nx-libs-3.5.99.23/ChangeLog0000644000000000000000000177351313614532424012105 0ustar 2020-01-30 11:49:59 +0100 Mike Gabriel (82fc54e57) * release 3.5.99.23 (HEAD -> 3.6.x, tag: 3.5.99.23) 2020-01-30 11:49:42 +0100 Mike Gabriel (bd5b20192) * debian/libnx-x11-6.symbols: Sync with .symbols file found in official Debian package. 2020-01-30 11:49:18 +0100 Mike Gabriel (deffba48d) * debian/rules: Adopt changes from official Debian package. 2020-01-30 10:59:17 +0100 Mike Gabriel (c8d69ebae) * Merge branch 'uli42-pr/fix_shadowed_vars' into 3.6.x (origin/HEAD, origin/3.6.x) 2020-01-25 21:23:55 +0100 Ulrich Sibiller (4821edfe0) * nxagent: rename variables that shadow globals (gh-uli42/pr/fix_shadowed_vars, uli42-pr/fix_shadowed_vars, pr/fix_shadowed_vars) 2020-01-25 15:50:04 +0100 Ulrich Sibiller (2adab2972) * Events.c: fix capslock weirdness (re-add lost code) 2020-01-09 23:44:33 +0100 Ulrich Sibiller (870746222) * compext/Clean.c: fix shadow warnings / scope 2020-01-09 23:18:17 +0100 Ulrich Sibiller (a94e8258f) * os: Fix -Wshadow errors 2020-01-09 23:06:08 +0100 Ulrich Sibiller (4b8194e1e) * mi: fix shadow warnings 2020-01-09 22:50:13 +0100 Ulrich Sibiller (1a1ace774) * _XkbFilterDeviceBtn: move variable declarations to match usage scope 2020-01-09 22:44:55 +0100 Ulrich Sibiller (914f88a8a) * XkbFindSrvLedInfo: remove extraneous name-clashing sli variable 2020-01-09 22:41:53 +0100 Ulrich Sibiller (ae180b6b5) * xkb: fix shadow warnings 2020-01-09 22:35:01 +0100 Ulrich Sibiller (3c3e11cb0) * CheckForEmptyMask does not need to declare int n twice 2020-01-08 23:43:15 +0100 Ulrich Sibiller (fbfef7e62) * Drawable.c: fix logic broken by scope cleanup 2020-01-09 21:57:43 +0100 Ulrich Sibiller (32b64d7d7) * Cursor.c: drop unused return code for nxagentDisconnectAllCursor 2020-01-09 21:52:15 +0100 Ulrich Sibiller (33fbc6211) * Pixmap.c: drop unused return code for nxagentDisconnectAllPixmaps 2020-01-09 21:44:30 +0100 Ulrich Sibiller (7977b9f8f) * Pixmap.c: fix variable shadowing 2020-01-09 21:25:31 +0100 Ulrich Sibiller (a93e25077) * Display.c: fix shadowed/unused variable 2020-01-09 21:13:02 +0100 Ulrich Sibiller (7031219d9) * Events.c: fix two shadowed variables 2020-01-09 21:01:34 +0100 Ulrich Sibiller (c137c2a4d) * Clipboard.c: fix shadowed variable 2020-01-09 20:54:53 +0100 Ulrich Sibiller (4953c651d) * nxagent: build with -Wshadow to detect shadowing variables 2020-01-09 20:52:23 +0100 Ulrich Sibiller (21079cf31) * Drawable.c: fix segfault 2020-01-08 00:10:20 +0100 Ulrich Sibiller (105cd2be6) * Rootless.c: fix wring datatype being used 2020-01-06 07:35:29 +0100 Mike Gabriel (bb9ac3fd3) * hw/nxagent/Splash.c Fix build on 32bit architecture. 2020-01-06 00:53:06 +0100 Mike Gabriel (67599026d) * Merge branch 'uli42-pr/various3' into 3.6.x 2019-12-16 18:50:17 +0100 Ulrich Sibiller (cf8797c3c) * Atoms.c: describe atoms usage (gh-uli42/pr/various3, uli42-pr/various3, pr/various3) 2019-12-16 18:50:17 +0100 Ulrich Sibiller (d2ac4ce35) * Atoms.c: describe atoms usage 2020-01-05 23:49:12 +0100 Ulrich Sibiller (bf9b70d7b) * Display.c: Fix broken code in TEST case 2020-01-04 18:30:23 +0100 Ulrich Sibiller (bf958eced) * Image.c: undo wrong string replacement nxagentBitmapBitOrder 2020-01-04 17:10:01 +0100 Ulrich Sibiller (61619be52) * Display.c: add a describing comment for nxagentDisplayErrorPredicate 2020-01-04 16:22:24 +0100 Ulrich Sibiller (209c8d8c5) * Screen.c: harmonize size/wmhints code 2020-01-04 15:41:25 +0100 Ulrich Sibiller (4b9466ff5) * Events.c: pass a Boolean to nxagentSwitchFullscreen 2020-01-04 15:33:27 +0100 Ulrich Sibiller (e276b23b3) * Keystroke.c: fix formatting of keystrokes 2020-01-04 15:17:26 +0100 Ulrich Sibiller (14aab54f4) * Init.h: Fix superfluous space 2020-01-03 14:06:31 +0100 Ulrich Sibiller (52cefdd7e) * Display.c: reformat some comments 2020-01-03 14:06:15 +0100 Ulrich Sibiller (141d6bea5) * Display.c: scope improvements 2020-01-02 23:55:37 +0100 Ulrich Sibiller (892804811) * Reconnect.c: fix typos 2020-01-02 21:12:16 +0100 Ulrich Sibiller (cdd381105) * Keyboard.c: improve keyboard output 2019-12-29 18:40:53 +0100 Ulrich Sibiller (cfa17ffac) * Error.c: mark NX changes 2019-12-29 12:45:20 +0100 Ulrich Sibiller (100b27892) * Keyboard.c: fix typo 2019-12-29 00:56:36 +0100 Ulrich Sibiller (b8b897e3f) * Remove the numVideoScreens xprintism. 2019-12-29 00:48:43 +0100 Ulrich Sibiller (12358d64a) * nxagent: remove another xprint renmant 2019-12-29 00:45:51 +0100 Ulrich Sibiller (662708b3d) * drop xprint remnants: xpstubs 2019-12-28 23:40:25 +0100 Ulrich Sibiller (2c03bd793) * nxagent: drop CYGWIN and WIN32 defines 2019-12-28 20:40:37 +0100 Ulrich Sibiller (f3aca240d) * Image.c: code simplification/scope 2019-12-28 20:04:33 +0100 Ulrich Sibiller (203891d11) * Screen.c: code simplification/scope 2019-12-28 20:00:59 +0100 Ulrich Sibiller (a6335cf3d) * Screen.c: fix handling of NX_SHADOW atom 2019-12-28 20:00:16 +0100 Ulrich Sibiller (c6a2fda07) * Screen.c: drop variable 2019-12-28 18:39:48 +0100 Ulrich Sibiller (576255425) * Window.c: code simplifications/scope 2019-12-28 18:39:31 +0100 Ulrich Sibiller (aa0662bbd) * Window.c: fix comment 2019-12-19 16:49:56 +0100 Ulrich Sibiller (d2f694360) * Rootless.c: fix wording 2019-12-18 00:32:26 +0100 Ulrich Sibiller (f5348bdc4) * X.Org bug 4947/Sun bug 6646626: Xv extension not byte-swapping properly 2019-12-17 23:20:03 +0100 Ulrich Sibiller (a894fa8bd) * NXproperty.c: simplify ChangeWindowProperty 2019-12-17 21:49:57 +0100 Ulrich Sibiller (11d9b74b6) * Events.c: improve debugging output 2018-11-07 22:19:17 +0100 Ulrich Sibiller (d409b566b) * os: unifdef WIN32 2018-11-07 22:28:32 +0100 Ulrich Sibiller (74270d6b7) * os: unifdef UNIXWARE 2018-11-07 22:27:49 +0100 Ulrich Sibiller (38ab9ad85) * os: unifdef __SCO__ 2018-11-07 22:24:59 +0100 Ulrich Sibiller (5fb7f53c6) * os: unifdef ISC 2019-12-03 22:54:14 +0100 Ulrich Sibiller (bccf81ea0) * NXdispatch.c: port forgotten patch 2019-12-03 22:42:24 +0100 Ulrich Sibiller (25677711b) * NXDispatch.c: mark NX changes 2019-05-03 22:46:33 +0200 Ulrich Sibiller (2b9a6ddc2) * NXdispatch.c: cleanup ProcCloseFont() 2019-05-03 23:50:45 +0200 Ulrich Sibiller (51e60ada3) * NXdispatch.c: add FIXME 2019-12-03 22:14:31 +0100 Ulrich Sibiller (e9ee4505a) * xkbsrv.h: drop non-existing externs 2019-05-25 17:29:17 +0200 Ulrich Sibiller (7c1bd6f52) * NX{mitrap,picture}.c: mark NX changes 2019-12-03 19:18:06 +0100 Ulrich Sibiller (66f0a85e9) * Pointer.c: code simplification 2019-12-03 19:17:47 +0100 Ulrich Sibiller (759f89aa2) * Pointer.c: use __func__ in fprintf 2019-12-03 19:02:42 +0100 Ulrich Sibiller (e9ee5a007) * xkbsrv.h: move extern XkbFreePrivates to central include file 2019-12-03 18:59:11 +0100 Ulrich Sibiller (3d77840c1) * xkbActions.c: fix formatting 2019-06-10 15:33:10 +0200 Ulrich Sibiller (047b7ff21) * Window.c: print internal window id as well 2019-12-03 18:42:17 +0100 Ulrich Sibiller (d3ae4a0ed) * mi: Avoid stack smash when drawing dashed lines 2020-01-06 00:07:19 +0100 Mike Gabriel (5a8f1e921) * nx-libs.spec: Don't install nxagent.xpm to any package. Not there anymore.. 2020-01-06 00:08:32 +0100 Mike Gabriel (fa2f21ec0) * (main) Makefile: Don't install nxagent.xpm during install-full target. 2020-01-05 23:50:21 +0100 Mike Gabriel (e89fb895a) * Merge branch 'uli42-pr/more_clipboard_improvements' into 3.6.x 2019-12-17 22:56:44 +0100 Ulrich Sibiller (30fb45b2a) * Clipboard.c: cleanup parentheses (gh-uli42/pr/more_clipboard_improvements, uli42-pr/more_clipboard_improvements, pr/more_clipboard_improvements) 2019-12-17 22:56:25 +0100 Ulrich Sibiller (d634f26bb) * Clipboard.c: extend/reformat some comments 2019-12-16 23:11:13 +0100 Ulrich Sibiller (d210c584c) * Clipboard.c: rename variables/atoms to better reflect their meaning 2019-12-16 22:47:23 +0100 Ulrich Sibiller (40c243fd2) * Clipboard.c: add clientCLIPBOARD variable 2019-12-16 22:17:02 +0100 Ulrich Sibiller (ee5cf733f) * Clipboard.c: change order of if clause to better match the comment above it 2019-12-16 18:42:04 +0100 Ulrich Sibiller (84382e916) * Clipboard.c: CLINDEX and GetXErrorString are only used for debugging 2019-12-16 18:35:47 +0100 Ulrich Sibiller (7cda10124) * Clipboard.c: flush more often to ensure a smooth clipboard experience 2019-12-16 18:32:39 +0100 Ulrich Sibiller (65877a199) * Clipboard.c: fix handling of clipboard=none/client/server/both option 2019-12-16 18:31:49 +0100 Ulrich Sibiller (80ab8932d) * Options.h: comment on the four clipboard options 2019-11-22 21:15:54 +0100 Ulrich Sibiller (68125b06e) * Clipboard.c: Use Find*Index helpers at more locations 2019-11-22 20:41:31 +0100 Ulrich Sibiller (feedae86b) * Clipboard.c: cosmetics/typo fix/untabify 2019-11-22 00:24:35 +0100 Ulrich Sibiller (6c0536a20) * Clipboard.c: introduce helper macro IS_INTERNAL_OWNER 2019-11-21 23:58:17 +0100 Ulrich Sibiller (2b59a1993) * Clipboard.c: simplify nxagentSetSelectionOwner 2019-11-21 23:57:10 +0100 Ulrich Sibiller (15ef70874) * Clipboard.c: describe nxagentFind*Index 2019-11-18 07:38:16 +0100 Ulrich Sibiller (5d1577abe) * Clipboard.c: reorder nxagentInitClipboard 2019-11-18 01:35:50 +0100 Ulrich Sibiller (634d4fc81) * Clipboard.c: clear all selections in nxagentInitClipboard 2019-11-18 01:11:26 +0100 Ulrich Sibiller (20120205b) * Clipboard.c: Fix: re-claim selection on reconnect 2019-11-18 00:56:27 +0100 Ulrich Sibiller (8500b4bc0) * Clipboard.c: reorder atom allocation code 2019-11-18 00:45:17 +0100 Ulrich Sibiller (7d9c5ad4d) * Clipboard: align reported targets 2019-11-17 23:28:53 +0100 Ulrich Sibiller (509ae051b) * Clipboard.c: check pointer before usage 2019-11-17 23:14:17 +0100 Ulrich Sibiller (eb51bcb6d) * Clipboard.c: drop superflous variable 2019-11-17 21:58:16 +0100 Ulrich Sibiller (8574c233a) * Clipboard.c: split combined check 2019-11-17 19:07:19 +0100 Ulrich Sibiller (28f07b526) * Clipboard.c: more debugging output 2019-11-17 19:06:59 +0100 Ulrich Sibiller (1d0d54730) * Clipboard.c: add more explaining comments 2019-11-17 19:00:59 +0100 Ulrich Sibiller (166102e07) * Clipboard.c: use macros instead of hardcoced values for timeouts 2019-11-17 18:56:54 +0100 Ulrich Sibiller (f05a2eca5) * Clipboard.c: fix timeout comparison 2019-11-17 18:00:55 +0100 Ulrich Sibiller (b2af0c686) * Clipboard: make nxagentInitClipboard return a Boolean 2019-11-17 17:59:08 +0100 Ulrich Sibiller (fa7fb7499) * Clipboard.c: avoid nested extern 2019-11-17 17:43:58 +0100 Ulrich Sibiller (8c36f1dd2) * Clipboard.c: fix string formatting directives 2019-11-17 17:42:27 +0100 Ulrich Sibiller (3a935c674) * Clipboard.c: Fix formatting 2019-11-17 17:30:14 +0100 Ulrich Sibiller (cc01d4992) * Clipboard.c, NXproperty.c: match prototypes 2019-11-17 16:29:24 +0100 Ulrich Sibiller (ffce5337d) * Clipboard.c: reformat some comments 2019-11-17 16:29:02 +0100 Ulrich Sibiller (9226abf66) * Clipboard.c: add FIXMEs 2019-11-17 16:28:18 +0100 Ulrich Sibiller (5540a1492) * Clipboard.c: add nxagentMatchSelectionOwner helper function 2019-11-17 16:27:15 +0100 Ulrich Sibiller (1feb4985e) * Clipboard.c: make agentClipboardStatus a Boolean 2019-11-17 11:47:39 +0100 Ulrich Sibiller (fba367160) * Clipboard.c: refactor nxagent*SelectionOwner 2020-01-05 23:34:09 +0100 Mike Gabriel (057ce728f) * Merge branch 'uli42-pr/strings_fixes' into 3.6.x 2020-01-05 23:17:19 +0100 Ulrich Sibiller (80b6d6b9c) * Error.c: simplify some NULL pointer checks (gh-uli42/pr/strings_fixes, uli42-pr/strings_fixes, pr/strings_fixes) 2019-12-29 13:36:06 +0100 Ulrich Sibiller (1d50b2ab3) * Error.c: drop now obsolete DEFAULT_STRING_LENGTH 2019-12-29 13:35:09 +0100 Ulrich Sibiller (609b23f19) * Error.c: make nxagentRootDir a pointer 2019-12-29 13:26:34 +0100 Ulrich Sibiller (d6cc85e56) * Error.c: make nxagentHomeDir a pointer 2019-12-29 13:15:30 +0100 Ulrich Sibiller (03544b3ab) * Error.c: make nxagentClientsLogName a pointer 2019-12-29 12:54:07 +0100 Ulrich Sibiller (2a4af0c74) * Error.c: fix format-truncation warning 2019-12-29 12:40:29 +0100 Ulrich Sibiller (ce43e4346) * Dialog.c: fix format-truncation warning 2020-01-05 23:21:39 +0100 Mike Gabriel (46ef20bdb) * Merge branch 'uli42-pr/custom_version_string' into 3.6.x 2017-12-15 00:48:35 +0100 Ulrich Sibiller (ec1b3a44c) * Add support for custom version string (gh-uli42/pr/custom_version_string, uli42-pr/custom_version_string, pr/custom_version_string) 2020-01-05 22:59:43 +0100 Mike Gabriel (04962efa9) * Merge branch 'uli42-pr/xlib_types' into 3.6.x 2019-12-28 21:02:14 +0100 Ulrich Sibiller (427b7b977) * nxagent: Use XlibAtom data type where appropriate (gh-uli42/pr/xlib_types, uli42-pr/xlib_types, pr/xlib_types) 2020-01-05 22:46:24 +0100 Mike Gabriel (a261b7243) * Merge branch 'uli42-pr/code_cleanup' into 3.6.x 2019-10-31 01:49:12 +0100 Ulrich Sibiller (adca0cc92) * Pixels.c: reformat comments (gh-uli42/pr/code_cleanup, uli42-pr/code_cleanup) 2019-10-31 01:48:18 +0100 Ulrich Sibiller (fc991b93a) * Pixels.c: scope improvements 2019-10-31 01:39:36 +0100 Ulrich Sibiller (6a02a6795) * Options.h: reformat 2019-10-31 01:33:54 +0100 Ulrich Sibiller (78bb80a84) * Options.c: reformat comments 2019-10-31 01:32:35 +0100 Ulrich Sibiller (024a2bc2e) * Pointer.c: scope improvements 2019-10-31 01:32:19 +0100 Ulrich Sibiller (c9549f3c9) * Pointer.c: reformat comments 2019-10-31 01:29:11 +0100 Ulrich Sibiller (22f01d23a) * Visual.{ch}: disable unused code 2019-10-31 01:28:51 +0100 Ulrich Sibiller (1bb0e999e) * Visual.c: reformat comments 2019-10-31 01:28:18 +0100 Ulrich Sibiller (5db6217cc) * Visual.c: code improvements/desginated initializers 2019-10-31 00:32:12 +0100 Ulrich Sibiller (bcca31996) * Split.c: scope improvements/code simplification 2019-10-31 00:31:28 +0100 Ulrich Sibiller (53b3d4df3) * Split.c: reformat comments 2019-09-06 14:56:46 +0200 Ulrich Sibiller (cb283d4aa) * Keyboard.c: code simplification / scope improvements 2019-09-06 14:40:10 +0200 Ulrich Sibiller (58415b560) * Keyboard.c: reformat comments 2019-09-06 14:37:29 +0200 Ulrich Sibiller (e3b440547) * Init.c: rewrite two function prototypes 2019-09-06 14:37:18 +0200 Ulrich Sibiller (c5c821482) * Init.c: reformat comments 2019-09-06 14:22:23 +0200 Ulrich Sibiller (d87988aa2) * Handlers.c: reformat comments 2019-09-06 04:08:21 +0200 Ulrich Sibiller (8e66435a5) * GCOps.c: code simplification / scope improvements 2019-09-06 04:05:37 +0200 Ulrich Sibiller (41bc1de98) * GCOps.c: reformat comments 2019-09-06 03:39:20 +0200 Ulrich Sibiller (193bda764) * GC.c: blank line cleanup 2019-09-06 03:38:37 +0200 Ulrich Sibiller (da60cb8ca) * GC.c: code simplifications / scope improvements 2019-09-06 03:37:53 +0200 Ulrich Sibiller (fb03e31e5) * GC.c: reformat comments 2019-09-06 01:44:19 +0200 Ulrich Sibiller (5b3af0182) * Font.c: scope improvements 2019-09-06 01:43:54 +0200 Ulrich Sibiller (7f636648c) * Font.c: reformat comments 2019-09-06 01:30:06 +0200 Ulrich Sibiller (6d783bac2) * Error.c: Code simplification 2019-09-06 01:23:29 +0200 Ulrich Sibiller (d94f47274) * Drawable.c: code simplifications / scope improvements 2019-09-06 01:20:36 +0200 Ulrich Sibiller (0133d4619) * Drawable.c: reformat comments 2019-09-06 00:30:05 +0200 Ulrich Sibiller (827defa14) * Display.c: remove blank lines 2019-09-06 00:29:14 +0200 Ulrich Sibiller (462ad036e) * Display.c: code simplification, scope improvements 2019-09-06 00:28:14 +0200 Ulrich Sibiller (88e3a37ad) * Display.c: reformat comments 2019-09-05 23:59:26 +0200 Ulrich Sibiller (7e8f638a9) * Dialog.c: use designated initializer 2019-09-05 23:58:44 +0200 Ulrich Sibiller (fab0e477e) * Dialog.c: shorten switch blocks 2019-09-05 23:54:57 +0200 Ulrich Sibiller (883654741) * Composite.c: scope improvement 2019-09-05 23:54:46 +0200 Ulrich Sibiller (dbe3cc1f7) * Composite.c: reformat comments 2019-09-05 23:53:31 +0200 Ulrich Sibiller (560b7c6c2) * Client.c: remove tailing whitespace 2019-09-05 23:48:04 +0200 Ulrich Sibiller (ab7113b79) * BitmapUtils.c: remove tailing whitespace 2019-10-30 23:53:03 +0100 Ulrich Sibiller (5275d2d03) * Cursor.c: use __func__ in fprintf calls 2019-09-05 23:40:45 +0200 Ulrich Sibiller (631092bb0) * Cursor.c: remove some blank lines 2019-09-05 23:40:03 +0200 Ulrich Sibiller (e72e2375f) * Cursor.c: scope improvements 2019-09-05 23:29:52 +0200 Ulrich Sibiller (129c8621f) * Image.c: remove some blank lines 2019-09-05 23:29:04 +0200 Ulrich Sibiller (5d3029a6c) * Image.c: scope improvements 2019-09-05 23:28:18 +0200 Ulrich Sibiller (f469ac534) * Image.c: reformat comments 2019-10-30 23:00:00 +0100 Ulrich Sibiller (e74eb7652) * Events.c: fix format specifiers 2019-10-30 21:58:47 +0100 Ulrich Sibiller (8dbfc1e45) * Event.c: use __func__ in fprintf 2019-09-05 22:57:13 +0200 Ulrich Sibiller (d501d48c3) * Events.c: use designated initializers 2019-09-05 22:56:12 +0200 Ulrich Sibiller (9358eaedc) * Events.c: Scope improvements/code simplification 2019-09-05 22:51:42 +0200 Ulrich Sibiller (ad89c7055) * Events.c: reformat switch blocks 2019-09-05 22:49:08 +0200 Ulrich Sibiller (36f679fb3) * Events.c: reformat comments 2019-05-26 11:58:01 +0200 Ulrich Sibiller (f48e2da3e) * miwindow.c: mark NX changes 2019-10-28 22:31:10 +0100 Ulrich Sibiller (1bd78de58) * NXmitrap.c: mark NX changes 2019-10-23 00:19:09 +0200 Ulrich Sibiller (8b796ee54) * Binder.c: reformat comments 2019-10-23 00:18:27 +0200 Ulrich Sibiller (19ba07472) * Handlers.c: reformat comments 2019-10-23 00:12:48 +0200 Ulrich Sibiller (9b1e29937) * Image.c: reformat comments 2019-10-22 23:45:23 +0200 Ulrich Sibiller (24cb46d24) * Error.c: reformat comments 2019-10-22 23:42:13 +0200 Ulrich Sibiller (b1d156888) * Display.c: reformat comments 2019-10-22 23:02:56 +0200 Ulrich Sibiller (838572f7b) * Dialog.c: save some lines 2019-10-22 22:56:08 +0200 Ulrich Sibiller (5067b1695) * Cursor.c: reformat comments 2019-10-22 22:40:49 +0200 Ulrich Sibiller (ace3d2d89) * Colormap.c: save some lines 2019-10-22 22:36:13 +0200 Ulrich Sibiller (fae611c91) * Client.c: save some lines 2019-10-22 22:25:11 +0200 Ulrich Sibiller (bbb23e586) * GC.c: condense code 2019-10-22 22:16:05 +0200 Ulrich Sibiller (c3a7e9b50) * GC.c: reformat comments 2019-10-22 22:01:16 +0200 Ulrich Sibiller (e0e602cf1) * GC.c: fix format specifiers and parameters 2019-10-22 21:56:11 +0200 Ulrich Sibiller (9d1a12134) * GCOps.c: fix format length specifiers 2019-10-22 21:55:08 +0200 Ulrich Sibiller (b9a4dea51) * GCOps.c: reformat comments 2019-10-22 23:42:44 +0200 Ulrich Sibiller (7860401b0) * Display.c: shorten code 2019-10-23 00:19:22 +0200 Ulrich Sibiller (44138137b) * Binder.c: scope improvements 2019-10-23 00:14:12 +0200 Ulrich Sibiller (d86cb00b6) * Image.c: scope improvements 2019-10-22 23:44:14 +0200 Ulrich Sibiller (d62155740) * Error.c: scope improvements 2019-10-22 22:57:18 +0200 Ulrich Sibiller (f0742c7fa) * Cursor.c: scope improvements 2019-10-22 22:15:42 +0200 Ulrich Sibiller (53f4386b9) * GC.c: scope improvements 2019-10-22 21:44:03 +0200 Ulrich Sibiller (95940104a) * GCOps.c: scope improvements 2020-01-05 22:10:31 +0100 Mike Gabriel (0e2b7479c) * Merge branch 'uli42-pr/simplify_nxrender' into 3.6.x 2019-05-31 00:34:49 +0200 Ulrich Sibiller (3bc01d1b8) * NXrender.c: call upstream versions of (S)ProcRenderDispatch (gh-uli42/pr/simplify_nxrender, uli42-pr/simplify_nxrender, pr/simplify_nxrender) 2019-05-25 17:51:47 +0200 Ulrich Sibiller (e5a93849b) * NXrender.c: modify code to match upstream as close as possible 2019-10-28 20:48:46 +0100 Ulrich Sibiller (5b6da1aa7) * NXrender.c: mark NX changes 2019-05-31 00:52:59 +0200 Ulrich Sibiller (730876f8f) * NXrender.c, render.c: fix memory handling bugs 2020-01-05 21:50:39 +0100 Mike Gabriel (60e0566d8) * Merge branch 'uli42-pr/fix_keyconv_on_reconnect' into 3.6.x 2020-01-03 01:01:24 +0100 Ulrich Sibiller (6f390f820) * nxagent: remove additional keyboard handling from Reconnect.c (gh-uli42/pr/fix_keyconv_on_reconnect, uli42-pr/fix_keyconv_on_reconnect, pr/fix_keyconv_on_reconnect) 2020-01-03 00:20:49 +0100 Ulrich Sibiller (a59020b1d) * nxagent: central check for keyboard clone mode 2020-01-02 23:37:24 +0100 Ulrich Sibiller (69443952b) * Args.c: more debug output 2020-01-02 23:17:04 +0100 Ulrich Sibiller (925f58992) * Args.c: do not parse nx/nx marker as option 2020-01-02 23:16:13 +0100 Ulrich Sibiller (ee3afe303) * Args.c: fix: do not modify options string 2020-01-02 22:15:06 +0100 Ulrich Sibiller (8fa4d842d) * Keyboard.c: scope cleanups 2020-01-02 21:23:11 +0100 Ulrich Sibiller (15bfec7a5) * Keyboard.c: Use __func__ at fprintf calls 2020-01-02 21:11:56 +0100 Ulrich Sibiller (4c8568caa) * Keyboard.c: use "\0" instead of "0" 2020-01-02 21:10:40 +0100 Ulrich Sibiller (bbe2c2ab9) * Keyboard.c: fix: handle empty string 2020-01-05 21:41:05 +0100 Mike Gabriel (cf24c658a) * Merge branch 'uli42-pr/drop_icon_file_support' into 3.6.x 2020-01-03 14:36:23 +0100 Ulrich Sibiller (3cd622cf4) * Display.c: drop icon file support (uli42-pr/drop_icon_file_support, pr/drop_icon_file_support) 2020-01-05 16:01:26 +0100 Mike Gabriel (475961e65) * Merge branch 'uli42-pr/fix_startup_slowness' into 3.6.x 2020-01-05 00:22:37 +0100 Ulrich Sibiller (72af2d5e1) * nxagent.xpm: reduce colours from 242 to 8 (gh-uli42/pr/fix_startup_slowness, uli42-pr/fix_startup_slowness) 2020-01-05 00:19:01 +0100 Ulrich Sibiller (86d2dcf09) * x2goagent.xpm: move copyright to the end to make it a valid xpm file 2019-11-24 00:03:10 +0100 Mike Gabriel (226be98c8) * Merge branch 'uli42-pr/manpages_updates' into 3.6.x 2019-11-18 08:56:26 +0100 Ulrich Sibiller (16c18714b) * nxagent manpage: improve descriptions and types (gh-uli42/pr/manpages_updates, uli42-pr/manpages_updates, pr/manpages_updates) 2019-11-18 08:18:27 +0100 Ulrich Sibiller (408cfc390) * nxagent manpage: extend clipboard documentation 2019-11-23 23:59:51 +0100 Mike Gabriel (15647323c) * Merge branch 'uli42-pr/silence_mesa' into 3.6.x 2019-11-18 20:20:54 +0100 Ulrich Sibiller (585334183) * Mesa: silence "maybe uninitialized" warnings (gh-uli42/pr/silence_mesa, uli42-pr/silence_mesa, pr/silence_mesa) 2019-11-15 22:58:14 +0100 Mike Gabriel (a040e73ab) * Merge branch 'uli42-pr/utf8_clipboard' into 3.6.x 2019-11-15 22:04:11 +0100 Ulrich Sibiller (cfaf59728) * Clipboard.c: report more supported targets (gh-uli42/pr/utf8_clipboard, uli42-pr/utf8_clipboard) 2019-11-15 22:01:09 +0100 Ulrich Sibiller (9681d039c) * Clipboard: fix debugging output 2019-11-15 21:53:50 +0100 Ulrich Sibiller (a41e23c06) * Clipboard.c: automatically calc the array size 2019-11-15 21:48:43 +0100 Ulrich Sibiller (2161fa2bd) * Clipboard.c: improve XChangeProperty code 2019-11-15 12:18:07 +0100 Mike Gabriel (6f5e483cd) * Merge branch 'uli42-pr/cleanup_rootless' into 3.6.x 2019-10-30 20:08:20 +0100 Ulrich Sibiller (4579207e6) * Rootless.c: rewrite loop to allow for scope improvements (gh-uli42/pr/cleanup_rootless, uli42-pr/cleanup_rootless, pr/cleanup_rootless) 2019-10-30 20:07:33 +0100 Ulrich Sibiller (c75cdd100) * Rootless.c: fix linefeeds when printing lists 2019-10-30 19:45:53 +0100 Ulrich Sibiller (9e5d72c0e) * Rootless.c: silence compiler warning about wrong parmeter sizes 2019-10-30 19:45:28 +0100 Ulrich Sibiller (63f6c1e70) * Rootless.c: disable unused function 2019-10-30 19:45:00 +0100 Ulrich Sibiller (e319268ae) * Rootless.c: silence compiler warnings about wrong fromat specifiers 2019-10-30 19:30:02 +0100 Ulrich Sibiller (917d4b3c5) * Rootless.c: Fatal error if malloc fails 2019-10-28 16:45:06 +0100 Ulrich Sibiller (4ebd5fcd3) * Rootless.c: cleanup function prototypes 2019-10-28 16:44:43 +0100 Ulrich Sibiller (6d62b2c02) * Rootless.c: reformat comments 2019-10-28 16:44:13 +0100 Ulrich Sibiller (0f7c5e2a7) * Rootless.c: scope improvements 2019-10-28 16:42:00 +0100 Ulrich Sibiller (41f6f3eec) * Rootless.c: use __func__ instead of hardcoded function name 2019-10-28 16:04:03 +0100 Ulrich Sibiller (a43c50bb2) * Rootless.c: use designated initializers 2019-11-15 12:15:48 +0100 Mike Gabriel (1664e1051) * Merge branch 'uli42-pr/simplify_pixmap' into 3.6.x 2019-10-29 01:12:59 +0100 Ulrich Sibiller (bc42d11f9) * Pixmap.c: reformat comments (gh-uli42/pr/simplify_pixmap, uli42-pr/simplify_pixmap, pr/simplify_pixmap) 2019-10-29 01:12:01 +0100 Ulrich Sibiller (ec1aac45e) * Pixmap.c: scope improvements 2019-10-29 01:13:34 +0100 Ulrich Sibiller (6c44480de) * Pixmap.c: drop code that does not make sense 2019-06-11 23:46:20 +0200 Ulrich Sibiller (0535c49ca) * Pixmap.c: call miModifyPixmapHeader twice instead of duplicating code 2019-11-15 12:11:22 +0100 Mike Gabriel (db74c07e6) * Merge branch 'uli42-pr/args_fixes' into 3.6.x 2019-10-28 12:31:04 +0100 Ulrich Sibiller (6ef35a94e) * Args.c: reformat switch blocks (gh-uli42/pr/args_fixes, uli42-pr/args_fixes, pr/args_fixes) 2019-10-28 11:53:56 +0100 Ulrich Sibiller (1dd8276fb) * Args.c: Unify formatting 2019-10-28 11:53:03 +0100 Ulrich Sibiller (e9eb3bef2) * Args.c: do not print function name in errors or warnings 2019-10-28 11:52:40 +0100 Ulrich Sibiller (484691334) * Args.c: scope improvements 2019-06-22 22:11:34 +0200 Ulrich Sibiller (5bb948660) * Args.c: simplify options string allocation 2019-06-22 19:42:22 +0200 Ulrich Sibiller (0755f3d6c) * Args.c: fix clipboard=0 or -clipboard 0 2019-06-22 19:39:17 +0200 Ulrich Sibiller (500683ab5) * Args.c: remove unreachable code 2019-06-22 19:26:56 +0200 Ulrich Sibiller (773fdb6a8) * Args.c: fix unitialized variable 2019-11-02 11:49:57 +0100 Mike Gabriel (1ae0ceb7c) * Merge branch 'uli42-pr/simplify_glxext' into 3.6.x 2019-05-01 21:52:02 +0200 Ulrich Sibiller (f3bddad4c) * NXglxext.c: use upstream versions of Dispatch functions (gh-uli42/pr/simplify_glxext, uli42-pr/simplify_glxext, pr/simplify_glxext) 2019-11-02 11:40:04 +0100 Mike Gabriel (eb8c16ef9) * Merge branch 'uli42-pr/simplify_nxwindow' into 3.6.x 2019-05-01 14:10:17 +0200 Ulrich Sibiller (7675af8e1) * NXwindow.c: use upstream function DeleteWindow() (gh-uli42/pr/simplify_nxwindow, uli42-pr/simplify_nxwindow, pr/simplify_nxwindow) 2019-09-01 14:57:27 +0200 Ulrich Sibiller (cf0571bb4) * NXwindow.c: call InitRootWindow from dix 2019-10-28 14:30:07 +0100 Ulrich Sibiller (5327a85b7) * NXwindow.c: mark NX changes 2019-10-28 14:06:47 +0100 Ulrich Sibiller (aab723eab) * NXwindow.c: drop own UnmapWindow() 2019-05-01 11:59:12 +0200 Ulrich Sibiller (40a4fae66) * NXwindow.c: call upstream version UnmapWindow() 2019-11-02 11:37:00 +0100 Mike Gabriel (5f806ddfd) * Merge branch 'uli42-pr/simplify_nxglyph' into 3.6.x 2019-06-12 00:54:40 +0200 Ulrich Sibiller (fcbd27105) * NXglyph.c: mark NX changes (gh-uli42/pr/simplify_nxglyph, uli42-pr/simplify_nxglyph, pr/simplify_nxglyph) 2019-05-22 23:58:15 +0200 Ulrich Sibiller (67b03f5d5) * NXglyph.c: adapt FindGlyph() to better match render/glyph.c 2019-05-22 23:35:12 +0200 Ulrich Sibiller (73f88998a) * NXglyphcurs.c: use dixChangeCG() 2019-11-02 11:34:00 +0100 Mike Gabriel (03d31d2ab) * Merge branch 'uli42-pr/simplify_nxxvdisp' into 3.6.x 2019-05-01 02:35:56 +0200 Ulrich Sibiller (280cf1264) * Simplify (NX)xvdisp.c (gh-uli42/pr/simplify_nxxvdisp, uli42-pr/simplify_nxxvdisp, pr/simplify_nxxvdisp) 2019-11-02 11:31:26 +0100 Mike Gabriel (fdd1e538b) * Merge branch 'uli42-pr/simplify_nxdispatch' into 3.6.x 2019-10-28 22:30:54 +0100 Ulrich Sibiller (0fb6af25c) * NXdispatch.c: mark NX changes (gh-uli42/pr/simplify_nxdispatch, uli42-pr/simplify_nxdispatch, pr/simplify_nxdispatch) 2019-05-03 23:50:45 +0200 Ulrich Sibiller (c61ac23f2) * NXdispatch.c: simplify InitClientPrivates() 2019-05-03 23:15:02 +0200 Ulrich Sibiller (24c42813d) * NXdispatch.c: call upstream CloseDownClient() 2019-05-03 19:18:20 +0200 Ulrich Sibiller (c02ab70ef) * NXdispatch.c: Simplify InitSelections() 2019-11-02 11:21:39 +0100 Mike Gabriel (718a58fb1) * Merge branch 'uli42-pr/simplify_nxextension' into 3.6.x 2019-10-28 20:30:23 +0100 Ulrich Sibiller (e54d2a390) * nxagent: drop NXextension.c (gh-uli42/pr/simplify_nxextension, uli42-pr/simplify_nxextension, pr/simplify_nxextension) 2019-05-05 15:04:55 +0200 Ulrich Sibiller (9120d1b72) * NXextension.c: use ProcListExtensions() from dix 2019-05-05 15:01:00 +0200 Ulrich Sibiller (8e9e77665) * NXextension.c: use ProcQueryExtension() from dix 2019-11-02 11:18:39 +0100 Mike Gabriel (d6872d4e0) * Merge branch 'uli42-pr/simplify_nxshm' into 3.6.x 2019-05-30 23:24:16 +0200 Ulrich Sibiller (6fd0ffc99) * NXshm.c: call upstream miShmPutImage (gh-uli42/pr/simplify_nxshm, uli42-pr/simplify_nxshm, pr/simplify_nxshm) 2019-05-01 11:43:14 +0200 Ulrich Sibiller (a9bdfd217) * NXshm.c: use upstream versions of Dispatch functions 2019-05-01 11:07:21 +0200 Ulrich Sibiller (e755e6600) * NXshm.c: rework code to be identical for ProcShmDispatch and SProcShmDispatch 2019-11-02 11:14:34 +0100 Mike Gabriel (7afe95535) * Merge branch 'uli42-pr/drop_holders' into 3.6.x 2019-10-23 21:20:39 +0200 Ulrich Sibiller (dbf36ece3) * nxagent: drop Holder.[ch] (gh-uli42/pr/drop_holders, uli42-pr/drop_holders, pr/drop_holders) 2019-10-23 21:11:43 +0200 Ulrich Sibiller (cbc9f831c) * Drop unused placeholder code 2019-11-01 16:44:08 +0100 Mike Gabriel (7b63809ae) * Merge branch 'uli42-pr/fix_broken_damage' into 3.6.x 2019-10-30 18:34:05 +0100 Ulrich Sibiller (2a0994122) * Drop NXdamage.c (gh-uli42/pr/fix_broken_damage, uli42-pr/fix_broken_damage, pr/fix_broken_damage) 2019-10-30 18:26:31 +0100 Ulrich Sibiller (83d9cd4e9) * damage: Don't rewrite Text ops to GlyphBlt ops 2019-10-30 17:50:44 +0100 Ulrich Sibiller (ca7c1c861) * NXdamage.x fix wrong backport 2019-11-01 16:37:37 +0100 Mike Gabriel (753535e39) * Merge branch 'uli42-pr/simplify_nxevents' into 3.6.x 2019-10-28 19:58:38 +0100 Ulrich Sibiller (283e4523a) * NXevents.c: add some explanations from the original changelog (gh-uli42/pr/simplify_nxevents, uli42-pr/simplify_nxevents, pr/simplify_nxevents) 2019-10-28 17:45:49 +0100 Ulrich Sibiller (6ed435e44) * NXevents.c: use XYToWindow from dix 2019-05-22 21:56:39 +0200 Ulrich Sibiller (f887d428c) * NXevents.c: call upstream ProcAllocEvents() 2019-05-22 21:43:33 +0200 Ulrich Sibiller (582618af8) * NXEvents.c: mark NX specific code 2019-05-22 21:35:05 +0200 Ulrich Sibiller (4c5331afa) * NXevents.c: call upstream DefineInitialRootWindow() 2019-05-22 21:20:32 +0200 Ulrich Sibiller (b64e1f60b) * NXevents.c: call upstream version of ProcSendEvent() 2019-05-05 16:14:26 +0200 Ulrich Sibiller (a66037786) * NXevents.c: call upstream versions of (De)ActivatePointerGrab() 2019-11-01 16:21:13 +0100 Mike Gabriel (bdcb5a188) * Merge branch 'uli42-pr/work_on_xau' into 3.6.x 2019-10-04 21:13:35 +0200 Ulrich Sibiller (c590c6472) * Xau files: adapt code to match upstream libXau 1.0.9 (gh-uli42/pr/work_on_xau, uli42-pr/work_on_xau, pr/work_on_xau) 2019-10-04 21:05:49 +0200 Ulrich Sibiller (5929dfdeb) * AuRead.c: remove redundant null check on calling free() 2019-10-04 21:03:47 +0200 Ulrich Sibiller (9deebfc8f) * AuRead.c: whitespace cleanup 2019-10-04 21:01:59 +0200 Ulrich Sibiller (a7355c5c8) * Xau: mark NX changes 2019-10-19 08:49:09 +0200 Mihai Moldovan (e721ba296) * Merge branch 'uli42-pr/fix_rebuild' into 3.6.x 2019-09-28 21:32:07 +0200 Ulrich Sibiller (b55c66e8a) * nxagent/Imakefile: remove ../../exports/lib 2019-10-10 11:37:04 +0200 Mihai Moldovan (c68a579eb) * Merge branch 'uli42-pr/fix_fullscreen_memleak' into 3.6.x 2019-10-03 23:39:01 +0200 Ulrich Sibiller (646e3ce24) * Screen.c: cleanup code a bit (gh-uli42/pr/fix_fullscreen_memleak) 2019-10-03 23:31:29 +0200 Ulrich Sibiller (8482abd31) * Screen.c: fix a memleak 2019-10-10 11:23:55 +0200 Mihai Moldovan (994305ff4) * Merge branch 'uli42-pr/fix_segfault' into 3.6.x 2019-10-03 23:05:20 +0200 Ulrich Sibiller (dc7a78b45) * Fix segfault in argument parsing (gh-uli42/pr/fix_segfault) 2019-09-29 17:58:09 +0200 Mike Gabriel (5405447e5) * Merge branch 'uli42-pr/clipboard_overhaul' into 3.6.x 2019-08-09 11:03:16 +0200 Ulrich Sibiller (72c022406) * Clipboard.c: rename nxagentNotifySelection to nxagentHandleSelectionNotifyFromXServer (gh-uli42/pr/clipboard_overhaul, uli42-pr/clipboard_overhaul, pr/clipboard_overhaul) 2019-08-08 22:55:52 +0200 Ulrich Sibiller (6663cbe68) * Clipboard.c: fix nested clipboard handling 2019-08-08 22:48:38 +0200 Ulrich Sibiller (ae44a8cd5) * Clipboard.c: add some more FIXMEs 2019-08-08 21:45:39 +0200 Ulrich Sibiller (899339f5a) * Clipboard.c: drop old commented code 2019-08-08 21:44:15 +0200 Ulrich Sibiller (21598c7e2) * Clipboard.c: fix: translate target on transfer 2019-08-08 21:33:48 +0200 Ulrich Sibiller (b5cac6722) * Clipboard.c: flush the display during transfer phase 2019-08-08 21:23:39 +0200 Ulrich Sibiller (4db1172ae) * Clipboard.c: remove superflous return 2019-08-08 21:17:37 +0200 Ulrich Sibiller (1c36e49ad) * Clipboard.c: drop unneeded return code 2019-08-08 21:17:12 +0200 Ulrich Sibiller (bf87f8bbe) * Clipboard.c: add loads of comments 2019-08-08 20:48:44 +0200 Ulrich Sibiller (e985f7111) * Clipboard.c: rework debug prints 2019-08-06 22:54:55 +0200 Ulrich Sibiller (92ad24a3b) * Clipboard.c: translate internal to external atom 2019-08-05 18:22:00 +0200 Ulrich Sibiller (9a144136d) * Clipboard.c: remove unneccessary return 2019-08-05 18:00:49 +0200 Ulrich Sibiller (1bf68e328) * Clipboard.c: whitespace fixes 2019-08-05 17:57:37 +0200 Ulrich Sibiller (a6c57d6ff) * Clipboard.c: improve readability by using an if clause 2019-08-05 17:54:55 +0200 Ulrich Sibiller (249e4321c) * Clipboard.c: introduce nxagentInitSelectionOwner 2019-08-05 17:52:34 +0200 Ulrich Sibiller (b393bca69) * Clipboard.c: scope improvements 2019-08-05 17:41:48 +0200 Ulrich Sibiller (cb3e44a17) * Clipboard.c: Refactor nxagentCollectPropertyEvent 2019-08-05 17:14:06 +0200 Ulrich Sibiller (9006e19aa) * Clipboard.c: cleanup in nxagentRequestSelection 2019-08-05 17:07:25 +0200 Ulrich Sibiller (6f071341b) * Clipboard.c: use designated initializers where appropriate 2019-08-05 16:56:57 +0200 Ulrich Sibiller (1af01db33) * Clipboard.c: factor out nxagentReplyRequestSelection 2019-08-05 16:48:01 +0200 Ulrich Sibiller (5e2487108) * Clipboard.c: TIMESTAMP is a special server target 2019-08-05 16:27:38 +0200 Ulrich Sibiller (f99f52772) * Clipboard.c: introduce macros CLINDEX and WINDOWID 2019-08-05 16:36:10 +0200 Ulrich Sibiller (63320437e) * Clipboard.c: simplify nxagentGetClipboardWindow 2019-08-05 16:18:51 +0200 Ulrich Sibiller (1d05784b4) * Clipboard.c: drop serverCLIPBOARD 2019-08-05 16:16:30 +0200 Ulrich Sibiller (e34f152c9) * Clipboard.c: clientAccum is only used for debugging, add DEBUG ifdefs 2019-08-05 16:13:47 +0200 Ulrich Sibiller (98a0810ff) * Clipboard.c: rename some variables 2019-08-05 16:08:40 +0200 Ulrich Sibiller (5de8bac22) * Clipboard.c: introduce nxagentFind*Index functions 2019-08-05 15:51:42 +0200 Ulrich Sibiller (79867f4a0) * Clipboard.c: introduce nxagent{Clear,Store}SelectionOwner 2019-08-04 01:28:59 +0200 Ulrich Sibiller (6621c53c5) * Clipboard.c: Fix: report timestamps as XA_INTEGER 2019-08-04 01:09:06 +0200 Ulrich Sibiller (6d5cda478) * Clipboard.c: improve TARGETS request handling 2019-08-04 00:51:06 +0200 Ulrich Sibiller (25cbfd14f) * Clipboard.c: merge endTransfer and nxagentSendSelectionNotify 2019-08-04 00:17:01 +0200 Ulrich Sibiller (7d0683701) * Clipboard.c: introduce SendSelectionNotifyEventToClient helper 2019-08-03 23:58:29 +0200 Ulrich Sibiller (c233eec5f) * Clipboard.c: introduce SendEventToClient helper 2019-08-03 23:43:27 +0200 Ulrich Sibiller (2ee7626a6) * Clipboard.c: introduce SendSelectionNotifyEventToServer 2019-08-03 23:26:02 +0200 Ulrich Sibiller (bc997cf64) * Clipboard.c: introduce central function to abort the transfer 2019-08-03 23:20:42 +0200 Ulrich Sibiller (f14e80077) * Clipboard.c: do not send notify when pointer is NULL 2019-09-29 17:39:48 +0200 Mike Gabriel (3a3a3373c) * Merge branch 'uli42-pr/various2' into 3.6.x 2019-09-19 00:11:05 +0200 Ulrich Sibiller (085f8a4f6) * nxcompshad: delete trailing whitespace (gh-uli42/pr/various2, uli42-pr/various2, pr/various2) 2019-09-18 23:47:24 +0200 Ulrich Sibiller (506378cf2) * nxcompshad: fix logging segfault 2019-09-06 02:22:26 +0200 Ulrich Sibiller (df9d37da5) * GC.c: introduce helper macros for GC management 2019-09-05 22:57:57 +0200 Ulrich Sibiller (9693d8b98) * Events.c: drop unused function 2019-09-06 14:30:39 +0200 Ulrich Sibiller (9512e6451) * Holder.c: remove superflous return 2019-09-06 14:50:24 +0200 Ulrich Sibiller (bf700ec9e) * Keyboard.c: condense keycode conversion table 2019-09-06 00:30:16 +0200 Ulrich Sibiller (2682c9407) * Display.c: fix format 2019-09-06 01:44:33 +0200 Ulrich Sibiller (f6cdd0f92) * Font.c: add FIXME 2019-09-05 23:29:22 +0200 Ulrich Sibiller (0a8027135) * Image.c: fix indentation 2019-09-05 22:15:20 +0200 Ulrich Sibiller (602d4b82b) * Events.c: add nxagentSwitchEventsAllScreens helper 2019-09-05 21:43:23 +0200 Ulrich Sibiller (15ac7a809) * Trap.h: shorten file 2019-09-05 20:47:15 +0200 Ulrich Sibiller (f323ada3c) * nxagent: move atom initiatialization to Init.c 2019-09-05 20:32:24 +0200 Ulrich Sibiller (4fa0ea268) * Events.c: whitespace fixes 2019-09-05 20:13:03 +0200 Ulrich Sibiller (8fc7a8057) * Render.c: remove some more unused functions 2019-09-05 19:47:35 +0200 Ulrich Sibiller (fd274d058) * Render.c: remove lots of superflous empty lines 2019-09-05 19:44:39 +0200 Ulrich Sibiller (1a9d96e07) * Render.c: reformat comments 2019-09-05 19:17:53 +0200 Ulrich Sibiller (56aaea90b) * Render.c: Code simplifications 2019-09-05 19:07:14 +0200 Ulrich Sibiller (6275bbc6f) * Render.c: remove empty lines around XSync calls 2019-09-05 19:04:42 +0200 Ulrich Sibiller (45f6e41c4) * Render.c: make nxagentPrintFormat a NOP in normal mode 2019-09-05 17:58:55 +0200 Ulrich Sibiller (7d8323a4a) * nxagent: simplify nxagentRenderRealizeCursor 2019-09-01 23:03:11 +0200 Ulrich Sibiller (7ca51c529) * Render.c. simplify nxagentMatchingFormats 2019-09-01 23:04:59 +0200 Ulrich Sibiller (087b082c7) * Render.c: fix broken comment 2019-09-05 18:08:03 +0200 Ulrich Sibiller (1c019bd1f) * Render.c: drop unused nxagentDestroyPictureClip 2019-09-01 23:08:18 +0200 Ulrich Sibiller (59ea22458) * Render.c: drop unused nxagentRasterizeTrapezoid 2019-09-01 23:02:50 +0200 Ulrich Sibiller (8aac9b617) * Render.c: drop unused nxagentValidatePicture 2019-09-01 15:41:03 +0200 Ulrich Sibiller (2f2a8ee00) * Init.c: some scope improvements 2019-09-01 15:27:52 +0200 Ulrich Sibiller (c6498ddb7) * Screen.h: add missing prototype for nxagentPropagateArtsdProperties() 2019-09-01 15:25:48 +0200 Ulrich Sibiller (82c096ee2) * Atoms.[ch]: drop unused return code of nxagentInitAtoms() 2019-07-04 07:47:19 +0200 Ulrich Sibiller (39866f5c1) * Events.c: scope improvements 2019-08-03 23:16:05 +0200 Ulrich Sibiller (1920599e1) * Clipboard.c: whitespace fixes 2019-08-01 23:37:56 +0200 Ulrich Sibiller (4d3bd06ce) * NXdixfonts.c: use NXAGENT_SERVER instead of NX_TRANS_SOCK 2019-08-01 23:18:03 +0200 Ulrich Sibiller (b1850beb9) * nxagent: avoid nested externs 2019-08-01 00:13:07 +0200 Ulrich Sibiller (7d2a222f2) * xkb: replace NX_TRANS_SOCKET by NXAGENT_SERVER 2019-08-01 00:02:42 +0200 Ulrich Sibiller (71fca41ff) * Screen.c: fix wrong format character 2019-07-31 23:43:21 +0200 Ulrich Sibiller (c54feb0bd) * Window.c: reactivate disabled debug code 2019-07-31 23:33:50 +0200 Ulrich Sibiller (84867ad0f) * Screen.c: fix typo 2019-07-31 23:20:07 +0200 Ulrich Sibiller (a514a7e29) * Screen.c: improve readability 2019-07-31 23:18:41 +0200 Ulrich Sibiller (a91e34a8a) * Imakefile: make NXAGENT_RANDR_MODE_PREFIX configurable via macro 2019-07-31 22:34:24 +0200 Ulrich Sibiller (3b94b9c64) * Imakefile: Cleanup defines 2019-07-29 16:07:37 +0200 Ulrich Sibiller (e2fa4f5c4) * Colormap.c: Formatting and scope improvements 2019-07-29 00:01:17 +0200 Ulrich Sibiller (19267ddf4) * Screen.c: fix typo in TEST output 2019-07-26 00:07:28 +0200 Ulrich Sibiller (c36efbd37) * Screen.c: scope improvements 2019-07-25 23:58:30 +0200 Ulrich Sibiller (fc7cb8657) * Pixels.c: scope improvements 2019-07-25 23:53:57 +0200 Ulrich Sibiller (f8a1f79b3) * Colormap.c: scope improvements 2019-07-24 00:02:51 +0200 Ulrich Sibiller (8f609404c) * NXproperty.c: prevent deletion of NX_AGENT_VERSION property 2018-05-05 18:58:27 +0200 Ulrich Sibiller (9dca2c598) * Split.c: whitespace fixes 2019-07-23 22:30:33 +0200 Ulrich Sibiller (cccb25fa7) * Screen.c: code cleanup 2019-07-23 21:31:40 +0200 Ulrich Sibiller (17e0265a4) * Screen.c: fix: use bit operator, not logic operator 2019-07-23 21:29:27 +0200 Ulrich Sibiller (b8751fca8) * Atoms.c: remove unused parameter from nxagentInitAtoms 2019-07-23 21:25:41 +0200 Ulrich Sibiller (1f71a75f5) * Atoms.c: code cleanup 2019-07-23 21:25:02 +0200 Ulrich Sibiller (a61102b62) * Atoms.c: fix wrong variable reference 2019-07-23 21:24:44 +0200 Ulrich Sibiller (6dd6e695a) * Atoms.c: add FIXME 2018-11-09 01:54:22 +0100 Ulrich Sibiller (2fbefa708) * Events.c: code improvements (mainly scope) 2018-11-09 00:23:20 +0100 Ulrich Sibiller (9da26af35) * code-versions.txt: adapt os version information 2018-11-07 19:50:21 +0100 Ulrich Sibiller (db0187b05) * code-versions.txt: Update composite version 2018-11-08 00:12:56 +0100 Ulrich Sibiller (3a581f165) * {render,randr}/Imakefile: remove hw/kdrive from include path 2019-06-21 15:17:04 +0200 Ulrich Sibiller (59f1d3737) * NXrender.c: fix possible memory leak 2019-06-24 21:30:11 +0200 Ulrich Sibiller (157c8c7f3) * Clipboard.c: fix wrong variable being printed in debugging output 2019-06-24 21:39:45 +0200 Ulrich Sibiller (084d9cb54) * NXdispatch.c: replace hardcoded values by variables from Clipboard.c 2019-07-02 21:03:10 +0200 Ulrich Sibiller (7a2836f8d) * Update currentTime in dispatch loop 2019-07-02 19:55:20 +0200 Ulrich Sibiller (2589a1349) * Events.c: fix wrong size in format specification 2019-07-03 22:05:58 +0200 Ulrich Sibiller (41e1d4961) * nxagent: drop unused DisplayLatency 2019-06-30 15:55:26 +0200 Ulrich Sibiller (c539e0ca5) * NXproperty.c: reformat GetWindowProperty to increase readability 2019-06-30 17:56:09 +0200 Ulrich Sibiller (7fa6c8808) * Events.c: identify internal root window in nxagentInternalWindowInfo 2019-06-30 17:55:51 +0200 Ulrich Sibiller (94c7091bc) * Events.c: add FIXME 2019-06-30 17:35:47 +0200 Ulrich Sibiller (7404d2178) * Events.c: fix wrong returncode interpretation 2019-06-30 17:16:08 +0200 Ulrich Sibiller (3d37db071) * Events.c: shorten window tree debugging code 2019-06-30 17:15:05 +0200 Ulrich Sibiller (022d64d2a) * Events.c: fix write after buffer end 2019-06-30 16:42:22 +0200 Ulrich Sibiller (061f7dc9f) * Events.c: nxagentInternalWindowInfo is only called with DEBUG_TREE 2019-07-05 19:41:04 +0200 Ulrich Sibiller (0153bf6b7) * Atoms.c: fix wrong fprintf format 2019-09-29 16:59:53 +0200 Mike Gabriel (796c8e421) * Merge branch 'uli42-pr/drop_faulty_render_check' into 3.6.x 2019-09-01 21:22:17 +0200 Ulrich Sibiller (5aee32e9d) * nxagent: drop nxagentRenderTrap (gh-uli42/pr/drop_faulty_render_check, uli42-pr/drop_faulty_render_check, pr/drop_faulty_render_check) 2019-09-29 16:54:08 +0200 Mike Gabriel (c577775f9) * Merge branch 'sunweaver-pr/add-autograb-to-known-keystrokes-printout' into 3.6.x 2019-09-17 16:28:41 +0200 Mike Gabriel (4819712a9) * Keystroke.c: Grammar fix in stdout message (Current known -> Currently known). (gh-sunweaver/pr/add-autograb-to-known-keystrokes-printout, sunweaver-pr/add-autograb-to-known-keystrokes-printout, pr/add-autograb-to-known-keystrokes-printout) 2019-08-27 15:46:37 +0200 Mike Gabriel (57d3a42c2) * release 3.5.99.22 (tag: 3.5.99.22, origin/release-builds/3.6.x, release-builds/3.6.x) 2019-08-27 15:15:47 +0200 Mike Gabriel (7d07442d7) * debian/copyright: Update copyright attributions. 2019-08-27 15:14:49 +0200 Mike Gabriel (e428e39de) * debian/{nxagent,nxdialog}.install: Move nxdialog files from nxagent.install to nxdialog.install. 2019-08-27 15:14:25 +0200 Mike Gabriel (1b967c701) * debian/control: Split-out nxdialog bin:pkg. 2019-08-27 14:11:53 +0200 Mike Gabriel (6bca289af) * Merge branch 'uli42-gh-sunweaver/pr/autograb-without-inputlock' into 3.6.x 2019-08-14 20:59:49 +0200 Ulrich Sibiller (6181aa911) * Events.c: introduce separate debug level for autograb debugging only (gh-uli42/gh-sunweaver/pr/autograb-without-inputlock, uli42-gh-sunweaver/pr/autograb-without-inputlock, gh-sunweaver/pr/autograb-without-inputlock) 2019-06-27 23:43:44 +0200 Ulrich Sibiller (063813d35) * Make AutoGrab work in more situations 2017-07-24 14:48:29 +0200 Mike Gabriel (14d8e0a2a) * Dialog.c: Add NXTransDialog() call for autograb toggling. 2017-05-25 23:20:50 +0200 Ulrich Sibiller (03aa5d743) * Events.c: Autograb only for windowed modes 2017-05-18 15:09:29 +0200 Ulrich Sibiller (a4d7a04c4) * Events.c: do not ungrab keyboard on LeaveNotify when in autograb mode 2017-05-18 15:08:29 +0200 Ulrich Sibiller (6dcdc578f) * Events.c: improve debugging output for FocusIn/Out 2017-04-20 14:19:27 +0200 Ulrich Sibiller (ebfd8742c) * Args.c: make autograb available via options file, too. 2017-03-16 13:12:01 +0100 Ulrich Sibiller (4eaedd002) * Args.c: Add command line option -autograb. 2017-03-16 13:00:48 +0100 Ulrich Sibiller (8bf3429bc) * nxagent: Make autograb an nxagentOption. 2017-03-05 23:51:24 +0100 Ulrich Sibiller (58183b7ce) * nxagent: Add autograb mode. 2019-08-27 08:33:22 +0200 Mike Gabriel (daa50fd80) * Merge branch 'uli42-pr/fix_double_free' into 3.6.x 2019-08-12 23:11:34 +0200 Ulrich Sibiller (a7abd45a8) * Screen.c: initialize RandR only on startup... (gh-uli42/pr/fix_double_free) 2019-08-27 08:27:42 +0200 Mike Gabriel (6f80a06fb) * Merge branch 'uli42-pr/safe_free' into 3.6.x 2019-08-16 13:11:38 +0200 Ulrich Sibiller (f39b81d31) * NXdispatch.c: move nxagentWMtimeout into the function 2019-08-16 13:08:42 +0200 Ulrich Sibiller (4202d5094) * NXdispatch.c: drop currentDispatch variable 2019-08-16 13:02:01 +0200 Ulrich Sibiller (60a3c9b0a) * nxagent: move nxagentWMPassed to Splash.c 2019-08-16 12:55:28 +0200 Ulrich Sibiller (db4c220b2) * nxagent: add NXAGENT_ONSTART where missing 2019-08-16 12:54:10 +0200 Ulrich Sibiller (0f5e873dc) * nxagent: drop NXAGENT_SPLASH 2019-08-16 12:46:21 +0200 Ulrich Sibiller (784846317) * nxagent: rename nxagentWMStart to nxagentReadyAtom 2019-08-16 12:38:53 +0200 Ulrich Sibiller (bd002ffc5) * Splash.c: move some variables to Splash.c 2019-08-15 22:33:35 +0200 Ulrich Sibiller (5bb5adc8a) * Splash.c: make Splash logo work with white background (-wr) mode, too 2019-08-15 22:10:45 +0200 Ulrich Sibiller (41bfed975) * Splash.c: remove global variables for colors 2019-08-15 22:06:14 +0200 Ulrich Sibiller (e12983a67) * nxagent: drop nxagentRootTileWindow 2019-08-15 22:04:07 +0200 Ulrich Sibiller (bfb4e9ac9) * Splash.c: nxagentRemoveSplashWindow: drop unused parameter 2019-08-11 01:59:42 +0200 Ulrich Sibiller (48c43c837) * Splash.c: code cleanup 2019-08-11 01:51:37 +0200 Ulrich Sibiller (208e58fb7) * Splash.c: drop return code of nxagentShowSplashWindow 2019-08-11 01:47:16 +0200 Ulrich Sibiller (9cd602b27) * Splash.c: do not wait in nxagent mode 2019-08-11 00:21:44 +0200 Ulrich Sibiller (8eeaa40b1) * dix: add whiteroot flag 2019-08-10 23:56:22 +0200 Ulrich Sibiller (817c3c6fc) * NXwindow.c: simplify window background code 2019-08-10 23:42:45 +0200 Ulrich Sibiller (d3869aa53) * nxagent: fix main window being garbled without inner windows 2018-05-05 18:56:35 +0200 Ulrich Sibiller (17495dd6a) * nxagent: simplify nxagentWaitEvents() 2019-06-28 22:10:23 +0200 Ulrich Sibiller (1d32e5368) * Keystroke.c: fix wrong return code 2019-06-28 22:09:23 +0200 Ulrich Sibiller (bcbf25510) * Events.c: add more comments and TEST output 2019-06-28 22:07:00 +0200 Ulrich Sibiller (e7451477e) * Events.c: refactor nxagentHandleKeypress 2019-08-27 08:14:23 +0200 Mike Gabriel (8b15d574b) * Merge branch 'uli42-pr/fix_background' into 3.6.x 2019-08-16 13:11:38 +0200 Ulrich Sibiller (3563959c0) * NXdispatch.c: move nxagentWMtimeout into the function (gh-uli42/pr/fix_background, uli42-pr/fix_background, pr/fix_background) 2019-08-16 13:08:42 +0200 Ulrich Sibiller (c34d1b201) * NXdispatch.c: drop currentDispatch variable 2019-08-16 13:02:01 +0200 Ulrich Sibiller (ab8015237) * nxagent: move nxagentWMPassed to Splash.c 2019-08-16 12:55:28 +0200 Ulrich Sibiller (b04b58bad) * nxagent: add NXAGENT_ONSTART where missing 2019-08-16 12:54:10 +0200 Ulrich Sibiller (2228513a6) * nxagent: drop NXAGENT_SPLASH 2019-08-16 12:46:21 +0200 Ulrich Sibiller (24f392c4a) * nxagent: rename nxagentWMStart to nxagentReadyAtom 2019-08-16 12:38:53 +0200 Ulrich Sibiller (798a053b4) * Splash.c: move some variables to Splash.c 2019-08-15 22:33:35 +0200 Ulrich Sibiller (074821a84) * Splash.c: make Splash logo work with white background (-wr) mode, too 2019-08-15 22:10:45 +0200 Ulrich Sibiller (afebb8211) * Splash.c: remove global variables for colors 2019-08-15 22:06:14 +0200 Ulrich Sibiller (8fcaafab4) * nxagent: drop nxagentRootTileWindow 2019-08-15 22:04:07 +0200 Ulrich Sibiller (be508a447) * Splash.c: nxagentRemoveSplashWindow: drop unused parameter 2019-08-11 01:59:42 +0200 Ulrich Sibiller (612cbcc43) * Splash.c: code cleanup 2019-08-11 01:51:37 +0200 Ulrich Sibiller (3c92d8897) * Splash.c: drop return code of nxagentShowSplashWindow 2019-08-11 01:47:16 +0200 Ulrich Sibiller (470e0bd4d) * Splash.c: do not wait in nxagent mode 2019-08-11 00:21:44 +0200 Ulrich Sibiller (a539aaa6a) * dix: add whiteroot flag 2019-08-10 23:56:22 +0200 Ulrich Sibiller (c610d706b) * NXwindow.c: simplify window background code 2019-08-10 23:42:45 +0200 Ulrich Sibiller (d7d205c0d) * nxagent: fix main window being garbled without inner windows 2019-08-16 11:52:35 +0200 Mike Gabriel (f24767b3c) * Merge branch 'uli42-pr/improve_wait_events' into 3.6.x 2018-05-05 18:56:35 +0200 Ulrich Sibiller (62573abf0) * nxagent: simplify nxagentWaitEvents() (gh-uli42/pr/improve_wait_events, uli42-pr/improve_wait_events, pr/improve_wait_events) 2019-08-16 11:50:10 +0200 Mike Gabriel (7f4b50deb) * Merge branch 'uli42-pr/no_keystroke_passthrough' into 3.6.x 2019-06-28 22:10:23 +0200 Ulrich Sibiller (ceeb53f0c) * Keystroke.c: fix wrong return code (gh-uli42/pr/no_keystroke_passthrough, uli42-pr/no_keystroke_passthrough, pr/no_keystroke_passthrough) 2019-06-28 22:09:23 +0200 Ulrich Sibiller (b3d41485d) * Events.c: add more comments and TEST output 2019-06-28 22:07:00 +0200 Ulrich Sibiller (c260ae425) * Events.c: refactor nxagentHandleKeypress 2019-07-23 20:12:31 +0200 Ulrich Sibiller (504b1400e) * Clipboard.c: use SAFE_free (gh-uli42/pr/safe_free) 2019-07-23 20:10:43 +0200 Ulrich Sibiller (4421f787d) * Atoms.c: use SAFE_XFree and SAFE_free macros 2019-07-22 22:26:46 +0200 Ulrich Sibiller (7d25771da) * Keystroke.c: use SAFE_free 2019-07-22 22:25:40 +0200 Ulrich Sibiller (8080ad26a) * GCOps.c: use SAFE_free 2019-07-22 22:24:37 +0200 Ulrich Sibiller (6378d5ade) * GC.c: use SAFE_free 2019-07-22 22:22:31 +0200 Ulrich Sibiller (a9819436d) * Drawable.c: use SAFE_free 2019-07-22 22:20:47 +0200 Ulrich Sibiller (43e300ecd) * Colormap.c: use SAFE_free 2019-07-22 22:19:15 +0200 Ulrich Sibiller (633d04097) * Args.c: use SAFE_free 2019-07-22 22:17:25 +0200 Ulrich Sibiller (122fbd3e1) * Error.c: use SAFE_free 2019-07-22 21:53:20 +0200 Ulrich Sibiller (dde4e7636) * Image.c: use SAFE_free 2019-07-22 21:50:19 +0200 Ulrich Sibiller (458538010) * Render.c: use SAFE_free 2019-07-22 21:45:25 +0200 Ulrich Sibiller (8b74ff1c1) * Pixmap.c: use SAFE_free 2019-07-22 21:44:25 +0200 Ulrich Sibiller (34bd0942b) * Reconnect.c: use SAFE_free 2019-07-22 21:34:42 +0200 Ulrich Sibiller (fd4fa4e96) * Keyboard.c: use SAFE_XFree and SAFE_free 2019-07-22 21:33:54 +0200 Ulrich Sibiller (156533439) * Cursor.c: use SAFE_XFree 2019-07-22 21:32:58 +0200 Ulrich Sibiller (d0a6c98cb) * Window.c: use SAFE_free and SAFE_XFree 2019-07-22 21:29:31 +0200 Ulrich Sibiller (4a826d30f) * Rootless.c: use SAFE_free and SAFE_XFree 2019-07-22 21:27:10 +0200 Ulrich Sibiller (a4700c9d0) * Font.c: use SAFE_XFree and SAFE_free 2019-07-22 18:11:59 +0200 Ulrich Sibiller (d8012d2a8) * Screen.c: safe some lines by calling SAFE_XFree 2019-07-22 18:10:12 +0200 Ulrich Sibiller (ebc2ea79f) * Events.c: safe some lines by calling SAFE_XFree 2019-07-22 18:16:20 +0200 Ulrich Sibiller (b8411180e) * Display.c: safe some lines by calling SAFE_XFree and SAFE_free 2019-07-23 20:08:16 +0200 Ulrich Sibiller (1330167fa) * Utils.h: add SAFE_free macro 2019-08-05 18:32:16 +0200 Mike Gabriel (360cb5dd9) * release 3.5.99.21 (tag: 3.5.99.21) 2019-06-27 22:48:09 +0200 Mike Gabriel (c2ca013fb) * Merge branch 'uli42-pr/drop_ipaq' into 3.6.x 2019-06-27 21:50:53 +0200 Ulrich Sibiller (738686685) * drop onscreen keyboard support (gh-uli42/pr/drop_ipaq, uli42-pr/drop_ipaq) 2019-06-27 21:44:31 +0200 Ulrich Sibiller (6bdf9c2fa) * Drop Ipaq support 2019-06-27 21:03:03 +0200 Mike Gabriel (1ebf78519) * Merge branch 'uli42-pr/fix_fullscreen' into 3.6.x 2019-06-27 20:38:10 +0200 Ulrich Sibiller (032ed3511) * Screen.c: use XlibWindow so silence the compiler (gh-uli42/pr/fix_fullscreen, uli42-pr/fix_fullscreen) 2019-06-27 20:15:15 +0200 Ulrich Sibiller (d487d5879) * Consistently use None instead of 0 for nxagentIconWindow everywhere 2019-06-27 19:51:03 +0200 Ulrich Sibiller (ea571387b) * Screen.c: simplify nxagentMinimizeFromFullscreen 2019-06-26 19:04:41 +0200 Ulrich Sibiller (6657b8cc8) * nxagentMaximizeToFullScreen: only reparent if necessary 2019-06-26 18:50:44 +0200 Ulrich Sibiller (d32706888) * Screen.c: add nxagentIsParentOf helper 2019-06-26 18:49:36 +0200 Ulrich Sibiller (c190fd187) * Window.c: rearrange code regarding window decorations sizes 2019-06-26 18:49:13 +0200 Ulrich Sibiller (ca54fabed) * Window.c: add some comments about fullscreen handling 2019-06-23 22:21:24 +0200 Mike Gabriel (5858ebc6d) * Merge branch 'mjtrangoni-add-gcc-9' into 3.6.x 2019-06-22 18:44:25 +0200 Mario Trangoni (1ffe92a6f) * TravisCI: Print compiler version currently used (gh-mjtrangoni/add-gcc-9, mjtrangoni-add-gcc-9, add-gcc-9) 2019-06-22 18:26:14 +0200 Mario Trangoni (fba18967f) * TravisCI: move from gcc 8.x to gcc 9.x 2019-06-23 21:39:51 +0200 Mike Gabriel (4a440feaf) * Merge branch 'uli42-pr/fix_xkb_privates' into 3.6.x 2019-06-22 16:03:06 +0200 Ulrich Sibiller (3aabc92cf) * rework xkb device private handling (gh-uli42/pr/fix_xkb_privates, uli42-pr/fix_xkb_privates) 2019-06-22 11:32:42 +0200 Mike Gabriel (abf374136) * Merge branch 'uli42-pr/various' into 3.6.x 2019-06-20 12:51:23 +0200 Ulrich Sibiller (c8a5e33fc) * Suppress false positives in static analysis (gh-uli42/pr/various, uli42-pr/various, pr/various) 2019-06-21 12:04:23 +0200 Ulrich Sibiller (b91b3d807) * record/set.c: silence cpp finding 2019-06-21 11:39:03 +0200 Ulrich Sibiller (364035c00) * Keyboard.c: use existing define instead of hardcoced value 2019-06-21 11:38:39 +0200 Ulrich Sibiller (2bb498a4c) * Keyboard.c: fix another cppcheck finding 2019-06-21 11:22:28 +0200 Ulrich Sibiller (5be6d271b) * xkb: fix what looks to be a copy-paste error with first vs firstMM 2019-06-21 11:13:46 +0200 Ulrich Sibiller (31c3d27ea) * xkmread.c: fix compiler warning 2019-06-21 11:01:59 +0200 Ulrich Sibiller (813acdd2d) * xkb: Silence some compiler warnings 2019-06-21 10:57:09 +0200 Ulrich Sibiller (054e906f6) * xkb: Use snprintf to measure string lengths instead of manual strlen math 2019-06-21 10:45:57 +0200 Ulrich Sibiller (2070891cb) * xkbEvents.c: Fix "warning: unused variable `s'". 2019-06-21 10:41:36 +0200 Ulrich Sibiller (4962c5a8d) * XKB: Remove a bunch of mad ifdefs 2019-06-21 10:10:21 +0200 Ulrich Sibiller (56dcc8a4b) * xkb: remove oldState from XkbHandleActions. 2019-06-20 23:14:09 +0200 Ulrich Sibiller (c8520ac0a) * mi/miexpose.c: add missing free() 2019-06-20 19:54:44 +0200 Ulrich Sibiller (956caeb8a) * compext/Png.c: Nullify after free 2019-06-20 19:53:39 +0200 Ulrich Sibiller (e440e722d) * compext/Png.c: simplify srcBuf allocation 2019-06-20 19:51:00 +0200 Ulrich Sibiller (d48824195) * compext/Png.c: late image_index allocation 2019-06-20 19:14:10 +0200 Ulrich Sibiller (b4d3dc5bf) * NXdixfonts.c: fix index out of bounds 2019-06-20 18:52:31 +0200 Ulrich Sibiller (fd7e1f989) * Keyboard.c: rearrange code to make cppcheck happy 2019-06-20 01:35:22 +0200 Ulrich Sibiller (3c0469971) * os/access.c: add missing } 2019-06-20 01:31:17 +0200 Ulrich Sibiller (528e1e4ef) * NXpicture.c: code simplification 2019-06-20 01:29:21 +0200 Ulrich Sibiller (bb08043a6) * Screen.c: fix two more memleaks of visuals 2019-06-20 01:21:44 +0200 Ulrich Sibiller (213e63eed) * Screen.c: fix two memleaks 2019-06-20 00:59:16 +0200 Ulrich Sibiller (e63d9de45) * NXrender: fix another memleak 2019-06-20 00:51:32 +0200 Ulrich Sibiller (78eff73e4) * render: Propagate allocation failure from createSourcePicture() 2019-06-20 00:42:01 +0200 Ulrich Sibiller (9f9b790f8) * fb: fix memory leak in fbOverlayFinishScreenInit 2019-06-20 00:26:47 +0200 Ulrich Sibiller (f55402572) * dix/dispatch: fix a small memory leak 2019-06-20 00:13:25 +0200 Ulrich Sibiller (6f954bb7d) * Quarks.c: add missing ) 2019-06-19 23:44:40 +0200 Ulrich Sibiller (6da106610) * Keyboard.c: fix three memory leaks 2019-06-19 23:10:40 +0200 Ulrich Sibiller (234be0245) * glyph.c: fix a read beyond end of heap buffer 2019-06-19 01:12:26 +0200 Ulrich Sibiller (8205db425) * Font.c: code simplifications 2019-05-25 19:38:14 +0200 Ulrich Sibiller (cb508b263) * various scope improvements 2019-06-18 23:36:45 +0200 Ulrich Sibiller (bffdacc48) * glxext.c: fix another memory leak 2019-06-18 19:10:38 +0200 Ulrich Sibiller (b5eb7c76e) * Screen.c: more debug output 2019-06-18 19:04:12 +0200 Ulrich Sibiller (7e12c9ba5) * Extension.c: code simplifications 2019-06-17 21:57:45 +0200 Ulrich Sibiller (17d5e62ba) * Events.c: use designated initializer in nxagentDeactivatePointerGrab 2019-06-18 18:57:17 +0200 Ulrich Sibiller (5cb497146) * mi/miinitext.c: fix memleaks: remove (double) glx initialization 2019-06-17 23:37:51 +0200 Ulrich Sibiller (756442226) * Screen.c: fix another memory leak 2019-06-17 20:25:09 +0200 Ulrich Sibiller (4dd1f3cbd) * Fix memleaks: Free devPrivates of devices on shutdown 2019-06-17 18:15:05 +0200 Ulrich Sibiller (ca741177e) * CloseDevice: call XkbRemoveResourceClient before freeing key class struct 2019-06-17 17:31:32 +0200 Ulrich Sibiller (340de78e2) * Keyboard.c: nullify freed pointers 2019-06-17 16:06:02 +0200 Ulrich Sibiller (3b06ad51d) * Screen.c: Fix: make sure RRCloseScreen is being called 2019-06-14 00:14:17 +0200 Ulrich Sibiller (0f8dbbab2) * Screen.c: correctly free stuff in nxagentCloseScreen 2019-06-13 22:56:45 +0200 Ulrich Sibiller (308824ba9) * xkb: initialize tsyms 2019-06-12 19:25:57 +0200 Ulrich Sibiller (6d00a387f) * Rootless.c: improve TEST/WARN/DEBUG outout 2019-06-12 00:16:48 +0200 Ulrich Sibiller (2b25eb3d2) * Pixmap.c: fix comment phrasing/spelling 2019-05-30 11:38:10 +0200 Ulrich Sibiller (1bfafc127) * Window.c: add missing comment about nxagentConfiguredWindowList 2019-05-30 00:30:46 +0200 Ulrich Sibiller (1a8de6352) * dix/window.c: fix compiler warning 2019-05-01 10:40:47 +0200 Ulrich Sibiller (3900ba3f8) * NXshm.c: remove left-overs from patch 2019-05-01 02:06:30 +0200 Ulrich Sibiller (b961e190b) * miwindow.c: add hint to Red Hat Bugzilla + fix 2019-05-04 01:44:36 +0200 Ulrich Sibiller (28e42b3bd) * mi: Hush an almost certainly bogus warning 2019-05-30 00:10:43 +0200 Ulrich Sibiller (9f5ddede9) * Window.c: Drop defines CWParent and CWStackingOrder 2019-05-29 23:52:44 +0200 Ulrich Sibiller (a3e0376f9) * Window.c: remove leftover (commented) code 2019-05-30 23:50:53 +0200 Ulrich Sibiller (d8f5e647c) * NXwindow.c: fix compiler warning 2019-06-01 00:52:06 +0200 Ulrich Sibiller (a765857aa) * Remove the Must_have_memory hack. 2019-06-11 12:24:44 +0200 Mike Gabriel (c0754a357) * Merge branch 'uli42-pr/use_selection_callback' into 3.6.x 2019-06-10 14:25:53 +0200 Ulrich Sibiller (848dee5c4) * NXdispatch.c: use upstream version of ProcSetSelectionOwner (gh-uli42/pr/use_selection_callback, uli42-pr/use_selection_callback, pr/use_selection_callback) 2019-06-10 14:21:43 +0200 Ulrich Sibiller (09ba97b2d) * NXdispatch.c: Use Callback instead of a modified function 2019-06-10 14:20:47 +0200 Ulrich Sibiller (2972f6af1) * Add nxagentSetSelectionCallback 2019-06-10 14:18:06 +0200 Ulrich Sibiller (3fd7e5f93) * Add nxagentExternalClipboardEventTrap 2019-06-11 12:10:25 +0200 Mike Gabriel (58cd35745) * Merge branch 'uli42-pr/drop_nxmiexpose' into 3.6.x 2019-05-30 16:04:43 +0200 Ulrich Sibiller (073c6c17e) * NXmiexpose.c: drop file altogether (gh-uli42/pr/drop_nxmiexpose, uli42-pr/drop_nxmiexpose, pr/drop_nxmiexpose) 2019-05-30 16:02:53 +0200 Ulrich Sibiller (6ce9fb5f2) * Window.c/NXmiexpose.c: remove hack for certain WM theme 2019-05-25 17:29:17 +0200 Ulrich Sibiller (af1c4b9b7) * NXmiexpose.c: mark NX changes 2019-05-01 01:22:39 +0200 Ulrich Sibiller (9e051eab0) * NXmiexpose.c: use upstream version of miPaintWindows() 2019-05-04 01:47:50 +0200 Ulrich Sibiller (39ff69c72) * NXmiexpose.c: use upstream miHandleExposures() 2019-06-11 12:05:42 +0200 Mike Gabriel (a25232734) * Merge branch 'uli42-pr/various_small_things' into 3.6.x 2019-05-30 11:36:18 +0200 Ulrich Sibiller (2da476a67) * Window.c: comment on the purpose of some functions (gh-uli42/pr/various_small_things, uli42-pr/various_small_things, pr/various_small_things) 2019-06-10 15:32:38 +0200 Ulrich Sibiller (d38fb8137) * Events.c: add debug output 2019-06-10 15:27:02 +0200 Ulrich Sibiller (9cb29cce2) * Clipboard.c: more debugging output 2019-06-10 15:23:55 +0200 Ulrich Sibiller (9739c7009) * Clipboard.c: Scope improvements 2019-06-10 15:21:45 +0200 Ulrich Sibiller (4b19c4975) * Clipboard.c: fix wrong variable being printed 2019-06-10 12:09:16 +0200 Ulrich Sibiller (d9b1272fb) * Screen.c: more TEST output 2019-06-10 12:06:31 +0200 Ulrich Sibiller (0e496e5d1) * Screen.c: use consistent spacing on pointer references 2019-06-10 12:05:24 +0200 Ulrich Sibiller (8365ce463) * Screen.c: whitespace/formatting fixes 2019-06-10 12:04:20 +0200 Ulrich Sibiller (d98eeec02) * Screen.c: report both created windows (and with the right name) 2019-06-10 12:01:05 +0200 Ulrich Sibiller (61255ac1a) * Window.c: fix: report correct window on icon window creation 2019-06-11 12:00:48 +0200 Mike Gabriel (92f41213e) * Merge branch 'uli42-pr/fix_broken_cursor_handling' into 3.6.x 2019-05-27 15:42:11 +0200 Ulrich Sibiller (a736122f5) * os: fix BigReq ignoring when another request is pending (gh-uli42/pr/fix_broken_cursor_handling, uli42-pr/fix_broken_cursor_handling, pr/fix_broken_cursor_handling) 2019-05-23 00:17:21 +0200 Ulrich Sibiller (49adb1e5c) * render/glyph.c: add missing usage_hint 2019-05-22 22:22:36 +0200 Ulrich Sibiller (fd8427002) * Fix NXevents.c: Reactivate errornously commented function 2019-06-11 11:31:05 +0200 Mike Gabriel (126cbe1ff) * Merge branch 'uli42-pr/remove_requestlog' into 3.6.x 2019-05-27 20:35:25 +0200 Ulrich Sibiller (0eab060d1) * dix: remove unused requestLogIndex (gh-uli42/pr/remove_requestlog, uli42-pr/remove_requestlog) 2019-05-21 10:57:22 +0200 Mike Gabriel (789d3a37e) * Merge branch 'uli42-pr/fix_xkb_crash' into 3.6.x 2019-05-15 19:54:24 +0200 Ulrich Sibiller (20353e96a) * libNX_X11: add additional checks for dpy and xkb (gh-uli42/pr/fix_xkb_crash, uli42-pr/fix_xkb_crash) 2019-05-15 19:42:29 +0200 Ulrich Sibiller (4df77fe73) * xkbUtils.c: Catch division by zero 2019-05-17 15:51:36 +0200 Mike Gabriel (6981e9bb0) * Merge branch 'andschwa-xtestext1h' into 3.6.x 2019-05-13 21:32:07 +0000 Andrew Schwartzmeyer (6a938063b) * Remove Debian build references to `xtestext1.h` (andschwa-xtestext1h) 2019-05-11 09:41:15 +0200 Mike Gabriel (226493690) * Merge branch 'uli42-pr/small_fixes' into 3.6.x 2019-05-08 23:23:54 +0200 Ulrich Sibiller (fac36b24f) * nxagent: make nxagentX2go a Boolean (gh-uli42/pr/small_fixes, uli42-pr/small_fixes) 2019-05-08 22:25:02 +0200 Ulrich Sibiller (1b9d735b0) * README.keystrokes: mention nxdialog 2019-05-08 21:49:50 +0200 Ulrich Sibiller (79a2b7b24) * Remove useless "ignore" keystroke for Ctrl-Alt-Backspace 2019-05-08 21:57:01 +0200 Ulrich Sibiller (a31d28014) * README.keystrokes: refine description 2019-05-04 01:04:06 +0200 Ulrich Sibiller (0db8b0353) * NXdispatch.c: indent code to match environment 2019-05-04 00:40:49 +0200 Ulrich Sibiller (f6845fbd9) * NXdispatch.c: add missing fixes 2019-05-04 00:30:21 +0200 Ulrich Sibiller (3d254765c) * NXdispatch.c: add missing change 2019-05-01 20:11:14 +0200 Ulrich Sibiller (0312a8cfe) * Rename libdamage to (correct) libdamageext 2019-05-01 15:04:26 +0200 Ulrich Sibiller (f0ba303d4) * NXdamage.c: add missing upstream fixes 2019-05-01 14:38:31 +0200 Ulrich Sibiller (249be6680) * NXwindow.c: add missing change 2019-04-30 21:00:31 +0200 Ulrich Sibiller (34e9c6b0b) * Keyboard.c: clean/unify formatting 2018-11-02 20:56:55 +0100 Ulrich Sibiller (0a211b6b6) * Keyboard.c: improve TEST and DEBUG output 2019-04-29 15:37:10 +0200 Ulrich Sibiller (bee0f13ce) * nxagent: Remove own GetTimeInMillis() implementation 2018-11-07 21:29:19 +0100 Ulrich Sibiller (b32a984f8) * Die XTESTEXT1, die! 2019-04-29 22:02:47 +0200 Ulrich Sibiller (dece08252) * Reconnect.c: initialize stateFile path 2019-04-29 22:02:24 +0200 Ulrich Sibiller (ff5740e03) * spelling fixes 2019-05-10 16:37:20 +0200 Mike Gabriel (f6177d2ad) * Merge branch 'uli42-pr/short_font_code' into 3.6.x 2019-04-23 20:09:25 +0200 Ulrich Sibiller (453edbd21) * Font.c: use __func__ in TEST prints (gh-uli42/pr/short_font_code, uli42-pr/short_font_code, pr/short_font_code) 2019-04-23 20:08:57 +0200 Ulrich Sibiller (0086b8c24) * Font.c: Avoid duplicate font paths 2019-04-23 18:22:45 +0200 Ulrich Sibiller (78a16245a) * auto-determine system font path and add to list of font paths 2019-04-23 19:34:57 +0200 Ulrich Sibiller (898f04e42) * Font.c: Loop over font paths 2019-04-23 19:21:41 +0200 Ulrich Sibiller (dfb5602a6) * Font.c: Let dix check if a font path exists 2019-04-23 19:19:04 +0200 Ulrich Sibiller (8029141e7) * Font.c: build the font paths at runtime 2019-04-23 18:34:04 +0200 Ulrich Sibiller (bcb5c7962) * Drop Speedo font support 2019-04-03 22:33:33 +0200 Ulrich Sibiller (dff2e0a01) * Font.c: factor out font checks 2019-05-10 16:10:46 +0200 Mike Gabriel (d94e9ba24) * Merge branch 'uli42-pr/fix_flavour_change' into 3.6.x 2019-05-08 23:21:30 +0200 Ulrich Sibiller (3c9ee1ff7) * nxagent: Determine nxagentProgName only once (gh-uli42/pr/fix_flavour_change, uli42-pr/fix_flavour_change) 2019-04-23 08:42:43 +0200 Mike Gabriel (4ce890758) * Merge branch 'mjtrangoni-update-clang-8' into 3.6.x 2019-04-22 17:26:33 +0200 Mario Trangoni (ee82317b5) * travis.yml: Update clang 7.0 => 8.0 (mjtrangoni-update-clang-8) 2019-04-17 11:12:29 +0200 Mike Gabriel (c9cac948f) * roll-tarballs.sh: Fix script removal from nx-libs-lite tarballs. 2019-04-17 11:07:36 +0200 Mike Gabriel (3dc2c9aac) * roll-tarballs.sh: Remove nxdialog/* in nx-libs-lite tarballs. 2019-04-17 11:04:51 +0200 Mike Gabriel (e2b73ab90) * release 3.5.99.20 (tag: 3.5.99.20) 2019-04-17 10:52:00 +0200 Mike Gabriel (2a10438f7) * nxdialog/bin/nxdialog: Fix error dialog-type-not-supplied error message. 2019-04-08 11:50:08 +0200 Mihai Moldovan (f0aac0897) * Merge branch 'sunweaver-pr/pthread-flags' into arctica-3.6.x 2019-03-01 23:16:49 +0100 Mike Gabriel (80ecfad95) * nxcomp/src/Makefile.am: Correct usage of PTHREAD_CFLAGS and PTHREAD_LIBS. PTHREAD_CFLAGS is also supposed to be used when linking. See comments in m4/ax_pthread.m4. (gh-sunweaver/pr/pthread-flags, pr/pthread-flags) 2019-04-07 21:59:37 +0200 Mike Gabriel (1ff05c8e2) * nxdialog/Makefile.am: We forgot to clean up nxdialog/bin/Makefile.in. 2019-04-07 21:59:00 +0200 Mike Gabriel (34011ccad) * Makefile: Add clean/distclean target calls for nxdialog subdir to master Makefile's clean/distclean targets. 2019-04-07 21:36:05 +0200 Mike Gabriel (cb5c042a1) * Merge branch 'Ionic-bugfix/libXcomp-pthread-underlinking' into 3.6.x 2019-04-04 13:07:40 +0200 Mihai Moldovan (dd0d49c4e) * debian/patches/{,series}: remove 2004_enforce-lpthread.patch. (gh-ionic/bugfix/libXcomp-pthread-underlinking, gh-Ionic/bugfix/libXcomp-pthread-underlinking, bugfix/libXcomp-pthread-underlinking, Ionic-bugfix/libXcomp-pthread-underlinking) 2019-04-04 11:15:22 +0200 Mihai Moldovan (d1fe6a601) * nxproxy/{m4,configure.ac,src/Makefile.am}: drop pthread overlinking. 2019-04-04 11:06:05 +0200 Mihai Moldovan (95f8cf7ea) * m4/ax_pthread.m4: implement workaround for libtool bug #13550. 2019-04-01 09:16:43 +0200 Mihai Moldovan (2efaa423b) * m4/: update external macros from autoconf-archive. 2019-04-04 11:18:35 +0200 Mihai Moldovan (1b6da5992) * nxcomp/src/Makefile.am: PTHREAD_LDFLAGS does not exist, replace with PTHREAD_LIBS. 2019-03-25 06:42:08 +0100 Mihai Moldovan (3af59f806) * nxdialog/: create (almost) empty m4 directory. 2019-03-01 18:59:22 +0100 Ulrich Sibiller (cf3ac71a3) * nxdialog: fix example 2019-03-01 16:48:17 +0100 Mike Gabriel (59305c8b9) * release 3.5.99.19 (tag: 3.5.99.19) 2019-03-01 16:48:04 +0100 Mike Gabriel (da9a1bc0b) * debian/patches: Add 2004_enforce-lpthread.patch. On Debian, enforce -lpthread when building nxcomp. This is a nasty work around for a missing symbols issue that needs to get addressed otherwise in later release. 2019-03-01 15:32:12 +0100 Mike Gabriel (400b627e4) * nx-libs.spec: Dropping nxdialog files from installation for now when building RPMs. Postponing nxdialog integration with RPM packaging for now. 2019-03-01 15:25:36 +0100 Ulrich Sibiller (ff1b3e9e8) * nxdialog: Allow user to specify hexadecimal X11 window IDs. 2019-03-01 15:24:44 +0100 Mike Gabriel (ca8d889da) * debian/libnx-x11-6.symbols: Update symbols. 2019-03-01 15:23:49 +0100 Mike Gabriel (00f8d49a3) * debian/*: Debianize package inclusion of nxdialog (ships with nxagent bin:pkg for now). 2019-03-01 15:22:03 +0100 Mike Gabriel (ae565e1da) * Merge branch 'sunweaver-pr/nxdialog-autotools' into 3.6.x 2019-03-01 13:50:31 +0100 Mike Gabriel (6812657f0) * Makefile: Integrate new subproject "nxdialog". (gh-sunweaver/pr/nxdialog-autotools, sunweaver-pr/nxdialog-autotools, pr/nxdialog-autotools) 2019-03-01 13:47:39 +0100 Mike Gabriel (57ca69fe0) * nxdialog: Turn into autotools project, add man page. 2019-03-01 12:50:32 +0100 Mike Gabriel (df79c3b35) * Merge branch 'uli42-pr/add_nxdialog' into 3.6.x 2019-03-01 10:52:39 +0100 Ulrich Sibiller (d0e40f8b2) * nxdialog: add example call (gh-uli42/pr/add_nxdialog, uli42-pr/add_nxdialog, pr/add_nxdialog) 2019-03-01 10:50:16 +0100 Ulrich Sibiller (07052a25c) * nxdialog: allow to provide --parent 0 for testing 2019-02-28 20:17:39 +0100 Ulrich Sibiller (acffe15b5) * nxdialog: make code compatible to python2 _and_ python3 2019-02-28 18:13:47 +0100 Ulrich Sibiller (57700cd6b) * nxdialog: convert from optparse to argparse 2019-02-28 17:49:28 +0100 Ulrich Sibiller (3a097e6e0) * nxdialog: use gtk3 instead of gtk2 2019-02-28 17:46:48 +0100 Ulrich Sibiller (2aa575f0d) * nxdialog: pylint improvements 2019-02-09 01:55:59 +0100 Ulrich Sibiller (486cc6f50) * add nxdialog for displaying dialogs 2019-03-01 12:12:58 +0100 Mike Gabriel (4538d2133) * Merge branch 'mjtrangoni-move-to-xenial' into 3.6.x 2019-01-19 12:17:32 +0100 Mario Trangoni (440ce3f54) * .travis.yml: add some soft requirements (gh-mjtrangoni/move-to-xenial, move-to-xenial, mjtrangoni-move-to-xenial) 2019-01-18 20:38:03 +0100 Mario Trangoni (f2a1e877d) * .travis.yml: Update clang-6.0 to clang-7 2019-01-18 19:10:03 +0100 Mario Trangoni (ebd1ea036) * .travis.yml: move from Ubuntu Trusty to Xenial. 2019-03-01 12:04:25 +0100 Mike Gabriel (176f9b471) * Merge branch 'uli42-pr/fix_clang_warnings' into 3.6.x 2019-01-18 23:57:04 +0100 Ulrich Sibiller (7c8214f31) * GenericReply.h: remove unused variable (gh-uli42/pr/fix_clang_warnings, uli42-pr/fix_clang_warnings, pr/fix_clang_warnings) 2019-01-18 23:45:26 +0100 Ulrich Sibiller (059028ce7) * Logger.h: remove pragma, correct attributes 2019-01-18 23:44:47 +0100 Ulrich Sibiller (a53c65547) * Logger.h: fix missing compiler attribute 2019-01-18 22:51:40 +0100 Ulrich Sibiller (74fe99dab) * xcompshad: remove unused variables 2019-01-18 22:47:38 +0100 Ulrich Sibiller (a8ed28234) * Xlib: remove register keywords 2019-01-18 22:44:21 +0100 Ulrich Sibiller (e1f2a24f6) * xlib: remove superflous parens 2019-01-18 22:41:05 +0100 Ulrich Sibiller (0934b1e67) * nxcomp: fix unused variables 2019-01-18 22:38:31 +0100 Ulrich Sibiller (0e481f8aa) * nxcomp: fix unused variable 2019-01-18 22:10:54 +0100 Ulrich Sibiller (471342933) * Fix: clang does not know about gnu_printf 2019-03-01 11:59:55 +0100 Mike Gabriel (d156ce5ab) * Merge branch 'uli42-pr/xfixes_memset' into 3.6.x 2019-02-28 23:15:22 +0100 Ulrich Sibiller (e7a50079e) * xfixes: use calloc for some structs (gh-uli42/pr/xfixes_memset, uli42-pr/xfixes_memset) 2019-02-28 23:13:49 +0100 Ulrich Sibiller (c6b6a8fcb) * Use C99 designated initializers in various extension Replies 2019-02-28 23:11:23 +0100 Ulrich Sibiller (c81a45785) * Use calloc to zero fill buffers being allocated for replies & events 2019-02-28 22:09:28 +0100 Ulrich Sibiller (a70e36c81) * ConnDis.c: remove obsolete MNX_TCPCONN 2019-02-20 22:39:48 +0100 Ulrich Sibiller (f2e48fb73) * nx-X11/lib/configure.ac: add forgotten status line 2019-02-20 22:25:46 +0100 Ulrich Sibiller (71a3b8447) * nx-X11/lib/configure.ac: fix version number 2019-02-20 22:05:01 +0100 Ulrich Sibiller (0eb71d78a) * Merge branch 'gh-sunweaver/pr/xlib-loadable-modules' into 3.6.x 2019-02-20 13:14:43 +0100 Mike Gabriel (36a7f0413) * nx-X11/lib/configure.ac: Assure that the USE_DYNAMIC_XCURSOR macro is defined at build-time. (gh-sunweaver/pr/xlib-loadable-modules, pr/xlib-loadable-modules) 2019-02-20 10:40:20 +0100 Mike Gabriel (de421e4fe) * Revert "Fix parsing ports set to unix sockets" 2019-02-20 10:37:16 +0100 Mike Gabriel (3572b251e) * Regression fix for bfc05af7. Properly end lines in help/usage text. 2019-02-18 08:47:40 +0100 Mike Gabriel (66315e4f3) * Merge branch 'uli42-pr/session_types' into 3.6.x 2019-02-18 08:45:11 +0100 Mike Gabriel (fc2907759) * Keyboard.c: fix comment. (gh-uli42/pr/session_types, uli42-pr/session_types, pr/session_types) 2019-02-17 18:00:28 +0100 Ulrich Sibiller (bfc05af73) * nxproxy: list known session types in help output 2019-02-15 11:48:27 +0100 Mike Gabriel (a3dc87d6b) * Merge branch 'uli42-pr/fix_keystrokes' into 3.6.x 2019-02-15 09:27:29 +0100 Ulrich Sibiller (f1b27c4fd) * keystrokes.cfg: Add missing Shift=1 for viewport_move_up/down/right (gh-uli42/pr/fix_keystrokes, uli42-pr/fix_keystrokes, pr/fix_keystrokes) 2019-02-15 11:45:14 +0100 Mike Gabriel (24d7d0faa) * Merge branch 'uli42-pr/revert' into 3.6.x 2019-02-15 09:37:18 +0100 Ulrich Sibiller (586742b71) * Revert "nxagent: rework Bool handling" (gh-uli42/pr/revert, uli42-pr/revert) 2019-02-13 12:32:06 +0100 Mike Gabriel (b61934be2) * Merge branch 'uli42-pr/misc' into 3.6.x 2019-02-08 00:44:48 +0100 Ulrich Sibiller (16cd2bbe1) * nxagent: rework Bool handling (gh-uli42/pr/misc, uli42-pr/misc) 2019-02-07 23:06:58 +0100 Ulrich Sibiller (5bbab001a) * Screen.c: code optimization for rootless mode 2019-02-07 23:04:23 +0100 Ulrich Sibiller (34e4291de) * Screen.c: simplify and fix handling of rootless mode 2019-02-07 21:40:05 +0100 Ulrich Sibiller (f729ac996) * rrdispatch.c: remove obsolete ifdef 2019-01-31 14:10:36 +0100 Mike Gabriel (427ac344c) * release 3.5.99.18 (tag: 3.5.99.18) 2019-01-25 16:37:29 +0100 Mike Gabriel (26e483d49) * Merge branch 'theqvd-unix_socket_forwarding' into 3.6.x 2019-01-18 13:15:18 +0100 Vadim (889de46f7) * Fix parsing ports set to unix sockets (theqvd-unix_socket_forwarding) 2019-01-18 12:28:51 +0100 Vadim (5c99eb7d5) * Make getUnixPath() return the right value when called without an argument. 2019-01-17 12:06:34 +0100 Mike Gabriel (ca8236e7f) * Merge branch 'uli42-pr/window_fixes' into 3.6.x 2019-01-12 01:01:55 +0100 Ulrich Sibiller (d16a5fbb1) * Screen.c: fix handling of fullscreen startup (gh-uli42/pr/window_fixes, uli42-pr/window_fixes) 2019-01-13 23:47:53 +0100 Ulrich Sibiller (3c92b5db9) * Screen.c: fix size calculation in rootless mode 2019-01-13 23:46:49 +0100 Ulrich Sibiller (43d3b655d) * Screen.c: improve readability of size calculations 2019-01-11 23:25:39 +0100 Ulrich Sibiller (8dea30751) * Screen.c: move identical line out of both parts of an if clause 2019-01-11 22:39:34 +0100 Ulrich Sibiller (c4c39bc94) * Extensions.c: Cleanup nxagentRandRInitSizes() 2019-01-11 21:58:50 +0100 Ulrich Sibiller (6c0098a3e) * Extensions.c: fix first resolution being ignored 2019-01-11 00:59:55 +0100 Ulrich Sibiller (d175fd4c6) * Set default screen size to the whole screen in rootless mode 2019-01-10 22:35:02 +0100 Ulrich Sibiller (4a7faa8bd) * Window.c: move WM_STATE handling to separate function 2018-12-22 22:02:15 +0100 Mike Gabriel (4214a719a) * Merge branch 'uli42-pr/fix_xlibcrash' into 3.6.x 2018-10-31 23:44:15 +0100 Ulrich Sibiller (633f4617b) * XlibInt: check for XlibError before accessing other dpy fields (gh-uli42/pr/fix_xlibcrash, uli42-pr/fix_xlibcrash, pr/fix_xlibcrash) 2018-10-31 23:43:58 +0100 Ulrich Sibiller (a61b1a72d) * XlibInt.c: fix wrong debug message 2018-12-19 12:39:59 +0100 Mike Gabriel (d98255968) * nxagent.1 man page: Grammar fix. 2018-12-19 12:38:59 +0100 Mike Gabriel (669af5300) * Merge branch 'uli42-pr/x2go_bypass' into 3.6.x 2017-07-22 22:21:05 +0200 Ulrich Sibiller (522106e20) * nxagent: bypass X2go's keyboard configuration hack (gh-uli42/pr/x2go_bypass, uli42-pr/x2go_bypass, pr/x2go_bypass) 2018-12-19 12:36:28 +0100 Mike Gabriel (a8c65ab62) * Merge branch 'uli42-pr/improve_keyboard2' into 3.6.x 2018-12-03 23:35:56 +0100 Ulrich Sibiller (a70ec920d) * Keyboard.c: add static keyword where appropriate (gh-uli42/pr/improve_keyboard2, uli42-pr/improve_keyboard2, pr/improve_keyboard2) 2018-12-03 22:03:58 +0100 Ulrich Sibiller (d5c9733b2) * nxagent: simplify keycode conversion setup 2018-12-03 21:54:15 +0100 Ulrich Sibiller (1d6c241d3) * nxagent: store remote keyboard in global variables 2018-12-02 17:08:31 +0100 Ulrich Sibiller (161515d24) * nxagent: add additional keyboard config option rmlvo 2017-07-22 19:03:19 +0200 Ulrich Sibiller (1de6ca599) * nxagent: add keyboard=clone configuration option 2018-12-19 12:31:05 +0100 Mike Gabriel (ab3e14850) * Merge branch 'uli42-pr/keyboard_cleanup' into 3.6.x 2018-12-03 21:34:40 +0100 Ulrich Sibiller (26b033b84) * Reconnect.c: restore old keyboard value if no new one is given (gh-uli42/pr/keyboard_cleanup, uli42-pr/keyboard_cleanup, pr/keyboard_cleanup) 2018-12-03 21:52:33 +0100 Ulrich Sibiller (4dfe84eaf) * Keyboard.c: remove non-fitting comment 2018-12-01 22:37:40 +0100 Ulrich Sibiller (21a0ce367) * nxagent: fix references to default rules in manpage 2017-07-23 02:03:58 +0200 Ulrich Sibiller (3b62184a1) * Keyboard.c: improve creation of keyboard config file 2018-12-01 18:17:40 +0100 Ulrich Sibiller (fb31220f2) * Keyboard.c: reformat nxagentKeycodeConversionSetup 2018-12-02 00:09:00 +0100 Ulrich Sibiller (3c4a8da12) * Keyboard.c: use 'variant' all over the place 2018-12-01 23:59:36 +0100 Ulrich Sibiller (d0d6c1bdb) * Keyboard.c: rename variables to better reflect their meaning 2017-07-22 18:56:13 +0200 Ulrich Sibiller (269a352ff) * Keyboard.c: refactor keycode conversion 2017-07-22 17:34:22 +0200 Ulrich Sibiller (d610e9c3c) * Keyboard.c: move keyboard file creation to extra function 2018-12-19 12:25:53 +0100 Mike Gabriel (70cb1926c) * Merge branch 'uli42-pr/xnest_manpages' into 3.6.x 2018-12-17 22:36:44 +0100 Ulrich Sibiller (c8947d8aa) * manpage: reformat some lines (gh-uli42/pr/xnest_manpages, uli42-pr/xnest_manpages, pr/xnest_manpages) 2018-12-17 22:36:34 +0100 Ulrich Sibiller (b405b962f) * manpage: add -name 2018-12-17 22:36:07 +0100 Ulrich Sibiller (b8138d97d) * manpage: add/extend -dpi/-autodpi 2018-12-17 22:35:35 +0100 Ulrich Sibiller (338e20510) * manpage: add -geometry 2018-12-17 22:35:18 +0100 Ulrich Sibiller (51664049f) * manpage: add -depth 2018-12-17 22:34:43 +0100 Ulrich Sibiller (3b508010d) * manpage: add -class 2018-12-17 22:34:15 +0100 Ulrich Sibiller (0b454d2d3) * manpage: add -full 2018-12-17 22:33:52 +0100 Ulrich Sibiller (79e4c20a0) * manpage: add -sync 2018-12-19 12:20:10 +0100 Mike Gabriel (22fea29cf) * Merge branch 'uli42-pr/fb_fastpath' into 3.6.x 2018-12-18 21:39:04 +0100 Ulrich Sibiller (034228d75) * fb: fix fast-path blt detection (gh-uli42/pr/fb_fastpath, uli42-pr/fb_fastpath, pr/fb_fastpath) 2018-12-18 21:32:37 +0100 Ulrich Sibiller (020ef045e) * fb: Fix memcpy abuse 2018-12-19 12:18:27 +0100 Mike Gabriel (8d6a4a9b7) * Merge branch 'uli42-pr/fix_uninit' into 3.6.x 2018-12-18 00:17:51 +0100 Ulrich Sibiller (44c59e12d) * Fix uninitialized bytes (gh-uli42/pr/fix_uninit, uli42-pr/fix_uninit) 2018-12-18 00:05:50 +0100 Ulrich Sibiller (5b0bf752a) * xkb: Initialize pad bytes sent in replies of geometry requests. 2018-12-17 23:58:16 +0100 Ulrich Sibiller (a4fad8f58) * Fix crash due to uninitialized VModMap fields. 2018-11-22 13:16:20 +0100 Mike Gabriel (989398afe) * debian/*: Adopt packaging changes from official Debian package. 2018-11-22 11:46:01 +0100 Mike Gabriel (6d7784eb0) * debian/nxagent.{post,pre}*: Fix versions in dpkg-maintscript-helper calls. 2018-11-22 11:45:29 +0100 Mike Gabriel (afa56ea64) * debian/changelog: post-release fix (UNRELEASED -> unstable). 2018-11-20 16:03:22 +0100 Mike Gabriel (3a19d8d17) * release 3.5.99.17 (tag: 3.5.99.17) 2018-11-14 20:21:46 +0100 Ulrich Sibiller (623a74ae1) * Makefile: fix (dist)clean dependencies 2018-11-14 16:09:17 +0100 Mike Gabriel (071e41b6c) * Makefile: Assure that nx-X11's Makefiles are created after everything has been defined. 2018-11-14 15:18:22 +0100 Mike Gabriel (e4a7baf15) * Regression fix for a93f64e4. The test executables bails out on test failure, whereas ifdef does not. Adding "|| true" where needed. 2018-11-11 15:54:22 +0100 Mike Gabriel (a118ab801) * debian/patches: Rebase 2001_nx-X11_install-location.debian.patch. 2018-11-11 15:50:21 +0100 Mike Gabriel (1a429016c) * Merge branch 'uli42-pr/fix_font_defines_once_more2' into 3.6.x 2018-11-11 15:48:17 +0100 Mike Gabriel (f78a8b3eb) * nx-X11/config/cf/nxcompile.def: Rephrase header comment slightly. (gh-uli42/uli42-pr/fix_font_defines_once_more2, uli42-pr/fix_font_defines_once_more2) 2018-11-11 12:31:19 +0100 Ulrich Sibiller (8632895b8) * imake: adapt output to automake output as seen in lib/src 2018-11-11 12:30:54 +0100 Ulrich Sibiller (c4656c5e9) * imake: also silence makedepend 2018-11-11 11:02:07 +0100 Ulrich Sibiller (ffc723e73) * silence imake compilation 2018-11-10 14:26:49 +0100 Ulrich Sibiller (a93f64e4f) * Makefile: use test + && instead of if test/else/fi 2018-11-10 14:26:15 +0100 Ulrich Sibiller (58615f9fc) * Makefile: use (more) RM macros 2018-11-10 14:48:52 +0100 Ulrich Sibiller (77b392312) * Makefile: Rework handling auto-determined values for imake 2018-11-10 14:46:23 +0100 Ulrich Sibiller (abf47feca) * Makefile: drop intermediate NX version vars 2018-11-10 07:30:23 +0100 Mihai Moldovan (93c9b8862) * nx-libs.spec: newer versions of SLE* and OpenSuSE use xkbcomp-devel, while RedHat-based distros want xorg-x11-xkb-utils-devel for xkbcomp.pc. 2018-11-10 07:27:14 +0100 Mihai Moldovan (89f1e3baa) * Makefile: support systems without xkbcomp.pc. 2018-11-09 23:14:16 +0100 Mike Gabriel (a12ab412d) * debian/contrl: Bump Standards-Version: to 4.2.1. No changes needed. 2018-11-09 23:10:51 +0100 Mike Gabriel (7b08c7dfc) * debian/control: Add to B-D: libxkbfile-dev. Required by xkbcomp.pc (pkg-config). 2018-11-09 15:53:42 +0100 Mike Gabriel (d2dae84b3) * Merge branch 'uli42-pr/Xext-1.4.2' into 3.6.x 2018-11-05 22:16:25 +0100 Ulrich Sibiller (49607e93f) * Lift Xext to xorg 1.4.2 (gh-uli42/pr/Xext-1.4.2, uli42-pr/Xext-1.4.2, pr/Xext-1.4.2) 2018-11-09 15:33:02 +0100 Mike Gabriel (fccef5fc5) * Merge branch 'uli42-pr/xkb_1.3.0.0' into 3.6.x 2018-11-01 13:29:16 +0100 Ulrich Sibiller (3965f24be) * adapt code-versions.txt (gh-uli42/pr/xkb_1.3.0.0, uli42-pr/xkb_1.3.0.0, pr/xkb_1.3.0.0) 2018-10-30 00:00:45 +0100 Ulrich Sibiller (b09a72b08) * Convert existing Xprintf style calls to asprintf style 2018-10-29 23:39:03 +0100 Ulrich Sibiller (b01e29eff) * xkb: Don't check for NULL before calling free 2018-10-29 23:34:10 +0100 Ulrich Sibiller (90b83a79e) * xkb: Fix memory leak if opening file fails 2018-10-25 00:46:12 +0200 Ulrich Sibiller (f23189e73) * Make: Automatically determine xkb dir 2018-07-25 22:39:17 +0200 Ulrich Sibiller (824b62973) * XKB: Fix size_syms calculation bug 2018-07-25 22:27:47 +0200 Ulrich Sibiller (1ca0aee93) * Event.c: improve DEBUG output 2018-07-18 23:54:46 +0200 Ulrich Sibiller (3c1b1efad) * XKB: Remove unused DDX functions 2018-07-18 23:50:28 +0200 Ulrich Sibiller (7487d7fa2) * XKB: Fix logic error 2018-07-18 23:26:10 +0200 Ulrich Sibiller (6625e78c1) * XKB: Fix garbage initialization 2018-07-18 23:15:07 +0200 Ulrich Sibiller (69475953b) * ProcXkbGetKbdByName: fix use of uninitialised bytes valgrind error. 2018-07-18 23:09:32 +0200 Ulrich Sibiller (018b2d0c6) * XkbSendNames: fix use of uninitialised bytes valgrind error. 2018-07-18 22:16:48 +0200 Ulrich Sibiller (59524cd06) * Keyboard.c: simplify even more: free stuff at one place 2018-07-18 19:14:40 +0200 Ulrich Sibiller (b8ae794e4) * Keyboard.c: fix keyboard=query logic 2018-07-16 22:23:56 +0200 Ulrich Sibiller (05e03b965) * Keyboard.c: greatly simplify the code in nxagentKeyboardProc 2018-07-16 22:23:05 +0200 Ulrich Sibiller (d8bbbcf29) * Keyboard.c: guard XkbFreeKeyboard calls 2018-11-01 14:46:54 +0100 Ulrich Sibiller (1b05251a0) * Keyboard.c: simplify over-specific if 2018-07-16 22:22:10 +0200 Ulrich Sibiller (6186383e7) * Keyboard.c: simplify RLMVO string handling 2018-07-16 22:07:26 +0200 Ulrich Sibiller (b891e5f68) * Keyboard.c: always ask for remote XKB 2018-07-07 23:51:27 +0200 Ulrich Sibiller (3fbef7da7) * Lift xkb to XORG-1.3.0.0 state 2018-07-06 23:30:45 +0200 Ulrich Sibiller (4ed8145f7) * XKB: provide XKB defines via Imakefile 2018-07-05 23:23:11 +0200 Ulrich Sibiller (eb07ed57b) * Keyboard.c: do not define own RLMVO defaults 2018-07-05 23:16:30 +0200 Ulrich Sibiller (11a1f31d7) * no more own XkbBaseDirectory handling 2018-07-05 23:14:05 +0200 Ulrich Sibiller (d54f1fb73) * Keyboard.c: remove unused defines 2018-07-04 23:16:26 +0200 Ulrich Sibiller (0fc536886) * Keyboard.c: remove unnecessary includes 2018-07-04 23:15:11 +0200 Ulrich Sibiller (bebdf0990) * Keyboard.c: Remove (now) unused defines 2018-06-29 22:34:32 +0200 Ulrich Sibiller (9808c66ec) * Lift xkb to XORG-1.2.0 state 2018-06-24 23:33:33 +0200 Ulrich Sibiller (2db519141) * Check nxagentXkbInfo.EventBase before use 2018-11-01 20:12:44 +0100 Mike Gabriel (122db3fde) * Merge branch 'uli42-pr/Xi-1.2.0' into 3.6.x 2018-11-01 15:41:34 +0100 Ulrich Sibiller (266c3d68d) * Lift Xi to 1.3.0.0 (identical to 1.2.0) (gh-uli42/pr/Xi-1.2.0, uli42-pr/Xi-1.2.0) 2018-10-27 21:06:11 +0200 Mike Gabriel (70b49467c) * Merge branch 'uli42-pr/small_improvements' into 3.6.x 2018-10-27 02:50:12 +0200 Ulrich Sibiller (e2421bbd7) * Window.c: use C99 designated initializers at some places (gh-uli42/pr/small_improvements, uli42-pr/small_improvements, pr/small_improvements) 2018-10-27 02:26:28 +0200 Ulrich Sibiller (728a3d1c8) * Window.c: add FIXME 2018-10-27 01:28:23 +0200 Ulrich Sibiller (1eb560354) * Window.c: save some lines by declaring loop variables in the loop 2018-10-27 00:53:44 +0200 Ulrich Sibiller (c8383b83d) * Window.c: indent ifdefs for better readability 2018-10-27 00:19:33 +0200 Ulrich Sibiller (df531c16f) * Window.c: silence compiler warnings 2018-10-25 17:46:15 +0200 Ulrich Sibiller (9e6e43137) * Window.c: some code simplifications 2018-10-25 17:24:49 +0200 Ulrich Sibiller (ea275309b) * Window.c: whitespace cleanup 2018-10-25 17:24:35 +0200 Ulrich Sibiller (1fb32cf73) * Window.c: scope improvements 2018-10-25 17:23:45 +0200 Ulrich Sibiller (7a0b401bc) * Window.c: reformat/add braces for readability 2018-10-25 17:23:00 +0200 Ulrich Sibiller (2769cbb9d) * Window.c: indent FIXMEs 2018-10-25 17:18:38 +0200 Ulrich Sibiller (e8c6a7418) * Window.c: convert old-style function definitions to ANSI C89 style 2018-10-27 20:56:24 +0200 Mike Gabriel (280432016) * Merge branch 'uli42-pr/clipboard_debug' into 3.6.x 2018-10-22 00:30:01 +0200 Ulrich Sibiller (60bce146e) * Clipboard.c: use __func__ everywhere (gh-uli42/pr/clipboard_debug, uli42-pr/clipboard_debug, pr/clipboard_debug) 2018-10-22 00:29:35 +0200 Ulrich Sibiller (6ea7558d1) * Clipboard.c: fix fprintf type warnings 2018-07-25 22:25:22 +0200 Ulrich Sibiller (2517d8c1f) * Clipboard.c: more DEBUG output 2018-07-25 22:13:30 +0200 Ulrich Sibiller (934d9eae6) * Clipboard.c: Use constant instead of hardcoded value 2018-10-16 00:20:41 +0200 Ulrich Sibiller (f8bfdc87b) * Clipboard.c: improve nxagentClearSelection() debug code 2018-10-16 00:19:58 +0200 Ulrich Sibiller (5d26addd3) * Clipboard.c: new debug function to reduce duplicate code 2018-10-10 01:15:17 +0200 Ulrich Sibiller (1c4c9f609) * Clipboard.c: more debugging info for nxagentGetClipboardWindow() 2018-10-10 00:26:54 +0200 Ulrich Sibiller (1af67b4df) * Clipboard.c: GetWindowProperty() does not return BadMatch 2018-10-10 00:22:38 +0200 Ulrich Sibiller (018b561b7) * Clipboard.c: whitespace fixes 2018-10-10 00:22:21 +0200 Ulrich Sibiller (719488da9) * Clipboard.c: add FIXME 2018-10-10 00:21:48 +0200 Ulrich Sibiller (9a5f519a0) * Clipboard.c: Code optimization (missing else) 2018-10-10 00:21:13 +0200 Ulrich Sibiller (888de83ac) * Clipboard.c: print X errors 2018-10-10 00:13:57 +0200 Ulrich Sibiller (e90306ec4) * Clipboard.c: some scope optimizations 2018-10-09 23:00:08 +0200 Ulrich Sibiller (85a28a68e) * Clipboard.c: add macro for safe XFree calls with ptr clearance 2018-10-09 22:51:55 +0200 Ulrich Sibiller (fab6911bd) * Clipboard.c: introduce helper macros for easier debugging 2018-06-09 15:02:32 +0200 Ulrich Sibiller (35f6b32c6) * NXproperty.c:add debug output 2018-06-07 23:40:51 +0200 Ulrich Sibiller (6cdddadf9) * Clipboard.c: add function for debugging output 2018-06-06 00:32:38 +0200 Ulrich Sibiller (8baec5d70) * Clipboard: print requested target in debugging mode 2018-10-23 12:14:51 +0200 Mike Gabriel (2eb4a65eb) * Merge branch 'uli42-pr/libX11_1.6.6' into 3.6.x 2018-10-22 22:44:23 +0200 Ulrich Sibiller (701e702a1) * libNX_X11: upgrade to X.org upstream version 1.6.7 (gh-uli42/pr/libX11_1.6.6, uli42-pr/libX11_1.6.6, pr/libX11_1.6.6) 2018-08-22 22:30:34 +0200 Ulrich Sibiller (e1938c189) * libNX_X11: upgrade to X.org upstream version 1.6.6 2018-10-22 14:39:10 +0200 Mike Gabriel (3dc459556) * Merge branch 'uli42-pr/enableclientids' into 3.6.x 2018-10-21 23:54:10 +0200 Ulrich Sibiller (71abe0beb) * enable CLIENTIDS functions in xserver (gh-uli42/pr/enableclientids, uli42-pr/enableclientids, pr/enableclientids) 2018-10-21 23:53:42 +0200 Ulrich Sibiller (97f768a26) * X11.tmpl: whitespace fix 2018-10-22 14:35:08 +0200 Mike Gabriel (7392dd6a9) * Merge branch 'uli42-pr/cleanup_wmisrunning' into 3.6.x 2018-09-24 21:49:23 +0200 Ulrich Sibiller (450760bca) * Events.c: improve Bool usage (gh-uli42/pr/cleanup_wmisrunning, uli42-pr/cleanup_wmisrunning, pr/cleanup_wmisrunning) 2018-09-24 21:47:45 +0200 Ulrich Sibiller (7f7895ee5) * Window.c: remove useless code 2018-09-24 21:47:28 +0200 Ulrich Sibiller (158439555) * Window.c: improve Bool usage 2018-09-24 21:36:50 +0200 Ulrich Sibiller (7b8aef83a) * nxagentInitAndCheckVisuals: adapt bool usage to match the previous function 2018-09-24 21:24:49 +0200 Ulrich Sibiller (67432ac25) * Render.c: improve Bool usage 2018-09-24 21:19:08 +0200 Ulrich Sibiller (f91f02d9d) * Pixmap.c: use some Bools as Bools not integers 2018-09-24 21:08:18 +0200 Ulrich Sibiller (1a8c4532e) * nxagent: use nxagentWMPassed as Bool all over the place 2018-09-24 21:03:15 +0200 Ulrich Sibiller (6b2033bd2) * nxagent: use nxagentWMIsRunning as Bool all over the place 2018-10-22 14:17:04 +0200 Mike Gabriel (c478ba293) * Merge branch 'uli42-pr/fix_bigrequests' into 3.6.x 2018-10-06 20:59:25 +0200 Ulrich Sibiller (da9d1a529) * nxagent: Fix an excessive request size limitation that broke big-requests. (gh-uli42/pr/fix_bigrequests, uli42-pr/fix_bigrequests) 2018-08-24 23:54:13 +0200 Mike Gabriel (d3bbca712) * Merge branch 'sunweaver-pr/drop-nomachine-icon' into 3.6.x 2018-04-14 22:35:18 +0200 Mike Gabriel (31ac5a179) * X2Go Agent XPM: Rename from x2go.xpm to x2goagent.xpm (like the symlink name we expect). (gh-sunweaver/pr/drop-nomachine-icon) 2018-04-14 22:29:03 +0200 Mike Gabriel (c2b4e42a2) * X2Go XPM icon: white background, not transparent. 2018-04-14 03:09:33 +0200 Mike Gabriel (25c7f0252) * Use basename() to derive nxagentProgName cleanly. 2018-04-14 03:05:17 +0200 Mike Gabriel (373836468) * Call checkX2goAgent much earlier (in ddxProcessArgument) and adapt NXAGENTWINDOWNAMELENGTH to its result. 2018-04-14 02:25:21 +0200 Mike Gabriel (4d6bae082) * Application icon: Drop NoMachine logo as nxagent icon, switch to X11 icon for now. 2018-04-14 02:23:52 +0200 Mike Gabriel (c7eadb8ae) * nxmissing.xpm: Add XPM marker so that image viewers recognize the image file format. 2018-08-24 11:55:24 +0200 Mike Gabriel (930bd2833) * Merge branch 'uli42-pr/decode_options' into 3.6.x 2018-08-23 23:09:44 +0200 Ulrich Sibiller (30a962733) * Args.c: allow options to contain URL encoded characters (gh-uli42/pr/decode_options, uli42-pr/decode_options, pr/decode_options) 2018-08-23 23:08:30 +0200 Ulrich Sibiller (f8e20d05f) * Args.c: rename nxagentParseOptions to nxagentParseSingleOption 2018-08-24 10:55:02 +0200 Mike Gabriel (fad80bc4f) * Merge branch 'uli42-pr/drop_double_min_max' into 3.6.x 2018-08-23 22:57:27 +0200 Ulrich Sibiller (3bd41aaf7) * Replace MIN/MAX macros by min/max from misc.h (gh-uli42/pr/drop_double_min_max, uli42-pr/drop_double_min_max, pr/drop_double_min_max) 2018-08-22 20:18:48 +0200 Mike Gabriel (b517b66ef) * Merge branch 'uli42-pr/fix_wm_props' into 3.6.x 2018-08-22 19:37:13 +0200 Ulrich Sibiller (f9c2d560d) * Fix broken 9a7c0b081fad98bfcfcceff9557781f4b39ec572 (gh-uli42/pr/fix_wm_props, uli42-pr/fix_wm_props) 2018-08-22 15:37:48 +0200 Mike Gabriel (f9e4a54c4) * Merge branch 'uli42-pr/fix_events_debug_warnings' into 3.6.x 2018-03-08 22:32:01 +0100 Ulrich Sibiller (0db177073) * Events.c: drop variable that caused compilation warning (gh-uli42/pr/fix_events_debug_warnings, uli42-pr/fix_events_debug_warnings, pr/fix_events_debug_warnings) 2018-03-08 22:29:53 +0100 Ulrich Sibiller (553b96f05) * Events.c: fix wrong printf format specifiers 2018-03-08 22:28:29 +0100 Ulrich Sibiller (2fe89c5bf) * Events.c: fix compiler warnings 2018-03-08 22:25:15 +0100 Ulrich Sibiller (f8e76fd69) * Events.c: mitigate compiler warning 2018-08-22 15:35:49 +0200 Mike Gabriel (9f4eb6a0b) * Merge branch 'uli42-pr/refactor_defaulteventmask' into 3.6.x 2018-05-10 00:29:21 +0200 Ulrich Sibiller (129d1cc91) * refactor nxagentGet(Default)EventMask (gh-uli42/pr/refactor_defaulteventmask, uli42-pr/refactor_defaulteventmask, pr/refactor_defaulteventmask) 2018-08-22 15:29:49 +0200 Mike Gabriel (c0bef5e39) * Merge branch 'uli42-pr/track_versions' into 3.6.x 2018-07-25 23:39:06 +0200 Ulrich Sibiller (0154ef4b9) * add list with versions of the xserver modules (gh-uli42/pr/track_versions, uli42-pr/track_versions, pr/track_versions) 2018-08-22 15:21:49 +0200 Mike Gabriel (aaae5d574) * Merge branch 'Etersoft-fix-nxagent-window-title-encoding' into 3.6.x 2018-07-26 02:51:00 +0300 Pavel Vaynerman (9a7c0b081) * nxagent: Used 'Xutf8SetVMPropertis' instead of 'XSetStandardProperties' + 'Xutf8SetWMProperties' (gh-Etersoft/fix-nxagent-window-title-encoding, fix-nxagent-window-title-encoding, Etersoft-fix-nxagent-window-title-encoding) 2018-06-09 14:11:34 +0300 Pavel Vaynerman (643e13bf3) * fix window title encoding (use utf8) for nxagent 2018-08-21 18:50:16 +0200 Alan Coopersmith (489c17313) * Use min() [defined in include/misc.h] instead of MIN() [not defined in any Xorg header]. 2018-07-18 02:17:44 +0200 Mihai Moldovan (1e1693929) * [PATCH] os: XDMCP options like -query etc. should imply -listen tcp (pr/MIN-vs-min) 2018-07-07 08:04:51 +0200 Mihai Moldovan (992673157) * misc: fix more regressions and whitespace weirdness introduced in 913fcf1a74426725f14380dd5b34286a21c37ab7. 2018-07-03 22:38:26 +0200 Mike Gabriel (15f69488d) * nx-X11/lib/include/xtrans/Xtrans.c: Regression fix for 913fcf1a. 2018-06-19 23:40:33 +0200 Ulrich Sibiller (7bb238065) * XKB.h: Use the correct value for XkbAllAccessXEventsMask 2018-07-03 16:41:02 +0200 Mike Gabriel (5a8549c6e) * Merge branch 'mjtrangoni-WIP-add-cppcheck' into 3.6.x 2018-06-10 18:22:45 +0200 Mario Trangoni (5651680bb) * travis.yml: refactor some config options, add gcc-8 and clang-6.0. 2018-03-25 16:13:10 +0200 Mario Trangoni (913fcf1a7) * Fix some memory leaks. 2018-03-11 19:22:22 +0100 Mario Trangoni (c58cbc26c) * travis.yml: Add cppcheck - A tool for static C/C++ code analysis. 2018-07-03 16:35:41 +0200 Mike Gabriel (fd9de0086) * Merge branch 'uli42-pr/fix_xfont2' into 3.6.x 2018-06-19 22:05:18 +0200 Ulrich Sibiller (416f8c411) * Makefile: pass down Xfont2 define for Imake (gh-uli42/pr/fix_xfont2) 2018-07-03 16:32:11 +0200 Mike Gabriel (c86a119da) * Merge branch 'uli42-gh-sunweaver/pr/xserver-xkb-cleanup' into 3.6.x 2017-02-16 21:33:18 +0000 Mike Gabriel (b82a6a107) * debian/nxagent.*: Drop conffile /etc/nxagent/nxagent.keyboard. Not shipped upstream anymore. (gh-uli42/gh-sunweaver/pr/xserver-xkb-cleanup, gh-uli42/gh-sunweaver/pr/xserver-xkb-clean-up) 2017-02-16 21:32:45 +0000 Mike Gabriel (70a74a5c5) * nx-libs.spec: Drop reference to obsolete nxagent.keyboard file. 2017-02-16 21:32:28 +0000 Mike Gabriel (3872cd143) * etc/nxagent.keyboard: Drop file. Not required anymore. 2017-02-16 21:04:53 +0000 Mike Gabriel (6eb77137e) * Xserver/xkb: Remove XkbCF DDX configuration code. 2017-02-16 20:18:42 +0000 Mike Gabriel (e734ca217) * Removal of dead code in Xserver/xkb. Follow-up commit for 3739a9b. 2017-02-16 20:53:04 +0000 Daniel Stone (ec0cfcecf) * Xserver/xkb: Remove -xkbmap argument. 2017-02-16 21:16:50 +0000 Mike Gabriel (cc27ebb25) * hw/nxagent/Keyboard.c: Drop support for loading XKB config from file. 2018-07-03 16:25:31 +0200 Mike Gabriel (b1e4d6e84) * Merge branch 'uli42-pr/more_debug' into 3.6.x 2018-06-19 19:54:01 +0200 Ulrich Sibiller (f2d3eac89) * Atoms.c: more debugging output (gh-uli42/pr/more_debug) 2018-07-03 16:20:55 +0200 Mike Gabriel (ce83b566a) * Merge branch 'uli42-pr/misc' into 3.6.x 2018-07-03 16:19:21 +0200 Mike Gabriel (b394eac8f) * dixfonts.c: use calloc for LFclosurePtr 2018-07-03 16:17:56 +0200 Mike Gabriel (59e46dc54) * dix/dixfonts.c: free() can handle NULL 2018-06-21 23:30:34 +0200 Ulrich Sibiller (a2008b28e) * NXdixfonts.c: free() can handle NULL 2018-06-21 23:18:36 +0200 Ulrich Sibiller (e0291f30d) * NXdixfonts.c: use calloc for LFclosurePtr 2018-06-21 23:14:41 +0200 Ulrich Sibiller (cfcaa442d) * xkb/xkb.c: init all reply structs 2018-06-21 23:05:05 +0200 Ulrich Sibiller (e5975a70e) * os/io.c: fix unitialised bytes 2018-06-21 22:08:08 +0200 Ulrich Sibiller (389e3a445) * ProcGetPointerMapping uses rep.nElts before it is initialized 2018-06-21 21:46:52 +0200 Ulrich Sibiller (1e3db85a0) * Fix some valgrind findings 2018-06-21 22:16:58 +0200 Ulrich Sibiller (7a627e644) * Some small Keyboard.c improvements 2018-07-03 16:04:16 +0200 Mike Gabriel (983495123) * Merge branch 'sunweaver-pr/idletime-counter' into 3.6.x 2018-07-03 14:50:32 +0200 Mike Gabriel (222153af4) * Don't reset the lastDeviceEventTime when doing DPMS actions 2018-07-03 14:48:43 +0200 Richard Hughes (7401a6691) * Do not reset lastDeviceEventTime when we do dixSaveScreens 2018-07-03 14:43:26 +0200 Mike Gabriel (14f734873) * Backport IDLETIME system counter to nx-X11 Xserver. 2018-06-17 01:41:37 +0200 Mihai Moldovan (72f11ee83) * nx-X11/Makefile: pass down $(MFLAGS) to imake call, because... we probably want that. Likely. 2018-06-17 01:32:58 +0200 Mihai Moldovan (da51a3694) * nx-libs.spec: disable parallel builds, was pure luck that it worked before. 2018-06-17 01:05:05 +0200 Mihai Moldovan (942ae190e) * debian/rules: more Jessie unbreaking, also for dh_auto_{build,install}. 2018-06-16 16:59:00 +0200 Mihai Moldovan (8f73bf7cb) * debian/rules: unbreak Jessie: dh_auto_clean doesn't gracefully discard unknown --no-parallel flag. 2018-06-06 10:22:15 +0200 Mike Gabriel (742957393) * Merge branch 'uli42-pr/fix_missing_include' into 3.6.x (gh-Etersoft/3.6.x) 2018-06-05 22:26:51 +0200 Ulrich Sibiller (70ac10c8c) * Clipboard.c: add missing include (gh-uli42/pr/fix_missing_include) 2018-05-24 11:15:38 +0200 Mike Gabriel (7ec73ef21) * Merge branch 'uli42-pr/xinerama_without_wm' into 3.6.x 2018-05-17 23:13:38 +0200 Ulrich Sibiller (3f6d8f3e8) * Update Xinerama on XMapEvent (gh-uli42/pr/xinerama_without_wm) 2018-05-24 09:43:11 +0200 Mike Gabriel (c0f67abb4) * Merge branch 'uli42-pr/cleanup_window_hints' into 3.6.x 2018-05-05 20:14:04 +0200 Ulrich Sibiller (9138a9e3b) * whitespace fixes (gh-uli42/pr/cleanup_window_hints) 2018-05-05 20:13:20 +0200 Ulrich Sibiller (016759198) * Screen.c: simplify setting of window name/class 2018-05-04 22:29:55 +0200 Ulrich Sibiller (f9bae7554) * Events.c: catch intermediate window position changes 2018-04-11 00:39:40 +0200 Ulrich Sibiller (00c1f05ef) * nxagent: remove mmwidth/mmheight from nxagentChangeScreenConfig 2018-04-11 00:28:04 +0200 Ulrich Sibiller (845ae6eab) * Screen.c/Events.c: fix some comments 2018-04-11 00:10:20 +0200 Ulrich Sibiller (82dc00539) * nxagent: use XAllocSizeHints() instead of XSizeHints struct 2018-04-10 23:34:14 +0200 Ulrich Sibiller (82c4c28ea) * Screen.c/Events.c: add some FIXMEs 2018-04-10 23:32:57 +0200 Ulrich Sibiller (9937fbdf5) * Screen.c: replace XSetWMNormalHints code block by already existing function 2018-05-24 09:41:27 +0200 Mike Gabriel (985bed954) * debian/rules: Typo fix in dh_auto_build --no-parallel option. 2018-05-24 09:05:55 +0200 Mike Gabriel (7cb00355c) * debian/rules: Highly enforce --no-parallel mode while Xserver is still on imake. Can be re-parallelized after autotools conversion. 2018-05-24 09:04:43 +0200 Mike Gabriel (11b534ab0) * Merge branch 'uli42-pr/codespell' into 3.6.x 2018-04-10 21:27:00 +0200 Ulrich Sibiller (cce975654) * config/cf: fix spelling errors as reported by codespell (gh-uli42/pr/codespell) 2018-04-10 21:15:50 +0200 Ulrich Sibiller (e91406e9b) * nxproxy: fix spelling errors as reported by codespell 2018-04-10 21:12:44 +0200 Ulrich Sibiller (781b8a057) * compext: fix spelling errors as reported by codespell 2018-04-10 21:12:19 +0200 Ulrich Sibiller (d5da7e76f) * manpage: fix spelling error as reported by codespell 2018-04-10 21:11:57 +0200 Ulrich Sibiller (170416d26) * hw/nxagent: fix spelling errors as reported by codespell 2018-04-10 21:06:01 +0200 Ulrich Sibiller (94f7ce7d1) * nxcompshad: fix spelling errors as reported by codespell 2018-04-10 21:05:29 +0200 Ulrich Sibiller (a32554dbf) * nxcomp: fix spelling errors as reported by codespell 2018-04-30 23:40:56 +0200 Mihai Moldovan (997f2bbd2) * nx-libs.spec: we never used gpg-offline, drop it. 2018-04-25 21:40:25 +0200 Mike Gabriel (01dbfdecc) * debian/rules: Run dh_auto_clean with --no-parallel. 2018-04-25 21:34:46 +0200 Mike Gabriel (90156e3e8) * Makefile: Run BuildIncludes and clean target in nx-X11/ with -j1. 2018-04-25 21:31:32 +0200 Mike Gabriel (3d8818f60) * Revert "debian/rules: Avoid dh_auto_build. It adds -Oline since 11.2 which let's make choke in nx-X11/ subdir on the Makefiles target. Reason unknown." 2018-04-25 21:31:21 +0200 Mike Gabriel (b81759286) * Revert "debian/rules: Typo fix (NUMJOBS, not NUM_JOBS)." 2018-04-25 21:14:33 +0200 Mike Gabriel (0fc50407e) * Makefile: Enforce -j1 for BuildDependsOnly target. 2018-04-25 20:06:55 +0200 Mike Gabriel (190e3df41) * debian/rules: Typo fix (NUMJOBS, not NUM_JOBS). 2018-04-25 18:41:25 +0200 Mike Gabriel (f944a0da6) * debian/rules: Drop override_dh_clean. Makefile (et al.) removal in nx-X11/ has now been moved to the distclean target. 2018-04-25 18:40:55 +0200 Mike Gabriel (94d77e27a) * debian/rules: Avoid dh_auto_build. It adds -Oline since 11.2 which let's make choke in nx-X11/ subdir on the Makefiles target. Reason unknown. 2018-04-25 18:37:39 +0200 Mike Gabriel (da4770474) * Makefile targets: Rewriting and consolidating the target structure for nx-X11/ subdir (except nx-X11/lib/). 2018-04-20 09:03:05 +0200 Mike Gabriel (13bf7c037) * Makefile: Don't do a parallel clean-up of nx-X11. We have seen failures and due to the upcoming switch to autotools, it is pointless to dive into fixing it in the Imakefile stack. 2018-03-16 23:52:03 +0100 Mike Gabriel (28c14accd) * release 3.5.99.16 (tag: 3.5.99.16, gh-Etersoft/release-builds/3.6.x) 2018-03-15 21:30:43 +0100 Mike Gabriel (3b05d0de6) * Merge branch 'Ionic-feature/use-libtirpc' into 3.6.x 2018-03-15 12:46:12 +0100 Mihai Moldovan (2e1e9158e) * nx-libs.spec: stop needlessly exporting variables that we pass down directly anyway. (gh-ionic/feature/use-libtirpc, gh-Ionic/feature/use-libtirpc) 2018-03-09 09:11:06 +0100 Mihai Moldovan (9b1d00d30) * nx-libs.spec: force usage of libtirpc on Fedora > 27 and OpenSuSE Tumbleweed+ (soon to be Leap 15). 2018-03-09 09:09:05 +0100 Mihai Moldovan (0cd1392de) * nx-X11/config/cf/README: document new UseTIRPC macro. 2018-03-09 09:08:35 +0100 Mihai Moldovan (25cc6fce5) * nx-X11/programs/Xserver/{,os/}Imakefile: implement libtirpc forcing via UseTIRPC. 2018-03-09 09:06:11 +0100 Mihai Moldovan (090d4d19b) * nx-X11/config/cf/Imake.tmpl: implement new UseTIRPC macro, defaulting to NO. 2018-03-15 12:18:21 +0100 Mihai Moldovan (daebc8b6a) * nx-X11/programs/Xserver/Imakefile: move $(PIXMANLIB) to NXAGENTSYSLIBS, since libXcompext doesn't actually need it. 2018-03-09 09:07:15 +0100 Mihai Moldovan (32dac66c6) * nx-X11/programs/Xserver/Imakefile: use printf with no trailing newline instead of echo for variable value. 2018-03-15 12:15:27 +0100 Mihai Moldovan (7a901039c) * Makefile: pass down IMAKE_DEFINES to nx-X11/programs/Xserver build system. 2018-03-10 02:04:25 +0100 Mihai Moldovan (63a359313) * nx-X11/programs/Xserver/Imakefile: drop system libraries out of target list for nxagent regeneration. 2018-03-09 09:04:32 +0100 Mihai Moldovan (a47a73872) * nx-libs.spec: sync removed files with debian/rules. 2018-03-15 08:45:54 +0100 Mihai Moldovan (15e955545) * nx-X11/programs/Xserver/hw/nxagent/Screen.c: do not try to set a NULL mode if the output was disconnected before. 2018-03-15 08:45:00 +0100 Mihai Moldovan (6f8cdebc6) * nx-X11/programs/Xserver/hw/nxagent/Screen.c: initialize pointers to NULL to avoid referencing random data. 2018-03-07 23:46:48 +0100 Mike Gabriel (63e113de9) * release 3.5.99.15 (tag: 3.5.99.15) 2018-03-07 21:55:36 +0100 Mihai Moldovan (18630e5dd) * Merge branch 'sunweaver-pr/saver-unvalidated-lengths-ProcScreenSaverUnsetAttributes' into 3.6.x 2018-03-05 11:01:49 +0100 Nathan Kidd (7017c22c2) * Xserver/Xext/saver.c Unvalidated lengths (X.org CVE-2017-12185). (gh-sunweaver/pr/saver-unvalidated-lengths-ProcScreenSaverUnsetAttributes) 2018-03-07 21:35:51 +0100 Mihai Moldovan (f3231601b) * nxcompshad/configure.ac: blindly copy-pasting might not be the smartest idea; it's *COMPSHAD* here. 2018-03-07 21:15:18 +0100 Ulrich Sibiller (570d3fea4) * Merge branch 'sunweaver-pr/xinerama-bbox-corner-cases' into 3.6.x 2018-03-05 15:34:52 +0100 Mike Gabriel (4b7b214a7) * Xserver/hw/nxagent/Screen.c: Drop commented out code. Functionality now implemented in intersect_bb() function. (gh-sunweaver/pr/xinerama-bbox-corner-cases) 2018-03-02 14:01:29 +0100 Mike Gabriel (9117a5bf0) * hw/nxagent/Screen.c: Cover Xinerama bounding box corner cases. 2018-03-07 19:00:39 +0100 Mihai Moldovan (3352cfaba) * nxcomp{,shad}/configure.ac: replace versionating non-portable sed construct with hopefully more portable awk construct. 2018-03-07 02:01:39 +0100 Mihai Moldovan (76e7d26b8) * nx-X11/programs/Xserver/hw/nxagent/Init.c: disable DPMS support within nxagent. 2018-03-06 12:55:22 +0100 Mihai Moldovan (adb582abd) * Makefile: we don't need $(BINDIR)/bin. 2018-03-02 05:51:17 +0100 Mihai Moldovan (ed9512ed1) * nxcomp{,shad}/configure.ac: pass more portable -E option to sed instead of -r. 2018-03-01 21:46:32 +0100 Mike Gabriel (ae40bb9c4) * Merge branch 'mjtrangoni-WIP-travis' into 3.6.x 2018-01-09 20:03:17 +0100 Mario Trangoni (66ef3e46f) * README.md: Add travis badge 2018-01-01 17:51:31 +0100 Mario Trangoni (ffadec783) * Fix clang error: ordered comparison between pointer and zero ("char *" and "int") 2018-01-01 17:19:33 +0100 Mario Trangoni (d14d5838b) * Fix clang error: comparison of array authCookie not equal to a null pointer is always true 2017-12-31 17:00:43 +0100 Mario Trangoni (e1ad1d473) * Add travis yaml configuration file 2018-03-01 08:31:23 +0100 Simon Matter (a5a0a5c29) * hw/nxagent/Screen.c: Settle down with 96 DPI as the default resolution, if nothing better can be detected. 2018-02-28 10:53:45 +0100 Mike Gabriel (153be794d) * release 3.5.99.14 (tag: 3.5.99.14) 2018-02-28 01:03:53 +0100 Mihai Moldovan (5c4777b2d) * Merge branch 'uli42-pr/fix_autodpi_in_usage' into 3.6.x 2018-02-27 23:00:08 +0100 Ulrich Sibiller (809206d0c) * os: hide ttyxx option (gh-uli42/pr/fix_autodpi_in_usage) 2018-02-27 22:56:12 +0100 Ulrich Sibiller (9822e9703) * nxagent: rearrange nx options in usage 2018-02-28 00:55:13 +0100 Mihai Moldovan (1918bcb9c) * Merge branch 'uli42-pr/update_xkb' into 3.6.x 2018-02-28 00:52:10 +0100 Ulrich Sibiller (00e3e95e5) * Lift xkb to xorg-xserver-7.1/1.1.0 state - non-functional changes only (gh-uli42/pr/update_xkb) 2017-11-05 02:02:58 +0100 Ulrich Sibiller (9e6f87e20) * Lift xkb to xorg-xserver-7.1/1.1.0 state 2018-02-27 09:42:09 +0100 Mike Gabriel (a6cb8583a) * Revert "nx-libs.spec: Starting with Fedora 28 / RHEL 8, SunRPC support is being split out into a separate libraries (libtirpc)." 2018-02-27 09:37:58 +0100 Mike Gabriel (9f93e96ec) * nx-libs.spec: Starting with Fedora 28 / RHEL 8, SunRPC support is being split out into a separate libraries (libtirpc). 2018-02-27 09:33:19 +0100 Mihai Moldovan (6d4049640) * Merge branch 'sunweaver-pr/autodetect-dpi' into 3.6.x 2018-02-21 22:21:15 +0100 Mike Gabriel (29c166dbe) * nxagent: Also provide auto DPI feature via nx/nx option 'autodpi', taking only effect on session startups. (gh-sunweaver/pr/autodetect-dpi) 2017-10-09 11:36:23 +0200 Simon Matter (9dd2830e0) * nxagent: Auto-detect client-side DPI at session startup. 2018-02-27 07:47:49 +0100 Mike Gabriel (a88ca2717) * nxcomp/src/Loop.cpp: Harmonize log output. Uniformly, embrace port values by single quotes. 2018-02-27 07:48:18 +0100 Mihai Moldovan (0ef6b0d59) * {nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1,nxproxy/man/nxproxy.1}: magicpixel takes a boolean argument for now. 2018-02-27 07:39:57 +0100 Mihai Moldovan (842bb0f45) * nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1: remove empty line on top of file. 2018-02-27 07:34:54 +0100 Mike Gabriel (ea17fd059) * nxcomp/src/Loop.cpp: Make know the agent option 'keyconv' to nxcomp and tolerate it as a valid option. 2018-02-27 05:11:06 +0100 Mihai Moldovan (f963593c7) * nx-X11/programs/Xserver/{include/globals.h,mi/miinitext.c}: remove DPSEXT left-overs. 2018-02-27 03:20:46 +0100 Mihai Moldovan (7a4aa75de) * Merge branch 'uli42-pr/update_os' into 3.6.x 2018-02-27 03:13:55 +0100 Ulrich Sibiller (41ff6b034) * Lift os to XORG-7_1 state - non-functional changes only (gh-uli42/pr/update_os) 2017-11-05 13:26:04 +0100 Ulrich Sibiller (2d59daca2) * Lift os to XORG-7_1 state 2018-02-27 03:02:00 +0100 Mihai Moldovan (78724c486) * Remove unused X11R4 DDX compatibility function miClipNotify. 2018-02-27 02:56:01 +0100 Mihai Moldovan (3fffa5bd8) * Merge branch 'uli42-pr/update_mi' into 3.6.x 2018-02-27 02:47:11 +0100 Ulrich Sibiller (7368b4540) * Lift mi to xorg-xserver-7.1/1.1.0 state - non-functional changes only (gh-uli42/pr/update_mi) 2017-11-05 21:25:49 +0100 Ulrich Sibiller (6b0a1738f) * Lift mi to xorg-xserver-7.1/1.1.0 state 2017-11-05 13:45:31 +0100 Ulrich Sibiller (23dd2959b) * Lift miext to xorg-xserver-7.1/1.1.10 state 2018-02-27 02:14:07 +0100 Mihai Moldovan (eaae96101) * Merge branch 'uli42-pr/update_record' into 3.6.x 2017-11-05 23:24:55 +0100 Ulrich Sibiller (e5833a6a1) * Lift record to xorg-server-1.4.2 state (gh-uli42/pr/update_record) 2018-02-27 01:47:50 +0100 Ulrich Sibiller (39a56dea4) * Lift record to xorg-server-1.2.0/xorg-server-1.3.0.0 state - non-functional changes only 2017-11-05 23:15:07 +0100 Ulrich Sibiller (1c7abb05b) * Lift record to xorg-server-1.2.0/xorg-server-1.3.0.0 state 2018-02-27 01:38:29 +0100 Ulrich Sibiller (0b6259900) * Lift record to xorg-xserver-7.1/1.1.0 state - non-functional changes only 2017-11-05 12:39:05 +0100 Ulrich Sibiller (db836fd78) * Lift record to xorg-xserver-7.1/1.1.0 state 2018-02-27 01:07:02 +0100 Mihai Moldovan (92d806399) * Merge branch 'sunweaver-pr/version-cmdline-option' into 3.6.x 2018-02-26 12:50:12 +0100 Mike Gabriel (0371276fb) * hw/nxagent/: Stop using non-portable '__progname', set up our own 'nxagentProgName' instead and pass it around where needed. (gh-sunweaver/pr/version-cmdline-option) 2018-02-26 12:22:15 +0100 Mike Gabriel (99fb9817f) * hw/nxagent/: Use (void) rather than (). 2018-02-21 23:46:55 +0100 Simon Matter (deeac7e0f) * nxagent/Args.c: Mention new -options cmdline parameter in usage info. 2018-02-21 23:49:55 +0100 Simon Matter (eded33173) * nxagent: Print correct application in usage message. 2018-02-21 23:39:23 +0100 Simon Matter (7c32938ac) * nxagent: Add -version cmdline option. 2018-02-26 07:46:22 +0100 Mihai Moldovan (751760421) * nx-libs.spec: also package extensions/shapeconst.h in RPM packages. 2018-02-26 06:17:08 +0100 Mihai Moldovan (711fd2447) * Merge branch 'uli42-pr/update_dbe' into 3.6.x 2018-01-22 22:44:54 +0100 Ulrich Sibiller (f1f2a360f) * dbe: add NXAGENT_SERVER guard for DixLookup (gh-uli42/pr/update_dbe) 2018-02-26 06:15:49 +0100 Ulrich Sibiller (d364ea933) * Lift dbe to xorg-xserver-1.4.2 state - non-functional changes only 2018-01-22 22:26:59 +0100 Ulrich Sibiller (95b5cf795) * Lift dbe to xorg-xserver-1.4.2 state 2018-02-26 06:11:56 +0100 Ulrich Sibiller (4c5e9a295) * Lift dbe to xorg-xserver-7.1/1.1.0 state - non-functional changes only 2017-11-05 22:00:44 +0100 Ulrich Sibiller (c529873d9) * Lift dbe to xorg-xserver-7.1/1.1.0 state 2018-02-26 05:18:12 +0100 Mihai Moldovan (3d8f8d7ab) * debian/nx-x11proto-xext-dev.install: install new file extensions/shapeconst.h. 2018-02-26 05:12:20 +0100 Mihai Moldovan (a9787fc2e) * Merge branch 'uli42-pr/update_dix' into 3.6.x 2018-02-03 00:19:29 +0100 Ulrich Sibiller (6dcfcbabe) * Transfer previous dix changes into hw/nxagent (gh-uli42/pr/update_dix) 2018-02-26 05:03:53 +0100 Ulrich Sibiller (1b54f6462) * Lift dix to xorg-xserver-1.3.0.0 state - non-functional changes only 2018-01-23 00:47:38 +0100 Ulrich Sibiller (485d62676) * Lift dix to xorg-xserver-1.3.0.0 state 2018-02-26 04:56:21 +0100 Ulrich Sibiller (2853ab292) * Lift dix to xorg-xserver-7.1/1.1.0 state - non-functional changes only 2017-11-04 23:51:30 +0100 Ulrich Sibiller (50a337940) * Lift dix to xorg-xserver-7.1/1.1.0 state 2018-02-26 03:00:24 +0100 Mihai Moldovan (b40dec982) * Merge branch 'uli42-pr/update_xfixes' into 3.6.x 2018-02-26 02:56:58 +0100 Ulrich Sibiller (35d166b80) * Lift XFIXES to xorg-xserver-1.4.2 state - non-functional changes only (gh-uli42/pr/update_xfixes) 2017-11-05 23:59:22 +0100 Ulrich Sibiller (d59e8d7f4) * Lift XFIXES to xorg-xserver-1.4.2 state 2018-02-26 02:44:10 +0100 Ulrich Sibiller (5706005f7) * Lift XFIXES to xorg-xserver-7.1/1.1.0 state (XFIXES 4.0) - non-functional changes only 2017-10-31 01:54:47 +0100 Ulrich Sibiller (a667131e2) * Lift XFIXES to xorg-xserver-7.1/1.1.0 state (XFIXES 4.0) 2018-02-26 01:09:05 +0100 Mihai Moldovan (164263e1a) * Merge branch 'sunweaver-pr/nomagicpixel' into 3.6.x 2018-02-21 10:39:46 +0100 Mike Gabriel (8d00456ad) * nxagent: Add support for optionally enabling/disabling the magic pixel feature. (gh-sunweaver/pr/nomagicpixel) 2018-02-26 01:00:54 +0100 Mihai Moldovan (05152b788) * Merge branch 'uli42-pr/update_xi' into arctica-3.6.x 2018-02-15 21:56:52 +0100 Ulrich Sibiller (4598c0c3d) * Xi: change () prototypes to (void) (gh-uli42/pr/update_xi) 2018-02-15 21:42:51 +0100 Ulrich Sibiller (ebe1c2f22) * Xi/getbmap.c: remove unnecessary cast 2018-02-15 21:41:19 +0100 Ulrich Sibiller (8e188629f) * Xi: small formatting changes to match Xorg 7.1's Xi 2018-02-15 21:25:27 +0100 Ulrich Sibiller (b0abdf7bd) * Xi: reformat 2018-02-15 15:14:14 +0100 Ulrich Sibiller (7aca428ff) * Xi: ansify function prototypes 2018-02-11 22:01:11 +0100 Ulrich Sibiller (41a0ba729) * Xi: reformat code, ansify 2018-02-08 23:44:10 +0100 Ulrich Sibiller (5bfafee50) * Xi: Adapt include sections to match Xorg 7.1 2018-02-25 19:47:00 +0100 Mike Gabriel (e247900ed) * debian/control: Don't B-D on build-essential packages. 2018-02-25 19:46:08 +0100 Mike Gabriel (b18477eb4) * debian/copyright: Update copyright attributions. 2018-02-25 19:45:01 +0100 Mike Gabriel (4b81b8b38) * debian/watch: Drop file. Not really useful in native / upstream-provided package. 2018-02-25 19:44:34 +0100 Mike Gabriel (7986787c1) * debian/control: Bump Standards-Version: to 4.1.3. No changes needed. 2018-02-25 19:36:21 +0100 Mike Gabriel (e8552b7bb) * nxcompshad: Regression fix for 990e61cc. Add missing $(NULL) in 'if TARGET_ELF' clause. 2018-02-25 15:03:52 +0100 Mike Gabriel (a653aed4c) * Merge branch 'Ionic-bugfix/FTBFS-non-ELF' into 3.6.x 2018-02-25 04:35:07 +0100 Mihai Moldovan (06c14b831) * nxproxy/{configure.ac,src/Makefile.am}: only enable new ELF dtags if target system actually is ELF-based. (gh-ionic/bugfix/FTBFS-non-ELF, gh-Ionic/bugfix/FTBFS-non-ELF) 2018-02-25 04:33:52 +0100 Mihai Moldovan (990e61cc8) * nxcompshad/{configure.ac,src/Makefile.am}: only enable new ELF dtags if target system actually is ELF-based. 2018-02-25 04:32:15 +0100 Mihai Moldovan (be1ae7087) * m4/nx-macros.m4: add NX_TARGET_USE_ELF macro, setting TARGET_ELF automake conditional if target compiler is generating ELF binaries. 2018-02-25 04:29:52 +0100 Mihai Moldovan (dd1ae1769) * nxcomp{,shad}/configure.ac: trailing whitespace removal only. 2018-02-09 03:41:22 +0100 Mihai Moldovan (7af47b583) * Revert "NXhsm.c: add missing code" 2018-02-08 20:40:32 +0100 Mihai Moldovan (f76d4b541) * nx-X11/config/cf/{Imake.{cf,tmpl},{linux,xorg}.cf}: support ppc64le alongside ppc64(be). 2018-02-07 23:19:33 +0100 Mihai Moldovan (aecdb5266) * Merge branch 'uli42-pr/update_xext' into 3.6.x 2017-10-21 02:54:33 +0200 Ulrich Sibiller (5ec2366c4) * Xext: lift xvmain.c to xorg-xserver-7.1/1.1 state (gh-uli42/pr/update_xext) 2017-10-21 02:47:07 +0200 Ulrich Sibiller (8ebb5d23c) * Xext: lift xres.c to xorg-xserver-7.1/1.1 state 2017-10-21 02:43:20 +0200 Ulrich Sibiller (e85c6885e) * Xext: lift sync.c to xorg-xserver-7.1/1.1 state 2017-10-21 02:42:58 +0200 Ulrich Sibiller (62373d428) * Xext: lift sleeputil.c to xorg-xserver-7.1/1.1 state 2017-10-21 02:12:01 +0200 Ulrich Sibiller (d9c3a7249) * Xext: lift panoramiX to xorg-xserver-7.1/1.1 state 2017-10-21 02:04:30 +0200 Ulrich Sibiller (31900d41a) * Xext: lift DPMS extension to xorg-xserver-7.1/1.1 state 2017-10-21 01:47:40 +0200 Ulrich Sibiller (4ab18725c) * Xext: lift screensaver extension to XORG-7_1 state 2018-02-07 22:29:41 +0100 Mihai Moldovan (cbdae3b71) * nx-libs.spec: delete useless cond_noarch macro that has never been used. 2018-02-07 22:28:02 +0100 Mihai Moldovan (6449b5548) * nx-libs.spec: build-depend on libtirpc-devel for rpc/rpc.h and friends on Fedora 28+. 2018-02-07 22:21:35 +0100 Mihai Moldovan (88efaf8af) * nx-libs.spec: only apply ppc64le workaround when compiled against RHEL/EPEL 7. 2018-02-05 14:07:27 +0100 Mike Gabriel (a110b0c45) * Merge branch 'uli42-pr/update_fb' into 3.6.x 2017-11-05 21:41:08 +0100 Ulrich Sibiller (f7207bcdc) * Lift fb to xorg-xserver-7.1/1.1 state (gh-uli42/pr/update_fb) 2018-02-05 13:02:30 +0100 Mike Gabriel (b1c42dc98) * Merge branch 'uli42-pr/some_cleanups' into 3.6.x 2018-01-05 01:51:02 +0100 Ulrich Sibiller (7db6cff1c) * Window.c: fix TEST/DEBUG output (gh-uli42/pr/some_cleanups) 2018-01-05 01:45:15 +0100 Ulrich Sibiller (ffc363c54) * Split.c: make nxagentWaitDrawable TEST messages look like all the others 2018-01-05 01:44:58 +0100 Ulrich Sibiller (e3d749f68) * Split.c: Fix wrong function names in TEST output 2018-01-05 01:41:52 +0100 Ulrich Sibiller (0a2a9da33) * Splash.c: Fix wrong function names in TEST/DEBUG output 2018-01-05 01:39:00 +0100 Ulrich Sibiller (0e54be636) * Screen.c: Fix wrong function names in TEST output 2018-01-05 01:36:12 +0100 Ulrich Sibiller (1930f184c) * Rootless.c: Fix wrong function name in WARNING output 2018-01-05 01:34:11 +0100 Ulrich Sibiller (f511fba34) * Reconnect.c: Fix wrong function names in TEST output 2018-01-05 01:31:44 +0100 Ulrich Sibiller (87afc32f9) * Pixmap.c: Fix wrong function names in TEST/WARNING output 2018-01-05 01:19:40 +0100 Ulrich Sibiller (1c020ea9c) * Events.c: change scope of XButtonEvent struct and clear it before use 2018-01-05 01:19:26 +0100 Ulrich Sibiller (1997c04ab) * Events.c: Fix wrong function name in TEST output 2018-01-05 01:08:18 +0100 Ulrich Sibiller (5cee71a3c) * Dialog.c: Fix wrong function names in TEST output 2018-01-05 01:05:44 +0100 Ulrich Sibiller (61e4d2949) * Composite.c: Fix wrong function names in TEST output 2018-01-05 00:50:29 +0100 Ulrich Sibiller (876063ce1) * Client.c: Fix wrong function names in DEBUG/WARNING output 2018-01-05 00:47:32 +0100 Ulrich Sibiller (9e22a10a5) * NXdispatch.c: add FIXME 2018-01-05 00:47:11 +0100 Ulrich Sibiller (acbc9cd31) * NXdispatch.c: fix wrong indentation 2018-01-05 00:46:34 +0100 Ulrich Sibiller (99b114370) * Handlers.c: Fix wrong function names in TEST output 2018-02-05 12:14:39 +0100 Mike Gabriel (995350d14) * Merge branch 'uli42-pr/shm_missing_code' into 3.6.x 2018-02-02 22:39:06 +0100 Ulrich Sibiller (9fb582f42) * NXhsm.c: drop setting of sequence number (gh-uli42/pr/shm_missing_code) 2018-02-02 22:40:23 +0100 Ulrich Sibiller (c804d99f2) * NXhsm.c: add missing code 2018-01-28 21:36:03 +0100 Helmut Grohne (ef0a3d636) * debian/rules: Fix FTCBFS: (see Debian bug #875867) Fix build/host confusion in debian/rules. Pass --host to ./configure. 2018-01-20 14:03:28 +0100 Mike Gabriel (949b91c64) * nxcomp/src/Loop.cpp: Typo fix in error msg. 2018-01-16 15:19:42 +0100 Mike Gabriel (61265ff61) * release 3.5.99.13 (tag: 3.5.99.13) 2018-01-16 15:08:07 +0100 Mike Gabriel (9772277c6) * Merge branch 'sunweaver-pr/keep-disabled-rrxinerama-disabled-on-reconnects' into 3.6.x 2018-01-16 14:52:43 +0100 Mike Gabriel (05dd84256) * hw/nxagent/Screen.c: Additionally check for noRRXineramaExtension set to FALSE before using the nxagentAdjustRandRXinerama() function and providing a Xinerama-like user experience. (gh-sunweaver/pr/keep-disabled-rrxinerama-disabled-on-reconnects, pr/keep-disabled-rrxinerama-disabled-on-reconnects) 2018-01-11 10:01:18 +0100 Mihai Moldovan (7c43682e8) * nx-X11/config/cf/{gnu,lnx}Lib.rules: add RPATH entries for temporary nxcomp and nxcompshad libraries. 2018-01-09 01:08:17 +0100 Mihai Moldovan (1086c4aa5) * Merge branch 'Ionic-bugfix/ctime' into 3.6.x 2017-12-30 09:30:03 +0100 Mihai Moldovan (2eb2f2e6c) * nxcomp/src/Timestamp.{cpp,h}: use ::ctime_s or ::ctime_r instead of plain ctime, on-stack buffers and return std::string objects. (gh-ionic/bugfix/ctime, gh-Ionic/bugfix/ctime) 2017-12-30 09:25:26 +0100 Mihai Moldovan (df8908b9d) * nxcomp/configure.ac: add check for ::ctime_s. 2018-01-08 23:43:28 +0100 Mihai Moldovan (70e1e6a01) * Merge branch 'uli42-pr/fix_xext_includes' into 3.6.x 2018-01-08 23:08:51 +0100 Ulrich Sibiller (f66820b57) * panoramiX: fix includes (gh-uli42/pr/fix_xext_includes) 2018-01-08 22:58:26 +0100 Mihai Moldovan (47ef330c5) * Merge branch 'uli42-pr/reenable_xc-misc' into 3.6.x 2018-01-08 22:25:35 +0100 Ulrich Sibiller (43456713b) * Re-enable XC-MISC extension (gh-uli42/pr/reenable_xc-misc) 2018-01-07 01:29:13 +0100 Mihai Moldovan (5f9f744cd) * Merge branch 'uli42-pr/fix_strings' into 3.6.x 2018-01-03 22:28:43 +0100 Ulrich Sibiller (23c36c2d2) * Display.c: drop helper variable in loop (gh-uli42/pr/fix_strings) 2018-01-03 02:34:10 +0100 Ulrich Sibiller (b89b80949) * Error.c: replace malloc+strcpy by strdup 2018-01-03 02:29:55 +0100 Ulrich Sibiller (27a31d0ce) * Events.c: add FIXME 2018-01-03 02:22:11 +0100 Ulrich Sibiller (11b2b067e) * Keyboard.c: rework string allocation/building 2018-01-03 01:55:32 +0100 Ulrich Sibiller (a0e985fb6) * Keystroke.c: replace calloc + 2 * strcpy by asprintf 2018-01-03 01:31:52 +0100 Ulrich Sibiller (185470072) * Font.c: replace malloc + strcpy by strdup + fix memleak 2018-01-03 01:17:59 +0100 Ulrich Sibiller (054ae8447) * Font.c: free possibly allocated mem 2018-01-03 01:11:34 +0100 Ulrich Sibiller (56fa23485) * Font.c: replace memcpy by sprintf preventing possible buffer overflows 2018-01-03 00:59:59 +0100 Ulrich Sibiller (cac1af52d) * Args.c: simplify nxagentGetDialogName() 2018-01-03 00:59:20 +0100 Ulrich Sibiller (74c21e9e2) * Args.c, Error.[ch]: introduce own length macro for nxagentClientsLogName 2018-01-03 00:32:14 +0100 Ulrich Sibiller (dc61b6cca) * Args.c: use strdup instead of malloc 2018-01-03 00:18:39 +0100 Ulrich Sibiller (96e430069) * Error.c: update nxagentPrintError 2018-01-03 00:06:39 +0100 Ulrich Sibiller (525e15168) * Error.c: replace strcpy/strcat by snprintf 2018-01-03 00:05:49 +0100 Ulrich Sibiller (7d87e5a0c) * Error.c: use standard file descriptor macros 2018-01-03 00:05:09 +0100 Ulrich Sibiller (654422a04) * Error.c: remove trailing whitespace 2018-01-02 23:53:14 +0100 Ulrich Sibiller (6c080c839) * Error.c: remove empty ifdef 2018-01-02 21:02:41 +0100 Ulrich Sibiller (a8a693817) * Font.c: pass down size 2018-01-02 19:24:49 +0100 Ulrich Sibiller (19a3918a7) * Display.c: pass down buffer size to nxagentLookForIconFile 2018-01-02 19:23:20 +0100 Ulrich Sibiller (ea1e0bea3) * Replace hardcoded string lengths by macros 2017-12-08 00:30:32 +0100 Ulrich Sibiller (9a6b90c31) * Font.c: make nxagentGetFontServerPath more readable 2017-12-08 00:19:50 +0100 Ulrich Sibiller (677da7fd3) * Screen.c: string handling improvements 2017-12-08 00:17:24 +0100 Ulrich Sibiller (9d5c83e2f) * Font.c: shorten string handling 2017-11-24 00:54:14 +0100 Ulrich Sibiller (2836c72f7) * Keyboard.c: replace malloc + strcpy by asprintf 2017-11-24 00:49:17 +0100 Ulrich Sibiller (08912ef30) * Keyboard.c: improve user messages for keyboard file handling 2017-11-24 00:48:42 +0100 Ulrich Sibiller (0e2c4df8e) * Keyboard.c: fix memory leak 2017-11-23 23:18:44 +0100 Ulrich Sibiller (3de6bc749) * Dialog.c: fix possible buffer overflows 2017-11-24 00:25:25 +0100 Ulrich Sibiller (4a345786c) * Dialog.c,Display.c,NXdixfonts.c: replace strncpy() by snprintf where appropriate 2017-11-23 21:25:26 +0100 Ulrich Sibiller (5987a7b1a) * Dialog.c,Display.c,Font.c,NXdixfonts.c: don't use hardcoded string buffer lengths 2018-01-05 23:21:52 +0100 Mihai Moldovan (3c8189971) * Merge branch 'Ionic-bugfix/rpath' into 3.6.x 2018-01-03 03:22:31 +0100 Mihai Moldovan (1c1431c0f) * nxproxy/src/Makefile.am: build library using RUNPATH instead of RPATH. (gh-ionic/bugfix/rpath, gh-Ionic/bugfix/rpath) 2018-01-03 03:18:12 +0100 Mihai Moldovan (d1897719a) * nxproxy/configure.ac: enable libtool support. 2018-01-03 03:17:10 +0100 Mihai Moldovan (4d481bf99) * nxproxy/configure.ac: drop --enable-cxx11. 2017-12-30 00:40:06 +0100 Mihai Moldovan (b91b13b37) * Makefile: only try to copy/dereference libNX* files when installing data. 2017-12-30 00:17:57 +0100 Mihai Moldovan (ecaa13ce6) * nx-X11: reintroduce creation of libX11 compat symlinks. 2017-12-29 22:35:58 +0100 Mihai Moldovan (3d17c665b) * Makefile: install relinked program binary instead of the "temporary" one. 2017-12-29 21:44:56 +0100 Mihai Moldovan (ffc09a73d) * nx-X11: build programs with a temporary RPATH/RUNPATH value and a relinked version with the system location. 2017-12-28 23:16:32 +0100 Mihai Moldovan (44f8c424e) * nxcompshad/src/Makefile.am: enable new ELF dtags to force RUNPATH creation for libXcompshad. 2017-12-28 23:12:50 +0100 Mihai Moldovan (4b153f5b0) * nx-X11/config/cf/{gnu,lnx}Lib.rules: enable new ELF dtags to force RUNPATH creation for nxagent. 2017-12-26 04:10:27 +0100 Mihai Moldovan (b13bf675a) * nxcompshad/src/Makefile.am: implement libX11 RPATH/RUNPATH override. 2017-12-26 04:06:40 +0100 Mihai Moldovan (26ab7b8a7) * nxagent: implement RPATH/RUNPATH override for libX11. 2017-12-30 03:31:20 +0100 Mihai Moldovan (e13e31f75) * Merge branch 'uli42-pr/fix_abstract' into 3.6.x (gh-mjtrangoni/3.6.x) 2017-12-29 14:25:53 +0100 Ulrich Sibiller (367bec595) * EncodeBuffer.cpp: add another VALGRIND guard (gh-uli42/pr/fix_abstract) 2017-12-28 11:19:44 +0100 Ulrich Sibiller (6e98e35cf) * nxcomp: drop strncpy in favour of snprintf 2017-12-27 21:13:39 +0100 Ulrich Sibiller (9e8bd2e1b) * Loop.cpp: fix memleak happening with unknown tcp host 2017-12-27 19:16:15 +0100 Ulrich Sibiller (ce293647d) * ChannelEndPoint.cpp: fix possible memleak in getUnixPath() 2017-12-27 19:15:23 +0100 Ulrich Sibiller (17d045826) * ChannelEndPoint.cpp: remove unneccessary code 2017-12-27 17:06:43 +0100 Ulrich Sibiller (eae64c4a4) * ChannelEndPoint.cpp: fix another memleak 2017-12-27 15:23:33 +0100 Ulrich Sibiller (96879dc69) * EncodeBuffer.cpp: add VALGRIND guard 2017-12-27 14:53:58 +0100 Ulrich Sibiller (6198e0376) * nxcomp: implement correct length handling for unix socket structs 2017-12-27 14:43:50 +0100 Ulrich Sibiller (2367fc714) * Loop.cpp: drop ugly ifdef indentation 2017-12-27 14:43:22 +0100 Ulrich Sibiller (6d8fe661e) * Loop.cpp: create xServerAddrUNIX only if required 2017-12-27 13:16:35 +0100 Ulrich Sibiller (14a558918) * Loop.cpp: improve/fix usage of s(n)printf 2017-12-27 13:09:25 +0100 Ulrich Sibiller (3066195d7) * Loop.cpp: some reformatting/simplification/FIXMEs 2017-12-27 12:54:30 +0100 Ulrich Sibiller (c31c54c1b) * Loop.cpp: delete passed object prior to overwriting it 2017-12-27 12:18:28 +0100 Ulrich Sibiller (c48748ba0) * ChannelEndPoint.cpp: re-scope/improve getSpec 2017-12-27 12:15:47 +0100 Ulrich Sibiller (f1905c864) * Loop.cpp: delete structs when no longer required 2017-12-27 12:14:38 +0100 Ulrich Sibiller (b593edeb2) * Loop.cpp: always close testSocketFD 2017-12-27 12:13:43 +0100 Ulrich Sibiller (4107159e2) * Loop.cpp: free display before leaving SetupDisplaySocket() 2017-12-27 12:12:20 +0100 Ulrich Sibiller (604e09686) * Loop.cpp: Fix memset (size was 0) 2017-12-28 19:32:22 +0100 Mihai Moldovan (2d44051aa) * Merge branch 'uli42-pr/silence_nxcompshad_warnings' into 3.6.x 2017-12-27 23:54:34 +0100 Ulrich Sibiller (2cade632b) * nxcompshad: silence GCC warnings (gh-uli42/pr/silence_nxcompshad_warnings) 2017-12-28 00:18:58 +0100 Mihai Moldovan (061c35772) * Merge branch 'uli42-pr/reduce_uninitialised' into 3.6.x 2017-12-10 23:57:35 +0100 Ulrich Sibiller (6acbfab33) * reduce usage of uninitialised bytes (gh-uli42/pr/reduce_uninitialised) 2017-12-27 22:09:29 +0100 Mihai Moldovan (bc5f9a236) * nxcomp/src/Log.h: take a reference-type in generic has_newline() function. 2017-12-27 20:12:26 +0100 Mihai Moldovan (8036f6914) * nxcomp/src/Log.cpp: don't confuse users with useless warning messages in case that a log line append operation was requested, but the message level has lower precedence than the current log filter. 2017-12-27 19:49:25 +0100 Mihai Moldovan (56dbc2156) * nxcomp/src/Log.h: make sure we don't pass NULL pointers to strstr(). 2017-12-25 17:39:40 +0100 Mihai Moldovan (57845ced5) * nxcomp/src/Loop.cpp: whitespace in log messages only. 2017-12-25 02:19:17 +0100 Mihai Moldovan (970704ca4) * nxcomp/src/Loop.cpp: use new log continuation mechanism. 2017-12-25 02:18:46 +0100 Mihai Moldovan (fe447bb6d) * nxcomp/src/Loop.cpp: whitespace only. 2017-12-24 22:16:38 +0100 Mihai Moldovan (dccf5901e) * nxcomp/src/Log.{cpp,h}: provide infrastructure for appending to already existing log lines. 2017-12-24 20:17:18 +0100 Mihai Moldovan (b30cfaa24) * nxcomp/src/Log.h: NXLogStamp constructor should actually take a size_t-typed line parameter. 2017-12-24 20:07:44 +0100 Mihai Moldovan (5ff87ca9e) * nxcomp/src/Log.h: use initializer lists instead of initializing member variables in-block. 2017-12-24 18:37:03 +0100 Mihai Moldovan (fcb41e324) * nx-X11/programs/Xserver/hw/nxagent/Screen.c: re-enable normal error/warning output. 2017-12-24 17:59:35 +0100 Mihai Moldovan (9dba2435c) * nxcomp/src/ChannelEndPoint.cpp: don't use C-style casting in C++ code... 2017-12-24 17:59:17 +0100 Mihai Moldovan (ae73fedf8) * nxcomp/src/Loop.cpp: fix small memory leak. 2017-12-24 16:30:19 +0100 Mihai Moldovan (1e448d2f5) * testscripts/run-nxproxy2nx*: use more quotes, common variables and braces. 2017-12-24 15:51:11 +0100 Mihai Moldovan (a0003405b) * testscripts/run-nxproxy2nx*: drop echo -ne "...\n". 2017-12-24 15:45:01 +0100 Mihai Moldovan (6c7869ab9) * testscripts/*: fix "randlomly" typos. 2017-12-24 04:57:12 +0100 Mihai Moldovan (34bef6330) * nx-X11/programs/Xserver/hw/nxagent/Screen.c: update screen size after modifying CRTC modes. 2017-12-19 16:06:06 +0100 Mihai Moldovan (75767979e) * nx-libs.spec: make sure pass additional configure flags through, not discard them. 2017-12-19 11:39:33 +0100 Mihai Moldovan (ef28eb472) * nx-X11/extras/Mesa.patches_6.4.2/4002_no-special-glx-memfunctions.patch: include stdlib.h and string.h for memset, malloc and free prototypes. 2017-12-19 11:34:53 +0100 Mihai Moldovan (218a340d8) * mesa-quilt: drop debugging option erroneously committed. 2017-12-19 11:32:54 +0100 Mihai Moldovan (2c4afb84e) * mesa-quilt: ignore user configuration file when applying MESA patches. 2017-12-19 08:49:20 +0100 Mihai Moldovan (10871bba0) * nx-libs.spec: show compile calls during RPM-based builds. 2017-12-19 08:12:24 +0100 Mihai Moldovan (6616983f2) * nx-libs.spec: re-add %{optflags} to CDEBUGFLAGS. 2017-12-18 12:23:45 +0100 Mihai Moldovan (08ad4d04d) * nxcomp/src/Loop.cpp: log message fixups only. 2017-12-16 14:50:12 +0100 Mihai Moldovan (e7b744525) * Drop SHMNAME workaround again, it *is* defined in shmstr.h, which is actually header I was searching for. 2017-12-16 14:45:46 +0100 Mihai Moldovan (1e2fc1548) * nx-X11/programs/Xserver/Xext/shape.c: avoid pulling in Xlib in legacy mode via the _SHAPE_SERVER_ macro. 2017-12-16 13:06:36 +0100 Mihai Moldovan (3abdb9960) * nx-X11/programs/Xserver/Xext/shape.c: pull in shapestr.h for legacy Xext proto versions, since shape.h would pull in Xlib. 2017-12-16 09:40:44 +0100 Mihai Moldovan (caa048a18) * Handle SHAPE proto splitup gracefully for legacy Xext proto versions. 2017-12-16 08:38:29 +0100 Mihai Moldovan (404e6634a) * zlib compatibility: whenever we want -I flags only, assume that the headers are directly available. 2017-12-16 07:57:47 +0100 Mihai Moldovan (e37532ca8) * nx-X11/programs/Xserver/include/misc.h: add compat define for SHMNAME. 2017-12-16 07:47:17 +0100 Mihai Moldovan (779a116ff) * Support building with legacy zlib versions that do not ship a pkg-config file. 2017-12-16 07:18:11 +0100 Mihai Moldovan (e92c2a878) * Support building with legacy (pre-7.1.0) Xext proto versions. 2017-12-16 06:41:15 +0100 Mihai Moldovan (0d6207bd3) * Revert "nx-libs.spec: add xorg-x11-libXext-devel build dependency for older *SUSE versions." 2017-12-16 06:36:52 +0100 Mihai Moldovan (cc47066b3) * nx-libs.spec: add xorg-x11-libXext-devel build dependency for older *SUSE versions. 2017-12-16 05:53:26 +0100 Mihai Moldovan (ddd6f72ff) * nx{comp{,shad},proxy}: use dist-bzip2 instead of dist-xz. 2017-12-16 05:35:51 +0100 Mihai Moldovan (4c4f2b185) * debian/control: add dependencies needed for debian/compat.sh. 2017-12-16 05:11:42 +0100 Mihai Moldovan (c173e6b99) * Makefile: correctly quote variables when passing them down to other programs. 2017-12-16 04:17:24 +0100 Mihai Moldovan (3206eacf6) * nx-libs.spec: pixman is called libpixman-1-0 on older *SUSE versions. 2017-12-16 04:16:45 +0100 Mihai Moldovan (3411a8bc7) * nx-libs.spec: imake is part of xorg-x11-util-devel on older *SUSE versions and the splitted imake package on later versions. 2017-12-16 04:16:06 +0100 Mihai Moldovan (c7c4987b8) * nx-libs.spec: older *SUSE versions do not split up (all) libraries in a useful manner. 2017-12-16 03:55:58 +0100 Mihai Moldovan (fe011b55d) * Support building with legacy (pre-1.4.2) libXfont(1) versions. 2017-12-16 02:22:18 +0100 Mihai Moldovan (fb2e9a8b5) * debian/rules: execute new debian/compat.sh file before the actual build. 2017-12-16 02:21:36 +0100 Mihai Moldovan (baf61fbb2) * debian/: add compat.sh file containing compatibility logic for older Debian and Ubuntu versions. 2017-12-16 00:49:00 +0100 Mihai Moldovan (0bbef4f40) * nx-libs.spec: also own %{_datadir}/nx/X11, since %dir explicitly does not recurse down. 2017-12-15 17:43:48 +0100 Mihai Moldovan (1d431b53c) * nxcompshad/Makefile.am: also correctly call aclocal here. 2017-12-15 17:18:41 +0100 Mihai Moldovan (0e0eb5a43) * {nx-X11/lib,nxproxy}/Makefile.am: also use correct aclocal flags in the other locations. 2017-12-15 17:10:04 +0100 Mihai Moldovan (df6afb60d) * nxcomp/test/logging_test.cpp: return a value in non-void function. 2017-12-15 17:00:11 +0100 Mihai Moldovan (a10b9c649) * nx-X11/config/cf/linux.cf: recursive macros aren't a thing. 2017-12-15 15:52:17 +0100 Mihai Moldovan (3d59e2c30) * nxcomp/Makefile.am: call aclocal with the correct include dir argument. 2017-12-15 15:20:16 +0100 Mihai Moldovan (a22213e47) * nx-libs.spec: only remove files in the BuildRoot. 2017-12-15 14:12:25 +0100 Mihai Moldovan (dfa24dd8f) * nx-X11/config/cf/linux.cf: don't override default CC options for {ARM,PPC}{32,64}. 2017-12-15 12:55:17 +0100 Mihai Moldovan (1dad092ca) * Merge branch '3.6.x' 2017-12-15 12:40:31 +0100 Mike Gabriel (2b9025f79) * release 3.5.99.12 (tag: 3.5.99.12, gh-mjtrangoni/release-builds/3.6.x) 2017-12-15 12:05:16 +0100 Mike Gabriel (4fb495432) * Xserver/hw/nxagent/Image.c: Fix regression FTBFS after d4465b71 got merged in. 2017-12-15 12:02:36 +0100 Mike Gabriel (cfbb03820) * debian/changelog: post-release version bump to 3.5.99.11 2017-12-15 11:20:52 +0100 Mike Gabriel (b213c8eba) * release 3.5.99.11 (tag: 3.5.99.11) 2017-12-15 11:15:22 +0100 Mike Gabriel (4cca1b4bd) * Merge branch 'sunweaver-pr/more-X-memory-macro-fixes' into 3.6.x 2017-12-14 11:27:35 +0100 Mike Gabriel (5597f2ea5) * Xserver/hw/nxagent/Clipboard.c: Fix free calls (free back to XFree). (gh-sunweaver/pr/more-X-memory-macro-fixes) 2017-12-14 11:15:09 +0100 Mike Gabriel (d4465b719) * Xserver/hw/nxagent/compext: Xfree -> free and Xmalloc -> malloc. 2017-12-15 08:26:23 +0100 Mihai Moldovan (8cca3f09d) * nx-libs.spec: actually use a weak dependency for xkeyboard-config. 2017-12-15 08:10:32 +0100 Mihai Moldovan (8cf5b5b7c) * nx-libs.spec: add back erroneously dropped xkeyboard-config dependency. 2017-12-14 10:49:21 +0100 Mihai Moldovan (1d301c517) * Merge branch 'sunweaver-pr/fix-compiler-warnings' into 3.6.x 2017-12-14 08:05:54 +0100 Mike Gabriel (8bb1579f4) * Xserver/GL/glx/glxcmds.c: Cast small-int values through intptr_t when passed as pointers (gh-sunweaver/pr/fix-compiler-warnings) 2017-03-17 14:06:15 +0000 Mike Gabriel (ac6a216c5) * lib/X11/Xrm.c: Compiler warning fix: logical-not-parentheses 2017-02-17 13:35:48 +0000 Mike Gabriel (a6ffabda6) * glx: warning fixes 2017-02-17 13:30:13 +0000 Mike Gabriel (16fbdb2a8) * Xserver/GL/glx/glxfb.c: Fix compiler warning: pointer-sign. 2017-02-17 12:56:53 +0000 Mike Gabriel (a27414524) * hw/nxagent/Events.c: Fix compiler warnings (with NX_DEBUG_INPUT): format. 2017-02-17 12:28:05 +0100 Mike Gabriel (7aed70f14) * hw/nxagent/NXxvdisp.c: Fix compiler warnings: misleading-indentation 2017-02-17 10:25:03 +0000 Mike Gabriel (72152baff) * hw/nxagent/NXdispatch.c: Fix compiler warning: misleading-indentation 2017-02-16 10:06:41 +0000 Mike Gabriel (6d98e5381) * Xserver/Xi/chgfctl.c: Fix compiler warning: misleading-indentation. 2017-12-14 10:39:47 +0100 Mike Gabriel (91ca51bff) * debian/rules: Neither overzealously remove nx-X11/Makefile. 2017-12-14 09:51:12 +0100 Mike Gabriel (8cade97b0) * debian/rules: Don't remove our main Makefile. 2017-12-14 07:44:20 +0100 Mike Gabriel (346c59516) * debian/rules: Fix override_dh_clean target for older Debian/Ubuntu versions. 2017-12-14 01:08:34 +0100 Mike Gabriel (542b5b461) * Add missing/renamed patches. (Ouch!). 2017-09-22 15:32:31 -0400 Mike DePaulo (f8b2a04e0) * nx-libs.spec: Add missing BuildRequires and fix paths to files. 2017-12-14 00:21:42 +0100 Mike Gabriel (5000ded30) * debian/control: Set Section: to "libs" for libnx-x11-6. 2017-12-14 00:19:04 +0100 Mike Gabriel (f17d4eb26) * debian/control: All Priority: extras packages are required to be changed to Priority: optional by recent Debian Policy. 2017-12-14 00:09:35 +0100 Mike Gabriel (abaebb5b1) * Merge branch 'uli42-pr/improve_keyboard_light' into 3.6.x 2017-11-13 21:06:36 +0100 Ulrich Sibiller (a02b645b2) * nxagent manpage: extend description of keyboard option (gh-uli42/pr/improve_keyboard_light) 2017-08-31 16:17:29 +0200 Ulrich Sibiller (7dbc6cf86) * Events.c/h: Rename & restructure some Xkb functions 2017-07-22 22:12:51 +0200 Ulrich Sibiller (8e5b1e7a2) * Keyboard.c: Replace some memsets by zero initialization 2017-07-22 19:09:10 +0200 Ulrich Sibiller (de9b4edf9) * Keyboard.c: Fix indentation 2017-08-12 17:38:35 +0200 Ulrich Sibiller (88bc52615) * Keyboard.c: set variables to NULL after free 2017-07-22 16:41:09 +0200 Ulrich Sibiller (94fae7497) * Keyboard.c: XkbDfltRepeatDelay and XkbDfltRepeatIntervall are int not uint 2017-07-22 15:58:08 +0200 Ulrich Sibiller (eb4abe4c5) * Keyboard.c: Use calloc instead of malloc + memset 2017-07-22 15:28:59 +0200 Ulrich Sibiller (5c4a001ac) * nxagent manpage: Extend keyboard documentation 2017-07-22 15:26:11 +0200 Ulrich Sibiller (8b206a261) * Keyboard.c: Make xkblock more robust 2017-07-22 15:25:53 +0200 Ulrich Sibiller (1e1ea1cea) * Keyboard.c: Some code cleanups 2017-07-22 14:44:46 +0200 Ulrich Sibiller (a44737855) * nxagent manpage: Improve explanation of -noignore and -noxkblock 2017-07-22 14:40:53 +0200 Ulrich Sibiller (ba8076697) * Keyboard.c: Add some comments with changelog explanations 2017-12-06 00:04:44 +0100 Ulrich Sibiller (9566acb5a) * Keyboard.c: print message class for user messages 2017-12-06 00:04:29 +0100 Ulrich Sibiller (c37c47ac4) * Keyboard.c: Improve TEST output 2017-12-13 23:43:41 +0100 Mike Gabriel (7610c0f19) * debian/*: Adopt from official Debian package where appropriate. 2017-12-13 23:18:34 +0100 Mike Gabriel (c5f3c2042) * Merge branch 'uli42-pr/pre-rrxinerama-fallback' into 3.6.x 2017-07-13 18:33:17 +0200 Ulrich Sibiller (bd1ca625e) * small code cosmetics (gh-uli42/pr/pre-rrxinerama-fallback) 2017-07-13 15:52:47 +0200 Ulrich Sibiller (0852aa52c) * always notify on size changes 2017-07-13 15:28:05 +0200 Ulrich Sibiller (1923f49dd) * re-implement pre-xinerama behaviour 2017-12-13 04:50:24 +0100 Mihai Moldovan (73c113ce6) * nx-X11/programs/Xserver/os/xprintf.c: completely drop NX-related changes. 2017-12-13 03:31:06 +0100 Mihai Moldovan (6d70b9e3c) * debian/x2goagent.options: reenable XFIXES extension. 2017-12-11 13:38:59 +0100 Mihai Moldovan (3731a996d) * nxcomp/src/Log.cpp: only create a new queue entry if we actually intend to write it out later. 2017-12-11 09:49:05 +0100 Mike Gabriel (7882a39ad) * Merge branch 'uli42-pr/fix_shadow_warning' into 3.6.x 2017-12-10 18:00:15 +0100 Ulrich Sibiller (018c557c4) * Silence warning: "ar: 'u' modifier ignored since 'D' is the default" (gh-uli42/pr/fix_shadow_warning) 2017-12-10 16:23:03 +0100 Ulrich Sibiller (d5c3e75b3) * nxcomp: fix shadow warning 2017-12-11 09:45:47 +0100 Mike Gabriel (29bb12312) * Merge branch 'uli42-pr/simplify_xtrans' into 3.6.x 2017-12-10 21:36:15 +0100 Ulrich Sibiller (0eb1dc67d) * Xtranssock.c: simplify code in SocketWritev (gh-uli42/pr/simplify_xtrans) 2017-12-11 09:41:08 +0100 Mike Gabriel (4988e7c5f) * Merge branch 'sunweaver-pr/drop-NoMachines-own-Xvasprintf-implementation' into 3.6.x 2017-12-11 09:22:49 +0100 Mike Gabriel (cf2e07657) * Xserver/os/xprintf.c: Drop NoMachine's own implementation of Xvasprintf(). Use stock implementation instead. (gh-sunweaver/pr/drop-NoMachines-own-Xvasprintf-implementation) 2017-12-11 01:05:50 +0100 Mihai Moldovan (c31cd7737) * nx-X11/programs/Xserver/os/xprintf.c: remove doubly-defined Xscnprintf function, add missing header includes. 2017-12-10 12:17:39 +0100 Mike Gabriel (e54e42af9) * Merge branch 'Ionic-feature/backport-asprintf' into 3.6.x 2017-12-07 12:11:53 +0100 Daniel Kurtz (a6e632aac) * os/xprintf: add Xvscnprintf and Xscnprintf 2017-12-07 10:57:06 +0100 Colin Harrison (c281c6e06) * Typo in xserver Xvasprintf() 2017-12-07 10:48:31 +0100 Alan Coopersmith (1e3a97482) * Add asprintf() implementation for platforms without it 2017-12-09 13:16:37 +0100 Mihai Moldovan (804ff4452) * Merge branch 'uli42-pr/fix_memleaks' into 3.6.x 2017-12-07 22:35:59 +0100 Ulrich Sibiller (4dbee3a3f) * nxcomp: use new macro SAFE_FREE(ptr) (gh-uli42/pr/fix_memleaks) 2017-11-28 21:58:07 +0100 Ulrich Sibiller (2814677a7) * Loop.cpp: fix more memory leaks 2017-11-28 21:18:48 +0100 Ulrich Sibiller (1c09eab70) * Loop.cpp: fix two memleaks 2017-11-28 20:43:44 +0100 Ulrich Sibiller (c4660e109) * ChannelEndPoint.cpp: fix two memleaks 2017-11-27 23:31:35 +0100 Ulrich Sibiller (21c742d25) * nxcomp: simplify free calls 2017-11-27 23:30:50 +0100 Ulrich Sibiller (513aa23a7) * nxcomp: fix double free 2017-12-09 12:54:24 +0100 Mihai Moldovan (6d7536bd4) * Merge branch 'uli42-pr/keep_co' into 3.6.x 2017-12-04 23:44:58 +0100 Ulrich Sibiller (eff0f366d) * Reintroduce -co as no-op (gh-uli42/pr/keep_co) 2017-12-07 08:35:54 +0100 Mihai Moldovan (eb9618739) * Merge branch 'uli42-p/xquerytree_leak' into 3.6.x 2017-12-05 21:25:12 +0100 Ulrich Sibiller (ad53af097) * Events.c: add ifdef around nxagentRemoteWindowsTree (gh-uli42/p/xquerytree_leak) 2017-12-05 00:29:10 +0100 Ulrich Sibiller (cdaec755d) * Make sure XQueryTree results are freed 2017-12-05 00:28:51 +0100 Ulrich Sibiller (0938cf83d) * Events.c: drop unused variable 2017-12-05 00:28:27 +0100 Ulrich Sibiller (43579a3b9) * Events.c: move variable to inner scope 2017-12-07 07:23:20 +0100 Mihai Moldovan (5487d52fe) * Merge branch 'uli42-pr/various_backports' into 3.6.x 2017-12-05 22:39:34 +0100 Daniel Stone (aac4c5f59) * DIX: XKB: Set xkbInfo to NULL as well as freeing it (gh-uli42/pr/various_backports) 2017-12-05 22:22:55 +0100 Daniel Stone (e05b90814) * Allow options to appear with other components. 2017-12-05 22:14:22 +0100 Lars Knoll (e073093cc) * devPrivates fixes 2017-12-05 22:09:06 +0100 Adam Jackson (0a010adfc) * Coverity # 337: Remove useless NULL check. 2017-12-05 22:06:11 +0100 Adam Jackson (1771deaf1) * Coverity # 491: Check version number correctly. 2006-03-15 16:33:12 +0000 Adam Jackson (d31f107c6) * Coverity # 487: Check version number correctly. 2006-03-15 16:49:04 +0000 Adam Jackson (43388104d) * Coverity # 807: Fix a memory leak in XFixesExpandRegion. 2017-11-09 10:21:21 +0100 Giuseppe Bilotta (6f9a6aacd) * randr: free crtc->outputs on destroy 2017-11-09 10:21:20 +0100 Giuseppe Bilotta (4e059d579) * randr: always realloc crtcs and outputs 2017-12-07 06:28:19 +0100 Mihai Moldovan (c571aa9ed) * Merge branch 'uli42-pr/improve_nxproxy_help' into 3.6.x 2017-11-29 00:02:01 +0100 Ulrich Sibiller (9e3381cc8) * nxproxy/nxcomp: document logging options (gh-uli42/pr/improve_nxproxy_help) 2017-11-27 23:37:58 +0100 Ulrich Sibiller (3fcb8e4ee) * nxcomp/nxproxy: slightly improve the usage message of nxproxy 2017-11-27 23:35:04 +0100 Ulrich Sibiller (f51194fb1) * nxcomp/nxproxy: add missing hint for keyconv option 2017-12-06 04:51:59 +0100 Mihai Moldovan (80e590ea1) * Merge branch 'sunweaver-pr/drop-bin-wrappers' into 3.6.x 2017-11-26 23:16:59 +0100 Mike Gabriel (c54558e3c) * Makefile: Quote '$@' in make calls with double quotes. (gh-sunweaver/pr/drop-bin-wrappers) 2017-11-21 13:45:55 +0100 Mike Gabriel (1539c20e5) * Makefile: Don't use DESTDIR in configure. 2017-11-21 13:28:17 +0100 Mike Gabriel (ca4308781) * Drop bin wrappers for nxagent and nxproxy, directly install nxproxy and nxagent to BINDIR. 2017-12-05 18:12:11 +0100 Mike Gabriel (05cf54af3) * Merge branch 'uli42-pr/fix_global_tcpFD' into 3.6.x 2017-12-02 01:32:35 +0100 Ulrich Sibiller (b8c929773) * nxcomp: use lowercase abbreviations for seconds and milliseconds (gh-uli42/pr/fix_global_tcpFD) 2017-12-02 01:07:03 +0100 Ulrich Sibiller (3bd7e03e1) * nxcomp: remove unused return values 2017-12-02 01:03:29 +0100 Ulrich Sibiller (82e893ef2) * nxcomp: Fix setting of global tcpFD 2017-11-26 08:35:55 +0100 Mihai Moldovan (7f777e01e) * Merge branch 'uli42-pr/nokeyconv' into 3.6.x 2017-11-23 15:19:02 +0100 Ulrich Sibiller (66046f138) * Keyboard.c: make nxagentKeycodeConversion a Boolean (gh-uli42/pr/nokeyconv) 2017-11-19 01:11:05 +0100 Ulrich Sibiller (8fd25cf83) * add option keyconv=(auto|on|off) 2017-11-19 01:07:57 +0100 Ulrich Sibiller (4b71309c3) * Keyboard.c: Use booleans for nxagentKeycodeConversion 2017-11-22 11:09:38 +0100 Mike Gabriel (2e724702e) * nxcomp/src/Misc.cpp: Update explanation for the NX_TEMP env variable. 2017-11-22 11:08:31 +0100 Mike Gabriel (78661a19a) * nxproxy.1 man page: Update explanation for NX_TEMP env variable. 2017-11-22 10:56:38 +0100 Mike Gabriel (f0f4fdc2b) * Merge branch 'Ionic-bugfix/hardcode-socket-paths-in-libX11' into 3.6.x 2017-11-22 06:16:01 +0100 Mihai Moldovan (df9b5306e) * nx-X11/lib/include/xtrans/Xtranssock.c: drop UNIX path overrides as well. (gh-ionic/bugfix/hardcode-socket-paths-in-libX11, gh-Ionic/bugfix/hardcode-socket-paths-in-libX11) 2017-11-21 11:47:04 +0100 Mike Gabriel (ce182e88a) * Merge branch 'uli42-pr/simplify_free' into 3.6.x 2017-11-18 23:35:39 +0100 Ulrich Sibiller (dc43f4c98) * Error.c: simply nxagentGetClientsPath() (gh-uli42/pr/simplify_free) 2017-11-18 23:33:53 +0100 Ulrich Sibiller (7e975e3cc) * simply free() calls 2017-11-20 10:47:10 +0100 Mike Gabriel (3b640a0f8) * Merge branch 'uli42-pr/options_on_reconnect' into 3.6.x 2017-11-18 22:32:21 +0100 Ulrich Sibiller (4ef4fbf16) * Args.c: simplify nxagentProcessOptionsFile() 2017-11-18 22:18:26 +0100 Ulrich Sibiller (6c9622963) * Args.c: Fix compile bug with DEBUG enabled 2017-11-18 22:15:50 +0100 Ulrich Sibiller (76ce623ab) * Fix options parsing on reconnect 2017-11-17 13:16:39 +0100 Mike Gabriel (39d45a0e8) * Merge branch 'uli42-small_fixes' into 3.6.x 2017-10-18 00:28:23 +0200 Ulrich Sibiller (9a1604372) * fix broken path due to missing / 2017-10-18 00:22:53 +0200 Ulrich Sibiller (ac66ba349) * NXglxext.c: rename and relocate variable 2017-10-18 00:21:00 +0200 Ulrich Sibiller (fff0d5473) * glxext.c/NXglxext.c: merge two functions into one 2017-10-18 00:08:24 +0200 Ulrich Sibiller (b0b62dde6) * keysym.h: fix include path 2017-11-17 09:30:38 +0100 Mike Gabriel (56569f336) * Merge branch 'uli42-pr/fix_manpage' into 3.6.x 2017-11-17 00:04:57 +0100 Ulrich Sibiller (72c1f83fb) * nxagent manpage: some minor formatting improvements and typo fixes 2017-11-10 23:14:13 +0100 Mihai Moldovan (71511a765) * nx-libs.spec: fix SHLIBSGLOBALSFLAGS => SHLIBGLOBALSFLAGS typo spotted by Orion Poplawski. 2017-11-08 11:20:52 +0100 X2Go Release Manager (81d935604) * Continue development 2017-11-08 08:56:29 +0100 X2Go Release Manager (415446307) * Mid-release fixup: split up debian/patches/1500_all_propagate-optflags-to-subcompone.full+lite.patch. 2017-11-08 08:47:03 +0100 X2Go Release Manager (09bb93e00) * Mid-release fixup: rename debian/patches/1400_nx-X11_Render.c-Improve-situation-fo.full+lite.patch to debian/patches/1400_nx-X11_Render.c-Improve-situation-fo.full.patch. 2017-11-08 08:09:01 +0100 X2Go Release Manager (7dacd7993) * release 3.5.0.33 2017-11-04 09:26:18 +0100 Mike Gabriel (e788a70ce) * Merge branch 'Ionic-bugfix/hardcode-some-socket-paths' into 3.6.x 2017-11-03 12:57:25 +0100 Mihai Moldovan (79257eed0) * nxcomp/src/Loop.cpp: hardcode X11 and (legacy/xfs) font UNIX paths. (gh-ionic/bugfix/hardcode-some-socket-paths, gh-Ionic/bugfix/hardcode-some-socket-paths) 2017-11-04 08:00:32 +0100 Mihai Moldovan (2c75b00f3) * nxcomp: Hardcode X11 and (legacy/xfs) font UNIX paths. 2017-11-04 07:45:09 +0100 Mihai Moldovan (e095b8f6b) * nxcomp: Handle launchd sockets in DISPLAY variable correctly when fetching X cookie. 2017-11-03 16:23:41 +0100 Mike Gabriel (e3f498e62) * Merge branch 'Ionic-bugfix/fix-X-cookie-on-osx' into 3.6.x 2017-11-03 12:30:12 +0100 Mihai Moldovan (bd25453bd) * nxcomp/src/Auth.cpp: handle launchd sockets in DISPLAY variable correctly when fetching X cookie. (gh-ionic/bugfix/fix-X-cookie-on-osx, gh-Ionic/bugfix/fix-X-cookie-on-osx) 2017-11-02 07:18:27 +0100 Mihai Moldovan (288cc6fec) * nx-libs.spec: let x2goagent conflict with pre-4.0.1.21 x2goserver versions. 2017-11-02 07:16:36 +0100 Mihai Moldovan (b5230d371) * debian/control: change Breaks statement to pre-4.0.1.21 x2goserver and add a Replaces: x2goserver << 4.0.1.21 section to x2goagent package. 2017-10-27 14:14:24 +0200 Mihai Moldovan (1c6c9c04b) * nxproxy: use ax_pthread.m4. 2017-10-27 14:13:26 +0200 Mihai Moldovan (22bb128dc) * nxcomp/m4/ax_pthread.m4: move to top-level m4/ directory, use symlink. 2017-10-27 11:55:45 +0200 Mike Gabriel (06a6c5829) * Regression fix for f855b3b6. Caused FTBFS with Loop.cpp:2669:0: error: unterminated #ifdef (#ifdef TIME). 2017-10-27 11:13:08 +0200 Mike Gabriel (2e4f9e7a9) * Merge branch 'theqvd-improved-logging-loop' into 3.6.x 2017-10-27 11:12:00 +0200 Mike Gabriel (de3d9ff4e) * Merge branch 'theqvd-improved-logging' into 3.6.x 2017-09-29 21:05:04 +0200 Mihai Moldovan (ab0c4f842) * nxcomp/src/Loop.cpp: fix whitespace errors on continued lines. 2017-03-22 16:33:58 +0100 Vadim Troshchinskiy (d202b052e) * Remove leading \n in NXTrans* logging 2017-03-16 12:55:18 +0100 Vadim Troshchinskiy (f855b3b61) * Fix whitespace and line splitting issues reported by ionic 2016-12-22 12:39:40 +0100 Vadim Troshchinskiy (1cf6aa8f2) * Conversion of Loop.cpp to the new log system 2017-09-30 16:58:16 +0200 Mihai Moldovan (ceac07763) * nxcomp: add basic logging_test utility in test subdirectory. 2017-09-30 16:53:48 +0200 Mihai Moldovan (5efcd39fc) * nxcomp/src/Log.h: prepare for logger testing application. 2017-10-27 08:32:14 +0200 Mihai Moldovan (6c3cf54ba) * nxcomp/src/Log.cpp: add PID to thread ID output if requested. 2017-09-30 15:32:33 +0200 Mihai Moldovan (1829a35cd) * nxcomp/src/Log.h: block signals while writing out data. 2017-09-30 15:30:53 +0200 Mihai Moldovan (09586d760) * nxcomp/src/Log.{cpp,h}: port to std::stack as internal buffer structure. 2017-06-30 23:32:45 +0200 Mihai Moldovan (fc4a18d33) * nxcomp/{configure.ac,Log.cpp}: implement configure-time std::put_time check and use macro value in Log.cpp. 2017-06-30 22:42:25 +0200 Mihai Moldovan (67b0a17fa) * nxcomp/Log.h: delete stream_ member before class object destruction. 2017-06-30 22:37:13 +0200 Mihai Moldovan (ca08512cf) * nxcomp/Log.h: also clear the buffer after setting it to an empty string. 2016-12-22 12:40:43 +0100 Vadim Troshchinskiy (d960ec2cb) * Set default log level to WARNING 2016-12-22 09:57:47 +0100 Vadim Troshchinskiy (b0521e816) * New logging implementation 2017-07-13 01:10:02 +0200 Mihai Moldovan (381c39b86) * nxcomp: add AX_PTHREAD code from autoconf-archive and check for pthread support. 2017-09-29 17:19:06 +0200 Mihai Moldovan (1f717c6fd) * nx{comp{,shad},proxy}: add configure flag --enable-cxx11 to enable and setup optional C++11 support. 2017-10-27 08:42:17 +0200 Mihai Moldovan (39ee56f5d) * nxcomp/configure.ac: rename --{en,dis}able-info to --{en,dis}able-debug, as originally planned. 2017-10-20 11:30:43 +0200 Mihai Moldovan (dae8551e2) * README.md: add short Windows section and mention that using Cygwin tools is imperative when working with the git repository. 2017-10-16 10:44:18 +0200 Mihai Moldovan (c6b004578) * nx-libs.spec: pass CDEBUGFLAGS and friends directly through via make command. 2017-10-16 10:42:51 +0200 Mihai Moldovan (92485be30) * nx-libs.spec: handle potentially undefined variables more gracefully. 2017-10-16 10:26:16 +0200 Mihai Moldovan (d017d211d) * nx-libs.spec: pass CDEBUGSFLAGS and friends directly to the make command in %build. 2017-10-16 10:12:36 +0200 Mihai Moldovan (71bda0ed5) * nx-libs.spec: drop ugly optsflag sed hack, hopefully obsoleted by passing CDEBUGFLAGS through. 2017-10-16 10:08:10 +0200 Mihai Moldovan (07d308359) * nx-libs.spec: drop ugly sed hack to push optflags to build system. 2017-10-16 10:06:52 +0200 Mihai Moldovan (f54e56d81) * debian/changelog: fixup changelog. 2017-10-16 10:04:54 +0200 Mihai Moldovan (13aed2463) * OPTFLAGS: Properly propagate build option flags to nxcomp{,ext,shad} and the nx-X11 build scripts. 2017-10-16 07:24:38 +0200 Mihai Moldovan (9d750c686) * nx-libs.spec: add -mno-vxs to general C(XX)FLAGS on ppc64le. 2017-10-16 07:24:38 +0200 Mihai Moldovan (bd2a66fec) * nx-libs.spec: add -mno-vxs to general C(XX)FLAGS on ppc64le. 2017-10-16 07:18:32 +0200 Mihai Moldovan (df3944d46) * debian/patches: fixup series file to include previous patch. 2017-10-10 15:17:40 +0200 Mike Gabriel (13041f5c0) * Merge branch 'theqvd-media_argument_bugfix' into 3.6.x 2017-10-10 13:04:08 +0200 Vadim Troshchinskiy (f2c73bd84) * Fix bug #525: PANIC! No port specified for multimedia connections 2017-10-10 10:53:31 +0200 Simon Matter (e73464e4f) * nxcomp: Reduce control->TokenSize slightly again in order to fix fragmentation of packages when on VPN (or otherwise encapsulated) connections. 2017-10-10 10:27:18 +0200 Mike Gabriel (17ae45e0f) * Merge branch 'Ionic-add-stray-files-to-gitignore' into 3.6.x 2017-10-10 07:17:27 +0200 Mihai Moldovan (0336aab79) * .gitignore: ignore vim swap files. (gh-ionic/add-stray-files-to-gitignore, gh-Ionic/add-stray-files-to-gitignore) 2017-10-10 07:16:36 +0200 Mihai Moldovan (5d44c595a) * **/.gitignore: add stray files. 2017-10-09 22:10:57 +0200 Mihai Moldovan (b67be23b1) * Merge branch 'sunweaver-pr/nxcomp-tokensize-in-vpn-tunnels' into 3.6.x 2017-10-09 11:30:02 +0200 Simon Matter (418db3b5c) * nxcomp/src/Loop.cpp: Reduce control->TokenSize slightly again in order to fix fragmentation of packages when on VPN (or otherwise encapsulated) connections. (gh-sunweaver/pr/nxcomp-tokensize-in-vpn-tunnels) 2017-10-09 12:52:01 +0200 Mike Gabriel (27c14b4eb) * .gitignore: Improve all .gitignore files, adapt to autotools build-flow and its build cruft. 2017-09-29 20:55:36 +0200 Mihai Moldovan (371c71276) * nxcomp/src/Loop.cpp: whitespace fixes only. 2017-09-29 17:58:28 +0200 Mihai Moldovan (b5c714690) * nxcomp/configure.ac: prettify AC_ARG_ENABLE() calls, use more quotes and AS_IF() where appropriate. 2017-09-29 12:31:01 +0200 Simon Matter (03ebe6f25) * nxproxy/src/Main.c: Silence compiler warning. 2017-09-29 12:22:08 +0200 Vadim Troshchinskiy (b3f2e3006) * Merge pull request #519 from theqvd/fix_nxagent_arg_parsing 2017-09-28 16:42:41 +0200 Vadim Troshchinskiy (5f1eb0dc3) * Fix nxagent argument parsing logic 2017-09-15 15:59:30 +0200 Mike Gabriel (3c95d6040) * debian/control: Bump Standards-Version: to 4.1.0. No changes needed. 2017-09-15 15:59:03 +0200 Mike Gabriel (4bc1d6ccc) * debian/control: Drop non-required B-D libxmltok1-dev. 2017-09-15 14:57:56 +0200 Mike Gabriel (6557c0043) * release 3.5.99.10 (tag: 3.5.99.10) 2017-09-14 07:45:45 +0200 Mihai Moldovan (4405c6a6b) * Merge branch 'sunweaver-pr/assure-that-Mesa-includes-headers-from-libNX_X11' into 3.6.x 2017-09-13 13:06:34 +0200 Mike Gabriel (f9c23b51e) * Assure that headers from libNX_X11 are always included from $(INCDIR)/nx-X11/. (gh-sunweaver/pr/assure-that-Mesa-includes-headers-from-libNX_X11) 2017-09-13 11:50:40 +0200 Mihai Moldovan (0815fb06f) * nx-X11/programs/Xserver/hw/nxagent/Render.c: use macros obtaining values from _XPrivDisplay instead of the other Display structure directly. 2017-09-06 10:25:19 +0200 Mihai Moldovan (81569ad6b) * Merge branch 'sunweaver-pr/sun-path-is-104-on-debian-kfreebsd' into 3.6.x 2017-08-31 18:17:31 +0200 Mike Gabriel (96ba6190d) * nxcomp/src/{Loop,Proxy}.cpp: On Debian/kFreeBSD (and other *BSD variants) the sockaddr_un.sun_path property is 104 chars long, not 108. Hard-coding Unix domain sockets in nxcomp the string length 104. (gh-sunweaver/pr/sun-path-is-104-on-debian-kfreebsd) 2017-08-30 22:36:05 +0200 Mike Gabriel (d3f97cea2) * Mesa.patches: Shrink over-zealous 5001 patch. Only patch files that we use during build. 2017-08-30 22:07:46 +0200 Mike Gabriel (055f52b03) * roll-tarball.sh: Drop m4/nx-xtrans.m4 from nx-libs-lite tarball. 2017-08-30 22:07:28 +0200 Mike Gabriel (1047cda6d) * roll-tarball.sh: Some more .gitignore files to remove. 2017-08-30 22:07:02 +0200 Mike Gabriel (bbf69e0a6) * roll-tarball.sh: Use -f with rm everywhere, also when tweaking the Mesa/ dir. 2017-08-30 19:33:55 +0200 Mike Gabriel (f4afa5a56) * release 3.5.99.9 (tag: 3.5.99.9) 2017-08-30 19:29:58 +0200 Mike Gabriel (13264ea7f) * debian/rules: Strip static libraries before installing them into the lib*.dev packages. 2017-08-30 18:24:43 +0200 Mike Gabriel (15909676e) * Mesa.patches: Add 5001_nasty-typo-fixes.patch. Fix some nasty typos in Mesa's code ending up in the nxagent binary. 2017-08-30 18:18:39 +0200 Mike Gabriel (b9e5f03ab) * hw/nxagent/Window.c: Fix spelling error in debug message. 2017-08-30 18:07:59 +0200 Mike Gabriel (bdd4fc212) * debian/control: Bump Standards-Version: to 4.0.1. No changes needed. 2017-08-30 16:57:57 +0200 Mike Gabriel (9cffffe5e) * debian/copyright: Update copyright attributions. 2017-08-30 16:54:24 +0200 Mike Gabriel (5ecf04c92) * nx-X11/extras: Drop Mesa-6.4.1 related files. 2017-08-28 08:33:58 +0200 Mihai Moldovan (709bce6cf) * Merge branch 'sunweaver-pr/drop-nxcompshad-cygwin-support' into 3.6.x 2017-07-17 12:49:47 +0200 Mike Gabriel (d9e2822f5) * nxcompshad: Drop Cygwin/Win32 support. Has been untested and unused for a long time. (gh-sunweaver/pr/drop-nxcompshad-cygwin-support) 2017-08-26 23:29:58 +0200 Mihai Moldovan (bc66da714) * Merge branch 'sunweaver-pr/nxagent-render-cleanup' into 3.6.x 2017-07-17 11:15:55 +0200 Mike Gabriel (4eade297b) * nx-X11/programs/Xserver/Render.c: Re-introduce nxagentGlyphsCleanup() from libNX_Xrender's formerly removed XRenderGlyphsCleanup(). (gh-sunweaver/pr/nxagent-render-cleanup) 2017-08-25 19:18:17 +0200 Mike Gabriel (7290aea3b) * nx-X11/Makefile: Only run full CleanEnv code, if imake is installed in the build-system. 2017-08-25 16:34:30 +0200 Mike Gabriel (a32f1dfa1) * Makefile: Check for dir existence before attempting to remove it. 2017-08-25 16:29:29 +0200 Mike Gabriel (71878f7a9) * Makefile: Use $(RM_DIR) rather then plain rmdir in clean-env target. 2017-08-25 12:44:49 +0200 Mihai Moldovan (ae0a2bfde) * Merge branch 'sunweaver-pr/libnx-x11-autoreconf' into 3.6.x 2017-08-11 12:53:50 -0400 Mike Gabriel (3b7e5a42f) * debian/rules: Re-order configure options for the sake of more beauty. (gh-sunweaver/pr/libnx-x11-autoreconf) 2017-08-11 12:51:52 -0400 Mike Gabriel (9a79e09a5) * debian/rules: Use tabs as first indentation level. 2017-08-11 16:44:24 -0400 Mike Gabriel (9edd6e055) * debian/control: Add D (libnx-x11-6): libx11-data. 2017-08-11 12:48:32 -0400 Mike Gabriel (11fa0b140) * nx-X11/programs/Xserver/Imakefile: White-space fix. 2017-07-21 12:31:09 +0200 Mike Gabriel (c350873c7) * Convert nx-X11/lib/ build flow from imake to autotools. 2017-07-17 12:53:26 +0200 Mike Gabriel (1472e7e37) * debian/rules: Add configure option --disable-silent-rules. 2017-07-12 12:53:10 +0200 Mike Gabriel (55c4e4070) * nx*/configure.ac: Use newly introduced macro NX_DEFAULT_OPTIONS instead of NX_COMPILER_FLAGS. 2017-07-12 12:08:03 +0200 Mike Gabriel (ef08aadf5) * m4/nx-macros.m4: Add NX_STRICT_OPTION and NX_DEFAULT_OPTIONS macros (borrowed from X.org's xorg-macros.m4). 2017-08-11 09:29:17 -0400 Mike Gabriel (cbe2c0e44) * Merge branch 'uli42-pr/versionprop' into 3.6.x 2017-08-10 00:50:27 +0200 Ulrich Sibiller (715fcfe6d) * Set NX_AGENT_VERSION property for root window 2017-08-09 06:46:30 +0200 Mihai Moldovan (8235925a2) * nxcomp/configure.ac: fix copy-and-paste typo (nxcompshad.pc.) 2017-08-09 06:44:49 +0200 Mihai Moldovan (8b88289ee) * nxcomp/configure.ac: we don't need to specify empty optional parameters. 2017-08-09 06:43:17 +0200 Mihai Moldovan (b1b919477) * Merge branch 'sunweaver-pr/find-libjpeg-without-pkgconfig' into 3.6.x 2017-08-03 10:22:55 -0400 Mike Gabriel (4fd038dba) * nxcomp/configure.ac: Don't rely on pkg-config alone when it comes to testing for presence of libjpeg shared lib and header files. (gh-sunweaver/pr/find-libjpeg-without-pkgconfig) 2017-08-03 10:39:50 +0200 Mihai Moldovan (1077270f8) * nx-X11: Render.c: Improve situation for multiple trapezoid requests. 2017-08-03 09:58:34 +0200 Oleksandr Shneyder (ab2885575) * nxcomp: Set TokenSize to 1536 for link type ADSL and WAN. 2017-08-03 09:41:21 +0200 Mihai Moldovan (6ae091cc2) * debian/patches: refresh all patches. 2017-08-02 18:19:19 -0400 Mike Gabriel (430ae6eb6) * nxproxy/src/Makefile.am: Actually define nxproxy_CFLAGS, so the various compiler warning flags get enabled at build time of nxproxy. 2017-07-31 14:14:22 +0200 Mike Gabriel (dc8e52407) * Merge branch 'sunweaver-pr/fix-multi-trapez-requests' into 3.6.x 2017-07-31 13:20:12 +0200 Oleksandr Shneyder (da43f047a) * Render.c: Improve situation for multiple trapezoid requests. (gh-sunweaver/pr/fix-multi-trapez-requests) 2017-07-26 10:38:46 +0200 Mihai Moldovan (7897834ce) * Merge branch 'sunweaver-pr/nxcomp-autoreconf' into 3.6.x 2017-07-12 13:35:57 +0200 Mike Gabriel (4afc641fd) * nxcomp: Add __attribute__((noreturn)) to more functions where appropriate. (gh-sunweaver/pr/nxcomp-autoreconf) 2017-07-12 21:51:40 +0200 Mike Gabriel (b3a3382ad) * nxcomp/src/Loop.cpp: Don't mix using global proxyFD and a local p(roxy)FD variable (in WaitForRemote() and ConnectToRemote()). Rename local variable name. 2017-07-12 21:49:28 +0200 Mike Gabriel (82c218288) * nxcomp/src/Loop.cpp: Don't use global variables as function paramters in handleLogReopenInLoop(). 2017-07-14 11:22:20 +0200 Mike Gabriel (e47995370) * nxcomp/src/Loop.cpp: Drop global variable diffTs, declare it in every funtion where it is needed. 2017-07-14 11:21:34 +0200 Mike Gabriel (04e09f277) * nxcomp/src/Transport.cpp: Don't redeclare local variable if it can be reused. 2017-07-12 21:46:09 +0200 Mike Gabriel (54e7b9aa2) * nxcomp/src/Loop.cpp: Don't reuse global variable names as function parameters in SetupDisplaySocket(). 2017-07-12 21:42:46 +0200 Mike Gabriel (ca7db4fcb) * nxcomp/src/Loop.cpp: Rename local variable 'handler' to 'signalHandler'. 2017-07-12 21:41:21 +0200 Mike Gabriel (1e15760a3) * nxcomp/src/Loop.cpp: Drop duplicate prototypes (which already exist in Misc.h). 2017-07-12 21:39:32 +0200 Mike Gabriel (1894e04df) * nxcomp/src/Proxy.cpp: Fix index usage of nested loops. 2017-07-12 21:36:11 +0200 Mike Gabriel (4c3872279) * nxcomp/src/Loop.cpp: Avoid duplicate usage of proxyFD (global variable) and *proxyFD (function parameter). 2017-07-12 21:32:14 +0200 Mike Gabriel (5a7b589bb) * nxcomp: Trivially fix local variables shadowing variables of same name from higher scope. 2017-07-10 13:42:32 +0200 Mike Gabriel (93c4cea66) * debian/rules: Drop override_dh_clean target. Not required anymore, as configure files get removed correctly now. 2017-07-24 12:32:18 +0200 Mike Gabriel (9c8e3f139) * nxcomp/configure.ac,m4/nx-macros.m4,nxcomp/src/Socket.h: Use AC_CHECK_TYPES to detect if type 'in_addr_t' is available. 2017-07-14 11:43:05 +0200 Mike Gabriel (9fa0a6b95) * nxcomp/configure.ac: Re-add previously available configure options --with-valgrind and --with-info as renamed options --enable-valgrind and --enable-debug. 2017-06-30 20:13:51 +0200 Mike Gabriel (f76c82403) * nxcomp: Switch to autoreconf. 2017-07-25 09:19:44 +0200 Mike Gabriel (9193d11ee) * Merge branch 'uli42-pr/cmdline' into 3.6.x 2017-07-24 23:45:48 +0200 Ulrich Sibiller (3f7b30019) * treat options parameter as option string if it starts with nx/nx 2017-07-24 23:45:24 +0200 Ulrich Sibiller (36e583cf5) * rename nxagentOptionFile to nxagentOptionsFilename 2017-07-11 21:29:59 +0200 Ulrich Sibiller (b007b542d) * pass filename as parameter to nxagentProcessOptionsFile() 2017-07-17 09:50:26 +0200 Mike Gabriel (4ccb7eda5) * Merge branch 'uli42-pr/fix_keystroke_files' into 3.6.x 2017-07-12 20:01:44 +0200 Ulrich Sibiller (79001dd8a) * Improve keystroke file handling 2017-07-14 10:42:15 +0200 Mike Gabriel (ccd7c6962) * debian/control: Add B-D: libtool (required for Debian jessie, Ubuntu trusty and Ubuntu xenial). 2017-07-14 10:38:47 +0200 Mike Gabriel (ad1d45349) * debian/copyright: White-space cleanup. 2017-07-14 10:38:30 +0200 Mike Gabriel (96167fcdb) * debian/control: Process with wrap-and-sort -s. 2017-07-14 01:25:20 +0200 Mihai Moldovan (5796ac644) * Merge branch 'sunweaver-pr/nxcompshad-autoreconf' into 3.6.x 2017-07-12 22:34:11 +0200 Mike Gabriel (59e829f36) * nxcompshad: Rewrite Logger class methods to properly take advantage of the 'gnu_printf' format attribute. (gh-sunweaver/pr/nxcompshad-autoreconf) 2017-07-12 22:26:38 +0200 Mike Gabriel (8f5ce18d4) * nxcompshad: Prototype for NXShadowResetOptions() missing. Export it as public symbol via Shadow.h." 2017-07-12 22:26:05 +0200 Mike Gabriel (36fe0330e) * nxcompshad/src/Shadow.cpp: Drop duplicate prototype for NXShadowRemoveAllUpdaters(). Already in Shadow.h. 2017-07-12 22:23:07 +0200 Mike Gabriel (d77897462) * nxcompshad/src/Core.cpp: Don't redeclare (and shadow) curLine. Use curWorkLine instead. 2017-06-30 14:49:03 +0200 Mike Gabriel (dba850070) * nxcompshad/src/Regions.h: Avoid warning: ‘typedef’ was ignored in this declaration. Drop typedef declaration from _XRegion struct. 2017-04-25 15:27:17 +0200 Mike Gabriel (76b486768) * nxcompshad: Switch to autoreconf. 2017-07-13 11:38:17 +0200 Mike Gabriel (622360ea2) * debian/control: Add B-D: automake (required for Debian jessie, Ubuntu trusty and Ubuntu xenial). 2017-07-13 08:52:08 +0200 Mike Gabriel (107fba32e) * nxproxy/configure.ac: Have AC_LANG before NX_COMPILER_BRAND. Thanks to Ionic for spotting this same flaw in nxcompshad. 2017-07-12 23:56:42 +0200 Mihai Moldovan (06bf2a492) * Merge branch 'sunweaver-pr/nxproxy-autoreconf' into 3.6.x 2017-07-10 11:47:02 +0200 Mike Gabriel (397d3ac06) * debian/rules: Drop redundant --with-symbols configure option, '-g' already gets added by debhelper. (gh-sunweaver/pr/nxproxy-autoreconf) 2017-04-26 13:26:47 +0200 Mike Gabriel (41ea54b02) * nxproxy: Switch to autoreconf. 2017-06-30 13:58:47 +0200 Mike Gabriel (322e39b79) * m4/nx-macros.m4: Add autotools macros derived from X.org and nxcomp* configure.in files. 2017-07-12 12:43:53 +0200 Mike Gabriel (e17207f18) * make-changelog.sh: Drop obviously not needed '--since 1970' option from 'git log' call. 2017-07-12 12:09:45 +0200 Mike Gabriel (ba02470a5) * Merge branch 'sunweaver-pr/report-window-ids' into 3.6.x 2017-07-04 23:57:34 +0200 Mike Gabriel (84a403e27) * Report Xlib-side window IDs to session.log in machine readable form. This feature can be enabled by the cmdline options -reportwids and -reportprivatewids. (gh-sunweaver/pr/report-window-ids) 2017-07-04 23:32:04 +0200 Mike Gabriel (000a869b3) * nxagent man page: Fix layout near -nxrealwindowprop option. 2017-06-30 23:23:16 +0200 Mike Gabriel (a517c5ab6) * Mesa.patches: Disable 4001_Fix-non-working-GLX-in-64bit-Xorg-7.0.patch. It patches a file, we don't build and that we remove in roll-tarball.sh. 2017-06-30 23:22:22 +0200 Mike Gabriel (7838207b7) * roll-tarballs.sh: Remove even more files from nx-X11/extras/Mesa/. This roll-tarball.sh version has been used for generating the 3.5.99.8 tarball. 2017-06-30 21:21:49 +0200 Mike Gabriel (3b15804ce) * release 3.5.99.8 (tag: 3.5.99.8) 2017-06-30 20:59:27 +0200 Mihai Moldovan (4c7641a1f) * Merge branch 'sunweaver-pr/mese-quilt-without-quilt' into 3.6.x 2017-06-30 20:24:28 +0200 Mike Gabriel (79fcce3ee) * README.Mesa.patches: Define some rules for patch naming and numbering scheme. (gh-sunweaver/pr/mese-quilt-without-quilt) 2017-06-27 19:21:23 +0200 Mike Gabriel (638b334c8) * mesa-quilt: Provide a fallback patching method on systems where pulling quilt into the build env is not trivial. 2017-06-27 19:47:35 +0200 Mike Gabriel (bac473917) * nx-libs.spec: Use mesa-quilt with Fedora builds, but rely on fallback mode in mesa-quilt for RHEL and SUSE. 2017-06-30 17:41:21 +0200 Mihai Moldovan (05450d0e8) * Merge branch 'sunweaver-pr/browser-scrolling-improvements' into 3.6.x 2017-06-29 10:08:56 +0200 Oleksandr Shneyder (7d51cb676) * nxcomp: Set TokenSize to 1536 for link type ADSL and WAN. Improving non-xrender based browser scrolling behaviour when link type is set to ADSL or WAN. (gh-sunweaver/pr/browser-scrolling-improvements) 2017-06-30 16:22:25 +0200 Mike Gabriel (4365fe38e) * Merge branch 'sunweaver-pr/nx-real-wid' into 3.6.x 2017-05-30 21:28:03 +0200 Mike Gabriel (588be6386) * hw/nxagent/Window.c: Introduce NX_REAL_WINDOW window property. (gh-sunweaver/pr/nx-real-wid) 2017-05-30 21:33:33 +0200 Mike Gabriel (c88e87bc8) * hw/nxagnet/Atoms.c: In DEBUG mode, we need validateString() which is not statically defined in Utils.h. Thus including it for DEBUG builds. 2017-06-28 22:23:42 +0200 Mihai Moldovan (3d255540f) * Merge branch 'sunweaver-pr/fix-ftbfs-on-hppa' into 3.6.x 2017-05-06 01:31:14 +0200 Mike Gabriel (65c420515) * debian/patches: Update 016_nx-X11_install-location.debian.patch (line numbers only). (gh-sunweaver/pr/fix-ftbfs-on-hppa) 2017-05-06 00:38:01 +0200 Mike Gabriel (347363f3f) * Fix FTBFS on Linux based HP-PARisc 32-bit systems. Thanks to John Paul Adrian Glaubitz from FU Berlin for providing access to a corresponding porters' machine. 2017-05-06 00:29:46 +0200 Adam Jackson (f77a4b405) * dix: Remove arch awareness from servermd.h (X.org v2, nx-libs v4) 2017-06-28 19:20:36 +0200 Mihai Moldovan (78d41614e) * Merge branch 'sunweaver-pr/fix-ftbfs-on-mips64el' into 3.6.x 2017-06-27 19:59:36 +0200 Mike Gabriel (c22c3f729) * nx-X11/config/cf/linux.cf: Drop AsOutputArchSize macro from Sparc(64)Architecture ifdef-block. It does not seem to be used anywhere else. (gh-sunweaver/pr/fix-ftbfs-on-mips64el) 2017-05-07 19:47:27 +0200 Mike Gabriel (1839dd642) * Fix FTBFS on mips64el architecture due to missing definition of the _XSERVER64 macro. 2017-06-27 19:16:33 +0200 Mike Gabriel (cde05c090) * Mesa.patches_6.4.1: Add missing EOL at EOF to series file. 2017-06-27 19:15:53 +0200 Mike Gabriel (e2d72b599) * Mesa.patches: Have Mesa.patches_6.4.2 rather as a copy than as a symlink to Mesa.patches_6.4.1. Rebase 4004_define-USE_IEEE-macro-for-more-platforms.patch against Mesa 6.4.2 while being at it. 2017-06-27 18:34:20 +0200 Mike Gabriel (3dcdea4dd) * Merge branch 'frantracer-mesa-update-6.4.2' into 3.6.x 2017-06-27 15:53:30 +0200 ftrapero (fa70485dc) * roll-tarball.sh: Fix resolution of symbolic links and removal of useless Mesa versions 2017-06-27 12:12:09 +0200 ftrapero (2dd6ca0c8) * nx-X11/extras: Add symlinks to Mesa_6.4.2 and patches 2017-06-27 12:08:38 +0200 ftrapero (b30506dfa) * Include mesa-6.4.2 project 2017-06-27 12:08:38 +0200 ftrapero (663631725) * Squashed 'nx-X11/extras/Mesa_6.4.2/' content from commit 475b1f7 2017-06-19 11:01:22 +0200 Mike Gabriel (c032f0e34) * roll-tarball.sh: Fix tarball creation, now that we pull in Mesa as a git-subtree. This basically moves versioned folders around and drops the Mesa/ and Mesa.patches/ symlinks. 2017-06-19 10:16:14 +0200 Mike Gabriel (014365877) * Merge branch 'frantracer-mesa-squash-subtree' into 3.6.x 2017-02-20 15:36:36 +0100 Mike Gabriel (123fb7fe7) * roll-tarball.sh: Drop various unused files from the bundled Mesa version when creating release tarballs. 2017-02-20 12:54:14 +0100 Mike Gabriel (c20b946b4) * Mesa subtree: Adapt build process for building against Mesa that gets pulled in via git subtree. 2017-02-17 16:11:01 +0100 Mike Gabriel (209657f69) * nx-X11/extras/Mesa: Drop bundled Mesa, place a symlink to imported Git subtree of Mesa_6.4.1 instead. 2017-06-15 14:15:08 +0200 ftrapero (459021c16) * Include mesa-6.4.1 project 2017-06-15 14:15:08 +0200 ftrapero (8667d4d97) * Squashed 'nx-X11/extras/Mesa_6.4.1/' content from commit 53d1bc0 2017-06-11 14:26:35 +0200 Mike Gabriel (4f216e7cf) * Merge branch 'uli42-pr/fix_sync_segfault' into 3.6.x 2017-06-09 22:27:20 +0200 Ulrich Sibiller (19116a61c) * Args.c: fix sync option parsing 2017-06-06 20:33:55 +0200 Mike Gabriel (7fd59fbd1) * Merge branch 'uli42-pr/remove_unused_defines' into 3.6.x 2016-11-04 00:30:02 +0100 Ulrich Sibiller (52d65a4f6) * remove BuildRman define 2017-06-06 14:29:20 +0200 Mike Gabriel (7b00b7bb8) * Merge branch 'salva-install-as-non-root' into 3.6.x 2017-05-31 11:44:59 +0200 Salvador Fandiño (320352d64) * Don't force root ownership of dirs when installing (gh-salva/install-as-non-root) 2017-05-31 14:30:32 +0200 Salvador Fandiño (f61956c16) * Propagate DESTDIR and PREFIX from Makefile 2017-05-31 13:01:58 +0200 Mike Gabriel (04fbb2726) * Merge branch 'mikedep333-f24-ftbfs' into 3.6.x 2017-05-25 08:14:49 -0400 Mike DePaulo (c7ce96546) * nx-libs.xpec: Fix FTBFS on F24 due to missing Xfont2 2017-05-06 02:01:47 +0200 Mike Gabriel (150cbc23d) * debian/copyright: Update copyright attributions. 2017-05-06 00:03:48 +0200 Mike Gabriel (6479ed576) * nx-X11/config/cf/gnuLib.rules: Drop ancient Vcs comment. Erroneously sneaked in with reintroduction of GNU/ support. 2017-05-05 14:07:29 +0200 Mihai Moldovan (53cabac9e) * Merge branch 'uli42-pr/fix_rhel6' into 3.6.x 2017-04-25 14:47:48 +0200 Ulrich Sibiller (444e62156) * nx-libs.spec: fix FTBFS on RHEL6 2017-05-05 00:16:41 +0200 Mike Gabriel (5d5336541) * release 3.5.99.7 (tag: 3.5.99.7) 2017-05-04 23:54:31 +0200 Ulrich Sibiller (13753ddfd) * Merge pull request #427 from sunweaver/pr/gnu-hurd-i386-support 2017-04-13 12:01:07 +0200 Mike Gabriel (681069d7a) * nxcompshad/Shadow.cpp: Use EBADF instead of EBADFD (which is not portable to GNU/Hurd and GNU/kFreeBSD). (gh-sunweaver/pr/gnu-hurd-i386-support) 2017-04-13 12:00:26 +0200 Mike Gabriel (d8a25946e) * nx-X11/config/cf/gnu*: Re-introduce GNU/Hurd support to the nx-X11 buildflow. 2017-05-04 23:35:30 +0200 Ulrich Sibiller (c59710e8e) * remove _X_DEPRECATED for XKeycodeToKeysym 2017-05-04 23:08:18 +0200 Mike Gabriel (f149e3626) * Merge branch 'uli42-pr/fix_keyboard_delay' into 3.6.x 2017-05-04 22:38:08 +0200 Ulrich Sibiller (651d5e5ee) * Revert "Switch from using libNX_X11's deprecated XKeycodeToKeysym() function to using XGetKeyboardMapping()." 2017-04-25 14:20:55 +0200 Mihai Moldovan (60d7c02e0) * nx-libs.spec: RPM does not support %elif/%elsif/%elseif/whatever. 2017-04-21 21:31:14 +0200 Mike Gabriel (776785afb) * debian/copyright: Update copyright attributions (re-add nx-X11/programs/Xserver/hw/nxagent/NXpicturestr_PictSolidFill.h). 2017-04-21 16:26:31 +0200 Mike Gabriel (06a6a5fca) * release 3.5.99.6 (tag: 3.5.99.6) 2017-04-21 16:20:50 +0200 Mihai Moldovan (1c6217054) * Merge branch 'sunweaver-pr/use-source-tree-nxcomp' into 3.6.x 2017-03-08 10:45:51 +0100 Mike Gabriel (e91132f3b) * Xserver/Imakefile: Drop redundant library path option -L../../../nx-X11/exports/lib when linking nxagent. As -L../../exports/lib is already present and points to the same location. (gh-sunweaver/pr/use-source-tree-nxcomp) 2017-03-08 11:26:16 +0100 Mike Gabriel (4818c13e7) * Xserver/Imakefile: Change order of linker options, so that self-built components get mentioned first in the nxagent linker command. 2017-04-21 16:14:27 +0200 Mihai Moldovan (22b6ac728) * Merge branch 'sunweaver-pr/nxagent-dialog-fixes' into 3.6.x 2017-03-07 20:52:43 +0100 Mike Gabriel (0f67af9d7) * nxcomp/Children.cpp: Don't generate warnings with duplicated NX paths. (gh-sunweaver/pr/nxagent-dialog-fixes) 2017-03-08 12:21:20 +0000 Mike Gabriel (522e743f6) * hw/nxagent/Dialog.c: Drop unused dialog for DIALOG_DISABLE_XKB_LOCAL. 2017-04-21 12:07:37 +0200 Mike Gabriel (61d5cd0b7) * Revert "NXpicturestr_PictSolidFill.h: Drop file and revert db8705. Not an issue anymore nowadays." 2017-04-20 18:27:11 +0200 Mihai Moldovan (f3d406109) * nx-X11/programs/Xserver/os/connection.c: compact display autodetection code. 2017-04-20 18:24:04 +0200 Mihai Moldovan (1ccc6be61) * Merge branch 'sunweaver-pr/enhance-displayfd-auto-detection' into 3.6.x 2017-04-07 16:39:27 +0200 Mike Gabriel (9865f73be) * man/nxagent.1: Document the nxagent specific usage pattern of the displayfd cmdline option. (gh-sunweaver/pr/enhance-displayfd-auto-detection) 2017-04-07 15:27:50 +0200 Mike Gabriel (ec185d7f7) * Xserver/os/connection.c: If -displayfd and an explicit display port number are given, use the explicit display number as a starting point for auto-detecting the next available display number. 2017-04-07 15:26:45 +0200 Mike Gabriel (f4d7863f8) * Xserver/os/connection.c: Accompany display number with some human-readable (machine-parseable) text when -displayfd is set to STDERR. 2017-04-20 14:06:18 +0200 Mike Gabriel (7d0b7055b) * Merge branch 'uli42-pr/extend_manpage' into 3.6.x 2017-04-18 00:10:46 +0200 Ulrich Sibiller (394246855) * nxagent.1: some more rephrasing 2017-04-18 00:08:55 +0200 Ulrich Sibiller (4998c41de) * nxagent.1: fix: "tolerancechecks" was documented as "reconnectchecks" 2017-04-17 23:38:19 +0200 Ulrich Sibiller (0ccc2ee7a) * nxagent.1: highlight nxagent 2017-04-17 23:15:13 +0200 Ulrich Sibiller (e18c95584) * nxagent.1: use nxagent everywhere 2017-04-17 23:13:53 +0200 Ulrich Sibiller (5f88a2978) * nxagent.1: rephrase description 2017-04-17 23:09:39 +0200 Ulrich Sibiller (14417c94b) * nxagent.1: add -options, previously undocumented 2017-04-17 23:09:17 +0200 Ulrich Sibiller (baf7d39b8) * nxagent.1: fix typo 2017-04-17 23:08:37 +0200 Ulrich Sibiller (9494062eb) * nxagent.1: remove no longer existing -co option from manpage 2017-04-19 13:38:49 +0200 Mike Gabriel (ab0bc8158) * Xserver/GL/glx/glxext.c: Fix for previous commit, re-adding a comment starter '/*'. 2017-04-19 13:08:26 +0200 Mike Gabriel (4ad88de86) * Clearing comments from $XFree86$ (et al.) header lines. 2017-04-19 01:20:30 +0200 Mihai Moldovan (a4fb30f8d) * debian/changelog: add missing bug closure. 2017-04-18 17:21:53 +0000 Mihai Moldovan (0c9852a76) * {debian/control,nx-libs.spec}: add proper dependencies upon xkbcomp for RPM and DEB packages. 2017-04-18 22:45:11 +0200 Mike Gabriel (85b58daa8) * Merge branch 'Ionic-add-xkbcomp-dep' into 3.6.x 2017-04-18 19:01:42 +0000 Mihai Moldovan (a2dca67a5) * nx-libs.spec: sync up RPM builds after Xext proto change in a51cb94559e9228a55e01956f242dabccc5e6b14. (gh-ionic/add-xkbcomp-dep, gh-Ionic/add-xkbcomp-dep) 2017-04-18 17:21:53 +0000 Mihai Moldovan (adb2f80cc) * {debian/control,nx-libs.spec}: add proper dependencies upon xkbcomp for RPM and DEB packages. 2017-04-18 19:05:20 +0000 Mihai Moldovan (7c0a35916) * nx-libs.spec: whitespace only. 2017-04-13 16:00:16 +0200 Mike Gabriel (1537eb05d) * debian/Makefile.nx-libs: make sure that 'make all' only calls 'make build' and _not_ the global '%:' ruleset afterwards. 2017-04-14 15:14:00 +0200 Mike Gabriel (cc17d89e2) * debian/control: Add get-orig-source rule as in official Debian package. 2017-04-14 15:11:06 +0200 Mike Gabriel (a51cb9455) * debian/{rules,nx-x11proto-xext-dev}: More Xext header files belong int nx-x11proto-xext-dev (instead of removing them in debian/rules). 2017-04-14 15:07:53 +0200 Mike Gabriel (35ec402fd) * debian/control: Pre-D (nx-x11-common) on versioned dpkg not required anymore. 2017-04-14 15:05:06 +0200 Mike Gabriel (fdd66710f) * debian/control: Pull-over latest changes on these files from the official Debian package. Various improvements several package descriptions. 2017-04-14 15:02:52 +0200 Mike Gabriel (0eb3bbd25) * debian/copyright{,in}: Pull-over latest changes on these files from the official Debian package. 2017-04-13 20:28:19 +0200 Mihai Moldovan (a1e309a0f) * Merge branch 'sunweaver-pr/enable-mit-screen-saver-extension' into 3.6.x 2017-04-11 10:21:30 +0200 Mike Gabriel (244ce534a) * Xserver: Build nxagent with MIT-SCREEN-SAVER extension enabled. (gh-sunweaver/pr/enable-mit-screen-saver-extension) 2017-04-13 17:05:32 +0200 Mihai Moldovan (680de79fb) * Merge branch 'sunweaver-pr/Mesa-define-USE_IEEE-macro-for-more-platforms' into 3.6.x 2017-04-13 14:09:12 +0200 Mike Gabriel (d4941a6a5) * Mesa.patches: Define USE_IEEE for __aarch64__ and __mc68000__, as well. (gh-sunweaver/pr/Mesa-define-USE_IEEE-macro-for-more-platforms) 2017-04-13 16:13:04 +0200 Mike Gabriel (85b925e3f) * nx-X11/config/cf: Clean-up left-overs from having our own libNX_Xext shared library. 2017-04-13 16:00:16 +0200 Mike Gabriel (8a3605ffa) * Makefile: Make sure that 'make all' only calls 'make build' and _not_ the global '%:' ruleset afterwards. (gh-sunweaver/pr/Makefile-only-call-build-on-make-all) 2017-04-13 15:58:46 +0200 Mike Gabriel (f843d1b14) * Makefile: Remove nx-X11/config/cf/date.def on clean. 2017-04-13 15:58:14 +0200 Mike Gabriel (fa3734ff4) * Makefile: Fix comment above special clean rules. 2017-04-13 14:45:22 +0200 Mihai Moldovan (a2b758458) * Merge branch 'sunweaver-pr/fix-ftbfs-on-linux-sparc64' into 3.6.x 2017-04-13 10:24:19 +0200 Mike Gabriel (fb962f896) * nx-X11/config/cf/linux.cf: Fix FTBFS on Linux SPARC64 due to missing -D_XSERVER64 definition. (gh-sunweaver/pr/fix-ftbfs-on-linux-sparc64) 2017-04-13 14:02:22 +0200 Mihai Moldovan (138b52c9b) * Merge branch 'sunweaver-pr/fix-ftbfs-on-aarch64' into 3.6.x 2017-04-12 19:23:37 +0200 Mike Gabriel (53dc4ba12) * nx-X11/config/cf/linux.cf: Fix FTBFS on arm64 (aarch64) due to missing -D_XSERVER64 definition. (gh-sunweaver/pr/fix-ftbfs-on-aarch64) 2017-04-11 17:01:25 +0200 Mike Gabriel (3a2ecb9a5) * release 3.5.99.5 (tag: 3.5.99.5) 2017-04-10 20:54:19 +0000 Mike Gabriel (d6479c9f4) * debian/patches: Update 016_nx-X11_install-location.debian.patch (due to fuzziness). 2017-04-10 20:53:34 +0000 Mike Gabriel (d63b4a5ba) * Regression fix for added libXfont2 API support: 2017-04-10 16:33:27 +0200 Mihai Moldovan (2d700b147) * Merge branch 'sunweaver-pr/createpixmap-alloc-hints-abi-change' into 3.6.x 2017-02-22 12:59:07 +0000 Mike Gabriel (8b5bb2cda) * hw/nxagent/Pixmap.c et al.: Propagate usage_hint through nxagentCreatePixmap, as well. (gh-sunweaver/pr/createpixmap-alloc-hints-abi-change) 2017-03-11 01:13:58 +0100 Mike Gabriel (560c95643) * Mesa.patches: Adapt Mesa to CreatePixmap allocation hint ABI bump. 2017-02-22 14:14:41 +0100 Aaron Plattner (aa50b35a5) * Save pixmap allocation hints into the PixmapRec. 2017-02-22 13:30:48 +0100 Aaron Plattner (3ef6d5120) * Add CreatePixmap allocation hints. 2017-04-10 16:20:51 +0200 Mihai Moldovan (cc24d8ba2) * Merge branch 'sunweaver-pr/switch-to-libXfont2-API' into 3.6.x 2017-04-10 12:43:33 +0200 Mike Gabriel (c4c548547) * nx-libs.spec: Prefer libXfont2-devel on RPM distro versions that have it.~ (gh-sunweaver/pr/switch-to-libXfont2-API) 2017-04-10 10:09:32 +0000 Mike Gabriel (a5432aac8) * debian/control: Use B-D libxfont-dev only. Follow libXfont2 transition on Debian (and alike). 2017-04-10 10:08:14 +0000 Mike Gabriel (92979a4e8) * Makefile: Tell Xserver build which Xfont API to use (v2 or v1) depending on what's available in the build env. 2017-02-09 14:05:57 +0100 Mike Gabriel (f4c80a78c) * Xserver: Support building against libXfont2 (v2) API and old libXfont(1) API alike. 2017-02-16 08:19:40 +0000 Jamey Sharp (f743f9f74) * SetFontPath: set client->errorValue on failure. 2017-02-16 08:21:56 +0000 Eamon Walsh (4768662b0) * dix: pass a valid ClientPtr to SetFontPath in all cases. 2017-02-14 09:17:25 +0100 Mike Gabriel (523009b96) * hw/nxagent/BitmapUtils.c: Derive from utilbitmap.c in deprecated libXfont1 and ship as copy-of-code with nxagent. 2017-02-09 22:31:19 +0000 Mike Gabriel (6a06a6c81) * dix: Move InitFonts up above screen initialization 2017-02-09 11:22:41 +0100 Mike Gabriel (03b772b5f) * Xserver/Imakefile: Improve readability by introducing the NULL variable and adding more line-breaks. 2017-04-10 16:01:02 +0200 Mike Gabriel (9e2588e56) * Revert "regression fix for 52872a0: Keep index parameter in AddScreen() for now. Requires proper ABI backport. (was: copy+paste error)." 2017-04-10 15:01:39 +0200 Mihai Moldovan (5421dd444) * Merge branch 'sunweaver-pr/remove-index-from-CloseScreen-ABI-backport' into 3.6.x 2017-03-11 00:53:01 +0100 Dave Airlie (93ea74e53) * xserver: remove index from CloseScreen (API/ABI breakage) (gh-sunweaver/pr/remove-index-from-CloseScreen-ABI-backport) 2017-04-07 16:20:47 +0200 Vadim Troshchinskiy (ab3974f22) * Merge remote-tracking branch 'sunweaver-pr/pr/nxproxy-read-from-stdin' into 3.6.x 2017-02-05 23:29:41 +0100 Bernard Cafarelli (4c2fe0d97) * nxproxy: Support communication over stdin. Allow nxcl to use standard ssh instead of nxssh. (gh-sunweaver/pr/nxproxy-read-from-stdin) 2017-04-07 13:48:56 +0200 Mike Gabriel (1441b02f0) * nxcomp/Loop.cpp: Fix server/client mode info cerr printing in PrintProcessInfo(). 2017-04-07 10:32:28 +0200 Mike Gabriel (dcdbc102c) * Merge branch 'sunweaver-pr/drop-render-fullcolor-workaround' into 3.6.x 2017-03-21 21:25:39 +0100 Mike Gabriel (6c8c95025) * NXpicturestr_PictSolidFill.h: Drop file and revert db8705. Not an issue anymore nowadays. (gh-sunweaver/pr/drop-render-fullcolor-workaround) 2017-04-06 14:09:19 +0200 Erkki Seppälä (c8a4e1e75) * record: avoid crash when calling RecordFlushReplyBuffer recursively 2017-04-06 12:17:54 +0200 Mihai Moldovan (0d7b4c365) * Merge branch 'sunweaver-pr/mesa-patching-with-quilt' into 3.6.x 2017-02-20 12:54:14 +0100 Mike Gabriel (2c9effed2) * Mesa subtree: Add quilt based patch system for bundled Mesa. (gh-sunweaver/pr/mesa-patching-with-quilt) 2017-04-05 11:19:54 +0200 Mike Gabriel (2767d32c0) * roll-tarball.sh: Fix ChangeLog creation, always create ChangeLog for the CHECKOUT, not the currently checked out branch. 2017-04-03 21:44:05 +0200 Mike Gabriel (25d38bf36) * Merge branch 'uli42-pr/cleanup_keystroke' into 3.6.x 2017-03-27 22:58:38 +0200 Ulrich Sibiller (ee18cd43d) * Keystrokes: rename left/up/right/down keystrokes to descriptive names (gh-uli42/pr/cleanup_keystroke) 2017-03-27 22:46:47 +0200 Ulrich Sibiller (d28cf5574) * doc: rework keystroke documentation 2017-03-27 22:07:51 +0200 Ulrich Sibiller (9f0713c04) * doc: document debugging keystrokes 2017-03-23 23:48:46 +0100 Ulrich Sibiller (e3240d6b3) * keystrokes.cfg: remove debug keystrokes 2017-03-23 23:32:24 +0100 Ulrich Sibiller (bf27d58b7) * Keystroke.c: move some vars to inner scope 2017-03-23 23:11:32 +0100 Ulrich Sibiller (ba5183f80) * Init keystrokes at startup and reconnect 2017-03-23 23:01:09 +0100 Ulrich Sibiller (f12012b15) * Keystroke.c: avoid use of comparisons on "False" 2017-03-23 22:54:34 +0100 Ulrich Sibiller (2b9d7d274) * Keystroke.c: use Booleans where appropriate 2017-03-23 22:48:09 +0100 Ulrich Sibiller (076d458e7) * Keystroke.h: improve parse_keystroke_file() 2017-03-23 22:46:35 +0100 Ulrich Sibiller (79520f9c6) * Keystroke.c: introduce nxagentDumpKeystrokes() 2017-03-23 22:42:26 +0100 Ulrich Sibiller (a45a348c4) * keystrokes.cfg: add missing keystrokes 2017-03-23 22:22:05 +0100 Ulrich Sibiller (3c921ccb4) * Keystroke.c/h: completely disable keystrokes that are not active at compile time 2017-03-23 22:21:00 +0100 Ulrich Sibiller (811ce4902) * Keystroke.h: auto-enum keystrokes 2017-03-23 22:18:16 +0100 Ulrich Sibiller (4adb1911f) * Keystroke.h/Keyboard.h: cleanup mask variables 2017-03-21 22:33:29 +0100 Ulrich Sibiller (c693df127) * Keystroke.c: detect duplicate keystroke definitions 2017-03-21 22:32:00 +0100 Ulrich Sibiller (40f03399c) * Keystroke.c: use KEYSTROKE_NOTHING 2017-03-21 21:52:05 +0100 Ulrich Sibiller (51782cb25) * Args.c: add two missing options to help message 2017-04-03 20:52:05 +0200 Mike Gabriel (147371a28) * Merge branch 'sunweaver-pr/xinerama-response-swapping-in-RRXineramaWriteMonitor' into 3.6.x 2017-03-10 14:16:26 +0100 Michal Srb (f34eff0a2) * xinerama: Swap the response in RRXineramaWriteMonitor (gh-sunweaver/pr/xinerama-response-swapping-in-RRXineramaWriteMonitor) 2017-04-03 20:39:06 +0200 Mike Gabriel (4e0e7c472) * Merge branch 'mikedep333-pr/cygwin-nxcomp-ftbfs' into 3.6.x 2017-03-29 21:52:25 -0400 Mike DePaulo (1a2bea981) * Remove EMX (MS-DOS & OS/2) support 2017-03-29 07:19:25 -0400 Mike DePaulo (995851206) * Cygwin nxcomp: Use Cygwin un.h 2017-03-27 16:39:28 +0200 Mike Gabriel (342758254) * regression fix for 52872a0: Keep index parameter in AddScreen() for now. Requires proper ABI backport. (was: copy+paste error). 2017-03-27 16:14:30 +0200 Mike Gabriel (d7d2aeea4) * Merge branch 'uli42-pr/libX11-HEAD' into 3.6.x 2017-02-01 15:02:41 +0100 Arthur Huillet (00405b278) * _XDefaultError: set XlibDisplayIOError flag before calling exit 2017-01-07 16:20:31 +0100 Julien Cristau (8ad49a03e) * Fix wrong Xfree in XListFonts failure path 2017-03-26 14:34:48 +0200 Mihai Moldovan (ac03b5172) * Merge branch 'sunweaver-pr/dix-dispatch-backports' into 3.6.x 2017-03-11 00:48:03 +0100 Mike Gabriel (c1fc4ba78) * dix: Remove insane BC hacks (gh-sunweaver/pr/dix-dispatch-backports) 2017-03-10 16:48:54 +0100 Mike Gabriel (cb9e50c2f) * Move AddScreen() comment where it actually belongs. Should be done in X.org, too. 2017-03-10 16:29:24 +0100 Mike Gabriel (52872a0de) * dix: Move AddScreen() over into dispatch.c and introduce init_screen() 2017-03-22 00:40:55 +0100 Mihai Moldovan (f5e7d555a) * Merge branch 'sunweaver-pr/various-os-backports' into 3.6.x 2017-03-20 13:22:50 +0100 Adam Jackson (565421ba1) * os: Remove the useless -x option (gh-sunweaver/pr/various-os-backports) 2017-03-15 15:46:32 +0000 Keith Packard (a95cfdf48) * os: FatalError if -displayfd writes fail AND Clear the -displayfd option after closing the file 2017-03-15 15:42:10 +0000 Alan Coopersmith (e96e810c2) * Use unique logfile names when starting server with -displayfd 2017-03-15 15:40:57 +0000 Jon TURNEY (faaba2661) * os: -displayfd should check ports up to 65535 2017-03-15 15:16:37 +0000 Keith Packard (c468be804) * os: Use NotifyFd interface for listen descriptors 2017-03-15 15:05:18 +0000 Jon TURNEY (3be144ffd) * Handle -displayfd and an explicit display number sensibly 2017-03-15 15:00:27 +0000 Mike Gabriel (506aedbcd) * Xserver/os/utils.c: Add NXAGENT_SERVER specific -nolisten parameter: ANY. 2017-03-15 14:56:17 +0000 Kristian Høgsberg (e8bc4c7e2) * os: Add a mechanism to prevent creating any listen sockets 2017-03-15 14:10:24 +0000 Chase Douglas (89496d987) * os: Add -displayfd option 2017-03-15 11:42:30 +0100 Keith Packard (eb4999611) * os: Use NotifyFd for ErrorConnMax 2017-03-15 12:08:46 +0100 Adam Jackson (f5301dee4) * Move SIGUSR1 notification as late as possible. 2017-02-16 10:54:19 +0000 Adam Jackson (4f76ed19b) * dix: Extend initial connection handshake for forwarding proxies 2017-02-16 10:51:40 +0000 Adam Jackson (ed52cb295) * dix: Pull client-is-local flag up to the ClientRec 2017-02-16 10:35:39 +0100 Pauli Nieminen (349b6dec5) * os: always check if client is local when connection is accepted 2017-02-15 16:42:14 +0100 Rami Ylimäki (239fe3d08) * os: Add facilities for client ID tracking. 2017-02-16 15:21:34 +0000 Mike Gabriel (366067b7c) * dix/os: backport various signal handling and smart scheduler changes from X.org 2017-02-16 15:04:43 +0000 Keith Packard (f14f738a6) * dix/os: Merge priority computation into SmartScheduleClient 2017-02-16 10:28:32 +0100 Pauli Nieminen (6c076cfe5) * os: Fix a memory leak 2017-02-15 14:42:48 +0000 Alan Coopersmith (8996f80a5) * Rework local client id finding code to be more uniform 2017-02-15 14:18:35 +0000 Alan Coopersmith (6bc37b980) * AUDIT messages should contain uid for local accesses (X.org bug #1997) 2017-02-15 14:11:46 +0000 Mike Gabriel (0338cbc3f) * LBX clean-up: Drop forgotten passage in Xserver/os/connection.c. 2017-02-15 13:51:26 +0000 Mike Gabriel (104307dd6) * Xserver/os/: Drop not-used-anymore MNX_TCPCONN macro. 2017-02-15 10:27:43 +0100 Mike Gabriel (7177caa70) * Xserver/os/Imakefile: Introduce the NULL variable and line-wrap various variable definitions for the sake of better readability. 2017-02-15 09:41:36 +0100 Adam Jackson (eac0a8fad) * Don't crash on unconfigured interfaces. (X.org bug #5218, Andrei Barbu) 2017-02-14 18:01:17 +0000 Alan Coopersmith (f9123570d) * Set padding bytes to 0 in WriteToClient 2017-02-14 15:47:10 +0000 Aaron Plattner (2ecd2a006) * os: Return BadLength instead of disconnecting BigReq clients (#4565) 2017-02-14 15:19:18 +0000 Peter Harris (cbc2d300b) * Fix overflow of ConnectionOutput->size and ->count 2017-02-15 08:13:57 +0000 Michel Dänzer (65b6a62bc) * dix: Pass ClientPtr to FlushCallback 2017-02-14 14:59:51 +0000 Keith Packard (af7c37500) * Xserver/os/io.c: Bail out early from FlushClient if nothing needs to be written. 2017-02-14 13:18:04 +0000 Chris Wilson (645b757df) * os: Immediately queue initial WriteToClient 2017-03-15 13:27:12 +0000 Mike Gabriel (074646707) * os/xdmcp: Remove dead 'restart' code 2017-03-19 22:24:59 +0100 Mike Gabriel (b7c389b9a) * Merge branch 'uli42-pr/ignore_caps' into 3.6.x 2017-03-19 21:59:17 +0100 Ulrich Sibiller (7065e0bf2) * Keystroke.c: ignore CapsLock and NumLock most of the time (gh-uli42/pr/ignore_caps) 2017-03-17 20:39:28 +0100 Mihai Moldovan (7fd5d934c) * Merge branch 'sunweaver-pr/setnotifyfd-ABI' into 3.6.x 2017-02-24 13:03:30 +0000 Mike Gabriel (f315ae066) * os: Initialize NotifyFds earlier in startup (gh-sunweaver/pr/setnotifyfd-ABI) 2017-02-09 23:33:44 +0000 Keith Packard (761d74a68) * os: Implement support for NotifyFd X_NOTIFY_WRITE and removal of AddEnabledDevices/RemoveEnabledDevices 2017-02-09 21:28:12 +0000 Fredrik Höglund (6307e6fc7) * Move the code for resetting the DPMS mode in response to input events, from WaitForSomething to mieqProcessInputEvents. 2017-02-09 23:35:00 +0000 Mike Gabriel (9b934a447) * nxagent: Use SetNotifyFd to receive events. 2017-02-09 13:45:12 +0100 Keith Packard (86110d6ed) * os: Add NotifyFd interfaces 2017-02-09 12:32:16 +0000 Mike Gabriel (289e8ce56) * Xserver/include/list.h: Add list.h from X.org (from X.org commit 63f83d1). 2017-02-10 00:22:03 +0100 Keith Packard (9f0008429) * os/xdmcp: Just send XDMCP keepalive packets once every three minute 2017-03-13 23:07:19 +0100 Mike Gabriel (6ac805ab4) * Merge branch 'uli42-pr/cleanup_keystroke' into 3.6.x 2017-03-13 22:19:17 +0100 Ulrich Sibiller (6f4eb1540) * Update keystroke readme 2017-03-13 22:07:58 +0100 Ulrich Sibiller (cb40cc448) * Keystroke.c: remove unneeded capital keys for default keystrokes 2017-03-13 22:00:23 +0100 Ulrich Sibiller (abf624212) * Keystroke.c: add new keystroke to reread keystroke config 2017-03-13 21:42:24 +0100 Ulrich Sibiller (aadcac452) * Keystroke.c: simplify parse_keystroke_file 2017-03-13 21:26:31 +0100 Ulrich Sibiller (f97bb3f13) * Keystroke.c: fix formatting 2017-03-13 21:19:48 +0100 Ulrich Sibiller (c134b93ac) * Keystroke.c: use an own environment variable for X2Go 2017-03-13 21:14:20 +0100 Ulrich Sibiller (8f2679abc) * Keystroke.c: make nxagentKeystrokeFileParsed local 2017-03-13 20:50:53 +0100 Ulrich Sibiller (3042c5064) * Keystroke.c: add missing Mod5 modifier 2017-03-13 20:27:50 +0100 Ulrich Sibiller (57081e55f) * Keystroke.c: fix code order 2017-03-13 20:25:15 +0100 Ulrich Sibiller (2c721f484) * Keystroke.h: sane struct init 2017-03-13 20:23:32 +0100 Ulrich Sibiller (d2c811564) * Keyboard.c: Introduce separate masks for Alt and Meta 2017-03-13 20:21:57 +0100 Ulrich Sibiller (5595e3d16) * Keystroke.c: Fix modifier handling 2017-03-13 20:20:53 +0100 Ulrich Sibiller (af5a83bba) * Keystroke.c: more/fixed debug output 2017-03-13 20:17:51 +0100 Ulrich Sibiller (af8e5e03a) * Keystroke: whitespace fixes 2017-03-11 00:21:53 +0100 Ulrich Sibiller (8f7b0b75b) * Keystroke.c: arrange switch_all_screens and fullscreen close together 2017-03-11 00:07:13 +0100 Ulrich Sibiller (8f0d885cd) * Keystroke.c: print keystroke name in TEST mode 2017-03-10 23:49:49 +0100 Ulrich Sibiller (b39ec4c45) * Keystroke.c: improve TEST output 2017-03-10 23:40:17 +0100 Ulrich Sibiller (93a360c5d) * Keystroke.c: add another FIXME 2017-03-10 23:31:27 +0100 Ulrich Sibiller (25db7413a) * Keystroke.c: Simplify read_binding_from_xmlnode 2017-03-10 23:30:02 +0100 Ulrich Sibiller (13a7c4a73) * Keystroke.c: use symbols instead of integers 2017-03-10 23:29:11 +0100 Ulrich Sibiller (f78e673fb) * Keystroke.c: Boolify read_binding_from_xmlnode 2017-03-10 23:09:24 +0100 Ulrich Sibiller (c80605a19) * Keystroke.c: Boolify nxagentCheckSpecialKeystroke 2017-03-10 23:08:40 +0100 Ulrich Sibiller (ac3794c5f) * Keystroke.c: reorder parse_keystroke_file 2017-03-10 22:58:27 +0100 Ulrich Sibiller (06c83be7e) * Keystroke.c: handle parsing state in parse_keystroke_file() 2017-03-10 22:55:37 +0100 Ulrich Sibiller (7804c9c69) * Keystroke.c: simplify nxagentCheckSpecialKeystroke 2017-03-10 22:53:09 +0100 Ulrich Sibiller (dfa8bb27b) * Keystroke.c: fix code formatting 2017-03-10 22:48:18 +0100 Ulrich Sibiller (7a61c62cd) * Keystroke.c: rework read_binding_from_xmlnode() 2017-03-10 22:47:18 +0100 Ulrich Sibiller (d8bc49135) * Keystroke.c: use Bool type where appropriate 2017-03-10 20:19:19 +0100 Mihai Moldovan (320cece2e) * Merge branch 'uli42-pr/misc_cherries' into 3.6.x 2017-03-04 01:12:24 +0100 Ulrich Sibiller (ee2a933c3) * Xext: fix compiler warning (gh-uli42/pr/misc_cherries) 2017-03-04 00:28:01 +0100 Ulrich Sibiller (e021bc231) * xfixes: fix compiler warning 2017-03-04 00:24:12 +0100 Ulrich Sibiller (914f78a23) * xfixes: fix compiler warnings 2017-03-04 00:15:08 +0100 Ulrich Sibiller (e79d3ac6b) * render/filter.c: add missing return value 2017-03-04 00:10:57 +0100 Ulrich Sibiller (a9d4a454b) * record.c: fix compiler warnings 2017-03-03 23:52:20 +0100 Ulrich Sibiller (c1ed00569) * fb: fix compiler warning 2017-03-03 23:43:50 +0100 Ulrich Sibiller (e17c42e55) * dix: Fix compiler warning 2017-03-03 23:32:52 +0100 Ulrich Sibiller (fe887d68a) * Display.c: remove unused logo code 2016-12-14 11:50:47 +0100 Ulrich Sibiller (2a6fcfc14) * Rootless.c: improve debugging output 2016-12-14 11:50:21 +0100 Ulrich Sibiller (a83022a4a) * Rootless.c: improve malloc failure handling 2016-12-14 11:49:40 +0100 Ulrich Sibiller (4e545710f) * Rootless.c: fix possible memleak 2016-12-13 10:05:40 +0100 Ulrich Sibiller (1b6b76b5b) * Display.c: pid is always 0, remove check 2016-12-13 02:02:29 +0100 Ulrich Sibiller (35e41467a) * Window.c: Fix reference before check for null pointer 2016-12-13 02:00:40 +0100 Ulrich Sibiller (4a1095fff) * Keyboard.c: Simplify if clause 2016-12-13 01:56:57 +0100 Ulrich Sibiller (fcb5e8a0e) * Rootless.c: Fix wrongly negated comparisons 2016-12-13 01:56:10 +0100 Ulrich Sibiller (df0fea79b) * Args.c: Fix missing parentheses 2017-03-09 10:32:45 +0100 Mihai Moldovan (fb55fc3ef) * nx-X11: use the "old", non-NX header location. 2017-03-09 09:22:03 +0100 Mihai Moldovan (dc8477f76) * nxcomp/ChannelEndPoint.cpp: we're not really testing for a character, but a pointer. 2017-03-09 08:29:23 +0100 Mihai Moldovan (4537ad4c2) * Refresh: - 0016_nx-X11_install-location.debian.patch - 9900-dxpc-license-history.full+lite.patch 2017-03-09 08:24:28 +0100 Ulrich Sibiller (c2b050e30) * nx-X11: Backport CVE-2017-2624 (timingsafe_memcmp) 2017-03-07 23:53:21 +0100 Mihai Moldovan (d8a4f3be7) * Merge branch 'uli42-pr/backup_null_rulesfile' into 3.6.x 2008-12-03 15:06:37 +1000 Peter Hutterer (2794e674c) * xkb: Allow NULL as rulesFile in XkbSetRulesDflts. (gh-uli42/pr/backup_null_rulesfile) 2017-03-07 22:34:09 +0100 Mihai Moldovan (c6f0e6b2c) * Merge branch 'uli42-pr/cve-2017-2624' into 3.6.x 2017-03-04 16:10:38 +0100 Ulrich Sibiller (22f542626) * os: add timingsafe_memcmp to Imake (gh-uli42/pr/cve-2017-2624) 2017-03-03 22:46:33 +0100 Ulrich Sibiller (65c5d8ad7) * Backport CVE-2017-2624 (timingsafe_memcmp) 2017-03-03 22:44:58 +0100 Mike Gabriel (05aabb4e6) * Merge branch 'uli42-pr/fix_validatestring' into 3.6.x 2017-03-02 15:38:08 +0100 Ulrich Sibiller (06bb154df) * replace (DE)ALLOCATE_LOCAL by malloc/free 2017-03-03 21:46:33 +0100 Mike Gabriel (96e255603) * Merge branch 'uli42-pr/remove_allocate_local' into 3.6.x 2017-03-03 21:44:07 +0100 Ulrich Sibiller (6e8aee499) * nxagent: move validateString as inline func to Utils.h 2017-03-03 21:24:59 +0100 Ulrich Sibiller (19065e75e) * xkb: add missing const 2010-01-15 15:32:13 +1000 Peter Hutterer (9e29588dd) * xkb: remove XkbAtomGetString, replace with NameForAtom. 2011-02-13 21:36:03 -0800 Alan Coopersmith (bdfb52193) * Replace _XkbDupString with Xstrdup 2017-02-25 15:47:42 +0100 Ulrich Sibiller (e61e9795c) * nxagent: half number of NameForAtom calls 2017-03-02 15:38:08 +0100 Ulrich Sibiller (09ef99919) * replace (DE)ALLOCATE_LOCAL by malloc/free (gh-uli42/pr/remove_allocate_local) 2017-03-03 16:21:33 +0100 Mihai Moldovan (89ccf26d6) * Merge branch 'sunweaver-pr/really-enable-MITSHM-in-fboverlay-c' into 3.6.x 2017-02-05 23:25:35 +0000 Mike Gabriel (1c7b45d57) * Xserver/mi/miscrinit.c: Use new shmint.h for making ShmRegisterFbFuncs() available. (gh-sunweaver/pr/really-enable-MITSHM-in-fboverlay-c) 2017-02-05 23:23:52 +0000 Mike Gabriel (269651e47) * Xserver/fb/fboverlay.c: Define -DMITSHM at build as it is used in fboverlay.c. 2017-02-05 23:16:50 +0000 Mike Gabriel (dbfd7645a) * Xserver/Xext/shmint.h: Provide header file exporting ShmRegisterFunc and ShmRegisterFbFuncs (plus ShmSetPixmapFormat as a by-product). 2017-03-03 13:46:38 +0100 Mihai Moldovan (a54f3e0a8) * Merge branch 'sunweaver-pr/fix-unused-libNX_X11-files' into 3.6.x 2017-02-04 11:09:37 +0100 Mike Gabriel (09cf1bcc0) * libNX_X11: Fully drop loadable i18n module support in libNX_X11. 2017-02-04 10:55:12 +0100 Mike Gabriel (ba27cae63) * libNX_X11/lcUTF8.c: Drop not-used X11/lcUniConv/ascii.h. 2017-02-04 10:52:05 +0100 Mike Gabriel (949f5e04e) * doc/libNX_X11/lcUniConv: Move over the rather-documentary files 8bit_tab_to_h.c and cjk_tab_to_h.c to nx-libs's doc/ folder. 2017-02-04 10:50:49 +0100 Mike Gabriel (c9539417a) * doc/libNX_X11/lcUniConv: Pull over README from X.org's libX11 to document the origin and purpose of 8bit_tab_to_h.c and cjk_tab_to_h.c. 2017-03-03 13:09:15 +0100 Mike Gabriel (8cdccdcf1) * Merge branch 'sunweaver-pr/happyvalgrind-in-glXQueryVersion' into 3.6.x 2017-03-03 11:06:58 +0100 Mike Gabriel (6e770378c) * Xserver/GL/glx/glxcmd.c: Fix uninitialized xGLXQueryVersionReply. (gh-sunweaver/pr/happyvalgrind-in-glXQueryVersion) 2016-09-16 23:58:54 +0000 Mihai Moldovan (7011de155) * misc nx-X11/programs/Xserver/randr/: switch to using xreallocarray, since it has been ported now. 2016-09-12 02:59:02 +0000 Mihai Moldovan (5413c5ec8) * misc nx-X11/programs/Xserver/{composite,dix,randr}/: switch to using reallocarray, since it has been ported now. 2016-08-17 04:51:32 +0000 Mihai Moldovan (cd1dcdb2b) * nx-X11/programs/Xserver/include/os.h: backport xallocarray(). 2016-08-17 04:34:50 +0000 Mihai Moldovan (d189cb422) * nx-X11/{config/cf/{{Imake,X11}.tmpl,linux.cf},programs/Xserver/{include/os.h,os/{Imakefile,reallocarray.c}}: backport reallocarray() implementation. 2016-07-20 02:41:03 +0000 Mihai Moldovan (1a7fc41c2) * misc nx-X11/programs/Xserver/{hw/nxagent,miext,render}/: move code around so that we can drop nx-X11/programs/Xserver/render/miglyph.c (and by extension nx-X11/programs/Xserver/hw/nxagent/NXmiglyph.c.) 2016-09-12 02:33:22 +0000 Mihai Moldovan (d5a222b65) * nx-X11/programs/Xserver/mi/{Imakefile,mibank.{c,h}}: backport ffaae7c0c69a51a53a76146c79f3630ae197a443. 2017-03-03 11:42:06 +0100 Mike Gabriel (50c589eb9) * Merge branch 'sunweaver-pr/happyvalgrind-nxagentResetSignalHandlers' into 3.6.x 2017-03-03 11:17:22 +0100 Mike Gabriel (46f9afb35) * hw/nxagent/Display.c: Fix uninitialized newAction in nxagentResetSignalHandlers(). (gh-sunweaver/pr/happyvalgrind-nxagentResetSignalHandlers) 2017-03-03 11:04:10 +0100 Mike Gabriel (20029dbc8) * Merge branch 'uli42-pr/happyvalgrind' into 3.6.x 2017-02-25 02:17:18 +0100 Ulrich Sibiller (3e315cd17) * Fix "uninitialised byte(s)" complaints from valgrind (gh-uli42/pr/happyvalgrind) 2017-03-02 11:24:18 +0100 Mihai Moldovan (9d41e84ea) * Merge branch 'sunweaver-pr/allow-empty-nx-options-string' into 3.6.x 2017-02-05 12:47:57 +0100 Mike Gabriel (ce037f4e3) * nxcomp/Loop.cpp: Allow nx/nx: as DISPLAY variable (i.e. an empty nx/nx options string. (gh-sunweaver/pr/allow-empty-nx-options-string) 2017-02-05 12:41:28 +0100 Mike Gabriel (a4be1b89f) * nxcomp/Loop.cpp: Ignore, options= nx/nx parameter, if file options path starts with /dev/, /proc/, or /sys/. 2017-03-02 11:01:43 +0100 Mihai Moldovan (554a6fa76) * Merge branch 'sunweaver-pr/constify-atom-name-strings' into 3.6.x 2017-02-27 13:52:29 +0000 Mike Gabriel (9c3669c6b) * Xserver/dix/atom.c (et al.): Constify atom name strings. (gh-sunweaver/pr/constify-atom-name-strings) 2017-03-01 15:19:26 +0100 Mihai Moldovan (f42d36fb7) * Merge branch 'sunweaver-pr/randr-regression-fix-re-adding-RegisterResourceName-calls' into 3.6.x 2017-02-27 11:20:38 +0100 Mike Gabriel (bdc212b84) * nx-libs.spec: Add BR filesystem for SUSE builds (as it provides /usr/share/fonts). 2017-02-14 09:35:32 +0000 Mike Gabriel (f90e92bca) * nx-libs.spec: Add BR for Fedora/RHEL builds: xorg-x11-font-utils. 2017-02-09 08:59:48 +0100 Mike Gabriel (2174721a0) * nx-libs.spec: Versioned BR on libXfont-devel (and alike) (>= 1.4.2). 2017-02-09 08:59:15 +0100 Mike Gabriel (2556d40fb) * debian/control: Versioned B-D on libXfont (>= 1.4.2). 2017-02-09 08:55:07 +0100 Tiago Vignatti (ec30a857e) * dix: use one single function to register fpe fonts 2017-02-08 13:57:42 +0100 Mike Gabriel (7bf444621) * nx-libs.spec: Handle fonts dir symlinking and install /usr/share/nx/fonts symlink into nxagent bin:pkg. This change probably needs more fine-tuning for the various other RPM distros and versions out there. 2017-02-05 21:35:33 +0000 Mike Gabriel (bd98ba2d7) * For consistency, apply patch from previous commit (630a7c3) to the original Xserver/dix/dixfonts.c file, although the code is undef'ed when NXAGENT_SERVER is defined. 2017-02-05 17:06:55 +0000 Mike Gabriel (d981d938d) * {dix/,hw/nxagent/NX}dixfont.{c,h}: Support using builtin-fonts. Makes dependency on X11's misc fonts package obsolete. 2017-02-05 21:04:46 +0000 Mike Gabriel (d8eac7cce) * Xserver/dix/main.c: ErrorF requires a string to end with an EOL char. 2017-02-05 19:34:33 +0000 Mike Gabriel (7866430ed) * debian/nx-x11-common.{links,dirs}: Make sure /usr/share/fonts/X11 are reachable for nxagent (via placing a symlink to /usr/share/nx/fonts). 2017-02-05 20:19:49 +0000 Mike Gabriel (6537f7ece) * Xserver/hw/nxagent/Font.c: Drop references to /usr/NX/share/fonts/base as default font path, entirely. 2017-02-05 20:18:13 +0000 Mike Gabriel (b11dd91a8) * Xserver/hw/nxagent/Font.c: Change (alternative) default font path order to make font path search compliant with latest FHS for X11 fonts (though, prefer /usr/share/nx/fonts as default path). 2017-02-05 19:54:40 +0000 Mike Gabriel (b816d361f) * Xserver/hw/nxagent/Font.c: Drop NXAGENT_ALTERNATE_FONT_PATH_4 (pointing to /usr/NX/share/fonts/base) entirely. 2017-02-05 19:19:44 +0000 Mike Gabriel (2161edef0) * nx-X11/config/cf/X11.tmpl: Set a more appropriate font directory (recommended: /usr/{,local/}share/nx/fonts). 2017-02-06 15:33:35 +0100 Mike Gabriel (628281ea9) * debian/patches: Update/rebase 016_nx-X11_install-location.debian.patch. 2017-02-06 14:30:03 +0100 Mike Gabriel (398e238ff) * nx-libs.spec: Drop non-shipped-anymore rgb(.txt) file from list of to-be-installed files. 2017-02-06 15:20:18 +0100 Mike Gabriel (41c79bfc6) * debian/nxagent.*: Drop conffile /etc/nxagent/rgb utilizing dpkg-maintscript-helper. 2017-02-06 15:19:47 +0100 Mike Gabriel (7e99ae375) * Xserver/os/oscolor.c: Follow X.org in dropping the rgb.txt file entirely. Content of that file is now hard-coded. 2017-02-24 22:22:47 +0000 Mike Gabriel (095ba65b0) * release 3.5.99.4 2017-02-19 00:06:54 +0100 Ulrich Sibiller (1d24554ff) * dix: fix incomplete commit 2017-02-15 09:59:00 +0100 Mike Gabriel (52c3c80d7) * Naming change: Security*Access -> Dix*Access 2017-02-17 12:43:06 +0000 Mike Gabriel (efc0dae05) * Switch from using libNX_X11's deprecated XKeycodeToKeysym() function to using XGetKeyboardMapping(). 2017-02-09 14:05:32 +0100 Mathieu Bérard (e70448087) * The smart scheduler is not optional. 2017-02-08 16:33:40 +0100 Mike Gabriel (f781b8e4c) * Makefile: Fix flawed uninstall-* targets. Spotted by Ionic while reviewing the nxagent RPATH changeset. Thanks! 2017-02-08 16:31:00 +0100 Mike Gabriel (29fee5b46) * debian/patches: Update comment header of 016_nx-X11_install-location.debian.patch. 2017-02-04 19:02:16 +0100 Mike Gabriel (d16caa78a) * debian/patches: Update 016_nx-X11_install-location.debian.patch. Adapt path to recent upstream changes. 2017-02-04 19:00:00 +0100 Mike Gabriel (0a7ef09c8) * Load libNX_X11 / faked libX11 via RPATH setting rather than fidgeting with LD_LIBRARY_PATH in the nxagent wrapper script. 2017-02-08 15:03:58 +0100 Mike Gabriel (6777fac08) * Makefile: Allow longer names for variables that we want to allow distro maintainers to override. 2017-02-04 18:54:21 +0100 Mike Gabriel (14e4005b2) * Makefile: Actively set/override USRLIBDIR and SHLIBDIR when calling Xserver's make process. 2017-02-04 18:53:25 +0100 Mike Gabriel (5d3c4dda7) * debian/rules: Don't manually override SHLIBDIR via the dh_auto_build call. The default in the main Makefile should work fine. 2017-02-04 18:52:56 +0100 Mike Gabriel (cfb097af0) * nx-libs.spec: Don't manually override SHLIBDIR via the .spec file. The default in the main Makefile should work fine. 2017-02-04 18:52:04 +0100 Mike Gabriel (1e1f1246b) * Makefile: Align variable names USRLIBDIR, SHLIBDIR (and NX_DIR) with nx-X11 internal naming schemes (and use /usr//nx/X11 rather than /usr//nx-X11). 2017-02-08 11:06:17 +0100 Mike Gabriel (af11c3123) * nx-X11/include/Xos_r.h: Drop one _POSIX_REENTRANT_FUNCTIONS macro block, where offenders AIXV3, AIXV4 and __osf__ are gone now. 2017-02-04 16:25:13 +0100 Daniel Stone (bf1b3c6cf) * dix: remove staggeringly broken vendor workarounds 2016-11-15 22:03:39 +0100 Mike Gabriel (8c1a21b45) * drop platform support: unifdef sgi. 2016-11-15 21:51:55 +0100 Mike Gabriel (5c3776d25) * drop platform support: unifdef QNX. 2016-11-15 21:41:57 +0100 Mike Gabriel (29401f29b) * drop platform support: unifdef DGUX. 2016-11-15 21:32:46 +0100 Mike Gabriel (0a9f9a951) * drop platform support: unifdef __osf__. 2016-11-15 21:20:22 +0100 Mike Gabriel (cc1350ace) * drop platform support: unifdef AIXV3, AIXV4 (and AIXrt, AIX386). 2016-11-15 20:59:35 +0100 Mike Gabriel (f6dcf2feb) * drop platform support: unifdef hpux and __hppa__. 2016-11-15 19:20:13 +0100 Mike Gabriel (19edfab78) * drop platform support: unifdef Lynx. 2016-11-15 18:41:52 +0100 Mike Gabriel (0f9a11a94) * drop platform support: unifdef __UNIXOS2__. 2017-02-08 21:43:45 +0100 Ulrich Sibiller (f22e873e6) * Screen.c: clean up superfluous whitespace 2017-02-08 21:13:38 +0100 Ulrich Sibiller (baf7a9267) * Screen.c: Ensure that an output is unused before destroying it 2017-02-05 19:16:54 +0000 Mike Gabriel (da82328b2) * nx-X11/config/cf/X11.tmpl: Fix DefaultRGBDatabase path to $(USRDATADIR)/rgb (not $(LIBDIR)/rgb). 2017-02-04 15:41:18 +0100 Mike Gabriel (ce153d401) * debian/copyright{,.in}: Adopt from Debian's upload candidate, being DEP-5 compliant and up-to-date for 3.5.99.3. 2017-02-27 13:11:33 +0100 Mike Gabriel (5e68c1283) * Merge branch 'sunweaver-pr/support-builtin-fonts' into 3.6.x 2017-02-27 11:20:38 +0100 Mike Gabriel (3e8d98f33) * nx-libs.spec: Add BR filesystem for SUSE builds (as it provides /usr/share/fonts). (gh-sunweaver/pr/support-builtin-fonts) 2017-02-14 09:35:32 +0000 Mike Gabriel (b981dd16f) * nx-libs.spec: Add BR for Fedora/RHEL builds: xorg-x11-font-utils. 2017-02-09 08:59:48 +0100 Mike Gabriel (6c9e3ebdb) * nx-libs.spec: Versioned BR on libXfont-devel (and alike) (>= 1.4.2). 2017-02-09 08:59:15 +0100 Mike Gabriel (6fd724366) * debian/control: Versioned B-D on libXfont (>= 1.4.2). 2017-02-09 08:55:07 +0100 Tiago Vignatti (cb760f14d) * dix: use one single function to register fpe fonts 2017-02-08 13:57:42 +0100 Mike Gabriel (899254993) * nx-libs.spec: Handle fonts dir symlinking and install /usr/share/nx/fonts symlink into nxagent bin:pkg. This change probably needs more fine-tuning for the various other RPM distros and versions out there. 2017-02-05 21:35:33 +0000 Mike Gabriel (2ba23b3bc) * For consistency, apply patch from previous commit (630a7c3) to the original Xserver/dix/dixfonts.c file, although the code is undef'ed when NXAGENT_SERVER is defined. 2017-02-05 17:06:55 +0000 Mike Gabriel (ed40c3db1) * {dix/,hw/nxagent/NX}dixfont.{c,h}: Support using builtin-fonts. Makes dependency on X11's misc fonts package obsolete. 2017-02-05 21:04:46 +0000 Mike Gabriel (82a7f72ca) * Xserver/dix/main.c: ErrorF requires a string to end with an EOL char. 2017-02-05 19:34:33 +0000 Mike Gabriel (8383b1925) * debian/nx-x11-common.{links,dirs}: Make sure /usr/share/fonts/X11 are reachable for nxagent (via placing a symlink to /usr/share/nx/fonts). 2017-02-05 20:19:49 +0000 Mike Gabriel (18794d26c) * Xserver/hw/nxagent/Font.c: Drop references to /usr/NX/share/fonts/base as default font path, entirely. 2017-02-05 20:18:13 +0000 Mike Gabriel (7e3bb3f19) * Xserver/hw/nxagent/Font.c: Change (alternative) default font path order to make font path search compliant with latest FHS for X11 fonts (though, prefer /usr/share/nx/fonts as default path). 2017-02-05 19:54:40 +0000 Mike Gabriel (66d9b3e8b) * Xserver/hw/nxagent/Font.c: Drop NXAGENT_ALTERNATE_FONT_PATH_4 (pointing to /usr/NX/share/fonts/base) entirely. 2017-02-05 19:19:44 +0000 Mike Gabriel (55854645c) * nx-X11/config/cf/X11.tmpl: Set a more appropriate font directory (recommended: /usr/{,local/}share/nx/fonts). 2017-02-27 04:08:51 +0100 Mihai Moldovan (0a5d26d12) * Merge branch 'sunweaver-pr/hard-code-rgb-colors' into 3.6.x 2017-02-06 15:33:35 +0100 Mike Gabriel (fff875549) * debian/patches: Update/rebase 016_nx-X11_install-location.debian.patch. (gh-sunweaver/pr/hard-code-rgb-colors) 2017-02-06 14:30:03 +0100 Mike Gabriel (0b3447540) * nx-libs.spec: Drop non-shipped-anymore rgb(.txt) file from list of to-be-installed files. 2017-02-06 15:20:18 +0100 Mike Gabriel (744e288d1) * debian/nxagent.*: Drop conffile /etc/nxagent/rgb utilizing dpkg-maintscript-helper. 2017-02-06 15:19:47 +0100 Mike Gabriel (f6a114027) * Xserver/os/oscolor.c: Follow X.org in dropping the rgb.txt file entirely. Content of that file is now hard-coded. 2017-02-24 22:22:47 +0000 Mike Gabriel (e1f2902bb) * release 3.5.99.4 (tag: 3.5.99.4) 2017-02-24 12:23:51 +0100 Mihai Moldovan (31426a3d2) * Merge branch 'uli42-fix_#306_#322' into 3.6.x 2017-02-19 00:06:54 +0100 Ulrich Sibiller (3d8575c21) * dix: fix incomplete commit 2017-02-20 10:33:52 +0100 Mihai Moldovan (3c322ffbb) * Merge branch 'sunweaver-pr/security-acl-naming-change' into 3.6.x 2017-02-15 09:59:00 +0100 Mike Gabriel (104a3e9e2) * Naming change: Security*Access -> Dix*Access (gh-sunweaver/pr/security-acl-naming-change) 2017-02-20 10:21:01 +0100 Mike Gabriel (c79f2d289) * Merge branch 'sunweaver-pr/use-xgetkeyboardMapping-instead-of-deprecated-xkeycodetokeysym' into 3.6.x 2017-02-17 12:43:06 +0000 Mike Gabriel (38ac74d6f) * Switch from using libNX_X11's deprecated XKeycodeToKeysym() function to using XGetKeyboardMapping(). (gh-sunweaver/pr/use-xgetkeyboardMapping-instead-of-deprecated-xkeycodetokeysym) 2017-02-18 10:24:21 +0100 Mihai Moldovan (73ec915bc) * Merge branch 'sunweaver-pr/smart-scheduler-is-not-optional' into 3.6.x 2017-02-09 14:05:32 +0100 Mathieu Bérard (6884e6a5b) * The smart scheduler is not optional. (gh-sunweaver/pr/smart-scheduler-is-not-optional) 2017-02-10 00:47:32 +0100 Mihai Moldovan (0a7df0770) * Merge branch 'sunweaver-pr/use-rpath-for-nxagent' into 3.6.x 2017-02-08 16:33:40 +0100 Mike Gabriel (99c130f15) * Makefile: Fix flawed uninstall-* targets. Spotted by Ionic while reviewing the nxagent RPATH changeset. Thanks! (gh-sunweaver/pr/use-rpath-for-nxagent) 2017-02-08 16:31:00 +0100 Mike Gabriel (52760b6e8) * debian/patches: Update comment header of 016_nx-X11_install-location.debian.patch. 2017-02-04 19:02:16 +0100 Mike Gabriel (a474b9f93) * debian/patches: Update 016_nx-X11_install-location.debian.patch. Adapt path to recent upstream changes. 2017-02-04 19:00:00 +0100 Mike Gabriel (ba620a054) * Load libNX_X11 / faked libX11 via RPATH setting rather than fidgeting with LD_LIBRARY_PATH in the nxagent wrapper script. 2017-02-08 15:03:58 +0100 Mike Gabriel (9d1da072c) * Makefile: Allow longer names for variables that we want to allow distro maintainers to override. 2017-02-04 18:54:21 +0100 Mike Gabriel (4c4d3dfba) * Makefile: Actively set/override USRLIBDIR and SHLIBDIR when calling Xserver's make process. 2017-02-04 18:53:25 +0100 Mike Gabriel (4a01be659) * debian/rules: Don't manually override SHLIBDIR via the dh_auto_build call. The default in the main Makefile should work fine. 2017-02-04 18:52:56 +0100 Mike Gabriel (0ae1fd5d3) * nx-libs.spec: Don't manually override SHLIBDIR via the .spec file. The default in the main Makefile should work fine. 2017-02-04 18:52:04 +0100 Mike Gabriel (c45cab1ba) * Makefile: Align variable names USRLIBDIR, SHLIBDIR (and NX_DIR) with nx-X11 internal naming schemes (and use /usr//nx/X11 rather than /usr//nx-X11). 2017-02-09 22:01:31 +0100 Mihai Moldovan (0a314adfa) * Merge branch 'sunweaver-pr/drop-support-for-ancient-platforms' into 3.6.x 2017-02-08 11:06:17 +0100 Mike Gabriel (029bae127) * nx-X11/include/Xos_r.h: Drop one _POSIX_REENTRANT_FUNCTIONS macro block, where offenders AIXV3, AIXV4 and __osf__ are gone now. (gh-sunweaver/pr/drop-support-for-ancient-platforms) 2017-02-04 16:25:13 +0100 Daniel Stone (7dae94814) * dix: remove staggeringly broken vendor workarounds 2016-11-15 22:03:39 +0100 Mike Gabriel (2d45d8d80) * drop platform support: unifdef sgi. 2016-11-15 21:51:55 +0100 Mike Gabriel (c6250a864) * drop platform support: unifdef QNX. 2016-11-15 21:41:57 +0100 Mike Gabriel (754e48ac0) * drop platform support: unifdef DGUX. 2016-11-15 21:32:46 +0100 Mike Gabriel (a9c30796d) * drop platform support: unifdef __osf__. 2016-11-15 21:20:22 +0100 Mike Gabriel (4b178918b) * drop platform support: unifdef AIXV3, AIXV4 (and AIXrt, AIX386). 2016-11-15 20:59:35 +0100 Mike Gabriel (184c5d778) * drop platform support: unifdef hpux and __hppa__. 2016-11-15 19:20:13 +0100 Mike Gabriel (ace255eda) * drop platform support: unifdef Lynx. 2016-11-15 18:41:52 +0100 Mike Gabriel (d12f95241) * drop platform support: unifdef __UNIXOS2__. 2017-02-08 22:34:53 +0100 Mike Gabriel (86a6a340f) * Merge branch 'uli42-pr/fix_#293' into 3.6.x 2017-02-08 21:43:45 +0100 Ulrich Sibiller (3790a28fe) * Screen.c: clean up superfluous whitespace (gh-uli42/pr/fix_#293, gh-sunweaver/uli42-pr/fix_#293) 2017-02-08 21:13:38 +0100 Ulrich Sibiller (184c07e24) * Screen.c: Ensure that an output is unused before destroying it 2017-02-06 21:57:50 +0100 Mihai Moldovan (083051f66) * Merge branch 'sunweaver-pr/fix-DefaultRGBDatabase-path' into 3.6.x 2017-02-05 19:16:54 +0000 Mike Gabriel (34889920c) * nx-X11/config/cf/X11.tmpl: Fix DefaultRGBDatabase path to $(USRDATADIR)/rgb (not $(LIBDIR)/rgb). (gh-sunweaver/pr/fix-DefaultRGBDatabase-path) 2017-02-04 15:41:18 +0100 Mike Gabriel (d6f475f67) * debian/copyright{,.in}: Adopt from Debian's upload candidate, being DEP-5 compliant and up-to-date for 3.5.99.3. 2017-02-04 15:22:20 +0100 Mike Gabriel (ff6126f44) * Xserver/randr: Regression fix introduced by c2b1f48. Re-introduce RegisterResourceName() calls after each CreateNewResourceType() call. (gh-sunweaver/pr/randr-regression-fix-re-adding-RegisterResourceName-calls) 2017-02-03 14:58:06 +0100 Mike Gabriel (1cd73ccb7) * Makefile: Don't create superfluous symlink for libX11.so -> ../libNX_X11.so. The libNX_X11.so is only required at build time, so need to use it for faking libX11.so in nxagent. 2017-02-03 14:40:19 +0100 Mike Gabriel (b0d28c8a6) * debian/changelog: Cosmetic fix, restoring correct version number for 3.5.99.2 release stanza. 2017-01-12 10:23:02 +0100 Mike Gabriel (93447eb2b) * Merge branch 'opoplawski-symlink' into 3.6.x (gh-sunweaver/pr/no-extra-mode-freeing-in-nxagentAdjustRandRXinerama) 2017-01-05 16:43:17 -0700 Orion Poplawski (f92820948) * Be consistent with macros 2017-01-05 16:35:34 -0700 Orion Poplawski (c392bc0a8) * Use Obsoletes instead of Conflicts. Drop unneeded %{?_isa} versions 2017-01-12 10:21:51 +0100 Mike Gabriel (42b136811) * Merge branch 'opoplawski-fedora' into 3.6.x 2017-01-11 15:19:24 -0700 Orion Poplawski (c9ab60e89) * Install missing libNX_X11.so.6 symlink - fixes gh-287 2017-01-05 16:43:17 -0700 Orion Poplawski (bdcc867e2) * Be consistent with macros 2017-01-05 16:35:34 -0700 Orion Poplawski (13f3bdc00) * Use Obsoletes instead of Conflicts. Drop unneeded %{?_isa} versions 2016-12-22 20:12:53 +0100 Mike Gabriel (7d845e7f4) * hw/nxagent/Init.c: Amend artifact in license header. 2016-12-22 15:30:07 +0100 Mike Gabriel (9c0d52807) * helper scripts: Add license headers to files. 2016-12-20 10:33:48 +0100 Mike Gabriel (b425f071e) * nxcomp: Fix artifacts in copyright headers. 2016-12-20 10:27:07 +0100 Mike Gabriel (8a8ec60cc) * nxcompext: Drop folder with .gitignore file. nxcompext has been moved into nxagent DDX. 2016-12-20 09:04:11 +0100 Mike Gabriel (02546c560) * roll-tarballs.sh: Adapt to recent changes in nx-libs, keep legacy support for older 3.6.x and 3.5.x releases. 2016-12-19 15:03:09 +0100 Mike Gabriel (9acd13e50) * release 3.5.99.3 (tag: 3.5.99.3) 2016-12-14 13:32:23 +0100 Mike Gabriel (8be276d27) * Merge branch 'theqvd-fix-loopback-bind' into 3.6.x 2016-12-13 12:00:43 +0100 Vadim Troshchinskiy (920f423a5) * Make nxagent only bind to loopback when requested 2016-12-14 10:57:39 +0100 Mike Gabriel (e466a9387) * Merge branch 'theqvd-fix-accept-host-message' into 3.6.x 2016-12-13 12:19:09 +0100 Vadim Troshchinskiy (77188865e) * Fix reversed logic in acceptHost setting 2016-12-10 21:49:10 +0100 Mike Gabriel (2b8f59261) * Merge branch 'uli42-pr/improve_xinerama_debug' into 3.6.x 2016-12-07 21:50:40 +0100 Ulrich Sibiller (6f3fb5248) * Screen.c: more debug output formatting improvements (gh-uli42/pr/improve_xinerama_debug, gh-uli42/pr/cherry_picks) 2016-12-07 21:17:26 +0100 Ulrich Sibiller (e14309892) * Screen.c: fix uninitalized variable 2016-12-07 21:15:59 +0100 Ulrich Sibiller (ce76009d2) * Screen.c: fix compile warnings in DEBUG mode 2016-12-07 21:42:03 +0100 Ulrich Sibiller (6882b08d8) * Screen.c: fix formatting 2016-12-07 20:18:09 +0100 Ulrich Sibiller (c806956c2) * Screen.c: improve debugging output 2016-12-05 10:26:28 +0000 Mike Gabriel (5bdb2fcdf) * debian/control: B-D alternatively on libxfont1-dev or libxfont-dev. Fix FTBFS on Debian stretch which has libxfont2-dev as default now. 2016-12-04 21:45:33 +0100 Mike Gabriel (c893ad65c) * Merge branch 'sunweaver-pr/drop-glx-ansic' into 3.6.x 2016-11-02 20:30:07 +0100 Mike Gabriel (4e33fd4be) * Mesa: Convert some files with MSDOS EOL style to Unix EOL style. (gh-sunweaver/pr/drop-glx-ansic) 2016-11-01 21:30:22 +0100 Kristian Høgsberg (4146d1aa7) * Drop xf86glx.h, so we can finally drop Xserver/GL/include/ entirely. 2016-10-31 15:06:37 +0100 Kristian Høgsberg (cee997dac) * Drop glx_ansic.h wrapper and call malloc, realloc, free and str-funcs directly. 2016-12-04 21:14:24 +0100 Mike Gabriel (b38d5b97d) * Merge branch 'sunweaver-pr/extmod-xfree86loader-cleanup' into 3.6.x 2016-10-29 11:28:02 +0200 Eric Anholt (508d2deae) * Remove libcwrapper usage from xorg server modules. The libcwrapper is not used in nxagent. (gh-sunweaver/pr/extmod-xfree86loader-cleanup) 2016-12-04 21:09:52 +0100 Mike Gabriel (62f8e50e7) * Merge branch 'uli42-pr/compilation_fixes_and_debug_improvements' into 3.6.x 2016-12-03 23:31:26 +0100 Ulrich Sibiller (b0106e75a) * slightly improve rrxinerama debug output (gh-uli42/pr/compilation_fixes_and_debug_improvements, uli42-pr/compilation_fixes_and_debug_improvements) 2016-12-03 23:06:32 +0100 Ulrich Sibiller (c5e06d408) * Fix compilation warnings 2016-11-30 08:13:54 +0100 Mike Gabriel (a0a429cc7) * Update auto-generated debian/copyright.in. 2016-11-18 00:07:19 +0100 Mike Gabriel (cb8af80ae) * .gitignore: Don't ignore myself. 2016-11-18 00:06:30 +0100 Mike Gabriel (edeca4aff) * Merge branch 'uli42-pr/gitignore' into 3.6.x 2016-11-03 23:53:46 +0100 Ulrich Sibiller (7993d28f1) * add .gitignore files (gh-uli42/pr/gitignore) 2016-11-17 20:49:53 +0100 Mike Gabriel (1f6070437) * Merge branch 'uli42-pr/remove_xlibi18n' into 3.6.x 2016-11-04 00:25:25 +0100 Ulrich Sibiller (de4eca171) * LibX11: drop unused xlibi18n (gh-uli42/pr/remove_xlibi18n) 2016-11-15 17:06:18 +0100 Mike Gabriel (cb8bcbec8) * Merge branch 'sunweaver-pr/testscripts-file-headers' into 3.6.x 2016-11-07 12:32:09 +0100 Mike Gabriel (00725f16a) * testscripts: Use non-NoMachine file headers for our testscripts. 2016-11-15 17:02:11 +0100 Mike Gabriel (91d06723b) * New helper script: regenerate-symbol-docs.sh. Plus update symbols usage of libNX_X11 and nxcompext in nxagent, nxcompext and libNX_X11. 2016-11-15 16:42:39 +0100 Mike Gabriel (8c5a1b071) * Merge branch 'sunweaver-pr/move-nxcompext-into-Xserver' into 3.6.x 2016-11-09 16:45:47 +0100 Mike Gabriel (9ad0aae5d) * Xserver/Imakefile: Some whitespace fixes. (gh-sunweaver/pr/move-nxcompext-into-Xserver) 2016-11-03 00:19:26 +0100 Mike Gabriel (80b5de3f5) * nxcompext: Move code into Xserver subtree, as nxcompext requires Xserver includes at build time. 2016-11-03 08:30:49 +0100 Mike Gabriel (cae394b45) * Xserver/hw/nxagent/Imakefile: Introduce the NULL variable. 2016-11-08 08:00:44 +0100 Mihai Moldovan (b1d3f2ca5) * Merge branch 'uli42-pr/keyboard_fixes' into arctica-3.6.x 2016-10-27 01:00:23 +0200 Ulrich Sibiller (2f2ade61a) * Keyboard.c: evdev is only existing on Linux (gh-uli42/pr/keyboard_fixes) 2006-10-02 20:58:33 +0300 Daniel Stone (926e90abc) * xkb: remove the world's most staggeringly broken vendor workaround 2016-10-26 11:01:57 +0200 Ulrich Sibiller (08ed062c4) * Keyboard.c: move variable to inner scope 2016-10-26 10:39:37 +0200 Ulrich Sibiller (d37f9f311) * Reconnect.c: simplify code by using strndup 2016-10-25 23:40:13 +0200 Ulrich Sibiller (e52799d5c) * Keyboard.c: replace malloc/strcpy by str(n)dup 2016-10-25 22:59:35 +0200 Ulrich Sibiller (718c5b9f1) * Keyboard.c: more whitespace/formatting fixes 2016-10-25 22:53:39 +0200 Ulrich Sibiller (b5cc3c94e) * Keyboard.c: improve keyboard file creation 2016-10-25 22:53:07 +0200 Ulrich Sibiller (52848b785) * Keyboard.c: use NULL instead of 0 2016-10-25 22:52:43 +0200 Ulrich Sibiller (3ea601bcb) * Keyboard.c: remove superfluous whitespace 2016-10-25 21:50:11 +0200 Ulrich Sibiller (2901aca36) * Keyboard.c: Fix wrong error msg prefix 2016-10-25 21:41:11 +0200 Ulrich Sibiller (2f7f39b49) * Keyboard.c: Fix and simplify keyboard config file handling 2016-10-25 21:40:10 +0200 Ulrich Sibiller (8793e362b) * Improve DEBUG/TEST output regarding keyboard stuff 2016-10-25 21:39:24 +0200 Ulrich Sibiller (e3ac55bc2) * Drop unused define NXAGENT_KEYMAP_DIR_FILE 2016-11-05 05:20:31 +0000 Mihai Moldovan (7b79e8d83) * Makefile: fix up a9b145d4. 2016-11-05 05:18:06 +0000 Mihai Moldovan (c7e01938d) * nx-X11/lib/X11/Imakefile: essentially revert 5a90a63. 2016-11-04 14:19:07 +0100 Vadim Troshchinskiy (e5091e002) * Added sample slave agent and test script 2016-11-03 22:51:56 +0100 Mihai Moldovan (53d304ef7) * Merge branch 'sunweaver-pr/drop-fbmmx' into arctica-3.6.x 2016-10-29 14:23:58 +0200 Mike Gabriel (f5c5cb10f) * Xserver/fb: Drop fbmmx.[ch] files and code passages wrapped-in by USE_MMX macro. (gh-sunweaver/pr/drop-fbmmx) 2016-10-29 14:23:25 +0200 Mike Gabriel (89e1457d1) * Xserver/fb/Imakefile: Introduce NULL variable. 2016-11-03 09:36:23 +0100 Mike Gabriel (d12b77543) * Merge branch 'uli42-pr/libX11_xtrans_silence_compiler_warnings' into 3.6.x 2016-11-02 23:57:43 +0100 Ulrich Sibiller (47fab08aa) * xtrans: fix const warnings for SocketConnectConnInfo (gh-uli42/pr/libX11_xtrans_silence_compiler_warnings) 2016-11-02 23:55:23 +0100 Ulrich Sibiller (882c034c3) * xtrans: silence compiler warning regarding is_numeric 2016-11-02 23:37:30 +0100 Ulrich Sibiller (90612d25c) * libX11 + Xserver: fix missing define warning 2016-11-02 23:36:50 +0100 Ulrich Sibiller (2631603b6) * xtrans: Fix compile warning 2016-11-02 23:14:52 +0100 Ulrich Sibiller (5d06f46e5) * xtrans: fix compilation warnings because of missing XTRANS_SEND_FDS 2016-11-02 19:59:23 +0100 Mike Gabriel (8dc0d18c1) * debian/libnx-x11-6.symbols: Update after upgrade of xtrans library files. 2016-11-02 19:50:24 +0100 Mike Gabriel (107e72b03) * Merge branch 'uli42-pr/upgrade_xtrans' into 3.6.x 2016-11-02 11:48:23 +0100 Ulrich Sibiller (6a186b921) * Whitespace fixes 2016-10-31 02:29:18 +0100 Ulrich Sibiller (e65b106a8) * Xtrans: update to Xorg/xtrans upstream (1.3.5+) 2016-10-13 21:53:17 +0200 Ulrich Sibiller (793d587b4) * Remove __UNIXOS2__ references 2016-05-18 12:38:02 -0400 Adam Jackson (603fe2554) * remove CLTS code 2016-10-13 19:08:37 +0200 Ulrich Sibiller (247e1f72e) * use %p in format strings 2016-10-13 00:51:03 +0200 Ulrich Sibiller (c3f43e832) * replace PRMSG by prmsg 2016-10-13 00:35:04 +0200 Ulrich Sibiller (c4b775f6d) * align license headers with Xorg/xtrans upstream 2016-10-13 00:31:51 +0200 Ulrich Sibiller (6957b3daa) * move helper functions to file end 2008-02-10 19:04:40 -0800 Jeremy Huddleston (f686bc3eb) * Fixed #ifdef checks that were using i386 to use __i386__ 2016-10-13 00:16:30 +0200 Ulrich Sibiller (64d51869f) * whitespace cleanup 2008-08-07 10:32:11 -0400 Adam Jackson (e5b4532ab) * Drastically simplify TRANS_OPEN_MAX. 2016-10-12 22:28:41 +0200 Ulrich Sibiller (0ca6e5999) * undef __QNX__ 2016-10-12 22:27:34 +0200 Ulrich Sibiller (4ab02b27c) * undef Lynx 2016-10-12 22:47:36 +0200 Ulrich Sibiller (89cea600a) * undef AIXV3 2016-10-12 22:44:21 +0200 Ulrich Sibiller (eb4ee6c32) * undef hpux 2016-10-12 22:24:09 +0200 Ulrich Sibiller (175a3416e) * undef __UNIXOS2__ 2016-10-12 22:05:26 +0200 Ulrich Sibiller (97d651fcf) * Remove OS2PIPECONN transport 2016-10-12 21:33:00 +0200 Ulrich Sibiller (0cbc89221) * Remove unused TLI ("STREAMSCONN") code 2016-10-12 21:06:36 +0200 Ulrich Sibiller (b5bfd3a49) * remove DECnet support 2016-11-02 19:38:08 +0100 Mike Gabriel (a9b145d46) * Makefile: Make sure libNX_X11.so.6.2 does not get installed as symlink but as actual file. (Follow-up for 5a90a63). 2016-11-02 17:54:24 +0100 Mike Gabriel (1d1d1fc21) * Merge branch 'pr/unused_files' into 3.6.x 2016-10-30 19:05:56 +0100 Ulrich Sibiller (7d884049b) * remove unused mkks.sh 2016-10-30 19:02:36 +0100 Ulrich Sibiller (bac5ce7b5) * remove unused jump_* files from libX11 2016-10-30 18:54:04 +0100 Ulrich Sibiller (331497b88) * drop unused xtest1.frags 2016-10-30 18:48:31 +0100 Ulrich Sibiller (6b9ce7da4) * remove unused fb24_32.h 2016-10-30 18:47:04 +0100 Ulrich Sibiller (a29a2b656) * remove unused registry.h 2016-10-30 18:43:38 +0100 Ulrich Sibiller (89f9212ef) * remove unused XInput.h 2016-10-30 18:40:10 +0100 Ulrich Sibiller (881979bd1) * Remove unused Xv and XvMC headers 2016-10-30 18:01:11 +0100 Ulrich Sibiller (ba87cf406) * drop unused glu.h 2016-10-30 17:58:59 +0100 Ulrich Sibiller (903d5ce8a) * drop ap_keysym.h 2016-10-30 17:55:53 +0100 Ulrich Sibiller (1832ab62f) * remove unused registry file 2016-10-30 17:54:46 +0100 Ulrich Sibiller (b7daac272) * remove *-def.cpp 2016-10-29 23:26:05 +0200 Ulrich Sibiller (4271b9ebd) * nxcomp: remove unused Utils.cpp 2016-10-29 22:52:53 +0200 Ulrich Sibiller (96c9aafd6) * Imake: drop DoLoadableServer, MakeDllModules and IHaveModules 2016-10-29 11:18:41 +0200 Mike Gabriel (8dab7c21d) * Remove extmod from nx-X11/programs/Xserver/Xext/. 2016-11-02 17:53:15 +0100 Mike Gabriel (6eb8d3ec6) * Merge branch 'uli42-pr/add_libX11_links' into 3.6.x 2016-10-28 23:38:17 +0200 Ulrich Sibiller (5a90a638f) * libX11/Imakefile: handle libX11 links 2016-10-28 23:37:17 +0200 Ulrich Sibiller (f1d420baa) * libX11/Imakefile: add missing dependencies on ks_tables.h 2016-10-31 12:44:52 +0100 Mike Gabriel (4c59a3c58) * Merge branch 'sunweaver-pr/clean-up-old-vcs-comments' into 3.6.x 2016-10-29 15:30:20 +0200 Mike Gabriel (fcf61d341) * Imakefile cleanup: Delete all ancient Vcs comments stemming from SVN times of X.org and XFree86. 2016-10-30 23:52:44 +0100 Mike Gabriel (6b3080d54) * Merge branch 'sunweaver-pr/drop-mfb-maskbits-h' into 3.6.x 2016-10-30 21:36:53 +0100 Mike Gabriel (b99c78721) * Xserver/Imakefile: Drop references to already removed afb code. (gh-sunweaver/pr/drop-mfb-maskbits-h) 2016-10-30 21:36:03 +0100 Mike Gabriel (65e25bd47) * Xserver/Imakefile: Drop all references to building already removed cfb* implementations. 2016-10-30 20:16:53 +0100 Adam Jackson (cc0350202) * Death to mfb (removing last remnants from NX code). 2016-10-30 18:31:54 +0100 Adam Jackson (3c0e426f0) * Disinfect mi/ of mfb. 2016-10-30 14:32:04 +0100 Mike Gabriel (23c66f400) * Merge branch 'sunweaver-pr/drop-nxlibint-h' into 3.6.x 2016-10-30 13:11:38 +0100 Mike Gabriel (1ddbe39ad) * nxcompext: Drop (nowadays) no-op file NXlibint.h. (gh-sunweaver/pr/drop-nxlibint-h) 2016-10-30 14:25:57 +0100 Mike Gabriel (23ad270b5) * Merge branch 'uli42-misc_fixes' into 3.6.x 2016-10-30 13:46:11 +0100 Ulrich Sibiller (16947012d) * nxagent.keyboard: add quotes 2016-10-30 13:45:33 +0100 Ulrich Sibiller (903cc0657) * Imakefile: remove references to non-existing subdirs 2016-10-30 02:32:35 +0200 Ulrich Sibiller (162a627c4) * saver.c: fix unused variable warnings 2016-10-29 10:32:51 +0200 Mike Gabriel (a375d178f) * Merge branch 'sunweaver-pr/build-includes-robustness' into 3.6.x 2016-10-28 15:19:10 +0200 Mike Gabriel (2f2a5a920) * Imake.rules: Make BuildIncludes{,Top}() more robust in case people attempt providing path names instead of file names via srclist. (gh-sunweaver/pr/build-includes-robustness) 2016-10-29 10:30:27 +0200 Mike Gabriel (ecd335fa6) * Merge branch 'uli42-pr/remove_xf86' into 3.6.x 2016-10-28 01:05:03 +0200 Ulrich Sibiller (4aeed7ad9) * remove hw/xfree86 altogether 2016-10-28 00:30:25 +0200 Ulrich Sibiller (6c7f9cdaa) * remove xf86Version.h and xf86Date.h 2016-10-28 14:51:52 +0200 Mike Gabriel (4cdcd9145) * debian/patches: Rebase 102_xserver-xext_set-securitypolicy-path.debian.patch. 2016-10-28 14:48:25 +0200 Mike Gabriel (c9da511cf) * Merge branch 'theqvd-slave-channel' into 3.6.x 2016-10-24 13:27:52 +0200 Vadim Troshchinskiy (c7eac1f95) * Add description of NX_SLAVE_CMD to man and help 2016-10-18 09:19:28 +0200 Vadim Troshchinskiy (30af52eb3) * Slave channel implementation 2016-10-28 05:42:02 +0200 Mihai Moldovan (a5de79181) * Merge branch 'uli42-pr/backup_memleak' into arctica-3.6.x 2016-10-25 21:30:15 +0200 Emilio Pozuelo Monfort (8d1126e97) * Plug a memory leak 2016-10-20 22:56:41 +0200 Mike Gabriel (5d4a7e071) * debian/rules: Re-enable (+pie) hardening flags again when building .deb packages. 2016-10-20 10:31:24 +0200 Mike Gabriel (61b8d44f1) * Merge branch 'uli42-pr/fix_compile_warnings' into 3.6.x 2016-10-20 00:15:20 +0200 Ulrich Sibiller (50eb5e4a9) * sendexev.c: Fix return of unitialized variable 2011-05-24 18:33:17 +0200 Cyril Brulebois (151e0b16d) * xfixes: Remove unused variable. 2006-02-14 08:11:41 +0000 Benjamin Herrenschmidt (c26621610) * Remove useless line of code that contained a bug and triggered a gcc warning. This variable will be overriden before being used anyway. (Bugzilla #5595) 2009-01-11 08:25:17 +0100 Julien Cristau (4f99f854c) * dix: fix cast from pointer to integer 2014-12-09 09:30:57 -0800 Keith Packard (e3e4062c3) * dbe: Call to DDX SwapBuffers requires address of int, not unsigned int [CVE-2014-8097 pt. 2] 2016-10-19 21:58:06 +0200 Ulrich Sibiller (01eaab831) * LRGB.c: Fix label defined but not used 2016-06-04 17:19:59 +0200 walter harms (ddc5ed4c9) * Fixes: warning: variable 'req' set but not,used 2016-04-26 16:31:27 +0200 walter harms (21405f62b) * fix: warning: pointer targets in passing argument 2 of '_XSend' differ in signedness [-Wpointer-sign] 2016-04-26 16:34:11 +0200 walter harms (3f9ebf33d) * no need to check args for Xfree() 2016-04-26 16:23:46 +0200 walter harms (897b8b28b) * remove stray extern 2016-10-16 02:15:13 +0200 Ulrich Sibiller (2c59fbe30) * Fix warnings in XlibInt.c 2016-10-16 00:41:11 +0200 Ulrich Sibiller (0a28292ec) * xkb.c: fix 'assignment makes integer from pointer without a cast' 2016-10-16 00:19:47 +0200 Ulrich Sibiller (057ddde08) * xkmread.c: use _X_UNUSED to avoid compiler warning when result is not needed 2016-10-16 00:07:21 +0200 Ulrich Sibiller (33b5911f2) * xcmisc.c: remove HAVE_STDINT 2016-10-16 00:02:41 +0200 Ulrich Sibiller (c180a2147) * security.c: fix compiler warnings 2016-10-15 23:01:59 +0200 Ulrich Sibiller (185fbdaf9) * Loop.cpp: Fix output of SetCore() 2016-10-15 22:02:06 +0200 Ulrich Sibiller (d238db344) * Window.c: Fix function assignment warning 2016-10-15 21:45:30 +0200 Ulrich Sibiller (81a7c6cf4) * Display.c: remove unused variable 2016-10-15 21:42:54 +0200 Ulrich Sibiller (54b7561f9) * Colormap.c: add cast to avoid warning 2016-10-15 21:41:03 +0200 Ulrich Sibiller (3c5621c37) * Args.c: fix string format warning 2016-10-15 18:21:48 +0200 Ulrich Sibiller (e3c9bc392) * imLcIm.c: Fix unused variables 2016-10-15 18:03:18 +0200 Ulrich Sibiller (babaf67c9) * Pending.c: Fix compilation warning 2016-10-15 17:51:11 +0200 Ulrich Sibiller (ae8ec6b14) * Fix libX11 implicit declaration warnings 2016-10-20 10:08:14 +0200 Mike Gabriel (da01dc8da) * Drop nx-X11/lib/X11/libX11.elist. Not needed for anything nowadays. Probably never was needed in nx-X11. 2016-10-20 09:58:37 +0200 Mike Gabriel (44c76cacf) * debian/libnx-x11-6.symbols: Update symbols list. 2016-10-20 09:52:45 +0200 Mike Gabriel (a559592dc) * XKeysymDB: ... got removed. 2016-10-19 22:15:01 +0200 Mike Gabriel (70ac75f4a) * Merge branch 'uli42-pr/libX11_further_backports' into 3.6.x 2016-09-25 21:25:25 +0200 Tobias Stoeckmann (70e9d346f) * Validation of server responses in XGetImage() 2016-09-25 21:22:57 +0200 Tobias Stoeckmann (b17557f9f) * The validation of server responses avoids out of boundary accesses. 2016-02-06 14:18:32 -0800 Alan Coopersmith (68e3ee67c) * xcms: use size_t for pointer offsets passed to strncmp 2016-02-06 13:32:44 -0800 Alan Coopersmith (8d8d5cfd8) * xcms: use unsigned indexes when looping through unsigned values 2016-02-06 13:01:25 -0800 Alan Coopersmith (327d2cc60) * xcms: use size_t for strlen/sizeof values instead of converting to int & back 2015-03-26 07:52:58 +0100 Dominik Muth (de4047722) * Xlib.h: Fix macros imitating C functions. 2016-01-21 11:54:19 +0100 Olivier Fourdan (a3759f323) * XKB: fix XkbGetKeyboardByName with Xming server 2015-12-19 18:03:41 -0800 Alan Coopersmith (50192b720) * lcPubWrap: replace malloc(strlen) + strcpy with strdup 2015-12-19 10:21:04 -0800 Alan Coopersmith (7a1fc1759) * XlcDL.c: reduce code duplication 2015-12-19 10:19:25 -0800 Alan Coopersmith (c9ebd122f) * XlcDL.c: replace strcpy+strcat sequences with snprintf 2015-12-19 10:05:42 -0800 Alan Coopersmith (2874fd14b) * XDefaultOMIF: Remove comments referring to ancient Sun bug ids 2015-12-19 10:00:22 -0800 Alan Coopersmith (d980be3c2) * XDefaultOMIF: additional code simplification 2015-12-19 09:46:31 -0800 Alan Coopersmith (c00196d2d) * XDefaultOMIF: replace strlen+Xmalloc+strcpy with strdup 2015-12-19 09:20:55 -0800 Alan Coopersmith (f7254c69f) * Use strdup instead of Xmalloc+strcpy in _XDefaultOpenIM 2015-12-04 22:20:53 -0800 Alan Coopersmith (b912a4042) * Delete #if 0 hunks of code 2015-12-03 23:38:07 -0800 Alan Coopersmith (9dec6c18b) * Bug 93183: _XDefaultOpenIM memory leaks in out-of-memory error paths 2015-12-03 23:19:48 -0800 Alan Coopersmith (8d6d95d74) * Bug 93184: read_EncodingInfo invalid free 2015-11-28 13:18:11 -0800 Alan Coopersmith (8339e6803) * Remove unused definition of XCONN_CHECK_FREQ 2015-09-27 18:38:32 -0700 Alan Coopersmith (f857c70f8) * Get rid of some extraneous ; at the end of C source lines 2015-07-19 10:22:45 +0200 Thomas Klausner (fc524ddbb) * Do not return() after exit(). 2015-05-18 14:49:01 +0100 Ross Burton (1445735ef) * Add missing NULL checks to ICWrap 2015-06-04 20:51:17 -0700 Alan Coopersmith (39dd37d57) * Replace Xmalloc+memset pairs with Xcalloc calls 2015-06-04 19:07:12 -0700 Bhavi Dhingra (a402ed016) * omGeneric.c: Correct the parameter usage of sizeof 2015-05-19 12:30:22 +1000 Peter Hutterer (73f2d66e0) * Fix three "use of uninitialized variable" coverity warnings 2015-05-18 07:55:17 +1000 Peter Hutterer (e14489988) * Fix potential memory leak 2015-02-03 13:23:50 -0500 Ran Benita (8e3e7bb77) * compose: fix the description of modifiers in compose sequences 2014-07-11 10:34:08 -0700 Alan Coopersmith (0f1fa85fe) * Use C99 named initializers to fill in events passed to XSendEvent 2014-07-06 11:13:49 -0700 Alan Coopersmith (f20f91ee8) * Fix validation of ctrls parameter to XkbGetPerClientControls() 2014-07-06 10:54:57 -0700 Alan Coopersmith (37b8d6883) * Fix map->num_types check in XkbAddKeyType() 2014-06-07 12:03:17 +0200 walter harms (aa7053b3e) * lcDefConv.c: fix use before check 2014-06-07 11:54:34 +0200 walter harms (dd6dc2ddf) * rm redundant null checks 2014-06-07 15:17:27 +0200 walter harms (a98260726) * libX11: rm redundante NULL checks 2014-06-06 22:53:05 +0200 walter harms (1ff696123) * Remove more redundant null checks before Xfree() 2014-06-05 18:37:40 +0200 walter harms (fc26b97ea) * Remove redundant null checks before free 2014-06-04 17:12:31 +0200 walter harms (191d1575f) * libX11/lcUTF8.c fix: dereferenced before check 2014-06-04 17:10:20 +0200 walter harms (861fe5aee) * libX11/XKBNames.c fix: dereferenced before check 2014-06-04 17:08:12 +0200 walter harms (e7528f581) * libX11/lcGenConv.c fix: dereferenced before check 2014-05-09 18:21:05 -0400 Owen W. Taylor (afc7138f9) * Fix XNextRequest() after direct usage of XCB 2014-02-11 13:26:16 +0200 Ran Benita (88d496598) * Remove dead USE_OWN_COMPOSE-protected code 2014-02-06 13:48:08 -0800 Alan Coopersmith (3e8df1a2e) * Fix typos in Xrm.c comments 2013-12-26 09:26:13 -0800 Alan Coopersmith (101419b10) * _XkbReadGeomOverlay: check for NULL first, then use pointer 2013-12-26 09:22:49 -0800 Alan Coopersmith (1b0df5da6) * XkbSelectEventDetails: remove unnecessary assignments 2010-10-07 18:46:08 +0100 Jon TURNEY (4fad46e9c) * Don't try so hard to find a matching font with the given encoding 2013-12-02 21:51:27 -0800 Alan Coopersmith (f45ac4ae3) * unifdef -UISC 2013-11-16 20:21:54 -0800 Alan Coopersmith (35dc4784b) * Drop X_LOCALE fallback for OS'es without setlocale() 2013-08-24 17:27:43 -0700 Alan Coopersmith (f04e1a6d1) * Bug 68413 - [Bisected]Error in `xterm': realloc(): invalid next size 2013-08-16 21:04:02 -0700 Alan Coopersmith (ba86b7a2e) * Stop checking for HAVE_DIX_CONFIG_H on the client side 2013-08-16 18:27:28 -0700 Alan Coopersmith (2824899d2) * Rearrange some variable declarations & initializations in XKB 2013-08-11 13:29:33 -0700 Alan Coopersmith (3c5880e72) * Reindent XKB code to X.Org standard style 2013-08-16 18:14:14 -0700 Alan Coopersmith (3cd822526) * Fix overflow checks in _XkbReadKeySyms when key_sym_map is already created 2013-08-11 17:02:21 -0700 Alan Coopersmith (c22524d30) * Remove long unused udcInf.c 2013-08-11 00:07:33 -0700 Alan Coopersmith (26256188b) * Remove unnecessary casts of pointers to (char *) in calls to Xfree() 2013-08-10 23:57:55 -0700 Alan Coopersmith (d33cf0446) * Don't cast sizeof() results to unsigned when passing to Xmalloc/Xcalloc 2013-08-10 23:51:08 -0700 Alan Coopersmith (c161df4fe) * Remove even more casts of return values from Xmalloc/Xrealloc 2013-08-10 23:05:13 -0700 Alan Coopersmith (5d6cda4f6) * xlibi18n: fix argsize argument to _XlcParsePath 2013-08-10 22:32:42 -0700 Alan Coopersmith (069c1f4d5) * i18n modules: Fix some const cast warnings 2013-08-10 22:21:54 -0700 Alan Coopersmith (d8358c6ef) * xlibi18n: Fix a bunch of const cast warnings 2013-08-10 22:18:00 -0700 Alan Coopersmith (e667b9054) * Fix const handling in XSetLocaleModifiers 2013-08-10 21:46:37 -0700 Alan Coopersmith (d2671c285) * Constify lc_name argument to _XlcLocaleDirName() & _XlcLocaleLibDirName() 2013-08-10 13:37:53 -0700 Alan Coopersmith (22377a799) * init_om: remove unneeded extra copy of string to local buffer 2013-08-10 12:34:53 -0700 Alan Coopersmith (92591316d) * Delete unused XKB_INSURE_SIZE macro from XKBlibint.h 2013-08-10 12:19:17 -0700 Alan Coopersmith (be32fbb31) * miRegionOp(): ensure region size is not updated if realloc fails 2013-08-10 12:19:17 -0700 Alan Coopersmith (ad51fbdb4) * miRegionCopy(): handle realloc failure better 2013-08-10 11:27:22 -0700 Alan Coopersmith (105cd4711) * Avoid memory leak/corruption if realloc fails in Xregion.h:MEMCHECK macro 2013-08-10 12:07:51 -0700 Alan Coopersmith (180991ce2) * Avoid memory leak/corruption if realloc fails in imLcPrs.c:parseline() 2013-08-10 12:30:39 -0700 Alan Coopersmith (7156a20bc) * lcDB.c: ensure buffer size is updated correctly if realloc fails 2013-08-10 11:07:47 -0700 Alan Coopersmith (0574a55eb) * Avoid memory leak/corruption if realloc fails in XlcDL.c:resolve_object() 2013-08-09 23:33:03 -0700 Alan Coopersmith (a6d9409b0) * omGeneric.c: convert sprintf calls to snprintf 2013-08-09 23:30:30 -0700 Alan Coopersmith (d03ab1de0) * ximcp/imRm.c: convert sprintf calls to snprintf 2013-08-09 23:02:12 -0700 Alan Coopersmith (a1b0fdb2c) * xlibi18n: convert sprintf calls to snprintf 2013-08-09 23:02:12 -0700 Alan Coopersmith (bde3d8b14) * lcfile: skip over any null entries in args list 2013-08-09 22:00:09 -0700 Alan Coopersmith (7bca34528) * Fix file leak on malloc error in XlcDL.c:resolve_object() 2012-12-18 15:28:05 +0000 ISHIKAWA,chiaki (ce482d4fd) * Fix bogus timestamp generated by XIM 2011-06-16 17:28:39 +0200 Egbert Eich (ed53aca1d) * XIM: Fix race on focus change: set 'FABRICATED' only when keyev filters in place. 2013-07-27 01:03:18 -0700 Alan Coopersmith (adcf3894a) * omGeneric: remove space between struct name & member name 2013-07-23 22:11:34 -0700 Alan Coopersmith (6d64c4164) * XSetModifierMapping: Use Data instead of GetReqExtra 2013-06-09 11:13:42 -0700 Kees Cook (ea8239650) * libX11: check size of GetReqExtra after XFlush 2013-06-25 22:35:29 +0200 Thomas Klausner (39c6e5aa8) * Tighten out-of-range comparisons. 2013-06-25 18:34:32 +0200 Thomas Klausner (ac3d26251) * Fix out-of-range comparison in _XF86BigfontQueryFont 2013-06-25 18:33:56 +0200 Thomas Klausner (61fdf93ef) * Check for symbol existence with #ifdef, not #if 2013-06-25 18:31:32 +0200 Thomas Klausner (d122d7545) * Stop truncating source to destination length if it is larger. 2013-06-24 23:02:05 -0700 Alan Coopersmith (88edf8083) * Require ANSI C89 pre-processor, drop pre-C89 token pasting support 2016-10-08 00:20:48 +0200 Ulrich Sibiller (7f98ab03b) * update Xfuncproto.h 2016-10-07 23:46:05 +0200 Ulrich Sibiller (e2e45b2b3) * Align files with upstream libX11-1.6.0 2012-12-16 17:44:42 -0800 Alan Coopersmith (878040bf0) * Tell clang not to report -Wpadded warnings on public headers we can't fix 2010-09-08 10:44:23 -0400 Adam Jackson (9b5f99c37) * Zero buffer data in BufAlloc() 2011-01-31 14:02:10 +0200 Erkki Seppälä (13fe4d475) * GetProp: Zero-initialized error so its resourceID field is initialized 2013-03-01 18:37:37 -0800 Alan Coopersmith (7992a9873) * integer overflow in ReadInFile() in Xrm.c [CVE-2013-1981 7/13] 2011-01-31 14:01:58 +0200 Erkki Seppälä (78b0ca2fe) * ximcp/imRmAttr: Handle leaking colormap_ret 2011-02-21 15:56:54 +0100 Samuel Thibault (b00312f5d) * Fix status reporting for braille patterns 2016-10-07 22:16:24 +0200 Ulrich Sibiller (a2fded2e3) * Revert incomplete "Fix status reporting for braille patterns" 2010-09-03 23:11:53 -0700 Alan Coopersmith (bd43a0640) * Sun's copyrights are now owned by Oracle 2016-10-07 21:16:39 +0200 Ulrich Sibiller (5dbcf1987) * Assume size_t is always available, since it was defined in C89 2016-10-07 21:00:20 +0200 Ulrich Sibiller (1078f9770) * rename xf86bigfstr.h to xf86bigfproto.h 2013-06-02 11:49:54 -0700 Thomas Klausner (e03d8c215) * cmsMath.c: Add missing stdio header for printf(3) in DEBUG build. 2013-05-17 15:26:21 -0700 Niveditha Rau (26f7239a0) * Make sure internal headers include required headers 2013-05-16 23:05:36 -0700 Alan Coopersmith (71fb99cb4) * Free fs->properties in XF86BigfontQueryFont overflow error path 2013-05-23 20:39:46 +0200 Julien Cristau (78ed23330) * xkb: fix off-by-one in _XkbReadGetNamesReply and _XkbReadVirtualModMap 2016-10-06 23:34:06 +0200 Ulrich Sibiller (082e83130) * Revert "Add a couple fixups for the security patches" 2013-03-07 23:46:05 -0800 Alan Coopersmith (e15023b2a) * Remove more unnecessary casts from Xmalloc/calloc calls 2013-03-16 18:30:56 -0700 Alan Coopersmith (47d0ea1ba) * Move big request comment in XOpenDisplay to the right place 2013-03-08 22:33:28 -0800 Alan Coopersmith (4988e9bd9) * Fix very weird indenting in nx-X11/lib/X11/GetFProp.c 2013-03-08 15:37:33 -0800 Alan Coopersmith (001aeb55b) * XAllocClassHint: Assume calloc sets pointers in allocated memory to NULL 2013-03-08 17:13:09 -0800 Alan Coopersmith (7ddc5b90f) * _xudc_code_to_glyph: check for NULL pointer *before* writing to it, not after 2013-03-01 18:10:27 -0800 Alan Coopersmith (e18ccaaae) * Assume size_t is always available, since it was defined in C89 2013-03-01 18:09:07 -0800 Alan Coopersmith (2393e1acd) * unifdef XKB_IN_SERVER 2013-02-16 10:42:23 -0800 Alan Coopersmith (d31b81c10) * Convert more sprintf calls to snprintf 2013-02-15 23:43:12 -0800 Alan Coopersmith (d43f4c398) * XKeysymToString: move variable declarations to the scope of their usage 2013-02-15 23:34:40 -0800 Alan Coopersmith (5e0584c43) * Preserve constness in casting arguments through the Data*() routines 2013-02-15 23:25:38 -0800 Alan Coopersmith (d91c145a4) * XStringToKeysym: preserve constness when casting off unsignedness for strcmp 2013-02-15 23:14:40 -0800 Alan Coopersmith (641704516) * XRebindKeysym: Drop unnecessary const-removing cast 2013-02-15 22:45:19 -0800 Alan Coopersmith (5608b67f2) * cmsColNm.c: maintain constness of arguments to qsort helper function 2012-12-26 22:57:39 -0800 Alan Coopersmith (19275f9e1) * Remove unused DECnet ("DNETCONN") code from Xlib 2012-12-26 22:56:38 -0800 Alan Coopersmith (acceb2cf6) * Remove unused TLI ("STREAMSCONN") code from Xlib 2011-05-20 18:25:24 +0200 Egbert Eich (53e2e92e3) * Don't hard code path to Xcms.txt file. 2012-10-22 13:54:11 -0500 Yaakov Selkowitz (11d6dac92) * XIM: remove Private and Public macros 2012-06-29 23:08:04 -0700 Alan Coopersmith (97b9864ea) * Convert XCreate{Pix,Bit}map...Data to use C99 designated initializers 2012-06-29 22:57:13 -0700 Alan Coopersmith (7a8721b8a) * XCreate{Pix,Bit}map...Data: Free pixmap in error path if XCreateGC fails 2010-12-22 15:14:05 +0000 Philipp Reh (c86806148) * Events: Store event cookie when dequeuing event 2011-05-03 09:32:53 -0700 Jeremy Huddleston (5062342d4) * clang analyzer: Don't warn about Xmalloc(0) 2011-05-08 09:08:07 -0700 Jeremy Huddleston (c19cda6d6) * Silence clang static analysis warnings for SetReqLen 2011-05-17 20:49:59 -0700 Alan Coopersmith (c300a430d) * Fix man page and comment references to use XFreeModifiermap (lowercase map) 2011-10-10 14:09:17 -0700 Jeremy Huddleston (f3bbb81c4) * Mark XKeycodeToKeysym as _X_DEPRECATED 2011-10-10 16:40:52 +0200 Bodo Graumann (cc4d5260e) * libX11: Fixing modifier key range in Xutil.h (Bug #21910) 2011-10-27 13:24:10 +1000 Peter Hutterer (3bf350742) * Switch GetEmptyReq and GetResReq to call _XGetRequest 2011-10-14 14:51:06 +1000 Peter Hutterer (3597915f6) * include: Add GetReqSized() for request buffers of specific size 2011-10-27 13:53:22 +1000 Peter Hutterer (3155b9bb2) * Use GetReqSized for GetReq and GetReqExtra 2011-01-31 14:01:59 +0200 Erkki Seppälä (79cb50e4c) * ximcp/imRmAttr: Handle leaking missing_list 2011-01-31 14:02:01 +0200 Erkki Seppälä (44e472068) * ximcp/imRm: Handle leaking colormap_ret 2011-01-31 14:02:14 +0200 Erkki Seppälä (89dc7ccfb) * ximcp/imTrX: Handle failing XGetWindowProperty 2011-01-31 14:02:15 +0200 Erkki Seppälä (81422098f) * ximcp/imLckup: Handle negative return value from _Xlcwctomb 2011-01-31 14:02:13 +0200 Ander Conselvan de Oliveira (a8598e062) * lc/def/lcDefConv: Use Xcalloc to avoid use of uninitialized memory 2011-02-21 15:56:54 +0100 Samuel Thibault (93a4f5c47) * Fix status reporting for braille patterns 2011-02-21 21:54:17 +0100 Samuel Thibault (2cca621e3) * Make the Local XIM request key releases for braille 2011-01-10 16:22:45 +0200 Erkki Seppälä (e4815126b) * im/ximcp: release modifiermap before returning 2011-04-12 20:50:42 -0700 Alan Coopersmith (018d938aa) * Fix "attrinute" typo in comments in ximcp 2011-03-24 16:24:29 +0200 Ander Conselvan de Oliveira (4aa79f1f1) * Fix leaks in _XimEncodingNegotiation error paths. 2011-03-24 19:36:56 +0200 Ander Conselvan de Oliveira (3720ed7bf) * Fix memory leaks on _XimProtoCreateIC error paths. 2011-03-24 19:48:44 +0200 Ander Conselvan de Oliveira (b7cc762ba) * Fix memory leaks on _XimWriteCachedDefaultTree error paths. 2011-03-24 19:52:05 +0200 Ander Conselvan de Oliveira (7024f3d90) * Fix memory leak on _XimCommitRecv error path. 2011-03-24 19:55:33 +0200 Ander Conselvan de Oliveira (60840dc31) * Fix memory leaks on _XimCbDispatch error path. 2011-03-24 20:40:41 +0200 Ander Conselvan de Oliveira (9fa1e98dd) * om: Fix memory leak on read_EncodingInfo error path. 2011-03-25 16:06:15 +0200 Ander Conselvan de Oliveira (748cf8946) * om: Fix potential memory leak in init_om. 2011-03-25 14:47:35 +0200 Ander Conselvan de Oliveira (6fe8d44ca) * om: Fix memory leaks on get_font_name error paths. 2011-10-09 02:26:45 -0700 Jeremy Huddleston (73a2898af) * Fix potential uninitialized variable access in _XimMakeICAttrIDList 2011-10-09 17:56:45 +0200 Yann Droneaud (bec22fe97) * Return name instead of value in XGetIMValues() and XSetIMValues() 2011-10-11 17:27:59 +0200 Yann Droneaud (cded3305d) * Return name instead of False in XSetICValues() 2011-10-14 17:39:21 -0700 Xue Wei (8d1e05940) * mbtocs should not truncate input 2011-10-14 17:53:00 -0700 Alan Coopersmith (2f49f62a8) * Fix "nomal" -> "normal" typo in several comments 2011-11-08 20:18:09 +0000 Andreas Wettstein (4ef27790b) * XIM: Allow modifier releases in compose sequences (#26705) 2011-02-21 17:27:38 +0100 Samuel Thibault (b8b885daf) * Match braille patterns with compose tree 2012-04-30 16:36:47 +1000 Peter Hutterer (79a5330db) * Typo fix 2012-03-15 22:03:21 -0700 Alan Coopersmith (4c7f0af73) * Remove "register" qualifier that annoys Solaris Studio compiler 2012-03-04 02:00:13 -0800 Keith Packard (3d37513eb) * Block for other threads in _XUserLockDisplay 2011-02-20 17:09:43 +0200 Marko Myllynen (e8e91b69e) * Provide translation from XK_permille (ad5) to Unicode (U2030) 2012-01-01 21:04:52 +0000 Ryan Pavlik (fd7157723) * Use pthreads on MinGW also 2011-12-14 02:17:55 -0500 Kusanagi Kouichi (5eb1147cc) * XQueryColors: Split a request into multiple requests if necessary 2011-11-29 23:56:57 -0800 Alan Coopersmith (30d4454e3) * Reject negative string counts in copy_string_list 2011-11-09 21:00:36 -0800 Alan Coopersmith (0f089824e) * XlcSL.c: convert old-style function definitions to ANSI C89 style 2011-10-17 09:45:15 +1000 Peter Hutterer (02dad70a8) * Add _XGetRequest as substitute for GetReq/GetReqExtra 2011-10-13 07:58:02 +0900 Choe Hwanjin (1871ff031) * XIM: Make Xim handle NEED_SYNC_REPLY flag 2011-05-04 15:34:31 -0700 Jeremy Huddleston (7efa7da59) * XKB: XkbComputeSectionBounds: Check correct bounds in default switch-case 2011-05-04 11:35:31 -0700 Jeremy Huddleston (1d806a555) * Dead code removal 2011-04-21 16:21:04 -0700 Alan Coopersmith (8127b17dc) * Delete special case code to append "/sparcv9" to i18n module path 2011-04-12 22:30:45 -0700 Alan Coopersmith (dde00b2f6) * Convert malloc(strlen()); strcpy() sets to strdup 2011-04-12 21:27:45 -0700 Alan Coopersmith (7d7224d85) * Replace Xmalloc+bzero pairs with Xcalloc calls 2011-03-24 19:42:36 +0200 Ander Conselvan de Oliveira (369c95668) * Fix memory leaks on _XimGetAttributeID error paths. 2011-03-30 15:06:10 +0300 Ander Conselvan de Oliveira (f50e651e8) * xcms: Fix memory leaks on LINEAR_RGB_InitSCCData error path. 2011-03-30 15:19:28 +0300 Ander Conselvan de Oliveira (fefb909a0) * xcms: Fix error on LINEAR_RGB_InitSCCData error path. 2011-03-24 14:17:44 +0200 Ander Conselvan de Oliveira (dce81504f) * FSWrap: fix potential leak in copy_string_list 2011-03-23 14:36:22 +0200 Ander Conselvan de Oliveira (0f7148695) * Fix memory leak with broken bitmap files in XReadBitmapFileData 2011-03-21 14:49:37 +0000 Harshula Jayasuriya (417e04111) * Add #define XK_SINHALA 2011-01-18 15:58:20 +0200 Erkki Seppälä (29ad23b98) * xkb: XkbPropertyPtr determined allocation success from wrong variables 2011-01-10 16:37:22 +0200 Erkki Seppälä (bbeee4fd1) * keyBind: Use Xcalloc to initialize allocated _XKeytrans 2011-02-11 14:49:17 -0800 Alan Coopersmith (2618bd3fc) * Clean up memory when first XCreateRegion succeeds and second fails 2011-02-03 17:08:57 +0200 Erkki Seppälä (07fae919a) * cmsProp: don't deal with uninitialized values, fail instead 2011-01-31 14:02:07 +0200 Ander Conselvan de Oliveira (ae4e7538e) * xcms/LRGB: don't double-free property_return 2011-02-02 08:58:45 -0800 Alan Coopersmith (26270ab1c) * Xrm.c: ReadInFile: refactor fstat error handling 2011-02-02 08:56:00 -0800 Alan Coopersmith (563318af9) * Expand GetSizeOfFile() macro at the one place it's called 2011-01-31 14:01:57 +0200 Erkki Seppälä (20470a83e) * XlibInt: Use strncpy+zero termination instead of strcpy to enforce buffer size 2011-01-31 14:02:16 +0200 Erkki Seppälä (7576f5f15) * xlibi18n/lcFile: Removed superfluous check for NULL target_dir 2011-01-31 14:02:12 +0200 Ander Conselvan de Oliveira (698270c47) * XlibInt: info_list->watch_data was reallocated, but result was discarded 2011-02-01 11:07:25 +0200 Ander Conselvan de Oliveira (7482afcaa) * xcms/LRGB: Add a label for freeing property_return. 2011-01-31 14:02:08 +0200 Ander Conselvan de Oliveira (8f5a56474) * xcms/LRGB: Fix potential resource leak. 2011-01-31 14:02:05 +0200 Erkki Seppälä (afd1d4eb5) * Xrm: NEWTABLE had a memory leak after a memory allocation error 2011-01-31 14:02:03 +0200 Erkki Seppälä (1ac1b691d) * ImUtil: Handle a memory leak in one early return branch 2011-01-31 14:01:56 +0200 Erkki Seppälä (52d2c3558) * xlibi18n/lcGeneric: Initialize uninitialized local variable 2011-01-31 14:01:54 +0200 Erkki Seppälä (865043ea0) * xcmx/cmxColNm: Removed unused assignments to pBuf (in two functions) 2011-02-01 12:30:56 +0200 Alan Coopersmith (54550ebb2) * XDefaultOMIF.c: Fix memory leaks in get_font_name 2011-01-18 12:49:48 +0200 Erkki Seppälä (b7694b0b5) * Comparing array against NULL is not useful "&xkb->server->vmods != NULL" 2011-01-12 15:51:11 +0200 Erkki Seppälä (3147ddbf4) * Variable "entry" tracked as NULL was dereferenced. 2011-01-27 09:54:00 +0200 Erkki Seppälä (e17558786) * Dereferencing possibly NULL "str" in call to function "memcpy" (Deref assumed on the basis of 'nonnull' parameter attribute.) 2011-01-10 16:17:47 +0200 Erkki Seppälä (8aacb3fab) * Using freed pointer "e" 2011-01-03 12:25:28 -0500 Pauli Nieminen (1a72bc414) * Initialize event type 2010-06-04 13:20:17 -0700 Alan Coopersmith (8ff526111) * LINEAR_RGB_InitSCCData: When malloc fails, don't try to free unallocated bits 2010-07-09 18:13:13 +0100 Daniel Stone (93b55eeec) * XStringToKeysym: Cope with 0x1234cafe-style input 2010-07-08 16:49:51 +0100 Daniel Stone (b414bc2c6) * XStringToKeysym: Check strdup() return value 2010-06-15 18:49:43 +0100 Daniel Stone (c1b175d3d) * Delete now-redundant XKeysymDB 2010-06-15 18:47:37 +0100 Daniel Stone (f0b87f3de) * XStringToKeysym: Special case for XF86 keysyms 2016-10-14 16:49:08 +0200 Mike Gabriel (6c303d9e4) * debian/rules: Don't use -pie -fPIE at build time for 3.5.99.2 as it causes nxagent to segfault. Investigating the reasons behind it is in process... 2016-10-14 02:31:38 +0000 Mihai Moldovan (75e080800) * nx-X11/programs/Xserver/GL/glx/Imakefile: typo fix, leading to glcontextmodes.c not being compiled. 2016-10-13 14:10:28 +0200 Mike Gabriel (29e29342e) * release 3.5.99.2 (tag: 3.5.99.2) 2016-10-13 15:05:37 +0200 Mike Gabriel (64aa45a61) * debian/*.triggers: Call ldconfig via a trigger for all shared libraries. 2016-10-13 15:05:31 +0200 Mike Gabriel (440c675c2) * debian/rules: Don't modify/create post{inst,rm} scripts during dh_makeshlibs. This avoids adding ldconfig calls to such scripts. 2016-10-13 14:45:37 +0200 Mike Gabriel (bd25086c3) * hw/nxagent/{Clipboard|Events}.c: Typo fix in error messages. 2016-10-13 14:44:27 +0200 Mike Gabriel (d2fb76d8b) * nxcomp/{Client|}Proxy.cpp: Typo fix in error messages. 2016-10-13 14:17:55 +0200 Mike Gabriel (0006fc04b) * debian/libnx-x11-6.symbols: Update symbols for new backports in libNX_X11 API. 2016-10-07 21:19:07 +0200 Ulrich Sibiller (97c26978b) * Pending.c: conditionally include stdio.h 2016-10-10 01:00:38 +0200 Ulrich Sibiller (0bf52dc99) * nxcomp: Fix typo in usage message. 2016-10-13 14:02:51 +0200 Mike Gabriel (133c91f73) * Merge branch 'uli42-pr/libX11_debian_backports' into 3.6.x 2013-05-21 21:54:55 +0200 Julien Cristau (a9f623f0a) * Add a couple fixups for the security patches 2013-05-08 19:33:09 +0200 Matthieu Herrb (838108c29) * XListFontsWithInfo: Re-decrement flist[0] before calling free() on it. 2013-03-31 12:22:35 -0700 Alan Coopersmith (dc749a457) * _XkbReadGetMapReply: reject maxKeyCodes smaller than the minKeyCode 2013-03-16 10:03:13 -0700 Alan Coopersmith (37f8d3eb8) * Use calloc in XOpenDisplay to initialize structs containing pointers 2013-03-02 12:39:58 -0800 Alan Coopersmith (e386187e9) * Unbounded recursion in _XimParseStringFile() when parsing include files [CVE-2013-2004 2/2] 2013-03-02 12:01:39 -0800 Alan Coopersmith (bddfee4a9) * Unbounded recursion in GetDatabase() when parsing include files [CVE-2013-2004 1/2] 2013-03-02 15:08:21 -0800 Alan Coopersmith (dbc117193) * Avoid overflows in XListExtensions() [CVE-2013-1997 15/15] 2013-03-02 15:08:21 -0800 Alan Coopersmith (77edd88e1) * Avoid overflows in XGetFontPath() [CVE-2013-1997 14/15] 2013-03-02 15:08:21 -0800 Alan Coopersmith (f6c5069ac) * Avoid overflows in XListFonts() [CVE-2013-1997 13/15] 2013-03-02 11:25:25 -0800 Alan Coopersmith (0284afb80) * unvalidated length in _XimXGetReadData() [CVE-2013-1997 12/15] 2013-03-02 11:11:08 -0800 Alan Coopersmith (0bf09b4bb) * unvalidated index/length in _XkbReadGetNamesReply() [CVE-2013-1997 11/15] 2013-03-02 11:01:04 -0800 Alan Coopersmith (e6d8856ef) * unvalidated index in _XkbReadVirtualModMap() [CVE-2013-1997 10/15] 2013-03-02 11:04:44 -0800 Alan Coopersmith (e27df8070) * unvalidated index in _XkbReadExplicitComponents() [CVE-2013-1997 9/15] 2013-03-02 10:51:51 -0800 Alan Coopersmith (7564bf7ef) * unvalidated index in _XkbReadModifierMap() [CVE-2013-1997 8/15] 2013-03-02 10:39:21 -0800 Alan Coopersmith (8f2c05082) * unvalidated index in _XkbReadKeyBehaviors() [CVE-2013-1997 7/15] 2013-03-02 09:40:22 -0800 Alan Coopersmith (4c19cd0c7) * unvalidated index in _XkbReadKeyActions() [CVE-2013-1997 6/15] 2013-03-02 09:28:33 -0800 Alan Coopersmith (5dae1d3f4) * unvalidated index in _XkbReadKeySyms() [CVE-2013-1997 5/15] 2013-03-02 09:18:26 -0800 Alan Coopersmith (e6fbdea84) * unvalidated indexes in _XkbReadGetGeometryReply() [CVE-2013-1997 4/15] 2013-03-02 09:12:47 -0800 Alan Coopersmith (0445730b1) * unvalidated indexes in _XkbReadGeomShapes() [CVE-2013-1997 3/15] 2013-03-01 22:49:01 -0800 Alan Coopersmith (b06952603) * unvalidated index in _XkbReadGetDeviceInfoReply() [CVE-2013-1997 2/15] 2013-03-01 19:30:09 -0800 Alan Coopersmith (2a1fbb181) * unvalidated lengths in XAllocColorCells() [CVE-2013-1997 1/15] 2013-03-09 11:04:37 -0800 Alan Coopersmith (e03f3922a) * Make XGetWindowProperty() always initialize returned values 2013-03-02 13:03:55 -0800 Alan Coopersmith (b20710586) * Move repeated #ifdef magic to find PATH_MAX into a common header 2013-03-02 16:56:16 -0800 Alan Coopersmith (05b72b8da) * Convert more _XEatData callers to _XEatDataWords 2013-03-02 15:08:21 -0800 Alan Coopersmith (306ca006a) * integer overflow in XGetModifierMapping() [CVE-2013-1981 13/13] 2013-03-02 15:08:21 -0800 Alan Coopersmith (748af521e) * integer overflow in XGetPointerMapping() & XGetKeyboardMapping() [CVE-2013-1981 12/13] 2013-03-02 15:08:21 -0800 Alan Coopersmith (9501bce22) * integer overflow in XGetImage() [CVE-2013-1981 11/13] 2013-03-08 22:25:35 -0800 Alan Coopersmith (361d36770) * integer overflow in XGetWindowProperty() [CVE-2013-1981 10/13] 2013-03-02 13:18:48 -0800 Alan Coopersmith (25172302a) * integer overflows in TransFileName() [CVE-2013-1981 9/13] 2013-03-01 18:37:37 -0800 Alan Coopersmith (8468165ae) * integer truncation in _XimParseStringFile() [CVE-2013-1981 8/13] 2013-03-01 18:37:37 -0800 Alan Coopersmith (00d7a2e5b) * integer overflow in ReadInFile() in Xrm.c [CVE-2013-1981 7/13] 2013-03-02 11:44:19 -0800 Alan Coopersmith (0349af114) * Integer overflows in stringSectionSize() cause buffer overflow in ReadColornameDB() [CVE-2013-1981 6/13] 2013-03-01 22:49:01 -0800 Alan Coopersmith (8673bf071) * integer overflow in XListHosts() [CVE-2013-1981 5/13] 2013-03-01 22:49:01 -0800 Alan Coopersmith (7d18bbe93) * integer overflow in XGetMotionEvents() [CVE-2013-1981 4/13] 2013-03-01 22:49:01 -0800 Alan Coopersmith (29779559c) * integer overflow in XListFontsWithInfo() [CVE-2013-1981 3/13] 2013-03-01 21:05:27 -0800 Alan Coopersmith (dda0c652f) * integer overflow in _XF86BigfontQueryFont() [CVE-2013-1981 2/13] 2013-03-01 21:05:27 -0800 Alan Coopersmith (de2d3cb6b) * integer overflow in _XQueryFont() on 32-bit platforms [CVE-2013-1981 1/13] 2013-01-22 10:03:00 -0500 Nickolai Zeldovich (e8ada07fa) * XListFontsWithInfo: avoid accessing realloc'ed memory 2011-02-11 14:20:24 -0800 Alan Coopersmith (290f94aea) * ximcp: Prevent memory leak & double free if multiple %L in string 2011-01-31 14:02:06 +0200 Erkki Seppälä (936154728) * Xrm: Handle the extremely unlikely situation of fstat failing 2016-10-12 08:32:04 +0200 Mike Gabriel (051d521f6) * Merge branch 'uli42-pr/upgrade_libX11' into 3.6.x 2016-10-09 17:49:20 +0200 Ulrich Sibiller (b8de7bf65) * Use both __APPLE__ and __DARWIN__ defines 2015-04-15 10:16:18 +0200 Karl Tomlinson (01865335b) * MakeBigReq: don't move the last word, already handled by Data32 (X.Org CVE-2013-7439). 2013-04-19 14:30:40 -0700 Alan Coopersmith (670b8ef64) * Give GNU & Solaris Studio compilers hints about XEatData branches 2011-12-13 19:58:30 -0800 Alan Coopersmith (6165dafda) * makekeys: move buf declaration from global to main to silence gcc -Wshadow 2011-09-22 18:44:13 -0400 Derek Buitenhuis (62e5b0ff8) * makekeys: Fix build/target word size mismatch when cross-compiling 2016-08-27 03:24:22 +0200 Ulrich Sibiller (0bcb4bba2) * adapt Imakefile to call makekeys correctly after update 2010-06-15 18:48:48 +0100 Daniel Stone (c98265ab4) * makekeys: Scan vendor keysyms as well as core 2009-03-17 15:42:19 -0700 Alan Coopersmith (70327993a) * When makekeys fails to find a good hash, print error instead of divide-by-zero 2008-10-25 09:13:08 -0400 James Cloos (f57365400) * Increase size of working arrays in the makekeys utility program. 2016-08-27 02:24:46 +0200 Ulrich Sibiller (9a3096a2a) * Update keysym includes 2016-08-27 02:13:27 +0200 Ulrich Sibiller (1baa27d09) * update files from modules dir of libX11 1.3.4 2016-08-27 02:13:02 +0200 Ulrich Sibiller (da3e7fd28) * Xutil.h: Fix wrong include path 2016-08-27 01:44:41 +0200 Ulrich Sibiller (d3ae0b2c9) * replace {x11,xim}trans.c links by libX11 1.3.4 solution 2016-08-27 01:22:46 +0200 Ulrich Sibiller (385dc2b07) * update xlibi18n files to libX11 1.3.4 2016-08-27 01:00:43 +0200 Ulrich Sibiller (e868fbbfd) * update xcms files to libX11 1.3.4 2016-08-27 00:37:53 +0200 Ulrich Sibiller (274929053) * Update some missing files to libX11 1.3.4 2016-08-27 00:31:05 +0200 Ulrich Sibiller (8a5f30fb1) * Add (Free|Get)EventData.c from libX11 1.3.4 2016-08-27 00:16:07 +0200 Ulrich Sibiller (efa70b0cf) * remove more NEED_REPLIES/EVENTS 2016-08-27 00:24:37 +0200 Ulrich Sibiller (0079db696) * Purge more remaining VCS refs 2016-08-27 00:04:03 +0200 Ulrich Sibiller (af1f7cee0) * Lift XKB*.c to libX11 1.3.4 2016-08-25 21:43:53 +0200 Ulrich Sibiller (3e75c816d) * XlibInt.c: shorten one ifdef 2016-08-24 16:52:58 +0200 Ulrich Sibiller (a497ebf88) * update X.h and Xproto.h because of GenericEvent 2016-08-03 19:19:58 +0200 Ulrich Sibiller (22652155f) * set USE_XCB define to 0 to prevent compiler complaints 2016-08-02 01:06:35 +0200 Ulrich Sibiller (e51b961a7) * Remove CRAY support 2016-08-02 01:23:54 +0200 Ulrich Sibiller (35270a3d9) * adapt include files to libX11 1.3.4 2016-08-02 00:51:13 +0200 Ulrich Sibiller (7b0bdde5c) * update makekeys.c to libX11 1.3.4 (+ fix) 2016-08-01 23:54:34 +0200 Ulrich Sibiller (b4571a8ff) * update lcUniConv subdir to libX11 1.3.4 2016-07-29 00:44:38 +0200 Ulrich Sibiller (687d44b6e) * update src files *[ch] to libX11 1.3.4 2016-07-26 23:19:36 +0200 Ulrich Sibiller (ea24f0b0e) * add XLOCALELIBDIR 2016-07-26 23:18:33 +0200 Ulrich Sibiller (ef5565f8e) * improve header guards 2016-07-26 00:34:34 +0200 Ulrich Sibiller (593073142) * update all files with NX relevant changes to libX11 1.3.4 2016-08-24 16:41:42 +0200 Ulrich Sibiller (a053df0a7) * fix wrong include in XlibInt.c 2016-10-08 21:31:17 +0200 Mike Gabriel (6dce607ba) * Merge branch 'uli42-pr/decouple-xserver' into 3.6.x 2016-10-08 00:40:36 +0200 Ulrich Sibiller (b0622729a) * xserver: add missing xkbfile.h 2016-10-07 13:12:39 +0200 Vadim Troshchinskiyddd (f55852c2e) * Fix nxproxy hostname parsing. 2016-10-07 13:58:57 +0200 Vadim Troshchinskiy (85f5fdfd2) * Check if unixPath is NULL before accessing it; this fixes crashing of nxagent when TEST is enabled. 2016-10-07 21:38:18 +0200 Mike Gabriel (3039a34cb) * Merge branch 'uli42-pr/decouple-xserver' into 3.6.x 2016-10-04 21:24:56 +0200 Ulrich Sibiller (736a2333e) * xserver: adapt xkbsrc includes syntax to match upstream 2015-02-17 14:40:27 +1000 Dave Airlie (a2a7482f2) * os/access: fix regression in server interpreted auth 2014-10-22 14:24:55 -0700 Keith Packard (a11629656) * os: Eliminate uninitialized value warnings from access.c 2014-12-09 09:31:00 -0800 Keith Packard (057cdafdc) * dix: GetHosts bounds check using wrong pointer value [CVE-2014-8092 pt. 6] 2008-06-13 21:59:09 -0400 Eamon Walsh (da5da2091) * Fix multiple warnings in os/xdmauth.c. 2016-09-26 23:00:04 +0200 Ulrich Sibiller (b60f66bb9) * replace transport.c link by xstrans.c 2016-09-26 22:20:45 +0200 Ulrich Sibiller (2a5364d5f) * xserver: drop XKBSRV_NEED_FILE_FUNCS 2016-09-26 21:32:05 +0200 Ulrich Sibiller (7c5d836c2) * xserver: remove define XKB_IN_SERVER 2016-09-26 21:12:23 +0200 Ulrich Sibiller (2fdb1add0) * xserver: use own copy of XKBgeom.h header 2016-09-26 21:09:36 +0200 Ulrich Sibiller (2c31ce2f2) * xserver: use own copy of XKBrules.h header 2016-09-26 21:05:32 +0200 Ulrich Sibiller (e60184393) * xserver: use own copy of XKBrules.h header 2016-09-26 21:03:02 +0200 Ulrich Sibiller (3b8819087) * xserver: use own copy of XKBstr.h header 2016-09-26 20:43:23 +0200 Ulrich Sibiller (3739a9b30) * xserver: use own copy of XKBsrv.h header 2016-09-21 20:54:53 +0200 Ulrich Sibiller (f0c0ff41b) * copy files from libX11 to xserver dir 2016-10-06 13:04:25 +0200 Mike Gabriel (168c063dc) * run-nxproxy2nxagent-over-network: Improve comment that describes script usage. Fix commented-out NX_HOST assignment. 2016-10-06 12:59:52 +0200 Mike Gabriel (834f13fa1) * testscripts: Rename run-nxagent and run-nxagent-over-sockets. 2016-10-06 12:59:25 +0200 Mike Gabriel (cd0da096a) * run-nxproxy2nxagent-over-network: New test script that tests nxproxy/nxagent connectivity between networked hosts. 2016-10-01 20:22:18 +0200 Mike Gabriel (3e59f165f) * Merge branch 'sunweaver-pr/update-X11s-XKeysymDB' into 3.6.x 2011-03-22 11:28:56 +1000 Peter Hutterer (5dcf0d573) * Add XF86TouchpadOn and XF86TouchpadOff to keysymdb 2016-08-25 00:52:51 +0200 Mike Gabriel (34cb7b558) * lib/X11/XKeysymDB: Update to last version found in X.org (between 1.3.5 and 1.3.6). 2016-10-01 20:20:18 +0200 Mike Gabriel (5d52d21bc) * Merge branch 'sunweaver-pr/use-gccmakedep' into 3.6.x 2016-10-01 12:04:54 +0200 Mike Gabriel (b1603713e) * Imake.tmpl: Use gccmakedep instead of makedepend. 2016-10-01 20:16:39 +0200 Mike Gabriel (e3ea74823) * Merge branch 'sunweaver-pr/fix-protoheader-mess' into 3.6.x 2016-10-01 11:28:50 +0200 Mike Gabriel (3698cf27b) * include/extensions/damageproto.h: Use nx-X11's xfixesproto.h and damagewire.h instead of X.org's. 2016-10-01 11:25:29 +0200 Mike Gabriel (9acfa3b28) * randrproto: It was discovered that nx-libs shipped two different version of randr.h and randrproto.h. This commit leaves the newer file versions in the package and let's the build process use those everywhere. 2016-10-01 11:00:01 +0200 Mike Gabriel (f4f0b4490) * nx-X11: Enable -Wpedantic as default CFLAG. This is to detect redefined typedefs when building nxagent. 2016-10-01 10:53:37 +0200 Mike Gabriel (b50b0af97) * hw/nxagent/X11/include/Xrandr_nxagent.h: Reduce injected libXrandr(_nxagent) header file, so that it only contains the XRRScreenChangeNotifyEvent typedef. 2016-09-29 20:58:15 +0200 Ulrich Sibiller (485805235) * nx-libs.spec: Fix warning because of double reference to nxproxy.1.gz. 2016-09-29 20:28:59 +0200 Ulrich Sibiller (ce31b9c97) * Fix FTBFS with gcc 4.4 2016-10-01 10:29:48 +0200 Mike Gabriel (a788c6856) * Makefile: Adapt install target to the new situation where we fake X11 headers in .build-export. This fixes FTBFS during file installation into .deb and .rpm packages. 2016-09-29 08:40:05 -0400 Mike DePaulo (5c2a8cdc9) * Merge pull request #203 from mikedep333/issue-202 2016-09-25 08:28:29 -0400 Mike DePaulo (cf435b3bc) * nx-libs.spec: Add BuildRequires: imake 2016-09-24 23:59:02 +0200 Mike Gabriel (049bf681e) * Merge branch 'uli42-pr/improve_include_path_handling' into 3.6.x 2016-09-24 23:44:09 +0200 Ulrich Sibiller (97a5cec70) * Revert "Fix wrong include" 2016-09-24 23:43:01 +0200 Ulrich Sibiller (c061022a9) * whitespace cleanup 2016-09-24 23:41:55 +0200 Ulrich Sibiller (35e8c02d9) * ensure that headers references use nx-X11 files if existing 2016-09-22 08:41:24 +0200 Mike Gabriel (a906bf0f2) * Merge branch 'uli42-remove-misc' into 3.6.x 2016-09-21 18:37:10 +0200 Ulrich Sibiller (09d5e073a) * remove misc dir 2016-09-21 18:28:22 +0200 Ulrich Sibiller (8d4d2bc20) * move xkblib to xserver 2016-09-13 15:45:03 +0200 Mike Gabriel (43f135be0) * release 3.5.99.1 (tag: 3.5.99.1) 2016-08-26 12:49:28 +0200 Mike Gabriel (60e88a0b1) * nxcomp/Loop.cpp: We have PrintVersionInfo(), why not use it? Use endl instead of \n for EOLs when streaming application's preamble to stderr. 2016-08-26 12:40:49 +0200 Mike Gabriel (01ebcfa35) * nxcomp/Loop.cpp: Mention DXPC copyright holders on application (i.e. nxproxy) start-up. 2016-08-24 16:29:46 +0200 Mike Gabriel (efa309add) * nxcomp/Loop.cpp: We have GetCopyrightInfo() in Misc.cpp, so why not use it? Also: point to ArcticaProject/nx-libs namespace on Github for further information. 2016-08-24 16:17:24 +0200 Mike Gabriel (3520015b4) * hw/nxagent/Init.c: Fix copy+paste flaw when re-arranging copyright information as display by nxagent. 2016-08-24 16:13:52 +0200 Mike Gabriel (e2011608f) * nxcomp/Misc.cpp: Display new list of copyright holders when launching nxproxy / nxagent. 2016-08-24 16:11:04 +0200 Mike Gabriel (8fc2e80bc) * nxcomp/*.c: Update copyright headers, use new list of copyright holders like for the .cpp files. 2016-08-24 16:08:41 +0200 Mike Gabriel (ed5d920f6) * nxcomp/Loop.cpp: Refer to Github namespace of Arctica Project as location to search for software updates. 2016-08-24 15:59:36 +0200 Mike Gabriel (0ea971b9e) * Merge branch 'uli42-fix_x2go_952' into 3.6.x 2016-08-21 13:12:23 +0200 Ulrich Sibiller (2d450e383) * Fix pasting the clipboard directly after session start. 2016-07-28 13:21:29 +0200 Mike Gabriel (46fef3150) * nxagent.1 man page: Some layout fixes for string options with well-defined expected selections of values. 2016-07-28 13:20:38 +0200 Mike Gabriel (e9a3734ae) * hw/nxagent/Display.c: Fix comment where the meaning of the "bypass" reconnectchecks parameter value is explained. 2016-07-28 12:59:37 +0200 Mike Gabriel (bff330577) * nxagent.1 man page: Add explanation about the new reconnectchecks nx/nx option. 2016-07-28 12:16:23 +0200 Mike Gabriel (aadf3175c) * hw/nxagent/Args.c: Follow-up fix for PR #183: expect reconnectchecks=bypass instead of =none. 2016-07-28 12:14:22 +0200 Mike Gabriel (443b52723) * Merge branch 'Ionic-feature/reconnect-checks' into 3.6.x 2016-07-03 23:52:43 +0000 Mihai Moldovan (64a83d1e0) * nx-X11/programs/Xserver/hw/nxagent/Display.c: add FIXME comment to nxagentCheckForColormapsCompatibility(). (gh-ionic/feature/reconnect-checks, gh-Ionic/feature/reconnect-checks) 2016-07-03 23:52:06 +0000 Mihai Moldovan (5ec7e48ac) * nx-X11/programs/Xserver/hw/nxagent/Display.c: add FIXME comment to nxagentInitAndCheckVisuals(). 2016-07-09 03:28:27 +0000 Mihai Moldovan (e61c8c85c) * nx-X11/programs/Xserver/hw/nxagent/Display.c: split up nxagentCheckForPixmapFormatsCompatibility() and nxagentInitPixmapFormats(). 2016-06-29 02:13:03 +0000 Mihai Moldovan (661827149) * nx-X11/programs/Xserver/hw/nxagent/Display.c: use new ReconnectTolerance nxagentOption value in nxagentCheckForPixmapFormatsCompatibility() and modify behavior based on this value. 2016-06-28 23:54:17 +0000 Mihai Moldovan (bb9b50bfc) * nx-X11/programs/Xserver/hw/nxagent/Display.c: use new ReconnectTolerance nxagentOption value in nxagentCheckForDepthsCompatibility() and modify behavior based on this value. 2016-06-28 23:51:14 +0000 Mihai Moldovan (6effea543) * nx-X11/programs/Xserver/hw/nxagent/Display.c: use new ReconnectTolerance nxagentOption in nxagentCheckForDefaultDepthCompatibility() and modify behavior based on this value. 2016-07-02 21:49:10 +0000 Mihai Moldovan (29be5cc07) * {nx-X11/programs/Xserver/hw/nxagent/{Args.c,Options.{c,h}},nxcomp/{Loop,Misc}.cpp}: add tolerancechecks parameter as an nx/nx option and ReconnectTolerance as an nxagentOption. 2016-07-27 13:05:27 +0200 Mike Gabriel (e1c85caac) * Merge branch 'uli42-3.6.x' into 3.6.x 2016-07-26 23:25:26 +0200 Ulrich Sibiller (9a4bb50af) * Fix wrong include 2016-07-10 09:55:55 +0200 Mihai Moldovan (debe460b2) * debian/control: add Breaks statement on pre-4.1.0.0 x2goserver to x2goagent package. 2016-07-10 09:32:29 +0200 Mihai Moldovan (9744c1002) * debian/changelog: whitespace only. 2016-07-06 10:38:25 +0200 Mike Gabriel (470611e02) * release 3.5.99.0 (tag: 3.5.99.0, gh-ionic/3.6.x, gh-Ionic/3.6.x) 2016-07-06 10:02:37 +0200 Mike Gabriel (961fa2a0e) * README.md: Add build howto for openSUSE based RPMs. 2016-07-06 10:02:16 +0200 Mike Gabriel (b41369f27) * README.md: Status update of listed 3.6.x features. 2016-07-06 08:29:38 +0200 Mike Gabriel (98922f7b1) * make-changelog.sh: Ship simple script for updating the upstream ChangeLog file from Git history. 2016-07-06 01:14:56 +0200 Mike Gabriel (9b50e0088) * Merge branch 'sunweaver-pr/update-license-files' into 3.6.x 2016-07-05 16:32:57 +0200 Mike Gabriel (6144b615d) * VCS info lines: Remove ancient X.org / XFree86 VCS info line from code files. (gh-sunweaver/pr/update-license-files, sunweaver-pr/update-license-files, pr/update-license-files) 2016-07-05 16:22:51 +0200 Mike Gabriel (51c3d42f3) * Per-file copyright notices: Update copyright information in file headers that NoMachine placed there own copyright statement in. 2016-07-05 13:44:32 +0200 Mike Gabriel (3c79d5cf4) * LICENSE files: Update copyright holders, FSF address and various other minor things. 2016-07-06 00:40:36 +0200 Mike Gabriel (5cbc93678) * nxproxy.1 man page: Another rendering flaw fixed. 2016-07-06 00:25:06 +0200 Mike Gabriel (8ec78a0c3) * debian/*.doc-base: Add .doc-base files for bin:packages containing documentation. 2016-07-06 00:07:11 +0200 Ulrich Sibiller (196d38f96) * Xserver/dix/events.c: Drop unused i variable from TryClientEvents. 2016-07-06 00:04:05 +0200 Mike Gabriel (0369bf5e9) * nxproxy.1 man page: Fix a typo + a rendering error. Detected by lintian. 2016-07-05 23:47:49 +0200 Mike Gabriel (67f937c4a) * debian/rules: Enable -fPIE / -pie hardening support for nxagent and nxproxy. 2016-07-05 22:56:01 +0200 Ulrich Sibiller (d7655e15a) * Merge pull request #180 from uli42/pr/remove_need_events_replies 2016-07-04 21:11:21 +0200 Ulrich Sibiller (fa6519947) * remove unreferenced NEED_EVENTS/NEED_REPLIES 2016-07-05 22:23:27 +0200 Mike Gabriel (ff0d46e0b) * bin/nxauth: Remove deprecated wrapper script "nxauth". 2016-07-05 22:18:40 +0200 Mike Gabriel (f397f3a42) * debian/nxagent.docs: whitespace only 2016-07-05 22:17:51 +0200 Mike Gabriel (754d33d81) * README.keystrokes: Move from base folder to doc/nxagent/. 2016-07-05 21:58:42 +0200 Mike Gabriel (a39c5c155) * nx-libs.spec: Adapt RPM packaging to doc files having been moved around. 2016-07-05 21:57:45 +0200 Mike Gabriel (cd9a6b9dd) * debian/libxcomp3.docs: Install libxcomp3 documentation files into bin:package. 2016-07-05 21:48:27 +0200 Mike Gabriel (3ec3f6162) * debian/nxproxy.docs: Fix FTBFS due to missing documentation files (moved out of the way with recent commits). 2016-07-05 21:47:28 +0200 Mike Gabriel (2555bd5ac) * documentation: Move README-VALGRIND out of doc/_attic_/ folder to doc/nxproxy/. 2016-07-05 13:34:26 +0200 Mike Gabriel (381706aa2) * Merge branch 'sunweaver-pr/no-more-type-casting-in-writetoclient' into 3.6.x 2016-07-04 00:28:47 +0200 Alan Coopersmith (f6a1bda2d) * Remove unneccesary casts from WriteToClient calls (gh-sunweaver/pr/no-more-type-casting-in-writetoclient, sunweaver-pr/no-more-type-casting-in-writetoclient, pr/no-more-type-casting-in-writetoclient) 2016-07-04 00:21:45 +0200 Kristian Høgsberg (ff81a5269) * Make WriteToClient take a const void * like any decent IO write function. 2016-07-05 13:25:48 +0200 Mike Gabriel (06a97857a) * nxcomp/Misc.cpp: The clipboard nx/nx option is a string option, not int. 2016-07-05 13:25:17 +0200 Mike Gabriel (7e18fdf6e) * Xserver.man: Drop original and old Xserver man page. Relevant parts have now been added to nxagent.1 man page. 2016-07-05 13:24:16 +0200 Mike Gabriel (ebb2026a7) * man pages: Greatly improve man pages nxagent.1 and nxproxy.1. 2016-07-05 10:47:55 +0200 Mike Gabriel (ee0282207) * File permission fixes: No executable bit on Imakefile files, *.c and *.h files. 2016-07-05 10:41:55 +0200 Mike Gabriel (5214930a1) * X2Go remnants: Drop x2goagent.1 man page. Shipped in X2Go Server sources nowadays. 2016-07-05 10:41:24 +0200 Mike Gabriel (40179398d) * nxcomp licensing: Move README.on-retroactive-DXPC-license to doc/nxcomp/ folder. 2016-07-05 10:40:11 +0200 Mike Gabriel (b38f01092) * NoMachine documentation files: Move to doc/_attic_/ folder. 2016-07-05 10:33:08 +0200 Mike Gabriel (d38ccd197) * LICENSE files: Have a main LICENSE file and one for nxcomp in the project's base folder. 2016-07-05 10:28:40 +0200 Mike Gabriel (cc4fdf6f0) * X.org 6.9 documentation files: Move into doc/_attic_/. 2016-07-05 10:26:34 +0200 Mike Gabriel (4ad29435c) * Drop multiple COPYING files contaning the GPL-2 license text. 2016-07-05 10:16:00 +0200 Mike Gabriel (d14cc5361) * doc/_attic_/: Introduce an "_attic_" folder. Move diffs between NoMachine's nx-X11 3.5 and X.org 6.9 here. 2016-07-05 10:15:12 +0200 Mike Gabriel (74a52dd35) * doc/ folder: Have one sub-folder per nx-libs component. 2016-07-05 10:11:19 +0200 Mike Gabriel (74edd6e73) * test scripts: Move to top folder "testscripts/" in source tree. 2016-07-05 10:08:03 +0200 Mike Gabriel (aa4210715) * Merge branch 'sunweaver-pr/rpm-packaging-updates' into 3.6.x 2016-07-05 09:54:47 +0200 Mike Gabriel (058ae3e76) * nx-libs.spec: Add Conflicts: fields for removed shared library bin:packages. (gh-sunweaver/pr/rpm-packaging-updates, sunweaver-pr/rpm-packaging-updates, pr/rpm-packaging-updates) 2016-07-04 16:34:38 +0200 Mike Gabriel (1910142cf) * nx-libs.spec: Let libNX_X11-6 and libNX_X11-devel conflict with deprecated libXau6 and libXau-devel. 2016-07-04 16:31:18 +0200 Mike Gabriel (6dded30a7) * nx-libs.spec: Let nxagent conflict with nxauth, which is not provided anymore. 2016-07-04 16:27:34 +0200 Mike Gabriel (59eab0a82) * nx-libs.spec: Add correct Obsoletes:/Provides: fields for lib* bin:packages. 2016-07-04 15:32:58 +0200 Mike Gabriel (5c65e9b40) * nx-libs.spec: Fix various issues since last testing the RPM builds of nx-libs: 2016-07-05 09:46:45 +0200 Mike Gabriel (a1a7b1aab) * debian/control: Add some hard and exact-versioned dependencies for our bin:packages. Assure that no old share lib packages with the same set of symbols remain on the system when upgrading. 2016-07-05 09:10:28 +0200 Mike Gabriel (bf08b9960) * Merge branch 'sunweaver-pr/writeeventstoclients-no-sequencenumber' into 3.6.x 2016-07-03 22:52:13 +0200 Jamey Sharp (cb0089bad) * Set event sequence number in WriteEventsToClient instead of at callers. (gh-sunweaver/pr/writeeventstoclients-no-sequencenumber) 2016-07-03 22:06:43 +0200 Jamey Sharp (9ea88717d) * Make WriteEventsToClient/WriteToClient no-op on fake or dead clients. 2016-07-05 08:34:17 +0200 Mike Gabriel (320a8cc0c) * Merge branch 'sunweaver-pr/silencing-compiler-warnings' into 3.6.x 2016-07-05 08:16:09 +0200 Tomas Carnecky (b15fc63f4) * Replace INITARGS with void (gh-sunweaver/pr/silencing-compiler-warnings) 2016-06-29 15:07:16 +0200 Mike Gabriel (f0af82cbb) * nx-X11/lib/X11/XKBMisc.c: Avoid warning about maybe non-assigned variables (mask, newMask). 2016-06-29 15:02:00 +0200 Daniel Stone (d60297e41) * Remove INITARGS braindamage, change to void; add XkbExtensionInit prototype to xkb.h. Explicitly initialise nTypes in xkb.c. 2016-06-29 14:58:47 +0200 Keith Packard (ecaf4df7f) * Xserver/Xext/xres.c: Drop unused REQUEST macro call (for xXResQueryVersionReq). 2016-06-29 14:28:49 +0200 Mike Gabriel (894993501) * Xserver: Post-REGION-macros-to-inline-funcs clean-up. 2016-06-29 14:17:53 +0200 Mike Gabriel (8df1a67b6) * Xserver/mi/mizerarc.c: Initialize oddPtrs as NULL before using it (in miZeroPolyArc). 2016-06-29 14:14:15 +0200 Mike Gabriel (c08d0308d) * Xserver/mi/miarc.c: Initialize dashRemaining with 0 before using it. 2016-06-29 14:09:52 +0200 Mike Gabriel (a8fd16ce6) * Xserver/os/xdmauth.c: Avoid compiler warnings due to -Wswitch being enabled. Use if statement rather than switch. 2016-06-29 14:05:12 +0200 Mike Gabriel (141316af0) * Xserver/os/log.c: Make sure strlcpy is defined in log.c. Immitate what is done in X.org. 2016-06-29 13:57:05 +0200 Adam Jackson (f46af7de8) * Restore compression of duplicate log file entries. 2016-06-29 13:45:20 +0200 Keith Packard (b5cceb740) * os: Make sure that writing our pid to the lock file actually worked 2016-06-29 13:35:06 +0200 Mike Gabriel (bad0e8bdd) * Xserver/os/connection.c: Drop unused variable 'restore_trans_conn' from ClientAuthorized(). 2016-06-29 13:33:51 +0200 Mike Gabriel (00ebfaf53) * Xserver/os/connection.c: Only define XSERV_t, TRANS_SERVER and TRANS_REOPEN if not yet defined. 2016-06-29 13:30:08 +0200 Mike Gabriel (b34b47ed5) * nx-X11/lib/X11/imTrX.c: Fix warning ‘len’ may be used uninitialized in this function (_XimRead). 2016-06-29 13:28:23 +0200 Mike Gabriel (eddd4876b) * nx-X11/lib/X11/imInsClbk.c: Fix warning 'right-hand operand of comma expression has no effect' in _XimFilterPropertyNotify. 2016-06-29 13:24:38 +0200 Mike Gabriel (3569ac171) * nx-X11/lib/X11/lcFile.c: Drop conditional always evaluating as True. 2016-06-29 13:20:30 +0200 Mike Gabriel (365fa4f3e) * nx-X11/lib/X11/XKBMisc.c: Drop conditional always evaluating as True. 2016-06-29 13:17:04 +0200 Mike Gabriel (ed61433e1) * nx-X11/lib/X11/LiHosts.c: Drop unused variable (in XListHosts). 2016-06-29 13:10:08 +0200 Mike Gabriel (5e2e760d3) * Avoid 'siAddr' maybe being used uninitialized in XAddHost and XRemoveHost. 2016-06-29 12:53:21 +0200 Mike Gabriel (35dbbd7e4) * hw/nxagent/Exrensions.c: Post-RandR 1.5 update fix. Properly set rrProvider hook functions to NULL. 2016-06-29 12:50:14 +0200 Mike Gabriel (e02bdf929) * hw/nxagent/Args.c: Fix fprintf placeholder (%u -> %lu). 2016-06-29 12:45:45 +0200 Adam Jackson (7e21611db) * Remove fbpseudocolor 2016-06-29 12:37:22 +0200 Cyril Brulebois (3a54da8bc) * fb: Mark some variables as unused. 2016-06-29 12:38:31 +0200 Jeremy Huddleston (b91099b97) * Add _X_UNUSED attribute to designate unused variables and silence warnings 2016-06-29 12:18:52 +0200 Mike Gabriel (cef6d723c) * Xserver/composite/compint.h: Disable debugging in Copmosite extension. 2016-06-29 12:07:26 +0200 Mike Gabriel (f364bacf8) * Xserver/xfixes/region.c: Don't declare and set PictureScreenPtr ps (in ProcXFixesSetPictureClipRegion). Variable is not used. 2016-07-05 08:09:24 +0200 Mike Gabriel (854f3fa49) * Merge branch 'sunweaver-pr/proxy-to-proxy-over-unix-socket' into 3.6.x 2016-06-15 16:44:28 +0200 Mike Gabriel (5a22f2ec1) * test scripts: Add test scripts for testing Unix file socket support (i.e. proxy2proxy and proxy2agent sessions via Unix file sockets). (gh-sunweaver/pr/proxy-to-proxy-over-unix-socket) 2016-06-15 10:29:12 +0200 Mike Gabriel (c6e956512) * nxcomp/Loop.cpp: Add Unix file socket support for proxy <-> proxy connection. 2015-06-02 14:55:40 +0200 Salvador Fandino (b23dcd101) * merge code paths depending on acceptHost being "" 2015-06-02 15:35:50 +0200 Salvador Fandino (f706d774b) * remove now unused function ParseListenOption 2015-06-02 13:25:34 +0200 Salvador Fandino (c92a102ba) * rewrite WaitForRemote to build on top of ListenConnectionTCP 2015-06-02 12:54:15 +0200 Salvador Fandino (28736a888) * remove unused listenHost parameter 2015-06-02 12:34:20 +0200 Salvador Fandino (d6edd7c97) * Remove work around for OS/X that was doing nothing 2015-06-02 12:30:49 +0200 Salvador Fandino (d2e8551ef) * Simplify ParseListenOption 2015-06-02 10:31:53 +0200 Salvador Fandino (5ea2d901b) * rewrite SetupUnixSocket to use ListenConnectionUnix 2015-06-01 17:52:33 +0200 Salvador Fandino (c5a2cf82f) * Rework SetupTcpSocket to use ListenConnectionTCP 2016-07-04 22:55:23 +0200 Mike Gabriel (e0edae04d) * Merge branch 'sunweaver-pr/xerrordb-from-xorg' into 3.6.x 2016-06-28 20:30:42 +0200 Mike Gabriel (1bd2463a2) * libNX_X11 data files: Install libNX_X11 related data files. (gh-sunweaver/pr/xerrordb-from-xorg) 2016-07-04 16:37:55 +0200 Mike Gabriel (27b0b5723) * Merge branch 'sunweaver-pr/type-safe-swapping' into 3.6.x 2016-06-29 01:36:31 +0200 Mike Gabriel (286d83260) * Use internal temp variable for swap macros. Make swaps/swapl type safe (introducing wrong_size check at build time). (gh-sunweaver/pr/type-safe-swapping) 2016-06-15 16:46:10 +0200 Mike Gabriel (d1d859dfd) * test scripts: Update copyright headers. 2016-06-15 16:42:25 +0200 Mike Gabriel (b767ca5c3) * test scripts: Rename run-nxproxy2nxproxy-test -> run-nxproxy2nxproxy. 2016-07-02 14:11:38 +0200 Mike Gabriel (1dbd3c888) * Merge branch 'sunweaver-pr/backport-Xorg-memory-handling' into 3.6.x 2016-06-27 12:53:03 +0200 Mike Gabriel (e85808245) * debian/patches: Refresh patches after changes in upstream code. (gh-sunweaver/pr/backport-Xorg-memory-handling) 2016-06-28 16:55:26 +0200 Mike Gabriel (40e398409) * nx-X11/include/extensions/XKBsrv.h: Different memory handling when built with Xserver and with Xlib. 2016-06-27 12:12:31 +0200 Mike Gabriel (f779b2e3c) * os: Remove deprecated malloc/free wrappers, clean {X,XNF}{alloc,calloc,realloc,free,strdup} from pre-C89 baggage 2016-06-27 11:51:31 +0200 Mike Gabriel (ce40aec08) * nx-X11/programs/Xserver: Drop {X,x}calloc() macros, use calloc() instead. 2016-06-26 02:08:32 +0200 Mike Gabriel (74a5450bc) * nx-X11/programs/Xserver: Drop {X,x}realloc() macros, use realloc() instead. 2016-06-26 01:51:18 +0200 Mike Gabriel (2646fc254) * nx-X11/programs/Xserver: Drop {X,x}alloc() macros, use malloc() instead. 2016-06-26 01:38:22 +0200 Mike Gabriel (acf87144d) * nx-X11/programs/Xserver: Drop {X,x}free() macros, use free() instead. 2016-07-02 13:53:16 +0200 Mike Gabriel (279d37127) * Merge branch 'sunweaver-pr/protocols-version-h' into 3.6.x 2016-06-28 12:07:10 +0200 Mike Gabriel (487870fff) * Xserver/include/protocol-versions.h: Switch to having an Xserver-specific header file containing all use protocol versions. (gh-sunweaver/pr/protocols-version-h) 2016-06-28 12:06:50 +0200 Mike Gabriel (a08e2323e) * Xserver Imakefiles: Make sure NXAGENT_SERVER is defined for all extensions. 2016-07-01 16:08:55 +0200 Mike Gabriel (dd5f5b56b) * Merge branch 'sunweaver-pr/ld-loading-libX11-hack' into 3.6.x 2016-06-30 23:50:12 +0200 Mike Gabriel (5934d03ef) * Rework nxagent and nxproxy wrapper scripts. (gh-sunweaver/pr/ld-loading-libX11-hack) 2016-07-01 16:00:04 +0200 Mike Gabriel (da7261cfe) * Merge branch 'uli42-pr/drop_libNX_Xext' into 3.6.x 2016-07-01 13:54:11 +0200 Ulrich Sibiller (1cd7e35cb) * finally drop libNX_Xext 2016-07-01 13:54:10 +0200 Ulrich Sibiller (e78c5bc3c) * remove shm code from libNX_Xext 2016-07-01 00:55:53 +0200 Ulrich Sibiller (232c7ad91) * avoid conflicts when mixing own includes with upstream includes 2016-07-01 00:05:30 +0200 Ulrich Sibiller (e77e37ff0) * remove XShape code from libNX_Xext 2016-07-01 15:48:55 +0200 Mike Gabriel (2f19f2f66) * Merge branch 'sunweaver-pr/libXau-cleanup' into 3.6.x 2016-06-23 10:46:48 +0200 Mike Gabriel (204545286) * nxagent Xserver: Drop Kerberos code. Not used in nxagent. (gh-sunweaver/pr/libXau-cleanup) 2016-06-23 10:31:42 +0200 Mike Gabriel (26bf48bab) * library-cleanup: Don't build libNX_Xau anymore. Use system's libXau shared library. 2016-06-23 10:27:37 +0200 Mike Gabriel (b214c73b5) * nxauth: Drop nxauth tool completely, xauth can be successfully used with nxagent / nxproxy instead. 2016-07-01 14:02:52 +0200 Mike Gabriel (a3a295288) * Merge branch 'sunweaver-pr/debian-packaging-updates' into 3.6.x 2016-07-01 00:00:29 +0200 Mike Gabriel (12ca29bf5) * debian/*.dirs: Don't create directories in the Debian package. All handled well by the upstream Makefile. (gh-sunweaver/pr/debian-packaging-updates) 2016-06-23 21:33:23 +0200 Mike Gabriel (2d016f826) * roll-tarball.sh: Move out of debian/ folder into project's base folder. 2016-06-23 21:28:42 +0200 Mike Gabriel (82a8d595d) * debian/libxcompext3.symbols: Add symbols file for libXcompext3. 2016-06-23 21:13:20 +0200 Mike Gabriel (ba5f32cda) * nx-X11/extras/Mesa/src/mesa/shader/arbprogparse.c: Fix typo (grammer -> grammar). 2016-06-23 21:09:19 +0200 Mike Gabriel (7d66941ae) * debian/rules: Use buildflags.mk from dpkg-dev. Enable bindnow hardening flag. 2016-06-23 21:08:47 +0200 Mike Gabriel (56f776ced) * debian/control: Versioned B-D: dpkg-dev (>= 1.16.1.1). 2016-06-23 15:45:33 +0200 Mike Gabriel (2a2d7f0e2) * debian/control: Remove all Pre-Depends: fields from all bin:pkgs. 2016-06-22 12:14:00 +0200 Mike Gabriel (9663b1ce2) * debian/control: Bump Standards: to 3.9.8. (Various changes were needed). 2016-06-22 12:13:23 +0200 Mike Gabriel (87ce9b4b0) * debian/{control,compat}: Bump to DH compat level 9. 2016-06-22 12:08:49 +0200 Mike Gabriel (2e1ec6181) * debian/control: Use my DD address in Uploaders: field. 2016-06-22 12:08:35 +0200 Mike Gabriel (24ff7db2b) * debian/changelog: Suppress warnings from lintian about -0 revision in version string. 2016-06-22 10:26:15 +0200 Mike Gabriel (b4d7b9989) * debian/control: Drop various not-used-anymore libNX_* related packages. Add B:/R: to libnx-x11-{6,dev,6-dbg) to uninstall those package when upgrading to nx-libs 3.6.x. 2016-06-22 10:12:33 +0200 Mike Gabriel (6b423eefd) * roll-tarball.sh: Don't ship doc/X11-symbols/ in the lite (proxy-only) tarball derived from the nx-libs code tree. 2016-06-22 10:10:49 +0200 Mike Gabriel (908b930c9) * debian/rules: Don't attempt at removing $(CURDIR)/.preserve/. Not needed anymore since we removed the CODE-REDUCTION_* hacks from debian/rules. 2016-06-22 10:09:17 +0200 Mike Gabriel (593e15ca1) * debian/*: Drop non-multi-arch support (i.e. Debian squeeze, Ubuntu 10.04 and earlier). 2016-06-22 10:04:16 +0200 Mike Gabriel (3983b111a) * debian/*: Drop not-use-anymore CODE-REDUCTION_* files. 2016-07-01 13:46:26 +0200 Mike Gabriel (8307d4f33) * Merge branch 'sunweaver-pr/define-default-source-not-bsd+svid-source' into 3.6.x 2016-06-23 20:52:27 +0200 Mike Gabriel (da4410cce) * build flags: Use -D_DEFAULT_SOURCE instead of deprecated -D_BSD_SOURCE and -D_SVID_SOURCE. (gh-sunweaver/pr/define-default-source-not-bsd+svid-source) 2016-07-01 13:13:48 +0200 Mike Gabriel (4b3081c48) * Merge branch 'sunweaver-pr/drop-really-old-X10-API-code' into 3.6.x 2016-06-23 09:58:54 +0200 Mike Gabriel (f0bf303c8) * nx-X11/lib/X10: Drop really ancient X10 API code. Not used within nxagent. (gh-sunweaver/pr/drop-really-old-X10-API-code) 2016-07-01 13:10:06 +0200 Mike Gabriel (b666a3776) * Merge branch 'sunweaver-pr/properly-apply-optflags-at-buildtime' into 3.6.x 2016-06-23 14:27:15 +0200 Mike Gabriel (d650a0b47) * OPTFLAGS: Properly propagate build option flags to nxcomp{,ext,shad} and the nx-X11 build scripts. (gh-sunweaver/pr/properly-apply-optflags-at-buildtime) 2016-06-23 09:58:54 +0200 Mike Gabriel (4693c3203) * nx-X11/lib/X10: Drop really ancient X10 API code. Not used within nxagent. 2016-06-23 14:27:15 +0200 Mike Gabriel (a1e9abc78) * OPTFLAGS: Properly propagate build option flags to nxcomp{,ext,shad} and the nx-X11 build scripts. 2016-06-30 22:41:00 +0200 Mike Gabriel (4cbfc5f98) * debian/libnx-x11-6.symbols: Update symbols (added: _XEatDataWords@Base 3.5.99.0, _XGetRequest@Base 3.5.99.0). 2016-06-30 15:41:03 +0200 Mike Gabriel (ba10ceffc) * Merge branch 'sunweaver-pr/drop-embedded-imake-and-makedepend' into 3.6.x 2016-06-30 11:30:00 +0200 Mihai Moldovan (81f2c9c7d) * nx-libs.spec: let x2goagent package satisfy x2goagent-virtual. 2016-06-30 11:09:04 +0200 Mihai Moldovan (b6bcc2410) * nx-libs.spec: add new x2goagent.options file to installed file list of x2goagent package. 2016-06-30 11:08:14 +0200 Mihai Moldovan (b8d8fdaad) * nx-libs.spec: copy new debian/x2goagent.options file into build environment, analogous to what debian/roll-tarballs.sh does. 2016-06-30 10:28:52 +0200 Mihai Moldovan (f3c5f881b) * debian/x2goagent.install: add new x2goagent.options file. 2016-06-30 10:27:31 +0200 Mihai Moldovan (112f0f816) * debian/rules: symlink and remove new debian/x2goagent.options file into/from build environment. 2016-06-30 10:23:47 +0200 Mihai Moldovan (9b0868985) * debian/Makefile.nx-libs: install/destroot new x2goagent.options file. 2016-06-30 10:18:51 +0200 Mihai Moldovan (7c531a5be) * debian/roll-tarballs.sh: copy new debian/x2goagent.options file into real tarball environment. 2016-06-30 10:00:08 +0200 Mihai Moldovan (ae590fe4f) * debian/: add x2goagent.options file for compatibility with x2goserver nightly. 2016-06-22 13:22:06 +0200 Mike Gabriel (298744e94) * nx-X11/Makefile: Drop build support for World.Win32 and World.OS2. Not our target platforms. (gh-sunweaver/pr/drop-embedded-imake-and-makedepend) 2016-06-22 12:41:50 +0200 Mike Gabriel (2f3d394e8) * nx-X11/config/{imake,makedepend}: Use system-wide available imake and makedepend tools. 2016-06-30 00:26:37 +0200 Mike Gabriel (5b36f6443) * Merge branch 'sunweaver-pr/backport-xgetrequest-and-xeatdatawords' into 3.6.x 2016-06-29 21:44:08 +0200 Ulrich Sibiller (bd2650ca0) * Port _XEatDataWords (gh-sunweaver/pr/backport-xgetrequest-and-xeatdatawords) 2016-06-29 21:25:24 +0200 Ulrich Sibiller (36d0fac77) * Backport of _XGetRequest() 2016-06-29 11:21:09 +0200 Mike Gabriel (3314c24a7) * Merge branch 'sunweaver-pr/drop-x2goagent' into 3.6.x (gh-salva/3.6.x) 2016-06-22 08:16:35 +0200 Mike Gabriel (c355dc91d) * Makefile,debian/*,nx-libs.spec,: Drop references to X2Go Project, esp. drop x2goagent. (gh-sunweaver/pr/drop-x2goagent) 2016-06-29 11:13:34 +0200 Mike Gabriel (b9fb7a05a) * Merge branch 'sunweaver-pr/libnx-xext-drop-unused-extensions' into 3.6.x 2016-06-28 12:20:00 +0000 Mike Gabriel (f051b7a2d) * libNX_Xext: Drop unused extensions: DPMS, XTestExt1, XSync, XSecurity. (gh-sunweaver/pr/libnx-xext-drop-unused-extensions) 2016-06-28 12:13:27 +0000 Mike Gabriel (e9857d5ea) * nx-X11/lib/Xext/Imakefile: Serialize parameters and make Imakefile changes more trackable. 2016-06-28 12:05:01 +0000 Mike Gabriel (d595125a1) * fix wrong bin:package for Xext proto headers: Move dpmsstr.h and securstr.h from Xext devel package into proto header package. 2016-06-28 11:43:06 +0000 Mike Gabriel (3ded4a2d6) * Fix linking order hack in nxagent. (gh-sunweaver/pr/linking-order-fix) 2016-06-28 04:13:10 +0200 Mihai Moldovan (7bdc7ef23) * debian/changelog: add entry for last change. 2016-06-15 16:42:58 +0200 Mike Gabriel (b83a14843) * test scripts: Add run-nxagent test script. 2016-06-27 01:46:51 +0200 Mihai Moldovan (ba5a1074f) * debian/control: add myself as uploader. 2016-06-25 01:35:40 +0200 Mihai Moldovan (975511c87) * Merge branch 'sunweaver-pr/hw-nxagent-drop-duplicate-Xserver-code_disable-Xserver-code-and-include-in-nxagent' into arctica-3.6.x 2016-05-02 12:14:14 +0200 Mike Gabriel (a5befd4e2) * hw/nxagent: Drop code referring to the following removed Xserver extensions: XAPPGROUP, LBX, XEVIE. (gh-sunweaver/pr/hw-nxagent-drop-duplicate-Xserver-code_disable-Xserver-code-and-include-in-nxagent) 2016-05-02 11:29:53 +0200 Mike Gabriel (3bdcd1727) * hw/nxagent/NX*.c: Amend re-introduced nxagent warnings by fixing the corresponding code section in files included from "somewhere" in nx-X11/programs/Xserver/. 2016-05-01 23:02:20 +0200 Mike Gabriel (a5c7b248e) * hw/nxagent/NXdixfonts.c: Shrink file, drop duplicate code that can identically be found in dix/dixfonts.c. Also remove NX'ish code from dix/dixfonts.c. 2016-05-01 21:58:22 +0200 Mike Gabriel (2ba500864) * hw/nxagent/NXdispatch.c: Shrink file, drop duplicate code that can identically be found in dix/dispatch.c. 2016-04-26 05:59:56 +0200 Mike Gabriel (a43461335) * hw/nxagent/NXproperty.c: Shrink file, drop duplicate code that can identically be found in dix/property.c. 2016-04-11 14:53:15 +0200 Mike Gabriel (c6f86b3b2) * hw/nxagent/NXshm.c: Shrink file, drop duplicate code that can identically be found in Xext/shm.c. 2016-04-10 01:57:57 +0200 Mike Gabriel (51e4ed0fc) * hw/nxagent/NXxvdisp.c: Shrink file, drop duplicate code that can identically be found in Xext/xvdisp.c. 2016-04-18 13:02:34 +0200 Mike Gabriel (add881931) * hw/nxagent/NXevents.c: Shrink file, drop duplicate code that can identically be found in dix/events.c. 2016-04-18 08:19:05 +0200 Mike Gabriel (0571ece6a) * hw/nxagent/NXglyph.c: Shrink file, drop duplicate code that can identically be found in render/glyph.c. 2016-04-18 08:10:08 +0200 Mike Gabriel (12130a4d9) * hw/nxagent/NXglyphcurs.c: Shrink file, drop duplicate code that can identically be found in dix/glyphcurs.c. 2016-04-13 15:29:32 +0200 Mike Gabriel (a64855879) * hw/nxagent/NXrender.c: Shrink file, drop duplicate code that can identically be found in render/render.c. 2016-04-13 15:28:33 +0200 Mike Gabriel (778e83a3c) * hw/nxagent/NX{glyphstr,picturestr}.h: Don't ship the complete header files in nxagent's code base. Rather replace structures we need modified only. 2016-04-13 11:33:33 +0200 Mike Gabriel (de03d6227) * NXrenderint.h: Move into subfolder X11/include/ and rename to Xrender_nxagent.h. (Like we have done with all other non-public Xlib related header files that are required for building nxagent. 2016-04-11 16:37:00 +0200 Mike Gabriel (ab6bb890e) * hw/nxagent/NXresource.c: Shrink file, drop duplicate code that can identically be found in dix/resource.c. 2016-04-11 13:46:36 +0200 Mike Gabriel (1384776fd) * Xserver/dix/window.c: Don't reintroduce build warnings with previous commit due to now-unnecessary assignements of pScreen pointers. 2016-04-11 13:41:11 +0200 Mike Gabriel (4690d6b71) * hw/nxagent/NXwindow.c: Shrink file, drop duplicate code that can identically be found in dix/window.c. 2016-04-10 02:45:24 +0200 Mike Gabriel (e60f281aa) * hw/nxagent/NXglxext.c: Shrink file, drop duplicate code that can identically be found in GL/glx/glxext.c. 2016-04-10 02:37:19 +0200 Mike Gabriel (b4e2ec709) * Xserver/GL/glx/Imakefile: Serialize parameters and make Imakefile changes more trackable. 2016-04-09 00:36:40 +0200 Mike Gabriel (0c29f81f1) * hw/nxagent/NXpicture.c: Shrink file, drop duplicate code that can identically be found in render/picture.c. 2016-04-08 13:53:36 +0200 Mike Gabriel (809fed649) * hw/nxagent/NXmiexpose.c: Shrink file, drop duplicate code that can identically be found in mi/miexpose.c. 2016-04-08 13:52:59 +0200 Mike Gabriel (69ac98165) * hw/nxagent/Pixmaps.h: Make RESTYPE well-defined by adding resource.h to includes. 2016-04-08 10:01:30 +0200 Mike Gabriel (5088a6d13) * Xserver/mi/Imakefile: Serialize parameters and make Imakefile changes more trackable. 2016-04-08 09:45:32 +0200 Mike Gabriel (ae1a218d1) * hw/nxagent/NXmiglyph.c: Shrink file, drop code that can be identically found in render/miglyph.c. 2016-04-08 09:38:20 +0200 Mike Gabriel (500544f82) * hw/nxagent/NXmitrap.c: Shrink file, drop duplicate code that can identically be found in render/mitrap.c. 2016-04-08 09:26:12 +0200 Mike Gabriel (8fab4afbb) * hw/nxagent/NXmiwindow.c: Drop complete file. 2016-04-07 12:22:51 +0200 Mike Gabriel (148f75067) * hw/nxagent/NXdamage.c: Shrink file, drop duplicate code that can identically be found in miext/damage/damage.c. 2016-04-07 09:36:18 +0200 Mike Gabriel (fd31518f4) * NXcomposite.h: Move fake header file NXcomposite.h to hw/nxagent/X11/include/ and drop all symbols that are not explicitly used by nxagent. 2016-04-07 00:54:44 +0200 Mike Gabriel (28acdaff7) * Xserver/hw/nxagent: Drop NXcompositeext.h, it is a duplicate of nx-X11/include/extensions/composite.h. 2016-04-06 23:31:52 +0200 Mike Gabriel (ca1e85710) * hw/nxagent/NXextension.c: Shrink file, drop duplicate code that is indentically found in dix/extension.c. 2016-04-06 23:18:07 +0200 Mike Gabriel (5d1604616) * Xserver/dix/Imakefile: Serialize parameters and make Imakefile changes more trackable. 2016-06-25 00:38:01 +0200 Mike Gabriel (9df153668) * Merge branch 'uli42-pr/run_xinerama_without_debug_output' into 3.6.x 2016-06-24 21:22:01 +0200 Ulrich Sibiller (b7d7ff3e4) * libX11: Extend Event functions to handle IOErrors 2016-06-25 00:31:35 +0200 Ulrich Sibiller (e079b0b35) * Screen.c: fix RRGetInfo call (gh-uli42/pr/run_xinerama_without_debug_output, gh-uli42/pr/run_xinerama_without_debug_outout) 2016-06-25 00:31:05 +0200 Ulrich Sibiller (cec31e2f0) * Xinerama: undef debug/test flags 2016-06-25 00:17:10 +0200 Mike Gabriel (9c1275f58) * Merge branch 'uli42-pr/fix-crash-in-XPeekEvent' into 3.6.x 2016-06-24 21:22:01 +0200 Ulrich Sibiller (5ee04c24c) * libX11: Extend Event functions to handle IOErrors 2016-06-21 04:12:07 +0200 Mike Gabriel (17f3e3bc5) * Merge branch 'sunweaver-pr/xrandr-extension-upgrade-1.5' into 3.6.x 2016-06-20 17:21:33 +0200 Mike Gabriel (4c8fc6be8) * debian/patches: Update 102_xserver-xext_set-securitypolicy-path.debian.patch. (gh-sunweaver/pr/xrandr-extension-upgrade-1.5) 2016-06-20 11:10:06 +0200 Mike Gabriel (c2b1f489d) * Backport RANDR proto version 1.5 to nx-X11's Xserver. 2016-06-20 15:53:20 +0200 Mike Gabriel (2e5b98986) * Move matrix operations from X server to pixman 0.13.2. Required code de-duplication in nxagent. (Will be fixed by ArcticaProject/nx-libs#120 later on). 2016-06-20 15:51:55 +0200 Mike Gabriel (36e17bdc6) * [render] Split out filter finding from filter setting. Required code de-duplication in nxagent. (Will be fixed by ArcticaProject/nx-libs#120 later on). 2016-06-20 15:50:05 +0200 Mike Gabriel (3f4e503d6) * nx-libs.spec, debian/control: versioned B-R / B-D: pixman-1 (>= 0.13.2). 2016-06-20 15:43:35 +0200 Mike Gabriel (f9dbc64f0) * Move matrix operations from X server to pixman 0.13.2, handle RandR transform matrices in floating point. 2016-06-20 15:36:52 +0200 Mike Gabriel (6859815ec) * Call pScreen->ConstrainCursorHarder from the position update path 2016-06-20 15:29:28 +0200 Mike Gabriel (a60c22f45) * dix/randr: add a hooks into screen to (a) replace scanout pixmap and (b) for additional cursor confinement 2016-06-20 13:25:23 +0200 Mike Gabriel (19ebd7722) * include: add version_compare helper function 2016-06-20 13:19:08 +0200 Mike Gabriel (21c3d20fb) * [render] Split out filter finding from filter setting. 2016-06-20 12:21:39 +0200 Mike Gabriel (e38388174) * debian/patches-pending-evaluation: Adapt fix-icon-and-clipboard.patch to removal of the WindowTable array. 2016-06-20 16:51:59 +0200 Mike Gabriel (8c7d7bed9) * hw/nxagent/NXresource.c: remove caching of drawables and graphics contexts. The security checks simply bypass the cached values so they are unused. Required code de-duplication in nxagent. (Will be fixed by ArcticaProject/nx-libs#120 later on). 2016-06-20 16:45:38 +0200 Mike Gabriel (e6f2f6427) * dix: remove caching of drawables and graphics contexts. The security checks simply bypass the cached values so they are unused. 2016-06-20 16:47:28 +0200 Mike Gabriel (274598651) * Xserver/dix/events.c: Don't declare and assign unused pScreen. 2016-06-20 12:18:53 +0200 Mike Gabriel (c61bb8cc5) * Move each screen's root-window pointer into ScreenRec. 2016-06-20 11:16:08 +0200 Mike Gabriel (590862d39) * Centralize declaration of ConnectionInfo. 2016-06-20 11:21:46 +0200 Mike Gabriel (560fd4e5f) * nxagent/hw/NXextension.c: Allow CloseDownProc to be NULL. Required code de-duplication in nxagent. (Will be fixed by ArcticaProject/nx-libs#120 later on). 2016-06-20 11:12:11 +0200 Mike Gabriel (4aec11346) * Allow CloseDownProc to be NULL. 2016-06-07 10:26:58 +0200 Mike Gabriel (e440ea768) * randr extension: Convert to Xorg coding style. 2016-06-07 10:26:12 +0200 Mike Gabriel (7f7c96c7c) * Copy x-indent.sh and x-indent-all.sh from xorg/util/modular. 2016-06-07 10:14:50 +0200 Mike Gabriel (b943cfe2a) * Drop trailing whitespaces (randr extension) 2016-05-31 16:12:15 +0200 Adam Jackson (e2b0f279e) * randr: Remove mirandr 2016-05-31 16:11:40 +0200 Mike Gabriel (6343fa664) * Xserver/randr/Imakefile: Serialize parameters and make Imakefile changes more trackable. 2016-06-21 03:56:29 +0200 Mike Gabriel (3db9a757f) * hw/nxagent/Handlers.c: Regression fix since 6051dec. Close unclosed '#ifdef TEST'. 2016-06-18 19:50:10 +0200 Mike Gabriel (9de3d26ef) * hw/nxagent/Options.h: Grammar fix in comment. 2016-06-10 01:05:58 +0200 Mike Gabriel (d13049403) * Properly enable/disable Xinerama support in nxagent via cmdline options provider in Xserver/os/utils.c. 2016-06-09 16:24:10 +0200 Mike Gabriel (059f03188) * noRRXineramaExtension: Make Boolean configurable via new cmdline switch (+|-rrxinerama). 2016-06-17 01:45:40 +0000 Mihai Moldovan (4d6d3c567) * {nx-X11/programs/Xserver/hw/nxagent/{{Args,Handlers,Image,Options}.c,Options.h},nxcomp/{Loop,Misc}.cpp}: add configurable sleep delay if session is suspended. 2016-06-13 01:56:07 +0200 Mike Gabriel (04d2fe3ae) * nxagentReversePointerMap: Don't assume Xevent.xbutton.button is always greater than zero. We have seen Xevent.xbutton.button being set to AnyButton (equaling 0). 2016-05-27 15:52:50 +0000 Mihai Moldovan (129cc6afd) * nx-X11/programs/Xserver/hw/nxagent/Handlers.h: fix stack smashing related to different data type sizes between Xserver and Xlib. 2016-06-21 03:56:29 +0200 Mike Gabriel (9013a24da) * hw/nxagent/Handlers.c: Regression fix since 6051dec. Close unclosed '#ifdef TEST'. 2016-06-18 19:50:10 +0200 Mike Gabriel (d5cc12c2a) * hw/nxagent/Options.h: Grammar fix in comment. 2016-06-18 19:46:28 +0200 Mike Gabriel (c31ae1eed) * Merge branch 'sunweaver-pr/rrxinerama-vs-panoramix-with-disable-support' into 3.6.x 2016-06-10 01:05:58 +0200 Mike Gabriel (4b4a6a35c) * Properly enable/disable Xinerama support in nxagent via cmdline options provider in Xserver/os/utils.c. (gh-sunweaver/pr/rrxinerama-vs-panoramix-with-disable-support) 2016-06-09 16:24:10 +0200 Mike Gabriel (3f8aa38fe) * noRRXineramaExtension: Make Boolean configurable via new cmdline switch (+|-rrxinerama). 2016-06-18 09:27:39 +0200 Mike Gabriel (2dd1a1fe6) * Merge branch 'Ionic-feature/configurablesleep' into 3.6.x 2016-06-17 01:45:40 +0000 Mihai Moldovan (6051dec4a) * {nx-X11/programs/Xserver/hw/nxagent/{{Args,Handlers,Image,Options}.c,Options.h},nxcomp/{Loop,Misc}.cpp}: add configurable sleep delay if session is suspended. (gh-ionic/feature/configurablesleep, gh-Ionic/feature/configurablesleep) 2016-06-15 00:39:04 +0200 Mike Gabriel (3dea5a88c) * Merge branch 'sunweaver-pr/nxagentReversePointerMapping-negative-index' into 3.6.x 2016-06-13 01:56:07 +0200 Mike Gabriel (5e17d05aa) * nxagentReversePointerMap: Don't assume Xevent.xbutton.button is always greater than zero. We have seen Xevent.xbutton.button being set to AnyButton (equaling 0). (gh-sunweaver/pr/nxagentReversePointerMapping-negative-index) 2016-06-13 21:07:38 +0200 Mike Gabriel (61d0fbea7) * Merge branch 'Ionic-bugfix/Xserver-Xlib-type-mismatch' into 3.6.x 2016-05-27 15:52:50 +0000 Mihai Moldovan (639a2c36f) * nx-X11/programs/Xserver/hw/nxagent/Handlers.h: fix stack smashing related to different data type sizes between Xserver and Xlib. (gh-ionic/bugfix/Xserver-Xlib-type-mismatch, gh-Ionic/bugfix/Xserver-Xlib-type-mismatch) 2016-06-13 13:13:55 +0200 Mike Gabriel (35613d1dc) * Merge branch 'sunweaver-pr/nxcomp+ext+shad-system-wide-headers' into 3.6.x 2016-04-06 22:09:31 +0200 Mike Gabriel (f5eff9bc0) * nx-X11/programs/Xserver: Include nxcomp{,ext,shad} headers like one would do with system-wide shared libraries. (gh-sunweaver/pr/nxcomp+ext+shad-system-wide-headers) 2016-04-05 14:29:02 +0200 Mike Gabriel (2f706cbeb) * nxcomp/Makefile.in: Only install MD5.h, NX.h, NXalert.h, NXpack.h, NXproto.h and NXvars.h as publicly available header files. 2016-04-05 14:20:24 +0200 Mike Gabriel (f55249dc6) * nxcomshad/Makefile.in: Only install Shadow.h as publicly available header file. 2016-06-09 16:26:51 +0200 Mike Gabriel (734da2139) * hw/nxagent/Args.c: Fix syntax errors for builds using -UPANORAMIX. 2016-06-03 14:58:02 +0200 Mike Gabriel (4998e62c4) * nx-X11/programs/Xserver/Imakefile: Don't overlink nxagent. Linking against libXrandr and libXtst is not necessary for nxagent. 2016-06-03 14:42:54 +0200 Mike Gabriel (15440cad7) * nx-X11/config/cf/lnxLib.tmpl requires post-library removal cleanup: Drop references to dropped X11 extension client libraries. 2016-06-01 21:57:36 +0200 Mihai Moldovan (3d5433833) * Merge branch 'sunweaver-pr/xserver-drop-outdated-xext-extensions' into arctica-3.6.x 2016-04-26 23:44:55 +0200 Mike Gabriel (b2145323c) * XTRAP: Drop all Xserver code blocks that relate to removed XTRAP extension. (gh-sunweaver/pr/xserver-drop-outdated-xext-extensions) 2016-04-19 12:04:57 +0200 Mike Gabriel (8c1d16dae) * XFreeXDGA: Drop all Xserver code blocks that relate to removed XFreeXDGA extension. 2016-04-19 12:02:12 +0200 Mike Gabriel (2ff2c92bb) * XF86MISC: Drop all Xserver code blocks that relate to removed XF86MISC extension. 2016-04-19 11:58:37 +0200 Mike Gabriel (004f8f896) * MITMISC: Drop all Xserver code blocks that relate to removed MITMISC extension. 2016-04-19 11:56:20 +0200 Mike Gabriel (e14231443) * XF86VIDMODE: Drop all Xserver code blocks that relate to removed XF86VIDMODE extension. 2016-04-19 11:53:59 +0200 Mike Gabriel (74a1e4e83) * MULTIBUFFER: Drop all Xserver code blocks that relate to removed MULTIBUFFER extension. 2016-04-19 11:52:13 +0200 Mike Gabriel (2f0d2d388) * LBX: Drop all Xserver code blocks that relate to removed LBX extension. 2016-04-19 11:36:27 +0200 Mike Gabriel (e80842cc4) * EVI: Drop all Xserver code blocks that relate to removed EVI extension. 2016-04-19 11:34:20 +0200 Mike Gabriel (25ffbbb22) * FONTCACHE: Drop all Xserver code blocks that relate to removed FONTCACHE extension. 2016-04-19 11:02:14 +0200 Mike Gabriel (3aedac174) * XEVIE: Drop all Xserver code blocks that relate to removed XEVIE extension. 2016-04-19 11:31:48 +0200 Mike Gabriel (cd39f1393) * XFree86DGA: Drop all Xserver code blocks that relate to removed XFree86DGA extension. 2016-04-19 11:07:49 +0200 Mike Gabriel (a25c0de09) * TOGCUP: Drop all Xserver code blocks that relate to removed TOGCUP extension. 2016-04-19 11:05:41 +0200 Mike Gabriel (683415dfe) * XAPPGROUP: Drop all Xserver code blocks that relate to removed XAPPGROUP extension. 2016-03-01 20:55:27 +0000 Mike Gabriel (9bc6ff269) * Drop X11 extensions not shipped with recent X.Org server versions anymore: 2016-05-31 12:44:02 +0200 Nito Martinez (c646808bc) * Fix debugging function for Loop.cpp. getDebugSpec was replaced by << operand in ChannelEndPoint.{h|cpp}, fixes #130 2016-05-31 12:12:39 +0200 Mike Gabriel (e3051f7a7) * Merge branch 'nitomartinez-3.6.x' into 3.6.x (origin/3713346f, gh-mjtrangoni/3713346f, gh-Etersoft/3713346f) 2016-05-30 16:10:32 +0000 Mihai Moldovan (36c3613a7) * nx-X11/programs/Xserver/{hw/nxagent/NX,render/}picture.c: add and use new function ReduceCompositeOp(). 2016-04-09 19:41:48 +0000 Mihai Moldovan (62aac6950) * nx-X11/programs/Xserver/composite/Imakefile: add new file to SRCS and OBJS and define -DNXAGENT_SERVER while building the Composite extension to disable some code that depends upon a newer X.Org architecture. 2016-04-09 19:40:24 +0000 Mihai Moldovan (7d2dd2aac) * misc nx-X11/{programs/Xserver/composite,include/extensions}: update to Composite 0.4 - with changes where neccessary and rough edges. 2016-04-09 19:38:12 +0000 Mihai Moldovan (fe3fa5ef3) * nx-X11/programs/Xserver/{dix/{colormap.c,window.c},hw/nxagent/NXwindow.c,include/{colormap,window{,str}}.h}: backport features needed for Composite 0.4. 2016-05-31 12:09:23 +0200 Mike Gabriel (4a9c1b946) * Merge branch 'Ionic-feature/composite-update' into 3.6.x 2016-05-31 11:23:40 +0200 Nito Martinez (035995a8c) * display version number in nxcomp log, fixes #127 2016-05-30 16:10:32 +0000 Mihai Moldovan (cad9f4ef8) * nx-X11/programs/Xserver/{hw/nxagent/NX,render/}picture.c: add and use new function ReduceCompositeOp(). (gh-ionic/feature/composite-update, gh-Ionic/feature/composite-update) 2016-04-09 19:41:48 +0000 Mihai Moldovan (dd9eb3adf) * nx-X11/programs/Xserver/composite/Imakefile: add new file to SRCS and OBJS and define -DNXAGENT_SERVER while building the Composite extension to disable some code that depends upon a newer X.Org architecture. 2016-04-09 19:40:24 +0000 Mihai Moldovan (be824bc8d) * misc nx-X11/{programs/Xserver/composite,include/extensions}: update to Composite 0.4 - with changes where neccessary and rough edges. 2016-04-09 19:38:12 +0000 Mihai Moldovan (f7cff021e) * nx-X11/programs/Xserver/{dix/{colormap.c,window.c},hw/nxagent/NXwindow.c,include/{colormap,window{,str}}.h}: backport features needed for Composite 0.4. 2016-05-13 06:19:21 +0200 Mihai Moldovan (aba2a534f) * Merge branch 'sunweaver-pr/nxagent-no-compiler-warnings' into arctica-3.6.x 2016-05-03 19:42:46 +0200 Mike Gabriel (52dc49607) * hw/nxagent/Display.c: Avoid incompatible pointer type. (gh-sunweaver/pr/nxagent-no-compiler-warnings) 2016-05-03 19:28:48 +0200 Mike Gabriel (a0e5589ed) * hw/nxagent/Display.c: Define Pixmap from XlibPixmap before including Icons.h (which includes hw/nxagent/X11/include/xpm_nxagent.h). 2016-05-03 17:49:54 +0200 Mike Gabriel (e79fe3b9a) * hw/nxagent/Holder.c: Define Pixmap from XlibPixmap before including hw/nxagent/X11/include/xpm_nxagent.h. 2016-04-19 10:43:40 +0200 Mihai Moldovan (b91135b0c) * hw/nxagent/Events.c: Avoid '#endif #ifdef DEBUG' blocks. 2016-03-22 01:11:55 +0100 Mike Gabriel (c2de5f198) * hw/nxagent/NXmiexpose.c: Initialize all items of the newValues[] array. 2016-03-21 22:49:25 +0100 Mike Gabriel (021023202) * hw/nxagent/Keystroke.c: Fix warning: pointer type mismatch in conditional expression. 2016-03-21 22:37:38 +0100 Mike Gabriel (00059798d) * hw/nxagent/Window.c: Initialize tmp_mask and attributes.event_mask with NoEventMask. 2016-03-21 22:22:07 +0100 Mike Gabriel (7251ef492) * hw/nxagent/Colormap.c: Don't declare and assign flexibility variable if not used later on. 2016-03-21 16:36:38 +0100 Mike Gabriel (634484bb3) * hw/nxagent/GCOps.c: Don't declare and assign oldDstxyValue if not used later on. 2016-03-21 16:36:15 +0100 Mike Gabriel (e8042c9ff) * hw/nxagent/GC.c: Don't declare and assign flexibility variable if not used later on. 2016-03-21 16:32:41 +0100 Mike Gabriel (7876d1f28) * hw/nxagent/Events.c: Only declare and assign message_data and box variables if compiled with -DTEST / -DDEBUG (plus drop commented out code). 2016-03-21 16:31:49 +0100 Mike Gabriel (30cd3a6c2) * hw/nxagent/Display.c: Don't declare and assign packMethod / packQuality if not used later on. 2016-03-21 16:14:00 +0100 Mike Gabriel (ab196f3a1) * hw/nxagent/NXrender.c: Don't declare and assign the colors variable, if not used later on. 2016-03-21 16:11:46 +0100 Mike Gabriel (ce8fb1f93) * HAVE_STDINT_H: Always include . 2016-05-02 15:38:30 +0200 Mike Gabriel (e3e451629) * hw/nxagent/NXdixfonts.c: Fix implicit declaration for register_fpe_functions(). 2016-03-21 15:54:24 +0100 Mike Gabriel (fb832b01e) * Adapt API for MakeAtom() and CopyISOLatin1Lowered to latest changes in X.org. 2016-03-21 14:18:42 +0100 Mike Gabriel (5e6b72dc7) * hw/nxagent/NXdixfonts.c: Don't include . No symbol needed from that header file. 2016-03-21 11:55:31 +0100 Mike Gabriel (23d3821f0) * hw/nxagent/NXpicture.c: Don't declare anything in empty function nxagentReconnectPictFormat. 2016-03-21 11:54:55 +0100 Mike Gabriel (292d88d07) * hw/nxagent/NXglyphcurs.c: Don't declare and set gcval, if not being used later on. 2016-03-21 09:48:11 +0100 Mike Gabriel (182569bf6) * hw/nxagent/Keyboard.c: The ret variable is only used later on when compiled with -DTEST. 2016-03-21 09:47:29 +0100 Mike Gabriel (66f889542) * hw/nxagent/Handlers.c: Don't declare and assign result variable if not used later on. 2016-03-21 09:43:02 +0100 Mike Gabriel (fc393174c) * hw/nxagent/Keyboard.c: Don't declare and set XkbDescPtr xkb if not used later on. 2016-03-21 09:41:16 +0100 Mike Gabriel (eb682184c) * hw/nxagent/*.c: Drop various declarations of unused ScreenPtr pScreen. 2016-03-18 16:46:34 +0100 Mike Gabriel (b5b7a2d26) * hw/nxagent/Screen.c: Cast proper types before handing values over to fprintf(). 2016-03-18 16:45:59 +0100 Mike Gabriel (ab50f84b5) * hw/nxagent/Screen.c: Drop various unused variables. 2016-03-18 16:35:43 +0100 Mike Gabriel (ef287b54f) * hw/nxagent/Screen.h: Provide prototype for nxagentAdjustRandRXinerama(). Avoid implicit-declaration compiler warning. 2016-03-18 16:34:43 +0100 Mike Gabriel (72386e171) * hw/nxagent/Screen.c: Correctly use already defined MIN/MAX macros. 2016-03-18 16:27:09 +0100 Mike Gabriel (7d3d47f1f) * hw/nxagent/Window.c: Don't declare "XWindowChanges changes;" and later not use it. 2016-03-18 16:17:30 +0100 Mike Gabriel (5ea2457ef) * hw/nxagent/Pixmap.c: pBool pointer is only required when compiled in -DTEST mode. 2016-03-18 16:15:29 +0100 Mike Gabriel (08d384841) * hw/nxagent/Extension.c: Don't declare pRandRScrPriv without using it later on. 2016-03-18 16:08:45 +0100 Mike Gabriel (802f58163) * hw/nxagent/Rootless.c: Type cast type Atom to type long unsigned int before handing it over to %lu in fprintf(). 2016-03-18 16:06:59 +0100 Mike Gabriel (c206a0c69) * hw/nxagent/Splash.c: Drop unused variable declaration "XPoint m[12];". 2016-03-18 16:05:01 +0100 Mike Gabriel (5bbdbfce2) * hw/nxagent/Clipboard.c: The result variable is only needed when combiled with -DDEBUG. 2016-03-18 15:59:58 +0100 Mike Gabriel (f3f0a6b4b) * hw/nxagent/Drawable.c: RegionNumRects returns int, not long int anymore. 2016-03-18 13:06:30 +0100 Mike Gabriel (120204631) * Add REGION_ macros for source compatibility with existing drivers. 2016-03-18 13:05:05 +0100 Mike Gabriel (b0e69fe35) * Change region implementation names to eliminate the 'mi' prefix 2016-03-18 04:49:09 +0100 Keith Packard (288136514) * Move mi/miregion.c to dix/region.c 2016-03-18 05:13:43 +0100 Mike Gabriel (d9e7f6ae4) * pixman-devel: Build against shared library pkg-config(pixman-1). 2016-03-18 05:11:40 +0100 Mike Gabriel (4a8d6eca3) * Change region implementation from macros to inline functions. 2016-03-16 11:11:43 +0100 Mike Gabriel (63f1fff8f) * Rename region macros to eliminate screen argument 2016-03-04 16:12:12 +0100 Mike Gabriel (28ba87780) * gcc: Build using -std=c99 instead of -ansi. 2016-03-16 11:08:49 +0100 Mike Gabriel (101c895e6) * fix-patch-whitepspace: Copy script from X.Org's xserver Git repo. 2016-03-16 08:05:01 +0100 Mike Gabriel (eaa19eb55) * NXwindow.c: Don't set w and h, not used later on. 2016-03-22 14:23:12 +0100 Mike Gabriel (6c6b6b962) * lib/Imakefile: Drop $(XINERAMADIR) from nx-X11/lib/Imakefile. (gh-sunweaver/3.6.x) 2016-04-27 14:00:57 +0200 Mike Gabriel (2137ee7e2) * Merge branch 'sunweaver-pr/nxcomp-unix-sockets-for-channels' into 3.6.x 2016-04-20 16:22:56 +0200 Salvador Fandino (3713346f3) * Provide support for channel endpoints being UNIX file sockets in addition to being TCP/IP sockets. (gh-sunweaver/pr/nxcomp-unix-sockets-for-channels) 2016-04-27 13:56:55 +0200 Mike Gabriel (b326eda73) * nxcomp: Rephrase comment in previous commit. 2016-04-27 13:54:56 +0200 Mike Gabriel (416fc186b) * Merge branch 'fcarvajaldev-3.6.x-nxcomp-amend-compiler-warnings' into 3.6.x 2016-04-25 12:53:00 +0200 Fernando Carvajal (a436cba04) * Clean up compiler warnings in nxcomp 2016-04-26 22:35:00 +0200 Mihai Moldovan (12104a232) * Merge branch 'sunweaver-pr/libxrender-cleanup' into arctica-3.6.x 2015-06-25 05:37:03 +0200 Mike Gabriel (ebcb6a6e1) * library-cleanup: Don't build libNX_Xrender anymore. Use system's libXrender shared library. (gh-sunweaver/pr/libxrender-cleanup) 2016-04-20 16:16:40 +0200 Mike Gabriel (5729783db) * Merge branch 'theqvd-fix-for-112' into 3.6.x 2016-04-20 15:46:16 +0200 Salvador Fandino (7d053959f) * Fix copyright notice in nxcomp/Version.c 2016-04-19 10:47:43 +0200 Mike Gabriel (03b652112) * Merge branch 'fcarvajaldev-3.6.x-remove-old-proto-compat' into 3.6.x 2016-04-15 09:49:09 +0200 Fernando Carvajal (5c4952410) * Remove TextCompressor class and files from nxcomp 2016-04-14 17:10:07 +0200 Fernando Carvajal (00464aea0) * Add testing doc for nxcomp drop-old-proto-compat 2016-04-12 16:03:37 +0200 Fernando Carvajal (134648169) * Remove obsolete compatibility files from nxcomp 2016-04-12 11:52:22 +0200 Fernando Carvajal (a9be6f591) * Remove compatibility code for nxcomp before 3.5.0 2016-03-22 20:03:42 +0100 Mike Gabriel (2ffe52c5e) * nxcomp: Properly define NX*Version(void) prototypes in NX.h. 2016-03-17 16:46:13 +0100 Mike Gabriel (af923fba3) * debian/patches/401_nxcomp_bigrequests-and-genericevent-extensions.full+lite.patch: Move into debian/patches-pending-evaluation/. 2016-03-15 10:49:25 +0100 Mike Gabriel (156814860) * doc: Collect data on what libX11 symbols are used by nx-X11, nx-Xserver and nxagent. 2016-03-02 09:33:13 +0100 Nito Martinez (b8c5f677c) * Rename file for windows environments, Fixes #96 2016-02-26 08:14:28 +0100 Mike Gabriel (abd6cf1bd) * rename original NX patches, so that we can see the patched file's name in the patch file name. 2016-02-20 21:35:27 +0100 Mike Gabriel (45a7989c5) * debian/changelog: Add closures for #757, #758, #760. The issue occurred earlier (#410) and was resolved by properly setting up Xinerama symlinks 2016-01-19 05:59:51 +0100 Mike Gabriel (2eb85d140) * README.md: Update open / completed tasks regarding 3.6.x and 3.7.x releases. 2016-01-19 04:55:01 +0100 Mike Gabriel (e3539ec58) * README.md: Update release dates for 3.6.x and 3.7.x (as earlier discussed with Salve from TheQVD). 2016-01-19 04:50:57 +0100 Mike Gabriel (125f03110) * Merge branch 'mikedep333-README.md' into 3.6.x 2016-01-18 22:37:46 -0500 Mike DePaulo (0239ba72b) * README.md: Add debuild instructions 2016-01-18 21:49:03 -0500 Mike DePaulo (474e9c0ba) * README.md: Update signature 2016-01-09 22:26:34 +0100 Mike Gabriel (72801f6d5) * Merge pull request #68 from mikedep333/mock-build-instructions 2016-01-02 07:30:02 +0100 Mike Gabriel (e794be341) * debian/nx-x11proto-xinerama-dev.install.in: Install PANORAMIX extension header files into its own nx-x11proto bin:package. (more Xinerama clean-up, fix FTBFS during dh_install). 2016-01-01 12:27:14 -0500 Mike DePaulo (b7657cfba) * nx-libs.spec: FTBFS Fixes (more libNX_Xinerama cleanup) 2016-01-01 12:01:43 -0500 Mike DePaulo (0428db4db) * nx-libs.spec: Misc FTBFS fixes for %files due to recent library changes 2016-01-01 11:32:25 -0500 Mike DePaulo (7f5480dd7) * Fedora/EPEL: Add the implicit build dependencies also 2016-01-01 11:21:47 -0500 Mike DePaulo (1330c4125) * Fedora/EPEL: Fix FTBFS due to missing libXpm 2016-01-01 16:26:50 +0100 Mike Gabriel (3ba31659e) * Fix c4a3889. Add forgotten file nx-X11/programs/Xserver/Xinerama_nxagent.h. 2016-01-01 16:08:05 +0100 Mike Gabriel (12b4a0e7a) * nx-libs.spec: Re-add erroneously removed (during rebasing) BR libXdamage-devel. 2016-01-01 09:52:26 -0500 Mike DePaulo (daace15e2) * Add instructions for building using Mock under Fedora/EPEL 2015-12-30 19:25:08 +0100 Mike Gabriel (fa497ac95) * nxcomp: Make nxcomp/nxproxy aware of nxagent's xinerama option in the $DISPLAY variable. 2015-05-23 09:28:57 -0400 Mike DePaulo (6da41e6f6) * Complete changes from commit 0d56c45 in NXpicturestr.h (i.e. add a missing comment). (Fixes ArcticaProject/nx-libs#38). 2015-12-30 00:06:58 +0100 Mike Gabriel (1391c0ad7) * Merge branch 'sunweaver-pr/xinerama-xrandr' into 3.6.x 2015-10-08 22:25:09 +0200 Ulrich Sibiller (c4a388937) * Xinerama: do not cut off at outer edges (gh-sunweaver/pr/xinerama-xrandr) 2015-10-07 20:45:14 +0200 Mike Gabriel (4ba8df855) * Xserver globals.h: Make PanoramiXExtensionDisabledHack globally available. 2015-10-07 20:44:19 +0200 Mike Gabriel (d49b0625e) * Xserver help: Document -disablexineramaextension cmdline option. 2015-10-07 21:33:55 +0200 Mike Gabriel (522cf0089) * X2Go Agent: Add x2goagent.features file that informs X2Go clients about the new RandR based Xinerama feature. 2015-10-07 20:51:12 +0200 Mike Gabriel (0297567cd) * Provide support for re-enabling Xinerama on session resumptions. 2015-10-07 17:24:01 +0200 Mike Gabriel (f40792c43) * Initialize XRandR based Xinerama extension properly when session is started with "-geometry fullscreen". 2015-10-07 17:23:13 +0200 Mike Gabriel (e7e2f164b) * Only declare nxagentRandRCrtcSet if RANDR_12_INTERFACE is defined. 2015-10-07 15:17:59 +0200 Mike Gabriel (f1eafeaa4) * Screen.c: Rename NX_USE_MODE_PREFIX to NXAGENT_RANDR_MODE_PREFIX, fix unclosed comment. 2015-10-06 22:53:16 +0200 Ulrich Sibiller (9b87a384e) * Screen.c: restructure xinerama code, much shorter now 2015-10-06 22:32:12 +0200 Ulrich Sibiller (359f48dd7) * Screen.c: Fix freeing of unsued modes 2015-10-06 22:30:39 +0200 Ulrich Sibiller (76a203410) * Screen.c: improve comments and DEBUG output 2015-10-06 22:27:10 +0200 Ulrich Sibiller (8b0e2af36) * rrmode.c: add debug output 2015-05-02 21:53:25 +0200 Ulrich Sibiller (c6482d24f) * Reimplement xinerama via randr in nxagent (not libNX_Xinerama). (Fixes ArcticaProject/nx-libs#23). 2015-05-05 10:24:24 +0200 Mike Gabriel (2d776b14f) * library clean-up: Don't build libNX_Xinerama anymore. Use system's libXinerama shared library. (Fixes ArcticaProject/nx-libs#49). 2015-12-29 22:34:04 +0100 Mike Gabriel (e4763fb48) * debian/rules: Don't strips symbols from not-build-anymore libNX_Xtst.so. 2015-06-21 18:12:11 +0200 Mike Gabriel (bd592c2e7) * library clean-up: Don't build libNX_Xtst anymore. Use system's libXtst shared library. (Fixes ArcticaProject/nx-libs#32). 2015-12-29 17:34:36 +0100 Mike Gabriel (b768e8124) * Fix for too overall Xdamage and Xrandr client lib removal: Bring back the nx-x11proto-{randr,damage} header files and use those at compile time. 2015-12-29 17:27:47 +0100 Mike Gabriel (9618380bd) * X11/nx-X11 clear-up: More places where we need to explicitly distinguish between X11 and nx-X11 namespace regarding header include paths. 2015-12-29 17:28:54 +0100 Mike Gabriel (eafc94f16) * nx-X11/lib/X11/Marcos.c: white-space cleanup (EOL blanks). 2015-12-28 22:32:52 +0100 Mike Gabriel (b7f155654) * pointer typedef in Xdefs.h: also catch Xdefs.h include in include/misc.h, make undoing the FIXME more obvious. 2015-12-28 21:33:30 +0100 Mike Gabriel (7eab400ab) * libray clean (Xfixes): Provide a fake libXfixes.h header from latest X.Org, that includes headers from our Xlib version. This avoids FTBFS caused by type redefinitions and should really be a temporary measure. 2015-12-28 21:31:58 +0100 Mike Gabriel (f63641b13) * Xrandr_nxagent.h: When faking Xrandr.h, we better include our own Xfuncproto.h. 2015-12-28 20:47:49 +0100 Mike Gabriel (cc43e2bf6) * nxcompshad/X11/include/Xdamage_nxcompshad.h: Update FIXME statement. Work-around needs to persist until libX11 from X.Org gets used by nxagent. 2015-12-28 19:09:42 +0100 Mike Gabriel (6217812c8) * library clean-up: Don't build libNX_Xfixes anymore. Use system's libXfixes shared library. 2015-12-28 19:55:38 +0100 Mike Gabriel (27e06a5e2) * library clean-up: Don't build libNX_Xcomposite anymore. Use system's libXcomposite shared library. 2015-12-28 15:53:09 +0100 Mike Gabriel (96e1f867d) * pointer typedef in Xdefs.h: Define pointer type for building against older Xlib versions that still expect the pointer type to exist (e.g. Ubuntu <= 14.04, Debian <= 7.0). 2015-12-28 13:17:21 +0100 Mike Gabriel (ca0f639a4) * Merge branch 'sunweaver-pr/NX-include-path' into 3.6.x 2015-07-08 16:16:40 +0200 Mike Gabriel (433d81865) * Clear header file namespace separation ( vs. ). 2015-12-28 13:08:47 +0100 Mike Gabriel (f58006d93) * Merge branch 'sunweaver-pr/dixfont-fix' into 3.6.x 2015-06-23 15:04:16 +0200 Mike Gabriel (aea71067d) * On realloc failure, free font_path_string instead of leaking it 2015-12-28 13:03:52 +0100 Mike Gabriel (edce25213) * Merge branch 'sunweaver-pr/change-pointer-into-void' into 3.6.x 2015-06-22 09:36:08 +0200 Keith Packard (68dd0b52e) * Replace 'pointer' type with 'void *' 2015-10-07 17:28:27 +0200 Mike Gabriel (e9f44221b) * Drop all references to printver.c. Not provided in source tree anymore. 2015-10-06 17:12:16 +0200 Mike Gabriel (e0b8f3eef) * Re-add -sync option back to nxagent to allow synchronous debugging of the nxagent DDX. 2015-09-28 09:57:12 +0200 Mike Gabriel (81d92cd0f) * Xinerama symlinking: Create / remove folder containing Xinerama sylinks on installation/upgrade and removal. 2015-09-28 08:15:52 +0200 Mike Gabriel (45983d130) * Xinerama symlinking: Attach Xinerama symlinking to nxagent bin:package (and not libnx-xinerama1). 2015-09-28 08:10:59 +0200 Mike Gabriel (0382b4018) * debian/changelog: Drop unnecessary "~build1" from version string 2015-09-28 08:15:52 +0200 Mike Gabriel (d35a3622d) * Xinerama symlinking: Attach Xinerama symlinking to nxagent bin:package (and not libnx-xinerama1). (origin/3.5.0.x, gh-sunweaver/3.5.0.x, gh-mjtrangoni/3.5.0.x, gh-ionic/3.5.0.x, gh-Ionic/3.5.0.x, gh-Etersoft/3.5.0.x) 2015-09-28 07:59:12 +0200 Mike Gabriel (ca990cf0a) * Merge pull request #64 from uli42/pr/add_pkgconfig 2015-09-28 07:53:57 +0200 Mike Gabriel (f9653af3b) * Merge branch 'uli42-pr/backported_fixes' into 3.6.x 2015-09-23 12:15:06 +0200 Mike Gabriel (3a022e35c) * debian/libnx-xinerama1.postinst.in: Enforce symlink creation for Xinerama support. 2015-09-22 15:02:22 +0200 Mike Gabriel (899f865cf) * Revert "debian/libnx-xinerama1.*: fix faulty logic when creating symlinks." 2015-07-17 18:13:00 +0200 Mihai Moldovan (9b126b852) * nx-libs.spec: add xkeyboard-config to nxagent's Requires. 2015-07-17 17:57:24 +0200 Mihai Moldovan (3a1226ea6) * debian/control: add xkb-data to nxagent's Recommends. 2015-07-17 17:48:44 +0200 Mihai Moldovan (2aa853530) * debian/roll-tarballs.sh: more quotes, more curly braces, replace cd with pushd and pop. 2015-07-15 09:30:29 +0200 Mike Gabriel (c36501b53) * roll-tarball.sh: more quotes (follow-up for previous commit), drop debug code 2015-07-14 20:39:58 +0200 Mike Gabriel (99a7271e3) * roll-tarball.sh: Make sure symlinked files are included in tarballs. 2015-07-14 15:14:55 +0200 Mike Gabriel (0897c062e) * nx-libs.spec: Install nxcomp{,ext,shad}.pc into the corresponding development packages. 2015-07-14 14:46:42 +0200 Mike Gabriel (2cc179223) * debian/libxcomp{,ext,shad}-dev.install.in: Install nxcomp{,ext,shad}.pc file into the corresponding development packages. 2015-07-14 14:43:34 +0200 Mike Gabriel (eb5f07ccd) * nxcomp{,ext,shad}/Makefile.in: Create pkgconfigdir before putting files in it. 2015-07-14 01:39:17 +0200 Mike Gabriel (bc35168fb) * nxcomp{,shad,ext}: Remove nxcomp*.pc file on clean and distclean. 2015-07-14 01:26:33 +0200 Mike Gabriel (eee7cb4fb) * Makefile: Also remove nxversion.def on distclean. 2015-07-12 01:52:29 +0200 Ulrich Sibiller (708cf86a5) * Add pkg-config support to nxcomp, nxcompext and nxcompshad 2015-07-04 06:46:29 +0200 Mihai Moldovan (8c0a6161d) * debian/changelog: sync with master/3.5.0.x branch. 2015-06-29 03:40:58 +0200 Mihai Moldovan (34670f8ab) * debian/changelog: sync with master/3.5.0.x branch. 2015-06-28 01:50:00 -0400 Mike DePaulo (a1dfd145d) * Correct nxproxy manpage also: --help -> -help 2015-06-28 01:33:49 -0400 Mike DePaulo (d8132cbfe) * Correct manpages: --help -> -help 2015-06-23 16:24:56 +0200 Mike Gabriel (5720842b6) * library clean-up: No autotools cruft in nx-libs. 2015-06-25 05:04:12 +0200 Mike Gabriel (8365e22bb) * doc/examples/run-nxproxy2nxproxy-test: Create NX_COOKIE dynamically using the mcookie tool. 2015-05-28 14:52:24 +0200 Mike Gabriel (7dc263333) * COPYING: Replace content with GPL-2 license text, because that is the overall (i.e., strictest) license we have to deal with in nx-libs. 2015-05-28 14:50:05 +0200 Mike Gabriel (c68dad542) * debian/roll-tarball.sh: Auto-generate ChangeLog from Git history. 2015-05-28 14:49:40 +0200 Mike Gabriel (ce5337799) * debian/roll-tarball.sh: Rename README.md to README.NX-Development before moving it into doc/ folder. 2015-05-28 14:33:08 +0200 Mike Gabriel (122fd234c) * debian/roll-tarball.sh: Prevent several files/folders from ending up in nx-libs-lite tarball. 2015-05-28 13:33:43 +0200 Mike Gabriel (2d50be9da) * debian/roll-tarball.sh: Support tarring up the HEAD of the current branch. 2015-05-28 13:29:27 +0200 Mike Gabriel (51a679ac2) * debian/roll-tarball.sh: Allow patch files names having a dash next to the four digits (i.e., 1234-.). 2015-06-23 16:09:50 +0200 Emanuele Giaquinta (931d24cc2) * Fix alpha premultiplication in XRenderParseColor. 2015-05-27 12:34:12 +0200 Mike Gabriel (6deaaf50f) * library clean-up: Drop libXx86{misc,vm,dga} libraries. Not needed by nx-libs. 2015-05-27 10:20:29 +0200 Mike Gabriel (fe0065c55) * library clean-up: Drop nx-X11/lib/Xxf86rush and references to libglide{2,3}. Unused in nx-libs. 2015-05-27 09:48:26 +0200 Mike Gabriel (018c51293) * nx-X11/config/cf: Drop build-logic for all hardware drivers. 2015-05-27 08:38:11 +0200 Mike Gabriel (17334df9b) * nx-X11/config/cf: Drop unnecessary xf86site.def, xf86.tmpl, xfree86.cf. 2015-05-27 08:26:40 +0200 Mike Gabriel (8dd6d2fe7) * nx-X11/config/cf/Imakefile: Don't list non-present-anymore imake configuration files. 2015-06-20 17:47:39 +0200 Mike Gabriel (32b44398a) * libgl clean-up, fix-up commit 2015-06-20 17:35:00 +0200 Mike DePaulo (d7108d206) * README.md: typo fix 2015-06-20 11:34:04 +0200 Henning Heinold (2699d60f6) * remove libxkbui, looks like it is not used anywhere 2015-06-19 23:58:49 +0200 Mike Gabriel (f1778d0c2) * debian/control: Add Breaks:/Replaces: for qvd-libxcomp3 and qvd-nxproxy. 2015-05-27 08:10:38 +0200 Mike Gabriel (858b9bc2a) * imake clean-up: Enforce build of Mesa GLX extension. Drop all other GLX build methods (built-in DRI drivers, etc.). 2015-05-26 16:44:49 +0200 Mike Gabriel (0887e3ad5) * Drop unused / untested Xserver GLX extension support / build logic. 2015-05-26 16:22:40 +0200 Mike Gabriel (d877b46dd) * Drop nx-X11/lib/GL and move Imakefile.inc include files into Xserver code tree. 2015-06-16 22:43:21 +0200 Mihai Moldovan (8f4138457) * nxcomp/Loop.cpp: tiny whitespace fix. No functional change. 2015-05-20 15:47:45 +0200 Vadim Troshchinskiy (8d9e8f70b) * Fix negotiation in stage 10 error 2015-09-26 00:28:14 +0200 Ulrich Sibiller (1fe33b710) * use xfree instead of free for xalloced data (gh-uli42/pr/backported_fixes) 2015-09-23 12:16:22 +0200 Mike Gabriel (3027f5019) * Enforce symlink creation for Xinerama et al. library symlinks. 2015-09-23 12:15:06 +0200 Mike Gabriel (da6b89f7e) * debian/libnx-xinerama1.postinst.in: Enforce symlink creation for Xinerama support. 2015-09-22 15:09:27 +0200 Mike Gabriel (449eae1be) * Revert "debian/libnx-xinerama1.*: fix faulty logic when creating symlinks." 2015-09-22 15:02:22 +0200 Mike Gabriel (4db753eb7) * Revert "debian/libnx-xinerama1.*: fix faulty logic when creating symlinks." 2015-08-26 01:06:28 +0200 Ulrich Sibiller (f8772b6fc) * adapt pkgconfigdir in nxcompshad 2015-08-26 01:02:34 +0200 Ulrich Sibiller (96a1c5edf) * Fix "Makefile.in seems to ignore the --datarootdir setting" warning 2015-08-26 00:29:14 +0200 Ulrich Sibiller (6615de8dd) * create pkgcnfig dir before copying anything 2015-07-17 18:13:00 +0200 Mihai Moldovan (edeb4e196) * nx-libs.spec: add xkeyboard-config to nxagent's Requires. 2015-07-17 17:57:24 +0200 Mihai Moldovan (813d0cf13) * debian/control: add xkb-data to nxagent's Recommends. 2015-07-17 18:13:00 +0200 Mihai Moldovan (021050ff7) * nx-libs.spec: add xkeyboard-config to nxagent's Requires. 2015-07-17 17:57:24 +0200 Mihai Moldovan (d417db53d) * debian/control: add xkb-data to nxagent's Recommends. 2015-07-17 17:48:44 +0200 Mihai Moldovan (0606ec814) * debian/roll-tarballs.sh: more quotes, more curly braces, replace cd with pushd and pop. 2015-07-15 09:30:29 +0200 Mike Gabriel (01ad7dad4) * roll-tarball.sh: more quotes (follow-up for previous commit), drop debug code 2015-07-14 20:39:58 +0200 Mike Gabriel (c2761fb7c) * roll-tarball.sh: Make sure symlinked files are included in tarballs. 2015-07-14 15:14:55 +0200 Mike Gabriel (c1d502e1c) * nx-libs.spec: Install nxcomp{,ext,shad}.pc into the corresponding development packages. 2015-07-14 14:46:42 +0200 Mike Gabriel (931050cbe) * debian/libxcomp{,ext,shad}-dev.install.in: Install nxcomp{,ext,shad}.pc file into the corresponding development packages. 2015-07-14 14:43:34 +0200 Mike Gabriel (ee0ed871a) * nxcomp{,ext,shad}/Makefile.in: Create pkgconfigdir before putting files in it. 2015-07-14 01:39:17 +0200 Mike Gabriel (39ae81788) * nxcomp{,shad,ext}: Remove nxcomp*.pc file on clean and distclean. 2015-07-14 01:26:33 +0200 Mike Gabriel (5eecadb53) * Makefile: Also remove nxversion.def on distclean. 2015-07-14 00:04:01 +0200 Mike Gabriel (e5fbb11b2) * Merge branch 'uli42-pr/add_pkgconfig' into 3.6.x 2015-07-12 01:52:29 +0200 Ulrich Sibiller (00cec4924) * Add pkg-config support to nxcomp, nxcompext and nxcompshad 2015-07-04 06:46:29 +0200 Mihai Moldovan (f4c07c077) * debian/changelog: sync with master/3.5.0.x branch. 2015-07-04 06:31:07 +0200 X2Go Release Manager (8a81ba8b5) * Continue development 2015-07-04 04:45:49 +0200 X2Go Release Manager (023bc5a62) * release 3.5.0.32 2015-07-04 02:17:16 +0200 Peter Ã…strand (97494f162) * nx-X11: Backport: xserver: Avoid sending uninitialized padding data over the network 2015-07-04 01:49:55 +0200 Keith Packard (ab38d9b59) * nx-X11: Backport: Make RANDR 'set' timestamps follow client specified time. Bug 21987. 2015-07-04 01:22:02 +0200 Keith Packard (558e45c15) * nx-X11: Backport: randr: Clean up compiler warnings about unused and shadowing variables 2015-07-04 00:53:37 +0200 Aaron Plattner (ab58e5781) * nx-X11: Backport: randr: Fix REQUEST vs. REQUEST_SIZE_MATCH mismatch 2015-07-04 00:39:35 +0200 Alan Coopersmith (f3079befb) * nx-X11: Backport: ProcRRGetScreenInfo: swap configTimestamp as well 2015-07-04 00:11:59 +0200 Alan Coopersmith (e2f5d079d) * nx-X11: Backport: RRModeCreate: plug memory leak of newModes if AddResource fails 2015-07-03 23:53:25 +0200 Julien Cristau (09cb7b2d2) * nx-X11: Backport: randr: fix server crash in RRGetScreenInfo 2015-07-03 23:40:57 +0200 Tiago Vignatti (44b913275) * nx-X11: Backport: randr: check for virtual size limits before set crtc 2015-07-03 23:02:14 +0200 Keith Packard (9b26cc163) * nx-X11: Backport: Free randr crtc and output pointer arrays 2015-07-03 22:46:27 +0200 Keith Packard (389e41028) * nx-X11: Backport: Drop a reference to user mode after create 2015-07-03 22:21:44 +0200 Jaroslav Å míd (257825c88) * nx-X11: Backport: Bug 51375: Xorg doesn't set status for RRGetOutputInfo 2015-07-03 17:07:30 +0200 Mihai Moldovan (ca19c342c) * Merge branch 'uli42-pr/backported_fixes' into arctica-3.6.x 2009-02-13 10:23:28 +0100 Peter Ã…strand (d08869832) * Backport: xserver: Avoid sending uninitialized padding data over the network 2015-06-29 04:13:59 +0200 Mihai Moldovan (61013ec4f) * Merge branch 'sunweaver-pr/no-autotools-cruft' into arctica-3.6.x 2015-06-29 03:40:58 +0200 Mihai Moldovan (fa0286ed6) * debian/changelog: sync with master/3.5.0.x branch. 2015-06-29 03:35:08 +0200 Mike DePaulo (46de1b072) * {nx-X11,nxproxy}: correct manpages: --help -> -help 2015-06-28 01:50:00 -0400 Mike DePaulo (779d54645) * Correct nxproxy manpage also: --help -> -help 2015-06-28 01:33:49 -0400 Mike DePaulo (12acd909b) * Correct manpages: --help -> -help 2015-06-23 16:24:56 +0200 Mike Gabriel (a28be4aa9) * library clean-up: No autotools cruft in nx-libs. 2015-06-25 05:04:12 +0200 Mike Gabriel (e7f3187ee) * doc/examples/run-nxproxy2nxproxy-test: Create NX_COOKIE dynamically using the mcookie tool. 2015-06-23 20:06:48 +0200 Emanuele Giaquinta (64b2001db) * nx-X11: Fix alpha premultiplication in XRenderParseColor. Fixes: #893. 2015-06-23 16:39:33 +0200 Mihai Moldovan (32bbe01dd) * Merge branch 'sunweaver-pr/roll-tarball-fixes' into arctica-3.6.x 2015-05-28 14:52:24 +0200 Mike Gabriel (5af9863e7) * COPYING: Replace content with GPL-2 license text, because that is the overall (i.e., strictest) license we have to deal with in nx-libs. 2015-05-28 14:50:05 +0200 Mike Gabriel (438f3df14) * debian/roll-tarball.sh: Auto-generate ChangeLog from Git history. 2015-05-28 14:49:40 +0200 Mike Gabriel (7e1effbe7) * debian/roll-tarball.sh: Rename README.md to README.NX-Development before moving it into doc/ folder. 2015-05-28 14:33:08 +0200 Mike Gabriel (47afc48ea) * debian/roll-tarball.sh: Prevent several files/folders from ending up in nx-libs-lite tarball. 2015-05-28 13:33:43 +0200 Mike Gabriel (895ee3b3b) * debian/roll-tarball.sh: Support tarring up the HEAD of the current branch. 2015-05-28 13:29:27 +0200 Mike Gabriel (701471e8e) * debian/roll-tarball.sh: Allow patch files names having a dash next to the four digits (i.e., 1234-.). 2015-06-23 16:14:41 +0200 Mike Gabriel (ce9ea5448) * Merge branch 'pr/anti-aliasing-rgba-crash' into 3.6.x 2015-06-23 16:09:50 +0200 Emanuele Giaquinta (ffc87da60) * Fix alpha premultiplication in XRenderParseColor. 2015-06-23 02:30:02 +0200 Mihai Moldovan (8cf9283bd) * Merge branch 'sunweaver-pr/libXx86FOO-cleanup' into arctica-3.6.x 2015-05-27 12:34:12 +0200 Mike Gabriel (06d389a0c) * library clean-up: Drop libXx86{misc,vm,dga} libraries. Not needed by nx-libs. (gh-sunweaver/pr/libXx86FOO-cleanup) 2015-06-22 03:38:46 +0200 Mihai Moldovan (e7dfbd511) * Merge branch 'sunweaver-pr/libxf86rush-cleanup' into arctica-3.6.x 2015-05-27 10:20:29 +0200 Mike Gabriel (5365f9059) * library clean-up: Drop nx-X11/lib/Xxf86rush and references to libglide{2,3}. Unused in nx-libs. (gh-sunweaver/pr/libxf86rush-cleanup) 2015-06-21 10:50:31 +0200 Mihai Moldovan (fb2a4e4c5) * Merge branch 'sunweaver-pr/hw-driver-cleanup' into arctica-3.6.x 2015-05-27 09:48:26 +0200 Mike Gabriel (26091f4bd) * nx-X11/config/cf: Drop build-logic for all hardware drivers. (gh-sunweaver/pr/hw-driver-cleanup) 2015-05-27 08:38:11 +0200 Mike Gabriel (ae443bd5b) * nx-X11/config/cf: Drop unnecessary xf86site.def, xf86.tmpl, xfree86.cf. 2015-05-27 08:26:40 +0200 Mike Gabriel (c0662d6de) * nx-X11/config/cf/Imakefile: Don't list non-present-anymore imake configuration files. 2015-06-20 17:47:39 +0200 Mike Gabriel (cc92f77e9) * libgl clean-up, fix-up commit 2015-06-20 17:35:00 +0200 Mike DePaulo (88ab5a34f) * README.md: typo fix 2015-06-20 14:39:56 +0200 Mike Gabriel (905c74da3) * Merge pull request #52 from woglinde/3.6.x 2015-06-20 11:34:04 +0200 Henning Heinold (a287e9dbe) * remove libxkbui, looks like it is not used anywhere 2015-06-19 23:58:49 +0200 Mike Gabriel (085dccc99) * debian/control: Add Breaks:/Replaces: for qvd-libxcomp3 and qvd-nxproxy. 2015-06-19 23:58:49 +0200 Mike Gabriel (4674a4ae4) * debian/control: Add Breaks:/Replaces: for qvd-libxcomp3 and qvd-nxproxy. 2015-06-16 23:58:50 +0200 Mihai Moldovan (51b60ea7a) * Merge branch 'sunweaver-pr/libglx-cleanup' into arctica-3.6.x 2015-06-16 23:02:05 +0200 Vadim Troshchinskiy (371348148) * nxcomp: fix "negotiation in stage 10" error. 2015-05-27 08:10:38 +0200 Mike Gabriel (5cd80d272) * imake clean-up: Enforce build of Mesa GLX extension. Drop all other GLX build methods (built-in DRI drivers, etc.). (gh-sunweaver/pr/libglx-cleanup) 2015-05-26 16:44:49 +0200 Mike Gabriel (73fa89991) * Drop unused / untested Xserver GLX extension support / build logic. 2015-05-26 16:22:40 +0200 Mike Gabriel (cb4a2d732) * Drop nx-X11/lib/GL and move Imakefile.inc include files into Xserver code tree. 2015-06-16 22:43:21 +0200 Mihai Moldovan (5a64974cc) * nxcomp/Loop.cpp: tiny whitespace fix. No functional change. 2015-06-16 10:41:12 +0200 Mike Gabriel (d8f3aa414) * Merge pull request #28 from theqvd/3.6.x 2009-05-28 14:43:27 -0700 Keith Packard (cf660f485) * Backport: Make RANDR 'set' timestamps follow client specified time. Bug 21987. 2012-06-21 18:42:46 -0700 Keith Packard (9dbd74793) * Backport: randr: Clean up compiler warnings about unused and shadowing variables 2012-06-29 13:33:58 -0700 Aaron Plattner (9e2ac01a4) * Backport: randr: Fix REQUEST vs. REQUEST_SIZE_MATCH mismatch 2012-07-09 19:12:42 -0700 Alan Coopersmith (bd5754f94) * Backport: ProcRRGetScreenInfo: swap configTimestamp as well 2012-07-14 11:21:15 -0700 Alan Coopersmith (0fc419314) * Backport: RRModeCreate: plug memory leak of newModes if AddResource fails 2009-05-22 09:54:38 +0200 Julien Cristau (faddfbec6) * Backport: randr: fix server crash in RRGetScreenInfo 2010-12-17 16:09:35 +0200 Tiago Vignatti (da678db0e) * Backport: randr: check for virtual size limits before set crtc 2009-09-17 18:14:37 -0700 Keith Packard (2aeb76719) * Backport: Free randr crtc and output pointer arrays 2008-09-10 13:11:09 +0800 Keith Packard (f45476100) * Backport: Drop a reference to user mode after create 2012-07-09 19:12:42 -0700 Jaroslav Å míd (8fd0b52f2) * Backport: Bug 51375: Xorg doesn't set status for RRGetOutputInfo 2015-06-02 21:54:12 +0200 Mihai Moldovan (b5d78278d) * Merge branch 'sunweaver-pr/libxres-cleanup' into arctica-3.6.x 2015-06-02 21:12:05 +0200 Mihai Moldovan (167d09ed7) * debian/changelog: sync with master/3.5.0.x branch. 2015-06-02 18:38:59 +0200 Mihai Moldovan (16df117e5) * Security fixes: X.Org CVE-2014-8099: 2015-06-02 18:27:15 +0200 Mihai Moldovan (e5ff9ace4) * Security fixes: X.Org CVE-2015-3418: 2015-06-02 18:11:24 +0200 Mihai Moldovan (125254d35) * Security fixes: X.Org CVE-2014-8092: 2015-06-02 17:59:28 +0200 Mihai Moldovan (4fb35326a) * Security fixes: X.Org CVE-2013-4396: 2015-06-02 17:35:44 +0200 Mike Gabriel (86937b86c) * nxcomp/README.on-retroactive-DXPC-license: Some layout and interpunctuation fixes. 2015-05-26 12:30:48 +0200 Mike Gabriel (6a74e671a) * library clean-up: Don't compile (i.e., remove) libNX_Xres.a anymore. It is not used anywhere. (gh-sunweaver/pr/libxres-cleanup) 2015-05-31 17:21:10 +0200 Mike Gabriel (01b142ddf) * Update README.md: Move more release goals to 3.6.x. 2015-05-31 17:15:24 +0200 Mike Gabriel (dddffb760) * Merge pull request #46 from ArcticaProject/pr/Xext-cve-fixes 2015-05-31 16:50:39 +0200 Mike Gabriel (11b26436b) * Merge pull request #45 from ArcticaProject/pr/dix-cve-fixes 2014-01-26 19:23:17 -0800 Alan Coopersmith (d1ca2119a) * Xv: unvalidated lengths in XVideo extension swapped procs [CVE-2014-8099] (origin/pr/Xext-cve-fixes, gh-salva/pr/Xext-cve-fixes, gh-mjtrangoni/pr/Xext-cve-fixes, gh-ionic/pr/Xext-cve-fixes, gh-Ionic/pr/Xext-cve-fixes, gh-Etersoft/pr/Xext-cve-fixes) 2015-05-01 13:09:24 +0200 Keith Packard (2db01a9a2) * dix: Allow zero-height PutImage requests (fix for X.Org's CVE-2015-3418). (origin/pr/dix-cve-fixes, gh-salva/pr/dix-cve-fixes, gh-mjtrangoni/pr/dix-cve-fixes, gh-ionic/pr/dix-cve-fixes, gh-Ionic/pr/dix-cve-fixes, gh-Etersoft/pr/dix-cve-fixes) 2014-01-22 21:11:16 -0800 Alan Coopersmith (8623faa42) * dix: integer overflow in ProcPutImage() [CVE-2014-8092 1/4] 2015-02-08 20:01:27 -0500 Mike DePaulo (c2298e075) * Avoid use-after-free in dix/dixfonts.c: doImageText() [CVE-2013-4396] from xorg/Xserver http://lists.x.org/archives/xorg-announce/2013-October/002332.html 2015-05-29 11:15:19 +0200 Mike Gabriel (4ed85e8ef) * nxcomp/README.on-retroactive-DXPC-license: Some layout and interpunctuation fixes. 2015-05-28 22:42:45 +0200 Mihai Moldovan (f9303c1c7) * nxcomp/Misc.cpp: fix build failure introduced in a27a8aae3ca7a3f70e05152ac3d347942e11159d. 2015-05-28 22:36:59 +0200 Mihai Moldovan (5bc91ad49) * nxcomp/Misc.cpp: fix build failure introduced in 1f44331574bdbe4069d13e4c26df18094b49e658. 2015-05-28 22:09:07 +0200 Mihai Moldovan (eda8da43d) * debian/changelog: typo fix. 2015-05-28 13:30:34 +0200 Mike Gabriel (2e5b45ada) * Support tarring up the HEAD of the current branch. (gh-salva/3.5.0.x) 2015-05-28 13:28:33 +0200 Mike Gabriel (23fc7ee7e) * Allow patch files names having a dash next to the four digits (i.e., 1234-.). 2015-05-28 13:03:52 +0200 Mike Gabriel (a27a8aae3) * Add 9900-dxpc-license-history.full+lite.patch. Document license history of DXPC (where nxcomp got forked from). 2015-05-28 12:59:12 +0200 Mike Gabriel (6814755d8) * debian/COPYING.full+lite: Replace content with GPL-2 license text, because that is the overall (i.e., strictest) license we have to deal with in nx-libs. 2015-05-28 12:55:34 +0200 Mike Gabriel (b3ece6448) * debian/roll-tarball.sh: Make sure *.keyboard, debian/**, nx-libs.spec, .pc/** don't end up in tarball (special focuse on the nx-libs-lite tarball). 2015-05-26 19:07:36 +0200 Mihai Moldovan (dc770326a) * debian/changelog: add entry for last change. 2015-05-26 18:56:12 +0200 Mihai Moldovan (0575a5b3d) * nxcomp: fix DEBUG, TEST, DUMP, FLUSH, TOKEN, PING, MIXED et al builds. 2015-05-26 18:39:21 +0200 Mihai Moldovan (7f626521f) * debian/changelog: add entry for last change. 2015-05-26 18:36:28 +0200 Mihai Moldovan (a9a7426df) * Security fixes: X.Org CVE-2014-8100: 2015-05-26 18:05:21 +0200 Mihai Moldovan (cce8c0d22) * debian/changelog: add entry for last change. 2015-05-26 18:00:00 +0200 Mihai Moldovan (c19b58d09) * Security fixes: X.Org CVE-2014-8100: 2015-05-26 16:51:38 +0200 Mihai Moldovan (beb08f96c) * Merge branch 'sunweaver-pr/DXPC-re-license-retroactively' into arctica-3.6.x 2015-05-26 10:31:46 +0200 Mike Gabriel (e364fde72) * Merge pull request #36 from ArcticaProject/pr/render-cve-fixes 2015-05-21 12:25:13 +0200 Mike Gabriel (1f4433157) * Document retroactive re-licensing of the original DXPC code (closes #30). 2015-05-25 23:23:22 +0200 Mihai Moldovan (230852e0e) * Merge branch 'sunweaver-pr/libxrandr-cleanup' into arctica-3.6.x 2014-01-26 19:51:29 -0800 Alan Coopersmith (a0c90ad34) * render: unvalidated lengths in Render extn. swapped procs [CVE-2014-8100 2/2] (origin/pr/render-cve-fixes, gh-salva/pr/render-cve-fixes, gh-mjtrangoni/pr/render-cve-fixes, gh-ionic/pr/render-cve-fixes, gh-Ionic/pr/render-cve-fixes, gh-Etersoft/pr/render-cve-fixes) 2014-10-28 10:30:04 +0100 Julien Cristau (e469cff02) * render: check request size before reading it [CVE-2014-8100 1/2] 2015-05-22 00:58:38 +0200 Mihai Moldovan (608ee9928) * README.md: replace simple link with a text link, capitalization. 2015-05-22 00:43:53 +0200 Mihai Moldovan (7846638a8) * Merge branch 'nitomartinez-qindel-readme' into arctica-3.6.x 2015-05-21 21:43:30 +0200 Nito Martinez (900b0cc2d) * Update the Qindel Company name (Qindel is without u ;-)) 2015-05-20 15:47:45 +0200 Vadim Troshchinskiy (f982cbc85) * Fix negotiation in stage 10 error 2015-05-20 11:30:05 +0200 Mike Gabriel (a6185abd9) * hw/nxagent clean-up: Drop NXrandr.{c|h} client lib copy-of-code from nxagent hardware driver. 2015-05-01 15:57:02 +0200 Mike Gabriel (e9dcab679) * library clean-up: Don't build libNX_Xrandr anymore. Use system's libXrandr shared library. 2015-05-16 15:54:37 +0200 Mike Gabriel (24903c921) * README.md: mark the iOS support for nxproxy/nxcomp as completed. 2015-05-16 15:15:41 +0200 Mike Gabriel (657acf98a) * Merge pull request #26 from nitomartinez/fix_developer_debugging 2015-05-16 15:12:19 +0200 Mike Gabriel (91ac79ecc) * Merge pull request #25 from nitomartinez/nxtranscleanup_for_reconnect 2015-05-15 22:40:05 +0200 Nito Martinez (cf4ed917e) * This patch is some code fixes to debug some debuging macro usage in the NX code. 2015-05-15 17:06:00 +0200 Mihai Moldovan (ab96962b1) * README.md: reword a few sections, whitespace fixes. 2015-05-15 16:34:27 +0200 Mike Gabriel (8512c700a) * README.md: grammar fix 2015-05-15 16:33:20 +0200 Mike Gabriel (d73351532) * README.md: phase 2 release series will be 3.7.0.x 2015-05-15 16:26:58 +0200 Mike Gabriel (50c3f5628) * update README.md with newest plans for nx-libs 3.6.x 2015-05-15 15:20:52 +0200 Nito Martinez (4fefe352c) * This patch allows to cleanup the nxcomp resources to allow for a second connection inside the same process, instead of a new process as is the nxproxy case. 2015-05-12 06:07:45 +0200 Mihai Moldovan (f7295831a) * Merge branch 'sunweaver-pr/libxdamage-cleanup' into arctica-3.6.x 2015-05-05 01:23:04 +0200 Mihai Moldovan (027f593fc) * debian/changelog: merge with master branch. 2015-05-05 01:22:41 +0200 Mihai Moldovan (998527ce5) * debian/changelog: add entry for last change. 2015-05-05 01:22:18 +0200 Mihai Moldovan (b77b26f4a) * debian/libnx-xinerama1.*: fix faulty logic when creating symlinks. 2015-05-05 01:23:50 +0200 Mihai Moldovan (5a9f8294c) * debian/libnx-xinerama1.*: fix faulty logic when creating symlinks. 2015-05-05 01:23:04 +0200 Mihai Moldovan (b573cbba9) * debian/changelog: merge with master branch. 2015-05-05 01:22:41 +0200 Mihai Moldovan (fca264fd0) * debian/changelog: add entry for last change. 2015-05-05 01:22:18 +0200 Mihai Moldovan (06f36d0f0) * debian/libnx-xinerama1.*: fix faulty logic when creating symlinks. 2015-05-02 00:08:41 +0200 Mihai Moldovan (5f2a5ac84) * debian/control: workaround missing dependencies of nxagent on Ubuntu for now. 2015-05-01 23:38:44 +0200 Mike Gabriel (6b9df6cae) * Security fixes: X.Org CVE-2015-3418: 2015-05-01 16:16:30 -0400 Mike DePaulo (c9d81fc38) * Merge pull request #20 from sunweaver/pr/fix-CVE-2015-3418 2015-04-27 16:08:06 +0200 Mike Gabriel (06aa41671) * library clean-up: Don't build libNX_Xdamage anymore. Use system's libXdamage shared library. (Fixes ArcticaProject/nx-libs#6, X2GoBTS#826). 2015-05-01 13:09:24 +0200 Keith Packard (dba779d9f) * dix: Allow zero-height PutImage requests (fix for X.Org's CVE-2015-3418). 2015-04-30 15:51:48 +0200 Mihai Moldovan (7ccbb073f) * debian/changelog: sync with 3.5.0.x branch. 2015-04-30 15:14:24 +0200 Mihai Moldovan (a17bd57ef) * nx-libs.spec: actually create libXinerama.so.1 symlink during build phase. 2015-04-30 15:14:24 +0200 Mihai Moldovan (e6e323a22) * nx-libs.spec: actually create libXinerama.so.1 symlink during build phase. 2015-04-30 14:43:04 +0200 Mihai Moldovan (e59561387) * debian/changelog: correctly sync with 3.5.0.x branch. Add latest entries. 2015-04-30 14:38:37 +0200 Mihai Moldovan (8726e7d0b) * debian/changelog: add changelog entry for the last two changes. 2015-04-30 14:34:11 +0200 Mihai Moldovan (0af0060d5) * debian/libnx-xinerama1.*: move Xinerama dir back to nx-x11-common. Only delete known files. Fixes RPM build failures. 2015-04-30 14:25:25 +0200 Mihai Moldovan (a9bc7bdb6) * debian/libnx-xinerama1.*: move Xinerama dir back to nx-x11-common. Only delete known files. Fixes RPM build failures. 2015-04-29 13:47:40 +0200 Mihai Moldovan (79d49066c) * libnx-xinerama1: also create libXinerama symlink in libnx-xinerama1.postinst.postinst (and remove in libnx-xinerama1.postinst.prerm.) 2015-04-29 08:04:44 +0200 Mike Gabriel (7a6b40a11) * Merge pull request #19 from ArcticaProject/PR-ionic/libXinerama_symlink_to_libnx-xinerama1 2015-04-28 23:00:43 +0200 Mihai Moldovan (83983e944) * libnx-xinerama1: also create libXinerama symlink in postinst (and remove in prerm.) 2015-04-28 05:15:19 +0200 Mihai Moldovan (7b7ba9441) * Merge branch 'sunweaver-pr/imake-cleanup-nonpresent-buildlogic' into arctica-3.6.x 2015-04-22 00:37:47 +0200 Mike Gabriel (662a89545) * imake cleanup: Drop references to X11 build-logic that is not present in nx-X11. 2015-04-21 10:57:56 +0200 Mike Gabriel (c189f6efc) * imake cleanup: Break up multiple vars into invidual lines to ease further work on patches / pull requests. 2015-04-27 16:10:26 +0200 Mike Gabriel (cbf4e4dbe) * COPYING: Add Arctica Project to copyright holders. 2015-04-27 02:56:07 +0200 Mihai Moldovan (99ef17f90) * debian/changelog: merge with 3.5.0.x branch. 2015-04-27 02:48:10 +0200 Mihai Moldovan (266d5affb) * README.keystrokes: remove accidentally copied Dokuwiki syntax. 2015-04-27 02:45:10 +0200 Mihai Moldovan (f717a7e81) * README.keystrokes: remove accidentally copied Dokuwiki syntax. 2015-04-27 02:43:05 +0200 Mihai Moldovan (352631a4b) * etc/keystrokes.cfg: fix whitespace errors. 2015-04-27 02:40:16 +0200 Mihai Moldovan (82d73c3e1) * debian/changelog: unify entry for README.keystrokes. 2015-04-27 02:33:47 +0200 Mihai Moldovan (45d9d2405) * README.keystrokes: add documentation for branding behavior. 2015-04-27 02:19:22 +0200 Mihai Moldovan (034bd9407) * README.keystrokes: copy actions documentation from the wiki. 2015-04-27 02:02:15 +0200 Mihai Moldovan (380a4df0f) * etc/keystrokes.cfg: fix whitespace errors. 2015-04-27 02:00:43 +0200 Mihai Moldovan (a430b4a87) * README.keystrokes: add documentation for branding behavior. 2015-04-27 01:59:53 +0200 Mihai Moldovan (1c0f42d30) * README.keystrokes: copy actions documentation from the wiki. 2015-04-27 01:33:56 +0200 Mihai Moldovan (14e51de12) * debian/changelog: document the last commits. 2015-04-27 01:28:50 +0200 Mihai Moldovan (4c90de7aa) * debian/roll-tarballs.sh: next batch of quotes. 2015-04-27 01:22:41 +0200 Mihai Moldovan (56b383b8c) * debian/roll-tarballs.sh: whitespace changes for consistency. 2015-04-26 23:49:06 +0200 Mihai Moldovan (06bdc2723) * debian/roll-tarballs.sh: don't escape last newline of a multiline command. 2015-04-26 23:48:02 +0200 Mihai Moldovan (cc2fdd962) * debian/roll-tarballs.sh: use more curly braces. 2015-04-26 23:47:33 +0200 Mihai Moldovan (e822d5cd9) * debian/roll-tarballs.sh: convert tabs to spaces. 2015-04-26 23:45:42 +0200 Mihai Moldovan (027577686) * debian/roll-tarballs.sh: use more quotes. 2015-04-27 01:14:23 +0200 Mike Gabriel (9525d0739) * nxcompshad: Prevent underlinking by linking to libNX_Xext. 2015-04-27 00:33:52 +0200 Mike Gabriel (ef24d6490) * nx-X11: Prevent underlinking by linking to libNX_X{11,damage,fixes). 2015-04-26 23:49:06 +0200 Mihai Moldovan (347e97335) * debian/roll-tarballs.sh: don't escape last newline of a multiline command. 2015-04-26 23:48:02 +0200 Mihai Moldovan (21a556b37) * debian/roll-tarballs.sh: use more curly braces. 2015-04-26 23:47:33 +0200 Mihai Moldovan (cf9181918) * debian/roll-tarballs.sh: convert tabs to spaces. 2015-04-26 23:45:42 +0200 Mihai Moldovan (e68c36625) * debian/roll-tarballs.sh: use more quotes. 2015-04-26 23:32:32 +0200 Mihai Moldovan (96efadac5) * CVE patches were previously not included in release tarballs. 2015-04-26 21:51:23 +0200 Mike Gabriel (79a4ed92d) * Security fixes: X.Org CVE-2013-7439: 2015-04-26 20:13:12 +0200 Bernard Cafarelli (ca3617573) * nx-X11: link to libdl to fix undefined references to 'dlopen' and 'dlsym'. Fixes: #853. 2015-04-26 16:35:14 +0200 Mike Gabriel (f2fd79416) * libXcompshad underlinking problem: Fix undefined reference to 'XShmQueryVersion', 'XShmDetach', 'XShmCreateImage', 'XShmAttach', and 'XShmGetImage'. 2015-04-26 16:11:57 +0200 Mike Gabriel (4a3a4737f) * Fix underlinking issues for libNX_X{composite,damage,fixes}. 2015-04-26 15:41:46 +0200 Mike Gabriel (305ac7889) * libX11 underlinking problem: Fix undefined reference to 'XdmcpWrap' (by linking against X.Org'x libXdmcp). 2015-04-26 15:12:39 +0200 Mike Gabriel (f46b43261) * libX11 underlinking problem: Fix undefined reference to 'dlopen' and 'dlsym'. (Fixes: X2GoBTS#853). 2015-04-23 13:29:10 +0200 Mihai Moldovan (2b159e18d) * Merge branch 'sunweaver-pr/xbitmaps-cleanup' into arctica-3.6.x 2015-04-21 10:42:47 +0200 Mike Gabriel (e69b7d1ec) * xbitmaps cleanup: The headers are not required at build time for NX. 2015-04-22 22:48:54 +0200 Mihai Moldovan (825af1835) * Merge branch 'sunweaver-pr/libxdmcp-cleanup' into arctica-3.6.x 2015-04-05 18:07:53 +0200 Mike Gabriel (49fc383a4) * library clean-up: Don't build libNX_Xdmcp anymore. Use system's libXdmcp shared library. 2015-04-22 22:41:14 +0200 Mike Gabriel (a5bb88824) * nx-libs.spec: Drop packaging of libNX_Xpm*, in RPM packages there is no such concept for transitional/dummy packages as know from Debian/Ubuntu. 2015-04-22 22:39:14 +0200 Mike Gabriel (294d91223) * debian/control: Typo fix (Meas -> Mesa). 2015-04-22 08:38:21 +0200 Mihai Moldovan (b964406ba) * Merge branch 'sunweaver-pr/libxfont-cleanup' into arctica-3.6.x 2015-04-14 09:24:55 +0200 Mike Gabriel (70b77a0fc) * library clean-up: Don't build and link libXfont.a anymore. Use system's libXfont shared library and link dynamically. (origin/pr/libxfont-cleanup, gh-salva/pr/libxfont-cleanup, gh-mjtrangoni/pr/libxfont-cleanup, gh-ionic/pr/libxfont-cleanup, gh-Ionic/pr/libxfont-cleanup, gh-Etersoft/pr/libxfont-cleanup) 2015-04-21 15:28:25 +0200 Mike Gabriel (a77ca871c) * fix for Xcursor clean-up (422fe90) 2015-04-17 00:12:52 +0200 Mike Gabriel (a20e77b7c) * imake cleanup (nx-X11/programs/Xserver/Imakefile): Drop build rules for XF86Server and XorgServer. 2015-04-16 18:30:39 -0400 Mike DePaulo (8b1577599) * Merge pull request #12 from sunweaver/pr/arch-cleanup.CRAY 2015-04-16 22:12:45 +0200 Mihai Moldovan (0d9217127) * Merge branch 'sunweaver-pr/xcursor-cleanup' into arctica-3.6.x 2015-04-08 21:52:51 +0200 Mike Gabriel (422fe9071) * library clean-up: Drop nx-X11/lib/Xcursor. Not used at build time. 2015-04-16 18:03:18 +0200 Mihai Moldovan (cfc0202b4) * Merge branch 'sunweaver-pr/nxupgradeagent-cleanup' into arctica-3.6.x 2015-04-14 09:42:35 +0200 Mike Gabriel (a5f71f084) * NXAGENT_UPGRADE code cleanup: 2015-04-15 10:16:18 +0200 Karl Tomlinson (ac9fbaabd) * MakeBigReq: don't move the last word, already handled by Data32 (X.Org CVE-2013-7439). 2015-04-15 09:58:01 +0200 Mike Gabriel (bad677992) * old-arch cleanup: Drop CRAY support (i.e., drop code related to CRAY, _CRAY, WORD64, WORD64ALIGN, MUSTCOPY, UNSIGNEDBITFIELDS definitions). 2015-04-15 12:37:30 +0200 Mike Gabriel (fad840cfe) * test script: doc/examples/run-nxproxy2nxproxy-test 2015-04-13 15:48:07 +0200 Mike Gabriel (097562b8b) * drop: nx-X11/config/util/ (not needed at build time). 2015-04-13 15:39:36 +0200 Mike Gabriel (a8dad09a5) * imake clean-up: nx-X11/config/Imakefile (drop BuildDPSLibrary related build-logic). 2015-04-11 17:38:02 +0200 Mike Gabriel (2f4d7dbb4) * fix for libXpm4-cleanup 2015-04-05 22:31:33 +0200 Mike Gabriel (d97b0ca93) * fix for ebe00df38f264ef71dac3c73d416a74685c8cbd2 (removal of DmxLibrary) 2015-04-05 20:58:58 +0200 Mihai Moldovan (bb23f7a3d) * Merge branch 'feature/other-Xserver-cleanup' into arctica-3.6.x 2015-03-04 14:08:50 +0100 Mike Gabriel (d280fa15e) * imake clean: Remove (probably incomplete) support for NXZaurusXServer, NXiPAQXServer. 2015-03-04 13:56:53 +0100 Mike Gabriel (6db94c3e1) * imake cleanup: nx-X11/programs/Xserver/Imakefile (drop non-provided Xserver variants) 2015-03-04 13:43:54 +0100 Mike Gabriel (05d208351) * imake cleanup: nx-X11/programs/Imakefile (reduce to minimal). 2015-03-04 13:34:21 +0100 Mike Gabriel (78ac4396a) * imake cleanup: Drop all references to BuildFontServer. 2015-03-04 13:29:02 +0100 Mike Gabriel (f5f280417) * imake cleanup: Drop all references to XprtServer and BuildXprint*. 2015-03-04 08:35:50 +0100 Mike Gabriel (ebe00df38) * imake cleanup: Drop all references to XdmxServer and BuildXdmx*. 2015-03-03 12:30:51 +0100 Mike Gabriel (b1fc73ad4) * imake cleanup: Drop all references to XVirtualFramebufferServer. 2015-03-03 12:13:59 +0100 Mike Gabriel (6471f66c9) * imake cleanup: Drop all references to XNestServer. 2015-03-03 12:09:06 +0100 Mike Gabriel (9c46d3ddb) * imake cleanup: Drop all references to XWinServer. 2015-03-29 08:03:13 +0200 Mihai Moldovan (8ed8a43d2) * nx-X11: add more NULL guards to TEST and DEBUG sections of Render.c. 2015-03-29 08:02:43 +0200 Mihai Moldovan (ab4e5bf66) * debian/changelog: sync with 3.5.0.x branch. 2015-03-29 07:49:03 +0200 Mihai Moldovan (952e320cd) * nx-X11: add more NULL guards to TEST and DEBUG sections of Render.c. 2015-03-29 04:53:52 +0200 Mihai Moldovan (f1ab3f27b) * nx-X11: fix typo in previous commit. 2015-03-29 04:52:40 +0200 Mihai Moldovan (da6bb07a0) * nx-X11: fix typo in previous patch. 2015-03-29 04:26:10 +0200 Mihai Moldovan (0d56c45a7) * nx-X11: handle source pictures (those without a Drawable surface) gracefully. 2015-03-29 04:21:59 +0200 Mihai Moldovan (52224aa87) * nx-X11: handle source pictures (those without a Drawable surface) gracefully. 2015-03-26 00:41:45 +0100 Mihai Moldovan (68be7d1c8) * debian/changelog: sync with 3.5.0.x branch. 2015-03-26 00:23:09 +0100 Mihai Moldovan (a88fc7163) * Only use the first three numbers in the full version for current_version on OS X. ld(1) on 10.6 fails otherwise. 2015-03-26 00:32:27 +0100 Mihai Moldovan (d86ce9c7a) * nxcomp{,ext,shad}: only use the first three numbers in the full version for current_version on OS X. ld(1) on 10.6 fails otherwise. 2015-03-17 19:20:25 +0100 X2Go Release Manager (1e0adb715) * Continue development 2015-03-17 19:09:05 +0100 X2Go Release Manager (71589a050) * Mid-release fixup: Rename *nxcomp{ext,shad}*.full+lite* to *nxcomp{ext,shad}*.full*. (tag: redist-server/3.5.0.31, tag: redist-client/3.5.0.31) 2015-03-17 18:48:16 +0100 X2Go Release Manager (8963b8e70) * release 3.5.0.31 2015-03-17 18:28:15 +0100 Mihai Moldovan (b30a05e3a) * nx-libs.spec: add overlooked Obsolete: statement to libNX_Xfixes3. 2015-03-17 18:26:26 +0100 Mihai Moldovan (605c27e5c) * nx-libs.spec: Versioned libXcomp* should obsolete unversioned libXcomp*, not libNX_Xcomp*. 2015-03-17 18:28:15 +0100 Mihai Moldovan (fcb2cb5e0) * nx-libs.spec: add overlooked Obsolete: statement to libNX_Xfixes3. 2015-03-17 18:26:26 +0100 Mihai Moldovan (8a260b94f) * nx-libs.spec: Versioned libXcomp* should obsolete unversioned libXcomp*, not libNX_Xcomp*. 2015-03-16 03:29:16 +0100 Mihai Moldovan (d8de5928e) * nx{comp{,ext,shad},proxy}: try really hard to find makedepend. Do not fail if it is not available. 2015-03-16 03:04:21 +0100 Mihai Moldovan (06b51cc33) * nx{comp{,ext,shad},proxy}: try really hard to find makedepend. Do not fail if it is not available. 2015-03-15 17:29:50 +0100 Clemens Lang (638e31c2f) * nxcomp{,ext,shad}: use the correct library naming scheme on OS X. It differs from other UNIX-based systems. 2015-03-15 17:26:24 +0100 Clemens Lang (ad7e12ed3) * nxcomp{,shad}: fix dynamic library linking on OS X. Use -dynamiclib instead of -bundle. 2015-03-15 17:22:38 +0100 Clemens Lang (5464a6dba) * nx{comp{,ext,shad},proxy}: use path discovery for finding makedepend. Remove old cruft. 2015-03-15 07:33:51 +0100 Clemens Lang (91f1fed27) * nxcomp{,ext,shad}: use the correct library naming scheme on OS X. It differs from other UNIX-based systems. 2015-03-15 07:21:00 +0100 Clemens Lang (d055e523d) * nxcomp{,shad}: fix dynamic library linking on OS X. Use -dynamiclib instead of -bundle. 2015-03-15 07:18:14 +0100 Clemens Lang (8b45079eb) * nx{comp{,ext,shad},proxy}: use path discovery for finding makedepend. Remove old cruft. Adds: 2015-03-15 01:13:56 +0100 Mihai Moldovan (c460e090b) * debian/changelog: fix wrong signature. 2015-03-15 01:12:13 +0100 Mihai Moldovan (d8b5ca2bf) * debian/changelog: merge with 3.6.x development branch. 2015-03-15 01:10:31 +0100 Mihai Moldovan (98e56c125) * debian/changelog: merge with 3.5.0.x release branch. 2015-03-15 00:49:40 +0100 X2Go Release Manager (a90faa174) * Continue development 2015-03-14 14:38:18 +0100 Mike Gabriel (9c9b892fd) * release 3.5.0.30 (tag: redist-server/3.5.0.30, tag: redist-client/3.5.0.30) 2015-03-13 16:14:30 +0100 X2Go Release Manager (69b82c8f7) * Continue development 2015-03-13 16:13:36 +0100 X2Go Release Manager (12a395aac) * debian/roll-tarballs.sh: fix tarball creation in lite mode: do not try to fixup NX-X11 directory (it won't be there.) 2015-03-13 15:55:08 +0100 X2Go Release Manager (8367380eb) * release 3.5.0.29 (tag: redist-server/3.5.0.29, tag: redist-client/3.5.0.29) 2015-03-13 15:14:07 +0100 Mike Gabriel (7d2254185) * README.md: Fix typo, update date. 2015-03-13 15:13:00 +0100 Mike Gabriel (286d8917c) * README.md markdown fixup 2015-03-13 15:08:10 +0100 Mike Gabriel (2922ec512) * README.md: Add 3.6.x release goals. 2015-03-05 12:24:42 +0100 Mike Gabriel (18e186b51) * Makefile: clean-up auto-generated nxversion.def in clean rule (not in build rule). 2015-03-03 12:34:48 +0100 Mike Gabriel (1a4d0c7c5) * nx-X11/**: Drop non-imake Makefile* files. 2015-03-03 12:01:01 +0100 Mike Gabriel (f11393a05) * nx-X11/config/cf/X11.tmpl: Fix imake warning ("UseInstalledOnCrossCompile" is not defined). 2015-03-04 08:09:34 +0100 Mike Gabriel (897e2e2de) * Merge pull request #4 from sunweaver/feature/libxpm-cleanup 2015-02-27 00:14:10 +0100 Mike Gabriel (1d71c9ebd) * library clean-up: Don't build libNX_Xpm anymore. Use system's libXpm shared library. 2015-02-18 08:14:09 -0500 Mike DePaulo (46318a51e) * Drop unused .cvsignore files 2015-02-18 07:51:55 -0500 Mike DePaulo (c29c331ce) * Update changelog for the CVE-2015-0255 commit and its 3 prereq commits 2015-02-18 07:43:20 -0500 Mike DePaulo (2b2a02f93) * X.org CVE-2015-0255 patch and its 3 prereq patches (origin/master, gh-salva/master, gh-mjtrangoni/master, gh-ionic/master, gh-Ionic/master, gh-Etersoft/master) 2015-02-18 08:01:54 +0100 Mike Gabriel (ec018a79c) * Fix symlink to renamed README.md. 2015-02-18 06:18:03 +0100 Mike Gabriel (f7e109e5c) * README.md: Mention the TheQVD project as collaborator on NX. 2015-02-18 05:06:41 +0100 Mike Gabriel (5c24a09a1) * rename README.txt to README.md 2015-02-18 05:05:27 +0100 Mike Gabriel (04af6fefb) * switch symlink and real file 2015-02-18 05:03:57 +0100 Mike Gabriel (f29801f37) * Add README.txt symlink to README.NX-development (to have it shown on the Github summary page). 2015-01-16 08:44:45 +0100 Olivier Fourdan (d7258444a) * xkb: Check strings length against request size 2015-01-16 20:08:59 +0100 Olivier Fourdan (9308c79ba) * xkb: Don't swap XkbSetGeometry data in the input buffer 2009-06-29 13:09:57 +1000 Peter Hutterer (3937db18a) * include: introduce byte counting functions. 2006-04-07 16:07:50 +0000 Daniel Stone (d6ce946f9) * Coverity #844, #845, #846: Fix memory leaks. 2015-02-17 09:28:03 +0100 Mike Gabriel (c910bf7cd) * Merge pull request #3 from sunweaver/feature/nxagent-version-v2 2015-02-16 15:11:02 +0100 Mike Gabriel (203d97147) * Make nxagent process aware of its current NX'ish version. 2015-02-16 15:10:43 +0100 Mike Gabriel (eb49d408c) * nx-X11/programs/Xserver/hw/nxagent/: Drop unused VERSION file. 2011-08-21 18:51:53 +0200 Joerg Sonnenberger (65deb86f8) * Do proper input validation to fix for CVE-2011-2895. 2015-02-16 10:29:14 +0100 Mike Gabriel (18e337ddf) * Revert "Do proper input validation to fix for CVE-2011-2895." 2015-02-16 09:57:17 +0100 Mike Gabriel (ac2937e71) * Update 1042-Do-proper-input-validation-to-fix-for-CVE-2011-2895.patch. Fix broken comment paragraph, whitespace fix. (gh-sunweaver/master) 2015-02-16 09:40:16 +0100 Mihai Moldovan (650181c23) * CVE security review: Add 1041-nx-X11-lib-font-fc-fserve.c-initialize-remaining-buf.patch & 1042-Do-proper-input-validation-to-fix-for-CVE-2011-2895.patch. 2015-02-16 09:35:47 +0100 Mihai Moldovan (ae898ff13) * CVE security review [1/2]. 2015-02-16 06:24:38 +0100 Mike Gabriel (26cfe931f) * fix 3.5.0.29 changelog entry 2015-02-16 06:19:54 +0100 Mike Gabriel (1f3222fa0) * debian/changelog: fix too-long lines 2015-02-16 05:51:02 +0100 Mike Gabriel (db12538dd) * Makefile.nx-libs: Fix uninstall-lite rule. The nxproxy and nxcomp uninstallation has to be in uninstall-lite, not in uninstall-full. 2015-02-16 05:45:17 +0100 Mike Gabriel (892c08ddc) * Make install-lite rule in Makefile.nx-libs more predictable and not rely on nxproxy/Makefile.in. 2015-02-14 21:55:30 +0100 Mike Gabriel (f29cc29fd) * Install "%{_libdir}/nx/bin" into nxproxy package. 2015-02-14 21:53:00 +0100 Mike Gabriel (742430826) * nx-libs.spec: Typo fix in comment. 2015-02-14 17:07:21 -0500 Mike DePaulo (e4d97018b) * Fix FTBFS due to the nxproxy executable already existing under /usr/lib/nx/bin/nx 2015-02-16 06:19:54 +0100 Mike Gabriel (f74f59d2f) * debian/changelog: fix too-long lines 2011-08-21 18:51:53 +0200 Joerg Sonnenberger (6acafc933) * Do proper input validation to fix for CVE-2011-2895. 2015-02-16 05:51:02 +0100 Mike Gabriel (ffb64d2b0) * Makefile.nx-libs: Fix uninstall-lite rule. The nxproxy and nxcomp uninstallation has to be in uninstall-lite, not in uninstall-full. 2015-02-16 05:45:17 +0100 Mike Gabriel (d2ff2138b) * Make install-lite rule in Makefile.nx-libs more predictable and not rely on nxproxy/Makefile.in. 2015-02-16 06:03:48 +0100 Mihai Moldovan (b04f11915) * nx-X11/lib/font/fc/fserve.c: initialize remaining bufleft variables. 2014-01-06 23:30:14 -0800 Alan Coopersmith (b6b5b14e4) * dix: integer overflow in GetHosts() [CVE-2014-8092 2/4] 2015-02-16 05:55:23 +0100 Mihai Moldovan (03a2922d9) * Revert "dix: integer overflow in GetHosts() [CVE-2014-8092 2/4]" 2015-02-08 21:03:33 -0500 Mike DePaulo (31322c2bd) * CVE-2014-0210: unvalidated length in _fs_recv_conn_setup() from xorg/lib/libXfont commit 891e084b26837162b12f841060086a105edde86d 2015-02-16 05:52:09 +0100 Mihai Moldovan (c0d0e373d) * Revert "CVE-2014-0210: unvalidated length in _fs_recv_conn_setup() from xorg/lib/libXfont commit 891e084b26837162b12f841060086a105edde86d" 2015-02-08 22:08:09 -0500 Mike DePaulo (e29bbd5bf) * CVE-2014-0210: unvalidated length fields in fs_read_query_info() from xorg/lib/libXfont commit 491291cabf78efdeec8f18b09e14726a9030cc8f 2015-02-16 05:26:40 +0100 Mihai Moldovan (5fc2f57fb) * Revert "CVE-2014-0210: unvalidated length fields in fs_read_query_info() from xorg/lib/libXfont commit 491291cabf78efdeec8f18b09e14726a9030cc8f" 2015-02-14 21:55:30 +0100 Mike Gabriel (0a423ce8f) * Install "%{_libdir}/nx/bin" into nxproxy package. 2015-02-14 21:53:00 +0100 Mike Gabriel (db328b616) * nx-libs.spec: Typo fix in comment. 2015-02-14 17:07:21 -0500 Mike DePaulo (7b0c8a2ac) * Fix FTBFS due to the nxproxy executable already existing under /usr/lib/nx/bin/nx 2015-02-14 16:40:07 +0100 Mike Gabriel (458788113) * 40 patches, fixing several X.Org CVEs in NX. 2015-02-14 16:25:46 +0100 Mike Gabriel (f46d11790) * remove item from changelog that got reverted 2015-02-14 16:23:43 +0100 Mike Gabriel (09d2732b4) * Patch system: Prepend a "0" to every patch file name in debian/patches/. Adapt only this changelog stanza to this modification. 2014-11-10 12:13:48 -0500 Adam Jackson (1ea1cd8c4) * glx: Pass remaining request length into ->varsize (v2) [CVE-2014-8098 8/8] (V3) 2014-11-10 12:13:43 -0500 Adam Jackson (9c558f9ca) * glx: Length checking for RenderLarge requests (v2) [CVE-2014-8098 3/8] (v3) 2014-11-10 12:13:47 -0500 Adam Jackson (893106607) * glx: Length checking for non-generated single requests (v2) [CVE-2014-8098 7/8] 2014-11-10 12:13:44 -0500 Adam Jackson (ad29acd76) * glx: Top-level length checking for swapped VendorPrivate requests [CVE-2014-8098 4/8] 2014-11-10 12:13:42 -0500 Adam Jackson (ddb1235bc) * glx: Integer overflow protection for non-generated render requests (v3) [CVE-2014-8093 5/6] 2014-11-10 12:13:41 -0500 Julien Cristau (78b38a8a3) * glx: Length checking for GLXRender requests (v2) [CVE-2014-8098 2/8] (v3) 2014-11-10 12:13:40 -0500 Adam Jackson (1a9f23118) * glx: Add safe_{add,mul,pad} (v3) [CVE-2014-8093 4/6] (v4) 2014-11-10 12:13:38 -0500 Adam Jackson (d0fcbc8a6) * glx: Additional paranoia in __glXGetAnswerBuffer / __GLX_GET_ANSWER_BUFFER (v2) [CVE-2014-8093 3/6] 2014-11-10 12:13:37 -0500 Adam Jackson (cdf0c3e65) * glx: Be more strict about rejecting invalid image sizes [CVE-2014-8093 2/6] 2014-11-10 12:13:36 -0500 Adam Jackson (5c43bb248) * glx: Be more paranoid about variable-length requests [CVE-2014-8093 1/6] (v2) 2014-01-26 19:38:09 -0800 Alan Coopersmith (cea44678d) * randr: unvalidated lengths in RandR extension swapped procs [CVE-2014-8101] 2014-01-26 20:02:20 -0800 Alan Coopersmith (c12a473f2) * xfixes: unvalidated length in SProcXFixesSelectSelectionInput [CVE-2014-8102] 2014-01-26 19:51:29 -0800 Alan Coopersmith (9c3842a4f) * render: unvalidated lengths in Render extn. swapped procs [CVE-2014-8100 2/2] 2014-10-28 10:30:04 +0100 Julien Cristau (6c820648b) * render: check request size before reading it [CVE-2014-8100 1/2] 2014-01-26 19:23:17 -0800 Alan Coopersmith (2abde565d) * Xv: unvalidated lengths in XVideo extension swapped procs [CVE-2014-8099] 2014-01-26 17:18:54 -0800 Alan Coopersmith (0d53194f7) * xcmisc: unvalidated length in SProcXCMiscGetXIDList() [CVE-2014-8096] 2014-01-26 10:54:41 -0800 Alan Coopersmith (fde1375e3) * Xi: unvalidated lengths in Xinput extension [CVE-2014-8095] 2014-01-22 23:12:04 -0800 Alan Coopersmith (985ca320f) * dbe: unvalidated lengths in DbeSwapBuffers calls [CVE-2014-8097] 2014-01-22 23:44:46 -0800 Alan Coopersmith (82d7279eb) * dix: integer overflow in REQUEST_FIXED_SIZE() [CVE-2014-8092 4/4] 2014-01-22 22:37:15 -0800 Alan Coopersmith (ed1e13a1f) * dix: integer overflow in RegionSizeof() [CVE-2014-8092 3/4] 2014-01-06 23:30:14 -0800 Alan Coopersmith (d4c76981f) * dix: integer overflow in GetHosts() [CVE-2014-8092 2/4] 2014-01-22 21:11:16 -0800 Alan Coopersmith (c1225fe64) * dix: integer overflow in ProcPutImage() [CVE-2014-8092 1/4] 2014-01-17 18:54:03 -0800 Alan Coopersmith (37e7fb1f6) * unchecked malloc may allow unauthed client to crash Xserver [CVE-2014-8091] 2015-02-08 22:38:32 -0500 Mike DePaulo (b65259bf3) * CVE-2014-0210: unvalidated length fields in fs_read_list_info() from xorg/lib/libXfont commit d338f81df1e188eb16e1d6aeea7f4800f89c1218 2015-02-08 22:35:21 -0500 Mike DePaulo (ef439da38) * CVE-2014-0210: unvalidated length fields in fs_read_list() from xorg/lib/libXfont commit 5fa73ac18474be3032ee7af9c6e29deab163ea39 2015-02-08 22:27:47 -0500 Mike DePaulo (ece51493f) * CVE-2014-0210: unvalidated length fields in fs_read_glyphs() from xorg/lib/libXfont commit 520683652564c2a4e42328ae23eef9bb63271565 2015-02-08 22:26:16 -0500 Mike DePaulo (d2b96c5d5) * CVE-2014-0210: unvalidated length fields in fs_read_extent_info() from xorg/lib/libXfont commit a3f21421537620fc4e1f844a594a4bcd9f7e2bd8 2015-02-08 22:23:51 -0500 Mike DePaulo (a0bed4d9f) * CVE-2014-0211: integer overflow in fs_alloc_glyphs() from xorg/lib/libXfont commit a42f707f8a62973f5e8bbcd08afb10a79e9cee33 2015-02-08 22:19:01 -0500 Mike DePaulo (bb7abd9da) * CVE-2014-0211: integer overflow in fs_read_extent_info() from xorg/lib/libXfont commit c578408c1fd4db09e4e3173f8a9e65c81cc187c1 2015-02-08 22:08:09 -0500 Mike DePaulo (c6aebf928) * CVE-2014-0210: unvalidated length fields in fs_read_query_info() from xorg/lib/libXfont commit 491291cabf78efdeec8f18b09e14726a9030cc8f 2015-02-08 21:43:42 -0500 Mike DePaulo (2d724c1a0) * CVE-2014-0211: Integer overflow in fs_get_reply/_fs_start_read from xorg/lib/libXfont commit 0f1a5d372c143f91a602bdf10c917d7eabaee09b 2015-02-08 21:39:55 -0500 Mike DePaulo (50e80a06c) * CVE-2014-0210: unvalidated lengths when reading replies from font server from xorg/lib/libXfont commit cbb64aef35960b2882be721f4b8fbaa0fb649d12 2015-02-08 21:33:30 -0500 Mike DePaulo (a2c7cd9fe) * Don't crash when we receive an FS_Error from the font server (Guillem Jover). from xorg/lib/libXfont commit bfb8a71f4f7e5c5ed4278cb3ee271bf9990d276d 2015-02-08 21:03:33 -0500 Mike DePaulo (94c6de064) * CVE-2014-0210: unvalidated length in _fs_recv_conn_setup() from xorg/lib/libXfont commit 891e084b26837162b12f841060086a105edde86d 2015-02-08 20:53:14 -0500 Mike DePaulo (36f1dae74) * CVE-2014-0209: integer overflow of realloc() size in lexAlias() from xorg/lib/libXfont commit 05c8020a49416dd8b7510cbba45ce4f3fc81a7dc 2015-02-08 20:28:30 -0500 Mike DePaulo (f53f2474d) * CVE-2014-0209: integer overflow of realloc() size in FontFileAddEntry() from xorg/lib/libXfont commit 2f5e57317339c526e6eaee1010b0e2ab8089c42e 2015-02-08 20:12:25 -0500 Mike DePaulo (ac6694378) * CVE-2013-6462: unlimited sscanf overflows stack buffer in bdfReadCharacters() from xorg/lib/libXfont http://lists.x.org/archives/xorg-announce/2014-January/002389.html 2015-02-08 20:01:27 -0500 Mike DePaulo (72790a558) * Avoid use-after-free in dix/dixfonts.c: doImageText() [CVE-2013-4396] from xorg/Xserver http://lists.x.org/archives/xorg-announce/2013-October/002332.html 2015-02-08 19:16:38 -0500 Mike DePaulo (df4a3b727) * Fix CVE-2011-4028: File disclosure vulnerability. upstream xorg/xserver commit 6ba44b91e37622ef8c146d8f2ac92d708a18ed34 2015-02-08 19:15:20 -0500 Mike DePaulo (af55da1e9) * LZW decompress: fix for CVE-2011-2895 From xorg/lib/Xfont commit d11ee5886e9d9ec610051a206b135a4cdc1e09a0 2015-02-14 15:58:11 +0100 Mike Gabriel (902dc519d) * Move COPYING.full+lite as COPYING to / 2015-02-14 15:52:29 +0100 Mike Gabriel (9000c00dc) * Move all config files from $(srcbase)/debian/ into $(srcbase)/etc/ folder. 2015-02-14 15:29:25 +0100 Mike Gabriel (53329e609) * Provide wrapper scripts for launch NX components in $(src)/bin/. 2015-02-14 15:23:59 +0100 Mike Gabriel (1a824cfb5) * Prepare for maintaing upstream changes in upstream ChangeLog. 2015-02-14 15:14:23 +0100 Mike Gabriel (ce531230f) * VERSION file: master VERSION file is in base folder, symlinked from nx*/VERSION and hw/nxagent/VERSION. 2015-02-14 15:08:07 +0100 Mike Gabriel (ea8ca04a7) * Move Makefile (and auxiliary file replace.sh) into base folder. Adapt packaging these scripts: 2015-02-14 14:50:20 +0100 Mike Gabriel (ebf71e0a4) * Add README.keystrokes file. Fix for commit e91277d02bf1288909daed3b0de8f876f6403acf. 2015-02-14 14:43:13 +0100 Mike Gabriel (823450515) * nxcomp: Add Version.c file. Fix for commit d4d3fe0e6e77a58e68defc5895a589a681d7d092. 2015-02-14 14:28:35 +0100 Mike Gabriel (2d4a61d3c) * Version bump, continuing NX 3.x development.. Targetting NX 3.6.x some time. 2015-02-14 14:23:10 +0100 Mike Gabriel (e54e896a6) * Use proper quoting on build flag vars (they may contain spaces). 2015-02-14 14:21:52 +0100 Mike Gabriel (db3c6a6d2) * Revert "Fix build when LDFLAGS (etc) contains spaces." 2015-02-14 14:23:10 +0100 Mike Gabriel (8c98a401b) * Use proper quoting on build flag vars (they may contain spaces). 2015-02-14 14:21:52 +0100 Mike Gabriel (863119ed6) * Revert "Fix build when LDFLAGS (etc) contains spaces." 2015-02-13 14:14:26 +0100 Mike Gabriel (1e5ee575d) * nx-X11 vs. X.Org 6.9 patches for further studying / documentation 2015-02-13 13:57:39 +0100 Oleksandr Shneyder (1fd8551f1) * Unbrand NX Agent Startup Screen / Brand X2Go Agent Startup Screen (999_nxagent_unbrand-nxagent-brand-x2goagent.full.patch). 2015-02-13 13:43:54 +0100 Mike Gabriel (23fb61755) * Fix several typos in nxcomp. 2015-02-13 13:41:31 +0100 Mihai Moldovan (6e6624731) * Several fixes for building debug versions of NX (990_fix-DEBUG-and-TEST-builds.full.patch). 2015-02-13 13:38:39 +0100 Mike Gabriel (a8fb7d4f5) * Detection for Mac OS X's launchd service on Mac OS X 10.10 and beyond (607_nxcomp_macosx-X11-launcher-in-private-tmp.full+lite.patch). 2015-02-13 13:37:33 +0100 Orion Poplawski (31cdd874c) * Provide build support for aarch64 architecture (606_nx-X11_build-on-aarch64.full.patch). 2015-02-13 13:35:40 +0100 Clemens Lang (ab8d1276f) * In Types.h, don't use STL internals on libc++ (605_nxcomp_Types.h-dont-use-STL-internals-on-libc++.full+lite.patch). 2015-02-13 13:34:16 +0100 Mirraz Mirraz (96d5e74a3) * Handle some serious compilation warnings (603_nx-X11_compilation_warnings.full.patch). 2015-02-13 13:32:17 +0100 Orion Poplawski (415b20b6f) * Be compliant with POS36-C: Observe correct revocation order while relinquishing privileges (602_nx-X11_initgroups.full.patch). 2015-02-13 13:30:31 +0100 Orion Poplawski (456f887d9) * Do not build bundled libraries (601_nx-X11_build-option-changes-to-not-use-bundled-libraries.full.patch). 2015-02-13 13:27:42 +0100 Jan Engelhardt (c4a8556c4) * Unique Library Names Patch (600_nx-X11+nxcompext+nxcompshad_unique-libnames.full.patch). 2015-02-13 13:26:27 +0100 Nito Martinez (d4d3fe0e6) * Allow version 4-digit version comparison/handshake (400_nxcomp-version.full+lite.patch). 2015-02-13 13:06:53 +0100 Horst Schirmeier (fea8fb5ae) * Adapt paths of keystrokes.cfg if nxagent runs as x2goagent (321_nxagent_x2go-specific-keystroke-config.full.patch). 2015-02-13 09:52:21 +0100 Alexander Wuerstlein (e91277d02) * Make nxagent-specific keyboard bindings configurable (320_nxagent_configurable-keystrokes.full.patch). 2015-02-13 09:49:52 +0100 Mike Gabriel (4dc1bd004) * Test for xkb/rules/base instead of xkb/keymap.dir for setting XkbBaseDir (302_nx-X11_xkbbasedir-detection.full.patch). 2015-02-03 05:11:09 +0100 Mike Gabriel (a43c49594) * update changelog 2015-02-01 22:27:06 +0100 Ulrich Sibiller (08114b1e4) * Fix patch rollout in tarball 2015-02-11 19:02:57 -0500 Mike DePaulo (bccb2750b) * Fix build when LDFLAGS (etc) contains spaces. 2015-02-12 10:07:40 +0100 Mike Gabriel (fa8fb7288) * changelog: add 3.5.0.x entry for commit 4436e97 2015-02-12 09:59:57 +0100 Mike Gabriel (d569145e6) * Makefile.nx-libs: Run make install for nxproxy first, then create the wrapper script. 2015-02-12 09:59:12 +0100 Mike Gabriel (a7cc4edef) * Remove upstream nx-libs ChangeLog during override_dh_clean. 2015-02-12 09:59:57 +0100 Mike Gabriel (4157e8258) * Makefile.nx-libs: Run make install for nxproxy first, then create the wrapper script. 2015-02-12 09:59:12 +0100 Mike Gabriel (75c478521) * Remove upstream nx-libs ChangeLog during override_dh_clean. 2015-02-11 19:02:57 -0500 Mike DePaulo (4436e9790) * Fix build when LDFLAGS (etc) contains spaces. 2015-02-10 21:47:31 +0100 Jan Engelhardt (6fc37fa76) * Use shared libraries (301_nx-X11_use-shared-libs.full.patch). 2015-02-10 21:45:19 +0100 Oleksandr Shneyder (1e99734ec) * Set WM_CLASS to X2GoAgent/NXAgent (300_nxagent_set-wm-class.full.patch). 2015-02-10 21:11:27 +0100 Mike Gabriel (1be1c4a21) * Force NX proxy to bind to loopback devices only (loopback option) (220_nxproxy_bind-loopback-only.full+lite.patch). 2015-02-10 19:47:58 +0100 Nito Martinez (79f218b56) * Fix FTBFS of nxproxy/nxcomp on Android (212_nxcomp_build-on-Android.full+lite.patch). 2015-02-10 19:46:04 +0100 Oleksandr Shneyder (46c2aebca) * Set default pack and link options to avoid damage of session (211_nxcomp_set_default_options.full+lite.patch). 2015-02-10 19:43:41 +0100 Oleksandr Shneyder (8c1b852ab) * Save session state in file. 2015-02-10 19:38:45 +0100 Mike Gabriel (4a6ccd503) * Add x2goagent man page (209_x2goagent_add-man-page.full.patch). 2015-02-10 19:36:57 +0100 Ulrich Sibiller (57a58c73c) * Fix XFIXES selection handling (copy and paste via middle mouse button) (207_nxagent_fix-xfixes-selection.full.patch). 2015-02-10 19:33:51 +0100 Mike Gabriel (4ef611eea) * Add -clipboard cmdline option to nxagent (206_nxagent_clipboard-as-nxoption.full.patch). 2015-02-10 19:32:12 +0100 Oleksandr Shneyder (35aab85c7) * Fix refresh errors on Win2012 RDP connections with speed=ADS (205_nxagent_refresh-adsl.full.patch). 2015-02-10 19:29:53 +0100 Oleksandr Shneyder (db8705564) * Fix repainting of SolidFill pictures with libcairo > 1.12.x (204_nxagent_repaint-solidpict.full.patch). 2015-02-10 19:26:42 +0100 Oleksandr Shneyder (4f5dc807a) * Add -norootlessexit cmdline option to nxagent (203_nxagent_disable-rootless-exit.full.patch). 2015-02-10 19:23:16 +0100 Oleksandr Shneyder (d26930d59) * Enable Xinerama support for NX (202_nx-X11_enable-xinerama.full.patch). 2015-02-10 19:21:35 +0100 Oleksandr Shneyder (6aa18cc28) * X2Go icon when run with x2goagent flavour (201_nxagent_set-x2go-icon-if-x2goagent-flavour.full.patch). 2015-02-10 19:19:25 +0100 Oleksandr Shneyder (1681f1110) * Detect nxagent/x2goagent flavour (200_nxagent_check-binary-x2go-flavour.full.patch). 2015-02-10 19:17:58 +0100 Mike Gabriel (471223907) * Avoid large pixmaps (110_nxagent_createpixmap-bounds-check.full.patch). 2015-02-10 19:14:04 +0100 Mike Gabriel (223f5548b) * Wine Close Delay (108_nxagent_wine-close-delay.full.patch). 2015-02-10 19:04:00 +0100 Mike Gabriel (658d07e93) * Prevent sending COMPOUND_TEXT (107_nxagent_clipboard-compound-text+small-bed-sheets.full.patch). 2015-02-10 19:00:06 +0100 Mike Gabriel (9674c4346) * UTF-8 Clipboard copying (106_nxagent_utf8-copy-clipboard.full.patch). 2015-02-10 18:56:59 +0100 Marcelo Boveto Shima (c91fe980b) * Export remote keyboard configuration to session directory (105_nxagent_export-remote-keyboard-config.full.patch) 2015-02-10 18:54:29 +0100 Mike Gabriel (c106ad8e8) * FHS path fix for keyboard config file (103_nxagent_set-X0-config-path.full.patch). 2015-02-10 18:52:39 +0100 Marcelo Boveto Shima (057999efa) * FHS path fix for SecurityPolicy file (102_xserver-xext_set-securitypolicy-path.full.patch). 2015-02-10 18:48:39 +0100 Marcelo Boveto Shima (ceb70505c) * FHS path fix for rgb file This patch is needed on Debian only, not reporting this path addition to upstream. 2015-02-10 18:41:08 +0100 Mihai Moldovan (2d68caca7) * Create Windows and fix drawing issues on Big Endian 64bit systems (057_nx-X11_sanitize-eventmasks.full.patch). 2015-02-09 15:58:22 +0100 Orion Poplawski (4dac57f3d) * Fix -Werror=format-security errors (056_nx-X11_Werror-format-security.full.patch). 2015-02-09 15:51:26 +0100 Orion Poplawski (95dbaa614) * Fix FTBFS when compiled with -Werror=format-security (055_nx-X11_imake-Werror-format-security.full.patch). 2015-02-09 15:49:51 +0100 Orion Poplawski (0b711de48) * Fix FTBFS on ppc64 architecture (054_nx-X11_ppc64-ftbfs.full.patch). 2015-02-09 15:47:44 +0100 Orion Poplawski (9ea734b21) * Avoid building libXcomp.so.1 (which is identical to libXcomp.so.3), (053_nx-X11_no-xcomp1-install-target.full.patch). 2015-02-09 15:45:33 +0100 Mihai Moldovan (e736fff09) * Fix nxauth location on Mac OS X 10 (052_nxcomp_macos10-nxauth-location.full+lite.patch) 2015-02-09 15:41:35 +0100 Mihai Moldovan (905478694) * workaround for Mac OS X 10.5 (051_nxcomp_macos105-fdisset.full+lite.patch( 2015-02-09 15:38:59 +0100 Jan Engelhardt (6101bd956) * Description: Enable parallel make (031_nx-X11_parallel-make.full.patch). 2015-02-09 15:34:02 +0100 Jan Engelhardt (9f4b494fa) * Allow to pass in configure args (030_nx-X11_configure-args.full.patch). 2015-02-09 15:31:46 +0100 Mihai Moldovan (bd10fe591) * Fix BIGENDIAN issue in nxcomp (relevant on PPC64 arch) (029_nxcomp_ppc64.full+lite.patch) 2015-02-09 15:29:53 +0100 Mike Gabriel (f6619070b) * Support abstract local sockets for Linux systems (028_nx-X11_abstract-kernel-sockets.full.patch). 2015-02-09 15:27:46 +0100 Mike Gabriel (aaf4a59e4) * Add X11 abstract socket support to nxcomp/nxproxy (027_nxcomp_abstract-X11-socket.full+lite.patch). 2015-02-09 15:22:07 +0100 Orion Poplawski (3384aba38) * Honour compiler/linker option flags. 2015-02-09 15:19:12 +0100 Gabriel Marcano (78efa8bf9) * Fix FTBFS against libjpeg9a (025_nxcomp-fix-ftbfs-against-jpeg9a.full+lite.patch). 2015-02-09 15:16:30 +0100 Mike Gabriel (236ee4ffa) * nxcomp*, nxproxy: Fix clean-up of source tree via Makefile.in templates. 2015-02-09 15:12:11 +0100 Mike Gabriel (9b72eeaa2) * FHS adaptation for Debian packaging (016_nx-X11_install-location.full.patch). From tarball, NX libraries and binaries are installed to /usr/local/lib/nx. . FIXME: The paths in this patch get superceded by current build logic in nx-libs.spec and debian/rules. This should be merged into the NX build logic finally. 2015-02-09 08:37:40 -0500 Mike DePaulo (a097b2c05) * Fix RPM spec syntax error 2015-02-09 08:37:40 -0500 Mike DePaulo (519bcac93) * Fix RPM spec syntax error 2015-02-09 14:26:02 +0100 Mike Gabriel (4bc550e86) * nxcomp*,nxproxy: Add clean rules to Makefile.in templates. 2015-02-09 14:23:12 +0100 Mike Gabriel (27ddd1695) * Work on man pages. 2015-02-09 14:20:22 +0100 Mike Gabriel (a0b2fd836) * sa_restorer vs. memset (008_nxcomp_sa-restorer.full+lite.patch). Use memset instead of setting sa_restorer to NULL. 2015-02-09 14:18:50 +0100 Mike Gabriel (a720908a6) * Remove .gch files during cleanup (007_nxcompshad_clean-gch-files.full.patch). When building nxcompshad .gch files get created. On cleanup these should be removed. 2015-02-09 14:16:10 +0100 Mike Gabriel (f27e7424f) * Fix building against libpng 1.5 (006_nxcomp_libpng15.full+lite.patch). From the libpng homepage... 2015-02-09 11:57:55 +0100 Marcelo Boveto Shima (48c828107) * Description: gcc43 fix (005_nxcomp_gcc43.full+lite.patch) Use builtin includes to build with gcc43. 2015-02-09 11:56:14 +0100 Mike Gabriel (dd20ab5e6) * Description: Fix build on Debian (004_nx-X11_fix-nxcompshad-build.full.patch) By an unknown reason this patch currently is needed to build nx-X11, nxcomp, nxcompshad and nxcompext with dpkg-buildpackage and debuild. 2015-02-09 11:53:47 +0100 Marcelo Boveto Shima (b3496d0a7) * gcc43 fix (003_nxcompshad_gcc43.full.patch) Use builtin includes to build with gcc43. 2015-02-09 11:46:07 +0100 Mike Gabriel (3b4a91598) * Build nxcompshad against nx-X11 (002_nxcompshad_build-against-nx-x11-only.full.patch). Make sure nxcompshad get built against nx-X11. . Furthermore /usr/X11R6/lib is an outdated path on current Debian systems. 2015-02-09 11:44:17 +0100 Mike Gabriel (7a1bd6b29) * Provide README.NX-development file. Drop README.NX-redistribution file. 2015-02-09 10:46:10 +0100 Mike Gabriel (abbe93861) * fix long-line in changelog 2015-02-09 10:46:10 +0100 Mike Gabriel (b62d8c5b0) * fix long-line in changelog 2015-02-09 10:37:17 +0100 Mike Gabriel (eb55dc8fd) * Drop not-used-anymore NX source tree clean-up code. Source tree has been cleaned up natively. 2015-02-09 10:32:49 +0100 Mike Gabriel (939492d83) * Revert "Add patch 700_nx-X11_mesa-initialize-server-support-correctly.full.patch. Initialize server_support array with correct size. Fix Mesa upstream bugzilla bug #7353. (Fixes: #776)." 2015-02-09 10:30:42 +0100 Mike Gabriel (02316322c) * Revert "Add patch 700_nx-X11_mesa-initialize-server-support-correctly.full.patch. Initialize server_support array with correct size. Fix Mesa upstream bugzilla bug #7353. (Fixes: #776)." 2015-02-03 05:11:09 +0100 Mike Gabriel (48e2c84f3) * update changelog 2015-02-02 15:31:35 +0100 Mike Gabriel (9c52824a8) * Update 991_fix-hr-typos.full.patch. Don't patch files that get removed by the NX code reduction effort. 2015-02-02 15:29:45 +0100 Mike Gabriel (2f1a0ad60) * Drop 604_nx-X11_recent-freetype-API.full.patch. Not used in current build process. 2015-02-02 15:26:51 +0100 Mike Gabriel (98c5283b2) * Update 600_nx-X11+nxcompext+nxcompshad_unique-libnames.full.patch. Don't patch files matter to the NX code reduction efforts. 2015-02-02 15:25:43 +0100 Mike Gabriel (c70f52450) * Update 031_nx-X11_parallel-make.full.patch. Don't patch .original files in NX code tree. 2015-02-02 15:24:31 +0100 Mike Gabriel (e743a6f7b) * Drop patches: 017_nx-X11_update-autotools-helper-files.full.patch, 018_nx-X11_update-libtool-ltmain-script.full.patch, 019_nx-X11_expat-build-against-system-libxmltok.full.patch. They patch files that are not used at build time. 2015-02-03 05:04:38 +0100 Mike Gabriel (21398f377) * Merge pull request #1 from uli42/x2go 2015-02-03 04:59:13 +0100 Mike Gabriel (4db6f0fdb) * Add patch 700_nx-X11_mesa-initialize-server-support-correctly.full.patch. Initialize server_support array with correct size. Fix Mesa upstream bugzilla bug #7353. (Fixes: #776). 2015-02-03 04:59:13 +0100 Mike Gabriel (b992fdaa0) * Add patch 700_nx-X11_mesa-initialize-server-support-correctly.full.patch. Initialize server_support array with correct size. Fix Mesa upstream bugzilla bug #7353. (Fixes: #776). 2015-02-02 15:31:35 +0100 Mike Gabriel (231ffa85e) * Update 991_fix-hr-typos.full.patch. Don't patch files that get removed by the NX code reduction effort. 2015-02-02 15:29:45 +0100 Mike Gabriel (91dc4b509) * Drop 604_nx-X11_recent-freetype-API.full.patch. Not used in current build process. 2015-02-02 15:26:51 +0100 Mike Gabriel (237d7487f) * Update 600_nx-X11+nxcompext+nxcompshad_unique-libnames.full.patch. Don't patch files matter to the NX code reduction efforts. 2015-02-02 15:25:43 +0100 Mike Gabriel (0c42e33b4) * Update 031_nx-X11_parallel-make.full.patch. Don't patch .original files in NX code tree. 2015-02-02 15:24:31 +0100 Mike Gabriel (42f3b1442) * Drop patches: 017_nx-X11_update-autotools-helper-files.full.patch, 018_nx-X11_update-libtool-ltmain-script.full.patch, 019_nx-X11_expat-build-against-system-libxmltok.full.patch. They patch files that are not used at build time. 2015-02-02 15:20:12 +0100 Mike Gabriel (86f96b065) * empty CODE-REDUCTION_* files (maybe usable later for futher code reduction efforts 2015-02-02 15:17:59 +0100 Mike Gabriel (541c80d32) * fix for last commit 2015-02-02 15:04:01 +0100 Mike Gabriel (e399356ed) * drop .original files from the current code base 2015-02-02 15:02:49 +0100 Mike Gabriel (b16b9e465) * massive reduction of unneeded files 2015-02-02 14:47:22 +0100 Mike Gabriel (0d5a83e98) * On SLE 11.x: libX* packages are prefixed with "xorg-x11-". 2015-02-01 22:27:06 +0100 Ulrich Sibiller (f8fa7cb19) * Fix patch rollout in tarball (gh-uli42/x2go) 2015-01-29 13:04:46 +0100 Mike Gabriel (dc7495063) * Assure that BuildRoot: is set. (gh-uli42/master) 2015-01-29 12:48:05 +0100 Mike Gabriel (d9a48367e) * nx-libs.spec: Set PREFIX=%{_prefix} USRLIBDIR=%{_libdir} SHLIBDIR=%{_libdir} at build time. 2015-01-29 12:40:22 +0100 Mike Gabriel (804584cb1) * Don't fail if removing *.a files fails due to the files being non-present. 2015-01-29 12:12:15 +0100 Mike Gabriel (0b9fce27b) * Makefile.nx-libs: fix faulty path to nxproxy.1 man page 2015-01-29 12:05:23 +0100 Mike Gabriel (5e8563876) * nx-libs.spec: several dependency fixes... 2015-01-29 11:53:16 +0100 Mike Gabriel (a161173d1) * Make libNX_X11-6 and libXinerama1 compliant to Shared Library Policy. 2015-01-29 11:49:37 +0100 Mike Gabriel (76c529124) * nx-libs.spec: Install man pages into bin:packages. 2015-01-29 11:49:28 +0100 Mike Gabriel (9a901a9f6) * Makefile.nx-libs: Install man pages via main Makefile. 2015-01-29 11:46:31 +0100 Mike Gabriel (7e0de4df1) * nx-libs.spec: Mention NX technology in every package description. 2015-01-29 09:46:34 +0100 Mike Gabriel (10d670c0c) * Support .symbols for 64bit and 32bit alike. 2015-01-28 23:18:58 +0100 Mike Gabriel (cde624f45) * Use SONAME based library package naming scheme. 2015-01-28 23:17:45 +0100 Mike Gabriel (5a74175cd) * Revert "Use SONAME based library package naming scheme." 2015-01-28 23:14:49 +0100 Mike Gabriel (1e5c83e8b) * Use SONAME based library package naming scheme. 2015-01-28 23:06:25 +0100 Mike Gabriel (6d54eba6c) * debian/control: don't use 1 person plural in LONG_DESCRIPTION 2015-01-28 23:01:59 +0100 Mike Gabriel (d306c9004) * nx-libs.spec: Make %{_libdir}/nx{,/X11} owned by libNX_X11 bin:package 2015-01-28 22:54:40 +0100 Mike Gabriel (752dac2b5) * CODE-REDUCTION_PRESERVE-NEEDED: keep cross.def and cross.rules 2015-01-28 22:52:34 +0100 Mike Gabriel (f99299998) * debian/control: fix several packaging issues since the re-packaging started 2015-01-28 22:52:01 +0100 Mike Gabriel (1d7eb36d3) * Add Description: and Author: fields to various patch headers. 2015-01-28 22:32:09 +0100 Mike Gabriel (89b285f2a) * nx-libs.spec: Non-packaged files detected: nxagent.xpm, /usr/share/nx/rgb in bin:package nxagent 2015-01-28 22:31:16 +0100 Mike Gabriel (06212f51f) * latest tarball size: 41MiB 2015-01-28 22:24:24 +0100 Mike Gabriel (ce1078e87) * Makefile.nx-libs: Don't allow symlinks to point into buildroot. 2015-01-28 22:21:22 +0100 Mike Gabriel (279b74158) * Add 991_fix-hr-typos.full+lite.patch and 991_fix-hr-typos.full.patch. Fix several typos in upstream code detected by lintian. 2015-01-28 22:08:16 +0100 Mike Gabriel (3de46599f) * debian/libnx-xinerama1.dirs: no non-multi-arch dir in multi-arch packages 2015-01-28 21:56:13 +0100 Mike Gabriel (2a548a079) * Provide CDBS-generated debian/copyright.in file. 2015-01-28 21:52:17 +0100 Mike Gabriel (79c0bac99) * enable official changelog 2015-01-28 21:50:33 +0100 Mike Gabriel (94d5bb3c1) * debian/control: dummy packages don't have the substvar 2015-01-28 21:47:56 +0100 Mike Gabriel (e2cc535c7) * nx-libs.spec: NX libs are installed in %{_libdir} 2015-01-28 21:43:27 +0100 Mike Gabriel (1d39845b3) * Add debian/*.symbols files for shared nx-X11 libraries. 2015-01-28 21:42:15 +0100 Mike Gabriel (dd79903cd) * nx-libs.spec: fix permission setting on outdated path 2015-01-28 21:31:37 +0100 Mike Gabriel (801dc1fe8) * fix typos in CODE-REDUCTION scripts 2015-01-28 21:28:04 +0100 Mike Gabriel (912d62ba5) * Install upstream ChangeLogs into bin:packages. 2015-01-28 21:26:40 +0100 Mike Gabriel (f72fb34eb) * silence lintian warning about licence file being a symlink 2015-01-28 20:42:34 +0100 Mike Gabriel (72ecc24e6) * CODE-REDUCTION_PRESERVE-SYMLINKED: fix Mesa builds on 32bit intel arch 2015-01-28 20:41:56 +0100 Mike Gabriel (1b458e32e) * CODE-REDUCTION_CLEANUP-UNUSED: remove DPS include files, remove XTrap shared lib 2015-01-28 19:51:32 +0100 Mike Gabriel (62d4f6a06) * CODE-REDUCTION_CLEANUP-BACKUPFILES: fine-tune dropped file 2015-01-28 19:49:11 +0100 Mike Gabriel (4fae286b8) * CODE-REDUCTION_CLEANUP-UNUSED: remove faulty path 2015-01-28 19:39:16 +0100 Mike Gabriel (8b05e1918) * Update .spec file to meet changes in tarball size reduction and restructuring. 2015-01-28 18:21:44 +0100 Mike Gabriel (3c7c3b7f4) * Support hardened builds for nxagent and libNX_*.so files. 2015-01-28 18:21:17 +0100 Mike Gabriel (f0f1df262) * more code reduction and adaptation of patch 600_....patch 2015-01-28 15:11:12 +0100 Mike Gabriel (350fb90d6) * remove more unused code from nx-X11/lib/ 2015-01-28 15:04:50 +0100 Mike Gabriel (151bca3a1) * Update 600_nx-X11+nxcompext+nxcompshad_unique-libnames.full.patch. Don't patch files that get removed during code reduction. 2015-01-28 14:58:17 +0100 Mike Gabriel (2a4015865) * Support hardened builds for nxcomp* libraries. 2015-01-28 14:57:42 +0100 Mike Gabriel (8b432c7a5) * debian/changelog: whitespace fix 2015-01-28 15:10:54 +0100 Mike Gabriel (f18608de2) * rebase with unify 2015-01-28 12:58:30 +0100 Mike Gabriel (5565184a6) * Unify source tree reduction (debian/rules vs. roll-tarball.sh) via file/folder lists in text files named debian/CODE-REDUCTION_*. 2015-01-28 11:44:04 +0100 Mike Gabriel (22f0208cb) * re-arrange changelog, work-in missing entries for previous commits 2015-01-28 11:31:41 +0100 Mike Gabriel (100276175) * debian/roll-tarball.sh: Install etc/ files into etc/ subfolder (rgb, nxagent.keyboard, x2goagent.keyboard). 2015-01-28 11:34:05 +0100 Mike Gabriel (a7a4246f4) * debian/rules: Correctly link config files (etc/rgb, etc/nxagent.keyboard, etc/x2goagent.keyboard) before dh_auto_build. 2015-01-28 11:25:02 +0100 Mike Gabriel (0956f0c7d) * Provide support for separate .keyboard files for nxagent/x2goagent. 2015-01-28 11:24:34 +0100 Mike Gabriel (04307b247) * Allow sysadmins to manipulate nxagent's / x2goagent's rgb file by placing it into /etc/nxagent or /etc/x2go. 2015-01-28 11:29:52 +0100 Mike Gabriel (78c016e77) * Extend 999_nxagent_unbrand-nxagent-brand-x2goagent.full.patch. Allow separate .keyboard files for x2goagent and nxagent. 2015-01-28 11:28:38 +0100 Mike Gabriel (fc2dcc9c3) * Extend 999_nxagent_unbrand-nxagent-brand-x2goagent.full.patch. Let rgb file shipped with x2goagent supersede rgb file shipped with nxagent. FIXME: a better approach would be to decide at runtime if to use /etc/x2go/rgb or /etc/nxagent/rgb. 2015-01-28 11:21:02 +0100 Mike Gabriel (bb70adf75) * Modify 101_nxagent_set-rgb-path.full.patch. Allow configurable rgb files. 2015-01-28 11:13:45 +0100 Mike Gabriel (7357f8c0e) * Base Debian packaging 100% on Makefile install. 2015-01-27 13:56:36 +0100 Mike Gabriel (b3d32ec56) * Fully rework the way nx-libs gets packaged for Debian/Ubuntu. 2015-01-22 15:50:30 +0100 Mike Gabriel (a3087eec9) * fix for last commit 2015-01-22 15:43:36 +0100 Mike Gabriel (caa9e8c9a) * Header files need not be removed anymore. They don't get installed via Makefile.nx-libs anymore. 2015-01-22 15:17:47 +0100 Mike Gabriel (c5ceb16a5) * Makefile.nx-libs: Don't install Mesa header files into DESTDIR anymore. 2015-01-22 13:48:18 +0100 Mike Gabriel (30ade9cb7) * More source tree size reduction by analyzing what exactly of the Mesa source code in nx-X11/extras/ is used and what not. 2015-01-22 11:47:31 +0100 Mike Gabriel (4c73b97cf) * debian/control: Turn libnx-*-dev packages into dummy packages. Shipping development files for nx-X11 makes no sense. No other programme build against nx-X11's header files except nxagent itself. 2015-01-22 11:00:15 +0100 Mike Gabriel (8de5a897a) * Drop more unused folders from tarball release / before .deb package build. 2015-01-22 10:16:50 +0100 Mike Gabriel (3cfe4bfa3) * Drop nx-X11/programs/Xserver/hw/xfree86 except of four files symlinked to other locations in the source tree at build time. 2015-01-22 06:19:42 +0100 Mike Gabriel (b590ce38c) * Stop shipping unused / very old xterm code. 2015-01-22 06:12:10 +0100 Mike Gabriel (be832e8e1) * Drop more unused code in nx-X11/programs/Xserver/hw/. Do this in roll-tarball.sh and in debian/rules alike. 2015-01-22 06:10:11 +0100 Mike Gabriel (040962da7) * Fix removal of unused code (that part of the code that we know of so far). (The debian/rules file is a Makefile and Makefiles don't understand shell globbing with curly braces). 2015-01-22 06:06:37 +0100 Mike Gabriel (694523eee) * debian/rules: Backup nxcomp/VERSION file from NoMachine before replacing it with a symlink to debian/VERSION. Recreate the original file when cleaning up. 2015-01-19 10:32:03 +0100 Mike Gabriel (24986dd2e) * Update 320_nxagent_configurable-keystrokes.full.patch. Fix patch header referring to keystrokes.cfg (plural), not keystroke.cfg. 2015-01-19 10:28:59 +0100 Horst Schirmeier (4e5a11596) * Add 321_nxagent_x2go-specific-keystroke-config.full.patch. If nxagent is launched as x2goagent, use X2Go-specific paths for the keystrokes.cfg file. (Fixes: #744). 2015-01-13 12:17:58 +0100 Mike Gabriel (6ca1073ea) * give credits to Horst Schirmeier for solving #741 2015-01-13 06:05:32 +0100 Mike Gabriel (0648d56a9) * grammar fix in changelog 2015-01-13 05:36:24 +0100 Mike Gabriel (c09580a52) * Update 320_nxagent_configurable-keystrokes.full.patch. Fix a typo that prevented the /etc/nxagent/keystrokes.cfg file to be parsed. (Fixes: #741). 2015-01-09 04:51:03 +0100 Mihai Moldovan (3fb038d6c) * debian/changelog: add entry for last change. 2015-01-09 03:46:38 +0100 Mihai Moldovan (7750a7eaf) * common: change X2go -> X2Go. 2014-12-03 15:28:59 +0100 Mike Gabriel (3fa67b673) * fix for last commit(2) 2014-12-03 15:23:14 +0100 Mike Gabriel (8b36b798e) * fix for last commit 2014-12-03 15:19:03 +0100 Mike Gabriel (992ec61a1) * nx-libs.spec: The gpg-offline bin:package is not available in our SLE repo. We can do without. 2014-12-03 15:09:54 +0100 Mike Gabriel (e44f1aec8) * DISABLED:401_nxcomp_bigrequests-and-genericevent-extensions.full+lite.patch. 2014-11-13 23:29:07 +0100 Paul Szabo (b2ac5aaf1) * Add 401_nxcomp_bigrequests-and-genericevent-extensions.full+lite.patch. Enable support for the X11 big requests extension and the generic events extension. 2014-11-13 21:59:11 +0100 Mike Gabriel (ec61d2e72) * Continue development... 2014-11-13 21:39:59 +0100 Mike Gabriel (c69789464) * release 3.5.0.28 (tag: redist-server/3.5.0.28, tag: redist-client/3.5.0.28) 2014-11-13 21:38:32 +0100 Mike Gabriel (0f5dbb95c) * Revert "Add 401_nxcomp_big-requests.full+lite.patch. Support usage of the BIG-REQUESTS X11 extension on the server-side. (See Debian bug #766299)." 2014-11-13 21:38:24 +0100 Mike Gabriel (6f59493da) * Revert "401_nxcomp_bigrequests.full+lite.patch: PATCH DISABLED FOR NOW, IT CAUSES NXPROXY CRASHES EVERY 1-2 minutes." 2014-11-05 10:07:39 +0100 Ulrich Sibiller (d1f040121) * Add 207_nxagent_fix-xfixes-selection.full.patch. Fix selection handling when XFIXES is enabled. (Fixes: #585) 2014-10-25 23:02:16 +0200 Mike Gabriel (d505944e0) * 401_nxcomp_bigrequests.full+lite.patch: PATCH DISABLED FOR NOW, IT CAUSES NXPROXY CRASHES EVERY 1-2 minutes. 2014-10-25 22:11:45 +0200 Mike Gabriel (c69c2e2ea) * Add 401_nxcomp_big-requests.full+lite.patch. Support usage of the BIG-REQUESTS X11 extension on the server-side. (See Debian bug #766299). 2014-10-19 00:19:38 +0200 Mike Gabriel (429dbe708) * Rename 605_nxcomp_Types.h-dont-use-STL-internals-on-libc++.full.patch to 605_nxcomp_Types.h-dont-use-STL-internals-on-libc++.full+lite.patch. It is an nxcomp patch that needs to be applied in the nx-libs-lite _and_ the nx-libs-full tarball release. 2014-10-18 23:04:25 +0200 Mike Gabriel (b0727a02f) * Add 607_nxcomp_macosx-X11-launcher-in-private-tmp.full+lite.patch. Fix check for launchd socket path in $DISPLAY on recent Mac OS X systems. 2014-10-14 19:17:11 +0200 Mike Gabriel (efe4d1f73) * nx-libs.spec: Fix more rpmlint warnings. 2014-10-13 15:47:05 +0200 Mike Gabriel (aa7a0c834) * nx-libs.spec: Fix SUSE-specific R for libXext(6). 2014-10-13 14:54:11 +0200 Mike Gabriel (33f69da55) * nx-libs.spec: typo fix 2014-10-13 14:28:04 +0200 Mike Gabriel (370e56ec4) * nx-libs.spec: minor dep fix 2014-10-13 14:26:57 +0200 Mike Gabriel (44b7138b3) * nx-libs.spec: Fix Xinerama deps for SUSE builds. 2014-10-13 13:49:42 +0200 Mike Gabriel (ef4a6c845) * nx-libs.spec: Do not conflict with nx... This will break our own neck. 2014-10-13 13:29:18 +0200 Mike Gabriel (aeb9b430c) * nx-libs.spec: fix nx-libs builds in mock 2014-10-13 11:48:15 +0200 Mike Gabriel (61c21fce0) * nx-libs.spec: fix for last commit 2014-10-13 11:42:00 +0200 Mike Gabriel (d86c1be2c) * Fix Xinerama symlink installation into RPM bin:package libNX_Xinerama. (Fixes: #269). 2014-10-13 11:27:50 +0200 Mike Gabriel (827cbcc04) * Make sure all package directories are owned by one of the built bin:packages. 2014-10-13 11:27:23 +0200 Mike Gabriel (26e55cf81) * fix last changelog entry 2014-10-13 11:19:14 +0200 Mike Gabriel (52ac26bec) * nx-libs.spec: Fix for last commit. 2014-10-13 11:01:57 +0200 Mike Gabriel (0387e383d) * nx-libs.spec: SUSE hack for linking to files in libX11-6 and libXext6. 2014-10-13 10:36:53 +0200 Mike Gabriel (1bc6c85e5) * nx-libs.spec: follow up for last commits 2014-10-13 10:33:12 +0200 Mike Gabriel (894199e60) * nx-libs.spec: follow up for last commits 2014-10-13 10:29:51 +0200 Mike Gabriel (b96e120f1) * nx-libs.spec: follow-up commit for last commit 2014-10-13 10:20:34 +0200 Mike Gabriel (5e4ae04ef) * Additionally adapt to building on openSUSE/SLES. 2014-10-11 10:13:33 +0200 Mike Gabriel (45c592cf4) * Update 027_nxcomp_abstract-X11-socket.full+lite: Add patch header (Description: and Author: field). 2014-10-02 13:52:00 +0200 Mike Gabriel (bddc7e0ba) * debian/rules: fix nxcomp/VERSION symlink creation at build-time 2014-10-02 13:32:13 +0200 Mike Gabriel (0cac9efd4) * debian/rules: No such option for dh_auto_build: --with quilt." 2014-10-02 12:34:22 +0200 Mike Gabriel (0277e0857) * nx-libs.spec: Adapt installation of debian/VERSION as VERSION.x2goagent and nxcomp/VERSION to latest changes introduced by 400_nxcomp-version.full+lite.patch. 2014-10-02 12:30:20 +0200 Mike Gabriel (8d0798ec7) * fix symlink creation 2014-10-02 11:53:47 +0200 Mike Gabriel (5a82f5994) * debian/libnx-x11.postinst: Don't use dpkg-architecture (bin:package dpkg-dev) in postinst script. Instead prep a libnx-x11.postinst script at build time. (Fixes: #621). 2014-10-02 10:40:55 +0200 Nito Martinez (61d047d63) * Add 400_nxcomp-version.full+lite.patch. Allow 4-digit version comparison during NX session handshake. (Fixes: #610). 2014-08-20 13:02:53 +0200 Mike Gabriel (c9bc8accc) * Add 025_nxcomp-fix-ftbfs-against-jpeg9a.full+lite.patch. Fix FTBFS when built against libjpeg9a. Thanks to Gabriel Marcano for sending this in. 2014-07-09 19:04:25 +0200 Mike Gabriel (0e3b414ea) * Provide COPYING file in tarball. Update debian/copyright. 2014-06-30 15:06:06 +0200 Mike Gabriel (340ec14a4) * Continue development... 2014-06-30 14:53:48 +0200 Mike Gabriel (aeb5e8ad5) * release 3.5.0.27 (tag: redist-server/3.5.0.27, tag: redist-client/3.5.0.27) 2014-06-30 14:53:09 +0200 Mike Gabriel (77c3e1550) * Split up patch 210 (for correct creation nx-libs, nx-libs-lite tarballs): 2014-06-30 14:43:02 +0200 Mike Gabriel (035de8281) * release 3.5.0.26 (tag: redist-server/3.5.0.26, tag: redist-client/3.5.0.26) 2014-06-30 14:42:40 +0200 Mike Gabriel (9c7bf9da2) * Fix patch names... 2014-06-30 14:25:25 +0200 Mike Gabriel (c92704558) * Continue development... 2014-06-30 14:14:35 +0200 Mike Gabriel (752a80cee) * release 3.5.0.25 (tag: redist-server/3.5.0.25, tag: redist-client/3.5.0.25) 2014-06-29 15:34:25 +0200 Mike Gabriel (2a31f67c7) * changelog fix 2014-06-29 15:11:31 +0200 Mike Gabriel (cf029b619) * Add 212_nxcomp_build-on-Android.patch. Fix FTBFS of nxproxy/nxcomp when build against the Android system. (Fixes: #339). 2014-06-27 17:40:00 +0200 Mike Gabriel (fa886dff8) * update patch name in changelog 2014-06-27 17:39:00 +0200 Mike Gabriel (e474a3f35) * update changelog, update patches 2014-06-27 10:52:52 +0200 Oleksandr Shneyder (92a0f58e8) * Rename Patches 210 and 211. Update series file. 2014-06-27 02:01:15 +0200 Mike Gabriel (0cf283dca) * Add 206_nxagent_clipboard-as-nxoption.full.patch. Make the clipboard option configurable in nxagent via NX options as addition to the command line parameter -clipboard. Note that the command line parameter overrides the clipboard NX option. Possible values are both or 1, client, server, none or 0. 2014-06-25 11:43:44 +0200 Oleksandr Shneyder (c62b81304) * Add 211_nxcomp_set_default_options.patch. Set default arguments for options 'link' and 'pack' to avoid session damage by resuming with incorrect options file. 2014-06-25 10:02:02 +0200 Oleksandr Shneyder (9f6eb6f79) * Add 210_nxagent_nxcomp_save_session_state.patch. Save session state in path specified by "state" option in agent options file. If option is omitted, session state will not be saved. Session states are: STARTING, RUNNING, SUSPENDING, SUSPENDED, RESUMING, TERMINATING, TERMINATED. 2014-06-25 09:59:35 +0200 Oleksandr Shneyder (480a05519) * Revert "Add 210_nxagent_nxcomp_save_session_state.patch. Save session state in path specified by "state" option in agent options file. If option is omitted, session state will not be saved. Session states are: STARTING, RUNNING, SUSPENDING, SUSPENDED, RESUMING, TERMINATING, TERMINATED." 2014-06-25 09:57:42 +0200 Oleksandr Shneyder (fcd9b71bc) * Add 210_nxagent_nxcomp_save_session_state.patch. Save session state in path specified by "state" option in agent options file. If option is omitted, session state will not be saved. Session states are: STARTING, RUNNING, SUSPENDING, SUSPENDED, RESUMING, TERMINATING, TERMINATED. 2014-06-22 09:16:45 +0200 Mike Gabriel (7154096b7) * fix changelog entry for patch 057 2014-06-22 09:16:02 +0200 Mike Gabriel (c00d26974) * fix Description: in patch 057 2014-06-22 09:14:35 +0200 Mike Gabriel (ead0f653f) * Rename patches to match our naming scheme: 2014-06-22 09:07:56 +0200 Mike Gabriel (53a0a47b8) * renmae patch 057 2014-06-21 23:40:09 +0200 Mike Gabriel (d8c9f89b1) * update description for patch 057_nx-X11-bigendian-ppc64-no-session-window.full.patch as proposed by the patch author 2014-06-21 23:20:33 +0200 Mike Gabriel (eca0ee98c) * Update patches, to make them apply cleanly after above changes: 2014-06-21 23:17:41 +0200 Mike Gabriel (8be0a0472) * fix 057, rebase 2014-06-21 23:04:16 +0200 Mihai Moldovan (abbe7e840) * Add 990_fix-DEBUG-and-TEST-builds.full.patch. Fix debug builds (e.g. when globally setting -DDEBUG and -DTEST at build time). 2014-06-21 22:39:10 +0200 Mihai Moldovan (3446d14ea) * Improve 028_nx-X11_abstract-kernel-sockets.full.patch. Make it more Big Endian robust by assigning correct types for socklen_t objects. 2014-06-21 22:35:47 +0200 Mihai Moldovan (afcc7a93d) * Improve 105_nxagent_export-remote-keyboard-config.full.patch. Don't print out nonsensical information, if there really was no error when creating the keyboard file or the other way around. Also add the reason when failing to create the keyboard file. Only print an error message if SessionPath *really* is not defined. 2014-06-21 22:29:44 +0200 Mihai Moldovan (cfb1990d4) * Add 057_nx-X11-bigendian-ppc64-no-session-window.patch. Fix failures in session windows coming up on Big Endian systems like PPC64. (Fixes: #516). 2014-06-15 01:03:15 +0200 Mike Gabriel (359c458f1) * update last committed patch, fix EOL style 2014-06-15 00:49:26 +0200 Mike Gabriel (ecd6d4e85) * giving credits to Mihai for digging out patch 029_nxcomp_ppc64.full+lite.patch 2014-06-15 00:33:28 +0200 Mike Gabriel (36f4e34b2) * Add 029_nxcomp_ppc64.full+lite.patch. Fix sockaddr handling on Big Endian systems (like PPC64). (Fixes: #515). 2014-06-13 01:55:49 +0200 Mike Gabriel (75987a76f) * Add 302_nx-X11_xkbbasedir-detection.patch. For detecting XkbBaseDir test for xkb/rules/base instead of testing for deprecated file xkb/keymap.dir. (Fixes: #40). 2014-06-11 16:37:37 +0200 Mike Gabriel (e30d46d85) * Make 016_nx-X11_install-location.debian.patch cleanly apply again. 2014-06-11 16:35:13 +0200 Mike Gabriel (656f29cc6) * Add 028_nx-X11_abstract-kernel-sockets.full.patch. Provide abstract local socket support for Linux based systems. This patch pulls in abstract socket relevant code from xtrans 1.2.7. 2014-06-11 14:48:08 +0200 Mike Gabriel (9268d270e) * Wrap too-long-line in changelog. 2014-06-11 12:25:52 +0200 Mike Gabriel (065dcc903) * fix patch name 2014-06-11 10:43:14 +0200 Mike Gabriel (5a07d00e0) * Make 220_nxproxy-bind-loopback-only.full+lite.patch cleanly apply after having added 027_nxcomp_abstract-X11-socket.patch. 2014-06-11 10:42:04 +0200 Mike Gabriel (57fb5bb57) * Add 027_nxcomp_abstract-X11-socket.patch. In proxy mode server let NX proxy attempt connecting to the abstract X11 socket first, and only fallback to the file system socket, if the abstract socket is not available. (Fixes: #505). 2014-05-09 12:57:23 +0200 Mike Gabriel (eb3642101) * Add 606_nx-X11_build-on-aarch64.full.patch. Build on aarch64 architectures. (Fixes: #490). 2014-05-07 09:59:08 +0200 Mike Gabriel (21ba6e22c) * Continue development... 2014-05-07 09:56:12 +0200 Mike Gabriel (460a3cb39) * release 3.5.0.24 (tag: redist-server/3.5.0.24, tag: redist-client/3.5.0.24) 2014-05-07 09:55:40 +0200 Mike Gabriel (c6f84a448) * Configurable keystrokes: Don't ignore first XML element in keystrokes.cfg anymore. (Fixes: #488). 2014-05-07 09:38:04 +0200 Mike Gabriel (7e55c36f4) * Update 320_nxagent_configurable-keystrokes.full.patch: The keystrokes config file's default name now is keystrokes.cfg (plural). 2014-05-07 09:24:45 +0200 Mike Gabriel (a481c137a) * Debian lintian: Fix: nx-libs source: not-binnmuable-all-depends-any x2goagent -> nxagent. 2014-05-07 09:08:13 +0200 Mike Gabriel (440fd40c5) * Make sure, patch 056_nx-X11-Werror-format-security.full.patch gets included into rolled tarball (by renaming *.patch to *.full.patch). 2014-05-07 09:04:55 +0200 Mike Gabriel (a8be15e1d) * Clean debian/patches/series: Remove commented out patches. 2014-05-06 18:34:53 +0200 Mike Gabriel (43ee5101c) * Continue development... 2014-05-06 18:06:05 +0200 Mike Gabriel (085bfbd25) * release 3.5.0.23 (tag: redist-server/3.5.0.23, tag: redist-client/3.5.0.23) 2014-05-06 17:59:42 +0200 Mike Gabriel (f0aa66536) * fix changelog 2014-05-06 13:27:49 +0200 Oleksandr Shneyder (a544b9d4c) * nxagent: add patch to fix refresh error on RDP connections to Windows 2012 if speed=ADSL. 2014-03-29 21:22:59 +0100 Mike Gabriel (4bbcbe505) * Add patch: 056_nx-X11-Werror-format-security.patch. Fix more -Werror=format-security errors that only show up on ARM builds. (Fixes: #423). 2014-01-28 23:47:15 +0100 Mike Gabriel (d999822bf) * nx-libs.spec: Build our imake against xorg-x11-proto-devel. 2014-01-28 23:45:10 +0100 Mike Gabriel (d95e47f3b) * debian/control: Build our imake against x11proto-core-dev headers. 2014-01-28 19:48:21 +0100 Mike Gabriel (faa289a82) * nx-libs.spec: Sync nx-libs.spec in Fedora with upstream's nx-libs.spec file. (Fixes: #393). 2014-01-28 19:41:15 +0100 Mike Gabriel (fc91d4d04) * Add patch: 055_nx-X11_imake-Werror-format-security.full.patch. Fix FTBFS of imake on current Fedora rawhide (21) which uses the compiler option -Werror=format-security for all builds. (Fixes: #412). 2014-01-28 19:40:45 +0100 Mike Gabriel (d5f2bbb3d) * fix patch 054_nx-X11_ppc64-ftbfs.full.patch 2014-01-28 19:32:53 +0100 Mike Gabriel (54f39758c) * Add patch: 054_nx-X11_ppc64-ftbfs.full.patch. Fix FTBFS on ppc64 architecture. (Fixes: #411). 2014-01-04 22:03:44 +0100 Mike Gabriel (e8a69d261) * Continue development... 2014-01-04 22:02:09 +0100 Mike Gabriel (80d10df87) * release hotfix build 2014-01-04 22:01:16 +0100 Mike Gabriel (0d07f3e8b) * Update version in VERSION.x2goagent. 2014-01-04 21:39:35 +0100 Mike Gabriel (626b5dbae) * release 3.5.0.22 (tag: redist-server/3.5.0.22, tag: redist-client/3.5.0.22) 2013-12-17 21:03:26 +0100 Mike Gabriel (1d074b1ae) * nx-libs.spec: fix symlink creation for Xinerama (missing subfolder) 2013-12-17 17:16:47 +0100 Mike Gabriel (edbd95b90) * attempt to correct symlink creation for Xinerama support 2013-12-17 12:32:34 +0100 Mike Gabriel (36cdfdcb5) * Make sure all nx-libs components depend on the very same version. 2013-12-17 12:09:54 +0100 Mike Gabriel (a96a43f14) * Enable Xinerama support for RPM packages. (Fixes: #370). 2013-12-17 11:50:25 +0100 Mike Gabriel (ded201707) * Drop symlinking libNX_xrandr for setting a custom LD_LIBRARY_PATH. Not in use anymore and not recommended at all to have that. 2013-12-08 12:05:46 +0100 Mike Gabriel (a6ab07de8) * Clear (Fedora package) changelog. 2013-12-13 18:48:59 +0100 Mike Gabriel (501112b2a) * nx-libs.spec: x2goagent does not depend on x2goserver (rather vice versa) 2013-12-13 18:24:09 +0100 Mike Gabriel (3fbb9ca30) * nx-libs.spec: fix spellings in package descriptions 2013-12-08 01:19:44 +0100 Mike Gabriel (19033a157) * make sure our RPM package version is lower than a package version from EPEL 2013-12-08 00:27:53 +0100 Mike Gabriel (ce11917ad) * typo fix 2013-12-08 00:07:14 +0100 Mike Gabriel (703a67ac7) * compensate missing %buildroot macro in EPEL5 2013-12-07 23:04:18 +0100 Mike Gabriel (51afd69b2) * The RPM macro for the linker flags does not exist on EPEL. Thus, hardcode __global_ldflags macro for EPEL builds. 2013-12-07 22:11:17 +0100 Mike Gabriel (1ac043b94) * debian/rules: Remove bundled libraries from source tree before building the package. 2013-12-06 15:42:26 +0100 Mike Gabriel (1061630f1) * adapt spec file to last commit 2013-12-06 15:39:59 +0100 Mike Gabriel (523d50529) * Improve patch: 601_nx-X11_build-option-changes-to-not-use-bundled-libraries.full.patch. Improvements taken from the current Fedora package. Thanks to Orion Paplowski!!! Also adapt roll-tarball.sh do dropping more bundled libraries. 2013-12-06 15:20:15 +0100 Mike Gabriel (40aa275cd) * Add patch: 302_nx-X11_do-not-build-bundled-libs.full.patch. Rename patch: 302_nxagent_configurable-keystrokes.full.patch. 2013-12-06 15:06:42 +0100 Mike Gabriel (e3da34510) * prep source tree after unpacking tarball, bring files from debian/ folder in place before building the RPM package 2013-12-06 14:54:38 +0100 Mike Gabriel (21cde6e42) * nx-libs.spec: Use local tarball, don't expect ,,-full'' in tarball name. 2013-12-06 14:50:59 +0100 Mike Gabriel (2fceb10d2) * nx-libs.specs: remove duplication of file contents 2013-12-06 13:55:53 +0100 Mike Gabriel (8c78f3204) * Ship nx-libs.spec (RPM package definitions) in upstream project. (Thanks to the Fedora package maintainers). File differs from the Fedora file already. 2013-12-06 13:54:42 +0100 Mike Gabriel (b413799fb) * Refresh patch: 600_nx-X11+nxcompext+nxcompshad_unique-libnames.full.patch. 2013-12-03 21:33:08 +0100 Mike Gabriel (08312e2e1) * Add patch 605_nxcomp_Types.h-dont-use-STL-internals-on-libc++.full.patch. Fix FTBFS of nx-libs-lite on Mac OS X Mavericks. (Fixes: #337). 2013-12-03 15:08:30 +0100 Mike Gabriel (2382d8835) * Add patch 604_nx-X11_recent-freetype-API.full.patch. Fix FTBFS against recent (>= 2.5.0) libfreetype6 API. 2013-11-30 21:55:36 +0100 Mike Gabriel (8cd7d82d7) * debian/control: Add libfreetype6-dev to Build-Depends: field. 2013-11-29 12:37:48 +0100 Mike Gabriel (c50b2a90e) * change versioning scheme 2013-11-27 14:54:44 +0100 Mike Gabriel (ca414e175) * debian/source/format: Switch to format 1.0. 2013-09-30 21:00:41 +0200 Mike Gabriel (2ef4ab414) * Add patch: 603_nx-X11_compilation_warnings.full.patch. Fix 3 evident bugs: one implicit function declaration issue and two array index out of bounds issues. (Fixes: #314). 2013-08-30 16:20:29 +0200 Mike Gabriel (b29654d54) * Continue development... 2013-08-30 16:18:40 +0200 Mike Gabriel (b2a3143f8) * release 3.5.0.21 (tag: redist-server/3.5.0.21, tag: redist-client/3.5.0.21) 2013-08-29 22:58:19 +0200 Mike Gabriel (13f2b57d4) * Fix keystrokes.cfg, use Ctrl+Alt+ instead of just Ctrl+. (Adds to fixing #223). 2013-08-29 22:24:26 +0200 Mike Gabriel (0946b4375) * Add patch: 602_nx-X11_initgroups.full.patch. Fix calling setuid and setgid without setgroups or initgroups. There is a high probability this means it didn't relinquish all groups, and this would be a potential security issue to be fixed. Seek POS36-C on the web for details about the problem. (Fixes: #293). 2013-08-29 20:48:09 +0200 Mike Gabriel (e46b43443) * fix underscore in name of patch 601_... 2013-07-19 19:27:09 +0200 Mike Gabriel (2a41a2ca5) * /debian/nx-libs-dev.install: Remove unrelated files from -dev package. 2013-07-19 19:26:37 +0200 Mike Gabriel (19ef7a2ca) * /debian/control: Add B-Ds: libfontconfig1-dev, libfontenc-dev. 2013-07-19 19:25:05 +0200 Orion Poplawski (9113131a7) * Change build options so that bundled libraries are not used anymore at build time. Remove bundled libraries from rolled tarballs, as well. (Fixes: #116, #238). 2013-05-29 19:02:02 +0200 Mike Gabriel (d90c457c4) * Use a keystrokes.cfg that reflects the normally hard-coded defaults of a vanilla nxagent. (Fixes: #223). 2013-05-11 20:40:57 +0200 Mike Gabriel (ead1e823a) * * Tarball roller script: + Only install keystrokes.cfg when in full mode. + Only install nxproxy wrapper when in lite mode. 2013-05-08 14:21:49 +0200 Mike Gabriel (4c462f28d) * addition to last commit 2013-05-07 20:20:43 +0200 Mike Gabriel (dafbbf21a) * For vanilla nxagent move keystrokes.cfg from /etc/nx to /etc/nxagent. 2013-05-07 20:03:27 +0200 Mike Gabriel (995b70cdc) * /debian/rules: clean etc/keystrokes.cfg symlink 2013-05-07 20:00:51 +0200 Mike Gabriel (ee35c3ff9) * fix broker symlink 2013-05-06 23:09:35 +0200 Mike Gabriel (e0fb697e9) * Set NXAGENT_KEYSTROKEFILE to /etc/x2go/keystrokes.cfg for wrapper x2goagent. 2013-05-06 22:44:32 +0200 Mike Gabriel (fc118b4bb) * add forgotten file: debian/keystrokes.cfg 2013-05-06 22:38:51 +0200 Mike Gabriel (d8a55d2c6) * Provide a default keystrokes.cfg in /etc/nx (for nxagent) and /etc/x2go (for x2goagent). (Fixes: #199). 2013-03-28 21:09:09 +0100 Mike Gabriel (dc5faf7af) * increment version in VERSION.x2goagent 2013-03-28 21:07:59 +0100 Mike Gabriel (121f7ca9d) * Continue development... 2013-03-28 20:43:53 +0100 Mike Gabriel (225445db3) * release 3.5.0.20 (tag: redist-server/3.5.0.20, tag: redist-client/3.5.0.20) 2013-03-28 20:43:14 +0100 Mike Gabriel (ef0c6b4b8) * add bug closure for #156 2013-03-28 15:27:57 +0100 Mike Gabriel (bd2eb481a) * Fix faulty symlink path. Make sure that x2goagent symlink does not point to absolute path somewhere within the build environment. 2013-03-28 09:12:07 +0100 Mike Gabriel (5ff8e62d1) * Continue development... 2013-03-28 08:59:14 +0100 Mike Gabriel (436d06739) * release 3.5.0.19 (tag: redist-server/3.5.0.19, tag: redist-client/3.5.0.19) 2013-03-28 08:58:35 +0100 Mike Gabriel (db7feaf98) * Revert "release 3.5.0.19" 2013-03-28 08:55:23 +0100 Mike Gabriel (e77bf36d9) * release 3.5.0.19 2013-03-28 08:55:00 +0100 Mike Gabriel (d16188f08) * fix my mail address in changelog 2013-03-28 08:43:52 +0100 Mike Gabriel (478015eb1) * increment version in VERSION.x2goagent 2013-03-28 08:42:56 +0100 Mike Gabriel (a40d4b7b1) * Fix FTBFS for .deb packages after including fix for #145. 2013-03-23 00:43:17 +0100 Mike Gabriel (1af59b317) * Add Jan's reasoning for using string_rep() instead of bash based string substitutions as comment to /debian/Makefile.replaces.sh. 2013-03-22 23:40:44 +0100 Mike Gabriel (1b4092e0f) * release 3.5.0.18 (tag: redist-server/3.5.0.18, tag: redist-client/3.5.0.18) 2013-03-22 23:35:40 +0100 Mike Gabriel (f81df1a69) * Main Makefile: Use absolute symlink when linking from $(X2GOLIBDIR) into $(NXLIBDIR) (i.e. linking x2goagent -> nxagent). (Fixes: #143). 2013-03-22 22:33:40 +0100 Mike Gabriel (8f151d797) * Work-in patch from Jan Engehardt for working around different improper bash implementations of string-in-string replacing. (Fixes: #145). 2013-02-12 08:32:30 +0100 Orion Poplawski (258902bec) * Avoid building of libxcomp1 (which actually is identical to libxcomp3, just with a wrong name). (Fixes: #104). 2013-02-12 08:13:37 +0100 Orion Poplawski (d439556ff) * Fix wrong symlink direction of libNX_* files. (Fixes: #107). 2013-01-21 10:35:47 +0100 Mike Gabriel (cf521a4b6) * increment VERSION.x2goagent 2013-01-08 00:39:32 +0100 Mike Gabriel (c8a5fddf1) * replaces Closes: by Fixes: statements in changelog 2013-01-07 10:45:58 +0100 Mike Gabriel (b121300fd) * Remove duplicate install of nxproxy from main Makefile. Spotted by Jan Engelhard. 2013-01-04 13:27:41 +0100 Mike Gabriel (39e84229d) * Continue development... 2013-01-04 13:24:18 +0100 Mike Gabriel (69c809af9) * release 3.5.0.17 (tag: redist-server/3.5.0.17, tag: redist-client/3.5.0.17) 2013-01-03 08:03:46 +0100 Mike Gabriel (1d7669458) * let nx-x11-dbg depend on libnx-x11 and nxagent 2013-01-03 08:02:57 +0100 Mike Gabriel (abc2ce3f8) * fix multiple binaries-have-file-conflicts lintian issue 2013-01-02 17:41:04 +0100 Mike Gabriel (17371711f) * add misc:Depends to nx-x11-dbg 2013-01-02 17:40:49 +0100 Mike Gabriel (62f66b02a) * fix multiple binaries-have-file-conflicts lintian issue 2013-01-02 15:55:33 +0100 Mike Gabriel (bfe6f4349) * Continue Reinhard's work on top-level install/uninstall. Esp. integrate debian/post-nx-build.sh into main Makefile. Make value of CONFIGURE variable traversable through the Makefile tree. 2013-01-02 14:58:22 +0100 Mike Gabriel (36a2247e0) * fix lintian: missing-separator-between-items in x2goagent depends field between nxagent (>= ${source:Version}) and ${misc:Depends} 2012-12-15 14:45:26 +0100 Reinhard Tartler (300bafb1a) * integrate install and uninstall rules into the top-level Makefile 2012-12-15 14:58:58 +0100 Reinhard Tartler (978aaa0a4) * integrate nx*/x2go* shell wrappers into debian/wrappers 2012-12-16 11:40:09 +0100 Reinhard Tartler (918e2b10d) * Use Fixes instead of Closes syntax 2012-12-15 15:05:33 +0100 Reinhard Tartler (352751ef9) * simplify clean rule in debian/rules 2012-12-16 00:00:09 +0100 Mike Gabriel (f2011a718) * add closure for #87 2012-12-15 14:29:41 +0100 Reinhard Tartler (08d568a2c) * reenable parallel builds 2012-12-15 14:29:25 +0100 Reinhard Tartler (d123923a5) * update 031_nx-X11_parallel-make.full.patch. 2012-12-13 13:11:40 +0100 Mike Gabriel (0ef5ea2eb) * add changelog entries for Reinhard's previous commits 2012-12-13 12:19:20 +0100 Reinhard Tartler (682c80705) * fix installation of libxcompext 2012-12-12 12:48:34 +0100 Reinhard Tartler (e559c7522) * delete nxproxy/configure 2012-12-12 12:47:54 +0100 Reinhard Tartler (9a3737b14) * drop debian/patches/025_nxproxy_no-configure-file.full+lite.patch 2012-12-12 15:20:44 +0100 Reinhard Tartler (b09b686cf) * add rewritten roll-tarballs.sh script 2012-12-12 12:45:41 +0100 Reinhard Tartler (d139e5d3d) * drop debian/patches/001_add-main-makefile.full+lite.patch 2012-12-12 12:42:03 +0100 Reinhard Tartler (a12ad5050) * integrate debian/pre-build-nx.sh into debian/rules 2012-12-12 12:27:00 +0100 Reinhard Tartler (3970fabc5) * Rely on shlibs files instead of hard coding library dependencies 2012-12-12 12:31:51 +0100 Reinhard Tartler (263523d7b) * disable parallel builds 2012-12-12 10:07:52 +0100 Reinhard Tartler (6b505a48a) * remove unnecessary build-conflict on xbitmaps 2012-12-12 10:30:57 +0100 Reinhard Tartler (d634c16aa) * make xfonts-base a recommends 2012-12-12 13:23:37 +0100 Mike Gabriel (3727d736b) * add (forgotten) files belong to last commit 2012-12-12 13:20:39 +0100 Orion Poplawski (923b7c7eb) * Add patches: 026_nxcomp*_honour-optflags.full*.patch. (Closes upstream issue #84). 2012-12-12 13:06:25 +0100 Mike Gabriel (016959d11) * changelog cleanup 2012-12-12 13:05:56 +0100 Mike Gabriel (241010302) * exchange X2Go by NX 2012-12-08 18:25:28 +0100 Reinhard Tartler (19685c566) * install debug symbols for all packages in a new binary package 'nx-x11-dbg' 2012-12-06 09:07:09 +0100 Alexander Wuerstlein (26901cc52) * Follow-up commit for 302_nxagent_configurable-keystrokes.full.patch, fixes FTBFS problem with the first version of that patch. 2012-12-04 15:28:00 +0100 Mike Gabriel (fe598a1e5) * changelog entry for having added libxml2-dev to build dependencies 2012-12-04 15:27:00 +0100 Mike Gabriel (0def0092f) * control file: add some kommata at EOLs, fix dependency of x2goagent on nxagent 2012-12-04 15:24:25 +0100 Mike Gabriel (6c9bd8865) * Add pkg-config to build dependencies. 2012-12-04 14:55:01 +0100 Mike Gabriel (2093e705a) * Add README.keystrokes to doc section of bin:package nxagent. 2012-12-04 14:54:30 +0100 Mike Gabriel (cf5ac17d6) * whitespace fix 2012-12-04 13:50:47 +0100 Mike Gabriel (2a112c1c3) * add bug closure for X2Go BTS issue #74 2012-12-04 13:49:18 +0100 Mike Gabriel (5938c38ae) * re-add renamed patch file 2012-12-04 13:48:12 +0100 Mike Gabriel (0a91caa98) * Add patch: 302_nxagent_configurable-keystrokes.full.patch, replaces the... (fixing patch application, fixing up follow-up patches, cleaning up patch-system). 2012-12-04 13:31:01 +0100 Alexander Wuerstlein (34f232c14) * Add patch: 210_nxagent_configurable-keystrokes.full.patch, replaces the hardcoded nxagent keybindings by a configurable table of keybindings. 2012-11-12 08:45:46 +0100 Mike Gabriel (5a640efd1) * Fix /bin/Makefile. Add $(DESTDIR) to every install path. 2012-11-07 21:14:41 +0100 Mike Gabriel (9e8a2792f) * Continue development... 2012-11-07 21:08:06 +0100 Mike Gabriel (3fd30962b) * release 3.5.0.16 (tag: redist-server/3.5.0.16, tag: redist-client/3.5.0.16) 2012-11-07 21:07:43 +0100 Mike Gabriel (9568a1655) * Bump Debian Standards to 3.9.3 (no changes needed). Update Home page and Vcs information. 2012-11-07 21:05:47 +0100 Mike Gabriel (232f1a46e) * Bump Debian Standards to 3.9.3 (no changes needed). 2012-11-07 20:36:04 +0100 Mike Gabriel (b246e9f75) * Dropping empty override rules for quilt patch from /debian/rules. 2012-10-20 22:56:14 +0200 Mike Gabriel (45b9bb839) * Modify patch: 001_add-main-makefile.full+lite.patch. Add uninstall routine. 2012-10-20 22:27:26 +0200 Mike Gabriel (f801d405d) * Fix wrapper scripts: make sure all NX executables can be launched if NX gets installed via the tarball installation method. 2012-10-20 17:58:04 +0200 Mike Gabriel (d39771037) * Modify patch: 001_add-main-makefile.full+lite.patch. Install nx* and x2goagent wrapper scripts during make install. 2012-10-20 09:33:11 +0200 Mike Gabriel (30d311a68) * Add patch: 025_nxproxy_no-configure-file.full+lite.patch. Remove unneeded build file from NoMachine's nxproxy sources. 2012-10-20 08:15:35 +0200 Mike Gabriel (380d23968) * Add patches: 024_fix-make-clean.full.patch, 024_fix-make-clean.full+lite.patch. Fix clean-up of build tree after make build has run. 2012-10-20 08:05:53 +0200 Mike Gabriel (1e3d69216) * drop build file from nx-libs tree 2012-10-19 09:56:26 +0200 Mike Gabriel (11980c79b) * Drop patch 032, fix other patches so that installation via make install installs NX components to /usr/local/lib/nx and /usr/local/include/nx. 2012-10-05 14:37:20 +0200 Mike Gabriel (fbb3ba912) * Modify patch: 032_no-x11r6.full.patch. Install nx-X11 to /usr/local/lib/nx. Add patch: 032_no-x11r6.debian.patch. Use /usr/lib/nx for nx-X11 on Debian. 2012-10-05 14:26:48 +0200 Mike Gabriel (cd631e0bc) * Fix patch file names concerning component nx-X11. 2012-09-28 15:18:07 +0200 Mike Gabriel (e3ba4bdc6) * Fix installation of header files in Debian package. 2012-09-21 10:07:07 +0200 Mike Gabriel (21b09b85b) * Continue development... 2012-09-21 10:03:00 +0200 Mike Gabriel (51412cd02) * release 3.5.0.15 (tag: redist-server/3.5.0.15, tag: redist-client/3.5.0.15) 2012-09-20 22:13:12 +0200 Mike Gabriel (9f1868def) * mark issue #16 as closed by last added patch 2012-09-20 22:12:00 +0200 Mike Gabriel (dc30db8a1) * fix patch name 2012-09-20 21:27:59 +0200 Oleksandr Shneyder (f6adfd1fa) * Add patch: 204-nxagent_repaint-solidpict.full.patch. Fixes repainting of SolidFill pictures by nxagent/x2goagent on reconnects. 2012-09-17 18:50:50 +0200 Mike Gabriel (b8db5192d) * Add patch: 220_nxproxy-bind-loopback-only.full+lite.patch, adds loopback option to nxproxy options and forces nxproxy to bind to loopback devices only. 2012-09-17 16:50:15 +0200 Mike Gabriel (b9a7a1b4f) * Add patch: 220_nxproxy-bind-loopback-only.patch, adds loopback option to nxproxy options and forces nxproxy to bind to loopback devices only. 2012-09-15 21:01:51 +0200 Mike Gabriel (f83009075) * remove Priorty: extra from -dev package 2012-09-15 20:39:50 +0200 Mike Gabriel (78dc96a39) * /debian/control: Maintainer change in package: X2Go Developers . Priority: optional. 2012-09-14 16:48:43 +0200 Mike Gabriel (2d6352839) * remove weird remainders of configure files... 2012-09-14 16:47:20 +0200 Mike Gabriel (b8605d4d6) * Link libNX_Xrandr to a separate location where we can provide it as libXrandr. 2012-09-04 12:50:38 +0200 Mike Gabriel (189bfbe14) * Make sure the NX_TEMP envvar gets set in all wrapper script for all nx* executables 2012-09-04 12:47:27 +0200 Mike Gabriel (8d2827b2a) * Refresh patch 200_nxagent_check-binary-x2go-flavour.full.patch 2012-07-13 16:36:27 +0200 Mike Gabriel (3fdfd5142) * Add VERSION.x2goagent to package x2goagent package so x2goversion command lists up x2goagent in the list of X2Go server-side packages. 2012-06-28 22:22:00 +0200 Mike Gabriel (b42268b13) * Improve 020_add-nxagent-wrapper.full.patch: Properly set NX_TEMP, make sure nxagent launches even with pam_tmpdir.so being in use. 2012-06-28 22:20:57 +0200 Mike Gabriel (7b3d592e6) * debian/changelog 2012-06-28 14:55:16 +0200 Mike Gabriel (6af3d3b80) * Continue development... 2012-06-28 14:52:41 +0200 Mike Gabriel (136375188) * release 3.5.0.14 (tag: redist-server/3.5.0.14) 2012-06-28 12:31:01 +0200 Mike Gabriel (b65b83ba4) * Drop patch: 109_nxagent_locale-utf8-compound-text.patch, the patch causes Qt applications to be rendered without window decorations when running in rootless window mode. 2012-06-04 08:19:19 +0200 Mike Gabriel (dd7b5eb3c) * Add patch: 052_nxcomp_macos10-nxauth-location.full+lite.patch, change nxauth search location on Mac OS X to $NX_SYSTEM/nxauth to facilitate application bundle building. 2012-05-22 00:57:21 +0200 Mike Gabriel (e2e7008b3) * New upstream release of nxagent (3.5.0-9). 2012-05-22 00:50:51 +0200 Mike Gabriel (fdaa24043) * Merge branch 'nxagent' 2012-05-22 00:49:10 +0200 Mike Gabriel (222a4a222) * Imported nxagent-3.5.0-9.tar.gz (origin/nxagent, gh-sunweaver/nxagent, gh-salva/nxagent, gh-mjtrangoni/nxagent, gh-ionic/nxagent, gh-Ionic/nxagent, gh-Etersoft/nxagent) 2012-05-11 23:57:35 +0200 Mike Gabriel (fe72988fb) * Continue development... 2012-05-11 23:52:39 +0200 Mike Gabriel (789c75851) * release 3.5.0.13 (tag: redist-server/3.5.0.13) 2012-05-11 23:51:09 +0200 Mike Gabriel (3511e8791) * add patch header for 120_nxagent_libcairo-null-source-drawables.full.patch 2012-05-11 12:48:36 +0200 Mike Gabriel (45311f783) * Add patch: 120_nxagent_libcairo-null-source-drawables.full.patch, solves crashes of GTK applications based on libcairo 1.12.1+. 2012-03-17 17:22:51 +0100 Mike Gabriel (4372dfa53) * Let nxagent Debian package depend on xfonts-base. 2012-03-17 17:21:50 +0100 Mike Gabriel (fc87c4fbb) * Revert "Let nxagent Debian package depend on xfonts-base." 2012-03-17 17:20:49 +0100 Mike Gabriel (ab04ba217) * Let nxagent Debian package depend on xfonts-base. 2012-03-07 21:01:44 +0100 Mike Gabriel (30110dd4a) * Continue development... 2012-03-07 20:51:27 +0100 Mike Gabriel (1b1a26ae6) * release 3.5.0.12 (tag: redist-server/3.5.0.12, tag: redist-client/3.5.0.12) 2012-03-01 22:31:35 +0100 Mike Gabriel (4f7c8d079) * Re-introduce proper Xinerama support on non-multiarch systems. 2012-03-01 22:27:26 +0100 Mike Gabriel (95929b8a5) * no bashisms in package scripts 2012-03-01 22:26:38 +0100 Mike Gabriel (9b17e8a96) * changelog cleanup: fixing too-long-line 2012-03-01 22:13:32 +0100 Mike Gabriel (fb274937d) * Provide temporary workaround for installation on Debian 64bit with multiarch support (via libnx-x11.postinst and .prerm). 2012-03-01 22:06:08 +0100 Mike Gabriel (055436f48) * fix wrong lib-name in libnx-x11.postinst 2012-03-01 21:53:28 +0100 Mike Gabriel (3776a6f41) * typofix in libnx-x11.postinst 2012-03-01 21:12:54 +0100 Mike Gabriel (a71cebf04) * Provide temporary workaround for installation on Debian 64bit with multiarch support. 2012-03-01 20:43:53 +0100 Mihai Moldovan (22d41ae20) * Update patch: 005_nxcomp_gcc43.full+lite.patch, fix faulty path to nxcomp/Split.cpp. 2012-03-01 20:39:37 +0100 Mike Gabriel (7e5c04b5d) * Pass address of fd_set structs on the stack to the FD_ISSET macro/function, instead of the struct itself. 2012-02-29 15:56:49 +0100 Mihai Moldovan (655173ff2) * Add patch: 051_nxcomp_macos105-fdisset.full+lite.patch, work around issue in Mac OS X 10.5 SDK. 2012-02-28 13:44:25 +0100 Oleksandr Shneyder (be86627ad) * Create patch: 203_nxagent_disable-rootless-exit.full.patch 2012-02-22 22:49:06 +0100 Mike Gabriel (0586f0d6e) * Update patch: 001_add-main-makefile.full+lite.patch, adapt patch from packaging. Test for Makefiles in subfolders before calling them. Fixes build failure during ,,make distclean'' calls. 2012-02-22 15:05:55 +0100 Mike Gabriel (a8bf2dd81) * Continue development... 2012-02-22 14:41:26 +0100 Mike Gabriel (50690ea17) * release 3.5.0.11 (tag: redist-server/3.5.0.11, tag: redist-client/3.5.0.11) 2012-02-20 10:00:00 +0100 Mike Gabriel (fde6a88a8) * Fine-tune symlinking of libXinerama. 2012-02-18 02:28:53 +0100 Mike Gabriel (ec47c22c2) * Fix Xinerama support in Debian package libnx-x11 when NX gets built with patch 600_nx-X11+nxcompext+nxcompshad_unique-libnames.full.patch. Still on the todo list: fix the nx-X11 installation via Makefile. 2012-02-16 19:38:48 +0100 Mike Gabriel (7a6cf42d4) * another last patch with .diff suffix 2012-02-16 19:35:28 +0100 Mike Gabriel (e63819e64) * Fix faulty patch name suffix (has to be .patch, not .diff). 2012-02-16 19:31:08 +0100 Mike Gabriel (78fba0271) * Apply patches for the Debian package as the last patches in the series. 2012-02-15 09:42:35 +0100 Mike Gabriel (c26e4bd82) * Update patches: 012_nxcomp..., 013_nxcompext_..., 014_nxcompshad_.... Also make use of $(LIBFULL) in Makefile.in's install and uninstall stanzas. Inspired by Jan Engelhardt's so-version.diff patch. However, the version name change requested in that patch has been rejected for NX (redistributed). 2012-02-15 08:50:48 +0100 Mike Gabriel (b99168fc3) * changelog cleanup, fix long-line-wraps 2012-02-15 08:49:49 +0100 Jan Engelhardt (07f9dfa05) * Add patch 600_nx-X11+nxcompext+nxcompshad_unique-libnames.full.patch, use unique library names for nx-X11 based X11 libraries. 2012-02-15 08:10:21 +0100 Mike Gabriel (548d50ba5) * changelog cleanup, typo fix 2012-02-15 08:09:41 +0100 Jan Engelhardt (3deee8f94) * Add patch 032_nx-X11_no-x11r6-project-root. We must not overlap with any existing files, therefore, both /usr/X11R6 and /usr are excluded possibilities for ProjectRoot. Use %_libexecdir/somename, since that is still allowed by FHS. 2012-02-14 23:34:51 +0100 Mike Gabriel (9282c00e2) * Update patch: 001_add-main-makefile.full+lite.patch, fix missing $(CONFIGURE) variable. 2012-02-14 23:03:45 +0100 Mike Gabriel (6a96ae450) * Make patch headers DEP5 compliant (030_nx-X11_... and 031_nx-X11_...). 2012-02-14 22:59:50 +0100 Jan Engelhardt (8d6d0a921) * Add patch: 301_nx-X11_use-shared-libs.full.diff, use shared libraries from distribution rather then libs included in source tree. 2012-02-14 22:42:48 +0100 Mike Gabriel (01e97f0f8) * Rename patches 030_nx-X11_... and 031_nx-X11_..., the tarball roll script currently requires ,,full'' or ,,full+lite'' in the file name. 2012-02-14 22:40:15 +0100 Mike Gabriel (c621c22f8) * Merge honor-ac-dirs.patch from Jan Engelhardt (OpenSUSE) with already existing Makefile patches (012_nxcomp..., 013_nxcompext_..., 014_nxcompshad_...). 2012-02-14 22:30:26 +0100 Mike Gabriel (4d6e1c4fb) * Enable parallel build for Debian package. 2012-02-14 08:47:19 +0100 Jan Engelhardt (ba589d1fd) * Add patch: 031_nx-X11_parallel-make.diff, enable parallel make. 2012-02-14 08:39:32 +0100 Mike Gabriel (b4b4e209b) * Update patch: 001_add-main-makefile.full+lite.patch, use curly braces for macros. 2012-02-14 08:33:42 +0100 Jan Engelhardt (280d8751c) * Add patch: 030_nx-X11_configure-args.diff. Allow passing of configure args. 2012-02-14 08:27:52 +0100 Mike Gabriel (165206eb2) * changelog fix, long-line-wrap 2012-02-14 08:26:50 +0100 Jan Engelhardt (448a1db30) * Update patch: 001_add-main-makefile.full+lite.patch, allow passing of configure args. 2012-02-12 12:40:01 +0100 Mike Gabriel (b087877b2) * Xinerama path has to be put into debian/rules, that dpkg-shlibs can find the libXinerama files. 2012-02-12 01:03:38 +0100 Mike Gabriel (4feedb214) * fix for intra-dependency lintian fix 2012-02-12 00:37:51 +0100 Mike Gabriel (278f94136) * fix libXinerama removal 2012-02-11 23:39:16 +0100 Mike Gabriel (4473c3ab9) * Do not install libXinerama directly into /usr/lib/nx. Recommended method is installing to /usr/lib/nx/Xinerama, so that you can enable/disable usage of the Xinerama extension. 2012-02-11 23:06:58 +0100 Mike Gabriel (ec7237798) * Revert "Add patch: 111_nxcomp_byerace.full+lite.patch. Work around race condition in qtnx and libnxcl." 2012-02-08 08:52:18 +0100 Mike Gabriel (4eae840bd) * Add patch: 111_nxcomp_byerace.full+lite.patch. Work around race condition in qtnx and libnxcl. 2012-02-07 21:00:44 +0100 Mike Gabriel (54792fe29) * another fix for the main Makefile 2012-02-07 16:39:58 +0100 Mike Gabriel (7f7cb5d87) * more simplification of the main Makefile 2012-02-07 16:19:36 +0100 Mike Gabriel (eb5ef91b6) * simplify main Makefile a little... 2012-02-07 16:10:34 +0100 Mike Gabriel (00b266b82) * Use ,,$(MAKE) -C'' in main Makefile for calling Makefiles in subdirectories, make build stanza work for nx-libs-full and nx-libs-lite. 2012-02-07 15:23:45 +0100 Mike Gabriel (f4ef2967b) * Use ,,make -C'' in main Makefile for calling Makefiles in subdirectories. 2012-02-07 13:48:36 +0100 Mike Gabriel (a751baaab) * Continue development... 2012-02-07 13:44:21 +0100 Mike Gabriel (419d505c9) * release 3.5.0.10 (tag: redist-server/3.5.0.10, tag: redist-client/3.5.0.10) 2012-02-07 13:37:16 +0100 Mike Gabriel (28acb2ea1) * changelog fix (revision was missing) 2012-02-07 13:09:02 +0100 Mike Gabriel (2f8b190c8) * Reintroduce patch: 008_nxcomp_sa_restorer.full+lite.patch, now in a version found on etersoft.ru, fixes build on ia64 architecture. 2012-02-06 12:15:13 +0100 Mike Gabriel (6ae5c16b8) * cleanup patch 2012-02-06 12:12:20 +0100 Mike Gabriel (e326dd760) * Add patch: 006_nxcomp_libpng15.full+lite.patch, fix build against libpng 1.5.x. 2012-02-01 14:48:55 +0100 Mike Gabriel (dbbbbc5ff) * Continue development... 2012-02-01 14:40:41 +0100 Mike Gabriel (220c985d3) * release NX re-distributed 3.5.0.9 (tag: redist-server/3.5.0.9) 2012-02-01 14:38:14 +0100 Mike Gabriel (8ba08fa2e) * Providing pending patches in source tree. 2012-01-30 13:45:07 +0100 Oleksandr Shneyder (2d226a609) * Update patch: 202_nx-x11_enable-xinerama.full.patch, disable Xinerama extension if NX_XINERAMA_CONF not exists. 2012-01-30 13:18:30 +0100 Oleksandr Shneyder (3467d6b76) * Revert "Update patch: 202_nx-x11_enable-xinerama.full.patch disable Xinerama extension if NX_XINERAMA_CONF not exists" 2012-01-30 13:18:12 +0100 Oleksandr Shneyder (3c0e43a41) * Revert "changelog cleanup: add interpunctation." 2012-01-30 13:12:26 +0100 Mike Gabriel (d4d85ca86) * changelog cleanup: add interpunctation. 2012-01-30 13:05:01 +0100 Oleksandr Shneyder (f17b59824) * Update patch: 202_nx-x11_enable-xinerama.full.patch disable Xinerama extension if NX_XINERAMA_CONF not exists 2012-01-28 08:58:43 +0100 Reinhard Tartler (36ca6646b) * fix typos in nxproxy manpage 2012-01-23 00:05:29 +0100 Mike Gabriel (104623396) * version increment, continue development... 2012-01-22 23:42:43 +0100 Mike Gabriel (f4379f608) * release NX re-distributed 3.5.0.8 (tag: redist-server/3.5.0.8) 2012-01-22 23:02:50 +0100 Mike Gabriel (cf5a5980c) * Fix patch: 109_nxagent_locale-utf8-compound-text.patch, fix crashes reported from Stefan Baur. Thanks for reporting and testing!!! 2012-01-22 22:47:30 +0100 Mike Gabriel (5027f1e8b) * Add folder /debian/patches-pending-evaluation with two newly discovered patches from git.etersoft.ru (AltLinux packaging repository for NX). 2012-01-18 20:09:39 +0100 Mike Gabriel (a05b56038) * Package x2goagent is an ,,all'' package, not ,,any''. 2012-01-16 22:57:29 +0100 Mike Gabriel (8b013ce80) * Update patch: 001_add-main-makefile.full+lite.patch, only build, install, clean etc. NX subprojects if the folder exists. 2012-01-16 22:29:05 +0100 Mike Gabriel (e9241fe8c) * Reorganize patch names, to reflect patch inclusion into lite+full or full-only ,,NX (redistributed)'' tarball. 2012-01-16 11:28:26 +0100 Mike Gabriel (d7ecf7214) * release NX re-distributed 3.5.0.7 (tag: redist-server/3.5.0.7) 2012-01-16 10:54:19 +0100 Mike Gabriel (1bd66f19c) * Drop patch: 011_nxcomp_sa-restorer.patch. 2012-01-13 13:22:13 +0100 Mike Gabriel (28b2a3a93) * release NX re-distributed 3.5.0.6 (tag: redist-server/3.5.0.6) 2012-01-13 13:09:43 +0100 Mike Gabriel (8d655bc1a) * Install libXinerama into libnx-x11 package. Header files into libnx-x11-dev. 2012-01-13 12:45:15 +0100 Mike Gabriel (d086c3699) * fix for lintian-overrids (debian-revision-should-not-be-zero), package: libxcomp-dev 2012-01-13 11:34:21 +0100 Mike Gabriel (55ee602bb) * Silence lintian on debian-revision-should-not-be-zero. As this is no Debian packaging repository, but ,,NX (redistributed)'', we will always release with rev no. set to ,,0''. 2012-01-13 11:29:10 +0100 Mike Gabriel (e32a5590f) * Add patch header/copyright to: 202_nx-x11_enable-xinerama.patch. 2012-01-13 11:28:17 +0100 Mike Gabriel (2be056d38) * Fix lintian issue: missing-separator-between-items for x2goagent package. Drop dependency on libnx-x11 as we already depend on nxagent and fix description synopsis of x2goagent package. 2012-01-13 10:29:47 +0100 Mike Gabriel (fa996b5bc) * Add patch: 202_nx-x11_enable-xinerama.patch. 2012-01-13 00:38:30 +0100 Mike Gabriel (fdf0d1ccf) * release NX re-distributed 3.5.0.5 (tag: redist-server/3.5.0.5) 2012-01-13 00:36:28 +0100 Mike Gabriel (a295d73f6) * Fix wrapper script patches for nxagent, x2goagent, nxauth, nxproxy. 2012-01-12 23:05:32 +0100 Mike Gabriel (8199a5d2a) * release NX re-distributed 3.5.0.4 (tag: redist-server/3.5.0.4) 2012-01-12 23:04:03 +0100 Mike Gabriel (96cd4325b) * Update/fix patch: 999_nxagent_unbrand-nxagent-brand-x2goagent.patch. 2012-01-12 13:09:00 +0100 Mike Gabriel (e40208d7c) * release NX re-distributed 3.5.0.3 (tag: redist-server/3.5.0.3) 2012-01-12 13:03:59 +0100 Mike Gabriel (86dc68806) * set version to 3.5.0.3-0 2012-01-12 13:02:36 +0100 Mike Gabriel (1bbc9cc9e) * changelog cleanup 2012-01-12 13:01:47 +0100 Mike Gabriel (496f31a51) * Fix RGB color pallette (gray X2GO logo to be more accurate) for agent splash screen. 2012-01-12 13:01:04 +0100 Mike Gabriel (df8dc83d1) * two more patches belonging to last commit: 016a_debian_nx-X11_install-location.patch, 102a_debian_xserver-xext_set-securitypolicy-path.patch 2012-01-12 13:00:23 +0100 Mike Gabriel (760c5c07c) * Provide patches that are tarball / distro aware. Either NX (redistributed) has been installed to /usr/local/lib/nx via tarball or it has been packagedfor a distribution and is installed to /usr/lib/nx. Other installation paths are currently not supported. 2012-01-12 12:15:14 +0100 Mike Gabriel (d6fee9a41) * Modify patch: 101_nxagent_set-rgb-path.patch, add path to RGB file if NX (redistributed) is installed via tarball under /usr/local. 2012-01-11 17:37:45 +0100 Mike Gabriel (8f76198c5) * Add binary package: x2goagent, includes man page patch: 209_x2goagent-add-man-page.patch 2012-01-11 17:34:18 +0100 Mike Gabriel (0d3a820b3) * Revert "Drop patch: 101_nxagent_set-rgb-path.path, add patch: 202_nxagent_set-rgb-path-x2go-flavour-aware.patch." 2012-01-11 17:25:08 +0100 Mike Gabriel (d9d49b5d8) * Drop patch: 101_nxagent_set-rgb-path.path, add patch: 202_nxagent_set-rgb-path-x2go-flavour-aware.patch. 2012-01-11 17:03:23 +0100 Mike Gabriel (43de8b972) * Add patch: 209_x2goagent-add-man-page.patch. 2012-01-11 16:41:26 +0100 Mike Gabriel (fdfed536c) * Add patch: 023_add-x2goagent-wrapper.patch. 2012-01-11 16:38:36 +0100 Mike Gabriel (9d99eeb53) * remove copy+paste cruft from debian/patches/999_nxagent_unbrand-nxagent-brand-x2goagent.patch 2012-01-11 16:38:10 +0100 Mike Gabriel (6ae3d7efc) * add EOL at EOF 2012-01-11 16:17:51 +0100 Mike Gabriel (405bc8f25) * Add X2Go agent / NX agent flavouring via patch system: - 200_nxagent_check-binary-x2go-flavour.patch - 201_nxagent_set-x2go-icon-if-x2goagent-flavour.patch - 300_nxagent_set-wm-class.patch - 999_nxagent_unbrand-nxagent-brand-x2goagent.patch 2012-01-11 16:15:38 +0100 Mike Gabriel (19f248733) * Drop NX agent unbrand patch from FreeNX. 2012-01-11 15:31:11 +0100 Mike Gabriel (3744795d3) * Rename nxagent-unbrand patch, so that is the last patch to be applied (999_). 2012-01-10 14:39:07 +0100 Mike Gabriel (eaea40dec) * release NX re-distributed 3.5.0.2 (tag: redist-server/3.5.0.2) 2012-01-10 14:37:25 +0100 Mike Gabriel (e669607f9) * Update folder name where applied patches end up in the tarball release. 2012-01-10 14:34:27 +0100 Mike Gabriel (eac87da64) * Re-add binary wrapper scripts to the patch system as we want to provide them in the tarball. 2012-01-10 12:06:00 +0100 Mike Gabriel (c84ad97a7) * release NX re-distributed 3.5.0.1 (tag: redist-server/3.5.0.1) 2012-01-10 12:05:44 +0100 Mike Gabriel (ca0994c84) * Increment version to stay in sync with client-only branch. 2012-01-10 11:39:35 +0100 Mike Gabriel (d97802ad7) * release NX re-distributed 3.5.0.0 (tag: redist-server/3.5.0.0) 2012-01-10 11:14:36 +0100 Mike Gabriel (281b04f70) * Add patches: 009_add-nxagent-man-page.patch, 009_add-nxproxy-man-page.patch. Reintroduce man page creation via patch system, so that all man pages find their way into the NX-redistribution tarball created from this source project. 2012-01-10 10:50:01 +0100 Mike Gabriel (71cc495aa) * Fix dh_installman for nxproxy. 2012-01-10 10:12:50 +0100 Mike Gabriel (e685cc890) * switch NX-redistribution version to 3.5.0.0 2012-01-10 10:07:56 +0100 Mike Gabriel (736356ea7) * Add patch: 000_add-NX-redistribution-README.patch. 2011-12-31 19:28:56 +0100 Mike Gabriel (c9c1f8b91) * Remove branding from descriptions in control file. 2011-12-31 18:55:05 +0100 Mike Gabriel (c9bf030aa) * Call dh_clean again. This got lost somewhere on the way. 2011-12-31 18:32:01 +0100 Mike Gabriel (e292f23ac) * forgot to add patch file: 005_nxcomp_gcc43.patch 2011-12-31 18:31:40 +0100 Mike Gabriel (91ae4d4e4) * Fix line hunks: 011_nxcomp_sa-restorer.patch. 2011-12-31 18:29:56 +0100 Mike Gabriel (b494b5287) * Revert "Fix linking of doc folders for nxcomp*-dev." 2011-12-31 17:12:52 +0100 Mike Gabriel (2fe05f6ad) * patches/series cleanup 2011-12-31 17:12:20 +0100 Mike Gabriel (6f30998ad) * Add/insert patch: 005_nxcomp_gcc43.patch. 2011-12-31 17:04:48 +0100 Mike Gabriel (448872e70) * Add patch: 011_nxcomp_sa-restorer.patch. 2011-12-31 16:27:58 +0100 Mike Gabriel (82e5023ed) * Transfer patch: 009_nxproxy_add-man-page.patch into man page file in /debian/man. 2011-12-31 16:24:02 +0100 Mike Gabriel (608bbb6d9) * Fix linking of doc folders for nxcomp*-dev. 2011-12-31 16:22:46 +0100 Mike Gabriel (eb069a4e6) * grammar fix in pre-build-nx.sh 2011-12-31 03:18:07 +0100 Mike Gabriel (85e87ab6c) * Add patch headers to all patch files, report most patches upstream. Waiting for feedback and quotable URLs from NoMachine. 2011-12-31 03:16:59 +0100 Mike Gabriel (24261f05e) * Remove patch: 104_nxagent_enable_debug.patch, as it breaks package build. 2011-12-31 02:57:25 +0100 Mike Gabriel (a24c4b2e7) * also forgotten: scripts for last two commits 2011-12-31 01:41:34 +0100 Mike Gabriel (0db119427) * changelog: forgot to ship with last commit 2011-12-31 01:39:39 +0100 Mike Gabriel (92374647e) * * Remove patches and put as executable scripts into /debian/bin/ - 005_add-nxagent-wrapper.patch. - 008_add-nxproxy-wrapper.patch. - 011_add-nxauth-wrapper.patch. 2011-12-31 01:27:13 +0100 Mike Gabriel (383f8eece) * Remove patch 006_remove-configure-files.patch. Implemented via /debian/rules. 2011-12-31 01:03:16 +0100 Mike Gabriel (faa3dee7e) * Make package descriptions in /debian/control more explanatory. 2011-12-31 00:29:09 +0100 Mike Gabriel (a193a0a0a) * Remove *-dbg packages from /debian/control file. 2011-12-31 00:26:16 +0100 Mike Gabriel (caa6dd5f1) * Add more upstream source information to README.source. 2011-12-30 23:46:45 +0100 Mike Gabriel (c2cdc1da3) * Set homepage of NoMachine upstream site (using http://www.nomachine.com/sources.php). 2011-12-30 19:21:24 +0100 Mike Gabriel (7fabca589) * Set homepage of X2Go upstream project (using http://wiki.x2go.org). Packaging Vcs has been relocated to Alioth. 2011-12-30 15:34:02 +0100 Mike Gabriel (f1c239c07) * changelog fix for latest changelog line 2011-12-30 15:32:37 +0100 Mike Gabriel (e20dc398f) * control file: fixing Breaks/Replaces statements 2011-12-30 15:29:39 +0100 Mike Gabriel (28a112c7a) * changelog fix: typo 2011-12-30 15:29:01 +0100 Mike Gabriel (74e810a31) * changelog fix: wrap long line 2011-12-30 15:28:23 +0100 Mike Gabriel (d6fa23c86) * Break/conflict with nxlibs and nxlibs-dev (packages provided by freenx-team on Launchpad). 2011-12-30 15:25:30 +0100 Mike Gabriel (290fdeddf) * Make `breaks-without-version' lintian overrides needless. 2011-12-30 15:20:02 +0100 Mike Gabriel (f9177685a) * changelog modification: use Debianic revision numbers 2011-12-30 15:16:59 +0100 Mike Gabriel (5287efc44) * X2Go Packaging Team becomes maintainer, Mike Gabriel + Reinhard Tartler become uploaders. 2011-12-29 21:38:51 +0100 Mike Gabriel (7d9e1544f) * Fix LD_LIBRARY_PATH export in wrapper scripts/patches. 2011-12-29 16:33:57 +0100 Mike Gabriel (0e3b58b7f) * Add patch: 019_nx-x11_expat-build-against-system-libxmltok.patch, fixes lintian error: embedded-library: expat. Build-depend on libxmltok1-dev. 2011-12-29 16:28:19 +0100 Mike Gabriel (93b716f78) * Disable patch: 006_remove-configure-files.patch, remove configure files from within /debian/rules. 2011-12-29 14:45:18 +0100 Mike Gabriel (21a85ffbe) * Make sure upstream changelog file names are in lower case. 2011-12-29 14:34:35 +0100 Mike Gabriel (5dea6a378) * * Override lintian warnings - libnx-x11: postinst-has-useless-call-to-ldconfig - libnx-x11: postrm-has-useless-call-to-ldconfig as they relate to a bug in debhelper (call of ldconfig although we did not touch any directory controlled by /etc/ld.so.conf, amongst others see BTS issue #205142). 2011-12-29 13:51:47 +0100 Mike Gabriel (3b7914dd7) * Add upstream CHANGELOG files to all .deb packages of this source package. 2011-12-29 13:50:34 +0100 Mike Gabriel (e1f46f911) * explicitly name all source version from upstream used for initial package release. 2011-12-29 13:27:14 +0100 Mike Gabriel (d57ff7754) * Update patch: 017_nx-x11_update-autotools-helper-files.patch. Add lintian override to source.lintian-overrides: ancient-autotools-helper-file as we handle autotools helper file updates via patch system. 2011-12-29 13:22:26 +0100 Mike Gabriel (776fa97cb) * changelog fix: wrap long lines 2011-12-29 13:08:43 +0100 Mike Gabriel (fafea0918) * Add patch: 018_nx-x11_update-libtool-ltmain-script.patch. Silence lintian warning ancient-libtool via lintian override as we patch in a new version of ltmain.sh by this patch. 2011-12-29 13:06:55 +0100 Mike Gabriel (a8d1eab2c) * Add lintian-override: outdated-autotools-helper-file to source.lintian-overrides as we patch-update the outdated helper files before building binaries. 2011-12-29 12:29:24 +0100 Mike Gabriel (184c63e7b) * Add README.source file, fixes lintian warning: patch-system-but-no-source-readme. 2011-12-29 12:24:49 +0100 Mike Gabriel (b3eac91c9) * Add patch: 017_nx-x11_update-autotools-helper-files.patch. 2011-12-29 12:17:22 +0100 Mike Gabriel (e68f15a9d) * changelog fix: wrap long line 2011-12-29 11:59:40 +0100 Mike Gabriel (da0bfe6ea) * Disable patch: 104_nxagent_enable_debug.patch for now as it let's the build fail. 2011-12-29 11:54:02 +0100 Mike Gabriel (3d575c45c) * add possible-new-upstream-release-without-new-version lintian override for *-dev packages, as well 2011-12-29 11:37:35 +0100 Mike Gabriel (b97f5a78b) * wrap long lines in /debian/changelog 2011-12-29 11:01:23 +0100 Mike Gabriel (dda2c7cd6) * Rename patch: 008_nxproxy_add-nx-proxy-wrapper.patch to 008_nxproxy_add-nxproxy-wrapper.patch. Add patch from FreeNX patchset: 110_nxagent_createpixmap-bounds-check.patch. 2011-12-29 10:44:39 +0100 Mike Gabriel (c93ae9697) * Install nxagent.xpm icon to /usr/share/pixmaps. 2011-12-29 10:42:42 +0100 Mike Gabriel (43c04dbfd) * Rework FreeNX patches to be applicable to latest NX sources. 2011-12-29 10:25:45 +0100 Mike Gabriel (9f226601f) * Adapt path names in FreeNX patches to meet requirements for source tree of this package. 2011-12-29 10:03:08 +0100 Mike Gabriel (4cffd99f2) * fix debian/patches/series file to reflect new patch naming scheme... 2011-12-29 09:57:30 +0100 Mike Gabriel (89fea9279) * Add FreeNX patches for nxagent (some with other names compared to FreeNX): - 101_nxagent_set-rgb-path.patch - 102_xserver-xext_set-securitypolicy-path.patch - 103_nxagent_set-X0-config-path.patch - 104_nxagent_enable_debug.patch - 105_nxagent_export-remote-keyboard-config.patch - 106_nxagent_utf8-copy-clipboard.patch - 107_nxagent_clipboard-compound-text+small-bed-sheets.patch - 108_nxagent_wine-close-delay.patch - 109_nxagent_locale-utf8-compound-text.patch - 200_nxagent_unbrand-agent.patch 2011-12-29 09:47:29 +0100 Mike Gabriel (dd287a5c8) * Add man page for nxagent. Fix lintian warning: binary-without-manpage. 2011-12-29 09:42:45 +0100 Mike Gabriel (1f87c87a1) * forgot to commit changelog for last two commits (adding of watch files, change of patch file naming scheme) 2011-12-28 23:18:58 +0100 Mike Gabriel (3c2fe1ace) * Change naming scheme of patch files. 2011-12-28 23:15:54 +0100 Mike Gabriel (082c8ae3a) * Add individual watch files for NX components in this source package. 2011-12-28 19:25:43 +0100 Mike Gabriel (13b60f760) * Add lintian-overrides for every package. Override lintian warning: possible-new-upstream-release-without-new-version as there will be new upstream releases of NX subprojects that will not require a version increment of the Debian package. 2011-12-28 19:07:03 +0100 Mike Gabriel (c853e1eb8) * changelog update: new upstream release of nxagent 3.5.0-7 2011-12-28 18:48:50 +0100 Mike Gabriel (82ab807fd) * Merge branch 'nxagent' 2011-12-28 18:46:39 +0100 Mike Gabriel (c29053f82) * Imported nxagent-3.5.0-7.tar.gz (tag: nxagent/3.5.0-7) 2011-12-06 14:48:04 +0100 Mike Gabriel (aa1665506) * fix for patch 016_nx-x11-install.patch (2) 2011-12-06 14:44:40 +0100 Mike Gabriel (37c5f0ee8) * fix for patch 016_nx-x11-install.patch 2011-12-05 09:51:35 +0100 Mike Gabriel (3132e1d02) * Add patch 016_nx-x11-install.patch, to allow installation of nx-X11 from Makefile (via make install). 2011-12-05 09:50:16 +0100 Mike Gabriel (4c66f3d5c) * forgot to add file (015_nxproxy-makefile-uninstall.patch) 2011-12-05 09:42:05 +0100 Mike Gabriel (a2d77744d) * Add install/uninstall stanza to main Makefile (via patch 001_add-main-makefile.patch). 2011-12-05 09:39:08 +0100 Mike Gabriel (f4fac4535) * Add patch: 015_nxproxy-makefile-uninstall.patch. 2011-12-05 09:35:03 +0100 Mike Gabriel (8eb3ea78b) * Add patches: 012, 013, 014 - Makefile uninstall stanza patches for nxcomp, nxcompext, nxcompshad. 2011-12-02 11:54:03 +0100 Mike Gabriel (9852dfad0) * fix EOF of pre-build-nx.sh script 2011-11-20 18:12:44 +0100 Mike Gabriel (23dcaefb6) * missing control file changes to build nxauth 2011-11-20 18:07:06 +0100 Mike Gabriel (a6903100a) * Add lintian overrides for libxcomp*: breaks-without-version. 2011-11-20 18:01:52 +0100 Mike Gabriel (7402df3ba) * fix ext. description of nxagent in control file 2011-11-20 17:06:41 +0100 Mike Gabriel (b55577524) * fix patch 001 2011-11-20 16:51:27 +0100 Mike Gabriel (5814d15bb) * Build nxauth package. 2011-11-20 16:46:36 +0100 Mike Gabriel (4fef9e4a4) * add forgotten patch files for patch 010 and 011 2011-11-20 16:45:16 +0100 Mike Gabriel (7b5552f70) * Add patch: 011_add-nxauth-wrapper.patch. 2011-11-20 16:42:28 +0100 Mike Gabriel (369972db3) * Add patch: 010_nxauth-fix-binary-name-in-man-page.patch. 2011-11-20 16:18:39 +0100 Mike Gabriel (e6fa2ca31) * Fix of nxproxy build in main Makefile (modifies 001_add-main-makefile.patch). 2011-11-20 16:15:36 +0100 Mike Gabriel (b3d3ea7d8) * main Makefile does not need x-bits set 2011-11-20 15:51:32 +0100 Mike Gabriel (379f32a5e) * Add nxproxy man page to nxproxy package. 2011-11-20 15:50:20 +0100 Mike Gabriel (5336186cf) * Add patch: 009_nxproxy-add-man-page.patch. 2011-11-20 15:41:55 +0100 Mike Gabriel (ed08056fd) * fix permission of nxproxy wrapper 2011-11-20 15:40:39 +0100 Mike Gabriel (a84dd07bb) * rename 005_add-nxagent-wrapper.patch 2011-11-20 15:39:31 +0100 Mike Gabriel (5ea24ed1e) * Add patch: 008_add-nxproxy-wrapper.patch. Build nxproxy package. 2011-11-20 15:36:37 +0100 Mike Gabriel (867c3b978) * Add autoconf as build dependency. 2011-11-20 15:27:49 +0100 Mike Gabriel (63bdc1f87) * Remove unknown option --with from dh_auto_clean. 2011-11-20 15:26:17 +0100 Mike Gabriel (c0fb3c34b) * remove build cruft from nxproxy, adapt patch set 006 2011-11-20 15:03:19 +0100 Mike Gabriel (41c5c2537) * fix distclean for patch 001_add-main-makefile.patch 2011-11-20 14:56:16 +0100 Mike Gabriel (b026a8005) * Add patch: 007_nxcompshad-clean-gch-files.patch. 2011-11-20 14:49:53 +0100 Mike Gabriel (d93577c58) * Add patch: 006_remove-configure-files.patch. 2011-11-20 14:43:34 +0100 Mike Gabriel (5489d4648) * Disable build of *-dbg packages. 2011-11-19 18:15:36 +0100 Mike Gabriel (70ccae44a) * Fix for lintian issue: extended-description-line-too-long (nxagent). 2011-11-19 18:09:05 +0100 Mike Gabriel (3add2cba4) * Fix for lintian issue: missing-build-dependency quilt (>= 0.46-7~). 2011-11-19 17:54:22 +0100 Mike Gabriel (687e07b0c) * chown has to be chmod... stupid error... 2011-11-19 17:50:14 +0100 Mike Gabriel (7fb19af29) * add chown a+x for nxagent wrapper script 2011-11-19 17:49:48 +0100 Mike Gabriel (9da568986) * add newline at EOF 2011-11-19 17:44:07 +0100 Mike Gabriel (5a7e3cc13) * Add patch: 005_add_nxagent_wrapper.patch. 2011-11-19 17:40:48 +0100 Mike Gabriel (e60334546) * changelog maintenance 2011-11-19 17:40:33 +0100 Mike Gabriel (1234d1b89) * Add patch: 004_nx-x11-fix-nxcompshad-build.patch. 2011-11-19 17:36:45 +0100 Mike Gabriel (85be77cb3) * Add patch: 003_nxcompshad-gcc43.patch 2011-11-19 17:30:04 +0100 Mike Gabriel (f7e6c45a5) * Add patch: 002_nxcompshad-build-against-nx-x11-only.patch 2011-11-19 17:08:40 +0100 Mike Gabriel (954557e90) * Add main Makefile via patch: 001_add-main-makefile.patch. 2011-11-19 16:43:25 +0100 Mike Gabriel (4076b4132) * Add quilt as build dependency. 2011-11-19 16:10:28 +0100 Mike Gabriel (d03110473) * add /debian folder 2011-11-19 15:59:43 +0100 Mike Gabriel (65f882e05) * Merge branch 'nxproxy' 2011-11-19 15:59:38 +0100 Mike Gabriel (9bfca1c2d) * Merge branch 'nxcompshad' 2011-11-19 15:59:26 +0100 Mike Gabriel (5e502cbb1) * Merge branch 'nxcompext' 2011-11-19 15:59:16 +0100 Mike Gabriel (a48361b11) * Merge branch 'nxcomp' 2011-11-13 09:53:38 +0100 Reinhard Tartler (6dc46faed) * Imported nxproxy-3.5.0-1.tar.gz (tag: nxproxy/3.5.0-1, origin/nxproxy, gh-sunweaver/nxproxy, gh-salva/nxproxy, gh-mjtrangoni/nxproxy, gh-ionic/nxproxy, gh-Ionic/nxproxy, gh-Etersoft/nxproxy) 2011-11-13 09:53:38 +0100 Reinhard Tartler (d83d9f6be) * Imported nxproxy-3.4.0-2.tar.gz (tag: nxproxy/3.4.0-2) 2011-11-13 09:53:38 +0100 Reinhard Tartler (7b07a64ea) * Imported nxproxy-3.3.0-2.tar.gz (tag: nxproxy/3.3.0-2) 2011-11-13 09:53:38 +0100 Reinhard Tartler (131e675bd) * Imported nxproxy-3.2.0-1.tar.gz (tag: nxproxy/3.2.0-1) 2011-11-13 09:53:38 +0100 Reinhard Tartler (d588e1f09) * Imported nxproxy-3.1.0-2.tar.gz (tag: nxproxy/3.1.0-2) 2011-11-13 09:53:38 +0100 Reinhard Tartler (35472e348) * Imported nxproxy-3.0.0-4.tar.gz (tag: nxproxy/3.0.0-4) 2011-11-13 09:53:12 +0100 Reinhard Tartler (bf85c6e69) * Imported nxcompshad-3.5.0-2.tar.gz (tag: nxcompshad/3.5.0-2, origin/nxcompshad, gh-sunweaver/nxcompshad, gh-salva/nxcompshad, gh-mjtrangoni/nxcompshad, gh-ionic/nxcompshad, gh-Ionic/nxcompshad, gh-Etersoft/nxcompshad) 2011-11-13 09:53:12 +0100 Reinhard Tartler (c70adf725) * Imported nxcompshad-3.4.0-3.tar.gz (tag: nxcompshad/3.4.0-3) 2011-11-13 09:53:12 +0100 Reinhard Tartler (2208f4f9e) * Imported nxcompshad-3.4.0-1.tar.gz (tag: nxcompshad/3.4.0-1) 2011-11-13 09:53:12 +0100 Reinhard Tartler (3d8e85c47) * Imported nxcompshad-3.3.0-3.tar.gz (tag: nxcompshad/3.3.0-3) 2011-11-13 09:53:12 +0100 Reinhard Tartler (3b4404668) * Imported nxcompshad-3.3.0-2.tar.gz (tag: nxcompshad/3.3.0-2) 2011-11-13 09:53:12 +0100 Reinhard Tartler (9f7021392) * Imported nxcompshad-3.2.0-3.tar.gz (tag: nxcompshad/3.2.0-3) 2011-11-13 09:53:12 +0100 Reinhard Tartler (c7dc0c3cd) * Imported nxcompshad-3.2.0-1.tar.gz (tag: nxcompshad/3.2.0-1) 2011-11-13 09:53:12 +0100 Reinhard Tartler (8fa612d1a) * Imported nxcompshad-3.1.0-2.tar.gz (tag: nxcompshad/3.1.0-2) 2011-11-13 09:52:38 +0100 Reinhard Tartler (88dace9a9) * Imported nxcompext-3.5.0-1.tar.gz (tag: nxcompext/3.5.0-1, origin/nxcompext, gh-sunweaver/nxcompext, gh-salva/nxcompext, gh-mjtrangoni/nxcompext, gh-ionic/nxcompext, gh-Ionic/nxcompext, gh-Etersoft/nxcompext) 2011-11-13 09:52:38 +0100 Reinhard Tartler (9573b5669) * Imported nxcompext-3.4.0-1.tar.gz (tag: nxcompext/3.4.0-1) 2011-11-13 09:52:38 +0100 Reinhard Tartler (9ea069139) * Imported nxcompext-3.3.0-4.tar.gz (tag: nxcompext/3.3.0-4) 2011-11-13 09:52:38 +0100 Reinhard Tartler (f2f6dab87) * Imported nxcompext-3.3.0-3.tar.gz (tag: nxcompext/3.3.0-3) 2011-11-13 09:52:37 +0100 Reinhard Tartler (abf03fd2c) * Imported nxcompext-3.3.0-2.tar.gz (tag: nxcompext/3.3.0-2) 2011-11-13 09:52:37 +0100 Reinhard Tartler (4ad13f4ef) * Imported nxcompext-3.2.0-1.tar.gz (tag: nxcompext/3.2.0-1) 2011-11-13 09:52:37 +0100 Reinhard Tartler (42e72ef5f) * Imported nxcompext-3.1.0-2.tar.gz (tag: nxcompext/3.1.0-2) 2011-11-13 09:27:53 +0100 Reinhard Tartler (232dfc41d) * Imported nxcomp-3.5.0-2.tar.gz (tag: nxcomp/3.5.0-2, origin/nxcomp, gh-sunweaver/nxcomp, gh-salva/nxcomp, gh-mjtrangoni/nxcomp, gh-ionic/nxcomp, gh-Ionic/nxcomp, gh-Etersoft/nxcomp) 2011-11-13 09:27:53 +0100 Reinhard Tartler (233de71fc) * Imported nxcomp-3.5.0-1.tar.gz (tag: nxcomp/3.5.0-1) 2011-11-13 09:27:53 +0100 Reinhard Tartler (7c9e193ae) * Imported nxcomp-3.4.0-7.tar.gz (tag: nxcomp/3.4.0-7) 2011-11-13 09:27:53 +0100 Reinhard Tartler (477961678) * Imported nxcomp-3.4.0-6.tar.gz (tag: nxcomp/3.4.0-6) 2011-11-13 09:27:52 +0100 Reinhard Tartler (799bf672a) * Imported nxcomp-3.4.0-1.tar.gz (tag: nxcomp/3.4.0-1) 2011-11-13 09:27:52 +0100 Reinhard Tartler (ca416e797) * Imported nxcomp-3.3.0-4.tar.gz (tag: nxcomp/3.3.0-4) 2011-11-13 09:27:52 +0100 Reinhard Tartler (95ce6b74b) * Imported nxcomp-3.3.0-3.tar.gz (tag: nxcomp/3.3.0-3) 2011-11-13 09:27:52 +0100 Reinhard Tartler (920705cf7) * Imported nxcomp-3.2.0-7.tar.gz (tag: nxcomp/3.2.0-7) 2011-11-13 09:27:52 +0100 Reinhard Tartler (92239dafb) * Imported nxcomp-3.2.0-6.tar.gz (tag: nxcomp/3.2.0-6) 2011-11-13 09:27:52 +0100 Reinhard Tartler (d7a8d67d7) * Imported nxcomp-3.1.0-6.tar.gz (tag: nxcomp/3.1.0-6) 2011-11-13 09:27:51 +0100 Reinhard Tartler (3e924126b) * Imported nxcomp-3.1.0-4.tar.gz (tag: nxcomp/3.1.0-4) 2011-10-10 18:03:17 +0200 Reinhard Tartler (9997e13bb) * Merge branch 'nx-X11' 2011-10-10 18:02:52 +0200 Reinhard Tartler (5b4ca0f93) * Merge branch 'nxagent' 2011-10-10 18:02:41 +0200 Reinhard Tartler (e29a11209) * Merge branch 'nxauth' 2011-10-10 17:59:01 +0200 Reinhard Tartler (e01b9177b) * Imported nxagent-3.5.0-5.tar.gz (tag: nxagent/3.5.0-5) 2011-10-10 17:59:00 +0200 Reinhard Tartler (39b738a67) * Imported nxagent-3.5.0-2.tar.gz (tag: nxagent/3.5.0-2) 2011-10-10 17:59:00 +0200 Reinhard Tartler (e6db7e936) * Imported nxagent-3.4.0-9.tar.gz (tag: nxagent/3.4.0-9) 2011-10-10 17:58:59 +0200 Reinhard Tartler (b7494f082) * Imported nxagent-3.4.0-8.tar.gz (tag: nxagent/3.4.0-8) 2011-10-10 17:58:59 +0200 Reinhard Tartler (c07802401) * Imported nxagent-3.4.0-5.tar.gz (tag: nxagent/3.4.0-5) 2011-10-10 17:58:58 +0200 Reinhard Tartler (d30ef0340) * Imported nxagent-3.4.0-3.tar.gz (tag: nxagent/3.4.0-3) 2011-10-10 17:58:57 +0200 Reinhard Tartler (25af86cd3) * Imported nxagent-3.4.0-16.tar.gz (tag: nxagent/3.4.0-16) 2011-10-10 17:58:57 +0200 Reinhard Tartler (e9132da09) * Imported nxagent-3.4.0-11.tar.gz (tag: nxagent/3.4.0-11) 2011-10-10 17:58:56 +0200 Reinhard Tartler (6f5e20bc4) * Imported nxagent-3.3.0-9.tar.gz (tag: nxagent/3.3.0-9) 2011-10-10 17:58:56 +0200 Reinhard Tartler (45b970f25) * Imported nxagent-3.3.0-6.tar.gz (tag: nxagent/3.3.0-6) 2011-10-10 17:58:56 +0200 Reinhard Tartler (229144470) * Imported nxagent-3.3.0-18.tar.gz (tag: nxagent/3.3.0-18) 2011-10-10 17:58:56 +0200 Reinhard Tartler (fc05e5e04) * Imported nxagent-3.3.0-13.tar.gz (tag: nxagent/3.3.0-13) 2011-10-10 17:58:55 +0200 Reinhard Tartler (1a74e0323) * Imported nxagent-3.3.0-10.tar.gz (tag: nxagent/3.3.0-10) 2011-10-10 17:58:55 +0200 Reinhard Tartler (97fe7650e) * Imported nxagent-3.2.0-8.tar.gz (tag: nxagent/3.2.0-8) 2011-10-10 17:58:55 +0200 Reinhard Tartler (c4e7705d2) * Imported nxagent-3.2.0-7.tar.gz (tag: nxagent/3.2.0-7) 2011-10-10 17:58:55 +0200 Reinhard Tartler (c9983230f) * Imported nxagent-3.2.0-6.tar.gz (tag: nxagent/3.2.0-6) 2011-10-10 17:58:55 +0200 Reinhard Tartler (b79164001) * Imported nxagent-3.2.0-5.tar.gz (tag: nxagent/3.2.0-5) 2011-10-10 17:58:31 +0200 Reinhard Tartler (1c25e92b9) * Imported nxagent-3.2.0-10.tar.gz (tag: nxagent/3.2.0-10) 2011-10-10 17:58:31 +0200 Reinhard Tartler (266b55549) * Imported nxagent-3.1.0-7.tar.gz (tag: nxagent/3.1.0-7) 2011-10-10 17:58:31 +0200 Reinhard Tartler (3e7c6697a) * Imported nxagent-3.1.0-6.tar.gz (tag: nxagent/3.1.0-6) 2011-10-10 17:58:30 +0200 Reinhard Tartler (9e3371021) * Imported nxagent-3.1.0-2.tar.gz (tag: nxagent/3.1.0-2) 2011-10-10 17:57:25 +0200 Reinhard Tartler (edddbe876) * creating nxagent 2011-10-10 17:51:57 +0200 Reinhard Tartler (caf1bc41f) * Imported nxauth-3.5.0-1.tar.gz (tag: nxauth/3.5.0-1) 2011-10-10 17:51:57 +0200 Reinhard Tartler (fea16d7bb) * Imported nxauth-3.4.0-3.tar.gz (tag: nxauth/3.4.0-3) 2011-10-10 17:51:57 +0200 Reinhard Tartler (d90fd5d13) * Imported nxauth-3.4.0-2.tar.gz (tag: nxauth/3.4.0-2) 2011-10-10 17:51:57 +0200 Reinhard Tartler (7881dac52) * Imported nxauth-3.4.0-1.tar.gz (tag: nxauth/3.4.0-1) 2011-10-10 17:51:57 +0200 Reinhard Tartler (c76c07835) * Imported nxauth-3.3.0-1.tar.gz (tag: nxauth/3.3.0-1) 2011-10-10 17:51:57 +0200 Reinhard Tartler (76b9f2d91) * Imported nxauth-3.2.0-1.tar.gz (tag: nxauth/3.2.0-1) 2011-10-10 17:51:57 +0200 Reinhard Tartler (9610c1e72) * Imported nxauth-3.1.0-1.tar.gz (tag: nxauth/3.1.0-1) 2011-10-10 17:47:59 +0200 Reinhard Tartler (15cee47a4) * Imported nx-X11-3.5.0-2.tar.gz (tag: nx-X11/3.5.0-2, origin/nx-X11, gh-sunweaver/nx-X11, gh-salva/nx-X11, gh-mjtrangoni/nx-X11, gh-ionic/nx-X11, gh-Ionic/nx-X11, gh-Etersoft/nx-X11) 2011-10-10 17:47:52 +0200 Reinhard Tartler (964f53964) * Imported nx-X11-3.5.0-1.tar.gz (tag: nx-X11/3.5.0-1) 2011-10-10 17:47:50 +0200 Reinhard Tartler (17bae6bff) * Imported nx-X11-3.4.0-4.tar.gz (tag: nx-X11/3.4.0-4) 2011-10-10 17:47:47 +0200 Reinhard Tartler (4fceb197e) * Imported nx-X11-3.4.0-3.tar.gz (tag: nx-X11/3.4.0-3) 2011-10-10 17:47:45 +0200 Reinhard Tartler (3daf6d446) * Imported nx-X11-3.4.0-1.tar.gz (tag: nx-X11/3.4.0-1) 2011-10-10 17:47:42 +0200 Reinhard Tartler (5036ffbe6) * Imported nx-X11-3.3.0-7.tar.gz (tag: nx-X11/3.3.0-7) 2011-10-10 17:47:40 +0200 Reinhard Tartler (bd433c648) * Imported nx-X11-3.3.0-6.tar.gz (tag: nx-X11/3.3.0-6) 2011-10-10 17:47:37 +0200 Reinhard Tartler (55a9311fb) * Imported nx-X11-3.3.0-5.tar.gz (tag: nx-X11/3.3.0-5) 2011-10-10 17:47:35 +0200 Reinhard Tartler (aefdef62f) * Imported nx-X11-3.3.0-4.tar.gz (tag: nx-X11/3.3.0-4) 2011-10-10 17:47:32 +0200 Reinhard Tartler (01ed75712) * Imported nx-X11-3.3.0-3.tar.gz (tag: nx-X11/3.3.0-3) 2011-10-10 17:47:30 +0200 Reinhard Tartler (30463b084) * Imported nx-X11-3.2.0-2.tar.gz (tag: nx-X11/3.2.0-2) 2011-10-10 17:47:28 +0200 Reinhard Tartler (713da2260) * Imported nx-X11-3.2.0-1.tar.gz (tag: nx-X11/3.2.0-1) 2011-10-10 17:46:43 +0200 Reinhard Tartler (3d1c57d5e) * Imported nx-X11-3.1.0-4.tar.gz (tag: nx-X11/3.1.0-4) 2011-10-10 17:46:25 +0200 Reinhard Tartler (844a4094f) * Imported nx-X11-3.1.0-3.tar.gz (tag: nx-X11/3.1.0-3) 2011-10-10 17:43:39 +0200 Reinhard Tartler (f4092abdf) * Imported nx-X11-3.1.0-1.tar.gz (tag: nx-X11/3.1.0-1) 2011-10-10 17:22:20 +0200 Reinhard Tartler (e5c70dac0) * creating nxauth 2011-10-10 15:28:54 +0200 Reinhard Tartler (a840692ed) * creating nx-X11 nx-libs-3.5.99.23/COPYING0000644000000000000000000004310313614532331011343 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. nx-libs-3.5.99.23/doc/libNX_X11/lcUniConv/8bit_tab_to_h.c0000644000000000000000000004117113614532331017276 0ustar /* * Generates an 8-bit character set table from a .TXT table as found on * ftp.unicode.org or from a table containing the 256 Unicode values as * hexadecimal integers. * Examples: * * ./8bit_tab_to_h ISO-8859-1 iso8859_1 < tab8859_1 * ./8bit_tab_to_h ISO-8859-2 iso8859_2 < tab8859_2 * ./8bit_tab_to_h ISO-8859-3 iso8859_3 < tab8859_3 * ./8bit_tab_to_h ISO-8859-4 iso8859_4 < tab8859_4 * ./8bit_tab_to_h ISO-8859-5 iso8859_5 < tab8859_5 * ./8bit_tab_to_h ISO-8859-6 iso8859_6 < tab8859_6 * ./8bit_tab_to_h ISO-8859-7 iso8859_7 < tab8859_7 * ./8bit_tab_to_h ISO-8859-8 iso8859_8 < tab8859_8 * ./8bit_tab_to_h ISO-8859-9 iso8859_9 < tab8859_9 * ./8bit_tab_to_h ISO-8859-10 iso8859_10 < tab8859_10 * ./8bit_tab_to_h ISO-8859-14 iso8859_14 < tab8859_14 * ./8bit_tab_to_h ISO-8859-15 iso8859_15 < tab8859_15 * ./8bit_tab_to_h JISX0201.1976-0 jisx0201 < jis0201 * ./8bit_tab_to_h TIS620-0 tis620 < tabtis620 * ./8bit_tab_to_h KOI8-R koi8_r < tabkoi8_r * ./8bit_tab_to_h KOI8-U koi8_u < tabkoi8_u * ./8bit_tab_to_h ARMSCII-8 armscii_8 < tabarmscii_8 * ./8bit_tab_to_h CP1133 cp1133 < tabibm_cp1133 * ./8bit_tab_to_h MULELAO-1 mulelao < tabmulelao_1 * ./8bit_tab_to_h VISCII1.1-1 viscii1 < tabviscii * ./8bit_tab_to_h TCVN-5712 tcvn < tabtcvn * ./8bit_tab_to_h GEORGIAN-ACADEMY georgian_ac < tabgeorgian_academy * ./8bit_tab_to_h GEORGIAN-PS georgian_ps < tabgeorgian_ps * * ./8bit_tab_to_h ISO-8859-1 iso8859_1 < 8859-1.TXT * ./8bit_tab_to_h ISO-8859-2 iso8859_2 < 8859-2.TXT * ./8bit_tab_to_h ISO-8859-3 iso8859_3 < 8859-3.TXT * ./8bit_tab_to_h ISO-8859-4 iso8859_4 < 8859-4.TXT * ./8bit_tab_to_h ISO-8859-5 iso8859_5 < 8859-5.TXT * ./8bit_tab_to_h ISO-8859-6 iso8859_6 < 8859-6.TXT * ./8bit_tab_to_h ISO-8859-7 iso8859_7 < 8859-7.TXT * ./8bit_tab_to_h ISO-8859-8 iso8859_8 < 8859-8.TXT * ./8bit_tab_to_h ISO-8859-9 iso8859_9 < 8859-9.TXT * ./8bit_tab_to_h ISO-8859-10 iso8859_10 < 8859-10.TXT * ./8bit_tab_to_h ISO-8859-14 iso8859_14 < 8859-14.TXT * ./8bit_tab_to_h ISO-8859-15 iso8859_15 < 8859-15.TXT * ./8bit_tab_to_h JISX0201.1976-0 jisx0201 < JIS0201.TXT * ./8bit_tab_to_h KOI8-R koi8_r < KOI8-R.TXT */ #include #include #include #include int main (int argc, char *argv[]) { const char* charsetname; const char* c_charsetname; const char* filename; const char* directory; int charset2uni[0x100]; if (argc != 3 && argc != 4 && argc != 5) exit(1); charsetname = argv[1]; c_charsetname = argv[2]; if (argc > 3) { filename = argv[3]; } else { char* s = malloc(strlen(c_charsetname)+strlen(".h")+1); strcpy(s,c_charsetname); strcat(s,".h"); filename = s; } directory = (argc > 4 ? argv[4] : ""); fprintf(stderr, "Creating %s%s\n", directory, filename); { int i, c; c = getc(stdin); ungetc(c,stdin); if (c == '#') { /* Read a unicode.org style .TXT file. */ for (i = 0; i < 0x100; i++) charset2uni[i] = 0xfffd; for (;;) { c = getc(stdin); if (c == EOF) break; if (c == '\n' || c == ' ' || c == '\t') continue; if (c == '#') { do { c = getc(stdin); } while (!(c == EOF || c == '\n')); continue; } ungetc(c,stdin); if (scanf("0x%x", &i) != 1 || !(i >= 0 && i < 0x100)) exit(1); do { c = getc(stdin); } while (c == ' ' || c == '\t'); if (c != EOF) ungetc(c,stdin); if (c == '\n' || c == '#') continue; if (scanf("0x%x", &charset2uni[i]) != 1) exit(1); } } else { /* Read a table of hexadecimal Unicode values. */ for (i = 0; i < 0x100; i++) { if (scanf("%x", &charset2uni[i]) != 1) exit(1); if (charset2uni[i] < 0 || charset2uni[i] == 0xffff) charset2uni[i] = 0xfffd; } if (scanf("%x", &i) != EOF) exit(1); } } /* Write the output file. */ { FILE* f; { char* fname = malloc(strlen(directory)+strlen(filename)+1); if (fname == NULL) { printf("malloc failed\n"); exit(1); } strcpy(fname,directory); strcat(fname,filename); f = fopen(fname,"w"); if (f == NULL) { free(fname); exit(1); } } fprintf(f, "\n"); fprintf(f, "/*\n"); fprintf(f, " * %s\n", charsetname); fprintf(f, " */\n"); fprintf(f, "\n"); { int i, i1, i2, i3; int line[16]; int tableno; struct { int minline; int maxline; } tables[16]; bool some_invalid; bool final_ret_reached; for (i1 = 0; i1 < 16; i1++) { bool all_invalid = true; bool all_identity = true; for (i2 = 0; i2 < 16; i2++) { i = 16*i1+i2; if (charset2uni[i] != 0xfffd) all_invalid = false; if (charset2uni[i] != i) all_identity = false; } if (all_invalid) line[i1] = -2; else if (all_identity) line[i1] = -1; else line[i1] = 0; } tableno = 0; for (i1 = 0; i1 < 16; i1++) { if (line[i1] >= 0) { if (i1 > 0 && tableno > 0 && line[i1-1] == tableno-1) { line[i1] = tableno-1; tables[tableno-1].maxline = i1; } else { tableno++; line[i1] = tableno-1; tables[tableno-1].minline = tables[tableno-1].maxline = i1; } } } some_invalid = false; for (i = 0; i < 0x100; i++) if (charset2uni[i] == 0xfffd) some_invalid = true; if (tableno > 0) { int t; for (t = 0; t < tableno; t++) { fprintf(f, "static const unsigned short %s_2uni", c_charsetname); if (tableno > 1) fprintf(f, "_%d", t+1); fprintf(f, "[%d] = {\n", 16*(tables[t].maxline-tables[t].minline+1)); for (i1 = tables[t].minline; i1 <= tables[t].maxline; i1++) { fprintf(f, " /* 0x%02x */\n", 16*i1); for (i2 = 0; i2 < 2; i2++) { fprintf(f, " "); for (i3 = 0; i3 < 8; i3++) { i = 16*i1+8*i2+i3; fprintf(f, " 0x%04x,", charset2uni[i]); } fprintf(f, "\n"); } } fprintf(f, "};\n"); } fprintf(f, "\n"); } final_ret_reached = false; fprintf(f, "static int\n%s_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)\n", c_charsetname); fprintf(f, "{\n"); fprintf(f, " unsigned char c = *s;\n"); if (some_invalid) { for (i1 = 0; i1 < 16;) { int t = line[i1]; const char* indent; for (i2 = i1; i2 < 16 && line[i2] == t; i2++); indent = (i1 == 0 && i2 == 16 ? " " : " "); if (i1 == 0) { if (i2 == 16) { } else { fprintf(f, " if (c < 0x%02x) {\n", 16*i2); } } else { if (i2 == 16) { fprintf(f, " else {\n"); } else { fprintf(f, " else if (c < 0x%02x) {\n", 16*i2); } } if (t == -2) { final_ret_reached = true; } else if (t == -1) { fprintf(f, "%s*pwc = (ucs4_t) c;\n", indent); fprintf(f, "%sreturn 1;\n", indent); } else { fprintf(f, "%s", indent); some_invalid = false; for (i = 16*i1; i < 16*i2; i++) if (charset2uni[i] == 0xfffd) some_invalid = true; if (some_invalid) fprintf(f, "unsigned short wc = "); else fprintf(f, "*pwc = (ucs4_t) "); fprintf(f, "%s_2uni", c_charsetname); if (tableno > 1) fprintf(f, "_%d", t+1); fprintf(f, "[c"); if (tables[t].minline > 0) fprintf(f, "-0x%02x", 16*tables[t].minline); fprintf(f, "];\n"); if (some_invalid) { fprintf(f, "%sif (wc != 0xfffd) {\n", indent); fprintf(f, "%s *pwc = (ucs4_t) wc;\n", indent); fprintf(f, "%s return 1;\n", indent); fprintf(f, "%s}\n", indent); final_ret_reached = true; } else { fprintf(f, "%sreturn 1;\n", indent); } } if (!(i1 == 0 && i2 == 16)) fprintf(f, " }\n"); i1 = i2; } if (final_ret_reached) fprintf(f, " return RET_ILSEQ;\n"); } else { for (i1 = 0; i1 < 16;) { int t = line[i1]; for (i2 = i1; i2 < 16 && line[i2] == t; i2++); if (i1 == 0) { if (i2 == 16) { fprintf(f, " "); } else { fprintf(f, " if (c < 0x%02x)\n ", 16*i2); } } else { if (i2 == 16) { fprintf(f, " else\n "); } else { fprintf(f, " else if (c < 0x%02x)\n ", 16*i2); } } if (t == -1) fprintf(f, "*pwc = (ucs4_t) c;\n"); else { fprintf(f, "*pwc = (ucs4_t) %s_2uni", c_charsetname); if (tableno > 1) fprintf(f, "_%d", t+1); fprintf(f, "[c"); if (tables[t].minline > 0) fprintf(f, "-0x%02x", 16*tables[t].minline); fprintf(f, "];\n"); } i1 = i2; } fprintf(f, " return 1;\n"); } fprintf(f, "}\n"); } fprintf(f, "\n"); { int uni2charset[0x10000]; bool pages[0x100]; int line[0x2000]; int tableno; struct { int minline; int maxline; int usecount; const char* suffix; } tables[0x2000]; bool need_c; bool fix_0000; int i, j, p, j1, j2, t; for (j = 0; j < 0x10000; j++) uni2charset[j] = 0; for (p = 0; p < 0x100; p++) pages[p] = false; for (i = 0; i < 0x100; i++) { j = charset2uni[i]; if (j != 0xfffd) { uni2charset[j] = i; pages[j>>8] = true; } } for (j1 = 0; j1 < 0x2000; j1++) { bool all_invalid = true; bool all_identity = true; for (j2 = 0; j2 < 8; j2++) { j = 8*j1+j2; if (uni2charset[j] != 0) all_invalid = false; if (uni2charset[j] != j) all_identity = false; } if (all_invalid) line[j1] = -2; else if (all_identity) line[j1] = -1; else line[j1] = 0; } tableno = 0; for (j1 = 0; j1 < 0x2000; j1++) { if (line[j1] >= 0) { if (tableno > 0 && ((j1 > 0 && line[j1-1] == tableno-1) || ((tables[tableno-1].maxline >> 5) == (j1 >> 5) && j1 - tables[tableno-1].maxline <= 8))) { line[j1] = tableno-1; tables[tableno-1].maxline = j1; } else { tableno++; line[j1] = tableno-1; tables[tableno-1].minline = tables[tableno-1].maxline = j1; } } } for (t = 0; t < tableno; t++) { tables[t].usecount = 0; j1 = 8*tables[t].minline; j2 = 8*(tables[t].maxline+1); for (j = j1; j < j2; j++) if (uni2charset[j] != 0) tables[t].usecount++; } for (t = 0, p = -1, i = 0; t < tableno; t++) { if (tables[t].usecount > 1) { char* s; if (p == tables[t].minline >> 5) { s = malloc(5+1); sprintf(s, "%02x_%d", p, ++i); } else { p = tables[t].minline >> 5; s = malloc(2+1); sprintf(s, "%02x", p); } tables[t].suffix = s; } else tables[t].suffix = NULL; } { p = -1; for (t = 0; t < tableno; t++) if (tables[t].usecount > 1) { p = 0; fprintf(f, "static const unsigned char %s_page%s[%d] = {\n", c_charsetname, tables[t].suffix, 8*(tables[t].maxline-tables[t].minline+1)); for (j1 = tables[t].minline; j1 <= tables[t].maxline; j1++) { if ((j1 % 0x20) == 0 && j1 > tables[t].minline) fprintf(f, " /* 0x%04x */\n", 8*j1); fprintf(f, " "); for (j2 = 0; j2 < 8; j2++) { j = 8*j1+j2; fprintf(f, " 0x%02x,", uni2charset[j]); } fprintf(f, " /* 0x%02x-0x%02x */\n", 8*(j1 % 0x20), 8*(j1 % 0x20)+7); } fprintf(f, "};\n"); } if (p >= 0) fprintf(f, "\n"); } need_c = false; for (j1 = 0; j1 < 0x2000;) { t = line[j1]; for (j2 = j1; j2 < 0x2000 && line[j2] == t; j2++); if (t >= 0) j2 = tables[t].maxline+1; if (!(t == -2 || (t == -1 && j1 == 0))) need_c = true; j1 = j2; } fix_0000 = false; fprintf(f, "static int\n%s_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)\n", c_charsetname); fprintf(f, "{\n"); if (need_c) fprintf(f, " unsigned char c = 0;\n"); for (j1 = 0; j1 < 0x2000;) { t = line[j1]; for (j2 = j1; j2 < 0x2000 && line[j2] == t; j2++); if (t >= 0) { if (j1 != tables[t].minline) abort(); if (j2 > tables[t].maxline+1) abort(); j2 = tables[t].maxline+1; } if (t == -2) { } else { if (j1 == 0) fprintf(f, " "); else fprintf(f, " else "); if (t >= 0 && tables[t].usecount == 0) abort(); if (t >= 0 && tables[t].usecount == 1) { if (j2 != j1+1) abort(); for (j = 8*j1; j < 8*j2; j++) if (uni2charset[j] != 0) { fprintf(f, "if (wc == 0x%04x)\n c = 0x%02x;\n", j, uni2charset[j]); break; } } else { if (j1 == 0) { fprintf(f, "if (wc < 0x%04x)", 8*j2); } else { fprintf(f, "if (wc >= 0x%04x && wc < 0x%04x)", 8*j1, 8*j2); } if (t == -1) { if (j1 == 0) /* If wc == 0, the function must return 1, not -1. */ fprintf(f, " {\n *r = wc;\n return 1;\n }\n"); else fprintf(f, "\n c = wc;\n"); } else { fprintf(f, "\n c = %s_page%s[wc", c_charsetname, tables[t].suffix); if (tables[t].minline > 0) fprintf(f, "-0x%04x", 8*j1); fprintf(f, "];\n"); if (j1 == 0 && uni2charset[0] == 0) /* If wc == 0, the function must return 1, not -1. */ fix_0000 = true; } } } j1 = j2; } if (need_c) { if (fix_0000) fprintf(f, " if (c != 0 || wc == 0) {\n"); else fprintf(f, " if (c != 0) {\n"); fprintf(f, " *r = c;\n"); fprintf(f, " return 1;\n"); fprintf(f, " }\n"); } fprintf(f, " return RET_ILSEQ;\n"); fprintf(f, "}\n"); } if (ferror(f) || fclose(f)) exit(1); } #if 0 int i1, i2, i3, i1_min, i1_max, j1, j2; i1_min = 16; i1_max = -1; for (i1 = 0; i1 < 16; i1++) for (i2 = 0; i2 < 16; i2++) if (charset2uni[16*i1+i2] != 0xfffd) { if (i1_min > i1) i1_min = i1; if (i1_max < i1) i1_max = i1; } printf("static const unsigned short %s_2uni[%d] = {\n", name, 16*(i1_max-i1_min+1)); for (i1 = i1_min; i1 <= i1_max; i1++) { printf(" /""* 0x%02x *""/\n", 16*i1); for (i2 = 0; i2 < 2; i2++) { printf(" "); for (i3 = 0; i3 < 8; i3++) { if (i3 > 0) printf(" "); printf("0x%04x,", charset2uni[16*i1+8*i2+i3]); } printf("\n"); } } printf("};\n"); printf("\n"); for (p = 0; p < 0x100; p++) pages[p] = 0; for (i = 0; i < 0x100; i++) if (charset2uni[i] != 0xfffd) pages[charset2uni[i]>>8] = 1; for (p = 0; p < 0x100; p++) if (pages[p]) { int j1_min = 32; int j1_max = -1; for (j1 = 0; j1 < 32; j1++) for (j2 = 0; j2 < 8; j2++) if (uni2charset[256*p+8*j1+j2] != 0) { if (j1_min > j1) j1_min = j1; if (j1_max < j1) j1_max = j1; } printf("static const unsigned char %s_page%02x[%d] = {\n", name, p, 8*(j1_max-j1_min+1)); for (j1 = j1_min; j1 <= j1_max; j1++) { printf(" "); for (j2 = 0; j2 < 8; j2++) printf("0x%02x, ", uni2charset[256*p+8*j1+j2]); printf("/""* 0x%02x-0x%02x *""/\n", 8*j1, 8*j1+7); } printf("};\n"); } printf("\n"); } #endif exit(0); } nx-libs-3.5.99.23/doc/libNX_X11/lcUniConv/cjk_tab_to_h.c0000644000000000000000000007443213614532331017205 0ustar /* * Generates a CJK character set table from a .TXT table as found on * ftp.unicode.org or in the X nls directory. * Examples: * * ./cjk_tab_to_h GB2312.1980-0 gb2312 > gb2312.h < gb2312 * ./cjk_tab_to_h JISX0208.1983-0 jisx0208 > jisx0208.h < jis0208 * ./cjk_tab_to_h KSC5601.1987-0 ksc5601 > ksc5601.h < ksc5601 * * ./cjk_tab_to_h GB2312.1980-0 gb2312 > gb2312.h < GB2312.TXT * ./cjk_tab_to_h JISX0208.1983-0 jisx0208 > jisx0208.h < JIS0208.TXT * ./cjk_tab_to_h JISX0212.1990-0 jisx0212 > jisx0212.h < JIS0212.TXT * ./cjk_tab_to_h KSC5601.1987-0 ksc5601 > ksc5601.h < KSC5601.TXT * ./cjk_tab_to_h KSX1001.1992-0 ksc5601 > ksc5601.h < KSX1001.TXT * * ./cjk_tab_to_h BIG5 big5 > big5.h < BIG5.TXT * * ./cjk_tab_to_h JOHAB johab > johab.h < JOHAB.TXT * * ./cjk_tab_to_h BIG5HKSCS-0 big5hkscs >big5hkscs.h < BIG5HKSCS.TXT */ #include #include #include #include typedef struct { int start; int end; } Block; typedef struct { int rows; /* number of possible values for the 1st byte */ int cols; /* number of possible values for the 2nd byte */ int (*row_byte) (int row); /* returns the 1st byte value for a given row */ int (*col_byte) (int col); /* returns the 2nd byte value for a given col */ int (*byte_row) (int byte); /* converts a 1st byte value to a row, else -1 */ int (*byte_col) (int byte); /* converts a 2nd byte value to a col, else -1 */ const char* check_row_expr; /* format string for 1st byte value checking */ const char* check_col_expr; /* format string for 2nd byte value checking */ const char* byte_row_expr; /* format string for 1st byte value to row */ const char* byte_col_expr; /* format string for 2nd byte value to col */ int** charset2uni; /* charset2uni[0..rows-1][0..cols-1] is valid */ /* You'll understand the terms "row" and "col" when you buy Ken Lunde's book. Once a row is fixed, choosing a "col" is the same as choosing a "cell". */ int* charsetpage; /* charsetpage[0..rows]: how large is a page for a row */ int ncharsetblocks; Block* charsetblocks; /* blocks[0..nblocks-1] */ int* uni2charset; /* uni2charset[0x0000..0xffff] */ } Encoding; /* * Outputs the file title. */ static void output_title (const char *charsetname) { printf("\n"); printf("/*\n"); printf(" * %s\n", charsetname); printf(" */\n"); printf("\n"); } /* * Reads the charset2uni table from standard input. */ static void read_table (Encoding* enc) { int row, col, i, i1, i2, c, j; enc->charset2uni = malloc(enc->rows*sizeof(int*)); for (row = 0; row < enc->rows; row++) enc->charset2uni[row] = malloc(enc->cols*sizeof(int)); for (row = 0; row < enc->rows; row++) for (col = 0; col < enc->cols; col++) enc->charset2uni[row][col] = 0xfffd; c = getc(stdin); ungetc(c,stdin); if (c == '#') { /* Read a unicode.org style .TXT file. */ for (;;) { c = getc(stdin); if (c == EOF) break; if (c == '\n' || c == ' ' || c == '\t') continue; if (c == '#') { do { c = getc(stdin); } while (!(c == EOF || c == '\n')); continue; } ungetc(c,stdin); if (scanf("0x%x", &j) != 1) exit(1); i1 = j >> 8; i2 = j & 0xff; row = enc->byte_row(i1); col = enc->byte_col(i2); if (row < 0 || col < 0) { fprintf(stderr, "lost entry for %02x %02x\n", i1, i2); exit(1); } if (scanf(" 0x%x", &enc->charset2uni[row][col]) != 1) exit(1); } } else { /* Read a table of hexadecimal Unicode values. */ for (i1 = 32; i1 < 132; i1++) for (i2 = 32; i2 < 132; i2++) { i = scanf("%x", &j); if (i == EOF) goto read_done; if (i != 1) exit(1); if (j < 0 || j == 0xffff) j = 0xfffd; if (j != 0xfffd) { if (enc->byte_row(i1) < 0 || enc->byte_col(i2) < 0) { fprintf(stderr, "lost entry at %02x %02x\n", i1, i2); exit (1); } enc->charset2uni[enc->byte_row(i1)][enc->byte_col(i2)] = j; } } read_done: ; } } /* * Computes the charsetpage[0..rows] array. */ static void find_charset2uni_pages (Encoding* enc) { int row, col; enc->charsetpage = malloc((enc->rows+1)*sizeof(int)); for (row = 0; row <= enc->rows; row++) enc->charsetpage[row] = 0; for (row = 0; row < enc->rows; row++) { int used = 0; for (col = 0; col < enc->cols; col++) if (enc->charset2uni[row][col] != 0xfffd) used = col+1; enc->charsetpage[row] = used; } } /* * Fills in nblocks and blocks. */ static void find_charset2uni_blocks (Encoding* enc) { int n, row, lastrow; enc->charsetblocks = malloc(enc->rows*sizeof(Block)); n = 0; for (row = 0; row < enc->rows; row++) if (enc->charsetpage[row] > 0 && (row == 0 || enc->charsetpage[row-1] == 0)) { for (lastrow = row; enc->charsetpage[lastrow+1] > 0; lastrow++); enc->charsetblocks[n].start = row * enc->cols; enc->charsetblocks[n].end = lastrow * enc->cols + enc->charsetpage[lastrow]; n++; } enc->ncharsetblocks = n; } /* * Outputs the charset to unicode table and function. */ static void output_charset2uni (const char* name, Encoding* enc) { int row, col, lastrow, col_max, i, i1_min, i1_max; find_charset2uni_pages(enc); find_charset2uni_blocks(enc); for (row = 0; row < enc->rows; row++) if (enc->charsetpage[row] > 0) { if (row == 0 || enc->charsetpage[row-1] == 0) { /* Start a new block. */ for (lastrow = row; enc->charsetpage[lastrow+1] > 0; lastrow++); printf("static const unsigned short %s_2uni_page%02x[%d] = {\n", name, enc->row_byte(row), (lastrow-row) * enc->cols + enc->charsetpage[lastrow]); } printf(" /""* 0x%02x *""/\n ", enc->row_byte(row)); col_max = (enc->charsetpage[row+1] > 0 ? enc->cols : enc->charsetpage[row]); for (col = 0; col < col_max; col++) { printf(" 0x%04x,", enc->charset2uni[row][col]); if ((col % 8) == 7 && (col+1 < col_max)) printf("\n "); } printf("\n"); if (enc->charsetpage[row+1] == 0) { /* End a block. */ printf("};\n"); } } printf("\n"); printf("static int\n"); printf("%s_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)\n", name); printf("{\n"); printf(" unsigned char c1 = s[0];\n"); printf(" if ("); for (i = 0; i < enc->ncharsetblocks; i++) { i1_min = enc->row_byte(enc->charsetblocks[i].start / enc->cols); i1_max = enc->row_byte((enc->charsetblocks[i].end-1) / enc->cols); if (i > 0) printf(" || "); if (i1_min == i1_max) printf("(c1 == 0x%02x)", i1_min); else printf("(c1 >= 0x%02x && c1 <= 0x%02x)", i1_min, i1_max); } printf(") {\n"); printf(" if (n >= 2) {\n"); printf(" unsigned char c2 = s[1];\n"); printf(" if ("); printf(enc->check_col_expr, "c2"); printf(") {\n"); printf(" unsigned int i = %d * (", enc->cols); printf(enc->byte_row_expr, "c1"); printf(") + ("); printf(enc->byte_col_expr, "c2"); printf(");\n"); printf(" unsigned short wc = 0xfffd;\n"); for (i = 0; i < enc->ncharsetblocks; i++) { printf(" "); if (i > 0) printf("} else "); if (i < enc->ncharsetblocks-1) printf("if (i < %d) ", enc->charsetblocks[i+1].start); printf("{\n"); printf(" if (i < %d)\n", enc->charsetblocks[i].end); printf(" wc = %s_2uni_page%02x[i", name, enc->row_byte(enc->charsetblocks[i].start / enc->cols)); if (enc->charsetblocks[i].start > 0) printf("-%d", enc->charsetblocks[i].start); printf("];\n"); } printf(" }\n"); printf(" if (wc != 0xfffd) {\n"); printf(" *pwc = (ucs4_t) wc;\n"); printf(" return 2;\n"); printf(" }\n"); printf(" }\n"); printf(" return RET_ILSEQ;\n"); printf(" }\n"); printf(" return RET_TOOFEW(0);\n"); printf(" }\n"); printf(" return RET_ILSEQ;\n"); printf("}\n"); printf("\n"); } /* * Computes the uni2charset[0x0000..0xffff] array. */ static void invert (Encoding* enc) { int row, col, j; enc->uni2charset = malloc(0x10000*sizeof(int)); for (j = 0; j < 0x10000; j++) enc->uni2charset[j] = 0; for (row = 0; row < enc->rows; row++) for (col = 0; col < enc->cols; col++) { j = enc->charset2uni[row][col]; if (j != 0xfffd) enc->uni2charset[j] = 0x100 * enc->row_byte(row) + enc->col_byte(col); } } /* * Outputs the unicode to charset table and function, using a linear array. * (Suitable if the table is dense.) */ static void output_uni2charset_dense (const char* name, Encoding* enc) { /* Like in 8bit_tab_to_h.c */ bool pages[0x100]; int line[0x2000]; int tableno; struct { int minline; int maxline; int usecount; } tables[0x2000]; bool first; int row, col, j, p, j1, j2, t; for (p = 0; p < 0x100; p++) pages[p] = false; for (row = 0; row < enc->rows; row++) for (col = 0; col < enc->cols; col++) { j = enc->charset2uni[row][col]; if (j != 0xfffd) pages[j>>8] = true; } for (j1 = 0; j1 < 0x2000; j1++) { bool all_invalid = true; for (j2 = 0; j2 < 8; j2++) { j = 8*j1+j2; if (enc->uni2charset[j] != 0) all_invalid = false; } if (all_invalid) line[j1] = -1; else line[j1] = 0; } tableno = 0; for (j1 = 0; j1 < 0x2000; j1++) { if (line[j1] >= 0) { if (tableno > 0 && ((j1 > 0 && line[j1-1] == tableno-1) || ((tables[tableno-1].maxline >> 5) == (j1 >> 5) && j1 - tables[tableno-1].maxline <= 8))) { line[j1] = tableno-1; tables[tableno-1].maxline = j1; } else { tableno++; line[j1] = tableno-1; tables[tableno-1].minline = tables[tableno-1].maxline = j1; } } } for (t = 0; t < tableno; t++) { tables[t].usecount = 0; j1 = 8*tables[t].minline; j2 = 8*(tables[t].maxline+1); for (j = j1; j < j2; j++) if (enc->uni2charset[j] != 0) tables[t].usecount++; } { p = -1; for (t = 0; t < tableno; t++) if (tables[t].usecount > 1) { p = tables[t].minline >> 5; printf("static const unsigned short %s_page%02x[%d] = {\n", name, p, 8*(tables[t].maxline-tables[t].minline+1)); for (j1 = tables[t].minline; j1 <= tables[t].maxline; j1++) { if ((j1 % 0x20) == 0 && j1 > tables[t].minline) printf(" /* 0x%04x */\n", 8*j1); printf(" "); for (j2 = 0; j2 < 8; j2++) { j = 8*j1+j2; printf(" 0x%04x,", enc->uni2charset[j]); } printf(" /*0x%02x-0x%02x*/\n", 8*(j1 % 0x20), 8*(j1 % 0x20)+7); } printf("};\n"); } if (p >= 0) printf("\n"); } printf("static int\n%s_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)\n", name); printf("{\n"); printf(" if (n >= 2) {\n"); printf(" unsigned short c = 0;\n"); first = true; for (j1 = 0; j1 < 0x2000;) { t = line[j1]; for (j2 = j1; j2 < 0x2000 && line[j2] == t; j2++); if (t >= 0) { if (j1 != tables[t].minline) abort(); if (j2 > tables[t].maxline+1) abort(); j2 = tables[t].maxline+1; if (first) printf(" "); else printf(" else "); first = false; if (tables[t].usecount == 0) abort(); if (tables[t].usecount == 1) { if (j2 != j1+1) abort(); for (j = 8*j1; j < 8*j2; j++) if (enc->uni2charset[j] != 0) { printf("if (wc == 0x%04x)\n c = 0x%02x;\n", j, enc->uni2charset[j]); break; } } else { if (j1 == 0) { printf("if (wc < 0x%04x)", 8*j2); } else { printf("if (wc >= 0x%04x && wc < 0x%04x)", 8*j1, 8*j2); } printf("\n c = %s_page%02x[wc", name, j1 >> 5); if (tables[t].minline > 0) printf("-0x%04x", 8*j1); printf("];\n"); } } j1 = j2; } printf(" if (c != 0) {\n"); printf(" r[0] = (c >> 8); r[1] = (c & 0xff);\n"); printf(" return 2;\n"); printf(" }\n"); printf(" return RET_ILSEQ;\n"); printf(" }\n"); printf(" return RET_TOOSMALL;\n"); printf("}\n"); } /* * Outputs the unicode to charset table and function, using a packed array. * (Suitable if the table is sparse.) */ static void output_uni2charset_sparse (const char* name, Encoding* enc) { bool pages[0x100]; Block pageblocks[0x100]; int npageblocks; int indx2charset[0x10000]; int summary_indx[0x1000]; int summary_used[0x1000]; int i, row, col, j, p, j1, j2, indx; /* Fill pages[0x100]. */ for (p = 0; p < 0x100; p++) pages[p] = false; for (row = 0; row < enc->rows; row++) for (col = 0; col < enc->cols; col++) { j = enc->charset2uni[row][col]; if (j != 0xfffd) pages[j>>8] = true; } #if 0 for (p = 0; p < 0x100; p++) if (pages[p]) { printf("static const unsigned short %s_page%02x[256] = {\n", name, p); for (j1 = 0; j1 < 32; j1++) { printf(" "); for (j2 = 0; j2 < 8; j2++) printf("0x%04x, ", enc->uni2charset[256*p+8*j1+j2]); printf("/""*0x%02x-0x%02x*""/\n", 8*j1, 8*j1+7); } printf("};\n"); } printf("\n"); #endif /* Fill summary_indx[] and summary_used[]. */ indx = 0; for (j1 = 0; j1 < 0x1000; j1++) { summary_indx[j1] = indx; summary_used[j1] = 0; for (j2 = 0; j2 < 16; j2++) { j = 16*j1+j2; if (enc->uni2charset[j] != 0) { indx2charset[indx++] = enc->uni2charset[j]; summary_used[j1] |= (1 << j2); } } } /* Fill npageblocks and pageblocks[]. */ npageblocks = 0; for (p = 0; p < 0x100; ) { if (pages[p] && (p == 0 || !pages[p-1])) { pageblocks[npageblocks].start = 16*p; do p++; while (p < 0x100 && pages[p]); j1 = 16*p; while (summary_used[j1-1] == 0) j1--; pageblocks[npageblocks].end = j1; npageblocks++; } else p++; } printf("static const unsigned short %s_2charset[%d] = {\n", name, indx); for (i = 0; i < indx; ) { if ((i % 8) == 0) printf(" "); printf(" 0x%04x,", indx2charset[i]); i++; if ((i % 8) == 0 || i == indx) printf("\n"); } printf("};\n"); printf("\n"); for (i = 0; i < npageblocks; i++) { printf("static const Summary16 %s_uni2indx_page%02x[%d] = {\n", name, pageblocks[i].start/16, pageblocks[i].end-pageblocks[i].start); for (j1 = pageblocks[i].start; j1 < pageblocks[i].end; ) { if (((16*j1) % 0x100) == 0) printf(" /""* 0x%04x *""/\n", 16*j1); if ((j1 % 4) == 0) printf(" "); printf(" { %4d, 0x%04x },", summary_indx[j1], summary_used[j1]); j1++; if ((j1 % 4) == 0 || j1 == pageblocks[i].end) printf("\n"); } printf("};\n"); } printf("\n"); printf("static int\n"); printf("%s_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)\n", name); printf("{\n"); printf(" if (n >= 2) {\n"); printf(" const Summary16 *summary = NULL;\n"); for (i = 0; i < npageblocks; i++) { printf(" "); if (i > 0) printf("else "); printf("if (wc >= 0x%04x && wc < 0x%04x)\n", 16*pageblocks[i].start, 16*pageblocks[i].end); printf(" summary = &%s_uni2indx_page%02x[(wc>>4)", name, pageblocks[i].start/16); if (pageblocks[i].start > 0) printf("-0x%03x", pageblocks[i].start); printf("];\n"); } printf(" if (summary) {\n"); printf(" unsigned short used = summary->used;\n"); printf(" unsigned int i = wc & 0x0f;\n"); printf(" if (used & ((unsigned short) 1 << i)) {\n"); printf(" unsigned short c;\n"); printf(" /* Keep in `used' only the bits 0..i-1. */\n"); printf(" used &= ((unsigned short) 1 << i) - 1;\n"); printf(" /* Add `summary->indx' and the number of bits set in `used'. */\n"); printf(" used = (used & 0x5555) + ((used & 0xaaaa) >> 1);\n"); printf(" used = (used & 0x3333) + ((used & 0xcccc) >> 2);\n"); printf(" used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4);\n"); printf(" used = (used & 0x00ff) + (used >> 8);\n"); printf(" c = %s_2charset[summary->indx + used];\n", name); printf(" r[0] = (c >> 8); r[1] = (c & 0xff);\n"); printf(" return 2;\n"); printf(" }\n"); printf(" }\n"); printf(" return RET_ILSEQ;\n"); printf(" }\n"); printf(" return RET_TOOSMALL;\n"); printf("}\n"); } /* ISO-2022/EUC specifics */ static int row_byte_normal (int row) { return 0x21+row; } static int col_byte_normal (int col) { return 0x21+col; } static int byte_row_normal (int byte) { return byte-0x21; } static int byte_col_normal (int byte) { return byte-0x21; } static void do_normal (const char* name) { Encoding enc; enc.rows = 94; enc.cols = 94; enc.row_byte = row_byte_normal; enc.col_byte = col_byte_normal; enc.byte_row = byte_row_normal; enc.byte_col = byte_col_normal; enc.check_row_expr = "%1$s >= 0x21 && %1$s < 0x7f"; enc.check_col_expr = "%1$s >= 0x21 && %1$s < 0x7f"; enc.byte_row_expr = "%1$s - 0x21"; enc.byte_col_expr = "%1$s - 0x21"; read_table(&enc); output_charset2uni(name,&enc); invert(&enc); output_uni2charset_sparse(name,&enc); } /* Note: On first sight, the jisx0212_2charset[] table seems to be in order, starting from the charset=0x3021/uni=0x4e02 pair. But it's only mostly in order. There are 75 out-of-order values, scattered all throughout the table. */ static void do_normal_only_charset2uni (const char* name) { Encoding enc; enc.rows = 94; enc.cols = 94; enc.row_byte = row_byte_normal; enc.col_byte = col_byte_normal; enc.byte_row = byte_row_normal; enc.byte_col = byte_col_normal; enc.check_row_expr = "%1$s >= 0x21 && %1$s < 0x7f"; enc.check_col_expr = "%1$s >= 0x21 && %1$s < 0x7f"; enc.byte_row_expr = "%1$s - 0x21"; enc.byte_col_expr = "%1$s - 0x21"; read_table(&enc); output_charset2uni(name,&enc); } /* CNS 11643 specifics - trick to put two tables into one */ static int row_byte_cns11643 (int row) { return 0x100 * (row / 94) + (row % 94) + 0x21; } static int byte_row_cns11643 (int byte) { return (byte >= 0x100 && byte < 0x200 ? byte-0x121 : byte >= 0x200 && byte < 0x300 ? byte-0x221+94 : byte >= 0x300 && byte < 0x400 ? byte-0x321+2*94 : -1); } static void do_cns11643_only_uni2charset (const char* name) { Encoding enc; int j, x; enc.rows = 3*94; enc.cols = 94; enc.row_byte = row_byte_cns11643; enc.col_byte = col_byte_normal; enc.byte_row = byte_row_cns11643; enc.byte_col = byte_col_normal; enc.check_row_expr = "%1$s >= 0x21 && %1$s < 0x7f"; enc.check_col_expr = "%1$s >= 0x21 && %1$s < 0x7f"; enc.byte_row_expr = "%1$s - 0x21"; enc.byte_col_expr = "%1$s - 0x21"; read_table(&enc); invert(&enc); /* Move the 2 plane bits into the unused bits 15 and 7. */ for (j = 0; j < 0x10000; j++) { x = enc.uni2charset[j]; if (x != 0) { if (x & 0x8080) abort(); switch (x >> 16) { case 0: /* plane 1 */ x = (x & 0xffff) | 0x0000; break; case 1: /* plane 2 */ x = (x & 0xffff) | 0x0080; break; case 2: /* plane 3 */ x = (x & 0xffff) | 0x8000; break; default: abort(); } enc.uni2charset[j] = x; } } output_uni2charset_sparse(name,&enc); } /* GBK specifics */ static int row_byte_gbk1 (int row) { return 0x81+row; } static int col_byte_gbk1 (int col) { return (col >= 0x3f ? 0x41 : 0x40) + col; } static int byte_row_gbk1 (int byte) { if (byte >= 0x81 && byte < 0xff) return byte-0x81; else return -1; } static int byte_col_gbk1 (int byte) { if (byte >= 0x40 && byte < 0x7f) return byte-0x40; else if (byte >= 0x80 && byte < 0xff) return byte-0x41; else return -1; } static void do_gbk1 (const char* name) { Encoding enc; enc.rows = 126; enc.cols = 190; enc.row_byte = row_byte_gbk1; enc.col_byte = col_byte_gbk1; enc.byte_row = byte_row_gbk1; enc.byte_col = byte_col_gbk1; enc.check_row_expr = "%1$s >= 0x81 && %1$s < 0xff"; enc.check_col_expr = "(%1$s >= 0x40 && %1$s < 0x7f) || (%1$s >= 0x80 && %1$s < 0xff)"; enc.byte_row_expr = "%1$s - 0x81"; enc.byte_col_expr = "%1$s - (%1$s >= 0x80 ? 0x41 : 0x40)"; read_table(&enc); output_charset2uni(name,&enc); invert(&enc); output_uni2charset_dense(name,&enc); } static void do_gbk1_only_charset2uni (const char* name) { Encoding enc; enc.rows = 126; enc.cols = 190; enc.row_byte = row_byte_gbk1; enc.col_byte = col_byte_gbk1; enc.byte_row = byte_row_gbk1; enc.byte_col = byte_col_gbk1; enc.check_row_expr = "%1$s >= 0x81 && %1$s < 0xff"; enc.check_col_expr = "(%1$s >= 0x40 && %1$s < 0x7f) || (%1$s >= 0x80 && %1$s < 0xff)"; enc.byte_row_expr = "%1$s - 0x81"; enc.byte_col_expr = "%1$s - (%1$s >= 0x80 ? 0x41 : 0x40)"; read_table(&enc); output_charset2uni(name,&enc); } static int row_byte_gbk2 (int row) { return 0x81+row; } static int col_byte_gbk2 (int col) { return (col >= 0x3f ? 0x41 : 0x40) + col; } static int byte_row_gbk2 (int byte) { if (byte >= 0x81 && byte < 0xff) return byte-0x81; else return -1; } static int byte_col_gbk2 (int byte) { if (byte >= 0x40 && byte < 0x7f) return byte-0x40; else if (byte >= 0x80 && byte < 0xa1) return byte-0x41; else return -1; } static void do_gbk2_only_charset2uni (const char* name) { Encoding enc; enc.rows = 126; enc.cols = 96; enc.row_byte = row_byte_gbk2; enc.col_byte = col_byte_gbk2; enc.byte_row = byte_row_gbk2; enc.byte_col = byte_col_gbk2; enc.check_row_expr = "%1$s >= 0x81 && %1$s < 0xff"; enc.check_col_expr = "(%1$s >= 0x40 && %1$s < 0x7f) || (%1$s >= 0x80 && %1$s < 0xa1)"; enc.byte_row_expr = "%1$s - 0x81"; enc.byte_col_expr = "%1$s - (%1$s >= 0x80 ? 0x41 : 0x40)"; read_table(&enc); output_charset2uni(name,&enc); } static void do_gbk1_only_uni2charset (const char* name) { Encoding enc; enc.rows = 126; enc.cols = 190; enc.row_byte = row_byte_gbk1; enc.col_byte = col_byte_gbk1; enc.byte_row = byte_row_gbk1; enc.byte_col = byte_col_gbk1; enc.check_row_expr = "%1$s >= 0x81 && %1$s < 0xff"; enc.check_col_expr = "(%1$s >= 0x40 && %1$s < 0x7f) || (%1$s >= 0x80 && %1$s < 0xff)"; enc.byte_row_expr = "%1$s - 0x81"; enc.byte_col_expr = "%1$s - (%1$s >= 0x80 ? 0x41 : 0x40)"; read_table(&enc); invert(&enc); output_uni2charset_sparse(name,&enc); } /* KSC 5601 specifics */ /* * Reads the charset2uni table from standard input. */ static void read_table_ksc5601 (Encoding* enc) { int row, col, i, i1, i2, c, j; enc->charset2uni = malloc(enc->rows*sizeof(int*)); for (row = 0; row < enc->rows; row++) enc->charset2uni[row] = malloc(enc->cols*sizeof(int)); for (row = 0; row < enc->rows; row++) for (col = 0; col < enc->cols; col++) enc->charset2uni[row][col] = 0xfffd; c = getc(stdin); ungetc(c,stdin); if (c == '#') { /* Read a unicode.org style .TXT file. */ for (;;) { c = getc(stdin); if (c == EOF) break; if (c == '\n' || c == ' ' || c == '\t') continue; if (c == '#') { do { c = getc(stdin); } while (!(c == EOF || c == '\n')); continue; } ungetc(c,stdin); if (scanf("0x%x", &j) != 1) exit(1); i1 = j >> 8; i2 = j & 0xff; if (scanf(" 0x%x", &j) != 1) exit(1); /* Take only the range covered by KS C 5601.1987-0 = KS C 5601.1989-0 = KS X 1001.1992, ignore the rest. */ if (!(i1 >= 128+33 && i1 < 128+127 && i2 >= 128+33 && i2 < 128+127)) continue; /* KSC5601 specific */ i1 &= 0x7f; /* KSC5601 specific */ i2 &= 0x7f; /* KSC5601 specific */ row = enc->byte_row(i1); col = enc->byte_col(i2); if (row < 0 || col < 0) { fprintf(stderr, "lost entry for %02x %02x\n", i1, i2); exit(1); } enc->charset2uni[row][col] = j; } } else { /* Read a table of hexadecimal Unicode values. */ for (i1 = 33; i1 < 127; i1++) for (i2 = 33; i2 < 127; i2++) { i = scanf("%x", &j); if (i == EOF) goto read_done; if (i != 1) exit(1); if (j < 0 || j == 0xffff) j = 0xfffd; if (j != 0xfffd) { if (enc->byte_row(i1) < 0 || enc->byte_col(i2) < 0) { fprintf(stderr, "lost entry at %02x %02x\n", i1, i2); exit (1); } enc->charset2uni[enc->byte_row(i1)][enc->byte_col(i2)] = j; } } read_done: ; } } static void do_ksc5601 (const char* name) { Encoding enc; enc.rows = 94; enc.cols = 94; enc.row_byte = row_byte_normal; enc.col_byte = col_byte_normal; enc.byte_row = byte_row_normal; enc.byte_col = byte_col_normal; enc.check_row_expr = "%1$s >= 0x21 && %1$s < 0x7f"; enc.check_col_expr = "%1$s >= 0x21 && %1$s < 0x7f"; enc.byte_row_expr = "%1$s - 0x21"; enc.byte_col_expr = "%1$s - 0x21"; read_table_ksc5601(&enc); output_charset2uni(name,&enc); invert(&enc); output_uni2charset_sparse(name,&enc); } /* Big5 specifics */ static int row_byte_big5 (int row) { return 0xa1+row; } static int col_byte_big5 (int col) { return (col >= 0x3f ? 0x62 : 0x40) + col; } static int byte_row_big5 (int byte) { if (byte >= 0xa1 && byte < 0xff) return byte-0xa1; else return -1; } static int byte_col_big5 (int byte) { if (byte >= 0x40 && byte < 0x7f) return byte-0x40; else if (byte >= 0xa1 && byte < 0xff) return byte-0x62; else return -1; } static void do_big5 (const char* name) { Encoding enc; enc.rows = 94; enc.cols = 157; enc.row_byte = row_byte_big5; enc.col_byte = col_byte_big5; enc.byte_row = byte_row_big5; enc.byte_col = byte_col_big5; enc.check_row_expr = "%1$s >= 0xa1 && %1$s < 0xff"; enc.check_col_expr = "(%1$s >= 0x40 && %1$s < 0x7f) || (%1$s >= 0xa1 && %1$s < 0xff)"; enc.byte_row_expr = "%1$s - 0xa1"; enc.byte_col_expr = "%1$s - (%1$s >= 0xa1 ? 0x62 : 0x40)"; read_table(&enc); output_charset2uni(name,&enc); invert(&enc); output_uni2charset_sparse(name,&enc); } /* Big5-HKSCS specifics */ static int row_byte_big5hkscs (int row) { return 0x81+row; } static int col_byte_big5hkscs (int col) { return (col >= 0x3f ? 0x62 : 0x40) + col; } static int byte_row_big5hkscs (int byte) { if (byte >= 0x81 && byte < 0xff) return byte-0x81; else return -1; } static int byte_col_big5hkscs (int byte) { if (byte >= 0x40 && byte < 0x7f) return byte-0x40; else if (byte >= 0xa1 && byte < 0xff) return byte-0x62; else return -1; } static void do_big5hkscs (const char* name) { Encoding enc; enc.rows = 126; enc.cols = 157; enc.row_byte = row_byte_big5hkscs; enc.col_byte = col_byte_big5hkscs; enc.byte_row = byte_row_big5hkscs; enc.byte_col = byte_col_big5hkscs; enc.check_row_expr = "%1$s >= 0x81 && %1$s < 0xff"; enc.check_col_expr = "(%1$s >= 0x40 && %1$s < 0x7f) || (%1$s >= 0xa1 && %1$s < 0xff)"; enc.byte_row_expr = "%1$s - 0x81"; enc.byte_col_expr = "%1$s - (%1$s >= 0xa1 ? 0x62 : 0x40)"; read_table(&enc); output_charset2uni(name,&enc); invert(&enc); output_uni2charset_sparse(name,&enc); } /* Johab Hangul specifics */ static int row_byte_johab_hangul (int row) { return 0x84+row; } static int col_byte_johab_hangul (int col) { return (col >= 0x3e ? 0x43 : 0x41) + col; } static int byte_row_johab_hangul (int byte) { if (byte >= 0x84 && byte < 0xd4) return byte-0x84; else return -1; } static int byte_col_johab_hangul (int byte) { if (byte >= 0x41 && byte < 0x7f) return byte-0x41; else if (byte >= 0x81 && byte < 0xff) return byte-0x43; else return -1; } static void do_johab_hangul (const char* name) { Encoding enc; enc.rows = 80; enc.cols = 188; enc.row_byte = row_byte_johab_hangul; enc.col_byte = col_byte_johab_hangul; enc.byte_row = byte_row_johab_hangul; enc.byte_col = byte_col_johab_hangul; enc.check_row_expr = "%1$s >= 0x84 && %1$s < 0xd4"; enc.check_col_expr = "(%1$s >= 0x41 && %1$s < 0x7f) || (%1$s >= 0x81 && %1$s < 0xff)"; enc.byte_row_expr = "%1$s - 0x84"; enc.byte_col_expr = "%1$s - (%1$s >= 0x81 ? 0x43 : 0x41)"; read_table(&enc); output_charset2uni(name,&enc); invert(&enc); output_uni2charset_dense(name,&enc); } /* SJIS specifics */ static int row_byte_sjis (int row) { return (row >= 0x1f ? 0xc1 : 0x81) + row; } static int col_byte_sjis (int col) { return (col >= 0x3f ? 0x41 : 0x40) + col; } static int byte_row_sjis (int byte) { if (byte >= 0x81 && byte < 0xa0) return byte-0x81; else if (byte >= 0xe0) return byte-0xc1; else return -1; } static int byte_col_sjis (int byte) { if (byte >= 0x40 && byte < 0x7f) return byte-0x40; else if (byte >= 0x80 && byte < 0xfd) return byte-0x41; else return -1; } static void do_sjis (const char* name) { Encoding enc; enc.rows = 94; enc.cols = 188; enc.row_byte = row_byte_sjis; enc.col_byte = col_byte_sjis; enc.byte_row = byte_row_sjis; enc.byte_col = byte_col_sjis; enc.check_row_expr = "(%1$s >= 0x81 && %1$s < 0xa0) || (%1$s >= 0xe0)"; enc.check_col_expr = "(%1$s >= 0x40 && %1$s < 0x7f) || (%1$s >= 0x80 && %1$s < 0xfd)"; enc.byte_row_expr = "%1$s - (%1$s >= 0xe0 ? 0xc1 : 0x81)"; enc.byte_col_expr = "%1$s - (%1$s >= 0x80 ? 0x41 : 0x40)"; read_table(&enc); output_charset2uni(name,&enc); invert(&enc); output_uni2charset_sparse(name,&enc); } /* Main program */ int main (int argc, char *argv[]) { const char* charsetname; const char* name; if (argc != 3) exit(1); charsetname = argv[1]; name = argv[2]; output_title(charsetname); if (!strcmp(name,"gb2312") || !strcmp(name,"gb12345ext") || !strcmp(name,"jisx0208") || !strcmp(name,"jisx0212")) do_normal(name); else if (!strcmp(name,"cns11643_1") || !strcmp(name,"cns11643_2") || !strcmp(name,"cns11643_3")) do_normal_only_charset2uni(name); else if (!strcmp(name,"cns11643_inv")) do_cns11643_only_uni2charset(name); else if (!strcmp(name,"gbkext1")) do_gbk1_only_charset2uni(name); else if (!strcmp(name,"gbkext2")) do_gbk2_only_charset2uni(name); else if (!strcmp(name,"gbkext_inv")) do_gbk1_only_uni2charset(name); else if (!strcmp(name,"cp936ext")) do_gbk1(name); else if (!strcmp(name,"ksc5601")) do_ksc5601(name); else if (!strcmp(name,"big5") || !strcmp(name,"cp950ext")) do_big5(name); else if (!strcmp(name,"big5hkscs")) do_big5hkscs(name); else if (!strcmp(name,"johab_hangul")) do_johab_hangul(name); else if (!strcmp(name,"cp932ext")) do_sjis(name); else exit(1); return 0; } nx-libs-3.5.99.23/doc/libNX_X11/lcUniConv/README0000644000000000000000000000072213614532331015302 0ustar The files in this directory are taken from the libiconv-1.1 package. The *.h files were generated from tables (mostly from ftp.unicode.org) using the programs '8bit_tab_to_h.c' and 'cjk_tab_to_h.c'. On some of them, further optimizations were applied by hand. If you find a bug in these files, instead of modifying them in XFree86 and let it diverge from libiconv, please notify the libiconv maintainer (currently ) so he can fix both in synch. nx-libs-3.5.99.23/doc/libNX_X11/symbols/libNX_X11::symbols.txt0000644000000000000000000005421413614532331020222 0ustar ### as found in libNX_X11 (rebased against libX11 1.6.4) (20161115) ### KeySymToUcs4 XActivateScreenSaver XAddConnectionWatch XAddExtension XAddHost XAddHosts XAddPixel XAddToExtensionList XAddToSaveSet XAllPlanes XAllocClassHint XAllocColor XAllocColorCells XAllocColorPlanes XAllocIconSize XAllocNamedColor XAllocSizeHints XAllocStandardColormap XAllocWMHints XAllowEvents XAutoRepeatOff XAutoRepeatOn XBaseFontNameListOfFontSet XBell XBitmapBitOrder XBitmapPad XBitmapUnit XBlackPixel XBlackPixelOfScreen XCellsOfScreen XChangeActivePointerGrab XChangeGC XChangeKeyboardControl XChangeKeyboardMapping XChangePointerControl XChangeProperty XChangeSaveSet XChangeWindowAttributes XCheckIfEvent XCheckIfEventNoFlush XCheckMaskEvent XCheckTypedEvent XCheckTypedWindowEvent XCheckWindowEvent XCirculateSubwindows XCirculateSubwindowsDown XCirculateSubwindowsUp XClearArea XClearWindow XClipBox XCloseDisplay XCloseIM XCloseOM XConfigureWindow XConnectionNumber XContextDependentDrawing XContextualDrawing XConvertCase XConvertSelection XCopyArea XCopyColormapAndFree XCopyGC XCopyPlane XCreateBitmapFromData XCreateColormap XCreateFontCursor XCreateFontSet XCreateGC XCreateGlyphCursor XCreateIC XCreateImage XCreateOC XCreatePixmap XCreatePixmapCursor XCreatePixmapFromBitmapData XCreateRegion XCreateSimpleWindow XCreateWindow XDefaultColormap XDefaultColormapOfScreen XDefaultDepth XDefaultDepthOfScreen XDefaultGC XDefaultGCOfScreen XDefaultRootWindow XDefaultScreen XDefaultScreenOfDisplay XDefaultString XDefaultVisual XDefaultVisualOfScreen XDefineCursor XDeleteContext XDeleteModifiermapEntry XDeleteProperty XDestroyIC XDestroyImage XDestroyOC XDestroyRegion XDestroySubwindows XDestroyWindow XDirectionalDependentDrawing XDisableAccessControl XDisplayCells XDisplayHeight XDisplayHeightMM XDisplayKeycodes XDisplayMotionBufferSize XDisplayName XDisplayOfIM XDisplayOfOM XDisplayOfScreen XDisplayPlanes XDisplayString XDisplayWidth XDisplayWidthMM XDoesBackingStore XDoesSaveUnders XDrawArc XDrawArcs XDrawImageString16 XDrawImageString XDrawLine XDrawLines XDrawPoint XDrawPoints XDrawRectangle XDrawRectangles XDrawSegments XDrawString16 XDrawString XDrawText16 XDrawText XEHeadOfExtensionList XESetBeforeFlush XESetCloseDisplay XESetCopyEventCookie XESetCopyGC XESetCreateFont XESetCreateGC XESetError XESetErrorString XESetEventToWire XESetFlushGC XESetFreeFont XESetFreeGC XESetPrintErrorValues XESetWireToError XESetWireToEvent XESetWireToEventCookie XEmptyRegion XEnableAccessControl XEqualRegion XEventMaskOfScreen XEventsQueued XExtendedMaxRequestSize XExtentsOfFontSet XFetchBuffer XFetchBytes XFetchName XFillArc XFillArcs XFillPolygon XFillRectangle XFillRectangles XFilterEvent XFindContext XFindOnExtensionList XFlush XFlushGC XFontsOfFontSet XForceScreenSaver XFree XFreeColormap XFreeColors XFreeCursor XFreeEventData XFreeExtensionList XFreeFont XFreeFontInfo XFreeFontNames XFreeFontPath XFreeFontSet XFreeGC XFreeModifiermap XFreePixmap XFreeStringList XGContextFromGC XGeometry XGetAtomName XGetAtomNames XGetClassHint XGetCommand XGetDefault XGetErrorDatabaseText XGetErrorText XGetEventData XGetFontPath XGetFontProperty XGetGCValues XGetGeometry XGetICValues XGetIMValues XGetIconName XGetIconSizes XGetImage XGetInputFocus XGetKeyboardControl XGetKeyboardMapping XGetModifierMapping XGetMotionEvents XGetNormalHints XGetOCValues XGetOMValues XGetPixel XGetPointerControl XGetPointerMapping XGetRGBColormaps XGetScreenSaver XGetSelectionOwner XGetSizeHints XGetStandardColormap XGetSubImage XGetTextProperty XGetTransientForHint XGetVisualInfo XGetWMClientMachine XGetWMColormapWindows XGetWMHints XGetWMIconName XGetWMName XGetWMNormalHints XGetWMProtocols XGetWMSizeHints XGetWindowAttributes XGetWindowProperty XGetZoomHints XGrabButton XGrabKey XGrabKeyboard XGrabPointer XGrabServer XHeightMMOfScreen XHeightOfScreen XIMOfIC XIconifyWindow XIfEvent XImageByteOrder XInitExtension XInitImage XInitThreads XInsertModifiermapEntry XInstallColormap XInternAtom XInternAtoms XInternalConnectionNumbers XIntersectRegion XKeycodeToKeysym XKeysymToKeycode XKeysymToString XKillClient XLastKnownRequestProcessed XListDepths XListExtensions XListFonts XListFontsWithInfo XListHosts XListInstalledColormaps XListPixmapFormats XListProperties XLoadFont XLoadQueryFont XLocaleOfFontSet XLocaleOfIM XLocaleOfOM XLockDisplay XLookupColor XLookupKeysym XLookupString XLowerWindow XMapRaised XMapSubwindows XMapWindow XMaskEvent XMatchVisualInfo XMaxCmapsOfScreen XMaxRequestSize XMinCmapsOfScreen XMoveResizeWindow XMoveWindow XNewModifiermap XNextEvent XNextRequest XNoOp XOMOfOC XOffsetRegion XOpenDisplay XOpenIM XOpenOM XParseColor XParseGeometry XPeekEvent XPeekIfEvent XPending XPlanesOfScreen XPointInRegion XPolygonRegion XProcessInternalConnection XProtocolRevision XProtocolVersion XPutBackEvent XPutImage XPutPixel XQLength XQueryBestCursor XQueryBestSize XQueryBestStipple XQueryBestTile XQueryColor XQueryColors XQueryExtension XQueryFont XQueryKeymap XQueryPointer XQueryTextExtents16 XQueryTextExtents XQueryTree XRaiseWindow XReadBitmapFile XReadBitmapFileData XRebindKeysym XRecolorCursor XReconfigureWMWindow XRectInRegion XRefreshKeyboardMapping XRegisterIMInstantiateCallback XRemoveConnectionWatch XRemoveFromSaveSet XRemoveHost XRemoveHosts XReparentWindow XResetScreenSaver XResizeWindow XResourceManagerString XRestackWindows XRootWindow XRootWindowOfScreen XRotateBuffers XRotateWindowProperties XSaveContext XScreenCount XScreenNumberOfScreen XScreenOfDisplay XScreenResourceString XSelectInput XSendEvent XServerVendor XSetAccessControl XSetAfterFunction XSetArcMode XSetAuthorization XSetBackground XSetClassHint XSetClipMask XSetClipOrigin XSetClipRectangles XSetCloseDownMode XSetCommand XSetDashes XSetErrorHandler XSetFillRule XSetFillStyle XSetFont XSetFontPath XSetForeground XSetFunction XSetGraphicsExposures XSetICFocus XSetICValues XSetIMValues XSetIOErrorHandler XSetIconName XSetIconSizes XSetInputFocus XSetLineAttributes XSetLocaleModifiers XSetModifierMapping XSetNormalHints XSetOCValues XSetOMValues XSetPlaneMask XSetPointerMapping XSetRGBColormaps XSetRegion XSetScreenSaver XSetSelectionOwner XSetSizeHints XSetStandardColormap XSetStandardProperties XSetState XSetStipple XSetSubwindowMode XSetTSOrigin XSetTextProperty XSetTile XSetTransientForHint XSetWMClientMachine XSetWMColormapWindows XSetWMHints XSetWMIconName XSetWMName XSetWMNormalHints XSetWMProperties XSetWMProtocols XSetWMSizeHints XSetWindowBackground XSetWindowBackgroundPixmap XSetWindowBorder XSetWindowBorderPixmap XSetWindowBorderWidth XSetWindowColormap XSetZoomHints XShrinkRegion XStoreBuffer XStoreBytes XStoreColor XStoreColors XStoreName XStoreNamedColor XStringListToTextProperty XStringToKeysym XSubImage XSubtractRegion XSupportsLocale XSync XSynchronize XTextExtents16 XTextExtents XTextPropertyToStringList XTextWidth16 XTextWidth XTranslateCoordinates XUndefineCursor XUngrabButton XUngrabKey XUngrabKeyboard XUngrabPointer XUngrabServer XUninstallColormap XUnionRectWithRegion XUnionRegion XUnloadFont XUnlockDisplay XUnmapSubwindows XUnmapWindow XUnregisterIMInstantiateCallback XUnsetICFocus XVaCreateNestedList XVendorRelease XVisualIDFromVisual XWMGeometry XWarpPointer XWhitePixel XWhitePixelOfScreen XWidthMMOfScreen XWidthOfScreen XWindowEvent XWithdrawWindow XWriteBitmapFile XXorRegion XauDisposeAuth XauFileName XauGetBestAuthByAddr XauReadAuth XcmsAddColorSpace XcmsAddFunctionSet XcmsAllocColor XcmsAllocNamedColor XcmsCCCOfColormap XcmsCIELabClipL XcmsCIELabClipLab XcmsCIELabClipab XcmsCIELabColorSpace XcmsCIELabQueryMaxC XcmsCIELabQueryMaxL XcmsCIELabQueryMaxLC XcmsCIELabQueryMinL XcmsCIELabToCIEXYZ XcmsCIELabWhiteShiftColors XcmsCIELuvClipL XcmsCIELuvClipLuv XcmsCIELuvClipuv XcmsCIELuvColorSpace XcmsCIELuvQueryMaxC XcmsCIELuvQueryMaxL XcmsCIELuvQueryMaxLC XcmsCIELuvQueryMinL XcmsCIELuvToCIEuvY XcmsCIELuvWhiteShiftColors XcmsCIEXYZColorSpace XcmsCIEXYZToCIELab XcmsCIEXYZToCIEuvY XcmsCIEXYZToCIExyY XcmsCIEXYZToRGBi XcmsCIEuvYColorSpace XcmsCIEuvYToCIELuv XcmsCIEuvYToCIEXYZ XcmsCIEuvYToTekHVC XcmsCIExyYColorSpace XcmsCIExyYToCIEXYZ XcmsClientWhitePointOfCCC XcmsConvertColors XcmsCreateCCC XcmsDefaultCCC XcmsDisplayOfCCC XcmsFormatOfPrefix XcmsFreeCCC XcmsLinearRGBFunctionSet XcmsLookupColor XcmsPrefixOfFormat XcmsQueryBlack XcmsQueryBlue XcmsQueryColor XcmsQueryColors XcmsQueryGreen XcmsQueryRed XcmsQueryWhite XcmsRGBColorSpace XcmsRGBToRGBi XcmsRGBiColorSpace XcmsRGBiToCIEXYZ XcmsRGBiToRGB XcmsScreenNumberOfCCC XcmsScreenWhitePointOfCCC XcmsSetCCCOfColormap XcmsSetCompressionProc XcmsSetWhiteAdjustProc XcmsSetWhitePoint XcmsStoreColor XcmsStoreColors XcmsTekHVCClipC XcmsTekHVCClipV XcmsTekHVCClipVC XcmsTekHVCColorSpace XcmsTekHVCQueryMaxC XcmsTekHVCQueryMaxV XcmsTekHVCQueryMaxVC XcmsTekHVCQueryMaxVSamples XcmsTekHVCQueryMinV XcmsTekHVCToCIEuvY XcmsTekHVCWhiteShiftColors XcmsUNDEFINEDColorSpace XcmsVisualOfCCC XkbAddDeviceLedInfo XkbAddGeomColor XkbAddGeomDoodad XkbAddGeomKey XkbAddGeomKeyAlias XkbAddGeomOutline XkbAddGeomOverlay XkbAddGeomOverlayKey XkbAddGeomOverlayRow XkbAddGeomProperty XkbAddGeomRow XkbAddGeomSection XkbAddGeomShape XkbAddKeyType XkbAllocClientMap XkbAllocCompatMap XkbAllocControls XkbAllocDeviceInfo XkbAllocGeomColors XkbAllocGeomDoodads XkbAllocGeomKeyAliases XkbAllocGeomKeys XkbAllocGeomOutlines XkbAllocGeomOverlayKeys XkbAllocGeomOverlayRows XkbAllocGeomOverlays XkbAllocGeomPoints XkbAllocGeomProps XkbAllocGeomRows XkbAllocGeomSectionDoodads XkbAllocGeomSections XkbAllocGeomShapes XkbAllocGeometry XkbAllocIndicatorMaps XkbAllocKeyboard XkbAllocNames XkbAllocServerMap XkbApplyCompatMapToKey XkbApplyVirtualModChanges XkbBell XkbBellEvent XkbChangeDeviceInfo XkbChangeEnabledControls XkbChangeKeycodeRange XkbChangeMap XkbChangeNames XkbChangeTypesOfKey XkbComputeEffectiveMap XkbComputeRowBounds XkbComputeSectionBounds XkbComputeShapeBounds XkbComputeShapeTop XkbCopyKeyType XkbCopyKeyTypes XkbDeviceBell XkbDeviceBellEvent XkbFindOverlayForKey XkbForceBell XkbForceDeviceBell XkbFreeClientMap XkbFreeCompatMap XkbFreeComponentList XkbFreeControls XkbFreeDeviceInfo XkbFreeGeomColors XkbFreeGeomDoodads XkbFreeGeomKeyAliases XkbFreeGeomKeys XkbFreeGeomOutlines XkbFreeGeomOverlayKeys XkbFreeGeomOverlayRows XkbFreeGeomOverlays XkbFreeGeomPoints XkbFreeGeomProperties XkbFreeGeomRows XkbFreeGeomSections XkbFreeGeomShapes XkbFreeGeometry XkbFreeIndicatorMaps XkbFreeKeyboard XkbFreeNames XkbFreeServerMap XkbGetAutoRepeatRate XkbGetAutoResetControls XkbGetCompatMap XkbGetControls XkbGetDetectableAutoRepeat XkbGetDeviceButtonActions XkbGetDeviceInfo XkbGetDeviceInfoChanges XkbGetDeviceLedInfo XkbGetGeometry XkbGetIndicatorMap XkbGetIndicatorState XkbGetKeyActions XkbGetKeyBehaviors XkbGetKeyExplicitComponents XkbGetKeyModifierMap XkbGetKeySyms XkbGetKeyTypes XkbGetKeyVirtualModMap XkbGetKeyboard XkbGetKeyboardByName XkbGetMap XkbGetMapChanges XkbGetNamedDeviceIndicator XkbGetNamedGeometry XkbGetNamedIndicator XkbGetNames XkbGetPerClientControls XkbGetState XkbGetUpdatedMap XkbGetVirtualMods XkbGetXlibControls XkbIgnoreExtension XkbInitCanonicalKeyTypes XkbKeyTypesForCoreSymbols XkbKeycodeToKeysym XkbKeysymToModifiers XkbLatchGroup XkbLatchModifiers XkbLibraryVersion XkbListComponents XkbLockGroup XkbLockModifiers XkbLookupKeyBinding XkbLookupKeySym XkbNoteControlsChanges XkbNoteDeviceChanges XkbNoteMapChanges XkbNoteNameChanges XkbOpenDisplay XkbQueryExtension XkbRefreshKeyboardMapping XkbResizeDeviceButtonActions XkbResizeKeyActions XkbResizeKeySyms XkbResizeKeyType XkbSelectEventDetails XkbSelectEvents XkbSetAtomFuncs XkbSetAutoRepeatRate XkbSetAutoResetControls XkbSetCompatMap XkbSetControls XkbSetDebuggingFlags XkbSetDetectableAutoRepeat XkbSetDeviceButtonActions XkbSetDeviceInfo XkbSetDeviceLedInfo XkbSetGeometry XkbSetIgnoreLockMods XkbSetIndicatorMap XkbSetMap XkbSetNamedDeviceIndicator XkbSetNamedIndicator XkbSetNames XkbSetPerClientControls XkbSetServerInternalMods XkbSetXlibControls XkbToControl XkbTranslateKey XkbTranslateKeyCode XkbTranslateKeySym XkbUpdateActionVirtualMods XkbUpdateKeyTypeVirtualMods XkbUpdateMapFromCore XkbUseExtension XkbVirtualModsToReal XkbXlibControlsImplemented XmbDrawImageString XmbDrawString XmbDrawText XmbLookupString XmbResetIC XmbSetWMProperties XmbTextEscapement XmbTextExtents XmbTextListToTextProperty XmbTextPerCharExtents XmbTextPropertyToTextList Xpermalloc XrmCombineDatabase XrmCombineFileDatabase XrmDestroyDatabase XrmEnumerateDatabase XrmGetDatabase XrmGetFileDatabase XrmGetResource XrmGetStringDatabase XrmInitialize XrmLocaleOfDatabase XrmMergeDatabases XrmParseCommand XrmPermStringToQuark XrmPutFileDatabase XrmPutLineResource XrmPutResource XrmPutStringResource XrmQGetResource XrmQGetSearchList XrmQGetSearchResource XrmQPutResource XrmQPutStringResource XrmQuarkToString XrmSetDatabase XrmStringToBindingQuarkList XrmStringToQuark XrmStringToQuarkList XrmUniqueQuark Xutf8DrawImageString Xutf8DrawString Xutf8DrawText Xutf8LookupString Xutf8ResetIC Xutf8SetWMProperties Xutf8TextEscapement Xutf8TextExtents Xutf8TextListToTextProperty Xutf8TextPerCharExtents Xutf8TextPropertyToTextList XwcDrawImageString XwcDrawString XwcDrawText XwcFreeStringList XwcLookupString XwcResetIC XwcTextEscapement XwcTextExtents XwcTextListToTextProperty XwcTextPerCharExtents XwcTextPropertyToTextList _Utf8GetConvByName _X11TransBytesReadable _X11TransClose _X11TransCloseForCloning _X11TransConnect _X11TransConnectDisplay _X11TransConvertAddress _X11TransDisconnect _X11TransFreeConnInfo _X11TransGetConnectionNumber _X11TransGetHostname _X11TransGetMyAddr _X11TransGetPeerAddr _X11TransIsLocal _X11TransOpenCOTSClient _X11TransRead _X11TransReadv _X11TransSetOption _X11TransSocketINET6Funcs _X11TransSocketINETFuncs _X11TransSocketLocalFuncs _X11TransSocketProxyConnInfo _X11TransSocketTCPFuncs _X11TransSocketUNIXFuncs _X11TransWrite _X11TransWritev _XAllocID _XAllocIDs _XAllocScratch _XAllocTemp _XAsyncErrorHandler _XCloseLC _XColor_to_XcmsRGB _XConnectDisplay _XCopyEventCookie _XCopyToArg _XCreateMutex_fn (arch=amd64 ia64 alpha ppc64 arm64)_XData32 _XDefaultError _XDefaultIOError _XDefaultWireError _XDeq _XDeqAsyncHandler _XDisconnectDisplay _XEatData _XEatDataWords _XEnq _XError _XErrorFunction _XEventToWire _XEventsQueued _XF86BigfontFreeFontMetrics _XF86LoadQueryLocaleFont _XFetchEventCookie _XFlush _XFlushGCCache _XFreeAtomTable _XFreeDisplayLock_fn _XFreeDisplayStructure _XFreeEventCookies _XFreeExtData _XFreeMutex_fn _XFreeTemp _XGetAsyncData _XGetAsyncReply _XGetBitsPerPixel _XGetHostname _XGetLCValues _XGetRequest _XGetScanlinePad _XGetWindowAttributes _XHeadOfDisplayList _XIMCompileResourceList _XIOError _XIOErrorFunction _XInitDisplayLock_fn _XInitIM _XInitImageFuncPtrs _XInitKeysymDB _XInitOM _XIsEventCookie _XKeyInitialize _XKeycodeToKeysym _XKeysymToKeycode _XKeysymToModifiers _XLockMutex_fn _XLookupKeysym _XLookupString _XNoticeCreateBitmap _XNoticePutBitmap _XOpenLC _XParseBaseFontNameList _XPollfdCacheAdd _XPollfdCacheDel _XPollfdCacheInit _XProcessInternalConnection _XProcessWindowAttributes _XPutBackEvent (arch=amd64 ia64 alpha ppc64 arm64)_XRead32 _XRead _XReadEvents _XReadPad _XRefreshKeyboardMapping _XRegisterFilterByMask _XRegisterFilterByType _XRegisterInternalConnection _XReply _XReverse_Bytes _XScreenOfWindow _XSelect _XSend _XSendClientPrefix _XSetClipRectangles _XSetImage _XSetLastRequestRead _XStoreEventCookie _XTextHeight16 _XTextHeight _XTranslateKey _XTranslateKeySym _XTryShapeBitmapCursor _XUnknownCopyEventCookie _XUnknownNativeEvent _XUnknownWireEvent _XUnknownWireEventCookie _XUnlockMutex_fn _XUnregisterFilter _XUnregisterInternalConnection _XUnresolveColor _XUpdateAtomCache _XUpdateGCCache _XVIDtoVisual _XWireToEvent _XcmsAddCmapRec _XcmsArcTangent _XcmsCIELabQueryMaxLCRGB _XcmsCIELab_prefix _XcmsCIELuvQueryMaxLCRGB _XcmsCIELuv_prefix _XcmsCIEXYZ_ValidSpec _XcmsCIEXYZ_prefix _XcmsCIEuvY_ValidSpec _XcmsCIEuvY_prefix _XcmsCIExyY_prefix _XcmsConvertColorsWithWhitePt _XcmsCopyCmapRecAndFree _XcmsCopyISOLatin1Lowered _XcmsCopyPointerArray _XcmsCosine _XcmsCubeRoot _XcmsDDColorSpaces _XcmsDDColorSpacesInit _XcmsDDConvertColors _XcmsDIColorSpaces _XcmsDIColorSpacesInit _XcmsDIConvertColors _XcmsDeleteCmapRec _XcmsEqualWhitePts _XcmsFreeIntensityMaps _XcmsFreePointerArray _XcmsGetElement _XcmsGetIntensityMap _XcmsGetProperty _XcmsInitDefaultCCCs _XcmsInitScrnInfo _XcmsLRGB_InitScrnDefault _XcmsPushPointerArray _XcmsRGB_prefix _XcmsRGB_to_XColor _XcmsRGBi_prefix _XcmsRegColorSpaces _XcmsRegFormatOfPrefix _XcmsResolveColor _XcmsResolveColorString _XcmsSCCFuncSets _XcmsSCCFuncSetsInit _XcmsSetGetColor _XcmsSetGetColors _XcmsSine _XcmsSquareRoot _XcmsTekHVCQueryMaxVCRGB _XcmsTekHVC_CheckModify _XcmsTekHVC_prefix _XcmsUnresolveColor _Xdebug _Xevent_to_mask _Xglobal_lock _Xi18n_lock _XimCbDispatch _XimCheckCreateICValues _XimCheckDataSize _XimCheckICMode _XimCheckIMMode _XimCheckIfLocalProcessing _XimCheckIfThaiProcessing _XimCheckLocalInputStyle _XimCommitCallback _XimConnect _XimDecodeICATTRIBUTE _XimDecodeIMATTRIBUTE _XimDecodeLocalICAttr _XimDecodeLocalIMAttr _XimDestroyIMStructureList _XimDispatchInit _XimEncodeICATTRIBUTE _XimEncodeIMATTRIBUTE _XimEncodeLocalICAttr _XimEncodeLocalIMAttr _XimError _XimErrorCallback _XimExtension _XimFilterWaitEvent _XimFlush _XimForwardEvent _XimForwardEventCallback _XimFreeCommitInfo _XimFreeProtoIntrCallback _XimFreeTransIntrCallback _XimGetAttributeID _XimGetCharCode _XimGetCurrentICValues _XimGetCurrentIMValues _XimGetICValueData _XimGetIMValueData _XimGetLocaleCode _XimGetMyEndian _XimGetResourceListRec _XimGetResourceListRecByQuark _XimGetWindowEventmask _XimICOfXICID _XimImSportRec _XimInitialResourceInfo _XimLcctstombs _XimLcctstoutf8 _XimLcctstowcs _XimLocalCreateIC _XimLocalFilter _XimLocalGetICValues _XimLocalGetIMValues _XimLocalIMFree _XimLocalMbLookupString _XimLocalOpenIM _XimLocalSetICValues _XimLocalSetIMValues _XimLocalUtf8LookupString _XimLocalWcLookupString _XimLookupMBText _XimLookupUTF8Text _XimLookupWCText _XimMakeICAttrIDList _XimMakeIMAttrIDList _XimOpenIM _XimParseStringFile _XimProcError _XimProcSyncReply _XimProtoCreateIC _XimProtoEventToWire _XimProtoIMFree _XimProtoMbLookupString _XimProtoOpenIM _XimProtoUtf8LookupString _XimProtoWcLookupString _XimProtoWireToEvent _XimRead _XimRegProtoIntrCallback _XimRegisterDispatcher _XimRegisterFilter _XimRegisterIMInstantiateCallback _XimRegisterServerFilter _XimRegisterTriggerKeysCallback _XimReregisterFilter _XimResetIMInstantiateCallback _XimRespSyncReply _XimServerDestroy _XimSetCurrentICValues _XimSetCurrentIMValues _XimSetEventMaskCallback _XimSetHeader _XimSetICDefaults _XimSetICMode _XimSetICResourceList _XimSetICValueData _XimSetIMMode _XimSetIMResourceList _XimSetIMValueData _XimSetInnerICResourceList _XimSetInnerIMResourceList _XimSetLocalIMDefaults _XimShutdown _XimSync _XimSyncCallback _XimThaiCloseIM _XimThaiCreateIC _XimThaiFilter _XimThaiIMFree _XimThaiOpenIM _XimTransCallDispatcher _XimTransConf _XimTransFilterWaitEvent _XimTransFlush _XimTransInternalConnection _XimTransRead _XimTransRegisterDispatcher _XimTransWrite _XimTransportRec _XimTriggerNotify _XimUnRegisterIMInstantiateCallback _XimUnregisterFilter _XimUnregisterServerFilter _XimWrite _XimXConf _XimXTransBytesReadable _XimXTransClose _XimXTransCloseForCloning _XimXTransConnect _XimXTransDisconnect _XimXTransFreeConnInfo _XimXTransGetConnectionNumber _XimXTransGetHostname _XimXTransGetPeerAddr _XimXTransIsLocal _XimXTransOpenCOTSClient _XimXTransRead _XimXTransReadv _XimXTransSetOption _XimXTransSocketINET6Funcs _XimXTransSocketINETFuncs _XimXTransSocketLocalFuncs _XimXTransSocketTCPFuncs _XimXTransSocketUNIXFuncs _XimXTransWrite _XimXTransWritev _Ximctstombs _Ximctstoutf8 _Ximctstowcs _XkbCopyFromReadBuffer _XkbFreeReadBuffer _XkbGetAtomNameFunc _XkbGetCharset _XkbGetConverters _XkbGetReadBufferCountedString _XkbGetReadBufferPtr _XkbInitReadBuffer _XkbInternAtomFunc _XkbNoteCoreMapChanges _XkbPeekAtReadBuffer (arch=amd64 ia64 alpha ppc64 arm64)_XkbReadBufferCopy32 _XkbReadBufferCopyKeySyms (arch=amd64 ia64 alpha ppc64 arm64)_XkbReadCopyData32 _XkbReadCopyKeySyms _XkbReadGetCompatMapReply _XkbReadGetGeometryReply _XkbReadGetIndicatorMapReply _XkbReadGetMapReply _XkbReadGetNamesReply _XkbReloadDpy _XkbSkipReadBufferData (arch=amd64 ia64 alpha ppc64 arm64)_XkbWriteCopyData32 _XkbWriteCopyKeySyms _XkeyTable _XlcAddCT _XlcAddCharSet _XlcAddGB18030LocaleConverters _XlcAddLoader _XlcAddUtf8Converters _XlcAddUtf8LocaleConverters _XlcCloseConverter _XlcCompareISOLatin1 _XlcCompileResourceList _XlcConvert _XlcCopyFromArg _XlcCopyToArg _XlcCountVaList _XlcCreateDefaultCharSet _XlcCreateLC _XlcCreateLocaleDataBase _XlcCurrentLC _XlcDbg_printValue _XlcDeInitLoader _XlcDefaultLoader _XlcDefaultMapModifiers _XlcDestroyLC _XlcDestroyLocaleDataBase _XlcFileName _XlcGenericLoader _XlcGenericMethods _XlcGetCSValues _XlcGetCharSet _XlcGetCharSetWithSide _XlcGetLocaleDataBase _XlcGetResource _XlcGetValues _XlcInitCTInfo _XlcInitLoader _XlcLocaleDirName _XlcLocaleLibDirName _XlcMapOSLocaleName _XlcNCompareISOLatin1 _XlcOpenConverter _XlcParseCharSet _XlcParse_scopemaps _XlcPublicMethods _XlcRemoveLoader _XlcResetConverter _XlcResolveI18NPath _XlcResolveLocaleName _XlcSetConverter _XlcSetValues _XlcUtf8Loader _XlcVaToArgList _XlcValidModSyntax _Xlcmbstoutf8 _Xlcmbstowcs _Xlcmbtowc _Xlcwcstombs _Xlcwctomb _XmbDefaultDrawImageString _XmbDefaultDrawString _XmbDefaultTextEscapement _XmbDefaultTextExtents _XmbDefaultTextPerCharExtents _XmbGenericDrawImageString _XmbGenericDrawString _XmbGenericTextEscapement _XmbGenericTextExtents _XmbGenericTextPerCharExtents _XmbTextListToTextProperty _XmbTextPropertyToTextList _Xmblen _Xmbstoutf8 _Xmbstowcs _Xmbtowc _XomConvert _XomGenericDrawString _XomGenericOpenOM _XomGenericTextExtents _XomGetFontDataFromFontSet _XomInitConverter _XrmDefaultInitParseInfo _XrmInitParseInfo _XrmInternalStringToQuark _Xthread_self_fn _Xutf8DefaultDrawImageString _Xutf8DefaultDrawString _Xutf8DefaultTextEscapement _Xutf8DefaultTextExtents _Xutf8DefaultTextPerCharExtents _Xutf8GenericDrawImageString _Xutf8GenericDrawString _Xutf8GenericTextEscapement _Xutf8GenericTextExtents _Xutf8GenericTextPerCharExtents _Xutf8TextListToTextProperty _Xutf8TextPropertyToTextList _XwcDefaultDrawImageString _XwcDefaultDrawString _XwcDefaultTextEscapement _XwcDefaultTextExtents _XwcDefaultTextPerCharExtents _XwcFreeStringList _XwcGenericDrawImageString _XwcGenericDrawString _XwcGenericTextEscapement _XwcGenericTextExtents _XwcGenericTextPerCharExtents _XwcTextListToTextProperty _XwcTextPropertyToTextList _Xwcscmp _Xwcscpy _Xwcslen _Xwcsncmp _Xwcsncpy _Xwcstombs _Xwctomb _qfree read_EncodingInfo xlocaledir nx-libs-3.5.99.23/doc/libNX_X11/symbols/libNX_X11::symbol-usage_internally.txt0000644000000000000000000152172213614532331023406 0ustar #### KeySymToUcs4 #### imConv.c:122: ucs4 = KeySymToUcs4(keysym); imConv.c:197: ucs4 = (ucs4_t) KeySymToUcs4(symbol); imConv.c:266: ucs4 = (ucs4_t) KeySymToUcs4(symbol); imConv.c:338: ucs4 = (ucs4_t) KeySymToUcs4(symbol); imKStoUCS.c:272:KeySymToUcs4(KeySym keysym) imLcPrs.c:418: ucs = KeySymToUcs4(ks); Ximint.h:195:unsigned int KeySymToUcs4 ( #### XActivateScreenSaver #### FSSaver.c:33:XActivateScreenSaver(register Display *dpy) Xlib.h:1934:extern int XActivateScreenSaver( #### XAddConnectionWatch #### XlibInt.c:2448: * fd with Xlib. Any XConnectionWatchProc registered by XAddConnectionWatch XlibInt.c:2458: * a XConnectionWatchProc with XAddConnectionWatch XlibInt.c:2512: * Any XConnectionWatchProc registered by XAddConnectionWatch XlibInt.c:2550: * Typically a XConnectionWatchProc registered with XAddConnectionWatch XlibInt.c:2643:/* XAddConnectionWatch XlibInt.c:2651:XAddConnectionWatch( XlibInt.c:2662: fprintf(stderr, "XAddConnectionWatch: Got called.\n"); XlibInt.c:2704: * Unregister a callback registered by XAddConnectionWatch. XlibInt.c:2706: * XAddConnectionWatch. Xlib.h:3991:extern Status XAddConnectionWatch( Xlibint.h:209: struct _XConnWatchInfo *conn_watchers; /* XAddConnectionWatch */ Xlibint.h:1246:struct _XConnWatchInfo { /* info from XAddConnectionWatch */ #### XAddExtension #### InitExt.c:69:XExtCodes *XAddExtension (Display *dpy) Xlib.h:1754:extern XExtCodes *XAddExtension( #### XAddHost #### Host.c:105:XAddHost ( Host.c:121:XAddHosts ( Host.c:128: (void) XAddHost(dpy, &hosts[i]); Xlib.h:1938:extern int XAddHost( Xlib.h:1943:extern int XAddHosts( #### XAddHosts #### Host.c:121:XAddHosts ( Xlib.h:1943:extern int XAddHosts( #### XAddPixel #### ImUtil.c:47:static int _XAddPixel(XImage *, long); ImUtil.c:110: * _XAddPixel Adds a constant value to every pixel in an image ImUtil.c:297: image->f.add_pixel = _XAddPixel; ImUtil.c:963:_XAddPixel ( Macros.c:283:#undef XAddPixel Macros.c:284:int XAddPixel( Xutil.h:209:extern int XAddPixel( Xutil.h:225:#define XAddPixel(ximage, value) \ #### XAddToExtensionList #### Font.c:348: XAddToExtensionList(XEHeadOfExtensionList(dpy_union), pData); Font.c:609: XAddToExtensionList(XEHeadOfExtensionList(fs_union), pData); InitExt.c:104:XAddToExtensionList( Xlib.h:1949:extern int XAddToExtensionList( #### XAddToSaveSet #### ChSaveSet.c:50:XAddToSaveSet( Xlib.h:1954:extern int XAddToSaveSet( #### XAllPlanes #### Macros.c:77:unsigned long XAllPlanes(void) { return AllPlanes; } Xlib.h:1798:extern unsigned long XAllPlanes( #### XAllocClassHint #### PropAlloc.c:58:XClassHint *XAllocClassHint (void) Xutil.h:367:extern XClassHint *XAllocClassHint ( #### XAllocColor #### AllCells.c:32:Status XAllocColorCells( AllPlanes.c:32:Status XAllocColorPlanes( cmsAllCol.c:59: * values then use it in a call to XAllocColor. cmsAllCol.c:72: return(_XcmsSetGetColor(XAllocColor, dpy, colormap, pXcmsColor_in_out, cmsAllNCol.c:63: * RGB value is then used in a call to XAllocColor to allocate cmsAllNCol.c:118: * 3. Convert to XColor and call XAllocColor cmsAllNCol.c:121: if (XAllocColor(ccc->dpy, cmap, &XColor_in_out) == 0) { GetColor.c:64: ret = XAllocColor(dpy, cmap, hard_def); GetHColor.c:32:Status XAllocColor( SetGetCols.c:106: if ( !((*xColorProc == XAllocColor) || (*xColorProc == XStoreColor) SetGetCols.c:136: if (*xColorProc == XAllocColor) { Xlib.h:1959:extern Status XAllocColor( Xlib.h:1965:extern Status XAllocColorCells( Xlib.h:1975:extern Status XAllocColorPlanes( #### XAllocColorCells #### AllCells.c:32:Status XAllocColorCells( Xlib.h:1965:extern Status XAllocColorCells( #### XAllocColorPlanes #### AllPlanes.c:32:Status XAllocColorPlanes( Xlib.h:1975:extern Status XAllocColorPlanes( #### XAllocIconSize #### PropAlloc.c:64:XIconSize *XAllocIconSize (void) Xutil.h:371:extern XIconSize *XAllocIconSize ( #### XAllocNamedColor #### GetColor.c:35:XAllocNamedColor( Xcmsint.h:73: * XAllocNamedColor() Xlib.h:1989:extern Status XAllocNamedColor( #### XAllocSizeHints #### PropAlloc.c:40:XSizeHints *XAllocSizeHints (void) Xutil.h:375:extern XSizeHints *XAllocSizeHints ( #### XAllocStandardColormap #### PropAlloc.c:46:XStandardColormap *XAllocStandardColormap (void) Xutil.h:379:extern XStandardColormap *XAllocStandardColormap ( #### XAllocWMHints #### PropAlloc.c:52:XWMHints *XAllocWMHints (void) Xutil.h:383:extern XWMHints *XAllocWMHints ( #### XAllowEvents #### AllowEv.c:33:XAllowEvents( Xlib.h:1997:extern int XAllowEvents( #### XAutoRepeatOff #### AutoRep.c:42:XAutoRepeatOff (register Display *dpy) Xlib.h:2003:extern int XAutoRepeatOff( #### XAutoRepeatOn #### AutoRep.c:33:XAutoRepeatOn (register Display *dpy) Xlib.h:2007:extern int XAutoRepeatOn( #### XBaseFontNameListOfFontSet #### FSWrap.c:219:XBaseFontNameListOfFontSet(XFontSet font_set) Xlib.h:3650:extern char *XBaseFontNameListOfFontSet( #### XBell #### Bell.c:33:XBell( imThaiFlt.c:1084: XBell(event->display, BellVolume); imThaiFlt.c:1403: XBell(ev->xkey.display, BellVolume); XKBBell.c:150: XBell(dpy, percent); XKBBell.c:162: XBell(dpy, percent); Xlib.h:2011:extern int XBell( #### XBitmapBitOrder #### Macros.c:135:int XBitmapBitOrder(Display *dpy) { return (BitmapBitOrder(dpy)); } Xlib.h:2016:extern int XBitmapBitOrder( #### XBitmapPad #### Macros.c:137:int XBitmapPad(Display *dpy) { return (BitmapPad(dpy)); } Xlib.h:2020:extern int XBitmapPad( #### XBitmapUnit #### Macros.c:133:int XBitmapUnit(Display *dpy) { return (BitmapUnit(dpy)); } Xlib.h:2024:extern int XBitmapUnit( #### XBlackPixel #### Macros.c:67:unsigned long XBlackPixel(Display *dpy, int scr) Macros.c:184:unsigned long XBlackPixelOfScreen(Screen *s) Xlib.h:1790:extern unsigned long XBlackPixel( Xlib.h:1801:extern unsigned long XBlackPixelOfScreen( #### XBlackPixelOfScreen #### Macros.c:184:unsigned long XBlackPixelOfScreen(Screen *s) Xlib.h:1801:extern unsigned long XBlackPixelOfScreen( #### XCellsOfScreen #### Macros.c:224:int XCellsOfScreen(Screen *s) { return (CellsOfScreen(s)); } Xlib.h:2028:extern int XCellsOfScreen( #### XChangeActivePointerGrab #### ChActPGb.c:33:XChangeActivePointerGrab( Xlib.h:2032:extern int XChangeActivePointerGrab( #### XChangeGC #### ChGC.c:34:XChangeGC ( omImText.c:59: XChangeGC(dpy, gc, SET_VALUE_MASK, &values); Xlib.h:2039:extern int XChangeGC( #### XChangeKeyboardControl #### AutoRep.c:37: XChangeKeyboardControl (dpy, KBAutoRepeatMode, &values); AutoRep.c:46: XChangeKeyboardControl (dpy, KBAutoRepeatMode, &values); ChKeyCon.c:33:XChangeKeyboardControl( imThaiFlt.c:1176: XChangeKeyboardControl (dpy, KBLed | KBLedMode, &led_control); Xlib.h:443:/* Data structure for XChangeKeyboardControl */ Xlib.h:2046:extern int XChangeKeyboardControl( #### XChangeKeyboardMapping #### SetPntMap.c:55:XChangeKeyboardMapping ( Xlib.h:2052:extern int XChangeKeyboardMapping( #### XChangePointerControl #### ChPntCon.c:33:XChangePointerControl( Xlib.h:2060:extern int XChangePointerControl( #### XChangeProperty #### ChProp.c:33:XChangeProperty ( imTrX.c:287: XChangeProperty(im->core.display, spec->ims_connect_wid, imTrX.c:387: XChangeProperty(im->core.display, spec->lib_connect_wid, prop, imTrX.c:410: XChangeProperty(im->core.display, spec->lib_connect_wid, prop, imTrX.c:435: XChangeProperty(im->core.display, spec->lib_connect_wid, prop, SetHints.c:96: return XChangeProperty (dpy, w, property, XA_WM_SIZE_HINTS, 32, SetHints.c:131: return XChangeProperty (dpy, w, XA_WM_HINTS, XA_WM_HINTS, 32, SetHints.c:171: * when examining a protocol structure. This is because the XChangeProperty SetHints.c:198: XChangeProperty (dpy, w, XA_WM_ICON_SIZE, XA_WM_ICON_SIZE, 32, SetHints.c:229: XChangeProperty (dpy, w, XA_WM_COMMAND, XA_STRING, 8, SetHints.c:261: XChangeProperty (dpy, w, XA_WM_ICON_NAME, XA_STRING, 8, SetHints.c:286: return XChangeProperty(dpy, w, XA_WM_TRANSIENT_FOR, XA_WINDOW, 32, SetHints.c:313: XChangeProperty(dpy, w, XA_WM_CLASS, XA_STRING, 8, SetNrmHint.c:114: XChangeProperty (dpy, w, prop, XA_WM_SIZE_HINTS, 32, SetRGBCMap.c:87: XChangeProperty (dpy, w, property, XA_RGB_COLOR_MAP, 32, mode, SetRGBCMap.c:95: XChangeProperty (dpy, w, property, XA_RGB_COLOR_MAP, 32, SetTxtProp.c:66: XChangeProperty (dpy, w, property, tp->encoding, tp->format, SetWMCMapW.c:71: XChangeProperty (dpy, w, prop, XA_WINDOW, 32, SetWMProto.c:71: XChangeProperty (dpy, w, prop, XA_ATOM, 32, StBytes.c:96: return XChangeProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], StName.c:39: return XChangeProperty(dpy, w, XA_WM_NAME, XA_STRING, StName.c:50: return XChangeProperty(dpy, w, XA_WM_ICON_NAME, XA_STRING, 8, WMProps.c:143: XChangeProperty (dpy, w, XInternAtom(dpy, "WM_LOCALE_NAME", False), Xatomtype.h:54: * XChangeProperty. All fields must be longs as the semantics of property Xlib.h:2069:extern int XChangeProperty( #### XChangeSaveSet #### ChSaveSet.c:33:XChangeSaveSet( ChSaveSet.c:54: return XChangeSaveSet(dpy,win,SetModeInsert); ChSaveSet.c:62: return XChangeSaveSet(dpy,win,SetModeDelete); Xlib.h:2080:extern int XChangeSaveSet( #### XChangeWindowAttributes #### ChWAttrs.c:39:XChangeWindowAttributes ( Xlib.h:2086:extern int XChangeWindowAttributes( #### XCheckIfEvent #### ChkIfEv.c:38:Bool XCheckIfEvent ( ChkIfEv.c:88: * This is just like XCheckIfEvent() but doesn't ChkIfEv.c:93:Bool XCheckIfEventNoFlush ( Xlib.h:2093:extern Bool XCheckIfEvent( Xlib.h:2107: * This is just like XCheckIfEvent() but doesn't Xlib.h:2112:extern Bool XCheckIfEventNoFlush( #### XCheckIfEventNoFlush #### ChkIfEv.c:93:Bool XCheckIfEventNoFlush ( Xlib.h:2112:extern Bool XCheckIfEventNoFlush( #### XCheckMaskEvent #### ChkMaskEv.c:44:Bool XCheckMaskEvent ( Xlib.h:2125:extern Bool XCheckMaskEvent( #### XCheckTypedEvent #### ChkTypEv.c:38:Bool XCheckTypedEvent ( Xlib.h:2131:extern Bool XCheckTypedEvent( #### XCheckTypedWindowEvent #### ChkTypWEv.c:38:Bool XCheckTypedWindowEvent ( Xlib.h:2137:extern Bool XCheckTypedWindowEvent( #### XCheckWindowEvent #### ChkWinEv.c:43:Bool XCheckWindowEvent ( Xlib.h:2144:extern Bool XCheckWindowEvent( #### XCirculateSubwindows #### CirWin.c:33:XCirculateSubwindows( CirWinDn.c:33:XCirculateSubwindowsDown( CirWinUp.c:33:XCirculateSubwindowsUp( Xlib.h:2151:extern int XCirculateSubwindows( Xlib.h:2157:extern int XCirculateSubwindowsDown( Xlib.h:2162:extern int XCirculateSubwindowsUp( #### XCirculateSubwindowsDown #### CirWinDn.c:33:XCirculateSubwindowsDown( Xlib.h:2157:extern int XCirculateSubwindowsDown( #### XCirculateSubwindowsUp #### CirWinUp.c:33:XCirculateSubwindowsUp( Xlib.h:2162:extern int XCirculateSubwindowsUp( #### XClearArea #### ClearArea.c:33:XClearArea ( locking.c:186: if (strcmp("XClearArea.c", file) && strcmp("XDrSegs.c", file)) /* ico */ locking.c:214: if (strcmp("XClearArea.c", file) && strcmp("XDrSegs.c", file)) /* ico */ Xlib.h:2167:extern int XClearArea( #### XClearWindow #### Clear.c:33:XClearWindow( Xlib.h:2177:extern int XClearWindow( #### XClipBox #### Region.c:158:XClipBox( Xutil.h:387:extern int XClipBox( #### XCloseDisplay #### ClDisplay.c:43: * XCloseDisplay - XSync the connection to the X Server, close the connection, ClDisplay.c:49:XCloseDisplay ( OpenDis.c:844: * and also by XCloseDisplay. It needs to check whether all pointers XKB.c:761: XCloseDisplay(dpy); Xlib.h:2182:extern int XCloseDisplay( #### XCloseIM #### IMWrap.c:128:XCloseIM(XIM im) XlcDL.c:287: * since XCloseIM, XCloseOM, XlcClose aren't wrapped, but directly Xlib.h:3855:extern Status XCloseIM( #### XCloseOM #### FSWrap.c:202: XCloseOM(om); FSWrap.c:261: XCloseOM(font_set->core.om); OMWrap.c:48:XCloseOM(XOM om) XlcDL.c:287: * since XCloseIM, XCloseOM, XlcClose aren't wrapped, but directly Xlcint.h:370:typedef Status (*XCloseOMProc)( Xlcint.h:393: XCloseOMProc close; Xlib.h:3586:extern Status XCloseOM( #### XConfigureWindow #### ReconfWin.c:36:XConfigureWindow( ReconfWM.c:53: XConfigureWindow (dpy, w, mask, changes); ReconfWM.c:59: * We need to inline XConfigureWindow and XSync so that everything is done ReconfWM.c:66: * XConfigureWindow (dpy, w, mask, changes); Xlib.h:2186:extern int XConfigureWindow( #### XConnectionNumber #### Macros.c:43:int XConnectionNumber(Display *dpy) { return (ConnectionNumber(dpy)); } Xlib.h:2193:extern int XConnectionNumber( #### XContextDependentDrawing #### FSWrap.c:231:XContextDependentDrawing(XFontSet font_set) Xlib.h:3658:extern Bool XContextDependentDrawing( #### XContextualDrawing #### FSWrap.c:243:XContextualDrawing(XFontSet font_set) Xlib.h:3666:extern Bool XContextualDrawing( #### XConvertCase #### imThaiFlt.c:798: XConvertCase(syms[0], keysym_return, &usym); imThaiFlt.c:800: XConvertCase(syms[0], &lsym, &usym); imThaiFlt.c:806: XConvertCase(syms[0], &lsym, &usym); imThaiFlt.c:811: XConvertCase(sym, &lsym, &usym); imThaiFlt.c:814: XConvertCase(syms[0], &lsym, &usym); KeyBind.c:105: XConvertCase(syms[col&~1], &lsym, &usym); KeyBind.c:641:XConvertCase( KeyBind.c:793: XConvertCase(syms[0], keysym_return, &usym); KeyBind.c:799: XConvertCase(syms[0], &lsym, &usym); KeyBind.c:804: XConvertCase(sym, &lsym, &usym); KeyBind.c:807: XConvertCase(syms[0], &lsym, &usym); XKBCvt.c:165: XConvertCase(sym, &lower, &upper); XKBMisc.c:219: XConvertCase(syms[0], &lower, &upper); XKBMisc.c:238: XConvertCase(syms[0], &lower, &upper); Xutil.h:529:extern void XConvertCase( #### XConvertSelection #### ConvSel.c:33:XConvertSelection( imDefIm.c:340: XConvertSelection(display, selection, locales, locales, window, imDefIm.c:363: XConvertSelection(display, selection, transport, transport, window, Xlib.h:2197:extern int XConvertSelection( #### XCopyArea #### CopyArea.c:33:XCopyArea( Xlib.h:2206:extern int XCopyArea( #### XCopyColormapAndFree #### cmsCmap.c:287: * Augments Xlib's XCopyColormapAndFree() to copy CopyCmap.c:43:Colormap XCopyColormapAndFree( Xlib.h:1549:extern Colormap XCopyColormapAndFree( #### XCopyGC #### CopyGC.c:33:XCopyGC ( Xlib.h:2219:extern int XCopyGC( #### XCopyPlane #### CopyPlane.c:33:XCopyPlane( Xlib.h:2226:extern int XCopyPlane( #### XCreateBitmapFromData #### CrBFData.c:33: * XCreateBitmapFromData: Routine to make a pixmap of depth 1 from user CrBFData.c:49:Pixmap XCreateBitmapFromData( RdBitF.c:256: *pixmap = XCreateBitmapFromData(display, d, (char *)data, *width, *height); Xlib.h:1605:extern Pixmap XCreateBitmapFromData( #### XCreateColormap #### CrCmap.c:34:Colormap XCreateColormap( Xlib.h:1553:extern Colormap XCreateColormap( #### XCreateFontCursor #### Cursor.c:34:Cursor XCreateFontCursor( Xlib.h:1577:extern Cursor XCreateFontCursor( Xlibint.h:184: Font cursor_font; /* for XCreateFontCursor */ #### XCreateFontSet #### FSWrap.c:164:XCreateFontSet ( imRmAttr.c:338: rep = XCreateFontSet(ic->core.im->core.display, imRmAttr.c:346: rep = XCreateFontSet(ic->core.im->core.display, Xlib.h:3631:extern XFontSet XCreateFontSet( #### XCreateGC #### CrBFData.c:57: GC gc = XCreateGC(display, pix, (unsigned long) 0, (XGCValues *) 0); CrGC.c:64:GC XCreateGC ( CrPFBData.c:66: GC gc = XCreateGC(display, pix, GCForeground|GCBackground, &gcv); OpenDis.c:724: if ((sp->default_gc = XCreateGC (dpy, sp->root, Xlib.h:1585:extern GC XCreateGC( #### XCreateGlyphCursor #### CrGlCur.c:225:Cursor XCreateGlyphCursor( Cursor.c:50: return XCreateGlyphCursor (dpy, dpy->cursor_font, dpy->cursor_font, Xlib.h:1568:extern Cursor XCreateGlyphCursor( #### XCreateIC #### ICWrap.c:228:XCreateIC(XIM im, ...) Xlib.h:3875:extern XIC XCreateIC( #### XCreateImage #### GetImage.c:96: image = XCreateImage(dpy, _XVIDtoVisual(dpy, rep.visual), GetImage.c:102: image = XCreateImage (dpy, _XVIDtoVisual(dpy, rep.visual), ImUtil.c:96: * XCreateImage Creates a default XImage data structure ImUtil.c:274: image->f.create_image = XCreateImage; ImUtil.c:308:XImage *XCreateImage ( ImUtil.c:323: XCreateImage can calculate it.*/ Xlib.h:1442:extern XImage *XCreateImage( #### XCreateOC #### FSWrap.c:182: if ((oc = XCreateOC(om, XNBaseFontName, base_font_name_list, NULL))) { OCWrap.c:33:XCreateOC(XOM om, ...) Xlcint.h:386:typedef XOC (*XCreateOCProc)( Xlcint.h:396: XCreateOCProc create_oc; Xlib.h:3608:extern XOC XCreateOC( #### XCreatePixmap #### CrBFData.c:56: Pixmap pix = XCreatePixmap(display, d, width, height, 1); CrCursor.c:43:Cursor XCreatePixmapCursor( CrPFBData.c:34: * XCreatePixmapFromBitmapData: Routine to make a pixmap from user supplied bitmap data. CrPFBData.c:51:Pixmap XCreatePixmapFromBitmapData( CrPFBData.c:61: Pixmap pix = XCreatePixmap(display, d, width, height, depth); CrPixmap.c:40:Pixmap XCreatePixmap ( Xlib.h:1559:extern Cursor XCreatePixmapCursor( Xlib.h:1598:extern Pixmap XCreatePixmap( Xlib.h:1612:extern Pixmap XCreatePixmapFromBitmapData( #### XCreatePixmapCursor #### CrCursor.c:43:Cursor XCreatePixmapCursor( Xlib.h:1559:extern Cursor XCreatePixmapCursor( #### XCreatePixmapFromBitmapData #### CrPFBData.c:34: * XCreatePixmapFromBitmapData: Routine to make a pixmap from user supplied bitmap data. CrPFBData.c:51:Pixmap XCreatePixmapFromBitmapData( Xlib.h:1612:extern Pixmap XCreatePixmapFromBitmapData( #### XCreateRegion #### PolyReg.c:494: if (! (region = XCreateRegion())) return (Region) NULL; Region.c:138:XCreateRegion(void) Region.c:387: if (! (s = XCreateRegion()) ) Region.c:389: if (! (t = XCreateRegion()) ) { Region.c:1457: if (! (tra = XCreateRegion()) ) Region.c:1459: if (! (trb = XCreateRegion()) ) { Xutil.h:392:extern Region XCreateRegion( #### XCreateSimpleWindow #### CrWindow.c:32:Window XCreateSimpleWindow( imDefIm.c:297: if(!(window = XCreateSimpleWindow(display, DefaultRootWindow(display), imTrans.c:111: if (!(window = XCreateSimpleWindow(im->core.display, imTrX.c:164: if (!(spec->lib_connect_wid = XCreateSimpleWindow(im->core.display, Xlib.h:1622:extern Window XCreateSimpleWindow( #### XCreateWindow #### EvToWire.c:185: register XCreateWindowEvent *ev = EvToWire.c:186: (XCreateWindowEvent *) re; imEvToWire.c:188: register XCreateWindowEvent *ev = imEvToWire.c:189: (XCreateWindowEvent *) re; imEvToWire.c:568: register XCreateWindowEvent *ev = imEvToWire.c:569: (XCreateWindowEvent *) re; Window.c:100:Window XCreateWindow( XlibInt.c:3228: register XCreateWindowEvent *ev = XlibInt.c:3229: (XCreateWindowEvent *) re; Xlib.h:717:} XCreateWindowEvent; Xlib.h:986: XCreateWindowEvent xcreatewindow; Xlib.h:1637:extern Window XCreateWindow( #### XDefaultColormap #### Macros.c:128:Colormap XDefaultColormap(Display *dpy, int scr) Macros.c:194:Colormap XDefaultColormapOfScreen(Screen *s) Xlib.h:1819:extern Colormap XDefaultColormap( Xlib.h:1823:extern Colormap XDefaultColormapOfScreen( #### XDefaultColormapOfScreen #### Macros.c:194:Colormap XDefaultColormapOfScreen(Screen *s) Xlib.h:1823:extern Colormap XDefaultColormapOfScreen( #### XDefaultDepth #### Macros.c:123:int XDefaultDepth(Display *dpy, int scr) Macros.c:199:int XDefaultDepthOfScreen(Screen *s) Xlib.h:2240:extern int XDefaultDepth( Xlib.h:2245:extern int XDefaultDepthOfScreen( #### XDefaultDepthOfScreen #### Macros.c:199:int XDefaultDepthOfScreen(Screen *s) Xlib.h:2245:extern int XDefaultDepthOfScreen( #### XDefaultGC #### Macros.c:62:GC XDefaultGC(Display *dpy, int scr) Macros.c:204:GC XDefaultGCOfScreen(Screen *s) Xlib.h:1783:extern GC XDefaultGC( Xlib.h:1787:extern GC XDefaultGCOfScreen( #### XDefaultGCOfScreen #### Macros.c:204:GC XDefaultGCOfScreen(Screen *s) Xlib.h:1787:extern GC XDefaultGCOfScreen( #### XDefaultRootWindow #### Macros.c:52:Window XDefaultRootWindow (Display *dpy) Xlib.h:1770:extern Window XDefaultRootWindow( #### XDefaultScreen #### Macros.c:50:int XDefaultScreen(Display *dpy) { return (DefaultScreen(dpy)); } Macros.c:175:Screen *XDefaultScreenOfDisplay(Display *dpy) Xlib.h:1833:extern Screen *XDefaultScreenOfDisplay( Xlib.h:2249:extern int XDefaultScreen( #### XDefaultScreenOfDisplay #### Macros.c:175:Screen *XDefaultScreenOfDisplay(Display *dpy) Xlib.h:1833:extern Screen *XDefaultScreenOfDisplay( #### XDefaultString #### lcGenConv.c:939: /* output default_string of XDefaultString() */ lcGenConv.c:1965: /* output default_string of XDefaultString() */ lcWrap.c:488:XDefaultString(void) Xlcint.h:309:typedef const char* (*XDefaultStringProc)( Xlcint.h:326: XDefaultStringProc default_string; XlcPubI.h:94: const char *default_string; /* for XDefaultString() */ Xutil.h:396:extern const char *XDefaultString (void); #### XDefaultVisual #### Macros.c:57:Visual *XDefaultVisual(Display *dpy, int scr) Macros.c:209:Visual *XDefaultVisualOfScreen(Screen *s) Xlib.h:1776:extern Visual *XDefaultVisual( Xlib.h:1780:extern Visual *XDefaultVisualOfScreen( #### XDefaultVisualOfScreen #### Macros.c:209:Visual *XDefaultVisualOfScreen(Screen *s) Xlib.h:1780:extern Visual *XDefaultVisualOfScreen( #### XDefineCursor #### DefCursor.c:33:XDefineCursor ( Xlib.h:2253:extern int XDefineCursor( #### XDeleteContext #### Context.c:57: XDeleteContext(a,b,c) will delete the entry in (a,b,c). Context.c:271:int XDeleteContext(Display *display, XID rid, XContext context) Xutil.h:398:extern int XDeleteContext( #### XDeleteModifiermapEntry #### ModMap.c:167:XDeleteModifiermapEntry(XModifierKeymap *map, Xlib.h:1414:extern XModifierKeymap *XDeleteModifiermapEntry( #### XDeleteProperty #### DelProp.c:33:XDeleteProperty( Xlib.h:2259:extern int XDeleteProperty( #### XDestroyIC #### ICWrap.c:263:XDestroyIC(XIC ic) XDefaultIMIF.c:358:/*BugId4255571. This Xfree() should be removed because XDestroyIC() still need ic after invoking _DestroyIC() and there is a XFree(ic) at the end of XDestroyIC() already. Xlib.h:3879:extern void XDestroyIC( #### XDestroyImage #### GetImage.c:31:#include /* for XDestroyImage */ GetImage.c:114: XDestroyImage(image); GetImage.c:141: XDestroyImage(temp_image); ImUtil.c:35:static int _XDestroyImage(XImage *); ImUtil.c:97: * _XDestroyImage Deletes an XImage data structure ImUtil.c:275: image->f.destroy_image = _XDestroyImage; ImUtil.c:435:static int _XDestroyImage (XImage *ximage) Macros.c:252:#undef XDestroyImage Macros.c:254:XDestroyImage( WrBitF.c:123: XDestroyImage(image); Xutil.h:196:extern int XDestroyImage( Xutil.h:217:#define XDestroyImage(ximage) \ #### XDestroyOC #### OCWrap.c:64:XDestroyOC(XOC oc) Xlcint.h:420:typedef void (*XDestroyOCProc)( Xlcint.h:542: XDestroyOCProc destroy; Xlib.h:3613:extern void XDestroyOC( #### XDestroyRegion #### PolyReg.c:523: XDestroyRegion(region); Region.c:284:XDestroyRegion( Region.c:390: XDestroyRegion(s); Region.c:398: XDestroyRegion(s); Region.c:399: XDestroyRegion(t); Region.c:1460: XDestroyRegion(tra); Region.c:1466: XDestroyRegion(tra); Region.c:1467: XDestroyRegion(trb); Xutil.h:404:extern int XDestroyRegion( #### XDestroySubwindows #### DestSubs.c:33:XDestroySubwindows( Xlib.h:2270:extern int XDestroySubwindows( #### XDestroyWindow #### cmsCmap.c:212: XDestroyWindow(dpy, tmpWindow); DestWind.c:33:XDestroyWindow ( EvToWire.c:199: register XDestroyWindowEvent *ev = EvToWire.c:200: (XDestroyWindowEvent *) re; imDefIm.c:375: XDestroyWindow(display, window); imDefIm.c:386: XDestroyWindow(display, window); imEvToWire.c:202: register XDestroyWindowEvent *ev = imEvToWire.c:203: (XDestroyWindowEvent *) re; imEvToWire.c:582: register XDestroyWindowEvent *ev = imEvToWire.c:583: (XDestroyWindowEvent *) re; imTrans.c:137: XDestroyWindow(im->core.display, spec->window); imTrX.c:239: XDestroyWindow(im->core.display, XlibInt.c:3242: register XDestroyWindowEvent *ev = XlibInt.c:3243: (XDestroyWindowEvent *) re; Xlib.h:726:} XDestroyWindowEvent; Xlib.h:987: XDestroyWindowEvent xdestroywindow; Xlib.h:2265:extern int XDestroyWindow( #### XDirectionalDependentDrawing #### FSWrap.c:237:XDirectionalDependentDrawing(XFontSet font_set) Xlib.h:3662:extern Bool XDirectionalDependentDrawing( #### XDisableAccessControl #### ChAccCon.c:39:XDisableAccessControl(register Display *dpy) Xlib.h:2283:extern int XDisableAccessControl( #### XDisplayCells #### Macros.c:106:int XDisplayCells(Display *dpy, int scr) Xlib.h:2288:extern int XDisplayCells( #### XDisplayHeight #### Macros.c:86:int XDisplayHeight(Display *dpy, int scr) Macros.c:96:int XDisplayHeightMM(Display *dpy, int scr) Xlib.h:2293:extern int XDisplayHeight( Xlib.h:2298:extern int XDisplayHeightMM( #### XDisplayHeightMM #### Macros.c:96:int XDisplayHeightMM(Display *dpy, int scr) Xlib.h:2298:extern int XDisplayHeightMM( #### XDisplayKeycodes #### Misc.c:48:XDisplayKeycodes( Xlib.h:2303:extern int XDisplayKeycodes( #### XDisplayMotionBufferSize #### Misc.c:42:unsigned long XDisplayMotionBufferSize(Display *dpy) Xlib.h:1726:extern unsigned long XDisplayMotionBufferSize( #### XDisplayName #### ConnDis.c:640: * XDisplayString() and XDisplayName() agree. DisName.c:30:/* XDisplayName.c */ DisName.c:40: * strncpy( displaybuf, XDisplayName( display ), sizeof(displaybuf) ); DisName.c:55:XDisplayName( Xlib.h:1516:extern char *XDisplayName( #### XDisplayOfIM #### IMWrap.c:146:XDisplayOfIM(XIM im) Xlib.h:3867:extern Display *XDisplayOfIM( #### XDisplayOfOM #### OMWrap.c:120:XDisplayOfOM(XOM om) Xlib.h:3600:extern Display *XDisplayOfOM( #### XDisplayOfScreen #### Macros.c:180:Display *XDisplayOfScreen(Screen *s) { return (DisplayOfScreen(s)); } Xlib.h:1826:extern Display *XDisplayOfScreen( #### XDisplayPlanes #### Macros.c:101:int XDisplayPlanes(Display *dpy, int scr) Xlib.h:2309:extern int XDisplayPlanes( #### XDisplayString #### ConnDis.c:640: * XDisplayString() and XDisplayName() agree. Macros.c:121:char *XDisplayString(Display *dpy) { return (DisplayString(dpy)); } Xlib.h:1816:extern char *XDisplayString( #### XDisplayWidth #### Macros.c:81:int XDisplayWidth(Display *dpy, int scr) Macros.c:91:int XDisplayWidthMM(Display *dpy, int scr) Xlib.h:2314:extern int XDisplayWidth( Xlib.h:2319:extern int XDisplayWidthMM( #### XDisplayWidthMM #### Macros.c:91:int XDisplayWidthMM(Display *dpy, int scr) Xlib.h:2319:extern int XDisplayWidthMM( #### XDoesBackingStore #### Macros.c:232:int XDoesBackingStore(Screen *s) { return (DoesBackingStore(s)); } Xlib.h:2275:extern int XDoesBackingStore( #### XDoesSaveUnders #### Macros.c:230:Bool XDoesSaveUnders(Screen *s) { return (DoesSaveUnders(s)); } Xlib.h:2279:extern Bool XDoesSaveUnders( #### XDrawArc #### DrArc.c:27:/* Note to future maintainers: XDrawArc does NOT batch successive PolyArc DrArc.c:39:XDrawArc( DrArcs.c:35:XDrawArcs( Xlib.h:2324:extern int XDrawArc( Xlib.h:2336:extern int XDrawArcs( #### XDrawArcs #### DrArcs.c:35:XDrawArcs( Xlib.h:2336:extern int XDrawArcs( #### XDrawImageString16 #### ImText16.c:33:XDrawImageString16( Xlib.h:2354:extern int XDrawImageString16( #### XDrawImageString #### ImText16.c:33:XDrawImageString16( ImText.c:33:XDrawImageString( omDefault.c:410: XDrawImageString(dpy, d, gc, x, y, text, length); XDefaultOMIF.c:814: XDrawImageString(dpy, d, gc, x, y, text, length); Xlib.h:2344:extern int XDrawImageString( Xlib.h:2354:extern int XDrawImageString16( #### XDrawLine #### DrArc.c:28: requests into a single request like XDrawLine, XDrawPoint, etc. DrLine.c:38:XDrawLine ( DrLines.c:33:XDrawLines ( Xlib.h:2364:extern int XDrawLine( Xlib.h:2374:extern int XDrawLines( #### XDrawLines #### DrLines.c:33:XDrawLines ( Xlib.h:2374:extern int XDrawLines( #### XDrawPoint #### DrArc.c:28: requests into a single request like XDrawLine, XDrawPoint, etc. DrPoint.c:37:XDrawPoint( DrPoints.c:33:XDrawPoints( Xlib.h:2383:extern int XDrawPoint( Xlib.h:2391:extern int XDrawPoints( #### XDrawPoints #### DrPoints.c:33:XDrawPoints( Xlib.h:2391:extern int XDrawPoints( #### XDrawRectangle #### DrRect.c:38:XDrawRectangle( DrRects.c:33:XDrawRectangles( Xlib.h:2400:extern int XDrawRectangle( Xlib.h:2410:extern int XDrawRectangles( #### XDrawRectangles #### DrRects.c:33:XDrawRectangles( Xlib.h:2410:extern int XDrawRectangles( #### XDrawSegments #### DrSegs.c:33:XDrawSegments ( Xlib.h:2418:extern int XDrawSegments( #### XDrawString16 #### omText.c:123: XDrawString16(dpy, d, gc, wx, wy, buf2b, 1); omText.c:130: XDrawString16(dpy, d, gc, wx, wy, buf2b, 1); omText.c:212: XDrawString16(dpy, d, gc, x, y, (XChar2b *)ptr, char_len); Text16.c:33:XDrawString16( Xlib.h:2436:extern int XDrawString16( #### XDrawString #### omDefault.c:352: XDrawString(dpy, d, gc, x, y, text, length); omText.c:123: XDrawString16(dpy, d, gc, wx, wy, buf2b, 1); omText.c:130: XDrawString16(dpy, d, gc, wx, wy, buf2b, 1); omText.c:143: XDrawString(dpy, d, gc, wx, wy, buf, 1); omText.c:150: XDrawString(dpy, d, gc, wx, wy, buf, 1); omText.c:212: XDrawString16(dpy, d, gc, x, y, (XChar2b *)ptr, char_len); omText.c:216: XDrawString(dpy, d, gc, x, y, (char *)ptr, char_len); Text16.c:33:XDrawString16( Text.c:33:XDrawString( XDefaultOMIF.c:782: XDrawString(dpy, d, gc, x, y, text, length); Xlib.h:2426:extern int XDrawString( Xlib.h:2436:extern int XDrawString16( #### XDrawText16 #### PolyTxt16.c:33:XDrawText16( Xlib.h:2456:extern int XDrawText16( #### XDrawText #### PolyTxt16.c:33:XDrawText16( PolyTxt.c:33:XDrawText( Xlib.h:2446:extern int XDrawText( Xlib.h:2456:extern int XDrawText16( #### XEHeadOfExtensionList #### Font.c:321: pData = XFindOnExtensionList(XEHeadOfExtensionList(dpy_union), Font.c:348: XAddToExtensionList(XEHeadOfExtensionList(dpy_union), pData); Font.c:609: XAddToExtensionList(XEHeadOfExtensionList(fs_union), pData); Font.c:637: if ((pData = XFindOnExtensionList(XEHeadOfExtensionList(fs_union), InitExt.c:98:XExtData **XEHeadOfExtensionList(XEDataObject object) Xlib.h:1761:extern XExtData **XEHeadOfExtensionList( #### XESetBeforeFlush #### InitExt.c:389:BeforeFlushType XESetBeforeFlush( Xlibint.h:1197:extern void (*XESetBeforeFlush( #### XESetCloseDisplay #### InitExt.c:218:CloseDisplayType XESetCloseDisplay( Xlibint.h:1086:extern int (*XESetCloseDisplay( #### XESetCopyEventCookie #### InitExt.c:280:CopyEventCookieType XESetCopyEventCookie( Xlibint.h:1160:extern Bool (*XESetCopyEventCookie( #### XESetCopyGC #### InitExt.c:143:CopyGCType XESetCopyGC( Xlibint.h:1026:extern int (*XESetCopyGC( #### XESetCreateFont #### InitExt.c:188:CreateFontType XESetCreateFont( Xlibint.h:1062:extern int (*XESetCreateFont( #### XESetCreateGC #### InitExt.c:128:CreateGCType XESetCreateGC( Xlibint.h:1014:extern int (*XESetCreateGC( #### XESetError #### InitExt.c:344:ErrorType XESetError( InitExt.c:359:ErrorStringType XESetErrorString( Xlibint.h:1097:extern int (*XESetError( Xlibint.h:1110:extern char* (*XESetErrorString( #### XESetErrorString #### InitExt.c:359:ErrorStringType XESetErrorString( Xlibint.h:1110:extern char* (*XESetErrorString( #### XESetEventToWire #### InitExt.c:302:EventToWireType XESetEventToWire( Xlibint.h:1173:extern Status (*XESetEventToWire( #### XESetFlushGC #### InitExt.c:158:FlushGCType XESetFlushGC( Xlibint.h:1038:extern int (*XESetFlushGC( #### XESetFreeFont #### InitExt.c:203:FreeFontType XESetFreeFont( Xlibint.h:1074:extern int (*XESetFreeFont( #### XESetFreeGC #### InitExt.c:173:FreeGCType XESetFreeGC( Xlibint.h:1050:extern int (*XESetFreeGC( #### XESetPrintErrorValues #### InitExt.c:374:PrintErrorType XESetPrintErrorValues( Xlibint.h:1124:extern void (*XESetPrintErrorValues ( #### XESetWireToError #### InitExt.c:322:WireToErrorType XESetWireToError( Xlibint.h:1185:extern Bool (*XESetWireToError( #### XESetWireToEvent #### InitExt.c:239:WireToEventType XESetWireToEvent( InitExt.c:259:WireToEventCookieType XESetWireToEventCookie( XKBUse.c:811: XESetWireToEvent(dpy, ev_base + XkbEventCode, wire_to_event); Xlibint.h:1136:extern Bool (*XESetWireToEvent( Xlibint.h:1148:extern Bool (*XESetWireToEventCookie( #### XESetWireToEventCookie #### InitExt.c:259:WireToEventCookieType XESetWireToEventCookie( Xlibint.h:1148:extern Bool (*XESetWireToEventCookie( #### XEmptyRegion #### Region.c:1476:XEmptyRegion( Xutil.h:408:extern int XEmptyRegion( #### XEnableAccessControl #### ChAccCon.c:33:XEnableAccessControl(register Display *dpy) Xlib.h:2466:extern int XEnableAccessControl( #### XEqualRegion #### Region.c:1487:XEqualRegion(Region r1, Region r2) Xutil.h:412:extern int XEqualRegion( #### XEventMaskOfScreen #### Macros.c:234:long XEventMaskOfScreen(Screen *s) { return (EventMaskOfScreen(s)); } Xlib.h:1836:extern long XEventMaskOfScreen( #### XEventsQueued #### ChkIfEv.c:71: _XEventsQueued(dpy, QueuedAfterReading); ChkIfEv.c:127: _XEventsQueued(dpy, QueuedAfterReading); ChkMaskEv.c:78: _XEventsQueued(dpy, QueuedAfterReading); ChkTypEv.c:69: _XEventsQueued(dpy, QueuedAfterReading); ChkTypWEv.c:71: _XEventsQueued(dpy, QueuedAfterReading); ChkWinEv.c:79: _XEventsQueued(dpy, QueuedAfterReading); Pending.c:38:int XEventsQueued ( Pending.c:44: fprintf(stderr, "\nXEventsQueued: Called with a display at [%p].\n", (void *)dpy); Pending.c:51: ret_val = _XEventsQueued (dpy, mode); Pending.c:53: fprintf(stderr, "\nXEventsQueued: Going to unlock the display at [%p].\n", (void *)dpy); Pending.c:66: ret_val = _XEventsQueued (dpy, QueuedAfterFlush); XlibInt.c:1101:_XEventsQueued( XlibInt.c:1116: printf("_XEventsQueued called in thread %x\n", XThread_Self()); XlibInt.c:1128: fprintf(stderr, "_XEventsQueued: Returning [%d] after display failure.\n", XlibInt.c:1173: fprintf(stderr, "_XEventsQueued: Checking bytes readable.\n"); XlibInt.c:1202: fprintf(stderr, "_XEventsQueued: Calling poll().\n"); XlibInt.c:1209: fprintf(stderr, "_XEventsQueued: Calling select().\n"); XlibInt.c:1257: fprintf(stderr, "_XEventsQueued: Returning [%d].\n", dpy->qlen); Xlib.h:2470:extern int XEventsQueued( Xlibint.h:106: int conn_checker; /* ugly thing used by _XEventsQueued */ Xlibint.h:940:extern int _XEventsQueued( #### XExtendedMaxRequestSize #### Misc.c:63:long XExtendedMaxRequestSize(Display *dpy) Xlib.h:1717:extern long XExtendedMaxRequestSize( #### XExtentsOfFontSet #### FSWrap.c:249:XExtentsOfFontSet(XFontSet font_set) imRm.c:747: fset_extents = XExtentsOfFontSet(fontset); Xlib.h:3670:extern XFontSetExtents *XExtentsOfFontSet( #### XFetchBuffer #### StBytes.c:55:char *XFetchBuffer ( StBytes.c:85: return (XFetchBuffer (dpy, nbytes, 0)); Xlib.h:1496:extern char *XFetchBuffer( #### XFetchBytes #### StBytes.c:81:char *XFetchBytes ( Xlib.h:1492:extern char *XFetchBytes( #### XFetchName #### FetchName.c:36:Status XFetchName ( Xlib.h:2475:extern Status XFetchName( #### XFillArc #### FillArc.c:37:XFillArc( FillArcs.c:35:XFillArcs( Xlib.h:2481:extern int XFillArc( Xlib.h:2493:extern int XFillArcs( #### XFillArcs #### FillArcs.c:35:XFillArcs( Xlib.h:2493:extern int XFillArcs( #### XFillPolygon #### FillPoly.c:33:XFillPolygon( Xlib.h:2501:extern int XFillPolygon( #### XFillRectangle #### FillRct.c:37:XFillRectangle( FillRcts.c:33:XFillRectangles( omImText.c:56: XFillRectangle(dpy, d, gc, x + extent.x, y + extent.y, extent.width, Xlib.h:2511:extern int XFillRectangle( Xlib.h:2521:extern int XFillRectangles( #### XFillRectangles #### FillRcts.c:33:XFillRectangles( Xlib.h:2521:extern int XFillRectangles( #### XFilterEvent #### FilterEv.c:72:XFilterEvent( FilterEv.c:77: XFilterEventList p; RegstFlt.c:65: register XFilterEventList fl; RegstFlt.c:86: XFilterEventRec *rec; RegstFlt.c:88: rec = Xmalloc(sizeof(XFilterEventRec)); RegstFlt.c:118: XFilterEventRec *rec; RegstFlt.c:120: rec = Xmalloc(sizeof(XFilterEventRec)); RegstFlt.c:145: register XFilterEventList *prev, fl; Xlcint.h:79:typedef Bool (*XFilterEventProc)( Xlcint.h:91: XFilterEventProc filter; Xlcint.h:93:} XFilterEventRec, *XFilterEventList; Xlib.h:3915:extern Bool XFilterEvent( #### XFindContext #### Context.c:56: XFindContext(a,b,c,&d) will set d to be the value in position (a,b,c). Context.c:236:int XFindContext(Display *display, XID rid, XContext context, XPointer *data) Xutil.h:417:extern int XFindContext( #### XFindOnExtensionList #### Font.c:321: pData = XFindOnExtensionList(XEHeadOfExtensionList(dpy_union), Font.c:637: if ((pData = XFindOnExtensionList(XEHeadOfExtensionList(fs_union), InitExt.c:113:XExtData *XFindOnExtensionList( Xlib.h:1757:extern XExtData *XFindOnExtensionList( #### XFlush #### ChGC.c:47: _XFlushGCCache(dpy, gc); ChkIfEv.c:74: _XFlush(dpy); ChkMaskEv.c:81: _XFlush(dpy); ChkTypEv.c:72: _XFlush(dpy); ChkTypWEv.c:74: _XFlush(dpy); ChkWinEv.c:82: _XFlush(dpy); CopyGC.c:50: _XFlushGCCache(dpy, srcGC); CrGC.c:315:void _XFlushGCCache( CrGC.c:335:XFlushGC( Flush.c:36:XFlush (register Display *dpy) Flush.c:39: _XFlush (dpy); imTrans.c:240: XFlush(im->core.display); imTrX.c:194: XFlush(im->core.display); imTrX.c:488:_XimXFlush(Xim im) imTrX.c:490: XFlush(im->core.display); imTrX.c:513: im->private.proto.flush = _XimXFlush; PolyTxt16.c:90: _XFlush (dpy); PolyTxt16.c:237: _XFlush (dpy); PolyTxt.c:90: _XFlush (dpy); PolyTxt.c:230: _XFlush (dpy); SetClMask.c:43: _XFlushGCCache(dpy, gc); SetFont.c:42: _XFlushGCCache(dpy, gc); SetStip.c:42: _XFlushGCCache(dpy, gc); SetTile.c:42: _XFlushGCCache(dpy, gc); Text16.c:71: _XFlush (dpy); Text16.c:124: _XFlush (dpy); Text.c:71: _XFlush (dpy); Text.c:135: _XFlush (dpy); XlibInt.c:940:static void _XFlushInt( XlibInt.c:946: * _XFlush - Flush the X request buffer. If the buffer is empty, no XlibInt.c:950:void _XFlush( XlibInt.c:957: _XFlushInt(dpy, NULL); XlibInt.c:960:/* _XFlushInt - Internal version of _XFlush used to do multi-threaded XlibInt.c:964:static void _XFlushInt( XlibInt.c:978: fprintf(stderr, "_XFlushInt: Entering flush with [%d] bytes to write.\n", XlibInt.c:984: * callers of _XFlush() are not verifying this before they call it. XlibInt.c:989: fprintf(stderr, "_XFlushInt: Returning with I/O error detected.\n"); XlibInt.c:1122: _XFlush(dpy); XlibInt.c:1249: /* _XFlush can enqueue events */ XlibInt.c:1412: _XFlush (dpy); XlibInt.c:2180: _XFlushInt(dpy, cvl ? cvl->cv : NULL); XlibInt.c:2192: _XFlush(dpy); XlibInt.c:3882: _XFlush(dpy); XlibInt.c:3984: _XFlush(dpy); Xlib.h:1594:extern void XFlushGC( Xlib.h:2529:extern int XFlush( Xlibint.h:88:#define _XFlush _XFlushIt Xlibint.h:429:#define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */ Xlibint.h:551:extern void _XFlushGCCache(Display *dpy, GC gc); Xlibint.h:553: if ((gc)->dirty) _XFlushGCCache((dpy), (gc)) Xlibint.h:589: _XFlush (dpy); \ Xlibint.h:937:extern void _XFlush( #### XFlushGC #### ChGC.c:47: _XFlushGCCache(dpy, gc); CopyGC.c:50: _XFlushGCCache(dpy, srcGC); CrGC.c:315:void _XFlushGCCache( CrGC.c:335:XFlushGC( SetClMask.c:43: _XFlushGCCache(dpy, gc); SetFont.c:42: _XFlushGCCache(dpy, gc); SetStip.c:42: _XFlushGCCache(dpy, gc); SetTile.c:42: _XFlushGCCache(dpy, gc); Xlib.h:1594:extern void XFlushGC( Xlibint.h:551:extern void _XFlushGCCache(Display *dpy, GC gc); Xlibint.h:553: if ((gc)->dirty) _XFlushGCCache((dpy), (gc)) #### XFontsOfFontSet #### FSWrap.c:208:XFontsOfFontSet( imRmAttr.c:977: list_ret = XFontsOfFontSet((XFontSet)p->value, imRmAttr.c:1028: list_ret = XFontsOfFontSet((XFontSet)p->value, imRmAttr.c:1205: list_ret = XFontsOfFontSet((XFontSet)value, imRmAttr.c:1246: list_ret = XFontsOfFontSet((XFontSet)value, Xlib.h:3644:extern int XFontsOfFontSet( #### XForceScreenSaver #### FSSaver.c:35: XForceScreenSaver (dpy, ScreenSaverActive); FSSaver.c:42: XForceScreenSaver (dpy, ScreenSaverReset); FSSaver.c:47:XForceScreenSaver( Xlib.h:2533:extern int XForceScreenSaver( #### XFree #### ChkMaskEv.c:56: _XFreeEventCookies(dpy); ChkTypEv.c:50: _XFreeEventCookies(dpy); ChkTypWEv.c:51: _XFreeEventCookies(dpy); ChkWinEv.c:56: _XFreeEventCookies(dpy); ClDisplay.c:60: XFreeGC (dpy, sp->default_gc); ClDisplay.c:80: _XFreeDisplayStructure (dpy); cmsProp.c:137: XFree (prop_ret); Context.c:132:static void _XFreeContextDB(Display *display) Context.c:147: _XFreeMutex(&db->linfo); Context.c:200: display->free_funcs->context_db = _XFreeContextDB; CrBFData.c:59: XFreePixmap(display, pix); CrBFData.c:77: XFreeGC(display, gc); CrPFBData.c:68: XFreePixmap(display, pix); CrPFBData.c:86: XFreeGC(display, gc); Font.c:4:Copyright (c) 2000 The XFree86 Project, Inc. Font.c:24:XFree86 Project shall not be used in advertising or otherwise to promote the Font.c:26:authorization from the X Consortium and the XFree86 Project. Font.c:151:XFreeFont( Font.c:172: _XFreeExtData(fs->ext_data); Font.c:699: _XFreeExtData(fs->ext_data); Font.c:705: XFreeFont(dpy, fs); FontInfo.c:168: flist[i] = NULL; /* required in case XFreeFontNames is called */ FontInfo.c:200:XFreeFontInfo ( FontNames.c:91: *ch = 1; /* make sure it is non-zero for XFreeFontNames */ FontNames.c:123:XFreeFontNames(char **list) FreeCmap.c:35:XFreeColormap( FreeCols.c:33:XFreeColors( FreeCurs.c:33:XFreeCursor( FreeEData.c:33:_XFreeExtData (XExtData *extension) FreeEventData.c:31:XFreeEventData(Display *dpy, XGenericEventCookie *event) FreeEventData.c:36: XFree(event->data); FreeGC.c:33:XFreeGC ( FreeGC.c:46: _XFreeExtData(gc->ext_data); FreePix.c:33:XFreePixmap( FSWrap.c:257:XFreeFontSet( GetFPath.c:92:XFreeFontPath (char **list) imConv.c:33:/* 2000 Modifier: Ivan Pascal The XFree86 Project. imDefIm.c:305: XFree( (XPointer)str ); imDefIm.c:308: XFree( (XPointer)str ); imDefIm.c:347: XFree((XPointer)address); imDefIm.c:353: XFree( locale_name[i] ); imDefIm.c:357: XFree((XPointer)address); imDefIm.c:374: XFree((XPointer)address); imDefIm.c:381: XFree((XPointer)address); imDefIm.c:385: XFree( locale_name[i] ); imDefIm.c:416: XFree((XPointer)prop_return); imDefIm.c:429: XFree((XPointer)prop_return); imExten.c:453: XFree(buf); imExten.c:456: XFree(buf); imInsClbk.c:106: XFree( atoms ); imInsClbk.c:130: XFree( atoms ); imInsClbk.c:140: XFree( tmp ); imInsClbk.c:261: XFree( icb ); imRmAttr.c:963: XFree(colormap_ret); imRmAttr.c:1014: XFree(colormap_ret); imThaiFlt.c:591: XFree(screc.text->string.mbs); imThaiFlt.c:593: XFree(screc.text); imThaiFlt.c:625: XFree(screc.text->string.wcs); imThaiFlt.c:628: XFree(screc.text->string.mbs); imThaiFlt.c:631: XFree(screc.text); imThaiFlt.c:1276: XFreeModifiermap(map); imThaiFlt.c:1280: XFreeModifiermap(map); imTrX.c:85:_XimXFreeIntrCallback( imTrX.c:241: _XimXFreeIntrCallback(im); imTrX.c:372: XFree(prop_ret); imTrX.c:379: XFree(prop_ret); imTrX.c:400: XFree(prop_ret); imTrX.c:416: XFree(prop_ret); imTrX.c:425: XFree(prop_ret); imTrX.c:438: XFree(prop_ret); IntAtom.c:40:_XFreeAtomTable(Display *dpy) IntAtom.c:76: dpy->free_funcs->atoms = _XFreeAtomTable; IntAtom.c:131: dpy->free_funcs->atoms = _XFreeAtomTable; KeyBind.c:218: XFreeModifiermap(dpy->modifiermap); KeyBind.c:220: dpy->free_funcs->modifiermap = XFreeModifiermap; KeyBind.c:245: XFreeModifiermap(event->display->modifiermap); KeyBind.c:898:_XFreeKeyBindings( KeyBind.c:942: dpy->free_funcs->key_bindings = _XFreeKeyBindings; lcCT.c:35: * Modifier: Ivan Pascal The XFree86 Project lcCT.c:36: * Modifier: Bruno Haible The XFree86 Project lcCT.c:119: /* Backward compatibility with XFree86 3.x */ lcDefConv.c:27: * Modifier: Ivan Pascal The XFree86 Project lcGenConv.c:35: * Modifier: Ivan Pascal The XFree86 Project lcRM.c:24: * Bug fixes: Bruno Haible XFree86 Inc. lcUtil.c:24: * Bug fixes: Bruno Haible XFree86 Inc. LiHosts.c:68: * can be freed using XFree. ListExt.c:102:XFreeExtensionList (char **list) locking.c:40:#undef _XFreeMutex locking.c:128:static void _XFreeMutex( locking.c:401:static void _XFreeDisplayLock( locking.c:520: _XFreeDisplayLock(dpy); locking.c:527: _XFreeDisplayLock(dpy); locking.c:606: _XFreeMutex_fn = _XFreeMutex; locking.c:608: _XFreeDisplayLock_fn = _XFreeDisplayLock; MaskEvent.c:55: _XFreeEventCookies(dpy); ModMap.c:115:XFreeModifiermap(XModifierKeymap *map) ModMap.c:160: (void) XFreeModifiermap(map); NextEvent.c:47: _XFreeEventCookies(dpy); omGeneric.c:307: XFreeFontNames(fn_list); omGeneric.c:495: XFreeFontNames(list); omGeneric.c:645: XFreeFontInfo(fn_list, fs_list, list_num); omGeneric.c:649: XFree(prop_fname); omGeneric.c:650: XFreeFontInfo(fn_list, fs_list, list_num); omGeneric.c:655: XFreeFontInfo(fn_list, fs_list, list_num); omGeneric.c:1171: XFreeStringList(name_list); omGeneric.c:1176: XFreeStringList(name_list); omGeneric.c:1329: XFreeFont(dpy,font_data->font); /* ADD 1996.01.7 */ omGeneric.c:1331: XFreeFontInfo(NULL, font_data->font, 1);/* Add 1996.01.23 */ omGeneric.c:1366: XFreeFont(dpy,font_set->font); omGeneric.c:1368: XFreeFontInfo(NULL, font_set->font, 1); omGeneric.c:1373: XFreeFontInfo(NULL, font_set->info, 1); omGeneric.c:1428: XFreeStringList(oc->core.font_info.font_name_list); omGeneric.c:1430: XFreeStringList(oc->core.missing_list.charset_list); omGeneric.c:1689: XFreeStringList(om->core.required_charset.charset_list); omXChar.c:294: XFreeFontInfo(NULL, font_set->info, 1); OpenDis.c:87:void (*_XFreeDisplayLock_fn)(Display *dpy) = NULL; OpenDis.c:90:#define FreeDisplayLock(d) if (_XFreeDisplayLock_fn) (*_XFreeDisplayLock_fn)(d) OpenDis.c:231: * Initialize pointers to NULL so that XFreeDisplayStructure will OpenDis.c:353: if ((dpy->free_funcs = Xcalloc(1, sizeof(_XFreeFuncRec))) == NULL) { OpenDis.c:842:/* XFreeDisplayStructure frees all the storage associated with a OpenDis.c:851:void _XFreeDisplayStructure(Display *dpy) OpenDis.c:863: _XFreeEventCookies(dpy); OpenDis.c:909: _XFreeExtData (dp->visuals[k].ext_data); OpenDis.c:917: _XFreeExtData (sp->ext_data); OpenDis.c:927: _XFreeExtData (dpy->pixmap_format[i].ext_data); OpenDis.c:939: _XFreeExtData (dpy->ext_data); OpenDis.c:969: _XFreeX11XCBStructure(dpy); OpenDis.c:986: _XFreeDisplayStructure (dpy); PrOfId.c:63: * the application is responsible for freeing (using XFree) Region.c:277: _XFreeTemp(dpy, (char *)xr, total); RegstFlt.c:62:_XFreeIMFilters( RegstFlt.c:100: display->free_funcs->im_filters = _XFreeIMFilters; RegstFlt.c:132: display->free_funcs->im_filters = _XFreeIMFilters; TextToStr.c:110:void XFreeStringList (char **list) UIThrStubs.c:40: * Modifications by Carlos A M dos Santos, XFree86 Project, November 1999. WinEvent.c:58: _XFreeEventCookies(dpy); XDefaultIMIF.c:240: XFree(im->private); XDefaultIMIF.c:241: XFree(im->core.im_name); XDefaultIMIF.c:242: XFree(im->core.res_name); XDefaultIMIF.c:243: XFree(im->core.res_class); XDefaultIMIF.c:351: XFree(ic); XDefaultIMIF.c:358:/*BugId4255571. This Xfree() should be removed because XDestroyIC() still need ic after invoking _DestroyIC() and there is a XFree(ic) at the end of XDestroyIC() already. XDefaultIMIF.c:360: XFree(ic); */ XDefaultIMIF.c:455: XFree(mb_buf); XDefaultOMIF.c:296: XFreeFontNames(list); XDefaultOMIF.c:302: XFreeFont(dpy, fs); XDefaultOMIF.c:355: XFreeFontInfo(fn_list, fs_list, list_num); XDefaultOMIF.c:448: XFreeStringList(name_list); XDefaultOMIF.c:452: XFreeStringList(name_list); XDefaultOMIF.c:526: XFreeStringList(oc->core.font_info.font_name_list); XDefaultOMIF.c:531: XFreeFont(dpy, font); XDefaultOMIF.c:533: XFreeFontInfo(NULL, font, 1); XDefaultOMIF.c:539: XFreeStringList(oc->core.missing_list.charset_list); XDefaultOMIF.c:936: XFreeStringList(om->core.required_charset.charset_list); XKBSetGeom.c:440: _XFreeTemp(dpy, tbuf, sz); XlibInt.c:85:void (*_XFreeMutex_fn)(LockInfoPtr) = NULL; XlibInt.c:2806: jar. _XFreeEventCookies removes all unclaimed cookies from the jar XlibInt.c:2809: _XFreeDisplayStructure calls _XFreeEventCookies for each cookie in the XlibInt.c:2831:_XFreeEventCookies(Display *dpy) XlibInt.c:2843: XFree(e->ev.data); XlibInt.c:2844: XFree(e); XlibInt.c:3011: * _XFreeDisplayStructure */ XlibInt.c:3778: * MT safe, but you must hand the buffer back with _XFreeTemp. XlibInt.c:3792:void _XFreeTemp( XlibInt.c:3829:XFree (void *data) XlibInt.c:4194:void (**_XFreeMutex_fn_p)(LockInfoPtr) = &_XFreeMutex_fn; Xrm.c:803: _XFreeMutex(&from->linfo); Xrm.c:2662: _XFreeMutex(&db->linfo); locking.h:154:extern void (*_XFreeDisplayLock_fn)(Display *dpy); Xintatom.h:29:extern void _XFreeAtomTable(Display *dpy); Xintconn.h:34:extern void _XFreeDisplayStructure(Display *dpy); Xlib.h:69:/* API mentioning "UTF8" or "utf8" is an XFree86 extension, introduced in Xlib.h:1923:extern void XFreeStringList( Xlib.h:2538:extern int XFree( Xlib.h:2542:extern int XFreeColormap( Xlib.h:2547:extern int XFreeColors( Xlib.h:2555:extern int XFreeCursor( Xlib.h:2560:extern int XFreeExtensionList( Xlib.h:2564:extern int XFreeFont( Xlib.h:2569:extern int XFreeFontInfo( Xlib.h:2575:extern int XFreeFontNames( Xlib.h:2579:extern int XFreeFontPath( Xlib.h:2583:extern int XFreeGC( Xlib.h:2588:extern int XFreeModifiermap( Xlib.h:2592:extern int XFreePixmap( Xlib.h:3639:extern void XFreeFontSet( Xlib.h:4026:extern void XFreeEventData( Xlibint.h:104: struct _XFreeFuncs *free_funcs; /* internal free functions */ Xlibint.h:304:#define _XFreeMutex_fn (*_XFreeMutex_fn_p) Xlibint.h:314:extern void (*_XFreeMutex_fn)( Xlibint.h:347:#define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock); Xlibint.h:355:#define _XFreeMutex(lock) Xlibint.h:736:typedef struct _XFreeFuncs { Xlibint.h:737: FreeFuncType atoms; /* _XFreeAtomTable */ Xlibint.h:738: FreeModmapType modifiermap; /* XFreeModifiermap */ Xlibint.h:739: FreeFuncType key_bindings; /* _XFreeKeyBindings */ Xlibint.h:740: FreeFuncType context_db; /* _XFreeContextDB */ Xlibint.h:744: FreeFuncType im_filters; /* _XFreeIMFilters */ Xlibint.h:746:} _XFreeFuncRec; Xlibint.h:891:extern void _XFreeTemp( Xlibint.h:1010:extern int _XFreeExtData( Xlibint.h:1341:extern void _XFreeEventCookies( Xutil.h:180: /* The following is an XFree86 extension, introduced in November 2000 */ #### XFreeColormap #### FreeCmap.c:35:XFreeColormap( Xlib.h:2542:extern int XFreeColormap( #### XFreeColors #### FreeCols.c:33:XFreeColors( Xlib.h:2547:extern int XFreeColors( #### XFreeCursor #### FreeCurs.c:33:XFreeCursor( Xlib.h:2555:extern int XFreeCursor( #### XFreeEventData #### FreeEventData.c:31:XFreeEventData(Display *dpy, XGenericEventCookie *event) Xlib.h:4026:extern void XFreeEventData( #### XFreeExtensionList #### ListExt.c:102:XFreeExtensionList (char **list) Xlib.h:2560:extern int XFreeExtensionList( #### XFreeFont #### Font.c:151:XFreeFont( Font.c:705: XFreeFont(dpy, fs); FontInfo.c:168: flist[i] = NULL; /* required in case XFreeFontNames is called */ FontInfo.c:200:XFreeFontInfo ( FontNames.c:91: *ch = 1; /* make sure it is non-zero for XFreeFontNames */ FontNames.c:123:XFreeFontNames(char **list) FSWrap.c:257:XFreeFontSet( GetFPath.c:92:XFreeFontPath (char **list) omGeneric.c:307: XFreeFontNames(fn_list); omGeneric.c:495: XFreeFontNames(list); omGeneric.c:645: XFreeFontInfo(fn_list, fs_list, list_num); omGeneric.c:650: XFreeFontInfo(fn_list, fs_list, list_num); omGeneric.c:655: XFreeFontInfo(fn_list, fs_list, list_num); omGeneric.c:1329: XFreeFont(dpy,font_data->font); /* ADD 1996.01.7 */ omGeneric.c:1331: XFreeFontInfo(NULL, font_data->font, 1);/* Add 1996.01.23 */ omGeneric.c:1366: XFreeFont(dpy,font_set->font); omGeneric.c:1368: XFreeFontInfo(NULL, font_set->font, 1); omGeneric.c:1373: XFreeFontInfo(NULL, font_set->info, 1); omXChar.c:294: XFreeFontInfo(NULL, font_set->info, 1); XDefaultOMIF.c:296: XFreeFontNames(list); XDefaultOMIF.c:302: XFreeFont(dpy, fs); XDefaultOMIF.c:355: XFreeFontInfo(fn_list, fs_list, list_num); XDefaultOMIF.c:531: XFreeFont(dpy, font); XDefaultOMIF.c:533: XFreeFontInfo(NULL, font, 1); Xlib.h:2564:extern int XFreeFont( Xlib.h:2569:extern int XFreeFontInfo( Xlib.h:2575:extern int XFreeFontNames( Xlib.h:2579:extern int XFreeFontPath( Xlib.h:3639:extern void XFreeFontSet( #### XFreeFontInfo #### FontInfo.c:200:XFreeFontInfo ( omGeneric.c:645: XFreeFontInfo(fn_list, fs_list, list_num); omGeneric.c:650: XFreeFontInfo(fn_list, fs_list, list_num); omGeneric.c:655: XFreeFontInfo(fn_list, fs_list, list_num); omGeneric.c:1331: XFreeFontInfo(NULL, font_data->font, 1);/* Add 1996.01.23 */ omGeneric.c:1368: XFreeFontInfo(NULL, font_set->font, 1); omGeneric.c:1373: XFreeFontInfo(NULL, font_set->info, 1); omXChar.c:294: XFreeFontInfo(NULL, font_set->info, 1); XDefaultOMIF.c:355: XFreeFontInfo(fn_list, fs_list, list_num); XDefaultOMIF.c:533: XFreeFontInfo(NULL, font, 1); Xlib.h:2569:extern int XFreeFontInfo( #### XFreeFontNames #### FontInfo.c:168: flist[i] = NULL; /* required in case XFreeFontNames is called */ FontNames.c:91: *ch = 1; /* make sure it is non-zero for XFreeFontNames */ FontNames.c:123:XFreeFontNames(char **list) omGeneric.c:307: XFreeFontNames(fn_list); omGeneric.c:495: XFreeFontNames(list); XDefaultOMIF.c:296: XFreeFontNames(list); Xlib.h:2575:extern int XFreeFontNames( #### XFreeFontPath #### GetFPath.c:92:XFreeFontPath (char **list) Xlib.h:2579:extern int XFreeFontPath( #### XFreeFontSet #### FSWrap.c:257:XFreeFontSet( Xlib.h:3639:extern void XFreeFontSet( #### XFreeGC #### ClDisplay.c:60: XFreeGC (dpy, sp->default_gc); CrBFData.c:77: XFreeGC(display, gc); CrPFBData.c:86: XFreeGC(display, gc); FreeGC.c:33:XFreeGC ( Xlib.h:2583:extern int XFreeGC( #### XFreeModifiermap #### imThaiFlt.c:1276: XFreeModifiermap(map); imThaiFlt.c:1280: XFreeModifiermap(map); KeyBind.c:218: XFreeModifiermap(dpy->modifiermap); KeyBind.c:220: dpy->free_funcs->modifiermap = XFreeModifiermap; KeyBind.c:245: XFreeModifiermap(event->display->modifiermap); ModMap.c:115:XFreeModifiermap(XModifierKeymap *map) ModMap.c:160: (void) XFreeModifiermap(map); Xlib.h:2588:extern int XFreeModifiermap( Xlibint.h:738: FreeModmapType modifiermap; /* XFreeModifiermap */ #### XFreePixmap #### CrBFData.c:59: XFreePixmap(display, pix); CrPFBData.c:68: XFreePixmap(display, pix); FreePix.c:33:XFreePixmap( Xlib.h:2592:extern int XFreePixmap( #### XFreeStringList #### omGeneric.c:1171: XFreeStringList(name_list); omGeneric.c:1176: XFreeStringList(name_list); omGeneric.c:1428: XFreeStringList(oc->core.font_info.font_name_list); omGeneric.c:1430: XFreeStringList(oc->core.missing_list.charset_list); omGeneric.c:1689: XFreeStringList(om->core.required_charset.charset_list); TextToStr.c:110:void XFreeStringList (char **list) XDefaultOMIF.c:448: XFreeStringList(name_list); XDefaultOMIF.c:452: XFreeStringList(name_list); XDefaultOMIF.c:526: XFreeStringList(oc->core.font_info.font_name_list); XDefaultOMIF.c:539: XFreeStringList(oc->core.missing_list.charset_list); XDefaultOMIF.c:936: XFreeStringList(om->core.required_charset.charset_list); Xlib.h:1923:extern void XFreeStringList( #### XGContextFromGC #### CrGC.c:342:GContext XGContextFromGC(GC gc) Xlib.h:1591:extern GContext XGContextFromGC( #### XGeometry #### Geom.c:43:XGeometry ( Xlib.h:2597:extern int XGeometry( #### XGetAtomName #### GetAtomNm.c:34:char *_XGetAtomName( GetAtomNm.c:59:char *XGetAtomName( GetAtomNm.c:67: if ((name = _XGetAtomName(dpy, atom))) { GetAtomNm.c:97:} _XGetAtomNameState; GetAtomNm.c:100:Bool _XGetAtomNameHandler( GetAtomNm.c:107: register _XGetAtomNameState *state; GetAtomNm.c:111: state = (_XGetAtomNameState *)data; GetAtomNm.c:142:XGetAtomNames ( GetAtomNm.c:149: _XGetAtomNameState async_state; GetAtomNm.c:162: async.handler = _XGetAtomNameHandler; GetAtomNm.c:166: if (!(names_return[i] = _XGetAtomName(dpy, atoms[i]))) { imDefIm.c:302: if( !(str = XGetAtomName( display, selection )) ) omGeneric.c:191: return XGetAtomName(dpy, fp); XDefaultOMIF.c:152: return XGetAtomName(dpy, fp); XKB.c:36:XkbGetAtomNameFunc _XkbGetAtomNameFunc = XGetAtomName; XKB.c:773: _XkbGetAtomNameFunc = (getName ? getName : XGetAtomName); Xlib.h:1501:extern char *XGetAtomName( Xlib.h:1505:extern Status XGetAtomNames( #### XGetAtomNames #### GetAtomNm.c:142:XGetAtomNames ( Xlib.h:1505:extern Status XGetAtomNames( #### XGetClassHint #### GetHints.c:299:XGetClassHint( Xutil.h:424:extern Status XGetClassHint( #### XGetCommand #### GetHints.c:229:Status XGetCommand ( Xlib.h:1905:extern Status XGetCommand( #### XGetDefault #### GetDflt.c:174:XGetDefault( OpenDis.c:889: /* if RM database was allocated by XGetDefault() free it */ Xrm.c:352: /* destroy database if set up implicitly by XGetDefault() */ Xlib.h:1511:extern char *XGetDefault( Xlibint.h:430:#define XlibDisplayDfltRMDB (1L << 7) /* mark if RM db from XGetDefault */ #### XGetErrorDatabaseText #### ErrDes.c:113: (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, ErrDes.c:130: (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, "", buffer, nbytes); ErrDes.c:139:XGetErrorDatabaseText( XlibInt.c:3515: XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ); XlibInt.c:3517: XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d", XlibInt.c:3522: XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); XlibInt.c:3536: XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", XlibInt.c:3542: XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ); XlibInt.c:3568: XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ); XlibInt.c:3590: XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", XlibInt.c:3593: XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", XlibInt.c:3596: XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", XlibInt.c:3602: XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", XlibInt.c:3606: XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d", Xlib.h:2613:extern int XGetErrorDatabaseText( #### XGetErrorText #### ErrDes.c:100:XGetErrorText( XlibInt.c:3514: XGetErrorText(dpy, event->error_code, buffer, BUFSIZ); Xlib.h:2622:extern int XGetErrorText( #### XGetEventData #### GetEventData.c:31:XGetEventData(Display *dpy, XGenericEventCookie *event) XlibInt.c:2805: _XFetchEventCookie (called from XGetEventData) removes a cookie from the Xlib.h:4021:extern Bool XGetEventData( #### XGetFontPath #### GetFPath.c:33:char **XGetFontPath( Xlib.h:1669:extern char **XGetFontPath( #### XGetFontProperty #### GetFProp.c:33:XGetFontProperty( omGeneric.c:190: if (XGetFontProperty(fs, XA_FONT, &fp)) XDefaultOMIF.c:151: if (XGetFontProperty(fs, XA_FONT, &fp)) Xlib.h:2629:extern Bool XGetFontProperty( #### XGetGCValues #### GetGCVals.c:46:Status XGetGCValues ( omImText.c:49: XGetGCValues(dpy, gc, GET_VALUE_MASK, &values); Xlib.h:2635:extern Status XGetGCValues( #### XGetGeometry #### GetGeom.c:32:Status XGetGeometry ( imRm.c:607: if(XGetGeometry(im->core.display, (Drawable)ic->core.focus_window, SetStCmap.c:75: /* already caught the XGetGeometry error in _XScreenOfWindow */ XlibInt.c:3960: if (XGetGeometry (dpy, w, &root, &x, &y, &width, &height, Xlib.h:2642:extern Status XGetGeometry( #### XGetICValues #### ICWrap.c:281:XGetICValues(XIC ic, ...) Xlib.h:3907:extern char *XGetICValues( #### XGetIMValues #### ICWrap.c:195:XGetIMValues(XIM im, ...) Xlib.h:3859:extern char *XGetIMValues( #### XGetIconName #### FetchName.c:66:Status XGetIconName ( Xlib.h:2654:extern Status XGetIconName( #### XGetIconSizes #### GetHints.c:169: * XGetIconSizes reads the property GetHints.c:173:Status XGetIconSizes ( Xutil.h:430:extern Status XGetIconSizes( #### XGetImage #### GetImage.c:47:XImage *XGetImage ( GetImage.c:136: temp_image = XGetImage(dpy, d, x, y, width, height, WrBitF.c:115: image = XGetImage(display, bitmap, 0,0,width, height, 1L, XYPixmap); Xlib.h:1457:extern XImage *XGetImage( #### XGetInputFocus #### GetIFocus.c:33:XGetInputFocus( Xlib.h:2660:extern int XGetInputFocus( #### XGetKeyboardControl #### GetKCnt.c:33:XGetKeyboardControl ( Xlib.h:456:/* Data structure for XGetKeyboardControl */ Xlib.h:2666:extern int XGetKeyboardControl( #### XGetKeyboardMapping #### GetPntMap.c:87:XGetKeyboardMapping (Display *dpy, KeyBind.c:268: keysyms = XGetKeyboardMapping (dpy, (KeyCode) dpy->min_keycode, Xlib.h:1701:extern KeySym *XGetKeyboardMapping( #### XGetModifierMapping #### imThaiFlt.c:1270: map = XGetModifierMapping (d); KeyBind.c:214: if (! (map = XGetModifierMapping(dpy))) ModMap.c:34:XGetModifierMapping(register Display *dpy) Xlib.h:1424:extern XModifierKeymap *XGetModifierMapping( #### XGetMotionEvents #### GetMoEv.c:33:XTimeCoord *XGetMotionEvents( Xlib.h:467:/* Data structure for XGetMotionEvents. */ Xlib.h:1406:extern XTimeCoord *XGetMotionEvents( #### XGetNormalHints #### GetHints.c:159:XGetNormalHints ( Xutil.h:437:extern Status XGetNormalHints( #### XGetOCValues #### OCWrap.c:117:XGetOCValues(XOC oc, ...) Xlcint.h:430:typedef char* (*XGetOCValuesProc)( Xlcint.h:544: XGetOCValuesProc get_values; Xlib.h:3626:extern char *XGetOCValues( #### XGetOMValues #### OMWrap.c:94:XGetOMValues(XOM om, ...) Xlcint.h:380:typedef char* (*XGetOMValuesProc)( Xlcint.h:395: XGetOMValuesProc get_values; Xlib.h:3595:extern char *XGetOMValues( #### XGetPixel #### ImUtil.c:36:static unsigned long _XGetPixel(XImage *, int, int); ImUtil.c:37:static unsigned long _XGetPixel1(XImage *, int, int); ImUtil.c:38:static unsigned long _XGetPixel8(XImage *, int, int); ImUtil.c:39:static unsigned long _XGetPixel16(XImage *, int, int); ImUtil.c:40:static unsigned long _XGetPixel32(XImage *, int, int); ImUtil.c:98: * _XGetPixel Reads a pixel from an image data structure ImUtil.c:99: * _XGetPixel32 Reads a pixel from a 32-bit Z image data structure ImUtil.c:100: * _XGetPixel16 Reads a pixel from a 16-bit Z image data structure ImUtil.c:101: * _XGetPixel8 Reads a pixel from an 8-bit Z image data structure ImUtil.c:102: * _XGetPixel1 Reads a pixel from an 1-bit image data structure ImUtil.c:277: image->f.get_pixel = _XGetPixel8; ImUtil.c:281: image->f.get_pixel = _XGetPixel1; ImUtil.c:285: image->f.get_pixel = _XGetPixel32; ImUtil.c:289: image->f.get_pixel = _XGetPixel16; ImUtil.c:292: image->f.get_pixel = _XGetPixel; ImUtil.c:470:static unsigned long _XGetPixel ( ImUtil.c:533:static unsigned long _XGetPixel32 ( ImUtil.c:561: return XGetPixel(ximage, x, y); ImUtil.c:565:static unsigned long _XGetPixel16 ( ImUtil.c:585: return XGetPixel(ximage, x, y); ImUtil.c:589:static unsigned long _XGetPixel8 ( ImUtil.c:604: return XGetPixel(ximage, x, y); ImUtil.c:608:static unsigned long _XGetPixel1 ( ImUtil.c:628: return XGetPixel(ximage, x, y); ImUtil.c:888: pixel = XGetPixel(ximage, col, row); ImUtil.c:948: pixel = XGetPixel(srcimg, col, row); ImUtil.c:1009: register unsigned long pixel = XGetPixel(ximage, x, y); Macros.c:259:#undef XGetPixel Macros.c:260:unsigned long XGetPixel( PutImage.c:1000: XPutPixel(&img, i, j, XGetPixel(image, req_xoffset + i, WrBitF.c:67: if (XGetPixel(image, x, y)) Xutil.h:198:extern unsigned long XGetPixel( Xutil.h:219:#define XGetPixel(ximage, x, y) \ #### XGetPointerControl #### GetPCnt.c:33:XGetPointerControl( Xlib.h:2671:extern int XGetPointerControl( #### XGetPointerMapping #### GetPntMap.c:39:int XGetPointerMapping ( Xlib.h:2678:extern int XGetPointerMapping( #### XGetRGBColormaps #### GetRGBCMap.c:38:Status XGetRGBColormaps ( GetStCmap.c:74: stat = XGetRGBColormaps (dpy, w, &stdcmaps, &nstdcmaps, property); imRmAttr.c:958: if (!(XGetRGBColormaps(ic->core.im->core.display, imRmAttr.c:1009: if (!(XGetRGBColormaps(ic->core.im->core.display, imRm.c:2823: if (!(XGetRGBColormaps(ic->core.im->core.display, imRm.c:2845: if (!(XGetRGBColormaps(ic->core.im->core.display, Xutil.h:443:extern Status XGetRGBColormaps( #### XGetScreenSaver #### GetSSaver.c:33:XGetScreenSaver( Xlib.h:2684:extern int XGetScreenSaver( #### XGetSelectionOwner #### GetSOwner.c:32:Window XGetSelectionOwner( imDefIm.c:422: if((im_window = XGetSelectionOwner(display, atoms[i])) == (Window)None) imInsClbk.c:112: if(XGetSelectionOwner (display, atoms[ii])) { Xlib.h:1633:extern Window XGetSelectionOwner( #### XGetSizeHints #### GetHints.c:59:Status XGetSizeHints ( GetHints.c:155: return (XGetSizeHints(dpy, w, zhints, XA_WM_ZOOM_HINTS)); GetHints.c:164: return (XGetSizeHints(dpy, w, hints, XA_WM_NORMAL_HINTS)); Xutil.h:451:extern Status XGetSizeHints( #### XGetStandardColormap #### GetStCmap.c:64:Status XGetStandardColormap ( Xutil.h:458:extern Status XGetStandardColormap( #### XGetSubImage #### GetImage.c:122:XImage *XGetSubImage( Xlib.h:1467:extern XImage *XGetSubImage( #### XGetTextProperty #### GetHints.c:239: if (!XGetTextProperty (dpy, w, &tp, XA_WM_COMMAND)) return 0; GetTxtProp.c:60:Status XGetTextProperty ( GetTxtProp.c:95: return (XGetTextProperty (dpy, w, tp, XA_WM_NAME)); GetTxtProp.c:103: return (XGetTextProperty (dpy, w, tp, XA_WM_ICON_NAME)); GetTxtProp.c:111: return (XGetTextProperty (dpy, w, tp, XA_WM_CLIENT_MACHINE)); Xutil.h:465:extern Status XGetTextProperty( #### XGetTransientForHint #### GetHints.c:269:XGetTransientForHint( Xlib.h:2692:extern Status XGetTransientForHint( #### XGetVisualInfo #### cmsCmap.c:143: visualList = XGetVisualInfo(dpy, VisualScreenMask, &visualTemplate, VisUtil.c:56:XVisualInfo *XGetVisualInfo( Xutil.h:472:extern XVisualInfo *XGetVisualInfo( #### XGetWMClientMachine #### GetTxtProp.c:106:Status XGetWMClientMachine ( Xutil.h:479:extern Status XGetWMClientMachine( #### XGetWMColormapWindows #### GetWMCMapW.c:56:Status XGetWMColormapWindows ( Xlib.h:1911:extern Status XGetWMColormapWindows( #### XGetWMHints #### GetHints.c:106:XWMHints *XGetWMHints ( Xutil.h:485:extern XWMHints *XGetWMHints( #### XGetWMIconName #### GetTxtProp.c:98:Status XGetWMIconName ( Xutil.h:490:extern Status XGetWMIconName( #### XGetWMName #### GetTxtProp.c:90:Status XGetWMName ( Xutil.h:496:extern Status XGetWMName( #### XGetWMNormalHints #### GetNrmHint.c:120:Status XGetWMNormalHints ( Xutil.h:502:extern Status XGetWMNormalHints( #### XGetWMProtocols #### GetWMProto.c:56:Status XGetWMProtocols ( Xlib.h:1883:extern Status XGetWMProtocols( #### XGetWMSizeHints #### GetNrmHint.c:63:Status XGetWMSizeHints ( GetNrmHint.c:126: return (XGetWMSizeHints (dpy, w, hints, supplied, XA_WM_NORMAL_HINTS)); Xutil.h:509:extern Status XGetWMSizeHints( #### XGetWindowAttributes #### cmsCmap.c:267: * it may require the use of XGetWindowAttributes (a round trip request) cmsCmap.c:437: * cmap, so use XGetWindowAttributes() to extract that cmsCmap.c:453: if (XGetWindowAttributes(dpy, pRec->windowID, &windowAttr)) { GetWAttrs.c:88:_XGetWindowAttributes( GetWAttrs.c:141:XGetWindowAttributes( GetWAttrs.c:149: ret = _XGetWindowAttributes(dpy, w, attr); imDefLkup.c:469: if (!XGetWindowAttributes(im->core.display, ic->core.focus_window, &atr)) imInsClbk.c:197: XGetWindowAttributes( display, root, &attr ); imRm.c:638: if(XGetWindowAttributes(im->core.display, ic->core.client_window, imTrX.c:184: XGetWindowAttributes(im->core.display, spec->lib_connect_wid, &atr); Xlib.h:2713:extern Status XGetWindowAttributes( Xlibint.h:1328:Status _XGetWindowAttributes( #### XGetWindowProperty #### cmsProp.c:131: xgwp_ret = XGetWindowProperty (pDpy, w, property, 0, len, False, FetchName.c:46: if (XGetWindowProperty(dpy, w, XA_WM_NAME, 0L, (long)BUFSIZ, False, XA_STRING, FetchName.c:54: /* The data returned by XGetWindowProperty is guarranteed to FetchName.c:76: if (XGetWindowProperty(dpy, w, XA_WM_ICON_NAME, 0L, (long)BUFSIZ, False, FetchName.c:85: /* The data returned by XGetWindowProperty is guarranteed to GetHints.c:70: if (XGetWindowProperty(dpy, w, property, 0L, GetHints.c:116: if (XGetWindowProperty(dpy, w, XA_WM_HINTS, GetHints.c:188: if (XGetWindowProperty(dpy, w, XA_WM_ICON_SIZE, 0L, 60L, GetHints.c:279: if (XGetWindowProperty(dpy, w, XA_WM_TRANSIENT_FOR, 0L, 1L, False, GetHints.c:311: if (XGetWindowProperty(dpy, w, XA_WM_CLASS, 0L, (long)BUFSIZ, False, GetNrmHint.c:76: if (XGetWindowProperty (dpy, w, property, 0L, GetProp.c:34:XGetWindowProperty( GetRGBCMap.c:57: if (XGetWindowProperty (dpy, w, property, 0L, 1000000L, False, GetTxtProp.c:71: if (XGetWindowProperty (display, window, property, 0L, 1000000L, False, GetWMCMapW.c:72: if (XGetWindowProperty (dpy, w, prop, GetWMProto.c:72: if (XGetWindowProperty (dpy, w, prop, imDefIm.c:264: if( XGetWindowProperty( display, window, target, 0L, 1000000L, imDefIm.c:408: if(XGetWindowProperty(display, RootWindow(display, 0), imInsClbk.c:99: if( XGetWindowProperty( display, RootWindow(display, 0), ims, 0L, 1000000L, imTrX.c:366: return_code = XGetWindowProperty(im->core.display, imTrX.c:380: if (XGetWindowProperty(im->core.display, imTrX.c:401: if (XGetWindowProperty(im->core.display, imTrX.c:419: return_code = XGetWindowProperty(im->core.display, ScrResStr.c:44: XGetWindowProperty(screen->display, screen->root, prop_name, StBytes.c:68: if (XGetWindowProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], Xatomtype.h:53: * This files defines crock C structures for calling XGetWindowProperty and Xlib.h:2698:extern int XGetWindowProperty( #### XGetZoomHints #### GetHints.c:150:XGetZoomHints ( Xutil.h:517:extern Status XGetZoomHints( #### XGrabButton #### GrButton.c:33:XGrabButton( Xlib.h:2719:extern int XGrabButton( #### XGrabKey #### GrKeybd.c:31:int XGrabKeyboard ( GrKey.c:33:XGrabKey( Xlib.h:2732:extern int XGrabKey( Xlib.h:2742:extern int XGrabKeyboard( #### XGrabKeyboard #### GrKeybd.c:31:int XGrabKeyboard ( Xlib.h:2742:extern int XGrabKeyboard( #### XGrabPointer #### GrPointer.c:32:int XGrabPointer( Xlib.h:2751:extern int XGrabPointer( #### XGrabServer #### GrServer.c:33:XGrabServer (register Display *dpy) Xlib.h:2763:extern int XGrabServer( #### XHeightMMOfScreen #### Macros.c:220:int XHeightMMOfScreen(Screen *s) { return (HeightMMOfScreen(s)); } Xlib.h:2767:extern int XHeightMMOfScreen( #### XHeightOfScreen #### Macros.c:216:int XHeightOfScreen(Screen *s) { return (HeightOfScreen(s)); } Xlib.h:2771:extern int XHeightOfScreen( #### XIMOfIC #### ICWrap.c:366:XIMOfIC(XIC ic) imThaiFlt.c:568: im = (Xim) XIMOfIC((XIC)ic); imThaiFlt.c:1194: im = (Xim) XIMOfIC((XIC)ic); Xlib.h:3911:extern XIM XIMOfIC( #### XIconifyWindow #### Iconify.c:65:Status XIconifyWindow ( Xlib.h:1895:extern Status XIconifyWindow( #### XIfEvent #### IfEvent.c:38:XIfEvent ( imDefIm.c:257: XIfEvent(display, &event, _CheckSNEvent, (XPointer)&window); imTrX.c:197: XIfEvent(im->core.display, &event, _CheckConnect, (XPointer)im); imTrX.c:476: XIfEvent(im->core.display, ev, _CheckCMEvent, (XPointer)im); Xlib.h:2775:extern int XIfEvent( #### XImageByteOrder #### Macros.c:139:int XImageByteOrder(Display *dpy) { return (ImageByteOrder(dpy)); } Xlib.h:2786:extern int XImageByteOrder( #### XInitExtension #### Font.c:337: XExtCodes *codes = XInitExtension(dpy, XF86BIGFONTNAME); InitExt.c:41:XExtCodes *XInitExtension ( XKBUse.c:739: if ((codes = XInitExtension(dpy, XkbName)) == NULL) { Xlib.h:1749:extern XExtCodes *XInitExtension( #### XInitImage #### ImUtil.c:271:void _XInitImageFuncPtrs ( ImUtil.c:383: _XInitImageFuncPtrs (image); ImUtil.c:388:Status XInitImage (XImage *image) ImUtil.c:422: _XInitImageFuncPtrs (image); ImUtil.c:560: _XInitImageFuncPtrs(ximage); ImUtil.c:584: _XInitImageFuncPtrs(ximage); ImUtil.c:603: _XInitImageFuncPtrs(ximage); ImUtil.c:627: _XInitImageFuncPtrs(ximage); ImUtil.c:747: _XInitImageFuncPtrs(ximage); ImUtil.c:772: _XInitImageFuncPtrs(ximage); ImUtil.c:787: _XInitImageFuncPtrs(ximage); ImUtil.c:816: _XInitImageFuncPtrs(ximage); ImUtil.c:868: _XInitImageFuncPtrs (subimage); PutImage.c:997: _XInitImageFuncPtrs(&img); ImUtil.h:28:_XInitImageFuncPtrs( Xlib.h:1454:extern Status XInitImage( #### XInitThreads #### locking.c:572:Status XInitThreads(void) locking.c:583: "XInitThreads called, but no libthread in the calling program!\n" ); locking.c:621:Status XInitThreads(void) XlibInt.c:81:/* these pointers get initialized by XInitThreads */ XlibInt.c:900:/* NOTE: only called if !XTHREADS, or when XInitThreads wasn't called. */ Xlib.h:1735:extern Status XInitThreads( #### XInsertModifiermapEntry #### ModMap.c:125:XInsertModifiermapEntry(XModifierKeymap *map, Xlib.h:1428:extern XModifierKeymap *XInsertModifiermapEntry( #### XInstallColormap #### InsCmap.c:33:XInstallColormap( Xlib.h:2790:extern int XInstallColormap( #### XInternAtom #### GetWMCMapW.c:68: prop = XInternAtom(dpy, "WM_COLORMAP_WINDOWS", False); GetWMProto.c:68: prop = XInternAtom(dpy, "WM_PROTOCOLS", False); Iconify.c:72: prop = XInternAtom (dpy, "WM_CHANGE_STATE", False); imDefIm.c:337: if((locales = XInternAtom(display, XIM_LOCALES, True)) == (Atom)None) imDefIm.c:360: if((transport = XInternAtom(display, XIM_TRANSPORT, True)) == (Atom)None) imDefIm.c:405: if((imserver = XInternAtom(display, XIM_SERVERS, True)) == (Atom)None) imInsClbk.c:94: if( (ims = XInternAtom( display, XIM_SERVERS, True )) == None || imTrX.c:286: atom = XInternAtom(im->core.display, _NewAtom(atomName), False); imTrX.c:502: spec->improtocolid = XInternAtom(im->core.display, _XIM_PROTOCOL, False); imTrX.c:503: spec->imconnectid = XInternAtom(im->core.display, _XIM_XCONNECT, False); imTrX.c:504: spec->immoredataid = XInternAtom(im->core.display, _XIM_MOREDATA, False); IntAtom.c:57:Atom _XInternAtom( IntAtom.c:162:XInternAtom ( IntAtom.c:175: if ((atom = _XInternAtom(dpy, name, onlyIfExists, &sig, &idx, &n))) { IntAtom.c:240:XInternAtoms ( IntAtom.c:265: if (!(atoms_return[i] = _XInternAtom(dpy, names[i], onlyIfExists, lcPrTxt.c:142: else if (encoding == XInternAtom(dpy, "UTF8_STRING", False)) lcPrTxt.c:144: else if (encoding == XInternAtom(dpy, "COMPOUND_TEXT", False)) lcPrTxt.c:146: else if (encoding == XInternAtom(dpy, XLC_PUBLIC(lcd, encoding_name), False)) lcTxtPr.c:102: encoding = XInternAtom(dpy, "UTF8_STRING", False); lcTxtPr.c:106: encoding = XInternAtom(dpy, "COMPOUND_TEXT", False); lcTxtPr.c:110: encoding = XInternAtom(dpy, XLC_PUBLIC(lcd, encoding_name), False); lcTxtPr.c:176: encoding = XInternAtom(dpy, "COMPOUND_TEXT", False); LRGB.c:467: Atom CorrectAtom = XInternAtom (dpy, XDCCC_CORRECT_ATOM_NAME, True); LRGB.c:468: Atom MatrixAtom = XInternAtom (dpy, XDCCC_MATRIX_ATOM_NAME, True); ScrResStr.c:42: prop_name = XInternAtom(screen->display, "SCREEN_RESOURCES", True); SetWMCMapW.c:68: prop = XInternAtom (dpy, "WM_COLORMAP_WINDOWS", False); SetWMProto.c:68: prop = XInternAtom (dpy, "WM_PROTOCOLS", False); WMProps.c:143: XChangeProperty (dpy, w, XInternAtom(dpy, "WM_LOCALE_NAME", False), XKB.c:35:XkbInternAtomFunc _XkbInternAtomFunc = XInternAtom; XKB.c:772: _XkbInternAtomFunc = (getAtom ? getAtom : XInternAtom); XKBUse.c:692: xkbi->composeLED = XInternAtom(dpy, str, False); XKBUse.c:704: xkbi->composeLED = XInternAtom(dpy, "Compose", False); Xlib.h:1537:extern Atom XInternAtom( Xlib.h:1542:extern Status XInternAtoms( Xlibint.h:185: struct _XDisplayAtoms *atoms; /* for XInternAtom */ #### XInternAtoms #### IntAtom.c:240:XInternAtoms ( Xlib.h:1542:extern Status XInternAtoms( #### XInternalConnectionNumbers #### XlibInt.c:2457: * XInternalConnectionNumbers or, more typically, by registering XlibInt.c:2548:/* XInternalConnectionNumbers XlibInt.c:2558:XInternalConnectionNumbers( XlibInt.c:2569: fprintf(stderr, "XInternalConnectionNumbers: Got called.\n"); Xlib.h:3980:extern Status XInternalConnectionNumbers( #### XIntersectRegion #### Region.c:346: else XIntersectRegion(a,b,c) Region.c:486:XIntersectRegion( Xutil.h:523:extern int XIntersectRegion( #### XKeycodeToKeysym #### KeyBind.c:57:#define XKeycodeToKeysym _XKeycodeToKeysym KeyBind.c:118:XKeycodeToKeysym(Display *dpy, XKBBind.c:96:XKeycodeToKeysym(Display *dpy, XKBBind.c:107: return _XKeycodeToKeysym(dpy, kc, col); XKBBind.c:225: return XKeycodeToKeysym(dpy, event->keycode, col); XKBlibint.h:133:extern KeySym _XKeycodeToKeysym( Xlib.h:1688:extern KeySym XKeycodeToKeysym( #### XKeysymToKeycode #### imThaiFlt.c:1266: KeyCode numlock_keycode = XKeysymToKeycode (d, XK_Num_Lock); KeyBind.c:58:#define XKeysymToKeycode _XKeysymToKeycode KeyBind.c:132:XKeysymToKeycode( XKBBind.c:153:XKeysymToKeycode(Display *dpy, KeySym ks) XKBBind.c:158: return _XKeysymToKeycode(dpy, ks); XKBlibint.h:143:extern KeyCode _XKeysymToKeycode( Xlib.h:2795:extern KeyCode XKeysymToKeycode( #### XKeysymToString #### KeysymStr.c:71:char *XKeysymToString(KeySym ks) Xlib.h:1519:extern char *XKeysymToString( #### XKillClient #### KillCl.c:33:XKillClient( Xlib.h:2800:extern int XKillClient( #### XLastKnownRequestProcessed #### Macros.c:164:unsigned long XLastKnownRequestProcessed(Display *dpy) Xlib.h:1810:extern unsigned long XLastKnownRequestProcessed( #### XListDepths #### Depths.c:34: * XListDepths - return info from connection setup Depths.c:36:int *XListDepths ( Xlib.h:1867:extern int *XListDepths( #### XListExtensions #### ListExt.c:33:char **XListExtensions( Xlib.h:1673:extern char **XListExtensions( #### XListFonts #### FontInfo.c:42:char **XListFontsWithInfo( FontInfo.c:152: nbytes++; /* make first string 1 byte longer, to match XListFonts */ FontInfo.c:159: *flist[0] = 0; /* zero to distinguish from XListFonts */ FontNames.c:35:XListFonts( omGeneric.c:302: fn_list = XListFontsWithInfo(dpy, font_set->font_name, 1, &fn_num, omGeneric.c:489: list = XListFonts(oc->core.om->core.display, pattern, 1, &count); omGeneric.c:638: if ((fn_list = XListFontsWithInfo(dpy, pattern, omGeneric.c:774: /* This may mot be needed anymore as XListFonts() takes care of this */ XDefaultOMIF.c:292: list = XListFonts(dpy, pattern, 1, &count); XDefaultOMIF.c:349: if ((fn_list = XListFontsWithInfo(dpy, font_name, Xlib.h:1656:extern char **XListFonts( Xlib.h:1662:extern char **XListFontsWithInfo( #### XListFontsWithInfo #### FontInfo.c:42:char **XListFontsWithInfo( omGeneric.c:302: fn_list = XListFontsWithInfo(dpy, font_set->font_name, 1, &fn_num, omGeneric.c:638: if ((fn_list = XListFontsWithInfo(dpy, pattern, XDefaultOMIF.c:349: if ((fn_list = XListFontsWithInfo(dpy, font_name, Xlib.h:1662:extern char **XListFontsWithInfo( #### XListHosts #### LiHosts.c:71:XHostAddress *XListHosts ( Xlib.h:1682:extern XHostAddress *XListHosts( #### XListInstalledColormaps #### LiICmaps.c:32:Colormap *XListInstalledColormaps( Xlib.h:1651:extern Colormap *XListInstalledColormaps( #### XListPixmapFormats #### PixFormats.c:34: * XListPixmapFormats - return info from connection setup PixFormats.c:37:XPixmapFormatValues *XListPixmapFormats ( Xlib.h:1863:extern XPixmapFormatValues *XListPixmapFormats( #### XListProperties #### LiProps.c:32:Atom *XListProperties( Xlib.h:1677:extern Atom *XListProperties( #### XLoadFont #### Cursor.c:46: dpy->cursor_font = XLoadFont (dpy, CURSORFONT); LoadFont.c:33:XLoadFont ( Xlib.h:1581:extern Font XLoadFont( #### XLoadQueryFont #### Font.c:91:XFontStruct *XLoadQueryFont( Font.c:684: fs = XLoadQueryFont(dpy, buf); omGeneric.c:210: fd->font = XLoadQueryFont(dpy, fd->xlfd_name); omGeneric.c:233: font_set->font = XLoadQueryFont(dpy, font_set->font_name); omXChar.c:288: font_set->font = XLoadQueryFont(oc->core.om->core.display, XDefaultOMIF.c:197: font_set->font = XLoadQueryFont(dpy, font_set->font_name); XDefaultOMIF.c:298: fs = XLoadQueryFont(dpy, pattern); Xlib.h:1395:extern XFontStruct *XLoadQueryFont( #### XLocaleOfFontSet #### FSWrap.c:225:XLocaleOfFontSet(XFontSet font_set) Xlib.h:3654:extern char *XLocaleOfFontSet( #### XLocaleOfIM #### IMWrap.c:155:XLocaleOfIM(XIM im) Xlib.h:3871:extern char *XLocaleOfIM( #### XLocaleOfOM #### OMWrap.c:126:XLocaleOfOM(XOM om) Xlib.h:3604:extern char *XLocaleOfOM( #### XLockDisplay #### LockDis.c:43:XLockDisplay( LockDis.c:52: * XLockDisplay returns, in case they have any side effects the LockDis.c:53: * caller of XLockDisplay was trying to protect against. LockDis.c:54: * XLockDisplay puts itself at the head of the event waiters queue locking.c:153:static void _XLockDisplayWarn( locking.c:451:static void _XLockDisplay( locking.c:457: _XLockDisplayWarn(dpy, file, line); locking.c:478: _XLockDisplayWarn(dpy, file, line); locking.c:502: /* signal other threads that might be waiting in XLockDisplay */ locking.c:547: xcondition_set_name(dpy->lock->cv, "XLockDisplay"); locking.c:550: dpy->lock_fns->lock_display = _XLockDisplay; locking.c:561: dpy->lock->lock_wait = NULL; /* filled in by XLockDisplay() */ XlibInt.c:1137: * or XLockDisplay XlibInt.c:1142: /* some thread is in XProcessInternalConnection or XLockDisplay XlibInt.c:1367: * or XLockDisplay XlibInt.c:1372: /* some thread is in XProcessInternalConnection or XLockDisplay locking.h:64: /* for XLockDisplay */ locking.h:65: int locking_level; /* how many times into XLockDisplay we are */ locking.h:66: xthread_t locking_thread; /* thread that did XLockDisplay */ locking.h:67: xcondition_t cv; /* wait if another thread has XLockDisplay */ Xlib.h:1739:extern void XLockDisplay( #### XLookupColor #### LookupCol.c:36:XLookupColor ( Xcmsint.h:74: * XLookupColor() Xlib.h:2805:extern Status XLookupColor( #### XLookupKeysym #### KeyBind.c:59:#define XLookupKeysym _XLookupKeysym KeyBind.c:150:XLookupKeysym( XKBBind.c:218:XLookupKeysym(register XKeyEvent * event, int col) XKBBind.c:223: return _XLookupKeysym(event, col); XKBlibint.h:148:extern KeySym _XLookupKeysym( Xlib.h:1697:extern KeySym XLookupKeysym( #### XLookupString #### imConv.c:47: * rather than just call _XLookupString (i.e. the pre-XKB XLookupString) imConv.c:49: * _XLookupString doesn't grok. imConv.c:54:#define XLOOKUPSTRING XLookupString imConv.c:148: ret = XLookupString(event, (char *)buffer, nbytes, keysym, status); imDefFlt.c:55: XLookupString(ev, buf, BUFSIZE, &keysym, NULL); imLcFlt.c:55: XLookupString((XKeyEvent *)ev, buf, sizeof(buf), &keysym, NULL); imLcFlt.c:99: XLookupString((XKeyEvent *)ev, buf, sizeof(buf), &keysym, NULL); KeyBind.c:61:#define XLookupString _XLookupString KeyBind.c:876:XLookupString ( XDefaultIMIF.c:419: length = XLookupString(ev, buffer, bytes, keysym, &NotSupportedYet); XDefaultIMIF.c:445: length = XLookupString(ev, mb_buf, wlen, keysym, &NotSupportedYet); XKBBind.c:672:XLookupString(register XKeyEvent *event, XKBBind.c:724: /* that were used to compute the symbol here, but pre-XKB XLookupString */ XKBUse.c:714: "XKEYBOARD XLookupString: %slatin-1, %s lookup modifiers\n", XKBUse.c:718: "XKEYBOARD XLookupString: %sconsume shift and lock, %scontrol fallback\n", XKBlibint.h:178:extern int _XLookupString( Xlibint.h:172: KeySym lock_meaning; /* for XLookupString */ Xlibint.h:183: struct _XKeytrans *key_bindings; /* for XLookupString */ Xutil.h:230: * Compose sequence status structure, used in calling XLookupString. Xutil.h:535:extern int XLookupString( #### XLowerWindow #### LowerWin.c:33:XLowerWindow( Xlib.h:2813:extern int XLowerWindow( #### XMapRaised #### MapRaised.c:33:XMapRaised ( Xlib.h:2818:extern int XMapRaised( #### XMapSubwindows #### MapSubs.c:33:XMapSubwindows( Xlib.h:2823:extern int XMapSubwindows( #### XMapWindow #### MapWindow.c:33:XMapWindow ( Xlib.h:2828:extern int XMapWindow( #### XMaskEvent #### MaskEvent.c:44:XMaskEvent ( Xlib.h:2833:extern int XMaskEvent( #### XMatchVisualInfo #### VisUtil.c:189:Status XMatchVisualInfo( Xutil.h:543:extern Status XMatchVisualInfo( #### XMaxCmapsOfScreen #### Macros.c:228:int XMaxCmapsOfScreen(Screen *s) { return (MaxCmapsOfScreen(s)); } Xlib.h:2839:extern int XMaxCmapsOfScreen( #### XMaxRequestSize #### Misc.c:32:long XMaxRequestSize(Display *dpy) Xlib.h:1714:extern long XMaxRequestSize( #### XMinCmapsOfScreen #### Macros.c:226:int XMinCmapsOfScreen(Screen *s) { return (MinCmapsOfScreen(s)); } Xlib.h:2843:extern int XMinCmapsOfScreen( #### XMoveResizeWindow #### ConfWind.c:33:XMoveResizeWindow( Xlib.h:2847:extern int XMoveResizeWindow( #### XMoveWindow #### MoveWin.c:33:XMoveWindow ( Xlib.h:2856:extern int XMoveWindow( #### XNewModifiermap #### ModMap.c:97:XNewModifiermap(int keyspermodifier) ModMap.c:149: if ((newmap = XNewModifiermap(map->max_keypermod+1)) == NULL) Xlib.h:1438:extern XModifierKeymap *XNewModifiermap( #### XNextEvent #### NextEvent.c:38:XNextEvent ( XlibInt.c:2807: (called by XNextEvent). XlibInt.c:2850: * next call to XNextEvent(). Xlib.h:2863:extern int XNextEvent( #### XNextRequest #### Macros.c:142:unsigned long XNextRequest(Display *dpy) Macros.c:147:/* XNextRequest() differs from the rest of the functions here because it is Macros.c:151: * but we can at least make XNextRequest() do the right thing. Macros.c:153:unsigned long XNextRequest(Display *dpy) Macros.c:157: next_request = _XNextRequest(dpy); Xlib.h:1807:extern unsigned long XNextRequest( #### XNoOp #### Macros.c:293:XNoOp (register Display *dpy) Xlib.h:2868:extern int XNoOp( #### XOMOfOC #### OCWrap.c:85:XOMOfOC(XOC oc) Xlib.h:3617:extern XOM XOMOfOC( #### XOffsetRegion #### Region.c:299:XOffsetRegion( Region.c:347:#define ZShiftRegion(a,b) if (xdir) XOffsetRegion(a,b,0); \ Region.c:348: else XOffsetRegion(a,0,b) Region.c:397: XOffsetRegion(r, dx, dy); Xutil.h:551:extern int XOffsetRegion( #### XOpenDisplay #### ConnDis.c:1011: * so we can tell XOpenDisplay to not bother looking for it by DisName.c:32: * Returns the name of the display XOpenDisplay would use. This is better DisName.c:39: * For example, this is used in XOpenDisplay() as OpenDis.c:111:XOpenDisplay ( OpenDis.c:152: fprintf(stderr, "\nXOpenDisplay: Called with display [%s].\n", display); OpenDis.c:228: fprintf(stderr, "\nXOpenDisplay: Connected display with dpy->fd = [%d].\n", dpy->fd); OpenDis.c:808: fprintf(stderr, "XOpenDisplay: Returning display at [%p].\n", dpy); OpenDis.c:843: * Display. It is used by XOpenDisplay if it runs out of memory, OpenDis.c:846: * by XOpenDisplay before the Display structure is fully formed. OpenDis.c:847: * XOpenDisplay must be sure to initialize all the pointers to NULL OpenDis.c:975:/* OutOfMemory is called if malloc fails. XOpenDisplay returns NULL XKB.c:747: dpy = XOpenDisplay(name); Xlib.h:1484:extern Display *XOpenDisplay( #### XOpenIM #### IMWrap.c:115:XOpenIM(Display *display, XrmDatabase rdb, char *res_name, char *res_class) Xlcint.h:237:typedef XIM (*XOpenIMProc)( Xlcint.h:317: XOpenIMProc open_im; Xlib.h:3848:extern XIM XOpenIM( #### XOpenOM #### FSWrap.c:178: om = XOpenOM(dpy, NULL, NULL, NULL); OMWrap.c:33:XOpenOM(Display *dpy, XrmDatabase rdb, _Xconst char *res_name, Xlcint.h:229:typedef XOM (*XOpenOMProc)( Xlcint.h:316: XOpenOMProc open_om; Xlib.h:3579:extern XOM XOpenOM( #### XParseColor #### ParseCol.c:36:XParseColor ( Xcmsint.h:75: * XParseColor() Xlib.h:2872:extern Status XParseColor( #### XParseGeometry #### Geom.c:64: pmask = XParseGeometry(pos, &px, &py, &pwidth, &pheight); Geom.c:65: dmask = XParseGeometry(def, &dx, &dy, &dwidth, &dheight); ParseGeom.c:37: * XParseGeometry parses strings of the form ParseGeom.c:73:XParseGeometry ( WMGeom.c:94: rmask = umask = XParseGeometry (user_geom, &ux, &uy, &uwidth, &uheight); WMGeom.c:95: dmask = XParseGeometry (def_geom, &dx, &dy, &dwidth, &dheight); Xlib.h:2879:extern int XParseGeometry( Xutil.h:66: * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding #### XPeekEvent #### PeekEvent.c:39:XPeekEvent ( Xlib.h:2887:extern int XPeekEvent( #### XPeekIfEvent #### PeekIfEv.c:39:XPeekIfEvent ( Xlib.h:2892:extern int XPeekIfEvent( #### XPending #### Pending.c:59:int XPending (register Display *dpy) Xlib.h:2903:extern int XPending( #### XPlanesOfScreen #### Macros.c:222:int XPlanesOfScreen(Screen *s) { return (PlanesOfScreen(s)); } Xlib.h:2907:extern int XPlanesOfScreen( #### XPointInRegion #### Region.c:1507:XPointInRegion( Xutil.h:557:extern Bool XPointInRegion( #### XPolygonRegion #### PolyReg.c:472:XPolygonRegion( Xutil.h:563:extern Region XPolygonRegion( #### XProcessInternalConnection #### XlibInt.c:818: _XProcessInternalConnection(dpy, ilist); XlibInt.c:1136: * unless we were called from within XProcessInternalConnection XlibInt.c:1142: /* some thread is in XProcessInternalConnection or XLockDisplay XlibInt.c:1366: * unless we were called from within XProcessInternalConnection XlibInt.c:1372: /* some thread is in XProcessInternalConnection or XLockDisplay XlibInt.c:2453: * and detects input available, it must call XProcessInternalConnection, XlibInt.c:2592:void _XProcessInternalConnection( XlibInt.c:2616:/* XProcessInternalConnection XlibInt.c:2622:XProcessInternalConnection( XlibInt.c:2630: fprintf(stderr, "XProcessInternalConnection: Got called.\n"); XlibInt.c:2636: _XProcessInternalConnection(dpy, info_list); locking.h:69: xthread_t conni_thread; /* thread in XProcessInternalConnection */ Xlib.h:3986:extern void XProcessInternalConnection( Xlibint.h:426:#define XlibDisplayProcConni (1L << 4) /* in _XProcessInternalConnection */ Xlibint.h:1231:extern void _XProcessInternalConnection( #### XProtocolRevision #### Macros.c:117:int XProtocolRevision(Display *dpy) { return (ProtocolRevision(dpy));} Xlib.h:2911:extern int XProtocolRevision( #### XProtocolVersion #### Macros.c:115:int XProtocolVersion(Display *dpy) { return (ProtocolVersion(dpy)); } Xlib.h:2915:extern int XProtocolVersion( #### XPutBackEvent #### imDefLkup.c:375: XPutBackEvent(d, &ev); imDefLkup.c:728: XPutBackEvent(im->core.display, (XEvent *)&ev); imExten.c:159: XPutBackEvent(im->core.display, &ev); imLcFlt.c:123: XPutBackEvent(d, ev); imLcFlt.c:153: _XPutBackEvent(d, ev); imThaiFlt.c:1419: XPutBackEvent(d, ev); imTrans.c:239: XPutBackEvent(im->core.display, &ev); imTrX.c:359: XPutBackEvent(im->core.display, event); imTrX.c:414: XPutBackEvent(im->core.display, event); PutBEvent.c:29:/* XPutBackEvent puts an event back at the head of the queue. */ PutBEvent.c:36:_XPutBackEvent ( PutBEvent.c:77:XPutBackEvent ( PutBEvent.c:84: ret = _XPutBackEvent(dpy, event); XlibInt.c:829: XPutBackEvent. We notice it here and if we needed an event, XlibInt.c:1460: done XPutBackEvent. Which we can use so we're done. */ XlibInt.c:1572: return -2; /* internal connection did XPutBackEvent */ XlibInt.c:1578: return -2; /* internal connection did XPutBackEvent */ Xlib.h:2920:extern int XPutBackEvent( Xlibint.h:1333:int _XPutBackEvent ( #### XPutImage #### CrBFData.c:76: XPutImage(display, pix, gc, &ximage, 0, 0, 0, 0, width, height); CrPFBData.c:85: XPutImage(display, pix, gc, &ximage, 0, 0, 0, 0, width, height); PutImage.c:932:XPutImage ( Xlib.h:2925:extern int XPutImage( #### XPutPixel #### ImUtil.c:41:static int _XPutPixel(XImage *, int, int, unsigned long); ImUtil.c:42:static int _XPutPixel1(XImage *, int, int, unsigned long); ImUtil.c:43:static int _XPutPixel8(XImage *, int, int, unsigned long); ImUtil.c:44:static int _XPutPixel16(XImage *, int, int, unsigned long); ImUtil.c:45:static int _XPutPixel32(XImage *, int, int, unsigned long); ImUtil.c:103: * _XPutPixel Writes a pixel into an image data structure ImUtil.c:104: * _XPutPixel32 Writes a pixel into a 32-bit Z image data structure ImUtil.c:105: * _XPutPixel16 Writes a pixel into a 16-bit Z image data structure ImUtil.c:106: * _XPutPixel8 Writes a pixel into an 8-bit Z image data structure ImUtil.c:107: * _XPutPixel1 Writes a pixel into an 1-bit image data structure ImUtil.c:278: image->f.put_pixel = _XPutPixel8; ImUtil.c:282: image->f.put_pixel = _XPutPixel1; ImUtil.c:286: image->f.put_pixel = _XPutPixel32; ImUtil.c:290: image->f.put_pixel = _XPutPixel16; ImUtil.c:293: image->f.put_pixel = _XPutPixel; ImUtil.c:648:static int _XPutPixel ( ImUtil.c:721:static int _XPutPixel32 ( ImUtil.c:748: return XPutPixel(ximage, x, y, pixel); ImUtil.c:752:static int _XPutPixel16 ( ImUtil.c:773: return XPutPixel(ximage, x, y, pixel); ImUtil.c:777:static int _XPutPixel8 ( ImUtil.c:788: return XPutPixel(ximage, x, y, pixel); ImUtil.c:792:static int _XPutPixel1 ( ImUtil.c:817: return XPutPixel(ximage, x, y, pixel); ImUtil.c:889: XPutPixel(subimage, (col - x), (row - y), pixel); ImUtil.c:949: XPutPixel(dstimg, x + col, y + row, pixel); ImUtil.c:1011: XPutPixel(ximage, x, y, pixel); Macros.c:266:#undef XPutPixel Macros.c:267:int XPutPixel( PutImage.c:1000: XPutPixel(&img, i, j, XGetPixel(image, req_xoffset + i, Xutil.h:201:extern int XPutPixel( Xutil.h:221:#define XPutPixel(ximage, x, y, pixel) \ #### XQLength #### Macros.c:79:int XQLength(Display *dpy) { return (QLength(dpy)); } Xlib.h:2938:extern int XQLength( #### XQueryBestCursor #### QuCurShp.c:32:Status XQueryBestCursor( Xlib.h:2942:extern Status XQueryBestCursor( #### XQueryBestSize #### QuBest.c:32:Status XQueryBestSize( Xlib.h:2951:extern Status XQueryBestSize( #### XQueryBestStipple #### QuStipShp.c:32:Status XQueryBestStipple( Xlib.h:2961:extern Status XQueryBestStipple( #### XQueryBestTile #### QuTileShp.c:32:Status XQueryBestTile( Xlib.h:2970:extern Status XQueryBestTile( #### XQueryColor #### QuCol.c:63: * This routine uses XQueryColor to obtain the X RGB values QuCol.c:76: return(_XcmsSetGetColor(XQueryColor, dpy, colormap, QuColor.c:33:XQueryColor( QuColors.c:33:_XQueryColors( QuColors.c:75:XQueryColors( QuColors.c:90: _XQueryColors(dpy, cmap, defs, n); QuColors.c:95: _XQueryColors(dpy, cmap, defs, ncolors); QuCols.c:63: * This routine uses XQueryColors to obtain the X RGB values QuCols.c:76: return(_XcmsSetGetColors(XQueryColors, dpy, colormap, SetGetCols.c:107: || (*xColorProc == XQueryColor)) ) { SetGetCols.c:115: if (*xColorProc == XQueryColor) { SetGetCols.c:140: } else if ((*xColorProc == XQueryColor) || (*xColorProc == XStoreColor)) { SetGetCols.c:141: /* Note: XQueryColor and XStoreColor do not return any Status */ SetGetCols.c:229: if ( !((*xColorProc == XStoreColors) || (*xColorProc == XQueryColors)) ) { SetGetCols.c:245: if (*xColorProc == XQueryColors) { SetGetCols.c:267: if ((*xColorProc == XQueryColors) || (*xColorProc == XStoreColors)){ SetGetCols.c:268: /* Note: XQueryColors and XStoreColors do not return any Status */ Xlib.h:2979:extern int XQueryColor( Xlib.h:2985:extern int XQueryColors( #### XQueryColors #### QuColors.c:33:_XQueryColors( QuColors.c:75:XQueryColors( QuColors.c:90: _XQueryColors(dpy, cmap, defs, n); QuColors.c:95: _XQueryColors(dpy, cmap, defs, ncolors); QuCols.c:63: * This routine uses XQueryColors to obtain the X RGB values QuCols.c:76: return(_XcmsSetGetColors(XQueryColors, dpy, colormap, SetGetCols.c:229: if ( !((*xColorProc == XStoreColors) || (*xColorProc == XQueryColors)) ) { SetGetCols.c:245: if (*xColorProc == XQueryColors) { SetGetCols.c:267: if ((*xColorProc == XQueryColors) || (*xColorProc == XStoreColors)){ SetGetCols.c:268: /* Note: XQueryColors and XStoreColors do not return any Status */ Xlib.h:2985:extern int XQueryColors( #### XQueryExtension #### InitExt.c:47: if (!XQueryExtension(dpy, name, QuExt.c:33:XQueryExtension( Xlib.h:2992:extern Bool XQueryExtension( #### XQueryFont #### Font.c:55:static XFontStruct *_XQueryFont( Font.c:121: font_result = _XQueryFont(dpy, fid, seq); Font.c:127:XFontStruct *XQueryFont ( Font.c:144: font_result = _XQueryFont(dpy, fid, 0L); Font.c:181:_XQueryFont ( Font.c:436: /* The function _XQueryFont benefits from a "magic" error handler for Xlib.h:1400:extern XFontStruct *XQueryFont( #### XQueryKeymap #### QuKeybd.c:37:XQueryKeymap( Xlib.h:3000:extern int XQueryKeymap( #### XQueryPointer #### QuPntr.c:32:Bool XQueryPointer( Xlib.h:3005:extern Bool XQueryPointer( #### XQueryTextExtents16 #### QuTextE16.c:33:XQueryTextExtents16 ( Xlib.h:3028:extern int XQueryTextExtents16( #### XQueryTextExtents #### QuTextE16.c:33:XQueryTextExtents16 ( QuTextExt.c:33:XQueryTextExtents ( Xlib.h:3017:extern int XQueryTextExtents( Xlib.h:3028:extern int XQueryTextExtents16( #### XQueryTree #### QuTree.c:32:Status XQueryTree ( Xlib.h:3039:extern Status XQueryTree( #### XRaiseWindow #### RaiseWin.c:33:XRaiseWindow ( Xlib.h:3048:extern int XRaiseWindow( #### XReadBitmapFile #### RdBitF.c:109:XReadBitmapFileData ( RdBitF.c:240:XReadBitmapFile ( RdBitF.c:253: res = XReadBitmapFileData(filename, width, height, &data, x_hot, y_hot); Xlib.h:3053:extern int XReadBitmapFile( Xlib.h:3064:extern int XReadBitmapFileData( Xutil.h:338: * return codes for XReadBitmapFile and XWriteBitmapFile #### XReadBitmapFileData #### RdBitF.c:109:XReadBitmapFileData ( RdBitF.c:253: res = XReadBitmapFileData(filename, width, height, &data, x_hot, y_hot); Xlib.h:3064:extern int XReadBitmapFileData( #### XRebindKeysym #### KeyBind.c:912:XRebindKeysym ( Xlib.h:3073:extern int XRebindKeysym( #### XRecolorCursor #### RecolorC.c:33:XRecolorCursor( Xlib.h:3082:extern int XRecolorCursor( #### XReconfigureWMWindow #### ReconfWM.c:37:Status XReconfigureWMWindow ( Xlib.h:1875:extern Status XReconfigureWMWindow( #### XRectInRegion #### Region.c:1526:XRectInRegion( Xutil.h:276:/* Return values from XRectInRegion() */ Xutil.h:569:extern int XRectInRegion( #### XRefreshKeyboardMapping #### KeyBind.c:60:#define XRefreshKeyboardMapping _XRefreshKeyboardMapping KeyBind.c:228:XRefreshKeyboardMapping(register XMappingEvent *event) XKBBind.c:354: _XRefreshKeyboardMapping((XMappingEvent *) event); XKBBind.c:390:XRefreshKeyboardMapping(register XMappingEvent * event) XKBBind.c:398: (void) _XRefreshKeyboardMapping(event); XKBlibint.h:153:extern int _XRefreshKeyboardMapping( Xlib.h:3089:extern int XRefreshKeyboardMapping( #### XRegisterIMInstantiateCallback #### IMWrap.c:165:XRegisterIMInstantiateCallback( Xlib.h:3953:extern Bool XRegisterIMInstantiateCallback( #### XRemoveConnectionWatch #### XlibInt.c:2703:/* XRemoveConnectionWatch XlibInt.c:2709:XRemoveConnectionWatch( XlibInt.c:2721: fprintf(stderr, "XRemoveConnectionWatch: Got called.\n"); Xlib.h:3997:extern void XRemoveConnectionWatch( #### XRemoveFromSaveSet #### ChSaveSet.c:58:XRemoveFromSaveSet ( Xlib.h:3093:extern int XRemoveFromSaveSet( #### XRemoveHost #### Host.c:113:XRemoveHost ( Host.c:134:XRemoveHosts ( Host.c:141: (void) XRemoveHost(dpy, &hosts[i]); Xlib.h:3098:extern int XRemoveHost( Xlib.h:3103:extern int XRemoveHosts( #### XRemoveHosts #### Host.c:134:XRemoveHosts ( Xlib.h:3103:extern int XRemoveHosts( #### XReparentWindow #### RepWindow.c:33:XReparentWindow( Xlib.h:3109:extern int XReparentWindow( #### XResetScreenSaver #### FSSaver.c:40:XResetScreenSaver(register Display *dpy) Xlib.h:3117:extern int XResetScreenSaver( #### XResizeWindow #### ChWindow.c:33:XResizeWindow( Xlib.h:3121:extern int XResizeWindow( #### XResourceManagerString #### Misc.c:37:char *XResourceManagerString(Display *dpy) Xlib.h:1720:extern char *XResourceManagerString( #### XRestackWindows #### RestackWs.c:33:XRestackWindows ( Xlib.h:3128:extern int XRestackWindows( #### XRootWindow #### Macros.c:45:Window XRootWindow (Display *dpy, int scr) Macros.c:182:Window XRootWindowOfScreen(Screen *s) { return (RootWindowOfScreen(s)); } Xlib.h:1766:extern Window XRootWindow( Xlib.h:1773:extern Window XRootWindowOfScreen( #### XRootWindowOfScreen #### Macros.c:182:Window XRootWindowOfScreen(Screen *s) { return (RootWindowOfScreen(s)); } Xlib.h:1773:extern Window XRootWindowOfScreen( #### XRotateBuffers #### StBytes.c:45:XRotateBuffers ( Xlib.h:3134:extern int XRotateBuffers( #### XRotateWindowProperties #### RotProp.c:33:XRotateWindowProperties( StBytes.c:49: /* XRotateWindowProperties wants a non-const Atom*, but it doesn't StBytes.c:52: return XRotateWindowProperties(dpy, RootWindow(dpy, 0), (Atom *)n_to_atom, 8, rotate); Xlib.h:3139:extern int XRotateWindowProperties( #### XSaveContext #### Context.c:55: XSaveContext(a,b,c,d) will store d in position (a,b,c) of the array. Context.c:159:int XSaveContext( Xutil.h:577:extern int XSaveContext( #### XScreenCount #### Macros.c:111:int XScreenCount(Display *dpy) { return (ScreenCount(dpy)); } Xlib.h:3147:extern int XScreenCount( #### XScreenNumberOfScreen #### Macros.c:236:int XScreenNumberOfScreen (register Screen *scr) Xlib.h:1840:extern int XScreenNumberOfScreen( #### XScreenOfDisplay #### Macros.c:170:Screen *XScreenOfDisplay(Display *dpy, int scr) Xlib.h:1829:extern Screen *XScreenOfDisplay( #### XScreenResourceString #### ScrResStr.c:33:char *XScreenResourceString(Screen *screen) Xlib.h:1723:extern char *XScreenResourceString( #### XSelectInput #### imDefFlt.c:390: XSelectInput(im->core.display, im->private.proto.im_window, imExten.c:108: XSelectInput(im->core.display, ic->core.focus_window, select_mask); imInsClbk.c:200: XSelectInput( display, root, imTrX.c:186: XSelectInput(im->core.display, spec->lib_connect_wid, event_mask); SelInput.c:33:XSelectInput ( Xlib.h:3151:extern int XSelectInput( #### XSendEvent #### Iconify.c:85: return (XSendEvent (dpy, root, False, imTrX.c:192: XSendEvent(im->core.display, im->private.proto.im_window, imTrX.c:294: XSendEvent(im->core.display, spec->ims_connect_wid, imTrX.c:311: XSendEvent(im->core.display, spec->ims_connect_wid, ReconfWM.c:138: return (XSendEvent (dpy, root, False, SendEvent.c:37:XSendEvent( Withdraw.c:80: return (XSendEvent (dpy, root, False, Xlib.h:3157:extern Status XSendEvent( #### XServerVendor #### Macros.c:113:char *XServerVendor(Display *dpy) { return (ServerVendor(dpy)); } Xlib.h:1813:extern char *XServerVendor( #### XSetAccessControl #### ChAccCon.c:35: return XSetAccessControl(dpy, EnableAccess); ChAccCon.c:41: return XSetAccessControl(dpy, DisableAccess); ChAccCon.c:45:XSetAccessControl( Xlib.h:3165:extern int XSetAccessControl( #### XSetAfterFunction #### Synchro.c:59:int (*XSetAfterFunction( Xlib.h:1529:extern int (*XSetAfterFunction( #### XSetArcMode #### GCMisc.c:33:XSetArcMode ( Xlib.h:3170:extern int XSetArcMode( #### XSetAuthorization #### ConnDis.c:910:void XSetAuthorization ( Xlib.h:4003:extern void XSetAuthorization( #### XSetBackground #### SetBack.c:33:XSetBackground ( Xlib.h:3176:extern int XSetBackground( #### XSetClassHint #### SetHints.c:291:XSetClassHint( WMProps.c:138: XSetClassHint (dpy, w, classHints); Xutil.h:584:extern int XSetClassHint( #### XSetClipMask #### SetClMask.c:33:XSetClipMask ( Xlib.h:3182:extern int XSetClipMask( #### XSetClipOrigin #### SetClOrig.c:33:XSetClipOrigin ( Xlib.h:3188:extern int XSetClipOrigin( #### XSetClipRectangles #### Region.c:275: _XSetClipRectangles(dpy, gc, 0, 0, xr, r->numRects, YXBanded); SetCRects.c:33:void _XSetClipRectangles ( SetCRects.c:65:XSetClipRectangles ( SetCRects.c:75: _XSetClipRectangles (dpy, gc, clip_x_origin, clip_y_origin, rectangles, n, Xlib.h:3195:extern int XSetClipRectangles( Xlibint.h:1320:extern void _XSetClipRectangles ( #### XSetCloseDownMode #### ChClMode.c:33:XSetCloseDownMode( Xlib.h:3205:extern int XSetCloseDownMode( #### XSetCommand #### SetHints.c:207:XSetCommand ( SetHints.c:271: if (argv != NULL) XSetCommand(dpy, w, argv, argc); WMProps.c:101: XSetCommand (dpy, w, argv, argc); Xlib.h:3210:extern int XSetCommand( #### XSetDashes #### SetDashes.c:33:XSetDashes ( Xlib.h:3217:extern int XSetDashes( #### XSetErrorHandler #### ErrHndlr.c:39:XSetErrorHandler(XErrorHandler handler) OpenDis.c:173: if (_XErrorFunction == NULL) (void) XSetErrorHandler (NULL); Xlib.h:1849:extern XErrorHandler XSetErrorHandler ( #### XSetFillRule #### GCMisc.c:49:XSetFillRule ( Xlib.h:3225:extern int XSetFillRule( #### XSetFillStyle #### GCMisc.c:65:XSetFillStyle ( omImText.c:53: XSetFillStyle(dpy, gc, FillSolid); Xlib.h:3231:extern int XSetFillStyle( #### XSetFont #### omDefault.c:351: XSetFont(dpy, gc, font->fid); omDefault.c:409: XSetFont(dpy, gc, (*oc->core.font_info.font_struct_list)->fid); omText.c:208: XSetFont(dpy, gc, font->fid); omText.c:246: XSetFont(dpy, gc, font->fid); SetFont.c:33:XSetFont ( SetFPath.c:35:XSetFontPath ( XDefaultOMIF.c:781: XSetFont(dpy, gc, font->fid); XDefaultOMIF.c:813: XSetFont(dpy, gc, (*oc->core.font_info.font_struct_list)->fid); Xlib.h:3237:extern int XSetFont( Xlib.h:3243:extern int XSetFontPath( #### XSetFontPath #### SetFPath.c:35:XSetFontPath ( Xlib.h:3243:extern int XSetFontPath( #### XSetForeground #### omImText.c:52: XSetForeground(dpy, gc, values.background); SetFore.c:33:XSetForeground ( Xlib.h:3249:extern int XSetForeground( #### XSetFunction #### omImText.c:51: XSetFunction(dpy, gc, GXcopy); SetFunc.c:33:XSetFunction ( Xlib.h:3255:extern int XSetFunction( #### XSetGraphicsExposures #### GCMisc.c:81:XSetGraphicsExposures ( Xlib.h:3261:extern int XSetGraphicsExposures( #### XSetICFocus #### ICWrap.c:345:XSetICFocus(XIC ic) Xlib.h:3883:extern void XSetICFocus( #### XSetICValues #### ICWrap.c:311:XSetICValues(XIC ic, ...) Xlib.h:3903:extern char *XSetICValues( #### XSetIMValues #### ICWrap.c:167:XSetIMValues(XIM im, ...) Xlib.h:3863:extern char *XSetIMValues( #### XSetIOErrorHandler #### ErrHndlr.c:67:XSetIOErrorHandler(XIOErrorHandler handler) OpenDis.c:174: if (_XIOErrorFunction == NULL) (void) XSetIOErrorHandler (NULL); Xlib.h:1858:extern XIOErrorHandler XSetIOErrorHandler ( #### XSetIconName #### StName.c:45:XSetIconName ( Xlib.h:3267:extern int XSetIconName( #### XSetIconSizes #### SetHints.c:176:XSetIconSizes ( Xutil.h:590:extern int XSetIconSizes( #### XSetInputFocus #### SetIFocus.c:33:XSetInputFocus( Xlib.h:3273:extern int XSetInputFocus( #### XSetLineAttributes #### SetLStyle.c:33:XSetLineAttributes( Xlib.h:3280:extern int XSetLineAttributes( #### XSetLocaleModifiers #### lcWrap.c:75:XSetLocaleModifiers( Xlib.h:3575:extern char *XSetLocaleModifiers( #### XSetModifierMapping #### ModMap.c:74:XSetModifierMapping( Xlib.h:3289:extern int XSetModifierMapping( #### XSetNormalHints #### SetHints.c:154: * XSetNormalHints sets the property SetHints.c:159:XSetNormalHints ( /* old routine */ SetHints.c:273: if (hints != NULL) XSetNormalHints(dpy, w, hints); Xutil.h:597:extern int XSetNormalHints( #### XSetOCValues #### OCWrap.c:91:XSetOCValues(XOC oc, ...) Xlcint.h:424:typedef char* (*XSetOCValuesProc)( Xlcint.h:543: XSetOCValuesProc set_values; Xlib.h:3621:extern char *XSetOCValues( #### XSetOMValues #### OMWrap.c:68:XSetOMValues(XOM om, ...) Xlcint.h:374:typedef char* (*XSetOMValuesProc)( Xlcint.h:394: XSetOMValuesProc set_values; Xlib.h:3590:extern char *XSetOMValues( #### XSetPlaneMask #### SetPMask.c:33:XSetPlaneMask ( Xlib.h:3294:extern int XSetPlaneMask( #### XSetPointerMapping #### SetPntMap.c:34:XSetPointerMapping ( Xlib.h:3300:extern int XSetPointerMapping( #### XSetRGBColormaps #### SetRGBCMap.c:38:void XSetRGBColormaps ( SetStCmap.c:91: XSetRGBColormaps (dpy, w, &stdcmap, 1, property); Xutil.h:603:extern void XSetRGBColormaps( #### XSetRegion #### Region.c:254:XSetRegion( Xutil.h:709:extern int XSetRegion( #### XSetScreenSaver #### SetSSaver.c:33:XSetScreenSaver( Xlib.h:3306:extern int XSetScreenSaver( #### XSetSelectionOwner #### SetSOwner.c:33:XSetSelectionOwner( Xlib.h:3314:extern int XSetSelectionOwner( #### XSetSizeHints #### SetHints.c:61:XSetSizeHints( /* old routine */ SetHints.c:149: return XSetSizeHints (dpy, w, zhints, XA_WM_ZOOM_HINTS); SetHints.c:164: return XSetSizeHints (dpy, w, hints, XA_WM_NORMAL_HINTS); Xutil.h:611:extern int XSetSizeHints( #### XSetStandardColormap #### SetStCmap.c:64:void XSetStandardColormap( Xutil.h:715:extern void XSetStandardColormap( #### XSetStandardProperties #### SetHints.c:236: * XSetStandardProperties sets the following properties: SetHints.c:245:XSetStandardProperties ( Xutil.h:618:extern int XSetStandardProperties( #### XSetState #### SetState.c:33:XSetState( Xlib.h:3321:extern int XSetState( #### XSetStipple #### SetStip.c:33:XSetStipple ( Xlib.h:3330:extern int XSetStipple( #### XSetSubwindowMode #### GCMisc.c:97:XSetSubwindowMode ( Xlib.h:3336:extern int XSetSubwindowMode( #### XSetTSOrigin #### SetTSOrig.c:33:XSetTSOrigin ( Xlib.h:3342:extern int XSetTSOrigin( #### XSetTextProperty #### SetTxtProp.c:60:void XSetTextProperty ( SetTxtProp.c:75: XSetTextProperty (dpy, w, tp, XA_WM_NAME); SetTxtProp.c:83: XSetTextProperty (dpy, w, tp, XA_WM_ICON_NAME); SetTxtProp.c:91: XSetTextProperty (dpy, w, tp, XA_WM_CLIENT_MACHINE); Xutil.h:629:extern void XSetTextProperty( #### XSetTile #### SetTile.c:33:XSetTile ( Xlib.h:3349:extern int XSetTile( #### XSetTransientForHint #### SetHints.c:281:XSetTransientForHint( Xlib.h:1926:extern int XSetTransientForHint( #### XSetWMClientMachine #### SetTxtProp.c:86:void XSetWMClientMachine ( WMProps.c:109: XSetWMClientMachine (dpy, w, &textprop); Xutil.h:636:extern void XSetWMClientMachine( #### XSetWMColormapWindows #### SetWMCMapW.c:60:Status XSetWMColormapWindows ( Xlib.h:1917:extern Status XSetWMColormapWindows( #### XSetWMHints #### SetHints.c:102: * XSetWMHints sets the property SetHints.c:107:XSetWMHints ( SetHints.c:275: if (phints.flags != 0) XSetWMHints(dpy, w, &phints); WMProps.c:113: if (wmHints) XSetWMHints (dpy, w, wmHints); Xutil.h:642:extern int XSetWMHints( #### XSetWMIconName #### SetTxtProp.c:78:void XSetWMIconName ( WMProps.c:93: if (iconName) XSetWMIconName (dpy, w, iconName); Xutil.h:648:extern void XSetWMIconName( #### XSetWMName #### SetTxtProp.c:70:void XSetWMName ( WMProps.c:92: if (windowName) XSetWMName (dpy, w, windowName); Xutil.h:654:extern void XSetWMName( #### XSetWMNormalHints #### SetNrmHint.c:120:void XSetWMNormalHints ( WMProps.c:112: if (sizeHints) XSetWMNormalHints (dpy, w, sizeHints); Xutil.h:660:extern void XSetWMNormalHints( #### XSetWMProperties #### mbWMProps.c:61: XSetWMProperties(dpy, w, wprop, iprop, argv, argc, mbWMProps.c:68: /* Note: The WM_LOCALE_NAME property is set by XSetWMProperties. */ utf8WMProps.c:83: XSetWMProperties(dpy, w, wprop, iprop, argv, argc, utf8WMProps.c:90: /* Note: The WM_LOCALE_NAME property is set by XSetWMProperties. */ WMProps.c:64: * XSetWMProperties sets the following properties: WMProps.c:75:void XSetWMProperties ( Xutil.h:666:extern void XSetWMProperties( #### XSetWMProtocols #### SetWMCMapW.c:56: * XSetWMProtocols sets the property SetWMProto.c:56: * XSetWMProtocols sets the property SetWMProto.c:60:Status XSetWMProtocols ( Xlib.h:1889:extern Status XSetWMProtocols( #### XSetWMSizeHints #### SetNrmHint.c:62:void XSetWMSizeHints ( SetNrmHint.c:125: XSetWMSizeHints (dpy, w, hints, XA_WM_NORMAL_HINTS); Xutil.h:702:extern void XSetWMSizeHints( #### XSetWindowBackground #### Backgnd.c:33:XSetWindowBackground( PmapBgnd.c:33:XSetWindowBackgroundPixmap( Xlib.h:3355:extern int XSetWindowBackground( Xlib.h:3361:extern int XSetWindowBackgroundPixmap( #### XSetWindowBackgroundPixmap #### PmapBgnd.c:33:XSetWindowBackgroundPixmap( Xlib.h:3361:extern int XSetWindowBackgroundPixmap( #### XSetWindowBorder #### BdrWidth.c:36:XSetWindowBorderWidth( Border.c:33:XSetWindowBorder( PmapBord.c:33:XSetWindowBorderPixmap( Xlib.h:3367:extern int XSetWindowBorder( Xlib.h:3373:extern int XSetWindowBorderPixmap( Xlib.h:3379:extern int XSetWindowBorderWidth( #### XSetWindowBorderPixmap #### PmapBord.c:33:XSetWindowBorderPixmap( Xlib.h:3373:extern int XSetWindowBorderPixmap( #### XSetWindowBorderWidth #### BdrWidth.c:36:XSetWindowBorderWidth( Xlib.h:3379:extern int XSetWindowBorderWidth( #### XSetWindowColormap #### ChCmap.c:33:XSetWindowColormap( Xlib.h:3385:extern int XSetWindowColormap( #### XSetZoomHints #### SetHints.c:139: * XSetZoomHints sets the property SetHints.c:144:XSetZoomHints ( Xutil.h:722:extern int XSetZoomHints( #### XShrinkRegion #### Region.c:379:XShrinkRegion( Xutil.h:728:extern int XShrinkRegion( #### XStoreBuffer #### StBytes.c:89:XStoreBuffer ( StBytes.c:106: return XStoreBuffer (dpy, bytes, nbytes, 0); Xlib.h:3391:extern int XStoreBuffer( #### XStoreBytes #### StBytes.c:101:XStoreBytes ( Xlib.h:3398:extern int XStoreBytes( #### XStoreColor #### SetGetCols.c:106: if ( !((*xColorProc == XAllocColor) || (*xColorProc == XStoreColor) SetGetCols.c:140: } else if ((*xColorProc == XQueryColor) || (*xColorProc == XStoreColor)) { SetGetCols.c:141: /* Note: XQueryColor and XStoreColor do not return any Status */ SetGetCols.c:147: if ((*xColorProc == XStoreColor)) { SetGetCols.c:229: if ( !((*xColorProc == XStoreColors) || (*xColorProc == XQueryColors)) ) { SetGetCols.c:267: if ((*xColorProc == XQueryColors) || (*xColorProc == XStoreColors)){ SetGetCols.c:268: /* Note: XQueryColors and XStoreColors do not return any Status */ SetGetCols.c:275: if (*xColorProc == XStoreColors) { StCol.c:64: * values then use it in a call to XStoreColor. StCol.c:72: * Since XStoreColor has no return value this routine StCol.c:80: return(_XcmsSetGetColor(XStoreColor, dpy, colormap, StColor.c:33:XStoreColor( StColors.c:33:XStoreColors( StCols.c:66: * values then use it in a call to XStoreColors. StCols.c:74: * Since XStoreColors has no return value, this routine StCols.c:98: retval = _XcmsSetGetColors (XStoreColors, dpy, colormap, StNColor.c:59: return XStoreColor(dpy, cmap, &scr_def); Xlib.h:3404:extern int XStoreColor( Xlib.h:3410:extern int XStoreColors( #### XStoreColors #### SetGetCols.c:229: if ( !((*xColorProc == XStoreColors) || (*xColorProc == XQueryColors)) ) { SetGetCols.c:267: if ((*xColorProc == XQueryColors) || (*xColorProc == XStoreColors)){ SetGetCols.c:268: /* Note: XQueryColors and XStoreColors do not return any Status */ SetGetCols.c:275: if (*xColorProc == XStoreColors) { StColors.c:33:XStoreColors( StCols.c:66: * values then use it in a call to XStoreColors. StCols.c:74: * Since XStoreColors has no return value, this routine StCols.c:98: retval = _XcmsSetGetColors (XStoreColors, dpy, colormap, Xlib.h:3410:extern int XStoreColors( #### XStoreName #### SetHints.c:258: if (name != NULL) XStoreName (dpy, w, name); StName.c:34:XStoreName ( StNColor.c:36:XStoreNamedColor( Xcmsint.h:76: * XStoreNamedColor() Xlib.h:3417:extern int XStoreName( Xlib.h:3423:extern int XStoreNamedColor( #### XStoreNamedColor #### StNColor.c:36:XStoreNamedColor( Xcmsint.h:76: * XStoreNamedColor() Xlib.h:3423:extern int XStoreNamedColor( #### XStringListToTextProperty #### StrToText.c:35: * XStringListToTextProperty - fill in TextProperty structure with StrToText.c:41:Status XStringListToTextProperty ( Xutil.h:734:extern Status XStringListToTextProperty( #### XStringToKeysym #### imLcPrs.c:560: keysym = XStringToKeysym(tokenbuf); imLcPrs.c:590: rhs_keysym = XStringToKeysym(tokenbuf); imLcPrs.c:600: rhs_keysym = XStringToKeysym(tokenbuf); StrKeysym.c:74:XStringToKeysym(_Xconst char *s) StrKeysym.c:175: ret = XStringToKeysym(tmp); Xlib.h:1711:extern KeySym XStringToKeysym( #### XSubImage #### ImUtil.c:46:static XImage *_XSubImage(XImage *, int, int, unsigned int, unsigned int); ImUtil.c:108: * _XSubImage Clones a new (sub)image from an existing one ImUtil.c:295: image->f.sub_image = _XSubImage; ImUtil.c:831:static XImage *_XSubImage ( Macros.c:274:#undef XSubImage Macros.c:275:XImage *XSubImage( Xutil.h:205:extern XImage *XSubImage( Xutil.h:223:#define XSubImage(ximage, x, y, width, height) \ #### XSubtractRegion #### Region.c:1426:XSubtractRegion( Region.c:1463: (void) XSubtractRegion(sra,srb,tra); Region.c:1464: (void) XSubtractRegion(srb,sra,trb); Xutil.h:740:extern int XSubtractRegion( #### XSupportsLocale #### lcWrap.c:96:XSupportsLocale(void) Xlib.h:3573:extern Bool XSupportsLocale (void); #### XSync #### ClDisplay.c:43: * XCloseDisplay - XSync the connection to the X Server, close the connection, ClDisplay.c:65: XSync(dpy, 1); /* throw away pending events, catch errors */ ClDisplay.c:73: XSync(dpy, 1); OpenDis.c:735: (void) XSynchronize(dpy, _Xdebug); ReconfWM.c:59: * We need to inline XConfigureWindow and XSync so that everything is done ReconfWM.c:104: * XSync (dpy, 0) Sync.c:35:XSync ( Synchro.c:33:static int _XSyncFunction(register Display *dpy) Synchro.c:35: XSync(dpy,0); Synchro.c:39:int (*XSynchronize(Display *dpy, int onoff))(Display *) Synchro.c:45: func = _XSyncFunction; Xlib.h:1523:extern int (*XSynchronize( Xlib.h:3431:extern int XSync( #### XSynchronize #### OpenDis.c:735: (void) XSynchronize(dpy, _Xdebug); Synchro.c:39:int (*XSynchronize(Display *dpy, int onoff))(Display *) Xlib.h:1523:extern int (*XSynchronize( #### XTextExtents16 #### omText.c:117: XTextExtents16(font, buf2b, 1, omTextExt.c:72: XTextExtents16(font, xchar2b_buf, buf_len, &direction, TextExt16.c:44: * XTextExtents16 - compute the extents of string given as a sequence of TextExt16.c:48:XTextExtents16 ( TextExt16.c:120: * subset of XTextExtents16. TextExt.c:71: * what is done in XTextExtents16. Xlib.h:3446:extern int XTextExtents16( #### XTextExtents #### omDefault.c:149: XTextExtents(*oc->core.font_info.font_struct_list, text, length, &direction, omText.c:117: XTextExtents16(font, buf2b, 1, omText.c:137: XTextExtents(font, buf, 1, omTextExt.c:72: XTextExtents16(font, xchar2b_buf, buf_len, &direction, omTextExt.c:75: XTextExtents(font, (char *) xchar2b_buf, buf_len, &direction, TextExt16.c:44: * XTextExtents16 - compute the extents of string given as a sequence of TextExt16.c:48:XTextExtents16 ( TextExt16.c:120: * subset of XTextExtents16. TextExt.c:68: * XTextExtents - compute the extents of string given as a sequences of eight TextExt.c:71: * what is done in XTextExtents16. TextExt.c:74:XTextExtents ( TextExt.c:145: * subset of XTextExtents. XDefaultOMIF.c:637: XTextExtents(*oc->core.font_info.font_struct_list, text, length, &direction, Xlib.h:3436:extern int XTextExtents( Xlib.h:3446:extern int XTextExtents16( #### XTextPropertyToStringList #### GetHints.c:256: if (!XTextPropertyToStringList (&tp, &argv, &argc)) { TextToStr.c:37: * XTextPropertyToStringList - set list and count to contain data stored in TextToStr.c:41:Status XTextPropertyToStringList ( Xutil.h:774:extern Status XTextPropertyToStringList( #### XTextWidth16 #### omText.c:213: x += XTextWidth16(font, (XChar2b *)ptr, char_len); omTextEsc.c:184: escapement += XTextWidth16(font, (XChar2b *)ptr, char_len); TextExt16.c:119: * XTextWidth16 - compute the width of sequence of XChar2bs. This is a TextExt16.c:123:XTextWidth16 ( Xlib.h:3462:extern int XTextWidth16( #### XTextWidth #### omDefault.c:93: return XTextWidth(*oc->core.font_info.font_struct_list, text, length); omDefault.c:354: return XTextWidth(font, text, length); omText.c:213: x += XTextWidth16(font, (XChar2b *)ptr, char_len); omText.c:217: x += XTextWidth(font, (char *)ptr, char_len); omTextEsc.c:184: escapement += XTextWidth16(font, (XChar2b *)ptr, char_len); omTextEsc.c:187: escapement += XTextWidth(font, (char *)ptr, char_len); TextExt16.c:119: * XTextWidth16 - compute the width of sequence of XChar2bs. This is a TextExt16.c:123:XTextWidth16 ( TextExt.c:144: * XTextWidth - compute the width of a string of eightbit bytes. This is a TextExt.c:148:XTextWidth ( XDefaultOMIF.c:606: return XTextWidth(*oc->core.font_info.font_struct_list, text, length); XDefaultOMIF.c:784: return XTextWidth(font, text, length); Xlib.h:3456:extern int XTextWidth( Xlib.h:3462:extern int XTextWidth16( #### XTranslateCoordinates #### TrCoords.c:32:Bool XTranslateCoordinates( Xlib.h:3468:extern Bool XTranslateCoordinates( #### XUndefineCursor #### UndefCurs.c:33:XUndefineCursor ( Xlib.h:3479:extern int XUndefineCursor( #### XUngrabButton #### UngrabBut.c:33:XUngrabButton( Xlib.h:3484:extern int XUngrabButton( #### XUngrabKey #### UngrabKbd.c:33:XUngrabKeyboard ( UngrabKey.c:33:XUngrabKey( Xlib.h:3491:extern int XUngrabKey( Xlib.h:3498:extern int XUngrabKeyboard( #### XUngrabKeyboard #### UngrabKbd.c:33:XUngrabKeyboard ( Xlib.h:3498:extern int XUngrabKeyboard( #### XUngrabPointer #### UngrabPtr.c:33:XUngrabPointer( Xlib.h:3503:extern int XUngrabPointer( #### XUngrabServer #### UngrabSvr.c:33:XUngrabServer ( Xlib.h:3508:extern int XUngrabServer( #### XUninstallColormap #### UninsCmap.c:33:XUninstallColormap( Xlib.h:3512:extern int XUninstallColormap( #### XUnionRectWithRegion #### Region.c:170:XUnionRectWithRegion( Xutil.h:801:extern int XUnionRectWithRegion( #### XUnionRegion #### Region.c:186: return XUnionRegion(®ion, source, dest); Region.c:345:#define ZOpRegion(a,b,c) if (grow) XUnionRegion(a,b,c); \ Region.c:349:#define ZCopyRegion(a,b) XUnionRegion(a,a,b) Region.c:1143:XUnionRegion( Region.c:1465: (void) XUnionRegion(tra,trb,dr); Xutil.h:807:extern int XUnionRegion( #### XUnloadFont #### ClDisplay.c:63: XUnloadFont (dpy, dpy->cursor_font); UnldFont.c:33:XUnloadFont( Xlib.h:3517:extern int XUnloadFont( #### XUnlockDisplay #### LockDis.c:75:XUnlockDisplay( locking.c:205:static void _XUnlockDisplay( locking.c:552: dpy->lock_fns->unlock_display = _XUnlockDisplay; Xlib.h:1743:extern void XUnlockDisplay( #### XUnmapSubwindows #### UnmapSubs.c:33:XUnmapSubwindows( Xlib.h:3522:extern int XUnmapSubwindows( #### XUnmapWindow #### UnmapWin.c:33:XUnmapWindow ( Withdraw.c:70: XUnmapWindow (dpy, w); Xlib.h:3527:extern int XUnmapWindow( #### XUnregisterIMInstantiateCallback #### IMWrap.c:186:XUnregisterIMInstantiateCallback( Xlib.h:3962:extern Bool XUnregisterIMInstantiateCallback( #### XUnsetICFocus #### ICWrap.c:356:XUnsetICFocus(XIC ic) Xlib.h:3887:extern void XUnsetICFocus( #### XVaCreateNestedList #### ICWrap.c:149:XVaCreateNestedList(int dummy, ...) Xlib.h:3947:extern XVaNestedList XVaCreateNestedList( #### XVendorRelease #### Macros.c:119:int XVendorRelease(Display *dpy) { return (VendorRelease(dpy)); } Xlib.h:3532:extern int XVendorRelease( #### XVisualIDFromVisual #### Misc.c:58:VisualID XVisualIDFromVisual(Visual *visual) Xlib.h:1729:extern VisualID XVisualIDFromVisual( #### XWMGeometry #### WMGeom.c:46:XWMGeometry ( Xutil.h:813:extern int XWMGeometry( #### XWarpPointer #### WarpPtr.c:33:XWarpPointer( Xlib.h:3536:extern int XWarpPointer( #### XWhitePixel #### Macros.c:72:unsigned long XWhitePixel(Display *dpy, int scr) Macros.c:189:unsigned long XWhitePixelOfScreen(Screen *s) Xlib.h:1794:extern unsigned long XWhitePixel( Xlib.h:1804:extern unsigned long XWhitePixelOfScreen( #### XWhitePixelOfScreen #### Macros.c:189:unsigned long XWhitePixelOfScreen(Screen *s) Xlib.h:1804:extern unsigned long XWhitePixelOfScreen( #### XWidthMMOfScreen #### Macros.c:218:int XWidthMMOfScreen(Screen *s) { return (WidthMMOfScreen(s)); } Xlib.h:3548:extern int XWidthMMOfScreen( #### XWidthOfScreen #### Macros.c:214:int XWidthOfScreen(Screen *s) { return (WidthOfScreen(s)); } Xlib.h:3552:extern int XWidthOfScreen( #### XWindowEvent #### WinEvent.c:46:XWindowEvent ( Xlib.h:3556:extern int XWindowEvent( #### XWithdrawWindow #### Withdraw.c:65:Status XWithdrawWindow ( Xlib.h:1900:extern Status XWithdrawWindow( #### XWriteBitmapFile #### WrBitF.c:87:XWriteBitmapFile( Xlib.h:3563:extern int XWriteBitmapFile( Xutil.h:338: * return codes for XReadBitmapFile and XWriteBitmapFile #### XXorRegion #### Region.c:1453:XXorRegion(Region sra, Region srb, Region dr) Xutil.h:827:extern int XXorRegion( #### XauDisposeAuth #### AuDispose.c:35:XauDisposeAuth (auth) AuGetBest.c:159: XauDisposeAuth (best); AuGetBest.c:167: XauDisposeAuth (entry); ConnDis.c:1482: if (authptr) XauDisposeAuth (authptr); #### XauFileName #### AuFileName.c:36:XauFileName () AuGetBest.c:82: auth_name = XauFileName (); #### XauGetBestAuthByAddr #### AuGetBest.c:52:XauGetBestAuthByAddr ( ConnDis.c:1294: authptr = XauGetBestAuthByAddr ((unsigned short) family, #### XauReadAuth #### AuGetBest.c:114: entry = XauReadAuth (auth_file); AuRead.c:97:XauReadAuth (auth_file) #### XcmsAddColorSpace #### AddDIC.c:30: * Source for XcmsAddColorSpace AddDIC.c:53: * XcmsAddColorSpace - Add a Device-Independent Color Space AddDIC.c:58:XcmsAddColorSpace(XcmsColorSpace *pCS) HVCGcC.c:107: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCGcV.c:98: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCGcVC.c:109: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCMnV.c:114: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCMxC.c:117: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCMxV.c:115: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCMxVC.c:217: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCMxVs.c:112: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCWpAj.c:95: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { Xcms.h:346:extern Status XcmsAddColorSpace ( #### XcmsAddFunctionSet #### AddSF.c:30: * Source for XcmsAddFunctionSet AddSF.c:52: * XcmsAddFunctionSet - Add an Screen Color Characterization AddSF.c:58:XcmsAddFunctionSet(XcmsFunctionSet *pNewFS) Xcms.h:350:extern Status XcmsAddFunctionSet ( #### XcmsAllocColor #### cmsAllCol.c:30: * Source for XcmsAllocColor cmsAllCol.c:45: * XcmsAllocColor - Allocate Color cmsAllCol.c:50:XcmsAllocColor( cmsAllCol.c:58: * specification, XcmsAllocColor will convert it to X RGB SetGetCols.c:74: * XcmsAllocColor Xcms.h:354:extern Status XcmsAllocColor ( #### XcmsAllocNamedColor #### cmsAllNCol.c:30: * Source for XcmsAllocNamedColor cmsAllNCol.c:46: * XcmsAllocNamedColor - cmsAllNCol.c:51:XcmsAllocNamedColor ( Xcms.h:361:extern Status XcmsAllocNamedColor ( #### XcmsCCCOfColormap #### cmsAllNCol.c:92: if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { cmsCmap.c:405: * XcmsCCCOfColormap cmsCmap.c:410:XcmsCCCOfColormap( cmsLkCol.c:89: if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { GetColor.c:55: if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { LookupCol.c:53: if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { ParseCol.c:90: if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { SetGetCols.c:111: if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { SetGetCols.c:233: if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { StNColor.c:53: if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { Xcms.h:370:extern XcmsCCC XcmsCCCOfColormap ( #### XcmsCIELabClipL #### LabGcL.c:29: * Source for XcmsCIELabClipL() gamut compression routine. LabGcL.c:49: * XcmsCIELabClipL - Return the closest L* LabGcL.c:55:XcmsCIELabClipL ( LabGcLC.c:29: * Source for XcmsCIELabClipLab() gamut LabGcLC.c:57: * XcmsCIELabClipLab - Return the closest L* and chroma LabGcLC.c:63:XcmsCIELabClipLab ( Xcms.h:383:extern Status XcmsCIELabClipL( Xcms.h:391:extern Status XcmsCIELabClipLab( #### XcmsCIELabClipLab #### LabGcLC.c:29: * Source for XcmsCIELabClipLab() gamut LabGcLC.c:57: * XcmsCIELabClipLab - Return the closest L* and chroma LabGcLC.c:63:XcmsCIELabClipLab ( Xcms.h:391:extern Status XcmsCIELabClipLab( #### XcmsCIELabClipab #### LabGcC.c:49: * XcmsCIELabClipab - Reduce the chroma for a hue and L* LabGcC.c:55:XcmsCIELabClipab ( Xcms.h:375:extern Status XcmsCIELabClipab( #### XcmsCIELabColorSpace #### cmsGlobls.c:55: &XcmsCIELabColorSpace, Lab.c:97:XcmsColorSpace XcmsCIELabColorSpace = Cv.h:20:extern XcmsColorSpace XcmsCIELabColorSpace; #### XcmsCIELabQueryMaxC #### LabGcC.c:113: if (XcmsCIELabQueryMaxC(ccc, LabMxC.c:31: * Source for the XcmsCIELabQueryMaxC() gamut boundary LabMxC.c:61: * XcmsCIELabQueryMaxC - max chroma for a hue_angle and L_star LabMxC.c:66:XcmsCIELabQueryMaxC( Xcms.h:399:extern Status XcmsCIELabQueryMaxC ( #### XcmsCIELabQueryMaxL #### LabGcL.c:119: if (_XcmsCIELabQueryMaxLCRGB (&myCCC, hue, &Lab_max, LabGcL.c:162: if (XcmsCIELabQueryMaxL(&myCCC, degrees(hue), chroma, pColor) LabGcLC.c:141: if (_XcmsCIELabQueryMaxLCRGB (&myCCC, hue, &Lab_max, &rgb_max) LabMnL.c:119: if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LabMxC.c:125: if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LabMxL.c:29: * Source for the XcmsCIELabQueryMaxL() gamut boundary LabMxL.c:58: * XcmsCIELabQueryMaxL - Compute max Lstar for a hue and chroma LabMxL.c:63:XcmsCIELabQueryMaxL( LabMxL.c:119: if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LabMxLC.c:31: * Source for the XcmsCIELabQueryMaxLC() gamut boundary LabMxLC.c:67: * _XcmsCIELabQueryMaxLCRGB - Compute maximum L* and chroma. LabMxLC.c:72:_XcmsCIELabQueryMaxLCRGB( LabMxLC.c:168: * XcmsCIELabQueryMaxLC - Compute maximum L* and chroma. LabMxLC.c:173:XcmsCIELabQueryMaxLC ( LabMxLC.c:216: return(_XcmsCIELabQueryMaxLCRGB (&myCCC, radians(hue_angle), pColor_return, Cv.h:67:_XcmsCIELabQueryMaxLCRGB( Xcms.h:406:extern Status XcmsCIELabQueryMaxL ( Xcms.h:413:extern Status XcmsCIELabQueryMaxLC ( #### XcmsCIELabQueryMaxLC #### LabGcL.c:119: if (_XcmsCIELabQueryMaxLCRGB (&myCCC, hue, &Lab_max, LabGcLC.c:141: if (_XcmsCIELabQueryMaxLCRGB (&myCCC, hue, &Lab_max, &rgb_max) LabMnL.c:119: if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LabMxC.c:125: if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LabMxL.c:119: if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LabMxLC.c:31: * Source for the XcmsCIELabQueryMaxLC() gamut boundary LabMxLC.c:67: * _XcmsCIELabQueryMaxLCRGB - Compute maximum L* and chroma. LabMxLC.c:72:_XcmsCIELabQueryMaxLCRGB( LabMxLC.c:168: * XcmsCIELabQueryMaxLC - Compute maximum L* and chroma. LabMxLC.c:173:XcmsCIELabQueryMaxLC ( LabMxLC.c:216: return(_XcmsCIELabQueryMaxLCRGB (&myCCC, radians(hue_angle), pColor_return, Cv.h:67:_XcmsCIELabQueryMaxLCRGB( Xcms.h:413:extern Status XcmsCIELabQueryMaxLC ( #### XcmsCIELabQueryMinL #### LabGcL.c:147: if (XcmsCIELabQueryMinL(&myCCC, degrees(hue), chroma, pColor) LabMnL.c:29: * Source for the XcmsCIELabQueryMinL() gamut boundary LabMnL.c:58: * XcmsCIELabQueryMinL - Compute max Lstar for a hue and chroma LabMnL.c:63:XcmsCIELabQueryMinL( Xcms.h:419:extern Status XcmsCIELabQueryMinL ( #### XcmsCIELabToCIEXYZ #### Lab.c:78: XcmsCIELabToCIEXYZ, Lab.c:228: * XcmsCIELabToCIEXYZ - convert CIELab to CIEXYZ Lab.c:233:XcmsCIELabToCIEXYZ( Xcms.h:426:extern Status XcmsCIELabToCIEXYZ ( #### XcmsCIELabWhiteShiftColors #### LabWpAj.c:55: * XcmsCIELabWhiteShiftColors LabWpAj.c:60:XcmsCIELabWhiteShiftColors( Xcms.h:433:extern Status XcmsCIELabWhiteShiftColors( #### XcmsCIELuvClipL #### LuvGcL.c:29: * Source for XcmsCIELuvClipL() gamut compression routine. LuvGcL.c:49: * XcmsCIELuvClipL - Return the closest L* LuvGcL.c:55:XcmsCIELuvClipL ( LuvGcLC.c:29: * Source for XcmsCIELuvClipLuv() gamut LuvGcLC.c:57: * XcmsCIELuvClipLuv - Return the closest L* and chroma LuvGcLC.c:63:XcmsCIELuvClipLuv ( Xcms.h:443:extern Status XcmsCIELuvClipL( Xcms.h:451:extern Status XcmsCIELuvClipLuv( #### XcmsCIELuvClipLuv #### LuvGcLC.c:29: * Source for XcmsCIELuvClipLuv() gamut LuvGcLC.c:57: * XcmsCIELuvClipLuv - Return the closest L* and chroma LuvGcLC.c:63:XcmsCIELuvClipLuv ( Xcms.h:451:extern Status XcmsCIELuvClipLuv( #### XcmsCIELuvClipuv #### LuvGcC.c:29: * Source for XcmsCIELuvClipuv() gamut compression routine. LuvGcC.c:49: * XcmsCIELuvClipuv - Reduce the chroma for a hue and L* LuvGcC.c:55:XcmsCIELuvClipuv ( Xcms.h:459:extern Status XcmsCIELuvClipuv( #### XcmsCIELuvColorSpace #### cmsGlobls.c:56: &XcmsCIELuvColorSpace, Luv.c:100:XcmsColorSpace XcmsCIELuvColorSpace = Cv.h:21:extern XcmsColorSpace XcmsCIELuvColorSpace; #### XcmsCIELuvQueryMaxC #### LuvGcC.c:113: if (XcmsCIELuvQueryMaxC(ccc, LuvMxC.c:31: * Source for the XcmsCIELuvQueryMaxC() gamut boundary LuvMxC.c:61: * XcmsCIELuvQueryMaxC - max chroma for a hue_angle and L_star LuvMxC.c:66:XcmsCIELuvQueryMaxC( Xcms.h:467:extern Status XcmsCIELuvQueryMaxC ( #### XcmsCIELuvQueryMaxL #### LuvGcL.c:119: if (_XcmsCIELuvQueryMaxLCRGB (&myCCC, hue, &Luv_max, LuvGcL.c:162: if (XcmsCIELuvQueryMaxL(&myCCC, degrees(hue), chroma, pColor) LuvGcLC.c:141: if (_XcmsCIELuvQueryMaxLCRGB (&myCCC, hue, &Luv_max, &rgb_max) LuvMnL.c:119: if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LuvMxC.c:125: if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LuvMxL.c:29: * Source for the XcmsCIELuvQueryMaxL() gamut boundary LuvMxL.c:58: * XcmsCIELuvQueryMaxL - Compute max Lstar for a hue and chroma LuvMxL.c:63:XcmsCIELuvQueryMaxL( LuvMxL.c:119: if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LuvMxLC.c:31: * Source for the XcmsCIELuvQueryMaxLC() gamut boundary LuvMxLC.c:67: * _XcmsCIELuvQueryMaxLCRGB - Compute maximum L* and chroma. LuvMxLC.c:72:_XcmsCIELuvQueryMaxLCRGB( LuvMxLC.c:168: * XcmsCIELuvQueryMaxLC - Compute maximum L* and chroma. LuvMxLC.c:173:XcmsCIELuvQueryMaxLC ( LuvMxLC.c:216: return(_XcmsCIELuvQueryMaxLCRGB (&myCCC, radians(hue_angle), pColor_return, Cv.h:129:_XcmsCIELuvQueryMaxLCRGB( Xcms.h:474:extern Status XcmsCIELuvQueryMaxL ( Xcms.h:481:extern Status XcmsCIELuvQueryMaxLC ( #### XcmsCIELuvQueryMaxLC #### LuvGcL.c:119: if (_XcmsCIELuvQueryMaxLCRGB (&myCCC, hue, &Luv_max, LuvGcLC.c:141: if (_XcmsCIELuvQueryMaxLCRGB (&myCCC, hue, &Luv_max, &rgb_max) LuvMnL.c:119: if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LuvMxC.c:125: if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LuvMxL.c:119: if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LuvMxLC.c:31: * Source for the XcmsCIELuvQueryMaxLC() gamut boundary LuvMxLC.c:67: * _XcmsCIELuvQueryMaxLCRGB - Compute maximum L* and chroma. LuvMxLC.c:72:_XcmsCIELuvQueryMaxLCRGB( LuvMxLC.c:168: * XcmsCIELuvQueryMaxLC - Compute maximum L* and chroma. LuvMxLC.c:173:XcmsCIELuvQueryMaxLC ( LuvMxLC.c:216: return(_XcmsCIELuvQueryMaxLCRGB (&myCCC, radians(hue_angle), pColor_return, Cv.h:129:_XcmsCIELuvQueryMaxLCRGB( Xcms.h:481:extern Status XcmsCIELuvQueryMaxLC ( #### XcmsCIELuvQueryMinL #### LuvGcL.c:147: if (XcmsCIELuvQueryMinL(&myCCC, degrees(hue), chroma, pColor) LuvMnL.c:29: * Source for the XcmsCIELuvQueryMinL() gamut boundary LuvMnL.c:58: * XcmsCIELuvQueryMinL - Compute max Lstar for a hue and chroma LuvMnL.c:63:XcmsCIELuvQueryMinL( Xcms.h:487:extern Status XcmsCIELuvQueryMinL ( #### XcmsCIELuvToCIEuvY #### Luv.c:79: XcmsCIELuvToCIEuvY, Luv.c:229: * XcmsCIELuvToCIEuvY - convert CIELuv to CIEuvY Luv.c:234:XcmsCIELuvToCIEuvY( Xcms.h:494:extern Status XcmsCIELuvToCIEuvY ( #### XcmsCIELuvWhiteShiftColors #### LuvWpAj.c:52: * XcmsCIELuvWhiteShiftColors LuvWpAj.c:57:XcmsCIELuvWhiteShiftColors( Xcms.h:501:extern Status XcmsCIELuvWhiteShiftColors( #### XcmsCIEXYZColorSpace #### cmsGlobls.c:52: &XcmsCIEXYZColorSpace, XYZ.c:80:XcmsColorSpace XcmsCIEXYZColorSpace = Cv.h:17:extern XcmsColorSpace XcmsCIEXYZColorSpace; #### XcmsCIEXYZToCIELab #### Lab.c:86: XcmsCIEXYZToCIELab, Lab.c:331: * XcmsCIEXYZToCIELab - convert CIEXYZ to CIELab Lab.c:336:XcmsCIEXYZToCIELab( Xcms.h:511:extern Status XcmsCIEXYZToCIELab ( #### XcmsCIEXYZToCIEuvY #### HVC.c:120: XcmsCIEXYZToCIEuvY, Luv.c:88: XcmsCIEXYZToCIEuvY, uvY.c:81: XcmsCIEXYZToCIEuvY, uvY.c:338: * XcmsCIEXYZToCIEuvY - convert CIEXYZ to CIEuvY uvY.c:343:XcmsCIEXYZToCIEuvY( Xcms.h:518:extern Status XcmsCIEXYZToCIEuvY ( #### XcmsCIEXYZToCIExyY #### xyY.c:80: XcmsCIEXYZToCIExyY, xyY.c:337: * XcmsCIEXYZToCIExyY - convert CIEXYZ to CIExyY xyY.c:343:XcmsCIEXYZToCIExyY( Xcms.h:525:extern Status XcmsCIEXYZToCIExyY ( #### XcmsCIEXYZToRGBi #### LRGB.c:138: (XcmsConversionProc)XcmsCIEXYZToRGBi, LRGB.c:159: (XcmsConversionProc)XcmsCIEXYZToRGBi, LRGB.c:1458: * XcmsCIEXYZToRGBi - convert CIE XYZ to RGB LRGB.c:1464:XcmsCIEXYZToRGBi( Xcms.h:532:extern Status XcmsCIEXYZToRGBi ( #### XcmsCIEuvYColorSpace #### cmsGlobls.c:53: &XcmsCIEuvYColorSpace, uvY.c:93:XcmsColorSpace XcmsCIEuvYColorSpace = Cv.h:18:extern XcmsColorSpace XcmsCIEuvYColorSpace; #### XcmsCIEuvYToCIELuv #### Luv.c:89: XcmsCIEuvYToCIELuv, Luv.c:321: * XcmsCIEuvYToCIELuv - convert CIEuvY to CIELuv Luv.c:326:XcmsCIEuvYToCIELuv( Xcms.h:539:extern Status XcmsCIEuvYToCIELuv ( #### XcmsCIEuvYToCIEXYZ #### HVC.c:112: XcmsCIEuvYToCIEXYZ, Luv.c:80: XcmsCIEuvYToCIEXYZ, uvY.c:73: XcmsCIEuvYToCIEXYZ, uvY.c:223: * XcmsCIEuvYToCIEXYZ - convert CIEuvY to CIEXYZ uvY.c:228:XcmsCIEuvYToCIEXYZ( Xcms.h:546:extern Status XcmsCIEuvYToCIEXYZ ( #### XcmsCIEuvYToTekHVC #### HVC.c:121: XcmsCIEuvYToTekHVC, HVC.c:446: * XcmsCIEuvYToTekHVC - convert CIEuvY to TekHVC HVC.c:451:XcmsCIEuvYToTekHVC( Xcms.h:553:extern Status XcmsCIEuvYToTekHVC ( #### XcmsCIExyYColorSpace #### cmsGlobls.c:54: &XcmsCIExyYColorSpace, xyY.c:92:XcmsColorSpace XcmsCIExyYColorSpace = Cv.h:19:extern XcmsColorSpace XcmsCIExyYColorSpace; #### XcmsCIExyYToCIEXYZ #### xyY.c:72: XcmsCIExyYToCIEXYZ, xyY.c:231: * XcmsCIExyYToCIEXYZ - convert CIExyY to CIEXYZ xyY.c:236:XcmsCIExyYToCIEXYZ( Xcms.h:560:extern Status XcmsCIExyYToCIEXYZ ( #### XcmsClientWhitePointOfCCC #### OfCCC.c:144: * XcmsClientWhitePointOfCCC OfCCC.c:150:XcmsClientWhitePointOfCCC( Xcms.h:567:extern XcmsColor *XcmsClientWhitePointOfCCC ( #### XcmsConvertColors #### cmsAllNCol.c:112: if ((retval2 = XcmsConvertColors(ccc, &tmpColor, cmsAllNCol.c:137: if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, cmsAllNCol.c:187: if (XcmsConvertColors(ccc, pColor_exact_return, 1, result_format, cmsAllNCol.c:191: if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, cmsColNm.c:887: return(XcmsConvertColors(ccc, pColor_exact_return, 1, cmsLkCol.c:117: } else if ((retval2 = XcmsConvertColors(ccc, pColor_scrn_return, 1, cmsLkCol.c:135: if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, cmsLkCol.c:182: if (XcmsConvertColors(ccc, pColor_exact_return, 1, result_format, cmsLkCol.c:186: if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, CvCols.c:710: * XcmsConvertColors - Convert XcmsColor structures CvCols.c:715:XcmsConvertColors( CvColW.c:53: * _XcmsConvertColorsWithWhitePt - Convert XcmsColor structures CvColW.c:58:_XcmsConvertColorsWithWhitePt( HVCGcVC.c:215: if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, HVCMxC.c:178: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, HVCMxV.c:187: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, HVCMxVC.c:124: if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, HVCMxVC.c:157: if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, HVCMxVs.c:150: if (_XcmsConvertColorsWithWhitePt(&myCCC, pHVC, HVCWpAj.c:104: if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, HVCWpAj.c:112: return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtTo, LabGcLC.c:181: if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, LabMnL.c:170: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, LabMxC.c:166: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, LabMxL.c:170: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, LabMxLC.c:116: if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc), LabMxLC.c:149: if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, LabWpAj.c:87: if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, LabWpAj.c:95: return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, LuvGcLC.c:181: if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, LuvMnL.c:170: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, LuvMxC.c:167: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, LuvMxL.c:170: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, LuvMxLC.c:116: if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc), LuvMxLC.c:149: if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, LuvWpAj.c:86: if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, LuvWpAj.c:94: return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtTo, QBlack.c:79: if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { QBlue.c:79: if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { QGreen.c:79: if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { QRed.c:79: if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { QWhite.c:79: if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { SetGetCols.c:122: if ((retval = XcmsConvertColors(ccc, pColors_in_out, 1, XcmsRGBFormat, SetGetCols.c:163: if (XcmsConvertColors(ccc, pColors_in_out, 1, result_format, SetGetCols.c:252: if ((retval = XcmsConvertColors(ccc, pColors_in_out, nColors, XcmsRGBFormat, SetGetCols.c:292: if (XcmsConvertColors(ccc, pColors_in_out, nColors, result_format, Cv.h:73:_XcmsConvertColorsWithWhitePt( Xcms.h:571:extern Status XcmsConvertColors ( #### XcmsCreateCCC #### AddSF.c:76: * XcmsCreateCCC(). If not, XcmsCCC structures created CCC.c:82: * XcmsCreateCCC CCC.c:88:XcmsCreateCCC( CCC.c:259: * that was created with XcmsCreateCCC(). cmsCmap.c:109: pRec->ccc = XcmsCreateCCC( cmsCmap.c:202: pRec->ccc = XcmsCreateCCC( cmsCmap.c:442: return(pRec->ccc = XcmsCreateCCC( cmsCmap.c:456: return(pRec->ccc = XcmsCreateCCC( cmsInt.c:321: * for the latter (see XcmsCreateCCC). The ones created Xcms.h:579:extern XcmsCCC XcmsCreateCCC ( #### XcmsDefaultCCC #### CCC.c:108: XcmsCCC pDefaultCCC = XcmsDefaultCCC(dpy, screenNumber); CCC.c:168: * XcmsDefaultCCC CCC.c:173:XcmsDefaultCCC( cmsInt.c:205: * Note that the XcmsDefaultCCC routine calls _XcmsInitScrnInto Xcms.h:590:extern XcmsCCC XcmsDefaultCCC ( #### XcmsDisplayOfCCC #### OfCCC.c:52: * XcmsDisplayOfCCC OfCCC.c:58:XcmsDisplayOfCCC( Xcms.h:595:extern Display *XcmsDisplayOfCCC ( #### XcmsFormatOfPrefix #### AddDIC.c:66: * structures between clients! Use the routines XcmsFormatOfPrefix() AddSF.c:67: * across clients! Use the routines XcmsFormatOfPrefix() cmsColNm.c:802: * This routine is also used in XcmsFormatOfPrefix. IdOfPr.c:30: * Source for XcmsFormatOfPrefix() IdOfPr.c:45: * XcmsFormatOfPrefix IdOfPr.c:50:XcmsFormatOfPrefix(char *prefix) Xcms.h:599:extern XcmsColorFormat XcmsFormatOfPrefix ( #### XcmsFreeCCC #### CCC.c:250: * XcmsFreeCCC CCC.c:255:XcmsFreeCCC(XcmsCCC ccc) cmsCmap.c:352: XcmsFreeCCC(pRec->ccc); cmsCmap.c:387: XcmsFreeCCC(pRecFree->ccc); cmsInt.c:241: * Do not use XcmsFreeCCC here because it will not free Xcms.h:603:extern void XcmsFreeCCC ( #### XcmsLinearRGBFunctionSet #### cmsGlobls.c:87: &XcmsLinearRGBFunctionSet, HVCGcC.c:114: FunctionSetOfCCC(ccc) != (XPointer) &XcmsLinearRGBFunctionSet) { HVCGcV.c:119: FunctionSetOfCCC(ccc) != (XPointer) &XcmsLinearRGBFunctionSet) { HVCGcVC.c:130: FunctionSetOfCCC(ccc) != (XPointer) &XcmsLinearRGBFunctionSet) { LRGB.c:209:XcmsFunctionSet XcmsLinearRGBFunctionSet = LRGB.c:790: pPerScrnInfo->functionSet = (XPointer) &XcmsLinearRGBFunctionSet; LRGB.c:1838: pPerScrnInfo->functionSet = (XPointer)&XcmsLinearRGBFunctionSet; Cv.h:31:extern XcmsFunctionSet XcmsLinearRGBFunctionSet; #### XcmsLookupColor #### cmsColNm.c:29: * Source for _XcmsLookupColorName(). cmsColNm.c:364: * _XcmsLookupColorName - Lookup DB entry for a color name cmsColNm.c:369:_XcmsLookupColorName( cmsColNm.c:843: * The XcmsLookupColor function finds the color specification cmsColNm.c:904: retval = _XcmsLookupColorName(ccc, color_string, pColor_exact_return); cmsColNm.c:973: if (_XcmsLookupColorName(ccc, &strptr, &dbWhitePt) != 1) { cmsLkCol.c:30: * Source for XcmsLookupColor cmsLkCol.c:46: * XcmsLookupColor - cmsLkCol.c:51:XcmsLookupColor ( cmsLkCol.c:60: * The XcmsLookupColor function finds the color specification Xcms.h:607:extern Status XcmsLookupColor ( #### XcmsPrefixOfFormat #### AddDIC.c:67: * and XcmsPrefixOfFormat() appropriately. AddSF.c:68: * and XcmsPrefixOfFormat() appropriately. PrOfId.c:30: * Source for XcmsPrefixOfFormat() PrOfId.c:50:XcmsPrefixOfFormat( Xcms.h:616:extern char *XcmsPrefixOfFormat ( #### XcmsQueryBlack #### QBlack.c:52: * XcmsQueryBlack QBlack.c:58:XcmsQueryBlack( Xcms.h:620:extern Status XcmsQueryBlack ( #### XcmsQueryBlue #### QBlue.c:52: * XcmsQueryBlue QBlue.c:58:XcmsQueryBlue( Xcms.h:626:extern Status XcmsQueryBlue ( #### XcmsQueryColor #### QuCol.c:30: * Source for XcmsQueryColors QuCol.c:51: * XcmsQueryColor - Query Color QuCol.c:56:XcmsQueryColor( QuCols.c:30: * Source for XcmsQueryColors QuCols.c:50: * XcmsQueryColors - Query Colors QuCols.c:55:XcmsQueryColors( SetGetCols.c:75: * XcmsQueryColor SetGetCols.c:193: * XcmsQueryColors Xcms.h:632:extern Status XcmsQueryColor ( Xcms.h:639:extern Status XcmsQueryColors ( #### XcmsQueryColors #### QuCol.c:30: * Source for XcmsQueryColors QuCols.c:30: * Source for XcmsQueryColors QuCols.c:50: * XcmsQueryColors - Query Colors QuCols.c:55:XcmsQueryColors( SetGetCols.c:193: * XcmsQueryColors Xcms.h:639:extern Status XcmsQueryColors ( #### XcmsQueryGreen #### QGreen.c:52: * XcmsQueryGreen QGreen.c:58:XcmsQueryGreen( Xcms.h:647:extern Status XcmsQueryGreen ( #### XcmsQueryRed #### QRed.c:52: * XcmsQueryRed QRed.c:58:XcmsQueryRed( Xcms.h:653:extern Status XcmsQueryRed ( #### XcmsQueryWhite #### QWhite.c:52: * XcmsQueryWhite QWhite.c:58:XcmsQueryWhite( Xcms.h:659:extern Status XcmsQueryWhite ( #### XcmsRGBColorSpace #### cmsGlobls.c:72: &XcmsRGBColorSpace, LRGB.c:179:XcmsColorSpace XcmsRGBColorSpace = LRGB.c:194: &XcmsRGBColorSpace, Cv.h:22:extern XcmsColorSpace XcmsRGBColorSpace; #### XcmsRGBToRGBi #### LRGB.c:127: (XcmsConversionProc)XcmsRGBToRGBi, LRGB.c:1716: * XcmsRGBToRGBi LRGB.c:1722:XcmsRGBToRGBi( Xcms.h:679:extern Status XcmsRGBToRGBi ( #### XcmsRGBiColorSpace #### cmsGlobls.c:73: &XcmsRGBiColorSpace, LRGB.c:166:XcmsColorSpace XcmsRGBiColorSpace = LRGB.c:195: &XcmsRGBiColorSpace, Cv.h:23:extern XcmsColorSpace XcmsRGBiColorSpace; #### XcmsRGBiToCIEXYZ #### LRGB.c:128: (XcmsConversionProc)XcmsRGBiToCIEXYZ, LRGB.c:149: (XcmsConversionProc)XcmsRGBiToCIEXYZ, LRGB.c:1586:XcmsRGBiToCIEXYZ( Xcms.h:665:extern Status XcmsRGBiToCIEXYZ ( #### XcmsRGBiToRGB #### LRGB.c:139: (XcmsConversionProc)XcmsRGBiToRGB, LRGB.c:1633: * XcmsRGBiToRGB LRGB.c:1639:XcmsRGBiToRGB( Xcms.h:672:extern Status XcmsRGBiToRGB ( #### XcmsScreenNumberOfCCC #### OfCCC.c:98: * XcmsScreenNumberOfCCC OfCCC.c:104:XcmsScreenNumberOfCCC( Xcms.h:686:extern int XcmsScreenNumberOfCCC ( #### XcmsScreenWhitePointOfCCC #### OfCCC.c:121: * XcmsScreenWhitePointOfCCC OfCCC.c:127:XcmsScreenWhitePointOfCCC( Xcms.h:690:extern XcmsColor *XcmsScreenWhitePointOfCCC ( #### XcmsSetCCCOfColormap #### cmsCmap.c:478:XcmsCCC XcmsSetCCCOfColormap( Xcms.h:694:extern XcmsCCC XcmsSetCCCOfColormap( #### XcmsSetCompressionProc #### SetCCC.c:85: * XcmsSetCompressionProc SetCCC.c:91:XcmsSetCompressionProc( Xcms.h:700:extern XcmsCompressionProc XcmsSetCompressionProc ( #### XcmsSetWhiteAdjustProc #### SetCCC.c:114: * XcmsSetWhiteAdjustProc SetCCC.c:120:XcmsSetWhiteAdjustProc( Xcms.h:706:extern XcmsWhiteAdjustProc XcmsSetWhiteAdjustProc ( #### XcmsSetWhitePoint #### SetCCC.c:52: * XcmsSetWhitePoint SetCCC.c:58:XcmsSetWhitePoint( Xcms.h:712:extern Status XcmsSetWhitePoint ( #### XcmsStoreColor #### SetGetCols.c:76: * XcmsStoreColor SetGetCols.c:194: * XcmsStoreColors StCol.c:30: * Source for XcmsStoreColor StCol.c:51: * XcmsStoreColor - Store Color StCol.c:56:XcmsStoreColor( StCols.c:30: * Source for XcmsStoreColors StCols.c:51: * XcmsStoreColors - Store Colors StCols.c:56:XcmsStoreColors( Xcms.h:717:extern Status XcmsStoreColor ( Xcms.h:723:extern Status XcmsStoreColors ( #### XcmsStoreColors #### SetGetCols.c:194: * XcmsStoreColors StCols.c:30: * Source for XcmsStoreColors StCols.c:51: * XcmsStoreColors - Store Colors StCols.c:56:XcmsStoreColors( Xcms.h:723:extern Status XcmsStoreColors ( #### XcmsTekHVCClipC #### cmsInt.c:46:# define XCMSCOMPPROC XcmsTekHVCClipC HVCGcC.c:42: * Source for XcmsTekHVCClipC() gamut compression routine. HVCGcC.c:62: * XcmsTekHVCClipC - Reduce the chroma for a hue and value HVCGcC.c:68:XcmsTekHVCClipC ( Xcms.h:731:extern Status XcmsTekHVCClipC( #### XcmsTekHVCClipV #### HVCGcV.c:42: * Source for XcmsTekHVCClipV() gamut compression routine. HVCGcV.c:62: * XcmsTekHVCClipV - Return the closest value HVCGcV.c:68:XcmsTekHVCClipV ( HVCGcVC.c:42: * Source for XcmsTekHVCClipVC() gamut HVCGcVC.c:70: * XcmsTekHVCClipVC - Return the closest value and chroma HVCGcVC.c:76:XcmsTekHVCClipVC ( Xcms.h:739:extern Status XcmsTekHVCClipV( Xcms.h:747:extern Status XcmsTekHVCClipVC( #### XcmsTekHVCClipVC #### HVCGcVC.c:42: * Source for XcmsTekHVCClipVC() gamut HVCGcVC.c:70: * XcmsTekHVCClipVC - Return the closest value and chroma HVCGcVC.c:76:XcmsTekHVCClipVC ( Xcms.h:747:extern Status XcmsTekHVCClipVC( #### XcmsTekHVCColorSpace #### cmsGlobls.c:57: &XcmsTekHVCColorSpace, HVC.c:132:XcmsColorSpace XcmsTekHVCColorSpace = HVCGcC.c:107: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCGcV.c:98: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCGcVC.c:109: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCMnV.c:114: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCMxC.c:117: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCMxV.c:115: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCMxVC.c:217: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCMxVs.c:112: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { HVCWpAj.c:95: if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { Cv.h:16:extern XcmsColorSpace XcmsTekHVCColorSpace; #### XcmsTekHVCQueryMaxC #### HVCGcC.c:135: if (XcmsTekHVCQueryMaxC(ccc, HVCMxC.c:42: * Source for the XcmsTekHVCQueryMaxC() gamut boudary HVCMxC.c:70: * XcmsTekHVCQueryMaxC - Compute the maximum chroma for a hue and value HVCMxC.c:75:XcmsTekHVCQueryMaxC( Xcms.h:755:extern Status XcmsTekHVCQueryMaxC ( #### XcmsTekHVCQueryMaxV #### HVCGcV.c:140: if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, hvc_max.spec.TekHVC.H, &hvc_max, HVCGcV.c:186: if (XcmsTekHVCQueryMaxV(&myCCC, HVCGcVC.c:158: if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, hvc_max.spec.TekHVC.H, &hvc_max, HVCMnV.c:138: if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, max_vc.spec.TekHVC.H, &max_vc, HVCMxC.c:139: if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, hue, &max_vc, &rgb_saved) HVCMxV.c:42: * Source for the XcmsTekHVCQueryMaxV() gamut boundary HVCMxV.c:70: * XcmsTekHVCQueryMaxV - Compute maximum value for a hue and chroma HVCMxV.c:75:XcmsTekHVCQueryMaxV( HVCMxV.c:138: if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, max_vc.spec.TekHVC.H, &max_vc, &rgb_saved) HVCMxVC.c:42: * Source for the XcmsTekHVCQueryMaxVC() gamut boundary HVCMxVC.c:73: * _XcmsTekHVCQueryMaxVCRGB - Compute maximum value/chroma. HVCMxVC.c:78:_XcmsTekHVCQueryMaxVCRGB( HVCMxVC.c:178: * XcmsTekHVCQueryMaxVC - Compute maximum value and chroma. HVCMxVC.c:183:XcmsTekHVCQueryMaxVC ( HVCMxVC.c:233: return(_XcmsTekHVCQueryMaxVCRGB (&myCCC, hue, pColor_return, HVCMxVs.c:42: * Source for the XcmsTekHVCQueryMaxVSamples() gamut boundary HVCMxVs.c:62: * XcmsTekHVCQueryMaxVSamples - Compute a set of value/chroma HVCMxVs.c:68:XcmsTekHVCQueryMaxVSamples( HVCMxVs.c:135: if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, pColor_in_out->spec.TekHVC.H, Cv.h:61:_XcmsTekHVCQueryMaxVCRGB( Xcms.h:762:extern Status XcmsTekHVCQueryMaxV ( Xcms.h:769:extern Status XcmsTekHVCQueryMaxVC ( Xcms.h:775:extern Status XcmsTekHVCQueryMaxVSamples ( #### XcmsTekHVCQueryMaxVC #### HVCGcV.c:140: if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, hvc_max.spec.TekHVC.H, &hvc_max, HVCGcVC.c:158: if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, hvc_max.spec.TekHVC.H, &hvc_max, HVCMnV.c:138: if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, max_vc.spec.TekHVC.H, &max_vc, HVCMxC.c:139: if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, hue, &max_vc, &rgb_saved) HVCMxV.c:138: if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, max_vc.spec.TekHVC.H, &max_vc, &rgb_saved) HVCMxVC.c:42: * Source for the XcmsTekHVCQueryMaxVC() gamut boundary HVCMxVC.c:73: * _XcmsTekHVCQueryMaxVCRGB - Compute maximum value/chroma. HVCMxVC.c:78:_XcmsTekHVCQueryMaxVCRGB( HVCMxVC.c:178: * XcmsTekHVCQueryMaxVC - Compute maximum value and chroma. HVCMxVC.c:183:XcmsTekHVCQueryMaxVC ( HVCMxVC.c:233: return(_XcmsTekHVCQueryMaxVCRGB (&myCCC, hue, pColor_return, HVCMxVs.c:135: if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, pColor_in_out->spec.TekHVC.H, Cv.h:61:_XcmsTekHVCQueryMaxVCRGB( Xcms.h:769:extern Status XcmsTekHVCQueryMaxVC ( #### XcmsTekHVCQueryMaxVSamples #### HVCMxVs.c:42: * Source for the XcmsTekHVCQueryMaxVSamples() gamut boundary HVCMxVs.c:62: * XcmsTekHVCQueryMaxVSamples - Compute a set of value/chroma HVCMxVs.c:68:XcmsTekHVCQueryMaxVSamples( Xcms.h:775:extern Status XcmsTekHVCQueryMaxVSamples ( #### XcmsTekHVCQueryMinV #### HVCMnV.c:42: * Source for XcmsTekHVCQueryMinV gamut boundary querying routine. HVCMnV.c:67: * XcmsTekHVCQueryMinV - Compute minimum value for hue and chroma HVCMnV.c:72:XcmsTekHVCQueryMinV ( Xcms.h:782:extern Status XcmsTekHVCQueryMinV ( #### XcmsTekHVCToCIEuvY #### HVC.c:111: XcmsTekHVCToCIEuvY, HVC.c:325: * XcmsTekHVCToCIEuvY - convert TekHVC to CIEuvY HVC.c:330:XcmsTekHVCToCIEuvY( Xcms.h:789:extern Status XcmsTekHVCToCIEuvY ( #### XcmsTekHVCWhiteShiftColors #### HVCWpAj.c:63: * XcmsTekHVCWhiteShiftColors HVCWpAj.c:68:XcmsTekHVCWhiteShiftColors( Xcms.h:796:extern Status XcmsTekHVCWhiteShiftColors( #### XcmsUNDEFINEDColorSpace #### cmsGlobls.c:58: &XcmsUNDEFINEDColorSpace, UNDEFINED.c:80:XcmsColorSpace XcmsUNDEFINEDColorSpace = Cv.h:15:extern XcmsColorSpace XcmsUNDEFINEDColorSpace; #### XcmsVisualOfCCC #### OfCCC.c:75: * XcmsVisualOfCCC OfCCC.c:81:XcmsVisualOfCCC( Xcms.h:806:extern Visual *XcmsVisualOfCCC ( #### XkbAddDeviceLedInfo #### XKBAlloc.c:343:XkbAddDeviceLedInfo(XkbDeviceInfoPtr devi, unsigned ledClass, unsigned ledId) XKBExtDev.c:124: devli = XkbAddDeviceLedInfo(devi, wireli->ledClass, wireli->ledID); XKBlib.h:1024:extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo( #### XkbAddGeomColor #### XKBGAlloc.c:714:XkbAddGeomColor(XkbGeometryPtr geom, char *spec, unsigned int pixel) XKBGeom.c:322: else if (XkbAddGeomColor(geom, spec, geom->num_colors) == NULL) #### XkbAddGeomDoodad #### XKBGAlloc.c:861:XkbAddGeomDoodad(XkbGeometryPtr geom, XkbSectionPtr section, Atom name) XKBGeom.c:411: doodad = XkbAddGeomDoodad(geom, section, doodadWire->any.name); #### XkbAddGeomKey #### XKBGAlloc.c:686:XkbAddGeomKeyAlias(XkbGeometryPtr geom, char *aliasStr, char *realStr) XKBGAlloc.c:787:XkbAddGeomKey(XkbRowPtr row) XKBGeom.c:556: key = XkbAddGeomKey(row); #### XkbAddGeomKeyAlias #### XKBGAlloc.c:686:XkbAddGeomKeyAlias(XkbGeometryPtr geom, char *aliasStr, char *realStr) #### XkbAddGeomOutline #### XKBGAlloc.c:741:XkbAddGeomOutline(XkbShapePtr shape, int sz_points) XKBGeom.c:368: ol = XkbAddGeomOutline(shape, olWire->nPoints); #### XkbAddGeomOverlay #### XKBGAlloc.c:899:XkbAddGeomOverlayKey(XkbOverlayPtr overlay, XKBGAlloc.c:935:XkbAddGeomOverlayRow(XkbOverlayPtr overlay, int row_under, int sz_keys) XKBGAlloc.c:967:XkbAddGeomOverlay(XkbSectionPtr section, Atom name, int sz_rows) XKBGeom.c:464: ol = XkbAddGeomOverlay(section, olWire->name, olWire->nRows); XKBGeom.c:477: row = XkbAddGeomOverlayRow(ol, rowWire->rowUnder, rowWire->nKeys); #### XkbAddGeomOverlayKey #### XKBGAlloc.c:899:XkbAddGeomOverlayKey(XkbOverlayPtr overlay, #### XkbAddGeomOverlayRow #### XKBGAlloc.c:935:XkbAddGeomOverlayRow(XkbOverlayPtr overlay, int row_under, int sz_keys) XKBGeom.c:477: row = XkbAddGeomOverlayRow(ol, rowWire->rowUnder, rowWire->nKeys); #### XkbAddGeomProperty #### XKBGAlloc.c:653:XkbAddGeomProperty(XkbGeometryPtr geom, char *name, char *value) XKBGeom.c:271: ok = ok && (XkbAddGeomProperty(geom, name, value) != NULL); #### XkbAddGeomRow #### XKBGAlloc.c:801:XkbAddGeomRow(XkbSectionPtr section, int sz_keys) XKBGeom.c:539: row = XkbAddGeomRow(section, rowWire->nKeys); #### XkbAddGeomSection #### XKBGAlloc.c:819:XkbAddGeomSection(XkbGeometryPtr geom, XKBGeom.c:517: section = XkbAddGeomSection(geom, sectionWire->name, sectionWire->nRows, #### XkbAddGeomShape #### XKBGAlloc.c:760:XkbAddGeomShape(XkbGeometryPtr geom, Atom name, int sz_outlines) XKBGeom.c:355: shape = XkbAddGeomShape(geom, shapeWire->name, shapeWire->nOutlines); #### XkbAddKeyType #### XKBMAlloc.c:279:XkbAddKeyType(XkbDescPtr xkb, XKBlib.h:676:extern XkbKeyTypePtr XkbAddKeyType( #### XkbAllocClientMap #### XKBGetMap.c:45: else if (XkbAllocClientMap(xkb, XkbKeyTypesMask, n) != Success) XKBGetMap.c:414: (XkbAllocClientMap(xkb, XkbModifierMapMask, 0) != Success)) { XKBGetMap.c:510: if (mask && (XkbAllocClientMap(xkb, mask, rep->nTypes) != Success)) XKBMAlloc.c:42:XkbAllocClientMap(XkbDescPtr xkb, unsigned which, unsigned nTotalTypes) XKBMAlloc.c:55: fprintf(stderr, "bad keycode (%d,%d) in XkbAllocClientMap\n", XKBMAlloc.c:305: if (XkbAllocClientMap(xkb, XkbKeyTypesMask, tmp) != Success) XKBMAlloc.c:331: (XkbAllocClientMap(xkb, XkbKeyTypesMask, map->num_types + 1) != XKBMisc.c:98: rtrn = XkbAllocClientMap(xkb, XkbKeyTypesMask, XkbNumRequiredTypes); XKBlib.h:652:extern Status XkbAllocClientMap( #### XkbAllocCompatMap #### XKBAlloc.c:44:XkbAllocCompatMap(XkbDescPtr xkb, unsigned which, unsigned nSI) XKBCompat.c:53: (XkbAllocCompatMap(xkb, XkbAllCompatMask, i) != Success)) XKBlib.h:802:extern Status XkbAllocCompatMap( #### XkbAllocControls #### XKBAlloc.c:252:XkbAllocControls(XkbDescPtr xkb, unsigned which) XKBlib.h:770:extern Status XkbAllocControls( #### XkbAllocDeviceInfo #### XKBAlloc.c:418:XkbAllocDeviceInfo(unsigned deviceSpec, unsigned nButtons, unsigned szLeds) XKBExtDev.c:262: devi = XkbAllocDeviceInfo(rep.deviceID, rep.totalBtns, rep.nDeviceLedFBs); XKBlib.h:1035:extern XkbDeviceInfoPtr XkbAllocDeviceInfo( #### XkbAllocGeomColors #### XKBGAlloc.c:529:XkbAllocGeomColors(XkbGeometryPtr geom, int nColors) XKBGeom.c:315: if ((rtrn = XkbAllocGeomColors(geom, rep->nColors)) == Success) { #### XkbAllocGeomDoodads #### XKBGAlloc.c:571:XkbAllocGeomDoodads(XkbGeometryPtr geom, int nDoodads) XKBGeom.c:597: if ((rtrn = XkbAllocGeomDoodads(geom, rep->nDoodads)) != Success) #### XkbAllocGeomKeyAliases #### XKBGAlloc.c:535:XkbAllocGeomKeyAliases(XkbGeometryPtr geom, int nKeyAliases) XKBGeom.c:293: if ((rtrn = XkbAllocGeomKeyAliases(geom, rep->nKeyAliases)) == Success) { #### XkbAllocGeomKeys #### XKBGAlloc.c:601:XkbAllocGeomKeys(XkbRowPtr row, int nKeys) #### XkbAllocGeomOutlines #### XKBGAlloc.c:583:XkbAllocGeomOutlines(XkbShapePtr shape, int nOL) #### XkbAllocGeomOverlayKeys #### XKBGAlloc.c:565:XkbAllocGeomOverlayKeys(XkbOverlayRowPtr row, int nKeys) #### XkbAllocGeomOverlayRows #### XKBGAlloc.c:559:XkbAllocGeomOverlayRows(XkbOverlayPtr overlay, int nRows) #### XkbAllocGeomOverlays #### XKBGAlloc.c:553:XkbAllocGeomOverlays(XkbSectionPtr section, int nOverlays) #### XkbAllocGeomPoints #### XKBGAlloc.c:595:XkbAllocGeomPoints(XkbOutlinePtr ol, int nPts) #### XkbAllocGeomProps #### XKBGAlloc.c:523:XkbAllocGeomProps(XkbGeometryPtr geom, int nProps) XKBGeom.c:262: if ((rtrn = XkbAllocGeomProps(geom, rep->nProperties)) == Success) { #### XkbAllocGeomRows #### XKBGAlloc.c:589:XkbAllocGeomRows(XkbSectionPtr section, int nRows) #### XkbAllocGeomSectionDoodads #### XKBGAlloc.c:577:XkbAllocGeomSectionDoodads(XkbSectionPtr section, int nDoodads) #### XkbAllocGeomSections #### XKBGAlloc.c:547:XkbAllocGeomSections(XkbGeometryPtr geom, int nSections) XKBGeom.c:510: if ((rtrn = XkbAllocGeomSections(geom, rep->nSections)) != Success) #### XkbAllocGeomShapes #### XKBGAlloc.c:541:XkbAllocGeomShapes(XkbGeometryPtr geom, int nShapes) XKBGeom.c:344: if ((rtrn = XkbAllocGeomShapes(geom, rep->nShapes)) != Success) #### XkbAllocGeometry #### XKBGAlloc.c:607:XkbAllocGeometry(XkbDescPtr xkb, XkbGeometrySizesPtr sizes) #### XkbAllocIndicatorMaps #### XKBAlloc.c:279:XkbAllocIndicatorMaps(XkbDescPtr xkb) XKBleds.c:69: if ((!xkb->indicators) && (XkbAllocIndicatorMaps(xkb) != Success)) XKBlib.h:684:extern Status XkbAllocIndicatorMaps( #### XkbAllocKeyboard #### XKBAlloc.c:304:XkbAllocKeyboard(void) XKBlib.h:642:extern XkbDescPtr XkbAllocKeyboard( #### XkbAllocNames #### XKBAlloc.c:118:XkbAllocNames(XkbDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases) XKBNames.c:68: (XkbAllocNames(xkb, rep->which, XKBNames.c:197: if (XkbAllocNames(xkb, XkbKeyAliasesMask, 0, rep->nKeyAliases) != XKBlib.h:834:extern Status XkbAllocNames( #### XkbAllocServerMap #### XKBGetMap.c:447: (XkbAllocServerMap(xkb, XkbVirtualModMapMask, 0) != Success)) { XKBGetMap.c:515: if (mask && (XkbAllocServerMap(xkb, mask, rep->totalActs) != Success)) XKBMAlloc.c:129:XkbAllocServerMap(XkbDescPtr xkb, unsigned which, unsigned nNewActions) XKBMisc.c:441: (XkbAllocServerMap(xkb, XkbAllServerInfoMask, 0) != Success)) { XKBlib.h:658:extern Status XkbAllocServerMap( #### XkbApplyCompatMapToKey #### XKBMisc.c:427:XkbApplyCompatMapToKey(XkbDescPtr xkb, KeyCode key, XkbChangesPtr changes) XKBMisc.c:638: XkbApplyCompatMapToKey(xkb, key, changes); XKBlib.h:1007:extern Bool XkbApplyCompatMapToKey( /* False only on error */ #### XkbApplyVirtualModChanges #### XKBMisc.c:668: XkbApplyVirtualModChanges(xkb, changes->map.vmods, changes); XKBMisc.c:907:XkbApplyVirtualModChanges(XkbDescPtr xkb, XKBlib.h:1129:extern Bool XkbApplyVirtualModChanges( #### XkbBell #### XKBBell.c:146:XkbBell(Display *dpy, Window window, int percent, Atom name) XKBBell.c:170:XkbBellEvent(Display *dpy, Window window, int percent, Atom name) XKB.c:200: case XkbBellNotify: XKBUse.c:379: case XkbBellNotify: XKBUse.c:381: if (xkbi->selected_events & XkbBellNotifyMask) { XKBUse.c:383: XkbBellNotifyEvent *bev = (XkbBellNotifyEvent *) re; XKBUse.c:386: bev->xkb_type = XkbBellNotify; XKBlib.h:186:typedef struct _XkbBellNotify { XKBlib.h:192: int xkb_type; /* XkbBellNotify */ XKBlib.h:202:} XkbBellNotifyEvent; XKBlib.h:265: XkbBellNotifyEvent bell; XKBlib.h:456:extern Bool XkbBell( XKBlib.h:468:extern Bool XkbBellEvent( #### XkbBellEvent #### XKBBell.c:170:XkbBellEvent(Display *dpy, Window window, int percent, Atom name) XKBlib.h:468:extern Bool XkbBellEvent( #### XkbChangeDeviceInfo #### XKBExtDev.c:731:XkbChangeDeviceInfo(Display *dpy, XKBlib.h:1089:extern Bool XkbChangeDeviceInfo( #### XkbChangeEnabledControls #### XKBCtrls.c:154:XkbChangeEnabledControls(Display *dpy, XKBlib.h:421:extern Bool XkbChangeEnabledControls( #### XkbChangeKeycodeRange #### XKBMAlloc.c:645:XkbChangeKeycodeRange(XkbDescPtr xkb, XKBlib.h:961:extern Status XkbChangeKeycodeRange( #### XkbChangeMap #### XKBSetMap.c:541:XkbChangeMap(Display *dpy, XkbDescPtr xkb, XkbMapChangesPtr changes) XKBlib.h:880:extern Bool XkbChangeMap( #### XkbChangeNames #### XKBNames.c:532:XkbChangeNames(Display *dpy, XkbDescPtr xkb, XkbNameChangesPtr changes) XKBlib.h:855:extern Bool XkbChangeNames( #### XkbChangeTypesOfKey #### XKBMisc.c:635: XkbChangeTypesOfKey(xkb, key, nG, XkbAllGroupsMask, types, mc); XKBMisc.c:673:XkbChangeTypesOfKey(XkbDescPtr xkb, XKBlib.h:952:extern Status XkbChangeTypesOfKey( #### XkbComputeEffectiveMap #### XKB.c:435:XkbComputeEffectiveMap(XkbDescPtr xkb, XKBlib.h:630:extern Bool XkbComputeEffectiveMap( #### XkbComputeRowBounds #### XKBGeom.c:114:XkbComputeRowBounds(XkbGeometryPtr geom, XkbSectionPtr section, XkbRowPtr row) XKBGeom.c:163: if (!XkbComputeRowBounds(geom, section, row)) #### XkbComputeSectionBounds #### XKBGeom.c:150:XkbComputeSectionBounds(XkbGeometryPtr geom, XkbSectionPtr section) #### XkbComputeShapeBounds #### XKBGeom.c:64:XkbComputeShapeBounds(XkbShapePtr shape) XKBGeom.c:394: XkbComputeShapeBounds(shape); #### XkbComputeShapeTop #### XKBGeom.c:87:XkbComputeShapeTop(XkbShapePtr shape, XkbBoundsPtr bounds) #### XkbCopyKeyType #### XKBMAlloc.c:225:XkbCopyKeyType(XkbKeyTypePtr from, XkbKeyTypePtr into) XKBMAlloc.c:265:XkbCopyKeyTypes(XkbKeyTypePtr from, XkbKeyTypePtr into, int num_types) XKBMAlloc.c:272: if ((rtrn = XkbCopyKeyType(from++, into++)) != Success) XKBMisc.c:108: rtrn = XkbCopyKeyType(&from[XkbOneLevelIndex], &to[XkbOneLevelIndex]); XKBMisc.c:110: rtrn = XkbCopyKeyType(&from[XkbTwoLevelIndex], &to[XkbTwoLevelIndex]); XKBMisc.c:113: XkbCopyKeyType(&from[XkbAlphabeticIndex], &to[XkbAlphabeticIndex]); XKBMisc.c:117: rtrn = XkbCopyKeyType(&from[XkbKeypadIndex], &to[XkbKeypadIndex]); XKBlib.h:921:extern Status XkbCopyKeyType( XKBlib.h:926:extern Status XkbCopyKeyTypes( #### XkbCopyKeyTypes #### XKBMAlloc.c:265:XkbCopyKeyTypes(XkbKeyTypePtr from, XkbKeyTypePtr into, int num_types) XKBlib.h:926:extern Status XkbCopyKeyTypes( #### XkbDeviceBell #### XKBBell.c:37:XkbDeviceBell(Display *dpy, XKBBell.c:109:XkbDeviceBellEvent(Display *dpy, XKBBell.c:153: return XkbDeviceBell(dpy, window, XkbUseCoreKbd, XKBBell.c:177: return XkbDeviceBellEvent(dpy, window, XkbUseCoreKbd, XKBlib.h:428:extern Bool XkbDeviceBell( XKBlib.h:446:extern Bool XkbDeviceBellEvent( #### XkbDeviceBellEvent #### XKBBell.c:109:XkbDeviceBellEvent(Display *dpy, XKBBell.c:177: return XkbDeviceBellEvent(dpy, window, XkbUseCoreKbd, XKBlib.h:446:extern Bool XkbDeviceBellEvent( #### XkbFindOverlayForKey #### XKBGeom.c:211:XkbFindOverlayForKey(XkbGeometryPtr geom, XkbSectionPtr wanted, char *under) #### XkbForceBell #### XKBBell.c:158:XkbForceBell(Display *dpy, int percent) XKBlib.h:463:extern Bool XkbForceBell( #### XkbForceDeviceBell #### XKBBell.c:74:XkbForceDeviceBell(Display *dpy, XKBBell.c:165: return XkbForceDeviceBell(dpy, XkbUseCoreKbd, XkbDfltXIClass, XkbDfltXIId, XKBlib.h:438:extern Bool XkbForceDeviceBell( #### XkbFreeClientMap #### XKBAlloc.c:322: XkbFreeClientMap(xkb, XkbAllClientInfoMask, True); XKBMAlloc.c:928:XkbFreeClientMap(XkbDescPtr xkb, unsigned what, Bool freeMap) XKBlib.h:664:extern void XkbFreeClientMap( #### XkbFreeCompatMap #### XKBAlloc.c:91:XkbFreeCompatMap(XkbDescPtr xkb, unsigned which, Bool freeMap) XKBAlloc.c:326: XkbFreeCompatMap(xkb, XkbAllCompatMask, True); XKBlib.h:808:extern void XkbFreeCompatMap( #### XkbFreeComponentList #### XKBList.c:223: XkbFreeComponentList(list); XKBList.c:237:XkbFreeComponentList(XkbComponentListPtr list) XKBlib.h:977:extern void XkbFreeComponentList( #### XkbFreeControls #### XKBAlloc.c:267:XkbFreeControls(XkbDescPtr xkb, unsigned which, Bool freeMap) XKBAlloc.c:334: XkbFreeControls(xkb, XkbAllControlsMask, True); XKBlib.h:775:extern void XkbFreeControls( #### XkbFreeDeviceInfo #### XKBAlloc.c:456:XkbFreeDeviceInfo(XkbDeviceInfoPtr devi, unsigned which, Bool freeDevI) XKBExtDev.c:272: XkbFreeDeviceInfo(devi, XkbXI_AllDeviceFeaturesMask, True); XKBlib.h:1041:extern void XkbFreeDeviceInfo( #### XkbFreeGeomColors #### XKBGAlloc.c:185:XkbFreeGeomColors(XkbGeometryPtr geom, int first, int count, Bool freeAll) XKBGAlloc.c:425: XkbFreeGeomColors(geom, 0, geom->num_colors, True); #### XkbFreeGeomDoodads #### XKBGAlloc.c:351: XkbFreeGeomDoodads(section->doodads, section->num_doodads, True); XKBGAlloc.c:400:XkbFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool freeAll) XKBGAlloc.c:431: XkbFreeGeomDoodads(geom->doodads, geom->num_doodads, True); #### XkbFreeGeomKeyAliases #### XKBGAlloc.c:164:XkbFreeGeomKeyAliases(XkbGeometryPtr geom, int first, int count, Bool freeAll) XKBGAlloc.c:436: XkbFreeGeomKeyAliases(geom, 0, geom->num_key_aliases, True); #### XkbFreeGeomKeys #### XKBGAlloc.c:311:XkbFreeGeomKeys(XkbRowPtr row, int first, int count, Bool freeAll) XKBGAlloc.c:328: XkbFreeGeomKeys(row, 0, row->num_keys, True); #### XkbFreeGeomOutlines #### XKBGAlloc.c:219:XkbFreeGeomOutlines(XkbShapePtr shape, int first, int count, Bool freeAll) XKBGAlloc.c:237: XkbFreeGeomOutlines(shape, 0, shape->num_outlines, True); #### XkbFreeGeomOverlayKeys #### XKBGAlloc.c:254:XkbFreeGeomOverlayKeys(XkbOverlayRowPtr row, int first, int count, Bool freeAll) XKBGAlloc.c:271: XkbFreeGeomOverlayKeys(row, 0, row->num_keys, True); #### XkbFreeGeomOverlayRows #### XKBGAlloc.c:276:XkbFreeGeomOverlayRows(XkbOverlayPtr overlay, int first, int count, XKBGAlloc.c:294: XkbFreeGeomOverlayRows(overlay, 0, overlay->num_rows, True); #### XkbFreeGeomOverlays #### XKBGAlloc.c:299:XkbFreeGeomOverlays(XkbSectionPtr section, int first, int count, Bool freeAll) #### XkbFreeGeomPoints #### XKBGAlloc.c:197:XkbFreeGeomPoints(XkbOutlinePtr outline, int first, int count, Bool freeAll) XKBGAlloc.c:214: XkbFreeGeomPoints(outline, 0, outline->num_points, True); #### XkbFreeGeomProperties #### XKBGAlloc.c:152:XkbFreeGeomProperties(XkbGeometryPtr geom, int first, int count, Bool freeAll) XKBGAlloc.c:423: XkbFreeGeomProperties(geom, 0, geom->num_properties, True); #### XkbFreeGeomRows #### XKBGAlloc.c:333:XkbFreeGeomRows(XkbSectionPtr section, int first, int count, Bool freeAll) XKBGAlloc.c:349: XkbFreeGeomRows(section, 0, section->num_rows, True); #### XkbFreeGeomSections #### XKBGAlloc.c:358:XkbFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll) XKBGAlloc.c:429: XkbFreeGeomSections(geom, 0, geom->num_sections, True); #### XkbFreeGeomShapes #### XKBGAlloc.c:242:XkbFreeGeomShapes(XkbGeometryPtr geom, int first, int count, Bool freeAll) XKBGAlloc.c:427: XkbFreeGeomShapes(geom, 0, geom->num_shapes, True); #### XkbFreeGeometry #### XKBAlloc.c:332: XkbFreeGeometry(xkb->geom, XkbGeomAllMask, True); XKBGAlloc.c:416:XkbFreeGeometry(XkbGeometryPtr geom, unsigned which, Bool freeMap) XKBGAlloc.c:645: XkbFreeGeometry(geom, XkbGeomAllMask, True); XKBGeom.c:618: XkbFreeGeometry(xkb->geom, XkbGeomAllMask, True); XKBGeom.c:654: XkbFreeGeometry(geom, XkbGeomAllMask, True); XKBGeom.c:662: XkbFreeGeometry(geom, XkbGeomAllMask, True); #### XkbFreeIndicatorMaps #### XKBAlloc.c:292:XkbFreeIndicatorMaps(XkbDescPtr xkb) XKBAlloc.c:328: XkbFreeIndicatorMaps(xkb); XKBlib.h:688:extern void XkbFreeIndicatorMaps( #### XkbFreeKeyboard #### XKBAlloc.c:315:XkbFreeKeyboard(XkbDescPtr xkb, unsigned which, Bool freeAll) XKBBind.c:558: XkbFreeKeyboard(xkbi->desc, XkbAllComponentsMask, True); XKBGetByName.c:214: XkbFreeKeyboard(xkb, XkbAllComponentsMask, xTrue); XKBUse.c:613: XkbFreeKeyboard(xkbi->desc, XkbAllComponentsMask, True); XKBlib.h:646:extern void XkbFreeKeyboard( #### XkbFreeNames #### XKBAlloc.c:201:XkbFreeNames(XkbDescPtr xkb, unsigned which, Bool freeMap) XKBAlloc.c:330: XkbFreeNames(xkb, XkbAllNamesMask, True); XKBlib.h:861:extern void XkbFreeNames( #### XkbFreeServerMap #### XKBAlloc.c:324: XkbFreeServerMap(xkb, XkbAllServerInfoMask, True); XKBMAlloc.c:981:XkbFreeServerMap(XkbDescPtr xkb, unsigned what, Bool freeMap) XKBlib.h:670:extern void XkbFreeServerMap( #### XkbGetAutoRepeatRate #### XKBCtrls.c:72:XkbGetAutoRepeatRate(Display *dpy, XKBlib.h:414:extern Bool XkbGetAutoRepeatRate( #### XkbGetAutoResetControls #### XKB.c:622:XkbGetAutoResetControls(Display *dpy, XKBlib.h:904:extern Bool XkbGetAutoResetControls( #### XkbGetCompatMap #### XKBCompat.c:110:XkbGetCompatMap(Display *dpy, unsigned which, XkbDescPtr xkb) XKBlib.h:814:extern Status XkbGetCompatMap( #### XkbGetControls #### XKBCtrls.c:175:XkbGetControls(Display *dpy, unsigned long which, XkbDescPtr xkb) XKBlib.h:781:extern Status XkbGetControls( XKBlib.h:799:#define XkbGetControlsChanges(d,x,c) XkbGetControls(d,(c)->changed_ctrls,x) #### XkbGetDetectableAutoRepeat #### XKB.c:555:XkbGetDetectableAutoRepeat(Display *dpy, Bool *supported) XKBlib.h:892:extern Bool XkbGetDetectableAutoRepeat( #### XkbGetDeviceButtonActions #### XKBExtDev.c:344:XkbGetDeviceButtonActions(Display *dpy, XKBlib.h:1067:extern Status XkbGetDeviceButtonActions( #### XkbGetDeviceInfo #### XKBExtDev.c:233:XkbGetDeviceInfo(Display *dpy, XKBExtDev.c:282:XkbGetDeviceInfoChanges(Display *dpy, XKBlib.h:1053:extern XkbDeviceInfoPtr XkbGetDeviceInfo( XKBlib.h:1061:extern Status XkbGetDeviceInfoChanges( #### XkbGetDeviceInfoChanges #### XKBExtDev.c:282:XkbGetDeviceInfoChanges(Display *dpy, XKBlib.h:1061:extern Status XkbGetDeviceInfoChanges( #### XkbGetDeviceLedInfo #### XKBExtDev.c:385:XkbGetDeviceLedInfo(Display *dpy, XKBlib.h:1075:extern Status XkbGetDeviceLedInfo( #### XkbGetGeometry #### XKBGeom.c:671:XkbGetGeometry(Display *dpy, XkbDescPtr xkb) #### XkbGetIndicatorMap #### XKBleds.c:115:XkbGetIndicatorMap(Display *dpy, unsigned long which, XkbDescPtr xkb) XKBlib.h:516:extern Status XkbGetIndicatorMap( XKBlib.h:532:#define XkbGetIndicatorMapChanges(d,x,c) \ XKBlib.h:533: (XkbGetIndicatorMap((d),(c)->map_changes,x)) #### XkbGetIndicatorState #### XKBleds.c:36:XkbGetIndicatorState(Display *dpy, unsigned deviceSpec, unsigned *pStateRtrn) XKBlib.h:502:extern Status XkbGetIndicatorState( #### XkbGetKeyActions #### XKBGetMap.c:641:XkbGetKeyActions(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) XKBlib.h:729:extern Status XkbGetKeyActions( #### XkbGetKeyBehaviors #### XKBGetMap.c:692:XkbGetKeyBehaviors(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) XKBlib.h:736:extern Status XkbGetKeyBehaviors( #### XkbGetKeyExplicitComponents #### XKBGetMap.c:738:XkbGetKeyExplicitComponents(Display *dpy, XKBlib.h:749:extern Status XkbGetKeyExplicitComponents( #### XkbGetKeyModifierMap #### XKBGetMap.c:775:XkbGetKeyModifierMap(Display *dpy, XKBlib.h:756:extern Status XkbGetKeyModifierMap( #### XkbGetKeySyms #### XKBGetMap.c:666:XkbGetKeySyms(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) XKBlib.h:722:extern Status XkbGetKeySyms( #### XkbGetKeyTypes #### XKBGetMap.c:617:XkbGetKeyTypes(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) XKBlib.h:715:extern Status XkbGetKeyTypes( #### XkbGetKeyVirtualModMap #### XKBGetMap.c:811:XkbGetKeyVirtualModMap(Display *dpy, unsigned first, unsigned num, XKBlib.h:763:extern Status XkbGetKeyVirtualModMap( #### XkbGetKeyboard #### XKBGetByName.c:38:XkbGetKeyboardByName(Display *dpy, XKBGetByName.c:223:XkbGetKeyboard(Display *dpy, unsigned which, unsigned deviceSpec) XKBGetByName.c:225: return XkbGetKeyboardByName(dpy, deviceSpec, NULL, which, which, False); XKBlib.h:981:extern XkbDescPtr XkbGetKeyboard( XKBlib.h:987:extern XkbDescPtr XkbGetKeyboardByName( #### XkbGetKeyboardByName #### XKBGetByName.c:38:XkbGetKeyboardByName(Display *dpy, XKBGetByName.c:225: return XkbGetKeyboardByName(dpy, deviceSpec, NULL, which, which, False); XKBlib.h:987:extern XkbDescPtr XkbGetKeyboardByName( #### XkbGetMap #### XKBBind.c:374: if ((rtrn = XkbGetMapChanges(dpy, xkbi->desc, &changes)) != Success) { XKBBind.c:376: fprintf(stderr, "Internal Error! XkbGetMapChanges failed:\n"); XKBBind.c:432: if (XkbGetMapChanges(dpy, xkbi->desc, &changes) != Success) { XKBBind.c:434: fprintf(stderr, "Internal Error! XkbGetMapChanges failed:\n"); XKBBind.c:518: desc = XkbGetMap(dpy, query, XkbUseCoreKbd); XKBBind.c:521: fprintf(stderr, "Warning! XkbGetMap failed!\n"); XKBBind.c:566: desc = XkbGetMap(dpy, XkbAllClientInfoMask, XkbUseCoreKbd); XKBGetMap.c:594:XkbGetMap(Display *dpy, unsigned which, unsigned deviceSpec) XKBGetMap.c:846:XkbGetMapChanges(Display *dpy, XkbDescPtr xkb, XkbMapChangesPtr changes) XKBlib.h:692:extern XkbDescPtr XkbGetMap( XKBlib.h:704:extern Status XkbGetMapChanges( XKBlibint.h:91: if (XkbGetMapChanges((d),(xi)->desc, &(xi)->changes)==Success) { \ #### XkbGetMapChanges #### XKBBind.c:374: if ((rtrn = XkbGetMapChanges(dpy, xkbi->desc, &changes)) != Success) { XKBBind.c:376: fprintf(stderr, "Internal Error! XkbGetMapChanges failed:\n"); XKBBind.c:432: if (XkbGetMapChanges(dpy, xkbi->desc, &changes) != Success) { XKBBind.c:434: fprintf(stderr, "Internal Error! XkbGetMapChanges failed:\n"); XKBGetMap.c:846:XkbGetMapChanges(Display *dpy, XkbDescPtr xkb, XkbMapChangesPtr changes) XKBlib.h:704:extern Status XkbGetMapChanges( XKBlibint.h:91: if (XkbGetMapChanges((d),(xi)->desc, &(xi)->changes)==Success) { \ #### XkbGetNamedDeviceIndicator #### XKBleds.c:200:XkbGetNamedDeviceIndicator(Display *dpy, XKBleds.c:262: return XkbGetNamedDeviceIndicator(dpy, XkbUseCoreKbd, XKBlib.h:546:extern Bool XkbGetNamedDeviceIndicator( #### XkbGetNamedGeometry #### XKBGeom.c:699:XkbGetNamedGeometry(Display *dpy, XkbDescPtr xkb, Atom name) #### XkbGetNamedIndicator #### XKBleds.c:255:XkbGetNamedIndicator(Display *dpy, XKBlib.h:537:extern Bool XkbGetNamedIndicator( #### XkbGetNames #### XKBNames.c:239:XkbGetNames(Display *dpy, unsigned which, XkbDescPtr xkb) XKBlib.h:841:extern Status XkbGetNames( #### XkbGetPerClientControls #### XKB.c:691:XkbGetPerClientControls(Display *dpy, unsigned *ctrls) XKBlib.h:916:extern Bool XkbGetPerClientControls( #### XkbGetState #### XKB.c:481:XkbGetState(Display *dpy, unsigned deviceSpec, XkbStatePtr rtrn) XKBlib.h:868:extern Status XkbGetState( #### XkbGetUpdatedMap #### XKBBind.c:183: if (XkbGetUpdatedMap(dpy, XkbModifierMapMask, xkb) == Success) XKBGetMap.c:571:XkbGetUpdatedMap(Display *dpy, unsigned which, XkbDescPtr xkb) XKBGetMap.c:603: ((which) && (XkbGetUpdatedMap(dpy, which, xkb) != Success))) { XKBlib.h:698:extern Status XkbGetUpdatedMap( #### XkbGetVirtualMods #### XKBGetMap.c:717:XkbGetVirtualMods(Display *dpy, unsigned which, XkbDescPtr xkb) XKBlib.h:743:extern Status XkbGetVirtualMods( #### XkbGetXlibControls #### imConv.c:145: unsigned ctrls = XkbGetXlibControls (event->display); XKB.c:364:XkbGetXlibControls(Display *dpy) XKBlib.h:335:extern unsigned int XkbGetXlibControls( #### XkbIgnoreExtension #### XKBUse.c:36:static Bool _XkbIgnoreExtension = False; XKBUse.c:587:XkbIgnoreExtension(Bool ignore) XKBUse.c:602: _XkbIgnoreExtension = ignore; XKBUse.c:730: if (forceIgnore || _XkbIgnoreExtension || getenv("XKB_DISABLE")) { XKBlib.h:296:extern Bool XkbIgnoreExtension( #### XkbInitCanonicalKeyTypes #### XKBMAlloc.c:318: if (XkbInitCanonicalKeyTypes(xkb, tmp, XkbNoModifier) == Success) { XKBMisc.c:90:XkbInitCanonicalKeyTypes(XkbDescPtr xkb, unsigned which, int keypadVMod) XKBlib.h:636:extern Status XkbInitCanonicalKeyTypes( #### XkbKeyTypesForCoreSymbols #### XKBMisc.c:143:XkbKeyTypesForCoreSymbols(XkbDescPtr xkb, XKBMisc.c:629: nG = XkbKeyTypesForCoreSymbols(xkb, map_width, syms, explicit, types, XKBlib.h:998:extern int XkbKeyTypesForCoreSymbols( /* returns # of groups */ #### XkbKeycodeToKeysym #### XKBBind.c:60:XkbKeycodeToKeysym(Display *dpy, XKBBind.c:123: return XkbKeycodeToKeysym(dpy, kc, XkbGroup1Index, XKBBind.c:130: return XkbKeycodeToKeysym(dpy, kc, XkbGroup2Index, XKBBind.c:137: return XkbKeycodeToKeysym(dpy, kc, XkbGroup3Index, XKBBind.c:144: return XkbKeycodeToKeysym(dpy, kc, XkbGroup4Index, XKBBind.c:149: return XkbKeycodeToKeysym(dpy, kc, (col >> 1), (col & 1)); XKBlib.h:357:extern KeySym XkbKeycodeToKeysym( #### XkbKeysymToModifiers #### KeyBind.c:64:#define XkbKeysymToModifiers _XKeysymToModifiers KeyBind.c:1002: p->state|= XkbKeysymToModifiers(dpy,p->modifiers[i]); XKBBind.c:189:XkbKeysymToModifiers(Display *dpy, KeySym ks) XKBBind.c:492: p->state |= XkbKeysymToModifiers(dpy, p->modifiers[i]); XKBlib.h:368:extern unsigned int XkbKeysymToModifiers( #### XkbLatchGroup #### XKB.c:321:XkbLatchGroup(Display *dpy, unsigned int deviceSpec, unsigned int group) XKBlib.h:599:extern Bool XkbLatchGroup( #### XkbLatchModifiers #### XKB.c:260:XkbLatchModifiers(Display *dpy, XKBlib.h:586:extern Bool XkbLatchModifiers( #### XkbLibraryVersion #### XKB.c:62:XkbLibraryVersion(int *libMajorRtrn, int *libMinorRtrn) XKB.c:735: if (!XkbLibraryVersion(major_rtrn, minor_rtrn)) { XKBlib.h:324:extern Bool XkbLibraryVersion( #### XkbListComponents #### XKBList.c:97:XkbListComponents(Display *dpy, XKBlib.h:970:extern XkbComponentListPtr XkbListComponents( #### XkbLockGroup #### XKB.c:293:XkbLockGroup(Display *dpy, unsigned int deviceSpec, unsigned int group) XKBlib.h:593:extern Bool XkbLockGroup( #### XkbLockModifiers #### XKB.c:229:XkbLockModifiers(Display *dpy, XKBlib.h:579:extern Bool XkbLockModifiers( #### XkbLookupKeyBinding #### XKBBind.c:618: n = XkbLookupKeyBinding(dpy, *sym_rtrn, mods, buffer, nbytes, extra_rtrn); XKBBind.c:730: rtrnLen = XkbLookupKeyBinding(dpy, *keysym, new_mods, buffer, nbytes, NULL); XKBBind.c:739:XkbLookupKeyBinding(Display *dpy, XKBlib.h:381:extern int XkbLookupKeyBinding( #### XkbLookupKeySym #### XKBBind.c:247: return XkbLookupKeySym(dpy, key, mods, mods_rtrn, keysym_rtrn); XKBBind.c:251:XkbLookupKeySym(register Display *dpy, XKBBind.c:685: if (!XkbLookupKeySym(dpy, event->keycode, event->state, &new_mods, keysym)) XKBBind.c:698: if (XkbLookupKeySym(dpy, tmp_ev.keycode, tmp_ev.state, XKBBind.c:712: if (XkbLookupKeySym(dpy, tmp_ev.keycode, tmp_ev.state, XKBlib.h:373:extern Bool XkbLookupKeySym( #### XkbNoteControlsChanges #### XKBCtrls.c:342:XkbNoteControlsChanges(XkbControlsChangesPtr old, XKBlib.h:793:extern void XkbNoteControlsChanges( #### XkbNoteDeviceChanges #### XKBExtDev.c:40:XkbNoteDeviceChanges(XkbDeviceChangesPtr old, XKBlib.h:1047:extern void XkbNoteDeviceChanges( #### XkbNoteMapChanges #### XKBBind.c:373: XkbNoteMapChanges(&changes, event, XKB_XLIB_MAP_MASK); XKBUse.c:39:XkbNoteMapChanges(XkbMapChangesPtr old, XKBUse.c:293: XkbNoteMapChanges(&xkbi->changes, mev, XKB_XLIB_MAP_MASK); XKBlib.h:490:extern void XkbNoteMapChanges( #### XkbNoteNameChanges #### XKBNames.c:775:XkbNoteNameChanges(XkbNameChangesPtr old, XKBlib.h:496:extern void XkbNoteNameChanges( #### XkbOpenDisplay #### XKB.c:724:XkbOpenDisplay(char *name, XKBlib.h:274: /* XkbOpenDisplay error codes */ XKBlib.h:300:extern Display *XkbOpenDisplay( #### XkbQueryExtension #### XKB.c:39:XkbQueryExtension(Display *dpy, XKB.c:753: if (!XkbQueryExtension(dpy, NULL, ev_rtrn, err_rtrn, XKBlib.h:309:extern Bool XkbQueryExtension( #### XkbRefreshKeyboardMapping #### XKBBind.c:348:XkbRefreshKeyboardMapping(register XkbMapNotifyEvent * event) XKBBind.c:406: return XkbRefreshKeyboardMapping(&xkbevent->map); XKBlib.h:711:extern Status XkbRefreshKeyboardMapping( #### XkbResizeDeviceButtonActions #### XKBAlloc.c:383:XkbResizeDeviceButtonActions(XkbDeviceInfoPtr devi, unsigned newTotal) XKBExtDev.c:186: tmp = XkbResizeDeviceButtonActions(devi, rep->totalBtns); XKBlib.h:1030:extern Status XkbResizeDeviceButtonActions( #### XkbResizeKeyActions #### XKBGetMap.c:289: newActs = XkbResizeKeyActions(info, i + rep->firstKeyAct, XKBMAlloc.c:876:XkbResizeKeyActions(XkbDescPtr xkb, int key, int needed) XKBMisc.c:486: pActs = XkbResizeKeyActions(xkb, key, nSyms); XKBMisc.c:758: pActs = XkbResizeKeyActions(xkb, key, width * nGroups); XKBlib.h:946:extern XkbAction *XkbResizeKeyActions( #### XkbResizeKeySyms #### XKBGetMap.c:231: newSyms = XkbResizeKeySyms(xkb, i + rep->firstKeySym, tmp); XKBMAlloc.c:563:XkbResizeKeySyms(XkbDescPtr xkb, int key, int needed) XKBMisc.c:696: XkbResizeKeySyms(xkb, key, 0); XKBMisc.c:724: pSyms = XkbResizeKeySyms(xkb, key, width * nGroups); XKBMisc.c:739: pSyms = XkbResizeKeySyms(xkb, key, width * nGroups); XKBlib.h:940:extern KeySym *XkbResizeKeySyms( #### XkbResizeKeyType #### XKBMAlloc.c:297: XkbResizeKeyType(xkb, i, map_count, want_preserve, XKBMAlloc.c:324: status = XkbResizeKeyType(xkb, i, map_count, want_preserve, XKBMAlloc.c:360:XkbResizeKeyType(XkbDescPtr xkb, XKBlib.h:932:extern Status XkbResizeKeyType( #### XkbSelectEventDetails #### XKBBind.c:531: XkbSelectEventDetails(dpy, xkbi->desc->device_spec, XKBBind.c:536: XkbSelectEventDetails(dpy, xkbi->desc->device_spec, XkbMapNotify, XKBBind.c:579: XkbSelectEventDetails(dpy, xkbi->desc->device_spec, XkbMapNotify, XKB.c:137:XkbSelectEventDetails(Display *dpy, XKBlib.h:482:extern Bool XkbSelectEventDetails( #### XkbSelectEvents #### XKB.c:84:XkbSelectEvents(Display *dpy, XKBlib.h:475:extern Bool XkbSelectEvents( #### XkbSetAtomFuncs #### XKB.c:770:XkbSetAtomFuncs(XkbInternAtomFunc getAtom, XkbGetAtomNameFunc getName) XKBlib.h:352:extern void XkbSetAtomFuncs( #### XkbSetAutoRepeatRate #### XKBCtrls.c:51:XkbSetAutoRepeatRate(Display *dpy, XKBlib.h:407:extern Bool XkbSetAutoRepeatRate( #### XkbSetAutoResetControls #### XKB.c:586:XkbSetAutoResetControls(Display *dpy, XKBlib.h:897:extern Bool XkbSetAutoResetControls( #### XkbSetCompatMap #### XKBCompat.c:214:XkbSetCompatMap(Display *dpy, unsigned which, XkbDescPtr xkb, XKBlib.h:820:extern Bool XkbSetCompatMap( #### XkbSetControls #### XKBCtrls.c:270:XkbSetControls(Display *dpy, unsigned long which, XkbDescPtr xkb) XKBlib.h:787:extern Bool XkbSetControls( XKBlib.h:800:#define XkbChangeControls(d,x,c) XkbSetControls(d,(c)->changed_ctrls,x) #### XkbSetDebuggingFlags #### XKB.c:384:XkbSetDebuggingFlags(Display *dpy, XKBlib.h:1118:extern Bool XkbSetDebuggingFlags( #### XkbSetDetectableAutoRepeat #### XKB.c:521:XkbSetDetectableAutoRepeat(Display *dpy, Bool detectable, Bool *supported) XKBlib.h:886:extern Bool XkbSetDetectableAutoRepeat( #### XkbSetDeviceButtonActions #### XKBExtDev.c:791:XkbSetDeviceButtonActions(Display *dpy, XKBlib.h:1103:extern Bool XkbSetDeviceButtonActions( #### XkbSetDeviceInfo #### XKBExtDev.c:554:_XkbSetDeviceInfoSize(XkbDeviceInfoPtr devi, XKBExtDev.c:676:XkbSetDeviceInfo(Display *dpy, unsigned which, XkbDeviceInfoPtr devi) XKBExtDev.c:702: if (_XkbSetDeviceInfoSize(devi, &changes, &lstuff, &size, &nLeds) != XKBExtDev.c:753: if (_XkbSetDeviceInfoSize(devi, changes, &lstuff, &size, &nLeds) != Success) XKBExtDev.c:820: if (_XkbSetDeviceInfoSize(devi, &changes, NULL, &size, &nLeds) != Success) XKBlib.h:1083:extern Bool XkbSetDeviceInfo( #### XkbSetDeviceLedInfo #### XKBExtDev.c:781:XkbSetDeviceLedInfo(Display *dpy, XKBlib.h:1095:extern Bool XkbSetDeviceLedInfo( #### XkbSetGeometry #### XKBSetGeom.c:448:XkbSetGeometry(Display *dpy, unsigned deviceSpec, XkbGeometryPtr geom) #### XkbSetIgnoreLockMods #### XKBCtrls.c:129:XkbSetIgnoreLockMods(Display *dpy, XKBlib.h:614:extern Bool XkbSetIgnoreLockMods( #### XkbSetIndicatorMap #### XKBleds.c:155:XkbSetIndicatorMap(Display *dpy, unsigned long which, XkbDescPtr xkb) XKBlib.h:522:extern Bool XkbSetIndicatorMap( XKBlib.h:535: (XkbSetIndicatorMap((d),(c)->map_changes,x)) #### XkbSetMap #### XKBSetMap.c:469:XkbSetMap(Display *dpy, unsigned which, XkbDescPtr xkb) XKBSetMap.c:500: req->flags = XkbSetMapAllFlags; XKBSetMap.c:576: req->flags = XkbSetMapRecomputeActions; XKBlib.h:874:extern Bool XkbSetMap( #### XkbSetNamedDeviceIndicator #### XKBleds.c:269:XkbSetNamedDeviceIndicator(Display *dpy, XKBleds.c:334: return XkbSetNamedDeviceIndicator(dpy, XkbUseCoreKbd, XKBlib.h:567:extern Bool XkbSetNamedDeviceIndicator( #### XkbSetNamedIndicator #### XKBleds.c:327:XkbSetNamedIndicator(Display *dpy, XKBlib.h:558:extern Bool XkbSetNamedIndicator( #### XkbSetNames #### XKBNames.c:321:XkbSetNames(Display *dpy, XKBlib.h:847:extern Bool XkbSetNames( #### XkbSetPerClientControls #### XKB.c:657:XkbSetPerClientControls(Display *dpy, unsigned change, unsigned *values) XKBlib.h:910:extern Bool XkbSetPerClientControls( #### XkbSetServerInternalMods #### XKBCtrls.c:104:XkbSetServerInternalMods(Display *dpy, XKBlib.h:605:extern Bool XkbSetServerInternalMods( #### XkbSetXlibControls #### imConv.c:146: XkbSetXlibControls (event->display, imConv.c:149: XkbSetXlibControls (event->display, XKB.c:351:XkbSetXlibControls(Display *dpy, unsigned affect, unsigned values) XKBlib.h:329:extern unsigned int XkbSetXlibControls( #### XkbToControl #### XKBBind.c:659: buffer[0] = XkbToControl(buffer[0]); XKBBind.c:769:XkbToControl(char ch) XKBlib.h:1112:extern char XkbToControl( #### XkbTranslateKey #### XKBBind.c:229: * Not a public entry point -- XkbTranslateKey is an obsolete name XKBBind.c:234:XkbTranslateKey(register Display *dpy, XKBBind.c:241:XkbTranslateKey(register Display *dpy, XKBBind.c:260: return XkbTranslateKeyCode(dpy->xkb_info->desc, key, mods, mods_rtrn, XKBBind.c:265:XkbTranslateKeyCode(register XkbDescPtr xkb, XKBBind.c:333: * is XkbTranslateKeyCode that is causing the problem. The XKBBind.c:590:XkbTranslateKeySym(register Display *dpy, XKBBind.c:734: return XkbTranslateKeySym(dpy, keysym, new_mods, buffer, nbytes, NULL); XKBlib.h:390:extern Bool XkbTranslateKeyCode( XKBlib.h:398:extern int XkbTranslateKeySym( #### XkbTranslateKeyCode #### XKBBind.c:260: return XkbTranslateKeyCode(dpy->xkb_info->desc, key, mods, mods_rtrn, XKBBind.c:265:XkbTranslateKeyCode(register XkbDescPtr xkb, XKBBind.c:333: * is XkbTranslateKeyCode that is causing the problem. The XKBlib.h:390:extern Bool XkbTranslateKeyCode( #### XkbTranslateKeySym #### XKBBind.c:590:XkbTranslateKeySym(register Display *dpy, XKBBind.c:734: return XkbTranslateKeySym(dpy, keysym, new_mods, buffer, nbytes, NULL); XKBlib.h:398:extern int XkbTranslateKeySym( #### XkbUpdateActionVirtualMods #### XKBMisc.c:826:XkbUpdateActionVirtualMods(XkbDescPtr xkb, XkbAction *act, unsigned changed) XKBMisc.c:996: XkbUpdateActionVirtualMods(xkb, pAct, changed)) { XKBlib.h:1135:extern Bool XkbUpdateActionVirtualMods( #### XkbUpdateKeyTypeVirtualMods #### XKBMisc.c:854:XkbUpdateKeyTypeVirtualMods(XkbDescPtr xkb, XKBMisc.c:918: XkbUpdateKeyTypeVirtualMods(xkb, &xkb->map->types[i], changed, XKBlib.h:1141:extern void XkbUpdateKeyTypeVirtualMods( #### XkbUpdateMapFromCore #### XKBMisc.c:589:XkbUpdateMapFromCore(XkbDescPtr xkb, XKBlib.h:1013:extern Bool XkbUpdateMapFromCore( /* False only on error */ #### XkbUseExtension #### OpenDis.c:802: XkbUseExtension(dpy,NULL,NULL); XKBBell.c:49: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBBell.c:84: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBBell.c:121: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBBell.c:149: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) { XKBBell.c:161: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) { XKBBell.c:173: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) { XKBBind.c:513: if (!XkbUseExtension(dpy, NULL, NULL)) XKB.c:46: if (!XkbUseExtension(dpy, majorReturn, minorReturn)) XKB.c:93: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKB.c:154: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKB.c:238: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKB.c:269: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKB.c:299: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKB.c:327: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKB.c:354: XkbUseExtension(dpy, NULL, NULL); XKB.c:367: XkbUseExtension(dpy, NULL, NULL); XKB.c:398: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKB.c:488: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKB.c:528: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKB.c:562: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKB.c:596: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKB.c:631: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKB.c:665: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || XKB.c:698: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || XKBCompat.c:119: (!dpy->xkb_info && (!XkbUseExtension(dpy, NULL, NULL)))) XKBCompat.c:222: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBCtrls.c:59: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBCtrls.c:82: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBCtrls.c:114: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBCtrls.c:139: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBCtrls.c:162: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBCtrls.c:183: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBCtrls.c:276: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBExtDev.c:245: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBExtDev.c:291: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBExtDev.c:355: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBExtDev.c:396: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBExtDev.c:686: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBExtDev.c:742: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBExtDev.c:804: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBGeom.c:678: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBGeom.c:706: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBGetByName.c:55: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBGetMap.c:574: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBGetMap.c:623: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBGetMap.c:647: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBGetMap.c:672: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBGetMap.c:698: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBGetMap.c:723: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBGetMap.c:747: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBGetMap.c:784: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBGetMap.c:818: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBGetMap.c:851: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBleds.c:44: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBleds.c:123: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBleds.c:164: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBleds.c:215: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBleds.c:283: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBList.c:112: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || XKBNames.c:247: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBNames.c:337: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBNames.c:545: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBSetGeom.c:454: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBSetMap.c:477: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || (!xkb)) XKBSetMap.c:549: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || XKBUse.c:216: (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) XKBUse.c:619:XkbUseExtension(Display *dpy, int *major_rtrn, int *minor_rtrn) XKBUse.c:795: "Internal Error! XkbUseExtension succeeded with forceIgnore set\n"); XKBlib.h:318:extern Bool XkbUseExtension( #### XkbVirtualModsToReal #### XKB.c:447: if (!XkbVirtualModsToReal(xkb, type->mods.vmods, &tmp)) XKB.c:455: if (!XkbVirtualModsToReal(xkb, entry->mods.vmods, &tmp)) XKBMisc.c:408: XkbVirtualModsToReal(xkb, tmp, &tmp); XKBMisc.c:416: XkbVirtualModsToReal(xkb, tmp, &tmp); XKBMisc.c:802:XkbVirtualModsToReal(XkbDescPtr xkb, unsigned virtual_mask, unsigned *mask_rtrn) XKBMisc.c:835: XkbVirtualModsToReal(xkb, tmp, &tmp); XKBMisc.c:843: XkbVirtualModsToReal(xkb, tmp, &tmp); XKBMisc.c:862: XkbVirtualModsToReal(xkb, type->mods.vmods, &mask); XKBMisc.c:869: XkbVirtualModsToReal(xkb, entry->mods.vmods, &mask); XKBMisc.c:924: XkbVirtualModsToReal(xkb, xkb->ctrls->internal.vmods, &newMask); XKBMisc.c:937: XkbVirtualModsToReal(xkb, xkb->ctrls->ignore_lock.vmods, &newMask); XKBMisc.c:955: XkbVirtualModsToReal(xkb, map->mods.vmods, &newMask); XKBMisc.c:974: XkbVirtualModsToReal(xkb, compat->groups[i].vmods, &newMask); XKBlib.h:624:extern Bool XkbVirtualModsToReal( #### XkbXlibControlsImplemented #### XKB.c:374:XkbXlibControlsImplemented(void) XKBlib.h:339:extern unsigned int XkbXlibControlsImplemented(void); #### XmbDrawImageString #### mbWrap.c:109:XmbDrawImageString( Xlcint.h:482:typedef void (*XmbDrawImageStringProc)( Xlcint.h:552: XmbDrawImageStringProc mb_draw_image_string; Xlcint.h:568: XmbDrawImageStringProc utf8_draw_image_string; Xlib.h:3815:extern void XmbDrawImageString( #### XmbDrawString #### mbWrap.c:93:XmbDrawString( Xlcint.h:471:typedef int (*XmbDrawStringProc)( Xlcint.h:551: XmbDrawStringProc mb_draw_string; Xlcint.h:567: XmbDrawStringProc utf8_draw_string; Xlib.h:3782:extern void XmbDrawString( #### XmbDrawText #### mbWrap.c:60:XmbDrawText( Xlib.h:3752:extern void XmbDrawText( #### XmbLookupString #### ICWrap.c:400:XmbLookupString(XIC ic, XKeyEvent *ev, char *buffer, int nbytes, Xlib.h:3920:extern int XmbLookupString( #### XmbResetIC #### ICWrap.c:372:XmbResetIC(XIC ic) Xlib.h:3895:extern char *XmbResetIC( #### XmbSetWMProperties #### mbWMProps.c:38:XmbSetWMProperties ( Xutil.h:678:extern void XmbSetWMProperties( #### XmbTextEscapement #### mbWrap.c:124:XmbTextEscapement( Xlcint.h:445:typedef int (*XmbTextEscapementProc)( Xlcint.h:548: XmbTextEscapementProc mb_escapement; Xlcint.h:564: XmbTextEscapementProc utf8_escapement; Xlib.h:3674:extern int XmbTextEscapement( #### XmbTextExtents #### mbWrap.c:133:XmbTextExtents( Xlcint.h:451:typedef int (*XmbTextExtentsProc)( Xlcint.h:549: XmbTextExtentsProc mb_extents; Xlcint.h:565: XmbTextExtentsProc utf8_extents; Xlib.h:3692:extern int XmbTextExtents( #### XmbTextListToTextProperty #### lcPublic.c:55: _XmbTextListToTextProperty, lcTxtPr.c:218:_XmbTextListToTextProperty( lcWrap.c:425:XmbTextListToTextProperty( mbWMProps.c:54: XmbTextListToTextProperty(dpy, (char**)&windowName, 1, mbWMProps.c:58: XmbTextListToTextProperty(dpy, (char**)&iconName, 1, Xlcint.h:286:typedef int (*XmbTextListToTextPropertyProc)( Xlcint.h:322: XmbTextListToTextPropertyProc mb_text_list_to_prop; Xlcint.h:324: XmbTextListToTextPropertyProc utf8_text_list_to_prop; XlcPubI.h:165:extern int _XmbTextListToTextProperty( Xutil.h:746:extern int XmbTextListToTextProperty( #### XmbTextPerCharExtents #### mbWrap.c:146:XmbTextPerCharExtents( Xlcint.h:459:typedef Status (*XmbTextPerCharExtentsProc)( Xlcint.h:550: XmbTextPerCharExtentsProc mb_extents_per_char; Xlcint.h:566: XmbTextPerCharExtentsProc utf8_extents_per_char; Xlib.h:3716:extern Status XmbTextPerCharExtents( #### XmbTextPropertyToTextList #### lcPrTxt.c:245:_XmbTextPropertyToTextList( lcPublic.c:52: _XmbTextPropertyToTextList, lcWrap.c:377:XmbTextPropertyToTextList( Xlcint.h:270:typedef int (*XmbTextPropertyToTextListProc)( Xlcint.h:319: XmbTextPropertyToTextListProc mb_text_prop_to_list; Xlcint.h:321: XmbTextPropertyToTextListProc utf8_text_prop_to_list; XlcPubI.h:141:extern int _XmbTextPropertyToTextList( Xutil.h:780:extern int XmbTextPropertyToTextList( #### Xpermalloc #### Quarks.c:138:static char *_Xpermalloc(unsigned int length); Quarks.c:140:char *Xpermalloc(unsigned int length) Quarks.c:145: p = _Xpermalloc(length); Quarks.c:149:#define Xpermalloc _Xpermalloc Quarks.c:153:char *Xpermalloc(unsigned int length) Quarks.c:200: stringTable[0] = (XrmString *)Xpermalloc(QUANTSIZE); Quarks.c:304: new = Xpermalloc(QUANTSIZE); Xresource.h:75:extern char *Xpermalloc( #### XrmCombineDatabase #### Xrm.c:759:void XrmCombineDatabase( Xrm.c:812: XrmCombineDatabase(from, into, True); Xrm.c:1708: XrmCombineDatabase(db, target, False); Xresource.h:291:extern void XrmCombineDatabase( #### XrmCombineFileDatabase #### Xrm.c:1687:XrmCombineFileDatabase( Xresource.h:271:extern Status XrmCombineFileDatabase( #### XrmDestroyDatabase #### ErrDes.c:183: XrmDestroyDatabase(temp_db); OpenDis.c:891: XrmDestroyDatabase(dpy->db); Xrm.c:354: XrmDestroyDatabase(display->db); Xrm.c:2647:void XrmDestroyDatabase( Xresource.h:179:extern void XrmDestroyDatabase( #### XrmEnumerateDatabase #### KeysymStr.c:116: (void)XrmEnumerateDatabase(keysymdb, &empty, &empty, XrmEnumAllLevels, Xrm.c:1959:Bool XrmEnumerateDatabase( Xrm.c:2096: if (XrmEnumerateDatabase(db, &empty, &empty, XrmEnumAllLevels, Xresource.h:300:extern Bool XrmEnumerateDatabase( #### XrmGetDatabase #### Xrm.c:337:XrmDatabase XrmGetDatabase( Xresource.h:261:extern XrmDatabase XrmGetDatabase( #### XrmGetFileDatabase #### ErrDes.c:172: temp_db = XrmGetFileDatabase(dbname); GetDflt.c:146: xdb = XrmGetFileDatabase (fname); GetDflt.c:161: userdb = XrmGetFileDatabase (xenv); GetDflt.c:166: if (fname[0] != '\0') userdb = XrmGetFileDatabase(fname); StrKeysym.c:65: keysymdb = XrmGetFileDatabase(dbname); Xrm.c:1669:XrmGetFileDatabase( Xresource.h:267:extern XrmDatabase XrmGetFileDatabase( #### XrmGetResource #### ErrDes.c:195: XrmGetResource(db, tptr, "ErrorType.ErrorNumber", imRm.c:124: if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { imRm.c:139: if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { imRm.c:154: if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { imRm.c:174: if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { imRm.c:197: if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { Xrm.c:2581:XrmGetResource(XrmDatabase db, _Xconst char *name_str, _Xconst char *class_str, Xresource.h:224:extern Bool XrmGetResource( #### XrmGetStringDatabase #### GetDflt.c:148: xdb = XrmGetStringDatabase(dpy->xdefaults); GetDflt.c:167: xdb = XrmGetStringDatabase(dpy->xdefaults); Xrm.c:1554:XrmGetStringDatabase( Xresource.h:277:extern XrmDatabase XrmGetStringDatabase( #### XrmInitialize #### ErrDes.c:164: XrmInitialize(); GetDflt.c:131: XrmInitialize(); StrKeysym.c:59: XrmInitialize(); Xrm.c:331:void XrmInitialize(void) Xlib.h:1488:extern void XrmInitialize( #### XrmLocaleOfDatabase #### Xrm.c:2637:XrmLocaleOfDatabase( Xresource.h:316:extern const char *XrmLocaleOfDatabase( #### XrmMergeDatabases #### GetDflt.c:162: XrmMergeDatabases (userdb, &xdb); GetDflt.c:168: XrmMergeDatabases(userdb, &xdb); Xrm.c:809:void XrmMergeDatabases( Xresource.h:286:extern void XrmMergeDatabases( #### XrmParseCommand #### ParseCmd.c:49:/* XrmParseCommand() ParseCmd.c:74:XrmParseCommand( Xresource.h:347:extern void XrmParseCommand( #### XrmPermStringToQuark #### KeysymStr.c:114: data.type = XrmPermStringToQuark("String"); lcWrap.c:583: resources->xrm_name = XrmPermStringToQuark(resources->name); lcWrap.c:602: xrm_name = XrmPermStringToQuark(args->name); lcWrap.c:634: xrm_name = XrmPermStringToQuark(args->name); Quarks.c:362:XrmPermStringToQuark( Xrm.c:333: XrmQString = XrmPermStringToQuark("String"); Xrm.c:334: XrmQANY = XrmPermStringToQuark("?"); Xresource.h:96:extern XrmQuark XrmPermStringToQuark( #### XrmPutFileDatabase #### Xrm.c:2087:XrmPutFileDatabase( Xresource.h:281:extern void XrmPutFileDatabase( #### XrmPutLineResource #### ParseCmd.c:182: XrmPutLineResource(pdb, *argv); Xrm.c:1543:XrmPutLineResource( Xresource.h:211:extern void XrmPutLineResource( #### XrmPutResource #### Xrm.c:1023:XrmPutResource( Xresource.h:191:extern void XrmPutResource( #### XrmPutStringResource #### Xrm.c:1523:XrmPutStringResource( Xresource.h:205:extern void XrmPutStringResource( #### XrmQGetResource #### GetDflt.c:231: (void)XrmQGetResource(dpy->db, names, classes, &fromType, &result); StrKeysym.c:123: (void)XrmQGetResource(keysymdb, names, Qkeysym, &from_type, &result); Xrm.c:2538:Bool XrmQGetResource( Xrm.c:2591: result = XrmQGetResource(db, names, classes, &fromType, pValue); Xresource.h:216:extern Bool XrmQGetResource( #### XrmQGetSearchList #### Xrm.c:2255:Bool XrmQGetSearchList( Xresource.h:232:extern Bool XrmQGetSearchList( #### XrmQGetSearchResource #### Xrm.c:2300:Bool XrmQGetSearchResource( Xresource.h:240:extern Bool XrmQGetSearchResource( #### XrmQPutResource #### Xrm.c:1009:void XrmQPutResource( Xresource.h:183:extern void XrmQPutResource( #### XrmQPutStringResource #### ParseCmd.c:98: XrmQPutStringResource(pdb, bindings, quarks, value_str); \ Xrm.c:1040:XrmQPutStringResource( Xresource.h:198:extern void XrmQPutStringResource( #### XrmQuarkToString #### KeysymStr.c:65: gd->name = XrmQuarkToString(*quarks); /* XXX */ Quarks.c:390:XrmString XrmQuarkToString(register XrmQuark quark) Xrm.c:450: (void) fputs(XrmQuarkToString(*quarks), stream); Xrm.c:2009: (void) fputs(XrmQuarkToString(*quarks), stream); Xrm.c:2592: (*pType_str) = XrmQuarkToString(fromType); Xresource.h:101:extern XrmString XrmQuarkToString( Xresource.h:139:#define XrmNameToString(name) XrmQuarkToString(name) Xresource.h:145:#define XrmClassToString(c_class) XrmQuarkToString(c_class) Xresource.h:159:#define XrmRepresentationToString(type) XrmQuarkToString(type) #### XrmSetDatabase #### Xrm.c:347:void XrmSetDatabase( Xresource.h:256:extern void XrmSetDatabase( #### XrmStringToBindingQuarkList #### ParseCmd.c:96: XrmStringToBindingQuarkList( \ Xrm.c:395:XrmStringToBindingQuarkList( Xrm.c:1034: XrmStringToBindingQuarkList(specifier, bindings, quarks); Xrm.c:1533: XrmStringToBindingQuarkList(specifier, bindings, quarks); Xresource.h:125:extern void XrmStringToBindingQuarkList( #### XrmStringToQuark #### imDefIc.c:463: quark = XrmStringToQuark(p->name); imDefIc.c:522: pre_quark = XrmStringToQuark(XNPreeditAttributes); imDefIc.c:523: sts_quark = XrmStringToQuark(XNStatusAttributes); imDefIc.c:524: separator = XrmStringToQuark(XNSeparatorofNestedList); imDefIc.c:529: quark = XrmStringToQuark(p->name); imDefIc.c:550: *q_list = XrmStringToQuark(pp->name); imDefIc.c:599: *quark_list = XrmStringToQuark(p->name); imDefIc.c:605: *quark_list = XrmStringToQuark(pp->name); imDefIm.c:1172: quark = XrmStringToQuark(p->name); imDefIm.c:1200: *quark_list = XrmStringToQuark(p->name); imRmAttr.c:149: pre_quark = XrmStringToQuark(XNPreeditAttributes); imRmAttr.c:150: sts_quark = XrmStringToQuark(XNStatusAttributes); imRmAttr.c:516: pre_quark = XrmStringToQuark(XNPreeditAttributes); imRmAttr.c:517: sts_quark = XrmStringToQuark(XNStatusAttributes); imRmAttr.c:931: if (res->xrm_name == XrmStringToQuark(XNClientWindow)) { imRmAttr.c:937: } else if (res->xrm_name == XrmStringToQuark(XNFocusWindow)) { imRmAttr.c:954: if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { imRmAttr.c:964: } else if (res->xrm_name == XrmStringToQuark(XNFontSet)) { imRmAttr.c:1005: if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { imRmAttr.c:1015: } else if (res->xrm_name == XrmStringToQuark(XNFontSet)) { imRmAttr.c:1098: pre_quark = XrmStringToQuark(XNPreeditAttributes); imRmAttr.c:1099: sts_quark = XrmStringToQuark(XNStatusAttributes); imRmAttr.c:1198: if (res->xrm_name == XrmStringToQuark(XNFontSet)) { imRmAttr.c:1240: if (res->xrm_name == XrmStringToQuark(XNFontSet)) { imRmAttr.c:1299: pre_quark = XrmStringToQuark(XNPreeditAttributes); imRmAttr.c:1300: sts_quark = XrmStringToQuark(XNStatusAttributes); imRmAttr.c:1301: separator = XrmStringToQuark(XNSeparatorofNestedList); imRm.c:2250: XrmQuark quark = XrmStringToQuark(name); imRm.c:2670: pre_quark = XrmStringToQuark(XNPreeditAttributes); imRm.c:2671: sts_quark = XrmStringToQuark(XNStatusAttributes); imRm.c:2784: if (res->xrm_name == XrmStringToQuark(XNClientWindow)) { imRm.c:2793: } else if (res->xrm_name == XrmStringToQuark(XNFocusWindow)) { imRm.c:2819: if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { imRm.c:2841: if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { imRm.c:2872: pre_quark = XrmStringToQuark(XNPreeditAttributes); imRm.c:2873: sts_quark = XrmStringToQuark(XNStatusAttributes); imRm.c:2945: XrmQuark quark = XrmStringToQuark(XNInputStyle); imRm.c:2950: if(quark == XrmStringToQuark(p->name)) { imRm.c:3033: pre_quark = XrmStringToQuark(XNPreeditAttributes); imRm.c:3034: sts_quark = XrmStringToQuark(XNStatusAttributes); imRm.c:3151: im_attr_info[i].quark = XrmStringToQuark(GET_NAME(im_attr_info[i])); imRm.c:3163: ic_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_attr_info[i])); imRm.c:3168: ic_pre_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_pre_attr_info[i])); imRm.c:3173: ic_sts_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_sts_attr_info[i])); imRm.c:3184: im_mode_quark[i] = XrmStringToQuark(GET_NAME(im_mode[i])); imRm.c:3195: ic_mode_quark[i] = XrmStringToQuark(GET_NAME(ic_mode[i])); IMWrap.c:72: res->xrm_name = XrmStringToQuark(res->resource_name); lcCharSet.c:52: xrm_name = XrmStringToQuark(name); lcCharSet.c:73: xrm_encoding_name = XrmStringToQuark(encoding_name); lcCharSet.c:194: charset->xrm_name = XrmStringToQuark(charset->name); lcCharSet.c:208: charset->xrm_encoding_name = XrmStringToQuark(charset->encoding_name); lcConv.c:92: from_type = XrmStringToQuark(from); lcConv.c:93: to_type = XrmStringToQuark(to); lcConv.c:241: QCTCharSet = XrmStringToQuark(XlcNCTCharSet); lcConv.c:242: QCharSet = XrmStringToQuark(XlcNCharSet); lcConv.c:243: QChar = XrmStringToQuark(XlcNChar); lcConv.c:246: from_type = XrmStringToQuark(from); lcConv.c:247: to_type = XrmStringToQuark(to); lcConv.c:303: from_type = XrmStringToQuark(from); lcConv.c:304: to_type = XrmStringToQuark(to); lcDB.c:1218: category_q = XrmStringToQuark(category); lcDB.c:1219: name_q = XrmStringToQuark(name); lcDB.c:1290: name_q = XrmStringToQuark(name); lcDB.c:1292: name_q = XrmStringToQuark((char*)__XOS2RedirRoot(name)); lcDB.c:1312: lc_db[i].category_q = XrmStringToQuark(p->category); lcDB.c:1313: lc_db[i].name_q = XrmStringToQuark(p->name); lcGeneric.c:523: charsetd->xrm_encoding_name = XrmStringToQuark(tmp); lcUTF8.c:374: convptr->xrm_name = XrmStringToQuark(convptr->name); lcUTF8.c:941: xrm_name = XrmStringToQuark(name); Quarks.c:346:XrmStringToQuark( StrKeysym.c:67: Qkeysym[0] = XrmStringToQuark("Keysym"); Xrm.c:362:XrmStringToQuarkList( Xrm.c:1035: PutEntry(*pdb, bindings, quarks, XrmStringToQuark(type), value); Xresource.h:92:extern XrmQuark XrmStringToQuark( Xresource.h:120:extern void XrmStringToQuarkList( Xresource.h:140:#define XrmStringToName(string) XrmStringToQuark(string) Xresource.h:141:#define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name) Xresource.h:146:#define XrmStringToClass(c_class) XrmStringToQuark(c_class) Xresource.h:147:#define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class) Xresource.h:158:#define XrmStringToRepresentation(string) XrmStringToQuark(string) Xutil.h:361:#define XStringToContext(string) ((XContext) XrmStringToQuark(string)) #### XrmStringToQuarkList #### Xrm.c:362:XrmStringToQuarkList( Xresource.h:120:extern void XrmStringToQuarkList( Xresource.h:141:#define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name) Xresource.h:147:#define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class) #### XrmUniqueQuark #### Quarks.c:76:static XrmQuark nextUniq = -1; /* next quark from XrmUniqueQuark */ Quarks.c:377:XrmQuark XrmUniqueQuark(void) Xresource.h:105:extern XrmQuark XrmUniqueQuark( Xutil.h:360:#define XUniqueContext() ((XContext) XrmUniqueQuark()) #### Xutf8DrawImageString #### utf8Wrap.c:131:Xutf8DrawImageString( Xlib.h:3837:extern void Xutf8DrawImageString( #### Xutf8DrawString #### utf8Wrap.c:115:Xutf8DrawString( Xlib.h:3804:extern void Xutf8DrawString( #### Xutf8DrawText #### utf8Wrap.c:82:Xutf8DrawText( Xlib.h:3772:extern void Xutf8DrawText( #### Xutf8LookupString #### ICWrap.c:420:Xutf8LookupString(XIC ic, XKeyEvent *ev, char *buffer, int nbytes, Xlib.h:3938:extern int Xutf8LookupString( #### Xutf8ResetIC #### ICWrap.c:388:Xutf8ResetIC(XIC ic) Xlib.h:3899:extern char *Xutf8ResetIC( #### Xutf8SetWMProperties #### utf8WMProps.c:60:Xutf8SetWMProperties ( Xutil.h:690:extern void Xutf8SetWMProperties( #### Xutf8TextEscapement #### utf8Wrap.c:146:Xutf8TextEscapement( Xlib.h:3686:extern int Xutf8TextEscapement( #### Xutf8TextExtents #### utf8Wrap.c:155:Xutf8TextExtents( Xlib.h:3708:extern int Xutf8TextExtents( #### Xutf8TextListToTextProperty #### lcPublic.c:57: _Xutf8TextListToTextProperty, lcTxtPr.c:244:_Xutf8TextListToTextProperty( lcWrap.c:459:Xutf8TextListToTextProperty( utf8WMProps.c:76: Xutf8TextListToTextProperty(dpy, (char**)&windowName, 1, utf8WMProps.c:80: Xutf8TextListToTextProperty(dpy, (char**)&iconName, 1, XlcPubI.h:183:extern int _Xutf8TextListToTextProperty( Xutil.h:762:extern int Xutf8TextListToTextProperty( #### Xutf8TextPerCharExtents #### utf8Wrap.c:168:Xutf8TextPerCharExtents( Xlib.h:3740:extern Status Xutf8TextPerCharExtents( #### Xutf8TextPropertyToTextList #### lcPrTxt.c:269:_Xutf8TextPropertyToTextList( lcPublic.c:54: _Xutf8TextPropertyToTextList, lcWrap.c:409:Xutf8TextPropertyToTextList( XlcPubI.h:157:extern int _Xutf8TextPropertyToTextList( Xutil.h:794:extern int Xutf8TextPropertyToTextList( #### XwcDrawImageString #### wcWrap.c:109:XwcDrawImageString( Xlcint.h:530:typedef void (*XwcDrawImageStringProc)( Xlcint.h:560: XwcDrawImageStringProc wc_draw_image_string; Xlib.h:3826:extern void XwcDrawImageString( #### XwcDrawString #### wcWrap.c:94:XwcDrawString( Xlcint.h:519:typedef int (*XwcDrawStringProc)( Xlcint.h:559: XwcDrawStringProc wc_draw_string; Xlib.h:3793:extern void XwcDrawString( #### XwcDrawText #### wcWrap.c:61:XwcDrawText( Xlib.h:3762:extern void XwcDrawText( #### XwcFreeStringList #### lcPrTxt.c:281:_XwcFreeStringList( lcPublic.c:58: _XwcFreeStringList, lcWrap.c:476:XwcFreeStringList( Xlcint.h:304:typedef void (*XwcFreeStringListProc)( Xlcint.h:325: XwcFreeStringListProc wc_free_string_list; XlcPubI.h:192:extern void _XwcFreeStringList( Xutil.h:770:extern void XwcFreeStringList( #### XwcLookupString #### ICWrap.c:410:XwcLookupString(XIC ic, XKeyEvent *ev, wchar_t *buffer, int nchars, imThaiFlt.c:1312: XwcLookupString((XIC)ic, &ev->xkey, wbuf, sizeof(wbuf) / sizeof(wbuf[0]), Xlib.h:3929:extern int XwcLookupString( #### XwcResetIC #### ICWrap.c:380:XwcResetIC(XIC ic) Xlib.h:3891:extern wchar_t *XwcResetIC( #### XwcTextEscapement #### wcWrap.c:124:XwcTextEscapement( Xlcint.h:493:typedef int (*XwcTextEscapementProc)( Xlcint.h:556: XwcTextEscapementProc wc_escapement; Xlib.h:3680:extern int XwcTextEscapement( #### XwcTextExtents #### wcWrap.c:133:XwcTextExtents( Xlcint.h:499:typedef int (*XwcTextExtentsProc)( Xlcint.h:557: XwcTextExtentsProc wc_extents; Xlib.h:3700:extern int XwcTextExtents( #### XwcTextListToTextProperty #### lcPublic.c:56: _XwcTextListToTextProperty, lcTxtPr.c:231:_XwcTextListToTextProperty( lcWrap.c:442:XwcTextListToTextProperty( Xlcint.h:295:typedef int (*XwcTextListToTextPropertyProc)( Xlcint.h:323: XwcTextListToTextPropertyProc wc_text_list_to_prop; XlcPubI.h:174:extern int _XwcTextListToTextProperty( Xutil.h:754:extern int XwcTextListToTextProperty( #### XwcTextPerCharExtents #### wcWrap.c:146:XwcTextPerCharExtents( Xlcint.h:507:typedef Status (*XwcTextPerCharExtentsProc)( Xlcint.h:558: XwcTextPerCharExtentsProc wc_extents_per_char; Xlib.h:3728:extern Status XwcTextPerCharExtents( #### XwcTextPropertyToTextList #### lcPrTxt.c:257:_XwcTextPropertyToTextList( lcPublic.c:53: _XwcTextPropertyToTextList, lcWrap.c:393:XwcTextPropertyToTextList( Xlcint.h:278:typedef int (*XwcTextPropertyToTextListProc)( Xlcint.h:320: XwcTextPropertyToTextListProc wc_text_prop_to_list; XlcPubI.h:149:extern int _XwcTextPropertyToTextList( Xutil.h:787:extern int XwcTextPropertyToTextList( #### _Utf8GetConvByName #### imConv.c:87: XPointer cvt = _Utf8GetConvByName(encoding_name); imConv.c:92: return _Utf8GetConvByName(SubstTable[i].charset_name); lcUTF8.c:930:_Utf8GetConvByName( XlcPubI.h:293:_Utf8GetConvByName( #### _X11TransBytesReadable #### XlibInt.c:484: _X11TransBytesReadable(dpy->trans_conn, &pend); XlibInt.c:533: if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) XlibInt.c:1175: if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) XlibInt.c:1218: if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) XlibInt.c:1393: if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) #### _X11TransClose #### ConnDis.c:577: fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransClose(trans_conn).\n"); ConnDis.c:579: _X11TransClose(trans_conn); ConnDis.c:604: _X11TransClose(trans_conn); ConnDis.c:685: if (trans_conn) (void)_X11TransClose(trans_conn); ConnDis.c:774: _X11TransClose(trans_conn); #### _X11TransCloseForCloning #### #### _X11TransConnect #### ConnDis.c:174:_X11TransConnectDisplay ( ConnDis.c:215: fprintf(stderr, "_X11TransConnectDisplay: Called with display_name [%s].\n", display_name); ConnDis.c:238: fprintf(stderr, "_X11TransConnectDisplay: Forced protocol to [%s].\n", pprotocol); ConnDis.c:274: fprintf(stderr, "_X11TransConnectDisplay: Checking hostname [%s].\n", p); ConnDis.c:307: fprintf(stderr, "_X11TransConnectDisplay: Forced hostname [%s].\n", phostname); ConnDis.c:403: fprintf(stderr, "_X11TransConnectDisplay: Searching port in port [%s].\n", phostname); ConnDis.c:498: fprintf(stderr, "_X11TransConnectDisplay: Converted protocol to [%s].\n", pprotocol); ConnDis.c:560: fprintf(stderr, "_X11TransConnectDisplay: Entering connection loop.\n"); ConnDis.c:565: fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransOpenCOTSClient(address) with address [%s].\n", address); ConnDis.c:572: fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransConnect(trans_conn,address).\n"); ConnDis.c:574: if ((connect_stat = _X11TransConnect(trans_conn,address)) < 0 ) ConnDis.c:577: fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransClose(trans_conn).\n"); ConnDis.c:589: fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr).\n"); ConnDis.c:600: fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransConvertAddress(&family, &saddrlen, &saddr).\n"); ConnDis.c:618: fprintf(stderr, "_X11TransConnectDisplay: Out of connection loop.\n"); ConnDis.c:746: trans_conn = _X11TransConnectDisplay ( OpenDis.c:215: if ((dpy->trans_conn = _X11TransConnectDisplay ( Xintconn.h:26:extern XtransConnInfo _X11TransConnectDisplay(char *display_name, #### _X11TransConnectDisplay #### ConnDis.c:174:_X11TransConnectDisplay ( ConnDis.c:215: fprintf(stderr, "_X11TransConnectDisplay: Called with display_name [%s].\n", display_name); ConnDis.c:238: fprintf(stderr, "_X11TransConnectDisplay: Forced protocol to [%s].\n", pprotocol); ConnDis.c:274: fprintf(stderr, "_X11TransConnectDisplay: Checking hostname [%s].\n", p); ConnDis.c:307: fprintf(stderr, "_X11TransConnectDisplay: Forced hostname [%s].\n", phostname); ConnDis.c:403: fprintf(stderr, "_X11TransConnectDisplay: Searching port in port [%s].\n", phostname); ConnDis.c:498: fprintf(stderr, "_X11TransConnectDisplay: Converted protocol to [%s].\n", pprotocol); ConnDis.c:560: fprintf(stderr, "_X11TransConnectDisplay: Entering connection loop.\n"); ConnDis.c:565: fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransOpenCOTSClient(address) with address [%s].\n", address); ConnDis.c:572: fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransConnect(trans_conn,address).\n"); ConnDis.c:577: fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransClose(trans_conn).\n"); ConnDis.c:589: fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr).\n"); ConnDis.c:600: fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransConvertAddress(&family, &saddrlen, &saddr).\n"); ConnDis.c:618: fprintf(stderr, "_X11TransConnectDisplay: Out of connection loop.\n"); ConnDis.c:746: trans_conn = _X11TransConnectDisplay ( OpenDis.c:215: if ((dpy->trans_conn = _X11TransConnectDisplay ( Xintconn.h:26:extern XtransConnInfo _X11TransConnectDisplay(char *display_name, #### _X11TransConvertAddress #### ConnDis.c:600: fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransConvertAddress(&family, &saddrlen, &saddr).\n"); ConnDis.c:602: if( _X11TransConvertAddress(&family, &saddrlen, &saddr) < 0 ) #### _X11TransDisconnect #### ConnDis.c:773: _X11TransDisconnect(trans_conn); #### _X11TransFreeConnInfo #### ConnDis.c:753: _X11TransFreeConnInfo (trans_conn); #### _X11TransGetConnectionNumber #### ConnDis.c:752: int fd = _X11TransGetConnectionNumber (trans_conn); OpenDis.c:224: dpy->fd = _X11TransGetConnectionNumber (dpy->trans_conn); #### _X11TransGetHostname #### #### _X11TransGetMyAddr #### ConnDis.c:1328: _X11TransGetMyAddr(trans_conn, &family, &addrlen, &addr); #### _X11TransGetPeerAddr #### ConnDis.c:589: fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr).\n"); ConnDis.c:591: _X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr); #### _X11TransIsLocal #### #### _X11TransOpenCOTSClient #### ConnDis.c:536: * host, and port back together to pass to _X11TransOpenCOTSClient(). ConnDis.c:565: fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransOpenCOTSClient(address) with address [%s].\n", address); ConnDis.c:567: if ( (trans_conn = _X11TransOpenCOTSClient(address)) == NULL ) #### _X11TransRead #### XlibInt.c:1553: bytes_read = _X11TransRead(dpy->trans_conn, data, (int)size); XlibInt.c:1562: while ((bytes_read = _X11TransRead(dpy->trans_conn, data, (int)size)) XlibInt.c:1688: bytes_read = _X11TransReadv (dpy->trans_conn, iov, 2); XlibInt.c:1697: while ((bytes_read = _X11TransReadv (dpy->trans_conn, iov, 2)) != size) { #### _X11TransReadv #### XlibInt.c:1688: bytes_read = _X11TransReadv (dpy->trans_conn, iov, 2); XlibInt.c:1697: while ((bytes_read = _X11TransReadv (dpy->trans_conn, iov, 2)) != size) { #### _X11TransSetOption #### ConnDis.c:630: _X11TransSetOption(trans_conn,TRANS_CLOSEONEXEC,1); ConnDis.c:822: _X11TransSetOption(dpy->trans_conn, TRANS_NONBLOCKING, 1); #### _X11TransSocketINET6Funcs #### #### _X11TransSocketINETFuncs #### #### _X11TransSocketLocalFuncs #### #### _X11TransSocketProxyConnInfo #### OpenDis.c:72:extern void *_X11TransSocketProxyConnInfo(XtransConnInfo); OpenDis.c:407: if (_X11TransSocketProxyConnInfo(dpy->trans_conn) == NULL) { #### _X11TransSocketTCPFuncs #### #### _X11TransSocketUNIXFuncs #### #### _X11TransWrite #### ConnDis.c:816: len -= _X11TransWritev (dpy->trans_conn, iovarray, niov); XlibInt.c:1029: write_stat = _X11TransWrite(dpy->trans_conn, XlibInt.c:1873: if ((len = _X11TransWritev(dpy->trans_conn, iov, i)) >= 0) { #### _X11TransWritev #### ConnDis.c:816: len -= _X11TransWritev (dpy->trans_conn, iovarray, niov); XlibInt.c:1873: if ((len = _X11TransWritev(dpy->trans_conn, iov, i)) >= 0) { #### _XAllocID #### OpenDis.c:293: dpy->resource_alloc = _XAllocID; OpenDis.c:294: dpy->idlist_alloc = _XAllocIDs; XlibInt.c:1998: * _XAllocID - resource ID allocation routine. XlibInt.c:2000:XID _XAllocID( XlibInt.c:2024: * _XAllocIDs - multiple resource ID allocation routine. XlibInt.c:2026:void _XAllocIDs( Xlibint.h:1007:extern XID _XAllocID(Display *dpy); Xlibint.h:1008:extern void _XAllocIDs(Display *dpy, XID *ids, int count); #### _XAllocIDs #### OpenDis.c:294: dpy->idlist_alloc = _XAllocIDs; XlibInt.c:2024: * _XAllocIDs - multiple resource ID allocation routine. XlibInt.c:2026:void _XAllocIDs( Xlibint.h:1008:extern void _XAllocIDs(Display *dpy, XID *ids, int count); #### _XAllocScratch #### PutImage.c:677: if ((buf = _XAllocScratch(dpy, length)) == NULL) { PutImage.c:700: if (! (temp = _XAllocScratch(dpy, temp_length))) { PutImage.c:804: _XAllocScratch(dpy, length)) == NULL) { QuTextE16.c:54: if ((buf = _XAllocScratch (dpy, (unsigned long) nbytes))) { QuTextExt.c:54: if ((buf = _XAllocScratch (dpy, (unsigned long) nbytes))) { XlibInt.c:3762:char *_XAllocScratch( XlibInt.c:3786: buf = _XAllocScratch(dpy, nbytes); Xlibint.h:883:extern char *_XAllocScratch( #### _XAllocTemp #### Region.c:266: if ((xr = (XRectangle *) _XAllocTemp(dpy, total))) { XKBSetGeom.c:420: tbuf = _XAllocTemp(dpy, sz); XlibInt.c:3780:char *_XAllocTemp( Xlibint.h:887:extern char *_XAllocTemp( #### _XAsyncErrorHandler #### cmsCmap.c:164: async.handler = _XAsyncErrorHandler; Font.c:203: async.handler = _XAsyncErrorHandler; Font.c:424: async1.handler = _XAsyncErrorHandler; Font.c:446: async2.handler = _XAsyncErrorHandler; ReconfWM.c:83: async.handler = _XAsyncErrorHandler; XlibAsync.c:62:_XAsyncErrorHandler( Xlibint.h:912:extern Bool _XAsyncErrorHandler( #### _XCloseLC #### imInsClbk.c:260: _XCloseLC( icb->lcd ); IMWrap.c:138: _XCloseLC (lcd); lcRM.c:87: _XCloseLC(((UbState) state)->lcd); lcRM.c:179: _XCloseLC(((MbState) state)->lcd); lcWrap.c:322:_XCloseLC( lcWrap.c:357: _XCloseLC(last_lcd); OMWrap.c:62: _XCloseLC(lcd); Xlcint.h:763:extern void _XCloseLC( #### _XColor_to_XcmsRGB #### cmsAllNCol.c:132: _XColor_to_XcmsRGB(ccc, &XColor_in_out, pColor_scrn_return, 1); cmsAllNCol.c:183: _XColor_to_XcmsRGB(ccc, &exact_def, pColor_exact_return, 1); cmsAllNCol.c:184: _XColor_to_XcmsRGB(ccc, &hard_def, pColor_scrn_return, 1); cmsLkCol.c:171: _XColor_to_XcmsRGB(ccc, &def, pColor_exact_return, 1); cmsLkCol.c:172: _XColor_to_XcmsRGB(ccc, &scr, pColor_scrn_return, 1); SetGetCols.c:154: _XColor_to_XcmsRGB(ccc, &XColors_in_out, pColors_in_out, 1); SetGetCols.c:283: _XColor_to_XcmsRGB(ccc, pXColors_in_out, pColors_in_out, nColors); XRGB.c:107: * _XColor_to_XcmsRGB XRGB.c:112:_XColor_to_XcmsRGB( Cv.h:99:_XColor_to_XcmsRGB( #### _XConnectDisplay #### ConnDis.c:734:int _XConnectDisplay ( Xintconn.h:13:int _XConnectDisplay ( #### _XCopyEventCookie #### PeekEvent.c:54: if (_XCopyEventCookie(dpy, &event->xcookie, ©.xcookie)) { PeekIfEv.c:62: if (_XCopyEventCookie(dpy, &event->xcookie, ©.xcookie)) { PutBEvent.c:59: _XCopyEventCookie(dpy, &event->xcookie, ©.xcookie); XlibInt.c:2902:_XCopyEventCookie(Display *dpy, XGenericEventCookie *in, XGenericEventCookie *out) Xlibint.h:1352:extern Bool _XCopyEventCookie( #### _XCopyToArg #### imRmAttr.c:231: _XCopyToArg((XPointer)data, (XPointer *)&value, data_len); IMWrap.c:77:_XCopyToArg(XPointer src, XPointer *dst, unsigned int size) lcWrap.c:529: On Big Endian machines, this behaves differently than _XCopyToArg. */ Xlcint.h:785:extern void _XCopyToArg( #### _XCreateMutex_fn #### locking.c:605: _XCreateMutex_fn = _XCreateMutex; XlibInt.c:83:void (*_XCreateMutex_fn)(LockInfoPtr) = NULL; XlibInt.c:4193:void (**_XCreateMutex_fn_p)(LockInfoPtr) = &_XCreateMutex_fn; Xlibint.h:303:#define _XCreateMutex_fn (*_XCreateMutex_fn_p) Xlibint.h:311:extern void (*_XCreateMutex_fn)( Xlibint.h:346:#define _XCreateMutex(lock) if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock); #### (arch=amd64 ia64 alpha ppc64 arm64)_XData32 #### #### _XDefaultError #### ErrHndlr.c:47: oldhandler = _XDefaultError; ErrHndlr.c:53: _XErrorFunction = _XDefaultError; XlibInt.c:3615:int _XDefaultError( XlibInt.c:3677: return _XDefaultError(dpy, (XErrorEvent *)&event); Xlibint.h:1313:extern int _XDefaultError( #### _XDefaultIOError #### ErrHndlr.c:75: oldhandler = _XDefaultIOError; ErrHndlr.c:81: _XIOErrorFunction = _XDefaultIOError; XlibInt.c:3452: * _XDefaultIOError - Default fatal system error reporting routine. Called XlibInt.c:3455:int _XDefaultIOError( XlibInt.c:3481: fprintf(stderr, "_XDefaultIOError: Going to return from the error handler.\n"); XlibInt.c:3488: fprintf(stderr, "_XDefaultIOError: Going to exit from the program.\n"); XlibInt.c:3706: _XDefaultIOError(dpy); Xlibint.h:1317:extern int _XDefaultIOError( #### _XDefaultWireError #### InitExt.c:328: if (proc == NULL) proc = (WireToErrorType)_XDefaultWireError; InitExt.c:334: dpy->error_vec[i] = _XDefaultWireError; XlibInt.c:3625:Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we) Xlibint.h:1003:extern Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we); #### _XDeq #### ChkIfEv.c:61: _XDeq(dpy, prev, qelt); ChkIfEv.c:117: _XDeq(dpy, prev, qelt); ChkMaskEv.c:69: _XDeq(dpy, prev, qelt); ChkTypEv.c:59: _XDeq(dpy, prev, qelt); ChkTypWEv.c:61: _XDeq(dpy, prev, qelt); ChkWinEv.c:70: _XDeq(dpy, prev, qelt); IfEvent.c:60: _XDeq(dpy, prev, qelt); MaskEvent.c:68: _XDeq(dpy, prev, qelt); NextEvent.c:59: _XDeq(dpy, NULL, qelt); WinEvent.c:72: _XDeq(dpy, prev, qelt); XlibAsync.c:90:void _XDeqAsyncHandler( XlibInt.c:2801: data pointer) and adds it to the cookiejar. _XDeq just removes XlibInt.c:2988: * _XDeq - Remove event packet from the display's queue. XlibInt.c:2990:void _XDeq( Xlibint.h:717:extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler); Xlibint.h:722: _XDeqAsyncHandler(dpy, handler); \ Xlibint.h:972:extern void _XDeq( #### _XDeqAsyncHandler #### XlibAsync.c:90:void _XDeqAsyncHandler( Xlibint.h:717:extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler); Xlibint.h:722: _XDeqAsyncHandler(dpy, handler); \ #### _XDisconnectDisplay #### ClDisplay.c:78: _XDisconnectDisplay(dpy->trans_conn); ConnDis.c:771:int _XDisconnectDisplay (XtransConnInfo trans_conn) OpenDis.c:379: _XDisconnectDisplay (dpy->trans_conn); OpenDis.c:399: _XDisconnectDisplay (dpy->trans_conn); OpenDis.c:416: _XDisconnectDisplay (dpy->trans_conn); OpenDis.c:435: _XDisconnectDisplay (dpy->trans_conn); OpenDis.c:984: _XDisconnectDisplay (dpy->trans_conn); Xintconn.h:22:extern int _XDisconnectDisplay(XtransConnInfo trans_conn); #### _XEatData #### AllCells.c:57: _XEatDataWords(dpy, rep.length); Font.c:219: _XEatDataWords(dpy, reply_left); Font.c:253: _XEatDataWords(dpy, reply_left); Font.c:276: _XEatDataWords(dpy, reply_left); Font.c:463: _XEatDataWords(dpy, reply_left); Font.c:497: _XEatDataWords(dpy, reply_left); Font.c:512: _XEatDataWords(dpy, reply_left); Font.c:529: _XEatDataWords(dpy, reply_left); Font.c:536: _XEatDataWords(dpy, reply_left); FontInfo.c:79: _XEatDataWords(dpy, reply_left); FontInfo.c:187: _XEatDataWords(dpy, reply_left); FontNames.c:78: _XEatDataWords(dpy, rep.length); GetAtomNm.c:81: _XEatDataWords(dpy, rep.length); GetAtomNm.c:179: _XEatDataWords(dpy, rep.length); GetFPath.c:62: _XEatDataWords(dpy, rep.length); GetImage.c:89: _XEatDataWords(dpy, rep.length); GetMoEv.c:60: _XEatDataWords (dpy, rep.length); GetPntMap.c:60: _XEatDataWords(dpy, rep.length); GetPntMap.c:79: _XEatData(dpy, remainder); GetPntMap.c:119: _XEatDataWords(dpy, rep.length); GetProp.c:131: _XEatDataWords(dpy, reply.length); LiHosts.c:108: _XEatDataWords(dpy, reply.length); LiICmaps.c:56: _XEatDataWords(dpy, rep.length); LiProps.c:55: _XEatDataWords(dpy, rep.length); ListExt.c:67: _XEatDataWords(dpy, rep.length); ModMap.c:56: _XEatDataWords(dpy, rep.length); OpenDis.c:780: _XEatDataWords(dpy, reply.length); QuColors.c:70: _XEatDataWords(dpy, rep.length); QuTree.c:57: _XEatDataWords(dpy, rep.length); XKBGetByName.c:216: _XEatData(dpy, extraLen); XlibAsync.c:117: _XEatData (dpy, (rep->generic.length << 2) - len); XlibAsync.c:132: _XEatData (dpy, (rep->generic.length << 2) - len); XlibAsync.c:142: _XEatData (dpy, (rep->generic.length << 2) - len); XlibAsync.c:170: _XEatData(dpy, datalen - len); XlibAsync.c:180: _XEatData(dpy, discardtotal - len); XlibInt.c:2243: _XEatData(dpy, (rep->generic.length - extra) << 2); XlibInt.c:2396: _XEatData(dpy, len - *lenp); XlibInt.c:2754:void _XEatData( XlibInt.c:2762: fprintf(stderr, "_XEatData: Going to eat [%ld] bytes of data from descriptor [%d].\n", XlibInt.c:2788:void _XEatDataWords(Display *dpy, unsigned long n) XlibInt.c:2794: _XEatData (dpy, n << 2); Xlibint.h:872:extern void _XEatData( Xlibint.h:876:extern void _XEatDataWords( Xlibint.h:881:# pragma rarely_called(_XEatData, _XEatDataWords) #### _XEatDataWords #### AllCells.c:57: _XEatDataWords(dpy, rep.length); Font.c:219: _XEatDataWords(dpy, reply_left); Font.c:253: _XEatDataWords(dpy, reply_left); Font.c:276: _XEatDataWords(dpy, reply_left); Font.c:463: _XEatDataWords(dpy, reply_left); Font.c:497: _XEatDataWords(dpy, reply_left); Font.c:512: _XEatDataWords(dpy, reply_left); Font.c:529: _XEatDataWords(dpy, reply_left); Font.c:536: _XEatDataWords(dpy, reply_left); FontInfo.c:79: _XEatDataWords(dpy, reply_left); FontInfo.c:187: _XEatDataWords(dpy, reply_left); FontNames.c:78: _XEatDataWords(dpy, rep.length); GetAtomNm.c:81: _XEatDataWords(dpy, rep.length); GetAtomNm.c:179: _XEatDataWords(dpy, rep.length); GetFPath.c:62: _XEatDataWords(dpy, rep.length); GetImage.c:89: _XEatDataWords(dpy, rep.length); GetMoEv.c:60: _XEatDataWords (dpy, rep.length); GetPntMap.c:60: _XEatDataWords(dpy, rep.length); GetPntMap.c:119: _XEatDataWords(dpy, rep.length); GetProp.c:131: _XEatDataWords(dpy, reply.length); LiHosts.c:108: _XEatDataWords(dpy, reply.length); LiICmaps.c:56: _XEatDataWords(dpy, rep.length); LiProps.c:55: _XEatDataWords(dpy, rep.length); ListExt.c:67: _XEatDataWords(dpy, rep.length); ModMap.c:56: _XEatDataWords(dpy, rep.length); OpenDis.c:780: _XEatDataWords(dpy, reply.length); QuColors.c:70: _XEatDataWords(dpy, rep.length); QuTree.c:57: _XEatDataWords(dpy, rep.length); XlibInt.c:2788:void _XEatDataWords(Display *dpy, unsigned long n) Xlibint.h:876:extern void _XEatDataWords( Xlibint.h:881:# pragma rarely_called(_XEatData, _XEatDataWords) #### _XEnq #### XlibInt.c:574: _XEnq (dpy, (xEvent *)rep); XlibInt.c:1328: _XEnq (dpy, (xEvent *)rep); XlibInt.c:1514: _XEnq (dpy, (xEvent *)rep); XlibInt.c:2333: _XEnq(dpy, (xEvent *) rep); XlibInt.c:2799: dpy->cookiejar is a linked list. _XEnq receives the events but leaves XlibInt.c:2922: * _XEnq - Place event packets on the display's queue. XlibInt.c:2926:void _XEnq( Xlibint.h:968:extern void _XEnq( #### _XError #### ErrDes.c:71:static const char _XErrorList[] = ErrDes.c:92:/* offsets into _XErrorList */ ErrDes.c:93:static const unsigned char _XErrorOffsets[] = { ErrDes.c:114: _XErrorList + _XErrorOffsets[code], ErrHndlr.c:34: * (_XErrorFunction) to be the specified routine. If NULL is passed in ErrHndlr.c:44: oldhandler = _XErrorFunction; ErrHndlr.c:50: _XErrorFunction = handler; ErrHndlr.c:53: _XErrorFunction = _XDefaultError; GetProp.c:125: _XError(dpy, &error); globals.c:72:ZEROINIT (XErrorHandler, _XErrorFunction, NULL); OpenDis.c:173: if (_XErrorFunction == NULL) (void) XSetErrorHandler (NULL); XlibInt.c:231: * _XError(Display *, xError *) will be called whenever an X_Error event is XlibInt.c:572: _XError (dpy, (xError *)rep); XlibInt.c:1326: _XError (dpy, (xError *)rep); XlibInt.c:1503: _XError (dpy, (xError *) rep); XlibInt.c:2322: _XError(dpy, err); XlibInt.c:3631: * _XError - upcall internal or user protocol error handler XlibInt.c:3633:int _XError ( XlibInt.c:3662: if (_XErrorFunction != NULL) { XlibInt.c:3669: rtn_val = (*_XErrorFunction)(dpy, (XErrorEvent *)&event); /* upcall */ Xlibint.h:853:extern int _XError( Xlibint.h:868:extern int (*_XErrorFunction)( #### _XErrorFunction #### ErrHndlr.c:34: * (_XErrorFunction) to be the specified routine. If NULL is passed in ErrHndlr.c:44: oldhandler = _XErrorFunction; ErrHndlr.c:50: _XErrorFunction = handler; ErrHndlr.c:53: _XErrorFunction = _XDefaultError; globals.c:72:ZEROINIT (XErrorHandler, _XErrorFunction, NULL); OpenDis.c:173: if (_XErrorFunction == NULL) (void) XSetErrorHandler (NULL); XlibInt.c:3662: if (_XErrorFunction != NULL) { XlibInt.c:3669: rtn_val = (*_XErrorFunction)(dpy, (XErrorEvent *)&event); /* upcall */ Xlibint.h:868:extern int (*_XErrorFunction)( #### _XEventToWire #### EvToWire.c:46:_XEventToWire( SendEvent.c:33: * In order to avoid all images requiring _XEventToWire, we install the SendEvent.c:62: if (*fp == NULL) *fp = _XEventToWire; Xlibint.h:1298:extern Status _XEventToWire(Display *dpy, XEvent *re, xEvent *event); #### _XEventsQueued #### ChkIfEv.c:71: _XEventsQueued(dpy, QueuedAfterReading); ChkIfEv.c:127: _XEventsQueued(dpy, QueuedAfterReading); ChkMaskEv.c:78: _XEventsQueued(dpy, QueuedAfterReading); ChkTypEv.c:69: _XEventsQueued(dpy, QueuedAfterReading); ChkTypWEv.c:71: _XEventsQueued(dpy, QueuedAfterReading); ChkWinEv.c:79: _XEventsQueued(dpy, QueuedAfterReading); Pending.c:51: ret_val = _XEventsQueued (dpy, mode); Pending.c:66: ret_val = _XEventsQueued (dpy, QueuedAfterFlush); XlibInt.c:1101:_XEventsQueued( XlibInt.c:1116: printf("_XEventsQueued called in thread %x\n", XThread_Self()); XlibInt.c:1128: fprintf(stderr, "_XEventsQueued: Returning [%d] after display failure.\n", XlibInt.c:1173: fprintf(stderr, "_XEventsQueued: Checking bytes readable.\n"); XlibInt.c:1202: fprintf(stderr, "_XEventsQueued: Calling poll().\n"); XlibInt.c:1209: fprintf(stderr, "_XEventsQueued: Calling select().\n"); XlibInt.c:1257: fprintf(stderr, "_XEventsQueued: Returning [%d].\n", dpy->qlen); Xlibint.h:106: int conn_checker; /* ugly thing used by _XEventsQueued */ Xlibint.h:940:extern int _XEventsQueued( #### _XF86BigfontFreeFontMetrics #### Font.c:84:void _XF86BigfontFreeFontMetrics( Font.c:167: _XF86BigfontFreeFontMetrics(fs); Font.c:630:_XF86BigfontFreeFontMetrics (XFontStruct *fs) Font.c:694: _XF86BigfontFreeFontMetrics(fs); FontInfo.c:37:extern void _XF86BigfontFreeFontMetrics( FontInfo.c:217: _XF86BigfontFreeFontMetrics(&info[i]); #### _XF86LoadQueryLocaleFont #### Font.c:104: if (_XF86LoadQueryLocaleFont(dpy, name, &font_result, (Font *)0)) Font.c:649:int _XF86LoadQueryLocaleFont( LoadFont.c:41: if (_XF86LoadQueryLocaleFont(dpy, name, (XFontStruct **)0, &fid)) Xlibint.h:1300:extern int _XF86LoadQueryLocaleFont( #### _XFetchEventCookie #### GetEventData.c:36: rc = _XFetchEventCookie(dpy, event); PutBEvent.c:56: _XFetchEventCookie(dpy, &event->xcookie); XlibInt.c:2805: _XFetchEventCookie (called from XGetEventData) removes a cookie from the XlibInt.c:2877:_XFetchEventCookie(Display *dpy, XGenericEventCookie* ev) Xlibint.h:1348:extern Bool _XFetchEventCookie( #### _XFlush #### ChGC.c:47: _XFlushGCCache(dpy, gc); ChkIfEv.c:74: _XFlush(dpy); ChkMaskEv.c:81: _XFlush(dpy); ChkTypEv.c:72: _XFlush(dpy); ChkTypWEv.c:74: _XFlush(dpy); ChkWinEv.c:82: _XFlush(dpy); CopyGC.c:50: _XFlushGCCache(dpy, srcGC); CrGC.c:315:void _XFlushGCCache( Flush.c:39: _XFlush (dpy); PolyTxt16.c:90: _XFlush (dpy); PolyTxt16.c:237: _XFlush (dpy); PolyTxt.c:90: _XFlush (dpy); PolyTxt.c:230: _XFlush (dpy); SetClMask.c:43: _XFlushGCCache(dpy, gc); SetFont.c:42: _XFlushGCCache(dpy, gc); SetStip.c:42: _XFlushGCCache(dpy, gc); SetTile.c:42: _XFlushGCCache(dpy, gc); Text16.c:71: _XFlush (dpy); Text16.c:124: _XFlush (dpy); Text.c:71: _XFlush (dpy); Text.c:135: _XFlush (dpy); XlibInt.c:940:static void _XFlushInt( XlibInt.c:946: * _XFlush - Flush the X request buffer. If the buffer is empty, no XlibInt.c:950:void _XFlush( XlibInt.c:957: _XFlushInt(dpy, NULL); XlibInt.c:960:/* _XFlushInt - Internal version of _XFlush used to do multi-threaded XlibInt.c:964:static void _XFlushInt( XlibInt.c:978: fprintf(stderr, "_XFlushInt: Entering flush with [%d] bytes to write.\n", XlibInt.c:984: * callers of _XFlush() are not verifying this before they call it. XlibInt.c:989: fprintf(stderr, "_XFlushInt: Returning with I/O error detected.\n"); XlibInt.c:1122: _XFlush(dpy); XlibInt.c:1249: /* _XFlush can enqueue events */ XlibInt.c:1412: _XFlush (dpy); XlibInt.c:2180: _XFlushInt(dpy, cvl ? cvl->cv : NULL); XlibInt.c:2192: _XFlush(dpy); XlibInt.c:3882: _XFlush(dpy); XlibInt.c:3984: _XFlush(dpy); Xlibint.h:88:#define _XFlush _XFlushIt Xlibint.h:429:#define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */ Xlibint.h:551:extern void _XFlushGCCache(Display *dpy, GC gc); Xlibint.h:553: if ((gc)->dirty) _XFlushGCCache((dpy), (gc)) Xlibint.h:589: _XFlush (dpy); \ Xlibint.h:937:extern void _XFlush( #### _XFlushGCCache #### ChGC.c:47: _XFlushGCCache(dpy, gc); CopyGC.c:50: _XFlushGCCache(dpy, srcGC); CrGC.c:315:void _XFlushGCCache( SetClMask.c:43: _XFlushGCCache(dpy, gc); SetFont.c:42: _XFlushGCCache(dpy, gc); SetStip.c:42: _XFlushGCCache(dpy, gc); SetTile.c:42: _XFlushGCCache(dpy, gc); Xlibint.h:551:extern void _XFlushGCCache(Display *dpy, GC gc); Xlibint.h:553: if ((gc)->dirty) _XFlushGCCache((dpy), (gc)) #### _XFreeAtomTable #### IntAtom.c:40:_XFreeAtomTable(Display *dpy) IntAtom.c:76: dpy->free_funcs->atoms = _XFreeAtomTable; IntAtom.c:131: dpy->free_funcs->atoms = _XFreeAtomTable; Xintatom.h:29:extern void _XFreeAtomTable(Display *dpy); Xlibint.h:737: FreeFuncType atoms; /* _XFreeAtomTable */ #### _XFreeDisplayLock_fn #### locking.c:608: _XFreeDisplayLock_fn = _XFreeDisplayLock; OpenDis.c:87:void (*_XFreeDisplayLock_fn)(Display *dpy) = NULL; OpenDis.c:90:#define FreeDisplayLock(d) if (_XFreeDisplayLock_fn) (*_XFreeDisplayLock_fn)(d) locking.h:154:extern void (*_XFreeDisplayLock_fn)(Display *dpy); #### _XFreeDisplayStructure #### ClDisplay.c:80: _XFreeDisplayStructure (dpy); OpenDis.c:851:void _XFreeDisplayStructure(Display *dpy) OpenDis.c:986: _XFreeDisplayStructure (dpy); XlibInt.c:2809: _XFreeDisplayStructure calls _XFreeEventCookies for each cookie in the XlibInt.c:3011: * _XFreeDisplayStructure */ Xintconn.h:34:extern void _XFreeDisplayStructure(Display *dpy); #### _XFreeEventCookies #### ChkMaskEv.c:56: _XFreeEventCookies(dpy); ChkTypEv.c:50: _XFreeEventCookies(dpy); ChkTypWEv.c:51: _XFreeEventCookies(dpy); ChkWinEv.c:56: _XFreeEventCookies(dpy); MaskEvent.c:55: _XFreeEventCookies(dpy); NextEvent.c:47: _XFreeEventCookies(dpy); OpenDis.c:863: _XFreeEventCookies(dpy); WinEvent.c:58: _XFreeEventCookies(dpy); XlibInt.c:2806: jar. _XFreeEventCookies removes all unclaimed cookies from the jar XlibInt.c:2809: _XFreeDisplayStructure calls _XFreeEventCookies for each cookie in the XlibInt.c:2831:_XFreeEventCookies(Display *dpy) Xlibint.h:1341:extern void _XFreeEventCookies( #### _XFreeExtData #### Font.c:172: _XFreeExtData(fs->ext_data); Font.c:699: _XFreeExtData(fs->ext_data); FreeEData.c:33:_XFreeExtData (XExtData *extension) FreeGC.c:46: _XFreeExtData(gc->ext_data); OpenDis.c:909: _XFreeExtData (dp->visuals[k].ext_data); OpenDis.c:917: _XFreeExtData (sp->ext_data); OpenDis.c:927: _XFreeExtData (dpy->pixmap_format[i].ext_data); OpenDis.c:939: _XFreeExtData (dpy->ext_data); Xlibint.h:1010:extern int _XFreeExtData( #### _XFreeMutex_fn #### locking.c:606: _XFreeMutex_fn = _XFreeMutex; XlibInt.c:85:void (*_XFreeMutex_fn)(LockInfoPtr) = NULL; XlibInt.c:4194:void (**_XFreeMutex_fn_p)(LockInfoPtr) = &_XFreeMutex_fn; Xlibint.h:304:#define _XFreeMutex_fn (*_XFreeMutex_fn_p) Xlibint.h:314:extern void (*_XFreeMutex_fn)( Xlibint.h:347:#define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock); #### _XFreeTemp #### Region.c:277: _XFreeTemp(dpy, (char *)xr, total); XKBSetGeom.c:440: _XFreeTemp(dpy, tbuf, sz); XlibInt.c:3778: * MT safe, but you must hand the buffer back with _XFreeTemp. XlibInt.c:3792:void _XFreeTemp( Xlibint.h:891:extern void _XFreeTemp( #### _XGetAsyncData #### GetAtomNm.c:128: _XGetAsyncData(dpy, state->names[state->idx], buf, len, XlibAsync.c:156:_XGetAsyncData( XlibAsync.c:162: _XGetAsyncReply or _XGetAsyncData calls */ Xlibint.h:693: * _XGetAsyncReply or _XGetAsyncData. Xlibint.h:928:extern void _XGetAsyncData( #### _XGetAsyncReply #### GetAtomNm.c:124: _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, GetWAttrs.c:65: _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, IntAtom.c:230: _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, OpenDis.c:832: _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, XlibAsync.c:106:_XGetAsyncReply( XlibAsync.c:162: _XGetAsyncReply or _XGetAsyncData calls */ Xlibint.h:691: * to be invoked. It must also be passed to _XGetAsyncReply. Xlibint.h:693: * _XGetAsyncReply or _XGetAsyncData. Xlibint.h:919:extern char *_XGetAsyncReply( #### _XGetBitsPerPixel #### ImUtil.c:72:_XGetBitsPerPixel( ImUtil.c:354: bits_per_pixel = _XGetBitsPerPixel(dpy, (int) depth); ImUtil.h:12:_XGetBitsPerPixel( #### _XGetHostname #### ConnDis.c:356: if ((_XGetHostname (localhostname, sizeof localhostname) > 0) GetDflt.c:158: (void) _XGetHostname (fname+len, PATH_MAX-len); WMProps.c:88: int len = _XGetHostname (hostName, sizeof hostName); XlibInt.c:3917: * _XGetHostname - similar to gethostname but allows special processing. XlibInt.c:3919:int _XGetHostname ( Xlibint.h:904:extern int _XGetHostname( #### _XGetLCValues #### imDefIm.c:311: _XGetLCValues(lcd, XlcNLanguage, &language, XlcNTerritory, &territory, imDefIm.c:1550: _XGetLCValues(im->core.lcd, XlcNCodeset, &encoding, NULL); imInsClbk.c:64: _XGetLCValues( lcd, XlcNLanguage, &language, XlcNTerritory, &territory, imThaiIm.c:66: _XGetLCValues(im->core.lcd, XlcNLanguage, &language, NULL); lcPubWrap.c:33:_XGetLCValues(XLCd lcd, ...) XlcPublic.h:238:extern char *_XGetLCValues( #### _XGetRequest #### XlibInt.c:3979:void *_XGetRequest(Display *dpy, CARD8 type, size_t len) Xlibint.h:450:extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); Xlibint.h:456: req = (x##name##Req *) _XGetRequest(dpy, X_##name, sz) Xlibint.h:483: req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \ Xlibint.h:491: req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq)) #### _XGetScanlinePad #### GetImage.c:104: _XGetScanlinePad(dpy, (int) rep.depth), 0); ImUtil.c:57:_XGetScanlinePad( ImUtil.h:7:_XGetScanlinePad( #### _XGetWindowAttributes #### GetWAttrs.c:88:_XGetWindowAttributes( GetWAttrs.c:149: ret = _XGetWindowAttributes(dpy, w, attr); Xlibint.h:1328:Status _XGetWindowAttributes( #### _XHeadOfDisplayList #### globals.c:81:ZEROINIT (Display *, _XHeadOfDisplayList, NULL); OpenDis.c:797: extern Display *_XHeadOfDisplayList; OpenDis.c:798: _XHeadOfDisplayList = dpy; #### _XIMCompileResourceList #### imRmAttr.c:1458: _XIMCompileResourceList(res, n); imRmAttr.c:1503: _XIMCompileResourceList(res, n); imRm.c:2159: _XIMCompileResourceList(res, num_resource); IMWrap.c:67:_XIMCompileResourceList(XIMResourceList res, unsigned int num_res) Xlcint.h:780:extern void _XIMCompileResourceList( #### _XIOError #### ErrHndlr.c:62: * (_XIOErrorFunction) to be the specified routine. If NULL is passed in ErrHndlr.c:72: oldhandler = _XIOErrorFunction; ErrHndlr.c:78: _XIOErrorFunction = handler; ErrHndlr.c:81: _XIOErrorFunction = _XDefaultIOError; globals.c:73:ZEROINIT (XIOErrorHandler, _XIOErrorFunction, NULL); OpenDis.c:174: if (_XIOErrorFunction == NULL) (void) XSetIOErrorHandler (NULL); XlibAsync.c:151: _XIOError (dpy); XlibInt.c:228: * _XIOError(Display *) will be called if any sort of system call error occurs. XlibInt.c:509: _XIOError(dpy); XlibInt.c:515: _XIOError(dpy); XlibInt.c:536: _XIOError(dpy); XlibInt.c:541: _XIOError(dpy); XlibInt.c:789: _XIOError(dpy); XlibInt.c:795: if (result == -1 && !(ECHECK(EINTR) || ETEST())) _XIOError(dpy); XlibInt.c:1076: _XIOError(dpy); XlibInt.c:1083: _XIOError(dpy); XlibInt.c:1178: _XIOError(dpy); XlibInt.c:1183: _XIOError(dpy); XlibInt.c:1221: _XIOError(dpy); XlibInt.c:1226: _XIOError(dpy); XlibInt.c:1237: _XIOError(dpy); XlibInt.c:1244: _XIOError(dpy); XlibInt.c:1395: _XIOError(dpy); XlibInt.c:1585: _XIOError(dpy); XlibInt.c:1589: _XIOError(dpy); XlibInt.c:1599: _XIOError(dpy); XlibInt.c:1604: _XIOError(dpy); XlibInt.c:1727: _XIOError(dpy); XlibInt.c:1731: _XIOError(dpy); XlibInt.c:1741: _XIOError(dpy); XlibInt.c:1746: _XIOError(dpy); XlibInt.c:1918: _XIOError(dpy); XlibInt.c:1923: _XIOError(dpy); XlibInt.c:2277: _XIOError (dpy); XlibInt.c:2373: _XIOError (dpy); XlibInt.c:2408: _XIOError (dpy); XlibInt.c:2792: _XIOError(dpy); XlibInt.c:2866: _XIOError(dpy); XlibInt.c:2941: _XIOError(dpy); XlibInt.c:2945: _XIOError(dpy); XlibInt.c:3682: * _XIOError - call user connection error handler and exit XlibInt.c:3685:_XIOError ( XlibInt.c:3703: if (_XIOErrorFunction != NULL) XlibInt.c:3704: (*_XIOErrorFunction)(dpy); XlibInt.c:3731: fprintf(stderr, "_XIOError: Resetting the display buffer.\n"); XlibInt.c:3738: fprintf(stderr, "_XIOError: Resetting the display flags.\n"); Xlibint.h:857:extern int _XIOError( Xlibint.h:865:extern int (*_XIOErrorFunction)( #### _XIOErrorFunction #### ErrHndlr.c:62: * (_XIOErrorFunction) to be the specified routine. If NULL is passed in ErrHndlr.c:72: oldhandler = _XIOErrorFunction; ErrHndlr.c:78: _XIOErrorFunction = handler; ErrHndlr.c:81: _XIOErrorFunction = _XDefaultIOError; globals.c:73:ZEROINIT (XIOErrorHandler, _XIOErrorFunction, NULL); OpenDis.c:174: if (_XIOErrorFunction == NULL) (void) XSetIOErrorHandler (NULL); XlibInt.c:3703: if (_XIOErrorFunction != NULL) XlibInt.c:3704: (*_XIOErrorFunction)(dpy); Xlibint.h:865:extern int (*_XIOErrorFunction)( #### _XInitDisplayLock_fn #### locking.c:607: _XInitDisplayLock_fn = _XInitDisplayLock; OpenDis.c:86:int (*_XInitDisplayLock_fn)(Display *dpy) = NULL; OpenDis.c:89:#define InitDisplayLock(d) (_XInitDisplayLock_fn ? (*_XInitDisplayLock_fn)(d) : Success) locking.h:153:extern int (*_XInitDisplayLock_fn)(Display *dpy); #### _XInitIM #### imInt.c:252:_XInitIM(XLCd lcd) lcPublic.c:163: _XInitIM(lcd); XlcPublic.h:226:extern Bool _XInitIM( #### _XInitImageFuncPtrs #### ImUtil.c:271:void _XInitImageFuncPtrs ( ImUtil.c:383: _XInitImageFuncPtrs (image); ImUtil.c:422: _XInitImageFuncPtrs (image); ImUtil.c:560: _XInitImageFuncPtrs(ximage); ImUtil.c:584: _XInitImageFuncPtrs(ximage); ImUtil.c:603: _XInitImageFuncPtrs(ximage); ImUtil.c:627: _XInitImageFuncPtrs(ximage); ImUtil.c:747: _XInitImageFuncPtrs(ximage); ImUtil.c:772: _XInitImageFuncPtrs(ximage); ImUtil.c:787: _XInitImageFuncPtrs(ximage); ImUtil.c:816: _XInitImageFuncPtrs(ximage); ImUtil.c:868: _XInitImageFuncPtrs (subimage); PutImage.c:997: _XInitImageFuncPtrs(&img); ImUtil.h:28:_XInitImageFuncPtrs( #### _XInitKeysymDB #### KeysymStr.c:103: if ((keysymdb = _XInitKeysymDB())) StrKeysym.c:53:_XInitKeysymDB(void) StrKeysym.c:113: (void)_XInitKeysymDB(); Key.h:17:_XInitKeysymDB( #### _XInitOM #### lcPublic.c:156: _XInitOM(lcd); omGeneric.c:2094:_XInitOM( XlcPublic.h:222:extern Bool _XInitOM( #### _XIsEventCookie #### FreeEventData.c:34: if (_XIsEventCookie(dpy, (XEvent*)event) && event->data) OpenDis.c:857: if (_XIsEventCookie(dpy, &qelt->event)) PutBEvent.c:51: if (_XIsEventCookie(dpy, event)) XlibInt.c:2821:_XIsEventCookie(Display *dpy, XEvent *ev) XlibInt.c:2858: if (!_XIsEventCookie(dpy, event)) XlibInt.c:2883: if (!_XIsEventCookie(dpy, (XEvent*)ev)) XlibInt.c:2907: if (!_XIsEventCookie(dpy, (XEvent*)in) || !out) XlibInt.c:3008: if (_XIsEventCookie(dpy, &qelt->event)) { Xlibint.h:1337:extern Bool _XIsEventCookie( #### _XKeyInitialize #### imThaiFlt.c:779: if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) KeyBind.c:126: if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) KeyBind.c:138: if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) KeyBind.c:154: if ((! event->display->keysyms) && (! _XKeyInitialize(event->display))) KeyBind.c:257:_XKeyInitialize( KeyBind.c:766: if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) KeyBind.c:923: if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) KeyBind.c:964: if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) Key.h:13:_XKeyInitialize( #### _XKeycodeToKeysym #### KeyBind.c:57:#define XKeycodeToKeysym _XKeycodeToKeysym XKBBind.c:107: return _XKeycodeToKeysym(dpy, kc, col); XKBlibint.h:133:extern KeySym _XKeycodeToKeysym( #### _XKeysymToKeycode #### KeyBind.c:58:#define XKeysymToKeycode _XKeysymToKeycode XKBBind.c:158: return _XKeysymToKeycode(dpy, ks); XKBlibint.h:143:extern KeyCode _XKeysymToKeycode( #### _XKeysymToModifiers #### KeyBind.c:64:#define XkbKeysymToModifiers _XKeysymToModifiers KeyBind.c:955:_XKeysymToModifiers( XKBBind.c:197: return _XKeysymToModifiers(dpy, ks); XKBBind.c:201: return _XKeysymToModifiers(dpy, ks); XKBlibint.h:157:extern unsigned _XKeysymToModifiers( #### _XLockMutex_fn #### locking.c:603: _XLockMutex_fn = _XLockMutex; XlibInt.c:86:void (*_XLockMutex_fn)( XlibInt.c:4195:void (**_XLockMutex_fn_p)(LockInfoPtr XlibInt.c:4200: ) = &_XLockMutex_fn; Xlibint.h:305:#define _XLockMutex_fn (*_XLockMutex_fn_p) Xlibint.h:317:extern void (*_XLockMutex_fn)( Xlibint.h:337:#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__) Xlibint.h:343:#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock) #### _XLookupKeysym #### KeyBind.c:59:#define XLookupKeysym _XLookupKeysym XKBBind.c:223: return _XLookupKeysym(event, col); XKBlibint.h:148:extern KeySym _XLookupKeysym( #### _XLookupString #### imConv.c:47: * rather than just call _XLookupString (i.e. the pre-XKB XLookupString) imConv.c:49: * _XLookupString doesn't grok. KeyBind.c:61:#define XLookupString _XLookupString XKBlibint.h:178:extern int _XLookupString( #### _XNoticeCreateBitmap #### CrGlCur.c:183:_XNoticeCreateBitmap (Display *dpy, CrPixmap.c:34:_XNoticeCreateBitmap (Display *dpy, CrPixmap.c:61: _XNoticeCreateBitmap (dpy, pid, width, height); Cr.h:11:extern void _XNoticeCreateBitmap( #### _XNoticePutBitmap #### CrGlCur.c:196:_XNoticePutBitmap (Display *dpy, PutImage.c:1030: _XNoticePutBitmap (dpy, d, image); Cr.h:16:extern void _XNoticePutBitmap( #### _XOpenLC #### IMWrap.c:117: XLCd lcd = _XOpenLC( (char *)NULL ); IMWrap.c:173: XLCd lcd = _XOpenLC( (char *)NULL ); lcWrap.c:245:_XOpenLC( lcWrap.c:354: lcd = _XOpenLC((char *) NULL); lcWrap.c:368: XLCd lcd = _XOpenLC((char *) NULL); OMWrap.c:36: XLCd lcd = _XOpenLC((char *) NULL); Xlcint.h:759:extern XLCd _XOpenLC( #### _XParseBaseFontNameList #### FSWrap.c:71:_XParseBaseFontNameList( omGeneric.c:1080: name_list = _XParseBaseFontNameList(oc->core.base_name_list, &count); XDefaultOMIF.c:326: name_list = _XParseBaseFontNameList(oc->core.base_name_list, &count); Xlcint.h:791:extern char ** _XParseBaseFontNameList( #### _XPollfdCacheAdd #### XlibInt.c:622:void _XPollfdCacheAdd( XlibInt.c:2497: _XPollfdCacheAdd(dpy, fd); Xlibint.h:1005:extern void _XPollfdCacheAdd(Display *dpy, int fd); #### _XPollfdCacheDel #### XlibInt.c:637:void _XPollfdCacheDel( XlibInt.c:2545: _XPollfdCacheDel(dpy, fd); Xlibint.h:1006:extern void _XPollfdCacheDel(Display *dpy, int fd); #### _XPollfdCacheInit #### OpenDis.c:308: if (!_XPollfdCacheInit(dpy)) { XlibInt.c:605:Bool _XPollfdCacheInit( Xlibint.h:1004:extern Bool _XPollfdCacheInit(Display *dpy); #### _XProcessInternalConnection #### XlibInt.c:818: _XProcessInternalConnection(dpy, ilist); XlibInt.c:2592:void _XProcessInternalConnection( XlibInt.c:2636: _XProcessInternalConnection(dpy, info_list); Xlibint.h:426:#define XlibDisplayProcConni (1L << 4) /* in _XProcessInternalConnection */ Xlibint.h:1231:extern void _XProcessInternalConnection( #### _XProcessWindowAttributes #### ChWAttrs.c:52: _XProcessWindowAttributes (dpy, req, valuemask, attributes); Window.c:32:void _XProcessWindowAttributes ( Window.c:134: _XProcessWindowAttributes (dpy, (xChangeWindowAttributesReq *)req, Xlibint.h:1307:extern void _XProcessWindowAttributes ( #### _XPutBackEvent #### imLcFlt.c:153: _XPutBackEvent(d, ev); PutBEvent.c:36:_XPutBackEvent ( PutBEvent.c:84: ret = _XPutBackEvent(dpy, event); Xlibint.h:1333:int _XPutBackEvent ( #### (arch=amd64 ia64 alpha ppc64 arm64)_XRead32 #### #### _XRead #### AllCells.c:60: _XRead32 (dpy, (long *) pixels, 4L * (long) (rep.nPixels)); AllCells.c:61: _XRead32 (dpy, (long *) masks, 4L * (long) (rep.nMasks)); AllPlanes.c:68: _XRead32 (dpy, (long *) pixels, (long)(ncolors * 4)); ConnDis.c:1032: _XRead(dpy, (char *)&prefix, sz_xReq); ConnDis.c:1038: _XRead(dpy, (char *)sprefix + sz_xReq, ConnDis.c:1062: _XRead(dpy, buf, tlen); ConnDis.c:1212: _XRead(dpy, (char *)&prefix, sz_xReq); ConnDis.c:1217: _XRead(dpy, (char *)sprefix + sz_xReq, ConnDis.c:1237: _XRead(dpy, (char *)kbuf.data, kbuf.length); Font.c:256: _XRead32 (dpy, (long *)fs->properties, nbytes); Font.c:280: _XRead16 (dpy, (char *)fs->per_char, nbytes); Font.c:500: _XRead32 (dpy, (long *)fs->properties, nbytes); Font.c:539: _XRead16 (dpy, (char *) pUniqCI, nbytes); FontInfo.c:145: _XRead32 (dpy, (long *)fs->properties, nbytes); FontInfo.c:163: _XReadPad (dpy, flist[i], (long) reply.nameLength); FontNames.c:85: _XReadPad (dpy, ch, rlen); GetAtomNm.c:77: _XReadPad(dpy, name, (long)rep.nameLength); GetAtomNm.c:174: _XReadPad(dpy, names_return[missed], (long)rep.nameLength); GetFPath.c:68: _XReadPad (dpy, ch, nbytes); GetImage.c:94: _XReadPad (dpy, data, nbytes); GetMoEv.c:70: _XRead (dpy, (char *) &xtc, SIZEOF (xTimecoord)); GetPntMap.c:71: _XRead (dpy, (char *)mapping, nbytes); GetPntMap.c:125: _XRead32 (dpy, (long *) mapping, nbytes); GetProp.c:96: _XReadPad (dpy, (char *) *prop, netbytes); GetProp.c:103: _XRead16Pad (dpy, (short *) *prop, netbytes); GetProp.c:110: _XRead32 (dpy, (long *) *prop, netbytes); IfEvent.c:68: _XReadEvents(dpy); LiHosts.c:119: _XRead (dpy, (char *) buf, nbytes); LiICmaps.c:62: _XRead32 (dpy, (long *) cmaps, nbytes); LiProps.c:61: _XRead32 (dpy, (long *) properties, nbytes); ListExt.c:73: _XReadPad (dpy, ch, rlen); MaskEvent.c:75: _XReadEvents(dpy); ModMap.c:58: _XReadPad(dpy, (char *) res->modifiermap, (long) nbytes); NextEvent.c:50: _XReadEvents(dpy); OpenDis.c:392: _XRead (dpy, (char *)&prefix,(long)SIZEOF(xConnSetupPrefix)); OpenDis.c:439: _XRead (dpy, (char *)u.setup, setuplength); OpenDis.c:776: _XReadPad (dpy, dpy->xdefaults, reply.nItems); PeekEvent.c:46: _XReadEvents(dpy); PeekIfEv.c:72: _XReadEvents(dpy); QuColor.c:51: _XRead(dpy, (char *)&color, (long) SIZEOF(xrgb)); QuColors.c:57: _XRead(dpy, (char *) color, nbytes); QuTree.c:63: _XRead32 (dpy, (long *) *children, nbytes); WinEvent.c:79: _XReadEvents(dpy); XKBGetByName.c:152: _XRead(dpy, (char *) &mrep, SIZEOF(xkbGetMapReply)); XKBGetByName.c:164: _XRead(dpy, (char *) &crep, SIZEOF(xkbGetCompatMapReply)); XKBGetByName.c:176: _XRead(dpy, (char *) &irep, SIZEOF(xkbGetIndicatorMapReply)); XKBGetByName.c:188: _XRead(dpy, (char *) &nrep, SIZEOF(xkbGetNamesReply)); XKBGetByName.c:200: _XRead(dpy, (char *) &grep, SIZEOF(xkbGetGeometryReply)); XKBRdBuf.c:45: _XRead(dpy, buf->start, size); XlibAsync.c:125: _XRead(dpy, replbuf + len, size - len); XlibAsync.c:175: _XRead(dpy, data + len, datalen - len); XlibInt.c:560: (void) _XRead (dpy, buf.buf, (long) len); XlibInt.c:1289: (void) _XRead (dpy, read_buf, (long) len); XlibInt.c:1343:/* _XReadEvents - Flush the output queue, XlibInt.c:1346:void _XReadEvents( XlibInt.c:1362: printf("_XReadEvents called in thread %x\n", XlibInt.c:1447: i = _XRead (dpy, read_buf, (long) len); XlibInt.c:1453: fprintf(stderr, "_XReadEvents: Returning with I/O error detected.\n"); XlibInt.c:1459: /* special flag from _XRead to say that internal connection has XlibInt.c:1510: if (_XRead(dpy, &read_buf[len], evlen) == -2) XlibInt.c:1526: * _XRead - Read bytes from the socket taking into account incomplete XlibInt.c:1529:int _XRead( XlibInt.c:1628:void _XRead32( XlibInt.c:1637: (void) _XRead(dpy, (char *)data, len); XlibInt.c:1651: * _XReadPad - Read bytes from the socket taking into account incomplete XlibInt.c:1655:void _XReadPad( XlibInt.c:2056: _XRead32(dpy, (long *) ids, 4L * (long) (grep.count)); XlibInt.c:2210: /* Did another thread's _XReadEvents get our reply by accident? */ XlibInt.c:2213: (void) _XRead(dpy, (char *)rep, (long)SIZEOF(xReply)); XlibInt.c:2239: (void) _XRead (dpy, (char *) (NEXTPTR(rep,xReply)), XlibInt.c:2267: (void) _XRead (dpy, (char *) (NEXTPTR(rep,xReply)), XlibInt.c:2433: (void) _XRead(dpy, nbuf + *lenp, (long)len); XlibInt.c:2767: (void) _XRead (dpy, buf, bytes_read); locking.h:58: Bool reply_was_read; /* _XReadEvents read a reply for _XReply */ locking.h:61: struct _XCVList *event_awaiters; /* list of CVs for _XReadEvents */ Xlibint.h:427:#define XlibDisplayReadEvents (1L << 5) /* in _XReadEvents */ Xlibint.h:595:#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) Xlibint.h:596:#define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len)) Xlibint.h:604:extern void _XRead32( Xlibint.h:611:#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) Xlibint.h:944:extern void _XReadEvents( Xlibint.h:947:extern int _XRead( Xlibint.h:952:extern void _XReadPad( #### _XReadEvents #### IfEvent.c:68: _XReadEvents(dpy); MaskEvent.c:75: _XReadEvents(dpy); NextEvent.c:50: _XReadEvents(dpy); PeekEvent.c:46: _XReadEvents(dpy); PeekIfEv.c:72: _XReadEvents(dpy); WinEvent.c:79: _XReadEvents(dpy); XlibInt.c:1343:/* _XReadEvents - Flush the output queue, XlibInt.c:1346:void _XReadEvents( XlibInt.c:1362: printf("_XReadEvents called in thread %x\n", XlibInt.c:1453: fprintf(stderr, "_XReadEvents: Returning with I/O error detected.\n"); XlibInt.c:2210: /* Did another thread's _XReadEvents get our reply by accident? */ locking.h:58: Bool reply_was_read; /* _XReadEvents read a reply for _XReply */ locking.h:61: struct _XCVList *event_awaiters; /* list of CVs for _XReadEvents */ Xlibint.h:427:#define XlibDisplayReadEvents (1L << 5) /* in _XReadEvents */ Xlibint.h:944:extern void _XReadEvents( #### _XReadPad #### FontInfo.c:163: _XReadPad (dpy, flist[i], (long) reply.nameLength); FontNames.c:85: _XReadPad (dpy, ch, rlen); GetAtomNm.c:77: _XReadPad(dpy, name, (long)rep.nameLength); GetAtomNm.c:174: _XReadPad(dpy, names_return[missed], (long)rep.nameLength); GetFPath.c:68: _XReadPad (dpy, ch, nbytes); GetImage.c:94: _XReadPad (dpy, data, nbytes); GetProp.c:96: _XReadPad (dpy, (char *) *prop, netbytes); ListExt.c:73: _XReadPad (dpy, ch, rlen); ModMap.c:58: _XReadPad(dpy, (char *) res->modifiermap, (long) nbytes); OpenDis.c:776: _XReadPad (dpy, dpy->xdefaults, reply.nItems); XlibInt.c:1651: * _XReadPad - Read bytes from the socket taking into account incomplete XlibInt.c:1655:void _XReadPad( Xlibint.h:595:#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) Xlibint.h:952:extern void _XReadPad( #### _XRefreshKeyboardMapping #### KeyBind.c:60:#define XRefreshKeyboardMapping _XRefreshKeyboardMapping XKBBind.c:354: _XRefreshKeyboardMapping((XMappingEvent *) event); XKBBind.c:398: (void) _XRefreshKeyboardMapping(event); XKBlibint.h:153:extern int _XRefreshKeyboardMapping( #### _XRegisterFilterByMask #### imDefFlt.c:385: _XRegisterFilterByMask(im->core.display, RegstFlt.c:77:_XRegisterFilterByMask( Xlcint.h:800:extern void _XRegisterFilterByMask( #### _XRegisterFilterByType #### imDefFlt.c:266: _XRegisterFilterByType (ic->core.im->core.display, imDefFlt.c:283: _XRegisterFilterByType (ic->core.im->core.display, imInsClbk.c:198: _XRegisterFilterByType( display, root, PropertyNotify, PropertyNotify, imLcIc.c:87: _XRegisterFilterByType(ic->core.im->core.display, imRm.c:2789: _XRegisterFilterByType(ic->core.im->core.display, imRm.c:2801: _XRegisterFilterByType(ic->core.im->core.display, imThaiIc.c:102: _XRegisterFilterByType(ic->core.im->core.display, ic->core.focus_window, imTrans.c:116: _XRegisterFilterByType(im->core.display, window, KeyPress, KeyPress, imTrX.c:187: _XRegisterFilterByType(im->core.display, spec->lib_connect_wid, imTrX.c:221: _XRegisterFilterByType(im->core.display, spec->lib_connect_wid, RegstFlt.c:108:_XRegisterFilterByType( Xlcint.h:813:extern void _XRegisterFilterByType( #### _XRegisterInternalConnection #### imTrans.c:119: return _XRegisterInternalConnection(im->core.display, spec->fd, XlibInt.c:2445:/* _XRegisterInternalConnection XlibInt.c:2466:_XRegisterInternalConnection( XlibInt.c:2478: fprintf(stderr, "_XRegisterInternalConnection: Got called.\n"); XlibInt.c:2511: * registered with _XRegisterInternalConnection must call this function. XlibInt.c:2617: * Call the _XInternalConnectionProc registered by _XRegisterInternalConnection XlibInt.c:2644: * Register a callback to be called whenever _XRegisterInternalConnection Xlibint.h:207: struct _XConnectionInfo *im_fd_info; /* _XRegisterInternalConnection */ Xlibint.h:1219:extern Status _XRegisterInternalConnection( Xlibint.h:1238:struct _XConnectionInfo { /* info from _XRegisterInternalConnection */ #### _XReply #### AllCells.c:53: status = _XReply(dpy, (xReply *)&rep, 0, xFalse); AllPlanes.c:59: status = _XReply(dpy, (xReply *)&rep, 0, xFalse); cmsAllNCol.c:159: /* _XSend is more efficient that Data, since _XReply follows */ cmsAllNCol.c:161: if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { cmsCmap.c:187: (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); cmsLkCol.c:155: if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) { Font.c:208: if (!_XReply (dpy, (xReply *) &reply, Font.c:362: result = _XReply (dpy, (xReply *) &reply, Font.c:437: BadFont coming from a X_QueryFont request. (See function _XReply.) Font.c:450: if (!_XReply (dpy, (xReply *) &reply, FontInfo.c:66: /* use _XSend instead of Data, since subsequent _XReply will flush buffer */ FontInfo.c:69: if (!_XReply (dpy, (xReply *) &reply, FontInfo.c:189: _XReply(dpy, (xReply *) &reply, FontNames.c:58: /* use _XSend instead of Data, since following _XReply will flush buffer */ FontNames.c:60: if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) { GetAtomNm.c:71: if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { GetAtomNm.c:172: if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { GetColor.c:90: /* _XSend is more efficient that Data, since _XReply follows */ GetColor.c:92: if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { GetFPath.c:49: (void) _XReply (dpy, (xReply *) &rep, 0, xFalse); GetGeom.c:47: if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) { GetHColor.c:48: status = _XReply(dpy, (xReply *) &rep, 0, xTrue); GetIFocus.c:42: (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); GetImage.c:76: if (_XReply (dpy, (xReply *) &rep, 0, xFalse) == 0 || GetKCnt.c:41: (void) _XReply (dpy, (xReply *) &rep, GetMoEv.c:49: if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) { GetPCnt.c:44: (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); GetPntMap.c:52: if (! _XReply(dpy, (xReply *)&rep, 0, xFalse)) { GetPntMap.c:106: if (! _XReply(dpy, (xReply *)&rep, 0, xFalse)) { GetProp.c:69: if (!_XReply (dpy, (xReply *) &reply, 0, xFalse)) { GetSOwner.c:41: if (_XReply(dpy, (xReply *)&rep, 0, xTrue) == 0) rep.owner = None; GetSSaver.c:47: (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); GetWAttrs.c:114: if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) { GrKeybd.c:51: if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) GrPointer.c:58: if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) ImText16.c:80: if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) ImText.c:79: if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) IntAtom.c:181: if (_XReply (dpy, (xReply *)&rep, 0, xTrue)) { IntAtom.c:283: if (_XReply (dpy, (xReply *)&rep, 0, xTrue)) { LiHosts.c:87: if (!_XReply (dpy, (xReply *) &reply, 0, xFalse)) { LiICmaps.c:45: if(_XReply(dpy, (xReply *) &rep, 0, xFalse) == 0) { LiProps.c:44: if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { ListExt.c:50: if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) { locking.c:468: * _XReply is allowed to exit from select/poll and clean up even if a LookupCol.c:88: if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) { ModMap.c:43: (void) _XReply (dpy, (xReply *)&rep, 0, xFalse); ModMap.c:89: (void) _XReply(dpy, (xReply *) & rep, OpenDis.c:771: if (_XReply (dpy, (xReply *) &reply, 0, xFalse)) { OpenDis.c:788: if (_XReply(dpy, (xReply *)&brep, 0, xFalse)) ParseCol.c:125: if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) { QuBest.c:50: if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { QuColor.c:49: if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) { QuColors.c:52: if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) { QuCurShp.c:49: if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { QuExt.c:48: (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); QuKeybd.c:46: (void) _XReply(dpy, (xReply *)&rep, QuPntr.c:48: if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { QuStipShp.c:49: if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { QuTextE16.c:63: if (!_XReply (dpy, (xReply *)&rep, 0, xTrue) || !buf) { QuTextExt.c:63: if (!_XReply (dpy, (xReply *)&rep, 0, xTrue) || !buf) { QuTileShp.c:49: if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { QuTree.c:46: if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { ReconfWM.c:111: (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); SetPntMap.c:47: if (_XReply (dpy, (xReply *)&rep, 0, xFalse) == 0) Sync.c:44: (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); TrCoords.c:51: if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { XKB.c:420: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKB.c:496: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKB.c:542: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKB.c:573: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKB.c:609: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKB.c:642: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKB.c:679: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKB.c:710: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKBCompat.c:138: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKBCtrls.c:90: if (!_XReply(dpy, (xReply *) &rep, XKBCtrls.c:202: if (!_XReply(dpy, (xReply *) &rep, XKBExtDev.c:257: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKBExtDev.c:329: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKBExtDev.c:370: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKBExtDev.c:413: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKBGeom.c:687: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) XKBGeom.c:715: if ((!_XReply(dpy, (xReply *) &rep, 0, xFalse)) || (!rep.found)) XKBGetByName.c:140: if ((!_XReply(dpy, (xReply *) &rep, 0, xFalse)) || (!rep.reported)) XKBGetMap.c:562: if (!_XReply(dpy, (xReply *) &rep, XKBleds.c:52: ok = _XReply(dpy, (xReply *) &rep, 0, xFalse); XKBleds.c:143: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKBleds.c:226: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKBList.c:185: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) XKBNames.c:264: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { XKBUse.c:755: if (!_XReply(dpy, (xReply *) &rep, 0, xFalse) || !rep.supported) { XKBUse.c:773: if (_XReply(dpy, (xReply *) &rep, 0, xFalse) && rep.supported) { XlibAsync.c:112: int extra, /* extra words to read, ala _XReply */ XlibAsync.c:113: Bool discard) /* discard after extra?, ala _XReply */ XlibInt.c:894: (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); XlibInt.c:1160: if _XReply (in another thread) reads one */ XlibInt.c:1163: /* did _XReply read an event we can return? */ XlibInt.c:1414: /* _XReply has read an event for us */ XlibInt.c:1956: if (!_XReply (dpy, (xReply *)&qrep, 0, xTrue)) XlibInt.c:1964: if (!_XReply (dpy, (xReply *)&vrep, 0, xTrue)) XlibInt.c:1984: if (_XReply (dpy, (xReply *)&grep, 0, xTrue) && grep.count) { XlibInt.c:2055: if (_XReply(dpy, (xReply *)&grep, 0, xFalse) && grep.count) { XlibInt.c:2128: * _XReply - Wait for a reply packet and copy its contents into the XlibInt.c:2133:_XReply ( XlibInt.c:2147: fprintf(stderr, "_XReply: Going to wait for an X reply.\n"); XlibInt.c:2154: fprintf(stderr, "_XReply: Returning 0 with I/O error detected.\n"); XlibInt.c:2173: printf("_XReply called in thread %x, adding %x to cvl\n", XlibInt.c:2178: fprintf(stderr, "_XReply: Going to flush the display buffer.\n"); XlibInt.c:2203: fprintf(stderr, "_XReply: Requesting a flush of the NX transport.\n"); locking.h:58: Bool reply_was_read; /* _XReadEvents read a reply for _XReply */ locking.h:59: struct _XCVList *reply_awaiters; /* list of CVs for _XReply */ Xlibint.h:428:#define XlibDisplayReply (1L << 5) /* in _XReply */ Xlibint.h:962:extern Status _XReply( #### _XReverse_Bytes #### ImUtil.c:147: _XReverse_Bytes (bp, img->bitmap_unit >> 3); PutImage.c:120:_XReverse_Bytes( ImUtil.h:24:_XReverse_Bytes( #### _XScreenOfWindow #### GetRGBCMap.c:78: Screen *sp = _XScreenOfWindow (dpy, w); GetStCmap.c:80: Screen *sp = _XScreenOfWindow (dpy, w); SetStCmap.c:73: sp = _XScreenOfWindow (dpy, w); SetStCmap.c:75: /* already caught the XGetGeometry error in _XScreenOfWindow */ XlibInt.c:3950: * _XScreenOfWindow - get the Screen of a given window XlibInt.c:3953:Screen *_XScreenOfWindow(Display *dpy, Window w) Xlibint.h:908:extern Screen *_XScreenOfWindow( #### _XSelect #### XlibInt.c:256:int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, XlibInt.c:260: fprintf(stderr, "_XSelect: Called with [%d][%p][%p][%p][%p].\n", XlibInt.c:276: fprintf(stderr, "_XSelect: WARNING! Can't handle exception fds in select.\n"); XlibInt.c:333:int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, #### _XSend #### cmsAllNCol.c:158: _XSend(dpy, colorname, nbytes); cmsAllNCol.c:159: /* _XSend is more efficient that Data, since _XReply follows */ ConnDis.c:781:_XSendClientPrefix( ConnDis.c:1206: _XSend(dpy, (char *)&prefix, sz_xReq); ConnDis.c:1207: _XSend(dpy, (char *)kbuf.data, kbuf.length); ConnDis.c:1253: _XSend(dpy, (char *)&prefix, sz_xReq); FontInfo.c:65: _XSend (dpy, pattern, nbytes); FontInfo.c:66: /* use _XSend instead of Data, since subsequent _XReply will flush buffer */ FontNames.c:57: _XSend (dpy, pattern, nbytes); FontNames.c:58: /* use _XSend instead of Data, since following _XReply will flush buffer */ GetColor.c:89: _XSend(dpy, colorname, nbytes); GetColor.c:90: /* _XSend is more efficient that Data, since _XReply follows */ OpenDis.c:374: prefixread = _XSendClientPrefix(dpy, &client, PutImage.c:601:/* Cancel a GetReq operation, before doing _XSend or Data */ PutImage.c:748: _XSend(dpy, buf, length); PutImage.c:830: _XSend(dpy, (char *)dest, length); QuExt.c:47: _XSend(dpy, name, (long)req->nbytes); XlibInt.c:1768: * _XSend - Flush the buffer and send the client data. 32 bit word aligned XlibInt.c:1773:_XSend ( XlibInt.c:1790: fprintf(stderr, "_XSend: Sending data with [%d] bytes to write.\n", XlibInt.c:1798: fprintf(stderr, "_XSend: Returning with I/O error detected.\n"); XlibInt.c:1955: _XSend(dpy, XCMiscExtensionName, (long)qreq->nbytes); XlibInt.c:3759: * GetReq* and a call to Data* or _XSend*, or in a context when the thread XlibInt.c:3862: _XSend(dpy, data, len); Xintconn.h:23:extern Bool _XSendClientPrefix(Display *dpy, xConnClientPrefix *client, Xlibint.h:429:#define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */ Xlibint.h:568: _XSend(dpy, data, len);\ Xlibint.h:957:extern void _XSend( #### _XSendClientPrefix #### ConnDis.c:781:_XSendClientPrefix( OpenDis.c:374: prefixread = _XSendClientPrefix(dpy, &client, Xintconn.h:23:extern Bool _XSendClientPrefix(Display *dpy, xConnClientPrefix *client, #### _XSetClipRectangles #### Region.c:275: _XSetClipRectangles(dpy, gc, 0, 0, xr, r->numRects, YXBanded); SetCRects.c:33:void _XSetClipRectangles ( SetCRects.c:75: _XSetClipRectangles (dpy, gc, clip_x_origin, clip_y_origin, rectangles, n, Xlibint.h:1320:extern void _XSetClipRectangles ( #### _XSetImage #### GetImage.c:140: _XSetImage(temp_image, dest_image, dest_x, dest_y); ImUtil.c:109: * _XSetImage Writes an image data pattern into another image ImUtil.c:296:/* image->f.set_image = _XSetImage;*/ ImUtil.c:919:int _XSetImage( ImUtil.h:17:_XSetImage( #### _XSetLastRequestRead #### XKBUse.c:232: sev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); XKBUse.c:270: mev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); XKBUse.c:302: ev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); XKBUse.c:324: cev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); XKBUse.c:349: iev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); XKBUse.c:368: iev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); XKBUse.c:387: bev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); XKBUse.c:412: axev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); XKBUse.c:433: nev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); XKBUse.c:462: cmev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); XKBUse.c:483: amev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); XKBUse.c:508: edev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); XKBUse.c:536: nkev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); XKBUse.c:560: ev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); XlibInt.c:2084:_XSetLastRequestRead( XlibInt.c:2289: serial = _XSetLastRequestRead(dpy, (xGenericReply *)rep); XlibInt.c:2362: (void) _XSetLastRequestRead(dpy, &rep->generic); XlibInt.c:3088: ((XAnyEvent *)re)->serial = _XSetLastRequestRead(dpy, XlibInt.c:3644: event.xerror.serial = _XSetLastRequestRead(dpy, (xGenericReply *)rep); Xlibint.h:900:extern unsigned long _XSetLastRequestRead( #### _XStoreEventCookie #### ChkIfEv.c:62: _XStoreEventCookie(dpy, event); ChkIfEv.c:118: _XStoreEventCookie(dpy, event); ChkTypEv.c:60: _XStoreEventCookie(dpy, event); ChkTypWEv.c:62: _XStoreEventCookie(dpy, event); IfEvent.c:61: _XStoreEventCookie(dpy, event); NextEvent.c:60: _XStoreEventCookie(dpy, event); OpenDis.c:858: _XStoreEventCookie(dpy, &qelt->event); PeekEvent.c:55: _XStoreEventCookie(dpy, ©); PeekIfEv.c:63: _XStoreEventCookie(dpy, ©); XlibInt.c:2853:_XStoreEventCookie(Display *dpy, XEvent *event) Xlibint.h:1344:extern void _XStoreEventCookie( #### _XTextHeight16 #### omTextEsc.c:109: escapement += _XTextHeight16(font, buf2b, 1); TextExt16.c:166: * _XTextHeight16 - compute the height of sequence of XChar2bs. TextExt16.c:169:_XTextHeight16 ( Xlibint.h:1264:extern int _XTextHeight16( #### _XTextHeight #### omTextEsc.c:109: escapement += _XTextHeight16(font, buf2b, 1); omTextEsc.c:118: escapement += _XTextHeight(font, buf, 1); TextExt16.c:166: * _XTextHeight16 - compute the height of sequence of XChar2bs. TextExt16.c:169:_XTextHeight16 ( TextExt.c:191: * _XTextHeight - compute the height of a string of eightbit bytes. TextExt.c:194:_XTextHeight ( Xlibint.h:1258:extern int _XTextHeight( Xlibint.h:1264:extern int _XTextHeight16( #### _XTranslateKey #### KeyBind.c:756:_XTranslateKey( register Display *dpy, KeyBind.c:816:_XTranslateKeySym( KeyBind.c:886: if (! _XTranslateKey(event->display, event->keycode, event->state, KeyBind.c:893: return _XTranslateKeySym(event->display, symbol, event->state, XKBBind.c:258: return _XTranslateKey(dpy, key, mods, mods_rtrn, keysym_rtrn); XKBlibint.h:162:extern int _XTranslateKey( XKBlibint.h:170:extern int _XTranslateKeySym( #### _XTranslateKeySym #### KeyBind.c:816:_XTranslateKeySym( KeyBind.c:893: return _XTranslateKeySym(event->display, symbol, event->state, XKBlibint.h:170:extern int _XTranslateKeySym( #### _XTryShapeBitmapCursor #### CrCursor.c:34:_XTryShapeBitmapCursor (Display *dpy, CrCursor.c:57: cid = _XTryShapeBitmapCursor (dpy, source, mask, CrGlCur.c:208:_XTryShapeBitmapCursor (Display *dpy, Cr.h:20:extern Cursor _XTryShapeBitmapCursor( #### _XUnknownCopyEventCookie #### InitExt.c:287: if (proc == NULL) proc = (CopyEventCookieType)_XUnknownCopyEventCookie; XlibInt.c:3050:_XUnknownCopyEventCookie( Xlibint.h:990:extern Bool _XUnknownCopyEventCookie( #### _XUnknownNativeEvent #### EvToWire.c:43: * _XUnknownNativeEvent returns (i.e., False). EvToWire.c:403: return(_XUnknownNativeEvent(dpy, re, event)); InitExt.c:308: if (proc == NULL) proc = (EventToWireType) _XUnknownNativeEvent; OpenDis.c:248: dpy->wire_vec[X_Error] = _XUnknownNativeEvent; OpenDis.c:249: dpy->wire_vec[X_Reply] = _XUnknownNativeEvent; OpenDis.c:256: dpy->wire_vec[i] = _XUnknownNativeEvent; XlibInt.c:3065:_XUnknownNativeEvent( Xlibint.h:996:extern Status _XUnknownNativeEvent( #### _XUnknownWireEvent #### InitExt.c:245: if (proc == NULL) proc = (WireToEventType)_XUnknownWireEvent; InitExt.c:266: if (proc == NULL) proc = (WireToEventCookieType)_XUnknownWireEventCookie; OpenDis.c:246: dpy->event_vec[X_Error] = _XUnknownWireEvent; OpenDis.c:247: dpy->event_vec[X_Reply] = _XUnknownWireEvent; OpenDis.c:255: dpy->event_vec[i] = _XUnknownWireEvent; XlibInt.c:3022:_XUnknownWireEvent( XlibInt.c:3036:_XUnknownWireEventCookie( XlibInt.c:3445: return(_XUnknownWireEvent(dpy, re, event)); Xlibint.h:978:extern Bool _XUnknownWireEvent( Xlibint.h:984:extern Bool _XUnknownWireEventCookie( #### _XUnknownWireEventCookie #### InitExt.c:266: if (proc == NULL) proc = (WireToEventCookieType)_XUnknownWireEventCookie; XlibInt.c:3036:_XUnknownWireEventCookie( Xlibint.h:984:extern Bool _XUnknownWireEventCookie( #### _XUnlockMutex_fn #### locking.c:604: _XUnlockMutex_fn = _XUnlockMutex; XlibInt.c:93:void (*_XUnlockMutex_fn)( XlibInt.c:4201:void (**_XUnlockMutex_fn_p)(LockInfoPtr XlibInt.c:4206: ) = &_XUnlockMutex_fn; Xlibint.h:306:#define _XUnlockMutex_fn (*_XUnlockMutex_fn_p) Xlibint.h:324:extern void (*_XUnlockMutex_fn)( Xlibint.h:338:#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__) Xlibint.h:344:#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock) #### _XUnregisterFilter #### imDefFlt.c:300: _XUnregisterFilter (ic->core.im->core.display, imDefFlt.c:316: _XUnregisterFilter (ic->core.im->core.display, imDefFlt.c:404: _XUnregisterFilter(im->core.display, imInsClbk.c:254: _XUnregisterFilter( display, RootWindow(display, 0), imLcIc.c:47: _XUnregisterFilter(ic->core.im->core.display, imLcIc.c:62: _XUnregisterFilter(ic->core.im->core.display, imRm.c:2796: _XUnregisterFilter(ic->core.im->core.display, imThaiIc.c:53: _XUnregisterFilter(ic->core.im->core.display, ic->core.focus_window, imTrans.c:135: _XUnregisterFilter(im->core.display, spec->window, imTrX.c:236: _XUnregisterFilter(im->core.display, RegstFlt.c:137:_XUnregisterFilter( Xlcint.h:827:extern void _XUnregisterFilter( #### _XUnregisterInternalConnection #### imTrans.c:134: _XUnregisterInternalConnection(im->core.display, spec->fd); XlibInt.c:2509:/* _XUnregisterInternalConnection XlibInt.c:2518:_XUnregisterInternalConnection( XlibInt.c:2528: fprintf(stderr, "_XUnregisterInternalConnection: Got called.\n"); XlibInt.c:2645: * or _XUnregisterInternalConnection is called. Xlibint.h:1226:extern void _XUnregisterInternalConnection( #### _XUnresolveColor #### LookupCol.c:62: _XUnresolveColor(ccc, scr); XRGB.c:220: * _XUnresolveColor XRGB.c:225:_XUnresolveColor( Xcmsint.h:196:_XUnresolveColor( #### _XUpdateAtomCache #### GetAtomNm.c:79: _XUpdateAtomCache(dpy, name, atom, 0, -1, 0); GetAtomNm.c:133: _XUpdateAtomCache(dpy, state->names[state->idx], GetAtomNm.c:176: _XUpdateAtomCache(dpy, names_return[missed], atoms[missed], IntAtom.c:115:_XUpdateAtomCache( IntAtom.c:183: _XUpdateAtomCache(dpy, name, atom, sig, idx, n); IntAtom.c:234: _XUpdateAtomCache(dpy, state->names[i], (Atom) repl->atom, IntAtom.c:285: _XUpdateAtomCache(dpy, names[missed], (Atom) rep.atom, Xintatom.h:27:extern void _XUpdateAtomCache(Display *dpy, const char *name, Atom atom, #### _XUpdateGCCache #### ChGC.c:43: if (valuemask) _XUpdateGCCache (gc, valuemask, values); CrGC.c:87: if (valuemask) _XUpdateGCCache (gc, valuemask, values); CrGC.c:164:_XUpdateGCCache ( Cr.h:7:extern int _XUpdateGCCache( #### _XVIDtoVisual #### GetImage.c:96: image = XCreateImage(dpy, _XVIDtoVisual(dpy, rep.visual), GetImage.c:102: image = XCreateImage (dpy, _XVIDtoVisual(dpy, rep.visual), GetWAttrs.c:83: attr->visual = _XVIDtoVisual (dpy, repl->visualID); OpenDis.c:672: sp->root_visual = _XVIDtoVisual(dpy, root_visualID); VisUtil.c:145: vip->visual = _XVIDtoVisual(dpy, vp->visualid); VisUtil.c:227: visual_info->visual = _XVIDtoVisual(dpy, vp->visualid); XlibInt.c:3806:Visual *_XVIDtoVisual( Xlibint.h:896:extern Visual *_XVIDtoVisual( #### _XWireToEvent #### OpenDis.c:251: dpy->event_vec[i] = _XWireToEvent; XlibInt.c:3081:_XWireToEvent( Xlibint.h:1002:extern Bool _XWireToEvent(Display *dpy, XEvent *re, xEvent *event); #### _XcmsAddCmapRec #### cmsCmap.c:105: if ((pRec = _XcmsAddCmapRec(dpy, cmap, RootWindow(dpy, i), cmsCmap.c:200: if ((pRec = _XcmsAddCmapRec(dpy, cmap, tmpWindow, vp)) == NULL) cmsCmap.c:230: * _XcmsAddCmapRec cmsCmap.c:235:_XcmsAddCmapRec( cmsCmap.c:300: pRec_copy =_XcmsAddCmapRec(dpy, copy_cmap, pRec_src->windowID, CrCmap.c:55: _XcmsAddCmapRec(dpy, mid, w, visual); Xcmsint.h:179:_XcmsAddCmapRec( #### _XcmsArcTangent #### cmsTrig.c:530: * _XcmsArcTangent cmsTrig.c:535:_XcmsArcTangent(double x) Xcmsint.h:211:#define XCMS_ATAN(x) _XcmsArcTangent(x) Xcmsint.h:219:double _XcmsArcTangent(double a); #### _XcmsCIELabQueryMaxLCRGB #### LabGcL.c:119: if (_XcmsCIELabQueryMaxLCRGB (&myCCC, hue, &Lab_max, LabGcLC.c:141: if (_XcmsCIELabQueryMaxLCRGB (&myCCC, hue, &Lab_max, &rgb_max) LabMnL.c:119: if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LabMxC.c:125: if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LabMxL.c:119: if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LabMxLC.c:67: * _XcmsCIELabQueryMaxLCRGB - Compute maximum L* and chroma. LabMxLC.c:72:_XcmsCIELabQueryMaxLCRGB( LabMxLC.c:216: return(_XcmsCIELabQueryMaxLCRGB (&myCCC, radians(hue_angle), pColor_return, Cv.h:67:_XcmsCIELabQueryMaxLCRGB( #### _XcmsCIELab_prefix #### cmsGlobls.c:107:const char _XcmsCIELab_prefix[] = "cielab"; cmsGlobls.c:120: { _XcmsCIELab_prefix, XcmsCIELabFormat }, Lab.c:99: _XcmsCIELab_prefix, /* prefix */ Lab.c:152: if (strncmp(spec, _XcmsCIELab_prefix, n) != 0) { Cv.h:9:extern const char _XcmsCIELab_prefix[]; #### _XcmsCIELuvQueryMaxLCRGB #### LuvGcL.c:119: if (_XcmsCIELuvQueryMaxLCRGB (&myCCC, hue, &Luv_max, LuvGcLC.c:141: if (_XcmsCIELuvQueryMaxLCRGB (&myCCC, hue, &Luv_max, &rgb_max) LuvMnL.c:119: if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LuvMxC.c:125: if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LuvMxL.c:119: if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) LuvMxLC.c:67: * _XcmsCIELuvQueryMaxLCRGB - Compute maximum L* and chroma. LuvMxLC.c:72:_XcmsCIELuvQueryMaxLCRGB( LuvMxLC.c:216: return(_XcmsCIELuvQueryMaxLCRGB (&myCCC, radians(hue_angle), pColor_return, Cv.h:129:_XcmsCIELuvQueryMaxLCRGB( #### _XcmsCIELuv_prefix #### cmsGlobls.c:108:const char _XcmsCIELuv_prefix[] = "cieluv"; cmsGlobls.c:121: { _XcmsCIELuv_prefix, XcmsCIELuvFormat }, Luv.c:102: _XcmsCIELuv_prefix, /* prefix */ Luv.c:155: if (strncmp(spec, _XcmsCIELuv_prefix, n) != 0) { Cv.h:10:extern const char _XcmsCIELuv_prefix[]; #### _XcmsCIEXYZ_ValidSpec #### Lab.c:393: if (!_XcmsCIEXYZ_ValidSpec(pColor)) { uvY.c:380: if (!_XcmsCIEXYZ_ValidSpec(pColor)) { xyY.c:377: if (!_XcmsCIEXYZ_ValidSpec(pColor)) { XYZ.c:166: return(_XcmsCIEXYZ_ValidSpec(pColor)); XYZ.c:183:_XcmsCIEXYZ_ValidSpec( Cv.h:51:_XcmsCIEXYZ_ValidSpec( #### _XcmsCIEXYZ_prefix #### cmsGlobls.c:104:const char _XcmsCIEXYZ_prefix[] = "ciexyz"; cmsGlobls.c:117: { _XcmsCIEXYZ_prefix, XcmsCIEXYZFormat }, XYZ.c:82: _XcmsCIEXYZ_prefix, /* prefix */ XYZ.c:134: if (strncmp(spec, _XcmsCIEXYZ_prefix, n) != 0) { Cv.h:6:extern const char _XcmsCIEXYZ_prefix[]; #### _XcmsCIEuvY_ValidSpec #### HVC.c:504: if (!_XcmsCIEuvY_ValidSpec(pColor)) { Luv.c:377: if (!_XcmsCIEuvY_ValidSpec(pColor)) { uvY.c:181: return(_XcmsCIEuvY_ValidSpec(pColor)); uvY.c:198:_XcmsCIEuvY_ValidSpec( uvY.c:266: if (!_XcmsCIEuvY_ValidSpec(pColor)) { Cv.h:54:_XcmsCIEuvY_ValidSpec( #### _XcmsCIEuvY_prefix #### cmsGlobls.c:105:const char _XcmsCIEuvY_prefix[] = "cieuvy"; cmsGlobls.c:118: { _XcmsCIEuvY_prefix, XcmsCIEuvYFormat }, uvY.c:95: _XcmsCIEuvY_prefix, /* prefix */ uvY.c:149: if (strncmp(spec, _XcmsCIEuvY_prefix, n) != 0) { Cv.h:7:extern const char _XcmsCIEuvY_prefix[]; #### _XcmsCIExyY_prefix #### cmsGlobls.c:106:const char _XcmsCIExyY_prefix[] = "ciexyy"; cmsGlobls.c:119: { _XcmsCIExyY_prefix, XcmsCIExyYFormat }, xyY.c:94: _XcmsCIExyY_prefix, /* prefix */ xyY.c:148: if (strncmp(spec, _XcmsCIExyY_prefix, n) != 0) { Cv.h:8:extern const char _XcmsCIExyY_prefix[]; #### _XcmsConvertColorsWithWhitePt #### CvColW.c:53: * _XcmsConvertColorsWithWhitePt - Convert XcmsColor structures CvColW.c:58:_XcmsConvertColorsWithWhitePt( HVCGcVC.c:215: if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, HVCMxC.c:178: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, HVCMxV.c:187: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, HVCMxVC.c:124: if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, HVCMxVC.c:157: if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, HVCMxVs.c:150: if (_XcmsConvertColorsWithWhitePt(&myCCC, pHVC, HVCWpAj.c:104: if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, HVCWpAj.c:112: return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtTo, LabGcLC.c:181: if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, LabMnL.c:170: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, LabMxC.c:166: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, LabMxL.c:170: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, LabMxLC.c:116: if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc), LabMxLC.c:149: if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, LabWpAj.c:87: if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, LabWpAj.c:95: return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, LuvGcLC.c:181: if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, LuvMnL.c:170: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, LuvMxC.c:167: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, LuvMxL.c:170: if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, LuvMxLC.c:116: if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc), LuvMxLC.c:149: if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, LuvWpAj.c:86: if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, LuvWpAj.c:94: return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtTo, Cv.h:73:_XcmsConvertColorsWithWhitePt( #### _XcmsCopyCmapRecAndFree #### cmsCmap.c:276: * _XcmsCopyCmapRecAndFree cmsCmap.c:281:_XcmsCopyCmapRecAndFree( CopyCmap.c:38:extern XcmsCmapRec * _XcmsCopyCmapRecAndFree(Display *dpy, CopyCmap.c:60: _XcmsCopyCmapRecAndFree(dpy, src_cmap, mid); Cv.h:147:_XcmsCopyCmapRecAndFree( #### _XcmsCopyISOLatin1Lowered #### cmsColNm.c:217: _XcmsCopyISOLatin1Lowered(string_lowered, color_string); cmsColNm.c:426: _XcmsCopyISOLatin1Lowered(name_lowered, tmpName); cmsColNm.c:691: _XcmsCopyISOLatin1Lowered(pString, f1); cmsColNm.c:695: _XcmsCopyISOLatin1Lowered(pString, f2); cmsColNm.c:787: * _XcmsCopyISOLatin1Lowered cmsColNm.c:792:_XcmsCopyISOLatin1Lowered( IdOfPr.c:74: _XcmsCopyISOLatin1Lowered(string_lowered, prefix); Cv.h:152:_XcmsCopyISOLatin1Lowered( #### _XcmsCopyPointerArray #### cmsInt.c:61: * _XcmsCopyPointerArray cmsInt.c:66:_XcmsCopyPointerArray( Cv.h:40:_XcmsCopyPointerArray( #### _XcmsCosine #### cmsTrig.c:122: * _XcmsCosine double precision cosine cmsTrig.c:138: * double _XcmsCosine (x) cmsTrig.c:225:double _XcmsCosine(double x) cmsTrig.c:240: retval = -(_XcmsCosine (x - XCMS_PI)); cmsTrig.c:242: retval = -(_XcmsCosine (x + XCMS_PI)); cmsTrig.c:514: retval = _XcmsCosine (XCMS_HALFPI - x); cmsTrig.c:516: retval = -(_XcmsCosine (XCMS_HALFPI + x)); Xcmsint.h:212:#define XCMS_COS(x) _XcmsCosine(x) Xcmsint.h:220:double _XcmsCosine(double a); #### _XcmsCubeRoot #### cmsMath.c:58:_XcmsCubeRoot(double a) cmsMath.c:63: printf("_XcmsCubeRoot passed in %g\n", a); cmsMath.c:92: printf("_XcmsCubeRoot returning %g\n", cur_guess); Xcmsint.h:213:#define XCMS_CUBEROOT(x) _XcmsCubeRoot(x) Xcmsint.h:221:double _XcmsCubeRoot(double a); #### _XcmsDDColorSpaces #### AddSF.c:110: * _XcmsDDColorSpaces. AddSF.c:114: for (paptmpCS = _XcmsDDColorSpaces; *paptmpCS != NULL; AddSF.c:126: (XPointer *) _XcmsDDColorSpaces, AddSF.c:128: (XPointer *) _XcmsDDColorSpacesInit)) == NULL) { AddSF.c:131: _XcmsDDColorSpaces = paptmpCS; cmsGlobls.c:71:XcmsColorSpace *_XcmsDDColorSpacesInit[] = { cmsGlobls.c:81:XcmsColorSpace **_XcmsDDColorSpaces = &_XcmsDDColorSpacesInit[0]; IdOfPr.c:93: papColorSpaces = _XcmsDDColorSpaces; PrOfId.c:86: papColorSpaces = _XcmsDDColorSpaces; Cv.h:28:extern XcmsColorSpace *_XcmsDDColorSpacesInit[]; Cv.h:29:extern XcmsColorSpace **_XcmsDDColorSpaces; #### _XcmsDDColorSpacesInit #### AddSF.c:128: (XPointer *) _XcmsDDColorSpacesInit)) == NULL) { cmsGlobls.c:71:XcmsColorSpace *_XcmsDDColorSpacesInit[] = { cmsGlobls.c:81:XcmsColorSpace **_XcmsDDColorSpaces = &_XcmsDDColorSpacesInit[0]; Cv.h:28:extern XcmsColorSpace *_XcmsDDColorSpacesInit[]; #### _XcmsDDConvertColors #### cmsColNm.c:943: return(_XcmsDDConvertColors(ccc, pColor_exact_return, cmsColNm.c:956: if (_XcmsDDConvertColors(ccc, pColor_exact_return, 1, cmsColNm.c:995: return (_XcmsDDConvertColors(ccc, pColor_exact_return, 1, CvCols.c:320: retval_tmp = _XcmsDDConvertColors(ccc, pColors_start, CvCols.c:332: retval_tmp = _XcmsDDConvertColors(ccc, pColors_start, nBatch, CvCols.c:541: * _XcmsDDConvertColors - Convert XcmsColor structures CvCols.c:546:_XcmsDDConvertColors( CvCols.c:829: retval = _XcmsDDConvertColors(ccc, pColors_tmp, nColors, CvCols.c:860: retval = _XcmsDDConvertColors(ccc, pColors_tmp, nColors, CvCols.c:880: if (_XcmsDDConvertColors(ccc, pColors_tmp, nColors, CvCols.c:979: retval = _XcmsDDConvertColors(ccc, pColors_tmp, nColors, CvColW.c:105: return(_XcmsDDConvertColors(ccc, pColors_in_out, nColors, newFormat, CvColW.c:126: return(_XcmsDDConvertColors(ccc, pColors_in_out, nColors, newFormat, CvColW.c:133: if (_XcmsDDConvertColors(ccc, pColors_in_out, nColors, Cv.h:89:_XcmsDDConvertColors( #### _XcmsDIColorSpaces #### AddDIC.c:94: if ((papColorSpaces = _XcmsDIColorSpaces) != NULL) { AddDIC.c:121: if ((papColorSpaces = _XcmsDIColorSpaces) != NULL) { AddDIC.c:142: _XcmsPushPointerArray((XPointer *)_XcmsDIColorSpaces, AddDIC.c:144: (XPointer *)_XcmsDIColorSpacesInit)) == NULL) { AddDIC.c:147: _XcmsDIColorSpaces = papColorSpaces; cmsColNm.c:144: papColorSpaces = _XcmsDIColorSpaces; cmsGlobls.c:51:XcmsColorSpace *_XcmsDIColorSpacesInit[] = { cmsGlobls.c:66:XcmsColorSpace **_XcmsDIColorSpaces = _XcmsDIColorSpacesInit; CvCols.c:120: papColorSpaces = _XcmsDIColorSpaces; CvCols.c:167: papRec = _XcmsDIColorSpaces; IdOfPr.c:79: papColorSpaces = _XcmsDIColorSpaces; PrOfId.c:73: papColorSpaces = _XcmsDIColorSpaces; Cv.h:25:extern XcmsColorSpace *_XcmsDIColorSpacesInit[]; Cv.h:26:extern XcmsColorSpace **_XcmsDIColorSpaces; #### _XcmsDIColorSpacesInit #### AddDIC.c:144: (XPointer *)_XcmsDIColorSpacesInit)) == NULL) { cmsGlobls.c:51:XcmsColorSpace *_XcmsDIColorSpacesInit[] = { cmsGlobls.c:66:XcmsColorSpace **_XcmsDIColorSpaces = _XcmsDIColorSpacesInit; Cv.h:25:extern XcmsColorSpace *_XcmsDIColorSpacesInit[]; #### _XcmsDIConvertColors #### cmsColNm.c:960: return(_XcmsDIConvertColors(ccc, pColor_exact_return, cmsColNm.c:990: if (_XcmsDIConvertColors(ccc, pColor_exact_return, cmsColNm.c:1023: return (_XcmsDIConvertColors(ccc, pColor_exact_return, cmsColNm.c:1039: if (_XcmsDIConvertColors(ccc, pColor_exact_return, cmsColNm.c:1047: return(_XcmsDIConvertColors(ccc, pColor_exact_return, CvCols.c:296: retval_tmp = _XcmsDIConvertColors(ccc, pColors_start, pWhitePt, CvCols.c:378: if (_XcmsDIConvertColors(ccc, &tmp1, (XcmsColor *) NULL, 1, CvCols.c:385: if (_XcmsDIConvertColors(ccc, &tmp2, (XcmsColor *) NULL, 1, CvCols.c:397: * _XcmsDIConvertColors - Convert XcmsColor structures CvCols.c:402:_XcmsDIConvertColors( CvCols.c:821: retval = _XcmsDIConvertColors(ccc, pColors_tmp, CvCols.c:855: if (_XcmsDIConvertColors(ccc, pColors_tmp, CvCols.c:884: retval = _XcmsDIConvertColors(ccc, pColors_tmp, CvColW.c:98: return(_XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors, CvColW.c:121: if (_XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors, CvColW.c:138: return(_XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors, HVC.c:367: if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, HVC.c:486: if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, HVCGcC.c:118: _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, HVCGcC.c:121: _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, HVCGcC.c:129: if (_XcmsDIConvertColors(ccc, pColor, HVCGcC.c:142: retval = _XcmsDIConvertColors(ccc, pColor, HVCGcV.c:126: if (_XcmsDIConvertColors(&myCCC, pColor, HVCGcV.c:153: retval = _XcmsDIConvertColors(&myCCC, pColor, HVCGcV.c:174: retval = _XcmsDIConvertColors(&myCCC, pColor, HVCGcV.c:180: if (_XcmsDIConvertColors(ccc, pColor, HVCGcV.c:193: retval = _XcmsDIConvertColors(&myCCC, pColor, HVCGcVC.c:134: _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, HVCGcVC.c:137: _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, HVCGcVC.c:145: if (_XcmsDIConvertColors(&myCCC, pColor, HVCGcVC.c:168: retval = _XcmsDIConvertColors(&myCCC, pColor, HVCGcVC.c:188: retval = _XcmsDIConvertColors(&myCCC, pColor, HVCGcVC.c:254: retval = _XcmsDIConvertColors(&myCCC, pColor, Lab.c:270: if (!_XcmsDIConvertColors(ccc, &whitePt, Lab.c:373: if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, LabGcC.c:97: _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), LabGcC.c:99: _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), LabGcC.c:107: if (_XcmsDIConvertColors(ccc, pColor, LabGcC.c:120: retval = _XcmsDIConvertColors(ccc, pColor, LabGcL.c:106: if (_XcmsDIConvertColors(&myCCC, pColor, LabGcL.c:131: retval = _XcmsDIConvertColors(&myCCC, pColor, LabGcL.c:141: if (_XcmsDIConvertColors(ccc, pColor, LabGcL.c:151: retval = _XcmsDIConvertColors(&myCCC, pColor, LabGcL.c:156: if (_XcmsDIConvertColors(ccc, pColor, LabGcL.c:166: retval = _XcmsDIConvertColors(&myCCC, pColor, LabGcLC.c:116: _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), LabGcLC.c:118: _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), LabGcLC.c:127: if (_XcmsDIConvertColors(&myCCC, pColor, LabGcLC.c:152: retval = _XcmsDIConvertColors(&myCCC, pColor, LabGcLC.c:215: retval = _XcmsDIConvertColors(&myCCC, pColor, Luv.c:269: if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, Luv.c:361: if (!_XcmsDIConvertColors(ccc, &whitePt, LuvGcC.c:97: _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), LuvGcC.c:99: _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), LuvGcC.c:107: if (_XcmsDIConvertColors(ccc, pColor, LuvGcC.c:120: retval = _XcmsDIConvertColors(ccc, pColor, LuvGcL.c:106: if (_XcmsDIConvertColors(&myCCC, pColor, LuvGcL.c:131: retval = _XcmsDIConvertColors(&myCCC, pColor, LuvGcL.c:141: if (_XcmsDIConvertColors(ccc, pColor, LuvGcL.c:151: retval = _XcmsDIConvertColors(&myCCC, pColor, LuvGcL.c:156: if (_XcmsDIConvertColors(ccc, pColor, LuvGcL.c:166: retval = _XcmsDIConvertColors(&myCCC, pColor, LuvGcLC.c:116: _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), LuvGcLC.c:118: _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), LuvGcLC.c:127: if (_XcmsDIConvertColors(&myCCC, pColor, LuvGcLC.c:152: retval = _XcmsDIConvertColors(&myCCC, pColor, LuvGcLC.c:215: retval = _XcmsDIConvertColors(&myCCC, pColor, uvY.c:289: if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, uvY.c:398: if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, xyY.c:288: if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, Cv.h:82:_XcmsDIConvertColors( #### _XcmsDeleteCmapRec #### cmsCmap.c:315: * _XcmsDeleteCmapRec cmsCmap.c:320:_XcmsDeleteCmapRec( FreeCmap.c:48: _XcmsDeleteCmapRec(dpy, cmap); Cmap.h:8:_XcmsDeleteCmapRec( #### _XcmsEqualWhitePts #### cmsColNm.c:950: if (ccc->whitePtAdjProc && !_XcmsEqualWhitePts(ccc, cmsColNm.c:983: if (ccc->whitePtAdjProc && !_XcmsEqualWhitePts(ccc, cmsColNm.c:1003: if (ccc->whitePtAdjProc && !_XcmsEqualWhitePts(ccc, cmsColNm.c:1014: } else if (_XcmsEqualWhitePts(ccc, CvCols.c:309: if ((ccc->whitePtAdjProc != NULL) && !_XcmsEqualWhitePts(ccc, CvCols.c:358: * _XcmsEqualWhitePts CvCols.c:363:_XcmsEqualWhitePts(XcmsCCC ccc, XcmsColor *pWhitePt1, XcmsColor *pWhitePt2) CvCols.c:784: } else if ((ccc->whitePtAdjProc != NULL) && !_XcmsEqualWhitePts(ccc, Cv.h:156:_XcmsEqualWhitePts( #### _XcmsFreeIntensityMaps #### cmsInt.c:349: * _XcmsFreeIntensityMaps cmsInt.c:354:_XcmsFreeIntensityMaps( LRGB.c:674: dpy->free_funcs->intensityMaps = _XcmsFreeIntensityMaps; Cv.h:164:_XcmsFreeIntensityMaps( Xlibint.h:743: FreeFuncType intensityMaps; /* _XcmsFreeIntensityMaps */ #### _XcmsFreePointerArray #### cmsInt.c:94: * _XcmsFreePointerArray cmsInt.c:99:_XcmsFreePointerArray( cmsInt.c:150: _XcmsFreePointerArray(pap); Cv.h:43:_XcmsFreePointerArray( #### _XcmsGetElement #### cmsProp.c:52: * _XcmsGetElement -- get an element value from the property passed cmsProp.c:57:_XcmsGetElement( LRGB.c:511: *pValue++ = (long)_XcmsGetElement(format_return, &pChar, LRGB.c:639: visualID = _XcmsGetElement(format_return, &pChar, &nitems); LRGB.c:642: visualID |= _XcmsGetElement(format_return, &pChar, &nitems); LRGB.c:677: cType = _XcmsGetElement(format_return, &pChar, &nitems); LRGB.c:678: nTables = _XcmsGetElement(format_return, &pChar, &nitems); LRGB.c:909: _XcmsGetElement(format, pChar, pCount) + 1; LRGB.c:919: pIRec->value = _XcmsGetElement (format, pChar, pCount) * 0x101; LRGB.c:921: _XcmsGetElement (format, pChar, pCount) / (XcmsFloat)255.0; LRGB.c:926: pIRec->value = _XcmsGetElement (format, pChar, pCount); LRGB.c:927: pIRec->intensity = _XcmsGetElement (format, pChar, pCount) LRGB.c:933: pIRec->value = _XcmsGetElement (format, pChar, pCount); LRGB.c:934: pIRec->intensity = _XcmsGetElement (format, pChar, pCount) LRGB.c:970: max_index = _XcmsGetElement(format, pChar, pCount); LRGB.c:981: pIRec->intensity = _XcmsGetElement (format, pChar, pCount) LRGB.c:988: pIRec->intensity = _XcmsGetElement (format, pChar, pCount) LRGB.c:995: pIRec->intensity = _XcmsGetElement (format, pChar, pCount) Cv.h:176:_XcmsGetElement( #### _XcmsGetIntensityMap #### CCC.c:146: if ((pIMap = _XcmsGetIntensityMap(dpy, visual)) != NULL) { CCC.c:280: if (_XcmsGetIntensityMap(ccc->dpy, ccc->visual) != NULL) { cmsInt.c:382: * _XcmsGetIntensityMap cmsInt.c:387:_XcmsGetIntensityMap( Cv.h:136:_XcmsGetIntensityMap( #### _XcmsGetProperty #### cmsProp.c:98: * _XcmsGetProperty -- Determine the existance of a property cmsProp.c:103:_XcmsGetProperty( LRGB.c:494: !_XcmsGetProperty (dpy, RootWindow(dpy, screenNumber), MatrixAtom, LRGB.c:574: !_XcmsGetProperty (dpy, RootWindow(dpy, screenNumber), CorrectAtom, Cv.h:167:_XcmsGetProperty( #### _XcmsInitDefaultCCCs #### CCC.c:200: if (!_XcmsInitDefaultCCCs(dpy)) { cmsInt.c:157: * _XcmsInitDefaultCCCs cmsInt.c:162:_XcmsInitDefaultCCCs( cmsInt.c:303: if (!_XcmsInitDefaultCCCs(dpy)) { Cv.h:140:_XcmsInitDefaultCCCs( #### _XcmsInitScrnInfo #### CCC.c:210: * _XcmsInitScrnInfo routine will create the XcmsPerScrnInfo CCC.c:214: if (!_XcmsInitScrnInfo(dpy, screenNumber)) { CCC.c:237: if (!_XcmsInitScrnInfo(dpy, screenNumber)) { cmsInt.c:276: * _XcmsInitScrnInfo cmsInt.c:281:_XcmsInitScrnInfo( Cv.h:143:_XcmsInitScrnInfo( #### _XcmsLRGB_InitScrnDefault #### cmsInt.c:343: return(_XcmsLRGB_InitScrnDefault(dpy, screenNumber, defaultccc->pPerScrnInfo)); LRGB.c:1802:_XcmsLRGB_InitScrnDefault( Cv.h:159:_XcmsLRGB_InitScrnDefault( #### _XcmsPushPointerArray #### AddDIC.c:142: _XcmsPushPointerArray((XPointer *)_XcmsDIColorSpaces, AddSF.c:125: if ((paptmpCS = (XcmsColorSpace **)_XcmsPushPointerArray( AddSF.c:137: _XcmsPushPointerArray((XPointer *) _XcmsSCCFuncSets, cmsInt.c:115: * _XcmsPushPointerArray cmsInt.c:120:_XcmsPushPointerArray( Cv.h:46:_XcmsPushPointerArray( #### _XcmsRGB_prefix #### cmsGlobls.c:114:const char _XcmsRGB_prefix[] = "rgb"; cmsGlobls.c:123: { _XcmsRGB_prefix, XcmsRGBFormat }, LRGB.c:181: _XcmsRGB_prefix, /* prefix */ LRGB.c:1337: if (strncmp(spec, _XcmsRGB_prefix, n) != 0) { Cv.h:13:extern const char _XcmsRGB_prefix[]; #### _XcmsRGB_to_XColor #### cmsAllNCol.c:120: _XcmsRGB_to_XColor(&tmpColor, &XColor_in_out, 1); GetColor.c:62: _XcmsRGB_to_XColor(&cmsColor_exact, exact_def, 1); LookupCol.c:60: _XcmsRGB_to_XColor(&cmsColor_exact, def, 1); ParseCol.c:98: _XcmsRGB_to_XColor(&cmsColor, def, 1); SetGetCols.c:131: _XcmsRGB_to_XColor(pColors_in_out, &XColors_in_out, 1); SetGetCols.c:262: _XcmsRGB_to_XColor(pColors_in_out, pXColors_in_out, nColors); StNColor.c:56: _XcmsRGB_to_XColor(&cmsColor_exact, &scr_def, 1); XRGB.c:77: * _XcmsRGB_to_XColor - XRGB.c:82:_XcmsRGB_to_XColor( Xcmsint.h:185:_XcmsRGB_to_XColor( #### _XcmsRGBi_prefix #### cmsGlobls.c:113:const char _XcmsRGBi_prefix[] = "rgbi"; cmsGlobls.c:124: { _XcmsRGBi_prefix, XcmsRGBiFormat }, LRGB.c:168: _XcmsRGBi_prefix, /* prefix */ LRGB.c:1416: if (strncmp(spec, _XcmsRGBi_prefix, n) != 0) { Cv.h:12:extern const char _XcmsRGBi_prefix[]; #### _XcmsRegColorSpaces #### cmsGlobls.c:116:XcmsRegColorSpaceEntry _XcmsRegColorSpaces[] = { CvCols.c:1021: XcmsRegColorSpaceEntry *pEntry = _XcmsRegColorSpaces; Cv.h:36:extern XcmsRegColorSpaceEntry _XcmsRegColorSpaces[]; #### _XcmsRegFormatOfPrefix #### AddDIC.c:77: if ((pCS->id = _XcmsRegFormatOfPrefix(pCS->prefix)) != 0) { AddSF.c:97: if ((pNewCS->id = _XcmsRegFormatOfPrefix(pNewCS->prefix)) != 0) { CvCols.c:1009:_XcmsRegFormatOfPrefix( Cv.h:96:_XcmsRegFormatOfPrefix( #### _XcmsResolveColor #### cmsAllNCol.c:99: if ((retval1 = _XcmsResolveColorString(ccc, &colorname, cmsColNm.c:831: * _XcmsResolveColorString - cmsColNm.c:836:_XcmsResolveColorString ( cmsLkCol.c:96: if ((retval1 = _XcmsResolveColorString(ccc, &colorname, cmsLkCol.c:134: _XcmsResolveColor(ccc, pColor_scrn_return); GetColor.c:58: switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact, LookupCol.c:56: switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact, ParseCol.c:93: switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor, StNColor.c:54: if (_XcmsResolveColorString(ccc, &name, &cmsColor_exact, XRGB.c:145: * _XcmsResolveColor XRGB.c:150:_XcmsResolveColor( Cv.h:185:_XcmsResolveColor( Xcmsint.h:190:_XcmsResolveColorString ( #### _XcmsResolveColorString #### cmsAllNCol.c:99: if ((retval1 = _XcmsResolveColorString(ccc, &colorname, cmsColNm.c:831: * _XcmsResolveColorString - cmsColNm.c:836:_XcmsResolveColorString ( cmsLkCol.c:96: if ((retval1 = _XcmsResolveColorString(ccc, &colorname, GetColor.c:58: switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact, LookupCol.c:56: switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact, ParseCol.c:93: switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor, StNColor.c:54: if (_XcmsResolveColorString(ccc, &name, &cmsColor_exact, Xcmsint.h:190:_XcmsResolveColorString ( #### _XcmsSCCFuncSets #### AddSF.c:82: XcmsFunctionSet **papSCCFuncSets = _XcmsSCCFuncSets; AddSF.c:137: _XcmsPushPointerArray((XPointer *) _XcmsSCCFuncSets, AddSF.c:139: (XPointer *)_XcmsSCCFuncSetsInit)) == NULL) { AddSF.c:142: _XcmsSCCFuncSets = papSCCFuncSets; cmsGlobls.c:86:XcmsFunctionSet *_XcmsSCCFuncSetsInit[] = { cmsGlobls.c:98:XcmsFunctionSet **_XcmsSCCFuncSets = _XcmsSCCFuncSetsInit; cmsInt.c:294: XcmsFunctionSet **papSCCFuncSet = _XcmsSCCFuncSets; Cv.h:33:extern XcmsFunctionSet *_XcmsSCCFuncSetsInit[]; Cv.h:34:extern XcmsFunctionSet **_XcmsSCCFuncSets; #### _XcmsSCCFuncSetsInit #### AddSF.c:139: (XPointer *)_XcmsSCCFuncSetsInit)) == NULL) { cmsGlobls.c:86:XcmsFunctionSet *_XcmsSCCFuncSetsInit[] = { cmsGlobls.c:98:XcmsFunctionSet **_XcmsSCCFuncSets = _XcmsSCCFuncSetsInit; Cv.h:33:extern XcmsFunctionSet *_XcmsSCCFuncSetsInit[]; #### _XcmsSetGetColor #### cmsAllCol.c:72: return(_XcmsSetGetColor(XAllocColor, dpy, colormap, pXcmsColor_in_out, QuCol.c:76: return(_XcmsSetGetColor(XQueryColor, dpy, colormap, QuCols.c:76: return(_XcmsSetGetColors(XQueryColors, dpy, colormap, SetGetCols.c:30: * Source for _XcmsSetGetColors() SetGetCols.c:61:_XcmsSetGetColor( SetGetCols.c:178:_XcmsSetGetColors( StCol.c:80: return(_XcmsSetGetColor(XStoreColor, dpy, colormap, StCols.c:98: retval = _XcmsSetGetColors (XStoreColors, dpy, colormap, Cv.h:105:_XcmsSetGetColor( Cv.h:116:_XcmsSetGetColors( #### _XcmsSetGetColors #### QuCols.c:76: return(_XcmsSetGetColors(XQueryColors, dpy, colormap, SetGetCols.c:30: * Source for _XcmsSetGetColors() SetGetCols.c:178:_XcmsSetGetColors( StCols.c:98: retval = _XcmsSetGetColors (XStoreColors, dpy, colormap, Cv.h:116:_XcmsSetGetColors( #### _XcmsSine #### cmsTrig.c:244: retval = _XcmsSine (XCMS_HALFPI - x); cmsTrig.c:246: retval = _XcmsSine (XCMS_HALFPI + x); cmsTrig.c:390: * _XcmsSine double precision sine cmsTrig.c:406: * double _XcmsSine (x) cmsTrig.c:495:_XcmsSine (double x) cmsTrig.c:510: retval = -(_XcmsSine (x - XCMS_PI)); cmsTrig.c:512: retval = -(_XcmsSine (x + XCMS_PI)); Xcmsint.h:215:#define XCMS_SIN(x) _XcmsSine(x) Xcmsint.h:222:double _XcmsSine(double a); #### _XcmsSquareRoot #### cmsMath.c:102:_XcmsSquareRoot(double a) cmsMath.c:107: printf("_XcmsSquareRoot passed in %g\n", a); cmsMath.c:136: printf("_XcmsSquareRoot returning %g\n", cur_guess); cmsTrig.c:248: retval = _XcmsSquareRoot (1.0 - (x * x)); cmsTrig.c:560: ai = _XcmsSquareRoot( 1.0 / (1.0 + (x * x)) ); cmsTrig.c:564: b1 = _XcmsSquareRoot((a1 * bi)); cmsTrig.c:576: a1 = _XcmsSquareRoot(1 + (x * x)); Xcmsint.h:216:#define XCMS_SQRT(x) _XcmsSquareRoot(x) Xcmsint.h:223:double _XcmsSquareRoot(double a); #### _XcmsTekHVCQueryMaxVCRGB #### HVCGcV.c:140: if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, hvc_max.spec.TekHVC.H, &hvc_max, HVCGcVC.c:158: if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, hvc_max.spec.TekHVC.H, &hvc_max, HVCMnV.c:138: if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, max_vc.spec.TekHVC.H, &max_vc, HVCMxC.c:139: if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, hue, &max_vc, &rgb_saved) HVCMxV.c:138: if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, max_vc.spec.TekHVC.H, &max_vc, &rgb_saved) HVCMxVC.c:73: * _XcmsTekHVCQueryMaxVCRGB - Compute maximum value/chroma. HVCMxVC.c:78:_XcmsTekHVCQueryMaxVCRGB( HVCMxVC.c:233: return(_XcmsTekHVCQueryMaxVCRGB (&myCCC, hue, pColor_return, HVCMxVs.c:135: if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, pColor_in_out->spec.TekHVC.H, Cv.h:61:_XcmsTekHVCQueryMaxVCRGB( #### _XcmsTekHVC_CheckModify #### HVC.c:579: * _XcmsTekHVC_CheckModify HVC.c:584:_XcmsTekHVC_CheckModify( HVCGcV.c:133: if (!_XcmsTekHVC_CheckModify (pColor)) { HVCGcV.c:150: if (!_XcmsTekHVC_CheckModify (pColor)) { HVCGcV.c:171: if (!_XcmsTekHVC_CheckModify (pColor)) { HVCGcVC.c:151: if (!_XcmsTekHVC_CheckModify(pColor)) { HVCGcVC.c:221: if (!_XcmsTekHVC_CheckModify(pColor)) { HVCGcVC.c:251: if (!_XcmsTekHVC_CheckModify(pColor)) { HVCMnV.c:131: if (!_XcmsTekHVC_CheckModify (&tmp)) { HVCMnV.c:157: if (_XcmsTekHVC_CheckModify (&tmp)) { HVCMxC.c:133: if (!_XcmsTekHVC_CheckModify(&tmp)) { HVCMxC.c:150: if (_XcmsTekHVC_CheckModify (&tmp)) { HVCMxC.c:189: if (_XcmsTekHVC_CheckModify (&tmp)) { HVCMxC.c:214: if (_XcmsTekHVC_CheckModify (&tmp)) { HVCMxV.c:130: if (!_XcmsTekHVC_CheckModify (&tmp)) { HVCMxV.c:218: if (!_XcmsTekHVC_CheckModify(&tmp)) { Cv.h:57:_XcmsTekHVC_CheckModify( #### _XcmsTekHVC_prefix #### cmsGlobls.c:109:const char _XcmsTekHVC_prefix[] = "tekhvc"; cmsGlobls.c:122: { _XcmsTekHVC_prefix, XcmsTekHVCFormat }, HVC.c:134: _XcmsTekHVC_prefix, /* prefix */ HVC.c:190: if (strncmp(spec, _XcmsTekHVC_prefix, n) != 0) { Cv.h:11:extern const char _XcmsTekHVC_prefix[]; #### _XcmsUnresolveColor #### cmsLkCol.c:132: _XcmsUnresolveColor(ccc, pColor_scrn_return); XRGB.c:191: * _XcmsUnresolveColor XRGB.c:196:_XcmsUnresolveColor( Cv.h:181:_XcmsUnresolveColor( #### _Xdebug #### globals.c:80:ZEROINIT (int, _Xdebug, 0); OpenDis.c:735: (void) XSynchronize(dpy, _Xdebug); XlibInt.c:4190:#undef _Xdebug XlibInt.c:4191:int _Xdebug = 0; XlibInt.c:4192:int *_Xdebug_p = &_Xdebug; Xlib.h:1390:#define _Xdebug (*_Xdebug_p) Xlib.h:1393:extern int _Xdebug; #### _Xevent_to_mask #### ChkMaskEv.c:32:extern long const _Xevent_to_mask[]; ChkMaskEv.c:64: (_Xevent_to_mask[qelt->event.type] & mask) && ChkWinEv.c:32:extern long const _Xevent_to_mask[]; ChkWinEv.c:65: (_Xevent_to_mask[qelt->event.type] & mask) && evtomask.c:36:long const _Xevent_to_mask [LASTEvent] = { FilterEv.c:66:extern long const _Xevent_to_mask[]; FilterEv.c:89: mask = _Xevent_to_mask[ev->type]; MaskEvent.c:32:extern long const _Xevent_to_mask[]; MaskEvent.c:63: (_Xevent_to_mask[qelt->event.type] & mask) && WinEvent.c:32:extern long const _Xevent_to_mask[]; WinEvent.c:67: (_Xevent_to_mask[qelt->event.type] & mask) && #### _Xglobal_lock #### ConnDis.c:916: _XLockMutex(_Xglobal_lock); ConnDis.c:922: _XUnlockMutex(_Xglobal_lock); ConnDis.c:946: _XLockMutex(_Xglobal_lock); ConnDis.c:963: _XUnlockMutex(_Xglobal_lock); ConnDis.c:1390: _XLockMutex(_Xglobal_lock); ConnDis.c:1392: _XUnlockMutex(_Xglobal_lock); ConnDis.c:1424: _XLockMutex(_Xglobal_lock); ConnDis.c:1428: _XUnlockMutex(_Xglobal_lock); CrGlCur.c:148: _XLockMutex (_Xglobal_lock); \ CrGlCur.c:161: _XUnlockMutex (_Xglobal_lock); \ ErrDes.c:174: _XLockMutex(_Xglobal_lock); ErrDes.c:180: _XUnlockMutex(_Xglobal_lock); ErrHndlr.c:43: _XLockMutex(_Xglobal_lock); ErrHndlr.c:55: _XUnlockMutex(_Xglobal_lock); ErrHndlr.c:71: _XLockMutex(_Xglobal_lock); ErrHndlr.c:83: _XUnlockMutex(_Xglobal_lock); locking.c:574: if (_Xglobal_lock) locking.c:597: _Xglobal_lock = &global_lock; locking.c:598: xmutex_init(_Xglobal_lock->lock); locking.c:599: xmutex_set_name(_Xglobal_lock->lock, "Xlib global"); Quarks.c:144: _XLockMutex(_Xglobal_lock); Quarks.c:146: _XUnlockMutex(_Xglobal_lock); Quarks.c:251: _XLockMutex(_Xglobal_lock); Quarks.c:277: _XUnlockMutex(_Xglobal_lock); Quarks.c:285: _XUnlockMutex(_Xglobal_lock); Quarks.c:338: _XUnlockMutex(_Xglobal_lock); Quarks.c:341: _XUnlockMutex(_Xglobal_lock); Quarks.c:381: _XLockMutex(_Xglobal_lock); Quarks.c:386: _XUnlockMutex(_Xglobal_lock); Quarks.c:394: _XLockMutex(_Xglobal_lock); Quarks.c:406: _XUnlockMutex(_Xglobal_lock); XlibInt.c:82:LockInfoPtr _Xglobal_lock = NULL; XlibInt.c:4207:LockInfoPtr *_Xglobal_lock_p = &_Xglobal_lock; Xlibint.h:307:#define _Xglobal_lock (*_Xglobal_lock_p) Xlibint.h:332:extern LockInfoPtr _Xglobal_lock; #### _Xi18n_lock #### lcWrap.c:71:LockInfoPtr _Xi18n_lock; lcWrap.c:273: _XLockMutex(_Xi18n_lock); lcWrap.c:312: _XUnlockMutex(_Xi18n_lock); locking.c:68:extern LockInfoPtr _Xi18n_lock; locking.c:600: _Xi18n_lock = &i18n_lock; locking.c:601: xmutex_init(_Xi18n_lock->lock); locking.c:602: xmutex_set_name(_Xi18n_lock->lock, "Xlib i18n"); #### _XimCbDispatch #### imCallbk.c:182:_XimCbDispatch(Xim xim, imDefIm.c:888: _XimRegisterDispatcher(im, _XimCbDispatch, (XPointer)im); Ximint.h:859:extern Bool _XimCbDispatch( #### _XimCheckCreateICValues #### imDefIc.c:1510: if (!(_XimCheckCreateICValues(ic->private.proto.ic_resources, imRm.c:2218:_XimCheckCreateICValues( Ximint.h:219:extern Bool _XimCheckCreateICValues( #### _XimCheckDataSize #### imDefIm.c:67:_XimCheckDataSize( Ximint.h:674:extern int _XimCheckDataSize( #### _XimCheckICMode #### imRmAttr.c:118: check = _XimCheckICMode(res, mode); imRmAttr.c:160: check = _XimCheckICMode(res, mode); imRmAttr.c:526: check = _XimCheckICMode(res, mode); imRmAttr.c:1064: check = _XimCheckICMode(res, mode); imRmAttr.c:1110: check = _XimCheckICMode(res, mode); imRm.c:2598: _XimCheckICMode( imRm.c:2701: check = _XimCheckICMode(res, mode); imRm.c:2895: check = _XimCheckICMode(res, mode); imRm.c:3056: check = _XimCheckICMode(res, mode); Ximint.h:246:extern int _XimCheckICMode( #### _XimCheckIMMode #### imRmAttr.c:58: check = _XimCheckIMMode(res, mode); imRmAttr.c:92: check = _XimCheckIMMode(res, mode); imRmAttr.c:444: check = _XimCheckIMMode(res, mode); imRmAttr.c:789: check = _XimCheckIMMode(res, mode); imRmAttr.c:827: check = _XimCheckIMMode(res, mode); imRm.c:2271: check = _XimCheckIMMode(res, XIM_SETIMVALUES); imRm.c:2301: check = _XimCheckIMMode(res, XIM_GETIMVALUES); imRm.c:2365: _XimCheckIMMode( imRm.c:2637: check = _XimCheckIMMode(res, XIM_SETIMDEFAULTS); Ximint.h:241:extern int _XimCheckIMMode( #### _XimCheckIfLocalProcessing #### imImSw.c:51: { _XimCheckIfLocalProcessing, _XimLocalOpenIM, _XimLocalIMFree }, imLcIm.c:97:_XimCheckIfLocalProcessing(Xim im) Ximint.h:331:extern Bool _XimCheckIfLocalProcessing( #### _XimCheckIfThaiProcessing #### imImSw.c:52: { _XimCheckIfThaiProcessing, _XimThaiOpenIM, _XimThaiIMFree }, imThaiIm.c:62:_XimCheckIfThaiProcessing(Xim im) Ximint.h:335:extern Bool _XimCheckIfThaiProcessing( #### _XimCheckLocalInputStyle #### imLcIc.c:169: if(_XimCheckLocalInputStyle(ic, (XPointer)&ic_values, values, imRm.c:2937:_XimCheckLocalInputStyle( imThaiIc.c:201: if(_XimCheckLocalInputStyle(ic, (XPointer)&ic_values, values, Ximint.h:280:extern Bool _XimCheckLocalInputStyle( #### _XimCommitCallback #### imDefIm.c:880: _XimCommitCallback, (XPointer)im); imDefLkup.c:734:_XimCommitCallback( Ximint.h:517:extern Bool _XimCommitCallback( #### _XimConnect #### imDefFlt.c:157: if (_XimConnectServer(im)) { imDefFlt.c:218: if (_XimConnectServer(im)) { imDefIc.c:320: if (_XimConnectServer(im)) { imDefIc.c:697: if (_XimConnectServer(im)) { imDefIc.c:947: if (_XimConnectServer(im)) { imDefIc.c:992: if (_XimConnectServer(im)) { imDefIc.c:1444: if (!_XimConnectServer(im)) { imDefIm.c:559:_XimConnection( imDefIm.c:577: if(!(_XimConnect(im))) /* Transport Connect */ imDefIm.c:1282: if (!_XimConnectServer(im)) { imDefIm.c:1444: if (!_XimConnectServer(im)) { imDefIm.c:1934:_XimConnectServer( imDefIm.c:1943: if (_XimPreConnect(im) && _XimConnection(im) imDefIm.c:2029: if (_XimConnection(im) && _XimOpen(im) && _XimEncodingNegotiation(im)) { imTransR.c:73:_XimConnect(Xim im) Ximint.h:814:extern Bool _XimConnect( Ximint.h:941:extern Bool _XimConnectServer( #### _XimDecodeICATTRIBUTE #### imDefIc.c:414: decode_name = _XimDecodeICATTRIBUTE(ic, ic->private.proto.ic_resources, imRmAttr.c:492:_XimDecodeICATTRIBUTE( imRmAttr.c:548: if ((name = _XimDecodeICATTRIBUTE(ic, res_list, res_num, imRmAttr.c:553: if ((name = _XimDecodeICATTRIBUTE(ic, res_list, res_num, Ximint.h:460:extern char * _XimDecodeICATTRIBUTE( #### _XimDecodeIMATTRIBUTE #### imDefIm.c:1517: decode_name = _XimDecodeIMATTRIBUTE(im, im->core.im_resources, imRmAttr.c:419:_XimDecodeIMATTRIBUTE( Ximint.h:450:extern char * _XimDecodeIMATTRIBUTE( #### _XimDecodeLocalICAttr #### imRmAttr.c:485: if (!_XimDecodeLocalICAttr(res, (XPointer)&ic_values, arg->value, mode)) imRmAttr.c:1314: if (!_XimDecodeLocalICAttr(res, top,(XPointer)&value, mode)) imRm.c:2999:_XimDecodeLocalICAttr( imRm.c:3063: if(_XimDecodeLocalICAttr(res, top, p->value, mode) == False) { Ximint.h:295:extern Bool _XimDecodeLocalICAttr( #### _XimDecodeLocalIMAttr #### imRmAttr.c:415: return _XimDecodeLocalIMAttr(res, (XPointer)&im_values, arg->value); imRmAttr.c:896: if (!_XimDecodeLocalIMAttr(res, top, value)) imRm.c:2308: if(!_XimDecodeLocalIMAttr(res, top, p->value)) { imRm.c:2989:_XimDecodeLocalIMAttr( Ximint.h:289:extern Bool _XimDecodeLocalIMAttr( #### _XimDestroyIMStructureList #### imDefIm.c:1136: _XimDestroyIMStructureList(im); imInt.c:76:_XimDestroyIMStructureList(Xim im) imLcIm.c:231: _XimDestroyIMStructureList(im); Ximint.h:426:extern void _XimDestroyIMStructureList( #### _XimDispatchInit #### imDefIm.c:580: if(!_XimDispatchInit(im)) imDispch.c:99:_XimDispatchInit(Xim im) Ximint.h:413:extern Bool _XimDispatchInit( #### _XimEncodeICATTRIBUTE #### imDefIc.c:720: if ((name = _XimEncodeICATTRIBUTE(ic, ic->private.proto.ic_resources, imDefIc.c:1482: if (_XimEncodeICATTRIBUTE(ic, ic->private.proto.ic_resources, imRmAttr.c:1074:_XimEncodeICATTRIBUTE( imRmAttr.c:1132: if ((name = _XimEncodeICATTRIBUTE(ic, res_list, res_num, imRmAttr.c:1142: if ((name = _XimEncodeICATTRIBUTE(ic, res_list, res_num, Ximint.h:592:extern char * _XimEncodeICATTRIBUTE( #### _XimEncodeIMATTRIBUTE #### imDefIm.c:1299: if ((name = _XimEncodeIMATTRIBUTE(im, im->core.im_resources, imRmAttr.c:799:_XimEncodeIMATTRIBUTE( Ximint.h:579:extern char * _XimEncodeIMATTRIBUTE( #### _XimEncodeLocalICAttr #### imRmAttr.c:1070: return _XimEncodeLocalICAttr(ic, res, top, arg, mode); imRmAttr.c:1155: if (!(_XimEncodeLocalICAttr(ic, res, top, p, mode))) imRm.c:2751:_XimEncodeLocalICAttr( imRm.c:2912: if(_XimEncodeLocalICAttr(ic, res, top, p, mode) == False) { imRm.c:2954: if(!_XimEncodeLocalICAttr(ic, res, top, p, 0)) { Ximint.h:272:extern Bool _XimEncodeLocalICAttr( #### _XimEncodeLocalIMAttr #### imRmAttr.c:795: return _XimEncodeLocalIMAttr(res, top, arg->value); imRmAttr.c:833: if (!(_XimEncodeLocalIMAttr(res, top, p->value))) imRm.c:2278: if(!_XimEncodeLocalIMAttr(res, top, p->value)) { imRm.c:2741:_XimEncodeLocalIMAttr( Ximint.h:266:extern Bool _XimEncodeLocalIMAttr( #### _XimError #### imCallbk.c:311: _XimError(im, ic, imCallbk.c:384: _XimError(im, ic, imCallbk.c:615: _XimError(im, ic, imDefIm.c:583: _XimRegProtoIntrCallback(im, XIM_ERROR, 0, _XimErrorCallback, (XPointer)im); imDefLkup.c:421: _XimError(im, 0, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); imDefLkup.c:438: _XimError(im, 0, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); imDefLkup.c:629: _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); imDefLkup.c:651: _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); imDefLkup.c:700: _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); imDefLkup.c:764:_XimErrorCallback( imDefLkup.c:793:_XimError( imTransR.c:243: _XimError(im, 0, XIM_BadProtocol, (INT16)0, (CARD16)0, (char *)NULL); imTransR.c:302: _XimError(im, 0, XIM_BadProtocol, (INT16)0, (CARD16)0, (char *)NULL); Ximint.h:480:extern Bool _XimErrorCallback( Ximint.h:487:extern Bool _XimError( #### _XimErrorCallback #### imDefIm.c:583: _XimRegProtoIntrCallback(im, XIM_ERROR, 0, _XimErrorCallback, (XPointer)im); imDefLkup.c:764:_XimErrorCallback( Ximint.h:480:extern Bool _XimErrorCallback( #### _XimExtension #### imDefIm.c:884: if(!_XimExtension(im)) imExten.c:416:_XimExtension( Ximint.h:422:extern Bool _XimExtension( #### _XimFilterWaitEvent #### imTrans.c:208: return _XimFilterWaitEvent(im); imTransR.c:268:_XimFilterWaitEvent(Xim im) imTrX.c:124: ret = _XimFilterWaitEvent(im); Ximint.h:843:extern Bool _XimFilterWaitEvent( #### _XimFlush #### imCallbk.c:89:#define _XimFlushData(im) im->private.proto.flush((im)) imCallbk.c:358: _XimFlushData(im); imCallbk.c:409: _XimFlushData(im); imCallbk.c:639: _XimFlushData(im); imDefIc.c:192: _XimFlush(im); imDefIc.c:376: _XimFlush(im); imDefIc.c:773: _XimFlush(im); imDefIc.c:912: _XimFlush(im); imDefIc.c:969: _XimFlush(im); imDefIc.c:1014: _XimFlush(im); imDefIc.c:1079: _XimFlush(im); imDefIc.c:1527: _XimFlush(im); imDefIm.c:541: _XimFlush(im); imDefIm.c:609: _XimFlush(im); imDefIm.c:755: _XimFlush(im); imDefIm.c:823: _XimFlush(im); imDefIm.c:942: _XimFlush(im); imDefIm.c:1343: _XimFlush(im); imDefIm.c:1485: _XimFlush(im); imDefIm.c:1748: _XimFlush(im); imDefIm.c:1873: _XimFlush(im); imDefLkup.c:154: _XimFlush(im); imDefLkup.c:207: _XimFlush(im); imDefLkup.c:292: _XimFlush(im); imDefLkup.c:538: _XimFlush(im); imDefLkup.c:832: _XimFlush(im); imExten.c:262: _XimFlush(im); imExten.c:457: _XimFlush(im); imExten.c:550: _XimFlush(im); imTransR.c:261:_XimFlush(Xim im) Ximint.h:839:extern void _XimFlush( #### _XimForwardEvent #### imDefFlt.c:182: if (_XimForwardEvent(ic, (XEvent *)ev, imDefFlt.c:243: if (_XimForwardEvent(ic, (XEvent *)ev, imDefIm.c:878: _XimForwardEventCallback, (XPointer)im); imDefLkup.c:256:_XimForwardEventCore( imDefLkup.c:330:_XimForwardEvent( imDefLkup.c:340: return _XimForwardEventCore(ic, ev, sync); imDefLkup.c:362:_XimForwardEventRecv( imDefLkup.c:381:_XimForwardEventCallback( imDefLkup.c:395: (void)_XimForwardEventRecv(im, ic, (XPointer)&buf_s[2]); Ximint.h:510:extern Bool _XimForwardEventCallback( Ximint.h:565:extern Bool _XimForwardEvent( #### _XimForwardEventCallback #### imDefIm.c:878: _XimForwardEventCallback, (XPointer)im); imDefLkup.c:381:_XimForwardEventCallback( Ximint.h:510:extern Bool _XimForwardEventCallback( #### _XimFreeCommitInfo #### imDefIc.c:857: _XimFreeCommitInfo(ic); imDefIc.c:1166: _XimFreeCommitInfo( ic ); imDefIc.c:1224: _XimFreeCommitInfo( ic ); imDefIc.c:1282: _XimFreeCommitInfo( ic ); imDefLkup.c:611:_XimFreeCommitInfo( Ximint.h:810:extern void _XimFreeCommitInfo( #### _XimFreeProtoIntrCallback #### imDefIm.c:989: _XimFreeProtoIntrCallback(im); imDispch.c:64:_XimFreeProtoIntrCallback(Xim im) Ximint.h:531:extern void _XimFreeProtoIntrCallback( #### _XimFreeTransIntrCallback #### imTrans.c:133: _XimFreeTransIntrCallback(im); imTrans.c:168:_XimFreeTransIntrCallback( XimTrans.h:102:extern void _XimFreeTransIntrCallback( #### _XimGetAttributeID #### imDefIm.c:854: if (!(_XimGetAttributeID(im, &buf_s[1]))) { imRmAttr.c:1405:_XimGetAttributeID( Ximint.h:417:extern Bool _XimGetAttributeID( #### _XimGetCharCode #### imConv.c:81: * This converter is needed for _XimGetCharCode subroutine. imConv.c:108:_XimGetCharCode ( XKBCvt.c:130: return _XimGetCharCode(priv, keysym, (unsigned char *) buf, nbytes); Ximint.h:188:int _XimGetCharCode ( #### _XimGetCurrentICValues #### imDefIc.c:144: _XimGetCurrentICValues(ic, &ic_values); imDefIc.c:254: _XimGetCurrentICValues(ic, &ic_values); imDefIc.c:621: _XimGetCurrentICValues(ic, &ic_values); imDefIc.c:711: _XimGetCurrentICValues(ic, &ic_values); imDefIc.c:1337: _XimGetCurrentICValues(ic, &ic_values); imDefIc.c:1474: _XimGetCurrentICValues(ic, &ic_values); imLcGIc.c:42: _XimGetCurrentICValues(ic, &ic_values); imLcSIc.c:47: _XimGetCurrentICValues(ic, &ic_values); imRmAttr.c:484: _XimGetCurrentICValues(ic, &ic_values); imRm.c:3098:_XimGetCurrentICValues(Xic ic, XimDefICValues *ic_values) Ximint.h:312:extern void _XimGetCurrentICValues( #### _XimGetCurrentIMValues #### imDefIm.c:1215: _XimGetCurrentIMValues(im, &im_values); imDefIm.c:1291: _XimGetCurrentIMValues(im, &im_values); imDefIm.c:1387: _XimGetCurrentIMValues(im, &im_values); imDefIm.c:1822: _XimGetCurrentIMValues(im, &im_values); imDefIm.c:1974: _XimGetCurrentIMValues(im, &im_values); imLcIm.c:243: _XimGetCurrentIMValues(im, &im_values); imLcIm.c:257: _XimGetCurrentIMValues(im, &im_values); imLcIm.c:657: _XimGetCurrentIMValues(im, &im_values); imRmAttr.c:414: _XimGetCurrentIMValues(im, &im_values); imRm.c:3072:_XimGetCurrentIMValues(Xim im, XimDefIMValues *im_values) imThaiIm.c:99: _XimGetCurrentIMValues(im, &im_values); Ximint.h:302:extern void _XimGetCurrentIMValues( #### _XimGetICValueData #### imDefIc.c:255: return _XimGetICValueData(ic, (XPointer)&ic_values, imLcGIc.c:43: return(_XimGetICValueData(ic, (XPointer)&ic_values, imRm.c:3023:_XimGetICValueData(Xic ic, XPointer top, XIMResourceList res_list, imRm.c:3042: if((name = _XimGetICValueData(ic, imRm.c:3049: if((name = _XimGetICValueData(ic, Ximint.h:389:extern char * _XimGetICValueData( #### _XimGetIMValueData #### imDefIm.c:1388: return(_XimGetIMValueData(im, (XPointer)&im_values, arg, imLcIm.c:244: return(_XimGetIMValueData(im, (XPointer)&im_values, values, imRm.c:2286:_XimGetIMValueData( Ximint.h:371:extern char * _XimGetIMValueData( #### _XimGetLocaleCode #### imConv.c:84:_XimGetLocaleCode ( XKBCvt.c:200: cvt_rtrn->KSToMBPriv = _XimGetLocaleCode(encoding_name); Ximint.h:184:XPointer _XimGetLocaleCode ( #### _XimGetMyEndian #### imDefIm.c:97:_XimGetMyEndian(void) imDefIm.c:591: buf_b[0] = _XimGetMyEndian(); imLcIm.c:354: sprintf (*res, "%s/%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(), imLcIm.c:357: sprintf (*res, "%s%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(), Ximint.h:670:extern char _XimGetMyEndian( #### _XimGetResourceListRec #### imRmAttr.c:42: return _XimGetResourceListRec(res_list, res_num, XNSeparatorofNestedList); imRmAttr.c:54: if (!(res = _XimGetResourceListRec(im->private.proto.im_inner_resources, imRmAttr.c:86: if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { imRmAttr.c:114: if (!(res = _XimGetResourceListRec(ic->private.proto.ic_inner_resources, imRmAttr.c:153: if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { imRmAttr.c:410: if (!(res = _XimGetResourceListRec(im->private.proto.im_inner_resources, imRmAttr.c:438: if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { imRmAttr.c:480: if (!(res = _XimGetResourceListRec(ic->private.proto.ic_inner_resources, imRmAttr.c:520: if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { imRmAttr.c:785: if (!(res = _XimGetResourceListRec(im->private.proto.im_inner_resources, imRmAttr.c:821: if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { imRmAttr.c:892: if (!(res = _XimGetResourceListRecByQuark(res_list, imRmAttr.c:1060: if (!(res = _XimGetResourceListRec(ic->private.proto.ic_inner_resources, imRmAttr.c:1104: if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { imRmAttr.c:1310: if (!(res = _XimGetResourceListRecByQuark(res_list, imRm.c:2202:_XimGetResourceListRecByMode( imRm.c:2222: if (!_XimGetResourceListRecByMode(res_list, list_num, XIM_MODE_IC_CREATE)) { imRm.c:2229:_XimGetResourceListRecByQuark( imRm.c:2245:_XimGetResourceListRec( imRm.c:2252: return _XimGetResourceListRecByQuark(res_list, list_num, quark); imRm.c:2268: if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { imRm.c:2298: if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { imRm.c:2325: if(!(res = _XimGetResourceListRecByQuark(res_list, imRm.c:2415: if(!(res = _XimGetResourceListRecByQuark(res_list, imRm.c:2632: if((res = _XimGetResourceListRecByQuark( res_list, list_num, imRm.c:2696: if(!(res = _XimGetResourceListRecByQuark(res_list, list_num, imRm.c:2876: if((res = _XimGetResourceListRec(res_list, list_num, imRm.c:2951: if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { imRm.c:3037: if((res = _XimGetResourceListRec(res_list, list_num, Ximint.h:224:extern XIMResourceList _XimGetResourceListRec( Ximint.h:873:extern XIMResourceList _XimGetResourceListRecByQuark( #### _XimGetResourceListRecByQuark #### imRmAttr.c:892: if (!(res = _XimGetResourceListRecByQuark(res_list, imRmAttr.c:1310: if (!(res = _XimGetResourceListRecByQuark(res_list, imRm.c:2229:_XimGetResourceListRecByQuark( imRm.c:2252: return _XimGetResourceListRecByQuark(res_list, list_num, quark); imRm.c:2325: if(!(res = _XimGetResourceListRecByQuark(res_list, imRm.c:2415: if(!(res = _XimGetResourceListRecByQuark(res_list, imRm.c:2632: if((res = _XimGetResourceListRecByQuark( res_list, list_num, imRm.c:2696: if(!(res = _XimGetResourceListRecByQuark(res_list, list_num, Ximint.h:873:extern XIMResourceList _XimGetResourceListRecByQuark( #### _XimGetWindowEventmask #### imDefLkup.c:463:_XimGetWindowEventmask( imDefLkup.c:521: EVENTMASK mask = _XimGetWindowEventmask(ic); imExten.c:96: EVENTMASK select_mask = _XimGetWindowEventmask(ic); Ximint.h:777:extern EVENTMASK _XimGetWindowEventmask( #### _XimICOfXICID #### imCallbk.c:193: Xic ic = _XimICOfXICID(im, icid); imDefLkup.c:38:_XimICOfXICID( imDefLkup.c:91: ic = _XimICOfXICID(im, icid); imDefLkup.c:236: && (ic = _XimICOfXICID(im, icid))) { imDefLkup.c:394: && (ic = _XimICOfXICID(im, icid))) { imDefLkup.c:747: && (ic = _XimICOfXICID(im, icid))) { imDefLkup.c:784: if (!(ic = _XimICOfXICID(im, icid))) imExten.c:130: && (ic = _XimICOfXICID(im, icid))) { imExten.c:181: && (ic = _XimICOfXICID(im, icid))) { Ximint.h:781:extern Xic _XimICOfXICID( #### _XimImSportRec #### imImSw.c:50:XimImsportSW _XimImSportRec[] = { imInt.c:228: if(_XimImSportRec[i].checkprocessing(im)) { imInt.c:229: if(!(_XimImSportRec[i].im_open(im))) imInt.c:238: _XimImSportRec[i].im_free(im); XimImSw.h:44:extern XimImsportSW _XimImSportRec[]; #### _XimInitialResourceInfo #### imDefIm.c:2020: _XimInitialResourceInfo(); imLcIm.c:645: _XimInitialResourceInfo(); imRm.c:3200:_XimInitialResourceInfo(void) imThaiIm.c:87: _XimInitialResourceInfo(); Ximint.h:322:extern void _XimInitialResourceInfo( #### _XimLcctstombs #### imLcIm.c:631: _XimLcctstombs, /* ctstombs */ imLcLkup.c:341:_XimLcctstombs(XIM xim, char *from, int from_len, imThaiIm.c:54: _XimLcctstombs, /* ctstombs */ Ximint.h:643:extern int _XimLcctstombs( #### _XimLcctstoutf8 #### imLcIm.c:633: _XimLcctstoutf8 /* ctstoutf8 */ imLcLkup.c:412:_XimLcctstoutf8(XIM xim, char *from, int from_len, imThaiIm.c:56: _XimLcctstoutf8 /* ctstoutf8 */ Ximint.h:661:extern int _XimLcctstoutf8( #### _XimLcctstowcs #### imLcIm.c:632: _XimLcctstowcs, /* ctstowcs */ imLcLkup.c:349:_XimLcctstowcs(XIM xim, char *from, int from_len, imThaiIm.c:55: _XimLcctstowcs, /* ctstowcs */ Ximint.h:652:extern int _XimLcctstowcs( #### _XimLocalCreateIC #### imLcIc.c:136:_XimLocalCreateIC( imLcIm.c:630: _XimLocalCreateIC, /* create_ic */ Ximint.h:408:extern XIC _XimLocalCreateIC( #### _XimLocalFilter #### imLcFlt.c:41:_XimLocalFilter(Display *d, Window w, XEvent *ev, XPointer client_data) imLcIc.c:48: ic->core.focus_window, _XimLocalFilter, (XPointer)ic); imLcIc.c:63: ic->core.focus_window, _XimLocalFilter, (XPointer)ic); imLcIc.c:89: _XimLocalFilter, (XPointer)ic); imRm.c:2791: KeyPress, KeyRelease, _XimLocalFilter, (XPointer)ic); imRm.c:2797: ic->core.focus_window, _XimLocalFilter, (XPointer)ic); imRm.c:2803: _XimLocalFilter, (XPointer)ic); Ximint.h:866:extern Bool _XimLocalFilter( #### _XimLocalGetICValues #### imLcGIc.c:37:_XimLocalGetICValues(XIC xic, XIMArg *values) imLcIc.c:126: _XimLocalGetICValues, /* get_values */ imThaiIc.c:141: _XimLocalGetICValues, /* get_values */ Ximint.h:888:extern char * _XimLocalGetICValues( #### _XimLocalGetIMValues #### imLcIm.c:236:_XimLocalGetIMValues( imLcIm.c:629: _XimLocalGetIMValues, /* get_values */ imThaiIm.c:52: _XimLocalGetIMValues, /* get_values */ Ximint.h:403:extern char * _XimLocalGetIMValues( #### _XimLocalIMFree #### imImSw.c:51: { _XimCheckIfLocalProcessing, _XimLocalOpenIM, _XimLocalIMFree }, imLcIm.c:149:_XimLocalIMFree( imLcIm.c:230: _XimLocalIMFree(im); imLcIm.c:709: _XimLocalIMFree(im); Ximint.h:351:extern void _XimLocalIMFree( #### _XimLocalMbLookupString #### imLcIc.c:130: _XimLocalMbLookupString, /* mb_lookup_string */ imLcLkup.c:47:_XimLocalMbLookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes, imThaiIc.c:145: _XimLocalMbLookupString, /* mb_lookup_string */ Ximint.h:893:extern int _XimLocalMbLookupString( #### _XimLocalOpenIM #### imImSw.c:51: { _XimCheckIfLocalProcessing, _XimLocalOpenIM, _XimLocalIMFree }, imLcIm.c:637:_XimLocalOpenIM( Ximint.h:339:extern Bool _XimLocalOpenIM( #### _XimLocalSetICValues #### imLcIc.c:125: _XimLocalSetICValues, /* set_values */ imLcSIc.c:41:_XimLocalSetICValues(XIC xic, XIMArg *values) imThaiIc.c:140: _XimLocalSetICValues, /* set_values */ Ximint.h:883:extern char *_XimLocalSetICValues( #### _XimLocalSetIMValues #### imLcIm.c:249:_XimLocalSetIMValues( imLcIm.c:628: _XimLocalSetIMValues, /* set_values */ imThaiIm.c:51: _XimLocalSetIMValues, /* set_values */ Ximint.h:398:extern char * _XimLocalSetIMValues( #### _XimLocalUtf8LookupString #### imLcIc.c:132: _XimLocalUtf8LookupString /* utf8_lookup_string */ imLcLkup.c:202:_XimLocalUtf8LookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes, imThaiIc.c:147: _XimLocalUtf8LookupString /* utf8_lookup_string */ Ximint.h:911:extern int _XimLocalUtf8LookupString( #### _XimLocalWcLookupString #### imLcIc.c:131: _XimLocalWcLookupString, /* wc_lookup_string */ imLcLkup.c:130:_XimLocalWcLookupString(XIC xic, XKeyEvent *ev, wchar_t *buffer, int wlen, imThaiIc.c:146: _XimLocalWcLookupString, /* wc_lookup_string */ Ximint.h:902:extern int _XimLocalWcLookupString( #### _XimLookupMBText #### imConv.c:158:_XimLookupMBText( imDefLkup.c:1032: ret = _XimLookupMBText(ic, ev, buffer, bytes, keysym, NULL); imLcLkup.c:109: ret = _XimLookupMBText(ic, ev, buffer, bytes, keysym, NULL); Ximint.h:750:extern int _XimLookupMBText( #### _XimLookupUTF8Text #### imConv.c:301:_XimLookupUTF8Text( imDefLkup.c:1158: ret = _XimLookupUTF8Text(ic, ev, buffer, bytes, keysym, NULL); imLcLkup.c:254: ret = _XimLookupUTF8Text(ic, ev, buffer, bytes, keysym, NULL); Ximint.h:768:extern int _XimLookupUTF8Text( #### _XimLookupWCText #### imConv.c:229:_XimLookupWCText( imDefLkup.c:1095: ret = _XimLookupWCText(ic, ev, buffer, bytes, keysym, NULL); imLcLkup.c:181: ret = _XimLookupWCText(ic, ev, buffer, wlen, keysym, NULL); Ximint.h:759:extern int _XimLookupWCText( #### _XimMakeICAttrIDList #### imDefIc.c:358: makeid_name = _XimMakeICAttrIDList(ic, ic->private.proto.ic_resources, imRmAttr.c:128:_XimMakeICAttrIDList( imRmAttr.c:173: if ((name = _XimMakeICAttrIDList(ic, res_list, res_num, imRmAttr.c:183: if ((name = _XimMakeICAttrIDList(ic, res_list, res_num, Ximint.h:440:extern char * _XimMakeICAttrIDList( #### _XimMakeIMAttrIDList #### imDefIm.c:1469: makeid_name = _XimMakeIMAttrIDList(im, im->core.im_resources, imRmAttr.c:68:_XimMakeIMAttrIDList( Ximint.h:430:extern char * _XimMakeIMAttrIDList( #### _XimOpenIM #### imInt.c:197:_XimOpenIM( imInt.c:256: lcd->methods->open_im = _XimOpenIM; XlcPublic.h:230:extern XIM _XimOpenIM( #### _XimParseStringFile #### imLcIm.c:611: _XimParseStringFile(fp, im); imLcPrs.c:712:_XimParseStringFile( Ximint.h:326:extern void _XimParseStringFile( #### _XimProcError #### imDefIc.c:222: _XimProcError(im, 0, (XPointer)&buf_s[3]); imDefIc.c:402: _XimProcError(im, 0, (XPointer)&buf_s[3]); imDefIc.c:799: _XimProcError(im, 0, (XPointer)&buf_s[3]); imDefIc.c:1107: _XimProcError(im, 0, (XPointer)&buf_s[3]); imDefIc.c:1557: _XimProcError(im, 0, (XPointer)&buf_s[3]); imDefIm.c:846: _XimProcError(im, 0, (XPointer)&buf_s[3]); imDefIm.c:964: _XimProcError(im, 0, (XPointer)&buf_s[3]); imDefIm.c:1368: _XimProcError(im, 0, (XPointer)&buf_s[3]); imDefIm.c:1509: _XimProcError(im, 0, (XPointer)&buf_s[3]); imDefIm.c:1770: _XimProcError(im, 0, (XPointer)&buf_s[3]); imDefIm.c:1899: _XimProcError(im, 0, (XPointer)&buf_s[3]); imDefLkup.c:178: _XimProcError(im, 0, (XPointer)&buf_s[3]); imDefLkup.c:318: _XimProcError(im, 0, (XPointer)&buf_s[3]); imDefLkup.c:562: _XimProcError(im, 0, (XPointer)&buf_s[3]); imDefLkup.c:755:_XimProcError( imDefLkup.c:787: _XimProcError(im, ic, (XPointer)&buf_s[3]); imExten.c:286: _XimProcError(im, 0, (XPointer)&buf_s[3]); imExten.c:480: _XimProcError(im, 0, (XPointer)&buf_s[3]); Ximint.h:847:extern void _XimProcError( #### _XimProcSyncReply #### imDefFlt.c:132: (void)_XimProcSyncReply(im, ic); imDefLkup.c:189:_XimProcSyncReply( imDefLkup.c:237: (void)_XimProcSyncReply(im, ic); imExten.c:111: if (!(_XimProcSyncReply(im, ic))) Ximint.h:555:extern Bool _XimProcSyncReply( #### _XimProtoCreateIC #### imDefIc.c:1386:_XimProtoCreateIC( imDefIm.c:1533: _XimProtoCreateIC, /* create_ic */ Ximint.h:535:extern XIC _XimProtoCreateIC( #### _XimProtoEventToWire #### imDefLkup.c:248: if (!(_XimProtoEventToWire(ev, event, False))) imEvToWire.c:45:_XimProtoEventToWire( Ximint.h:730:extern Status _XimProtoEventToWire( #### _XimProtoIMFree #### imDefIm.c:976:_XimProtoIMFree( imDefIm.c:1126: _XimProtoIMFree(im); imDefIm.c:2040: _XimProtoIMFree(im); imImSw.c:53: { _XimCheckIfDefault, _XimProtoOpenIM, _XimProtoIMFree }, Ximint.h:359:extern void _XimProtoIMFree( #### _XimProtoMbLookupString #### imDefIc.c:1302: _XimProtoMbLookupString, /* mb_lookup_string */ imDefLkup.c:992:_XimProtoMbLookupString( Ximint.h:691:extern int _XimProtoMbLookupString( #### _XimProtoOpenIM #### imDefIm.c:2017:_XimProtoOpenIM( imImSw.c:53: { _XimCheckIfDefault, _XimProtoOpenIM, _XimProtoIMFree }, Ximint.h:347:extern Bool _XimProtoOpenIM( #### _XimProtoUtf8LookupString #### imDefIc.c:1304: _XimProtoUtf8LookupString /* utf8_lookup_string */ imDefLkup.c:1118:_XimProtoUtf8LookupString( Ximint.h:709:extern int _XimProtoUtf8LookupString( #### _XimProtoWcLookupString #### imDefIc.c:1303: _XimProtoWcLookupString, /* wc_lookup_string */ imDefLkup.c:1055:_XimProtoWcLookupString( Ximint.h:700:extern int _XimProtoWcLookupString( #### _XimProtoWireToEvent #### imDefLkup.c:353: _XimProtoWireToEvent(ev, xev, False); imEvToWire.c:422:_XimProtoWireToEvent( Ximint.h:736:extern Bool _XimProtoWireToEvent( #### _XimRead #### imCallbk.c:87:#define _XimReadData(im,buf,buf_len,len) \ imDefIc.c:197: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefIc.c:207: ret_code = _XimRead(im, &len, preply, buf_size, imDefIc.c:379: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefIc.c:389: ret_code = _XimRead(im, &len, preply, buf_size, imDefIc.c:778: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefIc.c:785: ret_code = _XimRead(im, &len, preply, buf_size, imDefIc.c:914: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefIc.c:919: (void)_XimRead(im, &len, preply, buf_size, imDefIc.c:1082: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefIc.c:1092: ret_code = _XimRead(im, &len, preply, buf_size, imDefIc.c:1532: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefIc.c:1542: ret_code = _XimRead(im, &len, preply, buf_size, imDefIm.c:611: ret_code = _XimRead(im, &len, reply, buf_size, _XimAllRecv, 0); imDefIm.c:620: ret_code = _XimRead(im, &len, preply, buf_size, _XimAllRecv, 0); imDefIm.c:757: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefIm.c:763: ret_code = _XimRead(im, &len, preply, buf_size, imDefIm.c:825: ret_code = _XimRead(im, &len, reply, buf_size, imDefIm.c:835: ret_code = _XimRead(im, &len, preply, buf_size, imDefIm.c:944: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefIm.c:954: ret_code = _XimRead(im, &len, preply, buf_size, _XimCloseCheck, 0); imDefIm.c:1347: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefIm.c:1357: ret_code = _XimRead(im, &len, reply, buf_size, imDefIm.c:1488: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefIm.c:1498: ret_code = _XimRead(im, &len, preply, buf_size, imDefIm.c:1751: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefIm.c:1761: ret_code = _XimRead(im, &len, preply, buf_size, imDefIm.c:1877: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefIm.c:1887: ret_code = _XimRead(im, &len, reply, buf_size, imDefLkup.c:156: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefLkup.c:166: ret_code = _XimRead(im, &len, preply, buf_size, imDefLkup.c:296: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefLkup.c:306: ret_code = _XimRead(im, &len, preply, buf_size, imDefLkup.c:540: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imDefLkup.c:550: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imExten.c:265: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imExten.c:275: ret_code = _XimRead(im, &len, preply, buf_size, imExten.c:459: ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, imExten.c:469: ret_code = _XimRead(im, &len, reply, buf_size, imLcIm.c:268:_XimReadCachedDefaultTree( imLcIm.c:423: _XimReadCachedDefaultTree (fd, name, encoding, size)) { imTransR.c:102:_XimReadData( imTransR.c:228:_XimRead(Xim im, INT16 *len, XPointer buf, int buf_size, imTransR.c:235: ret_code = _XimReadData(im, &read_len, buf, buf_size); imTransR.c:278: ret_code = _XimReadData(im, &read_len, (XPointer)reply, buf_size); imTransR.c:287: ret_code = _XimReadData(im, &read_len, preply, buf_size); Ximint.h:828:extern Bool _XimRead( #### _XimRegProtoIntrCallback #### imDefIm.c:583: _XimRegProtoIntrCallback(im, XIM_ERROR, 0, _XimErrorCallback, (XPointer)im); imDefIm.c:714: _XimRegProtoIntrCallback(im, XIM_REGISTER_TRIGGERKEYS, 0, imDefIm.c:875: _XimRegProtoIntrCallback(im, XIM_SET_EVENT_MASK, 0, imDefIm.c:877: _XimRegProtoIntrCallback(im, XIM_FORWARD_EVENT, 0, imDefIm.c:879: _XimRegProtoIntrCallback(im, XIM_COMMIT, 0, imDefIm.c:881: _XimRegProtoIntrCallback(im, XIM_SYNC, 0, imDispch.c:40:_XimRegProtoIntrCallback( imExten.c:495: _XimRegProtoIntrCallback(im, imExten.c:501: _XimRegProtoIntrCallback(im, Ximint.h:470:extern Bool _XimRegProtoIntrCallback( #### _XimRegisterDispatcher #### imDefIm.c:888: _XimRegisterDispatcher(im, _XimCbDispatch, (XPointer)im); imDispch.c:101: if (_XimRegisterDispatcher(im, _XimTransportIntr, (XPointer)im)) imTransR.c:250:_XimRegisterDispatcher( Ximint.h:983:_XimRegisterDispatcher( #### _XimRegisterFilter #### imDefFlt.c:327:_XimRegisterFilter( imDefIc.c:232: _XimRegisterFilter(ic); imDefIc.c:971: _XimRegisterFilter(ic); imDefIc.c:1354: _XimRegisterFilter(ic); imDefIc.c:1514: _XimRegisterFilter(ic); imRmAttr.c:935: _XimRegisterFilter(ic); imRmAttr.c:941: _XimRegisterFilter(ic); Ximint.h:718:extern void _XimRegisterFilter( #### _XimRegisterIMInstantiateCallback #### imInsClbk.c:154:_XimRegisterIMInstantiateCallback( imInt.c:257: lcd->methods->register_callback = _XimRegisterIMInstantiateCallback; Ximint.h:790:extern Bool _XimRegisterIMInstantiateCallback( #### _XimRegisterServerFilter #### imDefFlt.c:380:_XimRegisterServerFilter( imDefIm.c:1947: _XimRegisterServerFilter(im); imDefIm.c:2030: _XimRegisterServerFilter(im); Ximint.h:540:extern void _XimRegisterServerFilter( #### _XimRegisterTriggerKeysCallback #### imDefIm.c:715: _XimRegisterTriggerKeysCallback, (XPointer)im); imDefLkup.c:449:_XimRegisterTriggerKeysCallback( Ximint.h:496:extern Bool _XimRegisterTriggerKeysCallback( #### _XimReregisterFilter #### imDefFlt.c:346:_XimReregisterFilter( imDefLkup.c:72: _XimReregisterFilter(ic); imExten.c:109: _XimReregisterFilter(ic); Ximint.h:726:extern void _XimReregisterFilter( #### _XimResetIMInstantiateCallback #### imDefIm.c:1123: _XimResetIMInstantiateCallback(im); imInsClbk.c:271:_XimResetIMInstantiateCallback(Xim xim) imInt.c:114: _XimResetIMInstantiateCallback( im ); imInt.c:143: _XimResetIMInstantiateCallback( im ); Ximint.h:786:extern void _XimResetIMInstantiateCallback( #### _XimRespSyncReply #### imDefLkup.c:212:_XimRespSyncReply( imDefLkup.c:373: (void)_XimRespSyncReply(ic, buf_s[0]); imDefLkup.c:704: (void)_XimRespSyncReply(ic, flag); imExten.c:161: _XimRespSyncReply(ic, buf_s[0]); Ximint.h:991:_XimRespSyncReply( #### _XimServerDestroy #### imDefFlt.c:374: _XimServerDestroy(im); imInt.c:90:_XimServerDestroy(Xim im_2_destroy) Ximint.h:575:extern void _XimServerDestroy( #### _XimSetCurrentICValues #### imDefIc.c:626: _XimSetCurrentICValues(ic, &ic_values); imDefIc.c:747: _XimSetCurrentICValues(ic, &ic_values); imDefIc.c:1347: _XimSetCurrentICValues(ic, &ic_values); imDefIc.c:1353: _XimSetCurrentICValues(ic, &ic_values); imDefIc.c:1508: _XimSetCurrentICValues(ic, &ic_values); imLcIc.c:183: _XimSetCurrentICValues(ic, &ic_values); imLcIc.c:188: _XimSetCurrentICValues(ic, &ic_values); imLcSIc.c:52: _XimSetCurrentICValues(ic, &ic_values); imRmAttr.c:487: _XimSetCurrentICValues(ic, &ic_values); imRm.c:3121:_XimSetCurrentICValues( imThaiIc.c:219: _XimSetCurrentICValues(ic, &ic_values); Ximint.h:317:extern void _XimSetCurrentICValues( #### _XimSetCurrentIMValues #### imDefIm.c:1218: _XimSetCurrentIMValues(im, &im_values); imDefIm.c:1327: _XimSetCurrentIMValues(im, &im_values); imDefIm.c:1979: _XimSetCurrentIMValues(im, &im_values); imLcIm.c:260: _XimSetCurrentIMValues(im, &im_values); imLcIm.c:662: _XimSetCurrentIMValues(im, &im_values); imRm.c:3086:_XimSetCurrentIMValues(Xim im, XimDefIMValues *im_values) imThaiIm.c:104: _XimSetCurrentIMValues(im, &im_values); Ximint.h:307:extern void _XimSetCurrentIMValues( #### _XimSetEventMaskCallback #### imDefIm.c:876: _XimSetEventMaskCallback, (XPointer)im); imDefLkup.c:77:_XimSetEventMaskCallback( Ximint.h:503:extern Bool _XimSetEventMaskCallback( #### _XimSetHeader #### imCallbk.c:340: _XimSetHeader((XPointer)buf, XIM_STR_CONVERSION_REPLY, 0, &buf_len); imCallbk.c:341: buf_len -= XIM_HEADER_SIZE; /* added by _XimSetHeader (HACK) */ imCallbk.c:400: _XimSetHeader((XPointer)buf, XIM_PREEDIT_START_REPLY, 0, &buf_len); imCallbk.c:630: _XimSetHeader((XPointer)buf, XIM_PREEDIT_CARET_REPLY, 0, &len); imDefIc.c:186: _XimSetHeader((XPointer)buf, XIM_CREATE_IC, 0, &len); imDefIc.c:371: _XimSetHeader((XPointer)buf, XIM_GET_IC_VALUES, 0, &len); imDefIc.c:767: _XimSetHeader((XPointer)buf, XIM_SET_IC_VALUES, 0, &len); imDefIc.c:910: _XimSetHeader((XPointer)buf, XIM_DESTROY_IC, 0, &len); imDefIc.c:967: _XimSetHeader((XPointer)buf, XIM_SET_IC_FOCUS, 0, &len); imDefIc.c:1012: _XimSetHeader((XPointer)buf, XIM_UNSET_IC_FOCUS, 0, &len); imDefIc.c:1076: _XimSetHeader((XPointer)buf, XIM_RESET_IC, 0, &len); imDefIc.c:1521: _XimSetHeader((XPointer)buf, XIM_CREATE_IC, 0, &len); imDefIm.c:79:_XimSetHeader( imDefIm.c:539: _XimSetHeader((XPointer)buf, XIM_AUTH_NG, 0, &len); imDefIm.c:606: _XimSetHeader((XPointer)buf, major_opcode, 0, &len); imDefIm.c:752: _XimSetHeader((XPointer)buf, XIM_DISCONNECT, 0, &len); imDefIm.c:820: _XimSetHeader((XPointer)buf, XIM_OPEN, 0, &len); imDefIm.c:939: _XimSetHeader((XPointer)buf, XIM_CLOSE, 0, &len); imDefIm.c:1337: _XimSetHeader((XPointer)buf, XIM_SET_IM_VALUES, 0, &len); imDefIm.c:1480: _XimSetHeader((XPointer)buf, XIM_GET_IM_VALUES, 0, &len); imDefIm.c:1743: _XimSetHeader((XPointer)buf, XIM_ENCODING_NEGOTIATION, 0, &len); imDefIm.c:1867: _XimSetHeader((XPointer)buf, XIM_SET_IM_VALUES, 0, &len); imDefLkup.c:151: _XimSetHeader((XPointer)buf, XIM_SYNC, 0, &len); imDefLkup.c:204: _XimSetHeader((XPointer)buf, XIM_SYNC_REPLY, 0, &len); imDefLkup.c:289: _XimSetHeader((XPointer)buf, XIM_FORWARD_EVENT, 0, &len); imDefLkup.c:535: _XimSetHeader((XPointer)buf, XIM_TRIGGER_NOTIFY, 0, &len); imDefLkup.c:829: _XimSetHeader((XPointer)buf, XIM_ERROR, 0, &len); imExten.c:257: _XimSetHeader((XPointer)buf, imExten.c:451: _XimSetHeader((XPointer)buf, XIM_QUERY_EXTENSION, 0, &len); imExten.c:546: _XimSetHeader((XPointer)buf, extensions[idx].major_opcode, Ximint.h:679:extern void _XimSetHeader( #### _XimSetICDefaults #### imDefIc.c:1348: if (!_XimSetICDefaults(ic, (XPointer)&ic_values, imLcIc.c:184: if(_XimSetICDefaults(ic, (XPointer)&ic_values, imRm.c:2655:_XimSetICDefaults( imRm.c:2686: if(!_XimSetICDefaults(ic, (XPointer)((char *)top + info[i].offset), imRm.c:2691: if(!_XimSetICDefaults(ic, (XPointer)((char *)top + info[i].offset), imThaiIc.c:214: if(_XimSetICDefaults(ic, (XPointer)&ic_values, Ximint.h:258:extern Bool _XimSetICDefaults( #### _XimSetICMode #### imDefIc.c:138: _XimSetICMode(ic->private.proto.ic_resources, imDefIc.c:141: _XimSetICMode(ic->private.proto.ic_inner_resources, imDefIc.c:1341: _XimSetICMode(res, num, input_style); imDefIc.c:1377: _XimSetICMode(res, num, input_style); imDefIc.c:1468: _XimSetICMode(ic->private.proto.ic_resources, imDefIc.c:1471: _XimSetICMode(ic->private.proto.ic_inner_resources, imLcIc.c:174: _XimSetICMode(res, num, ic_values.input_style); imRm.c:2384:_XimSetICMode(XIMResourceList res_list, unsigned int list_num, XIMStyle style) imThaiIc.c:206: _XimSetICMode(res, num, ic_values.input_style); Ximint.h:235:extern void _XimSetICMode( #### _XimSetICResourceList #### imDefIm.c:1967: if(!_XimSetICResourceList(&im->core.ic_resources, imDefIm.c:1999: if(!_XimSetICResourceList(&im->core.ic_resources, imLcIm.c:650: if(_XimSetICResourceList(&im->core.ic_resources, imRm.c:2175:_XimSetICResourceList( imThaiIm.c:92: if(_XimSetICResourceList(&im->core.ic_resources, Ximint.h:204:extern Bool _XimSetICResourceList( #### _XimSetICValueData #### imDefIc.c:622: name = _XimSetICValueData(ic, (XPointer)&ic_values, imDefIc.c:1343: if (_XimSetICValueData(ic, (XPointer)&ic_values, res, num, imLcIc.c:176: if(_XimSetICValueData(ic, (XPointer)&ic_values, imLcSIc.c:48: name = _XimSetICValueData(ic, (XPointer)&ic_values, imRm.c:2856:_XimSetICValueData( imRm.c:2881: if(((name = _XimSetICValueData(ic, imRm.c:2888: if(((name = _XimSetICValueData(ic, imThaiIc.c:208: if(_XimSetICValueData(ic, (XPointer)&ic_values, Ximint.h:379:extern char * _XimSetICValueData( #### _XimSetIMMode #### imDefIm.c:870: _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); imDefIm.c:871: _XimSetIMMode(im->private.proto.im_inner_resources, imDefIm.c:1972: _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); imDefIm.c:2004: _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); imLcIm.c:655: _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); imRm.c:2316:_XimSetIMMode( imThaiIm.c:97: _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); Ximint.h:230:extern void _XimSetIMMode( #### _XimSetIMResourceList #### imDefIm.c:1963: if(!_XimSetIMResourceList(&im->core.im_resources, imDefIm.c:1995: if(!_XimSetIMResourceList(&im->core.im_resources, imLcIm.c:646: if(_XimSetIMResourceList(&im->core.im_resources, imRm.c:2166:_XimSetIMResourceList( imThaiIm.c:88: if(_XimSetIMResourceList(&im->core.im_resources, Ximint.h:199:extern Bool _XimSetIMResourceList( #### _XimSetIMValueData #### imDefIm.c:1216: name = _XimSetIMValueData(im, (XPointer)&im_values, values, imLcIm.c:258: name = _XimSetIMValueData(im, (XPointer)&im_values, values, imRm.c:2256:_XimSetIMValueData( Ximint.h:363:extern char * _XimSetIMValueData( #### _XimSetInnerICResourceList #### imDefIm.c:866: if (!(_XimSetInnerICResourceList(&(im->private.proto.ic_inner_resources), imRm.c:2193:_XimSetInnerICResourceList( Ximint.h:214:extern Bool _XimSetInnerICResourceList( #### _XimSetInnerIMResourceList #### imDefIm.c:862: if (!(_XimSetInnerIMResourceList(&(im->private.proto.im_inner_resources), imRm.c:2184:_XimSetInnerIMResourceList( Ximint.h:209:extern Bool _XimSetInnerIMResourceList( #### _XimSetLocalIMDefaults #### imDefIm.c:1975: if(!_XimSetLocalIMDefaults(im, (XPointer)&im_values, imLcIm.c:658: if(_XimSetLocalIMDefaults(im, (XPointer)&im_values, imRm.c:2616:_XimSetLocalIMDefaults( imThaiIm.c:100: if(_XimSetLocalIMDefaults(im, (XPointer)&im_values, Ximint.h:251:extern Bool _XimSetLocalIMDefaults( #### _XimShutdown #### imDefIm.c:773: if (!(_XimShutdown(im))) /* Transport shutdown */ imDefIm.c:2033: _XimShutdown(im); imTransR.c:79:_XimShutdown(Xim im) Ximint.h:818:extern Bool _XimShutdown( #### _XimSync #### imDefIm.c:882: _XimSyncCallback, (XPointer)im); imDefLkup.c:102:_XimSyncCheck( imDefLkup.c:131:_XimSync( imDefLkup.c:157: _XimSyncCheck, (XPointer)ic); imDefLkup.c:167: _XimSyncCheck, (XPointer)ic); imDefLkup.c:223:_XimSyncCallback( imDefLkup.c:297: _XimSyncCheck, (XPointer)ic); imDefLkup.c:307: _XimSyncCheck, (XPointer)ic); Ximint.h:524:extern Bool _XimSyncCallback( Ximint.h:686:extern Bool _XimSync( #### _XimSyncCallback #### imDefIm.c:882: _XimSyncCallback, (XPointer)im); imDefLkup.c:223:_XimSyncCallback( Ximint.h:524:extern Bool _XimSyncCallback( #### _XimThaiCloseIM #### imThaiIm.c:50: _XimThaiCloseIM, /* close */ imThaiIm.c:219:_XimThaiCloseIM(XIM xim) Ximint.h:932:extern Status _XimThaiCloseIM( #### _XimThaiCreateIC #### imThaiIc.c:151:_XimThaiCreateIC( imThaiIm.c:53: _XimThaiCreateIC, /* create_ic */ Ximint.h:927:extern XIC _XimThaiCreateIC( #### _XimThaiFilter #### imThaiFlt.c:1214: * Helper functions for _XimThaiFilter() imThaiFlt.c:1288:_XimThaiFilter(Display *d, Window w, XEvent *ev, XPointer client_data) imThaiIc.c:54: _XimThaiFilter, (XPointer)ic); imThaiIc.c:103: KeyPress, KeyPress, _XimThaiFilter, (XPointer)ic); Ximint.h:920:extern Bool _XimThaiFilter( #### _XimThaiIMFree #### imImSw.c:52: { _XimCheckIfThaiProcessing, _XimThaiOpenIM, _XimThaiIMFree }, imThaiIm.c:144: _XimThaiIMFree(im); imThaiIm.c:149:_XimThaiIMFree(Xim im) imThaiIm.c:233: _XimThaiIMFree(im); Ximint.h:355:extern void _XimThaiIMFree( #### _XimThaiOpenIM #### imImSw.c:52: { _XimCheckIfThaiProcessing, _XimThaiOpenIM, _XimThaiIMFree }, imThaiIm.c:80:_XimThaiOpenIM(Xim im) Ximint.h:343:extern Bool _XimThaiOpenIM( #### _XimTransCallDispatcher #### imTrans.c:184:_XimTransCallDispatcher(Xim im, INT16 len, XPointer data) imTrans.c:318: im->private.proto.call_dispatcher = _XimTransCallDispatcher; XimTrans.h:96:extern Bool _XimTransCallDispatcher( #### _XimTransConf #### imTrans.c:294:_XimTransConf( imTransR.c:64: { "tcp", _XimTransConf }, /* use X transport lib */ imTransR.c:67: { "local", _XimTransConf }, /* use X transport lib */ XimTrInt.h:78:extern Bool _XimTransConf( #### _XimTransFilterWaitEvent #### imTrans.c:117: _XimTransFilterWaitEvent, (XPointer)im); imTrans.c:136: _XimTransFilterWaitEvent, (XPointer)im); imTrans.c:198:_XimTransFilterWaitEvent( XimTrans.h:106:extern Bool _XimTransFilterWaitEvent( #### _XimTransFlush #### imTrans.c:285:_XimTransFlush( imTrans.c:316: im->private.proto.flush = _XimTransFlush; XimTrans.h:132:extern void _XimTransFlush( #### _XimTransInternalConnection #### imTrans.c:120: (_XInternalConnectionProc)_XimTransInternalConnection, imTrans.c:213:_XimTransInternalConnection( XimTrans.h:113:extern void _XimTransInternalConnection( #### _XimTransRead #### imTrans.c:264:_XimTransRead( imTrans.c:315: im->private.proto.read = _XimTransRead; XimTrans.h:125:extern Bool _XimTransRead( #### _XimTransRegisterDispatcher #### imTrans.c:146:_XimTransRegisterDispatcher( imTrans.c:317: im->private.proto.register_dispatcher = _XimTransRegisterDispatcher; XimTrans.h:79:extern Bool _XimTransRegisterDispatcher( #### _XimTransWrite #### imTrans.c:247:_XimTransWrite(Xim im, INT16 len, XPointer data) imTrans.c:314: im->private.proto.write = _XimTransWrite; XimTrans.h:119:extern Bool _XimTransWrite( #### _XimTransportRec #### imDefIm.c:368: for(i = 0; _XimTransportRec[i].transportname ; i++) { imDefIm.c:370: _XimTransportRec[i].transportname, imDefIm.c:371: strlen(_XimTransportRec[i].transportname), imDefIm.c:373: if( _XimTransportRec[i].config(im, trans_addr) ) { imTransR.c:60:TransportSW _XimTransportRec[] = { XimTrInt.h:65:extern TransportSW _XimTransportRec[]; #### _XimTriggerNotify #### imDefFlt.c:99: (void)_XimTriggerNotify(im, ic, 0, (CARD32)idx); /* Trigger on */ imDefFlt.c:118: _XimTriggerNotify(im, ic, 1, (CARD32)idx); /* Trigger off */ imDefLkup.c:476:_XimTriggerNotifyCheck( imDefLkup.c:505:_XimTriggerNotify( imDefLkup.c:541: _XimTriggerNotifyCheck, (XPointer)ic); imDefLkup.c:551: _XimTriggerNotifyCheck, (XPointer)ic); Ximint.h:548:extern Bool _XimTriggerNotify( #### _XimUnRegisterIMInstantiateCallback #### imInsClbk.c:217:_XimUnRegisterIMInstantiateCallback( imInt.c:258: lcd->methods->unregister_callback = _XimUnRegisterIMInstantiateCallback; Ximint.h:800:extern Bool _XimUnRegisterIMInstantiateCallback( #### _XimUnregisterFilter #### imDefFlt.c:337:_XimUnregisterFilter( imDefIc.c:925: _XimUnregisterFilter(ic); imDefIc.c:1016: _XimUnregisterFilter(ic); imDefIc.c:1570: _XimUnregisterFilter(ic); imRmAttr.c:939: _XimUnregisterFilter(ic); Ximint.h:722:extern void _XimUnregisterFilter( #### _XimUnregisterServerFilter #### imDefFlt.c:399:_XimUnregisterServerFilter( imDefIm.c:1122: _XimUnregisterServerFilter(im); Ximint.h:544:extern void _XimUnregisterServerFilter( #### _XimWrite #### imCallbk.c:85:#define _XimWriteData(im,len,data) \ imCallbk.c:355: if (!(_XimWriteData(im, buf_len, buf))) { imCallbk.c:406: if (!(_XimWriteData(im, buf_len, buf))) { imCallbk.c:636: if (!(_XimWriteData(im, len, buf))) { imDefIc.c:187: if (!(_XimWrite(im, len, (XPointer)buf))) { imDefIc.c:372: if (!(_XimWrite(im, len, (XPointer)buf))) { imDefIc.c:768: if (!(_XimWrite(im, len, (XPointer)buf))) { imDefIc.c:911: (void)_XimWrite(im, len, (XPointer)buf); imDefIc.c:968: (void)_XimWrite(im, len, (XPointer)buf); imDefIc.c:1013: (void)_XimWrite(im, len, (XPointer)buf); imDefIc.c:1077: if (!(_XimWrite(im, len, (XPointer)buf))) imDefIc.c:1522: if (!(_XimWrite(im, len, (XPointer)buf))) { imDefIm.c:540: (void)_XimWrite(im, len, (XPointer)buf); imDefIm.c:607: if (!(_XimWrite(im, len, (XPointer)buf))) imDefIm.c:753: if (!(_XimWrite(im, len, (XPointer)buf))) imDefIm.c:821: if (!(_XimWrite(im, len, (XPointer)buf))) imDefIm.c:940: if (!(_XimWrite(im, len, (XPointer)buf))) imDefIm.c:1338: if (!(_XimWrite(im, len, (XPointer)buf))) { imDefIm.c:1481: if (!(_XimWrite(im, len, (XPointer)buf))) { imDefIm.c:1744: if (!(_XimWrite(im, len, (XPointer)buf))) { imDefIm.c:1868: if (!(_XimWrite(im, len, (XPointer)buf))) { imDefLkup.c:152: if (!(_XimWrite(im, len, (XPointer)buf))) imDefLkup.c:205: if (!(_XimWrite(im, len, (XPointer)buf))) imDefLkup.c:290: if (!(_XimWrite(im, len, (XPointer)buf))) imDefLkup.c:536: if (!(_XimWrite(im, len, (XPointer)buf))) imDefLkup.c:830: if (!(_XimWrite(im, len, (XPointer)buf))) imExten.c:260: if (!(_XimWrite(im, len, (XPointer)buf))) imExten.c:452: if (!(_XimWrite(im, len, (XPointer)buf))) { imExten.c:548: if (!(_XimWrite(im, len, (XPointer)buf))) imLcIm.c:436:_XimWriteCachedDefaultTree( imLcIm.c:617: _XimWriteCachedDefaultTree (intname, encoding, cachename, im); imTransR.c:85:_XimWrite(Xim im, INT16 len, XPointer data) Ximint.h:822:extern Bool _XimWrite( #### _XimXConf #### imTransR.c:61: { "X", _XimXConf }, /* 1st entry must be X. imTrX.c:495:_XimXConf(Xim im, char *address) XimTrInt.h:71:extern Bool _XimXConf( #### _XimXTransBytesReadable #### #### _XimXTransClose #### imTrans.c:94: _XimXTransClose (spec->trans_conn); imTrans.c:132: (void)_XimXTransClose(spec->trans_conn); #### _XimXTransCloseForCloning #### #### _XimXTransConnect #### imTrans.c:91: if ((connect_stat = _XimXTransConnect ( #### _XimXTransDisconnect #### imTrans.c:131: _XimXTransDisconnect(spec->trans_conn); #### _XimXTransFreeConnInfo #### #### _XimXTransGetConnectionNumber #### imTrans.c:109: spec->fd = _XimXTransGetConnectionNumber (spec->trans_conn); #### _XimXTransGetHostname #### #### _XimXTransGetPeerAddr #### #### _XimXTransIsLocal #### #### _XimXTransOpenCOTSClient #### imTrans.c:85: if ((spec->trans_conn = _XimXTransOpenCOTSClient ( #### _XimXTransRead #### imTrans.c:277: if ((len = _XimXTransRead(spec->trans_conn, recv_buf, buf_len)) <= 0) #### _XimXTransReadv #### #### _XimXTransSetOption #### #### _XimXTransSocketINET6Funcs #### #### _XimXTransSocketINETFuncs #### #### _XimXTransSocketLocalFuncs #### #### _XimXTransSocketTCPFuncs #### #### _XimXTransSocketUNIXFuncs #### #### _XimXTransWrite #### imTrans.c:254: if ((nbyte = _XimXTransWrite(spec->trans_conn, buf, len)) <= 0) #### _XimXTransWritev #### #### _Ximctstombs #### imDefIm.c:1534: _Ximctstombs, /* ctstombs */ imDefLkup.c:903:_Ximctstombs(XIM xim, char *from, int from_len, Ximint.h:616:extern int _Ximctstombs( #### _Ximctstoutf8 #### imDefIm.c:1536: _Ximctstoutf8 /* ctstoutf8 */ imDefLkup.c:979:_Ximctstoutf8( Ximint.h:634:extern int _Ximctstoutf8( #### _Ximctstowcs #### imDefIm.c:1535: _Ximctstowcs, /* ctstowcs */ imDefLkup.c:911:_Ximctstowcs( Ximint.h:625:extern int _Ximctstowcs( #### _XkbCopyFromReadBuffer #### XKBExtDev.c:137: if (!_XkbCopyFromReadBuffer(buf, XKBExtDev.c:209: if (!_XkbCopyFromReadBuffer(&buf, (char *) act, size)) XKBGeom.c:294: if (!_XkbCopyFromReadBuffer(buf, (char *) geom->key_aliases, XKBGetMap.c:266: if (!_XkbCopyFromReadBuffer(buf, (char *) numDesc, nKeyActs)) { XKBGetMap.c:295: if (!_XkbCopyFromReadBuffer(buf, (char *) newActs, XKBNames.c:188: if (!_XkbCopyFromReadBuffer(&buf, XKBNames.c:200: if (!_XkbCopyFromReadBuffer(&buf, (char *) names->key_aliases, XKBRdBuf.c:67:_XkbCopyFromReadBuffer(XkbReadBufferPtr from, char *to, int size) XKBlibint.h:203:extern int _XkbCopyFromReadBuffer( XKBlibint.h:231:#define _XkbReadBufferCopy32(f,t,s) _XkbCopyFromReadBuffer(f, (char *)t, (s)*4) #### _XkbFreeReadBuffer #### XKBCompat.c:98: i = _XkbFreeReadBuffer(&buf); XKBCompat.c:105: _XkbFreeReadBuffer(&buf); XKBExtDev.c:221: tmp = _XkbFreeReadBuffer(&buf); XKBExtDev.c:228: _XkbFreeReadBuffer(&buf); XKBGeom.c:647: left = _XkbFreeReadBuffer(&buf); XKBGetMap.c:545: left = _XkbFreeReadBuffer(&buf); XKBleds.c:94: _XkbFreeReadBuffer(&buf); XKBleds.c:109: left = _XkbFreeReadBuffer(&buf); XKBList.c:200: _XkbFreeReadBuffer(&buf); XKBList.c:221: left = _XkbFreeReadBuffer(&buf); XKBNames.c:228: len = _XkbFreeReadBuffer(&buf); XKBNames.c:234: _XkbFreeReadBuffer(&buf); XKBRdBuf.c:164:_XkbFreeReadBuffer(XkbReadBufferPtr buf) XKBlibint.h:277:extern int _XkbFreeReadBuffer( #### _XkbGetAtomNameFunc #### XKB.c:36:XkbGetAtomNameFunc _XkbGetAtomNameFunc = XGetAtomName; XKB.c:773: _XkbGetAtomNameFunc = (getName ? getName : XGetAtomName); XKBlibint.h:64:extern XkbGetAtomNameFunc _XkbGetAtomNameFunc; #### _XkbGetCharset #### Font.c:667: /* next three lines stolen from _XkbGetCharset() */ XKBBind.c:605: _XkbGetConverters(_XkbGetCharset(), &xkb->cvt); XKBCvt.c:210: * The function _XkbGetCharset seems to be missnamed as what it seems to XKBCvt.c:231:_XkbGetCharset(void) XKBCvt.c:334:_XkbGetCharset(void) XKBlibint.h:287:extern char *_XkbGetCharset( #### _XkbGetConverters #### XKBBind.c:605: _XkbGetConverters(_XkbGetCharset(), &xkb->cvt); XKBBind.c:606: _XkbGetConverters("ISO8859-1", &xkb->latin1cvt); XKBCvt.c:194:_XkbGetConverters(const char *encoding_name, XkbConverters * cvt_rtrn) XKBlibint.h:291:extern int _XkbGetConverters( #### _XkbGetReadBufferCountedString #### XKBExtDev.c:199: if (!_XkbGetReadBufferCountedString(&buf, &devi->name)) XKBGeom.c:269: ok = _XkbGetReadBufferCountedString(buf, &name) && ok; XKBGeom.c:270: ok = _XkbGetReadBufferCountedString(buf, &value) && ok; XKBGeom.c:320: if (!_XkbGetReadBufferCountedString(buf, &spec)) XKBGeom.c:429: if (!_XkbGetReadBufferCountedString(buf, &doodad->text.text)) XKBGeom.c:431: if (!_XkbGetReadBufferCountedString(buf, &doodad->text.font)) XKBGeom.c:442: if (!_XkbGetReadBufferCountedString(buf, &doodad->logo.logo_name)) XKBGeom.c:633: if (!_XkbGetReadBufferCountedString(&buf, &geom->label_font)) XKBRdBuf.c:180:_XkbGetReadBufferCountedString(XkbReadBufferPtr buf, char **rtrn) XKBlibint.h:282:_XkbGetReadBufferCountedString( #### _XkbGetReadBufferPtr #### XKBCompat.c:60: wire = (xkbSymInterpretWireDesc *) _XkbGetReadBufferPtr(&buf, XKBCompat.c:86: _XkbGetReadBufferPtr(&buf, nGroups * SIZEOF(xkbModsWireDesc)); XKBGeom.c:352: _XkbGetReadBufferPtr(buf, SIZEOF(xkbShapeWireDesc)); XKBGeom.c:365: _XkbGetReadBufferPtr(buf, SIZEOF(xkbOutlineWireDesc)); XKBGeom.c:376: _XkbGetReadBufferPtr(buf, SIZEOF(xkbPointWireDesc)); XKBGeom.c:408: _XkbGetReadBufferPtr(buf, SIZEOF(xkbDoodadWireDesc)); XKBGeom.c:461: _XkbGetReadBufferPtr(buf, SIZEOF(xkbOverlayWireDesc)); XKBGeom.c:474: _XkbGetReadBufferPtr(buf, SIZEOF(xkbOverlayRowWireDesc)); XKBGeom.c:484: _XkbGetReadBufferPtr(buf, XKBGeom.c:514: _XkbGetReadBufferPtr(buf, SIZEOF(xkbSectionWireDesc)); XKBGeom.c:536: _XkbGetReadBufferPtr(buf, SIZEOF(xkbRowWireDesc)); XKBGeom.c:553: _XkbGetReadBufferPtr(buf, SIZEOF(xkbKeyWireDesc)); XKBGetMap.c:58: _XkbGetReadBufferPtr(buf, SIZEOF(xkbKeyTypeWireDesc)); XKBGetMap.c:112: (xkbKTMapEntryWireDesc *) _XkbGetReadBufferPtr(buf, size); XKBGetMap.c:130: pwire = (xkbModsWireDesc *) _XkbGetReadBufferPtr(buf, sz); XKBGetMap.c:179: _XkbGetReadBufferPtr(buf, SIZEOF(xkbSymMapWireDesc)); XKBGetMap.c:222: _XkbGetReadBufferPtr(buf, SIZEOF(xkbSymMapWireDesc)); XKBGetMap.c:331: wire = (xkbBehaviorWireDesc *) _XkbGetReadBufferPtr(buf, XKBGetMap.c:353: data = _XkbGetReadBufferPtr(buf, XkbPaddedSize(nVMods)); XKBGetMap.c:391: wire = (unsigned char *) _XkbGetReadBufferPtr(buf, i); XKBGetMap.c:421: wire = (unsigned char *) _XkbGetReadBufferPtr(buf, i); XKBGetMap.c:459: wire = (xkbVModMapWireDesc *) _XkbGetReadBufferPtr(buf, i); XKBleds.c:91: _XkbGetReadBufferPtr(&buf, XKBList.c:72: flags = (CARD16 *) _XkbGetReadBufferPtr(buf, 2 * sizeof(CARD16)); XKBList.c:82: str = (char *) _XkbGetReadBufferPtr(buf, wlen); XKBNames.c:121: (CARD8 *) _XkbGetReadBufferPtr(&buf, XkbPaddedSize(rep->nTypes)); XKBRdBuf.c:150:_XkbGetReadBufferPtr(XkbReadBufferPtr from, int size) XKBlibint.h:271:extern char *_XkbGetReadBufferPtr( XKBlibint.h:275:#define _XkbGetTypedRdBufPtr(b,n,t) ((t *)_XkbGetReadBufferPtr(b,(n)*SIZEOF(t))) #### _XkbInitReadBuffer #### XKBCompat.c:45: if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) XKBExtDev.c:182: if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) XKBGeom.c:628: if (_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) { XKBGetMap.c:524: if (_XkbInitReadBuffer(dpy, &buf, extraData)) { XKBleds.c:77: if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) XKBList.c:195: if (_XkbInitReadBuffer(dpy, &buf, extraLen)) { XKBNames.c:76: if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) XKBRdBuf.c:38:_XkbInitReadBuffer(Display *dpy, XkbReadBufferPtr buf, int size) XKBlibint.h:192:extern int _XkbInitReadBuffer( #### _XkbInternAtomFunc #### XKB.c:35:XkbInternAtomFunc _XkbInternAtomFunc = XInternAtom; XKB.c:772: _XkbInternAtomFunc = (getAtom ? getAtom : XInternAtom); XKBlibint.h:63:extern XkbInternAtomFunc _XkbInternAtomFunc; #### _XkbNoteCoreMapChanges #### XKBBind.c:416: _XkbNoteCoreMapChanges(&changes, event, XKB_XLIB_MAP_MASK); XKBUse.c:181:_XkbNoteCoreMapChanges(XkbMapChangesPtr old, XKBUse.c:309: _XkbNoteCoreMapChanges(&xkbi->changes, ev, XKB_XLIB_MAP_MASK); XKBlibint.h:186:extern void _XkbNoteCoreMapChanges( #### _XkbPeekAtReadBuffer #### XKBRdBuf.c:141:_XkbPeekAtReadBuffer(XkbReadBufferPtr from, int size) XKBlibint.h:266:extern char *_XkbPeekAtReadBuffer( #### (arch=amd64 ia64 alpha ppc64 arm64)_XkbReadBufferCopy32 #### #### _XkbReadBufferCopyKeySyms #### XKBGetMap.c:203: _XkbReadBufferCopyKeySyms(buf, (KeySym *) &map->syms[offset], XKBGetMap.c:235: _XkbReadBufferCopyKeySyms(buf, newSyms, newMap->nSyms); XKBRdBuf.c:90:_XkbReadBufferCopyKeySyms(XkbReadBufferPtr from, KeySym * to, int num_words) XKBlibint.h:251:extern int _XkbReadBufferCopyKeySyms( XKBlibint.h:263:#define _XkbReadBufferCopyKeySyms(f,t,s) _XkbReadBufferCopy32(f,t,s) #### (arch=amd64 ia64 alpha ppc64 arm64)_XkbReadCopyData32 #### #### _XkbReadCopyKeySyms #### XKBRdBuf.c:81:_XkbReadCopyKeySyms(int *wire, KeySym * to, int num_words) XKBRdBuf.c:94: _XkbReadCopyKeySyms((int *) from->data, to, num_words); XKBlibint.h:239:extern int _XkbReadCopyKeySyms( XKBlibint.h:261:#define _XkbReadCopyKeySyms(f,t,n) _XkbReadCopyData32(f,t,n) #### _XkbReadGetCompatMapReply #### XKBCompat.c:37:_XkbReadGetCompatMapReply(Display *dpy, XKBCompat.c:148: status = _XkbReadGetCompatMapReply(dpy, &rep, xkb, NULL); XKBGetByName.c:166: status = _XkbReadGetCompatMapReply(dpy, &crep, xkb, &nread); XKBlibint.h:305:extern Status _XkbReadGetCompatMapReply( #### _XkbReadGetGeometryReply #### XKBGeom.c:607:_XkbReadGetGeometryReply(Display *dpy, XKBGeom.c:692: status = _XkbReadGetGeometryReply(dpy, &rep, xkb, NULL); XKBGeom.c:720: status = _XkbReadGetGeometryReply(dpy, &rep, xkb, NULL); XKBGetByName.c:202: status = _XkbReadGetGeometryReply(dpy, &grep, xkb, &nread); XKBlibint.h:326:extern Status _XkbReadGetGeometryReply( #### _XkbReadGetIndicatorMapReply #### XKBGetByName.c:178: status = _XkbReadGetIndicatorMapReply(dpy, &irep, xkb, &nread); XKBleds.c:61:_XkbReadGetIndicatorMapReply(Display *dpy, XKBleds.c:148: status = _XkbReadGetIndicatorMapReply(dpy, &rep, xkb, NULL); XKBlibint.h:312:extern Status _XkbReadGetIndicatorMapReply( #### _XkbReadGetMapReply #### XKBGetByName.c:154: status = _XkbReadGetMapReply(dpy, &mrep, xkb, &nread); XKBGetMap.c:493:_XkbReadGetMapReply(Display *dpy, XKBGetMap.c:567: return _XkbReadGetMapReply(dpy, &rep, xkb, NULL); XKBlibint.h:298:extern Status _XkbReadGetMapReply( #### _XkbReadGetNamesReply #### XKBGetByName.c:190: status = _XkbReadGetNamesReply(dpy, &nrep, xkb, &nread); XKBNames.c:55:_XkbReadGetNamesReply(Display *dpy, XKBNames.c:270: status = _XkbReadGetNamesReply(dpy, &rep, xkb, NULL); XKBlibint.h:319:extern Status _XkbReadGetNamesReply( #### _XkbReloadDpy #### XKBBind.c:362: _XkbReloadDpy(dpy); XKBBind.c:409: _XkbReloadDpy(dpy); XKBBind.c:545:_XkbReloadDpy(Display *dpy) XKBlibint.h:89: _XkbReloadDpy((d)); \ XKBlibint.h:129:extern void _XkbReloadDpy( #### _XkbSkipReadBufferData #### XKBGeom.c:301: _XkbSkipReadBufferData(buf, (rep->nKeyAliases * XkbKeyNameLength * 2)); XKBGetMap.c:271: if ((i > 0) && (!_XkbSkipReadBufferData(buf, i))) { XKBNames.c:113: if ((len > 0) && (!_XkbSkipReadBufferData(&buf, len))) XKBNames.c:129: if (!_XkbSkipReadBufferData(&buf, nLevels[i] * 4)) XKBNames.c:149: _XkbSkipReadBufferData(&buf, nLevels[i] * 4); XKBNames.c:155: _XkbSkipReadBufferData(&buf, nLevels[i] * 4); XKBNames.c:194: _XkbSkipReadBufferData(&buf, rep->nKeys * XkbKeyNameLength); XKBRdBuf.c:55:_XkbSkipReadBufferData(XkbReadBufferPtr from, int size) XKBlibint.h:198:extern int _XkbSkipReadBufferData( #### (arch=amd64 ia64 alpha ppc64 arm64)_XkbWriteCopyData32 #### #### _XkbWriteCopyKeySyms #### XKBRdBuf.c:100:_XkbWriteCopyKeySyms(register KeySym * from, CARD32 *to, int len) XKBSetMap.c:150: _XkbWriteCopyKeySyms(pSym, outSym, desc->nSyms); XKBlibint.h:245:extern int _XkbWriteCopyKeySyms( XKBlibint.h:262:#define _XkbWriteCopyKeySyms(f,t,n) _XkbWriteCopyData32(f,t,n) #### _XkeyTable #### KeysymStr.c:91: const unsigned char *entry = &_XkeyTable[idx]; StrKeysym.c:95: entry = &_XkeyTable[idx]; Key.h:9:extern const unsigned char _XkeyTable[]; #### _XlcAddCT #### lcCT.c:405: * at runtime through _XlcAddCT. lcCT.c:456:_XlcAddCT( lcCT.c:1276: charset = _XlcAddCT(ct_data->name, ct_data->ct_sequence); lcGeneric.c:525: _XlcAddCT(charsetd->name, charsetd->ct_sequence); lcGeneric.c:837: charset = _XlcAddCT(name, encoding); XlcPubI.h:129:extern XlcCharSet _XlcAddCT( #### _XlcAddCharSet #### lcCharSet.c:87:_XlcAddCharSet( lcCT.c:476: _XlcAddCharSet(charset); lcGeneric.c:406: _XlcAddCharSet(charset); lcGeneric.c:845: _XlcAddCharSet(charset); XlcPublic.h:133:extern Bool _XlcAddCharSet( #### _XlcAddGB18030LocaleConverters #### lcUTF8.c:2364:_XlcAddGB18030LocaleConverters( lcUTF8Load.c:60: _XlcAddGB18030LocaleConverters(lcd); Xlcint.h:914:extern void _XlcAddGB18030LocaleConverters( #### _XlcAddLoader #### lcInit.c:121: _XlcAddLoader(_XlcDynamicLoad, XlcHead); lcInit.c:125: _XlcAddLoader(_XlcGenericLoader, XlcHead); lcInit.c:129: _XlcAddLoader(_XlcDefaultLoader, XlcHead); lcInit.c:133: _XlcAddLoader(_XlcUtf8Loader, XlcHead); lcInit.c:137: _XlcAddLoader(_XlcDynamicLoader, XlcHead); lcWrap.c:212:_XlcAddLoader( Xlcint.h:893:extern Bool _XlcAddLoader( #### _XlcAddUtf8Converters #### lcDefConv.c:803: _XlcAddUtf8Converters(lcd); lcGenConv.c:3109: _XlcAddUtf8Converters(lcd); lcUTF8.c:1133:_XlcAddUtf8Converters( lcUTF8Load.c:67: _XlcAddUtf8Converters(lcd); Xlcint.h:904:extern void _XlcAddUtf8Converters( #### _XlcAddUtf8LocaleConverters #### lcUTF8.c:2330:_XlcAddUtf8LocaleConverters( lcUTF8Load.c:57: _XlcAddUtf8LocaleConverters(lcd); Xlcint.h:909:extern void _XlcAddUtf8LocaleConverters( #### _XlcCloseConverter #### imDefIm.c:1009: _XlcCloseConverter(im->private.proto.ctom_conv); imDefIm.c:1013: _XlcCloseConverter(im->private.proto.ctow_conv); imDefIm.c:1017: _XlcCloseConverter(im->private.proto.ctoutf8_conv); imDefIm.c:1021: _XlcCloseConverter(im->private.proto.cstomb_conv); imDefIm.c:1025: _XlcCloseConverter(im->private.proto.cstowc_conv); imDefIm.c:1029: _XlcCloseConverter(im->private.proto.cstoutf8_conv); imDefIm.c:1033: _XlcCloseConverter(im->private.proto.ucstoc_conv); imDefIm.c:1037: _XlcCloseConverter(im->private.proto.ucstoutf8_conv); imLcIm.c:180: _XlcCloseConverter(im->private.local.ctom_conv); imLcIm.c:184: _XlcCloseConverter(im->private.local.ctow_conv); imLcIm.c:188: _XlcCloseConverter(im->private.local.ctoutf8_conv); imLcIm.c:192: _XlcCloseConverter(im->private.local.cstomb_conv); imLcIm.c:196: _XlcCloseConverter(im->private.local.cstowc_conv); imLcIm.c:200: _XlcCloseConverter(im->private.local.cstoutf8_conv); imLcIm.c:204: _XlcCloseConverter(im->private.local.ucstoc_conv); imLcIm.c:208: _XlcCloseConverter(im->private.local.ucstoutf8_conv); imThaiFlt.c:589: _XlcCloseConverter(conv); imThaiIm.c:184: _XlcCloseConverter(im->private.local.ctom_conv); imThaiIm.c:188: _XlcCloseConverter(im->private.local.ctow_conv); imThaiIm.c:192: _XlcCloseConverter(im->private.local.ctoutf8_conv); imThaiIm.c:196: _XlcCloseConverter(im->private.local.cstomb_conv); imThaiIm.c:200: _XlcCloseConverter(im->private.local.cstowc_conv); imThaiIm.c:204: _XlcCloseConverter(im->private.local.cstoutf8_conv); imThaiIm.c:208: _XlcCloseConverter(im->private.local.ucstoc_conv); imThaiIm.c:212: _XlcCloseConverter(im->private.local.ucstoutf8_conv); lcConv.c:313:_XlcCloseConverter( lcPrTxt.c:225: _XlcCloseConverter(conv); lcRM.c:178: _XlcCloseConverter(((MbState) state)->conv); lcStd.c:54: _XlcCloseConverter(conv); lcStd.c:97: _XlcCloseConverter(conv); lcStd.c:154: _XlcCloseConverter(conv); lcStd.c:193: _XlcCloseConverter(conv); lcStd.c:346: _XlcCloseConverter(conv); lcTxtPr.c:175: _XlcCloseConverter(conv); lcTxtPr.c:191: _XlcCloseConverter(conv); omGeneric.c:1413: _XlcCloseConverter(gen->mbs_to_cs); omGeneric.c:1416: _XlcCloseConverter(gen->wcs_to_cs); omGeneric.c:1419: _XlcCloseConverter(gen->utf8_to_cs); XDefaultIMIF.c:237: _XlcCloseConverter(im->private->ctom_conv); XDefaultIMIF.c:239: _XlcCloseConverter(im->private->ctow_conv); XlcPublic.h:250:extern void _XlcCloseConverter( #### _XlcCompareISOLatin1 #### imDefIm.c:176: if( locale_name[n] && !_XlcCompareISOLatin1( pp, locale_name[n] ) ) lcGeneric.c:718: if (num > 0 && !_XlcCompareISOLatin1(value[0], "True")) lcGeneric.c:724: if (num > 0 && !_XlcCompareISOLatin1(value[0], "True")) lcGeneric.c:755: if (tmp != NULL && !_XlcCompareISOLatin1(tmp + 1, "Default")) { lcPublic.c:125: if (num > 0 && !_XlcCompareISOLatin1(values[0], "True")) lcUTF8.c:958: && _XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "UTF-8") == 0) { lcUTF8Load.c:56: else if (!_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "UTF-8")) { lcUTF8Load.c:59: else if (!_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "GB18030")) { lcUtil.c:42:_XlcCompareISOLatin1( omGeneric.c:606: if (_XlcCompareISOLatin1(last - length, font_data->name) == 0) omGeneric.c:1600: if (!_XlcCompareISOLatin1(gen->object_name, methods_list->name)) { omGeneric.c:1850: if (bufptr && _XlcCompareISOLatin1(bufptr, "GL") == 0) omGeneric.c:1852: else if (bufptr && _XlcCompareISOLatin1(bufptr, "GR") == 0) omGeneric.c:1926: if (count > 0 && _XlcCompareISOLatin1(*value, "True") == 0) XDefaultOMIF.c:179: if (_XlcCompareISOLatin1(last - length, font_data->name) == 0) XDefaultOMIF.c:428: if (_XlcCompareISOLatin1(charset_p, XlcPublic.h:304:extern int _XlcCompareISOLatin1( #### _XlcCompileResourceList #### lcCharSet.c:132: _XlcCompileResourceList(resources, XlcNumber(resources)); lcPublic.c:307: _XlcCompileResourceList(resources, XlcNumber(resources)); lcWrap.c:578:_XlcCompileResourceList( omGeneric.c:1579: _XlcCompileResourceList(oc_resources, XlcNumber(oc_resources)); omGeneric.c:1779: _XlcCompileResourceList(om_resources, XlcNumber(om_resources)); XDefaultOMIF.c:886: _XlcCompileResourceList(oc_resources, XlcNumber(oc_resources)); XDefaultOMIF.c:1109: _XlcCompileResourceList(om_resources, XlcNumber(om_resources)); Xlcint.h:863:extern void _XlcCompileResourceList( #### _XlcConvert #### imConv.c:201: if (_XlcConvert(private->ucstoc_conv, imConv.c:211: if (_XlcConvert(private->cstomb_conv, imConv.c:270: if (_XlcConvert(private->ucstoc_conv, imConv.c:281: if (_XlcConvert(private->cstowc_conv, imConv.c:342: if (_XlcConvert(private->ucstoutf8_conv, imDefLkup.c:877: if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, imDefLkup.c:953: if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, imLcLkup.c:315: if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, imLcLkup.c:386: if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, imLcPrs.c:425: if (_XlcConvert(im->private.local.ucstoc_conv, imLcPrs.c:435: if (_XlcConvert(im->private.local.cstomb_conv, imThaiFlt.c:584: if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, lcConv.c:33:typedef struct _XlcConverterListRec { lcConv.c:41: struct _XlcConverterListRec *next; lcConv.c:320:_XlcConvert( lcPrTxt.c:195: ret = _XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0); lcRM.c:145: ret = _XlcConvert(conv, (XPointer *) &from, &from_left, lcStd.c:71: if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) lcStd.c:114: if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) lcStd.c:146: if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) lcStd.c:185: if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) lcStd.c:338: if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) lcTxtPr.c:168: ret = _XlcConvert(conv, &from, &from_left, (XPointer *) &to, &to_left, omDefault.c:59: ret = _XlcConvert(conv, (XPointer *) &from, &length, (XPointer *) &to, omDefault.c:82: ret = _XlcConvert(conv, (XPointer *) &from, &length, (XPointer *) &to, omXChar.c:325: ret = _XlcConvert(conv, from, from_left, &cs, &cs_left, lc_args, 1); XDefaultOMIF.c:595: ret = _XlcConvert(conv, (XPointer *) &from, &length, (XPointer *) &to, XlcPublic.h:254:extern int _XlcConvert( #### _XlcCopyFromArg #### lcWrap.c:499:_XlcCopyFromArg( lcWrap.c:638: _XlcCopyFromArg(args->value, base + res->offset, res->size); Xlcint.h:851:extern void _XlcCopyFromArg( #### _XlcCopyToArg #### lcWrap.c:523:_XlcCopyToArg( lcWrap.c:606: _XlcCopyToArg(base + res->offset, &args->value, res->size); Xlcint.h:857:extern void _XlcCopyToArg( #### _XlcCountVaList #### lcCharSet.c:150: _XlcCountVaList(var, &num_args); lcPubWrap.c:42: _XlcCountVaList(var, &num_args); lcWrap.c:547:_XlcCountVaList( OCWrap.c:41: _XlcCountVaList(var, &num_args); OCWrap.c:99: _XlcCountVaList(var, &num_args); OCWrap.c:125: _XlcCountVaList(var, &num_args); OMWrap.c:76: _XlcCountVaList(var, &num_args); OMWrap.c:102: _XlcCountVaList(var, &num_args); Xlcint.h:839:extern void _XlcCountVaList( #### _XlcCreateDefaultCharSet #### lcCharSet.c:170:_XlcCreateDefaultCharSet( lcCT.c:311: * Used by _XlcCreateDefaultCharSet. lcCT.c:473: charset = _XlcCreateDefaultCharSet(name, ct_sequence); lcGeneric.c:405: (charset = _XlcCreateDefaultCharSet(name, ""))) { lcGeneric.c:842: (charset = _XlcCreateDefaultCharSet(name, ""))) { XlcPubI.h:124:extern XlcCharSet _XlcCreateDefaultCharSet( #### _XlcCreateLC #### lcDefConv.c:779: lcd = _XlcCreateLC(name, _XlcGenericMethods); lcDynamic.c:72: lcd = _XlcCreateLC(name,_XlcGenericMethods); lcGenConv.c:3061: lcd = _XlcCreateLC(name, _XlcGenericMethods); lcPubWrap.c:69:_XlcCreateLC( lcUTF8Load.c:47: lcd = _XlcCreateLC(name, _XlcGenericMethods); XlcPubI.h:107:extern XLCd _XlcCreateLC( #### _XlcCreateLocaleDataBase #### lcDB.c:1269:/* _XlcCreateLocaleDataBase(lcd) */ lcDB.c:1275:_XlcCreateLocaleDataBase( lcPublic.c:113: if(_XlcCreateLocaleDataBase(lcd) == NULL) XlcPubI.h:219:extern XPointer _XlcCreateLocaleDataBase( #### _XlcCurrentLC #### Font.c:668: lcd = _XlcCurrentLC(); Font.c:669: if ((lcd = _XlcCurrentLC()) != 0) IMWrap.c:194: XLCd lcd = _XlcCurrentLC(); lcStd.c:46: lcd = _XlcCurrentLC(); lcStd.c:89: lcd = _XlcCurrentLC(); lcStd.c:132: lcd = _XlcCurrentLC(); lcStd.c:171: lcd = _XlcCurrentLC(); lcStd.c:324: lcd = _XlcCurrentLC(); lcWrap.c:78: XLCd lcd = _XlcCurrentLC(); lcWrap.c:98: return _XlcCurrentLC() != (XLCd)NULL; lcWrap.c:349:_XlcCurrentLC(void) lcWrap.c:383: XLCd lcd = _XlcCurrentLC(); lcWrap.c:399: XLCd lcd = _XlcCurrentLC(); lcWrap.c:415: XLCd lcd = _XlcCurrentLC(); lcWrap.c:432: XLCd lcd = _XlcCurrentLC(); lcWrap.c:449: XLCd lcd = _XlcCurrentLC(); lcWrap.c:466: XLCd lcd = _XlcCurrentLC(); lcWrap.c:479: XLCd lcd = _XlcCurrentLC(); lcWrap.c:490: XLCd lcd = _XlcCurrentLC(); XKBCvt.c:343: lcd = _XlcCurrentLC(); Xlcint.h:767:extern XLCd _XlcCurrentLC (void); #### _XlcDbg_printValue #### lcGeneric.c:364:_XlcDbg_printValue( lcGeneric.c:434: _XlcDbg_printValue(name,value,num); lcGeneric.c:442: _XlcDbg_printValue(name,value,num); lcGeneric.c:474: _XlcDbg_printValue(name,value,num); lcGeneric.c:481: _XlcDbg_printValue(name,value,num); lcGeneric.c:488: _XlcDbg_printValue(name,value,num); lcGeneric.c:499: _XlcDbg_printValue(name,value,num); lcGeneric.c:515: _XlcDbg_printValue(name,value,num); lcGeneric.c:576: _XlcDbg_printValue(name,value,num); lcGeneric.c:590: _XlcDbg_printValue(name,value,num); lcGeneric.c:602: _XlcDbg_printValue(name,value,num); lcGeneric.c:613: _XlcDbg_printValue(name,value,num); lcGeneric.c:621: _XlcDbg_printValue(name,value,num); lcGeneric.c:880: _XlcDbg_printValue(name,value,num); lcGeneric.c:901: _XlcDbg_printValue(name,value,num); lcGeneric.c:913: _XlcDbg_printValue(name,value,num); lcGeneric.c:925: _XlcDbg_printValue(name,value,num); lcGeneric.c:932: _XlcDbg_printValue(name,value,num); omGeneric.c:1897: _XlcDbg_printValue(buf,value,count); omGeneric.c:1905: _XlcDbg_printValue(buf,value,count); XlcGeneric.h:149:_XlcDbg_printValue( #### _XlcDeInitLoader #### lcInit.c:144:_XlcDeInitLoader(void) lcWrap.c:339: _XlcDeInitLoader(); Xlcint.h:889:extern void _XlcDeInitLoader (void); #### _XlcDefaultLoader #### lcDefConv.c:774:_XlcDefaultLoader( lcInit.c:129: _XlcAddLoader(_XlcDefaultLoader, XlcHead); lcInit.c:156: _XlcRemoveLoader(_XlcDefaultLoader); Xlcint.h:919:extern XLCd _XlcDefaultLoader( #### _XlcDefaultMapModifiers #### lcPublic.c:48: _XlcDefaultMapModifiers, lcWrap.c:131:_XlcDefaultMapModifiers( Xlcint.h:774:extern char *_XlcDefaultMapModifiers( #### _XlcDestroyLC #### lcDefConv.c:784: _XlcDestroyLC(lcd); lcPubWrap.c:60:_XlcDestroyLC( lcPubWrap.c:95: _XlcDestroyLC(lcd); lcUTF8Load.c:53: _XlcDestroyLC(lcd); lcUTF8Load.c:63: _XlcDestroyLC(lcd); XlcPubI.h:112:extern void _XlcDestroyLC( #### _XlcDestroyLocaleDataBase #### lcDB.c:1232:/* _XlcDestroyLocaleDataBase(lcd) */ lcDB.c:1241:_XlcDestroyLocaleDataBase( lcPublic.c:273: _XlcDestroyLocaleDataBase(lcd); XlcPubI.h:223:extern void _XlcDestroyLocaleDataBase( #### _XlcFileName #### imLcIm.c:103: name = _XlcFileName(im->core.lcd, COMPOSE_FILE); imLcIm.c:547: tmpname = name = _XlcFileName(im->core.lcd, COMPOSE_FILE); imLcPrs.c:336: lcCompose = _XlcFileName(im->core.lcd, COMPOSE_FILE); lcDB.c:1285: name = _XlcFileName(lcd, "locale"); lcFile.c:465:_XlcFileName( XlcPublic.h:284:extern char *_XlcFileName( #### _XlcGenericLoader #### lcGenConv.c:3053:_XlcGenericLoader( lcInit.c:125: _XlcAddLoader(_XlcGenericLoader, XlcHead); lcInit.c:152: _XlcRemoveLoader(_XlcGenericLoader); Xlcint.h:925:extern XLCd _XlcGenericLoader( #### _XlcGenericMethods #### lcDefConv.c:779: lcd = _XlcCreateLC(name, _XlcGenericMethods); lcDynamic.c:64: XLCdMethods _XlcGenericMethods; lcDynamic.c:71: _XlcGenericMethods = (XLCdMethods)dlsym(nlshandler,"genericMethods"); lcDynamic.c:72: lcd = _XlcCreateLC(name,_XlcGenericMethods); lcGenConv.c:3061: lcd = _XlcCreateLC(name, _XlcGenericMethods); lcGeneric.c:53:XLCdMethods _XlcGenericMethods = (XLCdMethods) &genericMethods; lcUTF8Load.c:47: lcd = _XlcCreateLC(name, _XlcGenericMethods); XlcGeneric.h:142:extern XLCdMethods _XlcGenericMethods; #### _XlcGetCSValues #### lcCharSet.c:142:_XlcGetCSValues(XlcCharSet charset, ...) XlcPublic.h:140:extern char *_XlcGetCSValues( #### _XlcGetCharSet #### lcCharSet.c:46:_XlcGetCharSet( lcCharSet.c:66:_XlcGetCharSetWithSide( lcCharSet.c:92: if (_XlcGetCharSet(charset->name)) lcCT.c:467: charset = _XlcGetCharSet(name); lcCT.c:682: default_GL_charset = _XlcGetCharSet("ISO8859-1:GL"); lcCT.c:683: default_GR_charset = _XlcGetCharSet("ISO8859-1:GR"); lcGenConv.c:3066: default_GL_charset = _XlcGetCharSet("ISO8859-1:GL"); lcGenConv.c:3067: default_GR_charset = _XlcGetCharSet("ISO8859-1:GR"); lcGeneric.c:403: charset = _XlcGetCharSet(name); lcGeneric.c:840: charset = _XlcGetCharSet(name); lcUTF8.c:644: _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); lcUTF8.c:747: _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); lcUTF8.c:1038: charset = _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); lcUTF8.c:1527: _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); lcUTF8.c:1620: _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); lcUTF8.c:1763: XlcCharSet charset = _XlcGetCharSet(*value++); lcUTF8.c:1958: _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); lcUTF8.c:2053: _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); omGeneric.c:1959: *charset_list++ = _XlcGetCharSet(*value++); XlcPublic.h:119:extern XlcCharSet _XlcGetCharSet( XlcPublic.h:126:extern XlcCharSet _XlcGetCharSetWithSide( #### _XlcGetCharSetWithSide #### lcCharSet.c:66:_XlcGetCharSetWithSide( lcUTF8.c:644: _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); lcUTF8.c:747: _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); lcUTF8.c:1038: charset = _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); lcUTF8.c:1527: _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); lcUTF8.c:1620: _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); lcUTF8.c:1958: _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); lcUTF8.c:2053: _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); XlcPublic.h:126:extern XlcCharSet _XlcGetCharSetWithSide( #### _XlcGetLocaleDataBase #### lcDB.c:1203:/* _XlcGetLocaleDataBase(lcd, category, class, value, count) */ lcDB.c:1208:_XlcGetLocaleDataBase( lcPublic.c:69: _XlcGetLocaleDataBase XlcPubI.h:227:extern void _XlcGetLocaleDataBase( #### _XlcGetResource #### lcDB.c:1184:/* _XlcGetResource(lcd, category, class, value, count) */ lcDB.c:1189:_XlcGetResource( lcGeneric.c:433: _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); lcGeneric.c:440: _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); lcGeneric.c:472: _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); lcGeneric.c:479: _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); lcGeneric.c:486: _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); lcGeneric.c:497: _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); lcGeneric.c:513: _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); lcGeneric.c:570: _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); lcGeneric.c:587: _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); lcGeneric.c:599: _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); lcGeneric.c:611: _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); lcGeneric.c:619: _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); lcGeneric.c:704: _XlcGetResource(lcd, "XLC_XLOCALE", "wc_encoding_mask", &value, &num); lcGeneric.c:711: _XlcGetResource(lcd, "XLC_XLOCALE", "wc_shift_bits", &value, &num); lcGeneric.c:717: _XlcGetResource(lcd, "XLC_XLOCALE", "use_stdc_env", &value, &num); lcGeneric.c:723: _XlcGetResource(lcd, "XLC_XLOCALE", "force_convert_to_mb", &value, &num); lcGeneric.c:738: _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); lcGeneric.c:765: _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); lcGeneric.c:776: _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); lcGeneric.c:812: _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); lcGeneric.c:823: _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); lcGeneric.c:865: _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); lcGeneric.c:899: _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); lcGeneric.c:911: _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); lcGeneric.c:923: _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); lcGeneric.c:930: _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); lcPublic.c:116: _XlcGetResource(lcd, "XLC_XLOCALE", "mb_cur_max", &values, &num); lcPublic.c:124: _XlcGetResource(lcd, "XLC_XLOCALE", "state_depend_encoding", &values, &num); lcPublic.c:130: _XlcGetResource(lcd, "XLC_XLOCALE", "encoding_name", &values, &num); lcUTF8.c:1737: _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); lcUTF8.c:1740: _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); lcUTF8.c:1755: _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); lcUTF8.c:1758: _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); omGeneric.c:1895: _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); omGeneric.c:1903: _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); omGeneric.c:1925: _XlcGetResource(lcd, "XLC_FONTSET", "on_demand_loading", &value, &count); omGeneric.c:1929: _XlcGetResource(lcd, "XLC_FONTSET", "object_name", &value, &count); omGeneric.c:1939: _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); omGeneric.c:1943: _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); omGeneric.c:1962: _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); omGeneric.c:1986: _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); omGeneric.c:1989: _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); omGeneric.c:2002: _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); omGeneric.c:2011: _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); XlcPublic.h:276:extern void _XlcGetResource( #### _XlcGetValues #### lcCharSet.c:134: return _XlcGetValues((XPointer) charset, resources, XlcNumber(resources), lcPublic.c:309: return _XlcGetValues((XPointer) pub, resources, XlcNumber(resources), args, lcWrap.c:587:_XlcGetValues( omGeneric.c:1486: return _XlcGetValues((XPointer) oc, oc->core.resources, omGeneric.c:1727: return _XlcGetValues((XPointer) om, om->core.resources, XDefaultOMIF.c:571: return _XlcGetValues((XPointer) oc, oc->core.resources, XDefaultOMIF.c:968: return _XlcGetValues((XPointer) om, om->core.resources, Xlcint.h:868:extern char *_XlcGetValues( #### _XlcInitCTInfo #### lcCT.c:1265:_XlcInitCTInfo(void) lcPublic.c:210: _XlcInitCTInfo(); XlcPubI.h:134:extern Bool _XlcInitCTInfo (void); #### _XlcInitLoader #### lcInit.c:112: * The _XlcInitLoader function initializes the locale object loader list lcInit.c:117:_XlcInitLoader(void) lcWrap.c:287: _XlcInitLoader(); Xlcint.h:887:extern void _XlcInitLoader (void); #### _XlcLocaleDirName #### lcFile.c:618:_XlcLocaleDirName(char *dir_name, size_t dir_len, const char *lc_name) XlcDL.c:383: if (_XlcLocaleDirName(lc_dir, BUFSIZE, lc_name) == NULL) XlcDL.c:523: if (_XlcLocaleDirName(lc_dir, BUFSIZE, lc_name) == NULL) return False; XlcPubI.h:213:extern char *_XlcLocaleDirName( #### _XlcLocaleLibDirName #### lcFile.c:696:_XlcLocaleLibDirName(char *dir_name, size_t dir_len, const char *lc_name) XlcDL.c:385: if (_XlcLocaleLibDirName(lc_lib_dir, BUFSIZE, lc_name) == NULL) XlcDL.c:428: if (_XlcLocaleLibDirName(lc_dir, BUFSIZE, lc_name) == NULL) return (XIM)0; XlcDL.c:476: if (_XlcLocaleLibDirName(lc_dir, BUFSIZE, lc_name) == NULL) return False; XlcDL.c:580: if (_XlcLocaleLibDirName(lc_dir, BUFSIZE, lc_name) == NULL) return (XOM)0; XlcPubI.h:207:extern char *_XlcLocaleLibDirName( #### _XlcMapOSLocaleName #### lcPublic.c:227: name = _XlcMapOSLocaleName(name, siname); lcWrap.c:269: name = _XlcMapOSLocaleName(name, siname); SetLocale.c:82: * _XlcMapOSLocaleName is an implementation dependent routine that derives SetLocale.c:98:_XlcMapOSLocaleName( XlcPubI.h:87: char *siname; /* for _XlcMapOSLocaleName() */ XlcPubI.h:241:extern char *_XlcMapOSLocaleName( #### _XlcNCompareISOLatin1 #### Font.c:678: if (_XlcNCompareISOLatin1(name + l - 2 - (p - charset), charset, p - charset)) lcGenConv.c:480: if ( _XlcNCompareISOLatin1(inbufptr, encoding_name, name_len) != 0 ) lcGeneric.c:443: if (!_XlcNCompareISOLatin1(value[0], "none", 4)) { lcGeneric.c:445: } else if (!_XlcNCompareISOLatin1(value[0], "GL", 2)) { lcGeneric.c:658: if (!_XlcNCompareISOLatin1(ptr, "GL", 2)) { lcGeneric.c:746: if (!_XlcNCompareISOLatin1(value[0], "none", 4)) { lcGeneric.c:748: } else if (!_XlcNCompareISOLatin1(value[0], "GL", 2)) { lcGeneric.c:796: if (!_XlcNCompareISOLatin1(tmp, shifts[j].str, lcUtil.c:65:_XlcNCompareISOLatin1( XlcPublic.h:311:extern int _XlcNCompareISOLatin1( #### _XlcOpenConverter #### imDefIm.c:1603: if (!(ctom_conv = _XlcOpenConverter(lcd, imDefIm.c:1606: if (!(ctow_conv = _XlcOpenConverter(lcd, imDefIm.c:1609: if (!(ctoutf8_conv = _XlcOpenConverter(lcd, imDefIm.c:1618: if (!(ctom_conv = _XlcOpenConverter(lcd, imDefIm.c:1621: if (!(ctow_conv = _XlcOpenConverter(lcd, imDefIm.c:1624: if (!(ctoutf8_conv = _XlcOpenConverter(lcd, imDefIm.c:1649: if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte))) imDefIm.c:1653: if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNWideChar))) imDefIm.c:1657: if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String))) imDefIm.c:1661: if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) imDefIm.c:1665: if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) imLcIm.c:664: if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte))) imLcIm.c:668: if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar))) imLcIm.c:672: if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNUtf8String))) imLcIm.c:676: if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte))) imLcIm.c:680: if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNWideChar))) imLcIm.c:684: if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String))) imLcIm.c:688: if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) imLcIm.c:692: if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) imThaiFlt.c:570: conv = _XlcOpenConverter(im->core.lcd, XlcNWideChar, imThaiFlt.c:575: conv = _XlcOpenConverter(im->core.lcd, XlcNMultiByte, imThaiIm.c:106: if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte))) imThaiIm.c:110: if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar))) imThaiIm.c:114: if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNUtf8String))) imThaiIm.c:118: if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte))) imThaiIm.c:122: if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNWideChar))) imThaiIm.c:126: if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String))) imThaiIm.c:130: if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) imThaiIm.c:134: if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) lcConv.c:294:_XlcOpenConverter( lcPrTxt.c:170: conv = _XlcOpenConverter(lcd, from_type, lcd, to_type); lcRM.c:215: state->conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar); lcStd.c:61: conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar); lcStd.c:104: conv = _XlcOpenConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte); lcStd.c:137: conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar); lcStd.c:176: conv = _XlcOpenConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte); lcStd.c:329: conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNUtf8String); lcTxtPr.c:141: conv = _XlcOpenConverter(lcd, from_type, lcd, to_type); omXChar.c:395: conv = _XlcOpenConverter(lcd, conv_type, lcd, XlcNFontCharSet); omXChar.c:397: conv = _XlcOpenConverter(lcd, conv_type, lcd, XlcNCharSet); XDefaultIMIF.c:181: if ((im->private->ctom_conv = _XlcOpenConverter(lcd, XlcNCompoundText, XDefaultIMIF.c:186: if ((im->private->ctow_conv = _XlcOpenConverter(lcd, XlcNCompoundText, XDefaultOMIF.c:588: conv = _XlcOpenConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte); XlcPublic.h:243:extern XlcConv _XlcOpenConverter( #### _XlcParseCharSet #### lcCharSet.c:220: if (!_XlcParseCharSet(charset)) lcCT.c:314:_XlcParseCharSet( XlcPubI.h:118:extern Bool _XlcParseCharSet( #### _XlcParse_scopemaps #### lcGeneric.c:343:_XlcParse_scopemaps( lcGeneric.c:623: _XlcParse_scopemaps(value[0],&conversion->conv_num); lcGeneric.c:904: _XlcParse_scopemaps(value[0],&(codeset->mbconv->conv_num)); lcGeneric.c:916: _XlcParse_scopemaps(value[0],&(codeset->ctconv->conv_num)); omGeneric.c:1858: font_data->scopes = _XlcParse_scopemaps(scp,&(font_data->scopes_num)); omGeneric.c:1877: range = (CodeRange) _XlcParse_scopemaps(value[0],vrotate_num); XlcGeneric.h:145:_XlcParse_scopemaps( #### _XlcPublicMethods #### lcGeneric.c:998: XLCdPublicMethods superclass = (XLCdPublicMethods) _XlcPublicMethods; lcPublic.c:73:XLCdMethods _XlcPublicMethods = (XLCdMethods) &publicMethods; XlcPubI.h:103:extern XLCdMethods _XlcPublicMethods; #### _XlcRemoveLoader #### lcInit.c:148: _XlcRemoveLoader(_XlcDynamicLoad); lcInit.c:152: _XlcRemoveLoader(_XlcGenericLoader); lcInit.c:156: _XlcRemoveLoader(_XlcDefaultLoader); lcInit.c:160: _XlcRemoveLoader(_XlcUtf8Loader); lcInit.c:164: _XlcRemoveLoader(_XlcDynamicLoader); lcWrap.c:184:_XlcRemoveLoader( lcWrap.c:218: _XlcRemoveLoader(proc); /* remove old loader, if exist */ Xlcint.h:899:extern void _XlcRemoveLoader( #### _XlcResetConverter #### imDefLkup.c:866: _XlcResetConverter(conv); imDefLkup.c:942: _XlcResetConverter(conv); imLcLkup.c:304: _XlcResetConverter(conv); imLcLkup.c:375: _XlcResetConverter(conv); imThaiFlt.c:583: _XlcResetConverter(conv); lcConv.c:334:_XlcResetConverter( lcGenConv.c:763: _XlcResetConverter(conv); lcGenConv.c:1260: _XlcResetConverter(conv); /* ??? */ lcGenConv.c:1263: _XlcResetConverter(conv); lcGenConv.c:1654: _XlcResetConverter(conv); lcGenConv.c:1771: _XlcResetConverter(conv); lcGenConv.c:2634: _XlcResetConverter(conv); lcPrTxt.c:217: _XlcResetConverter(conv); lcRM.c:113: _XlcResetConverter(((MbState) state)->conv); lcTxtPr.c:188: _XlcResetConverter(conv); omXChar.c:389: _XlcResetConverter(conv); XDefaultOMIF.c:593: _XlcResetConverter(conv); XlcPublic.h:264:extern void _XlcResetConverter( #### _XlcResolveI18NPath #### lcFile.c:609:_XlcResolveI18NPath(char *buf, int buf_len) XlcPubI.h:202:extern int _XlcResolveI18NPath( #### _XlcResolveLocaleName #### lcFile.c:525:_XlcResolveLocaleName( lcPublic.c:229: /* _XlcResolveLocaleName will lookup the SI's name for the locale */ lcPublic.c:230: if (_XlcResolveLocaleName(name, pub) == 0) { XlcPubI.h:197:extern int _XlcResolveLocaleName( #### _XlcSetConverter #### lcConv.c:82:_XlcSetConverter( lcCT.c:1287: _XlcSetConverter((XLCd) NULL, XlcNCompoundText, lcCT.c:1290: _XlcSetConverter((XLCd) NULL, XlcNString, lcCT.c:1294: _XlcSetConverter((XLCd) NULL, XlcNCharSet, lcCT.c:1297: _XlcSetConverter((XLCd) NULL, XlcNCharSet, lcDefConv.c:788: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_mbstowcs); lcDefConv.c:789: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_mbstostr); lcDefConv.c:790: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_mbstocs); lcDefConv.c:791: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_mbstocs); lcDefConv.c:793: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_wcstombs); lcDefConv.c:794: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); lcDefConv.c:795: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); lcDefConv.c:797: _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtombs); lcDefConv.c:798: _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_mbstowcs); lcDefConv.c:800: _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstombs); lcDefConv.c:801: _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); lcGenConv.c:3069: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCompoundText, open_mbstocts); lcGenConv.c:3070: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_mbstostr); lcGenConv.c:3071: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_mbstocs); lcGenConv.c:3072: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_mbtocs); lcGenConv.c:3073: _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte, open_ctstombs); lcGenConv.c:3074: _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtombs); lcGenConv.c:3075: _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstombs); lcGenConv.c:3082: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_mbstowcs); lcGenConv.c:3083: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_wcstombs); lcGenConv.c:3084: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCompoundText, open_wcstocts); lcGenConv.c:3085: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); lcGenConv.c:3086: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); lcGenConv.c:3087: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_wctocs); lcGenConv.c:3088: _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar, open_ctstowcs); lcGenConv.c:3089: _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_strtowcs); lcGenConv.c:3090: _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); lcGenConv.c:3097: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_stdc_mbstowcs); lcGenConv.c:3098: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_stdc_wcstombs); lcGenConv.c:3099: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCompoundText, open_stdc_wcstocts); lcGenConv.c:3100: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_stdc_wcstostr); lcGenConv.c:3101: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_stdc_wcstocs); lcGenConv.c:3102: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_stdc_wctocs); lcGenConv.c:3103: _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar, open_stdc_ctstowcs); lcGenConv.c:3104: _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_stdc_strtowcs); lcGenConv.c:3105: _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_stdc_cstowcs); lcUTF8.c:1136: _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String, open_cstoutf8); lcUTF8.c:1137: _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNCharSet, open_utf8tocs); lcUTF8.c:1138: _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNChar, open_utf8tocs1); lcUTF8.c:1139: _XlcSetConverter(lcd, XlcNString, lcd, XlcNUtf8String, open_strtoutf8); lcUTF8.c:1140: _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNString, open_utf8tostr); lcUTF8.c:1141: _XlcSetConverter(lcd, XlcNUcsChar, lcd, XlcNChar, open_ucstocs1); lcUTF8.c:1142: _XlcSetConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String, open_ucstoutf8); lcUTF8.c:2335: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_utf8towcs); lcUTF8.c:2337: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_wcstoutf8); lcUTF8.c:2338: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); lcUTF8.c:2340: _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_strtowcs); lcUTF8.c:2345: _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstoutf8); lcUTF8.c:2346: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_utf8tocs); lcUTF8.c:2347: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_utf8tocs1); lcUTF8.c:2349: _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); lcUTF8.c:2350: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); lcUTF8.c:2351: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_wcstocs1); lcUTF8.c:2353: _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtoutf8); lcUTF8.c:2354: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_utf8tostr); lcUTF8.c:2355: _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNMultiByte, open_identity); lcUTF8.c:2356: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNUtf8String, open_identity); lcUTF8.c:2359: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNFontCharSet, open_utf8tofcs); lcUTF8.c:2360: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNFontCharSet, open_wcstofcs); lcUTF8.c:2369: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_iconv_mbstowcs); lcUTF8.c:2370: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_iconv_wcstombs); lcUTF8.c:2375: _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_iconv_cstombs); lcUTF8.c:2376: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_iconv_mbstocs); lcUTF8.c:2377: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_iconv_mbtocs); lcUTF8.c:2378: _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_iconv_strtombs); lcUTF8.c:2379: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_iconv_mbstostr); lcUTF8.c:2382: _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNFontCharSet, open_iconv_mbstofcs); lcUTF8.c:2384: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); lcUTF8.c:2385: _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_strtowcs); lcUTF8.c:2386: _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); lcUTF8.c:2387: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); lcUTF8.c:2388: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_wcstocs1); lcUTF8.c:2391: _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNFontCharSet, open_wcstofcs); XlcPublic.h:268:extern Bool _XlcSetConverter( #### _XlcSetValues #### lcWrap.c:619:_XlcSetValues( omGeneric.c:1455: ret = _XlcSetValues((XPointer) oc, oc->core.resources, omGeneric.c:1581: if (_XlcSetValues((XPointer) oc, oc_resources, XlcNumber(oc_resources), omGeneric.c:1714: return _XlcSetValues((XPointer) om, om->core.resources, XDefaultOMIF.c:558: return _XlcSetValues((XPointer) oc, oc->core.resources, XDefaultOMIF.c:888: if (_XlcSetValues((XPointer) oc, oc_resources, XlcNumber(oc_resources), XDefaultOMIF.c:955: return _XlcSetValues((XPointer) om, om->core.resources, Xlcint.h:877:extern char *_XlcSetValues( #### _XlcUtf8Loader #### lcInit.c:133: _XlcAddLoader(_XlcUtf8Loader, XlcHead); lcInit.c:160: _XlcRemoveLoader(_XlcUtf8Loader); lcUTF8Load.c:42:_XlcUtf8Loader( Xlcint.h:931:extern XLCd _XlcUtf8Loader( #### _XlcVaToArgList #### lcCharSet.c:154: _XlcVaToArgList(var, num_args, &args); lcPubWrap.c:46: _XlcVaToArgList(var, num_args, &args); lcWrap.c:560:_XlcVaToArgList( OCWrap.c:45: _XlcVaToArgList(var, num_args, &args); OCWrap.c:103: _XlcVaToArgList(var, num_args, &args); OCWrap.c:129: _XlcVaToArgList(var, num_args, &args); OMWrap.c:80: _XlcVaToArgList(var, num_args, &args); OMWrap.c:106: _XlcVaToArgList(var, num_args, &args); Xlcint.h:844:extern void _XlcVaToArgList( #### _XlcValidModSyntax #### lcWrap.c:101:Bool _XlcValidModSyntax( lcWrap.c:139: if (!_XlcValidModSyntax(prog_mods, im_valid)) lcWrap.c:141: if (!_XlcValidModSyntax(user_mods, im_valid)) Xlcint.h:769:extern Bool _XlcValidModSyntax( #### _Xlcmbstoutf8 #### imThaiFlt.c:1410: _Xlcmbstoutf8(ic->core.im->core.lcd, &b->utf8[b->tree[ic->private.local.composed].utf8], lcStd.c:313:_Xlcmbstoutf8( lcStd.c:357: return _Xlcmbstoutf8((XLCd) NULL, ustr, str, len); XlcPubI.h:251:_Xlcmbstoutf8( #### _Xlcmbstowcs #### lcStd.c:121:_Xlcmbstowcs( lcStd.c:232: return _Xlcmbstowcs((XLCd) NULL, wstr, str, len); XlcPubI.h:268:_Xlcmbstowcs( #### _Xlcmbtowc #### lcStd.c:33:_Xlcmbtowc( lcStd.c:206: return _Xlcmbtowc((XLCd) NULL, wstr, str, len); XlcPubI.h:279:_Xlcmbtowc( #### _Xlcwcstombs #### imThaiFlt.c:1407: _Xlcwcstombs(ic->core.im->core.lcd, &b->mb[b->tree[ic->private.local.composed].mb], lcStd.c:160:_Xlcwcstombs( lcStd.c:241: return _Xlcwcstombs((XLCd) NULL, str, wstr, len); XlcPubI.h:262:_Xlcwcstombs( #### _Xlcwctomb #### imLcLkup.c:65: ret = _Xlcwctomb(ic->core.im->core.lcd, mb, BRL_UC_ROW | pattern); lcStd.c:78:_Xlcwctomb( lcStd.c:223: return _Xlcwctomb((XLCd) NULL, str, wc); XlcPubI.h:285:_Xlcwctomb( #### _XmbDefaultDrawImageString #### omDefault.c:406:_XmbDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, omDefault.c:426: _XmbDefaultDrawImageString(dpy, d, oc, gc, x, y, buf, length); omDefault.c:445: _XmbDefaultDrawImageString(dpy, d, oc, gc, x, y, buf, length); omGeneric.c:1498: _XmbDefaultDrawImageString, XDefaultOMIF.c:810:_XmbDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, XDefaultOMIF.c:830: _XmbDefaultDrawImageString(dpy, d, oc, gc, x, y, buf, length); XDefaultOMIF.c:844: _XmbDefaultDrawImageString, XomGeneric.h:220:_XmbDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, #### _XmbDefaultDrawString #### omDefault.c:346:_XmbDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, omDefault.c:373: ret = _XmbDefaultDrawString(dpy, d, oc, gc, x, y, buf, length); omDefault.c:397: ret = _XmbDefaultDrawString(dpy, d, oc, gc, x, y, buf, length); omGeneric.c:1497: _XmbDefaultDrawString, XDefaultOMIF.c:776:_XmbDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, XDefaultOMIF.c:801: ret = _XmbDefaultDrawString(dpy, d, oc, gc, x, y, buf, length); XDefaultOMIF.c:843: _XmbDefaultDrawString, XomGeneric.h:211:_XmbDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, #### _XmbDefaultTextEscapement #### omDefault.c:91:_XmbDefaultTextEscapement(XOC oc, _Xconst char *text, int length) omDefault.c:111: ret = _XmbDefaultTextEscapement(oc, buf, length); omDefault.c:134: ret = _XmbDefaultTextEscapement(oc, buf, length); omGeneric.c:1494: _XmbDefaultTextEscapement, XDefaultOMIF.c:604:_XmbDefaultTextEscapement(XOC oc, _Xconst char *text, int length) XDefaultOMIF.c:622: ret = _XmbDefaultTextEscapement(oc, buf, length); XDefaultOMIF.c:840: _XmbDefaultTextEscapement, XomGeneric.h:175:_XmbDefaultTextEscapement(XOC oc, _Xconst char *text, int length); #### _XmbDefaultTextExtents #### omDefault.c:143:_XmbDefaultTextExtents(XOC oc, _Xconst char *text, int length, omDefault.c:185: ret = _XmbDefaultTextExtents(oc, buf, length, overall_ink, overall_logical); omDefault.c:209: ret = _XmbDefaultTextExtents(oc, buf, length, overall_ink, overall_logical); omGeneric.c:1495: _XmbDefaultTextExtents, XDefaultOMIF.c:631:_XmbDefaultTextExtents(XOC oc, _Xconst char *text, int length, XDefaultOMIF.c:671: ret = _XmbDefaultTextExtents(oc, buf, length, overall_ink, overall_logical); XDefaultOMIF.c:841: _XmbDefaultTextExtents, XomGeneric.h:181:_XmbDefaultTextExtents(XOC oc, _Xconst char *text, int length, #### _XmbDefaultTextPerCharExtents #### omDefault.c:218:_XmbDefaultTextPerCharExtents(XOC oc, _Xconst char *text, int length, omDefault.c:306: ret = _XmbDefaultTextPerCharExtents(oc, buf, length, ink_buf, logical_buf, omDefault.c:335: ret = _XmbDefaultTextPerCharExtents(oc, buf, length, ink_buf, logical_buf, omGeneric.c:1496: _XmbDefaultTextPerCharExtents, XDefaultOMIF.c:680:_XmbDefaultTextPerCharExtents(XOC oc, _Xconst char *text, int length, XDefaultOMIF.c:765: ret = _XmbDefaultTextPerCharExtents(oc, buf, length, ink_buf, logical_buf, XDefaultOMIF.c:842: _XmbDefaultTextPerCharExtents, XomGeneric.h:190:_XmbDefaultTextPerCharExtents( #### _XmbGenericDrawImageString #### omGeneric.c:1519: _XmbGenericDrawImageString, omImText.c:65:_XmbGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, XomGeneric.h:270:_XmbGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, #### _XmbGenericDrawString #### omGeneric.c:1518: _XmbGenericDrawString, omText.c:349:_XmbGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, XomGeneric.h:273:_XmbGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, #### _XmbGenericTextEscapement #### omGeneric.c:1515: _XmbGenericTextEscapement, omTextEsc.c:284:_XmbGenericTextEscapement(XOC oc, _Xconst char *text, int length) XomGeneric.h:230:_XmbGenericTextEscapement(XOC oc, _Xconst char *text, int length); #### _XmbGenericTextExtents #### omGeneric.c:1516: _XmbGenericTextExtents, omTextExt.c:114:_XmbGenericTextExtents(XOC oc, _Xconst char *text, int length, XomGeneric.h:232:_XmbGenericTextExtents(XOC oc, _Xconst char *text, int length, #### _XmbGenericTextPerCharExtents #### omGeneric.c:1517: _XmbGenericTextPerCharExtents, omTextPer.c:166:_XmbGenericTextPerCharExtents(XOC oc, _Xconst char *text, int length, XomGeneric.h:276:_XmbGenericTextPerCharExtents(XOC oc, _Xconst char *text, int length, #### _XmbTextListToTextProperty #### lcPublic.c:55: _XmbTextListToTextProperty, lcTxtPr.c:218:_XmbTextListToTextProperty( XlcPubI.h:165:extern int _XmbTextListToTextProperty( #### _XmbTextPropertyToTextList #### lcPrTxt.c:245:_XmbTextPropertyToTextList( lcPublic.c:52: _XmbTextPropertyToTextList, XlcPubI.h:141:extern int _XmbTextPropertyToTextList( #### _Xmblen #### lcStd.c:210:_Xmblen( Xlib.h:64:_Xmblen( #### _Xmbstoutf8 #### imLcPrs.c:55:extern int _Xmbstoutf8( imLcPrs.c:642: l = _Xmbstoutf8(local_utf8_buf, rhs_string_mb, LOCAL_UTF8_BUFSIZE - 1); lcStd.c:352:_Xmbstoutf8( XlcPubI.h:246:_Xmbstoutf8( #### _Xmbstowcs #### imLcPrs.c:49:extern int _Xmbstowcs( imLcPrs.c:626: l = _Xmbstowcs(local_wc_buf, rhs_string_mb, LOCAL_WC_BUFSIZE - 1); lcStd.c:227:_Xmbstowcs( XlcPubI.h:257:_Xmbstowcs( #### _Xmbtowc #### lcStd.c:200:_Xmbtowc( lcStd.c:215: return _Xmbtowc((wchar_t *) NULL, str, len); Xlib.h:4010:extern int _Xmbtowc( #### _XomConvert #### omText.c:317: if (_XomConvert(oc, conv, (XPointer *) &text, &length, omTextEsc.c:269: if (_XomConvert(oc, conv, (XPointer *) &text, &length, omTextExt.c:66: if (_XomConvert(oc, conv, (XPointer *) &text, &length, omTextPer.c:71: if (_XomConvert(oc, conv, (XPointer *) &text, &length, omXChar.c:306:_XomConvert( XomGeneric.h:163:extern int _XomConvert( #### _XomGenericDrawString #### omImText.c:61: _XomGenericDrawString(dpy, d, oc, gc, x, y, type, text, length); omText.c:282:_XomGenericDrawString( omText.c:352: return _XomGenericDrawString(dpy, d, oc, gc, x, y, XOMMultiByte, omText.c:360: return _XomGenericDrawString(dpy, d, oc, gc, x, y, XOMWideChar, omText.c:368: return _XomGenericDrawString(dpy, d, oc, gc, x, y, XOMUtf8String, XomGeneric.h:288:_XomGenericDrawString( #### _XomGenericOpenOM #### omGeneric.c:2073:_XomGenericOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb, omGeneric.c:2097: lcd->methods->open_om = _XomGenericOpenOM; XomGeneric.h:150:extern XOM _XomGenericOpenOM( #### _XomGenericTextExtents #### omImText.c:55: _XomGenericTextExtents(oc, type, text, length, 0, &extent); omTextExt.c:34:_XomGenericTextExtents( omTextExt.c:117: return _XomGenericTextExtents(oc, XOMMultiByte, (XPointer) text, length, omTextExt.c:125: return _XomGenericTextExtents(oc, XOMWideChar, (XPointer) text, length, omTextExt.c:133: return _XomGenericTextExtents(oc, XOMUtf8String, (XPointer) text, length, XomGeneric.h:298:_XomGenericTextExtents( #### _XomGetFontDataFromFontSet #### omText.c:184: fd = _XomGetFontDataFromFontSet(fs, omText.c:192: * _XomGetFontDataFromFontSet() always seems to return for omText.c:223: fd = _XomGetFontDataFromFontSet(fs, omText.c:232: fd = _XomGetFontDataFromFontSet(fs, omTextEsc.c:149: fd = _XomGetFontDataFromFontSet(font_set, ptr, length, &ptr_len, omTextEsc.c:158: * _XomGetFontDataFromFontSet() always seems to return for omTextEsc.c:194: fd = _XomGetFontDataFromFontSet(font_set, ptr, length, &ptr_len, omTextEsc.c:203: fd = _XomGetFontDataFromFontSet(font_set, ptr, length, omXChar.c:116:_XomGetFontDataFromFontSet( XomGeneric.h:306:_XomGetFontDataFromFontSet( #### _XomInitConverter #### omDefault.c:54: conv = _XomInitConverter(oc, XOMWideChar); omDefault.c:77: conv = _XomInitConverter(oc, XOMUtf8String); omText.c:305: conv = _XomInitConverter(oc, type); omTextEsc.c:257: conv = _XomInitConverter(oc, type); omTextExt.c:52: conv = _XomInitConverter(oc, type); omTextPer.c:57: conv = _XomInitConverter(oc, type); omXChar.c:360:_XomInitConverter( XomGeneric.h:158:extern XlcConv _XomInitConverter( #### _XrmDefaultInitParseInfo #### lcPublic.c:51: _XrmDefaultInitParseInfo, lcRM.c:82:/* Frees the state, which was allocated by _XrmDefaultInitParseInfo. */ lcRM.c:173:/* Frees the state, which was allocated by _XrmDefaultInitParseInfo. */ lcRM.c:194:_XrmDefaultInitParseInfo( Xlcint.h:168: init_parse_info function (default: _XrmDefaultInitParseInfo). */ XlcPubI.h:136:extern XrmMethods _XrmDefaultInitParseInfo( #### _XrmInitParseInfo #### lcWrap.c:365:_XrmInitParseInfo( Xrm.c:503: db->methods = _XrmInitParseInfo(&db->mbstate); Xlcint.h:796:extern XrmMethods _XrmInitParseInfo( #### _XrmInternalStringToQuark #### Quarks.c:238:_XrmInternalStringToQuark( Quarks.c:286: return _XrmInternalStringToQuark(name, len, sig, permstring); Quarks.c:358: return _XrmInternalStringToQuark(name, tname-(char *)name-1, sig, False); Quarks.c:374: return _XrmInternalStringToQuark(name, tname-(char *)name-1, sig, True); StrKeysym.c:121: names[0] = _XrmInternalStringToQuark(s, p - s - 1, sig, False); Xrm.c:377: *quarks++ = _XrmInternalStringToQuark(name,tname - name, Xrm.c:389: *quarks++ = _XrmInternalStringToQuark(name, tname - name, sig, False); Xrm.c:414: *quarks++ = _XrmInternalStringToQuark(name, tname - name, Xrm.c:432: *quarks++ = _XrmInternalStringToQuark(name, tname - name, sig, False); Xrm.c:1244: _XrmInternalStringToQuark(lhs, ptr - lhs, sig, False); Xresinternal.h:13:extern XrmQuark _XrmInternalStringToQuark( #### _Xthread_self_fn #### locking.c:609: _Xthread_self_fn = _Xthread_self; XlibInt.c:100:xthread_t (*_Xthread_self_fn)(void) = NULL; XlibInt.c:102:#define XThread_Self() ((*_Xthread_self_fn)()) locking.h:49:extern xthread_t (*_Xthread_self_fn)( /* in XlibInt.c */ #### _Xutf8DefaultDrawImageString #### omDefault.c:433:_Xutf8DefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, omGeneric.c:1508: _Xutf8DefaultDrawImageString XomGeneric.h:226:_Xutf8DefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, #### _Xutf8DefaultDrawString #### omDefault.c:382:_Xutf8DefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, omGeneric.c:1507: _Xutf8DefaultDrawString, XomGeneric.h:217:_Xutf8DefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, #### _Xutf8DefaultTextEscapement #### omDefault.c:120:_Xutf8DefaultTextEscapement(XOC oc, _Xconst char *text, int length) omGeneric.c:1504: _Xutf8DefaultTextEscapement, XomGeneric.h:179:_Xutf8DefaultTextEscapement(XOC oc, _Xconst char *text, int length); #### _Xutf8DefaultTextExtents #### omDefault.c:194:_Xutf8DefaultTextExtents(XOC oc, _Xconst char *text, int length, omGeneric.c:1505: _Xutf8DefaultTextExtents, XomGeneric.h:187:_Xutf8DefaultTextExtents(XOC oc, _Xconst char *text, int length, #### _Xutf8DefaultTextPerCharExtents #### omDefault.c:317:_Xutf8DefaultTextPerCharExtents(XOC oc, _Xconst char *text, int length, omGeneric.c:1506: _Xutf8DefaultTextPerCharExtents, XomGeneric.h:204:_Xutf8DefaultTextPerCharExtents( #### _Xutf8GenericDrawImageString #### omGeneric.c:1529: _Xutf8GenericDrawImageString omImText.c:81:_Xutf8GenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, XomGeneric.h:238:_Xutf8GenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, #### _Xutf8GenericDrawString #### omGeneric.c:1528: _Xutf8GenericDrawString, omText.c:365:_Xutf8GenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, XomGeneric.h:235:_Xutf8GenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, #### _Xutf8GenericTextEscapement #### omGeneric.c:1525: _Xutf8GenericTextEscapement, omTextEsc.c:296:_Xutf8GenericTextEscapement(XOC oc, _Xconst char *text, int length) XomGeneric.h:251:_Xutf8GenericTextEscapement(XOC oc, _Xconst char *text, int length); #### _Xutf8GenericTextExtents #### omGeneric.c:1526: _Xutf8GenericTextExtents, omTextExt.c:130:_Xutf8GenericTextExtents(XOC oc, _Xconst char *text, int length, XomGeneric.h:248:_Xutf8GenericTextExtents(XOC oc, _Xconst char *text, int length, #### _Xutf8GenericTextPerCharExtents #### omGeneric.c:1527: _Xutf8GenericTextPerCharExtents, omTextPer.c:192:_Xutf8GenericTextPerCharExtents(XOC oc, _Xconst char *text, int length, XomGeneric.h:241:_Xutf8GenericTextPerCharExtents( #### _Xutf8TextListToTextProperty #### lcPublic.c:57: _Xutf8TextListToTextProperty, lcTxtPr.c:244:_Xutf8TextListToTextProperty( XlcPubI.h:183:extern int _Xutf8TextListToTextProperty( #### _Xutf8TextPropertyToTextList #### lcPrTxt.c:269:_Xutf8TextPropertyToTextList( lcPublic.c:54: _Xutf8TextPropertyToTextList, XlcPubI.h:157:extern int _Xutf8TextPropertyToTextList( #### _XwcDefaultDrawImageString #### omDefault.c:414:_XwcDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, omGeneric.c:1503: _XwcDefaultDrawImageString, XDefaultOMIF.c:818:_XwcDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, XDefaultOMIF.c:849: _XwcDefaultDrawImageString XomGeneric.h:223:_XwcDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, #### _XwcDefaultDrawString #### omDefault.c:358:_XwcDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, omGeneric.c:1502: _XwcDefaultDrawString, XDefaultOMIF.c:788:_XwcDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, XDefaultOMIF.c:848: _XwcDefaultDrawString, XomGeneric.h:214:_XwcDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, #### _XwcDefaultTextEscapement #### omDefault.c:97:_XwcDefaultTextEscapement(XOC oc, _Xconst wchar_t *text, int length) omGeneric.c:1499: _XwcDefaultTextEscapement, XDefaultOMIF.c:610:_XwcDefaultTextEscapement(XOC oc, _Xconst wchar_t *text, int length) XDefaultOMIF.c:845: _XwcDefaultTextEscapement, XomGeneric.h:177:_XwcDefaultTextEscapement(XOC oc, _Xconst wchar_t *text, int length); #### _XwcDefaultTextExtents #### omDefault.c:170:_XwcDefaultTextExtents(XOC oc, _Xconst wchar_t *text, int length, omGeneric.c:1500: _XwcDefaultTextExtents, XDefaultOMIF.c:658:_XwcDefaultTextExtents(XOC oc, _Xconst wchar_t *text, int length, XDefaultOMIF.c:846: _XwcDefaultTextExtents, XomGeneric.h:184:_XwcDefaultTextExtents(XOC oc, _Xconst wchar_t *text, int length, #### _XwcDefaultTextPerCharExtents #### omDefault.c:288:_XwcDefaultTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length, omGeneric.c:1501: _XwcDefaultTextPerCharExtents, XDefaultOMIF.c:749:_XwcDefaultTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length, XDefaultOMIF.c:847: _XwcDefaultTextPerCharExtents, XomGeneric.h:197:_XwcDefaultTextPerCharExtents( #### _XwcFreeStringList #### lcPrTxt.c:281:_XwcFreeStringList( lcPublic.c:58: _XwcFreeStringList, XlcPubI.h:192:extern void _XwcFreeStringList( #### _XwcGenericDrawImageString #### omGeneric.c:1524: _XwcGenericDrawImageString, omImText.c:73:_XwcGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, XomGeneric.h:253:_XwcGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, #### _XwcGenericDrawString #### omGeneric.c:1523: _XwcGenericDrawString, omText.c:357:_XwcGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, XomGeneric.h:256:_XwcGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, #### _XwcGenericTextEscapement #### omGeneric.c:1520: _XwcGenericTextEscapement, omTextEsc.c:290:_XwcGenericTextEscapement(XOC oc, _Xconst wchar_t *text, int length) XomGeneric.h:268:_XwcGenericTextEscapement(XOC oc, _Xconst wchar_t *text, int length); #### _XwcGenericTextExtents #### omGeneric.c:1521: _XwcGenericTextExtents, omTextExt.c:122:_XwcGenericTextExtents(XOC oc, _Xconst wchar_t *text, int length, XomGeneric.h:265:_XwcGenericTextExtents(XOC oc, _Xconst wchar_t *text, int length, #### _XwcGenericTextPerCharExtents #### omGeneric.c:1522: _XwcGenericTextPerCharExtents, omTextPer.c:179:_XwcGenericTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length, XomGeneric.h:259:_XwcGenericTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length, #### _XwcTextListToTextProperty #### lcPublic.c:56: _XwcTextListToTextProperty, lcTxtPr.c:231:_XwcTextListToTextProperty( XlcPubI.h:174:extern int _XwcTextListToTextProperty( #### _XwcTextPropertyToTextList #### lcPrTxt.c:257:_XwcTextPropertyToTextList( lcPublic.c:53: _XwcTextPropertyToTextList, XlcPubI.h:149:extern int _XwcTextPropertyToTextList( #### _Xwcscmp #### lcStd.c:286:_Xwcscmp( XlcPublic.h:299:extern int _Xwcscmp(wchar_t *wstr1, wchar_t *wstr2); #### _Xwcscpy #### lcPrTxt.c:87: _Xwcscpy(wstr, wc_text); lcStd.c:245:_Xwcscpy( XlcPublic.h:293:extern wchar_t *_Xwcscpy( #### _Xwcslen #### imLcLkup.c:157: ret = _Xwcslen(&wc[b[ic->private.local.composed].wc]); lcPrTxt.c:89: length = _Xwcslen(wstr) + 1; lcStd.c:181: from_left = _Xwcslen(wstr); lcStd.c:274:_Xwcslen( lcTxtPr.c:52: length += _Xwcslen(*wc_list) + 1; lcTxtPr.c:160: from_left = _Xwcslen(*wc_list); XlcPublic.h:289:extern int _Xwcslen( #### _Xwcsncmp #### lcStd.c:297:_Xwcsncmp( XlcPublic.h:300:extern int _Xwcsncmp(wchar_t *wstr1, wchar_t *wstr2, int len); #### _Xwcsncpy #### lcStd.c:257:_Xwcsncpy( XlcPublic.h:298:extern wchar_t *_Xwcsncpy(wchar_t *wstr1, wchar_t *wstr2, int len); #### _Xwcstombs #### lcStd.c:236:_Xwcstombs( XlcPubI.h:274:_Xwcstombs( #### _Xwctomb #### lcStd.c:219:_Xwctomb( Xlib.h:4016:extern int _Xwctomb( #### _qfree #### globals.c:74:ZEROINIT (_XQEvent *, _qfree, NULL); #### read_EncodingInfo #### omGeneric.c:1820:read_EncodingInfo( omGeneric.c:1899: font_set->vmap = read_EncodingInfo(count,value); omGeneric.c:1994: font_data = read_EncodingInfo(count,value); omGeneric.c:2004: font_data = read_EncodingInfo(count,value); omGeneric.c:2016: font_data = read_EncodingInfo(count,value); XomGeneric.h:283:read_EncodingInfo( #### xlocaledir #### imLcPrs.c:347: xlocaledir(dir, XLC_BUFSIZE); lcFile.c:199:xlocaledir( lcFile.c:484: xlocaledir(dir,XLC_BUFSIZE); lcFile.c:537: xlocaledir (dir, PATH_MAX); lcFile.c:612: xlocaledir(buf, buf_len); lcFile.c:637: xlocaledir (dir, PATH_MAX); Xlibint.h:1359:extern void xlocaledir( nx-libs-3.5.99.23/doc/libNX_X11/symbols/libNX_X11::symbol-usage_nxagent.txt0000644000000000000000000026653613614532331022701 0ustar #### KeySymToUcs4 #### #### XActivateScreenSaver #### #### XAddConnectionWatch #### #### XAddExtension #### #### XAddHost #### #### XAddHosts #### #### XAddPixel #### #### XAddToExtensionList #### #### XAddToSaveSet #### #### XAllPlanes #### #### XAllocClassHint #### #### XAllocColor #### #### XAllocColorCells #### #### XAllocColorPlanes #### #### XAllocIconSize #### #### XAllocNamedColor #### #### XAllocSizeHints #### #### XAllocStandardColormap #### #### XAllocWMHints #### #### XAllowEvents #### NXevents.c:310:// * XAllowEvents(nxagentDisplay, stuff -> mode, CurrentTime); #### XAutoRepeatOff #### #### XAutoRepeatOn #### #### XBaseFontNameListOfFontSet #### #### XBell #### Keyboard.c:588: XBell(nxagentDisplay, volume); #### XBitmapBitOrder #### #### XBitmapPad #### #### XBitmapUnit #### #### XBlackPixel #### #### XBlackPixelOfScreen #### #### XCellsOfScreen #### #### XChangeActivePointerGrab #### #### XChangeGC #### Cursor.c:176: XChangeGC(nxagentDisplay, nxagentBitmapGC, valuemask, &values); GC.c:564: XChangeGC(nxagentDisplay, nxagentGC(pGC), mask, &values); GC.c:1441: * This is why we call the XChangeGC at the end of GC.c:1532: XChangeGC(nxagentDisplay, nxagentGC(pGC), mask, &values); GC.c:1561: * lues and to avoid XChangeGC() requests. Holder.c:147: XChangeGC(nxagentDisplay, gc, GCForeground | GCLineWidth | GCLineStyle, &value); Holder.c:161: XChangeGC(nxagentDisplay, gc, GCForeground | GCLineWidth | GCLineStyle, &value); #### XChangeKeyboardControl #### Keyboard.c:660: XChangeKeyboardControl(nxagentDisplay, value_mask, &values); Keyboard.c:675: XChangeKeyboardControl(nxagentDisplay, value_mask, &values); #### XChangeKeyboardMapping #### #### XChangePointerControl #### Pointer.c:94: XChangePointerControl(nxagentDisplay, True, True, #### XChangeProperty #### Clipboard.c:323: XChangeProperty (nxagentDisplay, Clipboard.c:341: XChangeProperty(nxagentDisplay, Clipboard.c:957: fprintf (stderr, "SelectionNotify - XChangeProperty failed\n"); Clipboard.c:963: result = XChangeProperty(nxagentDisplay, Rootless.c:76: * a parameter of XChangeProperty(). Rootless.c:524: * Initialize the structure used in XChangeProperty(). Rootless.c:747: XChangeProperty(nxagentDisplay, nxagentWindow(pWin), propertyX, typeX, Rootless.c:772: XChangeProperty(nxagentDisplay, nxagentWindow(pWin), propertyX, Screen.c:1831: XChangeProperty(nxagentDisplay, Screen.c:2588: XChangeProperty(nxagentShadowDisplay, DefaultRootWindow(nxagentShadowDisplay), #### XChangeSaveSet #### #### XChangeWindowAttributes #### Splash.c:159: XChangeWindowAttributes(nxagentDisplay, nxagentSplashWindow, CWOverrideRedirect, &attributes); Window.c:808: XChangeWindowAttributes(nxagentDisplay, w, valuemask, &attributes); Window.c:943: XChangeWindowAttributes(nxagentDisplay, w, valuemask, &attributes); Window.c:1856: XChangeWindowAttributes(nxagentDisplay, nxagentWindow(pWin), mask, &attributes); Window.c:3400: XChangeWindowAttributes(nxagentDisplay, nxagentWindow(pWin), mask, &attributes); #### XCheckIfEvent #### Events.h:234: XCheckIfEventNoFlush((display), (event), (predicate), (argument)) #### XCheckIfEventNoFlush #### Events.h:234: XCheckIfEventNoFlush((display), (event), (predicate), (argument)) #### XCheckMaskEvent #### #### XCheckTypedEvent #### #### XCheckTypedWindowEvent #### Events.c:3372: while (XCheckTypedWindowEvent(nxagentDisplay, nxagentDefaultWindows[pScreen -> myNum], Screen.c:343: if (XCheckTypedWindowEvent(nxagentDisplay, nxagentFullscreenWindow, ReparentNotify, &e)) Screen.c:361: while (XCheckTypedWindowEvent(nxagentDisplay, nxagentFullscreenWindow, LeaveNotify, &e)); Window.c:832: if (XCheckTypedWindowEvent(nxagentDisplay, w, ReparentNotify, &e)) Window.c:914: XCheckTypedWindowEvent(nxagentDisplay, w, LeaveNotify, &e); #### XCheckWindowEvent #### #### XCirculateSubwindows #### Rootless.c:242: XCirculateSubwindows(nxagentDisplay, DefaultRootWindow(nxagentDisplay), direction); #### XCirculateSubwindowsDown #### #### XCirculateSubwindowsUp #### #### XClearArea #### Drawable.c:72: * If defined, send the XClearArea at the end Drawable.c:920: XClearArea(nxagentDisplay, nxagentWindow(owner), scaledx, scaledy, scaledw, scaledh, 0); Drawable.c:924: XClearArea(nxagentDisplay, nxagentWindow(owner), x, y, w, h, 0); Drawable.c:1051: XClearArea(nxagentDisplay, nxagentWindow(owner), scaledx, scaledy, scaledw, scaledh, 0); Drawable.c:1055: XClearArea(nxagentDisplay, nxagentWindow(owner), x, y, w, h, 0); Drawable.c:2327: XClearArea(nxagentDisplay, nxagentWindow(pWin), pBox[i].x1, pBox[i].y1, Window.c:2004: XClearArea(nxagentDisplay, nxagentWindow(pWin), #### XClearWindow #### Events.c:2519: XClearWindow(nxagentDisplay, nxagentWindowPriv(nxagentRootTileWindow) -> window); Pixmap.c:1350: XClearWindow(shadow, win); Pixmap.c:1502: XClearWindow(shadow, win); Screen.c:1898: XClearWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum]); Window.c:481: XClearWindow(nxagentDisplay, nxagentWindowPriv(nxagentRootTileWindow)->window); Window.c:652: XClearWindow(nxagentDisplay, nxagentWindowPriv(nxagentRootTileWindow) -> window); #### XClipBox #### #### XCloseDisplay #### Display.c:1869: XCloseDisplay(nxagentDisplay); Display.c:2105: XCloseDisplay(nxagentDisplayBackup); Display.c:2164: XCloseDisplay(nxagentDisplay); #### XCloseIM #### #### XCloseOM #### #### XConfigureWindow #### Pixmap.c:1541: XConfigureWindow(shadow, win, CWWidth | CWHeight, &values); Rootless.c:237: XConfigureWindow(nxagentDisplay, nxagentWindow(pWin), mask, &changes); Screen.c:1819: XConfigureWindow(nxagentDisplay, nxagentFullscreenWindow, ch_mask, &ch); Screen.c:2932: XConfigureWindow(nxagentDisplay, nxagentWindow(nxagentShadowWindowPtr), mask, &changes); Screen.c:2965: XConfigureWindow(nxagentDisplay, nxagentWindow(pWin), mask, &changes); Splash.c:157: XConfigureWindow(nxagentDisplay, nxagentSplashWindow, CWStackMode, &values); Window.c:1358: XConfigureWindow(nxagentDisplay, nxagentWindow(pWin), valuemask, &values); Window.c:1388: XConfigureWindow(nxagentDisplay, nxagentWindow(pSib), valuemask, &values); Window.c:1412: XConfigureWindow(nxagentDisplay, nxagentWindow(pSib), valuemask, &values); Window.c:1480: * XConfigureWindow(nxagentDisplay, nxagentSplashWindow, valuemask, &values); Window.c:3486: XConfigureWindow(nxagentDisplay, nxagentConfiguredSynchroWindow, #### XConnectionNumber #### Display.c:110:int nxagentXConnectionNumber; Display.c:1236: nxagentXConnectionNumber = XConnectionNumber(nxagentDisplay); Display.c:2937: int fd = XConnectionNumber(nxagentDisplay); Display.c:2939: nxagentXConnectionNumber = fd; Display.c:2943: "to the device set.\n", nxagentXConnectionNumber); Display.c:2946: AddEnabledDevice(nxagentXConnectionNumber); Display.c:2953: "from the device set.\n", nxagentXConnectionNumber); Display.c:2956: RemoveEnabledDevice(nxagentXConnectionNumber); Display.c:2986: nxagentXConnectionNumber); Handlers.c:636: if (count > 0 && FD_ISSET(nxagentXConnectionNumber, (fd_set *) mask)) Handlers.c:649: FD_CLR(nxagentXConnectionNumber, (fd_set *) mask); Handlers.c:932: if (count > 0 && FD_ISSET(nxagentXConnectionNumber, (fd_set *) mask)) Handlers.c:945: FD_CLR(nxagentXConnectionNumber, (fd_set *) mask); Screen.c:196:int nxagentShadowXConnectionNumber; Screen.c:2773: fd = XConnectionNumber(nxagentShadowDisplay); Screen.c:2775: nxagentShadowXConnectionNumber = fd; Screen.c:2784: AddEnabledDevice(nxagentShadowXConnectionNumber); Display.h:159:extern int nxagentXConnectionNumber; Display.h:166:extern int nxagentShadowXConnectionNumber; #### XContextDependentDrawing #### #### XContextualDrawing #### #### XConvertCase #### #### XConvertSelection #### Clipboard.c:401: XConvertSelection(nxagentDisplay, CurrentSelections[i].selection, Clipboard.c:406: fprintf(stderr, "nxagentRequestSelection: Sent XConvertSelection.\n"); Clipboard.c:1353: XConvertSelection(nxagentDisplay, selection, serverUTF8_STRING, serverCutProperty, Clipboard.c:1358: XConvertSelection(nxagentDisplay, selection, XA_STRING, serverCutProperty, Clipboard.c:1363: fprintf(stderr, "nxagentConvertSelection: Sent XConvertSelection with target=[%s], property [%s]\n", #### XCopyArea #### GCOps.c:276: * XCopyArea request must be skipped. GCOps.c:533: XCopyArea(nxagentDisplay, nxagentDrawable(pSrcDrawable), nxagentDrawable(pDstDrawable), GCOps.c:824: XCopyArea(nxagentDisplay, nxagentDrawable(pSrcDrawable), nxagentDrawable(pDstDrawable), Holder.c:182: XCopyArea(nxagentDisplay, nxagentPlaceholderPixmaps[depth], Screen.c:4205: XCopyArea(nxagentDisplay, nxagentWindow(pWin), nxagentPixmap(pPixmap), gc, Screen.c:4340: XCopyArea(nxagentDisplay, nxagentPixmap(pPixmap), nxagentWindow(pWin), gc, #### XCopyColormapAndFree #### #### XCopyGC #### GC.c:587: XCopyGC(nxagentDisplay, nxagentGC(pGCSrc), mask, nxagentGC(pGCDst)); #### XCopyPlane #### GCOps.c:1075: XCopyPlane(nxagentDisplay, #### XCreateBitmapFromData #### #### XCreateColormap #### Colormap.c:106: XCreateColormap(nxagentDisplay, Colormap.c:569: XCreateColormap(nxagentDisplay, Display.c:1289: nxagentDefaultColormaps[i] = XCreateColormap(nxagentDisplay, Display.c:2790: nxagentDefaultColormaps[i] = XCreateColormap(nxagentDisplay, #### XCreateFontCursor #### Events.c:1244: viewportCursor = XCreateFontCursor(nxagentDisplay, XC_fleur); #### XCreateFontSet #### #### XCreateGC #### Display.c:1372: nxagentBitmapGC = XCreateGC(nxagentDisplay, nxagentDefaultDrawables[1], 0L, NULL); Display.c:2892: nxagentBitmapGC = XCreateGC(nxagentDisplay, nxagentDefaultDrawables[1], 0L, NULL); Drawable.c:2578: gc = XCreateGC(nxagentDisplay, nxagentWindow(pWin), GCForeground | GCSubwindowMode, &value); GC.c:172: nxagentGCPriv(pGC)->gc = XCreateGC(nxagentDisplay, GC.c:1144: if ((nxagentGC(pGC) = XCreateGC(nxagentDisplay, Holder.c:126: gc = XCreateGC(nxagentDisplay, drawable, GCBackground | Pixmap.c:1431: gc = XCreateGC(shadow, win, GCBackground | Pixmap.c:1593: gc = XCreateGC(shadow, win, GCBackground | Screen.c:2816: gc = XCreateGC(nxagentDisplay, nxagentPixmap(nxagentShadowPixmapPtr), GCBackground | Screen.c:4133: gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values); Screen.c:4254: gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values); Screen.c:4562: gc = XCreateGC(shadow, win, GCBackground | Screen.c:4677: gc = XCreateGC(shadow, nxagentWindow(screenInfo.screens[0]->root), GCBackground | Splash.c:153: gc = XCreateGC(nxagentDisplay, nxagentSplashWindow, 0, NULL); #### XCreateGlyphCursor #### #### XCreateIC #### #### XCreateImage #### Cursor.c:190: image = XCreateImage(nxagentDisplay, Cursor.c:216: image = XCreateImage(nxagentDisplay, Drawable.c:2162: ximage = XCreateImage(nxagentDisplay, pVisual, depth, format, leftPad, (char *) data, Image.c:985: image = XCreateImage(nxagentDisplay, pVisual, depth, ZPixmap, Image.c:1098: * XCreateImage is the place where the leftPad should be passed. Image.c:1107: * plainImage = XCreateImage(nxagentDisplay, pVisual, Image.c:1113: if ((plainImage = XCreateImage(nxagentDisplay, pVisual, Image.c:1698: newImage = XCreateImage(nxagentDisplay, NULL, image -> depth, image -> format, 0, NULL, Pixmap.c:1407: image = XCreateImage(nxagentDisplay, pVisual, Pixmap.c:1415: fprintf(stderr, "nxagentPixmapOnShadowDisplay: XCreateImage failed.\n"); Pixmap.c:1569: image = XCreateImage(nxagentDisplay, pVisual, Pixmap.c:1577: fprintf(stderr, "nxagentFbOnShadowDisplay: XCreateImage failed.\n"); Screen.c:4660: image = XCreateImage(nxagentDisplay, pVisual, #### XCreateOC #### #### XCreatePixmap #### Cursor.c:178: source = XCreatePixmap(nxagentDisplay, Cursor.c:184: mask = XCreatePixmap(nxagentDisplay, Cursor.c:245: XCreatePixmapCursor(nxagentDisplay, source, mask, &fg_color, Display.c:1775: XCreatePixmap(nxagentDisplay, DefaultRootWindow(nxagentDisplay), Display.c:1793: XCreatePixmap(nxagentDisplay, DefaultRootWindow(nxagentDisplay), Pixmap.c:219: pPixmapPriv -> id = XCreatePixmap(nxagentDisplay, Pixmap.c:898: pPixmapPriv -> id = XCreatePixmap(nxagentDisplay, Screen.c:2882: xid = XCreatePixmap(nxagentDisplay, nxagentDefaultWindows[0], Screen.c:3560: nxagentPixmap(pPixmap) = XCreatePixmap(nxagentDisplay, Screen.c:3574: XCreatePixmap(nxagentDisplay, Splash.c:223: nxagentPixmapLogo = XCreatePixmap(nxagentDisplay, win, width, height, nxagentLogoDepth); #### XCreatePixmapCursor #### Cursor.c:245: XCreatePixmapCursor(nxagentDisplay, source, mask, &fg_color, #### XCreatePixmapFromBitmapData #### #### XCreateRegion #### Render.c:715: reg = XCreateRegion(); Window.c:2346: reg = XCreateRegion(); Window.c:2406: reg = XCreateRegion(); #### XCreateSimpleWindow #### Pixmap.c:1346: win = XCreateSimpleWindow(shadow, DefaultRootWindow(shadow), 0, 0, Pixmap.c:1498: win = XCreateSimpleWindow(shadow, DefaultRootWindow(shadow), 0, 0, Screen.c:4493: win = XCreateSimpleWindow(shadow, DefaultRootWindow(shadow), 0, 0, Splash.c:140: XCreateSimpleWindow(nxagentDisplay, #### XCreateWindow #### Display.c:1384: nxagentConfineWindow = XCreateWindow(nxagentDisplay, Display.c:2898: nxagentConfineWindow = XCreateWindow(nxagentDisplay, Screen.c:392: w = XCreateWindow(nxagentDisplay, DefaultRootWindow(nxagentDisplay), Screen.c:1734: XCreateWindow(nxagentDisplay, Screen.c:1753: XCreateWindow(nxagentDisplay, Window.c:380: nxagentWindowPriv(pWin)->window = XCreateWindow(nxagentDisplay, Window.c:2152: nxagentConfiguredSynchroWindow = XCreateWindow(nxagentDisplay, DefaultRootWindow(nxagentDisplay), 0, 0, Window.c:2980: nxagentWindow(pWin) = XCreateWindow(nxagentDisplay, #### XDefaultColormap #### #### XDefaultColormapOfScreen #### #### XDefaultDepth #### #### XDefaultDepthOfScreen #### #### XDefaultGC #### #### XDefaultGCOfScreen #### #### XDefaultRootWindow #### #### XDefaultScreen #### #### XDefaultScreenOfDisplay #### #### XDefaultString #### #### XDefaultVisual #### #### XDefaultVisualOfScreen #### #### XDefineCursor #### Cursor.c:139: XDefineCursor(nxagentDisplay, Window.c:3167: XDefineCursor(nxagentDisplay,nxagentWindow(pWin),nxagentCursor(pCursor,pScreen)); #### XDeleteContext #### #### XDeleteModifiermapEntry #### #### XDeleteProperty #### Rootless.c:755: XDeleteProperty(nxagentDisplay, nxagentWindow(pWin), propertyX); #### XDestroyIC #### #### XDestroyImage #### Drawable.c:2179: XDestroyImage(ximage); Image.c:1076: XDestroyImage(image); Pixmap.c:1166: XDestroyImage(image); Pixmap.c:1442: XDestroyImage(image); Pixmap.c:1604: XDestroyImage(image); Screen.c:4577: XDestroyImage(image); Screen.c:4693: XDestroyImage(image); Window.c:3338: XDestroyImage(image); #### XDestroyOC #### #### XDestroyRegion #### Render.c:749: XDestroyRegion(reg); Window.c:2364: XDestroyRegion(reg); Window.c:2424: XDestroyRegion(reg); #### XDestroySubwindows #### #### XDestroyWindow #### Screen.c:4589: XDestroyWindow(shadow, win); Splash.c:404: XDestroyWindow(nxagentDisplay, nxagentSplashWindow); Window.c:636: XDestroyWindow(nxagentDisplay, nxagentWindow(pWin)); Window.c:964: XDestroyWindow(nxagentDisplay, nxagentIconWindow); #### XDirectionalDependentDrawing #### #### XDisableAccessControl #### #### XDisplayCells #### #### XDisplayHeight #### #### XDisplayHeightMM #### #### XDisplayKeycodes #### Keyboard.c:750: XDisplayKeycodes(nxagentDisplay, &min_keycode, &max_keycode); #### XDisplayMotionBufferSize #### #### XDisplayName #### Display.c:1206: strncpy(nxagentDisplayName, XDisplayName(NULL), 1023); #### XDisplayOfIM #### #### XDisplayOfOM #### #### XDisplayOfScreen #### #### XDisplayPlanes #### #### XDisplayString #### #### XDisplayWidth #### #### XDisplayWidthMM #### #### XDoesBackingStore #### Init.c:340: nxagentBackingStore = XDoesBackingStore(DefaultScreenOfDisplay(nxagentDisplay)); #### XDoesSaveUnders #### Init.c:347: nxagentSaveUnder = XDoesSaveUnders(DefaultScreenOfDisplay(nxagentDisplay)); #### XDrawArc #### GCOps.c:1424: XDrawArcs(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1430: XDrawArcs(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1440: XDrawArcs(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), #### XDrawArcs #### GCOps.c:1424: XDrawArcs(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1430: XDrawArcs(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1440: XDrawArcs(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), #### XDrawImageString16 #### GCOps.c:2024: XDrawImageString16(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:2030: XDrawImageString16(nxagentDisplay, nxagentDrawable(pDrawable), GCOps.c:2040: XDrawImageString16(nxagentDisplay, nxagentDrawable(pDrawable), #### XDrawImageString #### GCOps.c:1967: XDrawImageString(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1973: XDrawImageString(nxagentDisplay, nxagentDrawable(pDrawable), GCOps.c:1983: XDrawImageString(nxagentDisplay, nxagentDrawable(pDrawable), GCOps.c:2024: XDrawImageString16(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:2030: XDrawImageString16(nxagentDisplay, nxagentDrawable(pDrawable), GCOps.c:2040: XDrawImageString16(nxagentDisplay, nxagentDrawable(pDrawable), #### XDrawLine #### GCOps.c:1209: XDrawLines(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1215: XDrawLines(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1225: XDrawLines(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), Holder.c:148: XDrawLines(nxagentDisplay, drawable, gc, points, 3, CoordModeOrigin); Holder.c:162: XDrawLines(nxagentDisplay, drawable, gc, points, 3, CoordModeOrigin); #### XDrawLines #### GCOps.c:1209: XDrawLines(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1215: XDrawLines(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1225: XDrawLines(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), Holder.c:148: XDrawLines(nxagentDisplay, drawable, gc, points, 3, CoordModeOrigin); Holder.c:162: XDrawLines(nxagentDisplay, drawable, gc, points, 3, CoordModeOrigin); #### XDrawPoint #### GCOps.c:1152: XDrawPoints(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1158: XDrawPoints(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1168: XDrawPoints(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), #### XDrawPoints #### GCOps.c:1152: XDrawPoints(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1158: XDrawPoints(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1168: XDrawPoints(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), #### XDrawRectangle #### Drawable.c:2598: XDrawRectangle(nxagentDisplay, nxagentWindow(pWin), gc, GCOps.c:1359: XDrawRectangles(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1365: XDrawRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1379: XDrawRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), #### XDrawRectangles #### GCOps.c:1359: XDrawRectangles(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1365: XDrawRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1379: XDrawRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), #### XDrawSegments #### GCOps.c:1282: XDrawSegments(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1288: XDrawSegments(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1300: XDrawSegments(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), #### XDrawString16 #### GCOps.c:1908: XDrawString16(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1914: XDrawString16(nxagentDisplay, nxagentDrawable(pDrawable), GCOps.c:1924: XDrawString16(nxagentDisplay, nxagentDrawable(pDrawable), #### XDrawString #### GCOps.c:1835: XDrawString(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1841: XDrawString(nxagentDisplay, nxagentDrawable(pDrawable), GCOps.c:1851: XDrawString(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1908: XDrawString16(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1914: XDrawString16(nxagentDisplay, nxagentDrawable(pDrawable), GCOps.c:1924: XDrawString16(nxagentDisplay, nxagentDrawable(pDrawable), #### XDrawText16 #### #### XDrawText #### #### XEHeadOfExtensionList #### #### XESetBeforeFlush #### #### XESetCloseDisplay #### #### XESetCopyEventCookie #### #### XESetCopyGC #### #### XESetCreateFont #### #### XESetCreateGC #### #### XESetError #### #### XESetErrorString #### #### XESetEventToWire #### #### XESetFlushGC #### #### XESetFreeFont #### #### XESetFreeGC #### #### XESetPrintErrorValues #### #### XESetWireToError #### #### XESetWireToEvent #### #### XESetWireToEventCookie #### #### XEmptyRegion #### #### XEnableAccessControl #### #### XEqualRegion #### #### XEventMaskOfScreen #### #### XEventsQueued #### Events.h:231: XEventsQueued((display), QueuedAfterReading) #### XExtendedMaxRequestSize #### #### XExtentsOfFontSet #### #### XFetchBuffer #### #### XFetchBytes #### #### XFetchName #### Events.c:325: if (!XFetchName(nxagentDisplay, window, &winName)) #### XFillArc #### GCOps.c:1756: XFillArcs(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1762: XFillArcs(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1776: XFillArcs(nxagentDisplay, nxagentDrawable(pDrawable), #### XFillArcs #### GCOps.c:1756: XFillArcs(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1762: XFillArcs(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1776: XFillArcs(nxagentDisplay, nxagentDrawable(pDrawable), #### XFillPolygon #### GCOps.c:1520: XFillPolygon(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1526: XFillPolygon(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1538: XFillPolygon(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), Splash.c:230: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:253: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:259: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:273: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:279: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:285: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:291: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:298: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:311: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:317: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:323: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:329: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:335: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:341: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:354: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:360: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:366: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); Splash.c:372: XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); #### XFillRectangle #### Drawable.c:2376: XFillRectangle(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), Drawable.c:2395: XFillRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1699: XFillRectangles(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1705: XFillRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1715: XFillRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), Holder.c:129: XFillRectangle(nxagentDisplay, drawable, gc, x, y, w, h); Screen.c:2819: XFillRectangle(nxagentDisplay, nxagentPixmap(nxagentShadowPixmapPtr), gc, 0, 0, #### XFillRectangles #### Drawable.c:2395: XFillRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1699: XFillRectangles(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), GCOps.c:1705: XFillRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), GCOps.c:1715: XFillRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), #### XFilterEvent #### #### XFindContext #### #### XFindOnExtensionList #### #### XFlush #### Client.c:355: NXFlushDisplay(nxagentDisplay, NXFlushBuffer); Events.c:3354: NXFlushDisplay(nxagentDisplay, NXFlushLink); Events.c:4517: NXFlushDisplay(dpy, NXFlushLink); Handlers.c:487: NXFlushDisplay(nxagentDisplay, NXFlushLink); Handlers.c:524: NXFlushDisplay(nxagentDisplay, NXFlushLink); Handlers.c:838: NXFlushDisplay(nxagentDisplay, NXFlushLink); Handlers.c:1333: NXFlushDisplay(nxagentDisplay, NXFlushBuffer); Reconnect.c:512: XFlush(nxagentDisplay); Screen.c:4571: XFlush(shadow); Screen.c:4687: XFlush(shadow); Split.c:760: NXFlushDisplay(nxagentDisplay, NXFlushBuffer); Split.c:874: NXFlushDisplay(nxagentDisplay, NXFlushBuffer); Window.c:2493: NXFlushDisplay(nxagentDisplay, NXFlushLink); #### XFlushGC #### #### XFontsOfFontSet #### #### XForceScreenSaver #### #### XFree #### Args.c:2035: * to a standard XFree86 server. Atoms.c:763: XFree(string); Clipboard.c:315: XFree(strTarget); Clipboard.c:701: XFree(pszReturnData); Clipboard.c:725: XFree(pszReturnData); Clipboard.c:839: XFree(pszReturnData); Colormap.c:178: XFreeColormap(nxagentDisplay, nxagentColormap(pCmap)); Cursor.c:214: XFree(image); Cursor.c:232: XFree(image); Cursor.c:256: XFreePixmap(nxagentDisplay, source); Cursor.c:257: XFreePixmap(nxagentDisplay, mask); Cursor.c:273: XFreeCursor(nxagentDisplay, nxagentCursor(pCursor, pScreen)); Display.c:1603: XFree(viList); Display.c:1828: XFree(nxagentVisuals); Display.c:1834: XFree(nxagentPixmapFormats); Display.c:1837: XFree(nxagentRemotePixmapFormats); Display.c:1854: NXFreeCache(nxagentDisplay); Display.c:2114: XFreeGC(nxagentDisplayBackup, nxagentBitmapGCBackup); Display.c:2136: XFreeGC(nxagentDisplay, nxagentBitmapGC); Display.c:2623: XFree(viList); Display.c:2822: XFree(nxagentPixmapFormats); Display.c:2829: XFree(nxagentRemotePixmapFormats); Drawable.c:2603: XFreeGC(nxagentDisplay, gc); Events.c:332: XFree(winName); Events.c:358: XFreeStringList(list); Events.c:481: XFree((char *) childList); Events.c:1327: XFreeCursor(nxagentDisplay, viewportCursor); Events.c:3181: XFree(children_return); Events.c:3543: XFree(children_return); Events.c:3575: XFree(children_return); Events.c:3647: XFree(childrenReturn); Events.c:4040: XFree(pszReturnData); Font.c:280: XFreeFontNames(xList); Font.c:689: XFreeFont(nxagentDisplay, nxagentFontStruct(pFont)); Font.c:906: XFreeFont(nxagentDisplay, privFont -> font_struct); Font.c:1084: XFree(CACHE_NAME(i)); Font.c:1361: XFreeFontPath(fontPaths); Font.c:1372: XFreeFontPath(fontPaths); Font.c:1734: XFree(fs); GC.c:608: XFreeGC(nxagentDisplay, nxagentGC(pGC)); Holder.c:187: XFreeGC(nxagentDisplay, gc); Keyboard.c:762: XFreeModifiermap(modifier_keymap); Keyboard.c:771: XFree(keymap64); Keyboard.c:783: XFreeModifiermap(modifier_keymap); Keyboard.c:807: XFreeModifiermap(modifier_keymap); Keyboard.c:1153: XFree(keymap); Keyboard.c:1753: XFree(data); Keyboard.c:1880: XFree(drules); NXglxext.c:26:/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.9 2003/09/28 20:15:43 alanh Exp $ NXglyph.c:27: * $XFree86: xc/programs/Xserver/render/glyph.c,v 1.5 2001/01/30 07:01:22 keithp Exp $ NXmiglyph.c:27: * $XFree86: xc/programs/Xserver/render/miglyph.c,v 1.4 2000/11/20 07:13:13 keithp Exp $ NXmitrap.c:27: * $XFree86: xc/programs/Xserver/render/mitrap.c,v 1.8 2002/09/03 19:28:28 keithp Exp $ NXmitrap.c:29: * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. NXpicture.c:27: * $XFree86: xc/programs/Xserver/render/picture.c,v 1.29 2002/11/23 02:38:15 keithp Exp $ NXrender.c:27: * $XFree86: xc/programs/Xserver/render/render.c,v 1.27tsi Exp $ Pixmap.c:490: XFreePixmap(nxagentDisplay, pPixmapPriv -> id); Pixmap.c:1438: XFreeGC(shadow, gc); Pixmap.c:1600: XFreeGC(shadow, gc); Rootless.c:294: XFree(children_return); Screen.c:2822: XFreeGC(nxagentDisplay, gc); Screen.c:2880: XFreePixmap(nxagentDisplay, nxagentPixmap(nxagentVirtualPixmap(nxagentShadowPixmapPtr))); Screen.c:4216: XFreeGC(nxagentDisplay, gc); Screen.c:4343: XFreeGC(nxagentDisplay, gc); Screen.c:4573: XFreeGC(shadow, gc); Screen.c:4689: XFreeGC(shadow, gc); Splash.c:160: XFreeGC(nxagentDisplay, gc); Splash.c:420: XFreePixmap(nxagentDisplay, nxagentPixmapLogo); Split.c:185: NXFreeSplit(nxagentDisplay, pResource -> split); Window.c:1448: XFree(children_return); NXglyphstr_GlyphRef.h:27: * $XFree86: xc/programs/Xserver/render/glyphstr.h,v 1.3 2000/11/20 07:13:13 keithp Exp $ NXglyphstr_GlyphSet.h:27: * $XFree86: xc/programs/Xserver/render/glyphstr.h,v 1.3 2000/11/20 07:13:13 keithp Exp $ Pixels.h:117: te on XFree86 remote server. #### XFreeColormap #### Colormap.c:178: XFreeColormap(nxagentDisplay, nxagentColormap(pCmap)); #### XFreeColors #### #### XFreeCursor #### Cursor.c:273: XFreeCursor(nxagentDisplay, nxagentCursor(pCursor, pScreen)); Events.c:1327: XFreeCursor(nxagentDisplay, viewportCursor); #### XFreeEventData #### #### XFreeExtensionList #### #### XFreeFont #### Font.c:280: XFreeFontNames(xList); Font.c:689: XFreeFont(nxagentDisplay, nxagentFontStruct(pFont)); Font.c:906: XFreeFont(nxagentDisplay, privFont -> font_struct); Font.c:1361: XFreeFontPath(fontPaths); Font.c:1372: XFreeFontPath(fontPaths); #### XFreeFontInfo #### #### XFreeFontNames #### Font.c:280: XFreeFontNames(xList); #### XFreeFontPath #### Font.c:1361: XFreeFontPath(fontPaths); Font.c:1372: XFreeFontPath(fontPaths); #### XFreeFontSet #### #### XFreeGC #### Display.c:2114: XFreeGC(nxagentDisplayBackup, nxagentBitmapGCBackup); Display.c:2136: XFreeGC(nxagentDisplay, nxagentBitmapGC); Drawable.c:2603: XFreeGC(nxagentDisplay, gc); GC.c:608: XFreeGC(nxagentDisplay, nxagentGC(pGC)); Holder.c:187: XFreeGC(nxagentDisplay, gc); Pixmap.c:1438: XFreeGC(shadow, gc); Pixmap.c:1600: XFreeGC(shadow, gc); Screen.c:2822: XFreeGC(nxagentDisplay, gc); Screen.c:4216: XFreeGC(nxagentDisplay, gc); Screen.c:4343: XFreeGC(nxagentDisplay, gc); Screen.c:4573: XFreeGC(shadow, gc); Screen.c:4689: XFreeGC(shadow, gc); Splash.c:160: XFreeGC(nxagentDisplay, gc); #### XFreeModifiermap #### Keyboard.c:762: XFreeModifiermap(modifier_keymap); Keyboard.c:783: XFreeModifiermap(modifier_keymap); Keyboard.c:807: XFreeModifiermap(modifier_keymap); #### XFreePixmap #### Cursor.c:256: XFreePixmap(nxagentDisplay, source); Cursor.c:257: XFreePixmap(nxagentDisplay, mask); Pixmap.c:490: XFreePixmap(nxagentDisplay, pPixmapPriv -> id); Screen.c:2880: XFreePixmap(nxagentDisplay, nxagentPixmap(nxagentVirtualPixmap(nxagentShadowPixmapPtr))); Splash.c:420: XFreePixmap(nxagentDisplay, nxagentPixmapLogo); #### XFreeStringList #### Events.c:358: XFreeStringList(list); #### XGContextFromGC #### #### XGeometry #### #### XGetAtomName #### Atoms.c:748: if ((string = XGetAtomName(nxagentDisplay, remote))) Clipboard.c:304: strTarget = XGetAtomName(nxagentDisplay, X->xselectionrequest.target); Clipboard.c:1599: validateString(XGetAtomName(nxagentDisplay, nxagentAtoms[10])), iWindow); Events.c:925: (int)X.xproperty.atom, validateString(XGetAtomName(nxagentDisplay, X.xproperty.atom)), #### XGetAtomNames #### #### XGetClassHint #### #### XGetCommand #### #### XGetDefault #### #### XGetErrorDatabaseText #### Error.c:135: XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ); Error.c:137: XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d", Error.c:142: XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); Error.c:156: XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", Error.c:163: XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ); Error.c:192: XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ); Error.c:216: XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", Error.c:219: XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", Error.c:222: XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", Error.c:228: XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", Error.c:232: XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d", #### XGetErrorText #### Error.c:134: XGetErrorText(dpy, event->error_code, buffer, BUFSIZ); #### XGetEventData #### #### XGetFontPath #### Font.c:1304: fontPaths = XGetFontPath(nxagentDisplay, &nPaths); NXdixfonts.c:107:static const char *_NXGetFontPath(const char *path) NXdixfonts.c:127: fprintf(stderr, "_NXGetFontPath: WARNING! Maximum length of font path exceeded.\n"); NXdixfonts.c:129: goto _NXGetFontPathError; NXdixfonts.c:135: fprintf(stderr, "_NXGetFontPath: Using NX font path [%s].\n", _NXFontPath); NXdixfonts.c:141:_NXGetFontPathError: NXdixfonts.c:147: fprintf(stderr, "_NXGetFontPath: Using default font path [%s].\n", _NXFontPath); NXdixfonts.c:941: len = strlen(_NXGetFontPath(path)) + 1; NXdixfonts.c:949: pp = (unsigned char *) _NXGetFontPath(path); #### XGetFontProperty #### #### XGetGCValues #### #### XGetGeometry #### #### XGetICValues #### #### XGetIMValues #### #### XGetIconName #### #### XGetIconSizes #### #### XGetImage #### Pixmap.c:1086: image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), 0, 0, Pixmap.c:1090: FatalError("XGetImage: Failed.\n"); Screen.c:4531: image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), x, y, Screen.c:4535: image = XGetImage(nxagentDisplay, RootWindow(nxagentDisplay, 0), 0, 0, Screen.c:4541: fprintf(stderr, "nxagentShowPixmap: XGetImage failed.\n"); Screen.c:4625: image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), xSrc, ySrc, Screen.c:4632: fprintf(stderr, "nxagentFbRestoreArea: XGetImage failed.\n"); Window.c:3286: image = XGetImage(nxagentDisplay, nxagentWindow(pWin), 0, 0, Window.c:3290: fprintf(stderr, "XGetImage: Failed.\n"); #### XGetInputFocus #### #### XGetKeyboardControl #### Keyboard.c:850: XGetKeyboardControl(nxagentDisplay, &values); #### XGetKeyboardMapping #### Keyboard.c:755: keymap64 = XGetKeyboardMapping(nxagentDisplay, Keyboard.c:776: keymap = XGetKeyboardMapping(nxagentDisplay, #### XGetModifierMapping #### Keyboard.c:743: modifier_keymap = XGetModifierMapping(nxagentDisplay); #### XGetMotionEvents #### #### XGetNormalHints #### #### XGetOCValues #### #### XGetOMValues #### #### XGetPixel #### Drawable.c:2177: pixel = XGetPixel(ximage, 0, 0); Image.c:1743: val = XGetPixel(image, i - x, j - y); #### XGetPointerControl #### #### XGetPointerMapping #### Pointer.c:124: nmap = XGetPointerMapping(nxagentDisplay, map, MAXBUTTONS); Pointer.c:189: numButtons = XGetPointerMapping(nxagentDisplay, pointerMap, MAXBUTTONS); #### XGetRGBColormaps #### #### XGetScreenSaver #### #### XGetSelectionOwner #### Clipboard.c:1117: if (XGetSelectionOwner(nxagentDisplay,pSelection->selection)==serverWindow) #### XGetSizeHints #### #### XGetStandardColormap #### #### XGetSubImage #### #### XGetTextProperty #### #### XGetTransientForHint #### #### XGetVisualInfo #### Display.c:1568: viList = XGetVisualInfo(nxagentDisplay, mask, &vi, &viNumList); Display.c:2553: viList = XGetVisualInfo(nxagentDisplay, viMask, &viTemplate, &viNumList); #### XGetWMClientMachine #### #### XGetWMColormapWindows #### #### XGetWMHints #### #### XGetWMIconName #### #### XGetWMName #### Events.c:337: if (XGetWMName(nxagentDisplay, window, &tp) != 0) #### XGetWMNormalHints #### #### XGetWMProtocols #### #### XGetWMSizeHints #### #### XGetWindowAttributes #### Events.c:393: if (XGetWindowAttributes(nxagentDisplay, win, &attributes) == 0) Events.c:3609: if ((XGetWindowAttributes(nxagentDisplay, X -> xreparent.window, Events.c:3614: "XGetWindowAttributes failed.\n"); Events.c:3658: if (XGetWindowAttributes(nxagentDisplay, w, &attributes) == 0) Events.c:3662: "XGetWindowAttributes failed for parent window.\n"); Screen.c:1425: XGetWindowAttributes(nxagentDisplay, nxagentParentWindow, &gattributes); Splash.c:111: * XGetWindowAttributes(nxagentDisplay, parentWindow, &getAttributes); #### XGetWindowProperty #### Keyboard.c:1740: result = XGetWindowProperty(nxagentDisplay, DefaultRootWindow(nxagentDisplay), Screen.c:3400: iReturn = XGetWindowProperty(nxagentDisplay, #### XGetZoomHints #### #### XGrabButton #### #### XGrabKey #### Events.c:3860: result = XGrabKeyboard(nxagentDisplay, nxagentFullscreenWindow, Events.c:3891: * XGrabKey(nxagentDisplay, AnyKey, AnyModifier, nxagentFullscreenWindow, Screen.c:1904: XGrabKeyboard(nxagentDisplay, nxagentFullscreenWindow, True, GrabModeAsync, Screen.c:1923: fprintf(stderr, "nxagentOpenScreen: No window manager, we call XGrabKeyboard.\n"); Screen.c:1926: XGrabKeyboard(nxagentDisplay, RootWindow (nxagentDisplay, 0), True, GrabModeAsync, #### XGrabKeyboard #### Events.c:3860: result = XGrabKeyboard(nxagentDisplay, nxagentFullscreenWindow, Screen.c:1904: XGrabKeyboard(nxagentDisplay, nxagentFullscreenWindow, True, GrabModeAsync, Screen.c:1923: fprintf(stderr, "nxagentOpenScreen: No window manager, we call XGrabKeyboard.\n"); Screen.c:1926: XGrabKeyboard(nxagentDisplay, RootWindow (nxagentDisplay, 0), True, GrabModeAsync, #### XGrabPointer #### #### XGrabServer #### #### XHeightMMOfScreen #### #### XHeightOfScreen #### #### XIMOfIC #### #### XIconifyWindow #### Events.c:2144: XIconifyWindow(nxagentDisplay, nxagentDefaultWindows[0], Events.c:2759: XIconifyWindow(nxagentDisplay, nxagentIconWindow, Screen.c:301: XIconifyWindow(nxagentDisplay, nxagentIconWindow, Screen.c:306: XIconifyWindow(nxagentDisplay, nxagentIconWindow, Screen.c:358: XIconifyWindow(nxagentDisplay, nxagentIconWindow, Window.c:2585: XIconifyWindow(nxagentDisplay, nxagentIconWindow, Window.c:3228: XIconifyWindow(nxagentDisplay, nxagentWindow(pWin), pWin -> drawable.pScreen -> myNum); #### XIfEvent #### Split.c:769: * We should better use XIfEvent() instead Split.c:883: XIfEvent(nxagentDisplay, &event, nxagentWaitSplitPredicate, NULL); #### XImageByteOrder #### #### XInitExtension #### #### XInitImage #### #### XInitThreads #### #### XInsertModifiermapEntry #### #### XInstallColormap #### Colormap.c:363: XInstallColormap(nxagentDisplay, nxagentColormap(pCmap)); #### XInternAtom #### Atoms.c:246: * after a reset the XInternAtom could be cached Atoms.c:472: ret_value = XInternAtoms(nxagentDisplay, name_list, list_size, False, atom_list); Atoms.c:477: fprintf(stderr, "nxagentInitAtomMap: WARNING! XInternAtoms request failed.\n"); Atoms.c:653: remote = XInternAtom(nxagentDisplay, string, !Makeit); Atoms.c:658: fprintf(stderr, "nxagentMakeAtom: WARNING XInternAtom failed.\n"); Atoms.c:693: remote = XInternAtom(nxagentDisplay, string, False); Atoms.c:698: fprintf(stderr, "nxagentLocalToRemoteAtom: WARNING XInternAtom failed.\n"); Clipboard.c:326: XInternAtom(nxagentDisplay, "ATOM", 0), Clipboard.c:1417: * XInternAtom(nxagentDisplay, "CLIPBOARD", 1). Keyboard.c:1733: atom = XInternAtom(nxagentDisplay, "_XKB_RULES_NAMES", 1); Screen.c:2586: nxagentShadowAtom = XInternAtom(nxagentShadowDisplay, "_NX_SHADOW", False); #### XInternAtoms #### Atoms.c:472: ret_value = XInternAtoms(nxagentDisplay, name_list, list_size, False, atom_list); Atoms.c:477: fprintf(stderr, "nxagentInitAtomMap: WARNING! XInternAtoms request failed.\n"); #### XInternalConnectionNumbers #### #### XIntersectRegion #### #### XKeycodeToKeysym #### Events.c:1104: keysym = XKeycodeToKeysym(nxagentDisplay, X.xkey.keycode, 0); Events.c:4642: XKeysymToString(XKeycodeToKeysym(nxagentDisplay, i * 8 + k, 0))); Keystroke.c:409: KeySym keysym = XKeycodeToKeysym(nxagentDisplay, X->keycode, 0); Keystroke.c:443: sym = XKeycodeToKeysym(nxagentDisplay, X -> keycode, index); #### XKeysymToKeycode #### Keyboard.c:1380: if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Meta_L)) Keyboard.c:1385: if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Meta_R)) Keyboard.c:1390: if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Alt_L)) Keyboard.c:1395: if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Alt_R)) Keyboard.c:1403: nxagentCapsLockKeycode = XKeysymToKeycode(nxagentDisplay, XK_Caps_Lock); Keyboard.c:1405: nxagentNumLockKeycode = XKeysymToKeycode(nxagentDisplay, XK_Num_Lock); #### XKeysymToString #### Events.c:4642: XKeysymToString(XKeycodeToKeysym(nxagentDisplay, i * 8 + k, 0))); #### XKillClient #### #### XLastKnownRequestProcessed #### #### XListDepths #### Display.c:1619: nxagentDepths = XListDepths(nxagentDisplay, DefaultScreen(nxagentDisplay), #### XListExtensions #### #### XListFonts #### Font.c:260: xList = XListFonts(nxagentDisplay, patterns[p], maxNames, &xLen); #### XListFontsWithInfo #### #### XListHosts #### #### XListInstalledColormaps #### #### XListPixmapFormats #### Display.c:1709: nxagentRemotePixmapFormats = XListPixmapFormats(nxagentDisplay, &nxagentRemoteNumPixmapFormats); #### XListProperties #### #### XLoadFont #### Font.c:1657: fs -> fid = XLoadFont(dpy, name); /* Font id for this font. */ #### XLoadQueryFont #### #### XLocaleOfFontSet #### #### XLocaleOfIM #### #### XLocaleOfOM #### #### XLockDisplay #### #### XLookupColor #### #### XLookupKeysym #### #### XLookupString #### #### XLowerWindow #### Window.c:1507: XLowerWindow(nxagentDisplay, nxagentWindow(pWin)); #### XMapRaised #### Events.c:2757: XMapRaised(nxagentDisplay, nxagentFullscreenWindow); Screen.c:356: XMapRaised(nxagentDisplay, nxagentFullscreenWindow); Splash.c:155: XMapRaised (nxagentDisplay, nxagentSplashWindow); Window.c:912: XMapRaised(nxagentDisplay, w); #### XMapSubwindows #### #### XMapWindow #### Pixmap.c:1349: XMapWindow(shadow, win); Pixmap.c:1501: XMapWindow(shadow, win); Screen.c:300: XMapWindow(nxagentDisplay, nxagentIconWindow); Screen.c:317: XMapWindow(nxagentDisplay, nxagentFullscreenWindow); Screen.c:363: XMapWindow(nxagentDisplay, nxagentIconWindow); Screen.c:2805: XMapWindow(nxagentDisplay, nxagentDefaultWindows[0]); Screen.c:2957: XMapWindow(nxagentDisplay, nxagentWindow(nxagentShadowWindowPtr)); Screen.c:4498: XMapWindow(shadow, win); Window.c:909: XMapWindow(nxagentDisplay, nxagentIconWindow); Window.c:944: XMapWindow(nxagentDisplay, w); Window.c:1007: XMapWindow(nxagentDisplay, w); Window.c:1538: XMapWindow(nxagentDisplay, nxagentWindow(pWin)); Window.c:1911: * XMapWindow(nxagentDisplay, nxagentWindow(pWin)); Window.c:2535: XMapWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum]); Window.c:2547: XMapWindow(nxagentDisplay, nxagentInputWindows[pScreen->myNum]); Window.c:2581: XMapWindow(nxagentDisplay, nxagentIconWindow); Window.c:3216: do anything, leaving this mapped window around. XMapWindow() Window.c:3221: XMapWindow(nxagentDisplay, nxagentWindow(pWin)); Window.c:3240: XMapWindow(nxagentDisplay, nxagentWindow(pWin)); #### XMaskEvent #### #### XMatchVisualInfo #### #### XMaxCmapsOfScreen #### #### XMaxRequestSize #### #### XMinCmapsOfScreen #### #### XMoveResizeWindow #### Events.c:3420: XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, Extensions.c:425: XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, width, Screen.c:2491: XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, Window.c:890: XMoveResizeWindow(nxagentDisplay, w, nxagentOption(X), nxagentOption(Y), Window.c:1001: XMoveResizeWindow(nxagentDisplay, w, nxagentOption(X), nxagentOption(Y), Window.c:1013: XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, #### XMoveWindow #### Events.c:3441: XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root), Screen.c:2432: XMoveWindow(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), Window.c:895: XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root), Window.c:1006: XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root), 0, 0); Window.c:1171: XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root), Window.c:2790: XMoveWindow(nxagentDisplay, nxagentWindow(nxagentViewportFrameLeft), Window.c:2792: XMoveWindow(nxagentDisplay, nxagentWindow(nxagentViewportFrameRight), Window.c:2794: XMoveWindow(nxagentDisplay, nxagentWindow(nxagentViewportFrameAbove), Window.c:2796: XMoveWindow(nxagentDisplay, nxagentWindow(nxagentViewportFrameBelow), Window.c:3237: XMoveWindow(nxagentDisplay, nxagentWindow(pWin), #### XNewModifiermap #### #### XNextEvent #### Screen.c:4504: XNextEvent(shadow, &e); #### XNextRequest #### Window.c:1344: nxagentAddStaticResizedWindow(pWin, XNextRequest(nxagentDisplay), offX, offY); #### XNoOp #### #### XOMOfOC #### #### XOffsetRegion #### #### XOpenDisplay #### Display.c:645: newDisplay = XOpenDisplay(display); Pixmap.c:1333: shadow = XOpenDisplay("localhost:0"); Pixmap.c:1482: shadow = XOpenDisplay("localhost:0"); Screen.c:4477: shadow = XOpenDisplay("localhost:0"); #### XOpenIM #### #### XOpenOM #### #### XParseColor #### #### XParseGeometry #### Args.c:632: nxagentUserGeometry.flag = XParseGeometry(argv[i], #### XPeekEvent #### Events.c:4532: XPeekEvent(dpy, &ev); #### XPeekIfEvent #### #### XPending #### #### XPlanesOfScreen #### #### XPointInRegion #### #### XPolygonRegion #### #### XProcessInternalConnection #### #### XProtocolRevision #### #### XProtocolVersion #### #### XPutBackEvent #### Events.c:3958: XPutBackEvent(nxagentDisplay, (XEvent*)&X); #### XPutImage #### Cursor.c:211: XPutImage(nxagentDisplay, source, nxagentBitmapGC, image, Cursor.c:229: XPutImage(nxagentDisplay, mask, nxagentBitmapGC, image, Image.c:1103: * the src_x of XPutImage otherwise the src_x would make Xlib Image.c:1545: fprintf(stderr, "nxagentPutSubImage: Calling XPutImage with geometry [%d,%d] and data size [%d].\n", Image.c:1552: * XPutImage(nxagentDisplay, nxagentDrawable(pDrawable), Image.c:1556: XPutImage(nxagentDisplay, nxagentDrawable(pDrawable), Pixmap.c:1355: XPutImage returns a BadMatch. For example this may happens if Pixmap.c:1436: XPutImage(shadow, win, gc, image, 0, 0, 0, 0, width, height); Pixmap.c:1598: XPutImage(shadow, win, gc, image, 0, 0, 0, 0, width, height); Screen.c:4569: XPutImage(shadow, win, gc, image, 0, 0, 0, 0, width, height); Screen.c:4682: XPutImage(shadow, nxagentWindow(pWin), gc, image, 0, 0, xDst, yDst, width, height); #### XPutPixel #### Image.c:1770: XPutPixel(newImage, k - x1, l - y1, val); #### XQLength #### Events.c:4458: else if (XQLength(dpy) > 0) Events.c:4462: XQLength(dpy)); Events.h:228: XQLength((display)) #### XQueryBestCursor #### #### XQueryBestSize #### #### XQueryBestStipple #### #### XQueryBestTile #### #### XQueryColor #### Colormap.c:117: XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors); Colormap.c:130: XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors); Colormap.c:154: XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors); #### XQueryColors #### Colormap.c:117: XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors); Colormap.c:130: XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors); Colormap.c:154: XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors); #### XQueryExtension #### Clipboard.c:1559: if (XQueryExtension(nxagentDisplay, #### XQueryFont #### #### XQueryKeymap #### #### XQueryPointer #### #### XQueryTextExtents16 #### #### XQueryTextExtents #### #### XQueryTree #### Events.c:431: if (!XQueryTree(nxagentDisplay, window, &rootWin, &parentWin, &childList, Events.c:434: fprintf(stderr, "nxagentRemoteWindowsTree - XQueryTree failed.\n"); Events.c:1913: * XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), Events.c:3165: result = XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), Events.c:3529: result = XQueryTree(nxagentDisplay, w, &root_return, Events.c:3559: result = XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), Events.c:3637: result = XQueryTree(nxagentDisplay, w, &rootReturn, &parentReturn, Rootless.c:258: result = XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), Window.c:1428: result = XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), #### XRaiseWindow #### Screen.c:4515: XRaiseWindow(nxagentDisplay, win); Window.c:1498: XRaiseWindow(nxagentDisplay, nxagentWindow(pWin)); Window.c:2557: XRaiseWindow(nxagentDisplay, nxagentInputWindows[pScreen->myNum]); Window.c:2742: XRaiseWindow(nxagentDisplay, nxagentInputWindows[i]); #### XReadBitmapFile #### #### XReadBitmapFileData #### #### XRebindKeysym #### #### XRecolorCursor #### Cursor.c:296: XRecolorCursor(nxagentDisplay, #### XReconfigureWMWindow #### #### XRectInRegion #### #### XRefreshKeyboardMapping #### #### XRegisterIMInstantiateCallback #### #### XRemoveConnectionWatch #### #### XRemoveFromSaveSet #### #### XRemoveHost #### #### XRemoveHosts #### #### XReparentWindow #### Screen.c:325:FIXME: We'll check for ReparentNotify and LeaveNotify events after XReparentWindow() Screen.c:334: XReparentWindow(nxagentDisplay, nxagentFullscreenWindow, Window.c:810: XReparentWindow(nxagentDisplay, w, DefaultRootWindow(nxagentDisplay), 0, 0); Window.c:1559: XReparentWindow(nxagentDisplay, nxagentWindow(pWin), #### XResetScreenSaver #### #### XResizeWindow #### Extensions.c:421: XResizeWindow(nxagentDisplay, nxagentDefaultWindows[0], width, height); Screen.c:2401: XResizeWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], width, height); Screen.c:2405: XResizeWindow(nxagentDisplay, nxagentInputWindows[pScreen -> myNum], width, height); Screen.c:2488: XResizeWindow(nxagentDisplay, nxagentDefaultWindows[0], Screen.c:4514: XResizeWindow(nxagentDisplay, win, width, height); #### XResourceManagerString #### #### XRestackWindows #### Window.c:1521: XRestackWindows(nxagentDisplay, windowList, 2); #### XRootWindow #### #### XRootWindowOfScreen #### #### XRotateBuffers #### #### XRotateWindowProperties #### #### XSaveContext #### #### XScreenCount #### #### XScreenNumberOfScreen #### #### XScreenOfDisplay #### #### XScreenResourceString #### #### XSelectInput #### Atoms.c:130: XSelectInput(nxagentDisplay, Atoms.c:157: XSelectInput(nxagentDisplay, RootWindow (nxagentDisplay, 0), 0); Events.c:3549: XSelectInput(nxagentDisplay, w, StructureNotifyMask); Events.c:3697: XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask); Events.c:3718: XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask); Events.c:3737: XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask); Events.c:3754: XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask); Screen.c:437: XSelectInput(nxagentDisplay, w, (mask & ~(KeyPressMask | Screen.c:1708: XSelectInput(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], mask); Screen.c:1843: XSelectInput(nxagentDisplay, nxagentFullscreenWindow, mask); Screen.c:2045: XSelectInput(nxagentDisplay, DefaultRootWindow(nxagentDisplay), StructureNotifyMask); Screen.c:3583: XSelectInput(nxagentDisplay, nxagentDefaultWindows[0], mask); Screen.c:4496: XSelectInput(shadow, win, StructureNotifyMask); #### XSendEvent #### Clipboard.c:364: XSendEvent(nxagentDisplay, Clipboard.c:373: fprintf(stderr, "nxagentRequestSelection: WARNING! XSendEvent failed.\n"); Clipboard.c:377: fprintf(stderr, "nxagentRequestSelection: XSendEvent sent to window [0x%lx].\n", Clipboard.c:481: XSendEvent(nxagentDisplay, Clipboard.c:488: fprintf(stderr, "nxagentRequestSelection: Executed XSendEvent with property None.\n"); Clipboard.c:1007: result = XSendEvent(nxagentDisplay, Clipboard.c:1015: fprintf (stderr, "SelectionRequest - XSendEvent failed\n"); Clipboard.c:1437: result = XSendEvent (nxagentDisplay, x.requestor, False, Clipboard.c:1442: fprintf (stderr, "nxagentSendNotify: XSendEvent failed.\n"); Window.c:762: XSendEvent(nxagentDisplay, DefaultRootWindow(nxagentDisplay), False, #### XServerVendor #### #### XSetAccessControl #### #### XSetAfterFunction #### #### XSetArcMode #### #### XSetAuthorization #### #### XSetBackground #### Splash.c:221: XSetBackground(nxagentDisplay, gc, nxagentLogoRed); Splash.c:237: XSetBackground(nxagentDisplay, gc, nxagentLogoWhite); Splash.c:248: XSetBackground(nxagentDisplay, gc, nxagentLogoWhite); #### XSetClassHint #### Screen.c:1784: XSetClassHint(nxagentDisplay,nxagentDefaultWindows[pScreen->myNum],&hint); Screen.c:1800: XSetClassHint(nxagentDisplay,nxagentDefaultWindows[pScreen->myNum],&hint); #### XSetClipMask #### GC.c:673: XSetClipMask(nxagentDisplay, nxagentGC(pGC), None); GC.c:706: XSetClipMask(nxagentDisplay, nxagentGC(pGC), GC.c:814: XSetClipMask(nxagentDisplay, nxagentGC(pGC), None); GC.c:1283: XSetClipMask(nxagentDisplay, nxagentGC(pGC), None); GC.c:1313: XSetClipMask(nxagentDisplay, nxagentGC(pGC), GC.c:1323: XSetClipMask(nxagentDisplay, nxagentGC(pGC), #### XSetClipOrigin #### GC.c:1316: XSetClipOrigin(nxagentDisplay, nxagentGC(pGC), pGC -> clipOrg.x, pGC -> clipOrg.y); GC.c:1326: XSetClipOrigin(nxagentDisplay, nxagentGC(pGC), pGC -> clipOrg.x, pGC -> clipOrg.y); #### XSetClipRectangles #### GC.c:695: XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC -> clipOrg.x, pGC -> clipOrg.y, GC.c:724: XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), GC.c:735: XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), GC.c:746: XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), GC.c:757: XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), GC.c:1307: XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC -> clipOrg.x, pGC -> clipOrg.y, GC.c:1339: XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), GC.c:1345: XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), GC.c:1351: XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), GC.c:1357: XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), GCOps.c:502: * used in the XSetClipRectangles(). Screen.c:4177: XSetClipRectangles(nxagentDisplay, gc, 0, 0, pRects, nRects, Unsorted); Screen.c:4323: XSetClipRectangles(nxagentDisplay, gc, 0, 0, pRects, nRects, Unsorted); #### XSetCloseDownMode #### #### XSetCommand #### #### XSetDashes #### GC.c:540: XSetDashes(nxagentDisplay, nxagentGC(pGC), #### XSetErrorHandler #### Atoms.c:122: previousErrorHandler = XSetErrorHandler((XErrorHandler)&catchAndRedirect); Atoms.c:137: XSetErrorHandler(previousErrorHandler); Display.c:920: XSetErrorHandler(nxagentErrorHandler); #### XSetFillRule #### #### XSetFillStyle #### Splash.c:219: XSetFillStyle(nxagentDisplay, gc, FillSolid); #### XSetFont #### Font.c:1325: XSetFontPath(nxagentDisplay, newFontPaths, nPaths + 1); Font.c:1357: XSetFontPath(nxagentDisplay, fontPaths, nPaths); Font.c:1370: XSetFontPath(nxagentDisplay, fontPaths, nPaths); #### XSetFontPath #### Font.c:1325: XSetFontPath(nxagentDisplay, newFontPaths, nPaths + 1); Font.c:1357: XSetFontPath(nxagentDisplay, fontPaths, nPaths); Font.c:1370: XSetFontPath(nxagentDisplay, fontPaths, nPaths); #### XSetForeground #### Splash.c:220: XSetForeground(nxagentDisplay, gc, nxagentLogoBlack); Splash.c:236: XSetForeground(nxagentDisplay, gc, nxagentLogoRed); Splash.c:247: XSetForeground(nxagentDisplay, gc, nxagentLogoGray); #### XSetFunction #### Splash.c:218: XSetFunction(nxagentDisplay, gc, GXcopy); #### XSetGraphicsExposures #### #### XSetICFocus #### #### XSetICValues #### #### XSetIMValues #### #### XSetIOErrorHandler #### Display.c:872: XSetIOErrorHandler(nxagentIOErrorHandler); #### XSetIconName #### #### XSetIconSizes #### #### XSetInputFocus #### Events.c:3901: XSetInputFocus(nxagentDisplay, nxagentFullscreenWindow, Window.c:913: XSetInputFocus(nxagentDisplay, w, RevertToParent, CurrentTime); Window.c:2596: XSetInputFocus(nxagentDisplay, nxagentFullscreenWindow, #### XSetLineAttributes #### #### XSetLocaleModifiers #### #### XSetModifierMapping #### #### XSetNormalHints #### #### XSetOCValues #### #### XSetOMValues #### #### XSetPlaneMask #### #### XSetPointerMapping #### #### XSetRGBColormaps #### #### XSetRegion #### #### XSetScreenSaver #### Screen.c:1444: XSetScreenSaver(nxagentDisplay, 0, 0, DefaultExposures, DefaultBlanking); Screen.c:1693: XSetScreenSaver(nxagentDisplay, 0, 0, DefaultExposures, DefaultBlanking); Window.c:903: XSetScreenSaver(nxagentDisplay, 0, 0, DefaultExposures, DefaultBlanking); #### XSetSelectionOwner #### Clipboard.c:1049: XSetSelectionOwner(nxagentDisplay, lastSelectionOwner[i].selection, serverWindow, CurrentTime); Clipboard.c:1100: XSetSelectionOwner(nxagentDisplay, lastSelectionOwner[i].selection, serverWindow, CurrentTime); Clipboard.c:1557: XSetSelectionOwner(nxagentDisplay, serverCutProperty, iWindow, CurrentTime); Clipboard.c:1602: XSetSelectionOwner(nxagentDisplay, nxagentAtoms[10], iWindow, CurrentTime); Clipboard.c:1618: XSetSelectionOwner(nxagentDisplay, lastSelectionOwner[i].selection, iWindow, CurrentTime); Splash.c:101: XSetSelectionOwner(nxagentDisplay, nxagentWMStart, None, CurrentTime); Splash.c:396: XSetSelectionOwner(nxagentDisplay, nxagentWMStart, Splash.c:414: XSetSelectionOwner(nxagentDisplay, serverCutProperty, Window.c:2566: XSetSelectionOwner(nxagentDisplay, serverCutProperty, #### XSetSizeHints #### #### XSetStandardColormap #### #### XSetStandardProperties #### Screen.c:1871: XSetStandardProperties(nxagentDisplay, #### XSetState #### #### XSetStipple #### #### XSetSubwindowMode #### #### XSetTSOrigin #### #### XSetTextProperty #### #### XSetTile #### #### XSetTransientForHint #### #### XSetWMClientMachine #### #### XSetWMColormapWindows #### Colormap.c:270: XSetWMColormapWindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], Colormap.c:275: XSetWMColormapWindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], Colormap.c:334: XSetWMColormapWindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], Colormap.c:339: XSetWMColormapWindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], #### XSetWMHints #### Screen.c:1890: XSetWMHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &wmHints); #### XSetWMIconName #### #### XSetWMName #### #### XSetWMNormalHints #### Events.c:599: XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], Events.c:620: XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], Events.c:664: XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], Screen.c:2399: XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &sizeHints); Screen.c:4400: XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[screen], &sizeHints); Screen.c:4422: XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &sizeHints); Window.c:3099: XSetWMNormalHints(nxagentDisplay, #### XSetWMProperties #### Screen.c:427: XSetWMProperties(nxagentDisplay, w, #### XSetWMProtocols #### Screen.c:448: XSetWMProtocols(nxagentDisplay, w, &deleteWMAtom, 1); Screen.c:1964: XSetWMProtocols(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &deleteWMatom, 1); Screen.c:1974: XSetWMProtocols(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &deleteWMatom, 1); Window.c:453: XSetWMProtocols(nxagentDisplay, nxagentWindowPriv(pWin)->window, &atom, 1); Window.c:3014: XSetWMProtocols(nxagentDisplay, nxagentWindow(pWin), &atom, 1); #### XSetWMSizeHints #### #### XSetWindowBackground #### Splash.c:379: XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo); #### XSetWindowBackgroundPixmap #### Splash.c:379: XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo); #### XSetWindowBorder #### #### XSetWindowBorderPixmap #### #### XSetWindowBorderWidth #### #### XSetWindowColormap #### Colormap.c:305: XSetWindowColormap(nxagentDisplay, #### XSetZoomHints #### #### XShrinkRegion #### #### XStoreBuffer #### #### XStoreBytes #### #### XStoreColor #### Colormap.c:458: XStoreColors(nxagentDisplay, nxagentColormap(pCmap), pColors64, nColors); Colormap.c:462: XStoreColors(nxagentDisplay, nxagentColormap(pCmap), #### XStoreColors #### Colormap.c:458: XStoreColors(nxagentDisplay, nxagentColormap(pCmap), pColors64, nColors); Colormap.c:462: XStoreColors(nxagentDisplay, nxagentColormap(pCmap), #### XStoreName #### #### XStoreNamedColor #### #### XStringListToTextProperty #### Screen.c:409: XStringListToTextProperty(&window_name, 1, &windowName); #### XStringToKeysym #### Keystroke.c:200: new.keysym = XStringToKeysym((char *)attr->children->content); #### XSubImage #### #### XSubtractRegion #### #### XSupportsLocale #### #### XSync #### Atoms.c:168: XSync(nxagentDisplay, 0); Atoms.c:261: XSync(nxagentDisplay, 0); Display.c:1234: XSynchronize(nxagentDisplay, True); Display.c:2991: XSync(nxagentDisplay, 0); Events.c:3370: XSync(nxagentDisplay, 0); GC.c:1156: XSync(nxagentDisplay, 0); Handlers.c:1254: XSync(nxagentDisplay, 0); Render.c:540: XSync(nxagentDisplay, 0); Render.c:607: XSync(nxagentDisplay, 0); Render.c:666: XSync(nxagentDisplay, 0); Render.c:699: XSync(nxagentDisplay, 0); Render.c:745: XSync(nxagentDisplay, 0); Render.c:991: XSync(nxagentDisplay, 0); Render.c:1155: XSync(nxagentDisplay, 0); Render.c:1653: XSync(nxagentDisplay, 0); Render.c:1827: XSync(nxagentDisplay, 0); Render.c:1913: XSync(nxagentDisplay, 0); Render.c:1991: XSync(nxagentDisplay, 0); Render.c:2069: XSync(nxagentDisplay, 0); Render.c:2090: XSync(nxagentDisplay, 0); Render.c:2098: XSync(nxagentDisplay, 0); Render.c:2172: XSync(nxagentDisplay, 0); Render.c:2300: XSync(nxagentDisplay, 0); Render.c:2537: XSync(nxagentDisplay, 0); Render.c:2694: XSync(nxagentDisplay, 0); Render.c:2834: XSync(nxagentDisplay, 0); Render.c:2902: XSync(nxagentDisplay, 0); Render.c:2975: XSync(nxagentDisplay, 0); Render.c:3038: XSync(nxagentDisplay, 0); Screen.c:348: XSync(nxagentDisplay, 0); Screen.c:4565: XSync(shadow, 0); Window.c:107:#define MAKE_SYNC_CONFIGURE_WINDOW XSync(nxagentDisplay, 0) Window.c:842: XSync(nxagentDisplay, 0); Window.c:2717: XSync(nxagentDisplay, 0); Window.c:2756: XSync(nxagentDisplay, 0); Window.c:2773: XSync(nxagentDisplay, 0); #### XSynchronize #### Display.c:1234: XSynchronize(nxagentDisplay, True); #### XTextExtents16 #### #### XTextExtents #### #### XTextPropertyToStringList #### #### XTextWidth16 #### GCOps.c:1875: width = XTextWidth16(nxagentFontStruct(pGC->font), (XChar2b *)string, count); #### XTextWidth #### GCOps.c:1802: width = XTextWidth(nxagentFontStruct(pGC->font), string, count); GCOps.c:1875: width = XTextWidth16(nxagentFontStruct(pGC->font), (XChar2b *)string, count); #### XTranslateCoordinates #### Events.c:3623: XTranslateCoordinates(nxagentDisplay, X -> xreparent.window, #### XUndefineCursor #### #### XUngrabButton #### #### XUngrabKey #### Events.c:3928: XUngrabKeyboard(nxagentDisplay, now); #### XUngrabKeyboard #### Events.c:3928: XUngrabKeyboard(nxagentDisplay, now); #### XUngrabPointer #### Events.c:1325: XUngrabPointer(nxagentDisplay, CurrentTime); Events.c:3934: XUngrabPointer(nxagentDisplay, now); NXevents.c:250: XUngrabPointer(nxagentDisplay, CurrentTime); #### XUngrabServer #### #### XUninstallColormap #### Colormap.c:381: XUninstallColormap(nxagentDisplay, nxagentColormap(pCmap)); #### XUnionRectWithRegion #### Render.c:724: XUnionRectWithRegion(&rectangle, reg, reg); Window.c:2356: XUnionRectWithRegion(&rect, reg, reg); Window.c:2416: XUnionRectWithRegion(&rect, reg, reg); #### XUnionRegion #### #### XUnloadFont #### #### XUnlockDisplay #### #### XUnmapSubwindows #### #### XUnmapWindow #### Screen.c:296: XUnmapWindow(nxagentDisplay, nxagentFullscreenWindow); Screen.c:315: XUnmapWindow(nxagentDisplay, nxagentIconWindow); Screen.c:322: XUnmapWindow(nxagentDisplay, nxagentIconWindow); Window.c:807: XUnmapWindow(nxagentDisplay, w); Window.c:1948: XUnmapWindow(nxagentDisplay, nxagentWindow(pWin)); Window.c:2488: XUnmapWindow(nxagentDisplay, nxagentDefaultWindows[i]); #### XUnregisterIMInstantiateCallback #### #### XUnsetICFocus #### #### XVaCreateNestedList #### #### XVendorRelease #### #### XVisualIDFromVisual #### Display.c:1543: vi.visualid = XVisualIDFromVisual(DefaultVisual(nxagentDisplay, #### XWMGeometry #### #### XWarpPointer #### #### XWhitePixel #### #### XWhitePixelOfScreen #### #### XWidthMMOfScreen #### #### XWidthOfScreen #### #### XWindowEvent #### #### XWithdrawWindow #### #### XWriteBitmapFile #### #### XXorRegion #### #### XauDisposeAuth #### #### XauFileName #### #### XauGetBestAuthByAddr #### #### XauReadAuth #### #### XcmsAddColorSpace #### #### XcmsAddFunctionSet #### #### XcmsAllocColor #### #### XcmsAllocNamedColor #### #### XcmsCCCOfColormap #### #### XcmsCIELabClipL #### #### XcmsCIELabClipLab #### #### XcmsCIELabClipab #### #### XcmsCIELabColorSpace #### #### XcmsCIELabQueryMaxC #### #### XcmsCIELabQueryMaxL #### #### XcmsCIELabQueryMaxLC #### #### XcmsCIELabQueryMinL #### #### XcmsCIELabToCIEXYZ #### #### XcmsCIELabWhiteShiftColors #### #### XcmsCIELuvClipL #### #### XcmsCIELuvClipLuv #### #### XcmsCIELuvClipuv #### #### XcmsCIELuvColorSpace #### #### XcmsCIELuvQueryMaxC #### #### XcmsCIELuvQueryMaxL #### #### XcmsCIELuvQueryMaxLC #### #### XcmsCIELuvQueryMinL #### #### XcmsCIELuvToCIEuvY #### #### XcmsCIELuvWhiteShiftColors #### #### XcmsCIEXYZColorSpace #### #### XcmsCIEXYZToCIELab #### #### XcmsCIEXYZToCIEuvY #### #### XcmsCIEXYZToCIExyY #### #### XcmsCIEXYZToRGBi #### #### XcmsCIEuvYColorSpace #### #### XcmsCIEuvYToCIELuv #### #### XcmsCIEuvYToCIEXYZ #### #### XcmsCIEuvYToTekHVC #### #### XcmsCIExyYColorSpace #### #### XcmsCIExyYToCIEXYZ #### #### XcmsClientWhitePointOfCCC #### #### XcmsConvertColors #### #### XcmsCreateCCC #### #### XcmsDefaultCCC #### #### XcmsDisplayOfCCC #### #### XcmsFormatOfPrefix #### #### XcmsFreeCCC #### #### XcmsLinearRGBFunctionSet #### #### XcmsLookupColor #### #### XcmsPrefixOfFormat #### #### XcmsQueryBlack #### #### XcmsQueryBlue #### #### XcmsQueryColor #### #### XcmsQueryColors #### #### XcmsQueryGreen #### #### XcmsQueryRed #### #### XcmsQueryWhite #### #### XcmsRGBColorSpace #### #### XcmsRGBToRGBi #### #### XcmsRGBiColorSpace #### #### XcmsRGBiToCIEXYZ #### #### XcmsRGBiToRGB #### #### XcmsScreenNumberOfCCC #### #### XcmsScreenWhitePointOfCCC #### #### XcmsSetCCCOfColormap #### #### XcmsSetCompressionProc #### #### XcmsSetWhiteAdjustProc #### #### XcmsSetWhitePoint #### #### XcmsStoreColor #### #### XcmsStoreColors #### #### XcmsTekHVCClipC #### #### XcmsTekHVCClipV #### #### XcmsTekHVCClipVC #### #### XcmsTekHVCColorSpace #### #### XcmsTekHVCQueryMaxC #### #### XcmsTekHVCQueryMaxV #### #### XcmsTekHVCQueryMaxVC #### #### XcmsTekHVCQueryMaxVSamples #### #### XcmsTekHVCQueryMinV #### #### XcmsTekHVCToCIEuvY #### #### XcmsTekHVCWhiteShiftColors #### #### XcmsUNDEFINEDColorSpace #### #### XcmsVisualOfCCC #### #### XkbAddDeviceLedInfo #### #### XkbAddGeomColor #### #### XkbAddGeomDoodad #### #### XkbAddGeomKey #### #### XkbAddGeomKeyAlias #### #### XkbAddGeomOutline #### #### XkbAddGeomOverlay #### #### XkbAddGeomOverlayKey #### #### XkbAddGeomOverlayRow #### #### XkbAddGeomProperty #### #### XkbAddGeomRow #### #### XkbAddGeomSection #### #### XkbAddGeomShape #### #### XkbAddKeyType #### #### XkbAllocClientMap #### #### XkbAllocCompatMap #### #### XkbAllocControls #### #### XkbAllocDeviceInfo #### #### XkbAllocGeomColors #### #### XkbAllocGeomDoodads #### #### XkbAllocGeomKeyAliases #### #### XkbAllocGeomKeys #### #### XkbAllocGeomOutlines #### #### XkbAllocGeomOverlayKeys #### #### XkbAllocGeomOverlayRows #### #### XkbAllocGeomOverlays #### #### XkbAllocGeomPoints #### #### XkbAllocGeomProps #### #### XkbAllocGeomRows #### #### XkbAllocGeomSectionDoodads #### #### XkbAllocGeomSections #### #### XkbAllocGeomShapes #### #### XkbAllocGeometry #### #### XkbAllocIndicatorMaps #### #### XkbAllocKeyboard #### #### XkbAllocNames #### #### XkbAllocServerMap #### #### XkbApplyCompatMapToKey #### #### XkbApplyVirtualModChanges #### #### XkbBell #### #### XkbBellEvent #### #### XkbChangeDeviceInfo #### #### XkbChangeEnabledControls #### #### XkbChangeKeycodeRange #### #### XkbChangeMap #### #### XkbChangeNames #### #### XkbChangeTypesOfKey #### #### XkbComputeEffectiveMap #### #### XkbComputeRowBounds #### #### XkbComputeSectionBounds #### #### XkbComputeShapeBounds #### #### XkbComputeShapeTop #### #### XkbCopyKeyType #### #### XkbCopyKeyTypes #### #### XkbDeviceBell #### #### XkbDeviceBellEvent #### #### XkbFindOverlayForKey #### #### XkbForceBell #### #### XkbForceDeviceBell #### #### XkbFreeClientMap #### #### XkbFreeCompatMap #### #### XkbFreeComponentList #### #### XkbFreeControls #### #### XkbFreeDeviceInfo #### #### XkbFreeGeomColors #### #### XkbFreeGeomDoodads #### #### XkbFreeGeomKeyAliases #### #### XkbFreeGeomKeys #### #### XkbFreeGeomOutlines #### #### XkbFreeGeomOverlayKeys #### #### XkbFreeGeomOverlayRows #### #### XkbFreeGeomOverlays #### #### XkbFreeGeomPoints #### #### XkbFreeGeomProperties #### #### XkbFreeGeomRows #### #### XkbFreeGeomSections #### #### XkbFreeGeomShapes #### #### XkbFreeGeometry #### #### XkbFreeIndicatorMaps #### #### XkbFreeKeyboard #### Keyboard.c:837: XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); Keyboard.c:1128: XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); #### XkbFreeNames #### #### XkbFreeServerMap #### #### XkbGetAutoRepeatRate #### #### XkbGetAutoResetControls #### #### XkbGetCompatMap #### #### XkbGetControls #### Keyboard.c:137:extern Status XkbGetControls( Keyboard.c:1009: XkbGetControls(nxagentDisplay, XkbAllControlsMask, xkb); #### XkbGetDetectableAutoRepeat #### #### XkbGetDeviceButtonActions #### #### XkbGetDeviceInfo #### #### XkbGetDeviceInfoChanges #### #### XkbGetDeviceLedInfo #### #### XkbGetGeometry #### #### XkbGetIndicatorMap #### #### XkbGetIndicatorState #### Events.c:203: * and XkbGetIndicatorState. Events.c:3790: XkbGetIndicatorState(nxagentDisplay, XkbUseCoreKbd, &modifiers); #### XkbGetKeyActions #### #### XkbGetKeyBehaviors #### #### XkbGetKeyExplicitComponents #### #### XkbGetKeyModifierMap #### #### XkbGetKeySyms #### #### XkbGetKeyTypes #### #### XkbGetKeyVirtualModMap #### #### XkbGetKeyboard #### Keyboard.c:129:extern XkbDescPtr XkbGetKeyboard( Keyboard.c:972: xkb = XkbGetKeyboard(nxagentDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd); #### XkbGetKeyboardByName #### #### XkbGetMap #### #### XkbGetMapChanges #### #### XkbGetNamedDeviceIndicator #### #### XkbGetNamedGeometry #### #### XkbGetNamedIndicator #### #### XkbGetNames #### Keyboard.c:88:static int nxagentXkbGetNames(char **rules, char **model, char **layout, Keyboard.c:1709:static int nxagentXkbGetNames(char **rules, char **model, char **layout, Keyboard.c:1804: drulesLen = nxagentXkbGetNames(&drules, &dmodel, &dlayout, #### XkbGetPerClientControls #### #### XkbGetState #### #### XkbGetUpdatedMap #### #### XkbGetVirtualMods #### #### XkbGetXlibControls #### #### XkbIgnoreExtension #### #### XkbInitCanonicalKeyTypes #### #### XkbKeyTypesForCoreSymbols #### #### XkbKeycodeToKeysym #### #### XkbKeysymToModifiers #### #### XkbLatchGroup #### #### XkbLatchModifiers #### #### XkbLibraryVersion #### #### XkbListComponents #### #### XkbLockGroup #### #### XkbLockModifiers #### #### XkbLookupKeyBinding #### #### XkbLookupKeySym #### #### XkbNoteControlsChanges #### #### XkbNoteDeviceChanges #### #### XkbNoteMapChanges #### #### XkbNoteNameChanges #### #### XkbOpenDisplay #### #### XkbQueryExtension #### Keyboard.c:118:extern Bool XkbQueryExtension( Keyboard.c:960: if (XkbQueryExtension(nxagentDisplay, Keyboard.c:1889: result = XkbQueryExtension(nxagentDisplay, &info.Opcode, &info.EventBase, #### XkbRefreshKeyboardMapping #### #### XkbResizeDeviceButtonActions #### #### XkbResizeKeyActions #### #### XkbResizeKeySyms #### #### XkbResizeKeyType #### #### XkbSelectEventDetails #### #### XkbSelectEvents #### Events.c:3700: XkbSelectEvents(nxagentDisplay, XkbUseCoreKbd, Events.c:3721: XkbSelectEvents(nxagentDisplay, XkbUseCoreKbd, 0x0, 0x0); #### XkbSetAtomFuncs #### #### XkbSetAutoRepeatRate #### #### XkbSetAutoResetControls #### #### XkbSetCompatMap #### #### XkbSetControls #### #### XkbSetDebuggingFlags #### #### XkbSetDetectableAutoRepeat #### #### XkbSetDeviceButtonActions #### #### XkbSetDeviceInfo #### #### XkbSetDeviceLedInfo #### #### XkbSetGeometry #### #### XkbSetIgnoreLockMods #### #### XkbSetIndicatorMap #### #### XkbSetMap #### #### XkbSetNamedDeviceIndicator #### #### XkbSetNamedIndicator #### #### XkbSetNames #### #### XkbSetPerClientControls #### #### XkbSetServerInternalMods #### #### XkbSetXlibControls #### #### XkbToControl #### #### XkbTranslateKey #### #### XkbTranslateKeyCode #### #### XkbTranslateKeySym #### #### XkbUpdateActionVirtualMods #### #### XkbUpdateKeyTypeVirtualMods #### #### XkbUpdateMapFromCore #### #### XkbUseExtension #### #### XkbVirtualModsToReal #### #### XkbXlibControlsImplemented #### #### XmbDrawImageString #### #### XmbDrawString #### #### XmbDrawText #### #### XmbLookupString #### #### XmbResetIC #### #### XmbSetWMProperties #### #### XmbTextEscapement #### #### XmbTextExtents #### #### XmbTextListToTextProperty #### #### XmbTextPerCharExtents #### #### XmbTextPropertyToTextList #### Events.c:349: ret = XmbTextPropertyToTextList(nxagentDisplay, &tp, &list, &count); #### Xpermalloc #### #### XrmCombineDatabase #### #### XrmCombineFileDatabase #### #### XrmDestroyDatabase #### #### XrmEnumerateDatabase #### #### XrmGetDatabase #### #### XrmGetFileDatabase #### #### XrmGetResource #### #### XrmGetStringDatabase #### #### XrmInitialize #### #### XrmLocaleOfDatabase #### #### XrmMergeDatabases #### #### XrmParseCommand #### #### XrmPermStringToQuark #### #### XrmPutFileDatabase #### #### XrmPutLineResource #### #### XrmPutResource #### #### XrmPutStringResource #### #### XrmQGetResource #### #### XrmQGetSearchList #### #### XrmQGetSearchResource #### #### XrmQPutResource #### #### XrmQPutStringResource #### #### XrmQuarkToString #### #### XrmSetDatabase #### #### XrmStringToBindingQuarkList #### #### XrmStringToQuark #### #### XrmStringToQuarkList #### #### XrmUniqueQuark #### #### Xutf8DrawImageString #### #### Xutf8DrawString #### #### Xutf8DrawText #### #### Xutf8LookupString #### #### Xutf8ResetIC #### #### Xutf8SetWMProperties #### #### Xutf8TextEscapement #### #### Xutf8TextExtents #### #### Xutf8TextListToTextProperty #### #### Xutf8TextPerCharExtents #### #### Xutf8TextPropertyToTextList #### #### XwcDrawImageString #### #### XwcDrawString #### #### XwcDrawText #### #### XwcFreeStringList #### #### XwcLookupString #### #### XwcResetIC #### #### XwcTextEscapement #### #### XwcTextExtents #### #### XwcTextListToTextProperty #### #### XwcTextPerCharExtents #### #### XwcTextPropertyToTextList #### #### _Utf8GetConvByName #### #### _X11TransBytesReadable #### #### _X11TransClose #### #### _X11TransCloseForCloning #### #### _X11TransConnect #### #### _X11TransConnectDisplay #### #### _X11TransConvertAddress #### #### _X11TransDisconnect #### #### _X11TransFreeConnInfo #### #### _X11TransGetConnectionNumber #### #### _X11TransGetHostname #### #### _X11TransGetMyAddr #### #### _X11TransGetPeerAddr #### #### _X11TransIsLocal #### #### _X11TransOpenCOTSClient #### #### _X11TransRead #### #### _X11TransReadv #### #### _X11TransSetOption #### #### _X11TransSocketINET6Funcs #### #### _X11TransSocketINETFuncs #### #### _X11TransSocketLocalFuncs #### #### _X11TransSocketProxyConnInfo #### #### _X11TransSocketTCPFuncs #### #### _X11TransSocketUNIXFuncs #### #### _X11TransWrite #### #### _X11TransWritev #### #### _XAllocID #### #### _XAllocIDs #### #### _XAllocScratch #### #### _XAllocTemp #### #### _XAsyncErrorHandler #### #### _XCloseLC #### #### _XColor_to_XcmsRGB #### #### _XConnectDisplay #### #### _XCopyEventCookie #### #### _XCopyToArg #### #### _XCreateMutex_fn #### #### (arch=amd64 ia64 alpha ppc64 arm64)_XData32 #### #### _XDefaultError #### #### _XDefaultIOError #### #### _XDefaultWireError #### #### _XDeq #### Events.c:4206: _XDeq(nxagentDisplay, prev, qelt); Events.c:4215: _XDeq(nxagentDisplay, prevKeyRelease, qeltKeyRelease); #### _XDeqAsyncHandler #### #### _XDisconnectDisplay #### #### _XEatData #### #### _XEatDataWords #### #### _XEnq #### #### _XError #### #### _XErrorFunction #### #### _XEventToWire #### #### _XEventsQueued #### #### _XF86BigfontFreeFontMetrics #### Font.c:1723: _XF86BigfontFreeFontMetrics(fs); #### _XF86LoadQueryLocaleFont #### #### _XFetchEventCookie #### #### _XFlush #### #### _XFlushGCCache #### #### _XFreeAtomTable #### #### _XFreeDisplayLock_fn #### #### _XFreeDisplayStructure #### #### _XFreeEventCookies #### #### _XFreeExtData #### #### _XFreeMutex_fn #### #### _XFreeTemp #### #### _XGetAsyncData #### #### _XGetAsyncReply #### #### _XGetBitsPerPixel #### Args.c:122:extern int _XGetBitsPerPixel(Display *dpy, int depth); #### _XGetHostname #### #### _XGetLCValues #### #### _XGetRequest #### #### _XGetScanlinePad #### #### _XGetWindowAttributes #### #### _XHeadOfDisplayList #### #### _XIMCompileResourceList #### #### _XIOError #### #### _XIOErrorFunction #### #### _XInitDisplayLock_fn #### #### _XInitIM #### #### _XInitImageFuncPtrs #### #### _XInitKeysymDB #### #### _XInitOM #### #### _XIsEventCookie #### #### _XKeyInitialize #### #### _XKeycodeToKeysym #### #### _XKeysymToKeycode #### #### _XKeysymToModifiers #### #### _XLockMutex_fn #### #### _XLookupKeysym #### #### _XLookupString #### #### _XNoticeCreateBitmap #### #### _XNoticePutBitmap #### #### _XOpenLC #### #### _XParseBaseFontNameList #### #### _XPollfdCacheAdd #### #### _XPollfdCacheDel #### #### _XPollfdCacheInit #### #### _XProcessInternalConnection #### #### _XProcessWindowAttributes #### #### _XPutBackEvent #### #### (arch=amd64 ia64 alpha ppc64 arm64)_XRead32 #### #### _XRead #### #### _XReadEvents #### #### _XReadPad #### #### _XRefreshKeyboardMapping #### #### _XRegisterFilterByMask #### #### _XRegisterFilterByType #### #### _XRegisterInternalConnection #### #### _XReply #### #### _XReverse_Bytes #### #### _XScreenOfWindow #### #### _XSelect #### #### _XSend #### #### _XSendClientPrefix #### #### _XSetClipRectangles #### #### _XSetImage #### #### _XSetLastRequestRead #### #### _XStoreEventCookie #### #### _XTextHeight16 #### #### _XTextHeight #### #### _XTranslateKey #### #### _XTranslateKeySym #### #### _XTryShapeBitmapCursor #### #### _XUnknownCopyEventCookie #### #### _XUnknownNativeEvent #### #### _XUnknownWireEvent #### #### _XUnknownWireEventCookie #### #### _XUnlockMutex_fn #### #### _XUnregisterFilter #### #### _XUnregisterInternalConnection #### #### _XUnresolveColor #### #### _XUpdateAtomCache #### #### _XUpdateGCCache #### #### _XVIDtoVisual #### #### _XWireToEvent #### #### _XcmsAddCmapRec #### #### _XcmsArcTangent #### #### _XcmsCIELabQueryMaxLCRGB #### #### _XcmsCIELab_prefix #### #### _XcmsCIELuvQueryMaxLCRGB #### #### _XcmsCIELuv_prefix #### #### _XcmsCIEXYZ_ValidSpec #### #### _XcmsCIEXYZ_prefix #### #### _XcmsCIEuvY_ValidSpec #### #### _XcmsCIEuvY_prefix #### #### _XcmsCIExyY_prefix #### #### _XcmsConvertColorsWithWhitePt #### #### _XcmsCopyCmapRecAndFree #### #### _XcmsCopyISOLatin1Lowered #### #### _XcmsCopyPointerArray #### #### _XcmsCosine #### #### _XcmsCubeRoot #### #### _XcmsDDColorSpaces #### #### _XcmsDDColorSpacesInit #### #### _XcmsDDConvertColors #### #### _XcmsDIColorSpaces #### #### _XcmsDIColorSpacesInit #### #### _XcmsDIConvertColors #### #### _XcmsDeleteCmapRec #### #### _XcmsEqualWhitePts #### #### _XcmsFreeIntensityMaps #### #### _XcmsFreePointerArray #### #### _XcmsGetElement #### #### _XcmsGetIntensityMap #### #### _XcmsGetProperty #### #### _XcmsInitDefaultCCCs #### #### _XcmsInitScrnInfo #### #### _XcmsLRGB_InitScrnDefault #### #### _XcmsPushPointerArray #### #### _XcmsRGB_prefix #### #### _XcmsRGB_to_XColor #### #### _XcmsRGBi_prefix #### #### _XcmsRegColorSpaces #### #### _XcmsRegFormatOfPrefix #### #### _XcmsResolveColor #### #### _XcmsResolveColorString #### #### _XcmsSCCFuncSets #### #### _XcmsSCCFuncSetsInit #### #### _XcmsSetGetColor #### #### _XcmsSetGetColors #### #### _XcmsSine #### #### _XcmsSquareRoot #### #### _XcmsTekHVCQueryMaxVCRGB #### #### _XcmsTekHVC_CheckModify #### #### _XcmsTekHVC_prefix #### #### _XcmsUnresolveColor #### #### _Xdebug #### #### _Xevent_to_mask #### #### _Xglobal_lock #### #### _Xi18n_lock #### #### _XimCbDispatch #### #### _XimCheckCreateICValues #### #### _XimCheckDataSize #### #### _XimCheckICMode #### #### _XimCheckIMMode #### #### _XimCheckIfLocalProcessing #### #### _XimCheckIfThaiProcessing #### #### _XimCheckLocalInputStyle #### #### _XimCommitCallback #### #### _XimConnect #### #### _XimDecodeICATTRIBUTE #### #### _XimDecodeIMATTRIBUTE #### #### _XimDecodeLocalICAttr #### #### _XimDecodeLocalIMAttr #### #### _XimDestroyIMStructureList #### #### _XimDispatchInit #### #### _XimEncodeICATTRIBUTE #### #### _XimEncodeIMATTRIBUTE #### #### _XimEncodeLocalICAttr #### #### _XimEncodeLocalIMAttr #### #### _XimError #### #### _XimErrorCallback #### #### _XimExtension #### #### _XimFilterWaitEvent #### #### _XimFlush #### #### _XimForwardEvent #### #### _XimForwardEventCallback #### #### _XimFreeCommitInfo #### #### _XimFreeProtoIntrCallback #### #### _XimFreeTransIntrCallback #### #### _XimGetAttributeID #### #### _XimGetCharCode #### #### _XimGetCurrentICValues #### #### _XimGetCurrentIMValues #### #### _XimGetICValueData #### #### _XimGetIMValueData #### #### _XimGetLocaleCode #### #### _XimGetMyEndian #### #### _XimGetResourceListRec #### #### _XimGetResourceListRecByQuark #### #### _XimGetWindowEventmask #### #### _XimICOfXICID #### #### _XimImSportRec #### #### _XimInitialResourceInfo #### #### _XimLcctstombs #### #### _XimLcctstoutf8 #### #### _XimLcctstowcs #### #### _XimLocalCreateIC #### #### _XimLocalFilter #### #### _XimLocalGetICValues #### #### _XimLocalGetIMValues #### #### _XimLocalIMFree #### #### _XimLocalMbLookupString #### #### _XimLocalOpenIM #### #### _XimLocalSetICValues #### #### _XimLocalSetIMValues #### #### _XimLocalUtf8LookupString #### #### _XimLocalWcLookupString #### #### _XimLookupMBText #### #### _XimLookupUTF8Text #### #### _XimLookupWCText #### #### _XimMakeICAttrIDList #### #### _XimMakeIMAttrIDList #### #### _XimOpenIM #### #### _XimParseStringFile #### #### _XimProcError #### #### _XimProcSyncReply #### #### _XimProtoCreateIC #### #### _XimProtoEventToWire #### #### _XimProtoIMFree #### #### _XimProtoMbLookupString #### #### _XimProtoOpenIM #### #### _XimProtoUtf8LookupString #### #### _XimProtoWcLookupString #### #### _XimProtoWireToEvent #### #### _XimRead #### #### _XimRegProtoIntrCallback #### #### _XimRegisterDispatcher #### #### _XimRegisterFilter #### #### _XimRegisterIMInstantiateCallback #### #### _XimRegisterServerFilter #### #### _XimRegisterTriggerKeysCallback #### #### _XimReregisterFilter #### #### _XimResetIMInstantiateCallback #### #### _XimRespSyncReply #### #### _XimServerDestroy #### #### _XimSetCurrentICValues #### #### _XimSetCurrentIMValues #### #### _XimSetEventMaskCallback #### #### _XimSetHeader #### #### _XimSetICDefaults #### #### _XimSetICMode #### #### _XimSetICResourceList #### #### _XimSetICValueData #### #### _XimSetIMMode #### #### _XimSetIMResourceList #### #### _XimSetIMValueData #### #### _XimSetInnerICResourceList #### #### _XimSetInnerIMResourceList #### #### _XimSetLocalIMDefaults #### #### _XimShutdown #### #### _XimSync #### #### _XimSyncCallback #### #### _XimThaiCloseIM #### #### _XimThaiCreateIC #### #### _XimThaiFilter #### #### _XimThaiIMFree #### #### _XimThaiOpenIM #### #### _XimTransCallDispatcher #### #### _XimTransConf #### #### _XimTransFilterWaitEvent #### #### _XimTransFlush #### #### _XimTransInternalConnection #### #### _XimTransRead #### #### _XimTransRegisterDispatcher #### #### _XimTransWrite #### #### _XimTransportRec #### #### _XimTriggerNotify #### #### _XimUnRegisterIMInstantiateCallback #### #### _XimUnregisterFilter #### #### _XimUnregisterServerFilter #### #### _XimWrite #### #### _XimXConf #### #### _XimXTransBytesReadable #### #### _XimXTransClose #### #### _XimXTransCloseForCloning #### #### _XimXTransConnect #### #### _XimXTransDisconnect #### #### _XimXTransFreeConnInfo #### #### _XimXTransGetConnectionNumber #### #### _XimXTransGetHostname #### #### _XimXTransGetPeerAddr #### #### _XimXTransIsLocal #### #### _XimXTransOpenCOTSClient #### #### _XimXTransRead #### #### _XimXTransReadv #### #### _XimXTransSetOption #### #### _XimXTransSocketINET6Funcs #### #### _XimXTransSocketINETFuncs #### #### _XimXTransSocketLocalFuncs #### #### _XimXTransSocketTCPFuncs #### #### _XimXTransSocketUNIXFuncs #### #### _XimXTransWrite #### #### _XimXTransWritev #### #### _Ximctstombs #### #### _Ximctstoutf8 #### #### _Ximctstowcs #### #### _XkbCopyFromReadBuffer #### #### _XkbFreeReadBuffer #### #### _XkbGetAtomNameFunc #### #### _XkbGetCharset #### #### _XkbGetConverters #### #### _XkbGetReadBufferCountedString #### #### _XkbGetReadBufferPtr #### #### _XkbInitReadBuffer #### #### _XkbInternAtomFunc #### #### _XkbNoteCoreMapChanges #### #### _XkbPeekAtReadBuffer #### #### (arch=amd64 ia64 alpha ppc64 arm64)_XkbReadBufferCopy32 #### #### _XkbReadBufferCopyKeySyms #### #### (arch=amd64 ia64 alpha ppc64 arm64)_XkbReadCopyData32 #### #### _XkbReadCopyKeySyms #### #### _XkbReadGetCompatMapReply #### #### _XkbReadGetGeometryReply #### #### _XkbReadGetIndicatorMapReply #### #### _XkbReadGetMapReply #### #### _XkbReadGetNamesReply #### #### _XkbReloadDpy #### #### _XkbSkipReadBufferData #### #### (arch=amd64 ia64 alpha ppc64 arm64)_XkbWriteCopyData32 #### #### _XkbWriteCopyKeySyms #### #### _XkeyTable #### #### _XlcAddCT #### #### _XlcAddCharSet #### #### _XlcAddGB18030LocaleConverters #### #### _XlcAddLoader #### #### _XlcAddUtf8Converters #### #### _XlcAddUtf8LocaleConverters #### #### _XlcCloseConverter #### #### _XlcCompareISOLatin1 #### #### _XlcCompileResourceList #### #### _XlcConvert #### #### _XlcCopyFromArg #### #### _XlcCopyToArg #### #### _XlcCountVaList #### #### _XlcCreateDefaultCharSet #### #### _XlcCreateLC #### #### _XlcCreateLocaleDataBase #### #### _XlcCurrentLC #### #### _XlcDbg_printValue #### #### _XlcDeInitLoader #### #### _XlcDefaultLoader #### #### _XlcDefaultMapModifiers #### #### _XlcDestroyLC #### #### _XlcDestroyLocaleDataBase #### #### _XlcFileName #### #### _XlcGenericLoader #### #### _XlcGenericMethods #### #### _XlcGetCSValues #### #### _XlcGetCharSet #### #### _XlcGetCharSetWithSide #### #### _XlcGetLocaleDataBase #### #### _XlcGetResource #### #### _XlcGetValues #### #### _XlcInitCTInfo #### #### _XlcInitLoader #### #### _XlcLocaleDirName #### #### _XlcLocaleLibDirName #### #### _XlcMapOSLocaleName #### #### _XlcNCompareISOLatin1 #### #### _XlcOpenConverter #### #### _XlcParseCharSet #### #### _XlcParse_scopemaps #### #### _XlcPublicMethods #### #### _XlcRemoveLoader #### #### _XlcResetConverter #### #### _XlcResolveI18NPath #### #### _XlcResolveLocaleName #### #### _XlcSetConverter #### #### _XlcSetValues #### #### _XlcUtf8Loader #### #### _XlcVaToArgList #### #### _XlcValidModSyntax #### #### _Xlcmbstoutf8 #### #### _Xlcmbstowcs #### #### _Xlcmbtowc #### #### _Xlcwcstombs #### #### _Xlcwctomb #### #### _XmbDefaultDrawImageString #### #### _XmbDefaultDrawString #### #### _XmbDefaultTextEscapement #### #### _XmbDefaultTextExtents #### #### _XmbDefaultTextPerCharExtents #### #### _XmbGenericDrawImageString #### #### _XmbGenericDrawString #### #### _XmbGenericTextEscapement #### #### _XmbGenericTextExtents #### #### _XmbGenericTextPerCharExtents #### #### _XmbTextListToTextProperty #### #### _XmbTextPropertyToTextList #### #### _Xmblen #### #### _Xmbstoutf8 #### #### _Xmbstowcs #### #### _Xmbtowc #### #### _XomConvert #### #### _XomGenericDrawString #### #### _XomGenericOpenOM #### #### _XomGenericTextExtents #### #### _XomGetFontDataFromFontSet #### #### _XomInitConverter #### #### _XrmDefaultInitParseInfo #### #### _XrmInitParseInfo #### #### _XrmInternalStringToQuark #### #### _Xthread_self_fn #### #### _Xutf8DefaultDrawImageString #### #### _Xutf8DefaultDrawString #### #### _Xutf8DefaultTextEscapement #### #### _Xutf8DefaultTextExtents #### #### _Xutf8DefaultTextPerCharExtents #### #### _Xutf8GenericDrawImageString #### #### _Xutf8GenericDrawString #### #### _Xutf8GenericTextEscapement #### #### _Xutf8GenericTextExtents #### #### _Xutf8GenericTextPerCharExtents #### #### _Xutf8TextListToTextProperty #### #### _Xutf8TextPropertyToTextList #### #### _XwcDefaultDrawImageString #### #### _XwcDefaultDrawString #### #### _XwcDefaultTextEscapement #### #### _XwcDefaultTextExtents #### #### _XwcDefaultTextPerCharExtents #### #### _XwcFreeStringList #### #### _XwcGenericDrawImageString #### #### _XwcGenericDrawString #### #### _XwcGenericTextEscapement #### #### _XwcGenericTextExtents #### #### _XwcGenericTextPerCharExtents #### #### _XwcTextListToTextProperty #### #### _XwcTextPropertyToTextList #### #### _Xwcscmp #### #### _Xwcscpy #### #### _Xwcslen #### #### _Xwcsncmp #### #### _Xwcsncpy #### #### _Xwcstombs #### #### _Xwctomb #### #### _qfree #### #### read_EncodingInfo #### #### xlocaledir #### nx-libs-3.5.99.23/doc/libNX_X11/symbols/libNX_X11::symbol-usage_nxcompext.txt0000644000000000000000000012335713614532331023253 0ustar #### KeySymToUcs4 #### #### XActivateScreenSaver #### #### XAddConnectionWatch #### #### XAddExtension #### #### XAddHost #### #### XAddHosts #### #### XAddPixel #### #### XAddToExtensionList #### #### XAddToSaveSet #### #### XAllPlanes #### #### XAllocClassHint #### #### XAllocColor #### Compext.c:2574:int NXAllocColors(Display *dpy, Colormap colormap, unsigned int entries, Compext.h:668:extern int NXAllocColors( #### XAllocColorCells #### #### XAllocColorPlanes #### #### XAllocIconSize #### #### XAllocNamedColor #### #### XAllocSizeHints #### #### XAllocStandardColormap #### #### XAllocWMHints #### #### XAllowEvents #### #### XAutoRepeatOff #### #### XAutoRepeatOn #### #### XBaseFontNameListOfFontSet #### #### XBell #### #### XBitmapBitOrder #### #### XBitmapPad #### #### XBitmapUnit #### #### XBlackPixel #### #### XBlackPixelOfScreen #### #### XCellsOfScreen #### #### XChangeActivePointerGrab #### #### XChangeGC #### #### XChangeKeyboardControl #### #### XChangeKeyboardMapping #### #### XChangePointerControl #### #### XChangeProperty #### #### XChangeSaveSet #### #### XChangeWindowAttributes #### #### XCheckIfEvent #### #### XCheckIfEventNoFlush #### #### XCheckMaskEvent #### #### XCheckTypedEvent #### #### XCheckTypedWindowEvent #### #### XCheckWindowEvent #### #### XCirculateSubwindows #### #### XCirculateSubwindowsDown #### #### XCirculateSubwindowsUp #### #### XClearArea #### #### XClearWindow #### #### XClipBox #### #### XCloseDisplay #### #### XCloseIM #### #### XCloseOM #### #### XConfigureWindow #### #### XConnectionNumber #### #### XContextDependentDrawing #### #### XContextualDrawing #### #### XConvertCase #### #### XConvertSelection #### #### XCopyArea #### #### XCopyColormapAndFree #### #### XCopyGC #### #### XCopyPlane #### #### XCreateBitmapFromData #### #### XCreateColormap #### #### XCreateFontCursor #### #### XCreateFontSet #### #### XCreateGC #### #### XCreateGlyphCursor #### #### XCreateIC #### #### XCreateImage #### Compext.c:2044: * Wrapper of XCreateImage(). Note that we use offset Compext.c:2058: image = XCreateImage(dpy, visual, depth, format, 0, data, Compext.c:3603: state -> image = XCreateImage(dpy, _XVIDtoVisual(dpy, async_rep -> visual), Compext.c:3609: state -> image = XCreateImage(dpy, _XVIDtoVisual(dpy, async_rep -> visual), #### XCreateOC #### #### XCreatePixmap #### #### XCreatePixmapCursor #### #### XCreatePixmapFromBitmapData #### #### XCreateRegion #### #### XCreateSimpleWindow #### #### XCreateWindow #### #### XDefaultColormap #### #### XDefaultColormapOfScreen #### #### XDefaultDepth #### #### XDefaultDepthOfScreen #### #### XDefaultGC #### #### XDefaultGCOfScreen #### #### XDefaultRootWindow #### #### XDefaultScreen #### #### XDefaultScreenOfDisplay #### #### XDefaultString #### #### XDefaultVisual #### #### XDefaultVisualOfScreen #### #### XDefineCursor #### #### XDeleteContext #### #### XDeleteModifiermapEntry #### #### XDeleteProperty #### #### XDestroyIC #### #### XDestroyImage #### Compext.c:347: XDestroyImage(_NXCollectedImages[i] -> image); Compext.c:2070: * Wrapper of XDestroyImage(). Compext.c:2075: return XDestroyImage((XImage *) image); Compext.c:3705: XDestroyImage(state -> image); #### XDestroyOC #### #### XDestroyRegion #### #### XDestroySubwindows #### #### XDestroyWindow #### #### XDirectionalDependentDrawing #### #### XDisableAccessControl #### #### XDisplayCells #### #### XDisplayHeight #### #### XDisplayHeightMM #### #### XDisplayKeycodes #### #### XDisplayMotionBufferSize #### #### XDisplayName #### #### XDisplayOfIM #### #### XDisplayOfOM #### #### XDisplayOfScreen #### #### XDisplayPlanes #### #### XDisplayString #### #### XDisplayWidth #### #### XDisplayWidthMM #### #### XDoesBackingStore #### #### XDoesSaveUnders #### #### XDrawArc #### #### XDrawArcs #### #### XDrawImageString16 #### #### XDrawImageString #### #### XDrawLine #### #### XDrawLines #### #### XDrawPoint #### #### XDrawPoints #### #### XDrawRectangle #### #### XDrawRectangles #### #### XDrawSegments #### #### XDrawString16 #### #### XDrawString #### #### XDrawText16 #### #### XDrawText #### #### XEHeadOfExtensionList #### #### XESetBeforeFlush #### #### XESetCloseDisplay #### #### XESetCopyEventCookie #### #### XESetCopyGC #### #### XESetCreateFont #### #### XESetCreateGC #### #### XESetError #### #### XESetErrorString #### #### XESetEventToWire #### #### XESetFlushGC #### #### XESetFreeFont #### #### XESetFreeGC #### #### XESetPrintErrorValues #### #### XESetWireToError #### #### XESetWireToEvent #### #### XESetWireToEventCookie #### #### XEmptyRegion #### #### XEnableAccessControl #### #### XEqualRegion #### #### XEventMaskOfScreen #### #### XEventsQueued #### #### XExtendedMaxRequestSize #### #### XExtentsOfFontSet #### #### XFetchBuffer #### #### XFetchBytes #### #### XFetchName #### #### XFillArc #### #### XFillArcs #### #### XFillPolygon #### #### XFillRectangle #### #### XFillRectangles #### #### XFilterEvent #### #### XFindContext #### #### XFindOnExtensionList #### #### XFlush #### Compext.c:457: XFlush(dpy); Compext.c:663:int NXFlushDisplay(Display *dpy, int what) Compext.c:669: fprintf(stderr, "******NXFlushDisplay: Writing with [%d] bytes in the buffer.\n", Compext.c:673: XFlush(dpy); Compext.c:676: if (what == NXFlushBuffer) Compext.c:682: fprintf(stderr, "******NXFlushDisplay: Flushing with [%d] bytes in the NX transport.\n", Compext.h:90: * be either NXFlushDeferred or NXFlushImmediate. Compext.h:204:extern int NXFlushDisplay( #### XFlushGC #### #### XFontsOfFontSet #### #### XForceScreenSaver #### #### XFree #### Compext.c:1462:int NXFreeSplit(Display *dpy, unsigned int resource) Compext.c:1464: register xNXFreeSplitReq *req; Compext.c:1470: GetReq(NXFreeSplit, req); Compext.c:1473: fprintf(stderr, "******NXFreeSplit: Sending message opcode [%d] with resource [%u].\n", Compext.c:1474: X_NXFreeSplit, resource); Compext.c:1484: fprintf(stderr, "******NXFreeSplit: Making the resource [%u] newly available.\n", Compext.c:1493: fprintf(stderr, "******NXFreeSplit: Nothing to do for resource [%u].\n", Compext.c:2004:int NXFreeUnpack(Display *dpy, unsigned int resource) Compext.c:2006: register xNXFreeUnpackReq *req; Compext.c:2012: GetReq(NXFreeUnpack, req); Compext.c:2015: fprintf(stderr, "******NXFreeUnpack: Sending message opcode [%d] with resource [%u].\n", Compext.c:2016: X_NXFreeUnpack, resource); Compext.c:2026: fprintf(stderr, "******NXFreeUnpack: Making the resource [%u] newly available.\n", Compext.c:2035: fprintf(stderr, "******NXFreeUnpack: Nothing to do for resource [%u].\n", Compext.c:3375:void NXFreeCache(Display *dpy) Compext.c:3382: fprintf(stderr, "******NXFreeCache: Nothing to do with a null image cache.\n"); Compext.c:3389: fprintf(stderr, "******NXFreeCache: Freeing the cache with [%d] entries.\n", Compext.h:505:extern int NXFreeSplit( Compext.h:586:extern int NXFreeUnpack( Compext.h:775:extern void NXFreeCache( #### XFreeColormap #### #### XFreeColors #### #### XFreeCursor #### #### XFreeEventData #### #### XFreeExtensionList #### #### XFreeFont #### #### XFreeFontInfo #### #### XFreeFontNames #### #### XFreeFontPath #### #### XFreeFontSet #### #### XFreeGC #### #### XFreeModifiermap #### #### XFreePixmap #### #### XFreeStringList #### #### XGContextFromGC #### #### XGeometry #### #### XGetAtomName #### #### XGetAtomNames #### #### XGetClassHint #### #### XGetCommand #### #### XGetDefault #### #### XGetErrorDatabaseText #### #### XGetErrorText #### #### XGetEventData #### #### XGetFontPath #### #### XGetFontProperty #### #### XGetGCValues #### #### XGetGeometry #### #### XGetICValues #### #### XGetIMValues #### #### XGetIconName #### #### XGetIconSizes #### #### XGetImage #### #### XGetInputFocus #### #### XGetKeyboardControl #### #### XGetKeyboardMapping #### #### XGetModifierMapping #### #### XGetMotionEvents #### #### XGetNormalHints #### #### XGetOCValues #### #### XGetOMValues #### #### XGetPixel #### Compext.c:2905: pixel = XGetPixel(src_image, x, y); #### XGetPointerControl #### #### XGetPointerMapping #### #### XGetRGBColormaps #### #### XGetScreenSaver #### #### XGetSelectionOwner #### #### XGetSizeHints #### #### XGetStandardColormap #### #### XGetSubImage #### #### XGetTextProperty #### #### XGetTransientForHint #### #### XGetVisualInfo #### #### XGetWMClientMachine #### #### XGetWMColormapWindows #### #### XGetWMHints #### #### XGetWMIconName #### #### XGetWMName #### #### XGetWMNormalHints #### #### XGetWMProtocols #### #### XGetWMSizeHints #### #### XGetWindowAttributes #### #### XGetWindowProperty #### #### XGetZoomHints #### #### XGrabButton #### #### XGrabKey #### #### XGrabKeyboard #### #### XGrabPointer #### #### XGrabServer #### #### XHeightMMOfScreen #### #### XHeightOfScreen #### #### XIMOfIC #### #### XIconifyWindow #### #### XIfEvent #### #### XImageByteOrder #### #### XInitExtension #### #### XInitImage #### #### XInitThreads #### #### XInsertModifiermapEntry #### #### XInstallColormap #### #### XInternAtom #### #### XInternAtoms #### #### XInternalConnectionNumbers #### #### XIntersectRegion #### #### XKeycodeToKeysym #### #### XKeysymToKeycode #### #### XKeysymToString #### #### XKillClient #### #### XLastKnownRequestProcessed #### #### XListDepths #### #### XListExtensions #### #### XListFonts #### #### XListFontsWithInfo #### #### XListHosts #### #### XListInstalledColormaps #### #### XListPixmapFormats #### #### XListProperties #### #### XLoadFont #### #### XLoadQueryFont #### #### XLocaleOfFontSet #### #### XLocaleOfIM #### #### XLocaleOfOM #### #### XLockDisplay #### #### XLookupColor #### #### XLookupKeysym #### #### XLookupString #### #### XLowerWindow #### #### XMapRaised #### #### XMapSubwindows #### #### XMapWindow #### #### XMaskEvent #### #### XMatchVisualInfo #### #### XMaxCmapsOfScreen #### #### XMaxRequestSize #### #### XMinCmapsOfScreen #### #### XMoveResizeWindow #### #### XMoveWindow #### #### XNewModifiermap #### #### XNextEvent #### #### XNextRequest #### #### XNoOp #### #### XOMOfOC #### #### XOffsetRegion #### #### XOpenDisplay #### #### XOpenIM #### #### XOpenOM #### #### XParseColor #### #### XParseGeometry #### #### XPeekEvent #### #### XPeekIfEvent #### #### XPending #### #### XPlanesOfScreen #### #### XPointInRegion #### #### XPolygonRegion #### #### XProcessInternalConnection #### #### XProtocolRevision #### #### XProtocolVersion #### #### XPutBackEvent #### Compext.c:3445: XPutBackEvent(dpy, &async_event); Compext.c:3838: XPutBackEvent(dpy, &async_event); Compext.c:4208: XPutBackEvent(dpy, &async_event); Compext.c:4492: XPutBackEvent(dpy, &async_event); #### XPutImage #### #### XPutPixel #### #### XQLength #### #### XQueryBestCursor #### #### XQueryBestSize #### #### XQueryBestStipple #### #### XQueryBestTile #### #### XQueryColor #### #### XQueryColors #### #### XQueryExtension #### #### XQueryFont #### #### XQueryKeymap #### #### XQueryPointer #### #### XQueryTextExtents16 #### #### XQueryTextExtents #### #### XQueryTree #### #### XRaiseWindow #### #### XReadBitmapFile #### #### XReadBitmapFileData #### #### XRebindKeysym #### #### XRecolorCursor #### #### XReconfigureWMWindow #### #### XRectInRegion #### #### XRefreshKeyboardMapping #### #### XRegisterIMInstantiateCallback #### #### XRemoveConnectionWatch #### #### XRemoveFromSaveSet #### #### XRemoveHost #### #### XRemoveHosts #### #### XReparentWindow #### #### XResetScreenSaver #### #### XResizeWindow #### #### XResourceManagerString #### #### XRestackWindows #### #### XRootWindow #### #### XRootWindowOfScreen #### #### XRotateBuffers #### #### XRotateWindowProperties #### #### XSaveContext #### #### XScreenCount #### #### XScreenNumberOfScreen #### #### XScreenOfDisplay #### #### XScreenResourceString #### #### XSelectInput #### #### XSendEvent #### #### XServerVendor #### #### XSetAccessControl #### #### XSetAfterFunction #### #### XSetArcMode #### #### XSetAuthorization #### #### XSetBackground #### #### XSetClassHint #### #### XSetClipMask #### #### XSetClipOrigin #### #### XSetClipRectangles #### #### XSetCloseDownMode #### #### XSetCommand #### #### XSetDashes #### #### XSetErrorHandler #### #### XSetFillRule #### #### XSetFillStyle #### #### XSetFont #### #### XSetFontPath #### #### XSetForeground #### #### XSetFunction #### #### XSetGraphicsExposures #### #### XSetICFocus #### #### XSetICValues #### #### XSetIMValues #### #### XSetIOErrorHandler #### #### XSetIconName #### #### XSetIconSizes #### #### XSetInputFocus #### #### XSetLineAttributes #### #### XSetLocaleModifiers #### #### XSetModifierMapping #### #### XSetNormalHints #### #### XSetOCValues #### #### XSetOMValues #### #### XSetPlaneMask #### #### XSetPointerMapping #### #### XSetRGBColormaps #### #### XSetRegion #### #### XSetScreenSaver #### #### XSetSelectionOwner #### #### XSetSizeHints #### #### XSetStandardColormap #### #### XSetStandardProperties #### #### XSetState #### #### XSetStipple #### #### XSetSubwindowMode #### #### XSetTSOrigin #### #### XSetTextProperty #### #### XSetTile #### #### XSetTransientForHint #### #### XSetWMClientMachine #### #### XSetWMColormapWindows #### #### XSetWMHints #### #### XSetWMIconName #### #### XSetWMName #### #### XSetWMNormalHints #### #### XSetWMProperties #### #### XSetWMProtocols #### #### XSetWMSizeHints #### #### XSetWindowBackground #### #### XSetWindowBackgroundPixmap #### #### XSetWindowBorder #### #### XSetWindowBorderPixmap #### #### XSetWindowBorderWidth #### #### XSetWindowColormap #### #### XSetZoomHints #### #### XShrinkRegion #### #### XStoreBuffer #### #### XStoreBytes #### #### XStoreColor #### #### XStoreColors #### #### XStoreName #### #### XStoreNamedColor #### #### XStringListToTextProperty #### #### XStringToKeysym #### #### XSubImage #### #### XSubtractRegion #### #### XSupportsLocale #### #### XSync #### #### XSynchronize #### #### XTextExtents16 #### #### XTextExtents #### #### XTextPropertyToStringList #### #### XTextWidth16 #### #### XTextWidth #### #### XTranslateCoordinates #### #### XUndefineCursor #### #### XUngrabButton #### #### XUngrabKey #### #### XUngrabKeyboard #### #### XUngrabPointer #### #### XUngrabServer #### #### XUninstallColormap #### #### XUnionRectWithRegion #### #### XUnionRegion #### #### XUnloadFont #### #### XUnlockDisplay #### #### XUnmapSubwindows #### #### XUnmapWindow #### #### XUnregisterIMInstantiateCallback #### #### XUnsetICFocus #### #### XVaCreateNestedList #### #### XVendorRelease #### #### XVisualIDFromVisual #### #### XWMGeometry #### #### XWarpPointer #### #### XWhitePixel #### #### XWhitePixelOfScreen #### #### XWidthMMOfScreen #### #### XWidthOfScreen #### #### XWindowEvent #### #### XWithdrawWindow #### #### XWriteBitmapFile #### #### XXorRegion #### #### XauDisposeAuth #### #### XauFileName #### #### XauGetBestAuthByAddr #### #### XauReadAuth #### #### XcmsAddColorSpace #### #### XcmsAddFunctionSet #### #### XcmsAllocColor #### #### XcmsAllocNamedColor #### #### XcmsCCCOfColormap #### #### XcmsCIELabClipL #### #### XcmsCIELabClipLab #### #### XcmsCIELabClipab #### #### XcmsCIELabColorSpace #### #### XcmsCIELabQueryMaxC #### #### XcmsCIELabQueryMaxL #### #### XcmsCIELabQueryMaxLC #### #### XcmsCIELabQueryMinL #### #### XcmsCIELabToCIEXYZ #### #### XcmsCIELabWhiteShiftColors #### #### XcmsCIELuvClipL #### #### XcmsCIELuvClipLuv #### #### XcmsCIELuvClipuv #### #### XcmsCIELuvColorSpace #### #### XcmsCIELuvQueryMaxC #### #### XcmsCIELuvQueryMaxL #### #### XcmsCIELuvQueryMaxLC #### #### XcmsCIELuvQueryMinL #### #### XcmsCIELuvToCIEuvY #### #### XcmsCIELuvWhiteShiftColors #### #### XcmsCIEXYZColorSpace #### #### XcmsCIEXYZToCIELab #### #### XcmsCIEXYZToCIEuvY #### #### XcmsCIEXYZToCIExyY #### #### XcmsCIEXYZToRGBi #### #### XcmsCIEuvYColorSpace #### #### XcmsCIEuvYToCIELuv #### #### XcmsCIEuvYToCIEXYZ #### #### XcmsCIEuvYToTekHVC #### #### XcmsCIExyYColorSpace #### #### XcmsCIExyYToCIEXYZ #### #### XcmsClientWhitePointOfCCC #### #### XcmsConvertColors #### #### XcmsCreateCCC #### #### XcmsDefaultCCC #### #### XcmsDisplayOfCCC #### #### XcmsFormatOfPrefix #### #### XcmsFreeCCC #### #### XcmsLinearRGBFunctionSet #### #### XcmsLookupColor #### #### XcmsPrefixOfFormat #### #### XcmsQueryBlack #### #### XcmsQueryBlue #### #### XcmsQueryColor #### #### XcmsQueryColors #### #### XcmsQueryGreen #### #### XcmsQueryRed #### #### XcmsQueryWhite #### #### XcmsRGBColorSpace #### #### XcmsRGBToRGBi #### #### XcmsRGBiColorSpace #### #### XcmsRGBiToCIEXYZ #### #### XcmsRGBiToRGB #### #### XcmsScreenNumberOfCCC #### #### XcmsScreenWhitePointOfCCC #### #### XcmsSetCCCOfColormap #### #### XcmsSetCompressionProc #### #### XcmsSetWhiteAdjustProc #### #### XcmsSetWhitePoint #### #### XcmsStoreColor #### #### XcmsStoreColors #### #### XcmsTekHVCClipC #### #### XcmsTekHVCClipV #### #### XcmsTekHVCClipVC #### #### XcmsTekHVCColorSpace #### #### XcmsTekHVCQueryMaxC #### #### XcmsTekHVCQueryMaxV #### #### XcmsTekHVCQueryMaxVC #### #### XcmsTekHVCQueryMaxVSamples #### #### XcmsTekHVCQueryMinV #### #### XcmsTekHVCToCIEuvY #### #### XcmsTekHVCWhiteShiftColors #### #### XcmsUNDEFINEDColorSpace #### #### XcmsVisualOfCCC #### #### XkbAddDeviceLedInfo #### #### XkbAddGeomColor #### #### XkbAddGeomDoodad #### #### XkbAddGeomKey #### #### XkbAddGeomKeyAlias #### #### XkbAddGeomOutline #### #### XkbAddGeomOverlay #### #### XkbAddGeomOverlayKey #### #### XkbAddGeomOverlayRow #### #### XkbAddGeomProperty #### #### XkbAddGeomRow #### #### XkbAddGeomSection #### #### XkbAddGeomShape #### #### XkbAddKeyType #### #### XkbAllocClientMap #### #### XkbAllocCompatMap #### #### XkbAllocControls #### #### XkbAllocDeviceInfo #### #### XkbAllocGeomColors #### #### XkbAllocGeomDoodads #### #### XkbAllocGeomKeyAliases #### #### XkbAllocGeomKeys #### #### XkbAllocGeomOutlines #### #### XkbAllocGeomOverlayKeys #### #### XkbAllocGeomOverlayRows #### #### XkbAllocGeomOverlays #### #### XkbAllocGeomPoints #### #### XkbAllocGeomProps #### #### XkbAllocGeomRows #### #### XkbAllocGeomSectionDoodads #### #### XkbAllocGeomSections #### #### XkbAllocGeomShapes #### #### XkbAllocGeometry #### #### XkbAllocIndicatorMaps #### #### XkbAllocKeyboard #### #### XkbAllocNames #### #### XkbAllocServerMap #### #### XkbApplyCompatMapToKey #### #### XkbApplyVirtualModChanges #### #### XkbBell #### #### XkbBellEvent #### #### XkbChangeDeviceInfo #### #### XkbChangeEnabledControls #### #### XkbChangeKeycodeRange #### #### XkbChangeMap #### #### XkbChangeNames #### #### XkbChangeTypesOfKey #### #### XkbComputeEffectiveMap #### #### XkbComputeRowBounds #### #### XkbComputeSectionBounds #### #### XkbComputeShapeBounds #### #### XkbComputeShapeTop #### #### XkbCopyKeyType #### #### XkbCopyKeyTypes #### #### XkbDeviceBell #### #### XkbDeviceBellEvent #### #### XkbFindOverlayForKey #### #### XkbForceBell #### #### XkbForceDeviceBell #### #### XkbFreeClientMap #### #### XkbFreeCompatMap #### #### XkbFreeComponentList #### #### XkbFreeControls #### #### XkbFreeDeviceInfo #### #### XkbFreeGeomColors #### #### XkbFreeGeomDoodads #### #### XkbFreeGeomKeyAliases #### #### XkbFreeGeomKeys #### #### XkbFreeGeomOutlines #### #### XkbFreeGeomOverlayKeys #### #### XkbFreeGeomOverlayRows #### #### XkbFreeGeomOverlays #### #### XkbFreeGeomPoints #### #### XkbFreeGeomProperties #### #### XkbFreeGeomRows #### #### XkbFreeGeomSections #### #### XkbFreeGeomShapes #### #### XkbFreeGeometry #### #### XkbFreeIndicatorMaps #### #### XkbFreeKeyboard #### #### XkbFreeNames #### #### XkbFreeServerMap #### #### XkbGetAutoRepeatRate #### #### XkbGetAutoResetControls #### #### XkbGetCompatMap #### #### XkbGetControls #### #### XkbGetDetectableAutoRepeat #### #### XkbGetDeviceButtonActions #### #### XkbGetDeviceInfo #### #### XkbGetDeviceInfoChanges #### #### XkbGetDeviceLedInfo #### #### XkbGetGeometry #### #### XkbGetIndicatorMap #### #### XkbGetIndicatorState #### #### XkbGetKeyActions #### #### XkbGetKeyBehaviors #### #### XkbGetKeyExplicitComponents #### #### XkbGetKeyModifierMap #### #### XkbGetKeySyms #### #### XkbGetKeyTypes #### #### XkbGetKeyVirtualModMap #### #### XkbGetKeyboard #### #### XkbGetKeyboardByName #### #### XkbGetMap #### #### XkbGetMapChanges #### #### XkbGetNamedDeviceIndicator #### #### XkbGetNamedGeometry #### #### XkbGetNamedIndicator #### #### XkbGetNames #### #### XkbGetPerClientControls #### #### XkbGetState #### #### XkbGetUpdatedMap #### #### XkbGetVirtualMods #### #### XkbGetXlibControls #### #### XkbIgnoreExtension #### #### XkbInitCanonicalKeyTypes #### #### XkbKeyTypesForCoreSymbols #### #### XkbKeycodeToKeysym #### #### XkbKeysymToModifiers #### #### XkbLatchGroup #### #### XkbLatchModifiers #### #### XkbLibraryVersion #### #### XkbListComponents #### #### XkbLockGroup #### #### XkbLockModifiers #### #### XkbLookupKeyBinding #### #### XkbLookupKeySym #### #### XkbNoteControlsChanges #### #### XkbNoteDeviceChanges #### #### XkbNoteMapChanges #### #### XkbNoteNameChanges #### #### XkbOpenDisplay #### #### XkbQueryExtension #### #### XkbRefreshKeyboardMapping #### #### XkbResizeDeviceButtonActions #### #### XkbResizeKeyActions #### #### XkbResizeKeySyms #### #### XkbResizeKeyType #### #### XkbSelectEventDetails #### #### XkbSelectEvents #### #### XkbSetAtomFuncs #### #### XkbSetAutoRepeatRate #### #### XkbSetAutoResetControls #### #### XkbSetCompatMap #### #### XkbSetControls #### #### XkbSetDebuggingFlags #### #### XkbSetDetectableAutoRepeat #### #### XkbSetDeviceButtonActions #### #### XkbSetDeviceInfo #### #### XkbSetDeviceLedInfo #### #### XkbSetGeometry #### #### XkbSetIgnoreLockMods #### #### XkbSetIndicatorMap #### #### XkbSetMap #### #### XkbSetNamedDeviceIndicator #### #### XkbSetNamedIndicator #### #### XkbSetNames #### #### XkbSetPerClientControls #### #### XkbSetServerInternalMods #### #### XkbSetXlibControls #### #### XkbToControl #### #### XkbTranslateKey #### #### XkbTranslateKeyCode #### #### XkbTranslateKeySym #### #### XkbUpdateActionVirtualMods #### #### XkbUpdateKeyTypeVirtualMods #### #### XkbUpdateMapFromCore #### #### XkbUseExtension #### #### XkbVirtualModsToReal #### #### XkbXlibControlsImplemented #### #### XmbDrawImageString #### #### XmbDrawString #### #### XmbDrawText #### #### XmbLookupString #### #### XmbResetIC #### #### XmbSetWMProperties #### #### XmbTextEscapement #### #### XmbTextExtents #### #### XmbTextListToTextProperty #### #### XmbTextPerCharExtents #### #### XmbTextPropertyToTextList #### #### Xpermalloc #### #### XrmCombineDatabase #### #### XrmCombineFileDatabase #### #### XrmDestroyDatabase #### #### XrmEnumerateDatabase #### #### XrmGetDatabase #### #### XrmGetFileDatabase #### #### XrmGetResource #### #### XrmGetStringDatabase #### #### XrmInitialize #### #### XrmLocaleOfDatabase #### #### XrmMergeDatabases #### #### XrmParseCommand #### #### XrmPermStringToQuark #### #### XrmPutFileDatabase #### #### XrmPutLineResource #### #### XrmPutResource #### #### XrmPutStringResource #### #### XrmQGetResource #### #### XrmQGetSearchList #### #### XrmQGetSearchResource #### #### XrmQPutResource #### #### XrmQPutStringResource #### #### XrmQuarkToString #### #### XrmSetDatabase #### #### XrmStringToBindingQuarkList #### #### XrmStringToQuark #### #### XrmStringToQuarkList #### #### XrmUniqueQuark #### #### Xutf8DrawImageString #### #### Xutf8DrawString #### #### Xutf8DrawText #### #### Xutf8LookupString #### #### Xutf8ResetIC #### #### Xutf8SetWMProperties #### #### Xutf8TextEscapement #### #### Xutf8TextExtents #### #### Xutf8TextListToTextProperty #### #### Xutf8TextPerCharExtents #### #### Xutf8TextPropertyToTextList #### #### XwcDrawImageString #### #### XwcDrawString #### #### XwcDrawText #### #### XwcFreeStringList #### #### XwcLookupString #### #### XwcResetIC #### #### XwcTextEscapement #### #### XwcTextExtents #### #### XwcTextListToTextProperty #### #### XwcTextPerCharExtents #### #### XwcTextPropertyToTextList #### #### _Utf8GetConvByName #### #### _X11TransBytesReadable #### #### _X11TransClose #### #### _X11TransCloseForCloning #### #### _X11TransConnect #### #### _X11TransConnectDisplay #### #### _X11TransConvertAddress #### #### _X11TransDisconnect #### #### _X11TransFreeConnInfo #### #### _X11TransGetConnectionNumber #### #### _X11TransGetHostname #### #### _X11TransGetMyAddr #### #### _X11TransGetPeerAddr #### #### _X11TransIsLocal #### #### _X11TransOpenCOTSClient #### #### _X11TransRead #### #### _X11TransReadv #### #### _X11TransSetOption #### #### _X11TransSocketINET6Funcs #### #### _X11TransSocketINETFuncs #### #### _X11TransSocketLocalFuncs #### #### _X11TransSocketProxyConnInfo #### #### _X11TransSocketTCPFuncs #### #### _X11TransSocketUNIXFuncs #### #### _X11TransWrite #### #### _X11TransWritev #### #### _XAllocID #### #### _XAllocIDs #### #### _XAllocScratch #### Compext.c:1852: if ((dst_data = _XAllocScratch(dpy, dst_data_length)) == NULL) Compext.c:1947: if ((dst_data = _XAllocScratch(dpy, dst_data_length)) == NULL) #### _XAllocTemp #### #### _XAsyncErrorHandler #### #### _XCloseLC #### #### _XColor_to_XcmsRGB #### #### _XConnectDisplay #### #### _XCopyEventCookie #### #### _XCopyToArg #### #### _XCreateMutex_fn #### #### (arch=amd64 ia64 alpha ppc64 arm64)_XData32 #### #### _XDefaultError #### #### _XDefaultIOError #### #### _XDefaultWireError #### #### _XDeq #### #### _XDeqAsyncHandler #### #### _XDisconnectDisplay #### #### _XEatData #### Compext.c:968: _XEatData(dpy, (unsigned long) n); Compext.c:1222: _XEatData(dpy, (unsigned long) n); #### _XEatDataWords #### #### _XEnq #### #### _XError #### Compext.c:1036: int (*handler)(Display *, XErrorEvent *) = _XErrorFunction; Compext.c:1053: _XErrorFunction = _NXInternalReplyErrorFunction; Compext.c:1115: _XErrorFunction = handler; Compext.c:1144: _XErrorFunction = handler; #### _XErrorFunction #### Compext.c:1036: int (*handler)(Display *, XErrorEvent *) = _XErrorFunction; Compext.c:1053: _XErrorFunction = _NXInternalReplyErrorFunction; Compext.c:1115: _XErrorFunction = handler; Compext.c:1144: _XErrorFunction = handler; #### _XEventToWire #### #### _XEventsQueued #### #### _XF86BigfontFreeFontMetrics #### #### _XF86LoadQueryLocaleFont #### #### _XFetchEventCookie #### #### _XFlush #### #### _XFlushGCCache #### #### _XFreeAtomTable #### #### _XFreeDisplayLock_fn #### #### _XFreeDisplayStructure #### #### _XFreeEventCookies #### #### _XFreeExtData #### #### _XFreeMutex_fn #### #### _XFreeTemp #### #### _XGetAsyncData #### Compext.c:3591: _XGetAsyncData(dpy, async_data, buf, len, SIZEOF(xGetImageReply), async_size, async_size); Compext.c:3992: _XGetAsyncData(dpy, async_data, buf, len, SIZEOF(xGetPropertyReply), async_size, async_size); #### _XGetAsyncReply #### Compext.c:3537: async_rep = (xGetImageReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); Compext.c:3930: async_rep = (xGetPropertyReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); Compext.c:4292: async_rep = (xGrabPointerReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); Compext.c:4576: async_rep = (xGetInputFocusReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); #### _XGetBitsPerPixel #### Compext.c:231:extern int _XGetBitsPerPixel(Display *dpy, int depth); Compext.c:1624: req -> depth1Bpp = _XGetBitsPerPixel(dpy, 1); Compext.c:1625: req -> depth4Bpp = _XGetBitsPerPixel(dpy, 4); Compext.c:1626: req -> depth8Bpp = _XGetBitsPerPixel(dpy, 8); Compext.c:1627: req -> depth16Bpp = _XGetBitsPerPixel(dpy, 16); Compext.c:1628: req -> depth24Bpp = _XGetBitsPerPixel(dpy, 24); Compext.c:1629: req -> depth32Bpp = _XGetBitsPerPixel(dpy, 32); #### _XGetHostname #### #### _XGetLCValues #### #### _XGetRequest #### #### _XGetScanlinePad #### Compext.c:232:extern int _XGetScanlinePad(Display *dpy, int depth); Compext.c:3611: state -> height, _XGetScanlinePad(dpy, async_rep -> depth), 0); #### _XGetWindowAttributes #### #### _XHeadOfDisplayList #### #### _XIMCompileResourceList #### #### _XIOError #### Compext.c:560: _XIOError(dpy); #### _XIOErrorFunction #### #### _XInitDisplayLock_fn #### #### _XInitIM #### #### _XInitImageFuncPtrs #### #### _XInitKeysymDB #### #### _XInitOM #### #### _XIsEventCookie #### #### _XKeyInitialize #### #### _XKeycodeToKeysym #### #### _XKeysymToKeycode #### #### _XKeysymToModifiers #### #### _XLockMutex_fn #### #### _XLookupKeysym #### #### _XLookupString #### #### _XNoticeCreateBitmap #### #### _XNoticePutBitmap #### #### _XOpenLC #### #### _XParseBaseFontNameList #### #### _XPollfdCacheAdd #### #### _XPollfdCacheDel #### #### _XPollfdCacheInit #### #### _XProcessInternalConnection #### #### _XProcessWindowAttributes #### #### _XPutBackEvent #### #### (arch=amd64 ia64 alpha ppc64 arm64)_XRead32 #### #### _XRead #### Compext.c:983: _XReadPad(dpy, (char *) supported_methods, n); Compext.c:1235: _XReadPad(dpy, (char *) path_data, n); #### _XReadEvents #### #### _XReadPad #### Compext.c:983: _XReadPad(dpy, (char *) supported_methods, n); Compext.c:1235: _XReadPad(dpy, (char *) path_data, n); #### _XRefreshKeyboardMapping #### #### _XRegisterFilterByMask #### #### _XRegisterFilterByType #### #### _XRegisterInternalConnection #### #### _XReply #### Compext.c:835: if (_XReply(dpy, (xReply *) &rep, 0, xTrue) == xFalse) Compext.c:948: if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == xFalse || rep.length == 0) Compext.c:1109: if (_XReply(dpy, (xReply *) &rep, 0, xTrue) == xFalse) Compext.c:1202: if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == xFalse || rep.length == 0) Compext.c:2600: result = _XReply(dpy, (xReply *) &rep, 0, xTrue); #### _XReverse_Bytes #### #### _XScreenOfWindow #### #### _XSelect #### #### _XSend #### Compext.c:204: * _XSend or Data. Compext.c:1715: * The _XSend() will pad the request for us. Compext.c:1718: _XSend(dpy, data, data_length); Compext.c:1778: * The _XSend() will pad the request for us. Compext.c:1781: _XSend(dpy, data, data_length); Compext.c:1886: _XSend(dpy, dst_data, dst_data_length); Compext.c:1986: _XSend(dpy, dst_data, dst_data_length); Compext.c:2560: * The _XSend() will pad the request for us. Compext.c:2563: _XSend(dpy, image -> data, src_data_length); #### _XSendClientPrefix #### #### _XSetClipRectangles #### #### _XSetImage #### #### _XSetLastRequestRead #### #### _XStoreEventCookie #### #### _XTextHeight16 #### #### _XTextHeight #### #### _XTranslateKey #### #### _XTranslateKeySym #### #### _XTryShapeBitmapCursor #### #### _XUnknownCopyEventCookie #### #### _XUnknownNativeEvent #### #### _XUnknownWireEvent #### #### _XUnknownWireEventCookie #### #### _XUnlockMutex_fn #### #### _XUnregisterFilter #### #### _XUnregisterInternalConnection #### #### _XUnresolveColor #### #### _XUpdateAtomCache #### #### _XUpdateGCCache #### #### _XVIDtoVisual #### Compext.c:3603: state -> image = XCreateImage(dpy, _XVIDtoVisual(dpy, async_rep -> visual), Compext.c:3609: state -> image = XCreateImage(dpy, _XVIDtoVisual(dpy, async_rep -> visual), #### _XWireToEvent #### #### _XcmsAddCmapRec #### #### _XcmsArcTangent #### #### _XcmsCIELabQueryMaxLCRGB #### #### _XcmsCIELab_prefix #### #### _XcmsCIELuvQueryMaxLCRGB #### #### _XcmsCIELuv_prefix #### #### _XcmsCIEXYZ_ValidSpec #### #### _XcmsCIEXYZ_prefix #### #### _XcmsCIEuvY_ValidSpec #### #### _XcmsCIEuvY_prefix #### #### _XcmsCIExyY_prefix #### #### _XcmsConvertColorsWithWhitePt #### #### _XcmsCopyCmapRecAndFree #### #### _XcmsCopyISOLatin1Lowered #### #### _XcmsCopyPointerArray #### #### _XcmsCosine #### #### _XcmsCubeRoot #### #### _XcmsDDColorSpaces #### #### _XcmsDDColorSpacesInit #### #### _XcmsDDConvertColors #### #### _XcmsDIColorSpaces #### #### _XcmsDIColorSpacesInit #### #### _XcmsDIConvertColors #### #### _XcmsDeleteCmapRec #### #### _XcmsEqualWhitePts #### #### _XcmsFreeIntensityMaps #### #### _XcmsFreePointerArray #### #### _XcmsGetElement #### #### _XcmsGetIntensityMap #### #### _XcmsGetProperty #### #### _XcmsInitDefaultCCCs #### #### _XcmsInitScrnInfo #### #### _XcmsLRGB_InitScrnDefault #### #### _XcmsPushPointerArray #### #### _XcmsRGB_prefix #### #### _XcmsRGB_to_XColor #### #### _XcmsRGBi_prefix #### #### _XcmsRegColorSpaces #### #### _XcmsRegFormatOfPrefix #### #### _XcmsResolveColor #### #### _XcmsResolveColorString #### #### _XcmsSCCFuncSets #### #### _XcmsSCCFuncSetsInit #### #### _XcmsSetGetColor #### #### _XcmsSetGetColors #### #### _XcmsSine #### #### _XcmsSquareRoot #### #### _XcmsTekHVCQueryMaxVCRGB #### #### _XcmsTekHVC_CheckModify #### #### _XcmsTekHVC_prefix #### #### _XcmsUnresolveColor #### #### _Xdebug #### #### _Xevent_to_mask #### #### _Xglobal_lock #### #### _Xi18n_lock #### #### _XimCbDispatch #### #### _XimCheckCreateICValues #### #### _XimCheckDataSize #### #### _XimCheckICMode #### #### _XimCheckIMMode #### #### _XimCheckIfLocalProcessing #### #### _XimCheckIfThaiProcessing #### #### _XimCheckLocalInputStyle #### #### _XimCommitCallback #### #### _XimConnect #### #### _XimDecodeICATTRIBUTE #### #### _XimDecodeIMATTRIBUTE #### #### _XimDecodeLocalICAttr #### #### _XimDecodeLocalIMAttr #### #### _XimDestroyIMStructureList #### #### _XimDispatchInit #### #### _XimEncodeICATTRIBUTE #### #### _XimEncodeIMATTRIBUTE #### #### _XimEncodeLocalICAttr #### #### _XimEncodeLocalIMAttr #### #### _XimError #### #### _XimErrorCallback #### #### _XimExtension #### #### _XimFilterWaitEvent #### #### _XimFlush #### #### _XimForwardEvent #### #### _XimForwardEventCallback #### #### _XimFreeCommitInfo #### #### _XimFreeProtoIntrCallback #### #### _XimFreeTransIntrCallback #### #### _XimGetAttributeID #### #### _XimGetCharCode #### #### _XimGetCurrentICValues #### #### _XimGetCurrentIMValues #### #### _XimGetICValueData #### #### _XimGetIMValueData #### #### _XimGetLocaleCode #### #### _XimGetMyEndian #### #### _XimGetResourceListRec #### #### _XimGetResourceListRecByQuark #### #### _XimGetWindowEventmask #### #### _XimICOfXICID #### #### _XimImSportRec #### #### _XimInitialResourceInfo #### #### _XimLcctstombs #### #### _XimLcctstoutf8 #### #### _XimLcctstowcs #### #### _XimLocalCreateIC #### #### _XimLocalFilter #### #### _XimLocalGetICValues #### #### _XimLocalGetIMValues #### #### _XimLocalIMFree #### #### _XimLocalMbLookupString #### #### _XimLocalOpenIM #### #### _XimLocalSetICValues #### #### _XimLocalSetIMValues #### #### _XimLocalUtf8LookupString #### #### _XimLocalWcLookupString #### #### _XimLookupMBText #### #### _XimLookupUTF8Text #### #### _XimLookupWCText #### #### _XimMakeICAttrIDList #### #### _XimMakeIMAttrIDList #### #### _XimOpenIM #### #### _XimParseStringFile #### #### _XimProcError #### #### _XimProcSyncReply #### #### _XimProtoCreateIC #### #### _XimProtoEventToWire #### #### _XimProtoIMFree #### #### _XimProtoMbLookupString #### #### _XimProtoOpenIM #### #### _XimProtoUtf8LookupString #### #### _XimProtoWcLookupString #### #### _XimProtoWireToEvent #### #### _XimRead #### #### _XimRegProtoIntrCallback #### #### _XimRegisterDispatcher #### #### _XimRegisterFilter #### #### _XimRegisterIMInstantiateCallback #### #### _XimRegisterServerFilter #### #### _XimRegisterTriggerKeysCallback #### #### _XimReregisterFilter #### #### _XimResetIMInstantiateCallback #### #### _XimRespSyncReply #### #### _XimServerDestroy #### #### _XimSetCurrentICValues #### #### _XimSetCurrentIMValues #### #### _XimSetEventMaskCallback #### #### _XimSetHeader #### #### _XimSetICDefaults #### #### _XimSetICMode #### #### _XimSetICResourceList #### #### _XimSetICValueData #### #### _XimSetIMMode #### #### _XimSetIMResourceList #### #### _XimSetIMValueData #### #### _XimSetInnerICResourceList #### #### _XimSetInnerIMResourceList #### #### _XimSetLocalIMDefaults #### #### _XimShutdown #### #### _XimSync #### #### _XimSyncCallback #### #### _XimThaiCloseIM #### #### _XimThaiCreateIC #### #### _XimThaiFilter #### #### _XimThaiIMFree #### #### _XimThaiOpenIM #### #### _XimTransCallDispatcher #### #### _XimTransConf #### #### _XimTransFilterWaitEvent #### #### _XimTransFlush #### #### _XimTransInternalConnection #### #### _XimTransRead #### #### _XimTransRegisterDispatcher #### #### _XimTransWrite #### #### _XimTransportRec #### #### _XimTriggerNotify #### #### _XimUnRegisterIMInstantiateCallback #### #### _XimUnregisterFilter #### #### _XimUnregisterServerFilter #### #### _XimWrite #### #### _XimXConf #### #### _XimXTransBytesReadable #### #### _XimXTransClose #### #### _XimXTransCloseForCloning #### #### _XimXTransConnect #### #### _XimXTransDisconnect #### #### _XimXTransFreeConnInfo #### #### _XimXTransGetConnectionNumber #### #### _XimXTransGetHostname #### #### _XimXTransGetPeerAddr #### #### _XimXTransIsLocal #### #### _XimXTransOpenCOTSClient #### #### _XimXTransRead #### #### _XimXTransReadv #### #### _XimXTransSetOption #### #### _XimXTransSocketINET6Funcs #### #### _XimXTransSocketINETFuncs #### #### _XimXTransSocketLocalFuncs #### #### _XimXTransSocketTCPFuncs #### #### _XimXTransSocketUNIXFuncs #### #### _XimXTransWrite #### #### _XimXTransWritev #### #### _Ximctstombs #### #### _Ximctstoutf8 #### #### _Ximctstowcs #### #### _XkbCopyFromReadBuffer #### #### _XkbFreeReadBuffer #### #### _XkbGetAtomNameFunc #### #### _XkbGetCharset #### #### _XkbGetConverters #### #### _XkbGetReadBufferCountedString #### #### _XkbGetReadBufferPtr #### #### _XkbInitReadBuffer #### #### _XkbInternAtomFunc #### #### _XkbNoteCoreMapChanges #### #### _XkbPeekAtReadBuffer #### #### (arch=amd64 ia64 alpha ppc64 arm64)_XkbReadBufferCopy32 #### #### _XkbReadBufferCopyKeySyms #### #### (arch=amd64 ia64 alpha ppc64 arm64)_XkbReadCopyData32 #### #### _XkbReadCopyKeySyms #### #### _XkbReadGetCompatMapReply #### #### _XkbReadGetGeometryReply #### #### _XkbReadGetIndicatorMapReply #### #### _XkbReadGetMapReply #### #### _XkbReadGetNamesReply #### #### _XkbReloadDpy #### #### _XkbSkipReadBufferData #### #### (arch=amd64 ia64 alpha ppc64 arm64)_XkbWriteCopyData32 #### #### _XkbWriteCopyKeySyms #### #### _XkeyTable #### #### _XlcAddCT #### #### _XlcAddCharSet #### #### _XlcAddGB18030LocaleConverters #### #### _XlcAddLoader #### #### _XlcAddUtf8Converters #### #### _XlcAddUtf8LocaleConverters #### #### _XlcCloseConverter #### #### _XlcCompareISOLatin1 #### #### _XlcCompileResourceList #### #### _XlcConvert #### #### _XlcCopyFromArg #### #### _XlcCopyToArg #### #### _XlcCountVaList #### #### _XlcCreateDefaultCharSet #### #### _XlcCreateLC #### #### _XlcCreateLocaleDataBase #### #### _XlcCurrentLC #### #### _XlcDbg_printValue #### #### _XlcDeInitLoader #### #### _XlcDefaultLoader #### #### _XlcDefaultMapModifiers #### #### _XlcDestroyLC #### #### _XlcDestroyLocaleDataBase #### #### _XlcFileName #### #### _XlcGenericLoader #### #### _XlcGenericMethods #### #### _XlcGetCSValues #### #### _XlcGetCharSet #### #### _XlcGetCharSetWithSide #### #### _XlcGetLocaleDataBase #### #### _XlcGetResource #### #### _XlcGetValues #### #### _XlcInitCTInfo #### #### _XlcInitLoader #### #### _XlcLocaleDirName #### #### _XlcLocaleLibDirName #### #### _XlcMapOSLocaleName #### #### _XlcNCompareISOLatin1 #### #### _XlcOpenConverter #### #### _XlcParseCharSet #### #### _XlcParse_scopemaps #### #### _XlcPublicMethods #### #### _XlcRemoveLoader #### #### _XlcResetConverter #### #### _XlcResolveI18NPath #### #### _XlcResolveLocaleName #### #### _XlcSetConverter #### #### _XlcSetValues #### #### _XlcUtf8Loader #### #### _XlcVaToArgList #### #### _XlcValidModSyntax #### #### _Xlcmbstoutf8 #### #### _Xlcmbstowcs #### #### _Xlcmbtowc #### #### _Xlcwcstombs #### #### _Xlcwctomb #### #### _XmbDefaultDrawImageString #### #### _XmbDefaultDrawString #### #### _XmbDefaultTextEscapement #### #### _XmbDefaultTextExtents #### #### _XmbDefaultTextPerCharExtents #### #### _XmbGenericDrawImageString #### #### _XmbGenericDrawString #### #### _XmbGenericTextEscapement #### #### _XmbGenericTextExtents #### #### _XmbGenericTextPerCharExtents #### #### _XmbTextListToTextProperty #### #### _XmbTextPropertyToTextList #### #### _Xmblen #### #### _Xmbstoutf8 #### #### _Xmbstowcs #### #### _Xmbtowc #### #### _XomConvert #### #### _XomGenericDrawString #### #### _XomGenericOpenOM #### #### _XomGenericTextExtents #### #### _XomGetFontDataFromFontSet #### #### _XomInitConverter #### #### _XrmDefaultInitParseInfo #### #### _XrmInitParseInfo #### #### _XrmInternalStringToQuark #### #### _Xthread_self_fn #### #### _Xutf8DefaultDrawImageString #### #### _Xutf8DefaultDrawString #### #### _Xutf8DefaultTextEscapement #### #### _Xutf8DefaultTextExtents #### #### _Xutf8DefaultTextPerCharExtents #### #### _Xutf8GenericDrawImageString #### #### _Xutf8GenericDrawString #### #### _Xutf8GenericTextEscapement #### #### _Xutf8GenericTextExtents #### #### _Xutf8GenericTextPerCharExtents #### #### _Xutf8TextListToTextProperty #### #### _Xutf8TextPropertyToTextList #### #### _XwcDefaultDrawImageString #### #### _XwcDefaultDrawString #### #### _XwcDefaultTextEscapement #### #### _XwcDefaultTextExtents #### #### _XwcDefaultTextPerCharExtents #### #### _XwcFreeStringList #### #### _XwcGenericDrawImageString #### #### _XwcGenericDrawString #### #### _XwcGenericTextEscapement #### #### _XwcGenericTextExtents #### #### _XwcGenericTextPerCharExtents #### #### _XwcTextListToTextProperty #### #### _XwcTextPropertyToTextList #### #### _Xwcscmp #### #### _Xwcscpy #### #### _Xwcslen #### #### _Xwcsncmp #### #### _Xwcsncpy #### #### _Xwcstombs #### #### _Xwctomb #### #### _qfree #### #### read_EncodingInfo #### #### xlocaledir #### nx-libs-3.5.99.23/doc/nxagent/README.keystrokes0000644000000000000000000001253713614532331015612 0ustar Configurable keybindings in nxagent Keybindings in the redistributed x2go version of nxagent can be configured by the user. This is done via a configuration file. File location ------------- nxagent parses the first available configuration file and ignores all others. If nxagent is called without branding, it searches: - in the location given by the '-keystrokefile' command line parameter - in the location given by the NXAGENT_KEYSTROKEFILE environment variable - in ~/.nx/config/keystrokes.cfg - in /etc/nxagent/keystrokes.cfg If nxagent is called with X2Go branding (i.e., as x2goagent), it searches: - in the location given by the '-keystrokefile' command line parameter - in the location given by the X2GO_KEYSTROKEFILE environment variable - in ~/.x2go/config/keystrokes.cfg - in /etc/x2go/keystrokes.cfg If none of these files are accessible, the default configuration is used which is the same as the old, traditional nxagent keybindings. File format ----------- The configuration file is XML with the following format: Each 'action' defines an action to be executed when receiving that keystroke. A list of possible actions is given below. Some of those actions are only available with debug builds of nxagent. Keys are given as a combination of 'key' and (optionally) a number of modifiers. The key attribute is evaluated into a X11 key via the usual XStringToKeysym function. A list of possible keys can be found in /usr/include/X11/keysymdef.h, the names are specified without the leading 'XK_'. Evaluation is case-sensitive, so, 'space' and 'Escape' will work while 'Space' and 'escape' won't. Modifiers are given as boolean attributes, possible modifiers are Mod1, Mod2, Mod3, Mod4, Mod5, Control, Shift, Lock. Sensible combinations strongly depend on your keyboard configuration, but usually you will need Mod1 and Control. Boolean in this context means '0', 'false' and an unspecified attribute are false, anything else is considered true. Everything in this file is case-sensitive. Unknown lines are ignored (accompanied by a warning in the session log). Keybindings are evaluated from top to bottom, so if a keybinding matches, other keybindings further down will be ignored. The contents of the file replaces the default keybindings, and only one file is read, no merging between different configuration files is done. This also means that an empty or invalid configuration file deactivates all keybindings. If an attribute occurs more than once in a line the last one wins. Some of the actions can open a dialog window. Depending on the user's answer the selected action will be taken. Some actions will only show a dialog informing the user about the taken action. All these dialogs will only work if the nxagent/x2goagent process has a properly configured NX_CLIENT environment variable pointing to an executable (like nxdialog) that is responsible for showing the dialogs and taking the action(s). If that executable cannot be run no dialog will show up and no action will be taken. List of possible 'action' attributes: ------------------------------------- close_session This terminates the session. If a proper dialog helper is available ask the user if he wants to disconnect or terminate the session and then perform the selected action. Without proper helper it will do nothing (except writing an error the session log) fullscreen Switches the client window into or out of fullscreen mode, using only the current head. switch_all_screens Switches the client window into or out of fullscreen mode, using all available heads. minimize This will minimize the client window (even for fullscreen sessions). resize This action switches between the auto-resize (default) and viewport mode. In viewport mode the xserver screen size stays static even if the nxagent window is resized. You will possibly only see a part of the screen and can scroll around using the following actions: viewport_move_left/up/right/down Moves the viewport left/up/right/down by the width resp. height of the visible area. viewport_scroll_left/up/right/down Scrolls the viewport left/up/right/down with increasing speed (maximum step size is 200px). defer Activates/deactivates deferred screen updates. With a proper dialog helper (see above) it will open a dialog informing the user about the action taken. ignore Ignores the following keystroke, nothing will happen when this keystroke is pressed. The keystroke will NOT be passed to the clients. If you want the clients to see the keystroke you need to eliminate the line from the config file instead of using 'ignore'. reread_keystrokes Forces nxagent to re-read the keystroke configuration. Useful to add/change keystrokes to a running session. autograb Toggles autograb mode force_synchronization Forces immediate drawing of elements to be synchronized which can fix some visual bugs. nx-libs-3.5.99.23/doc/nxagent/README.keystrokes.debug0000644000000000000000000000167013614532331016673 0ustar Configurable keybindings for debugging nxagent Some keystrokes are only available in special debug builds of nxagent and will be ignored otherwise. These are debug_tree Show the window trees of both internal and external windows. Included if DEBUG_TREE is defined. regions_on_screen Make corrupted regions visible. Included if DUMP is defined. test_input Activate/deactive input device debugging. Included if NX_DEBUG_INPUT is defined. deactivate_input_devices_grab Release grab of input devices. Included if NX_DEBUG_INPUT is defined. They can be configured by adding these lines to keystrokes.cfg, below keystrokes represent the default: nx-libs-3.5.99.23/doc/nxagent/x11.svg0000644000000000000000000000214413614532331013653 0ustar nx-libs-3.5.99.23/doc/nxcomp/DXPC_re-licensed_debug_784565.mbox0000644000000000000000000047706613614532331020313 0ustar From invernomuto@paranoici.org Wed May 06 17:36:12 2015 Received: (at submit) by bugs.debian.org; 6 May 2015 17:36:12 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=4.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FOURLA,HAS_PACKAGE,SPF_HELO_PASS,SPF_PASS, XMAILER_REPORTBUG autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 12; hammy, 150; neutral, 79; spammy, 0. spammytokens: hammytokens:0.000-+--H*M:reportbug, 0.000-+--H*MI:reportbug, 0.000-+--H*x:reportbug, 0.000-+--H*UA:reportbug, 0.000-+--H*x:6.6.3 Return-path: Received: from perdizione.investici.org ([94.23.50.208]) by buxtehude.debian.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yq3Ex-0001dB-Ks for submit@bugs.debian.org; Wed, 06 May 2015 17:36:11 +0000 Received: from [94.23.50.208] (perdizione [94.23.50.208]) (Authenticated sender: invernomuto@paranoici.org) by localhost (Postfix) with ESMTPSA id 3987C120F77; Wed, 6 May 2015 17:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paranoici.org; s=stigmate; t=1430933767; bh=QAdaIheSnzoHI301+0HPUrAK62wjbKWg7iWEzGzlOTs=; h=From:To:Subject:Date; b=X/2YGWFWL2KRAVqONR2Q6Q6HuMii+1WfGCbSpf8XvQesaf7qWlvY2u1IVKgKVpN2m Baq+3OrQ1adlmdHQQJm7tLfv37vRZVNOUpP3lyKQX4v3B/Gos63+1GqfyJ7qGkvQha 4qwytZrPI20VmUswHf7qhgSGIVQmy0COEZZX0PF8= Received: from frx by homebrew with local (Exim 4.85) (envelope-from ) id 1Yq3EK-0001ye-Bx; Wed, 06 May 2015 19:35:32 +0200 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Francesco Poli \(wintermute\)" To: Debian Bug Tracking System Subject: nx-libs-lite: parts are derived from non-free code Message-ID: <20150506173532.7531.31389.reportbug@homebrew> X-Mailer: reportbug 6.6.3 Date: Wed, 06 May 2015 19:35:32 +0200 Delivered-To: submit@bugs.debian.org Package: nx-libs-lite Version: 3.5.0.27-1 Severity: serious Justification: Policy 2.2.1 Hello and thanks for maintaining this package in Debian! I noticed that the debian/copyright states: [...] | Parts of this software are derived from DXPC project. These copyright | notices apply to original DXPC code: | | Redistribution and use in source and binary forms are permitted provided | that the above copyright notice and this paragraph are duplicated in all | such forms. | | THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED | WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | | Copyright (c) 1995,1996 Brian Pane | Copyright (c) 1996,1997 Zachary Vonler and Brian Pane | Copyright (c) 1999 Kevin Vigor and Brian Pane | Copyright (c) 2000,2001 Gian Filippo Pinzari and Brian Pane [...] This license lacks the permission to modify the DXPC code. Hence, the original DXPC code does not appear to comply with the DFSG. And the nx-libs-lite is in part derived from DXPC code. This basically means that nx-libs-lite includes parts which are non-free (as they are derived from non-modifiable code) and are also possibly legally undistributable (as they are non-modifiable, but actually modified). The combination with the rest of nx-libs-lite (which is GPL-licensed) may also be legally undistributable (since the license with no permission to modify is GPL-incompatible). If there's anything I misunderstood, please clarify. Otherwise, please address this issue as soon as possible. The copyright owners for the original DXPC code should be contacted and persuaded to re-license under GPL-compatible terms. Thanks for your time. Bye. From mike.gabriel@das-netzwerkteam.de Mon May 11 09:07:54 2015 Received: (at 784565) by bugs.debian.org; 11 May 2015 09:07:54 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-11.9 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,PGPSIGNATURE,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 24; hammy, 150; neutral, 203; spammy, 0. spammytokens: hammytokens:0.000-+--H*c:pgp-signature, 0.000-+--H*c:protocol, 0.000-+--H*c:micalg, 0.000-+--H*c:signed, 0.000-+--H*RU:sk:grimnir Return-path: Received: from freya.das-netzwerkteam.de ([88.198.48.199]) by buxtehude.debian.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Yrjgn-0001o6-MP for 784565@bugs.debian.org; Mon, 11 May 2015 09:07:54 +0000 Received: from grimnir.das-netzwerkteam.de (grimnir.das-netzwerkteam.de [78.46.204.98]) by freya.das-netzwerkteam.de (Postfix) with ESMTPS id 85F37E4B; Mon, 11 May 2015 11:07:49 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id F1CFF3C20D; Mon, 11 May 2015 11:07:48 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at grimnir.das-netzwerkteam.de Received: from grimnir.das-netzwerkteam.de ([127.0.0.1]) by localhost (grimnir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wKYnujH8-HJ8; Mon, 11 May 2015 11:07:48 +0200 (CEST) Received: from grimnir.das-netzwerkteam.de (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTPS id 960E33C18A; Mon, 11 May 2015 11:07:48 +0200 (CEST) Received: from bifrost.das-netzwerkteam.de (bifrost.das-netzwerkteam.de [178.62.101.154]) by mail.das-netzwerkteam.de (Horde Framework) with HTTP; Mon, 11 May 2015 09:07:48 +0000 Date: Mon, 11 May 2015 09:07:48 +0000 Message-ID: <20150511090748.Horde.Edus-FOfuc519TjISGi1vQ2@mail.das-netzwerkteam.de> From: Mike Gabriel To: "Francesco Poli (wintermute)" , 784565@bugs.debian.org Cc: x2go-dev@lists.x2go.org, Nito Martinez , opensource@gznianguan.com, dktrkranz@debian.org Subject: Re: [pkg-x2go-devel] Bug#784565: nx-libs-lite: parts are derived from non-free code In-Reply-To: <20150506173532.7531.31389.reportbug@homebrew> User-Agent: Internet Messaging Program (IMP) H5 (6.2.2) Accept-Language: de,en Organization: DAS-NETZWERKTEAM X-Originating-IP: 178.62.101.154 X-Remote-Browser: Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0 Iceweasel/32.0 Content-Type: multipart/signed; boundary="=_ALb-1vQm6P3YAYx12TU2SQ1"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 This message is in MIME format and has been PGP signed. --=_ALb-1vQm6P3YAYx12TU2SQ1 Content-Type: text/plain; charset=us-ascii; format=flowed; DelSp=Yes Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Francesco, Cc:ing a couple of people/groups being affected by the below. On Mi 06 Mai 2015 19:35:32 CEST, Francesco Poli (wintermute) wrote: > Package: nx-libs-lite > Version: 3.5.0.27-1 > Severity: serious > Justification: Policy 2.2.1 > > Hello and thanks for maintaining this package in Debian! > > I noticed that the debian/copyright states: > > [...] > | Parts of this software are derived from DXPC project. These copyright > | notices apply to original DXPC code: > | > | Redistribution and use in source and binary forms are permitted prov= ided > | that the above copyright notice and this paragraph are duplicated in= all > | such forms. > | > | THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLI= ED > | WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF > | MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. > | > | Copyright (c) 1995,1996 Brian Pane > | Copyright (c) 1996,1997 Zachary Vonler and Brian Pane > | Copyright (c) 1999 Kevin Vigor and Brian Pane > | Copyright (c) 2000,2001 Gian Filippo Pinzari and Brian Pane > [...] > > This license lacks the permission to modify the DXPC code. > Hence, the original DXPC code does not appear to comply with the > DFSG. And the nx-libs-lite is in part derived from DXPC code. > > This basically means that nx-libs-lite includes parts which are > non-free (as they are derived from non-modifiable code) and > are also possibly legally undistributable (as they are non-modifiable, > but actually modified). The combination with the rest of nx-libs-lite > (which is GPL-licensed) may also be legally undistributable (since > the license with no permission to modify is GPL-incompatible). > > > If there's anything I misunderstood, please clarify. > > Otherwise, please address this issue as soon as possible. > The copyright owners for the original DXPC code should be > contacted and persuaded to re-license under GPL-compatible > terms. > > Thanks for your time. > Bye. I/we will investigate this asap. Thanks for bringing this up. Greets, Mike --=20 DAS-NETZWERKTEAM mike=20gabriel, herweg 7, 24357 fleckeby fon: +49 (1520) 1976 148 GnuPG Key ID 0x25771B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.x= fb --=_ALb-1vQm6P3YAYx12TU2SQ1 Content-Type: application/pgp-signature Content-Description: Digitale PGP-Signatur Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVUHFkAAoJEJr0azAldxsxbNYP/jqxwacIBSYlAhaZEf62JFtt ObBSEqUQfjljkolnzeaf2K4lBT6dl1x9VxGvIM5S8y9H/qpbFW+XWNHIR1BpdAsw TgKuqb6giM+28V9pMaHuqwPwMQ7YnFsfSKf/YCEs0AvJJKsf5jSUbeHAJ/RHwC4Z iGOj/KRqQ3tqIZJbzV2TCMNYnPm4sttcvKcRIOnBLDEVn1CRhlYX93v/pP87iPok wvvnbPpM+D2oq1JjS6mR2JbVHspc9/ZGq5I100Cdo5r3Y3upunNyG4IRCL0ttBzg nRjEiktViU/hhBB2xjYRaDsEpRFSsOeItLWss2PNYER2uIYuimvUsJzhtj7IwsV8 4J8wlvn0uRZRiQwSWI/UaL1r1eqI4AlMA4hzDnWR7cBB4nTNE6YWzTpYYhsqNVfJ jURTKIwGzDVVcpU5UZZhEtPcD5utkd8eYn4fA68pvkje3OFpLjfQnFWUcjIn5ywb mejuW08cnsdfB0he+NTFXpK4p4wiu92pqul/EqPKW3Dm1w7FZXPHpIkN6VQ03LdY kSXOOpITg8cHESsHlvyKIZITaLDrNAPB4RHkRxyWhRpZWgEM35FasE6hIRTbszQ9 jpuXcrG11L7HbITi599U8ZAo4qK9OgWfzJEsBdQKXBHEqCjiv4GvdXvgJyR2Eukp OIldtig78B5JgGKDLKjY =G+R6 -----END PGP SIGNATURE----- --=_ALb-1vQm6P3YAYx12TU2SQ1-- From X2Go-ML-1@baur-itcs.de Mon May 11 09:21:13 2015 Received: (at 784565) by bugs.debian.org; 11 May 2015 09:21:13 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-9.4 required=4.0 tests=BAYES_00,DIGITS_LETTERS, FOURLA,FVGT_m_MULTI_ODD,HAS_BUG_NUMBER,MONEY,PGPSIGNATURE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,STOCKLIKE autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 67; hammy, 149; neutral, 240; spammy, 1. spammytokens:0.997-1--jjng hammytokens:0.000-+--sk:iqecbae, 0.000-+--sk:iQEcBAE, 0.000-+--sha256, 0.000-+--SHA256, 0.000-+--H*UA:31.6.0 Return-path: Received: from mout.kundenserver.de ([212.227.17.10]) by buxtehude.debian.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yrjtg-0003AA-Jy for 784565@bugs.debian.org; Mon, 11 May 2015 09:21:13 +0000 Received: from [192.168.0.171] ([78.43.125.82]) by mrelayeu.kundenserver.de (mreue102) with ESMTPSA (Nemesis) id 0MBke7-1Z2Qat2SRz-00AqUz; Mon, 11 May 2015 11:20:48 +0200 Message-ID: <5550746E.1040707@baur-itcs.de> Date: Mon, 11 May 2015 11:20:46 +0200 From: Stefan Baur User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Mike Gabriel , "Francesco Poli (wintermute)" , 784565@bugs.debian.org CC: opensource@gznianguan.com, Nito Martinez , dktrkranz@debian.org, x2go-dev@lists.x2go.org Subject: Re: [X2Go-Dev] [pkg-x2go-devel] Bug#784565: nx-libs-lite: parts are derived from non-free code References: <20150511090748.Horde.Edus-FOfuc519TjISGi1vQ2@mail.das-netzwerkteam.de> In-Reply-To: <20150511090748.Horde.Edus-FOfuc519TjISGi1vQ2@mail.das-netzwerkteam.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:1hGpzbQ6YusgDW3LQNBHFEMw92BwlVIDUv6GGAN1bbqSykY6aoQ ekoiYjWtMWz72yWg8Xd5/k/PEjXU7VxzZNBzxoyEx46ughI6kPZG/kS6r+aMsjf3KVXNi4U da367A2ZowOeet1s6/LouBbblzzvjx7LF9SFO2TW4oakOyxhNCWEhVpveTV9FQPnavxZzhL D5GN1YjxQGdnacFHIIuSQ== X-UI-Out-Filterresults: notjunk:1; -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 hi everyone, looking at the current homepage of DXPC, the following can be found in their changelog http://www.vigor.nu/dxpc/CHANGES: 3.8.1 Release: [...] Changed license to BSD license. - -Stefan Am 11.05.2015 um 11:07 schrieb Mike Gabriel: > Hi Francesco, Cc:ing a couple of people/groups being affected by > the below. > > On Mi 06 Mai 2015 19:35:32 CEST, Francesco Poli (wintermute) > wrote: > >> Package: nx-libs-lite Version: 3.5.0.27-1 Severity: serious >> Justification: Policy 2.2.1 >> >> Hello and thanks for maintaining this package in Debian! >> >> I noticed that the debian/copyright states: >> >> [...] | Parts of this software are derived from DXPC project. >> These copyright | notices apply to original DXPC code: | | >> Redistribution and use in source and binary forms are permitted >> provided | that the above copyright notice and this paragraph >> are duplicated in all | such forms. | | THIS SOFTWARE IS >> PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED | >> WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES >> OF | MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | | >> Copyright (c) 1995,1996 Brian Pane | Copyright (c) 1996,1997 >> Zachary Vonler and Brian Pane | Copyright (c) 1999 Kevin Vigor >> and Brian Pane | Copyright (c) 2000,2001 Gian Filippo Pinzari >> and Brian Pane [...] >> >> This license lacks the permission to modify the DXPC code. Hence, >> the original DXPC code does not appear to comply with the DFSG. >> And the nx-libs-lite is in part derived from DXPC code. >> >> This basically means that nx-libs-lite includes parts which are >> non-free (as they are derived from non-modifiable code) and are >> also possibly legally undistributable (as they are >> non-modifiable, but actually modified). The combination with the >> rest of nx-libs-lite (which is GPL-licensed) may also be legally >> undistributable (since the license with no permission to modify >> is GPL-incompatible). >> >> >> If there's anything I misunderstood, please clarify. >> >> Otherwise, please address this issue as soon as possible. The >> copyright owners for the original DXPC code should be contacted >> and persuaded to re-license under GPL-compatible terms. >> >> Thanks for your time. Bye. > > I/we will investigate this asap. Thanks for bringing this up. > > Greets, Mike > > > _______________________________________________ x2go-dev mailing > list x2go-dev@lists.x2go.org > http://lists.x2go.org/listinfo/x2go-dev > - -- BAUR-ITCS UG (haftungsbeschränkt) Geschäftsführer: Stefan Baur Eichenäckerweg 10, 89081 Ulm | Registergericht Ulm, HRB 724364 Fon/Fax 0731 40 34 66-36/-35 | USt-IdNr.: DE268653243 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJVUHRuAAoJEG7d9BjNvlEZsCYH/i0GArfIg0xNQ91srhMtMxVf NcaQ5uOJLLZ+e0WOcRMm5Kprg9f6uKQNFRo1dv9NCFNxjrpdR/5/LMmeSYxafIQA beoYbnuMMRBvcjoUN5ScGD/jjng/9VCiwviBVjUc6AhDebGjVone2OtaIXPoMELI ClKnDShC41qQpSUgEESUYHiIIptkkmSrIJS6Ostsby5rhT1mApv7ulBqVvADUKCX OtNZmG+O6Bvur63G2fBTrdQwZAed0+Q6/XlhfOkf5QNG4I9fd5KlrMDpSmO8w7Cm h4rVnveLS5+0afZXs9sImhNW4I7Ah8zh5sAUFNCGXEuO60XRRysUO4i1WjRgnZw= =sgsA -----END PGP SIGNATURE----- From mike.gabriel@das-netzwerkteam.de Mon May 11 09:26:40 2015 Received: (at 784565) by bugs.debian.org; 11 May 2015 09:26:40 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-11.9 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,PGPSIGNATURE,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 15; hammy, 150; neutral, 246; spammy, 0. spammytokens: hammytokens:0.000-+--H*c:pgp-signature, 0.000-+--H*c:protocol, 0.000-+--H*c:micalg, 0.000-+--H*c:signed, 0.000-+--H*RU:sk:grimnir Return-path: Received: from freya.das-netzwerkteam.de ([88.198.48.199]) by buxtehude.debian.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Yrjyx-0003n8-Sv for 784565@bugs.debian.org; Mon, 11 May 2015 09:26:40 +0000 Received: from grimnir.das-netzwerkteam.de (grimnir.das-netzwerkteam.de [78.46.204.98]) by freya.das-netzwerkteam.de (Postfix) with ESMTPS id B938DE53; Mon, 11 May 2015 11:26:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id 564F73C20D; Mon, 11 May 2015 11:26:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at grimnir.das-netzwerkteam.de Received: from grimnir.das-netzwerkteam.de ([127.0.0.1]) by localhost (grimnir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zA86M1U+gj03; Mon, 11 May 2015 11:26:37 +0200 (CEST) Received: from grimnir.das-netzwerkteam.de (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTPS id E81223BF5A; Mon, 11 May 2015 11:26:36 +0200 (CEST) Received: from bifrost.das-netzwerkteam.de (bifrost.das-netzwerkteam.de [178.62.101.154]) by mail.das-netzwerkteam.de (Horde Framework) with HTTP; Mon, 11 May 2015 09:26:36 +0000 Date: Mon, 11 May 2015 09:26:36 +0000 Message-ID: <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> From: Mike Gabriel To: "Francesco Poli (wintermute)" , 784565@bugs.debian.org Cc: x2go-dev@lists.x2go.org, nito.martinez@qindel.com, opensource@gznianguan.com Subject: Re: [pkg-x2go-devel] Bug#784565: nx-libs-lite: parts are derived from non-free code In-Reply-To: <20150506173532.7531.31389.reportbug@homebrew> User-Agent: Internet Messaging Program (IMP) H5 (6.2.2) Accept-Language: de,en Organization: DAS-NETZWERKTEAM X-Originating-IP: 178.62.101.154 X-Remote-Browser: Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0 Iceweasel/32.0 Content-Type: multipart/signed; boundary="=_8dL5yJABYXdTfUqhzQkNVg1"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 This message is in MIME format and has been PGP signed. --=_8dL5yJABYXdTfUqhzQkNVg1 Content-Type: text/plain; charset=us-ascii; format=flowed; DelSp=Yes Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Francesco, On Mi 06 Mai 2015 19:35:32 CEST, Francesco Poli (wintermute) wrote: > Package: nx-libs-lite > Version: 3.5.0.27-1 > Severity: serious > Justification: Policy 2.2.1 > > Hello and thanks for maintaining this package in Debian! > > I noticed that the debian/copyright states: > > [...] > | Parts of this software are derived from DXPC project. These copyright > | notices apply to original DXPC code: > | > | Redistribution and use in source and binary forms are permitted prov= ided > | that the above copyright notice and this paragraph are duplicated in= all > | such forms. > | > | THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLI= ED > | WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF > | MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. > | > | Copyright (c) 1995,1996 Brian Pane > | Copyright (c) 1996,1997 Zachary Vonler and Brian Pane > | Copyright (c) 1999 Kevin Vigor and Brian Pane > | Copyright (c) 2000,2001 Gian Filippo Pinzari and Brian Pane > [...] > > This license lacks the permission to modify the DXPC code. > Hence, the original DXPC code does not appear to comply with the > DFSG. And the nx-libs-lite is in part derived from DXPC code. > > This basically means that nx-libs-lite includes parts which are > non-free (as they are derived from non-modifiable code) and > are also possibly legally undistributable (as they are non-modifiable, > but actually modified). The combination with the rest of nx-libs-lite > (which is GPL-licensed) may also be legally undistributable (since > the license with no permission to modify is GPL-incompatible). > > > If there's anything I misunderstood, please clarify. > > Otherwise, please address this issue as soon as possible. > The copyright owners for the original DXPC code should be > contacted and persuaded to re-license under GPL-compatible > terms. > > Thanks for your time. > Bye. Please follow-up with reading [1]. As it seems, dxpc has been long ago relicensed to BSD-2-clause (for=20=20 v3.8.1=20in/around 2002). I have no exact clue, if NoMachine forked prior to that (if they quote=20= =20 the=20old licensing terms, then probably they did). However, how do you see the situation considering that upstream=20=20 changed=20to BSD-2-clause a long time ago. What approach do you propose=20= =20 for=20nx-libs-lite to get the issue fully fixed? Mike [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D142028 --=20 DAS-NETZWERKTEAM mike=20gabriel, herweg 7, 24357 fleckeby fon: +49 (1520) 1976 148 GnuPG Key ID 0x25771B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.x= fb --=_8dL5yJABYXdTfUqhzQkNVg1 Content-Type: application/pgp-signature Content-Description: Digitale PGP-Signatur Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVUHXMAAoJEJr0azAldxsxls4P/RyFv6ghemJhfrHNbAUEDmNz kyY2Q4Jt6pIDXX3U3yThYCeyG1nVAwKJI2B/q7q/YWWdzea8RzTTXrj3DubYplOZ PatD30FhlKdL+rsohmLFrA5dHVcwFbJA4GqrR2Y8y6NSLEtifYE4EDIDKLqvX6Dy msvHyLl+3AXg2gR4Wmu9lOLC8MrPA3A7nwlw/wCa6kwf3i6FUsAB2nzUsj3yUX1f 4iXzcZhjGCJli9otPLlYFjPuc0HjwBgoOx5tEOL1hgVYP+yiQCw24LOKwHTnDogZ ONio1VdS+VPUbhVTlBfYD29lSDO8pgBGk43325b7Bmo56Ica+HCr8TznMVASidvJ dbAXZQOMuHxBofP9sm89q2lIXjPmJFWspG76OEM8dAIMKo87gQNuOTNPuOK0Zj8T Ua+40fIc5/C7CyRgGO8wqb6dYjD4Q6HxbjSQJrlxsHdjKIozv+MXGV+if/bKSXM8 tIAh9JzcwgYtRVlVQXCmpk+yP9DntWFs5WeOEGBqKZw+was5OSXSlpjukNn9us2a bWj0E84zMlIu61KVZ8ot14OMIzgUxzymIt/LzWHKiiSezb20S22LJGBaKLxbqplp 9Gi8g9rEhjn5Pgpt9B3MlIWQTKhpAa71GCD9Okt9vhPsBiKE57fSjCYgQR83lhDy kbLoUbByjixBA+TXUYM8 =NW/2 -----END PGP SIGNATURE----- --=_8dL5yJABYXdTfUqhzQkNVg1-- From invernomuto@paranoici.org Mon May 11 19:37:54 2015 Received: (at 784565) by bugs.debian.org; 11 May 2015 19:37:54 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=4.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FOURLA,HAS_BUG_NUMBER,MDO_CABLE_TV3,PGPSIGNATURE, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 9; hammy, 150; neutral, 119; spammy, 0. spammytokens: hammytokens:0.000-+--H*UA:sk:x86_64-, 0.000-+--H*x:sk:x86_64-, 0.000-+--H*c:PGP-SHA256, 0.000-+--H*c:SignHturH, 0.000-+--H*c:pgp-signature Return-path: Received: from perdizione.investici.org ([94.23.50.208]) by buxtehude.debian.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YrtWT-0004t9-Ty for 784565@bugs.debian.org; Mon, 11 May 2015 19:37:54 +0000 Received: from [94.23.50.208] (perdizione [94.23.50.208]) (Authenticated sender: invernomuto@paranoici.org) by localhost (Postfix) with ESMTPSA id 9C4DF120408; Mon, 11 May 2015 19:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paranoici.org; s=stigmate; t=1431373066; bh=vGWv2ZFJgWpWShHOYFcPN0r6i8IFunsxG5IJHqxpdbk=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=JQRMmMDPSZFkJ21FEn1TdsCco0YtUFBII0CsMLxdl3mxM5SzGN9flVttwlZ+5RrgR a7/u/VUVPzv0ZcdVKwrC+Nq6imwd5hzUj80C+e6KLZQoovz6shmhuIdKtga2OIl7lm cF0ONDqjdq0pI158Ws5hz0MiwJkzF6V5VbIEk3SY= Received: from frx by homebrew with local (Exim 4.85) (envelope-from ) id 1YrtVj-0001Cl-NV; Mon, 11 May 2015 21:37:07 +0200 Date: Mon, 11 May 2015 21:36:59 +0200 From: Francesco Poli To: Mike Gabriel Cc: 784565@bugs.debian.org, x2go-dev@lists.x2go.org, nito.martinez@qindel.com, opensource@gznianguan.com Subject: Re: [pkg-x2go-devel] Bug#784565: nx-libs-lite: parts are derived from non-free code Message-Id: <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> In-Reply-To: <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> X-Mailer: Sylpheed 3.5.0beta1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA256"; boundary="Signature=_Mon__11_May_2015_21_36_59_+0200_DweA9EbdD2ISBmUH" --Signature=_Mon__11_May_2015_21_36_59_+0200_DweA9EbdD2ISBmUH Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, 11 May 2015 09:26:36 +0000 Mike Gabriel wrote: [...] > As it seems, dxpc has been long ago relicensed to BSD-2-clause (for =20 > v3.8.1 in/around 2002). This is great news, indeed! >=20 > I have no exact clue, if NoMachine forked prior to that (if they quote =20 > the old licensing terms, then probably they did). Yep, it's plausible... >=20 > However, how do you see the situation considering that upstream =20 > changed to BSD-2-clause a long time ago. What approach do you propose =20 > for nx-libs-lite to get the issue fully fixed? If the fork has been performed before the DXPC re-licensing (as it's likely), I see two possible strategies: (A) someone gets in touch with DXPC copyright owners and asks them whether the re-licensing may be considered retroactive (applicable to older versions of DXPC); in case the answer is negative, DXPC copyright owners should be persuaded to make the re-licensing retroactive (B) nx-libs-lite upstream developers re-fork from scratch, basing the new code on a BSD-licensed version of DXPC (I suspect this may turn out to be somewhat painful...) Obviously, the optimal solution is (A). I hope it may work... Thanks for your time and for your prompt and kind replies. --=20 http://www.inventati.org/frx/ There's not a second to spare! To the laboratory! ..................................................... Francesco Poli . GnuPG key fpr =3D=3D CA01 1147 9CD2 EFDF FB82 3925 3E1C 27E1 1F69 BFFE --Signature=_Mon__11_May_2015_21_36_59_+0200_DweA9EbdD2ISBmUH Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVUQTgAAoJED4cJ+Efab/+Mx4QAMLmPwqnPYyI0Bl6sZgxP3nA Yfrf7m2+swTrNz3M2xNepx1KoylRNlz2DiCuG7QWABNupSK60ACtIuAvWIAPSYNt wlHDRGiVrpCKBKzB4N3zjB0MN1VELhdWqrap8Yw5nnwohJ2jXoAUaqorwEba6YBg VK1BsGvlqcwSYt8eWt+ugpaRR43DbZTCpAvBn3t9DdYe8LwtlJDTCatbJfovlTJ9 P19TNbwxiEoj8uWbmpOO/kLvvMed0avTEsvgAROQKF/dnWCnB1dh5QGd06IHdAY7 KfnoZc4HUM8BB/ylWsaV13Cd8UA/2B2FKp3xbab3ry8gWeMe6dnk/pFa+pv6TGeT I+6VxWOMT/hc4AwBOl+R7yqp2AkcNO+KP2o5i04+yENcbgrGxyCQU2aVsHkJsVYi N5myXypSZY3tF6TnAm/UYP2GgiMCo0FXptwVoLiGSJkBw0tn13I25pYSqjYZlq4q 4RQYuTEHEkV16tCdEdy+DSuI0GsABYUkY3a3A3TLj9LjiPPEDwLOxHjZlLbeyXP+ xtmC3d82YvMmLXUiqItuhiBYjCRFq8piGGCDRX7wp1B+t6xHUcR8UV5O4s554iMX +r2m1mLzM285PoKwP/Smd6BXU5RfhT4svmxvaMSSvADNo8X4ddNd2Hiq/Gib2ftH mYKFpBE7IMwQqfrOpAW5 =Bt09 -----END PGP SIGNATURE----- --Signature=_Mon__11_May_2015_21_36_59_+0200_DweA9EbdD2ISBmUH-- From mike.gabriel@das-netzwerkteam.de Tue May 12 03:59:27 2015 Received: (at 784565) by bugs.debian.org; 12 May 2015 03:59:27 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-11.4 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,MDO_CABLE_TV3,PGPSIGNATURE,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 21; hammy, 150; neutral, 206; spammy, 0. spammytokens: hammytokens:0.000-+--H*c:pgp-signature, 0.000-+--H*c:protocol, 0.000-+--H*c:micalg, 0.000-+--H*c:signed, 0.000-+--H*RU:sk:grimnir Return-path: Received: from freya.das-netzwerkteam.de ([88.198.48.199]) by buxtehude.debian.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Ys1Lq-0000j4-Sf for 784565@bugs.debian.org; Tue, 12 May 2015 03:59:27 +0000 Received: from grimnir.das-netzwerkteam.de (grimnir.das-netzwerkteam.de [78.46.204.98]) by freya.das-netzwerkteam.de (Postfix) with ESMTPS id B4F9BAA3; Tue, 12 May 2015 05:59:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id 299233C21D; Tue, 12 May 2015 05:59:21 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at grimnir.das-netzwerkteam.de Received: from grimnir.das-netzwerkteam.de ([127.0.0.1]) by localhost (grimnir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G2j6l6YtFs0q; Tue, 12 May 2015 05:59:21 +0200 (CEST) Received: from grimnir.das-netzwerkteam.de (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTPS id C67023BF5A; Tue, 12 May 2015 05:59:20 +0200 (CEST) Received: from p5B3B925B.dip0.t-ipconnect.de (p5B3B925B.dip0.t-ipconnect.de [91.59.146.91]) by mail.das-netzwerkteam.de (Horde Framework) with HTTP; Tue, 12 May 2015 03:59:20 +0000 Date: Tue, 12 May 2015 03:59:20 +0000 Message-ID: <20150512035920.Horde.JnI2DWx-AAFvzpbQFqakJw3@mail.das-netzwerkteam.de> From: Mike Gabriel To: Francesco Poli Cc: 784565@bugs.debian.org, x2go-dev@lists.x2go.org, nito.martinez@qindel.com, opensource@gznianguan.com Subject: Re: [pkg-x2go-devel] Bug#784565: nx-libs-lite: parts are derived from non-free code References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> In-Reply-To: <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> User-Agent: Internet Messaging Program (IMP) H5 (6.2.2) Accept-Language: de,en Organization: DAS-NETZWERKTEAM X-Originating-IP: 91.59.146.91 X-Remote-Browser: Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0 Iceweasel/32.0 Content-Type: multipart/signed; boundary="=_kYZkQgyfaSLUTLVIkzgq8w1"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 This message is in MIME format and has been PGP signed. --=_kYZkQgyfaSLUTLVIkzgq8w1 Content-Type: text/plain; charset=us-ascii; format=flowed; DelSp=Yes Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Francesco, On Mo 11 Mai 2015 21:36:59 CEST, Francesco Poli wrote: > On Mon, 11 May 2015 09:26:36 +0000 Mike Gabriel wrote: > > [...] >> As it seems, dxpc has been long ago relicensed to BSD-2-clause (for >> v3.8.1 in/around 2002). > > This is great news, indeed! > >> >> I have no exact clue, if NoMachine forked prior to that (if they quote >> the old licensing terms, then probably they did). > > Yep, it's plausible... > >> >> However, how do you see the situation considering that upstream >> changed to BSD-2-clause a long time ago. What approach do you propose >> for nx-libs-lite to get the issue fully fixed? > > If the fork has been performed before the DXPC re-licensing (as it's > likely), I see two possible strategies: > > (A) someone gets in touch with DXPC copyright owners and asks them > whether the re-licensing may be considered retroactive (applicable to > older versions of DXPC); in case the answer is negative, DXPC copyright > owners should be persuaded to make the re-licensing retroactive This is the way to go, I will pull in Kevin Vigor (the upstream author=20= =20 of=20DXPC) into this thread with my next email. > (B) nx-libs-lite upstream developers re-fork from scratch, basing the > new code on a BSD-licensed version of DXPC (I suspect this may turn out > to be somewhat painful...) Yeah, indeed painful. > Obviously, the optimal solution is (A). I hope it may work... > > Thanks for your time and for your prompt and kind replies. Also, Michael DePaulo, one of the upstream NX maintainers noted that=20=20 DXPC=20simply used a previous version of the BSD license, see [1]. The=20= =20 weakness=20of that ancient license template is that modification is not=20= =20 explictily=20allowed, but neither forbidden. I think, regarding the historical usage of the BSD license predecessor=20= =20 and=20the switch to BSD-2-clause should be fine already (I am not a=20=20 lawyer,=20though). I will contact DXPC upstream nonetheless and ask for=20= =20 a=20statement. Greets, Mike [1] http://en.wikipedia.org/wiki/BSD_licenses#Previous_license --=20 DAS-NETZWERKTEAM mike=20gabriel, herweg 7, 24357 fleckeby fon: +49 (1520) 1976 148 GnuPG Key ID 0x25771B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.x= fb --=_kYZkQgyfaSLUTLVIkzgq8w1 Content-Type: application/pgp-signature Content-Description: Digitale PGP-Signatur Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIbBAABAgAGBQJVUXqYAAoJEJr0azAldxsxYVAP+Pg4A2zg6TEs+vk/mknbLwV2 dOv/tQiarKfb6JJRcm1j6rzGBhGzO4iwj/Uk8wmbFvIJgxs6mM93kfOPa0lJYM1N D0YcKPPsHqgxcyVW8pIyawhnW5IsIDSaugjsandx1hbfl+J5SBCAtSovhz5F+Fkf fs1wvgYcGKtWGNTxV5Qy48EnzSzAVz2r4GKBYUdRiCNpXtl/M8jJFIfm/cmJ7PJq ycY8Diu6x3mVvPdvap/0pOOY0uqg256XX7dcFJUtTNZoai4oGOuwR1o4g9jztyd/ 4JJ2E1MigAjGSYPpTnQGhORA86yDLQrk/NlLG/2/J8meG7Nsky6xmf3zBhuG/0G0 3TZYQcoFrFS3EWQs0uKiGKGylchODCfXHZgF0y5NT5iqr4DMT51AlUeQl3MWhxf8 j8OMjK86jsPMrSjL0l4uYbs+znMdlVpgjBSYsKoXg3tIc3WJpj77qyPUbfwO8hys 5Q2j4lDaGV5NAnSmZ//p9lPwRu8oAMwSkrMkRTaJwLVhcmDzgoujZEpEPj64lIEy HD3p/5dSJF+RsYT6286JkWAZm+XvXeFpEqGZ7xAVsrYSY1qFm3g0se1oHxxcVWyN PEsQBOt8WXgYmtz7RLaBDbBQVMmeRMxbPCkC1xCHCU+Vq3y9dW/3TyOW4Oz1YoZR 3YATO+YehUKVdM5teyg= =884K -----END PGP SIGNATURE----- --=_kYZkQgyfaSLUTLVIkzgq8w1-- From mike.gabriel@das-netzwerkteam.de Tue May 12 04:46:43 2015 Received: (at 784565) by bugs.debian.org; 12 May 2015 04:46:44 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-11.4 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,MDO_CABLE_TV3,PGPSIGNATURE,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 27; hammy, 149; neutral, 375; spammy, 1. spammytokens:0.998-1--arctica hammytokens:0.000-+--IIRC, 0.000-+--H*c:pgp-signature, 0.000-+--H*c:protocol, 0.000-+--H*c:micalg, 0.000-+--H*c:signed Return-path: Received: from freya.das-netzwerkteam.de ([88.198.48.199]) by buxtehude.debian.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Ys25b-0004lf-4r for 784565@bugs.debian.org; Tue, 12 May 2015 04:46:43 +0000 Received: from grimnir.das-netzwerkteam.de (grimnir.das-netzwerkteam.de [78.46.204.98]) by freya.das-netzwerkteam.de (Postfix) with ESMTPS id 6AB7617F5; Tue, 12 May 2015 06:46:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id 71D923BC0D; Tue, 12 May 2015 06:46:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at grimnir.das-netzwerkteam.de Received: from grimnir.das-netzwerkteam.de ([127.0.0.1]) by localhost (grimnir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TYvbPGLabTH7; Tue, 12 May 2015 06:46:38 +0200 (CEST) Received: from grimnir.das-netzwerkteam.de (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTPS id 0669F3BA08; Tue, 12 May 2015 06:46:38 +0200 (CEST) Received: from p5B3B925B.dip0.t-ipconnect.de (p5B3B925B.dip0.t-ipconnect.de [91.59.146.91]) by mail.das-netzwerkteam.de (Horde Framework) with HTTP; Tue, 12 May 2015 04:46:37 +0000 Date: Tue, 12 May 2015 04:46:37 +0000 Message-ID: <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> From: Mike Gabriel To: Kevin Vigor Cc: 784565@bugs.debian.org, x2go-dev@lists.x2go.org, nito.martinez@qindel.com, opensource@gznianguan.com, Francesco Poli Subject: Re: [pkg-x2go-devel] Bug#784565: nx-libs-lite: parts are derived from non-free code References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> In-Reply-To: <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> User-Agent: Internet Messaging Program (IMP) H5 (6.2.2) Accept-Language: de,en Organization: DAS-NETZWERKTEAM X-Originating-IP: 91.59.146.91 X-Remote-Browser: Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0 Iceweasel/32.0 Content-Type: multipart/signed; boundary="=_9zX_XixEpAdR4NT64zJguA1"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 This message is in MIME format and has been PGP signed. --=_9zX_XixEpAdR4NT64zJguA1 Content-Type: text/plain; charset=us-ascii; format=flowed; DelSp=Yes Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Dear Kevin, (I Cc: several people involved in this, also the X2Go development=20=20 mailing=20list...) [If you feel unconfortable with discussing the details / the impact of=20= =20 the=20below in public, feel free to answer to me directly first with=20=20 questions=20and concerns, before answering to all people who are listed=20= =20 in=20Cc:.] Someone from the Debian legal team recently brought up a license issue=20= =20 discovered=20in nx-libs 3.x series. TL;DR; Suggested by Francesco Poli from the Debian legal team: """ (A) someone gets in touch with DXPC copyright owners and asks them whether the re-licensing [in 2002] may be considered retroactive=20=20 (applicable=20to older versions of DXPC); in case the answer is negative, DXPC copyright owners should be persuaded to make the re-licensing retroactive """ The person contacting you about the above question is me. Mike=20=20 Gabriel,=20Debian Developer and one of the current upstream maintainers=20= =20 of=20nx-libs 3.x (previously also know as "NX redistributed" for X2Go)=20= =20 [1]. This=20issue requires some time of reading from you and (hopefully) a=20=20 public=20statement, that the original DXPC code can be considered as=20=20 BSD-2-clause=20(the current license) also for released versions prior=20=20 2002=20when the ancient BSD license template [2] was still shipped with=20= =20 DXPC. For=20a complete follow-up, please check Debian bug #784565 [3]. We are aware that NoMachine forked DXPC at some early stage around the=20= =20 year=202000 and wrote their own commercial product around it. Obviously,=20= =20 this=20fork happened before 2002 (i.e., before DXPC release 3.8.1), as=20= =20 libxcomp3=20in NoMachine's NX ships the previously used BSD license=20=20 template.=20I am not sure, if that fork was easy for you or actually a=20= =20 nuisance.=20I may only guess at this point. I'd be happy to know more=20=20 (maybe=20not in this mail thread, though). NoMachine has stopped publishing NXv3 updates a couple of years ago=20=20 (2011=20IIRC), now. The maintenance has been moved into the hands of the=20= =20 currently=20available FLOSS projects "X2Go", "Arctica Project" [NEW] and=20= =20 "TheQVD".=20Some of us are running a business model on top of that=20=20 (consultancy,=20support contracts, feature development contracts), some=20= =20 of=20us spend a lot of their free time on improving / maintaining=20=20 nx-libs=20(as we call NoMachine's NXv3 at the moment). To outline the impact of my mail clearly: If you say that it was not=20=20 legal=20by NoMachine to fork DXPC at the given time (before 2002), then=20= =20 all=20FLOSS remote desktop / remote application would be in real=20=20 trouble,=20because then the core component of their software projects=20=20 could=20not be considered as free (as in DFSG, Debian free software=20=20 guidelines[4])=20anymore. Also the code changes originally performed by=20= =20 NoMachine=20might have been illegal in the first place. All current=20=20 maintenance=20activities and also planned future development on nx-libs=20= =20 would=20become questionable. Thus, I hope you can chime in on this: Dear developers of nx-libs,=20=20 please=20assume the BSD-2-license as retroactive and applicable to DXPC=20= =20 version=20earlier than 3.8.1. As the copyright holder, I agree with=20=20 modifications=20of code bases that originate before the change to=20=20 BSD-2-clause=20license got introduced in 3.8.1 of DXPC. And... I will bring up that question later (but it is burning under my=20= =20 nails)...=20Be sure: The nx-libs maintainers would be happy to have the=20= =20 original=20DXPC author on the nx-libs developer team. But I will bring=20= =20 up=20that question later (when this very issue is settled). ;-) Greets, Mike [1] https://github.com/ArcticaProject/nx-libs [2] http://en.wikipedia.org/wiki/BSD_licenses#Previous_license [3] http://bugs.debian.org/784565 [4] http://de.wikipedia.org/wiki/Debian_Free_Software_Guidelines On Mo 11 Mai 2015 21:36:59 CEST, Francesco Poli wrote: > On Mon, 11 May 2015 09:26:36 +0000 Mike Gabriel wrote: > > [...] >> As it seems, dxpc has been long ago relicensed to BSD-2-clause (for >> v3.8.1 in/around 2002). > > This is great news, indeed! > >> >> I have no exact clue, if NoMachine forked prior to that (if they quote >> the old licensing terms, then probably they did). > > Yep, it's plausible... > >> >> However, how do you see the situation considering that upstream >> changed to BSD-2-clause a long time ago. What approach do you propose >> for nx-libs-lite to get the issue fully fixed? > > If the fork has been performed before the DXPC re-licensing (as it's > likely), I see two possible strategies: > > (A) someone gets in touch with DXPC copyright owners and asks them > whether the re-licensing may be considered retroactive (applicable to > older versions of DXPC); in case the answer is negative, DXPC copyright > owners should be persuaded to make the re-licensing retroactive > > (B) nx-libs-lite upstream developers re-fork from scratch, basing the > new code on a BSD-licensed version of DXPC (I suspect this may turn out > to be somewhat painful...) > > > Obviously, the optimal solution is (A). I hope it may work... > > Thanks for your time and for your prompt and kind replies. --=20 DAS-NETZWERKTEAM mike=20gabriel, herweg 7, 24357 fleckeby fon: +49 (1520) 1976 148 GnuPG Key ID 0x25771B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.x= fb --=_9zX_XixEpAdR4NT64zJguA1 Content-Type: application/pgp-signature Content-Description: Digitale PGP-Signatur Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVUYWtAAoJEJr0azAldxsxEMcP/0mjNHW4k/IiNjSbrm1j7pIQ k6yVqJ8cMW/71H0/VLuzS6roL02JAXMzToMzAcbPGqeV5rjhLDJNjcOuuADhb8HI Izisai5ABzHiclnITalVTsF4i5+MsTXI+6eNez9sv3Es8pwFuLkvAlqKsheO33mP dz83ZqDmCGKcCCbZmhbhGHdhScS8GMSyU7cBm6xu0TMh8rOtcECBG/+wfohVeR2I vy0GeYR0ZF0yIxcBGXYvjiocStjsxaqnD9QCt8JAfewVO3jY/Ye6DIEI92moS/Nz 6iTA9GspZyYNqL7QsOraG2HF6TmIfK5xBaUjDrLH+HfKm2K6Dxp0wo6Y6VDY9mIi svCFCoIQ3RBihcsOp7k1v1eZl+WJJ2XXilQr3SrtlOiZAK0/FtbkUwhk4DLu5o3R CBHwy6F14szo8F4ChFGqqbOlODGJOiCONfOShRZQLgAgHciRirrgTKF4b25cspNU v7ag47K4WN3YNtkA5DO5Bj2NKAP8oWyvlTpO0uIuUZo/pj+7sHnWG8QSDJiyunVt 3VxMLM4h3C02k+EtR2uvtKKqVFf+JgiwRGDhFx2ldUwWFg0+3IeWKuuTxRt6NcR+ ZdDN2tR0PWpe4v+jsUqSD3YJNRoK1oyj9kMYriTkHTvhr/XcKr5KYNsWMC6nvqps JDhKCpypB1iR9N13NpeX =HDe/ -----END PGP SIGNATURE----- --=_9zX_XixEpAdR4NT64zJguA1-- From kevin@vigor.nu Tue May 12 15:07:38 2015 Received: (at 784565) by bugs.debian.org; 12 May 2015 15:07:38 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,MDO_CABLE_TV3,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 34; hammy, 150; neutral, 395; spammy, 0. spammytokens: hammytokens:0.000-+--IIRC, 0.000-+--H*f:sk:2015050, 0.000-+--H*UA:31.0, 0.000-+--H*u:31.0, 0.000-+--H*u:x86_64 Return-path: Received: from gateway30.websitewelcome.com ([192.185.184.48]) by buxtehude.debian.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YsBmT-0007o6-Qg for 784565@bugs.debian.org; Tue, 12 May 2015 15:07:38 +0000 Received: by gateway30.websitewelcome.com (Postfix, from userid 500) id 69AEB573DA20; Tue, 12 May 2015 09:55:02 -0500 (CDT) Received: from gator4058.hostgator.com (gator4058.hostgator.com [192.185.4.69]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 677E2573DA04 for <784565@bugs.debian.org>; Tue, 12 May 2015 09:55:02 -0500 (CDT) Received: from [63.158.132.10] (port=46206 helo=[10.50.3.84]) by gator4058.hostgator.com with esmtpsa (UNKNOWN:DHE-RSA-AES128-SHA:128) (Exim 4.82) (envelope-from ) id 1YsBaH-0003xr-Ii; Tue, 12 May 2015 09:55:01 -0500 Message-ID: <55521444.9090407@vigor.nu> Date: Tue, 12 May 2015 08:55:00 -0600 From: Kevin Vigor User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Mike Gabriel CC: 784565@bugs.debian.org, x2go-dev@lists.x2go.org, nito.martinez@qindel.com, opensource@gznianguan.com, Francesco Poli Subject: Re: [pkg-x2go-devel] Bug#784565: nx-libs-lite: parts are derived from non-free code References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> In-Reply-To: <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4058.hostgator.com X-AntiAbuse: Original Domain - bugs.debian.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - vigor.nu X-BWhitelist: no X-Source-IP: 63.158.132.10 X-Exim-ID: 1YsBaH-0003xr-Ii X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([10.50.3.84]) [63.158.132.10]:46206 X-Source-Auth: kevin@vigor.nu X-Email-Count: 2 X-Source-Cap: a3ZpZ29yO2t2aWdvcjtnYXRvcjQwNTguaG9zdGdhdG9yLmNvbQ== X-Greylist: delayed 379 seconds by postgrey-1.34 at buxtehude; Tue, 12 May 2015 15:07:37 UTC Hi Mike, et al, I am not the original author of dxpc, that being Brian Pane. However, I took over maintenance circa 1999 and am still the primary maintainer (though the project has effectively been dead for most of a decade now). As you are aware, when I inherited the code, it was licensed under a variant of the BSD license that did not include the 'with modification' clause. To the best of my recollection, somebody from the FSF contacted me circa 2001 regarding this and as a result, subsequent releases were done under a standard 2-clause BSD license with the modification clause. Again, to the best of my recollection, I contacted Brian about this change and he offered no objection. Further, I recall distinctly that NoMachine contacted me and explicitly asked permission before including DXPC code in NX, which I happily granted with no new conditions beyond the BSD license already in play. It is possible, though by no means certain, that I could dig up ancient email to corroborate this account if necessary. However, I am more than willing to publicly state that I believe NoMachine's use of DXPC code to be both legal and ethical, and that my intent when changing the license to 2-clause BSD was simply to clarity the existing intent and that it ought therefore be considered retroactive. Yours, Kevin Vigor On 05/11/15 22:46, Mike Gabriel wrote: > Dear Kevin, > > (I Cc: several people involved in this, also the X2Go development mailing list...) > > [If you feel unconfortable with discussing the details / the impact of the below in public, feel free to answer to me directly first with questions and concerns, before answering to all people who are listed in Cc:.] > > Someone from the Debian legal team recently brought up a license issue discovered in nx-libs 3.x series. > > TL;DR; Suggested by Francesco Poli from the Debian legal team: """ > (A) someone gets in touch with DXPC copyright owners and asks them > whether the re-licensing [in 2002] may be considered retroactive (applicable to > older versions of DXPC); in case the answer is negative, DXPC copyright > owners should be persuaded to make the re-licensing retroactive > """ > > The person contacting you about the above question is me. Mike Gabriel, Debian Developer and one of the current upstream maintainers of nx-libs 3.x (previously also know as "NX redistributed" for X2Go) [1]. > > This issue requires some time of reading from you and (hopefully) a public statement, that the original DXPC code can be considered as BSD-2-clause (the current license) also for released versions prior 2002 when the ancient BSD license template [2] was still shipped with DXPC. > > For a complete follow-up, please check Debian bug #784565 [3]. > > We are aware that NoMachine forked DXPC at some early stage around the year 2000 and wrote their own commercial product around it. Obviously, this fork happened before 2002 (i.e., before DXPC release 3.8.1), as libxcomp3 in NoMachine's NX ships the previously used BSD license template. I am not sure, if that fork was easy for you or actually a nuisance. I may only guess at this point. I'd be happy to know more (maybe not in this mail thread, though). > > NoMachine has stopped publishing NXv3 updates a couple of years ago (2011 IIRC), now. The maintenance has been moved into the hands of the currently available FLOSS projects "X2Go", "Arctica Project" [NEW] and "TheQVD". Some of us are running a business model on top of that (consultancy, support contracts, feature development contracts), some of us spend a lot of their free time on improving / maintaining nx-libs (as we call NoMachine's NXv3 at the moment). > > To outline the impact of my mail clearly: If you say that it was not legal by NoMachine to fork DXPC at the given time (before 2002), then all FLOSS remote desktop / remote application would be in real trouble, because then the core component of their software projects could not be considered as free (as in DFSG, Debian free software guidelines[4]) anymore. Also the code changes originally performed by NoMachine might have been illegal in the first place. All current maintenance activities and also planned future development on nx-libs would become questionable. > > Thus, I hope you can chime in on this: Dear developers of nx-libs, please assume the BSD-2-license as retroactive and applicable to DXPC version earlier than 3.8.1. As the copyright holder, I agree with modifications of code bases that originate before the change to BSD-2-clause license got introduced in 3.8.1 of DXPC. > > And... I will bring up that question later (but it is burning under my nails)... Be sure: The nx-libs maintainers would be happy to have the original DXPC author on the nx-libs developer team. But I will bring up that question later (when this very issue is settled). ;-) > > Greets, > Mike > > [1] https://github.com/ArcticaProject/nx-libs > [2] http://en.wikipedia.org/wiki/BSD_licenses#Previous_license > [3] http://bugs.debian.org/784565 > [4] http://de.wikipedia.org/wiki/Debian_Free_Software_Guidelines > > On Mo 11 Mai 2015 21:36:59 CEST, Francesco Poli wrote: > >> On Mon, 11 May 2015 09:26:36 +0000 Mike Gabriel wrote: >> >> [...] >>> As it seems, dxpc has been long ago relicensed to BSD-2-clause (for >>> v3.8.1 in/around 2002). >> >> This is great news, indeed! >> >>> >>> I have no exact clue, if NoMachine forked prior to that (if they quote >>> the old licensing terms, then probably they did). >> >> Yep, it's plausible... >> >>> >>> However, how do you see the situation considering that upstream >>> changed to BSD-2-clause a long time ago. What approach do you propose >>> for nx-libs-lite to get the issue fully fixed? >> >> If the fork has been performed before the DXPC re-licensing (as it's >> likely), I see two possible strategies: >> >> (A) someone gets in touch with DXPC copyright owners and asks them >> whether the re-licensing may be considered retroactive (applicable to >> older versions of DXPC); in case the answer is negative, DXPC copyright >> owners should be persuaded to make the re-licensing retroactive >> >> (B) nx-libs-lite upstream developers re-fork from scratch, basing the >> new code on a BSD-licensed version of DXPC (I suspect this may turn out >> to be somewhat painful...) >> >> >> Obviously, the optimal solution is (A). I hope it may work... >> >> Thanks for your time and for your prompt and kind replies. > > From mike.gabriel@das-netzwerkteam.de Tue May 12 15:42:13 2015 Received: (at 784565) by bugs.debian.org; 12 May 2015 15:42:13 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,MDO_CABLE_TV3,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 28; hammy, 150; neutral, 444; spammy, 0. spammytokens: hammytokens:0.000-+--IIRC, 0.000-+--H*RU:sk:grimnir, 0.000-+--H*r:sk:grimnir, 0.000-+--H*RU:78.46.204.98, 0.000-+--H*RU:88.198.48.199 Return-path: Received: from freya.das-netzwerkteam.de ([88.198.48.199]) by buxtehude.debian.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YsCJx-0003Fj-12 for 784565@bugs.debian.org; Tue, 12 May 2015 15:42:13 +0000 Received: from grimnir.das-netzwerkteam.de (grimnir.das-netzwerkteam.de [78.46.204.98]) by freya.das-netzwerkteam.de (Postfix) with ESMTPS id AB2291F6 for <784565@bugs.debian.org>; Tue, 12 May 2015 17:42:08 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id 0899C3BFDA for <784565@bugs.debian.org>; Tue, 12 May 2015 17:42:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at grimnir.das-netzwerkteam.de Received: from grimnir.das-netzwerkteam.de ([127.0.0.1]) by localhost (grimnir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tKjFu527nUiq for <784565@bugs.debian.org>; Tue, 12 May 2015 17:42:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id 558633C022 for <784565@bugs.debian.org>; Tue, 12 May 2015 17:42:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id 1F4393BFDA for <784565@bugs.debian.org>; Tue, 12 May 2015 17:42:07 +0200 (CEST) Received: from [10.215.43.89] (unknown [46.115.20.43]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTPSA id 867C23BA87; Tue, 12 May 2015 17:42:02 +0200 (CEST) From: Mike Gabriel Reply-To: Mike Gabriel To: Kevin Vigor Cc: 784565@bugs.debian.org, x2go-dev@lists.x2go.org, nito.martinez@qindel.com, opensource@gznianguan.com, Francesco Poli Subject: Re: [pkg-x2go-devel] Bug#784565: nx-libs-lite: parts are derived from non-free code X-Mailer: Modest 3.2 References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> <55521444.9090407@vigor.nu> In-Reply-To: <55521444.9090407@vigor.nu> Content-Type: text/plain; charset=utf-8 Content-ID: <1431445315.4712.6.camel@Nokia-N900> Date: Tue, 12 May 2015 17:41:55 +0200 Message-Id: <1431445315.4712.7.camel@Nokia-N900> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Kevin, thanks for your feedback. Let us wait for Francesco, our expert on license issues, and see what he thinks about your feedback. Thank you very much for providing info and sharing pieces of nx-libs's history. As you sent your reply to the Debian bug tracker already, this will public statement enough, I guess. Thanks a lot, Mike -- DAS-NETZWERKTEAM mike gabriel, herweg 7, 24357 fleckeby fon: +49 (1520) 1976148 GnuPG Key ID 0x25771B13 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de ----- Original message ----- > Hi Mike, et al, > >        I am not the original author of dxpc, that being Brian Pane. > However, I took over maintenance circa 1999 and am still the primary > maintainer (though the project has effectively been dead for most of a > decade now). > >        As you are aware, when I inherited the code, it was licensed under a > variant of the BSD license that did not include the 'with modification' > clause. To the best of my recollection, somebody from the FSF contacted > me circa 2001 regarding this and as a result, subsequent releases were > done under a standard 2-clause BSD license with the modification clause. > Again, to the best of my recollection, I contacted Brian about this > change and he offered no objection. > >        Further, I recall distinctly that NoMachine contacted me and > explicitly asked permission before including DXPC code in NX, which I > happily granted with no new conditions beyond the BSD license already in > play. > >        It is possible, though by no means certain, that I could dig up > ancient email to corroborate this account if necessary. However, I am > more than willing to publicly state that I believe NoMachine's use of > DXPC code to be both legal and ethical, and that my intent when changing > the license to 2-clause BSD was simply to clarity the existing intent > and that it ought therefore be considered retroactive. > >        Yours, >              Kevin Vigor > > On 05/11/15 22:46, Mike Gabriel wrote: > > Dear Kevin, > > > > (I Cc: several people involved in this, also the X2Go development > > mailing list...) > > > > [If you feel unconfortable with discussing the details / the impact of > > the below in public, feel free to answer to me directly first with > > questions and concerns, before answering to all people who are listed > > in Cc:.] > > > > Someone from the Debian legal team recently brought up a license issue > > discovered in nx-libs 3.x series. > > > > TL;DR; Suggested by Francesco Poli from the Debian legal team: """ > > (A) someone gets in touch with DXPC copyright owners and asks them > > whether the re-licensing [in 2002] may be considered retroactive > > (applicable to older versions of DXPC); in case the answer is > > negative, DXPC copyright owners should be persuaded to make the > > re-licensing retroactive """ > > > > The person contacting you about the above question is me. Mike > > Gabriel, Debian Developer and one of the current upstream maintainers > > of nx-libs 3.x (previously also know as  "NX redistributed" for X2Go) > > [1]. > > > > This issue requires some time of reading from you and (hopefully) a > > public statement, that the original DXPC code can be considered as > > BSD-2-clause (the current license) also for released versions prior > > 2002 when the ancient BSD license template [2] was still shipped with > > DXPC. > > > > For a complete follow-up, please check Debian bug #784565 [3]. > > > > We are aware that NoMachine forked DXPC at some early stage around the > > year 2000 and wrote their own commercial product around it. Obviously, > > this fork happened before 2002 (i.e., before DXPC release 3.8.1), as > > libxcomp3 in NoMachine's NX ships the previously used BSD license > > template. I am not sure, if that fork was easy for you or actually a > > nuisance. I may only guess at this point. I'd be happy to know more > > (maybe not in this mail thread, though). > > > > NoMachine has stopped publishing NXv3 updates a couple of years ago > > (2011 IIRC), now. The maintenance has been moved into the hands of the > > currently available FLOSS projects "X2Go", "Arctica Project" [NEW] and > > "TheQVD". Some of us are running a business model on top of that > > (consultancy, support contracts, feature development contracts), some > > of us spend a lot of their free time on improving / maintaining > > nx-libs (as we call NoMachine's NXv3 at the moment). > > > > To outline the impact of my mail clearly: If you say that it was not > > legal by NoMachine to fork DXPC at the given time (before 2002), then > > all FLOSS remote desktop / remote application would be in real > > trouble, because then the core component of their software projects > > could not be considered as free (as in DFSG, Debian free software > > guidelines[4]) anymore. Also the code changes originally performed by > > NoMachine might have been illegal in the first place. All current > > maintenance activities and also planned future development on nx-libs > > would become questionable. > > > > Thus, I hope you can chime in on this: Dear developers of nx-libs, > > please assume the BSD-2-license as retroactive and applicable to DXPC > > version earlier than 3.8.1. As the copyright holder, I agree with > > modifications of code bases that originate before the change to > > BSD-2-clause license got introduced in 3.8.1 of DXPC. > > > > And... I will bring up that question later (but it is burning under my > > nails)... Be sure: The nx-libs maintainers would be happy to have the > > original DXPC author on the nx-libs developer team. But I will bring > > up that question later (when this very issue is settled). ;-) > > > > Greets, > > Mike > > > > [1] https://github.com/ArcticaProject/nx-libs > > [2] http://en.wikipedia.org/wiki/BSD_licenses#Previous_license > > [3] http://bugs.debian.org/784565 > > [4] http://de.wikipedia.org/wiki/Debian_Free_Software_Guidelines > > > > On  Mo 11 Mai 2015 21:36:59 CEST, Francesco Poli wrote: > > > > > On Mon, 11 May 2015 09:26:36 +0000 Mike Gabriel wrote: > > > > > > [...] > > > > As it seems, dxpc has been long ago relicensed to BSD-2-clause (for > > > > v3.8.1 in/around 2002). > > > > > > This is great news, indeed! > > > > > > > > > > > I have no exact clue, if NoMachine forked prior to that (if they > > > > quote the old licensing terms, then probably they did). > > > > > > Yep, it's plausible... > > > > > > > > > > > However, how do you see the situation considering that upstream > > > > changed to BSD-2-clause a long time ago. What approach do you > > > > propose for nx-libs-lite to get the issue fully fixed? > > > > > > If the fork has been performed before the DXPC re-licensing (as it's > > > likely), I see two possible strategies: > > > > > > (A) someone gets in touch with DXPC copyright owners and asks them > > > whether the re-licensing may be considered retroactive (applicable to > > > older versions of DXPC); in case the answer is negative, DXPC > > > copyright owners should be persuaded to make the re-licensing > > > retroactive > > > > > > (B) nx-libs-lite upstream developers re-fork from scratch, basing the > > > new code on a BSD-licensed version of DXPC (I suspect this may turn > > > out to be somewhat painful...) > > > > > > > > > Obviously, the optimal solution is (A). I hope it may work... > > > > > > Thanks for your time and for your prompt and kind replies. > > > > > From invernomuto@paranoici.org Tue May 12 21:42:01 2015 Received: (at 784565) by bugs.debian.org; 12 May 2015 21:42:01 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=4.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FOURLA,HAS_BUG_NUMBER,PGPSIGNATURE,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 15; hammy, 150; neutral, 119; spammy, 0. spammytokens: hammytokens:0.000-+--H*UA:sk:x86_64-, 0.000-+--H*x:sk:x86_64-, 0.000-+--H*c:PGP-SHA256, 0.000-+--H*c:SignHturH, 0.000-+--H*c:pgp-signature Return-path: Received: from perdizione.investici.org ([94.23.50.208]) by buxtehude.debian.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YsHw8-0008Hh-DT for 784565@bugs.debian.org; Tue, 12 May 2015 21:42:01 +0000 Received: from [94.23.50.208] (perdizione [94.23.50.208]) (Authenticated sender: invernomuto@paranoici.org) by localhost (Postfix) with ESMTPSA id 9E73512097E; Tue, 12 May 2015 21:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paranoici.org; s=stigmate; t=1431466915; bh=w0yVuJLtWq+0cj6zbjNb4THkJk0Xq3N9SMQ1+u0ZZnk=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=RRQcr33uMGnEaupGoWl0nXectE2hPbUghdie73/SnVp5Ax5QWxqK90ic5VPUE7RsN RsJ6HcYccQEzYLzm37W24u9eQZFa+Oc1CZaJBvFgOg9MAvh6tHaLUgOuFGkYXhn5R0 Nlq5WHCpVKi9YvGfj/aAtfe84CJPt2HIKAqPXb5w= Received: from frx by homebrew with local (Exim 4.85) (envelope-from ) id 1YsHvP-00019Q-D1; Tue, 12 May 2015 23:41:15 +0200 Date: Tue, 12 May 2015 23:40:48 +0200 From: Francesco Poli To: Mike Gabriel Cc: Kevin Vigor , 784565@bugs.debian.org, x2go-dev@lists.x2go.org, nito.martinez@qindel.com, opensource@gznianguan.com Subject: Re: [pkg-x2go-devel] Bug#784565: nx-libs-lite: parts are derived from non-free code Message-Id: <20150512234048.054319a449ffadcf87577425@paranoici.org> In-Reply-To: <1431445315.4712.7.camel@Nokia-N900> References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> <55521444.9090407@vigor.nu> <1431445315.4712.7.camel@Nokia-N900> X-Mailer: Sylpheed 3.5.0beta1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA256"; boundary="Signature=_Tue__12_May_2015_23_40_48_+0200_KqpLAiCdvC+4zCCk" --Signature=_Tue__12_May_2015_23_40_48_+0200_KqpLAiCdvC+4zCCk Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, 12 May 2015 17:41:55 +0200 Mike Gabriel wrote: > Hi Kevin, Hello Mike, hello Kevin, hello to all the other recipients. First of all, I wish to express my gratitude to Kevin for his prompt, kind and generous response. >=20 > thanks for your feedback. Let us wait for Francesco, our expert on licens= e issues, and see what he thinks about your feedback. I think that this is an important first step to solve this issue for the best. Kevin Vigor is one of the copyright owners of the code that was forked before the re-licensing. We now know that he intended the re-licensing to be retroactive and this is really good. I think that now it would be useful to ascertain that the other copyright owners (Brian Pane, Zachary Vonler, Gian Filippo Pinzari) are also OK with this interpretation of the re-licensing operation. Maybe Kevin is able to dig the original conversations (assuming they were carried on by e-mail or similar archived means) or otherwise to get in touch with them and check? Or, alternatively, Kevin could help Mike to get in touch with them? I hope everything may be settled for the best soon. Thanks a lot to everyone involved. --=20 http://www.inventati.org/frx/ There's not a second to spare! To the laboratory! ..................................................... Francesco Poli . GnuPG key fpr =3D=3D CA01 1147 9CD2 EFDF FB82 3925 3E1C 27E1 1F69 BFFE --Signature=_Tue__12_May_2015_23_40_48_+0200_KqpLAiCdvC+4zCCk Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVUnNlAAoJED4cJ+Efab/+CBQP/33+SjLcIk2VZbjeeyCxhCAo kmgg9BDtqce1Dy22ONotywDNQ187suqlmkEa6yAAdglB0M3CYMFKSIsZHn2C0uGb B45HnzXE7PJd/j/WOXuCIvDe70iGJ7Ubk16DCjyRuKsF70cr2DcsbieiwZh8Wi4v GXNOxpm5Nv2bs1vQnRzYFc7GLWny3eCqcWF23XisqvxQecOHopoGWr9F6NuS5ymz NQ8Z7eanEPaqE86GYFIqJyt9Wcz+fM2r1d/IrNmYaTVBJPrqndQKnXJAViwYhtaM V8+CIKDuttcIYMto9dyE9+vr6wgtDyepVatQIHyVA2LpzR9jub8MGelXMdA7em3i /H3gz3H/tQti3T3HoHu+4CSAEWsXdtkHq2RWU9k3+HQuWB00z7WDr404xzs7k2Wg h6VR9c+VjV92KnMvDqWjE4VBYjrn6Ag5u/0Cf6HMx5RAGFNL8ROjOGbQSskfUogo GnWX2b8yLIe8ojg3AVowWV2oKVlWzsjZVHH9lp0M/lqGmnPVEJk0mh6DKbZPjK8O P2dpZ8IlSa18R2CvMWnf7HXKRR/s2ef7rUmBkT2sFnTwsT5PeDSU45/7ZuWbNIpw 8/Y5q38c36Axeng1J0OCR8YX47dH0PubVnBzYEqoun3GucR1jifOiNzWLyM2ZxNe 0JSSqn5ddFC8/iuGpFDI =ZqCl -----END PGP SIGNATURE----- --Signature=_Tue__12_May_2015_23_40_48_+0200_KqpLAiCdvC+4zCCk-- From niels@thykier.net Wed May 13 16:04:21 2015 Received: (at control) by bugs.debian.org; 13 May 2015 16:04:21 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=4.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 6; hammy, 61; neutral, 18; spammy, 0. spammytokens: hammytokens:0.000-+--H*u:devscripts, 0.000-+--H*u:bts, 0.000-+--H*UA:bts, 0.000-+--H*UA:devscripts, 0.000-+--H*MI:thykier Return-path: Received: from mailrelay11.public.one.com ([195.47.247.189]) by buxtehude.debian.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YsZ8u-0002Ch-RD for control@bugs.debian.org; Wed, 13 May 2015 16:04:21 +0000 X-HalOne-Cookie: 4652f81fa62fa9da4dd9249e7484054c41bc782d X-HalOne-ID: b22b9887-f989-11e4-950a-b82a72d06996 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=thykier.net; s=20140924; h=from:subject:date:message-id:to; bh=EysymZxJFEX8N6fIBUIaFmFP7WdtVLf5PrmWzWVb22Y=; b=Ur7nNbvtl3pu7O1YKIHwSM8MHIW+JPWJKM1GBE23FB4sLbENnBM2V0rmU5++qyolEv7hHAhvKkWFO lH4tbbHCyoYVdUE76nRT/1HEb5/X+pxjrsC1qTXWWXkekbuLNcDwIl0+WdVVEd5B4LYpW7igVWi4AH XncGXx/MNYDQvFiU= Received: from thykier.net (unknown [80.62.116.219]) by smtpfilter3.public.one.com (Halon Mail Gateway) with ESMTPSA for ; Wed, 13 May 2015 16:04:12 +0000 (GMT) Received: by thykier.net (Postfix, from userid 1000) id 985EB4BB; Wed, 13 May 2015 18:04:10 +0200 (CEST) From: Niels Thykier To: control@bugs.debian.org Subject: tagging 784565 Date: Wed, 13 May 2015 18:04:10 +0200 User-Agent: devscripts bts/2.15.4 Message-ID: <1431533050-371-bts-niels@thykier.net> Delivered-To: control@bugs.debian.org # distributable tags 784565 + jessie-ignore thanks From mike.gabriel@das-netzwerkteam.de Thu May 14 04:58:16 2015 Received: (at 784565) by bugs.debian.org; 14 May 2015 04:58:16 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-11.9 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,PGPSIGNATURE,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 22; hammy, 150; neutral, 339; spammy, 0. spammytokens: hammytokens:0.000-+--H*c:pgp-signature, 0.000-+--H*c:protocol, 0.000-+--H*c:micalg, 0.000-+--H*c:signed, 0.000-+--H*RU:sk:grimnir Return-path: Received: from freya.das-netzwerkteam.de ([88.198.48.199]) by buxtehude.debian.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YslDr-0000NV-Ur for 784565@bugs.debian.org; Thu, 14 May 2015 04:58:16 +0000 Received: from grimnir.das-netzwerkteam.de (grimnir.das-netzwerkteam.de [78.46.204.98]) by freya.das-netzwerkteam.de (Postfix) with ESMTPS id A03C82B5; Thu, 14 May 2015 06:58:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id E89E93BD2E; Thu, 14 May 2015 06:58:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at grimnir.das-netzwerkteam.de Received: from grimnir.das-netzwerkteam.de ([127.0.0.1]) by localhost (grimnir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5m6G8sqwjlfJ; Thu, 14 May 2015 06:58:10 +0200 (CEST) Received: from grimnir.das-netzwerkteam.de (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTPS id 5713E3BB3A; Thu, 14 May 2015 06:58:10 +0200 (CEST) Received: from bifrost.das-netzwerkteam.de (bifrost.das-netzwerkteam.de [178.62.101.154]) by mail.das-netzwerkteam.de (Horde Framework) with HTTP; Thu, 14 May 2015 04:58:10 +0000 Date: Thu, 14 May 2015 04:58:09 +0000 Message-ID: <20150514045809.Horde.-3NIZzBnA5V5B6a721F2kg2@mail.das-netzwerkteam.de> From: Mike Gabriel To: Francesco Poli Cc: Kevin Vigor , 784565@bugs.debian.org, x2go-dev@lists.x2go.org, nito.martinez@qindel.com, opensource@gznianguan.com Subject: Re: [pkg-x2go-devel] Bug#784565: nx-libs-lite: parts are derived from non-free code References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> <55521444.9090407@vigor.nu> <1431445315.4712.7.camel@Nokia-N900> <20150512234048.054319a449ffadcf87577425@paranoici.org> In-Reply-To: <20150512234048.054319a449ffadcf87577425@paranoici.org> User-Agent: Internet Messaging Program (IMP) H5 (6.2.2) Accept-Language: de,en Organization: DAS-NETZWERKTEAM X-Originating-IP: 178.62.101.154 X-Remote-Browser: Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0 Iceweasel/32.0 Content-Type: multipart/signed; boundary="=_SHoEHYV8bfary9lJHYP1lQ1"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 This message is in MIME format and has been PGP signed. --=_SHoEHYV8bfary9lJHYP1lQ1 Content-Type: text/plain; charset=us-ascii; format=flowed; DelSp=Yes Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi all, there has been an off-list mail exchange between Francesco and Kevin=20=20 (and=20me in Cc:) which I will quote at the end of this mail (as it was=20= =20 not=20meant to be private and we should fully document the flow on this=20= =20 issue). @Kevin:=20I will take you off this mail thread's Cc: field with my next=20= =20 post.=20Feel free to follow-up via #784565 [1] on the Debian bug=20=20 tracker.=20Thanks a lot for being so responsive and generous with=20=20 providing=20information. On Di 12 Mai 2015 23:40:48 CEST, Francesco Poli wrote: > On Tue, 12 May 2015 17:41:55 +0200 Mike Gabriel wrote: > I think that now it would be useful to ascertain that the other > copyright owners (Brian Pane, Zachary Vonler, Gian Filippo Pinzari) are > also OK with this interpretation of the re-licensing operation. As stated by Kevin, Gian Filippo worked/works on the NoMachine side. I=20= =20 will=20include him in Cc:. For Brian Pane we also found and e-Mail address, for Zach Vonler, I=20=20 will=20use the mail address provided in DXPC code (which might be=20=20 outdated),=20but I think I actually have found his phone number on the=20= =20 web,=20so if that mail address bounces I will give him a ring. > Maybe Kevin is able to dig the original conversations (assuming they > were carried on by e-mail or similar archived means) or otherwise to > get in touch with them and check? Or, alternatively, Kevin could help As stated in the forwarded messages below, Kevin was unable to dig out=20= =20 any=20mails from backups. So we switch to plan B: contact Brian, Zach=20=20 and=20Gian Filippo. > Mike to get in touch with them? I will do that. > I hope everything may be settled for the best soon. > Thanks a lot to everyone involved. /me, too. light+love Mike [1] http://bugs.debian.org/784565 ----- Weitergeleitete Nachricht von Kevin Vigor ----- Datum: Wed, 13 May 2015 09:01:27 -0600 Von: Kevin Vigor Betreff: Re: [pkg-x2go-devel] Bug#784565: nx-libs-lite: parts are=20=20 derived=20from non-free code An: Francesco Poli Cc: Mike Gabriel On 05/12/15 15:40, Francesco Poli wrote: > Maybe Kevin is able to dig the original conversations (assuming they > were carried on by e-mail or similar archived means) or otherwise to > get in touch with them and check? Or, alternatively, Kevin could help > Mike to get in touch with them? I'm afraid I was not able to dig anything out of old backups last=20=20 night.=20I still have a stack of CDs to look through, but don't hold=20=20 your=20breath. Sorry about that. I have never had any contact with Zachary Vonler or Gian Filippo=20=20 Pinzari,=20and have not spoken with Brian Pane in many years, so I have=20= =20 no=20recent contact information for any of them. However, a quick google=20= =20 turns=20up: https://www.linkedin.com/profile/view?id=3D728859 http://www.brianp.net/contact/ which is almost certainly the right Brian Pane (he was at CNet at the=20=20 proper=20time). Good luck, Kevin ----- Ende der weitergeleiteten Nachricht ----- ----- Weitergeleitete Nachricht von Francesco Poli=20=20 =20----- Datum: Wed, 13 May 2015 19:43:44 +0200 Von: Francesco Poli Betreff: Re: [pkg-x2go-devel] Bug#784565: nx-libs-lite: parts are=20=20 derived=20from non-free code An: Kevin Vigor Cc: Mike Gabriel On Wed, 13 May 2015 09:01:27 -0600 Kevin Vigor wrote: > On 05/12/15 15:40, Francesco Poli wrote: > > > Maybe Kevin is able to dig the original conversations (assuming they > > were carried on by e-mail or similar archived means) or otherwise to > > get in touch with them and check? Or, alternatively, Kevin could help > > Mike to get in touch with them? > > I'm afraid I was not able to dig anything out of old backups last=20=20 >=20night. I still have a stack of CDs to look through, but don't hold=20= =20 >=20your breath. Sorry about that. Thanks a lot for searching: this is really appreciated, at least from my side. > > I have never had any contact with Zachary Vonler or Gian Filippo Pinzari, Then I wonder how it was possible to re-license DXPC in 2002... :-| > and have not spoken with Brian Pane in many years, so I have no recent contact information for any of them. However, a quick google turns up: > > https://www.linkedin.com/profile/view?id=3D728859 > http://www.brianp.net/contact/ > > which is almost certainly the right Brian Pane (he was at CNet at=20=20 >=20the proper time). This could be really useful, thank you very much! Mike, I hope the search may go on from there: Brian should be asked about the retroactive nature of the re-licensing of DXPC and maybe he also knows how to get in touch with Zachary and/or Gian Filippo... P.S.: Kevin, any special reason why you dropped several addresses from the Cc list? Should this part of our conversation be kept private for the time being? Please clarify. Thanks! ----- Ende der weitergeleiteten Nachricht ----- ----- Weitergeleitete Nachricht von Kevin Vigor ----- Datum: Wed, 13 May 2015 14:08:48 -0600 Von: Kevin Vigor Betreff: Re: [pkg-x2go-devel] Bug#784565: nx-libs-lite: parts are=20=20 derived=20from non-free code An: Francesco Poli Cc: Mike Gabriel On 05/13/15 11:43, Francesco Poli wrote: > On Wed, 13 May 2015 09:01:27 -0600 Kevin Vigor wrote: >> I have never had any contact with Zachary Vonler or Gian Filippo Pinzari= , > > Then I wonder how it was possible to re-license DXPC in 2002... > :-| > I believe Gian worked on the NoMachine code; he has never contributed=20=20 to=20DXPC directly. Zachary Vonler was allegedly the maintainer of DXPC for a while circa=20=20 1999,=20but never responded to any email when I attempted to contact=20=20 him,=20which is how I came to take over maintenance. > P.S.: Kevin, any special reason why you dropped several addresses from > the Cc list? Should this part of our conversation be kept private for > the time being? Please clarify. Thanks! No, I was just trying to keep from spamming email lists unnecessarily.=20= =20 I=20do not consider any part of this conversation private. ----- Ende der weitergeleiteten Nachricht ----- ----- Weitergeleitete Nachricht von Francesco Poli=20=20 =20----- Datum: Wed, 13 May 2015 22:50:32 +0200 Von: Francesco Poli Betreff: Re: [pkg-x2go-devel] Bug#784565: nx-libs-lite: parts are=20=20 derived=20from non-free code An: Kevin Vigor Cc: Mike Gabriel On Wed, 13 May 2015 14:08:48 -0600 Kevin Vigor wrote: > On 05/13/15 11:43, Francesco Poli wrote: > > On Wed, 13 May 2015 09:01:27 -0600 Kevin Vigor wrote: > > >> I have never had any contact with Zachary Vonler or Gian Filippo Pinza= ri, > > > > Then I wonder how it was possible to re-license DXPC in 2002... > > :-| > > > > I believe Gian worked on the NoMachine code; he has never=20=20 >=20contributed to DXPC directly. Good, then only Zachary has to be tracked down. > > Zachary Vonler was allegedly the maintainer of DXPC for a while=20=20 >=20circa 1999, but never responded to any email when I attempted to=20=20 >=20contact him, which is how I came to take over maintenance. Let's hope Brian is able to help Mike in getting in touch with Zachary... > > > > P.S.: Kevin, any special reason why you dropped several addresses from > > the Cc list? Should this part of our conversation be kept private for > > the time being? Please clarify. Thanks! > > No, I was just trying to keep from spamming email lists=20=20 >=20unnecessarily. I do not consider any part of this conversation=20=20 >=20private. > OK, thanks for clarifying. ----- Ende der weitergeleiteten Nachricht ----- --=20 DAS-NETZWERKTEAM mike gabriel, herweg 7, 24357 fleckeby fon: +49 (1520) 1976 148 GnuPG Key ID 0x25771B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.x= fb --=_SHoEHYV8bfary9lJHYP1lQ1 Content-Type: application/pgp-signature Content-Description: Digitale PGP-Signatur Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVVCthAAoJEJr0azAldxsx3KUP/2997X9KnhVEedREGxsuqvQn Dp5oGK2JPf0Z2MZui1FVehvakoHQD0MuhpVs7ZktnshwNvAgxyhW5esC617a9gsz jJvaJz0S0MPHfSM4Dz8Yg2t0u0DpueVZBpOeDOlt9W9ECXkpe2YPk5AOialHwTPX OP5KKfMSLEGFreUL7U0WeetC/To5zm54Ivx1a0wx2I+HdPJ0YXTxIC7JvUSNejFE 0+yhK1thXf38juOeb2pxTvRQXcj1IoDMRSc0k7KHeNGmP1NF38fh1illPlBABG1u wa3hn+1uMe3+On8LJkDtIHtsXrR2RUuOP+0FbI4rTRo5SOeVFNRSl1ldp2ywl8rQ 9WkK623cuurOydsHjj+fIlcb7GN/OgrTay8VRS3jUjy9tlQ7PCpF5W1m7kMPHrCP nh6/hUa6ep8qE+86dosQS4FxvOgSHOEpbNZ8ulEib/ClHr9wsnWpjxQtvRnZsBTl PAIXKvdiHUCgyfs4efSWYtR8QUJTYmPDrGr2V8jWAtzZOo6NSa09c2Yc2OxLRDpP HBGVSLUOrocvbb3wPAgnsogxtYCpzo/ga1Rnx2LdIfLNaTv62sek+nHqJzICqtcH SdMajeJTVksKQCmHqIQS7C2V44cDYizTe9exZIl75OKT6TDujuW/KZiPQK6VCCNv eEgOxmCOHlc8YLLz0dEP =N9IW -----END PGP SIGNATURE----- --=_SHoEHYV8bfary9lJHYP1lQ1-- From mike.gabriel@das-netzwerkteam.de Thu May 14 05:55:46 2015 Received: (at 784565) by bugs.debian.org; 14 May 2015 05:55:46 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-11.9 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,PGPSIGNATURE,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 23; hammy, 150; neutral, 392; spammy, 0. spammytokens: hammytokens:0.000-+--H*c:pgp-signature, 0.000-+--H*c:protocol, 0.000-+--H*c:micalg, 0.000-+--H*c:signed, 0.000-+--H*RU:sk:grimnir Return-path: Received: from freya.das-netzwerkteam.de ([88.198.48.199]) by buxtehude.debian.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Ysm7W-0005fv-3I for 784565@bugs.debian.org; Thu, 14 May 2015 05:55:46 +0000 Received: from grimnir.das-netzwerkteam.de (grimnir.das-netzwerkteam.de [78.46.204.98]) by freya.das-netzwerkteam.de (Postfix) with ESMTPS id BDB433282; Thu, 14 May 2015 07:55:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id 20DC03BD2E; Thu, 14 May 2015 07:55:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at grimnir.das-netzwerkteam.de Received: from grimnir.das-netzwerkteam.de ([127.0.0.1]) by localhost (grimnir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3Dt4TKuxIMPh; Thu, 14 May 2015 07:55:43 +0200 (CEST) Received: from grimnir.das-netzwerkteam.de (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTPS id 871AB3B9EA; Thu, 14 May 2015 07:55:42 +0200 (CEST) Received: from bifrost.das-netzwerkteam.de (bifrost.das-netzwerkteam.de [178.62.101.154]) by mail.das-netzwerkteam.de (Horde Framework) with HTTP; Thu, 14 May 2015 05:55:42 +0000 Date: Thu, 14 May 2015 05:55:42 +0000 Message-ID: <20150514055542.Horde.LWDaJ7sgQHr-LCJySXbtvQ3@mail.das-netzwerkteam.de> From: Mike Gabriel To: Zach Vonler , Brian Pane , Gian Filippo Pinzari Cc: nito.martinez@qindel.com, x2go-dev@lists.x2go.org, opensource@gznianguan.com, 784565@bugs.debian.org, Francesco Poli Subject: Re: [pkg-x2go-devel] Bug#784565: Bug#784565: nx-libs-lite: parts are derived from non-free code References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> <55521444.9090407@vigor.nu> <1431445315.4712.7.camel@Nokia-N900> <20150512234048.054319a449ffadcf87577425@paranoici.org> In-Reply-To: <20150512234048.054319a449ffadcf87577425@paranoici.org> User-Agent: Internet Messaging Program (IMP) H5 (6.2.2) Accept-Language: de,en Organization: DAS-NETZWERKTEAM X-Originating-IP: 178.62.101.154 X-Remote-Browser: Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0 Iceweasel/32.0 Content-Type: multipart/signed; boundary="=_whjzG6t3RqUoHnRlD0aGiA1"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 This message is in MIME format and has been PGP signed. --=_whjzG6t3RqUoHnRlD0aGiA1 Content-Type: text/plain; charset=us-ascii; format=flowed; DelSp=Yes Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Dear Brian, dear Zachary, dear Gian Filippo, (Find a TL;DR; at the end of this mail...) I am contacting you on a licensing issue related to the DXPC code that=20= =20 you=20worked on at the end of the nineties. I'd highly appreciate it if=20= =20 you=20could take a little time to read this mail and get back to me,=20=20 either=20privately or in public. [I have actually Cc:ed quite a number of people in this mail (thread).=20= =20 All=20of them will be affected by the outcome of this license issue to=20= =20 some=20lesser or greater extent. If you feel inconvenient with replying=20= =20 to=20so many people you don't know, really don't hesitate to get back to=20= =20 me=20in private first, so that we can sort things out. Thank you.] Before I continue, let me shortly introduce myself. My name is Mike=20=20 Gabriel,=20I work for the Debian project [1.1, 1.2] (which brings forth=20= =20 one=20of the major GNU/Linux distributions world-wide. I am also the=20=20 upstream=20code maintainer of a software project called nx-libs [2]. The=20= =20 nx-libs=20code has been derived from several of NoMachine's NXv3 [11]=20=20 components=20(namely: nx-X11, nxagent, nxcomp, nxcompext and nxcompshad). A member of the Debian legal team [3] (Francesco Poli) made us (i.e.,=20=20 the=20nx-libs developers, users, package maintainers) aware of an issue=20= =20 [4]=20in the nx-libs component NXCOMP (which has been derived from DXPC=20= =20 [5]).=20Please read Message #5 of the brought up issue on the Debian bug=20= =20 tracker=20(#784565) [4] before you continue reading. Thanks. I will now jump into the below quoted mail and continue inline... On Di 12 Mai 2015 23:40:48 CEST, Francesco Poli wrote: > On Tue, 12 May 2015 17:41:55 +0200 Mike Gabriel wrote: > >> Hi Kevin, > > Hello Mike, hello Kevin, hello to all the other recipients. > > First of all, I wish to express my gratitude to Kevin for his prompt, > kind and generous response. >> thanks for your feedback. Let us wait for Francesco, our expert on=20=20 >>=20license issues, and see what he thinks about your feedback. > > I think that this is an important first step to solve this issue for > the best. > Kevin Vigor is one of the copyright owners of the code that was forked > before the re-licensing. > We now know that he intended the re-licensing to be retroactive and > this is really good. We are currently in the process of contacting all DXPC related=20=20 copyright=20holders mentioned in the NXCOMP license file [6]. We already=20= =20 received=20some feedback from Kevin Vigor [7], but we also need to=20=20 address=20you (Brian, Zachary, Gian Filippo) with this. (The mail=20=20 address=20I have from Zachary may be outdated, so any current contact=20=20 address=20is highly welcome, in case the mail address being used will=20=20 bounce=20back). At the moment, NXCOMP (and thus nx-libs, but also NoMachine's NXv3=20=20 code)=20cannot be considered as fully free software, until this issue is=20= =20 settled.=20The DXPC license before DXPC v3.8.1 was an ancient BSD style=20= =20 license=20that failed in explicitly mentioning, that it is allowed to=20=20 modify=20the DXPC code in derivative works. In 2002, DXPC 3.8.1 got=20=20 released=20[12], using a more compliant license (BSD-2-clause). As Kevin=20= =20 told=20us, this license change [8,9] was done after the FSF [10] had=20=20 contacted=20the DXPC developers. However, the NXCOMP code in NXv3 got forked from DXPC before 2002, as=20=20 it=20seems. So unfortunately, the modifications of DXPC as found in=20=20 NoMachine's=20NXCOMP product are not compliant with the pre-3.8.1=20=20 license=20of DXPC. > I think that now it would be useful to ascertain that the other > copyright owners (Brian Pane, Zachary Vonler, Gian Filippo Pinzari) are > also OK with this interpretation of the re-licensing operation. TL;DR; So here comes my actual question: are you (Brian Pane, Zachary=20=20 Vonler,=20Gian Filippo Pinzari) ok with retroactively regarding=20=20 pre-3.8.1=20code of DXPC (that you probably all worked on at that time)=20= =20 as=20BSD-2-clause? Are you ok with others having taken or taking the=20=20 pre-3.8.1=20DXPC code and distribute it in a modified form? A yes from all of you as DXPC copyright holders is essential for the=20=20 continuation=20of nx-libs development under a free license. This may=20=20 also=20possibly be an issue for NXv4 in case parts of it have been=20=20 derived=20from DXPC. Thanks to all of you for taking your time. light+love Mike [1.1] http://www.debian.org [1.2] https://qa.debian.org/developer.php?login=3Dsunweaver%40debian.org [2] https://github.com/ArcticaProject/nx-libs [3] https://www.debian.org/legal/ [4] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D784565#5 [5] http://www.vigor.nu/dxpc/ [6] https://github.com/ArcticaProject/nx-libs/blob/3.6.x/nxcomp/LICENSE#L32 [7] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D784565#40 [8] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D72020 [9] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D142028 [10] http://www.fsf.org/ [11] https://www.nomachine.com/version-3 [12] http://www.vigor.nu/dxpc/CHANGES --=20 DAS-NETZWERKTEAM mike=20gabriel, herweg 7, 24357 fleckeby fon: +49 (1520) 1976 148 GnuPG Key ID 0x25771B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.x= fb --=_whjzG6t3RqUoHnRlD0aGiA1 Content-Type: application/pgp-signature Content-Description: Digitale PGP-Signatur Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVVDjeAAoJEJr0azAldxsx1JUP/RdzhmQ3HU+6x479AoGBTKxV onR3XPlq8Iw9f6dU0TjqlAHCOGeftJ+X7A3HamiTFsr5wUqlrTuKeYnVd4hTa08e ge9WIODczQfnoHm47siTjlMfQuHFIGDnHuJ+3GbvojMI7QXWrM9wgxGo2B/2UUQS tFlYPbvfAGhCyUVx/zLRFqDVzzdo+UCVoLLYKE1pkwjhpnGGamY1xd/KFjCgi0Vx f/Nx9w28EqmRFZCTmxghLngkTlQwrtBkSUAhLS3ntxV12RrrQQ2verXPWbW1DU9C 3TZypNZSMc4O8etJ244YUk7wAvspUtJnXyvxoQ2Padw0ogGFayIdLtC8HStCy+Mx Q/FIND8+aGdYALNTbQfTCpJ1fmg06Id4hn96rdZOhpT80M3vTuY9HpIyf2dDCdHu OmHEjUKnMRgjPbVoIU5lz8s4X/ET7hzxb2psXSwscxI+qqlSrADzC98QB23djJii O9qPVB/HqJXwNNXlwiScrLC/q4ro0QgdurKmIDQq1zjdFXyBDEwMzxLNlVSJiEeG gMSiXD9lD8J1KBDp35P4wxmOcCSymILU11Lpvf5N22ID7cfk8x58+Fsik+RkQZcm 94ll8p4XU0xOt8pgzGOVL4rLBsjcPGzuTjUoDsB8zmZLSgEgrISZNQC7pRhEXTRW 3g7fQuF635IMObwgVJJB =c1td -----END PGP SIGNATURE----- --=_whjzG6t3RqUoHnRlD0aGiA1-- From mike.gabriel@das-netzwerkteam.de Thu May 14 06:20:24 2015 Received: (at 784565) by bugs.debian.org; 14 May 2015 06:20:24 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-11.9 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,PGPSIGNATURE,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 15; hammy, 149; neutral, 94; spammy, 1. spammytokens:0.997-1--sk:austin. hammytokens:0.000-+--H*c:pgp-signature, 0.000-+--H*c:protocol, 0.000-+--H*c:micalg, 0.000-+--H*c:signed, 0.000-+--H*RU:sk:grimnir Return-path: Received: from freya.das-netzwerkteam.de ([88.198.48.199]) by buxtehude.debian.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YsmVL-0008TY-AE for 784565@bugs.debian.org; Thu, 14 May 2015 06:20:24 +0000 Received: from grimnir.das-netzwerkteam.de (grimnir.das-netzwerkteam.de [78.46.204.98]) by freya.das-netzwerkteam.de (Postfix) with ESMTPS id AA82B3282; Thu, 14 May 2015 08:20:19 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id A8B823BD2E; Thu, 14 May 2015 08:20:18 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at grimnir.das-netzwerkteam.de Received: from grimnir.das-netzwerkteam.de ([127.0.0.1]) by localhost (grimnir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LyPILriO4mkm; Thu, 14 May 2015 08:20:18 +0200 (CEST) Received: from grimnir.das-netzwerkteam.de (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTPS id 4BB463BB3A; Thu, 14 May 2015 08:20:18 +0200 (CEST) Received: from bifrost.das-netzwerkteam.de (bifrost.das-netzwerkteam.de [178.62.101.154]) by mail.das-netzwerkteam.de (Horde Framework) with HTTP; Thu, 14 May 2015 06:20:18 +0000 Date: Thu, 14 May 2015 06:20:18 +0000 Message-ID: <20150514062018.Horde.T6fBfDEHTv_IkVi4n506ew5@mail.das-netzwerkteam.de> From: Mike Gabriel To: Brian Pane , Gian Filippo Pinzari Cc: opensource@gznianguan.com, 784565@bugs.debian.org, nito.martinez@qindel.com, Francesco Poli , x2go-dev@lists.x2go.org Subject: Re: [X2Go-Dev] [pkg-x2go-devel] Bug#784565: Bug#784565: nx-libs-lite: parts are derived from non-free code References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> <55521444.9090407@vigor.nu> <1431445315.4712.7.camel@Nokia-N900> <20150512234048.054319a449ffadcf87577425@paranoici.org> <20150514055542.Horde.LWDaJ7sgQHr-LCJySXbtvQ3@mail.das-netzwerkteam.de> In-Reply-To: <20150514055542.Horde.LWDaJ7sgQHr-LCJySXbtvQ3@mail.das-netzwerkteam.de> User-Agent: Internet Messaging Program (IMP) H5 (6.2.2) Accept-Language: de,en Organization: DAS-NETZWERKTEAM X-Originating-IP: 178.62.101.154 X-Remote-Browser: Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0 Iceweasel/32.0 Content-Type: multipart/signed; boundary="=_FXxC2VoubfzELdkXQu84zQ1"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 This message is in MIME format and has been PGP signed. --=_FXxC2VoubfzELdkXQu84zQ1 Content-Type: text/plain; charset=us-ascii; format=flowed; DelSp=Yes Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi again, On Do 14 Mai 2015 07:55:42 CEST, Mike Gabriel wrote: > [...] (The mail address I have from Zachary may be outdated, so any=20=20 >=20current contact address is highly welcome, in case the mail address=20= =20 >=20being used will bounce back). As it seems, the publicly known mail address of Zachary Vonler at=20=20 austin.utexas.edu=20is outdated. @Brian: if you happen to have a recent mail address of Zachary, could=20=20 you=20please provide it to me privately? Thanks. Mike --=20 DAS-NETZWERKTEAM mike=20gabriel, herweg 7, 24357 fleckeby fon: +49 (1520) 1976 148 GnuPG Key ID 0x25771B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.x= fb --=_FXxC2VoubfzELdkXQu84zQ1 Content-Type: application/pgp-signature Content-Description: Digitale PGP-Signatur Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVVD6iAAoJEJr0azAldxsx4+8QAI9fbkDu0G/1NpC4+MDJ3HtH wzfUUIIoBAPTahr1ZGrGK4ZMH5+RvXtwX2OBTwRRgKlZOqsdU35bj2HKi01KNLGx 9NXXnLz97CuTrXJrzis3C+pzCIpR6cR/SPhDdExdhjR8nawXcejfFhPUnbVvPvxY jYN43cYFScovk5f5bUtIAybVZZCpdRZwDRevD+1qTTs+WtDf/9PXL7CX9A7j7r6T XQIURSVQq/FVXcJHSdZcYZza/4JHIZbEQTeX3FaUK+zkdHlBbbmRwzN0YLP/XQiY 06tQXFjgjqjjkoxTE5gQrlN3kyxNH2WpXj2eeAqQarkCOnKgiuFEYxhTCYnZHCmk WVYhb2/78VbRlRbDJH0jJ0KKNOi9fbXGcVa36IOgV2dLN+tnNorAQjHm7LkBDhyi c3EmzEPtDTmcb5XuPYwwbNGn2EE47UsTx3UjPFWAQVQ2LwMXoFb+iH+WWSQ8KW1b xKRDOtarACd06rbW/sKQVdzNytydvFkZZn//AHHA7KP7jmqhl/bub8EyEf9cCTVr 92XB5bbI1rLfEo1D3FTUaCt1tUEumhgRzwlJteX5/vbpf0fJ3QcWMUQSQWYqbhEm LnlGOM44jZDtQ7QonezcB/+lQDu2/0Q7fZtgqtr9bxkJ5URr8/ByTI+E3K2bxdme jQAQL6yyRC5s419MIJTr =6/Dc -----END PGP SIGNATURE----- --=_FXxC2VoubfzELdkXQu84zQ1-- From mike.gabriel@das-netzwerkteam.de Sat May 16 09:19:18 2015 Received: (at 784565) by bugs.debian.org; 16 May 2015 09:19:18 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-10.9 required=4.0 tests=BAYES_00,DIGITS_LETTERS, FOURLA,HAS_BUG_NUMBER,PGPSIGNATURE,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 31; hammy, 150; neutral, 208; spammy, 0. spammytokens: hammytokens:0.000-+--tarballs, 0.000-+--H*c:pgp-signature, 0.000-+--H*c:protocol, 0.000-+--H*c:micalg, 0.000-+--H*c:signed Return-path: Received: from freya.das-netzwerkteam.de ([88.198.48.199]) by buxtehude.debian.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YtYFZ-0006BP-Mo for 784565@bugs.debian.org; Sat, 16 May 2015 09:19:18 +0000 Received: from grimnir.das-netzwerkteam.de (grimnir.das-netzwerkteam.de [78.46.204.98]) by freya.das-netzwerkteam.de (Postfix) with ESMTPS id 434CF3D4F; Sat, 16 May 2015 11:19:13 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id 9294C3BB55; Sat, 16 May 2015 11:19:12 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at grimnir.das-netzwerkteam.de Received: from grimnir.das-netzwerkteam.de ([127.0.0.1]) by localhost (grimnir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a-GW73-71I6N; Sat, 16 May 2015 11:19:12 +0200 (CEST) Received: from grimnir.das-netzwerkteam.de (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTPS id 224123BB3B; Sat, 16 May 2015 11:19:12 +0200 (CEST) Received: from 176.4.79.4 ([176.4.79.4]) by mail.das-netzwerkteam.de (Horde Framework) with HTTP; Sat, 16 May 2015 09:19:12 +0000 Date: Sat, 16 May 2015 09:19:12 +0000 Message-ID: <20150516091912.Horde.W_1Szu5msccGYo-Ndwv3cg1@mail.das-netzwerkteam.de> From: Mike Gabriel To: 784565@bugs.debian.org, Francesco Poli Cc: Kevin Vigor , nito.martinez@qindel.com, x2go-dev@lists.x2go.org, opensource@gznianguan.com Subject: Re: [pkg-x2go-devel] Bug#784565: Bug#784565: nx-libs-lite: parts are derived from non-free code References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> <55521444.9090407@vigor.nu> <1431445315.4712.7.camel@Nokia-N900> <20150512234048.054319a449ffadcf87577425@paranoici.org> <20150514045809.Horde.-3NIZzBnA5V5B6a721F2kg2@mail.das-netzwerkteam.de> In-Reply-To: <20150514045809.Horde.-3NIZzBnA5V5B6a721F2kg2@mail.das-netzwerkteam.de> User-Agent: Internet Messaging Program (IMP) H5 (6.2.2) Accept-Language: de,en Organization: DAS-NETZWERKTEAM X-Originating-IP: 176.4.79.4 X-Remote-Browser: Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0 Iceweasel/32.0 Content-Type: multipart/signed; boundary="=_n6jEwcfiXkrvf2B-ZGaJrw3"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 This message is in MIME format and has been PGP signed. --=_n6jEwcfiXkrvf2B-ZGaJrw3 Content-Type: text/plain; charset=us-ascii; format=flowed; DelSp=Yes Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi all, esp. Kevin, On Do 14 Mai 2015 06:58:09 CEST, Mike Gabriel wrote: I looked at dxpc releases (I obtained upstream tarballs from=20=20 snapshot.debian.org). I=20currently have: """ [mike@minobo dxpc.nxrebase (upstream-nxrebase)]$ git log commit 0676a768a96383641a73a72ecd2e1083322e6abe Author: Mike Gabriel Date: Sat May 16 10:52:24 2015 +0200 Imported Upstream version 3.9.2 commit 4ccf34b2c4763dfb01dceb8588b204b0d029cc3d Author: Mike Gabriel Date: Sat May 16 10:51:04 2015 +0200 Imported Upstream version 3.9.1 commit dd8f60ce63c70ed605a2e1717feb7128e59fb8e6 Author: Mike Gabriel Date: Sat May 16 10:49:19 2015 +0200 Imported Upstream version 3.9.0 commit 01c990099aea802405f8d39c0b819ee1742c185c Author: Mike Gabriel Date: Sat May 16 10:32:06 2015 +0200 Imported Upstream version 3.8.2 commit 48df60b3b946a08541ee48371634f074e875adda Author: Mike Gabriel Date: Sat May 16 10:31:57 2015 +0200 Imported Upstream version 3.8.0 commit 11d81444d0f86a67f9b8483cbfa33343714b26e9 Author: Mike Gabriel Date: Sat May 16 10:31:53 2015 +0200 Imported Upstream version 3.7.0 commit e4f550abd4cd49ecc2381e717a55a9940087a376 Author: Mike Gabriel Date: Sat May 16 10:31:44 2015 +0200 Imported Upstream version 3.5.0 """ > @Kevin: I will take you off this mail thread's Cc: field with my=20=20 >=20next post. Feel free to follow-up via #784565 [1] on the Debian bug=20= =20 >=20tracker. Thanks a lot for being so responsive and generous with=20=20 >=20providing information. With this post I actually reincluded you because it becomes technical=20=20 from=20here on and I probably will need your expertise on DXPC. Not sure=20= =20 if=20you have time or prio or are willing to provide that. Would you be=20= =20 open=20for answering technical questions on DXPC and esp. the changes=20=20 between=203.7.0 and 3.8.1/3.8.2? I'd highly appreciate that. As I have not heard back neither from Brian Pane, Zachary Vonler nor=20=20 Gian=20Filippo Pinzari (we had Ascension Day and maybe a prolonged=20=20 weekend=20that people used for going on VAC), I will try looking at the=20= =20 DXPC=20changes between 3.7.0 and 3.8.1. Obviously, NoMachine forked=20=20 NXCOMP=20from DXPC some time between DXPC 3.7.0 and DXPC 3.8.0. Questions to Kevin: o Is there any SVN upstream repo still online (I saw it in one of the tarballs, that SVN was used for 3.9.0). o Do you have any tarballs documenting the changes between 3.7.0 and 3.8.0? Do you also have the 3.8.1 tarball? o Did the 3.8.0 version of DXPC break proto compatibility (i.e., you could not use client 3.7.0 and server 3.8.0 and vice versa with each other)? Any help on this is appreciated. Thanks. Mike --=20 DAS-NETZWERKTEAM mike=20gabriel, herweg 7, 24357 fleckeby fon: +49 (1520) 1976 148 GnuPG Key ID 0x25771B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.x= fb --=_n6jEwcfiXkrvf2B-ZGaJrw3 Content-Type: application/pgp-signature Content-Description: Digitale PGP-Signatur Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVVwuPAAoJEJr0azAldxsxAqoQAI1IOApnU8WLZH+VT1GIgtvx XxuBALPeR8KobmGRfJd4bSzeIpAqw+JSGa0/XApTwjYbpsIUKnMrEfoHfS0wt4Tb ZmSiHL4XCYa6SCGOAbSe89QXNA8kS4ewQMSaPTZhGvoR6wIjdNfxXDN5aO6TkUlw qw786fMKYcj9htNnshlq264uSfkrMusFEw614dnfKEVnx8YrIUU5lNY9AInShO9S K0vy1vn53/Ie5Fec1FK0WUsT4xTu7NW80Ch0+IgopURIl9NmlomJVRwoDLbR47Ox 6dFVGJ5VKmOt+oW2g4YAdti8YNhSYteyPgTAPMdtU4XqkHV5/RepCoV/6gr3/YR1 To63WGpt2B+jl2d4OAPuWWdTRucB2QYsCz/jCvLKeLcg2ODHZJXhSzVYlIie0uFY SRvqM8qW+WyuYek2vZDneKvDB2eUqMhRb5dmSeod9UR+3RYTq+JrFUoDq65PONbM A0QZ+cG0EkQdxG/1V8yZoMRgxPOtb+AZcMIjC5NikWUsyIkGjMHNHSbJCboJBlyM DdyRCTxuM09cpzNxS7Ph0z0iSdQZAl2D7vPCAY1jwyLdu7Xra/p3aM6pqeYuIaWh OpoF/sRq08CjWmgVe7MdfkgxZQxW4qIdOeNYGUDIADzzj6cHdNV+WP13ISizeoyO u4cspyl/6lFu3TyMWkh8 =fu9u -----END PGP SIGNATURE----- --=_n6jEwcfiXkrvf2B-ZGaJrw3-- From zvonler@gmail.com Mon May 18 15:05:45 2015 Received: (at 784565) by bugs.debian.org; 18 May 2015 15:05:46 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=4.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FOURLA,FREEMAIL_FROM,HAS_BUG_NUMBER,HTML_MESSAGE, MULTALT,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 14; hammy, 104; neutral, 41; spammy, 1. spammytokens:0.940-+--H*c:alternative hammytokens:0.000-+--D*das-netzwerkteam.de, 0.000-+--sk:mikega, 0.000-+--sk:mike.ga, 0.000-+--U*mike.gabriel, 0.000-+--mike.gabriel@das-netzwerkteam.de Return-path: Received: from mail-ob0-f181.google.com ([209.85.214.181]) by buxtehude.debian.org with esmtps (TLS1.2:RSA_ARCFOUR_SHA1:128) (Exim 4.80) (envelope-from ) id 1YuMbx-0004SF-RZ for 784565@bugs.debian.org; Mon, 18 May 2015 15:05:45 +0000 Received: by obblk2 with SMTP id lk2so127830096obb.0 for <784565@bugs.debian.org>; Mon, 18 May 2015 08:05:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=nHgAzYNhWTJXAXb1d3jfmZVOFHEEaolqyRCNmCThusM=; b=ilsboi8m+iXF7pVv2MVsvJqi8Es4/o3Awnfg5nSzWVB34kDB0g7zczoEfC4d9km/Bn WDerLV30mJ+OfaRA5elHld2CsY9ByX2MuU73jj2kNenlEV15s7LdJxYsWiZeKM4AEeOw gGF3oU3A/FfhVUrhoPjcGXiF7xjXh1kkPGjkmXFJgthTnyJQjrL6Kw6jfsqhQtbEpqnc 5hsWFCNR7O780T1pkf+MisASrWFXI3oolY4EV8/P6OeEWmmKd7L9h8YHPegOdFq543qZ na9coEvmwpnReWORK79ycOgZa1DwiX1h2SvS+wgigQx8j9ZlJld5SpJFTcV3vSJxmICQ i7Wg== MIME-Version: 1.0 X-Received: by 10.202.89.131 with SMTP id n125mr19222614oib.91.1431961538959; Mon, 18 May 2015 08:05:38 -0700 (PDT) Received: by 10.202.212.10 with HTTP; Mon, 18 May 2015 08:05:38 -0700 (PDT) Date: Mon, 18 May 2015 10:05:38 -0500 Message-ID: Subject: Re: [pkg-x2go-devel] Bug#784565: Bug#784565: nx-libs-lite: parts are derived from non-free code From: Zach Vonler To: 784565@bugs.debian.org Content-Type: multipart/alternative; boundary=001a113d381edcb3e205165c863b --001a113d381edcb3e205165c863b Content-Type: text/plain; charset=UTF-8 On Thu, 14 May 2015 05:55:42 +0000 Mike Gabriel < mike.gabriel@das-netzwerkteam.de> wrote: > > TL;DR; So here comes my actual question: are you (Brian Pane, Zachary > Vonler, Gian Filippo Pinzari) ok with retroactively regarding > pre-3.8.1 code of DXPC (that you probably all worked on at that time) > as BSD-2-clause? Are you ok with others having taken or taking the > pre-3.8.1 DXPC code and distribute it in a modified form? > > A yes from all of you as DXPC copyright holders is essential for the > continuation of nx-libs development under a free license. This may > also possibly be an issue for NXv4 in case parts of it have been > derived from DXPC. Yes, I am fine with considering the license change to be retroactive to cover the time I was the maintainer. I have no objections to others distributing modified versions of that code. Zach --001a113d381edcb3e205165c863b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Thu, 14 May 2015 05:55:42 +0000 Mike Gabriel <mike.gabriel@das-netzwerkteam= .de> wrote:

TL;DR; So here comes my act= ual question: are you (Brian Pane, Zachary =C2=A0
Vonler, Gian Filippo P= inzari) ok with retroactively regarding =C2=A0
pre-3.8.1 code of DXPC (t= hat you probably all worked on at that time) =C2=A0
as BSD-2-clause? Are= you ok with others having taken or taking the =C2=A0
pre-3.8.1 DXPC cod= e and distribute it in a modified form?
=C2=A0
A yes from all of you as DXPC copyright holders is essential= for the =C2=A0
continuation of nx-libs development under a free license= . This may =C2=A0
also possibly be an issue for NXv4 in case parts of it= have been =C2=A0
derived from DXPC.
=C2=A0
=
Yes, I am fine with considering the license change to be retroactive t= o cover the time I was the maintainer.

I have no o= bjections to others distributing modified versions of that code.
=
Zach
--001a113d381edcb3e205165c863b-- From kevin@vigor.nu Mon May 18 21:26:12 2015 Received: (at 784565) by bugs.debian.org; 18 May 2015 21:26:12 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 16; hammy, 150; neutral, 121; spammy, 0. spammytokens: hammytokens:0.000-+--tarballs, 0.000-+--H*f:sk:2015050, 0.000-+--3.9.0, 0.000-+--3.8.0, 0.000-+--H*UA:31.0 Return-path: Received: from gateway13.websitewelcome.com ([69.56.148.12]) by buxtehude.debian.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YuSY8-0004Mq-9I for 784565@bugs.debian.org; Mon, 18 May 2015 21:26:12 +0000 Received: by gateway13.websitewelcome.com (Postfix, from userid 5007) id 248D59C09927E; Mon, 18 May 2015 15:38:28 -0500 (CDT) Received: from gator4058.hostgator.com (gator4058.hostgator.com [192.185.4.69]) by gateway13.websitewelcome.com (Postfix) with ESMTP id 1EB399C099246 for <784565@bugs.debian.org>; Mon, 18 May 2015 15:38:28 -0500 (CDT) Received: from [63.158.132.10] (port=43192 helo=[10.50.3.84]) by gator4058.hostgator.com with esmtpsa (UNKNOWN:DHE-RSA-AES128-SHA:128) (Exim 4.82) (envelope-from ) id 1YuRnv-0001VU-8i; Mon, 18 May 2015 15:38:27 -0500 Message-ID: <555A4DC1.2040900@vigor.nu> Date: Mon, 18 May 2015 14:38:25 -0600 From: Kevin Vigor User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Mike Gabriel , 784565@bugs.debian.org, Francesco Poli CC: nito.martinez@qindel.com, x2go-dev@lists.x2go.org, opensource@gznianguan.com Subject: Re: [pkg-x2go-devel] Bug#784565: Bug#784565: nx-libs-lite: parts are derived from non-free code References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> <55521444.9090407@vigor.nu> <1431445315.4712.7.camel@Nokia-N900> <20150512234048.054319a449ffadcf87577425@paranoici.org> <20150514045809.Horde.-3NIZzBnA5V5B6a721F2kg2@mail.das-netzwerkteam.de> <20150516091912.Horde.W_1Szu5msccGYo-Ndwv3cg1@mail.das-netzwerkteam.de> In-Reply-To: <20150516091912.Horde.W_1Szu5msccGYo-Ndwv3cg1@mail.das-netzwerkteam.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4058.hostgator.com X-AntiAbuse: Original Domain - bugs.debian.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - vigor.nu X-BWhitelist: no X-Source-IP: 63.158.132.10 X-Exim-ID: 1YuRnv-0001VU-8i X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([10.50.3.84]) [63.158.132.10]:43192 X-Source-Auth: kevin@vigor.nu X-Email-Count: 2 X-Source-Cap: a3ZpZ29yO2t2aWdvcjtnYXRvcjQwNTguaG9zdGdhdG9yLmNvbQ== X-Greylist: delayed 1495 seconds by postgrey-1.34 at buxtehude; Mon, 18 May 2015 21:26:12 UTC On 05/16/15 03:19, Mike Gabriel wrote: As I have not heard back neither from Brian Pane, Zachary Vonler nor Gian Filippo Pinzari (we had Ascension Day and maybe a prolonged weekend that people used for going on VAC), I will try looking at the DXPC changes between 3.7.0 and 3.8.1. Obviously, NoMachine forked NXCOMP from DXPC some time between DXPC 3.7.0 and DXPC 3.8.0. > > Questions to Kevin: > > o Is there any SVN upstream repo still online > (I saw it in one of the tarballs, that SVN was > used for 3.9.0). I'm afraid not. There was never an online repo available, and if I used one personally it is lost to the mists of time. > o Do you have any tarballs documenting the > changes between 3.7.0 and 3.8.0? Do you also > have the 3.8.1 tarball? I have the source tarballs to each of those (including the 3.8.1 version). The 3.8.0 release includes a README-3.8.0 file which documents the changes between 3.7.0 and 3.8.0 reasonably well. As will be (unfortunately) obvious from examining the deltas between 3.7.0 (the last release by Brian and/or Zachary) and 3.8.0 (the first release by me), I inherited a significant majority of the code. > o Did the 3.8.0 version of DXPC break proto > compatibility (i.e., you could not use client > 3.7.0 and server 3.8.0 and vice versa with > each other)? Yes, minor version number bumps were used to indicate compatibility. 3.8.x was incompatible with 3.7.x (and also with 3.9.x). From kevin@vigor.nu Mon May 18 21:34:50 2015 Received: (at 784565) by bugs.debian.org; 18 May 2015 21:34:50 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 39; hammy, 146; neutral, 132; spammy, 4. spammytokens:0.999-1--tecnologies, 0.993-1--H*RU:67.18.68.12, 0.987-1--D*ascend.com, 0.987-1--H*r:34828 hammytokens:0.000-+--H*f:sk:2015050, 0.000-+--3.8.0, 0.000-+--H*UA:31.0, 0.000-+--H*u:31.0, 0.000-+--H*f:sk:2015051 Return-path: Received: from gateway15.websitewelcome.com ([67.18.68.12]) by buxtehude.debian.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YuSgU-0005Jq-92 for 784565@bugs.debian.org; Mon, 18 May 2015 21:34:50 +0000 Received: by gateway15.websitewelcome.com (Postfix, from userid 5007) id 8BB94ED5E6912; Mon, 18 May 2015 16:11:44 -0500 (CDT) Received: from gator4058.hostgator.com (gator4058.hostgator.com [192.185.4.69]) by gateway15.websitewelcome.com (Postfix) with ESMTP id 84825ED5E68F2 for <784565@bugs.debian.org>; Mon, 18 May 2015 16:11:44 -0500 (CDT) Received: from [63.158.132.10] (port=34828 helo=[10.50.3.84]) by gator4058.hostgator.com with esmtpsa (UNKNOWN:DHE-RSA-AES128-SHA:128) (Exim 4.82) (envelope-from ) id 1YuSK7-00005R-B6; Mon, 18 May 2015 16:11:43 -0500 Message-ID: <555A558E.1020703@vigor.nu> Date: Mon, 18 May 2015 15:11:42 -0600 From: Kevin Vigor User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Mike Gabriel , 784565@bugs.debian.org, Francesco Poli CC: nito.martinez@qindel.com, x2go-dev@lists.x2go.org, opensource@gznianguan.com Subject: Re: [pkg-x2go-devel] Bug#784565: Bug#784565: nx-libs-lite: parts are derived from non-free code References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> <55521444.9090407@vigor.nu> <1431445315.4712.7.camel@Nokia-N900> <20150512234048.054319a449ffadcf87577425@paranoici.org> <20150514045809.Horde.-3NIZzBnA5V5B6a721F2kg2@mail.das-netzwerkteam.de> <20150516091912.Horde.W_1Szu5msccGYo-Ndwv3cg1@mail.das-netzwerkteam.de> In-Reply-To: <20150516091912.Horde.W_1Szu5msccGYo-Ndwv3cg1@mail.das-netzwerkteam.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4058.hostgator.com X-AntiAbuse: Original Domain - bugs.debian.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - vigor.nu X-BWhitelist: no X-Source-IP: 63.158.132.10 X-Exim-ID: 1YuSK7-00005R-B6 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([10.50.3.84]) [63.158.132.10]:34828 X-Source-Auth: kevin@vigor.nu X-Email-Count: 2 X-Source-Cap: a3ZpZ29yO2t2aWdvcjtnYXRvcjQwNTguaG9zdGdhdG9yLmNvbQ== X-Greylist: delayed 1383 seconds by postgrey-1.34 at buxtehude; Mon, 18 May 2015 21:34:50 UTC By the way, poking around the interwebs I find there is an archive of the old DXPC mailing list available at: http://marc.info/?l=dxpc&r=1&w=2 I think you will find this of particular interest: http://marc.info/?l=dxpc&m=93093790813555&w=2 List: dxpc Subject: Re: future tecnologies From: Brian Pane Date: 1999-07-02 16:42:18 [Download message RAW] Kevin Vigor wrote: > On 01-Jul-99 dxpc@mcfeeley.cc.utexas.edu wrote: > > Speaking of licensing, are you putting your 3.8.0 changes to the dxpc > > code itself under GPL, or are they going to use the original dxpc's > > licensing? > > No, as you can probably guess, I am no fan of the GPL. For stuff on > this level, where my hacking is pretty simple and probably devoid of > commercial value, I'll just release my changes to the public domain and > give up even a copyright interest in them. > > Your and Zach's copyrights still stand, of course. > > I *think* that fact that we use the LZO library and API, but do not > directly incorporate the code, allows us to escape the clutch of the GPL > virus. > > btw, is there an original dxpc license? I haven't seen anything but a > copyright notice, which to my non-lawyerly mind translates as "free to > all the world as is, negotiate with copyright owner if modifying or > including in some other product". The copyright banner in the Readme is all the documentation there's ever been. My intent was to allow _any_ distribution, use, and modification of the source, without imposing restrictions on the licensing style of any system into which others might incorporate the code. We probably should start stating this clearly in the distributions. -brian [prev in list] [next in list] [prev in thread] [next in thread] From mike.gabriel@das-netzwerkteam.de Mon May 18 21:49:10 2015 Received: (at 784565) by bugs.debian.org; 18 May 2015 21:49:10 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 35; hammy, 150; neutral, 281; spammy, 0. spammytokens: hammytokens:0.000-+--H*RU:sk:grimnir, 0.000-+--H*r:sk:grimnir, 0.000-+--H*RU:78.46.204.98, 0.000-+--H*RU:88.198.48.199, 0.000-+--H*RU:sk:freya.d Return-path: Received: from freya.das-netzwerkteam.de ([88.198.48.199]) by buxtehude.debian.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YuSuK-0007oj-Hh for 784565@bugs.debian.org; Mon, 18 May 2015 21:49:10 +0000 Received: from grimnir.das-netzwerkteam.de (grimnir.das-netzwerkteam.de [78.46.204.98]) by freya.das-netzwerkteam.de (Postfix) with ESMTPS id 253493049 for <784565@bugs.debian.org>; Mon, 18 May 2015 23:49:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id ACC2E3BD6C for <784565@bugs.debian.org>; Mon, 18 May 2015 23:49:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at grimnir.das-netzwerkteam.de Received: from grimnir.das-netzwerkteam.de ([127.0.0.1]) by localhost (grimnir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Hh79XOiBkYIp for <784565@bugs.debian.org>; Mon, 18 May 2015 23:49:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id 6CC483BC0D for <784565@bugs.debian.org>; Mon, 18 May 2015 23:49:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id 2100C3BD6C for <784565@bugs.debian.org>; Mon, 18 May 2015 23:49:03 +0200 (CEST) Received: from [10.139.193.227] (unknown [176.0.38.193]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTPSA id 453F63BB1E; Mon, 18 May 2015 23:48:59 +0200 (CEST) From: Mike Gabriel Reply-To: Mike Gabriel To: Kevin Vigor , 784565@bugs.debian.org, Francesco Poli Cc: nito.martinez@qindel.com, x2go-dev@lists.x2go.org, opensource@gznianguan.com, zvonler@gmail.com Subject: Re: [pkg-x2go-devel] Bug#784565: Bug#784565: nx-libs-lite: parts are derived from non-free code X-Mailer: Modest 3.2 References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> <55521444.9090407@vigor.nu> <1431445315.4712.7.camel@Nokia-N900> <20150512234048.054319a449ffadcf87577425@paranoici.org> <20150514045809.Horde.-3NIZzBnA5V5B6a721F2kg2@mail.das-netzwerkteam.de> <20150516091912.Horde.W_1Szu5msccGYo-Ndwv3cg1@mail.das-netzwerkteam.de> <555A558E.1020703@vigor.nu> In-Reply-To: <555A558E.1020703@vigor.nu> Content-Type: text/plain; charset=utf-8 Content-ID: <1431985731.1406.1.camel@Nokia-N900> Date: Mon, 18 May 2015 23:48:51 +0200 Message-Id: <1431985731.1406.2.camel@Nokia-N900> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Kevin, hi Zach, hi Francesco, hi all, @Francesco, please review the recent posts and sum up what to do next. ----- Original message ----- > By the way, poking around the interwebs I find there is an archive of > the old DXPC mailing list available at: > > http://marc.info/?l=dxpc&r=1&w=2 > > I think you will find this of particular interest: > > > http://marc.info/?l=dxpc&m=93093790813555&w=2 > > > List:            dxpc > Subject:      Re: future tecnologies > From:            Brian Pane > Date:            1999-07-02 16:42:18 > [Download message RAW] > > Kevin Vigor wrote: > > On 01-Jul-99 dxpc@mcfeeley.cc.utexas.edu wrote: > > > Speaking of licensing, are you putting your 3.8.0 changes to the dxpc > > > code itself under GPL, or are they going to use the original dxpc's > > > licensing? > > > > No, as you can probably guess, I am no fan of the GPL. For stuff on > > this level, where my hacking is pretty simple and probably devoid of > > commercial value, I'll just release my changes to the public domain and > > give up even a copyright interest in them. > > > > Your and Zach's copyrights still stand, of course. > > > > I *think* that fact that we use the LZO library and API, but do not > > directly incorporate the code, allows us to escape the clutch of the > > GPL virus. > > > > btw, is there an original dxpc license? I haven't seen anything but a > > copyright notice, which to my non-lawyerly mind translates as "free to > > all the world as is, negotiate with copyright owner if modifying or > > including in some other product". > > The copyright banner in the Readme is all the documentation there's ever > been.  My intent was to allow _any_ distribution, use, and modification > of the source, without imposing restrictions on the licensing style of > any system into which others might incorporate the code.  We probably > should start stating this clearly in the distributions. > > -brian > > [prev in list] [next in list] [prev in thread] [next in thread] @Kevin: You are very awesome! @Francesco: that old post from Brian should be the statement we need, right? As Brian has not answered back, so far, does that post suffice? I also had a mail from Zach in my mailbox this morning. I managed to get hold of him via phone over the weekend. He posted his agreement to this Debian bug (as message #77) [1] earlier today. @Zach: thanks a lot for that!!! @Francesco: by looking at [2], I cannot see any hint for Gian Filippo Pinzari being a copyright holder of DXPC. This is stated in the NoMachine files at at least one place, but not in the latest DXPC upstream release. I am on my mobile right now, need to check old versions of DXPC, but if Gian Filippo Pinzari is not listed in the DXPC 3.7.0 release (where nxcomp obviously got forked from), then I think that we don't require his feedback, right? To my opinion, this issue can be settled. We have direct feedback from Kevin and Zach and Kevin dug out an old post from Brian stating the retroactive nature of the BSD-2-clause while Gian Filippo probably not being a real copyright holder of the original DXPC code. Right? light+love, Mike [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=77;att=0;bug=784565 [2] http://www.vigor.nu/dxpc/README -- DAS-NETZWERKTEAM mike gabriel, herweg 7, 24357 fleckeby fon: +49 (1520) 1976148 GnuPG Key ID 0x25771B13 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de From invernomuto@paranoici.org Mon May 18 22:15:14 2015 Received: (at 784565) by bugs.debian.org; 18 May 2015 22:15:14 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=4.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FOURLA,HAS_BUG_NUMBER,PGPSIGNATURE,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 12; hammy, 150; neutral, 220; spammy, 0. spammytokens: hammytokens:0.000-+--H*UA:sk:x86_64-, 0.000-+--H*x:sk:x86_64-, 0.000-+--H*c:PGP-SHA256, 0.000-+--H*c:SignHturH, 0.000-+--H*c:pgp-signature Return-path: Received: from latitanza.investici.org ([82.94.249.234]) by buxtehude.debian.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YuTJa-0002xP-0G for 784565@bugs.debian.org; Mon, 18 May 2015 22:15:14 +0000 Received: from [82.94.249.234] (latitanza [82.94.249.234]) (Authenticated sender: invernomuto@paranoici.org) by localhost (Postfix) with ESMTPSA id 921B3120546; Mon, 18 May 2015 22:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paranoici.org; s=stigmate; t=1431987305; bh=RQEA/1bkAQ71T0PpK/7XelDXEZBLyoVavVl9tpWLzWY=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=sO+MOEv4mZZNK2g5Om9IC7Og5k2qPAvFepN+ei+3/jCixgNBbvaLuRpMgJw6l1yjD hpqRYIxtNgyVywgpuiFVACFBuDn1ksfdFrEPNAcgRl//Sert2aOjetbZcKi1VouhXi eexR8IP81C0C1UjzjeC7zEmF5V+wSyhVs9jKvKfg= Received: from frx by homebrew with local (Exim 4.85) (envelope-from ) id 1YuTIi-0002Se-TN; Tue, 19 May 2015 00:14:20 +0200 Date: Tue, 19 May 2015 00:14:08 +0200 From: Francesco Poli To: Mike Gabriel Cc: Kevin Vigor , 784565@bugs.debian.org, nito.martinez@qindel.com, x2go-dev@lists.x2go.org, opensource@gznianguan.com, zvonler@gmail.com Subject: Re: [pkg-x2go-devel] Bug#784565: Bug#784565: nx-libs-lite: parts are derived from non-free code Message-Id: <20150519001408.8e5452a098db48d6867af6cb@paranoici.org> In-Reply-To: <1431985731.1406.2.camel@Nokia-N900> References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> <55521444.9090407@vigor.nu> <1431445315.4712.7.camel@Nokia-N900> <20150512234048.054319a449ffadcf87577425@paranoici.org> <20150514045809.Horde.-3NIZzBnA5V5B6a721F2kg2@mail.das-netzwerkteam.de> <20150516091912.Horde.W_1Szu5msccGYo-Ndwv3cg1@mail.das-netzwerkteam.de> <555A558E.1020703@vigor.nu> <1431985731.1406.2.camel@Nokia-N900> X-Mailer: Sylpheed 3.5.0beta1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA256"; boundary="Signature=_Tue__19_May_2015_00_14_08_+0200_Wl9eJ95DZcVokEvx" --Signature=_Tue__19_May_2015_00_14_08_+0200_Wl9eJ95DZcVokEvx Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, 18 May 2015 23:48:51 +0200 Mike Gabriel wrote: [...] > @Francesco: that old post from Brian should be the statement we need, > right? As Brian has not answered back, so far, does that post suffice? Yes, I am under the impression that it may be considered as evidence that Brian had always meant to grant permission to modify, despite not being overly clear until DXPC version 3.8.1. In other words, it seems that the re-licensing was more intended to be a clarification, rather than a change of mind. >=20 > I also had a mail from Zach in my mailbox this morning. I managed to > get hold of him via phone over the weekend. He posted his agreement > to this Debian bug (as message #77) [1] earlier today. @Zach: thanks > a lot for that!!! This is really great! >=20 > @Francesco: by looking at [2], I cannot see any hint for Gian Filippo > Pinzari being a copyright holder of DXPC. This is stated in the > NoMachine files at at least one place, but not in the latest DXPC > upstream release. I am on my mobile right now, need to check old > versions of DXPC, but if Gian Filippo Pinzari is not listed in > the DXPC 3.7.0 release (where nxcomp obviously got forked from), > then I think that we don't require his feedback, right? If it is confirmed that Gian Filippo contributed to the forking of DXPC within the NoMachine project, but not directly to DXPC, then I think that he made his contributions available under the terms of the GPL v2 of the NoMachine project. If this is the case, no feedback should be required from his side. >=20 > To my opinion, this issue can be settled. We have direct feedback > from Kevin and Zach and Kevin dug out an old post from Brian stating > the retroactive nature of the BSD-2-clause while Gian Filippo probably > not being a real copyright holder of the original DXPC code. Right? Yes, I agree with this analysis. The only missing check is the one about Gian Filippo's involvement (as explained above). Thanks a lot to everyone involved in this license fixing effort! Bye. >=20 > [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=3D77;att=3D0;bug=3D= 784565 > [2] http://www.vigor.nu/dxpc/README --=20 http://www.inventati.org/frx/ There's not a second to spare! To the laboratory! ..................................................... Francesco Poli . GnuPG key fpr =3D=3D CA01 1147 9CD2 EFDF FB82 3925 3E1C 27E1 1F69 BFFE --Signature=_Tue__19_May_2015_00_14_08_+0200_Wl9eJ95DZcVokEvx Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVWmQ1AAoJED4cJ+Efab/+FowQALSZya0Xp8IXNA+d0gjQBLGQ 7eDzaX+kPVKkbYdb7ZDlQF+ZVTwjOnqjf1dDLXWSHwcXYhFd3DeeFB11QfAKXptI GyzOt/vrh+w1K2zMb4rR9lxyUKIrKmVI6aOxyRTP7ojqkqqFvpF7ZVkDJZBFCSvx LXdAWTaz5NLIH5R4lzvTcTFYmC3JhBtf8m58l4jT3GC1pxoqlYQk0svWOrdlULQZ zh1dy6Sf0guwMuOH4pfreTKlNIizFj7BwanoN+tNvYG1sbQnyIwNRKUfG+v5/13P 3tyjknNDTTE67T40qSv6pcZs46vqMTevL8E+s+wGfcvdKQ5Y2fPQ8Q9yxS6cVxH2 DXsLV97RFCcdD+ys+7P9j7xYG0e38juu61sU42cNmrb5iU0woB3SJtFvABhioGZg TLFi/OxOT6ZTHcZtfwqozVyB1fOesqx3nvwCEE3pNuf58ErxRy1sIXwoChNL4+eo ET1kojXBXHER6W6EHno0yz600sJXHE8rco+fv5b5qGBHdLEJ0k80YXQI4FhJQT69 I8FyASmNX4u6HvH6hRVm2BwE9WrZTUUQRb0m/pEfZVVroiRrqTl/ntvWchXvI2Tt IGfoDMtmVbSkh+2DQmsG9oDqiG1pCt3eNkLa1oftlQ7oIQem2MajCOS4QN20PMpU d/smtrrNvkmiWuQrjwDF =R0ou -----END PGP SIGNATURE----- --Signature=_Tue__19_May_2015_00_14_08_+0200_Wl9eJ95DZcVokEvx-- From kevin@vigor.nu Tue May 19 01:41:18 2015 Received: (at 784565) by bugs.debian.org; 19 May 2015 01:41:18 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 26; hammy, 131; neutral, 46; spammy, 0. spammytokens: hammytokens:0.000-+--H*UA:31.6.0, 0.000-+--H*u:31.6.0, 0.000-+--H*f:sk:2015050, 0.000-+--H*UA:31.0, 0.000-+--H*u:31.0 Return-path: Received: from gateway32.websitewelcome.com ([192.185.145.107]) by buxtehude.debian.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YuWX0-0002lG-Du for 784565@bugs.debian.org; Tue, 19 May 2015 01:41:18 +0000 Received: by gateway32.websitewelcome.com (Postfix, from userid 500) id 311BBD143B8C; Mon, 18 May 2015 20:16:29 -0500 (CDT) Received: from gator4058.hostgator.com (gator4058.hostgator.com [192.185.4.69]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 2F036D143B72 for <784565@bugs.debian.org>; Mon, 18 May 2015 20:16:29 -0500 (CDT) Received: from [98.202.128.111] (port=49655 helo=[192.168.7.118]) by gator4058.hostgator.com with esmtpsa (UNKNOWN:DHE-RSA-AES128-SHA:128) (Exim 4.82) (envelope-from ) id 1YuW8y-0004Tt-DX; Mon, 18 May 2015 20:16:28 -0500 Message-ID: <555A8EE9.9000503@vigor.nu> Date: Mon, 18 May 2015 19:16:25 -0600 From: Kevin Vigor User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Francesco Poli , Mike Gabriel CC: 784565@bugs.debian.org, nito.martinez@qindel.com, x2go-dev@lists.x2go.org, opensource@gznianguan.com, zvonler@gmail.com Subject: Re: [pkg-x2go-devel] Bug#784565: Bug#784565: nx-libs-lite: parts are derived from non-free code References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> <55521444.9090407@vigor.nu> <1431445315.4712.7.camel@Nokia-N900> <20150512234048.054319a449ffadcf87577425@paranoici.org> <20150514045809.Horde.-3NIZzBnA5V5B6a721F2kg2@mail.das-netzwerkteam.de> <20150516091912.Horde.W_1Szu5msccGYo-Ndwv3cg1@mail.das-netzwerkteam.de> <555A558E.1020703@vigor.nu> <1431985731.1406.2.camel@Nokia-N900> <20150519001408.8e5452a098db48d6867af6cb@paranoici.org> In-Reply-To: <20150519001408.8e5452a098db48d6867af6cb@paranoici.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4058.hostgator.com X-AntiAbuse: Original Domain - bugs.debian.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - vigor.nu X-BWhitelist: no X-Source-IP: 98.202.128.111 X-Exim-ID: 1YuW8y-0004Tt-DX X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.7.118]) [98.202.128.111]:49655 X-Source-Auth: kevin@vigor.nu X-Email-Count: 3 X-Source-Cap: a3ZpZ29yO2t2aWdvcjtnYXRvcjQwNTguaG9zdGdhdG9yLmNvbQ== X-Greylist: delayed 1487 seconds by postgrey-1.34 at buxtehude; Tue, 19 May 2015 01:41:18 UTC On 5/18/2015 4:14 PM, Francesco Poli wrote: > If it is confirmed that Gian Filippo contributed to the forking of > DXPC within the NoMachine project, but not directly to DXPC, then I > think that he made his contributions available under the terms of the > GPL v2 of the NoMachine project. If this is the case, no feedback > should be required from his side. I can confirm that Gian Fillippo never contributed directly to DXPC. You'll note his name does not appear in the DXPC README, and never has. From mike.gabriel@das-netzwerkteam.de Tue May 19 08:15:28 2015 Received: (at 784565) by bugs.debian.org; 19 May 2015 08:15:28 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-11.9 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,PGPSIGNATURE,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 24; hammy, 150; neutral, 195; spammy, 0. spammytokens: hammytokens:0.000-+--H*c:pgp-signature, 0.000-+--H*c:protocol, 0.000-+--H*c:micalg, 0.000-+--H*c:signed, 0.000-+--H*RU:sk:grimnir Return-path: Received: from freya.das-netzwerkteam.de ([88.198.48.199]) by buxtehude.debian.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YucgR-0008T9-K0 for 784565@bugs.debian.org; Tue, 19 May 2015 08:15:28 +0000 Received: from grimnir.das-netzwerkteam.de (grimnir.das-netzwerkteam.de [78.46.204.98]) by freya.das-netzwerkteam.de (Postfix) with ESMTPS id 7D1773C96; Tue, 19 May 2015 10:15:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id 08FEE3BFD5; Tue, 19 May 2015 10:15:23 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at grimnir.das-netzwerkteam.de Received: from grimnir.das-netzwerkteam.de ([127.0.0.1]) by localhost (grimnir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MW9pv+xO3WwY; Tue, 19 May 2015 10:15:22 +0200 (CEST) Received: from grimnir.das-netzwerkteam.de (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTPS id 97FCC3C2AA; Tue, 19 May 2015 10:15:12 +0200 (CEST) Received: from bifrost.das-netzwerkteam.de (bifrost.das-netzwerkteam.de [178.62.101.154]) by mail.das-netzwerkteam.de (Horde Framework) with HTTP; Tue, 19 May 2015 08:15:12 +0000 Date: Tue, 19 May 2015 08:15:12 +0000 Message-ID: <20150519081512.Horde.36QI-nOdkbpWsXrDE4E8Yw1@mail.das-netzwerkteam.de> From: Mike Gabriel To: Kevin Vigor , 784565@bugs.debian.org, Francesco Poli Cc: opensource@gznianguan.com, zvonler@gmail.com, nito.martinez@qindel.com, x2go-dev@lists.x2go.org Subject: Re: [pkg-x2go-devel] Bug#784565: Bug#784565: Bug#784565: nx-libs-lite: parts are derived from non-free code References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> <55521444.9090407@vigor.nu> <1431445315.4712.7.camel@Nokia-N900> <20150512234048.054319a449ffadcf87577425@paranoici.org> <20150514045809.Horde.-3NIZzBnA5V5B6a721F2kg2@mail.das-netzwerkteam.de> <20150516091912.Horde.W_1Szu5msccGYo-Ndwv3cg1@mail.das-netzwerkteam.de> <555A558E.1020703@vigor.nu> <1431985731.1406.2.camel@Nokia-N900> <20150519001408.8e5452a098db48d6867af6cb@paranoici.org> <555A8EE9.9000503@vigor.nu> In-Reply-To: <555A8EE9.9000503@vigor.nu> User-Agent: Internet Messaging Program (IMP) H5 (6.2.2) Accept-Language: de,en Organization: DAS-NETZWERKTEAM X-Originating-IP: 178.62.101.154 X-Remote-Browser: Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0 Iceweasel/32.0 Content-Type: multipart/signed; boundary="=_AI4511z4pP7yPmTeeGgEoA6"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 This message is in MIME format and has been PGP signed. --=_AI4511z4pP7yPmTeeGgEoA6 Content-Type: text/plain; charset=us-ascii; format=flowed; DelSp=Yes Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Kevin, hi Frederico, On Di 19 Mai 2015 03:16:25 CEST, Kevin Vigor wrote: > On 5/18/2015 4:14 PM, Francesco Poli wrote: >> If it is confirmed that Gian Filippo contributed to the forking of=20=20 >>=20DXPC within the NoMachine project, but not directly to DXPC, then I=20= =20 >>=20think that he made his contributions available under the terms of=20= =20 >>=20the GPL v2 of the NoMachine project. If this is the case, no=20=20 >>=20feedback should be required from his side. > I can confirm that Gian Fillippo never contributed directly to DXPC.=20= =20 >=20You'll note his name does not appear in the DXPC README, and never=20= =20 >=20has. @Kevin: This is again good news for sorting out this issue. Thanks a=20=20 lot=20for your help, Kevin. @Frederico: I guess we are through then. Thanks for helping with=20=20 clarifying=20the situation (and bringing it up in the first place). For fixing this issue (in terms of closing the bug), I propose this=20=20 for=20downstream (i.e., Debian): o copy bug_784565.mbox [1] into the debian/ folder of the=20=20 nx-libs-lite=20package o upload some latest release of nx-libs-lite 3.5.0.x to unstable o update debian/copyright accordingly o close this bug via debian/changelog For upstream, I propose this: o copy bug_784565.mbox into the docs/ folder o update copyright information in nxcomp/ subfolder o provide some README or such that shortly explains our last weeks' proc= ess o this will be for the upcoming 3.6.x release series of nx-libs o this should also be backported to the 3.5.x release series Once the mbox file and README are upstreamed, I will drop that content=20= =20 from=20the debian/ folder in the Debian package nx-libs-lite (as it will=20= =20 be=20in the upstream tarball of nx-libs-lite). Feedback (esp. from Frederico), concerns, other suggestions? Greets, Mike [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?mbox=3Dyes;bug=3D784565 --=20 DAS-NETZWERKTEAM mike=20gabriel, herweg 7, 24357 fleckeby fon: +49 (1520) 1976 148 GnuPG Key ID 0x25771B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.x= fb --=_AI4511z4pP7yPmTeeGgEoA6 Content-Type: application/pgp-signature Content-Description: Digitale PGP-Signatur Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVWvEQAAoJEJr0azAldxsxiZgP/1MhcK1h2or3zG3P9h3oOqFk rsknSn/0paY8HlzggWh5N4juLU9ET/VyO+xMCbVFDXb9jv5ryRI0MinPGwp6ujTl DxHAz5q5YrC/NYH9IU0PqL2Zja952xbjlVPgf64+iLT0kqFmY7L48bkxVXd4cKnJ flflATeaPTcVgIVcfFte2q/NJV7AAGjwb/tEOOMbqrRYOu1hKLozWnRSLZ/rdl5V OmktCjfAfw6Cvy4/IN6pCjG4uqFvsWvzjMofR53MLuy8cwQhtpvK9KPLCZlo9Efm KyrFNl866Egmc/HTLQkSaOJOKartANw+Ev7qsVi30OJOEWh9T1fDjnFvLn6hesKf 9pAS/+mkuCUVNjLI/ATZAwY93bzBS+vo7fya2D/DxDk8FoLIe7XdI9GABdTE2U0H eyNLb/Lq485BEQEu9ThtvACZYH3F3UqA7OcFfLKyVw2lsOJV7SN3KCl76te4iNcf UlVzVr211lKhGTV9hLF3daKntu1H3jQku9zLK9ShJR6bYTpCAsGi2h2xzZm5PLDE 9tbf+qUmDn3lp4uMaBtBdtq+yt47Wk95iS41x/qyvy0PK/RdnPxTpfdbriu4+1l2 ij6Dq5bb7GckZDmpVjSsGSr4jjWtJ5QrnZbpv/u/v3+wliZL0c+CScrA+5I/qJeI eGXnQIwqcWE/2/AcAz2r =Q2/H -----END PGP SIGNATURE----- --=_AI4511z4pP7yPmTeeGgEoA6-- From invernomuto@paranoici.org Wed May 20 18:04:34 2015 Received: (at 784565) by bugs.debian.org; 20 May 2015 18:04:34 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=4.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FOURLA,HAS_BUG_NUMBER,PGPSIGNATURE,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 11; hammy, 150; neutral, 212; spammy, 0. spammytokens: hammytokens:0.000-+--H*UA:sk:x86_64-, 0.000-+--H*x:sk:x86_64-, 0.000-+--H*c:PGP-SHA256, 0.000-+--H*c:SignHturH, 0.000-+--H*c:pgp-signature Return-path: Received: from latitanza.investici.org ([82.94.249.234]) by buxtehude.debian.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yv8M4-00011u-4i for 784565@bugs.debian.org; Wed, 20 May 2015 18:04:34 +0000 Received: from [82.94.249.234] (latitanza [82.94.249.234]) (Authenticated sender: invernomuto@paranoici.org) by localhost (Postfix) with ESMTPSA id C5F33121147; Wed, 20 May 2015 18:04:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paranoici.org; s=stigmate; t=1432145064; bh=kDc9DoBw4hJZuuDTXyurpbInn9fdFF6IfH4jMVGqQB4=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=frjvhV6NrKV9TyZSGeK6evsHeI9sAgoPOPboFwSAIij0bPp1G5rCLaVWFjD1RtFsK j+6I/XZ60KTIjiXaQGqqznF3jU2dQ/lzPkj1VYKa9Kmt1pw4UhJvU+mbyrO6cX2mSi 52Wi1of3M+l/UT9DYKjXgzMRuWkYoAq4tmsOe9jY= Received: from frx by homebrew with local (Exim 4.85) (envelope-from ) id 1Yv8LB-0001gi-7y; Wed, 20 May 2015 20:03:37 +0200 Date: Wed, 20 May 2015 20:03:25 +0200 From: Francesco Poli To: Mike Gabriel Cc: Kevin Vigor , 784565@bugs.debian.org, opensource@gznianguan.com, zvonler@gmail.com, nito.martinez@qindel.com, x2go-dev@lists.x2go.org Subject: Re: [pkg-x2go-devel] Bug#784565: Bug#784565: Bug#784565: nx-libs-lite: parts are derived from non-free code Message-Id: <20150520200325.6641876f5b4b2f483bdaea7d@paranoici.org> In-Reply-To: <20150519081512.Horde.36QI-nOdkbpWsXrDE4E8Yw1@mail.das-netzwerkteam.de> References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> <55521444.9090407@vigor.nu> <1431445315.4712.7.camel@Nokia-N900> <20150512234048.054319a449ffadcf87577425@paranoici.org> <20150514045809.Horde.-3NIZzBnA5V5B6a721F2kg2@mail.das-netzwerkteam.de> <20150516091912.Horde.W_1Szu5msccGYo-Ndwv3cg1@mail.das-netzwerkteam.de> <555A558E.1020703@vigor.nu> <1431985731.1406.2.camel@Nokia-N900> <20150519001408.8e5452a098db48d6867af6cb@paranoici.org> <555A8EE9.9000503@vigor.nu> <20150519081512.Horde.36QI-nOdkbpWsXrDE4E8Yw1@mail.das-netzwerkteam.de> X-Mailer: Sylpheed 3.5.0beta1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA256"; boundary="Signature=_Wed__20_May_2015_20_03_25_+0200__3Vr7Ml7uHmX7EzV" --Signature=_Wed__20_May_2015_20_03_25_+0200__3Vr7Ml7uHmX7EzV Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, 19 May 2015 08:15:12 +0000 Mike Gabriel wrote: [...] > @Frederico: I guess we are through then. Yes, it seems so (I'm assuming you meant to direct this question to me...). > Thanks for helping with =20 > clarifying the situation (and bringing it up in the first place). You're welcome! Thanks to you and all the involved people for helping to solve this issue. >=20 > For fixing this issue (in terms of closing the bug), I propose this =20 > for downstream (i.e., Debian): >=20 > o copy bug_784565.mbox [1] into the debian/ folder of the =20 > nx-libs-lite package Maybe the entire bug log is an overkill... I would include the relevant replies only. For instance: https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=3D40;mbox=3Dyes;bug=3D784= 565 https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=3D77;mbox=3Dyes;bug=3D784= 565 https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=3D87;mbox=3Dyes;bug=3D784= 565 https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=3D102;mbox=3Dyes;bug=3D78= 4565 > o upload some latest release of nx-libs-lite 3.5.0.x to unstable > o update debian/copyright accordingly In the debian/copyright file the license for the original DXPC code should be replaced with the 2-clause BSD license (currently adopted for DXPC) with a comment saying something like: The original DXPC code used to be available under a license which failed to explicitly grant the permission to modify, but was later retroactively re-licensed under the 2-clause BSD license (see debian/bug_784565_*.mbox for the copyright owners' statements; see for more details) Moreover, the copyright notice of Gian Filippo Pinzari should be documented in some more appropriate part of the debian/copyright file, associated with the NoMachine license (GPL v2 or later). > o close this bug via debian/changelog >=20 > For upstream, I propose this: >=20 > o copy bug_784565.mbox into the docs/ folder Again, I would not include the entire bug log, but only the relevant messages (see above)... > o update copyright information in nxcomp/ subfolder > o provide some README or such that shortly explains our last weeks' pr= ocess > o this will be for the upcoming 3.6.x release series of nx-libs >=20 > o this should also be backported to the 3.5.x release series Thanks to everyone involved! Bye. --=20 http://www.inventati.org/frx/ There's not a second to spare! To the laboratory! ..................................................... Francesco Poli . GnuPG key fpr =3D=3D CA01 1147 9CD2 EFDF FB82 3925 3E1C 27E1 1F69 BFFE --Signature=_Wed__20_May_2015_20_03_25_+0200__3Vr7Ml7uHmX7EzV Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVXMxyAAoJED4cJ+Efab/+yUsP/RWzC9NoVGF7UnEIEpJODu0u hVkX1zjpJ+iMByHVlatR90ulKwkvVb4d354YJqyI0VM2wUtif6XBoroB0K3i6vZE DsxugBlzhnH8jgpPVKbOyBKshpKKZsUbvDdEXM20ZkfI4xwokymiSdHOKoHH4ZHS WN9q+i6OezfWvZSKQ+VCbe7QiQABAcB+zCdVvUWevhNqMDKdhsDC03Ju+5YZQbse QbgYSazZvJouLPamivquh8nBdjGpPxqAJGrlUu3SR5slJxRojRvl2cl/CDFEQEQR gbLMnnr2nj1hF4JI2WaWCSX90NrGTfGxCN4IdNd7tmjtkg5lB+KFx63YjHbLmUl/ k87XAyXxSWyGvc7M2xyIXBQQrHtRxtK0rdN+e7ht9PcXYyxUtQzr7vfPwvI+B2GV M23ZUoyV1rFp5JymbUL4Vk6pq/hLnv9FzwOySNVcj6Pt8eT+BcoSbwOI1AMq1P1S wCs/PhEGBA3TDWERXF0Fb7x24NEf7EdjmzKTGGdXTCfSkacxkGzsMaRpWb0D6IaV tSI6CmBQ9uOdkbiNDhGX4esosyJZJQ9GrnWX9d/lTs9wXUHHykvnYRbDzpkChZdI ICqc+IxnPmX6HU2kyq2ZAzfhx/drqLizcv0gQlyY6APjRu3EQ3tapR9kYB6BcuGU cMLlO0549ekk8/s3Zk0i =9Hew -----END PGP SIGNATURE----- --Signature=_Wed__20_May_2015_20_03_25_+0200__3Vr7Ml7uHmX7EzV-- From mike.gabriel@das-netzwerkteam.de Thu May 21 09:35:35 2015 Received: (at 784565) by bugs.debian.org; 21 May 2015 09:35:35 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02 (2014-02-07) on buxtehude.debian.org X-Spam-Level: X-Spam-Status: No, score=-11.9 required=4.0 tests=BAYES_00,FOURLA, HAS_BUG_NUMBER,PGPSIGNATURE,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02 X-Spam-Bayes: score:0.0000 Tokens: new, 15; hammy, 150; neutral, 222; spammy, 0. spammytokens: hammytokens:0.000-+--H*c:pgp-signature, 0.000-+--H*c:protocol, 0.000-+--H*c:micalg, 0.000-+--H*c:signed, 0.000-+--H*RU:sk:grimnir Return-path: Received: from freya.das-netzwerkteam.de ([88.198.48.199]) by buxtehude.debian.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YvMt4-0006Ry-Ri for 784565@bugs.debian.org; Thu, 21 May 2015 09:35:35 +0000 Received: from grimnir.das-netzwerkteam.de (grimnir.das-netzwerkteam.de [78.46.204.98]) by freya.das-netzwerkteam.de (Postfix) with ESMTPS id 89FD21F2; Thu, 21 May 2015 11:35:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTP id C86AC3BAE9; Thu, 21 May 2015 11:35:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at grimnir.das-netzwerkteam.de Received: from grimnir.das-netzwerkteam.de ([127.0.0.1]) by localhost (grimnir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GqfEjOoeH2CA; Thu, 21 May 2015 11:35:30 +0200 (CEST) Received: from grimnir.das-netzwerkteam.de (localhost [127.0.0.1]) by grimnir.das-netzwerkteam.de (Postfix) with ESMTPS id 615DC3BAB2; Thu, 21 May 2015 11:35:30 +0200 (CEST) Received: from bifrost.das-netzwerkteam.de (bifrost.das-netzwerkteam.de [178.62.101.154]) by mail.das-netzwerkteam.de (Horde Framework) with HTTP; Thu, 21 May 2015 09:35:30 +0000 Date: Thu, 21 May 2015 09:35:30 +0000 Message-ID: <20150521093530.Horde.Oeys0xv-mTUN5U5IZtdeLA1@mail.das-netzwerkteam.de> From: Mike Gabriel To: Francesco Poli , 784565@bugs.debian.org Cc: nito.martinez@qindel.com, opensource@gznianguan.com Subject: Re: [pkg-x2go-devel] Bug#784565: Bug#784565: Bug#784565: Bug#784565: nx-libs-lite: parts are derived from non-free code References: <20150506173532.7531.31389.reportbug@homebrew> <20150511092636.Horde.oj6sHKnvQDt85T3EW1WhVA1@mail.das-netzwerkteam.de> <20150511213659.34dce0505c493c1e23d2c3ee@paranoici.org> <20150512044637.Horde.8WHdvRpU7GS9Szy323gv_Q2@mail.das-netzwerkteam.de> <55521444.9090407@vigor.nu> <1431445315.4712.7.camel@Nokia-N900> <20150512234048.054319a449ffadcf87577425@paranoici.org> <20150514045809.Horde.-3NIZzBnA5V5B6a721F2kg2@mail.das-netzwerkteam.de> <20150516091912.Horde.W_1Szu5msccGYo-Ndwv3cg1@mail.das-netzwerkteam.de> <555A558E.1020703@vigor.nu> <1431985731.1406.2.camel@Nokia-N900> <20150519001408.8e5452a098db48d6867af6cb@paranoici.org> <555A8EE9.9000503@vigor.nu> <20150519081512.Horde.36QI-nOdkbpWsXrDE4E8Yw1@mail.das-netzwerkteam.de> <20150520200325.6641876f5b4b2f483bdaea7d@paranoici.org> In-Reply-To: <20150520200325.6641876f5b4b2f483bdaea7d@paranoici.org> User-Agent: Internet Messaging Program (IMP) H5 (6.2.2) Accept-Language: de,en Organization: DAS-NETZWERKTEAM X-Originating-IP: 178.62.101.154 X-Remote-Browser: Mozilla/5.0 (X11; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0 Iceweasel/32.0 Content-Type: multipart/signed; boundary="=_5hM8_j7kivGPCYTZql9Fug5"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 This message is in MIME format and has been PGP signed. --=_5hM8_j7kivGPCYTZql9Fug5 Content-Type: text/plain; charset=us-ascii; format=flowed; DelSp=Yes Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Control: forwarded -1 https://github.com/ArcticaProject/nx-libs/issues/30 Hi Francesco, On Mi 20 Mai 2015 20:03:25 CEST, Francesco Poli wrote: > On Tue, 19 May 2015 08:15:12 +0000 Mike Gabriel wrote: > > [...] >> @Frederico: I guess we are through then. > > Yes, it seems so (I'm assuming you meant to direct this question to > me...). Yes. :-) >> For fixing this issue (in terms of closing the bug), I propose this >> for downstream (i.e., Debian): >> >> o copy bug_784565.mbox [1] into the debian/ folder of the >> nx-libs-lite package > > Maybe the entire bug log is an overkill... > I would include the relevant replies only. For instance: > https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=3D40;mbox=3Dyes;bug=3D7= 84565 > https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=3D77;mbox=3Dyes;bug=3D7= 84565 > https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=3D87;mbox=3Dyes;bug=3D7= 84565 > https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=3D102;mbox=3Dyes;bug=3D= 784565 ACK. >> o upload some latest release of nx-libs-lite 3.5.0.x to unstable >> o update debian/copyright accordingly > > In the debian/copyright file the license for the original DXPC code > should be replaced with the 2-clause BSD license (currently adopted for > DXPC) with a comment saying something like: > > The original DXPC code used to be available under a license which > failed to explicitly grant the permission to modify, but was later > retroactively re-licensed under the 2-clause BSD license (see > debian/bug_784565_*.mbox for the copyright owners' statements; see > for more details) > > Moreover, the copyright notice of Gian Filippo Pinzari should be > documented in some more appropriate part of the debian/copyright file, > associated with the NoMachine license (GPL v2 or later). > >> o close this bug via debian/changelog >> >> For upstream, I propose this: >> >> o copy bug_784565.mbox into the docs/ folder > > Again, I would not include the entire bug log, but only the relevant > messages (see above)... > >> o update copyright information in nxcomp/ subfolder >> o provide some README or such that shortly explains our last=20=20 >>=20weeks' process >> o this will be for the upcoming 3.6.x release series of nx-libs >> >> o this should also be backported to the 3.5.x release series Doing all the above now. Thanks to all, Mike --=20 DAS-NETZWERKTEAM mike=20gabriel, herweg 7, 24357 fleckeby fon: +49 (1520) 1976 148 GnuPG Key ID 0x25771B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.x= fb --=_5hM8_j7kivGPCYTZql9Fug5 Content-Type: application/pgp-signature Content-Description: Digitale PGP-Signatur Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVXabiAAoJEJr0azAldxsxd4cP/in26lIPvdANMyDaqq3zQOMh n/Q+oZK5SYnHQP7vaS4mOWjTw5tCbfcUMcKwu1KpbgpUGOl9e1c/oKGxR3j5GWh3 XiqQhPWEMf64OsM4vW5prJFrx0VNqfxykMWbGzQfs6Dz9ihJ6+HzVudOk3bfHwj2 GahCflRo7xA1hJjwz5cIX1/WJaAF25TVSQ43jVpPu0pnAYOWvhOAZMpTJTZqRbgT peuFaiKE+NOb4C/WO9mkuO3wlEBZ5Ef/RinKQDlbV5/CZElEs1f42A4t5q909EVi U2PpaEis8BJAIKetl8g/bPoHh9u6X3tbeOKJlZBo5l2SMyLUG0sYsoAyhJKJtIvk gwdGdO71A7HLEJ6DfvE8vYXUPy9JEOQ6hhL2qeZOtJG2DZ2Qcoll9eK5scg2YutW ZXHRTYcCQeS4PQpvQPlCR5LuFTJeNBwJ0cWgtfXYPIrPMyeEZj/VP+Ypm82hBT+I JFjo80QjOEJ7uEM1wmn8nD0rbbP/NVf6ot/UcwlejC/XaYIlWDW5FrXf18UbGsvu VzaHkLbhbGUYedwsb50Uu6Nn4IX8IEcF3zbwnqmB5IlbPYV0UokjgtnKEIQbdmF4 fQ5xe5u/p2aZTnQwt39vey2W/RxJVOHRjVVrYGv0eqgda8TYOWzI3UIjSYGfuLcU kDRest50Qfy4tmilPx3z =Cf5/ -----END PGP SIGNATURE----- --=_5hM8_j7kivGPCYTZql9Fug5-- nx-libs-3.5.99.23/doc/nxcompext/symbols/nxcompext::symbols.txt0000644000000000000000000000342413614532331021157 0ustar AlphaCompressData BitmapCompressData CleanXYImage CleanZImage ColormapCompressData CopyAndCleanImage FindLSB JpegCompressData MaskImage MaskInPlaceImage NXAbortSplit NXAllocColors NXAllocSplit NXAllocUnpack NXCacheAddImage NXCacheFindImage NXCleanImage NXCollectGrabPointer NXCollectImage NXCollectInputFocus NXCollectProperty NXCommitSplit NXCreatePackedImage NXCreatePalette16 NXCreatePalette32 NXDestroyPackedImage NXDisplayCongestion NXDisplayError NXDisplayFlushable NXDisplayReadable NXEncodeAlpha NXEncodeBitmap NXEncodeColormap NXEncodeColors NXEncodeJpeg NXEncodePng NXEncodeRgb NXEncodeRle NXEndSplit NXFinishSplit NXFlushDisplay NXForceDisplayError NXFreeCache NXFreeSplit NXFreeUnpack NXGetCollectGrabPointerResource NXGetCollectImageResource NXGetCollectInputFocusResource NXGetCollectPropertyResource NXGetCollectedGrabPointer NXGetCollectedImage NXGetCollectedInputFocus NXGetCollectedProperty NXGetControlParameters NXGetFontParameters NXGetShmemParameters NXGetUnpackParameters NXHandleDisplayError NXImageCache NXImageCacheHits NXImageCacheOps NXImageCacheSize NXInPlacePackImage NXInitCache NXInitDisplay NXMaskImage NXPackImage NXPutPackedImage NXResetDisplay NXSetCacheParameters NXSetDisplayBlockHandler NXSetDisplayBuffer NXSetDisplayErrorPredicate NXSetDisplayFlushHandler NXSetDisplayPolicy NXSetDisplayStatisticsHandler NXSetDisplayWriteHandler NXSetExposeParameters NXSetLostSequenceHandler NXSetUnpackAlpha NXSetUnpackAlphaCompat NXSetUnpackColormap NXSetUnpackColormapCompat NXSetUnpackGeometry NXStartSplit NXUnsetLibraryPath PackImage PngCompareColorTable PngCompressData RgbCompressData RleCompressData ZCompressData ZInitEncoder ZResetEncoder _NXInternalInitEncoders _NXInternalInitResources _NXInternalResetEncoders _NXInternalResetResources color_type info_ptr palette png_ptr nx-libs-3.5.99.23/doc/nxcompext/symbols/nxcompext::symbol-usage_internally.txt0000644000000000000000000021742113614532331024343 0ustar #### AlphaCompressData #### Alpha.c:46:char *AlphaCompressData(const char *data, unsigned int size, unsigned int *compressed_size) Compext.c:2634: return AlphaCompressData(src_data, src_size, dst_size); Alpha.h:33:extern char *AlphaCompressData( #### BitmapCompressData #### Bitmap.c:38:char *BitmapCompressData(XImage *image, unsigned int *size) Bitmap.c:43: fprintf(stderr, "******BitmapCompressData: Nothing to do with image of [%d] bpp and size [%d].\n", Bitmap.c:66: fprintf(stderr, "******BitmapCompressData: PANIC! Image as [%d] bytes per line with expected [%d].\n", Bitmap.c:81: fprintf(stderr, "******BitmapCompressData: PANIC! Failed to allocate [%d] bytes for the destination.\n", Compext.c:2750: dst_image -> data = BitmapCompressData(src_image, &dst_size); Bitmap.h:33:extern char *BitmapCompressData( #### CleanXYImage #### Clean.c:40:int CleanXYImage(XImage *image) Compext.c:2094: return CleanXYImage(image); Compext.c:2103: return CleanXYImage(image); Clean.h:35:int CleanXYImage(XImage *image); #### CleanZImage #### Clean.c:85:int CleanZImage(XImage *image) Clean.c:92: fprintf(stderr, "*****CleanZImage: Going to clean image of [%d] bits per pixel.\n", Clean.c:113: fprintf(stderr, "*****CleanZImage: Cleaning [%d] bytes with bits per pixel [%d] " Clean.c:159: fprintf(stderr, "*****CleanZImage: PANIC! Cannot clean image with [%d] bits per pixel.\n", Compext.c:2098: return CleanZImage(image); Clean.h:36:int CleanZImage(XImage *image); #### ColormapCompressData #### Colormap.c:46:char *ColormapCompressData(const char *data, unsigned int size, unsigned int *compressed_size) Compext.c:2629: return ColormapCompressData(src_data, src_size, dst_size); Colormap.h:33:extern char *ColormapCompressData( #### CopyAndCleanImage #### Clean.c:189:int CopyAndCleanImage(XImage *src_image, XImage *dst_image) Compext.c:2215: if (CopyAndCleanImage(src_image, dst_image) <= 0) Clean.h:38:int CopyAndCleanImage(XImage *src_image, XImage *dst_image); #### FindLSB #### Jpeg.c:137: redShift = FindLSB(image -> red_mask) - 1; Jpeg.c:138: greenShift = FindLSB(image -> green_mask) - 1; Jpeg.c:139: blueShift = FindLSB(image -> blue_mask) - 1; Mask.c:785:int FindLSB(int word) Png.c:289: redShift = FindLSB(image -> red_mask) - 1; Png.c:290: greenShift = FindLSB(image -> green_mask) - 1; Png.c:291: blueShift = FindLSB(image -> blue_mask) - 1; Mask.h:42:int FindLSB(int word); #### JpegCompressData #### Compext.c:2810: dst_image -> data = JpegCompressData(src_image, quality, &size); Jpeg.c:109:char *JpegCompressData(XImage *image, int level, int *compressed_size) Jpeg.c:130: fprintf(stderr, "******JpegCompressData: Image byte order [%d] bitmap bit order [%d].\n", Jpeg.c:133: fprintf(stderr, "******JpegCompressData: Bits per pixel [%d] bytes per line [%d].\n", Jpeg.c:142: fprintf(stderr, "******JpegCompressData: Red mask [0x%lx] green mask [0x%lx] blue mask [0x%lx].\n", Jpeg.c:145: fprintf(stderr, "******JpegCompressData: Red shift [%d] green shift [%d] blue shift [%d].\n", Jpeg.c:154: fprintf(stderr, "******JpegCompressData: Red max [0x%x] green max [0x%x] blue max [0x%x].\n", Jpeg.c:164: fprintf(stderr, "******JpegCompressData: Width [%d] height [%d] level [%d].\n", Jpeg.c:172: fprintf(stderr, "******JpegCompressData: PANIC! Invalid bits per pixel [%d].\n", Jpeg.c:185: fprintf(stderr, "******JpegCompressData: Allocating [%d] bytes for the scanline.\n", Jpeg.c:194: fprintf(stderr, "******JpegCompressData: PANIC! Cannot allocate [%d] bytes.\n", Jpeg.c:223: fprintf(stderr, "******JpegCompressData: Allocating [%d] bytes for the destination data.\n", Jpeg.c:232: fprintf(stderr, "******JpegCompressData: PANIC! Error allocating [%d] bytes for the Jpeg data.\n", Jpeg.h:33:extern char *JpegCompressData( #### MaskImage #### Compext.c:247:#define CanMaskImage(image, mask) \ Compext.c:254:#define ShouldMaskImage(image, mask) (mask -> color_mask != 0xff) Compext.c:2141: else if (CanMaskImage(src_image, mask) == 0) Compext.c:2208: ShouldMaskImage(src_image, mask) == 0) Compext.c:2228: else if (MaskImage(mask, src_image, dst_image) <= 0) Compext.c:2328: else if (CanMaskImage(src_image, mask) == 0) Compext.c:2381: ShouldMaskImage(src_image, mask) == 0) Compext.c:2934:void NXMaskImage(XImage *image, unsigned int method) Compext.c:2952: fprintf(stderr, "******NXMaskImage: Method is MASK_8_COLORS\n"); Compext.c:2963: fprintf(stderr, "******NXMaskImage: Method is MASK_64K_COLORS\n"); Compext.c:2974: fprintf(stderr, "******NXMaskImage: Method is MASK_256_COLORS\n"); Compext.c:2985: fprintf(stderr, "******NXMaskImage: Method is MASK_512K_COLORS\n"); Compext.c:2996: fprintf(stderr, "******NXMaskImage: Method is MASK_4K_COLORS\n"); Compext.c:3007: fprintf(stderr, "******NXMaskImage: Method is MASK_32K_COLORS\n"); Compext.c:3018: fprintf(stderr, "******NXMaskImage: Method is MASK_64K_COLORS\n"); Compext.c:3029: fprintf(stderr, "******NXMaskImage: Method is MASK_256K_COLORS\n"); Compext.c:3040: fprintf(stderr, "******NXMaskImage: Method is MASK_2M_COLORS\n"); Compext.c:3051: fprintf(stderr, "******NXMaskImage: Method is MASK_16M_COLORS\n"); Compext.c:3059: fprintf(stderr, "******NXMaskImage: PANIC! Cannot find mask method for pack method [%d]\n", Compext.c:3068: fprintf(stderr, "******NXMaskImage: packMethod[%d] => maskMethod[%d]\n", Compext.c:3083: fprintf(stderr, "******NXMaskImage: PANIC! No mask to apply for pack method [%d].\n", Compext.c:3089: else if (CanMaskImage(image, mask) == 0) Compext.c:3092: fprintf(stderr, "******NXMaskImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", Compext.c:3095: fprintf(stderr, "******NXMaskImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", Compext.c:3103: * Calling ShouldMaskImage you get 0 in the case Compext.c:3108: if (ShouldMaskImage(image, mask) == 0) Compext.c:3111: fprintf(stderr, "******NXMaskImage: the image will not be masked\n"); Compext.c:3119: fprintf(stderr, "******NXMaskImage: PANIC! Failed to apply the color mask in place.\n"); Mask.c:67:int MaskImage(const ColorMask *mask, XImage *src_image, XImage *dst_image) Mask.c:82: fprintf(stderr, "******MaskImage: Going to mask image with [%d] bits per pixel.\n", Mask.c:101: fprintf(stderr, "******MaskImage: 24/32 bits original R [%d] G [%d] B [%d] A [%d].\n", Mask.c:108: fprintf(stderr, "******MaskImage: 24/32 bits masked R [%d] G [%d] B [%d] A [%d].\n", Mask.c:113: fprintf(stderr, "******MaskImage: 24/32 bits pixel 0x%lx", pixel); Mask.c:151: fprintf(stderr, "******MaskImage: 16 bits original R [%d] G [%d] B [%d].\n", Mask.c:158: fprintf(stderr, "******MaskImage: 16 bits masked R [%d] G [%d] B [%d].\n", Mask.c:167: fprintf(stderr, "******MaskImage: 16 bits pixel 0x%x", dst_pixels_addr[0]); Mask.c:175: fprintf(stderr, "******MaskImage: 16 bits original R [%d] G [%d] B [%d].\n", Mask.c:182: fprintf(stderr, "******MaskImage: 16 bits masked R [%d] G [%d] B [%d].\n", Mask.c:191: fprintf(stderr, "******MaskImage: 16 bits pixel 0x%x", dst_pixels_addr[0]); Mask.c:215: fprintf(stderr, "******MaskImage: PANIC! Cannot apply mask with [%d] bits per pixel.\n", Mask.c:371: fprintf(stderr, "******MaskImage: PANIC! Cannot apply mask with [%d] bits per pixel.\n", Compext.h:759:extern void NXMaskImage( Mask.h:35:extern int MaskImage(const ColorMask *mask, XImage *src_image, XImage *dst_image); #### MaskInPlaceImage #### Compext.c:2399: else if (MaskInPlaceImage(mask, dst_image) <= 0) Compext.c:3116: if (MaskInPlaceImage(mask, image) <= 0) Mask.c:225:int MaskInPlaceImage(const ColorMask *mask, XImage *image) Mask.c:240: fprintf(stderr, "******MaskInPlaceImage: Going to mask image with [%d] bits per pixel.\n", Mask.c:259: fprintf(stderr, "******MaskInPlaceImage: 24/32 bits original R [%d] G [%d] B [%d] A [%d].\n", Mask.c:266: fprintf(stderr, "******MaskInPlaceImage: 24/32 bits masked R [%d] G [%d] B [%d] A [%d].\n", Mask.c:271: fprintf(stderr, "******MaskInPlaceImage: 24/32 bits pixel 0x%lx", pixel); Mask.c:307: fprintf(stderr, "******MaskInPlaceImage: 16 bits original R [%d] G [%d] B [%d].\n", Mask.c:314: fprintf(stderr, "******MaskInPlaceImage: 16 bits masked R [%d] G [%d] B [%d].\n", Mask.c:323: fprintf(stderr, "******MaskInPlaceImage: 16 bits pixel 0x%x", pixels_addr[0]); Mask.c:331: fprintf(stderr, "******MaskInPlaceImage: 16 bits original R [%d] G [%d] B [%d].\n", Mask.c:338: fprintf(stderr, "******MaskInPlaceImage: 16 bits masked R [%d] G [%d] B [%d].\n", Mask.c:347: fprintf(stderr, "******MaskInPlaceImage: 16 bits pixel 0x%x", pixels_addr[1]); Mask.h:37:extern int MaskInPlaceImage(const ColorMask *mask, XImage *image); #### NXAbortSplit #### Compext.c:1418:int NXAbortSplit(Display *dpy, unsigned int resource) Compext.c:1420: register xNXAbortSplitReq *req; Compext.c:1424: GetReq(NXAbortSplit, req); Compext.c:1427: fprintf(stderr, "******NXAbortSplit: Sending message opcode [%d] with resource [%u].\n", Compext.c:1428: X_NXAbortSplit, resource); Compext.h:491:extern int NXAbortSplit( #### NXAllocColors #### Compext.c:2574:int NXAllocColors(Display *dpy, Colormap colormap, unsigned int entries, Compext.h:668:extern int NXAllocColors( #### NXAllocSplit #### Compext.c:1276:unsigned int NXAllocSplit(Display *dpy, unsigned int resource) Compext.c:1287: fprintf(stderr, "******NXAllocSplit: Reserved resource [%u].\n", Compext.c:1296: fprintf(stderr, "******NXAllocSplit: WARNING! Resource limit exausted.\n"); Compext.c:1307: fprintf(stderr, "******NXAllocSplit: Reserved requested resource [%u].\n", Compext.c:1312: fprintf(stderr, "******NXAllocSplit: Requested resource [%u] already reserved.\n", Compext.c:1322: fprintf(stderr, "******NXAllocSplit: PANIC! Can't reserve requested resource [%u].\n", Compext.h:459:extern unsigned int NXAllocSplit( #### NXAllocUnpack #### Compext.c:1561:unsigned int NXAllocUnpack(Display *dpy, unsigned int resource) Compext.c:1572: fprintf(stderr, "******NXAllocUnpack: Reserved resource [%u].\n", Compext.c:1581: fprintf(stderr, "******NXAllocUnpack: WARNING! Resource limit exausted.\n"); Compext.c:1592: fprintf(stderr, "******NXAllocUnpack: Reserved requested resource [%u].\n", Compext.c:1597: fprintf(stderr, "******NXAllocUnpack: Requested resource [%u] already reserved.\n", Compext.c:1607: fprintf(stderr, "******NXAllocUnpack: PANIC! Can't reserve requested resource [%u].\n", Compext.h:531:extern unsigned int NXAllocUnpack( #### NXCacheAddImage #### Compext.c:3318:int NXCacheAddImage(NXPackedImage *image, unsigned int method, unsigned char *md5) Compext.c:3325: fprintf(stderr, "******NXCacheAddImage: PANIC! Invalid image passed to function.\n"); Compext.c:3336: fprintf(stderr, "******NXCacheAddImage: Freeing up the oldest entry.\n"); Compext.c:3354: fprintf(stderr, "******NXCacheAddImage: Going to add new image with data size [%d].\n", Compext.c:3364: _NXCacheDump("******NXCacheAddImage"); Compext.h:789:extern int NXCacheAddImage( #### NXCacheFindImage #### Compext.c:3205:XImage *NXCacheFindImage(NXPackedImage *src_image, unsigned int *method, unsigned char **md5) Compext.c:3226: fprintf(stderr, "******NXCacheFindImage: Can't allocate memory for the checksum.\n"); Compext.c:3260: fprintf(stderr, "******NXCacheFindImage: Found at position [%d] with hits [%d] and [%d] packs.\n", Compext.c:3275: fprintf(stderr, "******NXCacheFindImage: Moving the image at the head of the list.\n"); Compext.c:3286: _NXCacheDump("******NXCacheFindImage"); Compext.h:781:extern XImage *NXCacheFindImage( #### NXCleanImage #### Compext.c:2082:int NXCleanImage(XImage *image) Compext.c:2085: fprintf(stderr, "******NXCleanImage: Cleaning image with format [%d] depth [%d] " Compext.c:2388: if (NXCleanImage(dst_image) <= 0) Compext.h:753:extern int NXCleanImage( #### NXCollectGrabPointer #### Compext.c:152:} _NXCollectGrabPointerState; Compext.c:154:static _NXCollectGrabPointerState *_NXCollectedGrabPointers[NXNumberOfResources]; Compext.c:4204: async_event.xclient.data.l[0] = NXCollectGrabPointerNotify; Compext.c:4211:static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf, Compext.c:4214: register _NXCollectGrabPointerState *state; Compext.c:4222: state = (_NXCollectGrabPointerState *) data; Compext.c:4228: fprintf(stderr, "******_NXCollectGrabPointerHandler: Unmatched sequence [%d] for opcode [%d] " Compext.c:4237: fprintf(stderr, "******_NXCollectGrabPointerHandler: Going to handle asynchronous GrabPointer reply.\n"); Compext.c:4249: fprintf(stderr, "******_NXCollectGrabPointerHandler: Error received from X server for resource [%d].\n", Compext.c:4263: fprintf(stderr, "******_NXCollectGrabPointerHandler: Matched request with sequence [%ld].\n", Compext.c:4274: fprintf(stderr, "******_NXCollectGrabPointerHandler: PANIC! Failed to allocate memory with resource [%d].\n", Compext.c:4288: fprintf(stderr, "******_NXCollectGrabPointerHandler: Going to get reply with size [%d].\n", Compext.c:4297: fprintf(stderr, "******_NXCollectGrabPointerHandler: PANIC! Failed to get reply with resource [%d].\n", Compext.c:4313: fprintf(stderr, "******_NXCollectGrabPointerHandler: Got reply with status [%d] size [%d].\n", Compext.c:4341:int NXCollectGrabPointer(Display *dpy, unsigned int resource, Window grab_window, Bool owner_events, Compext.c:4347: _NXCollectGrabPointerState *state; Compext.c:4353: fprintf(stderr, "******NXCollectGrabPointer: PANIC! Provided resource [%u] is out of range.\n", Compext.c:4365: fprintf(stderr, "******NXCollectGrabPointer: PANIC! Having to remove previous state for resource [%u].\n", Compext.c:4395: fprintf(stderr, "******NXCollectGrabPointer: Sending message opcode [%d] sequence [%ld] " Compext.c:4399: state = Xmalloc(sizeof(_NXCollectGrabPointerState)); Compext.c:4405: fprintf(stderr, "******NXCollectGrabPointer: Failed to allocate memory with resource [%d].\n", Compext.c:4433: handler -> handler = _NXCollectGrabPointerHandler; Compext.c:4448: register _NXCollectGrabPointerState *state; Compext.h:863:extern int NXCollectGrabPointer( #### NXCollectImage #### Compext.c:116:} _NXCollectImageState; Compext.c:118:static _NXCollectImageState *_NXCollectedImages[NXNumberOfResources]; Compext.c:3441: async_event.xclient.data.l[0] = NXCollectImageNotify; Compext.c:3448:static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, Compext.c:3451: register _NXCollectImageState *state; Compext.c:3460: state = (_NXCollectImageState *) data; Compext.c:3466: fprintf(stderr, "******_NXCollectImageHandler: Unmatched sequence [%d] for opcode [%d] " Compext.c:3475: fprintf(stderr, "******_NXCollectImageHandler: Going to handle asynchronous GetImage reply.\n"); Compext.c:3494: fprintf(stderr, "******_NXCollectImageHandler: Error received from X server for resource [%d].\n", Compext.c:3508: fprintf(stderr, "******_NXCollectImageHandler: Matched request with sequence [%ld].\n", Compext.c:3519: fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to allocate memory with resource [%d].\n", Compext.c:3533: fprintf(stderr, "******_NXCollectImageHandler: Going to get reply with size [%d].\n", Compext.c:3542: fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to get reply with resource [%d].\n", Compext.c:3558: fprintf(stderr, "******_NXCollectImageHandler: Got reply with depth [%d] visual [%d] size [%d].\n", Compext.c:3571: fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to allocate memory with resource [%d].\n", Compext.c:3587: fprintf(stderr, "******_NXCollectImageHandler: Going to get data with size [%d].\n", Compext.c:3617: fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to create image for resource [%d].\n", Compext.c:3634: fprintf(stderr, "******_NXCollectImageHandler: Successfully stored image data for resource [%d].\n", Compext.c:3641: fprintf(stderr, "******_NXCollectImageHandler: WARNING! Null image data stored for resource [%d].\n", Compext.c:3668:int NXCollectImage(Display *dpy, unsigned int resource, Drawable drawable, Compext.c:3674: _NXCollectImageState *state; Compext.c:3680: fprintf(stderr, "******NXCollectImage: PANIC! Provided resource [%u] is out of range.\n", Compext.c:3692: fprintf(stderr, "******NXCollectImage: PANIC! Having to remove previous state for resource [%u].\n", Compext.c:3726: fprintf(stderr, "******NXCollectImage: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", Compext.c:3729: fprintf(stderr, "******NXCollectImage: Format [%d] drawable [%d] src_x [%d] src_y [%d].\n", Compext.c:3732: fprintf(stderr, "******NXCollectImage: Width [%d] height [%d] plane_mask [%x].\n", Compext.c:3736: state = Xmalloc(sizeof(_NXCollectImageState)); Compext.c:3742: fprintf(stderr, "******NXCollectImage: PANIC! Failed to allocate memory with resource [%d].\n", Compext.c:3774: handler -> handler = _NXCollectImageHandler; Compext.c:3789: register _NXCollectImageState *state; Compext.h:804:extern int NXCollectImage( #### NXCollectInputFocus #### Compext.c:168:} _NXCollectInputFocusState; Compext.c:170:static _NXCollectInputFocusState *_NXCollectedInputFocuses[NXNumberOfResources]; Compext.c:4488: async_event.xclient.data.l[0] = NXCollectInputFocusNotify; Compext.c:4495:static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf, Compext.c:4498: register _NXCollectInputFocusState *state; Compext.c:4506: state = (_NXCollectInputFocusState *) data; Compext.c:4512: fprintf(stderr, "******_NXCollectInputFocusHandler: Unmatched sequence [%d] for opcode [%d] " Compext.c:4521: fprintf(stderr, "******_NXCollectInputFocusHandler: Going to handle asynchronous GetInputFocus reply.\n"); Compext.c:4533: fprintf(stderr, "******_NXCollectInputFocusHandler: Error received from X server for resource [%d].\n", Compext.c:4547: fprintf(stderr, "******_NXCollectInputFocusHandler: Matched request with sequence [%ld].\n", Compext.c:4558: fprintf(stderr, "******_NXCollectInputFocusHandler: PANIC! Failed to allocate memory with resource [%d].\n", Compext.c:4572: fprintf(stderr, "******_NXCollectInputFocusHandler: Going to get reply with size [%d].\n", Compext.c:4581: fprintf(stderr, "******_NXCollectInputFocusHandler: PANIC! Failed to get reply with resource [%d].\n", Compext.c:4597: fprintf(stderr, "******_NXCollectInputFocusHandler: Got reply with focus [%d] revert to [%d] " Compext.c:4627:int NXCollectInputFocus(Display *dpy, unsigned int resource) Compext.c:4631: _NXCollectInputFocusState *state; Compext.c:4637: fprintf(stderr, "******NXCollectInputFocus: PANIC! Provided resource [%u] is out of range.\n", Compext.c:4649: fprintf(stderr, "******NXCollectInputFocus: PANIC! Having to remove previous state for resource [%u].\n", Compext.c:4670: fprintf(stderr, "******NXCollectInputFocus: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", Compext.c:4674: state = Xmalloc(sizeof(_NXCollectInputFocusState)); Compext.c:4680: fprintf(stderr, "******NXCollectInputFocus: Failed to allocate memory with resource [%d].\n", Compext.c:4709: handler -> handler = _NXCollectInputFocusHandler; Compext.c:4725: register _NXCollectInputFocusState *state; Compext.h:892:extern int NXCollectInputFocus( #### NXCollectProperty #### Compext.c:137:} _NXCollectPropertyState; Compext.c:139:static _NXCollectPropertyState *_NXCollectedProperties[NXNumberOfResources]; Compext.c:3834: async_event.xclient.data.l[0] = NXCollectPropertyNotify; Compext.c:3841:static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, Compext.c:3844: register _NXCollectPropertyState *state; Compext.c:3853: state = (_NXCollectPropertyState *) data; Compext.c:3859: fprintf(stderr, "******_NXCollectPropertyHandler: Unmatched sequence [%d] for opcode [%d] " Compext.c:3868: fprintf(stderr, "******_NXCollectPropertyHandler: Going to handle asynchronous GetProperty reply.\n"); Compext.c:3887: fprintf(stderr, "******_NXCollectPropertyHandler: Error received from X server for resource [%d].\n", Compext.c:3901: fprintf(stderr, "******_NXCollectPropertyHandler: Matched request with sequence [%ld].\n", Compext.c:3912: fprintf(stderr, "******_NXCollectPropertyHandler: PANIC! Failed to allocate memory with resource [%d].\n", Compext.c:3926: fprintf(stderr, "******_NXCollectPropertyHandler: Going to get reply with size [%d].\n", Compext.c:3935: fprintf(stderr, "******_NXCollectPropertyHandler: PANIC! Failed to get reply with resource [%d].\n", Compext.c:3951: fprintf(stderr, "******_NXCollectPropertyHandler: Got reply with format [%d] type [%d] size [%d].\n", Compext.c:3954: fprintf(stderr, "******_NXCollectPropertyHandler: Bytes after [%d] number of items [%d].\n", Compext.c:3972: fprintf(stderr, "******_NXCollectPropertyHandler: PANIC! Failed to allocate memory with resource [%d].\n", Compext.c:3988: fprintf(stderr, "******_NXCollectPropertyHandler: Going to get data with size [%d].\n", Compext.c:4002: fprintf(stderr, "******_NXCollectPropertyHandler: Successfully stored property data for resource [%d].\n", Compext.c:4009: fprintf(stderr, "******_NXCollectPropertyHandler: WARNING! Null property data stored for resource [%d].\n", Compext.c:4036:int NXCollectProperty(Display *dpy, unsigned int resource, Window window, Atom property, Compext.c:4041: _NXCollectPropertyState *state; Compext.c:4047: fprintf(stderr, "******NXCollectProperty: PANIC! Provided resource [%u] is out of range.\n", Compext.c:4059: fprintf(stderr, "******NXCollectProperty: PANIC! Having to remove previous state for resource [%u].\n", Compext.c:4092: fprintf(stderr, "******NXCollectProperty: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", Compext.c:4095: fprintf(stderr, "******NXCollectProperty: Delete [%u] window [%d] property [%d] type [%d].\n", Compext.c:4098: fprintf(stderr, "******NXCollectProperty: Long offset [%d] long length [%d].\n", Compext.c:4102: state = Xmalloc(sizeof(_NXCollectPropertyState)); Compext.c:4108: fprintf(stderr, "******NXCollectProperty: Failed to allocate memory with resource [%d].\n", Compext.c:4142: handler -> handler = _NXCollectPropertyHandler; Compext.c:4159: register _NXCollectPropertyState *state; Compext.h:832:extern int NXCollectProperty( #### NXCommitSplit #### Compext.c:1391:int NXCommitSplit(Display *dpy, unsigned int resource, unsigned int propagate, Compext.c:1394: register xNXCommitSplitReq *req; Compext.c:1398: GetReq(NXCommitSplit, req); Compext.c:1406: fprintf(stderr, "******NXCommitSplit: Sending opcode [%d] with resource [%d] propagate [%d] " Compext.c:1407: "request [%d] position [%d].\n", X_NXCommitSplit, resource, Compext.h:426: * NXCommitSplitNotify One of the requests that made up the Compext.h:481:extern int NXCommitSplit( #### NXCreatePackedImage #### Compext.c:2050:NXPackedImage *NXCreatePackedImage(Display *dpy, Visual *visual, unsigned int method, Compext.h:601:NXPackedImage *NXCreatePackedImage( #### NXCreatePalette16 #### Png.c:176:int NXCreatePalette16(XImage *src_image, NXColorTable *color_table, CARD8 *image_index, int nb_max) Png.c:385: nb_colors = NXCreatePalette16(image, color_table, image_index, NB_COLOR_MAX); Png.h:53:int NXCreatePalette16( #### NXCreatePalette32 #### Png.c:112:int NXCreatePalette32(XImage *src_image, NXColorTable *color_table, CARD8 *image_index, int nb_max) Png.c:389: nb_colors = NXCreatePalette32(image, color_table, image_index, NB_COLOR_MAX); Png.h:62:int NXCreatePalette32( #### NXDestroyPackedImage #### Compext.c:2073:int NXDestroyPackedImage(NXPackedImage *image) Compext.h:617:extern int NXDestroyPackedImage( #### NXDisplayCongestion #### Compext.c:645:int NXDisplayCongestion(Display *dpy) Compext.c:651: fprintf(stderr, "******NXDisplayCongestion: Returning [%d] as congestion level for fd [%d].\n", Compext.h:192:extern int NXDisplayCongestion( #### NXDisplayError #### Compext.c:580:int NXDisplayError(Display *dpy) Compext.c:585: (_NXDisplayErrorFunction != NULL && Compext.c:586: (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))); Compext.c:689:NXDisplayErrorPredicate NXSetDisplayErrorPredicate(NXDisplayErrorPredicate predicate) Compext.c:691: NXDisplayErrorPredicate previous = _NXDisplayErrorFunction; Compext.c:693: _NXDisplayErrorFunction = predicate; Compext.h:156:extern int NXDisplayError( Compext.h:216:extern NXDisplayErrorPredicate NXSetDisplayErrorPredicate( Compext.h:218: NXDisplayErrorPredicate /* predicate */ #### NXDisplayFlushable #### Compext.c:622:int NXDisplayFlushable(Display *dpy) Compext.c:631: fprintf(stderr, "******NXDisplayFlushable: Returning [%d+%d=%d] bytes flushable " Compext.c:683: NXDisplayFlushable(dpy)); Compext.h:178:extern int NXDisplayFlushable( #### NXDisplayReadable #### Compext.c:597:int NXDisplayReadable(Display *dpy) Compext.c:607: fprintf(stderr, "******NXDisplayReadable: Returning [%d] bytes readable from fd [%d].\n", Compext.c:615: fprintf(stderr, "******NXDisplayReadable: WARNING! Error detected on display fd [%d].\n", Compext.h:167:extern int NXDisplayReadable( #### NXEncodeAlpha #### Compext.c:2632:char *NXEncodeAlpha(const char *src_data, unsigned int src_size, unsigned int *dst_size) Compext.h:690:extern char *NXEncodeAlpha( #### NXEncodeBitmap #### Compext.c:2727:NXPackedImage *NXEncodeBitmap(XImage *src_image, unsigned int method, unsigned int quality) Compext.c:2741: fprintf(stderr, "******NXEncodeBitmap: PANIC! Cannot allocate [%d] bytes for the image.\n", Compext.c:2755: fprintf(stderr, "******NXEncodeBitmap: PANIC! Bitmap compression failed.\n"); Compext.h:745:extern NXPackedImage *NXEncodeBitmap( #### NXEncodeColormap #### Compext.c:2627:char *NXEncodeColormap(const char *src_data, unsigned int src_size, unsigned int *dst_size) Compext.h:682:extern char *NXEncodeColormap( #### NXEncodeColors #### Compext.c:2887:int NXEncodeColors(XImage *src_image, NXColorTable *color_table, int nb_max) Compext.h:729:extern int NXEncodeColors( #### NXEncodeJpeg #### Compext.c:2772:NXPackedImage *NXEncodeJpeg(XImage *src_image, unsigned int method, unsigned int quality) Compext.c:2786: fprintf(stderr, "******NXEncodeJpeg: PANIC! Invalid bpp for Jpeg compression [%d]\n.", Compext.c:2801: fprintf(stderr, "******NXEncodeJpeg: PANIC! Cannot allocate [%d] bytes for the Jpeg image.\n", Compext.c:2815: fprintf(stderr, "******NXEncodeJpeg: PANIC! Jpeg compression failed.\n"); Compext.h:714:extern NXPackedImage *NXEncodeJpeg( #### NXEncodePng #### Compext.c:2832:NXPackedImage *NXEncodePng(XImage *src_image, unsigned int method, unsigned int quality) Compext.c:2846: fprintf(stderr, "******NXEncodePng: PANIC! Invalid bpp for Png compression [%d].\n", Compext.c:2856: fprintf(stderr, "******NXEncodePng: PANIC! Cannot allocate [%d] bytes for the Png image.\n", Compext.c:2870: fprintf(stderr, "******NXEncodePng: PANIC! Png compression failed.\n"); Compext.h:737:extern NXPackedImage *NXEncodePng( #### NXEncodeRgb #### Compext.c:2637:NXPackedImage *NXEncodeRgb(XImage *src_image, unsigned int method, unsigned int quality) Compext.c:2651: fprintf(stderr, "******NXEncodeRgb: PANIC! Cannot allocate [%d] bytes for the image.\n", Compext.c:2665: fprintf(stderr, "******NXEncodeRgb: PANIC! Rgb compression failed.\n"); Compext.h:698:extern NXPackedImage *NXEncodeRgb( #### NXEncodeRle #### Compext.c:2682:NXPackedImage *NXEncodeRle(XImage *src_image, unsigned int method, unsigned int quality) Compext.c:2696: fprintf(stderr, "******NXEncodeRle: PANIC! Cannot allocate [%d] bytes for the image.\n", Compext.c:2710: fprintf(stderr, "******NXEncodeRle: PANIC! Rle compression failed.\n"); Compext.h:706:extern NXPackedImage *NXEncodeRle( #### NXEndSplit #### Compext.c:1361:int NXEndSplit(Display *dpy, unsigned int resource) Compext.c:1363: register xNXEndSplitReq *req; Compext.c:1367: GetReq(NXEndSplit, req); Compext.c:1372: fprintf(stderr, "******NXEndSplit: Sending opcode [%d] with resource [%d].\n", Compext.h:431: * NXEndSplitNotify The split was duly completed. The agent Compext.h:474:extern int NXEndSplit( #### NXFinishSplit #### Compext.c:1440:int NXFinishSplit(Display *dpy, unsigned int resource) Compext.c:1442: register xNXFinishSplitReq *req; Compext.c:1446: GetReq(NXFinishSplit, req); Compext.c:1449: fprintf(stderr, "******NXFinishSplit: Sending message opcode [%d] with resource [%u].\n", Compext.c:1450: X_NXFinishSplit, resource); Compext.h:498:extern int NXFinishSplit( #### NXFlushDisplay #### Compext.c:663:int NXFlushDisplay(Display *dpy, int what) Compext.c:669: fprintf(stderr, "******NXFlushDisplay: Writing with [%d] bytes in the buffer.\n", Compext.c:682: fprintf(stderr, "******NXFlushDisplay: Flushing with [%d] bytes in the NX transport.\n", Compext.h:204:extern int NXFlushDisplay( #### NXForceDisplayError #### Compext.c:550:Bool NXForceDisplayError(Display *dpy) Compext.h:143:extern Bool NXForceDisplayError( #### NXFreeCache #### Compext.c:3375:void NXFreeCache(Display *dpy) Compext.c:3382: fprintf(stderr, "******NXFreeCache: Nothing to do with a null image cache.\n"); Compext.c:3389: fprintf(stderr, "******NXFreeCache: Freeing the cache with [%d] entries.\n", Compext.h:775:extern void NXFreeCache( #### NXFreeSplit #### Compext.c:1462:int NXFreeSplit(Display *dpy, unsigned int resource) Compext.c:1464: register xNXFreeSplitReq *req; Compext.c:1470: GetReq(NXFreeSplit, req); Compext.c:1473: fprintf(stderr, "******NXFreeSplit: Sending message opcode [%d] with resource [%u].\n", Compext.c:1474: X_NXFreeSplit, resource); Compext.c:1484: fprintf(stderr, "******NXFreeSplit: Making the resource [%u] newly available.\n", Compext.c:1493: fprintf(stderr, "******NXFreeSplit: Nothing to do for resource [%u].\n", Compext.h:505:extern int NXFreeSplit( #### NXFreeUnpack #### Compext.c:2004:int NXFreeUnpack(Display *dpy, unsigned int resource) Compext.c:2006: register xNXFreeUnpackReq *req; Compext.c:2012: GetReq(NXFreeUnpack, req); Compext.c:2015: fprintf(stderr, "******NXFreeUnpack: Sending message opcode [%d] with resource [%u].\n", Compext.c:2016: X_NXFreeUnpack, resource); Compext.c:2026: fprintf(stderr, "******NXFreeUnpack: Making the resource [%u] newly available.\n", Compext.c:2035: fprintf(stderr, "******NXFreeUnpack: Nothing to do for resource [%u].\n", Compext.h:586:extern int NXFreeUnpack( #### NXGetCollectGrabPointerResource #### Compext.c:4326:int NXGetCollectGrabPointerResource(Display *dpy) Compext.h:857:extern int NXGetCollectGrabPointerResource( #### NXGetCollectImageResource #### Compext.c:3653:int NXGetCollectImageResource(Display *dpy) Compext.h:798:extern int NXGetCollectImageResource( #### NXGetCollectInputFocusResource #### Compext.c:4612:int NXGetCollectInputFocusResource(Display *dpy) Compext.h:886:extern int NXGetCollectInputFocusResource( #### NXGetCollectPropertyResource #### Compext.c:4021:int NXGetCollectPropertyResource(Display *dpy) Compext.h:826:extern int NXGetCollectPropertyResource( #### NXGetCollectedGrabPointer #### Compext.c:4446:int NXGetCollectedGrabPointer(Display *dpy, unsigned int resource, int *status) Compext.c:4455: fprintf(stderr, "******NXGetCollectedGrabPointer: PANIC! No data collected for resource [%u].\n", Compext.c:4469: fprintf(stderr, "******NXGetCollectedGrabPointer: Returning GrabPointer data for resource [%u].\n", Compext.h:878:extern int NXGetCollectedGrabPointer( #### NXGetCollectedImage #### Compext.c:3787:int NXGetCollectedImage(Display *dpy, unsigned int resource, XImage **image) Compext.c:3796: fprintf(stderr, "******NXGetCollectedImage: PANIC! No image collected for resource [%u].\n", Compext.c:3810: fprintf(stderr, "******NXGetCollectedImage: Returning GetImage data for resource [%u].\n", Compext.h:818:extern int NXGetCollectedImage( #### NXGetCollectedInputFocus #### Compext.c:4722:int NXGetCollectedInputFocus(Display *dpy, unsigned int resource, Compext.c:4732: fprintf(stderr, "******NXGetCollectedInputFocus: PANIC! No data collected for resource [%u].\n", Compext.c:4747: fprintf(stderr, "******NXGetCollectedInputFocus: Returning GetInputFocus data for resource [%u].\n", Compext.h:899:extern int NXGetCollectedInputFocus( #### NXGetCollectedProperty #### Compext.c:4155:int NXGetCollectedProperty(Display *dpy, unsigned int resource, Atom *actual_type_return, Compext.c:4166: fprintf(stderr, "******NXGetCollectedProperty: PANIC! No data collected for resource [%u].\n", Compext.c:4185: fprintf(stderr, "******NXGetCollectedProperty: Returning GetProperty data for resource [%u].\n", Compext.h:845:extern int NXGetCollectedProperty( #### NXGetControlParameters #### Compext.c:813:Status NXGetControlParameters(Display *dpy, unsigned int *link_type, unsigned int *local_major, Compext.c:822: xNXGetControlParametersReply rep; Compext.c:828: GetEmptyReq(NXGetControlParameters, req); Compext.c:831: fprintf(stderr, "******NXGetControlParameters: Sending message opcode [%d].\n", Compext.c:832: X_NXGetControlParameters); Compext.c:838: fprintf(stderr, "******NXGetControlParameters: Error receiving reply.\n"); Compext.c:849: fprintf(stderr, "******NXGetControlParameters: Got reply with link type [%u].\n", rep.linkType); Compext.c:851: fprintf(stderr, "******NXGetControlParameters: Local protocol major [%u] minor [%u] patch [%u].\n", Compext.c:854: fprintf(stderr, "******NXGetControlParameters: Remote protocol major [%u] minor [%u] patch [%u].\n", Compext.c:857: fprintf(stderr, "******NXGetControlParameters: Split timeout [%d] motion timeout [%d].\n", Compext.c:860: fprintf(stderr, "******NXGetControlParameters: Split mode [%d] split size [%d].\n", Compext.c:863: fprintf(stderr, "******NXGetControlParameters: Preferred pack method [%d] pack quality [%d].\n", Compext.c:866: fprintf(stderr, "******NXGetControlParameters: Data level [%d] stream level [%d] delta level [%d].\n", Compext.h:298:extern Status NXGetControlParameters( Compext.h:446: * current threshold can be found in the NXGetControlParameters() #### NXGetFontParameters #### Compext.c:1170:Status NXGetFontParameters(Display *dpy, unsigned int path_length, char path_data[]) Compext.c:1172: register xNXGetFontParametersReq *req; Compext.c:1174: xNXGetFontParametersReply rep; Compext.c:1185: fprintf(stderr, "******NXGetFontParameters: No room to store the reply.\n"); Compext.c:1195: GetReq(NXGetFontParameters, req); Compext.c:1198: fprintf(stderr, "******NXGetFontParameters: Sending message opcode [%d].\n", Compext.c:1199: X_NXGetFontParameters); Compext.c:1205: fprintf(stderr, "******NXGetFontParameters: Error receiving reply.\n"); Compext.c:1218: fprintf(stderr, "******NXGetFontParameters: Got [%d] bytes of reply data with only room for [%d].\n", Compext.c:1232: fprintf(stderr, "******NXGetFontParameters: Reading [%d] bytes of reply data.\n", n); Compext.c:1245: fprintf(stderr, "******NXGetFontParameters: Inconsistent length in the returned string.\n"); Compext.c:1257: fprintf(stderr, "******NXGetFontParameters: Got font path of [%d] bytes and value [", Compext.h:369:extern Status NXGetFontParameters( #### NXGetShmemParameters #### Compext.c:1021:Status NXGetShmemParameters(Display *dpy, unsigned int *enable_client, Compext.c:1026: register xNXGetShmemParametersReq *req; Compext.c:1030: xNXGetShmemParametersReply rep; Compext.c:1057: GetReq(NXGetShmemParameters, req); Compext.c:1068: fprintf(stderr, "******NXGetShmemParameters: Sending message opcode [%d] at stage [%d].\n", Compext.c:1069: X_NXGetShmemParameters, stage); Compext.c:1076: fprintf(stderr, "******NXGetShmemParameters: Enable client is [%u] enable server is [%u].\n", Compext.c:1079: fprintf(stderr, "******NXGetShmemParameters: Client segment is [%u] server segment is [%u].\n", Compext.c:1112: fprintf(stderr, "******NXGetShmemParameters: Error receiving reply.\n"); Compext.c:1137: fprintf(stderr, "******NXGetShmemParameters: Got final reply with enabled client [%u] and server [%u].\n", Compext.c:1140: fprintf(stderr, "******NXGetShmemParameters: Client segment size [%u] server segment size [%u].\n", Compext.h:347:extern Status NXGetShmemParameters( #### NXGetUnpackParameters #### Compext.c:915:Status NXGetUnpackParameters(Display *dpy, unsigned int *entries, unsigned char supported_methods[]) Compext.c:917: register xNXGetUnpackParametersReq *req; Compext.c:919: xNXGetUnpackParametersReply rep; Compext.c:930: fprintf(stderr, "******NXGetUnpackParameters: Requested only [%d] entries while they should be [%d].\n", Compext.c:939: GetReq(NXGetUnpackParameters, req); Compext.c:944: fprintf(stderr, "******NXGetUnpackParameters: Sending message opcode [%d] with [%d] requested entries.\n", Compext.c:945: X_NXGetUnpackParameters, *entries); Compext.c:951: fprintf(stderr, "******NXGetUnpackParameters: Error receiving reply.\n"); Compext.c:964: fprintf(stderr, "******NXGetUnpackParameters: Got [%d] bytes of reply data while they should be [%d].\n", Compext.c:980: fprintf(stderr, "******NXGetUnpackParameters: Reading [%d] bytes of reply data.\n", n); Compext.c:987: fprintf(stderr, "******NXGetUnpackParameters: Got reply with methods: "); Compext.h:327:extern Status NXGetUnpackParameters( #### NXHandleDisplayError #### Compext.c:531:int NXHandleDisplayError(int value) Compext.c:533: int previous = _NXHandleDisplayError; Compext.c:535: _NXHandleDisplayError = value; Compext.c:538: fprintf(stderr, "******NXHandleDisplayError: Set the flag to [%d] with previous value [%d].\n", Compext.h:132:extern int NXHandleDisplayError( #### NXImageCache #### Compext.c:184:} _NXImageCacheEntry; Compext.c:186:int NXImageCacheSize = 0; Compext.c:187:int NXImageCacheHits = 0; Compext.c:188:int NXImageCacheOps = 0; Compext.c:190:_NXImageCacheEntry *NXImageCache = NULL; Compext.c:3131: if (NXImageCache != NULL && NXImageCacheSize == entries) Compext.c:3135: NXImageCache, NXImageCacheSize); Compext.c:3146: NXImageCacheSize = 0; Compext.c:3148: if (NXImageCache != NULL) Compext.c:3150: Xfree(NXImageCache); Compext.c:3152: NXImageCache = NULL; Compext.c:3157: NXImageCache = Xmalloc(entries * sizeof(_NXImageCacheEntry)); Compext.c:3159: if (NXImageCache != NULL) Compext.c:3161: memset(NXImageCache, 0, entries * sizeof(_NXImageCacheEntry)); Compext.c:3163: NXImageCacheSize = entries; Compext.c:3185: for (i = 0; i < NXImageCacheSize; i++) Compext.c:3187: if (NXImageCache[i].image == NULL) Compext.c:3194: sprintf(s + (j * 2), "%02X", ((unsigned char *) NXImageCache[i].md5)[j]); Compext.c:3211: if (NXImageCache == NULL) Compext.c:3243: for (i = 0; i < NXImageCacheSize; i++) Compext.c:3245: if (NXImageCache[i].image != NULL) Compext.c:3247: if (memcmp(NXImageCache[i].md5, new_md5, MD5_LENGTH) == 0) Compext.c:3249: _NXImageCacheEntry found; Compext.c:3251: found.image = NXImageCache[i].image; Compext.c:3252: found.method = NXImageCache[i].method; Compext.c:3253: found.md5 = NXImageCache[i].md5; Compext.c:3257: NXImageCacheHits++; Compext.c:3261: i, NXImageCacheHits, NXImageCacheOps); Compext.c:3278: memmove(&NXImageCache[1], &NXImageCache[0], (i * sizeof(_NXImageCacheEntry))); Compext.c:3280: NXImageCache[0].image = found.image; Compext.c:3281: NXImageCache[0].method = found.method; Compext.c:3282: NXImageCache[0].md5 = found.md5; Compext.c:3331: i = (NXImageCacheOps < NXImageCacheSize) ? NXImageCacheOps : NXImageCacheSize; Compext.c:3333: if (NXImageCacheOps >= NXImageCacheSize) Compext.c:3341: Xfree(NXImageCache[NXImageCacheSize - 1].image -> data); Compext.c:3342: Xfree(NXImageCache[NXImageCacheSize - 1].image); Compext.c:3343: Xfree(NXImageCache[NXImageCacheSize - 1].md5); Compext.c:3348: memmove(&NXImageCache[1], &NXImageCache[0], i * sizeof(_NXImageCacheEntry)); Compext.c:3351: NXImageCacheOps++; Compext.c:3358: NXImageCache[0].image = image; Compext.c:3359: NXImageCache[0].method = method; Compext.c:3360: NXImageCache[0].md5 = md5; Compext.c:3379: if (NXImageCache == NULL) Compext.c:3390: NXImageCacheSize); Compext.c:3393: for (i = 0; i < NXImageCacheSize; i++) Compext.c:3395: if (NXImageCache[i].image != NULL) Compext.c:3397: if (NXImageCache[i].image -> data != NULL) Compext.c:3399: Xfree(NXImageCache[i].image -> data); Compext.c:3402: Xfree(NXImageCache[i].image); Compext.c:3404: NXImageCache[i].image = NULL; Compext.c:3407: if (NXImageCache[i].md5 != NULL) Compext.c:3409: Xfree(NXImageCache[i].md5); Compext.c:3411: NXImageCache[i].md5 = NULL; Compext.c:3415: Xfree(NXImageCache); Compext.c:3417: NXImageCache = NULL; Compext.c:3419: NXImageCacheSize = 0; Compext.c:3420: NXImageCacheHits = 0; Compext.c:3421: NXImageCacheOps = 0; Compext.h:766:extern int NXImageCacheSize; #### NXImageCacheHits #### Compext.c:187:int NXImageCacheHits = 0; Compext.c:3257: NXImageCacheHits++; Compext.c:3261: i, NXImageCacheHits, NXImageCacheOps); Compext.c:3420: NXImageCacheHits = 0; #### NXImageCacheOps #### Compext.c:188:int NXImageCacheOps = 0; Compext.c:3261: i, NXImageCacheHits, NXImageCacheOps); Compext.c:3331: i = (NXImageCacheOps < NXImageCacheSize) ? NXImageCacheOps : NXImageCacheSize; Compext.c:3333: if (NXImageCacheOps >= NXImageCacheSize) Compext.c:3351: NXImageCacheOps++; Compext.c:3421: NXImageCacheOps = 0; #### NXImageCacheSize #### Compext.c:186:int NXImageCacheSize = 0; Compext.c:3131: if (NXImageCache != NULL && NXImageCacheSize == entries) Compext.c:3135: NXImageCache, NXImageCacheSize); Compext.c:3146: NXImageCacheSize = 0; Compext.c:3163: NXImageCacheSize = entries; Compext.c:3185: for (i = 0; i < NXImageCacheSize; i++) Compext.c:3243: for (i = 0; i < NXImageCacheSize; i++) Compext.c:3331: i = (NXImageCacheOps < NXImageCacheSize) ? NXImageCacheOps : NXImageCacheSize; Compext.c:3333: if (NXImageCacheOps >= NXImageCacheSize) Compext.c:3341: Xfree(NXImageCache[NXImageCacheSize - 1].image -> data); Compext.c:3342: Xfree(NXImageCache[NXImageCacheSize - 1].image); Compext.c:3343: Xfree(NXImageCache[NXImageCacheSize - 1].md5); Compext.c:3390: NXImageCacheSize); Compext.c:3393: for (i = 0; i < NXImageCacheSize; i++) Compext.c:3419: NXImageCacheSize = 0; Compext.h:766:extern int NXImageCacheSize; #### NXInPlacePackImage #### Compext.c:2288: * NXInPlacePackImage creates a NXPackedImage Compext.c:2294:XImage *NXInPlacePackImage(Display *dpy, XImage *src_image, unsigned int method) Compext.c:2307: fprintf(stderr, "******NXInPlacePackImage: Going to pack a new image with method [%d].\n", Compext.c:2322: fprintf(stderr, "******NXInPlacePackImage: WARNING! No mask to apply for pack method [%d].\n", Compext.c:2331: fprintf(stderr, "******NXInPlacePackImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", Compext.c:2334: fprintf(stderr, "******NXInPlacePackImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", Compext.c:2348: fprintf(stderr, "******NXInPlacePackImage: PANIC! Cannot allocate [%d] bytes for the image.\n", Compext.c:2358: fprintf(stderr, "******NXInPlacePackImage: Source width [%d], bytes per line [%d] with depth [%d].\n", Compext.c:2376: fprintf(stderr, "******NXInPlacePackImage: Destination depth [%d], bits per pixel [%d], packed bits per pixel [%d].\n", Compext.c:2384: fprintf(stderr, "******NXInPlacePackImage: Just clean image packed_bits_per_pixel[%d], bits_per_pixel[%d].\n", Compext.c:2391: fprintf(stderr, "******NXInPlacePackImage: PANIC! Failed to clean the image.\n"); Compext.c:2402: fprintf(stderr, "******NXInPlacePackImage: PANIC! Failed to apply the color mask.\n"); Compext.c:2419: fprintf(stderr, "******NXInPlacePackImage: Plain bits per pixel [%d], data size [%d].\n", Compext.c:2427: fprintf(stderr, "******NXInPlacePackImage: Packed bits per pixel [%d], data size [%d].\n", Compext.h:631:NXPackedImage *NXInPlacePackImage( #### NXInitCache #### Compext.c:3129:void NXInitCache(Display *dpy, int entries) Compext.c:3134: fprintf(stderr, "******NXInitCache: Nothing to do with image cache at [%p] and [%d] entries.\n", Compext.c:3142: fprintf(stderr, "******NXInitCache: Initializing the cache with [%d] entries.\n", Compext.c:3166: fprintf(stderr, "******NXInitCache: Image cache initialized with [%d] entries.\n", entries); Compext.h:768:extern void NXInitCache( #### NXInitDisplay #### Compext.c:265:int NXInitDisplay(Display *dpy) Compext.c:268: fprintf(stderr, "******NXInitDisplay: Called for display at [%p].\n", (void *) dpy); Compext.c:283: fprintf(stderr, "******NXInitDisplay: WARNING! Internal structures already initialized.\n"); Compext.h:71:extern int NXInitDisplay( #### NXMaskImage #### Compext.c:2934:void NXMaskImage(XImage *image, unsigned int method) Compext.c:2952: fprintf(stderr, "******NXMaskImage: Method is MASK_8_COLORS\n"); Compext.c:2963: fprintf(stderr, "******NXMaskImage: Method is MASK_64K_COLORS\n"); Compext.c:2974: fprintf(stderr, "******NXMaskImage: Method is MASK_256_COLORS\n"); Compext.c:2985: fprintf(stderr, "******NXMaskImage: Method is MASK_512K_COLORS\n"); Compext.c:2996: fprintf(stderr, "******NXMaskImage: Method is MASK_4K_COLORS\n"); Compext.c:3007: fprintf(stderr, "******NXMaskImage: Method is MASK_32K_COLORS\n"); Compext.c:3018: fprintf(stderr, "******NXMaskImage: Method is MASK_64K_COLORS\n"); Compext.c:3029: fprintf(stderr, "******NXMaskImage: Method is MASK_256K_COLORS\n"); Compext.c:3040: fprintf(stderr, "******NXMaskImage: Method is MASK_2M_COLORS\n"); Compext.c:3051: fprintf(stderr, "******NXMaskImage: Method is MASK_16M_COLORS\n"); Compext.c:3059: fprintf(stderr, "******NXMaskImage: PANIC! Cannot find mask method for pack method [%d]\n", Compext.c:3068: fprintf(stderr, "******NXMaskImage: packMethod[%d] => maskMethod[%d]\n", Compext.c:3083: fprintf(stderr, "******NXMaskImage: PANIC! No mask to apply for pack method [%d].\n", Compext.c:3092: fprintf(stderr, "******NXMaskImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", Compext.c:3095: fprintf(stderr, "******NXMaskImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", Compext.c:3111: fprintf(stderr, "******NXMaskImage: the image will not be masked\n"); Compext.c:3119: fprintf(stderr, "******NXMaskImage: PANIC! Failed to apply the color mask in place.\n"); Compext.h:759:extern void NXMaskImage( #### NXPackImage #### Compext.c:2107:NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method) Compext.c:2120: fprintf(stderr, "******NXPackImage: Going to pack a new image with method [%d].\n", Compext.c:2135: fprintf(stderr, "******NXPackImage: WARNING! No mask to apply for pack method [%d].\n", Compext.c:2144: fprintf(stderr, "******NXPackImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", Compext.c:2147: fprintf(stderr, "******NXPackImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", Compext.c:2162: fprintf(stderr, "******NXPackImage: PANIC! Cannot allocate [%d] bytes for the image.\n", Compext.c:2172: fprintf(stderr, "******NXPackImage: Source width [%d], bytes per line [%d] with depth [%d].\n", Compext.c:2183: fprintf(stderr, "******NXPackImage: PANIC! Cannot allocate [%d] bytes for masked image data.\n", Compext.c:2203: fprintf(stderr, "******NXPackImage: Destination depth [%d], bits per pixel [%d], packed bits per pixel [%d].\n", Compext.c:2218: fprintf(stderr, "******NXPackImage: PANIC! Failed to clean the image.\n"); Compext.c:2231: fprintf(stderr, "******NXPackImage: PANIC! Failed to apply the color mask.\n"); Compext.c:2250: fprintf(stderr, "******NXPackImage: Plain bits per pixel [%d], data size [%d].\n", Compext.c:2258: fprintf(stderr, "******NXPackImage: Packed bits per pixel [%d], data size [%d].\n", Compext.c:2266: fprintf(stderr, "******NXPackImage: PANIC! Failed to pack image from [%d] to [%d] bits per pixel.\n", Compext.h:623:NXPackedImage *NXPackImage( #### NXPutPackedImage #### Compext.c:2441:int NXPutPackedImage(Display *dpy, unsigned int resource, Drawable drawable, Compext.c:2446: register xNXPutPackedImageReq *req; Compext.c:2455: GetReq(NXPutPackedImage, req); Compext.c:2462: fprintf(stderr, "******NXPutPackedImage: Image resource [%d] drawable [%d] gc [%d].\n", Compext.c:2503: fprintf(stderr, "******NXPutPackedImage: Source image depth [%d] destination depth [%d] " Compext.c:2537: fprintf(stderr, "******NXPutPackedImage: Source data length [%d] request data length [%d].\n", Compext.h:645:extern int NXPutPackedImage( #### NXResetDisplay #### Compext.c:289:int NXResetDisplay(Display *dpy) Compext.c:292: fprintf(stderr, "******NXResetDisplay: Called for display at [%p].\n", (void *) dpy); Compext.c:307: fprintf(stderr, "******NXResetDisplay: WARNING! Internal structures already reset.\n"); Compext.h:82:extern int NXResetDisplay( #### NXSetCacheParameters #### Compext.c:1534:int NXSetCacheParameters(Display *dpy, int enable_cache, int enable_split, Compext.c:1537: register xNXSetCacheParametersReq *req; Compext.c:1541: GetReq(NXSetCacheParameters, req); Compext.c:1549: fprintf(stderr, "******NXSetCacheParameters: Sending message opcode [%d] with " Compext.c:1550: "flags [%d][%d][%d][%d].\n", X_NXSetCacheParameters, req -> enableCache, Compext.h:521:extern int NXSetCacheParameters( #### NXSetDisplayBlockHandler #### Compext.c:703:NXDisplayBlockHandler NXSetDisplayBlockHandler(NXDisplayBlockHandler handler) Compext.c:710: fprintf(stderr, "******NXSetDisplayBlockHandler: Set the handler to [%p] with previous value [%p].\n", Compext.h:227:extern NXDisplayBlockHandler NXSetDisplayBlockHandler( #### NXSetDisplayBuffer #### Compext.c:447:int NXSetDisplayBuffer(Display *dpy, int size) Compext.c:462: fprintf(stderr, "******NXSetDisplayBuffer: Nothing to do with buffer size matching.\n"); Compext.c:470: fprintf(stderr, "******NXSetDisplayBuffer: PANIC! The display buffer is not empty.\n"); Compext.c:478: fprintf(stderr, "******NXSetDisplayBuffer: PANIC! Can't allocate [%d] bytes for the buffer.\n", Compext.c:495: fprintf(stderr, "******NXSetDisplayBuffer: Set the display output buffer size to [%d].\n", Compext.h:104:extern int NXSetDisplayBuffer( #### NXSetDisplayErrorPredicate #### Compext.c:689:NXDisplayErrorPredicate NXSetDisplayErrorPredicate(NXDisplayErrorPredicate predicate) Compext.c:696: fprintf(stderr, "******NXSetDisplayErrorPredicate: Set the predicate to [%p] with previous value [%p].\n", Compext.h:216:extern NXDisplayErrorPredicate NXSetDisplayErrorPredicate( #### NXSetDisplayFlushHandler #### Compext.c:731:NXDisplayFlushHandler NXSetDisplayFlushHandler(NXDisplayFlushHandler handler, Display *display) Compext.c:741: fprintf(stderr, "******NXSetDisplayFlushHandler: Set the handler to [%p] with display [%p] " Compext.h:258:extern NXDisplayFlushHandler NXSetDisplayFlushHandler( #### NXSetDisplayPolicy #### Compext.c:435:int NXSetDisplayPolicy(Display *dpy, int policy) Compext.h:93:extern int NXSetDisplayPolicy( #### NXSetDisplayStatisticsHandler #### Compext.c:748:NXDisplayStatisticsHandler NXSetDisplayStatisticsHandler(NXDisplayStatisticsHandler handler, char **buffer) Compext.c:762: fprintf(stderr, "******NXSetDisplayStatisticsHandler: Set the handler to [%p] with buffer pointer [%p] " Compext.h:270:extern NXDisplayStatisticsHandler NXSetDisplayStatisticsHandler( #### NXSetDisplayWriteHandler #### Compext.c:717:NXDisplayWriteHandler NXSetDisplayWriteHandler(NXDisplayWriteHandler handler) Compext.c:724: fprintf(stderr, "******NXSetDisplayWriteHandler: Set the handler to [%p] with previous value [%p].\n", Compext.h:239:extern NXDisplayWriteHandler NXSetDisplayWriteHandler( #### NXSetExposeParameters #### Compext.c:1506:int NXSetExposeParameters(Display *dpy, int expose, int graphics_expose, int no_expose) Compext.c:1508: register xNXSetExposeParametersReq *req; Compext.c:1512: GetReq(NXSetExposeParameters, req); Compext.c:1519: fprintf(stderr, "******NXSetExposeParameters: Sending message opcode [%d] with flags [%d][%d][%d].\n", Compext.c:1520: X_NXSetExposeParameters, req -> expose, req -> graphicsExpose, req -> noExpose); Compext.h:512:extern int NXSetExposeParameters( #### NXSetLostSequenceHandler #### Compext.c:769:NXLostSequenceHandler NXSetLostSequenceHandler(NXLostSequenceHandler handler) Compext.c:776: fprintf(stderr, "******NXSetLostSequenceHandler: Set the handler to [%p] with previous value [%p].\n", Compext.h:283:extern NXLostSequenceHandler NXSetLostSequenceHandler( #### NXSetUnpackAlpha #### Compext.c:1735:int NXSetUnpackAlpha(Display *dpy, unsigned int resource, unsigned int method, Compext.c:1738: register xNXSetUnpackAlphaReq *req; Compext.c:1744: GetReq(NXSetUnpackAlpha, req); Compext.c:1757: fprintf(stderr, "******NXSetUnpackAlpha: Resource [%u] data size [%u] destination data size [%u].\n", Compext.c:1897:#define sz_xNXSetUnpackAlphaCompatReq 8 Compext.c:1899:typedef struct _NXSetUnpackAlphaCompatReq { Compext.c:1904:} xNXSetUnpackAlphaCompatReq; Compext.c:1906:#define X_NXSetUnpackAlphaCompat X_NXSetUnpackAlpha Compext.c:1908:int NXSetUnpackAlphaCompat(Display *dpy, unsigned int resource, Compext.c:1911: register xNXSetUnpackAlphaCompatReq *req; Compext.c:1925: GetReq(NXSetUnpackAlphaCompat, req); Compext.c:1935: fprintf(stderr, "******NXSetUnpackAlphaCompat: Resource [%u] number of entries [%u] " Compext.c:1950: fprintf(stderr, "******NXSetUnpackAlphaCompat: PANIC! Cannot allocate memory.\n"); Compext.c:1953: UnGetReq(NXSetUnpackAlphaCompat); Compext.c:1970: fprintf(stderr, "******NXSetUnpackAlphaCompat: Dumping alpha channel data:\n"); Compext.c:1974: fprintf(stderr, "******NXSetUnpackAlphaCompat: [%d] -> [0x%02x].\n", Compext.h:557:extern int NXSetUnpackAlpha( Compext.h:577:extern int NXSetUnpackAlphaCompat( #### NXSetUnpackAlphaCompat #### Compext.c:1897:#define sz_xNXSetUnpackAlphaCompatReq 8 Compext.c:1899:typedef struct _NXSetUnpackAlphaCompatReq { Compext.c:1904:} xNXSetUnpackAlphaCompatReq; Compext.c:1906:#define X_NXSetUnpackAlphaCompat X_NXSetUnpackAlpha Compext.c:1908:int NXSetUnpackAlphaCompat(Display *dpy, unsigned int resource, Compext.c:1911: register xNXSetUnpackAlphaCompatReq *req; Compext.c:1925: GetReq(NXSetUnpackAlphaCompat, req); Compext.c:1935: fprintf(stderr, "******NXSetUnpackAlphaCompat: Resource [%u] number of entries [%u] " Compext.c:1950: fprintf(stderr, "******NXSetUnpackAlphaCompat: PANIC! Cannot allocate memory.\n"); Compext.c:1953: UnGetReq(NXSetUnpackAlphaCompat); Compext.c:1970: fprintf(stderr, "******NXSetUnpackAlphaCompat: Dumping alpha channel data:\n"); Compext.c:1974: fprintf(stderr, "******NXSetUnpackAlphaCompat: [%d] -> [0x%02x].\n", Compext.h:577:extern int NXSetUnpackAlphaCompat( #### NXSetUnpackColormap #### Compext.c:1672:int NXSetUnpackColormap(Display *dpy, unsigned int resource, unsigned int method, Compext.c:1675: register xNXSetUnpackColormapReq *req; Compext.c:1681: GetReq(NXSetUnpackColormap, req); Compext.c:1694: fprintf(stderr, "******NXSetUnpackColormap: Resource [%u] data size [%u] destination " Compext.c:1802:#define sz_xNXSetUnpackColormapCompatReq 8 Compext.c:1804:typedef struct _NXSetUnpackColormapCompatReq { Compext.c:1809:} xNXSetUnpackColormapCompatReq; Compext.c:1811:#define X_NXSetUnpackColormapCompat X_NXSetUnpackColormap Compext.c:1813:int NXSetUnpackColormapCompat(Display *dpy, unsigned int resource, Compext.c:1816: register xNXSetUnpackColormapCompatReq *req; Compext.c:1830: GetReq(NXSetUnpackColormapCompat, req); Compext.c:1840: fprintf(stderr, "******NXSetUnpackColormapCompat: Resource [%u] number of entries [%u] " Compext.c:1855: fprintf(stderr, "******NXSetUnpackColormapCompat: PANIC! Cannot allocate memory.\n"); Compext.c:1858: UnGetReq(NXSetUnpackColormapCompat); Compext.c:1870: fprintf(stderr, "******NXSetUnpackColormapCompat: Dumping colormap entries:\n"); Compext.c:1874: fprintf(stderr, "******NXSetUnpackColormapCompat: [%d] -> [0x%x].\n", Compext.h:546:extern int NXSetUnpackColormap( Compext.h:568:extern int NXSetUnpackColormapCompat( #### NXSetUnpackColormapCompat #### Compext.c:1802:#define sz_xNXSetUnpackColormapCompatReq 8 Compext.c:1804:typedef struct _NXSetUnpackColormapCompatReq { Compext.c:1809:} xNXSetUnpackColormapCompatReq; Compext.c:1811:#define X_NXSetUnpackColormapCompat X_NXSetUnpackColormap Compext.c:1813:int NXSetUnpackColormapCompat(Display *dpy, unsigned int resource, Compext.c:1816: register xNXSetUnpackColormapCompatReq *req; Compext.c:1830: GetReq(NXSetUnpackColormapCompat, req); Compext.c:1840: fprintf(stderr, "******NXSetUnpackColormapCompat: Resource [%u] number of entries [%u] " Compext.c:1855: fprintf(stderr, "******NXSetUnpackColormapCompat: PANIC! Cannot allocate memory.\n"); Compext.c:1858: UnGetReq(NXSetUnpackColormapCompat); Compext.c:1870: fprintf(stderr, "******NXSetUnpackColormapCompat: Dumping colormap entries:\n"); Compext.c:1874: fprintf(stderr, "******NXSetUnpackColormapCompat: [%d] -> [0x%x].\n", Compext.h:568:extern int NXSetUnpackColormapCompat( #### NXSetUnpackGeometry #### Compext.c:1614:int NXSetUnpackGeometry(Display *dpy, unsigned int resource, Visual *visual) Compext.c:1616: register xNXSetUnpackGeometryReq *req; Compext.c:1620: GetReq(NXSetUnpackGeometry, req); Compext.c:1640: fprintf(stderr, "******NXSetUnpackGeometry: PANIC! Can't set the geometry without a visual.\n"); Compext.c:1643: UnGetReq(NXSetUnpackGeometry); Compext.c:1651: fprintf(stderr, "******NXSetUnpackGeometry: Resource [%u] Depth/Bpp [1/%d][4/%d][8/%d]" Compext.c:1655: fprintf(stderr, "******NXSetUnpackGeometry: red [0x%x] green [0x%x] blue [0x%x].\n", Compext.h:538:extern int NXSetUnpackGeometry( #### NXStartSplit #### Compext.c:1333:int NXStartSplit(Display *dpy, unsigned int resource, unsigned int mode) Compext.c:1335: register xNXStartSplitReq *req; Compext.c:1339: GetReq(NXStartSplit, req); Compext.c:1345: fprintf(stderr, "******NXStartSplit: Sending opcode [%d] with resource [%d] mode [%d].\n", Compext.c:1346: X_NXStartSplit, resource, mode); Compext.c:1373: X_NXStartSplit, resource); Compext.h:421: * NXStartSplitNotify One or more messages were split, so, Compext.h:466:extern int NXStartSplit( #### NXUnsetLibraryPath #### Compext.c:509:int NXUnsetLibraryPath(int value) Compext.c:511: int previous = _NXUnsetLibraryPath; Compext.c:513: _NXUnsetLibraryPath = value; Compext.c:516: fprintf(stderr, "******NXUnsetLibraryPath: Set the flag to [%d] with previous value [%d].\n", Compext.h:119:extern int NXUnsetLibraryPath( #### PackImage #### Compext.c:2107:NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method) Compext.c:2120: fprintf(stderr, "******NXPackImage: Going to pack a new image with method [%d].\n", Compext.c:2135: fprintf(stderr, "******NXPackImage: WARNING! No mask to apply for pack method [%d].\n", Compext.c:2144: fprintf(stderr, "******NXPackImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", Compext.c:2147: fprintf(stderr, "******NXPackImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", Compext.c:2162: fprintf(stderr, "******NXPackImage: PANIC! Cannot allocate [%d] bytes for the image.\n", Compext.c:2172: fprintf(stderr, "******NXPackImage: Source width [%d], bytes per line [%d] with depth [%d].\n", Compext.c:2183: fprintf(stderr, "******NXPackImage: PANIC! Cannot allocate [%d] bytes for masked image data.\n", Compext.c:2203: fprintf(stderr, "******NXPackImage: Destination depth [%d], bits per pixel [%d], packed bits per pixel [%d].\n", Compext.c:2218: fprintf(stderr, "******NXPackImage: PANIC! Failed to clean the image.\n"); Compext.c:2231: fprintf(stderr, "******NXPackImage: PANIC! Failed to apply the color mask.\n"); Compext.c:2245: * tination. This means that PackImage() must Compext.c:2250: fprintf(stderr, "******NXPackImage: Plain bits per pixel [%d], data size [%d].\n", Compext.c:2258: fprintf(stderr, "******NXPackImage: Packed bits per pixel [%d], data size [%d].\n", Compext.c:2262: if (PackImage(method, dst_data_size, dst_image, Compext.c:2266: fprintf(stderr, "******NXPackImage: PANIC! Failed to pack image from [%d] to [%d] bits per pixel.\n", Compext.c:2288: * NXInPlacePackImage creates a NXPackedImage Compext.c:2294:XImage *NXInPlacePackImage(Display *dpy, XImage *src_image, unsigned int method) Compext.c:2307: fprintf(stderr, "******NXInPlacePackImage: Going to pack a new image with method [%d].\n", Compext.c:2322: fprintf(stderr, "******NXInPlacePackImage: WARNING! No mask to apply for pack method [%d].\n", Compext.c:2331: fprintf(stderr, "******NXInPlacePackImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", Compext.c:2334: fprintf(stderr, "******NXInPlacePackImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", Compext.c:2348: fprintf(stderr, "******NXInPlacePackImage: PANIC! Cannot allocate [%d] bytes for the image.\n", Compext.c:2358: fprintf(stderr, "******NXInPlacePackImage: Source width [%d], bytes per line [%d] with depth [%d].\n", Compext.c:2376: fprintf(stderr, "******NXInPlacePackImage: Destination depth [%d], bits per pixel [%d], packed bits per pixel [%d].\n", Compext.c:2384: fprintf(stderr, "******NXInPlacePackImage: Just clean image packed_bits_per_pixel[%d], bits_per_pixel[%d].\n", Compext.c:2391: fprintf(stderr, "******NXInPlacePackImage: PANIC! Failed to clean the image.\n"); Compext.c:2402: fprintf(stderr, "******NXInPlacePackImage: PANIC! Failed to apply the color mask.\n"); Compext.c:2414: * tination. This means that PackImage() must Compext.c:2419: fprintf(stderr, "******NXInPlacePackImage: Plain bits per pixel [%d], data size [%d].\n", Compext.c:2427: fprintf(stderr, "******NXInPlacePackImage: Packed bits per pixel [%d], data size [%d].\n", Mask.c:393: fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", Mask.c:414: fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", Mask.c:444: fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x%x%x] red [0x%x] green [0x%x] blue [0x%x].\n", Mask.c:477: fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", Mask.c:512: fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x%x%x] red [0x%x] green [0x%x] blue [0x%x].\n", Mask.c:543: fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", Mask.c:570: fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", Mask.c:591: fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", Mask.c:614: fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", Mask.c:635: fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", Mask.c:658: fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", Mask.c:679: fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x], [0x%x], [0x%x].\n", Mask.c:690:int PackImage(unsigned int method, unsigned int src_data_size, XImage *src_image, Mask.c:700: fprintf(stderr, "******PackImage: Source bits per pixel [%d], destination bits per pixel [%d].\n", Mask.c:703: fprintf(stderr, "******PackImage: Source data size [%d], destination data size [%d].\n", Mask.c:710: fprintf(stderr, "******PackImage: PANIC! Cannot pack image from [%d] to [%d] bytes per pixel.\n", Compext.h:623:NXPackedImage *NXPackImage( Compext.h:631:NXPackedImage *NXInPlacePackImage( Mask.h:39:extern int PackImage(unsigned int method, unsigned int src_data_size, XImage *src_image, #### PngCompareColorTable #### Png.c:105:int PngCompareColorTable(NXColorTable *c1, NXColorTable *c2) Png.h:39:extern int PngCompareColorTable( #### PngCompressData #### Compext.c:2865: dst_image -> data = PngCompressData(dst_image, &size); Png.c:244:char *PngCompressData(XImage *image, int *compressed_size) Png.c:282: fprintf(stderr, "******PngCompressData: PANIC! Can't compress images with [%d] bits per pixel.\n", Png.c:302: fprintf(stderr, "******PngCompressData: Compressing image with width [%d] height [%d].\n", Png.c:315: fprintf(stderr, "******PngCompressData: PANIC! Failed creating the png_create_write_struct.\n"); Png.c:326: fprintf(stderr, "******PngCompressData: PANIC! Failed creating the png_create_info_struct.\n"); Png.c:337: fprintf(stderr, "******PngCompressData: PANIC! Error during compression initialization.\n"); Png.c:350: fprintf(stderr, "******PngCompressData: Allocating [%d] bytes for the destination data.\n", Png.c:359: fprintf(stderr, "******PngCompressData: PANIC! Error allocating [%d] bytes for the Png data.\n", Png.c:371: fprintf(stderr, "******PngCompressData: PANIC! Error writing the header.\n"); Png.c:437: fprintf(stderr, "******PngCompressData: pixel[%d] r[%d] g[%d] b[%d].\n", Png.c:467: fprintf(stderr, "******PngCompressData: PANIC! Error while writing the image rows.\n"); Png.c:484: fprintf(stderr, "******PngCompressData: PANIC! Cannot allocate [%d] bytes.\n", Png.c:514: fprintf(stderr, "******PngCompressData: PANIC! Cannot allocate [%d] bytes.\n", Png.c:548: fprintf(stderr, "******PngCompressData: PANIC! error during end of write.\n"); Png.h:46:extern char *PngCompressData( #### RgbCompressData #### Compext.c:2660: dst_image -> data = RgbCompressData(src_image, &dst_size); Rgb.c:46:char *RgbCompressData(XImage *image, unsigned int *size) Rgb.h:33:extern char *RgbCompressData( #### RleCompressData #### Compext.c:2705: dst_image -> data = RleCompressData(src_image, &dst_size); Rle.c:46:char *RleCompressData(XImage *image, unsigned int *size) Rle.h:33:extern char *RleCompressData( #### ZCompressData #### Alpha.c:48: return ZCompressData(data, size, alphaCompressionThreshold, alphaCompressionLevel, Colormap.c:48: return ZCompressData(data, size, colormapCompressionThreshold, colormapCompressionLevel, Rgb.c:48: return ZCompressData(image -> data, image -> bytes_per_line * image -> height, Rle.c:48: return ZCompressData(image -> data, image -> bytes_per_line * image -> height, Z.c:57:char *ZCompressData(const char *plainData, unsigned int plainSize, int threshold, Z.c:75: fprintf(stderr, "******ZCompressData: PANIC! Failed to allocate [%d] bytes for the destination.\n", Z.c:87: fprintf(stderr, "******ZCompressData: Not compressing [%d] bytes with level [%d] and " Z.c:128: fprintf(stderr, "******ZCompressData: PANIC! Failed to compress [%d] bytes with error [%s].\n", Z.c:140: fprintf(stderr, "******ZCompressData: Source data of [%d] bytes compressed to [%d].\n", Z.h:45:extern char *ZCompressData( #### ZInitEncoder #### Compext.c:423: ZInitEncoder(); Z.c:242:int ZInitEncoder() Z.c:253: fprintf(stderr, "******ZInitEncoder: PANIC! Failed to allocate memory for the stream.\n"); Z.c:264: fprintf(stderr, "******ZInitEncoder: Initializing compressor with level [%d] and startegy [%d].\n", Z.c:274: fprintf(stderr, "******ZInitEncoder: Failed to initialize the compressor with error [%s].\n", Z.h:33:int ZInitEncoder( #### ZResetEncoder #### Compext.c:430: ZResetEncoder(); Z.c:287:int ZResetEncoder() Z.c:298: fprintf(stderr, "******ZResetEncoder: WARNING! Failed to deinitialize the compressor with error [%s].\n", Z.h:39:int ZResetEncoder( #### _NXInternalInitEncoders #### Compext.c:262:extern int _NXInternalInitEncoders(Display *dpy); Compext.c:275: _NXInternalInitEncoders(dpy); Compext.c:421:int _NXInternalInitEncoders(Display *dpy) #### _NXInternalInitResources #### Compext.c:260:extern int _NXInternalInitResources(Display *dpy); Compext.c:273: _NXInternalInitResources(dpy); Compext.c:313:int _NXInternalInitResources(Display *dpy) #### _NXInternalResetEncoders #### Compext.c:263:extern int _NXInternalResetEncoders(Display *dpy); Compext.c:299: _NXInternalResetEncoders(dpy); Compext.c:428:int _NXInternalResetEncoders(Display *dpy) #### _NXInternalResetResources #### Compext.c:261:extern int _NXInternalResetResources(Display *dpy); Compext.c:297: _NXInternalResetResources(dpy); Compext.c:315: return _NXInternalResetResources(dpy); Compext.c:318:int _NXInternalResetResources(Display *dpy) Compext.c:323: fprintf(stderr, "******_NXInternalResetResources: Clearing all the internal structures.\n"); Compext.c:334: fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect image data " Compext.c:358: fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect property data " Compext.c:382: fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing grab pointer data " Compext.c:401: fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect input focus data " #### color_type #### Png.c:76:png_byte color_type; Png.c:394: color_type = PNG_COLOR_TYPE_PALETTE; Png.c:398: color_type = PNG_COLOR_TYPE_RGB; Png.c:402: 8, color_type, PNG_INTERLACE_NONE, Png.c:405: if (color_type == PNG_COLOR_TYPE_PALETTE) Png.c:477: if (color_type == PNG_COLOR_TYPE_PALETTE) Png.c:525: if (color_type == PNG_COLOR_TYPE_RGB) Png.c:560: if (color_type == PNG_COLOR_TYPE_PALETTE) #### info_ptr #### Png.c:78:png_infop info_ptr; Png.c:321: info_ptr = png_create_info_struct(png_ptr); Png.c:323: if (info_ptr == NULL) Png.c:340: png_destroy_write_struct(&png_ptr, &info_ptr); Png.c:374: png_destroy_write_struct(&png_ptr, &info_ptr); Png.c:401: png_set_IHDR(png_ptr, info_ptr, w, h, Png.c:442: png_set_PLTE(png_ptr, info_ptr, palette, num); Png.c:453: png_write_info(png_ptr, info_ptr); Png.c:470: png_destroy_write_struct(&png_ptr, &info_ptr); Png.c:551: png_destroy_write_struct(&png_ptr, &info_ptr); Png.c:565: png_destroy_write_struct(&png_ptr, &info_ptr); #### palette #### Png.c:79:png_colorp palette; Png.c:87: * space to include the palette and the Png.c:407: palette = png_malloc(png_ptr, sizeof(*palette) * 256); Png.c:412: * memset(palette, 0, sizeof(*palette) * 256); Png.c:419: palette[num].red = (color_table[num].pixel >> redShift) & redMax; Png.c:420: palette[num].green = (color_table[num].pixel >> greenShift) & greenMax; Png.c:421: palette[num].blue = color_table[num].pixel >> blueShift & blueMax; Png.c:431: palette[num].red = (CARD8)((inRed * 255 + redMax / 2) / redMax); Png.c:432: palette[num].green = (CARD8)((inGreen * 255 + greenMax / 2) / greenMax); Png.c:433: palette[num].blue = (CARD8)((inBlue * 255 + blueMax / 2) / blueMax); Png.c:438: (int) color_table[num].pixel,palette[num].red,palette[num].green,palette[num].blue); Png.c:442: png_set_PLTE(png_ptr, info_ptr, palette, num); Png.c:445: fprintf(stderr, "******PngCompressedData: Setting palette.\n"); Png.c:450: * End of palette. Png.c:562: png_free(png_ptr, palette); #### png_ptr #### Png.c:57:static void PngWriteData(png_structp png_ptr, png_bytep data, png_size_t length); Png.c:58:static void PngFlushData(png_structp png_ptr); Png.c:77:png_structp png_ptr; Png.c:310: png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); Png.c:312: if (png_ptr == NULL) Png.c:321: info_ptr = png_create_info_struct(png_ptr); Png.c:329: png_destroy_write_struct(&png_ptr, NULL); Png.c:334: if (setjmp(png_jmpbuf(png_ptr))) Png.c:340: png_destroy_write_struct(&png_ptr, &info_ptr); Png.c:366: png_set_write_fn(png_ptr, (void *) pngCompBuf, PngWriteData, PngFlushData); Png.c:368: if (setjmp(png_jmpbuf(png_ptr))) Png.c:374: png_destroy_write_struct(&png_ptr, &info_ptr); Png.c:381: png_set_compression_level(png_ptr, PNG_Z_LEVEL); Png.c:401: png_set_IHDR(png_ptr, info_ptr, w, h, Png.c:407: palette = png_malloc(png_ptr, sizeof(*palette) * 256); Png.c:442: png_set_PLTE(png_ptr, info_ptr, palette, num); Png.c:453: png_write_info(png_ptr, info_ptr); Png.c:464: if (setjmp(png_jmpbuf(png_ptr))) Png.c:470: png_destroy_write_struct(&png_ptr, &info_ptr); Png.c:534: png_write_row(png_ptr, srcBuf); Png.c:545: if (setjmp(png_jmpbuf(png_ptr))) Png.c:551: png_destroy_write_struct(&png_ptr, &info_ptr); Png.c:558: png_write_end(png_ptr, NULL); Png.c:562: png_free(png_ptr, palette); Png.c:565: png_destroy_write_struct(&png_ptr, &info_ptr); Png.c:610:static void PngWriteData(png_structp png_ptr, png_bytep data, png_size_t length) Png.c:612: memcpy(((char *) png_get_io_ptr(png_ptr) + pngDataLen), data, length); Png.c:617:static void PngFlushData(png_structp png_ptr) nx-libs-3.5.99.23/doc/nxcompext/symbols/nxcompext::symbol-usage_nxagent.txt0000644000000000000000000003145313614532331023625 0ustar #### AlphaCompressData #### #### BitmapCompressData #### #### CleanXYImage #### #### CleanZImage #### #### ColormapCompressData #### #### CopyAndCleanImage #### #### FindLSB #### #### JpegCompressData #### #### MaskImage #### NXdixfonts.c:225: BitmapFormatMaskImageRectangle | #### MaskInPlaceImage #### #### NXAbortSplit #### Split.c:506: NXAbortSplit(nxagentDisplay, pResource -> split); #### NXAllocColors #### #### NXAllocSplit #### Split.c:104: resource = NXAllocSplit(nxagentDisplay, NXAnyResource); #### NXAllocUnpack #### #### NXCacheAddImage #### Image.c:1495: NXCacheAddImage(packedImage, packMethod, packedChecksum); #### NXCacheFindImage #### Image.c:1305: packedImage = NXCacheFindImage(plainImage, &packMethod, &packedChecksum); #### NXCleanImage #### Cursor.c:209: NXCleanImage(image); Cursor.c:227: NXCleanImage(image); Image.c:1294: NXCleanImage(plainImage); Image.c:1393: NXCleanImage(plainImage); Image.c:1533: NXCleanImage(plainImage); Pixmap.c:1102: NXCleanImage(image); Pixmap.c:1434: NXCleanImage(image); Pixmap.c:1596: NXCleanImage(image); Screen.c:4567: NXCleanImage(image); Screen.c:4680: NXCleanImage(image); #### NXCollectGrabPointer #### Events.c:1246: NXCollectGrabPointer(nxagentDisplay, resource, Events.c:3055: case NXCollectGrabPointerNotify: Events.c:3060: fprintf(stderr, "nxagentHandleProxyEvent: NXCollectGrabPointerNotify received with resource [%d].\n", Events.c:3884: NXCollectGrabPointer(nxagentDisplay, resource, Events.c:3967: X -> xclient.data.l[0] == NXCollectGrabPointerNotify); NXevents.c:213: NXCollectGrabPointer(nxagentDisplay, resource, nxagentWindow(grab -> window), #### NXCollectImage #### #### NXCollectInputFocus #### Events.c:3068: case NXCollectInputFocusNotify: Events.c:3077: fprintf(stderr, "nxagentHandleProxyEvent: NXCollectInputFocusNotify received with resource [%d].\n", Handlers.c:1039: X -> xclient.data.l[0] == NXCollectInputFocusNotify); Handlers.c:1331: NXCollectInputFocus(nxagentDisplay, resource); #### NXCollectProperty #### Clipboard.c:560: result = NXCollectProperty(nxagentDisplay, Clipboard.c:616: result = NXCollectProperty(nxagentDisplay, Events.c:2372: NXCollectProperty(nxagentDisplay, resource, Events.c:3042: case NXCollectPropertyNotify: Events.c:3047: fprintf(stderr, "nxagentHandleProxyEvent: NXCollectPropertyNotify received with resource [%d].\n", #### NXCommitSplit #### Client.c:319: event -> xclient.data.l[0] == NXCommitSplitNotify || Events.c:2986: case NXCommitSplitNotify: Events.c:3001: fprintf(stderr, "nxagentHandleProxyEvent: NXCommitSplitNotify received with " Split.c:814: event -> xclient.data.l[0] == NXCommitSplitNotify && Split.c:1032: NXCommitSplit(nxagentDisplay, resource, 1, request, position); Split.c:1041: NXCommitSplit(nxagentDisplay, resource, 0, request, position); #### NXCreatePackedImage #### #### NXCreatePalette16 #### #### NXCreatePalette32 #### #### NXDestroyPackedImage #### #### NXDisplayCongestion #### Display.c:783: nxagentCongestion = NXDisplayCongestion(nxagentDisplay); #### NXDisplayError #### Client.c:378: NXDisplayError(nxagentDisplay) == 1) Dialog.c:367: if (NXDisplayError(nxagentDisplay) == 0 && Dialog.c:377: while (NXDisplayError(nxagentDisplay) == 0 && Drawable.c:1348: if (NXDisplayError(nxagentDisplay) == 1) Events.c:4541: if (NXDisplayError(dpy) == 1) Font.c:233: if (NXDisplayError(nxagentDisplay) == 1) Font.c:608: if (nxagentRemoteFontList.length == 0 && (NXDisplayError(nxagentDisplay) == 0)) Font.c:660: if (NXDisplayError(nxagentDisplay) == 0) Handlers.c:249: if (NXDisplayError(nxagentDisplay) == 1 && nxagentShadowCounter == 0 && nxagentOption(SleepTime) > 0) Handlers.c:544: if (NXDisplayError(nxagentDisplay) == 0 && Image.c:523: NXDisplayError(nxagentDisplay) == 1 && Image.c:626: if (NXDisplayError(nxagentDisplay) == 1) Image.c:946: if (NXDisplayError(nxagentDisplay) == 1) Keyboard.c:708: if (NXDisplayError(nxagentDisplay) == 1) Keyboard.c:1162: if (NXDisplayError(nxagentDisplay) == 1) Keyboard.c:1191: if (NXDisplayError(nxagentDisplay) == 1) Keyboard.c:1291: if (NXDisplayError(nxagentDisplay) == 1) Pixmap.c:858: NXDisplayError(nxagentDisplay) == 1) Pointer.c:119: if (NXDisplayError(nxagentDisplay) == 1) Pointer.c:138: if (NXDisplayError(nxagentDisplay) == 1) Pointer.c:155: if (NXDisplayError(nxagentDisplay) == 1) Reconnect.c:712: if (NXDisplayError(nxagentDisplay) == 0) Rootless.c:466: if (NXDisplayError(nxagentDisplay) == 1) Rootless.c:1179: if (NXDisplayError(nxagentDisplay) == 1) Split.c:783: NXDisplayError(nxagentDisplay) == 1) Split.c:787: if (NXDisplayError(nxagentDisplay) == 1) Split.c:885: if (NXDisplayError(nxagentDisplay) == 1) Window.c:2312: if (NXDisplayError(nxagentDisplay) == 1) #### NXDisplayFlushable #### Handlers.c:467: flushable = NXDisplayFlushable(nxagentDisplay); #### NXDisplayReadable #### #### NXEncodeAlpha #### #### NXEncodeBitmap #### Image.c:1410: packedImage = NXEncodeBitmap(plainImage, packMethod, packQuality); #### NXEncodeColormap #### #### NXEncodeColors #### #### NXEncodeJpeg #### Image.c:1431: packedImage = NXEncodeJpeg(plainImage, packMethod, packQuality); #### NXEncodePng #### Image.c:1436: packedImage = NXEncodePng(plainImage, packMethod, packQuality); #### NXEncodeRgb #### Image.c:1416: packedImage = NXEncodeRgb(plainImage, packMethod, packQuality); #### NXEncodeRle #### Image.c:1422: packedImage = NXEncodeRle(plainImage, packMethod, packQuality); #### NXEndSplit #### Client.c:320: event -> xclient.data.l[0] == NXEndSplitNotify || Events.c:3010: case NXEndSplitNotify: Events.c:3020: fprintf(stderr, "nxagentHandleProxyEvent: NXEndSplitNotify received with " Image.c:835: NXEndSplit(nxagentDisplay, resource); #### NXFinishSplit #### Client.c:351: NXFinishSplit(nxagentDisplay, client -> index); Split.c:756: NXFinishSplit(nxagentDisplay, pResource -> split); #### NXFlushDisplay #### Client.c:355: NXFlushDisplay(nxagentDisplay, NXFlushBuffer); Events.c:3354: NXFlushDisplay(nxagentDisplay, NXFlushLink); Events.c:4517: NXFlushDisplay(dpy, NXFlushLink); Handlers.c:487: NXFlushDisplay(nxagentDisplay, NXFlushLink); Handlers.c:524: NXFlushDisplay(nxagentDisplay, NXFlushLink); Handlers.c:838: NXFlushDisplay(nxagentDisplay, NXFlushLink); Handlers.c:1333: NXFlushDisplay(nxagentDisplay, NXFlushBuffer); Split.c:760: NXFlushDisplay(nxagentDisplay, NXFlushBuffer); Split.c:874: NXFlushDisplay(nxagentDisplay, NXFlushBuffer); Window.c:2493: NXFlushDisplay(nxagentDisplay, NXFlushLink); #### NXForceDisplayError #### Display.c:834: NXForceDisplayError(display); Display.c:2989: NXForceDisplayError(nxagentDisplay); Events.c:4498: NXForceDisplayError(dpy); #### NXFreeCache #### Display.c:1854: NXFreeCache(nxagentDisplay); #### NXFreeSplit #### Split.c:185: NXFreeSplit(nxagentDisplay, pResource -> split); #### NXFreeUnpack #### #### NXGetCollectGrabPointerResource #### Events.c:1240: int resource = nxagentWaitForResource(NXGetCollectGrabPointerResource, Events.c:3881: resource = nxagentWaitForResource(NXGetCollectGrabPointerResource, NXevents.c:210: int resource = nxagentWaitForResource(NXGetCollectGrabPointerResource, #### NXGetCollectImageResource #### #### NXGetCollectInputFocusResource #### Handlers.c:1312: resource = nxagentWaitForResource(NXGetCollectInputFocusResource, #### NXGetCollectPropertyResource #### Clipboard.c:548: nxagentLastClipboardClient = NXGetCollectPropertyResource(nxagentDisplay); Clipboard.c:604: nxagentLastClipboardClient = NXGetCollectPropertyResource(nxagentDisplay); Events.c:2361: resource = NXGetCollectPropertyResource(nxagentDisplay); #### NXGetCollectedGrabPointer #### Events.c:3974: if (NXGetCollectedGrabPointer(nxagentDisplay, resource, &status) == 0) #### NXGetCollectedImage #### #### NXGetCollectedInputFocus #### Handlers.c:1011: if (NXGetCollectedInputFocus(nxagentDisplay, resource, &window, &revert_to) == 0) #### NXGetCollectedProperty #### Clipboard.c:677: result = NXGetCollectedProperty(nxagentDisplay, Events.c:4013: result = NXGetCollectedProperty(nxagentDisplay, #### NXGetControlParameters #### Args.c:1800: if (NXGetControlParameters(dpy, &linkType, &localMajor, &localMinor, #### NXGetFontParameters #### Font.c:1417: if (NXGetFontParameters(nxagentDisplay, 256, path) == True) #### NXGetShmemParameters #### Args.c:1873: if (NXGetShmemParameters(dpy, &enableClient, &enableServer, &clientSegment, #### NXGetUnpackParameters #### Args.c:2228: if (NXGetUnpackParameters(nxagentDisplay, &entries, supportedMethods) == 0 || #### NXHandleDisplayError #### Display.c:860: NXHandleDisplayError(1); #### NXImageCache #### Image.c:1277: nxagentLosslessTrap == 0 && NXImageCacheSize > 0) Image.c:1476: if (NXImageCacheSize > 0 && packedChecksum != NULL) #### NXImageCacheHits #### #### NXImageCacheOps #### #### NXImageCacheSize #### Image.c:1277: nxagentLosslessTrap == 0 && NXImageCacheSize > 0) Image.c:1476: if (NXImageCacheSize > 0 && packedChecksum != NULL) #### NXInPlacePackImage #### #### NXInitCache #### Display.c:909: NXInitCache(nxagentDisplay, 128); Display.c:911: NXInitCache(nxagentDisplay, 256); #### NXInitDisplay #### Display.c:905: NXInitDisplay(nxagentDisplay); #### NXMaskImage #### #### NXPackImage #### #### NXPutPackedImage #### Image.c:933: * NXPutPackedImage is longer than PutPackedImage Image.c:937: const int subSize = (MAX_REQUEST_SIZE << 2) - sizeof(xNXPutPackedImageReq); Image.c:1317: NXPutPackedImage(nxagentDisplay, client -> index, nxagentDrawable(pDrawable), Image.c:1465: NXPutPackedImage(nxagentDisplay, client -> index, nxagentDrawable(pDrawable), #### NXResetDisplay #### Display.c:932: NXResetDisplay(nxagentDisplay); Display.c:1856: NXResetDisplay(nxagentDisplay); #### NXSetCacheParameters #### Image.c:776: NXSetCacheParameters(nxagentDisplay, 0, 1, 0, 0); Image.c:913: NXSetCacheParameters(nxagentDisplay, 1, 1, 1, 1); #### NXSetDisplayBlockHandler #### Display.c:862: NXSetDisplayBlockHandler(nxagentDisplayBlockHandler); #### NXSetDisplayBuffer #### Args.c:2538: if (NXSetDisplayBuffer(nxagentDisplay, nxagentBuffer) < 0) Handlers.c:430: NXSetDisplayBuffer(nxagentDisplay, nxagentBuffer); Handlers.c:442: NXSetDisplayBuffer(nxagentDisplay, nxagentBuffer); #### NXSetDisplayErrorPredicate #### Display.c:889: NXSetDisplayErrorPredicate(nxagentDisplayErrorPredicate); #### NXSetDisplayFlushHandler #### Display.c:866: NXSetDisplayFlushHandler(nxagentDisplayFlushHandler, NULL); Display.c:913: NXSetDisplayFlushHandler(nxagentDisplayFlushHandler, nxagentDisplay); #### NXSetDisplayPolicy #### Display.c:661: NXSetDisplayPolicy(nxagentDisplay, NXPolicyImmediate); Init.c:457: NXSetDisplayPolicy(nxagentDisplay, NXPolicyDeferred); Reconnect.c:669: NXSetDisplayPolicy(nxagentDisplay, NXPolicyDeferred); #### NXSetDisplayStatisticsHandler #### #### NXSetDisplayWriteHandler #### Display.c:864: NXSetDisplayWriteHandler(nxagentDisplayWriteHandler); #### NXSetExposeParameters #### Args.c:1896: NXSetExposeParameters(nxagentDisplay, 1, 1, 0); Events.c:614: NXSetExposeParameters(nxagentDisplay, 0, 0, 0); Screen.c:969: NXSetExposeParameters(nxagentDisplay, 0, 0, 0); #### NXSetLostSequenceHandler #### #### NXSetUnpackAlpha #### Image.c:449: NXSetUnpackAlpha(nxagentDisplay, resource, PACK_NONE, size, data, size); Image.c:453: NXSetUnpackAlphaCompat(nxagentDisplay, resource, size, data); #### NXSetUnpackAlphaCompat #### Image.c:453: NXSetUnpackAlphaCompat(nxagentDisplay, resource, size, data); #### NXSetUnpackColormap #### #### NXSetUnpackColormapCompat #### #### NXSetUnpackGeometry #### Image.c:1247: NXSetUnpackGeometry(nxagentDisplay, client -> index, pVisual); #### NXStartSplit #### Client.c:318: event -> xclient.data.l[0] == NXStartSplitNotify || Events.c:2958: case NXStartSplitNotify: Events.c:2978: fprintf(stderr, "nxagentHandleProxyEvent: PANIC! NXStartSplitNotify received " Image.c:827: NXStartSplit(nxagentDisplay, resource, NXSplitModeDefault); Split.c:857: event -> xclient.data.l[0] == NXStartSplitNotify) && #### NXUnsetLibraryPath #### Init.c:276: NXUnsetLibraryPath(1); #### PackImage #### #### PngCompareColorTable #### #### PngCompressData #### #### RgbCompressData #### #### RleCompressData #### #### ZCompressData #### #### ZInitEncoder #### #### ZResetEncoder #### #### _NXInternalInitEncoders #### #### _NXInternalInitResources #### #### _NXInternalResetEncoders #### #### _NXInternalResetResources #### #### color_type #### #### info_ptr #### #### palette #### #### png_ptr #### nx-libs-3.5.99.23/doc/nxcomp/nxcomp-3.6-drops-compat-code-3.4.x-testing.pdf0000644000000000000000000021762513614532331022441 0ustar %PDF-1.4 %äüöß 2 0 obj <> stream xœíËj,»qﯘõ;­WK fÀ3žYdwÁEÈ.÷&‹$»Éï§Þ*u÷ŒÇ9‡±q»K*•ê¥R•ÔÓK8üë韇é0Á[YÊK<´^Úá·_žþðÓáOÓK›áç°þÿÛ_žÊò2J™_–ÃߟJjýí P./ ¡e0ÞÓ_Ÿ~ýéÉuEf(%xêÐ`e Òx7yxîw‘bY¡D†,êEæÆh²Þ|e‚¬%Ï1Ì¿`K‹Æ¯CScפᤊíí>Ó§æ•d•†s4Ø’’¼@(×þ7ž÷DÇÌ–÷‹ã+03y`Ú„ ­³³Ë¢®dÏäŽì$…=¯½Žò˜šnUnÕŸ… )Ó«ážõñ¼j^‡9UV´@5,yÓº‡øhÖKçˆÔz¶°0]#G’y^ -4ÊÓ=›2?‰3¥b¾¾òôYVKìò]ŠK ˜M0ÈAÆHn¶&Ä›f^kñŽãöàö~eêr >b‹©d£(+ïƒæñtj’e«Ëps8ßß9†¤²¾ÆÛ óòR%Wu²U“$Ì\@`(Æd]Z<«d–&Ù;fÎXˆž’êæ0¹@4°A5Ú¥>ï²”ö’¡ cpæÍ% íÙE0hçΗ SÁ ŒîŒGÉp£Ê´1ÚEø@{PÆø ¯W ‡ãwž"ìí5Æ3/HœðJ¤zK šÚʱ‡][çEù®Gc›à‘³ðMĘ›“JÄ"Âk‰Š¬šñbÆ*hŽzlÄFPÒZQ%‘€ïa^ðÖ¸`rˆoñ†Ï•Eøx:‚[ž‹ó‘ \U_µ[nö?+®Í/úÿ.g¹-/yÍùí¬™LÖÐSÚftßæ]?^%ø§‰½~.ð»Ä*ïK\¸JêE&HAü$lL.þp_³¹ÖfS$k©— lò“¥ } à#%4‡ò"Ír`€ »Ù.Ç­3Œj'ß÷ƒpŠ)¦<„ÈëA›ZgÚ)ÂiÆ‚_"Þ>ÓWÉ[{_¶s±r€?ôÎ[qkTÔЛ[§ùÖÊ•ÎÊ/ó®4Ьª& p ­Œ˜æTS†?-[4º‚F]:¬±ªk_$Tf«ø¾ƒ8äÜ"ìeQE¡™"Ý¢Žóf¶…f^±¤Ÿ`.iæ7øŸl9Mé%,T6yjt¾¢Çd˜Èj@•ðfËâ¶¹‡•<¨Œ‰¤ÅCÃB/è«WV¢úMÛºmO¤åùËn='yL=|$ ÿÞ•÷ü=[3{P0õé’羋šâ†Z¤ê–m£R77°ï£t¨èhMCÌq«™ÔvÁ íSåa¢š–ªádsÀ¨©béG4š¨>®ŠVZš¯ZÙ€9kèòD‰Ô¬F ½D“#¤2VEŽW¹H+âîž~ÌÆäæä‹e© ] sžlðųµ“§>Ï›DµO½=ôø\1Cf/µÖˆ±«…^Þ5yuÇ]7t|ëEY¯ É*½¸Q™ùJ¥jîO£ï'î)ïä1Ῐ¶§T7»ÑÄ}ˆý=â¶óöÝœ½õ”ý¹á‘&÷œ™,šR– ½°óE——SøíI.ÓŒ¹Jj¶Ì““ "9ó~èy0?N!oc0ÚÂ¥æéœÀ â+›)]ÈX›$¹¬räí~|]ëà.[€¦Ç}? 9¾|÷ä8ÖíÖöÿäøŽ¾Ê¼µ÷ΔX{Z¡¶Ý¬;j «šùôdé?̱Ãõ¡d)æ¼9ùŸË±1\}1ÇÉôÀî1Ϲjœº!~‘¨î²8*µŠËéRm2°Æ|dŽäœìºyŒžæêzžeÄöØ&è•´­uó¾mÆ+mmÌQî<CͥȱŸ¶b°`®øa‹É®v×21è¥ÁC–qñýó}d~r{ ”Æ2Îű֣7Eß¶—¯‹Ï]pýl³m¯V >–¾“r¦e{Üù½”³*:º¨i#Š>)”ÃeÊnt¥BåKê± 4êgâÝÐ:êÊ󇄒µž!Ýß|1O­nî+ðŒ/Ÿκôsi%©ê²Ð#zü7VSÙŒB§Ùܾ»Q,ì¯ñ—¥7»²À5s]ÐìA‰{´}å÷6WÕ<4~˜’®ª<#zîŠÀ>.oìV,ÈåYôRõ“g^±·ešfcfÙj(eõ²Ãú]7˜çÍUë¹+Sj x&– ?;Òkñ­iüZ"±bRôHc:É»+’ñúÞcܨÁpð¬°èÄewxóó¥¸R—ÕÅ»†9Éþ”ƒ1àJô.æíÒPF&mÌ´ß÷ù«GÑãýZ¯^ÝÔI ”ØÈYà/ˆRº+³[Gw} 6°òþ€bu1wÓ;äêLîÔ@ÅÌþpÿ©7qÑ.Yù{)ùœÈ¡¯ÂµõϾü¤þîOÇ ´î^.nÎJ­ [u–þ[­Oªû@y~éÔÚÒ (ý-E)’ üûÌIn½À6sZ_ÇhйËC›4¸â¶*¹º,«v®¸ “̼ÚÖz5&,í&˜¾ŠØÝ—û¶Ý7bÑæ–¡ Vˆi¡ [ïz¹£Pãþž{ráÓ³bE1[¯N[xH»ÍþxPýéõÛâì|Ϫýk†¯Õ»ýXGËÊì˜ýföÕqö¥«º=©7ö®½qvÄJ>êð£G8“;ÒúLÙ-mÃÇ#ÊÎ.²‡›ð77¢»b랸ZÎÛ²a\c_(7÷,=‘½A)Ô¤ÓÃa§ÆmÝôˆÎ8ö²Û‘³¤ùùðo ùp endstream endobj 3 0 obj 3215 endobj 5 0 obj <> stream xœíZÍŽ#¹ ¾÷Sø¼€½¢Tú)À(ÀvÛ@r[`€‚œ’lrÈ$˜½äõC‘EU¹ÝîIÏ!@¦1vQ¢(Š¢ÈO,»ìþýòmçvŸâ~W&8”Ýo}ùÃO»¾¸CIøo·þþío/q>¤].ñv__b(Jýc'Tø‰Ô¼!˜ïåï/¿þ$rB<Ì]Q*ÇO,uÞÌgåP·ÊiÌL7* óY9Ø»¢TŽh…ÇÈÀN•ÀŒôœÊÜ—0ÌÕ%ÔÎIe0¥Rrfæ Á|f5 fc¦TŽËÝ#Á|VŽËÆ*L59qÖæ±ñtµ³IF~.fcG‚¸ŒììVaJ¥dß 1ÌgVÃÝ*'Û=ŽI7Ö>æõ‡h-ÂT“¦tС#Á|FîV9™© +œ7óY9Ø»¢TŽ÷x²ÛÐ`>+‡ºUNcf À,e ˜ÏÊÁnßåÕäøyfíæ5!|FÄ`âSMLž¥Î‚ù¬ìî')•\wþ‘`>+‡ºUNcf k7oæ³rÀ¬ ÌšðÜè â2¨Se4V¢0 ëìsãêR°·»1MFQoëOÂЇ—~K?ŒÙ۸ݟ‰ÅÆlsœ‰è±ÉD5ó,L$‚²þaF:©3æš´ûò—ÝÏ·€+Ý}ùõÇà]XöÓòòq^öptiÉG˜ê£jðO°:æÊ„{t™ZËRŽ2ö•:‘ Yj\ö!Á5À‰›ý™ÆÇ%6!ÞÏ…Îô„¤•¿†$O'ï±Çû+ö9’z¿üéËï_®_^~Y[#áqÌtÈ~žìá£{]êÄîZ˜êóÄKq‘É i^¿ìs]Ÿ²F&.܉ÞãB^-˹ÊwàPžk4’ç© >¿¹ÚOŸëesLÂB¨FåÍ™¨É]–}:B]Ù ÐjS”·¤Z•P³gÙbÝMxG%ˆ+…pÙ*¡º n*ú€zUYB:ÊvÏ nïµzË5Ðjà*Ï ›xÍ¿àBû{OáÉ5¥GœŒ¿¡û!6‘¸$XúJÉ ü(‰T#Çû0£JqÝ.>Lj¹ŒN¥j²Fu\–Ždlͬg^ódÆ3ú²mEï×'¸r¶#|[Ðêì9~–ï냳DÛÏÞxlR÷mkRsÒg $¸t‘{®‘ÕtžLfÕ6ë¶YÛG‡%5f»Á^é;Ò<å»ftOîDš??{'&Xèð±C6çQ¬3³Yãcgîê¤Ç´¬Ú¥Qw5”Ø+‡ŒdO&¥†p~7E1‹ûoÃëÔbY' SuÒjàDÛä'ÉÞÕ Ôˆ}’‹p‰P÷kŸØŠ“â”B‰(Õ¡ÒUÅš¬u¶c0ýPÖ›VÍ0¥âÿIµª xÊ]ÙûûºÂz‰_[n«»“zR„²ÒW…„]U7…i$dÌ·—&˜æ©)7°•FM<-s5éÇ6Å}7WQ$Ūçvœ:Óí-;XE³5¸Ç®r‹¨êëM…Tpå©Á^x^€‰a 0+Aɲ¯Æq'ݯÉÈ ?¹Øö&µv3öy;QÝɦ5ªÖ$É‘úvöwO‚õÁt7ƒ8GÔR4Ô5˜ù‘ìÀ!ñT£… ,ðM^ÂÇø‹" D4ko#œÍÕ“„Õ‰úL¼ø‡®8—mF~ÆFBýw—7Bý ý°X_ÍSñ>–´MžÏ-œC÷¸Þ0ßËöeµ®áÖ4¬ÒÀLB:¯Ýdo[l¸–6…‡M¦ý¬@kÀU£’ÆaÛ²ì¹ûÃ;FÎë+Ân¡—¢NEÐààc Æ|ìé+jtGý”û)Ù)¼ÍÿØûúꛓaÝÝ üt×:ùG§¦Ç8Á6=Â>oOh)uN›24NÊKY;wh”ìrh9KkþRÑÏ0 aC÷ÔyÕyB4 €Bˆà-dèÓ Êºà'É8 K0é·'Õ[v¬¦©Ix-k«Œ†º§„Å÷W:ë·àB5³Á/ÔEà oÔº@àb†cü•­=jiäáîz× º»(O°Bèk­ç:6ø"(GöZ1®Â¡D£ ±RÖ²ÒÐGU/äØÒDî3wÁaZîùß($…©lBÍ{7àñ–ƒñ^‰­ÝϾ)³„ xö±.|š9šÍÇ5hJN{Œk+ŠJ:6fë î§<öÆœJk¼_Ïìƒl¹Ñ(Ù¬™»k‡îZ©Írœxª4j +^Å_† ä¶à*¢˜o­’ ÿça®Û>7öëªítÞÙ‘V·5¶s,XÖ%Æä0û-¾VMl¤’â§Æ…ï\d4¦„ã:È\•Ûªr½$ôz²†žôd ƒ\`ìq®Âê[Wm@À¼'„»Ïa`"¿”¥@ Ðumõ’Áõ;á ãÜöUq’CGwœæçoHÉå )zk‘+LR̨Z‘Ãmo1Â8ì¹^\Zï#›ß5oçµd ð{ä°º€à\õæ±ÖÖ–áıÌ1ZoÐ¶š¯¯ Z6{ç6Ó´y-^o(z)™èHZП;¦1¨_n…A½”Ô1£»F€Ò°ÇcÁ·­T’Á„az‰Ð¡S¿’H}ó®Âæ6²û# DïwëO;†2½}q4\…íel2 M…g^ìü²û†á¬þy¢_ ˆh£Zn?DþFmÕ¤µ=·'î¼ûó×—Ÿ÷5ï^ÿµ«¢þ«èr8 endstream endobj 6 0 obj 2590 endobj 7 0 obj <> stream xœíwX×ÞÇWPAQD%öX¢&Àöe{céE©*X#bìQ#jbIbŠFM®7&&Ök4J4jŒA#ÖDÁBGD¤ƒûÞ›÷}ïïû¼×÷Ì,[ÎìÎÂÀ"üöù<û gN?g¾{ÎÌî—IÎ>“œ}&:ûˆ'û…ªU13CºHÐã§¿ê41Ñi$º)ýG‡ªTq±a³#“çDtf%FÄÆ„†¨T“û"äÎÙ'D¥œ•„.!6,nf(@ !.|ά¨8BîHëD“|ãbBP`ìÌ€.ÆìĈ˜Á¼ñÓ‚ŠøØÐ™ÑÁ]˜!hi¤GE"é›Ð%AZ‡„.2\©³Š£QK%|ŸÍãú¡wt¬ÕH£":]BKÐê ]D˜i Z™ÏÙœš™¶°êã•ÿÜ»½_M[´)!TÄçè´r+ |Nbbì¦ë>ýdÇŸïBï›6®G!ÂöI@ºðPMdx •B©Èyoá~”òçöùn›ûçÖdâ}û|’óîBtV­”`*Òm[7ïÚ¹ã£Ûv|¸õö wtŒB¶nÝ„Î2›À HèÂBÔaZK´jY¤\TµeÞ?6'þ#-ÃæÄÊ÷æFÈDZÌ,!R¤;L½·}Û&KPøŽ[r)S © `ûùúú*¤üèæ@©*…øúñâCU…ÆOÿ‡NÉ$ÎÊT:"Ä?B-¤S„ž@‰\åkòâÄKÃCå*µ€ËÑáËãqÃÅ‘tó€IÐ…«â™Â…|öýÕ1_ý÷·Ã)Y½*m-Q|CBŸ½1íím[7¾÷î;T ³iÖ˜Hh…AøÇ·rÊJf~«ñ£C5RU°$õTYINÙÃ/g ÙÚÕÇ‹ÑqɽókÔ2¾D¨L=T@„Üüvž4J-°YDx¨V,Óê6þDäÙÂù®D¬[²ýo¿\/!B²³/~ùn¼4RE'O ]p2)ž)JEÀ†HyãÚð†åZDÅRÍy òŽQyŒâ¬—ªbC™3"‘"mÚ¸Ö:(ÎÌèpª„"!ÇlB+4kâÎéÕ˜'QiWÀÓ¬þ>‹ø3ïØJ‡'›{øÿá×IJ!?ÒVþz4B±:òã+D&ù7ïݹ–¸~h¥†0狜&é{Фy‡–Èù4ò€aÐëHñÌñ.ÎW×§*êS¤ˆësÄ2ÎôŒ:Fïè…§PœŸæ©Q|CÂeo-Þ˜¶fÃ;«¬ƒâ¼µt1UB¤lhÇj Á&´‚¨Eë? ‰%FZÇ Õ„ðÕ©§r‰…ß­Z±ÿ:q*{ß|)/&Pb3=‘P¿ÿJ˜±RîïçÇfûs8ì:¥H¤KݽûÝ$5ßϺá*Q‡ß&ée “ ¡ ”‡)Íàóü‹Þ”×ÎçÕÎã"êRåWWÆÈØÓÿâ‡Þ3–ÏD!ä)§ðMŸÇ6$\¿n庵+Ö¾½Ü:(Îúu+¨"e3‹o1KhƒÖ=ξKˆØÝÏçKÙÆëº™:¹PªQ½u¨°eûyóà*¬Ö…4GÐjÕr¹H!—H$\Nðû׈8™i•ˆÏW.<ø»~¹xbM¸€¥Ù¬3í:µJ¢EŠgŠL*\­ð«ˆŸ\1s¢$Ñ÷zjXU²?:Fïè…§PœU _©ThH¨Ó©S—,Xüæ\ë 8º@UBìæ›Ð #­ÓŠÙ|,qïU#­ãˆÅJEÊ7ùDȯ“å¡Ï”ê$‹Ce£¬”·e‹–”ͧTj¥X5#T#ò÷óóóõ禞xHäq…œËѬù!›Ø8ŸZÌõógû³Ùþ‘¿ÍjÀ8HèTJ±F-µ@"äûgFL)_5¶|Æ„ÊÄiÄâxÆâ8züÕð×<¶ZÕ’PÀg'͉[´0iá‚9T ³sfÇñyª„kÖ,³„"!%¦Zç§Téøâįî´ŽÍ—Í?r¿é6ŠÄ0üÃ_õgß™ 䆫l!’é„q{·é² r³›„ôÁW‹elnІk䟹·dÝÐsíòÎ(›yÀ8H蔊¤x– …V¨àõÜÈ O#G?…!r4:ÌÅ4K â%''Ì›;knr¢%( yL%¤‚o¬u"? «eoêr„Ö gí»¦ß½~·ZÉPðùR]ÀœÏêêÚv´XóÕÚ*B$ÕHâ·œ¼t%¯˜ü]fÆ‘-‹´|¥D&œ¹ë¾ÉŒõ¢úušÀ,HèrR<,’~ÿõ+ÁãÊÂ_) ÷) Ù:åJðxtV,æa"EЉš3;1{V ùglL4:ËlB, …šç¯ÿ˜è us _¬"‚üØ¡ 1—/ÔÿDŒ&oÊ“/Ñè#æ+újè•"”ª8ò‡`¾~~|[§ÏM %nfòñ|iVAB'—‰” 1R‰PÀó_!ž|R3.;ØçQÈô~B3nyÀd.‘¬$DW½R.‰Œ‰‹NLˆAï! ¹…·GB*Сý B`Qa%Çáqýy\?ôŽŽQJÛù`@B'“HCº.Hè$b>¡x]$tâžT"è ¡ q‘âtaЉ„¤x]$tõEt%¾ÝÛ¶ª±ôžÃkÐN<;öåóÕ«Ÿ<øÏ”ù •¹í^bÙ‘˜¡>©—:¼á]§ß%{›wñsy>¸8Ûk伓UÖ£u¥Ad¾éõ•¡Üö®@{÷I'¬?–Ò{Ï.xž“óüî]$w ¾c0s6 óâìþKg¼Lžþ-ÑËë/ójw”Ö™õÏ ­ufm©¾yv÷?æå·WqT}e(·3h…]}ÒÁÈh÷úüÔ©ç?ÿLòÏKþ¨/f*󚊇Ո¯ÂÝ\CŽÝ®ÖÿYSÊÄeR“÷ŒÙ®h­c¼’˜jƒÖµ¢Ó:ösÍf_uB­ëTÈ¥÷þgV<¡u$Hî¶mkød Ã¥<9éæ~ªùf 1ôÃã·,” ïÃb½ì£}'³¬§ê+Ü–ά£Ýö‚Ò «Ô>N¬^.#Œ‡•Æü7T©ææñÅüÑnèjbõñæ¤ʬ³œ †È”Õ£ªI²&‰ÚºšÜp÷rûjÝ@–‹êÙÜÜÚüóF8±wÚÒXž¾lœË¤Å_>¬È¯ü}gü7Å_¯×› ´ËEúîoå¨ ññõ™÷ã­ø©(¯êö™ëË^u;¯fÕ•¦§Ms¿ö| ʧôÈl/§i+WåŸY2ÝÙsVzVƒÙG½Ê8K¶d¡Kµ*c·ÜÍgÁ‰JËJb˪Ͻ»Ý€OüÙü‹òúû$*­+ª»³~ê¿=ô’ƒ¼æýdú¹ùôdÊ(§±É{î–<+¿‘y&½¸ÆèzÁTqnÆ09yõùO~?ñKn¾]'qao8ù¤&/ÿø¬±=Y^tÖu­Dl+°½¤ïÉÚ²+‹+Î¥MîÏ!‹  Çï4Ó¶XíCÊjQscÙÕ‰’¢ºß×N8dÀ°³èƒøÆ[i¾LÝW–ZGoÖÑl{ÝãC Cúñß=†µèÔüI/5+ùo¤u?îÝñð~}MÖõO®Òƒ……”HQ½ªštÄ#‰ÄDBëöî5aõj´“m_­40êt¶þχ— {´¢¾¨òüÌ¡µ'“©òì˜ì&ÞSb6ЃFžnÊŸˆã®Swû+NŸ‘©éÕúYïŽw•î{R_Tq&|»ît)™0û‡(wèæÃG«2ÂN’­(*?4È;ñ—róJâËBÇU—wŠ]¼2ØyLÒ…Rýg_ͯ;Ù®~ýZ__XrDéî3ïj…I7Vþíé¦A”©5M3lA.& wc¯;v¾¸ªÐJ»r΄ŠÖÉúN»ù%߉–Öµj±­À÷*bð ø³÷É"~]âã¥/¢‘"ß4|§á/Uûªašá¬aÞó¾_ü%ßG—¶ìµqË}·kúîb±GÑW–ZGkÖÑoûaƒ=#Ε‘Ãzû@€ó0ý°Ò™ÿømuùÉ#¼f`MëpÕ« ¨ “"c•,˜M<~E ¹CXòñ:^²äyTTCîMÆÊÂìa ·/r®¯58ì Ú¬=9Ä{‰ÕÛ}ˆçСCÜ ¶ç¯á‰„#S3šî{àã?6ÎüîQQ¿)Û.×é'ÀÓúñ÷” ¹.£—ܨ"³Í½µv”3 7>Z•2|ñ¥¦ÊT_žïã¦8YjYI\YÄqañA%ÚXùâFž-(ø ß}Ú;ÙU·¾‘»Ž[}®Æ´Q•Œ²2\eMÓ _Píï·G Ǹö`¹¾ªN9þ0Û®[ßrûŽ[~»)íƒóñCFØw¿ÎŽAĶ_yŠ"ì*úÖ·ØNÃ_ªöUÄ;G•n“6žþ>z„è/?%ùøxæ¨vàÄ k©+l©uô.Úmÿ†ë‚V:ó¿¥nµw.m çŽrwíßßm€KOVâB¶¢uØêÄפ]õÍÀ³s{®ÕO`‘Ö¡µœá…/&ñQ!ŒGOë*Œ:4ªIü±˜ÞãÅÇ/³­uúϵ tËϵa^s›·´*ãÞWuøNƒþÏÒ£ 7uQ%ñe¡þ/ú*~˜ëaþsš`5íU{LØþ~À€ ›o噕ˆVDCÐg·µu¦ 2ZMþ‰­¢~Špíª8æ9,öâÓ¦Ëöˆ¢/æc×´Z=ˆØVà+o§Öa‹¦è4Ó¶XïCZZ—ŸóÉT×éÉqã'o¾ûä˜r¤`A¸÷°d²ÚZgç%`£íT«):óßP¥êË F¹qÞϸC\D§Þ1°Iëp‘©ªçÀu]CIÖŸr Z¼=OJ"´-ç ¯ý‹GL›†6¹Ì”HOëŸ~¿tlÿ©Köe—4ÖÜ/¸úõ‘ ·ÌoV?ÏÂÆ§¡u¥‡‡:¿ñö±GÕùÎ-õuœžÕPùãê1ý¥½ùÌJæf•Èê=eÑ…ùuEGWMq1ÿ» ËJb˪½y$r»jGNÕ­cуÝUåT“ÓàΉ0÷q.ÓÓ²«-ºQëiÂü/²Ÿ<«¸™y6ý‘Éý:LAU·öìÿá—'U… •—÷»ž¦4¦]įÁßÜ žÈÜJãõf µœŠfýÓêAĶÛKvj¾hlqæcm­)«aJMæâ1½zöôN¸T^ôìáû\ç^¬¾òã¬÷•Åý:û.m¯+ù6Ö³Ÿà½ô²Ú¼¢Ó &·Ü¯£3ÿ[¶ÕƆzTˆ® Â#ž¬¾Ä…LÕÕk ªIûCì^Ñ¢ŽÔ:´c5Öº²2b]‡ÎʤÿÖ¡Z‡&̽/–É_qíÉbõp0{kÙ¨ŠŸ‹G¹¾„â÷rñ/<®/×®‚Òó+Õc<}&Nz# j±bî1™iÿ´z±­ÀŽˆ½ZGQ4®8Ó¶XíC+Å5šÎ‡Ø,—ÀýOÐqÕ…õcY,ßíyµvj}—€Í¶<>·B9¢ýᢤuž> OUÓœÿ†*U]Ù?iˆ§Ï”éÓısýÝõ2EdÊêQÕ¤}iȽÙ$tˆÄDbk¼‡ýùgƒÖ!êNhïú¼¨´ÏÌjo¯šèÊÝ—[àø]‰º[_ ûOÙúK]wªICÚ*BßÊ!MCïhi‡0¼¶m#ƒƒ ¹KJú·PÐP|Çñ#Õ i­«»{v®·GȾ’:G·è äå¦ï»”“ÓP—“stÖXçqë®·ÿ/@;MMê/"DlõjBßБ q3lcQ8ú“\õ¡ã… Ræ9zÈ:%Lkݳ¼Oú²^¸÷®ùS h¹¿m“ŒtéÕ«g—OMØu¾ÒaŸ¡¨ÉŸ: !tK–´h©l6=˜ µŽ„|rÁì÷OÚ™g§ Y#…ÎLëP z¡Õ±Ö‘wó’’פ:¼ò4ùC§j7Ã.Õ GK;¤xèÀ8\¯xÿ à!/Ï>؈$‹xè@¢Õ¶#ÐrNÿÃBß Œâ0ó¢3˜ct€§„M¿2Gµ™þ§gp÷4ä…¢=šÜö éð)mAÃÍŸžO›ö\&E’e€üVIÿúWÓ³‰æo›Ç$iÿI'4bÎk«¡àcû únóÕy´Î^S N8‘Ú›öhrÛ}ç:¿sÝšTBë¬`xQÇùS.±Û¤½‹OÑ‚v4èk@ëèÓÞƒßä¶ûÎun纆»—ÿ=r¤u5[¸½[fï÷O3=£éÃfÍ2¤­fe8hôŠÆ5§:|W±ÜÛ6ðš~ë‘ÀórêÙÃeœÁs϶é…Á]É>‰ë«Ûî’ë÷ÏÇ ñyótµí -Ýqca%~+'£9Þƒm²hÃŒU¶­ÉøJZ1îÙ Úå\ÇàÕÔj¡Ë½ù‡NõîîŒð_®ýíû‘,C¦g•ô|ØžZDÃ$l³Y-­³êW†©•™"Ù´àùŠÙvÀÓçüòÔÅÄox‹­™æ<’ôܳi›FepG¥u¶]ìL'Þåù‰dÛhΦ÷`[,Ú°^pT}Ø–&SMc*¬ËŸ]Îu ^M­¥þ³÷ÿ·W/yÕ&­k•éY=¶\‹h– 0+££uVýÊ0µ2S$[|&ñ ®b¶ðôž{ý´Gšž1=9®r×{îÙìÿ *ƒ;ŠëÔ¶›éÄ tùcz"Ñ1š³á=È”E›aÔèký&SMc ¥Â[#bk˸õs uR'´c´µïË' ™ž5ÒóaË©2f™ ³2 è¹<Á,jeœû¬«˜-< Ͻy¤ç Ó9 ƒ;ŠëÔö€š»R¹ü1=‘lÍÙòl‹EvÔèký&?¦šTÆ}8—?{œë˜¼š^P2=3`݇Í2Z¹efeØ«uÔõ´HŽ×:¼«˜-¼¦uÝQãuá¹g³ÿ) îïW»Û|›,(ëD ëHr]gs@M'†uó=F'}£9û\õè¬ëð£Fчmj2å ÄûÎa]þìr®còjj- •¹ÕNT½‡ªŽüվߋ1dzVMχ­Â"Z &a«ÌÊê²2¶Î[w8oÎ`§ÖašC9QñZ‡w«·å€GÞ¯›¾ä|Q~}ññµÓ›<÷lõ•Á]ÕÅÍ“\yŸ\F‹¢šßÞ“:³¼›®S[>lf;í0‘í0š³ÏUŽE~Ô¨ú°-M¦ŠLå;‡sù³Ï¹® ÖŒi]îÍÚï '‰áØø€<6˜E0œjâÚ9{*ÀŒéM¶2‹h˜„­3+«½¾ûõ—¼›2¶Që°Í±Kë(\ňäÖðÈç°ë,<÷l›ÎQÜ”þ¸T2ÜÍkÌøi²øe –ç°624s Ä:ª1?‘ÈN g4Wd§ ‹6ü¨QõašL™Ê¸çòg—s][¬ÿ˜ÒºÊÜg·/Õ_:Å`ñÔÉ<ÇÓyÌ⺤ÜY§áîe´Dï6¢áI'ðFç1‹ëÖ4”dRFÍõÅ$6£9¼-à€çP:Y\·†±’,â^´ÎJ´>txC sÃašu¯­ÎçÄÅpóÍèjž3ÐhíÅn—×Ö §uß ´\ÂÒ:‘AëÚV{Á9ÜDhƒñÅ2w ÃzŽQ¦1âÖ…µ³Ã\Î+4%R8uÂXoω 8lžtüôð–k”ÍoÆQp´½MF9ìóc\>5xë‹óKxëÙJÑd®¬/–™KÖ€‹Ê0·.¼1ms97–³dKñ#šŒÝr7Ò—§eV4ø(›oÒ·Ž±€£ÛÓQ®½µr¢+§é×¥gx™}î>„ŽŸÃ@¼/–©KÖ€+‡Â0·.“Ê´sÑ6—óv’´+*?4Ho‡ÍÓ2+šF|TÍ7)ÅAp4›Pb:ÊU—¶LéÏýì’Í''tƒ¼.=¥—^ð¾Xæ.a®[ßâ Óqë¢0æ¢m.gb7Ÿ´€Ãçi™=#>ªæ›ÔÄQp4½›Œ2’²ìí“]ý·äTß9<КÍyBxÀúb™ÝÇpQ¦1âÖEaÌEÛ\ν¯êðr{XzTᦷ€£2”£Êʺ¥_œ1³€£ÕËgõ÷6ûºNû(cÆÍgÙ•ª¡‡ÄÀ ÎË|2ã ¸ê¨ Ó˜pëÂsÑ7—Èê=eñ/ŠŽ®šâDZÀaó´Ì ç§gOóqM/ÁzKɪ¹º‹Ýw„`L¿±ÍëO: ­;@§ã‹eqà<Ǩ Ó˜pëÂsÙa.ç=s½….OˬhñYi¾ޱ€£ÛÌò¬ o?ªÞøõj¬ ½YBëδ°Ã ;Z@w´º7¬nùrx·ÐÁ  ÿywzÖ@÷„Ô:‡W£cؼy3htO@ëè€ÖÐ0Ó:Ï ]ò´º-X­ëbZÝØÃÐpðº®Cþµ¬ëè u]ݽë»Ä£ûBÓg¨oôÚs…úÿ Þ±ÿF ´º-²®Ëùm«¿³ók‹÷Ÿ)zšSúû4…ûËãæ^x\ë::†X×5}ØßI¼÷Z½!¤ä`¢gï7>¸\×¢u%gûyŒ™sðZ]»Õ´º-°®«8áÑÛÿËüB£Àûçböî~ôD¯u÷ Ž&NrŸœúýíz¦Ko„u²®+;"êÓ_sú‰q`Îõ#{¿¶ñþã#1C¼ÂS_ñð_ÿÓÝgíÜXÐ:è¶tغnùºîeágĺΣGŸÞ,¯ÄjÛ«°® Cî×}®5»_÷øP¢gïéÛ3Èûuoù8ÎÇõUÇKÛMîH@ë ÛÒ1Ïaom~ÝIÿ¶¸<çÉî½GÏ9WÒò¶öþ§ÑÞ®ìµ'Êê˜o#¬ëè ï×ÕfeҗšÞƒ_\s&ßüûu5Y;½\yN?m¹#­€n ü€îü€î¬ëèX®ë:ƒÝ\{˜×5‚Ö@7ö°t@ëèZ·¹Û¼@ë {Âê–/‡w;Œ£UÇ1/‡w;€%ÿã±â endstream endobj 8 0 obj 8162 endobj 9 0 obj <> stream xœíÁ  ÷Om7 > âh endstream endobj 10 0 obj 79 endobj 12 0 obj <> stream xœÝKÏ#·íþý Ÿø‹ÞÒ†choè¡è)mÚC·ÅæÒ¿_R¤(jfüÊnE³ÈìhDQ|‰/yÍ»ÝýçíËÎì ¼Å)¾»] ö½ì~ýÛÛŸ~Øýëͼ—ÿí–ÿú÷·8½§].ñÝï>¿E_dôϲ‡'Œ¦Õ€àÞþñöËo2;ž:<ÉÉBõÊ0 L ¤÷hˆªi5¨P L†Ž£Ž <³,§¸IÅ(©Ð¨áI©tAŒ‚ÓxRQR¡‘à‰B€~e…#* Q­± bĘìR¡‘`ñ¾ bœæÆk 0œ(V¿ú¥Ža,UpÔ‘à°¬¯i5 8M‹Õšà:Š“Rî0`8…§‹à¡‘à)™¨›V‚Óxê´àiÀ4ʱ³2NãéØñÔ‘àIž¨›V‚Óxê´àiÀ4ŠN±2 Nãé~*i$x‚!ê¦Õ€àžÓÝvhÔð7µ…ú•a7)ÓHpØÜÅ:NÓR§O¦‘‰Ý\ÆÁ)<>u ã{ÃácêÛƒ ¥0ÔIÁÑ@iBß|œ¦¦-u$xà Š‚ÇÁ)<.vjð½ápÁu÷2*”“ G o:ã€à4%^Û‹ÓÈŠ‘èW¿´˜TöB#Áa”‰Œ»´šùƒsîä?ÜÅg[wü˧?¾]>½ý´ÉX `g#kÞ1ÕùhùA$d«Ò×8P"+SÈ Nˆc¤ÇBr€‹™D°`Ž3NR«†$ÞÙ¹É'|Ú+Qç.òvòfœ»¸ x{J.à\ó *÷Å”¤£Í\uå塺õ·Qd„ÄOz,ÅclÒ;ã«gSð•Åf7em6¸M·›ô²ÙûŠpNG(ã`È[Ö@Ñ´T8 G7Ø< óIs ÛhG@EÓG>820.6à&ñ¢¢EÊ!p™.hmè,<ŸÀ²NÎ=]'“Á›Vѹu$:‹|8óÛÏÇ}ÌÕ²œüXwæbªßbõ+¥ °Bg¤IÑ Í¹¡l+[]™  ÜSÄÅNöÿçgÉ6»Ža‰0t®ïŸ„Hâ%T ³Ð{Å «•º6é2Y|ÑdölføóÁ j zbhÖ[3iuФðX0†0Ÿݹ9BlJ¸šÁ.î)ƒaðöÝÇÊF5ž0¥ËíT]ßI9ŸY¢§àýŠüÓZgèoØ×Ѭwè{ײh­OàB!þ÷Xѳ#DO³ áK—ÓB•{ °× õn¨ rüìÁ*ÜTå/UaÈBu§0•‰xK7£ðu”ƒ»Ü'ËHÄdU I=R³ÓÍJ©'V»ây¶ÀŽ!9Ö¸‘»Çð ͘Iâ…·6’”WÑ…sŽbµëx_ó T2éI\Ùnkø à«ŸtB2ÙÐ6Å¥Œbïñá5¸qrP¥­¡Ö!áVü| ¯X¦µ¾¿s~DÒ›¸læÚ®9³Üòž"ý¶Ìz‚<ó™)æ Îÿÿ4³†ŒGrì3ë˜ÒûKÉãµù©ìGöì*{«VTù!¨µºCÔIL{fW“ £ÑÒ@^žÓ™WU‘Nb׆Ñg]¬oé2„[*sä;˜£ ,9ïÈ÷×p  ™?DbÖG¶»š‰á=¾ åßçæ#ñFÅ@.ˆyòc¥{ïê}ËVžÎ67+çú(Øæàé´½ '¸ÕqþfÂYÕæk r:1„Cåɦw­ÊKâ'4ÊÇP4TPròf¥fÎÂätœ_Ì£3M¶’!»‰‹‡ýDù¶5Y²÷V@XNW'ðb )ú>ã"kâjh’,’þZGU8…‹±*‚h±á*ù¬ õ™*‚"š·;Éæ½·©z®Ú©ë‡-±ˆiAÎQaS+¿ u$Ûš«^]ÒÎ òÖD×݈X;×ê©‘zÙ ý®Ó"ƒ˜ɹ “K xfAie^¦wþ¤ê+ຘ¶2PlûÈ›œUyœÑSõe·J0<}WkA›UÛj&«È–:\¨U4Ý!”¬N1;õú±É¨Äûˆ¨ ýd &ü#~5wúd(b^QÆíší!dÉ1—ö°R²«û |ð y‚3io_ÓECÇчª–H"¤½a ì,’~ŠŽŽk'Gc©ýÂe8Q6Õ¢’zZÖÎkÖ˜>(œQ¹¦m(&,öv ö&à“‰K‡d÷‡Ý†»Êˆ¥H]O4&F9,ZPûÖ”ŠÝ²QgE—`îê–Qošê×­àíK5 ¥Â-+³’½ENÇ÷í{•\vL?Z¾ø{´î©ü%Øi]àr_VrÚÍlíÅŒf”É빌¯E½Îµo·(ÖíwYu¿Umw£%c_ܶ _:#së`ʪêùZñ«Ê@5ÿuãÜ*ÉöJg³Šú_nnÔÞ×Qgi[”¡LºŸaú’–ù%;˜Ø:á§²¸)påÍO.ÜØpб³DÁ|èÍÙÞÑý}kóZŠP‰ÛÏý™ï.YlŠôiÌ©"6pçêt‘rLí±ÕÊ'¡jݶ4ŸEŸ»ZåTÜ%)äuq–j»º7mXínˆ\­ŸÍÄÍäÉÍÁoûœÑ¢7üðïësš¿Q¾‡Û‘7[J7˯¯s;\Ž÷qî^6û§ÊúU‚¶¼Ì"}ç–=¶‘ª#ÛÌ ö±­XDû}º‡J]eµ-uî,ßL+²lË›êôª:º·ÍòÞˆËÇpoËÛ™µ"¾åÕ"¯^äÉ'©ðÚvœ©$V[¼pΨ0ˆ§‚@±˜Bj²Ê [æ‡Æ,*ʤۄIwÿÄ­ÜÖ%N=]\6D6mÕ‰„Pš˜-ñ_3`ñÿ­@O‡¥tl¿<ô+àe÷!ŒX”âlÚÖ\¿­Ex+Ôá ŽT©$¸—‘,Z°' *"‰Àænìe±M¯h6ÈlÙm_{>U=~®þXki®*kCWYö“¹[+¬~e2ö&‡a´^²öî›-¸aºÓgwÞÚÅÒŒª 58´õ†ñF t¨û}å•zÔiX”à{Ì/W÷-°Þ"ü%J ZåkcÄÐߢS]ÅIe”þû ‚ ­ßÌŠJnGê|‡éïW’ YÉ#Y»røi{´òknþžÔŠnŠ¥[ââ\(S,wnÆ3öÂM×ê‡T½g´Fkéì?ž.£Y—ÑϹÓÑúazñÛ§§Ô¢.Ò—»“ôôõÕ%±þèÒ±Þ¢VƹºO¥…º`Ø"R@6ìÂ֯ʿ{B¶ÓF±üüÕ)D¾¨ŽÜuk+ÝÁ7¹OõxŸú/SmI«3üÚ%ócÓJ¥ûâBÊÆmóJ:ù÷æ6…UyRËþ}à}ía]ýÃçIf³m• NG§–í÷$&®^[^j¥»>»Óÿã‹5>I²~Yí3!Kp<î rÛÞ¶2c†ç…ÊapºóK¼FqÐ?ÄK¸‰ççÞ5À?¶Ÿ° †£~õÆc è¢wø×™²W๑¦J¡Zm™Úð킘¹¸«Ûà·ÚÑœKúQÉ|ãÖoU_Ë#ö›¸óŠ27´f~Ú}zð«Xlȸ)ã/Ê-Vßí_ˆ}©_Kågb_Pv?~ûñŸmØÿ½ClÿR/u§ endstream endobj 13 0 obj 2986 endobj 14 0 obj <> stream xœíyXS×Þïã (ˆ  ¢Rç:TQ #BH@fPfEq(Šu®u¨µNU[­V[-ÕªuŠVT™e<ï=§÷}Ï÷>÷x×N dX;ÙÁ„DýåùÌ7bV€a ôrÆ9}j21ÁdDÕ½=KD¡!¡Q‘A³cCçÎ 0,q±!‘Bá¤#‘R½8$ôŽ‹ A5+À°ÄDω ‹"”J€dêäÖШˆ”9+Àx˜1ÓŸ5nê’ø€èÈÀYáþFEÄÌ´ š!ð ñEª53l€±d iTh°8<ÔO (ȇÏsgsØtÓ½£m±ˆbtøÀ@k*¤Q!A"$ døŠ=ÝØŒ-±™É ë÷¬ü×áµèý^ò¢Í1\6ÃO쥦 ‡ÍˆÜ¼iݾ½»øþzß¼i=JqÓOA>HFŠBƒ}±¼P{áW ÿ÷·‹ÿÞ9ÿïóþÞ>—xß9¥n]ˆöúxó°½üÛ·Ø¿ûÛÝ;v³ý›]ÛÐ;ÚF)Û·oF{u[€¤QA>!AbUÄ>ž¡^Üúm ÿÜûÏäH [b뾚âÉ‹<• "1Ù½)ÌW;wlV¥ïÞ½MàÅ×UA2ƒÜé.ÎÎÎ>;¼#‘/œRœ]XÑBž@ä"ùàçÍ%öúz ý\‰×7*‡àËó:+¼Qþüà@_/¡‡É™Åbûz„R @;H£ý…H¬”@énlzþêˆÿZþ__“²>³RÈ`yÎ;U@ä~"ÞÛª)¾‘›‡Oèž»D’¬gÙ÷óRWŠ˜îs~(lW­‚vù*N]âŦ€NFùû X)áÎeÝœïÓ’$hYÌG<˜ãáÉpʈá¢mô޶QŠtÊs#Áå—\öEâ¦ä57¬RÊóÅÒD²‚H”Ð%ž<([P ÜN™BÜÜéîéÁ““)V (€í“t¾ˆÈPö۪ǻòŽÎç³"|yãKqݼ¢?B3Vz¹º¸Ðé® }¦Ÿ7—ë—tðàÖx¶‹ 3pã=¢ORbܨ… ¤Q3|½fx+Áf¹–îÕ4ŸÕ”ÀD4'yÝ[áIwú1À½g,Ÿ…R¤»Pž²Ï=Ù,º¬àúu+×­]±öËåêAyÖ¯[AV‰’R~YŠRA5Èdêe^¡?9ßÏçÓåWS³ü¼Üø"á©e×kY) ¼ /†ÆàˆÜYž‹.>Ge3w/šáïɤûð~ÿ¾\wŽŸ·›@Äô]÷üÏ],Ê‘ @å'öDb¥‹éZ·€Óç$£i÷ç¹~.Ó§-FÛò»PN&ÃUVpÃú•«W%IÁ^»ÉönܰRMAÙ¶jŠ|A5Èdêþ¶9/w¥g‡.딩™¾ü~b7–pù¹\©L¥Ìóæ0ƒ•Cù¸±X²ûãl6=¨c× ?_7–89CîÆTEÆ™õÁ~îô_/”A `{DíË ®ûŠRˆÝ« €~3B#bgÏ[ºfóÑ‹™’|?±—\7æåp—º¨Éu‘wƒ&yÒ§f,l\â‰ÞÑ6J‘îBy.…¹ ü²‚óæÆ}±tÑÒ¤…êAyæÎ%+ˆDI)¿,E© äeŠÇáxÄÈ•­y$2"òvc{/N}L¤”fIvåŸ#ä0;ã±2БA,öñòâ ¼xî<“áÿõ}"Of²HÈe³½¦<•,Òή æ0ÂD\u@ ¤Q>Bž‰•"ž|·Õ—ÚèIµ³Æ#*c$ÕÏuEÛèm£é.”g•À™Ïw“ôóóIZ² ñóyêAyü|…d±W‹Ø‚jàÈÉ”ØƒÎæxƾ''S oÁâŸKˆ”‡'æznºT%Ù>9×#Г!Ê›Ãbv^ô¡…\Ç.¡·‡pf ˆëêâââìÊôM:ûœˆs…“!ZóGq¥y~•?ÓÅ•îJ§»ò¸®« €î^ðgÝGØYæÇωZ´0~á‚9d ½sfG±Y ²‚kÖ,S…¤ )Š2åâ-ôc{Äþ”#“):Ûs~Z~û-)!éXð7Iö>ÝãÆ ºk<×ÓÏ-êðsâ–TniQ^»ü”èIgÎØx_ú±èQAîC ÷ïìÓyFy Ü‘X©‚–7œiE¡ã_…Žz2Cè(´×Ÿ= åT*èÎeÍ“0/nÞÜXUP:ÚËucéª ly™âºˆPЇçç’å!SnqGïK.÷~[-b„Øl¾ŸûœïŸK´åþN´Drk:—/âEo;wûnq…ô›Q™iÛ‰ÙÞ,WÉe¸Ó}:ÙB"É…(ð`²Ý$¿•¡yµÇdóD’Ë8{¹9‹¨Å/d0\¥¿ˆqvqa³è~’h¾ôw7 /.Ë™bå‚4ÊË“ë-ð ƒÏsã°\WxL:'›çïø"`8z?+»Ü}Jçñ8j ¢ÖÛ‹ÞCB^<”®‚| BP/wµpÝ ë'‹éÊbº w´RPYã+À‡Ò(OG€N£iσMˆ€Q‚4ÊÃÅçqŒ¤Qî\&+ãi×Ä À8Aõ¦¥@ç´ýr¸-yÕ›ªg¯ €*­g޽]½úmJÊ¿Ïo«+2x}4ðê·¹Cnè%¦l£&-ÂÎ1éÎs#­ðû[ }Qps¶ýˆ„sõ†¯‰Žè Ôá¤56ªž½]¸àmaáÛœ¤Tm×ÓeðºKËGôeüø¸M‡1±§q ­/ûû‚iÊË®¦c–=®/o-?akÁÿî¯fIzkÙÑ™6}Žd¶`c6d]>¸ëJq‰.G\Ó°ýîÕhøëÇÈφYô¢¡—™'aOök\¶æ¼Ì}á®v}P®~vÎ+na„±µâ×Í¢Oú£æc‚¶Ÿ¯iÆÄ¡’G½ÉÔ«_cííuýg‘BL*3P)N—'­ö§Ž;YèrïíùóooÝ’ò¯KþÑR¡³øÝ,SýzOH­ØÏoZJ+Nù±äACÐôä·›ž»ž7hŠIeÄ‹[5Ö–J£§ƒ6åd]Ø+°¶à§”•©‘)îÏ·ÓüÙE§  …~n)o)ún†e/“^¦œo3šT뉕©A´¾S¯”•4WœY3ÕtÄ‚³uÒ™iI3ão}òM€2| •òÈb¾¾¸l¬ÙÄÄcÏkKêžîn)øñÁ««3‡:„œ.,Fëê§gÿ,*VPƒG+'X0ŽI&|UÊLÛÙWó±qZZ§VV lÿKŠïÊ«CRs5y’9cÿ=œÔÜH9 /:{O^œò¢I9CKþ–)}‡G-ôo޲XM™¹¥]Þåh¼¿dT?§#ÅÒô’Â=“ú[õ´^ëú„¸sKÈÔáà ¬^.ýô'Sµ—‚[ù]¨’~Ìû#ÌÊ:üTÅ•pKÑÙJòP¯Ï-nw­@L¥æ4>\1yÀämOŠ”úùMCÆ7Î=i}G K1Á±2e=@œ–-ÍP.´rˆýóµd& z÷HTVC¥<1ë®Í²$>÷Rš¿¤`÷$KCE7c†YÒ×¹VQ[½ÔßÞ6Ùœù±8©>ë7Ø!æö«rlœJŃ֫†í¨¶ÿkQñ!ƒ£/KW/ÏÿZâhyº3eM/³JòoÝ85¡¿Cü…l¥ 1B^h´>NŸ_È/¨Ë?¶hLo‡yéJqêoÅ íÇLëëÇœûX˜Y§uÔ!ƒ/UK>6gc›He ß@ù:4_P½L ¶ ¿(éóæÇ?1úHºØ ”Ü­ã,øG«Iç°BÌ:ìä— hØ…é]t´½dÉÛ°°¶¢,'SÕ©L³QK¶÷º®iÊ>TÊ’Kì )ûöŽ`æH+ ssËf=iæÁ矩—©7ÍÙgì‡ü˜s\¾ŸK ö³Úñc鶳ީ®ð2e;,ñvûe~ÃGKÁ¹*éR|DRÆsu5TÊÓ³:•Õ›ÖÇÊÖÆÎŽÀÖÊtggaýÓ›;ÃÝF[ô Y|ê³8ý¹ÒŠº$oç$ ×m… Ùéþƒ?¿Ð@t .ÎK¥Š©„í¬¦ÿ«nk>X1rHPÊkuƒûìÊ,+sñ‰WŠéÍÙë'ÑLD§s$KK;õuT–éJéhIÇJiïd²Õ”ú<¨!ýÇ.ïâ‚kѶÃ%2…o |=I‹/¨^¦:ãäœæ˜¼ãŽäVsÉóÝHŠŸÃ 1«±“ŸÊˆ¨»7%ß.Ü„‘¿î{ÇÓGo´^ýõ­XL<ãC2…VP²«ˆÄÿ ÐÁHWS3.ª¬¦l‘à+þAi¸³`¤%ãëŒlbèkÏ>|f™BJOÖM06ñË©²~nÎß%°´‰JÚ˜·ÍÝÂ.öwå5éjê´üj*¦}5%w—_C¥;™²ÕÔ•0;»°«5ø¾j,9»;À*4Ui*¶<Ûâl1õÛŒC"KÇew ß|qqHnŸv†UXM)÷­ö2uÉ”¯²L½©N ³ì/þµ]¦Êp2õ¦âˆ·¹MüõYKܽ)yj/Ù ¼ùJú1;MÐhçjJ¥¤}ÕÙX|A$CíçÝè¢L‘Ìa…˜u¸ÉOU¦äëFRDýÄÓÁé£Ú*sÿöâ¡%ÓÛøxB¦Ð"Jöú÷¿‰tÄÔ©èªð]%‘)×C÷êkŸ7Hh¬/}Su*ÖÎtú—g^4”¼¸ºÔÙlHLǽ©ñóÈ{UÚZ›•yùâ‹Fb±:Ô.èü ô'µ¤,-Ć֟ŠL½iÎý#Ú¦· &íçÆÌ…‡„­ þ çîr1}õ¥âÙ½)§%×ÊKZ*Ò×:™Ÿÿ[­òL ©!‰L½yõûÒ1æS–Í«)}Ó˜_zïDÚõGµÿãÏêú²¶º;Çý­†Ì<¥¼°o¼w€Þ8gô€1pqqZ”ôS5lç½)\ÿS8)ZËÏìß{4ãiVõ‹û÷ŽÍžÜ×bÆÏ’[è͹ÛÖ’<>hyv=aè€éIWŠ  O.×w˜´ßäó4?M±2w[ïeqÕ­UŒþOñ¨ä‘ŸÆ/Sc쇄üü]7>Jfõ¡Ùµß›Â5Š` Ö]Y=Úœÿcæá)™ÂÏ¥˜¸ÉOI¦”âÁNž>ú¸ÜCK)©L¡Kì Q‰‰™ü”Ö·ŠqÈ‹`&Ì»>úÖ¨¶¢¬vBÄÆ×}ò}·nÉd Ñ|ö¤¾ë D[ò*Bš@!9BïhA…½vì Òýý ¥Šÿ§­"Ûàuàã¡åöyBV¯&¤ i”¤K²ë>”Ž>J×Zh{á‚¶Å ¯6û‰Z²¤S¦¤¢”’Ò~ÿ\*SR¤7ØuõåM´f\ IªQJ2…Ñ ­©äeJzç*>þÍš$ƒW€ø ÛuIvY'¥£+´!Ÿ.«ÿ¸qà^:ú¦u×&¤6Ľq)bqç6-¢$¿;&¤I–A.áï¥ëÍ.©!kkÀHÓž=L¦o»Mú{¥ØÉÇH0 Ö»®¶`:áh˺ñvêÔ·ž|¤62¤_9hçßÿn¿…ÞñUùœRtéœÐôåÚ”eÖásO+ÿˆ^WzE#݀·éÌG{-RüZW·×§d꽘NgM!Sj½ÈóüíÅë&ânõhzz’ÙÚþLå#êc^é¼]Ý S]®³š‚’ß&ÐxØÔPXýä‡Ec{©¬™ÒÃx­%š m9wþ3b„z!Z¸½«Ï¦í—ŒÌ.I¥`cÖ ‘m_â«¿,m¦'?(ìÈ©;'¥vU“µ]“m5+$ •Áy[i‹ ïWtu«I&†Â/=‹³7é=*)«R­+ÖyŒbs®•³6I©ì”V^Jt±='å~sçAu7¨t{±Ò(ž/šGªÛ4ª(ë~Âÿge¥þÛÂ\«ú—]¶`ó“Ÿh5u_ójªkN>JÞSdm×h[DÅ ISe0½Ja,º<ˆ¤CN¦Z«.nuécÂÿ®B¶šÂFƹ6QmŽÂ°jãì„FÉTƳÒÓ±­&%ýþX_ÆPTº]é#ùù¢y¤º‹–ï¾þ¿½zéÖè0-*`LvIø‚ÔeªkN>Ší"o»Û"*VH+£Ú«TƢ˃¨V¦h´}MLúö ÑL ýái¡zW.….ípm¢Ú¹²Z9;a£’E°µNòýÄÚuýÌ5”ަ¥nWüHz¾P©î­¦° UN@×}Z~3Áˆì’ð©ËTל|½§ÈÛ®á¬T¬4WF¥W)E—‘ B¦ú8}s¥¸(«²º¤Ý»@ƒ+ε‰bsäz@+g'l´G¿D°îѯÍ>ö$ÞŽIGÓ‰R·+O9²ó…ÂH}4]¾ ™Ò‰“’ñ‹æ¶ãeŠŠ’æÊ¨ôj9µ±xÇATk=­Ö• ïÚD±9rhåì„­‰šŸ§í‰r´˜¾*½ 㻨›éD©Û•¼24Ÿ/†§­®¨áúÙ†‡tB}ÚZÿpÆhì’ðÉdJWN>ʦ.ÛNâBÅ ISep½ªy,º<ˆŠ>Tò}«N¦°‘_á\›¨6Gá(Ú8;a£©Ð”¿/ÜÁ‚¾ö¬²uŒ®¦•nWú¨ù|1¾Ýrû¼®_tŽT©ÔÓ–s­»Ð»†l`•€~h«Ì%Tˆœ´THјÍàmàƒ„ÐŸÊ\â§.$ÈdJM´*3xC#€îJÙX=Ñéµéà-z¾àælûŽÿe4C£~òty@UÿÙ™¡GM]% ^“ööàð£µO‹œw–vö\º©.»Ê ú&¼»LuÍÁ¬{<¾ôå®àø8eJWMZŸ$ÞYš1J™ÒG©–wž“:—)ã°{ú¨QoÕRZu}•£ ­—Ùp÷ø þ¶¸3¥kîRºsø1˜G“ª¶;hRôÎúó´Ü¿oÆöUiõÍ5âOLh=M‡qµéüÊ£<‹OwäHÿÐç_‹²•üc~Õ¤´ø»i–ŒoJQo¼þ}ÑPZo÷ï*š%ç»Ã°E· HížäôD+“(y0q}dã¢ÒojšYdLîjE×ÈÝ+«Ì•¨!vQ¨2ÔÔÐÒa™Â™Þ´¾L±ÀÞz¡º±¸üüü‰½iöªgJ—Ý¥täðcH&¥&`»B>¿üäÿË<¶¯^žŠµ5£o<‡:¿$=nLOÊO6«É——·ž­,o~ºvê Û¶A—«Qâã‹~I>4z¢I”Bâ ªÊù¸`ú¼™Få®Öœ½~Ê@—C’aª<2Ø>áI4)µ&Qå ± iÿ¹wóã“î¦CUΔ.»KéÊáÇMŠMÀw…|~2™ÂõŠ6dp`ûâ­9ëÛDU¦ðGÔ^¦Ð®¸¡óoåWc;ú%/ûlìò¿ Š8 dî&–X$C#ç™ …I”||A™"ìSÓLcrW{Óø×~º…Ë·¡Exeš·•c½Z-ôãA­ITA ÓlìòÇí‰×¢m‡«œ)]v—Ò™a”=š”í¤p]!ŸŸL¦ð göïZçwA¦Z²O{[NÜtá÷ðáÜ#7â]¿¹tZ¿62U{)ÈfhäÍWÒ²Ùi‚þT;ÿåq˱[KsÏúZŒÉ”|‡+PR¸wŠ…Óܨq“¶<.ª>ã=‚³ Øaè\ifM2¥•I”||AÕÕ”æqQ”)Òf‘»¢­ü°õø¿v8~Ë£b­ôãA­ITkå/‘68_]¬i*.¿°`þÞTWÝ¥täðÓÝMjš€í ùüÚÈTÛËÔû!!??$ì_%³úÐì(v~ýÍ--X{ï …P㓯ø¦´v«¥Ú*Ò˜™8ºWÏžè:èuyë󯙦½hý½Ò_¨…{STM¢¦® ê½)Íã"_m3È]˜Ùgƒ¬­ÆZ›9%ç5h? êM¢ZJ_^]á=¼­—Ù0nü:_Ç…çUú§ËîRºqøén&5MÀ÷¡ü´ÔB¦ˆÇ¬×VúŒ¶qœ0qº{X¢`0öIvÔª®,å ³´=nªgô2uÇ5‚²ù•B¨š´ÈA43ßãÕh»þúú14šóÎâ¦ö]dJK“(y0±Oú4Œ‹||µÍ4"w5‚×C¬i=ä.h5 € Í~r3Ÿ¼ýOe§GºJÓãU,˜í.R\tñèí¶æÂÂÓqcLÇ®{&  #šs.Ïs°8ZÙ¬ÿc}È=ÙÁaÖ«WÏ}‡L‰9p­útAkñ^÷þ´¾#|ç¼2ð¡ #[$=ù6èÖÈH·–]ótúÀ€Nº™ÒÖ[£ f>T¡^¦´­¤±ÉT÷ø,éŠf>`îèÉT™ú€eJèÊy Ð+äÆ8X—'\¢F[$-}™Z”¾¡«ž²ÇT–ò!³ÒÙ£,û ´~ŒÅ©’ÿ?®N¦´¯$Q7‡YëcXö&={˜ Lά¦f…­Y4õžKïRl5°P$‰˜ú¨záÜÀHë¬ÑØJ]4:z†ÌkƒM¤b‹¤­/“&/&œÿâ!³®>˜ñ<¿¥1÷Á^µ?¥¬L»Õ”ÆJJü”úNI¼RVÒ\qfÍTÓ ÎÖ‘u|AlÝÈ¢©÷\z—úã»k…KÄÕç•ʸ`FJM5[©fHç1@¯ã`Mx ±‰l‘´öeÒäÅ„óÿ!¿äy}nÁpû¸kZÉ”æJ¢ºY§eK?V§ ­bÿ|­Ù _7’h<—Þ¥þ¸j`  ð‰¸ú©Œ f¤Èë¬ÑØJ}4C:zE—§G¿`5Û"iíˤñg¹ÿÅ ß”}{G0s¤•…¹¹å@³ž4óàóÏ´’)Í•Du³–x»ãGôw-窨dáêFMƒçRã;ÔW ¬Y"¦>õ*ã¢:Rä}®ù7Îê£Ðy Ð+Ú¸ãBž¢Zg*V ꢩìí>ç1@¯håò„Kl¦b‹¤­/“&™Âøÿ(-Ú‡Úÿ%ei!6´þšeJÛJJï&9-¹V^ÒR‘¾ÖÉtøüßjɺN® ¾n¤ÑÔz.½CýIºk…MÄÔ§Ve\*UGJM5ÉfÜå¢u·óXsnÆö„u§2Á3Dïhéò„K¤b‹¤¥/“FgKŒÇ”â!êïžhkã8ÙiªGä¼`+Í2¥m%¥ÏæÖE3íMzÒLGûo¸[Õñ¤O­AÖlÝÈ¢©÷\z—úc«5€"IT­Oʸ`ÝÀHë¬I¦ÔGën籦§õþèêàC‡öQ¾ ÞíP³o?¦È¼wHeÊàÕè¶lÙ2ï S9 S9J2em3þƒ|—2ï#X™úÀ5 d ÞGà¢#ÇÀ«©nù¯»°š€÷šnZM5?{p0ÆcÔB#úÙ9‡¯½Z&ù¿™ÝûÏÁA¦à}¤[VS…O¶»šš~–xüRù«Âª§'“V}Çλþ² VSh¤VSmå?øš›x¾/ûÇëm•)±6}¦ïºÓÜ)S¥•—]¬GÏI¹ß¬·š€LÀûH7¬¦j/‡X÷q=VR&—˜5rP?·ƒ/ª%2•ñ¬ôtìD«II¿?nÑõÑßÀj Þsºa5U“Æíg.ºP-ŸXø`ň>ŸmÊ™akœäû‰µëú9­zn,ȼtÛjêx©òjª¯ÛwÄjʺG¿>4ûØ“/šôÕFXMÀ{M·Ü›ú^¬toêej¬M§Ò{SŸ§í‰r´˜¾*½JoJ%d ÞGºçIߣ-ÓL$Oú*^VgŸÜ$°ê3jÎÕÊÎ'}MùûÂ,èkÏÖ4ë¾°š€÷šnúÞTSnæhî'ý è3dZèšK%Êß›jÌÝloÁÚxá•”J ȼÀoú0rà7}9°šÀÈQ]Mƒ=”>̦ހLÀû \ô`ä€L`äHejËGó™€÷ÚGù2x·@C †a^ïv€÷šÿ–H–~ endstream endobj 15 0 obj 9764 endobj 16 0 obj <> stream xœíÁ‚ ÿ¯nH@¼îÒ endstream endobj 17 0 obj 81 endobj 19 0 obj <> stream xœíXKã6 ¾çWø¼@R‰zY€a`’I½-0@Eoí¶‡¶@÷Ò¿_Š”(ÚN&™ÝÙ:8¦ESäGŠ›ƒþÞý5˜Áà]ÈáÃèía>ÿ²ûáÃðçÎƈÃú÷ó¯»qˆðúÇ.¸Q¨ß‡JysÈ…Ê‚ùv¿í>}¨r¼íRð^d@>8ymA—’@‹"£±2eë•7óiMp9u9D‰Ó_4 i©‹Q˜˜ŽHȾ° ˜«K(‹^d0%RF`ò†`>eM¯PaJäXè@, æÓr,(T˜9ÆÊ‹ê¶ò(¦û¸2Ò½•[su e±£Â”HI©±$˜OYÃË"'iû(0èÛ´ö±‡Q!˔ȰQm¿ ˜OëBË"§13e‚¼¨n+’a¡cËT“á²c”òš¨|J^nr„™©Ñv3–ói9cÉ!"‡(‘“ÌA‚dI0Ë¡¤„ÿ˜hŽ/»q%"s^~¾»À`axùôãy“9™h‚qóïŸg˜8Ïv²±Üûy×d“Éžê£À¼0ïÓ„/ k`âÄËi)¹±‹|c Ê3í¡µô&ïS Í?½|¿;¿ì>® ʈ_ôƒ rƒ5l÷vò`Ýì& …°¾\§GìyÞ<àö¾ìÌH¸Œ*}R⯋!ˆš¬†RÍjo¡ÓEƒÊzd›Õ¾öYô“ìq_GØ*×’A¼AåôÕÒËŒ¨sÜ@®¿gü}Õñ`ÞÝíøHB·Y$`Òµ-šr-0’˜†ª¹ê ȬQÁ·Ý³v/TEº?Zœ|ÑŽæQ?˜q“¾ÞÞÎtô8[´K~è¡Ì°†×C¹S|¤£Òq}8—F1F7Rûaå„õ¹DÛ1ù÷˜!—*ùîÙìi¶nqt—8<¬@Ú" ’Œççch†êÞuÞ¬ ʇ‹âqMV?¹õ,Œ„ü±Ë¼ã„1|U}»)¼ô!ºu7kRù–€.€{9 —»’Y±°3_Áº/˜ ½‡°bj…Ûí#ÀZ¿wVDªý扻‡gê–@}CB•bš\鼈l½Æ>Ò³@ ØsmÀFˆ6o»VK¤wqa­û¹²;óªU,&!¬§²µ\Ç–.q¬’—{^X%º,ÙGé×Rm§Žõ¬jß'*¬®*šúãÒ¢½By{2ª¢Éí¤´™Ðð ø 7ŽèV2 ðbð.›LÔ,+ø­zÈÀ£ØøJQ|ÒÏ›Èò¢É¸×[Tþ}n*‘ú$Íz÷;j°ëcl.½­\42¥¦´„ŠÒᑂΉ÷©¤Õç±|‹iÈ×3^ß“´€:?>K˶.Jº¹ò5ùˆN´v#ÞKtfÛÊ?„ÑkÕù‹:ÍÕyÛ»~£ò Î¥}¨Hûl·EúظJsר+éÍåVùWÆbKÈnÓ¢AqÂi¦‹îãŒMT'ߊ> stream xœÕ{{|Sež÷óœkî9I“4iHsÒôJÚ¦MÚ¦¥…„^C[J z¡mJ/´PšÞ‘*"RuEp•qW‚:^g”qw]‡qagÇYYwt¥éû{NR(Žûîçó~ÞÞ¤'ç¹_~ÏïòýýÎéÄØ–>¤B“ˆFžÍÝ#ÕÎ5å¡_ „õ=7Lˆ«ü7%Bú"\WúG6lÎô¾ûg„èCˆg7 mëþçЄ¿G(û˾î^÷ŽWÒòA=*€‚õÑa¡bäS6OÜx¿ƒùòÅ0ž0îéþè†Ú0B%A¨ŸÚÜ}ãÈ?â‹ä yq¸{sß[»Ÿ‚ùJþ‚wÃHx|¢ Î""õ#c}# Þ‡¾»¢>†2 _òQA’#yŠfXŽ—ÉJ•Z£túƒÑ”h¶$YØ’í¢#Å™š–ž‘™µÐ•“ëÎË÷x ‹|Å%‹JË/ñ––W ÿ¯?œ)Q;Ñvš}ãúZ¦нÍÚÍû¢ÿOW!‹ÝŽ£itîâÅ«Ñ.t=Šv Ð øŽÂ—|^@¯ÂE>Ç ön)u¾;à;ÿAÏ£))õzö±u^ÝÁyéA4Œö¡gÑÙ«3#ÔÂèFhõ2º€kâeQ¼f¾î&üų•?Kcß «=ˆöb:ˆÍ 6t€jC·ÑdÖ'b+¦¶¡_£g±˜pÚŒv¢£RÿÍÐ÷›Ÿû¥ºÛÐÞkEìô•H7û)PèÞx¿íózœÁOÑͱšÆ¿ÂUëŸ`§£g¢áè.¦~¨jmYݼjeS㊆åõuµË‚5ÕU•åKþ%‹ËJ•ûŠ óóܹ9Ù™éi©Î‡ÝlÐ ZZ©ËxŽeh £ì*guHŒ¤‡"Lº3Ì!yg7tÏ+ED(ª¾¾MD IÍÄë[ eÿ7Zb-W[bA,Ce9Ùb•SŒ¼QéO㶦HßSél#ŸHéåRšI—2jÈ8ÐC¬2TŠ«"Õ7 LU…*a¼SJE…³¢O‘“N)”TB*’é9…3—`)AeV-:E!™šL¡Óªº{#M-U•V‡£5'{YD㬔ªP…4d„«ˆðÒâ Y:ºK<•ýòÔݧ´>äRõ:{»×µDènè;EWMMí‰è\‘,ge$ë¦ß›aç}‘lgeUÄEF­[yužºkSâ›&8Å©ÏlÇùÉÇ×—tÇK¸4ásD’Õ@Þ©©j§X=šê>=;¹Þ) ΩS*ÕÔHP5¶@¯Ó³/ÜeTßÝBxQ|³Õ+ë" Mí-*­Zè†øó;ÅV‡®u®MãW€@ ©ÃA6~×éZ™ÈdSK,/¢õÖ§QÀíjP!Róò\q5©™œ«¹Ú=ä„Ó¬[Õ2aÒ–õ:«€ÆwuG&×?m$Gá"š/¬ç”^'–¸[¥¶"¬jYï aÓ,Ðk~àÒeJ2š/b·O¬0AºN/–8a2N•³*ÿ»aÀ ˆ9Ù‘ +vôÍ-‘@%$Ýñ3ª:•ç†Ý!8¢ÁJéø"nçHÄà,¿zždYUƒ«Z¤.ñnCE…zâ½"îªJ2³X5ªŒ-Œåljyyg/ž*­ÏxQj­$MÀWéUS-½ý{ÈÚ ’Ö/¶X‘@+p«³¥¯•0P(ë"LçfŒPÍ-u«œuMm-Åñ…Ä*ÈpLZÕ7†q¶XcÃËEdi2±…²Ò­ÐP€±Îò2øði2¸ ¸TJXµ¼LlÁV4×–É«ú*ãíHþºAYÂNÁ¹Ñ8’…q*‚VG«#öÉɦ ZŒO =d„¨Á¹*: 4”Q0ŒTDhi&wë®5 óÛo]1ÕûdEyñݵ-{Ús#Wµ·£=ª×e–ç·®Â/V5ûTxO®OÒI:ütrùêáÚŠðªBù³v¡}¿%‹‹¶ÙËWm :|9éúè]šõÔ÷SKÜé:<*´’Sý˜¾Ät¢d”*™Î EX›u1 ‡³pŠ.È®ÉÔ5ZS\)”6s)){£B04!ò_ò_Ò—]°ùá Ï¥ü<öMöëõ$SF£Ãdòz`óF M§p¼¶M…†§wËoü‡¾žG†KgêÙïò®mªÏÈ\Þ´64¶[‰?¶–´j¿óÏ{îü—jnýñðèÙiE‚MÿX½Œ~÷È•£ÙpèNÀˆïÚV¢ßÛ+ÇwИcð_üƒ‹̰ä0G-år Iá?Q¸„ob·³ÔZ/bkYªO`ªãB\…)˱œ¥•œ ÿU†?á"–ñ“%ÈÞÙÄo穵<^Ä×ò¯ÔyjjŸ:¢¦´jÌýZ®À/(°\¥Ê:%•©Ä¬Ò¨¤”¼k‘ßÝgáê ¬#ü.ÉêK»ÍnRA*Óy _ÅÒùy¨£coB‚c'ù{0úèù¯¾:}o9ýKô³ó”—JŒöãÃ3ͼŸÖ“³=50~8[;ÊCEäÜ u­GðàtSÕ¨›óÅFIÐhUVW#KNÔsÉï÷{cÇéñÀyÆ3ÃiJ4™Œ:§Î›è]BK' LN§FözŠ Ò©GJCËKU4M1Ó’d‰‹–‡Ê:o.+Û|øÖúÁ¥vʺt¨iÏΆ$×"1Åžä¢.®è€sqŽ5xï/ï¾ç¾eô»¹wweõ=¼É÷›_¼õfœ?™ØCÙEÀ–DkÇ[Ž‹ZëÀœ!¨X#ÚµBb#cJ²üÎŽØê‰,:ç1$k0ÅëLᘜŠO‡7œØYSqó3Ò}í=|x¹¨Œ½ö××ï¿°÷Îwö×Õíçηßyçí·ÏŸ'Þð à;¬È„–”OÓ¯ÐÔ>úh\ëYye¦ÍyæFó¤™Ö©k4͉Z­Ú¨ç‘€üg½À’°€&tutÀ=’Jp)¯Ò—Úk &™”&ù겦˜d–’š¦“eŸ`yo×Sûº«qq¬Å1û1u/[l¨ñ”…%+pƒæcY»ß¾ÂN%Zk v½[Oé‘ ¢^Þ8NHÒ¯0µ¨Q)ÑÌë½äÁ ʯuxãk5—[‰~:g¡Ïç5:ŒÁ„¿Òç,tÊÕ™y–%—g?ôPà 6D?ößÊp2zŠSÉY±awµ£©áWöÎìê^+=þ—Fò™›YšLŒ±± õY"|¯#‹`¡2TXEËÛ½f%pæ ¥¤Õ§g/OCR­@zàOËïuycü) !%¨\‡_cQìMÏ•«ó²š_ÍäË8†a_ ~ÁÓ ¦i|‚yayýÒï”\ùþº¾¾V¬¨X’D‹(ã`B°B%º5`“+…ù”X)+f1Ø6bdFÐ$ø¶4"t6ðŠ œ)RkÕvµ[½SÍ€sË}”9÷€ÀdR8C†)#‡"i~/Ødw±Çã.övZ»:F½ þ’¸ë¼f(—vDäÜKþ˜Ð;ÑG¢ûÏàW£m¯ázÜðb´Ú>³›ºB½0ó6åžYdzW¢gè†Ù ¬N? ¤Æø ¹/a0en`3G¡ƒn¸r‚^=s7ÙëªÙZ0œÔ`MÀhj4æDððFDJ$[4sŠ (¦LÃl»¹?ÕºlŒZÑ•<ã…?rqNKà"ìLø8¦b¬“ž²§/*òÆøœ¶l:±½¢ô†È ­G2Vw—»üpýÚ'¿zlèg+üØŒ¦³÷žw68Ó&jø¡×°éÉDZáµáì…GÄÜÑ/Â)±ÈH`ø“<xL·¡^Ž·‹Pù’$c°²ü<°×:‡ñÜ ÔbÀ—‡þ+A©ôJ§¼6®T»ÔÔvõC꪿V3ÍjìR—ªëÔ´] ǦT´±Ôë4Áþ2 ¨ -Ø9ÃÑ´ÄŽg=ðGÄÆÕqÖóŸg=]1Uípút…#¯K¤zgþ|ü8¥?~¼?‹y0«¿?ëë¬y»P¢ò@ºŒŒ 3hƒšS´á^•¼k‡µÜIŽh¢`»(ZÑ…õ×,îhLE ððA&ÔÁ”.úÅ9õ×™ŸR‰3‘M‹–=6ó%ÌhîÖÃŒ<ê x´rü–¯Ÿ—S‚\”çÉé“ܧu;LŽo£ôEšÒÒXFÓk© ÔVЦ?(å)žîbh²}?Ñê h©cnûNp›ÑAþ$ÚIG£]¬þØ1¢Éûñ E$áÅuÅ<%È1óÂ?AøI„ï@x;—#\ f~dgÝ,µ“ňXŠcYô£ËkqL8‚é.IS1âfÐZ‡ð&¨ƒ˜ÃÕO¹ÒK¡›x Úð áûûg‡÷£¯À𬓯}Æ£FZgÄŠƒ/£·U€*Q/š@ ‘ði"àìCZäþ„ì³ã¢¯}sÈ&nXî7¤äZ“Ü)CŠ;Éš›b§:´ZGazZaŠ ¤Æ(O}(áädÕD5È)Tl °±[‡½ÅIè‰ÈSÎ\|†rD ]bֆуµ1ƒõ[€jÌ«“„¤PÒd­QÔ(›-Z¦Ñ ¨´Jd$ê%.”qÛíÐ\oY@ :zÝàHÓp… l´ÂRµr]ÞsÏS?½í¶‚þ¡™sL헡ᥞñ‰u6<s;‘5tΪq®.Є (./¨J:=ûV Y­ & rU0)IµÆk15Ú®›ÚHñ&²*@þ÷%` ëv¹0Ï’ ‡f8㦠Èç+t†™Ï úh¬#&¨°×ÐFƒ‰¶¤Éå !ÕÄê¼?>mó5¬º·‘ñUm>s^ÊÞÌâ¬Ö©õ3ÂÎôå[VôðŒXÒä]·Ä¥E ôØ¥tC'ú‡€EíaWÕøôîoÄ7é£}nŸ;#hk­‘ìër` –Å ž±áˆ ßiâ-ϰÑ6[ÈÂ/…ÞQGC8PiƒëQ3ekV*)ëV”e7h1Ÿ˜X&T­H±b¨ð¬Ÿ§³ãl‰@|‰KÝÎJPbl0n×%ᬮ¤¢pV%PÌbäÁàIl˜žA(Zw>gJ>Gz:!lÌ!*Ï¡5 4ጄyxˆ¾òê‚tw×ݦlÎaÕ™³Ší‘ŽÉ¦Ô¥w¼qצ£ 3Ê׺ª\5ùVÏúûºÓVX£¤Òîà Ï›}mK#ÎzÖº¡žÞ ƒ½=™ÚQ«ssUý­…˜VXÄL³Õ¡çÜ›·ÜÝ]°°q´¦¬½|¡2aeáâÖ…zSÈÛz÷ú¥ük*-kÊ]äP ÙËéÐøHxëö‰AÚ€ š-DÁ@NZBÍ>txt­Ïïëò=ê£ή‘?j;i£lkŠÒ³²ÙA®‰áB¨FXð‹Ï%‚@}ÌáÃtÉO#¼F¼²kÔ’€G(›˜LÓþE›‡6)µ×7·f/m/I2® Ç]¾Þ»×t/è_º·¦}bqgup´q!Îi¼±)Ó™ò¸`7kMY¥©vO¾Çn/«í®¨Þ\›¾0å~›«b‰³ ×mK.« ]•t΀,Ȱ¡Ëj«` Y'­´Võ$i4 *ô Qÿ6Y×ñ'ìÓ²¿vÎõì»*îÄ_Tà‡Ø‘ÿ8'È®ÍÏ?={:¨XfÒjôÍy Ho\بU˜ÄF+A´à2€xÇ@­ÇÃÜó˜0ÃÉ“å8ž#KJ¼$‡!îtƇ´ÝÓ|$ÇÁÒ¸i©5î/0sîqî‚Ußé\‘’™î,˶ò¼ê.`t v Ÿ0‰hKœX“´z° ´`r­­Q5[Íj­~¾^ŠA²øùºˆ¬Xr[IŠÞbQ®}j{zcX¢æý.–!wýƒƒÔ3‹œ}BÔ¢¯§ ÂQna?½¢Ciƒ &P*TÃàf=¿J«¥´±¹Ý`â/{:$ƒé¥ b*ÏÀ;âÞééŸ-Î1eØtþìœÅL-Î*+R/p%/*)Žñ î…S¢QR@#°"K¡ÜÌPHYÚQlP2´‹ùP”t®y¨ `KGÖšäÕÄÌ *×äÛ «ÑB#æ@V¼×ÎtNO§]UÓ1ó—t Ç)¹ qÍMÔt³ÌT Ž_Çáá²²áÃp´e¦˜Oxôµùnàý)‹s“®žlvÜ%ÄÏþíã]¹÷tÆÀ·ß ˜ ¿M•SÛ`ÇF°,‰…¡ç±oÁâÇ þJ|¿ýĤ5è‰?¶-A¥#Ï‘§O Ë3ÂjÏ4$’—Š¥x…ë9qü‡¼Í•,s8ŒîìñBÞ8®×X$2\òÆ"—JÈpA4ñ%IÏz®)áÂX¬#¦\ ¯&‰A‹9ÍôÙÜU5§N/½ý§6Ÿ]½öŸ:Öݱ6«pý=­»w7ݲ:;µ|]ñ¦ï×®KïÞQ=ôýáb&´ìÆ–gúñþÐщ@JÎS¹žÌÚ¡ŠÊnò¡ÌÚþÅ+K’+ŠvØ‹²ÌEÝ»ã'­€½»Àšùbþ°*e©°'–†ˆ«,Úb³ñÙãaœç%LI¬l †ß’NBÁF:d£ä˜2ü<ŸŸ0¾º³˜4 ×}çµÝ ¹n—ÎÙâjÛÛ[±Ð@« %õ]¥]‡‡J—Lëï=9Y‹ß-ë f8Ê{Ê+ ®´eÃÔèà[/ÛVE±<ûJåjÚu 1ÕŸ“T:öƒcÓ;+Ž~}>kÕεÕᆅîºP^Åî°K Å1ý€â2Ð’À!k2k_ÖÑ,&YqÐð÷@N­ÈùEˆ¡9 Ïy?ð|  ÓýOï|ô~€þ£0#­€G‚z§/KÞVY@tÊÂVkš†SÂØu:\aYŠ 7ñTÊ6KÆŠpœ‰‰ü„øXÄZc—Ðß`*²Pôå+#¸³î†UÙ)þ5…]ß­êÏ\·ñ†¥¡‡†J ;n­‹~H:‚w4Ý1yk}i›_\^¶5ÕŸk-êÛß¾úð›¢d mþAì@×E¨MV%;=ÃZEfpø§ì;,õcp…Ym½P3‡-K†/8ñ/œøð¾‚E´PEò@ñƒÅTk1Î,..ÓÅ÷WàôŠ5TEÊ7XJÇÑU¦‹ÅÂJbû$B&\’D Rz ]³%|2}®‰ÙhZ2%q³Áq8n¬ Àïl~`´<³:T¼(¼¶°bÛ“ýÃ?ܲ8§~`QþZÅØçÄÊ`õ¦`jƲ~ò-“Ø´q‡sÉZoÞjê-ìÙ-··T ­­Z`¯ïºaÙºŠ‹úî[Wwc¨v}YÛæòµ»Z²¿~¼°Õït.]W\Ð Ø5eÑÍûJV¼fSAysQßFb×I„5,EáÌ6µ£Ë±ÓA l ²kÄ„&…`™‹§ÆüVɇ¹F’KÇ”«äVsµ²/r[mýî§ûð%—-JzxßþM»ŠŠ¶ü{/|øÝ½KR,‡ Zùë¿|ç§i–ÇlÉq„Áí•d£¾€ß©¨y^‰*WR{•xƒr«’R*M¨&{uîå\|>‹¹¹”6Ë,ÆSsŽ3)‰Ñ6fÚ…D­)†A<Ćz<ºéŒGd¤“…3ô\Jþ޹ꑰo÷.ë_šü\Ïàò¿•8&æò­¹7>š.KZ¶6ä9yŠ€wûž–™ÇþÎWiétWæ˜$ƒ‘°üû`ÿSPïtŠ “!–DöõÆ ¹l¼2¨´ÚÔ—Rϧ~šJ7¦bmª;uE*Í›1"®™ A7ç‚F£UCÐ9H¢ÎëõbwñY/Ù ¯qÕ“x y”áMH¦É>| ^,Å;欀ϧø_¿ÒØ,z†cMV›òÜ™hÂ¥k& ê­Æ€3¯º M[ÂÔÎ<”ÙÒ²ÒiYÓÝé z¾Îhºµ-_ÉígùÄì@ÈýoCF*T0œ×`A³OsTC[U.¥Â‡8žìK-‚]R$„玨$µ£Ãåý„DÉÀz'jhÞ ‹Äµš ·×2¥µYM²?'ÝtóöâÅ·ïÚQ8×¼ (Aƒ:Ae2à«Ó\%<™ ‘x=Ë ZÁ-P¼Z^£h§I¡ðsxü žæFš„ºIœËåòÇ#å"OJHPû°Ææ%¬Jã5{pÚ;Ñ0>þv4²ùÙgÊ÷Œ¦ÍìÇ_®Œ¶q†™¢è'°¾§^§XßÝÐc-ÖhÐðKxS·`Œ°€EÀ ‡ÕZÜe¿ÿ 3ÞD‹Æ Ñ@ >{©sÔ%Y“BxçAz¿k}wkŠ>ÉlÕoÛŽ]0ã.Ü/`Æ…¨!`NO ³ÙB6ÎHMÍpâV¢õ.k±ÄWzð•mXÆD*gq¡—l«KRpdÿ`b%¿c>F¾ê|HÂg$8@›QŽžî VÞñꤷ§}¥ÃѺ¾gኛ×äFž°úý%Æ6õôÌÇâ }«oèèàØô-Š„dÃñÄT³:­á†¦{±29SBEvp‚LI|ó=ö (`º=ʱÕ®6`Ê@/“áe`„0ÒhhÀ <žä÷ñoñ4?äž7iMv“Ût¯éQÓû&Ž9u Õ¥š †5ع(g‰[_â‚}ÏpêˆÌHÑOé‡HƒvÐN t. ., i?:óþcg(ËSTRtÃN§×Ëx½^ÇíǯFKÙ3_URñú‚²¥v{ùb¯.Ú2ËüLÂ<¾@²Ë¥Êj3Pr„loWõg»ºJMêÒ1©]|Â\ íRÜJïHxT7/X™zUçÎy+À5:­Á¿÷Üp[Ýß=¾¦k+þEK0uUKGîMgv–ûn|ñŽìeK|IÑ 43ãÕ/HP þ'ž8ŽM?Ì^ø˜.9QC‚›·ýë‘5¬LÉâgçbÎw‡©ÐP@ )¹œA!<‚#fL¨oêgc[³Só’†Ö8y%´–aZ~zöâ3 ]PNCUrŠÖ#L÷ù½^@¢º¼®9 œÓ[@tBx“)±¨ÈG¿úZ4ñ'QË«8öP§ÍµÇ‚OWºÛŸ¬­}²8g=ñª¼•0&‡Q–… aQÎq-og-10’°8ÇÇ]ÿ5éÙyöš—‘yGŸÞyÃÉñoøÔ-[#‹f’Ë7-_>Te·W -_¾©<™zïTô¯ô÷¿‚ͧNaóÙþ¾³Ñ?>}ðâuµ.:xñ@mí‹„’+£g(P2¼"5§ùL~Ù¥š¿±_Æž¼]ú½G‚¶”ÏËIÇšèÌ¥W¦ÖŽ6¿{ZÍÆª§FkS©üÿõÁ;g£ž¿lýøßÙÙöæ¥ËdôÅ0z¢4ú‚€FW^Ž@©Qó%û7Éçúml|É%püAex“i*1µn´á©ªÁÔ}÷o­ƒño¾|éͶÎ_þûÇ[ÿ‚ß<ÛñÎÿ…bñ`Î ã[Ð]„" €&jˆN-Ñ`®ÍBôìÈZ¤hÕj•\è³®°bÑŠµV,S’IP•®ÄJJÖ&ïM2c,ÈõA¬QÒ:yŽ•,þÅC¸C7ApuJ¦ü×åu'à‚Ítt8®=Vq»8ˆ/òùœ˜vF«bV°áð#ØðC3´,º”EµËüw•\9ÈNÝÂ<ñU-½µàŽÅ5˾¦`Ÿ Q_Yõ¢ò@Q¡º6´¡ð¥ÂÙB*Tˆý…xa›ÜÚ_ [Èft¥ŠŒ&$gâ)¨ ÉeŽ¡ ¢Ð¯‹Þýƒ7¯WMžŸ]š²6Ôï9ú]Û²›:Zw­Î L|¯{답KÐrÓÉÕãÍí{×¹ñžîïnô9Sž&¡›GŠ+üiÎU·7·LuyrœGl®ÑPɪŠRGj}è–X|—ý`7úéóÈ ç }èF2¹&ˆ2Dr0zHŠvR`— 2¨´¤XZssÎ)ÁĶ›±Y„{†Ül–gкœÜ8z!÷@ —\!77_ÌÏ˧´ù˜×ëˆÜ›t9v¹ËuÚ gé·Ü`¡-H„&=Pò“K1]‡/^éq³ÌQ .Âs?D)ƒ2NÏpr<J´Ä5„3ëЗŸ`T*3-§Q+-ÊãïD?|i— ×ÞÑMŠg~v\žhôC«õFåÞ¢¿§ô9žË¢%þEži3GüœÎÜÐnKZÛÝå 6Í<²®«r›ÝTðëi ¬ ÌÖeÎŽ¬h$ÐpÞö¾ Ù&mûlGmŒÝæ·­°ÑVëNá%„$ª ˆ–%Ï N² Ë"Z Ez’&Ïf9ŽÆì %a>IkhTcŠDJ.ù;;â>Áî•WrVßÜPÚ“á¶/ËÌ\”žð9}öŠŸ>[WÚtO³3QsR—·jé‘íÝôã¸VŠÿ/ ,x™}‹½ÈÒn6ÌRèA²È‹ôe И[Ò d~ÚIãÚ¬ñ,vzæ2%û¶ÂϾˆnÙò5Ä~PÃ:•’iÀ2IBÞjÞc¦Ì]€Úäœyœ5JÇs”9†ÈÜ­oKz^\Ažûº¥wVÈnÁ»„â@’Ì1fü"3Ô¡3¢Ûi†ÅrÞhIRFûp0z¥u%÷oßÒŸbÈÏÏfŽ’U’ ÏB‹§%—ÃÈ/€V ¢(RbÁ«•_8žÆ [ø¤ùñ¯d9bJ”‰£8”þFð ϳËDèf.‘›M{Nô»Xµ¡¸>$…üã?èï;1YM› ?TKáºzðípcÅr쵪ó{ÿ²5uIn,øð >ü®Élž|ØTNvºšñÂyj@[W²í™¨‘¯¬ç­8 )dNË·Éz“´¡<.À%ä-!9ÍKO͈téªÇDÑqM&Ùßt2^ß-ç<øÞxÇ+·”Í4ÜÚqW{î±GEû·.Ÿ0\²ùhtƒX3Úô½14A_M¤C›ŸG:Ð0ZÐ5:D4¡âÚ„Ü @›ðIx)á|§ tcÖ&¸V$Ð<…%8k@©ÂE,KÈcë³ßt‚b:c¾–Àxktï™sÊäd óæädâûìiØ10²XBCÄÕ™ŽiN.*áë÷§™ÑÓ‹?†„–Ç’â„$F¤™läf[@ŠÝZfå+ùg§2i†´Ô´Ê´æ4–7¥¥™x:Y4xD3©y0“cA­j&;œ½3›³ó²)m6–Ù“ÉV’M" (“ʤFÉ4Ÿ–GViÒ+ò`š`Ó# S•JîqzáÆµjG'ytó ­#PŒ>N:=4ìu jè¬W?ÐÚ, £”??Ý&ªIRª”J¥Â¢ùìLô–WßWt–ÕՀϞ(ìLOoëÙO™}Ê;äöx}î‘¢+ë ~OnÏúöô´õCá|òô¸–ZsÈuŠ“\]03fe‚ S,5AÇ|&¢I¸Tz¼9`ÄØByg4ôñ™ ¬ðøþ¯ÞKÁQO‹ ÛkäZ‹–ú0‹L© jUræUØÔ.ãÍ<Åór þHó7 ¥!µµ Nö'ß›ühòKÉï'³b2Ü6ª×¦¢ò Dׂ x›\˜Nš{ÍìÍb”ÿÂEž:c"<¢) sâŒk‘X|ë ¸+¢ùM>üw£ßûàXÛ-Mi$¬x”Z7sŒ~óíµ·u,1ÌŒRëqVm¨ öl°Cð+ØÑ8ê-ˆÉíhCÖËYø¥,<’…ÝY]Y”¡]ÑŸéìÒ2–.6a^çêÛGÿ3fG›Ž~òÐ÷?}¸¾þ‘Ëßè?Ž6}ývÁ¦Œý`“dzñØØØãCÔ{OFÿôÚÐÐk8ñ©§°ñg›6½ýî}÷»MMß}wïÔo55úÍœ7áƒ3‘¡ñ€åSç¹*(û!äq€ÇVƒ\ñäìÝ<ÏâI ¯ °•”@QˆiÛÊîa±ôŠøwž-"ÿûÃèù˜?¡'  ÷¸‹ÉãvÂù±ïÒËáÀµ¶âæŸGË-ÿ'êêwWvÍœ£Üô²ÂÓ`ÞcOƒ-s˜Ú°ôPØrÒB ¬iSöšu]\‚Jziô*5cÄÔͯ>žñé˜÷Êw¿~çäÏvWþäG'['Wfböô•ú±Ÿí[¹ü;çn¢O\ ž|¹hýMôé8Ç^‘|­DâŨá<-0«¡ë5'„xÚâô×ñê 2N¨e8:^b'W„aBÓÑ¿>½úî—'º^-¿åô–×ZE}ô|ô£Ÿt²Óë~ýËô}¦*¾Þ‹SѼ7>ä€et2ÖÒx–ÆŸ¼EÓÒ»cÅ ¡hZ©Uº•÷*O*žCm¸W!ïÒ’·Aü\˜›åH²¹€` r"ï†ÄÞÅ /ฮ¾Ò-gTOÜ[òFFìý…¹—CØéc3WŽ‘•õSµ E·IÑiµD¦`Ä)ì’*$ívöG È{N~õ uX}¯šS#0Øÿùs·Ës)ödhó˜ùBéIVb,¨á3räÌ(}š/'Ë´ ¬´ØÒ{ÀæñU¸Ó|îL©ÀÜó) îLj6Á‘mylˆU[ ×åæbþŠJD‹žG˜hm…!(X&-û,G- ­9ÌPC–¬B2XþPEÞ¯øüMìvyÝ‚ô¬ÍÚ×K#Æ·yß¿üÍÀ>~„1õü7_ç¤ ®Mw>\Ö¥-ûYbÿ‡uö°÷ê?Í^‰¸(àV0o±¸K¬¿9j›÷ÿFøÿ±TɼÎ2h;EÞÕ ¢Q!'A'˜GÐ(NPÓÈÁ^@çò<¡vö óÚAÿƒò•L ”g ôï§ÒÐýÔHOC_?êdÒP}µIy2Þ4:FéÑQ¸H~”ºúH×(é ÷\égÑ(ïB'è¶á§¿„öèi¸v1ï׳í` õô‡k1÷…´Žp» ÔcȆϣÝPŸHÆcŽ sô ƒ^Zgsc/Ã>ë :ÍnƒzØ´‡ t?Ðd!úúà·)/u3õ HÐçèß2¥L;óó+Ö̶±ØgØÿäzùbþ þ#Y­ì.ÙÙy¡¼^þŠÅŠRPþZU«zFõGu±zTý¯šJÍcšÏµ5Ú´ IÂíº|ÝÝi½R³þõG¯f #†×IÆã!ãïM>ÓÍñÓªD]À±·ßð÷À¦R.ðÕi©ÖŠk¯žiÁÕóÅ€× âi ñhIàX®nÈwCª…o·¡1©Õ”ŠèI¸<(¾>” éh†Ú!è-¢ HAòÛ-FÃ(æƒÔ 4þ*¨Fãh%ôØ€¶@Ïn¨] %=P2 mú /¢¸¾­ß·•­‘úŒÇçQ>ÌIÖ(¢õ0à ÌÑ+•棂yý¿mÄAÈ‹Òî'¤=Õl–V¸ ʨÿïöÜ-­Y”Zm“f$¥cÒîÈhÒÚúâ£Kt%%„ƱüFXã˜Ô¶~{®Òmvñ÷tùvUæïfæØ,•ÇÖ$Âï\«qiäAio°‡È÷Cm´2ï¸ÄÃñ]ôKs‹0âx|Md±}ÎõŸG™>‰R=EÃÒ zâܵ¾[â%óù…ðÚ¬chg7Ú*}s¡Åõ´è‰S"7>–ûÿºßÜ®¯ßë˜tdÌͰƒzi•}ÍbtØ2ïT& ¡ÖR‡P –»¾‘—orªGâT·Gh¶(ø-Ÿ€ ÿ’žµßû×GÿJíü/ú üê?\ÿ¡ªß÷¾·ú·³ÿ¶:ï=ü¦Wÿý•=ï~ùÓ—©+Óf{Þs8ôÜäsÒ›¿ÅÏiª?<…í'Ý'ý'é'»N†OÒ“Pz¼Él·é:B]|Ó®ÃØ~ï;|ô05~x×aŠ==û§€å°\Y}òÐK‡(ÚuÛâGžÿ}+î£÷©´ÕîýøÑýxÏf{àæÆ›)Z˜'ò&hj6a<ÆO†ñ¡0ÞÞ¦êÂX1Œg‡ñ“ÃøÐ0®Æ\6¯¶$ÌÚyfÖÎÁÞý°}ƒ{ƒÃì&Ðߨ´?ÒÏøû°¶ïdÅí½Øûß½œ¢º»ËeuÕØ»SìmÇ·ãæöÛÛ©eí¸´ÿ­ Ú†7µáº6\Ú†¹¯~5 ¤c¼ôj; ÞOŸ¤iíZûZ÷Z Ó?³Fo¬&„5¼²šä›¥üËÍÍœ²ze£Ëîo\ÑØÕHÄŸñž î â5A¼(ˆ¿ªÁŸÖà=5¸´s ¬³v“׸Z‡µ«¯v5…Ñj\ƒVý•Ëþ•Uo×j±]{^Kiµ³ZŠ £è$ú1“&ÌâÓxß©æU.WÝi~ve]„klà;#i«Èo ©-ÂÝA«ÛÚ[NaüÖÝ÷܃ÊmuϪ–HÈÖZé…D€$&!!ØN™PyëøxçøÄWüƒ»Æ¯~и “².HM|³Žä¡úŽO k]'¤ê è1.Òsœ4„> endobj 25 0 obj <> stream xœ]ÔËŽ›@Ð=_Ár²AWA3#Y–<öXò"Å“ÀÐvb@/ü÷áÖí$R¶.MWõáÑdÛÃîÐwsömšc˜Ós×·S¸ ÷© é)\º>q’¶]3Ç#ûo®õ˜dKíñq›ÃõП‡Õ*ɾ/çnóôHŸ6íp Ÿ’ìëÔ†©ë/éÓíq9>ÞÇñW¸†~Nód½NÛp^ú|®Ç/õ5dVõ|h—ÓÝüx^JþMøxŒ!;v¤4CncÝ„©î/!Yåù:]í÷ë$ôíç|Å’Ó¹ùYOËT·LÍs)ÖKæY-û¹°\½ —Ì6Çsι⸠¿0[ÏWËÅ;òÆri}Þ˜­vË9мcÞ"¿3¿"ï™áq9kÑßѯ;äèÇZŽ~AG¿·qú½CŽþ 9úapô{8ý×åè¯Ì@¿‡ÍÑïavô{³Ñ/f£_Ñ_èWýdúk ý ƒD¿ÕF?z ý B¿À Ñÿ†L¿âz…~…_è/l<ÞÜ¡¿4ýŠg-ô ¶7±+»>üýnŒÃˆ*ûýR1 endstream endobj 26 0 obj <> endobj 27 0 obj <> stream xœÝ¼ xTÇ•0Z§î½½/·wµZ­î¦okkI-ÔHµ.BKƒX°,ÔI ³HHŒÅ€±ÁŒI‚‰±›ø'Ž;ãf 8”ùíL<‰còB<ãq3’Ì<›˜ñ??cZÿ©Û-'™ù¾÷¿ï{ß÷Zº·¶S§ªN:KUun 2A8"¯ÝÔ7²jsßrBÈO ëÚmãþ©FÙñK„PçàȺMEÑwþ@÷ !jaÝÆƒ“¿=ƒ=V‘­èëï½ÿ¢„´ÃŒYë1ãþô5¦…iiý¦ñ{ÿ^ô½BÈ"L’‹‡×öþèÛßÄôELoÜÔwïÈT'xB˘öoîÛ4°dà¹C˜N¢Y42<6ÞO¤)B:^bå#£#ìúšÓØ_:Žy€ìcÀ¨Š¥)Ç *µF«ÓŒ&³h±Úì§+ÇëÉóæûüA)TPXT\.-+T̬ŒV‘ÿ?}„ÄAâB=1“å}LJ{‰¸Y8õÁïô¢©Oÿßì…&ö‚û¬md•ëÇ^-èò§„$ Öº½r «²OT¦3Á6P`±úkƒˆ†ái6'³ÿÛÖç Yi*ÎL}{gJnˆܗ£æ¬Ñ—Ä)jR¦/ ޤìÁÆ›óɺÕ<´¢S©’­–²ÏO‘äÚl­T¤¹‰µìoÞ—lÊtá .ëÁ #î77å† n8nhÀê;Ýœß ;éyD;å’nXê† V¾þ¡q#ÜËn^d5ßD„Snþ û¨›îtC’A6¸é%†oº³‚_©¿ûû¦ÒÔcn¸ÕãL.v¸³ñðnÙMå½>7`·ßcÃH¹i/KU¸iöùÒtFÇÜ\K\r_usÌ ¬¡rD0©PcÄ=ᦾÌÀqÂ0aH& ¼öjÓž×¾©åµŽ.j$ZÐjí\RÇ9h/±’†+•øôD!rã§=âO{²Ÿ-ì3ª|VßLÿiÎÍTÏÍòÕ·`|f¦Õ³-Á*3‘C‚…å\,.Ôý2ºëdÈ3ŸºÉcm]=Z{Í}@¾£¾”oÒÇÄõ1º•UÄ•0Ç£„²hã 3Ÿ›ðšíî„Ë‘á.$O˜Q¦—±†ø«0RgôÆEd+3+e‚3ÊiuUŒ2òp·èq¿%¿Èé,Ì·Xò ΢|‹îi÷Ñ=æß»=¡®/cƒÇÅ]Æø¤}êú î5RM¾!K +÷UÒ/8uÐ9Î…Îûœûœ¼uDCQnnî¢Ü/ä>šËÓ³Sÿ$»´Æx~ŽÖÉ¢# ÙZÈlÿl˜Í†U‘ˆ/Ý;ûåÙ\YKž^Ÿg+Jª‚¦ZPÅ„P¥oÒÓs~=èõ‚“4àz꯰@¼b­­…H4"^é o}% #G„{[#ÓÃ/¬Žºò!Z9«ºª\•¡…ÓåÀ…¸jö|ýEaûžÕ‘î%sŒe3}k{Jšî꾫©¤|ÅXsÓƒs#%¹]Ñe%Íww6—€¦a¨­Xo…ßïÊ+ZÖQ9¯Ô›_0·k¾Üß´ÞØäÊI4•×çû‹å»¿,œú€û=®­\RL¾ Wm+¢Oh@«yDCŸæá4Vlu…IZñ‘ÃáÉ0ç'•f¤Ê —Ç=ñ¥®D®Ã–p’„N ¢&]Æ9Ù’_güÀL϶XCàR„û„Lô[²(çê9­°çcÖ¬Ù…"ô¥»V¥wFïyn8:VM)À3Ð4žþ$í 5%ëæÞ*Ùݳ³%8þeë+»š z=ÒÜ|-§ìÓsî2xcèàªB—H¯Ñ¾…c_‚c?‰ü¢'>ò¨8 h8ÔZ\\“Óª²¶Q-ÖÛ£Å1°Ç@ƒO.ÇàÿˆÁ騫1ú\ ÅàÁŒÇ`M Ú€3V€5øbðjìbìrŒ;ƒc1˜[DD‡c‚g ø\‹Á[±ßÅè«18;£»c°-«bPkŠÑ‚X°œiîbŒ{^ið¡ŒÆ ?‰4Æ@Š!ãf@ò71¸ƒÅ †ž†ìzùd|ylMŒ6±. ¨ÒCª”MûVü¹ØÉ½åÊ,¾LŸ`ýû8Æ‹±p‡c°›lSðÄfÅ(Ycò»Ìxér(FÙx·Å¸é?f½º£?RˆqX!ë>¢©`-ÙcRŒ[5 5ŽÍQ™å³¾pˆþ¤b“1ÚÛ;ã™^6Å8qš’XàÅT:YÛ£þ jZ£`MÆŽÆ(Α̦‡(wÂA]Ž]‹ñlòÆ•6«bàQpât,|Èz5t9Ä×c3ÄÆšƒ®G8öL†Ð”ÁHh"t0Ä…²î‡TÆÜÜÖ TI”i&?F. FRi|þDМ+ê} “×á&Äžaý?ï€ôÞé‚„ÙÂðßyMy‹ÛÛo÷9ÇLMòÍgŠ}C$®ö»üTô—Ê¥@J'Ji­Xz°”Ê¥IL,M•N–^*Uû•äd)Ÿ«o}¯ßÛ†vu‰)ræêtÂ2¯hI ¿Ïh¦ÈwfI!0C ddk´+ÃÌ®dÖeÖ4V[JñSNÇ´ƒEӡ澺œÙ³*­%£û¾pcÿ#Aʾ´dòªßÜR±6ÙUW÷¯ ñZƒæ†K£ù'¾<§,²Í¬®Î †ÿýƒíçŠë­n³"Š‘™ž@™C6œâu ¸‘­9nóÁ0ìDÌ m%&Ñä7Mš.˜.™T“/·7—ʹ°Ò6h£6.‡*^3JJsDsÂjÖš†i¯™±ÇëÑØ2aë8Òƒ,‚cF¯ðÎ¥Ët}"<'O–ëœßH7¢x·j]‰ž‰{-½Yc´ên4N¯Ó­¶™¥ùØ÷ìûqá9€—e£VåV«8 Îê ëÑêO®Ç÷¡*Øìr»ƒƒ—ƒ×‚üHì˜ÕŽ™<{O+*}Ф?½„WPN©ËʹcÓu3ð,*(MèR§âJµ§•¤á‰§âOa<¸;H•Œ™ˆ¿Vmwóµ ¼†GÉ )fn`‡‚œRëàÀúxÛ4ì‹ÁW‚ôPÂÁniR–ó“ ÇâlãAaÎõ œÆ>Ò£A‚lÀã :•J‚àVÁ‰àÁ`*x)x5¨ƒ~LNù£1¯•#}¿‰¯ ä>ÉMpn³5¡í5ɤ’ÙP‚ŒD«Ä™dŒÜ;m"d†ðm»haÅTÜÂi%‡‰[°zöç6L¨ù˜¢vFÜT)W©œ¨¤µITŽT¬¼PyµRÈD¸¥•vòy­ ]` ä%ò=å ›³¤p¯I‚3O;KW²Ôaʬgz™+ ?kbÙ²ŒÎ䢲¤ ó9/(CÎUvý?±4ÔQÛ¸° óÑ5Ѫõ_Šn‰²Õx,-o§ý3æ­®«ØTP2Ý}/‡®Ól«×aˆÝÿmcçvµèõ_ O›Î‰Dr¸%ƒ»K,â ‹Fû[ï(yvCÀ9¿KwnŸŽë"÷Ú¡ÐÐn€£œŠwòT‹ŽÏ¥S(ÏTÙÐ:…«\ËT‰„,mZ]«ÕQX®ÑjZ9jç8JA«…|Ðj´ÄµZN§'ôí¸DDjò»ñdœˆÐÊâ²¥¨%~I„Óâ«âE‘;*‚’[íE¿X!r¼ǰNˆ@“âˆH5Ñè8.a̲퀖þQ Z lÓ*ŠœÖÀ¬h@UÌgfñ2V†œk©­„™NÞ›#†÷†_Í3+Øö(V´‚L;ÔZ%àžOï]˜~ g+¨‡»¹{>{»’çÆvºCFÛBBxv7à wÉâ.õWÕt©¹×L—’^B­g§þí”Ö·0¢Áˆ±Èd‰×Ú Ý®NߦïÖs-ô«ÇÕ‡Ôœ¬N¨)¯®RÓ~ jµÆd2šUf“–»F£6©Õ"¼¬:¯zSÅ©TÆa ˆ¿¦BÙўÓxdOÒCz€xüOx&=—<ªzÑ“òPÑSIÏÏUŠ`tÄsó'1Cía–ܪž¸.îȄյJ(ÛÂ3ãf"¶&@¢Ãïà4e»Ìêˆ;œ 7ÑEΑ0“šçô6‡ 2k£²!juÕfÝš°báU†•½ÔQe»è &*Q5D­µ–è^1ÆÉÞ«™ÔLâ¤L».á0Qæ%;+™%s»é× _Z‹¶¦¯Aç`zçÊtúþþôÎíûa&¼ÏzÊÊ\é?Üøƒ 5<¾7ýÑmûÌ@èÔÂpMØá]YÜ@ú‹Ëâ÷ˆ÷‰OŠœçMváTµ Ý]#Œ  ÜsÂIáïN8;uAÞŠ°„¯ ôá>v ÀØÁM‹éºŠòNS©Å´ÒÄ«tN]Žsª Ôe˜Y;fÑn6‹¸vLfSvíàóßf0Ú F,× úV•Á®RÞ`2r̳Ì`f\¤Ã^©Í.3ÕÎN=™·€²Þ²`܆Åô ò*エT§j œÙÌ8•Hœ’³ÉÙîäD'ðN8í¼æ¤GÐäwîvròNœÐîìÇÄ1'OœPÛPœì:á„ èï0Þ(.³PŽx|ñóNqN8:¹^'ø '*QEUFÎDô"R aÕ˜ò³À¶Ù\Qe‘F¢Q4"+3sœÝ]¿y&ƒ“Å…ë5Y­X”aE¡X¢ÑÌfé^Ü›sÛ:¾µœ3ŒÓ«Ø¢¸þÑûÅU­Ÿ^؈z”˜°2ýÚ’ûíÂô+Ãpþé÷þµý7¿|Ùú¦oÊ®ñ=tàÆ×è—²ëœÙL"®s-Ù+ ­a‚C…9Ýd¹Ÿ\)Bưë´vƒÁ!Àr¬Òjì&“àX˜ ¹¹vÄkDÄOì„êˆ×+÷õÇy¯ÝK%o•·ÉÛïÝí=æ}Õ{Ñ{Ù«eùf²¬Ó˜yÙ{Í««e¹UÞqï!%W]…¯‹XÀ{±½8 å*³+žð½²—ÚÖ0ÛGM ¢Áoà4›#—3%TF×¹D3Ôœ!ÁépR” ›¬„Ëz{[˜âAŸ_‘oañ§LíXkkÙƒ…LÄÝâT÷²“-âÞÉÉÌÃ$ßMù—QJlm„™KEz2S­ÏH@í43+p;6§W>ðvúKé¿ÙÕé«Ãpüï\ø,ߘþ¤Ñ2§O`(ÂðeÆØé@ÄБ>Îxd úG)a™KR§Bƒ„Mñ:Da?ê«G­ c¡€dÝœ¶9tŽç¡j¨ö÷z†=t§ÿ1?-õøýžRNëÞFB[,Fb2Û'c›i—b¼_[^2§ãËË«IX Óp84V©Ç„Ý„Žšu€~“ûæÉÓ -l¥e’è×=WP 8`¥=–ÚžŒ»‰”¬9ÅE]ùÛUa^fªgDzþ¦‰²c[e[Š™^ê|àRòŽ[Ö~¯MßXf3¿5¿g{snéâuu=¶e£gNÏüüúš k°1ز¨}æ/Þ™^tæ%ØÔýØÚªä~}qmùб¦%뼜f¹V5ñà¼>Ù¯5ÛtÇ€jE½ú¹6µ×êßBÚîúWØA~Il¤Pv“ÃDD'ê®ê¸l Ñ™Ÿl$»2ÊÖôça‡Í_æÎ-õÛlþÒ\w™ßv·»4`³JÝ,…ÌþíÄ9üŸ8‡dyIn{P»]²·Ûûíãv¡*¯?o<«®~¼šòœ²Ç#…v‡xMé0y—§ŒâÆf{»[Cjä*×$kŽÖ\ªá}•ú³SWåRƒ9^¡“uTçC…=þÐ ˜1£0wÌLì¢Ýoçìv³ºpìavÀ¦±§çæé!Û_Çi 3XüYOe$¼åÖn™>D¯UqzÇ€S|b–F(ÓZÀŒd{>åþgõú#ý›¿½½aÅþ3kÚžŒ5­¨L\­[–Gøø‹íí{WW¦×ȳ\ëFš_èkZG×?72gå‹dêøPOØÍ¿D'ÔMû.(¨ˆ$¿’®-éØÙ~ì+¹9}diFnv¥Ñõ(ë]¤YÎ)t@¥½ÑNï5ýz¨šZ(€M­XG:S\M>zÌF׌ÑJ4ÒРøü? £×;}–Ï»å43LeßÇ£q•-ÜØöÐk»dy×kmÙÂòíßzöñ][Âí­ßzòþöoÁóÏÏ·¶Ï;÷îǨO:Ó-ÜÛ¨fªH+Yd׎fX9sp&éG;=>³sæú™Ïäg²ni1‡æ`‡*™goÒˆq©³ Y–‘-ð•3û†¸¯e¸¿!Ô­3*ËUAžtÄC3d·7b¯¡¡œ½([ªå\o¼ºº-ŽšïŠ\Ö’îön»¡ªüÝÐÍÚ¶®JÆ'ºa¼’ÝpºûÕnªd{·Çvß |÷îîcÝÜ1,»Ø}¹›gå§æÅãJX]Ÿ Ã%”mùøÍ¨¿»"‹¯Üœ¯-ðVä@Ž*XáK¸DÜ[£7Ç}ñHœ;ª‡¸>®ŸŸH”ˆó¶¼ìÎl­"EÞ¨™HaûXW*Ã=½ÌSg$·b60/vTÙ¬A=„¯ô(5ÑD½‚Ÿño8ó!L…Ùüª˜Bù ÜÚ¸akxv9W=»`z5»f»˜ Bv°°ÌV0(Gç7H¹Á¿;S¼"¯‹Ïç_­Þ>ùè†Ã«KÜe1É)É{晪¾¿êÊ›-оÜ?#PÜÒš>äºM®Ú5 »v­,NŸÚÔíˆ,š5{ñL§³bÝõÜóZÕ.KþîñyôÕcË+u³«rUž’Ù3N.|{éŽeÅ*µ–,ûì{µ²5RUí–êJr‚ +ií;zææçÏíihèmð±µ±Ó$ GöÉhOTÐ$Œ »…cÂiA8„"@Ù4^ÙŸÐÖ vR¸*PY&ãyòTW€ôÁÂøN½Ósð}Efµg¯² þlf… Ü"j‡ÃGŽ(~þBôóßáÞ&nRBvÉ]zó~óSfn xk1Íå@o½ 4’›¨! n¥·vò¥ÙÇ;ZÊßÚÁ‹ßkyØB—ZÀR”§¨—$ß2““ª‚'{·ˆͰ~õ\¹éØ£VŸ>òGñÞ”ž5Ûʉwf{¦·ù3‡þ\YËúô–/ñª²=]¯}¿jè£Û«Óá`c_,§fv¥µdst÷÷ö§ßcÞ;w•+®0vîKÍ}:4øåž0ÛÖ£WØ©?£Cíºw„zô®}ä›ò›/OÅ[ÕÇ5¢Ñ å5–ãVW®Ýî8oÏ÷ <ï8îl°‚ÆÊ;¼UÃëˆ9giÍ‘Ñ—È ˜t*ªû¶>Ï£÷åš¾mvÙÌf=˜Í Ñ›õfÎaá4œ•3Z;làÈÑÑ›Ëèp‹? ÷Tft4“û¶Fîx¡IãpA{‚ÕQ|¶(Çž¨#ȼ“þlÉú%éX<´ä¥É9Ÿ‚aÑú6¨^´~ѱ3µé5P]›þ 5 ¦»àyö Bt|-=Äžué7 š‘Û§‘.{„8Ñ¡ R"š0ŒR†«žl–Eä5AÂQ!%A=¡SaŒËQf;÷ E çâT£pZC¡:¥c`½[ú?`oUÂS]íá[úª­´×ˆz"¡è‰Åru³ÍÙíäêÄ6±[äš].ºÐÜe¦œ‘ ×'¶\æ²Ë^£1’QŒåo(ê‚ ç‚>Œ­:&0™PXO­;5AcÛÆ…e.­y÷–=?b*ãGéEíá-»ö[í_üøÝsóÚ[ŸÿçôoÿöoÓ—ßù–Ò77ê‹OÐöŸÁ=|Žx2»9¹ËÞwæäPʃ†gÞl¹ÞG÷ÔÂ9.o~~ÆKõæÛ½Þ|',Ïóæµºœv— ½?ò½ É”Ö÷z]ùZô‹h1‘Ñœ&Ò*iHÚ!qm¸¥b©Vâô|ò¾t]¢G¤¿–^—¸ý¬”Ë%ù÷ÿgü} ÎIð¢;¤G$Ú-mh½´X¢),Ñ·¤ßIKÜ_Kð”$¸_†ž:%@¬?¾.ÁVýu‰¾˜)yDiX+Áÿ-b~[‚ŸLãß–­–ê¤6‰sKðâV:Eï—öKTËJŸÀŠïHïKôu N³J‡¥ç%n³Ðœ’$‰ª²õ°O‡å=ŒK»%ºR”(•à# .J—%zFú‘Da…’­”%:]}½Rÿ¤ôw=&ÁW²(%h— E«4Cª”8^‚k¬©ßIô´ôªDŸW@wK°\Z#J\•ÔÄèP Q‰Ò'šãñIpL:-Ñi” ’*p¬ó€m×|ÌzJ㻥CÒ1‰•àfÛ•8)¬ Rm¨(®4.1IÝJ8!‚»vA:"MH¥”4) fi©D5~C…A6pCqù]Tv%\IG\¢‹j]õ^Ð{ÁZáôRâõ{+¼ÜÅýš!Ï ^hövx¼{¼<8½\äås®„ßm—TyÌÙRü-‹+Úöô¶  ÊÌlÿhú¸<¼%ÜûgÏ·Ã[þÂùöW?ÿô¾è­üÕwBgìƒì!ùÏÂyq¯âͱ³sÅ›ÓBæHŒ]™s2õз»rÜáô—ýËÖ7çΘáˆ|³Ã-uÎÜô“I8}(ýñWa5wÏgÝË]WG•𓤫 yumœQv+†éW• ¶ö·+>]=)%;ä™{(˜™§Ò€À9¸Çi Šr‡·  T('år9•Ë“åGË/•óE#A›/V0Íðâ(Ü&©cº󄙢Z0›u·ùjÌOc—…Þº’ñÔ0¹'”9üs3僖€#€Žüvä¥ñºÚm§v¬þëEÌ%‹Î•—Ì`M]—7I_¸qÒZ6»™ËVy ÷ÉÍsάYyï‚%ãK E =r$ÝÎkÔ™¾','F }ßñ‰hz˜S^ÌJÇ ƒZDŒm7ÀÜ«‚혆Iå •ƒÉàÑॠŸ3,kjŽj8mL¯öŽ1·&{ó óJÆ®g>(0áœH­ÑJ+÷'Wݪ7>¿…]v»ø«³îºµ öÎr8fõ.\°¶ÎM½þìD7ôC;,†¾ôÿH¿|ð7O-[öÔoüí³ÏþV™Ë…8¨58—zòy6é² ZYÇP©£ÍuHàŒÂˆqÂxÐÈ5ÛýFN4ú”7Â%ãU#=m|ÕxÑÈ•Ý3ý'廚Ä“FVI©B+ŒÀíFÉÈÕñÆ*c"7îV*^6j//)eH+Œ cÒxÔ˜2N5JpÁÈëU½Ž½ÜôulPNñWg¶ö2 (òùí*‡μtãß^z‰æ¼”ѨÏäVWçfx·Ž¾Ç›KþE^ÈnÚW9‡!d¨6pnG³£ÃA9‡Ëz=(è×îÎ;”Ç%ó )¯=^΃ yÐŽÙ§ó^Íãå<òªòh*ò_"Ö'ybž?ÇŠõŽåqJ~Ýì9ñÉ<`pvèJ¨.©¨ªµ“$ínp»#ö^û0ótU¶¤–À`P÷j9PõòÙaßôw3‡þ‘åR‚…oÛÚ\Ýc©D{цb<·¶²§¯–fG1 /¼wã‡Ï¾Äý¡Ñïï^Ýîzöûêë}´ëÆÇÓôJŸ›WqpãçGÓýÏ!ß?7õ¯ðUî‡l¯<÷ݪâ¦âöbN¹ýhœß'Åb1{±X晉ÊùeñKÅpºøÕâ‹Å\E1Z(ê/æŽ§Š©b5Šq;9œÏvk긔tŒ¡qBU§'þ,ÛÙÎýTPÌnid65Ø6ͨâemQÜ¬Ñ Aþt£Ãòù¯Úü¥·6>2áéÏo„Ð_Ü*U 2ü´’»<ÈO?Gv•õúTü¢pY¸&p§¸+¨í>ú8¾RDqˆ©S|¨ø'§~ÿ~ÆOÑýæ·ñ~Vf€¿û«÷â*Þañ3oýs<“=yêç¿Ì@~òf\Ù$˜‘?5ùjÍ+çã㼕u‘V|ç\üUžÎݦ!f -eë›"þÿQ‹pòSÏÄùñ'â¿>è°C ZÁ-œ^øAÞù`±="þZà¶eñêÖ 0¼g2­ŸYÙÌöpYG¦#¦¶¥q 3ÁŠ~Y¦u JÑ™Ysâ²x U¿„ÎG•ê>)SÝíöÆÍÂËÂyÓÀ‘ ¾ó#RäŽ4¼¡0>Îp˜±>¾³»˜•Ét7zÚ7Õ)2E˜‡3gÆì¼‡Û…Ññ‹rÁ•¯Å õi¢·"œE»ÞL¬äßå¸ ]6“Y4k­`5T°Ü ºÔ*»Z„[ŽI^°£€ôˆ ú –¸(òϪA9^‹ªSÛív¸l;UEgœ…²9\¿`š´_°_Å¥ÎÊü’Rv*7?S Úâ½v˜Å£Ä4%­fì†ôhïS¨xƒš7÷ê€9KÊͦhtu"˜†TF׃TAWü); Pl†-w âä$ô° a`KD9îŠf6}¹\ÞH·>¯ÿÞ9~ãõÓ{n\Ý û¿¨f2á“ë&`Wú~ý­L¶O} Œ)ߥ($åÅ«BC!º20 *ÏJÏ ‡ÓºV¹†\œN :# àptÝ$\ùìuƒ¿X.¦¤»ÂŽž¾Ùî³G0BoÐfîuóÓ±ç »å–¹ØrÛýïŒœÞØPg¶÷ò!ãÍ([~*|éÁ_ZWR²Ž…ƒ%?¿ëùkÏùÏã]]ÇÿóÈ‘ŽwÑ£þæè]wýÍ£û/}½½ýë—öŸúB"ñB:}òdúúñ+Žƒ€ã¬›úLØŠk\$ä^¹}«¶Ú@oò˜6˜¸nGk¹ÕsŽj=´øOÀDº‰\Î"R rø‹`¤èhÑ¥"NÝ•@+€¥^U²€ ö’&çq¼Y`4;bv¯¡gúœŸå£Ï:PÉçš?À3¡EÈóÇ–ù§=§ó[¶I;¿3>ûÆ'ßãÖµOßx¹vïƒ[ _B•øÂ¡|´éúý”rÐöø¯¹â–g>ûî±ôßt!Á2‚×YÝÔ§üG8^ñ¢¾¼"ç>Ia¿î)}R„û<ûm{˜Ų0êÕÕì«H™+fÓdfD¶e¢Nåû'HóŒ&ÍÚê|.k~¹—|¡ëÍwzîkõ”õºZ^^]ýà2é³$ùÀïV/œ{×5Õu_üÑ£#¿^Í}R×YçM …­ý7^mœ¸ñS”qP²xsúï3ó^¾uAÃú¥ÕFmÕŠÑ–»¾¼®V•µ_„'pnlä¨ÉQwªél5Xa¹Z£î²Yí6«Úv·rFjP9ˆ9Ï~u\r°ë?–k5bܪÑÞ0IÐ84Í+ gîµR §5õþÒ»l(¦l#6ºÌóm²UÛ¨Mm°*× 2§Ÿìø¹L½C¤2|“goTîU E3·%x›ü®ÓðúK}Ÿ½v:=û¥—à0=Éÿg×­ü™ëONŸùÝŠî†ðÛ‡‚/Ë<°ÔvXh‡„ªŒ°@uNEa0Æ£ ¡‡j}³ž&tÀS;Û­@ñ¬±u.R×hp¨Ô¹‚I°Ù¡#ÆÕ&XŽIÁd“–; Ž®\µ=K6ØîG"ÙìFŠWçö:ÀÃî3€Ááõy{½Ôìmð.õîô¾ìýЫzÏ;żTÙ;âMyù:Ù ~ï„÷ —#Þ$æE'ö‚÷’Wm8¤>¦¦ê³SË’Ù_ÁxœBžÁdãÔ½•ÝÈs¢–#Ž\NèÍQ6Ñn;5´@4Â{2—Ù–çO™(a;iì^Ćá ð–&½ù!Ù0tûYáç®P@ýóé…‡àÇéû¿F‹ƒf?ß=”Þ oçÈ å äp!ÛoP.ɰË2r!FD± L.ƒÜî AF“Œ¬Ž^aêVÇøz 30£‘Ì1“rØ’ýÆŽr\Ú#ÌÊ¡ºÊ:KR6ÝmŸÿºND9Ç©Ž¥§NÜÝsèóÍ÷ ÷GTù-ç’[¿ûÅù_85ÛÒ·874OU²ñ¾‡ìwÿÍõgNƒæÛíZ“U—~çoÂùËW¾ýÄ¿<¾PÌ Ùœ~Íà²ênù/ë]tIÖ j‡šj9ÕÊÌÌ *«ÓZ`m±®´ZU׬ð;+\´Â u›õyëë¬B»X9}Ë J¥ÚyÍqVL›¬íVZið[Ánb…Z»µÊÚo=d½h½l½fUc±‚lMXG¬œ•™.¡¢¸æz•Pγ¹â´+a¸d 0öš9C¯.Á.qI•dåF[Ï•[ß|¼u£BqdÂloM;P[•³f³­ÜŒô ÛßÍÏäÇæY¯ÿë\A“{}½I®ôάòºI£F2!¯¼/e’n«†ëU «vª8«ÊªrùÐ%OG\0»ºp pãgÒ\ö›Ýlæ]É@~>ô¬¦$OØ ¤½à®!ÿבßÊÏÙ}’¯ÊÇém†: ¹ºªÜ*º;•ƒ£¼ºœÎ+>ÇžC5Å6ÐYÑÍ5]#¢æ|_>óó ]3ëI=Ô\B=‹êöB=­¨—1àŠºØ £Â!;^ã,‚ö"ØU ÛJ¡½´¿”†JÁY ˆ°P¼O¤±´ˆÏU÷Θe öæø|¹üÍkŸå°ë¦XQ.9DÄiã ˌң\sœ¶€”뎷íõ¨þÜ7æT7/65­¸»tÑÈ©~í÷|qmýÜñ¿Þ¸ödÛ¼`éDbᆖõkwîÙ¹¶¾vìÛ[c÷ÞÓ€¡ïä„¶âøš9ñÕóÊÊkVîìY²sUE®%ýïÇü%þÙmáy+ëK#uÝ»’=‡7Ôì¹ÆìwÓ¯ÁNò â"õ§µO¯)¾L@c‰ Ý„$ûfœêë ÃÚÚÇ´œ–)Ø g#(‰{®]4G^ ßȞЫ«•|öÛ°3°`|Ew‡=?˜ooªÎ«*Ì™Y7¼zQÎboûl«Ûfu‡òfÕ:Šë•»˜,ïÛWÎzÍsÿH|™ßSzóÀŒ¿šþÍ”¬-*·ða?¶D³™XOH7“»nþn|î—‡ªé¤‰ÿWâ ±ÓZ漤UÇôB|–pÈ =*Vv€$0A8;Æã<;V:NŠñiÀx€ÏÔ+þžP„)ƸŸ5ˆo/†ו eñ³vOcºCôÈvÖ&¦òc¤q<[ÈJÄgǧŸ:a%>¯Ÿ^90:Æ3Ë+f—WÝ*ý<ðÓìýº¡±ñQÌÚìï(_QîOôl÷÷mî÷·ß¬¸tpph퀒¹v`t¼‡Ç×cWïÙ::4Ö?´–µ6V~só‡GG†³]Ø6à_Ü7>>06¼yýøøÈœHdûöíå}Yàµ[¾vxSä¿*ß12Ð?06´n3޼|ýø¦‹°C›Ç°ã[•±7·S­ex3NÎÆ L©l`ÀÏÐ!þÁ~ìÚÈèð=kǡG×E¶mŠdð m^¹…†aɶó¿W›Ì'øwQ2DÖ‘õdœøIYKŠ1¬$ø7cËÉéÇ0Nú¢c Èf„*Çû…¶ÞÂ0¦¤0Àp›R—A.ÂZ¤±Í#í_Š2˵|>ã݇°d†£dæ “Áÿ²ýEXÒ+BøÍXºBɺ¬æ:²{È0ÎöÖbÎf¥•Q„,Súõ_ãøïÊW*±±›%3±_Œnå¤êÏÖýï0ÿïQ$Cûu –qwrHÁÝ+¨„R“Ñb\im³ÕþgZ\Š-b}F¹[kÜã˜Î`Æøú,UïAŠ*=èWêMm [þÓ9`<8Š\8ü9*±ÞmSÚ\¬ä+<ÅÊÖ+©2µNõû+G˜;1¯Íâ-Wb›òÿi½q\!# ”y^‡°™9/WpnBþZ”¥Ðf…ï…¶Þ6Æ mþ¯µ(afål¼›Y²ºÓ½ËöPi'Cµ|#Ýj—+¹ë”1áaìöþ±[—Íû|o¦ûrçxþ¿l›ËÚzlñÏ|Nh“?ö‹ Êû<ðò*¸tÞ¼þ°ó:$®ÃÄG?¢ÿqµØ÷òÕóWéÒ{?|ùC®âC0rE¼’¸’¼2råè•ÎüÈû`ù×K5¾÷¢ïvü:ú«ò.ÌM¼;ñnê]ŽÂ]ïjô-ï×ñ+Îé'ý““#““&/M^ÔLüààèß~?â3ß÷}ê;µôÔÎS\ò0¿à{&žJ>E> æ§}OGžæžl´´ô>;¿òØWèÈC|ˆ›Øsp}yÛùmt,QìÞömn-ñ¹£9ê(ס⦔æiZ*jIöʾ^êîªðuµûlQk‡€åÐÌù¸n)7Ì=ÆçÔšå‰|ß2|.%®&¨y©oid©ò=ؾ¶"Z8²pb!· ¥Øo­ñ™[}­‘Ö7[ßký°UÕÛ ÏâËË-ç[8¹¥8Ò"·äZòâžgÔÑ!FÍHDIGÄ<ÅÎÂ{Í;ÍìË.„}9B€³pðDûŠp¸í¬zjy[J“èNÁéРö–—u¥T§HGWwç €¿ZµçÀÒèmKU®èL%½«ÚRý‘Yd#¢÷„“4®WîB8ŒÑ­ø&á­˜µz,“IÂÓÅ$<ccdl ¬L‰b ³l–ÃêÖ\=FØ‹•†(ËYý¿}š endstream endobj 28 0 obj 15565 endobj 29 0 obj <> endobj 30 0 obj <> stream xœ]“M›0†ïü ·‡xl`WвÉFÊ¡j¶?€€“"5€rÈ¿¯ßyÓVêôØž1Ϙq¾Ùo÷ã°äßâÔÂbNÃØÇpn± æÎØY1ýÐ-‘¾»K;gyÊ=ܯK¸ìÇÓ´Zeù÷´v]âÝ<­ûé>eùר‡8ŒgóôcsHãÃmž…KSdMcúpJû|nç/í%äšõ¼ïÓò°ÜŸSÊ¿€ûŒèØR¥›úpÛ.Äv<‡lUYívMÆþ¿µR˜r> endobj 32 0 obj <> stream xœÝz xוè=wf$dY’-ÿ­‘åÙ–macØþ6‰±m°ù±eKH„–` „$´IíæeÛ¦ 2!Á4y i›¶_i“v»´mIÒnêÂö%ín òž;’ùIÓìûÞ¾ï{ß÷ƾ3çž{î9÷ž{î¹çÌ(8¾iÄ„#JÿÆ>ÿ·ÜóuBÈ„@\ÿæ ¼{Õ…¹_$„.Yã_»1×sþ„ð„h…µ¶¬ùÙWk‡ 1Ì!$í®¡Á¾¯líA8÷ÛÈ£|cá{µX¿„õÌ¡Á»öÅ‹w’§ÃúĆÑþ¾‚ûRX?„u߯¾»üIZ#õ_a]éÛ88±þ oaýBtþÑ@ð$†Ò^Öîô7ÿeë;á~8À?vÅ ¨auÊñ‚F«õ†c¬Él‰‹·Ú¤„Ĥä”Ô´t»ìÈ ÿ_ÂÂäa'±‘-êý–‹ŸG¬×cæ¬vã^ñw:õIE>&ÞÔð*ùù ‘³7SCä±Õƒ8r‰|D~ø÷¸"?;,UÁ ä-òyáïÐQòM¸Fþ ’ÐÎO"Äpµäø%Rïç|j:ß †‡@ ã~-äry.|*üYEŽÑwHùŽ»^°À7 Qº:;ÚÛZ[š›–/[Ú¸d±o‘·¡¾ná¥v~Muռʹåe%Åî¢Â‚Üœì¬Lg†Ãžhµ˜M±Fƒ^Ôi5ÏQ  No¯Êî ñÙNŸ¯Õ}ˆè» Ñ’录&$÷ªdò­” R®ù¥¡T®S‚Y®&Õ…rƒS©wÊS°²¥áýõÎ.94­ÂËT˜ÏV+F¬8ØCnHª—CÐ+7„¼›‡&zë‘ߤA_ç¬ÔI½AB¡\§rçƒ Ð܆y“”èŒLlˆËjè5·t6Ô§8]…‹C±Îzµ‰Ô©,CšºVe)³¡“½òdÁé‰}Sf²º×3à軣3Äõaß ®abbwÈâ å9ëCyw_JÄ™† œõ !ãÚØz]Nã ‘²ÌNyâc‚ÓqNÿáVL_£É2LèEõNLx²w¢w¢ojfÇj§lvNLÆÄLøPä¹{MÍ|goJÈ»¯+dî‚yÑÉz[Cñ-·w†h–WêC þ×:sS–®Yšæ¿×LP¨Ô©ÃÁ&¾wJ!«±ÚÑÒ©ËduÊq¢¸]]!ÚËZN϶Ø:XËŽÙ–ëÝ{¸šm!>kñ€³u¼·/´c5ÚÓ:¶Ns(öÏ)çDœE®tw©´2ŽjñÀ°²Q-Øëæh)¬Ë„Y­Äþ9ò˜NAÙ–8¹Ò‰lŸgCoôóP"2 B>WdéÛ;CJ=J_t&‹ÝØ£¯—h¸^]¾ÛéY ¯¯'VÃp[§Ú%Ú-d­ ‘Þþh¯»¡žI–&zë#C`¼œ-§ˆgæâä9åy™Cºê±T‡v•Ý0Ñ9°&dïMÀ¶FîLq„”.\à.gç`34ÔPÞEçP%†h]{gc›³±eeçÜè@" ŒŸÕð)6ÎΔ4¹.K'wÒ® ͈½8Vã=¤ÍÒa1£ÂU,3Õ…Õr'¤YjF(On¬Ò±ú-LfNu¾YnVE>u¾G—#rPl–£‚±‡Ž)Õ7ÛÄe¡'@E6*Šé2‘Ù¼Üétv9‡äÒÜÉæÆÔ£j9ª Uçѵj¿¥v“²PMÄͳ¦Ìוr³rC‹ÔúõªïSÍ‹g›å ³±m‚1wFùâa&¬Ìµ¤¨»Ÿíg§·71îhu?OL* ÛËClÛN8L8Û:«Ujô ÷¤ÜÍdÅ‘Fhl_XX€Îlá¤îo™Tàþ¶•§ð´”ïoï®å3¦K'5¯ªsA2É1´ÀÐǵç'ÕÇá=‡%ËaqÔS9œ ‡ÃCBÇ_Ÿ©çϰà‚ìÁÓ_ƒqš´*e&´œ–õFÙXlTŒœ ®”I1Š×õô£Âá‚0#—‘ïNì!q¤vºv:®ÒÝ=6 îîéÒnó›–JtCc%Å(Ùæˆ–=|û'?£W®™¹Û„—ÂO^ ï¿„òwã¼Â|I#«NÓÌïNˆz²Ô65sZIc|6›}»ýˆž³ƒÛÞc?fçbÒ¼ç°<Ÿ™ëcOň„$©9&ά5a¼Y[[ëÁ‘¸\l,ÝcÛURL\Ëœ"šãHçlžùœ§TJ°3Cc³ŽRˆ¡<Ïñ¶üÊæª¤cJEöð&®Ú¹|Q¥1¦ÊÛ`«ê^à5jÄoýãµi¶Í3àæ—“xâ$™ŠÕºˆdõfù³hò"}B“Élo$U1àž3¿;]R ÖXêÌ(¢esæSOi:æd3ñÖt¬Í§üà oîÙõ“=ÞºûßœxèÍûjÂÿü…»¶ír*+Ëç÷-Ì éÛÞ|¤­õÐÙ{¶œy´½ý‘3w¿ú\蕾}+]®•ûØ:&Íü‘>(Ì% ¤]ñÐ\¦Å˜˜+X­úX/®© 4q=Ü(ÇqJvï(œQhÒè5:Ædi"ê`=n‹Ç<]Š«è‹Â¥în»¤Ø%dd—Yœež ÍcsZ¬’§´¼Â ðÔ¶/íy¬3tæLumr~òœ`Üî=ô ß ‡¿{íͦFæ9‹%b¿L_…¨¯t’Cš^Lò&'gyÍlõrr\>sž;¯)¯'o4ïHžiY$XZ33%{«Þ,µs$%±âXÌScZE;{×5íq£j…›ÔšU¥åB,ÇeÄR­£è’M/íò¶íŸZ³ã…`ùµ%‰å·Õ,Ye1nÁ†¯\žÒXö¿sàñ·ï›×uôÂn]ý¦Ž’Ú… EC+*¹É´Úï}÷¡ž}8;Úk9|ŠÌ›ù¢É2‡™é›NÍ\Q«¥^{¾7ÏÎfçM’}ö<{žÞæ=‹9mB5Í5P\ª¡J ¸kÀàÕ—ÚwKæOóÁŸö|w>ÍÏÏ4›[³A6Pƒ™’G<Þ»ñWY‰@ã7¿‹Û.Žm7—yÚŒºp¹\³––S‘Î1Û*c†_ÄÍj(A[ÄE-/!ãí ¶¬}úžvÛ_bòç·•·Õd”tÔïRªƒÏŒv¾«ÅüÚÌ2oþÀ@^ãÚšÆÇ zù¶îô†‘–¬Â¹ézCJIV~‰=ÁdÊ÷v,ÛÒQèX4²<9Ç“nðTg¤ÙLfWãfÕß8ўà 1…¬8Eô3•4¦ºWÒ`G¤¤ô˜ÀdJ/Õàv,FÏth6Çûh| fØ|S’`¶Å=Ó¥loÝj§Ýcl£º;´ÔÈt£Û<íÂcƒ_†÷ä“é¾»o/îΊ+ŒÏñ¤Å¼Ãmûd·í»có‡—è5/ð‚Y.‘;¾ËlÖƒ¾ñAôZb¥¿Qšâ)'@+gäVñ‚•8Þ D­ÄHVi5V­ÆÈk•xɧÕ&h©A+ýHú…DKð% ´R‚”#­î”„Ǥ”NJH¼Ä¦6ó“3>?f´H\„úN r#}è_°M‚“<-ÁcÜ%Á"Vý@¢÷K‡%º9Ò¹$H ‘àðŸ%x[º$Ñ×$xQ‚‡¥è. ¥Mm— N‚LiŽDm*ñG¼ÇÈáé5‰>%Á#ªì)(Ñ:©M¢s$È’@’€Jð¿>“ñ& ÖH€œnpæ%zOúX¢È©Ÿ—€•à! ‚Ò.‰®– Y‚Ri¡D3UÞÊ/û ~#Á¤·%z\ÊA îe= UZ-Ñz Ê™0«c¹$}$ÑŸ3zøºt\¢‡$Ø,}I¢ŒæHõÍ–ÀªNrîŸ= õ÷$8¡jq#ÇA02¯Dã$¸!×£Rˆñ J‡$®™ñ`ܸ]X=!ýç/ø%¨g=ÙH°“.ÄŸæÏᱡÚcM2‚Qˆ× a°C±´ÖS鎫ìFKu£G]Õ݃[·{Œ]ã=ã7®UÝ7]c·\×izþ†°û³ oÝÒ²ªÛ¥"Ì?GÈR¹ÛµÛõóéÓfòên!1Z))vpøЏœX<2üÆ{®}pOø—x<ÞAɵ‡b,½%!f/<CáÃÂοnçÎ;UeS.{Þ"gx½ºÇ™¯¯@_/“ %Ýì5™R¼M©š!-â›ôf³Þ¬¤àfOŒ;¸oѯ™™OGoö·=AˆÔæ¨S§­;_Ý¡xw½ºuø6/Ž ¿ÓÛ96ôëæ FHÖ/ÚòmkóCg¶íþÙƒKçöíZÛÖÿÉðÄà€±qÏp-îé8Ào ÿaqT“R‚—¾¢¿.h@#*b³HŠ!‘n¡W»—E؈Óâ9‘L¼´a‡e-D”¬ºà±ÒéÒ’âø2‡yŸþ’økgÏ^åøyWˆr«Q';P'eÉíy±$QŒ!KíìÀÈÂCkÆ—(ÈÒòRƒ7ãtÞ¹<š——á}Å M^%0g‘gKô%$T/£Ù'T´êõ©µvÉ-m— ;‘,-©æœÚ¦R·zV–2‰ªµDŽKvRº¦»ÇÌo¨§hi©zR¸fõ\ ì`~R›Å¢£tj³¨Ç(žñxXdç8c!^ËÙØÁ' ìY¾õ¶¢ºà¿·åVe;+r“„ðùeìŒ>92OïL•Ó“rs Ó× ê5sýä`aKM梪òΚ ««íîå½÷µd_QÕTj‹uVÆ.Út›»´ÿ`OxsvužMs#~hpÐOEJ1R®\ÖXÔ¸Úƒ¶µ‘»ØÛEŽ”c|zx=HRî`ä¨x>ÕîS ƒ!ÖG)/oRË•, cq˜|õùd0#§Õ^1åðLw’¾SÄŽgR¶Ž,#Þ‹Î+NêÌ:˜u4‹úÕG(ëJ–p9 ’b¼çp·GƒPöTbu1>c’¦9Ío2²(´´õ?†ªV2ÍN'‡%ªh›ÅqSD sK­EKÊ‚"4 ô¨èvz° €‰ÎDœÎ <îzxܲë§Õ‡íwá¿ÎQãÜݸÏ ÿL2‡,S¬Y‹Ô°”ûËAÒzÏaD5öTâ0w±æ6¥Êf±ØJ›ôj¬7}sSŠùÃØM DŽÓÊ¢ÚùP†¢­­F55£@ÊĿü’5_]_Ü{›/™}’ á˽$^¼çø¦¡GûŠÂç7Œ¹Úææ*í®õAêØzö±v4¿r[¹'WçÜÙÆ¿^-×$§§ø{ÛycËÔñŒŽ×íkϘdó ¯àð-8ÏrÒ}Šdà®IÅ]ÃÉx›ô\ÿ\(LµxÏÅA\tÒqê¤q¯Ä©“–L–”Ï4¹)œuâNa›&ûæ=sˤ1ŠÌºç¶ÅÉÀýþ@àÀB޲Y¯}´Ï>ïÍo[—» 5¿¼½2fl=÷h‡µpq¹[V•îãÿµíÞLm¶õw´:s÷©çlÞûÛ®ÛPýÅv\ã;p9ÉJ‘]ý­ï…XˆUpбŸå1À{9c&ƒf¨®×<ƒ¹ Éj‹!¦®¢{Zulþ‘@6:)u¡ñ t`ŽXÍ"-pØZ´Xu¸ªá@à8aî³wöÝß‘ÍÏ»öµYgAë?™Êhœu[ýÊèáNz ×§×p%ú=)%õJ~FL¼÷.›DÜÿ(Xtšœ#´§\Ô””&ŧĚršt‚ù¦ÕBŸ:2;£17>*± ®VyEyEtÐY³®ÏÌfÕ^ºö«6^¡~‚&a ¬JL¢`MLâ¡U´Š ¯·êãE½UcÕèS¸D‡9F϶}¤^ÇÇÖÀÃèz ¼‹ßÊïåç…*ŸÂßίçŸá_â5U*úuþä¯ò"+_§ç釔;AÁ@éíôqÊï¥/Ñ×)G•ü9>žZqô ¼w‰ÜSâ ñ#‘ÕlîÝñ­·Š´]„*F‘)Ò7®ˆð¶xI¤/‰°K<$>%rëE˜%°Šô¼ø¡HY|I3Åvq¹>% WE¸ÈúÁ3"ávêEH]xT‹ð•«ŒÕ ñm‘Æ9"D@îjìÊdιK8&zZ6:ºW?9 ÒÙQ !‹K"¼.ÂAñ(ë5G¬Gé»Dá#†=/Ò"`¿ çílhLȇâU‘žá"<®ŽÈ ¦ˆ´»l÷Š‹JÕKâë¢0*‚K¬EŽg$È`¯ø 2Ṏ@ˆgÅ "GDY,ý"¯%|úh̘г—žî±ÏHdÆnM–þÑ}S¤"YÆãVŸññéâ}U7˃ Ѽì}ð³ïù­°(ÈñI>ªÕhµ:“@øh\_é®dÁ¬«{6¼g-ƵøDW]R¬Ú£´ÌÆ,j »0|a K á^( ï‚/ÿ¶‡× o|òœ¯¼¶çážù=Ÿ'}yR 9Ù\Д}$›fg;Zs@ ½¿!d8mŠ Ša‡á áœA0„$õÍá{o:› V²lÐüît\ž*nö2Ñ|st™Å^–³tÐe‘ׇìEõõ¼Ÿ¶tŽÏ«ýÂKÛ&þç–Ò5޹-ƒþ²–Uù«ïÈ_á-èë^±^þ ¦cç7Vm;>^ž¹x|ùŠ­¹°»÷Ë*½‡“ ËÓÖÖ.Í‹ý­9¿qÞŠþÞNkÿC½îê5÷/›¿¾£ÆÄë«:GÕ5Þ‹·oC îÇT%–{4òE‚`Hþ8A+SÏŽîh(¾˜"œ¼snaïjQ§ñ$‡d+6ëÈYd–—>¢ m$LZg€éG}Iß==dS5VœvœaBœ0¶ÌƘö%÷=¿nÝñ¾E÷¾0²vrçâðûRñ²Šªæ›T¼¼²byi}õ'áŸi\ò Ø^ž®«{:üûwù~ ÈüþÃ~oSqñ¦ï±¹™1ÂX’}G8…þ&³6sf2ÎT„¬îíçd2.Æ"•Å%YñÀˆß™‘S&•bdU à ¾¿Bv¸½eEÏW—–u(Éž¼¸p;äý·øêþ×Z»Œ?ÖÅÙò×ón&O‡ûeÊÓt2Éëj'…¨(­;¤CQ?+ 5‰˜ë›ýX8¾ò~Ë­¸úCì­æÌš'1v¬$ß8Erg®¨¦EV ’+½„ ½— >* UíU»ªÞ®ºTÅWUÁãU/U¯âÚ«+î* ö* Uª:Wu±Š;R½U;ª(6`–MÔQ猼šcdzdÛ£iNrds,Ï.Œ$Ú¸#<ì³Eä‹ó=gÂ’n š¼NNê-%xfßz\'ÒZ¸KNm¡ËëI½%Ÿóø†m%kÒêZzævm]æ ÿž‘å7xRéßOзêVV$FÒô•«i¤îÚ1ÕNÑNÙÞOGÃ>El3ÿŽé6Yf1›uöõWIvž”&ä^Ð]ÖÍè8]f0Áœ ’/'ÓæäÞdšœ\d šÑWZ Ú¢¨a« ا¹î1«M—²o&Ì ”Gó*b1“›ß²ÍfU7›|9ŸW}çñMÿþLŸ´OlXšþ‹ueõØÎ£ƒÝ­Ÿ~?¹l¹'kɼÌôŠå%=ëà̺Éí‹ VÀ¸Ç¹|kgÖ’¿y¿±¹&ð´¿òvÅ™XÖ:¯zh™kw$Ž\„6éÀùg %M7š”äÈŒ1™dj°ÖØXCÀª•j¼Èú1¶e=îió›¥l2ž²ùÂßø)^ë°-*žxì‘;—¬º}eOlø=ýüÀ³w‡îš¿üîGöRéßþæþ-cãʪ•}}涇FjËÖ<¼ªÿèîÍþñ‘ó‹åCÃÌr©úcbü®ììþŒnü¤)¼Bó$ž@l¨töG[„h燗“º?ãúÔï 2èH½pÙÃ¥‘ÝüoI3­DSøI⤋a§ð#âaul;€Ïjø€lDÚÝÇb{ÿ[µ?+Û±´c›ËN„æ5„Y_7ÒîÅg 36MåÓÈ´WÙ@~ füë…Ðúþ6þ)þ¢°Kx³œƒš§4ok}Úêòu‡Å%â„þEÃ>Õ˜/Ä|%æÆL£ÏøÇؑؗÕY:ICT”˜‰›¬ÄÕ½[ó5ôÞ › ·]×Eïu½¦Á½Q˜â9;…9ÌÞQ˜'VòPH,y: kÐwžˆÂZr7ùQFÃQX$±Ð… 8†þë¿Ú,‚íQØHFáÙ(KæÓT”ŽÑ2ÖNÓ•QH:—…)Ñqs£0GæsJæI.÷…(,Tîé(¬!ÙÜ÷¢°–|Äý. ëH.ÿ«(,’TÂ2W£p ¹CèŒÂFò®p" Ç’mš‡êFý[Ƈ×åÜþ<¹´¸¸Bn}}ÁyñH‘¼`ÃY%ÈãƒÁñ̓EòÒÅ Z´/nZ.ä>98Þ70¸±o|½<ºæÖþK‡WŽ÷‡GGä¶¾‘ÀÂÑ  ýƒ#ƒãr¡ü©V™5î¶ÁñC”W͹AÁ ?Õé¿Îbíp 88ŽÈá¹£¨­Hnî Ž徑¹ýzǦ5k†ûUdÿàx°‰GƒC8ìu›Æ‡ÃýLZ èúlêFÇý£Ña7ÊËú‚ÁÁÀèÈP0èŸçvßyçE}Qâ~¤-êÝèþ¼¶àÿàÀ``xíξh(¸qÃRÐH¾I•ˆ£¹YƒÞÑ\¤ š908(3öä¿fp‡æ]7Ø,_ë¾sxý°;Âoxd­ûÆ%*ç¿×ý×(ñ“-dœ “µdˆ‰LrI?ÉÃg)žVŤ¡V2Hðé#}HQ€Ðb2‚TE-@¿²Ÿ78ÔÚ >ñ¹YíË(—b¯…è;Z±O;ÂM„}AVéû°‘ºiÉF|Ž“õˆ%k>WþRì¿Z•ÃZ†‘~[Û°6‚|b}ö\€p?R¨ÜÇ‘¢PÏçõ•¯÷þߥ»M¥ \§(Áñ1ý‘9ŸÉc–Cá!é¿§¡ÈZ¬U¹UÞÊa•wR´©TÍjO¦£ *mD¥jÿ ‰M(q ög½AÙ¯òb=Âyᡨ¶×‘Mª}’õ›[%ÿíÚ0›G«ý”¶Øè6«2—©ø jc¬mH­ùÉ<<ÜäNõ¯inåÜå[¤B‘òÿ´_wŒ_Õã ºÞk‘6²öE*ϸšK£Q÷ÓЦ›æÑÍß³A¯úŒì¤ ·ða+Ëž¬ïìèÑñ¯QåD´æÇû(ê}PÕv‘Š]«Îq×p¡›ÇÇVlm÷éÑÌŽåÖùü¿”ÍE‚‹™ò ò×+¤´,áVïÇ€WÁ¹kðÊ50_ƒÑ« \…üøèÇÜ¿])³»¯¹B{.ƒûrÏåÑËG._¸,¼I¶¿w©Æþ›‹9ö¹Xc¿PóëŽwk¸Ž_OAúñj»{ÒYb‡w‹‚…›9 éJnRª÷WÜŒœ‡æ«íoÿ4Õþ³ŸfÛ{ß:øÖé·8ö!pñ-½x+)Í‹Ïoé^ÓHŠ ^ùn¶]y)oWy)#Ç;ÅùbLÁÔI½œrR>©œì=é?)°ÇÁ“çN^9)L¬}H÷Bï ôè ç^P_ÅÆ¾`ˆõšŽ÷§“\d̘0`i‘xy’’›çµs«=väo:ʱXÉKžõ?»ãYîâ³Wž¥Ï|«Ìþ­ælû)Hdœ>'ùE0}L߀—!âI5±ƒMÙÝ\mòñûW±òÃÏýïûéºüÀ¾]ý¨ÔÑŸ}Ä[jO†ÄŽ$Ob‡ÖÃuhpuú°ooO©½Ÿ«Vúìwxsì·¯¼Ë¾Ò[b/ë€ëàK¹ŽQL\-G{Ú@iË-ð*méx‹Oô¶¶äÚ[šRíÍX’šòšhWÓp‚8%Ï›e_ìM²û¼û"œô¿{Q •Ú:,`ê0—š:( 3ö)°OñaVjðiNQR¨9EN)Nñ§ðvS­©Ç´ÝÄ›LnS“iÔtÀtÁ4cÒF°—M<†Ï˜:í@€)88ÙÞær5NigZCÚæÛCp(«Ý•–•!Íý!Ò±òöÎI€º¾¸?Y˜Ö*më õ¦u5†P°sÚ¤Dv‚à¦@й ‘YD °‰aÊ5K¢¢`0H"]®q\ÁMj@¢½Œœq‹þ»c}“+¨²b„ £q1(*Œ¨HÆF½PB ÷úâW endstream endobj 33 0 obj 9244 endobj 34 0 obj <> endobj 35 0 obj <> stream xœ]’Ínƒ0 €ïUúÔ(Šw¹gEœ*dMœ”È1±Šwœ#'œCµ)Ç5ò#Çä=ï/‘§œ#ó¹`¦œŸ•"Ÿ9~F.yÿGÏ2âœ2û'2û'è/Ù?EgÉþ)zÊÕÏ’ì¯ÐG²¿¦8ûïðŽ’ýõyõ?"³¿¦ZöWè)Ù_Ó¹ìŸâåêÿD±‚þŠý5ÅÙ_+z¸õ…ð ±Ç~ZC4wç|[P#R?`'ô~{ÕŽ«èûBº« endstream endobj 36 0 obj <> endobj 37 0 obj <> endobj 38 0 obj <> /ProcSet[/PDF/Text/ImageC/ImageI/ImageB] >> endobj 1 0 obj <>/Contents 2 0 R>> endobj 4 0 obj <>/Contents 5 0 R>> endobj 11 0 obj <>/Contents 12 0 R>> endobj 18 0 obj <>/Contents 19 0 R>> endobj 39 0 obj <> endobj 40 0 obj < /Dest[1 0 R/XYZ 56.7 773.4 0]/Parent 39 0 R>> endobj 41 0 obj < /Dest[1 0 R/XYZ 56.7 661.4 0]/Parent 40 0 R/Next 42 0 R>> endobj 42 0 obj < /Dest[4 0 R/XYZ 56.7 258.3 0]/Parent 40 0 R/Prev 41 0 R>> endobj 21 0 obj <> endobj 43 0 obj <> endobj 44 0 obj < /Producer /CreationDate(D:20160414150758+02'00')>> endobj xref 0 45 0000000000 65535 f 0000070479 00000 n 0000000019 00000 n 0000003305 00000 n 0000070623 00000 n 0000003326 00000 n 0000005987 00000 n 0000006008 00000 n 0000014344 00000 n 0000014365 00000 n 0000014623 00000 n 0000070767 00000 n 0000014643 00000 n 0000017702 00000 n 0000017724 00000 n 0000027665 00000 n 0000027687 00000 n 0000027948 00000 n 0000070913 00000 n 0000027968 00000 n 0000029688 00000 n 0000072107 00000 n 0000029710 00000 n 0000042020 00000 n 0000042043 00000 n 0000042236 00000 n 0000042818 00000 n 0000043243 00000 n 0000058895 00000 n 0000058918 00000 n 0000059115 00000 n 0000059638 00000 n 0000060009 00000 n 0000069340 00000 n 0000069362 00000 n 0000069565 00000 n 0000070012 00000 n 0000070315 00000 n 0000070368 00000 n 0000071059 00000 n 0000071115 00000 n 0000071431 00000 n 0000071769 00000 n 0000072227 00000 n 0000072342 00000 n trailer < <7487556FF66574D985420154351F0926> ] /DocChecksum /0681295274800D168447279E199EEB11 >> startxref 72517 %%EOF nx-libs-3.5.99.23/doc/nxcomp/README.on-retroactive-DXPC-license0000644000000000000000000002412013614532331020353 0ustar On DXPC retroactive relicensing as BSD-2-clause =============================================== TL;DR; In May 2015, all versions of DXPC released before version 3.8.1 (sometime in 2002) have retroactively been re-licensed by all previous maintainers of DXPC as BSD-2-clause. This README file gives an overview of the discussion thread that lead to the retroactive re-licensing of DXPC. For the full discussion, see doc/DXPC_re-licensed_debug_784565.mbox in this source project or #784565 on the Debian bug tracker [1]. light+love, 20150521, Mike Gabriel [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=784565 ------------------------------------------------------------------------------ STEP 1 ====== In May 2015, a serious license issue around the nxcomp code shipped in this source project was raised and solved on the Debian bug tracker (thanks to Francesco Poli and many others): http://bugs.debian.org/784565 """ From: "Francesco Poli \(wintermute\)" To: Debian Bug Tracking System Date: Wed, 06 May 2015 19:35:32 +0200 I noticed that the debian/copyright states: [...] | Parts of this software are derived from DXPC project. These copyright | notices apply to original DXPC code: | | Redistribution and use in source and binary forms are permitted provided | that the above copyright notice and this paragraph are duplicated in all | such forms. | | THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED | WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | | Copyright (c) 1995,1996 Brian Pane | Copyright (c) 1996,1997 Zachary Vonler and Brian Pane | Copyright (c) 1999 Kevin Vigor and Brian Pane | Copyright (c) 2000,2001 Gian Filippo Pinzari and Brian Pane [...] This license lacks the permission to modify the DXPC code. Hence, the original DXPC code does not appear to comply with the DFSG. And the nx-libs-lite is in part derived from DXPC code. This basically means that nx-libs-lite includes parts which are non-free (as they are derived from non-modifiable code) and are also possibly legally undistributable (as they are non-modifiable, but actually modified). The combination with the rest of nx-libs-lite (which is GPL-licensed) may also be legally undistributable (since the license with no permission to modify is GPL-incompatible). If there's anything I misunderstood, please clarify. Otherwise, please address this issue as soon as possible. The copyright owners for the original DXPC code should be contacted and persuaded to re-license under GPL-compatible terms. """ The issue has been settled by asking all recent maintainers (i.e., copyright holders) of DXPC, to agree on considering the BSD-2-clause license (as introduced in DXPC 3.8.1) retro-actively as the license of all pre-3.8.1 DXPC releases. STEP 2: ======= Kevin Vigor, the (at that time being) latest known maintainer of DXPC replied back immediately and provided the info given below. He also stated that he agrees to applying BSD-2-clause retroactively to all pre-3.8.1 releases of DXPC. """ From: Kevin Vigor To: Mike Gabriel CC: 784565@bugs.debian.org, [...] Subject: Re: Bug#784565: nx-libs-lite: parts are derived from non-free code Hi Mike, et al, I am not the original author of dxpc, that being Brian Pane. However, I took over maintenance circa 1999 and am still the primary maintainer (though the project has effectively been dead for most of a decade now). As you are aware, when I inherited the code, it was licensed under a variant of the BSD license that did not include the 'with modification' clause. To the best of my recollection, somebody from the FSF contacted me circa 2001 regarding this and as a result, subsequent releases were done under a standard 2-clause BSD license with the modification clause. Again, to the best of my recollection, I contacted Brian about this change and he offered no objection. Further, I recall distinctly that NoMachine contacted me and explicitly asked permission before including DXPC code in NX, which I happily granted with no new conditions beyond the BSD license already in play. It is possible, though by no means certain, that I could dig up ancient email to corroborate this account if necessary. However, I am more than willing to publicly state that I believe NoMachine's use of DXPC code to be both legal and ethical, and that my intent when changing the license to 2-clause BSD was simply to clarity the existing intent and that it ought therefore be considered retroactive. Yours, Kevin Vigor [...] """ STEP 3: ------- We were not able to dig out any recent mail address of Zachary Volner, another of the DXPC copyright holders, but a phone number. On Friday, May 15th, I (Mike Gabriel) called that phone number and left a message on - hopefully - Zach's voicebox, asking him to mail me, so I could explain everything. He mailed back and later on posted the below statement to the Debian BTS, also expressing his agreement to the retroactive re-licensing of DXPC. """ Date: Mon, 18 May 2015 10:05:38 -0500 Subject: Re: Bug#784565: nx-libs-lite: parts are derived from non-free code From: Zach Vonler To: 784565@bugs.debian.org On Thu, 14 May 2015 05:55:42 +0000 Mike Gabriel < mike.gabriel@das-netzwerkteam.de> wrote: > > TL;DR; So here comes my actual question: are you (Brian Pane, Zachary > Vonler, Gian Filippo Pinzari) ok with retroactively regarding > pre-3.8.1 code of DXPC (that you probably all worked on at that time) > as BSD-2-clause? Are you ok with others having taken or taking the > pre-3.8.1 DXPC code and distribute it in a modified form? > > A yes from all of you as DXPC copyright holders is essential for the > continuation of nx-libs development under a free license. This may > also possibly be an issue for NXv4 in case parts of it have been > derived from DXPC. Yes, I am fine with considering the license change to be retroactive to cover the time I was the maintainer. I have no objections to others distributing modified versions of that code. Zach """ STEP 4: ------- By 18th May 2015, Brian Pane had not mailed back to us. Hoping he is well and alive. Giving my personal gratitude to him for his work on DXPC back in the nighties. However, Kevin found an old archive of the DXPC mailing lists, esp. a post by Brian expressing openness to modifications of all DXPC code versions. We refer to this regarding his consent on the re-licensing. """ Date: Mon, 18 May 2015 15:11:42 -0600 From: Kevin Vigor To: Mike Gabriel , 784565@bugs.debian.org, Francesco Poli CC: [...] Subject: Re: Bug#784565: nx-libs-lite: parts are derived from non-free code By the way, poking around the interwebs I find there is an archive of the old DXPC mailing list available at: http://marc.info/?l=dxpc&r=1&w=2 I think you will find this of particular interest: http://marc.info/?l=dxpc&m=93093790813555&w=2 List: dxpc Subject: Re: future tecnologies From: Brian Pane Date: 1999-07-02 16:42:18 [Download message RAW] Kevin Vigor wrote: > On 01-Jul-99 dxpc@mcfeeley.cc.utexas.edu wrote: > > Speaking of licensing, are you putting your 3.8.0 changes to the dxpc > > code itself under GPL, or are they going to use the original dxpc's > > licensing? > > No, as you can probably guess, I am no fan of the GPL. For stuff on > this level, where my hacking is pretty simple and probably devoid of > commercial value, I'll just release my changes to the public domain and > give up even a copyright interest in them. > > Your and Zach's copyrights still stand, of course. > > I *think* that fact that we use the LZO library and API, but do not > directly incorporate the code, allows us to escape the clutch of the GPL > virus. > > btw, is there an original dxpc license? I haven't seen anything but a > copyright notice, which to my non-lawyerly mind translates as "free to > all the world as is, negotiate with copyright owner if modifying or > including in some other product". The copyright banner in the Readme is all the documentation there's ever been. My intent was to allow _any_ distribution, use, and modification of the source, without imposing restrictions on the licensing style of any system into which others might incorporate the code. We probably should start stating this clearly in the distributions. -brian [prev in list] [next in list] [prev in thread] [next in thread] """ STEP 5: ------- Last but not least, Kevin informed us that Gian Filippo Pinzari never contributed any code to any of the official DPXC releases. So we assumed that his copyrights on the code stem from the time where he - under the NoMachine umbrella - worked on the code and should probably be associated with the GPL-2 re-licensing of the code later on done by NoMachine (which we did in the LICENSE file). It also appears, that there has been an incongruity between the copyright statement in nxcomp/Misc.cpp and nxcomp/LICENSE for Gian Filippo Pinzari. We used the copyright years (2000,2003) from nxcomp/Misc.cpp instead of those originally given in nxcomp/LICENSE (2000,2006). """ Date: Mon, 18 May 2015 19:16:25 -0600 From: Kevin Vigor To: Francesco Poli , Mike Gabriel CC: 784565@bugs.debian.org, [...] Subject: Re: [pkg-x2go-devel] Bug#784565: Bug#784565: nx-libs-lite: parts are derived from non-free code On 5/18/2015 4:14 PM, Francesco Poli wrote: > If it is confirmed that Gian Filippo contributed to the forking of > DXPC within the NoMachine project, but not directly to DXPC, then I > think that he made his contributions available under the terms of the > GPL v2 of the NoMachine project. If this is the case, no feedback > should be required from his side. I can confirm that Gian Fillippo never contributed directly to DXPC. You'll note his name does not appear in the DXPC README, and never has. """ nx-libs-3.5.99.23/doc/nxproxy/README-VALGRIND0000644000000000000000000000200513614532331014664 0ustar README-VALGRIND --------------- You can run nxproxy (and nxcomp) under the supervision of valgrind (a very good memory debugger) by wrapping nxproxy in the following script: #!/bin/bash # Enable core dumps. ulimit -c unlimited # Set this to directory where nxproxy is located. NXPROXY_DIR=~/NX/nxproxy # Set this to directory where valgrind is located. VALGRIND_DIR=/usr/local/bin exec ${VALGRIND_DIR}/valgrind -v --leak-check=yes --leak-resolution=high \ --show-reachable=yes --show-reachable=yes \ --suppressions=${NXPROXY_DIR}/nxproxy.supp \ --num-callers=16 --logfile-fd=2 \ \ ${NXPROXY_DIR}/nxproxy $1 $2 $3 $4 $5 $6 $7 $8 $9 Run the following commands on your shell, right in the place where the nxproxy executable is to be placed in your setup: $ cat >nxproxy $ chmod a+x nxproxy Output of valgrind will go on stderr, that is in session file, if run in NX environment. nx-libs-3.5.99.23/doc/README.NX-development0000644000000000000000000001412713614532424014610 0ustar # NX development by ArticaProject, X2Go and TheQVD [![Build Status](https://travis-ci.org/ArcticaProject/nx-libs.svg)](https://travis-ci.org/ArcticaProject/nx-libs) This source tree started as a re-distribution of those NX packages needed to setup FreeNX and/or X2Go on a Linux server. In the past, the NX re-distribution (3.5.0.x) had been maintained by the X2Go Project: http://wiki.x2go.org In 2014, [the QVD project](http://theqvd.com) run by the company Qindel joined the group of people being interested in NX maintenance and improvement. Since 2015, the Arctica Project has joined in the NX development. The core devs of X2Go, Arctica and TheQVD have agreed on stopping to redistribute NX and to continue the development of NX 3.x as the new upstream instead. The package will see a slight name change to **nx-libs** starting with version 3.5.99.0. Our intentions for nx-libs are: * provide _one_ tarball that builds NX projects via a common Makefile * provide _one_ tarball for distribution packagers * provide support for security issues * provide support for latest X11 extensions * improve NX where possible This source tree is maintained on Github: https://github.com/ArcticaProject/nx-libs (3.6.x branch) For the the post-NoMachine era of nx-libs, we will focus on two release phases for the upcoming two years (06/2015 - 06/2017). ## Release series 3.6.0.x Scheduled for end of Q2/2016. Release goals (phase 1) for nx-libs release series 3.6.0.x: * CVE security audit (complete) * remove unused code (+/- complete) * no bundled non-X11 libraries anymore (complete) * complete imake cleanup (+/- complete) * replace as many libNX_X* libraries by X.org's libX* libraries (complete, only remaining library: libNX_X11) * support for iOS (nxproxy, complete) * Unix file socket communication for nxproxy -C <-> nxproxy -S connections (complete) * allow Unix file sockets as channel endpoints (complete) * allow embedding of nxproxy into other windows (work pending) * new RandR based Xinerama extension (+/- complete, more QA needed) * Fix Xcomposite extension in Xserver (work pending) * nxcomp protocol clean-up (complete) * nxcomp logging clean-up (work pending) * optimizing documentation: how to tune NX connections (work pending) ## Release series 3.7.0.x Scheduled for end of Q2/2017. Release goals (phase 2) for nx-libs release series 3.7.0.x (not branched-off, yet): * rebase Xserver code against latest X.Org server (work in progress) * event FIFO sockets for attaching external applications (todo, to be discussed) * enable/support XV extension (todo) * software cursor for shadow sessions (todo) * no bundled Mesa library anymore (todo, to be discussed) * use recent MesaGL (todo, to-be-discussed) If you have any questions about this NX development or want to file a bug report, please contact the Arctica developers, the X2Go developers or the TheQVD developers via the project's Github issue tracker. *Sincerely,* *The nx-libs developers (a combined effort of ArcticaProject / TheQVD / X2Go)* ## Building Under Fedora or EPEL using Mock Assuming: 1. The branch you are building is 3.6.x 2. The current version is 3.5.99.0 (specified in the .spec file) 3. The current release is 0.0build1 (specified in the .spec file) 4. You wish for the RPM files and the mock build logs to be under ~/result Prerequisites: 1. Install package "mock" 2. Add your user account to the "mock" group (recommended) 3. cd to the nx-libs directory that you cloned using git ``` mkdir -p ~/result git archive -o ../nx-libs-3.5.99.0.tar.gz --prefix=nx-libs-3.5.99.0/ 3.6.x cp --preserve=time nx-libs.spec ../ cd .. mock --buildsrpm --spec ./nx-libs.spec --sources ./nx-libs-3.5.99.0.tar.gz --resultdir ~/result mock --rebuild ~/result/nx-libs-3.5.99.0-0.0build1.fc23.src.rpm --resultdir ~/result ``` The end result is RPMs under ~/result that you can install (or upgrade to) using yum or dnf, which will resolve their dependencies. ## Building for openSUSE using OBS Build Assuming: 1. The branch you are building is 3.6.x 2. The current version is 3.5.99.0 (specified in the .spec file) 3. The current release is 0.0build1 (specified in the .spec file) 4. You wish for the RPM files and the obs-build logs to be under ~/rpmbuild Prerequisites: 1. Install package "obs-build" 2. Make sure your user account can become root via sudo 3. cd to the nx-libs directory that you cloned using git ``` mkdir -p ~/rpmbuild/SOURCES ~/rpmbuild/RPMS ~/rpmbuild/SRPMS ~/rpmbuild/OTHER ~/rpmbuild/BUILD git archive -o $HOME/rpmbuild/SOURCES/nx-libs-3.5.99.0.tar.gz --prefix=nx-libs-3.5.99.0/ 3.6.x cp --preserve=time nx-libs.spec ~/rpmbuild/SOURCES cd .. sudo obs-build --clean --nosignature --repo http://download.opensuse.org/distribution//repo/oss/suse/ --root /var/lib/obs-build/ ~/rpmbuild/SOURCES/nx-libs.spec cp -ar /var/lib/obs-build/home/abuild/rpmbuild/RPMS/* ~/rpmbuild/RPMS/ cp -ar /var/lib/obs-build/home/abuild/rpmbuild/SRPMS/* ~/rpmbuild/SRPMS/ cp -ar /var/lib/obs-build/home/abuild/rpmbuild/OTHER/* ~/rpmbuild/OTHER/ cp -ar /var/lib/obs-build/.build.log ~/rpmbuild/BUILD/ ``` The end result is RPMs under ~/result that you can install (or upgrade to) using yum or dnf, which will resolve their dependencies. ## Building Under Debian or Ubuntu using debuild Assuming: 1. The current version is 3.5.99\* (specified in debian/changelog) Prerequisites: 1. Install package "devscripts" 2. Install the build dependencies. `dpkg-checkbuilddeps` can help you identify them. ``` git clone nx-libs cd nx-libs debuild -uc -us cd .. sudo dpkg -i *3.5.99*.deb ``` ## Building on Windows The only components that can be built on Windows at the time of writing are `nxcomp` and `nxproxy` (with the latter utilizing the former). **The next section is only relevant for git-based source code builds. Released tarballs do not require special handling.** Since this project makes use of UNIX-style symlinks, it is imperative to clone the repository using Cygwin's git binary. MSYS(2) git is not able to handle UNIX-style symlinks. Make sure that all build utilities are Cygwin-based. Non-Cygwin binaries will bail out with errors during the build process or insert garbage. nx-libs-3.5.99.23/etc/keystrokes.cfg0000644000000000000000000000373713614532331013760 0ustar nx-libs-3.5.99.23/fix-patch-whitespace0000755000000000000000000000235613614532331014260 0ustar #!/bin/sh # Copyright (c) 2010 Keith Packard # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice (including the next # paragraph) shall be included in all copies or substantial portions of the # Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. git diff --check | sed -n 's!^\([^:]*\):\([^:]*\):.*!sed -i "\2 s/[ \t]*$//; \2 s/ *\t/\t/g" \1!p' | sh nx-libs-3.5.99.23/LICENSE0000644000000000000000000000274513614532331011324 0ustar Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) Copyright (c) 2008-2014 Oleksandr Shneyder Copyright (c) 2011-2016 Mike Gabriel Copyright (c) 2014-2016 Ulrich Sibiller Copyright (c) 2014-2016 Mihai Moldovan Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) nx-X11, NX extensions to X (nxcompext, nxcompshad), nxagent and nxproxy are copyright of the aforementioned copyright holders. Redistribution and use of this software is allowed according to the following terms: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License Version 2, and not any other version, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTA- BILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, you can request a copy to NoMachine or write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Parts of this software are derived from XFree86 and X.org projects. Other copyrights and the MIT/X11 license applies to different sources. Please check the applicable copyrights in each file or subdirectory. All rights reserved. nx-libs-3.5.99.23/LICENSE.nxcomp0000644000000000000000000001063213614532331012621 0ustar Copyright (c) 2001,2010 NoMachine (http://www.nomachine.com) Copyright (c) 2000,2003 Gian Filippo Pinzari Copyright (c) 2008-2014 Oleksandr Shneyder Copyright (c) 2011-2016 Mike Gabriel Copyright (c) 2014-2016 Ulrich Sibiller Copyright (c) 2014-2016 Mihai Moldovan Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) NXCOMP library and NX extensions to X are copyright of the aforementioned copyright holders. Redistribution and use of this software is allowed according to the following terms: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License Version 2, and not any other version, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTA- BILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, you can request a copy to NoMachine or write to the Free Software Foundation, Inc., 51 Franklin Street, Suite 330, Boston, MA 02110-1301 USA ============================================================================== Parts of this software are derived from DXPC project. These copyright notices apply to original DXPC code: Redistribution and use in source and binary forms are permitted provi- ded that the above copyright notice and this paragraph are duplicated in all such forms. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. Copyright (c) 1995,1996,2000,2006 Brian Pane Copyright (c) 1996,1997 Zachary Vonler and Brian Pane Copyright (c) 1999 Kevin Vigor and Brian Pane Copyright (c) 2000,2006 Gian Filippo Pinzari and Brian Pane All rights reserved. ============================================================================== Update 2015-05-21 on the nature of the original DXPC license: The original DXPC code used to be available under a license which failed to explicitly grant the permission to modify, but was later retroactively re-licensed under the 2-clause BSD license (see doc/nxcomp/README.on-retroactive-DXPC-license for the copyright owners' statements; also see for more details). In the course of discussion, it also became evident that Gian Filippo Pinzari never participated in any of the official DXPC releases, but rather worked on the forked code on the NoMachine side. Thus, we crossed-out his name in the above copyright notice and moved him to the top list of copyright holders associated with the GPL-2 re-licensing done by NoMachine. Thus, the version of DXPC where NXCOMP got forked from (most likely some DXPC version between release 3.7.0 and release 3.8.0) can be considered as BSD-2-clause, as quoted below: Copyright (c) 1995,1996 Brian Pane Copyright (c) 1996,1997 Zachary Vonler and Brian Pane Copyright (c) 1999-2002 Kevin Vigor and Brian Pane All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. nx-libs-3.5.99.23/m4/ax_cxx_compile_stdcxx_11.m40000644000000000000000000000321513614532331015772 0ustar # ============================================================================= # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html # ============================================================================= # # SYNOPSIS # # AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional]) # # DESCRIPTION # # Check for baseline language coverage in the compiler for the C++11 # standard; if necessary, add switches to CXX and CXXCPP to enable # support. # # This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX # macro with the version set to C++11. The two optional arguments are # forwarded literally as the second and third argument respectively. # Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for # more information. If you want to use this macro, you also need to # download the ax_cxx_compile_stdcxx.m4 file. # # LICENSE # # Copyright (c) 2008 Benjamin Kosnik # Copyright (c) 2012 Zack Weinberg # Copyright (c) 2013 Roy Stogner # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov # Copyright (c) 2015 Paul Norman # Copyright (c) 2015 Moritz Klammler # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 18 AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) nx-libs-3.5.99.23/m4/ax_cxx_compile_stdcxx.m40000644000000000000000000004564713614532331015510 0ustar # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html # =========================================================================== # # SYNOPSIS # # AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) # # DESCRIPTION # # Check for baseline language coverage in the compiler for the specified # version of the C++ standard. If necessary, add switches to CXX and # CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) # or '14' (for the C++14 standard). # # The second argument, if specified, indicates whether you insist on an # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. # -std=c++11). If neither is specified, you get whatever works, with # preference for an extended mode. # # The third argument, if specified 'mandatory' or if left unspecified, # indicates that baseline support for the specified C++ standard is # required and that the macro should error out if no mode with that # support is found. If specified 'optional', then configuration proceeds # regardless, after defining HAVE_CXX${VERSION} if and only if a # supporting mode is found. # # LICENSE # # Copyright (c) 2008 Benjamin Kosnik # Copyright (c) 2012 Zack Weinberg # Copyright (c) 2013 Roy Stogner # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov # Copyright (c) 2015 Paul Norman # Copyright (c) 2015 Moritz Klammler # Copyright (c) 2016, 2018 Krzesimir Nowak # Copyright (c) 2019 Enji Cooper # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 11 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl (serial version number 13). AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], [$1], [14], [ax_cxx_compile_alternatives="14 1y"], [$1], [17], [ax_cxx_compile_alternatives="17 1z"], [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$2], [], [], [$2], [ext], [], [$2], [noext], [], [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], [$3], [optional], [ax_cxx_compile_cxx$1_required=false], [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) AC_LANG_PUSH([C++])dnl ac_success=no m4_if([$2], [noext], [], [dnl if test x$ac_success = xno; then for alternative in ${ax_cxx_compile_alternatives}; do switch="-std=gnu++${alternative}" cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" CXX="$CXX $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], [eval $cachevar=yes], [eval $cachevar=no]) CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done fi]) m4_if([$2], [ext], [], [dnl if test x$ac_success = xno; then dnl HP's aCC needs +std=c++11 according to: dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf dnl Cray's crayCC needs "-h std=c++11" for alternative in ${ax_cxx_compile_alternatives}; do for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" CXX="$CXX $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], [eval $cachevar=yes], [eval $cachevar=no]) CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done if test x$ac_success = xyes; then break fi done fi]) AC_LANG_POP([C++]) if test x$ax_cxx_compile_cxx$1_required = xtrue; then if test x$ac_success = xno; then AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) fi fi if test x$ac_success = xno; then HAVE_CXX$1=0 AC_MSG_NOTICE([No compiler with C++$1 support was found]) else HAVE_CXX$1=1 AC_DEFINE(HAVE_CXX$1,1, [define if the compiler supports basic C++$1 syntax]) fi AC_SUBST(HAVE_CXX$1) ]) dnl Test body for checking C++11 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 ) dnl Test body for checking C++14 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 ) m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 ) dnl Tests for new features in C++11 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ // If the compiler admits that it is not ready for C++11, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201103L #error "This is not a C++11 compiler" #else namespace cxx11 { namespace test_static_assert { template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; } namespace test_final_override { struct Base { virtual ~Base() {} virtual void f() {} }; struct Derived : public Base { virtual ~Derived() override {} virtual void f() override {} }; } namespace test_double_right_angle_brackets { template < typename T > struct check {}; typedef check single_type; typedef check> double_type; typedef check>> triple_type; typedef check>>> quadruple_type; } namespace test_decltype { int f() { int a = 1; decltype(a) b = 2; return a + b; } } namespace test_type_deduction { template < typename T1, typename T2 > struct is_same { static const bool value = false; }; template < typename T > struct is_same { static const bool value = true; }; template < typename T1, typename T2 > auto add(T1 a1, T2 a2) -> decltype(a1 + a2) { return a1 + a2; } int test(const int c, volatile int v) { static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == false, ""); auto ac = c; auto av = v; auto sumi = ac + av + 'x'; auto sumf = ac + av + 1.0; static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == true, ""); return (sumf > 0.0) ? sumi : add(c, v); } } namespace test_noexcept { int f() { return 0; } int g() noexcept { return 0; } static_assert(noexcept(f()) == false, ""); static_assert(noexcept(g()) == true, ""); } namespace test_constexpr { template < typename CharT > unsigned long constexpr strlen_c_r(const CharT *const s, const unsigned long acc) noexcept { return *s ? strlen_c_r(s + 1, acc + 1) : acc; } template < typename CharT > unsigned long constexpr strlen_c(const CharT *const s) noexcept { return strlen_c_r(s, 0UL); } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("1") == 1UL, ""); static_assert(strlen_c("example") == 7UL, ""); static_assert(strlen_c("another\0example") == 7UL, ""); } namespace test_rvalue_references { template < int N > struct answer { static constexpr int value = N; }; answer<1> f(int&) { return answer<1>(); } answer<2> f(const int&) { return answer<2>(); } answer<3> f(int&&) { return answer<3>(); } void test() { int i = 0; const int c = 0; static_assert(decltype(f(i))::value == 1, ""); static_assert(decltype(f(c))::value == 2, ""); static_assert(decltype(f(0))::value == 3, ""); } } namespace test_uniform_initialization { struct test { static const int zero {}; static const int one {1}; }; static_assert(test::zero == 0, ""); static_assert(test::one == 1, ""); } namespace test_lambdas { void test1() { auto lambda1 = [](){}; auto lambda2 = lambda1; lambda1(); lambda2(); } int test2() { auto a = [](int i, int j){ return i + j; }(1, 2); auto b = []() -> int { return '0'; }(); auto c = [=](){ return a + b; }(); auto d = [&](){ return c; }(); auto e = [a, &b](int x) mutable { const auto identity = [](int y){ return y; }; for (auto i = 0; i < a; ++i) a += b--; return x + identity(a + b); }(0); return a + b + c + d + e; } int test3() { const auto nullary = [](){ return 0; }; const auto unary = [](int x){ return x; }; using nullary_t = decltype(nullary); using unary_t = decltype(unary); const auto higher1st = [](nullary_t f){ return f(); }; const auto higher2nd = [unary](nullary_t f1){ return [unary, f1](unary_t f2){ return f2(unary(f1())); }; }; return higher1st(nullary) + higher2nd(nullary)(unary); } } namespace test_variadic_templates { template struct sum; template struct sum { static constexpr auto value = N0 + sum::value; }; template <> struct sum<> { static constexpr auto value = 0; }; static_assert(sum<>::value == 0, ""); static_assert(sum<1>::value == 1, ""); static_assert(sum<23>::value == 23, ""); static_assert(sum<1, 2>::value == 3, ""); static_assert(sum<5, 5, 11>::value == 21, ""); static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); } // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function // because of this. namespace test_template_alias_sfinae { struct foo {}; template using member = typename T::member_type; template void func(...) {} template void func(member*) {} void test(); void test() { func(0); } } } // namespace cxx11 #endif // __cplusplus >= 201103L ]]) dnl Tests for new features in C++14 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ // If the compiler admits that it is not ready for C++14, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201402L #error "This is not a C++14 compiler" #else namespace cxx14 { namespace test_polymorphic_lambdas { int test() { const auto lambda = [](auto&&... args){ const auto istiny = [](auto x){ return (sizeof(x) == 1UL) ? 1 : 0; }; const int aretiny[] = { istiny(args)... }; return aretiny[0]; }; return lambda(1, 1L, 1.0f, '1'); } } namespace test_binary_literals { constexpr auto ivii = 0b0000000000101010; static_assert(ivii == 42, "wrong value"); } namespace test_generalized_constexpr { template < typename CharT > constexpr unsigned long strlen_c(const CharT *const s) noexcept { auto length = 0UL; for (auto p = s; *p; ++p) ++length; return length; } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("x") == 1UL, ""); static_assert(strlen_c("test") == 4UL, ""); static_assert(strlen_c("another\0test") == 7UL, ""); } namespace test_lambda_init_capture { int test() { auto x = 0; const auto lambda1 = [a = x](int b){ return a + b; }; const auto lambda2 = [a = lambda1(x)](){ return a; }; return lambda2(); } } namespace test_digit_separators { constexpr auto ten_million = 100'000'000; static_assert(ten_million == 100000000, ""); } namespace test_return_type_deduction { auto f(int& x) { return x; } decltype(auto) g(int& x) { return x; } template < typename T1, typename T2 > struct is_same { static constexpr auto value = false; }; template < typename T > struct is_same { static constexpr auto value = true; }; int test() { auto x = 0; static_assert(is_same::value, ""); static_assert(is_same::value, ""); return x; } } } // namespace cxx14 #endif // __cplusplus >= 201402L ]]) dnl Tests for new features in C++17 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ // If the compiler admits that it is not ready for C++17, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201703L #error "This is not a C++17 compiler" #else #include #include #include namespace cxx17 { namespace test_constexpr_lambdas { constexpr int foo = [](){return 42;}(); } namespace test::nested_namespace::definitions { } namespace test_fold_expression { template int multiply(Args... args) { return (args * ... * 1); } template bool all(Args... args) { return (args && ...); } } namespace test_extended_static_assert { static_assert (true); } namespace test_auto_brace_init_list { auto foo = {5}; auto bar {5}; static_assert(std::is_same, decltype(foo)>::value); static_assert(std::is_same::value); } namespace test_typename_in_template_template_parameter { template typename X> struct D; } namespace test_fallthrough_nodiscard_maybe_unused_attributes { int f1() { return 42; } [[nodiscard]] int f2() { [[maybe_unused]] auto unused = f1(); switch (f1()) { case 17: f1(); [[fallthrough]]; case 42: f1(); } return f1(); } } namespace test_extended_aggregate_initialization { struct base1 { int b1, b2 = 42; }; struct base2 { base2() { b3 = 42; } int b3; }; struct derived : base1, base2 { int d; }; derived d1 {{1, 2}, {}, 4}; // full initialization derived d2 {{}, {}, 4}; // value-initialized bases } namespace test_general_range_based_for_loop { struct iter { int i; int& operator* () { return i; } const int& operator* () const { return i; } iter& operator++() { ++i; return *this; } }; struct sentinel { int i; }; bool operator== (const iter& i, const sentinel& s) { return i.i == s.i; } bool operator!= (const iter& i, const sentinel& s) { return !(i == s); } struct range { iter begin() const { return {0}; } sentinel end() const { return {5}; } }; void f() { range r {}; for (auto i : r) { [[maybe_unused]] auto v = i; } } } namespace test_lambda_capture_asterisk_this_by_value { struct t { int i; int foo() { return [*this]() { return i; }(); } }; } namespace test_enum_class_construction { enum class byte : unsigned char {}; byte foo {42}; } namespace test_constexpr_if { template int f () { if constexpr(cond) { return 13; } else { return 42; } } } namespace test_selection_statement_with_initializer { int f() { return 13; } int f2() { if (auto i = f(); i > 0) { return 3; } switch (auto i = f(); i + 4) { case 17: return 2; default: return 1; } } } namespace test_template_argument_deduction_for_class_templates { template struct pair { pair (T1 p1, T2 p2) : m1 {p1}, m2 {p2} {} T1 m1; T2 m2; }; void f() { [[maybe_unused]] auto p = pair{13, 42u}; } } namespace test_non_type_auto_template_parameters { template struct B {}; B<5> b1; B<'a'> b2; } namespace test_structured_bindings { int arr[2] = { 1, 2 }; std::pair pr = { 1, 2 }; auto f1() -> int(&)[2] { return arr; } auto f2() -> std::pair& { return pr; } struct S { int x1 : 2; volatile double y1; }; S f3() { return {}; } auto [ x1, y1 ] = f1(); auto& [ xr1, yr1 ] = f1(); auto [ x2, y2 ] = f2(); auto& [ xr2, yr2 ] = f2(); const auto [ x3, y3 ] = f3(); } namespace test_exception_spec_type_system { struct Good {}; struct Bad {}; void g1() noexcept; void g2(); template Bad f(T*, T*); template Good f(T1*, T2*); static_assert (std::is_same_v); } namespace test_inline_variables { template void f(T) {} template inline T g(T) { return T{}; } template<> inline void f<>(int) {} template<> int g<>(int) { return 5; } } } // namespace cxx17 #endif // __cplusplus < 201703L ]]) nx-libs-3.5.99.23/m4/ax_pthread.m40000644000000000000000000005441713614532331013223 0ustar # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_pthread.html # =========================================================================== # # SYNOPSIS # # AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) # # DESCRIPTION # # This macro figures out how to build C programs using POSIX threads. It # sets the PTHREAD_LIBS output variable to the threads library and linker # flags, and the PTHREAD_CFLAGS output variable to any special C compiler # flags that are needed. (The user can also force certain compiler # flags/libs to be tested by setting these environment variables.) # # Also sets PTHREAD_CC to any special C compiler that is needed for # multi-threaded programs (defaults to the value of CC otherwise). (This # is necessary on AIX to use the special cc_r compiler alias.) # # NOTE: You are assumed to not only compile your program with these flags, # but also to link with them as well. For example, you might link with # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS # # If you are only building threaded programs, you may wish to use these # variables in your default LIBS, CFLAGS, and CC: # # LIBS="$PTHREAD_LIBS $LIBS" # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # CC="$PTHREAD_CC" # # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant # has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to # that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). # # Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the # PTHREAD_PRIO_INHERIT symbol is defined when compiling with # PTHREAD_CFLAGS. # # ACTION-IF-FOUND is a list of shell commands to run if a threads library # is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it # is not found. If ACTION-IF-FOUND is not specified, the default action # will define HAVE_PTHREAD. # # Please let the authors know if this macro fails on any platform, or if # you have any other suggestions or comments. This macro was based on work # by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help # from M. Frigo), as well as ac_pthread and hb_pthread macros posted by # Alejandro Forero Cuervo to the autoconf macro repository. We are also # grateful for the helpful feedback of numerous users. # # Updated for Autoconf 2.68 by Daniel Richard G. # # LICENSE # # Copyright (c) 2008 Steven G. Johnson # Copyright (c) 2011 Daniel Richard G. # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 25 #arctica-serial 1 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_SED]) AC_LANG_PUSH([C]) ax_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on Tru64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then ax_pthread_save_CC="$CC" ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) AC_MSG_RESULT([$ax_pthread_ok]) if test "x$ax_pthread_ok" = "xno"; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi CC="$ax_pthread_save_CC" CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 # (Note: HP C rejects this with "bad form for `-t' option") # -pthreads: Solaris/gcc (Note: HP C also rejects) # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads and # -D_REENTRANT too), HP C (must be checked before -lpthread, which # is present but should not be used directly; and before -mthreads, # because the compiler interprets this as "-mt" + "-hreads") # -mthreads: Mingw32/gcc, Lynx/gcc # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case $host_os in freebsd*) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) ax_pthread_flags="-kthread lthread $ax_pthread_flags" ;; hpux*) # From the cc(1) man page: "[-mt] Sets various -D flags to enable # multi-threading and also sets -lpthread." ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" ;; openedition*) # IBM z/OS requires a feature-test macro to be defined in order to # enable POSIX threads at all, so give the user a hint if this is # not set. (We don't define these ourselves, as they can affect # other portions of the system API in unpredictable ways.) AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], [ # if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) AX_PTHREAD_ZOS_MISSING # endif ], [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) ;; solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (N.B.: The stubs are missing # pthread_cleanup_push, or rather a function called by this macro, # so we could check for that, but who knows whether they'll stub # that too in a future libc.) So we'll check first for the # standard Solaris way of linking pthreads (-mt -lpthread). ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" ;; esac # GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) AS_IF([test "x$GCC" = "xyes"], [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"]) # The presence of a feature test macro requesting re-entrant function # definitions is, on some systems, a strong hint that pthreads support is # correctly enabled case $host_os in darwin* | hpux* | linux* | osf* | solaris*) ax_pthread_check_macro="_REENTRANT" ;; aix*) ax_pthread_check_macro="_THREAD_SAFE" ;; *) ax_pthread_check_macro="--" ;; esac AS_IF([test "x$ax_pthread_check_macro" = "x--"], [ax_pthread_check_cond=0], [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) # Are we compiling with Clang? AC_CACHE_CHECK([whether $CC is Clang], [ax_cv_PTHREAD_CLANG], [ax_cv_PTHREAD_CLANG=no # Note that Autoconf sets GCC=yes for Clang as well as GCC if test "x$GCC" = "xyes"; then AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ # if defined(__clang__) && defined(__llvm__) AX_PTHREAD_CC_IS_CLANG # endif ], [ax_cv_PTHREAD_CLANG=yes]) fi ]) ax_pthread_clang="$ax_cv_PTHREAD_CLANG" ax_pthread_clang_warning=no # Clang needs special handling, because older versions handle the -pthread # option in a rather... idiosyncratic way if test "x$ax_pthread_clang" = "xyes"; then # Clang takes -pthread; it has never supported any other flag # (Note 1: This will need to be revisited if a system that Clang # supports has POSIX threads in a separate library. This tends not # to be the way of modern systems, but it's conceivable.) # (Note 2: On some systems, notably Darwin, -pthread is not needed # to get POSIX threads support; the API is always present and # active. We could reasonably leave PTHREAD_CFLAGS empty. But # -pthread does define _REENTRANT, and while the Darwin headers # ignore this macro, third-party headers might not.) PTHREAD_CFLAGS="-pthread" PTHREAD_LIBS= ax_pthread_ok=yes # However, older versions of Clang make a point of warning the user # that, in an invocation where only linking and no compilation is # taking place, the -pthread option has no effect ("argument unused # during compilation"). They expect -pthread to be passed in only # when source code is being compiled. # # Problem is, this is at odds with the way Automake and most other # C build frameworks function, which is that the same flags used in # compilation (CFLAGS) are also used in linking. Many systems # supported by AX_PTHREAD require exactly this for POSIX threads # support, and in fact it is often not straightforward to specify a # flag that is used only in the compilation phase and not in # linking. Such a scenario is extremely rare in practice. # # Even though use of the -pthread flag in linking would only print # a warning, this can be a nuisance for well-run software projects # that build with -Werror. So if the active version of Clang has # this misfeature, we search for an option to squash it. AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown # Create an alternate version of $ac_link that compiles and # links in two steps (.c -> .o, .o -> exe) instead of one # (.c -> exe), because the warning occurs only in the second # step ax_pthread_save_ac_link="$ac_link" ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" ax_pthread_save_CFLAGS="$CFLAGS" for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" ac_link="$ax_pthread_save_ac_link" AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], [ac_link="$ax_pthread_2step_ac_link" AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], [break]) ]) done ac_link="$ax_pthread_save_ac_link" CFLAGS="$ax_pthread_save_CFLAGS" AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" ]) case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in no | unknown) ;; *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; esac fi # $ax_pthread_clang = yes if test "x$ax_pthread_ok" = "xno"; then for ax_pthread_try_flag in $ax_pthread_flags; do case $ax_pthread_try_flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; -mt,pthread) AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) PTHREAD_CFLAGS="-mt" PTHREAD_LIBS="-lpthread" ;; -pthread) AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) PTHREAD_CFLAGS="$ax_pthread_try_flag" if test "x$GCC" = "xyes"; then # Thanks to libtool bug #13550, we have to consider the possibility # that -nostdlib will be used during compilation at some point. # Try to determine the first pthread library available, # ignoring any other variants. for ax_pthread_try_lib_flag in $ax_pthread_flags; do case $ax_pthread_try_lib_flag in none|-*|pthread-config) continue ;; *) PTHREAD_LIBS="-l$ax_pthread_try_lib_flag" ax_pthread_save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" # We only need to link a trivial program with # the current library value. # Linking should fail if the library doesn't # exist, otherwise we should be good to go. AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [LIBS="$ax_pthread_save_LIBS" break], [LIBS="$ax_pthread_save_LIBS" PTHREAD_LIBS=""]) ;; esac done fi ;; -*) AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) PTHREAD_CFLAGS="$ax_pthread_try_flag" ;; pthread-config) AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) PTHREAD_LIBS="-l$ax_pthread_try_flag" ;; esac ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. AC_LINK_IFELSE([AC_LANG_PROGRAM([#include # if $ax_pthread_check_cond # error "$ax_pthread_check_macro must be defined" # endif static void routine(void *a) { a = 0; } static void *start_routine(void *a) { return a; }], [pthread_t th; pthread_attr_t attr; pthread_create(&th, 0, start_routine, 0); pthread_join(th, 0); pthread_attr_init(&attr); pthread_cleanup_push(routine, 0); pthread_cleanup_pop(0) /* ; */])], [ax_pthread_ok=yes], []) CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" AC_MSG_RESULT([$ax_pthread_ok]) AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$ax_pthread_ok" = "xyes"; then ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. AC_CACHE_CHECK([for joinable pthread attribute], [ax_cv_PTHREAD_JOINABLE_ATTR], [ax_cv_PTHREAD_JOINABLE_ATTR=unknown for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [int attr = $ax_pthread_attr; return attr /* ; */])], [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], []) done ]) AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ test "x$ax_pthread_joinable_attr_defined" != "xyes"], [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$ax_cv_PTHREAD_JOINABLE_ATTR], [Define to necessary symbol if this constant uses a non-standard name on your system.]) ax_pthread_joinable_attr_defined=yes ]) AC_CACHE_CHECK([whether more special flags are required for pthreads], [ax_cv_PTHREAD_SPECIAL_FLAGS], [ax_cv_PTHREAD_SPECIAL_FLAGS=no case $host_os in solaris*) ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" ;; esac ]) AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ test "x$ax_pthread_special_flags_added" != "xyes"], [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" ax_pthread_special_flags_added=yes]) AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], [ax_cv_PTHREAD_PRIO_INHERIT], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[int i = PTHREAD_PRIO_INHERIT; return i;]])], [ax_cv_PTHREAD_PRIO_INHERIT=yes], [ax_cv_PTHREAD_PRIO_INHERIT=no]) ]) AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ test "x$ax_pthread_prio_inherit_defined" != "xyes"], [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) ax_pthread_prio_inherit_defined=yes ]) CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" # More AIX lossage: compile with *_r variant if test "x$GCC" != "xyes"; then case $host_os in aix*) AS_CASE(["x/$CC"], [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], [#handle absolute path differently from PATH based program lookup AS_CASE(["x$CC"], [x/*], [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) ;; esac fi fi test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" AC_SUBST([PTHREAD_LIBS]) AC_SUBST([PTHREAD_CFLAGS]) AC_SUBST([PTHREAD_CC]) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test "x$ax_pthread_ok" = "xyes"; then ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) : else ax_pthread_ok=no $2 fi AC_LANG_POP ])dnl AX_PTHREAD nx-libs-3.5.99.23/m4/nx-macros.m40000644000000000000000000004165413614532331013012 0ustar dnl nx-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. dnl dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. dnl Copyright (c) 2017, Mike Gabriel dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the "Software"), dnl to deal in the Software without restriction, including without limitation dnl the rights to use, copy, modify, merge, publish, distribute, sublicense, dnl and/or sell copies of the Software, and to permit persons to whom the dnl Software is furnished to do so, subject to the following conditions: dnl dnl The above copyright notice and this permission notice (including the next dnl paragraph) shall be included in all copies or substantial portions of the dnl Software. dnl dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER dnl DEALINGS IN THE SOFTWARE. # NX_COMPILER_BRAND # ------------------- # Checks for various brands of compilers and sets flags as appropriate: # GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes" # GNU g++ - relies on AC_PROG_CXX to set GXX to "yes" # clang compiler - sets CLANGCC to "yes" # Intel compiler - sets INTELCC to "yes" # Sun/Oracle Solaris Studio cc - sets SUNCC to "yes" # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_COMPILER_BRAND], [ AC_LANG_CASE( [C], [ AC_REQUIRE([AC_PROG_CC_C99]) ], [C++], [ AC_REQUIRE([AC_PROG_CXX]) ] ) AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"]) AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) ]) # NX_COMPILER_BRAND # NX_TESTSET_CFLAG(, , [, ...]) # --------------- # Test if the compiler works when passed the given flag as a command line argument. # If it succeeds, the flag is appended to the given variable. If not, it tries the # next flag in the list until there are no more options. # # Note that this does not guarantee that the compiler supports the flag as some # compilers will simply ignore arguments that they do not understand, but we do # attempt to weed out false positives by using -Werror=unknown-warning-option and # -Werror=unused-command-line-argument # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_TESTSET_CFLAG], [ m4_if([$#], 0, [m4_fatal([NX_TESTSET_CFLAG was given with an unsupported number of arguments])]) m4_if([$#], 1, [m4_fatal([NX_TESTSET_CFLAG was given with an unsupported number of arguments])]) AC_LANG_COMPILER_REQUIRE AC_LANG_CASE( [C], [ AC_REQUIRE([AC_PROG_CC_C99]) define([PREFIX], [C]) define([CACHE_PREFIX], [cc]) define([COMPILER], [$CC]) ], [C++], [ define([PREFIX], [CXX]) define([CACHE_PREFIX], [cxx]) define([COMPILER], [$CXX]) ] ) [nx_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]" if test "x$[nx_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option], AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no])) [nx_testset_]CACHE_PREFIX[_unknown_warning_option]=$[nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option] PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" fi if test "x$[nx_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then if test "x$[nx_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" fi PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument], AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no])) [nx_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument] PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" fi found="no" m4_foreach([flag], m4_cdr($@), [ if test $found = "no" ; then if test "x$nx_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" fi if test "x$nx_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" fi PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag[" dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[]) cacheid=AS_TR_SH([nx_cv_]CACHE_PREFIX[_flag_]flag[]) AC_CACHE_VAL($cacheid, [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])], [eval $cacheid=yes], [eval $cacheid=no])]) PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" eval supported=\$$cacheid AC_MSG_RESULT([$supported]) if test "$supported" = "yes" ; then $1="$$1 ]flag[" found="yes" fi fi ]) ]) # NX_TESTSET_CFLAG # NX_COMPILER_FLAGS # --------------- # Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line # arguments supported by the selected compiler which do NOT alter the generated # code. These arguments will cause the compiler to print various warnings # during compilation AND turn a conservative set of warnings into errors. # # The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in # future versions of util-macros as options are added to new compilers. # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_COMPILER_FLAGS], [ AC_REQUIRE([NX_COMPILER_BRAND]) AC_ARG_ENABLE(selective-werror, AS_HELP_STRING([--disable-selective-werror], [Turn off selective compiler errors. (default: enabled)]), [SELECTIVE_WERROR=$enableval], [SELECTIVE_WERROR=yes]) AC_LANG_CASE( [C], [ define([PREFIX], [C]) ], [C++], [ define([PREFIX], [CXX]) ] ) # -v is too short to test reliably with NX_TESTSET_CFLAG if test "x$SUNCC" = "xyes"; then [BASE_]PREFIX[FLAGS]="-v" else [BASE_]PREFIX[FLAGS]="" fi # This chunk of warnings were those that existed in the legacy CWARNFLAGS NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat]) AC_LANG_CASE( [C], [ NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement]) ] ) # This chunk adds additional warnings that could catch undesired effects. NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) # These are currently disabled because they are noisy. They will be enabled # in the future once the codebase is sufficiently modernized to silence # them. For now, I don't want them to drown out the other warnings. # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) # Turn some warnings into errors, so we don't accidentally get successful builds # when there are problems that should be fixed. if test "x$SELECTIVE_WERROR" = "xyes" ; then NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION else AC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors. This should not be necessary. Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast]) fi AC_SUBST([BASE_]PREFIX[FLAGS]) ]) # NX_COMPILER_FLAGS # NX_STRICT_OPTION # ----------------------- # # Add configure option to enable strict compilation flags, such as treating # warnings as fatal errors. # If --enable-strict-compilation is passed to configure, adds strict flags to # $BASE_CFLAGS or $BASE_CXXFLAGS. # # Also exports $STRICT_CFLAGS for use in other tests or when strict compilation # is unconditionally desired. AC_DEFUN([NX_STRICT_OPTION], [ AC_REQUIRE([NX_COMPILER_FLAGS]) AC_ARG_ENABLE(strict-compilation, AS_HELP_STRING([--enable-strict-compilation], [Enable all warnings from compiler and make them errors (default: disabled)]), [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) AC_LANG_CASE( [C], [ define([PREFIX], [C]) ], [C++], [ define([PREFIX], [CXX]) ] ) [STRICT_]PREFIX[FLAGS]="" NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic]) NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn]) # Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not # activate it with -Werror, so we add it here explicitly. NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes]) if test "x$STRICT_COMPILE" = "xyes"; then [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]" fi AC_SUBST([STRICT_]PREFIX[FLAGS]) AC_SUBST([BASE_]PREFIX[FLAGS]) ]) # NX_STRICT_OPTION # NX_DEFAULT_OPTIONS # -------------------- # # Defines default options for X.Org-like modules. # AC_DEFUN([NX_DEFAULT_OPTIONS], [ AC_REQUIRE([AC_PROG_INSTALL]) NX_COMPILER_FLAGS NX_STRICT_OPTION m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) ]) # NX_DEFAULT_OPTIONS # NX_CHECK_MALLOC_ZERO # ---------------------- # Minimum version: 1.0.0 # # Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if # malloc(0) returns NULL. Packages should add one of these cflags to # their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. AC_DEFUN([NX_CHECK_MALLOC_ZERO],[ AC_ARG_ENABLE(malloc0returnsnull, AS_HELP_STRING([--enable-malloc0returnsnull], [malloc(0) returns NULL (default: auto)]), [MALLOC_ZERO_RETURNS_NULL=$enableval], [MALLOC_ZERO_RETURNS_NULL=auto]) AC_MSG_CHECKING([whether malloc(0) returns NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then AC_RUN_IFELSE([AC_LANG_PROGRAM([ #include ],[ char *m0, *r0, *c0, *p; m0 = malloc(0); p = malloc(10); r0 = realloc(p,0); c0 = calloc(0,10); exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); ])], [MALLOC_ZERO_RETURNS_NULL=yes], [MALLOC_ZERO_RETURNS_NULL=no], [MALLOC_ZERO_RETURNS_NULL=yes]) fi AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL" XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC" else MALLOC_ZERO_CFLAGS="" XMALLOC_ZERO_CFLAGS="" XTMALLOC_ZERO_CFLAGS="" fi AC_SUBST([MALLOC_ZERO_CFLAGS]) AC_SUBST([XMALLOC_ZERO_CFLAGS]) AC_SUBST([XTMALLOC_ZERO_CFLAGS]) ]) # NX_CHECK_MALLOC_ZERO dnl Check to see if we're running under Cygwin32. AC_DEFUN([NX_BUILD_ON_CYGWIN32], [AC_CACHE_CHECK([for Cygwin32 environment], nxconf_cv_cygwin32, [AC_TRY_COMPILE(,[return __CYGWIN32__;], nxconf_cv_cygwin32=yes, nxconf_cv_cygwin32=no) rm -f conftest*]) CYGWIN32= test "$nxconf_cv_cygwin32" = yes && CYGWIN32=yes ]) # NX_BUILD_ON_CYGWIN32 dnl Check whether we're building on a AMD64. AC_DEFUN([NX_BUILD_ON_AMD64], [AC_CACHE_CHECK([for Amd64 environment], nxconf_cv_amd64, [AC_TRY_COMPILE(,[return (__amd64__ || __x86_64__);], nxconf_cv_amd64=yes, nxconf_cv_amd64=no) rm -f conftest*]) AMD64= test "$nxconf_cv_amd64" = yes && AMD64=yes ]) # NX_BUILD_ON_AMD64 dnl Check for Darwin environment. AC_DEFUN([NX_BUILD_ON_DARWIN], [AC_CACHE_CHECK([for Darwin environment], nxconf_cv_darwin, [AC_TRY_COMPILE(,[return __APPLE__;], nxconf_cv_darwin=yes, nxconf_cv_darwin=no) rm -f conftest*]) DARWIN= test "$nxconf_cv_darwin" = yes && DARWIN=yes ]) # NX_BUILD_ON_DARWIN # Check to see if we're running under Solaris. AC_DEFUN([NX_BUILD_ON_SUN], [AC_CACHE_CHECK([for Solaris environment], nxconf_cv_sun, [AC_TRY_COMPILE(,[return __sun;], nxconf_cv_sun=yes, nxconf_cv_sun=no) rm -f conftest*]) SUN= test "$nxconf_cv_sun" = yes && SUN=yes ]) # NX_BUILD_ON_SUN # Check to see if we're running under FreeBSD. AC_DEFUN([NX_BUILD_ON_FreeBSD], [AC_CACHE_CHECK([for FreeBSD environment], nxconf_cv_freebsd, [AC_TRY_COMPILE(,[return __FreeBSD__;], nxconf_cv_freebsd=yes, nxconf_cv_freebsd=no) rm -f conftest*]) FreeBSD= test "$nxconf_cv_freebsd" = yes && FreeBSD=yes ]) # NX_BUILD_ON_FreeBSD # Check to see if we're generating binaries in ELF format. AC_DEFUN([NX_TARGET_USE_ELF], [AC_CACHE_CHECK([if target system is ELF-based], [nxconf_cv_targetelf], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[ #ifndef __ELF__ #error not an ELF-based system error! #endif ]], [[ ]])], [nxconf_cv_targetelf=yes], [nxconf_cv_targetelf=no])]) AM_CONDITIONAL([TARGET_ELF], [test x"$nxconf_cv_targetelf" = "xyes"]) ]) # NX_TARGET_USE_ELF AC_DEFUN([LIBJPEG_FALLBACK_CHECK],[ AC_MSG_CHECKING([for libjpeg shared library file and headers]) AC_CHECK_LIB([jpeg], [jpeg_destroy_compress], [have_jpeg_lib=yes], [have_jpeg_lib=no]) AC_CHECK_HEADERS([jpeglib.h], [have_jpeg_headers=yes], [have_jpeg_headers=no]) if test x"$have_jpeg_lib" = "xyes" && test x"$have_jpeg_headers" = "xyes"; then AC_MSG_RESULT([yes]) JPEG_CFLAGS="" JPEG_LIBS="-ljpeg" else AC_MSG_RESULT([no]) AC_MSG_FAILURE([Could not find libjpeg on your system, make sure the JPEG shared library and header files are installed.]) fi ]) # LIBJPEG_FALLBACK_CHECK AC_DEFUN([ZLIB_FALLBACK_CHECK],[ AC_MSG_CHECKING([for zlib shared library file and headers]) AC_CHECK_LIB([z], [inflateEnd], [have_zlib_lib=yes], [have_zlib_lib=no]) AC_CHECK_HEADERS([zlib.h], [have_zlib_headers=yes], [have_zlib_headers=no]) if test x"$have_zlib_lib" = "xyes" && test x"$have_zlib_headers" = "xyes"; then AC_MSG_RESULT([yes]) Z_CFLAGS="" Z_LIBS="-lz" else AC_MSG_RESULT([no]) AC_MSG_FAILURE([Could not find zlib on your system, make sure the zlib shared library and header files are installed.]) fi ]) # ZLIB_FALLBACK_CHECK nx-libs-3.5.99.23/m4/nx-xtrans.m40000644000000000000000000001454513614532331013044 0ustar dnl dnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the "Software"), dnl to deal in the Software without restriction, including without limitation dnl the rights to use, copy, modify, merge, publish, distribute, sublicense, dnl and/or sell copies of the Software, and to permit persons to whom the dnl Software is furnished to do so, subject to the following conditions: dnl dnl The above copyright notice and this permission notice (including the next dnl paragraph) shall be included in all copies or substantial portions of the dnl Software. dnl dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER dnl DEALINGS IN THE SOFTWARE. dnl # NX_XTRANS_TCP_FLAGS() # ------------------ # Find needed libraries for TCP sockets, and check for IPv6 support AC_DEFUN([NX_XTRANS_TCP_FLAGS],[ # SVR4 hides these in libraries other than libc AC_SEARCH_LIBS(socket, [socket]) AC_SEARCH_LIBS(gethostbyname, [nsl]) if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then AC_CHECK_LIB([ws2_32],[main]) fi # Needs to come after above checks for libsocket & libnsl for SVR4 systems AC_ARG_ENABLE(ipv6, AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]), [IPV6CONN=$enableval], [AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])]) AC_MSG_CHECKING([if IPv6 support should be built]) if test "$IPV6CONN" = "yes"; then AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections]) fi AC_MSG_RESULT($IPV6CONN) # 4.3BSD-Reno added a new member to struct sockaddr_in AC_CHECK_MEMBER([struct sockaddr_in.sin_len], AC_DEFINE([BSD44SOCKETS],1, [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [ #include #include #include ]) # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc. AC_CHECK_TYPES([socklen_t], [], [], [ AC_INCLUDES_DEFAULT #include ]) # XPG4v2/UNIX95 added msg_control - check to see if we need to define # _XOPEN_SOURCE to get it (such as on Solaris) AC_CHECK_MEMBER([struct msghdr.msg_control], [], [], [ AC_INCLUDES_DEFAULT #include ]) # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03 if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then unset ac_cv_member_struct_msghdr_msg_control AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600]) AC_CHECK_MEMBER([struct msghdr.msg_control], [AC_DEFINE([_XOPEN_SOURCE], [600], [Defined if needed to expose struct msghdr.msg_control]) ], [], [ #define _XOPEN_SOURCE 600 AC_INCLUDES_DEFAULT #include ]) fi # If that didn't work, fall back to XPG5/UNIX98 with C89 if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then unset ac_cv_member_struct_msghdr_msg_control AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500]) AC_CHECK_MEMBER([struct msghdr.msg_control], [AC_DEFINE([_XOPEN_SOURCE], [500], [Defined if needed to expose struct msghdr.msg_control]) ], [], [ #define _XOPEN_SOURCE 500 AC_INCLUDES_DEFAULT #include ]) fi ]) # NX_XTRANS_TCP_FLAGS # NX_XTRANS_CONNECTION_FLAGS() # ------------------------- # Standard checks for which Xtrans transports to use by the Xorg packages # that use Xtrans functions AC_DEFUN([NX_XTRANS_CONNECTION_FLAGS],[ AC_REQUIRE([AC_CANONICAL_HOST]) [case $host_os in mingw*) unixdef="no" ;; *) unixdef="yes" ;; esac] AC_ARG_ENABLE(unix-transport, AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]), [UNIXCONN=$enableval], [UNIXCONN=$unixdef]) AC_MSG_CHECKING([if Xtrans should support UNIX socket connections]) if test "$UNIXCONN" = "yes"; then AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections]) fi AC_MSG_RESULT($UNIXCONN) AC_ARG_ENABLE(tcp-transport, AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]), [TCPCONN=$enableval], [TCPCONN=yes]) AC_MSG_CHECKING([if Xtrans should support TCP socket connections]) AC_MSG_RESULT($TCPCONN) if test "$TCPCONN" = "yes"; then AC_DEFINE(TCPCONN,1,[Support TCP socket connections]) NX_XTRANS_TCP_FLAGS fi AC_ARG_ENABLE(nxcomp-transport, AS_HELP_STRING([--enable-nxcomp-transport],[Enable nxcomp mediated transport]), [NXCOMPCONN=$enableval], [NXCOMPCONN=yes]) AC_MSG_CHECKING([if Xtrans should support nxcomp mediated connections]) AC_MSG_RESULT($NXCOMPCONN) if test "$NXCOMPCONN" = "yes"; then AC_DEFINE(NX_TRANS_SOCKET,1,[Support nxcomp mediated socket connections]) AC_DEFINE(NX_TRANS_EXIT,1,[Support nxcomp NX_TRANS_EXIT feature]) NX_XTRANS_TCP_FLAGS fi ]) # NX_XTRANS_CONNECTION_FLAGS # NX_XTRANS_SECURE_RPC_FLAGS() # ------------------------- # Check for Secure RPC functions - must come after NX_XTRANS_TCP_FLAGS # so that any necessary networking libraries are already found AC_DEFUN([NX_XTRANS_SECURE_RPC_FLAGS], [AC_REQUIRE([NX_XTRANS_TCP_FLAGS]) AC_ARG_ENABLE(secure-rpc, AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]), [SECURE_RPC=$enableval], [SECURE_RPC="try"]) if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then FOUND_SECURE_RPC="no" AC_CHECK_FUNCS([authdes_seccreate authdes_create], [FOUND_SECURE_RPC="yes"]) if test "x$FOUND_SECURE_RPC" = "xno" ; then if test "x$SECURE_RPC" = "xyes" ; then AC_MSG_ERROR([Secure RPC requested, but required functions not found]) fi SECURE_RPC="no" else dnl FreeBSD keeps getsecretkey in librpcsvc AC_SEARCH_LIBS(getsecretkey, [rpcsvc]) SECURE_RPC="yes" fi fi AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported]) if test "x$SECURE_RPC" = "xyes" ; then AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients]) fi AC_MSG_RESULT($SECURE_RPC) ]) # NX_XTRANS_SECURE_RPC_FLAGS nx-libs-3.5.99.23/make-changelog.sh0000755000000000000000000000154613614532331013516 0ustar #!/bin/bash # Copyright (C) 2016 Mike Gabriel # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. git --no-pager log --format="%ai %aN (%h)%n%n%x09*%w(68,0,10) %s%d%n" > ChangeLog nx-libs-3.5.99.23/Makefile0000644000000000000000000002436313614532331011757 0ustar #!/usr/bin/make -f NULL = # helpers for "install" target INSTALL_DIR=install -d -m 755 INSTALL_FILE=install -m 644 INSTALL_PROGRAM=install -m 755 INSTALL_SYMLINK=ln -s -f # helpers for "build" target SYMLINK_FILE=ln -f -s # helpers for "clean" and "uninstall" targets RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty RM_DIR_REC=rm -Rf ETCDIR_NX ?= /etc/nxagent PREFIX ?= /usr/local BINDIR ?= $(PREFIX)/bin LIBDIR ?= $(PREFIX)/lib SHLIBDIR ?= $(LIBDIR) NXLIBDIR ?= $(SHLIBDIR)/nx USRLIBDIR ?= $(NXLIBDIR)/X11 INCLUDEDIR ?= $(PREFIX)/include CONFIGURE ?= ./configure --prefix="$(PREFIX)" # check if the xkbcomp devel pkg is available - we need it for the next step ifneq ($(shell pkg-config --exists xkbcomp && echo yes), yes) $(warning xkbcomp devel package missing, using imake default values) endif ifneq ($(shell pkg-config --exists fontutil && echo yes), yes) $(warning fontutil devel package missing, using imake default values) endif ifneq "$(strip $(NX_VERSION_CUSTOM))" "" CUSTOM_VERSION_DEFINE = NX_VERSION_CUSTOM="$(NX_VERSION_CUSTOM)" endif IMAKE_DEFINES ?= SHELL:=/bin/bash NX_X11_HEADERS = \ Xlib.h \ Xresource.h \ Xutil.h \ cursorfont.h \ Xlibint.h \ Xcms.h \ Xlocale.h \ XKBlib.h \ XlibConf.h \ Xregion.h \ ImUtil.h \ $(NULL) NX_XTRANS_HEADERS = \ transport.c \ Xtrans.c \ Xtrans.h \ Xtransint.h \ Xtranslcl.c \ Xtranssock.c \ Xtransutil.c \ $(NULL) all: build clean: version imakeconfig test -f nxcomp/Makefile && ${MAKE} -C nxcomp clean || true test -f nxproxy/Makefile && ${MAKE} -C nxproxy clean || true test -f nx-X11/lib/Makefile && ${MAKE} -C nx-X11/lib clean || true test -f nxcompshad/Makefile && ${MAKE} -C nxcompshad clean || true test -d nx-X11 && ${MAKE} clean-env || true test -f nxdialog/Makefile && ${MAKE} -C nxdialog clean || true distclean: clean version imakeconfig test -f nxcomp/Makefile && ${MAKE} -C nxcomp distclean || true test -f nxproxy/Makefile && ${MAKE} -C nxproxy distclean || true test -f nx-X11/lib/Makefile && ${MAKE} -C nx-X11/lib distclean || true test -f nxcompshad/Makefile && ${MAKE} -C nxcompshad distclean || true test -d nx-X11 && ${MAKE} -C nx-X11 distclean || true test -f nxdialog/Makefile && ${MAKE} -C nxdialog distclean || true test -x ./mesa-quilt && ./mesa-quilt pop -a $(RM_DIR_REC) nx-X11/extras/Mesa/.pc/ $(RM_FILE) nx-X11/config/cf/nxversion.def $(RM_FILE) nx-X11/config/cf/nxconfig.def test: echo "No testing for NX (redistributed)" version: # prepare nx-X11/config/cf/nxversion.def sed \ -e 's/###NX_VERSION_MAJOR###/$(shell ./version.sh 1)/' \ -e 's/###NX_VERSION_MINOR###/$(shell ./version.sh 2)/' \ -e 's/###NX_VERSION_MICRO###/$(shell ./version.sh 3)/' \ -e 's/###NX_VERSION_PATCH###/$(shell ./version.sh 4)/' \ nx-X11/config/cf/nxversion.def.in \ > nx-X11/config/cf/nxversion.def ifneq "$(strip $(NX_VERSION_CUSTOM))" "" echo '#define NX_VERSION_CUSTOM $(NX_VERSION_CUSTOM)' >>nx-X11/config/cf/nxversion.def endif imakeconfig: # auto-config some setting # check if system supports Xfont2 (echo "#define HasXfont2 `pkg-config --exists xfont2 && echo YES || echo NO`") >nx-X11/config/cf/nxconfig.def # check if system has an _old_ release of Xfont1 (echo "#define HasLegacyXfont1 `pkg-config --exists 'xfont < 1.4.2' && echo YES || echo NO`") >>nx-X11/config/cf/nxconfig.def # check if system has an _old_ release of XextProto (echo "#define HasLegacyXextProto `pkg-config --exists 'xextproto < 7.1.0' && echo YES || echo NO`") >>nx-X11/config/cf/nxconfig.def # the system's directory with the xkb data and binary files (these # needs to be independent of Imake's ProjectRoot or the configure # prefix.) (pkg-config --exists xkbcomp && echo "#define SystemXkbConfigDir `pkg-config xkbcomp --variable=xkbconfigdir`"; :) >>nx-X11/config/cf/nxconfig.def (pkg-config --exists xkbcomp && echo "#define SystemXkbBinDir `pkg-config xkbcomp --variable=prefix`/bin"; :) >>nx-X11/config/cf/nxconfig.def (pkg-config --exists fontutil && echo "#define SystemFontRootDir `pkg-config fontutil --variable=fontrootdir`"; :) >>nx-X11/config/cf/nxconfig.def # let's create the nx-X11 Makefiles now, once everything has been defined $(MAKE) -j1 -C nx-X11 Makefiles IMAKE_DEFINES="$(IMAKE_DEFINES)" build-env: version imakeconfig # prepare Makefiles and the nx-X11 symlinking magic ${MAKE} -j1 -C nx-X11 BuildIncludes IMAKE_DEFINES="$(IMAKE_DEFINES)" # set up environment for libNX_X11 build (X11 header files) mkdir -p nx-X11/exports/include/nx-X11/ for header in $(NX_X11_HEADERS); do \ ${SYMLINK_FILE} ../../../lib/include/X11/$${header} nx-X11/exports/include/nx-X11/$${header}; \ done # set up environment for libNX_X11 build (Xtrans header/include files) mkdir -p nx-X11/exports/include/nx-X11/Xtrans/ for header in $(NX_XTRANS_HEADERS); do \ ${SYMLINK_FILE} ../../../../lib/include/xtrans/$${header} nx-X11/exports/include/nx-X11/Xtrans/$${header}; \ done clean-env: version for header in $(NX_X11_HEADERS); do \ ${RM_FILE} nx-X11/exports/include/nx-X11/$${header}; \ done for header in $(NX_XTRANS_HEADERS); do \ ${RM_FILE} nx-X11/exports/include/nx-X11/Xtrans/$${header}; \ done [ -d exports/include/nx-X11/Xtrans ] && $(RM_DIR) exports/include/nx-X11/Xtrans/ || : [ -d exports/include/nx-X11/ ] && $(RM_DIR) exports/include/nx-X11/ || : ${MAKE} -j1 -C nx-X11 clean IMAKE_DEFINES="$(IMAKE_DEFINES)" build-lite: cd nxcomp && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} cd nxproxy && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} build-full: build-env # in the full case, we rely on "magic" in the nx-X11 imake-based makefiles... # build nxcomp first cd nxcomp && autoreconf -vfsi && (${CONFIGURE} $(CUSTOM_VERSION_DEFINE)) && ${MAKE} # build libNX_X11 second cd nx-X11/lib && autoreconf -vfsi && (${CONFIGURE} $(CUSTOM_VERSION_DEFINE) --disable-poll) && ${MAKE} mkdir -p nx-X11/exports/lib/ $(SYMLINK_FILE) ../../lib/src/.libs/libNX_X11.so nx-X11/exports/lib/libNX_X11.so $(SYMLINK_FILE) ../../lib/src/.libs/libNX_X11.so.6 nx-X11/exports/lib/libNX_X11.so.6 $(SYMLINK_FILE) ../../lib/src/.libs/libNX_X11.so.6.3.0 nx-X11/exports/lib/libNX_X11.so.6.3.0 # build nxcompshad third cd nxcompshad && autoreconf -vfsi && (${CONFIGURE} $(CUSTOM_VERSION_DEFINE)) && ${MAKE} # build nxagent fourth ./mesa-quilt push -a ${MAKE} -j1 -C nx-X11 BuildDependsOnly IMAKE_DEFINES="$(IMAKE_DEFINES)" ${MAKE} -C nx-X11 World USRLIBDIR="$(USRLIBDIR)" SHLIBDIR="$(SHLIBDIR)" IMAKE_DEFINES="$(IMAKE_DEFINES)" # build nxproxy fifth cd nxproxy && autoreconf -vfsi && (${CONFIGURE} $(CUSTOM_VERSION_DEFINE)) && ${MAKE} # "build" nxdialog last cd nxdialog && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} build: if ! test -d nx-X11; then \ ${MAKE} build-lite; \ else \ ${MAKE} build-full; \ fi install: $(MAKE) install-lite [ ! -d nx-X11 ] || $(MAKE) install-full install-lite: # install nxcomp library $(MAKE) -C nxcomp install # install the nxproxy executable and its man page $(MAKE) -C nxproxy install install-full: $(MAKE) -C nxcompshad install $(INSTALL_DIR) $(DESTDIR)$(BINDIR)/ $(INSTALL_PROGRAM) nx-X11/programs/Xserver/nxagent-relink $(DESTDIR)$(BINDIR)/nxagent $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx $(INSTALL_FILE) nx-X11/programs/Xserver/Xext/SecurityPolicy $(DESTDIR)$(PREFIX)/share/nx # FIXME: Drop this symlink for 3.6.0. Requires that third party frameworks like X2Go have become aware of this... $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/bin $(INSTALL_SYMLINK) $(BINDIR)/nxagent $(DESTDIR)$(NXLIBDIR)/bin/nxagent $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/man/man1/ $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 $(DESTDIR)$(PREFIX)/share/man/man1/ gzip $(DESTDIR)$(PREFIX)/share/man/man1/*.1 # create a clean nx-X11/.build-exports space $(RM_DIR_REC) nx-X11/.build-exports mkdir -p nx-X11/.build-exports/include mkdir -p nx-X11/.build-exports/lib # copy headers (for libnx-x11-dev) cp -aL nx-X11/exports/include/* nx-X11/.build-exports/include # copy libs (for libnx-x11), we want the targets of the links . replace.sh; set -x; find nx-X11/exports/lib/ -name "libNX*.so" | while read libpath; do \ libfile=$$(basename $$libpath); \ libdir=$$(dirname $$libpath); \ link=$$(readlink $$libpath); \ \ mkdir -p "$$(string_rep "$$libdir" exports .build-exports)"; \ cp -a "$$(string_rep "$$libpath" "$$libfile" "$$link")" "$$(string_rep "$$libdir" exports .build-exports)"; \ done; $(INSTALL_DIR) $(DESTDIR)$(SHLIBDIR) $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR) $(INSTALL_SYMLINK) ../../libNX_X11.so.6 $(DESTDIR)$(USRLIBDIR)/libX11.so.6 $(INSTALL_SYMLINK) ../../libNX_X11.so.6.3.0 $(DESTDIR)$(USRLIBDIR)/libX11.so.6.3.0 . replace.sh; set -x; find nx-X11/.build-exports/include/{nx*,GL} -type d | \ while read dirname; do \ $(INSTALL_DIR) "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/")"; \ $(INSTALL_FILE) $${dirname}/*.h \ "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/")"/ || true; \ done; \ $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_NX) $(INSTALL_FILE) etc/keystrokes.cfg $(DESTDIR)/$(ETCDIR_NX)/ $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx $(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent $(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxproxy $(MAKE) -C nx-X11/lib install # install the nxdialog executable and its man page $(MAKE) -C nxdialog install uninstall: $(MAKE) uninstall-lite [ ! -d nx-X11 ] || $(MAKE) uninstall-full uninstall-lite: test -f nxcomp/Makefile && ${MAKE} -C nxcomp "$@" test -f nxproxy/Makefile && ${MAKE} -C nxproxy "$@" $(RM_FILE) $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxproxy $(RM_DIR) $(DESTDIR)$(PREFIX)/share/nx/ uninstall-full: test -f nxcompshad/Makefile && ${MAKE} -C nxcompshad "$@" test -f nx-X11/lib/Makefile && ${MAKE} -C nx-X11/lib "$@" $(RM_FILE) $(DESTDIR)$(BINDIR)/nxagent $(RM_FILE) $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent $(RM_DIR) $(DESTDIR)$(PREFIX)/share/nx/ $(RM_DIR_REC) $(DESTDIR)$(NXLIBDIR) $(RM_DIR_REC) $(DESTDIR)$(INCLUDEDIR)/nx test -f nxdialog/Makefile && ${MAKE} -C nxdialog "$@" nx-libs-3.5.99.23/mesa-quilt0000755000000000000000000000706413614532331012325 0ustar #!/bin/bash # Copyright (C) 2017 by Mike Gabriel # # This is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. d=. ; while [ ! -d "$d/nx-X11/extras" ] && [ "$(readlink -e "$d")" != "/" ]; do d="$d/.."; done # only continue, if in nx-libs tree if [ -d "$d/nx-X11/extras" ]; then if which quilt 1>/dev/null; then echo "$(basename $0): quilt utility found, so we use it..." echo export QUILT_PATCHES="../Mesa.patches" export QUILT_PATCH_OPTS="--reject-format=unified" export QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto" export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index" export QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33" mkdir -p "$d/nx-X11/extras/Mesa.patches" cd "$d/nx-X11/extras/Mesa/" # "--quiltrc -" disables reading global or user-local configuration files. # These can override the environment settings if the quiltrc is not # carefully crafted. # For instance, it should set variables only if they aren't already # provided through the environment, but since the quiltrc file is # actually sourced as a shell script, there's no way to assume that # a user's quiltrc is "sane". quilt --quiltrc - "$@" cd - 1> /dev/null else echo "$(basename $0): no quilt utility found, falling back to stupidly (un)applying our patches..." echo CMDLINE_ARGS="$@" # we are really stupid here, we only understand 'push -a' and 'pop -a' # this should be sufficient for the build process... cd "$d/nx-X11/extras/Mesa/" # make sure all need dirs and files exist mkdir -p ./Mesa.patches/ touch "../Mesa.patches/series" # this file will be needed temporarily touch "../Mesa.patches/.applied-patches" if [ "$CMDLINE_ARGS" = "push -a" ]; then grep -E -v "^#.*" < "../Mesa.patches/series" | while read patchfile; do if [ -n "$patchfile" ] && [ -r "../Mesa.patches/$patchfile" ] && ! grep -q "$patchfile" < "../Mesa.patches/.applied-patches"; then echo "Applying patch ../Mesa.patches/$patchfile" patch -p1 < "../Mesa.patches/$patchfile" echo "$patchfile" >> "../Mesa.patches/.applied-patches" echo fi done elif [ "$CMDLINE_ARGS" = "pop -a" ]; then tac "../Mesa.patches/.applied-patches" | while read patchfile; do if [ -n "$patchfile" ] && [ -r "../Mesa.patches/$patchfile" ]; then echo "Removing patch ../Mesa.patches/$patchfile" patch -R -p1 < "../Mesa.patches/$patchfile" sed -e "/$patchfile/d" "../Mesa.patches/.applied-patches" > "../Mesa.patches/.applied-patches.tmp" mv "../Mesa.patches/.applied-patches.tmp" "../Mesa.patches/.applied-patches" echo fi done else echo "$(basename $0): Doing nothing! Cmdline options not understood: $CMDLINE_ARGS" fi # remove the .applied-patches file, if empty again if [ ! -s "../Mesa.patches/.applied-patches" ]; then rm -f "../Mesa.patches/.applied-patches" fi cd - 1> /dev/null fi fi nx-libs-3.5.99.23/nxcomp/configure.ac0000644000000000000000000001107613614532331014106 0ustar # *************************************************************************** # *** configure.ac for nxcomp *** # *************************************************************************** m4_define([nxcomp_version], m4_esyscmd([tr -d '\n' < VERSION])) # Initialize Autoconf AC_PREREQ(2.60) AC_INIT([libXcomp], [nxcomp_version], [https://github.com/ArcticaProject/nx-libs/issues]) AC_CONFIG_AUX_DIR([build-aux]) AC_PROG_CXX AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-bzip2]) # Initialize libtool AC_PROG_LIBTOOL # enable this to add the variable to the Makefiles #AC_ARG_VAR(NX_VERSION_CUSTOM, [custom version string]) if test "x$NX_VERSION_CUSTOM" != x; then AC_DEFINE_UNQUOTED([NX_VERSION_CUSTOM], ["${NX_VERSION_CUSTOM}"], [user provided custom version string]) fi COMP_VERSION=nxcomp_version AC_SUBST([COMP_VERSION]) LT_COMP_VERSION=["$(printf '%s\n' "${COMP_VERSION}" | awk -F '.' '/^[0-9]+\.[0-9]+\.[0-9]+.*$/ { print $1 ":" $2 ":" $3; }')"] AC_SUBST([LT_COMP_VERSION]) # Silence warning: ar: 'u' modifier ignored since 'D' is the default AC_SUBST(AR_FLAGS, [cr]) # Upstream's pkg.m4 (since 0.27) offers this now, but define our own # compatible version in case the local version of pkgconfig isn't new enough. # https://bugs.freedesktop.org/show_bug.cgi?id=48743 m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], [install directory for nxcomp.pc pkg-config file])], [],[with_pkgconfigdir='$(libdir)/pkgconfig']) AC_SUBST([pkgconfigdir], [${with_pkgconfigdir}])]) PKG_CHECK_MODULES([JPEG], [libjpeg], [], [LIBJPEG_FALLBACK_CHECK]) PKG_CHECK_MODULES([PNG], [libpng]) PKG_CHECK_MODULES([Z], [zlib], [], [ZLIB_FALLBACK_CHECK]) AC_LANG([C++]) NX_COMPILER_BRAND NX_DEFAULT_OPTIONS NX_BUILD_ON_CYGWIN32 NX_BUILD_ON_AMD64 NX_BUILD_ON_DARWIN NX_BUILD_ON_SUN NX_BUILD_ON_FreeBSD # Build PIC libraries. if test "$CYGWIN32" != yes -a "$DARWIN" != yes; then CXXFLAGS="$CXXFLAGS -fPIC" CFLAGS="$CFLAGS -fPIC" fi # On FreeBSD search libraries and includes under /usr/local. if test "$FreeBSD" = yes; then LIBS="$LIBS -L/usr/local/lib" CPPFLAGS="$CPPFLAGS -I/usr/local/include" fi AX_PTHREAD([], AC_MSG_ERROR([no POSIX threads support detected])) # If in_addr_t is not defined use unsigned int. AC_CHECK_TYPES([in_addr_t], [], [], [[#include ]]) AC_ARG_ENABLE([cxx11], [AS_HELP_STRING([--enable-cxx11], [enable optional features requiring C++11 support (disabled by default)])], [AS_IF([test x$enableval = xyes], [AX_CXX_COMPILE_STDCXX_11([], [mandatory])])]) # Check if std::put_time is available. AC_MSG_CHECKING([if std::put_time is available]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[ #include #include ]], [[ std::time_t t = std::time(NULL); std::tm tm = *std::localtime(&t); (void) std::put_time(&tm, "%c"); ]])], [AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_STD_PUT_TIME, [1], [Use std::put_time to format times, must be made available by the compiler if turned on.])], [AC_MSG_RESULT([no])]) # Check if ::ctime_s is available. AC_MSG_CHECKING([if ::ctime_s is available]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[ #define __STDC_WANT_LIB_EXT1__ 1 #include ]], [[ time_t res = time(NULL); char str[26] = { }; ::ctime_s(str, sizeof(str), &res); ]])], [AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_CTIME_S, [1], [Use ::ctime_s to format times, must be made available by the compiler if turned on.])], [AC_MSG_RESULT([no])]) AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [enable to get info session log output (disabled by default)])], [AS_IF([test x$enableval = xyes], [AC_DEFINE(INFO, 1, [Define this to get info session log output.]) info_messages=yes])]) AC_ARG_ENABLE([valgrind], [AS_HELP_STRING([--enable-valgrind], [enable for extra valgrind hacks (disabled by default)])], [AS_IF([test x$enableval = xyes], [AC_DEFINE(VALGRIND, 1, [Define this for extra valgrind hacks.]) valgrind_hacks=yes])]) AC_CONFIG_FILES([ Makefile src/Makefile test/Makefile nxcomp.pc ]) AC_OUTPUT nx-libs-3.5.99.23/nxcomp/include/MD5.h0000644000000000000000000000650013614532331013775 0ustar /* Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. L. Peter Deutsch ghost@aladdin.com */ /* $Id: md5.h,v 1.4 2002/04/13 19:20:28 lpd Exp $ */ /* Independent implementation of MD5 (RFC 1321). This code implements the MD5 Algorithm defined in RFC 1321, whose text is available at http://www.ietf.org/rfc/rfc1321.txt The code is derived from the text of the RFC, including the test suite (section A.5) but excluding the rest of Appendix A. It does not include any code or documentation that is identified in the RFC as being copyrighted. The original and principal author of md5.h is L. Peter Deutsch . Other authors are noted in the change history that follows (in reverse chronological order): 2002-04-13 lpd Removed support for non-ANSI compilers; removed references to Ghostscript; clarified derivation from RFC 1321; now handles byte order either statically or dynamically. 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); added conditionalization for C++ compilation from Martin Purschke . 1999-05-03 lpd Original version. */ #ifndef md5_INCLUDED # define md5_INCLUDED /* * This package supports both compile-time and run-time determination of CPU * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is * defined as non-zero, the code will be compiled to run only on big-endian * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to * run on either big- or little-endian CPUs, but will run slightly less * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. */ typedef unsigned char md5_byte_t; /* 8-bit byte */ typedef unsigned int md5_word_t; /* 32-bit word */ /* Define the state of the MD5 Algorithm. */ typedef struct md5_state_s { md5_word_t count[2]; /* message length in bits, lsw first */ md5_word_t abcd[4]; /* digest buffer */ md5_byte_t buf[64]; /* accumulate block */ } md5_state_t; #ifdef __cplusplus extern "C" { #endif /* Initialize the algorithm. */ void md5_init(md5_state_t *pms); /* Append a string to the message. */ void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); /* Finish the message and return the digest. */ void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); #ifdef __cplusplus } /* end extern "C" */ #endif #endif /* md5_INCLUDED */ nx-libs-3.5.99.23/nxcomp/include/NXalert.h0000644000000000000000000002557213614532331014777 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef NXalert_H #define NXalert_H #define ALERT_CAPTION_PREFIX "NX - " #define INTERNAL_ERROR_ALERT 1 #define INTERNAL_ERROR_ALERT_TYPE "error" #define INTERNAL_ERROR_ALERT_STRING \ "\ An unrecoverable internal error was detected.\n\ Press OK to terminate the current session.\n\ " #define CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT 2 #define CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT_TYPE "yesno" #define CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT_STRING \ "\ One of the applications currently in use is not responding.\n\ Do you want to terminate the current session?\n\ " #define CLOSE_DEAD_X_CONNECTION_SERVER_ALERT 3 #define CLOSE_DEAD_X_CONNECTION_SERVER_ALERT_TYPE "yesno" #define CLOSE_DEAD_X_CONNECTION_SERVER_ALERT_STRING \ "\ One of the applications did not behave correctly and caused\n\ the X server to stop responding in a timely fashion. Do you\n\ want to terminate the current session?\n\ " #define CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT 4 #define CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT_TYPE NULL #define CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT_STRING NULL #define CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT 5 #define CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT_TYPE "yesno" #define CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT_STRING \ "\ No response received from the remote server.\n\ Do you want to terminate the current session?\n\ " #define RESTART_DEAD_PROXY_CONNECTION_CLIENT_ALERT 6 #define RESTART_DEAD_PROXY_CONNECTION_CLIENT_ALERT_TYPE NULL #define RESTART_DEAD_PROXY_CONNECTION_CLIENT_ALERT_STRING NULL #define RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT 7 #define RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT_TYPE "yesno" #define RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT_STRING \ "\ Connection with remote server was shut down. NX will try\n\ to establish a new server connection. Session could have\n\ been left in a unusable state. Do you want to terminate\n\ the session?\n\ " #define CLOSE_UNRESPONSIVE_X_SERVER_ALERT 8 #define CLOSE_UNRESPONSIVE_X_SERVER_ALERT_TYPE "panic" #define CLOSE_UNRESPONSIVE_X_SERVER_ALERT_STRING \ "\ You pressed the key sequence CTRL+ALT+SHIFT+ESC.\n\ This is probably because your X server has become\n\ unresponsive. Session will be terminated in 30\n\ seconds unless you abort the procedure by pressing\n\ the Cancel button.\n\ " #define WRONG_PROXY_VERSION_ALERT 9 #define WRONG_PROXY_VERSION_ALERT_TYPE "ok" #define WRONG_PROXY_VERSION_ALERT_STRING \ "\ Local NX libraries version " VERSION " do not match the NX\n\ version of the remote server. Please check the error\n\ log on the server to find out which client version you\n\ need to install to be able to access this server.\n\ " #define FAILED_PROXY_CONNECTION_CLIENT_ALERT 10 #define FAILED_PROXY_CONNECTION_CLIENT_ALERT_TYPE NULL #define FAILED_PROXY_CONNECTION_CLIENT_ALERT_STRING NULL #define FAILED_PROXY_CONNECTION_SERVER_ALERT 11 #define FAILED_PROXY_CONNECTION_SERVER_ALERT_TYPE "yesno" #define FAILED_PROXY_CONNECTION_SERVER_ALERT_STRING \ "\ Could not yet establish the connection to the remote\n\ proxy. Do you want to terminate the current session?\n\ " #define MISSING_PROXY_CACHE_ALERT 12 #define MISSING_PROXY_CACHE_ALERT_TYPE "ok" #define MISSING_PROXY_CACHE_ALERT_STRING \ "\ NX was unable to negotiate a cache for this session.\n\ This may happen if this is the first time you run a\n\ session on this server or if cache was corrupted or\n\ produced by an incompatible NX version.\n\ " #define ABORT_PROXY_CONNECTION_ALERT 13 #define ABORT_PROXY_CONNECTION_ALERT_TYPE "ok" #define ABORT_PROXY_CONNECTION_ALERT_STRING \ "\ The connection with the remote server was shut down.\n\ Please check the state of your network connection.\n\ " /* * The one below is a special alert, used to close * a previous alert that is running on the given * side. This can be used to get rid of a message * that has ceased to hold true. */ #define DISPLACE_MESSAGE_ALERT 14 #define DISPLACE_MESSAGE_ALERT_TYPE NULL #define DISPLACE_MESSAGE_ALERT_STRING NULL /* * These are the other alert messages that were * added in the 1.5.0 release. The first is never * shown and is intended just for testing. */ #define GREETING_MESSAGE_ALERT 15 #define GREETING_MESSAGE_ALERT_TYPE "ok" #define GREETING_MESSAGE_ALERT_STRING \ "\ Welcome to NX from the NoMachine team. We really\n\ hope you will enjoy this wonderful software as much\n\ as we had fun making it ;-).\n\ " /* * These alerts are intended to notify the user * of the reason why the agent failed to resume * the session. */ #define START_RESUME_SESSION_ALERT 16 #define START_RESUME_SESSION_ALERT_TYPE "ok" #define START_RESUME_SESSION_ALERT_STRING \ "\ You appear to run your NX session across a slow network\n\ connection. Resuming the session may require some time.\n\ Please wait.\ " #define FAILED_RESUME_DISPLAY_ALERT 17 #define FAILED_RESUME_DISPLAY_ALERT_TYPE "error" #define FAILED_RESUME_DISPLAY_ALERT_STRING \ "\ Failed to open the display. Can't resume the NX\n\ session on this display.\n\ " #define FAILED_RESUME_DISPLAY_BROKEN_ALERT 18 #define FAILED_RESUME_DISPLAY_BROKEN_TYPE "error" #define FAILED_RESUME_DISPLAY_BROKEN_STRING \ "\ The display connection was broken while trying to\n\ resume the session. Please, check your network\n\ connection and try again.\n\ " #define FAILED_RESUME_VISUALS_ALERT 19 #define FAILED_RESUME_VISUALS_ALERT_TYPE "error" #define FAILED_RESUME_VISUALS_ALERT_STRING \ "\ Failed to restore all the required visuals.\n\ Can't resume the NX session on this display.\n\ " #define FAILED_RESUME_COLORMAPS_ALERT 20 #define FAILED_RESUME_COLORMAPS_ALERT_TYPE "error" #define FAILED_RESUME_COLORMAPS_ALERT_STRING \ "\ The number of available colormaps is different\n\ on the new display. Can't resume the NX session\n\ on this display.\n\ " #define FAILED_RESUME_PIXMAPS_ALERT 21 #define FAILED_RESUME_PIXMAPS_ALERT_TYPE "error" #define FAILED_RESUME_PIXMAPS_ALERT_STRING \ "\ Failed to restore all the required pixmap formats.\n\ Can't resume the NX session on this display.\n\ " #define FAILED_RESUME_DEPTHS_ALERT 22 #define FAILED_RESUME_DEPTHS_ALERT_TYPE "error" #define FAILED_RESUME_DEPTHS_ALERT_STRING \ "\ Failed to restore all the required screen depths.\n\ Can't resume the NX session on this display.\n\ " #define FAILED_RESUME_RENDER_ALERT 23 #define FAILED_RESUME_RENDER_ALERT_TYPE "error" #define FAILED_RESUME_RENDER_ALERT_STRING \ "\ The render extension is missing or an incompatible\n\ version was detected on your X server. Can't resume\n\ the NX session on this display.\n\ " #define FAILED_RESUME_FONTS_ALERT 24 #define FAILED_RESUME_FONTS_ALERT_TYPE "error" #define FAILED_RESUME_FONTS_ALERT_STRING \ "\ One or more of the fonts that are in use by the\n\ session are missing. Can't resume the NX session\n\ on this display.\n\ " #define ABORT_PROXY_NEGOTIATION_ALERT 62 #define ABORT_PROXY_NEGOTIATION_ALERT_TYPE "ok" #define ABORT_PROXY_NEGOTIATION_ALERT_STRING \ "\ The remote proxy closed the connection while negotiating\n\ the session. This may be due to the wrong authentication\n\ credentials passed to the server.\n\ " #define ABORT_PROXY_SHUTDOWN_ALERT 64 #define ABORT_PROXY_SHUTDOWN_ALERT_TYPE "ok" #define ABORT_PROXY_SHUTDOWN_ALERT_STRING \ "\ No response received from the remote proxy while\n\ waiting for the session shutdown.\n\ " #define FAILED_XDMCP_CONNECTION_ALERT 65 #define FAILED_XDMCP_CONNECTION_ALERT_TYPE "ok" #define FAILED_XDMCP_CONNECTION_ALERT_STRING \ "\ The XDM host that was contacted by the NX server doesn't\n\ seem to be able to start the session. Please check your\n\ server configuration.\n\ " /* * Used to handle the backward compatibility. * Update the numbers if you add a new alert. */ #define LAST_PROTO_STEP_6_ALERT 63 #define LAST_PROTO_STEP_7_ALERT 65 #endif /* NXalert_H */ nx-libs-3.5.99.23/nxcomp/include/NX.h0000644000000000000000000004140713614532331013742 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef NX_H #define NX_H #ifdef __cplusplus extern "C" { #endif #include #include #include #include #include #define NX_FD_ANY -1 #define NX_MODE_ANY -1 #define NX_MODE_CLIENT 1 #define NX_MODE_SERVER 2 #define NX_DISPLAY_ANY NULL #define NX_SIGNAL_ANY -1 #define NX_SIGNAL_ENABLE 1 #define NX_SIGNAL_DISABLE 2 #define NX_SIGNAL_RAISE 3 #define NX_SIGNAL_FORWARD 4 #define NX_POLICY_IMMEDIATE 1 #define NX_POLICY_DEFERRED 2 #define NX_ALERT_REMOTE 0 #define NX_ALERT_LOCAL 1 #define NX_HANDLER_FLUSH 0 #define NX_HANDLER_STATISTICS 1 #define NX_STATISTICS_PARTIAL 0 #define NX_STATISTICS_TOTAL 1 #define NX_CHANNEL_X11 0 #define NX_CHANNEL_CUPS 1 #define NX_CHANNEL_SMB 2 #define NX_CHANNEL_MEDIA 3 #define NX_CHANNEL_HTTP 4 #define NX_CHANNEL_FONT 5 #define NX_CHANNEL_SLAVE 6 #define NX_FILE_SESSION 0 #define NX_FILE_ERRORS 1 #define NX_FILE_OPTIONS 2 #define NX_FILE_STATS 3 /* * The following are the new interfaces to the NX transport. The * NX proxy software is now intended to be run as a library of a * higher level communication manager (nxssh, nxhttp, nxrtp, etc, * not only nxproxy). This is a work-in-progress, so expect these * interfaces to change in future. At the present moment, as an * example, there is no provision for creating and managing mul- * tiple proxy connections. */ /* * Attach a NX transport to the provided descriptor. This should be * done after having created a pair of connected sockets. */ extern int NXTransCreate(int fd, int mode, const char *options); /* * Tell the proxy to use the second descriptor as its own end of * the internal connection to the NX agent. The NX agent will use * the first descriptor. Setting an agent connection will have the * effect of disabling further X client connections and, if it is * possible, will trigger the use of the memory-to-memory transport. */ extern int NXTransAgent(int fd[2]); /* * Prepare the file sets and the timeout for a later execution of * the select(). The masks and the timeout must persist across all * the calls, so if you don't need any of the values, it is requi- * red that you create empty masks and a default timeout. To save * a check at each run, all the functions below assume that valid * pointers are passed. */ extern int NXTransPrepare(int *maxfds, fd_set *readfds, fd_set *writefds, struct timeval *timeout); /* * Call select() to find out the descriptors in the sets having * pending data. */ extern int NXTransSelect(int *result, int *error, int *maxfds, fd_set *readfds, fd_set *writefds, struct timeval *timeout); /* * Perform the required I/O on all the NX descriptors having pen- * ding data. This can include reading and writing to the NX chan- * nels, encoding and decoding the proxy data or managing any of * the other NX resources. */ extern int NXTransExecute(int *result, int *error, int *maxfds, fd_set *readfds, fd_set *writefds, struct timeval *timeout); /* * Run an empty loop, giving to the NX transport a chance to check * its descriptors. */ extern int NXTransContinue(struct timeval *timeout); /* * Perform I/O on the given descriptors. If memory-to-memory trans- * port has been activated and the descriptor is recognized as a * valid agent connection, then the functions will read and write * the data directly to the proxy buffer, otherwise the correspond- * ing network operation will be performed. */ extern int NXTransRead(int fd, char *data, int size); extern int NXTransWrite(int fd, char *data, int size); extern int NXTransReadable(int fd, int *readable); extern int NXTransReadVector(int fd, struct iovec *iovdata, int iovsize); extern int NXTransWriteVector(int fd, struct iovec *iovdata, int iovsize); extern int NXTransClose(int fd); /* * Return true if the NX transport is running. The fd parameter can * be either the local descriptor attached to the NX transport or * NX_FD_ANY. */ extern int NXTransRunning(int fd); /* * Close down the NX transport and free all the allocated resources. * The fd parameter can be either the local descriptor or NX_FD_ANY. * This must be explicitly called by the agent before the proxy can * start the tear down procedure. */ extern int NXTransDestroy(int fd); /* * Tell to the proxy how to handle the standard POSIX signals. For * example, given the SIGINT signal, the caller can specify any of * the following actions: * * NX_SIGNAL_ENABLE: A signal handler will have to be installed by * the library, so that it can be intercepted by * the proxy. * * NX_SIGNAL_DISABLE: The signal will be handled by the caller and, * eventually, forwarded to the proxy by calling * NXTransSignal() explicitly. * * NX_SIGNAL_RAISE: The signal must be handled now, as if it had * been delivered by the operating system. This * function can be called by the agent with the * purpose of propagating a signal to the proxy. * * NX_SIGNAL_FORWARD: A signal handler will have to be installed by * the library but the library will have to call * the original signal handler when the signal * is received. * * As a rule of thumb, agents should let the proxy handle SIGUSR1 * and SIGUSR2, used for producing the NX protocol statistics, and * SIGHUP, used for disconnecting the NX transport. * * The following signals are blocked by default upon creation of the * NX transport: * * SIGCHLD These signals should be always put under the control * SIGUSR1 of the proxy. If agents are intercepting them, agents * SIGUSR2 should later call NXTransSignal(..., NX_SIGNAL_RAISE) * SIGHUP to forward the signal to the proxy. As an alternative * they can specify a NX_SIGNAL_FORWARD action, so they, * in turn, can be notified about the signal. This can * be especially useful for SIGCHLD. * * SIGINT These signals should be intercepted by agents. Agents * SIGTERM should ensure that NXTransDestroy() is called before * exiting, to give the proxy a chance to shut down the * NX transport. * * SIGPIPE This signal is blocked by the proxy, but not used to * implement any functionality. It can be handled by the * NX agent without affecting the proxy. * * SIGALRM This is now used by the proxy and agents should not * redefine it. Agents can use the signal to implement * their own timers but should not interleave calls to * the NX transport and should restore the old handler * when the timeout is raised. * * SIGVTALRM These signals are not used but may be used in future * SIGWINCH versions of the library. * SIGIO * SIGTSTP * SIGTTIN * SIGTTOU * * By calling NXTransSignal(..., NX_SIGNAL_DISABLE) nxcomp will res- * tore the signal handler that was saved at the time the proxy hand- * ler was installed. This means that you should call the function * just after the XOpenDisplay() or any other function used to init- * ialize the NX transport. */ extern int NXTransSignal(int signal, int action); /* * Return a value between 0 and 9 indicating the congestion level * based on the tokens still available. A value of 9 means that * the link is congested and no further data can be sent. */ extern int NXTransCongestion(int fd); /* * Let the application to be notified by the proxy when an event oc- * curs. The parameter, as set at the time the handler is installed, * is passed each time to the callback function. The parameter is * presumably the display pointer, given that at the present moment * the NX transport doesn't have access to the display structure and * so wouldn't be able to determine the display to pass to the call- * back function. * * NX_HANDLER_FLUSH: The handler function is called when some * more data has been written to the proxy * link. * * The data is the number of bytes written. * * NX_HANDLER_STATISTICS: This handler is called to let the agent * include arbitrary data in the transport * statistics. The parameter, in this case, * is a pointer to a pointer to a null term- * inated string. The pointer is set at the * time the handler is registered. The point- * ed string will have to be filled by the * agent with its statistics data. * * The data can be NX_STATISTICS_PARTIAL or NX_STATISTICS_TOTAL. The * agent can refer to the value by using the NXStatisticsPartial and * NXStatisticsTotal constants defined in NXvars.h. * * Note that these interfaces are used by Xlib and nxcompext. Agents * should never call these interfaces directly, but use the nxcompext * wrapper. */ extern int NXTransHandler(int fd, int type, void (*handler)(void *parameter, int reason), void *parameter); /* * Set the policy to be used by the NX transport to write data to the * proxy link: * * NX_POLICY_IMMEDIATE: When set to immediate, the proxy will try to * write the data just after having encoded it. * * NX_POLICY_DEFERRED: When policy is set to deferred, data will be * accumulated in a buffer and written to the * remote proxy when NXTransFlush() is called by * the agent. */ extern int NXTransPolicy(int fd, int type); /* * Query the number of bytes that have been accumulated for a deferred * flush. */ extern int NXTransFlushable(int fd); /* * Tell to the NX transport to write all the accumulated data to the * remote proxy. */ extern int NXTransFlush(int fd); /* * Create a new channel of the given type. It returns 1 on success, * 0 if the NX transport is not running, or -1 in the case of error. * On success, the descriptor provided by the caller can be later * used for the subsequent I/O. The type parameter not only tells to * the proxy the remote port where the channel has to be connected, * but also gives a hint about the type of data that will be carried * by the channel, so that the proxy can try to optimize the traffic * on the proxy link. * * NX_CHANNEL_X: The channel will carry X traffic and it * will be connected to the remote X display. * * NX_CHANNEL_CUPS: The channel will carry CUPS/IPP protocol. * * NX_CHANNEL_SMB: The channel will carry SMB/CIFS protocol. * * NX_CHANNEL_MEDIA: The channel will transport audio or other * multimedia data. * * NX_CHANNEL_HTTP: The channel will carry HTTP protocol. * * NX_CHANNEL_FONT: The channel will forward a X font server * connection. * * Only a proxy running at the NX server/X client side will be able * to create a X, CUPS, SMB, MEDIA and HTTP channel. A proxy running * at the NX client/X server side can create font server connections. * The channel creation will also fail if the remote end has not been * set up to forward the connection. * * To create a new channel the agent will have to set up a socketpair * and pass to the proxy one of the socket descriptors. * * Example: * * #include * #include * * int fds[2]; * * if (socketpair(PF_LOCAL, SOCK_STREAM, 0, fds) < 0) * { * ... * } * else * { * // * // Use fds[0] locally and let the * // proxy use fds[1]. * // * * if (NXTransChannel(NX_FD_ANY, fds[1], NX_CHANNEL_X) <= 0) * { * ... * } * * // * // The agent can now use fds[0] in * // read(), write() and select() * // system calls. * // * * ... * } * * Note that all the I/O on the descriptor should be non-blocking, to * give a chance to the NX transport to run in the background and handle * the data that will be fed to the agent's side of the socketpair. This * will happen automatically, as long as the agent uses the XSelect() * version of the select() function (as it is normal whenever performing * Xlib I/O). In all the other cases, like presumably in the agent's main * loop, the agent will have to loop through NXTransPrepare(), NXTrans- * Select() and NXTransExecute() functions explicitly, adding to the sets * the descriptors that are awaited by the agent. Please check the imple- * mentation of _XSelect() in nx-X11/lib/X11/XlibInt.c for an example. */ extern int NXTransChannel(int fd, int channelfd, int type); /* * Return the name of the files used by the proxy for the current session. * * The type parameter can be: * * NX_FILE_SESSION: Usually the file 'session' in the user's session * directory. * * NX_FILE_ERRORS: The file used for the diagnostic output. Usually * the file 'errors' in the session directory. * * NX_FILE_OPTIONS: The file containing the NX options, if any. * * NX_FILE_STATS: The file used for the statistics output. * * The returned string is allocated in static memory. The caller should * copy the string upon returning from the function, without freeing the * pointer. */ extern const char *NXTransFile(int type); /* * Return the time in milliseconds elapsed since the last call to this * same function. */ extern long NXTransTime(void); /* * Other interfaces to the internal transport functions. */ extern int NXTransProxy(int fd, int mode, const char *display); extern int NXTransClient(const char *display); extern int NXTransDialog(const char *caption, const char *message, const char *window, const char *type, int local, const char *display); extern int NXTransAlert(int code, int local); extern int NXTransWatchdog(int timeout); extern int NXTransKeeper(int caches, int images, const char *root); extern void NXTransExit(int code) __attribute__((noreturn)); extern int NXTransParseCommandLine(int argc, const char **argv); extern int NXTransParseEnvironment(const char *env, int force); extern void NXTransCleanup(void) __attribute__((noreturn)); /* * Cleans up the global and local state * (the same way as NXTransCleanup does) * but does not exit the process * Needed for IOS platform */ extern void NXTransCleanupForReconnect(void); extern const char* NXVersion(void); extern int NXMajorVersion(void); extern int NXMinorVersion(void); extern int NXPatchVersion(void); extern int NXMaintenancePatchVersion(void); #ifdef __cplusplus } #endif #endif /* NX_H */ nx-libs-3.5.99.23/nxcomp/include/NXpack.h0000644000000000000000000001301613614532331014574 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef NXpack_H #define NXpack_H #ifdef __cplusplus extern "C" { #endif #define MASK_METHOD_LIMIT 10 #define NO_MASK 0 #define MASK_8_COLORS 1 #define MASK_64_COLORS 2 #define MASK_256_COLORS 3 #define MASK_512_COLORS 4 #define MASK_4K_COLORS 5 #define MASK_32K_COLORS 6 #define MASK_64K_COLORS 7 #define MASK_256K_COLORS 8 #define MASK_2M_COLORS 9 #define MASK_16M_COLORS 10 #define PACK_METHOD_LIMIT 128 #define NO_PACK 0 #define PACK_MASKED_8_COLORS 1 #define PACK_MASKED_64_COLORS 2 #define PACK_MASKED_256_COLORS 3 #define PACK_MASKED_512_COLORS 4 #define PACK_MASKED_4K_COLORS 5 #define PACK_MASKED_32K_COLORS 6 #define PACK_MASKED_64K_COLORS 7 #define PACK_MASKED_256K_COLORS 8 #define PACK_MASKED_2M_COLORS 9 #define PACK_MASKED_16M_COLORS 10 #define PACK_RAW_8_BITS 3 #define PACK_RAW_16_BITS 7 #define PACK_RAW_24_BITS 10 #define PACK_COLORMAP_256_COLORS 11 #define PACK_JPEG_8_COLORS 26 #define PACK_JPEG_64_COLORS 27 #define PACK_JPEG_256_COLORS 28 #define PACK_JPEG_512_COLORS 29 #define PACK_JPEG_4K_COLORS 30 #define PACK_JPEG_32K_COLORS 31 #define PACK_JPEG_64K_COLORS 32 #define PACK_JPEG_256K_COLORS 33 #define PACK_JPEG_2M_COLORS 34 #define PACK_JPEG_16M_COLORS 35 #define PACK_PNG_8_COLORS 37 #define PACK_PNG_64_COLORS 38 #define PACK_PNG_256_COLORS 39 #define PACK_PNG_512_COLORS 40 #define PACK_PNG_4K_COLORS 41 #define PACK_PNG_32K_COLORS 42 #define PACK_PNG_64K_COLORS 43 #define PACK_PNG_256K_COLORS 44 #define PACK_PNG_2M_COLORS 45 #define PACK_PNG_16M_COLORS 46 #define PACK_RGB_16M_COLORS 63 #define PACK_RLE_16M_COLORS 64 #define PACK_ALPHA 65 #define PACK_COLORMAP 66 #define PACK_BITMAP_16M_COLORS 67 /* * Not really pack methods. These values * allow dynamic selection of the pack * method by the agent. */ #define PACK_NONE 0 #define PACK_LOSSY 253 #define PACK_LOSSLESS 254 #define PACK_ADAPTIVE 255 /* * Reduce the number of colors in the * image by applying a mask. */ typedef struct { unsigned int color_mask; unsigned int correction_mask; unsigned int white_threshold; unsigned int black_threshold; } ColorMask; extern const ColorMask Mask8TrueColor; extern const ColorMask Mask64TrueColor; extern const ColorMask Mask512TrueColor; extern const ColorMask Mask4KTrueColor; extern const ColorMask Mask32KTrueColor; extern const ColorMask Mask256KTrueColor; extern const ColorMask Mask2MTrueColor; extern const ColorMask Mask16MTrueColor; const ColorMask *MethodColorMask(unsigned int method); int MethodBitsPerPixel(unsigned int method); #ifdef __cplusplus } #endif #endif /* NXpack_H */ nx-libs-3.5.99.23/nxcomp/include/NXproto.h0000644000000000000000000003153113614532331015023 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef NXproto_H #define NXproto_H #ifdef __cplusplus extern "C" { #endif #include #include #include /* * Force the size to match the wire protocol. */ #define Drawable CARD32 #define GContext CARD32 #define sz_xNXGetControlParametersReq 4 #define sz_xNXGetCleanupParametersReq 4 #define sz_xNXGetImageParametersReq 4 #define sz_xNXGetUnpackParametersReq 8 #define sz_xNXGetShmemParametersReq 16 #define sz_xNXGetFontParametersReq 4 #define sz_xNXSetExposeParametersReq 8 #define sz_xNXSetCacheParametersReq 8 #define sz_xNXStartSplitReq 8 #define sz_xNXEndSplitReq 4 #define sz_xNXCommitSplitReq 12 #define sz_xNXSetUnpackGeometryReq 24 #define sz_xNXSetUnpackColormapReq 16 #define sz_xNXSetUnpackAlphaReq 16 #define sz_xNXPutPackedImageReq 40 #define sz_xNXFreeUnpackReq 4 #define sz_xNXFinishSplitReq 4 #define sz_xNXAbortSplitReq 4 #define sz_xNXFreeSplitReq 4 #define sz_xGetControlParametersReply 32 #define sz_xGetCleanupParametersReply 32 #define sz_xGetImageParametersReply 32 #define sz_xGetUnpackParametersReply 32 #define sz_xGetShmemParametersReply 32 #define LINK_TYPE_LIMIT 5 #define LINK_TYPE_NONE 0 #define LINK_TYPE_MODEM 1 #define LINK_TYPE_ISDN 2 #define LINK_TYPE_ADSL 3 #define LINK_TYPE_WAN 4 #define LINK_TYPE_LAN 5 /* * NX Replies. */ /* * The following reply has 4 new boolean * fields in the last protocol version. */ typedef struct _NXGetControlParametersReply { BYTE type; /* Is X_Reply. */ CARD8 linkType; CARD16 sequenceNumber B16; CARD32 length B32; /* Is 0. */ CARD8 localMajor; CARD8 localMinor; CARD8 localPatch; CARD8 remoteMajor; CARD8 remoteMinor; CARD8 remotePatch; CARD16 splitTimeout B16; CARD16 motionTimeout B16; CARD8 splitMode; CARD8 pad1; CARD32 splitSize B32; CARD8 packMethod; CARD8 packQuality; CARD8 dataLevel; CARD8 streamLevel; CARD8 deltaLevel; CARD8 loadCache; CARD8 saveCache; CARD8 startupCache; } xNXGetControlParametersReply; typedef struct _NXGetCleanupParametersReply { BYTE type; /* Is X_Reply. */ BYTE pad; CARD16 sequenceNumber B16; CARD32 length B32; /* Is 0. */ BOOL cleanGet; BOOL cleanAlloc; BOOL cleanFlush; BOOL cleanSend; BOOL cleanImages; BYTE pad1, pad2, pad3; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xNXGetCleanupParametersReply; typedef struct _NXGetImageParametersReply { BYTE type; /* Is X_Reply. */ BYTE pad; CARD16 sequenceNumber B16; CARD32 length B32; /* Is 0. */ BOOL imageSplit; BOOL imageMask; BOOL imageFrame; CARD8 imageMaskMethod; CARD8 imageSplitMethod; BYTE pad1, pad2, pad3; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xNXGetImageParametersReply; /* * Data is made of PACK_METHOD_LIMIT values of * type BOOL telling which unpack capabilities * are implemented in proxy. */ typedef struct _NXGetUnpackParametersReply { BYTE type; /* Is X_Reply. */ BYTE pad; CARD16 sequenceNumber B16; CARD32 length B32; /* Is PACK_METHOD_LIMIT / 4 from NXpack.h. */ CARD8 entries; /* Is PACK_METHOD_LIMIT. */ BYTE pad1, pad2, pad3; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; CARD32 pad8 B32; } xNXGetUnpackParametersReply; typedef struct _NXGetShmemParametersReply { BYTE type; /* Is X_Reply. */ CARD8 stage; /* As in the corresponding request. */ CARD16 sequenceNumber B16; CARD32 length B32; /* Is 0. */ BOOL clientEnabled; /* SHM on path agent to proxy. */ BOOL serverEnabled; /* SHM on path proxy to X server. */ BYTE pad1, pad2; /* Previous values can be checked */ CARD32 clientSize B32; /* at end of stage 2. */ CARD32 serverSize B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xNXGetShmemParametersReply; typedef struct _NXGetFontParametersReply { BYTE type; /* Is X_Reply. */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* Is length of path string + 1 / 4. */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xNXGetFontParametersReply; /* * NX Requests. */ typedef struct _NXGetControlParametersReq { CARD8 reqType; BYTE pad; CARD16 length B16; } xNXGetControlParametersReq; typedef struct _NXGetCleanupParametersReq { CARD8 reqType; BYTE pad; CARD16 length B16; } xNXGetCleanupParametersReq; typedef struct _NXGetImageParametersReq { CARD8 reqType; BYTE pad; CARD16 length B16; } xNXGetImageParametersReq; typedef struct _NXGetUnpackParametersReq { CARD8 reqType; BYTE pad; CARD16 length B16; CARD8 entries; BYTE pad1, pad2, pad3; } xNXGetUnpackParametersReq; typedef struct _NXGetShmemParametersReq { CARD8 reqType; CARD8 stage; /* It is between 0 and 2. */ CARD16 length B16; BOOL enableClient; /* X client side support is */ BOOL enableServer; /* not implemented yet. */ BYTE pad1, pad2; CARD32 clientSegment; /* XID identifying the shared */ CARD32 serverSegment; /* memory segments. */ } xNXGetShmemParametersReq; typedef struct _NXGetFontParametersReq { CARD8 reqType; CARD8 pad; CARD16 length B16; } xNXGetFontParametersReq; /* * The available split modes. */ #define NXSplitModeDefault 0 #define NXSplitModeAsync 1 #define NXSplitModeSync 2 typedef struct _NXStartSplitReq { CARD8 reqType; CARD8 resource; CARD16 length B16; CARD8 mode; BYTE pad1, pad2, pad3; } xNXStartSplitReq; typedef struct _NXEndSplitReq { CARD8 reqType; CARD8 resource; CARD16 length B16; } xNXEndSplitReq; typedef struct _NXCommitSplitReq { CARD8 reqType; CARD8 resource; CARD16 length B16; CARD8 propagate; CARD8 request; BYTE pad1, pad2; CARD32 position B32; } xNXCommitSplitReq; typedef struct _NXFinishSplitReq { CARD8 reqType; CARD8 resource; CARD16 length B16; } xNXFinishSplitReq; typedef struct _NXAbortSplitReq { CARD8 reqType; CARD8 resource; CARD16 length B16; } xNXAbortSplitReq; typedef struct _NXFreeSplitReq { CARD8 reqType; CARD8 resource; CARD16 length B16; } xNXFreeSplitReq; typedef struct _NXSetExposeParametersReq { CARD8 reqType; BYTE pad; CARD16 length B16; BOOL expose; BOOL graphicsExpose; BOOL noExpose; BYTE pad1; } xNXSetExposeParametersReq; typedef struct _NXSetCacheParametersReq { CARD8 reqType; BYTE pad; CARD16 length B16; BOOL enableCache; BOOL enableSplit; BOOL enableSave; BOOL enableLoad; } xNXSetCacheParametersReq; typedef struct _NXSetUnpackGeometryReq { CARD8 reqType; CARD8 resource; CARD16 length B16; CARD8 depth1Bpp; CARD8 depth4Bpp; CARD8 depth8Bpp; CARD8 depth16Bpp; CARD8 depth24Bpp; CARD8 depth32Bpp; BYTE pad1, pad2; CARD32 redMask B32; CARD32 greenMask B32; CARD32 blueMask B32; } xNXSetUnpackGeometryReq; typedef struct _NXSetUnpackColormapReq { CARD8 reqType; CARD8 resource; CARD16 length B16; CARD8 method; BYTE pad1, pad2, pad3; CARD32 srcLength B32; CARD32 dstLength B32; } xNXSetUnpackColormapReq; typedef struct _NXSetUnpackAlphaReq { CARD8 reqType; CARD8 resource; CARD16 length B16; CARD8 method; BYTE pad1, pad2, pad3; CARD32 srcLength B32; CARD32 dstLength B32; } xNXSetUnpackAlphaReq; typedef struct _NXPutPackedImageReq { CARD8 reqType; CARD8 resource; CARD16 length B16; Drawable drawable B32; GContext gc B32; CARD8 method; CARD8 format; CARD8 srcDepth; CARD8 dstDepth; CARD32 srcLength B32; CARD32 dstLength B32; INT16 srcX B16, srcY B16; CARD16 srcWidth B16, srcHeight B16; INT16 dstX B16, dstY B16; CARD16 dstWidth B16, dstHeight B16; } xNXPutPackedImageReq; typedef struct _NXFreeUnpackReq { CARD8 reqType; CARD8 resource; CARD16 length B16; } xNXFreeUnpackReq; /* * The X_NXSplitData and X_NXSplitEvent opcodes * are used internally and are ignored if coming * from the agent. */ #define X_NXInternalGenericData 0 #define X_NXInternalGenericReply 1 #define X_NXInternalGenericRequest 255 #define X_NXInternalShapeExtension 128 #define X_NXInternalRenderExtension 129 #define X_NXFirstOpcode 230 #define X_NXLastOpcode 252 #define X_NXGetControlParameters 230 #define X_NXGetCleanupParameters 231 #define X_NXGetImageParameters 232 #define X_NXGetUnpackParameters 233 #define X_NXStartSplit 234 #define X_NXEndSplit 235 #define X_NXSplitData 236 #define X_NXCommitSplit 237 #define X_NXSetExposeParameters 240 #define X_NXSetUnpackGeometry 241 #define X_NXSetUnpackColormap 242 #define X_NXPutPackedImage 243 #define X_NXSplitEvent 244 #define X_NXGetShmemParameters 245 #define X_NXSetUnpackAlpha 246 #define X_NXFreeUnpack 247 #define X_NXFinishSplit 248 #define X_NXAbortSplit 249 #define X_NXFreeSplit 250 #define X_NXGetFontParameters 251 #define X_NXSetCacheParameters 252 /* * The following events are received by the agent * in the form of a ClientMessage with the value * 0 in fields atom and window. The format is * always 32. Event specific data starts at byte * offset 12. * * These events are sent by the NX transport to * notify the agent about the result of a split * operation. */ #define NXNoSplitNotify 1 #define NXStartSplitNotify 2 #define NXCommitSplitNotify 3 #define NXEndSplitNotify 4 #define NXEmptySplitNotify 5 /* * Notifications of collect events. These events * don't come from the NX transport but are put * back in client's event queue by NXlib. */ #define NXCollectImageNotify 8 #define NXCollectPropertyNotify 9 #define NXCollectGrabPointerNotify 10 #define NXCollectInputFocusNotify 11 #undef Drawable #undef GContext #ifdef __cplusplus } #endif #endif /* NXproto_H */ nx-libs-3.5.99.23/nxcomp/include/NXvars.h0000644000000000000000000001316313614532331014634 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef NXvars_H #define NXvars_H /* * This can be included by the proxy or another * layer that doesn't use Xlib. */ #if !defined(_XLIB_H_) && !defined(_XKBSRV_H_) #define NeedFunctionPrototypes 1 #define Display void #endif #ifdef __cplusplus extern "C" { #endif /* * Display flush policies. */ #define NXPolicyImmediate 1 #define NXPolicyDeferred 2 /* * Type of flush. */ #define NXFlushBuffer 0 #define NXFlushLink 1 /* * Type of statistics. */ #define NXStatisticsPartial 0 #define NXStatisticsTotal 1 /* * Reason why the display is blocking. */ #define NXBlockRead 1 #define NXBlockWrite 2 /* * Set if the client is interested in ignoring * the display error and continue with the exe- * cution of the program. By default the usual * Xlib behaviour is gotten, and the library * will call an exit(). */ extern int _NXHandleDisplayError; /* * The function below is called whenever Xlib is * going to perform an I/O operation. The funct- * ion can be redefined to include additional * checks aimed at detecting if the display needs * to be closed, for example because of an event * or a signal mandating the end of the session. * In this way the client program can regain the * control before Xlib blocks waiting for input * from the network. */ typedef int (*NXDisplayErrorPredicate)( #if NeedFunctionPrototypes Display* /* display */, int /* reason */ #endif ); extern NXDisplayErrorPredicate _NXDisplayErrorFunction; /* * This is called when Xlib is going to block * waiting for the display to become readable or * writable. The client can use the hook to run * any arbitrary operation that may require some * time to complete. The user should not try to * read or write to the display inside the call- * back routine. */ typedef void (*NXDisplayBlockHandler)( #if NeedFunctionPrototypes Display* /* display */, int /* reason */ #endif ); extern NXDisplayBlockHandler _NXDisplayBlockFunction; /* * Used to notify the program when more data * is written to the socket. */ typedef void (*NXDisplayWriteHandler)( #if NeedFunctionPrototypes Display* /* display */, int /* length */ #endif ); extern NXDisplayWriteHandler _NXDisplayWriteFunction; /* * This callback is used to notify the agent * that the proxy link has been flushed. */ typedef void (*NXDisplayFlushHandler)( #if NeedFunctionPrototypes Display* /* display */, int /* length */ #endif ); extern NXDisplayFlushHandler _NXDisplayFlushFunction; /* * Used by the NX transport to get an arbitrary * string to add to its protocol statistics. */ typedef void (*NXDisplayStatisticsHandler)( #if NeedFunctionPrototypes Display* /* display */, char* /* buffer */, int /* size */ #endif ); extern NXDisplayStatisticsHandler _NXDisplayStatisticsFunction; /* * Let users redefine the function printing an * error message in the case of a out-of-order * sequence number. */ typedef void (*NXLostSequenceHandler)( #if NeedFunctionPrototypes Display* /* display */, unsigned long /* newseq */, unsigned long /* lastseq */, unsigned int /* type */ #endif ); extern NXLostSequenceHandler _NXLostSequenceFunction; /* * Let the X server run the children processes * (as for example the keyboard initialization * utilities) by using the native system libra- * ries, instead of the libraries shipped with * the NX environment. If set, the Popen() in * the X server will remove the LD_LIBRARY_PATH * setting from the environment before calling * the execl() function in the child process. */ extern int _NXUnsetLibraryPath; #ifdef __cplusplus } #endif #endif /* NXvars_H */ nx-libs-3.5.99.23/nxcomp/m4/ax_cxx_compile_stdcxx_11.m40000644000000000000000000000321513614532424017301 0ustar # ============================================================================= # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html # ============================================================================= # # SYNOPSIS # # AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional]) # # DESCRIPTION # # Check for baseline language coverage in the compiler for the C++11 # standard; if necessary, add switches to CXX and CXXCPP to enable # support. # # This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX # macro with the version set to C++11. The two optional arguments are # forwarded literally as the second and third argument respectively. # Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for # more information. If you want to use this macro, you also need to # download the ax_cxx_compile_stdcxx.m4 file. # # LICENSE # # Copyright (c) 2008 Benjamin Kosnik # Copyright (c) 2012 Zack Weinberg # Copyright (c) 2013 Roy Stogner # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov # Copyright (c) 2015 Paul Norman # Copyright (c) 2015 Moritz Klammler # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 18 AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) nx-libs-3.5.99.23/nxcomp/m4/ax_cxx_compile_stdcxx.m40000644000000000000000000004564713614532424017017 0ustar # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html # =========================================================================== # # SYNOPSIS # # AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) # # DESCRIPTION # # Check for baseline language coverage in the compiler for the specified # version of the C++ standard. If necessary, add switches to CXX and # CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) # or '14' (for the C++14 standard). # # The second argument, if specified, indicates whether you insist on an # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. # -std=c++11). If neither is specified, you get whatever works, with # preference for an extended mode. # # The third argument, if specified 'mandatory' or if left unspecified, # indicates that baseline support for the specified C++ standard is # required and that the macro should error out if no mode with that # support is found. If specified 'optional', then configuration proceeds # regardless, after defining HAVE_CXX${VERSION} if and only if a # supporting mode is found. # # LICENSE # # Copyright (c) 2008 Benjamin Kosnik # Copyright (c) 2012 Zack Weinberg # Copyright (c) 2013 Roy Stogner # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov # Copyright (c) 2015 Paul Norman # Copyright (c) 2015 Moritz Klammler # Copyright (c) 2016, 2018 Krzesimir Nowak # Copyright (c) 2019 Enji Cooper # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 11 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl (serial version number 13). AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], [$1], [14], [ax_cxx_compile_alternatives="14 1y"], [$1], [17], [ax_cxx_compile_alternatives="17 1z"], [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$2], [], [], [$2], [ext], [], [$2], [noext], [], [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], [$3], [optional], [ax_cxx_compile_cxx$1_required=false], [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) AC_LANG_PUSH([C++])dnl ac_success=no m4_if([$2], [noext], [], [dnl if test x$ac_success = xno; then for alternative in ${ax_cxx_compile_alternatives}; do switch="-std=gnu++${alternative}" cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" CXX="$CXX $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], [eval $cachevar=yes], [eval $cachevar=no]) CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done fi]) m4_if([$2], [ext], [], [dnl if test x$ac_success = xno; then dnl HP's aCC needs +std=c++11 according to: dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf dnl Cray's crayCC needs "-h std=c++11" for alternative in ${ax_cxx_compile_alternatives}; do for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" CXX="$CXX $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], [eval $cachevar=yes], [eval $cachevar=no]) CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done if test x$ac_success = xyes; then break fi done fi]) AC_LANG_POP([C++]) if test x$ax_cxx_compile_cxx$1_required = xtrue; then if test x$ac_success = xno; then AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) fi fi if test x$ac_success = xno; then HAVE_CXX$1=0 AC_MSG_NOTICE([No compiler with C++$1 support was found]) else HAVE_CXX$1=1 AC_DEFINE(HAVE_CXX$1,1, [define if the compiler supports basic C++$1 syntax]) fi AC_SUBST(HAVE_CXX$1) ]) dnl Test body for checking C++11 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 ) dnl Test body for checking C++14 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 ) m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 ) dnl Tests for new features in C++11 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ // If the compiler admits that it is not ready for C++11, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201103L #error "This is not a C++11 compiler" #else namespace cxx11 { namespace test_static_assert { template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; } namespace test_final_override { struct Base { virtual ~Base() {} virtual void f() {} }; struct Derived : public Base { virtual ~Derived() override {} virtual void f() override {} }; } namespace test_double_right_angle_brackets { template < typename T > struct check {}; typedef check single_type; typedef check> double_type; typedef check>> triple_type; typedef check>>> quadruple_type; } namespace test_decltype { int f() { int a = 1; decltype(a) b = 2; return a + b; } } namespace test_type_deduction { template < typename T1, typename T2 > struct is_same { static const bool value = false; }; template < typename T > struct is_same { static const bool value = true; }; template < typename T1, typename T2 > auto add(T1 a1, T2 a2) -> decltype(a1 + a2) { return a1 + a2; } int test(const int c, volatile int v) { static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == false, ""); auto ac = c; auto av = v; auto sumi = ac + av + 'x'; auto sumf = ac + av + 1.0; static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == true, ""); return (sumf > 0.0) ? sumi : add(c, v); } } namespace test_noexcept { int f() { return 0; } int g() noexcept { return 0; } static_assert(noexcept(f()) == false, ""); static_assert(noexcept(g()) == true, ""); } namespace test_constexpr { template < typename CharT > unsigned long constexpr strlen_c_r(const CharT *const s, const unsigned long acc) noexcept { return *s ? strlen_c_r(s + 1, acc + 1) : acc; } template < typename CharT > unsigned long constexpr strlen_c(const CharT *const s) noexcept { return strlen_c_r(s, 0UL); } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("1") == 1UL, ""); static_assert(strlen_c("example") == 7UL, ""); static_assert(strlen_c("another\0example") == 7UL, ""); } namespace test_rvalue_references { template < int N > struct answer { static constexpr int value = N; }; answer<1> f(int&) { return answer<1>(); } answer<2> f(const int&) { return answer<2>(); } answer<3> f(int&&) { return answer<3>(); } void test() { int i = 0; const int c = 0; static_assert(decltype(f(i))::value == 1, ""); static_assert(decltype(f(c))::value == 2, ""); static_assert(decltype(f(0))::value == 3, ""); } } namespace test_uniform_initialization { struct test { static const int zero {}; static const int one {1}; }; static_assert(test::zero == 0, ""); static_assert(test::one == 1, ""); } namespace test_lambdas { void test1() { auto lambda1 = [](){}; auto lambda2 = lambda1; lambda1(); lambda2(); } int test2() { auto a = [](int i, int j){ return i + j; }(1, 2); auto b = []() -> int { return '0'; }(); auto c = [=](){ return a + b; }(); auto d = [&](){ return c; }(); auto e = [a, &b](int x) mutable { const auto identity = [](int y){ return y; }; for (auto i = 0; i < a; ++i) a += b--; return x + identity(a + b); }(0); return a + b + c + d + e; } int test3() { const auto nullary = [](){ return 0; }; const auto unary = [](int x){ return x; }; using nullary_t = decltype(nullary); using unary_t = decltype(unary); const auto higher1st = [](nullary_t f){ return f(); }; const auto higher2nd = [unary](nullary_t f1){ return [unary, f1](unary_t f2){ return f2(unary(f1())); }; }; return higher1st(nullary) + higher2nd(nullary)(unary); } } namespace test_variadic_templates { template struct sum; template struct sum { static constexpr auto value = N0 + sum::value; }; template <> struct sum<> { static constexpr auto value = 0; }; static_assert(sum<>::value == 0, ""); static_assert(sum<1>::value == 1, ""); static_assert(sum<23>::value == 23, ""); static_assert(sum<1, 2>::value == 3, ""); static_assert(sum<5, 5, 11>::value == 21, ""); static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); } // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function // because of this. namespace test_template_alias_sfinae { struct foo {}; template using member = typename T::member_type; template void func(...) {} template void func(member*) {} void test(); void test() { func(0); } } } // namespace cxx11 #endif // __cplusplus >= 201103L ]]) dnl Tests for new features in C++14 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ // If the compiler admits that it is not ready for C++14, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201402L #error "This is not a C++14 compiler" #else namespace cxx14 { namespace test_polymorphic_lambdas { int test() { const auto lambda = [](auto&&... args){ const auto istiny = [](auto x){ return (sizeof(x) == 1UL) ? 1 : 0; }; const int aretiny[] = { istiny(args)... }; return aretiny[0]; }; return lambda(1, 1L, 1.0f, '1'); } } namespace test_binary_literals { constexpr auto ivii = 0b0000000000101010; static_assert(ivii == 42, "wrong value"); } namespace test_generalized_constexpr { template < typename CharT > constexpr unsigned long strlen_c(const CharT *const s) noexcept { auto length = 0UL; for (auto p = s; *p; ++p) ++length; return length; } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("x") == 1UL, ""); static_assert(strlen_c("test") == 4UL, ""); static_assert(strlen_c("another\0test") == 7UL, ""); } namespace test_lambda_init_capture { int test() { auto x = 0; const auto lambda1 = [a = x](int b){ return a + b; }; const auto lambda2 = [a = lambda1(x)](){ return a; }; return lambda2(); } } namespace test_digit_separators { constexpr auto ten_million = 100'000'000; static_assert(ten_million == 100000000, ""); } namespace test_return_type_deduction { auto f(int& x) { return x; } decltype(auto) g(int& x) { return x; } template < typename T1, typename T2 > struct is_same { static constexpr auto value = false; }; template < typename T > struct is_same { static constexpr auto value = true; }; int test() { auto x = 0; static_assert(is_same::value, ""); static_assert(is_same::value, ""); return x; } } } // namespace cxx14 #endif // __cplusplus >= 201402L ]]) dnl Tests for new features in C++17 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ // If the compiler admits that it is not ready for C++17, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201703L #error "This is not a C++17 compiler" #else #include #include #include namespace cxx17 { namespace test_constexpr_lambdas { constexpr int foo = [](){return 42;}(); } namespace test::nested_namespace::definitions { } namespace test_fold_expression { template int multiply(Args... args) { return (args * ... * 1); } template bool all(Args... args) { return (args && ...); } } namespace test_extended_static_assert { static_assert (true); } namespace test_auto_brace_init_list { auto foo = {5}; auto bar {5}; static_assert(std::is_same, decltype(foo)>::value); static_assert(std::is_same::value); } namespace test_typename_in_template_template_parameter { template typename X> struct D; } namespace test_fallthrough_nodiscard_maybe_unused_attributes { int f1() { return 42; } [[nodiscard]] int f2() { [[maybe_unused]] auto unused = f1(); switch (f1()) { case 17: f1(); [[fallthrough]]; case 42: f1(); } return f1(); } } namespace test_extended_aggregate_initialization { struct base1 { int b1, b2 = 42; }; struct base2 { base2() { b3 = 42; } int b3; }; struct derived : base1, base2 { int d; }; derived d1 {{1, 2}, {}, 4}; // full initialization derived d2 {{}, {}, 4}; // value-initialized bases } namespace test_general_range_based_for_loop { struct iter { int i; int& operator* () { return i; } const int& operator* () const { return i; } iter& operator++() { ++i; return *this; } }; struct sentinel { int i; }; bool operator== (const iter& i, const sentinel& s) { return i.i == s.i; } bool operator!= (const iter& i, const sentinel& s) { return !(i == s); } struct range { iter begin() const { return {0}; } sentinel end() const { return {5}; } }; void f() { range r {}; for (auto i : r) { [[maybe_unused]] auto v = i; } } } namespace test_lambda_capture_asterisk_this_by_value { struct t { int i; int foo() { return [*this]() { return i; }(); } }; } namespace test_enum_class_construction { enum class byte : unsigned char {}; byte foo {42}; } namespace test_constexpr_if { template int f () { if constexpr(cond) { return 13; } else { return 42; } } } namespace test_selection_statement_with_initializer { int f() { return 13; } int f2() { if (auto i = f(); i > 0) { return 3; } switch (auto i = f(); i + 4) { case 17: return 2; default: return 1; } } } namespace test_template_argument_deduction_for_class_templates { template struct pair { pair (T1 p1, T2 p2) : m1 {p1}, m2 {p2} {} T1 m1; T2 m2; }; void f() { [[maybe_unused]] auto p = pair{13, 42u}; } } namespace test_non_type_auto_template_parameters { template struct B {}; B<5> b1; B<'a'> b2; } namespace test_structured_bindings { int arr[2] = { 1, 2 }; std::pair pr = { 1, 2 }; auto f1() -> int(&)[2] { return arr; } auto f2() -> std::pair& { return pr; } struct S { int x1 : 2; volatile double y1; }; S f3() { return {}; } auto [ x1, y1 ] = f1(); auto& [ xr1, yr1 ] = f1(); auto [ x2, y2 ] = f2(); auto& [ xr2, yr2 ] = f2(); const auto [ x3, y3 ] = f3(); } namespace test_exception_spec_type_system { struct Good {}; struct Bad {}; void g1() noexcept; void g2(); template Bad f(T*, T*); template Good f(T1*, T2*); static_assert (std::is_same_v); } namespace test_inline_variables { template void f(T) {} template inline T g(T) { return T{}; } template<> inline void f<>(int) {} template<> int g<>(int) { return 5; } } } // namespace cxx17 #endif // __cplusplus < 201703L ]]) nx-libs-3.5.99.23/nxcomp/m4/ax_pthread.m40000644000000000000000000005441713614532424014532 0ustar # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_pthread.html # =========================================================================== # # SYNOPSIS # # AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) # # DESCRIPTION # # This macro figures out how to build C programs using POSIX threads. It # sets the PTHREAD_LIBS output variable to the threads library and linker # flags, and the PTHREAD_CFLAGS output variable to any special C compiler # flags that are needed. (The user can also force certain compiler # flags/libs to be tested by setting these environment variables.) # # Also sets PTHREAD_CC to any special C compiler that is needed for # multi-threaded programs (defaults to the value of CC otherwise). (This # is necessary on AIX to use the special cc_r compiler alias.) # # NOTE: You are assumed to not only compile your program with these flags, # but also to link with them as well. For example, you might link with # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS # # If you are only building threaded programs, you may wish to use these # variables in your default LIBS, CFLAGS, and CC: # # LIBS="$PTHREAD_LIBS $LIBS" # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # CC="$PTHREAD_CC" # # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant # has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to # that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). # # Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the # PTHREAD_PRIO_INHERIT symbol is defined when compiling with # PTHREAD_CFLAGS. # # ACTION-IF-FOUND is a list of shell commands to run if a threads library # is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it # is not found. If ACTION-IF-FOUND is not specified, the default action # will define HAVE_PTHREAD. # # Please let the authors know if this macro fails on any platform, or if # you have any other suggestions or comments. This macro was based on work # by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help # from M. Frigo), as well as ac_pthread and hb_pthread macros posted by # Alejandro Forero Cuervo to the autoconf macro repository. We are also # grateful for the helpful feedback of numerous users. # # Updated for Autoconf 2.68 by Daniel Richard G. # # LICENSE # # Copyright (c) 2008 Steven G. Johnson # Copyright (c) 2011 Daniel Richard G. # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 25 #arctica-serial 1 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_SED]) AC_LANG_PUSH([C]) ax_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on Tru64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then ax_pthread_save_CC="$CC" ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) AC_MSG_RESULT([$ax_pthread_ok]) if test "x$ax_pthread_ok" = "xno"; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi CC="$ax_pthread_save_CC" CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 # (Note: HP C rejects this with "bad form for `-t' option") # -pthreads: Solaris/gcc (Note: HP C also rejects) # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads and # -D_REENTRANT too), HP C (must be checked before -lpthread, which # is present but should not be used directly; and before -mthreads, # because the compiler interprets this as "-mt" + "-hreads") # -mthreads: Mingw32/gcc, Lynx/gcc # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case $host_os in freebsd*) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) ax_pthread_flags="-kthread lthread $ax_pthread_flags" ;; hpux*) # From the cc(1) man page: "[-mt] Sets various -D flags to enable # multi-threading and also sets -lpthread." ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" ;; openedition*) # IBM z/OS requires a feature-test macro to be defined in order to # enable POSIX threads at all, so give the user a hint if this is # not set. (We don't define these ourselves, as they can affect # other portions of the system API in unpredictable ways.) AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], [ # if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) AX_PTHREAD_ZOS_MISSING # endif ], [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) ;; solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (N.B.: The stubs are missing # pthread_cleanup_push, or rather a function called by this macro, # so we could check for that, but who knows whether they'll stub # that too in a future libc.) So we'll check first for the # standard Solaris way of linking pthreads (-mt -lpthread). ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" ;; esac # GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) AS_IF([test "x$GCC" = "xyes"], [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"]) # The presence of a feature test macro requesting re-entrant function # definitions is, on some systems, a strong hint that pthreads support is # correctly enabled case $host_os in darwin* | hpux* | linux* | osf* | solaris*) ax_pthread_check_macro="_REENTRANT" ;; aix*) ax_pthread_check_macro="_THREAD_SAFE" ;; *) ax_pthread_check_macro="--" ;; esac AS_IF([test "x$ax_pthread_check_macro" = "x--"], [ax_pthread_check_cond=0], [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) # Are we compiling with Clang? AC_CACHE_CHECK([whether $CC is Clang], [ax_cv_PTHREAD_CLANG], [ax_cv_PTHREAD_CLANG=no # Note that Autoconf sets GCC=yes for Clang as well as GCC if test "x$GCC" = "xyes"; then AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ # if defined(__clang__) && defined(__llvm__) AX_PTHREAD_CC_IS_CLANG # endif ], [ax_cv_PTHREAD_CLANG=yes]) fi ]) ax_pthread_clang="$ax_cv_PTHREAD_CLANG" ax_pthread_clang_warning=no # Clang needs special handling, because older versions handle the -pthread # option in a rather... idiosyncratic way if test "x$ax_pthread_clang" = "xyes"; then # Clang takes -pthread; it has never supported any other flag # (Note 1: This will need to be revisited if a system that Clang # supports has POSIX threads in a separate library. This tends not # to be the way of modern systems, but it's conceivable.) # (Note 2: On some systems, notably Darwin, -pthread is not needed # to get POSIX threads support; the API is always present and # active. We could reasonably leave PTHREAD_CFLAGS empty. But # -pthread does define _REENTRANT, and while the Darwin headers # ignore this macro, third-party headers might not.) PTHREAD_CFLAGS="-pthread" PTHREAD_LIBS= ax_pthread_ok=yes # However, older versions of Clang make a point of warning the user # that, in an invocation where only linking and no compilation is # taking place, the -pthread option has no effect ("argument unused # during compilation"). They expect -pthread to be passed in only # when source code is being compiled. # # Problem is, this is at odds with the way Automake and most other # C build frameworks function, which is that the same flags used in # compilation (CFLAGS) are also used in linking. Many systems # supported by AX_PTHREAD require exactly this for POSIX threads # support, and in fact it is often not straightforward to specify a # flag that is used only in the compilation phase and not in # linking. Such a scenario is extremely rare in practice. # # Even though use of the -pthread flag in linking would only print # a warning, this can be a nuisance for well-run software projects # that build with -Werror. So if the active version of Clang has # this misfeature, we search for an option to squash it. AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown # Create an alternate version of $ac_link that compiles and # links in two steps (.c -> .o, .o -> exe) instead of one # (.c -> exe), because the warning occurs only in the second # step ax_pthread_save_ac_link="$ac_link" ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" ax_pthread_save_CFLAGS="$CFLAGS" for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" ac_link="$ax_pthread_save_ac_link" AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], [ac_link="$ax_pthread_2step_ac_link" AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], [break]) ]) done ac_link="$ax_pthread_save_ac_link" CFLAGS="$ax_pthread_save_CFLAGS" AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" ]) case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in no | unknown) ;; *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; esac fi # $ax_pthread_clang = yes if test "x$ax_pthread_ok" = "xno"; then for ax_pthread_try_flag in $ax_pthread_flags; do case $ax_pthread_try_flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; -mt,pthread) AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) PTHREAD_CFLAGS="-mt" PTHREAD_LIBS="-lpthread" ;; -pthread) AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) PTHREAD_CFLAGS="$ax_pthread_try_flag" if test "x$GCC" = "xyes"; then # Thanks to libtool bug #13550, we have to consider the possibility # that -nostdlib will be used during compilation at some point. # Try to determine the first pthread library available, # ignoring any other variants. for ax_pthread_try_lib_flag in $ax_pthread_flags; do case $ax_pthread_try_lib_flag in none|-*|pthread-config) continue ;; *) PTHREAD_LIBS="-l$ax_pthread_try_lib_flag" ax_pthread_save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" # We only need to link a trivial program with # the current library value. # Linking should fail if the library doesn't # exist, otherwise we should be good to go. AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [LIBS="$ax_pthread_save_LIBS" break], [LIBS="$ax_pthread_save_LIBS" PTHREAD_LIBS=""]) ;; esac done fi ;; -*) AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) PTHREAD_CFLAGS="$ax_pthread_try_flag" ;; pthread-config) AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) PTHREAD_LIBS="-l$ax_pthread_try_flag" ;; esac ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. AC_LINK_IFELSE([AC_LANG_PROGRAM([#include # if $ax_pthread_check_cond # error "$ax_pthread_check_macro must be defined" # endif static void routine(void *a) { a = 0; } static void *start_routine(void *a) { return a; }], [pthread_t th; pthread_attr_t attr; pthread_create(&th, 0, start_routine, 0); pthread_join(th, 0); pthread_attr_init(&attr); pthread_cleanup_push(routine, 0); pthread_cleanup_pop(0) /* ; */])], [ax_pthread_ok=yes], []) CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" AC_MSG_RESULT([$ax_pthread_ok]) AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$ax_pthread_ok" = "xyes"; then ax_pthread_save_CFLAGS="$CFLAGS" ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. AC_CACHE_CHECK([for joinable pthread attribute], [ax_cv_PTHREAD_JOINABLE_ATTR], [ax_cv_PTHREAD_JOINABLE_ATTR=unknown for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [int attr = $ax_pthread_attr; return attr /* ; */])], [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], []) done ]) AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ test "x$ax_pthread_joinable_attr_defined" != "xyes"], [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$ax_cv_PTHREAD_JOINABLE_ATTR], [Define to necessary symbol if this constant uses a non-standard name on your system.]) ax_pthread_joinable_attr_defined=yes ]) AC_CACHE_CHECK([whether more special flags are required for pthreads], [ax_cv_PTHREAD_SPECIAL_FLAGS], [ax_cv_PTHREAD_SPECIAL_FLAGS=no case $host_os in solaris*) ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" ;; esac ]) AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ test "x$ax_pthread_special_flags_added" != "xyes"], [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" ax_pthread_special_flags_added=yes]) AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], [ax_cv_PTHREAD_PRIO_INHERIT], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[int i = PTHREAD_PRIO_INHERIT; return i;]])], [ax_cv_PTHREAD_PRIO_INHERIT=yes], [ax_cv_PTHREAD_PRIO_INHERIT=no]) ]) AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ test "x$ax_pthread_prio_inherit_defined" != "xyes"], [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) ax_pthread_prio_inherit_defined=yes ]) CFLAGS="$ax_pthread_save_CFLAGS" LIBS="$ax_pthread_save_LIBS" # More AIX lossage: compile with *_r variant if test "x$GCC" != "xyes"; then case $host_os in aix*) AS_CASE(["x/$CC"], [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], [#handle absolute path differently from PATH based program lookup AS_CASE(["x$CC"], [x/*], [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) ;; esac fi fi test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" AC_SUBST([PTHREAD_LIBS]) AC_SUBST([PTHREAD_CFLAGS]) AC_SUBST([PTHREAD_CC]) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test "x$ax_pthread_ok" = "xyes"; then ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) : else ax_pthread_ok=no $2 fi AC_LANG_POP ])dnl AX_PTHREAD nx-libs-3.5.99.23/nxcomp/m4/nx-macros.m40000644000000000000000000004165413614532424014321 0ustar dnl nx-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. dnl dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. dnl Copyright (c) 2017, Mike Gabriel dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the "Software"), dnl to deal in the Software without restriction, including without limitation dnl the rights to use, copy, modify, merge, publish, distribute, sublicense, dnl and/or sell copies of the Software, and to permit persons to whom the dnl Software is furnished to do so, subject to the following conditions: dnl dnl The above copyright notice and this permission notice (including the next dnl paragraph) shall be included in all copies or substantial portions of the dnl Software. dnl dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER dnl DEALINGS IN THE SOFTWARE. # NX_COMPILER_BRAND # ------------------- # Checks for various brands of compilers and sets flags as appropriate: # GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes" # GNU g++ - relies on AC_PROG_CXX to set GXX to "yes" # clang compiler - sets CLANGCC to "yes" # Intel compiler - sets INTELCC to "yes" # Sun/Oracle Solaris Studio cc - sets SUNCC to "yes" # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_COMPILER_BRAND], [ AC_LANG_CASE( [C], [ AC_REQUIRE([AC_PROG_CC_C99]) ], [C++], [ AC_REQUIRE([AC_PROG_CXX]) ] ) AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"]) AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) ]) # NX_COMPILER_BRAND # NX_TESTSET_CFLAG(, , [, ...]) # --------------- # Test if the compiler works when passed the given flag as a command line argument. # If it succeeds, the flag is appended to the given variable. If not, it tries the # next flag in the list until there are no more options. # # Note that this does not guarantee that the compiler supports the flag as some # compilers will simply ignore arguments that they do not understand, but we do # attempt to weed out false positives by using -Werror=unknown-warning-option and # -Werror=unused-command-line-argument # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_TESTSET_CFLAG], [ m4_if([$#], 0, [m4_fatal([NX_TESTSET_CFLAG was given with an unsupported number of arguments])]) m4_if([$#], 1, [m4_fatal([NX_TESTSET_CFLAG was given with an unsupported number of arguments])]) AC_LANG_COMPILER_REQUIRE AC_LANG_CASE( [C], [ AC_REQUIRE([AC_PROG_CC_C99]) define([PREFIX], [C]) define([CACHE_PREFIX], [cc]) define([COMPILER], [$CC]) ], [C++], [ define([PREFIX], [CXX]) define([CACHE_PREFIX], [cxx]) define([COMPILER], [$CXX]) ] ) [nx_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]" if test "x$[nx_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option], AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no])) [nx_testset_]CACHE_PREFIX[_unknown_warning_option]=$[nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option] PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" fi if test "x$[nx_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then if test "x$[nx_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" fi PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument], AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no])) [nx_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument] PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" fi found="no" m4_foreach([flag], m4_cdr($@), [ if test $found = "no" ; then if test "x$nx_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" fi if test "x$nx_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" fi PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag[" dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[]) cacheid=AS_TR_SH([nx_cv_]CACHE_PREFIX[_flag_]flag[]) AC_CACHE_VAL($cacheid, [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])], [eval $cacheid=yes], [eval $cacheid=no])]) PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" eval supported=\$$cacheid AC_MSG_RESULT([$supported]) if test "$supported" = "yes" ; then $1="$$1 ]flag[" found="yes" fi fi ]) ]) # NX_TESTSET_CFLAG # NX_COMPILER_FLAGS # --------------- # Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line # arguments supported by the selected compiler which do NOT alter the generated # code. These arguments will cause the compiler to print various warnings # during compilation AND turn a conservative set of warnings into errors. # # The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in # future versions of util-macros as options are added to new compilers. # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_COMPILER_FLAGS], [ AC_REQUIRE([NX_COMPILER_BRAND]) AC_ARG_ENABLE(selective-werror, AS_HELP_STRING([--disable-selective-werror], [Turn off selective compiler errors. (default: enabled)]), [SELECTIVE_WERROR=$enableval], [SELECTIVE_WERROR=yes]) AC_LANG_CASE( [C], [ define([PREFIX], [C]) ], [C++], [ define([PREFIX], [CXX]) ] ) # -v is too short to test reliably with NX_TESTSET_CFLAG if test "x$SUNCC" = "xyes"; then [BASE_]PREFIX[FLAGS]="-v" else [BASE_]PREFIX[FLAGS]="" fi # This chunk of warnings were those that existed in the legacy CWARNFLAGS NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat]) AC_LANG_CASE( [C], [ NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement]) ] ) # This chunk adds additional warnings that could catch undesired effects. NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) # These are currently disabled because they are noisy. They will be enabled # in the future once the codebase is sufficiently modernized to silence # them. For now, I don't want them to drown out the other warnings. # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) # Turn some warnings into errors, so we don't accidentally get successful builds # when there are problems that should be fixed. if test "x$SELECTIVE_WERROR" = "xyes" ; then NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION else AC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors. This should not be necessary. Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast]) fi AC_SUBST([BASE_]PREFIX[FLAGS]) ]) # NX_COMPILER_FLAGS # NX_STRICT_OPTION # ----------------------- # # Add configure option to enable strict compilation flags, such as treating # warnings as fatal errors. # If --enable-strict-compilation is passed to configure, adds strict flags to # $BASE_CFLAGS or $BASE_CXXFLAGS. # # Also exports $STRICT_CFLAGS for use in other tests or when strict compilation # is unconditionally desired. AC_DEFUN([NX_STRICT_OPTION], [ AC_REQUIRE([NX_COMPILER_FLAGS]) AC_ARG_ENABLE(strict-compilation, AS_HELP_STRING([--enable-strict-compilation], [Enable all warnings from compiler and make them errors (default: disabled)]), [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) AC_LANG_CASE( [C], [ define([PREFIX], [C]) ], [C++], [ define([PREFIX], [CXX]) ] ) [STRICT_]PREFIX[FLAGS]="" NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic]) NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn]) # Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not # activate it with -Werror, so we add it here explicitly. NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes]) if test "x$STRICT_COMPILE" = "xyes"; then [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]" fi AC_SUBST([STRICT_]PREFIX[FLAGS]) AC_SUBST([BASE_]PREFIX[FLAGS]) ]) # NX_STRICT_OPTION # NX_DEFAULT_OPTIONS # -------------------- # # Defines default options for X.Org-like modules. # AC_DEFUN([NX_DEFAULT_OPTIONS], [ AC_REQUIRE([AC_PROG_INSTALL]) NX_COMPILER_FLAGS NX_STRICT_OPTION m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) ]) # NX_DEFAULT_OPTIONS # NX_CHECK_MALLOC_ZERO # ---------------------- # Minimum version: 1.0.0 # # Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if # malloc(0) returns NULL. Packages should add one of these cflags to # their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. AC_DEFUN([NX_CHECK_MALLOC_ZERO],[ AC_ARG_ENABLE(malloc0returnsnull, AS_HELP_STRING([--enable-malloc0returnsnull], [malloc(0) returns NULL (default: auto)]), [MALLOC_ZERO_RETURNS_NULL=$enableval], [MALLOC_ZERO_RETURNS_NULL=auto]) AC_MSG_CHECKING([whether malloc(0) returns NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then AC_RUN_IFELSE([AC_LANG_PROGRAM([ #include ],[ char *m0, *r0, *c0, *p; m0 = malloc(0); p = malloc(10); r0 = realloc(p,0); c0 = calloc(0,10); exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); ])], [MALLOC_ZERO_RETURNS_NULL=yes], [MALLOC_ZERO_RETURNS_NULL=no], [MALLOC_ZERO_RETURNS_NULL=yes]) fi AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL" XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC" else MALLOC_ZERO_CFLAGS="" XMALLOC_ZERO_CFLAGS="" XTMALLOC_ZERO_CFLAGS="" fi AC_SUBST([MALLOC_ZERO_CFLAGS]) AC_SUBST([XMALLOC_ZERO_CFLAGS]) AC_SUBST([XTMALLOC_ZERO_CFLAGS]) ]) # NX_CHECK_MALLOC_ZERO dnl Check to see if we're running under Cygwin32. AC_DEFUN([NX_BUILD_ON_CYGWIN32], [AC_CACHE_CHECK([for Cygwin32 environment], nxconf_cv_cygwin32, [AC_TRY_COMPILE(,[return __CYGWIN32__;], nxconf_cv_cygwin32=yes, nxconf_cv_cygwin32=no) rm -f conftest*]) CYGWIN32= test "$nxconf_cv_cygwin32" = yes && CYGWIN32=yes ]) # NX_BUILD_ON_CYGWIN32 dnl Check whether we're building on a AMD64. AC_DEFUN([NX_BUILD_ON_AMD64], [AC_CACHE_CHECK([for Amd64 environment], nxconf_cv_amd64, [AC_TRY_COMPILE(,[return (__amd64__ || __x86_64__);], nxconf_cv_amd64=yes, nxconf_cv_amd64=no) rm -f conftest*]) AMD64= test "$nxconf_cv_amd64" = yes && AMD64=yes ]) # NX_BUILD_ON_AMD64 dnl Check for Darwin environment. AC_DEFUN([NX_BUILD_ON_DARWIN], [AC_CACHE_CHECK([for Darwin environment], nxconf_cv_darwin, [AC_TRY_COMPILE(,[return __APPLE__;], nxconf_cv_darwin=yes, nxconf_cv_darwin=no) rm -f conftest*]) DARWIN= test "$nxconf_cv_darwin" = yes && DARWIN=yes ]) # NX_BUILD_ON_DARWIN # Check to see if we're running under Solaris. AC_DEFUN([NX_BUILD_ON_SUN], [AC_CACHE_CHECK([for Solaris environment], nxconf_cv_sun, [AC_TRY_COMPILE(,[return __sun;], nxconf_cv_sun=yes, nxconf_cv_sun=no) rm -f conftest*]) SUN= test "$nxconf_cv_sun" = yes && SUN=yes ]) # NX_BUILD_ON_SUN # Check to see if we're running under FreeBSD. AC_DEFUN([NX_BUILD_ON_FreeBSD], [AC_CACHE_CHECK([for FreeBSD environment], nxconf_cv_freebsd, [AC_TRY_COMPILE(,[return __FreeBSD__;], nxconf_cv_freebsd=yes, nxconf_cv_freebsd=no) rm -f conftest*]) FreeBSD= test "$nxconf_cv_freebsd" = yes && FreeBSD=yes ]) # NX_BUILD_ON_FreeBSD # Check to see if we're generating binaries in ELF format. AC_DEFUN([NX_TARGET_USE_ELF], [AC_CACHE_CHECK([if target system is ELF-based], [nxconf_cv_targetelf], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[ #ifndef __ELF__ #error not an ELF-based system error! #endif ]], [[ ]])], [nxconf_cv_targetelf=yes], [nxconf_cv_targetelf=no])]) AM_CONDITIONAL([TARGET_ELF], [test x"$nxconf_cv_targetelf" = "xyes"]) ]) # NX_TARGET_USE_ELF AC_DEFUN([LIBJPEG_FALLBACK_CHECK],[ AC_MSG_CHECKING([for libjpeg shared library file and headers]) AC_CHECK_LIB([jpeg], [jpeg_destroy_compress], [have_jpeg_lib=yes], [have_jpeg_lib=no]) AC_CHECK_HEADERS([jpeglib.h], [have_jpeg_headers=yes], [have_jpeg_headers=no]) if test x"$have_jpeg_lib" = "xyes" && test x"$have_jpeg_headers" = "xyes"; then AC_MSG_RESULT([yes]) JPEG_CFLAGS="" JPEG_LIBS="-ljpeg" else AC_MSG_RESULT([no]) AC_MSG_FAILURE([Could not find libjpeg on your system, make sure the JPEG shared library and header files are installed.]) fi ]) # LIBJPEG_FALLBACK_CHECK AC_DEFUN([ZLIB_FALLBACK_CHECK],[ AC_MSG_CHECKING([for zlib shared library file and headers]) AC_CHECK_LIB([z], [inflateEnd], [have_zlib_lib=yes], [have_zlib_lib=no]) AC_CHECK_HEADERS([zlib.h], [have_zlib_headers=yes], [have_zlib_headers=no]) if test x"$have_zlib_lib" = "xyes" && test x"$have_zlib_headers" = "xyes"; then AC_MSG_RESULT([yes]) Z_CFLAGS="" Z_LIBS="-lz" else AC_MSG_RESULT([no]) AC_MSG_FAILURE([Could not find zlib on your system, make sure the zlib shared library and header files are installed.]) fi ]) # ZLIB_FALLBACK_CHECK nx-libs-3.5.99.23/nxcomp/Makefile.am0000644000000000000000000000105313614532331013646 0ustar SUBDIRS = src test pkgconfig_DATA = nxcomp.pc ACLOCAL_AMFLAGS = -I m4 MAINTAINERCLEANFILES = \ $(srcdir)/autom4te.cache/* \ $(srcdir)/build-aux/* \ $(srcdir)/Makefile.in \ $(srcdir)/src/Makefile.in \ $(srcdir)/aclocal.m4 \ $(srcdir)/config.h.in \ $(srcdir)/config.h.in~ \ $(srcdir)/configure \ $(srcdir)/m4/libtool.m4 \ $(srcdir)/m4/lt~obsolete.m4 \ $(srcdir)/m4/ltoptions.m4 \ $(srcdir)/m4/ltsugar.m4 \ $(srcdir)/m4/ltversion.m4 \ $(NULL) DISTCLEANFILES=$(MAINTAINERCLEANFILES) nx-libs-3.5.99.23/nxcomp/nxcomp.pc.in0000644000000000000000000000054613614532331014055 0ustar prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: nxcomp Description: NX Compression Library Version: @COMP_VERSION@ #libjepg does not provide a pkgconfig-file, zlib does not provide it for older versions #Requires: libjpeg zlib Requires: libpng Requires.private: x11 Cflags: -I${includedir} Libs: -L${libdir} -lXcomp nx-libs-3.5.99.23/nxcompshad/configure.ac0000644000000000000000000000451413614532331014745 0ustar dnl *************************************************************************** dnl *** configure.ac for nxcompshad *** dnl *************************************************************************** m4_define([nxcompshad_version], m4_esyscmd([tr -d '\n' < VERSION])) # Initialize Autoconf AC_PREREQ(2.60) AC_INIT([libXcompshad], [nxcompshad_version], [https://github.com/ArcticaProject/nx-libs/issues]) AC_PROG_CXX AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-bzip2]) # Initialize libtool AC_PROG_LIBTOOL # enable this to add the variable to the Makefiles #AC_ARG_VAR(NX_VERSION_CUSTOM, [custom version string]) if test "x$NX_VERSION_CUSTOM" != x; then AC_DEFINE_UNQUOTED([NX_VERSION_CUSTOM], ["${NX_VERSION_CUSTOM}"], [user provided custom version string]) fi COMPSHAD_VERSION=nxcompshad_version AC_SUBST([COMPSHAD_VERSION]) LT_COMPSHAD_VERSION=["$(printf '%s\n' "${COMPSHAD_VERSION}" | awk -F '.' '/^[0-9]+\.[0-9]+\.[0-9]+.*$/ { print $1 ":" $2 ":" $3; }')"] AC_SUBST([LT_COMPSHAD_VERSION]) # Silence warning: ar: 'u' modifier ignored since 'D' is the default AC_SUBST(AR_FLAGS, [cr]) PKG_CHECK_MODULES(Xext, xext) PKG_CHECK_MODULES(Xdamage, xdamage) PKG_CHECK_MODULES(Xrandr, xrandr) PKG_CHECK_MODULES(Xtst, xtst) # Upstream's pkg.m4 (since 0.27) offers this now, but define our own # compatible version in case the local version of pkgconfig isn't new enough. # https://bugs.freedesktop.org/show_bug.cgi?id=48743 m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], [install directory for nxcompshad.pc pkg-config file])], [],[with_pkgconfigdir='$(libdir)/pkgconfig']) AC_SUBST([pkgconfigdir], [${with_pkgconfigdir}])]) AC_LANG([C++]) NX_COMPILER_BRAND NX_DEFAULT_OPTIONS NX_TARGET_USE_ELF AC_ARG_ENABLE([cxx11], [AS_HELP_STRING([--enable-cxx11], [enable optional features requiring C++11 support (disabled by default)])], [AS_IF([test x$enableval = xyes], [AX_CXX_COMPILE_STDCXX_11([], [mandatory])])]) AC_CONFIG_FILES([ Makefile src/Makefile nxcompshad.pc ]) AC_OUTPUT nx-libs-3.5.99.23/nxcompshad/include/Shadow.h0000644000000000000000000001001013614532331015464 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Shadow_H #define Shadow_H #include #define NXShadowCorrectColor(length, buffer) \ \ { \ unsigned short a; \ unsigned short b; \ unsigned short *shorts; \ int i; \ \ length >>= 1; \ shorts = (unsigned short *)buffer; \ for (i = 0; i < length ; i++) \ { \ a = shorts[i]; \ \ b = a & 63; \ a <<= 1; \ a = (a & ~127) | b; \ \ shorts[i] = a; \ } \ } #ifdef __cplusplus extern "C" { #endif typedef char* UpdaterHandle; typedef struct _ShadowOptions { char optionShmExtension; char optionDamageExtension; int optionShadowDisplayUid; } ShadowOptions; extern ShadowOptions NXShadowOptions; extern void NXShadowResetOptions(); extern int NXShadowCreate(void *, char *, char *, void **); extern void NXShadowDestroy(void); /* * Use an already opened Display connection. * We use instead of to avoid * useless dependences from Xlib headers. */ extern int NXShadowAddUpdaterDisplay(void *display, int *width, int *height, unsigned char *depth); extern UpdaterHandle NXShadowAddUpdater(char *displayName); extern int NXShadowRemoveUpdater(UpdaterHandle handle); extern int NXShadowRemoveAllUpdaters(void); extern void NXShadowHandleInput(void); extern int NXShadowHasChanged(int (*)(void *), void *, int *); extern void NXShadowExportChanges(long *, char **); extern int NXShadowHasUpdaters(void); extern int NXShadowCaptureCursor(unsigned int wnd, void *vis); extern void NXShadowColorCorrect(int, int, unsigned int, unsigned int, char *); extern void NXShadowUpdateBuffer(void **); extern void NXShadowEvent(Display *, XEvent); extern void NXShadowWebKeyEvent(KeySym keysym, Bool isKeyPress); extern void NXShadowSetDisplayUid(int uid); extern void NXShadowDisableShm(void); extern void NXShadowDisableDamage(void); extern void NXShadowGetScreenSize(int *width, int *height); extern void NXShadowSetScreenSize(int *width, int *height); extern void NXShadowInitKeymap(void *keysyms); #ifdef __cplusplus } #endif #endif /* Shadow_H */ nx-libs-3.5.99.23/nxcompshad/m4/ax_cxx_compile_stdcxx_11.m40000644000000000000000000000321513614532424020141 0ustar # ============================================================================= # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html # ============================================================================= # # SYNOPSIS # # AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional]) # # DESCRIPTION # # Check for baseline language coverage in the compiler for the C++11 # standard; if necessary, add switches to CXX and CXXCPP to enable # support. # # This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX # macro with the version set to C++11. The two optional arguments are # forwarded literally as the second and third argument respectively. # Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for # more information. If you want to use this macro, you also need to # download the ax_cxx_compile_stdcxx.m4 file. # # LICENSE # # Copyright (c) 2008 Benjamin Kosnik # Copyright (c) 2012 Zack Weinberg # Copyright (c) 2013 Roy Stogner # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov # Copyright (c) 2015 Paul Norman # Copyright (c) 2015 Moritz Klammler # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 18 AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) nx-libs-3.5.99.23/nxcompshad/m4/ax_cxx_compile_stdcxx.m40000644000000000000000000004564713614532424017657 0ustar # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html # =========================================================================== # # SYNOPSIS # # AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) # # DESCRIPTION # # Check for baseline language coverage in the compiler for the specified # version of the C++ standard. If necessary, add switches to CXX and # CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) # or '14' (for the C++14 standard). # # The second argument, if specified, indicates whether you insist on an # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. # -std=c++11). If neither is specified, you get whatever works, with # preference for an extended mode. # # The third argument, if specified 'mandatory' or if left unspecified, # indicates that baseline support for the specified C++ standard is # required and that the macro should error out if no mode with that # support is found. If specified 'optional', then configuration proceeds # regardless, after defining HAVE_CXX${VERSION} if and only if a # supporting mode is found. # # LICENSE # # Copyright (c) 2008 Benjamin Kosnik # Copyright (c) 2012 Zack Weinberg # Copyright (c) 2013 Roy Stogner # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov # Copyright (c) 2015 Paul Norman # Copyright (c) 2015 Moritz Klammler # Copyright (c) 2016, 2018 Krzesimir Nowak # Copyright (c) 2019 Enji Cooper # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 11 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl (serial version number 13). AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], [$1], [14], [ax_cxx_compile_alternatives="14 1y"], [$1], [17], [ax_cxx_compile_alternatives="17 1z"], [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$2], [], [], [$2], [ext], [], [$2], [noext], [], [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], [$3], [optional], [ax_cxx_compile_cxx$1_required=false], [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) AC_LANG_PUSH([C++])dnl ac_success=no m4_if([$2], [noext], [], [dnl if test x$ac_success = xno; then for alternative in ${ax_cxx_compile_alternatives}; do switch="-std=gnu++${alternative}" cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" CXX="$CXX $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], [eval $cachevar=yes], [eval $cachevar=no]) CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done fi]) m4_if([$2], [ext], [], [dnl if test x$ac_success = xno; then dnl HP's aCC needs +std=c++11 according to: dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf dnl Cray's crayCC needs "-h std=c++11" for alternative in ${ax_cxx_compile_alternatives}; do for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" CXX="$CXX $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], [eval $cachevar=yes], [eval $cachevar=no]) CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done if test x$ac_success = xyes; then break fi done fi]) AC_LANG_POP([C++]) if test x$ax_cxx_compile_cxx$1_required = xtrue; then if test x$ac_success = xno; then AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) fi fi if test x$ac_success = xno; then HAVE_CXX$1=0 AC_MSG_NOTICE([No compiler with C++$1 support was found]) else HAVE_CXX$1=1 AC_DEFINE(HAVE_CXX$1,1, [define if the compiler supports basic C++$1 syntax]) fi AC_SUBST(HAVE_CXX$1) ]) dnl Test body for checking C++11 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 ) dnl Test body for checking C++14 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 ) m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 ) dnl Tests for new features in C++11 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ // If the compiler admits that it is not ready for C++11, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201103L #error "This is not a C++11 compiler" #else namespace cxx11 { namespace test_static_assert { template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; } namespace test_final_override { struct Base { virtual ~Base() {} virtual void f() {} }; struct Derived : public Base { virtual ~Derived() override {} virtual void f() override {} }; } namespace test_double_right_angle_brackets { template < typename T > struct check {}; typedef check single_type; typedef check> double_type; typedef check>> triple_type; typedef check>>> quadruple_type; } namespace test_decltype { int f() { int a = 1; decltype(a) b = 2; return a + b; } } namespace test_type_deduction { template < typename T1, typename T2 > struct is_same { static const bool value = false; }; template < typename T > struct is_same { static const bool value = true; }; template < typename T1, typename T2 > auto add(T1 a1, T2 a2) -> decltype(a1 + a2) { return a1 + a2; } int test(const int c, volatile int v) { static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == false, ""); auto ac = c; auto av = v; auto sumi = ac + av + 'x'; auto sumf = ac + av + 1.0; static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == true, ""); return (sumf > 0.0) ? sumi : add(c, v); } } namespace test_noexcept { int f() { return 0; } int g() noexcept { return 0; } static_assert(noexcept(f()) == false, ""); static_assert(noexcept(g()) == true, ""); } namespace test_constexpr { template < typename CharT > unsigned long constexpr strlen_c_r(const CharT *const s, const unsigned long acc) noexcept { return *s ? strlen_c_r(s + 1, acc + 1) : acc; } template < typename CharT > unsigned long constexpr strlen_c(const CharT *const s) noexcept { return strlen_c_r(s, 0UL); } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("1") == 1UL, ""); static_assert(strlen_c("example") == 7UL, ""); static_assert(strlen_c("another\0example") == 7UL, ""); } namespace test_rvalue_references { template < int N > struct answer { static constexpr int value = N; }; answer<1> f(int&) { return answer<1>(); } answer<2> f(const int&) { return answer<2>(); } answer<3> f(int&&) { return answer<3>(); } void test() { int i = 0; const int c = 0; static_assert(decltype(f(i))::value == 1, ""); static_assert(decltype(f(c))::value == 2, ""); static_assert(decltype(f(0))::value == 3, ""); } } namespace test_uniform_initialization { struct test { static const int zero {}; static const int one {1}; }; static_assert(test::zero == 0, ""); static_assert(test::one == 1, ""); } namespace test_lambdas { void test1() { auto lambda1 = [](){}; auto lambda2 = lambda1; lambda1(); lambda2(); } int test2() { auto a = [](int i, int j){ return i + j; }(1, 2); auto b = []() -> int { return '0'; }(); auto c = [=](){ return a + b; }(); auto d = [&](){ return c; }(); auto e = [a, &b](int x) mutable { const auto identity = [](int y){ return y; }; for (auto i = 0; i < a; ++i) a += b--; return x + identity(a + b); }(0); return a + b + c + d + e; } int test3() { const auto nullary = [](){ return 0; }; const auto unary = [](int x){ return x; }; using nullary_t = decltype(nullary); using unary_t = decltype(unary); const auto higher1st = [](nullary_t f){ return f(); }; const auto higher2nd = [unary](nullary_t f1){ return [unary, f1](unary_t f2){ return f2(unary(f1())); }; }; return higher1st(nullary) + higher2nd(nullary)(unary); } } namespace test_variadic_templates { template struct sum; template struct sum { static constexpr auto value = N0 + sum::value; }; template <> struct sum<> { static constexpr auto value = 0; }; static_assert(sum<>::value == 0, ""); static_assert(sum<1>::value == 1, ""); static_assert(sum<23>::value == 23, ""); static_assert(sum<1, 2>::value == 3, ""); static_assert(sum<5, 5, 11>::value == 21, ""); static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); } // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function // because of this. namespace test_template_alias_sfinae { struct foo {}; template using member = typename T::member_type; template void func(...) {} template void func(member*) {} void test(); void test() { func(0); } } } // namespace cxx11 #endif // __cplusplus >= 201103L ]]) dnl Tests for new features in C++14 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ // If the compiler admits that it is not ready for C++14, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201402L #error "This is not a C++14 compiler" #else namespace cxx14 { namespace test_polymorphic_lambdas { int test() { const auto lambda = [](auto&&... args){ const auto istiny = [](auto x){ return (sizeof(x) == 1UL) ? 1 : 0; }; const int aretiny[] = { istiny(args)... }; return aretiny[0]; }; return lambda(1, 1L, 1.0f, '1'); } } namespace test_binary_literals { constexpr auto ivii = 0b0000000000101010; static_assert(ivii == 42, "wrong value"); } namespace test_generalized_constexpr { template < typename CharT > constexpr unsigned long strlen_c(const CharT *const s) noexcept { auto length = 0UL; for (auto p = s; *p; ++p) ++length; return length; } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("x") == 1UL, ""); static_assert(strlen_c("test") == 4UL, ""); static_assert(strlen_c("another\0test") == 7UL, ""); } namespace test_lambda_init_capture { int test() { auto x = 0; const auto lambda1 = [a = x](int b){ return a + b; }; const auto lambda2 = [a = lambda1(x)](){ return a; }; return lambda2(); } } namespace test_digit_separators { constexpr auto ten_million = 100'000'000; static_assert(ten_million == 100000000, ""); } namespace test_return_type_deduction { auto f(int& x) { return x; } decltype(auto) g(int& x) { return x; } template < typename T1, typename T2 > struct is_same { static constexpr auto value = false; }; template < typename T > struct is_same { static constexpr auto value = true; }; int test() { auto x = 0; static_assert(is_same::value, ""); static_assert(is_same::value, ""); return x; } } } // namespace cxx14 #endif // __cplusplus >= 201402L ]]) dnl Tests for new features in C++17 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ // If the compiler admits that it is not ready for C++17, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201703L #error "This is not a C++17 compiler" #else #include #include #include namespace cxx17 { namespace test_constexpr_lambdas { constexpr int foo = [](){return 42;}(); } namespace test::nested_namespace::definitions { } namespace test_fold_expression { template int multiply(Args... args) { return (args * ... * 1); } template bool all(Args... args) { return (args && ...); } } namespace test_extended_static_assert { static_assert (true); } namespace test_auto_brace_init_list { auto foo = {5}; auto bar {5}; static_assert(std::is_same, decltype(foo)>::value); static_assert(std::is_same::value); } namespace test_typename_in_template_template_parameter { template typename X> struct D; } namespace test_fallthrough_nodiscard_maybe_unused_attributes { int f1() { return 42; } [[nodiscard]] int f2() { [[maybe_unused]] auto unused = f1(); switch (f1()) { case 17: f1(); [[fallthrough]]; case 42: f1(); } return f1(); } } namespace test_extended_aggregate_initialization { struct base1 { int b1, b2 = 42; }; struct base2 { base2() { b3 = 42; } int b3; }; struct derived : base1, base2 { int d; }; derived d1 {{1, 2}, {}, 4}; // full initialization derived d2 {{}, {}, 4}; // value-initialized bases } namespace test_general_range_based_for_loop { struct iter { int i; int& operator* () { return i; } const int& operator* () const { return i; } iter& operator++() { ++i; return *this; } }; struct sentinel { int i; }; bool operator== (const iter& i, const sentinel& s) { return i.i == s.i; } bool operator!= (const iter& i, const sentinel& s) { return !(i == s); } struct range { iter begin() const { return {0}; } sentinel end() const { return {5}; } }; void f() { range r {}; for (auto i : r) { [[maybe_unused]] auto v = i; } } } namespace test_lambda_capture_asterisk_this_by_value { struct t { int i; int foo() { return [*this]() { return i; }(); } }; } namespace test_enum_class_construction { enum class byte : unsigned char {}; byte foo {42}; } namespace test_constexpr_if { template int f () { if constexpr(cond) { return 13; } else { return 42; } } } namespace test_selection_statement_with_initializer { int f() { return 13; } int f2() { if (auto i = f(); i > 0) { return 3; } switch (auto i = f(); i + 4) { case 17: return 2; default: return 1; } } } namespace test_template_argument_deduction_for_class_templates { template struct pair { pair (T1 p1, T2 p2) : m1 {p1}, m2 {p2} {} T1 m1; T2 m2; }; void f() { [[maybe_unused]] auto p = pair{13, 42u}; } } namespace test_non_type_auto_template_parameters { template struct B {}; B<5> b1; B<'a'> b2; } namespace test_structured_bindings { int arr[2] = { 1, 2 }; std::pair pr = { 1, 2 }; auto f1() -> int(&)[2] { return arr; } auto f2() -> std::pair& { return pr; } struct S { int x1 : 2; volatile double y1; }; S f3() { return {}; } auto [ x1, y1 ] = f1(); auto& [ xr1, yr1 ] = f1(); auto [ x2, y2 ] = f2(); auto& [ xr2, yr2 ] = f2(); const auto [ x3, y3 ] = f3(); } namespace test_exception_spec_type_system { struct Good {}; struct Bad {}; void g1() noexcept; void g2(); template Bad f(T*, T*); template Good f(T1*, T2*); static_assert (std::is_same_v); } namespace test_inline_variables { template void f(T) {} template inline T g(T) { return T{}; } template<> inline void f<>(int) {} template<> int g<>(int) { return 5; } } } // namespace cxx17 #endif // __cplusplus < 201703L ]]) nx-libs-3.5.99.23/nxcompshad/m4/nx-macros.m40000644000000000000000000004165413614532424015161 0ustar dnl nx-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. dnl dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. dnl Copyright (c) 2017, Mike Gabriel dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the "Software"), dnl to deal in the Software without restriction, including without limitation dnl the rights to use, copy, modify, merge, publish, distribute, sublicense, dnl and/or sell copies of the Software, and to permit persons to whom the dnl Software is furnished to do so, subject to the following conditions: dnl dnl The above copyright notice and this permission notice (including the next dnl paragraph) shall be included in all copies or substantial portions of the dnl Software. dnl dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER dnl DEALINGS IN THE SOFTWARE. # NX_COMPILER_BRAND # ------------------- # Checks for various brands of compilers and sets flags as appropriate: # GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes" # GNU g++ - relies on AC_PROG_CXX to set GXX to "yes" # clang compiler - sets CLANGCC to "yes" # Intel compiler - sets INTELCC to "yes" # Sun/Oracle Solaris Studio cc - sets SUNCC to "yes" # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_COMPILER_BRAND], [ AC_LANG_CASE( [C], [ AC_REQUIRE([AC_PROG_CC_C99]) ], [C++], [ AC_REQUIRE([AC_PROG_CXX]) ] ) AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"]) AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) ]) # NX_COMPILER_BRAND # NX_TESTSET_CFLAG(, , [, ...]) # --------------- # Test if the compiler works when passed the given flag as a command line argument. # If it succeeds, the flag is appended to the given variable. If not, it tries the # next flag in the list until there are no more options. # # Note that this does not guarantee that the compiler supports the flag as some # compilers will simply ignore arguments that they do not understand, but we do # attempt to weed out false positives by using -Werror=unknown-warning-option and # -Werror=unused-command-line-argument # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_TESTSET_CFLAG], [ m4_if([$#], 0, [m4_fatal([NX_TESTSET_CFLAG was given with an unsupported number of arguments])]) m4_if([$#], 1, [m4_fatal([NX_TESTSET_CFLAG was given with an unsupported number of arguments])]) AC_LANG_COMPILER_REQUIRE AC_LANG_CASE( [C], [ AC_REQUIRE([AC_PROG_CC_C99]) define([PREFIX], [C]) define([CACHE_PREFIX], [cc]) define([COMPILER], [$CC]) ], [C++], [ define([PREFIX], [CXX]) define([CACHE_PREFIX], [cxx]) define([COMPILER], [$CXX]) ] ) [nx_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]" if test "x$[nx_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option], AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no])) [nx_testset_]CACHE_PREFIX[_unknown_warning_option]=$[nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option] PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" fi if test "x$[nx_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then if test "x$[nx_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" fi PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument], AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no])) [nx_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument] PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" fi found="no" m4_foreach([flag], m4_cdr($@), [ if test $found = "no" ; then if test "x$nx_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" fi if test "x$nx_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" fi PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag[" dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[]) cacheid=AS_TR_SH([nx_cv_]CACHE_PREFIX[_flag_]flag[]) AC_CACHE_VAL($cacheid, [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])], [eval $cacheid=yes], [eval $cacheid=no])]) PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" eval supported=\$$cacheid AC_MSG_RESULT([$supported]) if test "$supported" = "yes" ; then $1="$$1 ]flag[" found="yes" fi fi ]) ]) # NX_TESTSET_CFLAG # NX_COMPILER_FLAGS # --------------- # Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line # arguments supported by the selected compiler which do NOT alter the generated # code. These arguments will cause the compiler to print various warnings # during compilation AND turn a conservative set of warnings into errors. # # The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in # future versions of util-macros as options are added to new compilers. # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_COMPILER_FLAGS], [ AC_REQUIRE([NX_COMPILER_BRAND]) AC_ARG_ENABLE(selective-werror, AS_HELP_STRING([--disable-selective-werror], [Turn off selective compiler errors. (default: enabled)]), [SELECTIVE_WERROR=$enableval], [SELECTIVE_WERROR=yes]) AC_LANG_CASE( [C], [ define([PREFIX], [C]) ], [C++], [ define([PREFIX], [CXX]) ] ) # -v is too short to test reliably with NX_TESTSET_CFLAG if test "x$SUNCC" = "xyes"; then [BASE_]PREFIX[FLAGS]="-v" else [BASE_]PREFIX[FLAGS]="" fi # This chunk of warnings were those that existed in the legacy CWARNFLAGS NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat]) AC_LANG_CASE( [C], [ NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement]) ] ) # This chunk adds additional warnings that could catch undesired effects. NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) # These are currently disabled because they are noisy. They will be enabled # in the future once the codebase is sufficiently modernized to silence # them. For now, I don't want them to drown out the other warnings. # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) # Turn some warnings into errors, so we don't accidentally get successful builds # when there are problems that should be fixed. if test "x$SELECTIVE_WERROR" = "xyes" ; then NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION else AC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors. This should not be necessary. Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast]) fi AC_SUBST([BASE_]PREFIX[FLAGS]) ]) # NX_COMPILER_FLAGS # NX_STRICT_OPTION # ----------------------- # # Add configure option to enable strict compilation flags, such as treating # warnings as fatal errors. # If --enable-strict-compilation is passed to configure, adds strict flags to # $BASE_CFLAGS or $BASE_CXXFLAGS. # # Also exports $STRICT_CFLAGS for use in other tests or when strict compilation # is unconditionally desired. AC_DEFUN([NX_STRICT_OPTION], [ AC_REQUIRE([NX_COMPILER_FLAGS]) AC_ARG_ENABLE(strict-compilation, AS_HELP_STRING([--enable-strict-compilation], [Enable all warnings from compiler and make them errors (default: disabled)]), [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) AC_LANG_CASE( [C], [ define([PREFIX], [C]) ], [C++], [ define([PREFIX], [CXX]) ] ) [STRICT_]PREFIX[FLAGS]="" NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic]) NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn]) # Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not # activate it with -Werror, so we add it here explicitly. NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes]) if test "x$STRICT_COMPILE" = "xyes"; then [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]" fi AC_SUBST([STRICT_]PREFIX[FLAGS]) AC_SUBST([BASE_]PREFIX[FLAGS]) ]) # NX_STRICT_OPTION # NX_DEFAULT_OPTIONS # -------------------- # # Defines default options for X.Org-like modules. # AC_DEFUN([NX_DEFAULT_OPTIONS], [ AC_REQUIRE([AC_PROG_INSTALL]) NX_COMPILER_FLAGS NX_STRICT_OPTION m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) ]) # NX_DEFAULT_OPTIONS # NX_CHECK_MALLOC_ZERO # ---------------------- # Minimum version: 1.0.0 # # Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if # malloc(0) returns NULL. Packages should add one of these cflags to # their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. AC_DEFUN([NX_CHECK_MALLOC_ZERO],[ AC_ARG_ENABLE(malloc0returnsnull, AS_HELP_STRING([--enable-malloc0returnsnull], [malloc(0) returns NULL (default: auto)]), [MALLOC_ZERO_RETURNS_NULL=$enableval], [MALLOC_ZERO_RETURNS_NULL=auto]) AC_MSG_CHECKING([whether malloc(0) returns NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then AC_RUN_IFELSE([AC_LANG_PROGRAM([ #include ],[ char *m0, *r0, *c0, *p; m0 = malloc(0); p = malloc(10); r0 = realloc(p,0); c0 = calloc(0,10); exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); ])], [MALLOC_ZERO_RETURNS_NULL=yes], [MALLOC_ZERO_RETURNS_NULL=no], [MALLOC_ZERO_RETURNS_NULL=yes]) fi AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL" XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC" else MALLOC_ZERO_CFLAGS="" XMALLOC_ZERO_CFLAGS="" XTMALLOC_ZERO_CFLAGS="" fi AC_SUBST([MALLOC_ZERO_CFLAGS]) AC_SUBST([XMALLOC_ZERO_CFLAGS]) AC_SUBST([XTMALLOC_ZERO_CFLAGS]) ]) # NX_CHECK_MALLOC_ZERO dnl Check to see if we're running under Cygwin32. AC_DEFUN([NX_BUILD_ON_CYGWIN32], [AC_CACHE_CHECK([for Cygwin32 environment], nxconf_cv_cygwin32, [AC_TRY_COMPILE(,[return __CYGWIN32__;], nxconf_cv_cygwin32=yes, nxconf_cv_cygwin32=no) rm -f conftest*]) CYGWIN32= test "$nxconf_cv_cygwin32" = yes && CYGWIN32=yes ]) # NX_BUILD_ON_CYGWIN32 dnl Check whether we're building on a AMD64. AC_DEFUN([NX_BUILD_ON_AMD64], [AC_CACHE_CHECK([for Amd64 environment], nxconf_cv_amd64, [AC_TRY_COMPILE(,[return (__amd64__ || __x86_64__);], nxconf_cv_amd64=yes, nxconf_cv_amd64=no) rm -f conftest*]) AMD64= test "$nxconf_cv_amd64" = yes && AMD64=yes ]) # NX_BUILD_ON_AMD64 dnl Check for Darwin environment. AC_DEFUN([NX_BUILD_ON_DARWIN], [AC_CACHE_CHECK([for Darwin environment], nxconf_cv_darwin, [AC_TRY_COMPILE(,[return __APPLE__;], nxconf_cv_darwin=yes, nxconf_cv_darwin=no) rm -f conftest*]) DARWIN= test "$nxconf_cv_darwin" = yes && DARWIN=yes ]) # NX_BUILD_ON_DARWIN # Check to see if we're running under Solaris. AC_DEFUN([NX_BUILD_ON_SUN], [AC_CACHE_CHECK([for Solaris environment], nxconf_cv_sun, [AC_TRY_COMPILE(,[return __sun;], nxconf_cv_sun=yes, nxconf_cv_sun=no) rm -f conftest*]) SUN= test "$nxconf_cv_sun" = yes && SUN=yes ]) # NX_BUILD_ON_SUN # Check to see if we're running under FreeBSD. AC_DEFUN([NX_BUILD_ON_FreeBSD], [AC_CACHE_CHECK([for FreeBSD environment], nxconf_cv_freebsd, [AC_TRY_COMPILE(,[return __FreeBSD__;], nxconf_cv_freebsd=yes, nxconf_cv_freebsd=no) rm -f conftest*]) FreeBSD= test "$nxconf_cv_freebsd" = yes && FreeBSD=yes ]) # NX_BUILD_ON_FreeBSD # Check to see if we're generating binaries in ELF format. AC_DEFUN([NX_TARGET_USE_ELF], [AC_CACHE_CHECK([if target system is ELF-based], [nxconf_cv_targetelf], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[ #ifndef __ELF__ #error not an ELF-based system error! #endif ]], [[ ]])], [nxconf_cv_targetelf=yes], [nxconf_cv_targetelf=no])]) AM_CONDITIONAL([TARGET_ELF], [test x"$nxconf_cv_targetelf" = "xyes"]) ]) # NX_TARGET_USE_ELF AC_DEFUN([LIBJPEG_FALLBACK_CHECK],[ AC_MSG_CHECKING([for libjpeg shared library file and headers]) AC_CHECK_LIB([jpeg], [jpeg_destroy_compress], [have_jpeg_lib=yes], [have_jpeg_lib=no]) AC_CHECK_HEADERS([jpeglib.h], [have_jpeg_headers=yes], [have_jpeg_headers=no]) if test x"$have_jpeg_lib" = "xyes" && test x"$have_jpeg_headers" = "xyes"; then AC_MSG_RESULT([yes]) JPEG_CFLAGS="" JPEG_LIBS="-ljpeg" else AC_MSG_RESULT([no]) AC_MSG_FAILURE([Could not find libjpeg on your system, make sure the JPEG shared library and header files are installed.]) fi ]) # LIBJPEG_FALLBACK_CHECK AC_DEFUN([ZLIB_FALLBACK_CHECK],[ AC_MSG_CHECKING([for zlib shared library file and headers]) AC_CHECK_LIB([z], [inflateEnd], [have_zlib_lib=yes], [have_zlib_lib=no]) AC_CHECK_HEADERS([zlib.h], [have_zlib_headers=yes], [have_zlib_headers=no]) if test x"$have_zlib_lib" = "xyes" && test x"$have_zlib_headers" = "xyes"; then AC_MSG_RESULT([yes]) Z_CFLAGS="" Z_LIBS="-lz" else AC_MSG_RESULT([no]) AC_MSG_FAILURE([Could not find zlib on your system, make sure the zlib shared library and header files are installed.]) fi ]) # ZLIB_FALLBACK_CHECK nx-libs-3.5.99.23/nxcompshad/Makefile.am0000644000000000000000000000105213614532331014505 0ustar SUBDIRS = src pkgconfig_DATA = nxcompshad.pc ACLOCAL_AMFLAGS = -I m4 MAINTAINERCLEANFILES = \ $(srcdir)/autom4te.cache/* \ $(srcdir)/build-aux/* \ $(srcdir)/Makefile.in \ $(srcdir)/src/Makefile.in \ $(srcdir)/aclocal.m4 \ $(srcdir)/config.h.in \ $(srcdir)/config.h.in~ \ $(srcdir)/configure \ $(srcdir)/m4/libtool.m4 \ $(srcdir)/m4/lt~obsolete.m4 \ $(srcdir)/m4/ltoptions.m4 \ $(srcdir)/m4/ltsugar.m4 \ $(srcdir)/m4/ltversion.m4 \ $(NULL) DISTCLEANFILES=$(MAINTAINERCLEANFILES) nx-libs-3.5.99.23/nxcompshad/nxcompshad.pc.in0000644000000000000000000000043513614532331015552 0ustar prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: nxcompshad Description: Shadow Session Support for NX Compression Library Version: @COMPSHAD_VERSION@ Requires: nxcomp Requires.private: x11 Cflags: -I${includedir} Libs: -L${libdir} -lXcompshad nx-libs-3.5.99.23/nxcompshad/src/Core.cpp0000644000000000000000000003044113614532331014640 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #define PANIC #define WARNING #undef TEST #undef DEBUG #include "Core.h" #include "Logger.h" const int CorePoller::maxSliceHeight_ = 20; const int CorePoller::minSliceHeight_ = 3; const char CorePoller::interlace_[] = { 0, 16, 8, 24, 4, 20, 12, 28, 2, 18, 10, 26, 6, 22, 14, 30, 1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 31 }; CorePoller::CorePoller(Input *input, Display *display) : input_(input) { logTrace("CorePoller::CorePoller"); buffer_ = NULL; lastUpdatedRegion_ = NULL; lineStatus_ = NULL; linePriority_ = NULL; lefts_ = NULL; rights_ = NULL; } CorePoller::~CorePoller() { logTrace("CorePoller::~CorePoller"); if (buffer_ != NULL) { delete [] buffer_; buffer_ = NULL; } if (lastUpdatedRegion_ != NULL) { XDestroyRegion(lastUpdatedRegion_); lastUpdatedRegion_ = NULL; } if (lineStatus_ != NULL) { delete [] lineStatus_; lineStatus_ = NULL; } if (linePriority_ != NULL) { delete [] linePriority_; linePriority_ = NULL; } if (lefts_ != NULL) { delete [] lefts_; lefts_ = NULL; } if (rights_ != NULL) { delete [] rights_; rights_ = NULL; } } int CorePoller::init() { logTrace("CorePoller::init"); createFrameBuffer(); if (buffer_ == NULL) { logError("CorePoller::init", ESET(ENOMEM)); return -1; } logTest("CorePoller::init", "Allocated frame buffer at [%p] for [%d] bytes.", buffer_, bpl_ * height_); if (lastUpdatedRegion_ != NULL) { XDestroyRegion(lastUpdatedRegion_); lastUpdatedRegion_ = NULL; } lastUpdatedRegion_ = XCreateRegion(); if (lineStatus_ != NULL) { delete[] lineStatus_; } lineStatus_ = new LineStatus[height_ + 1]; if (lineStatus_ == NULL) { logError("CorePoller::init", ESET(ENOMEM)); return -1; } // // We need this boundary element to // speed up the algo. // if (linePriority_ != NULL) { delete[] linePriority_; } linePriority_ = new int [height_ + 1]; if (linePriority_ == NULL) { logError("CorePoller::init", ESET(ENOMEM)); return -1; } for (unsigned int i = 0; i < height_; i++) { linePriority_[i] = HIGHEST_PRIORITY; } if (lefts_ != NULL) { delete[] lefts_; } lefts_ = new int [height_]; if (rights_ != NULL) { delete[] rights_; } rights_ = new int [height_]; for (unsigned int i = 0; i < height_; i++) { rights_[i] = lefts_[i] = 0; } return 1; } int CorePoller::isChanged(int (*checkIfInputCallback)(void *), void *arg, int *suspended) { logTrace("CorePoller::isChanged"); if (mirror_ == 1) { int result = mirrorChanges_; mirrorChanges_ = 0; return result; } logDebug("CorePoller:isChanged", "Going to use default polling algorithm.\n"); // // In order to allow this function to // be suspended and resumed later, we // need to save these two status vars. // static int idxIlace = 0; static int curLine = 0; const long timeout = 50; long oldTime; long newTime; struct timeval ts; gettimeofday(&ts, NULL); oldTime = ts.tv_sec * 1000 + ts.tv_usec / 1000; if (curLine == 0) // && idxIlace == 0 ? { for (unsigned int i = 0; i < height_; i++) { lineStatus_[i] = LINE_NOT_CHECKED; } } int foundChanges = 0; foundChanges = 0; int curIlace = interlace_[idxIlace]; bool moveBackward = false; logDebug("CorePoller::isChanged", "Interlace index [%d] interlace [%d].", idxIlace, curIlace); for (; curLine < (int) height_; curLine++) { logDebug("CorePoller::isChanged", "Analyzing line [%d] move backward [%d] status [%d] priority [%d].", curLine, moveBackward, lineStatus_[curIlace], linePriority_[curLine]); // // Ask the caller if the polling have to be suspended. // if ((*checkIfInputCallback)(arg) == 1) { *suspended = 1; break; } // // Suspend if too much time is elapsed. // gettimeofday(&ts, NULL); newTime = ts.tv_sec * 1000 + ts.tv_usec / 1000; if (newTime - oldTime >= timeout) { *suspended = 1; break; } oldTime = newTime; if (lineStatus_[curLine] != LINE_NOT_CHECKED) { continue; } if (moveBackward) { moveBackward = false; } else { switch (linePriority_[curLine]) { case 1: case 29: { // // It was a priority, // but now it may not be. // } case 31: { // // Not a priority, still isn't. // linePriority_[curLine] = NOT_PRIORITY; break; } case 0: { // // Make it a priority. // linePriority_[curLine] = PRIORITY; break; } default: { linePriority_[curLine]--; break; } } if ((linePriority_[curLine] > PRIORITY) && ((curLine & 31) != curIlace)) { continue; } } XRectangle rect = {0, static_cast(curLine), static_cast(width_), 1}; char *buffer; logDebug("CorePoller::isChanged", "Checking line [%d].", curLine); if ((buffer = getRect(rect)) == NULL) { logDebug("CorePoller::isChanged", "Failed to retrieve line [%d].", curLine); return -1; } if (memcmp(buffer, buffer_ + curLine * bpl_, bpl_) == 0 || differ(buffer, rect) == 0) { logDebug("CorePoller::isChanged", "Data buffer didn't change."); lineStatus_[curLine] = LINE_NOT_CHANGED; continue; } rect.x = lefts_[rect.y]; rect.width = rights_[rect.y] - lefts_[rect.y] + 1; update(buffer + rect.x * bpp_, rect); foundChanges = 1; lineStatus_[curLine] = LINE_HAS_CHANGED; // // Wake up the next line. // if (linePriority_[curLine + 1] > PRIORITY) { linePriority_[curLine + 1] = HIGHEST_PRIORITY; } // // Give this line priority. // linePriority_[curLine] = HIGHEST_PRIORITY; // // Wake up previous line. // if (curLine > 0 && lineStatus_[curLine - 1] == LINE_NOT_CHECKED) { moveBackward = true; curLine -= 2; } } // // Execution reached the end of loop. // if (curLine == (int) height_) { idxIlace = (idxIlace + 1) % 32; curLine = 0; } // // Create the region of changed pixels. // if (foundChanges) { int start, last, curWorkLine, left, right; for (curWorkLine = 0; curWorkLine < (int) height_; curWorkLine++) { if (lineStatus_[curWorkLine] == LINE_HAS_CHANGED) { break; } } start = curWorkLine; last = curWorkLine; left = lefts_[curWorkLine]; right = rights_[curWorkLine]; curWorkLine++; while (1) { for (; curWorkLine < (int) height_; curWorkLine++) { if (lineStatus_[curWorkLine] == LINE_HAS_CHANGED) { break; } } if (curWorkLine == (int) height_) { break; } if ((curWorkLine - last > minSliceHeight_) || (last - start > maxSliceHeight_)) { XRectangle rect = {static_cast(left), static_cast(start), static_cast(right - left + 1), static_cast(last - start + 1)}; XUnionRectWithRegion(&rect, lastUpdatedRegion_, lastUpdatedRegion_); start = curWorkLine; left = lefts_[curWorkLine]; right = rights_[curWorkLine]; } else { if (lefts_[curWorkLine] < left) { left = lefts_[curWorkLine]; } if (rights_[curWorkLine] > right) { right = rights_[curWorkLine]; } } last = curWorkLine; curWorkLine++; } // // Send last block. // if (last >= start) { XRectangle rect = {static_cast(left), static_cast(start), static_cast(right - left + 1), static_cast(last - start + 1)}; XUnionRectWithRegion(&rect, lastUpdatedRegion_, lastUpdatedRegion_); } } return foundChanges; } int CorePoller::differ(char *buffer, XRectangle r) { logTrace("CorePoller::differ"); int bpl = bpp_ * r.width; int i; char *pBuf; char *pFb; pBuf = (buffer); pFb = (buffer_ + r.x + r.y * bpl_); for (i = 0; i < bpl; i++) { if (*pFb++ != *pBuf++) { lefts_[r.y] = i / bpp_; break; } } if (i == bpl) { return 0; } pBuf = (buffer) + bpl - 1; pFb = (buffer_ + r.x + r.y * bpl_) + bpl - 1; int j = i - 1; for (i = bpl - 1; i > j; i--) { if (*pFb-- != *pBuf--) { rights_[r.y] = i / bpp_; break; } } return 1; } void CorePoller::update(char *src, XRectangle r) { logTrace("CorePoller::update"); char *dst = buffer_ + r.x * bpp_ + r.y * bpl_; int bpl = bpp_ * r.width; for (unsigned int i = 0; i < r.height; i++) { if(((r.x * bpp_ + r.y * bpl_) + bpl) > (bpl_ * height_)) { // // Out of bounds. Maybe a resize is going on. // continue; } memcpy(dst, src, bpl); src += bpl; dst += bpl_; } } void CorePoller::handleEvent(Display *display, XEvent *event) { logTrace("CorePoller::handleEvent"); switch (event -> type) { case KeyPress: case KeyRelease: { handleKeyboardEvent(display, event); break; } case ButtonPress: case ButtonRelease: case MotionNotify: { handleMouseEvent(display, event); break; } default: { logTest("CorePoller::handleEvent", "Handling unexpected event [%d] from display [%p].", event -> type, display); break; } } } void CorePoller::handleWebKeyEvent(KeySym keysym, Bool isKeyPress) { logTrace("CorePoller::handleWebKeyEvent"); handleWebKeyboardEvent(keysym, isKeyPress); } void CorePoller::handleInput() { while (input_ -> checkIfEvent()) { Display *display = input_ -> currentDisplay(); XEvent *event = input_ -> popEvent(); handleEvent(display, event); delete event; } } void CorePoller::createFrameBuffer() { logTrace("CorePoller::createFrameBuffer"); if (buffer_ == NULL) { buffer_ = new char[bpl_ * height_]; } } nx-libs-3.5.99.23/nxcompshad/src/Core.h0000644000000000000000000001124213614532331014303 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef CorePoller_H #define CorePoller_H #include #include "Logger.h" #include "Regions.h" #include "Input.h" typedef enum{ LINE_HAS_CHANGED, LINE_NOT_CHECKED, LINE_NOT_CHANGED } LineStatus; typedef enum{ HIGHEST_PRIORITY = 0, PRIORITY = 30, NOT_PRIORITY = 90 } LinePriority; class CorePoller { public: CorePoller(Input*, Display*); virtual ~CorePoller(); virtual int init(); unsigned int width() const; unsigned int height() const; unsigned char depth() const; int isChanged(int (*)(void*), void *, int *); char *getFrameBuffer() const; void destroyFrameBuffer(); void createFrameBuffer(); Region lastUpdatedRegion(); Region getLastUpdatedRegion(); void handleInput(); void handleEvent(Display *, XEvent *); void handleWebKeyEvent(KeySym keysym, Bool isKeyPress); Display *getShadowDisplay(); void setShadowDisplay(Display *shadowDisplay); protected: unsigned int bpp_; unsigned int bpl_; unsigned int width_; unsigned int height_; int depth_; char *buffer_; unsigned long redMask_; unsigned long greenMask_; unsigned long blueMask_; unsigned long colorMask_[3]; char mirror_; char mirrorChanges_; virtual int updateShadowFrameBuffer(void) = 0; virtual char *getRect(XRectangle r) = 0; int imageByteOrder_; Display *shadowDisplay_; void update(char *src, XRectangle r); Region lastUpdatedRegion_; private: virtual void handleKeyboardEvent(Display *, XEvent *) = 0; virtual void handleWebKeyboardEvent(KeySym keysym, Bool isKeyPress) = 0; virtual void handleMouseEvent(Display *, XEvent *) = 0; Input *input_; static const int maxSliceHeight_; static const int minSliceHeight_; LineStatus *lineStatus_; int *linePriority_; static const char interlace_[]; int *lefts_; int *rights_; // FIXME: Make them friend. int differ(char *src, XRectangle r); }; inline unsigned int CorePoller::width() const { return width_; } inline unsigned int CorePoller::height() const { return height_; } inline unsigned char CorePoller::depth() const { return depth_; } inline char *CorePoller::getFrameBuffer() const { return buffer_; } inline void CorePoller::destroyFrameBuffer() { if (buffer_ != NULL) { delete[] buffer_; buffer_ = NULL; } } inline Region CorePoller::lastUpdatedRegion() { Region region = lastUpdatedRegion_; lastUpdatedRegion_ = XCreateRegion(); if (lastUpdatedRegion_ == NULL) { logError("CorePoller::lastUpdatedRegion", ESET(ENOMEM)); lastUpdatedRegion_ = region; return NULL; } return region; } inline Region CorePoller::getLastUpdatedRegion() { return lastUpdatedRegion_; } inline Display *CorePoller::getShadowDisplay() { return shadowDisplay_ ; } inline void CorePoller::setShadowDisplay(Display *shadowDisplay) { shadowDisplay_ = shadowDisplay; } #endif /* CorePoller_H */ nx-libs-3.5.99.23/nxcompshad/src/Input.cpp0000644000000000000000000000756013614532331015055 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #define PANIC #define WARNING #undef TEST #undef DEBUG #include "Input.h" #include "Logger.h" Input::Input() { logTrace("Input::Input"); eventsHead_ = NULL; eventsTail_ = NULL; keymap_ = NULL; } Input::~Input() { logTrace("Input::~Input"); Event *head = eventsHead_; while (head) { Event *next = head -> next; delete head -> event; delete head; head = next; } if (keymap_ != NULL) { logDebug("Input::~Input", "Delete keymap_ [%p].", keymap_); delete [] keymap_; } } void Input::pushEvent(Display *display, XEvent *event) { Event *tail = new Event; if (tail == NULL) { logError("Input::pushEvent", ESET(ENOMEM)); return; } tail -> next = NULL; tail -> display = display; tail -> event = event; if (eventsHead_ == NULL) { eventsHead_ = tail; } else { eventsTail_ -> next = tail; } eventsTail_ = tail; } XEvent *Input::popEvent() { Event *head = eventsHead_; if (head == NULL) { return 0; } XEvent *event = head -> event; eventsHead_ = head -> next; delete head; if (eventsHead_ == NULL) { eventsTail_ = NULL; } return event; } int Input::removeAllEvents(Display *display) { logTrace("Input::removeAllEvents"); int nRemoved = 0; Event *current = eventsHead_; while (current) { if (display == current -> display) { // // Update head of list. // if (current == eventsHead_) { eventsHead_ = current -> next; } // // Update tail of list. // if (current == eventsTail_) { eventsTail_ = eventsHead_; while (eventsTail_ && eventsTail_ -> next) { eventsTail_ = eventsTail_ -> next; } } // // Remove event. // Event *next = current -> next; delete current -> event; delete current; current = next; nRemoved++; } else { current = current -> next; } } return nRemoved; } nx-libs-3.5.99.23/nxcompshad/src/Input.h0000644000000000000000000000560413614532331014517 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Input_H #define Input_H #include typedef struct Event { struct Event *next; Display *display; XEvent *event; } Event; class Input { public: Input(); ~Input(); int checkIfEvent(); void pushEvent(Display *, XEvent *); XEvent *popEvent(); Display *currentDisplay(); int removeAllEvents(Display *); void setKeymap(char *keymap); char *getKeymap(); void setShadowDisplayName(char *shadowDisplayName); char *getShadowDisplayName(); private: Event *eventsHead_; Event *eventsTail_; char *keymap_; char *shadowDisplayName_; }; inline Display *Input::currentDisplay() { return eventsHead_ ? eventsHead_ -> display : NULL; } inline int Input::checkIfEvent() { return (eventsHead_ != NULL); } inline void Input::setKeymap(char *keymap) { keymap_ = keymap; } inline char *Input::getKeymap() { return keymap_; } inline void Input::setShadowDisplayName(char *shadowDisplayName) { shadowDisplayName_ = shadowDisplayName; } inline char *Input::getShadowDisplayName() { return shadowDisplayName_; } #endif /* Input_H */ nx-libs-3.5.99.23/nxcompshad/src/Logger.cpp0000644000000000000000000000733013614532331015170 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #define PANIC #define WARNING #undef TEST #define DEBUG #include "Misc.h" #include "Logger.h" Logger logger; void Logger::user(const char *format, va_list arguments) { char string[1024]; vsnprintf(string, 1024, format, arguments); fprintf(stderr, "%s\n", string); } void Logger::error(const char *name, int error) { fprintf(stderr, "PANIC! %s: Failed with code %d: %s\n", name, error, strerror(error)); } void Logger::warning(const char *name, const char *format, va_list arguments) { char string[1024]; vsnprintf(string, 1024, format, arguments); fprintf(stderr, "%s: WARNING! %s\n", name, string); } void Logger::test(const char *name, const char *format, va_list arguments) { char string[1024]; vsnprintf(string, 1024, format, arguments); fprintf(stderr, "%s: %s\n", name, string); } void Logger::trace(const char *name) { fprintf(stderr, "%s\n", name); } void Logger::debug(const char *name, const char *format, va_list arguments) { char string[1024]; vsnprintf(string, 1024, format, arguments); fprintf(stderr, "%s: %s\n", name, string); } void Logger::dump(const char *name, const char *data, int size) { fprintf(stderr, "%s: Dumping %d bytes of data at %p\n", name, size, data); for (int i = 0; i < size;) { fprintf(stderr, "[%d]\t", i); int t = i; for (unsigned int ii = 0; i < size && ii < 8; i++, ii++) { fprintf(stderr, "%02x/%d\t", data[i] & 0xff, data[i]); } for (unsigned int ii = i % 8; ii > 0 && ii < 8; ii++) { fprintf(stderr, "\t"); } i = t; for (unsigned int ii = 0; i < size && ii < 8; i++, ii++) { if (isprint(data[i])) { fprintf(stderr, "%c", data[i]); } else { fprintf(stderr, "."); } } fprintf(stderr, "\n"); } } nx-libs-3.5.99.23/nxcompshad/src/Logger.h0000644000000000000000000001137313614532331014637 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Logger_H #define Logger_H #include #include // // Error handling macros. // #define ESET(e) (errno = (e)) #define EGET() (errno) #define ESTR() strerror(errno) extern class Logger logger; class Logger { public: void user(const char *format, va_list arguments) __attribute__((format(printf, 2, 0))); void error(const char *name, int error); void warning(const char *name, const char *format, va_list arguments) __attribute__((format(printf, 3, 0))); void test(const char *name, const char *format, va_list arguments) __attribute__((format(printf, 3, 0))); void trace(const char *name); void debug(const char *name, const char *format, va_list arguments) __attribute__((format(printf, 3, 0))); void dump(const char *name, const char *data, int size); }; static inline void logUser(const char *format, ...) \ __attribute__((format(printf, 1, 2))) __attribute__((__unused__)); static inline void logError(const char *name, int error) \ __attribute__((__unused__)); static inline void logWarning(const char *name, const char *format, ...) \ __attribute__((format(printf, 2, 3))) __attribute__((__unused__)); static inline void logTest(const char *name, const char *format, ...) \ __attribute__((format(printf, 2, 3))) __attribute__((__unused__)); static inline void logTrace(const char *name) \ __attribute__((__unused__)); static inline void logDebug(const char *name, const char *format, ...) \ __attribute__((format(printf, 2, 3))) __attribute__((__unused__)); static inline void logDump(const char *name, const char *data, int size) \ __attribute__((__unused__)); static inline void logUser(const char *format, ...) { va_list arguments; va_start(arguments, format); logger.user(format, arguments); va_end(arguments); } static inline void logError(const char *name, int error) { #if defined(DEBUG) || defined(TEST) || \ defined(WARNING) || defined(PANIC) logger.error(name, error); #endif } static inline void logWarning(const char *name, const char *format, ...) { #if defined(DEBUG) || defined(TEST) || \ defined(WARNING) va_list arguments; va_start(arguments, format); logger.warning(name, format, arguments); va_end(arguments); #endif } static inline void logTest(const char *name, const char *format, ...) { #if defined(TEST) va_list arguments; va_start(arguments, format); logger.test(name, format, arguments); va_end(arguments); #endif } static inline void logTrace(const char *name) { #if defined(DEBUG) logger.trace(name); #endif } static inline void logDebug(const char *name, const char *format, ...) { #if defined(DEBUG) va_list arguments; va_start(arguments, format); logger.debug(name, format, arguments); va_end(arguments); #endif } static inline void logDump(const char *name, const char *data, int size) { #if defined(TEST) logger.dump(name, data, size); #endif } #endif /* Logger_H */ nx-libs-3.5.99.23/nxcompshad/src/Makefile.am0000644000000000000000000000215413614532331015300 0ustar NULL = lib_LTLIBRARIES = libXcompshad.la libXcompshad_la_SOURCES = \ Core.cpp \ Input.cpp \ Logger.cpp \ Manager.cpp \ Shadow.cpp \ Updater.cpp \ X11.cpp \ $(NULL) libXcompshad_la_LIBADD = \ -lX11 \ @Xext_LIBS@ \ @Xdamage_LIBS@ \ @Xrandr_LIBS@ \ @Xtst_LIBS@ \ -L$(top_srcdir)/../nx-X11/lib/src/.libs -lNX_X11 \ $(NULL) AM_CFLAGS = \ $(Xext_CFLAGS) \ $(Xdamage_CFLAGS) \ $(Xrandr_CFLAGS) \ $(Xtst_CFLAGS) \ $(NULL) AM_CXXFLAGS = \ $(BASE_CXXFLAGS) \ $(NULL) AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/../nx-X11/exports/include \ $(NULL) libXcompshad_la_LDFLAGS = \ -version-number @LT_COMPSHAD_VERSION@ -no-undefined \ -R '$(libdir)/nx/X11' \ $(NULL) if TARGET_ELF libXcompshad_la_LDFLAGS += \ -Wl,--enable-new-dtags \ $(NULL) endif TARGET_ELF libXcompshadincludedir = $(includedir)/nx libXcompshadinclude_HEADERS = \ $(top_srcdir)/include/Shadow.h \ $(NULL) nx-libs-3.5.99.23/nxcompshad/src/Manager.cpp0000644000000000000000000001524113614532331015323 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #define PANIC #define WARNING #undef TEST #undef DEBUG #include "Manager.h" #include "Logger.h" UpdateManager::UpdateManager(int w, int h, char *f, Input *i) : width_(w), height_(h), frameBuffer_(f), input_(i) { logTrace("UpdateManager::UpdateManager"); nUpdater = 0; updaterVector = NULL; updateManagerRegion_ = NULL; } UpdateManager::~UpdateManager() { logTrace("UpdateManager::~UpdateManager"); for (int i = 0; i < nUpdater; i++) { delete updaterVector[i]; } delete [] updaterVector; } Updater *UpdateManager::createUpdater(char *displayName, Display *display) { Updater *updater = new Updater(displayName, display); if (updater == NULL) { logError("UpdateManager::createUpdater", ESET(ENOMEM)); return NULL; } if (updater -> init(width_, height_, frameBuffer_, input_) == -1) { logError("UpdateManager::createUpdater", EGET()); delete updater; return NULL; } return updater; } UpdaterHandle UpdateManager::addUpdater(char *displayName, Display *display) { Updater *newUpdater = createUpdater(displayName, display); if (newUpdater == NULL) { logError("UpdateManager::addUpdater", EGET()); return NULL; } Updater **newUpdaterVector = new Updater*[nUpdater + 1]; if (newUpdaterVector == NULL) { logError("UpdateManager::addUpdater", ESET(ENOMEM)); delete newUpdater; return NULL; } for (int i = 0; i < nUpdater; i++) { newUpdaterVector[i] = updaterVector[i]; } newUpdaterVector[nUpdater] = newUpdater; delete [] updaterVector; updaterVector = newUpdaterVector; nUpdater++; logTest("UpdateManager::AddUpdater", "Number of updaters [%d].", nUpdater); return reinterpret_cast(newUpdater); } int UpdateManager::removeAllUpdaters() { logTest("UpdateManager::removeAllUpdaters", "Number of updaters [%d].", nUpdater); int nullUpdaters = 0; for (int i = nUpdater; i > 0; i--) { if (removeUpdater(reinterpret_cast(updaterVector[i - 1])) == 0) { nullUpdaters++; } } if (nUpdater == 0) { return 1; } if (nUpdater == nullUpdaters) { logTest("UpdateManager::removeAllUpdaters", "Ignored null records in Updater vector."); return 0; } logTest("UpdateManager::removeAllUpdaters", "Failed to remove some updaters."); return -1; } int UpdateManager::removeUpdater(UpdaterHandle handle) { Updater * const updater = (Updater*) handle; logTest("UpdateManager::removeUpdater", "Removing Updater [%p].", updater); if (updater == NULL) { return 0; } for (int i = 0; i < nUpdater; i++) { if (updater == updaterVector[i]) { updaterVector[i] = updaterVector[nUpdater - 1]; nUpdater--; delete updater; return 1; } } logTest("UpdateManager::removeUpdater", "Couldn't find Updater [%p].", updater); return -1; } void UpdateManager::addRegion(Region region) { logTrace("UpdateManager::addRegion"); for (int i = 0; i < nUpdater; i++) { updaterVector[i] -> addRegion(region); } XDestroyRegion(region); } void UpdateManager::update() { logTrace("UpdateManager::update"); for (int i = 0; i < nUpdater; i++) { /*updaterVector[i] -> update();*/ if (updaterVector[i] -> getUpdateRegion()) { logDebug("UpdateManager::update", "pRegion [%p] rect[%ld].", updaterVector[i] -> getUpdateRegion(), (updaterVector[i] -> getUpdateRegion()) -> numRects); updateManagerRegion_ = updaterVector[i] -> getUpdateRegion(); // // FIXME: Remove me. // for (int j = 0; j < updateManagerRegion_ -> numRects; j++) { int x = updateManagerRegion_ -> rects[j].x1; int y = updateManagerRegion_ -> rects[j].y1; unsigned int width = updateManagerRegion_ -> rects[j].x2 - updateManagerRegion_ -> rects[j].x1; unsigned int height = updateManagerRegion_ -> rects[j].y2 - updateManagerRegion_ -> rects[j].y1; logDebug("UpdateManager::update", "x[%d]y[%d]width[%u]height[%u], updateManagerRegion_[%p]", x, y, width, height, updateManagerRegion_); } } } } void UpdateManager::handleInput() { logTrace("UpdateManager::handleInput"); for (int i = 0; i < nUpdater; i++) { try { updaterVector[i] -> handleInput(); } catch (UpdaterClosing u) { logTest("UpdateManager::handleInput", "Caught exception UpdaterClosing()."); removeUpdater((UpdaterHandle)updaterVector[i]); // // Now the i-element of the updaterVector // is changed. We don't want to skip it. // i--; } } } void UpdateManager::newRegion() { logTrace("UpdateManager::newRegion"); for (int i = 0; i < nUpdater; i++) { updaterVector[i] -> newRegion(); } } nx-libs-3.5.99.23/nxcompshad/src/Manager.h0000644000000000000000000000632013614532331014766 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef UpdateManager_H #define UpdateManager_H #include #include "Updater.h" #include "Regions.h" #include "Input.h" typedef char* UpdaterHandle; class UpdateManager { public: UpdateManager(int, int, char *, Input *); ~UpdateManager(); void handleInput(); void addRegion(Region); void update(); UpdaterHandle addUpdater(char *displayName, Display *display); int removeUpdater(UpdaterHandle); int removeAllUpdaters(); int numberOfUpdaters(); int getWidth(); int getHeight(); char *getBuffer(); Region getUpdateManagerRegion(); void destroyUpdateManagerRegion(); void newRegion(); private: Updater *createUpdater(char *displayName, Display *display); int width_; int height_; char *frameBuffer_; Input *input_; int nUpdater; Updater **updaterVector; Region updateManagerRegion_; }; inline int UpdateManager::numberOfUpdaters() { return nUpdater; } inline int UpdateManager::getWidth() { return width_; } inline int UpdateManager::getHeight() { return height_; } inline char *UpdateManager::getBuffer() { return frameBuffer_; } inline Region UpdateManager::getUpdateManagerRegion() { return updateManagerRegion_; } inline void UpdateManager::destroyUpdateManagerRegion() { if (updateManagerRegion_ != NULL) { XDestroyRegion(updateManagerRegion_); updateManagerRegion_ = NULL; } } #endif /* UpdateManager_H */ nx-libs-3.5.99.23/nxcompshad/src/Misc.h0000644000000000000000000000414513614532331014312 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Misc_H #define Misc_H #include #include #include using namespace std; // // Error handling macros. // #define ESET(e) (errno = (e)) #define EGET() (errno) #define ESTR() strerror(errno) // // Log file. // extern ostream *logofs; #endif /* Misc_H */ nx-libs-3.5.99.23/nxcompshad/src/Poller.h0000644000000000000000000000360413614532331014653 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Poller_H #define Poller_H #include "X11.h" #endif /* Poller_H */ nx-libs-3.5.99.23/nxcompshad/src/Regions.h0000644000000000000000000000411013614532331015015 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Region_H #define Region_H #include #include typedef struct { short x1, x2, y1, y2; } Box, BOX, BoxRec, *BoxPtr; struct _XRegion { long size; long numRects; BOX *rects; BOX extents; }; #endif /* Region_H */ nx-libs-3.5.99.23/nxcompshad/src/Shadow.cpp0000644000000000000000000002304513614532331015177 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #define PANIC #define WARNING #undef TEST #undef DEBUG #include "Logger.h" #include "Shadow.h" #include "Poller.h" #include "Manager.h" typedef struct { KeySym *map; KeyCode minKeyCode, maxKeyCode; int mapWidth; } KeySymsRec, *KeySymsPtr; KeySymsPtr NXShadowKeymap = NULL; ShadowOptions NXShadowOptions = {1, 1, -1}; static int mirrorException = 0; static UpdateManager *updateManager; static Poller *poller; static Input *input; inline bool NXShadowNotInitialized() { // // updateManager depends on input and poller. // So this test seem redundant. // // return (input == NULL) || (poller == NULL) || (updateManager == NULL); // return (updateManager == NULL); } #ifdef NEED_SIGNAL_HANDLER static void NXSignalHandler(int signal) { logTest("NXSignalHandler", "Got signal [%d]", signal); if (signal == SIGINT) { mirrorException = 1; } else if (signal == SIGTERM) { mirrorException = 1; } } static int NXInitSignal() { logTrace("NXInitSignal"); struct sigaction sa; sa.sa_handler = NXSignalHandler; sigfillset(&sa.sa_mask); sa.sa_flags = 0; int res; while ((res = sigaction(SIGINT, &sa, NULL)) == -1 && errno == EINTR); if (res == -1) { logError("NXInitSignal", EGET()); return -1; } return 1; } #endif static void NXHandleException() { if (mirrorException) { mirrorException = 0; NXShadowRemoveAllUpdaters(); } } static int NXCreateInput(char *keymap, char *shadowDisplayName) { logTrace("NXCreateInput"); input = new Input; if (input == NULL) { logError("NXCreateInput", ESET(ENOMEM)); return -1; } input -> setKeymap(keymap); input -> setShadowDisplayName(shadowDisplayName); return 1; } static int NXCreatePoller(Display *display, Display **shadowDisplay) { logTrace("NXCreatePoller"); if (input == NULL) { logError("NXCreatePoller", ESET(EBADF)); return -1; } poller = new Poller(input,display); if (poller == NULL) { logError("NXCreatePoller", ESET(ENOMEM)); return -1; } if (poller -> init() == -1) { logWarning("NXCreatePoller", "Failed to initialize poller."); return -1; } *shadowDisplay = poller -> getShadowDisplay(); logTest("NXCreatePoller", "Poller geometry [%d, %d], ShadowDisplay[%p].", poller -> width(), poller -> height(), (Display *) *shadowDisplay); return 1; } static int NXCreateUpdateManager() { logTrace("NXCreateUpdateManager"); if (input == NULL || poller == NULL) { logError("NXCreateUpdateManager", ESET(EBADF)); return -1; } updateManager = new UpdateManager(poller -> width(), poller -> height(), poller -> getFrameBuffer(), input); if (updateManager == NULL) { logError("NXCreateUpdateManager", ESET(ENOMEM)); return -1; } return 1; } void NXShadowResetOptions() { NXShadowOptions.optionShmExtension = 1; NXShadowOptions.optionDamageExtension = 1; } // // Exported functions. // int NXShadowHasUpdaters() { logTrace("NXShadowHasUpdaters"); return (updateManager && updateManager -> numberOfUpdaters()) ? 1 : 0; } int NXShadowRemoveAllUpdaters() { logTrace("NXShadowRemoveAllUpdaters"); return updateManager ? updateManager -> removeAllUpdaters() : 0; } int NXShadowRemoveUpdater(UpdaterHandle handle) { logTrace("NXShadowRemoveUpdater"); return updateManager ? updateManager -> removeUpdater(handle) : 0; } UpdaterHandle NXShadowAddUpdater(char *displayName) { logTrace("NXShadowAddUpdater"); return updateManager ? updateManager -> addUpdater(displayName, NULL) : NULL; } int NXShadowAddUpdaterDisplay(void *dpy, int *w, int *h, unsigned char *d) { Display *display = reinterpret_cast(dpy); logTrace("NXShadowAddUpdaterDisplay"); if ((updateManager ? updateManager -> addUpdater(NULL, display) : NULL) == NULL) { logTest("NXShadowAddUpdaterDisplay", "Error"); return 0; } *w = updateManager -> getWidth(); *h = updateManager -> getHeight(); *d = poller -> depth(); return 1; } int NXShadowCreate(void *dpy, char *keymap, char* shadowDisplayName, void **shadowDpy) { logTrace("NXShadowCreate"); Display *display = reinterpret_cast(dpy); Display **shadowDisplay = reinterpret_cast(shadowDpy); /* if (NXInitSignal() != 1) { logError("NXShadowCreate", EGET()); return -1; }*/ if (NXCreateInput(keymap, shadowDisplayName) != 1) { logError("NXShadowCreate", EGET()); return -1; } if (NXCreatePoller(display, shadowDisplay) != 1) { logWarning("NXShadowCreate", "NXCreatePoller failed."); return -1; } if (NXCreateUpdateManager() != 1) { logError("NXShadowCreate", EGET()); return -1; } return 1; } void NXShadowSetDisplayUid(int uid) { NXShadowOptions.optionShadowDisplayUid = uid; } void NXShadowDisableShm(void) { logUser("NXShadowDisableShm: Disabling SHM.\n"); NXShadowOptions.optionShmExtension = 0; } void NXShadowDisableDamage(void) { NXShadowOptions.optionDamageExtension = 0; } void NXShadowGetScreenSize(int *w, int *h) { poller -> getScreenSize(w, h); } void NXShadowSetScreenSize(int *w, int *h) { poller -> setScreenSize(w, h); } void NXShadowDestroy() { if (poller) { delete poller; poller = NULL; } if (updateManager) { delete updateManager; updateManager = NULL; } if (input) { delete input; input = NULL; } } void NXShadowHandleInput() { logTrace("NXShadowHandleInput"); if (NXShadowNotInitialized()) { logError("NXShadowHandleInput - NXShadow not properly initialized.", ESET(EBADF)); return; } NXHandleException(); updateManager -> handleInput(); poller -> handleInput(); } int NXShadowHasChanged(int (*callback)(void *), void *arg, int *suspended) { int result; logTrace("NXShadowHasChanged"); if (NXShadowNotInitialized()) { logError("NXShadowHasChanged - NXShadow not properly initialized.", ESET(EBADF)); return -1; } // // FIXME //updateManager -> destroyUpdateManagerRegion(); // updateManager -> newRegion(); poller -> getEvents(); result = poller -> isChanged(callback, arg, suspended); if (result == 1) { updateManager -> addRegion(poller -> lastUpdatedRegion()); return 1; } else if (result == -1) { logTest("NXShadowHasChanged", "Scanline error."); return -1; } return 0; } void NXShadowExportChanges(long *numRects, char **pBox) { Region pReg; logTrace("NXShadowExportChanges"); if (NXShadowNotInitialized()) { logError("NXShadowExportChanges - NXShadow not properly initialized.", ESET(EBADF)); } updateManager -> update(); pReg = updateManager -> getUpdateManagerRegion(); *numRects = pReg -> numRects; *pBox = (char *)pReg -> rects; logTest("NXShadowExportChanges", "numRects [%ld] pBox[%p], pReg->numRects[%ld], rects[%p], size[%lu]", *numRects, *pBox, pReg -> numRects, &(pReg -> rects -> x2), (unsigned long) sizeof(pReg -> rects -> x2)); } void NXShadowEvent(Display *display, XEvent event) { poller -> handleEvent(display, &event); } void NXShadowWebKeyEvent(KeySym keysym, Bool isKeyPress) { poller -> handleWebKeyEvent(keysym, isKeyPress); } void NXShadowUpdateBuffer(void **buffer) { char **fBuffer = reinterpret_cast(buffer); if (*fBuffer != NULL) { poller -> destroyFrameBuffer(); poller -> init(); } *fBuffer = poller -> getFrameBuffer(); logTest("NXShadowUpdateBuffer","New frame buffer [0x%p]", (void *)*fBuffer); } void NXShadowInitKeymap(void *keysyms) { NXShadowKeymap = (KeySymsPtr) keysyms; logTest("NXShadowInitKeymap","KeySyms pointer [0x%p]", (void *)NXShadowKeymap); } nx-libs-3.5.99.23/nxcompshad/src/Updater.cpp0000644000000000000000000002314613614532331015360 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #define PANIC #define WARNING #undef TEST #undef DEBUG // #include // #include "Updater.h" #include "Logger.h" Updater::Updater(char *displayName, Display *display) { logTrace("Updater::Updater"); displayName_ = displayName; display_ = display; closeDisplay_ = false; image_ = NULL; updateRegion_ = NULL; buffer_ = NULL; } Updater::~Updater() { logTrace("Updater::~Updater"); if (input_) { int removedEvents = input_ -> removeAllEvents(display_); logTest("Updater::~Updater", "Removed events in input queue is [%d].", removedEvents); } if (display_) { XDestroyWindow(display_, window_); XFreePixmap(display_, pixmap_); if (closeDisplay_) { XCloseDisplay(display_); } } if (image_) { image_ -> data = NULL; XDestroyImage(image_); } if (updateRegion_) { XDestroyRegion(updateRegion_); } } int Updater::init(int width, int height, char *fb, Input *input) { logTrace("Updater::init"); if (fb == NULL || input == NULL || width <= 0 || height <= 0) { logError("Updater::init", ESET(EINVAL)); return -1; } width_ = width; height_ = height; buffer_ = fb; input_ = input; /* if (display_ == NULL) { display_ = XOpenDisplay(displayName_); closeDisplay_ = true; if (display_ == NULL) { logError("Updater::init", ESET(ENOMSG)); return -1; } } */ depth_ = DefaultDepth(display_, DefaultScreen(display_)); if (depth_ == 8) bpl_ = width_; else if (depth_ == 16) bpl_ = width_ * 2; else bpl_ = width_ * 4; logTest("Updater::init", "Server geometry [%d, %d] depth [%d] bpl [%d].", width_, height_, depth_, bpl_); /* int bitmap_pad = 8; image_ = XCreateImage(display_, DefaultVisual(display_, DefaultScreen(display_)), depth_, ZPixmap, 0, buffer_, width_, height_, bitmap_pad, 0); if (image_ == NULL) { logError("Updater::init", ESET(ENOMSG)); logTest("Updater::init", "Failed to create default image."); return -1; } pixmap_ = XCreatePixmap(display_, DefaultRootWindow(display_), width_, height_, depth_); unsigned int mask = CWBackPixmap | CWBorderPixel | CWEventMask; XSetWindowAttributes attributes; attributes.background_pixmap = pixmap_; attributes.border_pixel = WhitePixel(display_, DefaultScreen(display_)); attributes.event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask; window_ = XCreateWindow(display_, DefaultRootWindow(display_), 0, 0, width_, height_, 0, depth_, InputOutput, DefaultVisual(display_, DefaultScreen(display_)), mask, &attributes); if (window_ == None) { logError("Updater::init", ESET(ENOMSG)); return -1; } XSizeHints *size_hints; if ((size_hints = XAllocSizeHints()) == NULL) { logError("Updater::init", ESET(ENOMEM)); return -1; } size_hints -> flags = PMinSize | PMaxSize; size_hints -> min_width = width_; size_hints -> max_width = width_; size_hints -> min_height = height_; size_hints -> max_height = height_; XSetWMNormalHints(display_, window_, size_hints); XFree(size_hints); Atom deleteWMatom = XInternAtom(display_, "WM_DELETE_WINDOW", 1); XSetWMProtocols(display_, window_, &deleteWMatom, 1); XMapWindow(display_, window_);*/ updateRegion_ = XCreateRegion(); logTest("Updater::init", "updateRegion_[%p]", updateRegion_); return 1; } void Updater::addRegion(Region region) { // // FIXME: Is this too paranoid ? // if (updateRegion_ == NULL) { logError("Updater::addRegion", ESET(EINVAL)); return; } XUnionRegion(region, updateRegion_, updateRegion_); } void Updater::update() { logTrace("Updater::update"); if (updateRegion_ == NULL) { logError("Updater::update", ESET(EINVAL)); return; } logTest("Updater::update", "Number of rectangles [%ld].", updateRegion_ -> numRects); /* for (; updateRegion_ -> numRects > 0; updateRegion_ -> numRects--) { int n = updateRegion_ -> numRects - 1; int x = updateRegion_ -> rects[n].x1; int y = updateRegion_ -> rects[n].y1; unsigned int width = updateRegion_ -> rects[n].x2 - updateRegion_ -> rects[n].x1; unsigned int height = updateRegion_ -> rects[n].y2 - updateRegion_ -> rects[n].y1; logDebug("Updater::update", "Sending rectangle: [%d, %d, %d, %d].", x, y, width, height); // // We need to update the extents. // int bitmap_pad; if (depth_ == 32 || depth_ == 24) { bitmap_pad = 32; } else if (depth_ == 16) { if ((width & 1) == 0) { bitmap_pad = 32; } else { bitmap_pad = 16; } } else if ((width & 3) == 0) { bitmap_pad = 32; } else if ((width & 1) == 0) { bitmap_pad = 16; } else { bitmap_pad = 8; }*/ /* image_ -> bitmap_pad = bitmap_pad;*/ /* NXShadowCorrectColor(x, y, width, height);*/ /* XPutImage(display_, pixmap_, DefaultGC(display_, DefaultScreen(display_)), image_, x, y, x, y, width, height); XClearArea(display_, window_, x, y, width, height, 0); }*/ // // Should we reduces the box vector ? // // BOX *box = Xrealloc(updateRegion_ -> rects, // updateRegion_ -> numRects == 0 ? sizeof(BOX) : // updateRegion_ -> numRects * sizeof(BOX)); // // if (box) // { // updateRegion_ -> rects = box; // updateRegion_ -> size = 1; // } // if (updateRegion_ -> numRects == 0) { updateRegion_ -> extents.x1 = 0; updateRegion_ -> extents.y1 = 0; updateRegion_ -> extents.x2 = 0; updateRegion_ -> extents.y2 = 0; } else { // // FIXME: We have to update the region extents. // logTest("Updater::update", "Region extents has not been updated."); } } void Updater::handleInput() { logTrace("Updater::handleInput"); XEvent *event = new XEvent; if (event == NULL) { logError("Updater::handleInput", ESET(ENOMEM)); return; } while (XCheckIfEvent(display_, event, anyEventPredicate, NULL)) { switch (event -> type) { /* case ClientMessage: { Atom wmProtocols = XInternAtom(display_, "WM_PROTOCOLS", 0); Atom wmDeleteWindow = XInternAtom(display_, "WM_DELETE_WINDOW", 0); if (event -> xclient.message_type == wmProtocols && (Atom)event -> xclient.data.l[0] == wmDeleteWindow) { logTest("Updater::handleInput", "Got client message of type WM_PROTOCOLS and value WM_DELETE_WINDOW," " throwing exception UpdaterClosing."); delete event; throw UpdaterClosing(); } else { logTest("Updater::handleInput", "Unexpected client message type [%ld] format [%d] first value [%ld]", event -> xclient.message_type, event -> xclient.format, event -> xclient.data.l[0]); } break; }*/ case KeyPress: case KeyRelease: case ButtonPress: case ButtonRelease: case MotionNotify: { input_ -> pushEvent(display_, event); event = new XEvent; if (event == NULL) { logError("Updater::handleInput", ESET(ENOMEM)); return; } break; } default: { logTest("Updater::handleInput", "Handling unexpected event [%d].", event -> type); break; } } } delete event; } void Updater::newRegion() { if (updateRegion_ != NULL) { XDestroyRegion(updateRegion_); } updateRegion_ = XCreateRegion(); logTest("Updater::newRegion", "updateRegion_ [%p].", updateRegion_); } // // Private functions. // nx-libs-3.5.99.23/nxcompshad/src/Updater.h0000644000000000000000000000544613614532331015030 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Updater_H #define Updater_H #include #include "Regions.h" #include "Input.h" class UpdaterClosing {}; class Updater { public: Updater(char *displayName, Display *display); ~Updater(); int init(int, int, char *, Input*); void addRegion(Region r); void update(); void handleInput(); XImage *getImage(); Region getUpdateRegion(); void newRegion(); private: Input *input_; static inline Bool anyEventPredicate(Display*, XEvent*, XPointer); void handleKeyboardEvent(XEvent &event); char *displayName_; char *buffer_; bool closeDisplay_; Display *display_; int depth_; int width_; int height_; int bpl_; Window window_; XImage *image_; Pixmap pixmap_; Region updateRegion_; }; Bool Updater::anyEventPredicate(Display*, XEvent*, XPointer) { return true; } inline XImage* Updater::getImage() { return image_; } inline Region Updater::getUpdateRegion() { return updateRegion_; } #endif /* Updater_H */ nx-libs-3.5.99.23/nxcompshad/src/X11.cpp0000644000000000000000000011702513614532331014325 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #define PANIC #define WARNING #undef TEST #undef DEBUG #include #include #include #include "X11/include/XTest_nxcompshad.h" #include #include #include #include "Poller.h" #include "Logger.h" #include "Shadow.h" #define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3)) #undef TRANSLATE_KEYCODES #define TRANSLATE_ALWAYS typedef struct { KeySym *map; KeyCode minKeyCode, maxKeyCode; int mapWidth; } KeySymsRec, *KeySymsPtr; extern KeySymsPtr NXShadowKeymap; typedef struct _KeyPressed { KeyCode keyRcvd; KeyCode keySent; struct _KeyPressed *next; } KeyPressedRec; static KeyPressedRec *shadowKeyPressedPtr = NULL; static KeySym *shadowKeysyms = NULL; static KeySym *masterKeysyms = NULL; static KeySym *shadowKeymap = NULL; static int shadowMinKey, shadowMaxKey, shadowMapWidth; static int masterMinKey, masterMaxKey, masterMapWidth; static int leftShiftOn = 0; static int rightShiftOn = 0; static int modeSwitchOn = 0; static int level3ShiftOn = 0; static int altROn = 0; static int sentFakeLShiftPress = 0; static int sentFakeLShiftRelease = 0; static int sentFakeRShiftRelease = 0; static int sentFakeModeSwitchPress = 0; static int sentFakeModeSwitchRelease = 0; static int sentFakeLevel3ShiftPress = 0; static int sentFakeLevel3ShiftRelease = 0; static int sentFakeAltRRelease = 0; static int shmInitTrap = 0; Poller::Poller(Input *input, Display *display, int depth) : CorePoller(input, display) { logTrace("Poller::Poller"); display_ = NULL; shadowDisplayName_ = input -> getShadowDisplayName(); tmpBuffer_ = NULL; xtestExtension_ = -1; shmExtension_ = -1; randrExtension_ = -1; damageExtension_ = -1; shadowDisplayUid_ = -1; image_ = NULL; shminfo_ = NULL; } Poller::~Poller() { logTrace("Poller::~Poller"); if (shmExtension_ == 1) { XShmDetach(display_, shminfo_); XDestroyImage(image_); shmdt(shminfo_ -> shmaddr); shmctl(shminfo_ -> shmid, IPC_RMID, 0); } if (shminfo_ != NULL) { delete shminfo_; shminfo_ = NULL; } if (display_ != NULL) { XCloseDisplay(display_); } if (tmpBuffer_ != NULL && shmExtension_ != -1 && damageExtension_ == 1) { XFree(tmpBuffer_); tmpBuffer_ = NULL; } } int Poller::init() { logTrace("Poller::init"); if (display_ == NULL) { display_ = XOpenDisplay(shadowDisplayName_); setShadowDisplay(display_); } logTest("Poller::init:" ,"Shadow display [%p] name [%s].", (Display *) display_, shadowDisplayName_); if (display_ == NULL) { logTest("Poller::init", "Failed to connect to display [%s].", shadowDisplayName_ ? shadowDisplayName_ : ""); return -1; } setRootSize(); logTest("Poller::init", "Screen geometry is [%d, %d] depth is [%d] bpl [%d] bpp [%d].", width_, height_, depth_, bpl_, bpp_); xtestInit(); shmInit(); randrInit(); damageInit(); return CorePoller::init(); } int Poller::updateShadowFrameBuffer(void) { if (shmExtension_ == 1) { if (XShmGetImage(display_, DefaultRootWindow(display_), image_, 0, 0, AllPlanes) == 0) { logDebug("Poller::updateShadowFrameBuffer", "XShmGetImage failed!"); return -1; } } else { image_ = XGetImage(display_, DefaultRootWindow(display_), 0, 0, width_, height_, AllPlanes, ZPixmap); if (image_ == NULL) { logDebug("Poller::updateShadowFrameBuffer", "XGetImage failed!"); return -1; } } return 1; } char *Poller::getRect(XRectangle r) { logTrace("Poller::getRect"); logDebug("Poller::getRect", "Going to retrieve rectangle [%d, %d, %d, %d].", r.x, r.y, r.width, r.height); if (shmExtension_ == 1) { if (damageExtension_ == 1) { image_ -> width = r.width; image_ -> height = r.height; image_ -> bytes_per_line = ROUNDUP((image_ -> bits_per_pixel * image_ -> width), image_ -> bitmap_pad); if (XShmGetImage(display_, DefaultRootWindow(display_), image_, r.x, r.y, AllPlanes) == 0) { logDebug("Poller::getRect", "XShmGetImage failed!"); return NULL; } tmpBuffer_ = image_ -> data; } else { image_ -> width = r.width; image_ -> height = r.height; image_ -> bytes_per_line = ROUNDUP((image_ -> bits_per_pixel * image_ -> width), image_ -> bitmap_pad); if (XShmGetImage(display_, DefaultRootWindow(display_), image_, r.x, r.y, AllPlanes) == 0) { logDebug("Poller::getRect", "XShmGetImage failed!"); } tmpBuffer_ = image_ -> data; } } else { if (tmpBuffer_) { XFree(tmpBuffer_); tmpBuffer_ = NULL; } image_ = XGetImage(display_, DefaultRootWindow(display_), r.x, r.y, r.width, r.height, AllPlanes, ZPixmap); if (image_ == NULL) { logError("Poller::getRect", ESET(ENOMSG)); return NULL; } tmpBuffer_ = image_ -> data; if (image_ -> obdata) { XFree(image_ -> obdata); } XFree(image_); image_ = NULL; } return tmpBuffer_; } void Poller::shmInit(void) { int major, minor; int pixmaps; logTest("Poller::shmInit", "Added shmExtension_ [%d].", shmExtension_); if (shmExtension_ >= 0) { logDebug("Poller::shmInit", "Called with shared memory already initialized."); if (shmInitTrap == 0) { return; } } if (shmExtension_ < 0 && NXShadowOptions.optionShmExtension == 0) { shmExtension_ = 0; logUser("Poller::shmInit: Disabling use of MIT-SHM extension.\n"); return; } if (XShmQueryVersion(display_, &major, &minor, &pixmaps) == 0) { logDebug("Poller::shmInit", "MIT_SHM: Shared memory extension not available."); shmExtension_ = 0; } else { logDebug("Poller::shmInit", "MIT_SHM: Shared memory extension available."); if (shminfo_ != NULL) { destroyShmImage(); } shminfo_ = (XShmSegmentInfo* ) new XShmSegmentInfo; if (shminfo_ == NULL) { logError("Poller::shmInit", ESET(ENOMEM)); shmExtension_ = 0; return; } image_ = (XImage *)XShmCreateImage(display_, display_ -> screens[0].root_visual, depth_, ZPixmap, NULL, shminfo_, width_, height_); if (image_ == NULL) { logError("Poller::shmInit", ESET(ENOMSG)); shmExtension_ = 0; return; } shadowDisplayUid_ = NXShadowOptions.optionShadowDisplayUid; logDebug("Poller::shmInit", "Master X server uid [%d].", NXShadowOptions.optionShadowDisplayUid); shminfo_ -> shmid = shmget(IPC_PRIVATE, image_ -> bytes_per_line * image_ -> height, IPC_CREAT | 0666); if (shminfo_ -> shmid < 0) { logDebug("Poller::shmInit", "kernel id error."); shmExtension_ = 0; return; } logDebug("Poller::shmInit", "Created shm segment with shmid [%d].", shminfo_ -> shmid); shminfo_ -> shmaddr = (char *)shmat(shminfo_ -> shmid, 0, 0); if (shminfo_ -> shmaddr < (void *)0) { logWarning("Poller::shmInit", "Couldn't attach to shm segment."); } logDebug("Poller::shmInit", "shminfo_ -> shmaddr [%p].", shminfo_ -> shmaddr); image_ -> data = shminfo_ -> shmaddr; shminfo_ -> readOnly = 0; if (XShmAttach(display_, shminfo_) == 0) { logDebug("Poller::shmInit", "XShmAttach failed."); shmExtension_ = 0; return; } // // Mark the shm segment to be destroyed after // the last process detach. Let the X server // complete the X_ShmAttach request, before. // XSync(display_, 0); struct shmid_ds ds; shmctl(shminfo_ -> shmid, IPC_STAT, &ds); if (shadowDisplayUid_ != -1) { ds.shm_perm.uid = (ushort) shadowDisplayUid_; } else { logWarning("Poller::shmInit", "Couldn't set uid for shm segment."); } ds.shm_perm.mode = 0600; shmctl(shminfo_ -> shmid, IPC_SET, &ds); shmctl(shminfo_ -> shmid, IPC_STAT, &ds); shmctl(shminfo_ -> shmid, IPC_RMID, 0); logDebug("Poller::shmInit", "Number of attaches to shm segment [%d] are [%d].\n", shminfo_ -> shmid, (int) ds.shm_nattch); if (ds.shm_nattch > 2) { logWarning("Poller::shmInit", "More than two attaches to the shm segment."); destroyShmImage(); shmExtension_ = 0; return; } shmExtension_ = 1; } } void Poller::keymapShadowInit(Display *display) { int i, len; CARD32 *map; if (NXShadowKeymap != NULL) { shadowMinKey = NXShadowKeymap -> minKeyCode; shadowMaxKey = NXShadowKeymap -> maxKeyCode; shadowMapWidth = NXShadowKeymap -> mapWidth; len = (shadowMaxKey - shadowMinKey + 1) * shadowMapWidth; map = (CARD32 *) NXShadowKeymap -> map; if (shadowKeymap != NULL) { free(shadowKeymap); } shadowKeymap = (KeySym *) malloc(len * sizeof(KeySym)); if (shadowKeymap != NULL) { for (i = 0; i < len; i++) { shadowKeymap[i] = map[i]; } shadowKeysyms = shadowKeymap; } } if (shadowKeysyms == NULL) { XDisplayKeycodes(display, &shadowMinKey, &shadowMaxKey); shadowKeysyms = XGetKeyboardMapping(display, shadowMinKey, shadowMaxKey - shadowMinKey + 1, &shadowMapWidth); } #ifdef DEBUG if (shadowKeysyms != NULL) { for (i = 0; i < (shadowMaxKey - shadowMinKey + 1) * shadowMapWidth; i++) { if (i % shadowMapWidth == 0) { logDebug("Poller::keymapShadowInit", "keycode [%d]", (int) (i / shadowMapWidth)); } logDebug("\tkeysym", " [%x] [%s]", (unsigned int) shadowKeysyms[i], XKeysymToString(shadowKeysyms[i])); } } #endif } void Poller::keymapMasterInit() { XDisplayKeycodes(display_, &masterMinKey, &masterMaxKey); masterKeysyms = XGetKeyboardMapping(display_, masterMinKey, masterMaxKey - masterMinKey + 1, &masterMapWidth); #ifdef DEBUG if (masterKeysyms != NULL) { for (int i = 0; i < (masterMaxKey - masterMinKey + 1) * masterMapWidth; i++) { if (i % masterMapWidth == 0) { logDebug("Poller::keymapMasterInit", "keycode [%d]", (int) (i / masterMapWidth)); } logDebug("\tkeysym", " [%x] [%s]", (unsigned int) masterKeysyms[i], XKeysymToString(masterKeysyms[i])); } } #endif } KeySym Poller::keymapKeycodeToKeysym(KeyCode keycode, KeySym *keysyms, int minKey, int mapWidth, int col) { int index = ((keycode - minKey) * mapWidth) + col; return keysyms[index]; } KeyCode Poller::keymapKeysymToKeycode(KeySym keysym, KeySym *keysyms, int minKey, int maxKey, int mapWidth, int *col) { for (int i = 0; i < (maxKey - minKey + 1) * mapWidth; i++) { if (keysyms[i] == keysym) { *col = i % mapWidth; return i / mapWidth + minKey; } } return 0; } KeyCode Poller::translateKeysymToKeycode(KeySym keysym, int *col) { KeyCode keycode; keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, col); if (keycode == 0) { if (((keysym >> 8) == 0) && (keysym >= XK_a) && (keysym <= XK_z)) { /* * The master session has a Solaris keyboard. */ keysym -= XK_a - XK_A; keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, col); } else if (keysym == XK_Shift_R) { keysym = XK_Shift_L; keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, col); } else if (keysym == XK_Shift_L) { keysym = XK_Shift_R; keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, col); } else if (keysym == XK_ISO_Level3_Shift) { keysym = XK_Mode_switch; if ((keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, col)) == 0) { keysym = XK_Alt_R; keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, col); } } else if (keysym == XK_Alt_R) { keysym = XK_ISO_Level3_Shift; if ((keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, col)) == 0) { keysym = XK_Mode_switch; keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, col); } } } return keycode; } Bool Poller::checkModifierKeys(KeySym keysym, Bool isKeyPress) { switch (keysym) { case XK_Shift_L: leftShiftOn = isKeyPress; return True; case XK_Shift_R: rightShiftOn = isKeyPress; return True; case XK_Mode_switch: modeSwitchOn = isKeyPress; return True; case XK_ISO_Level3_Shift: level3ShiftOn = isKeyPress; return True; case XK_Alt_R: altROn = isKeyPress; return True; default: return False; } } void Poller::sendFakeModifierEvents(int pos, Bool skip) { KeySym fakeKeysym; int col; if ((!leftShiftOn && !rightShiftOn) && (!modeSwitchOn && !level3ShiftOn && !altROn)) { if (pos == 1 || pos == 3) { fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); sentFakeLShiftPress = 1; } if (pos == 2 || pos == 3) { fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); if (fakeKeysym == 0) { fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); sentFakeModeSwitchPress = 1; } else { sentFakeLevel3ShiftPress = 1; } XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); } } else if ((leftShiftOn || rightShiftOn) && (!modeSwitchOn && !level3ShiftOn && !altROn)) { if ((pos == 0 && !skip) || pos == 2) { if (leftShiftOn) { fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); sentFakeLShiftRelease = 1; } if (rightShiftOn) { fakeKeysym = keymapKeysymToKeycode(XK_Shift_R, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); sentFakeRShiftRelease = 1; } } if (pos == 2 || pos ==3) { fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); if (fakeKeysym == 0) { fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); sentFakeModeSwitchPress = 1; } else { sentFakeLevel3ShiftPress = 1; } XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); } } else if ((!leftShiftOn && !rightShiftOn) && (modeSwitchOn || level3ShiftOn || altROn)) { if (pos == 1 || pos == 3) { fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); sentFakeLShiftPress = 1; } if (pos == 0 || pos == 1) { if (modeSwitchOn) { fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); sentFakeModeSwitchRelease = 1; } if (level3ShiftOn) { fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); sentFakeLevel3ShiftRelease = 1; } if (altROn) { fakeKeysym = keymapKeysymToKeycode(XK_Alt_R, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); sentFakeAltRRelease = 1; } } } else if ((leftShiftOn || rightShiftOn) && (modeSwitchOn || level3ShiftOn || altROn)) { if (pos == 0 || pos == 2) { if (leftShiftOn) { fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); sentFakeLShiftRelease = 1; } if (rightShiftOn) { fakeKeysym = keymapKeysymToKeycode(XK_Shift_R, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); sentFakeRShiftRelease = 1; } } if (pos == 0 || pos == 1) { if (modeSwitchOn) { fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); sentFakeModeSwitchRelease = 1; } if (level3ShiftOn) { fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); sentFakeLevel3ShiftRelease = 1; } if (altROn) { fakeKeysym = keymapKeysymToKeycode(XK_Alt_R, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); sentFakeAltRRelease = 1; } } } } void Poller::cancelFakeModifierEvents() { KeySym fakeKeysym; int col; if (sentFakeLShiftPress) { logTest("Poller::handleKeyboardEvent", "Fake Shift_L key press event has been sent"); logTest("Poller::handleKeyboardEvent", "Sending fake Shift_L key release event"); fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); sentFakeLShiftPress = 0; } if (sentFakeLShiftRelease) { logTest("Poller::handleKeyboardEvent", "Fake Shift_L key release event has been sent"); logTest("Poller::handleKeyboardEvent", "Sending fake Shift_L key press event"); fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); sentFakeLShiftRelease = 0; } if (sentFakeRShiftRelease) { logTest("Poller::handleKeyboardEvent", "Fake Shift_R key release event has been sent"); logTest("Poller::handleKeyboardEvent", "Sending fake Shift_R key press event"); fakeKeysym = keymapKeysymToKeycode(XK_Shift_R, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); sentFakeRShiftRelease = 0; } if (sentFakeModeSwitchPress) { logTest("Poller::handleKeyboardEvent", "Fake Mode_switch key press event has been sent"); logTest("Poller::handleKeyboardEvent", "Sending fake Mode_switch key release event"); fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); sentFakeModeSwitchPress = 0; } if (sentFakeModeSwitchRelease) { logTest("Poller::handleKeyboardEvent", "Fake Mode_switch key release event has been sent"); logTest("Poller::handleKeyboardEvent", "Sending Mode_switch key press event"); fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); sentFakeModeSwitchRelease = 0; } if (sentFakeLevel3ShiftPress) { logTest("Poller::handleKeyboardEvent", "Fake ISO_Level3_Shift key press event has been sent"); logTest("Poller::handleKeyboardEvent", "Sending fake ISO_Level3_Shift key release event"); fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); sentFakeLevel3ShiftPress = 0; } if (sentFakeLevel3ShiftRelease) { logTest("Poller::handleKeyboardEvent", "Fake ISO_Level3_Shift key release event has been sent"); logTest("Poller::handleKeyboardEvent", "Sending fake ISO_Level3_Shift key press event"); fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); sentFakeLevel3ShiftRelease = 0; } if (sentFakeAltRRelease) { logTest("Poller::handleKeyboardEvent", "Fake XK_Alt_R key release event has been sent"); logTest("Poller::handleKeyboardEvent", "Sending fake XK_Alt_R key press event"); fakeKeysym = keymapKeysymToKeycode(XK_Alt_R, masterKeysyms, masterMinKey, masterMaxKey, masterMapWidth, &col); XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); sentFakeAltRRelease = 0; } } Bool Poller::keyIsDown(KeyCode keycode) { KeyPressedRec *downKey; downKey = shadowKeyPressedPtr; while (downKey) { if (downKey -> keyRcvd == keycode) { return True; } downKey = downKey -> next; } return False; } void Poller::addKeyPressed(KeyCode received, KeyCode sent) { KeyPressedRec *downKey; if (!keyIsDown(received)) { if (shadowKeyPressedPtr == NULL) { shadowKeyPressedPtr = (KeyPressedRec *) malloc(sizeof(KeyPressedRec)); shadowKeyPressedPtr -> keyRcvd = received; shadowKeyPressedPtr -> keySent = sent; shadowKeyPressedPtr -> next = NULL; } else { downKey = shadowKeyPressedPtr; while (downKey -> next != NULL) { downKey = downKey -> next; } downKey -> next = (KeyPressedRec *) malloc(sizeof(KeyPressedRec)); downKey -> next -> keyRcvd = received; downKey -> next -> keySent = sent; downKey -> next -> next = NULL; } } } KeyCode Poller::getKeyPressed(KeyCode received) { KeyCode sent; KeyPressedRec *downKey; KeyPressedRec *tempKey; if (shadowKeyPressedPtr != NULL) { if (shadowKeyPressedPtr -> keyRcvd == received) { sent = shadowKeyPressedPtr -> keySent; tempKey = shadowKeyPressedPtr; shadowKeyPressedPtr = shadowKeyPressedPtr -> next; free(tempKey); return sent; } else { downKey = shadowKeyPressedPtr; while (downKey -> next != NULL) { if (downKey -> next -> keyRcvd == received) { sent = downKey -> next -> keySent; tempKey = downKey -> next; downKey -> next = downKey -> next -> next; free(tempKey); return sent; } else { downKey = downKey -> next; } } } } return 0; } void Poller::handleKeyboardEvent(Display *display, XEvent *event) { if (xtestExtension_ == 0 || display_ == 0) { return; } logTest("Poller::handleKeyboardEvent", "Handling event at [%p]", event); #ifdef TRANSLATE_ALWAYS KeyCode keycode; KeySym keysym; int col = 0; Bool isKeyPress = False; Bool isModifier = False; Bool isShiftComb = False; Bool skip = False; if (event -> type == KeyPress) { isKeyPress = True; } if (shadowKeysyms == NULL) { keymapShadowInit(event -> xkey.display); } if (masterKeysyms == NULL) { keymapMasterInit(); } if (shadowKeysyms == NULL || masterKeysyms == NULL) { logTest("Poller::handleKeyboardEvent", "Unable to initialize keymaps. Do not translate"); keycode = event -> xkey.keycode; goto SendKeycode; } keysym = keymapKeycodeToKeysym(event -> xkey.keycode, shadowKeysyms, shadowMinKey, shadowMapWidth, 0); isModifier = checkModifierKeys(keysym, isKeyPress); if (event -> type == KeyRelease) { KeyCode keycodeToSend; keycodeToSend = getKeyPressed(event -> xkey.keycode); if (keycodeToSend) { keycode = keycodeToSend; goto SendKeycode; } } /* * Convert case for Solaris keyboard. */ if (((keysym >> 8) == 0) && (keysym >= XK_A) && (keysym <= XK_Z)) { if (!leftShiftOn && !rightShiftOn) { keysym += XK_a - XK_A; } else { skip = True; } } if (!isModifier) { if ((leftShiftOn || rightShiftOn) && (!modeSwitchOn && !level3ShiftOn && !altROn) && !skip) { KeySym tempKeysym = keymapKeycodeToKeysym(event -> xkey.keycode, shadowKeysyms, shadowMinKey, shadowMapWidth, 1); if (tempKeysym == 0) { isShiftComb = True; } else { keysym = tempKeysym; } } else if ((!leftShiftOn && !rightShiftOn) && (modeSwitchOn || level3ShiftOn || altROn)) { keysym = keymapKeycodeToKeysym(event -> xkey.keycode, shadowKeysyms, shadowMinKey, shadowMapWidth, 2); } else if ((leftShiftOn || rightShiftOn) && (modeSwitchOn || level3ShiftOn || altROn)) { keysym = keymapKeycodeToKeysym(event -> xkey.keycode, shadowKeysyms, shadowMinKey, shadowMapWidth, 3); } } if (keysym == 0) { logTest("Poller::handleKeyboardEvent", "Null keysym. Return"); return; } logTest("Poller::handleKeyboardEvent", "keysym [%x] [%s]", (unsigned int)keysym, XKeysymToString(keysym)); if (keysym == XK_Mode_switch) { keysym = XK_ISO_Level3_Shift; } keycode = translateKeysymToKeycode(keysym, &col); if (keycode == 0) { logTest("Poller::handleKeyboardEvent", "No keycode found for keysym [%x] [%s]. Return", (unsigned int)keysym, XKeysymToString(keysym)); return; } logTest("Poller::handleKeyboardEvent", "keycode [%d] translated into keycode [%d]", (int)event -> xkey.keycode, (unsigned int)keycode); if (event -> type == KeyPress) { addKeyPressed(event -> xkey.keycode, keycode); } /* * Send fake modifier events. */ if (!isModifier && isShiftComb == False) { sendFakeModifierEvents(col, ((keysym >> 8) == 0) && (keysym >= XK_A) && (keysym <= XK_Z)); } SendKeycode: /* * Send the event. */ XTestFakeKeyEvent(display_, keycode, isKeyPress, 0); /* * Check if fake modifier events have been sent. */ cancelFakeModifierEvents(); #else // TRANSLATE_ALWAYS // // Use keysyms to translate keycodes across different // keyboard models. Useless when both keyboards have // same keycodes (e.g. both are pc keyboards). // #ifdef TRANSLATE_KEYCODES KeyCode keycode = XKeysymToKeycode(display_, XK_A); if (XKeysymToKeycode(event -> xkey.display, XK_A) != keycode) { KeySym keysym = XKeycodeToKeysym(event -> xkey.display, event -> xkey.keycode, 0); if (keysym == XK_Mode_switch || keysym == XK_ISO_Level3_Shift) { logUser("Poller::handleKeyboardEvent: keysym [%x].\n", (unsigned int)keysym); if (XKeycodeToKeysym(display_, 113, 0) == XK_ISO_Level3_Shift || (XKeycodeToKeysym(display_, 124, 0) == XK_ISO_Level3_Shift)) { event -> xkey.keycode = 113; } else { event -> xkey.keycode = XKeysymToKeycode(display_, XK_Mode_switch); } logUser("Poller::handleKeyboardEvent: keycode translated to [%x].\n", (unsigned int)event -> xkey.keycode); } else { event -> xkey.keycode = XKeysymToKeycode(display_, keysym); } } #endif // TRANSLATE_KEYCODES if (event -> type == KeyPress) { XTestFakeKeyEvent(display_, event -> xkey.keycode, 1, 0); } else if (event -> type == KeyRelease) { XTestFakeKeyEvent(display_, event -> xkey.keycode, 0, 0); } #endif // TRANSLATE_ALWAYS } void Poller::handleWebKeyboardEvent(KeySym keysym, Bool isKeyPress) { KeyCode keycode; int col; if (masterKeysyms == NULL) { keymapMasterInit(); } if (masterKeysyms == NULL) { logTest("Poller::handleWebKeyboardEvent", "Unable to initialize keymap"); return; } keycode = translateKeysymToKeycode(keysym, &col); if (keycode == 0) { logTest("Poller::handleKeyboardEvent", "No keycode found for keysym [%x] [%s]. Return", (unsigned int)keysym, XKeysymToString(keysym)); return; } logTest("Poller::handleKeyboardEvent", "keysym [%x] [%s] translated into keycode [%x]", (unsigned int)keysym, XKeysymToString(keysym), (unsigned int)keycode); /* * Send fake modifier events. */ if (!checkModifierKeys(keysym, isKeyPress)) { sendFakeModifierEvents(col, False); } /* * Send the event. */ XTestFakeKeyEvent(display_, keycode, isKeyPress, 0); /* * Check if fake modifier events have been sent. */ cancelFakeModifierEvents(); } void Poller::handleMouseEvent(Display *display, XEvent *event) { if (xtestExtension_ == 0 || display_ == 0) { return; } if (event -> type == MotionNotify) { XTestFakeMotionEvent(display_, 0, event -> xmotion.x, event -> xmotion.y, 0); } else if (event -> type == ButtonPress) { XTestFakeButtonEvent(display_, event -> xbutton.button, True, 0); } else if (event -> type == ButtonRelease) { XTestFakeButtonEvent(display_, event -> xbutton.button, False, 0); } XFlush(display_); } void Poller::setRootSize(void) { width_ = WidthOfScreen(DefaultScreenOfDisplay(display_)); height_ = HeightOfScreen(DefaultScreenOfDisplay(display_)); depth_ = DefaultDepth(display_, DefaultScreen(display_)); if (depth_ == 8) bpp_ = 1; else if (depth_ == 16) bpp_ = 2; else bpp_ = 4; bpl_ = width_ * bpp_; } void Poller::destroyShmImage(void) { XShmDetach(display_, shminfo_); XDestroyImage(image_); image_ = NULL; shmdt(shminfo_ -> shmaddr); shmctl(shminfo_ -> shmid, IPC_RMID, 0); delete shminfo_; shminfo_ = NULL; } void Poller::xtestInit(void) { int eventBase; int errorBase; int versionMajor; int versionMinor; int result; xtestExtension_ = 0; result = XTestQueryExtension(display_, &eventBase, &errorBase, &versionMajor, &versionMinor); if (result == 0) { xtestExtension_ = 0; logWarning("Poller::xtestInit", "Failed while querying for XTEST extension."); } else { logDebug("Poller::xtestInit", "XTEST version %d.%d.", versionMajor, versionMinor); xtestExtension_ = 1; } // // Make this client impervious to grabs. // if (xtestExtension_ == 1) { XTestGrabControl(display_, 1); } } void Poller::randrInit(void) { int randrEventBase; int randrErrorBase; if (XRRQueryExtension(display_, &randrEventBase, &randrErrorBase) == 0) { logWarning("Poller::randrInit", "Randr extension not supported on this " "display."); randrExtension_ = 0; return; } XRRSelectInput(display_, DefaultRootWindow(display_), RRScreenChangeNotifyMask); randrEventBase_ = randrEventBase; randrExtension_ = 1; return; } void Poller::damageInit(void) { int damageMajorVersion = 0; int damageMinorVersion = 0; int damageEventBase = 0; int damageErrorBase = 0; if (damageExtension_ >= 0) { logDebug("Poller::damageInit", "Called with damage already initialized."); } if (damageExtension_ == 0) { logDebug("Poller::damageInit", "Damage disabled. Skip initialization."); return; } if (damageExtension_ < 0 && NXShadowOptions.optionDamageExtension == 0) { damageExtension_ = 0; logUser("Poller::damageInit: Disabling use of DAMAGE extension.\n"); return; } damageExtension_ = 0; mirrorChanges_ = 0; if (XDamageQueryExtension(display_, &damageEventBase, &damageErrorBase) == 0) { logUser("Poller::damageInit: DAMAGE not supported.\n"); return; } #ifdef DEBUG else { fprintf(stderr, "Poller::damageInit: DAMAGE supported. " "Event base [%d] error base [%d].\n", damageEventBase, damageErrorBase); } #endif damageEventBase_ = damageEventBase; if (XDamageQueryVersion(display_, &damageMajorVersion, &damageMinorVersion) == 0) { logWarning("Poller::damageInit", "Error on querying DAMAGE version.\n"); damageExtension_ = 0; return; } #ifdef DEBUG else { fprintf(stderr, "Poller::damageInit: DAMAGE version %d.%d.\n", damageMajorVersion, damageMinorVersion); } #endif damage_ = XDamageCreate(display_, DefaultRootWindow(display_), XDamageReportRawRectangles); damageExtension_= 1; mirror_ = 1; return; } void Poller::getEvents(void) { XEvent X; if (damageExtension_ == 1) { XDamageSubtract(display_, damage_, None, None); } XSync(display_, 0); while (XCheckIfEvent(display_, &X, anyEventPredicate, NULL) == 1) { if (randrExtension_ == 1 && (X.type == randrEventBase_ + RRScreenChangeNotify || X.type == ConfigureNotify)) { XRRUpdateConfiguration(&X); handleRRScreenChangeNotify(&X); continue; } if (damageExtension_ == 1 && X.type == damageEventBase_ + XDamageNotify) { handleDamageNotify(&X); } } if (damageExtension_ == 1) { updateDamagedAreas(); } XFlush(display_); } void Poller::handleRRScreenChangeNotify(XEvent *X) { return; } void Poller::handleDamageNotify(XEvent *X) { XDamageNotifyEvent *e = (XDamageNotifyEvent *) X; // // e->drawable is the window ID of the damaged window // e->geometry is the geometry of the damaged window // e->area is the bounding rect for the damaged area // e->damage is the damage handle returned by XDamageCreate() // #ifdef DEBUG fprintf(stderr, "handleDamageNotify: drawable [%d] damage [%d] geometry [%d][%d][%d][%d] area [%d][%d][%d][%d].\n", (int) e -> drawable, (int) e -> damage, e -> geometry.x, e -> geometry.y, e -> geometry.width, e -> geometry.height, e -> area.x, e -> area.y, e -> area.width, e -> area.height); #endif XRectangle rectangle = {e -> area.x, e -> area.y, e -> area.width, e -> area.height}; XUnionRectWithRegion(&rectangle, lastUpdatedRegion_, lastUpdatedRegion_); mirrorChanges_ = 1; return; } void Poller::updateDamagedAreas(void) { BOX *boxPtr; XRectangle rectangle; int i; int y; for (i = 0; i < lastUpdatedRegion_ -> numRects; i++) { boxPtr = lastUpdatedRegion_ -> rects + i; if (shmExtension_ == 1) { image_ -> width = boxPtr -> x2 - boxPtr -> x1; image_ -> height = boxPtr -> y2 - boxPtr -> y1; image_ -> bytes_per_line = ROUNDUP((image_ -> bits_per_pixel * image_ -> width), image_ -> bitmap_pad); if (XShmGetImage(display_, DefaultRootWindow(display_), image_, boxPtr -> x1, boxPtr -> y1, AllPlanes) == 0) { logDebug("Poller::updateDamagedAreas", "XShmGetImage failed!"); return; } } else if (shmExtension_ == 0) { image_ = XGetImage(display_, DefaultRootWindow(display_), boxPtr -> x1, boxPtr -> y1, boxPtr -> x2 - boxPtr -> x1, boxPtr -> y2 - boxPtr -> y1, AllPlanes, ZPixmap); if (image_ == NULL) { logDebug("Poller::updateDamagedAreas", "XGetImage failed!"); return; } image_ -> width = boxPtr -> x2 - boxPtr -> x1; image_ -> height = boxPtr -> y2 - boxPtr -> y1; image_ -> bytes_per_line = ROUNDUP((image_ -> bits_per_pixel * image_ -> width), image_ -> bitmap_pad); } rectangle.height = 1; rectangle.width = image_ -> width; rectangle.x = boxPtr -> x1; rectangle.y = boxPtr -> y1; for (y = 0; y < image_ -> height; y++) { update(image_ -> data + y * image_ -> bytes_per_line, rectangle); rectangle.y++; } if (shmExtension_ != 1) { XDestroyImage(image_); image_ = NULL; } } return; } void Poller::getScreenSize(int *w, int *h) { *w = WidthOfScreen(DefaultScreenOfDisplay(display_)); *h = HeightOfScreen(DefaultScreenOfDisplay(display_)); } void Poller::setScreenSize(int *w, int *h) { setRootSize(); shmInitTrap = 1; shmInit(); shmInitTrap = 0; *w = width_; *h = height_; logDebug("Poller::setScreenSize", "New size of screen [%d, %d]", width_, height_); } int anyEventPredicate(Display *display, XEvent *event, XPointer parameter) { return 1; } nx-libs-3.5.99.23/nxcompshad/src/X11.h0000644000000000000000000000752513614532331013775 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef X11Poller_H #define X11Poller_H #include #include #include "X11/include/Xdamage_nxcompshad.h" #include "X11/include/Xrandr_nxcompshad.h" #include "Core.h" class Poller : public CorePoller { public: Poller(Input *, Display *display, int = 0); ~Poller(); int init(); void setRootSize(); void destroyShmImage(); void getEvents(void); void getScreenSize(int *width, int *height); void setScreenSize(int *width, int *height); private: Display *display_; char *shadowDisplayName_; int shadowDisplayUid_; char *tmpBuffer_; char xtestExtension_; char shmExtension_; char randrExtension_; int randrEventBase_; char damageExtension_; int damageEventBase_; Damage damage_; XShmSegmentInfo *shminfo_; XImage *image_; int updateShadowFrameBuffer(void); char *getRect(XRectangle); void keymapShadowInit(Display *display); void keymapMasterInit(); KeySym keymapKeycodeToKeysym(KeyCode keycode, KeySym *keysyms, int minKey, int per, int col); KeyCode keymapKeysymToKeycode(KeySym keysym, KeySym *keysyms, int minKey, int maxKey, int per, int *col); KeyCode translateKeysymToKeycode(KeySym keysym, int *col); Bool checkModifierKeys(KeySym keysym, Bool isKeyPress); void sendFakeModifierEvents(int pos, Bool skip); void cancelFakeModifierEvents(); Bool keyIsDown(KeyCode keycode); void addKeyPressed(KeyCode received, KeyCode sent); KeyCode getKeyPressed(KeyCode received); void handleKeyboardEvent(Display *display, XEvent *); void handleWebKeyboardEvent(KeySym keysym, Bool isKeyPress); void handleMouseEvent(Display *, XEvent *); void xtestInit(void); void shmInit(void); void randrInit(void); void damageInit(void); void handleRRScreenChangeNotify(XEvent *); void handleDamageNotify(XEvent *); void updateDamagedAreas(void); }; int anyEventPredicate(Display *display, XEvent *event, XPointer parameter); #endif /* X11Poller_H */ nx-libs-3.5.99.23/nxcompshad/src/X11/include/Xdamage_nxcompshad.h0000644000000000000000000000601613614532331021204 0ustar /* * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* * This file is a reduced version of the header file of * * * This copy of code has been introduced to allow a clear namespace * separation between and header files. * * This version of the Xdamage library header file only contains symbols * required by nxcompshad and strictly avoids indirectly including * from an X11 library that is also shipped in nx-X11/lib/. * * When using instead for inclusion in * nxcompshad, it will attempt pulling in the * header which in turn will include . However, the headers of * the same name from should be used instead. * * FIXME: Once the nxagent Xserver starts using libX11 from X.Org, this * hack can be removed. * * 2015/06/26, Mike Gabriel */ #ifndef _XDAMAGE_H_ #define _XDAMAGE_H_ #include #include /* from */ typedef XID XserverRegion; #define XDAMAGE_1_1_INTERFACE typedef XID Damage; typedef struct { int type; /* event base */ unsigned long serial; Bool send_event; Display *display; Drawable drawable; Damage damage; int level; Bool more; /* more events will be delivered immediately */ Time timestamp; XRectangle area; XRectangle geometry; } XDamageNotifyEvent; _XFUNCPROTOBEGIN Bool XDamageQueryExtension (Display *dpy, int *event_base_return, int *error_base_return); Status XDamageQueryVersion (Display *dpy, int *major_version_return, int *minor_version_return); Damage XDamageCreate (Display *dpy, Drawable drawable, int level); void XDamageSubtract (Display *dpy, Damage damage, XserverRegion repair, XserverRegion parts); _XFUNCPROTOEND #endif /* _XDAMAGE_H_ */ nx-libs-3.5.99.23/nxcompshad/src/X11/include/Xrandr_nxcompshad.h0000644000000000000000000000571213614532331021076 0ustar /* * Copyright © 2000 Compaq Computer Corporation, Inc. * Copyright © 2002 Hewlett-Packard Company, Inc. * Copyright © 2006 Intel Corporation * Copyright © 2008 Red Hat, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc. * Keith Packard, Intel Corporation */ /* * This file is a reduced version of the header file of * * * This copy of code has been introduced to allow a clear namespace * separation between and header files. * * This version of the Xrandr library header file only contains symbols * required by nxcompshad and strictly avoids indirectly including * from an X11 library that is also shipped in nx-X11/lib/. * * When using instead for inclusion in * nxcompshad, it will attempt pulling in the * header which in turn will include . However, the headers of * the same name from should be used instead. * * FIXME: Once the nxagent Xserver starts using libXrender from X.Org, this * hack can be removed. * * 2015/06/26, Mike Gabriel */ #ifndef _XRANDR_H_ #define _XRANDR_H_ /* from */ #define RRScreenChangeNotify 0 #define RRScreenChangeNotifyMask (1L << 0) #include _XFUNCPROTOBEGIN /* internal representation is private to the library */ typedef struct _XRRScreenConfiguration XRRScreenConfiguration; Bool XRRQueryExtension (Display *dpy, int *event_base_return, int *error_base_return); void XRRSelectInput(Display *dpy, Window window, int mask); /* * intended to take RRScreenChangeNotify, or * ConfigureNotify (on the root window) * returns 1 if it is an event type it understands, 0 if not */ int XRRUpdateConfiguration(XEvent *event); _XFUNCPROTOEND #endif /* _XRANDR_H_ */ nx-libs-3.5.99.23/nxcompshad/src/X11/include/XTest_nxcompshad.h0000644000000000000000000000363613614532331020712 0ustar /* Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _XTEST_H_ #define _XTEST_H_ #include _XFUNCPROTOBEGIN Bool XTestQueryExtension( Display* /* dpy */, int* /* event_basep */, int* /* error_basep */, int* /* majorp */, int* /* minorp */ ); extern int XTestFakeKeyEvent( Display* /* dpy */, unsigned int /* keycode */, Bool /* is_press */, unsigned long /* delay */ ); extern int XTestFakeButtonEvent( Display* /* dpy */, unsigned int /* button */, Bool /* is_press */, unsigned long /* delay */ ); extern int XTestFakeMotionEvent( Display* /* dpy */, int /* screen */, int /* x */, int /* y */, unsigned long /* delay */ ); extern int XTestGrabControl( Display* /* dpy */, Bool /* impervious */ ); _XFUNCPROTOEND #endif nx-libs-3.5.99.23/nxcompshad/VERSION0000644000000000000000000000001213614532424013517 0ustar 3.5.99.23 nx-libs-3.5.99.23/nxcomp/src/ActionCache.cpp0000644000000000000000000000417213614532331015253 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Control.h" #include "ActionCache.h" ActionCache::ActionCache() { for (int i = 0; i < 256; i++) { base_[i] = new IntCache(8); } slot_ = 0; last_ = 0; } ActionCache::~ActionCache() { for (int i = 0; i < 256; i++) { delete base_[i]; } } nx-libs-3.5.99.23/nxcomp/src/ActionCache.h0000644000000000000000000000415713614532331014723 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ActionCache_H #define ActionCache_H #include "IntCache.h" class ActionCache { friend class EncodeBuffer; friend class DecodeBuffer; public: ActionCache(); ~ActionCache(); private: IntCache *base_[256]; unsigned int slot_; unsigned short last_; }; #endif /* ActionCache_H */ nx-libs-3.5.99.23/nxcomp/src/Agent.cpp0000644000000000000000000000546213614532331014153 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Misc.h" #include "Agent.h" #include "Proxy.h" extern Proxy *proxy; // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG Agent::Agent(int fd[2]) { remoteFd_ = fd[0]; localFd_ = fd[1]; transport_ = new AgentTransport(localFd_); if (transport_ == NULL) { #ifdef PANIC *logofs << "Agent: PANIC! Can't create the memory-to-memory transport " << "for FD#" << localFd_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": Can't create the memory-to-memory transport " << "for FD#" << localFd_ << ".\n"; HandleCleanup(); } FD_ZERO(&saveRead_); FD_ZERO(&saveWrite_); canRead_ = 0; #ifdef DEBUG *logofs << "Agent: Created agent object at " << this << ".\n" << logofs_flush; #endif } Agent::~Agent() { delete transport_; #ifdef DEBUG *logofs << "Agent: Deleted agent object at " << this << ".\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/Agent.h0000644000000000000000000001554213614532331013620 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Agent_H #define Agent_H #include #include #include #include #include "Misc.h" #include "Transport.h" #include "Proxy.h" extern Proxy *proxy; #define PANIC #define WARNING #undef TEST #undef DEBUG class Agent { public: // // Must be created by passing the fake descriptor that // will be used for simulating socket communication // between the agent and the proxy. I/O will take place // by copying data to the agent's read and write buf- // fers. // Agent(int fd[2]); ~Agent(); AgentTransport *getTransport() const { return transport_; } void saveReadMask(fd_set *readSet) { saveRead_ = *readSet; } void saveWriteMask(fd_set *writeSet) { saveWrite_ = *writeSet; } void clearReadMask(fd_set *readSet) { FD_CLR(remoteFd_, readSet); FD_CLR(localFd_, readSet); } void clearWriteMask(fd_set *writeSet) { FD_CLR(remoteFd_, writeSet); FD_CLR(localFd_, writeSet); } void setLocalRead(fd_set *readSet, int *result) { (*result)++; FD_SET(localFd_, readSet); } void setRemoteRead(fd_set *readSet, int *result) { (*result)++; FD_SET(remoteFd_, readSet); } void setRemoteWrite(fd_set *writeSet, int *result) { (*result)++; FD_SET(remoteFd_, writeSet); } fd_set *getSavedReadMask() { return &saveRead_; } fd_set *getSavedWriteMask() { return &saveWrite_; } int getRemoteFd() const { return remoteFd_; } int getLocalFd() const { return localFd_; } int getProxyFd() const { return proxy -> getFd(); } int isValid() const { return (transport_ != NULL); } int localReadable() { return (transport_ -> readable() != 0); } // // Check if we can process more data from // the agent descriptor and cache the result // to avoid multiple calls. This must be // always called before querying the other // functions. // void saveChannelState() { canRead_ = (proxy != NULL ? proxy -> canRead(localFd_) : 0); } int remoteCanRead(const fd_set * const readSet) { // OS X 10.5 requires the second argument to be non-const, so copy readSet. // It's safe though, as FD_ISSET does not operate on it. fd_set readWorkSet = *readSet; #if defined(TEST) || defined(INFO) *logofs << "Agent: remoteCanRead() is " << (FD_ISSET(remoteFd_, &readWorkSet) && transport_ -> dequeuable() != 0) << " with FD_ISSET() " << (int) FD_ISSET(remoteFd_, &readWorkSet) << " and dequeuable " << transport_ -> dequeuable() << ".\n" << logofs_flush; #endif return (FD_ISSET(remoteFd_, &readWorkSet) && transport_ -> dequeuable() != 0); } int remoteCanWrite(const fd_set * const writeSet) { // OS X 10.5 requires the second argument to be non-const, so copy writeSet. // It's safe though, as FD_ISSET does not operate on it. fd_set writeWorkSet = *writeSet; #if defined(TEST) || defined(INFO) *logofs << "Agent: remoteCanWrite() is " << (FD_ISSET(remoteFd_, &writeWorkSet) && transport_ -> queuable() != 0 && canRead_ == 1) << " with FD_ISSET() " << (int) FD_ISSET(remoteFd_, &writeWorkSet) << " queueable " << transport_ -> queuable() << " channel can read " << canRead_ << ".\n" << logofs_flush; #endif return (FD_ISSET(remoteFd_, &writeWorkSet) && transport_ -> queuable() != 0 && canRead_ == 1); } int localCanRead() { #if defined(TEST) || defined(INFO) *logofs << "Agent: localCanRead() is " << (transport_ -> readable() != 0 && canRead_ == 1) << " with readable " << transport_ -> readable() << " channel can read " << canRead_ << ".\n" << logofs_flush; #endif return (transport_ -> readable() != 0 && canRead_ == 1); } int proxyCanRead() { #if defined(TEST) || defined(INFO) *logofs << "Agent: proxyCanRead() is " << proxy -> canRead() << ".\n" << logofs_flush; #endif return (proxy -> canRead()); } int proxyCanRead(const fd_set * const readSet) { // OS X 10.5 requires the second argument to be non-const, so copy readSet. // It's safe though, as FD_ISSET does not operate on it. fd_set readWorkSet = *readSet; #if defined(TEST) || defined(INFO) *logofs << "Agent: proxyCanRead() is " << ((int) FD_ISSET(proxy -> getFd(), &readWorkSet)) << ".\n" << logofs_flush; #endif return (FD_ISSET(proxy -> getFd(), &readWorkSet)); } int enqueueData(const char *data, const int size) const { return transport_ -> enqueue(data, size); } int dequeueData(char *data, int size) const { return transport_ -> dequeue(data, size); } int dequeuableData() const { return transport_ -> dequeuable(); } private: int remoteFd_; int localFd_; fd_set saveRead_; fd_set saveWrite_; int canRead_; AgentTransport *transport_; }; #endif /* Agent_H */ nx-libs-3.5.99.23/nxcomp/src/Alpha.cpp0000644000000000000000000001054613614532331014141 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Misc.h" #include "Unpack.h" #include "Alpha.h" #define PANIC #define WARNING #undef TEST #undef DEBUG int UnpackAlpha(unsigned char method, unsigned char *src_data, int src_size, unsigned char *dst_data, int dst_size) { if (*src_data == 0) { if (dst_size != src_size - 1) { #ifdef TEST *logofs << "UnpackAlpha: PANIC! Invalid destination size " << dst_size << " with source " << src_size << ".\n" << logofs_flush; #endif return -1; } #ifdef TEST *logofs << "UnpackAlpha: Expanding " << src_size - 1 << " bytes of plain alpha data.\n" << logofs_flush; #endif memcpy(dst_data, src_data + 1, src_size - 1); return 1; } unsigned int check_size = dst_size; int result = ZDecompress(&unpackStream, dst_data, &check_size, src_data + 1, src_size - 1); if (result != Z_OK) { #ifdef PANIC *logofs << "UnpackAlpha: PANIC! Failure decompressing alpha data. " << "Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failure decompressing alpha data. " << "Error is '" << zError(result) << "'.\n"; return -1; } else if (check_size != (unsigned int) dst_size) { #ifdef PANIC *logofs << "UnpackAlpha: PANIC! Size mismatch in alpha data. " << "Resulting size is " << check_size << " with " << "expected size " << dst_size << ".\n" << logofs_flush; #endif cerr << "Error" << ": Size mismatch in alpha data. " << "Resulting size is " << check_size << " with " << "expected size " << dst_size << ".\n"; return -1; } #ifdef TEST *logofs << "UnpackAlpha: Decompressed " << src_size - 1 << " bytes to " << dst_size << " bytes of alpha data.\n" << logofs_flush; #endif return 1; } int UnpackAlpha(T_alpha *alpha, unsigned char *dst_data, int dst_size, int big_endian) { unsigned int count = dst_size >> 2; unsigned int i; int shift; if (count != alpha -> entries) { #ifdef WARNING *logofs << "UnpackAlpha: WARNING! Not applying the alpha with " << count << " elements needed and " << alpha -> entries << " available.\n" << logofs_flush; #endif return 0; } shift = (big_endian == 1 ? 0 : 3); for (i = 0; i < count; i++) { *(dst_data + shift) = *(alpha -> data + i); dst_data += 4; } return 1; } nx-libs-3.5.99.23/nxcomp/src/Alpha.h0000644000000000000000000000414613614532331013605 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Alpha_H #define Alpha_H int UnpackAlpha(unsigned char method, unsigned char *src_data, int src_size, unsigned char *dst_data, int dst_size); int UnpackAlpha(T_alpha *alpha, unsigned char *dst_data, int dst_size, int big_endian); #endif /* Aplha_H */ nx-libs-3.5.99.23/nxcomp/src/Auth.cpp0000644000000000000000000004126613614532331014020 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Auth.h" #include "Misc.h" #include "Control.h" #include "Timestamp.h" #include "Pipe.h" #define DEFAULT_STRING_LIMIT 512 // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Store the provided cookie as our 'fake' cookie, then // read the 'real' cookie from the current X authority // file. // Auth::Auth(char *display, char *cookie) { display_ = NULL; file_ = NULL; last_ = nullTimestamp(); fakeCookie_ = NULL; realCookie_ = NULL; fakeData_ = NULL; realData_ = NULL; dataSize_ = 0; generatedCookie_ = 0; if (display == NULL || *display == '\0' || cookie == NULL || *cookie == '\0' || strlen(cookie) != 32) { #ifdef PANIC *logofs << "Auth: PANIC! Can't create the X authorization data " << "with cookie '" << cookie << "' and display '" << display << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Can't create the X authorization data " << "with cookie '" << cookie << "' and display '" << display << "'.\n"; return; } #ifdef TEST *logofs << "Auth: Creating X authorization data with cookie '" << cookie << "' and display '" << display << "'.\n" << logofs_flush; #endif // // Get a local copy of all parameters. // display_ = new char[strlen(display) + 1]; file_ = new char[DEFAULT_STRING_LIMIT]; fakeCookie_ = new char[strlen(cookie) + 1]; realCookie_ = new char[DEFAULT_STRING_LIMIT]; if (display_ == NULL || file_ == NULL || fakeCookie_ == NULL || realCookie_ == NULL) { #ifdef PANIC *logofs << "Auth: PANIC! Cannot allocate memory for the X " << "authorization data.\n" << logofs_flush; #endif cerr << "Error" << ": Cannot allocate memory for the X " << "authorization data.\n"; return; } strcpy(display_, display); *file_ = '\0'; strcpy(fakeCookie_, cookie); *realCookie_ = '\0'; // // Get the real cookie from the authorization file. // updateCookie(); } Auth::~Auth() { delete [] display_; delete [] file_; delete [] fakeCookie_; delete [] realCookie_; delete [] fakeData_; delete [] realData_; } // // At the present moment the cookie is read only once, // at the time the instance is initialized. If the auth // file changes along the life of the session, the old // cookie will be used. This works with X servers beca- // use of an undocumented "feature". See nx-X11. // int Auth::updateCookie() { if (isTimestamp(last_) == 0) { #ifdef TEST *logofs << "Auth: Reading the X authorization file " << "with last update at " << strMsTimestamp(last_) << ".\n" << logofs_flush; #endif if (getCookie() == 1 && validateCookie() == 1) { // // It should rather be the modification time // the auth file, so we can read it again if // the file is changed. // #ifdef TEST *logofs << "Auth: Setting last X authorization file " << "update at " << strMsTimestamp() << ".\n" << logofs_flush; #endif last_ = getTimestamp(); return 1; } #ifdef PANIC *logofs << "Auth: PANIC! Cannot read the cookie from the X " << "authorization file.\n" << logofs_flush; #endif cerr << "Error" << ": Cannot read the cookie from the X " << "authorization file.\n"; return -1; } #ifdef TEST *logofs << "Auth: WARNING! Skipping check on the X " << "authorization file.\n" << logofs_flush; #endif return 0; } int Auth::getCookie() { // // Check the name of the auth file that we are going to use. // It can be either the value of the XAUTHORITY environment // or the default .Xauthority file in the user's home. // char *environment; environment = getenv("XAUTHORITY"); if (environment != NULL && *environment != '\0') { snprintf(file_, DEFAULT_STRING_LIMIT, "%s", environment); } else { snprintf(file_, DEFAULT_STRING_LIMIT, "%s/.Xauthority", control -> HomePath); } #ifdef TEST *logofs << "Auth: Using X authorization file '" << file_ << "'.\n" << logofs_flush; #endif // // Use the nxauth command on Windows and the Mac, xauth // on all the other platforms. On Windows we assume that // the nxauth command is located under bin in the client // installation directory. On Mac OS X we assume that the // command is located directly in the client installation // directory, to make bundle shipping easier. On all the // other platforms we use the default xauth command that // is in our path. // char command[DEFAULT_STRING_LIMIT]; #if defined(__CYGWIN32__) snprintf(command, DEFAULT_STRING_LIMIT, "%s/bin/nxauth", control -> SystemPath); #elif defined(__APPLE__) snprintf(command, DEFAULT_STRING_LIMIT, "%s/nxauth", control -> SystemPath); #else strcpy(command, "xauth"); #endif #ifdef TEST *logofs << "Auth: Using X auth command '" << command << "'.\n" << logofs_flush; #endif // // The SSH code forces using the unix:n port when passing localhost:n. // This is probably because localhost:n can fail to return a valid // entry on machines where the hostname for localhost doesn't match // exactly the 'localhost' string. For example, on a freshly installed // Fedora Core 3 I get a 'localhost.localdomain/unix:0' entry. Query- // ing 'xauth list localhost:0' results in an empty result, while the // query 'xauth list unix:0' works as expected. Note anyway that if // the cookie for the TCP connection on 'localhost' is set to a dif- // ferent cookie than the one for the Unix connections, both SSH and // NX will match the wrong cookie and session will fail. // char line[DEFAULT_STRING_LIMIT]; FILE *data = NULL; int result = -1; if (strncmp(display_, "localhost:", 10) == 0) { snprintf(line, DEFAULT_STRING_LIMIT, "unix:%s", display_ + 10); } else if ((0 == strncasecmp(display_, "/tmp/launch", 11)) || (0 == strncasecmp(display_, "/private/tmp/com.apple.launchd", 30))) { /* * Launchd socket support, mostly for OS X, but maybe also other BSD derivates. */ const char *separator = strrchr(display_, ':'); if ((NULL == separator) || (!isdigit(*(separator + 1)))) { #ifdef PANIC *logofs << "Auth: PANIC! Unable to find separating colon character '" << "in launchd socket path '" << display_ << "'.\n" << logofs_flush; #endif goto AuthGetCookieResult; } snprintf(line, DEFAULT_STRING_LIMIT, "unix:%s", separator + 1); } else { snprintf(line, DEFAULT_STRING_LIMIT, "%.200s", display_); } const char *parameters[256]; parameters[0] = command; parameters[1] = command; parameters[2] = "-f"; parameters[3] = file_; parameters[4] = "list"; parameters[5] = line; parameters[6] = NULL; #ifdef TEST *logofs << "Auth: Executing command "; for (int i = 0; i < 256 && parameters[i] != NULL; i++) { *logofs << "[" << parameters[i] << "]"; } *logofs << ".\n" << logofs_flush; #endif // // Use the popen() function to read the result // of the command. We would better use our own // implementation. // data = Popen((char *const *) parameters, "r"); if (data == NULL) { #ifdef PANIC *logofs << "Auth: PANIC! Failed to execute the X auth command.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to execute the X auth command.\n"; goto AuthGetCookieResult; } if (fgets(line, DEFAULT_STRING_LIMIT, data) == NULL) { #ifdef WARNING *logofs << "Auth: WARNING! Failed to read data from the X " << "auth command.\n" << logofs_flush; #endif #ifdef TEST cerr << "Warning" << ": Failed to read data from the X " << "auth command.\n"; #endif #ifdef PANIC *logofs << "Auth: WARNING! Generating a fake cookie for " << "X authentication.\n" << logofs_flush; #endif #ifdef TEST cerr << "Warning" << ": Generating a fake cookie for " << "X authentication.\n"; #endif generateCookie(realCookie_); } else { #ifdef TEST *logofs << "Auth: Checking cookie in string '" << line << "'.\n" << logofs_flush; #endif // // Skip the hostname in the authority entry // just in case it includes some white spaces. // char *cookie = NULL; cookie = index(line, ':'); if (cookie == NULL) { cookie = line; } if (sscanf(cookie, "%*s %*s %511s", realCookie_) != 1) { #ifdef PANIC *logofs << "Auth: PANIC! Failed to identify the cookie " << "in string '" << line << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to identify the cookie " << "in string '" << line << "'.\n"; goto AuthGetCookieResult; } #ifdef TEST *logofs << "Auth: Got cookie '" << realCookie_ << "' from file '" << file_ << "'.\n" << logofs_flush; #endif } result = 1; AuthGetCookieResult: if (data != NULL) { Pclose(data); } return result; } int Auth::validateCookie() { unsigned int length = strlen(realCookie_); if (length > DEFAULT_STRING_LIMIT / 2 - 1 || strlen(fakeCookie_) != length) { #ifdef PANIC *logofs << "Auth: PANIC! Size mismatch between cookies '" << realCookie_ << "' and '" << fakeCookie_ << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Size mismatch between cookies '" << realCookie_ << "' and '" << fakeCookie_ << "'.\n"; goto AuthValidateCookieError; } // // The length of the resulting data will be // half the size of the Hex cookie. // length = length / 2; fakeData_ = new char[length]; realData_ = new char[length]; if (fakeData_ == NULL || realData_ == NULL) { #ifdef PANIC *logofs << "Auth: PANIC! Cannot allocate memory for the binary X " << "authorization data.\n" << logofs_flush; #endif cerr << "Error" << ": Cannot allocate memory for the binary X " << "authorization data.\n"; goto AuthValidateCookieError; } // // Translate the real cookie from Hex data // to its binary representation. // unsigned int value; for (unsigned int i = 0; i < length; i++) { if (sscanf(realCookie_ + 2 * i, "%2x", &value) != 1) { #ifdef PANIC *logofs << "Auth: PANIC! Bad X authorization data in real " << "cookie '" << realCookie_ << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Bad X authorization data in real cookie '" << realCookie_ << "'.\n"; goto AuthValidateCookieError; } realData_[i] = value; if (sscanf(fakeCookie_ + 2 * i, "%2x", &value) != 1) { #ifdef PANIC *logofs << "Auth: PANIC! Bad X authorization data in fake " << "cookie '" << fakeCookie_ << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Bad X authorization data in fake cookie '" << fakeCookie_ << "'.\n"; goto AuthValidateCookieError; } fakeData_[i] = value; } dataSize_ = length; #ifdef TEST *logofs << "Auth: Validated real cookie '" << realCookie_ << "' and fake cookie '" << fakeCookie_ << "' with data with size " << dataSize_ << ".\n" << logofs_flush; *logofs << "Auth: Ready to accept incoming connections.\n" << logofs_flush; #endif return 1; AuthValidateCookieError: delete [] fakeData_; delete [] realData_; fakeData_ = NULL; realData_ = NULL; dataSize_ = 0; return -1; } int Auth::checkCookie(unsigned char *buffer) { if (isValid() != 1) { #ifdef PANIC *logofs << "Auth: PANIC! Attempt to check the X cookie with " << "invalid authorization data.\n" << logofs_flush; #endif cerr << "Error" << ": Attempt to check the X cookie with " << "invalid authorization data.\n"; return -1; } const char *protoName = "MIT-MAGIC-COOKIE-1"; int protoSize = strlen(protoName); int matchedProtoSize; int matchedDataSize; if (buffer[0] == 0x42) { // // Byte order is MSB first. // matchedProtoSize = 256 * buffer[6] + buffer[7]; matchedDataSize = 256 * buffer[8] + buffer[9]; } else if (buffer[0] == 0x6c) { // // Byte order is LSB first. // matchedProtoSize = buffer[6] + 256 * buffer[7]; matchedDataSize = buffer[8] + 256 * buffer[9]; } else { #ifdef WARNING *logofs << "Auth: WARNING! Bad X connection data in the buffer.\n" << logofs_flush; #endif cerr << "Warning" << ": Bad X connection data in the buffer.\n"; return -1; } // // Check if both the authentication protocol // and the fake cookie match our data. // int protoOffset = 12; #ifdef TEST *logofs << "Auth: Received a protocol size of " << matchedProtoSize << " bytes.\n" << logofs_flush; #endif if (matchedProtoSize != protoSize || memcmp(buffer + protoOffset, protoName, protoSize) != 0) { #ifdef WARNING *logofs << "Auth: WARNING! Protocol mismatch or no X " << "authentication data.\n" << logofs_flush; #endif cerr << "Warning" << ": Protocol mismatch or no X " << "authentication data.\n"; return -1; } int dataOffset = protoOffset + ((matchedProtoSize + 3) & ~3); #ifdef TEST *logofs << "Auth: Received a data size of " << matchedDataSize << " bytes.\n" << logofs_flush; #endif if (matchedDataSize != dataSize_ || memcmp(buffer + dataOffset, fakeData_, dataSize_) != 0) { #ifdef WARNING *logofs << "Auth: WARNING! Cookie mismatch in the X " << "authentication data.\n" << logofs_flush; #endif cerr << "Warning" << ": Cookie mismatch in the X " << "authentication data.\n"; return -1; } // // Everything is OK. Replace the fake data. // #ifdef TEST *logofs << "Auth: Replacing fake X authentication data " << "with the real data.\n" << logofs_flush; #endif memcpy(buffer + dataOffset, realData_, dataSize_); return 1; } void Auth::generateCookie(char *cookie) { // // Code is from the SSH implementation, except that // we use a much weaker random number generator. // This is not critical, anyway, as this is just a // fake cookie. The X server doesn't have a cookie // for the display, so it will ignore the value we // feed to it. // T_timestamp timer = getTimestamp(); srand((unsigned int) timer.tv_usec); unsigned int data = rand(); for (int i = 0; i < 16; i++) { if (i % 4 == 0) { data = rand(); } snprintf(cookie + 2 * i, 3, "%02x", data & 0xff); data >>= 8; } generatedCookie_ = 1; #ifdef TEST *logofs << "Auth: Generated X cookie string '" << cookie << "'.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/Auth.h0000644000000000000000000000745713614532331013471 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Auth_H #define Auth_H #include "Timestamp.h" // // Handle the forwarding of authorization credentials // to the X server by replacing the fake cookie with // the real cookie as it is read from the auth file. // At the moment only the MIT-MAGIC-COOKIE-1 cookies // are recognized. The implementation is based on the // corresponding code found in the SSH client. // class Auth { public: // // Must be created by passing the fake cookie that // will be forwarded by the remote end and with the // real X display that is going to be used for the // session. // Auth(char *display, char *cookie); ~Auth(); int isValid() { return (isTimestamp(last_) == 1 && fakeCookie_ != NULL && *fakeCookie_ != '\0' && realCookie_ != NULL && *realCookie_ != '\0' && fakeData_ != NULL && realData_ != NULL && dataSize_ != 0); } int isFake() const { return generatedCookie_; } // // Method called in the channel class to find if the // provided cookie matches the fake one. If the data // matches, the fake cookie is replaced with the real // one. // int checkCookie(unsigned char *buffer); protected: // // Update the real cookie for the display. If called // a further time, check if the auth file is changed // and get the new cookie. // int updateCookie(); // // Find out which authorization file is to be used // and query the cookie for the current display. // int getCookie(); // // Extract the binary data from the cookies so that // data can be directly compared at the time it is // taken from the X request. // int validateCookie(); // // Generate a fake random cookie and copy it to the // provided string. // void generateCookie(char *cookie); private: char *display_; char *file_; T_timestamp last_; char *fakeCookie_; char *realCookie_; char *fakeData_; char *realData_; int dataSize_; int generatedCookie_; }; #endif /* Auth_H */ nx-libs-3.5.99.23/nxcomp/src/Bitmap.cpp0000644000000000000000000000754613614532331014336 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Misc.h" #include "Bitmap.h" #define PANIC #define WARNING #undef TEST #undef DEBUG int UnpackBitmap(T_geometry *geometry, unsigned char method, unsigned char *src_data, int src_size, int dst_bpp, int dst_width, int dst_height, unsigned char *dst_data, int dst_size) { if (dst_bpp != 32) { #ifdef TEST *logofs << "UnpackBitmap: Nothing to do with " << "image of " << dst_bpp << " bits per plane " << "and size " << src_size << ".\n" << logofs_flush; #endif if (src_size != dst_size) { #ifdef PANIC *logofs << "UnpackBitmap: PANIC! Size mismatch with " << src_size << " bytes in the source and " << dst_size << " in the destination.\n" << logofs_flush; #endif return -1; } memcpy(dst_data, src_data, src_size); return 1; } else if (src_size != dst_width * dst_height * 3 || dst_size != dst_width * dst_height * 4) { #ifdef PANIC *logofs << "UnpackBitmap: PANIC! Size mismatch with " << src_size << " bytes in the source and " << dst_size << " in the destination.\n" << logofs_flush; #endif return -1; } /* * Insert the 4th byte in the bitmap. */ unsigned char *next_src = src_data; unsigned char *next_dst = dst_data; if (geometry -> image_byte_order == LSBFirst) { while (next_src < src_data + src_size) { *next_dst++ = *next_src++; *next_dst++ = *next_src++; *next_dst++ = *next_src++; next_dst++; } } else { while (next_src < src_data + src_size) { next_dst++; *next_dst++ = *next_src++; *next_dst++ = *next_src++; *next_dst++ = *next_src++; } } #ifdef TEST *logofs << "UnpackBitmap: Unpacked " << src_size << " bytes to a buffer of " << dst_size << " with " << dst_bpp << " bits per plane.\n" << logofs_flush; #endif return 1; } nx-libs-3.5.99.23/nxcomp/src/Bitmap.h0000644000000000000000000000421313614532331013767 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Bitmap_H #define Bitmap_H #include "Unpack.h" int UnpackBitmap(T_geometry *geometry, unsigned char method, unsigned char *src_data, int src_size, int dst_bpp, int dst_width, int dst_height, unsigned char *dst_data, int dst_size); #endif /* Bitmap_H */ nx-libs-3.5.99.23/nxcomp/src/BlockCache.cpp0000644000000000000000000000555213614532331015073 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "BlockCache.h" int BlockCache::compare(unsigned int size, const unsigned char *data, int overwrite) { int match = 0; if (size == size_) { match = 1; for (unsigned int i = 0; i < size_; i++) if (data[i] != buffer_[i]) { match = 0; break; } } if (!match && overwrite) set(size, data); return match; } void BlockCache::set(unsigned int size, const unsigned char *data) { if (size_ < size) { delete[]buffer_; buffer_ = new unsigned char[size]; } size_ = size; memcpy(buffer_, data, size); checksum_ = checksum(size, data); } unsigned int BlockCache::checksum(unsigned int size, const unsigned char *data) { unsigned int sum = 0; unsigned int shift = 0; const unsigned char *next = data; for (unsigned int i = 0; i < size; i++) { unsigned int value = (unsigned int) *next++; sum += (value << shift); shift++; if (shift == 8) shift = 0; } return sum; } nx-libs-3.5.99.23/nxcomp/src/BlockCache.h0000644000000000000000000000506113614532331014533 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef BlockCache_H #define BlockCache_H // Cache to hold an arbitrary-length block of bytes class BlockCache { public: BlockCache():buffer_(0), size_(0), checksum_(0) { } ~BlockCache() { delete[]buffer_; } int compare(unsigned int size, const unsigned char *data, int overwrite = 1); void set(unsigned int size, const unsigned char *data); unsigned int getLength() const { return size_; } unsigned int getChecksum() const { return checksum_; } const unsigned char *getData() const { return buffer_; } static unsigned int checksum(unsigned int size, const unsigned char *data); private: unsigned char *buffer_; unsigned int size_; unsigned int checksum_; }; #endif /* BlockCache_H */ nx-libs-3.5.99.23/nxcomp/src/BlockCacheSet.cpp0000644000000000000000000001056013614532331015542 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Misc.h" #include "BlockCacheSet.h" BlockCacheSet::BlockCacheSet(unsigned int numCaches): caches_(new BlockCache *[numCaches]), size_(numCaches), length_(0) { for (unsigned int i = 0; i < numCaches; i++) caches_[i] = new BlockCache(); } BlockCacheSet::~BlockCacheSet() { // // TODO: There is still a strange segfault occurring // at random time under Cygwin, when proxy is being // shutdown. Problem appeared just after upgrading // to the latest version of the Cygwin DLL. A stack // trace, obtained at the last minute, reveals that // failure happens in this destructor. // #ifndef __CYGWIN32__ for (unsigned int i = 0; i < size_; i++) delete caches_[i]; delete[]caches_; #endif /* ifdef __CYGWIN32__ */ } int BlockCacheSet::lookup(unsigned int dataLength, const unsigned char *data, unsigned int &index) { unsigned int checksum = BlockCache::checksum(dataLength, data); for (unsigned int i = 0; i < length_; i++) if ((caches_[i]->getChecksum() == checksum) && (caches_[i]->compare(dataLength, data, 0))) { // match index = i; if (i) { BlockCache *save = caches_[i]; unsigned int target = (i >> 1); do { caches_[i] = caches_[i - 1]; i--; } while (i > target); caches_[target] = save; } return 1; } // no match unsigned int insertionPoint = (length_ >> 1); unsigned int start; if (length_ >= size_) start = size_ - 1; else { start = length_; length_++; } BlockCache *save = caches_[start]; for (unsigned int k = start; k > insertionPoint; k--) caches_[k] = caches_[k - 1]; caches_[insertionPoint] = save; save->set(dataLength, data); return 0; } void BlockCacheSet::get(unsigned index, unsigned int &size, const unsigned char *&data) { size = caches_[index]->getLength(); data = caches_[index]->getData(); if (index) { BlockCache *save = caches_[index]; unsigned int target = (index >> 1); do { caches_[index] = caches_[index - 1]; index--; } while (index > target); caches_[target] = save; } } void BlockCacheSet::set(unsigned int dataLength, const unsigned char *data) { unsigned int insertionPoint = (length_ >> 1); unsigned int start; if (length_ >= size_) start = size_ - 1; else { start = length_; length_++; } BlockCache *save = caches_[start]; for (unsigned int k = start; k > insertionPoint; k--) caches_[k] = caches_[k - 1]; caches_[insertionPoint] = save; save->set(dataLength, data); } nx-libs-3.5.99.23/nxcomp/src/BlockCacheSet.h0000644000000000000000000000447413614532331015216 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef BlockCacheSet_H #define BlockCacheSet_H #include "BlockCache.h" class BlockCacheSet { public: BlockCacheSet(unsigned int numCaches); ~BlockCacheSet(); int lookup(unsigned int size, const unsigned char *data, unsigned int &index); void get(unsigned int index, unsigned int &size, const unsigned char *&data); void set(unsigned int size, const unsigned char *data); private: BlockCache ** caches_; unsigned int size_; unsigned int length_; }; #endif /* BlockCacheSet_H */ nx-libs-3.5.99.23/nxcomp/src/ChangeGC.cpp0000644000000000000000000001342213614532331014507 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ChangeGC.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int ChangeGCStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { ChangeGCMessage *changeGC = (ChangeGCMessage *) message; // // Here is the fingerprint. // changeGC -> gcontext = GetULONG(buffer + 4, bigEndian); changeGC -> value_mask = GetULONG(buffer + 8, bigEndian); // // Clear the unused bytes carried in the // payload to increase the effectiveness // of the caching algorithm. // if ((int) size > dataOffset) { #ifdef DEBUG *logofs << name() << ": Removing unused bytes from the " << "data payload.\n" << logofs_flush; #endif changeGC -> value_mask &= (1 << 23) - 1; unsigned int mask = 0x1; unsigned char *source = (unsigned char *) buffer + CHANGEGC_DATA_OFFSET; unsigned long value = 0; for (unsigned int i = 0; i < 23; i++) { if (changeGC -> value_mask & mask) { value = GetULONG(source, bigEndian); value &= (0xffffffff >> (32 - CREATEGC_FIELD_WIDTH[i])); PutULONG(value, source, bigEndian); source += 4; } mask <<= 1; } } #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int ChangeGCStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { ChangeGCMessage *changeGC = (ChangeGCMessage *) message; // // Fill all the message's fields. // PutULONG(changeGC -> gcontext, buffer + 4, bigEndian); PutULONG(changeGC -> value_mask, buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void ChangeGCStore::dumpIdentity(const Message *message) const { #ifdef DUMP ChangeGCMessage *changeGC = (ChangeGCMessage *) message; *logofs << name() << ": Identity gcontext " << changeGC -> gcontext << ", mask " << changeGC -> value_mask << ", size " << changeGC -> size_ << ".\n" << logofs_flush; #endif } void ChangeGCStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { /* md5_append(md5_state_, buffer + 4, 8); */ md5_append(md5_state_, buffer + 8, 4); } void ChangeGCStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { ChangeGCMessage *changeGC = (ChangeGCMessage *) message; ChangeGCMessage *cachedChangeGC = (ChangeGCMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << changeGC -> gcontext << " as gcontext field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(changeGC -> gcontext, clientCache -> gcCache); cachedChangeGC -> gcontext = changeGC -> gcontext; } void ChangeGCStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { ChangeGCMessage *changeGC = (ChangeGCMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> gcCache); changeGC -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << changeGC -> gcontext << " as gcontext field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/ChangeGC.h0000644000000000000000000001235413614532331014157 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ChangeGC_H #define ChangeGC_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define CHANGEGC_ENABLE_CACHE 1 #define CHANGEGC_ENABLE_DATA 0 #define CHANGEGC_ENABLE_SPLIT 0 #define CHANGEGC_ENABLE_COMPRESS 0 #define CHANGEGC_DATA_LIMIT 144 #define CHANGEGC_DATA_OFFSET 12 #define CHANGEGC_CACHE_SLOTS 3000 #define CHANGEGC_CACHE_THRESHOLD 3 #define CHANGEGC_CACHE_LOWER_THRESHOLD 1 // // The message class. // class ChangeGCMessage : public Message { friend class ChangeGCStore; public: ChangeGCMessage() { } ~ChangeGCMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned int gcontext; unsigned int value_mask; }; class ChangeGCStore : public MessageStore { // // Constructors and destructors. // public: ChangeGCStore() : MessageStore() { enableCache = CHANGEGC_ENABLE_CACHE; enableData = CHANGEGC_ENABLE_DATA; enableSplit = CHANGEGC_ENABLE_SPLIT; enableCompress = CHANGEGC_ENABLE_COMPRESS; dataLimit = CHANGEGC_DATA_LIMIT; dataOffset = CHANGEGC_DATA_OFFSET; cacheSlots = CHANGEGC_CACHE_SLOTS; cacheThreshold = CHANGEGC_CACHE_THRESHOLD; cacheLowerThreshold = CHANGEGC_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~ChangeGCStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "ChangeGC"; } virtual unsigned char opcode() const { return X_ChangeGC; } virtual unsigned int storage() const { return sizeof(ChangeGCMessage); } // // Message handling methods. // public: virtual Message *create() const { return new ChangeGCMessage(); } virtual Message *create(const Message &message) const { return new ChangeGCMessage((const ChangeGCMessage &) message); } virtual void destroy(Message *message) const { delete (ChangeGCMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; }; #endif /* ChangeGC_H */ nx-libs-3.5.99.23/nxcomp/src/ChangeProperty.cpp0000644000000000000000000001522113614532331016041 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ChangeProperty.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int ChangePropertyStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; changeProperty -> mode = *(buffer + 1); changeProperty -> format = *(buffer + 16); changeProperty -> window = GetULONG(buffer + 4, bigEndian); changeProperty -> property = GetULONG(buffer + 8, bigEndian); changeProperty -> type = GetULONG(buffer + 12, bigEndian); changeProperty -> length = GetULONG(buffer + 20, bigEndian); // // Cleanup the padding bytes. // unsigned int uiFormat; unsigned int uiLengthInBytes; if ((int) size > CHANGEPROPERTY_DATA_OFFSET) { uiFormat = *(buffer + 16); uiLengthInBytes = changeProperty -> length; #ifdef DEBUG *logofs << name() << ": length " << uiLengthInBytes << ", format " << uiFormat << ", size " << size << ".\n" << logofs_flush; #endif if (uiFormat == 16) { uiLengthInBytes <<= 1; } else if (uiFormat == 32) { uiLengthInBytes <<= 2; } unsigned char *end = ((unsigned char *) buffer) + size; unsigned char *pad = ((unsigned char *) buffer) + CHANGEPROPERTY_DATA_OFFSET + uiLengthInBytes; CleanData((unsigned char *) pad, end - pad); } #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } int ChangePropertyStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; *(buffer + 1) = changeProperty -> mode; *(buffer + 16) = changeProperty -> format; PutULONG(changeProperty -> window, buffer + 4, bigEndian); PutULONG(changeProperty -> property, buffer + 8, bigEndian); PutULONG(changeProperty -> type, buffer + 12, bigEndian); PutULONG(changeProperty -> length, buffer + 20, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void ChangePropertyStore::dumpIdentity(const Message *message) const { #ifdef DUMP ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; *logofs << name() << ": Identity mode " << (unsigned int) changeProperty -> mode << ", format " << (unsigned int) changeProperty -> format << ", window " << changeProperty -> window << ", property " << changeProperty -> property << ", type " << changeProperty -> type << ", length " << changeProperty -> length << ", size " << changeProperty -> size_ << ".\n" << logofs_flush; #endif } void ChangePropertyStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { md5_append(md5_state_, buffer + 1, 1); md5_append(md5_state_, buffer + 16, 1); md5_append(md5_state_, buffer + 8, 4); md5_append(md5_state_, buffer + 12, 4); md5_append(md5_state_, buffer + 20, 4); } void ChangePropertyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; ChangePropertyMessage *cachedChangeProperty = (ChangePropertyMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << changeProperty -> window << " as window field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(changeProperty -> window, clientCache -> windowCache); cachedChangeProperty -> window = changeProperty -> window; } void ChangePropertyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> windowCache); changeProperty -> window = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << changeProperty -> window << " as window field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/ChangeProperty.h0000644000000000000000000001265613614532331015517 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ChangeProperty_H #define ChangeProperty_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define CHANGEPROPERTY_ENABLE_CACHE 1 #define CHANGEPROPERTY_ENABLE_DATA 0 #define CHANGEPROPERTY_ENABLE_SPLIT 0 #define CHANGEPROPERTY_ENABLE_COMPRESS 0 #define CHANGEPROPERTY_DATA_LIMIT 28688 #define CHANGEPROPERTY_DATA_OFFSET 24 #define CHANGEPROPERTY_CACHE_SLOTS 2000 #define CHANGEPROPERTY_CACHE_THRESHOLD 2 #define CHANGEPROPERTY_CACHE_LOWER_THRESHOLD 1 // // The message class. // class ChangePropertyMessage : public Message { friend class ChangePropertyStore; public: ChangePropertyMessage() { } ~ChangePropertyMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char mode; unsigned char format; unsigned int window; unsigned int property; unsigned int type; unsigned int length; }; class ChangePropertyStore : public MessageStore { // // Constructors and destructors. // public: ChangePropertyStore() : MessageStore() { enableCache = CHANGEPROPERTY_ENABLE_CACHE; enableData = CHANGEPROPERTY_ENABLE_DATA; enableSplit = CHANGEPROPERTY_ENABLE_SPLIT; enableCompress = CHANGEPROPERTY_ENABLE_COMPRESS; dataLimit = CHANGEPROPERTY_DATA_LIMIT; dataOffset = CHANGEPROPERTY_DATA_OFFSET; cacheSlots = CHANGEPROPERTY_CACHE_SLOTS; cacheThreshold = CHANGEPROPERTY_CACHE_THRESHOLD; cacheLowerThreshold = CHANGEPROPERTY_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~ChangePropertyStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "ChangeProperty"; } virtual unsigned char opcode() const { return X_ChangeProperty; } virtual unsigned int storage() const { return sizeof(ChangePropertyMessage); } // // Message handling methods. // public: virtual Message *create() const { return new ChangePropertyMessage(); } virtual Message *create(const Message &message) const { return new ChangePropertyMessage((const ChangePropertyMessage &) message); } virtual void destroy(Message *message) const { delete (ChangePropertyMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* ChangeProperty_H */ nx-libs-3.5.99.23/nxcomp/src/ChannelCache.cpp0000644000000000000000000000527413614532331015412 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ChannelCache.h" const unsigned int CONFIGUREWINDOW_FIELD_WIDTH[7] = { 16, // x 16, // y 16, // width 16, // height 16, // border width 29, // sibling window 3 // stack mode }; const unsigned int CREATEGC_FIELD_WIDTH[23] = { 4, // function 32, // plane mask 32, // foreground 32, // background 16, // line width 2, // line style 2, // cap style 2, // join style 2, // fill style 1, // fill rule 29, // tile 29, // stipple 16, // tile/stipple x origin 16, // tile/stipple y origin 29, // font 1, // subwindow mode 1, // graphics exposures 16, // clip x origin 16, // clip y origin 29, // clip mask 16, // card offset 8, // dashes 1 // arc mode }; nx-libs-3.5.99.23/nxcomp/src/ChannelCache.h0000644000000000000000000000452013614532331015050 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ChannelCache_H #define ChannelCache_H // // Sizes of optional fields for ConfigureWindow // request. // extern const unsigned int CONFIGUREWINDOW_FIELD_WIDTH[7]; // // Sizes of optional fields for CreateGC request. // extern const unsigned int CREATEGC_FIELD_WIDTH[23]; // // This is just needed to provide a pointer // to the base cache class in encoding and // decoding procedures of message stores. // class ChannelCache { public: ChannelCache() { } ~ChannelCache() { } }; #endif /* ChannelCache_H */ nx-libs-3.5.99.23/nxcomp/src/Channel.cpp0000644000000000000000000014522613614532331014470 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Channel.h" #include "List.h" #include "Proxy.h" #include "Statistics.h" #include "StaticCompressor.h" #include "NXalert.h" extern Proxy *proxy; // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Log the operations related to splits. // #undef SPLIT #undef COUNT #define COUNT_MAJOR_OPCODE 154 #undef MONITOR #define MONITOR_MAJOR_OPCODE 154 #define MONITOR_MINOR_OPCODE 23 #undef CLEAR #define CLEAR_MAJOR_OPCODE 154 #define CLEAR_MINOR_OPCODE 23 // // Define this to know how many messages // are allocated and deallocated. // #undef REFERENCES // // Set to the descriptor of the first X // channel successfully connected. // int Channel::firstClient_ = -1; // // Port used for font server connections. // int Channel::fontPort_ = -1; // // This is used for reference count. // #ifdef REFERENCES int Channel::references_ = 0; #endif Channel::Channel(Transport *transport, StaticCompressor *compressor) : transport_(transport), compressor_(compressor) { fd_ = transport_ -> fd(); finish_ = 0; closing_ = 0; drop_ = 0; congestion_ = 0; priority_ = 0; alert_ = 0; firstRequest_ = 1; firstReply_ = 1; enableCache_ = 1; enableSplit_ = 1; enableSave_ = 1; enableLoad_ = 1; // // Must be set by proxy. // opcodeStore_ = NULL; clientStore_ = NULL; serverStore_ = NULL; clientCache_ = NULL; serverCache_ = NULL; #ifdef REFERENCES *logofs << "Channel: Created new Channel at " << this << " out of " << ++references_ << " allocated references.\n" << logofs_flush; #endif } Channel::~Channel() { if (firstClient_ == fd_) { firstClient_ = -1; } #ifdef REFERENCES *logofs << "Channel: Deleted Channel at " << this << " out of " << --references_ << " allocated references.\n" << logofs_flush; #endif } int Channel::handleEncode(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, MessageStore *store, const unsigned char opcode, const unsigned char *buffer, const unsigned int size) { #ifdef MONITOR static float totalMessages = 0; static float totalBits = 0; int bits; int diff; bits = encodeBuffer.getBits(); #endif // // Check if message can be differentially // encoded using a similar message in the // message store. // #ifdef COUNT if (*(buffer) == COUNT_MAJOR_OPCODE) { if (*(buffer) < 128) { *logofs << "handleEncode: Handling OPCODE#" << (unsigned int) *(buffer) << ".\n" << logofs_flush; } else { *logofs << "handleEncode: Handling OPCODE#" << (unsigned int) *(buffer) << " MINOR#" << (unsigned int) *(buffer + 1) << ".\n" << logofs_flush; } } #endif #ifdef CLEAR if (*(buffer) == CLEAR_MAJOR_OPCODE && (CLEAR_MINOR_OPCODE == -1 || *(buffer + 1) == CLEAR_MINOR_OPCODE)) { *((unsigned char *) buffer) = X_NoOperation; *((unsigned char *) buffer + 1) = '\0'; CleanData((unsigned char *) buffer + 4, size - 4); } #endif if (handleEncodeCached(encodeBuffer, channelCache, store, buffer, size) == 1) { #ifdef MONITOR diff = encodeBuffer.getBits() - bits; if (*(buffer) == MONITOR_MAJOR_OPCODE && (MONITOR_MINOR_OPCODE == -1 || *(buffer + 1) == MONITOR_MINOR_OPCODE)) { totalMessages++; totalBits += diff; *logofs << "handleEncode: Handled cached OPCODE#" << (unsigned int) *(buffer) << " MINOR#" << (unsigned int) *(buffer + 1) << ". " << size << " bytes in, " << diff << " bits (" << ((float) diff) / 8 << " bytes) out. Average " << totalBits / totalMessages << "/1.\n" << logofs_flush; } #endif // // Let the channel update the split store // and notify the agent in the case of a // cache hit. // if (store -> enableSplit) { handleSplit(encodeBuffer, store, store -> lastAction, store -> lastHit, opcode, buffer, size); } return 1; } // // A similar message could not be found in // cache or message must be discarded. Must // transmit the message using the field by // field differential encoding. // handleEncodeIdentity(encodeBuffer, channelCache, store, buffer, size, bigEndian_); // // Check if message has a distinct data part. // if (store -> enableData) { // // If message split was requested by agent then send data // out-of-band, dividing it in small chunks. Until message // is completely transferred, keep in the split store a // dummy version of the message, with data replaced with a // pattern. // // While data is being transferred, agent should have put // the resource (for example its client) asleep. It can // happen, though, that a different client would reference // the same message. We cannot issue a cache hit for images // being split (such images are put in store in 'incomplete' // state), so we need to handle this case. // if (store -> enableSplit == 1) { // // Let the channel decide what to do with the // message. If the split can't take place be- // cause the split store is full, the channel // will tell the remote side that the data is // going to follow. // if (handleSplit(encodeBuffer, store, store -> lastAction, (store -> lastAction == IS_ADDED ? store -> lastAdded : 0), opcode, buffer, size) == 1) { #ifdef MONITOR diff = encodeBuffer.getBits() - bits; if (*(buffer) == MONITOR_MAJOR_OPCODE && (MONITOR_MINOR_OPCODE == -1 || *(buffer + 1) == MONITOR_MINOR_OPCODE)) { totalMessages++; totalBits += diff; *logofs << "handleEncode: Handled split OPCODE#" << (unsigned int) *(buffer) << " MINOR#" << (unsigned int) *(buffer + 1) << ". " << size << " bytes in, " << diff << " bits (" << ((float) diff) / 8 << " bytes) out. Average " << totalBits / totalMessages << "/1.\n" << logofs_flush; } #endif return 0; } } // // The split did not take place and we are going // to transfer the data part. Check if the static // compression of the data section is enabled. // This is the case of all messages not having a // special differential encoding or messages that // we want to store in cache in compressed form. // unsigned int offset = store -> identitySize(buffer, size); if (store -> enableCompress) { unsigned char *data = NULL; unsigned int dataSize = 0; int compressed = handleCompress(encodeBuffer, opcode, offset, buffer, size, data, dataSize); if (compressed < 0) { return -1; } else if (compressed > 0) { // // Update the size of the message according // to the result of the data compression. // handleUpdate(store, size - offset, dataSize); } } else { handleCopy(encodeBuffer, opcode, offset, buffer, size); } } #ifdef MONITOR diff = encodeBuffer.getBits() - bits; if (*(buffer) == MONITOR_MAJOR_OPCODE && (MONITOR_MINOR_OPCODE == -1 || *(buffer + 1) == MONITOR_MINOR_OPCODE)) { totalMessages++; totalBits += diff; *logofs << "handleEncode: Handled OPCODE#" << (unsigned int) *(buffer) << " MINOR#" << (unsigned int) *(buffer + 1) << ". " << size << " bytes in, " << diff << " bits (" << ((float) diff) / 8 << " bytes) out. Average " << totalBits / totalMessages << "/1.\n" << logofs_flush; } #endif return 0; } int Channel::handleDecode(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, MessageStore *store, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { // // Check first if the message is in the // message store. // unsigned int split = 0; if (handleDecodeCached(decodeBuffer, channelCache, store, buffer, size) == 1) { // // Let the channel update the split store // in the case of a message being cached. // if (store -> enableSplit == 1) { // Since ProtoStep7 (#issue 108) #ifdef DEBUG *logofs << "handleDecode: " << store -> name() << ": Checking if the message was split.\n" << logofs_flush; #endif decodeBuffer.decodeBoolValue(split); if (split == 1) { handleSplit(decodeBuffer, store, store -> lastAction, store -> lastHit, opcode, buffer, size); handleCleanAndNullRequest(opcode, buffer, size); } } return 1; } // // Decode the full identity. // handleDecodeIdentity(decodeBuffer, channelCache, store, buffer, size, bigEndian_, &writeBuffer_); // // Check if the message has a distinct // data part. // if (store -> enableData) { // // Check if message has been split. // if (store -> enableSplit) { #ifdef DEBUG *logofs << "handleDecode: " << store -> name() << ": Checking if the message was split.\n" << logofs_flush; #endif decodeBuffer.decodeBoolValue(split); if (split == 1) { // // If the message was added to the store, // create the entry without the data part. // handleSaveSplit(store, buffer, size); handleSplit(decodeBuffer, store, store -> lastAction, (store -> lastAction == IS_ADDED ? store -> lastAdded : 0), opcode, buffer, size); handleCleanAndNullRequest(opcode, buffer, size); return 0; } } // // Decode the data part. // unsigned int offset = store -> identitySize(buffer, size); if (store -> enableCompress) { const unsigned char *data = NULL; unsigned int dataSize = 0; int decompressed = handleDecompress(decodeBuffer, opcode, offset, buffer, size, data, dataSize); if (decompressed < 0) { return -1; } else if (decompressed > 0) { // // The message has been transferred // in compressed format. // handleSave(store, buffer, size, data, dataSize); if (store -> enableSplit) { if (split == 1) { handleSplit(decodeBuffer, store, store -> lastAction, (store -> lastAction == IS_ADDED ? store -> lastAdded : 0), opcode, buffer, size); handleCleanAndNullRequest(opcode, buffer, size); } } return 0; } } else { // // Static compression of the data part // was not enabled for this message. // handleCopy(decodeBuffer, opcode, offset, buffer, size); } } // // The message doesn't have a data part // or the data was not compressed. // handleSave(store, buffer, size); if (store -> enableSplit) { if (split == 1) { handleSplit(decodeBuffer, store, store -> lastAction, (store -> lastAction == IS_ADDED ? store -> lastAdded : 0), opcode, buffer, size); handleCleanAndNullRequest(opcode, buffer, size); } } return 0; } int Channel::handleEncodeCached(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, MessageStore *store, const unsigned char *buffer, const unsigned int size) { if (control -> LocalDeltaCompression == 0 || enableCache_ == 0 || store -> enableCache == 0) { // Since ProtoStep7 (#issue 108) encodeBuffer.encodeActionValue(is_discarded, store -> lastActionCache); store -> lastAction = is_discarded; return 0; } #ifdef DEBUG *logofs << "handleEncodeCached: " << store -> name() << ": Going to handle a new message of this class.\n" << logofs_flush; #endif // // Check if the estimated size of cache is greater // than the requested limit. If it is the case make // some room by deleting one or more messages. // int position; while (mustCleanStore(store) == 1 && canCleanStore(store) == 1) { #ifdef DEBUG *logofs << "handleEncodeCached: " << store -> name() << ": Trying to reduce size of message store.\n" << logofs_flush; #endif position = store -> clean(use_checksum); if (position == nothing) { #ifdef TEST *logofs << "handleEncodeCached: " << store -> name() << ": WARNING! No message found to be " << "actually removed.\n" << logofs_flush; #endif break; } #ifdef DEBUG *logofs << "handleEncodeCached: " << store -> name() << ": Message at position " << position << " will be removed.\n" << logofs_flush; #endif // // Encode the position of message to // be discarded. // store -> lastRemoved = position; // Since ProtoStep7 (#issue 108) encodeBuffer.encodeActionValue(is_removed, store -> lastRemoved, store -> lastActionCache); #ifdef DEBUG *logofs << "handleEncodeCached: " << store -> name() << ": Going to " << "clean up message at position " << position << ".\n" << logofs_flush; #endif store -> remove(position, use_checksum, discard_data); #ifdef DEBUG *logofs << "handleEncodeCached: " << store -> name() << ": There are " << store -> getSize() << " messages in the store out of " << store -> cacheSlots << " slots.\n" << logofs_flush; *logofs << "handleEncodeCached: " << store -> name() << ": Size of store is " << store -> getLocalStorageSize() << " bytes locally and " << store -> getRemoteStorageSize() << " bytes remotely.\n" << logofs_flush; *logofs << "handleEncodeCached: " << store -> name() << ": Size of total cache is " << store -> getLocalTotalStorageSize() << " bytes locally and " << store -> getRemoteTotalStorageSize() << " bytes remotely.\n" << logofs_flush; #endif } #ifdef DEBUG if (mustCleanStore(store) == 1 && canCleanStore(store) == 0) { *logofs << "handleEncodeCached: " << store -> name() << ": Store would need a clean but operation will be delayed.\n" << logofs_flush; *logofs << "handleEncodeCached: " << store -> name() << ": There are " << store -> getSize() << " messages in the store out of " << store -> cacheSlots << " slots.\n" << logofs_flush; *logofs << "handleEncodeCached: " << store -> name() << ": Size of store is " << store -> getLocalStorageSize() << " bytes locally and " << store -> getRemoteStorageSize() << " bytes remotely.\n" << logofs_flush; *logofs << "handleEncodeCached: " << store -> name() << ": Size of total cache is " << store -> getLocalTotalStorageSize() << " bytes locally and " << store -> getRemoteTotalStorageSize() << " bytes remotely.\n" << logofs_flush; } #endif // // If 'on the wire' size of message exceeds the // allowed limit then avoid to store it in the // cache. // if (store -> validateMessage(buffer, size) == 0) { #ifdef TEST *logofs << "handleEncodeCached: " << store -> name() << ": Message with size " << size << " ignored.\n" << logofs_flush; #endif // Since ProtoStep7 (#issue 108) encodeBuffer.encodeActionValue(is_discarded, store -> lastActionCache); store -> lastAction = is_discarded; return 0; } // // Fill the message object with the // received data. // Message *message = store -> getTemporary(); if (message == NULL) { #ifdef PANIC *logofs << "handleEncodeCached: " << store -> name() << ": PANIC! Can't allocate memory for " << "a new message.\n" << logofs_flush; #endif cerr << "Error" << ": Can't allocate memory for " << "a new message in context [D].\n"; HandleCleanup(); } // // As we are at encoding side, it is enough to store the // checksum for the object while data can be erased. Both // the identity and the data will never be sent through // the wire again as long as they are stored in the cache // at the decoding side. The split parameter is always // set to 0 as the data will not be stored in any case. // store -> parse(message, 0, buffer, size, use_checksum, discard_data, bigEndian_); #ifdef DUMP store -> dump(message); #endif // // Search the object in the message // store. If found get the position. // #ifdef DEBUG *logofs << "handleEncodeCached: " << store -> name() << ": Searching object of size " << size << " in the cache.\n" << logofs_flush; #endif int added; int locked; position = store -> findOrAdd(message, use_checksum, discard_data, added, locked); if (position == nothing) { #ifdef WARNING *logofs << "handleEncodeCached: " << store -> name() << ": WARNING! Can't store object in the cache.\n" << logofs_flush; #endif // Since ProtoStep7 (#issue 108) encodeBuffer.encodeActionValue(is_discarded, store -> lastActionCache); store -> lastAction = is_discarded; return 0; } else if (locked == 1) { // // We can't issue a cache hit. Encoding identity // differences while message it's being split // would later result in agent to commit a wrong // version of message. // #ifdef WARNING *logofs << "handleEncodeCached: " << store -> name() << ": WARNING! Message of size " << store -> plainSize(position) << " at position " << position << " is locked.\n" << logofs_flush; #endif cerr << "Warning" << ": Message of size " << store -> plainSize(position) << " at position " << position << " is locked.\n"; // Since ProtoStep7 (#issue 108) encodeBuffer.encodeActionValue(is_discarded, store -> lastActionCache); store -> lastAction = is_discarded; return 0; } else if (added == 1) { store -> resetTemporary(); #ifdef DEBUG *logofs << "handleEncodeCached: " << store -> name() << ": Message of size " << store -> plainSize(position) << " has been stored at position " << position << ".\n" << logofs_flush; *logofs << "handleEncodeCached: " << store -> name() << ": There are " << store -> getSize() << " messages in the store out of " << store -> cacheSlots << " slots.\n" << logofs_flush; *logofs << "handleEncodeCached: " << store -> name() << ": Size of store is " << store -> getLocalStorageSize() << " bytes locally and " << store -> getRemoteStorageSize() << " bytes remotely.\n" << logofs_flush; *logofs << "handleEncodeCached: " << store -> name() << ": Size of total cache is " << store -> getLocalTotalStorageSize() << " bytes locally and " << store -> getRemoteTotalStorageSize() << " bytes remotely.\n" << logofs_flush; #endif // // Inform the decoding side that message // must be inserted in cache and encode // the position where the insertion took // place. // store -> lastAction = IS_ADDED; store -> lastAdded = position; // Since ProtoStep7 (#issue 108) encodeBuffer.encodeActionValue(IS_ADDED, store -> lastAdded, store -> lastActionCache); return 0; } else { #ifdef DEBUG *logofs << "handleEncodeCached: " << store -> name() << ": Cache hit. Found object at position " << position << ".\n" << logofs_flush; #endif // // Must abort the connection if the // the position is invalid. // Message *cachedMessage = store -> get(position); // // Increase the rating of the cached // message. // store -> touch(cachedMessage); #ifdef DEBUG *logofs << "handleEncodeCached: " << store -> name() << ": Hits for " << "object at position " << position << " are now " << store -> getTouches(position) << ".\n" << logofs_flush; #endif // // Send to the decoding side position // where object can be found in cache. // store -> lastAction = IS_HIT; store -> lastHit = position; // Since ProtoStep7 (#issue 108) encodeBuffer.encodeActionValue(IS_HIT, store -> lastHit, store -> lastActionCache); // // Send the field by field differences in // respect to the original message stored // in cache. // store -> updateIdentity(encodeBuffer, message, cachedMessage, channelCache); return 1; } } void Channel::handleUpdateAdded(MessageStore *store, unsigned int dataSize, unsigned int compressedDataSize) { #ifdef TEST if (store -> lastAction != IS_ADDED) { #ifdef PANIC *logofs << "handleUpdateAdded: " << store -> name() << ": PANIC! Function called for action '" << store -> lastAction << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Update function called for " << "store '" << store -> name() << "' with " << "action '" << store -> lastAction << "'.\n"; HandleCleanup(); } #endif #ifdef DEBUG *logofs << "handleUpdateAdded: " << store -> name() << ": Updating " << "object at position " << store -> lastAdded << " of size " << store -> plainSize(store -> lastAdded) << " (" << dataSize << "/" << compressedDataSize << ").\n" << logofs_flush; #endif store -> updateData(store -> lastAdded, dataSize, compressedDataSize); #ifdef DEBUG *logofs << "handleUpdateAdded: " << store -> name() << ": There are " << store -> getSize() << " messages in the store out of " << store -> cacheSlots << " slots.\n" << logofs_flush; *logofs << "handleUpdateAdded: " << store -> name() << ": Size of store is " << store -> getLocalStorageSize() << " bytes locally and " << store -> getRemoteStorageSize() << " bytes remotely.\n" << logofs_flush; *logofs << "handleUpdateAdded: " << store -> name() << ": Size of total cache is " << store -> getLocalTotalStorageSize() << " bytes locally and " << store -> getRemoteTotalStorageSize() << " bytes remotely.\n" << logofs_flush; #endif } int Channel::handleDecodeCached(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, MessageStore *store, unsigned char *&buffer, unsigned int &size) { // // Create a new message object and // fill it with received data. // #ifdef DEBUG *logofs << "handleDecodeCached: " << store -> name() << ": Going to handle a new message of this class.\n" << logofs_flush; #endif // // Decode bits telling how to handle // this message. // unsigned char action; unsigned short int position; // Since ProtoStep7 (#issue 108) decodeBuffer.decodeActionValue(action, position, store -> lastActionCache); // // Clean operations must always come // before any operation on message. // while (action == is_removed) { // Since ProtoStep7 (#issue 108) store -> lastRemoved = position; #ifdef DEBUG if (store -> get(store -> lastRemoved)) { *logofs << "handleDecodeCached: " << store -> name() << ": Cleaning up " << "object at position " << store -> lastRemoved << " of size " << store -> plainSize(store -> lastRemoved) << " (" << store -> plainSize(store -> lastRemoved) << "/" << store -> compressedSize(store -> lastRemoved) << ").\n" << logofs_flush; } #endif // // If the message can't be found we // will abort the connection. // store -> remove(store -> lastRemoved, discard_checksum, use_data); // Since ProtoStep7 (#issue 108) decodeBuffer.decodeActionValue(action, position, store -> lastActionCache); } // // If it's a cache hit, the position // where object can be found follows. // if ((T_store_action) action == IS_HIT) { // Since ProtoStep7 (#issue 108) store -> lastHit = position; // // Get data from the cache at given position. // #ifdef DEBUG if (store -> get(store -> lastHit)) { *logofs << "handleDecodeCached: " << store -> name() << ": Retrieving " << "object at position " << store -> lastHit << " of size " << store -> plainSize(store -> lastHit) << " (" << store -> plainSize(store -> lastHit) << "/" << store -> compressedSize(store -> lastHit) << ").\n" << logofs_flush; } #endif // // Must abort the connection if the // the position is invalid. // Message *message = store -> get(store -> lastHit); // // Make room for the outgoing message. // size = store -> plainSize(store -> lastHit); buffer = writeBuffer_.addMessage(size); #ifdef DEBUG *logofs << "handleDecodeCached: " << store -> name() << ": Prepared an outgoing buffer of " << size << " bytes.\n" << logofs_flush; #endif // // Decode the variant part. Pass client // or server cache to the message store. // store -> updateIdentity(decodeBuffer, message, channelCache); // // Write each field in the outgoing buffer. // store -> unparse(message, buffer, size, bigEndian_); #ifdef DUMP store -> dump(message); #endif store -> lastAction = IS_HIT; return 1; } else if ((T_store_action) action == IS_ADDED) { // Since ProtoStep7 (#issue 108) store -> lastAdded = position; #ifdef DEBUG *logofs << "handleDecodeCached: " << store -> name() << ": Message will be later stored at position " << store -> lastAdded << ".\n" << logofs_flush; #endif store -> lastAction = IS_ADDED; return 0; } else { #ifdef DEBUG *logofs << "handleDecodeCached: " << store -> name() << ": Message will be later discarded.\n" << logofs_flush; #endif store -> lastAction = is_discarded; return 0; } } void Channel::handleSaveAdded(MessageStore *store, int split, unsigned char *buffer, unsigned int size, const unsigned char *compressedData, const unsigned int compressedDataSize) { #ifdef TEST if (store -> lastAction != IS_ADDED) { #ifdef PANIC *logofs << "handleSaveAdded: " << store -> name() << ": PANIC! Function called for action '" << store -> lastAction << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Save function called for " << "store '" << store -> name() << "' with " << "action '" << store -> lastAction << "'.\n"; HandleCleanup(); } #endif Message *message = store -> getTemporary(); if (message == NULL) { #ifdef PANIC *logofs << "handleSaveAdded: " << store -> name() << ": PANIC! Can't access temporary storage " << "for message at position " << store -> lastAdded << ".\n" << logofs_flush; #endif cerr << "Error" << ": Can't access temporary storage " << "for message at position " << store -> lastAdded << ".\n"; HandleCleanup(); } if (compressedData == NULL) { // // If the data part has been split // avoid to copy it into the message. // store -> parse(message, split, buffer, size, discard_checksum, use_data, bigEndian_); } else { store -> parse(message, buffer, size, compressedData, compressedDataSize, discard_checksum, use_data, bigEndian_); } if (store -> add(message, store -> lastAdded, discard_checksum, use_data) == nothing) { #ifdef PANIC *logofs << "handleSaveAdded: " << store -> name() << ": PANIC! Can't store message in the cache " << "at position " << store -> lastAdded << ".\n" << logofs_flush; #endif cerr << "Error" << ": Can't store message of type " << store -> name() << "in the cache at position " << store -> lastAdded << ".\n"; HandleCleanup(); } else { store -> resetTemporary(); #ifdef DEBUG *logofs << "handleSaveAdded: " << store -> name() << ": Stored " << (compressedData == NULL ? "plain" : "compressed") << " object at position " << store -> lastAdded << " of size " << store -> plainSize(store -> lastAdded) << " (" << store -> plainSize(store -> lastAdded) << "/" << store -> compressedSize(store -> lastAdded) << ").\n" << logofs_flush; #endif } #ifdef DEBUG *logofs << "handleSaveAdded: " << store -> name() << ": Size of store is " << store -> getLocalStorageSize() << " bytes locally and " << store -> getRemoteStorageSize() << " bytes remotely.\n" << logofs_flush; *logofs << "handleSaveAdded: " << store -> name() << ": Size of total cache is " << store -> getLocalTotalStorageSize() << " bytes locally and " << store -> getRemoteTotalStorageSize() << " bytes remotely.\n" << logofs_flush; #endif } int Channel::handleWait(int timeout) { #ifdef TEST *logofs << "handleWait: Going to wait for more data " << "on FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif T_timestamp startTs = getNewTimestamp(); T_timestamp nowTs = startTs; int readable; int remaining; for (;;) { remaining = timeout - diffTimestamp(startTs, nowTs); if (transport_ -> blocked() == 1) { #ifdef WARNING *logofs << "handleWait: WARNING! Having to drain with " << "channel " << "for FD#" << fd_ << " blocked.\n" << logofs_flush; #endif handleDrain(0, remaining); continue; } if (remaining <= 0) { #ifdef TEST *logofs << "handleWait: Timeout raised while waiting " << "for more data for FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif return 0; } #ifdef TEST *logofs << "handleWait: Waiting " << remaining << " ms " << "for a new message on FD#" << fd_ << ".\n" << logofs_flush; #endif readable = transport_ -> wait(remaining); if (readable > 0) { #ifdef TEST *logofs << "handleWait: WARNING! Encoding more data " << "for FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif if (proxy -> handleAsyncRead(fd_) < 0) { return -1; } return 1; } else if (readable == -1) { return -1; } nowTs = getNewTimestamp(); } } int Channel::handleDrain(int limit, int timeout) { #ifdef TEST *logofs << "handleDrain: Going to drain FD#" << fd_ << " with a limit of " << limit << " bytes " << "at " << strMsTimestamp() << ".\n" << logofs_flush; #endif T_timestamp startTs = getNewTimestamp(); T_timestamp nowTs = startTs; int drained; int remaining; int result; for (;;) { remaining = timeout - diffTimestamp(startTs, nowTs); if (remaining <= 0) { #ifdef TEST *logofs << "handleDrain: Timeout raised while draining " << "FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif result = 0; goto ChannelDrainEnd; } #ifdef TEST *logofs << "handleDrain: Trying to write to FD#" << fd_ << " with " << remaining << " ms " << "remaining.\n" << logofs_flush; #endif drained = transport_ -> drain(limit, remaining); if (drained == 1) { #ifdef TEST *logofs << "handleDrain: Transport for FD#" << fd_ << " drained to " << transport_ -> length() << " bytes at " << strMsTimestamp() << ".\n" << logofs_flush; #endif result = 1; goto ChannelDrainEnd; } else if (drained == 0 && transport_ -> readable() > 0) { #ifdef TEST *logofs << "handleDrain: WARNING! Encoding more data " << "for FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif if (proxy -> handleAsyncRead(fd_) < 0) { goto ChannelDrainError; } } else if (drained == -1) { goto ChannelDrainError; } nowTs = getNewTimestamp(); if (diffTimestamp(startTs, nowTs) >= control -> ChannelTimeout) { int seconds = (remaining + control -> LatencyTimeout * 10) / 1000; #ifdef WARNING *logofs << "handleDrain: WARNING! Could not drain FD#" << fd_ << " within " << seconds << " seconds.\n" << logofs_flush; #endif cerr << "Warning" << ": Can't write to connection on FD#" << fd_ << " since " << seconds << " seconds.\n"; if (alert_ == 0) { if (control -> ProxyMode == proxy_client) { alert_ = CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT; } else { alert_ = CLOSE_DEAD_X_CONNECTION_SERVER_ALERT; } HandleAlert(alert_, 1); } } } ChannelDrainEnd: // // Maybe we drained the channel and are // now out of the congestion state. // handleCongestion(); return result; ChannelDrainError: finish_ = 1; return -1; } int Channel::handleCongestion() { // // Send a begin congestion control code // if the local end of the channel does // not consume its data. // if (isCongested() == 1) { if (congestion_ == 0) { #if defined(TEST) || defined(INFO) *logofs << "handleCongestion: Sending congestion for FD#" << fd_ << " with length " << transport_ -> length() << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif congestion_ = 1; // // Use the callback to send the control // code immediately. // if (proxy -> handleAsyncCongestion(fd_) < 0) { finish_ = 1; return -1; } } } else { // // If the channel was in congestion state // send an end congestion control code. // if (congestion_ == 1) { #if defined(TEST) || defined(INFO) *logofs << "handleCongestion: Sending decongestion for FD#" << fd_ << " with length " << transport_ -> length() << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif congestion_ = 0; if (proxy -> handleAsyncDecongestion(fd_) < 0) { finish_ = 1; return -1; } } // // Remove the "channel unresponsive" // dialog. // if (alert_ != 0) { #if defined(TEST) || defined(INFO) *logofs << "handleCongestion: Displacing the dialog " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif HandleAlert(DISPLACE_MESSAGE_ALERT, 1); } } return 1; } int Channel::handleFlush(T_flush type, int bufferLength, int scratchLength) { if (finish_ == 1) { #ifdef TEST *logofs << "handleFlush: Not flushing data for " << "finishing channel for FD#" << fd_ << ".\n" << logofs_flush; #endif writeBuffer_.fullReset(); return -1; } #ifdef TEST *logofs << "handleFlush: Flushing " << bufferLength << " + " << scratchLength << " bytes " << "to FD#" << fd_ << ".\n" << logofs_flush; #endif // // Check if the channel has data available. // Recent Linux kernels are very picky. // They require that we read often or they // assume that the process is non-interact- // ive. // int result = 0; if (handleAsyncEvents() < 0) { goto ChannelFlushError; } // // Write the data in the main buffer first, // followed by the data in the scratch buffer. // if (bufferLength > 0) { result = transport_ -> write(write_immediate, writeBuffer_.getData(), bufferLength); } if (result >= 0 && scratchLength > 0) { result = transport_ -> write(write_immediate, writeBuffer_.getScratchData(), scratchLength); } if (type == flush_if_any) { writeBuffer_.fullReset(); } else { writeBuffer_.partialReset(); } // // If we failed to write to the X connection then // set the finish flag. The caller should continue // to handle all the remaining messages or it will // corrupt the decode buffer. At the real end, an // error will be propagated to the upper layers // which will perform any needed cleanup. // if (result < 0) { goto ChannelFlushError; } // // Reset transport buffers. // transport_ -> partialReset(); // // Check if the X server has generated // any event in response to our data. // if (handleAsyncEvents() < 0) { goto ChannelFlushError; } // // Check if the channel has entered in // congestion state and, in this case, // send an immediate congestion control // code to the remote. // handleCongestion(); // // We could optionally drain the output // buffer if this is X11 channel. // // if (isCongested() == 1 && isReliable() == 1) // { // if (handleDrain(0, control -> ChannelTimeout) < 0) // { // goto ChannelFlushError; // } // } // return 1; ChannelFlushError: finish_ = 1; return -1; } int Channel::handleFlush() { #ifdef TEST *logofs << "handleFlush: Flushing " << transport_ -> length() << " bytes to FD#" << fd_ << " with descriptor writable.\n" << logofs_flush; #endif // // Check if there is anything to read // before anf after having written to // the socket. // if (handleAsyncEvents() < 0) { goto ChannelFlushError; } if (transport_ -> flush() < 0) { #ifdef TEST *logofs << "handleFlush: Failure detected " << "flushing data to FD#" << fd_ << ".\n" << logofs_flush; #endif goto ChannelFlushError; } if (handleAsyncEvents() < 0) { goto ChannelFlushError; } // // Reset channel's transport buffers. // transport_ -> partialReset(); // // Check if the channel went out of the // congestion state. // handleCongestion(); return 1; ChannelFlushError: finish_ = 1; return -1; } void Channel::handleResetAlert() { if (alert_ != 0) { #ifdef TEST *logofs << "handleResetAlert: The channel alert '" << alert_ << "' was displaced.\n" << logofs_flush; #endif alert_ = 0; } } int Channel::handleCompress(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned int offset, const unsigned char *buffer, const unsigned int size, unsigned char *&compressedData, unsigned int &compressedDataSize) { if (size <= offset) { #ifdef DEBUG *logofs << "handleCompress: Not compressing data for FD#" << fd_ << " as offset is " << offset << " with data size " << size << ".\n" << logofs_flush; #endif return 0; } #ifdef DEBUG *logofs << "handleCompress: Compressing data for FD#" << fd_ << " with data size " << size << " and offset " << offset << ".\n" << logofs_flush; #endif // // It is responsibility of the compressor to // mark the buffer as such if the compression // couldn't take place. // if (compressor_ -> compressBuffer(buffer + offset, size - offset, compressedData, compressedDataSize, encodeBuffer) <= 0) { #ifdef DEBUG *logofs << "handleCompress: Sent " << size - offset << " bytes of plain data for FD#" << fd_ << ".\n" << logofs_flush; #endif return 0; } else { #ifdef DEBUG *logofs << "handleCompress: Sent " << compressedDataSize << " bytes of compressed data for FD#" << fd_ << ".\n" << logofs_flush; #endif return 1; } } int Channel::handleDecompress(DecodeBuffer &decodeBuffer, const unsigned char opcode, const unsigned int offset, unsigned char *buffer, const unsigned int size, const unsigned char *&compressedData, unsigned int &compressedDataSize) { if (size <= offset) { return 0; } int result = compressor_ -> decompressBuffer(buffer + offset, size - offset, compressedData, compressedDataSize, decodeBuffer); if (result < 0) { #ifdef PANIC *logofs << "handleDecompress: PANIC! Failed to decompress " << size - offset << " bytes of data for FD#" << fd_ << " with OPCODE#" << (unsigned int) opcode << ".\n" << logofs_flush; #endif cerr << "Error" << ": Data decompression failed for OPCODE#" << (unsigned int) opcode << ".\n"; return -1; } else if (result == 0) { #ifdef DEBUG *logofs << "handleDecompress: Received " << size - offset << " bytes of plain data for FD#" << fd_ << ".\n" << logofs_flush; #endif return 0; } else { #ifdef DEBUG *logofs << "handleDecompress: Received " << compressedDataSize << " bytes of compressed data for FD#" << fd_ << ".\n" << logofs_flush; #endif return 1; } } int Channel::handleCleanAndNullRequest(unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { #ifdef TEST *logofs << "handleCleanAndNullRequest: Removing the previous data " << "and sending an X_NoOperation " << "for FD#" << fd_ << " due to OPCODE#" << (unsigned int) opcode << " (" << DumpOpcode(opcode) << ").\n" << logofs_flush; #endif writeBuffer_.removeMessage(size - 4); size = 4; opcode = X_NoOperation; return 1; } int Channel::handleNullRequest(unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { #ifdef TEST *logofs << "handleNullRequest: Sending an X_NoOperation for FD#" << fd_ << " due to OPCODE#" << (unsigned int) opcode << " (" << DumpOpcode(opcode) << ").\n" << logofs_flush; #endif size = 4; buffer = writeBuffer_.addMessage(size); opcode = X_NoOperation; return 1; } void Channel::handleSplitStoreError(int resource) { if (resource < 0 || resource >= CONNECTIONS_LIMIT) { #ifdef PANIC *logofs << "handleSplitStoreError: PANIC! Resource " << resource << " is out of range with limit " << "set to " << CONNECTIONS_LIMIT << ".\n" << logofs_flush; #endif cerr << "Error" << ": Resource " << resource << " is out of range with limit set to " << CONNECTIONS_LIMIT << ".\n"; HandleCleanup(); } else { #ifdef PANIC *logofs << "handleSplitStoreError: PANIC! Cannot " << "allocate the split store for resource " << resource << ".\n" << logofs_flush; #endif cerr << "Error" << ": Cannot allocate the " << "split store for resource " << resource << ".\n"; HandleCleanup(); } } void Channel::handleSplitStoreAlloc(List *list, int resource) { if (resource < 0 || resource >= CONNECTIONS_LIMIT) { handleSplitStoreError(resource); } if (clientStore_ -> getSplitStore(resource) == NULL) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitStoreAlloc: Allocating a new " << "split store for resource " << resource << ".\n" << logofs_flush; #endif SplitStore *splitStore = clientStore_ -> createSplitStore(resource); if (splitStore == NULL) { handleSplitStoreError(resource); } list -> add(resource); } #if defined(TEST) || defined(SPLIT) else { // // Old proxy versions only use a single // split store. // if (resource != 0) { *logofs << "handleSplitStoreAlloc: WARNING! A split " << "store for resource " << resource << " already exists.\n" << logofs_flush; } } #endif } void Channel::handleSplitStoreRemove(List *list, int resource) { if (resource < 0 || resource >= CONNECTIONS_LIMIT) { handleSplitStoreError(resource); } SplitStore *splitStore = clientStore_ -> getSplitStore(resource); if (splitStore != NULL) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitStoreRemove: Deleting the " << "split store for resource " << resource << ".\n" << logofs_flush; #endif clientStore_ -> destroySplitStore(resource); #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitStoreRemove: Deleting resource " << resource << " from the list " << ".\n" << logofs_flush; #endif list -> remove(resource); } #if defined(TEST) || defined(SPLIT) else { *logofs << "handleSplitStoreRemove: WARNING! A split " << "store for resource " << resource << " does not exist.\n" << logofs_flush; } #endif } Split *Channel::handleSplitCommitRemove(int request, int resource, int position) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitCommitRemove: SPLIT! Checking split " << "commit with resource " << resource << " request " << request << " and position " << position << ".\n" << logofs_flush; #endif // // Remove the split from the split queue. // CommitStore *commitStore = clientStore_ -> getCommitStore(); Split *split = commitStore -> pop(); if (split == NULL) { #ifdef PANIC *logofs << "handleSplitCommitRemove: PANIC! Can't " << "find the split in the commit queue.\n" << logofs_flush; #endif cerr << "Error" << ": Can't find the " << "split in the commit queue.\n"; HandleCleanup(); } #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitCommitRemove: SPLIT! Element from " << "the queue has resource " << split -> getResource() << " request " << split -> getRequest() << " and " << "position " << split -> getPosition() << ".\n" << logofs_flush; #endif // Since ProtoStep7 (#issue 108) if (resource != split -> getResource() || request != split -> getRequest() || position != split -> getPosition()) { #ifdef PANIC *logofs << "handleSplitCommitRemove: PANIC! The data in " << "the split doesn't match the commit request.\n" << logofs_flush; #endif cerr << "Error" << ": The data in the split doesn't " << "match the commit request.\n"; return NULL; } #if defined(TEST) || defined(SPLIT) commitStore -> dump(); #endif return split; } int Channel::setReferences() { #ifdef TEST *logofs << "Channel: Initializing the static " << "members for the base class.\n" << logofs_flush; #endif firstClient_ = -1; fontPort_ = -1; #ifdef REFERENCES references_ = 0; #endif return 1; } int Channel::setOpcodes(OpcodeStore *opcodeStore) { opcodeStore_ = opcodeStore; #ifdef TEST *logofs << "setOpcodes: Propagated opcodes store to channel " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif return 1; } int Channel::setStores(ClientStore *clientStore, ServerStore *serverStore) { clientStore_ = clientStore; serverStore_ = serverStore; #ifdef TEST *logofs << "setStores: Propagated message stores to channel " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif return 1; } int Channel::setCaches(ClientCache *clientCache, ServerCache *serverCache) { clientCache_ = clientCache; serverCache_ = serverCache; #ifdef TEST *logofs << "setCaches: Propagated encode caches to channel " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif return 1; } nx-libs-3.5.99.23/nxcomp/src/ChannelEndPoint.cpp0000644000000000000000000002014113614532331016115 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "ChannelEndPoint.h" #include "NXalert.h" #include "Misc.h" ChannelEndPoint::ChannelEndPoint(const char *spec) : defaultTCPPort_(0), defaultTCPInterface_(0), defaultUnixPath_(NULL), spec_(NULL) { setSpec(spec); } ChannelEndPoint::~ChannelEndPoint() { char *unixPath = NULL; if (getUnixPath(&unixPath)) { struct stat st; lstat(unixPath, &st); if(S_ISSOCK(st.st_mode)) unlink(unixPath); } SAFE_FREE(unixPath); SAFE_FREE(defaultUnixPath_); SAFE_FREE(spec_); } void ChannelEndPoint::setSpec(const char *spec) { SAFE_FREE(spec_); if (spec && strlen(spec)) { spec_ = strdup(spec); isUnix_ = getUnixPath(); isTCP_ = getTCPHostAndPort(); } else { spec_ = NULL; isUnix_ = false; isTCP_ = false; } } void ChannelEndPoint::setSpec(long port) { if (port >= 0) { char tmp[20]; sprintf(tmp, "%ld", port); setSpec(tmp); } else { disable(); } } void ChannelEndPoint::setSpec(const char *hostName, long port) { int length; isUnix_ = false; isTCP_ = false; SAFE_FREE(spec_); if (hostName && strlen(hostName) && port >= 1) { length = snprintf(NULL, 0, "tcp:%s:%ld", hostName, port); spec_ = static_cast(calloc(length + 1, sizeof(char))); snprintf(spec_, length+1, "tcp:%s:%ld", hostName, port); isTCP_ = true; } else setSpec(static_cast(NULL)); } bool ChannelEndPoint::getSpec(char **socketUri) const { if (socketUri) { *socketUri = NULL; } else { return false; } char *unixPath = NULL; char *hostName = NULL; long port = -1; int length = -1; if (getUnixPath(&unixPath)) { length = snprintf(NULL, 0, "unix:%s", unixPath); } else if (getTCPHostAndPort(&hostName, &port)) { length = snprintf(NULL, 0, "tcp:%s:%ld", hostName, port); } if (length > 0) { char *newSocketUri = static_cast(calloc(length + 1, sizeof(char))); if (newSocketUri) { if (isUnixSocket()) snprintf(newSocketUri, length+1, "unix:%s", unixPath); else snprintf(newSocketUri, length+1, "tcp:%s:%ld", hostName, port); *socketUri = strdup(newSocketUri); SAFE_FREE(newSocketUri); } } SAFE_FREE(unixPath); SAFE_FREE(hostName); if (NULL != *socketUri) return true; return false; } void ChannelEndPoint::setDefaultTCPPort(long port) { defaultTCPPort_ = port; isTCP_ = getTCPHostAndPort(); } void ChannelEndPoint::setDefaultTCPInterface(int publicInterface) { defaultTCPInterface_ = publicInterface; } void ChannelEndPoint::setDefaultUnixPath(char *path) { SAFE_FREE(defaultUnixPath_); if (path && strlen(path)) defaultUnixPath_ = strdup(path); isUnix_ = getUnixPath(); } void ChannelEndPoint::disable() { setSpec("0"); } bool ChannelEndPoint::getPort(long *port) const { if (port) *port = 0; long p = -1; if (spec_) { char *end; p = strtol(spec_, &end, 10); if ((end == spec_) || (*end != '\0')) return false; } if (port) *port = p; return true; } bool ChannelEndPoint::getUnixPath(char **unixPath) const { if (unixPath) *unixPath = NULL; long p; char *path = NULL; if (getPort(&p)) { if (p != 1) return false; } else if (spec_ && (strncmp("unix:", spec_, 5) == 0)) { path = spec_ + 5; } else return false; if (!path || (*path == '\0')) { path = defaultUnixPath_; if (!path) return false; } // Only return value wanted if ( unixPath ) *unixPath = strdup(path); return true; } bool ChannelEndPoint::isUnixSocket() const { return isUnix_; } // FIXME!!! static const char * getComputerName() { // // Strangely enough, under some Windows OSes SMB // service doesn't bind to localhost. Fall back // to localhost if can't find computer name in // the environment. In future we should try to // bind to localhost and then try the other IPs. // const char *hostname = NULL; #ifdef __CYGWIN32__ hostname = getenv("COMPUTERNAME"); #endif if (hostname == NULL) { hostname = "localhost"; } return hostname; } bool ChannelEndPoint::getTCPHostAndPort(char **host, long *port) const { long p; char *h = NULL; ssize_t h_len; if (host) *host = NULL; if (port) *port = 0; if (getPort(&p)) { h_len = 0; } else if (spec_ && (strncmp("tcp:", spec_, 4) == 0)) { h = spec_ + 4; char *colon = strrchr(h, ':'); if (colon) { char *end; h_len = colon++ - h; p = strtol(colon, &end, 10); if ((end == colon) || (*end != '\0')) return false; } else { h_len = strlen(h); p = 1; } } else return false; if (p == 1) p = defaultTCPPort_; if (p < 1) return false; if (port) *port = p; if (host) *host = ( h_len ? strndup(h, h_len) : strdup(defaultTCPInterface_ ? getComputerName() : "localhost")); return true; } bool ChannelEndPoint::isTCPSocket() const { return isTCP_; } long ChannelEndPoint::getTCPPort() const { long port; if (getTCPHostAndPort(NULL, &port)) return port; return -1; } bool ChannelEndPoint::enabled() const { return (isUnixSocket() || isTCPSocket()); } bool ChannelEndPoint::configured() const { return ( spec_ && ( strcmp(spec_, "0") != 0) ); } bool ChannelEndPoint::validateSpec() { isTCP_ = getTCPHostAndPort(); isUnix_ = getUnixPath(); return ( getPort() || isUnix_ || isTCP_ ); } ChannelEndPoint &ChannelEndPoint::operator=(const ChannelEndPoint &other) { char *old; defaultTCPPort_ = other.defaultTCPPort_; defaultTCPInterface_ = other.defaultTCPInterface_; old = defaultUnixPath_; defaultUnixPath_ = (other.defaultUnixPath_ ? strdup(other.defaultUnixPath_) : NULL); SAFE_FREE(old); old = spec_; spec_ = (other.spec_ ? strdup(other.spec_) : NULL); SAFE_FREE(old); isUnix_ = getUnixPath(); isTCP_ = getTCPHostAndPort(); return *this; } std::ostream& operator<<(std::ostream& os, const ChannelEndPoint& endPoint) { if (endPoint.enabled()) { char* endPointSpec = NULL; if (endPoint.getSpec(&endPointSpec)) { os << endPointSpec; SAFE_FREE(endPointSpec); } else os << "(invalid)"; } else { os << "(disabled)"; } return os; } nx-libs-3.5.99.23/nxcomp/src/ChannelEndPoint.h0000644000000000000000000000573513614532331015576 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ChannelEndPoint_H #define ChannelEndPoint_H #include #include class ChannelEndPoint { private: long defaultTCPPort_; int defaultTCPInterface_; // 0=localhost, otherwise IP of public interface. char *defaultUnixPath_; char *spec_; bool isUnix_; bool isTCP_; bool getPort(long *port = NULL) const; public: ChannelEndPoint(const char *spec = NULL); ~ChannelEndPoint(); ChannelEndPoint &operator=(const ChannelEndPoint &other); bool configured() const; bool enabled() const; bool disabled() { return !enabled(); } void disable(); void setSpec(const char *spec); void setSpec(long port); void setSpec(const char *hostName, long port); bool getSpec(char **socketUri) const; void setDefaultTCPPort(long port); void setDefaultTCPInterface(int publicInterface); void setDefaultUnixPath(char *path); bool getUnixPath(char **path = NULL) const; bool isUnixSocket() const; bool getTCPHostAndPort(char **hostname = NULL, long *port = NULL) const; long getTCPPort() const; bool isTCPSocket() const; bool validateSpec(); }; std::ostream& operator<<(std::ostream& os, const ChannelEndPoint& endPoint); #endif nx-libs-3.5.99.23/nxcomp/src/Channel.h0000644000000000000000000004055613614532331014135 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Channel_H #define Channel_H #include "Transport.h" #include "WriteBuffer.h" #include "OpcodeStore.h" #include "ClientStore.h" #include "ServerStore.h" #include "ClientCache.h" #include "ServerCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Forward declaration of referenced classes. // class List; class StaticCompressor; // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Define this to log a line when a channel // is created or destroyed. // #undef REFERENCES // // Type of traffic carried by channel. // typedef enum { channel_none = -1, channel_x11, channel_cups, channel_smb, channel_media, channel_http, channel_font, channel_slave, channel_last_tag } T_channel_type; // // Type of notification event to be sent // by proxy to the X channel. // typedef enum { notify_no_split, notify_start_split, notify_commit_split, notify_end_split, notify_empty_split, } T_notification_type; class Channel { public: // // Maximum number of X connections supported. // static const int CONNECTIONS_LIMIT = 256; Channel(Transport *transport, StaticCompressor *compressor); virtual ~Channel(); // // Read any X message available on the X // connection and encode it to the encode // buffer. // virtual int handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, unsigned int length) = 0; // // Decode any X message encoded in the // proxy message and write it to the X // connection. // virtual int handleWrite(const unsigned char *message, unsigned int length) = 0; // // Other methods to be implemented in // client, server and generic channel // classes. // virtual int handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, T_store_action action, int position, const unsigned char opcode, const unsigned char *buffer, const unsigned int size) = 0; virtual int handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, T_store_action action, int position, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) = 0; virtual int handleSplit(EncodeBuffer &encodeBuffer) = 0; virtual int handleSplit(DecodeBuffer &decodeBuffer) = 0; virtual int handleSplitEvent(EncodeBuffer &encodeBuffer, Split *split) = 0; virtual int handleSplitEvent(DecodeBuffer &decodeBuffer) = 0; virtual int handleMotion(EncodeBuffer &encodeBuffer) = 0; virtual int handleCompletion(EncodeBuffer &encodeBuffer) = 0; virtual int handleConfiguration() = 0; virtual int handleFinish() = 0; // // Interleave reads of the available // events while writing data to the // channel socket. // virtual int handleAsyncEvents() = 0; // // Handle the channel tear down. // int handleClosing() { closing_ = 1; return 1; } int handleDrop() { drop_ = 1; return 1; } // // Try to read more data from the socket. In // the meanwhile flush any enqueued data if // the channel is blocked. Return as soon as // more data has been read or the timeout has // been exceeded. // int handleWait(int timeout); // // Drain the output buffer while handling the // data that may become readable. // int handleDrain(int timeout, int limit); // // Flush any remaining data in the transport // buffer. // int handleFlush(); // // Called when the loop has replaced or // closed a previous alert. // void handleResetAlert(); // // Initialize all the static members. // static int setReferences(); // // Set pointer to object mapping opcodes // of NX specific messages. // int setOpcodes(OpcodeStore *opcodeStore); // // Update pointers to message stores in // channels. // int setStores(ClientStore *clientStore, ServerStore *serverStore); // // The same for channels caches. // int setCaches(ClientCache *clientCache, ServerCache *serverCache); // // Set the port used for tunneling of the // font server connections. // void setPorts(int fontPort) { fontPort_ = fontPort; } // // Check if there are pending split // to send to the remote side. // virtual int needSplit() const = 0; // // Check if there are motion events // to flush. // virtual int needMotion() const = 0; // // Return the type of traffic carried // by this channel. // virtual T_channel_type getType() const = 0; // // Check if the channel has been marked // as closing down. // int getFinish() const { return finish_; } int getClosing() { return closing_; } int getDrop() { return drop_; } int getCongestion() { return congestion_; } protected: int handleFlush(T_flush type) { // // We could write the data immediately if there // is already something queued to the low level // TCP buffers. // // if (... || transport_ -> queued() > 0) // { // ... // } // if (writeBuffer_.getScratchLength() > 0 || (type == flush_if_any && writeBuffer_.getLength() > 0) || writeBuffer_.getLength() >= (unsigned int) control -> TransportFlushBufferSize) { return handleFlush(type, writeBuffer_.getLength(), writeBuffer_.getScratchLength()); } return 0; } // // Actually flush the data to the // channel descriptor. // int handleFlush(T_flush type, int bufferLength, int scratchLength); // // Handle the congestion changes. // int handleCongestion(); // // Encode and decode X messages. // int handleEncode(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, MessageStore *store, const unsigned char opcode, const unsigned char *buffer, const unsigned int size); int handleDecode(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, MessageStore *store, unsigned char &opcode, unsigned char *&buffer, unsigned int &size); // // Encode the message based on its // message store. // int handleEncodeCached(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, MessageStore *store, const unsigned char *buffer, const unsigned int size); int handleDecodeCached(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, MessageStore *store, unsigned char *&buffer, unsigned int &size); int handleEncodeIdentity(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, MessageStore *store, const unsigned char *buffer, const unsigned int size, int bigEndian) { return (store -> encodeIdentity(encodeBuffer, buffer, size, bigEndian, channelCache)); } int handleDecodeIdentity(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, MessageStore *store, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer) { return (store -> decodeIdentity(decodeBuffer, buffer, size, bigEndian, writeBuffer, channelCache)); } // // Other utility functions used by // the encoding and decoding methods. // void handleCopy(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned int offset, const unsigned char *buffer, const unsigned int size) { if (size > offset) { encodeBuffer.encodeMemory(buffer + offset, size - offset); } } void handleCopy(DecodeBuffer &decodeBuffer, const unsigned char opcode, const unsigned int offset, unsigned char *buffer, const unsigned int size) { if (size > offset) { memcpy(buffer + offset, decodeBuffer.decodeMemory(size - offset), size - offset); } } void handleUpdate(MessageStore *store, const unsigned int dataSize, const unsigned int compressedDataSize) { if (store -> lastAction == IS_ADDED) { handleUpdateAdded(store, dataSize, compressedDataSize); } } void handleSave(MessageStore *store, unsigned char *buffer, unsigned int size, const unsigned char *compressedData = NULL, const unsigned int compressedDataSize = 0) { if (store -> lastAction == IS_ADDED) { handleSaveAdded(store, 0, buffer, size, compressedData, compressedDataSize); } } void handleSaveSplit(MessageStore *store, unsigned char *buffer, unsigned int size) { if (store -> lastAction == IS_ADDED) { return handleSaveAdded(store, 1, buffer, size, 0, 0); } } void handleUpdateAdded(MessageStore *store, const unsigned int dataSize, const unsigned int compressedDataSize); void handleSaveAdded(MessageStore *store, int split, unsigned char *buffer, unsigned int size, const unsigned char *compressedData, const unsigned int compressedDataSize); // // Compress the data part of a message // using ZLIB or another compressor // and send it over the network. // int handleCompress(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned int offset, const unsigned char *buffer, const unsigned int size, unsigned char *&compressedData, unsigned int &compressedDataSize); int handleDecompress(DecodeBuffer &decodeBuffer, const unsigned char opcode, const unsigned int offset, unsigned char *buffer, const unsigned int size, const unsigned char *&compressedData, unsigned int &compressedDataSize); // // Send an X_NoOperation to the X server. // The second version also removes any // previous data in the write buffer. // int handleNullRequest(unsigned char &opcode, unsigned char *&buffer, unsigned int &size); int handleCleanAndNullRequest(unsigned char &opcode, unsigned char *&buffer, unsigned int &size); // // X11 channels are considered to be in // congestion state when there was a // blocking write and, since then, the // local end didn't consume all the data. // virtual int isCongested() { return (transport_ -> getType() != transport_agent && transport_ -> length() > control -> TransportFlushBufferSize); } virtual int isReliable() { return 1; } // // Determine how to handle allocation // of new messages in the message // stores. // int mustCleanStore(MessageStore *store) { return (store -> getRemoteTotalStorageSize() > control -> RemoteTotalStorageSize || store -> getLocalTotalStorageSize() > control -> LocalTotalStorageSize || (store -> getRemoteStorageSize() > (control -> RemoteTotalStorageSize / 100 * store -> cacheThreshold)) || (store -> getLocalStorageSize() > (control -> LocalTotalStorageSize / 100 * store -> cacheThreshold))); } int canCleanStore(MessageStore *store) { return ((store -> getSize() > 0 && (store -> getRemoteStorageSize() > (control -> RemoteTotalStorageSize / 100 * store -> cacheLowerThreshold))) || (store -> getLocalStorageSize() > (control -> LocalTotalStorageSize / 100 * store -> cacheLowerThreshold))); } protected: // // Set up the split stores. // void handleSplitStoreError(int resource) __attribute__((noreturn)); void handleSplitStoreAlloc(List *list, int resource); void handleSplitStoreRemove(List *list, int resource); Split *handleSplitCommitRemove(int request, int resource, int position); void validateSize(const char *name, int input, int output, int offset, int size) { if (size < offset || size > control -> MaximumMessageSize || size != (int) RoundUp4(input) + offset || output > control -> MaximumMessageSize) { *logofs << "Channel: PANIC! Invalid size " << size << " for " << name << " output with data " << input << "/" << output << "/" << offset << "/" << size << ".\n" << logofs_flush; cerr << "Error" << ": Invalid size " << size << " for " << name << " output.\n"; HandleAbort(); } } // // Is the X client big endian? // int bigEndian() const { return bigEndian_; } int bigEndian_; // // Other X server's features // saved at session startup. // unsigned int imageByteOrder_; unsigned int bitmapBitOrder_; unsigned int scanlineUnit_; unsigned int scanlinePad_; int firstRequest_; int firstReply_; // // Use this class for IO operations. // Transport *transport_; // // The static compressor is created by the // proxy and shared among channels. // StaticCompressor *compressor_; // // Map NX operations to opcodes. Propagated // by proxy to all channels on the same X // server. // OpcodeStore *opcodeStore_; // // Also stores are shared between channels. // ClientStore *clientStore_; ServerStore *serverStore_; // // Caches are specific for each channel. // ClientCache *clientCache_; ServerCache *serverCache_; // // Data going to X connection. // WriteBuffer writeBuffer_; // // Other data members. // int fd_; int finish_; int closing_; int drop_; int congestion_; int priority_; int alert_; // // It will be set to the descriptor of the // first X channel that is successfully con- // nected and will print an info message on // standard error. // static int firstClient_; // // Port used for font server connections. // static int fontPort_; // // Track which cache operations have been // enabled by the agent. // int enableCache_; int enableSplit_; int enableSave_; int enableLoad_; // // Keep track of object creation and // deletion. // #ifdef REFERENCES static int references_; #endif }; #endif /* Channel_H */ nx-libs-3.5.99.23/nxcomp/src/ChannelStore.h0000644000000000000000000000423413614532331015143 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ChannelStore_H #define ChannelStore_H // // One message store for each opcode. // #define CHANNEL_STORE_OPCODE_LIMIT 256 // // One split store for each resource. // #define CHANNEL_STORE_RESOURCE_LIMIT 256 class ChannelStore { public: ChannelStore() { } virtual ~ChannelStore() { } }; #endif /* ChannelStore_H */ nx-libs-3.5.99.23/nxcomp/src/CharCache.cpp0000644000000000000000000000530213614532331014707 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "CharCache.h" int CharCache::lookup(unsigned char value, unsigned int &index) { for (unsigned int i = 0; i < length_; i++) if (value == buffer_[i]) { index = i; if (i) { unsigned int target = (i >> 1); do { buffer_[i] = buffer_[i - 1]; i--; } while (i > target); buffer_[target] = value; } return 1; } insert(value); return 0; } void CharCache::insert(unsigned char value) { unsigned int insertionPoint = 0; if (2 >= length_) insertionPoint = length_; else insertionPoint = 2; unsigned int start; if (length_ >= 7) start = 7 - 1; else { start = length_; length_++; } for (unsigned int k = start; k > insertionPoint; k--) buffer_[k] = buffer_[k - 1]; buffer_[insertionPoint] = value; } nx-libs-3.5.99.23/nxcomp/src/CharCache.h0000644000000000000000000000540713614532331014362 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef CharCache_H #define CharCache_H // // CharCache is a counterpart of IntCache that is // optimized for use in compressing text composed // of 8-bit characters. // class CharCache { public: CharCache() : length_(0) { } ~CharCache() { } unsigned int getSize() const { return (unsigned int) length_; } int lookup(unsigned char value, unsigned int &index); // // This can be inlined as it is only // called by decodeCachedValue(). // unsigned int get(unsigned int index) { unsigned char result = buffer_[index]; if (index != 0) { unsigned int i = index; unsigned int target = (i >> 1); do { buffer_[i] = buffer_[i - 1]; i--; } while (i > target); buffer_[target] = result; } return (unsigned int) result; } void insert(unsigned char value); private: unsigned char length_; unsigned char buffer_[7]; }; #endif /* CharCache_H */ nx-libs-3.5.99.23/nxcomp/src/Children.cpp0000644000000000000000000005350313614532331014644 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "NX.h" #include "Misc.h" #include "Types.h" #include "Timestamp.h" #include "Control.h" #include "Statistics.h" #include "Proxy.h" #include "Keeper.h" #include "Fork.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #define DISPLAY_LENGTH_LIMIT 256 #define DEFAULT_STRING_LIMIT 512 // // These are from the main loop. // extern Keeper *keeper; extern int (*signalHandler)(int); extern int useUnixSocket; extern int lastDialog; extern int lastWatchdog; extern int lastKeeper; extern void CleanupListeners(); extern void CleanupSockets(); extern void CleanupAgent(); extern void CleanupGlobal(); extern void InstallSignals(); extern char *GetClientPath(); extern int CheckParent(const char *name, const char *type, int parent); #ifdef __sun extern char **environ; #endif // // Close all the unused descriptors and // install any signal handler that might // have been disabled in the main process. // static void SystemCleanup(const char *name); // // Release all objects allocated in the // heap. static void MemoryCleanup(const char *name); // // Remove 'name' from the environment. // static int UnsetEnv(const char *name); static int NXTransKeeperHandler(int signal); static void NXTransKeeperCheck(); // // Start a nxclient process in dialog mode. // int NXTransDialog(const char *caption, const char *message, const char *window, const char *type, int local, const char* display) { // // Be sure log file is valid. // if (logofs == NULL) { logofs = &cerr; } int pid; #ifdef TEST *logofs << "NXTransDialog: Going to fork with NX pid '" << getpid() << "'.\n" << logofs_flush; #endif pid = Fork(); if (pid != 0) { if (pid < 0) { #ifdef TEST *logofs << "NXTransDialog: WARNING! Function fork failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Function fork failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n"; } #ifdef TEST else { *logofs << "NXTransDialog: Created NX dialog process " << "with pid '" << pid << "'.\n" << logofs_flush; } #endif return pid; } #ifdef TEST *logofs << "NXTransDialog: Executing child with pid '" << getpid() << "' and parent '" << getppid() << "'.\n" << logofs_flush; #endif SystemCleanup("NXTransDialog"); // // Copy the client command before // freeing up the control class. // char command[DEFAULT_STRING_LIMIT]; if (control != NULL) { strcpy(command, control -> ClientPath); } else { char *path = GetClientPath(); strcpy(command, path); delete [] path; } // // Get rid of the unused resources. // MemoryCleanup("NXTransDialog"); #ifdef TEST *logofs << "NXTransDialog: Running external NX dialog with caption '" << caption << "' message '" << message << "' type '" << type << "' local '" << local << "' display '" << display << "'.\n" << logofs_flush; #endif int pulldown = (strcmp(type, "pulldown") == 0); char parent[DEFAULT_STRING_LIMIT]; snprintf(parent, DEFAULT_STRING_LIMIT, "%d", getppid()); parent[DEFAULT_STRING_LIMIT - 1] = '\0'; UnsetEnv("LD_LIBRARY_PATH"); for (int i = 0; i < 2; i++) { if (local != 0) { if (pulldown) { execlp(command, command, "--dialog", type, "--caption", caption, "--window", window, "--local", "--parent", parent, "--display", display, NULL); } else { execlp(command, command, "--dialog", type, "--caption", caption, "--message", message, "--local", "--parent", parent, "--display", display, NULL); } } else { if (pulldown) { execlp(command, command, "--dialog", type, "--caption", caption, "--window", window, "--parent", parent, "--display", display, NULL); } else { execlp(command, command, "--dialog", type, "--caption", caption, "--message", message, "--parent", parent, "--display", display, NULL); } } #ifdef WARNING *logofs << "NXTransDialog: WARNING! Couldn't start '" << command << "'. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Couldn't start '" << command << "'. Error is " << EGET() << " '" << ESTR() << "'.\n"; // // Retry by looking for the default name // in the default NX path. // if (i == 0) { strcpy(command, "nxclient"); char newPath[DEFAULT_STRING_LIMIT]; strcpy(newPath, "/usr/NX/bin:/opt/NX/bin:/usr/local/NX/bin:"); #ifdef __APPLE__ // FIXME: missing length limitation! strcat(newPath, "/Applications/NX Client for OSX.app/Contents/MacOS:"); #endif #ifdef __CYGWIN32__ // FIXME: missing length limitation! strcat(newPath, ".:"); #endif int newLength = strlen(newPath); char *oldPath = getenv("PATH"); // FIXME: check if strncat would be better here snprintf(newPath + newLength, DEFAULT_STRING_LIMIT - newLength, "%s", oldPath); #ifdef WARNING *logofs << "NXTransDialog: WARNING! Trying with path '" << newPath << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Trying with path '" << newPath << "'.\n"; // // Solaris doesn't seem to have // function setenv(). // #ifdef __sun char newEnv[DEFAULT_STRING_LIMIT + 5]; sprintf(newEnv,"PATH=%s", newPath); putenv(newEnv); #else setenv("PATH", newPath, 1); #endif } } // // Hopefully useless. // exit(0); } // // Start a nxclient process in dialog mode. // int NXTransClient(const char* display) { // // Be sure log file is valid. // if (logofs == NULL) { logofs = &cerr; } int pid; #ifdef TEST *logofs << "NXTransClient: Going to fork with NX pid '" << getpid() << "'.\n" << logofs_flush; #endif pid = Fork(); if (pid != 0) { if (pid < 0) { #ifdef TEST *logofs << "NXTransClient: WARNING! Function fork failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Function fork failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n"; } #ifdef TEST else { *logofs << "NXTransClient: Created NX client process " << "with pid '" << pid << "'.\n" << logofs_flush; } #endif return pid; } #ifdef TEST *logofs << "NXTransClient: Executing child with pid '" << getpid() << "' and parent '" << getppid() << "'.\n" << logofs_flush; #endif SystemCleanup("NXTransClient"); // // Copy the client command before // freeing up the control class. // char command[DEFAULT_STRING_LIMIT]; if (control != NULL) { strcpy(command, control -> ClientPath); } else { char *path = GetClientPath(); strcpy(command, path); delete [] path; } // // Get rid of unused resources. // MemoryCleanup("NXTransClient"); #ifdef TEST *logofs << "NXTransClient: Running external NX client with display '" << display << "'.\n" << logofs_flush; #endif // // Provide the display in the environment. // char newDisplay[DISPLAY_LENGTH_LIMIT]; #ifdef __sun snprintf(newDisplay, DISPLAY_LENGTH_LIMIT, "DISPLAY=%s", display); putenv(newDisplay); #else snprintf(newDisplay, DISPLAY_LENGTH_LIMIT, "%s", display); setenv("DISPLAY", newDisplay, 1); #endif UnsetEnv("LD_LIBRARY_PATH"); for (int i = 0; i < 2; i++) { execlp(command, command, NULL); #ifdef WARNING *logofs << "NXTransClient: WARNING! Couldn't start '" << command << "'. Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Couldn't start '" << command << "'. Error is " << EGET() << " '" << ESTR() << "'.\n"; // // Retry by looking for the default name // in the default NX path. // if (i == 0) { // FIXME: code dpulication: this whole block is duplicated in NXTransDialog strcpy(command, "nxclient"); char newPath[DEFAULT_STRING_LIMIT]; strcpy(newPath, "/usr/NX/bin:/opt/NX/bin:/usr/local/NX/bin:"); #ifdef __APPLE__ strcat(newPath, "/Applications/NX Client for OSX.app/Contents/MacOS:"); #endif #ifdef __CYGWIN32__ strcat(newPath, ".:"); #endif int newLength = strlen(newPath); char *oldPath = getenv("PATH"); // FIXME: check if strncat would be better here snprintf(newPath + newLength, DEFAULT_STRING_LIMIT - newLength, "%s", oldPath); newPath[DEFAULT_STRING_LIMIT - 1] = '\0'; #ifdef WARNING *logofs << "NXTransClient: WARNING! Trying with path '" << newPath << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Trying with path '" << newPath << "'.\n"; // // Solaris doesn't seem to have // function setenv(). // #ifdef __sun char newEnv[DEFAULT_STRING_LIMIT + 5]; sprintf(newEnv,"PATH=%s", newPath); putenv(newEnv); #else setenv("PATH", newPath, 1); #endif } } // // Hopefully useless. // exit(0); } // // Wait until the timeout is expired. // The timeout is expressed in milli- // seconds. // int NXTransWatchdog(int timeout) { // // Be sure log file is valid. // if (logofs == NULL) { logofs = &cerr; } int pid; #ifdef TEST *logofs << "NXTransWatchdog: Going to fork with NX pid '" << getpid() << "'.\n" << logofs_flush; #endif pid = Fork(); if (pid != 0) { if (pid < 0) { #ifdef TEST *logofs << "NXTransWatchdog: WARNING! Function fork failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Function fork failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n"; } #ifdef TEST else { *logofs << "NXTransWatchdog: Created NX watchdog process " << "with pid '" << pid << "'.\n" << logofs_flush; } #endif return pid; } int parent = getppid(); #ifdef TEST *logofs << "NXTransWatchdog: Executing child with pid '" << getpid() << "' and parent '" << parent << "'.\n" << logofs_flush; #endif SystemCleanup("NXTransWatchdog"); // // Get rid of unused resources. // MemoryCleanup("NXTransWatchdog"); // // Run until the timeout is expired // or forever, if no timeout is // provided. // T_timestamp startTs = getTimestamp(); int diffTs = 0; for (;;) { // // Complain if the parent is dead. // if (CheckParent("NXTransWatchdog", "watchdog", parent) == 0) { #ifdef TEST *logofs << "NXTransWatchdog: Exiting with no parent " << "running.\n" << logofs_flush; #endif HandleCleanup(); } if (timeout > 0) { if (diffTs >= timeout) { #ifdef TEST *logofs << "NXTransWatchdog: Timeout of " << timeout << " ms raised in watchdog.\n" << logofs_flush; #endif // // We will just exit. Our parent should be // monitoring us and detect that the process // is gone. // HandleCleanup(); } } if (timeout > 0) { #ifdef TEST *logofs << "NXTransWatchdog: Waiting for the timeout " << "with " << timeout - diffTs << " ms to run.\n" << logofs_flush; #endif usleep((timeout - diffTs) * 1000); diffTs = diffTimestamp(startTs, getNewTimestamp()); } else { #ifdef TEST *logofs << "NXTransWatchdog: Waiting for a signal.\n" << logofs_flush; #endif sleep(10); } } // // Hopefully useless. // exit(0); } int NXTransKeeperHandler(int signal) { if (keeper != NULL) { switch (signal) { case SIGTERM: case SIGINT: case SIGHUP: { #ifdef TEST *logofs << "NXTransKeeperHandler: Requesting giveup " << "because of signal " << signal << " ,'" << DumpSignal(signal) << "'.\n" << logofs_flush; #endif keeper -> setSignal(signal); return 0; } } } return 1; } void NXTransKeeperCheck() { if (CheckParent("NXTransKeeper", "keeper", keeper -> getParent()) == 0 || keeper -> getSignal() != 0) { #ifdef TEST *logofs << "NXTransKeeperCheck: Exiting because of signal " << "or no parent running.\n" << logofs_flush; #endif HandleCleanup(); } } int NXTransKeeper(int caches, int images, const char *root) { // // Be sure log file is valid. // if (logofs == NULL) { logofs = &cerr; } if (caches == 0 && images == 0) { #ifdef TEST *logofs << "NXTransKeeper: No NX cache house-keeping needed.\n" << logofs_flush; #endif return 0; } int pid; #ifdef TEST *logofs << "NXTransKeeper: Going to fork with NX pid '" << getpid() << "'.\n" << logofs_flush; #endif pid = Fork(); if (pid != 0) { if (pid < 0) { #ifdef TEST *logofs << "NXTransKeeper: WARNING! Function fork failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Function fork failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n"; } #ifdef TEST else { *logofs << "NXTransKeeper: Created NX keeper process " << "with pid '" << pid << "'.\n" << logofs_flush; } #endif return pid; } int parent = getppid(); #ifdef TEST *logofs << "NXTransKeeper: Executing child with pid '" << getpid() << "' and parent '" << parent << "'.\n" << logofs_flush; #endif SystemCleanup("NXTransKeeper"); #ifdef TEST *logofs << "NXTransKeeper: Going to run with caches " << caches << " images " << images << " and root " << root << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif // // Create the house-keeper class. // int timeout = control -> KeeperTimeout; keeper = new Keeper(caches, images, root, 100, parent); signalHandler = NXTransKeeperHandler; if (keeper == NULL) { #ifdef PANIC *logofs << "NXTransKeeper: PANIC! Failed to create the keeper object.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to create the keeper object.\n"; HandleCleanup(); } // // Get rid of unused resources. Root path // must be copied in keeper's constructor // before control is deleted. // MemoryCleanup("NXTransKeeper"); // // Decrease the priority of this process. // // The following applies to Cygwin: "Cygwin processes can be // set to IDLE_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, HIGH_- // PRIORITY_CLASS, or REALTIME_PRIORITY_CLASS with the nice // call. If you pass a positive number to nice(), then the // priority level will decrease by one (within the above list // of priorities). A negative number would make it increase // by one. It is not possible to change it by more than one // at a time without making repeated calls". // if (nice(5) < 0 && errno != 0) { #ifdef WARNING *logofs << "NXTransKeeper: WARNING! Failed to renice process to +5. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Failed to renice process to +5. " << "Error is " << EGET() << " '" << ESTR() << "'.\n"; } // // Delay a bit the first run to give // a boost to the session startup. // #ifdef TEST *logofs << "NXTransKeeper: Going to sleep for " << timeout / 20 << " ms.\n" << logofs_flush; #endif usleep(timeout / 20 * 1000); NXTransKeeperCheck(); // // The house keeping of the persistent // caches is performed only once. // if (caches != 0) { #ifdef TEST *logofs << "NXTransKeeper: Going to cleanup the NX cache " << "directories at " << strMsTimestamp() << ".\n" << logofs_flush; #endif keeper -> cleanupCaches(); #ifdef TEST *logofs << "NXTransKeeper: Completed cleanup of NX cache " << "directories at " << strMsTimestamp() << ".\n" << logofs_flush; #endif } #ifdef TEST else { *logofs << "NXTransKeeper: Nothing to do for the " << "persistent caches.\n" << logofs_flush; } #endif if (images == 0) { #ifdef TEST *logofs << "NXTransKeeper: Nothing to do for the " << "persistent images.\n" << logofs_flush; #endif HandleCleanup(); } // // Take care of the persistent image cache. // Run a number of iterations and then exit, // so we can keep the memory consumption // low. The parent will check our exit code // and will eventually restart us. // for (int iterations = 0; iterations < 100; iterations++) { #ifdef TEST *logofs << "NXTransKeeper: Running iteration " << iterations << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif NXTransKeeperCheck(); #ifdef TEST *logofs << "NXTransKeeper: Going to cleanup the NX images " << "directories at " << strMsTimestamp() << ".\n" << logofs_flush; #endif if (keeper -> cleanupImages() < 0) { #ifdef TEST *logofs << "NXTransKeeper: Exiting because of error " << "handling the image cache.\n" << logofs_flush; #endif HandleCleanup(); } #ifdef TEST *logofs << "NXTransKeeper: Completed cleanup of NX images " << "directories at " << strMsTimestamp() << ".\n" << logofs_flush; #endif NXTransKeeperCheck(); #ifdef TEST *logofs << "NXTransKeeper: Going to sleep for " << timeout << " ms.\n" << logofs_flush; #endif usleep(timeout * 1000); } HandleCleanup(2); // // Hopefully useless. // exit(0); } void SystemCleanup(const char *name) { #ifdef TEST *logofs << name << ": Performing system cleanup in process " << "with pid '" << getpid() << "'.\n" << logofs_flush; #endif // // Reinstall signals that might // have been restored by agents. // InstallSignals(); } void MemoryCleanup(const char *name) { #ifdef TEST *logofs << name << ": Performing memory cleanup in process " << "with pid '" << getpid() << "'.\n" << logofs_flush; #endif DisableSignals(); // // Prevent deletion of unix socket // and lock file. // useUnixSocket = 0; // // Don't let cleanup kill other // children. // lastDialog = 0; lastWatchdog = 0; lastKeeper = 0; CleanupListeners(); CleanupSockets(); CleanupGlobal(); EnableSignals(); } int UnsetEnv(const char *name) { int result; #ifdef __sun char **pEnv = environ; int nameLen = strlen(name) + 1; char *varName = new char[nameLen + 1]; strcpy(varName, name); strcat(varName, "="); pEnv = environ; while (*pEnv != NULL) { if (!strncmp(varName, *pEnv, nameLen)) { break; } *pEnv++; } while (*pEnv != NULL) { *pEnv = *(pEnv + 1); pEnv++; } result = 0; delete[] varName; #else #ifdef __APPLE__ unsetenv(name); result = 0; #else result = unsetenv(name); #endif #endif return result; } nx-libs-3.5.99.23/nxcomp/src/ClearArea.cpp0000644000000000000000000001072313614532331014730 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ClearArea.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int ClearAreaStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { ClearAreaMessage *clearArea = (ClearAreaMessage *) message; // // Here is the fingerprint. // clearArea -> exposures = *(buffer + 1); clearArea -> window = GetULONG(buffer + 4, bigEndian); clearArea -> x = GetUINT(buffer + 8, bigEndian); clearArea -> y = GetUINT(buffer + 10, bigEndian); clearArea -> width = GetUINT(buffer + 12, bigEndian); clearArea -> height = GetUINT(buffer + 14, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int ClearAreaStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { ClearAreaMessage *clearArea = (ClearAreaMessage *) message; // // Fill all the message's fields. // *(buffer + 1) = clearArea -> exposures; PutULONG(clearArea -> window, buffer + 4, bigEndian); PutUINT(clearArea -> x, buffer + 8, bigEndian); PutUINT(clearArea -> y, buffer + 10, bigEndian); PutUINT(clearArea -> width, buffer + 12, bigEndian); PutUINT(clearArea -> height, buffer + 14, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void ClearAreaStore::dumpIdentity(const Message *message) const { #ifdef DUMP ClearAreaMessage *clearArea = (ClearAreaMessage *) message; *logofs << name() << ": Identity exposures " << (unsigned int) clearArea -> exposures << ", window " << clearArea -> window << ", x " << clearArea -> x << ", y " << clearArea -> y << ", width " << clearArea -> width << ", height " << clearArea -> height << ", size " << clearArea -> size_ << ".\n"; #endif } void ClearAreaStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { md5_append(md5_state_, buffer + 1, 1); md5_append(md5_state_, buffer + 4, 4); md5_append(md5_state_, buffer + 8, 2); md5_append(md5_state_, buffer + 10, 2); md5_append(md5_state_, buffer + 12, 2); md5_append(md5_state_, buffer + 14, 2); } nx-libs-3.5.99.23/nxcomp/src/ClearArea.h0000644000000000000000000001160713614532331014377 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ClearArea_H #define ClearArea_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define CLEARAREA_ENABLE_CACHE 1 #define CLEARAREA_ENABLE_DATA 0 #define CLEARAREA_ENABLE_SPLIT 0 #define CLEARAREA_ENABLE_COMPRESS 0 #define CLEARAREA_DATA_LIMIT 0 #define CLEARAREA_DATA_OFFSET 16 #define CLEARAREA_CACHE_SLOTS 3000 #define CLEARAREA_CACHE_THRESHOLD 5 #define CLEARAREA_CACHE_LOWER_THRESHOLD 1 // // The message class. // class ClearAreaMessage : public Message { friend class ClearAreaStore; public: ClearAreaMessage() { } ~ClearAreaMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char exposures; unsigned int window; unsigned short x; unsigned short y; unsigned short width; unsigned short height; }; class ClearAreaStore : public MessageStore { // // Constructors and destructors. // public: ClearAreaStore() : MessageStore() { enableCache = CLEARAREA_ENABLE_CACHE; enableData = CLEARAREA_ENABLE_DATA; enableSplit = CLEARAREA_ENABLE_SPLIT; enableCompress = CLEARAREA_ENABLE_COMPRESS; dataLimit = CLEARAREA_DATA_LIMIT; dataOffset = CLEARAREA_DATA_OFFSET; cacheSlots = CLEARAREA_CACHE_SLOTS; cacheThreshold = CLEARAREA_CACHE_THRESHOLD; cacheLowerThreshold = CLEARAREA_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~ClearAreaStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "ClearArea"; } virtual unsigned char opcode() const { return X_ClearArea; } virtual unsigned int storage() const { return sizeof(ClearAreaMessage); } // // Message handling methods. // public: virtual Message *create() const { return new ClearAreaMessage(); } virtual Message *create(const Message &message) const { return new ClearAreaMessage((const ClearAreaMessage &) message); } virtual void destroy(Message *message) const { delete (ClearAreaMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* ClearArea_H */ nx-libs-3.5.99.23/nxcomp/src/ClientCache.cpp0000644000000000000000000002207113614532331015252 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ClientCache.h" ClientCache::ClientCache() : freeGCCache(16), freeDrawableCache(16), freeWindowCache(16), cursorCache(16), colormapCache(16), visualCache(16), lastFont(0), changePropertyPropertyCache(16), changePropertyTypeCache(16), changePropertyData32Cache(16), configureWindowBitmaskCache(4), convertSelectionRequestorCache(16), convertSelectionLastTimestamp(0), copyPlaneBitPlaneCache(8), createGCBitmaskCache(8), createPixmapIdCache(16), createPixmapLastId(0), createPixmapXCache(8), createPixmapYCache(8), createWindowBitmaskCache(8), fillPolyNumPointsCache(8), fillPolyIndex(0), getSelectionOwnerSelectionCache(8), grabButtonEventMaskCache(8), grabButtonConfineCache(8), grabButtonModifierCache(8), grabKeyboardLastTimestamp(0), imageTextLengthCache(8), imageTextLastX(0), imageTextLastY(0), imageTextCacheX(8), imageTextCacheY(8), polySegmentCacheX(8), polySegmentCacheY(8), polySegmentCacheIndex(0), polyTextLastX(0), polyTextLastY(0), polyTextCacheX(8), polyTextCacheY(8), polyTextFontCache(8), putImageWidthCache(8), putImageHeightCache(8), putImageLastX(0), putImageLastY(0), putImageXCache(8), putImageYCache(8), getImagePlaneMaskCache(8), queryColorsLastPixel(0), setClipRectanglesXCache(8), setClipRectanglesYCache(8), setDashesLengthCache(8), setDashesOffsetCache(8), setSelectionOwnerCache(8), setSelectionOwnerTimestampCache(8), translateCoordsSrcCache(8), translateCoordsDstCache(8), translateCoordsXCache(8), translateCoordsYCache(8), sendEventMaskCache(16), sendEventLastSequence(0), sendEventIntDataCache(16), putPackedImageSrcLengthCache(16), putPackedImageDstLengthCache(16), // // RenderExtension requests. // renderFreePictureCache(16), renderGlyphSetCache(16), renderFreeGlyphSetCache(16), renderIdCache(8), renderLengthCache(16), renderFormatCache(16), renderValueMaskCache(8), renderNumGlyphsCache(8), renderXCache(16), renderYCache(16), renderLastX(0), renderLastY(0), renderWidthCache(16), renderHeightCache(16), renderLastId(0), renderGlyphXCache(16), renderGlyphYCache(16), renderGlyphX(0), renderGlyphY(0), renderLastCompositeGlyphsData(0), setCacheParametersCache(8), lastIdCache(16), lastId(0) { unsigned int i; for (i = 0; i < 3; i++) { allocColorRGBCache[i] = new IntCache(8); convertSelectionAtomCache[i] = new IntCache(8); } for (i = 0; i < 4; i++) { clearAreaGeomCache[i] = new IntCache(8); } for (i = 0; i < 7; i++) { configureWindowAttrCache[i] = new IntCache(8); } for (i = 0; i < 6; i++) { copyAreaGeomCache[i] = new IntCache(8); copyPlaneGeomCache[i] = new IntCache(8); } for (i = 0; i < 23; i++) { if (CREATEGC_FIELD_WIDTH[i] > 16) { createGCAttrCache[i] = new IntCache(16); } else { createGCAttrCache[i] = new IntCache(CREATEGC_FIELD_WIDTH[i]); } } for (i = 0; i < 6; i++) { createWindowGeomCache[i] = new IntCache(8); } for (i = 0; i < 15; i++) { createWindowAttrCache[i] = new IntCache(8); } for (i = 0; i < 10; i++) { fillPolyXRelCache[i] = new IntCache(8); fillPolyXAbsCache[i] = new IntCache(8); fillPolyYRelCache[i] = new IntCache(8); fillPolyYAbsCache[i] = new IntCache(8); } for (i = 0; i < 8; i++) { fillPolyRecentX[i] = 0; fillPolyRecentY[i] = 0; } for (i = 0; i < 4; i++) { polyFillRectangleCacheX[i] = new IntCache(8); polyFillRectangleCacheY[i] = new IntCache(8); polyFillRectangleCacheWidth[i] = new IntCache(8); polyFillRectangleCacheHeight[i] = new IntCache(8); } for (i = 0; i < 2; i++) { polyLineCacheX[i] = new IntCache(8); polyLineCacheY[i] = new IntCache(8); } for (i = 0; i < 2; i++) { polyPointCacheX[i] = new IntCache(8); polyPointCacheY[i] = new IntCache(8); } for (i = 0; i < 4; i++) { polyRectangleGeomCache[i] = new IntCache(8); } for (i = 0; i < 2; i++) { polySegmentLastX[i] = 0; polySegmentLastY[i] = 0; } for (i = 0; i < 4; i++) { setClipRectanglesGeomCache[i] = new IntCache(8); } for (i = 0; i < 2; i++) { polyFillArcCacheX[i] = new IntCache(8); polyFillArcCacheY[i] = new IntCache(8); polyFillArcCacheWidth[i] = new IntCache(8); polyFillArcCacheHeight[i] = new IntCache(8); polyFillArcCacheAngle1[i] = new IntCache(8); polyFillArcCacheAngle2[i] = new IntCache(8); } for (i = 0; i < 2; i++) { polyArcCacheX[i] = new IntCache(8); polyArcCacheY[i] = new IntCache(8); polyArcCacheWidth[i] = new IntCache(8); polyArcCacheHeight[i] = new IntCache(8); polyArcCacheAngle1[i] = new IntCache(8); polyArcCacheAngle2[i] = new IntCache(8); } for (i = 0; i < 8; i++) { shapeDataCache[i] = new IntCache(8); } for (i = 0; i < 8; i++) { genericRequestDataCache[i] = new IntCache(8); } for (i = 0; i < 16; i++) { renderDataCache[i] = new IntCache(16); } for (i = 0; i < 16; i++) { renderCompositeGlyphsDataCache[i] = new IntCache(16); } for (i = 0; i < 3; i++) { renderCompositeDataCache[i] = new IntCache(16); } } ClientCache::~ClientCache() { unsigned int i; for (i = 0; i < 3; i++) { delete allocColorRGBCache[i]; delete convertSelectionAtomCache[i]; } for (i = 0; i < 4; i++) { delete clearAreaGeomCache[i]; } for (i = 0; i < 7; i++) { delete configureWindowAttrCache[i]; } for (i = 0; i < 6; i++) { delete copyAreaGeomCache[i]; delete copyPlaneGeomCache[i]; } for (i = 0; i < 23; i++) { delete createGCAttrCache[i]; } for (i = 0; i < 6; i++) { delete createWindowGeomCache[i]; } for (i = 0; i < 15; i++) { delete createWindowAttrCache[i]; } for (i = 0; i < 10; i++) { delete fillPolyXRelCache[i]; delete fillPolyXAbsCache[i]; delete fillPolyYRelCache[i]; delete fillPolyYAbsCache[i]; } for (i = 0; i < 4; i++) { delete polyFillRectangleCacheX[i]; delete polyFillRectangleCacheY[i]; delete polyFillRectangleCacheWidth[i]; delete polyFillRectangleCacheHeight[i]; } for (i = 0; i < 2; i++) { delete polyLineCacheX[i]; delete polyLineCacheY[i]; } for (i = 0; i < 2; i++) { delete polyPointCacheX[i]; delete polyPointCacheY[i]; } for (i = 0; i < 4; i++) { delete polyRectangleGeomCache[i]; } for (i = 0; i < 4; i++) { delete setClipRectanglesGeomCache[i]; } for (i = 0; i < 2; i++) { delete polyFillArcCacheX[i]; delete polyFillArcCacheY[i]; delete polyFillArcCacheWidth[i]; delete polyFillArcCacheHeight[i]; delete polyFillArcCacheAngle1[i]; delete polyFillArcCacheAngle2[i]; } for (i = 0; i < 2; i++) { delete polyArcCacheX[i]; delete polyArcCacheY[i]; delete polyArcCacheWidth[i]; delete polyArcCacheHeight[i]; delete polyArcCacheAngle1[i]; delete polyArcCacheAngle2[i]; } for (i = 0; i < 8; i++) { delete shapeDataCache[i]; } for (i = 0; i < 8; i++) { delete genericRequestDataCache[i]; } for (i = 0; i < 16; i++) { delete renderDataCache[i]; } for (i = 0; i < 16; i++) { delete renderCompositeGlyphsDataCache[i]; } for (i = 0; i < 3; i++) { delete renderCompositeDataCache[i]; } } nx-libs-3.5.99.23/nxcomp/src/ClientCache.h0000644000000000000000000002135413614532331014722 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ClientCache_H #define ClientCache_H #include "Misc.h" #include "IntCache.h" #include "CharCache.h" #include "OpcodeCache.h" #include "XidCache.h" #include "FreeCache.h" #include "ChannelCache.h" class ClientCache : public ChannelCache { public: ClientCache(); ~ClientCache(); // // Opcode prediction caches. // OpcodeCache opcodeCache; // // GC and drawables caches. // XidCache gcCache; FreeCache freeGCCache; XidCache drawableCache; FreeCache freeDrawableCache; XidCache windowCache; FreeCache freeWindowCache; // // General-purpose caches. // IntCache cursorCache; IntCache colormapCache; IntCache visualCache; CharCache depthCache; CharCache resourceCache; CharCache methodCache; unsigned int lastFont; // // AllocColor request. // IntCache *allocColorRGBCache[3]; // // ChangeProperty request. // CharCache changePropertyFormatCache; IntCache changePropertyPropertyCache; IntCache changePropertyTypeCache; IntCache changePropertyData32Cache; // // ClearArea request. // IntCache *clearAreaGeomCache[4]; // // ConfigureWindow request. // IntCache configureWindowBitmaskCache; IntCache *configureWindowAttrCache[7]; // // ConvertSelection request. // IntCache convertSelectionRequestorCache; IntCache* convertSelectionAtomCache[3]; unsigned int convertSelectionLastTimestamp; // // CopyArea request. // IntCache *copyAreaGeomCache[6]; // // CopyPlane request. // IntCache *copyPlaneGeomCache[6]; IntCache copyPlaneBitPlaneCache; // // CreateGC request. // IntCache createGCBitmaskCache; IntCache *createGCAttrCache[23]; // // CreatePixmap request. // IntCache createPixmapIdCache; unsigned int createPixmapLastId; IntCache createPixmapXCache; IntCache createPixmapYCache; // // CreateWindow request. // IntCache *createWindowGeomCache[6]; IntCache createWindowBitmaskCache; IntCache *createWindowAttrCache[15]; // // FillPoly request. // IntCache fillPolyNumPointsCache; IntCache *fillPolyXRelCache[10]; IntCache *fillPolyXAbsCache[10]; IntCache *fillPolyYRelCache[10]; IntCache *fillPolyYAbsCache[10]; unsigned int fillPolyRecentX[8]; unsigned int fillPolyRecentY[8]; unsigned int fillPolyIndex; // // GetSelectionOwner request. // IntCache getSelectionOwnerSelectionCache; // // GrabButton request (also used for GrabPointer). // IntCache grabButtonEventMaskCache; IntCache grabButtonConfineCache; CharCache grabButtonButtonCache; IntCache grabButtonModifierCache; // // GrabKeyboard request. // unsigned int grabKeyboardLastTimestamp; // // ImageText8/16 request. // IntCache imageTextLengthCache; unsigned int imageTextLastX; unsigned int imageTextLastY; IntCache imageTextCacheX; IntCache imageTextCacheY; // // PolyFillRectangle request. // IntCache *polyFillRectangleCacheX[4]; IntCache *polyFillRectangleCacheY[4]; IntCache *polyFillRectangleCacheWidth[4]; IntCache *polyFillRectangleCacheHeight[4]; // // PolyLine request. // IntCache *polyLineCacheX[2]; IntCache *polyLineCacheY[2]; // // PolyPoint request. // IntCache *polyPointCacheX[2]; IntCache *polyPointCacheY[2]; // // PolyRectangle request. // IntCache *polyRectangleGeomCache[4]; // // PolySegment request. // IntCache polySegmentCacheX; IntCache polySegmentCacheY; unsigned int polySegmentLastX[2]; unsigned int polySegmentLastY[2]; unsigned int polySegmentCacheIndex; // // PolyText8/16 request. // unsigned int polyTextLastX; unsigned int polyTextLastY; IntCache polyTextCacheX; IntCache polyTextCacheY; IntCache polyTextFontCache; CharCache polyTextDeltaCache; // // PutImage request. // IntCache putImageWidthCache; IntCache putImageHeightCache; unsigned int putImageLastX; unsigned int putImageLastY; IntCache putImageXCache; IntCache putImageYCache; CharCache putImageLeftPadCache; // // GetImage request. // IntCache getImagePlaneMaskCache; // // QueryColors request. // unsigned int queryColorsLastPixel; // // SetClipRectangles request. // IntCache setClipRectanglesXCache; IntCache setClipRectanglesYCache; IntCache *setClipRectanglesGeomCache[4]; // // SetDashes request. // IntCache setDashesLengthCache; IntCache setDashesOffsetCache; CharCache setDashesDashCache_[2]; // // SetSelectionOwner request. // IntCache setSelectionOwnerCache; IntCache setSelectionOwnerTimestampCache; // // TranslateCoords request. // IntCache translateCoordsSrcCache; IntCache translateCoordsDstCache; IntCache translateCoordsXCache; IntCache translateCoordsYCache; // // SendEvent request. // IntCache sendEventMaskCache; CharCache sendEventCodeCache; CharCache sendEventByteDataCache; unsigned int sendEventLastSequence; IntCache sendEventIntDataCache; CharCache sendEventEventCache; // // PolyFillArc request. // IntCache *polyFillArcCacheX[2]; IntCache *polyFillArcCacheY[2]; IntCache *polyFillArcCacheWidth[2]; IntCache *polyFillArcCacheHeight[2]; IntCache *polyFillArcCacheAngle1[2]; IntCache *polyFillArcCacheAngle2[2]; // // PolyArc request. // IntCache *polyArcCacheX[2]; IntCache *polyArcCacheY[2]; IntCache *polyArcCacheWidth[2]; IntCache *polyArcCacheHeight[2]; IntCache *polyArcCacheAngle1[2]; IntCache *polyArcCacheAngle2[2]; // // PutPackedImage request. // IntCache putPackedImageSrcLengthCache; IntCache putPackedImageDstLengthCache; // // Shape extension requests. // CharCache shapeOpcodeCache; IntCache *shapeDataCache[8]; // // Generic requests. // CharCache genericRequestOpcodeCache; IntCache *genericRequestDataCache[8]; // // Render extension requests. // OpcodeCache renderOpcodeCache; CharCache renderOpCache; XidCache renderSrcPictureCache; XidCache renderMaskPictureCache; XidCache renderDstPictureCache; FreeCache renderFreePictureCache; IntCache renderGlyphSetCache; FreeCache renderFreeGlyphSetCache; IntCache renderIdCache; IntCache renderLengthCache; IntCache renderFormatCache; IntCache renderValueMaskCache; IntCache renderNumGlyphsCache; IntCache renderXCache; IntCache renderYCache; unsigned int renderLastX; unsigned int renderLastY; IntCache renderWidthCache; IntCache renderHeightCache; unsigned int renderLastId; IntCache *renderDataCache[16]; IntCache renderGlyphXCache; IntCache renderGlyphYCache; unsigned int renderGlyphX; unsigned int renderGlyphY; IntCache *renderCompositeGlyphsDataCache[16]; unsigned int renderLastCompositeGlyphsData; IntCache *renderCompositeDataCache[3]; // // SetCacheParameters request. // IntCache setCacheParametersCache; // // Encode new XID values based // on the last value encoded. // IntCache lastIdCache; unsigned int lastId; }; #endif /* ClientCache_H */ nx-libs-3.5.99.23/nxcomp/src/ClientChannel.cpp0000644000000000000000000076564513614532331015644 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "NXproto.h" #include "NXrender.h" #include "ClientChannel.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "StaticCompressor.h" #include "Statistics.h" #include "Proxy.h" #include "PutImage.h" #include "PutPackedImage.h" extern Proxy *proxy; // // Set the verbosity level. You also // need to define OPCODES in Misc.cpp // if you want literals instead of // opcodes' numbers. // #define PANIC #define WARNING #undef OPCODES #undef TEST #undef DEBUG #undef DUMP // // Log the important tracepoints related // to writing packets to the peer proxy. // #undef FLUSH // // Log the operations related to splits. // #undef SPLIT // // Define this to trace the invocations // of the agent's callbacks. // #undef CALLBACK // // By defining this, a simple procedure is activated at // startup which just allocates and deallocates plenty // of cache objects. This is used to help determine the // current memory requirements. // #undef MEMORY // // Inspects target of common X operations. // #undef TARGETS #ifdef TARGETS #include #include typedef set < unsigned int, less > T_windows; typedef set < unsigned int, less > T_pixmaps; typedef map < unsigned int, unsigned int, less > T_gcontexts; T_windows windows; T_pixmaps pixmaps; T_gcontexts gcontexts; #endif // // Define this to log when a channel // is created or destroyed. // #undef REFERENCES // // Here are the static members. // #ifdef REFERENCES int ClientChannel::references_ = 0; #endif ClientChannel::ClientChannel(Transport *transport, StaticCompressor *compressor) : Channel(transport, compressor), readBuffer_(transport_, this) { // // Sequence number of the next message // being encoded or decoded. // clientSequence_ = 0; serverSequence_ = 0; // // Current sequence known by NX agent. // lastSequence_ = 0; // // This is used to test the synchronous // flush in the proxy. // lastRequest_ = 0; // // Store information about the images // being streamed. // splitState_.resource = nothing; splitState_.pending = 0; splitState_.commit = 0; splitState_.mode = split_none; // // Number of outstanding tainted replies. // taintCounter_ = 0; #ifdef MEMORY *logofs << "ClientChannel: Created 1 ClientCache and 1 ServerCache. " << "You have 30 seconds to check the allocated size.\n" << logofs_flush; sleep(30); ClientCache *clientCacheTestArray[100]; ServerCache *serverCacheTestArray[100]; for (int i = 0; i < 100; i++) { clientCacheTestArray[i] = new ClientCache(); } *logofs << "ClientChannel: Created further 100 ClientCache. " << "You have 30 seconds to check the allocated size.\n" << logofs_flush; sleep(30); for (int i = 0; i < 100; i++) { serverCacheTestArray[i] = new ServerCache(); } *logofs << "ClientChannel: Created further 100 ServerCache. " << "You have 30 seconds to check the allocated size.\n" << logofs_flush; sleep(30); for (int i = 0; i < 100; i++) { delete clientCacheTestArray[i]; delete serverCacheTestArray[i]; } *logofs << "ClientChannel: Deleted 100 ClientCache and 100 ServerCache. " << "You have 30 seconds to check the allocated size.\n" << logofs_flush; sleep(30); #endif #ifdef REFERENCES *logofs << "ClientChannel: Created new object at " << this << " for FD#" << fd_ << " out of " << ++references_ << " allocated channels.\n" << logofs_flush; #endif } ClientChannel::~ClientChannel() { #ifdef REFERENCES *logofs << "ClientChannel: Deleted object at " << this << " for FD#" << fd_ << " out of " << --references_ << " allocated channels.\n" << logofs_flush; #endif } // // Beginning of handleRead(). // int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, unsigned int length) { #ifdef TEST *logofs << "handleRead: Called for FD#" << fd_ << " with " << encodeBuffer.getLength() << " bytes already encoded.\n" << logofs_flush; #endif // // Pointer to located message and // its size in bytes. // const unsigned char *inputMessage; unsigned int inputLength; // // Set when message is found in // cache. // int hit; // // Check if we can borrow the buffer // from the caller. // if (message != NULL && length != 0) { readBuffer_.readMessage(message, length); } else { // // Get the data from the transport. // #if defined(TEST) || defined(INFO) *logofs << "handleRead: Trying to read from FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif int result = readBuffer_.readMessage(); #ifdef DEBUG *logofs << "handleRead: Read result on FD#" << fd_ << " is " << result << ".\n" << logofs_flush; #endif if (result < 0) { // // Let the proxy close the channel. // return -1; } else if (result == 0) { #if defined(TEST) || defined(INFO) *logofs << "handleRead: PANIC! No data read from FD#" << fd_ << " while encoding messages.\n" << logofs_flush; HandleCleanup(); #endif return 0; } } #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "handleRead: Encoding messages for FD#" << fd_ << " with " << readBuffer_.getLength() << " bytes " << "in the buffer.\n" << logofs_flush; #endif // // Extract any complete message which // is available in the buffer. // if (proxy -> handleAsyncSwitch(fd_) < 0) { return -1; } while ((inputMessage = readBuffer_.getMessage(inputLength)) != NULL) { hit = 0; if (firstRequest_) { // // Need to add the length of the first // request as it was not present in // previous versions. // // Since ProtoStep7 (#issue 108) encodeBuffer.encodeValue(inputLength, 8); for (unsigned int i = 0; i < inputLength; i++) { encodeBuffer.encodeValue((unsigned int) inputMessage[i], 8); } firstRequest_ = 0; #if defined(TEST) || defined(OPCODES) int bits = encodeBuffer.diffBits(); *logofs << "handleRead: Handled first request. " << inputLength << " bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; #endif priority_++; } else { // // First of all we get the opcode. // unsigned char inputOpcode = *inputMessage; #if defined(TEST) || defined(INFO) // // This is used to test the synchronous // flush in the parent proxy. // lastRequest_ = inputOpcode; #endif // // Check if the request is supported by the // remote. If not, only handle it locally and // taint the opcode as a X_NoOperation. Also // try to short-circuit some replies at this // side. XSync requests, for example, weight // for half of the total round-trips. // if (handleTaintRequest(inputOpcode, inputMessage, inputLength) < 0) { return -1; } encodeBuffer.encodeOpcodeValue(inputOpcode, clientCache_ -> opcodeCache); // // Update the current sequence. // clientSequence_++; clientSequence_ &= 0xffff; #ifdef DEBUG *logofs << "handleRead: Last client sequence number for FD#" << fd_ << " is " << clientSequence_ << ".\n" << logofs_flush; #endif // // If differential compression is disabled // then use the most simple encoding. // if (control -> LocalDeltaCompression == 0) { int result = handleFastReadRequest(encodeBuffer, inputOpcode, inputMessage, inputLength); if (result < 0) { return -1; } else if (result > 0) { continue; } } // // Go to the message's specific encoding. // switch (inputOpcode) { case X_AllocColor: { encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, clientCache_ -> colormapCache); const unsigned char *nextSrc = inputMessage + 8; unsigned int colorData[3]; for (unsigned int i = 0; i < 3; i++) { unsigned int value = GetUINT(nextSrc, bigEndian_); encodeBuffer.encodeCachedValue(value, 16, *(clientCache_ -> allocColorRGBCache[i]), 4); colorData[i] = value; nextSrc += 2; } sequenceQueue_.push(clientSequence_, inputOpcode, colorData[0], colorData[1], colorData[2]); priority_++; } break; case X_ReparentWindow: { encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> windowCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> windowCache); encodeBuffer.encodeValue(GetUINT(inputMessage + 12, bigEndian_), 16, 11); encodeBuffer.encodeValue(GetUINT(inputMessage + 14, bigEndian_), 16, 11); } break; case X_ChangeProperty: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_ChangeProperty); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } unsigned char format = inputMessage[16]; encodeBuffer.encodeCachedValue(format, 8, clientCache_ -> changePropertyFormatCache); unsigned int dataLength = GetULONG(inputMessage + 20, bigEndian_); encodeBuffer.encodeValue(dataLength, 32, 6); encodeBuffer.encodeValue(inputMessage[1], 2); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> windowCache); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, clientCache_ -> changePropertyPropertyCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 29, clientCache_ -> changePropertyTypeCache, 9); const unsigned char *nextSrc = inputMessage + 24; if (format == 8) { // Since ProtoStep7 (#issue 108) encodeBuffer.encodeTextData(nextSrc, dataLength); } else if (format == 32) { for (unsigned int i = 0; i < dataLength; i++) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 32, clientCache_ -> changePropertyData32Cache); nextSrc += 4; } } else { for (unsigned int i = 0; i < dataLength; i++) { encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16); nextSrc += 2; } } } break; case X_SendEvent: { // // TODO: This can be improved. In the worst // cases, it appears to provide a poor 1.6:1 // ratio. // MessageStore *messageStore = clientStore_ -> getRequestStore(X_SendEvent); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); unsigned int window = GetULONG(inputMessage + 4, bigEndian_); if (window == 0 || window == 1) { encodeBuffer.encodeBoolValue(1); encodeBuffer.encodeBoolValue(window); } else { encodeBuffer.encodeBoolValue(0); encodeBuffer.encodeXidValue(window, clientCache_ -> windowCache); } encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 32, clientCache_ -> sendEventMaskCache, 9); encodeBuffer.encodeCachedValue(*(inputMessage + 12), 8, clientCache_ -> sendEventCodeCache); encodeBuffer.encodeCachedValue(*(inputMessage + 13), 8, clientCache_ -> sendEventByteDataCache); unsigned int newSeq = GetUINT(inputMessage + 14, bigEndian_); unsigned int diffSeq = newSeq - clientCache_ -> sendEventLastSequence; clientCache_ -> sendEventLastSequence = newSeq; encodeBuffer.encodeValue(diffSeq, 16, 4); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), 32, clientCache_ -> sendEventIntDataCache); for (unsigned int i = 20; i < 44; i++) { encodeBuffer.encodeCachedValue((unsigned int) inputMessage[i], 8, clientCache_ -> sendEventEventCache); } } break; case X_ChangeWindowAttributes: { encodeBuffer.encodeValue((inputLength - 12) >> 2, 4); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> windowCache); unsigned int bitmask = GetULONG(inputMessage + 8, bigEndian_); encodeBuffer.encodeCachedValue(bitmask, 15, clientCache_ -> createWindowBitmaskCache); const unsigned char *nextSrc = inputMessage + 12; unsigned int mask = 0x1; for (unsigned int j = 0; j < 15; j++) { if (bitmask & mask) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 32, *clientCache_ -> createWindowAttrCache[j]); nextSrc += 4; } mask <<= 1; } } break; case X_ClearArea: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_ClearArea target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_ClearArea target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_ClearArea target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_ClearArea); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> windowCache); const unsigned char *nextSrc = inputMessage + 8; for (unsigned int i = 0; i < 4; i++) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_ -> clearAreaGeomCache[i], 8); nextSrc += 2; } } break; case X_CloseFont: { unsigned int font = GetULONG(inputMessage + 4, bigEndian_); encodeBuffer.encodeValue(font - clientCache_ -> lastFont, 29, 5); clientCache_ -> lastFont = font; } break; case X_ConfigureWindow: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_ConfigureWindow); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> windowCache); unsigned int bitmask = GetUINT(inputMessage + 8, bigEndian_); encodeBuffer.encodeCachedValue(bitmask, 7, clientCache_ -> configureWindowBitmaskCache); unsigned int mask = 0x1; const unsigned char *nextSrc = inputMessage + 12; for (unsigned int i = 0; i < 7; i++) { if (bitmask & mask) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), CONFIGUREWINDOW_FIELD_WIDTH[i], *clientCache_ -> configureWindowAttrCache[i], 8); nextSrc += 4; } mask <<= 1; } } break; case X_ConvertSelection: { encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, clientCache_ -> convertSelectionRequestorCache, 9); const unsigned char* nextSrc = inputMessage + 8; for (unsigned int i = 0; i < 3; i++) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 29, *(clientCache_ -> convertSelectionAtomCache[i]), 9); nextSrc += 4; } unsigned int _timestamp = GetULONG(nextSrc, bigEndian_); encodeBuffer.encodeValue(_timestamp - clientCache_ -> convertSelectionLastTimestamp, 32, 4); clientCache_ -> convertSelectionLastTimestamp = _timestamp; } break; case X_CopyArea: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_CopyArea source id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_CopyArea source id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_CopyArea source id " << t_id << " is unrecognized.\n" << logofs_flush; } t_id = GetULONG(inputMessage + 8, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_CopyArea target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_CopyArea target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_CopyArea target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_CopyArea); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 12, bigEndian_), clientCache_ -> gcCache); const unsigned char *nextSrc = inputMessage + 16; for (unsigned int i = 0; i < 6; i++) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_ -> copyAreaGeomCache[i], 8); nextSrc += 2; } } break; case X_CopyGC: { #ifdef TARGETS unsigned int s_g_id = GetULONG(inputMessage + 4, bigEndian_); unsigned int d_g_id = GetULONG(inputMessage + 8, bigEndian_); *logofs << "handleRead: X_CopyGC source gcontext id is " << s_g_id << " destination gcontext id is " << d_g_id << ".\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> gcCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> gcCache); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 23, clientCache_ -> createGCBitmaskCache); } break; case X_CopyPlane: { encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 12, bigEndian_), clientCache_ -> gcCache); const unsigned char *nextSrc = inputMessage + 16; for (unsigned int i = 0; i < 6; i++) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_ -> copyPlaneGeomCache[i], 8); nextSrc += 2; } encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 28, bigEndian_), 32, clientCache_ -> copyPlaneBitPlaneCache, 10); } break; case X_CreateGC: { #ifdef TARGETS unsigned int g_id = GetULONG(inputMessage + 4, bigEndian_); unsigned int t_id = GetULONG(inputMessage + 8, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_CreateGC id " << g_id << " target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_CreateGC id " << g_id << " target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_CreateGC id " << g_id << " target id is unrecognized.\n" << logofs_flush; } gcontexts.insert(T_gcontexts::value_type(g_id, t_id)); #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_CreateGC); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } // Since ProtoStep7 (#issue 108) encodeBuffer.encodeNewXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> lastId, clientCache_ -> lastIdCache, clientCache_ -> gcCache, clientCache_ -> freeGCCache); const unsigned char *nextSrc = inputMessage + 8; encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> drawableCache); nextSrc += 4; unsigned int bitmask = GetULONG(nextSrc, bigEndian_); nextSrc += 4; encodeBuffer.encodeCachedValue(bitmask, 23, clientCache_ -> createGCBitmaskCache); unsigned int mask = 0x1; for (unsigned int i = 0; i < 23; i++) { if (bitmask & mask) { unsigned int value = GetULONG(nextSrc, bigEndian_); nextSrc += 4; unsigned int fieldWidth = CREATEGC_FIELD_WIDTH[i]; if (fieldWidth <= 4) { encodeBuffer.encodeValue(value, fieldWidth); } else { encodeBuffer.encodeCachedValue(value, fieldWidth, *clientCache_ -> createGCAttrCache[i]); } } mask <<= 1; } } break; case X_ChangeGC: { #ifdef TARGETS unsigned int g_id = GetULONG(inputMessage + 4, bigEndian_); T_gcontexts::iterator i = gcontexts.find(g_id); if (i != gcontexts.end()) { unsigned int t_id = i -> second; if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_ChangeGC gcontext id is " << g_id << " target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_ChangeGC gcontext id is " << g_id << " target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_ChangeGC gcontext is " << g_id << " target id is unrecognized.\n" << logofs_flush; } } else { *logofs << "handleRead: X_ChangeGC gcontext id " << g_id << " is unrecognized.\n" << logofs_flush; } gcontexts.erase(g_id); #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_ChangeGC); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> gcCache); const unsigned char *nextSrc = inputMessage + 8; unsigned int bitmask = GetULONG(nextSrc, bigEndian_); nextSrc += 4; encodeBuffer.encodeCachedValue(bitmask, 23, clientCache_ -> createGCBitmaskCache); unsigned int mask = 0x1; for (unsigned int i = 0; i < 23; i++) { if (bitmask & mask) { unsigned int value = GetULONG(nextSrc, bigEndian_); nextSrc += 4; unsigned int fieldWidth = CREATEGC_FIELD_WIDTH[i]; if (fieldWidth <= 4) { encodeBuffer.encodeValue(value, fieldWidth); } else { encodeBuffer.encodeCachedValue(value, fieldWidth, *clientCache_ -> createGCAttrCache[i]); } } mask <<= 1; } } break; case X_CreatePixmap: { #ifdef TARGETS *logofs << "handleRead: X_CreatePixmap depth " << (unsigned) inputMessage[1] << ", pixmap id " << GetULONG(inputMessage + 4, bigEndian_) << ", drawable " << GetULONG(inputMessage + 8, bigEndian_) << ", width " << GetUINT(inputMessage + 12, bigEndian_) << ", height " << GetUINT(inputMessage + 14, bigEndian_) << ", size " << GetUINT(inputMessage + 2, bigEndian_) << 2 << ".\n" << logofs_flush; unsigned int p_id = GetULONG(inputMessage + 4, bigEndian_); unsigned short p_sx = GetUINT(inputMessage + 12, bigEndian_); unsigned short p_sy = GetUINT(inputMessage + 14, bigEndian_); *logofs << "handleRead: X_CreatePixmap id is " << p_id << " width is " << p_sx << " height is " << p_sy << ".\n" << logofs_flush; if (p_sx * p_sy <= 64 * 64) { *logofs << "handleRead: X_CreatePixmap id " << p_id << " of size " << p_sx << "x" << p_sy << "=" << p_sx * p_sy << " will be painted at client side.\n" << logofs_flush; } else { *logofs << "handleRead: X_CreatePixmap id " << p_id << " of size " << p_sx << "x" << p_sy << "=" << p_sx * p_sy << " will be painted at server side.\n" << logofs_flush; } pixmaps.insert(p_id); #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_CreatePixmap); hit = handleEncode(encodeBuffer, clientCache_, messageStore, inputOpcode, inputMessage, inputLength); } break; case X_CreateWindow: { #ifdef TARGETS unsigned int w_id = GetULONG(inputMessage + 4, bigEndian_); *logofs << "handleRead: X_CreateWindow id is " << w_id << ".\n" << logofs_flush; windows.insert(w_id); #endif unsigned bitmask = GetULONG(inputMessage + 28, bigEndian_); encodeBuffer.encodeCachedValue((unsigned int) inputMessage[1], 8, clientCache_ -> depthCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> windowCache); // Since ProtoStep7 (#issue 108) encodeBuffer.encodeNewXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> lastId, clientCache_ -> lastIdCache, clientCache_ -> windowCache, clientCache_ -> freeWindowCache); const unsigned char *nextSrc = inputMessage + 12; for (unsigned int i = 0; i < 6; i++) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_ -> createWindowGeomCache[i], 8); nextSrc += 2; } encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 24, bigEndian_), 29, clientCache_ -> visualCache); encodeBuffer.encodeCachedValue(bitmask, 15, clientCache_ -> createWindowBitmaskCache); nextSrc = inputMessage + 32; unsigned int mask = 0x1; for (unsigned int j = 0; j < 15; j++) { if (bitmask & mask) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 32, *clientCache_ -> createWindowAttrCache[j]); nextSrc += 4; } mask <<= 1; } } break; case X_DeleteProperty: { encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> windowCache); encodeBuffer.encodeValue(GetULONG(inputMessage + 8, bigEndian_), 29, 9); } break; case X_FillPoly: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_FillPoly target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_FillPoly target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_FillPoly target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_FillPoly); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } unsigned int numPoints = ((inputLength - 16) >> 2); // Since ProtoStep10 (#issue 108) encodeBuffer.encodeCachedValue(numPoints, 16, clientCache_ -> fillPolyNumPointsCache, 4); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> gcCache); encodeBuffer.encodeValue((unsigned int) inputMessage[12], 2); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[13]); int relativeCoordMode = (inputMessage[13] != 0); const unsigned char *nextSrc = inputMessage + 16; unsigned int pointIndex = 0; for (unsigned int i = 0; i < numPoints; i++) { if (relativeCoordMode) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_ -> fillPolyXRelCache[pointIndex], 8); nextSrc += 2; encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_ -> fillPolyYRelCache[pointIndex], 8); nextSrc += 2; } else { unsigned int x = GetUINT(nextSrc, bigEndian_); nextSrc += 2; unsigned int y = GetUINT(nextSrc, bigEndian_); nextSrc += 2; unsigned int j; for (j = 0; j < 8; j++) if ((x == clientCache_ -> fillPolyRecentX[j]) && (y == clientCache_ -> fillPolyRecentY[j])) break; if (j < 8) { encodeBuffer.encodeBoolValue(1); encodeBuffer.encodeValue(j, 3); } else { encodeBuffer.encodeBoolValue(0); encodeBuffer.encodeCachedValue(x, 16, *clientCache_ -> fillPolyXAbsCache[pointIndex], 8); encodeBuffer.encodeCachedValue(y, 16, *clientCache_ -> fillPolyYAbsCache[pointIndex], 8); clientCache_ -> fillPolyRecentX[clientCache_ -> fillPolyIndex] = x; clientCache_ -> fillPolyRecentY[clientCache_ -> fillPolyIndex] = y; clientCache_ -> fillPolyIndex++; if (clientCache_ -> fillPolyIndex == 8) clientCache_ -> fillPolyIndex = 0; } } if (++pointIndex == 10) pointIndex = 0; } } break; case X_FreeColors: { unsigned int numPixels = GetUINT(inputMessage + 2, bigEndian_) - 3; encodeBuffer.encodeValue(numPixels, 16, 4); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, clientCache_ -> colormapCache); encodeBuffer.encodeValue(GetULONG(inputMessage + 8, bigEndian_), 32, 4); const unsigned char *nextSrc = inputMessage + 12; while (numPixels) { encodeBuffer.encodeValue(GetULONG(nextSrc, bigEndian_), 32, 8); nextSrc += 4; numPixels--; } } break; case X_FreeCursor: { encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, clientCache_ -> cursorCache, 9); } break; case X_FreeGC: { #ifdef TARGETS unsigned int g_id = GetULONG(inputMessage + 4, bigEndian_); T_gcontexts::iterator i = gcontexts.find(g_id); if (i != gcontexts.end()) { unsigned int t_id = i -> second; if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_FreeGC gcontext id is " << g_id << " target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_FreeGC gcontext id is " << g_id << " target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_FreeGC gcontext id is " << g_id << " target id is unrecognized.\n" << logofs_flush; } } else { *logofs << "handleRead: X_FreeGC gcontext id " << g_id << " is unrecognized.\n" << logofs_flush; } gcontexts.erase(g_id); #endif // Since ProtoStep7 (#issue 108) encodeBuffer.encodeFreeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> freeGCCache); } break; case X_FreePixmap: { #ifdef TARGETS unsigned int p_id = GetULONG(inputMessage + 4, bigEndian_); *logofs << "handleRead: X_FreePixmap id is " << p_id << ".\n" << logofs_flush; pixmaps.erase(p_id); #endif // Since ProtoStep7 (#issue 108) encodeBuffer.encodeFreeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> freeDrawableCache); } break; case X_GetAtomName: { encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 29, 9); sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_GetGeometry: { encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_GetInputFocus: { sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_GetModifierMapping: { sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_GetKeyboardMapping: { encodeBuffer.encodeValue((unsigned int) inputMessage[4], 8); encodeBuffer.encodeValue((unsigned int) inputMessage[5], 8); sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_GetProperty: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_GetProperty); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { unsigned int property = GetULONG(inputMessage + 8, bigEndian_); sequenceQueue_.push(clientSequence_, inputOpcode, property); priority_++; hit = 1; break; } encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> windowCache); unsigned int property = GetULONG(inputMessage + 8, bigEndian_); encodeBuffer.encodeValue(property, 29, 9); encodeBuffer.encodeValue(GetULONG(inputMessage + 12, bigEndian_), 29, 9); encodeBuffer.encodeValue(GetULONG(inputMessage + 16, bigEndian_), 32, 2); encodeBuffer.encodeValue(GetULONG(inputMessage + 20, bigEndian_), 32, 8); sequenceQueue_.push(clientSequence_, inputOpcode, property); priority_++; } break; case X_GetSelectionOwner: { encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, clientCache_ -> getSelectionOwnerSelectionCache, 9); sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_GrabButton: { encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> windowCache); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, clientCache_ -> grabButtonEventMaskCache); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[10]); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[11]); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 29, clientCache_ -> grabButtonConfineCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), 29, clientCache_ -> cursorCache, 9); encodeBuffer.encodeCachedValue(inputMessage[20], 8, clientCache_ -> grabButtonButtonCache); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 22, bigEndian_), 16, clientCache_ -> grabButtonModifierCache); } break; case X_GrabPointer: { encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> windowCache); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, clientCache_ -> grabButtonEventMaskCache); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[10]); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[11]); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 29, clientCache_ -> grabButtonConfineCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), 29, clientCache_ -> cursorCache, 9); unsigned int _timestamp = GetULONG(inputMessage + 20, bigEndian_); encodeBuffer.encodeValue(_timestamp - clientCache_ -> grabKeyboardLastTimestamp, 32, 4); clientCache_ -> grabKeyboardLastTimestamp = _timestamp; sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_GrabKeyboard: { encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> windowCache); unsigned int _timestamp = GetULONG(inputMessage + 8, bigEndian_); encodeBuffer.encodeValue(_timestamp - clientCache_ -> grabKeyboardLastTimestamp, 32, 4); clientCache_ -> grabKeyboardLastTimestamp = _timestamp; encodeBuffer.encodeBoolValue((unsigned int) inputMessage[12]); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[13]); sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_GrabServer: case X_UngrabServer: case X_NoOperation: { } break; case X_PolyText8: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_PolyText8 target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_PolyText8 target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_PolyText8 target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolyText8); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> gcCache); unsigned int x = GetUINT(inputMessage + 12, bigEndian_); int xDiff = x - clientCache_ -> polyTextLastX; clientCache_ -> polyTextLastX = x; encodeBuffer.encodeCachedValue(xDiff, 16, clientCache_ -> polyTextCacheX); unsigned int y = GetUINT(inputMessage + 14, bigEndian_); int yDiff = y - clientCache_ -> polyTextLastY; clientCache_ -> polyTextLastY = y; encodeBuffer.encodeCachedValue(yDiff, 16, clientCache_ -> polyTextCacheY); const unsigned char *end = inputMessage + inputLength - 1; const unsigned char *nextSrc = inputMessage + 16; while (nextSrc < end) { unsigned int textLength = (unsigned int) *nextSrc++; encodeBuffer.encodeBoolValue(1); encodeBuffer.encodeValue(textLength, 8); if (textLength == 255) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, 1), 29, clientCache_ -> polyTextFontCache); nextSrc += 4; } else { encodeBuffer.encodeCachedValue(*nextSrc++, 8, clientCache_ -> polyTextDeltaCache); // Since ProtoStep7 (#issue 108) encodeBuffer.encodeTextData(nextSrc, textLength); nextSrc += textLength; } } encodeBuffer.encodeBoolValue(0); } break; case X_PolyText16: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_PolyText16 target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_PolyText16 target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_PolyText16 target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolyText16); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> gcCache); unsigned int x = GetUINT(inputMessage + 12, bigEndian_); int xDiff = x - clientCache_ -> polyTextLastX; clientCache_ -> polyTextLastX = x; encodeBuffer.encodeCachedValue(xDiff, 16, clientCache_ -> polyTextCacheX); unsigned int y = GetUINT(inputMessage + 14, bigEndian_); int yDiff = y - clientCache_ -> polyTextLastY; clientCache_ -> polyTextLastY = y; encodeBuffer.encodeCachedValue(yDiff, 16, clientCache_ -> polyTextCacheY); const unsigned char *end = inputMessage + inputLength - 1; const unsigned char *nextSrc = inputMessage + 16; while (nextSrc < end) { unsigned int textLength = (unsigned int) *nextSrc++; encodeBuffer.encodeBoolValue(1); encodeBuffer.encodeValue(textLength, 8); if (textLength == 255) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, 1), 29, clientCache_ -> polyTextFontCache); nextSrc += 4; } else { encodeBuffer.encodeCachedValue(*nextSrc++, 8, clientCache_ -> polyTextDeltaCache); // Since ProtoStep7 (#issue 108) encodeBuffer.encodeTextData(nextSrc, textLength * 2); nextSrc += textLength * 2; } } encodeBuffer.encodeBoolValue(0); } break; case X_ImageText8: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_ImageText8 target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_ImageText8 target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_ImageText8 target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_ImageText8); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } unsigned int textLength = (unsigned int) inputMessage[1]; encodeBuffer.encodeCachedValue(textLength, 8, clientCache_ -> imageTextLengthCache, 4); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> gcCache); unsigned int x = GetUINT(inputMessage + 12, bigEndian_); int xDiff = x - clientCache_ -> imageTextLastX; clientCache_ -> imageTextLastX = x; encodeBuffer.encodeCachedValue(xDiff, 16, clientCache_ -> imageTextCacheX); unsigned int y = GetUINT(inputMessage + 14, bigEndian_); int yDiff = y - clientCache_ -> imageTextLastY; clientCache_ -> imageTextLastY = y; encodeBuffer.encodeCachedValue(yDiff, 16, clientCache_ -> imageTextCacheY); const unsigned char *nextSrc = inputMessage + 16; // Since ProtoStep7 (#issue 108) encodeBuffer.encodeTextData(nextSrc, textLength); } break; case X_ImageText16: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_ImageText16 target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_ImageText16 target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_ImageText16 target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_ImageText16); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } unsigned int textLength = (unsigned int) inputMessage[1]; encodeBuffer.encodeCachedValue(textLength, 8, clientCache_ -> imageTextLengthCache, 4); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> gcCache); unsigned int x = GetUINT(inputMessage + 12, bigEndian_); int xDiff = x - clientCache_ -> imageTextLastX; clientCache_ -> imageTextLastX = x; encodeBuffer.encodeCachedValue(xDiff, 16, clientCache_ -> imageTextCacheX); unsigned int y = GetUINT(inputMessage + 14, bigEndian_); int yDiff = y - clientCache_ -> imageTextLastY; clientCache_ -> imageTextLastY = y; encodeBuffer.encodeCachedValue(yDiff, 16, clientCache_ -> imageTextCacheY); const unsigned char *nextSrc = inputMessage + 16; // Since ProtoStep7 (#issue 108) encodeBuffer.encodeTextData(nextSrc, textLength * 2); } break; case X_InternAtom: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_InternAtom); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { sequenceQueue_.push(clientSequence_, inputOpcode); // // Set the priority, also if doing so will // penalize all the well written clients // using XInternAtoms() to pipeline multi- // ple replies. // priority_++; hit = 1; break; } unsigned int nameLength = GetUINT(inputMessage + 4, bigEndian_); encodeBuffer.encodeValue(nameLength, 16, 6); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); const unsigned char *nextSrc = inputMessage + 8; // Since ProtoStep7 (#issue 108) encodeBuffer.encodeTextData(nextSrc, nameLength); sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_ListExtensions: { sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_ListFonts: { unsigned int textLength = GetUINT(inputMessage + 6, bigEndian_); encodeBuffer.encodeValue(textLength, 16, 6); encodeBuffer.encodeValue(GetUINT(inputMessage + 4, bigEndian_), 16, 6); const unsigned char* nextSrc = inputMessage + 8; // Since ProtoStep7 (#issue 108) encodeBuffer.encodeTextData(nextSrc, textLength); sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_LookupColor: case X_AllocNamedColor: { unsigned int textLength = GetUINT(inputMessage + 8, bigEndian_); encodeBuffer.encodeValue(textLength, 16, 6); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, clientCache_ -> colormapCache); const unsigned char *nextSrc = inputMessage + 12; // Since ProtoStep7 (#issue 108) encodeBuffer.encodeTextData(nextSrc, textLength); sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_MapWindow: case X_UnmapWindow: case X_MapSubwindows: case X_GetWindowAttributes: case X_DestroyWindow: case X_DestroySubwindows: case X_QueryPointer: case X_QueryTree: { #ifdef TARGETS if (inputOpcode == X_DestroyWindow) { unsigned int w_id = GetULONG(inputMessage + 4, bigEndian_); *logofs << "handleRead: X_DestroyWindow id is " << w_id << ".\n" << logofs_flush; windows.erase(w_id); } #endif if (inputOpcode == X_DestroyWindow) { // Since ProtoStep7 (#issue 108) encodeBuffer.encodeFreeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> freeWindowCache); } else { encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> windowCache); } if ((inputOpcode == X_QueryPointer) || (inputOpcode == X_GetWindowAttributes) || (inputOpcode == X_QueryTree)) { sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } } break; case X_OpenFont: { unsigned int nameLength = GetUINT(inputMessage + 8, bigEndian_); encodeBuffer.encodeValue(nameLength, 16, 7); unsigned int font = GetULONG(inputMessage + 4, bigEndian_); encodeBuffer.encodeValue(font - clientCache_ -> lastFont, 29, 5); clientCache_ -> lastFont = font; const unsigned char *nextSrc = inputMessage + 12; // Since ProtoStep7 (#issue 108) encodeBuffer.encodeTextData(nextSrc, nameLength); } break; case X_PolyFillRectangle: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_PolyFillRectangle target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_PolyFillRectangle target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_PolyFillRectangle target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolyFillRectangle); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> gcCache); unsigned int index = 0; unsigned int lastX = 0, lastY = 0; unsigned int lastWidth = 0, lastHeight = 0; // // TODO: Could send the size at the beginning // instead of a bool at each iteration. // for (unsigned int i = 12; i < inputLength;) { unsigned int x = GetUINT(inputMessage + i, bigEndian_); unsigned int newX = x; x -= lastX; lastX = newX; encodeBuffer.encodeCachedValue(x, 16, *clientCache_ -> polyFillRectangleCacheX[index], 8); i += 2; unsigned int y = GetUINT(inputMessage + i, bigEndian_); unsigned int newY = y; y -= lastY; lastY = newY; encodeBuffer.encodeCachedValue(y, 16, *clientCache_ -> polyFillRectangleCacheY[index], 8); i += 2; unsigned int width = GetUINT(inputMessage + i, bigEndian_); unsigned int newWidth = width; width -= lastWidth; lastWidth = newWidth; encodeBuffer.encodeCachedValue(width, 16, *clientCache_ -> polyFillRectangleCacheWidth[index], 8); i += 2; unsigned int height = GetUINT(inputMessage + i, bigEndian_); unsigned int newHeight = height; height -= lastHeight; lastHeight = newHeight; encodeBuffer.encodeCachedValue(height, 16, *clientCache_ -> polyFillRectangleCacheHeight[index], 8); i += 2; if (++index == 4) index = 0; encodeBuffer.encodeBoolValue((i < inputLength) ? 1 : 0); } } break; case X_PolyFillArc: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_PolyFillArc target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_PolyFillArc target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_PolyFillArc target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolyFillArc); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> gcCache); unsigned int index = 0; unsigned int lastX = 0, lastY = 0; unsigned int lastWidth = 0, lastHeight = 0; unsigned int lastAngle1 = 0, lastAngle2 = 0; // // TODO: Could send the size at the beginning // instead of a bool at each iteration. // for (unsigned int i = 12; i < inputLength;) { unsigned int x = GetUINT(inputMessage + i, bigEndian_); unsigned int newX = x; x -= lastX; lastX = newX; encodeBuffer.encodeCachedValue(x, 16, *clientCache_ -> polyFillArcCacheX[index], 8); i += 2; unsigned int y = GetUINT(inputMessage + i, bigEndian_); unsigned int newY = y; y -= lastY; lastY = newY; encodeBuffer.encodeCachedValue(y, 16, *clientCache_ -> polyFillArcCacheY[index], 8); i += 2; unsigned int width = GetUINT(inputMessage + i, bigEndian_); unsigned int newWidth = width; width -= lastWidth; lastWidth = newWidth; encodeBuffer.encodeCachedValue(width, 16, *clientCache_ -> polyFillArcCacheWidth[index], 8); i += 2; unsigned int height = GetUINT(inputMessage + i, bigEndian_); unsigned int newHeight = height; height -= lastHeight; lastHeight = newHeight; encodeBuffer.encodeCachedValue(height, 16, *clientCache_ -> polyFillArcCacheHeight[index], 8); i += 2; unsigned int angle1 = GetUINT(inputMessage + i, bigEndian_); unsigned int newAngle1 = angle1; angle1 -= lastAngle1; lastAngle1 = newAngle1; encodeBuffer.encodeCachedValue(angle1, 16, *clientCache_ -> polyFillArcCacheAngle1[index], 8); i += 2; unsigned int angle2 = GetUINT(inputMessage + i, bigEndian_); unsigned int newAngle2 = angle2; angle2 -= lastAngle2; lastAngle2 = newAngle2; encodeBuffer.encodeCachedValue(angle2, 16, *clientCache_ -> polyFillArcCacheAngle2[index], 8); i += 2; if (++index == 2) index = 0; encodeBuffer.encodeBoolValue((i < inputLength) ? 1 : 0); } } break; case X_PolyArc: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_PolyArc target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_PolyArc target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_PolyArc target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolyArc); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> gcCache); unsigned int index = 0; unsigned int lastX = 0, lastY = 0; unsigned int lastWidth = 0, lastHeight = 0; unsigned int lastAngle1 = 0, lastAngle2 = 0; // // TODO: Could send the size at the beginning // instead of a bool at each iteration. // for (unsigned int i = 12; i < inputLength;) { unsigned int x = GetUINT(inputMessage + i, bigEndian_); unsigned int newX = x; x -= lastX; lastX = newX; encodeBuffer.encodeCachedValue(x, 16, *clientCache_ -> polyArcCacheX[index], 8); i += 2; unsigned int y = GetUINT(inputMessage + i, bigEndian_); unsigned int newY = y; y -= lastY; lastY = newY; encodeBuffer.encodeCachedValue(y, 16, *clientCache_ -> polyArcCacheY[index], 8); i += 2; unsigned int width = GetUINT(inputMessage + i, bigEndian_); unsigned int newWidth = width; width -= lastWidth; lastWidth = newWidth; encodeBuffer.encodeCachedValue(width, 16, *clientCache_ -> polyArcCacheWidth[index], 8); i += 2; unsigned int height = GetUINT(inputMessage + i, bigEndian_); unsigned int newHeight = height; height -= lastHeight; lastHeight = newHeight; encodeBuffer.encodeCachedValue(height, 16, *clientCache_ -> polyArcCacheHeight[index], 8); i += 2; unsigned int angle1 = GetUINT(inputMessage + i, bigEndian_); unsigned int newAngle1 = angle1; angle1 -= lastAngle1; lastAngle1 = newAngle1; encodeBuffer.encodeCachedValue(angle1, 16, *clientCache_ -> polyArcCacheAngle1[index], 8); i += 2; unsigned int angle2 = GetUINT(inputMessage + i, bigEndian_); unsigned int newAngle2 = angle2; angle2 -= lastAngle2; lastAngle2 = newAngle2; encodeBuffer.encodeCachedValue(angle2, 16, *clientCache_ -> polyArcCacheAngle2[index], 8); i += 2; if (++index == 2) index = 0; encodeBuffer.encodeBoolValue((i < inputLength) ? 1 : 0); } } break; case X_PolyPoint: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_PolyPoint target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_PolyPoint target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_PolyPoint target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolyPoint); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } encodeBuffer.encodeValue(GetUINT(inputMessage + 2, bigEndian_) - 3, 16, 4); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> gcCache); const unsigned char *nextSrc = inputMessage + 12; unsigned int index = 0; unsigned int lastX = 0, lastY = 0; for (unsigned int i = 12; i < inputLength; i += 4) { unsigned int x = GetUINT(nextSrc, bigEndian_); nextSrc += 2; unsigned int tmp = x; x -= lastX; lastX = tmp; encodeBuffer.encodeCachedValue(x, 16, *clientCache_ -> polyPointCacheX[index], 8); unsigned int y = GetUINT(nextSrc, bigEndian_); nextSrc += 2; tmp = y; y -= lastY; lastY = tmp; encodeBuffer.encodeCachedValue(y, 16, *clientCache_ -> polyPointCacheY[index], 8); if (++index == 2) index = 0; } } break; case X_PolyLine: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_PolyLine target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_PolyLine target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_PolyLine target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolyLine); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } encodeBuffer.encodeValue(GetUINT(inputMessage + 2, bigEndian_) - 3, 16, 4); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> gcCache); const unsigned char *nextSrc = inputMessage + 12; unsigned int index = 0; unsigned int lastX = 0, lastY = 0; for (unsigned int i = 12; i < inputLength; i += 4) { unsigned int x = GetUINT(nextSrc, bigEndian_); nextSrc += 2; unsigned int tmp = x; x -= lastX; lastX = tmp; encodeBuffer.encodeCachedValue(x, 16, *clientCache_ -> polyLineCacheX[index], 8); unsigned int y = GetUINT(nextSrc, bigEndian_); nextSrc += 2; tmp = y; y -= lastY; lastY = tmp; encodeBuffer.encodeCachedValue(y, 16, *clientCache_ -> polyLineCacheY[index], 8); if (++index == 2) index = 0; } } break; case X_PolyRectangle: { encodeBuffer.encodeValue((GetUINT(inputMessage + 2, bigEndian_) - 3) >> 1, 16, 3); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> gcCache); const unsigned char *end = inputMessage + inputLength; const unsigned char *nextSrc = inputMessage + 12; while (nextSrc < end) { for (unsigned int i = 0; i < 4; i++) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_ -> polyRectangleGeomCache[i], 8); nextSrc += 2; } } } break; case X_PolySegment: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_PolySegment target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_PolySegment target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_PolySegment target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolySegment); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } encodeBuffer.encodeValue((GetUINT(inputMessage + 2, bigEndian_) - 3) >> 1, 16, 4); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), clientCache_ -> gcCache); const unsigned char *end = inputMessage + inputLength; const unsigned char *nextSrc = inputMessage + 12; // unsigned int index = 0; // unsigned int lastX1, lastY1, lastX2, lastY2; while (nextSrc < end) { unsigned int x = GetUINT(nextSrc, bigEndian_); nextSrc += 2; unsigned int xDiff0 = x - clientCache_ -> polySegmentLastX[0]; unsigned int xDiff1 = x - clientCache_ -> polySegmentLastX[1]; int xDiff0Abs = (int) xDiff0; if (xDiff0Abs < 0) xDiff0Abs = -xDiff0Abs; int xDiff1Abs = (int) xDiff1; if (xDiff1Abs < 0) xDiff1Abs = -xDiff1Abs; unsigned int y = GetUINT(nextSrc, bigEndian_); nextSrc += 2; unsigned int yDiff0 = y - clientCache_ -> polySegmentLastY[0]; unsigned int yDiff1 = y - clientCache_ -> polySegmentLastY[1]; int yDiff0Abs = (int) yDiff0; if (yDiff0Abs < 0) yDiff0Abs = -yDiff0Abs; int yDiff1Abs = (int) yDiff1; if (yDiff1Abs < 0) yDiff1Abs = -yDiff1Abs; int diff0 = xDiff0Abs + yDiff0Abs; int diff1 = xDiff1Abs + yDiff1Abs; if (diff0 < diff1) { encodeBuffer.encodeBoolValue(0); encodeBuffer.encodeCachedValue(xDiff0, 16, clientCache_ -> polySegmentCacheX, 6); encodeBuffer.encodeCachedValue(yDiff0, 16, clientCache_ -> polySegmentCacheY, 6); } else { encodeBuffer.encodeBoolValue(1); encodeBuffer.encodeCachedValue(xDiff1, 16, clientCache_ -> polySegmentCacheX, 6); encodeBuffer.encodeCachedValue(yDiff1, 16, clientCache_ -> polySegmentCacheY, 6); } clientCache_ -> polySegmentLastX[clientCache_ -> polySegmentCacheIndex] = x; clientCache_ -> polySegmentLastY[clientCache_ -> polySegmentCacheIndex] = y; clientCache_ -> polySegmentCacheIndex = clientCache_ -> polySegmentCacheIndex == 1 ? 0 : 1; } } break; case X_PutImage: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_PutImage target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_PutImage target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_PutImage target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_PutImage); hit = handleEncode(encodeBuffer, clientCache_, messageStore, inputOpcode, inputMessage, inputLength); } break; case X_QueryBestSize: { encodeBuffer.encodeValue((unsigned int)inputMessage[1], 2); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); encodeBuffer.encodeValue(GetUINT(inputMessage + 8, bigEndian_), 16, 8); encodeBuffer.encodeValue(GetUINT(inputMessage + 10, bigEndian_), 16, 8); sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_QueryColors: { // Differential encoding. encodeBuffer.encodeBoolValue(1); unsigned int numColors = ((inputLength - 8) >> 2); encodeBuffer.encodeValue(numColors, 16, 5); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, clientCache_ -> colormapCache); const unsigned char *nextSrc = inputMessage + 8; unsigned int predictedPixel = clientCache_ -> queryColorsLastPixel; for (unsigned int i = 0; i < numColors; i++) { unsigned int pixel = GetULONG(nextSrc, bigEndian_); nextSrc += 4; if (pixel == predictedPixel) encodeBuffer.encodeBoolValue(1); else { encodeBuffer.encodeBoolValue(0); encodeBuffer.encodeValue(pixel, 32, 9); } if (i == 0) clientCache_ -> queryColorsLastPixel = pixel; predictedPixel = pixel + 1; } sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_QueryExtension: { #ifdef TEST char data[256]; int length = GetUINT(inputMessage + 4, bigEndian_); if (length > 256) { length = 256; } strncpy(data, (char *) inputMessage + 8, length); *(data + length) = '\0'; *logofs << "handleRead: Going to query extension '" << data << "' for FD#" << fd_ << ".\n" << logofs_flush; #endif unsigned int nameLength = GetUINT(inputMessage + 4, bigEndian_); encodeBuffer.encodeValue(nameLength, 16, 6); const unsigned char *nextSrc = inputMessage + 8; for (; nameLength; nameLength--) { encodeBuffer.encodeValue((unsigned int) *nextSrc++, 8); } unsigned int extension = 0; if (strncmp((char *) inputMessage + 8, "SHAPE", 5) == 0) { extension = X_NXInternalShapeExtension; } else if (strncmp((char *) inputMessage + 8, "RENDER", 6) == 0) { extension = X_NXInternalRenderExtension; } sequenceQueue_.push(clientSequence_, inputOpcode, extension); priority_++; } break; case X_QueryFont: { unsigned int font = GetULONG(inputMessage + 4, bigEndian_); encodeBuffer.encodeValue(font - clientCache_ -> lastFont, 29, 5); clientCache_ -> lastFont = font; sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_SetClipRectangles: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_SetClipRectangles); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { hit = 1; break; } unsigned int numRectangles = ((inputLength - 12) >> 3); // Since ProtoStep9 (#issue 108) encodeBuffer.encodeValue(numRectangles, 15, 4); encodeBuffer.encodeValue((unsigned int) inputMessage[1], 2); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> gcCache); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, clientCache_ -> setClipRectanglesXCache, 8); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 10, bigEndian_), 16, clientCache_ -> setClipRectanglesYCache, 8); const unsigned char *nextSrc = inputMessage + 12; for (unsigned int i = 0; i < numRectangles; i++) { for (unsigned int j = 0; j < 4; j++) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_ -> setClipRectanglesGeomCache[j], 8); nextSrc += 2; } } } break; case X_SetDashes: { unsigned int numDashes = GetUINT(inputMessage + 10, bigEndian_); encodeBuffer.encodeCachedValue(numDashes, 16, clientCache_ -> setDashesLengthCache, 5); encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> gcCache); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, clientCache_ -> setDashesOffsetCache, 5); const unsigned char *nextSrc = inputMessage + 12; for (unsigned int i = 0; i < numDashes; i++) encodeBuffer.encodeCachedValue(*nextSrc++, 8, clientCache_ -> setDashesDashCache_[i & 1], 5); } break; case X_SetSelectionOwner: { encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, clientCache_ -> setSelectionOwnerCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, clientCache_ -> getSelectionOwnerSelectionCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 32, clientCache_ -> setSelectionOwnerTimestampCache, 9); } break; case X_TranslateCoords: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_TranslateCoords source id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_TranslateCoords source id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_TranslateCoords source id " << t_id << " is unrecognized.\n" << logofs_flush; } t_id = GetULONG(inputMessage + 8, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_TranslateCoords target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_TranslateCoords target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_TranslateCoords target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_TranslateCoords); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; hit = 1; break; } encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, clientCache_ -> translateCoordsSrcCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, clientCache_ -> translateCoordsDstCache, 9); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 12, bigEndian_), 16, clientCache_ -> translateCoordsXCache, 8); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 14, bigEndian_), 16, clientCache_ -> translateCoordsYCache, 8); sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_GetImage: { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_GetImage source id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_GetImage source id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_GetImage source id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_GetImage); if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, inputMessage, inputLength)) { sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; hit = 1; break; } // Format. encodeBuffer.encodeValue((unsigned int) inputMessage[1], 2); // Drawable. encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), clientCache_ -> drawableCache); // X. unsigned int x = GetUINT(inputMessage + 8, bigEndian_); int xDiff = x - clientCache_ -> putImageLastX; clientCache_ -> putImageLastX = x; encodeBuffer.encodeCachedValue(xDiff, 16, clientCache_ -> putImageXCache, 8); // Y. unsigned int y = GetUINT(inputMessage + 10, bigEndian_); int yDiff = y - clientCache_ -> putImageLastY; clientCache_ -> putImageLastY = y; encodeBuffer.encodeCachedValue(yDiff, 16, clientCache_ -> putImageYCache, 8); // Width. unsigned int width = GetUINT(inputMessage + 12, bigEndian_); encodeBuffer.encodeCachedValue(width, 16, clientCache_ -> putImageWidthCache, 8); // Height. unsigned int height = GetUINT(inputMessage + 14, bigEndian_); encodeBuffer.encodeCachedValue(height, 16, clientCache_ -> putImageHeightCache, 8); // Plane mask. encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), 32, clientCache_ -> getImagePlaneMaskCache, 5); sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_GetPointerMapping: { sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; case X_GetKeyboardControl: { sequenceQueue_.push(clientSequence_, inputOpcode); priority_++; } break; default: { if (inputOpcode == opcodeStore_ -> renderExtension) { MessageStore *messageStore = clientStore_ -> getRequestStore(X_NXInternalRenderExtension); hit = handleEncode(encodeBuffer, clientCache_, messageStore, inputOpcode, inputMessage, inputLength); } else if (inputOpcode == opcodeStore_ -> shapeExtension) { MessageStore *messageStore = clientStore_ -> getRequestStore(X_NXInternalShapeExtension); hit = handleEncode(encodeBuffer, clientCache_, messageStore, inputOpcode, inputMessage, inputLength); } else if (inputOpcode == opcodeStore_ -> putPackedImage) { #ifdef TARGETS unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); if (pixmaps.find(t_id) != pixmaps.end()) { *logofs << "handleRead: X_NXPutPackedImage target id is pixmap " << t_id << ".\n" << logofs_flush; } else if (windows.find(t_id) != windows.end()) { *logofs << "handleRead: X_NXPutPackedImage target id is window " << t_id << ".\n" << logofs_flush; } else { *logofs << "handleRead: X_NXPutPackedImage target id " << t_id << " is unrecognized.\n" << logofs_flush; } #endif #ifdef DEBUG *logofs << "handleRead: Encoding packed image request for FD#" << fd_ << ".\n" << logofs_flush; #endif // // The field carries the destination data // length. We add the request's size of // the final X_PutImage. // unsigned int outputLength = GetULONG(inputMessage + 20, bigEndian_) + 24; statistics -> addPackedBytesIn(inputLength); statistics -> addPackedBytesOut(outputLength); MessageStore *messageStore = clientStore_ -> getRequestStore(X_NXPutPackedImage); hit = handleEncode(encodeBuffer, clientCache_, messageStore, inputOpcode, inputMessage, inputLength); } else if (inputOpcode == opcodeStore_ -> setUnpackColormap) { #ifdef DEBUG *logofs << "handleRead: Encoding set unpack colormap request " << "for FD#" << fd_ << " with size " << inputLength << ".\n" << logofs_flush; #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_NXSetUnpackColormap); hit = handleEncode(encodeBuffer, clientCache_, messageStore, inputOpcode, inputMessage, inputLength); } else if (inputOpcode == opcodeStore_ -> setUnpackAlpha) { #ifdef DEBUG *logofs << "handleRead: Encoding set unpack alpha request " << "for FD#" << fd_ << " with size " << inputLength << ".\n" << logofs_flush; #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_NXSetUnpackAlpha); hit = handleEncode(encodeBuffer, clientCache_, messageStore, inputOpcode, inputMessage, inputLength); } else if (inputOpcode == opcodeStore_ -> setUnpackGeometry) { #ifdef DEBUG *logofs << "handleRead: Encoding set unpack geometry request " << "for FD#" << fd_ << " with size " << inputLength << ".\n" << logofs_flush; #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_NXSetUnpackGeometry); hit = handleEncode(encodeBuffer, clientCache_, messageStore, inputOpcode, inputMessage, inputLength); } else if (inputOpcode == opcodeStore_ -> startSplit) { if (handleStartSplitRequest(encodeBuffer, inputOpcode, inputMessage, inputLength) < 0) { return -1; } } else if (inputOpcode == opcodeStore_ -> endSplit) { if (handleEndSplitRequest(encodeBuffer, inputOpcode, inputMessage, inputLength) < 0) { return -1; } } else if (inputOpcode == opcodeStore_ -> commitSplit) { if (handleCommitSplitRequest(encodeBuffer, inputOpcode, inputMessage, inputLength) < 0) { return -1; } } else if (inputOpcode == opcodeStore_ -> abortSplit) { if (handleAbortSplitRequest(encodeBuffer, inputOpcode, inputMessage, inputLength) < 0) { return -1; } } else if (inputOpcode == opcodeStore_ -> finishSplit) { if (handleFinishSplitRequest(encodeBuffer, inputOpcode, inputMessage, inputLength) < 0) { return -1; } } else if (inputOpcode == opcodeStore_ -> freeSplit) { #ifdef DEBUG *logofs << "handleRead: Encoding free split request " << "for FD#" << fd_ << " with size " << inputLength << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(*(inputMessage + 1), 8, clientCache_ -> resourceCache); } else if (inputOpcode == opcodeStore_ -> freeUnpack) { #ifdef DEBUG *logofs << "handleRead: Encoding free unpack request " << "for FD#" << fd_ << " with size " << inputLength << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(*(inputMessage + 1), 8, clientCache_ -> resourceCache); } else if (inputOpcode == opcodeStore_ -> getControlParameters) { #ifdef DEBUG *logofs << "handleRead: Encoding get control parameters " << "request for FD#" << fd_ << " with size " << inputLength << ".\n" << logofs_flush; #endif // // Add the reply to the write buffer. If found // to contain a message, it it will be flushed // to the X client before leaving the loop. // unsigned char *reply = writeBuffer_.addMessage(32); *(reply + 0) = X_Reply; PutUINT(clientSequence_, reply + 2, bigEndian_); PutULONG(0, reply + 4, bigEndian_); // // Save the sequence number we used // to auto-generate this reply. // lastSequence_ = clientSequence_; #ifdef TEST *logofs << "handleRead: Registered " << lastSequence_ << " as last auto-generated sequence number.\n" << logofs_flush; #endif *(reply + 1) = control -> LinkMode; *(reply + 8) = control -> LocalVersionMajor; *(reply + 9) = control -> LocalVersionMinor; *(reply + 10) = control -> LocalVersionPatch; *(reply + 11) = control -> RemoteVersionMajor; *(reply + 12) = control -> RemoteVersionMinor; *(reply + 13) = control -> RemoteVersionPatch; PutUINT(control -> SplitTimeout, reply + 14, bigEndian_); PutUINT(control -> MotionTimeout, reply + 16, bigEndian_); *(reply + 18) = control -> SplitMode; PutULONG(control -> SplitDataThreshold, reply + 20, bigEndian_); *(reply + 24) = control -> PackMethod; *(reply + 25) = control -> PackQuality; *(reply + 26) = control -> LocalDataCompressionLevel; *(reply + 27) = control -> LocalStreamCompressionLevel; *(reply + 28) = control -> LocalDeltaCompression; *(reply + 29) = (control -> LocalDeltaCompression == 1 && control -> PersistentCacheEnableLoad == 1); *(reply + 30) = (control -> LocalDeltaCompression == 1 && control -> PersistentCacheEnableSave == 1); *(reply + 31) = (control -> LocalDeltaCompression == 1 && control -> PersistentCacheEnableLoad == 1 && control -> PersistentCacheName != NULL); if (handleFlush(flush_if_any) < 0) { return -1; } } else if (inputOpcode == opcodeStore_ -> getCleanupParameters) { #ifdef WARNING *logofs << "handleRead: WARNING! Encoding fake get cleanup " << "parameters request for FD#" << fd_ << " with size " << inputLength << ".\n" << logofs_flush; #endif } else if (inputOpcode == opcodeStore_ -> getImageParameters) { #ifdef WARNING *logofs << "handleRead: WARNING! Encoding fake get cleanup " << "parameters request for FD#" << fd_ << " with size " << inputLength << ".\n" << logofs_flush; #endif } else if (inputOpcode == opcodeStore_ -> getUnpackParameters) { #ifdef DEBUG *logofs << "handleRead: Encoding get unpack parameters " << "request for FD#" << fd_ << " with size " << inputLength << ".\n" << logofs_flush; #endif sequenceQueue_.push(clientSequence_, inputOpcode); } else if (inputOpcode == opcodeStore_ -> getShmemParameters) { if (handleShmemRequest(encodeBuffer, inputOpcode, inputMessage, inputLength) < 0) { return -1; } } else if (inputOpcode == opcodeStore_ -> setExposeParameters) { // // Enable or disable expose events // coming from the real server. // encodeBuffer.encodeBoolValue(*(inputMessage + 4)); encodeBuffer.encodeBoolValue(*(inputMessage + 5)); encodeBuffer.encodeBoolValue(*(inputMessage + 6)); } else if (inputOpcode == opcodeStore_ -> setCacheParameters) { if (handleCacheRequest(encodeBuffer, inputOpcode, inputMessage, inputLength) < 0) { return -1; } } else if (inputOpcode == opcodeStore_ -> getFontParameters) { if (handleFontRequest(encodeBuffer, inputOpcode, inputMessage, inputLength) < 0) { return -1; } } else { MessageStore *messageStore = clientStore_ -> getRequestStore(X_NXInternalGenericRequest); hit = handleEncode(encodeBuffer, clientCache_, messageStore, inputOpcode, inputMessage, inputLength); // // Don't flush if the opcode is unrecognized. // We may optionally flush it is an extension // but would penalize the well written clients. // // if (inputOpcode > 127) // { // priority_++; // } // } } } // End of switch on opcode. int bits = encodeBuffer.diffBits(); #if defined(TEST) || defined(OPCODES) const char *cacheString = (hit ? "cached " : ""); *logofs << "handleRead: Handled " << cacheString << "request OPCODE#" << (unsigned int) inputOpcode << " (" << DumpOpcode(inputOpcode) << ")" << " for FD#" << fd_ << " sequence " << clientSequence_ << ". " << inputLength << " bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; #endif if (hit) { statistics -> addCachedRequest(inputOpcode); } statistics -> addRequestBits(inputOpcode, inputLength << 3, bits); if (inputOpcode == opcodeStore_ -> renderExtension) { if (hit) { statistics -> addRenderCachedRequest(*(inputMessage + 1)); } statistics -> addRenderRequestBits(*(inputMessage + 1), inputLength << 3, bits); } } // End if (firstRequest_)... else ... } // End of while ((inputMessage = readBuffer_.getMessage(inputLength)) != 0) ... // // Check if we need to flush because of // prioritized data. // if (priority_ > 0) { #if defined(TEST) || defined(INFO) *logofs << "handleRead: WARNING! Requesting flush " << "because of " << priority_ << " prioritized " << "messages for FD#" << fd_ << ".\n" << logofs_flush; #endif if (proxy -> handleAsyncPriority() < 0) { return -1; } // // Reset the priority flag. // priority_ = 0; } // // Flush if we exceeded the token length. // if (proxy -> canAsyncFlush() == 1) { #if defined(TEST) || defined(INFO) *logofs << "handleRead: WARNING! Requesting flush " << "because of token length exceeded.\n" << logofs_flush; #endif if (proxy -> handleAsyncFlush() < 0) { return -1; } } #if defined(TEST) || defined(INFO) if (transport_ -> pending() != 0 || readBuffer_.checkMessage() != 0) { *logofs << "handleRead: PANIC! Buffer for X descriptor FD#" << fd_ << " has " << transport_ -> pending() << " bytes to read.\n" << logofs_flush; HandleCleanup(); } #endif // // Reset the read buffer. // readBuffer_.fullReset(); return 1; } // // End of handleRead(). // // // Beginning of handleWrite(). // int ClientChannel::handleWrite(const unsigned char *message, unsigned int length) { #ifdef TEST *logofs << "handleWrite: Called for FD#" << fd_ << ".\n" << logofs_flush; #endif // // Create the buffer from which to // decode messages. // DecodeBuffer decodeBuffer(message, length); #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "handleWrite: Decoding messages for FD#" << fd_ << " with " << length << " bytes in the buffer.\n" << logofs_flush; #endif if (firstReply_) { #ifdef TEST *logofs << "handleWrite: First reply detected.\n" << logofs_flush; #endif unsigned int outputOpcode; decodeBuffer.decodeValue(outputOpcode, 8); unsigned int secondByte; decodeBuffer.decodeValue(secondByte, 8); unsigned int major; decodeBuffer.decodeValue(major, 16); unsigned int minor; decodeBuffer.decodeValue(minor, 16); unsigned int extraLength; decodeBuffer.decodeValue(extraLength, 16); unsigned int outputLength = 8 + (extraLength << 2); unsigned char *outputMessage = writeBuffer_.addMessage(outputLength); *outputMessage = (unsigned char) outputOpcode; outputMessage[1] = (unsigned char) secondByte; PutUINT(major, outputMessage + 2, bigEndian_); PutUINT(minor, outputMessage + 4, bigEndian_); PutUINT(extraLength, outputMessage + 6, bigEndian_); unsigned char *nextDest = outputMessage + 8; unsigned int cached; decodeBuffer.decodeBoolValue(cached); if (cached) { memcpy(nextDest, ServerCache::lastInitReply.getData(), outputLength - 8); } else { for (unsigned i = 8; i < outputLength; i++) { unsigned int nextByte; decodeBuffer.decodeValue(nextByte, 8); *nextDest++ = (unsigned char) nextByte; } ServerCache::lastInitReply.set(outputLength - 8, outputMessage + 8); } imageByteOrder_ = outputMessage[30]; bitmapBitOrder_ = outputMessage[31]; scanlineUnit_ = outputMessage[32]; scanlinePad_ = outputMessage[33]; firstReply_ = 0; } // End of if (firstReply_) // // This was previously in a 'else' block. // Due to the way the first request was // handled, we could not decode multiple // messages in the first frame. // { // Start of the decoding block. #ifdef DEBUG *logofs << "handleWrite: Starting loop on opcodes.\n" << logofs_flush; #endif unsigned char outputOpcode; // // NX client needs this line to consider // the initialization phase successfully // completed. // if (firstClient_ == -1) { cerr << "Info" << ": Established X client connection.\n" ; firstClient_ = fd_; } while (decodeBuffer.decodeOpcodeValue(outputOpcode, serverCache_ -> opcodeCache, 1)) { #ifdef DEBUG *logofs << "handleWrite: Decoded a new OPCODE#" << (unsigned int) outputOpcode << ".\n" << logofs_flush; #endif unsigned char *outputMessage = NULL; unsigned int outputLength = 0; // // General-purpose temp variables // for decoding ints and chars. // unsigned int value = 0; unsigned char cValue = 0; // // Check first if we need to abort any split, // then if this is a reply, finally if it is // en event or error. // if (outputOpcode == opcodeStore_ -> splitEvent) { // // It's an abort split, not a normal // burst of proxy data. // handleSplitEvent(decodeBuffer); continue; } else if (outputOpcode == X_Reply) { #ifdef DEBUG *logofs << "handleWrite: Decoding sequence number of reply.\n" << logofs_flush; #endif unsigned int sequenceNum; unsigned int sequenceDiff; decodeBuffer.decodeCachedValue(sequenceDiff, 16, serverCache_ -> replySequenceCache, 7); sequenceNum = (serverSequence_ + sequenceDiff) & 0xffff; serverSequence_ = sequenceNum; #ifdef DEBUG *logofs << "handleWrite: Last server sequence number for FD#" << fd_ << " is " << serverSequence_ << " with " << "difference " << sequenceDiff << ".\n" << logofs_flush; #endif // // In case of reply we can follow the X server and // override any event's sequence number generated // by this side. // #ifdef TEST *logofs << "handleWrite: Updating last event's sequence " << lastSequence_ << " to reply's sequence number " << serverSequence_ << " for FD#" << fd_ << ".\n" << logofs_flush; #endif lastSequence_ = serverSequence_; unsigned short int requestSequenceNum; unsigned char requestOpcode; #ifdef DEBUG requestSequenceNum = 0; requestOpcode = 0; *logofs << "handleWrite: Peek of sequence number returns "; *logofs << sequenceQueue_.peek(requestSequenceNum, requestOpcode); *logofs << " with sequence " << requestSequenceNum << " and opcode " << (unsigned int) requestOpcode << ".\n" << logofs_flush; #endif if (sequenceQueue_.peek(requestSequenceNum, requestOpcode) == 1 && (requestSequenceNum == sequenceNum)) { unsigned int requestData[3]; sequenceQueue_.pop(requestSequenceNum, requestOpcode, requestData[0], requestData[1], requestData[2]); #ifdef DEBUG *logofs << "handleWrite: Identified reply to OPCODE#" << (unsigned int) requestOpcode << ".\n" << logofs_flush; #endif // // Is differential encoding disabled? // if (control -> RemoteDeltaCompression == 0) { int result = handleFastWriteReply(decodeBuffer, requestOpcode, outputMessage, outputLength); if (result < 0) { return -1; } else if (result > 0) { continue; } } switch (requestOpcode) { case X_AllocColor: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); unsigned char *nextDest = outputMessage + 8; for (unsigned int i = 0; i < 3; i++) { decodeBuffer.decodeBoolValue(value); if (value) { PutUINT(requestData[i], nextDest, bigEndian_); } else { decodeBuffer.decodeValue(value, 16, 6); PutUINT(requestData[i] + value, nextDest, bigEndian_); } nextDest += 2; } decodeBuffer.decodeValue(value, 32, 9); PutULONG(value, outputMessage + 16, bigEndian_); } break; case X_GetAtomName: { unsigned int nameLength; decodeBuffer.decodeValue(nameLength, 16, 6); outputLength = RoundUp4(nameLength) + 32; outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(nameLength, outputMessage + 8, bigEndian_); unsigned char* nextDest = outputMessage + 32; // Since ProtoStep7 (#issue 108) decodeBuffer.decodeTextData(nextDest, nameLength); } break; case X_GetGeometry: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(cValue, 8, serverCache_ -> depthCache); outputMessage[1] = cValue; decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> getGeometryRootCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; for (unsigned int i = 0; i < 5; i++) { decodeBuffer.decodeCachedValue(value, 16, *serverCache_ -> getGeometryGeomCache[i], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } break; case X_GetInputFocus: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 2); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> getInputFocusWindowCache); PutULONG(value, outputMessage + 8, bigEndian_); } break; case X_GetKeyboardMapping: { decodeBuffer.decodeBoolValue(value); if (value) { unsigned int dataLength = ServerCache::getKeyboardMappingLastMap.getLength(); outputLength = 32 + dataLength; outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = ServerCache::getKeyboardMappingLastKeysymsPerKeycode; memcpy(outputMessage + 32, ServerCache::getKeyboardMappingLastMap.getData(), dataLength); break; } unsigned int numKeycodes; decodeBuffer.decodeValue(numKeycodes, 8); unsigned int keysymsPerKeycode; decodeBuffer.decodeValue(keysymsPerKeycode, 8, 4); ServerCache::getKeyboardMappingLastKeysymsPerKeycode = keysymsPerKeycode; outputLength = 32 + numKeycodes * keysymsPerKeycode * 4; outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = (unsigned char) keysymsPerKeycode; unsigned char *nextDest = outputMessage + 32; unsigned char previous = 0; for (unsigned int count = numKeycodes * keysymsPerKeycode; count; --count) { decodeBuffer.decodeBoolValue(value); if (value) PutULONG((unsigned int) NoSymbol, nextDest, bigEndian_); else { unsigned int keysym; decodeBuffer.decodeCachedValue(keysym, 24, serverCache_ -> getKeyboardMappingKeysymCache, 9); decodeBuffer.decodeCachedValue(cValue, 8, serverCache_ -> getKeyboardMappingLastByteCache, 5); previous += cValue; PutULONG((keysym << 8) | previous, nextDest, bigEndian_); } nextDest += 4; } ServerCache::getKeyboardMappingLastMap.set(outputLength - 32, outputMessage + 32); } break; case X_GetModifierMapping: { unsigned int keycodesPerModifier; decodeBuffer.decodeValue(keycodesPerModifier, 8); outputLength = 32 + (keycodesPerModifier << 3); outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = (unsigned char) keycodesPerModifier; unsigned char *nextDest = outputMessage + 32; decodeBuffer.decodeBoolValue(value); if (value) { memcpy(outputMessage + 32, ServerCache::getModifierMappingLastMap.getData(), ServerCache::getModifierMappingLastMap.getLength()); break; } for (unsigned int count = outputLength - 32; count; count--) { decodeBuffer.decodeBoolValue(value); if (value) *nextDest++ = 0; else { decodeBuffer.decodeValue(value, 8); *nextDest++ = value; } } ServerCache::getModifierMappingLastMap.set(outputLength - 32, outputMessage + 32); } break; case X_GetProperty: { MessageStore *messageStore = serverStore_ -> getReplyStore(X_GetProperty); handleDecode(decodeBuffer, serverCache_, messageStore, requestOpcode, outputMessage, outputLength); } break; case X_GetSelectionOwner: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> getSelectionOwnerCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); } break; case X_GetWindowAttributes: { outputLength = 44; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 2); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> visualCache); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> getWindowAttributesClassCache, 3); PutUINT(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(cValue, 8, serverCache_ -> getWindowAttributesBitGravityCache); outputMessage[14] = cValue; decodeBuffer.decodeCachedValue(cValue, 8, serverCache_ -> getWindowAttributesWinGravityCache); outputMessage[15] = cValue; decodeBuffer.decodeCachedValue(value, 32, serverCache_ -> getWindowAttributesPlanesCache, 9); PutULONG(value, outputMessage + 16, bigEndian_); decodeBuffer.decodeCachedValue(value, 32, serverCache_ -> getWindowAttributesPixelCache, 9); PutULONG(value, outputMessage + 20, bigEndian_); decodeBuffer.decodeBoolValue(value); outputMessage[24] = (unsigned char) value; decodeBuffer.decodeBoolValue(value); outputMessage[25] = (unsigned char) value; decodeBuffer.decodeValue(value, 2); outputMessage[26] = (unsigned char) value; decodeBuffer.decodeBoolValue(value); outputMessage[27] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> colormapCache, 9); PutULONG(value, outputMessage + 28, bigEndian_); decodeBuffer.decodeCachedValue(value, 32, serverCache_ -> getWindowAttributesAllEventsCache); PutULONG(value, outputMessage + 32, bigEndian_); decodeBuffer.decodeCachedValue(value, 32, serverCache_ -> getWindowAttributesYourEventsCache); PutULONG(value, outputMessage + 36, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> getWindowAttributesDontPropagateCache); PutUINT(value, outputMessage + 40, bigEndian_); } break; case X_GrabKeyboard: case X_GrabPointer: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 3); outputMessage[1] = (unsigned char) value; } break; case X_InternAtom: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 29, 9); PutULONG(value, outputMessage + 8, bigEndian_); } break; case X_ListExtensions: { decodeBuffer.decodeValue(value, 32, 8); outputLength = 32 + (value << 2); outputMessage = writeBuffer_.addMessage(outputLength); unsigned int numExtensions; decodeBuffer.decodeValue(numExtensions, 8); outputMessage[1] = (unsigned char) numExtensions; unsigned char *nextDest = outputMessage + 32; for (; numExtensions; numExtensions--) { unsigned int _length; decodeBuffer.decodeValue(_length, 8); *nextDest++ = (unsigned char) _length; for (; _length; _length--) { decodeBuffer.decodeValue(value, 8); *nextDest++ = value; } } } break; case X_ListFonts: { // // Differential compression can achieve a 12:1 to 14:1 // ratio, while the best ZLIB compression can achieve // a mere 4:1 to 5:1. In the first case, though, the // huge amount of data constituting the message would // be stored uncompressed at the remote side. We need // to find a compromise. The solution is to use diffe- // rential compression at startup and ZLIB compression // later on. // MessageStore *messageStore = serverStore_ -> getReplyStore(X_ListFonts); if (handleDecodeCached(decodeBuffer, serverCache_, messageStore, outputMessage, outputLength)) { break; } decodeBuffer.decodeValue(value, 32, 8); outputLength = 32 + (value << 2); outputMessage = writeBuffer_.addMessage(outputLength); unsigned int numFonts; decodeBuffer.decodeValue(numFonts, 16, 6); PutUINT(numFonts, outputMessage + 8, bigEndian_); // Differential or plain data compression? decodeBuffer.decodeBoolValue(value); if (value) { unsigned char* nextDest = outputMessage + 32; for (; numFonts; numFonts--) { unsigned int _length; decodeBuffer.decodeValue(_length, 8); *nextDest++ = (unsigned char)_length; // Since ProtoStep7 (#issue 108) decodeBuffer.decodeTextData(nextDest, _length); nextDest += _length; } handleSave(messageStore, outputMessage, outputLength); } else { const unsigned char *compressedData = NULL; unsigned int compressedDataSize = 0; int decompressed = handleDecompress(decodeBuffer, requestOpcode, messageStore -> dataOffset, outputMessage, outputLength, compressedData, compressedDataSize); if (decompressed < 0) { return -1; } else if (decompressed > 0) { handleSave(messageStore, outputMessage, outputLength, compressedData, compressedDataSize); } else { handleSave(messageStore, outputMessage, outputLength); } } } break; case X_LookupColor: case X_AllocNamedColor: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); unsigned char *nextDest = outputMessage + 8; if (requestOpcode == X_AllocNamedColor) { decodeBuffer.decodeValue(value, 32, 9); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } unsigned int count = 3; do { decodeBuffer.decodeValue(value, 16, 9); PutUINT(value, nextDest, bigEndian_); unsigned int visualColor; decodeBuffer.decodeValue(visualColor, 16, 5); visualColor += value; visualColor &= 0xffff; PutUINT(visualColor, nextDest + 6, bigEndian_); nextDest += 2; } while (--count); } break; case X_QueryBestSize: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 16, 8); PutUINT(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 16, 8); PutUINT(value, outputMessage + 10, bigEndian_); } break; case X_QueryColors: { // Differential or plain data compression? decodeBuffer.decodeBoolValue(value); if (value) { decodeBuffer.decodeBoolValue(value); if (value) { unsigned int numColors = serverCache_ -> queryColorsLastReply.getLength() / 6; outputLength = 32 + (numColors << 3); outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(numColors, outputMessage + 8, bigEndian_); const unsigned char *nextSrc = serverCache_ -> queryColorsLastReply.getData(); unsigned char *nextDest = outputMessage + 32; for (; numColors; numColors--) { for (unsigned int i = 0; i < 6; i++) *nextDest++ = *nextSrc++; nextDest += 2; } } else { unsigned int numColors; decodeBuffer.decodeValue(numColors, 16, 5); outputLength = 32 + (numColors << 3); outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(numColors, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 32; for (unsigned int c = 0; c < numColors; c++) { for (unsigned int i = 0; i < 3; i++) { decodeBuffer.decodeValue(value, 16); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } serverCache_ -> queryColorsLastReply.set(numColors * 6, outputMessage + 32); const unsigned char *nextSrc = nextDest - 1; nextDest = outputMessage + 32 + ((numColors - 1) << 3) + 5; for (; numColors > 1; numColors--) { for (unsigned int i = 0; i < 6; i++) *nextDest-- = *nextSrc--; nextDest -= 2; } } } else { // Reply length. unsigned int numColors; decodeBuffer.decodeValue(numColors, 16, 5); outputLength = 32 + (numColors << 3); outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(numColors, outputMessage + 8, bigEndian_); const unsigned char *compressedData = NULL; unsigned int compressedDataSize = 0; int decompressed = handleDecompress(decodeBuffer, requestOpcode, 32, outputMessage, outputLength, compressedData, compressedDataSize); if (decompressed < 0) { return -1; } } } break; case X_QueryExtension: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeBoolValue(value); outputMessage[8] = (unsigned char) value; decodeBuffer.decodeValue(value, 8); outputMessage[9] = (unsigned char) value; decodeBuffer.decodeValue(value, 8); outputMessage[10] = (unsigned char) value; decodeBuffer.decodeValue(value, 8); outputMessage[11] = (unsigned char) value; // // We use a predefined opcode to address // extensions' message stores, while real // opcodes are used for communication with // X server and clients. // if (requestData[0] == X_NXInternalShapeExtension) { opcodeStore_ -> shapeExtension = outputMessage[9]; #ifdef TEST *logofs << "handleWrite: Shape extension opcode for FD#" << fd_ << " is " << (unsigned int) opcodeStore_ -> shapeExtension << ".\n" << logofs_flush; #endif } else if (requestData[0] == X_NXInternalRenderExtension) { opcodeStore_ -> renderExtension = outputMessage[9]; #ifdef TEST *logofs << "handleWrite: Render extension opcode for FD#" << fd_ << " is " << (unsigned int) opcodeStore_ -> renderExtension << ".\n" << logofs_flush; #endif } } break; case X_QueryFont: { // // Use differential compression at startup and plain // data compression later. Check X_ListFonts message // for an explanation. // MessageStore *messageStore = serverStore_ -> getReplyStore(X_QueryFont); if (handleDecodeCached(decodeBuffer, serverCache_, messageStore, outputMessage, outputLength)) { break; } // Differential or plain data compression? decodeBuffer.decodeBoolValue(value); if (value) { unsigned int numProperties; unsigned int numCharInfos; decodeBuffer.decodeValue(numProperties, 16, 8); decodeBuffer.decodeValue(numCharInfos, 32, 10); outputLength = 60 + numProperties * 8 + numCharInfos * 12; outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(numProperties, outputMessage + 46, bigEndian_); PutULONG(numCharInfos, outputMessage + 56, bigEndian_); handleDecodeCharInfo(decodeBuffer, outputMessage + 8); handleDecodeCharInfo(decodeBuffer, outputMessage + 24); decodeBuffer.decodeValue(value, 16, 9); PutUINT(value, outputMessage + 40, bigEndian_); decodeBuffer.decodeValue(value, 16, 9); PutUINT(value, outputMessage + 42, bigEndian_); decodeBuffer.decodeValue(value, 16, 9); PutUINT(value, outputMessage + 44, bigEndian_); decodeBuffer.decodeBoolValue(value); outputMessage[48] = (unsigned char) value; decodeBuffer.decodeValue(value, 8); outputMessage[49] = (unsigned char) value; decodeBuffer.decodeValue(value, 8); outputMessage[50] = (unsigned char) value; decodeBuffer.decodeBoolValue(value); outputMessage[51] = (unsigned char) value; decodeBuffer.decodeValue(value, 16, 9); PutUINT(value, outputMessage + 52, bigEndian_); decodeBuffer.decodeValue(value, 16, 9); PutUINT(value, outputMessage + 54, bigEndian_); unsigned char *nextDest = outputMessage + 60; decodeBuffer.decodeBoolValue(value); int end = 0; if (value == 1) { unsigned int index; decodeBuffer.decodeValue(index, 4); unsigned int _length; const unsigned char *data; ServerCache::queryFontFontCache.get(index, _length, data); memcpy(nextDest, data, _length); end = 1; } if (end == 0) { unsigned char *saveDest = nextDest; unsigned int _length = numProperties * 8 + numCharInfos * 12; for (; numProperties; numProperties--) { decodeBuffer.decodeValue(value, 32, 9); PutULONG(value, nextDest, bigEndian_); decodeBuffer.decodeValue(value, 32, 9); PutULONG(value, nextDest + 4, bigEndian_); nextDest += 8; } for (; numCharInfos; numCharInfos--) { handleDecodeCharInfo(decodeBuffer, nextDest); nextDest += 12; } ServerCache::queryFontFontCache.set(_length, saveDest); } handleSave(messageStore, outputMessage, outputLength); } else { // Reply length. unsigned int replyLength; decodeBuffer.decodeValue(replyLength, 32, 16); outputLength = 32 + (replyLength << 2); outputMessage = writeBuffer_.addMessage(outputLength); const unsigned char *compressedData = NULL; unsigned int compressedDataSize = 0; int decompressed = handleDecompress(decodeBuffer, requestOpcode, messageStore -> dataOffset, outputMessage, outputLength, compressedData, compressedDataSize); if (decompressed < 0) { return -1; } else if (decompressed > 0) { handleSave(messageStore, outputMessage, outputLength, compressedData, compressedDataSize); } else { handleSave(messageStore, outputMessage, outputLength); } } } break; case X_QueryPointer: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeBoolValue(value); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> queryPointerRootCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> queryPointerChildCache, 9); PutULONG(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> motionNotifyRootXCache, 8); serverCache_ -> motionNotifyLastRootX += value; PutUINT(serverCache_ -> motionNotifyLastRootX, outputMessage + 16, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> motionNotifyRootYCache, 8); serverCache_ -> motionNotifyLastRootY += value; PutUINT(serverCache_ -> motionNotifyLastRootY, outputMessage + 18, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> motionNotifyEventXCache, 8); PutUINT(serverCache_ -> motionNotifyLastRootX + value, outputMessage + 20, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> motionNotifyEventYCache, 8); PutUINT(serverCache_ -> motionNotifyLastRootY + value, outputMessage + 22, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> motionNotifyStateCache); PutUINT(value, outputMessage + 24, bigEndian_); } break; case X_QueryTree: { unsigned int children; decodeBuffer.decodeValue(children, 16, 8); outputLength = 32 + (children << 2); outputMessage = writeBuffer_.addMessage(outputLength); PutULONG(outputLength, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> queryTreeWindowCache); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> queryTreeWindowCache); PutULONG(value, outputMessage + 12, bigEndian_); unsigned char *next = outputMessage + 32; PutUINT(children, outputMessage + 16, bigEndian_); for (unsigned int i = 0; i < children; i++) { decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> queryTreeWindowCache); PutULONG(value, next + (i * 4), bigEndian_); } } break; case X_TranslateCoords: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeBoolValue(value); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> translateCoordsChildCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> translateCoordsXCache, 8); PutUINT(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> translateCoordsYCache, 8); PutUINT(value, outputMessage + 14, bigEndian_); } break; case X_GetImage: { MessageStore *messageStore = serverStore_ -> getReplyStore(X_GetImage); if (handleDecodeCached(decodeBuffer, serverCache_, messageStore, outputMessage, outputLength)) { break; } // Depth. decodeBuffer.decodeCachedValue(cValue, 8, serverCache_ -> depthCache); // Reply length. unsigned int replyLength; decodeBuffer.decodeValue(replyLength, 32, 9); outputLength = 32 + (replyLength << 2); outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = (unsigned char) cValue; // Visual. unsigned int visual; decodeBuffer.decodeCachedValue(visual, 29, serverCache_ -> visualCache); PutULONG(visual, outputMessage + 8, bigEndian_); // Since ProtoStep8 (#issue 108) handleCopy(decodeBuffer, requestOpcode, messageStore -> dataOffset, outputMessage, outputLength); handleSave(messageStore, outputMessage, outputLength); } break; case X_GetPointerMapping: { unsigned int nextByte; decodeBuffer.decodeValue(nextByte, 8, 4); unsigned int replyLength; decodeBuffer.decodeValue(replyLength, 32, 4); outputLength = 32 + (replyLength << 2); outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = (unsigned char) nextByte; unsigned char *nextDest = outputMessage + 32; for (unsigned int i = 32; i < outputLength; i++) { decodeBuffer.decodeValue(nextByte, 8, 4); *nextDest++ = (unsigned char) nextByte; } } break; case X_GetKeyboardControl: { unsigned int nextByte; decodeBuffer.decodeValue(nextByte, 8, 2); unsigned int replyLength; decodeBuffer.decodeValue(replyLength, 32, 8); outputLength = 32 + (replyLength << 2); outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = (unsigned char) nextByte; unsigned char *nextDest = outputMessage + 8; for (unsigned int i = 8; i < outputLength; i++) { decodeBuffer.decodeValue(nextByte, 8, 4); *nextDest++ = (unsigned char) nextByte; } } break; default: { if (requestOpcode == opcodeStore_ -> getUnpackParameters) { #ifdef TEST *logofs << "handleWrite: Received get unpack parameters reply " << "OPCODE#" << (unsigned int) opcodeStore_ -> getUnpackParameters << ".\n" << logofs_flush; #endif outputLength = 32 + PACK_METHOD_LIMIT; outputMessage = writeBuffer_.addMessage(outputLength); unsigned int method; // // Let agent use only the unpack methods // implemented at both sides. // for (int i = 0; i < PACK_METHOD_LIMIT; i++) { decodeBuffer.decodeBoolValue(method); control -> RemoteUnpackMethods[i] = method; *(outputMessage + 32 + i) = (control -> LocalUnpackMethods[i] == 1 && method == 1); } } else if (requestOpcode == opcodeStore_ -> getShmemParameters) { if (handleShmemReply(decodeBuffer, requestOpcode, outputMessage, outputLength) < 0) { return -1; } } else if (requestOpcode == opcodeStore_ -> getFontParameters) { if (handleFontReply(decodeBuffer, requestOpcode, outputMessage, outputLength) < 0) { return -1; } } else { #ifdef PANIC *logofs << "handleWrite: PANIC! No matching request for " << "reply with sequence number " << sequenceNum << ".\n" << logofs_flush; #endif cerr << "Error" << ": No matching request for " << "reply with sequence number " << sequenceNum << ".\n"; return -1; } } } #if defined(TEST) || defined(OPCODES) *logofs << "handleWrite: Handled reply to OPCODE#" << (unsigned) requestOpcode << " (" << DumpOpcode(requestOpcode) << ")" << " for FD#" << fd_ << " with sequence " << serverSequence_ << ". Output size is " << outputLength << ".\n" << logofs_flush; #endif statistics -> addRepliedRequest(requestOpcode); } else // End of if (sequenceQueue_.peek() && ...) { // // Reply didn't match any request opcode. // Check again if differential encoding // is disabled. // #ifdef DEBUG *logofs << "handleWrite: Identified generic reply.\n" << logofs_flush; #endif requestOpcode = X_Reply; if (control -> RemoteDeltaCompression == 0) { int result = handleFastWriteReply(decodeBuffer, requestOpcode, outputMessage, outputLength); if (result < 0) { return -1; } else if (result > 0) { continue; } } // // All replies whose opcode is not pushed in // sequence number queue are cached together. // Among such replies are those to extension // requests. // MessageStore *messageStore = serverStore_ -> getReplyStore(X_NXInternalGenericReply); handleDecode(decodeBuffer, serverCache_, messageStore, requestOpcode, outputMessage, outputLength); #if defined(TEST) || defined(OPCODES) *logofs << "handleWrite: Handled generic reply for FD#" << fd_ << " with sequence " << serverSequence_ << ". Output size is " << outputLength << ".\n" << logofs_flush; #endif statistics -> addRepliedRequest(requestOpcode); } // End of if (sequenceQueue_.peek() && ...) else ... // // If any output was produced then write opcode, // sequence number and size to the buffer. // if (outputLength > 0) { *outputMessage = outputOpcode; PutUINT(serverSequence_, outputMessage + 2, bigEndian_); PutULONG((outputLength - 32) >> 2, outputMessage + 4, bigEndian_); } } // End of if (outputOpcode == 1)... else { // // It's an event or error. // unsigned int sequenceNum; unsigned int sequenceDiff; decodeBuffer.decodeCachedValue(sequenceDiff, 16, serverCache_ -> eventSequenceCache, 7); sequenceNum = (serverSequence_ + sequenceDiff) & 0xffff; serverSequence_ = sequenceNum; #ifdef DEBUG *logofs << "handleWrite: Last server sequence number for FD#" << fd_ << " is " << serverSequence_ << " with " << "difference " << sequenceDiff << ".\n" << logofs_flush; #endif // // Check if this is an error that matches // a sequence number for which we were // expecting a reply. // if (outputOpcode == X_Error) { unsigned short int errorSequenceNum; unsigned char errorOpcode; if (sequenceQueue_.peek(errorSequenceNum, errorOpcode) && ((unsigned) errorSequenceNum == serverSequence_)) { // // Remove the queued sequence of the reply. // #ifdef TEST *logofs << "handleWrite: WARNING! Removing reply to OPCODE#" << (unsigned) errorOpcode << " sequence " << errorSequenceNum << " for FD#" << fd_ << " due to error.\n" << logofs_flush; #endif sequenceQueue_.pop(errorSequenceNum, errorOpcode); // // Send to the client the current sequence // number, not the number that matched the // reply. Because we are generating replies // at our side, Xlib can incur in a sequence // lost if the error comes after the auto- // generated reply. // if (control -> SessionMode == session_proxy) { #ifdef TEST *logofs << "handleWrite: Updating last event's sequence " << lastSequence_ << " to X server's error sequence " << "number " << serverSequence_ << " for FD#" << fd_ << ".\n" << logofs_flush; #endif lastSequence_ = serverSequence_; } } // // In case of errors always send to client the // original X server's sequence associated to // the failing request. // if (control -> SessionMode != session_proxy) { #ifdef TEST *logofs << "handleWrite: Updating last event's sequence " << lastSequence_ << " to X server's error sequence " << "number " << serverSequence_ << " for FD#" << fd_ << ".\n" << logofs_flush; #endif lastSequence_ = serverSequence_; } } // // Check if by producing events at client side we // have modified the events' sequence numbering. // In this case taint the original sequence to // comply with the last one known by client. // /* FIXME: Recover the sequence number if the proxy is not connected to an agent. */ if (serverSequence_ > lastSequence_ || control -> SessionMode != session_proxy) { #ifdef DEBUG *logofs << "handleWrite: Updating last event's sequence " << lastSequence_ << " to X server's sequence number " << serverSequence_ << " for FD#" << fd_ << ".\n" << logofs_flush; #endif lastSequence_ = serverSequence_; } #ifdef DEBUG else if (serverSequence_ < lastSequence_) { // // Use our last auto-generated sequence. // *logofs << "handleWrite: Tainting sequence number " << serverSequence_ << " to last event's sequence " << lastSequence_ << " for FD#" << fd_ << ".\n" << logofs_flush; } #endif // // Check if remote side used fast encoding. // if (control -> RemoteDeltaCompression == 0) { int result = handleFastWriteEvent(decodeBuffer, outputOpcode, outputMessage, outputLength); if (result < 0) { return -1; } else if (result > 0) { continue; } } // // Make space for message in the outgoing buffer // and write opcode and sequence number. // outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); *outputMessage = outputOpcode; PutUINT(lastSequence_, outputMessage + 2, bigEndian_); #ifdef DEBUG *logofs << "handleWrite: Going to handle event or error OPCODE#" << (unsigned int) outputOpcode << " for FD#" << fd_ << " sequence " << lastSequence_ << " (real was " << serverSequence_ << ").\n" << logofs_flush; #endif switch (outputOpcode) { case X_Error: { unsigned char code; decodeBuffer.decodeCachedValue(code, 8, serverCache_ -> errorCodeCache); outputMessage[1] = code; #if defined(TEST) || defined(OPCODES) *logofs << "handleWrite: Handled error ERR_CODE#" << (unsigned int) code << " for FD#" << fd_; #endif if ((code != 11) && (code != 8) && (code != 15) && (code != 1)) { decodeBuffer.decodeValue(value, 32, 16); PutULONG(value, outputMessage + 4, bigEndian_); #if defined(TEST) || defined(OPCODES) *logofs << " RES_ID#" << value; #endif } if (code >= 18) { decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> errorMinorCache); PutUINT(value, outputMessage + 8, bigEndian_); #if defined(TEST) || defined(OPCODES) *logofs << " MIN_OP#" << value; #endif } decodeBuffer.decodeCachedValue(cValue, 8, serverCache_ -> errorMajorCache); outputMessage[10] = cValue; #if defined(TEST) || defined(OPCODES) *logofs << " MAJ_OP#" << (unsigned int) cValue; #endif if (code >= 18) { unsigned char *nextDest = outputMessage + 11; for (unsigned int i = 11; i < 32; i++) { decodeBuffer.decodeValue(value, 8); *nextDest++ = (unsigned char) cValue; } } #if defined(TEST) || defined(OPCODES) *logofs << " sequence " << lastSequence_ << " (real was " << serverSequence_ << ") . Size is " << (unsigned int) outputLength << ".\n" << logofs_flush; #endif } break; case ButtonPress: case ButtonRelease: case KeyPress: case KeyRelease: case MotionNotify: case EnterNotify: case LeaveNotify: { if (outputOpcode == MotionNotify) { decodeBuffer.decodeBoolValue(value); } else if (outputOpcode == EnterNotify || outputOpcode == LeaveNotify) { decodeBuffer.decodeValue(value, 3); } else if (outputOpcode == KeyRelease) { decodeBuffer.decodeBoolValue(value); if (value) { value = serverCache_ -> keyPressLastKey; } else { decodeBuffer.decodeValue(value, 8); } } else if (outputOpcode == ButtonPress || outputOpcode == ButtonRelease) { decodeBuffer.decodeCachedValue(cValue, 8, serverCache_ -> buttonCache); value = (unsigned int) cValue; } else { decodeBuffer.decodeValue(value, 8); } outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 32, serverCache_ -> motionNotifyTimestampCache, 9); serverCache_ -> lastTimestamp += value; PutULONG(serverCache_ -> lastTimestamp, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 8; int skipRest = 0; if (outputOpcode == KeyRelease) { decodeBuffer.decodeBoolValue(value); if (value) { for (unsigned int i = 0; i < 23; i++) { *nextDest++ = serverCache_ -> keyPressCache[i]; } skipRest = 1; } } if (!skipRest) { for (unsigned int i = 0; i < 3; i++) { decodeBuffer.decodeCachedValue(value, 29, *serverCache_ -> motionNotifyWindowCache[i], 6); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> motionNotifyRootXCache, 6); serverCache_ -> motionNotifyLastRootX += value; PutUINT(serverCache_ -> motionNotifyLastRootX, outputMessage + 20, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> motionNotifyRootYCache, 6); serverCache_ -> motionNotifyLastRootY += value; PutUINT(serverCache_ -> motionNotifyLastRootY, outputMessage + 22, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> motionNotifyEventXCache, 6); PutUINT(serverCache_ -> motionNotifyLastRootX + value, outputMessage + 24, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> motionNotifyEventYCache, 6); PutUINT(serverCache_ -> motionNotifyLastRootY + value, outputMessage + 26, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> motionNotifyStateCache); PutUINT(value, outputMessage + 28, bigEndian_); if (outputOpcode == EnterNotify || outputOpcode == LeaveNotify) { decodeBuffer.decodeValue(value, 2); } else { decodeBuffer.decodeBoolValue(value); } outputMessage[30] = (unsigned char) value; if (outputOpcode == EnterNotify || outputOpcode == LeaveNotify) { decodeBuffer.decodeValue(value, 2); outputMessage[31] = (unsigned char) value; } else if (outputOpcode == KeyPress) { serverCache_ -> keyPressLastKey = outputMessage[1]; for (unsigned int i = 8; i < 31; i++) { serverCache_ -> keyPressCache[i - 8] = outputMessage[i]; } } } } break; case ColormapNotify: { decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> colormapNotifyWindowCache, 8); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> colormapNotifyColormapCache, 8); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeBoolValue(value); outputMessage[12] = (unsigned char) value; decodeBuffer.decodeBoolValue(value); outputMessage[13] = (unsigned char) value; } break; case ConfigureNotify: { unsigned char *nextDest = outputMessage + 4; for (unsigned int i = 0; i < 3; i++) { decodeBuffer.decodeCachedValue(value, 29, *serverCache_ -> configureNotifyWindowCache[i], 9); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } for (unsigned int j = 0; j < 5; j++) { decodeBuffer.decodeCachedValue(value, 16, *serverCache_ -> configureNotifyGeomCache[j], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } decodeBuffer.decodeBoolValue(value); *nextDest = value; } break; case CreateNotify: { decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> createNotifyWindowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 29, 5); serverCache_ -> createNotifyLastWindow += value; serverCache_ -> createNotifyLastWindow &= 0x1fffffff; PutULONG(serverCache_ -> createNotifyLastWindow, outputMessage + 8, bigEndian_); unsigned char* nextDest = outputMessage + 12; for (unsigned int i = 0; i < 5; i++) { decodeBuffer.decodeValue(value, 16, 9); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } decodeBuffer.decodeBoolValue(value); *nextDest = (unsigned char) value; } break; case Expose: { decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> exposeWindowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 8; for (unsigned int i = 0; i < 5; i++) { decodeBuffer.decodeCachedValue(value, 16, *serverCache_ -> exposeGeomCache[i], 6); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } break; case FocusIn: case FocusOut: { decodeBuffer.decodeValue(value, 3); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> focusInWindowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 2); outputMessage[8] = (unsigned char) value; } break; case KeymapNotify: { decodeBuffer.decodeBoolValue(value); if (value) memcpy(outputMessage + 1, ServerCache::lastKeymap.getData(), 31); else { unsigned char *nextDest = outputMessage + 1; for (unsigned int i = 1; i < 32; i++) { decodeBuffer.decodeValue(value, 8); *nextDest++ = (unsigned char) value; } ServerCache::lastKeymap.set(31, outputMessage + 1); } } break; case MapNotify: case UnmapNotify: case DestroyNotify: { decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> mapNotifyEventCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> mapNotifyWindowCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); if (outputOpcode == MapNotify || outputOpcode == UnmapNotify) { decodeBuffer.decodeBoolValue(value); outputMessage[12] = (unsigned char) value; } } break; case NoExpose: { decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> noExposeDrawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_ -> noExposeMinorCache); PutUINT(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(cValue, 8, serverCache_ -> noExposeMajorCache); outputMessage[10] = cValue; } break; case PropertyNotify: { decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> propertyNotifyWindowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> propertyNotifyAtomCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 32, 9); serverCache_ -> lastTimestamp += value; PutULONG(serverCache_ -> lastTimestamp, outputMessage + 12, bigEndian_); decodeBuffer.decodeBoolValue(value); outputMessage[16] = (unsigned char) value; } break; case ReparentNotify: { unsigned char* nextDest = outputMessage + 4; for (unsigned int i = 0; i < 3; i++) { decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> reparentNotifyWindowCache, 9); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } decodeBuffer.decodeValue(value, 16, 6); PutUINT(value, nextDest, bigEndian_); decodeBuffer.decodeValue(value, 16, 6); PutUINT(value, nextDest + 2, bigEndian_); decodeBuffer.decodeBoolValue(value); outputMessage[20] = (unsigned char)value; } break; case SelectionClear: { decodeBuffer.decodeValue(value, 32, 9); serverCache_ -> lastTimestamp += value; PutULONG(serverCache_ -> lastTimestamp, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> selectionClearWindowCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> selectionClearAtomCache, 9); PutULONG(value, outputMessage + 12, bigEndian_); } break; case SelectionRequest: { decodeBuffer.decodeValue(value, 32, 9); serverCache_ -> lastTimestamp += value; PutULONG(serverCache_ -> lastTimestamp, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> selectionClearWindowCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> selectionClearWindowCache, 9); PutULONG(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> selectionClearAtomCache, 9); PutULONG(value, outputMessage + 16, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> selectionClearAtomCache, 9); PutULONG(value, outputMessage + 20, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> selectionClearAtomCache, 9); PutULONG(value, outputMessage + 24, bigEndian_); } break; case VisibilityNotify: { decodeBuffer.decodeCachedValue(value, 29, serverCache_ -> visibilityNotifyWindowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 2); outputMessage[8] = (unsigned char) value; } break; default: { #ifdef TEST *logofs << "handleWrite: Using generic event compression " << "for OPCODE#" << (unsigned int) outputOpcode << ".\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(*(outputMessage + 1), 8, serverCache_ -> genericEventCharCache); for (unsigned int i = 0; i < 14; i++) { decodeBuffer.decodeCachedValue(value, 16, *serverCache_ -> genericEventIntCache[i]); PutUINT(value, outputMessage + i * 2 + 4, bigEndian_); } } } // End of switch (outputOpcode)... #if defined(TEST) || defined(OPCODES) if (outputOpcode != X_Error) { *logofs << "handleWrite: Handled event OPCODE#" << (unsigned int) outputOpcode << " for FD#" << fd_ << " sequence " << lastSequence_ << " (real was " << serverSequence_ << "). Size is " << outputLength << ".\n" << logofs_flush; } #endif // // Check if we need to suppress the error. // if (outputOpcode == X_Error && handleTaintSyncError(*(outputMessage + 10)) > 0) { #if defined(TEST) || defined(OPCODES) *logofs << "handleWrite: WARNING! Suppressed error OPCODE#" << (unsigned int) outputOpcode << " for FD#" << fd_ << " sequence " << lastSequence_ << ".\n" << logofs_flush; #endif writeBuffer_.removeMessage(32); } } // End of if (outputOpcode == 1)... else ... // // Check if we produced enough data. We need to // decode all provided messages. Just update the // finish flag in case of failure. // handleFlush(flush_if_needed); } // End of while (decodeBuffer.decodeOpcodeValue(outputOpcode, 8, ... } // End of the decoding block. // // Write any remaining data to the X connection. // if (handleFlush(flush_if_any) < 0) { return -1; } return 1; } // // End of handleWrite(). // // // Other members. // int ClientChannel::handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, T_store_action action, int position, const unsigned char opcode, const unsigned char *buffer, const unsigned int size) { #if defined(TEST) || defined(SPLIT) // Since ProtoStep8 (#issue 108) *logofs << "handleSplit: PANIC! SPLIT! Split should " << "not be enabled for message " << "OPCODE#" << (unsigned int) store -> opcode() << ".\n" << logofs_flush; HandleCleanup(); #endif // // Refuse the split if it is not introduced // by a start split. // // Since ProtoStep7 (#issue 108) if (splitState_.resource == nothing || enableSplit_ == 0) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Nothing to do for message " << "OPCODE#" << (unsigned int) store -> opcode() << " of size " << size << " position " << position << " with action [" << DumpAction(action) << "] at " << strMsTimestamp() << ".\n" << logofs_flush; #endif encodeBuffer.encodeBoolValue(0); return 0; } // // It's not advisable to allocate the store at // the time we receive the start-split because // we may process all the splits received and // deallocate the store even before we receive // the end split. Another message for the same // split sequence may then come and we would // have a null split store. // handleSplitStoreAlloc(&splitResources_, splitState_.resource); // // Check if the split was actually requested by // the agent and if the request was saved in the // message store. The split can also be refused // if the message is smaller than the threshold // or if the split store is already full. // if (mustSplitMessage(splitState_.resource) == 0) { if (action == IS_HIT || canSplitMessage(splitState_.mode, size) == 0) { #if defined(TEST) || defined(SPLIT) if (splitState_.mode == split_none) { #ifdef PANIC *logofs << "handleSplit: PANIC! SPLIT! Split state has " << "mode 'none'.\n" << logofs_flush; #endif HandleCleanup(); } if (action != IS_HIT && (int) size >= control -> SplitDataThreshold) { #ifdef WARNING *logofs << "handleSplit: WARNING! SPLIT! Split stores have " << clientStore_ -> getSplitTotalSize() << " messages " << "and " << clientStore_ -> getSplitTotalStorageSize() << " allocated bytes.\n" << logofs_flush; #endif } #endif #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Message OPCODE#" << (unsigned int) store -> opcode() << " of size " << size << " [not split] with resource " << splitState_.resource << " mode " << splitState_.mode << " position " << position << " and action [" << DumpAction(action) << "] at " << strMsTimestamp() << ".\n" << logofs_flush; #endif encodeBuffer.encodeBoolValue(0); return 0; } } #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Message OPCODE#" << (unsigned int) store -> opcode() << " of size " << size << " [split] with resource " << splitState_.resource << " mode " << splitState_.mode << " position " << position << " and action [" << DumpAction(action) << "] at " << strMsTimestamp() << ".\n" << logofs_flush; #endif encodeBuffer.encodeBoolValue(1); T_checksum checksum = NULL; if (action == IS_ADDED) { checksum = store -> getChecksum(position); } else if (action == is_discarded) { // // Generate the checksum on the fly. // checksum = store -> getChecksum(buffer, size, bigEndian_); } // // The method must abort the connection // if it can't allocate the split. // Split *splitMessage = clientStore_ -> getSplitStore(splitState_.resource) -> add(store, splitState_.resource, splitState_.mode, position, action, checksum, buffer, size); // // Send the checksum. By using the checksum, // the remote end will try to locate the // message and load it from disk. // if (action == IS_HIT) { splitMessage -> setState(split_loaded); } else if (handleSplitChecksum(encodeBuffer, checksum) == 0) { // // If the checksum is not sent, for example // because loading of messages from disk is // disabled, then mark the split as missed. // #ifdef WARNING *logofs << "handleSplit: WARNING! Checksum not sent. " << "Marking the split as [missed].\n" << logofs_flush; #endif splitMessage -> setState(split_missed); } if (action == is_discarded) { delete [] checksum; } // // Check if we are ready to send a new split // for this store. // handleSplitPending(splitState_.resource); #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! There are " << clientStore_ -> getSplitTotalSize() << " messages and " << clientStore_ -> getSplitTotalStorageSize() << " bytes to send in " << "the split stores.\n" << logofs_flush; clientStore_ -> dumpSplitStore(splitState_.resource); #endif return 1; } int ClientChannel::handleSplit(EncodeBuffer &encodeBuffer) { // // Determine the maximum amount of bytes // we can write in this iteration. // int total = control -> SplitDataPacketLimit; int bytes = total; int splits = 0; #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Handling splits " << "for FD#" << fd_ << " with " << clientStore_ -> getSplitTotalSize() << " elements and " << total << " bytes to write at " << strMsTimestamp() << ".\n" << logofs_flush; #endif if (proxy -> handleAsyncSwitch(fd_) < 0) { return -1; } #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Looping to find " << "if there is any split to send.\n" << logofs_flush; #endif SplitStore *splitStore; Split *splitMessage; // // Divide the available bandwidth among all the active // split stores by implementing a simple round-robin // mechanism. This can be extended by using an external // function returning the number of bytes to be written // based on the state of the split (splits which didn't // receive yet a confirmation event could be delayed), // the current bitrate, and by letting the agent asso- // ciate a priority to the resource in the start split // operation. // splitState_.pending = 0; splitResources_.rotate(); // // Copy the list since elements can be removed // in the middle of the loop. // T_list splitList = splitResources_.copyList(); for (T_list::iterator j = splitList.begin(); j != splitList.end(); j++) { int resource = *j; #ifdef DEBUG *logofs << "handleSplit: SPLIT! Looping with current " << "resource " << resource << ".\n" << logofs_flush; #endif splitStore = clientStore_ -> getSplitStore(resource); if (splitStore != NULL) { // // Don't send more than the the packet size // bytes but ensure that we abort any split // found in the disk cache. // for (;;) { #if defined(TEST) || defined(SPLIT) clientStore_ -> dumpSplitStore(resource); #endif splitMessage = splitStore -> getFirstSplit(); if (splitMessage == NULL) { // // We have created the store after a start // split but no message was added yet. // #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: WARNING! SPLIT! The split store " << "is still empty.\n" << logofs_flush; #endif break; } // // Splits already aborted can't be in the // split store. // #if defined(TEST) || defined(SPLIT) if (splitMessage -> getState() == split_aborted) { *logofs << "handleSplit: PANIC! SPLIT! Found an " << "aborted split in store [" << resource << "].\n" << logofs_flush; HandleCleanup(); } #endif // // Check if there are more messages in the // store that can be aborted or if we have // exceeded the number of bytes we can send // for this iteration. // #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Checking closure " << "of the inner loop with " << bytes << " bytes to write and split state [" << DumpState(splitMessage -> getState()) << "].\n" << logofs_flush; #endif if ((splitMessage -> getMode() == split_sync && splitMessage -> getState() == split_added) || (bytes <= 0 && splitMessage -> getState() != split_loaded)) { break; } // // If the split was loaded at the remote // side abort it immediately. // if (splitMessage -> getState() == split_loaded) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Sending more data " << "for store [" << resource << "] with " << "a split to be aborted.\n" << logofs_flush; #endif if (handleSplitSend(encodeBuffer, resource, splits, bytes) < 0) { return -1; } } else if (bytes > 0) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Sending more data " << "for store [" << resource << "] with " << bytes << " bytes to send.\n" << logofs_flush; #endif if (handleSplitSend(encodeBuffer, resource, splits, bytes) < 0) { return -1; } } // // Check if the split store was deleted. // splitStore = clientStore_ -> getSplitStore(resource); if (splitStore == NULL) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Exiting from the " << "inner loop with split store [" << resource << "] destroyed.\n" << logofs_flush; #endif break; } } #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Completed handling splits " << "for store [" << resource << "] with " << bytes << " bytes still to send.\n" << logofs_flush; #endif // // Check if there is still a split to // send for the store just processed. // handleSplitPending(resource); } } #if defined(TEST) || defined(SPLIT) if (splits == 0) { #ifdef PANIC *logofs << "handleSplit: PANIC! Function called but " << "no split message was sent.\n" << logofs_flush; #endif HandleCleanup(); } *logofs << "handleSplit: SPLIT! Sent " << splits << " splits and " << total - bytes << " bytes for FD#" << fd_ << " with " << clientStore_ -> getSplitTotalStorageSize() << " bytes and [" << clientStore_ -> getSplitTotalSize() << "] splits remaining.\n" << logofs_flush; *logofs << "handleSplit: SPLIT! The pending split flag is " << splitState_.pending << " with " << clientStore_ -> getSplitTotalSize() << " splits in the split stores.\n" << logofs_flush; clientStore_ -> dumpSplitStores(); #endif return 1; } int ClientChannel::handleSplitSend(EncodeBuffer &encodeBuffer, int resource, int &splits, int &bytes) { #if defined(TEST) || defined(SPLIT) SplitStore *splitStore = clientStore_ -> getSplitStore(resource); Split *splitMessage = splitStore -> getFirstSplit(); if (splitStore -> getResource() != resource || splitMessage -> getResource() != resource) { #ifdef PANIC *logofs << "handleSplitSend: PANIC! The resource doesn't " << "match the split store.\n" << logofs_flush; #endif HandleCleanup(); } *logofs << "handleSplitSend: SPLIT! Sending message " << "OPCODE#" << (unsigned) opcodeStore_ -> splitData << " for resource " << splitMessage -> getResource() << " with request " << splitMessage -> getRequest() << " position " << splitMessage -> getPosition() << " and " << bytes << " bytes to write.\n" << logofs_flush; #endif // // Use a special opcode to signal the other // side this is part of a split and not a // new message. // encodeBuffer.encodeOpcodeValue(opcodeStore_ -> splitData, clientCache_ -> opcodeCache); encodeBuffer.encodeCachedValue(resource, 8, clientCache_ -> resourceCache); int result = clientStore_ -> getSplitStore(resource) -> send(encodeBuffer, bytes); if (result < 0) { #ifdef PANIC *logofs << "handleSplit: PANIC! Error sending splits for FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": Error sending splits for FD#" << fd_ << ".\n"; return -1; } // // Get the bits written and update the // statistics for this special opcode. // int bits = encodeBuffer.diffBits(); #if defined(TEST) || defined(SPLIT)|| defined(OPCODES) *logofs << "handleSplitSend: SPLIT! Handled request OPCODE#" << (unsigned int) opcodeStore_ -> splitData << " (" << DumpOpcode(opcodeStore_ -> splitData) << ")" << " for FD#" << fd_ << " sequence none. 0 bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; #endif statistics -> addRequestBits(opcodeStore_ -> splitData, 0, bits); bytes -= bits >> 3; splits++; if (result == 1) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitSend: SPLIT! Split at the head " << "of the list was completely transferred.\n" << logofs_flush; #endif // // The split at the head of the list was // completely transferred. // handleRestart(sequence_deferred, resource); } #if defined(TEST) || defined(SPLIT) else { *logofs << "handleSplitSend: SPLIT! More data to send " << "for the split at the head of the list.\n" << logofs_flush; } #endif return result; } int ClientChannel::handleSplitChecksum(EncodeBuffer &encodeBuffer, T_checksum checksum) { // // Send the checksum only if the loading // or the saving of the message to the // persistent image cache is enabled. // if ((control -> ImageCacheEnableLoad == 1 || control -> ImageCacheEnableSave == 1) && (enableLoad_ == 1 || enableSave_ == 1)) { encodeBuffer.encodeBoolValue(1); for (unsigned int i = 0; i < MD5_LENGTH; i++) { encodeBuffer.encodeValue((unsigned int) checksum[i], 8); } #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitChecksum: SPLIT! Sent checksum " << "[" << DumpChecksum(checksum) << "].\n" << logofs_flush; #endif return 1; } else { encodeBuffer.encodeBoolValue(0); return 0; } } void ClientChannel::handleSplitPending() { #if defined(TEST) || defined(SPLIT) int previous = splitState_.pending; #endif if (clientStore_ -> getSplitTotalSize() == 0) { splitState_.pending = 0; #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitPending: SPLIT! Set the pending " << "split flag to " << splitState_.pending << " with split stores empty.\n" << logofs_flush; #endif } else { // // Loop through the stores to find if // there is any split that has become // ready. // #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitPending: WARNING! SPLIT! Looping to " << "find if there is any split pending.\n" << logofs_flush; #endif splitState_.pending = 0; T_list &splitList = splitResources_.getList(); for (T_list::iterator j = splitList.begin(); j != splitList.end(); j++) { int resource = *j; SplitStore *splitStore = clientStore_ -> getSplitStore(resource); if (splitStore != NULL) { #if defined(TEST) || defined(SPLIT) clientStore_ -> dumpSplitStore(resource); #endif Split *splitMessage = splitStore -> getFirstSplit(); if (splitMessage != NULL && canSendSplit(splitMessage) == 1) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitPending: SPLIT! Found a pending " << "split in store [" << resource << "].\n" << logofs_flush; #endif splitState_.pending = 1; #if defined(TEST) || defined(SPLIT) if (splitMessage -> getState() == split_loaded) { *logofs << "handleSplitPending: PANIC! SPLIT! Found a " << "loaded split in store [" << resource << "].\n" << logofs_flush; HandleCleanup(); } #endif break; } } } #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitPending: SPLIT! Set the pending " << "split flag to " << splitState_.pending << " with " << clientStore_ -> getSplitTotalSize() << " splits in the split stores.\n" << logofs_flush; #endif } #if defined(TEST) || defined(SPLIT) if (splitState_.pending != previous) { *logofs << "handleSplitPending: SPLIT! Pending state " << "changed from " << previous << " to " << splitState_.pending << ".\n" << logofs_flush; } #endif } int ClientChannel::handleSplitEvent(EncodeBuffer &encodeBuffer, Split *splitMessage) { SplitStore *splitStore; int resource = splitMessage -> getResource(); #if defined(TEST) || defined(INFO) splitStore = clientStore_ -> getSplitStore(resource); if (splitStore == NULL) { #ifdef PANIC *logofs << "handleSplitEvent: PANIC! The split store can't " << "be NULL handling abort splits.\n" << logofs_flush; #endif HandleCleanup(); } else if (splitMessage -> getState() != split_loaded) { *logofs << "handleSplitEvent: PANIC! Can't find the split " << "to be aborted.\n" << logofs_flush; HandleCleanup(); } #endif // // Send any split that it is possible to // abort until the store is either empty // or the next split can't be aborted. // if (proxy -> handleAsyncSwitch(fd_) < 0) { return -1; } while ((splitStore = clientStore_ -> getSplitStore(resource)) != NULL && (splitMessage = splitStore -> getFirstSplit()) != NULL && splitMessage -> getState() == split_loaded) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitEvent: SPLIT! Aborting split with " << "checksum [" << DumpChecksum(splitMessage -> getChecksum()) << "] for resource " << resource << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif int any = 0; if (handleSplitSend(encodeBuffer, resource, any, any) < 0) { return -1; } } #if defined(TEST) || defined(SPLIT) if ((splitStore = clientStore_ -> getSplitStore(resource)) == NULL) { *logofs << "handleSplitEvent: SPLIT! The split store [" << resource << "] has been destroyed.\n" << logofs_flush; } else if ((splitMessage = splitStore -> getFirstSplit()) == NULL) { *logofs << "handleSplitEvent: SPLIT! The split store [" << resource << "] is empty.\n" << logofs_flush; } else if (splitMessage -> getState() != split_loaded) { *logofs << "handleSplitEvent: SPLIT! The split at the " << "head of store [" << resource << "] doesn't " << "need to be aborted.\n" << logofs_flush; } #endif return 1; } int ClientChannel::handleSplitEvent(DecodeBuffer &decodeBuffer) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitEvent: SPLIT! Handling abort " << "split messages for FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif // Since ProtoStep7 (#issue 108) // // Decode the information about the // message to be updated. // unsigned char resource; decodeBuffer.decodeCachedValue(resource, 8, serverCache_ -> resourceCache); unsigned int loaded; decodeBuffer.decodeBoolValue(loaded); unsigned char request; unsigned int size; if (loaded == 1) { decodeBuffer.decodeOpcodeValue(request, serverCache_ -> abortOpcodeCache); decodeBuffer.decodeValue(size, 32, 14); } else { request = 0; size = 0; } unsigned int value; md5_byte_t checksum[MD5_LENGTH]; for (unsigned int i = 0; i < MD5_LENGTH; i++) { decodeBuffer.decodeValue(value, 8); checksum[i] = (unsigned char) value; } #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitEvent: SPLIT! Checking split " << "with checksum [" << DumpChecksum(checksum) << "] loaded " << loaded << " request " << (unsigned int) request << " compressed size " << size << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif Split *splitMessage = handleSplitFind(checksum, resource); if (splitMessage != NULL) { if (loaded == 1) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitEvent: SPLIT! Marked split with " << "checksum [" << DumpChecksum(checksum) << "] " << "as [loaded] at " << strMsTimestamp() << ".\n" << logofs_flush; #endif splitMessage -> setState(split_loaded); #if defined(TEST) || defined(SPLIT) if (splitMessage -> compressedSize() != (int) size) { *logofs << "handleSplitEvent: WARNING! SPLIT! Updating " << "compressed data size from " << splitMessage -> compressedSize() << " to " << size << ".\n" << logofs_flush; } #endif splitMessage -> compressedSize(size); // // The splits to be aborted are checked by the split // store at the time we are going to send a new chunk // of split data. The splits must be strictly handled // in the same order as they were added to the split // store and the split we want to abort here may be // not at the head of the list. // if (splitMessage == clientStore_ -> getSplitStore(resource) -> getFirstSplit()) { // // We don't need to flush this packet immediately. // The abort can be sent at any time to the remote // proxy. What's important is that we restart the // agent resource as soon as possible. // #if defined(TEST) || defined(SPLIT) T_timestamp startTs = getTimestamp(); *logofs << "handleSplitEvent: SPLIT! Encoding abort " << "split events for FD#" << fd_ << " with " << "resource " << (unsigned) resource << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif if (proxy -> handleAsyncSplit(fd_, splitMessage) < 0) { return -1; } #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitEvent: SPLIT! Spent " << diffTimestamp(startTs, getTimestamp()) << " ms " << "handling abort split events for FD#" << fd_ << ".\n" << logofs_flush; #endif // // Check if we can clear the pending flag. // handleSplitPending(); } #if defined(TEST) || defined(SPLIT) else { *logofs << "handleSplitEvent: WARNING! SPLIT! Abort split " << "event not sent because not at the head " << "of the list.\n" << logofs_flush; } #endif } else { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitEvent: SPLIT! Marked split with " << "checksum [" << DumpChecksum(checksum) << "] " << "as [missed] at " << strMsTimestamp() << ".\n" << logofs_flush; #endif splitMessage -> setState(split_missed); // // Check if we can set the pending flag. // handleSplitPending(resource); } } else { // // The split report came after the split was already // sent or the split store deleted. If the message // had been loaded from disk by the remote side, we // need to update the compressed size in our message // store or the checksum will not match at the time // we will try to save the message store on disk. // if (loaded == 1 && size != 0) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitEvent: WARNING! SPLIT! Can't find " << "the split. Updating in the message store.\n" << logofs_flush; #endif MessageStore *store = clientStore_ -> getRequestStore(request); if (store != NULL) { store -> updateData(checksum, size); } #if defined(TEST) || defined(SPLIT) else { #ifdef PANIC *logofs << "handleSplitEvent: PANIC! The message store " << "can't be null.\n" << logofs_flush; #endif HandleCleanup(); } #endif } #if defined(TEST) || defined(SPLIT) else { *logofs << "handleSplitEvent: WARNING! SPLIT! No need to " << "update the store with loaded " << loaded << " and compressed size " << size << ".\n" << logofs_flush; } #endif } return 1; } Split *ClientChannel::handleSplitFind(T_checksum checksum, int resource) { // // It can be that we handled all the splits, // restarted the resource and deleted the // store before the event could even reach // our side. // SplitStore *splitStore = clientStore_ -> getSplitStore(resource); if (splitStore != NULL) { Split *splitMessage; T_splits *splitList = splitStore -> getSplits(); for (T_splits::iterator i = splitList -> begin(); i != splitList -> end(); i++) { splitMessage = (*i); if (splitMessage -> getChecksum() != NULL) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitFind: SPLIT! Comparing with message [" << DumpChecksum(splitMessage -> getChecksum()) << "].\n" << logofs_flush; #endif if (memcmp(checksum, splitMessage -> getChecksum(), MD5_LENGTH) == 0) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitFind: SPLIT! Located split for " << "checksum [" << DumpChecksum(checksum) << "] " << "in store [" << splitStore -> getResource() << "].\n" << logofs_flush; #endif return splitMessage; } } } } #if defined(TEST) || defined(SPLIT) else { *logofs << "handleSplitFind: WARNING! SPLIT! The split store " << "was already deleted.\n" << logofs_flush; } #endif #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitFind: WARNING! SPLIT! Can't find the " << "split for checksum [" << DumpChecksum(checksum) << "].\n" << logofs_flush; #endif return NULL; } int ClientChannel::handleRestart(T_sequence_mode mode, int resource) { // // The agent must send a start-split message, followed by the // X messages that may be optionally split by the proxy. Usu- // ally, in the middle of a start-split/end-split sequence is // a single PutImage() or PutPackedImage(), that, in turn, // can generate multiple partial requests, like a SetUnpack- // Colormap() and SetUnpackAlpha() followed by the image that // must be transferred. Multiple requests may be also genera- // ted because the maximum size of a X request has been exce- // eded, so that Xlib has divided the single image in multi- // ple sub-image requests. The agent doesn't need to take care // of that, except tracking the result of the split operation. // // By monitoring the notify events sent by the proxy, the // agent will have to implement its own strategy to deal with // its resources (for example its clients). For example: // // - It will issue a new image request and suspend a client // if the image was not entirely sent in the main X oputput // stream. // // - It will choose to commit or discard the messages after // they are recomposed at the remote side. The set of mes- // sages that will have to be committed will include all // messages that were part of the split (the colormap, the // alpha channel). // // - It will restart its own client, in the case it had been // suspended. // // A more useful strategy would be to replace the original im- // age with a tiny 'placeholder' if a split took place, and // synchronize the content of the drawable at later time. This // is generally referred as 'lazy encoding'. // // The agent will be able to identify the original split ope- // ration (the one marked with the start-spit) by the small // integer number (0-255) referred to as the 'resource' field. // // Before the proxy will be able to report the status of the // split, the agent will have to close the sequence by issuing // an end-split. The proxy will then report the result of the // operation, so that the agent will have the option of suspend- // ing the client or marking the drawable as dirty and take // care of synchronizing it at later time. // // One of the following cases may be encountered: // // notify_no_split: All messages were sent in the main out- // put stream, so that no split actually // took place. // // notify_start_split: One or more messages were split, so, // at discrection of the agent, the client // may be suspended until the transferral // is completed. // // notify_commit_split: One of the requests that made up the // split was recomposed. The agent should // either commit the given request or tell // the proxy to discard it. // // notify_end_split: The split was duly completed. The agent // can restart the client. // // notify_empty_split: No more split operation are pending. // The agent can use this information to // implement specific strategies requiring // that all messages have been recomposed // at the remote end, like updating the // drawables that were not synchronized // because of the lazy encoding. // // By checking the split and commit store we can determine if we // need to send a new notification event to the agent. There can // be four different cases: // // - If the split store is not null and not empty, we are still // in the middle of a split. // // - If the commit store is not empty, we completely recomposed // a full message and can send a new commit notify. // // - If the split store has become empty, we recomposed all the // messages added for the given resource, and so will be able // to restart the resource. // // - If no more messages are in the split stores, we can notify // an empty split event to the agent. // #if defined(TEST) || defined(SPLIT) *logofs << "handleRestart: SPLIT! Handling [" << (mode == sequence_immediate ? "immediate" : "deferred") << "] restart events for resource " << resource << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif SplitStore *splitStore = clientStore_ -> getSplitStore(resource); if (mode == sequence_immediate) { // // We have received an end-split request. If the store // was not deleted already, we mark the last split added // as the one ending the row for this resource. If the // commit() function returns 0 it means that the split // store is either empty or that we did not add any split // for this resource. This is because when connected to // an old proxy version we only have a single store for // all the resources. // // It can happen that all the split messages that were // originally appended to the list were completely sent // before our client had the chance of ending the split // sequence. In this case the split store will be empty // or already deleted and so we will be able to restart // the resource. // #if defined(TEST) || defined(SPLIT) if (splitStore == NULL) { *logofs << "handleRestart: WARNING! SPLIT! Split store [" << resource << "] was already deleted.\n" << logofs_flush; } else { clientStore_ -> dumpSplitStore(resource); } #endif if (splitStore == NULL || splitStore -> getSize() == 0) { #if defined(TEST) || defined(SPLIT) *logofs << "handleRestart: SPLIT! Immediate agent split event " << "TYPE#" << (unsigned) opcodeStore_ -> noSplitNotify << " [no split] with resource " << resource << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif if (handleNotify(notify_no_split, sequence_immediate, resource, nothing, nothing) < 0) { return -1; } } else { #if defined(TEST) || defined(SPLIT) *logofs << "handleRestart: SPLIT! Immediate agent split event " << "TYPE#" << (unsigned) opcodeStore_ -> startSplitNotify << " [start split] with resource " << resource << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif if (handleNotify(notify_start_split, sequence_immediate, resource, nothing, nothing) < 0) { return -1; } } } else { // // We have completely transferred a message // that was put in the split store. // // The id of the resource can be different // than the index of the store if we are // connected to an old proxy. // #if defined(TEST) || defined(SPLIT) if (splitStore == NULL) { #ifdef PANIC *logofs << "handleRestart: PANIC! The split store can't " << "be NULL handling deferred restart events.\n" << logofs_flush; #endif HandleCleanup(); } else { clientStore_ -> dumpSplitStore(resource); } #endif CommitStore *commitStore = clientStore_ -> getCommitStore(); #if defined(TEST) || defined(SPLIT) clientStore_ -> dumpCommitStore(); #endif // // Check if there is any commit to notify. // Split *split; T_splits *commitList = commitStore -> getSplits(); for (T_splits::iterator i = commitList -> begin(); i != commitList -> end(); i++) { split = *i; if (split -> getState() != split_notified) { #if defined(TEST) || defined(SPLIT) if (split -> getResource() != resource) { #ifdef PANIC *logofs << "handleSplitSend: PANIC! The resource doesn't " << "match the split store.\n" << logofs_flush; #endif HandleCleanup(); } #endif int request = split -> getRequest(); int position = split -> getPosition(); #if defined(TEST) || defined(SPLIT) *logofs << "handleRestart: SPLIT! Deferred agent split event " << "TYPE#" << (unsigned) opcodeStore_ -> commitSplitNotify << " [commit split] with resource " << resource << " request " << request << " position " << position << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif if (handleNotify(notify_commit_split, sequence_deferred, resource, request, position) < 0) { return -1; } // // Don't send the notification again. // split -> setState(split_notified); } #if defined(TEST) || defined(SPLIT) else { *logofs << "handleRestart: SPLIT! Split for request " << split -> getRequest() << " and position " << split -> getPosition() << " was already " << "notified.\n" << logofs_flush; } #endif } // // Don't send the end split if we are still // in the middle of a start-split/end-split // sequence. We'll send a no-split at the // time the end-split is received. // if (splitStore -> getSize() == 0 && splitStore -> getResource() != splitState_.resource) { #if defined(TEST) || defined(SPLIT) *logofs << "handleRestart: SPLIT! Deferred agent split event " << "TYPE#" << (unsigned) opcodeStore_ -> endSplitNotify << " [end split] with resource " << resource << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif if (handleNotify(notify_end_split, sequence_deferred, resource, nothing, nothing) < 0) { return -1; } } #if defined(TEST) || defined(SPLIT) else if (splitStore -> getSize() == 0 && splitStore -> getResource() == splitState_.resource) { *logofs << "handleRestart: SPLIT! WARNING! The split store " << "for resource " << resource << " was emptied in the " << "split sequence at " << strMsTimestamp() << ".\n" << logofs_flush; } #endif } // // Remove the split store if it's empty. // if (splitStore != NULL && splitStore -> getSize() == 0 && splitStore -> getResource() != splitState_.resource) { #if defined(TEST) || defined(SPLIT) *logofs << "handleRestart: SPLIT! Removing the split store [" << resource << "] at " << strMsTimestamp() << ".\n" << logofs_flush; #endif handleSplitStoreRemove(&splitResources_, resource); if (clientStore_ -> getSplitTotalSize() == 0) { #if defined(TEST) || defined(SPLIT) *logofs << "handleRestart: SPLIT! Deferred agent split event " << "TYPE#" << (unsigned) opcodeStore_ -> emptySplitNotify << " [empty split] for FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif if (handleNotify(notify_empty_split, sequence_deferred, nothing, nothing, nothing) < 0) { return -1; } } #if defined(TEST) || defined(SPLIT) *logofs << "handleRestart: SPLIT! There are " << clientStore_ -> getSplitTotalSize() << " messages and " << clientStore_ -> getSplitTotalStorageSize() << " bytes to send in " << "the split stores.\n" << logofs_flush; if ((clientStore_ -> getSplitTotalSize() != 0 && clientStore_ -> getSplitTotalStorageSize() == 0) || (clientStore_ -> getSplitTotalSize() == 0 && clientStore_ -> getSplitTotalStorageSize() != 0)) { #ifdef PANIC *logofs << "handleRestart: PANIC! Inconsistency detected " << "while handling the split stores.\n" << logofs_flush; #endif HandleCleanup(); } #endif } return 1; } int ClientChannel::handleTaintLameRequest(unsigned char &opcode, const unsigned char *&buffer, unsigned int &size) { // // Test the efficiency of the encoding // without these RENDER requests. // if (opcode == opcodeStore_ -> renderExtension && (*(buffer + 1) == X_RenderCompositeGlyphs8 || *(buffer + 1) == X_RenderCompositeGlyphs16 || *(buffer + 1) == X_RenderCompositeGlyphs32 || *(buffer + 1) == X_RenderAddGlyphs || *(buffer + 1) == X_RenderTrapezoids)) { #ifdef TEST *logofs << "handleTaintLameRequest: Tainting request " << "OPCODE#" << (unsigned int) opcode << " MINOR#" << (unsigned int) *(buffer + 1) << " for FD#" << fd_ << ".\n" << logofs_flush; #endif opcode = X_NoOperation; return 1; } return 0; } int ClientChannel::handleTaintSyncRequest(unsigned char &opcode, const unsigned char *&buffer, unsigned int &size) { // // Should short-circuit other common replies // whose values could be queried only once. // Examples are X_InterAtom, X_ListExtension // and X_QueryExtension. // if (taintCounter_ >= control -> TaintThreshold) { #ifdef DEBUG *logofs << "handleTaintSyncRequest: Reset taint counter after " << taintCounter_ << " replies managed.\n" << logofs_flush; #endif taintCounter_ = 0; return 0; } // // Check if we are rolling the counter. // The client sequence number has not // been incremented yet in the loop. // unsigned int sequence = (clientSequence_ + 1) & 0xffff; #ifdef DEBUG *logofs << "handleTaintSyncRequest: Opcode is " << (unsigned) opcode << " expected client sequence is " << sequence << ".\n" << logofs_flush; #endif if (sequence == 0xffff) { return 0; } unsigned short t1; unsigned char t2; // // Check if there is a previous reply // pending. // if (sequenceQueue_.peek(t1, t2) != 0) { #ifdef DEBUG *logofs << "handleTaintSyncRequest: Skipping taint of reply due to " << "pending request OPCODE#" << t1 << " with sequence " << (unsigned int) t2 << ".\n" << logofs_flush; #endif return 0; } #ifdef DEBUG *logofs << "handleTaintSyncRequest: Suppressing get input focus " << "request for FD#" << fd_ << " with sequence " << sequence << ".\n" << logofs_flush; #endif unsigned char *reply = writeBuffer_.addMessage(32); *(reply + 0) = X_Reply; PutUINT(sequence, reply + 2, bigEndian_); PutULONG(0, reply + 4, bigEndian_); // // Set revert-to to none. // *(reply + 1) = 0; // // Set focus to none. // PutULONG(0, reply + 8, bigEndian_); // // Save the sequence number, not incremented // yet, we used to auto-generate this reply. // lastSequence_ = clientSequence_ + 1; #ifdef TEST *logofs << "handleTaintSyncRequest: Registered " << lastSequence_ << " as last auto-generated sequence number.\n" << logofs_flush; #endif // // Taint the request to a X_NoOperation. // opcode = X_NoOperation; // // We may assume that the client has finished // drawing and flush immediately, even if this // seems to perceively affect the performance. // // priority_++; // if (handleFlush(flush_if_any) < 0) { return -1; } taintCounter_++; return 1; } int ClientChannel::handleTaintSyncError(unsigned char opcode) { if (control -> TaintReplies > 0) { // // By enabling short-circuiting of replies // some window managers can get confused // by some otherwise innocuous X errors. // if (opcode == X_GrabKey || opcode == X_ReparentWindow || opcode == X_ConfigureWindow) { #if defined(TEST) || defined(OPCODES) *logofs << "handleTaintSyncError: WARNING! Suppressed error " << "on OPCODE#" << (unsigned int) opcode << " for FD#" << fd_ << " sequence " << lastSequence_ << " (real was " << serverSequence_ << ").\n" << logofs_flush; #endif return 1; } } return 0; } int ClientChannel::handleNotify(T_notification_type type, T_sequence_mode mode, int resource, int request, int position) { if (finish_ == 1) { #if defined(TEST) || defined(INFO) *logofs << "handleNotify: Discarding notification on " << "channel for FD#" << fd_ << ".\n" << logofs_flush; #endif return 0; } // // Add a new message to the write buffer. // unsigned char *event = writeBuffer_.addMessage(32); // // Event is ClientMessage, atom and // window are 0, format is 32. // *(event + 0) = ClientMessage; PutULONG(0, event + 4, bigEndian_); PutULONG(0, event + 8, bigEndian_); *(event + 1) = 32; // // If the event follows immediately the request (that is the // sequence mode is 'immediate') then the sequence number is // the one of the last request, else it should be the last // sequence number encoded by peer proxy but, as we are ins- // erting events in the stream, we must ensure that the se- // quence we send is not less than the last sequence we have // auto-generated. // if (mode == sequence_immediate) { // // Save the sequence number we used // to auto-generate this event. // lastSequence_ = clientSequence_; #if defined(TEST) || defined(INFO) *logofs << "handleNotify: Registered " << lastSequence_ << " as last auto-generated sequence number.\n" << logofs_flush; #endif } else { if (serverSequence_ > lastSequence_) { #ifdef DEBUG *logofs << "handleNotify: Updating last event's sequence " << lastSequence_ << " to X server's sequence number " << serverSequence_ << " for FD#" << fd_ << ".\n" << logofs_flush; #endif lastSequence_ = serverSequence_; } #ifdef DEBUG else if (serverSequence_ < lastSequence_) { // // Use our last auto-generated sequence. // *logofs << "handleNotify: Tainting sequence number " << serverSequence_ << " to last event's sequence " << lastSequence_ << " for FD#" << fd_ << ".\n" << logofs_flush; } #endif } PutUINT(lastSequence_, event + 2, bigEndian_); // // Be sure we set to void the fields that // are not significant for the specific // notification message. // PutULONG(nothing, event + 16, bigEndian_); PutULONG(nothing, event + 20, bigEndian_); PutULONG(nothing, event + 24, bigEndian_); switch (type) { case notify_no_split: { PutULONG(opcodeStore_ -> noSplitNotify, event + 12, bigEndian_); PutULONG(resource, event + 16, bigEndian_); break; } case notify_start_split: { PutULONG(opcodeStore_ -> startSplitNotify, event + 12, bigEndian_); PutULONG(resource, event + 16, bigEndian_); break; } case notify_commit_split: { PutULONG(opcodeStore_ -> commitSplitNotify, event + 12, bigEndian_); PutULONG(resource, event + 16, bigEndian_); PutULONG(request, event + 20, bigEndian_); PutULONG(position, event + 24, bigEndian_); break; } case notify_end_split: { PutULONG(opcodeStore_ -> endSplitNotify, event + 12, bigEndian_); PutULONG(resource, event + 16, bigEndian_); break; } case notify_empty_split: { PutULONG(opcodeStore_ -> emptySplitNotify, event + 12, bigEndian_); break; } default: { #ifdef PANIC *logofs << "handleNotify: PANIC! Unrecognized notify " << "TYPE#" << type << ".\n" << logofs_flush; #endif return -1; } } #if defined(TEST) || defined(INFO) || defined (SPLIT) *logofs << "handleNotify: Sending " << (mode == sequence_immediate ? "immediate " : "deferred ") << "agent notify event TYPE#" << GetULONG(event + 12, bigEndian_) << logofs_flush; if (resource != nothing) { *logofs << " with resource " << GetULONG(event + 16, bigEndian_) << logofs_flush; if (request != nothing && position != nothing) { *logofs << " request " << GetULONG(event + 20, bigEndian_) << " position " << GetULONG(event + 24, bigEndian_) << logofs_flush; } } *logofs << ".\n" << logofs_flush; #endif // // Send the notification now. // if (handleFlush(flush_if_any) < 0) { return -1; } return 1; } int ClientChannel::handleCommitSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size) { // // Get the data of the request to be // committed. // unsigned char request = *(buffer + 5); MessageStore *store = clientStore_ -> getRequestStore(request); if (store == NULL) { #ifdef PANIC *logofs << "handleCommitSplitRequest: PANIC! Can't commit split for " << "request OPCODE#" << (unsigned int) request << ". No message store found.\n" << logofs_flush; #endif cerr << "Error" << ": Can't commit split for request " << "OPCODE#" << (unsigned int) request << ". No message store found.\n"; return -1; } // // The position in cache of the message // to commit. Encode it as difference in // respect to the last encoded value. // unsigned int position = GetULONG(buffer + 8, bigEndian_); unsigned char resource = *(buffer + 1); unsigned int commit = *(buffer + 4); #if defined(TEST) || defined(SPLIT) if (commit == 1) { *logofs << "handleCommitSplitRequest: SPLIT! Committing request " << "OPCODE#" << (unsigned) request << " at position " << position << " for FD#" << fd_ << " with resource " << (unsigned) resource << ".\n" << logofs_flush; } else { *logofs << "handleCommitSplitRequest: SPLIT! Discarding request " << "OPCODE#" << (unsigned) request << " at position " << position << " for FD#" << fd_ << " with resource " << (unsigned) resource << ".\n" << logofs_flush; } #endif encodeBuffer.encodeOpcodeValue(request, clientCache_ -> opcodeCache); int diffCommit = position - splitState_.commit; splitState_.commit = position; encodeBuffer.encodeValue(diffCommit, 32, 5); // // Send the resource id and the commit // flag. // encodeBuffer.encodeCachedValue(resource, 8, clientCache_ -> resourceCache); encodeBuffer.encodeBoolValue(commit); // // Remove the split from the split queue. // Split *split = handleSplitCommitRemove(request, resource, splitState_.commit); if (split == NULL) { return -1; } clientStore_ -> getCommitStore() -> update(split); // // Free the split. // #if defined(TEST) || defined(SPLIT) *logofs << "handleCommitSplitRequest: SPLIT! Freeing up the " << "committed split.\n" << logofs_flush; #endif delete split; return 1; } int ClientChannel::handleAbortSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size) { unsigned char resource = *(buffer + 1); #if defined(TEST) || defined(SPLIT) *logofs << "handleAbortSplitRequest: SPLIT! Handling abort split " << "request for FD#"<< fd_ << " and resource " << (unsigned int) resource << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(resource, 8, clientCache_ -> resourceCache); SplitStore *splitStore = clientStore_ -> getSplitStore(resource); if (splitStore == NULL) { #ifdef WARNING *logofs << "handleAbortSplitRequest: WARNING! SPLIT! The split " << "store [" << (unsigned int) resource << "] " << "is already empty.\n" << logofs_flush; #endif return 0; } // // Loop through the messages in the split // store and discard from the memory cache // the messages that are still incomplete. // Then remove the message from the split // store. // #if defined(TEST) || defined(SPLIT) clientStore_ -> dumpSplitStore(resource); #endif int splits = 0; Split *splitMessage; for (;;) { splitMessage = splitStore -> getFirstSplit(); if (splitMessage == NULL) { // // Check if we had created the store // but no message was added yet. // #ifdef WARNING if (splits == 0) { *logofs << "handleAbortSplitRequest: WARNING! SPLIT! The " << "split store [" << (unsigned int) resource << "] is unexpectedly empty.\n" << logofs_flush; } #endif break; } // // Splits already aborted can't be in the // split store. // #if defined(TEST) || defined(SPLIT) if (splitMessage -> getState() == split_aborted) { *logofs << "handleAbortSplitRequest: PANIC! SPLIT! Found an " << "aborted split in store [" << (unsigned int) resource << "].\n" << logofs_flush; HandleCleanup(); } #endif if (splitMessage -> getAction() == IS_HIT) { #if defined(TEST) || defined(SPLIT) *logofs << "handleAbortSplitRequest: SPLIT! Removing the " << "split from the memory cache.\n" << logofs_flush; #endif splitMessage -> getStore() -> remove(splitMessage -> getPosition(), use_checksum, discard_data); } #if defined(TEST) || defined(SPLIT) *logofs << "handleAbortSplitRequest: SPLIT! Removing the " << "split from the split store.\n" << logofs_flush; #endif splitMessage = splitStore -> pop(); #if defined(TEST) || defined(SPLIT) *logofs << "handleAbortSplitRequest: SPLIT! Freeing up the " << "aborted split.\n" << logofs_flush; #endif delete splitMessage; splits++; } // // If the start-split/end-split sequence // was closed, send the notification now, // else wait for the end-split. // if (resource != splitState_.resource) { #if defined(TEST) || defined(SPLIT) *logofs << "handleAbortSplitRequest: SPLIT! Sending the " << "deferred [end split] event.\n" << logofs_flush; #endif handleRestart(sequence_deferred, resource); } #if defined(TEST) || defined(SPLIT) else { *logofs << "handleAbortSplitRequest: WARNING! SPLIT! Still " << "waiting for the closure of the split " << "sequence.\n" << logofs_flush; } #endif // // Check if there is any other store // having splits to send. // handleSplitPending(); return (splits > 0); } int ClientChannel::handleFinishSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size) { unsigned char resource = *(buffer + 1); #if defined(TEST) || defined(SPLIT) *logofs << "handleFinishSplitRequest: SPLIT! Handling finish split " << "request for FD#"<< fd_ << " and resource " << (unsigned int) resource << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(resource, 8, clientCache_ -> resourceCache); // // We need to get the protocol statistics // for the finish message we are handling // here because sending a new split will // reset the bits counter. // int bits = encodeBuffer.diffBits(); statistics -> addRequestBits(opcode, size << 3, bits); SplitStore *splitStore = clientStore_ -> getSplitStore(resource); if (splitStore == NULL) { #ifdef WARNING *logofs << "handleFinishSplitRequest: WARNING! SPLIT! The split " << "store [" << (unsigned int) resource << "] " << "is already empty.\n" << logofs_flush; #endif return 0; } // // Send all the split queued for the given // resource until the split store becomes // empty. // #if defined(TEST) || defined(SPLIT) clientStore_ -> dumpSplitStore(resource); #endif Split *splitMessage; int total = MESSAGE_DATA_LIMIT; int bytes = total; int splits = 0; for (;;) { splitMessage = splitStore -> getFirstSplit(); if (splitMessage == NULL) { // // We have presumably created the store // after a start split but no message // was added yet. // #ifdef WARNING *logofs << "handleFinishSplitRequest: WARNING! SPLIT! The " << "split store [" << (unsigned int) resource << "] is unexpectedly empty.\n" << logofs_flush; #endif break; } // // Splits already aborted can't be in the // split store. // #if defined(TEST) || defined(SPLIT) if (splitMessage -> getState() == split_aborted) { *logofs << "handleFinishSplitRequest: PANIC! SPLIT! Found an " << "aborted split in store [" << (unsigned int) resource << "].\n" << logofs_flush; HandleCleanup(); } *logofs << "handleFinishSplitRequest: SPLIT! Sending more " << "data for store [" << (unsigned int) resource << "].\n" << logofs_flush; #endif if (handleSplitSend(encodeBuffer, resource, splits, bytes) < 0) { return -1; } // // Check if the split store was deleted. // if (clientStore_ -> getSplitStore(resource) == NULL) { #if defined(TEST) || defined(SPLIT) *logofs << "handleFinishSplitRequest: SPLIT! Exiting " << "from the finish loop with split store [" << (unsigned int) resource << "] destroyed.\n" << logofs_flush; #endif break; } } // // Check if there is any other store // having splits to send. // handleSplitPending(); #if defined(TEST) || defined(SPLIT) *logofs << "handleFinishSplitRequest: SPLIT! Sent " << splits << " splits and " << total - bytes << " bytes for FD#" << fd_ << " with " << clientStore_ -> getSplitTotalStorageSize() << " bytes and [" << clientStore_ -> getSplitTotalSize() << "] splits remaining.\n" << logofs_flush; #endif return (splits > 0); } int ClientChannel::handleConfiguration() { #ifdef TEST *logofs << "ClientChannel: Setting new buffer parameters.\n" << logofs_flush; #endif readBuffer_.setSize(control -> ClientInitialReadSize, control -> ClientMaximumBufferSize); writeBuffer_.setSize(control -> TransportXBufferSize, control -> TransportXBufferThreshold, control -> TransportMaximumBufferSize); transport_ -> setSize(control -> TransportXBufferSize, control -> TransportXBufferThreshold, control -> TransportMaximumBufferSize); return 1; } int ClientChannel::handleFinish() { #ifdef TEST *logofs << "ClientChannel: Finishing channel for FD#" << fd_ << ".\n" << logofs_flush; #endif congestion_ = 0; priority_ = 0; finish_ = 1; taintCounter_ = 0; splitState_.resource = nothing; splitState_.pending = 0; splitState_.commit = 0; splitState_.mode = split_none; transport_ -> finish(); return 1; } // // If differential compression is disabled then use the // most simple encoding but handle the image requests // and the X_ListExtensions and X_QueryExtension messa- // ges (needed to detect the opcode of the shape or the // other extensions) in the usual way. // int ClientChannel::handleFastReadRequest(EncodeBuffer &encodeBuffer, const unsigned char &opcode, const unsigned char *&buffer, const unsigned int &size) { // // All the NX requests are handled in the // main message loop. The X_PutImage can // be handled here only if the split was // not requested (since ProtoStep7 #issue 108). // if ((opcode >= X_NXFirstOpcode && opcode <= X_NXLastOpcode) || (opcode == X_PutImage && splitState_.resource != nothing) || opcode == X_ListExtensions || opcode == X_QueryExtension) { return 0; } #ifdef DEBUG *logofs << "handleFastReadRequest: Encoding raw request OPCODE#" << (unsigned int) opcode << " for FD#" << fd_ << " with size " << size << ".\n" << logofs_flush; #endif encodeBuffer.encodeMemory(buffer, size); // // Put request on the fast track // if it needs a reply. // switch (opcode) { case X_GetAtomName: case X_GetGeometry: case X_GetInputFocus: case X_GetModifierMapping: case X_GetKeyboardMapping: case X_GetProperty: case X_GetSelectionOwner: case X_GrabPointer: case X_GrabKeyboard: case X_ListExtensions: case X_ListFonts: case X_LookupColor: case X_AllocNamedColor: case X_QueryPointer: case X_GetWindowAttributes: case X_QueryTree: case X_QueryBestSize: case X_QueryColors: case X_QueryFont: case X_TranslateCoords: case X_GetImage: case X_GetPointerMapping: case X_GetKeyboardControl: case X_InternAtom: case X_AllocColor: { sequenceQueue_.push(clientSequence_, opcode); priority_++; break; } default: { break; } } int bits = encodeBuffer.diffBits(); #if defined(TEST) || defined(OPCODES) *logofs << "handleFastReadRequest: Handled raw request OPCODE#" << (unsigned int) opcode << " (" << DumpOpcode(opcode) << ")" << " for FD#" << fd_ << " sequence " << clientSequence_ << ". " << size << " bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; #endif statistics -> addRequestBits(opcode, size << 3, bits); if (opcode == opcodeStore_ -> renderExtension) { statistics -> addRenderRequestBits(*(buffer + 1), size << 3, bits); } return 1; } int ClientChannel::handleFastWriteReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { if ((opcode >= X_NXFirstOpcode && opcode <= X_NXLastOpcode) || opcode == X_ListExtensions || opcode == X_QueryExtension) { return 0; } #ifdef DEBUG *logofs << "handleFastWriteReply: Decoding raw reply OPCODE#" << (unsigned int) opcode << " for FD#" << fd_ << ".\n" << logofs_flush; #endif buffer = writeBuffer_.addMessage(8); #ifndef __sun unsigned int *next = (unsigned int *) decodeBuffer.decodeMemory(8); *((unsigned int *) buffer) = *next++; *((unsigned int *) (buffer + 4)) = *next; #else /* #ifndef __sun */ memcpy(buffer, decodeBuffer.decodeMemory(8), 8); #endif /* #ifndef __sun */ size = 32 + (GetULONG(buffer + 4, bigEndian_) << 2); writeBuffer_.registerPointer(&buffer); if (writeBuffer_.getAvailable() < size - 8 || (int) size >= control -> TransportFlushBufferSize) { #ifdef DEBUG *logofs << "handleFastWriteReply: Using scratch buffer for OPCODE#" << (unsigned int) opcode << " with size " << size << " and " << writeBuffer_.getLength() << " bytes in buffer.\n" << logofs_flush; #endif writeBuffer_.removeMessage(8); buffer = writeBuffer_.addScratchMessage(((unsigned char *) decodeBuffer.decodeMemory(size - 8)) - 8, size); } else { writeBuffer_.addMessage(size - 8); #ifndef __sun if (size == 32) { next = (unsigned int *) decodeBuffer.decodeMemory(size - 8); for (int i = 8; i < 32; i += sizeof(unsigned int)) { *((unsigned int *) (buffer + i)) = *next++; } } else { memcpy(buffer + 8, decodeBuffer.decodeMemory(size - 8), size - 8); } #else /* #ifndef __sun */ memcpy(buffer + 8, decodeBuffer.decodeMemory(size - 8), size - 8); #endif /* #ifndef __sun */ } writeBuffer_.unregisterPointer(); // // We don't need to write our local sequence // number. Replies are always sent with the // original X server's sequence number. // #if defined(TEST) || defined(OPCODES) *logofs << "handleFastWriteReply: Handled raw reply OPCODE#" << (unsigned int) opcode << " for FD#" << fd_ << " with sequence " << serverSequence_ << ". Output size is " << size << ".\n" << logofs_flush; #endif #ifdef DEBUG *logofs << "handleFastWriteReply: Length of sequence queue is " << sequenceQueue_.length() << ".\n" << logofs_flush; #endif statistics -> addRepliedRequest(opcode); handleFlush(flush_if_needed); return 1; } int ClientChannel::handleFastWriteEvent(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { #ifdef DEBUG *logofs << "handleFastWriteEvent: Decoding raw " << (opcode == X_Error ? "error" : "event") << " OPCODE#" << (unsigned int) opcode << " for FD#" << fd_ << ".\n" << logofs_flush; #endif size = 32; buffer = writeBuffer_.addMessage(size); #ifndef __sun unsigned int *next = (unsigned int *) decodeBuffer.decodeMemory(size); for (int i = 0; i < 32; i += sizeof(unsigned int)) { *((unsigned int *) (buffer + i)) = *next++; } #else /* #ifndef __sun */ memcpy(buffer, decodeBuffer.decodeMemory(size), size); #endif /* #ifndef __sun */ // // Use our local sequence number. // PutUINT(lastSequence_, buffer + 2, bigEndian_); #if defined(TEST) || defined(OPCODES) *logofs << "handleFastWriteEvent: Handled raw " << (opcode == X_Error ? "error" : "event") << " OPCODE#" << (unsigned int) opcode << " for FD#" << fd_ << " with sequence " << lastSequence_ << ". Output size is " << size << ".\n" << logofs_flush; #endif // // Check if we need to suppress the error. // if (opcode == X_Error && handleTaintSyncError(*(buffer + 10)) > 0) { #if defined(TEST) || defined(OPCODES) *logofs << "handleFastWriteEvent: WARNING! Suppressed error OPCODE#" << (unsigned int) opcode << " for FD#" << fd_ << " with sequence " << lastSequence_ << ".\n" << logofs_flush; #endif writeBuffer_.removeMessage(32); } handleFlush(flush_if_needed); return 1; } int ClientChannel::handleShmemRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size) { // // Will push sequence and set // priority according to stage. // unsigned int stage = *(buffer + 1); #ifdef TEST *logofs << "handleShmemRequest: Encoding shmem request " << "OPCODE#" << (unsigned int) opcode << " for FD#" << fd_ << " with size " << size << " at stage " << stage << ".\n" << logofs_flush; #endif encodeBuffer.encodeValue(stage, 2); if (stage == 0) { unsigned int enableClient = 0; unsigned int enableServer = 0; if (control -> ShmemClient == 1) { enableClient = *(buffer + 4); } if (control -> ShmemServer == 1) { enableServer = *(buffer + 5); } encodeBuffer.encodeBoolValue(enableClient); encodeBuffer.encodeBoolValue(enableServer); unsigned int clientSegment = GetULONG(buffer + 8, bigEndian_); unsigned int serverSegment = GetULONG(buffer + 12, bigEndian_); encodeBuffer.encodeValue(clientSegment, 29, 9); encodeBuffer.encodeValue(serverSegment, 29, 9); #ifdef TEST *logofs << "handleShmemRequest: Enable client is " << enableClient << " enable server is " << enableServer << " client segment is " << (void *) clientSegment << " server segment is " << (void *) serverSegment << ".\n" << logofs_flush; #endif #ifdef TEST *logofs << "handleShmemRequest: Size of the shared memory " << "segment will be " << control -> ShmemServerSize << ".\n" << logofs_flush; #endif } if (stage != 1) { sequenceQueue_.push(clientSequence_, opcodeStore_ -> getShmemParameters); priority_++; } return 1; } int ClientChannel::handleShmemReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { #ifdef TEST *logofs << "handleShmemReply: Received shmem parameters " << "reply OPCODE#" << (unsigned int) opcode << ".\n" << logofs_flush; #endif size = 32; buffer = writeBuffer_.addMessage(size); unsigned int stage; decodeBuffer.decodeValue(stage, 2); *(buffer + 1) = stage; if (stage == 2) { unsigned int clientEnabled; unsigned int serverEnabled; decodeBuffer.decodeBoolValue(clientEnabled); decodeBuffer.decodeBoolValue(serverEnabled); // // Client support is not implemented // and not useful. It is here only // for compatibility. // clientEnabled = 0; *(buffer + 8) = clientEnabled; *(buffer + 9) = serverEnabled; PutULONG(0, buffer + 12, bigEndian_); if (serverEnabled == 1) { #ifdef TEST *logofs << "handleShmemReply: Enabled shared memory " << "support in X server with segment size " << control -> ShmemServerSize << ".\n" << logofs_flush; #endif PutULONG(control -> ShmemServerSize, buffer + 16, bigEndian_); } else { PutULONG(0, buffer + 16, bigEndian_); } } else { *(buffer + 8) = 0; *(buffer + 9) = 0; PutULONG(0, buffer + 12, bigEndian_); PutULONG(0, buffer + 16, bigEndian_); } return 1; } int ClientChannel::handleFontRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size) { #ifdef TEST *logofs << "handleFontRequest: Encoding font request " << "OPCODE#" << (unsigned int) opcode << " for FD#" << fd_ << " with size " << size << ".\n" << logofs_flush; #endif sequenceQueue_.push(clientSequence_, opcodeStore_ -> getFontParameters); return 1; } int ClientChannel::handleFontReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { #ifdef TEST *logofs << "handleFontReply: Received font operation " << "reply OPCODE#" << (unsigned int) opcode << ".\n" << logofs_flush; #endif unsigned int length; decodeBuffer.decodeValue(length, 8); size = 32 + RoundUp4(length + 1); buffer = writeBuffer_.addMessage(size); unsigned char *next = buffer + 32; *next++ = length; decodeBuffer.decodeTextData(next, length); #ifdef TEST *logofs << "handleFontReply: Received tunneled font server " << "path '"; for (unsigned int i = 0; i < length; i++) { *logofs << *(buffer + 32 + 1 + i); } *logofs << "' for FD#" << fd_ << ".\n" << logofs_flush; #endif if (fontPort_ == -1) { // // The local side is not going to forward // the font server connections. // #ifdef TEST *logofs << "handleFontReply: WARNING! Returning an empty " << "font server path.\n" << logofs_flush; #endif writeBuffer_.removeMessage(size); size = 36; buffer = writeBuffer_.addMessage(size); // // Set the length of the returned // path to 0. // *(buffer + 32) = 0; } #ifdef TEST else { *logofs << "handleFontReply: Returning the received " << "font server path.\n" << logofs_flush; } #endif return 1; } int ClientChannel::handleCacheRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size) { #ifdef TEST *logofs << "handleCacheRequest: Handling cache request " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif enableCache_ = *(buffer + 4); enableSplit_ = *(buffer + 5); enableSave_ = *(buffer + 6); enableLoad_ = *(buffer + 7); #ifdef TEST *logofs << "handleCacheRequest: Set cache parameters to " << " cache " << enableCache_ << " split " << enableSplit_ << " save " << enableSave_ << " load " << enableLoad_ << ".\n" << logofs_flush; #endif // // Encode all the parameters as a // single unsigned int so we can // use an int cache. // unsigned int mask = enableSave_ << 8 | enableLoad_; encodeBuffer.encodeCachedValue(mask, 32, clientCache_ -> setCacheParametersCache); return 0; } int ClientChannel::handleStartSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size) { #if defined(TEST) || defined(SPLIT) *logofs << "handleStartSplitRequest: SPLIT! Handling start split " << "request for FD#"<< fd_ << ".\n" << logofs_flush; #endif if (splitState_.resource != nothing) { #ifdef PANIC *logofs << "handleStartSplitRequest: PANIC! SPLIT! Split requested " << "for resource id " << (unsigned int) *(buffer + 1) << " while handling resource " << splitState_.resource << ".\n" << logofs_flush; #endif cerr << "Error" << ": Split requested for " << "resource id " << (unsigned int) *(buffer + 1) << " while handling resource " << splitState_.resource << ".\n"; return -1; } else if (fd_ != firstClient_) { // // It can be that an auxiliary channel is the // first to connect, then comes the agent that // is actually using the NX opcodes. // #ifdef WARNING *logofs << "handleStartSplitRequest: WARNING SPLIT! Split requested " << "on FD#" << fd_ << " while expecting FD#" << firstClient_ << ".\n" << logofs_flush; #endif firstClient_ = fd_; } // // Set the agent's resource for which we are // going to split the request. // splitState_.resource = *(buffer + 1); #if defined(TEST) || defined(SPLIT) *logofs << "handleStartSplitRequest: SPLIT! Registered id " << splitState_.resource << " as resource " << "waiting for a split.\n" << logofs_flush; if (clientStore_ -> getSplitStore(splitState_.resource) != NULL) { *logofs << "handleStartSplitRequest: WARNING! SPLIT! A split " << "store for resource id " << splitState_.resource << " already exists.\n" << logofs_flush; clientStore_ -> dumpSplitStore(splitState_.resource); } #endif // // Send the selected resource to the remote. // // Since ProtoStep7 (#issue 108) encodeBuffer.encodeCachedValue(splitState_.resource, 8, clientCache_ -> resourceCache); splitState_.mode = (T_split_mode) *(buffer + 4); if (splitState_.mode != NXSplitModeAsync && splitState_.mode != NXSplitModeSync) { splitState_.mode = (T_split_mode) control -> SplitMode; #if defined(TEST) || defined(SPLIT) *logofs << "handleStartSplitRequest: SPLIT! Set split " << "mode to '" << splitState_.mode << "' with " << "provided value '" << (unsigned) *(buffer + 4) << "'.\n" << logofs_flush; #endif } #if defined(TEST) || defined(SPLIT) if (splitState_.mode == NXSplitModeAsync) { *logofs << "handleStartSplitRequest: SPLIT! Selected split " << "mode is [split_async].\n" << logofs_flush; } else if (splitState_.mode == NXSplitModeSync) { *logofs << "handleStartSplitRequest: SPLIT! Selected split " << "mode is [split_sync].\n" << logofs_flush; } clientStore_ -> dumpSplitStores(); #endif return 1; } int ClientChannel::handleEndSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size) { #if defined(TEST) || defined(SPLIT) *logofs << "handleEndSplitRequest: SPLIT! Handling end split " << "request for FD#"<< fd_ << ".\n" << logofs_flush; #endif // // Verify that the agent resource matches. // if (splitState_.resource == nothing) { #ifdef PANIC *logofs << "handleEndSplitRequest: PANIC! SPLIT! Received an end of " << "split for resource id " << (unsigned int) *(buffer + 1) << " without a previous start.\n" << logofs_flush; #endif cerr << "Error" << ": Received an end of split " << "for resource id " << (unsigned int) *(buffer + 1) << " without a previous start.\n"; return -1; } else if (splitState_.resource != *(buffer + 1)) { #ifdef PANIC *logofs << "handleEndSplitRequest: PANIC! SPLIT! Invalid resource id " << (unsigned int) *(buffer + 1) << " received while " << "waiting for resource id " << splitState_.resource << ".\n" << logofs_flush; #endif cerr << "Error" << ": Invalid resource id " << (unsigned int) *(buffer + 1) << " received while " << "waiting for resource id " << splitState_.resource << ".\n"; return -1; } // // Send the selected resource to the remote. // // Since ProtoStep7 (#issue 108) encodeBuffer.encodeCachedValue(splitState_.resource, 8, clientCache_ -> resourceCache); // // Send the split notification events // to the agent. // handleRestart(sequence_immediate, splitState_.resource); // // Check if we still have splits to send. // handleSplitPending(); #if defined(TEST) || defined(SPLIT) *logofs << "handleEndSplitRequest: SPLIT! Reset id " << splitState_.resource << " as resource " << "selected for splits.\n" << logofs_flush; #endif splitState_.resource = nothing; splitState_.mode = split_none; #if defined(TEST) || defined(SPLIT) clientStore_ -> dumpSplitStores(); #endif return 1; } void ClientChannel::handleDecodeCharInfo(DecodeBuffer &decodeBuffer, unsigned char *nextDest) { unsigned int value; decodeBuffer.decodeCachedValue(value, 32, *serverCache_ -> queryFontCharInfoCache[0], 6); PutUINT(value & 0xffff, nextDest, bigEndian_); PutUINT(value >> 16, nextDest + 10, bigEndian_); nextDest += 2; for (unsigned int i = 1; i < 5; i++) { unsigned int _value; decodeBuffer.decodeCachedValue(_value, 16, *serverCache_ -> queryFontCharInfoCache[i], 6); PutUINT(_value, nextDest, bigEndian_); nextDest += 2; } } int ClientChannel::setBigEndian(int flag) { bigEndian_ = flag; return 1; } int ClientChannel::setReferences() { #ifdef TEST *logofs << "ClientChannel: Initializing the static " << "members for the client channels.\n" << logofs_flush; #endif #ifdef REFERENCES references_ = 0; #endif return 1; } nx-libs-3.5.99.23/nxcomp/src/ClientChannel.h0000644000000000000000000002722013614532331015265 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ClientChannel_H #define ClientChannel_H #include "List.h" #include "Channel.h" #include "SequenceQueue.h" #include "ClientReadBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // If defined, the client channel will // have the chance of suppressing more // opcodes for test purposes. // #undef LAME // // Define this to log a line when a // channel is created or destroyed. // #undef REFERENCES // // This class implements the X client // side compression of the protocol. // class ClientChannel : public Channel { public: ClientChannel(Transport *transport, StaticCompressor *compressor); virtual ~ClientChannel(); virtual int handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, unsigned int length); virtual int handleWrite(const unsigned char *message, unsigned int length); virtual int handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, T_store_action action, int position, const unsigned char opcode, const unsigned char *buffer, const unsigned int size); virtual int handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, T_store_action action, int position, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { return 0; } virtual int handleSplit(EncodeBuffer &encodeBuffer); virtual int handleSplit(DecodeBuffer &decodeBuffer) { return 0; } virtual int handleSplitEvent(EncodeBuffer &encodeBuffer, Split *split); virtual int handleSplitEvent(DecodeBuffer &decodeBuffer); virtual int handleMotion(EncodeBuffer &encodeBuffer) { return 0; } virtual int handleCompletion(EncodeBuffer &encodeBuffer) { return 0; } virtual int handleConfiguration(); virtual int handleFinish(); virtual int handleAsyncEvents() { return 0; } virtual int needSplit() const { #if defined(TEST) || defined(SPLIT) *logofs << "needSplit: SPLIT! Returning pending split " << "flag " << splitState_.pending << " with " << clientStore_ -> getSplitTotalSize() << " splits in the split stores.\n" << logofs_flush; #endif return splitState_.pending; } virtual int needMotion() const { return 0; } virtual T_channel_type getType() const { return channel_x11; } int setBigEndian(int flag); // // Initialize the static members. // static int setReferences(); private: int handleFastReadRequest(EncodeBuffer &encodeBuffer, const unsigned char &opcode, const unsigned char *&buffer, const unsigned int &size); int handleFastWriteReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size); int handleFastWriteEvent(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size); // // Intercept the request before the opcode // is encoded. // int handleTaintRequest(unsigned char &opcode, const unsigned char *&buffer, unsigned int &size) { if (control -> TaintReplies > 0 && opcode == X_GetInputFocus) { return handleTaintSyncRequest(opcode, buffer, size); } #ifdef LAME return handleTaintLameRequest(opcode, buffer, size); #endif return 0; } int handleTaintLameRequest(unsigned char &opcode, const unsigned char *&buffer, unsigned int &size); int handleTaintSyncRequest(unsigned char &opcode, const unsigned char *&buffer, unsigned int &size); int handleTaintSyncError(unsigned char opcode); // // How to handle sequence counter // in notification event. // enum T_sequence_mode { sequence_immediate, sequence_deferred }; // // Send split notifications to the // agent. // int handleRestart(T_sequence_mode mode, int resource); int handleNotify(T_notification_type type, T_sequence_mode mode, int resource, int request, int position); // // Other utility functions used in // handling of the image streaming. // int mustSplitMessage(int resource) { return (clientStore_ -> getSplitStore(resource) -> getSize() != 0); } int canSplitMessage(T_split_mode mode, unsigned int size) { return ((int) size >= control -> SplitDataThreshold && (clientStore_ -> getSplitTotalStorageSize() < control -> SplitTotalStorageSize && clientStore_ -> getSplitTotalSize() < control -> SplitTotalSize)); } int canSendSplit(Split *split) { return (split -> getMode() != split_sync || split -> getState() == split_missed || split -> getState() == split_loaded); } int handleSplitSend(EncodeBuffer &encodeBuffer, int resource, int &total, int &bytes); Split *handleSplitFind(T_checksum checksum, int resource); int handleSplitChecksum(EncodeBuffer &encodeBuffer, T_checksum checksum); void handleSplitPending(int resource) { if (splitState_.pending == 0) { if (clientStore_ -> getSplitStore(resource) != NULL && clientStore_ -> getSplitStore(resource) -> getFirstSplit() != NULL) { splitState_.pending = canSendSplit(clientStore_ -> getSplitStore(resource) -> getFirstSplit()); #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitPending: SPLIT! Set the pending " << "split flag to " << splitState_.pending << " with " << clientStore_ -> getSplitTotalSize() << " splits in the split stores.\n" << logofs_flush; #endif } } } // // Scan all the split stores to find // if there is any split to send. // void handleSplitPending(); // // Handle the MIT-SHM initialization // messages exchanged with the remote // proxy. // int handleShmemRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size); int handleShmemReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size); // // Query the port used to tunnel // the font server connections. // int handleFontRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size); int handleFontReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size); // // Let the agent set the cache // policy for image requests. // int handleCacheRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size); // // Encode the start and end split // requests. // int handleStartSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size); int handleEndSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size); // // Empty a split store and send the // restart event. // int handleAbortSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size); // // Force the proxy to finalize all // the pending split operations and // restart a resource. // int handleFinishSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size); // // Tell the remote peer to send the // split requests to the X server. // int handleCommitSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size); // // Other utilities. // void handleDecodeCharInfo(DecodeBuffer &, unsigned char *); // // Own read buffer. It is able to identify // full messages read from the X descriptor. // ClientReadBuffer readBuffer_; // // Sequence number of last request coming // from the X client or the X server. // unsigned int clientSequence_; unsigned int serverSequence_; // // Last sequence number known by client. It can // be the real sequence generated by server or // the one of the last auto-generated event. // unsigned int lastSequence_; // // Used to identify replies based on sequence // number of original request. // SequenceQueue sequenceQueue_; // // This is used to test the synchronous flush // in the proxy. // int lastRequest_; // // Current resource id selected as target and // other information related to the image split. // The pending and abort flags are set when we // want the proxy to give us a chance to send // more split data. We also save the position // of the last commit operation performed by // channel so we can differentially encode the // position of next message to commit. // typedef struct { int resource; int pending; int commit; T_split_mode mode; } T_split_state; T_split_state splitState_; // // List of agent resources. // List splitResources_; // // How many sync requests we // have tainted so far. // int taintCounter_; private: // // Keep track of object // creation and deletion. // #ifdef REFERENCES static int references_; #endif }; #endif /* ClientChannel_H */ nx-libs-3.5.99.23/nxcomp/src/ClientProxy.cpp0000644000000000000000000003261513614532331015375 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Socket.h" #include "Agent.h" #include "ClientProxy.h" #include "ClientChannel.h" #include "GenericChannel.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Log the operations related to sending // and receiving the control tokens. // #undef TOKEN ClientProxy::ClientProxy(int proxyFd) : Proxy(proxyFd) { fontServerPort_ = NULL; #ifdef DEBUG *logofs << "ClientProxy: Created new object at " << this << ".\n" << logofs_flush; #endif } ClientProxy::~ClientProxy() { delete [] fontServerPort_; #ifdef DEBUG *logofs << "ClientProxy: Deleted object at " << this << ".\n" << logofs_flush; #endif } void ClientProxy::handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, sockaddr * xServerAddr, unsigned int xServerAddrLength) { #ifdef DEBUG *logofs << "ClientProxy: No display configuration to set.\n" << logofs_flush; #endif } void ClientProxy::handlePortConfiguration(ChannelEndPoint &cupsServerPort, ChannelEndPoint &smbServerPort, ChannelEndPoint &mediaServerPort, ChannelEndPoint &httpServerPort, const char *fontServerPort) { delete [] fontServerPort_; fontServerPort_ = new char[strlen(fontServerPort) + 1]; strcpy(fontServerPort_, fontServerPort); #ifdef DEBUG *logofs << "ClientProxy: Set port configuration to font '" << fontServerPort_ << "'.\n" << logofs_flush; #endif } int ClientProxy::handleNewConnection(T_channel_type type, int clientFd) { switch (type) { case channel_x11: { return handleNewXConnection(clientFd); } case channel_cups: { return handleNewGenericConnection(clientFd, channel_cups, "CUPS"); } case channel_smb: { return handleNewGenericConnection(clientFd, channel_smb, "SMB"); } case channel_media: { return handleNewGenericConnection(clientFd, channel_media, "media"); } case channel_http: { return handleNewGenericConnection(clientFd, channel_http, "HTTP"); } case channel_slave: { return handleNewSlaveConnection(clientFd); } default: { #ifdef PANIC *logofs << "ClientProxy: PANIC! Unsupported channel with type '" << getTypeName(type) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Unsupported channel with type '" << getTypeName(type) << "'.\n"; return -1; } } } int ClientProxy::handleNewConnectionFromProxy(T_channel_type type, int channelId) { switch (type) { case channel_font: { int port = atoi(fontServerPort_); if (port > 0) { // // Connect on the TCP port number. // return handleNewGenericConnectionFromProxyTCP(channelId, channel_font, "localhost", port, "font"); } else { // // Connect to the Unix path. // return handleNewGenericConnectionFromProxyUnix(channelId, channel_font, fontServerPort_, "font"); } } case channel_slave: { return handleNewSlaveConnectionFromProxy(channelId); } default: { #ifdef PANIC *logofs << "ClientProxy: PANIC! Unsupported channel with type '" << getTypeName(type) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Unsupported channel with type '" << getTypeName(type) << "'.\n"; return -1; } } } int ClientProxy::handleNewAgentConnection(Agent *agent) { int clientFd = agent -> getLocalFd(); int channelId = allocateChannelMap(clientFd); if (channelId == -1) { #ifdef PANIC *logofs << "ClientProxy: PANIC! Maximum number of available " << "channels exceeded.\n" << logofs_flush; #endif cerr << "Error" << ": Maximum number of available " << "channels exceeded.\n"; return -1; } transports_[channelId] = agent -> getTransport(); agent_ = channelId; return handleNewXConnection(clientFd); } int ClientProxy::handleNewXConnection(int clientFd) { int channelId = getChannel(clientFd); // // Check if the channel has been // already mapped. // if (channelId == -1) { channelId = allocateChannelMap(clientFd); if (channelId == -1) { #ifdef PANIC *logofs << "ClientProxy: PANIC! Maximum number of available " << "channels exceeded.\n" << logofs_flush; #endif cerr << "Error" << ": Maximum number of available " << "channels exceeded.\n"; return -1; } } #ifdef TEST *logofs << "ClientProxy: X client descriptor FD#" << clientFd << " mapped to channel ID#" << channelId << ".\n" << logofs_flush; #endif // // Turn queuing off for path proxy-to-X-client. // if (control -> OptionClientNoDelay == 1) { SetNoDelay(clientFd, control -> OptionClientNoDelay); } // // If requested, set the size of the TCP send // and receive buffers. // if (control -> OptionClientSendBuffer != -1) { SetSendBuffer(clientFd, control -> OptionClientSendBuffer); } if (control -> OptionClientReceiveBuffer != -1) { SetReceiveBuffer(clientFd, control -> OptionClientReceiveBuffer); } if (allocateTransport(clientFd, channelId) < 0) { return -1; } // // Starting from protocol level 3 client and server // caches are created in proxy and shared between all // channels. If remote proxy has older protocol level // pointers are NULL and channels must create their // own instances. // channels_[channelId] = new ClientChannel(transports_[channelId], compressor_); if (channels_[channelId] == NULL) { deallocateTransport(channelId); return -1; } increaseChannels(channelId); // // Propagate channel stores and caches to the new // channel. // channels_[channelId] -> setOpcodes(opcodeStore_); channels_[channelId] -> setStores(clientStore_, serverStore_); channels_[channelId] -> setCaches(clientCache_, serverCache_); int port = atoi(fontServerPort_); if (port > 0 || *fontServerPort_ != '\0') { channels_[channelId] -> setPorts(1); } if (handleControl(code_new_x_connection, channelId) < 0) { return -1; } // // Let channel configure itself according // to control parameters. // channels_[channelId] -> handleConfiguration(); return 1; } int ClientProxy::handleNewXConnectionFromProxy(int channelId) { #ifdef PANIC *logofs << "ClientProxy: PANIC! Can't create a new X channel " << "with ID#" << channelId << " at this side.\n" << logofs_flush; #endif cerr << "Error" << ": Can't create a new X channel " << "with ID#" << channelId << " at this side.\n"; return -1; } int ClientProxy::handleLoad(T_load_type type) { int channelCount = getChannels(channel_x11); if ((channelCount == 0 && type == load_if_first) || (channelCount > 0 && type == load_if_any)) { #ifdef TEST *logofs << "ClientProxy: Going to load content of client store.\n" << logofs_flush; #endif int result = handleLoadStores(); if (result == 1) { if (handleControl(code_load_request) < 0) { return -1; } priority_ = 1; } else if (result < 0) { #ifdef WARNING *logofs << "ClientProxy: WARNING! Failed to load content " << "of persistent cache.\n" << logofs_flush; #endif // // Don't abort the proxy connection in the case // of a corrupted cache. By not sending the load // message to the remote peer, both sides will // start encoding messages using empty stores. // This behaviour is compatible with old proxy // versions. // if (channelCount == 0 && type == load_if_first) { if (handleResetStores() < 0) { #ifdef PANIC *logofs << "ClientProxy: PANIC! Failed to reset message stores.\n" << logofs_flush; #endif return -1; } } else { return -1; } } } else { #ifdef PANIC *logofs << "ClientProxy: PANIC! Can't load the stores with " << channelCount << " remaining channels.\n" << logofs_flush; #endif return -1; } return 1; } int ClientProxy::handleSave() { // // If no more X channels are remaining // then save content of message stores. // int channelCount = getChannels(channel_x11); if (channelCount == 0) { int result = handleSaveStores(); if (result == 1) { if (handleControl(code_save_request) < 0) { return -1; } priority_ = 1; return 1; } else if (result < 0) { #ifdef PANIC *logofs << "ClientProxy: PANIC! Failed to save stores " << "to persistent cache.\n" << logofs_flush; #endif return -1; } } else { #ifdef PANIC *logofs << "ClientProxy: PANIC! Can't save the stores with " << channelCount << " remaining channels.\n" << logofs_flush; #endif return -1; } return 1; } int ClientProxy::handleAsyncEvents() { if (canRead() == 1) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: WARNING! Reading while writing " << "with data available on the proxy link.\n" << logofs_flush; #endif if (handleRead() < 0) { return -1; } return 1; } return 0; } int ClientProxy::handleLoadFromProxy() { #ifdef PANIC *logofs << "ClientProxy: PANIC! Invalid load control message " << "received in proxy.\n" << logofs_flush; #endif cerr << "Error" << ": Invalid load control message " << "received in proxy.\n"; return -1; } int ClientProxy::handleSaveFromProxy() { #ifdef PANIC *logofs << "ClientProxy: PANIC! Invalid save control message " << "received in proxy.\n" << logofs_flush; #endif cerr << "Error" << ": Invalid save control message " << "received in proxy.\n"; return -1; } int ClientProxy::handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, md5_state_t *md5StateClient) const { if (clientStore_ -> saveRequestStores(cachefs, md5StateStream, md5StateClient, use_checksum, discard_data) < 0) { return -1; } else if (serverStore_ -> saveReplyStores(cachefs, md5StateStream, md5StateClient, discard_checksum, use_data) < 0) { return -1; } else if (serverStore_ -> saveEventStores(cachefs, md5StateStream, md5StateClient, discard_checksum, use_data) < 0) { return -1; } return 1; } int ClientProxy::handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const { if (clientStore_ -> loadRequestStores(cachefs, md5StateStream, use_checksum, discard_data) < 0) { return -1; } else if (serverStore_ -> loadReplyStores(cachefs, md5StateStream, discard_checksum, use_data) < 0) { return -1; } else if (serverStore_ -> loadEventStores(cachefs, md5StateStream, discard_checksum, use_data) < 0) { return -1; } return 1; } nx-libs-3.5.99.23/nxcomp/src/ClientProxy.h0000644000000000000000000000746313614532331015045 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ClientProxy_H #define ClientProxy_H #include "Proxy.h" // // Set the verbosity level. // #undef TEST #undef DEBUG class ClientProxy : public Proxy { public: ClientProxy(int proxyFD); virtual ~ClientProxy(); virtual void handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, sockaddr *xServerAddr, unsigned int xServerAddrLength); virtual void handlePortConfiguration(ChannelEndPoint &cupsServerPort, ChannelEndPoint &smbServerPort, ChannelEndPoint &mediaServerPort, ChannelEndPoint &httpServerPort, const char *fontServerPort); protected: // // Create a new channel. // virtual int handleNewConnection(T_channel_type type, int clientFd); virtual int handleNewConnectionFromProxy(T_channel_type type, int channelId); virtual int handleNewAgentConnection(Agent *agent); virtual int handleNewXConnection(int clientFd); virtual int handleNewXConnectionFromProxy(int channelId); // // Implement persistence according // to our proxy mode. // virtual int handleLoad(T_load_type type); virtual int handleSave(); virtual int handleAsyncEvents(); virtual int handleLoadFromProxy(); virtual int handleSaveFromProxy(); virtual int handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, md5_state_t *md5StateClient) const; virtual int handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const; // // Utility function used to realize // a new connection. // protected: virtual int checkLocalChannelMap(int channelId) { // Since ProtoStep7 (#issue 108) return ((channelId & control -> ChannelMask) != 0); } // // Ports where to forward extended services' // TCP connections. // private: char *fontServerPort_; }; #endif /* ClientProxy_H */ nx-libs-3.5.99.23/nxcomp/src/ClientReadBuffer.cpp0000644000000000000000000001202613614532331016253 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ClientReadBuffer.h" #include "ClientChannel.h" #define PANIC #define WARNING #undef TEST #undef DEBUG unsigned int ClientReadBuffer::suggestedLength(unsigned int pendingLength) { // // Even if the pending data is not // enough to make a complete message, // resize the buffer to accommodate // it all. // unsigned int readLength = pendingLength; if (pendingLength < remaining_) { readLength = remaining_; } return readLength; } int ClientReadBuffer::locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &controlLength, unsigned int &dataLength, unsigned int &trailerLength) { unsigned int size = end - start; #ifdef TEST *logofs << "ClientReadBuffer: Locating message for FD#" << transport_ -> fd() << " with " << size << " bytes.\n" << logofs_flush; #endif if (firstMessage_) { if (size < 12) { remaining_ = 12 - size; #ifdef TEST *logofs << "ClientReadBuffer: No message was located " << "with remaining " << remaining_ << ".\n" << logofs_flush; #endif return 0; } if (*start == 0x42) { bigEndian_ = 1; } else { bigEndian_ = 0; } channel_ -> setBigEndian(bigEndian_); dataLength = 12 + RoundUp4(GetUINT(start + 6, bigEndian_)) + RoundUp4(GetUINT(start + 8, bigEndian_)); // // Send the data immediately if this is unlikely // to be a X connection attempt. // if (dataLength > 4096) { #ifdef WARNING *logofs << "ClientReadBuffer: WARNING! Flushing suspicious X " << "connection with first request of " << dataLength << " bytes.\n" << logofs_flush; #endif dataLength = size; } } else { if (size < 4) { remaining_ = 4 - size; #ifdef TEST *logofs << "ClientReadBuffer: No message was located " << "with remaining " << remaining_ << ".\n" << logofs_flush; #endif return 0; } dataLength = (GetUINT(start + 2, bigEndian_) << 2); if (dataLength < 4) { #ifdef TEST *logofs << "ClientReadBuffer: WARNING! Assuming length 4 " << "for suspicious message of length " << dataLength << ".\n" << logofs_flush; #endif dataLength = 4; } } #ifdef TEST *logofs << "ClientReadBuffer: Length of the next message is " << dataLength << ".\n" << logofs_flush; #endif if (size < dataLength) { remaining_ = dataLength - size; #ifdef TEST *logofs << "ClientReadBuffer: No message was located " << "with remaining " << remaining_ << ".\n" << logofs_flush; #endif return 0; } firstMessage_ = 0; controlLength = 0; trailerLength = 0; remaining_ = 0; #ifdef TEST *logofs << "ClientReadBuffer: Located message with " << "remaining " << remaining_ << ".\n" << logofs_flush; #endif return 1; } nx-libs-3.5.99.23/nxcomp/src/ClientReadBuffer.h0000644000000000000000000000523213614532331015721 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ClientReadBuffer_H #define ClientReadBuffer_H #include "Control.h" #include "ReadBuffer.h" class ClientChannel; class ClientReadBuffer : public ReadBuffer { public: ClientReadBuffer(Transport *transport, ClientChannel *channel) : ReadBuffer(transport), firstMessage_(1), channel_(channel) { } virtual ~ClientReadBuffer() { } protected: virtual unsigned int suggestedLength(unsigned int pendingLength); virtual int locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &controlLength, unsigned int &dataLength, unsigned int &trailerLength); int bigEndian_; int firstMessage_; ClientChannel *channel_; }; #endif /* ClientReadBuffer_H */ nx-libs-3.5.99.23/nxcomp/src/ClientStore.cpp0000644000000000000000000001710613614532331015346 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ClientStore.h" // // Cached request classes. // #include "ChangeProperty.h" #include "SendEvent.h" #include "CreateGC.h" #include "ChangeGC.h" #include "CreatePixmap.h" #include "SetClipRectangles.h" #include "CopyArea.h" #include "PolyLine.h" #include "PolySegment.h" #include "PolyFillRectangle.h" #include "PutImage.h" #include "TranslateCoords.h" #include "GetImage.h" #include "ClearArea.h" #include "ConfigureWindow.h" #include "ShapeExtension.h" #include "RenderExtension.h" #include "PolyText8.h" #include "PolyText16.h" #include "ImageText8.h" #include "ImageText16.h" #include "PolyPoint.h" #include "PolyFillArc.h" #include "PolyArc.h" #include "FillPoly.h" #include "InternAtom.h" #include "GetProperty.h" #include "SetUnpackGeometry.h" #include "SetUnpackColormap.h" #include "SetUnpackAlpha.h" #include "PutPackedImage.h" #include "GenericRequest.h" // // Set the verbosity level. // #define WARNING #define PANIC #undef TEST ClientStore::ClientStore(StaticCompressor *compressor) : compressor_(compressor) { if (logofs == NULL) { logofs = &cout; } for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) { requests_[i] = NULL; } requests_[X_ChangeProperty] = new ChangePropertyStore(); requests_[X_SendEvent] = new SendEventStore(); requests_[X_CreateGC] = new CreateGCStore(); requests_[X_SetClipRectangles] = new SetClipRectanglesStore(); requests_[X_CopyArea] = new CopyAreaStore(); requests_[X_PolyLine] = new PolyLineStore(); requests_[X_PolySegment] = new PolySegmentStore(); requests_[X_PolyFillRectangle] = new PolyFillRectangleStore(); requests_[X_PutImage] = new PutImageStore(compressor); requests_[X_TranslateCoords] = new TranslateCoordsStore(); requests_[X_GetImage] = new GetImageStore(); requests_[X_ClearArea] = new ClearAreaStore(); requests_[X_ConfigureWindow] = new ConfigureWindowStore(); requests_[X_PolyText8] = new PolyText8Store(); requests_[X_PolyText16] = new PolyText16Store(); requests_[X_ImageText8] = new ImageText8Store(); requests_[X_ImageText16] = new ImageText16Store(); requests_[X_PolyPoint] = new PolyPointStore(); requests_[X_PolyFillArc] = new PolyFillArcStore(); requests_[X_PolyArc] = new PolyArcStore(); requests_[X_FillPoly] = new FillPolyStore(); requests_[X_InternAtom] = new InternAtomStore(); requests_[X_GetProperty] = new GetPropertyStore(); requests_[X_NXInternalShapeExtension] = new ShapeExtensionStore(compressor); requests_[X_NXInternalGenericRequest] = new GenericRequestStore(compressor); requests_[X_NXInternalRenderExtension] = new RenderExtensionStore(compressor); requests_[X_NXSetUnpackGeometry] = new SetUnpackGeometryStore(compressor); requests_[X_NXPutPackedImage] = new PutPackedImageStore(compressor); // Since ProtoStep7 (#issue 108) requests_[X_ChangeGC] = new ChangeGCStore(); requests_[X_CreatePixmap] = new CreatePixmapStore(); requests_[X_NXSetUnpackColormap] = new SetUnpackColormapStore(compressor); requests_[X_NXSetUnpackAlpha] = new SetUnpackAlphaStore(compressor); for (int i = 0; i < CHANNEL_STORE_RESOURCE_LIMIT; i++) { splits_[i] = NULL; } commits_ = new CommitStore(compressor); } ClientStore::~ClientStore() { if (logofs == NULL) { logofs = &cout; } for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) { delete requests_[i]; } for (int i = 0; i < CHANNEL_STORE_RESOURCE_LIMIT; i++) { delete splits_[i]; } delete commits_; } int ClientStore::saveRequestStores(ostream *cachefs, md5_state_t *md5StateStream, md5_state_t *md5StateClient, T_checksum_action checksumAction, T_data_action dataAction) const { for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) { if (requests_[i] != NULL && requests_[i] -> saveStore(cachefs, md5StateStream, md5StateClient, checksumAction, dataAction, storeBigEndian()) < 0) { #ifdef WARNING *logofs << "ClientStore: WARNING! Error saving request store " << "for OPCODE#" << (unsigned int) i << ".\n" << logofs_flush; #endif cerr << "Warning" << ": Error saving request store " << "for opcode '" << (unsigned int) i << "'.\n"; return -1; } } return 1; } int ClientStore::loadRequestStores(istream *cachefs, md5_state_t *md5StateStream, T_checksum_action checksumAction, T_data_action dataAction) const { for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) { if (requests_[i] != NULL && requests_[i] -> loadStore(cachefs, md5StateStream, checksumAction, dataAction, storeBigEndian()) < 0) { #ifdef WARNING *logofs << "ClientStore: WARNING! Error loading request store " << "for OPCODE#" << (unsigned int) i << ".\n" << logofs_flush; #endif return -1; } } return 1; } void ClientStore::dumpSplitStores() const { for (int i = 0; i < CHANNEL_STORE_RESOURCE_LIMIT; i++) { if (splits_[i] != NULL) { splits_[i] -> dump(); } } if ((getSplitTotalSize() != 0 && getSplitTotalStorageSize() == 0) || (getSplitTotalSize() == 0 && getSplitTotalStorageSize() != 0)) { #ifdef PANIC *logofs << "ClientStore: PANIC! Inconsistency detected " << "while handling the split stores.\n" << logofs_flush; #endif HandleCleanup(); } } nx-libs-3.5.99.23/nxcomp/src/ClientStore.h0000644000000000000000000000763713614532331015023 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ClientStore_H #define ClientStore_H #include "Message.h" #include "Split.h" #include "ChannelStore.h" class StaticCompressor; class ClientStore : public ChannelStore { public: ClientStore(StaticCompressor *compressor); virtual ~ClientStore(); // // Get the store based on the index. // MessageStore *getRequestStore(unsigned char opcode) const { return requests_[opcode]; } SplitStore *getSplitStore(int resource) const { return splits_[resource]; } int getSplitTotalSize() const { return SplitStore::getTotalSize(); } int getSplitTotalStorageSize() const { return SplitStore::getTotalStorageSize(); } CommitStore *getCommitStore() const { return commits_; } int getCommitSize() const { return commits_ -> getSize(); } void dumpSplitStore(int resource) const { splits_[resource] -> dump(); } void dumpCommitStore() const { commits_ -> dump(); } void dumpSplitStores() const; SplitStore *createSplitStore(int resource) { splits_[resource] = new SplitStore(compressor_, commits_, resource); return splits_[resource]; } void destroySplitStore(int resource) { delete splits_[resource]; splits_[resource] = NULL; } // // Actually save the message store // to disk according to proxy mode. // int saveRequestStores(ostream *cachefs, md5_state_t *md5StateStream, md5_state_t *md5StateClient, T_checksum_action checksumAction, T_data_action dataAction) const; int loadRequestStores(istream *cachefs, md5_state_t *md5StateStream, T_checksum_action checksumAction, T_data_action dataAction) const; private: // // A client store contains requests. // MessageStore *requests_[CHANNEL_STORE_OPCODE_LIMIT]; // // Client messages being split. // SplitStore *splits_[CHANNEL_STORE_RESOURCE_LIMIT]; // // Messages having been recomposed. // CommitStore *commits_; // // Passed forward to the other stores. // StaticCompressor *compressor_; }; #endif /* ClientStore_H */ nx-libs-3.5.99.23/nxcomp/src/Colormap.cpp0000644000000000000000000000744713614532331014676 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Misc.h" #include "Unpack.h" #include "Colormap.h" #define PANIC #define WARNING #undef TEST #undef DEBUG int UnpackColormap(unsigned char method, unsigned char *src_data, int src_size, unsigned char *dst_data, int dst_size) { if (*src_data == 0) { if (dst_size != src_size - 1) { #ifdef TEST *logofs << "UnpackColormap: PANIC! Invalid destination size " << dst_size << " with source " << src_size << ".\n" << logofs_flush; #endif return -1; } #ifdef TEST *logofs << "UnpackColormap: Expanding " << src_size - 1 << " bytes of plain colormap data.\n" << logofs_flush; #endif memcpy(dst_data, src_data + 1, src_size - 1); return 1; } unsigned int check_size = dst_size; int result = ZDecompress(&unpackStream, dst_data, &check_size, src_data + 1, src_size - 1); if (result != Z_OK) { #ifdef PANIC *logofs << "UnpackColormap: PANIC! Failure decompressing colormap data. " << "Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failure decompressing colormap data. " << "Error is '" << zError(result) << "'.\n"; return -1; } else if (check_size != (unsigned int) dst_size) { #ifdef PANIC *logofs << "UnpackColormap: PANIC! Size mismatch in colormap data. " << "Resulting size is " << check_size << " with " << "expected size " << dst_size << ".\n" << logofs_flush; #endif cerr << "Error" << ": Size mismatch in colormap data. " << "Resulting size is " << check_size << " with " << "expected size " << dst_size << ".\n"; return -1; } #ifdef TEST *logofs << "UnpackColormap: Decompressed " << src_size - 1 << " bytes to " << dst_size << " bytes of colormap data.\n" << logofs_flush; #endif return 1; } nx-libs-3.5.99.23/nxcomp/src/Colormap.h0000644000000000000000000000401013614532331014322 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Colormap_H #define Colormap_H int UnpackColormap(unsigned char method, unsigned char *src_data, int src_size, unsigned char *dst_data, int dst_size); #endif /* Colormap_H */ nx-libs-3.5.99.23/nxcomp/src/ConfigureWindow.cpp0000644000000000000000000001120313614532331016214 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ConfigureWindow.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int ConfigureWindowStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { ConfigureWindowMessage *configureWindow = (ConfigureWindowMessage *) message; // // Here is the fingerprint. // configureWindow -> window = GetULONG(buffer + 4, bigEndian); configureWindow -> value_mask = GetUINT(buffer + 8, bigEndian); // // To increase effectiveness of the caching algorithm // we remove the unused bytes carried in the data part. // if ((int) size > dataOffset) { #ifdef DEBUG *logofs << name() << ": Removing unused bytes from the data payload.\n" << logofs_flush; #endif configureWindow -> value_mask &= (1 << 7) - 1; unsigned int mask = 0x1; unsigned char *source = (unsigned char *) buffer + CONFIGUREWINDOW_DATA_OFFSET; unsigned long value = 0; for (unsigned int i = 0; i < 7; i++) { if (configureWindow -> value_mask & mask) { value = GetULONG(source, bigEndian); value &= (1 << CONFIGUREWINDOW_FIELD_WIDTH[i]) - 1; PutULONG(value, source, bigEndian); source += 4; } mask <<= 1; } } #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int ConfigureWindowStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { ConfigureWindowMessage *configureWindow = (ConfigureWindowMessage *) message; // // Fill all the message's fields. // PutULONG(configureWindow -> window, buffer + 4, bigEndian); PutUINT(configureWindow -> value_mask, buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void ConfigureWindowStore::dumpIdentity(const Message *message) const { #ifdef DUMP ConfigureWindowMessage *configureWindow = (ConfigureWindowMessage *) message; *logofs << "ConfigureWindow: window " << configureWindow -> window << ", value_mask " << configureWindow -> value_mask << ", size " << configureWindow -> size_ << ".\n"; #endif } void ConfigureWindowStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { md5_append(md5_state_, buffer + 4, 4); md5_append(md5_state_, buffer + 8, 2); } nx-libs-3.5.99.23/nxcomp/src/ConfigureWindow.h0000644000000000000000000001200213614532331015657 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ConfigureWindow_H #define ConfigureWindow_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define CONFIGUREWINDOW_ENABLE_CACHE 1 #define CONFIGUREWINDOW_ENABLE_DATA 0 #define CONFIGUREWINDOW_ENABLE_SPLIT 0 #define CONFIGUREWINDOW_ENABLE_COMPRESS 0 #define CONFIGUREWINDOW_DATA_LIMIT 32 #define CONFIGUREWINDOW_DATA_OFFSET 12 #define CONFIGUREWINDOW_CACHE_SLOTS 3000 #define CONFIGUREWINDOW_CACHE_THRESHOLD 5 #define CONFIGUREWINDOW_CACHE_LOWER_THRESHOLD 1 // // The message class. // class ConfigureWindowMessage : public Message { friend class ConfigureWindowStore; public: ConfigureWindowMessage() { } ~ConfigureWindowMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned int window; unsigned short value_mask; }; class ConfigureWindowStore : public MessageStore { // // Constructors and destructors. // public: ConfigureWindowStore() : MessageStore() { enableCache = CONFIGUREWINDOW_ENABLE_CACHE; enableData = CONFIGUREWINDOW_ENABLE_DATA; enableSplit = CONFIGUREWINDOW_ENABLE_SPLIT; enableCompress = CONFIGUREWINDOW_ENABLE_COMPRESS; dataLimit = CONFIGUREWINDOW_DATA_LIMIT; dataOffset = CONFIGUREWINDOW_DATA_OFFSET; cacheSlots = CONFIGUREWINDOW_CACHE_SLOTS; cacheThreshold = CONFIGUREWINDOW_CACHE_THRESHOLD; cacheLowerThreshold = CONFIGUREWINDOW_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~ConfigureWindowStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "ConfigureWindow"; } virtual unsigned char opcode() const { return X_ConfigureWindow; } virtual unsigned int storage() const { return sizeof(ConfigureWindowMessage); } // // Message handling methods. // public: virtual Message *create() const { return new ConfigureWindowMessage(); } virtual Message *create(const Message &message) const { return new ConfigureWindowMessage((const ConfigureWindowMessage &) message); } virtual void destroy(Message *message) const { delete (ConfigureWindowMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* ConfigureWindow_H */ nx-libs-3.5.99.23/nxcomp/src/Control.cpp0000644000000000000000000005324213614532331014534 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "NX.h" #include "NXpack.h" #include "Control.h" #define PANIC #define WARNING #undef TEST #undef DEBUG // // Flush immediately on prioritized messages. // #define FLUSH_PRIORITY 0 // // Maximum number of bytes sent for each token. // #define TOKEN_SIZE 1536 // // Maximum number of tokens that can be spent // by the client proxy before having to block // waiting for a token reply. // #define TOKEN_LIMIT 24 // // By default assume the proxy is running as a // standalone program. // #define LINK_ENCRYPTED 0 // // Maximum number of pids the proxy will record // and kill at shutdown. // #define KILL_LIMIT 16 // // Allocate on the NX client side channels whose // ids are a multiple of 8 (starting from 0). All // the other ids can be used to allocate channels // at the NX server side (X client side). // #define CHANNEL_MASK 0x07 // // Kill session if control parameters cannot be // negotiated before this timeout. // #define INIT_TIMEOUT 60000 // // Enter the congestion state if the remote does // not reply to a ping within the given amount // of time. // #define PING_TIMEOUT 5000 // // Only send one motion event any N milliseconds. // #define MOTION_TIMEOUT 0 // // Force an update of the congestion counter if // the proxy is idle for this time. // #define IDLE_TIMEOUT 50 // // Close X connection if can't write before this // timeout. // #define CHANNEL_TIMEOUT 10000 // // Warn user (or close proxy connection) if don't // receive any data before this timeout. // #define PROXY_TIMEOUT 120000 // // How many milliseconds to wait for the shared // memory completion event to become available. // #define SHMEM_TIMEOUT 200 // // Before closing down the proxy, wait for the // given amount of milliseconds to let all the // running applications to close down their // connections. // // A null timeout will cause the proxy to wait // indefinitely, until the watchdog process is // killed. This is usually the way the proxy is // started by the NX server. If on the other // hand a timeout is given and there no channel // is remaining, the proxy will be closed down // using a small timeout, presently of 500 ms. // #define CLEANUP_TIMEOUT 3000 // // Wait this amount of milliseconds after any // iteration of the house-keeping process. // #define KEEPER_TIMEOUT 60000 // // In case of timeout, select can return control // to program earlier or later of this amount of // ms. Consider this when calculating if timeout // is elapsed. // #define LATENCY_TIMEOUT 1 // // Control memory allocation in transport // and other classes. // #define TRANSPORT_X_BUFFER_SIZE 131072 #define TRANSPORT_PROXY_BUFFER_SIZE 65536 #define TRANSPORT_GENERIC_BUFFER_SIZE 16384 #define TRANSPORT_X_BUFFER_THRESHOLD 262144 #define TRANSPORT_PROXY_BUFFER_THRESHOLD 131072 #define TRANSPORT_GENERIC_BUFFER_THRESHOLD 32768 // // Never allow buffers to exceed this limit. // #define TRANSPORT_MAXIMUM_BUFFER_SIZE 393216 // // Immediately flush the accumulated data to // the X server if the write buffer exceeds // this size. // #define TRANSPORT_FLUSH_BUFFER_SIZE 16384 // // Defaults used for socket options. // #define OPTION_PROXY_KEEP_ALIVE 0 #define OPTION_PROXY_LOW_DELAY 1 #define OPTION_PROXY_CLIENT_NO_DELAY 1 #define OPTION_PROXY_SERVER_NO_DELAY 1 #define OPTION_CLIENT_NO_DELAY 1 #define OPTION_SERVER_NO_DELAY 1 #define OPTION_PROXY_RECEIVE_BUFFER -1 #define OPTION_CLIENT_RECEIVE_BUFFER -1 #define OPTION_SERVER_RECEIVE_BUFFER -1 #define OPTION_PROXY_SEND_BUFFER -1 #define OPTION_CLIENT_SEND_BUFFER -1 #define OPTION_SERVER_SEND_BUFFER -1 #define OPTION_PROXY_RETRY_CONNECT 30 #define OPTION_PROXY_RETRY_ACCEPT 3 #define OPTION_SERVER_RETRY_CONNECT 3 // // Defaults used for cache persistence. // #define PERSISTENT_CACHE_THRESHOLD 102400 #define PERSISTENT_CACHE_ENABLE_LOAD 1 #define PERSISTENT_CACHE_ENABLE_SAVE 1 #define PERSISTENT_CACHE_CHECK_ON_SHUTDOWN 0 #define PERSISTENT_CACHE_LOAD_PACKED 1 #define PERSISTENT_CACHE_LOAD_RENDER 1 #define PERSISTENT_CACHE_DISK_LIMIT 33554432 // // Defaults used for image cache. // #define IMAGE_CACHE_ENABLE_LOAD 0 #define IMAGE_CACHE_ENABLE_SAVE 0 #define IMAGE_CACHE_DISK_LIMIT 33554432 // // Suggested defaults for read length parameters // used by read buffer classes. // #define CLIENT_INITIAL_READ_SIZE 8192 #define CLIENT_MAXIMUM_BUFFER_SIZE 262144 #define SERVER_INITIAL_READ_SIZE 8192 #define SERVER_MAXIMUM_BUFFER_SIZE 65536 #define PROXY_INITIAL_READ_SIZE 65536 #define PROXY_MAXIMUM_BUFFER_SIZE 262144 + 1024 #define GENERIC_INITIAL_READ_SIZE 8192 #define GENERIC_MAXIMUM_BUFFER_SIZE 8192 // // Calculate bitrate in given time frames. // Values are in milliseconds. // #define SHORT_BITRATE_TIME_FRAME 5000 #define LONG_BITRATE_TIME_FRAME 30000 // // Bandwidth control. A value of 0 means no // limit. Values are stored internally in // bytes per second. // #define CLIENT_BITRATE_LIMIT 0 #define SERVER_BITRATE_LIMIT 0 // // Default values for cache control. We limit // the maximum size of a request to 262144 but // we need to consider the replies, whose size // may be up to 4MB. // #define MINIMUM_MESSAGE_SIZE 4 #define MAXIMUM_MESSAGE_SIZE 4194304 #define MAXIMUM_REQUEST_SIZE 262144 #define CLIENT_TOTAL_STORAGE_SIZE 8388608 #define SERVER_TOTAL_STORAGE_SIZE 8388608 #define STORE_TIME_LIMIT 3600 #define STORE_HITS_LOAD_BONUS 10 #define STORE_HITS_ADD_BONUS 20 #define STORE_HITS_LIMIT 100 #define STORE_HITS_TOUCH 1 #define STORE_HITS_UNTOUCH 2 // // Default parameters for message splitting. // #define SPLIT_MODE 1 #define SPLIT_TIMEOUT 50 #define SPLIT_TOTAL_SIZE 128 #define SPLIT_TOTAL_STORAGE_SIZE 1048576 #define SPLIT_DATA_THRESHOLD 65536 #define SPLIT_DATA_PACKET_LIMIT 24576 // // Agent related parameters. // #define PACK_METHOD 63 #define PACK_QUALITY 9 #define HIDE_RENDER 0 #define TAINT_REPLIES 1 #define TAINT_THRESHOLD 8 // // In current version only X server support is // implemented. Note that use of shared memory // is negotiated according to options provided // by the user. // #define SHMEM_CLIENT 0 #define SHMEM_SERVER 1 // // Default size of shared memory segments used // in MIT-SHM support. // #define SHMEM_CLIENT_SIZE 0 #define SHMEM_SERVER_SIZE 2097152 // // What do we do at the end of session? If this // flag is set, we launch a new client letting // the user run a new NX session. // #define ENABLE_RESTART_ON_SHUTDOWN 0 // // Do we produce a core dump on fatal errors? // #define ENABLE_CORE_DUMP_ON_ABORT 0 // // Reopen the log file if it exceeds this size. // #define FILE_SIZE_LIMIT 60000000 // // Check periodically if we need to truncate the // log file. By default check every minute. // #define FILE_SIZE_CHECK_TIMEOUT 60000 // // Protocol version compatibility values // const int Control::NX_MIN_PROTO_STEP = 10; const int Control::NX_MAX_PROTO_STEP = 10; const char* const Control::NXPROXY_COMPATIBILITY_VERSION = "3.5.0"; // // Set defaults for control. They should be what // you get in case of 'local' connection. // Control::Control() { ProxyMode = proxy_undefined; ProxyStage = stage_undefined; SessionMode = session_undefined; FlushPolicy = policy_undefined; LinkMode = link_undefined; LinkEncrypted = LINK_ENCRYPTED; FlushPriority = FLUSH_PRIORITY; TokenSize = TOKEN_SIZE; TokenLimit = TOKEN_LIMIT; ChannelMask = CHANNEL_MASK; InitTimeout = INIT_TIMEOUT; PingTimeout = PING_TIMEOUT; MotionTimeout = MOTION_TIMEOUT; IdleTimeout = IDLE_TIMEOUT; ChannelTimeout = CHANNEL_TIMEOUT; ProxyTimeout = PROXY_TIMEOUT; ShmemTimeout = SHMEM_TIMEOUT; CleanupTimeout = CLEANUP_TIMEOUT; KeeperTimeout = KEEPER_TIMEOUT; LatencyTimeout = LATENCY_TIMEOUT; FileSizeLimit = FILE_SIZE_LIMIT; FileSizeCheckTimeout = FILE_SIZE_CHECK_TIMEOUT; EnableRestartOnShutdown = ENABLE_RESTART_ON_SHUTDOWN; KillDaemonOnShutdownLimit = KILL_LIMIT; KillDaemonOnShutdown = new int[KillDaemonOnShutdownLimit]; for (int i = 0; i < KILL_LIMIT; i++) { KillDaemonOnShutdown[i] = -1; } KillDaemonOnShutdownNumber = 0; EnableCoreDumpOnAbort = ENABLE_CORE_DUMP_ON_ABORT; // // Collect statistics by default. // EnableStatistics = 1; // // Memory restrictions if any. // LocalMemoryLevel = -1; // // Compression must be negotiated between proxies. // LocalDeltaCompression = -1; RemoteDeltaCompression = -1; LocalDataCompression = -1; LocalStreamCompression = -1; RemoteDataCompression = -1; RemoteStreamCompression = -1; LocalDataCompressionLevel = -1; LocalDataCompressionThreshold = -1; LocalStreamCompressionLevel = -1; RemoteDataCompressionLevel = -1; RemoteStreamCompressionLevel = -1; // // Transport buffers' allocation parameters. // TransportXBufferSize = TRANSPORT_X_BUFFER_SIZE; TransportProxyBufferSize = TRANSPORT_PROXY_BUFFER_SIZE; TransportGenericBufferSize = TRANSPORT_GENERIC_BUFFER_SIZE; TransportXBufferThreshold = TRANSPORT_X_BUFFER_THRESHOLD; TransportProxyBufferThreshold = TRANSPORT_PROXY_BUFFER_THRESHOLD; TransportGenericBufferThreshold = TRANSPORT_GENERIC_BUFFER_THRESHOLD; TransportMaximumBufferSize = TRANSPORT_MAXIMUM_BUFFER_SIZE; // // Flush the write buffer if it exceeds // this size. // TransportFlushBufferSize = TRANSPORT_FLUSH_BUFFER_SIZE; // // Socket options. // OptionProxyKeepAlive = OPTION_PROXY_KEEP_ALIVE; OptionProxyLowDelay = OPTION_PROXY_LOW_DELAY; OptionProxyClientNoDelay = OPTION_PROXY_CLIENT_NO_DELAY; OptionProxyServerNoDelay = OPTION_PROXY_SERVER_NO_DELAY; OptionClientNoDelay = OPTION_CLIENT_NO_DELAY; OptionServerNoDelay = OPTION_SERVER_NO_DELAY; OptionProxyReceiveBuffer = OPTION_PROXY_RECEIVE_BUFFER; OptionClientReceiveBuffer = OPTION_CLIENT_RECEIVE_BUFFER; OptionServerReceiveBuffer = OPTION_SERVER_RECEIVE_BUFFER; OptionProxySendBuffer = OPTION_PROXY_SEND_BUFFER; OptionClientSendBuffer = OPTION_CLIENT_SEND_BUFFER; OptionServerSendBuffer = OPTION_SERVER_SEND_BUFFER; OptionProxyRetryAccept = OPTION_PROXY_RETRY_ACCEPT; OptionProxyRetryConnect = OPTION_PROXY_RETRY_CONNECT; OptionServerRetryConnect = OPTION_SERVER_RETRY_CONNECT; // // Base NX directories. // HomePath = NULL; RootPath = NULL; SystemPath = NULL; TempPath = NULL; ClientPath = NULL; // // Set defaults for handling persistent cache. // PersistentCachePath = NULL; PersistentCacheName = NULL; PersistentCacheThreshold = PERSISTENT_CACHE_THRESHOLD; PersistentCacheEnableLoad = PERSISTENT_CACHE_ENABLE_LOAD; PersistentCacheEnableSave = PERSISTENT_CACHE_ENABLE_SAVE; PersistentCacheCheckOnShutdown = PERSISTENT_CACHE_CHECK_ON_SHUTDOWN; PersistentCacheLoadPacked = PERSISTENT_CACHE_LOAD_PACKED; PersistentCacheLoadRender = PERSISTENT_CACHE_LOAD_RENDER; PersistentCacheDiskLimit = PERSISTENT_CACHE_DISK_LIMIT; // // Set defaults for image cache. // ImageCachePath = NULL; ImageCacheEnableLoad = IMAGE_CACHE_ENABLE_LOAD; ImageCacheEnableSave = IMAGE_CACHE_ENABLE_SAVE; ImageCacheDiskLimit = IMAGE_CACHE_DISK_LIMIT; // // Set defaults for the read buffers. // ClientInitialReadSize = CLIENT_INITIAL_READ_SIZE; ClientMaximumBufferSize = CLIENT_MAXIMUM_BUFFER_SIZE; ServerInitialReadSize = SERVER_INITIAL_READ_SIZE; ServerMaximumBufferSize = SERVER_MAXIMUM_BUFFER_SIZE; ProxyInitialReadSize = PROXY_INITIAL_READ_SIZE; ProxyMaximumBufferSize = PROXY_MAXIMUM_BUFFER_SIZE; GenericInitialReadSize = GENERIC_INITIAL_READ_SIZE; GenericMaximumBufferSize = GENERIC_MAXIMUM_BUFFER_SIZE; ShortBitrateTimeFrame = SHORT_BITRATE_TIME_FRAME; LongBitrateTimeFrame = LONG_BITRATE_TIME_FRAME; // // Bandwidth control. // LocalBitrateLimit = -1; ClientBitrateLimit = CLIENT_BITRATE_LIMIT; ServerBitrateLimit = SERVER_BITRATE_LIMIT; // // Default parameters for message handling. // ClientTotalStorageSize = CLIENT_TOTAL_STORAGE_SIZE; ServerTotalStorageSize = SERVER_TOTAL_STORAGE_SIZE; LocalTotalStorageSize = -1; RemoteTotalStorageSize = -1; StoreTimeLimit = STORE_TIME_LIMIT; StoreHitsLoadBonus = STORE_HITS_LOAD_BONUS; StoreHitsAddBonus = STORE_HITS_ADD_BONUS; StoreHitsLimit = STORE_HITS_LIMIT; StoreHitsTouch = STORE_HITS_TOUCH; StoreHitsUntouch = STORE_HITS_UNTOUCH; MinimumMessageSize = MINIMUM_MESSAGE_SIZE; MaximumMessageSize = MAXIMUM_MESSAGE_SIZE; MaximumRequestSize = MAXIMUM_REQUEST_SIZE; SplitMode = SPLIT_MODE; SplitTimeout = SPLIT_TIMEOUT; SplitTotalSize = SPLIT_TOTAL_SIZE; SplitTotalStorageSize = SPLIT_TOTAL_STORAGE_SIZE; SplitDataThreshold = SPLIT_DATA_THRESHOLD; SplitDataPacketLimit = SPLIT_DATA_PACKET_LIMIT; PackMethod = PACK_METHOD; PackQuality = PACK_QUALITY; HideRender = HIDE_RENDER; TaintReplies = TAINT_REPLIES; TaintThreshold = TAINT_THRESHOLD; ShmemClient = SHMEM_CLIENT; ShmemServer = SHMEM_SERVER; ShmemClientSize = SHMEM_CLIENT_SIZE; ShmemServerSize = SHMEM_SERVER_SIZE; // // Get local version number from compile time // settings. Version of remote proxy will be // checked at connection time. // RemoteVersionMajor = -1; RemoteVersionMinor = -1; RemoteVersionPatch = -1; RemoteVersionMaintenancePatch = -1; CompatVersionMajor = -1; CompatVersionMinor = -1; CompatVersionPatch = -1; CompatVersionMaintenancePatch = -1; LocalVersionMajor = NXMajorVersion(); LocalVersionMinor = NXMinorVersion(); LocalVersionPatch = NXPatchVersion(); LocalVersionMaintenancePatch = NXMaintenancePatchVersion(); #ifdef TEST *logofs << "Control: Major version is " << LocalVersionMajor << " minor is " << LocalVersionMinor << " patch is " << LocalVersionPatch << " Maintenance version is " << LocalVersionMaintenancePatch << ".\n" << logofs_flush; #endif // // Initialize local implemented methods later // and negotiate remote methods at connection // time. // LocalUnpackMethods = NULL; RemoteUnpackMethods = NULL; // // Set to 1 those methods which are implemented. // setLocalUnpackMethods(); // // Set the protocol version at the // time the session is negotiated. // protoStep_ = 0; } Control::~Control() { if (KillDaemonOnShutdown != NULL) { delete [] KillDaemonOnShutdown; } if (HomePath != NULL) { delete [] HomePath; } if (RootPath != NULL) { delete [] RootPath; } if (SystemPath != NULL) { delete [] SystemPath; } if (TempPath != NULL) { delete [] TempPath; } if (ClientPath != NULL) { delete [] ClientPath; } if (PersistentCachePath != NULL) { delete [] PersistentCachePath; } if (PersistentCacheName != NULL) { delete [] PersistentCacheName; } if (LocalUnpackMethods != NULL) { delete [] LocalUnpackMethods; } if (RemoteUnpackMethods != NULL) { delete [] RemoteUnpackMethods; } if (ImageCachePath != NULL) { delete [] ImageCachePath; } } // // Set the protocol step based on the // remote version. // void Control::setProtoStep(int step) { if (isValidProtoStep(step)) { protoStep_ = step; } else { #ifdef PANIC *logofs << "Control: PANIC! Invalid protocol step " << "with value " << step << ".\n" << logofs_flush; #endif HandleCleanup(); } } int Control::getProtoStep() { if (isValidProtoStep(protoStep_)) { return protoStep_; } else { #ifdef PANIC *logofs << "Control: PANIC! Can't identify the " << "protocol step.\n" << logofs_flush; #endif HandleCleanup(); } } // // Set here the pack/unpack methods that are // implemented by this NX proxy. // void Control::setLocalUnpackMethods() { LocalUnpackMethods = new unsigned char[PACK_METHOD_LIMIT]; RemoteUnpackMethods = new unsigned char[PACK_METHOD_LIMIT]; for (int i = 0; i < PACK_METHOD_LIMIT; i++) { LocalUnpackMethods[i] = 0; RemoteUnpackMethods[i] = 0; } LocalUnpackMethods[NO_PACK] = 1; LocalUnpackMethods[PACK_MASKED_8_COLORS] = 1; LocalUnpackMethods[PACK_MASKED_64_COLORS] = 1; LocalUnpackMethods[PACK_MASKED_256_COLORS] = 1; LocalUnpackMethods[PACK_MASKED_512_COLORS] = 1; LocalUnpackMethods[PACK_MASKED_4K_COLORS] = 1; LocalUnpackMethods[PACK_MASKED_32K_COLORS] = 1; LocalUnpackMethods[PACK_MASKED_64K_COLORS] = 1; LocalUnpackMethods[PACK_MASKED_256K_COLORS] = 1; LocalUnpackMethods[PACK_MASKED_2M_COLORS] = 1; LocalUnpackMethods[PACK_MASKED_16M_COLORS] = 1; LocalUnpackMethods[PACK_RAW_8_BITS] = 1; LocalUnpackMethods[PACK_RAW_16_BITS] = 1; LocalUnpackMethods[PACK_RAW_24_BITS] = 1; LocalUnpackMethods[PACK_COLORMAP_256_COLORS] = 1; LocalUnpackMethods[PACK_JPEG_8_COLORS] = 1; LocalUnpackMethods[PACK_JPEG_64_COLORS] = 1; LocalUnpackMethods[PACK_JPEG_256_COLORS] = 1; LocalUnpackMethods[PACK_JPEG_512_COLORS] = 1; LocalUnpackMethods[PACK_JPEG_4K_COLORS] = 1; LocalUnpackMethods[PACK_JPEG_32K_COLORS] = 1; LocalUnpackMethods[PACK_JPEG_64K_COLORS] = 1; LocalUnpackMethods[PACK_JPEG_256K_COLORS] = 1; LocalUnpackMethods[PACK_JPEG_2M_COLORS] = 1; LocalUnpackMethods[PACK_JPEG_16M_COLORS] = 1; LocalUnpackMethods[PACK_PNG_8_COLORS] = 1; LocalUnpackMethods[PACK_PNG_64_COLORS] = 1; LocalUnpackMethods[PACK_PNG_256_COLORS] = 1; LocalUnpackMethods[PACK_PNG_512_COLORS] = 1; LocalUnpackMethods[PACK_PNG_4K_COLORS] = 1; LocalUnpackMethods[PACK_PNG_32K_COLORS] = 1; LocalUnpackMethods[PACK_PNG_64K_COLORS] = 1; LocalUnpackMethods[PACK_PNG_256K_COLORS] = 1; LocalUnpackMethods[PACK_PNG_2M_COLORS] = 1; LocalUnpackMethods[PACK_PNG_16M_COLORS] = 1; LocalUnpackMethods[PACK_RGB_16M_COLORS] = 1; LocalUnpackMethods[PACK_RLE_16M_COLORS] = 1; LocalUnpackMethods[PACK_ALPHA] = 1; LocalUnpackMethods[PACK_COLORMAP] = 1; LocalUnpackMethods[PACK_BITMAP_16M_COLORS] = 1; } nx-libs-3.5.99.23/nxcomp/src/Control.h0000644000000000000000000003463113614532331014202 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Control_H #define Control_H #include "NXpack.h" #include "Misc.h" #include "Types.h" #include "Timestamp.h" #include "Statistics.h" #define PANIC #define WARNING #undef TEST #undef DEBUG // // This is the mode proxy is running. // typedef enum { proxy_undefined = -1, proxy_client, proxy_server, proxy_last_tag } T_proxy_mode; // // Handle advances in the connection // procedure. // typedef enum { stage_undefined, stage_initializing, stage_connecting, stage_connected, stage_waiting_forwarder_version, stage_waiting_forwarder_options, stage_sending_forwarder_options, stage_waiting_proxy_version, stage_waiting_proxy_options, stage_sending_proxy_options, stage_waiting_proxy_caches, stage_sending_proxy_caches, stage_operational, stage_terminating, stage_terminated } T_proxy_stage; // // Hint about whether or not the proxy is // connected to a NX agen. // typedef enum { session_undefined = -1, session_agent, session_shadow, session_proxy, session_last_tag } T_session_mode; // // Set how data will be written to the peer // socket. // typedef enum { policy_undefined = -1, policy_immediate, policy_deferred } T_flush_policy; // // Link mode, after negotiation, will be set to // any of the values defined in the NXproto.h. // #define link_undefined -1; // // This class collects functioning parameters, // to be configurable at run-time. They are for // the most part regarding timeouts, transport // and message stores handling. // class Control { public: // // Does proxy run in client mode or server mode? // As soon as we'll have gone through parsing of // the command line options the current mode will // be propagated to the control class. // T_proxy_mode ProxyMode; // // Goes from initializing to operational. // T_proxy_stage ProxyStage; // // Hint about type of session currently running. // T_session_mode SessionMode; // // Either immediate or defferred flushes. // T_flush_policy FlushPolicy; // // If set, the channels will try to flush the // encoded data whenever there is a prioritized // message. Depending on the flush policy, this // may determine an immediate flush or an event // being generated telling to the agent that it // should flush the proxy link. // int FlushPriority; // // Id corresponding to link speed negotiated // between proxies. // int LinkMode; // // Set if the proxy is connected to a program // providing the encryption of the point to // point communication. // int LinkEncrypted; // // Maximum number of bytes sent for each token. // int TokenSize; // // Maximum number of tokens that can be spent // by the client proxy before having to block // waiting for a reply. // int TokenLimit; // // Bitmask used to determine the distribution // of channel ids between the client and server // proxies. // int ChannelMask; // // Kill session if control parameters cannot // be negotiated before this timeout. // int InitTimeout; // // Enter the congestion state if the remote does // not reply to the ping within the given amount // of time. // int PingTimeout; // // Enqueue motion notify events in server channel. // int MotionTimeout; // // Force an update of the congestion counter if // the proxy is idle for this time. // int IdleTimeout; // // Close the connection if can't write before // this timeout. // int ChannelTimeout; // // Close connection if can't write before // this timeout. // int ProxyTimeout; // // How many milliseconds to wait for the shared // memory completion event to become available. // int ShmemTimeout; // // Wait for applications to complete at the time // proxy is shut down. // int CleanupTimeout; // // Wait this amount of milliseconds before any // iteration of the house-keeping process. // int KeeperTimeout; // // Adjust timeout calculations. // int LatencyTimeout; // // Maximum allowed size of log files. // int FileSizeLimit; int FileSizeCheckTimeout; // // What do we do at the end of session? If // this flag is set we launch a new client // letting the user run a new NX session. // int EnableRestartOnShutdown; // // The client can request the proxy to kill // a number of processes before exiting. // int *KillDaemonOnShutdown; int KillDaemonOnShutdownNumber; int KillDaemonOnShutdownLimit; // // Do we generate a core dump and exit in // case of program errors? // int EnableCoreDumpOnAbort; // // Is statistic output enabled? // int EnableStatistics; // // Version number of local and remote proxy. // /* * LocalVersionMaintenancePatch, RemoteVersionMaintenancePatch * CompatVersionMaintenancePatch * * currently not used, for future compatibility checks */ int LocalVersionMajor; int LocalVersionMinor; int LocalVersionPatch; int LocalVersionMaintenancePatch; int RemoteVersionMajor; int RemoteVersionMinor; int RemoteVersionPatch; int RemoteVersionMaintenancePatch; int CompatVersionMajor; int CompatVersionMinor; int CompatVersionPatch; int CompatVersionMaintenancePatch; // // Compatibility version for the proxy // static const char* const NXPROXY_COMPATIBILITY_VERSION; // // Which unpack methods are implemented in proxy? // unsigned char *LocalUnpackMethods; unsigned char *RemoteUnpackMethods; // // Memory restriction imposed by user. // int LocalMemoryLevel; // // Use or not differential compression // and caching of X protocol messages. // int LocalDeltaCompression; int RemoteDeltaCompression; // // Compression of images and replies. // int LocalDataCompression; int LocalDataCompressionLevel; int RemoteDataCompression; int RemoteDataCompressionLevel; // // Minimum packet size to be compressed. // int LocalDataCompressionThreshold; // // Compress or not data flowing through the proxy // link. Level should be one of the ZLIB level as // Z_DEFAULT_COMPRESSION or Z_BEST_COMPRESSION. // int LocalStreamCompression; int LocalStreamCompressionLevel; int RemoteStreamCompression; int RemoteStreamCompressionLevel; // // Size of read operations in read buffer classes. // int ClientInitialReadSize; int ClientMaximumBufferSize; int ServerInitialReadSize; int ServerMaximumBufferSize; int ProxyInitialReadSize; int ProxyMaximumBufferSize; int GenericInitialReadSize; int GenericMaximumBufferSize; // // Set initial size and resize policy of // transport buffers. If maximum size is // exceeded, print a warning. // int TransportXBufferSize; int TransportProxyBufferSize; int TransportGenericBufferSize; int TransportXBufferThreshold; int TransportProxyBufferThreshold; int TransportGenericBufferThreshold; int TransportMaximumBufferSize; // // Flush the data produced for the channel // connection if it exceeds this size. // int TransportFlushBufferSize; // // Socket options. // int OptionProxyKeepAlive; int OptionProxyLowDelay; int OptionProxyClientNoDelay; int OptionProxyServerNoDelay; int OptionClientNoDelay; int OptionServerNoDelay; int OptionProxyReceiveBuffer; int OptionClientReceiveBuffer; int OptionServerReceiveBuffer; int OptionProxySendBuffer; int OptionClientSendBuffer; int OptionServerSendBuffer; int OptionProxyRetryAccept; int OptionProxyRetryConnect; int OptionServerRetryConnect; // // Calculate current bitrate on proxy link // using these observation periods. Value // is in milliseconds. // int ShortBitrateTimeFrame; int LongBitrateTimeFrame; // // Limit the bandwidth usage of the proxy // link. // int LocalBitrateLimit; int ClientBitrateLimit; int ServerBitrateLimit; // // This is the limit imposed by user on // total cache size. // int ClientTotalStorageSize; int ServerTotalStorageSize; int LocalTotalStorageSize; int RemoteTotalStorageSize; // // Discard messages in store older than // this amount of seconds. // int StoreTimeLimit; // // Any new message in store starts with // this amount of hits. // int StoreHitsAddBonus; // // Unless it is loaded from persistent // cache. // int StoreHitsLoadBonus; // // Stop increasing hits at this threshold. // int StoreHitsLimit; // // Give a special weight to messages put or // taken from cache during startup time. // int StoreHitsStartup; // // Weight of touch and untoch operations. // int StoreHitsTouch; int StoreHitsUntouch; // // Directives on size of messages to cache. // int MinimumMessageSize; int MaximumMessageSize; // // Maximum size of a single X request. // int MaximumRequestSize; // // Currently selected streaming mode. // int SplitMode; // // Send new split data any given amount of // milliseconds. // int SplitTimeout; // // Maximum number of distinct messages and // maximum size in bytes of the temporary // storage. // int SplitTotalSize; int SplitTotalStorageSize; // // Don't split messages smaller that this // threshold and send no more than the // given amount of bytes in a single data // shot when streaming the split messages. // int SplitDataThreshold; int SplitDataPacketLimit; // // Agent related parameters. These values apply // to the agent which, at startup, must query // the user's settings. // int PackMethod; int PackQuality; int HideRender; int TaintReplies; int TaintThreshold; // // Do we allow shared memory image support in // client and or server? // int ShmemClient; int ShmemServer; // // Default size of shared memory segments used // in MIT-SHM support. // int ShmemClientSize; int ShmemServerSize; // // The user's home directory. // char *HomePath; // // The ".nx" directory, usually in // the user's home. // char *RootPath; // // Usually the /usr/NX" directory. // char *SystemPath; // // Usually the "/tmp" directory. // char *TempPath; // // The complete path to the client. // char *ClientPath; // // String containing path of cache // file selected for load or save. // char *PersistentCachePath; // // Name of selected cache file. // char *PersistentCacheName; // // Minimum size of cache in memory // to proceed to its storage on disk. // int PersistentCacheThreshold; // // Is persistent cache enabled? // int PersistentCacheEnableLoad; int PersistentCacheEnableSave; // // This is used just for test because // it requires that client and server // reside on the same machine. // int PersistentCacheCheckOnShutdown; // // Load packed image and render extension // message stores. This currently depends // on the type of session. // int PersistentCacheLoadPacked; int PersistentCacheLoadRender; // // Maximum disk consumption of message // caches on disk. // int PersistentCacheDiskLimit; // // String containing the base path // of image cache files. // char *ImageCachePath; // // Is image cache enabled? // int ImageCacheEnableLoad; int ImageCacheEnableSave; // // Maximum disk consumption of image // caches on disk. // int ImageCacheDiskLimit; // // Only constructor, destructor // and a few utility functions. // Control(); ~Control(); // // Should not leverage control to find channel // stores' size limits. As most of values in // control, this info must be moved elsewhere. // int getUpperStorageSize() const { return (ClientTotalStorageSize > ServerTotalStorageSize ? ClientTotalStorageSize : ServerTotalStorageSize); } int getLowerStorageSize() const { return (ClientTotalStorageSize < ServerTotalStorageSize ? ClientTotalStorageSize : ServerTotalStorageSize); } void setProtoStep(int step); int getProtoStep(); private: // // Look in Control.cpp. // void setLocalUnpackMethods(); // // Manage the encoding according // to the protocol version. // int protoStep_; // // Min and max values allowed for protocol step // depending on protocol version compatibility // static const int NX_MIN_PROTO_STEP; static const int NX_MAX_PROTO_STEP; // // Check the validity of protocol step // bool isValidProtoStep(int step) { return ((step >= NX_MIN_PROTO_STEP) && (step <= NX_MAX_PROTO_STEP)); } }; #endif /* Control_H */ nx-libs-3.5.99.23/nxcomp/src/CopyArea.cpp0000644000000000000000000001610513614532331014614 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "CopyArea.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP int CopyAreaStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { CopyAreaMessage *copyArea = (CopyAreaMessage *) message; // // Here is the fingerprint. // copyArea -> src_drawable = GetULONG(buffer + 4, bigEndian); copyArea -> dst_drawable = GetULONG(buffer + 8, bigEndian); copyArea -> gcontext = GetULONG(buffer + 12, bigEndian); copyArea -> src_x = GetUINT(buffer + 16, bigEndian); copyArea -> src_y = GetUINT(buffer + 18, bigEndian); copyArea -> dst_x = GetUINT(buffer + 20, bigEndian); copyArea -> dst_y = GetUINT(buffer + 22, bigEndian); copyArea -> width = GetUINT(buffer + 24, bigEndian); copyArea -> height = GetUINT(buffer + 26, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int CopyAreaStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { CopyAreaMessage *copyArea = (CopyAreaMessage *) message; // // Fill all the message's fields. // PutULONG(copyArea -> src_drawable, buffer + 4, bigEndian); PutULONG(copyArea -> dst_drawable, buffer + 8, bigEndian); PutULONG(copyArea -> gcontext, buffer + 12, bigEndian); PutUINT(copyArea -> src_x, buffer + 16, bigEndian); PutUINT(copyArea -> src_y, buffer + 18, bigEndian); PutUINT(copyArea -> dst_x, buffer + 20, bigEndian); PutUINT(copyArea -> dst_y, buffer + 22, bigEndian); PutUINT(copyArea -> width, buffer + 24, bigEndian); PutUINT(copyArea -> height, buffer + 26, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void CopyAreaStore::dumpIdentity(const Message *message) const { #ifdef DUMP CopyAreaMessage *copyArea = (CopyAreaMessage *) message; *logofs << name() << ": Identity src_drawable " << copyArea -> src_drawable << ", dst_drawable " << copyArea -> dst_drawable << ", gcontext " << copyArea -> gcontext << ", src_x " << copyArea -> src_x << ", src_y " << copyArea -> src_y << ", dst_x " << copyArea -> dst_x << ", dst_y " << copyArea -> dst_y << ", width " << copyArea -> width << ", height " << copyArea -> height << ", size " << copyArea -> size_ << ".\n"; #endif } void CopyAreaStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { md5_append(md5_state_, buffer + 16, 12); } void CopyAreaStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { CopyAreaMessage *copyArea = (CopyAreaMessage *) message; CopyAreaMessage *cachedCopyArea = (CopyAreaMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << copyArea -> src_drawable << " as " << "src_drawable" << " field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(copyArea -> src_drawable, clientCache -> drawableCache); cachedCopyArea -> src_drawable = copyArea -> src_drawable; #ifdef TEST *logofs << name() << ": Encoding value " << copyArea -> dst_drawable << " as " << "dst_drawable" << " field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(copyArea -> dst_drawable, clientCache -> drawableCache); cachedCopyArea -> dst_drawable = copyArea -> dst_drawable; #ifdef TEST *logofs << name() << ": Encoding value " << copyArea -> gcontext << " as " << "gcontext" << " field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(copyArea -> gcontext, clientCache -> gcCache); cachedCopyArea -> gcontext = copyArea -> gcontext; } void CopyAreaStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { CopyAreaMessage *copyArea = (CopyAreaMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); copyArea -> src_drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << copyArea -> src_drawable << " as " << "src_drawable" << " field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); copyArea -> dst_drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << copyArea -> dst_drawable << " as " << "dst_drawable" << " field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> gcCache); copyArea -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << copyArea -> gcontext << " as gcontext field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/CopyArea.h0000644000000000000000000001246413614532331014265 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef CopyArea_H #define CopyArea_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define COPYAREA_ENABLE_CACHE 1 #define COPYAREA_ENABLE_DATA 0 #define COPYAREA_ENABLE_SPLIT 0 #define COPYAREA_ENABLE_COMPRESS 0 #define COPYAREA_DATA_LIMIT 0 #define COPYAREA_DATA_OFFSET 28 #define COPYAREA_CACHE_SLOTS 3000 #define COPYAREA_CACHE_THRESHOLD 5 #define COPYAREA_CACHE_LOWER_THRESHOLD 1 // // The message class. // class CopyAreaMessage : public Message { friend class CopyAreaStore; public: CopyAreaMessage() { } ~CopyAreaMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned int src_drawable; unsigned int dst_drawable; unsigned int gcontext; unsigned short src_x; unsigned short src_y; unsigned short dst_x; unsigned short dst_y; unsigned short width; unsigned short height; }; class CopyAreaStore : public MessageStore { // // Constructors and destructors. // public: CopyAreaStore() : MessageStore() { enableCache = COPYAREA_ENABLE_CACHE; enableData = COPYAREA_ENABLE_DATA; enableSplit = COPYAREA_ENABLE_SPLIT; enableCompress = COPYAREA_ENABLE_COMPRESS; dataLimit = COPYAREA_DATA_LIMIT; dataOffset = COPYAREA_DATA_OFFSET; cacheSlots = COPYAREA_CACHE_SLOTS; cacheThreshold = COPYAREA_CACHE_THRESHOLD; cacheLowerThreshold = COPYAREA_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~CopyAreaStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "CopyArea"; } virtual unsigned char opcode() const { return X_CopyArea; } virtual unsigned int storage() const { return sizeof(CopyAreaMessage); } // // Message handling methods. // public: virtual Message *create() const { return new CopyAreaMessage(); } virtual Message *create(const Message &message) const { return new CopyAreaMessage((const CopyAreaMessage &) message); } virtual void destroy(Message *message) const { delete (CopyAreaMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* CopyArea_H */ nx-libs-3.5.99.23/nxcomp/src/CreateGC.cpp0000644000000000000000000001443313614532331014530 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "CreateGC.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int CreateGCStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { CreateGCMessage *createGC = (CreateGCMessage *) message; // // Here is the fingerprint. // createGC -> gcontext = GetULONG(buffer + 4, bigEndian); createGC -> drawable = GetULONG(buffer + 8, bigEndian); createGC -> value_mask = GetULONG(buffer + 12, bigEndian); // // Clear the unused bytes carried in the // payload to increase the effectiveness // of the caching algorithm. // if ((int) size > dataOffset) { #ifdef DEBUG *logofs << name() << ": Removing unused bytes from the " << "data payload.\n" << logofs_flush; #endif createGC -> value_mask &= (1 << 23) - 1; unsigned int mask = 0x1; unsigned char *source = (unsigned char *) buffer + CREATEGC_DATA_OFFSET; unsigned long value = 0; for (unsigned int i = 0; i < 23; i++) { if (createGC -> value_mask & mask) { value = GetULONG(source, bigEndian); value &= (0xffffffff >> (32 - CREATEGC_FIELD_WIDTH[i])); PutULONG(value, source, bigEndian); source += 4; } mask <<= 1; } } #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int CreateGCStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { CreateGCMessage *createGC = (CreateGCMessage *) message; // // Fill all the message's fields. // PutULONG(createGC -> gcontext, buffer + 4, bigEndian); PutULONG(createGC -> drawable, buffer + 8, bigEndian); PutULONG(createGC -> value_mask, buffer + 12, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void CreateGCStore::dumpIdentity(const Message *message) const { #ifdef DUMP CreateGCMessage *createGC = (CreateGCMessage *) message; *logofs << name() << ": Identity gcontext " << createGC -> gcontext << ", drawable " << createGC -> drawable << ", value_mask " << createGC -> value_mask << ", size " << createGC -> size_ << ".\n" << logofs_flush; #endif } void CreateGCStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { // // This didn't include the drawable // in previous versions. // md5_append(md5_state_, buffer + 8, 8); } void CreateGCStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { CreateGCMessage *createGC = (CreateGCMessage *) message; CreateGCMessage *cachedCreateGC = (CreateGCMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; // Since ProtoStep7 (#issue 108) #ifdef TEST *logofs << name() << ": Encoding value " << createGC -> gcontext << " as gcontext field.\n" << logofs_flush; #endif encodeBuffer.encodeNewXidValue(createGC -> gcontext, clientCache -> lastId, clientCache -> lastIdCache, clientCache -> gcCache, clientCache -> freeGCCache); cachedCreateGC -> gcontext = createGC -> gcontext; } void CreateGCStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { CreateGCMessage *createGC = (CreateGCMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; // Since ProtoStep7 (#issue 108) decodeBuffer.decodeNewXidValue(value, clientCache -> lastId, clientCache -> lastIdCache, clientCache -> gcCache, clientCache -> freeGCCache); createGC -> gcontext = value; #ifdef TEST *logofs << name() << ": Decoded value " << createGC -> gcontext << " as gcontext field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/CreateGC.h0000644000000000000000000001223113614532331014167 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef CreateGC_H #define CreateGC_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define CREATEGC_ENABLE_CACHE 1 #define CREATEGC_ENABLE_DATA 0 #define CREATEGC_ENABLE_SPLIT 0 #define CREATEGC_ENABLE_COMPRESS 0 #define CREATEGC_DATA_LIMIT 144 #define CREATEGC_DATA_OFFSET 16 #define CREATEGC_CACHE_SLOTS 2000 #define CREATEGC_CACHE_THRESHOLD 2 #define CREATEGC_CACHE_LOWER_THRESHOLD 1 // // The message class. // class CreateGCMessage : public Message { friend class CreateGCStore; public: CreateGCMessage() { } ~CreateGCMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned int gcontext; unsigned int drawable; unsigned int value_mask; }; class CreateGCStore : public MessageStore { // // Constructors and destructors. // public: CreateGCStore() : MessageStore() { enableCache = CREATEGC_ENABLE_CACHE; enableData = CREATEGC_ENABLE_DATA; enableSplit = CREATEGC_ENABLE_SPLIT; enableCompress = CREATEGC_ENABLE_COMPRESS; dataLimit = CREATEGC_DATA_LIMIT; dataOffset = CREATEGC_DATA_OFFSET; cacheSlots = CREATEGC_CACHE_SLOTS; cacheThreshold = CREATEGC_CACHE_THRESHOLD; cacheLowerThreshold = CREATEGC_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~CreateGCStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "CreateGC"; } virtual unsigned char opcode() const { return X_CreateGC; } virtual unsigned int storage() const { return sizeof(CreateGCMessage); } // // Message handling methods. // public: virtual Message *create() const { return new CreateGCMessage(); } virtual Message *create(const Message &message) const { return new CreateGCMessage((const CreateGCMessage &) message); } virtual void destroy(Message *message) const { delete (CreateGCMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* CreateGC_H */ nx-libs-3.5.99.23/nxcomp/src/CreatePixmap.cpp0000644000000000000000000002224013614532331015470 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "CreatePixmap.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "WriteBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Constructors and destructors. // CreatePixmapStore::CreatePixmapStore() : MessageStore() { enableCache = CREATEPIXMAP_ENABLE_CACHE; enableData = CREATEPIXMAP_ENABLE_DATA; enableSplit = CREATEPIXMAP_ENABLE_SPLIT; enableCompress = CREATEPIXMAP_ENABLE_COMPRESS; dataLimit = CREATEPIXMAP_DATA_LIMIT; dataOffset = CREATEPIXMAP_DATA_OFFSET; cacheSlots = CREATEPIXMAP_CACHE_SLOTS; cacheThreshold = CREATEPIXMAP_CACHE_THRESHOLD; cacheLowerThreshold = CREATEPIXMAP_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } CreatePixmapStore::~CreatePixmapStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } // // Here are the methods to handle messages' content. // int CreatePixmapStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue(*(buffer + 1), 8, clientCache -> depthCache); encodeBuffer.encodeNewXidValue(GetULONG(buffer + 4, bigEndian), clientCache -> lastId, clientCache -> lastIdCache, clientCache -> drawableCache, clientCache -> freeDrawableCache); encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), clientCache -> windowCache); encodeBuffer.encodeCachedValue(GetUINT(buffer + 12, bigEndian), 16, clientCache -> createPixmapXCache, 8); encodeBuffer.encodeCachedValue(GetUINT(buffer + 14, bigEndian), 16, clientCache -> createPixmapYCache, 8); #ifdef TEST *logofs << name() << ": Encoded message. Size is " << size << ".\n" << logofs_flush; #endif return 1; } int CreatePixmapStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; unsigned char cValue; unsigned int value; size = 16; buffer = writeBuffer -> addMessage(size); decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> depthCache); *(buffer + 1) = cValue; decodeBuffer.decodeNewXidValue(value, clientCache -> lastId, clientCache -> lastIdCache, clientCache -> drawableCache, clientCache -> freeDrawableCache); PutULONG(value, buffer + 4, bigEndian); decodeBuffer.decodeXidValue(value, clientCache -> windowCache); PutULONG(value, buffer + 8, bigEndian); decodeBuffer.decodeCachedValue(value, 16, clientCache -> createPixmapXCache, 8); PutUINT(value, buffer + 12, bigEndian); decodeBuffer.decodeCachedValue(value, 16, clientCache -> createPixmapYCache, 8); PutUINT(value, buffer + 14, bigEndian); #ifdef TEST *logofs << name() << ": Decoded message. Size is " << size << ".\n" << logofs_flush; #endif return 1; } int CreatePixmapStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { CreatePixmapMessage *createPixmap = (CreatePixmapMessage *) message; createPixmap -> depth = *(buffer + 1); createPixmap -> id = GetULONG(buffer + 4, bigEndian); createPixmap -> drawable = GetULONG(buffer + 8, bigEndian); createPixmap -> width = GetUINT(buffer + 12, bigEndian); createPixmap -> height = GetUINT(buffer + 14, bigEndian); #ifdef TEST *logofs << name() << ": Parsed identity. Size is " << createPixmap -> size_ << " identity is " << createPixmap -> i_size_ << ".\n" << logofs_flush; #endif return 1; } int CreatePixmapStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { CreatePixmapMessage *createPixmap = (CreatePixmapMessage *) message; *(buffer + 1) = createPixmap -> depth; PutULONG(createPixmap -> id, buffer + 4, bigEndian); PutULONG(createPixmap -> drawable, buffer + 8, bigEndian); PutUINT(createPixmap -> width, buffer + 12, bigEndian); PutUINT(createPixmap -> height, buffer + 14, bigEndian); #ifdef TEST *logofs << name() << ": Unparsed identity. Size is " << createPixmap -> size_ << " identity is " << createPixmap -> i_size_ << ".\n" << logofs_flush; #endif return 1; } void CreatePixmapStore::dumpIdentity(const Message *message) const { #ifdef DUMP #ifdef WARNING *logofs << name() << ": WARNING! Dump of identity not implemented.\n" << logofs_flush; #endif #endif } void CreatePixmapStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { md5_append(md5_state_, buffer + 1, 1); md5_append(md5_state_, buffer + 8, 8); } void CreatePixmapStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { CreatePixmapMessage *createPixmap = (CreatePixmapMessage *) message; CreatePixmapMessage *cachedCreatePixmap = (CreatePixmapMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeNewXidValue(createPixmap -> id, clientCache -> lastId, clientCache -> lastIdCache, clientCache -> drawableCache, clientCache -> freeDrawableCache); cachedCreatePixmap -> id = createPixmap -> id; #ifdef TEST *logofs << name() << ": Encoded update. Size is " << createPixmap -> size_ << " identity is " << createPixmap -> i_size_ << ".\n" << logofs_flush; #endif } void CreatePixmapStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { CreatePixmapMessage *createPixmap = (CreatePixmapMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeNewXidValue(createPixmap -> id, clientCache -> lastId, clientCache -> lastIdCache, clientCache -> drawableCache, clientCache -> freeDrawableCache); #ifdef TEST *logofs << name() << ": Decoded update. Size is " << createPixmap -> size_ << " identity is " << createPixmap -> i_size_ << ".\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/CreatePixmap.h0000644000000000000000000001171213614532331015137 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef CreatePixmap_H #define CreatePixmap_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define CREATEPIXMAP_ENABLE_CACHE 1 #define CREATEPIXMAP_ENABLE_DATA 0 #define CREATEPIXMAP_ENABLE_SPLIT 0 #define CREATEPIXMAP_ENABLE_COMPRESS 0 #define CREATEPIXMAP_DATA_LIMIT 16 #define CREATEPIXMAP_DATA_OFFSET 16 #define CREATEPIXMAP_CACHE_SLOTS 1000 #define CREATEPIXMAP_CACHE_THRESHOLD 2 #define CREATEPIXMAP_CACHE_LOWER_THRESHOLD 1 // // The message class. // class CreatePixmapMessage : public Message { friend class CreatePixmapStore; public: CreatePixmapMessage() { } ~CreatePixmapMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char depth; unsigned int id; unsigned int drawable; unsigned short width; unsigned short height; }; class CreatePixmapStore : public MessageStore { public: CreatePixmapStore(); virtual ~CreatePixmapStore(); virtual const char *name() const { return "CreatePixmap"; } virtual unsigned char opcode() const { return X_CreatePixmap; } virtual unsigned int storage() const { return sizeof(CreatePixmapMessage); } // // Message handling methods. // protected: virtual Message *create() const { return new CreatePixmapMessage(); } virtual Message *create(const Message &message) const { return new CreatePixmapMessage((const CreatePixmapMessage &) message); } virtual void destroy(Message *message) const { delete (CreatePixmapMessage *) message; } virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const; virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* CreatePixmap_H */ nx-libs-3.5.99.23/nxcomp/src/DecodeBuffer.cpp0000644000000000000000000004002213614532331015421 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Misc.h" #include "Control.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP DecodeBuffer::DecodeBuffer(const unsigned char *data, unsigned int length) : buffer_(data), end_(buffer_ + length), nextSrc_(buffer_), srcMask_(0x80) { // Since ProtoStep7 (#issue 108) end_ = buffer_ + length - DECODE_BUFFER_POSTFIX_SIZE; } int DecodeBuffer::decodeValue(unsigned int &value, unsigned int numBits, unsigned int blockSize, int endOkay) { #ifdef DUMP *logofs << "DecodeBuffer: Decoding " << numBits << " bits value with block " << blockSize << " and " << (nextSrc_ - buffer_) << " bytes in buffer.\n" << logofs_flush; #endif unsigned int result = 0; unsigned int destMask = 0x1; unsigned int bitsRead = 0; if (blockSize == 0) blockSize = numBits; unsigned char nextSrcChar = *nextSrc_; unsigned int numBlocks = 1; do { if (numBlocks == 4) { blockSize = numBits; } unsigned int bitsToRead = (blockSize > numBits - bitsRead ? numBits - bitsRead : blockSize); unsigned int count = 0; unsigned char lastBit; do { if (nextSrc_ >= end_) { if (!endOkay) { #ifdef PANIC *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [A] " << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) << " end_ = " << (end_ - buffer_) << ".\n" << logofs_flush; #endif // // Label "context" is just used to identify // the routine which detected the problem in // present source file. // cerr << "Error" << ": Failure decoding data in context [A].\n"; HandleAbort(); } #ifdef PANIC *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [B] " << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) << " end_ = " << (end_ - buffer_) << ".\n" << logofs_flush; #endif cerr << "Error" << ": Failure decoding data in context [B].\n"; HandleAbort(); } lastBit = (nextSrcChar & srcMask_); if (lastBit) result |= destMask; srcMask_ >>= 1; if (srcMask_ == 0) { srcMask_ = 0x80; nextSrc_++; nextSrcChar = *nextSrc_; } destMask <<= 1; } while (bitsToRead > ++count); bitsRead += bitsToRead; if (bitsRead < numBits) { if (nextSrc_ >= end_) { if (!endOkay) { #ifdef PANIC *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [C] " << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) << " end_ = " << (end_ - buffer_) << ".\n" << logofs_flush; #endif cerr << "Error" << ": Failure decoding data in context [C].\n"; HandleAbort(); } #ifdef PANIC *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [D] " << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) << " end_ = " << (end_ - buffer_) << ".\n" << logofs_flush; #endif cerr << "Error" << ": Failure decoding data in context [D].\n"; HandleAbort(); } unsigned char moreData = (nextSrcChar & srcMask_); srcMask_ >>= 1; if (srcMask_ == 0) { srcMask_ = 0x80; nextSrc_++; nextSrcChar = *nextSrc_; } if (!moreData) { if (lastBit) { do { result |= destMask; destMask <<= 1; } while (numBits > ++bitsRead); } else bitsRead = numBits; } } blockSize >>= 1; if (blockSize < 2) blockSize = 2; numBlocks++; } while (numBits > bitsRead); value = result; return 1; } int DecodeBuffer::decodeCachedValue(unsigned int &value, unsigned int numBits, IntCache &cache, unsigned int blockSize, int endOkay) { #ifdef DUMP *logofs << "DecodeBuffer: Decoding " << numBits << " bits cached value with block " << blockSize << " and " << (nextSrc_ - buffer_) << " bytes in buffer.\n" << logofs_flush; #endif if (nextSrc_ >= end_) { #ifdef PANIC *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [E] " << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) << " end_ = " << (end_ - buffer_) << ".\n" << logofs_flush; #endif cerr << "Error" << ": Failure decoding data in context [E].\n"; HandleAbort(); } unsigned int index = 0; unsigned char nextSrcChar = *nextSrc_; while (!(nextSrcChar & srcMask_)) { index++; srcMask_ >>= 1; if (srcMask_ == 0) { srcMask_ = 0x80; nextSrc_++; if (nextSrc_ >= end_) { if (!endOkay) { #ifdef PANIC *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [F] " << "in decodeCachedValue() nextSrc_ = " << (nextSrc_ - buffer_) << " end_ = " << (end_ - buffer_) << ".\n" << logofs_flush; #endif cerr << "Error" << ": Failure decoding data in context [F].\n"; HandleAbort(); } #ifdef PANIC *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [G] " << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) << " end_ = " << (end_ - buffer_) << ".\n" << logofs_flush; #endif cerr << "Error" << ": Failure decoding data in context [G].\n"; HandleAbort(); } nextSrcChar = *nextSrc_; } } srcMask_ >>= 1; if (srcMask_ == 0) { srcMask_ = 0x80; nextSrc_++; } if (index == 2) { // Since ProtoStep8 (#issue 108) blockSize = cache.getBlockSize(blockSize); if (decodeValue(value, numBits, blockSize, endOkay)) { cache.insert(value, IntMask[numBits]); return 1; } #ifdef PANIC *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [H] " << "in decodeCacheValue() with no value found.\n" << logofs_flush; #endif cerr << "Error" << ": Failure decoding data in context [H].\n"; HandleAbort(); } else { if (index > 2) { index--; } if (index > cache.getSize()) { #ifdef PANIC *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [I] " << "in decodeCachedValue() index = " << index << " cache size = " << cache.getSize() << ".\n" << logofs_flush; #endif cerr << "Error" << ": Failure decoding data in context [I].\n"; HandleAbort(); } value = cache.get(index); return 1; } } int DecodeBuffer::decodeCachedValue(unsigned char &value, unsigned int numBits, CharCache &cache, unsigned int blockSize, int endOkay) { #ifdef DUMP *logofs << "DecodeBuffer: Decoding " << numBits << " bits char cached value with block " << blockSize << " and " << nextSrc_ - buffer_ << " bytes read out of " << end_ - buffer_ << ".\n" << logofs_flush; #endif if (nextSrc_ >= end_) { #ifdef TEST *logofs << "DecodeBuffer: End of buffer reached in context [J] with " << nextSrc_ - buffer_ << " bytes read out of " << end_ - buffer_ << ".\n" << logofs_flush; #endif return 0; } unsigned int index = 0; unsigned char nextSrcChar = *nextSrc_; while (!(nextSrcChar & srcMask_)) { index++; srcMask_ >>= 1; if (srcMask_ == 0) { srcMask_ = 0x80; nextSrc_++; if (nextSrc_ >= end_) { if (!endOkay) { #ifdef PANIC *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [K] " << "in decodeCachedValue() nextSrc_ " << (nextSrc_ - buffer_) << " end_ " << (end_ - buffer_) << ".\n" << logofs_flush; #endif cerr << "Error" << ": Failure decoding data in context [K].\n"; HandleAbort(); } #ifdef TEST *logofs << "DecodeBuffer: End of buffer reached in context [L] with " << nextSrc_ - buffer_ << " bytes read out of " << end_ - buffer_ << ".\n" << logofs_flush; #endif return 0; } nextSrcChar = *nextSrc_; } } srcMask_ >>= 1; if (srcMask_ == 0) { srcMask_ = 0x80; nextSrc_++; } if (index == 2) { unsigned int temp; if (decodeValue(temp, numBits, blockSize, endOkay)) { value = (unsigned char) temp; cache.insert(value); } else { #ifdef PANIC *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [M] " << "in decodeValue() with index = 2.\n" << logofs_flush; #endif cerr << "Error" << ": Failure decoding data in context [M].\n"; HandleAbort(); } } else { if (index > 2) { index--; } if (index > cache.getSize()) { #ifdef PANIC *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [N] " << "in decodeCachedValue() " << "index = " << index << " cache size = " << cache.getSize() << ".\n" << logofs_flush; #endif cerr << "Error" << ": Failure decoding data in context [N].\n"; HandleAbort(); } value = cache.get(index); } return 1; } // // Simply returns a pointer to the correct spot in // the internal buffer. If the caller needs this // data to last beyond the lifetime of the internal // buffer, it must copy the data in its own memory. // const unsigned char *DecodeBuffer::decodeMemory(unsigned int numBytes) { #ifdef DUMP *logofs << "DecodeBuffer: Decoding " << numBytes << " bytes of memory with " << (nextSrc_ - buffer_) << " bytes in buffer.\n" << logofs_flush; #endif const unsigned char *result; // // Force ourselves to a byte boundary. // Is up to application to ensure data // is word aligned when needed. // if (srcMask_ != 0x80) { srcMask_ = 0x80; nextSrc_++; } result = nextSrc_; if (numBytes > DECODE_BUFFER_OVERFLOW_SIZE) { #ifdef PANIC *logofs << "DecodeBuffer: PANIC! Can't decode a buffer of " << numBytes << " bytes with limit set to " << DECODE_BUFFER_OVERFLOW_SIZE << ".\n" << logofs_flush; *logofs << "DecodeBuffer: PANIC! Assuming failure decoding " << "data in context [O].\n" << logofs_flush; #endif cerr << "Error" << ": Should never decode buffer of size " << "greater than " << DECODE_BUFFER_OVERFLOW_SIZE << " bytes.\n"; cerr << "Error" << ": Assuming failure decoding data in " << "context [O].\n"; HandleAbort(); } else if (end_ - nextSrc_ < (int) numBytes) { #ifdef PANIC *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [P] " << "in decodeMemory() " << "with length " << numBytes << " and " << (end_ - nextSrc_) << " bytes remaining.\n" << logofs_flush; #endif cerr << "Error" << ": Failure decoding data in context [P].\n"; HandleAbort(); } nextSrc_ += numBytes; return result; } void DecodeBuffer::decodeActionValue(unsigned char &value, unsigned short &position, ActionCache &cache) { unsigned int t; decodeCachedValue(t, 15, *(cache.base_[cache.slot_])); cache.last_ += t; cache.last_ &= 0x7fff; value = cache.last_ >> 13; position = cache.last_ & 0x1fff; #ifdef DEBUG *logofs << "DecodeBuffer: Decoded value " << (unsigned) value << " and position " << position << " with base " << cache.slot_ << ".\n" << logofs_flush; #endif #ifdef DEBUG *logofs << "DecodeBuffer: Action block prediction is " << (*(cache.base_[cache.slot_])).getBlockSize(15) << ".\n" << logofs_flush; #endif cache.slot_ = (cache.last_ & 0xff); } void DecodeBuffer::decodeNewXidValue(unsigned int &value, unsigned int &lastId, IntCache &lastIdCache, IntCache &cache, FreeCache &freeCache) { decodeCachedValue(value, 29, lastIdCache); lastId += (value + 1); lastId &= 0x1fffffff; value = lastId; cache.push(value, 0x1fffffff); freeCache.push(value, 0x1fffffff); } void DecodeBuffer::decodeNewXidValue(unsigned int &value, unsigned int &lastId, IntCache &lastIdCache, XidCache &cache, FreeCache &freeCache) { decodeCachedValue(value, 29, lastIdCache); #ifdef DEBUG *logofs << "DecodeBuffer: Decoded new Xid difference " << value << ".\n" << logofs_flush; #endif lastId += (value + 1); lastId &= 0x1fffffff; value = lastId; unsigned int t = (value - cache.last_); cache.last_ = value; #ifdef DEBUG *logofs << "DecodeBuffer: Decoded new Xid " << value << " with base " << cache.slot_ << ".\n" << logofs_flush; #endif cache.slot_ = (value & 0xff); cache.base_[cache.slot_] -> push(t, 0x1fffffff); freeCache.push(value, 0x1fffffff); } void DecodeBuffer::decodeXidValue(unsigned int &value, XidCache &cache) { unsigned int t; decodeCachedValue(t, 29, *(cache.base_[cache.slot_])); cache.last_ += t; cache.last_ &= 0x1fffffff; value = cache.last_; #ifdef DEBUG *logofs << "DecodeBuffer: Decoded Xid " << value << " with base " << cache.slot_ << ".\n" << logofs_flush; #endif cache.slot_ = (value & 0xff); #ifdef DEBUG *logofs << "DecodeBuffer: Xid block prediction is " << (*(cache.base_[cache.slot_])).getBlockSize(29) << ".\n" << logofs_flush; #endif } void DecodeBuffer::decodeFreeXidValue(unsigned int &value, FreeCache &cache) { decodeCachedValue(value, 29, cache); } nx-libs-3.5.99.23/nxcomp/src/DecodeBuffer.h0000644000000000000000000001135313614532331015073 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef DecodeBuffer_H #define DecodeBuffer_H #include #include "IntCache.h" #include "CharCache.h" #include "XidCache.h" #include "FreeCache.h" #include "OpcodeCache.h" #include "ActionCache.h" #define DECODE_BUFFER_OVERFLOW_SIZE 4194304 #define DECODE_BUFFER_POSTFIX_SIZE 1 class DecodeBuffer { public: DecodeBuffer(const unsigned char *data, unsigned int length); ~DecodeBuffer() { } int decodeValue(unsigned int &value, unsigned int numBits, unsigned int blockSize = 0, int endOkay = 0); int decodeCachedValue(unsigned int &value, unsigned int numBits, IntCache &cache, unsigned int blockSize = 0, int endOkay = 0); int decodeCachedValue(unsigned char &value, unsigned int numBits, CharCache &cache, unsigned int blockSize = 0, int endOkay = 0); void decodeDiffCachedValue(unsigned int &value, unsigned int &previous, unsigned int numBits, IntCache &cache, unsigned int blockSize = 0) { decodeCachedValue(value, numBits, cache, blockSize); previous += (value + 1); previous &= (0xffffffff >> (32 - numBits)); value = previous; } void decodeBoolValue(unsigned int &value) { decodeValue(value, 1); } int decodeOpcodeValue(unsigned char &value, OpcodeCache &cache, int endOkay = 0) { int result = decodeCachedValue(value, 8, cache.base_[cache.slot_], 8, endOkay); if (result == 1) { cache.slot_ = value; } return result; } void decodeActionValue(unsigned char &value, unsigned short &position, ActionCache &cache); void decodeNewXidValue(unsigned int &value, unsigned int &lastId, IntCache &lastIdCache, IntCache &cache, FreeCache &freeCache); void decodeNewXidValue(unsigned int &value, unsigned int &lastId, IntCache &lastIdCache, XidCache &cache, FreeCache &freeCache); void decodeXidValue(unsigned int &value, XidCache &cache); void decodeFreeXidValue(unsigned int &value, FreeCache &cache); void decodeTextData(unsigned char *buffer, unsigned int numBytes) { decodeMemory(buffer, numBytes); } void decodeIntData(unsigned char *buffer, unsigned int numBytes) { decodeMemory(buffer, numBytes); } void decodeLongData(unsigned char *buffer, unsigned int numBytes) { decodeMemory(buffer, numBytes); } const unsigned char *decodeMemory(unsigned int numBytes); void decodeMemory(unsigned char *buffer, unsigned int numBytes) { memcpy(buffer, decodeMemory(numBytes), numBytes); } private: const unsigned char *buffer_; const unsigned char *end_; const unsigned char *nextSrc_; unsigned char srcMask_; }; #endif /* DecodeBuffer_H */ nx-libs-3.5.99.23/nxcomp/src/EncodeBuffer.cpp0000644000000000000000000003504513614532331015444 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Misc.h" #include "Control.h" #include "EncodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP #define ADVANCE_DEST \ \ if (destShift_ == 0) \ { \ destShift_ = 7; nextDest_++; *nextDest_ = 0; \ } \ else \ { \ destShift_--; \ } EncodeBuffer::EncodeBuffer() { size_ = ENCODE_BUFFER_DEFAULT_SIZE; buffer_ = new unsigned char[size_ + ENCODE_BUFFER_PREFIX_SIZE + ENCODE_BUFFER_POSTFIX_SIZE] + ENCODE_BUFFER_PREFIX_SIZE; end_ = buffer_ + size_; nextDest_ = buffer_; *nextDest_ = 0; destShift_ = 7; lastBits_ = 0; initialSize_ = ENCODE_BUFFER_DEFAULT_SIZE; thresholdSize_ = ENCODE_BUFFER_DEFAULT_SIZE << 1; maximumSize_ = ENCODE_BUFFER_DEFAULT_SIZE << 4; #ifdef VALGRIND memset(buffer_, '\0', size_); #endif } EncodeBuffer::~EncodeBuffer() { delete [] (buffer_ - ENCODE_BUFFER_PREFIX_SIZE); } void EncodeBuffer::setSize(unsigned int initialSize, unsigned int thresholdSize, unsigned int maximumSize) { initialSize_ = initialSize; thresholdSize_ = thresholdSize; maximumSize_ = maximumSize; #ifdef TEST *logofs << "EncodeBuffer: Set buffer sizes to " << initialSize_ << "/" << thresholdSize_ << "/" << maximumSize_ << ".\n" << logofs_flush; #endif } void EncodeBuffer::fullReset() { if (size_ > initialSize_) { delete [] (buffer_ - ENCODE_BUFFER_PREFIX_SIZE); size_ = initialSize_; buffer_ = new unsigned char[size_ + ENCODE_BUFFER_PREFIX_SIZE + ENCODE_BUFFER_POSTFIX_SIZE]; #ifdef VALGRIND memset(buffer_, '\0', size_ + ENCODE_BUFFER_PREFIX_SIZE + ENCODE_BUFFER_POSTFIX_SIZE); #endif buffer_ += ENCODE_BUFFER_PREFIX_SIZE; } end_ = buffer_ + size_; nextDest_ = buffer_; *nextDest_ = 0; destShift_ = 7; lastBits_ = 0; } void EncodeBuffer::encodeValue(unsigned int value, unsigned int numBits, unsigned int blockSize) { #ifdef DUMP *logofs << "EncodeBuffer: Encoding " << numBits << " bits value with block " << blockSize << " and " << (nextDest_ - buffer_) << " bytes in buffer.\n" << logofs_flush; #endif value &= IntMask[numBits]; unsigned int srcMask = 0x1; unsigned int bitsWritten = 0; if (blockSize == 0) blockSize = numBits; if (end_ - nextDest_ < 8) { growBuffer(); } unsigned int numBlocks = 1; do { if (numBlocks == 4) blockSize = numBits; unsigned int bitsToWrite = (blockSize > numBits - bitsWritten ? numBits - bitsWritten : blockSize); unsigned int count = 0; unsigned int lastBit; do { lastBit = (value & srcMask); if (lastBit) *nextDest_ |= (1 << destShift_); ADVANCE_DEST; srcMask <<= 1; } while (bitsToWrite > ++count); bitsWritten += bitsToWrite; if (bitsWritten < numBits) { unsigned int tmpMask = srcMask; unsigned int i = bitsWritten; if (lastBit) { do { unsigned int nextBit = (value & tmpMask); if (!nextBit) break; tmpMask <<= 1; } while (numBits > ++i); } else { do { unsigned int nextBit = (value & tmpMask); if (nextBit) break; tmpMask <<= 1; } while (numBits > ++i); } if (i < numBits) *nextDest_ |= (1 << destShift_); else bitsWritten = numBits; ADVANCE_DEST; } blockSize >>= 1; if (blockSize < 2) blockSize = 2; numBlocks++; } while (numBits > bitsWritten); } void EncodeBuffer::encodeCachedValue(unsigned int value, unsigned int numBits, IntCache &cache, unsigned int blockSize) { #ifdef DUMP *logofs << "EncodeBuffer: Encoding " << numBits << " bits cached value with block " << blockSize << " and " << (nextDest_ - buffer_) << " bytes in buffer.\n" << logofs_flush; #endif value &= IntMask[numBits]; if (end_ - nextDest_ < 8) { growBuffer(); } blockSize = cache.getBlockSize(blockSize); unsigned int index; unsigned int sameDiff; #ifdef DUMP diffBits(); #endif if (cache.lookup(value, index, IntMask[numBits], sameDiff)) { if (index > 1) index++; while (destShift_ < index) { index -= destShift_; index--; destShift_ = 7; nextDest_++; *nextDest_ = 0; } destShift_ -= index; *nextDest_ |= (1 << destShift_); ADVANCE_DEST; #ifdef DUMP *logofs << "EncodeBuffer: Encoded cached int using " << diffBits() << " bits out of " << numBits << ".\n" << logofs_flush; #endif } else { ADVANCE_DEST; ADVANCE_DEST; *nextDest_ |= (1 << destShift_); ADVANCE_DEST; // // The attempt is very seldom successful. // Avoid to encode the additional bool. // // Since ProtoStep8 (#issue 108) #ifdef DUMP *logofs << "EncodeBuffer: Encoded missed int using " << diffBits() << " bits out of " << numBits << ".\n" << logofs_flush; #endif encodeValue(value, numBits, blockSize); } } void EncodeBuffer::encodeCachedValue(unsigned char value, unsigned int numBits, CharCache &cache, unsigned int blockSize) { #ifdef DUMP *logofs << "EncodeBuffer: Encoding " << numBits << " bits char cached value with block " << blockSize << " and " << (nextDest_ - buffer_) << " bytes in buffer.\n" << logofs_flush; #endif value &= IntMask[numBits]; if (end_ - nextDest_ < 8) { growBuffer(); } unsigned int index; #ifdef DUMP diffBits(); #endif if (cache.lookup(value, index)) { if (index > 1) index++; while (destShift_ < index) { index -= destShift_; index--; destShift_ = 7; nextDest_++; *nextDest_ = 0; } destShift_ -= index; *nextDest_ |= (1 << destShift_); ADVANCE_DEST; #ifdef DUMP *logofs << "EncodeBuffer: Encoded cached char using " << diffBits() << " bits out of " << numBits << ".\n" << logofs_flush; #endif } else { ADVANCE_DEST; ADVANCE_DEST; *nextDest_ |= (1 << destShift_); ADVANCE_DEST; encodeValue(value, numBits, blockSize); #ifdef DUMP *logofs << "EncodeBuffer: Encoded missed char using " << diffBits() << " bits out of " << numBits << ".\n" << logofs_flush; #endif } } void EncodeBuffer::encodeMemory(const unsigned char *buffer, unsigned int numBytes) { #ifdef DUMP *logofs << "EncodeBuffer: Encoding " << numBytes << " bytes of memory with " << (nextDest_ - buffer_) << " bytes in buffer.\n" << logofs_flush; #endif if (numBytes > ENCODE_BUFFER_OVERFLOW_SIZE) { #ifdef PANIC *logofs << "EncodeBuffer: PANIC! Should never encode buffer " << "of size greater than " << ENCODE_BUFFER_OVERFLOW_SIZE << " bytes.\n" << logofs_flush; *logofs << "EncodeBuffer: PANIC! Assuming failure encoding data " << "in context [A].\n" << logofs_flush; #endif // // Label "context" is just used to identify // the routine which detected the problem in // present source file. // cerr << "Error" << ": Should never encode buffer of size " << "greater than " << ENCODE_BUFFER_OVERFLOW_SIZE << " bytes.\n"; cerr << "Error" << ": Assuming failure encoding data " << "in context [A].\n" ; HandleAbort(); } alignBuffer(); if (end_ - nextDest_ < (int) numBytes) { growBuffer(numBytes); } memcpy(nextDest_, buffer, numBytes); nextDest_ += numBytes; if (nextDest_ == end_) { growBuffer(); } else if (nextDest_ > end_) { #ifdef PANIC *logofs << "EncodeBuffer: PANIC! Assertion failed. Error [B] " << "in encodeMemory() nextDest_ " << (nextDest_ - buffer) << " end_ " << (end_ - buffer) << ".\n" << logofs_flush; #endif // // Label "context" is just used to identify // the routine which detected the problem in // present source file. // cerr << "Error" << ": Failure encoding raw data " << "in context [B].\n" ; HandleAbort(); } *nextDest_ = 0; } unsigned int EncodeBuffer::getLength() const { unsigned int length = nextDest_ - buffer_; if (destShift_ != 7) { length++; } // Since ProtoStep7 (#issue 108) if (length > 0) { return length + ENCODE_BUFFER_POSTFIX_SIZE; } return length; } unsigned int EncodeBuffer::diffBits() { unsigned int bits = ((nextDest_ - buffer_) << 3); bits += (7 - destShift_); unsigned int diff = bits - lastBits_; lastBits_ = bits; return diff; } void EncodeBuffer::growBuffer(unsigned int numBytes) { if (numBytes == 0) { numBytes = initialSize_; } unsigned int bytesInBuffer = nextDest_ - buffer_; unsigned int newSize = thresholdSize_; while (newSize < bytesInBuffer + numBytes) { newSize <<= 1; if (newSize > maximumSize_) { newSize = bytesInBuffer + numBytes + initialSize_; } } unsigned char *newBuffer; newBuffer = new unsigned char[newSize + ENCODE_BUFFER_PREFIX_SIZE + ENCODE_BUFFER_POSTFIX_SIZE] + ENCODE_BUFFER_PREFIX_SIZE; if (newBuffer == NULL) { #ifdef PANIC *logofs << "EncodeBuffer: PANIC! Error in context [C] " << "growing buffer to accommodate " << numBytes << " bytes .\n" << logofs_flush; #endif cerr << "Error" << ": Error in context [C] " << "growing encode buffer to accommodate " << numBytes << " bytes.\n"; HandleAbort(); } #ifdef TEST if (newSize >= maximumSize_) { *logofs << "EncodeBuffer: WARNING! Buffer grown to reach " << "size of " << newSize << " bytes.\n" << logofs_flush; } #endif // // Prefix should not contain any valid data. // It is proxy that will fill it with control // messages and data length at the time a new // frame is written to socket. // memcpy(newBuffer, buffer_, bytesInBuffer + 1); newBuffer[bytesInBuffer + 1] = 0; delete [] (buffer_ - ENCODE_BUFFER_PREFIX_SIZE); buffer_ = newBuffer; size_ = newSize; end_ = buffer_ + size_; nextDest_ = buffer_ + bytesInBuffer; } void EncodeBuffer::alignBuffer() { if (destShift_ != 7) { destShift_ = 7; nextDest_++; if (nextDest_ >= end_) { growBuffer(); } *nextDest_ = 0; } } void EncodeBuffer::encodeActionValue(unsigned char value, unsigned short position, ActionCache &cache) { unsigned int v = (value << 13) | position; unsigned int t = (v - cache.last_); encodeCachedValue(t, 15, *(cache.base_[cache.slot_])); cache.last_ = v; #ifdef DEBUG *logofs << "EncodeBuffer: Encoded value " << (unsigned) value << " and position " << position << " with base " << cache.slot_ << ".\n" << logofs_flush; #endif cache.slot_ = (cache.last_ & 0xff); } void EncodeBuffer::encodeNewXidValue(unsigned int value, unsigned int &lastId, IntCache &lastIdCache, IntCache &cache, FreeCache &freeCache) { encodeCachedValue((value - 1) - lastId, 29, lastIdCache); lastId = value; cache.push(value, 0x1fffffff); freeCache.push(value, 0x1fffffff); } void EncodeBuffer::encodeNewXidValue(unsigned int value, unsigned int &lastId, IntCache &lastIdCache, XidCache &cache, FreeCache &freeCache) { encodeCachedValue((value - 1) - lastId, 29, lastIdCache); lastId = value; unsigned int t = (value - cache.last_); cache.last_ = value; #ifdef DEBUG *logofs << "EncodeBuffer: Encoded new Xid " << value << " with base " << cache.slot_ << ".\n" << logofs_flush; #endif cache.slot_ = (value & 0xff); cache.base_[cache.slot_] -> push(t, 0x1fffffff); freeCache.push(value, IntMask[29]); } void EncodeBuffer::encodeXidValue(unsigned int value, XidCache &cache) { unsigned int t = (value - cache.last_); encodeCachedValue(t, 29, *(cache.base_[cache.slot_])); cache.last_ = value; #ifdef DEBUG *logofs << "EncodeBuffer: Encoded Xid " << value << " with base " << cache.slot_ << ".\n" << logofs_flush; #endif cache.slot_ = (value & 0xff); } void EncodeBuffer::encodeFreeXidValue(unsigned int value, FreeCache &cache) { encodeCachedValue(value, 29, cache); } nx-libs-3.5.99.23/nxcomp/src/EncodeBuffer.h0000644000000000000000000001304713614532331015107 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef EncodeBuffer_H #define EncodeBuffer_H #include "IntCache.h" #include "CharCache.h" #include "XidCache.h" #include "FreeCache.h" #include "OpcodeCache.h" #include "ActionCache.h" #define ENCODE_BUFFER_DEFAULT_SIZE 16384 // // This should match the maximum size of // a single message added to write buffer // (see WriteBuffer.h). // #define ENCODE_BUFFER_OVERFLOW_SIZE 4194304 // // Adjust for the control messages and the // frame length added by the proxy. // #define ENCODE_BUFFER_PREFIX_SIZE 64 // // The encode routines may write one byte // past the nominal end of the encode buffer. // This additional byte is included in the // payload. This is actually a harmless bug. // #define ENCODE_BUFFER_POSTFIX_SIZE 1 class EncodeBuffer { public: EncodeBuffer(); ~EncodeBuffer(); void setSize(unsigned int initialSize, unsigned int thresholdSize, unsigned int maximumSize); void encodeValue(unsigned int value, unsigned int numBits, unsigned int blockSize = 0); void encodeCachedValue(unsigned int value, unsigned int numBits, IntCache &cache, unsigned int blockSize = 0); void encodeCachedValue(unsigned char value, unsigned int numBits, CharCache &cache, unsigned int blockSize = 0); void encodeDiffCachedValue(const unsigned int value, unsigned int &previous, unsigned int numBits, IntCache &cache, unsigned int blockSize = 0) { encodeCachedValue((value - 1) - previous, numBits, cache, blockSize); previous = value; } void encodeBoolValue(unsigned int value) { encodeValue(value, 1); } void encodeOpcodeValue(unsigned char value, OpcodeCache &cache) { encodeCachedValue(value, 8, cache.base_[cache.slot_], 8); cache.slot_ = value; } void encodeActionValue(unsigned char value, ActionCache &cache) { unsigned short position = 0; encodeActionValue(value, position, cache); } void encodeActionValue(unsigned char value, unsigned short position, ActionCache &cache); void encodeNewXidValue(unsigned int value, unsigned int &lastId, IntCache &lastIdCache, IntCache &cache, FreeCache &freeCache); void encodeNewXidValue(unsigned int value, unsigned int &lastId, IntCache &lastIdCache, XidCache &cache, FreeCache &freeCache); void encodeXidValue(unsigned int value, XidCache &cache); void encodeFreeXidValue(unsigned int value, FreeCache &cache); void encodeTextData(const unsigned char *buffer, unsigned int numBytes) { encodeMemory(buffer, numBytes); } void encodeIntData(const unsigned char *buffer, unsigned int numBytes) { encodeMemory(buffer, numBytes); } void encodeLongData(const unsigned char *buffer, unsigned int numBytes) { encodeMemory(buffer, numBytes); } void encodeMemory(const unsigned char *buffer, unsigned int numBytes); unsigned char *getData() { return buffer_; } unsigned int getLength() const; unsigned int getBits() const { return ((nextDest_ - buffer_) << 3) + (7 - destShift_); } unsigned int diffBits(); void fullReset(); private: void growBuffer(unsigned int numBytes = 0); void alignBuffer(); unsigned int size_; unsigned char *buffer_; // // This points to the first byte // just beyond end of the buffer. // const unsigned char *end_; unsigned char *nextDest_; unsigned int destShift_; unsigned int lastBits_; unsigned int initialSize_; unsigned int thresholdSize_; unsigned int maximumSize_; }; #endif /* EncodeBuffer_H */ nx-libs-3.5.99.23/nxcomp/src/FillPoly.cpp0000644000000000000000000001717613614532331014654 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "FillPoly.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int FillPolyStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { FillPolyMessage *fillPoly = (FillPolyMessage *) message; // // Here is the fingerprint. // fillPoly -> drawable = GetULONG(buffer + 4, bigEndian); fillPoly -> gcontext = GetULONG(buffer + 8, bigEndian); fillPoly -> shape = *(buffer + 12); fillPoly -> mode = *(buffer + 13); // Since ProtoStep8 (#issue 108) if (size >= (unsigned int) dataOffset) { fillPoly -> x_origin = GetUINT(buffer + 16, bigEndian); fillPoly -> y_origin = GetUINT(buffer + 18, bigEndian); } else { fillPoly -> x_origin = 0; fillPoly -> y_origin = 0; } #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int FillPolyStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { FillPolyMessage *fillPoly = (FillPolyMessage *) message; // // Fill all the message's fields. // PutULONG(fillPoly -> drawable, buffer + 4, bigEndian); PutULONG(fillPoly -> gcontext, buffer + 8, bigEndian); *(buffer + 12) = fillPoly -> shape; *(buffer + 13) = fillPoly -> mode; // Since ProtoStep8 (#issue 108) if (size >= (unsigned int) dataOffset) { PutUINT(fillPoly -> x_origin, buffer + 16, bigEndian); PutUINT(fillPoly -> y_origin, buffer + 18, bigEndian); } #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void FillPolyStore::dumpIdentity(const Message *message) const { #ifdef DUMP FillPolyMessage *fillPoly = (FillPolyMessage *) message; *logofs << name() << ": Identity drawable " << fillPoly -> drawable << ", gcontext " << fillPoly -> gcontext << ", shape " << fillPoly -> shape << ", mode " << fillPoly -> mode << fillPoly -> size_ << ", x_origin " << fillPoly -> x_origin << ", y_origin " << fillPoly -> y_origin << ".\n" << logofs_flush; #endif } void FillPolyStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { // // Fields shape, mode. // md5_append(md5_state_, buffer + 12, 2); } void FillPolyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { FillPolyMessage *fillPoly = (FillPolyMessage *) message; FillPolyMessage *cachedFillPoly = (FillPolyMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << fillPoly -> drawable << " as drawable field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(fillPoly -> drawable, clientCache -> drawableCache); cachedFillPoly -> drawable = fillPoly -> drawable; #ifdef TEST *logofs << name() << ": Encoding value " << fillPoly -> gcontext << " as gcontext field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(fillPoly -> gcontext, clientCache -> gcCache); cachedFillPoly -> gcontext = fillPoly -> gcontext; // Since ProtoStep8 (#issue 108) if (fillPoly -> size_ >= dataOffset) { #ifdef TEST *logofs << name() << ": Encoding value " << fillPoly -> x_origin << " as x_origin field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(fillPoly -> x_origin, 16, *clientCache -> fillPolyXAbsCache[0], 8); cachedFillPoly -> x_origin = fillPoly -> x_origin; #ifdef TEST *logofs << name() << ": Encoding value " << fillPoly -> y_origin << " as y_origin field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(fillPoly -> y_origin, 16, *clientCache -> fillPolyYAbsCache[0], 8); cachedFillPoly -> y_origin = fillPoly -> y_origin; } } void FillPolyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { FillPolyMessage *fillPoly = (FillPolyMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeXidValue(fillPoly -> drawable, clientCache -> drawableCache); #ifdef TEST *logofs << name() << ": Decoded value " << fillPoly -> drawable << " as drawable field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(fillPoly -> gcontext, clientCache -> gcCache); #ifdef TEST *logofs << name() << ": Decoded value " << fillPoly -> gcontext << " as gcontext field.\n" << logofs_flush; #endif // Since ProtoStep8 (#issue 108) if (fillPoly -> size_ >= dataOffset) { unsigned int value; decodeBuffer.decodeCachedValue(value, 16, *clientCache -> fillPolyXAbsCache[0], 8); fillPoly -> x_origin = value; #ifdef TEST *logofs << name() << ": Decoded value " << fillPoly -> x_origin << " as x_origin field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, *clientCache -> fillPolyYAbsCache[0], 8); fillPoly -> y_origin = value; #ifdef TEST *logofs << name() << ": Decoded value " << fillPoly -> y_origin << " as y_origin field.\n" << logofs_flush; #endif } } nx-libs-3.5.99.23/nxcomp/src/FillPoly.h0000644000000000000000000001303113614532331014303 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef FillPoly_H #define FillPoly_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define FILLPOLY_ENABLE_CACHE 1 #define FILLPOLY_ENABLE_DATA 0 #define FILLPOLY_ENABLE_SPLIT 0 #define FILLPOLY_ENABLE_COMPRESS 0 #define FILLPOLY_DATA_LIMIT 512 #define FILLPOLY_CACHE_SLOTS 2000 #define FILLPOLY_CACHE_THRESHOLD 3 #define FILLPOLY_CACHE_LOWER_THRESHOLD 1 #define FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8 20 // // The message class. // class FillPolyMessage : public Message { friend class FillPolyStore; public: FillPolyMessage() { } ~FillPolyMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char shape; unsigned char mode; unsigned int drawable; unsigned int gcontext; unsigned short x_origin; unsigned short y_origin; }; class FillPolyStore : public MessageStore { // // Constructors and destructors. // public: FillPolyStore() : MessageStore() { enableCache = FILLPOLY_ENABLE_CACHE; enableData = FILLPOLY_ENABLE_DATA; enableSplit = FILLPOLY_ENABLE_SPLIT; enableCompress = FILLPOLY_ENABLE_COMPRESS; dataLimit = FILLPOLY_DATA_LIMIT; // Since ProtoStep8 (#issue 108) dataOffset = FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8; cacheSlots = FILLPOLY_CACHE_SLOTS; cacheThreshold = FILLPOLY_CACHE_THRESHOLD; cacheLowerThreshold = FILLPOLY_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~FillPolyStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "FillPoly"; } virtual unsigned char opcode() const { return X_FillPoly; } virtual unsigned int storage() const { return sizeof(FillPolyMessage); } // // Message handling methods. // public: virtual Message *create() const { return new FillPolyMessage(); } virtual Message *create(const Message &message) const { return new FillPolyMessage((const FillPolyMessage &) message); } virtual void destroy(Message *message) const { delete (FillPolyMessage *) message; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { // Since ProtoStep8 (#issue 108) return (size >= FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8 ? FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8 : size); } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* FillPoly_H */ nx-libs-3.5.99.23/nxcomp/src/Fork.cpp0000644000000000000000000000616113614532331014013 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "Fork.h" #include "Misc.h" #include "Timestamp.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Only on Cygwin, retry n times waiting a // given amount of milliseconds after each // attempt. // #define RETRY_LIMIT 30 #define RETRY_TIMEOUT 1000 int Fork() { #ifdef __CYGWIN32__ int limit = RETRY_LIMIT; int timeout = RETRY_TIMEOUT; #else int limit = 1; int timeout = 0; #endif int pid = 0; for (int i = 0; i < limit; i++) { #ifdef TEST *logofs << "Fork: Trying at " << strMsTimestamp() << ".\n" << logofs_flush; #endif // // It could optionally try again only if the // error code is 11, 'Resource temporarily // unavailable'. // if ((pid = fork()) >= 0) { break; } else if (i < limit - 1) { #ifdef WARNING *logofs << "Fork: WARNING! Function fork failed. " << "Error is " << EGET() << " '" << ESTR() << "'. Retrying...\n" << logofs_flush; #endif usleep(timeout * 1000); } } #ifdef TEST if (pid <= 0) { *logofs << "Fork: Returning at " << strMsTimestamp() << ".\n" << logofs_flush; } #endif return pid; } nx-libs-3.5.99.23/nxcomp/src/Fork.h0000644000000000000000000000363213614532331013460 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ // // Try again if the fork() fails, as it can happen // often on Cygwin. // extern int Fork(); nx-libs-3.5.99.23/nxcomp/src/FreeCache.h0000644000000000000000000000400213614532331014354 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef FreeCache_H #define FreeCache_H #include "IntCache.h" class FreeCache : public IntCache { public: FreeCache(unsigned int size) : IntCache(size) { } }; #endif /* FreeCache_H */ nx-libs-3.5.99.23/nxcomp/src/GenericChannel.cpp0000644000000000000000000002762213614532331015764 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "GenericChannel.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "StaticCompressor.h" #include "Statistics.h" #include "Proxy.h" extern Proxy *proxy; // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Log the important tracepoints related // to writing packets to the peer proxy. // #undef FLUSH // // Define this to log when a channel // is created or destroyed. // #undef REFERENCES // // Here are the static members. // #ifdef REFERENCES int GenericChannel::references_ = 0; #endif GenericChannel::GenericChannel(Transport *transport, StaticCompressor *compressor) : Channel(transport, compressor), readBuffer_(transport_, this) { #ifdef REFERENCES *logofs << "GenericChannel: Created new object at " << this << " for FD#" << fd_ << " out of " << ++references_ << " allocated channels.\n" << logofs_flush; #endif } GenericChannel::~GenericChannel() { #ifdef REFERENCES *logofs << "GenericChannel: Deleted object at " << this << " for FD#" << fd_ << " out of " << --references_ << " allocated channels.\n" << logofs_flush; #endif } // // Beginning of handleRead(). // int GenericChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, unsigned int length) { #ifdef TEST *logofs << "handleRead: Called for FD#" << fd_ << " with " << encodeBuffer.getLength() << " bytes already encoded.\n" << logofs_flush; #endif // // Pointer to located message and // its size in bytes. // const unsigned char *inputMessage; unsigned int inputLength; // // Tag message as generic data in compression // routine. Opcode is not actually transferred // over the network. // unsigned char inputOpcode = X_NXInternalGenericData; #if defined(TEST) || defined(INFO) *logofs << "handleRead: Trying to read from FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif int result = readBuffer_.readMessage(); #ifdef DEBUG *logofs << "handleRead: Read result on FD#" << fd_ << " is " << result << ".\n" << logofs_flush; #endif if (result < 0) { // // Let the proxy close the channel. // return -1; } else if (result == 0) { #if defined(TEST) || defined(INFO) *logofs << "handleRead: PANIC! No data read from FD#" << fd_ << " while encoding messages.\n" << logofs_flush; HandleCleanup(); #endif return 0; } #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "handleRead: Encoding messages for FD#" << fd_ << " with " << readBuffer_.getLength() << " bytes " << "in the buffer.\n" << logofs_flush; #endif // // Divide the available data in multiple // messages and encode them one by one. // if (proxy -> handleAsyncSwitch(fd_) < 0) { return -1; } while ((inputMessage = readBuffer_.getMessage(inputLength)) != NULL) { encodeBuffer.encodeValue(inputLength, 32, 14); if (isCompressed() == 1) { unsigned int compressedDataSize = 0; unsigned char *compressedData = NULL; if (handleCompress(encodeBuffer, inputOpcode, 0, inputMessage, inputLength, compressedData, compressedDataSize) < 0) { return -1; } } else { encodeBuffer.encodeMemory(inputMessage, inputLength); } int bits = encodeBuffer.diffBits(); #if defined(TEST) || defined(OPCODES) *logofs << "handleRead: Handled generic data for FD#" << fd_ << ". " << inputLength << " bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; #endif addProtocolBits(inputLength << 3, bits); if (isPrioritized() == 1) { priority_++; } } // End of while ((inputMessage = readBuffer_.getMessage(inputLength)) != NULL) ... // // All data has been read from the read buffer. // We still need to mark the end of the encode // buffer just before sending the frame. This // allows us to accommodate multiple reads in // a single frame. // if (priority_ > 0) { #if defined(TEST) || defined(INFO) *logofs << "handleRead: WARNING! Requesting flush " << "because of " << priority_ << " prioritized " << "messages for FD#" << fd_ << ".\n" << logofs_flush; #endif if (proxy -> handleAsyncPriority() < 0) { return -1; } // // Reset the priority flag. // priority_ = 0; } // // Flush if we produced enough data. // if (proxy -> canAsyncFlush() == 1) { #if defined(TEST) || defined(INFO) *logofs << "handleRead: WARNING! Requesting flush " << "because of enough data or timeout on the " << "proxy link.\n" << logofs_flush; #endif if (proxy -> handleAsyncFlush() < 0) { return -1; } } #if defined(TEST) || defined(INFO) if (transport_ -> pending() != 0 || readBuffer_.checkMessage() != 0) { *logofs << "handleRead: PANIC! Buffer for X descriptor FD#" << fd_ << " has " << transport_ -> pending() << " bytes to read.\n" << logofs_flush; HandleCleanup(); } #endif // // Reset the read buffer. // readBuffer_.fullReset(); return 1; } // // End of handleRead(). // // // Beginning of handleWrite(). // int GenericChannel::handleWrite(const unsigned char *message, unsigned int length) { #ifdef TEST *logofs << "handleWrite: Called for FD#" << fd_ << ".\n" << logofs_flush; #endif // // Create the buffer from which to // decode messages. // DecodeBuffer decodeBuffer(message, length); #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "handleWrite: Decoding messages for FD#" << fd_ << " with " << length << " bytes in the buffer.\n" << logofs_flush; #endif unsigned char *outputMessage; unsigned int outputLength; // // Tag message as generic data // in decompression. // unsigned char outputOpcode = X_NXInternalGenericData; for (;;) { decodeBuffer.decodeValue(outputLength, 32, 14); if (outputLength == 0) { break; } if (isCompressed() == 1) { if (writeBuffer_.getAvailable() < outputLength || (int) outputLength >= control -> TransportFlushBufferSize) { #ifdef DEBUG *logofs << "handleWrite: Using scratch buffer for " << "generic data with size " << outputLength << " and " << writeBuffer_.getLength() << " bytes in buffer.\n" << logofs_flush; #endif outputMessage = writeBuffer_.addScratchMessage(outputLength); } else { outputMessage = writeBuffer_.addMessage(outputLength); } const unsigned char *compressedData = NULL; unsigned int compressedDataSize = 0; int decompressed = handleDecompress(decodeBuffer, outputOpcode, 0, outputMessage, outputLength, compressedData, compressedDataSize); if (decompressed < 0) { return -1; } } else { #ifdef DEBUG *logofs << "handleWrite: Using scratch buffer for " << "generic data with size " << outputLength << " and " << writeBuffer_.getLength() << " bytes in buffer.\n" << logofs_flush; #endif writeBuffer_.addScratchMessage((unsigned char *) decodeBuffer.decodeMemory(outputLength), outputLength); } #if defined(TEST) || defined(OPCODES) *logofs << "handleWrite: Handled generic data for FD#" << fd_ << ". " << outputLength << " bytes out.\n" << logofs_flush; #endif handleFlush(flush_if_needed); } // // Write any remaining data to socket. // if (handleFlush(flush_if_any) < 0) { return -1; } return 1; } // // End of handleWrite(). // // // Other members. // int GenericChannel::handleCompletion(EncodeBuffer &encodeBuffer) { // // Add the bits telling to the remote // that all data in the frame has been // encoded. // if (encodeBuffer.getLength() > 0) { #if defined(TEST) || defined(INFO) *logofs << "handleCompletion: Writing completion bits with " << encodeBuffer.getLength() << " bytes encoded " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif encodeBuffer.encodeValue(0, 32, 14); return 1; } #if defined(TEST) || defined(INFO) else { *logofs << "handleCompletion: PANIC! No completion to write " << "for FD#" << fd_ << ".\n" << logofs_flush; HandleCleanup(); } #endif return 0; } int GenericChannel::handleConfiguration() { #ifdef TEST *logofs << "GenericChannel: Setting new buffer parameters.\n" << logofs_flush; #endif readBuffer_.setSize(control -> GenericInitialReadSize, control -> GenericMaximumBufferSize); writeBuffer_.setSize(control -> TransportGenericBufferSize, control -> TransportGenericBufferThreshold, control -> TransportMaximumBufferSize); transport_ -> setSize(control -> TransportGenericBufferSize, control -> TransportGenericBufferThreshold, control -> TransportMaximumBufferSize); return 1; } int GenericChannel::handleFinish() { #ifdef TEST *logofs << "GenericChannel: Finishing channel for FD#" << fd_ << ".\n" << logofs_flush; #endif congestion_ = 0; priority_ = 0; finish_ = 1; transport_ -> fullReset(); return 1; } int GenericChannel::setReferences() { #ifdef TEST *logofs << "GenericChannel: Initializing the static " << "members for the generic channels.\n" << logofs_flush; #endif #ifdef REFERENCES references_ = 0; #endif return 1; } nx-libs-3.5.99.23/nxcomp/src/GenericChannel.h0000644000000000000000000002074213614532331015425 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef GenericChannel_H #define GenericChannel_H #include "Channel.h" #include "Statistics.h" #include "GenericReadBuffer.h" // // Set the verbosity level. // #define PANIC #undef TEST #undef DEBUG // // Define this to log a line when a channel // is created or destroyed. // #undef REFERENCES // // This class implements the client // side compression of X protocol. // class GenericChannel : public Channel { public: GenericChannel(Transport *transport, StaticCompressor *compressor); virtual ~GenericChannel(); virtual int handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, unsigned int length); virtual int handleWrite(const unsigned char *message, unsigned int length); virtual int handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, T_store_action action, int position, const unsigned char opcode, const unsigned char *buffer, const unsigned int size) { return 0; } virtual int handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, T_store_action action, int position, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { return 0; } virtual int handleSplit(EncodeBuffer &encodeBuffer) { return 0; } virtual int handleSplit(DecodeBuffer &decodeBuffer) { return 0; } virtual int handleSplitEvent(EncodeBuffer &encodeBuffer, Split *split) { return 0; } virtual int handleSplitEvent(DecodeBuffer &decodeBuffer) { return 0; } virtual int handleMotion(EncodeBuffer &encodeBuffer) { return 0; } virtual int handleCompletion(EncodeBuffer &encodeBuffer); virtual int handleConfiguration(); virtual int handleFinish(); virtual int handleAsyncEvents() { return 0; } virtual int needSplit() const { return 0; } virtual int needMotion() const { return 0; } virtual T_channel_type getType() const = 0; // // Initialize the static members. // static int setReferences(); protected: // // Generic channels are considered to be // in congestion state as soon as the // socket is blocked for write. // virtual int isCongested() { return (transport_ -> blocked() == 1); } virtual int isReliable() { return 0; } // // Model generic channels' encoding and // decoding policy. // virtual int isCompressed() = 0; // // Return true if the channel contains // time sensitive data. // virtual int isPrioritized() = 0; // // Record the protocol bits for the // specific service. // virtual void addProtocolBits(unsigned int bitsIn, unsigned int bitsOut) = 0; // // Channel's own read buffer. // GenericReadBuffer readBuffer_; private: // // Keep track of object's creation // and deletion. // #ifdef REFERENCES static int references_; #endif }; class CupsChannel : public GenericChannel { public: CupsChannel(Transport *transport, StaticCompressor *compressor) : GenericChannel(transport, compressor) { } virtual ~CupsChannel() { } protected: virtual T_channel_type getType() const { return channel_cups; } virtual int isCompressed() { // Since ProtoStep8 (#issue 108) return 0; } virtual int isPrioritized() { return 0; } virtual void addProtocolBits(unsigned int bitsIn, unsigned int bitsOut) { statistics -> addCupsBits(bitsIn, bitsOut); } }; class SmbChannel : public GenericChannel { public: SmbChannel(Transport *transport, StaticCompressor *compressor) : GenericChannel(transport, compressor) { } virtual ~SmbChannel() { } protected: virtual T_channel_type getType() const { return channel_smb; } virtual int isCompressed() { // Since ProtoStep8 (#issue 108) return 0; } virtual int isPrioritized() { return 0; } virtual void addProtocolBits(unsigned int bitsIn, unsigned int bitsOut) { statistics -> addSmbBits(bitsIn, bitsOut); } }; class MediaChannel : public GenericChannel { public: MediaChannel(Transport *transport, StaticCompressor *compressor) : GenericChannel(transport, compressor) { } virtual ~MediaChannel() { } protected: virtual T_channel_type getType() const { return channel_media; } // // Don't try to compress the media data. // virtual int isCompressed() { return 0; } // // Reduce the latency of media channels // by setting them as prioritized, even // if this will take away bandwidth from // the X channels. // virtual int isPrioritized() { return 1; } virtual void addProtocolBits(unsigned int bitsIn, unsigned int bitsOut) { statistics -> addMediaBits(bitsIn, bitsOut); } }; class HttpChannel : public GenericChannel { public: HttpChannel(Transport *transport, StaticCompressor *compressor) : GenericChannel(transport, compressor) { } virtual ~HttpChannel() { } protected: virtual T_channel_type getType() const { return channel_http; } virtual int isCompressed() { // Since ProtoStep8 (#issue 108) return 0; } virtual int isPrioritized() { return 0; } virtual void addProtocolBits(unsigned int bitsIn, unsigned int bitsOut) { statistics -> addHttpBits(bitsIn, bitsOut); } }; class FontChannel : public GenericChannel { public: FontChannel(Transport *transport, StaticCompressor *compressor) : GenericChannel(transport, compressor) { } virtual ~FontChannel() { } protected: virtual T_channel_type getType() const { return channel_font; } virtual int isCompressed() { // Since ProtoStep8 (#issue 108) return 0; } virtual int isPrioritized() { return 1; } virtual void addProtocolBits(unsigned int bitsIn, unsigned int bitsOut) { statistics -> addFontBits(bitsIn, bitsOut); } }; class SlaveChannel : public GenericChannel { public: SlaveChannel(Transport *transport, StaticCompressor *compressor) : GenericChannel(transport, compressor) { } virtual ~SlaveChannel() { } protected: virtual T_channel_type getType() const { return channel_slave; } virtual int isCompressed() { return 0; } virtual int isPrioritized() { return 0; } virtual void addProtocolBits(unsigned int bitsIn, unsigned int bitsOut) { statistics -> addSlaveBits(bitsIn, bitsOut); } }; #endif /* GenericChannel_H */ nx-libs-3.5.99.23/nxcomp/src/GenericReadBuffer.cpp0000644000000000000000000000564113614532331016416 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "GenericReadBuffer.h" #include "GenericChannel.h" #define PANIC #define WARNING #undef TEST #undef DEBUG unsigned int GenericReadBuffer::suggestedLength(unsigned int pendingLength) { // // Always read the initial read size. // return 0; } int GenericReadBuffer::locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &controlLength, unsigned int &dataLength, unsigned int &trailerLength) { // // We don't care about the endianness // in generic channels. // unsigned int size = end - start; #ifdef TEST *logofs << "GenericReadBuffer: Locating message for FD#" << transport_ -> fd() << " with " << size << " bytes.\n" << logofs_flush; #endif if (size == 0) { remaining_ = 1; return 0; } dataLength = size; controlLength = 0; trailerLength = 0; remaining_ = 0; return 1; } nx-libs-3.5.99.23/nxcomp/src/GenericReadBuffer.h0000644000000000000000000000515013614532331016056 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef GenericReadBuffer_H #define GenericReadBuffer_H #include "ReadBuffer.h" #include "Control.h" class GenericChannel; class GenericReadBuffer : public ReadBuffer { public: GenericReadBuffer(Transport *transport, GenericChannel *channel) : ReadBuffer(transport), channel_(channel) { } virtual ~GenericReadBuffer() { } protected: virtual unsigned int suggestedLength(unsigned int pendingLength); virtual int locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &controlLength, unsigned int &dataLength, unsigned int &trailerLength); GenericChannel *channel_; }; #endif /* GenericReadBuffer_H */ nx-libs-3.5.99.23/nxcomp/src/GenericReply.cpp0000644000000000000000000002206513614532331015503 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "GenericReply.h" #include "ServerCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "WriteBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Constructors and destructors. // GenericReplyStore::GenericReplyStore(StaticCompressor *compressor) : MessageStore(compressor) { enableCache = GENERICREPLY_ENABLE_CACHE; enableData = GENERICREPLY_ENABLE_DATA; enableSplit = GENERICREPLY_ENABLE_SPLIT; // Since ProtoStep7 (#issue 108) enableCompress = GENERICREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; dataLimit = GENERICREPLY_DATA_LIMIT; dataOffset = GENERICREPLY_DATA_OFFSET; cacheSlots = GENERICREPLY_CACHE_SLOTS; cacheThreshold = GENERICREPLY_CACHE_THRESHOLD; cacheLowerThreshold = GENERICREPLY_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } GenericReplyStore::~GenericReplyStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } // // Here are the methods to handle messages' content. // int GenericReplyStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const { ServerCache *serverCache = (ServerCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; #endif encodeBuffer.encodeValue(GetULONG(buffer + 4, bigEndian), 32, 15); encodeBuffer.encodeCachedValue(*(buffer + 1), 8, serverCache -> genericReplyCharCache); for (unsigned int i = 0; i < 6; i++) { encodeBuffer.encodeCachedValue(GetULONG(buffer + i * 4 + 8, bigEndian), 32, *serverCache -> genericReplyIntCache[i]); } #ifdef DEBUG *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; #endif return 1; } int GenericReplyStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const { ServerCache *serverCache = (ServerCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; #endif decodeBuffer.decodeValue(size, 32, 15); size = 32 + (size << 2); buffer = writeBuffer -> addMessage(size); decodeBuffer.decodeCachedValue(*(buffer + 1), 8, serverCache -> genericReplyCharCache); unsigned int value; for (unsigned int i = 0; i < 6; i++) { decodeBuffer.decodeCachedValue(value, 32, *serverCache -> genericReplyIntCache[i]); PutULONG(value, buffer + i * 4 + 8, bigEndian); } #ifdef DEBUG *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; #endif return 1; } int GenericReplyStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { GenericReplyMessage *genericReply = (GenericReplyMessage *) message; genericReply -> byte_data = *(buffer + 1); for (int i = 0; i < 12; i++) { genericReply -> short_data[i] = GetUINT(buffer + i * 2 + 8, bigEndian); } #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } int GenericReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { GenericReplyMessage *genericReply = (GenericReplyMessage *) message; *(buffer + 1) = genericReply -> byte_data; for (int i = 0; i < 12; i++) { PutUINT(genericReply -> short_data[i], buffer + i * 2 + 8, bigEndian); } #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } void GenericReplyStore::dumpIdentity(const Message *message) const { #ifdef DUMP GenericReplyMessage *genericReply = (GenericReplyMessage *) message; *logofs << name() << ": Identity byte_data " << (unsigned) genericReply -> byte_data; for (int i = 0; i < 12; i++) { *logofs << ", short_data[" << i << "]" << (unsigned) genericReply -> short_data[i]; } *logofs << ", size " << genericReply -> size_ << ".\n"; #endif } void GenericReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { } void GenericReplyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { // // Encode the variant part. // GenericReplyMessage *genericReply = (GenericReplyMessage *) message; GenericReplyMessage *cachedGenericReply = (GenericReplyMessage *) cachedMessage; ServerCache *serverCache = (ServerCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << (unsigned int) genericReply -> byte_data << " as byte_data field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(genericReply -> byte_data, 8, serverCache -> genericReplyCharCache); cachedGenericReply -> byte_data = genericReply -> byte_data; for (unsigned int i = 0; i < 12; i++) { #ifdef TEST *logofs << name() << ": Encoding value " << genericReply -> short_data[i] << " as short_data[" << i << "] field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(genericReply -> short_data[i], 16, *serverCache -> genericReplyIntCache[i]); cachedGenericReply -> short_data[i] = genericReply -> short_data[i]; } } void GenericReplyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { // // Decode the variant part. // GenericReplyMessage *genericReply = (GenericReplyMessage *) message; ServerCache *serverCache = (ServerCache *) channelCache; decodeBuffer.decodeCachedValue(genericReply -> byte_data, 8, serverCache -> genericReplyCharCache); #ifdef TEST *logofs << name() << ": Decoded value " << (unsigned int) genericReply -> byte_data << " as byte_data field.\n" << logofs_flush; #endif unsigned int value; for (unsigned int i = 0; i < 12; i++) { decodeBuffer.decodeCachedValue(value, 16, *serverCache -> genericReplyIntCache[i]); genericReply -> short_data[i] = (unsigned short) value; #ifdef TEST *logofs << name() << ": Decoded value " << genericReply -> short_data[i] << " as short_data[" << i << "] field.\n" << logofs_flush; #endif } } nx-libs-3.5.99.23/nxcomp/src/GenericReply.h0000644000000000000000000001214113614532331015142 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef GenericReply_H #define GenericReply_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define GENERICREPLY_ENABLE_CACHE 1 #define GENERICREPLY_ENABLE_DATA 1 #define GENERICREPLY_ENABLE_SPLIT 0 #define GENERICREPLY_DATA_LIMIT 1048576 - 32 #define GENERICREPLY_DATA_OFFSET 32 #define GENERICREPLY_CACHE_SLOTS 400 #define GENERICREPLY_CACHE_THRESHOLD 5 #define GENERICREPLY_CACHE_LOWER_THRESHOLD 1 #define GENERICREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 // // The message class. // class GenericReplyMessage : public Message { friend class GenericReplyStore; public: GenericReplyMessage() { } ~GenericReplyMessage() { } // // Put here the fields which constitute the // 'identity' part of the message. Starting // from protocol level 3 we use short data // to increase cache efficiency. // private: unsigned char byte_data; unsigned short short_data[12]; }; class GenericReplyStore : public MessageStore { public: GenericReplyStore(StaticCompressor *compressor); virtual ~GenericReplyStore(); virtual const char *name() const { return "GenericReply"; } virtual unsigned char opcode() const { return X_NXInternalGenericReply; } virtual unsigned int storage() const { return sizeof(GenericReplyMessage); } // // Message handling methods. // protected: virtual Message *create() const { return new GenericReplyMessage(); } virtual Message *create(const Message &message) const { return new GenericReplyMessage((const GenericReplyMessage &) message); } virtual void destroy(Message *message) const { delete (GenericReplyMessage *) message; } virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const; virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* GenericReply_H */ nx-libs-3.5.99.23/nxcomp/src/GenericRequest.cpp0000644000000000000000000002445413614532331016044 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "GenericRequest.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "WriteBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Constructors and destructors. // GenericRequestStore::GenericRequestStore(StaticCompressor *compressor) : MessageStore(compressor) { enableCache = GENERICREQUEST_ENABLE_CACHE; enableData = GENERICREQUEST_ENABLE_DATA; enableSplit = GENERICREQUEST_ENABLE_SPLIT; // Since ProtoStep7 (#issue 108) enableCompress = GENERICREQUEST_ENABLE_COMPRESS_IF_PROTO_STEP_7; dataLimit = GENERICREQUEST_DATA_LIMIT; dataOffset = GENERICREQUEST_DATA_OFFSET; cacheSlots = GENERICREQUEST_CACHE_SLOTS; cacheThreshold = GENERICREQUEST_CACHE_THRESHOLD; cacheLowerThreshold = GENERICREQUEST_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } GenericRequestStore::~GenericRequestStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } // // Here are the methods to handle messages' content. // int GenericRequestStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; #endif encodeBuffer.encodeValue(size >> 2, 16, 10); encodeBuffer.encodeCachedValue(*(buffer + 1), 8, clientCache -> genericRequestOpcodeCache); for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) { #ifdef DEBUG *logofs << name() << ": Encoding data[" << i << "] " << "at position " << i * 2 + 4 << " with value " << GetUINT(buffer + (i * 2) + 4, bigEndian) << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(GetUINT(buffer + (i * 2) + 4, bigEndian), 16, *clientCache -> genericRequestDataCache[i]); } #ifdef DEBUG *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; #endif return 1; } int GenericRequestStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; #endif decodeBuffer.decodeValue(size, 16, 10); size <<= 2; buffer = writeBuffer -> addMessage(size); decodeBuffer.decodeCachedValue(*(buffer + 1), 8, clientCache -> genericRequestOpcodeCache); unsigned int value; for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache -> genericRequestDataCache[i]); #ifdef DEBUG *logofs << name() << ": Decoding data[" << i << "] " << "at position " << i * 2 + 4 << " with value " << value << ".\n" << logofs_flush; #endif PutUINT(value, buffer + 4 + (i * 2), bigEndian); } #ifdef DEBUG *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; #endif return 1; } int GenericRequestStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; genericRequest -> opcode = *(buffer + 1); for (unsigned int i = 0; i < 8; i++) { if ((i * 2 + 4) < size) { genericRequest -> data[i] = GetUINT(buffer + i * 2 + 4, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed data[" << i << "] " << "with value " << genericRequest -> data[i] << ".\n" << logofs_flush; #endif } else { genericRequest -> data[i] = 0; } } #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int GenericRequestStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; *(buffer + 1) = genericRequest -> opcode; for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) { #ifdef DEBUG *logofs << name() << ": Unparsed data[" << i << "] " << "with value " << genericRequest -> data[i] << ".\n" << logofs_flush; #endif PutUINT(genericRequest -> data[i], buffer + i * 2 + 4, bigEndian); } #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void GenericRequestStore::dumpIdentity(const Message *message) const { #ifdef DUMP GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; *logofs << name() << ": Identity opcode " << (unsigned) genericRequest -> opcode; for (int i = 0; i < 8; i++) { *logofs << ", data[" << i << "] " << genericRequest -> data[i]; } *logofs << ", size " << genericRequest -> size_ << ".\n" << logofs_flush; #endif } void GenericRequestStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { // // As data offset can be beyond the real end of // the message, we need to include the message's // size or we will match any message whose size // is less or equal to the data offset. // md5_append(md5_state_, buffer + 2, 2); } void GenericRequestStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { // // Encode the variant part. // GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; GenericRequestMessage *cachedGenericRequest = (GenericRequestMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Updating value " << (unsigned) genericRequest -> opcode << " as opcode field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue((unsigned int) genericRequest -> opcode, 8, clientCache -> genericRequestOpcodeCache); cachedGenericRequest -> opcode = genericRequest -> opcode; for (int i = 0; i < 8 && (i * 2 + 4) < genericRequest -> size_; i++) { #ifdef TEST *logofs << name() << ": Updating data[" << i << "] " << "with value " << genericRequest -> data[i] << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue((unsigned int) genericRequest -> data[i], 16, *clientCache -> genericRequestDataCache[i]); cachedGenericRequest -> data[i] = genericRequest -> data[i]; } } void GenericRequestStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeCachedValue(genericRequest -> opcode, 8, clientCache -> genericRequestOpcodeCache); #ifdef TEST *logofs << name() << ": Updated value " << (unsigned) genericRequest -> opcode << " as opcode field.\n" << logofs_flush; #endif unsigned int value; for (int i = 0; i < 8 && (i * 2 + 4) < genericRequest -> size_; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache -> genericRequestDataCache[i]); genericRequest -> data[i] = (unsigned short) value; #ifdef TEST *logofs << name() << ": Updated data[" << i << "] " << "with value " << genericRequest -> data[i] << ".\n" << logofs_flush; #endif } } nx-libs-3.5.99.23/nxcomp/src/GenericRequest.h0000644000000000000000000001225113614532331015501 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef GenericRequest_H #define GenericRequest_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define GENERICREQUEST_ENABLE_CACHE 1 #define GENERICREQUEST_ENABLE_DATA 1 #define GENERICREQUEST_ENABLE_SPLIT 0 #define GENERICREQUEST_DATA_LIMIT 262144 - 20 #define GENERICREQUEST_DATA_OFFSET 20 #define GENERICREQUEST_CACHE_SLOTS 400 #define GENERICREQUEST_CACHE_THRESHOLD 5 #define GENERICREQUEST_CACHE_LOWER_THRESHOLD 1 #define GENERICREQUEST_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 // // The message class. // class GenericRequestMessage : public Message { friend class GenericRequestStore; public: GenericRequestMessage() { } ~GenericRequestMessage() { } // // Note that we consider for this message a data offset // of 4 (or 20 starting from protocol 3). Bytes from 9 // to 20, if present, are taken as part of identity and // encoded through an array of int caches. // private: unsigned char opcode; unsigned short data[8]; }; class GenericRequestStore : public MessageStore { public: GenericRequestStore(StaticCompressor *compressor); virtual ~GenericRequestStore(); virtual const char *name() const { return "GenericRequest"; } virtual unsigned char opcode() const { return X_NXInternalGenericRequest; } virtual unsigned int storage() const { return sizeof(GenericRequestMessage); } // // Message handling methods. // public: virtual Message *create() const { return new GenericRequestMessage(); } virtual Message *create(const Message &message) const { return new GenericRequestMessage((const GenericRequestMessage &) message); } virtual void destroy(Message *message) const { delete (GenericRequestMessage *) message; } virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const; virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* GenericRequest_H */ nx-libs-3.5.99.23/nxcomp/src/GetImage.cpp0000644000000000000000000001407313614532331014575 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "GetImage.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int GetImageStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { GetImageMessage *getImage = (GetImageMessage *) message; // // Here is the fingerprint. // getImage -> format = *(buffer + 1); #ifdef TEST if (getImage -> format != 1 && getImage -> format != 2) { *logofs << name() << ": WARNING! Dirty value " << getImage -> format << " for field format.\n" << logofs_flush; } #endif getImage -> drawable = GetULONG(buffer + 4, bigEndian); getImage -> x = GetUINT(buffer + 8, bigEndian); getImage -> y = GetUINT(buffer + 10, bigEndian); getImage -> width = GetUINT(buffer + 12, bigEndian); getImage -> height = GetUINT(buffer + 14, bigEndian); getImage -> plane_mask = GetULONG(buffer + 16, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int GetImageStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { GetImageMessage *getImage = (GetImageMessage *) message; // // Fill all the message's fields. // *(buffer + 1) = getImage -> format; PutULONG(getImage -> drawable, buffer + 4, bigEndian); PutUINT(getImage -> x, buffer + 8, bigEndian); PutUINT(getImage -> y, buffer + 10, bigEndian); PutUINT(getImage -> width, buffer + 12, bigEndian); PutUINT(getImage -> height, buffer + 14, bigEndian); PutULONG(getImage -> plane_mask, buffer + 16, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void GetImageStore::dumpIdentity(const Message *message) const { #ifdef DUMP GetImageMessage *getImage = (GetImageMessage *) message; *logofs << name() << ": Identity format " << (unsigned) getImage -> format << ", drawable " << getImage -> drawable << ", x " << getImage -> x << ", y " << getImage -> y << ", width " << getImage -> width << ", height " << getImage -> height << ", plane_mask " << getImage -> plane_mask << ", size " << getImage -> size_ << ".\n" << logofs_flush; #endif } void GetImageStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { md5_append(md5_state_, buffer + 1, 1); md5_append(md5_state_, buffer + 8, 2); md5_append(md5_state_, buffer + 10, 2); md5_append(md5_state_, buffer + 12, 2); md5_append(md5_state_, buffer + 14, 2); md5_append(md5_state_, buffer + 16, 4); } void GetImageStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { GetImageMessage *getImage = (GetImageMessage *) message; GetImageMessage *cachedGetImage = (GetImageMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << getImage -> drawable << " as drawable field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(getImage -> drawable, clientCache -> drawableCache); cachedGetImage -> drawable = getImage -> drawable; } void GetImageStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { GetImageMessage *getImage = (GetImageMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); getImage -> drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << getImage -> drawable << " as drawable field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/GetImage.h0000644000000000000000000001241713614532331014242 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef GetImage_H #define GetImage_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define GETIMAGE_ENABLE_CACHE 1 #define GETIMAGE_ENABLE_DATA 0 #define GETIMAGE_ENABLE_SPLIT 0 #define GETIMAGE_ENABLE_COMPRESS 0 #define GETIMAGE_DATA_LIMIT 0 #define GETIMAGE_DATA_OFFSET 20 #define GETIMAGE_CACHE_SLOTS 200 #define GETIMAGE_CACHE_THRESHOLD 1 #define GETIMAGE_CACHE_LOWER_THRESHOLD 0 // // The message class. // class GetImageMessage : public Message { friend class GetImageStore; public: GetImageMessage() { } ~GetImageMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char format; unsigned int drawable; unsigned short int x; unsigned short int y; unsigned short int width; unsigned short int height; unsigned int plane_mask; }; class GetImageStore : public MessageStore { // // Constructors and destructors. // public: GetImageStore() : MessageStore() { enableCache = GETIMAGE_ENABLE_CACHE; enableData = GETIMAGE_ENABLE_DATA; enableSplit = GETIMAGE_ENABLE_SPLIT; enableCompress = GETIMAGE_ENABLE_COMPRESS; dataLimit = GETIMAGE_DATA_LIMIT; dataOffset = GETIMAGE_DATA_OFFSET; cacheSlots = GETIMAGE_CACHE_SLOTS; cacheThreshold = GETIMAGE_CACHE_THRESHOLD; cacheLowerThreshold = GETIMAGE_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~GetImageStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "GetImage"; } virtual unsigned char opcode() const { return X_GetImage; } virtual unsigned int storage() const { return sizeof(GetImageMessage); } // // Message handling methods. // public: virtual Message *create() const { return new GetImageMessage(); } virtual Message *create(const Message &message) const { return new GetImageMessage((const GetImageMessage &) message); } virtual void destroy(Message *message) const { delete (GetImageMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* GetImage_H */ nx-libs-3.5.99.23/nxcomp/src/GetImageReply.cpp0000644000000000000000000001361713614532331015614 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "GetImageReply.h" #include "ServerCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Constructors and destructors. // GetImageReplyStore::GetImageReplyStore(StaticCompressor *compressor) : MessageStore(compressor) { enableCache = GETIMAGEREPLY_ENABLE_CACHE; enableData = GETIMAGEREPLY_ENABLE_DATA; enableSplit = GETIMAGEREPLY_ENABLE_SPLIT; // Since ProtoStep7 (#issue 108) enableCompress = GETIMAGEREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; dataLimit = GETIMAGEREPLY_DATA_LIMIT; dataOffset = GETIMAGEREPLY_DATA_OFFSET; cacheSlots = GETIMAGEREPLY_CACHE_SLOTS; cacheThreshold = GETIMAGEREPLY_CACHE_THRESHOLD; cacheLowerThreshold = GETIMAGEREPLY_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } GetImageReplyStore::~GetImageReplyStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } // // Here are the methods to handle messages' content. // int GetImageReplyStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; // // Here is the fingerprint. // getImageReply -> depth = *(buffer + 1); getImageReply -> visual = GetULONG(buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } int GetImageReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; // // Fill all the message's fields. // *(buffer + 1) = getImageReply -> depth; PutULONG(getImageReply -> visual, buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } void GetImageReplyStore::dumpIdentity(const Message *message) const { #ifdef DUMP GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; *logofs << name() << ": Identity depth " << (unsigned) getImageReply -> depth << ", visual " << getImageReply -> visual << ", size " << getImageReply -> size_ << ".\n"; #endif } void GetImageReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { // // Field depth. // md5_append(md5_state_, buffer + 1, 1); } void GetImageReplyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { // // Encode the variant part. // GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; ServerCache *serverCache = (ServerCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << getImageReply -> visual << " as visual field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(getImageReply -> visual, 29, serverCache -> visualCache); } void GetImageReplyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { // // Decode the variant part. // GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; ServerCache *serverCache = (ServerCache *) channelCache; decodeBuffer.decodeCachedValue(getImageReply -> visual, 29, serverCache -> visualCache); } nx-libs-3.5.99.23/nxcomp/src/GetImageReply.h0000644000000000000000000001105013614532331015246 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef GetImageReply_H #define GetImageReply_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define GETIMAGEREPLY_ENABLE_CACHE 1 #define GETIMAGEREPLY_ENABLE_DATA 1 #define GETIMAGEREPLY_ENABLE_SPLIT 0 #define GETIMAGEREPLY_DATA_LIMIT 1048576 - 32 #define GETIMAGEREPLY_DATA_OFFSET 32 #define GETIMAGEREPLY_CACHE_SLOTS 1000 #define GETIMAGEREPLY_CACHE_THRESHOLD 20 #define GETIMAGEREPLY_CACHE_LOWER_THRESHOLD 2 #define GETIMAGEREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 // // The message class. // class GetImageReplyMessage : public Message { friend class GetImageReplyStore; public: GetImageReplyMessage() { } ~GetImageReplyMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char depth; unsigned int visual; }; class GetImageReplyStore : public MessageStore { public: GetImageReplyStore(StaticCompressor *compressor); virtual ~GetImageReplyStore(); virtual const char *name() const { return "GetImageReply"; } virtual unsigned char opcode() const { return X_GetImage; } virtual unsigned int storage() const { return sizeof(GetImageReplyMessage); } // // Message handling methods. // protected: virtual Message *create() const { return new GetImageReplyMessage(); } virtual Message *create(const Message &message) const { return new GetImageReplyMessage((const GetImageReplyMessage &) message); } virtual void destroy(Message *message) const { delete (GetImageReplyMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* GetImageReply_H */ nx-libs-3.5.99.23/nxcomp/src/GetProperty.cpp0000644000000000000000000001074413614532331015400 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "GetProperty.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int GetPropertyStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { GetPropertyMessage *getProperty = (GetPropertyMessage *) message; // // Here is the fingerprint. // getProperty -> property_delete = *(buffer + 1); getProperty -> window = GetULONG(buffer + 4, bigEndian); getProperty -> property = GetULONG(buffer + 8, bigEndian); getProperty -> type = GetULONG(buffer + 12, bigEndian); getProperty -> long_offset = GetULONG(buffer + 16, bigEndian); getProperty -> long_length = GetULONG(buffer + 20, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } int GetPropertyStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { GetPropertyMessage *getProperty = (GetPropertyMessage *) message; // // Fill all the message's fields. // *(buffer + 1) = getProperty -> property_delete; PutULONG(getProperty -> window, buffer + 4, bigEndian); PutULONG(getProperty -> property, buffer + 8, bigEndian); PutULONG(getProperty -> type, buffer + 12, bigEndian); PutULONG(getProperty -> long_offset, buffer + 16, bigEndian); PutULONG(getProperty -> long_length, buffer + 20, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } void GetPropertyStore::dumpIdentity(const Message *message) const { #ifdef DUMP GetPropertyMessage *getProperty = (GetPropertyMessage *) message; *logofs << name() << ": Identity property_delete " << (unsigned int) getProperty -> property_delete << ", window " << getProperty -> window << ", property " << getProperty -> property << ", type " << getProperty -> type << ", long-offset " << getProperty -> long_offset << ", long-length " << getProperty -> long_length << ".\n" << logofs_flush; #endif } void GetPropertyStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { md5_append(md5_state_, buffer + 1, 1); md5_append(md5_state_, buffer + 4, 20); } nx-libs-3.5.99.23/nxcomp/src/GetProperty.h0000644000000000000000000001175413614532331015047 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef GetProperty_H #define GetProperty_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define GETPROPERTY_ENABLE_CACHE 1 #define GETPROPERTY_ENABLE_DATA 0 #define GETPROPERTY_ENABLE_SPLIT 0 #define GETPROPERTY_ENABLE_COMPRESS 0 #define GETPROPERTY_DATA_LIMIT 0 #define GETPROPERTY_DATA_OFFSET 24 #define GETPROPERTY_CACHE_SLOTS 2000 #define GETPROPERTY_CACHE_THRESHOLD 2 #define GETPROPERTY_CACHE_LOWER_THRESHOLD 1 // // The message class. // class GetPropertyMessage : public Message { friend class GetPropertyStore; public: GetPropertyMessage() { } ~GetPropertyMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char property_delete; unsigned long window; unsigned long property; unsigned long type; unsigned long long_offset; unsigned long long_length; }; class GetPropertyStore : public MessageStore { // // Constructors and destructors. // public: GetPropertyStore() : MessageStore() { enableCache = GETPROPERTY_ENABLE_CACHE; enableData = GETPROPERTY_ENABLE_DATA; enableSplit = GETPROPERTY_ENABLE_SPLIT; enableCompress = GETPROPERTY_ENABLE_COMPRESS; dataLimit = GETPROPERTY_DATA_LIMIT; dataOffset = GETPROPERTY_DATA_OFFSET; cacheSlots = GETPROPERTY_CACHE_SLOTS; cacheThreshold = GETPROPERTY_CACHE_THRESHOLD; cacheLowerThreshold = GETPROPERTY_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~GetPropertyStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "GetProperty"; } virtual unsigned char opcode() const { return X_GetProperty; } virtual unsigned int storage() const { return sizeof(GetPropertyMessage); } // // Message handling methods. // protected: virtual Message *create() const { return new GetPropertyMessage(); } virtual Message *create(const Message &message) const { return new GetPropertyMessage((const GetPropertyMessage &) message); } virtual void destroy(Message *message) const { delete (GetPropertyMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* GetProperty_H */ nx-libs-3.5.99.23/nxcomp/src/GetPropertyReply.cpp0000644000000000000000000002152113614532331016407 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "GetPropertyReply.h" #include "ServerCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "WriteBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Constructors and destructors. // GetPropertyReplyStore::GetPropertyReplyStore(StaticCompressor *compressor) : MessageStore(compressor) { enableCache = GETPROPERTYREPLY_ENABLE_CACHE; enableData = GETPROPERTYREPLY_ENABLE_DATA; enableSplit = GETPROPERTYREPLY_ENABLE_SPLIT; // Since ProtoStep7 (#issue 108) enableCompress = GETPROPERTYREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; dataLimit = GETPROPERTYREPLY_DATA_LIMIT; dataOffset = GETPROPERTYREPLY_DATA_OFFSET; cacheSlots = GETPROPERTYREPLY_CACHE_SLOTS; cacheThreshold = GETPROPERTYREPLY_CACHE_THRESHOLD; cacheLowerThreshold = GETPROPERTYREPLY_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } GetPropertyReplyStore::~GetPropertyReplyStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } // // Here are the methods to handle messages' content. // int GetPropertyReplyStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const { ServerCache *serverCache = (ServerCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; #endif unsigned char format = (unsigned int) *(buffer + 1); encodeBuffer.encodeCachedValue(format, 8, serverCache -> getPropertyFormatCache); unsigned int numBytes = GetULONG(buffer + 16, bigEndian); encodeBuffer.encodeValue(numBytes, 32, 9); if (format == 16) { numBytes <<= 1; } else if (format == 32) { numBytes <<= 2; } encodeBuffer.encodeCachedValue(GetULONG(buffer + 8, bigEndian), 29, serverCache -> getPropertyTypeCache, 9); encodeBuffer.encodeValue(GetULONG(buffer + 12, bigEndian), 32, 9); #ifdef DEBUG *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; #endif return 1; } int GetPropertyReplyStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const { ServerCache *serverCache = (ServerCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; #endif unsigned char format; decodeBuffer.decodeCachedValue(format, 8, serverCache -> getPropertyFormatCache); unsigned int length; decodeBuffer.decodeValue(length, 32, 9); unsigned int numBytes = length; if (format == 16) { numBytes <<= 1; } else if (format == 32) { numBytes <<= 2; } size = 32 + RoundUp4(numBytes); buffer = writeBuffer -> addMessage(size); *(buffer + 1) = format; PutULONG(length, buffer + 16, bigEndian); unsigned int value; decodeBuffer.decodeCachedValue(value, 29, serverCache -> getPropertyTypeCache, 9); PutULONG(value, buffer + 8, bigEndian); decodeBuffer.decodeValue(value, 32, 9); PutULONG(value, buffer + 12, bigEndian); #ifdef DEBUG *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; #endif return 1; } int GetPropertyReplyStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { GetPropertyReplyMessage *getPropertyReply = (GetPropertyReplyMessage *) message; getPropertyReply -> format = *(buffer + 1); getPropertyReply -> type = GetULONG(buffer + 8, bigEndian); getPropertyReply -> after = GetULONG(buffer + 12, bigEndian); getPropertyReply -> items = GetULONG(buffer + 16, bigEndian); // // Cleanup the padding bytes. // unsigned int uiLengthInBytes; unsigned int uiFormat; if ((int) size > GETPROPERTYREPLY_DATA_OFFSET) { uiLengthInBytes = getPropertyReply -> items; uiFormat = *(buffer + 1); #ifdef DEBUG *logofs << name() << ": length " << uiLengthInBytes << ", format " << uiFormat << ", size " << size << ".\n" << logofs_flush; #endif if (uiFormat == 16) { uiLengthInBytes <<= 1; } else if (uiFormat == 32) { uiLengthInBytes <<= 2; } unsigned char *end = ((unsigned char *) buffer) + size; unsigned char *pad = ((unsigned char *) buffer) + GETPROPERTYREPLY_DATA_OFFSET + uiLengthInBytes; CleanData((unsigned char *) pad, end - pad); } #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } int GetPropertyReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { GetPropertyReplyMessage *getPropertyReply = (GetPropertyReplyMessage *) message; *(buffer + 1) = getPropertyReply -> format; PutULONG(getPropertyReply -> type, buffer + 8, bigEndian); PutULONG(getPropertyReply -> after, buffer + 12, bigEndian); PutULONG(getPropertyReply -> items, buffer + 16, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } void GetPropertyReplyStore::dumpIdentity(const Message *message) const { #ifdef DUMP GetPropertyReplyMessage *getPropertyReply = (GetPropertyReplyMessage *) message; *logofs << name() << ": Identity format " << (unsigned) getPropertyReply -> format << ", type " << getPropertyReply -> type << ", after " << getPropertyReply -> after << ", items " << getPropertyReply -> items << ", size " << getPropertyReply -> size_ << ".\n"; #endif } void GetPropertyReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { // // Fields format, type, after, items. // md5_append(md5_state_, buffer + 1, 1); md5_append(md5_state_, buffer + 8, 12); } void GetPropertyReplyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { } void GetPropertyReplyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { } nx-libs-3.5.99.23/nxcomp/src/GetPropertyReply.h0000644000000000000000000001220113614532331016047 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef GetPropertyReply_H #define GetPropertyReply_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define GETPROPERTYREPLY_ENABLE_CACHE 1 #define GETPROPERTYREPLY_ENABLE_DATA 1 #define GETPROPERTYREPLY_ENABLE_SPLIT 0 #define GETPROPERTYREPLY_DATA_LIMIT 1048576 - 32 #define GETPROPERTYREPLY_DATA_OFFSET 32 #define GETPROPERTYREPLY_CACHE_SLOTS 400 #define GETPROPERTYREPLY_CACHE_THRESHOLD 5 #define GETPROPERTYREPLY_CACHE_LOWER_THRESHOLD 1 #define GETPROPERTYREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 // // The message class. // class GetPropertyReplyMessage : public Message { friend class GetPropertyReplyStore; public: GetPropertyReplyMessage() { } ~GetPropertyReplyMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char format; unsigned int type; unsigned int after; unsigned int items; }; class GetPropertyReplyStore : public MessageStore { public: GetPropertyReplyStore(StaticCompressor *compressor); virtual ~GetPropertyReplyStore(); virtual const char *name() const { return "GetPropertyReply"; } virtual unsigned char opcode() const { return X_GetProperty; } virtual unsigned int storage() const { return sizeof(GetPropertyReplyMessage); } // // Message handling methods. // protected: virtual Message *create() const { return new GetPropertyReplyMessage(); } virtual Message *create(const Message &message) const { return new GetPropertyReplyMessage((const GetPropertyReplyMessage &) message); } virtual void destroy(Message *message) const { delete (GetPropertyReplyMessage *) message; } virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const; virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* GetPropertyReply_H */ nx-libs-3.5.99.23/nxcomp/src/ImageText16.cpp0000644000000000000000000001672013614532331015152 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ImageText16.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int ImageText16Store::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { ImageText16Message *imageText16 = (ImageText16Message *) message; // // Here is the fingerprint. // imageText16 -> len = *(buffer + 1); imageText16 -> drawable = GetULONG(buffer + 4, bigEndian); imageText16 -> gcontext = GetULONG(buffer + 8, bigEndian); imageText16 -> x = GetUINT(buffer + 12, bigEndian); imageText16 -> y = GetUINT(buffer + 14, bigEndian); if ((int) size > dataOffset) { int pad = (size - dataOffset) - (imageText16 -> len * 2); if (pad > 0) { CleanData((unsigned char *) buffer + size - pad, pad); } } #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int ImageText16Store::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { ImageText16Message *imageText16 = (ImageText16Message *) message; // // Fill all the message's fields. // *(buffer + 1) = imageText16 -> len; PutULONG(imageText16 -> drawable, buffer + 4, bigEndian); PutULONG(imageText16 -> gcontext, buffer + 8, bigEndian); PutUINT(imageText16 -> x, buffer + 12, bigEndian); PutUINT(imageText16 -> y, buffer + 14, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void ImageText16Store::dumpIdentity(const Message *message) const { #ifdef DUMP ImageText16Message *imageText16 = (ImageText16Message *) message; *logofs << name() << ": Identity len " << (unsigned int) imageText16 -> len << " drawable " << imageText16 -> drawable << ", gcontext " << imageText16 -> gcontext << ", x " << imageText16 -> x << ", y " << imageText16 -> y << ", size " << imageText16 -> size_ << ".\n"; #endif } void ImageText16Store::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { md5_append(md5_state_, buffer + 1, 1); } void ImageText16Store::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { ImageText16Message *imageText16 = (ImageText16Message *) message; ImageText16Message *cachedImageText16 = (ImageText16Message *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << imageText16 -> drawable << " as " << "drawable" << " field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(imageText16 -> drawable, clientCache -> drawableCache); cachedImageText16 -> drawable = imageText16 -> drawable; #ifdef TEST *logofs << name() << ": Encoding value " << imageText16 -> gcontext << " as " << "gcontext" << " field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(imageText16 -> gcontext, clientCache -> gcCache); cachedImageText16 -> gcontext = imageText16 -> gcontext; #ifdef TEST *logofs << name() << ": Encoding value " << imageText16 -> x << " as " << "x" << " field.\n" << logofs_flush; #endif unsigned short int diff_x = imageText16 -> x - cachedImageText16 -> x; encodeBuffer.encodeCachedValue(diff_x, 16, clientCache -> imageTextCacheX); cachedImageText16 -> x = imageText16 -> x; #ifdef TEST *logofs << name() << ": Encoding value " << imageText16 -> y << " as " << "y" << " field.\n" << logofs_flush; #endif unsigned short int diff_y = imageText16 -> y - cachedImageText16 -> y; encodeBuffer.encodeCachedValue(diff_y, 16, clientCache -> imageTextCacheY); cachedImageText16 -> y = imageText16 -> y; } void ImageText16Store::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { ImageText16Message *imageText16 = (ImageText16Message *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); imageText16 -> drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << imageText16 -> drawable << " as " << "drawable" << " field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> gcCache); imageText16 -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << imageText16 -> gcontext << " as gcontext field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, clientCache -> imageTextCacheX); imageText16 -> x += value; imageText16 -> x &= 0xffff; #ifdef DEBUG *logofs << name() << ": Decoded value " << imageText16 -> x << " as x field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, clientCache -> imageTextCacheY); imageText16 -> y += value; imageText16 -> y &= 0xffff; #ifdef DEBUG *logofs << name() << ": Decoded value " << imageText16 -> y << " as y field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/ImageText16.h0000644000000000000000000001241113614532331014610 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ImageText16_H #define ImageText16_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define IMAGETEXT16_ENABLE_CACHE 1 #define IMAGETEXT16_ENABLE_DATA 0 #define IMAGETEXT16_ENABLE_SPLIT 0 #define IMAGETEXT16_ENABLE_COMPRESS 0 #define IMAGETEXT16_DATA_LIMIT 512 #define IMAGETEXT16_DATA_OFFSET 16 #define IMAGETEXT16_CACHE_SLOTS 3000 #define IMAGETEXT16_CACHE_THRESHOLD 5 #define IMAGETEXT16_CACHE_LOWER_THRESHOLD 1 // // The message class. // class ImageText16Message : public Message { friend class ImageText16Store; public: ImageText16Message() { } ~ImageText16Message() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char len; unsigned int drawable; unsigned int gcontext; unsigned short x; unsigned short y; }; class ImageText16Store : public MessageStore { // // Constructors and destructors. // public: ImageText16Store() : MessageStore() { enableCache = IMAGETEXT16_ENABLE_CACHE; enableData = IMAGETEXT16_ENABLE_DATA; enableSplit = IMAGETEXT16_ENABLE_SPLIT; enableCompress = IMAGETEXT16_ENABLE_COMPRESS; dataLimit = IMAGETEXT16_DATA_LIMIT; dataOffset = IMAGETEXT16_DATA_OFFSET; cacheSlots = IMAGETEXT16_CACHE_SLOTS; cacheThreshold = IMAGETEXT16_CACHE_THRESHOLD; cacheLowerThreshold = IMAGETEXT16_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~ImageText16Store() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "ImageText16"; } virtual unsigned char opcode() const { return X_ImageText16; } virtual unsigned int storage() const { return sizeof(ImageText16Message); } // // Message handling methods. // public: virtual Message *create() const { return new ImageText16Message(); } virtual Message *create(const Message &message) const { return new ImageText16Message((const ImageText16Message &) message); } virtual void destroy(Message *message) const { delete (ImageText16Message *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* ImageText16_H */ nx-libs-3.5.99.23/nxcomp/src/ImageText8.cpp0000644000000000000000000001660413614532331015074 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ImageText8.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int ImageText8Store::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { ImageText8Message *imageText8 = (ImageText8Message *) message; // // Here is the fingerprint. // imageText8 -> len = *(buffer + 1); imageText8 -> drawable = GetULONG(buffer + 4, bigEndian); imageText8 -> gcontext = GetULONG(buffer + 8, bigEndian); imageText8 -> x = GetUINT(buffer + 12, bigEndian); imageText8 -> y = GetUINT(buffer + 14, bigEndian); if ((int) size > dataOffset) { int pad = (size - dataOffset) - imageText8 -> len; if (pad > 0) { CleanData((unsigned char *) buffer + size - pad, pad); } } #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int ImageText8Store::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { ImageText8Message *imageText8 = (ImageText8Message *) message; // // Fill all the message's fields. // *(buffer + 1) = imageText8 -> len; PutULONG(imageText8 -> drawable, buffer + 4, bigEndian); PutULONG(imageText8 -> gcontext, buffer + 8, bigEndian); PutUINT(imageText8 -> x, buffer + 12, bigEndian); PutUINT(imageText8 -> y, buffer + 14, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void ImageText8Store::dumpIdentity(const Message *message) const { #ifdef DUMP ImageText8Message *imageText8 = (ImageText8Message *) message; *logofs << name() << ": Identity len " << (unsigned int) imageText8 -> len << " drawable " << imageText8 -> drawable << ", gcontext " << imageText8 -> gcontext << ", x " << imageText8 -> x << ", y " << imageText8 -> y << ", size " << imageText8 -> size_ << ".\n"; #endif } void ImageText8Store::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { md5_append(md5_state_, buffer + 1, 1); } void ImageText8Store::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { ImageText8Message *imageText8 = (ImageText8Message *) message; ImageText8Message *cachedImageText8 = (ImageText8Message *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << imageText8 -> drawable << " as " << "drawable" << " field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(imageText8 -> drawable, clientCache -> drawableCache); cachedImageText8 -> drawable = imageText8 -> drawable; #ifdef TEST *logofs << name() << ": Encoding value " << imageText8 -> gcontext << " as " << "gcontext" << " field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(imageText8 -> gcontext, clientCache -> gcCache); cachedImageText8 -> gcontext = imageText8 -> gcontext; #ifdef TEST *logofs << name() << ": Encoding value " << imageText8 -> x << " as " << "x" << " field.\n" << logofs_flush; #endif unsigned short int diff_x = imageText8 -> x - cachedImageText8 -> x; encodeBuffer.encodeCachedValue(diff_x, 16, clientCache -> imageTextCacheX); cachedImageText8 -> x = imageText8 -> x; #ifdef TEST *logofs << name() << ": Encoding value " << imageText8 -> y << " as " << "y" << " field.\n" << logofs_flush; #endif unsigned short int diff_y = imageText8 -> y - cachedImageText8 -> y; encodeBuffer.encodeCachedValue(diff_y, 16, clientCache -> imageTextCacheY); cachedImageText8 -> y = imageText8 -> y; } void ImageText8Store::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { ImageText8Message *imageText8 = (ImageText8Message *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); imageText8 -> drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << imageText8 -> drawable << " as " << "drawable" << " field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> gcCache); imageText8 -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << imageText8 -> gcontext << " as gcontext field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, clientCache -> imageTextCacheX); imageText8 -> x += value; imageText8 -> x &= 0xffff; #ifdef DEBUG *logofs << name() << ": Decoded value " << imageText8 -> x << " as x field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, clientCache -> imageTextCacheY); imageText8 -> y += value; imageText8 -> y &= 0xffff; #ifdef DEBUG *logofs << name() << ": Decoded value " << imageText8 -> y << " as y field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/ImageText8.h0000644000000000000000000001237213614532331014537 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ImageText8_H #define ImageText8_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define IMAGETEXT8_ENABLE_CACHE 1 #define IMAGETEXT8_ENABLE_DATA 0 #define IMAGETEXT8_ENABLE_SPLIT 0 #define IMAGETEXT8_ENABLE_COMPRESS 0 #define IMAGETEXT8_DATA_LIMIT 256 #define IMAGETEXT8_DATA_OFFSET 16 #define IMAGETEXT8_CACHE_SLOTS 3000 #define IMAGETEXT8_CACHE_THRESHOLD 5 #define IMAGETEXT8_CACHE_LOWER_THRESHOLD 1 // // The message class. // class ImageText8Message : public Message { friend class ImageText8Store; public: ImageText8Message() { } ~ImageText8Message() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char len; unsigned int drawable; unsigned int gcontext; unsigned short x; unsigned short y; }; class ImageText8Store : public MessageStore { // // Constructors and destructors. // public: ImageText8Store() : MessageStore() { enableCache = IMAGETEXT8_ENABLE_CACHE; enableData = IMAGETEXT8_ENABLE_DATA; enableSplit = IMAGETEXT8_ENABLE_SPLIT; enableCompress = IMAGETEXT8_ENABLE_COMPRESS; dataLimit = IMAGETEXT8_DATA_LIMIT; dataOffset = IMAGETEXT8_DATA_OFFSET; cacheSlots = IMAGETEXT8_CACHE_SLOTS; cacheThreshold = IMAGETEXT8_CACHE_THRESHOLD; cacheLowerThreshold = IMAGETEXT8_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~ImageText8Store() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "ImageText8"; } virtual unsigned char opcode() const { return X_ImageText8; } virtual unsigned int storage() const { return sizeof(ImageText8Message); } // // Message handling methods. // public: virtual Message *create() const { return new ImageText8Message(); } virtual Message *create(const Message &message) const { return new ImageText8Message((const ImageText8Message &) message); } virtual void destroy(Message *message) const { delete (ImageText8Message *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* ImageText8_H */ nx-libs-3.5.99.23/nxcomp/src/IntCache.cpp0000644000000000000000000001360413614532331014570 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "Misc.h" #include "IntCache.h" #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP IntCache::IntCache(unsigned int size) : size_(size), length_(0), buffer_(new unsigned int[size]), lastDiff_(0), lastValueInserted_(0), predictedBlockSize_(0) { } int IntCache::lookup(unsigned int &value, unsigned int &index, unsigned int mask, unsigned int &sameDiff) { for (unsigned int i = 0; i < length_; i++) { if (value == buffer_[i]) { index = i; if (i) { unsigned int target = (i >> 1); do { buffer_[i] = buffer_[i - 1]; i--; } while (i > target); buffer_[target] = value; } return 1; } } unsigned int insertionPoint; if (2 >= length_) insertionPoint = length_; else insertionPoint = 2; unsigned int start; if (length_ >= size_) start = size_ - 1; else { start = length_; length_++; } for (unsigned int k = start; k > insertionPoint; k--) buffer_[k] = buffer_[k - 1]; buffer_[insertionPoint] = value; unsigned int diff = value - lastValueInserted_; lastValueInserted_ = (value & mask); value = (diff & mask); sameDiff = (value == lastDiff_); if (!sameDiff) { lastDiff_ = value; unsigned int lastChangeIndex = 0; unsigned int lastBitIsOne = (lastDiff_ & 0x1); unsigned int j = 1; for (unsigned int nextMask = 0x2; nextMask & mask; nextMask <<= 1) { unsigned int nextBitIsOne = (lastDiff_ & nextMask); if (nextBitIsOne) { if (!lastBitIsOne) { lastChangeIndex = j; lastBitIsOne = nextBitIsOne; } } else { if (lastBitIsOne) { lastChangeIndex = j; lastBitIsOne = nextBitIsOne; } } j++; } predictedBlockSize_ = lastChangeIndex + 1; if (predictedBlockSize_ < 2) predictedBlockSize_ = 2; } return 0; } void IntCache::insert(unsigned int &value, unsigned int mask) { unsigned int insertionPoint; if (2 >= length_) insertionPoint = length_; else insertionPoint = 2; unsigned int start; if (length_ >= size_) start = size_ - 1; else { start = length_; length_++; } for (unsigned int k = start; k > insertionPoint; k--) buffer_[k] = buffer_[k - 1]; if (lastDiff_ != value) { lastDiff_ = value; unsigned int lastChangeIndex = 0; unsigned int lastBitIsOne = (lastDiff_ & 0x1); unsigned int j = 1; for (unsigned int nextMask = 0x2; nextMask & mask; nextMask <<= 1) { unsigned int nextBitIsOne = (lastDiff_ & nextMask); if (nextBitIsOne) { if (!lastBitIsOne) { lastChangeIndex = j; lastBitIsOne = nextBitIsOne; } } else { if (lastBitIsOne) { lastChangeIndex = j; lastBitIsOne = nextBitIsOne; } } j++; } predictedBlockSize_ = lastChangeIndex + 1; if (predictedBlockSize_ < 2) predictedBlockSize_ = 2; } lastValueInserted_ += value; lastValueInserted_ &= mask; buffer_[insertionPoint] = lastValueInserted_; value = lastValueInserted_; } void IntCache::push(unsigned int &value, unsigned int mask) { // // Using a memmove() appears to be slower. // // memmove((char *) &buffer_[1], (char *) &buffer_[0], // sizeof(unsigned int) * (size_ - 1)); // // if (length_ < size_) // { // length_++; // } // unsigned int start; if (length_ >= size_) { start = size_ - 1; } else { start = length_; length_++; } for (unsigned int k = start; k > 0; k--) { buffer_[k] = buffer_[k - 1]; } value &= mask; buffer_[0] = value; } void IntCache::dump() { #ifdef DUMP *logofs << "IntCache: Dumping content of cache at " << (void *) this << ":\n" << logofs_flush; for (unsigned int i = 0; i < length_; i++) { *logofs << "IntCache: [" << i << "][" << buffer_[i] << "]\n"; } #endif } nx-libs-3.5.99.23/nxcomp/src/IntCache.h0000644000000000000000000000671213614532331014237 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef IntCache_H #define IntCache_H class IntCache { public: IntCache(unsigned int size); ~IntCache() { delete [] buffer_; } unsigned int getSize() const { return length_; } int lookup(unsigned int &value, unsigned int &index, unsigned int mask, unsigned int &sameDiff); // // This can be inlined as it is only // called by decodeCachedValue(). // unsigned int get(unsigned int index) { unsigned int result = buffer_[index]; if (index != 0) { // // Using a memmove() appears to be slower. // // unsigned int target = index >> 1; // // memmove((char *) &buffer_[target + 1], (char *) &buffer_[target], // sizeof(unsigned int) * (index - target)); // // buffer_[target] = result; // unsigned int i = index; unsigned int target = (i >> 1); do { buffer_[i] = buffer_[i - 1]; i--; } while (i > target); buffer_[target] = result; } return result; } void insert(unsigned int &value, unsigned int mask); void push(unsigned int &value, unsigned int mask); void dump(); unsigned int getLastDiff(unsigned int mask) const { return lastDiff_; } unsigned int getBlockSize(unsigned int bits) const { if (bits > 0) { return (predictedBlockSize_ < bits ? predictedBlockSize_ : bits); } return predictedBlockSize_; } private: unsigned int size_; unsigned int length_; unsigned int *buffer_; unsigned int lastDiff_; unsigned int lastValueInserted_; unsigned int predictedBlockSize_; }; #endif /* IntCache_H */ nx-libs-3.5.99.23/nxcomp/src/InternAtom.cpp0000644000000000000000000001034513614532331015171 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "InternAtom.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int InternAtomStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { InternAtomMessage *internAtom = (InternAtomMessage *) message; // // Here is the fingerprint. // internAtom -> only_if_exists = *(buffer + 1); internAtom -> name_length = GetUINT(buffer + 4, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; #endif // // Clean up padding bytes. // if ((int) size > dataOffset) { unsigned char *end = ((unsigned char *) buffer) + size; for (unsigned char *pad = ((unsigned char *) buffer) + 8 + internAtom -> name_length; pad < end; pad++) { *pad = 0; } } return 1; } int InternAtomStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { InternAtomMessage *internAtom = (InternAtomMessage *) message; // // Fill all the message's fields. // *(buffer + 1) = internAtom -> only_if_exists; PutUINT(internAtom -> name_length, buffer + 4, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } void InternAtomStore::dumpIdentity(const Message *message) const { #ifdef DUMP InternAtomMessage *internAtom = (InternAtomMessage *) message; *logofs << name() << ": Identity only_if_exists " << (unsigned int) internAtom -> only_if_exists << ", name_length " << internAtom -> name_length << ", name '"; for (int i = 0; i < internAtom -> name_length; i++) { *logofs << internAtom -> data_[i]; } *logofs << "'.\n" << logofs_flush; #endif } void InternAtomStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { md5_append(md5_state_, buffer + 1, 1); md5_append(md5_state_, buffer + 4, 2); } nx-libs-3.5.99.23/nxcomp/src/InternAtom.h0000644000000000000000000001153613614532331014641 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef InternAtom_H #define InternAtom_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define INTERNATOM_ENABLE_CACHE 1 #define INTERNATOM_ENABLE_DATA 0 #define INTERNATOM_ENABLE_SPLIT 0 #define INTERNATOM_ENABLE_COMPRESS 0 #define INTERNATOM_DATA_LIMIT 80 #define INTERNATOM_DATA_OFFSET 8 #define INTERNATOM_CACHE_SLOTS 2000 #define INTERNATOM_CACHE_THRESHOLD 2 #define INTERNATOM_CACHE_LOWER_THRESHOLD 1 // // The message class. // class InternAtomMessage : public Message { friend class InternAtomStore; public: InternAtomMessage() { } ~InternAtomMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char only_if_exists; unsigned short name_length; }; class InternAtomStore : public MessageStore { // // Constructors and destructors. // public: InternAtomStore() : MessageStore() { enableCache = INTERNATOM_ENABLE_CACHE; enableData = INTERNATOM_ENABLE_DATA; enableSplit = INTERNATOM_ENABLE_SPLIT; enableCompress = INTERNATOM_ENABLE_COMPRESS; dataLimit = INTERNATOM_DATA_LIMIT; dataOffset = INTERNATOM_DATA_OFFSET; cacheSlots = INTERNATOM_CACHE_SLOTS; cacheThreshold = INTERNATOM_CACHE_THRESHOLD; cacheLowerThreshold = INTERNATOM_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~InternAtomStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "InternAtom"; } virtual unsigned char opcode() const { return X_InternAtom; } virtual unsigned int storage() const { return sizeof(InternAtomMessage); } // // Message handling methods. // protected: virtual Message *create() const { return new InternAtomMessage(); } virtual Message *create(const Message &message) const { return new InternAtomMessage((const InternAtomMessage &) message); } virtual void destroy(Message *message) const { delete (InternAtomMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* InternAtom_H */ nx-libs-3.5.99.23/nxcomp/src/Jpeg.cpp0000644000000000000000000005100513614532331013774 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #ifdef ANDROID #include #endif #include #include #include #ifdef __cplusplus extern "C" { #include #include } #else #include #include #endif #include "Misc.h" #include "Jpeg.h" #include "Unpack.h" #define PANIC #define WARNING #undef TEST #undef DEBUG #define RGB24_TO_PIXEL(bpp,r,g,b) \ ((((CARD##bpp)(r) & 0xff) * srcRedMax + 127) / 255 \ << srcRedShift | \ (((CARD##bpp)(g) & 0xff) * srcGreenMax + 127) / 255 \ << srcGreenShift | \ (((CARD##bpp)(b) & 0xff) * srcBlueMax + 127) / 255 \ << srcBlueShift) #define RGB24_TO_PIXEL32(r,g,b) \ (((CARD32)(r) & 0xff) << srcRedShift | \ ((CARD32)(g) & 0xff) << srcGreenShift | \ ((CARD32)(b) & 0xff) << srcBlueShift) // // Functions from Unpack.cpp // extern int Unpack32To32(const T_colormask *colormask, const unsigned int *data, unsigned int *out, unsigned int *end); extern int Unpack24To24(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); extern int Unpack16To16(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); // // Local functions used for the jpeg decompression. // static void JpegSetSrcManager(j_decompress_ptr cinfo, CARD8 *compressedData, int compressedLen); static void JpegInitSource(j_decompress_ptr cinfo); static void JpegTermSource(j_decompress_ptr cinfo); static void JpegSkipInputData(j_decompress_ptr cinfo, long num_bytes); static boolean JpegFillInputBuffer(j_decompress_ptr cinfo); static int DecompressJpeg16(unsigned char *compressedData, int compressedLen, unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder); static int DecompressJpeg24(unsigned char *compressedData, int compressedLen, unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder); static int DecompressJpeg32(unsigned char *compressedData, int compressedLen, unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder); void UnpackJpegErrorHandler(j_common_ptr cinfo) __attribute__((noreturn)); // // Colormap stuff. // CARD16 srcRedMax, srcGreenMax, srcBlueMax; CARD8 srcRedShift, srcGreenShift, srcBlueShift; // // Error handler. // static bool jpegError; jmp_buf UnpackJpegContext; void UnpackJpegErrorHandler(j_common_ptr cinfo) { #ifdef PANIC *logofs << "UnpackJpegErrorHandler: PANIC! Detected error in JPEG decompression.\n" << logofs_flush; *logofs << "UnpackJpegErrorHandler: PANIC! Trying to revert to the previous context.\n" << logofs_flush; #endif jpegError = 1; longjmp(UnpackJpegContext, 1); } // // Attributes used for the jpeg decompression. // static struct jpeg_source_mgr jpegSrcManager; static JOCTET *jpegBufferPtr; static size_t jpegBufferLen; static char *tmpBuf; static int tmpBufSize = 0; int UnpackJpeg(T_geometry *geometry, unsigned char method, unsigned char *srcData, int srcSize, int dstBpp, int dstWidth, int dstHeight, unsigned char *dstData, int dstSize) { int byteOrder = geometry -> image_byte_order; // // Check if data is coming from a failed unsplit. // if (srcSize < 2 || (srcData[0] == SPLIT_PATTERN && srcData[1] == SPLIT_PATTERN)) { #ifdef WARNING *logofs << "UnpackJpeg: WARNING! Skipping unpack of dummy data.\n" << logofs_flush; #endif return -1; } #ifdef DEBUG *logofs << "UnpackJpeg: Decompression. Source size " << srcSize << " bits per plane " << dstBpp << ".\n" << logofs_flush; #endif srcRedShift = ffs(geometry -> red_mask) - 1; srcGreenShift = ffs(geometry -> green_mask) - 1; srcBlueShift = ffs(geometry -> blue_mask) - 1; #ifdef DEBUG *logofs << "UnpackJpeg: Red shift " << (int) srcRedShift << " green shift " << (int) srcGreenShift << " blue shift " << (int) srcBlueShift << ".\n" << logofs_flush; #endif srcRedMax = geometry -> red_mask >> srcRedShift; srcGreenMax = geometry -> green_mask >> srcGreenShift; srcBlueMax = geometry -> blue_mask >> srcBlueShift; #ifdef DEBUG *logofs << "UnpackJpeg: Red mask " << (void *) geometry -> red_mask << " green mask " << (void *) geometry -> green_mask << " blue mask " << (void *) geometry -> blue_mask << ".\n" << logofs_flush; #endif #ifdef DEBUG *logofs << "UnpackJpeg: Red max " << srcRedMax << " green max " << srcGreenMax << " blue max " << srcBlueMax << ".\n" << logofs_flush; #endif // // Make enough space in the temporary // buffer to have one complete row of // the image with 3 bytes for a pixel. // tmpBufSize = dstWidth * 3; tmpBuf = new char[tmpBufSize]; if (tmpBuf == NULL) { #ifdef PANIC *logofs << "UnpackJpeg: PANIC! Cannot allocate " << dstWidth * 3 << " bytes for Jpeg " << "decompressed data.\n" << logofs_flush; #endif delete [] tmpBuf; return -1; } int result = 1; switch(dstBpp) { case 8: { // // Simply move the data from srcData to dstData // taking into consideration the correct padding. // int row; unsigned char * dstBuff = dstData; unsigned char * srcBuff = srcData; for (row = 0; row < dstHeight; row++) { memcpy(dstBuff, srcBuff, dstWidth); dstBuff += RoundUp4(dstWidth); srcBuff += dstWidth; } break; } case 16: { result = DecompressJpeg16(srcData, srcSize, dstWidth, dstHeight, dstData, byteOrder); break; } case 24: { result = DecompressJpeg24(srcData, srcSize, dstWidth, dstHeight, dstData, byteOrder); break; } case 32: { result = DecompressJpeg32(srcData, srcSize, dstWidth, dstHeight, dstData, byteOrder); break; } default: { #ifdef PANIC *logofs << "UnpackJpeg: PANIC! Failed to decode Jpeg image. " << " Unsupported Bpp value " << dstBpp << " for the Jpeg compression" << ".\n" << logofs_flush; #endif delete [] tmpBuf; result = -1; } } #ifdef DEBUG *logofs << "UnpackJpeg: Decompression finished with result " << result << ".\n" << logofs_flush; #endif if (result == -1) { delete [] tmpBuf; #ifdef PANIC *logofs << "UnpackJpeg: PANIC! Failed to decode Jpeg image using " << dstBpp << " Bpp destination.\n" << logofs_flush; #endif return result; } // // Apply the correction for the brightness. // int maskMethod; switch(method) { case PACK_JPEG_8_COLORS: { maskMethod = MASK_8_COLORS; break; } case PACK_JPEG_64_COLORS: { maskMethod = MASK_64_COLORS; break; } case PACK_JPEG_256_COLORS: { maskMethod = MASK_256_COLORS; break; } case PACK_JPEG_512_COLORS: { maskMethod = MASK_512_COLORS; break; } case PACK_JPEG_4K_COLORS: { maskMethod = MASK_4K_COLORS; break; } case PACK_JPEG_32K_COLORS: { maskMethod = MASK_32K_COLORS; break; } case PACK_JPEG_64K_COLORS: { maskMethod = MASK_64K_COLORS; break; } case PACK_JPEG_256K_COLORS: { maskMethod = MASK_256K_COLORS; break; } case PACK_JPEG_2M_COLORS: { maskMethod = MASK_2M_COLORS; break; } case PACK_JPEG_16M_COLORS: { maskMethod = MASK_16M_COLORS; break; } default: { delete [] tmpBuf; return -1; } } const T_colormask *colorMask = MethodColorMask(maskMethod); unsigned char *dstBuff = dstData; switch (dstBpp) { case 16: { Unpack16To16(colorMask, dstBuff, dstBuff, dstBuff + dstSize); break; } case 24: { break; } case 32: { Unpack32To32(colorMask, (unsigned int *) dstBuff, (unsigned int *) dstBuff, (unsigned int *) (dstBuff + dstSize)); break; } default: { delete [] tmpBuf; return -1; } } delete [] tmpBuf; return 1; } // // Functions that actually do the Jpeg decompression. // int DecompressJpeg16(unsigned char *compressedData, int compressedLen, unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) { struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; unsigned char *data; JSAMPROW rowPointer[1]; unsigned int dx = 0; unsigned int dy = 0; #ifdef DEBUG *logofs << "DecompressJpeg16: Decompressing with length " << compressedLen << " width " << w << " height " << h << ".\n" << logofs_flush; #endif jpegError = 0; cinfo.err = jpeg_std_error(&jerr); jerr.error_exit = UnpackJpegErrorHandler; if (setjmp(UnpackJpegContext) == 1) { #ifdef TEST *logofs << "DecompressJpeg16: Out of the long jump with error '" << jpegError << "'.\n" << logofs_flush; #endif goto AbortDecompressJpeg16; } jpeg_create_decompress(&cinfo); if (jpegError) goto AbortDecompressJpeg16; JpegSetSrcManager(&cinfo, compressedData, compressedLen); jpeg_read_header(&cinfo, TRUE); if (jpegError) goto AbortDecompressJpeg16; cinfo.out_color_space = JCS_RGB; jpeg_start_decompress(&cinfo); if (jpegError) goto AbortDecompressJpeg16; if (cinfo.output_width != w || cinfo.output_height != h || cinfo.output_components != 3) { #ifdef PANIC *logofs << "DecompressJpeg16: PANIC! Wrong JPEG data received.\n" << logofs_flush; #endif jpeg_destroy_decompress(&cinfo); return -1; } // // PixelPtr points to dstBuf which is // already padded correctly for the final // image to put // data = dstBuf; rowPointer[0] = (JSAMPROW) tmpBuf; unsigned long pixel; while (cinfo.output_scanline < cinfo.output_height) { jpeg_read_scanlines(&cinfo, rowPointer, 1); if (jpegError) goto AbortDecompressJpeg16; for (dx = 0; dx < w; dx++) { pixel = RGB24_TO_PIXEL(16, tmpBuf[dx * 3], tmpBuf[dx * 3 + 1], tmpBuf[dx * 3 + 2]); // // Follow the server byte order when arranging data. // if (byteOrder == LSBFirst) { data[0] = (unsigned char) (pixel & 0xff); data[1] = (unsigned char) ((pixel >> 8) & 0xff); } else { data[1] = (unsigned char) (pixel & 0xff); data[0] = (unsigned char) ((pixel >> 8) & 0xff); } data += 2; } // // Move data at the beginning of the // next line. // data = data + (RoundUp4(w * 2) - w * 2); dy++; } AbortDecompressJpeg16: if (jpegError == 0) { jpeg_finish_decompress(&cinfo); } jpeg_destroy_decompress(&cinfo); if (jpegError == 1) { #ifdef PANIC *logofs << "DecompressJpeg16: Failed to decompress JPEG image.\n" << logofs_flush; #endif return -1; } #ifdef TEST *logofs << "DecompressJpeg16: Decompression finished with " << dy << " lines handled.\n" << logofs_flush; #endif return 1; } int DecompressJpeg24(unsigned char *compressedData, int compressedLen, unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) { struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; CARD8 *pixelPtr = NULL; JSAMPROW rowPointer[1]; unsigned int dx = 0; unsigned int dy = 0; #ifdef TEST *logofs << "DecompressJpeg24: Decompressing with length " << compressedLen << " width " << w << " height " << h << ".\n" << logofs_flush; #endif jpegError = 0; cinfo.err = jpeg_std_error(&jerr); jerr.error_exit = UnpackJpegErrorHandler; if (setjmp(UnpackJpegContext) == 1) { #ifdef TEST *logofs << "DecompressJpeg24: Out of the long jump with error '" << jpegError << "'.\n" << logofs_flush; #endif goto AbortDecompressJpeg24; } jpeg_create_decompress(&cinfo); if (jpegError) goto AbortDecompressJpeg24; JpegSetSrcManager(&cinfo, compressedData, compressedLen); jpeg_read_header(&cinfo, TRUE); if (jpegError) goto AbortDecompressJpeg24; cinfo.out_color_space = JCS_RGB; jpeg_start_decompress(&cinfo); if (jpegError) goto AbortDecompressJpeg24; if (cinfo.output_width != w || cinfo.output_height != h || cinfo.output_components != 3) { #ifdef PANIC *logofs << "DecompressJpeg24: PANIC! Wrong JPEG data received.\n" << logofs_flush; #endif jpeg_destroy_decompress(&cinfo); return -1; } // // PixelPtr points to dstBuf which is // already padded correctly for the final // image to put. // pixelPtr = (CARD8 *) dstBuf; rowPointer[0] = (JSAMPROW) tmpBuf; while (cinfo.output_scanline < cinfo.output_height) { jpeg_read_scanlines(&cinfo, rowPointer, 1); if (jpegError) goto AbortDecompressJpeg24; for (dx = 0; dx < w; dx++) { // // Follow the server byte order when arranging data. // if (byteOrder == LSBFirst) { pixelPtr[0] = tmpBuf[dx * 3]; pixelPtr[1] = tmpBuf[dx * 3 + 1]; pixelPtr[2] = tmpBuf[dx * 3 + 2]; } else { pixelPtr[2] = tmpBuf[dx * 3]; pixelPtr[1] = tmpBuf[dx * 3 + 1]; pixelPtr[0] = tmpBuf[dx * 3 + 2]; } pixelPtr += 3; } // // Go to the next line. // pixelPtr = (CARD8 *) (((char *) pixelPtr) + (RoundUp4(w * 3) - w * 3)); dy++; } AbortDecompressJpeg24: if (jpegError == 0) { jpeg_finish_decompress(&cinfo); } jpeg_destroy_decompress(&cinfo); if (jpegError == 1) { #ifdef PANIC *logofs << "DecompressJpeg24: Failed to decompress JPEG image.\n" << logofs_flush; #endif return -1; } #ifdef TEST *logofs << "DecompressJpeg24: Decompression finished with " << dy << " lines handled.\n" << logofs_flush; #endif return 1; } int DecompressJpeg32(unsigned char *compressedData, int compressedLen, unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) { struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; unsigned char *data; JSAMPROW rowPointer[1]; unsigned int dx = 0; unsigned int dy = 0; #ifdef TEST *logofs << "DecompressJpeg32: Decompressing with length " << compressedLen << " width " << w << " height " << h << ".\n" << logofs_flush; #endif jpegError = 0; cinfo.err = jpeg_std_error(&jerr); jerr.error_exit = UnpackJpegErrorHandler; if (setjmp(UnpackJpegContext) == 1) { #ifdef TEST *logofs << "DecompressJpeg32: Out of the long jump with error '" << jpegError << "'.\n" << logofs_flush; #endif goto AbortDecompressJpeg32; } jpeg_create_decompress(&cinfo); if (jpegError) goto AbortDecompressJpeg32; JpegSetSrcManager(&cinfo, compressedData, compressedLen); jpeg_read_header(&cinfo, TRUE); if (jpegError) goto AbortDecompressJpeg32; cinfo.out_color_space = JCS_RGB; jpeg_start_decompress(&cinfo); if (jpegError) goto AbortDecompressJpeg32; if (cinfo.output_width != w || cinfo.output_height != h || cinfo.output_components != 3) { #ifdef PANIC *logofs << "DecompressJpeg32 : PANIC! Wrong JPEG data received.\n" << logofs_flush; #endif jpeg_destroy_decompress(&cinfo); return -1; } // // PixelPtr points to dstBuf which is // already padded correctly for the final // image to put // data = dstBuf; rowPointer[0] = (JSAMPROW) tmpBuf; unsigned long pixel; int i; while (cinfo.output_scanline < cinfo.output_height) { jpeg_read_scanlines(&cinfo, rowPointer, 1); if (jpegError) goto AbortDecompressJpeg32; for (dx = 0; dx < w; dx++) { pixel = RGB24_TO_PIXEL(32, tmpBuf[dx * 3], tmpBuf[dx * 3 + 1], tmpBuf[dx * 3 + 2]); // // Follow the server byte order when arranging data. // if (byteOrder == LSBFirst) { for (i = 0; i < 4; i++) { data[i] = (unsigned char)(pixel & 0xff); pixel >>= 8; } } else { for (i = 3; i >= 0; i--) { data[i] = (unsigned char) (pixel & 0xff); pixel >>= 8; } } data += 4; } dy++; } AbortDecompressJpeg32: if (jpegError == 0) { jpeg_finish_decompress(&cinfo); } jpeg_destroy_decompress(&cinfo); if (jpegError == 1) { #ifdef PANIC *logofs << "DecompressJpeg32: Failed to decompress JPEG image.\n" << logofs_flush; #endif return -1; } #ifdef TEST *logofs << "DecompressJpeg32: Decompression finished with " << dy << " lines handled.\n" << logofs_flush; #endif return 1; } static void JpegInitSource(j_decompress_ptr cinfo) { jpegError = 0; } static boolean JpegFillInputBuffer(j_decompress_ptr cinfo) { jpegError = 1; jpegSrcManager.bytes_in_buffer = jpegBufferLen; jpegSrcManager.next_input_byte = (JOCTET *)jpegBufferPtr; return TRUE; } static void JpegSkipInputData(j_decompress_ptr cinfo, long num_bytes) { if (num_bytes < 0 || (unsigned long) num_bytes > jpegSrcManager.bytes_in_buffer) { jpegError = 1; jpegSrcManager.bytes_in_buffer = jpegBufferLen; jpegSrcManager.next_input_byte = (JOCTET *)jpegBufferPtr; } else { jpegSrcManager.next_input_byte += (size_t) num_bytes; jpegSrcManager.bytes_in_buffer -= (size_t) num_bytes; } } static void JpegTermSource(j_decompress_ptr cinfo) { } static void JpegSetSrcManager(j_decompress_ptr cinfo, CARD8 *compressedData, int compressedLen) { jpegBufferPtr = (JOCTET *) compressedData; jpegBufferLen = (size_t) compressedLen; jpegSrcManager.init_source = JpegInitSource; jpegSrcManager.fill_input_buffer = JpegFillInputBuffer; jpegSrcManager.skip_input_data = JpegSkipInputData; jpegSrcManager.resync_to_restart = jpeg_resync_to_restart; jpegSrcManager.term_source = JpegTermSource; jpegSrcManager.next_input_byte = jpegBufferPtr; jpegSrcManager.bytes_in_buffer = jpegBufferLen; cinfo->src = &jpegSrcManager; } nx-libs-3.5.99.23/nxcomp/src/Jpeg.h0000644000000000000000000000415513614532331013445 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Jpeg_H #define Jpeg_H #include "Misc.h" #include "Unpack.h" int UnpackJpeg(T_geometry *geometry, unsigned char method, unsigned char *srcData, int srcSize, int dstBpp, int dstWidth, int dstHeight, unsigned char *dstData, int dstSize); #endif /* Jpeg_H */ nx-libs-3.5.99.23/nxcomp/src/Keeper.cpp0000644000000000000000000003250113614532331014322 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "Keeper.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Remove the directory if it's empty // since more than 30 * 24 h. // #define EMPTY_DIR_TIME 2592000 // // Sleep once any ONCE entries. // #define ONCE 2 // // Define this to trace messages while // they are allocated and deallocated. // #undef REFERENCES // // This is used for reference count. // #ifdef REFERENCES int File::references_ = 0; #endif bool T_older::operator () (File *a, File *b) const { return a -> compare(b); } File::File() { name_ = NULL; size_ = 0; time_ = 0; #ifdef REFERENCES references_++; *logofs << "Keeper: Created new File at " << this << " out of " << references_ << " allocated references.\n" << logofs_flush; #endif } // // TODO: This class can leak industrial amounts of memory. // I'm 100% sure that the destructor is called and that // also the string pointed in the File structure is dele- // ted. Everything is logged, but still the memory is not // freed. This is less a problem on Windows, where the me- // mory occupation remains almost constant. Obviously the // problem lies in the STL allocators of the GNU libstc++. // File::~File() { #ifdef TEST *logofs << "Keeper: Deleting name for File at " << this << ".\n" << logofs_flush; #endif delete [] name_; #ifdef REFERENCES *logofs << "Keeper: Deleted File at " << this << " out of " << references_ << " allocated references.\n" << logofs_flush; references_--; #endif } bool File::compare(File *b) const { if (this -> time_ == b -> time_) { return (this -> size_ < b -> size_); } return (this -> time_ < b -> time_); } Keeper::Keeper(int caches, int images, const char *root, int sleep, int parent) { caches_ = caches; images_ = images; sleep_ = sleep; parent_ = parent; root_ = new char[strlen(root) + 1]; strcpy(root_, root); total_ = 0; signal_ = 0; files_ = new T_files; } Keeper::~Keeper() { empty(); delete files_; delete [] root_; } int Keeper::cleanupCaches() { #ifdef TEST *logofs << "Keeper: Looking for cache directories in '" << root_ << "'.\n" << logofs_flush; #endif DIR *rootDir = opendir(root_); if (rootDir != NULL) { dirent *dirEntry; struct stat fileStat; int baseSize = strlen(root_); int s = 0; while (((dirEntry = readdir(rootDir)) != NULL)) { if (s++ % ONCE == 0) usleep(sleep_ * 1000); if (signal_ != 0) break; if (strcmp(dirEntry -> d_name, "cache") == 0 || strncmp(dirEntry -> d_name, "cache-", 6) == 0) { char *dirName = new char[baseSize + strlen(dirEntry -> d_name) + 2]; if (dirName == NULL) { #ifdef WARNING *logofs << "Keeper: WARNING! Can't check directory entry '" << dirEntry -> d_name << "'.\n" << logofs_flush; #endif delete [] dirName; continue; } strcpy(dirName, root_); strcpy(dirName + baseSize, "/"); strcpy(dirName + baseSize + 1, dirEntry -> d_name); #ifdef TEST *logofs << "Keeper: Checking directory '" << dirName << "'.\n" << logofs_flush; #endif if (stat(dirName, &fileStat) == 0 && S_ISDIR(fileStat.st_mode) != 0) { // // Add to repository all the "C-" and // "S-" files in the given directory. // collect(dirName); } delete [] dirName; } } closedir(rootDir); } else { #ifdef WARNING *logofs << "Keeper: WARNING! Can't open NX root directory '" << root_ << "'. Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Can't open NX root directory '" << root_ << "'. Error is " << EGET() << " '" << ESTR() << "'.\n"; } // // Remove older files. // cleanup(caches_); // // Empty the repository. // empty(); return 1; } int Keeper::cleanupImages() { #ifdef TEST *logofs << "Keeper: Looking for image directory in '" << root_ << "'.\n" << logofs_flush; #endif char *imagesPath = new char[strlen(root_) + strlen("/images") + 1]; if (imagesPath == NULL) { return -1; } strcpy(imagesPath, root_); strcat(imagesPath, "/images"); // // Check if the cache directory does exist. // struct stat dirStat; if (stat(imagesPath, &dirStat) == -1) { #ifdef WARNING *logofs << "Keeper: WARNING! Can't stat NX images cache directory '" << imagesPath << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Can't stat NX images cache directory '" << imagesPath << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; delete [] imagesPath; return -1; } // // Check any of the 16 directories in the // images root path. // char *digitPath = new char[strlen(imagesPath) + 5]; strcpy(digitPath, imagesPath); for (char digit = 0; digit < 16; digit++) { // // Give up if we received a signal or // our parent is gone. // if (signal_ != 0) { #ifdef TEST *logofs << "Keeper: Signal detected. Aborting.\n" << logofs_flush; #endif goto KeeperCleanupImagesAbort; } else if (parent_ != getppid() || parent_ == 1) { #ifdef WARNING *logofs << "Keeper: WARNING! Parent process appears " << "to be dead. Returning.\n" << logofs_flush; #endif goto KeeperCleanupImagesAbort; return 0; } sprintf(digitPath + strlen(imagesPath), "/I-%01X", digit); // // Add to the repository all the files // in the given directory. // collect(digitPath); } delete [] imagesPath; delete [] digitPath; // // Remove the oldest files. // cleanup(images_); // // Empty the repository. // empty(); return 1; KeeperCleanupImagesAbort: delete [] imagesPath; delete [] digitPath; empty(); return 0; } int Keeper::collect(const char *path) { #ifdef TEST *logofs << "Keeper: Looking for files in directory '" << path << "'.\n" << logofs_flush; #endif DIR *cacheDir = opendir(path); if (cacheDir != NULL) { File *file; dirent *dirEntry; struct stat fileStat; int baseSize = strlen(path); int fileSize = baseSize + 3 + MD5_LENGTH * 2 + 1; int n = 0; int s = 0; while (((dirEntry = readdir(cacheDir)) != NULL)) { if (s++ % ONCE == 0) usleep(sleep_ * 1000); if (signal_ != 0) break; if (strcmp(dirEntry -> d_name, ".") == 0 || strcmp(dirEntry -> d_name, "..") == 0) { continue; } n++; if (strlen(dirEntry -> d_name) == (MD5_LENGTH * 2 + 2) && (strncmp(dirEntry -> d_name, "I-", 2) == 0 || strncmp(dirEntry -> d_name, "S-", 2) == 0 || strncmp(dirEntry -> d_name, "C-", 2) == 0)) { file = new File(); char *fileName = new char[fileSize]; if (file == NULL || fileName == NULL) { #ifdef WARNING *logofs << "Keeper: WARNING! Can't add file '" << dirEntry -> d_name << "' to repository.\n" << logofs_flush; #endif delete [] fileName; delete file; continue; } strcpy(fileName, path); strcpy(fileName + baseSize, "/"); strcpy(fileName + baseSize + 1, dirEntry -> d_name); file -> name_ = fileName; #ifdef DEBUG *logofs << "Keeper: Adding file '" << file -> name_ << "'.\n" << logofs_flush; #endif if (stat(file -> name_, &fileStat) == -1) { #ifdef WARNING *logofs << "Keeper: WARNING! Can't stat NX file '" << file -> name_ << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif delete file; continue; } file -> size_ = fileStat.st_size; file -> time_ = fileStat.st_mtime; files_ -> insert(T_files::value_type(file)); total_ += file -> size_; } } closedir(cacheDir); if (n == 0) { time_t now = time(NULL); if (now > 0 && stat(path, &fileStat) == 0) { #ifdef TEST *logofs << "Keeper: Empty NX subdirectory '" << path << "' unused since " << now - fileStat.st_mtime << " S.\n" << logofs_flush; #endif if (now - fileStat.st_mtime > EMPTY_DIR_TIME) { #ifdef TEST *logofs << "Keeper: Removing empty NX subdirectory '" << path << "'.\n" << logofs_flush; #endif rmdir(path); } } } } else { #ifdef WARNING *logofs << "Keeper: WARNING! Can't open NX subdirectory '" << path << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Can't open NX subdirectory '" << path << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; } return 1; } int Keeper::cleanup(int threshold) { #ifdef TEST *logofs << "Keeper: Deleting the oldest files with " << files_ -> size() << " elements threshold " << threshold << " and size " << total_ << ".\n" << logofs_flush; #endif // // At least some versions of the standard // library don't allow erasing an element // while looping. This is not the most ef- // ficient way to release the objects, but // it's better than making a copy of the // container. // while (total_ > threshold && files_ -> size() > 0) { T_files::iterator i = files_ -> begin(); File *file = *i; #ifdef TEST *logofs << "Keeper: Removing '" << file -> name_ << "' with time " << file -> time_ << " and size " << file -> size_ << ".\n" << logofs_flush; #endif unlink(file -> name_); total_ -= file -> size_; #ifdef DEBUG *logofs << "Keeper: Going to delete the file at " << file << " while cleaning up.\n" << logofs_flush; #endif delete file; #ifdef DEBUG *logofs << "Keeper: Going to erase the element " << "while cleaning up.\n" << logofs_flush; #endif files_ -> erase(i); } #ifdef TEST *logofs << "Keeper: Bytes in repository are " << total_ << ".\n" << logofs_flush; #endif return 1; } void Keeper::empty() { #ifdef TEST *logofs << "Keeper: Getting rid of files in repository.\n" << logofs_flush; #endif while (files_ -> size() > 0) { T_files::iterator i = files_ -> begin(); File *file = *i; #ifdef DEBUG *logofs << "Keeper: Going to delete the file at " << file << " while emptying.\n" << logofs_flush; #endif delete file; #ifdef DEBUG *logofs << "Keeper: Going to erase the element " << "while emptying.\n" << logofs_flush; #endif files_ -> erase(i); } total_ = 0; #ifdef TEST *logofs << "Keeper: Bytes in repository are " << total_ << ".\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/Keeper.h0000644000000000000000000000756513614532331014003 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Keeper_H #define Keeper_H #include "Misc.h" #include "Types.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Define this to check how many file // nodes are allocated and deallocated. // #undef REFERENCES class Keeper; class File { friend class Keeper; public: File(); ~File(); // // Allow sort by time and size. If time // is the same, keep the bigger element. // bool compare(File *b) const; private: char *name_; int size_; time_t time_; #ifdef REFERENCES static int references_; #endif }; class Keeper { public: Keeper(int caches, int images, const char *root, int sleep, int parent); ~Keeper(); // // Call this just once. // int cleanupCaches(); // // Call this at any given interval. // int cleanupImages(); // // Call this if it's time to exit. // void setSignal(int signal) { signal_ = signal; } int getSignal() { return signal_; } int getParent() { return parent_; } private: // // Get a list of files in directory. // int collect(const char *path); // // Sort the collected files according to // last modification time and delete the // older ones until disk size is below // the threshold. // int cleanup(int threshold); // // Empty the files repository. // void empty(); // // Size in bytes of total allowed // storage for persistent caches. // int caches_; // // Size in bytes of total allowed // storage for images cache. // int images_; // // Path of the NX root directory. // char *root_; // // The little delay to be introduced // before reading a new entry. // int sleep_; // // Total size of files in repository. // int total_; // // The parent process, so we can exit // if it is gone. // int parent_; // // Set if we need to give up because // of a signal. // int signal_; // // Repository where to collect files. // T_files *files_; }; #endif /* Keeper_H */ nx-libs-3.5.99.23/nxcomp/src/List.cpp0000644000000000000000000000616613614532331014032 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "List.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Define this to know how many instances // are allocated and deallocated. // #undef REFERENCES #ifdef REFERENCES int List::references_ = 0; #endif List::List() { #ifdef REFERENCES references_++; *logofs << "List: Created new List at " << this << " out of " << references_ << " allocated references.\n" << logofs_flush; #endif } List::~List() { #ifdef REFERENCES references_--; *logofs << "List: Deleted List at " << this << " out of " << references_ << " allocated references.\n" << logofs_flush; #endif } void List::remove(int value) { for (T_list::iterator i = list_.begin(); i != list_.end(); i++) { if (*i == value) { list_.erase(i); return; } } #ifdef PANIC *logofs << "List: PANIC! Should not try to remove " << "an element not found in the list.\n" << logofs_flush; #endif cerr << "Error" << ": Should not try to remove " << "an element not found in the list.\n"; HandleAbort(); } void List::rotate() { if (list_.size() > 1) { int value = *(list_.begin()); list_.pop_front(); list_.push_back(value); } } nx-libs-3.5.99.23/nxcomp/src/ListFontsReply.cpp0000644000000000000000000001403413614532331016051 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ListFontsReply.h" #include "ServerCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef DUMP #undef TEST #undef DEBUG ListFontsReplyStore::ListFontsReplyStore(StaticCompressor *compressor) : MessageStore(compressor) { enableCache = LISTFONTSREPLY_ENABLE_CACHE; enableData = LISTFONTSREPLY_ENABLE_DATA; enableSplit = LISTFONTSREPLY_ENABLE_SPLIT; // Since ProtoStep7 (#issue 108) enableCompress = LISTFONTSREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; dataLimit = LISTFONTSREPLY_DATA_LIMIT; dataOffset = LISTFONTSREPLY_DATA_OFFSET; cacheSlots = LISTFONTSREPLY_CACHE_SLOTS; cacheThreshold = LISTFONTSREPLY_CACHE_THRESHOLD; cacheLowerThreshold = LISTFONTSREPLY_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } ListFontsReplyStore::~ListFontsReplyStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } // // Here are the methods to handle messages' content. // int ListFontsReplyStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { ListFontsReplyMessage *listFontsReply = (ListFontsReplyMessage *) message; // // Here is the fingerprint. // listFontsReply -> number_of_names = GetUINT(buffer + 8, bigEndian); // // Clean up padding bytes. // if ((int) size > dataOffset) { unsigned int current; unsigned int length; unsigned int nstringInNames; unsigned char *end = NULL; unsigned char *pad = NULL; #ifdef DUMP *logofs << "\n" << logofs_flush; *logofs << "Number of STRING8 " << listFontsReply -> number_of_names << ".\n" << logofs_flush; *logofs << "Size " << size << ".\n" << logofs_flush; DumpHexData(buffer, size); *logofs << "\n" << logofs_flush; #endif length = LISTFONTSREPLY_DATA_OFFSET; for (nstringInNames = 0; nstringInNames < listFontsReply -> number_of_names && listFontsReply -> number_of_names > 0; nstringInNames++) { // // Start with offset LISTFONTSREPLY_DATA_OFFSET 32. // current = buffer[length]; length += current + 1; #ifdef DUMP *logofs << "\nString number : " << nstringInNames << " Current length : " << current << "\n" << logofs_flush; #endif } #ifdef DUMP *logofs << "\nFinal length " << length << "\n" << logofs_flush; #endif end = ((unsigned char *) buffer) + size; for (pad = ((unsigned char *) buffer) + length; pad < end; pad++) { *pad = 0; #ifdef DUMP *logofs << "\nPadding ." << "\n" << logofs_flush; #endif } } #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } int ListFontsReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { ListFontsReplyMessage *listFontsReply = (ListFontsReplyMessage *) message; // // Fill all the message's fields. // PutUINT(listFontsReply -> number_of_names, buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } void ListFontsReplyStore::dumpIdentity(const Message *message) const { #ifdef DUMP ListFontsReplyMessage *listFontsReply = (ListFontsReplyMessage *) message; *logofs << name() << ": Identity number_of_names " << listFontsReply -> number_of_names << ", size " << listFontsReply -> size_ << ".\n"; #endif } void ListFontsReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { // // Field number_of_names. // md5_append(md5_state_, buffer + 8, 2); } nx-libs-3.5.99.23/nxcomp/src/ListFontsReply.h0000644000000000000000000001036213614532331015516 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ListFontsReply_H #define ListFontsReply_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define LISTFONTSREPLY_ENABLE_CACHE 1 #define LISTFONTSREPLY_ENABLE_DATA 1 #define LISTFONTSREPLY_ENABLE_SPLIT 0 #define LISTFONTSREPLY_DATA_LIMIT 1048576 - 32 #define LISTFONTSREPLY_DATA_OFFSET 32 #define LISTFONTSREPLY_CACHE_SLOTS 200 #define LISTFONTSREPLY_CACHE_THRESHOLD 20 #define LISTFONTSREPLY_CACHE_LOWER_THRESHOLD 5 #define LISTFONTSREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 // // The message class. // class ListFontsReplyMessage : public Message { friend class ListFontsReplyStore; public: ListFontsReplyMessage() { } ~ListFontsReplyMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned short int number_of_names; }; class ListFontsReplyStore : public MessageStore { // // Constructors and destructors. // public: ListFontsReplyStore(StaticCompressor *compressor); virtual ~ListFontsReplyStore(); virtual const char *name() const { return "ListFontsReply"; } virtual unsigned char opcode() const { return X_ListFonts; } virtual unsigned int storage() const { return sizeof(ListFontsReplyMessage); } // // Message handling methods. // protected: virtual Message *create() const { return new ListFontsReplyMessage(); } virtual Message *create(const Message &message) const { return new ListFontsReplyMessage((const ListFontsReplyMessage &) message); } virtual void destroy(Message *message) const { delete (ListFontsReplyMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* ListFontsReply_H */ nx-libs-3.5.99.23/nxcomp/src/List.h0000644000000000000000000000476213614532331013477 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef List_H #define List_H #include "Misc.h" #include "Types.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Define this to log when lists are // allocated and deallocated. // #undef REFERENCES class List { public: List(); ~List(); int getSize() { return list_.size(); } T_list &getList() { return list_; } T_list copyList() { return list_; } void add(int value) { list_.push_back(value); } void remove(int value); void rotate(); private: // // The list container. // T_list list_; #ifdef REFERENCES static int references_; #endif }; #endif /* List_H */ nx-libs-3.5.99.23/nxcomp/src/Log.cpp0000644000000000000000000001327013614532331013632 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include #include #include #include #include #include "Log.h" #include "config.h" NXLog nx_log; bool NXLog::will_log() const { std::map::const_iterator item = per_file_levels_.find(current_file()); if ( item != per_file_levels_.end() ) { return current_level() <= item->second; } else { return current_level() <= level(); } } std::string NXLog::stamp_to_string(const NXLogStamp& stamp) const { std::ostringstream oss; static const char* level_names[] = { "FATAL", "ERROR", "WARN ", "INFO ", "DEBUG" }; if ( log_level() ) oss << ((stamp.level() >=0 && stamp.level() < NXLOG_LEVEL_COUNT ) ? level_names[stamp.level()] : "???") << " "; if ( log_time() ) { struct timeval timestamp = stamp.timestamp(); struct tm timeinfo; localtime_r(×tamp.tv_sec, &timeinfo); if ( log_unix_time() ) { oss << timestamp.tv_sec; } else { #if HAVE_STD_PUT_TIME oss << " " << std::put_time(&timeinfo, "%Y/%m/%d %H:%M:%S"); #else oss << timestamp.tv_sec; #endif } oss << "." << std::setw(3) << std::setfill('0') << (int)(timestamp.tv_usec / 1000) << " "; } if ( log_location() ) oss << stamp.file() << "/" << stamp.function() << ":" << stamp.line() << " "; if ( log_thread_id() ) { if ( thread_name().empty() ) oss << getpid() << "/" << pthread_self() << " "; else oss << "[" << thread_name() << "] "; } return oss.str(); } NXLog& operator<< (NXLog& out, const NXLogStamp& value) { /* * If appending, the file and function names must be empty and * the line set to zero. */ const bool looks_like_append = ((value.file().empty()) || (value.function().empty()) || (0 == value.line())); const bool append = ((looks_like_append) && ((value.file().empty()) && (value.function().empty()) && (0 == value.line()))); if ((looks_like_append) && (!append)) { std::cerr << "WARNING: At least one element in logstamp invalid, but this is not supposed to be an append operation. " << "Internal state error!\n" << "Log line will be discarded!" << std::endl; } else if (append) { /* Appending means that the log object's internal level and the message level must match. */ if (out.current_level() == value.level()) { /* Discard, if the message is not supposed to be written out anyway. */ if (out.will_log ()) { /* And the buffer must of course be non-empty. */ if (out.has_buffer()) { out << " (cont.) "; } else { std::cerr << "WARNING: Append operation requested, but no queued data available. " << "Internal state error!\n" << "Log line will be discarded!" << std::endl; } } } else { std::cerr << "WARNING: Append operation requested, but internal log level not matching line level. " << "Internal state error!\n" << "Log line will be discarded!" << std::endl; } } else { out.current_level( value.level() ); out.current_file( value.file() ); // Writing an NXLogStamp to the stream indicates the start of a new entry. // If there's any content in the buffer and we actually intend to keep that line, // create a new entry in the output queue. if ( out.synchronized() && out.will_log() ) out.new_stack_entry(); out << out.stamp_to_string(value); } return out; } nx-libs-3.5.99.23/nxcomp/src/Log.h0000644000000000000000000003471613614532331013307 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef NXLog_H #define NXLog_H #include #include #include #include #include #include #include #include #include #include /** Log severity level */ enum NXLogLevel { NXFATAL, NXERROR, NXWARNING, NXINFO, NXDEBUG, NXLOG_LEVEL_COUNT }; /** * Log timestamp class * * Stores the timestamp, file, function, line number and log level. * Acts as a manipulator on the NXLog class, telling it a new log * severity level. For instance: * * nx_log << NXLogStamp(...,NXINFO) * * Tells nx_log that now NXINFO type messages are being logged. This * will be applied until a new NXLogStamp with a different level * is sent to the NXLog. */ class NXLogStamp { private: std::string file_; std::string function_; size_t line_; NXLogLevel level_; struct timeval timestamp_; public: /** File where the event occurred */ std::string file() const { return file_; } /** Function where the event occurred */ std::string function() const { return function_; } /** Line where the event occurred */ size_t line() const { return line_; } /** Severity level of the event */ NXLogLevel level() const { return level_; } /** Time of the event */ struct timeval timestamp() const { return timestamp_; } NXLogStamp(NXLogLevel level, const char *file = "", const char *function = "", size_t line = 0) : file_(file), function_(function), line_(line), level_(level) { gettimeofday(×tamp_, NULL); } }; /** * Log class * * Logs events to a stream, filters by file/level */ class NXLog { #ifdef INTERNAL_LOGGING_TEST protected: #endif NXLogLevel level_; std::ostream *stream_; std::map< std::string, NXLogLevel > per_file_levels_; bool synchronized_; size_t thread_buffer_size_; pthread_mutex_t output_lock_; pthread_key_t tls_key_; bool log_level_; bool log_time_; bool log_unix_time_; bool log_location_; bool log_thread_id_; typedef struct per_thread_data_s { NXLogLevel current_level; std::string* current_file; std::string* thread_name; std::stack buffer; NXLog* log_obj; } per_thread_data; static void free_thread_data(void* arg) { per_thread_data *pdt = (per_thread_data*)arg; if ( !pdt ) return; if ( pdt->log_obj ) { // Ensure the buffer is flushed before thread deletion pdt->log_obj->flush(pdt); } delete pdt->current_file; delete pdt->thread_name; while (!pdt->buffer.empty()) { /* * get the stringstream object created in new_stack_entry() * from the stack and delete it after pop() */ std::stringstream* tmp = pdt->buffer.top(); (void) pdt->buffer.pop (); delete tmp; } delete pdt; } per_thread_data* get_data_int() const { per_thread_data *ret = NULL; if ( (ret = (per_thread_data*)pthread_getspecific(tls_key_)) == NULL ) { ret = new per_thread_data; ret->current_level = NXDEBUG; ret->current_file = new std::string(); ret->thread_name = new std::string(); ret->log_obj = const_cast(this); pthread_setspecific(tls_key_, ret); } return ret; } per_thread_data* get_data() { return get_data_int(); } const per_thread_data* get_data() const { return get_data_int(); } /** Convert NXLogStamp to string according to the current configuration */ std::string stamp_to_string(const NXLogStamp& stamp) const; void new_stack_entry() { per_thread_data *pdt = get_data(); pdt->buffer.push(new std::stringstream()); } /** * Internal flush function * * When a thread is being terminated and free_thread_data gets called, * the TLS key gets set to NULL before the call to free_thread_data, * and the destructor function gets the old value. * * This means that get_data() stops working correctly, and we need * to be able to pass the old pointer. */ virtual /* Note: this function needs to be virtual for the logging test application. Don't remove. */ void flush(per_thread_data *pdt) { /* * Block all signals until we are dong printing data. * Ensures that a signal handler won't interrupt us * and overwrite the buffer data mid-print, leading * to confusing output. */ sigset_t orig_signal_mask, tmp_signal_mask; sigemptyset(&orig_signal_mask); /* Set up new mask to block all signals. */ sigfillset(&tmp_signal_mask); /* Block all signals. */ pthread_sigmask(SIG_BLOCK, &tmp_signal_mask, &orig_signal_mask); if (!pdt->buffer.empty ()) { /* * get the stringstream object created in new_stack_entry() * from the stack and delete it after pop() */ std::stringstream *tmp = pdt->buffer.top(); const std::string str = tmp->str(); if (!str.empty()) { pthread_mutex_lock(&output_lock_); (*stream()) << str; pthread_mutex_unlock(&output_lock_); } /* Remove from stack. */ pdt->buffer.pop(); /* free memory */ delete tmp; } /* Restore old signal mask. */ pthread_sigmask(SIG_SETMASK, &orig_signal_mask, NULL); } public: NXLog() : level_(NXWARNING), stream_(&std::cerr), synchronized_(true), thread_buffer_size_(1024), log_level_(false), log_time_(false), log_unix_time_(false), log_location_(false), log_thread_id_(false) { if ( pthread_key_create(&tls_key_, free_thread_data) != 0 ) { std::cerr << "pthread_key_create failed" << std::endl; abort(); } } ~NXLog() { per_thread_data *pdt = get_data(); // Flush any remaining output and delete TLS data free_thread_data(pdt); pthread_key_delete(tls_key_); if ((stream_) && (stream_ != &std::cerr)) { delete stream_; } } /** Minimum severity level to output */ NXLogLevel level() const { return level_; } void level(NXLogLevel level) { level_ = level; } /** Current severity level */ NXLogLevel current_level() const { return get_data()->current_level; } void current_level(NXLogLevel level) { get_data()->current_level = level; } /** Source file from which messages are currently originating */ std::string current_file() const { return *get_data()->current_file; } void current_file(std::string val) { *get_data()->current_file = val; } std::ostream* stream() const { return stream_; } void stream(std::ostream *stream) { flush(); stream_ = stream; } bool synchronized() const { return synchronized_; } void synchronized(bool val) { synchronized_ = val; } bool log_level() const { return log_level_; } void log_level(bool val) { log_level_ = val; } bool log_time() const { return log_time_; } void log_time(bool val) { log_time_ = val; } bool log_unix_time() const { return log_unix_time_; } void log_unix_time(bool val) { log_unix_time_ = val; } bool log_location() const { return log_location_; } void log_location(bool val) { log_location_ = val; } bool log_thread_id() const { return log_thread_id_; } void log_thread_id(bool val) { log_thread_id_ = val; } void flush() { per_thread_data *pdt = get_data(); flush(pdt); } std::string thread_name() const { return *get_data()->thread_name; } void thread_name(std::string str) { *get_data()->thread_name = str; } void thread_name(const char *str) { *get_data()->thread_name = str; } /** * True if a message sent to the NXLog object will be sent to the output * * This considers two things: * * If there's a per-file log level, then it is used * Otherwise the global log level is used. * * If the log level permits the current message to be output, then the * return value is true. */ bool will_log() const; bool has_buffer() const { return (!(get_data()->buffer.empty ())); } /** * This catches std::flush */ NXLog& operator<<(std::ostream& (*F)(std::ostream&)) { if ( will_log() ) { if ( synchronized() ) { /* Verbosely discard data if we don't have a buffer. */ if (!(has_buffer())) { std::cerr << "WARNING: no buffer available! " << "Internal state error!\n" << "Log hunk will be discarded!" << std::endl; } else { per_thread_data *pdt = get_data(); assert (!pdt->buffer.empty ()); (*pdt->buffer.top()) << F; flush(); } } else { *(stream()) << F; } } return *this; } template friend NXLog& operator<<(NXLog& out, const T& value); friend NXLog& operator<< (NXLog& out, const NXLogStamp& value); }; extern NXLog nx_log; #define nxstamp(l) NXLogStamp(l, __FILE__, __func__, __LINE__) #define nxstamp_append(l) NXLogStamp(l) #define nxdbg nx_log << nxstamp(NXDEBUG) #define nxinfo nx_log << nxstamp(NXINFO) #define nxwarn nx_log << nxstamp(NXWARNING) #define nxerr nx_log << nxstamp(NXERROR) #define nxfatal nx_log << nxstamp(NXFATAL) /* Append data to already existing (i.e., same-level) line. */ #define nxdbg_append nx_log << nxstamp_append(NXDEBUG) #define nxinfo_append nx_log << nxstamp_append(NXINFO) #define nxwarn_append nx_log << nxstamp_append(NXWARNING) #define nxerr_append nx_log << nxstamp_append(NXERROR) #define nxfatal_append nx_log << nxstamp_append(NXFATAL) NXLog& operator<< (NXLog& out, const NXLogStamp& value); template bool has_newline(T &value) { return false; } template static bool has_newline(char *value) { if (value) { return strstr(value, "\n") != NULL; } else { return false; } } template static bool has_newline(char value) { return value == '\n'; } template static bool has_newline(std::string &value) { return value.find_first_of("\n") != std::string::npos; } static size_t ss_length(std::stringstream *ss) { size_t pos = ss->tellg(); size_t ret = 0; ss->seekg(0, std::ios::end); ret = ss->tellg(); ss->seekg(pos, std::ios::beg); return ret; } template NXLog& operator<<(NXLog& out, const T& value) { if ( out.will_log() ) { if ( out.synchronized() ) { /* Verbosely discard data if we don't have a buffer. */ if (!(out.has_buffer())) { std::cerr << "WARNING: no buffer available! " << "Internal state error!\n" << "Log hunk will be discarded!" << std::endl; } else { // In synchronized mode, we buffer data until a newline, std::flush, or the buffer // gets full. Then we dump the whole thing at once to the output stream, synchronizing // with a mutex. NXLog::per_thread_data *pdt = out.get_data(); assert (!pdt->buffer.empty ()); (*pdt->buffer.top()) << value; if ( ss_length(pdt->buffer.top()) >= out.thread_buffer_size_ || has_newline(value) ) out.flush(); } } else { // In async mode we just dump data on the output stream as-is. // Multithreaded code will have ugly output. *(out.stream()) << value; } } return out; } #endif nx-libs-3.5.99.23/nxcomp/src/Loop.cpp0000644000000000000000000126737213614532331014041 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "Misc.h" #include #ifdef __sun #include #endif // // MacOSX 10.4 defines socklen_t. This is // intended to ensure compatibility with // older versions. // #ifdef __APPLE__ #include #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3 typedef int socklen_t; #endif #endif #ifdef _AIX #include #include #endif #ifndef __CYGWIN32__ #include #endif // // NX include files. // #include "NX.h" #include "NXalert.h" #include "Misc.h" #include "Control.h" #include "Socket.h" #include "Statistics.h" #include "Auth.h" #include "Keeper.h" #include "Agent.h" #include "ClientProxy.h" #include "ServerProxy.h" #include "Message.h" #include "ChannelEndPoint.h" #include "Log.h" // // System specific defines. // // // HP-UX hides this define. // #if defined(hpux) && !defined(RLIM_INFINITY) #define RLIM_INFINITY 0x7fffffff #endif // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Enable log output in signal handler. // This is likely to hang the proxy at // random, at least on Linux. // #undef UNSAFE // // Let all logs go to the standard error. // This is useful to interleave the Xlib // log output with the proxy output in a // single file. // #undef MIXED // // Define this to check if the client and // server caches match at shutdown. This // is a test facility as it requires that // both proxies are running on the same // host. // #undef MATCH // // If defined, reduce the size of the log // file and be sure it never exceeds the // limit. // #undef QUOTA // // If defined, force very strict limits for // the proxy tokens and force the proxy to // enter often in congestion state. // #undef STRICT // // Print a line in the log if the time we // spent inside the select or handling the // messages exceeded a given time value. // #undef TIME // // This can be useful when testing the forwarding // of the SSHD connection by nxssh to the agent. // The debug output will go to a well known file // that will be opened also by nxssh when BINDER // is enabled there. // #undef BINDER // // Define this to override the limits on // the core dump size. // #define COREDUMPS // // Upper limit of pre-allocated buffers // for string parameters. // #define DEFAULT_STRING_LENGTH 256 // // Maximum length of remote options data // passed by peer proxy at startup. // #define DEFAULT_REMOTE_OPTIONS_LENGTH 512 // // Maximum length of NX display string. // #define DEFAULT_DISPLAY_OPTIONS_LENGTH 1024 // // Maximum number of cache file names to // send to the server side. // #define DEFAULT_REMOTE_CACHE_ENTRIES 100 // // Maximum length of remote options string // that can be received from the peer proxy. // #define MAXIMUM_REMOTE_OPTIONS_LENGTH 4096 // // Macro is true if we determined our proxy // mode. // #define WE_SET_PROXY_MODE (control -> ProxyMode != proxy_undefined) // // Macro is true if our side is the one that // should connect to remote. // #define WE_INITIATE_CONNECTION (connectSocket.enabled()) // // Is true if we must provide our credentials // to the remote peer. // #define WE_PROVIDE_CREDENTIALS (control -> ProxyMode == proxy_server) // // Is true if we listen for a local forwarder // that will tunnel the traffic through a SSH // or HTTP link. // #define WE_LISTEN_FORWARDER (control -> ProxyMode == proxy_server && \ listenSocket.enabled()) // // You must define FLUSH in Misc.h if // you want an immediate flush of the // log output. // ostream *logofs = NULL; // // Other stream destriptors used for // logging. // ostream *statofs = NULL; ostream *errofs = NULL; // // Save standard error's rdbuf here // and restore it when exiting. // static streambuf *errsbuf = NULL; // // Allow faults to be recovered by // jumping back into the main loop. // jmp_buf context; // // Provide operational parameters. // Control *control = NULL; // // Collect and print statistics. // Statistics *statistics = NULL; // // Keep data for X11 authentication. // Auth *auth = NULL; // // This class makes the hard work. // Proxy *proxy = NULL; // // Used to handle memory-to-memory // transport to the X agent. // Agent *agent = NULL; // // The image cache house-keeping class. // Keeper *keeper = NULL; // // Callback set by the child process // to be notified about signals. // int (*signalHandler)(int) = NULL; // // Signal handling functions (that are not already mentioned in Misc.h). // void InstallSignals(); static void RestoreSignals(); static void HandleSignal(int signal); // // Signal handling utilities. // static void InstallSignal(int signal, int action); static void RestoreSignal(int signal); static int HandleChildren(); int HandleChild(int child); static int CheckChild(int pid, int status); static int WaitChild(int child, const char *label, int force); int CheckParent(const char *name, const char *type, int parent); void RegisterChild(int child); static int CheckAbort(); // // Timer handling utilities (that are not already mentioned in Misc.h). // static void HandleTimer(int signal); // // Kill or check a running child. // static int KillProcess(int pid, const char *label, int signal, int wait); static int CheckProcess(int pid, const char *label); // // Macros used to test the pid of a child. // #define IsFailed(pid) ((pid) < 0) #define IsRunning(pid) ((pid) > 1) #define IsNotRunning(pid) ((pid) == 0) #define IsRestarting(pid) ((pid) == 1) #define SetNotRunning(pid) ((pid) = 0) #define SetRestarting(pid) ((pid) = 1) // // Start or restart the house-keeper process. // static void StartKeeper(); // // Cleanup functions. // void CleanupConnections(); void CleanupListeners(); void CleanupSockets(); void CleanupGlobal(); static void CleanupChildren(); static void CleanupLocal(); static void CleanupKeeper(); static void CleanupStreams(); // // Loop forever until the connections // to the peer proxy is dropped. // static void WaitCleanup(); // // Initialization functions. // static int InitBeforeNegotiation(); static int SetupProxyConnection(); static int InitAfterNegotiation(); static int SetupProxyInstance(); static int SetupAuthInstance(); static int SetupAgentInstance(); static void SetupTcpSocket(); static void SetupUnixSocket(); static void SetupServiceSockets(); static void SetupDisplaySocket(int &addr_family, sockaddr *&addr, unsigned int &addr_length); // // Setup a listening socket and accept // a new connection. // static int ListenConnection(ChannelEndPoint &endPoint, const char *label); static int ListenConnectionTCP(const char *host, long port, const char *label); static int ListenConnectionUnix(const char *path, const char *label); static int ListenConnectionAny(sockaddr *addr, socklen_t addrlen, const char *label); static int AcceptConnection(int fd, int domain, const char *label); // // Other convenience functions. // static int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout, int* proxyFileDescriptor, int* reason); static int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFileDescriptor, int* reason); static int WaitForRemote(ChannelEndPoint &socketAddress); static int ConnectToRemote(ChannelEndPoint &socketAddress); static int SendProxyOptions(int fd); static int SendProxyCaches(int fd); static int ReadProxyVersion(int fd); static int ReadProxyOptions(int fd); static int ReadProxyCaches(int fd); static int ReadForwarderVersion(int fd); static int ReadForwarderOptions(int fd); static int ReadRemoteData(int fd, char *buffer, int size, char stop); static int WriteLocalData(int fd, const char *buffer, int size); static void PrintVersionInfo(); static void PrintProcessInfo(); static void PrintConnectionInfo(); static void PrintUsageInfo(const char *option, const int error); static void PrintOptionIgnored(const char *type, const char *name, const char *value); // // This is not static to avoid a warning. // void PrintCopyrightInfo(); static const char *GetOptions(const char *options); static const char *GetArg(int &argi, int argc, const char **argv); static int CheckArg(const char *type, const char *name, const char *value); static int ParseArg(const char *type, const char *name, const char *value); static int ValidateArg(const char *type, const char *name, const char *value); static void SetAndValidateChannelEndPointArg(const char *type, const char *name, const char *value, ChannelEndPoint &endPoint); static int LowercaseArg(const char *type, const char *name, char *value); static int CheckSignal(int signal); extern "C" { int ParseCommandLineOptions(int argc, const char **argv); int ParseEnvironmentOptions(const char *env, int force); int ParseBindOptions(char **host, int *port); } static int ParseFileOptions(const char *file); static int ParseRemoteOptions(char *opts); static int ParseForwarderOptions(char *opts); // // These functions are used to parse literal // values provided by the user and set the // control parameters accordingly. // static int ParseLinkOption(const char *opt); static int ParseBitrateOption(const char *opt); static int ParseCacheOption(const char *opt); static int ParseShmemOption(const char *opt); static int ParseImagesOption(const char *opt); static int ParsePackOption(const char *opt); // // Set host and port where NX proxy is supposed // to be listening in case such parameters are // given on the command line. // static int ParseHostOption(const char *opt, char *host, long &port); // // Translate a font server port specification // to the corresponding Unix socket path. // static int ParseFontPath(char *path); // // Translate a pack method id in a literal. // static int ParsePackMethod(const int method, const int quality); // // Try to increase the size of the allowed // core dumps. // static int SetCore(); // // Set the proxy mode to either client or // server. // static int SetMode(int mode); // // Determine the path of the NX_* directories // from the environment. // static int SetDirectories(); // // Set the defaults used for the log file and // statistics. // static int SetLogs(); // // Check if local and remote protocol versions // are compatible and, eventually, downgrade // local version to the minimum level that is // known to work. // static int SetVersion(); // // Setup the listening TCP ports used for the // additional channels according to user's // wishes. // static int SetPorts(); // // Set the maximum number of open descriptors. // static int SetDescriptors(); // // Set the path used for choosing the cache. // It must be selected after determining the // session type. // static int SetCaches(); // // Initialize, one after the other, all the // configuration parameters. // static int SetParameters(); // // Set the specific configuration parameter. // static int SetSession(); static int SetStorage(); static int SetShmem(); static int SetPack(); static int SetImages(); static int SetLimits(); // // Set up the control parameters based on // the link speed negotiated between the // proxies. // static int SetLink(); static int SetLinkModem(); static int SetLinkIsdn(); static int SetLinkAdsl(); static int SetLinkWan(); static int SetLinkLan(); // // Adjust the compression parameters. // static int SetCompression(); static int SetCompressionModem(); static int SetCompressionIsdn(); static int SetCompressionAdsl(); static int SetCompressionWan(); static int SetCompressionLan(); // // Determine the NX paths based on the // user's parameters or the environment. // char *GetClientPath(); static char *GetSystemPath(); static char *GetHomePath(); static char *GetTempPath(); static char *GetRootPath(); static char *GetCachePath(); static char *GetImagesPath(); static char *GetSessionPath(); static char *GetLastCache(char *list, const char *path); static int OpenLogFile(char *name, ostream *&stream); static int ReopenLogFile(char *name, ostream *&stream, int limit); // // Perform operations on the managed // descriptors in the main loop. // static void handleCheckSessionInLoop(); static void handleCheckBitrateInLoop(); static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet, fd_set &writeSet, T_timestamp selectTs); static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, fd_set &writeSet, struct timeval &selectTs, struct timeval &startTs); static void handleCheckStateInLoop(int &setFDs); static void handleCheckSessionInConnect(); static inline void handleSetReadInLoop(fd_set &readSet, int &setFDs, struct timeval &selectTs); static inline void handleSetWriteInLoop(fd_set &writeSet, int &setFDs, struct timeval &selectTs); static inline void handleSetListenersInLoop(fd_set &writeSet, int &setFDs); static inline void handleSetAgentInLoop(int &setFDs, fd_set &readSet, fd_set &writeSet, struct timeval &selectTs); static void handleAlertInLoop(); static void handleStatisticsInLoop(); static inline void handleAgentInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, fd_set &writeSet, struct timeval &selectTs); static inline void handleAgentLateInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, fd_set &writeSet, struct timeval &selectTs); static inline void handleReadableInLoop(int &resultFDs, fd_set &readSet); static inline void handleWritableInLoop(int &resultFDs, fd_set &writeSet); static inline void handleRotateInLoop(); static inline void handleEventsInLoop(); static inline void handleFlushInLoop(); // // Manage the proxy link during the negotiation // phase. // static void handleNegotiationInLoop(int &setFDs, fd_set &readSet, fd_set &writeSet, T_timestamp &selectTs); // // Print the 'terminating' messages in the // session log. // static inline void handleTerminatingInLoop(); static inline void handleTerminatedInLoop(); // // Monitor the size of the log file. // static void handleLogReopenInLoop(T_timestamp &lTs, T_timestamp &nTs); // // Directory where the NX binaries and libraries reside. // static char systemDir[DEFAULT_STRING_LENGTH] = { 0 }; // // Directory used for temporary files. // static char tempDir[DEFAULT_STRING_LENGTH] = { 0 }; // // Actually the full path to the client. // static char clientDir[DEFAULT_STRING_LENGTH] = { 0 }; // // User's home directory. // static char homeDir[DEFAULT_STRING_LENGTH] = { 0 }; // // Root of directory structure to be created by proxy. // static char rootDir[DEFAULT_STRING_LENGTH] = { 0 }; // // Root of statistics and log files to be created by proxy. // static char sessionDir[DEFAULT_STRING_LENGTH] = { 0 }; // // Log files for errors and statistics. Error log is // the place where we print also debug information. // Both files are closed, deleted and reopened as // their size exceed the limit set in control class. // The session log is not reopened, as it is used by // the NX client and server to track the advance of // the session. // static char errorsFileName[DEFAULT_STRING_LENGTH] = { 0 }; static char statsFileName[DEFAULT_STRING_LENGTH] = { 0 }; static char sessionFileName[DEFAULT_STRING_LENGTH] = { 0 }; static char optionsFileName[DEFAULT_STRING_LENGTH] = { 0 }; // // String literal representing selected link speed // parameter. Value is translated in control values // used by proxies to stay synchronized. // static char linkSpeedName[DEFAULT_STRING_LENGTH] = { 0 }; // // String literal representing selected // cache size. // static char cacheSizeName[DEFAULT_STRING_LENGTH] = { 0 }; // // String literal representing selected // shared memory segment size. // static char shsegSizeName[DEFAULT_STRING_LENGTH] = { 0 }; // // String literal of images cache size. // static char imagesSizeName[DEFAULT_STRING_LENGTH] = { 0 }; // // String literal for bandwidth limit. // static char bitrateLimitName[DEFAULT_STRING_LENGTH] = { 0 }; // // String literal for image packing method. // static char packMethodName[DEFAULT_STRING_LENGTH] = { 0 }; // // Product name provided by the server or client. // static char productName[DEFAULT_STRING_LENGTH] = { 0 }; // // Its corresponding value from NXpack.h. // static int packMethod = -1; static int packQuality = -1; // // String literal for session type. Persistent caches // are searched in directory whose name matches this // parameter. // static char sessionType[DEFAULT_STRING_LENGTH] = { 0 }; // // Unique id assigned to session. It is used as // name of directory where all files are placed. // static char sessionId[DEFAULT_STRING_LENGTH] = { 0 }; // // Set if we already parsed the options. // static int parsedOptions = 0; static int parsedCommand = 0; // // Buffer data received from the remote proxy at // session negotiation. // static char remoteData[MAXIMUM_REMOTE_OPTIONS_LENGTH] = { 0 }; static int remotePosition = 0; // // Main loop file descriptors. // static int tcpFD = -1; static int unixFD = -1; static int cupsFD = -1; static int auxFD = -1; static int smbFD = -1; static int mediaFD = -1; static int httpFD = -1; static int fontFD = -1; static int slaveFD = -1; static int proxyFD = -1; // // Used for internal communication // with the X agent. // static int agentFD[2] = { -1, -1 }; // // Flags determining which protocols and // ports are forwarded. // int useUnixSocket = 1; static int useTcpSocket = 1; static int useCupsSocket = 0; static int useAuxSocket = 0; static int useSmbSocket = 0; static int useMediaSocket = 0; static int useHttpSocket = 0; static int useFontSocket = 0; static int useSlaveSocket = 0; static int useAgentSocket = 0; // // Set if the launchd service is running // and its socket must be used as X socket. // static int useLaunchdSocket = 0; // // Set by user if he/she wants to modify // the default TCP_NODELAY option as set // in control. // static int useNoDelay = -1; // // Set if user wants to override default // flush timeout set according to link. // static int usePolicy = -1; // // Set if user wants to hide the RENDER // extension or wants to short-circuit // some simple replies at client side. // static int useRender = -1; static int useTaint = -1; // // Set if the user wants to reduce the // nominal size of the token messages // exchanged between the proxies. // static int useStrict = -1; // // Set if the proxy is running as part // of SSH on the client. // static int useEncryption = -1; // // Name of Unix socket created by the client proxy to // accept client connections. File must be unlinked // by cleanup function. // static char unixSocketName[DEFAULT_STRING_LENGTH] = { 0 }; // // Other parameters. // static char acceptHost[DEFAULT_STRING_LENGTH] = { 0 }; static char displayHost[DEFAULT_STRING_LENGTH] = { 0 }; static char authCookie[DEFAULT_STRING_LENGTH] = { 0 }; static int loopbackBind = DEFAULT_LOOPBACK_BIND; static int proxyPort = DEFAULT_NX_PROXY_PORT; static int xPort = DEFAULT_NX_X_PORT; // // Used to setup the connection the real // X display socket. // static int xServerAddrFamily = -1; static sockaddr *xServerAddr = NULL; static unsigned int xServerAddrLength = 0; // // The representation of a Unix socket path or // a bind address, denoting where the local proxy // will await the peer connection. // static ChannelEndPoint listenSocket; // // The TCP host and port or Unix file socket where // the remote proxy will be contacted. // static ChannelEndPoint connectSocket; // // Helper channels are disabled by default. // static ChannelEndPoint cupsPort; static ChannelEndPoint auxPort; static ChannelEndPoint smbPort; static ChannelEndPoint mediaPort; static ChannelEndPoint httpPort; static ChannelEndPoint slavePort; // // Can be either a port number or a Unix // socket. // static char fontPort[DEFAULT_STRING_LENGTH] = { 0 }; // // Host and port where the existing proxy // is running. // static char bindHost[DEFAULT_STRING_LENGTH] = { 0 }; static int bindPort = -1; // // Pointers to the callback functions and // parameter set by the agent // static void (*flushCallback)(void *, int) = NULL; static void *flushParameter = NULL; static void (*statisticsCallback)(void *, int) = NULL; static void *statisticsParameter = NULL; // // State variables shared between the init // function and the main loop. // T_timestamp initTs; T_timestamp startTs; T_timestamp logsTs; T_timestamp nowTs; // // This is set to the main proxy process id. // int lastProxy = 0; // // Set to last dialog process launched by proxy. // int lastDialog = 0; // // Set to watchdog process launched by proxy. // int lastWatchdog = 0; // // Set if a cache house-keeper process is running. // int lastKeeper = 0; // // Let an inner routine register the pid of a slave // process. // static int lastChild = 0; // // Exit code of the last child process exited. // static int lastStatus = 0; // // Set if shutdown was requested through a signal. // static int lastKill = 0; // // Set if the agent confirmed the destruction of // the NX transport. // static int lastDestroy = 0; // // This is set to the code and local flag of the // last requested alert. // static struct { int code; int local; } lastAlert; // // Manage the current signal masks. // static struct { sigset_t saved; int blocked; int installed; int enabled[32]; int forward[32]; struct sigaction action[32]; } lastMasks; // // Manage the current timer. // static struct { struct sigaction action; struct itimerval value; struct timeval start; struct timeval next; } lastTimer; // // This is set to last signal received in handler. // static int lastSignal = 0; // // Set to the last time bytes readable were queried // by the agent. // static T_timestamp lastReadableTs = nullTimestamp(); // // Here are interfaces declared in NX.h. // int NXTransProxy(int fd, int mode, const char* options) { // // Let the log temporarily go to the standard // error. Be also sure we have a jump context, // in the case any subsequent operation will // cause a cleanup. // if (logofs == NULL) { logofs = &cerr; } if (setjmp(context) == 1) { nxinfo << "NXTransProxy: Out of the long jump with pid '" << lastProxy << "'.\n" << std::flush; return -1; } // // Check if have already performed a parsing of // parameters, as in the case we are running as // a stand-alone process. If needed create the // parameters repository // if (control == NULL) { control = new Control(); } lastProxy = getpid(); nxinfo << "NXTransProxy: Main process started with pid '" << lastProxy << "'.\n" << std::flush; SetMode(mode); if (mode == NX_MODE_CLIENT) { if (fd != NX_FD_ANY) { nxinfo << "NXTransProxy: Agent descriptor for X client connections is FD#" << fd << ".\n" << std::flush; nxinfo << "NXTransProxy: Disabling listening on further X client connections.\n" << std::flush; useTcpSocket = 0; useUnixSocket = 0; useAgentSocket = 1; agentFD[1] = fd; } } else if (mode == NX_MODE_SERVER) { if (fd != NX_FD_ANY) { nxinfo << "NXTransProxy: PANIC! Agent descriptor for X server connections " << "not supported yet.\n" << std::flush; cerr << "Error" << ": Agent descriptor for X server connections " << "not supported yet.\n"; return -1; } } const char *env = GetOptions(options); if (ParseEnvironmentOptions(env, 0) < 0) { cerr << "Error" << ": Parsing of NX transport options failed.\n"; return -1; } // // Set the path of the NX directories. // SetDirectories(); // // Open the log files. // SetLogs(); nxinfo << "NXTransProxy: Going to run the NX transport loop.\n" << std::flush; WaitCleanup(); // // This function should never return. // exit(0); } void NXTransExit(int code) { if (logofs == NULL) { logofs = &cerr; } static int recurse; if (++recurse > 1) { nxinfo << "NXTransExit: Aborting process with pid '" << getpid() << "' due to recursion through " << "exit.\n" << std::flush; abort(); } nxinfo << "NXTransExit: Process with pid '" << getpid() << "' called exit with code '" << code << "'.\n" << std::flush; if (control != NULL) { // // Be sure that there we can detect the // termination of the watchdog. // EnableSignals(); // // Close the NX transport if it was not // shut down already. // NXTransDestroy(NX_FD_ANY); } exit(code); } int NXTransParseCommandLine(int argc, const char **argv) { return ParseCommandLineOptions(argc, argv); } int NXTransParseEnvironment(const char *env, int force) { return ParseEnvironmentOptions(env, force); } void NXTransCleanup() { HandleCleanup(); } void NXTransCleanupForReconnect() { HandleCleanupForReconnect(); } // // Check the parameters for subsequent // initialization of the NX transport. // int NXTransCreate(int fd, int mode, const char* options) { if (logofs == NULL) { logofs = &cerr; } // // Be sure we have a jump context, in the // case a subsequent operation will cause // a cleanup. // if (setjmp(context) == 1) { return -1; } // // Create the parameters repository // if (control != NULL) { nxfatal << "NXTransCreate: PANIC! The NX transport seems " << "to be already running.\n" << std::flush; cerr << "Error" << ": The NX transport seems " << "to be already running.\n"; return -1; } control = new Control(); if (control == NULL) { nxfatal << "Loop: PANIC! Error creating the NX transport.\n" << std::flush; cerr << "Error" << ": Error creating the NX transport.\n"; return -1; } lastProxy = getpid(); nxinfo << "NXTransCreate: Caller process running with pid '" << lastProxy << "'.\n" << std::flush; // // Set the local proxy mode an parse the // display NX options. // SetMode(mode); const char *env = GetOptions(options); if (ParseEnvironmentOptions(env, 0) < 0) { cerr << "Error" << ": Parsing of NX transport options failed.\n"; return -1; } // // Set the path of the NX directories. // SetDirectories(); // // Open the log files. // SetLogs(); // // Use the provided descriptor. // proxyFD = fd; nxinfo << "NXTransCreate: Called with NX proxy descriptor '" << proxyFD << "'.\n" << std::flush; nxinfo << "NXTransCreate: Creation of the NX transport completed.\n" << std::flush; return 1; } // // Tell the proxy to use the descriptor as the internal // connection to the X client side NX agent. This will // have the side effect of disabling listening for add- // itional X client connections. // int NXTransAgent(int fd[2]) { // // Be sure we have a jump context, in the // case a subsequent operation will cause // a cleanup. // if (logofs == NULL) { logofs = &cerr; } if (setjmp(context) == 1) { return -1; } if (control == NULL) { cerr << "Error" << ": Can't set the NX agent without a NX transport.\n"; return -1; } else if (control -> ProxyMode != proxy_client) { nxfatal << "NXTransAgent: Invalid mode while setting the NX agent.\n" << std::flush; cerr << "Error" << ": Invalid mode while setting the NX agent.\n\n"; return -1; } useTcpSocket = 0; useUnixSocket = 0; useAgentSocket = 1; agentFD[0] = fd[0]; agentFD[1] = fd[1]; nxinfo << "NXTransAgent: Internal descriptors for agent are FD#" << agentFD[0] << " and FD#" << agentFD[1] << ".\n" << std::flush; nxinfo << "NXTransAgent: Disabling listening for further X client " << "connections.\n" << std::flush; agent = new Agent(agentFD); if (agent == NULL || agent -> isValid() != 1) { nxfatal << "Loop: PANIC! Error creating the NX memory transport .\n" << std::flush; cerr << "Error" << ": Error creating the NX memory transport.\n"; HandleCleanup(); } nxinfo << "NXTransAgent: Enabling memory-to-memory transport.\n" << std::flush; return 1; } int NXTransClose(int fd) { if (logofs == NULL) { logofs = &cerr; } /* * Only handle the proxy connection. The X * transport will take care of closing its * end of the socket pair. */ if (control != NULL && ((agent != NULL && (fd == agentFD[0] || fd == NX_FD_ANY)) || (fd == proxyFD || fd == NX_FD_ANY))) { if (proxy != NULL) { nxinfo << "NXTransClose: Closing down all the X connections.\n" << std::flush; CleanupConnections(); } } else { nxinfo << "NXTransClose: The NX transport is not running.\n" << std::flush; } return 1; } // // Close down the transport and free the // allocated NX resources. // int NXTransDestroy(int fd) { if (logofs == NULL) { logofs = &cerr; } if (control != NULL && ((agent != NULL && (fd == agentFD[0] || fd == NX_FD_ANY)) || (fd == proxyFD || fd == NX_FD_ANY))) { // // Shut down the X connections and // wait the cleanup to complete. // if (proxy != NULL) { nxinfo << "NXTransDestroy: Closing down all the X connections.\n" << std::flush; CleanupConnections(); } nxinfo << "NXTransDestroy: Waiting for the NX transport to terminate.\n" << std::flush; lastDestroy = 1; WaitCleanup(); } else { nxinfo << "NXTransDestroy: The NX transport is not running.\n" << std::flush; } return 1; } // // Assume that the NX transport is valid // as long as the control class has not // been destroyed. // int NXTransRunning(int fd) { return (control != NULL); } // // FIXME: why timeval? Passing milliseconds would be more convenient, // the timeval struct/T_timestamp could be built on demand. // int NXTransContinue(struct timeval *selectTs) { if (control != NULL) { // // If no timeout is provided use // the default. // T_timestamp newTs; if (selectTs == NULL) { setTimestamp(newTs, control -> PingTimeout); selectTs = &newTs; } // // Use empty masks and only get the // descriptors set by the proxy. // fd_set readSet; fd_set writeSet; int setFDs; int errorFDs; int resultFDs; setFDs = 0; FD_ZERO(&readSet); FD_ZERO(&writeSet); // // Run a new loop. If the transport // is gone avoid sleeping until the // timeout. // if (NXTransPrepare(&setFDs, &readSet, &writeSet, selectTs) != 0) { NXTransSelect(&resultFDs, &errorFDs, &setFDs, &readSet, &writeSet, selectTs); NXTransExecute(&resultFDs, &errorFDs, &setFDs, &readSet, &writeSet, selectTs); } } return (control != NULL); } int NXTransSignal(int signal, int action) { if (logofs == NULL) { logofs = &cerr; } if (control == NULL) { return 0; } if (action == NX_SIGNAL_RAISE) { nxinfo << "NXTransSignal: Raising signal '" << DumpSignal(signal) << "' in the proxy handler.\n" << std::flush; HandleSignal(signal); return 1; } else if (signal == NX_SIGNAL_ANY) { nxinfo << "NXTransSignal: Setting action of all signals to '" << action << "'.\n" << std::flush; for (int i = 0; i < 32; i++) { if (CheckSignal(i) == 1) { NXTransSignal(i, action); } } return 1; } else if (CheckSignal(signal) == 1) { nxinfo << "NXTransSignal: Setting action of signal '" << DumpSignal(signal) << "' to '" << action << "'.\n" << std::flush; if (action == NX_SIGNAL_ENABLE || action == NX_SIGNAL_FORWARD) { InstallSignal(signal, action); return 1; } else if (action == NX_SIGNAL_DISABLE) { RestoreSignal(signal); return 1; } } nxwarn << "NXTransSignal: WARNING! Unable to perform action '" << action << "' on signal '" << DumpSignal(signal) << "'.\n" << std::flush; cerr << "Warning" << ": Unable to perform action '" << action << "' on signal '" << DumpSignal(signal) << "'.\n"; return -1; } int NXTransCongestion(int fd) { if (control != NULL && proxy != NULL) { int congestion = proxy -> getCongestion(proxyFD); nxdbg << "NXTransCongestion: Returning " << congestion << " as current congestion level.\n" << std::flush; return congestion; return (proxy -> getCongestion(proxyFD)); } return 0; } int NXTransHandler(int fd, int type, void (*handler)(void *parameter, int reason), void *parameter) { if (logofs == NULL) { logofs = &cerr; } switch (type) { case NX_HANDLER_FLUSH: { flushCallback = handler; flushParameter = parameter; break; } case NX_HANDLER_STATISTICS: { // // Reporting of statistics by the agent // still needs to be implemented. // statisticsCallback = handler; statisticsParameter = parameter; break; } default: { nxinfo << "NXTransHandler: WARNING! Failed to set " << "the NX callback for event '" << type << "' to '" << (void *) handler << "' and parameter '" << parameter << "'.\n" << std::flush; return 0; } } nxinfo << "NXTransHandler: Set the NX " << "callback for event '" << type << "' to '" << (void *) handler << "' and parameter '" << parameter << "'.\n" << std::flush; return 1; } int NXTransRead(int fd, char *data, int size) { if (logofs == NULL) { logofs = &cerr; } if (control != NULL && agent != NULL && fd == agentFD[0]) { nxdbg << "NXTransRead: Dequeuing " << size << " bytes " << "from FD#" << agentFD[0] << ".\n" << std::flush; int result = agent -> dequeueData(data, size); if (result < 0 && EGET() == EAGAIN) { nxdbg << "NXTransRead: WARNING! Dequeuing from FD#" << agentFD[0] << " would block.\n" << std::flush; } else { nxdbg << "NXTransRead: Dequeued " << result << " bytes " << "to FD#" << agentFD[0] << ".\n" << std::flush; } return result; } else { nxdbg << "NXTransRead: Reading " << size << " bytes " << "from FD#" << fd << ".\n" << std::flush; return read(fd, data, size); } } int NXTransReadVector(int fd, struct iovec *iovdata, int iovsize) { if (logofs == NULL) { logofs = &cerr; } if (control != NULL && agent != NULL && fd == agentFD[0]) { if (control -> ProxyStage >= stage_operational && agent -> localReadable() > 0) { nxdbg << "NXTransReadVector: WARNING! Agent has data readable.\n" << std::flush; } char *base; int length; int result; struct iovec *vector = iovdata; int count = iovsize; ESET(0); int i = 0; int total = 0; for (; i < count; i++, vector++) { length = vector -> iov_len; base = (char *) vector -> iov_base; while (length > 0) { nxdbg << "NXTransReadVector: Dequeuing " << length << " bytes " << "from FD#" << agentFD[0] << ".\n" << std::flush; result = agent -> dequeueData(base, length); if (result < 0 && EGET() == EAGAIN) { nxdbg << "NXTransReadVector: WARNING! Dequeuing from FD#" << agentFD[0] << " would block.\n" << std::flush; } else { nxdbg << "NXTransReadVector: Dequeued " << result << " bytes " << "from FD#" << agentFD[0] << ".\n" << std::flush; } if (result < 0 && total == 0) { return result; } else if (result <= 0) { return total; } ESET(0); length -= result; total += result; base += result; } } return total; } else { nxdbg << "NXTransReadVector: Reading vector with " << iovsize << " elements from FD#" << fd << ".\n" << std::flush; return readv(fd, iovdata, iovsize); } } int NXTransReadable(int fd, int *readable) { if (logofs == NULL) { logofs = &cerr; } if (control == NULL || agent == NULL || fd != agentFD[0]) { int result = GetBytesReadable(fd, readable); if (result == -1) { nxdbg << "NXTransReadable: Error detected on FD#" << fd << ".\n" << std::flush; } else { nxdbg << "NXTransReadable: Returning " << *readable << " bytes as readable from FD#" << fd << ".\n" << std::flush; } return result; } int result = agent -> dequeuableData(); switch (result) { case 0: { // // The client might have enqueued data to our side // and is now checking for the available events. As // _XEventsQueued() may omit to call _XSelect(), we // handle here the new data that is coming from the // proxy to avoid spinning through this function // again. // if (proxy != NULL && proxy -> canRead() == 1) { nxinfo << "NXTransReadable: WARNING! Trying to " << "read to generate new agent data.\n" << std::flush; // // Set the context as the function // can cause a cleanup. // if (setjmp(context) == 1) { return -1; } if (proxy -> handleRead() < 0) { nxinfo << "NXTransReadable: Failure reading " << "messages from proxy FD#" << proxyFD << ".\n" << std::flush; HandleShutdown(); } // // Call again the routine. By reading // new control messages from the proxy // the agent channel may be gone. // return NXTransReadable(fd, readable); } nxdbg << "NXTransReadable: Returning " << 0 << " bytes as readable from FD#" << fd << " with result 0.\n" << std::flush; *readable = 0; return 0; } case -1: { nxdbg << "NXTransReadable: Returning " << 0 << " bytes as readable from FD#" << fd << " with result -1.\n" << std::flush; *readable = 0; return -1; } default: { nxdbg << "NXTransReadable: Returning " << result << " bytes as readable from FD#" << fd << " with result 0.\n" << std::flush; *readable = result; return 0; } } } int NXTransWrite(int fd, char *data, int size) { // // Be sure we have a valid log file. // if (logofs == NULL) { logofs = &cerr; } if (control != NULL && agent != NULL && fd == agentFD[0]) { int result; if (proxy != NULL) { if (proxy -> canRead(agentFD[1]) == 0) { nxdbg << "NXTransWrite: WARNING! Delayed enqueuing to FD#" << agentFD[0] << " with proxy unable to read.\n" << std::flush; ESET(EAGAIN); return -1; } // // Set the context as the function // can cause a cleanup. // if (setjmp(context) == 1) { return -1; } // // Don't enqueue the data to the transport // but let the channel borrow the buffer. // nxdbg << "NXTransWrite: Letting the channel borrow " << size << " bytes from FD#" << agentFD[0] << ".\n" << std::flush; result = proxy -> handleRead(agentFD[1], data, size); if (result == 1) { result = size; } else { if (result == 0) { ESET(EAGAIN); } else { ESET(EPIPE); } result = -1; } } else { // // We don't have a proxy connection, yet. // Enqueue the data to the agent transport. // nxdbg << "NXTransWrite: Enqueuing " << size << " bytes " << "to FD#" << agentFD[0] << ".\n" << std::flush; result = agent -> enqueueData(data, size); } if (result < 0) { if (EGET() == EAGAIN) { nxdbg << "NXTransWrite: WARNING! Enqueuing to FD#" << agentFD[0] << " would block.\n" << std::flush; } else { nxdbg << "NXTransWrite: WARNING! Error enqueuing to FD#" << agentFD[0] << ".\n" << std::flush; } } else { nxdbg << "NXTransWrite: Enqueued " << result << " bytes " << "to FD#" << agentFD[0] << ".\n" << std::flush; } return result; } else { nxdbg << "NXTransWrite: Writing " << size << " bytes " << "to FD#" << fd << ".\n" << std::flush; return write(fd, data, size); } } int NXTransWriteVector(int fd, struct iovec *iovdata, int iovsize) { // // Be sure we have a valid log file and a // jump context because we will later call // functions that can perform a cleanup. // if (logofs == NULL) { logofs = &cerr; } int result = 0; if (control != NULL && agent != NULL && fd == agentFD[0]) { // // See the comment in NXTransWrite(). // if (proxy != NULL) { if (proxy -> canRead(agentFD[1]) == 0) { nxdbg << "NXTransWriteVector: WARNING! Delayed enqueuing to FD#" << agentFD[0] << " with proxy unable to read.\n" << std::flush; ESET(EAGAIN); return -1; } } // // Set the context as the function // can cause a cleanup. // if (setjmp(context) == 1) { return -1; } char *base; int length; struct iovec *vector = iovdata; int count = iovsize; ESET(0); int i = 0; int total = 0; for (; i < count; i++, vector++) { length = vector -> iov_len; base = (char *) vector -> iov_base; while (length > 0) { if (proxy != NULL) { // // Don't enqueue the data to the transport // but let the channel borrow the buffer. // nxdbg << "NXTransWriteVector: Letting the channel borrow " << length << " bytes from FD#" << agentFD[0] << ".\n" << std::flush; result = proxy -> handleRead(agentFD[1], base, length); if (result == 1) { result = length; } else { if (result == 0) { ESET(EAGAIN); } else { ESET(EPIPE); } result = -1; } } else { // // We don't have a proxy connection, yet. // Enqueue the data to the agent transport. // nxdbg << "NXTransWriteVector: Enqueuing " << length << " bytes " << "to FD#" << agentFD[0] << ".\n" << std::flush; result = agent -> enqueueData(base, length); } if (result < 0) { if (EGET() == EAGAIN) { nxdbg << "NXTransWriteVector: WARNING! Enqueuing to FD#" << agentFD[0] << " would block.\n" << std::flush; } else { nxdbg << "NXTransWriteVector: WARNING! Error enqueuing to FD#" << agentFD[0] << ".\n" << std::flush; } } else { nxdbg << "NXTransWriteVector: Enqueued " << result << " bytes " << "to FD#" << agentFD[0] << ".\n" << std::flush; } if (result < 0 && total == 0) { return result; } else if (result <= 0) { return total; } ESET(0); length -= result; total += result; base += result; } } return total; } else { nxdbg << "NXTransWriteVector: Writing vector with " << iovsize << " elements to FD#" << fd << ".\n" << std::flush; return writev(fd, iovdata, iovsize); } } int NXTransPolicy(int fd, int type) { if (control != NULL) { if (usePolicy == -1) { nxinfo << "NXTransPolicy: Setting flush policy on " << "proxy FD#" << proxyFD << " to '" << DumpPolicy(type == NX_POLICY_DEFERRED ? policy_deferred : policy_immediate) << "'.\n" << std::flush; control -> FlushPolicy = (type == NX_POLICY_DEFERRED ? policy_deferred : policy_immediate); if (proxy != NULL) { proxy -> handleFlush(); } return 1; } else { nxinfo << "NXTransPolicy: Ignoring the agent " << "setting with user policy set to '" << DumpPolicy(control -> FlushPolicy) << "'.\n" << std::flush; return 0; } } return 0; } int NXTransFlushable(int fd) { if (proxy == NULL || agent == NULL || fd != agentFD[0]) { nxdbg << "NXTransFlushable: Returning 0 bytes as " << "flushable for unrecognized FD#" << fd << ".\n" << std::flush; return 0; } else { nxdbg << "NXTransFlushable: Returning " << proxy -> getFlushable(proxyFD) << " as bytes flushable on " << "proxy FD#" << proxyFD << ".\n" << std::flush; return proxy -> getFlushable(proxyFD); } } int NXTransFlush(int fd) { if (proxy != NULL) { nxinfo << "NXTransFlush: Requesting an immediate flush of " << "proxy FD#" << proxyFD << ".\n" << std::flush; return proxy -> handleFlush(); } return 0; } int NXTransChannel(int fd, int channelFd, int type) { if (proxy != NULL) { // // Set the context as the function // can cause a cleanup. // if (setjmp(context) == 1) { return -1; } nxinfo << "NXTransChannel: Going to create a new channel " << "with type '" << type << "' on FD#" << channelFd << ".\n" << std::flush; int result = -1; switch (type) { case NX_CHANNEL_X11: { if (useUnixSocket == 1 || useTcpSocket == 1 || useAgentSocket == 1 || useAuxSocket == 1) { result = proxy -> handleNewConnection(channel_x11, channelFd); } break; } case NX_CHANNEL_CUPS: { if (useCupsSocket == 1) { result = proxy -> handleNewConnection(channel_cups, channelFd); } break; } case NX_CHANNEL_SMB: { if (useSmbSocket == 1) { result = proxy -> handleNewConnection(channel_smb, channelFd); } break; } case NX_CHANNEL_MEDIA: { if (useMediaSocket == 1) { result = proxy -> handleNewConnection(channel_media, channelFd); } break; } case NX_CHANNEL_HTTP: { if (useHttpSocket == 1) { result = proxy -> handleNewConnection(channel_http, channelFd); } break; } case NX_CHANNEL_FONT: { if (useFontSocket == 1) { result = proxy -> handleNewConnection(channel_font, channelFd); } break; } case NX_CHANNEL_SLAVE: { if (useSlaveSocket == 1) { result = proxy -> handleNewConnection(channel_slave, channelFd); } break; } default: { nxwarn << "NXTransChannel: WARNING! Unrecognized channel " << "type '" << type << "'.\n" << std::flush; break; } } if (result != 1) { nxwarn << "NXTransChannel: WARNING! Could not create the " << "new channel with type '" << type << "' on FD#" << channelFd << ".\n" << std::flush; } return result; } return 0; } const char *NXTransFile(int type) { char *name = NULL; switch (type) { case NX_FILE_SESSION: { name = sessionFileName; break; } case NX_FILE_ERRORS: { name = errorsFileName; break; } case NX_FILE_OPTIONS: { name = optionsFileName; break; } case NX_FILE_STATS: { name = statsFileName; break; } } if (name != NULL && *name != '\0') { return name; } return NULL; } long NXTransTime() { static T_timestamp last = getTimestamp(); T_timestamp now = getTimestamp(); long diff = diffTimestamp(last, now); last = now; return diff; } int NXTransAlert(int code, int local) { if (proxy != NULL) { nxdbg << "NXTransAlert: Requesting a NX dialog with code " << code << " and local " << local << ".\n" << std::flush; if (local == 0) { // // Set the context as the function // can cause a cleanup. // if (setjmp(context) == 1) { return -1; } proxy -> handleAlert(code); } else { // // Show the alert at the next loop. // HandleAlert(code, local); } return 1; } else { if (logofs == NULL) { logofs = &cerr; } nxdbg << "NXTransAlert: Can't request an alert without " << "a valid NX transport.\n" << std::flush; } return 0; } // // Prepare the file sets and the timeout // for a later execution of the select(). // int NXTransPrepare(int *setFDs, fd_set *readSet, fd_set *writeSet, struct timeval *selectTs) { if (logofs == NULL) { logofs = &cerr; } // // Control is NULL if the NX transport was // reset or was never created. If control // is valid then prepare to jump back when // the transport is destroyed. // if (control == NULL || setjmp(context) == 1) { return 0; } nxinfo << "NXTransPrepare: Going to prepare the NX transport.\n" << std::flush; if (control -> ProxyStage < stage_operational) { handleNegotiationInLoop(*setFDs, *readSet, *writeSet, *selectTs); } else { if (isTimestamp(*selectTs) == 0) { nxinfo << "Loop: WARNING! Preparing the select with requested " << "timeout of " << selectTs -> tv_sec << " s and " << (double) selectTs -> tv_usec / 1000 << " ms.\n" << std::flush; } else { nxinfo << "Loop: Preparing the select with requested " << "timeout of " << selectTs -> tv_sec << " s and " << (double) selectTs -> tv_usec / 1000 << " ms.\n" << std::flush; } // // Set descriptors of listening sockets. // handleSetListenersInLoop(*readSet, *setFDs); // // Set descriptors of both proxy and X // connections. // handleSetReadInLoop(*readSet, *setFDs, *selectTs); // // Find out which file descriptors have // data to write. // handleSetWriteInLoop(*writeSet, *setFDs, *selectTs); } // // Prepare the masks for handling the memory- // to-memory transport. This is required even // during session negotiation. // if (agent != NULL) { handleSetAgentInLoop(*setFDs, *readSet, *writeSet, *selectTs); } // // Register time spent handling messages. // nowTs = getNewTimestamp(); int diffTs = diffTimestamp(startTs, nowTs); nxinfo << "Loop: Mark - 0 - at " << strMsTimestamp() << " with " << diffTs << " ms elapsed.\n" << std::flush; // // TODO: Should add the read time in two // parts otherwise the limits are checked // before the counters are updated with // time spent in the last loop. // if (control -> ProxyStage >= stage_operational) { statistics -> addReadTime(diffTs); } startTs = nowTs; nxdbg << "Loop: New timestamp is " << strMsTimestamp(startTs) << ".\n" << std::flush; return 1; } // // Let's say that we call select() to find out // if any of the handled descriptors has data, // but actually things are a bit more complex // than that. // int NXTransSelect(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet, fd_set *writeSet, struct timeval *selectTs) { int diffTs; static T_timestamp lastTs; if (logofs == NULL) { logofs = &cerr; } // // Control is NULL if the NX transport was // reset or never created. If control is // valid then prepare for jumping back in // the case of an error. // if (control == NULL || setjmp(context) == 1) { *resultFDs = select(*setFDs, readSet, writeSet, NULL, selectTs); *errorFDs = errno; return 0; } nxinfo << "NXTransSelect: Going to select the NX descriptors.\n" << std::flush; handleCheckSelectInLoop(*setFDs, *readSet, *writeSet, *selectTs); diffTs = diffTimestamp(lastTs, getNewTimestamp()); if (diffTs > 20) { nxdbg << "Loop: TIME! Spent " << diffTs << " ms handling messages for proxy FD#" << proxyFD << ".\n" << std::flush; } lastTs = getNewTimestamp(); if (isTimestamp(*selectTs) == 0) { nxinfo << "Loop: WARNING! Executing the select with requested " << "timeout of " << selectTs -> tv_sec << " s and " << (double) selectTs -> tv_usec / 1000 << " ms.\n" << std::flush; } else if (proxy != NULL && proxy -> getFlushable(proxyFD) > 0) { nxinfo << "Loop: WARNING! Proxy FD#" << proxyFD << " has " << proxy -> getFlushable(proxyFD) << " bytes to write but timeout is " << selectTs -> tv_sec << " s and " << selectTs -> tv_usec / 1000 << " ms.\n" << std::flush; } // // Wait for the selected sockets // or the timeout. // ESET(0); *resultFDs = select(*setFDs, readSet, writeSet, NULL, selectTs); *errorFDs = EGET(); diffTs = diffTimestamp(lastTs, getNewTimestamp()); if (diffTs > 100) { nxdbg << "Loop: TIME! Spent " << diffTs << " ms waiting for new data for proxy FD#" << proxyFD << ".\n" << std::flush; } lastTs = getNewTimestamp(); // // Check the result of the select. // handleCheckResultInLoop(*resultFDs, *errorFDs, *setFDs, *readSet, *writeSet, *selectTs, startTs); // // Get time spent in select. The accouting is done // in milliseconds. This is a real problem on fast // machines where each loop is unlikely to take // more than 500 us, so consider that the results // can be inaccurate. // nowTs = getNewTimestamp(); diffTs = diffTimestamp(startTs, nowTs); nxinfo << "Loop: Out of select after " << diffTs << " ms " << "at " << strMsTimestamp(nowTs) << " with result " << *resultFDs << ".\n" << std::flush; startTs = nowTs; nxdbg << "Loop: New timestamp is " << strMsTimestamp(startTs) << ".\n" << std::flush; if (control -> ProxyStage >= stage_operational) { statistics -> addIdleTime(diffTs); } if (*resultFDs < 0) { // // Check if the call was interrupted or if any of the // managed descriptors has become invalid. This can // happen to the X11 code, before the descriptor is // removed from the managed set. // #ifdef __sun if (*errorFDs == EINTR || *errorFDs == EBADF || *errorFDs == EINVAL) #else if (*errorFDs == EINTR || *errorFDs == EBADF) #endif { if (*errorFDs == EINTR) { nxinfo << "Loop: Select failed due to EINTR error.\n" << std::flush; } else { nxinfo << "Loop: WARNING! Call to select failed. Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; } } else { nxfatal << "Loop: PANIC! Call to select failed. Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Call to select failed. Error is " << EGET() << " '" << ESTR() << "'.\n"; HandleCleanup(); } } return 1; } // // Perform the required actions on all // the descriptors having I/O pending. // int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet, fd_set *writeSet, struct timeval *selectTs) { if (logofs == NULL) { logofs = &cerr; } // // Control is NULL if the NX transport was // reset or never created. If control is // valid then prepare for jumping back in // the case of an error. // if (control == NULL || setjmp(context) == 1) { return 0; } nxinfo << "NXTransExecute: Going to execute I/O on the NX descriptors.\n" << std::flush; if (control -> ProxyStage >= stage_operational) { // // Check if I/O is possible on the proxy and // local agent descriptors. // if (agent != NULL) { handleAgentInLoop(*resultFDs, *errorFDs, *setFDs, *readSet, *writeSet, *selectTs); } nxinfo << "Loop: Mark - 1 - at " << strMsTimestamp() << " with " << diffTimestamp(startTs, getTimestamp()) << " ms elapsed.\n" << std::flush; // // Rotate the channel that will be handled // first. // handleRotateInLoop(); // // Flush any data on newly writable sockets. // handleWritableInLoop(*resultFDs, *writeSet); nxinfo << "Loop: Mark - 2 - at " << strMsTimestamp() << " with " << diffTimestamp(startTs, getTimestamp()) << " ms elapsed.\n" << std::flush; // // Check if any socket has become readable. // handleReadableInLoop(*resultFDs, *readSet); nxinfo << "Loop: Mark - 3 - at " << strMsTimestamp() << " with " << diffTimestamp(startTs, getTimestamp()) << " ms elapsed.\n" << std::flush; // // Handle the scheduled events on channels. // // - Restart, if possible, any client that was // put to sleep. // // - Check if there are pointer motion events to // flush. This applies only to X server side. // // - Check if any channel has exited the conges- // tion state. // // - Check if there are images that are currently // being streamed. // handleEventsInLoop(); nxinfo << "Loop: Mark - 4 - at " << strMsTimestamp() << " with " << diffTimestamp(startTs, getTimestamp()) << " ms elapsed.\n" << std::flush; // // Check if user sent a signal to produce // statistics. // handleStatisticsInLoop(); // // We may have flushed the proxy link or // handled data coming from the remote. // Post-process the masks and set the // selected agent descriptors as ready. // if (agent != NULL) { handleAgentLateInLoop(*resultFDs, *errorFDs, *setFDs, *readSet, *writeSet, *selectTs); } nxinfo << "Loop: Mark - 5 - at " << strMsTimestamp() << " with " << diffTimestamp(startTs, getTimestamp()) << " ms elapsed.\n" << std::flush; // // Check if there is any data to flush. // Agents should flush the proxy link // explicitly. // handleFlushInLoop(); nxinfo << "Loop: Mark - 6 - at " << strMsTimestamp() << " with " << diffTimestamp(startTs, getTimestamp()) << " ms elapsed.\n" << std::flush; } // // Check if we have an alert to show. // handleAlertInLoop(); if (control -> ProxyStage >= stage_operational) { // // Check if it's time to give up. // handleCheckSessionInLoop(); // // Check if local proxy is consuming // too many resources. // handleCheckBitrateInLoop(); // // Check coherency of internal state. // handleCheckStateInLoop(*setFDs); nxinfo << "Loop: Mark - 7 - at " << strMsTimestamp() << " with " << diffTimestamp(startTs, getTimestamp()) << " ms elapsed.\n" << std::flush; } // // Truncate the logs if needed. // handleLogReopenInLoop(logsTs, nowTs); return 1; } // // Initialize the connection parameters and // prepare for negotiating the link with the // remote proxy. // int InitBeforeNegotiation() { // // Disable limits on core dumps. // SetCore(); // // Install the signal handlers. // InstallSignals(); // // Track how much time we spent in initialization. // nowTs = getNewTimestamp(); startTs = nowTs; initTs = nowTs; nxinfo << "Loop: INIT! Taking mark for initialization at " << strMsTimestamp(initTs) << ".\n" << std::flush; // // If not explicitly specified, determine if local // mode is client or server according to parameters // provided so far. // if (WE_SET_PROXY_MODE == 0) { cerr << "Error" << ": Please specify either the -C or -S option.\n"; HandleCleanup(); } // // Start a watchdog. If initialization cannot // be completed before timeout, then clean up // everything and exit. // if (control -> ProxyMode == proxy_client) { nxinfo << "Loop: Starting watchdog process with timeout of " << control -> InitTimeout / 1000 << " seconds.\n" << std::flush; lastWatchdog = NXTransWatchdog(control -> InitTimeout); if (IsFailed(lastWatchdog)) { nxfatal << "Loop: PANIC! Can't start the NX watchdog process.\n" << std::flush; SetNotRunning(lastWatchdog); } else { nxinfo << "Loop: Watchdog started with pid '" << lastWatchdog << "'.\n" << std::flush; } } // // Print preliminary info. // PrintProcessInfo(); // // Set cups, multimedia and other // auxiliary ports. // SetPorts(); // // Increase the number of maximum open // file descriptors for this process. // SetDescriptors(); // // Set local endianness. // unsigned int test = 1; setHostBigEndian(*((unsigned char *) (&test)) == 0); nxinfo << "Loop: Local host is " << (hostBigEndian() ? "big endian" : "little endian") << ".\n" << std::flush; if (control -> ProxyMode == proxy_client) { // // Listen on sockets that mimic an X display to // which X clients will be able to connect (e.g. // unix:8 and/or localhost:8). // if (useTcpSocket == 1) { SetupTcpSocket(); } if (useUnixSocket == 1) { SetupUnixSocket(); } } else { // // Don't listen for X connections. // useUnixSocket = 0; useTcpSocket = 0; useAgentSocket = 0; // // Get ready to open the local display. // delete xServerAddr; xServerAddr = NULL; SetupDisplaySocket(xServerAddrFamily, xServerAddr, xServerAddrLength); } // // If we are the NX server-side proxy we need to // complete our initializazion. We will mandate // our parameters at the time the NX client will // connect. // if (control -> ProxyMode == proxy_client) { SetParameters(); } return 1; } int SetupProxyConnection() { if (proxyFD == -1) { char *socketUri = NULL; // Let's make sure, the default value for listenSocket is properly set. Doing this // here, because we have to make sure that we call it after the connectSocket // declaration is really really complete. if (listenSocket.disabled() && connectSocket.disabled()) { char listenPortValue[20] = { 0 }; sprintf(listenPortValue, "%ld", (long)(proxyPort + DEFAULT_NX_PROXY_PORT_OFFSET)); SetAndValidateChannelEndPointArg("local", "listen", listenPortValue, listenSocket); } connectSocket.getSpec(&socketUri); nxinfo << "Loop: connectSocket is "<< ( connectSocket.enabled() ? "enabled" : "disabled") << ". " << "The socket URI is '"<< ( socketUri != NULL ? socketUri : "") << "'.\n" << std::flush; SAFE_FREE(socketUri); listenSocket.getSpec(&socketUri); nxinfo << "Loop: listenSocket is "<< ( listenSocket.enabled() ? "enabled" : "disabled") << ". " << "The socket URI is '"<< ( socketUri != NULL ? socketUri : "") << "'.\n" << std::flush; SAFE_FREE(socketUri); if (WE_INITIATE_CONNECTION) { if (connectSocket.getSpec(&socketUri)) { nxinfo << "Loop: Going to connect to '" << socketUri << "'.\n" << std::flush; SAFE_FREE(socketUri); proxyFD = ConnectToRemote(connectSocket); nxinfo << "Loop: Connected to remote proxy on FD#" << proxyFD << ".\n" << std::flush; cerr << "Info" << ": Connected to remote proxy on FD#" << proxyFD << ".\n"; } } else { if (listenSocket.isTCPSocket() && (listenSocket.getTCPPort() < 0)) { listenSocket.setSpec(DEFAULT_NX_PROXY_PORT_OFFSET + proxyPort); } if (listenSocket.getSpec(&socketUri)) { nxinfo << "Loop: Going to wait for connection at '" << socketUri << "'.\n" << std::flush; SAFE_FREE(socketUri); proxyFD = WaitForRemote(listenSocket); if (WE_LISTEN_FORWARDER) { nxinfo << "Loop: Connected to remote forwarder on FD#" << proxyFD << ".\n" << std::flush; } else { nxinfo << "Loop: Connected to remote proxy on FD#" << proxyFD << ".\n" << std::flush; } } } } else { nxinfo << "Loop: Using the inherited connection on FD#" << proxyFD << ".\n" << std::flush; } // // Set TCP_NODELAY on proxy descriptor // to reduce startup time. Option will // later be disabled if needed. // // either listenSocket or connectSocket is used here... if(listenSocket.isTCPSocket() || connectSocket.isTCPSocket()) SetNoDelay(proxyFD, 1); // // We need non-blocking input since the // negotiation phase. // SetNonBlocking(proxyFD, 1); return 1; } // // Create the required proxy and channel classes // and get ready for handling the encoded traffic. // int InitAfterNegotiation() { nxinfo << "Loop: Connection with remote proxy completed.\n" << std::flush; cerr << "Info" << ": Connection with remote proxy completed.\n" << logofs_flush; // // If we are the server proxy we completed // our initializazion phase according to // the values provided by the client side. // if (control -> ProxyMode == proxy_server) { SetParameters(); } // // Set up the listeners for the additional // services. // SetupServiceSockets(); // // Create the proxy class and the statistics // repository and pass all the configuration // data we negotiated with the remote peer. // SetupProxyInstance(); // // We completed both parsing of user's parameters // and handlshaking with remote proxy. Now print // a brief summary including the most significant // control values. // PrintConnectionInfo(); // // Cancel the initialization watchdog. // if (IsRunning(lastWatchdog)) { KillProcess(lastWatchdog, "watchdog", SIGTERM, 1); SetNotRunning(lastWatchdog); lastSignal = 0; } // // Start the house-keeper process. It will // remove the oldest persistent caches, if // the amount of storage exceed the limits // set by the user. // StartKeeper(); // // Set the log size check timestamp. // nowTs = getNewTimestamp(); logsTs = nowTs; // // TODO: Due to the way the new NX transport is working, // the accounting of time spent handling messages must // be rewritten. In particular, at the moment it only // shows the time spent encoding and decoding messages // in the main loop, after executing a select. It doesn't // take into account the time spent in the NXTrans* calls // where messages can be encoded and decoded implicitly, // on demand of the agent. When the agent transport is // in use, these calls constitute the vast majority of // the encoding activity. The result is that the number // of KB encoded per second shown by the proxy statistics // is actually much lower than the real throughput gene- // rated by the proxy. // nxinfo << "Loop: INIT! Completed initialization at " << strMsTimestamp(nowTs) << " with " << diffTimestamp(initTs, nowTs) << " ms " << "since the init mark.\n" << std::flush; initTs = getNewTimestamp(); // // We can now start handling binary data from // our peer proxy. // if (agent == NULL) { cerr << "Session" << ": Session started at '" << strTimestamp() << "'.\n"; } return 1; } int SetMode(int mode) { // // Set the local proxy mode. // if (control -> ProxyMode == proxy_undefined) { if (mode == NX_MODE_CLIENT) { nxinfo << "Loop: INIT! Initializing with mode " << "NX_MODE_CLIENT at " << strMsTimestamp() << ".\n" << std::flush; control -> ProxyMode = proxy_client; } else if (mode == NX_MODE_SERVER) { nxinfo << "Loop: INIT! Initializing with mode " << "NX_MODE_SERVER at " << strMsTimestamp() << ".\n" << std::flush; control -> ProxyMode = proxy_server; } else { cerr << "Error" << ": Please specify either " << "the -C or -S option.\n"; HandleCleanup(); } } return 1; } int SetupProxyInstance() { if (control -> ProxyMode == proxy_client) { proxy = new ClientProxy(proxyFD); } else { proxy = new ServerProxy(proxyFD); } if (proxy == NULL) { nxfatal << "Loop: PANIC! Error creating the NX proxy.\n" << std::flush; cerr << "Error" << ": Error creating the NX proxy.\n"; HandleCleanup(); } // // Create the statistics repository. // statistics = new Statistics(proxy); if (statistics == NULL) { nxfatal << "Loop: PANIC! Error creating the NX statistics.\n" << std::flush; cerr << "Error" << ": Error creating the NX statistics.\n"; HandleCleanup(); } // // If user gave us a proxy cookie than create the // X11 authorization repository and find the real // cookie to be used for our X display. // SetupAuthInstance(); // // Reset the static members in channels. // proxy -> handleChannelConfiguration(); // // Inform the proxies about the ports where they // will have to forward the network connections. // proxy -> handleDisplayConfiguration(displayHost, xServerAddrFamily, xServerAddr, xServerAddrLength); proxy -> handlePortConfiguration(cupsPort, smbPort, mediaPort, httpPort, fontPort); // // We handed over the sockaddr structure we // created when we set up the display socket // to the proxy. // xServerAddr = NULL; // // Set socket options on proxy link, then propagate link // configuration to proxy. This includes translating some // control parameters in 'local' and 'remote'. Finally // adjust cache parameters according to pack method and // session type selected by user. // if (proxy -> handleSocketConfiguration() < 0 || proxy -> handleLinkConfiguration() < 0 || proxy -> handleCacheConfiguration() < 0) { nxfatal << "Loop: PANIC! Error configuring the NX transport.\n" << std::flush; cerr << "Error" << ": Error configuring the NX transport.\n"; HandleCleanup(); } // // Load the message stores from the persistent // cache. // proxy -> handleLoad(load_if_first); // // Inform the proxy that from now on it can // start handling the encoded data. // proxy -> setOperational(); // // Are we going to use an internal IPC connection // with an agent? In this case create the channel // by using the socket descriptor provided by the // caller at the proxy initialization. // SetupAgentInstance(); // // Check if we need to verify the existence of // a matching client cache at shutdown. // #ifdef MATCH control -> PersistentCacheCheckOnShutdown = 1; #endif // // Flush any data produced so far. // proxy -> handleFlush(); if (proxy -> getFlushable(proxyFD) > 0) { nxinfo << "Loop: WARNING! Proxy FD#" << proxyFD << " has data " << "to flush after setup of the NX transport.\n" << std::flush; } return 1; } int SetupAuthInstance() { // // If user gave us a proxy cookie, then create the // X11 authorization repository and find the real // cookie to be used for our X display. // if (control -> ProxyMode == proxy_server) { if (*authCookie != '\0') { if (useLaunchdSocket == 1) { // // If we are going to retrieve the X11 autho- // rization through the launchd service, make // a connection to its socket to trigger the // X server starting. // sockaddr_un launchdAddrUnix; unsigned int launchdAddrLength = sizeof(sockaddr_un); int launchdAddrFamily = AF_UNIX; launchdAddrUnix.sun_family = AF_UNIX; // determine the maximum number of characters that fit into struct // sockaddr_un's sun_path member std::size_t launchdAddrNameLength = sizeof(struct sockaddr_un) - offsetof(struct sockaddr_un, sun_path); int success = -1; snprintf(launchdAddrUnix.sun_path, launchdAddrNameLength, "%s", displayHost); *(launchdAddrUnix.sun_path + launchdAddrNameLength - 1) = '\0'; nxinfo << "Loop: Connecting to launchd service " << "on Unix port '" << displayHost << "'.\n" << std::flush; int launchdFd = socket(launchdAddrFamily, SOCK_STREAM, PF_UNSPEC); if (launchdFd < 0) { nxfatal << "Loop: PANIC! Call to socket failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; } else if ((success = connect(launchdFd, (sockaddr *) &launchdAddrUnix, launchdAddrLength)) < 0) { nxwarn << "Loop: WARNING! Connection to launchd service " << "on Unix port '" << displayHost << "' failed " << "with error " << EGET() << ", '" << ESTR() << "'.\n" << std::flush; } if (launchdFd >= 0) { close(launchdFd); } // // The real cookie will not be available // until the X server starts. Query for the // cookie in a loop, unless the connection // to the launchd service failed. // int attempts = (success < 0 ? 1 : 10); for (int i = 0; i < attempts; i++) { delete auth; auth = new Auth(displayHost, authCookie); if (auth != NULL && auth -> isFake() == 1) { usleep(200000); continue; } break; } } else { auth = new Auth(displayHost, authCookie); } if (auth == NULL || auth -> isValid() != 1) { nxfatal << "Loop: PANIC! Error creating the X authorization.\n" << std::flush; cerr << "Error" << ": Error creating the X authorization.\n"; HandleCleanup(); } else if (auth -> isFake() == 1) { nxwarn << "Loop: WARNING! Could not retrieve the X server " << "authentication cookie.\n" << std::flush; cerr << "Warning" << ": Failed to read data from the X " << "auth command.\n"; cerr << "Warning" << ": Generated a fake cookie for X " << "authentication.\n"; } } else { nxinfo << "Loop: No proxy cookie was provided for " << "authentication.\n" << std::flush; cerr << "Info" << ": No proxy cookie was provided for " << "authentication.\n"; nxinfo << "Loop: Forwarding the real X authorization " << "cookie.\n" << std::flush; cerr << "Info" << ": Forwarding the real X authorization " << "cookie.\n"; } } return 1; } int SetupAgentInstance() { if (control -> ProxyMode == proxy_client && useAgentSocket == 1) { // // This will temporarily disable signals to safely // load the cache, then will send a control packet // to the remote end, telling that cache has to be // loaded, so it's important that proxy is already // set in operational state. // int result; if (agent != NULL) { result = proxy -> handleNewAgentConnection(agent); } else { result = proxy -> handleNewConnection(channel_x11, agentFD[1]); } if (result < 0) { nxfatal << "Loop: PANIC! Error creating the NX agent connection.\n" << std::flush; cerr << "Error" << ": Error creating the NX agent connection.\n"; HandleCleanup(); } } return 1; } void SetupTcpSocket() { // // Open TCP socket emulating local display. // tcpFD = ListenConnectionTCP((loopbackBind ? "localhost" : "*"), X_TCP_PORT + proxyPort, "X11"); } void SetupUnixSocket() { // // Open UNIX domain socket for display. // unsigned int required = snprintf(unixSocketName, DEFAULT_STRING_LENGTH, "/tmp/.X11-unix"); if (required < sizeof(unixSocketName)) { // No need to execute the following actions conditionally mkdir(unixSocketName, (0777 | S_ISVTX)); chmod(unixSocketName, (0777 | S_ISVTX)); required = snprintf(unixSocketName, DEFAULT_STRING_LENGTH, "/tmp/.X11-unix/X%d", proxyPort); if (required < sizeof(unixSocketName)) { unixFD = ListenConnectionUnix(unixSocketName, "x11"); if (unixFD >= 0) chmod(unixSocketName, 0777); return; } } unixSocketName[0] = '\0'; // Just in case! nxfatal << "Loop: PANIC! path for unix socket is too long.\n" << std::flush; cerr << "Error" << ": path for Unix socket is too long.\n"; HandleCleanup(); } // // The following is a dumb copy-paste. The // nxcompsh library should offer a better // implementation. // addr is assumed to have been freed outside // void SetupDisplaySocket(int &addr_family, sockaddr *&addr, unsigned int &addr_length) { addr_family = AF_INET; addr_length = 0; char *display; if (*displayHost == '\0') { // // Assume DISPLAY as the X server to which // we will forward the proxied connections. // This means that NX parameters have been // passed through other means. // display = getenv("DISPLAY"); if (display == NULL || *display == '\0') { nxfatal << "Loop: PANIC! Host X server DISPLAY is not set.\n" << std::flush; cerr << "Error" << ": Host X server DISPLAY is not set.\n"; HandleCleanup(); } else if (strncasecmp(display, "nx/nx,", 6) == 0 || strncasecmp(display, "nx,", 3) == 0 || strncasecmp(display, "nx/nx:", 6) == 0 || strncasecmp(display, "nx:", 3) == 0) { nxfatal << "Loop: PANIC! NX transport on host X server '" << display << "' not supported.\n" << std::flush; cerr << "Error" << ": NX transport on host X server '" << display << "' not supported.\n"; cerr << "Error" << ": Please run the local proxy specifying " << "the host X server to connect to.\n"; HandleCleanup(); } else if (strlen(display) >= DEFAULT_STRING_LENGTH) { nxfatal << "Loop: PANIC! Host X server DISPLAY cannot exceed " << DEFAULT_STRING_LENGTH << " characters.\n" << std::flush; cerr << "Error" << ": Host X server DISPLAY cannot exceed " << DEFAULT_STRING_LENGTH << " characters.\n"; HandleCleanup(); } strcpy(displayHost, display); } display = new char[strlen(displayHost) + 1]; if (display == NULL) { nxfatal << "Loop: PANIC! Out of memory handling DISPLAY variable.\n" << std::flush; cerr << "Error" << ": Out of memory handling DISPLAY variable.\n"; HandleCleanup(); } strcpy(display, displayHost); #ifdef __APPLE__ if ((strncasecmp(display, "/tmp/launch", 11) == 0) || (strncasecmp(display, "/private/tmp/com.apple.launchd", 30) == 0)) { nxinfo << "Loop: Using launchd service on socket '" << display << "'.\n" << std::flush; useLaunchdSocket = 1; } #endif char *separator = strrchr(display, ':'); if ((separator == NULL) || !isdigit(*(separator + 1))) { nxfatal << "Loop: PANIC! Invalid display '" << display << "'.\n" << std::flush; cerr << "Error" << ": Invalid display '" << display << "'.\n"; delete [] display; HandleCleanup(); } *separator = '\0'; xPort = atoi(separator + 1); nxinfo << "Loop: Using local X display '" << displayHost << "' with host '" << display << "' and port '" << xPort << "'.\n" << std::flush; #ifdef __APPLE__ if (separator == display || strcmp(display, "unix") == 0 || useLaunchdSocket == 1) #else if (separator == display || strcmp(display, "unix") == 0) #endif { // // UNIX domain port. // // determine the maximum number of characters that fit into struct // sockaddr_un's sun_path member std::size_t maxlen_un = sizeof(struct sockaddr_un) - offsetof(struct sockaddr_un, sun_path); nxinfo << "Loop: Using real X server on UNIX domain socket.\n" << std::flush; addr_family = AF_UNIX; // // The scope of this function is to fill either the sockaddr_un // (when the display is set to the Unix Domain socket) or the // sockaddr_in structure (when connecting by TCP) only once, so // that the structure will be later used at the time the server // proxy will try to forward the connection to the X server. We // don't need to verify that the socket does exist at the pre- // sent moment. The method that forwards the connection will // perform the required checks and will retry, if needed. Anyway // we need to select the name of the socket, so we check if the // well-known directory exists and take that as an indication of // where the socket will be created. // // Try abstract X11 socket first (via a test connect), if that fails // fall back to Unix domain socket file. #ifdef __linux__ int testSocketFD = socket(addr_family, SOCK_STREAM, PF_UNSPEC); // this name cannot be changed as it is defined this way by the // local X server int len = snprintf(unixSocketName + 1, DEFAULT_STRING_LENGTH - 1, "/tmp/.X11-unix/X%d", xPort); unixSocketName[0] = '\0'; sockaddr_un *xServerAddrABSTRACT = new sockaddr_un; memset(xServerAddrABSTRACT, 0, sizeof(struct sockaddr_un)); xServerAddrABSTRACT -> sun_family = AF_UNIX; if (maxlen_un < (unsigned int)len + 1) { nxfatal << "Loop: PANIC! Abstract socket name '" << unixSocketName + 1 << "' is too long!" << std::flush; delete [] display; delete xServerAddrABSTRACT; HandleCleanup(); } // copy including the leading '\0' memcpy(xServerAddrABSTRACT -> sun_path, unixSocketName, len + 1); // man 7 unix: // "an abstract socket address is distinguished (from a // pathname socket) by the fact that sun_path[0] is a null byte // ('\0'). The socket's address in this namespace is given by the // additional bytes in sun_path that are covered by the specified // length of the address structure." addr_length = offsetof(struct sockaddr_un, sun_path) + len + 1; int ret = connect(testSocketFD, (struct sockaddr *) xServerAddrABSTRACT, addr_length); close(testSocketFD); if (ret == 0) { cerr << "Info" << ": Using abstract X11 socket in kernel namespace " << "for accessing DISPLAY=:" << xPort << ".\n"; addr = (sockaddr *) xServerAddrABSTRACT; delete [] display; return; } cerr << "Info" << ": Falling back to file system X11 socket " << "for accessing DISPLAY=:" << xPort << ".\n"; delete xServerAddrABSTRACT; #endif struct stat statInfo; char unixSocketDir[DEFAULT_STRING_LENGTH]; snprintf(unixSocketDir, DEFAULT_STRING_LENGTH, "/tmp/.X11-unix"); #ifdef __APPLE__ if (useLaunchdSocket == 1) { char *slash = rindex(display, '/'); if (slash != NULL) { *slash = '\0'; } snprintf(unixSocketDir, DEFAULT_STRING_LENGTH, "%s", display); } #endif *(unixSocketDir + DEFAULT_STRING_LENGTH - 1) = '\0'; nxinfo << "Loop: Assuming X socket in directory '" << unixSocketDir << "'.\n" << std::flush; if (stat(unixSocketDir, &statInfo) < 0) { nxfatal << "Loop: PANIC! Can't determine the location of " << "the X display socket.\n" << std::flush; cerr << "Error" << ": Can't determine the location of " << "the X display socket.\n"; nxfatal << "Loop: PANIC! Error " << EGET() << " '" << ESTR() << "' checking '" << unixSocketDir << "'.\n" << std::flush; cerr << "Error" << ": Error " << EGET() << " '" << ESTR() << "' checking '" << unixSocketDir << "'.\n"; delete [] display; HandleCleanup(); } snprintf(unixSocketName, DEFAULT_STRING_LENGTH, "%s/X%d", unixSocketDir, xPort); #ifdef __APPLE__ if (useLaunchdSocket == 1) { snprintf(unixSocketName, DEFAULT_STRING_LENGTH, "%s", displayHost); } #endif nxinfo << "Loop: Assuming X socket name '" << unixSocketName << "'.\n" << std::flush; if (maxlen_un < strlen(unixSocketName) + 1) { nxfatal << "Loop: PANIC! Socket name '" << unixSocketName << "' is too long!" << std::flush; delete [] display; HandleCleanup(); } sockaddr_un *xServerAddrUNIX = new sockaddr_un; xServerAddrUNIX -> sun_family = AF_UNIX; strcpy(xServerAddrUNIX -> sun_path, unixSocketName); addr = (sockaddr *) xServerAddrUNIX; addr_length = sizeof(sockaddr_un); } else { // // TCP port. // nxinfo << "Loop: Using real X server on TCP port.\n" << std::flush; addr_family = AF_INET; int xServerIPAddr = GetHostAddress(display); if (xServerIPAddr == 0) { nxfatal << "Loop: PANIC! Unknown display host '" << display << "'.\n" << std::flush; cerr << "Error" << ": Unknown display host '" << display << "'.\n"; delete [] display; HandleCleanup(); } sockaddr_in *xServerAddrTCP = new sockaddr_in; xServerAddrTCP -> sin_family = AF_INET; xServerAddrTCP -> sin_port = htons(X_TCP_PORT + xPort); xServerAddrTCP -> sin_addr.s_addr = xServerIPAddr; addr = (sockaddr *) xServerAddrTCP; addr_length = sizeof(sockaddr_in); } delete [] display; } void SetupServiceSockets() { if (control -> ProxyMode == proxy_client) { if (useCupsSocket) { if ((cupsFD = ListenConnection(cupsPort, "CUPS")) < 0) { useCupsSocket = 0; } } if (useAuxSocket) { if ((auxFD = ListenConnection(auxPort, "auxiliary X11")) < 0) { useAuxSocket = 0; } } if (useSmbSocket) { if ((smbFD = ListenConnection(smbPort, "SMB")) < 0) { useSmbSocket = 0; } } if (useMediaSocket) { if ((mediaFD = ListenConnection(mediaPort, "media")) < 0) { useMediaSocket = 0; } } if (useHttpSocket) { if ((httpFD = ListenConnection(httpPort, "http")) < 0) { useHttpSocket = 0; } } useFontSocket = 0; } else { // // Get ready to listen for the font server connections // if (useFontSocket) { // Since ProtoStep7 (#issue 108) int port = atoi(fontPort); if ((fontFD = ListenConnectionTCP("localhost", port, "font")) < 0) { useFontSocket = 0; } } useCupsSocket = 0; useAuxSocket = 0; useSmbSocket = 0; useMediaSocket = 0; useHttpSocket = 0; } // // Slave channels can be originated // by both sides. // if (useSlaveSocket) { // Since ProtoStep7 (#issue 108) if ((slaveFD = ListenConnection(slavePort, "slave")) < 0) { useSlaveSocket = 0; } } } int ListenConnectionAny(sockaddr *addr, socklen_t addrlen, const char *label) { int newFD = socket(addr->sa_family, SOCK_STREAM, PF_UNSPEC); if (newFD == -1) { nxfatal << "Loop: PANIC! Call to socket failed for " << label << " socket. Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Call to socket failed for " << label << " socket. Error is " << EGET() << " '" << ESTR() << "'.\n"; goto SetupSocketError; } if (addr->sa_family == AF_INET) if (SetReuseAddress(newFD) < 0) { // SetReuseAddress already warns with an error goto SetupSocketError; } if (bind(newFD, addr, addrlen) == -1) { nxfatal << "Loop: PANIC! Call to bind failed for " << label << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Call to bind failed for " << label << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; goto SetupSocketError; } if (listen(newFD, 8) == -1) { nxfatal << "Loop: PANIC! Call to listen failed for " << label << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Call to listen failed for " << label << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; goto SetupSocketError; } return newFD; SetupSocketError: if (newFD != -1) { close(newFD); } // // May optionally return. The session would // continue without the service. The problem // with this approach is that it would make // harder to track problems with allocation // of ports in clients and server. // HandleCleanup(); return -1; } int ListenConnectionUnix(const char *path, const char *label) { sockaddr_un unixAddr; unixAddr.sun_family = AF_UNIX; #ifdef UNIX_PATH_MAX if (strlen(path) >= UNIX_PATH_MAX) #else if (strlen(path) >= sizeof(unixAddr.sun_path)) #endif { nxfatal << "Loop: PANIC! Socket path \"" << path << "\" for " << label << " is too long.\n" << std::flush; cerr << "Error" << ": Socket path \"" << path << "\" for " << label << " is too long.\n"; HandleCleanup(); return -1; } strcpy(unixAddr.sun_path, path); return ListenConnectionAny((sockaddr *)&unixAddr, sizeof(unixAddr), label); } int ListenConnectionTCP(const char *host, long port, const char *label) { sockaddr_in tcpAddr; tcpAddr.sin_family = AF_INET; tcpAddr.sin_port = htons(port); if (loopbackBind || !host || !strcmp(host, "") || !strcmp(host, "localhost")) { tcpAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); } else if(strcmp(host, "*") == 0) { tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY); } else { int ip = tcpAddr.sin_addr.s_addr = GetHostAddress(host); if (ip == 0) { nxfatal << "Loop: PANIC! Unknown " << label << " host '" << host << "'.\n" << std::flush; cerr << "Error" << ": Unknown " << label << " host '" << host << "'.\n"; HandleCleanup(); return -1; } } return ListenConnectionAny((sockaddr *)&tcpAddr, sizeof(tcpAddr), label); } int ListenConnection(ChannelEndPoint &endpoint, const char *label) { char *unixPath = NULL, *host = NULL; long port; int result = -1; if (endpoint.getUnixPath(&unixPath)) { result = ListenConnectionUnix(unixPath, label); } else if (endpoint.getTCPHostAndPort(&host, &port)) { result = ListenConnectionTCP(host, port, label); } SAFE_FREE(unixPath); SAFE_FREE(host); return result; } static int AcceptConnection(int fd, int domain, const char *label) { struct sockaddr newAddr; socklen_t addrLen = sizeof(newAddr); if (domain == AF_UNIX) { nxinfo << "Loop: Going to accept new Unix " << label << " connection on FD#" << fd << ".\n" << std::flush; } else { nxinfo << "Loop: Going to accept new TCP " << label << " connection on FD#" << fd << ".\n" << std::flush; } int newFD = accept(fd, &newAddr, &addrLen); if (newFD < 0) { nxfatal << "Loop: PANIC! Call to accept failed for " << label << " connection. Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Call to accept failed for " << label << " connection. Error is " << EGET() << " '" << ESTR() << "'.\n"; } return newFD; } void HandleShutdown() { if (proxy -> getShutdown() == 0) { nxfatal << "Loop: PANIC! No shutdown of proxy link " << "performed by remote proxy.\n" << std::flush; // // Close the socket before showing the alert. // It seems that the closure of the socket can // sometimes take several seconds, even after // the connection is broken. The result is that // the dialog can be shown long after the user // has gone after the failed session. Note that // disabling the linger timeout does not seem // to make any difference. // CleanupSockets(); cerr << "Error" << ": Connection with remote peer broken.\n"; nxinfo << "Loop: Bytes received so far are " << (unsigned long long) statistics -> getBytesIn() << ".\n" << std::flush; cerr << "Error" << ": Please check the state of your " << "network and retry.\n"; handleTerminatingInLoop(); if (control -> ProxyMode == proxy_server) { nxinfo << "Loop: Showing the proxy abort dialog.\n" << std::flush; HandleAlert(ABORT_PROXY_CONNECTION_ALERT, 1); handleAlertInLoop(); } } else { nxinfo << "Loop: Finalized the remote proxy shutdown.\n" << std::flush; } HandleCleanup(); } void WaitCleanup() { T_timestamp selectTs; while (NXTransRunning(NX_FD_ANY)) { setTimestamp(selectTs, control -> PingTimeout); NXTransContinue(&selectTs); } } int KillProcess(int pid, const char *label, int signal, int wait) { if (pid > 0) { nxinfo << "Loop: Killing the " << label << " process '" << pid << "' from process with pid '" << getpid() << "' with signal '" << DumpSignal(signal) << "'.\n" << std::flush; signal = (signal == 0 ? SIGTERM : signal); if (kill(pid, signal) < 0 && EGET() != ESRCH) { nxfatal << "Loop: PANIC! Couldn't kill the " << label << " process with pid '" << pid << "'.\n" << std::flush; cerr << "Error" << ": Couldn't kill the " << label << " process with pid '" << pid << "'.\n"; } if (wait == 1) { WaitChild(pid, label, 1); } return 1; } else { nxinfo << "Loop: No " << label << " process " << "to kill with pid '" << pid << "'.\n" << std::flush; return 0; } } int CheckProcess(int pid, const char *label) { nxinfo << "Loop: Checking the " << label << " process '" << pid << "' from process with pid '" << getpid() << "'.\n" << std::flush; if (kill(pid, SIGCONT) < 0 && EGET() == ESRCH) { nxwarn << "Loop: WARNING! The " << label << " process " << "with pid '" << pid << "' has exited.\n" << std::flush; cerr << "Warning" << ": The " << label << " process " << "with pid '" << pid << "' has exited.\n"; return 0; } return 1; } void StartKeeper() { if (IsRunning(lastKeeper) == 1 || IsRestarting(lastKeeper) == 1) { nxfatal << "Loop: PANIC! The house-keeping process is " << "already running with pid '" << lastKeeper << "'.\n" << std::flush; HandleCleanup(); } // // Don't care harvesting the persistent caches if // the memory cache is not enabled. If the memory // cache is not enabled neither we produced per- // sistent caches. The user can still delete any // persistent cache produced by the previous runs // by using the client GUI. // // TODO: At the moment the user doesn't have a way // to specify the amount of disk space to use for // the persistent caches, but only the amount of // space to use for images. // if (control -> LocalTotalStorageSize > 0) { nxinfo << "Loop: Starting the house-keeping process with " << "storage size " << control -> PersistentCacheDiskLimit << ".\n" << std::flush; lastKeeper = NXTransKeeper(control -> PersistentCacheDiskLimit, 0, control -> RootPath); if (IsFailed(lastKeeper)) { nxwarn << "Loop: WARNING! Failed to start the NX keeper process.\n" << std::flush; cerr << "Warning" << ": Failed to start the NX keeper process.\n"; SetNotRunning(lastKeeper); } else { nxinfo << "Loop: Keeper started with pid '" << lastKeeper << "'.\n" << std::flush; } } else { nxinfo << "Loop: Nothing to do for the keeper process " << "with persistent cache not enabled.\n" << std::flush; } } void HandleCleanupForReconnect() { nxinfo << "Loop: Going to clean up system resources for Reconnect " << "in process '" << getpid() << "'.\n" << std::flush; handleTerminatedInLoop(); DisableSignals(); if (control) CleanupChildren(); CleanupListeners(); CleanupSockets(); CleanupKeeper(); CleanupStreams(); CleanupLocal(); CleanupGlobal(); RestoreSignals(); ServerCache::lastInitReply.set(0,NULL); ServerCache::lastKeymap.set(0,NULL); ServerCache::getKeyboardMappingLastMap.set(0,NULL); } void HandleCleanup(int code) { nxinfo << "Loop: Going to clean up system resources " << "in process '" << getpid() << "'.\n" << std::flush; handleTerminatedInLoop(); // // Suspend any signal while cleaning up. // DisableSignals(); if (getpid() == lastProxy) { // // Terminate all the children. // CleanupChildren(); // // Close all listeners. // CleanupListeners(); // // Close all sockets. // CleanupSockets(); // // Release the global objects. // CleanupGlobal(); // // Restore the original signal handlers. // RestoreSignals(); } // // This is our last chance to print a message. If this // is the process which created the transport we will // jump back into the loop, letting the caller find out // that the connection is broken, otherwise we assume // that this is a child of the proxy and so we will // safely exit. // if (getpid() == lastProxy) { nxinfo << "Loop: Reverting to loop context in process with " << "pid '" << getpid() << "' at " << strMsTimestamp() << ".\n" << std::flush; } else { nxinfo << "Loop: Exiting from child process with pid '" << getpid() << "' at " << strMsTimestamp() << ".\n" << std::flush; } if (getpid() == lastProxy) { // // Reset all values to their default. // CleanupLocal(); CleanupStreams(); longjmp(context, 1); } else { // // Give a last chance to the process // to cleanup the ancillary classes. // CleanupKeeper(); CleanupStreams(); exit(code); } } void CleanupKeeper() { if (keeper != NULL) { nxinfo << "Loop: Freeing up keeper in process " << "with pid '" << getpid() << "'.\n" << std::flush; delete keeper; keeper = NULL; } } void CleanupStreams() { // // TODO: The cleanup procedure skips deletion of // the I/O streams under Windows. This is intended // to avoid a strange segfault occurring randomly, // at the time the proxy is being shut down. // #ifndef __CYGWIN32__ nxinfo << "Loop: Freeing up streams in process " << "with pid '" << getpid() << "'.\n" << std::flush; if (logofs != NULL && logofs != &cerr && *errorsFileName != '\0') { *logofs << flush; delete logofs; // // Let the log go again to the standard // error. // logofs = &cerr; } if (statofs != NULL && statofs != &cerr && *statsFileName != '\0') { *statofs << flush; delete statofs; statofs = NULL; } if (errofs != NULL) { *errofs << flush; if (errofs == &cerr) { errofs = NULL; } else if (errsbuf != NULL) { cerr.rdbuf(errsbuf); errsbuf = NULL; delete errofs; } errofs = NULL; } #endif /* #ifndef __CYGWIN32__ */ // // Reset these as they can't be reset // in CleanupLocal(). // *sessionFileName = '\0'; *errorsFileName = '\0'; *optionsFileName = '\0'; *statsFileName = '\0'; } void CleanupChildren() { // // Remove any watchdog. // if (IsRunning(lastWatchdog)) { KillProcess(lastWatchdog, "watchdog", SIGTERM, 1); SetNotRunning(lastWatchdog); lastSignal = 0; } // // Kill the cache house-keeping process. // if (IsRunning(lastKeeper)) { KillProcess(lastKeeper, "house-keeping", SIGTERM, 1); SetNotRunning(lastKeeper); } // // Let any running dialog to continue until it is // closed by the user. In general this is the exp- // ected behaviour, as for example when we are // exiting because the link was abrouptedly shut // down. // if (IsRunning(lastDialog)) { nxinfo << "Loop: WARNING! Leaving the dialog process '" << lastDialog << "' running in process " << "with pid '" << getpid() << "'.\n" << std::flush; SetNotRunning(lastDialog); } // // Give user a chance to start a new session. // if (control -> EnableRestartOnShutdown == 1) { nxwarn << "Loop: WARNING! Respawning the NX client " << "on display '" << displayHost << "'.\n" << std::flush; NXTransClient(displayHost); } for (int i = 0; i < control -> KillDaemonOnShutdownNumber; i++) { nxwarn << "Loop: WARNING! Killing the NX daemon with " << "pid '" << control -> KillDaemonOnShutdown[i] << "'.\n" << std::flush; KillProcess(control -> KillDaemonOnShutdown[i], "daemon", SIGTERM, 0); } } void CleanupGlobal() { if (proxy != NULL) { nxinfo << "Loop: Freeing up proxy in process " << "with pid '" << getpid() << "'.\n" << std::flush; delete proxy; proxy = NULL; } if (agent != NULL) { nxinfo << "Loop: Freeing up agent in process " << "with pid '" << getpid() << "'.\n" << std::flush; delete agent; agent = NULL; } if (auth != NULL) { nxinfo << "Loop: Freeing up auth data in process " << "with pid '" << getpid() << "'.\n" << std::flush; delete auth; auth = NULL; } if (statistics != NULL) { nxinfo << "Loop: Freeing up statistics in process " << "with pid '" << getpid() << "'.\n" << std::flush; delete statistics; statistics = NULL; } if (control != NULL) { nxinfo << "Loop: Freeing up control in process " << "with pid '" << getpid() << "'.\n" << std::flush; delete control; control = NULL; } } void CleanupConnections() { if (proxy -> getChannels(channel_x11) != 0) { nxinfo << "Loop: Closing any remaining X connections.\n" << std::flush; proxy -> handleCloseAllXConnections(); nxinfo << "Loop: Closing any remaining listener.\n" << std::flush; proxy -> handleCloseAllListeners(); } proxy -> handleFinish(); } void CleanupListeners() { if (useTcpSocket == 1) { if (tcpFD != -1) { nxinfo << "Loop: Closing TCP listener in process " << "with pid '" << getpid() << "'.\n" << std::flush; close(tcpFD); tcpFD = -1; } useTcpSocket = 0; } if (useUnixSocket == 1) { if (unixFD != -1) { nxinfo << "Loop: Closing UNIX listener in process " << "with pid '" << getpid() << "'.\n" << std::flush; close(unixFD); unixFD = -1; } if (*unixSocketName != '\0') { nxinfo << "Loop: Going to remove the Unix domain socket '" << unixSocketName << "' in process " << "with pid '" << getpid() << "'.\n" << std::flush; unlink(unixSocketName); } useUnixSocket = 0; } if (useAgentSocket == 1) { // // There is no listener for the // agent descriptor. // useAgentSocket = 0; } if (useCupsSocket == 1) { if (cupsFD != -1) { nxinfo << "Loop: Closing CUPS listener in process " << "with pid '" << getpid() << "'.\n" << std::flush; close(cupsFD); cupsFD = -1; } useCupsSocket = 0; } if (useAuxSocket == 1) { if (auxFD != -1) { nxinfo << "Loop: Closing auxiliary X11 listener " << "in process " << "with pid '" << getpid() << "'.\n" << std::flush; close(auxFD); auxFD = -1; } useAuxSocket = 0; } if (useSmbSocket == 1) { if (smbFD != -1) { nxinfo << "Loop: Closing SMB listener in process " << "with pid '" << getpid() << "'.\n" << std::flush; close(smbFD); smbFD = -1; } useSmbSocket = 0; } if (useMediaSocket == 1) { if (mediaFD != -1) { nxinfo << "Loop: Closing multimedia listener in process " << "with pid '" << getpid() << "'.\n" << std::flush; close(mediaFD); mediaFD = -1; } useMediaSocket = 0; } if (useHttpSocket == 1) { if (httpFD != -1) { nxinfo << "Loop: Closing http listener in process " << "with pid '" << getpid() << "'.\n" << std::flush; close(httpFD); httpFD = -1; } useHttpSocket = 0; } if (useFontSocket == 1) { if (fontFD != -1) { nxinfo << "Loop: Closing font server listener in process " << "with pid '" << getpid() << "'.\n" << std::flush; close(fontFD); fontFD = -1; } useFontSocket = 0; } if (useSlaveSocket == 1) { if (slaveFD != -1) { nxinfo << "Loop: Closing slave listener in process " << "with pid '" << getpid() << "'.\n" << std::flush; close(slaveFD); slaveFD = -1; } useSlaveSocket = 0; } } void CleanupSockets() { if (proxyFD != -1) { nxinfo << "Loop: Closing proxy FD in process " << "with pid '" << getpid() << "'.\n" << std::flush; close(proxyFD); proxyFD = -1; } if (agentFD[1] != -1) { nxinfo << "Loop: Closing agent FD in process " << "with pid '" << getpid() << "'.\n" << std::flush; close(agentFD[1]); agentFD[0] = -1; agentFD[1] = -1; } } void CleanupLocal() { *homeDir = '\0'; *rootDir = '\0'; *tempDir = '\0'; *systemDir = '\0'; *sessionDir = '\0'; *linkSpeedName = '\0'; *cacheSizeName = '\0'; *shsegSizeName = '\0'; *imagesSizeName = '\0'; *bitrateLimitName = '\0'; *packMethodName = '\0'; *productName = '\0'; packMethod = -1; packQuality = -1; *sessionType = '\0'; *sessionId = '\0'; parsedOptions = 0; parsedCommand = 0; *remoteData = '\0'; remotePosition = 0; tcpFD = -1; unixFD = -1; cupsFD = -1; auxFD = -1; smbFD = -1; mediaFD = -1; httpFD = -1; fontFD = -1; slaveFD = -1; proxyFD = -1; agentFD[0] = -1; agentFD[1] = -1; useUnixSocket = 1; useTcpSocket = 1; useCupsSocket = 0; useAuxSocket = 0; useSmbSocket = 0; useMediaSocket = 0; useHttpSocket = 0; useFontSocket = 0; useSlaveSocket = 0; useAgentSocket = 0; useNoDelay = -1; usePolicy = -1; useRender = -1; useTaint = -1; *unixSocketName = '\0'; *acceptHost = '\0'; *displayHost = '\0'; *authCookie = '\0'; proxyPort = DEFAULT_NX_PROXY_PORT; xPort = DEFAULT_NX_X_PORT; xServerAddrFamily = -1; xServerAddrLength = 0; delete xServerAddr; xServerAddr = NULL; listenSocket.disable(); connectSocket.disable(); cupsPort.disable(); auxPort.disable(); smbPort.disable(); mediaPort.disable(); httpPort.disable(); slavePort.disable(); *fontPort = '\0'; *bindHost = '\0'; bindPort = -1; initTs = nullTimestamp(); startTs = nullTimestamp(); logsTs = nullTimestamp(); nowTs = nullTimestamp(); lastProxy = 0; lastDialog = 0; lastWatchdog = 0; lastKeeper = 0; lastStatus = 0; lastKill = 0; lastDestroy = 0; lastReadableTs = nullTimestamp(); lastAlert.code = 0; lastAlert.local = 0; lastMasks.blocked = 0; lastMasks.installed = 0; memset(&lastMasks.saved, 0, sizeof(sigset_t)); for (int i = 0; i < 32; i++) { lastMasks.enabled[i] = 0; lastMasks.forward[i] = 0; memset(&lastMasks.action[i], 0, sizeof(struct sigaction)); } lastSignal = 0; memset(&lastTimer.action, 0, sizeof(struct sigaction)); memset(&lastTimer.value, 0, sizeof(struct itimerval)); lastTimer.start = nullTimestamp(); lastTimer.next = nullTimestamp(); } int CheckAbort() { if (lastSignal != 0) { nxinfo << "Loop: Aborting the procedure due to signal '" << lastSignal << "', '" << DumpSignal(lastSignal) << "'.\n" << std::flush; cerr << "Info" << ": Aborting the procedure due to signal '" << lastSignal << "'.\n"; lastSignal = 0; return 1; } return 0; } void HandleAbort() { if (logofs == NULL) { logofs = &cerr; } *logofs << flush; handleTerminatingInLoop(); if (lastSignal == SIGHUP) { lastSignal = 0; } // // The current default is to just quit the program. // Code has not been updated to deal with the new // NX transport loop. // if (control -> EnableCoreDumpOnAbort == 1) { if (agent != NULL) { cerr << "Session" << ": Terminating session at '" << strTimestamp() << "'.\n"; } cerr << "Error" << ": Generating a core file to help " << "the investigations.\n"; cerr << "Session" << ": Session terminated at '" << strTimestamp() << "'.\n"; cerr << flush; signal(SIGABRT, SIG_DFL); raise(SIGABRT); } nxinfo << "Loop: Showing the proxy abort dialog.\n" << std::flush; if (control -> ProxyMode == proxy_server) { // // Close the socket before showing the alert. // It seems that the closure of the socket can // sometimes take several seconds, even after // the connection is broken. // CleanupSockets(); if (lastKill == 0) { HandleAlert(ABORT_PROXY_CONNECTION_ALERT, 1); } else { HandleAlert(ABORT_PROXY_SHUTDOWN_ALERT, 1); } handleAlertInLoop(); } HandleCleanup(); } void HandleAlert(int code, int local) { if (lastAlert.code == 0) { nxinfo << "Loop: Requesting an alert dialog with code " << code << " and local " << local << ".\n" << std::flush; lastAlert.code = code; lastAlert.local = local; } else { nxinfo << "Loop: WARNING! Alert dialog already requested " << "with code " << lastAlert.code << ".\n" << std::flush; } return; } void FlushCallback(int length) { if (flushCallback != NULL) { nxinfo << "Loop: Reporting a flush request at " << strMsTimestamp() << " with " << length << " bytes written.\n" << std::flush; (*flushCallback)(flushParameter, length); } else if (control -> ProxyMode == proxy_client) { nxinfo << "Loop: WARNING! Can't find a flush " << "callback in process with pid '" << getpid() << "'.\n" << std::flush; } } void KeeperCallback() { if (IsRunning(lastKeeper) == 0) { // // Let the house-keeping process take care // of the persistent image cache. // if (control -> ImageCacheEnableLoad == 1 || control -> ImageCacheEnableSave == 1) { nxinfo << "Loop: Starting the house-keeping process with " << "image storage size " << control -> ImageCacheDiskLimit << ".\n" << std::flush; lastKeeper = NXTransKeeper(0, control -> ImageCacheDiskLimit, control -> RootPath); if (IsFailed(lastKeeper)) { nxwarn << "Loop: WARNING! Can't start the NX keeper process.\n" << std::flush; SetNotRunning(lastKeeper); } else { nxinfo << "Loop: Keeper started with pid '" << lastKeeper << "'.\n" << std::flush; } } else { nxinfo << "Loop: Nothing to do for the keeper process " << "with image cache not enabled.\n" << std::flush; } } else { nxinfo << "Loop: Nothing to do with the keeper process " << "already running.\n" << std::flush; } } void InstallSignals() { nxinfo << "Loop: Installing signals in process with pid '" << getpid() << "'.\n" << std::flush; for (int i = 0; i < 32; i++) { if (CheckSignal(i) == 1 && lastMasks.enabled[i] == 0) { InstallSignal(i, NX_SIGNAL_ENABLE); } } lastMasks.installed = 1; } void RestoreSignals() { nxinfo << "Loop: Restoring signals in process with pid '" << getpid() << "'.\n" << std::flush; if (lastMasks.installed == 1) { // // Need to keep monitoring the children. // for (int i = 0; i < 32; i++) { if (lastMasks.enabled[i] == 1) { RestoreSignal(i); } } } lastMasks.installed = 0; if (lastMasks.blocked == 1) { EnableSignals(); } } void DisableSignals() { if (lastMasks.blocked == 0) { sigset_t newMask; sigemptyset(&newMask); // // Block also the other signals that may be // installed by the agent, that are those // signals for which the function returns 2. // for (int i = 0; i < 32; i++) { if (CheckSignal(i) > 0) { nxdbg << "Loop: Disabling signal " << i << " '" << DumpSignal(i) << "' in process with pid '" << getpid() << "'.\n" << std::flush; sigaddset(&newMask, i); } } sigprocmask(SIG_BLOCK, &newMask, &lastMasks.saved); lastMasks.blocked++; } else { nxinfo << "Loop: WARNING! Signals were already blocked in " << "process with pid '" << getpid() << "'.\n" << std::flush; } } void EnableSignals() { if (lastMasks.blocked == 1) { nxinfo << "Loop: Enabling signals in process with pid '" << getpid() << "'.\n" << std::flush; sigprocmask(SIG_SETMASK, &lastMasks.saved, NULL); lastMasks.blocked = 0; } else { nxwarn << "Loop: WARNING! Signals were not blocked in " << "process with pid '" << getpid() << "'.\n" << std::flush; cerr << "Warning" << ": Signals were not blocked in " << "process with pid '" << getpid() << "'.\n"; } } void InstallSignal(int signal, int action) { if (lastMasks.enabled[signal] == 1) { if (action == NX_SIGNAL_FORWARD) { nxinfo << "Loop: Forwarding handler for signal " << signal << " '" << DumpSignal(signal) << "' in process " << "with pid '" << getpid() << "'.\n" << std::flush; lastMasks.forward[signal] = 1; return; } else { nxinfo << "Loop: Reinstalling handler for signal " << signal << " '" << DumpSignal(signal) << "' in process " << "with pid '" << getpid() << "'.\n" << std::flush; } } else { nxinfo << "Loop: Installing handler for signal " << signal << " '" << DumpSignal(signal) << "' in process " << "with pid '" << getpid() << "'.\n" << std::flush; } if (signal == SIGALRM && isTimestamp(lastTimer.start)) { ResetTimer(); } struct sigaction newAction; memset(&newAction, 0, sizeof(newAction)); newAction.sa_handler = HandleSignal; sigemptyset(&(newAction.sa_mask)); if (signal == SIGCHLD) { newAction.sa_flags = SA_NOCLDSTOP; } else { newAction.sa_flags = 0; } sigaction(signal, &newAction, &lastMasks.action[signal]); lastMasks.enabled[signal] = 1; if (action == NX_SIGNAL_FORWARD) { lastMasks.forward[signal] = 1; } } void RestoreSignal(int signal) { if (lastMasks.enabled[signal] == 0) { nxwarn << "Loop: WARNING! Signal '" << DumpSignal(signal) << "' not installed in process with pid '" << getpid() << "'.\n" << std::flush; cerr << "Warning" << ": Signal '" << DumpSignal(signal) << "' not installed in process with pid '" << getpid() << "'.\n"; return; } nxinfo << "Loop: Restoring handler for signal " << signal << " '" << DumpSignal(signal) << "' in process " << "with pid '" << getpid() << "'.\n" << std::flush; if (signal == SIGALRM && isTimestamp(lastTimer.start)) { ResetTimer(); } sigaction(signal, &lastMasks.action[signal], NULL); lastMasks.enabled[signal] = 0; lastMasks.forward[signal] = 0; } void HandleSignal(int signal) { if (logofs == NULL) { logofs = &cerr; } if (lastSignal != 0) { nxinfo << "Loop: WARNING! Last signal is '" << lastSignal << "', '" << DumpSignal(signal) << "' and not zero " << "in process with pid '" << getpid() << "'.\n" << std::flush; } nxinfo << "Loop: Signal '" << signal << "', '" << DumpSignal(signal) << "' received in process " << "with pid '" << getpid() << "'.\n" << std::flush; if (getpid() != lastProxy && signalHandler != NULL) { nxinfo << "Loop: Calling slave handler in process " << "with pid '" << getpid() << "'.\n" << std::flush; if ((*signalHandler)(signal) == 0) { return; } } switch (signal) { case SIGUSR1: { if (proxy != NULL && lastSignal == 0) { lastSignal = SIGUSR1; } break; } case SIGUSR2: { if (proxy != NULL && lastSignal == 0) { lastSignal = SIGUSR2; } break; } case SIGPIPE: { // // It can happen that SIGPIPE is delivered // to the proxy even in the case some other // descriptor is unexpectedly closed. // // if (agentFD[1] != -1) // { // cerr << "Info" << ": Received signal 'SIGPIPE'. " // << "Closing agent connection.\n"; // // shutdown(agentFD[1], SHUT_RDWR); // } // break; } case SIGALRM: { // // Nothing to do. Just wake up the // process on blocking operations. // break; } case SIGCHLD: { // // Check if any of our children has exited. // if (HandleChildren() != 0) { signal = 0; } // // Don't save this signal or it will override // any previous signal sent by child before // exiting. // break; } #ifdef __CYGWIN32__ case 12: { // // Nothing to do. This signal is what is delivered // by the Cygwin library when trying use a shared // memory function if the daemon is not running. // nxinfo << "Loop: WARNING! Received signal '12' in " << "process with pid '" << getpid() << "'.\n" << std::flush; nxinfo << "Loop: WARNING! Please check that the " << "cygserver daemon is running.\n" << std::flush; break; } #endif default: { // // Register the signal so we can handle it // inside the main loop. We will probably // dispose any resource and exit. // if (getpid() == lastProxy) { nxinfo << "Loop: Registering end of session request " << "due to signal '" << signal << "', '" << DumpSignal(signal) << "'.\n" << std::flush; lastSignal = signal; } else { // // This is a child, so exit immediately. // HandleCleanup(); } } } if (signal != 0 && lastMasks.forward[signal] == 1) { if (lastMasks.action[signal].sa_handler != NULL && lastMasks.action[signal].sa_handler != HandleSignal) { nxinfo << "Loop: Forwarding signal '" << signal << "', '" << DumpSignal(signal) << "' to previous handler.\n" << std::flush; lastMasks.action[signal].sa_handler(signal); } else if (lastMasks.action[signal].sa_handler == NULL) { nxwarn << "Loop: WARNING! Parent requested to forward " << "signal '" << signal << "', '" << DumpSignal(signal) << "' but didn't set a handler.\n" << std::flush; } } } int HandleChildren() { // // Try to waitpid() for each child because the // call might have return ECHILD and so we may // have lost any of the processes. // if (IsRunning(lastDialog) && HandleChild(lastDialog) == 1) { nxinfo << "Loop: Resetting pid of last dialog process " << "in handler.\n" << std::flush; SetNotRunning(lastDialog); if (proxy != NULL) { proxy -> handleResetAlert(); } return 1; } if (IsRunning(lastWatchdog) && HandleChild(lastWatchdog) == 1) { nxinfo << "Loop: Watchdog is gone. Setting the last " << "signal to SIGHUP.\n" << std::flush; lastSignal = SIGHUP; nxinfo << "Loop: Resetting pid of last watchdog process " << "in handler.\n" << std::flush; SetNotRunning(lastWatchdog); return 1; } // // The house-keeping process exits after a // number of iterations to keep the memory // pollution low. It is restarted on demand // by the lower layers, using the callback // function. // if (IsRunning(lastKeeper) && HandleChild(lastKeeper) == 1) { nxinfo << "Loop: Resetting pid of last house-keeping " << "process in handler.\n" << std::flush; SetNotRunning(lastKeeper); return 1; } // // The pid will be checked by the code // that registered the child. // if (IsRunning(lastChild)) { nxinfo << "Loop: Resetting pid of last child process " << "in handler.\n" << std::flush; SetNotRunning(lastChild); return 1; } proxy->checkSlaves(); // // This can actually happen either because we // reset the pid of the child process as soon // as we kill it, or because of a child process // of our parent. // nxinfo << "Loop: Ignoring signal received for the " << "unregistered child.\n" << std::flush; return 0; } int HandleChild(int child) { int pid; int status = 0; int options = WNOHANG | WUNTRACED; while ((pid = waitpid(child, &status, options)) && pid == -1 && EGET() == EINTR); return CheckChild(pid, status); } int WaitChild(int child, const char* label, int force) { int pid; int status = 0; int options = WUNTRACED; for (;;) { nxinfo << "Loop: Waiting for the " << label << " process '" << child << "' to die.\n" << std::flush; pid = waitpid(child, &status, options); if (pid == -1 && EGET() == EINTR) { if (force == 0) { return 0; } nxwarn << "Loop: WARNING! Ignoring signal while " << "waiting for the " << label << " process '" << child << "' to die.\n" << std::flush; continue; } break; } return (EGET() == ECHILD ? 1 : CheckChild(pid, status)); } int CheckChild(int pid, int status) { lastStatus = 0; if (pid > 0) { if (WIFSTOPPED(status)) { nxinfo << "Loop: Child process '" << pid << "' was stopped " << "with signal " << (WSTOPSIG(status)) << ".\n" << std::flush; return 0; } else { if (WIFEXITED(status)) { nxinfo << "Loop: Child process '" << pid << "' exited " << "with status '" << (WEXITSTATUS(status)) << "'.\n" << std::flush; lastStatus = WEXITSTATUS(status); } else if (WIFSIGNALED(status)) { if (CheckSignal(WTERMSIG(status)) != 1) { nxwarn << "Loop: WARNING! Child process '" << pid << "' died because of signal " << (WTERMSIG(status)) << ", '" << DumpSignal(WTERMSIG(status)) << "'.\n" << std::flush; cerr << "Warning" << ": Child process '" << pid << "' died because of signal " << (WTERMSIG(status)) << ", '" << DumpSignal(WTERMSIG(status)) << "'.\n"; } else { nxinfo << "Loop: Child process '" << pid << "' died because of signal " << (WTERMSIG(status)) << ", '" << DumpSignal(WTERMSIG(status)) << "'.\n" << std::flush; } lastStatus = 1; } return 1; } } else if (pid < 0) { if (EGET() != ECHILD) { nxfatal << "Loop: PANIC! Call to waitpid failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Call to waitpid failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n"; HandleCleanup(); } // // This can happen when the waitpid() is // blocking, as the SIGCHLD is received // within the call. // nxinfo << "Loop: No more children processes running.\n" << std::flush; return 1; } return 0; } void RegisterChild(int child) { if (IsNotRunning(lastChild)) { nxinfo << "Loop: Registering child process '" << child << "' in process with pid '" << getpid() << "'.\n" << std::flush; } else { nxinfo << "Loop: WARNING! Overriding registered child '" << lastChild << "' with new child '" << child << "' in process with pid '" << getpid() << "'.\n" << std::flush; } lastChild = child; } int CheckParent(const char *name, const char *type, int parent) { if (parent != getppid() || parent == 1) { nxwarn << name << ": WARNING! Parent process appears " << "to be dead. Exiting " << type << ".\n" << std::flush; cerr << "Warning" << ": Parent process appears " << "to be dead. Exiting " << type << ".\n"; return 0; } return 1; } void HandleTimer(int signal) { if (signal == SIGALRM) { if (isTimestamp(lastTimer.start)) { nxinfo << "Loop: Timer expired at " << strMsTimestamp() << " in process with pid '" << getpid() << "'.\n" << std::flush; if (proxy != NULL) { proxy -> handleTimer(); } ResetTimer(); } else { nxfatal << "Loop: PANIC! Inconsistent timer state " << " in process with pid '" << getpid() << "'.\n" << std::flush; cerr << "Error" << ": Inconsistent timer state " << " in process with pid '" << getpid() << "'.\n"; } } else { nxfatal << "Loop: PANIC! Inconsistent signal '" << signal << "', '" << DumpSignal(signal) << "' received in process with pid '" << getpid() << "'.\n" << std::flush; cerr << "Error" << ": Inconsistent signal '" << signal << "', '" << DumpSignal(signal) << "' received in process with pid '" << getpid() << "'.\n"; } } void SetTimer(int value) { getNewTimestamp(); if (isTimestamp(lastTimer.start)) { int diffTs = diffTimestamp(lastTimer.start, getTimestamp()); if (diffTs > lastTimer.next.tv_usec / 1000 * 2) { nxwarn << "Loop: WARNING! Timer missed to expire at " << strMsTimestamp() << " in process with pid '" << getpid() << "'.\n" << std::flush; cerr << "Warning" << ": Timer missed to expire at " << strMsTimestamp() << " in process with pid '" << getpid() << "'.\n"; HandleTimer(SIGALRM); } else { nxinfo << "Loop: Timer already running at " << strMsTimestamp() << " in process with pid '" << getpid() << "'.\n" << std::flush; return; } } // // Save the former handler. // struct sigaction action; memset(&action, 0, sizeof(action)); action.sa_handler = HandleTimer; sigemptyset(&action.sa_mask); action.sa_flags = 0; sigaction(SIGALRM, &action, &lastTimer.action); // // Start the timer. // lastTimer.next = getTimestamp(value); struct itimerval timer; timer.it_interval = lastTimer.next; timer.it_value = lastTimer.next; nxinfo << "Loop: Timer set to " << lastTimer.next.tv_sec << " s and " << lastTimer.next.tv_usec / 1000 << " ms at " << strMsTimestamp() << " in process " << "with pid '" << getpid() << "'.\n" << std::flush; if (setitimer(ITIMER_REAL, &timer, &lastTimer.value) < 0) { nxfatal << "Loop: PANIC! Call to setitimer failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Call to setitimer failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n"; lastTimer.next = nullTimestamp(); return; } lastTimer.start = getTimestamp(); } void ResetTimer() { if (isTimestamp(lastTimer.start) == 0) { nxinfo << "Loop: Timer not running in process " << "with pid '" << getpid() << "'.\n" << std::flush; return; } nxinfo << "Loop: Timer reset at " << strMsTimestamp() << " in process with pid '" << getpid() << "'.\n" << std::flush; // // Restore the old signal mask and timer. // if (setitimer(ITIMER_REAL, &lastTimer.value, NULL) < 0) { nxfatal << "Loop: PANIC! Call to setitimer failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Call to setitimer failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n"; } if (sigaction(SIGALRM, &lastTimer.action, NULL) < 0) { nxfatal << "Loop: PANIC! Call to sigaction failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Call to sigaction failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n"; } lastTimer.start = lastTimer.next = nullTimestamp(); } // // Open TCP or UNIX file socket to listen for remote proxy // and block until remote connects. If successful close // the listening socket and return FD on which the other // party is connected. // int WaitForRemote(ChannelEndPoint &socketAddress) { char hostLabel[DEFAULT_STRING_LENGTH] = { 0 }; char *socketUri = NULL; int retryAccept = -1; int pFD = -1; int newFD = -1; int acceptIPAddr = 0; if (socketAddress.isTCPSocket()) { // // Get IP address of host to be awaited. // if (*acceptHost != '\0') { acceptIPAddr = GetHostAddress(acceptHost); if (acceptIPAddr == 0) { nxfatal << "Loop: PANIC! Cannot accept connections from unknown host '" << acceptHost << "'.\n" << std::flush; cerr << "Error" << ": Cannot accept connections from unknown host '" << acceptHost << "'.\n"; goto WaitForRemoteError; } snprintf(hostLabel, sizeof(hostLabel), "'%s'", acceptHost); } else { strcpy(hostLabel, "any host"); } long _bindPort; if (socketAddress.getTCPHostAndPort(NULL, &_bindPort)) { socketAddress.setSpec(loopbackBind ? "localhost" : "*", _bindPort); } else { // This should never happen cerr << "Error" << ": Unable to change bind host\n"; } } else if (socketAddress.isUnixSocket()) strcpy(hostLabel, "this host"); else strcpy(hostLabel, "unknown origin (something went wrong!!!)"); pFD = ListenConnection(socketAddress, "NX"); SAFE_FREE(socketUri); socketAddress.getSpec(&socketUri); nxinfo << "Loop: Waiting for connection from " << hostLabel << " on socket '" << socketUri << "'.\n" << std::flush; cerr << "Info" << ": Waiting for connection from " << hostLabel << " on socket '" << socketUri << "'.\n"; SAFE_FREE(socketUri); // // How many times to loop waiting for connections // from the selected host? Each loop wait for at // most 20 seconds so a default value of 3 gives // a timeout of 1 minute. // // TODO: Handling of timeouts and retry attempts // must be rewritten. // retryAccept = control -> OptionProxyRetryAccept; for (;;) { fd_set readSet; FD_ZERO(&readSet); FD_SET(pFD, &readSet); T_timestamp selectTs; selectTs.tv_sec = 20; selectTs.tv_usec = 0; int result = select(pFD + 1, &readSet, NULL, NULL, &selectTs); getNewTimestamp(); if (result == -1) { if (EGET() == EINTR) { if (CheckAbort() != 0) { goto WaitForRemoteError; } continue; } nxfatal << "Loop: PANIC! Call to select failed. Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Call to select failed. Error is " << EGET() << " '" << ESTR() << "'.\n"; goto WaitForRemoteError; } else if (result > 0 && FD_ISSET(pFD, &readSet)) { sockaddr_in newAddrINET; if (socketAddress.isUnixSocket()) { socklen_t addrLen = sizeof(sockaddr_un); newFD = accept(pFD, NULL, &addrLen); } else if (socketAddress.isTCPSocket()) { socklen_t addrLen = sizeof(sockaddr_in); newFD = accept(pFD, (sockaddr *) &newAddrINET, &addrLen); } if (newFD == -1) { nxfatal << "Loop: PANIC! Call to accept failed. Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Call to accept failed. Error is " << EGET() << " '" << ESTR() << "'.\n"; goto WaitForRemoteError; } if (socketAddress.isUnixSocket()) { char * unixPath = NULL; socketAddress.getUnixPath(&unixPath); nxinfo << "Loop: Accepted connection from this host on Unix file socket '" << unixPath << "'.\n" << std::flush; cerr << "Info" << ": Accepted connection from this host on Unix file socket '" << unixPath << "'.\n"; SAFE_FREE(unixPath); break; } else if (socketAddress.isTCPSocket()) { char *connectedHost = inet_ntoa(newAddrINET.sin_addr); if (*acceptHost == '\0' || (int) newAddrINET.sin_addr.s_addr == acceptIPAddr) { unsigned int connectedPort = ntohs(newAddrINET.sin_port); nxinfo << "Loop: Accepted connection from '" << connectedHost << "' with port '" << connectedPort << "'.\n" << std::flush; cerr << "Info" << ": Accepted connection from '" << connectedHost << "'.\n"; break; } else { nxfatal << "Loop: WARNING! Refusing connection from '" << connectedHost << "' on port '" << socketAddress.getTCPPort() << "'.\n" << std::flush; cerr << "Warning" << ": Refusing connection from '" << connectedHost << "'.\n"; } // // Not the best way to elude a DOS attack... // sleep(5); close(newFD); } } if (--retryAccept == 0) { if (socketAddress.isUnixSocket()) { nxfatal << "Loop: PANIC! Connection via Unix file socket from this host " << "could not be established.\n" << std::flush; cerr << "Error" << ": Connection via Unix file socket from this host " << "could not be established.\n"; } else if (*acceptHost == '\0') { nxfatal << "Loop: PANIC! Connection with remote host " << "could not be established.\n" << std::flush; cerr << "Error" << ": Connection with remote host " << "could not be established.\n"; } else { nxfatal << "Loop: PANIC! Connection with remote host '" << acceptHost << "' could not be established.\n" << std::flush; cerr << "Error" << ": Connection with remote host '" << acceptHost << "' could not be established.\n"; } goto WaitForRemoteError; } else { handleCheckSessionInConnect(); } } close(pFD); return newFD; WaitForRemoteError: close(pFD); HandleCleanup(); } int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout, int* proxyFileDescriptor, int* reason) { if (!proxyFileDescriptor) { nxfatal << "Loop: PANIC! Implementation error (PrepareProxyConnectionTCP). " << "'proxyFileDescriptor' must not be a NULL pointer.\n" << std::flush; cerr << "Error" << ": Implementation error (PrepareProxyConnectionTCP). " << "'proxyFileDescriptor' must not be a NULL pointer.\n"; return -1; } if (!reason) { nxfatal << "Loop: PANIC! Implementation error (PrepareProxyConnectionTCP). " << "'reason' must not be a NULL pointer.\n" << std::flush; cerr << "Error" << ": Implementation error (PrepareProxyConnectionTCP). " << "'reason' must not be a NULL pointer.\n"; return -1; } int remoteIPAddr = GetHostAddress(*hostName); if (remoteIPAddr == 0) { nxfatal << "Loop: PANIC! Unknown remote host '" << *hostName << "'.\n" << std::flush; cerr << "Error" << ": Unknown remote host '" << *hostName << "'.\n"; SAFE_FREE(*hostName); HandleCleanup(); } nxinfo << "Loop: Connecting to remote host '" << *hostName << ":" << *portNum << "'.\n" << std::flush; cerr << "Info" << ": Connecting to remote host '" << *hostName << ":" << *portNum << "'.\n" << logofs_flush; *proxyFileDescriptor = -1; *reason = -1; sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(*portNum); addr.sin_addr.s_addr = remoteIPAddr; *proxyFileDescriptor = socket(AF_INET, SOCK_STREAM, PF_UNSPEC); *reason = EGET(); if (*proxyFileDescriptor == -1) { nxfatal << "Loop: PANIC! Call to socket failed. " << "Error is " << *reason << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Call to socket failed. " << "Error is " << *reason << " '" << ESTR() << "'.\n"; return -1; } else if (SetReuseAddress(*proxyFileDescriptor) < 0) { return -1; } // // Ensure operation is timed out // if there is a network problem. // if (timeout) SetTimer(*timeout); else SetTimer(20000); int result = connect(*proxyFileDescriptor, (sockaddr *) &addr, sizeof(sockaddr_in)); *reason = EGET(); ResetTimer(); return result; } int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFileDescriptor, int* reason) { if (!proxyFileDescriptor) { nxfatal << "Loop: PANIC! Implementation error (PrepareProxyConnectionUnix). " << "proxyFileDescriptor must not be a NULL pointer.\n" << std::flush; cerr << "Error" << ": Implementation error (PrepareProxyConnectionUnix). " << "proxyFileDescriptor must not be a NULL pointer.\n"; return -1; } if (!reason) { nxfatal << "Loop: PANIC! Implementation error (PrepareProxyConnectionUnix). " << "'reason' must not be a NULL pointer.\n" << std::flush; cerr << "Error" << ": Implementation error (PrepareProxyConnectionUnix). " << "'reason' must not be a NULL pointer.\n"; return -1; } /* FIXME: Add socket file existence and permission checks */ *proxyFileDescriptor = -1; *reason = -1; // determine the maximum number of characters that fit into struct // sockaddr_un's sun_path member const std::size_t sockpathlen = sizeof(struct sockaddr_un) - offsetof(struct sockaddr_un, sun_path); sockaddr_un addr; addr.sun_family = AF_UNIX; snprintf(addr.sun_path, sockpathlen, "%s", *path); *proxyFileDescriptor = socket(AF_UNIX, SOCK_STREAM, PF_UNSPEC); *reason = EGET(); if (*proxyFileDescriptor == -1) { nxfatal << "Loop: PANIC! Call to socket failed. " << "Error is " << *reason << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Call to socket failed. " << "Error is " << *reason << " '" << ESTR() << "'.\n"; return -1; } // // Ensure operation is timed out // if there is a network problem. // if (timeout) SetTimer(*timeout); else SetTimer(20000); int result = connect(*proxyFileDescriptor, (sockaddr *) &addr, sizeof(sockaddr_un)); *reason = EGET(); ResetTimer(); return result; } // // Connect to remote proxy. If successful // return FD of connection, else return -1. // int ConnectToRemote(ChannelEndPoint &socketAddress) { // // How many times we retry to connect to remote // host / Unix domain socket in case of failure? // int retryConnect = control -> OptionProxyRetryConnect; // // Show an alert after 20 seconds and use the // same timeout to interrupt the connect. The // retry timeout is incremental, starting from // 100 milliseconds up to 1 second. // int alertTimeout = 20000; int connectTimeout = 20000; int retryTimeout = 100; T_timestamp lastRetry = getNewTimestamp(); int result = -1; int reason = -1; int pFD = -1; char *hostName = NULL; long int portNum = -1; char *unixPath = NULL; for (;;) { nxdbg << "Loop: Timer set to " << connectTimeout / 1000 << " s " << "with retry set to " << retryConnect << " in process with pid '" << getpid() << "'.\n" << std::flush; SAFE_FREE(hostName); SAFE_FREE(unixPath); if (socketAddress.getUnixPath(&unixPath)) result = PrepareProxyConnectionUnix(&unixPath, &connectTimeout, &pFD, &reason); else if (socketAddress.getTCPHostAndPort(&hostName, &portNum)) result = PrepareProxyConnectionTCP(&hostName, &portNum, &connectTimeout, &pFD, &reason); if (result < 0) { close(pFD); if (CheckAbort() != 0) { goto ConnectToRemoteError; } else if (--retryConnect == 0) { ESET(reason); if (socketAddress.isUnixSocket()) { nxfatal << "Loop: PANIC! Connection to Unix file socket '" << unixPath << "' failed. Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Connection to Unix file socket '" << unixPath << "' failed. Error is " << EGET() << " '" << ESTR() << "'.\n"; } else { nxfatal << "Loop: PANIC! Connection to '" << hostName << ":" << portNum << "' failed. Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Connection to '" << hostName << ":" << portNum << "' failed. Error is " << EGET() << " '" << ESTR() << "'.\n"; } goto ConnectToRemoteError; } else { nxinfo << "Loop: Sleeping " << retryTimeout << " ms before retrying.\n" << std::flush; usleep(retryTimeout * 1000); retryTimeout <<= 1; if (retryTimeout > 1000 * 1000) { retryTimeout = 1000 * 1000; } } // // Check if it is time to show an alert dialog. // if (diffTimestamp(lastRetry, getNewTimestamp()) >= (alertTimeout - control -> LatencyTimeout)) { if (IsNotRunning(lastDialog)) { handleCheckSessionInConnect(); // // Wait for the dialog process to die // unless a signal is received. // while (IsRunning(lastDialog)) { WaitChild(lastDialog, "dialog", 0); if (CheckAbort() != 0) { // // The client ignores the TERM signal // on Windows. // #ifdef __CYGWIN32__ KillProcess(lastDialog, "dialog", SIGKILL, 1); #else KillProcess(lastDialog, "dialog", SIGTERM, 1); #endif goto ConnectToRemoteError; } } lastRetry = getTimestamp(); } } { nxinfo << "Loop: Not showing the dialog with " << (diffTimestamp(lastRetry, getTimestamp()) / 1000) << " seconds elapsed.\n" << std::flush; } ESET(reason); if (unixPath && unixPath[0] != '\0' ) { nxinfo << "Loop: Connection to Unix socket file '" << unixPath << "' failed with error '" << ESTR() << "'. Retrying.\n" << std::flush; } else { nxinfo << "Loop: Connection to '" << hostName << ":" << portNum << "' failed with error '" << ESTR() << "'. Retrying.\n" << std::flush; } } else { // // Connection was successful. // break; } } SAFE_FREE(unixPath); SAFE_FREE(hostName); return pFD; ConnectToRemoteError: SAFE_FREE(unixPath); SAFE_FREE(hostName); if (pFD != -1) { close(pFD); } HandleCleanup(); } // // Make a string of options for the remote // proxy and write it to the descriptor. // The string includes the local version. // int SendProxyOptions(int fd) { char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; // // Send the "compatibility" version first, then our // actual version. Old proxies will take the first // value and ignore the second. // sprintf(options, "NXPROXY-%s-%i.%i.%i", control -> NXPROXY_COMPATIBILITY_VERSION, control -> LocalVersionMajor, control -> LocalVersionMinor, control -> LocalVersionPatch); // // If you want to send options from proxy // initiating the connection use something // like this: // // if (WE_PROVIDE_CREDENTIALS) // { // sprintf(options + strlen(options), "%s=%s", option, value); // } // // If you want to send options according to // local proxy mode use something like this: // // if (control -> ProxyMode == proxy_client) // { // sprintf(options + strlen(options), "%s=%s", option, value); // } // // // Send the authorization cookie if any. We assume // user can choose to not provide any auth cookie // and allow any connection to be accepted. // if (WE_PROVIDE_CREDENTIALS && *authCookie != '\0') { sprintf(options + strlen(options), " cookie=%s,", authCookie); } else { sprintf(options + strlen(options), " "); } // // Now link characteristics and compression // options. Delta compression, as well as // preferred pack method, are imposed by // client proxy. // if (control -> ProxyMode == proxy_client) { sprintf(options + strlen(options), "link=%s,pack=%s,cache=%s,", linkSpeedName, packMethodName, cacheSizeName); if (*bitrateLimitName != '\0') { sprintf(options + strlen(options), "limit=%s,", bitrateLimitName); } // // Let the user disable the render extension // and let the X client proxy know if it can // short-circuit the X replies. Also pass // along the session type to ensure that the // remote proxy gets the right value. // sprintf(options + strlen(options), "render=%d,taint=%d,", (control -> HideRender == 0), control -> TaintReplies); if (*sessionType != '\0') { sprintf(options + strlen(options), "type=%s,", sessionType); } else { sprintf(options + strlen(options), "type=default,"); } // // Add the 'strict' option, if needed. // // Since ProtoStep7 (#issue 108) if (useStrict != -1) { sprintf(options + strlen(options), "strict=%d,", useStrict); } // // Tell the remote the size of the shared // memory segment. // // Since ProtoStep7 (#issue 108) if (*shsegSizeName != '\0') { sprintf(options + strlen(options), "shseg=%s,", shsegSizeName); } // // Send image cache parameters. // sprintf(options + strlen(options), "images=%s,", imagesSizeName); sprintf(options + strlen(options), "delta=%d,stream=%d,data=%d ", control -> LocalDeltaCompression, control -> LocalStreamCompressionLevel, control -> LocalDataCompressionLevel); } else { // // If no special compression level was selected, // server side will use compression levels set // by client. // if (control -> LocalStreamCompressionLevel < 0) { sprintf(options + strlen(options), "stream=default,"); } else { sprintf(options + strlen(options), "stream=%d,", control -> LocalStreamCompressionLevel); } if (control -> LocalDataCompressionLevel < 0) { sprintf(options + strlen(options), "data=default "); } else { sprintf(options + strlen(options), "data=%d ", control -> LocalDataCompressionLevel); } } nxinfo << "Loop: Sending remote options '" << options << "'.\n" << std::flush; return WriteLocalData(fd, options, strlen(options)); } int ReadProxyVersion(int fd) { nxinfo << "Loop: Going to read the remote proxy version " << "from FD#" << fd << ".\n" << std::flush; // // Read until the first space in string. // We expect the remote version number. // char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; int result = ReadRemoteData(fd, options, sizeof(options), ' '); if (result <= 0) { if (result < 0) { if (control -> ProxyMode == proxy_server) { HandleAlert(ABORT_PROXY_NEGOTIATION_ALERT, 1); } handleAlertInLoop(); } return result; } nxinfo << "Loop: Received remote version string '" << options << "' from FD#" << fd << ".\n" << std::flush; if (strncmp(options, "NXPROXY-", strlen("NXPROXY-")) != 0) { nxfatal << "Loop: PANIC! Parse error in remote options string '" << options << "'.\n" << std::flush; cerr << "Error" << ": Parse error in remote options string '" << options << "'.\n"; return -1; } // // Try to determine if this is a pre-2.0.0 // version advertising itself as compatible // with the 1.2.2. // int major = -1; int minor = -1; int patch = -1; sscanf(options, "NXPROXY-%i.%i.%i-%i.%i.%i", &(control -> RemoteVersionMajor), &(control -> RemoteVersionMinor), &(control -> RemoteVersionPatch), &major, &minor, &patch); if (control -> RemoteVersionMajor == 1 && control -> RemoteVersionMinor == 2 && control -> RemoteVersionPatch == 2 && major != -1 && minor != -1 && patch != -1) { nxinfo << "Loop: Read trailing remote version '" << major << "." << minor << "." << patch << "'.\n" << std::flush; control -> CompatVersionMajor = major; control -> CompatVersionMinor = minor; control -> CompatVersionPatch = patch; control -> RemoteVersionMajor = major; control -> RemoteVersionMinor = minor; control -> RemoteVersionPatch = patch; } else { // // We read the remote version at the first // round. If the second version is missing, // we will retain the values read before. // sscanf(options, "NXPROXY-%i.%i.%i-%i.%i.%i", &(control -> CompatVersionMajor), &(control -> CompatVersionMinor), &(control -> CompatVersionPatch), &(control -> RemoteVersionMajor), &(control -> RemoteVersionMinor), &(control -> RemoteVersionPatch)); } *logofs << "Loop: Identified remote version '" << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor << "." << control -> RemoteVersionPatch << "'.\n" << logofs_flush; *logofs << "Loop: Remote compatibility version '" << control -> CompatVersionMajor << "." << control -> CompatVersionMinor << "." << control -> CompatVersionPatch << "'.\n" << logofs_flush; *logofs << "Loop: Local version '" << control -> LocalVersionMajor << "." << control -> LocalVersionMinor << "." << control -> LocalVersionPatch << "'.\n" << logofs_flush; if (SetVersion() < 0) { if (control -> ProxyMode == proxy_server) { HandleAlert(WRONG_PROXY_VERSION_ALERT, 1); } handleAlertInLoop(); return -1; } return 1; } int ReadProxyOptions(int fd) { nxinfo << "Loop: Going to read the remote proxy options " << "from FD#" << fd << ".\n" << std::flush; char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; int result = ReadRemoteData(fd, options, sizeof(options), ' '); if (result <= 0) { return result; } nxinfo << "Loop: Received remote options string '" << options << "' from FD#" << fd << ".\n" << std::flush; // // Get the remote options, delimited by a space character. // Note that there will be a further initialization phase // at the time proxies negotiate cache file to restore. // if (ParseRemoteOptions(options) < 0) { nxfatal << "Loop: PANIC! Couldn't negotiate a valid " << "session with remote NX proxy.\n" << std::flush; cerr << "Error" << ": Couldn't negotiate a valid " << "session with remote NX proxy.\n"; return -1; } return 1; } int SendProxyCaches(int fd) { nxinfo << "Loop: Synchronizing local and remote caches.\n" << std::flush; if (control -> ProxyMode == proxy_client) { // // Prepare a list of caches matching this // session type and send it to the remote. // nxinfo << "Loop: Going to send the list of local caches.\n" << std::flush; SetCaches(); int entries = DEFAULT_REMOTE_CACHE_ENTRIES; const char prefix = 'C'; if (control -> LocalDeltaCompression == 0 || control -> PersistentCacheEnableLoad == 0) { nxinfo << "Loop: Writing an empty list to FD#" << fd << ".\n" << std::flush; return WriteLocalData(fd, "cachelist=none ", strlen("cachelist=none ")); } int count = 0; nxinfo << "Loop: Looking for cache files in directory '" << control -> PersistentCachePath << "'.\n" << std::flush; DIR *cacheDir = opendir(control -> PersistentCachePath); if (cacheDir != NULL) { dirent *dirEntry; int prologue = 0; while (((dirEntry = readdir(cacheDir)) != NULL) && (count < entries)) { if (*dirEntry -> d_name == prefix && strlen(dirEntry -> d_name) == (MD5_LENGTH * 2 + 2)) { if (prologue == 0) { WriteLocalData(fd, "cachelist=", strlen("cachelist=")); prologue = 1; } else { WriteLocalData(fd, ",", strlen(",")); } nxinfo << "Loop: Writing entry '" << control -> PersistentCachePath << "/" << dirEntry -> d_name << "' to FD#" << fd << ".\n" << std::flush; // // Write cache file name to the socket, // including leading 'C-' or 'S-'. // WriteLocalData(fd, dirEntry -> d_name, MD5_LENGTH * 2 + 2); count++; } } closedir(cacheDir); } if (count == 0) { nxinfo << "Loop: Writing an empty list to FD#" << fd << ".\n" << std::flush; return WriteLocalData(fd, "cachelist=none ", strlen("cachelist=none ")); } else { return WriteLocalData(fd, " ", 1); } } else { // // Send back the selected cache name. // nxinfo << "Loop: Going to send the selected cache.\n" << std::flush; char buffer[DEFAULT_STRING_LENGTH]; if (control -> PersistentCacheName != NULL) { nxinfo << "Loop: Name of selected cache file is '" << control -> PersistentCacheName << "'.\n" << std::flush; sprintf(buffer, "cachefile=%s%s ", *(control -> PersistentCacheName) == 'C' ? "S-" : "C-", control -> PersistentCacheName + 2); } else { nxinfo << "Loop: No valid cache file was selected.\n" << std::flush; sprintf(buffer, "cachefile=none "); } nxinfo << "Loop: Sending string '" << buffer << "' as selected cache file.\n" << std::flush; return WriteLocalData(fd, buffer, strlen(buffer)); } } int ReadProxyCaches(int fd) { if (control -> ProxyMode == proxy_client) { nxinfo << "Loop: Going to receive the selected proxy cache.\n" << std::flush; // // We will read the name of cache plus the stop character. // char buffer[DEFAULT_STRING_LENGTH]; // // Leave space for a trailing null. // int result = ReadRemoteData(fd, buffer, sizeof("cachefile=") + MD5_LENGTH * 2 + 3, ' '); if (result <= 0) { return result; } char *cacheName = strstr(buffer, "cachefile="); if (cacheName == NULL) { nxfatal << "Loop: PANIC! Invalid cache file option '" << buffer << "' provided by remote proxy.\n" << std::flush; cerr << "Error" << ": Invalid cache file option '" << buffer << "' provided by remote proxy.\n"; HandleCleanup(); } cacheName += strlen("cachefile="); if (control -> PersistentCacheName != NULL) { delete [] control -> PersistentCacheName; } control -> PersistentCacheName = NULL; if (strncasecmp(cacheName, "none", strlen("none")) == 0) { nxinfo << "Loop: No cache file selected by remote proxy.\n" << std::flush; } else if (strlen(cacheName) != MD5_LENGTH * 2 + 3 || *(cacheName + MD5_LENGTH * 2 + 2) != ' ') { nxfatal << "Loop: PANIC! Invalid cache file name '" << cacheName << "' provided by remote proxy.\n" << std::flush; cerr << "Error" << ": Invalid cache file name '" << cacheName << "' provided by remote proxy.\n"; HandleCleanup(); } else { // // It is "C-" + 32 + "\0". // control -> PersistentCacheName = new char[MD5_LENGTH * 2 + 3]; *(cacheName + MD5_LENGTH * 2 + 2) = '\0'; strcpy(control -> PersistentCacheName, cacheName); nxinfo << "Loop: Cache file '" << control -> PersistentCacheName << "' selected by remote proxy.\n" << std::flush; } } else { nxinfo << "Loop: Going to receive the list of remote caches.\n" << std::flush; SetCaches(); int size = ((MD5_LENGTH * 2 + 2) + strlen(",")) * DEFAULT_REMOTE_CACHE_ENTRIES + strlen("cachelist=") + strlen(" ") + 1; char *buffer = new char[size]; int result = ReadRemoteData(fd, buffer, size - 1, ' '); if (result <= 0) { delete [] buffer; return result; } nxinfo << "Loop: Read list of caches from remote side as '" << buffer << "'.\n" << std::flush; // // Prepare the buffer. What we want is a list // like "cache1,cache2,cache2" terminated by // null. // *(buffer + strlen(buffer) - 1) = '\0'; if (strncasecmp(buffer, "cachelist=", strlen("cachelist=")) != 0) { nxfatal << "Loop: Wrong format for list of cache files " << "read from FD#" << fd << ".\n" << std::flush; cerr << "Error" << ": Wrong format for list of cache files.\n"; delete [] buffer; return -1; } control -> PersistentCacheName = GetLastCache(buffer, control -> PersistentCachePath); // // Get rid of list of caches. // delete [] buffer; } return 1; } int ReadForwarderVersion(int fd) { nxinfo << "Loop: Going to negotiate the forwarder version.\n" << std::flush; // // Check if we actually expect the session cookie. // if (*authCookie == '\0') { nxinfo << "Loop: No authentication cookie required " << "from FD#" << fd << ".\n" << std::flush; return 1; } char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; int result = ReadRemoteData(fd, options, sizeof(options), ' '); if (result <= 0) { return result; } nxinfo << "Loop: Received forwarder version string '" << options << "' from FD#" << fd << ".\n" << std::flush; if (strncmp(options, "NXSSH-", strlen("NXSSH-")) != 0) { nxfatal << "Loop: PANIC! Parse error in forwarder options string '" << options << "'.\n" << std::flush; cerr << "Error" << ": Parse error in forwarder options string '" << options << "'.\n"; return -1; } // // Accept whatever forwarder version. // sscanf(options, "NXSSH-%i.%i.%i", &(control -> RemoteVersionMajor), &(control -> RemoteVersionMinor), &(control -> RemoteVersionPatch)); nxinfo << "Loop: Read forwarder version '" << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor << "." << control -> RemoteVersionPatch << "'.\n" << std::flush; return 1; } int ReadForwarderOptions(int fd) { // // Get the forwarder cookie. // if (*authCookie == '\0') { nxinfo << "Loop: No authentication cookie required " << "from FD#" << fd << ".\n" << std::flush; return 1; } char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; int result = ReadRemoteData(fd, options, sizeof(options), ' '); if (result <= 0) { return result; } nxinfo << "Loop: Received forwarder options string '" << options << "' from FD#" << fd << ".\n" << std::flush; if (ParseForwarderOptions(options) < 0) { nxfatal << "Loop: PANIC! Couldn't negotiate a valid " << "cookie with the NX forwarder.\n" << std::flush; cerr << "Error" << ": Couldn't negotiate a valid " << "cookie with the NX forwarder.\n"; return -1; } return 1; } int ReadRemoteData(int fd, char *buffer, int size, char stop) { nxinfo << "Loop: Going to read remote data from FD#" << fd << ".\n" << std::flush; if (size >= MAXIMUM_REMOTE_OPTIONS_LENGTH) { nxfatal << "Loop: PANIC! Maximum remote options buffer " << "limit exceeded.\n" << std::flush; cerr << "Error" << ": Maximum remote options buffer " << "limit exceeded.\n"; HandleCleanup(); } while (remotePosition < (size - 1)) { int result = read(fd, remoteData + remotePosition, 1); getNewTimestamp(); if (result <= 0) { if (result == -1) { if (EGET() == EAGAIN) { nxinfo << "Loop: Reading data from FD#" << fd << " would block.\n" << std::flush; return 0; } else if (EGET() == EINTR) { if (CheckAbort() != 0) { return -1; } continue; } } nxfatal << "Loop: PANIC! The remote NX proxy closed " << "the connection.\n" << std::flush; cerr << "Error" << ": The remote NX proxy closed " << "the connection.\n"; return -1; } else if (*(remoteData + remotePosition) == stop) { nxinfo << "Loop: Read stop character from FD#" << fd << ".\n" << std::flush; remotePosition++; // // Copy the fake terminating null // in the buffer. // *(remoteData + remotePosition) = '\0'; memcpy(buffer, remoteData, remotePosition + 1); nxinfo << "Loop: Remote string '" << remoteData << "' read from FD#" << fd << ".\n" << std::flush; int t = remotePosition; remotePosition = 0; return t; } else { // // Make sure string received // from far end is printable. // if (isgraph(*(remoteData + remotePosition)) == 0) { nxwarn << "Loop: WARNING! Non printable character decimal '" << (unsigned int) *(remoteData + remotePosition) << "' received in remote data from FD#" << fd << ".\n" << std::flush; cerr << "Warning" << ": Non printable character decimal '" << (unsigned int) *(remoteData + remotePosition) << "' received in remote data from FD#" << fd << ".\n" << logofs_flush; *(remoteData + remotePosition) = ' '; } nxdbg << "Loop: Read a further character " << "from FD#" << fd << ".\n" << std::flush; remotePosition++; } } *(remoteData + remotePosition) = '\0'; nxfatal << "Loop: PANIC! Stop character missing " << "from FD#" << fd << " after " << remotePosition << " characters read in string '" << remoteData << "'.\n" << std::flush; cerr << "Error" << ": Stop character missing " << "from FD#" << fd << " after " << remotePosition << " characters read in string '" << remoteData << "'.\n"; memcpy(buffer, remoteData, remotePosition); remotePosition = 0; return -1; } static int hexval(char c) { if ((c >= '0') && (c <= '9')) return c - '0'; if ((c >= 'a') && (c <= 'f')) return c - 'a' + 10; if ((c >= 'A') && (c <= 'F')) return c - 'A' + 10; return -1; } static void URLDecodeInPlace(char *str) { if (str) { char *to = str; while (str[0]) { if ((str[0] == '%') && (hexval(str[1]) >= 0) && (hexval(str[2]) >= 0)) { *(to++) = hexval(str[1]) * 16 + hexval(str[2]); str += 3; } else *(to++) = *(str++); } *to = '\0'; } } int WriteLocalData(int fd, const char *buffer, int size) { int position = 0; int ret = 0; fd_set writeSet; struct timeval selectTs = {30, 0}; while (position < size) { // A write to a non-blocking socket may fail with EAGAIN. The problem is // that cache data is done in several writes, and there's no easy way // to handle failure without rewriting a significant amount of code. // // Bailing out of the outer loop would result in restarting the sending // of the entire cache list, which would confuse the other side. FD_ZERO(&writeSet); FD_SET(fd, &writeSet); ret = select(fd+1, NULL, &writeSet, NULL, &selectTs); nxdbg << "Loop: WriteLocalData: select() returned with a code of " << ret << " and remaining timeout of " << selectTs.tv_sec << " sec, " << selectTs.tv_usec << "usec\n" << std::flush; if ( ret < 0 ) { *logofs << "Loop: Error in select() when writing data to FD#" << fd << ": " << strerror(EGET()) << "\n" << logofs_flush; if ( EGET() == EINTR ) continue; return -1; } else if ( ret == 0 ) { *logofs << "Loop: Timeout expired in select() when writing data to FD#" << fd << ": " << strerror(EGET()) << "\n" << logofs_flush; return -1; } int result = write(fd, buffer + position, size - position); getNewTimestamp(); if (result <= 0) { if (result < 0 && (EGET() == EINTR || EGET() == EAGAIN || EGET() == EWOULDBLOCK)) { continue; } nxinfo << "Loop: Error writing data to FD#" << fd << ".\n" << std::flush; return -1; } position += result; } return position; } // // Parse the string passed by calling process in // the environment. This is not necessarily the // content of DISPLAY variable, but can be the // parameters passed when creating the process // or thread. // int ParseEnvironmentOptions(const char *env, int force) { // // Be sure log file is valid. // if (logofs == NULL) { logofs = &cerr; } // // Be sure we have a parameters repository // and a context to jump into because this // can be called before creating the proxy. // if (control == NULL) { control = new Control(); } if (setjmp(context) == 1) { nxinfo << "Loop: Out of the long jump while parsing " << "the environment options.\n" << std::flush; return -1; } if (force == 0 && parsedOptions == 1) { nxinfo << "Loop: Skipping a further parse of environment " << "options string '" << (env != NULL ? env : "") << "'.\n" << std::flush; return 1; } if (env == NULL || *env == '\0') { nxinfo << "Loop: Nothing to do with empty environment " << "options string '" << (env != NULL ? env : "") << "'.\n" << std::flush; return 0; } nxinfo << "Loop: Going to parse the environment options " << "string '" << env << "'.\n" << std::flush; parsedOptions = 1; // // Copy the string passed as parameter // because we need to modify it. // char opts[DEFAULT_DISPLAY_OPTIONS_LENGTH]; #ifdef VALGRIND memset(opts, '\0', DEFAULT_DISPLAY_OPTIONS_LENGTH); #endif if (strlen(env) >= DEFAULT_DISPLAY_OPTIONS_LENGTH) { nxfatal << "Loop: PANIC! Environment options string '" << env << "' exceeds length of " << DEFAULT_DISPLAY_OPTIONS_LENGTH << " characters.\n" << std::flush; cerr << "Error" << ": Environment options string '" << env << "' exceeds length of " << DEFAULT_DISPLAY_OPTIONS_LENGTH << " characters.\n"; return -1; } strcpy(opts, env); char *nextOpts = opts; // // Ensure that DISPLAY environment variable // (roughly) follows the X convention for // transport notation. // if (strncasecmp(opts, "nx/nx,:", 7) == 0 || strncasecmp(opts, "nx,:", 4) == 0) { nxfatal << "Loop: PANIC! Parse error in options string '" << opts << "' at 'nx,:'.\n" << std::flush; cerr << "Error" << ": Parse error in options string '" << opts << "' at 'nx,:'.\n"; return -1; } else if (strncasecmp(opts, "nx/nx,", 6) == 0) { nextOpts += 6; } else if (strncasecmp(opts, "nx,", 3) == 0) { nextOpts += 3; } else if (strncasecmp(opts, "nx:", 3) == 0) { nextOpts += 3; } else if (force == 0) { nxinfo << "Loop: Ignoring host X server display string '" << opts << "'.\n" << std::flush; return 0; } // // Save here the name of the options file and // parse it after all the other options. // char fileOptions[DEFAULT_STRING_LENGTH] = { 0 }; // // The options string is intended to be a series // of name/value tuples in the form name=value // separated by the ',' character ended by a ':' // followed by remote NX proxy port. // char *name; char *value; value = strrchr(nextOpts, ':'); if (value != NULL) { char *check = value + 1; if (*check == '\0' || isdigit(*check) == 0) { nxfatal << "Loop: PANIC! Can't identify NX port in string '" << value << "'.\n" << std::flush; cerr << "Error" << ": Can't identify NX port in string '" << value << "'.\n"; return -1; } proxyPort = atoi(check); // // Get rid of the port specification. // *value = '\0'; } else if (proxyPort == DEFAULT_NX_PROXY_PORT && force == 0) { // // Complain only if user didn't specify // the port on the command line. // nxfatal << "Loop: PANIC! Can't identify NX port in string '" << opts << "'.\n" << std::flush; cerr << "Error" << ": Can't identify NX port in string '" << opts << "'.\n"; return -1; } nxinfo << "Loop: Parsing options string '" << nextOpts << "'.\n" << std::flush; // // Now all the other optional parameters. // name = strtok(nextOpts, "="); char connectHost[DEFAULT_STRING_LENGTH] = { 0 }; long connectPort = -1; while (name) { value = strtok(NULL, ","); URLDecodeInPlace(value); if (CheckArg("environment", name, value) < 0) { return -1; } if (strcasecmp(name, "options") == 0) { snprintf(fileOptions, DEFAULT_STRING_LENGTH, "%s", value); } else if (strcasecmp(name, "display") == 0) { snprintf(displayHost, DEFAULT_STRING_LENGTH, "%s", value); } else if (strcasecmp(name, "link") == 0) { if (control -> ProxyMode == proxy_server) { PrintOptionIgnored("local", name, value); } else if (ParseLinkOption(value) < 0) { nxfatal << "Loop: PANIC! Can't identify 'link' option in string '" << value << "'.\n" << std::flush; cerr << "Error" << ": Can't identify 'link' option in string '" << value << "'.\n"; if (ParseLinkOption("adsl") < 0) return -1; } } else if (strcasecmp(name, "limit") == 0) { if (control -> ProxyMode == proxy_server) { PrintOptionIgnored("local", name, value); } else if (ParseBitrateOption(value) < 0) { nxfatal << "Loop: PANIC! Can't identify option 'limit' in string '" << value << "'.\n" << std::flush; cerr << "Error" << ": Can't identify option 'limit' in string '" << value << "'.\n"; return -1; } } else if (strcasecmp(name, "type") == 0) { // // Type of session, for example "desktop", // "application", "windows", etc. // if (control -> ProxyMode == proxy_server) { PrintOptionIgnored("local", name, value); } else { if (strcasecmp(value, "default") == 0) { *sessionType = '\0'; } else { snprintf(sessionType, DEFAULT_STRING_LENGTH, "%s", value); } } } else if (strcasecmp(name, "listen") == 0) { char *socketUri = NULL; if (connectSocket.getSpec(&socketUri)) { nxfatal << "Loop: PANIC! Can't handle 'listen' and 'connect' parameters " << "at the same time.\n" << std::flush; nxfatal << "Loop: PANIC! Refusing 'listen' parameter with 'connect' being '" << socketUri << "'.\n" << std::flush; cerr << "Error" << ": Can't handle 'listen' and 'connect' parameters " << "at the same time.\n"; cerr << "Error" << ": Refusing 'listen' parameter with 'connect' being '" << socketUri << "'.\n"; SAFE_FREE(socketUri); return -1; } SetAndValidateChannelEndPointArg("local", name, value, listenSocket); } else if (strcasecmp(name, "loopback") == 0) { loopbackBind = ValidateArg("local", name, value); } else if (strcasecmp(name, "accept") == 0) { char *socketUri = NULL; if (connectSocket.getSpec(&socketUri)) { nxfatal << "Loop: PANIC! Can't handle 'accept' and 'connect' parameters " << "at the same time.\n" << std::flush; nxfatal << "Loop: PANIC! Refusing 'accept' parameter with 'connect' being '" << socketUri << "'.\n" << std::flush; cerr << "Error" << ": Can't handle 'accept' and 'connect' parameters " << "at the same time.\n"; cerr << "Error" << ": Refusing 'accept' parameter with 'connect' being '" << socketUri << "'.\n"; SAFE_FREE(socketUri); return -1; } snprintf(acceptHost, DEFAULT_STRING_LENGTH, "%s", value); } else if (strcasecmp(name, "connect") == 0) { if (*acceptHost != '\0') { nxfatal << "Loop: PANIC! Can't handle 'connect' and 'accept' parameters " << "at the same time.\n" << std::flush; nxfatal << "Loop: PANIC! Refusing 'connect' parameter with 'accept' being '" << acceptHost << "'.\n" << std::flush; cerr << "Error" << ": Can't handle 'connect' and 'accept' parameters " << "at the same time.\n"; cerr << "Error" << ": Refusing 'connect' parameter with 'accept' being '" << acceptHost << "'.\n"; return -1; } if ((strncmp(value, "tcp:", 4) == 0) || (strncmp(value, "unix:", 5) == 0)) SetAndValidateChannelEndPointArg("local", name, value, connectSocket); else // if the "connect" parameter does not start with "unix:" or "tcp:" assume // old parameter usage style (providing hostname string only). strcpy(connectHost, value); } else if (strcasecmp(name, "port") == 0) { connectPort = ValidateArg("local", name, value); } else if (strcasecmp(name, "retry") == 0) { control -> OptionProxyRetryConnect = ValidateArg("local", name, value); control -> OptionServerRetryConnect = ValidateArg("local", name, value); } else if (strcasecmp(name, "session") == 0) { snprintf(sessionFileName, DEFAULT_STRING_LENGTH, "%s", value); } else if (strcasecmp(name, "errors") == 0) { // // The old name of the parameter was 'log' // but the default name for the file is // 'errors' so it is more logical to use // the same name. // snprintf(errorsFileName, DEFAULT_STRING_LENGTH, "%s", value); } else if (strcasecmp(name, "root") == 0) { snprintf(rootDir, DEFAULT_STRING_LENGTH, "%s", value); } else if (strcasecmp(name, "id") == 0) { snprintf(sessionId, DEFAULT_STRING_LENGTH, "%s", value); } else if (strcasecmp(name, "stats") == 0) { control -> EnableStatistics = 1; snprintf(statsFileName, DEFAULT_STRING_LENGTH, "%s", value); } else if (strcasecmp(name, "cookie") == 0) { LowercaseArg("local", name, value); snprintf(authCookie, DEFAULT_STRING_LENGTH, "%s", value); } else if (strcasecmp(name, "nodelay") == 0) { useNoDelay = ValidateArg("local", name, value); } else if (strcasecmp(name, "policy") == 0) { if (control -> ProxyMode == proxy_server) { PrintOptionIgnored("local", name, value); } else { usePolicy = ValidateArg("local", name, value); } } else if (strcasecmp(name, "render") == 0) { if (control -> ProxyMode == proxy_server) { PrintOptionIgnored("local", name, value); } else { useRender = ValidateArg("local", name, value); } } else if (strcasecmp(name, "taint") == 0) { if (control -> ProxyMode == proxy_server) { PrintOptionIgnored("local", name, value); } else { useTaint = ValidateArg("local", name, value); } } else if (strcasecmp(name, "delta") == 0) { if (control -> ProxyMode == proxy_server) { PrintOptionIgnored("local", name, value); } else { control -> LocalDeltaCompression = ValidateArg("local", name, value); } } else if (strcasecmp(name, "data") == 0) { control -> LocalDataCompressionLevel = ValidateArg("local", name, value); if (control -> LocalDataCompressionLevel == 0) { control -> LocalDataCompression = 0; } else { control -> LocalDataCompression = 1; } } else if (strcasecmp(name, "stream") == 0) { control -> LocalStreamCompressionLevel = ValidateArg("local", name, value); if (control -> LocalStreamCompressionLevel == 0) { control -> LocalStreamCompression = 0; } else { control -> LocalStreamCompression = 1; } } else if (strcasecmp(name, "memory") == 0) { control -> LocalMemoryLevel = ValidateArg("local", name, value); } else if (strcasecmp(name, "cache") == 0) { if (control -> ProxyMode == proxy_server) { PrintOptionIgnored("local", name, value); } else if (ParseCacheOption(value) < 0) { nxfatal << "Loop: PANIC! Can't identify cache size for string '" << value << "'.\n" << std::flush; cerr << "Error" << ": Can't identify cache size for string '" << value << "'.\n"; return -1; } } else if (strcasecmp(name, "images") == 0) { if (control -> ProxyMode == proxy_server) { PrintOptionIgnored("local", name, value); } else if (ParseImagesOption(value) < 0) { nxfatal << "Loop: PANIC! Can't identify images cache size for string '" << value << "'.\n" << std::flush; cerr << "Error" << ": Can't identify images cache size for string '" << value << "'.\n"; return -1; } } else if (strcasecmp(name, "shseg") == 0) { // // The 'shmem' option is used by the agent, together // with 'shpix' literal. We make the 'shseg' option // specific to the proxy and use it to determine the // size of the shared memory segment, or otherwise 0, // if the use of the shared memory extension should // not be enabled on the real X server. // if (control -> ProxyMode == proxy_server) { PrintOptionIgnored("local", name, value); } else if (ParseShmemOption(value) < 0) { nxfatal << "Loop: PANIC! Can't identify size of shared memory " << "segment in string '" << value << "'.\n" << std::flush; cerr << "Error" << ": Can't identify size of shared memory " << "segment in string '" << value << "'.\n"; return -1; } } else if (strcasecmp(name, "load") == 0) { if (control -> ProxyMode == proxy_server) { PrintOptionIgnored("local", name, value); } else { control -> PersistentCacheEnableLoad = ValidateArg("local", name, value); if (control -> PersistentCacheEnableLoad > 0) { control -> PersistentCacheEnableLoad = 1; } else { if (control -> PersistentCacheName != NULL) { delete [] control -> PersistentCacheName; } control -> PersistentCacheName = NULL; control -> PersistentCacheEnableLoad = 0; } } } else if (strcasecmp(name, "save") == 0) { if (control -> ProxyMode == proxy_server) { PrintOptionIgnored("local", name, value); } else { control -> PersistentCacheEnableSave = ValidateArg("local", name, value); if (control -> PersistentCacheEnableSave > 0) { control -> PersistentCacheEnableSave = 1; } else { if (control -> PersistentCacheName != NULL) { delete [] control -> PersistentCacheName; } control -> PersistentCacheName = NULL; control -> PersistentCacheEnableSave = 0; } } } else if (strcasecmp(name, "cups") == 0) { SetAndValidateChannelEndPointArg("local", name, value, cupsPort); } else if (strcasecmp(name, "sync") == 0) { nxwarn << "Loop: WARNING! No 'sync' channel in current version. " << "Assuming 'cups' channel.\n" << std::flush; cerr << "Warning" << ": No 'sync' channel in current version. " << "Assuming 'cups' channel.\n"; SetAndValidateChannelEndPointArg("local", name, value, cupsPort); } else if (strcasecmp(name, "keybd") == 0 || strcasecmp(name, "aux") == 0) { SetAndValidateChannelEndPointArg("local", name, value, auxPort); } else if (strcasecmp(name, "samba") == 0 || strcasecmp(name, "smb") == 0) { SetAndValidateChannelEndPointArg("local", name, value, smbPort); } else if (strcasecmp(name, "media") == 0) { SetAndValidateChannelEndPointArg("local", name, value, mediaPort); } else if (strcasecmp(name, "http") == 0) { SetAndValidateChannelEndPointArg("local", name, value, httpPort); } else if (strcasecmp(name, "font") == 0) { snprintf(fontPort, DEFAULT_STRING_LENGTH, "%s", value); } else if (strcasecmp(name, "slave") == 0) { SetAndValidateChannelEndPointArg("local", name, value, slavePort); } else if (strcasecmp(name, "mask") == 0) { control -> ChannelMask = ValidateArg("local", name, value); } else if (strcasecmp(name, "timeout") == 0) { int timeout = ValidateArg("local", name, value); if (timeout == 0) { nxinfo << "Loop: Disabling timeout on broken " << "proxy connection.\n" << std::flush; control -> ProxyTimeout = 0; } else { control -> ProxyTimeout = timeout * 1000; } } else if (strcasecmp(name, "cleanup") == 0) { int cleanup = ValidateArg("local", name, value); if (cleanup == 0) { nxinfo << "Loop: Disabling grace timeout on " << "proxy shutdown.\n" << std::flush; control -> CleanupTimeout = 0; } else { control -> CleanupTimeout = cleanup * 1000; } } else if (strcasecmp(name, "pack") == 0) { if (control -> ProxyMode == proxy_server) { PrintOptionIgnored("local", name, value); } else if (ParsePackOption(value) < 0) { nxfatal << "Loop: PANIC! Can't identify pack method for string '" << value << "'.\n" << std::flush; cerr << "Error" << ": Can't identify pack method for string '" << value << "'.\n"; if (ParsePackOption("nopack")<0) return -1; } } else if (strcasecmp(name, "core") == 0) { control -> EnableCoreDumpOnAbort = ValidateArg("local", name, value); } else if (strcasecmp(name, "kill") == 0) { if (control -> KillDaemonOnShutdownNumber < control -> KillDaemonOnShutdownLimit) { nxinfo << "Loop: WARNING! Adding process with pid '" << ValidateArg("local", name, value) << " to the " << "daemons to kill at shutdown.\n" << std::flush; control -> KillDaemonOnShutdown[control -> KillDaemonOnShutdownNumber] = ValidateArg("local", name, value); control -> KillDaemonOnShutdownNumber++; } else { nxwarn << "Loop: WARNING! Number of daemons to kill " << "at shutdown exceeded.\n" << std::flush; cerr << "Warning" << ": Number of daemons to kill " << "at shutdown exceeded.\n"; } } else if (strcasecmp(name, "strict") == 0) { if (control -> ProxyMode == proxy_server) { PrintOptionIgnored("local", name, value); } else { useStrict = ValidateArg("local", name, value); } } else if (strcasecmp(name, "encryption") == 0) { useEncryption = ValidateArg("local", name, value); } else if (strcasecmp(name, "product") == 0) { snprintf(productName, DEFAULT_STRING_LENGTH, "%s", value); } else if (strcasecmp(name, "rootless") == 0 || strcasecmp(name, "geometry") == 0 || strcasecmp(name, "resize") == 0 || strcasecmp(name, "fullscreen") == 0 || strcasecmp(name, "keyboard") == 0 || strcasecmp(name, "clipboard") == 0 || strcasecmp(name, "streaming") == 0 || strcasecmp(name, "backingstore") == 0 || strcasecmp(name, "sleep") == 0 || strcasecmp(name, "keyconv") == 0 || strcasecmp(name, "tolerancechecks") == 0) { nxdbg << "Loop: Ignoring agent option '" << name << "' with value '" << value << "'.\n" << std::flush; } else if (strcasecmp(name, "composite") == 0 || strcasecmp(name, "shmem") == 0 || strcasecmp(name, "shpix") == 0 || strcasecmp(name, "kbtype") == 0 || strcasecmp(name, "client") == 0 || strcasecmp(name, "shadow") == 0 || strcasecmp(name, "shadowuid") == 0 || strcasecmp(name, "shadowmode") == 0 || strcasecmp(name, "clients") == 0 || strcasecmp(name, "xinerama") == 0) { nxdbg << "Loop: Ignoring agent option '" << name << "' with value '" << value << "'.\n" << std::flush; } else if (strcasecmp(name, "defer") == 0 || strcasecmp(name, "tile") == 0 || strcasecmp(name, "menu") == 0 || strcasecmp(name, "magicpixel") == 0 || strcasecmp(name, "autodpi") == 0 || strcasecmp(name, "state") == 0 ) { nxdbg << "Loop: Ignoring agent option '" << name << "' with value '" << value << "'.\n" << std::flush; } else { nxwarn << "Loop: WARNING! Ignoring unknown option '" << name << "' with value '" << value << "'.\n" << std::flush; cerr << "Warning" << ": Ignoring unknown option '" << name << "' with value '" << value << "'.\n"; } name = strtok(NULL, "="); } // End of while (name) ... // Assemble the connectSocket channel end point if parameter values have been old-school... if (connectSocket.disabled() && (connectHost[0] != '\0') && (proxyPort > 0 || connectPort > 0)) { if (connectPort < 0) connectPort = proxyPort + DEFAULT_NX_PROXY_PORT_OFFSET; char tcpHostAndPort[DEFAULT_STRING_LENGTH] = { 0 }; sprintf(tcpHostAndPort, "tcp:%s:%ld", connectHost, connectPort); SetAndValidateChannelEndPointArg("local", name, tcpHostAndPort, connectSocket); } nxinfo << "Loop: Completed parsing of string '" << env << "'.\n" << std::flush; if ((*fileOptions != '\0') && (strncmp(fileOptions, "/dev/", 5) != 0) && (strncmp(fileOptions, "/proc/", 6) != 0) && (strncmp(fileOptions, "/sys/", 5) != 0)) { if (strcmp(fileOptions, optionsFileName) != 0) { nxinfo << "Loop: Reading options from '" << fileOptions << "'.\n" << std::flush; if (ParseFileOptions(fileOptions) < 0) { return -1; } } else { nxwarn << "Loop: WARNING! Name of the options file " << "specified multiple times. Not parsing " << "again.\n" << std::flush; } if (*optionsFileName == '\0') { snprintf(optionsFileName, DEFAULT_STRING_LENGTH, "%s", value); nxinfo << "Loop: Assuming name of options file '" << optionsFileName << "'.\n" << std::flush; } } // // If port where proxy is acting as an X server // was not specified assume the same port where // proxy is listening for the remote peer. // if (xPort == DEFAULT_NX_X_PORT) { xPort = proxyPort; } return 1; } // // Parse the command line options passed by user when // running proxy in stand alone mode. Note that passing // parameters this way is strongly discouraged. These // command line switch can change (and they do often). // Please, use the form "option=value" instead and set // the DISPLAY environment variable. // int ParseCommandLineOptions(int argc, const char **argv) { // // Be sure log file is valid. // if (logofs == NULL) { logofs = &cerr; } if (setjmp(context) == 1) { nxinfo << "Loop: Out of the long jump while parsing " << "the command line options.\n" << std::flush; return -1; } // // Be sure we have a parameters repository // if (control == NULL) { control = new Control(); } if (parsedCommand == 1) { nxinfo << "Loop: Skipping a further parse of command line options.\n" << std::flush; return 1; } nxinfo << "Loop: Going to parse the command line options.\n" << std::flush; parsedCommand = 1; // // Print out arguments. // nxinfo << "Loop: Argc is " << argc << ".\n" << std::flush; for (int argi = 0; argi < argc; argi++) { nxinfo << "Loop: Argv[" << argi << "] is " << argv[argi] << ".\n" << std::flush; } // // Shall use getopt here. // for (int argi = 1; argi < argc; argi++) { const char *nextArg = argv[argi]; if (*nextArg == '-') { switch (*(nextArg + 1)) { case 'h': { PrintUsageInfo(nextArg, 0); return -1; } case 'C': { // // Start proxy in CLIENT mode. // if (WE_SET_PROXY_MODE == 0) { nxinfo << "Loop: Setting local proxy mode to proxy_client.\n" << std::flush; control -> ProxyMode = proxy_client; } else if (control -> ProxyMode != proxy_client) { nxfatal << "Loop: PANIC! Can't redefine local proxy to " << "client mode.\n" << std::flush; cerr << "Error" << ": Can't redefine local proxy to " << "client mode.\n"; return -1; } break; } case 'S': { // // Start proxy in SERVER mode. // if (WE_SET_PROXY_MODE == 0) { nxinfo << "Loop: Setting local proxy mode to proxy_server.\n" << std::flush; control -> ProxyMode = proxy_server; } else if (control -> ProxyMode != proxy_server) { nxfatal << "Loop: PANIC! Can't redefine local proxy to " << "server mode.\n" << std::flush; cerr << "Error" << ": Can't redefine local proxy to " << "server mode.\n"; return -1; } break; } case 'v': { PrintVersionInfo(); return -1; } case 'd': { if ( argi+1 >= argc ) { PrintUsageInfo(nextArg, 0); return -1; } int level = 0; errno = 0; level = strtol(argv[argi+1], NULL, 10); if ( errno && (level == 0) ) { cerr << "Warning: Failed to parse log level. Ignoring option." << std::endl; } if ( level < 0 ) { cerr << "Warning: Log level must be a positive integer. Ignoring option." << std::endl; level = nx_log.level(); } else if ( level >= NXLOG_LEVEL_COUNT ) { cerr << "Warning: Log level is greater than the maximum " << NXLOG_LEVEL_COUNT-1 << ". Setting to the maximum." << std::endl; level = NXLOG_LEVEL_COUNT-1; } nx_log.level( (NXLogLevel)level ); argi++; break; } case 'o': { if ( argi + 1 >= argc ) { PrintUsageInfo(nextArg, 0); return -1; } std::ofstream *logfile = new std::ofstream(); // Unbuffered output logfile->rdbuf()->pubsetbuf(0, 0); logfile->open(argv[argi+1], std::ofstream::app); if ( logfile->is_open() ) { nx_log.stream(logfile); } else { cerr << "Failed to open log file " << argv[argi+1] << endl; return -1; } argi++; break; } case 'f': { if ( argi + 1 >= argc ) { PrintUsageInfo(nextArg, 0); return -1; } const char *format = argv[argi+1]; size_t pos = 0; nx_log.log_level(false); nx_log.log_time(false); nx_log.log_unix_time(false); nx_log.log_location(false); nx_log.log_thread_id(false); for(pos =0;pos 0) { // // Assume port is at a proxied display offset. // proxyPort = cPort; cPort += DEFAULT_NX_PROXY_PORT_OFFSET; connectSocket.setSpec(cHost, cPort); } else if (ParseEnvironmentOptions(nextArg, 1) < 0) { return -1; } } } } return 1; } // // Set the variable to the values of host and // port where this proxy is going to hook to // an existing proxy. // int ParseBindOptions(char **host, int *port) { if (*bindHost != '\0') { *host = bindHost; *port = bindPort; return 1; } else { return 0; } } // // Read options from file and merge with environment. // int ParseFileOptions(const char *file) { char *fileName; if (*file != '/' && *file != '.') { char *filePath = GetSessionPath(); if (filePath == NULL) { cerr << "Error" << ": Cannot determine directory for NX option file.\n"; HandleCleanup(); } fileName = new char[strlen(filePath) + strlen("/") + strlen(file) + 1]; strcpy(fileName, filePath); strcat(fileName, "/"); strcat(fileName, file); delete [] filePath; } else { fileName = new char[strlen(file) + 1]; strcpy(fileName, file); } nxinfo << "Loop: Going to read options from file '" << fileName << "'.\n" << std::flush; FILE *filePtr = fopen(fileName, "r"); if (filePtr == NULL) { nxfatal << "Loop: PANIC! Can't open options file '" << fileName << "'. Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Can't open options file '" << fileName << "'. Error is " << EGET() << " '" << ESTR() << "'.\n"; delete [] fileName; return -1; } char options[DEFAULT_DISPLAY_OPTIONS_LENGTH]; #ifdef VALGRIND memset(options, '\0', DEFAULT_DISPLAY_OPTIONS_LENGTH); #endif if (fgets(options, DEFAULT_DISPLAY_OPTIONS_LENGTH, filePtr) == NULL) { nxfatal << "Loop: PANIC! Can't read options from file '" << fileName << "'. Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Can't read options from file '" << fileName << "'. Error is " << EGET() << " '" << ESTR() << "'.\n"; fclose(filePtr); delete [] fileName; return -1; } fclose(filePtr); // // Purge the newline and the other non- // printable characters in the string. // char *next = options; while (*next != '\0') { if (isprint(*next) == 0) { *next = '\0'; } next++; } nxinfo << "Loop: Read options '" << options << "' from file '" << fileName << "'.\n" << std::flush; if (ParseEnvironmentOptions(options, 1) < 0) { delete [] fileName; return -1; } delete [] fileName; return 1; } // // Parse the option string passed from the // remote proxy at startup. // int ParseRemoteOptions(char *opts) { nxinfo << "Loop: Going to parse the remote options " << "string '" << opts << "'.\n" << std::flush; char *name; char *value; // // The options string is intended to be a series // of name/value tuples in the form name=value // separated by the ',' character. // int hasCookie = 0; int hasLink = 0; int hasPack = 0; int hasCache = 0; int hasImages = 0; int hasDelta = 0; int hasStream = 0; int hasData = 0; int hasType = 0; // // Get rid of the terminating space. // if (*(opts + strlen(opts) - 1) == ' ') { *(opts + strlen(opts) - 1) = '\0'; } name = strtok(opts, "="); while (name) { value = strtok(NULL, ","); if (CheckArg("remote", name, value) < 0) { return -1; } if (strcasecmp(name, "cookie") == 0) { if (WE_PROVIDE_CREDENTIALS) { nxwarn << "Loop: WARNING! Ignoring remote option 'cookie' " << "with value '" << value << "' when initiating " << "connection.\n" << std::flush; cerr << "Warning" << ": Ignoring remote option 'cookie' " << "with value '" << value << "' when initiating " << "connection.\n"; } else if (strncasecmp(authCookie, value, strlen(authCookie)) != 0) { nxfatal << "Loop: PANIC! Authentication cookie '" << value << "' doesn't match '" << authCookie << "'.\n" << std::flush; cerr << "Error" << ": Authentication cookie '" << value << "' doesn't match '" << authCookie << "'.\n"; return -1; } hasCookie = 1; } else if (strcasecmp(name, "link") == 0) { if (control -> ProxyMode == proxy_client) { PrintOptionIgnored("remote", name, value); } else { if (*linkSpeedName != '\0' && strcasecmp(linkSpeedName, value) != 0) { nxwarn << "Loop: WARNING! Overriding option 'link' " << "with new value '" << value << "'.\n" << std::flush; cerr << "Warning" << ": Overriding option 'link' " << "with new value '" << value << "'.\n"; } if (ParseLinkOption(value) < 0) { nxfatal << "Loop: PANIC! Can't identify remote 'link' " << "option in string '" << value << "'.\n" << std::flush; cerr << "Error" << ": Can't identify remote 'link' " << "option in string '" << value << "'.\n"; return -1; } } hasLink = 1; } else if (strcasecmp(name, "pack") == 0) { if (control -> ProxyMode == proxy_client) { PrintOptionIgnored("remote", name, value); } else { if (*packMethodName != '\0' && strcasecmp(packMethodName, value) != 0) { nxwarn << "Loop: WARNING! Overriding option 'pack' " << "with remote value '" << value << "'.\n" << std::flush; cerr << "Warning" << ": Overriding option 'pack' " << "with remote value '" << value << "'.\n"; } if (ParsePackOption(value) < 0) { nxfatal << "Loop: PANIC! Invalid pack option '" << value << "' requested by remote.\n" << std::flush; cerr << "Error" << ": Invalid pack option '" << value << "' requested by remote.\n"; return -1; } } hasPack = 1; } else if (strcasecmp(name, "cache") == 0) { if (control -> ProxyMode == proxy_client) { PrintOptionIgnored("remote", name, value); } else { // // Cache size is sent as a hint of how much memory // the remote proxy is going to consume. A very low // powered thin client could choose to refuse the // connection. // if (ParseCacheOption(value) < 0) { nxfatal << "Loop: PANIC! Can't identify remote 'cache' " << "option in string '" << value << "'.\n" << std::flush; cerr << "Error" << ": Can't identify remote 'cache' " << "option in string '" << value << "'.\n"; return -1; } } hasCache = 1; } else if (strcasecmp(name, "images") == 0) { if (control -> ProxyMode == proxy_client) { PrintOptionIgnored("remote", name, value); } else { // // Images cache size is sent as a hint. // There is no obbligation for the local // proxy to use the persistent cache. // if (ParseImagesOption(value) < 0) { nxfatal << "Loop: PANIC! Can't identify remote 'images' " << "option in string '" << value << "'.\n" << std::flush; cerr << "Error" << ": Can't identify remote 'images' " << "option in string '" << value << "'.\n"; return -1; } } hasImages = 1; } else if (strcasecmp(name, "limit") == 0) { if (control -> ProxyMode == proxy_client) { PrintOptionIgnored("remote", name, value); } else { if (*bitrateLimitName != '\0' && strcasecmp(bitrateLimitName, value) != 0) { nxwarn << "Loop: WARNING! Overriding option 'limit' " << "with new value '" << value << "'.\n" << std::flush; cerr << "Warning" << ": Overriding option 'limit' " << "with new value '" << value << "'.\n"; } if (ParseBitrateOption(value) < 0) { nxfatal << "Loop: PANIC! Can't identify 'limit' " << "option in string '" << value << "'.\n" << std::flush; cerr << "Error" << ": Can't identify 'limit' " << "option in string '" << value << "'.\n"; return -1; } } } else if (strcasecmp(name, "render") == 0) { if (control -> ProxyMode == proxy_client) { PrintOptionIgnored("remote", name, value); } else { useRender = ValidateArg("remote", name, value); } } else if (strcasecmp(name, "taint") == 0) { if (control -> ProxyMode == proxy_client) { PrintOptionIgnored("remote", name, value); } else { useTaint = ValidateArg("remote", name, value); } } else if (strcasecmp(name, "type") == 0) { if (control -> ProxyMode == proxy_client) { PrintOptionIgnored("remote", name, value); } else { if (strcasecmp(value, "default") == 0) { *sessionType = '\0'; } else { snprintf(sessionType, DEFAULT_STRING_LENGTH, "%s", value); } } hasType = 1; } else if (strcasecmp(name, "strict") == 0) { if (control -> ProxyMode == proxy_client) { PrintOptionIgnored("remote", name, value); } else { useStrict = ValidateArg("remote", name, value); } } else if (strcasecmp(name, "shseg") == 0) { if (control -> ProxyMode == proxy_client) { PrintOptionIgnored("remote", name, value); } else if (ParseShmemOption(value) < 0) { nxfatal << "Loop: PANIC! Can't identify size of shared memory " << "segment in string '" << value << "'.\n" << std::flush; cerr << "Error" << ": Can't identify size of shared memory " << "segment in string '" << value << "'.\n"; return -1; } } else if (strcasecmp(name, "delta") == 0) { if (control -> ProxyMode == proxy_client) { PrintOptionIgnored("remote", name, value); } else { control -> RemoteDeltaCompression = ValidateArg("remote", name, value); // // Follow for delta compression the // same settings as the client proxy. // control -> LocalDeltaCompression = control -> RemoteDeltaCompression; } hasDelta = 1; } else if (strcasecmp(name, "stream") == 0) { // // If remote side didn't choose its own // stream compression level then assume // local settings. // if (strcasecmp(value, "default") == 0) { // // This applies only at client side. // control -> RemoteStreamCompression = control -> LocalStreamCompression; control -> RemoteStreamCompressionLevel = control -> LocalStreamCompressionLevel; } else { control -> RemoteStreamCompressionLevel = ValidateArg("remote", name, value); if (control -> RemoteStreamCompressionLevel > 0) { control -> RemoteStreamCompression = 1; } else { control -> RemoteStreamCompression = 0; } if (control -> LocalStreamCompressionLevel < 0) { control -> LocalStreamCompressionLevel = ValidateArg("remote", name, value); if (control -> LocalStreamCompressionLevel > 0) { control -> LocalStreamCompression = 1; } else { control -> LocalStreamCompression = 0; } } } hasStream = 1; } else if (strcasecmp(name, "data") == 0) { // // Apply the same to data compression level. // if (strcasecmp(value, "default") == 0) { control -> RemoteDataCompression = control -> LocalDataCompression; control -> RemoteDataCompressionLevel = control -> LocalDataCompressionLevel; } else { control -> RemoteDataCompressionLevel = ValidateArg("remote", name, value); if (control -> RemoteDataCompressionLevel > 0) { control -> RemoteDataCompression = 1; } else { control -> RemoteDataCompression = 0; } if (control -> LocalDataCompressionLevel < 0) { control -> LocalDataCompressionLevel = ValidateArg("remote", name, value); if (control -> LocalDataCompressionLevel > 0) { control -> LocalDataCompression = 1; } else { control -> LocalDataCompression = 0; } } } hasData = 1; } else if (strcasecmp(name, "flush") == 0) { // // This option has no effect in recent // versions. // nxdbg << "Loop: Ignoring obsolete remote option '" << name << "' with value '" << value << "'.\n" << std::flush; } else { nxwarn << "Loop: WARNING! Ignoring unknown remote option '" << name << "' with value '" << value << "'.\n" << std::flush; cerr << "Warning" << ": Ignoring unknown remote option '" << name << "' with value '" << value << "'.\n"; } name = strtok(NULL, "="); } // End of while (name) ... // // If we are client side, we need remote 'stream' // and 'data' options. If we are server, we need // all the above plus 'link' and some others. // char missing[DEFAULT_STRING_LENGTH]; *missing = '\0'; if (control -> ProxyMode == proxy_client) { if (hasStream == 0) { strcpy(missing, "stream"); } else if (hasData == 0) { strcpy(missing, "data"); } } else { // // Don't complain if the optional 'flush', // 'render' and 'taint' options are not // provided. // if (hasLink == 0) { strcpy(missing, "link"); } else if (hasCache == 0) { strcpy(missing, "cache"); } else if (hasPack == 0) { strcpy(missing, "pack"); } else if (hasDelta == 0) { strcpy(missing, "delta"); } else if (hasStream == 0) { strcpy(missing, "stream"); } else if (hasData == 0) { strcpy(missing, "data"); } else if (hasType == 0) { strcpy(missing, "type"); } else if (hasImages == 0) { strcpy(missing, "images"); } } if (WE_PROVIDE_CREDENTIALS == 0) { // // Can be that user doesn't have requested to // check the authorization cookie provided by // the connecting peer. // if (hasCookie == 0 && *authCookie != '\0') { strcpy(missing, "cookie"); } } if (*missing != '\0') { nxfatal << "Loop: PANIC! The remote peer didn't specify the option '" << missing << "'.\n" << std::flush; cerr << "Error" << ": The remote peer didn't specify the option '" << missing << "'.\n"; return -1; } return 1; } // // Parse the cookie provided by the NX proxy // connection forwarder. // int ParseForwarderOptions(char *opts) { nxinfo << "Loop: Going to parse the forwarder options " << "string '" << opts << "'.\n" << std::flush; char *name; char *value; int hasCookie = 0; // // Get rid of the terminating space. // if (*(opts + strlen(opts) - 1) == ' ') { *(opts + strlen(opts) - 1) = '\0'; } name = strtok(opts, "="); while (name) { value = strtok(NULL, ","); if (CheckArg("forwarder", name, value) < 0) { return -1; } if (strcasecmp(name, "cookie") == 0) { if (strncasecmp(authCookie, value, strlen(authCookie)) != 0) { nxfatal << "Loop: PANIC! The NX forwarder cookie '" << value << "' doesn't match '" << authCookie << "'.\n" << std::flush; cerr << "Error" << ": The NX forwarder cookie '" << value << "' doesn't match '" << authCookie << "'.\n"; return -1; } hasCookie = 1; } else { nxwarn << "Loop: WARNING! Ignoring unknown forwarder option '" << name << "' with value '" << value << "'.\n" << std::flush; cerr << "Warning" << ": Ignoring unknown forwarder option '" << name << "' with value '" << value << "'.\n"; } name = strtok(NULL, "="); } // End of while (name) ... if (hasCookie == 0) { nxfatal << "Loop: PANIC! The NX forwarder didn't provide " << "the authentication cookie.\n" << std::flush; cerr << "Error" << ": The NX forwarder didn't provide " << "the authentication cookie.\n"; return -1; } return 1; } int SetCore() { #ifdef COREDUMPS rlimit rlim; if (getrlimit(RLIMIT_CORE, &rlim)) { nxinfo << "Cannot read RLIMIT_CORE. Error is '" << ESTR() << "'.\n" << std::flush; return -1; } if (rlim.rlim_cur < rlim.rlim_max) { rlim.rlim_cur = rlim.rlim_max; if (setrlimit(RLIMIT_CORE, &rlim)) { nxinfo << "Loop: Cannot read RLIMIT_CORE. Error is '" << ESTR() << "'.\n" << std::flush; return -2; } } nxinfo << "Loop: Set RLIMIT_CORE to "<< rlim.rlim_max << ".\n" << std::flush; #endif // #ifdef COREDUMPS return 1; } char *GetLastCache(char *listBuffer, const char *searchPath) { if (listBuffer == NULL || searchPath == NULL || strncmp(listBuffer, "cachelist=", strlen("cachelist=")) != 0) { nxinfo << "Loop: Invalid parameters '" << listBuffer << "' and '" << (searchPath != NULL ? searchPath : "") << "'. Can't select any cache.\n" << std::flush; return NULL; } char *selectedName = new char[MD5_LENGTH * 2 + 3]; *selectedName = '\0'; const char *localPrefix; const char *remotePrefix; if (control -> ProxyMode == proxy_client) { localPrefix = "C-"; remotePrefix = "S-"; } else { localPrefix = "S-"; remotePrefix = "C-"; } // // Get rid of prefix. // listBuffer += strlen("cachelist="); char *fileName; fileName = strtok(listBuffer, ","); // // It is "/path/to/file" + "/" + "C-" + 32 + "\0". // char fullPath[strlen(searchPath) + MD5_LENGTH * 2 + 4]; time_t selectedTime = 0; struct stat fileStat; while (fileName) { if (strncmp(fileName, "none", strlen("none")) == 0) { nxinfo << "Loop: No cache files seem to be available.\n" << std::flush; delete [] selectedName; return NULL; } else if (strlen(fileName) != MD5_LENGTH * 2 + 2 || strncmp(fileName, remotePrefix, 2) != 0) { nxfatal << "Loop: PANIC! Bad cache file name '" << fileName << "'.\n" << std::flush; cerr << "Error" << ": Bad cache file name '" << fileName << "'.\n"; delete [] selectedName; HandleCleanup(); } nxinfo << "Loop: Parsing remote cache name '" << fileName << "'.\n" << std::flush; // // Prefix, received as "S-", becomes // "C-" and viceversa. // *fileName = *localPrefix; strcpy(fullPath, searchPath); strcat(fullPath, "/"); strcat(fullPath, fileName); if (stat(fullPath, &fileStat) == 0) { nxinfo << "Loop: Found a matching cache '" << std::string(fullPath) << "'.\n" << std::flush; if (fileStat.st_mtime >= selectedTime) { strcpy(selectedName, fileName); selectedTime = fileStat.st_mtime; } } else { nxinfo << "Loop: Can't get stats of file '" << std::string(fullPath) << "'.\n" << std::flush; } fileName = strtok(NULL, ","); } if (*selectedName != '\0') { return selectedName; } else { delete [] selectedName; return NULL; } } char *GetTempPath() { if (*tempDir == '\0') { // // Check the NX_TEMP environment, first, // then the TEMP variable. // const char *tempEnv = getenv("NX_TEMP"); if (tempEnv == NULL || *tempEnv == '\0') { nxinfo << "Loop: WARNING! No environment for NX_TEMP.\n" << std::flush; tempEnv = getenv("TEMP"); if (tempEnv == NULL || *tempEnv == '\0') { nxinfo << "Loop: WARNING! No environment for TEMP.\n" << std::flush; tempEnv = "/tmp"; } } if (strlen(tempEnv) > DEFAULT_STRING_LENGTH - 1) { nxfatal << "Loop: PANIC! Invalid value for the NX " << "temporary directory '" << tempEnv << "'.\n" << std::flush; cerr << "Error" << ": Invalid value for the NX " << "temporary directory '" << tempEnv << "'.\n"; HandleCleanup(); } strcpy(tempDir, tempEnv); nxinfo << "Loop: Assuming temporary NX directory '" << tempDir << "'.\n" << std::flush; } char *tempPath = new char[strlen(tempDir) + 1]; if (tempPath == NULL) { nxfatal << "Loop: PANIC! Can't allocate memory " << "for the temp path.\n" << std::flush; cerr << "Error" << ": Can't allocate memory " << "for the temp path.\n"; HandleCleanup(); } strcpy(tempPath, tempDir); return tempPath; } char *GetClientPath() { if (*clientDir == '\0') { // // Check the NX_CLIENT environment. // const char *clientEnv = getenv("NX_CLIENT"); if (clientEnv == NULL || *clientEnv == '\0') { nxinfo << "Loop: WARNING! No environment for NX_CLIENT.\n" << std::flush; // // Try to guess the location of the client. // clientEnv = "/usr/NX/bin/nxclient"; #ifdef __APPLE__ clientEnv = "/Applications/NX Client for OSX.app/Contents/MacOS/nxclient"; #endif #ifdef __CYGWIN32__ clientEnv = "C:\\Program Files\\NX Client for Windows\\nxclient"; #endif } if (strlen(clientEnv) > DEFAULT_STRING_LENGTH - 1) { nxfatal << "Loop: PANIC! Invalid value for the NX " << "client directory '" << clientEnv << "'.\n" << std::flush; cerr << "Error" << ": Invalid value for the NX " << "client directory '" << clientEnv << "'.\n"; HandleCleanup(); } strcpy(clientDir, clientEnv); nxinfo << "Loop: Assuming NX client location '" << clientDir << "'.\n" << std::flush; } char *clientPath = new char[strlen(clientDir) + 1]; if (clientPath == NULL) { nxfatal << "Loop: PANIC! Can't allocate memory " << "for the client path.\n" << std::flush; cerr << "Error" << ": Can't allocate memory " << "for the client path.\n"; HandleCleanup(); } strcpy(clientPath, clientDir); return clientPath; } char *GetSystemPath() { if (*systemDir == '\0') { // // Check the NX_SYSTEM environment. // const char *systemEnv = getenv("NX_SYSTEM"); if (systemEnv == NULL || *systemEnv == '\0') { nxinfo << "Loop: WARNING! No environment for NX_SYSTEM.\n" << std::flush; systemEnv = "/usr/NX"; } if (strlen(systemEnv) > DEFAULT_STRING_LENGTH - 1) { nxfatal << "Loop: PANIC! Invalid value for the NX " << "system directory '" << systemEnv << "'.\n" << std::flush; cerr << "Error" << ": Invalid value for the NX " << "system directory '" << systemEnv << "'.\n"; HandleCleanup(); } strcpy(systemDir, systemEnv); nxinfo << "Loop: Assuming system NX directory '" << systemDir << "'.\n" << std::flush; } char *systemPath = new char[strlen(systemDir) + 1]; if (systemPath == NULL) { nxfatal << "Loop: PANIC! Can't allocate memory " << "for the system path.\n" << std::flush; cerr << "Error" << ": Can't allocate memory " << "for the system path.\n"; HandleCleanup(); } strcpy(systemPath, systemDir); return systemPath; } char *GetHomePath() { if (*homeDir == '\0') { // // Check the NX_HOME environment. // const char *homeEnv = getenv("NX_HOME"); if (homeEnv == NULL || *homeEnv == '\0') { nxinfo << "Loop: WARNING! No environment for NX_HOME.\n" << std::flush; homeEnv = getenv("HOME"); if (homeEnv == NULL || *homeEnv == '\0') { nxfatal << "Loop: PANIC! No environment for HOME.\n" << std::flush; cerr << "Error" << ": No environment for HOME.\n"; HandleCleanup(); } } if (strlen(homeEnv) > DEFAULT_STRING_LENGTH - 1) { nxfatal << "Loop: PANIC! Invalid value for the NX " << "home directory '" << homeEnv << "'.\n" << std::flush; cerr << "Error" << ": Invalid value for the NX " << "home directory '" << homeEnv << "'.\n"; HandleCleanup(); } strcpy(homeDir, homeEnv); nxinfo << "Loop: Assuming NX user's home directory '" << homeDir << "'.\n" << std::flush; } char *homePath = new char[strlen(homeDir) + 1]; if (homePath == NULL) { nxfatal << "Loop: PANIC! Can't allocate memory " << "for the home path.\n" << std::flush; cerr << "Error" << ": Can't allocate memory " << "for the home path.\n"; HandleCleanup(); } strcpy(homePath, homeDir); return homePath; } char *GetRootPath() { if (*rootDir == '\0') { // // Check the NX_ROOT environment. // const char *rootEnv = getenv("NX_ROOT"); if (rootEnv == NULL || *rootEnv == '\0') { nxinfo << "Loop: WARNING! No environment for NX_ROOT.\n" << std::flush; // // We will determine the root NX directory // based on the NX_HOME or HOME directory // settings. // const char *homeEnv = GetHomePath(); if (strlen(homeEnv) > DEFAULT_STRING_LENGTH - strlen("/.nx") - 1) { nxfatal << "Loop: PANIC! Invalid value for the NX " << "home directory '" << homeEnv << "'.\n" << std::flush; cerr << "Error" << ": Invalid value for the NX " << "home directory '" << homeEnv << "'.\n"; HandleCleanup(); } nxinfo << "Loop: Assuming NX root directory in " << "the user's home '" << homeEnv << "'.\n" << std::flush; strcpy(rootDir, homeEnv); strcat(rootDir, "/.nx"); delete [] homeEnv; // // Create the NX root directory. // struct stat dirStat; if ((stat(rootDir, &dirStat) == -1) && (EGET() == ENOENT)) { if (mkdir(rootDir, 0700) < 0 && (EGET() != EEXIST)) { nxfatal << "Loop: PANIC! Can't create directory '" << rootDir << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Can't create directory '" << rootDir << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; HandleCleanup(); } } } else { if (strlen(rootEnv) > DEFAULT_STRING_LENGTH - 1) { nxfatal << "Loop: PANIC! Invalid value for the NX " << "root directory '" << rootEnv << "'.\n" << std::flush; cerr << "Error" << ": Invalid value for the NX " << "root directory '" << rootEnv << "'.\n"; HandleCleanup(); } strcpy(rootDir, rootEnv); } nxinfo << "Loop: Assuming NX root directory '" << rootDir << "'.\n" << std::flush; } char *rootPath = new char[strlen(rootDir) + 1]; if (rootPath == NULL) { nxfatal << "Loop: PANIC! Can't allocate memory " << "for the root path.\n" << std::flush; cerr << "Error" << ": Can't allocate memory " << "for the root path.\n"; HandleCleanup(); } strcpy(rootPath, rootDir); return rootPath; } char *GetCachePath() { char *rootPath = GetRootPath(); char *cachePath; if (*sessionType != '\0') { cachePath = new char[strlen(rootPath) + strlen("/cache-") + strlen(sessionType) + 1]; } else { cachePath = new char[strlen(rootPath) + strlen("/cache") + 1]; } strcpy(cachePath, rootPath); if (*sessionType != '\0') { strcat(cachePath, "/cache-"); strcat(cachePath, sessionType); } else { strcat(cachePath, "/cache"); } // // Create the cache directory if needed. // struct stat dirStat; if ((stat(cachePath, &dirStat) == -1) && (EGET() == ENOENT)) { if (mkdir(cachePath, 0700) < 0 && (EGET() != EEXIST)) { nxfatal << "Loop: PANIC! Can't create directory '" << cachePath << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Can't create directory '" << cachePath << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; delete [] rootPath; delete [] cachePath; return NULL; } } delete [] rootPath; return cachePath; } char *GetImagesPath() { char *rootPath = GetRootPath(); char *imagesPath = new char[strlen(rootPath) + strlen("/images") + 1]; strcpy(imagesPath, rootPath); strcat(imagesPath, "/images"); // // Create the cache directory if needed. // struct stat dirStat; if ((stat(imagesPath, &dirStat) == -1) && (EGET() == ENOENT)) { if (mkdir(imagesPath, 0700) < 0 && (EGET() != EEXIST)) { nxfatal << "Loop: PANIC! Can't create directory '" << imagesPath << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Can't create directory '" << imagesPath << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; delete [] rootPath; delete [] imagesPath; return NULL; } } // // Create 16 directories in the path to // hold the images whose name begins with // the corresponding hexadecimal digit. // char *digitPath = new char[strlen(imagesPath) + 5]; strcpy(digitPath, imagesPath); // // Image paths have format "[path][/I-c][\0]", // where c is the first digit of the checksum. // for (char digit = 0; digit < 16; digit++) { sprintf(digitPath + strlen(imagesPath), "/I-%01X", digit); if ((stat(digitPath, &dirStat) == -1) && (EGET() == ENOENT)) { if (mkdir(digitPath, 0700) < 0 && (EGET() != EEXIST)) { nxfatal << "Loop: PANIC! Can't create directory '" << digitPath << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Can't create directory '" << digitPath << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; delete [] rootPath; delete [] imagesPath; delete [] digitPath; return NULL; } } } delete [] rootPath; delete [] digitPath; return imagesPath; } char *GetSessionPath() { if (*sessionDir == '\0') { char *rootPath = GetRootPath(); strcpy(sessionDir, rootPath); if (control -> ProxyMode == proxy_client) { strcat(sessionDir, "/C-"); } else { strcat(sessionDir, "/S-"); } if (*sessionId == '\0') { char port[DEFAULT_STRING_LENGTH]; sprintf(port, "%d", proxyPort); strcpy(sessionId, port); } strcat(sessionDir, sessionId); struct stat dirStat; if ((stat(sessionDir, &dirStat) == -1) && (EGET() == ENOENT)) { if (mkdir(sessionDir, 0700) < 0 && (EGET() != EEXIST)) { nxfatal << "Loop: PANIC! Can't create directory '" << sessionDir << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; cerr << "Error" << ": Can't create directory '" << sessionDir << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; delete [] rootPath; return NULL; } } nxinfo << "Loop: Root of NX session is '" << sessionDir << "'.\n" << std::flush; delete [] rootPath; } char *sessionPath = new char[strlen(sessionDir) + 1]; strcpy(sessionPath, sessionDir); return sessionPath; } // // Identify requested link characteristics // and set control parameters accordingly. // int ParseLinkOption(const char *opt) { // // Normalize the user input. // if (strcasecmp(opt, "modem") == 0 || strcasecmp(opt, "33k") == 0 || strcasecmp(opt, "56k") == 0) { strcpy(linkSpeedName, "MODEM"); } else if (strcasecmp(opt, "isdn") == 0 || strcasecmp(opt, "64k") == 0 || strcasecmp(opt, "128k") == 0) { strcpy(linkSpeedName, "ISDN"); } else if (strcasecmp(opt, "adsl") == 0 || strcasecmp(opt, "256k") == 0 || strcasecmp(opt, "640k") == 0) { strcpy(linkSpeedName, "ADSL"); } else if (strcasecmp(opt, "wan") == 0 || strcasecmp(opt, "1m") == 0 || strcasecmp(opt, "2m") == 0 || strcasecmp(opt, "34m") == 0) { strcpy(linkSpeedName, "WAN"); } else if (strcasecmp(opt, "lan") == 0 || strcasecmp(opt, "10m") == 0 || strcasecmp(opt, "100m") == 0 || strcasecmp(opt, "local") == 0) { strcpy(linkSpeedName, "LAN"); } if (strcasecmp(linkSpeedName, "modem") != 0 && strcasecmp(linkSpeedName, "isdn") != 0 && strcasecmp(linkSpeedName, "adsl") != 0 && strcasecmp(linkSpeedName, "wan") != 0 && strcasecmp(linkSpeedName, "lan") != 0) { return -1; } return 1; } int ParsePackOption(const char *opt) { nxdbg << "Loop: Pack method is " << packMethod << " quality is " << packQuality << ".\n" << std::flush; nxdbg << "Loop: Parsing pack method '" << opt << "'.\n" << std::flush; if (strcasecmp(opt, "0") == 0 || strcasecmp(opt, "none") == 0 || strcasecmp(opt, "nopack") == 0 || strcasecmp(opt, "no-pack") == 0) { packMethod = PACK_NONE; } else if (strcasecmp(opt, "8") == 0) { packMethod = PACK_MASKED_8_COLORS; } else if (strcasecmp(opt, "64") == 0) { packMethod = PACK_MASKED_64_COLORS; } else if (strcasecmp(opt, "256") == 0) { packMethod = PACK_MASKED_256_COLORS; } else if (strcasecmp(opt, "512") == 0) { packMethod = PACK_MASKED_512_COLORS; } else if (strcasecmp(opt, "4k") == 0) { packMethod = PACK_MASKED_4K_COLORS; } else if (strcasecmp(opt, "32k") == 0) { packMethod = PACK_MASKED_32K_COLORS; } else if (strcasecmp(opt, "64k") == 0) { packMethod = PACK_MASKED_64K_COLORS; } else if (strcasecmp(opt, "256k") == 0) { packMethod = PACK_MASKED_256K_COLORS; } else if (strcasecmp(opt, "2m") == 0) { packMethod = PACK_MASKED_2M_COLORS; } else if (strcasecmp(opt, "16m") == 0) { packMethod = PACK_MASKED_16M_COLORS; } else if (strncasecmp(opt, "8-jpeg", strlen("8-jpeg")) == 0) { packMethod = PACK_JPEG_8_COLORS; } else if (strncasecmp(opt, "64-jpeg", strlen("64-jpeg")) == 0) { packMethod = PACK_JPEG_64_COLORS; } else if (strncasecmp(opt, "256-jpeg", strlen("256-jpeg")) == 0) { packMethod = PACK_JPEG_256_COLORS; } else if (strncasecmp(opt, "512-jpeg", strlen("512-jpeg")) == 0) { packMethod = PACK_JPEG_512_COLORS; } else if (strncasecmp(opt, "4k-jpeg", strlen("4k-jpeg")) == 0) { packMethod = PACK_JPEG_4K_COLORS; } else if (strncasecmp(opt, "32k-jpeg", strlen("32k-jpeg")) == 0) { packMethod = PACK_JPEG_32K_COLORS; } else if (strncasecmp(opt, "64k-jpeg", strlen("64k-jpeg")) == 0) { packMethod = PACK_JPEG_64K_COLORS; } else if (strncasecmp(opt, "256k-jpeg", strlen("256k-jpeg")) == 0) { packMethod = PACK_JPEG_256K_COLORS; } else if (strncasecmp(opt, "2m-jpeg", strlen("2m-jpeg")) == 0) { packMethod = PACK_JPEG_2M_COLORS; } else if (strncasecmp(opt, "16m-jpeg", strlen("16m-jpeg")) == 0) { packMethod = PACK_JPEG_16M_COLORS; } else if (strncasecmp(opt, "8-png", strlen("8-png")) == 0) { packMethod = PACK_PNG_8_COLORS; } else if (strncasecmp(opt, "64-png", strlen("64-png")) == 0) { packMethod = PACK_PNG_64_COLORS; } else if (strncasecmp(opt, "256-png", strlen("256-png")) == 0) { packMethod = PACK_PNG_256_COLORS; } else if (strncasecmp(opt, "512-png", strlen("512-png")) == 0) { packMethod = PACK_PNG_512_COLORS; } else if (strncasecmp(opt, "4k-png", strlen("4k-png")) == 0) { packMethod = PACK_PNG_4K_COLORS; } else if (strncasecmp(opt, "32k-png", strlen("32k-png")) == 0) { packMethod = PACK_PNG_32K_COLORS; } else if (strncasecmp(opt, "64k-png", strlen("64k-png")) == 0) { packMethod = PACK_PNG_64K_COLORS; } else if (strncasecmp(opt, "256k-png", strlen("256k-png")) == 0) { packMethod = PACK_PNG_256K_COLORS; } else if (strncasecmp(opt, "2m-png", strlen("2m-png")) == 0) { packMethod = PACK_PNG_2M_COLORS; } else if (strncasecmp(opt, "16m-png", strlen("16m-png")) == 0) { packMethod = PACK_PNG_16M_COLORS; } else if (strncasecmp(opt, "16m-rgb", strlen("16m-rgb")) == 0 || strncasecmp(opt, "rgb", strlen("rgb")) == 0) { packMethod = PACK_RGB_16M_COLORS; } else if (strncasecmp(opt, "16m-rle", strlen("16m-rle")) == 0 || strncasecmp(opt, "rle", strlen("rle")) == 0) { packMethod = PACK_RLE_16M_COLORS; } else if (strncasecmp(opt, "16m-bitmap", strlen("16m-bitmap")) == 0 || strncasecmp(opt, "bitmap", strlen("bitmap")) == 0) { packMethod = PACK_BITMAP_16M_COLORS; } else if (strncasecmp(opt, "lossy", strlen("lossy")) == 0) { packMethod = PACK_LOSSY; } else if (strncasecmp(opt, "lossless", strlen("lossless")) == 0) { packMethod = PACK_LOSSLESS; } else if (strncasecmp(opt, "adaptive", strlen("adaptive")) == 0) { packMethod = PACK_ADAPTIVE; } else { return -1; } if (packMethod == PACK_NONE) { strcpy(packMethodName, "none"); } else { strcpy(packMethodName, opt); } if (packMethod == PACK_RGB_16M_COLORS || packMethod == PACK_RLE_16M_COLORS || packMethod == PACK_BITMAP_16M_COLORS || (packMethod >= PACK_JPEG_8_COLORS && packMethod <= PACK_JPEG_16M_COLORS) || (packMethod >= PACK_PNG_8_COLORS && packMethod <= PACK_PNG_16M_COLORS) || packMethod == PACK_LOSSY || packMethod == PACK_LOSSLESS || packMethod == PACK_ADAPTIVE) { const char *dash = strrchr(opt, '-'); if (dash != NULL && strlen(dash) == 2 && *(dash + 1) >= '0' && *(dash + 1) <= '9') { packQuality = atoi(dash + 1); nxdbg << "Loop: Using pack quality '" << packQuality << "'.\n" << std::flush; } } else { packQuality = 0; } return 1; } int ParsePackMethod(const int method, const int quality) { switch (method) { case PACK_NONE: { strcpy(packMethodName, "none"); break; } case PACK_MASKED_8_COLORS: { strcpy(packMethodName, "8"); break; } case PACK_MASKED_64_COLORS: { strcpy(packMethodName, "64"); break; } case PACK_MASKED_256_COLORS: { strcpy(packMethodName, "256"); break; } case PACK_MASKED_512_COLORS: { strcpy(packMethodName, "512"); break; } case PACK_MASKED_4K_COLORS: { strcpy(packMethodName, "4k"); break; } case PACK_MASKED_32K_COLORS: { strcpy(packMethodName, "32k"); break; } case PACK_MASKED_64K_COLORS: { strcpy(packMethodName, "64k"); break; } case PACK_MASKED_256K_COLORS: { strcpy(packMethodName, "256k"); break; } case PACK_MASKED_2M_COLORS: { strcpy(packMethodName, "2m"); break; } case PACK_MASKED_16M_COLORS: { strcpy(packMethodName, "16m"); break; } case PACK_JPEG_8_COLORS: { strcpy(packMethodName, "8-jpeg"); break; } case PACK_JPEG_64_COLORS: { strcpy(packMethodName, "64-jpeg"); break; } case PACK_JPEG_256_COLORS: { strcpy(packMethodName, "256-jpeg"); break; } case PACK_JPEG_512_COLORS: { strcpy(packMethodName, "512-jpeg"); break; } case PACK_JPEG_4K_COLORS: { strcpy(packMethodName, "4k-jpeg"); break; } case PACK_JPEG_32K_COLORS: { strcpy(packMethodName, "32k-jpeg"); break; } case PACK_JPEG_64K_COLORS: { strcpy(packMethodName, "64k-jpeg"); break; } case PACK_JPEG_256K_COLORS: { strcpy(packMethodName, "256k-jpeg"); break; } case PACK_JPEG_2M_COLORS: { strcpy(packMethodName, "2m-jpeg"); break; } case PACK_JPEG_16M_COLORS: { strcpy(packMethodName, "16m-jpeg"); break; } case PACK_PNG_8_COLORS: { strcpy(packMethodName, "8-png"); break; } case PACK_PNG_64_COLORS: { strcpy(packMethodName, "64-png"); break; } case PACK_PNG_256_COLORS: { strcpy(packMethodName, "256-png"); break; } case PACK_PNG_512_COLORS: { strcpy(packMethodName, "512-png"); break; } case PACK_PNG_4K_COLORS: { strcpy(packMethodName, "4k-png"); break; } case PACK_PNG_32K_COLORS: { strcpy(packMethodName, "32k-png"); break; } case PACK_PNG_64K_COLORS: { strcpy(packMethodName, "64k-png"); break; } case PACK_PNG_256K_COLORS: { strcpy(packMethodName, "256k-png"); break; } case PACK_PNG_2M_COLORS: { strcpy(packMethodName, "2m-png"); break; } case PACK_PNG_16M_COLORS: { strcpy(packMethodName, "16m-png"); break; } case PACK_RGB_16M_COLORS: { strcpy(packMethodName, "16m-rgb"); break; } case PACK_RLE_16M_COLORS: { strcpy(packMethodName, "16m-rle"); break; } case PACK_BITMAP_16M_COLORS: { strcpy(packMethodName, "16m-bitmap"); break; } case PACK_LOSSY: { strcpy(packMethodName, "lossy"); break; } case PACK_LOSSLESS: { strcpy(packMethodName, "lossless"); break; } case PACK_ADAPTIVE: { strcpy(packMethodName, "adaptive"); break; } default: { return -1; } } if (quality < 0 || quality > 9) { return -1; } if (packMethod == PACK_RGB_16M_COLORS || packMethod == PACK_RLE_16M_COLORS || packMethod == PACK_BITMAP_16M_COLORS || (packMethod >= PACK_JPEG_8_COLORS && packMethod <= PACK_JPEG_16M_COLORS) || (packMethod >= PACK_PNG_8_COLORS && packMethod <= PACK_PNG_16M_COLORS) || packMethod == PACK_LOSSY || packMethod == PACK_LOSSLESS || packMethod == PACK_ADAPTIVE) { sprintf(packMethodName + strlen(packMethodName), "-%d", quality); } packMethod = method; packQuality = quality; control -> PackMethod = packMethod; control -> PackQuality = packQuality; return 1; } int SetDirectories() { // // Determine the location of the user's NX // directory and the other relevant paths. // The functions below will check the pa- // rameters passed to the program and will // query the environment, if needed. // control -> HomePath = GetHomePath(); control -> RootPath = GetRootPath(); control -> SystemPath = GetSystemPath(); control -> TempPath = GetTempPath(); control -> ClientPath = GetClientPath(); return 1; } int SetLogs() { // // So far we used stderr (or stdout under // WIN32). Now use the files selected by // the user. // if (*statsFileName == '\0') { strcpy(statsFileName, "stats"); nxinfo << "Loop: Assuming default statistics file '" << statsFileName << "'.\n" << std::flush; } else { nxinfo << "Loop: Name selected for statistics is '" << statsFileName << "'.\n" << std::flush; } if (OpenLogFile(statsFileName, statofs) < 0) { HandleCleanup(); } #ifndef MIXED if (*errorsFileName == '\0') { strcpy(errorsFileName, "errors"); nxinfo << "Loop: Assuming default log file name '" << errorsFileName << "'.\n" << std::flush; } else { nxinfo << "Loop: Name selected for log file is '" << errorsFileName << "'.\n" << std::flush; } // // Share the bebug output with the nxssh binder // process. The file must be made writable by // everybody because the nxssh process is run by // nxserver as the nx user. // #ifdef BINDER strcpy(errorsFileName, "/tmp/errors"); ostream *tmpfs = new ofstream(errorsFileName, ios::out); delete tmpfs; chmod(errorsFileName, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); #endif if (OpenLogFile(errorsFileName, logofs) < 0) { HandleCleanup(); } // // By default the session log is the standard error // of the process. It is anyway required to set the // option when running inside SSH, otherwise the // output will go to the same file as the SSH log, // depending where the NX client has redirected the // output. // if (*sessionFileName != '\0') { nxinfo << "Loop: Name selected for session file is '" << sessionFileName << "'.\n" << std::flush; if (errofs != NULL) { nxwarn << "Loop: WARNING! Unexpected value for stream errofs.\n" << std::flush; cerr << "Warning" << ": Unexpected value for stream errofs.\n"; } if (errsbuf != NULL) { nxwarn << "Loop: WARNING! Unexpected value for buffer errsbuf.\n" << std::flush; cerr << "Warning" << ": Unexpected value for buffer errsbuf.\n"; } errofs = NULL; errsbuf = NULL; if (OpenLogFile(sessionFileName, errofs) < 0) { HandleCleanup(); } // // Redirect the standard error to the file. // errsbuf = cerr.rdbuf(errofs -> rdbuf()); } #endif return 1; } int SetPorts() { // // Depending on the proxy side, we need to determine on which // port to listen for the given protocol or to which port we // will have to forward the connection. Three possibilities // are given for each supported protocol: // // Port <= 0: Disable port forwarding. // Port == 1: Use the default port. // Port > 1: Use the specified port. // // At the connectiong side the user should always explicitly // set the ports where the connections will be forwarded. This // is both for security reasons and because, when running both // proxies on the same host, there is a concrete possibility // that, by using the default ports, the connection will be // forwarded to the same port where the peer proxy is listen- // ing, causing a loop. // if (control -> ProxyMode == proxy_client) { // ChannelEndPoint::enabled() implements the logic described above, // and takes the default port into consideration. If cups=1, and // there is a default port, then enabled() will return true. // // Therefore, we must set the default port before calling this // function. cupsPort.setDefaultTCPPort(DEFAULT_NX_CUPS_PORT_OFFSET + proxyPort); useCupsSocket = cupsPort.enabled(); } else { cupsPort.setDefaultTCPPort(631); } nxinfo << "Loop: cups port: '" << cupsPort << "'.\n" << std::flush; if (control -> ProxyMode == proxy_client) { auxPort.setDefaultTCPPort(DEFAULT_NX_AUX_PORT_OFFSET + proxyPort); useAuxSocket = auxPort.enabled(); } else { auxPort.setDefaultTCPPort(1); if ( auxPort.getTCPPort() != 1 ) { nxwarn << "Loop: WARNING! Overriding auxiliary X11 " << "port with new value '" << 1 << "'.\n" << std::flush; cerr << "Warning" << ": Overriding auxiliary X11 " << "port with new value '" << 1 << "'.\n"; auxPort.setSpec("1"); } } nxinfo << "Loop: aux port: '" << auxPort << "'.\n" << std::flush; if (control -> ProxyMode == proxy_client) { smbPort.setDefaultTCPPort(DEFAULT_NX_SMB_PORT_OFFSET + proxyPort); useSmbSocket = smbPort.enabled(); } else { smbPort.setDefaultTCPPort(139); } nxinfo << "Loop: smb port: '" << smbPort << "'.\n" << std::flush; if ( mediaPort.configured() ) { if (control -> ProxyMode == proxy_client) { mediaPort.setDefaultTCPPort(DEFAULT_NX_MEDIA_PORT_OFFSET + proxyPort); useMediaSocket = mediaPort.enabled(); } else { if ( mediaPort.getTCPPort() < 0 ) { nxfatal << "Loop: PANIC! No port specified for multimedia connections.\n" << std::flush; cerr << "Error" << ": No port specified for multimedia connections.\n"; HandleCleanup(); } } } nxinfo << "Loop: Using multimedia port '" << mediaPort << "'.\n" << std::flush; if (control -> ProxyMode == proxy_client) { httpPort.setDefaultTCPPort(DEFAULT_NX_HTTP_PORT_OFFSET + proxyPort); useHttpSocket = httpPort.enabled(); } else { httpPort.setDefaultTCPPort(80); } nxinfo << "Loop: Using HTTP port '" << httpPort << "'.\n" << std::flush; if (ParseFontPath(fontPort) <= 0) { nxinfo << "Loop: Disabling font server connections.\n" << std::flush; *fontPort = '\0'; useFontSocket = 0; } else { // // We don't know yet if the remote proxy supports // the font server connections. If needed, we will // disable the font server connections at later // time. // if (control -> ProxyMode == proxy_server) { useFontSocket = 1; } else { useFontSocket = 0; } nxinfo << "Loop: Using font server port '" << fontPort << "'.\n" << std::flush; } if (control -> ProxyMode == proxy_client) { slavePort.setDefaultTCPPort(DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET + proxyPort); useSlaveSocket = slavePort.enabled(); } else { slavePort.setDefaultTCPPort(DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET + proxyPort); } nxinfo << "Loop: Using slave port '" << slavePort << "'.\n" << std::flush; return 1; } int SetDescriptors() { unsigned int limit = 0; #ifdef RLIMIT_NOFILE rlimit limits; if (getrlimit(RLIMIT_NOFILE, &limits) == 0) { if (limits.rlim_max == RLIM_INFINITY) { limit = 0; } else { limit = (unsigned int) limits.rlim_max; } } #endif #ifdef _SC_OPEN_MAX if (limit == 0) { limit = sysconf(_SC_OPEN_MAX); } #endif #ifdef FD_SETSIZE if (limit > FD_SETSIZE) { limit = FD_SETSIZE; } #endif #ifdef RLIMIT_NOFILE if (limits.rlim_cur < limit) { limits.rlim_cur = limit; setrlimit(RLIMIT_NOFILE, &limits); } #endif if (limit == 0) { nxfatal << "Loop: PANIC! Cannot determine number of available " << "file descriptors.\n" << std::flush; cerr << "Error" << ": Cannot determine number of available " << "file descriptors.\n"; return -1; } return 1; } // // Find the directory containing the caches // matching the session type. // int SetCaches() { if ((control -> PersistentCachePath = GetCachePath()) == NULL) { nxfatal << "Loop: PANIC! Error getting or creating the cache path.\n" << std::flush; cerr << "Error" << ": Error getting or creating the cache path.\n"; HandleCleanup(); } nxinfo << "Loop: Path of cache files is '" << control -> PersistentCachePath << "'.\n" << std::flush; return 1; } // // Initialize all configuration parameters. // int SetParameters() { // // Find out the type of session. // SetSession(); // // Initialize the network and compression // parameters according to the settings // suggested by the user. // SetLink(); // // Set compression according to link speed. // SetCompression(); // // Be sure that we have a literal for current // cache size. Value will reflect control's // default unless we already parsed a 'cache' // option. Server side has no control on size // of cache but is informed at session nego- // tiation about how much memory is going to // be used. // SetStorage(); // // Set size of shared memory segments. // SetShmem(); // // Make adjustments to cache based // on the pack method. // SetPack(); // // Set disk-based image cache. // SetImages(); // // Set CPU and bandwidth limits. // SetLimits(); return 1; } // // According to session literal determine // the type of traffic that is going to be // transported. Literals should be better // standardized in future NX versions. // int SetSession() { if (strncmp(sessionType, "agent", strlen("agent")) == 0 || strncmp(sessionType, "desktop", strlen("desktop")) == 0 || strncmp(sessionType, "rootless", strlen("rootless")) == 0 || strncmp(sessionType, "console", strlen("console")) == 0 || strncmp(sessionType, "default", strlen("default")) == 0 || strncmp(sessionType, "gnome", strlen("gnome")) == 0 || strncmp(sessionType, "kde", strlen("kde")) == 0 || strncmp(sessionType, "cde", strlen("cde")) == 0 || strncmp(sessionType, "xdm", strlen("xdm")) == 0) { control -> SessionMode = session_agent; } else if (strncmp(sessionType, "win", strlen("win")) == 0 || strncmp(sessionType, "vnc", strlen("vnc")) == 0) { control -> SessionMode = session_agent; } else if (strncmp(sessionType, "shadow", strlen("shadow")) == 0) { control -> SessionMode = session_shadow; } else if (strncmp(sessionType, "proxy", strlen("proxy")) == 0 || strncmp(sessionType, "application", strlen("application")) == 0 || strncmp(sessionType, "raw", strlen("raw")) == 0) { control -> SessionMode = session_proxy; } else { // // If the session type is not passed or // it is not among the recognized strings, // we assume that the proxy is connected // to the agent. // // // Since ProtoStep8 (#issue 108) and also // with older "unix-" sessions // if (*sessionType != '\0') { nxwarn << "Loop: WARNING! Unrecognized session type '" << sessionType << "'. Assuming agent session.\n" << std::flush; cerr << "Warning" << ": Unrecognized session type '" << sessionType << "'. Assuming agent session.\n"; } control -> SessionMode = session_agent; } nxinfo << "Loop: Assuming session type '" << DumpSession(control -> SessionMode) << "' with " << "string '" << sessionType << "'.\n" << std::flush; // // By default the policy is immediate. Agents // will set a different policy, if they like. // Anyway we need to check if the user has // provided a custom flush policy. // if (usePolicy != -1) { if (usePolicy > 0) { control -> FlushPolicy = policy_deferred; } else { control -> FlushPolicy = policy_immediate; } nxinfo << "Loop: WARNING! Forcing flush policy to '" << DumpPolicy(control -> FlushPolicy) << ".\n" << std::flush; } else { control -> FlushPolicy = policy_immediate; nxinfo << "Loop: Setting initial flush policy to '" << DumpPolicy(control -> FlushPolicy) << "'.\n" << std::flush; } // // Check if the proxy library is run inside // another program providing encryption, as // it is the case of the SSH client. // if (useEncryption != -1) { if (useEncryption > 0) { control -> LinkEncrypted = 1; } else { control -> LinkEncrypted = 0; } } if (control -> LinkEncrypted == 1) { nxinfo << "Loop: Proxy running as part of an " << "encrypting client.\n" << std::flush; } else { nxinfo << "Loop: Assuming proxy running as a " << "standalone program.\n" << std::flush; } // // Check if the system administrator has // enabled the respawn of the client at // the end of session. // if (control -> ProxyMode == proxy_server) { struct stat fileStat; char fileName[DEFAULT_STRING_LENGTH]; snprintf(fileName, DEFAULT_STRING_LENGTH - 1, "%s/share/noexit", control -> SystemPath); *(fileName + DEFAULT_STRING_LENGTH - 1) = '\0'; if (stat(fileName, &fileStat) == 0) { nxinfo << "Loop: Enabling respawn of client at session shutdown.\n" << std::flush; control -> EnableRestartOnShutdown = 1; } } return 1; } int SetStorage() { // // If differential compression is disabled // we don't need a cache at all. // if (control -> LocalDeltaCompression == 0) { control -> ClientTotalStorageSize = 0; control -> ServerTotalStorageSize = 0; } // // Set a a cache size literal. // int size = control -> getUpperStorageSize(); if (size / 1024 > 0) { sprintf(cacheSizeName, "%dk", size / 1024); } else { sprintf(cacheSizeName, "%d", size); } if (control -> ProxyMode == proxy_client) { control -> LocalTotalStorageSize = control -> ClientTotalStorageSize; control -> RemoteTotalStorageSize = control -> ServerTotalStorageSize; } else { control -> LocalTotalStorageSize = control -> ServerTotalStorageSize; control -> RemoteTotalStorageSize = control -> ClientTotalStorageSize; } nxdbg << "Loop: Storage size limit is " << control -> ClientTotalStorageSize << " at client and " << control -> ServerTotalStorageSize << " at server.\n" << std::flush; nxdbg << "Loop: Storage local limit set to " << control -> LocalTotalStorageSize << " remote limit set to " << control -> RemoteTotalStorageSize << ".\n" << std::flush; // // Never reserve for split store more than // half the memory available for messages. // if (size > 0 && control -> SplitTotalStorageSize > size / 2) { nxinfo << "Loop: Reducing size of split store to " << size / 2 << " bytes.\n" << std::flush; control -> SplitTotalStorageSize = size / 2; } // // Don't load render from persistent // cache if extension is hidden or // not supported by agent. // if (control -> HideRender == 1) { nxinfo << "Loop: Not loading render extension " << "from persistent cache.\n" << std::flush; control -> PersistentCacheLoadRender = 0; } return 1; } int SetShmem() { // // If not set, adjust the size of the shared // memory segment according to size of the // message cache. // if (*shsegSizeName == '\0') { int size = control -> getUpperStorageSize(); const int mega = 1048576; if (size > 0) { if (size <= 1 * mega) { size = 0; } else if (size <= 2 * mega) { size = 524288; } else if (size < 4 * mega) { size = 1048576; } else { size = size / 4; } if (size > 4194304) { size = 4194304; } control -> ShmemClientSize = size; control -> ShmemServerSize = size; } else { // // The delta compression is disabled. // Use a default segment size of 2 MB. // control -> ShmemServerSize = 2 * mega; } } // // Client side shared memory support is // not useful and not implemented. // if (control -> ShmemServerSize >= 524288) { control -> ShmemServer = 1; nxinfo << "Loop: Set initial shared memory size " << "to " << control -> ShmemServerSize << " bytes.\n" << std::flush; } else { nxinfo << "Loop: Disabled use of the shared memory " << "extension.\n" << std::flush; control -> ShmemServer = 0; } // For android, no shared memory available control -> ShmemServer = 0; control -> ShmemClientSize = 0; return 1; } // // Adjust the pack method according to the // type of the session. // int SetPack() { nxinfo << "Loop: Setting pack with initial method " << packMethod << " and quality " << packQuality << ".\n" << std::flush; // // Check if this is a proxy session and, in // this case, set the pack method to none. // Packed images are not supported by plain // X applications. // if (control -> SessionMode == session_proxy) { nxinfo << "Loop: WARNING! Disabling pack with proxy session.\n" << std::flush; packMethod = PACK_NONE; } // // Adjust the internal settings according // to the newly selected pack method. // ParsePackMethod(packMethod, packQuality); // // Don't load messages from persistent // cache if packed images are disabled. // if (control -> PackMethod == PACK_NONE) { control -> PersistentCacheLoadPacked = 0; nxinfo << "Loop: Not loading packed images " << "from persistent cache.\n" << std::flush; } return 1; } // // Set the disk-based image cache parameters // according to the user's wishes. // int SetImages() { // // Be sure we disable the image cache if we // are connecting to plain X clients. // if (control -> SessionMode == session_proxy) { nxinfo << "Loop: Disabling image cache with " << "session '" << DumpSession(control -> SessionMode) << "'.\n" << std::flush; sprintf(imagesSizeName, "0"); control -> ImageCacheEnableLoad = 0; control -> ImageCacheEnableSave = 0; return 1; } int size = control -> ImageCacheDiskLimit; if (size / 1024 > 0) { sprintf(imagesSizeName, "%dk", size / 1024); } else { sprintf(imagesSizeName, "%d", size); } if (size > 0) { control -> ImageCacheEnableLoad = 1; control -> ImageCacheEnableSave = 1; if (control -> ProxyMode == proxy_server) { if ((control -> ImageCachePath = GetImagesPath()) == NULL) { nxfatal << "Loop: PANIC! Error getting or creating image cache path.\n" << std::flush; cerr << "Error" << ": Error getting or creating image cache path.\n"; HandleCleanup(); } nxinfo << "Loop: Path of image cache files is '" << control -> ImageCachePath << "'.\n" << std::flush; } } else { nxinfo << "Loop: Disabling the persistent image cache.\n" << std::flush; control -> ImageCacheEnableLoad = 0; control -> ImageCacheEnableSave = 0; } return 1; } int SetVersion() { // // Normalize the different proxy versions. // int local = (control -> LocalVersionMajor << 24) | (control -> LocalVersionMinor << 16) | control -> LocalVersionPatch; int remote = (control -> RemoteVersionMajor << 24) | (control -> RemoteVersionMinor << 16) | control -> RemoteVersionPatch; int major = -1; int minor = -1; int patch = -1; if (control -> RemoteVersionMajor <= 1) { // // The remote proxy uses a different // logic to determine the version so // we default to the compatibility // version. // major = control -> CompatVersionMajor; minor = control -> CompatVersionMinor; patch = control -> CompatVersionPatch; nxinfo << "Loop: Using compatibility version '" << major << "." << minor << "." << patch << "'.\n" << std::flush; } else if (control -> LocalVersionMajor > control -> RemoteVersionMajor) { // // We use a more recent version. Let's // negotiate the version based on the // version supported by the remote. // major = control -> RemoteVersionMajor; minor = control -> RemoteVersionMinor; patch = control -> RemoteVersionPatch; nxinfo << "Loop: Using remote version '" << major << "." << minor << "." << patch << "'.\n" << std::flush; } else { // // We support a major version that is // equal or older than the remote. We // assume the smaller version between // the two, including the minor and // the patch numbers. // if (local > remote) { major = control -> RemoteVersionMajor; minor = control -> RemoteVersionMinor; patch = control -> RemoteVersionPatch; nxinfo << "Loop: Using remote version '" << major << "." << minor << "." << patch << "'.\n" << std::flush; } else { major = control -> LocalVersionMajor; minor = control -> LocalVersionMinor; patch = control -> LocalVersionPatch; nxinfo << "Loop: Using local version '" << major << "." << minor << "." << patch << "'.\n" << std::flush; } } // // Handle versions from 3.5.0. The protocol // step 10 is the minimum supported version. // int step = 0; if (major == 3) { if (minor >= 5) { step = 10; } } else if (major > 3) { step = 10; } if (step == 0) { nxfatal << "Loop: PANIC! Unable to set the protocol step value from " << "the negotiated protocol version " << major << "." << minor << "." << patch << ".\n" << std::flush; cerr << "Error" << ": Unable to set the protocol step value from " << "the negotiated protocol version " << major << "." << minor << "." << patch << ".\n"; nxfatal << "Loop: PANIC! Incompatible remote version " << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor << "." << control -> RemoteVersionPatch << " with local version " << control -> LocalVersionMajor << "." << control -> LocalVersionMinor << "." << control -> LocalVersionPatch << ".\n" << std::flush; cerr << "Error" << ": Incompatible remote version " << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor << "." << control -> RemoteVersionPatch << " with local version " << control -> LocalVersionMajor << "." << control -> LocalVersionMinor << "." << control -> LocalVersionPatch << ".\n"; return -1; } nxinfo << "Loop: Using NX protocol step " << step << ".\n" << std::flush; control -> setProtoStep(step); // // Ignore the differences in patch version // and print a warning if the local version // is different or obsolete compared to // the remote. // local &= 0xffff0000; remote &= 0xffff0000; if (local != remote) { nxwarn << "Loop: WARNING! Connected to remote version " << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor << "." << control -> RemoteVersionPatch << " with local version " << control -> LocalVersionMajor << "." << control -> LocalVersionMinor << "." << control -> LocalVersionPatch << ".\n" << std::flush; cerr << "Warning" << ": Connected to remote version " << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor << "." << control -> RemoteVersionPatch << " with local version " << control -> LocalVersionMajor << "." << control -> LocalVersionMinor << "." << control -> LocalVersionPatch << ".\n" << logofs_flush; } if (local < remote) { nxerr << "Warning" << ": Consider checking https://github.com/ArcticaProject/nx-libs/releases for updates.\n"; } // // Now that we are aware of the remote // version, let's adjust the options to // be compatible with the remote proxy. // if (control -> ProxyMode == proxy_client) { // // Since ProtoStep8 (#issue 108) // // Now it's assumed that the remote is // able to handle the selected pack // method // nxinfo << __FILE__ << " : " << __LINE__ << " - " << "step = " << control -> getProtoStep() << " packMethod = " << packMethod << " packQuality = " << packQuality << ".\n" << std::flush; // // Update the pack method name. // ParsePackMethod(packMethod, packQuality); } // // At the moment the image cache is not used by the // agent. Proxy versions older than 3.0.0 assumed // that it was enabled and sent specific bits as part // of the encoding. Conversely, it is advisable to // disable the cache right now. By not enabling the // the image cache, the house-keeping process will // only take care of cleaning up the "cache-" direc- // tories. // // // Considering that compatibility with older versions // has been set to cover as far as 3.5.0, the cache can // be disabled at this point without any concern // // Since ProtoStep8 (#issue 108) nxinfo << "Loop: Disabling image cache with protocol " << "step '" << control -> getProtoStep() << "'.\n" << std::flush; sprintf(imagesSizeName, "0"); control -> ImageCacheEnableLoad = 0; control -> ImageCacheEnableSave = 0; return 1; } // // Identify the requested link settings // and update the control parameters // accordingly. // int SetLink() { nxinfo << "Loop: Setting link with initial value " << linkSpeedName << ".\n" << std::flush; if (*linkSpeedName == '\0') { strcpy(linkSpeedName, "lan"); } nxinfo << "Loop: Link speed is " << linkSpeedName << ".\n" << std::flush; if (strcasecmp(linkSpeedName, "modem") == 0) { SetLinkModem(); } else if (strcasecmp(linkSpeedName, "isdn") == 0) { SetLinkIsdn(); } else if (strcasecmp(linkSpeedName, "adsl") == 0) { SetLinkAdsl(); } else if (strcasecmp(linkSpeedName, "wan") == 0) { SetLinkWan(); } else if (strcasecmp(linkSpeedName, "lan") == 0) { SetLinkLan(); } else { return -1; } // // Set TCP_NODELAY according to the user's // wishes. // if (useNoDelay != -1) { control -> OptionProxyClientNoDelay = useNoDelay; control -> OptionProxyServerNoDelay = useNoDelay; } // // Select the image compression method. // if (packMethod == -1) { packMethod = control -> PackMethod; } if (packQuality == -1) { packQuality = control -> PackQuality; } if (ParsePackMethod(packMethod, packQuality) < 0) { nxfatal << "Loop: PANIC! Unrecognized pack method id " << packMethod << " with quality " << packQuality << ".\n" << std::flush; cerr << "Error" << ": Unrecognized pack method id " << packMethod << " with quality " << packQuality << ".\n"; HandleCleanup(); } // // Check if the user disabled the ability // to generate simple replies at the client // side. // if (control -> SessionMode == session_proxy) { if (useTaint != -1) { control -> TaintReplies = (useTaint == 1); } else { nxwarn << "Loop: WARNING! Forcing taint of replies " << "with a proxy session.\n" << std::flush; control -> TaintReplies = 1; } } else { // // There is no need to taint the // replies if we have an agent. // control -> TaintReplies = 0; } // // Be sure that the requests needing a reply // are flushed immediately. Normal X clients // use so many replies to make the queuing // completely useless. // if (control -> SessionMode == session_proxy) { nxwarn << "Loop: WARNING! Forcing flush on priority " << "with a proxy session.\n" << std::flush; control -> FlushPriority = 1; } return 1; } // // Parameters for MODEM 28.8/33.6/56 Kbps. // int SetLinkModem() { nxinfo << "Loop: Setting parameters for MODEM.\n" << std::flush; control -> LinkMode = LINK_TYPE_MODEM; control -> TokenSize = 256; control -> TokenLimit = 24; control -> SplitMode = 1; control -> SplitTotalSize = 128; control -> SplitTotalStorageSize = 1048576; control -> SplitTimeout = 50; control -> MotionTimeout = 50; control -> IdleTimeout = 50; control -> PackMethod = PACK_ADAPTIVE; control -> PackQuality = 3; return 1; } // // Parameters for ISDN 64/128 Kbps. // int SetLinkIsdn() { nxinfo << "Loop: Setting parameters for ISDN.\n" << std::flush; control -> LinkMode = LINK_TYPE_ISDN; control -> TokenSize = 384; control -> TokenLimit = 24; control -> SplitMode = 1; control -> SplitTotalSize = 128; control -> SplitTotalStorageSize = 1048576; control -> SplitTimeout = 50; control -> MotionTimeout = 20; control -> IdleTimeout = 50; control -> PackMethod = PACK_ADAPTIVE; control -> PackQuality = 5; return 1; } // // Parameters for ADSL 256 Kbps. // int SetLinkAdsl() { nxinfo << "Loop: Setting parameters for ADSL.\n" << std::flush; control -> LinkMode = LINK_TYPE_ADSL; control -> TokenSize = 1408; control -> TokenLimit = 24; control -> SplitMode = 1; control -> SplitTotalSize = 128; control -> SplitTotalStorageSize = 1048576; control -> SplitTimeout = 50; control -> MotionTimeout = 10; control -> IdleTimeout = 50; control -> PackMethod = PACK_ADAPTIVE; control -> PackQuality = 7; return 1; } // // Parameters for XDSL/FDDI/ATM 1/2/34 Mbps WAN. // int SetLinkWan() { nxinfo << "Loop: Setting parameters for WAN.\n" << std::flush; control -> LinkMode = LINK_TYPE_WAN; control -> TokenSize = 1408; control -> TokenLimit = 24; control -> SplitMode = 1; control -> SplitTotalSize = 128; control -> SplitTotalStorageSize = 1048576; control -> SplitTimeout = 50; control -> MotionTimeout = 5; control -> IdleTimeout = 50; control -> PackMethod = PACK_ADAPTIVE; control -> PackQuality = 9; return 1; } // // Parameters for LAN 10/100 Mbps. // int SetLinkLan() { nxinfo << "Loop: Setting parameters for LAN.\n" << std::flush; control -> LinkMode = LINK_TYPE_LAN; control -> TokenSize = 1536; control -> TokenLimit = 24; control -> SplitMode = 1; control -> SplitTotalSize = 128; control -> SplitTotalStorageSize = 1048576; control -> SplitTimeout = 50; control -> MotionTimeout = 0; control -> IdleTimeout = 50; control -> PackMethod = PACK_ADAPTIVE; control -> PackQuality = 9; return 1; } // // Identify the requested link type and set // the control parameters accordingly. // int SetCompression() { if (strcasecmp(linkSpeedName, "modem") == 0) { SetCompressionModem(); } else if (strcasecmp(linkSpeedName, "isdn") == 0) { SetCompressionIsdn(); } else if (strcasecmp(linkSpeedName, "adsl") == 0) { SetCompressionAdsl(); } else if (strcasecmp(linkSpeedName, "wan") == 0) { SetCompressionWan(); } else if (strcasecmp(linkSpeedName, "lan") == 0) { SetCompressionLan(); } else { return -1; } if (control -> LocalDeltaCompression < 0) { control -> LocalDeltaCompression = 1; } // // If we didn't set remote delta compression // (as it should always be the case at client // side) assume value of local side. // if (control -> RemoteDeltaCompression < 0) { control -> RemoteDeltaCompression = control -> LocalDeltaCompression; } // // If we didn't set remote compression levels // assume values of local side. // if (control -> RemoteStreamCompression < 0) { control -> RemoteStreamCompressionLevel = control -> LocalStreamCompressionLevel; if (control -> RemoteStreamCompressionLevel > 0) { control -> RemoteStreamCompression = 1; } else { control -> RemoteStreamCompression = 0; } } if (control -> RemoteDataCompression < 0) { control -> RemoteDataCompressionLevel = control -> LocalDataCompressionLevel; if (control -> RemoteDataCompressionLevel > 0) { control -> RemoteDataCompression = 1; } else { control -> RemoteDataCompression = 0; } } return 1; } // // Compression for MODEM. // int SetCompressionModem() { if (control -> LocalDataCompression < 0) { control -> LocalDataCompression = 1; control -> LocalDataCompressionLevel = 1; } if (control -> LocalDataCompressionThreshold < 0) { control -> LocalDataCompressionThreshold = 32; } if (control -> LocalStreamCompression < 0) { control -> LocalStreamCompression = 1; control -> LocalStreamCompressionLevel = 9; } return 1; } // // Compression for ISDN. // int SetCompressionIsdn() { if (control -> LocalDataCompression < 0) { control -> LocalDataCompression = 1; control -> LocalDataCompressionLevel = 1; } if (control -> LocalDataCompressionThreshold < 0) { control -> LocalDataCompressionThreshold = 32; } if (control -> LocalStreamCompression < 0) { control -> LocalStreamCompression = 1; control -> LocalStreamCompressionLevel = 6; } return 1; } // // Compression for ADSL. // int SetCompressionAdsl() { if (control -> LocalDataCompression < 0) { control -> LocalDataCompression = 1; control -> LocalDataCompressionLevel = 1; } if (control -> LocalDataCompressionThreshold < 0) { control -> LocalDataCompressionThreshold = 32; } if (control -> LocalStreamCompression < 0) { control -> LocalStreamCompression = 1; control -> LocalStreamCompressionLevel = 4; } return 1; } // // Compression for WAN. // int SetCompressionWan() { if (control -> LocalDataCompression < 0) { control -> LocalDataCompression = 1; control -> LocalDataCompressionLevel = 1; } if (control -> LocalDataCompressionThreshold < 0) { control -> LocalDataCompressionThreshold = 32; } if (control -> LocalStreamCompression < 0) { control -> LocalStreamCompression = 1; control -> LocalStreamCompressionLevel = 1; } return 1; } // // Compression for LAN. // int SetCompressionLan() { // // Disable delta compression if not // explicitly enabled. // if (control -> LocalDeltaCompression < 0) { control -> LocalDeltaCompression = 0; } if (control -> LocalDataCompression < 0) { control -> LocalDataCompression = 0; control -> LocalDataCompressionLevel = 0; } if (control -> LocalDataCompressionThreshold < 0) { control -> LocalDataCompressionThreshold = 0; } if (control -> LocalStreamCompression < 0) { control -> LocalStreamCompression = 0; control -> LocalStreamCompressionLevel = 0; } return 1; } int SetLimits() { // // Check if the user requested strict // control flow parameters. // if (useStrict == 1) { nxinfo << "Loop: LIMIT! Decreasing the token limit " << "to " << control -> TokenLimit / 2 << " with option 'strict'.\n" << std::flush; control -> TokenLimit /= 2; } #ifdef STRICT control -> TokenLimit = 1; nxinfo << "Loop: WARNING! LIMIT! Setting the token limit " << "to " << control -> TokenLimit << " to simulate the proxy congestion.\n" << std::flush; #endif // // Reduce the size of the log file. // #ifdef QUOTA control -> FileSizeLimit = 8388608; #endif // // Check the bitrate limits. // if (control -> LocalBitrateLimit == -1) { if (control -> ProxyMode == proxy_client) { control -> LocalBitrateLimit = control -> ClientBitrateLimit; } else { control -> LocalBitrateLimit = control -> ServerBitrateLimit; } } nxinfo << "Loop: LIMIT! Setting client bitrate limit " << "to " << control -> ClientBitrateLimit << " server bitrate limit to " << control -> ServerBitrateLimit << " with local limit " << control -> LocalBitrateLimit << ".\n" << std::flush; return 1; } // // These functions are used to parse literal // values provided by the user and set the // control parameters accordingly. // int ParseCacheOption(const char *opt) { int size = ParseArg("", "cache", opt); if (size < 0) { nxfatal << "Loop: PANIC! Invalid value '" << opt << "' for option 'cache'.\n" << std::flush; cerr << "Error" << ": Invalid value '" << opt << "' for option 'cache'.\n"; return -1; } nxinfo << "Loop: Setting size of cache to " << size << " bytes.\n" << std::flush; control -> ClientTotalStorageSize = size; control -> ServerTotalStorageSize = size; strcpy(cacheSizeName, opt); if (size == 0) { nxwarn << "Loop: WARNING! Disabling NX delta compression.\n" << std::flush; control -> LocalDeltaCompression = 0; nxwarn << "Loop: WARNING! Disabling use of NX persistent cache.\n" << std::flush; control -> PersistentCacheEnableLoad = 0; control -> PersistentCacheEnableSave = 0; } return 1; } int ParseImagesOption(const char *opt) { int size = ParseArg("", "images", opt); if (size < 0) { nxfatal << "Loop: PANIC! Invalid value '" << opt << "' for option 'images'.\n" << std::flush; cerr << "Error" << ": Invalid value '" << opt << "' for option 'images'.\n"; return -1; } nxinfo << "Loop: Setting size of images cache to " << size << " bytes.\n" << std::flush; control -> ImageCacheDiskLimit = size; strcpy(imagesSizeName, opt); return 1; } int ParseShmemOption(const char *opt) { int size = ParseArg("", "shseg", opt); if (size < 0) { nxfatal << "Loop: PANIC! Invalid value '" << opt << "' for option 'shseg'.\n" << std::flush; cerr << "Error" << ": Invalid value '" << opt << "' for option 'shseg'.\n"; return -1; } control -> ShmemClientSize = size; control -> ShmemServerSize = size; nxinfo << "Loop: Set shared memory size to " << control -> ShmemServerSize << " bytes.\n" << std::flush; strcpy(shsegSizeName, opt); return 1; } int ParseBitrateOption(const char *opt) { int bitrate = ParseArg("", "limit", opt); if (bitrate < 0) { nxfatal << "Loop: PANIC! Invalid value '" << opt << "' for option 'limit'.\n" << std::flush; cerr << "Error" << ": Invalid value '" << opt << "' for option 'limit'.\n"; return -1; } strcpy(bitrateLimitName, opt); if (bitrate == 0) { nxinfo << "Loop: Disabling bitrate limit on proxy link.\n" << std::flush; control -> LocalBitrateLimit = 0; } else { nxinfo << "Loop: Setting bitrate to " << bitrate << " bits per second.\n" << std::flush; // // Internal representation is in bytes // per second. // control -> LocalBitrateLimit = bitrate >> 3; } return 1; } int ParseHostOption(const char *opt, char *host, long &port) { nxinfo << "Loop: Trying to parse options string '" << opt << "' as a remote NX host.\n" << std::flush; if (opt == NULL || *opt == '\0') { nxfatal << "Loop: PANIC! No host parameter provided.\n" << std::flush; return 0; } else if (strlen(opt) >= DEFAULT_STRING_LENGTH) { nxfatal << "Loop: PANIC! Host parameter exceeds length of " << DEFAULT_STRING_LENGTH << " characters.\n" << std::flush; return 0; } // // Look for a host name followed // by a colon followed by port. // int newPort = port; const char *separator = strrchr(opt, ':'); if (separator != NULL) { const char *check = separator + 1; while (*check != '\0' && *check != ',' && *check != '=' && isdigit(*check) != 0) { check++; } newPort = atoi(separator + 1); if (newPort < 0 || *check != '\0') { nxinfo << "Loop: Can't identify remote NX port in string '" << separator << "'.\n" << std::flush; return 0; } } else if (newPort < 0) { // // Complain if port was not passed // by other means. // nxinfo << "Loop: Can't identify remote NX port in string '" << opt << "'.\n" << std::flush; return 0; } else { separator = opt + strlen(opt); } char newHost[DEFAULT_STRING_LENGTH] = { 0 }; // opt cannot be longer than DEFAULT_STRING_LENGTH, this is checked above strncpy(newHost, opt, strlen(opt) - strlen(separator)); *(newHost + strlen(opt) - strlen(separator)) = '\0'; const char *check = newHost; while (*check != '\0' && *check != ',' && *check != '=') { check++; } if (*check != '\0') { nxinfo << "Loop: Can't identify remote NX host in string '" << newHost << "'.\n" << std::flush; return 0; } else if (*acceptHost != '\0') { nxfatal << "Loop: PANIC! Can't manage to connect and accept connections " << "at the same time.\n" << std::flush; nxfatal << "Loop: PANIC! Refusing remote NX host with string '" << opt << "'.\n" << std::flush; cerr << "Error" << ": Can't manage to connect and accept connections " << "at the same time.\n"; cerr << "Error" << ": Refusing remote NX host with string '" << opt << "'.\n"; return -1; } if (*host != '\0' && strcmp(host, newHost) != 0) { nxwarn << "Loop: WARNING! Overriding remote NX host '" << host << "' with new value '" << newHost << "'.\n" << std::flush; } strcpy(host, newHost); if (port != -1 && port != newPort) { nxwarn << "Loop: WARNING! Overriding remote NX port '" << port << "' with new value '" << newPort << "'.\n" << std::flush; } nxinfo << "Loop: Parsed options string '" << opt << "' with host '" << newHost << "' and port '" << newPort << "'.\n" << std::flush; port = newPort; return 1; } int ParseFontPath(char *path) { char oldPath[DEFAULT_STRING_LENGTH]; strcpy(oldPath, path); if (path == NULL || *path == '\0' || strcmp(path, "0") == 0) { return 0; } nxinfo << "Loop: Parsing font server option '" << path << "'.\n" << std::flush; // // Convert the value to our default port. // if (strcmp(fontPort, "1") == 0) { if (control -> ProxyMode == proxy_server) { snprintf(fontPort, DEFAULT_STRING_LENGTH - 1, "%d", DEFAULT_NX_FONT_PORT_OFFSET + proxyPort); } else { // // Let the client use the well-known // "unix/:7100" font path. // snprintf(fontPort, DEFAULT_STRING_LENGTH - 1, "unix/:7100"); } } // // Check if a simple numaric value was given. // if (atoi(path) > 0) { nxinfo << "Loop: Assuming numeric TCP port '" << atoi(path) << "' for font server.\n" << std::flush; return 1; } // // Let's assume that a port specification "unix/:7100" // corresponds to "/tmp/.font-unix/fs7100" and a port // "unix/:-1" corresponds to "/tmp/.font-unix/fs-1". // if (strncmp("unix/:", path, 6) == 0) { snprintf(path, DEFAULT_STRING_LENGTH - 1, "/tmp/.font-unix/fs%s", oldPath + 6); *(path + DEFAULT_STRING_LENGTH - 1) = '\0'; nxinfo << "Loop: Assuming Unix socket '" << path << "' for font server.\n" << std::flush; } else if (strncmp("tcp/:", path, 5) == 0) { snprintf(path, DEFAULT_STRING_LENGTH - 1, "%d", atoi(oldPath + 5)); *(path + DEFAULT_STRING_LENGTH - 1) = '\0'; if (atoi(path) <= 0) { goto ParseFontPathError; } nxinfo << "Loop: Assuming TCP port '" << atoi(path) << "' for font server.\n" << std::flush; } else { // // Accept an absolute file path as // a valid Unix socket. // if (*path != '/') { goto ParseFontPathError; } nxinfo << "Loop: Assuming Unix socket '" << path << "' for font server.\n" << std::flush; } return 1; ParseFontPathError: nxinfo << "Loop: Unable to determine the font server " << "port in string '" << path << "'.\n" << std::flush; return -1; } int OpenLogFile(char *name, ostream *&stream) { if (name == NULL || *name == '\0') { nxinfo << "Loop: WARNING! No name provided for output. Using standard error.\n" << std::flush; if (stream == NULL) { stream = &cerr; } return 1; } if (stream == NULL || stream == &cerr) { if (*name != '/' && *name != '.') { char *filePath = GetSessionPath(); if (filePath == NULL) { nxfatal << "Loop: PANIC! Cannot determine directory of NX session file.\n" << std::flush; cerr << "Error" << ": Cannot determine directory of NX session file.\n"; return -1; } if (strlen(filePath) + strlen("/") + strlen(name) + 1 > DEFAULT_STRING_LENGTH) { nxfatal << "Loop: PANIC! Full name of NX file '" << name << " would exceed length of " << DEFAULT_STRING_LENGTH << " characters.\n" << std::flush; cerr << "Error" << ": Full name of NX file '" << name << " would exceed length of " << DEFAULT_STRING_LENGTH << " characters.\n"; return -1; } char *file = new char[strlen(filePath) + strlen("/") + strlen(name) + 1]; // // Transform name in a fully qualified name. // strcpy(file, filePath); strcat(file, "/"); strcat(file, name); strcpy(name, file); delete [] filePath; delete [] file; } mode_t fileMode = umask(0077); for (;;) { if ((stream = new ofstream(name, ios::app)) != NULL) { break; } usleep(200000); } umask(fileMode); } else { nxfatal << "Loop: PANIC! Bad stream provided for output.\n" << std::flush; cerr << "Error" << ": Bad stream provided for output.\n"; return -1; } return 1; } int ReopenLogFile(char *name, ostream *&stream, int limit) { if (*name != '\0' && limit >= 0) { struct stat fileStat; if (limit > 0) { // // This is used for the log file, if the // size exceeds the limit. // if (stat(name, &fileStat) != 0) { nxwarn << "Loop: WARNING! Can't get stats of file '" << name << "'. Error is " << EGET() << " '" << ESTR() << "'.\n" << std::flush; return 0; } else if (fileStat.st_size < (long) limit) { return 0; } } nxinfo << "Loop: Deleting file '" << name << "' with size " << fileStat.st_size << ".\n" << std::flush; // // Create a new stream over the previous // file. Trying to delete the file fails // to work on recent Cygwin installs. // *stream << flush; delete stream; mode_t fileMode = umask(0077); for (;;) { if ((stream = new ofstream(name, ios::out)) != NULL) { break; } usleep(200000); } umask(fileMode); nxinfo << "Loop: Reopened file '" << name << "'.\n" << std::flush; } return 1; } void PrintProcessInfo() { if (agent == NULL) { cerr << endl; PrintVersionInfo(); cerr << endl; cerr << GetCopyrightInfo() << endl << GetOtherCopyrightInfo() << endl << "See https://github.com/ArcticaProject/nx-libs for more information." << endl << endl; } // // People get confused by the fact that client // mode is running on NX server and viceversa. // Let's adopt an user-friendly naming conven- // tion here. // cerr << "Info: Proxy running in " << (control -> ProxyMode == proxy_client ? "client" : "server") << " mode with pid '" << getpid() << "'.\n"; if (agent == NULL) { cerr << "Session" << ": Starting session at '" << strTimestamp() << "'.\n"; } if (*errorsFileName != '\0') { cerr << "Info" << ": Using errors file '" << errorsFileName << "'.\n"; } if (*statsFileName != '\0') { cerr << "Info" << ": Using stats file '" << statsFileName << "'.\n"; } } void PrintConnectionInfo() { cerr << "Info" << ": Using " << linkSpeedName << " link parameters " << control -> TokenSize << "/" << control -> TokenLimit << "/" << control -> FlushPolicy + 1 << "/" << control -> FlushPriority << ".\n"; if (control -> ProxyMode == proxy_client) { cerr << "Info" << ": Using agent parameters " << control -> PingTimeout << "/" << control -> MotionTimeout << "/" << control -> IdleTimeout << "/" << control -> TaintReplies << "/" << control -> HideRender << ".\n"; } if (control -> LocalDeltaCompression == 1) { cerr << "Info" << ": Using cache parameters " << control -> MinimumMessageSize << "/" << control -> MaximumMessageSize / 1024 << "KB" << "/" << control -> ClientTotalStorageSize / 1024 << "KB" << "/" << control -> ServerTotalStorageSize / 1024 << "KB" << ".\n"; } if (control -> ImageCacheEnableLoad == 1 || control -> ImageCacheEnableSave == 1) { cerr << "Info" << ": Using image streaming parameters " << control -> SplitTimeout << "/" << control -> SplitTotalSize << "/" << control -> SplitTotalStorageSize / 1024 << "KB" << "/" << control -> SplitDataThreshold << "/" << control -> SplitDataPacketLimit << ".\n"; cerr << "Info" << ": Using image cache parameters " << control -> ImageCacheEnableLoad << "/" << control -> ImageCacheEnableSave << "/" << control -> ImageCacheDiskLimit / 1024 << "KB" << ".\n"; } cerr << "Info" << ": Using pack method '" << packMethodName << "' with session '" << sessionType << "'.\n"; if (*productName != '\0') { cerr << "Info" << ": Using product '" << productName << "'.\n" << logofs_flush; } if (control -> LocalDeltaCompression == 0) { cerr << "Info" << ": Not using NX delta compression.\n"; } if (control -> LocalDataCompression == 1 || control -> RemoteDataCompression == 1) { cerr << "Info" << ": Using ZLIB data compression " << control -> LocalDataCompressionLevel << "/" << control -> RemoteDataCompressionLevel << "/" << control -> LocalDataCompressionThreshold << ".\n"; } else { cerr << "Info" << ": Not using ZLIB data compression.\n"; } if (control -> LocalStreamCompression == 1 || control -> RemoteStreamCompression == 1) { cerr << "Info" << ": Using ZLIB stream compression " << control -> LocalStreamCompressionLevel << "/" << control -> RemoteStreamCompressionLevel << ".\n"; } else { cerr << "Info" << ": Not using ZLIB stream compression.\n"; } if (control -> LocalBitrateLimit > 0) { cerr << "Info" << ": Using bandwidth limit of " << bitrateLimitName << " bits per second.\n"; } if (control -> PersistentCacheName != NULL) { cerr << "Info" << ": Using cache file '" << control -> PersistentCachePath << "/" << control -> PersistentCacheName << "'.\n"; } else { if (control -> PersistentCacheEnableLoad == 0 || control -> LocalDeltaCompression == 0) { cerr << "Info" << ": Not using a persistent cache.\n"; } else { cerr << "Info" << ": No suitable cache file found.\n"; } } if (control -> ProxyMode == proxy_client && (useUnixSocket > 0 || useTcpSocket > 0 || useAgentSocket > 0)) { cerr << "Info" << ": Listening to X11 connections " << "on display ':" << xPort << "'.\n"; } else if (control -> ProxyMode == proxy_server) { cerr << "Info" << ": Forwarding X11 connections " << "to display '" << displayHost << "'.\n"; } if (control -> ProxyMode == proxy_client && useCupsSocket > 0 && cupsPort.enabled()) { cerr << "Info" << ": Listening to CUPS connections " << "on port '" << cupsPort << "'.\n"; } else if (control -> ProxyMode == proxy_server && cupsPort.enabled()) { cerr << "Info" << ": Forwarding CUPS connections " << "to port '" << cupsPort << "'.\n"; } if (control -> ProxyMode == proxy_client && useAuxSocket > 0 && auxPort.enabled()) { cerr << "Info" << ": Listening to auxiliary X11 connections " << "on port '" << auxPort << "'.\n"; } else if (control -> ProxyMode == proxy_server && auxPort.enabled()) { cerr << "Info" << ": Forwarding auxiliary X11 connections " << "to display '" << displayHost << "'.\n"; } if (control -> ProxyMode == proxy_client && useSmbSocket > 0 && smbPort.enabled()) { cerr << "Info" << ": Listening to SMB connections " << "on port '" << smbPort << "'.\n"; } else if (control -> ProxyMode == proxy_server && smbPort.enabled()) { cerr << "Info" << ": Forwarding SMB connections " << "to port '" << smbPort << "'.\n"; } if (control -> ProxyMode == proxy_client && useMediaSocket > 0 && mediaPort.enabled()) { cerr << "Info" << ": Listening to multimedia connections " << "on port '" << mediaPort << "'.\n"; } else if (control -> ProxyMode == proxy_server && mediaPort.enabled()) { cerr << "Info" << ": Forwarding multimedia connections " << "to port '" << mediaPort << "'.\n"; } if (control -> ProxyMode == proxy_client && useHttpSocket > 0 && httpPort.enabled()) { cerr << "Info" << ": Listening to HTTP connections " << "on port '" << httpPort << "'.\n"; } else if (control -> ProxyMode == proxy_server && httpPort.enabled()) { cerr << "Info" << ": Forwarding HTTP connections " << "to port '" << httpPort << "'.\n"; } if (control -> ProxyMode == proxy_server && useFontSocket > 0 && *fontPort != '\0') { cerr << "Info" << ": Listening to font server connections " << "on port '" << fontPort << "'.\n"; } else if (control -> ProxyMode == proxy_client && *fontPort != '\0') { cerr << "Info" << ": Forwarding font server connections " << "to port '" << fontPort << "'.\n"; } if (useSlaveSocket > 0 && slavePort.enabled()) { cerr << "Info" << ": Listening to slave connections " << "on port '" << slavePort << "'.\n"; } } void PrintVersionInfo() { cerr << "NXPROXY - Version " #ifdef NX_VERSION_CUSTOM << NX_VERSION_CUSTOM << " (" #endif << control -> LocalVersionMajor << "." << control -> LocalVersionMinor << "." << control -> LocalVersionPatch << "." << control -> LocalVersionMaintenancePatch #ifdef NX_VERSION_CUSTOM << ")" #endif << endl; } void PrintCopyrightInfo() { cerr << endl; PrintVersionInfo(); cerr << endl; cerr << GetCopyrightInfo(); // // Print third party's copyright info. // cerr << endl; cerr << GetOtherCopyrightInfo(); cerr << endl; } void PrintOptionIgnored(const char *type, const char *name, const char *value) { if (control -> ProxyMode == proxy_server) { nxwarn << "Loop: WARNING! Ignoring " << type << " option '" << name << "' with value '" << value << "' at " << "NX client side.\n" << std::flush; cerr << "Warning" << ": Ignoring " << type << " option '" << name << "' with value '" << value << "' at " << "NX client side.\n"; } else { nxwarn << "Loop: WARNING! Ignoring " << type << " option '" << name << "' with value '" << value << "' at " << "NX server side.\n" << std::flush; cerr << "Warning" << ": Ignoring " << type << " option '" << name << "' with value '" << value << "' at " << "NX server side.\n"; } } const char *GetOptions(const char *options) { if (options != NULL) { if (strncasecmp(options, "nx/nx,", 6) != 0 && strncasecmp(options, "nx,", 3) != 0 && strncasecmp(options, "nx:", 3) != 0) { nxinfo << "Loop: PANIC! Display options string '" << options << "' must start with 'nx' or 'nx/nx' prefix.\n" << std::flush; cerr << "Error" << ": Display options string '" << options << "' must start with 'nx' or 'nx/nx' prefix.\n"; HandleCleanup(); } } else { options = getenv("DISPLAY"); } return options; } const char *GetArg(int &argi, int argc, const char **argv) { // // Skip "-" and flag character. // const char *arg = argv[argi] + 2; if (*arg == 0) { if (argi + 1 == argc) { return NULL; } else { argi++; return (*argv[argi] == '-' ? NULL : argv[argi]); } } else { return (*arg == '-' ? NULL : arg); } } int CheckArg(const char *type, const char *name, const char *value) { nxinfo << "Loop: Parsing " << type << " option '" << name << "' with value '" << (value ? value : "(null)") << "'.\n" << std::flush; if (value == NULL || strstr(value, "=") != NULL) { nxfatal << "Loop: PANIC! Error in " << type << " option '" << name << "'. No value found.\n" << std::flush; cerr << "Error" << ": Error in " << type << " option '" << name << "'. No value found.\n"; return -1; } else if (strstr(name, ",") != NULL) { nxfatal << "Loop: PANIC! Parse error at " << type << " option '" << name << "'.\n" << std::flush; cerr << "Error" << ": Parse error at " << type << " option '" << name << "'.\n"; return -1; } else if (strlen(value) >= DEFAULT_STRING_LENGTH) { nxfatal << "Loop: PANIC! Value '" << value << "' of " << type << " option '" << name << "' exceeds length of " << DEFAULT_STRING_LENGTH << " characters.\n" << std::flush; cerr << "Error" << ": Value '" << value << "' of " << type << " option '" << name << "' exceeds length of " << DEFAULT_STRING_LENGTH << " characters.\n"; return -1; } return 1; } int ParseArg(const char *type, const char *name, const char *value) { if (strcasecmp(value, "0") == 0) { return 0; } // // Find the base factor. // double base; const char *id = value + strlen(value) - 1; if (strcasecmp(id, "g") == 0) { base = 1024 * 1024 * 1024; } else if (strcasecmp(id, "m") == 0) { base = 1024 * 1024; } else if (strcasecmp(id, "k") == 0) { base = 1024; } else if (strcasecmp(id, "b") == 0 || isdigit(*id) == 1) { base = 1; } else { return -1; } char *string = new char[strlen(value)]; // copy value but cut off the last character snprintf(string, strlen(value), "%s", value); nxinfo << "Loop: Parsing integer option '" << name << "' from string '" << string << "' with base set to "; switch (tolower(*id)) { case 'k': case 'm': case 'g': { nxinfo_append << (char) toupper(*id); break; } } nxinfo_append << ".\n" << std::flush; double result = atof(string) * base; delete [] string; if (result < 0 || result > (((unsigned) -1) >> 1)) { return -1; } nxinfo << "Loop: Integer option parsed to '" << (int) result << "'.\n" << std::flush; return (int) result; } void SetAndValidateChannelEndPointArg(const char *type, const char *name, const char *value, ChannelEndPoint &endPoint) { endPoint.setSpec(value); if (!endPoint.validateSpec()) { nxfatal << "Loop: PANIC! Invalid " << type << " option '" << name << "' with value '" << value << "'.\n" << std::flush; cerr << "Error" << ": Invalid " << type << " option '" << name << "' with value '" << value << "'.\n"; HandleCleanup(); } } int ValidateArg(const char *type, const char *name, const char *value) { int number = atoi(value); if (number < 0) { nxfatal << "Loop: PANIC! Invalid " << type << " option '" << name << "' with value '" << value << "'.\n" << std::flush; cerr << "Error" << ": Invalid " << type << " option '" << name << "' with value '" << value << "'.\n"; HandleCleanup(); } return number; } int LowercaseArg(const char *type, const char *name, char *value) { char *next = value; while (*next != '\0') { *next = tolower(*next); next++; } return 1; } int CheckSignal(int signal) { // // Return 1 if the signal needs to be handled // by the proxy, 2 if the signal just needs to // be blocked to avoid interrupting a system // call. // switch (signal) { case SIGCHLD: case SIGUSR1: case SIGUSR2: case SIGHUP: case SIGINT: case SIGTERM: case SIGPIPE: case SIGALRM: { return 1; } case SIGVTALRM: case SIGWINCH: case SIGIO: case SIGTSTP: case SIGTTIN: case SIGTTOU: { return 2; } default: { #ifdef __CYGWIN32__ // // This signal can be raised by the Cygwin // library. // if (signal == 12) { return 1; } #endif return 0; } } } static void PrintUsageInfo(const char *option, int error) { if (error == 1) { cerr << "Error" << ": Invalid command line option '" << option << "'.\n"; } cerr << GetUsageInfo(); if (error == 1) { cerr << "Error" << ": NX transport initialization failed.\n"; } } static void handleCheckSessionInLoop() { // // Check if we completed the shutdown procedure // and the remote confirmed the shutdown. The // tear down should be always initiated by the // agent, but the X server side may unilateral- // ly shut down the link without our permission. // if (proxy -> getShutdown() > 0) { nxinfo << "Loop: End of NX transport requested " << "by remote.\n" << std::flush; handleTerminatingInLoop(); if (control -> ProxyMode == proxy_server) { nxinfo << "Loop: Bytes received so far are " << (unsigned long long) statistics -> getBytesIn() << ".\n" << std::flush; if (statistics -> getBytesIn() < 1024) { cerr << "Info" << ": Your session was closed before reaching " << "a usable state.\n"; cerr << "Info" << ": This can be due to the local X server " << "refusing access to the client.\n"; cerr << "Info" << ": Please check authorization provided " << "by the remote X application.\n"; } } nxinfo << "Loop: Shutting down the NX transport.\n" << std::flush; HandleCleanup(); } else if (proxy -> handlePing() < 0) { nxinfo << "Loop: Failure handling the ping for " << "proxy FD#" << proxyFD << ".\n" << std::flush; HandleShutdown(); } // // Check if the watchdog has exited and we didn't // get the SIGCHLD. This can happen if the parent // has overridden our signal handlers. // if (IsRunning(lastWatchdog) && CheckProcess(lastWatchdog, "watchdog") == 0) { nxwarn << "Loop: WARNING! Watchdog is gone unnoticed. " << "Setting the last signal to SIGTERM.\n" << std::flush; lastSignal = SIGTERM; nxwarn << "Loop: WARNING! Resetting pid of last " << "watchdog process.\n" << std::flush; SetNotRunning(lastWatchdog); } // // Let the client proxy find out if the agent's // channel is gone. This is the normal shutdown // procedure in the case of an internal connect- // ion to the agent. // int cleanup = 0; if (control -> ProxyMode == proxy_client && agent != NULL && proxy -> getType(agentFD[1]) == channel_none && lastKill == 0 && lastDestroy == 1) { nxinfo << "Loop: End of NX transport requested " << "by agent.\n" << std::flush; nxinfo << "Loop: Bytes sent so far are " << (unsigned long long) statistics -> getBytesOut() << ".\n" << std::flush; if (statistics -> getBytesOut() < 1024) { cerr << "Info" << ": Your session has died before reaching " << "an usable state.\n"; cerr << "Info" << ": This can be due to the remote X server " << "refusing access to the client.\n"; cerr << "Info" << ": Please check the authorization provided " << "by your X application.\n"; } cleanup = 1; } // // Check if the user requested the end of the // session by sending a signal to the proxy. // All signals are handled in the main loop // so we need to reset the value to get ready // for the next iteration. // int signal = 0; if (lastSignal != 0) { switch (lastSignal) { case SIGCHLD: case SIGUSR1: case SIGUSR2: { break; } default: { signal = lastSignal; cleanup = 1; break; } } lastSignal = 0; } if (cleanup == 1) { // // The first time termination signal is received // disable all further connections, close down any // X channel and wait for a second signal. // if (lastKill == 0) { // // Don't print a message if cleanup is // due to normal termination of agent. // if (signal != 0) { nxinfo << "Loop: End of NX transport requested by signal '" << signal << "' '" << DumpSignal(signal) << "'.\n" << std::flush; handleTerminatingInLoop(); } // // Disable any further connection. // CleanupListeners(); // // Close all the remaining X channels and // let proxies save their persistent cache // on disk. // CleanupConnections(); // // We'll need to wait for the X channels // to be shut down before waiting for the // cleanup signal. // lastKill = 1; } else if (lastKill == 2) { nxinfo << "Loop: Shutting down the NX transport.\n" << std::flush; proxy -> handleShutdown(); HandleCleanup(); } } if (lastKill == 1 && proxy -> getChannels(channel_x11) == 0) { // // Save the message stores to the // persistent cache. // proxy -> handleSave(); // // Run a watchdog process so we can finally // give up at the time the watchdog exits. // if (IsNotRunning(lastWatchdog)) { int timeout = control -> CleanupTimeout; if (timeout > 0) { if (proxy -> getChannels() == 0) { timeout = 500; } nxinfo << "Loop: Starting watchdog process with timeout " << "of " << timeout << " ms.\n" << std::flush; } else { nxinfo << "Loop: Starting watchdog process without " << "a timeout.\n" << std::flush; } lastWatchdog = NXTransWatchdog(timeout); if (IsFailed(lastWatchdog)) { nxfatal << "Loop: PANIC! Can't start the NX watchdog " << "process in shutdown.\n" << std::flush; cerr << "Error" << ": Can't start the NX watchdog " << "process in shutdown.\n"; HandleCleanup(); } else { nxinfo << "Loop: Watchdog started with pid '" << lastWatchdog << "'.\n" << std::flush; } } else { nxfatal << "Loop: PANIC! Previous watchdog detected " << "in shutdown with pid '" << lastWatchdog << "'.\n" << std::flush; cerr << "Error" << ": Previous watchdog detected " << "in shutdown with pid '" << lastWatchdog << "'.\n"; HandleCleanup(); } if (control -> CleanupTimeout > 0) { nxinfo << "Loop: Waiting the cleanup timeout to complete.\n" << std::flush; cerr << "Info" << ": Waiting the cleanup timeout to complete.\n"; } else { // // The NX server will kill the watchdog // process after having shut down the // service channels. // cerr << "Info" << ": Watchdog running with pid '" << lastWatchdog << "'.\n"; nxinfo << "Loop: Waiting the watchdog process to complete.\n" << std::flush; cerr << "Info" << ": Waiting the watchdog process to complete.\n"; } lastKill = 2; } } static void handleCheckBitrateInLoop() { static long int slept = 0; nxinfo << "Loop: Bitrate is " << statistics -> getBitrateInShortFrame() << " B/s and " << statistics -> getBitrateInLongFrame() << " B/s in " << control -> ShortBitrateTimeFrame / 1000 << "/" << control -> LongBitrateTimeFrame / 1000 << " seconds timeframes.\n" << std::flush; // // This can be improved. We may not jump out // of the select often enough to guarantee // the necessary accuracy. // if (control -> LocalBitrateLimit > 0) { nxinfo << "Loop: Calculating bandwidth usage with limit " << control -> LocalBitrateLimit << ".\n" << std::flush; int reference = (statistics -> getBitrateInLongFrame() + statistics -> getBitrateInShortFrame()) / 2; if (reference > control -> LocalBitrateLimit) { double ratio = ((double) reference) / ((double) control -> LocalBitrateLimit); if (ratio > 1.2) { ratio = 1.2; } slept += (unsigned int) (pow(50000, ratio) / 1000); if (slept > 2000) { nxwarn << "Loop: WARNING! Sleeping due to " << "reference bitrate of " << reference << " B/s.\n" << std::flush; cerr << "Warning" << ": Sleeping due to " << "reference bitrate of " << reference << " B/s.\n"; slept %= 2000; } T_timestamp idleTs = getNewTimestamp(); usleep((unsigned int) pow(50000, ratio)); int diffTs = diffTimestamp(idleTs, getNewTimestamp()); statistics -> addIdleTime(diffTs); statistics -> subReadTime(diffTs); } } } static void handleCheckStateInLoop(int &setFDs) { int fdLength; int fdPending; int fdSplits; for (int j = 0; j < setFDs; j++) { if (j != proxyFD) { fdPending = proxy -> getPending(j); if (fdPending > 0) { nxfatal << "Loop: PANIC! Buffer for descriptor FD#" << j << " has pending bytes to read.\n" << std::flush; HandleCleanup(); } fdLength = proxy -> getLength(j); if (fdLength > 0) { nxinfo << "Loop: WARNING! Buffer for descriptor FD#" << j << " has " << fdLength << " bytes to write.\n" << std::flush; } } } fdPending = proxy -> getPending(proxyFD); if (fdPending > 0) { nxfatal << "Loop: PANIC! Buffer for proxy descriptor FD#" << proxyFD << " has pending bytes to read.\n" << std::flush; HandleCleanup(); } fdLength = proxy -> getFlushable(proxyFD); if (fdLength > 0) { if (control -> FlushPolicy == policy_immediate && proxy -> getBlocked(proxyFD) == 0) { nxfatal << "Loop: PANIC! Buffer for proxy descriptor FD#" << proxyFD << " has " << fdLength << " bytes " << "to write with policy 'immediate'.\n" << std::flush; HandleCleanup(); } else { nxinfo << "Loop: WARNING! Buffer for proxy descriptor FD#" << proxyFD << " has " << fdLength << " bytes " << "to write.\n" << std::flush; } } fdSplits = proxy -> getSplitSize(); if (fdSplits > 0) { nxwarn << "Loop: WARNING! Proxy descriptor FD#" << proxyFD << " has " << fdSplits << " splits to send.\n" << std::flush; } } static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet, fd_set &writeSet, T_timestamp selectTs) { nxinfo << "Loop: Maximum descriptors is [" << setFDs << "] at " << strMsTimestamp() << ".\n" << std::flush; int i; if (setFDs > 0) { i = 0; nxinfo << "Loop: Selected for read are"; for (int j = 0; j < setFDs; j++) { if (FD_ISSET(j, &readSet)) { nxinfo_append << " [" << j << "]"; i++; } } if (i > 0) { nxinfo_append << ".\n" << std::flush; } else { nxinfo_append << " [none].\n" << std::flush; } i = 0; nxinfo << "Loop: Selected for write are"; for (int j = 0; j < setFDs; j++) { if (FD_ISSET(j, &writeSet)) { nxinfo_append << " [" << j << "]"; i++; } } if (i > 0) { nxinfo_append << ".\n" << std::flush; } else { nxinfo_append << " [none].\n" << std::flush; } } nxinfo << "Loop: Select timeout is " << selectTs.tv_sec << " s and " << (double) selectTs.tv_usec / 1000 << " ms.\n" << std::flush; } static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, fd_set &writeSet, struct timeval &selectTs, struct timeval &pstartTs) { int diffTs = diffTimestamp(pstartTs, getNewTimestamp()); if (diffTs >= (control -> PingTimeout - (control -> LatencyTimeout * 4))) { nxinfo << "Loop: Select result is [" << resultFDs << "] at " << strMsTimestamp() << " with no " << "communication within " << diffTs << " ms.\n" << std::flush; } else { nxinfo << "Loop: Select result is [" << resultFDs << "] error is [" << errorFDs << "] at " << strMsTimestamp() << " after " << diffTs << " ms.\n" << std::flush; } int i; if (resultFDs > 0) { i = 0; nxinfo << "Loop: Selected for read are"; for (int j = 0; j < setFDs; j++) { if (FD_ISSET(j, &readSet)) { nxinfo_append << " [" << j << "]"; i++; } } if (i > 0) { nxinfo_append << ".\n" << std::flush; } else { nxinfo_append << " [none].\n" << std::flush; } i = 0; nxinfo << "Loop: Selected for write are"; for (int j = 0; j < setFDs; j++) { if (FD_ISSET(j, &writeSet)) { nxinfo_append << " [" << j << "]"; i++; } } if (i > 0) { nxinfo_append << ".\n" << std::flush; } else { nxinfo_append << " [none].\n" << std::flush; } } } static void handleCheckSessionInConnect() { nxinfo << "Loop: Going to check session in connect.\n" << std::flush; if (control -> ProxyMode == proxy_client) { HandleAlert(FAILED_PROXY_CONNECTION_CLIENT_ALERT, 1); } else if (IsNotRunning(lastDialog)) { HandleAlert(FAILED_PROXY_CONNECTION_SERVER_ALERT, 1); } handleAlertInLoop(); } static void handleStatisticsInLoop() { if (lastSignal == 0) { return; } int mode = NO_STATS; if (control -> EnableStatistics == 1) { if (lastSignal == SIGUSR1) { // // Print overall statistics. // mode = TOTAL_STATS; } else if (lastSignal == SIGUSR2) { // // Print partial statistics. // mode = PARTIAL_STATS; } if (mode == TOTAL_STATS || mode == PARTIAL_STATS) { nxinfo << "Loop: Going to request proxy statistics " << "with signal '" << DumpSignal(lastSignal) << "'.\n" << std::flush; if (proxy != NULL) { if (ReopenLogFile(statsFileName, statofs, 0) < 0) { HandleCleanup(); } proxy -> handleStatistics(mode, statofs); } } } } static void handleNegotiationInLoop(int &setFDs, fd_set &readSet, fd_set &writeSet, T_timestamp &selectTs) { int yield = 0; while (yield == 0) { nxinfo << "Loop: Going to run a new negotiation loop " << "with stage " << control -> ProxyStage << " at " << strMsTimestamp() << ".\n" << std::flush; switch (control -> ProxyStage) { case stage_undefined: { nxinfo << "Loop: Handling negotiation with '" << "stage_undefined" << "'.\n" << std::flush; control -> ProxyStage = stage_initializing; break; } case stage_initializing: { nxinfo << "Loop: Handling negotiation with '" << "stage_initializing" << "'.\n" << std::flush; InitBeforeNegotiation(); control -> ProxyStage = stage_connecting; break; } case stage_connecting: { nxinfo << "Loop: Handling negotiation with '" << "stage_connecting" << "'.\n" << std::flush; SetupProxyConnection(); control -> ProxyStage = stage_connected; break; } case stage_connected: { nxinfo << "Loop: Handling negotiation with '" << "stage_connected" << "'.\n" << std::flush; // // Server side proxy must always be the one that // sends its version and options first, so, in // some way, client side can be the the one that // has the last word on the matter. // if (control -> ProxyMode == proxy_server) { // // Check if we have been listening for a // forwarder. In this case it will have to // authenticate itself. // if (WE_LISTEN_FORWARDER) { control -> ProxyStage = stage_waiting_forwarder_version; break; } control -> ProxyStage = stage_sending_proxy_options; } else { // // The X client side is the side that has to wait // for the authorization cookie and any remote // option. // control -> ProxyStage = stage_waiting_proxy_version; } break; } case stage_sending_proxy_options: { nxinfo << "Loop: Handling negotiation with '" << "stage_sending_proxy_options" << "'.\n" << std::flush; if (SendProxyOptions(proxyFD) < 0) { goto handleNegotiationInLoopError; } if (control -> ProxyMode == proxy_server) { control -> ProxyStage = stage_waiting_proxy_version; } else { control -> ProxyStage = stage_sending_proxy_caches; } break; } case stage_waiting_forwarder_version: { nxinfo << "Loop: Handling negotiation with '" << "stage_waiting_forwarder_version" << "'.\n" << std::flush; int result = ReadForwarderVersion(proxyFD); if (result == 0) { yield = 1; } else if (result == 1) { control -> ProxyStage = stage_waiting_forwarder_options; } else { goto handleNegotiationInLoopError; } break; } case stage_waiting_forwarder_options: { nxinfo << "Loop: Handling negotiation with '" << "stage_waiting_forwarder_options" << "'.\n" << std::flush; int result = ReadForwarderOptions(proxyFD); if (result == 0) { yield = 1; } else if (result == 1) { control -> ProxyStage = stage_sending_proxy_options; } else { goto handleNegotiationInLoopError; } break; } case stage_waiting_proxy_version: { nxinfo << "Loop: Handling negotiation with '" << "stage_waiting_proxy_version" << "'.\n" << std::flush; int result = ReadProxyVersion(proxyFD); if (result == 0) { yield = 1; } else if (result == 1) { control -> ProxyStage = stage_waiting_proxy_options; } else { goto handleNegotiationInLoopError; } break; } case stage_waiting_proxy_options: { nxinfo << "Loop: Handling negotiation with '" << "stage_waiting_proxy_options" << "'.\n" << std::flush; int result = ReadProxyOptions(proxyFD); if (result == 0) { yield = 1; } else if (result == 1) { if (control -> ProxyMode == proxy_server) { control -> ProxyStage = stage_waiting_proxy_caches; } else { control -> ProxyStage = stage_sending_proxy_options; } } else { goto handleNegotiationInLoopError; } break; } case stage_sending_proxy_caches: { nxinfo << "Loop: Handling negotiation with '" << "stage_sending_proxy_caches" << "'.\n" << std::flush; if (SendProxyCaches(proxyFD) < 0) { goto handleNegotiationInLoopError; } if (control -> ProxyMode == proxy_server) { control -> ProxyStage = stage_operational; } else { control -> ProxyStage = stage_waiting_proxy_caches; } break; } case stage_waiting_proxy_caches: { nxinfo << "Loop: Handling negotiation with '" << "stage_waiting_proxy_caches" << "'.\n" << std::flush; int result = ReadProxyCaches(proxyFD); if (result == 0) { yield = 1; } else if (result == 1) { if (control -> ProxyMode == proxy_server) { control -> ProxyStage = stage_sending_proxy_caches; } else { control -> ProxyStage = stage_operational; } } else { goto handleNegotiationInLoopError; } break; } case stage_operational: { nxinfo << "Loop: Handling negotiation with '" << "stage_operational" << "'.\n" << std::flush; InitAfterNegotiation(); yield = 1; break; } default: { nxfatal << "Loop: PANIC! Unmanaged case '" << control -> ProxyStage << "' while handling negotiation.\n" << std::flush; cerr << "Error" << ": Unmanaged case '" << control -> ProxyStage << "' while handling negotiation.\n"; HandleCleanup(); } } } // // Check if the user requested the end of // the session. // if (CheckAbort() != 0) { HandleCleanup(); } // // Select the proxy descriptor so that we // can proceed negotiating the session. // FD_SET(proxyFD, &readSet); if (proxyFD >= setFDs) { setFDs = proxyFD + 1; } setMinTimestamp(selectTs, control -> PingTimeout); nxinfo << "Loop: Selected proxy FD#" << proxyFD << " in negotiation " << "phase with timeout of " << selectTs.tv_sec << " s and " << selectTs.tv_usec << " ms.\n" << std::flush; return; handleNegotiationInLoopError: nxfatal << "Loop: PANIC! Failure negotiating the session in stage '" << control -> ProxyStage << "'.\n" << std::flush; cerr << "Error" << ": Failure negotiating the session in stage '" << control -> ProxyStage << "'.\n"; if (control -> ProxyMode == proxy_server && control -> ProxyStage == stage_waiting_proxy_version) { nxfatal << "Loop: PANIC! Wrong version or invalid session " << "authentication cookie.\n" << std::flush; cerr << "Error" << ": Wrong version or invalid session " << "authentication cookie.\n"; } handleTerminatingInLoop(); HandleCleanup(); } static void handleTerminatingInLoop() { if (getpid() == lastProxy) { if (control -> ProxyStage < stage_terminating) { if (agent == NULL) { cerr << "Session" << ": Terminating session at '" << strTimestamp() << "'.\n"; } control -> ProxyStage = stage_terminating; } } } static void handleTerminatedInLoop() { if (getpid() == lastProxy) { if (control -> ProxyStage < stage_terminated) { if (agent == NULL) { cerr << "Session" << ": Session terminated at '" << strTimestamp() << "'.\n"; } control -> ProxyStage = stage_terminated; } } } static void handleAlertInLoop() { if (lastAlert.code == 0) { return; } // // Since ProtoStep7 (#issue 108) // // Now the remote proxy should always // be able to handle the alert // if (lastAlert.local == 0) { if (proxy != NULL) { nxinfo << "Loop: Requesting a remote alert with code '" << lastAlert.code << "'.\n" << std::flush; if (proxy -> handleAlert(lastAlert.code) < 0) { HandleShutdown(); } } } else { nxinfo << "Loop: Handling a local alert with code '" << lastAlert.code << "'.\n" << std::flush; if (control -> ProxyMode == proxy_client) { // // If we are at X client side and server // proxy is not responding, we don't have // any possibility to interact with user. // if (lastAlert.code != CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT && lastAlert.code != RESTART_DEAD_PROXY_CONNECTION_CLIENT_ALERT && lastAlert.code != FAILED_PROXY_CONNECTION_CLIENT_ALERT) { // // Let the server proxy show the dialog. // if (proxy != NULL && proxy -> handleAlert(lastAlert.code) < 0) { HandleShutdown(); } } } else { char caption[DEFAULT_STRING_LENGTH]; strcpy(caption, ALERT_CAPTION_PREFIX); int length = strlen(sessionId); // // Get rid of the trailing MD5 from session id. // if (length > (MD5_LENGTH * 2 + 1) && *(sessionId + (length - (MD5_LENGTH * 2 + 1))) == '-') { strncat(caption, sessionId, length - (MD5_LENGTH * 2 + 1)); } else { strcat(caption, sessionId); } // // Use the display to which we are forwarding // the remote X connections. // char *display = displayHost; int replace = 1; int local = 1; const char *message; const char *type; switch (lastAlert.code) { case CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT: { message = CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT_STRING; type = CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT_TYPE; break; } case CLOSE_DEAD_X_CONNECTION_SERVER_ALERT: { message = CLOSE_DEAD_X_CONNECTION_SERVER_ALERT_STRING; type = CLOSE_DEAD_X_CONNECTION_SERVER_ALERT_TYPE; break; } case CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT: { message = CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT_STRING; type = CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT_TYPE; break; } case RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT: { message = RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT_STRING; type = RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT_TYPE; break; } case CLOSE_UNRESPONSIVE_X_SERVER_ALERT: { message = CLOSE_UNRESPONSIVE_X_SERVER_ALERT_STRING; type = CLOSE_UNRESPONSIVE_X_SERVER_ALERT_TYPE; break; } case WRONG_PROXY_VERSION_ALERT: { message = WRONG_PROXY_VERSION_ALERT_STRING; type = WRONG_PROXY_VERSION_ALERT_TYPE; break; } case FAILED_PROXY_CONNECTION_SERVER_ALERT: { message = FAILED_PROXY_CONNECTION_SERVER_ALERT_STRING; type = FAILED_PROXY_CONNECTION_SERVER_ALERT_TYPE; break; } case MISSING_PROXY_CACHE_ALERT: { message = MISSING_PROXY_CACHE_ALERT_STRING; type = MISSING_PROXY_CACHE_ALERT_TYPE; break; } case ABORT_PROXY_CONNECTION_ALERT: { message = ABORT_PROXY_CONNECTION_ALERT_STRING; type = ABORT_PROXY_CONNECTION_ALERT_TYPE; break; } case DISPLACE_MESSAGE_ALERT: { message = DISPLACE_MESSAGE_ALERT_STRING; type = DISPLACE_MESSAGE_ALERT_TYPE; break; } case GREETING_MESSAGE_ALERT: { message = GREETING_MESSAGE_ALERT_STRING; type = GREETING_MESSAGE_ALERT_TYPE; break; } case START_RESUME_SESSION_ALERT: { message = START_RESUME_SESSION_ALERT_STRING; type = START_RESUME_SESSION_ALERT_TYPE; break; } case FAILED_RESUME_DISPLAY_ALERT: { message = FAILED_RESUME_DISPLAY_ALERT_STRING; type = FAILED_RESUME_DISPLAY_ALERT_TYPE; break; } case FAILED_RESUME_DISPLAY_BROKEN_ALERT: { message = FAILED_RESUME_DISPLAY_BROKEN_STRING; type = FAILED_RESUME_DISPLAY_BROKEN_TYPE; break; } case FAILED_RESUME_VISUALS_ALERT: { message = FAILED_RESUME_VISUALS_ALERT_STRING; type = FAILED_RESUME_VISUALS_ALERT_TYPE; break; } case FAILED_RESUME_COLORMAPS_ALERT: { message = FAILED_RESUME_COLORMAPS_ALERT_STRING; type = FAILED_RESUME_COLORMAPS_ALERT_TYPE; break; } case FAILED_RESUME_PIXMAPS_ALERT: { message = FAILED_RESUME_PIXMAPS_ALERT_STRING; type = FAILED_RESUME_PIXMAPS_ALERT_TYPE; break; } case FAILED_RESUME_DEPTHS_ALERT: { message = FAILED_RESUME_DEPTHS_ALERT_STRING; type = FAILED_RESUME_DEPTHS_ALERT_TYPE; break; } case FAILED_RESUME_RENDER_ALERT: { message = FAILED_RESUME_RENDER_ALERT_STRING; type = FAILED_RESUME_RENDER_ALERT_TYPE; break; } case FAILED_RESUME_FONTS_ALERT: { message = FAILED_RESUME_FONTS_ALERT_STRING; type = FAILED_RESUME_FONTS_ALERT_TYPE; break; } case INTERNAL_ERROR_ALERT: { message = INTERNAL_ERROR_ALERT_STRING; type = INTERNAL_ERROR_ALERT_TYPE; break; } case ABORT_PROXY_NEGOTIATION_ALERT: { message = ABORT_PROXY_NEGOTIATION_ALERT_STRING; type = ABORT_PROXY_NEGOTIATION_ALERT_TYPE; break; } case ABORT_PROXY_SHUTDOWN_ALERT: { message = ABORT_PROXY_SHUTDOWN_ALERT_STRING; type = ABORT_PROXY_SHUTDOWN_ALERT_TYPE; break; } case FAILED_XDMCP_CONNECTION_ALERT: { message = FAILED_XDMCP_CONNECTION_ALERT_STRING; type = FAILED_XDMCP_CONNECTION_ALERT_TYPE; break; } default: { if (lastAlert.code > LAST_PROTO_STEP_7_ALERT) { nxwarn << "Loop: WARNING! An unrecognized alert type '" << lastAlert.code << "' was requested.\n" << std::flush; cerr << "Warning" << ": An unrecognized alert type '" << lastAlert.code << "' was requested.\n"; } else { nxwarn << "Loop: WARNING! Ignoring obsolete alert type '" << lastAlert.code << "'.\n" << std::flush; } message = NULL; type = NULL; replace = 0; break; } } if (replace == 1 && IsRunning(lastDialog)) { nxinfo << "Loop: Killing the previous dialog with pid '" << lastDialog << "'.\n" << std::flush; // // The client ignores the TERM signal // on Windows. // #ifdef __CYGWIN32__ KillProcess(lastDialog, "dialog", SIGKILL, 0); #else KillProcess(lastDialog, "dialog", SIGTERM, 0); #endif SetNotRunning(lastDialog); if (proxy != NULL) { proxy -> handleResetAlert(); } } if (message != NULL && type != NULL) { lastDialog = NXTransDialog(caption, message, 0, type, local, display); if (IsFailed(lastDialog)) { nxfatal << "Loop: PANIC! Can't start the NX dialog process.\n" << std::flush; SetNotRunning(lastDialog); } else { nxinfo << "Loop: Dialog started with pid '" << lastDialog << "'.\n" << std::flush; } } else { nxinfo << "Loop: No new dialog required for code '" << lastAlert.code << "'.\n" << std::flush; } } } // // Reset state. // lastAlert.code = 0; lastAlert.local = 0; } static inline void handleSetAgentInLoop(int &setFDs, fd_set &readSet, fd_set &writeSet, struct timeval &selectTs) { nxinfo << "Loop: Preparing the masks for the agent descriptors.\n" << std::flush; agent -> saveChannelState(); agent -> saveReadMask(&readSet); agent -> saveWriteMask(&writeSet); if (control -> ProxyStage >= stage_operational) { if (agent -> remoteCanRead(&readSet) || agent -> remoteCanWrite(&writeSet) || agent -> localCanRead() || agent -> proxyCanRead()) { nxinfo << "Loop: Setting a null timeout with agent descriptors ready.\n" << std::flush; // // Force a null timeout so we'll bail out // of the select immediately. We will ac- // comodate the result code later. // selectTs.tv_sec = 0; selectTs.tv_usec = 0; } } nxinfo << "Loop: Clearing the read and write agent descriptors.\n" << std::flush; agent -> clearReadMask(&readSet); agent -> clearWriteMask(&writeSet); } static inline void handleAgentInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, fd_set &writeSet, struct timeval &selectTs) { nxinfo << "Loop: Setting proxy and local agent descriptors.\n" << std::flush; // // Check if I/O is possible on the local // agent or the proxy descriptor. // if (resultFDs >= 0) { // // Save if the proxy can read from the // the agent descriptor. // agent -> saveChannelState(); nxinfo << "Loop: Values were resultFDs " << resultFDs << " errorFDs " << errorFDs << " setFDs " << setFDs << ".\n" << std::flush; if (agent -> localCanRead() == 1) { nxinfo << "Loop: Setting agent descriptor FD#" << agent -> getLocalFd() << " as ready to read.\n" << std::flush; agent -> setLocalRead(&readSet, &resultFDs); } if (agent -> proxyCanRead(&readSet) == 0 && agent -> proxyCanRead() == 1) { nxinfo << "Loop: WARNING! Can read from proxy FD#" << proxyFD << " but the descriptor " << "is not selected.\n" << std::flush; } if (agent -> proxyCanRead(&readSet) == 1) { nxinfo << "Loop: Setting proxy descriptor FD#" << agent -> getProxyFd() << " as ready to read.\n" << std::flush; } nxinfo << "Loop: Values are now resultFDs " << resultFDs << " errorFDs " << errorFDs << " setFDs " << setFDs << ".\n" << std::flush; } } static inline void handleAgentLateInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, fd_set &writeSet, struct timeval &selectTs) { nxinfo << "Loop: Setting remote agent descriptors.\n" << std::flush; // // We reset the masks before calling our select. // We now set the descriptors that are ready but // only if they were set in the original mask. // We do this after having executed our loop as // we may have produced more data and the agent // descriptors may have become readable or writ- // able in the meanwhile. // if (resultFDs >= 0) { // // Save if the proxy can read from the // the agent descriptor. // agent -> saveChannelState(); nxinfo << "Loop: Values were resultFDs " << resultFDs << " errorFDs " << errorFDs << " setFDs " << setFDs << ".\n" << std::flush; if (agent -> remoteCanRead(agent -> getSavedReadMask()) == 1) { nxinfo << "Loop: Setting agent descriptor FD#" << agent -> getRemoteFd() << " as ready to read.\n" << std::flush; agent -> setRemoteRead(&readSet, &resultFDs); } if (agent -> remoteCanWrite(agent -> getSavedWriteMask()) == 1) { nxinfo << "Loop: Setting agent descriptor FD#" << agent -> getRemoteFd() << " as ready to write.\n" << std::flush; agent -> setRemoteWrite(&writeSet, &resultFDs); } nxinfo << "Loop: Values are now resultFDs " << resultFDs << " errorFDs " << errorFDs << " setFDs " << setFDs << ".\n" << std::flush; } } static inline void handleReadableInLoop(int &resultFDs, fd_set &readSet) { if (resultFDs > 0) { T_channel_type type = channel_none; const char *label = NULL; int domain = -1; int fd = -1; if (tcpFD != -1 && FD_ISSET(tcpFD, &readSet)) { type = channel_x11; label = "X"; domain = AF_INET; fd = tcpFD; resultFDs--; } if (unixFD != -1 && FD_ISSET(unixFD, &readSet)) { type = channel_x11; label = "X"; domain = AF_UNIX; fd = unixFD; resultFDs--; } if (cupsFD != -1 && FD_ISSET(cupsFD, &readSet)) { type = channel_cups; label = "CUPS"; domain = AF_INET; fd = cupsFD; resultFDs--; } if (auxFD != -1 && FD_ISSET(auxFD, &readSet)) { // // Starting from version 1.5.0 we create real X // connections for the keyboard channel, so they // can use the fake authorization cookie. This // means that there is not such a thing like a // channel_aux anymore. // type = channel_x11; label = "auxiliary X11"; domain = AF_INET; fd = auxFD; resultFDs--; } if (smbFD != -1 && FD_ISSET(smbFD, &readSet)) { type = channel_smb; label = "SMB"; domain = AF_INET; fd = smbFD; resultFDs--; } if (mediaFD != -1 && FD_ISSET(mediaFD, &readSet)) { type = channel_media; label = "media"; domain = AF_INET; fd = mediaFD; resultFDs--; } if (httpFD != -1 && FD_ISSET(httpFD, &readSet)) { type = channel_http; label = "HTTP"; domain = AF_INET; fd = httpFD; resultFDs--; } if (fontFD != -1 && FD_ISSET(fontFD, &readSet)) { type = channel_font; label = "font server"; domain = AF_INET; fd = fontFD; resultFDs--; } if (slaveFD != -1 && FD_ISSET(slaveFD, &readSet)) { type = channel_slave; label = "slave"; domain = AF_INET; fd = slaveFD; resultFDs--; } if (type != channel_none) { int newFD = AcceptConnection(fd, domain, label); if (newFD != -1) { if (proxy -> handleNewConnection(type, newFD) < 0) { nxfatal << "Loop: PANIC! Error creating new " << label << " connection.\n" << std::flush; cerr << "Error" << ": Error creating new " << label << " connection.\n"; close(newFD); // // Don't kill the proxy in the case of an error. // // HandleCleanup(); // } else if (proxy -> getReadable(newFD) > 0) { // // Add the descriptor, so we can try // to read immediately. // nxinfo << "Loop: Trying to read immediately " << "from descriptor FD#" << newFD << ".\n" << std::flush; FD_SET(newFD, &readSet); resultFDs++; } else { nxinfo << "Loop: Nothing to read immediately " << "from descriptor FD#" << newFD << ".\n" << std::flush; } } } } nxdbg << "Loop: Going to check the readable descriptors.\n" << std::flush; if (proxy -> handleRead(resultFDs, readSet) < 0) { nxinfo << "Loop: Failure reading from descriptors " << "for proxy FD#" << proxyFD << ".\n" << std::flush; HandleShutdown(); } } static inline void handleWritableInLoop(int &resultFDs, fd_set &writeSet) { nxdbg << "Loop: Going to check the writable descriptors.\n" << std::flush; if (resultFDs > 0 && proxy -> handleFlush(resultFDs, writeSet) < 0) { nxinfo << "Loop: Failure writing to descriptors " << "for proxy FD#" << proxyFD << ".\n" << std::flush; HandleShutdown(); } } static inline void handleFlushInLoop() { nxdbg << "Loop: Going to flush any data to the proxy.\n" << std::flush; if (agent == NULL || control -> FlushPolicy == policy_immediate) { if (usePolicy == -1 && control -> ProxyMode == proxy_client) { nxinfo << "Loop: WARNING! Flushing the proxy link " << "on behalf of the agent.\n" << std::flush; } if (proxy -> handleFlush() < 0) { nxinfo << "Loop: Failure flushing the proxy FD#" << proxyFD << ".\n" << std::flush; HandleShutdown(); } } } static inline void handleRotateInLoop() { nxdbg << "Loop: Going to rotate channels " << "for proxy FD#" << proxyFD << ".\n" << std::flush; proxy -> handleRotate(); } static inline void handleEventsInLoop() { nxdbg << "Loop: Going to check channel events " << "for proxy FD#" << proxyFD << ".\n" << std::flush; if (proxy -> handleEvents() < 0) { nxinfo << "Loop: Failure handling channel events " << "for proxy FD#" << proxyFD << ".\n" << std::flush; HandleShutdown(); } } static void handleLogReopenInLoop(T_timestamp &lTs, T_timestamp &nTs) { // // If need to limit the size of the // log file, check the size at each // loop. // #ifndef QUOTA if (diffTimestamp(lTs, nTs) > control -> FileSizeCheckTimeout) #endif { nxdbg << "Loop: Checking size of log file '" << errorsFileName << "'.\n" << std::flush; #ifndef MIXED if (ReopenLogFile(errorsFileName, logofs, control -> FileSizeLimit) < 0) { HandleShutdown(); } #endif // // Reset to current timestamp. // lTs = nTs; } } static inline void handleSetReadInLoop(fd_set &readSet, int &setFDs, struct timeval &selectTs) { proxy -> setReadDescriptors(&readSet, setFDs, selectTs); } static inline void handleSetWriteInLoop(fd_set &writeSet, int &setFDs, struct timeval &selectTs) { proxy -> setWriteDescriptors(&writeSet, setFDs, selectTs); } static void handleSetListenersInLoop(fd_set &readSet, int &setFDs) { // // Set descriptors of listening sockets. // if (control -> ProxyMode == proxy_client) { if (useTcpSocket == 1) { FD_SET(tcpFD, &readSet); if (tcpFD >= setFDs) { setFDs = tcpFD + 1; } nxdbg << "Loop: Selected listener tcpFD " << tcpFD << " with setFDs " << setFDs << ".\n" << std::flush; } if (useUnixSocket == 1) { FD_SET(unixFD, &readSet); if (unixFD >= setFDs) { setFDs = unixFD + 1; } nxdbg << "Loop: Selected listener unixFD " << unixFD << " with setFDs " << setFDs << ".\n" << std::flush; } if (useCupsSocket == 1) { FD_SET(cupsFD, &readSet); if (cupsFD >= setFDs) { setFDs = cupsFD + 1; } nxdbg << "Loop: Selected listener cupsFD " << cupsFD << " with setFDs " << setFDs << ".\n" << std::flush; } if (useAuxSocket == 1) { FD_SET(auxFD, &readSet); if (auxFD >= setFDs) { setFDs = auxFD + 1; } nxdbg << "Loop: Selected listener auxFD " << auxFD << " with setFDs " << setFDs << ".\n" << std::flush; } if (useSmbSocket == 1) { FD_SET(smbFD, &readSet); if (smbFD >= setFDs) { setFDs = smbFD + 1; } nxdbg << "Loop: Selected listener smbFD " << smbFD << " with setFDs " << setFDs << ".\n" << std::flush; } if (useMediaSocket == 1) { FD_SET(mediaFD, &readSet); if (mediaFD >= setFDs) { setFDs = mediaFD + 1; } nxdbg << "Loop: Selected listener mediaFD " << mediaFD << " with setFDs " << setFDs << ".\n" << std::flush; } if (useHttpSocket == 1) { FD_SET(httpFD, &readSet); if (httpFD >= setFDs) { setFDs = httpFD + 1; } nxdbg << "Loop: Selected listener httpFD " << httpFD << " with setFDs " << setFDs << ".\n" << std::flush; } } else { if (useFontSocket == 1) { FD_SET(fontFD, &readSet); if (fontFD >= setFDs) { setFDs = fontFD + 1; } nxdbg << "Loop: Selected listener fontFD " << fontFD << " with setFDs " << setFDs << ".\n" << std::flush; } } if (useSlaveSocket == 1) { FD_SET(slaveFD, &readSet); if (slaveFD >= setFDs) { setFDs = slaveFD + 1; } nxdbg << "Loop: Selected listener slaveFD " << slaveFD << " with setFDs " << setFDs << ".\n" << std::flush; } } nx-libs-3.5.99.23/nxcomp/src/Makefile.am0000644000000000000000000000731013614532331014437 0ustar NULL = lib_LTLIBRARIES = libXcomp.la libXcomp_la_SOURCES = \ ActionCache.cpp \ Agent.cpp \ Alpha.cpp \ Auth.cpp \ Bitmap.cpp \ BlockCache.cpp \ BlockCacheSet.cpp \ ChangeGC.cpp \ ChangeProperty.cpp \ ChannelCache.cpp \ Channel.cpp \ ChannelEndPoint.cpp \ CharCache.cpp \ Children.cpp \ ClearArea.cpp \ ClientCache.cpp \ ClientChannel.cpp \ ClientProxy.cpp \ ClientReadBuffer.cpp \ ClientStore.cpp \ Colormap.cpp \ ConfigureWindow.cpp \ Control.cpp \ CopyArea.cpp \ CreateGC.cpp \ CreatePixmap.cpp \ DecodeBuffer.cpp \ EncodeBuffer.cpp \ FillPoly.cpp \ Fork.cpp \ GenericChannel.cpp \ GenericReadBuffer.cpp \ GenericReply.cpp \ GenericRequest.cpp \ GetImage.cpp \ GetImageReply.cpp \ GetProperty.cpp \ GetPropertyReply.cpp \ ImageText16.cpp \ ImageText8.cpp \ IntCache.cpp \ InternAtom.cpp \ Jpeg.cpp \ Keeper.cpp \ List.cpp \ ListFontsReply.cpp \ Loop.cpp \ Message.cpp \ MD5.c \ Misc.cpp \ OpcodeStore.cpp \ Pack.c \ Pgn.cpp \ Pipe.cpp \ PolyArc.cpp \ PolyFillArc.cpp \ PolyFillRectangle.cpp \ PolyLine.cpp \ PolyPoint.cpp \ PolySegment.cpp \ PolyText16.cpp \ PolyText8.cpp \ Proxy.cpp \ ProxyReadBuffer.cpp \ PutImage.cpp \ PutPackedImage.cpp \ QueryFontReply.cpp \ ReadBuffer.cpp \ RenderAddGlyphs.cpp \ RenderChangePicture.cpp \ RenderComposite.cpp \ RenderCompositeGlyphs.cpp \ RenderCreateGlyphSet.cpp \ RenderCreatePicture.cpp \ RenderExtension.cpp \ RenderFillRectangles.cpp \ RenderFreeGlyphSet.cpp \ RenderFreePicture.cpp \ RenderGenericRequest.cpp \ RenderPictureClip.cpp \ RenderPictureFilter.cpp \ RenderPictureTransform.cpp \ RenderTrapezoids.cpp \ RenderTriangles.cpp \ Rgb.cpp \ Rle.cpp \ SendEvent.cpp \ SequenceQueue.cpp \ ServerCache.cpp \ ServerChannel.cpp \ ServerProxy.cpp \ ServerReadBuffer.cpp \ ServerStore.cpp \ SetClipRectangles.cpp \ SetUnpackAlpha.cpp \ SetUnpackColormap.cpp \ SetUnpackGeometry.cpp \ ShapeExtension.cpp \ Socket.cpp \ Split.cpp \ StaticCompressor.cpp \ Statistics.cpp \ Timestamp.cpp \ TranslateCoords.cpp \ Transport.cpp \ Unpack.cpp \ Vars.c \ Version.c \ WriteBuffer.cpp \ XidCache.cpp \ Z.cpp \ Log.cpp \ $(NULL) libXcomp_la_LIBADD = \ @JPEG_LIBS@ \ @PNG_LIBS@ \ @Z_LIBS@ \ $(NULL) AM_CXXFLAGS = \ $(BASE_CXXFLAGS) \ $(JPEG_CFLAGS) \ $(PNG_CFLAGS) \ $(Z_CFLAGS) \ $(NULL) AM_CPPFLAGS = \ -I$(top_srcdir)/include \ $(PTHREAD_CFLAGS) \ $(NULL) libXcomp_la_LDFLAGS = \ -version-number @LT_COMP_VERSION@ \ -no-undefined \ @PTHREAD_LIBS@ \ $(PTHREAD_CFLAGS) \ $(NULL) libXcompincludedir = $(includedir)/nx libXcompinclude_HEADERS = \ $(top_srcdir)/include/MD5.h \ $(top_srcdir)/include/NX.h \ $(top_srcdir)/include/NXalert.h \ $(top_srcdir)/include/NXpack.h \ $(top_srcdir)/include/NXproto.h \ $(top_srcdir)/include/NXvars.h \ $(NULL) nx-libs-3.5.99.23/nxcomp/src/MD5.c0000644000000000000000000003076513614532331013146 0ustar /* Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. L. Peter Deutsch ghost@aladdin.com */ /* $Id: md5.c,v 1.6 2002/04/13 19:20:28 lpd Exp $ */ /* Independent implementation of MD5 (RFC 1321). This code implements the MD5 Algorithm defined in RFC 1321, whose text is available at http://www.ietf.org/rfc/rfc1321.txt The code is derived from the text of the RFC, including the test suite (section A.5) but excluding the rest of Appendix A. It does not include any code or documentation that is identified in the RFC as being copyrighted. The original and principal author of md5.c is L. Peter Deutsch . Other authors are noted in the change history that follows (in reverse chronological order): 2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order either statically or dynamically; added missing #include in library. 2002-03-11 lpd Corrected argument list for main(), and added int return type, in test program and T value program. 2002-02-21 lpd Added missing #include in test program. 2000-07-03 lpd Patched to eliminate warnings about "constant is unsigned in ANSI C, signed in traditional"; made test program self-checking. 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5). 1999-05-03 lpd Original version. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "MD5.h" #include /* * Try to determine the CPU endianness * at compile time. */ #if defined(__linux) || defined(__CYGWIN32__) #include #if (__BYTE_ORDER == __LITTLE_ENDIAN) #define ARCH_IS_BIG_ENDIAN 0 #else #define ARCH_IS_BIG_ENDIAN 1 #endif #endif /* #if defined(__linux) || defined(__CYGWIN32__) */ #undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ #ifdef ARCH_IS_BIG_ENDIAN # define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1) #else # define BYTE_ORDER 0 #endif #define T_MASK ((md5_word_t)~0) #define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87) #define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9) #define T3 0x242070db #define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111) #define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050) #define T6 0x4787c62a #define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec) #define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe) #define T9 0x698098d8 #define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850) #define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e) #define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841) #define T13 0x6b901122 #define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c) #define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71) #define T16 0x49b40821 #define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d) #define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf) #define T19 0x265e5a51 #define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855) #define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2) #define T22 0x02441453 #define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e) #define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437) #define T25 0x21e1cde6 #define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829) #define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278) #define T28 0x455a14ed #define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa) #define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07) #define T31 0x676f02d9 #define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375) #define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd) #define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e) #define T35 0x6d9d6122 #define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3) #define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb) #define T38 0x4bdecfa9 #define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f) #define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f) #define T41 0x289b7ec6 #define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805) #define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a) #define T44 0x04881d05 #define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6) #define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a) #define T47 0x1fa27cf8 #define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a) #define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb) #define T50 0x432aff97 #define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58) #define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6) #define T53 0x655b59c3 #define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d) #define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82) #define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e) #define T57 0x6fa87e4f #define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f) #define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb) #define T60 0x4e0811a1 #define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d) #define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca) #define T63 0x2ad7d2bb #define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) { md5_word_t a = pms->abcd[0], b = pms->abcd[1], c = pms->abcd[2], d = pms->abcd[3]; md5_word_t t; #if BYTE_ORDER > 0 /* Define storage only for big-endian CPUs. */ md5_word_t X[16]; #else /* Define storage for little-endian or both types of CPUs. */ md5_word_t xbuf[16]; const md5_word_t *X; #endif { #if BYTE_ORDER == 0 /* * Determine dynamically whether this is a big-endian or * little-endian machine, since we can use a more efficient * algorithm on the latter. */ static const int w = 1; if (*((const md5_byte_t *)&w)) /* dynamic little-endian */ #endif #if BYTE_ORDER <= 0 /* little-endian */ { /* * On little-endian machines, we can process properly aligned * data without copying it. */ if (!((data - (const md5_byte_t *)0) & 3)) { /* data are properly aligned */ X = (const md5_word_t *)data; } else { /* not aligned */ memcpy(xbuf, data, 64); X = xbuf; } } #endif #if BYTE_ORDER == 0 else /* dynamic big-endian */ #endif #if BYTE_ORDER >= 0 /* big-endian */ { /* * On big-endian machines, we must arrange the bytes in the * right order. */ const md5_byte_t *xp = data; int i; # if BYTE_ORDER == 0 X = xbuf; /* (dynamic only) */ # else # define xbuf X /* (static only) */ # endif for (i = 0; i < 16; ++i, xp += 4) xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24); } #endif } #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) /* Round 1. */ /* Let [abcd k s i] denote the operation a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ #define F(x, y, z) (((x) & (y)) | (~(x) & (z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + F(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 0, 7, T1); SET(d, a, b, c, 1, 12, T2); SET(c, d, a, b, 2, 17, T3); SET(b, c, d, a, 3, 22, T4); SET(a, b, c, d, 4, 7, T5); SET(d, a, b, c, 5, 12, T6); SET(c, d, a, b, 6, 17, T7); SET(b, c, d, a, 7, 22, T8); SET(a, b, c, d, 8, 7, T9); SET(d, a, b, c, 9, 12, T10); SET(c, d, a, b, 10, 17, T11); SET(b, c, d, a, 11, 22, T12); SET(a, b, c, d, 12, 7, T13); SET(d, a, b, c, 13, 12, T14); SET(c, d, a, b, 14, 17, T15); SET(b, c, d, a, 15, 22, T16); #undef SET /* Round 2. */ /* Let [abcd k s i] denote the operation a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ #define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + G(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 1, 5, T17); SET(d, a, b, c, 6, 9, T18); SET(c, d, a, b, 11, 14, T19); SET(b, c, d, a, 0, 20, T20); SET(a, b, c, d, 5, 5, T21); SET(d, a, b, c, 10, 9, T22); SET(c, d, a, b, 15, 14, T23); SET(b, c, d, a, 4, 20, T24); SET(a, b, c, d, 9, 5, T25); SET(d, a, b, c, 14, 9, T26); SET(c, d, a, b, 3, 14, T27); SET(b, c, d, a, 8, 20, T28); SET(a, b, c, d, 13, 5, T29); SET(d, a, b, c, 2, 9, T30); SET(c, d, a, b, 7, 14, T31); SET(b, c, d, a, 12, 20, T32); #undef SET /* Round 3. */ /* Let [abcd k s t] denote the operation a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ #define H(x, y, z) ((x) ^ (y) ^ (z)) #define SET(a, b, c, d, k, s, Ti)\ t = a + H(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 5, 4, T33); SET(d, a, b, c, 8, 11, T34); SET(c, d, a, b, 11, 16, T35); SET(b, c, d, a, 14, 23, T36); SET(a, b, c, d, 1, 4, T37); SET(d, a, b, c, 4, 11, T38); SET(c, d, a, b, 7, 16, T39); SET(b, c, d, a, 10, 23, T40); SET(a, b, c, d, 13, 4, T41); SET(d, a, b, c, 0, 11, T42); SET(c, d, a, b, 3, 16, T43); SET(b, c, d, a, 6, 23, T44); SET(a, b, c, d, 9, 4, T45); SET(d, a, b, c, 12, 11, T46); SET(c, d, a, b, 15, 16, T47); SET(b, c, d, a, 2, 23, T48); #undef SET /* Round 4. */ /* Let [abcd k s t] denote the operation a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ #define I(x, y, z) ((y) ^ ((x) | ~(z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + I(b,c,d) + X[k] + Ti;\ a = ROTATE_LEFT(t, s) + b /* Do the following 16 operations. */ SET(a, b, c, d, 0, 6, T49); SET(d, a, b, c, 7, 10, T50); SET(c, d, a, b, 14, 15, T51); SET(b, c, d, a, 5, 21, T52); SET(a, b, c, d, 12, 6, T53); SET(d, a, b, c, 3, 10, T54); SET(c, d, a, b, 10, 15, T55); SET(b, c, d, a, 1, 21, T56); SET(a, b, c, d, 8, 6, T57); SET(d, a, b, c, 15, 10, T58); SET(c, d, a, b, 6, 15, T59); SET(b, c, d, a, 13, 21, T60); SET(a, b, c, d, 4, 6, T61); SET(d, a, b, c, 11, 10, T62); SET(c, d, a, b, 2, 15, T63); SET(b, c, d, a, 9, 21, T64); #undef SET /* Then perform the following additions. (That is increment each of the four registers by the value it had before this block was started.) */ pms->abcd[0] += a; pms->abcd[1] += b; pms->abcd[2] += c; pms->abcd[3] += d; } void md5_init(md5_state_t *pms) { pms->count[0] = pms->count[1] = 0; pms->abcd[0] = 0x67452301; pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476; pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301; pms->abcd[3] = 0x10325476; } void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes) { const md5_byte_t *p = data; int left = nbytes; int offset = (pms->count[0] >> 3) & 63; md5_word_t nbits = (md5_word_t)(nbytes << 3); if (nbytes <= 0) return; /* Update the message length. */ pms->count[1] += nbytes >> 29; pms->count[0] += nbits; if (pms->count[0] < nbits) pms->count[1]++; /* Process an initial partial block. */ if (offset) { int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); memcpy(pms->buf + offset, p, copy); if (offset + copy < 64) return; p += copy; left -= copy; md5_process(pms, pms->buf); } /* Process full blocks. */ for (; left >= 64; p += 64, left -= 64) md5_process(pms, p); /* Process a final partial block. */ if (left) memcpy(pms->buf, p, left); } void md5_finish(md5_state_t *pms, md5_byte_t digest[16]) { static const md5_byte_t pad[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; md5_byte_t data[8]; int i; /* Save the length before padding. */ for (i = 0; i < 8; ++i) data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); /* Pad to 56 bytes mod 64. */ md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); /* Append the length. */ md5_append(pms, data, 8); for (i = 0; i < 16; ++i) digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); } nx-libs-3.5.99.23/nxcomp/src/Message.cpp0000644000000000000000000016173513614532331014507 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "Misc.h" // // We need channel's cache data. // #include "Message.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. You also // need to define DUMP in Misc.cpp // if DUMP is defined here. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Define this to log when messages // are allocated and deallocated. // #undef REFERENCES // // Keep track of how many bytes are // occupied by cache. // int MessageStore::totalLocalStorageSize_ = 0; int MessageStore::totalRemoteStorageSize_ = 0; // // These are used for reference count. // #ifdef REFERENCES int Message::references_ = 0; int MessageStore::references_ = 0; #endif // // Here are the methods to handle cached messages. // MessageStore::MessageStore(StaticCompressor *compressor) : compressor_(compressor) { // // Public members. // enableCache = MESSAGE_ENABLE_CACHE; enableData = MESSAGE_ENABLE_DATA; enableSplit = MESSAGE_ENABLE_SPLIT; enableCompress = MESSAGE_ENABLE_COMPRESS; dataLimit = MESSAGE_DATA_LIMIT; dataOffset = MESSAGE_DATA_OFFSET; cacheSlots = MESSAGE_CACHE_SLOTS; cacheThreshold = MESSAGE_CACHE_THRESHOLD; cacheLowerThreshold = MESSAGE_CACHE_LOWER_THRESHOLD; #ifdef TEST *logofs << "MessageStore: Static compressor is at " << compressor_ << ".\n" << logofs_flush; #endif md5_state_ = new md5_state_t(); #ifdef DEBUG *logofs << "MessageStore: Created MD5 state for object at " << this << ".\n" << logofs_flush; #endif lastAdded = cacheSlots; lastHit = 0; lastRemoved = 0; lastRated = nothing; lastAction = is_discarded; // // Private members. // localStorageSize_ = 0; remoteStorageSize_ = 0; #ifdef TEST *logofs << "MessageStore: Size of total cache is " << totalLocalStorageSize_ << " bytes at local side and " << totalRemoteStorageSize_ << " bytes at remote side.\n" << logofs_flush; #endif messages_ = new T_messages(); checksums_ = new T_checksums(); temporary_ = NULL; #ifdef REFERENCES references_++; *logofs << "MessageStore: Created new store at " << this << "out of " << references_ << " allocated stores.\n" << logofs_flush; #endif } MessageStore::~MessageStore() { // // The virtual destructor of specialized class // must get rid of both messages in container // and temporary. // #ifdef DEBUG *logofs << "MessageStore: Deleting MD5 state for object at " << this << ".\n" << logofs_flush; #endif delete md5_state_; delete messages_; delete checksums_; // // Update the static members tracking // size of total memory allocated for // all stores. // totalLocalStorageSize_ -= localStorageSize_; totalRemoteStorageSize_ -= remoteStorageSize_; #ifdef TEST *logofs << "MessageStore: Size of total cache is " << totalLocalStorageSize_ << " bytes at local side and " << totalRemoteStorageSize_ << " bytes at remote side.\n" << logofs_flush; #endif #ifdef REFERENCES references_--; *logofs << "MessageStore: Deleted store at " << this << " out of " << references_ << " allocated stores.\n" << logofs_flush; #endif } // // Here are the methods to parse and cache // messages in the message stores. // int MessageStore::parse(Message *message, int split, const unsigned char *buffer, unsigned int size, T_checksum_action checksumAction, T_data_action dataAction, int bigEndian) { // // Save the message size as received on the link. // This information will be used to create an ap- // propriate buffer at the time the message will // be unparsed. // message -> size_ = size; message -> i_size_ = identitySize(buffer, size); message -> c_size_ = 0; validateSize(size); if (checksumAction == use_checksum) { beginChecksum(message); parseIdentity(message, buffer, size, bigEndian); identityChecksum(message, buffer, size, bigEndian); parseData(message, split, buffer, size, checksumAction, dataAction, bigEndian); endChecksum(message); } else { parseIdentity(message, buffer, size, bigEndian); parseData(message, split, buffer, size, checksumAction, dataAction, bigEndian); } return 1; } int MessageStore::parse(Message *message, const unsigned char *buffer, unsigned int size, const unsigned char *compressedData, const unsigned int compressedDataSize, T_checksum_action checksumAction, T_data_action dataAction, int bigEndian) { int offset = identitySize(buffer, size); message -> size_ = size; message -> i_size_ = offset; message -> c_size_ = compressedDataSize + offset; validateSize(message -> size_ - offset, compressedDataSize); if (checksumAction == use_checksum) { beginChecksum(message); parseIdentity(message, buffer, size, bigEndian); identityChecksum(message, buffer, size, bigEndian); parseData(message, buffer, size, compressedData, compressedDataSize, checksumAction, dataAction, bigEndian); endChecksum(message); } else { parseIdentity(message, buffer, size, bigEndian); parseData(message, buffer, size, compressedData, compressedDataSize, checksumAction, dataAction, bigEndian); } return 1; } int MessageStore::parseData(Message *message, int split, const unsigned char *buffer, unsigned int size, T_checksum_action checksumAction, T_data_action dataAction, int bigEndian) { if ((int) size > message -> i_size_) { unsigned int dataSize = size - message -> i_size_; if (checksumAction == use_checksum) { #ifdef DEBUG *logofs << name() << ": Calculating checksum of object at " << message << " with data size " << dataSize << ".\n" << logofs_flush; #endif dataChecksum(message, buffer, size, bigEndian); } if (dataAction == discard_data) { #ifdef DEBUG *logofs << name() << ": Discarded " << dataSize << " bytes of plain data. Real size is " << message -> size_ << " compressed size is " << message -> c_size_ << ".\n" << logofs_flush; #endif return 1; } // // Accept anyway data beyond the // expected limit. // #ifdef TEST if (dataSize > (unsigned int) dataLimit) { *logofs << name() << ": WARNING! Data is " << dataSize << " bytes. Ignoring the established limit.\n" << logofs_flush; } #endif if (dataSize != message -> data_.size()) { #ifdef DEBUG *logofs << name() << ": Data will be resized from " << message -> data_.size() << " to hold a plain buffer of " << dataSize << " bytes.\n" << logofs_flush; #endif message -> data_.clear(); message -> data_.resize(dataSize); } if (split == 0) { memcpy(message -> data_.begin(), buffer + message -> i_size_, dataSize); } #ifdef TEST else { *logofs << name() << ": Not copied " << dataSize << " bytes of fake data for the split message.\n" << logofs_flush; } #endif #ifdef DEBUG *logofs << name() << ": Parsed " << dataSize << " bytes of plain data. Real size is " << message -> size_ << " compressed size is " << message -> c_size_ << ".\n" << logofs_flush; #endif } return 1; } // // Store the data part in compressed format. // int MessageStore::parseData(Message *message, const unsigned char *buffer, unsigned int size, const unsigned char *compressedData, const unsigned int compressedDataSize, T_checksum_action checksumAction, T_data_action dataAction, int bigEndian) { if ((int) size > message -> i_size_) { unsigned int dataSize = size - message -> i_size_; if (checksumAction == use_checksum) { #ifdef DEBUG *logofs << name() << ": Calculating checksum of object at " << message << " with data size " << dataSize << ".\n" << logofs_flush; #endif dataChecksum(message, buffer, size, bigEndian); } if (dataAction == discard_data) { #ifdef DEBUG *logofs << name() << ": Discarded " << dataSize << " bytes of compressed data. Real size is " << message -> size_ << " compressed size is " << message -> c_size_ << ".\n" << logofs_flush; #endif return 1; } #ifdef WARNING if (dataSize > (unsigned int) dataLimit) { *logofs << name() << ": WARNING! Data is " << dataSize << " bytes. Ignoring the established limit!\n" << logofs_flush; } #endif dataSize = compressedDataSize; if (dataSize != message -> data_.size()) { #ifdef DEBUG *logofs << name() << ": Data will be resized from " << message -> data_.size() << " to hold a compressed buffer of " << dataSize << " bytes.\n" << logofs_flush; #endif message -> data_.clear(); message -> data_.resize(compressedDataSize); } memcpy(message -> data_.begin(), compressedData, compressedDataSize); #ifdef DEBUG *logofs << name() << ": Parsed " << dataSize << " bytes of compressed data. Real size is " << message -> size_ << " compressed size is " << message -> c_size_ << ".\n" << logofs_flush; #endif } return 1; } int MessageStore::unparseData(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) { // // Copy data, if any, to the buffer. // if ((int) size > message -> i_size_) { // // Check if message has been stored // in compressed format. // if (message -> c_size_ == 0) { memcpy(buffer + message -> i_size_, message -> data_.begin(), size - message -> i_size_); #ifdef DEBUG *logofs << name() << ": Unparsed " << message -> size_ - message -> i_size_ << " bytes of data to a buffer of " << message -> size_ - message -> i_size_ << ".\n" << logofs_flush; #endif } else { #ifdef DEBUG *logofs << name() << ": Using static compressor at " << (void *) compressor_ << ".\n" << logofs_flush; #endif if (compressor_ -> decompressBuffer(buffer + message -> i_size_, size - message -> i_size_, message -> data_.begin(), message -> c_size_ - message -> i_size_) < 0) { #ifdef PANIC *logofs << name() << ": PANIC! Data decompression failed.\n" << logofs_flush; #endif cerr << "Error" << ": Data decompression failed.\n"; return -1; } #ifdef DEBUG *logofs << name() << ": Unparsed " << message -> c_size_ - message -> i_size_ << " bytes of compressed data to a buffer of " << message -> size_ - message -> i_size_ << ".\n" << logofs_flush; #endif } } // // We could write size to the buffer but this // is something the channel class is doing by // itself. // // PutUINT(size >> 2, buffer + 2, bigEndian); // return 1; } void MessageStore::dumpData(const Message *message) const { #ifdef DUMP *logofs << name() << ": Dumping enumerated data:\n" << logofs_flush; DumpData(message -> data_.begin(), message -> data_.size()); #endif #ifdef DUMP *logofs << name() << ": Dumping checksum data:\n" << logofs_flush; DumpData(message -> md5_digest_, MD5_LENGTH); #endif } T_checksum MessageStore::getChecksum(const unsigned char *buffer, unsigned int size, int bigEndian) { Message *message = getTemporary(); message -> size_ = size; message -> i_size_ = identitySize(buffer, size); message -> c_size_ = 0; validateSize(size); beginChecksum(message); // // We don't need to extract the identity // data from the buffer. // // parseIdentity(message, buffer, size, bigEndian); // identityChecksum(message, buffer, size, bigEndian); parseData(message, 0, buffer, size, use_checksum, discard_data, bigEndian); endChecksum(message); // // The caller will have to explicitly // deallocated the memory after use. // T_checksum checksum = new md5_byte_t[MD5_LENGTH]; memcpy(checksum, message -> md5_digest_, MD5_LENGTH); return checksum; } int MessageStore::clean(T_checksum_action checksumAction) { int position = lastRemoved + 1; if (position >= cacheSlots) { position = 0; } #ifdef DEBUG *logofs << name() << ": Searching a message to remove " << "starting at position " << position << " with " << checksums_ -> size() << " elements in cache.\n" << logofs_flush; #endif while (position != lastRemoved) { #ifdef DEBUG *logofs << name() << ": Examining position " << position << ".\n" << logofs_flush; #endif if ((*messages_)[position] != NULL) { if (getRating((*messages_)[position], rating_for_clean) == 0) { break; } else { untouch((*messages_)[position]); } } if (++position == cacheSlots) { #ifdef DEBUG *logofs << name() << ": Rolled position at " << strMsTimestamp() << ".\n" << logofs_flush; #endif position = 0; } } // // If no message is a good candidate, // then try the object at the next slot // in respect to last element removed. // if (position == lastRemoved) { position = lastRemoved + 1; if (position >= cacheSlots) { position = 0; } if ((*messages_)[position] == NULL || (*messages_)[position] -> locks_ != 0) { #ifdef DEBUG *logofs << name() << ": WARNING! No message found " << "to be actually removed.\n" << logofs_flush; #endif return nothing; } #ifdef DEBUG *logofs << name() << ": WARNING! Assuming object " << "at position " << position << ".\n" << logofs_flush; #endif } return position; } // // This is the insertion method used at local side // side. Cache at remote side side will be kept in // sync by telling the to other party where to // store the message. // int MessageStore::findOrAdd(Message *message, T_checksum_action checksumAction, T_data_action dataAction, int &added, int &locked) { if (checksumAction != use_checksum) { #ifdef PANIC *logofs << name() << ": PANIC! Internal error in context [A]. " << "Cannot find or add message to repository " << "without using checksum.\n" << logofs_flush; #endif cerr << "Error" << ": Internal error in context [A]. " << "Cannot find or add message to repository " << "without using checksum.\n"; HandleAbort(); } // // Set added to true only if message // is inserted in cache. // added = 0; locked = 0; // // First of all figure out where to // store this object. // #ifdef DEBUG *logofs << name() << ": Searching an empty slot " << "with last rated " << lastRated << " and " << "last added " << lastAdded << ".\n" << logofs_flush; #endif int position = lastRated; if (position == nothing) { position = lastAdded + 1; if (position >= cacheSlots) { position = 0; } #ifdef DEBUG *logofs << name() << ": Searching an empty slot " << "starting at position " << position << " with " << checksums_ -> size() << " elements in cache.\n" << logofs_flush; #endif while (position != lastAdded) { #ifdef DEBUG *logofs << name() << ": Examining position " << position << ".\n" << logofs_flush; #endif if ((*messages_)[position] == NULL) { break; } else if (getRating((*messages_)[position], rating_for_insert) == 0) { break; } else { untouch((*messages_)[position]); } if (++position == cacheSlots) { #ifdef DEBUG *logofs << name() << ": Rolled position at " << strMsTimestamp() << ".\n" << logofs_flush; #endif position = 0; } } } #ifdef DEBUG else { *logofs << name() << ": Using last rated position " << position << ".\n" << logofs_flush; } #endif // // If we made an extensive check but did not // find neither a free slot or a message to // replace, assume slot at next position in // respect to last added. This can happen if // all objects in repository have got an hit // recently. // if (position == lastAdded) { position = lastAdded + 1; if (position >= cacheSlots) { position = 0; } #ifdef DEBUG *logofs << name() << ": WARNING! Assuming slot " << "at position " << position << ".\n" << logofs_flush; #endif } #ifdef DEBUG else { *logofs << name() << ": Found candidate slot " << "at position " << position << ".\n" << logofs_flush; } #endif // // Save the search result so if the message // is found in cache, we can use the slot // at next run. // lastRated = position; if ((*messages_)[position] != NULL && (*messages_)[position] -> locks_ != 0) { #ifdef WARNING *logofs << name() << ": WARNING! Insertion at position " << position << " would replace a locked message. " << "Forcing channel to discard the message.\n" << logofs_flush; #endif #ifdef TEST *logofs << name() << ": Invalidating rating of object " << "at position " << position << ".\n" << logofs_flush; #endif return (lastRated = nothing); } if (checksumAction == use_checksum) { T_checksum checksum = getChecksum(message); #ifdef TEST *logofs << name() << ": Searching checksum [" << DumpChecksum(checksum) << "] in repository.\n" << logofs_flush; #endif pair result; result = checksums_ -> insert(T_checksums::value_type(checksum, position)); // // Message was found in cache or // insertion couldn't take place. // if (result.second == 0) { if (result.first == checksums_ -> end()) { #ifdef PANIC *logofs << name() << ": PANIC! Failed to insert object " << "in the cache.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to insert object of type " << name() << " in the cache.\n"; return nothing; } // // Message is in cache. // #ifdef TEST *logofs << name() << ": Object is already in cache " << "at position " << (result.first) -> second << ".\n" << logofs_flush; #endif #ifdef DEBUG printStorageSize(); #endif // // Message is locked, probably because // it has not completely recomposed at // remote side after a split. // if ((*messages_)[(result.first) -> second] -> locks_ != 0) { #ifdef TEST *logofs << name() << ": WARNING! Object at position " << (result.first) -> second << " is locked.\n" << logofs_flush; #endif locked = 1; } // // Object got a hit, so prevent // its removal. // if (lastRated == (result.first) -> second) { #ifdef TEST *logofs << name() << ": Resetting rating of object " << "at position " << (result.first) -> second << ".\n" << logofs_flush; #endif lastRated = nothing; } return (result.first) -> second; } #ifdef DEBUG *logofs << name() << ": Could not find message in cache.\n" << logofs_flush; #endif } // // Message not found in hash table (or insertion // of checksum in hash table was not requested). // Message was added to cache. // added = 1; // // Log data about the missed message. // #ifdef TEST if (opcode() == X_PutImage || opcode() == X_NXPutPackedImage) { #ifdef WARNING *logofs << name() << ": WARNING! Dumping identity of " << "missed image object of type " << name() << ".\n" << logofs_flush; #endif dumpIdentity(message); } #endif if ((*messages_)[position] != NULL) { #ifdef DEBUG *logofs << name() << ": The message replaces " << "the old one at position " << position << ".\n" << logofs_flush; #endif remove(position, checksumAction, dataAction); } (*messages_)[position] = message; // // We used the slot. Perform a new // search at next run. // lastRated = nothing; #ifdef TEST *logofs << name() << ": Stored message object of size " << plainSize(position) << " (" << message -> size_ << "/" << message -> c_size_ << ") at position " << position << ".\n" << logofs_flush; #endif unsigned int localSize; unsigned int remoteSize; storageSize(message, localSize, remoteSize); localStorageSize_ += localSize; remoteStorageSize_ += remoteSize; totalLocalStorageSize_ += localSize; totalRemoteStorageSize_ += remoteSize; #ifdef DEBUG printStorageSize(); #endif // // Set hits and timestamp at insertion in cache. // message -> hits_ = control -> StoreHitsAddBonus; message -> last_ = (getTimestamp()).tv_sec; message -> locks_ = 0; #ifdef DEBUG *logofs << name() << ": Set last hit of object at " << strMsTimestamp() << " with a bonus of " << message -> hits_ << ".\n" << logofs_flush; #endif return position; } // // Add a parsed message to repository. It is normally used // at decoding side or at encoding side when we load store // from disk. To handle messages coming from network, the // encoding side uses the optimized method findOrAdd(). // int MessageStore::add(Message *message, const int position, T_checksum_action checksumAction, T_data_action dataAction) { if (position < 0 || position >= cacheSlots) { #ifdef PANIC *logofs << name() << ": PANIC! Cannot add a message " << "at non existing position " << position << ".\n" << logofs_flush; #endif cerr << "Error" << ": Cannot add a message " << "at non existing position " << position << ".\n"; HandleAbort(); } if ((*messages_)[position] != NULL) { #ifdef DEBUG *logofs << name() << ": The message will replace " << "the old one at position " << position << ".\n" << logofs_flush; #endif remove(position, checksumAction, dataAction); } #ifdef DEBUG *logofs << name() << ": Inserting object in repository at position " << position << ".\n" << logofs_flush; #endif (*messages_)[position] = message; // // Get the object's checksum value // and insert it in the table. // if (checksumAction == use_checksum) { #ifdef DEBUG *logofs << name() << ": Inserting object's checksum in repository.\n"; #endif T_checksum checksum = getChecksum(message); checksums_ -> insert(T_checksums::value_type(checksum, position)); } #ifdef DEBUG *logofs << name() << ": Stored message object of size " << plainSize(position) << " (" << message -> size_ << "/" << message -> c_size_ << ") at position " << position << ".\n" << logofs_flush; #endif unsigned int localSize; unsigned int remoteSize; storageSize(message, localSize, remoteSize); localStorageSize_ += localSize; remoteStorageSize_ += remoteSize; totalLocalStorageSize_ += localSize; totalRemoteStorageSize_ += remoteSize; #ifdef DEBUG printStorageSize(); #endif // // Set hits and timestamp at insertion in cache. // message -> hits_ = control -> StoreHitsAddBonus; message -> last_ = (getTimestamp()).tv_sec; message -> locks_ = 0; #ifdef DEBUG *logofs << name() << ": Set last hit of object at " << strMsTimestamp() << " with a bonus of " << message -> hits_ << ".\n" << logofs_flush; #endif return position; } // // The following functions don't modify data, // so they are supposed to be called only at // the encoding side. // void MessageStore::updateData(const int position, unsigned int dataSize, unsigned int compressedDataSize) { Message *message = (*messages_)[position]; validateSize(dataSize, compressedDataSize); if (compressedDataSize != 0) { unsigned int localSize; unsigned int remoteSize; storageSize(message, localSize, remoteSize); localStorageSize_ -= localSize; remoteStorageSize_ -= remoteSize; totalLocalStorageSize_ -= localSize; totalRemoteStorageSize_ -= remoteSize; message -> c_size_ = compressedDataSize + message -> i_size_; #ifdef TEST if (message -> size_ != (int) (dataSize + message -> i_size_)) { #ifdef PANIC *logofs << name() << ": PANIC! Size of object looks " << message -> size_ << " bytes while it " << "should be " << dataSize + message -> i_size_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": Size of object looks " << message -> size_ << " bytes while it " << "should be " << dataSize + message -> i_size_ << ".\n"; HandleAbort(); } #endif storageSize(message, localSize, remoteSize); localStorageSize_ += localSize; remoteStorageSize_ += remoteSize; totalLocalStorageSize_ += localSize; totalRemoteStorageSize_ += remoteSize; #ifdef DEBUG printStorageSize(); #endif } } void MessageStore::updateData(const T_checksum checksum, unsigned int compressedDataSize) { #ifdef TEST *logofs << name() << ": Searching checksum [" << DumpChecksum(checksum) << "] in repository.\n" << logofs_flush; #endif T_checksums::iterator found = checksums_ -> find(checksum); if (found != checksums_ -> end()) { Message *message = (*messages_)[found -> second]; #ifdef TEST *logofs << name() << ": Message found in cache at " << "position " << found -> second << " with size " << message -> size_ << " and compressed size " << message -> c_size_ << ".\n" << logofs_flush; #endif updateData(found -> second, message -> size_ - message -> i_size_, compressedDataSize); } #ifdef TEST else if (checksums_ -> size() > 0) { *logofs << name() << ": WARNING! Can't locate the " << "checksum [" << DumpChecksum(checksum) << "] for the update.\n" << logofs_flush; } #endif } // // This function replaces the data part of the message // and updates the information about its size. Split // messages are advertised to the decoding side with // their uncompressed size, data is then compressed // before sending the first chunk. This function is // called by the decoding side after the split message // is fully recomposed to replace the dummy data and // set the real size. // void MessageStore::updateData(const int position, const unsigned char *newData, unsigned int dataSize, unsigned int compressedDataSize) { Message *message = (*messages_)[position]; validateSize(dataSize, compressedDataSize); #ifdef TEST if (message -> size_ != (int) (dataSize + message -> i_size_)) { #ifdef PANIC *logofs << name() << ": PANIC! Data of object looks " << dataSize << " bytes while it " << "should be " << message -> size_ - message -> i_size_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": Data of object looks " << dataSize << " bytes while it " << "should be " << message -> size_ - message -> i_size_ << ".\n"; HandleAbort(); } #endif // // A compressed data size of 0 means that // message's data was not compressed. // if (compressedDataSize != 0) { unsigned int localSize; unsigned int remoteSize; storageSize(message, localSize, remoteSize); localStorageSize_ -= localSize; remoteStorageSize_ -= remoteSize; totalLocalStorageSize_ -= localSize; totalRemoteStorageSize_ -= remoteSize; if (message -> c_size_ != (int) compressedDataSize + message -> i_size_) { #ifdef TEST *logofs << name() << ": Resizing data of message at " << "position " << position << " from " << message -> c_size_ << " to " << compressedDataSize + message -> i_size_ << " bytes.\n" << logofs_flush; #endif message -> data_.clear(); message -> data_.resize(compressedDataSize); } memcpy(message -> data_.begin(), newData, compressedDataSize); #ifdef TEST *logofs << name() << ": Data of message at position " << position << " has size " << message -> data_.size() << " and capacity " << message -> data_.capacity() << ".\n" << logofs_flush; #endif message -> c_size_ = compressedDataSize + message -> i_size_; storageSize(message, localSize, remoteSize); localStorageSize_ += localSize; remoteStorageSize_ += remoteSize; totalLocalStorageSize_ += localSize; totalRemoteStorageSize_ += remoteSize; #ifdef DEBUG printStorageSize(); #endif } else { #ifdef TEST *logofs << name() << ": No changes to data size for message " << "at position " << position << ".\n" << logofs_flush; #endif memcpy(message -> data_.begin(), newData, dataSize); } } int MessageStore::remove(const int position, T_checksum_action checksumAction, T_data_action dataAction) { Message *message; if (position < 0 || position >= cacheSlots || (message = (*messages_)[position]) == NULL) { #ifdef PANIC *logofs << name() << ": PANIC! Cannot remove " << "a non existing message at position " << position << ".\n" << logofs_flush; #endif cerr << "Error" << ": Cannot remove " << "a non existing message at position " << position << ".\n"; HandleAbort(); } #if defined(TEST) || defined(INFO) if (opcode() == X_PutImage || opcode() == X_NXPutPackedImage) { #ifdef WARNING *logofs << name() << ": WARNING! Discarding image object " << "of type " << name() << " at position " << position << ".\n" << logofs_flush; #endif } #endif // // The checksum is only stored at the encoding // side. // if (checksumAction == use_checksum) { #ifdef DEBUG *logofs << name() << ": Removing checksum for object at " << "position " << position << ".\n" << logofs_flush; #endif // // TODO: If we had stored the iterator and // not the pointer to the message, we could // have removed the message without having // to look up the checksum. // T_checksum checksum = getChecksum(message); #ifdef TEST *logofs << name() << ": Searching checksum [" << DumpChecksum(checksum) << "] in repository.\n" << logofs_flush; #endif T_checksums::iterator found = checksums_ -> find(checksum); if (found == checksums_ -> end()) { #ifdef PANIC *logofs << name() << ": PANIC! No checksum found for " << "object at position " << position << ".\n" << logofs_flush; #endif cerr << "Error" << ": No checksum found for " << "object at position " << position << ".\n"; HandleAbort(); } #ifdef TEST else if (position != found -> second) { #ifdef PANIC *logofs << name() << ": PANIC! Value of position for object " << "doesn't match position " << position << ".\n" << logofs_flush; #endif cerr << "Error" << ": Value of position for object " << "doesn't match position " << position << ".\n"; HandleAbort(); } #endif checksums_ -> erase(found); } #ifdef DEBUG *logofs << name() << ": Removing message at position " << position << " of size " << plainSize(position) << " (" << message -> size_ << "/" << message -> c_size_ << ").\n" << logofs_flush; #endif unsigned int localSize; unsigned int remoteSize; storageSize(message, localSize, remoteSize); localStorageSize_ -= localSize; remoteStorageSize_ -= remoteSize; totalLocalStorageSize_ -= localSize; totalRemoteStorageSize_ -= remoteSize; recycle(message); (*messages_)[position] = NULL; #ifdef DEBUG printStorageSize(); #endif return position; } // // This should only be called at encoding side. // The decoding side can't rely on the counter // as it is decremented by the encoding side // every time the repository is searched for a // message to be removed. // int MessageStore::getRating(Message *message, T_rating type) const { if (message -> locks_ != 0) { #ifdef TEST *logofs << name() << ": Rate set to -1 as locks of object are " << (int) message -> locks_ << ".\n" << logofs_flush; #endif return -1; } else if ((type == rating_for_clean || (int) checksums_ -> size() == cacheSlots) && message -> hits_ <= control -> StoreHitsLoadBonus) { // // We don't have any free slot or we exceeded the // available storage size. This is likely to happen // after having loaded objects from persistent cache. // It's not a bad idea to discard some messages that // were restored but never referenced. // #ifdef TEST if (type == rating_for_clean) { *logofs << name() << ": Rate set to 0 with hits " << message -> hits_ << " as maximum storage size " << "was exceeded.\n" << logofs_flush; } else { *logofs << name() << ": Rate set to 0 with hits " << message -> hits_ << " as there are no available " << "slots in store.\n" << logofs_flush; } #endif return 0; } else if (type == rating_for_clean && (getTimestamp()).tv_sec - message -> last_ >= control -> StoreTimeLimit) { #ifdef TEST *logofs << name() << ": Rate set to 0 as last hit of object was " << (getTimestamp()).tv_sec - message -> last_ << " seconds ago with limit set to " << control -> StoreTimeLimit << ".\n" << logofs_flush; #endif return 0; } else { #ifdef TEST if (message -> hits_ < 0) { *logofs << name() << ": PANIC! Rate of object shouldn't be " << message -> hits_ << ".\n" << logofs_flush; cerr << "Error" << ": Rate of object of type " << name() << " shouldn't be " << message -> hits_ << ".\n"; HandleAbort(); } #endif #ifdef TEST *logofs << name() << ": Rate of object is " << message -> hits_ << " with last hit " << (getTimestamp()).tv_sec - message -> last_ << " seconds ago.\n" << logofs_flush; #endif return message -> hits_; } } int MessageStore::touch(Message *message) const { message -> last_ = (getTimestamp()).tv_sec; message -> hits_ += control -> StoreHitsTouch; if (message -> hits_ > control -> StoreHitsLimit) { message -> hits_ = control -> StoreHitsLimit; } #ifdef TEST *logofs << name() << ": Increased hits of object to " << message -> hits_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif return message -> hits_; } int MessageStore::untouch(Message *message) const { message -> hits_ -= control -> StoreHitsUntouch; if (message -> hits_ < 0) { message -> hits_ = 0; } #ifdef TEST *logofs << name() << ": Decreased hits of object to " << message -> hits_ << ".\n" << logofs_flush; #endif return message -> hits_; } int MessageStore::lock(const int position) const { Message *message = (*messages_)[position]; if (message == NULL) { #ifdef PANIC *logofs << name() << ": PANIC! Can't lock the null " << "object at position " << position << ".\n" << logofs_flush; #endif return -1; } #ifdef DEBUG *logofs << name() << ": Increasing locks of object to " << (int) message -> locks_ + 1 << ".\n" << logofs_flush; #endif return ++(message -> locks_); } int MessageStore::unlock(const int position) const { Message *message = (*messages_)[position]; if (message == NULL) { #ifdef PANIC *logofs << name() << ": PANIC! Can't unlock the null " << "object at position " << position << ".\n" << logofs_flush; #endif return -1; } #ifdef DEBUG *logofs << name() << ": Decreasing locks of object to " << (int) message -> locks_ - 1 << ".\n" << logofs_flush; #endif return --(message -> locks_); } int MessageStore::saveStore(ostream *cachefs, md5_state_t *md5StateStream, md5_state_t *md5StateClient, T_checksum_action checksumAction, T_data_action dataAction, int bigEndian) { Message *message; #ifdef TEST *logofs << name() << ": Opcode of this store is " << (unsigned int) opcode() << " default size of " << "identity is " << dataOffset << ".\n" << logofs_flush; #endif unsigned char *identityBuffer = new unsigned char[dataOffset]; unsigned char *sizeBuffer = new unsigned char[4 * 2]; unsigned char *positionBuffer = new unsigned char[4]; unsigned char *opcodeBuffer = new unsigned char[4]; #ifdef DUMP char *md5ClientDump = new char[dataOffset * 2 + 128]; #endif unsigned char value; int offset; int failed = 0; for (int position = 0; position < cacheSlots; position++) { message = (*messages_)[position]; // // Don't save split messages. // if (message != NULL && message -> locks_ == 0) { // // Use the total size if offset is // beyond the real end of message. // offset = dataOffset; if (offset > message -> size_) { offset = message -> size_; } #ifdef TEST *logofs << name() << ": Going to save message at position " << position << ".\n" << logofs_flush; #endif value = 1; PutULONG(position, positionBuffer, bigEndian); PutULONG(opcode(), opcodeBuffer, bigEndian); md5_append(md5StateClient, positionBuffer, 4); md5_append(md5StateClient, opcodeBuffer, 4); #ifdef DUMP *logofs << "Name=" << name() << logofs_flush; sprintf(md5ClientDump," Pos=%d Op=%d\n", position, opcode()); *logofs << md5ClientDump << logofs_flush; #endif if (PutData(cachefs, &value, 1) < 0) { #ifdef DEBUG *logofs << name() << ": PANIC! Failure writing " << 1 << " bytes.\n" << logofs_flush; #endif failed = 1; break; } md5_append(md5StateStream, &value, 1); PutULONG(message -> size_, sizeBuffer, bigEndian); PutULONG(message -> c_size_, sizeBuffer + 4, bigEndian); // // Note that the identity size is not saved with // the message and will be determined from the // data read when restoring the identity. // if (PutData(cachefs, sizeBuffer, 4 * 2) < 0) { #ifdef DEBUG *logofs << name() << ": PANIC! Failure writing " << 4 * 2 << " bytes.\n" << logofs_flush; #endif failed = 1; break; } md5_append(md5StateStream, sizeBuffer, 4 * 2); md5_append(md5StateClient, sizeBuffer, 4 * 2); #ifdef DUMP sprintf(md5ClientDump, "size = %d c_size = %d\n", message -> size_, message -> c_size_); *logofs << md5ClientDump << logofs_flush; #endif // // Prepare a clean buffer for unparse. // CleanData(identityBuffer, offset); unparseIdentity(message, identityBuffer, offset, bigEndian); if (PutData(cachefs, identityBuffer, offset) < 0) { #ifdef DEBUG *logofs << name() << ": PANIC! Failure writing " << offset << " bytes.\n" << logofs_flush; #endif failed = 1; break; } md5_append(md5StateStream, identityBuffer, offset); md5_append(md5StateClient, identityBuffer, offset); #ifdef DUMP for (int i = 0; i < offset; i++) { sprintf(md5ClientDump + (i * 2), "%02X", identityBuffer[i]); } *logofs << "Identity = " << md5ClientDump << "\n" << logofs_flush; #endif // // Set the real identity size before // saving the data. // offset = message -> i_size_; if (offset > message -> size_) { offset = message -> size_; } if (checksumAction == use_checksum) { if (PutData(cachefs, message -> md5_digest_, MD5_LENGTH) < 0) { #ifdef DEBUG *logofs << name() << ": PANIC! Failure writing " << MD5_LENGTH << " bytes.\n" << logofs_flush; #endif failed = 1; break; } md5_append(md5StateStream, message -> md5_digest_, MD5_LENGTH); } else if (dataAction == use_data) { int dataSize = (message -> c_size_ == 0 ? message -> size_ - offset : message -> c_size_ - offset); if (dataSize > 0) { if (PutData(cachefs, message -> data_.begin(), dataSize) < 0) { #ifdef DEBUG *logofs << name() << ": PANIC! Failure writing " << dataSize << " bytes.\n" << logofs_flush; #endif failed = 1; break; } md5_append(md5StateStream, message -> data_.begin(), dataSize); } } } else { #ifdef TEST *logofs << name() << ": Not saving message at position " << position << ".\n" << logofs_flush; #endif value = 0; if (PutData(cachefs, &value, 1) < 0) { #ifdef DEBUG *logofs << name() << ": PANIC! Failure writing " << 1 << " bytes.\n" << logofs_flush; #endif failed = 1; break; } md5_append(md5StateStream, &value, 1); } } if (failed == 1) { #ifdef PANIC *logofs << name() << ": PANIC! Write to persistent cache file failed.\n" << logofs_flush; #endif cerr << "Error" << ": Write to persistent cache file failed.\n"; } delete [] identityBuffer; delete [] sizeBuffer; delete [] positionBuffer; delete [] opcodeBuffer; #ifdef DUMP delete [] md5ClientDump; #endif return (failed == 0 ? 1 : -1); } int MessageStore::loadStore(istream *cachefs, md5_state_t *md5StateStream, T_checksum_action checksumAction, T_data_action dataAction, int bigEndian) { Message *message; #ifdef TEST *logofs << name() << ": Opcode of this store is " << (unsigned int) opcode() << " default size of " << "identity is " << dataOffset << " slots are " << cacheSlots << ".\n" << logofs_flush; #endif // // If packed images or the render extension has been // disabled we don't need to restore these messages // in the cache. Encoding of RENDER in 1.4.0 is also // changed so we want to skip messages saved using // the old format. We want to restore all the other // messages so we'll need to skip these one by one. // int skip = 0; if ((opcode() == X_NXPutPackedImage && control -> PersistentCacheLoadPacked == 0) || (opcode() == X_NXInternalRenderExtension && control -> PersistentCacheLoadRender == 0)) { #ifdef TEST *logofs << name() << ": All messages for OPCODE#" << (unsigned int) opcode() << " will be discarded.\n" << logofs_flush; #endif skip = 1; } unsigned char *identityBuffer = new unsigned char[dataOffset]; unsigned char *sizeBuffer = new unsigned char[4 * 2]; unsigned char value; int offset; int failed = 0; for (int position = 0; position < cacheSlots; position++) { if (GetData(cachefs, &value, 1) < 0) { #ifdef DEBUG *logofs << name() << ": PANIC! Failure reading " << 1 << " bytes.\n" << logofs_flush; #endif failed = 1; break; } md5_append(md5StateStream, &value, 1); if (value == 1) { #ifdef TEST *logofs << name() << ": Going to load message at position " << position << ".\n" << logofs_flush; #endif if (GetData(cachefs, sizeBuffer, 4 * 2) < 0) { #ifdef DEBUG *logofs << name() << ": PANIC! Failure reading " << 4 * 2 << " bytes.\n" << logofs_flush; #endif failed = 1; break; } md5_append(md5StateStream, sizeBuffer, 4 * 2); message = getTemporary(); if (message == NULL) { #ifdef PANIC *logofs << name() << ": PANIC! Can't access temporary storage " << "for message in context [B].\n" << logofs_flush; #endif cerr << "Error" << ": Can't access temporary storage " << "for message in context [B].\n"; failed = 1; break; } message -> size_ = GetULONG(sizeBuffer, bigEndian); message -> c_size_ = GetULONG(sizeBuffer + 4, bigEndian); #ifdef DEBUG *logofs << name() << ": Size is " << message -> size_ << " compressed size is " << message -> c_size_ << ".\n" << logofs_flush; #endif // // Use the total size if offset is // beyond the real end of message. // offset = dataOffset; if (offset > message -> size_) { offset = message -> size_; } if (GetData(cachefs, identityBuffer, offset) < 0) { #ifdef DEBUG *logofs << name() << ": PANIC! Failure reading " << offset << " bytes.\n" << logofs_flush; #endif failed = 1; break; } md5_append(md5StateStream, identityBuffer, offset); // // Get the real identity size based on the value // reported by the message store. The dataOffset // value is guaranteed to be greater or equal to // the maximum identity size of the messages in // the major store. // offset = identitySize(identityBuffer, offset); if (offset > message -> size_) { offset = message -> size_; } message -> i_size_ = offset; // // Get identity of message from the buffer we just // created. Don't calculate neither checksum nor // data, restore them from stream. Don't pass the // message's size but the default size of identity. // parseIdentity(message, identityBuffer, offset, bigEndian); if (checksumAction == use_checksum) { if (message -> md5_digest_ == NULL) { message -> md5_digest_ = new md5_byte_t[MD5_LENGTH]; } if (GetData(cachefs, message -> md5_digest_, MD5_LENGTH) < 0) { #ifdef DEBUG *logofs << name() << ": PANIC! Failure reading " << MD5_LENGTH << " bytes.\n" << logofs_flush; #endif failed = 1; break; } // // Add message's checksum to checksum that will // be saved together with this cache. Checksum // will be verified when cache file is restored // to ensure file is not corrupted. // md5_append(md5StateStream, message -> md5_digest_, MD5_LENGTH); if (skip == 1) { #ifdef TEST *logofs << name() << ": Discarding message for OPCODE#" << (unsigned int) opcode() << ".\n" << logofs_flush; #endif continue; } } else if (dataAction == use_data) { // // Restore the data part. // int dataSize = (message -> c_size_ == 0 ? message -> size_ - offset : message -> c_size_ - offset); if (dataSize < 0 || dataSize > control -> MaximumMessageSize) { #ifdef PANIC *logofs << name() << ": PANIC! Bad data size " << dataSize << " loading persistent cache.\n" << logofs_flush; #endif cerr << "Error" << ": Bad data size " << dataSize << " loading persistent cache.\n"; failed = 1; break; } else if (dataSize > 0) { // // If need to skip the message let anyway // it to be part of the calculated MD5. // if (skip == 1) { unsigned char *dummy = new unsigned char[dataSize]; if (dummy == NULL) { #ifdef PANIC *logofs << name() << ": PANIC! Can't allocate dummy buffer " << "of size " << dataSize << " loading cache.\n" << logofs_flush; #endif cerr << "Error" << ": Can't allocate dummy buffer " << "of size " << dataSize << " loading cache.\n"; failed = 1; break; } if (GetData(cachefs, dummy, dataSize) < 0) { #ifdef DEBUG *logofs << name() << ": PANIC! Failure reading " << dataSize << " bytes.\n" << logofs_flush; #endif failed = 1; break; } md5_append(md5StateStream, dummy, dataSize); delete [] dummy; #ifdef TEST *logofs << name() << ": Discarding message for OPCODE#" << (unsigned int) opcode() << ".\n" << logofs_flush; #endif continue; } else { message -> data_.clear(); message -> data_.resize(dataSize); if (GetData(cachefs, message -> data_.begin(), dataSize) < 0) { #ifdef DEBUG *logofs << name() << ": PANIC! Failure reading " << dataSize << " bytes.\n" << logofs_flush; #endif failed = 1; break; } // // Add message's data to cache checksum. // md5_append(md5StateStream, message -> data_.begin(), dataSize); } } else { // // We are here if data part is zero. // if (skip == 1) { #ifdef TEST *logofs << name() << ": Discarding message for OPCODE#" << (unsigned int) opcode() << ".\n" << logofs_flush; #endif continue; } } } int added; added = add(message, position, checksumAction, dataAction); if (added != position) { #ifdef PANIC *logofs << name() << ": PANIC! Can't store message " << "in the cache at position " << position << ".\n" << logofs_flush; #endif cerr << "Error" << ": Can't store message " << "in the cache at position " << position << ".\n"; failed = 1; break; } else { // // Replace default value of hits set by add // function. Messages read from cache start // with a lower bonus than fresh messages // inserted. // message -> hits_ = control -> StoreHitsLoadBonus; #ifdef DEBUG *logofs << name() << ": Updated last hit of object at " << strMsTimestamp() << " with a bonus of " << message -> hits_ << ".\n" << logofs_flush; #endif resetTemporary(); } } else if ((*messages_)[position] != NULL) { #ifdef TEST *logofs << name() << ": Going to remove message at position " << position << ".\n" << logofs_flush; #endif int removed; removed = remove(position, checksumAction, dataAction); if (removed != position) { #ifdef PANIC *logofs << name() << ": PANIC! Can't remove message from cache " << "at position " << position << ".\n" << logofs_flush; #endif cerr << "Error" << ": Can't remove message from cache " << "at position " << position << ".\n"; failed = 1; break; } } #ifdef TEST else { *logofs << name() << ": Not loading message at position " << position << ".\n" << logofs_flush; } #endif } #ifdef WARNING if (failed == 1) { *logofs << name() << ": WARNING! Read from persistent cache file failed.\n" << logofs_flush; } #endif delete [] identityBuffer; delete [] sizeBuffer; return (failed == 0 ? 1 : -1); } void MessageStore::storageSize(const Message *message, unsigned int &local, unsigned int &remote) const { local = remote = storage(); // // Encoding side includes 48 bytes for // the map of checksums and 24 bytes // of adjustment for total overhead. // local += MD5_LENGTH + 48 + 24; // // At decoding side we include size of // data part and 24 bytes of adjustment // for total overhead. // if (message -> c_size_ == 0) { remote += message -> size_ + 24; } else { remote += message -> c_size_ + 24; } // // Check if we are the encoding or the // decoding side and, if needed, swap // the values. // if (message -> md5_digest_ == NULL) { unsigned int t = local; local = remote; remote = t; } } void MessageStore::printStorageSize() { #ifdef TEST *logofs << name() << ": There are " << checksums_ -> size() << " checksums in this store " << "out of " << cacheSlots << " slots.\n" << logofs_flush; *logofs << name() << ": Size of this store is " << localStorageSize_ << " bytes at local side and " << remoteStorageSize_ << " bytes at remote side.\n" << logofs_flush; *logofs << name() << ": Size of total cache is " << totalLocalStorageSize_ << " bytes at local side and " << totalRemoteStorageSize_ << " bytes at remote side.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/Message.h0000644000000000000000000006176413614532331014155 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Message_H #define Message_H #include #include "NXproto.h" #include "Misc.h" #include "Control.h" #include "Types.h" #include "Timestamp.h" #include "ActionCache.h" #include "StaticCompressor.h" // // Forward class declarations. // class ChannelCache; class EncodeBuffer; class DecodeBuffer; class WriteBuffer; // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Define this to know how many messages // are allocated and deallocated. // #undef REFERENCES // // Set default values. We limit the maximum // size of a request to 262144 but we need to // consider the replies, whose size may be up // to 4MB. // #define MESSAGE_ENABLE_CACHE 0 #define MESSAGE_ENABLE_DATA 0 #define MESSAGE_ENABLE_SPLIT 0 #define MESSAGE_ENABLE_COMPRESS 0 #define MESSAGE_DATA_LIMIT 4194304 - 4 #define MESSAGE_DATA_OFFSET 4 #define MESSAGE_CACHE_SLOTS 6000 #define MESSAGE_CACHE_THRESHOLD 50 #define MESSAGE_CACHE_LOWER_THRESHOLD 5 // // Base message class. // class Message { friend class MessageStore; friend class RenderExtensionStore; public: Message() { hits_ = 0; last_ = 0; locks_ = 0; size_ = 0; c_size_ = 0; md5_digest_ = NULL; #ifdef REFERENCES references_++; *logofs << "Message: Created new message at " << this << " out of " << references_ << " allocated messages.\n" << logofs_flush; #endif } Message(const Message &message) { size_ = message.size_; c_size_ = message.c_size_; i_size_ = message.i_size_; hits_ = message.hits_; last_ = message.last_; locks_ = message.locks_; data_ = message.data_; #ifdef REFERENCES references_++; *logofs << "Message: Creating new copied message at " << this << " out of " << references_ << " allocated messages.\n" << logofs_flush; #endif if (message.md5_digest_ != NULL) { md5_digest_ = new md5_byte_t[MD5_LENGTH]; memcpy(md5_digest_, message.md5_digest_, MD5_LENGTH); #ifdef DEBUG *logofs << "Message: Created MD5 digest for object at " << this << ".\n" << logofs_flush; #endif } else { md5_digest_ = NULL; } } ~Message() { #ifdef DEBUG if (md5_digest_ != NULL) { *logofs << "Message: Deleted MD5 digest for object at " << this << ".\n" << logofs_flush; } #endif delete [] md5_digest_; #ifdef REFERENCES references_--; *logofs << "Message: Deleted message at " << this << " out of " << references_ << " allocated messages.\n" << logofs_flush; #endif } // // This is the original message size // including the data part regardless // data is still stored in the object. // int size_; // // This is the size of the identity. // int i_size_; // // This is the size, including identity, // after message has been 'updated' to // reflect storage of data in compressed // format. // int c_size_; protected: // // This is the data part. // T_data data_; // // Time of last hit. // time_t last_; // // This is the number of cache hits // registered for the object. // short int hits_; // // This is used to mark messages // that have been split. // short int locks_; // // This is the MD5 checksum. // md5_byte_t *md5_digest_; // // Keep a reference counter // of allocated objects. // #ifdef REFERENCES static int references_; #endif }; // // Repository of messages. // class MessageStore { public: // // Enable or disable cache of messages in store. // int enableCache; // // Does message have a distinct data part. // int enableData; // // Enable or disable split of data part. // int enableSplit; // // Enable or disable compression of data part. // int enableCompress; // // Set starting point of data part in the message. // int dataOffset; // // Set maximum size for the data part of each message. // int dataLimit; // // Set maximum elements in cache. // int cacheSlots; // // Set the percentage of total cache memory which // a given type of message is allowed to occupy. // When threshold is exceeded store is cleaned to // make room for a new message of the same type. // int cacheThreshold; // // Don't clean the store if percentage of cache // memory occupied by messages of this type is // below the threshold. // int cacheLowerThreshold; // // Last operation performed on cache. // T_store_action lastAction; // // Position of last element stored in cache. // short int lastAdded; // // Positions of last element found in cache. // short int lastHit; // // Position of last element erased. // short int lastRemoved; // // Used to encode the the action to // perform on the store and the slot // involved. // ActionCache lastActionCache; // // Position in cache where next insertion // is going to take place. // short int lastRated; // // Constructors and destructors. // public: MessageStore(StaticCompressor *compressor = NULL); virtual ~MessageStore(); virtual const char *name() const = 0; virtual unsigned char opcode() const = 0; virtual unsigned int storage() const = 0; // // These are members that must be specialized. // public: virtual Message *create() const = 0; virtual Message *create(const Message &message) const = 0; virtual void destroy(Message *message) const = 0; void validateSize(int size) { if (size < control -> MinimumMessageSize || size > control -> MaximumMessageSize) { *logofs << name() << ": PANIC! Invalid size " << size << " for message.\n" << logofs_flush; cerr << "Error" << ": Invalid size " << size << " for message opcode " << opcode() << ".\n"; HandleAbort(); } } void validateSize(int dataSize, int compressedDataSize) { if (dataSize < 0 || dataSize > control -> MaximumMessageSize - 4 || compressedDataSize < 0 || compressedDataSize >= dataSize) { *logofs << name() << ": PANIC! Invalid data size " << dataSize << " and compressed data size " << compressedDataSize << " for message.\n" << logofs_flush; cerr << "Error" << ": Invalid data size " << dataSize << " and compressed data size " << compressedDataSize << " for message " << "opcode " << (unsigned) opcode() << ".\n"; HandleAbort(); } } // // Determine if the message can be stored // in the cache. // virtual int validateMessage(const unsigned char *buffer, int size) { return (size >= control -> MinimumMessageSize && size <= control -> MaximumMessageSize); } // // Get data offset based on major and minor // opcode of the message. // virtual int identitySize(const unsigned char *buffer, unsigned int size) { return dataOffset; } // // Encode identity and data using the // specific message encoding. // // Some messages do not implement these // methods because the encoding is done // directly in the channel loop. Should // move the encoding methods in in the // message classes. // virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, unsigned int size, int bigEndian, ChannelCache *channelCache) const { return 1; } virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const { return 1; } // // Encode differences between message // in cache and the one to be encoded. // virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { } // // Decode differences and update the // cached version of the same message. // virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { } // // Post process the message information // contained in the store by either up- // dating the size record or the actual // data part once the message has been // completely sent to our peer. // void updateData(const int position, unsigned int dataSize, unsigned int compressedDataSize); void updateData(const T_checksum checksum, unsigned int compressedDataSize); void updateData(const int position, const unsigned char *newData, unsigned int dataSize, unsigned int compressedDataSize); // // These members, used internally // in the message store class, are // mandatory. // protected: virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const = 0; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const = 0; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const = 0; virtual void dumpIdentity(const Message *message) const = 0; // // Design should preserve these from being // virtual. // int parseData(Message *message, int split, const unsigned char *buffer, unsigned int size, T_checksum_action checksumAction, T_data_action dataAction, int bigEndian); int parseData(Message *message, const unsigned char *buffer, unsigned int size, const unsigned char *compressedData, const unsigned int compressedDataSize, T_checksum_action checksumAction, T_data_action dataAction, int bigEndian); int unparseData(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian); // // Manage efficient allocation of messages // in the heap. // void recycle(Message *message) { #ifdef TEST if (message == NULL) { *logofs << name() << ": PANIC! Cannot recycle a null message.\n" << logofs_flush; cerr << "Error" << ": Cannot recycle a null message.\n"; HandleAbort(); } #endif if (temporary_ == NULL) { // // Be careful when reusing the message as // it can contain valid data that must be // explicitly deallocated if not needed. // Note also that you cannot count on the // initialization made in costructor. // temporary_ = message; } else { destroy(message); } } void beginChecksum(Message *message) { if (message -> md5_digest_ == NULL) { message -> md5_digest_ = new md5_byte_t[MD5_LENGTH]; #ifdef DEBUG *logofs << name() << ": Created MD5 digest structure " << "for object at " << message << ".\n" << logofs_flush; #endif } #ifdef DEBUG else { *logofs << name() << ": Using existing MD5 digest structure " << "for object at " << message << ".\n" << logofs_flush; } #endif #ifdef DEBUG *logofs << name() << ": Prepared MD5 digest for object at " << message << ".\n" << logofs_flush; #endif md5_init(md5_state_); } void endChecksum(Message *message) { md5_finish(md5_state_, message -> md5_digest_); #ifdef DEBUG *logofs << name() << ": Calculated checksum for object at " << message << ".\n" << logofs_flush; #endif } void dataChecksum(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) { // // Messages that have a data part starting // at an offset possibly beyond the end of // the message, must include the size in // the identity checksum. // if ((int) size > message -> i_size_) { md5_append(md5_state_, buffer + message -> i_size_, size - message -> i_size_); } } // // Repository handling methods. // public: // // Extract identity and data from buffer. // The size field will be updated at the // time of data parsing. // int parse(Message *message, int split, const unsigned char *buffer, unsigned int size, T_checksum_action checksumAction, T_data_action dataAction, int bigEndian); int parse(Message *message, const unsigned char *buffer, unsigned int size, const unsigned char *compressedData, const unsigned int compressedDataSize, T_checksum_action checksumAction, T_data_action dataAction, int bigEndian); // // From identity and data write the // final message to the raw buffer. // int unparse(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) { return (unparseData(message, buffer, size, bigEndian) && unparseIdentity(message, buffer, size, bigEndian)); } void dump(const Message *message) const { dumpIdentity(message); dumpData(message); } void dumpData(const Message *message) const; // // This returns the original message size as it // was received on the link. It takes in account // the data part, regardless data is still stored // in the message object. This information will // be used at the time message is unparsed. // int plainSize(const int position) const { return (*messages_)[position] -> size_; } // // This returns either the size of identity plus // the compressed data part or 0 if message is // stored in uncompressed format. // int compressedSize(const int position) const { return (*messages_)[position] -> c_size_; } // // Returns a pointer to message // given its position in cache. // Message *get(const int position) const { if (position < 0 || position >= cacheSlots) { #ifdef PANIC *logofs << name() << ": PANIC! Requested position " << position << " is not inside the " << "container.\n" << logofs_flush; #endif cerr << "Error" << ": Requested position " << position << " is not inside the" << "container.\n"; HandleAbort(); } else if ((*messages_)[position] == NULL) { #ifdef PANIC *logofs << name() << ": PANIC! Message at position " << position << " is NULL.\n" << logofs_flush; #endif cerr << "Error" << ": Message at position " << position << " is NULL.\n"; HandleAbort(); } return (*messages_)[position]; } // // This is the method called at encoding // side to add a message to cache. // int findOrAdd(Message *message, T_checksum_action checksumAction, T_data_action dataAction, int &added, int &locked); // // Utility interfaces to message insertion // and deletion. // int add(Message *message, const int position, T_checksum_action checksumAction, T_data_action dataAction); int remove(const int position, T_checksum_action checksumAction, T_data_action dataAction); // // Make space in the repository by remove // the first suitable message object. // int clean(T_checksum_action checksumAction); // // Increase or decrease the "rating" of // the message object. // int touch(Message *message) const; int untouch(Message *message) const; int getTouches(const int position) const { Message *message = (*messages_)[position]; if (message == NULL) { return 0; } return message -> hits_; } // // Gives a 'weight' to the cached message. A zero // value means object can be safely removed. A value // greater than zero means it is advisable to retain // the object. A negative result means it is mandato- // ry to keep object in cache. // int getRating(Message *message, T_rating type) const; // // Increase or decrease locks of message at given // position. A locked message will not be removed // from the message store until the lock counter // is zero. // int lock(const int position) const; int unlock(const int position) const; int getLocks(const int position) const { Message *message = (*messages_)[position]; if (message == NULL) { return 0; } return message -> locks_; } T_checksum const getChecksum(const int position) const { return getChecksum(get(position)); } T_checksum const getChecksum(const Message *message) const { if (message -> md5_digest_ == NULL) { #ifdef PANIC *logofs << name() << ": PANIC! Checksum not initialized " << "for object at " << message << ".\n" << logofs_flush; #endif cerr << "Error" << ": Checksum not initialized " << "for object at " << message << ".\n"; HandleAbort(); } #ifdef DEBUG *logofs << name() << ": Got checksum for object at " << message << ".\n" << logofs_flush; #endif return message -> md5_digest_; } // // Calculate the checksum on the fly based the // opcode in the buffer. Useful in the case a // message was not processed or was not stored // in the cache. The returned checksum must be // explicitly deallocated by the caller, after // use. // T_checksum getChecksum(const unsigned char *buffer, unsigned int size, int bigEndian); const unsigned char *getData(const Message *message) const { return message -> data_.begin(); } int plainSize(const Message *message) const { return message -> size_; } int identitySize(Message *message) { return message -> i_size_; } int compressedSize(const Message *message) const { return message -> c_size_; } Message *getTemporary() { if (temporary_ == NULL) { temporary_ = create(); } return temporary_; } void resetTemporary() { temporary_ = NULL; } // // On side where we don't have checksums, we // count how many messages are in the array. // This is obviously expensive and should be // only performed when reporting statistics. // int getSize() const { int size = checksums_ -> size(); if (size == 0) { for (int i = 0; i < cacheSlots; i++) { if ((*messages_)[i] != NULL) { size++; } } } return size; } int getLocalStorageSize() const { return localStorageSize_; } int getRemoteStorageSize() const { return remoteStorageSize_; } int getLocalTotalStorageSize() const { return totalLocalStorageSize_; } int getRemoteTotalStorageSize() const { return totalRemoteStorageSize_; } static int getCumulativeTotalStorageSize() { return (totalLocalStorageSize_ > totalRemoteStorageSize_ ? totalLocalStorageSize_ : totalRemoteStorageSize_); } int saveStore(ostream *cachefs, md5_state_t *md5_state_stream, md5_state_t *md5_state_client, T_checksum_action checksumAction, T_data_action dataAction, int bigEndian); int loadStore(istream *cachefs, md5_state_t *md5_state_stream, T_checksum_action checksumAction, T_data_action dataAction, int bigEndian); protected: // // Estimate the memory requirements of given // instance of message. Size includes memory // allocated from heap to store checksum and // data. // void storageSize(const Message *message, unsigned int &local, unsigned int &remote) const; // // Just used for debug. // void printStorageSize(); // // Repositories where to save cached messages. // First is a vector of pointers, the second // is a hash table used for fast lookups. // T_messages *messages_; T_checksums *checksums_; // // A message object to be used as a temporary. // Reuse the temporary object if possible, if // not, create a new instance. // Message *temporary_; // // Used to calculate message's checksum. // md5_state_t *md5_state_; private: // // Used to compress data payload. // StaticCompressor *compressor_; // // Keep track of how many bytes // are taken by cache. // int localStorageSize_; int remoteStorageSize_; static int totalLocalStorageSize_; static int totalRemoteStorageSize_; // // Used to track object allocation and deallocation. // #ifdef REFERENCES static int references_; #endif }; // // This is an ancillary class of the message // store, used to encode extensions based on // the minor opcode. // class MinorMessageStore { public: virtual ~MinorMessageStore() { } virtual const char *name() const = 0; virtual int identitySize(const unsigned char *buffer, unsigned int size) = 0; virtual int encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const { return 1; } virtual int decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, unsigned char type, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const { return 1; } virtual void encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, unsigned int size, int bigEndian, ChannelCache *channelCache) const { } virtual void decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, unsigned int size, int bigEndian, ChannelCache *channelCache) const { } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const = 0; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const = 0; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { } virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { } virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, md5_state_t *md5_state, int bigEndian) const = 0; }; #endif /* Message_H */ nx-libs-3.5.99.23/nxcomp/src/Misc.cpp0000644000000000000000000012662213614532331014012 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include "NXproto.h" #include "MD5.h" #include "Misc.h" #include "Proxy.h" // // Set the verbosity level. // #define PANIC #define WARNING #define OPCODES #undef TEST #undef DEBUG // // By default nxproxy binds to all network interfaces, setting // DEFAULT_LOOPBACK_BIND to 1 enables binding to the loopback // device only. // const int DEFAULT_LOOPBACK_BIND = 0; // // TCP port offset applied to any NX port specification. // const int DEFAULT_NX_PROXY_PORT_OFFSET = 4000; // // Default TCP port used by client proxy to listen to // X clients and by server proxy to connect to remote. // const int DEFAULT_NX_PROXY_PORT = 8; // // Default X display number that client proxy imitates. // const int DEFAULT_NX_X_PORT = 8; // // Default ports used for listening for cups, samba, http, // multimedia and auxiliary X connections. Arbitrary ports // can be used by passing the service's port at the proxy // startup. By default ports are determined by adding the // offset below to the offset of the proxied display. For // example, if the proxy is impersonating the display :8, // SMB tunnels can be created by connecting to port 3008. // // Considering that the NX server uses to start the first // session at display offset 1000, we must lower the CUPS // and SMB ports to avoid interference with normal X ses- // sions run on the server. // // Font server connections are used to let the X server on // the client connect to a font server on the NX server. // // Slave channels can be originated by both sides so we need // different offsets in the case the user runs both proxies // on the same host. // const int DEFAULT_NX_CUPS_PORT_OFFSET = 2000; const int DEFAULT_NX_SMB_PORT_OFFSET = 3000; const int DEFAULT_NX_MEDIA_PORT_OFFSET = 7000; const int DEFAULT_NX_AUX_PORT_OFFSET = 8000; const int DEFAULT_NX_HTTP_PORT_OFFSET = 9000; const int DEFAULT_NX_FONT_PORT_OFFSET = 10000; const int DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET = 11000; const int DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET = 12000; // // Usage info and copyright. // static const char UsageInfo[] = "\n\ Usage: nxproxy [OPTIONS] host:port\n\ \n\ -C Specify that nxproxy has to run on the 'X client'\n\ side, listening for connections and impersonating\n\ an X server.\n\ \n\ -S Specify that nxproxy has to run in 'X server' mode,\n\ thus forwarding the connections to daemons running\n\ on the client.\n\ \n\ -h Print this message.\n\ \n\ -v Print version information.\n\ \n\ -d Set log level (0=FATAL, 1=ERROR, 2=WARNING, 3=INFO,\n\ 4=DEBUG). Default is 0.\n\ \n\ -o Name of the logfile. Default is stderr.\n\ \n\ -f Specify log format. The characters in define\n\ how the loglines are formatted. The following characters\n\ are supported, default is 0:\n\ 0 only the plain text without any additions\n\ u include time\n\ l include loglevel\n\ T include thread ids\n\ L include the source code location of the log\n\ \n\ host:port Put at the end, specifies the host and port of the\n\ listening proxy.\n\ \n\ name=value Set the NX option to the provided value.\n\ \n\ Multiple NX options can be specified in the DISPLAY environment\n\ or on the command line, by using the nx/nx,option=value notation.\n\ \n\ Options:\n\ \n\ link=s An indication of the link speed that is going to be\n\ used between the proxies. Usually the compression\n\ and the other link parameters depend on this setting.\n\ The value can be either 'modem', 'isdn', 'adsl',\n\ 'wan', 'lan', 'local' or a bandwidth specification,\n\ like for example '56k', '1m', '100m', etc.\n\ \n\ type=s Type of session. Known types are: 'agent', 'proxy' and\n\ 'shadow'. The following types are also allowed and will\n\ map to one of the three mentioned before: 'desktop',\n\ 'rootless', 'console', 'default', 'gnome', 'kde',\n\ 'cde', 'xdm', 'win', 'vnc', 'application', 'raw'\n\ \n\ display=s Specify the real display where X connections have\n\ to be forwarded by the proxy running on the client.\n\ \n\ listen=n Local port used for accepting the proxy connection.\n\ \n\ loopback=b Bind to the loopback device only.\n\ \n\ accept=s Name or IP of host that can connect to the proxy.\n\ \n\ connect=s Name or IP of host that the proxy will connect to.\n\ \n\ port=n Remote port used for the connection.\n\ \n\ retry=n Number of connection attempts.\n\ \n\ root=s The root directory for the session. Usually is the\n\ C-* or S-* in the .nx directory in the user's home,\n\ with '*' being the virtual display.\n\ \n\ session=s Name of the session file. The default is the name\n\ 'session' in the session directory.\n\ \n\ errors=s Name of the log file used by the proxy. The default\n\ is the name 'errors' in the session directory.\n\ \n\ stats=s Name of the file where the proxy statistics are writ-\n\ ten to. The default is a file 'stats' in the session\n\ directory. The proxy replaces the data in the file\n\ whenever it receives a SIGUSR1 or SIGUSR2 signal:\n\ \n\ SIGUSR1 Gives total statistics, i.e. statistics\n\ collected since the beginning of the\n\ session.\n\ \n\ SIGUSR2 Gives partial statistics, i.e. statist-\n\ ics collected since the last time this\n\ signal was received.\n\ \n\ cookie=s Use the provided cookie for authenticating to the\n\ remote proxy. The same cookie is used as the fake\n\ value used for the X authorization. The fake cookie\n\ is replaced on the X server side with the real cookie\n\ to be used for the display, so that the real cookie\n\ doesn't have to travel over the net. When not using\n\ a proxy cookie, any host will be able to connect to\n\ the proxy. See also the 'accept' parameter.\n\ \n\ nodelay=b A boolean indicating if TCP_NODELAY has to be set\n\ on the proxy link. Old Linux kernels had problems\n\ with handling TCP_NODELAY on PPP links.\n\ \n\ policy=b Let or not the agent decide when it is the best time\n\ to flush the proxy link. If set to 0, the proxy will\n\ flush any encoded data immediately. The option has\n\ only effect on the X client side proxy.\n\ \n\ render=b Enable or disable use of the RENDER extension.\n\ \n\ taint=b Try to suppress trivial sources of X roundtrips by\n\ generating the reply on the X client side.\n\ \n\ delta=b Enable X differential compression.\n\ \n\ data=n Enable or disable the ZLIB data compression. It is\n\ possible to specify a value between 0 and 9. Usual-\n\ ly the value is chosen automatically based on the\n\ requested link setting.\n\ \n\ stream=n Enable or disable the ZLIB stream compression. The\n\ value, between 0 and 9, is usually determined accor-\n\ ding to the requested link setting.\n\ \n\ limit=n Specify a bitrate limit allowed for this session.\n\ \n\ memory=n Trigger memory optimizations used to keep the size\n\ of X buffers small. This is useful on embedded plat-\n\ forms, or where memory is scarce.\n\ \n\ cache=n Size of the in-memory X message cache. Setting the\n\ value to 0 will disable the memory cache as well\n\ as the NX differential compression.\n\ \n\ images=n Size of the persistent image cache.\n\ \n\ shseg=n Enable the use of the MIT-SHM extension between the\n\ NX client proxy and the real X server. A value greater\n\ than 1 is assumed to be the size of requested shared\n\ memory segment. By default, the size of the segment is\n\ determined based on the size of the in-memory cache.\n\ \n\ load=b Enable loading a persistent X message cache at the\n\ proxy startup.\n\ \n\ save=b Enable saving a persistent X message cache at the\n\ end of session.\n\ \n\ cups=n Enable or disable forwarding of CUPS connections,\n\ by listening on the optional port 'n'.\n\ \n\ aux=n Enable or disable forwarding of the auxiliary X chan-\n\ nel used for controlling the keyboard. The 'keybd=n'\n\ form is accepted for backward compatibility.\n\ \n\ smb=n Enable or disable forwarding of SMB connections. The\n\ 'samba=n' form is accepted for backward compatibility.\n\ \n\ media=n Enable forwarding of audio connections.\n\ \n\ http=n Enable forwarding of HTTP connections.\n\ \n\ font=n Enable forwarding of reversed connections to a font\n\ server running on the NX server.\n\ \n\ file=n Enable forwarding of file transfer connections.\n\ \n\ mask=n Determine the distribution of channel ids between the\n\ proxies. By default, channels whose ids are multiple\n\ of 8 (starting from 0) are reserved for the NX client\n\ side. All the other channels can be allocated by the\n\ NX server side.\n\ \n\ timeout=t Specify the keep-alive timeout used by proxies to\n\ determine if there is a network problem preventing\n\ communication with the remote peer. A value of 0\n\ disables the check.\n\ \n\ cleanup=t Specify the number of seconds the proxy has to wait\n\ at session shutdown before closing all channels.\n\ The feature is used by the NX server to ensure that\n\ services are disconnected before shutting down the\n\ link.\n\ \n\ pack=s Determine the method used to compress images.\n\ \n\ product=s The product id of the client or server. The value is\n\ ignored by the proxy, but the client or server can\n\ provide it to facilitate the support.\n\ \n\ core=b Enable production of core dumps when aborting the\n\ proxy connection.\n\ \n\ options=s Specify an additional file containing options that\n\ has to be merged with option read from the command\n\ line or the environment.\n\ \n\ kill=n Add the given process to the list of daemons that\n\ must be terminated at session shutdown. Multiple\n\ 'kill=n' options can be specified. The proxy will\n\ send them a SIGTERM signal just before exiting.\n\ \n\ strict=b Optimize for responsiveness, rather than for the best\n\ use of all the available bandwidth.\n\ \n\ encryption=b Should be set to 1 if the proxy is running as part of\n\ a program providing encryption of the point to point\n\ communication.\n\ \n\ rootless=b\n\ geometry=s\n\ resize=b\n\ fullscreen=b\n\ keyboard=s\n\ clipboard=s\n\ streaming=n\n\ backingstore=n\n\ composite=n\n\ xinerama=n\n\ shmem=b\n\ shpix=b\n\ kbtype=s\n\ client=s\n\ shadow=n\n\ shadowuid=n\n\ shadowmode=s\n\ defer=n\n\ tile=s\n\ menu=n\n\ magicpixel=n\n\ autodpi=n\n\ sleep=n\n\ tolerancechecks=s\n\ keyconv=s\n\ These options are interpreted by the NX agent. They\n\ are ignored by the proxy.\n\ \n\ Environment:\n\ \n\ NX_ROOT The root NX directory is the place where the session\n\ directory and the cache files are created. This is\n\ usually overridden by passing the 'root=' option. By\n\ default, the root NX directory is assumed to be the\n\ directory '.nx' in the user's home.\n\ \n\ NX_SYSTEM The directory where NX programs and libraries reside.\n\ If not set, the value is assumed to be '/usr/NX'.\n\ Programs, libraries and data files are respectedly\n\ searched in the 'bin', 'lib' and 'share' subdirecto-\n\ ries.\n\ \n\ NX_HOME The NX user's home directory. If NX_ROOT is not set\n\ or invalid, the user's NX directory is created here.\n\ \n\ NX_TEMP The directory where all temporary files are to be created.\n\ \n\ NX_CLIENT The full path to the nxclient executable. If the va-\n\ riable is not set, the nxclient executable will be\n\ run assuming that the program is in the system path.\n\ This can be useful on platforms like Windows and the\n\ Mac where nxclient is located in a different direct-\n\ ory compared to the other programs, to make easier\n\ for the user to execute the program from the shell.\n\ The nxclient executable will be used for displaying\n\ the menu and request windows to the user.\n\ \n\ NX_SLAVE_CMD The full path to the slave channel handler. When the\n\ slave channel is enabled, the agent will listen on a\n\ port and forward the connection to the NX_SLAVE_CMD\n\ program. This can be used to implement agent/proxy\n\ communication for applications such as serial port and\n\ USB forwarding.\n\ \n\ Shell environment:\n\ \n\ HOME The variable is checked in the case NX_HOME is not\n\ set, null or invalid.\n\ \n\ TEMP The variable is checked whenever the NX_TEMP direct-\n\ ory is not set, null or invalid.\n\ \n\ PATH The path where all executables are searched, except\n\ nxclient. If NX_CLIENT is not set, also the nxclient\n\ executable is searched in the system path.\n\ \n\ LD_LIBRARY_PATH\n\ System-wide library search order. This should be set\n\ by the program invoking the proxy.\n\ \n\ DISPLAY On the X server side, the DISPLAY variable indicates\n\ the location of the X11 server. When nxcomp is used\n\ as a transport library, the DISPLAY may represent a\n\ NX transport specification and options can passed in\n\ the form nx/nx,option=value...\n\ \n\ XAUTHORITY This is the file containing the X11 authorization\n\ cookie. If not set, the file is assumed to be in\n\ the user's home (either NX_HOME or HOME).\n\ \n\ "; const char *GetUsageInfo() { return UsageInfo; } static const char CopyrightInfo[] = "\ Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com)\n\ Copyright (c) 2008-2014 Oleksandr Shneyder \n\ Copyright (c) 2014-2016 Ulrich Sibiller \n\ Copyright (c) 2014-2016 Mihai Moldovan \n\ Copyright (c) 2011-2016 Mike Gabriel \n\ Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com)\n\ \n\ NXCOMP, NX protocol compression and NX extensions to this software\n\ are copyright of the aforementioned persons and companies.\n\ \n\ Redistribution and use of the present software is allowed according\n\ to terms specified in the file LICENSE.nxcomp which comes in the\n\ source distribution.\n\ \n\ All rights reserved.\n\ \n\ NOTE: This software has received contributions from various other\n\ contributors, only the core maintainers and supporters are listed as\n\ copyright holders. Please contact us, if you feel you should be listed\n\ as copyright holder, as well.\n\ "; const char *GetCopyrightInfo() { return CopyrightInfo; } static const char OtherCopyrightInfo[] = "\ NX protocol compression is derived from DXPC project.\n\ \n\ Copyright (c) 1995,1996 Brian Pane\n\ Copyright (c) 1996,1997 Zachary Vonler and Brian Pane\n\ Copyright (c) 1999 Kevin Vigor and Brian Pane\n\ Copyright (c) 2000,2003 Gian Filippo Pinzari and Brian Pane\n\ \n\ All rights reserved.\n\ "; const char *GetOtherCopyrightInfo() { return OtherCopyrightInfo; } int _hostBigEndian = 0; int _storeBigEndian = 0; const unsigned int IntMask[33] = { 0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff }; unsigned int GetUINT(unsigned const char *buffer, int bigEndian) { // // It doesn't work on SPARCs if the buffer // is not aligned to the word boundary. We // should check the CPU, not the OS as this // surely applies to other architectures. // #ifndef __sun if (_hostBigEndian == bigEndian) { return *((unsigned short *) buffer); } #else if (_hostBigEndian == bigEndian && ((unsigned int) buffer) & 0x1 == 0) { return *((unsigned short *) buffer); } #endif unsigned int result; if (bigEndian) { result = *buffer; result <<= 8; result += buffer[1]; } else { result = buffer[1]; result <<= 8; result += *buffer; } return result; } unsigned int GetULONG(unsigned const char *buffer, int bigEndian) { // // It doesn't work on SPARCs if the buffer // is not aligned to word the boundary. // #ifndef __sun if (_hostBigEndian == bigEndian) { return *((unsigned int *) buffer); } #else if (_hostBigEndian == bigEndian && ((unsigned int) buffer) & 0x3 == 0) { return *((unsigned int *) buffer); } #endif const unsigned char *next = (bigEndian ? buffer : buffer + 3); unsigned int result = 0; for (int i = 0; i < 4; i++) { result <<= 8; result += *next; if (bigEndian) { next++; } else { next--; } } return result; } void PutUINT(unsigned int value, unsigned char *buffer, int bigEndian) { if (_hostBigEndian == bigEndian) { *((unsigned short *) buffer) = value; return; } if (bigEndian) { buffer[1] = (unsigned char) (value & 0xff); value >>= 8; *buffer = (unsigned char) value; } else { *buffer = (unsigned char) (value & 0xff); value >>= 8; buffer[1] = (unsigned char) value; } } void PutULONG(unsigned int value, unsigned char *buffer, int bigEndian) { if (_hostBigEndian == bigEndian) { *((unsigned int *) buffer) = value; return; } if (bigEndian) { buffer += 3; for (int i = 4; i > 0; i--) { *buffer-- = (unsigned char) (value & 0xff); value >>= 8; } } else { for (int i = 4; i > 0; i--) { *buffer++ = (unsigned char) (value & 0xff); value >>= 8; } } } int CheckData(istream *fs) { if (fs == NULL || fs -> fail()) { return -1; } return 1; } int CheckData(ostream *fs) { if (fs == NULL || fs -> fail()) { return -1; } return 1; } int PutData(ostream *fs, const unsigned char *buffer, int size) { fs -> write((char *) buffer, size); #ifdef DEBUG *logofs << "PutData: Written " << size << " bytes with eof " << fs -> eof() << " fail " << fs -> fail() << " and bad " << fs -> bad() << ".\n" << logofs_flush; #endif if (fs -> fail()) { return -1; } return size; } int GetData(istream *fs, unsigned char *buffer, int size) { fs -> read((char *) buffer, size); #ifdef DEBUG *logofs << "GetData: Read " << size << " bytes with eof " << fs -> eof() << " fail " << fs -> fail() << " and bad " << fs -> bad() << ".\n" << logofs_flush; #endif #ifdef __APPLE__ if (fs -> bad()) { return -1; } #else if (fs -> fail()) { return -1; } #endif return size; } int FlushData(ostream *fs) { fs -> flush(); if (fs -> fail()) { return -1; } return 1; } unsigned int RoundUp2(unsigned int x) { unsigned int y = x / 2; y *= 2; if (y != x) { y += 2; } return y; } unsigned int RoundUp4(unsigned int x) { unsigned int y = x / 4; y *= 4; if (y != x) { y += 4; } return y; } unsigned int RoundUp8(unsigned int x) { unsigned int y = x / 8; y *= 8; if (y != x) { y += 8; } return y; } const char *DumpSignal(int signal) { switch (signal) { case SIGCHLD: { return "SIGCHLD"; } case SIGUSR1: { return "SIGUSR1"; } case SIGUSR2: { return "SIGUSR2"; } case SIGHUP: { return "SIGHUP"; } case SIGINT: { return "SIGINT"; } case SIGTERM: { return "SIGTERM"; } case SIGPIPE: { return "SIGPIPE"; } case SIGALRM: { return "SIGALRM"; } case SIGVTALRM: { return "SIGVTALRM"; } case SIGWINCH: { return "SIGWINCH"; } case SIGIO: { return "SIGIO"; } case SIGTSTP: { return "SIGTSTP"; } case SIGTTIN: { return "SIGTTIN"; } case SIGTTOU: { return "SIGTTOU"; } case SIGSEGV: { return "SIGSEGV"; } case SIGABRT: { return "SIGABRT"; } default: { return "Unknown"; } } } const char *DumpPolicy(int type) { switch ((T_flush_policy) type) { case policy_immediate: { return "immediate"; } case policy_deferred: { return "deferred"; } default: { #ifdef PANIC *logofs << "Misc: PANIC! Unknown policy type '" << type << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Unknown policy type '" << type << "'.\n"; HandleCleanup(); } } } const char *DumpAction(int type) { T_store_action action = (T_store_action) type; if (action == IS_HIT) { return "is_hit"; } else if (action == IS_ADDED) { return "is_added"; } else if (action == is_discarded) { return "is_discarded"; } else if (action == is_removed) { return "is_removed"; } else { #ifdef PANIC *logofs << "Misc: PANIC! Unknown store action '" << type << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Unknown store action '" << type << "'.\n"; HandleCleanup(); } } const char *DumpState(int type) { switch ((T_split_state) type) { case split_added: { return "split_added"; } case split_missed: { return "split_missed"; } case split_loaded: { return "split_loaded"; } case split_aborted: { return "split_aborted"; } case split_notified: { return "split_notified"; } default: { #ifdef PANIC *logofs << "Misc: PANIC! Unknown split state '" << type << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Unknown split state '" << type << "'.\n"; HandleCleanup(); } } } const char *DumpControl(int code) { switch ((T_proxy_code) code) { case code_new_x_connection: { return "code_new_x_connection"; } case code_new_cups_connection: { return "code_new_cups_connection"; } case code_new_aux_connection: { return "code_new_aux_connection"; } case code_new_smb_connection: { return "code_new_smb_connection"; } case code_new_media_connection: { return "code_new_media_connection"; } case code_switch_connection: { return "code_switch_connection"; } case code_drop_connection: { return "code_drop_connection"; } case code_finish_connection: { return "code_finish_connection"; } case code_begin_congestion: { return "code_begin_congestion"; } case code_end_congestion: { return "code_end_congestion"; } case code_alert_request: { return "code_alert_request"; } case code_alert_reply: { return "code_alert_reply"; } case code_reset_request: { return "code_reset_request"; } case code_reset_reply: { return "code_reset_reply"; } case code_load_request: { return "code_load_request"; } case code_load_reply: { return "code_load_reply"; } case code_save_request: { return "code_save_request"; } case code_save_reply: { return "code_save_reply"; } case code_shutdown_request: { return "code_shutdown_request"; } case code_shutdown_reply: { return "code_shutdown_reply"; } case code_control_token_request: { return "code_control_token_request"; } case code_control_token_reply: { return "code_control_token_reply"; } case code_configuration_request: { return "code_configuration_request"; } case code_configuration_reply: { return "code_configuration_reply"; } case code_statistics_request: { return "code_statistics_request"; } case code_statistics_reply: { return "code_statistics_reply"; } case code_new_http_connection: { return "code_new_http_connection"; } case code_sync_request: { return "code_sync_request"; } case code_sync_reply: { return "code_sync_reply"; } case code_new_font_connection: { return "code_new_font_connection"; } case code_new_slave_connection: { return "code_new_slave_connection"; } case code_finish_listeners: { return "code_finish_listeners"; } case code_split_token_request: { return "code_split_token_request"; } case code_split_token_reply: { return "code_split_token_reply"; } case code_data_token_request: { return "code_data_token_request"; } case code_data_token_reply: { return "code_data_token_reply"; } default: { #ifdef WARNING *logofs << "Misc: WARNING! Unknown control code '" << code << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Unknown control code '" << code << "'.\n"; return "unknown"; } } } const char *DumpSession(int code) { switch ((T_session_mode) code) { case session_agent: { return "session_agent"; } case session_shadow: { return "session_shadow"; } case session_proxy: { return "session_proxy"; } default: { #ifdef WARNING *logofs << "Misc: WARNING! Unknown session type '" << code << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Unknown session type '" << code << "'.\n"; return "unknown"; } } } const char *DumpToken(int type) { switch ((T_token_type) type) { case token_control: { return "token_control"; } case token_split: { return "token_split"; } case token_data: { return "token_data"; } default: { #ifdef WARNING *logofs << "Misc: WARNING! Unknown token type '" << type << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Unknown token type '" << type << "'.\n"; return "unknown"; } } } // // Always include this in code as it is generally // needed to test channels and split store. // const char *DumpChecksum(const void *checksum) { static char string[MD5_LENGTH * 2 + 1]; if (checksum != NULL) { for (unsigned int i = 0; i < MD5_LENGTH; i++) { sprintf(string + (i * 2), "%02X", ((unsigned char *) checksum)[i]); } } else { strcpy(string, "null"); } return string; } // // Define OPCODES here and in the channel // if you want to log the opcode literal. // #ifdef OPCODES const char *DumpOpcode(const int &opcode) { switch (opcode) { case X_CreateWindow: { return "X_CreateWindow"; } case X_ChangeWindowAttributes: { return "X_ChangeWindowAttributes"; } case X_GetWindowAttributes: { return "X_GetWindowAttributes"; } case X_DestroyWindow: { return "X_DestroyWindow"; } case X_DestroySubwindows: { return "X_DestroySubwindows"; } case X_ChangeSaveSet: { return "X_ChangeSaveSet"; } case X_ReparentWindow: { return "X_ReparentWindow"; } case X_MapWindow: { return "X_MapWindow"; } case X_MapSubwindows: { return "X_MapSubwindows"; } case X_UnmapWindow: { return "X_UnmapWindow"; } case X_UnmapSubwindows: { return "X_UnmapSubwindows"; } case X_ConfigureWindow: { return "X_ConfigureWindow"; } case X_CirculateWindow: { return "X_CirculateWindow"; } case X_GetGeometry: { return "X_GetGeometry"; } case X_QueryTree: { return "X_QueryTree"; } case X_InternAtom: { return "X_InternAtom"; } case X_GetAtomName: { return "X_GetAtomName"; } case X_ChangeProperty: { return "X_ChangeProperty"; } case X_DeleteProperty: { return "X_DeleteProperty"; } case X_GetProperty: { return "X_GetProperty"; } case X_ListProperties: { return "X_ListProperties"; } case X_SetSelectionOwner: { return "X_SetSelectionOwner"; } case X_GetSelectionOwner: { return "X_GetSelectionOwner"; } case X_ConvertSelection: { return "X_ConvertSelection"; } case X_SendEvent: { return "X_SendEvent"; } case X_GrabPointer: { return "X_GrabPointer"; } case X_UngrabPointer: { return "X_UngrabPointer"; } case X_GrabButton: { return "X_GrabButton"; } case X_UngrabButton: { return "X_UngrabButton"; } case X_ChangeActivePointerGrab: { return "X_ChangeActivePointerGrab"; } case X_GrabKeyboard: { return "X_GrabKeyboard"; } case X_UngrabKeyboard: { return "X_UngrabKeyboard"; } case X_GrabKey: { return "X_GrabKey"; } case X_UngrabKey: { return "X_UngrabKey"; } case X_AllowEvents: { return "X_AllowEvents"; } case X_GrabServer: { return "X_GrabServer"; } case X_UngrabServer: { return "X_UngrabServer"; } case X_QueryPointer: { return "X_QueryPointer"; } case X_GetMotionEvents: { return "X_GetMotionEvents"; } case X_TranslateCoords: { return "X_TranslateCoords"; } case X_WarpPointer: { return "X_WarpPointer"; } case X_SetInputFocus: { return "X_SetInputFocus"; } case X_GetInputFocus: { return "X_GetInputFocus"; } case X_QueryKeymap: { return "X_QueryKeymap"; } case X_OpenFont: { return "X_OpenFont"; } case X_CloseFont: { return "X_CloseFont"; } case X_QueryFont: { return "X_QueryFont"; } case X_QueryTextExtents: { return "X_QueryTextExtents"; } case X_ListFonts: { return "X_ListFonts"; } case X_ListFontsWithInfo: { return "X_ListFontsWithInfo"; } case X_SetFontPath: { return "X_SetFontPath"; } case X_GetFontPath: { return "X_GetFontPath"; } case X_CreatePixmap: { return "X_CreatePixmap"; } case X_FreePixmap: { return "X_FreePixmap"; } case X_CreateGC: { return "X_CreateGC"; } case X_ChangeGC: { return "X_ChangeGC"; } case X_CopyGC: { return "X_CopyGC"; } case X_SetDashes: { return "X_SetDashes"; } case X_SetClipRectangles: { return "X_SetClipRectangles"; } case X_FreeGC: { return "X_FreeGC"; } case X_ClearArea: { return "X_ClearArea"; } case X_CopyArea: { return "X_CopyArea"; } case X_CopyPlane: { return "X_CopyPlane"; } case X_PolyPoint: { return "X_PolyPoint"; } case X_PolyLine: { return "X_PolyLine"; } case X_PolySegment: { return "X_PolySegment"; } case X_PolyRectangle: { return "X_PolyRectangle"; } case X_PolyArc: { return "X_PolyArc"; } case X_FillPoly: { return "X_FillPoly"; } case X_PolyFillRectangle: { return "X_PolyFillRectangle"; } case X_PolyFillArc: { return "X_PolyFillArc"; } case X_PutImage: { return "X_PutImage"; } case X_GetImage: { return "X_GetImage"; } case X_PolyText8: { return "X_PolyText8"; } case X_PolyText16: { return "X_PolyText16"; } case X_ImageText8: { return "X_ImageText8"; } case X_ImageText16: { return "X_ImageText16"; } case X_CreateColormap: { return "X_CreateColormap"; } case X_FreeColormap: { return "X_FreeColormap"; } case X_CopyColormapAndFree: { return "X_CopyColormapAndFree"; } case X_InstallColormap: { return "X_InstallColormap"; } case X_UninstallColormap: { return "X_UninstallColormap"; } case X_ListInstalledColormaps: { return "X_ListInstalledColormaps"; } case X_AllocColor: { return "X_AllocColor"; } case X_AllocNamedColor: { return "X_AllocNamedColor"; } case X_AllocColorCells: { return "X_AllocColorCells"; } case X_AllocColorPlanes: { return "X_AllocColorPlanes"; } case X_FreeColors: { return "X_FreeColors"; } case X_StoreColors: { return "X_StoreColors"; } case X_StoreNamedColor: { return "X_StoreNamedColor"; } case X_QueryColors: { return "X_QueryColors"; } case X_LookupColor: { return "X_LookupColor"; } case X_CreateCursor: { return "X_CreateCursor"; } case X_CreateGlyphCursor: { return "X_CreateGlyphCursor"; } case X_FreeCursor: { return "X_FreeCursor"; } case X_RecolorCursor: { return "X_RecolorCursor"; } case X_QueryBestSize: { return "X_QueryBestSize"; } case X_QueryExtension: { return "X_QueryExtension"; } case X_ListExtensions: { return "X_ListExtensions"; } case X_ChangeKeyboardMapping: { return "X_ChangeKeyboardMapping"; } case X_GetKeyboardMapping: { return "X_GetKeyboardMapping"; } case X_ChangeKeyboardControl: { return "X_ChangeKeyboardControl"; } case X_GetKeyboardControl: { return "X_GetKeyboardControl"; } case X_Bell: { return "X_Bell"; } case X_ChangePointerControl: { return "X_ChangePointerControl"; } case X_GetPointerControl: { return "X_GetPointerControl"; } case X_SetScreenSaver: { return "X_SetScreenSaver"; } case X_GetScreenSaver: { return "X_GetScreenSaver"; } case X_ChangeHosts: { return "X_ChangeHosts"; } case X_ListHosts: { return "X_ListHosts"; } case X_SetAccessControl: { return "X_SetAccessControl"; } case X_SetCloseDownMode: { return "X_SetCloseDownMode"; } case X_KillClient: { return "X_KillClient"; } case X_RotateProperties: { return "X_RotateProperties"; } case X_ForceScreenSaver: { return "X_ForceScreenSaver"; } case X_SetPointerMapping: { return "X_SetPointerMapping"; } case X_GetPointerMapping: { return "X_GetPointerMapping"; } case X_SetModifierMapping: { return "X_SetModifierMapping"; } case X_GetModifierMapping: { return "X_GetModifierMapping"; } case X_NoOperation: { return "X_NoOperation"; } case X_NXInternalGenericData: { return "X_NXInternalGenericData"; } // // case X_NXInternalGenericReply: // { // return "X_NXInternalGenericReply"; // } // case X_NXInternalGenericRequest: { return "X_NXInternalGenericRequest"; } case X_NXInternalShapeExtension: { return "X_NXInternalShapeExtension"; } case X_NXGetControlParameters: { return "X_NXGetControlParameters"; } case X_NXGetCleanupParameters: { return "X_NXGetCleanupParameters"; } case X_NXGetImageParameters: { return "X_NXGetImageParameters"; } case X_NXGetUnpackParameters: { return "X_NXGetUnpackParameters"; } case X_NXGetShmemParameters: { return "X_NXGetShmemParameters"; } case X_NXGetFontParameters: { return "X_NXGetFontParameters"; } case X_NXSetExposeParameters: { return "X_NXSetExposeParameters"; } case X_NXSetCacheParameters: { return "X_NXSetCacheParameters"; } case X_NXStartSplit: { return "X_NXStartSplit"; } case X_NXEndSplit: { return "X_NXEndSplit"; } case X_NXSplitData: { return "X_NXSplitData"; } case X_NXSplitEvent: { return "X_NXSplitEvent"; } case X_NXCommitSplit: { return "X_NXCommitSplit"; } case X_NXFinishSplit: { return "X_NXFinishSplit"; } case X_NXAbortSplit: { return "X_NXAbortSplit"; } case X_NXFreeSplit: { return "X_NXFreeSplit"; } case X_NXSetUnpackGeometry: { return "X_NXSetUnpackGeometry"; } case X_NXSetUnpackColormap: { return "X_NXSetUnpackColormap"; } case X_NXSetUnpackAlpha: { return "X_NXSetUnpackAlpha"; } case X_NXPutPackedImage: { return "X_NXPutPackedImage"; } case X_NXFreeUnpack: { return "X_NXFreeUnpack"; } default: { if (opcode > 127) { return "Extension"; } else { return "?"; } } } } #else /* #ifdef OPCODES */ const char *DumpOpcode(const int &opcode) { return "?"; } #endif /* #ifdef OPCODES */ void DumpData(const unsigned char *buffer, unsigned int size) { if (buffer != NULL) { unsigned int i = 0; while (i < size) { *logofs << "[" << i << "]\t"; for (unsigned int ii = 0; i < size && ii < 8; i++, ii++) { *logofs << (unsigned int) (buffer[i]) << "\t"; } *logofs << "\n" << logofs_flush; } } } void DumpChecksum(const unsigned char *buffer, unsigned int size) { if (buffer != NULL) { md5_byte_t md5_digest[MD5_LENGTH]; md5_state_t md5_state; md5_init(&md5_state); md5_append(&md5_state, buffer, size); md5_finish(&md5_state, md5_digest); char md5_string[MD5_LENGTH * 2 + 1]; for (unsigned int i = 0; i < MD5_LENGTH; i++) { sprintf(md5_string + (i * 2), "%02X", md5_digest[i]); } *logofs << "[" << md5_string << "]" << logofs_flush; } } void DumpBlockChecksums(const unsigned char *buffer, unsigned int size, unsigned int block) { for (unsigned int i = 0; i < (size / block); i++) { *logofs << "[" << i * block << "]"; DumpChecksum(buffer + (i * block), block); *logofs << "\n"; } if (size % block > 0) { *logofs << "[" << size / block * block << "]"; DumpChecksum(buffer + (size / block * block), size % block); *logofs << "\n"; } } void DumpHexData(const unsigned char *buffer, unsigned int size) { char message [65536]; char ascii [17]; unsigned int index = 0; unsigned int linescan = 0; unsigned int index_ascii = 0; sprintf (message,"\n#### Start Dump Buffer of [%.5d] Bytes ####\n\n",size); *logofs << message << logofs_flush; // // "Index 0 1 2 3 4 5 6 7 8 9 a b c d e f Ascii " // "----- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ----------------" // "00000 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................" // sprintf (message,"Index 0 1 2 3 4 5 6 7 8 9 a b c d e f Ascii \n"); *logofs << message << logofs_flush; sprintf (message,"----- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ----------------\n"); *logofs << message << logofs_flush; index = 0; while (index < size) { memset (ascii, ' ', sizeof(ascii)); ascii[16] = '\0'; sprintf (message,"%.5d ", index); for (index_ascii = 0, linescan = index; ((index < (linescan + 16)) && (index < size)); index++, index_ascii++) { if (isprint(buffer [index])) { ascii[index_ascii] = buffer [index]; } else { ascii[index_ascii] = '.'; } sprintf (&message [strlen (message)],"%.2x ", (unsigned char) buffer [index]); } for (linescan = index_ascii; linescan < 16; linescan++) { strcat (&message [strlen (message)], " "); } sprintf (&message [strlen (message)]," %s\n", ascii); *logofs << message << logofs_flush; } sprintf (message,"\n#### End Dump Buffer ####\n\n"); *logofs << message << logofs_flush; } nx-libs-3.5.99.23/nxcomp/src/Misc.h0000644000000000000000000001534013614532331013451 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Misc_H #define Misc_H #include #include #include #include #ifdef __sun #include #endif using namespace std; // // This is MD5 length. // #define MD5_LENGTH 16 // // Error handling macros. // #define ESET(e) (errno = (e)) #define EGET() (errno) #define ESTR() strerror(errno) // a free() macro that clears the ptr after free #define SAFE_FREE(ptr) do { free(ptr); ptr = NULL; } while (0) // // TCP port offset applied to NX port specification. // extern const int DEFAULT_NX_PROXY_PORT_OFFSET; // // Default TCP port used by client proxy to listen // to X clients and by server proxy to connect to // remote. // extern const int DEFAULT_NX_PROXY_PORT; // // Default X display number that client // proxy imitates. // extern const int DEFAULT_NX_X_PORT; // // Establish the port offsets for the additional // services. // extern const int DEFAULT_NX_CUPS_PORT_OFFSET; extern const int DEFAULT_NX_SMB_PORT_OFFSET; extern const int DEFAULT_NX_MEDIA_PORT_OFFSET; extern const int DEFAULT_NX_AUX_PORT_OFFSET; extern const int DEFAULT_NX_HTTP_PORT_OFFSET; extern const int DEFAULT_NX_FONT_PORT_OFFSET; // // Slave channels can be originated by both sides // so they need to have different port offsets // in the case the user runs both proxies on the // same host. // extern const int DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET; extern const int DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET; // // NX proxy binds to all network interfaces by default // With the -loopback parameter, you can switch // over to binding to the loopback device only. // extern const int DEFAULT_LOOPBACK_BIND; // // Return strings containing various info. // const char *GetUsageInfo(); const char *GetCopyrightInfo(); const char *GetOtherCopyrightInfo(); // // Define this if you want immediate flush of // the log output. // #define FLUSH_LOGOFS // // Global objects providing shared functions. // class Auth; class Control; class Statistics; extern Auth *auth; extern Control *control; extern Statistics *statistics; // // Log file. // extern ostream *logofs; // // Cleanup code. // void HandleAbort() __attribute__((noreturn)); void HandleShutdown() __attribute__((noreturn)); extern "C" { void HandleCleanup(int code = 0) __attribute__((noreturn)); void HandleCleanupForReconnect(); } // // Manage signal handlers. // void DisableSignals(); void EnableSignals(); // // Manage timers. // void SetTimer(int value); void ResetTimer(); // // Show a dialog asking the user if he/she // wants to close the current session. Look // in the alerts file for the known critical // events. // void HandleAlert(int code, int local); // // Run the callback registered by the proxy // or the agent. // void KeeperCallback(); void FlushCallback(int length); // // Return the string literal corresponding // the value. // const char *DumpSignal(int signal); const char *DumpPolicy(int type); const char *DumpControl(int code); const char *DumpSession(int code); const char *DumpAction(int type); const char *DumpState(int type); const char *DumpToken(int type); // // Print out content of buffer to log file. // You need to define DUMP or OPCODES in // the source to have these compiled. // const char *DumpOpcode(const int &opcode); const char *DumpChecksum(const void *checksum); void DumpData(const unsigned char *data, unsigned int length); void DumpHexData(const unsigned char *data, unsigned int length); void DumpChecksum(const unsigned char *data, unsigned int length); void DumpBlockChecksums(const unsigned char *data, unsigned int length, unsigned int block); // // Defines logofs_flush as an empty string to // avoid calling the corresponding ostream's // flush() function. // #ifdef FLUSH_LOGOFS #define logofs_flush "" ; logofs -> flush() #else #define logofs_flush "" #endif // // Is the host where local proxy is running // big-endian? // extern int _hostBigEndian; extern int _storeBigEndian; inline void setHostBigEndian(int flag) { _hostBigEndian = flag; } inline int hostBigEndian() { return _hostBigEndian; } inline int storeBigEndian() { return _storeBigEndian; } extern const unsigned int IntMask[33]; unsigned int GetUINT(unsigned const char *buffer, int bigEndian); unsigned int GetULONG(unsigned const char *buffer, int bigEndian); void PutUINT(unsigned int value, unsigned char *buffer, int bigEndian); void PutULONG(unsigned int value, unsigned char *buffer, int bigEndian); inline void CleanData(unsigned char *buffer, int size) { unsigned char *end = buffer + size; while (buffer < end) { *buffer++ = 0x00; } } int CheckData(istream *fs); int CheckData(ostream *fs); int PutData(ostream *fs, const unsigned char *buffer, int size); int GetData(istream *fs, unsigned char *buffer, int size); int FlushData(ostream *fs); unsigned int RoundUp2(unsigned int x); unsigned int RoundUp4(unsigned int x); unsigned int RoundUp8(unsigned int x); #endif /* Misc_H */ nx-libs-3.5.99.23/nxcomp/src/NXmitshm.h0000644000000000000000000000455113614532331014327 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef NXmitshm_H #define NXmitshm_H #ifdef __cplusplus extern "C" { #endif /* * Import opcodes from * to get rid of weird dependencies from other * headers of X environment. */ #define X_ShmQueryVersion 0 #define X_ShmAttach 1 #define X_ShmDetach 2 #define X_ShmPutImage 3 #define X_ShmGetImage 4 #define X_ShmCreatePixmap 5 #define ShmCompletion 0 #define ShmNumberEvents (ShmCompletion + 1) #define BadShmSeg 0 #define ShmNumberErrors (BadShmSeg + 1) #ifdef __cplusplus } #endif #endif /* NXmitshm_H */ nx-libs-3.5.99.23/nxcomp/src/NXrender.h0000644000000000000000000000643313614532331014306 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef NXrender_H #define NXrender_H #ifdef __cplusplus extern "C" { #endif /* * Import this from * to compile under old XFree86 distributions * when render extension was not present yet. */ #define X_RenderQueryVersion 0 #define X_RenderQueryPictFormats 1 #define X_RenderQueryPictIndexValues 2 #define X_RenderQueryDithers 3 #define X_RenderCreatePicture 4 #define X_RenderChangePicture 5 #define X_RenderSetPictureClipRectangles 6 #define X_RenderFreePicture 7 #define X_RenderComposite 8 #define X_RenderScale 9 #define X_RenderTrapezoids 10 #define X_RenderTriangles 11 #define X_RenderTriStrip 12 #define X_RenderTriFan 13 #define X_RenderColorTrapezoids 14 #define X_RenderColorTriangles 15 #define X_RenderTransform 16 #define X_RenderCreateGlyphSet 17 #define X_RenderReferenceGlyphSet 18 #define X_RenderFreeGlyphSet 19 #define X_RenderAddGlyphs 20 #define X_RenderAddGlyphsFromPicture 21 #define X_RenderFreeGlyphs 22 #define X_RenderCompositeGlyphs8 23 #define X_RenderCompositeGlyphs16 24 #define X_RenderCompositeGlyphs32 25 #define X_RenderFillRectangles 26 /* 0.5 */ #define X_RenderCreateCursor 27 /* 0.6 */ #define X_RenderSetPictureTransform 28 #define X_RenderQueryFilters 29 #define X_RenderSetPictureFilter 30 #define X_RenderCreateAnimCursor 31 #ifdef __cplusplus } #endif #endif /* NXrender_H */ nx-libs-3.5.99.23/nxcomp/src/OpcodeCache.h0000644000000000000000000000416613614532331014717 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef OpcodeCache_H #define OpcodeCache_H #include "CharCache.h" class OpcodeCache { friend class EncodeBuffer; friend class DecodeBuffer; public: OpcodeCache() { slot_ = 0; } ~OpcodeCache() { } private: CharCache base_[256]; unsigned char slot_; }; #endif /* OpcodeCache_H */ nx-libs-3.5.99.23/nxcomp/src/OpcodeStore.cpp0000644000000000000000000000631213614532331015336 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "OpcodeStore.h" OpcodeStore::OpcodeStore() { // // Assign values of the specific // NX opcodes. // getControlParameters = X_NXGetControlParameters; getCleanupParameters = X_NXGetCleanupParameters; getImageParameters = X_NXGetImageParameters; getUnpackParameters = X_NXGetUnpackParameters; getShmemParameters = X_NXGetShmemParameters; getFontParameters = X_NXGetFontParameters; startSplit = X_NXStartSplit; endSplit = X_NXEndSplit; commitSplit = X_NXCommitSplit; finishSplit = X_NXFinishSplit; abortSplit = X_NXAbortSplit; splitData = X_NXSplitData; splitEvent = X_NXSplitEvent; setCacheParameters = X_NXSetCacheParameters; setExposeParameters = X_NXSetExposeParameters; setUnpackGeometry = X_NXSetUnpackGeometry; setUnpackColormap = X_NXSetUnpackColormap; setUnpackAlpha = X_NXSetUnpackAlpha; putPackedImage = X_NXPutPackedImage; freeUnpack = X_NXFreeUnpack; freeSplit = X_NXFreeSplit; // // These values must be fetched // from the X server. // shapeExtension = 0; renderExtension = 0; // // Events sent as ClientMessage. // noSplitNotify = NXNoSplitNotify; startSplitNotify = NXStartSplitNotify; commitSplitNotify = NXCommitSplitNotify; endSplitNotify = NXEndSplitNotify; emptySplitNotify = NXEmptySplitNotify; } OpcodeStore::~OpcodeStore() { } nx-libs-3.5.99.23/nxcomp/src/OpcodeStore.h0000644000000000000000000000670013614532331015004 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef OpcodeStore_H #define OpcodeStore_H #include "NXproto.h" class OpcodeStore { public: OpcodeStore(); ~OpcodeStore(); // // Map NX protocol messages. At the moment mapping is hard- // coded. Opcodes should be instead agreed with the proxied // X server (by excluding all opcodes used for extensions) // and exported by the proxy class to channels. // // Some toolkits query the server only once for extensions' // opcodes and share the same settings across all channels. // This could be a problem as channels needed to monitor the // traffic to find out the extensions' opcodes themselves, // so it is important that proxy passes an instance of this // class to new channels. // unsigned char getControlParameters; unsigned char getCleanupParameters; unsigned char getImageParameters; unsigned char getUnpackParameters; unsigned char getShmemParameters; unsigned char getFontParameters; unsigned char startSplit; unsigned char endSplit; unsigned char commitSplit; unsigned char finishSplit; unsigned char abortSplit; unsigned char splitData; unsigned char splitEvent; unsigned char setCacheParameters; unsigned char setExposeParameters; unsigned char setUnpackGeometry; unsigned char setUnpackColormap; unsigned char setUnpackAlpha; unsigned char putPackedImage; unsigned char freeUnpack; unsigned char freeSplit; unsigned char shapeExtension; unsigned char renderExtension; unsigned char noSplitNotify; unsigned char startSplitNotify; unsigned char commitSplitNotify; unsigned char endSplitNotify; unsigned char emptySplitNotify; }; #endif /* OpcodeStore_H */ nx-libs-3.5.99.23/nxcomp/src/Pack.c0000644000000000000000000001137513614532331013433 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #define PANIC #define WARNING #undef TEST #undef DEBUG #ifdef __cplusplus extern "C" { #endif #include #include "NXpack.h" const ColorMask Mask8TrueColor = { 128, 63, 240, 7 }; const ColorMask Mask64TrueColor = { 192, 7, 240, 4 }; const ColorMask Mask256TrueColor = { 255, 0, 255, 0 }; const ColorMask Mask512TrueColor = { 224, 5, 240, 4 }; const ColorMask Mask4KTrueColor = { 240, 4, 240, 2 }; const ColorMask Mask32KTrueColor = { 248, 3, 248, 2 }; const ColorMask Mask64KTrueColor = { 255, 0, 255, 0 }; const ColorMask Mask256KTrueColor = { 252, 1, 252, 1 }; const ColorMask Mask2MTrueColor = { 255, 0, 254, 1 }; const ColorMask Mask16MTrueColor = { 255, 0, 255, 0 }; const ColorMask *MethodColorMask(unsigned int method) { switch (method) { case MASK_8_COLORS: { return &Mask8TrueColor; } case MASK_64_COLORS: { return &Mask64TrueColor; } case MASK_256_COLORS: { return &Mask256TrueColor; } case MASK_512_COLORS: { return &Mask512TrueColor; } case MASK_4K_COLORS: { return &Mask4KTrueColor; } case MASK_32K_COLORS: { return &Mask32KTrueColor; } case MASK_64K_COLORS: { return &Mask64KTrueColor; } case MASK_256K_COLORS: { return &Mask256KTrueColor; } case MASK_2M_COLORS: { return &Mask2MTrueColor; } case MASK_16M_COLORS: { return &Mask16MTrueColor; } default: { return NULL; } } } int MethodBitsPerPixel(unsigned int method) { switch (method) { case PACK_MASKED_8_COLORS: case PACK_JPEG_8_COLORS: case PACK_PNG_8_COLORS: { return 8; } case PACK_MASKED_64_COLORS: case PACK_JPEG_64_COLORS: case PACK_PNG_64_COLORS: { return 8; } case PACK_MASKED_256_COLORS: case PACK_JPEG_256_COLORS: case PACK_PNG_256_COLORS: { return 8; } case PACK_MASKED_512_COLORS: case PACK_JPEG_512_COLORS: case PACK_PNG_512_COLORS: { return 16; } case PACK_MASKED_4K_COLORS: case PACK_JPEG_4K_COLORS: case PACK_PNG_4K_COLORS: { return 16; } case PACK_MASKED_32K_COLORS: case PACK_JPEG_32K_COLORS: case PACK_PNG_32K_COLORS: { return 16; } case PACK_MASKED_64K_COLORS: case PACK_JPEG_64K_COLORS: case PACK_PNG_64K_COLORS: { return 16; } case PACK_MASKED_256K_COLORS: case PACK_JPEG_256K_COLORS: case PACK_PNG_256K_COLORS: { return 24; } case PACK_MASKED_2M_COLORS: case PACK_JPEG_2M_COLORS: case PACK_PNG_2M_COLORS: { return 24; } case PACK_MASKED_16M_COLORS: case PACK_JPEG_16M_COLORS: case PACK_PNG_16M_COLORS: { return 24; } case PACK_BITMAP_16M_COLORS: case PACK_RGB_16M_COLORS: case PACK_RLE_16M_COLORS: { return 24; } default: { return 0; } } } #ifdef __cplusplus } #endif nx-libs-3.5.99.23/nxcomp/src/Pgn.cpp0000644000000000000000000004423513614532331013642 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif // // This file obviously supports PNG // decompression. It was renamed to // avoid name clashes on Windows. // #include #ifdef ANDROID #include #endif #include #include #include #include "Unpack.h" #include "Pgn.h" #define PANIC #define WARNING #undef TEST #undef DEBUG #define RGB24_TO_PIXEL(bpp,r,g,b) \ ((((CARD##bpp)(r) & 0xFF) * srcRedMax2 + 127) / 255 \ << srcRedShift2 | \ (((CARD##bpp)(g) & 0xFF) * srcGreenMax2 + 127) / 255 \ << srcGreenShift2 | \ (((CARD##bpp)(b) & 0xFF) * srcBlueMax2 + 127) / 255 \ << srcBlueShift2) #define RGB24_TO_PIXEL32(r,g,b) \ (((CARD32)(r) & 0xFF) << srcRedShift2 | \ ((CARD32)(g) & 0xFF) << srcGreenShift2 | \ ((CARD32)(b) & 0xFF) << srcBlueShift2) // // Functions from Unpack.cpp // extern int Unpack32To32(const T_colormask *colormask, const unsigned int *data, unsigned int *out, unsigned int *end); extern int Unpack24To24(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); extern int Unpack16To16(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); // // Local functions used for the png decompression. // static int DecompressPng16(unsigned char *compressedData, int compressedLen, unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder); static int DecompressPng24(unsigned char *compressedData, int compressedLen, unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder); static int DecompressPng32(unsigned char *compressedData, int compressedLen, unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder); static void PngReadData(png_structp png_ptr, png_bytep data, png_size_t length); // // Colormap stuff. // CARD16 srcRedMax2, srcGreenMax2, srcBlueMax2; CARD8 srcRedShift2, srcGreenShift2, srcBlueShift2; // // Attributes used for the png decompression. // static char *tmpBuf; static int tmpBufSize = 0; static int streamPos; int UnpackPng(T_geometry *geometry, unsigned char method, unsigned char *srcData, int srcSize, int dstBpp, int dstWidth, int dstHeight, unsigned char *dstData, int dstSize) { int byteOrder = geometry -> image_byte_order; // // Check if data is coming from a failed unsplit. // if (srcSize < 2 || (srcData[0] == SPLIT_PATTERN && srcData[1] == SPLIT_PATTERN)) { #ifdef WARNING *logofs << "UnpackPng: WARNING! Skipping unpack of dummy data.\n" << logofs_flush; #endif return -1; } #ifdef DEBUG *logofs << "UnpackPng: Decompressing image with " << "srcSize " << srcSize << " and bpp " << dstBpp << ".\n" << logofs_flush; #endif srcRedShift2 = ffs(geometry -> red_mask) - 1; srcGreenShift2 = ffs(geometry -> green_mask) - 1; srcBlueShift2 = ffs(geometry -> blue_mask) - 1; srcRedMax2 = geometry -> red_mask >> srcRedShift2; srcGreenMax2 = geometry -> green_mask >> srcGreenShift2; srcBlueMax2 = geometry -> blue_mask >> srcBlueShift2; // // Make enough space in the temporary // buffer to have one complete row of // the image with 3 bytes per pixel. // tmpBufSize = dstWidth * 3; tmpBuf = new char [tmpBufSize]; if (tmpBuf == NULL) { #ifdef PANIC *logofs << "UnpackPng: PANIC! Cannot allocate " << dstWidth * 3 << " bytes for PNG " << "decompressed data.\n" << logofs_flush; #endif delete [] tmpBuf; return -1; } int result = 1; switch (dstBpp) { case 8: { // // Simply move the data from srcData to dstData // taking into consideration the correct padding. // int row; unsigned char * dstBuff = dstData; unsigned char * srcBuff = srcData; for (row = 0; row < dstHeight; row++) { memcpy(dstBuff, srcBuff, dstWidth ); dstBuff += RoundUp4(dstWidth); srcBuff += dstWidth; } } case 16: { result = DecompressPng16(srcData, srcSize, dstWidth, dstHeight, dstData, byteOrder); break; } case 24: { result = DecompressPng24(srcData, srcSize, dstWidth, dstHeight, dstData, byteOrder); break; } case 32: { result = DecompressPng32(srcData, srcSize, dstWidth, dstHeight, dstData, byteOrder); break; } default: { #ifdef PANIC *logofs << "UnpackPng: PANIC! Error in PNG compression. " << " Unsupported Bpp value " << dstBpp << " for the PNG compression" << ".\n" << logofs_flush; #endif delete [] tmpBuf; result = -1; } } if (result == -1) { delete [] tmpBuf; return result; } // // Apply the correction for the brightness // int maskMethod; switch (method) { case PACK_PNG_8_COLORS: { maskMethod = MASK_8_COLORS; break; } case PACK_PNG_64_COLORS: { maskMethod = MASK_64_COLORS; break; } case PACK_PNG_256_COLORS: { maskMethod = MASK_256_COLORS; break; } case PACK_PNG_512_COLORS: { maskMethod = MASK_512_COLORS; break; } case PACK_PNG_4K_COLORS: { maskMethod = MASK_4K_COLORS; break; } case PACK_PNG_32K_COLORS: { maskMethod = MASK_32K_COLORS; break; } case PACK_PNG_64K_COLORS: { maskMethod = MASK_64K_COLORS; break; } case PACK_PNG_256K_COLORS: { maskMethod = MASK_256K_COLORS; break; } case PACK_PNG_2M_COLORS: { maskMethod = MASK_2M_COLORS; break; } case PACK_PNG_16M_COLORS: { maskMethod = MASK_16M_COLORS; break; } default: { #ifdef PANIC *logofs << "DecompressPng16: PANIC! " << " No matching decompression method.\n" << logofs_flush; #endif delete [] tmpBuf; return -1; } } const T_colormask *colorMask = MethodColorMask(maskMethod); unsigned char *dstBuff = dstData; switch (dstBpp) { case 16: { Unpack16To16(colorMask, dstBuff, dstBuff, dstBuff + dstSize); break; } case 24: { break; } case 32: { Unpack32To32(colorMask, (unsigned int *)dstBuff, (unsigned int *)dstBuff, (unsigned int *)(dstBuff + dstSize)); break; } default: { #ifdef PANIC *logofs << "DecompressPng16: PANIC! " << " No matching destination bits per plane.\n" << logofs_flush; #endif delete [] tmpBuf; return -1; } } delete [] tmpBuf; return 1; } // // Functions that actually do // the PNG decompression. // int DecompressPng16(unsigned char *compressedData, int compressedLen, unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) { unsigned char *data; unsigned int dx, dy; png_structp pngPtr; png_infop infoPtr; png_bytep rowPointers; streamPos = 0; pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!pngPtr) { #ifdef PANIC *logofs << "DecompressPng16: PANIC! " << " Failed png_create_read_struct operation" << ".\n" << logofs_flush; #endif return -1; } infoPtr = png_create_info_struct(pngPtr); if (!infoPtr) { #ifdef PANIC *logofs << "DecompressPng16: PANIC! " << "Failed png_create_info_struct operation" << ".\n" << logofs_flush; #endif png_destroy_read_struct(&pngPtr, NULL, NULL); return -1; } if (setjmp(png_jmpbuf(pngPtr))) { #ifdef PANIC *logofs << "DecompressPng16: PANIC! " << "Error during IO initialization" << ".\n" << logofs_flush; #endif png_destroy_read_struct(&pngPtr, &infoPtr, NULL); return -1; } png_set_read_fn(pngPtr, (void *)compressedData, PngReadData); if (setjmp(png_jmpbuf(pngPtr))) { #ifdef PANIC *logofs << "DecompressPng16: PANIC! " << "Error during read of PNG header" << ".\n" << logofs_flush; #endif png_destroy_read_struct(&pngPtr, &infoPtr, NULL); return -1; } png_read_info(pngPtr, infoPtr); if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE) { png_set_expand(pngPtr); } // // data points to dstBuf which is // already padded correctly for the final // image to put // data = dstBuf; rowPointers = (png_byte *) tmpBuf; // // We use setjmp() to save our context. // The PNG library will call longjmp() // in case of error. // if (setjmp(png_jmpbuf(pngPtr))) { #ifdef PANIC *logofs << "DecompressPng16: PANIC! " << "Error during read of PNG rows" << ".\n" << logofs_flush; #endif png_destroy_read_struct(&pngPtr, &infoPtr, NULL); return -1; } unsigned long pixel; for (dy = 0; dy < h; dy++) { png_read_row(pngPtr, rowPointers, NULL); for (dx = 0; dx < w; dx++) { pixel = RGB24_TO_PIXEL(16, tmpBuf[dx*3], tmpBuf[dx*3+1], tmpBuf[dx*3+2]); // // Follow the server byte order when arranging data. // if (byteOrder == LSBFirst) { data[0] = (unsigned char) (pixel & 0xff); data[1] = (unsigned char) ((pixel >> 8) & 0xff); } else { data[1] = (unsigned char) (pixel & 0xff); data[0] = (unsigned char) ((pixel >> 8) & 0xff); } data += 2; } // // Move pixelPtr at the beginning of the // next line. // data = data + (RoundUp4(w * 2) - w * 2); } png_destroy_read_struct(&pngPtr, &infoPtr,NULL); #ifdef DEBUG *logofs << "DecompressPng16: Decompression finished." << dy << " lines handled.\n" << logofs_flush; #endif return 1; } int DecompressPng24(unsigned char *compressedData, int compressedLen, unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) { static CARD8 *pixelPtr = NULL; unsigned int dx, dy; png_structp pngPtr; png_infop infoPtr; png_bytep rowPointers; streamPos = 0; pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!pngPtr) { #ifdef PANIC *logofs << "DecompressPng24: PANIC! " << "Failed png_create_read_struct operation" << ".\n" << logofs_flush; #endif return -1; } infoPtr = png_create_info_struct(pngPtr); if (!infoPtr) { #ifdef PANIC *logofs << "DecompressPng24: PANIC! " << "Failed png_create_info_struct operation" << ".\n" << logofs_flush; #endif png_destroy_read_struct(&pngPtr, NULL, NULL); return -1; } if (setjmp(png_jmpbuf(pngPtr))) { #ifdef PANIC *logofs << "DecompressPng24: PANIC! " << "Error during IO initialization" << ".\n" << logofs_flush; #endif png_destroy_read_struct(&pngPtr, &infoPtr, NULL); return -1; } png_set_read_fn(pngPtr, (void *)compressedData, PngReadData); if (setjmp(png_jmpbuf(pngPtr))) { #ifdef PANIC *logofs << "DecompressPng24: PANIC! " << "Error during read of PNG header" << ".\n" << logofs_flush; #endif png_destroy_read_struct(&pngPtr, &infoPtr, NULL); return -1; } png_read_info( pngPtr, infoPtr ) ; if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE) { png_set_expand(pngPtr); } // // PixelPtr points to dstBuf which is // already padded correctly for the final // image to put // pixelPtr = (CARD8 *) dstBuf; rowPointers = (png_byte *)tmpBuf; if (setjmp(png_jmpbuf(pngPtr))) { #ifdef PANIC *logofs << "DecompressPng24: PANIC! " << "Error during read of PNG rows" << ".\n" << logofs_flush; #endif png_destroy_read_struct(&pngPtr, &infoPtr, NULL); return -1; } for (dy = 0; dy < h; dy++) { png_read_row(pngPtr, rowPointers, NULL); for (dx = 0; dx < w; dx++) { // // Follow the server byte order when arranging data. // if (byteOrder == LSBFirst) { pixelPtr[0] = tmpBuf[dx * 3]; pixelPtr[1] = tmpBuf[dx * 3 + 1]; pixelPtr[2] = tmpBuf[dx * 3 + 2]; } else { pixelPtr[2] = tmpBuf[dx * 3]; pixelPtr[1] = tmpBuf[dx * 3 + 1]; pixelPtr[0] = tmpBuf[dx * 3 + 2]; } pixelPtr += 3; } // // Go to the next line. // pixelPtr = (CARD8 *) (((char *) pixelPtr) + (RoundUp4(w * 3) - w * 3)); } png_destroy_read_struct(&pngPtr, &infoPtr,NULL); #ifdef DEBUG *logofs << "DecompressPng24: Decompression finished." << dy << " lines handled.\n" << logofs_flush; #endif return 1; } int DecompressPng32(unsigned char *compressedData, int compressedLen, unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) { unsigned char *data; unsigned int dx, dy; png_structp pngPtr; png_infop infoPtr; png_bytep rowPointers; streamPos = 0; pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!pngPtr) { #ifdef PANIC *logofs << "DecompressPng32: PANIC! " << "Failed png_create_read_struct operation" << ".\n" << logofs_flush; #endif return -1; } infoPtr = png_create_info_struct(pngPtr); if (!infoPtr) { #ifdef PANIC *logofs << "DecompressPng32: PANIC! " << "Failed png_create_info_struct operation." << ".\n" << logofs_flush; #endif png_destroy_read_struct(&pngPtr, NULL, NULL); return -1; } if (setjmp(png_jmpbuf(pngPtr))) { #ifdef PANIC *logofs << "DecompressPng32: PANIC! " << "Error during IO initialization" << ".\n" << logofs_flush; #endif png_destroy_read_struct(&pngPtr, &infoPtr, NULL); return -1; } png_set_read_fn(pngPtr, (void *)compressedData, PngReadData); if (setjmp(png_jmpbuf(pngPtr))) { #ifdef PANIC *logofs << "DecompressPng32: PANIC! " << "Error during read of PNG header" << ".\n" << logofs_flush; #endif png_destroy_read_struct(&pngPtr, &infoPtr, NULL); return -1; } png_read_info(pngPtr, infoPtr) ; if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE) { png_set_expand(pngPtr); } // // data points to dstBuf which is // already padded correctly for the final // image to put // data = dstBuf; rowPointers = (png_byte *) tmpBuf; if (setjmp(png_jmpbuf(pngPtr))) { #ifdef PANIC *logofs << "DecompressPng32: PANIC! " << "Error during read of PNG rows" << ".\n" << logofs_flush; #endif png_destroy_read_struct(&pngPtr, &infoPtr, NULL); return -1; } unsigned long pixel; int i; for (dy = 0; dy < h; dy++) { png_read_row(pngPtr, rowPointers, NULL); for (dx = 0; dx < w; dx++) { pixel = RGB24_TO_PIXEL(32, tmpBuf[dx * 3], tmpBuf[dx * 3 + 1], tmpBuf[dx * 3 + 2]); // // Follow the server byte order when arranging data. // if (byteOrder == LSBFirst) { for (i = 0; i < 4; i++) { data[i] = (unsigned char)(pixel & 0xff); pixel >>= 8; } } else { for (i = 3; i >= 0; i--) { data[i] = (unsigned char) (pixel & 0xff); pixel >>= 8; } } data += 4; } } png_destroy_read_struct(&pngPtr, &infoPtr,NULL); #ifdef DEBUG *logofs << "DecompressPng32: Decompression finished." << dy << " lines handled.\n" << logofs_flush; #endif return 1; } static void PngReadData(png_structp png_ptr, png_bytep data, png_size_t length) { memcpy((char *) data, (char *) png_get_io_ptr(png_ptr) + streamPos, length); streamPos += length; } nx-libs-3.5.99.23/nxcomp/src/Pgn.h0000644000000000000000000000433013614532331013277 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Pgn_H #define Pgn_H // // This file obviously supports PNG // decompression. It was renamed to // avoid name clashes on Windows. // #include "Misc.h" #include "Unpack.h" int UnpackPng(T_geometry *geometry, unsigned char method, unsigned char *srcData, int srcSize, int dstBpp, int dstWidth, int dstHeight, unsigned char *dstData, int dstSize); #endif /* Pgn_H */ nx-libs-3.5.99.23/nxcomp/src/Pipe.cpp0000644000000000000000000002125713614532331014012 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include "Pipe.h" #include "Misc.h" #include "Fork.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG extern void RegisterChild(int child); static int Psplit(const char *command, char *parameters[], int limit); // // These are slightly modified versions of popen(3) and pclose(3) // that don't rely on a shell to be available on the system, so // that they can also work on Windows. As an additional benefit, // these functions give up all privileges before running the com- // mand. Code is taken from the X distribution and, in turn, is // based on libc from FreeBSD 2.2. // static struct pid { struct pid *next; FILE *fp; int self; } *pidlist; // // A very unsofisticated attempt to parse the command line and // split each parameter in distinct strings. This is not going // to work when dealing with parameters containing spaces, even // if they are enclosed in quotes. // int Psplit(const char *command, char *parameters[], int limit) { char *line; char *value; int number; // // Preapare the list of parameters. // for (number = 0; number < limit; number++) { parameters[number] = NULL; } // // Copy the command to get rid of the // const qualifier. // line = new char[strlen(command) + 1]; if (line == NULL) { goto PsplitError; } strcpy(line, command); number = 0; value = strtok(line, " "); while (value != NULL && number < limit) { #ifdef DEBUG *logofs << "Psplit: Got parameter '" << value << "'.\n" << logofs_flush; #endif parameters[number] = new char[strlen(value) + 1]; if (parameters[number] == NULL) { goto PsplitError; } strcpy(parameters[number], value); number++; // // If this is the first parameter, then // copy it in the second position and // use it as the name of the command. // if (number == 1) { parameters[number] = new char[strlen(value) + 1]; if (parameters[number] == NULL) { goto PsplitError; } strcpy(parameters[number], value); number++; } value = strtok(NULL, " "); } // // Needs at least to have the command itself and // the first argument, being again the name of // the command. // if (number < 2) { goto PsplitError; } return number; PsplitError: #ifdef PANIC *logofs << "Psplit: PANIC! Can't split command line '" << command << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Can't split command line '" << command << "'.\n"; delete [] line; return -1; } FILE *Popen(char * const parameters[], const char *type) { FILE *iop; struct pid *cur; int pdes[2], pid; if (parameters == NULL || type == NULL) { return NULL; } if ((*type != 'r' && *type != 'w') || type[1]) { return NULL; } if ((cur = (struct pid *) malloc(sizeof(struct pid))) == NULL) { return NULL; } if (pipe(pdes) < 0) { SAFE_FREE(cur); return NULL; } // // Block all signals until command is exited. // We need to gather information about the // child in Pclose(). // DisableSignals(); switch (pid = Fork()) { case -1: { // // Error. // #ifdef PANIC *logofs << "Popen: PANIC! Function fork failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Function fork failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n"; close(pdes[0]); close(pdes[1]); SAFE_FREE(cur); return NULL; } case 0: { // // Child. // struct passwd *pwent = getpwuid(getuid()); if (pwent) initgroups(pwent->pw_name,getgid()); if (setgid(getgid()) == -1) { _exit(127); } if (setuid(getuid()) == -1) { _exit(127); } if (*type == 'r') { if (pdes[1] != 1) { // // Set up stdout. // dup2(pdes[1], 1); close(pdes[1]); } close(pdes[0]); } else { if (pdes[0] != 0) { // // Set up stdin. // dup2(pdes[0], 0); close(pdes[0]); } close(pdes[1]); } execvp(parameters[0], parameters + 1); exit(127); } } // // Parent. Save data about the child. // RegisterChild(pid); if (*type == 'r') { iop = fdopen(pdes[0], type); close(pdes[1]); } else { iop = fdopen(pdes[1], type); close(pdes[0]); } cur -> fp = iop; cur -> self = pid; cur -> next = pidlist; pidlist = cur; #ifdef TEST *logofs << "Popen: Executing "; for (int i = 0; i < 256 && parameters[i] != NULL; i++) { *logofs << "[" << parameters[i] << "]"; } *logofs << " with descriptor " << fileno(iop) << ".\n" << logofs_flush; #endif return iop; } FILE *Popen(const char *command, const char *type) { char *parameters[256]; if (Psplit(command, parameters, 256) > 0) { FILE *file = Popen(parameters, type); for (int i = 0; i < 256; i++) { delete [] parameters[i]; } return file; } else { #ifdef PANIC *logofs << "Popen: PANIC! Failed to parse command '" << command << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to parse command '" << command << "'.\n"; return NULL; } } int Pclose(FILE *iop) { struct pid *cur, *last; int pstat; int pid; #ifdef TEST *logofs << "Pclose: Closing command with output " << "on descriptor " << fileno(iop) << ".\n" << logofs_flush; #endif fclose((FILE *) iop); for (last = NULL, cur = pidlist; cur; last = cur, cur = cur -> next) { if (cur -> fp == iop) { break; } } if (cur == NULL) { #ifdef PANIC *logofs << "Pclose: PANIC! Failed to find the process " << "for descriptor " << fileno(iop) << ".\n" << logofs_flush; #endif cerr << "Error" << ": Failed to find the process " << "for descriptor " << fileno(iop) << ".\n"; return -1; } do { #ifdef TEST *logofs << "Pclose: Going to wait for process " << "with pid '" << cur -> self << "'.\n" << logofs_flush; #endif pid = waitpid(cur -> self, &pstat, 0); } while (pid == -1 && errno == EINTR); if (last == NULL) { pidlist = cur -> next; } else { last -> next = cur -> next; } SAFE_FREE(cur); // // Child has finished and we called the // waitpid(). We can enable signals again. // EnableSignals(); return (pid == -1 ? -1 : pstat); } nx-libs-3.5.99.23/nxcomp/src/Pipe.h0000644000000000000000000000420513614532331013451 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ // // These are slightly modified versions of popen(3) and pclose(3) // that don't rely on a shell to be available on the system, so // that they can also work on Windows. // extern FILE *Popen(char * const parameters[], const char *type); extern FILE *Popen(const char *command, const char *type); extern int Pclose(FILE *file); nx-libs-3.5.99.23/nxcomp/src/PolyArc.cpp0000644000000000000000000001254313614532331014464 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "PolyArc.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int PolyArcStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { PolyArcMessage *polyArc = (PolyArcMessage *) message; // // Here is the fingerprint. // polyArc -> drawable = GetULONG(buffer + 4, bigEndian); polyArc -> gcontext = GetULONG(buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int PolyArcStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { PolyArcMessage *polyArc = (PolyArcMessage *) message; // // Fill all the message's fields. // PutULONG(polyArc -> drawable, buffer + 4, bigEndian); PutULONG(polyArc -> gcontext, buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void PolyArcStore::dumpIdentity(const Message *message) const { #ifdef DUMP PolyArcMessage *polyArc = (PolyArcMessage *) message; *logofs << name() << ": Identity drawable " << polyArc -> drawable << ", gcontext " << polyArc -> gcontext << ", size " << polyArc -> size_ << ".\n" << logofs_flush; #endif } void PolyArcStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { } void PolyArcStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { PolyArcMessage *polyArc = (PolyArcMessage *) message; PolyArcMessage *cachedPolyArc = (PolyArcMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << polyArc -> drawable << " as drawable field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polyArc -> drawable, clientCache -> drawableCache); cachedPolyArc -> drawable = polyArc -> drawable; #ifdef TEST *logofs << name() << ": Encoding value " << polyArc -> gcontext << " as gcontext field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polyArc -> gcontext, clientCache -> gcCache); cachedPolyArc -> gcontext = polyArc -> gcontext; } void PolyArcStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { PolyArcMessage *polyArc = (PolyArcMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); polyArc -> drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyArc -> drawable << " as drawable field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> gcCache); polyArc -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyArc -> gcontext << " as gcontext field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/PolyArc.h0000644000000000000000000001213413614532331014125 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef PolyArc_H #define PolyArc_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define POLYARC_ENABLE_CACHE 1 #define POLYARC_ENABLE_DATA 0 #define POLYARC_ENABLE_SPLIT 0 #define POLYARC_ENABLE_COMPRESS 0 #define POLYARC_DATA_LIMIT 1980 #define POLYARC_DATA_OFFSET 12 #define POLYARC_CACHE_SLOTS 2000 #define POLYARC_CACHE_THRESHOLD 2 #define POLYARC_CACHE_LOWER_THRESHOLD 1 // // The message class. // class PolyArcMessage : public Message { friend class PolyArcStore; public: PolyArcMessage() { } ~PolyArcMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned int drawable; unsigned int gcontext; }; class PolyArcStore : public MessageStore { // // Constructors and destructors. // public: PolyArcStore() : MessageStore() { enableCache = POLYARC_ENABLE_CACHE; enableData = POLYARC_ENABLE_DATA; enableSplit = POLYARC_ENABLE_SPLIT; enableCompress = POLYARC_ENABLE_COMPRESS; dataLimit = POLYARC_DATA_LIMIT; dataOffset = POLYARC_DATA_OFFSET; cacheSlots = POLYARC_CACHE_SLOTS; cacheThreshold = POLYARC_CACHE_THRESHOLD; cacheLowerThreshold = POLYARC_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~PolyArcStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "PolyArc"; } virtual unsigned char opcode() const { return X_PolyArc; } virtual unsigned int storage() const { return sizeof(PolyArcMessage); } // // Message handling methods. // public: virtual Message *create() const { return new PolyArcMessage(); } virtual Message *create(const Message &message) const { return new PolyArcMessage((const PolyArcMessage &) message); } virtual void destroy(Message *message) const { delete (PolyArcMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* PolyArc_H */ nx-libs-3.5.99.23/nxcomp/src/PolyFillArc.cpp0000644000000000000000000001305313614532331015270 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "PolyFillArc.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int PolyFillArcStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; // // Here is the fingerprint. // polyFillArc -> drawable = GetULONG(buffer + 4, bigEndian); polyFillArc -> gcontext = GetULONG(buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int PolyFillArcStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; // // Fill all the message's fields. // PutULONG(polyFillArc -> drawable, buffer + 4, bigEndian); PutULONG(polyFillArc -> gcontext, buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void PolyFillArcStore::dumpIdentity(const Message *message) const { #ifdef DUMP PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; *logofs << name() << ": Identity drawable " << polyFillArc -> drawable << ", gcontext " << polyFillArc -> gcontext << ", size " << polyFillArc -> size_ << ".\n" << logofs_flush; #endif } void PolyFillArcStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { } void PolyFillArcStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; PolyFillArcMessage *cachedPolyFillArc = (PolyFillArcMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << polyFillArc -> drawable << " as drawable field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polyFillArc -> drawable, clientCache -> drawableCache); cachedPolyFillArc -> drawable = polyFillArc -> drawable; #ifdef TEST *logofs << name() << ": Encoding value " << polyFillArc -> gcontext << " as gcontext field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polyFillArc -> gcontext, clientCache -> gcCache); cachedPolyFillArc -> gcontext = polyFillArc -> gcontext; } void PolyFillArcStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); polyFillArc -> drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyFillArc -> drawable << " as drawable field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> gcCache); polyFillArc -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyFillArc -> gcontext << " as gcontext field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/PolyFillArc.h0000644000000000000000000001235013614532331014734 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef PolyFillArc_H #define PolyFillArc_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define POLYFILLARC_ENABLE_CACHE 1 #define POLYFILLARC_ENABLE_DATA 0 #define POLYFILLARC_ENABLE_SPLIT 0 #define POLYFILLARC_ENABLE_COMPRESS 0 #define POLYFILLARC_DATA_LIMIT 6144 #define POLYFILLARC_DATA_OFFSET 12 #define POLYFILLARC_CACHE_SLOTS 2000 #define POLYFILLARC_CACHE_THRESHOLD 2 #define POLYFILLARC_CACHE_LOWER_THRESHOLD 1 // // The message class. // class PolyFillArcMessage : public Message { friend class PolyFillArcStore; public: PolyFillArcMessage() { } ~PolyFillArcMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned int drawable; unsigned int gcontext; }; class PolyFillArcStore : public MessageStore { // // Constructors and destructors. // public: PolyFillArcStore() : MessageStore() { enableCache = POLYFILLARC_ENABLE_CACHE; enableData = POLYFILLARC_ENABLE_DATA; enableSplit = POLYFILLARC_ENABLE_SPLIT; enableCompress = POLYFILLARC_ENABLE_COMPRESS; dataLimit = POLYFILLARC_DATA_LIMIT; dataOffset = POLYFILLARC_DATA_OFFSET; cacheSlots = POLYFILLARC_CACHE_SLOTS; cacheThreshold = POLYFILLARC_CACHE_THRESHOLD; cacheLowerThreshold = POLYFILLARC_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~PolyFillArcStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "PolyFillArc"; } virtual unsigned char opcode() const { return X_PolyFillArc; } virtual unsigned int storage() const { return sizeof(PolyFillArcMessage); } // // Message handling methods. // public: virtual Message *create() const { return new PolyFillArcMessage(); } virtual Message *create(const Message &message) const { return new PolyFillArcMessage((const PolyFillArcMessage &) message); } virtual void destroy(Message *message) const { delete (PolyFillArcMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* PolyFillArc_H */ nx-libs-3.5.99.23/nxcomp/src/PolyFillRectangle.cpp0000644000000000000000000001352713614532331016475 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "PolyFillRectangle.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int PolyFillRectangleStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; // // Here is the fingerprint. // polyFillRectangle -> drawable = GetULONG(buffer + 4, bigEndian); polyFillRectangle -> gcontext = GetULONG(buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int PolyFillRectangleStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; // // Fill all the message's fields. // PutULONG(polyFillRectangle -> drawable, buffer + 4, bigEndian); PutULONG(polyFillRectangle -> gcontext, buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void PolyFillRectangleStore::dumpIdentity(const Message *message) const { #ifdef DUMP PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; *logofs << name() << ": Identity drawable " << polyFillRectangle -> drawable << ", gcontext " << polyFillRectangle -> gcontext << ", size " << polyFillRectangle -> size_ << ".\n" << logofs_flush; #endif } void PolyFillRectangleStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { } void PolyFillRectangleStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; PolyFillRectangleMessage *cachedPolyFillRectangle = (PolyFillRectangleMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding value " << polyFillRectangle -> drawable << " as drawable field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polyFillRectangle -> drawable, clientCache -> drawableCache); cachedPolyFillRectangle -> drawable = polyFillRectangle -> drawable; #ifdef DEBUG *logofs << name() << ": Encoding value " << polyFillRectangle -> gcontext << " as gcontext field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polyFillRectangle -> gcontext, clientCache -> gcCache); cachedPolyFillRectangle -> gcontext = polyFillRectangle -> gcontext; } void PolyFillRectangleStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); polyFillRectangle -> drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyFillRectangle -> drawable << " as drawable field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> gcCache); polyFillRectangle -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyFillRectangle -> gcontext << " as gcontext field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/PolyFillRectangle.h0000644000000000000000000001304613614532331016136 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef PolyFillRectangle_H #define PolyFillRectangle_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define POLYFILLRECTANGLE_ENABLE_CACHE 1 #define POLYFILLRECTANGLE_ENABLE_DATA 0 #define POLYFILLRECTANGLE_ENABLE_SPLIT 0 #define POLYFILLRECTANGLE_ENABLE_COMPRESS 0 #define POLYFILLRECTANGLE_DATA_LIMIT 2048 #define POLYFILLRECTANGLE_DATA_OFFSET 12 #define POLYFILLRECTANGLE_CACHE_SLOTS 4000 #define POLYFILLRECTANGLE_CACHE_THRESHOLD 5 #define POLYFILLRECTANGLE_CACHE_LOWER_THRESHOLD 1 // // The message class. // class PolyFillRectangleMessage : public Message { friend class PolyFillRectangleStore; public: PolyFillRectangleMessage() { } ~PolyFillRectangleMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned int drawable; unsigned int gcontext; }; class PolyFillRectangleStore : public MessageStore { // // Constructors and destructors. // public: PolyFillRectangleStore() : MessageStore() { enableCache = POLYFILLRECTANGLE_ENABLE_CACHE; enableData = POLYFILLRECTANGLE_ENABLE_DATA; enableSplit = POLYFILLRECTANGLE_ENABLE_SPLIT; enableCompress = POLYFILLRECTANGLE_ENABLE_COMPRESS; dataLimit = POLYFILLRECTANGLE_DATA_LIMIT; dataOffset = POLYFILLRECTANGLE_DATA_OFFSET; cacheSlots = POLYFILLRECTANGLE_CACHE_SLOTS; cacheThreshold = POLYFILLRECTANGLE_CACHE_THRESHOLD; cacheLowerThreshold = POLYFILLRECTANGLE_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~PolyFillRectangleStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "PolyFillRectangle"; } virtual unsigned char opcode() const { return X_PolyFillRectangle; } virtual unsigned int storage() const { return sizeof(PolyFillRectangleMessage); } // // Message handling methods. // public: virtual Message *create() const { return new PolyFillRectangleMessage(); } virtual Message *create(const Message &message) const { return new PolyFillRectangleMessage((const PolyFillRectangleMessage &) message); } virtual void destroy(Message *message) const { delete (PolyFillRectangleMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* PolyFillRectangle_H */ nx-libs-3.5.99.23/nxcomp/src/PolyLine.cpp0000644000000000000000000001305313614532331014643 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "PolyLine.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int PolyLineStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { PolyLineMessage *polyLine = (PolyLineMessage *) message; // // Here is the fingerprint. // polyLine -> mode = *(buffer + 1); polyLine -> drawable = GetULONG(buffer + 4, bigEndian); polyLine -> gcontext = GetULONG(buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int PolyLineStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { PolyLineMessage *polyLine = (PolyLineMessage *) message; // // Fill all the message's fields. // *(buffer + 1) = polyLine -> mode; PutULONG(polyLine -> drawable, buffer + 4, bigEndian); PutULONG(polyLine -> gcontext, buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void PolyLineStore::dumpIdentity(const Message *message) const { #ifdef DUMP PolyLineMessage *polyLine = (PolyLineMessage *) message; *logofs << name() << ": Identity drawable " << polyLine -> drawable << ", gcontext " << polyLine -> gcontext << ", size " << polyLine -> size_ << ".\n" << logofs_flush; #endif } void PolyLineStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { // Since ProtoStep8 (#issue 108) md5_append(md5_state_, buffer + 1, 1); } void PolyLineStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { PolyLineMessage *polyLine = (PolyLineMessage *) message; PolyLineMessage *cachedPolyLine = (PolyLineMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << polyLine -> drawable << " as drawable field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polyLine -> drawable, clientCache -> drawableCache); cachedPolyLine -> drawable = polyLine -> drawable; #ifdef TEST *logofs << name() << ": Encoding value " << polyLine -> gcontext << " as gcontext field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polyLine -> gcontext, clientCache -> gcCache); cachedPolyLine -> gcontext = polyLine -> gcontext; } void PolyLineStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { PolyLineMessage *polyLine = (PolyLineMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); polyLine -> drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyLine -> drawable << " as drawable field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> gcCache); polyLine -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyLine -> gcontext << " as gcontext field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/PolyLine.h0000644000000000000000000001222613614532331014311 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef PolyLine_H #define PolyLine_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define POLYLINE_ENABLE_CACHE 1 #define POLYLINE_ENABLE_DATA 0 #define POLYLINE_ENABLE_SPLIT 0 #define POLYLINE_ENABLE_COMPRESS 0 #define POLYLINE_DATA_LIMIT 144 #define POLYLINE_DATA_OFFSET 12 #define POLYLINE_CACHE_SLOTS 3000 #define POLYLINE_CACHE_THRESHOLD 3 #define POLYLINE_CACHE_LOWER_THRESHOLD 1 // // The message class. // class PolyLineMessage : public Message { friend class PolyLineStore; public: PolyLineMessage() { } ~PolyLineMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char mode; unsigned int drawable; unsigned int gcontext; }; class PolyLineStore : public MessageStore { // // Constructors and destructors. // public: PolyLineStore() : MessageStore() { enableCache = POLYLINE_ENABLE_CACHE; enableData = POLYLINE_ENABLE_DATA; enableSplit = POLYLINE_ENABLE_SPLIT; enableCompress = POLYLINE_ENABLE_COMPRESS; dataLimit = POLYLINE_DATA_LIMIT; dataOffset = POLYLINE_DATA_OFFSET; cacheSlots = POLYLINE_CACHE_SLOTS; cacheThreshold = POLYLINE_CACHE_THRESHOLD; cacheLowerThreshold = POLYLINE_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~PolyLineStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "PolyLine"; } virtual unsigned char opcode() const { return X_PolyLine; } virtual unsigned int storage() const { return sizeof(PolyLineMessage); } // // Message handling methods. // public: virtual Message *create() const { return new PolyLineMessage(); } virtual Message *create(const Message &message) const { return new PolyLineMessage((const PolyLineMessage &) message); } virtual void destroy(Message *message) const { delete (PolyLineMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* PolyLine_H */ nx-libs-3.5.99.23/nxcomp/src/PolyPoint.cpp0000644000000000000000000001313713614532331015050 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "PolyPoint.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int PolyPointStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { PolyPointMessage *polyPoint = (PolyPointMessage *) message; // // Here is the fingerprint. // polyPoint -> mode = *(buffer + 1); polyPoint -> drawable = GetULONG(buffer + 4, bigEndian); polyPoint -> gcontext = GetULONG(buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int PolyPointStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { PolyPointMessage *polyPoint = (PolyPointMessage *) message; // // Fill all the message's fields. // *(buffer + 1) = polyPoint -> mode; PutULONG(polyPoint -> drawable, buffer + 4, bigEndian); PutULONG(polyPoint -> gcontext, buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void PolyPointStore::dumpIdentity(const Message *message) const { #ifdef DUMP PolyPointMessage *polyPoint = (PolyPointMessage *) message; *logofs << name() << ": Identity drawable " << polyPoint -> drawable << ", gcontext " << polyPoint -> gcontext << ", size " << polyPoint -> size_ << ".\n" << logofs_flush; #endif } void PolyPointStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { // Since ProtoStep8 (#issue 108) md5_append(md5_state_, buffer + 1, 1); } void PolyPointStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { PolyPointMessage *polyPoint = (PolyPointMessage *) message; PolyPointMessage *cachedPolyPoint = (PolyPointMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << polyPoint -> drawable << " as drawable field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polyPoint -> drawable, clientCache -> drawableCache); cachedPolyPoint -> drawable = polyPoint -> drawable; #ifdef TEST *logofs << name() << ": Encoding value " << polyPoint -> gcontext << " as gcontext field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polyPoint -> gcontext, clientCache -> gcCache); cachedPolyPoint -> gcontext = polyPoint -> gcontext; } void PolyPointStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { PolyPointMessage *polyPoint = (PolyPointMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); polyPoint -> drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyPoint -> drawable << " as drawable field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> gcCache); polyPoint -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyPoint -> gcontext << " as gcontext field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/PolyPoint.h0000644000000000000000000001227213614532331014514 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef PolyPoint_H #define PolyPoint_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define POLYPOINT_ENABLE_CACHE 1 #define POLYPOINT_ENABLE_DATA 0 #define POLYPOINT_ENABLE_SPLIT 0 #define POLYPOINT_ENABLE_COMPRESS 0 #define POLYPOINT_DATA_LIMIT 3200 #define POLYPOINT_DATA_OFFSET 12 #define POLYPOINT_CACHE_SLOTS 3000 #define POLYPOINT_CACHE_THRESHOLD 3 #define POLYPOINT_CACHE_LOWER_THRESHOLD 1 // // The message class. // class PolyPointMessage : public Message { friend class PolyPointStore; public: PolyPointMessage() { } ~PolyPointMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char mode; unsigned int drawable; unsigned int gcontext; }; class PolyPointStore : public MessageStore { // // Constructors and destructors. // public: PolyPointStore() : MessageStore() { enableCache = POLYPOINT_ENABLE_CACHE; enableData = POLYPOINT_ENABLE_DATA; enableSplit = POLYPOINT_ENABLE_SPLIT; enableCompress = POLYPOINT_ENABLE_COMPRESS; dataLimit = POLYPOINT_DATA_LIMIT; dataOffset = POLYPOINT_DATA_OFFSET; cacheSlots = POLYPOINT_CACHE_SLOTS; cacheThreshold = POLYPOINT_CACHE_THRESHOLD; cacheLowerThreshold = POLYPOINT_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~PolyPointStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "PolyPoint"; } virtual unsigned char opcode() const { return X_PolyPoint; } virtual unsigned int storage() const { return sizeof(PolyPointMessage); } // // Message handling methods. // public: virtual Message *create() const { return new PolyPointMessage(); } virtual Message *create(const Message &message) const { return new PolyPointMessage((const PolyPointMessage &) message); } virtual void destroy(Message *message) const { delete (PolyPointMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* PolyPoint_H */ nx-libs-3.5.99.23/nxcomp/src/PolySegment.cpp0000644000000000000000000001305313614532331015356 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "PolySegment.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int PolySegmentStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { PolySegmentMessage *polySegment = (PolySegmentMessage *) message; // // Here is the fingerprint. // polySegment -> drawable = GetULONG(buffer + 4, bigEndian); polySegment -> gcontext = GetULONG(buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int PolySegmentStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { PolySegmentMessage *polySegment = (PolySegmentMessage *) message; // // Fill all the message's fields. // PutULONG(polySegment -> drawable, buffer + 4, bigEndian); PutULONG(polySegment -> gcontext, buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void PolySegmentStore::dumpIdentity(const Message *message) const { #ifdef DUMP PolySegmentMessage *polySegment = (PolySegmentMessage *) message; *logofs << name() << ": Identity drawable " << polySegment -> drawable << ", gcontext " << polySegment -> gcontext << ", size " << polySegment -> size_ << ".\n" << logofs_flush; #endif } void PolySegmentStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { } void PolySegmentStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { PolySegmentMessage *polySegment = (PolySegmentMessage *) message; PolySegmentMessage *cachedPolySegment = (PolySegmentMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << polySegment -> drawable << " as drawable field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polySegment -> drawable, clientCache -> drawableCache); cachedPolySegment -> drawable = polySegment -> drawable; #ifdef TEST *logofs << name() << ": Encoding value " << polySegment -> gcontext << " as gcontext field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polySegment -> gcontext, clientCache -> gcCache); cachedPolySegment -> gcontext = polySegment -> gcontext; } void PolySegmentStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { PolySegmentMessage *polySegment = (PolySegmentMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); polySegment -> drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polySegment -> drawable << " as drawable field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> gcCache); polySegment -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polySegment -> gcontext << " as gcontext field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/PolySegment.h0000644000000000000000000001237213614532331015026 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef PolySegment_H #define PolySegment_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define POLYSEGMENT_ENABLE_CACHE 1 #define POLYSEGMENT_ENABLE_DATA 0 #define POLYSEGMENT_ENABLE_SPLIT 0 #define POLYSEGMENT_ENABLE_COMPRESS 0 #define POLYSEGMENT_DATA_LIMIT 8192 #define POLYSEGMENT_DATA_OFFSET 12 #define POLYSEGMENT_CACHE_SLOTS 3000 #define POLYSEGMENT_CACHE_THRESHOLD 5 #define POLYSEGMENT_CACHE_LOWER_THRESHOLD 1 // // The message class. // class PolySegmentMessage : public Message { friend class PolySegmentStore; public: PolySegmentMessage() { } ~PolySegmentMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned int drawable; unsigned int gcontext; }; class PolySegmentStore : public MessageStore { // // Constructors and destructors. // public: PolySegmentStore() : MessageStore() { enableCache = POLYSEGMENT_ENABLE_CACHE; enableData = POLYSEGMENT_ENABLE_DATA; enableSplit = POLYSEGMENT_ENABLE_SPLIT; enableCompress = POLYSEGMENT_ENABLE_COMPRESS; dataLimit = POLYSEGMENT_DATA_LIMIT; dataOffset = POLYSEGMENT_DATA_OFFSET; cacheSlots = POLYSEGMENT_CACHE_SLOTS; cacheThreshold = POLYSEGMENT_CACHE_THRESHOLD; cacheLowerThreshold = POLYSEGMENT_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~PolySegmentStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "PolySegment"; } virtual unsigned char opcode() const { return X_PolySegment; } virtual unsigned int storage() const { return sizeof(PolySegmentMessage); } // // Message handling methods. // public: virtual Message *create() const { return new PolySegmentMessage(); } virtual Message *create(const Message &message) const { return new PolySegmentMessage((const PolySegmentMessage &) message); } virtual void destroy(Message *message) const { delete (PolySegmentMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* PolySegment_H */ nx-libs-3.5.99.23/nxcomp/src/PolyText16.cpp0000644000000000000000000002132513614532331015050 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "PolyText16.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int PolyText16Store::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { PolyText16Message *polyText16 = (PolyText16Message *) message; // // Here is the fingerprint. // polyText16 -> drawable = GetULONG(buffer + 4, bigEndian); polyText16 -> gcontext = GetULONG(buffer + 8, bigEndian); polyText16 -> x = GetUINT(buffer + 12, bigEndian); polyText16 -> y = GetUINT(buffer + 14, bigEndian); // // Clean up padding bytes. // #ifdef DUMP DumpData(buffer, size); *logofs << "\n" << logofs_flush; #endif if ((int) size > dataOffset) { int current; int length; int delta; int item; unsigned int nitem; unsigned char *pad = NULL; unsigned char *end = NULL; delta = 1; nitem = 0; #ifdef DUMP *logofs << name() << " Size " << size << ".\n" << logofs_flush; #endif // // Data is a list of TextItem where element // can be a string or a font shift. // current = POLYTEXT16_DATA_OFFSET; length = POLYTEXT16_DATA_OFFSET; do { #ifdef DUMP *logofs << name() << " Current " << current << ".\n" << logofs_flush; #endif item = GetUINT(buffer + length , bigEndian); if (item < 255) { // // Text element. Number represents // the 'Length of CHAR2B string' // field. // length += ((item * 2) + delta + 1); nitem++; } else if (item == 255) { // // Element is a font shift. // length += 5; nitem++; } #ifdef DUMP *logofs << name() << " Item " << item << ".\n" << logofs_flush; #endif current += length; } while(current < (int) size && item != 0); #ifdef DUMP *logofs << name() << " Final length " << length << ".\n" << logofs_flush; #endif end = ((unsigned char *) buffer) + size; pad = ((unsigned char *) buffer) + length; for (; pad < end && nitem >= 1; pad++) { #ifdef DUMP *logofs << name() << " Padding " << " .\n" << logofs_flush; #endif *pad = 0; } } #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int PolyText16Store::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { PolyText16Message *polyText16 = (PolyText16Message *) message; // // Fill all the message's fields. // PutULONG(polyText16 -> drawable, buffer + 4, bigEndian); PutULONG(polyText16 -> gcontext, buffer + 8, bigEndian); PutUINT(polyText16 -> x, buffer + 12, bigEndian); PutUINT(polyText16 -> y, buffer + 14, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void PolyText16Store::dumpIdentity(const Message *message) const { #ifdef DUMP PolyText16Message *polyText16 = (PolyText16Message *) message; *logofs << name() << ": Identity drawable " << polyText16 -> drawable << ", gcontext " << polyText16 -> gcontext << ", x " << polyText16 -> x << ", y " << polyText16 -> y << ", size " << polyText16 -> size_ << ".\n"; #endif } void PolyText16Store::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { } void PolyText16Store::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { PolyText16Message *polyText16 = (PolyText16Message *) message; PolyText16Message *cachedPolyText16 = (PolyText16Message *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << polyText16 -> drawable << " as " << "drawable" << " field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polyText16 -> drawable, clientCache -> drawableCache); cachedPolyText16 -> drawable = polyText16 -> drawable; #ifdef TEST *logofs << name() << ": Encoding value " << polyText16 -> gcontext << " as " << "gcontext" << " field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polyText16 -> gcontext, clientCache -> gcCache); cachedPolyText16 -> gcontext = polyText16 -> gcontext; #ifdef TEST *logofs << name() << ": Encoding value " << polyText16 -> x << " as " << "x" << " field.\n" << logofs_flush; #endif unsigned short int diff_x = polyText16 -> x - cachedPolyText16 -> x; encodeBuffer.encodeCachedValue(diff_x, 16, clientCache -> polyTextCacheX); cachedPolyText16 -> x = polyText16 -> x; #ifdef TEST *logofs << name() << ": Encoding value " << polyText16 -> y << " as " << "y" << " field.\n" << logofs_flush; #endif unsigned short int diff_y = polyText16 -> y - cachedPolyText16 -> y; encodeBuffer.encodeCachedValue(diff_y, 16, clientCache -> polyTextCacheY); cachedPolyText16 -> y = polyText16 -> y; } void PolyText16Store::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { PolyText16Message *polyText16 = (PolyText16Message *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); polyText16 -> drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyText16 -> drawable << " as " << "drawable" << " field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> gcCache); polyText16 -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyText16 -> gcontext << " as gcontext field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, clientCache -> polyTextCacheX); polyText16 -> x += value; polyText16 -> x &= 0xffff; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyText16 -> x << " as x field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, clientCache -> polyTextCacheY); polyText16 -> y += value; polyText16 -> y &= 0xffff; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyText16 -> y << " as y field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/PolyText16.h0000644000000000000000000001231513614532331014514 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef PolyText16_H #define PolyText16_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define POLYTEXT16_ENABLE_CACHE 1 #define POLYTEXT16_ENABLE_DATA 0 #define POLYTEXT16_ENABLE_SPLIT 0 #define POLYTEXT16_ENABLE_COMPRESS 0 #define POLYTEXT16_DATA_LIMIT 420 #define POLYTEXT16_DATA_OFFSET 16 #define POLYTEXT16_CACHE_SLOTS 3000 #define POLYTEXT16_CACHE_THRESHOLD 4 #define POLYTEXT16_CACHE_LOWER_THRESHOLD 1 // // The message class. // class PolyText16Message : public Message { friend class PolyText16Store; public: PolyText16Message() { } ~PolyText16Message() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned int drawable; unsigned int gcontext; unsigned short x; unsigned short y; }; class PolyText16Store : public MessageStore { // // Constructors and destructors. // public: PolyText16Store() : MessageStore() { enableCache = POLYTEXT16_ENABLE_CACHE; enableData = POLYTEXT16_ENABLE_DATA; enableSplit = POLYTEXT16_ENABLE_SPLIT; enableCompress = POLYTEXT16_ENABLE_COMPRESS; dataLimit = POLYTEXT16_DATA_LIMIT; dataOffset = POLYTEXT16_DATA_OFFSET; cacheSlots = POLYTEXT16_CACHE_SLOTS; cacheThreshold = POLYTEXT16_CACHE_THRESHOLD; cacheLowerThreshold = POLYTEXT16_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~PolyText16Store() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "PolyText16"; } virtual unsigned char opcode() const { return X_PolyText16; } virtual unsigned int storage() const { return sizeof(PolyText16Message); } // // Message handling methods. // public: virtual Message *create() const { return new PolyText16Message(); } virtual Message *create(const Message &message) const { return new PolyText16Message((const PolyText16Message &) message); } virtual void destroy(Message *message) const { delete (PolyText16Message *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* PolyText16_H */ nx-libs-3.5.99.23/nxcomp/src/PolyText8.cpp0000644000000000000000000002121413614532331014766 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "PolyText8.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int PolyText8Store::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { PolyText8Message *polyText8 = (PolyText8Message *) message; // // Here is the fingerprint. // polyText8 -> drawable = GetULONG(buffer + 4, bigEndian); polyText8 -> gcontext = GetULONG(buffer + 8, bigEndian); polyText8 -> x = GetUINT(buffer + 12, bigEndian); polyText8 -> y = GetUINT(buffer + 14, bigEndian); // // Clean up padding bytes. // #ifdef DUMP DumpData(buffer, size); *logofs << "\n\n" << logofs_flush; #endif if ((int) size > dataOffset) { int length; int current; int delta; int item; unsigned int nitem; unsigned char *pad = NULL; unsigned char *end = NULL; delta = 1; nitem = 0; #ifdef DUMP *logofs << name() << " Size " << size << ".\n" << logofs_flush; #endif // // Data is a list of TextItem where element // can be a string or a font shift. // current = POLYTEXT8_DATA_OFFSET; length = POLYTEXT8_DATA_OFFSET; do { #ifdef DUMP *logofs << name() << " Current " << current << ".\n" << logofs_flush; #endif item = GetUINT(buffer + length , bigEndian); if (item < 255) { // // Text element. Number represents // the 'Length of string' field. // length += (item + delta + 1); nitem++; } else if (item == 255) { // // Element is a font shift. // length += 5; nitem++; } #ifdef DUMP *logofs << name() << " Item " << item << ".\n" << logofs_flush; #endif current += length; } while(current < (int) size && item != 0); #ifdef DUMP *logofs << name() << " Final length " << length << ".\n" << logofs_flush; #endif end = ((unsigned char *) buffer) + size; pad = ((unsigned char *) buffer) + length; for (; pad < end && nitem >= 1; pad++) { #ifdef DUMP *logofs << name() << " Padding " << " .\n" << logofs_flush; #endif *pad = 0; } } #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int PolyText8Store::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { PolyText8Message *polyText8 = (PolyText8Message *) message; // // Fill all the message's fields. // PutULONG(polyText8 -> drawable, buffer + 4, bigEndian); PutULONG(polyText8 -> gcontext, buffer + 8, bigEndian); PutUINT(polyText8 -> x, buffer + 12, bigEndian); PutUINT(polyText8 -> y, buffer + 14, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void PolyText8Store::dumpIdentity(const Message *message) const { #ifdef DUMP PolyText8Message *polyText8 = (PolyText8Message *) message; *logofs << name() << ": Identity drawable " << polyText8 -> drawable << ", gcontext " << polyText8 -> gcontext << ", x " << polyText8 -> x << ", y " << polyText8 -> y << ", size " << polyText8 -> size_ << ".\n"; #endif } void PolyText8Store::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { } void PolyText8Store::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { PolyText8Message *polyText8 = (PolyText8Message *) message; PolyText8Message *cachedPolyText8 = (PolyText8Message *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << polyText8 -> drawable << " as " << "drawable" << " field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polyText8 -> drawable, clientCache -> drawableCache); cachedPolyText8 -> drawable = polyText8 -> drawable; #ifdef TEST *logofs << name() << ": Encoding value " << polyText8 -> gcontext << " as " << "gcontext" << " field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(polyText8 -> gcontext, clientCache -> gcCache); cachedPolyText8 -> gcontext = polyText8 -> gcontext; #ifdef TEST *logofs << name() << ": Encoding value " << polyText8 -> x << " as " << "x" << " field.\n" << logofs_flush; #endif unsigned short int diff_x = polyText8 -> x - cachedPolyText8 -> x; encodeBuffer.encodeCachedValue(diff_x, 16, clientCache -> polyTextCacheX); cachedPolyText8 -> x = polyText8 -> x; #ifdef TEST *logofs << name() << ": Encoding value " << polyText8 -> y << " as " << "y" << " field.\n" << logofs_flush; #endif unsigned short int diff_y = polyText8 -> y - cachedPolyText8 -> y; encodeBuffer.encodeCachedValue(diff_y, 16, clientCache -> polyTextCacheY); cachedPolyText8 -> y = polyText8 -> y; } void PolyText8Store::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { PolyText8Message *polyText8 = (PolyText8Message *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); polyText8 -> drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyText8 -> drawable << " as " << "drawable" << " field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> gcCache); polyText8 -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyText8 -> gcontext << " as gcontext field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, clientCache -> polyTextCacheX); polyText8 -> x += value; polyText8 -> x &= 0xffff; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyText8 -> x << " as x field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, clientCache -> polyTextCacheY); polyText8 -> y += value; polyText8 -> y &= 0xffff; #ifdef DEBUG *logofs << name() << ": Decoded value " << polyText8 -> y << " as y field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/PolyText8.h0000644000000000000000000001225213614532331014435 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef PolyText8_H #define PolyText8_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define POLYTEXT8_ENABLE_CACHE 1 #define POLYTEXT8_ENABLE_DATA 0 #define POLYTEXT8_ENABLE_SPLIT 0 #define POLYTEXT8_ENABLE_COMPRESS 0 #define POLYTEXT8_DATA_LIMIT 380 #define POLYTEXT8_DATA_OFFSET 16 #define POLYTEXT8_CACHE_SLOTS 3000 #define POLYTEXT8_CACHE_THRESHOLD 5 #define POLYTEXT8_CACHE_LOWER_THRESHOLD 1 // // The message class. // class PolyText8Message : public Message { friend class PolyText8Store; public: PolyText8Message() { } ~PolyText8Message() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned int drawable; unsigned int gcontext; unsigned short x; unsigned short y; }; class PolyText8Store : public MessageStore { // // Constructors and destructors. // public: PolyText8Store() : MessageStore() { enableCache = POLYTEXT8_ENABLE_CACHE; enableData = POLYTEXT8_ENABLE_DATA; enableSplit = POLYTEXT8_ENABLE_SPLIT; enableCompress = POLYTEXT8_ENABLE_COMPRESS; dataLimit = POLYTEXT8_DATA_LIMIT; dataOffset = POLYTEXT8_DATA_OFFSET; cacheSlots = POLYTEXT8_CACHE_SLOTS; cacheThreshold = POLYTEXT8_CACHE_THRESHOLD; cacheLowerThreshold = POLYTEXT8_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~PolyText8Store() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "PolyText8"; } virtual unsigned char opcode() const { return X_PolyText8; } virtual unsigned int storage() const { return sizeof(PolyText8Message); } // // Message handling methods. // public: virtual Message *create() const { return new PolyText8Message(); } virtual Message *create(const Message &message) const { return new PolyText8Message((const PolyText8Message &) message); } virtual void destroy(Message *message) const { delete (PolyText8Message *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* PolyText8_H */ nx-libs-3.5.99.23/nxcomp/src/Proxy.cpp0000644000000000000000000045115413614532331014241 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #ifdef ANDROID #include #include #include #endif #include "Misc.h" #if defined(__CYGWIN32__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun) #include #endif #ifndef ANDROID #include #include #include #endif #include "NXalert.h" #include "NXvars.h" #include "Proxy.h" #include "Socket.h" #include "Channel.h" #include "Statistics.h" #include "ClientChannel.h" #include "ServerChannel.h" #include "GenericChannel.h" #include "ChannelEndPoint.h" // // We need to adjust some values related // to these messages at the time the mes- // sage stores are reconfigured. // #include "PutImage.h" #include "ChangeGC.h" #include "PolyFillRectangle.h" #include "PutPackedImage.h" // // This is from the main loop. // extern void CleanupListeners(); extern int HandleChild(int); // // Default size of string buffers. // #define DEFAULT_STRING_LENGTH 512 // // Set the verbosity level. You also need // to define DUMP in Misc.cpp if DUMP is // defined here. // #define WARNING #define PANIC #undef TEST #undef DEBUG #undef DUMP // // Log the important tracepoints related // to writing packets to the peer proxy. // #undef FLUSH // // Log the operations related to splits. // #undef SPLIT // // Log the operations related to sending // and receiving the control tokens. // #undef TOKEN // // Log the operations related to setting // the token limits. // #undef LIMIT // // Log a warning if no data is written by // the proxy within a timeout. // #undef TIME // // Log the operation related to generating // the ping message at idle time. // #undef PING Proxy::Proxy(int fd) : transport_(new ProxyTransport(fd)), fd_(fd), readBuffer_(transport_) { for (int channelId = 0; channelId < CONNECTIONS_LIMIT; channelId++) { channels_[channelId] = NULL; transports_[channelId] = NULL; congestions_[channelId] = 0; fdMap_[channelId] = nothing; channelMap_[channelId] = nothing; slavePidMap_[channelId] = nothing; } inputChannel_ = nothing; outputChannel_ = nothing; controlLength_ = 0; operation_ = operation_in_negotiation; draining_ = 0; priority_ = 0; finish_ = 0; shutdown_ = 0; congestion_ = 0; timer_ = 0; alert_ = 0; agent_ = nothing; // // Set null timeouts. This will require // a new link configuration. // timeouts_.split = 0; timeouts_.motion = 0; timeouts_.readTs = getTimestamp(); timeouts_.writeTs = getTimestamp(); timeouts_.loopTs = getTimestamp(); timeouts_.pingTs = getTimestamp(); timeouts_.alertTs = nullTimestamp(); timeouts_.loadTs = nullTimestamp(); timeouts_.splitTs = nullTimestamp(); timeouts_.motionTs = nullTimestamp(); // // Initialize the token counters. This // will require a new link configuration. // for (int i = token_control; i <= token_data; i++) { tokens_[i].size = 0; tokens_[i].limit = 0; tokens_[i].bytes = 0; tokens_[i].remaining = 0; } tokens_[token_control].request = code_control_token_request; tokens_[token_control].reply = code_control_token_reply; tokens_[token_control].type = token_control; tokens_[token_split].request = code_split_token_request; tokens_[token_split].reply = code_split_token_reply; tokens_[token_split].type = token_split; tokens_[token_data].request = code_data_token_request; tokens_[token_data].reply = code_data_token_reply; tokens_[token_data].type = token_data; currentStatistics_ = NULL; // // Create compressor and decompressor // for image and data payload. // compressor_ = new StaticCompressor(control -> LocalDataCompressionLevel, control -> LocalDataCompressionThreshold); // // Create object storing NX specific // opcodes. // opcodeStore_ = new OpcodeStore(); // // Create the message stores. // clientStore_ = new ClientStore(compressor_); serverStore_ = new ServerStore(compressor_); clientCache_ = new ClientCache(); serverCache_ = new ServerCache(); if (clientCache_ == NULL || serverCache_ == NULL) { #ifdef PANIC *logofs << "Proxy: PANIC! Failed to create the channel cache.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to create the channel cache.\n"; HandleCleanup(); } // // Prepare for image decompression. // UnpackInit(); #ifdef DEBUG *logofs << "Proxy: Created new object at " << this << ".\n" << logofs_flush; #endif } Proxy::~Proxy() { for (int channelId = 0; channelId < CONNECTIONS_LIMIT; channelId++) { if (channels_[channelId] != NULL) { deallocateTransport(channelId); delete channels_[channelId]; channels_[channelId] = NULL; } } // // Kill all active slave channel children, and // give them 5 seconds to exit nicely. #ifdef DEBUG *logofs << "Proxy: Killing active slaves" << endl; #endif int slave_count = 999; int loop_count = 0; while(slave_count > 0 && loop_count < 50) { slave_count = 0; for (int channelId = 0; channelId 1) { slave_count++; #ifdef DEBUG *logofs << "Proxy: Active slave with pid " << pid << logofs_flush; #endif if ( loop_count == 0 ) { #ifdef DEBUG *logofs << "Proxy: Sending SIGTERM to " << pid << logofs_flush; #endif kill(pid, SIGTERM); } else if ( loop_count == 25 ) { #ifdef DEBUG *logofs << "Proxy: Sending SIGKILL to " << pid << logofs_flush; #endif kill(pid, SIGKILL); } if (HandleChild(pid)) { #ifdef DEBUG *logofs << "Proxy: Slave " << pid << " terminated" << logofs_flush; #endif slavePidMap_[channelId] = nothing; } } } if ( slave_count > 0 ) { cerr << "Proxy: Error: Failed to kill all slave channel processes. " << slave_count << " processes still remaining." << endl; } usleep(200000); loop_count++; } delete transport_; delete compressor_; // // Delete storage shared among channels. // delete opcodeStore_; delete clientStore_; delete serverStore_; delete clientCache_; delete serverCache_; // // Get rid of the image decompression // resources. // UnpackDestroy(); #ifdef DEBUG *logofs << "Proxy: Deleted proxy object at " << this << ".\n" << logofs_flush; #endif } int Proxy::setOperational() { #ifdef TEST *logofs << "Proxy: Entering operational mode.\n" << logofs_flush; #endif operation_ = operation_in_messages; return 1; } int Proxy::setReadDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax) { // // Set the initial timeout to the time of // the next ping. If the congestion count // is greater than zero, anyway, use a // shorter timeout to force a congestion // update. // if (agent_ != nothing && congestions_[agent_] == 0 && statistics -> getCongestionInFrame() >= 1 && tokens_[token_control].remaining >= (tokens_[token_control].limit - 1)) { setMinTimestamp(tsMax, control -> IdleTimeout); #ifdef TEST *logofs << "Proxy: Initial timeout is " << tsMax.tv_sec << " s and " << (double) tsMax.tv_usec / 1000 << " ms with congestion " << statistics -> getCongestionInFrame() << ".\n" << logofs_flush; #endif } else { setMinTimestamp(tsMax, control -> PingTimeout); #ifdef TEST *logofs << "Proxy: Initial timeout is " << tsMax.tv_sec << " s and " << (double) tsMax.tv_usec / 1000 << " ms.\n" << logofs_flush; #endif } int fd = -1; if (isTimeToRead() == 1) { // // If we don't have split tokens available // don't set the timeout. // if (tokens_[token_split].remaining > 0 && isTimestamp(timeouts_.splitTs) == 1) { int diffTs = getTimeToNextSplit(); #if defined(TEST) || defined(INFO) || \ defined(FLUSH) || defined(SPLIT) if (diffTimestamp(timeouts_.splitTs, getTimestamp()) > timeouts_.split) { *logofs << "Proxy: FLUSH! SPLIT! WARNING! Running with " << diffTimestamp(timeouts_.splitTs, getTimestamp()) << " ms elapsed since the last split.\n" << logofs_flush; } *logofs << "Proxy: FLUSH! SPLIT! Requesting timeout of " << diffTs << " ms as there are splits to send.\n" << logofs_flush; #endif setMinTimestamp(tsMax, diffTs); } #if defined(TEST) || defined(INFO) else if (isTimestamp(timeouts_.splitTs) == 1) { *logofs << "Proxy: WARNING! Not requesting a split " << "timeout with " << tokens_[token_split].remaining << " split tokens remaining.\n" << logofs_flush; } #endif // // Loop through the valid channels and set // the descriptors selected for read and // the timeout. // T_list &channelList = activeChannels_.getList(); for (T_list::iterator j = channelList.begin(); j != channelList.end(); j++) { int channelId = *j; if (channels_[channelId] == NULL) { continue; } fd = getFd(channelId); if (channels_[channelId] -> getFinish() == 0 && (channels_[channelId] -> getType() == channel_x11 || tokens_[token_data].remaining > 0) && congestions_[channelId] == 0) { FD_SET(fd, fdSet); if (fd >= fdMax) { fdMax = fd + 1; } #ifdef TEST *logofs << "Proxy: Descriptor FD#" << fd << " selected for read with buffer length " << transports_[channelId] -> length() << ".\n" << logofs_flush; #endif // // Wakeup the proxy if there are motion // events to flush. // if (isTimestamp(timeouts_.motionTs) == 1) { int diffTs = getTimeToNextMotion(); #if defined(TEST) || defined(INFO) if (diffTimestamp(timeouts_.motionTs, getTimestamp()) > timeouts_.motion) { *logofs << "Proxy: FLUSH! WARNING! Running with " << diffTimestamp(timeouts_.motionTs, getTimestamp()) << " ms elapsed since the last motion.\n" << logofs_flush; } *logofs << "Proxy: FLUSH! Requesting timeout of " << diffTs << " ms as FD#" << fd << " has motion " << "events to send.\n" << logofs_flush; #endif setMinTimestamp(tsMax, diffTs); } } #if defined(TEST) || defined(INFO) else { if (channels_[channelId] -> getType() != channel_x11 && tokens_[token_data].remaining <= 0) { *logofs << "Proxy: WARNING! Descriptor FD#" << fd << " not selected for read with " << tokens_[token_data].remaining << " data " << "tokens remaining.\n" << logofs_flush; } } #endif } } #if defined(TEST) || defined(INFO) else { *logofs << "Proxy: WARNING! Disabled reading from channels.\n" << logofs_flush; *logofs << "Proxy: WARNING! Congestion is " << congestion_ << " pending " << transport_ -> pending() << " blocked " << transport_ -> blocked() << " length " << transport_ -> length() << ".\n" << logofs_flush; } #endif // // Include the proxy descriptor. // FD_SET(fd_, fdSet); if (fd_ >= fdMax) { fdMax = fd_ + 1; } #ifdef TEST *logofs << "Proxy: Proxy descriptor FD#" << fd_ << " selected for read with buffer length " << transport_ -> length() << ".\n" << logofs_flush; #endif return 1; } // // Add to the mask the file descriptors of all // X connections to write to. // int Proxy::setWriteDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax) { int fd = -1; T_list &channelList = activeChannels_.getList(); for (T_list::iterator j = channelList.begin(); j != channelList.end(); j++) { int channelId = *j; if (channels_[channelId] != NULL) { fd = getFd(channelId); if (transports_[channelId] -> length() > 0) { FD_SET(fd, fdSet); #ifdef TEST *logofs << "Proxy: Descriptor FD#" << fd << " selected " << "for write with blocked " << transports_[channelId] -> blocked() << " and length " << transports_[channelId] -> length() << ".\n" << logofs_flush; #endif if (fd >= fdMax) { fdMax = fd + 1; } } #ifdef TEST else { *logofs << "Proxy: Descriptor FD#" << fd << " not selected " << "for write with blocked " << transports_[channelId] -> blocked() << " and length " << transports_[channelId] -> length() << ".\n" << logofs_flush; } #endif #if defined(TEST) || defined(INFO) if (transports_[channelId] -> getType() != transport_agent && transports_[channelId] -> length() > 0 && transports_[channelId] -> blocked() != 1) { *logofs << "Proxy: PANIC! Descriptor FD#" << fd << " has data to write but blocked flag is " << transports_[channelId] -> blocked() << ".\n" << logofs_flush; cerr << "Error" << ": Descriptor FD#" << fd << " has data to write but blocked flag is " << transports_[channelId] -> blocked() << ".\n"; HandleCleanup(); } #endif } } // // Check if the proxy transport has data // from a previous blocking write. // if (transport_ -> blocked() == 1) { FD_SET(fd_, fdSet); #ifdef TEST *logofs << "Proxy: Proxy descriptor FD#" << fd_ << " selected for write. Blocked is " << transport_ -> blocked() << " length is " << transport_ -> length() << ".\n" << logofs_flush; #endif if (fd_ >= fdMax) { fdMax = fd_ + 1; } } #ifdef TEST else { *logofs << "Proxy: Proxy descriptor FD#" << fd_ << " not selected for write. Blocked is " << transport_ -> blocked() << " length is " << transport_ -> length() << ".\n" << logofs_flush; } #endif // // We are entering the main select. Save // the timestamp of the last loop so that // we can detect the clock drifts. // timeouts_.loopTs = getTimestamp(); return 1; } int Proxy::getChannels(T_channel_type type) { int channels = 0; T_list &channelList = activeChannels_.getList(); for (T_list::iterator j = channelList.begin(); j != channelList.end(); j++) { int channelId = *j; if (channels_[channelId] != NULL && (type == channel_none || type == channels_[channelId] -> getType())) { channels++; } } return channels; } T_channel_type Proxy::getType(int fd) { int channelId = getChannel(fd); if (channelId < 0 || channels_[channelId] == NULL) { return channel_none; } return channels_[channelId] -> getType(); } const char *Proxy::getTypeName(T_channel_type type) { switch (type) { case channel_x11: { return "X"; } case channel_cups: { return "CUPS"; } case channel_smb: { return "SMB"; } case channel_media: { return "media"; } case channel_http: { return "HTTP"; } case channel_font: { return "font"; } case channel_slave: { return "slave"; } default: { return "unknown"; } } } const char *Proxy::getComputerName() { // // Strangely enough, under some Windows OSes SMB // service doesn't bind to localhost. Fall back // to localhost if can't find computer name in // the environment. In future we should try to // bind to localhost and then try the other IPs. // const char *hostname = NULL; #ifdef __CYGWIN32__ hostname = getenv("COMPUTERNAME"); #endif if (hostname == NULL) { hostname = "localhost"; } return hostname; } // // Handle data from channels selected for read. // int Proxy::handleRead(int &resultFds, fd_set &readSet) { #ifdef DEBUG *logofs << "Proxy: Checking descriptors selected for read.\n" << logofs_flush; #endif T_list &channelList = activeChannels_.getList(); for (T_list::iterator j = channelList.begin(); j != channelList.end(); j++) { #ifdef DEBUG *logofs << "Proxy: Looping with current channel " << *j << ".\n" << logofs_flush; #endif int fd = getFd(*j); if (fd >= 0 && resultFds > 0 && FD_ISSET(fd, &readSet)) { #ifdef DEBUG *logofs << "Proxy: Going to read messages from FD#" << fd << ".\n" << logofs_flush; #endif int result = handleRead(fd); if (result < 0) { #ifdef TEST *logofs << "Proxy: Failure reading messages from FD#" << fd << ".\n" << logofs_flush; #endif return -1; } #ifdef DEBUG *logofs << "Proxy: Clearing the read descriptor " << "for FD#" << fd << ".\n" << logofs_flush; #endif FD_CLR(fd, &readSet); resultFds--; } } if (resultFds > 0 && FD_ISSET(fd_, &readSet)) { #ifdef DEBUG *logofs << "Proxy: Going to read messages from " << "proxy FD#" << fd_ << ".\n" << logofs_flush; #endif if (handleRead() < 0) { #ifdef TEST *logofs << "Proxy: Failure reading from proxy FD#" << fd_ << ".\n" << logofs_flush; #endif return -1; } #ifdef DEBUG *logofs << "Proxy: Clearing the read descriptor " << "for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif FD_CLR(fd_, &readSet); resultFds--; } return 1; } // // Perform flush on descriptors selected for write. // int Proxy::handleFlush(int &resultFds, fd_set &writeSet) { #ifdef DEBUG *logofs << "Proxy: Checking descriptors selected for write.\n" << logofs_flush; #endif if (resultFds > 0 && FD_ISSET(fd_, &writeSet)) { #ifdef TEST *logofs << "Proxy: FLUSH! Proxy descriptor FD#" << fd_ << " reported to be writable.\n" << logofs_flush; #endif if (handleFlush() < 0) { #ifdef TEST *logofs << "Proxy: Failure flushing the writable " << "proxy FD#" << fd_ << ".\n" << logofs_flush; #endif return -1; } #ifdef DEBUG *logofs << "Proxy: Clearing the write descriptor " << "for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif FD_CLR(fd_, &writeSet); resultFds--; } T_list &channelList = activeChannels_.getList(); for (T_list::iterator j = channelList.begin(); resultFds > 0 && j != channelList.end(); j++) { #ifdef DEBUG *logofs << "Proxy: Looping with current channel " << *j << ".\n" << logofs_flush; #endif int fd = getFd(*j); if (fd >= 0 && FD_ISSET(fd, &writeSet)) { #ifdef TEST *logofs << "Proxy: X descriptor FD#" << fd << " reported to be writable.\n" << logofs_flush; #endif // // It can happen that, in handling reads, we // have destroyed the buffer associated to a // closed socket, so don't complain about // the errors. // handleFlush(fd); // // Clear the descriptor from the mask so // we don't confuse the agent if it's // not checking only its own descriptors. // #ifdef DEBUG *logofs << "Proxy: Clearing the write descriptor " << "for FD#" << fd << ".\n" << logofs_flush; #endif FD_CLR(fd, &writeSet); resultFds--; } } return 1; } int Proxy::handleRead() { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Decoding data from proxy FD#" << fd_ << ".\n" << logofs_flush; #endif // // Decode all the available messages from // the remote proxy until is not possible // to read more. // for (;;) { int result = readBuffer_.readMessage(); #if defined(TEST) || defined(DEBUG) || defined(INFO) *logofs << "Proxy: Read result on proxy FD#" << fd_ << " is " << result << ".\n" << logofs_flush; #endif if (result < 0) { if (shutdown_ == 0) { if (finish_ == 0) { #ifdef PANIC *logofs << "Proxy: PANIC! Failure reading from the " << "peer proxy on FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": Failure reading from the " << "peer proxy.\n"; } } #ifdef TEST else { *logofs << "Proxy: Closure of the proxy link detected " << "after clean shutdown.\n" << logofs_flush; } #endif priority_ = 0; finish_ = 1; congestion_ = 0; return -1; } else if (result == 0) { #if defined(TEST) || defined(DEBUG) || defined(INFO) *logofs << "Proxy: No data read from proxy FD#" << fd_ << "\n" << logofs_flush; #endif return 0; } // // We read some data from the remote. If we set // the congestion flag because we couldn't read // before the timeout and have tokens available, // then reset the congestion flag. // if (congestion_ == 1 && tokens_[token_control].remaining > 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Exiting congestion due to " << "proxy data with " << tokens_[token_control].remaining << " tokens.\n" << logofs_flush; #endif congestion_ = 0; } // // Set the timestamp of the last read // operation from the remote proxy and // enable again showing the 'no data // received' dialog at the next timeout. // timeouts_.readTs = getTimestamp(); if (alert_ != 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Displacing the dialog " << "for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif HandleAlert(DISPLACE_MESSAGE_ALERT, 1); } timeouts_.alertTs = nullTimestamp(); #if defined(TEST) || defined(INFO) *logofs << "Proxy: Getting messages from proxy FD#" << fd_ << " with " << readBuffer_.getLength() << " bytes " << "in the read buffer.\n" << logofs_flush; #endif unsigned int controlLength; unsigned int dataLength; const unsigned char *message; while ((message = readBuffer_.getMessage(controlLength, dataLength)) != NULL) { statistics -> addFrameIn(); if (controlLength == 3 && *message == 0 && *(message + 1) < code_last_tag) { if (handleControlFromProxy(message) < 0) { return -1; } } else if (operation_ == operation_in_messages) { int channelId = inputChannel_; #if defined(TEST) || defined(INFO) *logofs << "Proxy: Identified message of " << dataLength << " bytes for FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; #endif if (channelId >= 0 && channelId < CONNECTIONS_LIMIT && channels_[channelId] != NULL) { int finish = channels_[channelId] -> getFinish(); #ifdef WARNING if (finish == 1) { *logofs << "Proxy: WARNING! Handling data for finishing " << "FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; } #endif // // We need to decode all the data to preserve // the consistency of the cache, so can't re- // turn as soon as the first error is encount- // ered. Check if this is the first time that // the failure is detected. // int _result = channels_[channelId] -> handleWrite(message, dataLength); if (_result < 0 && finish == 0) { #ifdef TEST *logofs << "Proxy: Failed to write proxy data to FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; #endif if (handleFinish(channelId) < 0) { return -1; } } // // Check if we have splits or motion // events to send. // setSplitTimeout(channelId); setMotionTimeout(channelId); } #ifdef WARNING else { *logofs << "Proxy: WARNING! Received data for " << "invalid channel ID#" << channelId << ".\n" << logofs_flush; } #endif } else if (operation_ == operation_in_statistics) { #ifdef TEST *logofs << "Proxy: Received statistics data from remote proxy.\n" << logofs_flush; #endif if (handleStatisticsFromProxy(message, dataLength) < 0) { return -1; } operation_ = operation_in_messages; } else if (operation_ == operation_in_negotiation) { #ifdef TEST *logofs << "Proxy: Received new negotiation data from remote proxy.\n" << logofs_flush; #endif if (handleNegotiationFromProxy(message, dataLength) < 0) { return -1; } } // // if (controlLength == 3 && *message == 0 && ...) ... // else if (operation_ == operation_in_statistics) ... // else if (operation_ == operation_in_messages) ... // else if (operation_ == operation_in_negotiation) ... // else ... // else { #ifdef PANIC *logofs << "Proxy: PANIC! Unrecognized message received on proxy FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": Unrecognized message received on proxy FD#" << fd_ << ".\n"; return -1; } } // while ((message = readBuffer_.getMessage(controlLength, dataLength)) != NULL) ... // // Reset the read buffer. // readBuffer_.fullReset(); // // Give up if no data is readable. // if (transport_ -> readable() == 0) { break; } } // End of for (;;) ... return 1; } int Proxy::handleControlFromProxy(const unsigned char *message) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Received message '" << DumpControl(*(message + 1)) << "' at " << strMsTimestamp() << " with data ID#" << (int) *(message + 2) << ".\n" << logofs_flush; #endif T_channel_type channelType = channel_none; switch (*(message + 1)) { case code_switch_connection: { int channelId = *(message + 2); // // If channel is invalid further messages will // be ignored. The acknowledged shutdown of // channels should prevent this. // inputChannel_ = channelId; break; } case code_begin_congestion: { // // Set the congestion state for the // channel reported by the remote. // int channelId = *(message + 2); if (channels_[channelId] != NULL) { congestions_[channelId] = 1; #if defined(TEST) || defined(INFO) *logofs << "Proxy: Received a begin congestion " << "for channel id ID#" << channelId << ".\n" << logofs_flush; #endif if (channelId == agent_ && congestions_[agent_] != 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Forcing an update of the congestion " << "counter with agent congested.\n" << logofs_flush; #endif statistics -> updateCongestion(-tokens_[token_control].remaining, tokens_[token_control].limit); } } #ifdef WARNING else { *logofs << "Proxy: WARNING! Received a begin congestion " << "for invalid channel id ID#" << channelId << ".\n" << logofs_flush; } #endif break; } case code_end_congestion: { // // Attend again to the channel. // int channelId = *(message + 2); if (channels_[channelId] != NULL) { congestions_[channelId] = 0; #if defined(TEST) || defined(INFO) *logofs << "Proxy: Received an end congestion " << "for channel id ID#" << channelId << ".\n" << logofs_flush; #endif if (channelId == agent_ && congestions_[agent_] != 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Forcing an update of the congestion " << "counter with agent decongested.\n" << logofs_flush; #endif statistics -> updateCongestion(tokens_[token_control].remaining, tokens_[token_control].limit); } } #ifdef WARNING else { *logofs << "Proxy: WARNING! Received an end congestion " << "for invalid channel id ID#" << channelId << ".\n" << logofs_flush; } #endif break; } case code_control_token_request: { T_proxy_token &token = tokens_[token_control]; if (handleTokenFromProxy(token, *(message + 2)) < 0) { return -1; } break; } case code_split_token_request: { T_proxy_token &token = tokens_[token_split]; if (handleTokenFromProxy(token, *(message + 2)) < 0) { return -1; } break; } case code_data_token_request: { T_proxy_token &token = tokens_[token_data]; if (handleTokenFromProxy(token, *(message + 2)) < 0) { return -1; } break; } case code_control_token_reply: { T_proxy_token &token = tokens_[token_control]; if (handleTokenReplyFromProxy(token, *(message + 2)) < 0) { return -1; } break; } case code_split_token_reply: { T_proxy_token &token = tokens_[token_split]; if (handleTokenReplyFromProxy(token, *(message + 2)) < 0) { return -1; } break; } case code_data_token_reply: { T_proxy_token &token = tokens_[token_data]; if (handleTokenReplyFromProxy(token, *(message + 2)) < 0) { return -1; } break; } case code_new_x_connection: { // // Opening the channel is handled later. // channelType = channel_x11; break; } case code_new_cups_connection: { channelType = channel_cups; break; } case code_new_aux_connection: { // // Starting from version 1.5.0 we create real X // connections for the keyboard channel. We need // to refuse old auxiliary X connections because // they would be unable to leverage the new fake // authorization cookie. // #ifdef WARNING *logofs << "Proxy: WARNING! Can't open outdated auxiliary X " << "channel for code " << *(message + 1) << ".\n" << logofs_flush; #endif cerr << "Warning" << ": Can't open outdated auxiliary X " << "channel for code " << *(message + 1) << ".\n"; if (handleControl(code_drop_connection, *(message + 2)) < 0) { return -1; } break; } case code_new_smb_connection: { channelType = channel_smb; break; } case code_new_media_connection: { channelType = channel_media; break; } case code_new_http_connection: { channelType = channel_http; break; } case code_new_font_connection: { channelType = channel_font; break; } case code_new_slave_connection: { channelType = channel_slave; break; } case code_drop_connection: { int channelId = *(message + 2); if (channelId >= 0 && channelId < CONNECTIONS_LIMIT && channels_[channelId] != NULL) { handleDropFromProxy(channelId); } #ifdef WARNING else { *logofs << "Proxy: WARNING! Received a drop message " << "for invalid channel id ID#" << channelId << ".\n" << logofs_flush; } #endif break; } case code_finish_connection: { int channelId = *(message + 2); if (channelId >= 0 && channelId < CONNECTIONS_LIMIT && channels_[channelId] != NULL) { // // Force the finish state on the channel. // We can receive this message while in // the read loop, so we only mark the // channel for deletion. // #ifdef TEST *logofs << "Proxy: Received a finish message for FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; #endif handleFinishFromProxy(channelId); } #ifdef WARNING else { *logofs << "Proxy: WARNING! Received a finish message " << "for invalid channel id ID#" << channelId << ".\n" << logofs_flush; } #endif break; } case code_finish_listeners: { // // This is from the main loop. // #ifdef TEST *logofs << "Proxy: Closing down all local listeners.\n" << logofs_flush; #endif CleanupListeners(); finish_ = 1; break; } case code_reset_request: { #ifdef PANIC *logofs << "Proxy: PANIC! Proxy reset not supported " << "in this version.\n" << logofs_flush; #endif cerr << "Error" << ": Proxy reset not supported " << "in this version.\n"; HandleCleanup(); } case code_shutdown_request: { // // Time to rest in peace. // shutdown_ = 1; break; } case code_load_request: { if (handleLoadFromProxy() < 0) { return -1; } break; } case code_save_request: { // // Don't abort the connection // if can't write to disk. // handleSaveFromProxy(); break; } case code_statistics_request: { int type = *(message + 2); if (handleStatisticsFromProxy(type) < 0) { return -1; } break; } case code_statistics_reply: { operation_ = operation_in_statistics; break; } case code_alert_request: { HandleAlert(*(message + 2), 1); break; } case code_sync_request: { int channelId = *(message + 2); if (handleSyncFromProxy(channelId) < 0) { return -1; } break; } case code_sync_reply: { // // We are not the one that issued // the request. // #if defined(TEST) || defined(INFO) *logofs << "Proxy: PANIC! Received an unexpected " << "synchronization reply.\n" << logofs_flush; #endif cerr << "Error" << ": Received an unexpected " << "synchronization reply.\n"; HandleCleanup(); } default: { #ifdef PANIC *logofs << "Proxy: PANIC! Received bad control message number " << (unsigned int) *(message + 1) << " with attribute " << (unsigned int) *(message + 2) << ".\n" << logofs_flush; #endif cerr << "Error" << ": Received bad control message number " << (unsigned int) *(message + 1) << " with attribute " << (unsigned int) *(message + 2) << ".\n"; HandleCleanup(); } } // End of switch (*(message + 1)) ... if (channelType == channel_none) { return 1; } // // Handle the channel allocation that we // left from the main switch case. // int channelId = *(message + 2); // // Check if the channel has been dropped. // if (channels_[channelId] != NULL && (channels_[channelId] -> getDrop() == 1 || channels_[channelId] -> getClosing() == 1)) { #ifdef TEST *logofs << "Proxy: Dropping the descriptor FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; #endif handleDrop(channelId); } // // Check if the channel is in the valid // range. // int result = checkChannelMap(channelId); if (result >= 0) { result = handleNewConnectionFromProxy(channelType, channelId); } if (result < 0) { // // Realization of new channel failed. // Send channel shutdown message to // the peer proxy. // if (handleControl(code_drop_connection, channelId) < 0) { return -1; } } else { int fd = getFd(channelId); if (getReadable(fd) > 0) { #ifdef TEST *logofs << "Proxy: Trying to read immediately " << "from descriptor FD#" << fd << ".\n" << logofs_flush; #endif if (handleRead(fd) < 0) { return -1; } } #ifdef TEST *logofs << "Proxy: Nothing to read immediately " << "from descriptor FD#" << fd << ".\n" << logofs_flush; #endif } return 1; } int Proxy::handleRead(int fd, const char *data, int size) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Handling data for connection on FD#" << fd << ".\n" << logofs_flush; #endif if (canRead(fd) == 0) { #if defined(TEST) || defined(INFO) if (getChannel(fd) < 0) { *logofs << "Proxy: PANIC! Can't read from invalid FD#" << fd << ".\n" << logofs_flush; HandleCleanup(); } else { *logofs << "Proxy: WARNING! Read method called for FD#" << fd << " but operation is not possible.\n" << logofs_flush; } #endif return 0; } int channelId = getChannel(fd); // // Let the channel object read all the new data from // its file descriptor, isolate messages, compress // those messages, and append the compressed form to // the encode buffer. // #if defined(TEST) || defined(INFO) *logofs << "Proxy: Reading messages from FD#" << fd << " channel ID#" << channelId << ".\n" << logofs_flush; #endif int result = channels_[channelId] -> handleRead(encodeBuffer_, (const unsigned char *) data, (unsigned int) size); // // Even in the case of a failure, write the produced // data to the proxy connection. To keep the stores // synchronized, the remote side needs to decode any // message encoded by this side, also if the X socket // was closed in the meanwhile. If this is the case, // the decompressed output will be silently discarded. // if (result < 0) { #ifdef TEST *logofs << "Proxy: Failed to read data from connection FD#" << fd << " channel ID#" << channelId << ".\n" << logofs_flush; #endif if (handleFinish(channelId) < 0) { return -1; } } // // Check if there are new splits or // motion events to send. // setSplitTimeout(channelId); setMotionTimeout(channelId); return 1; } int Proxy::handleEvents() { #ifdef TEST *logofs << "Proxy: Going to check the events on channels.\n" << logofs_flush; #endif // // Check if we can safely write to the // proxy link. // int read = isTimeToRead(); // // Loop on channels and send the pending // events. We must copy the list because // channels can be removed in the middle // of the loop. // T_list channelList = activeChannels_.copyList(); for (T_list::iterator j = channelList.begin(); j != channelList.end(); j++) { int channelId = *j; if (channels_[channelId] == NULL) { continue; } // // Check if we need to drop the channel. // if (channels_[channelId] -> getDrop() == 1 || channels_[channelId] -> getClosing() == 1) { #ifdef TEST *logofs << "Proxy: Dropping the descriptor FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; #endif if (handleDrop(channelId) < 0) { return -1; } continue; } else if (channels_[channelId] -> getFinish() == 1) { #ifdef TEST *logofs << "Proxy: Skipping finishing " << "descriptor FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; #endif continue; } // // If the proxy link or the channel is // in congestion state, don't handle // the further events. // if (read == 0 || congestions_[channelId] == 1) { #ifdef TEST if (read == 0) { *logofs << "Proxy: Can't handle events for FD#" << getFd(channelId) << " channel ID#" << channelId << " with proxy not available.\n" << logofs_flush; } else { *logofs << "Proxy: Can't handle events for FD#" << getFd(channelId) << " channel ID#" << channelId << " with channel congested.\n" << logofs_flush; } #endif continue; } // // Handle the timeouts on the channel // operations. // int result = 0; // // Handle the motion events. // if (result >= 0 && channels_[channelId] -> needMotion() == 1) { if (isTimeToMotion() == 1) { #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "Proxy: FLUSH! Motion timeout expired after " << diffTimestamp(timeouts_.motionTs, getTimestamp()) << " ms.\n" << logofs_flush; #endif result = channels_[channelId] -> handleMotion(encodeBuffer_); #ifdef TEST if (result < 0) { *logofs << "Proxy: Failed to handle motion events for FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; } #endif timeouts_.motionTs = nullTimestamp(); setMotionTimeout(channelId); } #if defined(TEST) || defined(INFO) else if (isTimestamp(timeouts_.motionTs) == 1) { *logofs << "Proxy: Running with " << diffTimestamp(timeouts_.motionTs, getTimestamp()) << " ms elapsed since the last motion.\n" << logofs_flush; } #endif } if (result >= 0 && channels_[channelId] -> needSplit() == 1) { // // Check if it is time to send more splits // and how many bytes are going to be sent. // if (isTimeToSplit() == 1) { #if defined(TEST) || defined(INFO) || defined(SPLIT) *logofs << "Proxy: SPLIT! Split timeout expired after " << diffTimestamp(timeouts_.splitTs, getTimestamp()) << " ms.\n" << logofs_flush; #endif #if defined(TEST) || defined(INFO) || defined(SPLIT) *logofs << "Proxy: SPLIT! Encoding splits for FD#" << getFd(channelId) << " at " << strMsTimestamp() << " with " << clientStore_ -> getSplitTotalStorageSize() << " total bytes and " << control -> SplitDataPacketLimit << " bytes " << "to write.\n" << logofs_flush; #endif result = channels_[channelId] -> handleSplit(encodeBuffer_); #ifdef TEST if (result < 0) { *logofs << "Proxy: Failed to handle splits for FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; } #endif timeouts_.splitTs = nullTimestamp(); setSplitTimeout(channelId); } #if defined(TEST) || defined(INFO) || defined(SPLIT) else if (channels_[channelId] -> needSplit() == 1 && isTimestamp(timeouts_.splitTs) == 0) { *logofs << "Proxy: SPLIT! WARNING! Channel for FD#" << getFd(channelId) << " has split to send but " << "there is no timeout.\n" << logofs_flush; } else if (isTimestamp(timeouts_.splitTs) == 1) { *logofs << "Proxy: SPLIT! Running with " << diffTimestamp(timeouts_.splitTs, getTimestamp()) << " ms elapsed since the last split.\n" << logofs_flush; } #endif } if (result < 0) { #ifdef TEST *logofs << "Proxy: Error handling events for FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; #endif if (handleFinish(channelId) < 0) { return -1; } } } return 1; } int Proxy::handleFrame(T_frame_type type) { // // Write any outstanding control message, followed by the // content of the encode buffer, to the proxy transport. // // This code assumes that the encode buffer data is at an // offset several bytes from start of the buffer, so that // the length header and any necessary control bytes can // be inserted in front of the data already in the buffer. // This is the easiest way to encapsulate header and data // together in a single frame. // // The way framing is implemented is very efficient but // inherently limited and does not allow for getting the // best performance, especially when running over a fast // link. Framing should be rewritten to include the length // of the packets in a fixed size header and, possibly, // to incapsulate the control messages and the channel's // data in a pseudo X protocol message, so that the proxy // itself would be treated like any other channel. // #if defined(TEST) || defined(INFO) if (congestion_ == 1) { // // This can happen because there may be control // messages to send, like a proxy shutdown mes- // sage or a statistics request. All the other // cases should be considered an error. // #ifdef WARNING *logofs << "Proxy: WARNING! Data is to be sent while " << "congestion is " << congestion_ << ".\n" << logofs_flush; #endif } #endif // // Check if there is any data available on // the socket. Recent Linux kernels are very // picky. They require that we read often or // they assume that the process is non-inter- // active. // if (handleAsyncEvents() < 0) { return -1; } // // Check if this is a ping, not a data frame. // if (type == frame_ping) { if (handleToken(frame_ping) < 0) { return -1; } } unsigned int dataLength = encodeBuffer_.getLength(); #ifdef DEBUG *logofs << "Proxy: Data length is " << dataLength << " control length is " << controlLength_ << ".\n" << logofs_flush; #endif if (dataLength > 0) { // // If this is a generic channel we need // to add the completion bits. Data can // also have been encoded because of a // statistics request, even if no output // channel was currently selected. // if (outputChannel_ != -1) { #if defined(TEST) || defined(INFO) if (channels_[outputChannel_] == NULL) { *logofs << "Proxy: PANIC! A new frame was requested " << "but the channel is invalid.\n" << logofs_flush; HandleCleanup(); } #endif channels_[outputChannel_] -> handleCompletion(encodeBuffer_); dataLength = encodeBuffer_.getLength(); } } else if (controlLength_ == 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: PANIC! A new frame was requested " << "but there is no data to write.\n" << logofs_flush; HandleCleanup(); #endif return 0; } #ifdef DEBUG *logofs << "Proxy: Data length is now " << dataLength << " control length is " << controlLength_ << ".\n" << logofs_flush; #endif // // Check if this frame needs to carry a new // token request. // if (type == frame_data) { if (handleToken(frame_data) < 0) { return -1; } } #ifdef DEBUG *logofs << "Proxy: Adding a new frame for the remote proxy.\n" << logofs_flush; #endif unsigned char temp[5]; unsigned int lengthLength = 0; unsigned int shift = dataLength; while (shift) { temp[lengthLength++] = (unsigned char) (shift & 0x7f); shift >>= 7; } unsigned char *data = encodeBuffer_.getData(); unsigned char *outputMessage = data - (controlLength_ + lengthLength); unsigned char *nextDest = outputMessage; for (int i = 0; i < controlLength_; i++) { *nextDest++ = controlCodes_[i]; } for (int j = lengthLength - 1; j > 0; j--) { *nextDest++ = (temp[j] | 0x80); } if (lengthLength) { *nextDest++ = temp[0]; } unsigned int outputLength = dataLength + controlLength_ + lengthLength; #if defined(TEST) || defined(INFO) *logofs << "Proxy: Produced plain output for " << dataLength << "+" << controlLength_ << "+" << lengthLength << " out of " << outputLength << " bytes.\n" << logofs_flush; #endif #if defined(TEST) || defined(INFO) || defined(FLUSH) || defined(TIME) T_timestamp nowTs = getTimestamp(); *logofs << "Proxy: FLUSH! Immediate with blocked " << transport_ -> blocked() << " length " << transport_ -> length() << " new " << outputLength << " flushable " << transport_ -> flushable() << " tokens " << tokens_[token_control].remaining << " after " << diffTimestamp(timeouts_.writeTs, nowTs) << " ms.\n" << logofs_flush; *logofs << "Proxy: FLUSH! Immediate flush to proxy FD#" << fd_ << " of " << outputLength << " bytes at " << strMsTimestamp() << " with priority " << priority_ << ".\n" << logofs_flush; *logofs << "Proxy: FLUSH! Current bitrate is " << statistics -> getBitrateInShortFrame() << " with " << statistics -> getBitrateInLongFrame() << " in the " << "long frame and top " << statistics -> getTopBitrate() << ".\n" << logofs_flush; #endif statistics -> addWriteOut(); int result = transport_ -> write(write_immediate, outputMessage, outputLength); #ifdef TIME if (diffTimestamp(timeouts_.writeTs, nowTs) > 50) { *logofs << "Proxy: WARNING! TIME! Data written to proxy FD#" << fd_ << " at " << strMsTimestamp() << " after " << diffTimestamp(timeouts_.writeTs, nowTs) << " ms.\n" << logofs_flush; } #endif #ifdef DUMP *logofs << "Proxy: Sent " << outputLength << " bytes of data " << "with checksum "; DumpChecksum(outputMessage, outputLength); *logofs << " on proxy FD#" << fd_ << ".\n" << logofs_flush; #endif #ifdef DUMP *logofs << "Proxy: Partial checksums are:\n"; DumpBlockChecksums(outputMessage, outputLength, 256); *logofs << logofs_flush; #endif // // Clean up the encode buffer and // bring it to the initial size. // encodeBuffer_.fullReset(); // // Close the connection if we got // an error. // if (result < 0) { #ifdef TEST *logofs << "Proxy: Failed write to proxy FD#" << fd_ << ".\n" << logofs_flush; #endif return -1; } // // Account for the data frame and the // framing overhead. // if (dataLength > 0) { statistics -> addFrameOut(); } statistics -> addFramingBits((controlLength_ + lengthLength) << 3); controlLength_ = 0; // // Reset all buffers, counters and the // priority flag. // handleResetFlush(); // // Check if more data became available // after writing. // if (handleAsyncEvents() < 0) { return -1; } // // Drain the proxy link if we are in // congestion state. // // if (needDrain() == 1 && draining_ == 0) // { // if (handleDrain() < 0) // { // return -1; // } // } // return result; } int Proxy::handleFlush() { // // We can have data in the encode buffer or // control bytes to send. In the case make // up a new frame. // if (encodeBuffer_.getLength() + controlLength_ > 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Flushing data in the encode buffer.\n" << logofs_flush; #endif priority_ = 1; if (handleFrame(frame_data) < 0) { return -1; } } // // Check if we have something to write. // if (transport_ -> length() + transport_ -> flushable() == 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Nothing else to flush for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif return 0; } #if defined(TEST) || defined(INFO) if (transport_ -> blocked() == 0) { #ifdef PANIC *logofs << "Proxy: PANIC! Proxy descriptor FD#" << fd_ << " has data to flush but the transport " << "is not blocked.\n" << logofs_flush; #endif cerr << "Error" << ": Proxy descriptor FD#" << fd_ << " has data to flush but the transport " << "is not blocked.\n"; HandleCleanup(); } #endif #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "Proxy: FLUSH! Deferred with blocked " << transport_ -> blocked() << " length " << transport_ -> length() << " flushable " << transport_ -> flushable() << " tokens " << tokens_[token_control].remaining << ".\n" << logofs_flush; *logofs << "Proxy: FLUSH! Deferred flush to proxy FD#" << fd_ << " of " << transport_ -> length() + transport_ -> flushable() << " bytes at " << strMsTimestamp() << " with priority " << priority_ << ".\n" << logofs_flush; *logofs << "Proxy: FLUSH! Current bitrate is " << statistics -> getBitrateInShortFrame() << " with " << statistics -> getBitrateInLongFrame() << " in the " << "long frame and top " << statistics -> getTopBitrate() << ".\n" << logofs_flush; #endif statistics -> addWriteOut(); int result = transport_ -> flush(); if (result < 0) { return -1; } // // Reset the counters and update the // timestamp of the last write. // handleResetFlush(); return result; } int Proxy::handleDrain() { // // If the proxy is run in the same process // as SSH, we can't block or the program // would not have a chance to read or write // its data. // if (control -> LinkEncrypted == 1) { return 0; } if (needDrain() == 0 || draining_ == 1) { #if defined(TEST) || defined(INFO) if (draining_ == 1) { *logofs << "Proxy: WARNING! Already draining proxy FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; } else { *logofs << "Proxy: WARNING! No need to drain proxy FD#" << fd_ << " with congestion " << congestion_ << " length " << transport_ -> length() << " and blocked " << transport_ -> blocked() << ".\n" << logofs_flush; } #endif return 0; } draining_ = 1; #if defined(TEST) || defined(INFO) *logofs << "Proxy: Going to drain the proxy FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif int timeout = control -> PingTimeout / 2; T_timestamp startTs = getNewTimestamp(); T_timestamp nowTs = startTs; int remaining; int result; // // Keep draining the proxy socket while // reading the incoming messages until // the timeout is expired. // for (;;) { remaining = timeout - diffTimestamp(startTs, nowTs); if (remaining <= 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Timeout raised while draining " << "FD#" << fd_ << " at " << strMsTimestamp() << " after " << diffTimestamp(startTs, nowTs) << " ms.\n" << logofs_flush; #endif result = 0; goto ProxyDrainEnd; } if (transport_ -> length() > 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Trying to write to FD#" << fd_ << " at " << strMsTimestamp() << " with length " << transport_ -> length() << " and " << remaining << " ms remaining.\n" << logofs_flush; #endif result = transport_ -> drain(0, remaining); if (result == -1) { result = -1; goto ProxyDrainEnd; } else if (result == 0 && transport_ -> readable() > 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Decoding more data from proxy FD#" << fd_ << " at " << strMsTimestamp() << " with " << transport_ -> length() << " bytes to write and " << transport_ -> readable() << " readable.\n" << logofs_flush; #endif if (handleRead() < 0) { result = -1; goto ProxyDrainEnd; } } #if defined(TEST) || defined(INFO) else if (result == 1) { *logofs << "Proxy: Transport for proxy FD#" << fd_ << " drained down to " << transport_ -> length() << " bytes.\n" << logofs_flush; } #endif } else { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Waiting for more data from proxy " << "FD#" << fd_ << " at " << strMsTimestamp() << " with " << remaining << " ms remaining.\n" << logofs_flush; #endif result = transport_ -> wait(remaining); if (result == -1) { result = -1; goto ProxyDrainEnd; } else if (result > 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Decoding more data from proxy FD#" << fd_ << " at " << strMsTimestamp() << " with " << transport_ -> readable() << " bytes readable.\n" << logofs_flush; #endif if (handleRead() < 0) { result = -1; goto ProxyDrainEnd; } } } // // Check if we finally got the tokens // that would allow us to come out of // the congestion state. // if (needDrain() == 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Got decongestion for proxy FD#" << fd_ << " at " << strMsTimestamp() << " after " << diffTimestamp(startTs, getTimestamp()) << " ms.\n" << logofs_flush; #endif result = 1; goto ProxyDrainEnd; } nowTs = getNewTimestamp(); } ProxyDrainEnd: draining_ = 0; return result; } int Proxy::handleFlush(int fd) { int channelId = getChannel(fd); if (channelId < 0 || channels_[channelId] == NULL) { #ifdef TEST *logofs << "Proxy: WARNING! Skipping flush on invalid " << "descriptor FD#" << fd << " channel ID#" << channelId << ".\n" << logofs_flush; #endif return 0; } else if (channels_[channelId] -> getFinish() == 1) { #ifdef TEST *logofs << "Proxy: Skipping flush on finishing " << "descriptor FD#" << fd << " channel ID#" << channelId << ".\n" << logofs_flush; #endif return 0; } #ifdef TEST *logofs << "Proxy: Going to flush FD#" << fd << " with blocked " << transports_[channelId] -> blocked() << " length " << transports_[channelId] -> length() << ".\n" << logofs_flush; #endif if (channels_[channelId] -> handleFlush() < 0) { #ifdef TEST *logofs << "Proxy: Failed to flush data to FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; #endif handleFinish(channelId); return -1; } return 1; } int Proxy::handleStatistics(int type, ostream *stream) { if (stream == NULL || control -> EnableStatistics == 0) { #ifdef WARNING *logofs << "Proxy: WARNING! Cannot produce statistics " << " for proxy FD#" << fd_ << ". Invalid settings " << "for statistics or stream.\n" << logofs_flush; #endif return 0; } else if (currentStatistics_ != NULL) { // // Need to update the stream pointer as the // previous one could have been destroyed. // #ifdef WARNING *logofs << "Proxy: WARNING! Replacing stream while producing " << "statistics in stream at " << currentStatistics_ << " for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif } currentStatistics_ = stream; // // Get statistics of remote peer. // if (handleControl(code_statistics_request, type) < 0) { return -1; } return 1; } int Proxy::handleStatisticsFromProxy(int type) { if (needFlush() == 1) { #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "Proxy: WARNING! Data for the previous " << "channel ID#" << outputChannel_ << " flushed in statistics.\n" << logofs_flush; #endif if (handleFrame(frame_data) < 0) { return -1; } } if (control -> EnableStatistics == 1) { // // Allocate a buffer for the output. // char *buffer = new char[STATISTICS_LENGTH]; *buffer = '\0'; if (control -> ProxyMode == proxy_client) { #ifdef TEST *logofs << "Proxy: Producing " << (type == TOTAL_STATS ? "total" : "partial") << " client statistics for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif statistics -> getClientProtocolStats(type, buffer); statistics -> getClientOverallStats(type, buffer); } else { #ifdef TEST *logofs << "Proxy: Producing " << (type == TOTAL_STATS ? "total" : "partial") << " server statistics for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif statistics -> getServerProtocolStats(type, buffer); } if (type == PARTIAL_STATS) { statistics -> resetPartialStats(); } unsigned int length = strlen((char *) buffer) + 1; encodeBuffer_.encodeValue(type, 8); encodeBuffer_.encodeValue(length, 32); #ifdef TEST *logofs << "Proxy: Encoding " << length << " bytes of statistics data for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif encodeBuffer_.encodeMemory((unsigned char *) buffer, length); // // Account statistics data as framing bits. // statistics -> addFramingBits(length << 3); delete [] buffer; } else { #ifdef WARNING *logofs << "Proxy: WARNING! Got statistics request " << "but local statistics are disabled.\n" << logofs_flush; #endif cerr << "Warning" << ": Got statistics request " << "but local statistics are disabled.\n"; type = NO_STATS; encodeBuffer_.encodeValue(type, 8); #ifdef TEST *logofs << "Proxy: Sending error code to remote proxy on FD#" << fd_ << ".\n" << logofs_flush; #endif } // // The next write will flush the statistics // data and the control message. // if (handleControl(code_statistics_reply, type) < 0) { return -1; } return 1; } int Proxy::handleStatisticsFromProxy(const unsigned char *message, unsigned int length) { if (currentStatistics_ == NULL) { #ifdef WARNING *logofs << "Proxy: WARNING! Unexpected statistics data received " << "from remote proxy on FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Warning" << ": Unexpected statistics data received " << "from remote proxy.\n"; return 0; } // // Allocate the decode buffer and at least // the 'type' field to see if there was an // error. // DecodeBuffer decodeBuffer(message, length); unsigned int type; decodeBuffer.decodeValue(type, 8); if (type == NO_STATS) { #ifdef PANIC *logofs << "Proxy: PANIC! Couldn't get statistics from remote " << "proxy on FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": Couldn't get statistics from remote proxy.\n"; } else if (type != TOTAL_STATS && type != PARTIAL_STATS) { #ifdef PANIC *logofs << "Proxy: PANIC! Cannot produce statistics " << "with qualifier '" << type << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Cannot produce statistics " << "with qualifier '" << type << "'.\n"; return -1; } else { unsigned int size; decodeBuffer.decodeValue(size, 32); char *buffer = new char[STATISTICS_LENGTH]; *buffer = '\0'; if (control -> EnableStatistics == 1) { if (control -> ProxyMode == proxy_client) { #ifdef TEST *logofs << "Proxy: Finalizing " << (type == TOTAL_STATS ? "total" : "partial") << " client statistics for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif statistics -> getClientCacheStats(type, buffer); #ifdef TEST *logofs << "Proxy: Decoding " << size << " bytes of statistics data for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif strncat(buffer, (char *) decodeBuffer.decodeMemory(size), size); statistics -> getClientProtocolStats(type, buffer); statistics -> getClientOverallStats(type, buffer); } else { #ifdef TEST *logofs << "Proxy: Finalizing " << (type == TOTAL_STATS ? "total" : "partial") << " server statistics for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif statistics -> getServerCacheStats(type, buffer); statistics -> getServerProtocolStats(type, buffer); #ifdef TEST *logofs << "Proxy: Decoding " << size << " bytes of statistics data for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif strncat(buffer, (char *) decodeBuffer.decodeMemory(size), size); } if (type == PARTIAL_STATS) { statistics -> resetPartialStats(); } *currentStatistics_ << buffer; // // Mark the end of text to help external parsing. // *currentStatistics_ << '\4'; *currentStatistics_ << flush; } else { // // It can be that statistics were enabled at the time // we issued the request (otherwise we could not have // set the stream), but now they have been disabled // by user. We must decode statistics data if we want // to keep the connection. // #ifdef TEST *logofs << "Proxy: Discarding " << size << " bytes of statistics data for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif strncat(buffer, (char *) decodeBuffer.decodeMemory(size), size); } delete [] buffer; } currentStatistics_ = NULL; return 1; } int Proxy::handleNegotiation(const unsigned char *message, unsigned int length) { #ifdef PANIC *logofs << "Proxy: PANIC! Writing data during proxy " << "negotiation is not implemented.\n" << logofs_flush; #endif cerr << "Error" << ": Writing data during proxy " << "negotiation is not implemented.\n"; return -1; } int Proxy::handleNegotiationFromProxy(const unsigned char *message, unsigned int length) { #ifdef PANIC *logofs << "Proxy: PANIC! Reading data during proxy " << "negotiation is not implemented.\n" << logofs_flush; #endif cerr << "Error" << ": Reading data during proxy " << "negotiation is not implemented.\n"; return -1; } int Proxy::handleAlert(int alert) { if (handleControl(code_alert_request, alert) < 0) { return -1; } return 1; } int Proxy::handleCloseConnection(int clientFd) { int channelId = getChannel(clientFd); if (channels_[channelId] != NULL && channels_[channelId] -> getFinish() == 0) { #ifdef TEST *logofs << "Proxy: Closing down the channel for FD#" << clientFd << ".\n" << logofs_flush; #endif if (handleFinish(channelId) < 0) { return -1; } return 1; } return 0; } int Proxy::handleCloseAllXConnections() { #ifdef TEST *logofs << "Proxy: Closing down any remaining X channel.\n" << logofs_flush; #endif T_list &channelList = activeChannels_.getList(); for (T_list::iterator j = channelList.begin(); j != channelList.end(); j++) { int channelId = *j; if (channels_[channelId] != NULL && channels_[channelId] -> getType() == channel_x11 && channels_[channelId] -> getFinish() == 0) { #ifdef TEST *logofs << "Proxy: Closing down the channel for FD#" << getFd(channelId) << ".\n" << logofs_flush; #endif if (handleFinish(channelId) < 0) { return -1; } } } return 1; } int Proxy::handleCloseAllListeners() { // Since ProtoStep7 (#issue 108) if (finish_ == 0) { #ifdef TEST *logofs << "Proxy: Closing down all remote listeners.\n" << logofs_flush; #endif if (handleControl(code_finish_listeners) < 0) { return -1; } finish_ = 1; } return 1; } void Proxy::handleResetAlert() { if (alert_ != 0) { #ifdef TEST *logofs << "Proxy: The proxy alert '" << alert_ << "' was displaced.\n" << logofs_flush; #endif alert_ = 0; } T_list &channelList = activeChannels_.getList(); for (T_list::iterator j = channelList.begin(); j != channelList.end(); j++) { int channelId = *j; if (channels_[channelId] != NULL) { channels_[channelId] -> handleResetAlert(); } } } int Proxy::handleFinish(int channelId) { // // Send any outstanding encoded data and // do any finalization needed on the // channel. // if (needFlush(channelId) == 1) { if (channels_[channelId] -> getFinish() == 1) { #ifdef WARNING *logofs << "Proxy: WARNING! The finishing channel ID#" << channelId << " has data to flush.\n" << logofs_flush; #endif } #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "Proxy: WARNING! Flushing data for the " << "finishing channel ID#" << channelId << ".\n" << logofs_flush; #endif if (handleFrame(frame_data) < 0) { return -1; } } // // Reset the congestion state and the // timeouts, if needed. // congestions_[channelId] = 0; setSplitTimeout(channelId); setMotionTimeout(channelId); if (channels_[channelId] -> getFinish() == 0) { channels_[channelId] -> handleFinish(); // // Force a failure in the case somebody // would try to read from the channel. // shutdown(getFd(channelId), SHUT_RD); // // If the failure was not originated by // the remote, send a channel shutdown // message. // if (channels_[channelId] -> getClosing() == 0) { #ifdef TEST *logofs << "Proxy: Finishing channel for FD#" << getFd(channelId) << " channel ID#" << channelId << " because of failure.\n" << logofs_flush; #endif if (handleControl(code_finish_connection, channelId) < 0) { return -1; } } } return 1; } int Proxy::handleFinishFromProxy(int channelId) { // // Check if this channel has pending // data to send. // if (needFlush(channelId) == 1) { #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "Proxy: WARNING! Flushing data for the " << "finishing channel ID#" << channelId << ".\n" << logofs_flush; #endif if (handleFrame(frame_data) < 0) { return -1; } } // // Mark the channel. We will free its // resources at the next loop and will // send the drop message to the remote. // if (channels_[channelId] -> getClosing() == 0) { #ifdef TEST *logofs << "Proxy: Marking channel for FD#" << getFd(channelId) << " channel ID#" << channelId << " as closing.\n" << logofs_flush; #endif channels_[channelId] -> handleClosing(); } if (channels_[channelId] -> getFinish() == 0) { #ifdef TEST *logofs << "Proxy: Finishing channel for FD#" << getFd(channelId) << " channel ID#" << channelId << " because of proxy.\n" << logofs_flush; #endif channels_[channelId] -> handleFinish(); } if (handleFinish(channelId) < 0) { return -1; } return 1; } int Proxy::handleDropFromProxy(int channelId) { // // Only mark the channel. // #ifdef TEST *logofs << "Proxy: Marking channel for FD#" << getFd(channelId) << " channel ID#" << channelId << " as being dropped.\n" << logofs_flush; #endif if (channels_[channelId] -> getDrop() == 0) { channels_[channelId] -> handleDrop(); } return 1; } // // Close the channel and deallocate all its // resources. // int Proxy::handleDrop(int channelId) { // // Check if this channel has pending // data to send. // if (needFlush(channelId) == 1) { if (channels_[channelId] -> getFinish() == 1) { #ifdef WARNING *logofs << "Proxy: WARNING! The dropping channel ID#" << channelId << " has data to flush.\n" << logofs_flush; #endif } #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "Proxy: WARNING! Flushing data for the " << "dropping channel ID#" << channelId << ".\n" << logofs_flush; #endif if (handleFrame(frame_data) < 0) { return -1; } } #ifdef TEST *logofs << "Proxy: Dropping channel for FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; #endif if (channels_[channelId] -> getFinish() == 0) { #ifdef WARNING *logofs << "Proxy: WARNING! The channel for FD#" << getFd(channelId) << " channel ID#" << channelId << " was not marked as " << "finishing.\n" << logofs_flush; #endif cerr << "Warning" << ": The channel for FD#" << getFd(channelId) << " channel ID#" << channelId << " was not marked as " << "finishing.\n"; channels_[channelId] -> handleFinish(); } // // Send the channel shutdown message // to the peer proxy. // if (channels_[channelId] -> getClosing() == 1) { if (handleControl(code_drop_connection, channelId) < 0) { return -1; } } // // Get rid of the channel. // if (channels_[channelId] -> getType() != channel_x11) { #ifdef TEST *logofs << "Proxy: Closed connection to " << getTypeName(channels_[channelId] -> getType()) << " server.\n" << logofs_flush; #endif cerr << "Info" << ": Closed connection to " << getTypeName(channels_[channelId] -> getType()) << " server.\n"; } delete channels_[channelId]; channels_[channelId] = NULL; cleanupChannelMap(channelId); // // Get rid of the transport. // deallocateTransport(channelId); congestions_[channelId] = 0; decreaseChannels(channelId); // // Check if the channel was the // one currently selected for // output. // if (outputChannel_ == channelId) { outputChannel_ = -1; } return 1; } // // Send an empty message to the remote peer // to verify if the link is alive and let // the remote proxy detect a congestion. // int Proxy::handlePing() { T_timestamp nowTs = getTimestamp(); #if defined(DEBUG) || defined(PING) *logofs << "Proxy: Checking ping at " << strMsTimestamp(nowTs) << logofs_flush; *logofs << " with last loop at " << strMsTimestamp(timeouts_.loopTs) << ".\n" << logofs_flush; *logofs << "Proxy: Last bytes in at " << strMsTimestamp(timeouts_.readTs) << logofs_flush; *logofs << " last bytes out at " << strMsTimestamp(timeouts_.writeTs) << ".\n" << logofs_flush; *logofs << "Proxy: Last ping at " << strMsTimestamp(timeouts_.pingTs) << ".\n" << logofs_flush; #endif // // Be sure we take into account any clock drift. This // can be caused by the user changing the system timer // or by small adjustments introduced by the operating // system making the clock go backward. // if (checkDiffTimestamp(timeouts_.loopTs, nowTs) == 0) { #ifdef WARNING *logofs << "Proxy: WARNING! Detected drift in system " << "timer. Resetting to current time.\n" << logofs_flush; #endif timeouts_.pingTs = nowTs; timeouts_.readTs = nowTs; timeouts_.writeTs = nowTs; } // // Check timestamp of last read from remote proxy. It can // happen that we stayed in the main loop long enough to // have idle timeout expired, for example if the proxy was // stopped and restarted or because of an extremely high // load of the system. In this case we don't complain if // there is something new to read from the remote. // int diffIn = diffTimestamp(timeouts_.readTs, nowTs); if (diffIn >= (control -> PingTimeout * 2) - control -> LatencyTimeout) { // // Force a read to detect whether the remote proxy // aborted the connection. // int result = handleRead(); if (result < 0) { #if defined(TEST) || defined(INFO) || defined(PING) *logofs << "Proxy: WARNING! Detected shutdown waiting " << "for the ping after " << diffIn / 1000 << " seconds.\n" << logofs_flush; #endif return -1; } else if (result > 0) { diffIn = diffTimestamp(timeouts_.readTs, nowTs); if (handleFlush() < 0) { return -1; } } } if (diffIn >= (control -> PingTimeout * 2) - control -> LatencyTimeout) { #if defined(TEST) || defined(INFO) || defined(PING) *logofs << "Proxy: Detected congestion at " << strMsTimestamp() << " with " << diffIn / 1000 << " seconds since the last read.\n" << logofs_flush; #endif // // There are two types of proxy congestion. The first, // affecting the ability of the proxy to write the // encoded data to the network, is controlled by the // congestion_ flag. The flag is raised when no data // is received from the remote proxy within a timeout. // On the X client side, the flag is also raised when // the proxy runs out of tokens. // if (control -> ProxyMode == proxy_server) { // // At X server side we must return to read data // from the channels after a while, because we // need to give a chance to the channel to read // the key sequence CTRL+ALT+SHIFT+ESC. // if (congestion_ == 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Forcibly entering congestion due to " << "timeout with " << tokens_[token_control].remaining << " tokens.\n" << logofs_flush; #endif congestion_ = 1; } else { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Forcibly exiting congestion due to " << "timeout with " << tokens_[token_control].remaining << " tokens.\n" << logofs_flush; #endif congestion_ = 0; } } else { #if defined(TEST) || defined(INFO) if (congestion_ == 0) { *logofs << "Proxy: Entering congestion due to timeout " << "with " << tokens_[token_control].remaining << " tokens.\n" << logofs_flush; } #endif congestion_ = 1; } if (control -> ProxyTimeout > 0 && diffIn >= (control -> ProxyTimeout - control -> LatencyTimeout)) { #ifdef PANIC *logofs << "Proxy: PANIC! No data received from " << "remote proxy on FD#" << fd_ << " within " << (diffIn + control -> LatencyTimeout) / 1000 << " seconds.\n" << logofs_flush; #endif cerr << "Error" << ": No data received from remote " << "proxy within " << (diffIn + control -> LatencyTimeout) / 1000 << " seconds.\n"; HandleAbort(); } else { #if defined(TEST) || defined(INFO) *logofs << "Proxy: WARNING! No data received from " << "remote proxy on FD#" << fd_ << " since " << diffIn << " ms.\n" << logofs_flush; #endif if (control -> ProxyTimeout > 0 && isTimestamp(timeouts_.alertTs) == 0 && diffIn >= (control -> ProxyTimeout - control -> LatencyTimeout) / 4) { // // If we are in the middle of a shutdown // procedure but the remote is not resp- // onding, force the closure of the link. // if (finish_ != 0) { #ifdef PANIC *logofs << "Proxy: PANIC! No response received from " << "the remote proxy on FD#" << fd_ << " while " << "waiting for the shutdown.\n" << logofs_flush; #endif cerr << "Error" << ": No response received from remote " << "proxy while waiting for the shutdown.\n"; HandleAbort(); } else { cerr << "Warning" << ": No data received from remote " << "proxy within " << (diffIn + control -> LatencyTimeout) / 1000 << " seconds.\n"; if (alert_ == 0) { if (control -> ProxyMode == proxy_client) { alert_ = CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT; } else { alert_ = CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT; } HandleAlert(alert_, 1); } timeouts_.alertTs = nowTs; } } } } // // Check if we need to update the congestion // counter. // int diffOut = diffTimestamp(timeouts_.writeTs, nowTs); if (agent_ != nothing && congestions_[agent_] == 0 && statistics -> getCongestionInFrame() >= 1 && diffOut >= (control -> IdleTimeout - control -> LatencyTimeout * 5)) { #if defined(TEST) || defined(INFO) || defined(PING) *logofs << "Proxy: Forcing an update of the " << "congestion counter after timeout.\n" << logofs_flush; #endif statistics -> updateCongestion(tokens_[token_control].remaining, tokens_[token_control].limit); } // // Send a new token if we didn't send any data to // the remote for longer than the ping timeout. // The client side sends a token, the server side // responds with a token reply. // // VMWare virtual machines can have the system // timer deadly broken. Try to send a ping regard- // less we are the client or the server proxy to // force a write by the remote. // if (control -> ProxyMode == proxy_client || diffIn >= (control -> PingTimeout * 4) - control -> LatencyTimeout) { // // We need to send a new ping even if we didn't // receive anything from the remote within the // ping timeout. The server side will respond // to our ping, so we use the ping to force the // remote end to send some data. // if (diffIn >= (control -> PingTimeout - control -> LatencyTimeout * 5) || diffOut >= (control -> PingTimeout - control -> LatencyTimeout * 5)) { int diffPing = diffTimestamp(timeouts_.pingTs, nowTs); if (diffPing < 0 || diffPing >= (control -> PingTimeout - control -> LatencyTimeout * 5)) { #if defined(TEST) || defined(INFO) || defined(PING) *logofs << "Proxy: Sending a new ping at " << strMsTimestamp() << " with " << tokens_[token_control].remaining << " tokens and elapsed in " << diffIn << " out " << diffOut << " ping " << diffPing << ".\n" << logofs_flush; #endif if (handleFrame(frame_ping) < 0) { return -1; } timeouts_.pingTs = nowTs; } #if defined(TEST) || defined(INFO) || defined(PING) else { *logofs << "Proxy: Not sending a new ping with " << "elapsed in " << diffIn << " out " << diffOut << " ping " << diffPing << ".\n" << logofs_flush; } #endif } } return 1; } int Proxy::handleSyncFromProxy(int channelId) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: WARNING! Received a synchronization " << "request from the remote proxy.\n" << logofs_flush; #endif if (handleControl(code_sync_reply, channelId) < 0) { return -1; } return 1; } int Proxy::handleResetStores() { // // Recreate the message stores. // delete clientStore_; delete serverStore_; clientStore_ = new ClientStore(compressor_); serverStore_ = new ServerStore(compressor_); timeouts_.loadTs = nullTimestamp(); // // Replace message stores in channels. // T_list &channelList = activeChannels_.getList(); for (T_list::iterator j = channelList.begin(); j != channelList.end(); j++) { int channelId = *j; if (channels_[channelId] != NULL) { if (channels_[channelId] -> setStores(clientStore_, serverStore_) < 0) { #ifdef PANIC *logofs << "Proxy: PANIC! Failed to replace message stores in " << "channel for FD#" << getFd(channelId) << ".\n" << logofs_flush; #endif cerr << "Error" << ": Failed to replace message stores in " << "channel for FD#" << getFd(channelId) << ".\n"; return -1; } #ifdef TEST else { *logofs << "Proxy: Replaced message stores in channel " << "for FD#" << getFd(channelId) << ".\n" << logofs_flush; } #endif } } return 1; } int Proxy::handleResetPersistentCache() { char *fullName = new char[strlen(control -> PersistentCachePath) + strlen(control -> PersistentCacheName) + 2]; strcpy(fullName, control -> PersistentCachePath); strcat(fullName, "/"); strcat(fullName, control -> PersistentCacheName); #ifdef TEST *logofs << "Proxy: Going to remove persistent cache file '" << fullName << "'\n" << logofs_flush; #endif unlink(fullName); delete [] fullName; delete [] control -> PersistentCacheName; control -> PersistentCacheName = NULL; return 1; } void Proxy::handleResetFlush() { #ifdef TEST *logofs << "Proxy: Going to reset flush counters " << "for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif // // Reset the proxy priority flag. // priority_ = 0; // // Restore buffers to their initial // size. // transport_ -> partialReset(); // // Update the timestamp of the last // write operation performed on the // socket. // timeouts_.writeTs = getTimestamp(); } int Proxy::handleFinish() { // // Reset the timestamps to give the proxy // another chance to show the 'no response' // dialog if the shutdown message doesn't // come in time. // timeouts_.readTs = getTimestamp(); timeouts_.alertTs = nullTimestamp(); finish_ = 1; return 1; } int Proxy::handleShutdown() { // // Send shutdown message to remote proxy. // shutdown_ = 1; handleControl(code_shutdown_request); #ifdef TEST *logofs << "Proxy: Starting shutdown procedure " << "for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif // // Ensure that all the data accumulated // in the transport buffer is flushed // to the network layer. // for (int i = 0; i < 100; i++) { if (canFlush() == 1) { handleFlush(); } else { break; } usleep(100000); } // // Now wait for the network layers to // consume all the data. // for (int i = 0; i < 100; i++) { if (transport_ -> queued() <= 0) { break; } usleep(100000); } // // Give time to the remote end to read // the shutdown message and close the // connection. // transport_ -> wait(10000); #ifdef TEST *logofs << "Proxy: Ending shutdown procedure " << "for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif return 1; } int Proxy::handleChannelConfiguration() { if (activeChannels_.getSize() == 0) { #ifdef TEST *logofs << "Proxy: Going to initialize the static " << "members in channels for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif Channel::setReferences(); ClientChannel::setReferences(); ServerChannel::setReferences(); GenericChannel::setReferences(); } return 1; } int Proxy::handleSocketConfiguration() { // // Set linger mode on proxy to correctly // get shutdown notification. // SetLingerTimeout(fd_, 30); // // Set keep-alive on socket so that if remote link // terminates abnormally (as killed hard or because // of a power-off) process will get a SIGPIPE. In // practice this is useless as proxies already ping // each other every few seconds. // if (control -> OptionProxyKeepAlive == 1) { SetKeepAlive(fd_); } // // Set 'priority' flag at TCP layer for path // proxy-to-proxy. Look at IPTOS_LOWDELAY in // man 7 ip. // if (control -> OptionProxyLowDelay == 1) { SetLowDelay(fd_); } // // Update size of TCP send and receive buffers. // if (control -> OptionProxySendBuffer != -1) { SetSendBuffer(fd_, control -> OptionProxySendBuffer); } if (control -> OptionProxyReceiveBuffer != -1) { SetReceiveBuffer(fd_, control -> OptionProxyReceiveBuffer); } // // Update TCP_NODELAY settings. Note that on old Linux // kernels turning off the Nagle algorithm didn't work // when proxy was run through a PPP link. Trying to do // so caused the kernel to stop delivering data to us // if a serious network congestion was encountered. // if (control -> ProxyMode == proxy_client) { if (control -> OptionProxyClientNoDelay != -1) { SetNoDelay(fd_, control -> OptionProxyClientNoDelay); } } else { if (control -> OptionProxyServerNoDelay != -1) { SetNoDelay(fd_, control -> OptionProxyServerNoDelay); } } return 1; } int Proxy::handleLinkConfiguration() { #ifdef TEST *logofs << "Proxy: Propagating parameters to " << "channels' read buffers.\n" << logofs_flush; #endif T_list &channelList = activeChannels_.getList(); for (T_list::iterator j = channelList.begin(); j != channelList.end(); j++) { int channelId = *j; if (channels_[channelId] != NULL) { channels_[channelId] -> handleConfiguration(); } } #ifdef TEST *logofs << "Proxy: Propagating parameters to " << "proxy buffers.\n" << logofs_flush; #endif readBuffer_.setSize(control -> ProxyInitialReadSize, control -> ProxyMaximumBufferSize); encodeBuffer_.setSize(control -> TransportProxyBufferSize, control -> TransportProxyBufferThreshold, control -> TransportMaximumBufferSize); transport_ -> setSize(control -> TransportProxyBufferSize, control -> TransportProxyBufferThreshold, control -> TransportMaximumBufferSize); #ifdef TEST *logofs << "Proxy: Configuring the proxy timeouts.\n" << logofs_flush; #endif timeouts_.split = control -> SplitTimeout; timeouts_.motion = control -> MotionTimeout; #ifdef TEST *logofs << "Proxy: Configuring the proxy tokens.\n" << logofs_flush; #endif tokens_[token_control].size = control -> TokenSize; tokens_[token_control].limit = control -> TokenLimit; if (tokens_[token_control].limit < 1) { tokens_[token_control].limit = 1; } #if defined(TEST) || defined(INFO) || defined(LIMIT) *logofs << "Proxy: TOKEN! LIMIT! Setting token [" << DumpToken(token_control) << "] size to " << tokens_[token_control].size << " and limit to " << tokens_[token_control].limit << ".\n" << logofs_flush; #endif tokens_[token_split].size = control -> TokenSize; tokens_[token_split].limit = control -> TokenLimit / 2; if (tokens_[token_split].limit < 1) { tokens_[token_split].limit = 1; } #if defined(TEST) || defined(INFO) || defined(LIMIT) *logofs << "Proxy: TOKEN! LIMIT! Setting token [" << DumpToken(token_split) << "] size to " << tokens_[token_split].size << " and limit to " << tokens_[token_split].limit << ".\n" << logofs_flush; #endif tokens_[token_data].size = control -> TokenSize; tokens_[token_data].limit = control -> TokenLimit / 4; if (tokens_[token_data].limit < 1) { tokens_[token_data].limit = 1; } #if defined(TEST) || defined(INFO) || defined(LIMIT) *logofs << "Proxy: TOKEN! LIMIT! Setting token [" << DumpToken(token_data) << "] size to " << tokens_[token_data].size << " and limit to " << tokens_[token_data].limit << ".\n" << logofs_flush; #endif for (int i = token_control; i <= token_data; i++) { tokens_[i].remaining = tokens_[i].limit; } #if defined(TEST) || defined(INFO) || defined(LIMIT) *logofs << "Proxy: LIMIT! Using client bitrate " << "limit " << control -> ClientBitrateLimit << " server bitrate limit " << control -> ServerBitrateLimit << " with local limit " << control -> LocalBitrateLimit << ".\n" << logofs_flush; #endif // // Set the other parameters based on // the token size. // int base = control -> TokenSize; control -> SplitDataThreshold = base * 4; control -> SplitDataPacketLimit = base / 2; #if defined(TEST) || defined(INFO) *logofs << "Proxy: LIMIT! Setting split data threshold " << "to " << control -> SplitDataThreshold << " split packet limit to " << control -> SplitDataPacketLimit << " with base " << base << ".\n" << logofs_flush; #endif // // Set the number of bytes read from the // data channels at each loop. This will // basically determine the maximum band- // width available for the generic chan- // nels. // control -> GenericInitialReadSize = base / 2; control -> GenericMaximumBufferSize = base / 2; #if defined(TEST) || defined(INFO) *logofs << "Proxy: LIMIT! Setting generic channel " << "initial read size to " << control -> GenericInitialReadSize << " maximum read " << "size to " << control -> GenericMaximumBufferSize << " with base " << base << ".\n" << logofs_flush; #endif return 1; } int Proxy::handleCacheConfiguration() { #ifdef TEST *logofs << "Proxy: Configuring cache according to pack parameters.\n" << logofs_flush; #endif // // Further adjust the cache parameters. If // packing of the images is enabled, reduce // the size available for plain images. // if (control -> SessionMode == session_agent) { if (control -> PackMethod != NO_PACK) { clientStore_ -> getRequestStore(X_PutImage) -> cacheThreshold = PUTIMAGE_CACHE_THRESHOLD_IF_PACKED; clientStore_ -> getRequestStore(X_PutImage) -> cacheLowerThreshold = PUTIMAGE_CACHE_LOWER_THRESHOLD_IF_PACKED; } } // // If this is a shadow session increase the // size of the image cache. // if (control -> SessionMode == session_shadow) { if (control -> PackMethod != NO_PACK) { clientStore_ -> getRequestStore(X_NXPutPackedImage) -> cacheThreshold = PUTPACKEDIMAGE_CACHE_THRESHOLD_IF_PACKED_SHADOW; clientStore_ -> getRequestStore(X_NXPutPackedImage) -> cacheLowerThreshold = PUTPACKEDIMAGE_CACHE_LOWER_THRESHOLD_IF_PACKED_SHADOW; } else { clientStore_ -> getRequestStore(X_PutImage) -> cacheThreshold = PUTIMAGE_CACHE_THRESHOLD_IF_SHADOW; clientStore_ -> getRequestStore(X_PutImage) -> cacheLowerThreshold = PUTIMAGE_CACHE_LOWER_THRESHOLD_IF_SHADOW; } } return 1; } int Proxy::handleSaveStores() { // // Save content of stores on disk. // char *cacheToAdopt = NULL; // // Set to false the indicator for cumulative store // size too small // bool isTooSmall = false; if (control -> PersistentCacheEnableSave) { #ifdef TEST *logofs << "Proxy: Going to save content of client store.\n" << logofs_flush; #endif cacheToAdopt = handleSaveAllStores(control -> PersistentCachePath, isTooSmall); } #ifdef TEST else { if (control -> ProxyMode == proxy_client) { *logofs << "Proxy: Saving persistent cache to disk disabled.\n" << logofs_flush; } else { *logofs << "Proxy: PANIC! Protocol violation in command save.\n" << logofs_flush; cerr << "Error" << ": Protocol violation in command save.\n"; HandleCleanup(); } } #endif if (cacheToAdopt != NULL) { // // Do we have a cache already? // if (control -> PersistentCacheName != NULL) { // // Check if old and new cache are the same. // In this case don't remove the old cache. // if (strcasecmp(control -> PersistentCacheName, cacheToAdopt) != 0) { handleResetPersistentCache(); } delete [] control -> PersistentCacheName; } #ifdef TEST *logofs << "Proxy: Setting current persistent cache file to '" << cacheToAdopt << "'\n" << logofs_flush; #endif control -> PersistentCacheName = cacheToAdopt; return 1; } else { #ifdef TEST *logofs << "Proxy: No cache file produced from message stores.\n" << logofs_flush; #endif // // It can be that we didn't generate a new cache // because store was too small or persistent cache // was disabled. This is not an error. // if (control -> PersistentCacheEnableSave && !isTooSmall) { return -1; } else { return 0; } } } int Proxy::handleLoadStores() { // // Restore the content of the client store // from disk if a valid cache was negotiated // at session startup. // if (control -> PersistentCacheEnableLoad == 1 && control -> PersistentCachePath != NULL && control -> PersistentCacheName != NULL) { #ifdef TEST *logofs << "Proxy: Going to load content of client store.\n" << logofs_flush; #endif // // Returns the same string passed as name of // the cache, or NULL if it was not possible // to load the cache from disk. // if (handleLoadAllStores(control -> PersistentCachePath, control -> PersistentCacheName) == NULL) { // // The corrupted cache should have been // removed from disk. Get rid of the // reference so we don't try to delete // it once again. // if (control -> PersistentCacheName != NULL) { delete [] control -> PersistentCacheName; } control -> PersistentCacheName = NULL; return -1; } // // Set timestamp of last time cache // was loaded from data on disk. // timeouts_.loadTs = getTimestamp(); return 1; } #ifdef TEST else { if (control -> ProxyMode == proxy_client) { *logofs << "Proxy: Loading of cache disabled or no cache file selected.\n" << logofs_flush; } else { *logofs << "Proxy: PANIC! Protocol violation in command load.\n" << logofs_flush; cerr << "Error" << ": Protocol violation in command load.\n"; HandleCleanup(); } } #endif return 0; } int Proxy::handleControl(T_proxy_code code, int data) { // // Send the given control messages // to the remote proxy. // #if defined(TEST) || defined(INFO) if (data != -1) { if (code == code_control_token_reply || code == code_split_token_reply || code == code_data_token_reply) { *logofs << "Proxy: TOKEN! Sending message '" << DumpControl(code) << "' at " << strMsTimestamp() << " with count " << data << ".\n" << logofs_flush; } else { *logofs << "Proxy: Sending message '" << DumpControl(code) << "' at " << strMsTimestamp() << " with data ID#" << data << ".\n" << logofs_flush; } } else { *logofs << "Proxy: Sending message '" << DumpControl(code) << "' at " << strMsTimestamp() << ".\n" << logofs_flush; } #endif // // Add the control message and see if the // data has to be flushed immediately. // if (addControlCodes(code, data) < 0) { return -1; } switch (code) { // // Append the first data read from the opened // channel to the control code. // case code_new_x_connection: case code_new_cups_connection: case code_new_aux_connection: case code_new_smb_connection: case code_new_media_connection: case code_new_http_connection: case code_new_font_connection: case code_new_slave_connection: // // Do we send the token reply immediately? // The control messages are put at the begin- // ning of the of the encode buffer, so we may // reply to multiple tokens before having the // chance of handling the actual frame data. // On the other hand, the sooner we reply, the // sooner the remote proxy is restarted. // case code_control_token_reply: case code_split_token_reply: case code_data_token_reply: { break; } // // Also send the congestion control codes // immediately. // // case code_begin_congestion: // case code_end_congestion: // default: { priority_ = 1; break; } } if (priority_ == 1) { if (handleFrame(frame_data) < 0) { return -1; } } return 1; } int Proxy::handleSwitch(int channelId) { // // If data is for a different channel than last // selected for output, prepend to the data the // new channel id. // #ifdef DEBUG *logofs << "Proxy: Requested a switch with " << "current channel ID#" << outputChannel_ << " new channel ID#" << channelId << ".\n" << logofs_flush; #endif if (channelId != outputChannel_) { if (needFlush() == 1) { #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "Proxy: WARNING! Flushing data for the " << "previous channel ID#" << outputChannel_ << ".\n" << logofs_flush; #endif if (handleFrame(frame_data) < 0) { return -1; } } #if defined(TEST) || defined(INFO) *logofs << "Proxy: Sending message '" << DumpControl(code_switch_connection) << "' at " << strMsTimestamp() << " with FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; #endif if (addControlCodes(code_switch_connection, channelId) < 0) { return -1; } outputChannel_ = channelId; } return 1; } int Proxy::addTokenCodes(T_proxy_token &token) { #if defined(TEST) || defined(INFO) || defined(TOKEN) *logofs << "Proxy: TOKEN! Sending token [" << DumpToken(token.type) << "] with " << token.bytes << " bytes accumulated size " << token.size << " and " << token.remaining << " available.\n" << logofs_flush; #endif // // Give a 'weight' to the token. The tokens // remaining can become negative if we sent // a packet that was exceptionally big. // int count = 0; // Since ProtoStep7 (#issue 108) count = token.bytes / token.size; // // Force a count of 1, for example // if this is a ping. // if (count < 1) { count = 1; token.bytes = 0; } else { // Since ProtoStep7 (#issue 108) if (count > 255) { count = 255; } // // Let the next token account for the // remaining bytes. // token.bytes %= token.size; } #if defined(TEST) || defined(INFO) || defined(TOKEN) *logofs << "Proxy: Sending message '" << DumpControl(token.request) << "' at " << strMsTimestamp() << " with count " << count << ".\n" << logofs_flush; #endif controlCodes_[controlLength_++] = 0; controlCodes_[controlLength_++] = (unsigned char) token.request; controlCodes_[controlLength_++] = (unsigned char) count; statistics -> addFrameOut(); token.remaining -= count; return 1; } int Proxy::handleToken(T_frame_type type) { #if defined(TEST) || defined(INFO) || defined(TOKEN) *logofs << "Proxy: TOKEN! Checking tokens with " << "frame type ["; *logofs << (type == frame_ping ? "frame_ping" : "frame_data"); *logofs << "] with stream ratio " << statistics -> getStreamRatio() << ".\n" << logofs_flush; #endif if (type == frame_data) { // // Since ProtoStep7 (#issue 108) // // Send a distinct token for each data type. // We don't want to slow down the sending of // the X events, X replies and split confir- // mation events on the X server side, so // take care only of the generic data token. // if (control -> ProxyMode == proxy_client) { statistics -> updateControlToken(tokens_[token_control].bytes); if (tokens_[token_control].bytes > tokens_[token_control].size) { if (addTokenCodes(tokens_[token_control]) < 0) { return -1; } #if defined(TEST) || defined(INFO) || defined(TOKEN) T_proxy_token &token = tokens_[token_control]; *logofs << "Proxy: TOKEN! Token class [" << DumpToken(token.type) << "] has now " << token.bytes << " bytes accumulated and " << token.remaining << " tokens remaining.\n" << logofs_flush; #endif } statistics -> updateSplitToken(tokens_[token_split].bytes); if (tokens_[token_split].bytes > tokens_[token_split].size) { if (addTokenCodes(tokens_[token_split]) < 0) { return -1; } #if defined(TEST) || defined(INFO) || defined(TOKEN) T_proxy_token &token = tokens_[token_split]; *logofs << "Proxy: TOKEN! Token class [" << DumpToken(token.type) << "] has now " << token.bytes << " bytes accumulated and " << token.remaining << " tokens remaining.\n" << logofs_flush; #endif } } statistics -> updateDataToken(tokens_[token_data].bytes); if (tokens_[token_data].bytes > tokens_[token_data].size) { if (addTokenCodes(tokens_[token_data]) < 0) { return -1; } #if defined(TEST) || defined(INFO) || defined(TOKEN) T_proxy_token &token = tokens_[token_data]; *logofs << "Proxy: TOKEN! Token class [" << DumpToken(token.type) << "] has now " << token.bytes << " bytes accumulated and " << token.remaining << " tokens remaining.\n" << logofs_flush; #endif } } else { if (addTokenCodes(tokens_[token_control]) < 0) { return -1; } // // Reset all counters on a ping. // tokens_[token_control].bytes = 0; tokens_[token_split].bytes = 0; tokens_[token_data].bytes = 0; #if defined(TEST) || defined(INFO) || defined(TOKEN) T_proxy_token &token = tokens_[token_control]; *logofs << "Proxy: TOKEN! Token class [" << DumpToken(token.type) << "] has now " << token.bytes << " bytes accumulated and " << token.remaining << " tokens remaining.\n" << logofs_flush; #endif } // // Check if we have entered in // congestion state. // if (congestion_ == 0 && tokens_[token_control].remaining <= 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Entering congestion with " << tokens_[token_control].remaining << " tokens remaining.\n" << logofs_flush; #endif congestion_ = 1; } statistics -> updateCongestion(tokens_[token_control].remaining, tokens_[token_control].limit); return 1; } int Proxy::handleTokenFromProxy(T_proxy_token &token, int count) { #if defined(TEST) || defined(INFO) || defined(TOKEN) *logofs << "Proxy: TOKEN! Received token [" << DumpToken(token.type) << "] request at " << strMsTimestamp() << " with count " << count << ".\n" << logofs_flush; #endif // // Since ProtoStep7 (#issue 108) with no limitations // concerning invalid token requests at this point // // // Add our token reply. // if (handleControl(token.reply, count) < 0) { return -1; } return 1; } int Proxy::handleTokenReplyFromProxy(T_proxy_token &token, int count) { #if defined(TEST) || defined(INFO) || defined(TOKEN) *logofs << "Proxy: TOKEN! Received token [" << DumpToken(token.type) << "] reply at " << strMsTimestamp() << " with count " << count << ".\n" << logofs_flush; #endif // // Since ProtoStep7 (#issue 108) with no limitations // concerning invalid token requests at this point // // // Increment the available tokens. // token.remaining += count; if (token.remaining > token.limit) { #ifdef PANIC *logofs << "Proxy: PANIC! Token overflow handling messages.\n" << logofs_flush; #endif cerr << "Error" << ": Token overflow handling messages.\n"; HandleCleanup(); } #if defined(TEST) || defined(INFO) || defined(TOKEN) *logofs << "Proxy: TOKEN! Token class [" << DumpToken(token.type) << "] has now " << token.bytes << " bytes accumulated and " << token.remaining << " tokens remaining.\n" << logofs_flush; #endif // // Check if we can jump out of the // congestion state. // if (congestion_ == 1 && tokens_[token_control].remaining > 0) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Exiting congestion with " << tokens_[token_control].remaining << " tokens remaining.\n" << logofs_flush; #endif congestion_ = 0; } statistics -> updateCongestion(tokens_[token_control].remaining, tokens_[token_control].limit); return 1; } void Proxy::handleFailOnSave(const char *fullName, const char *failContext) const { #ifdef WARNING *logofs << "Proxy: WARNING! Error saving stores to cache file " << "in context [" << failContext << "].\n" << logofs_flush; #endif cerr << "Warning" << ": Error saving stores to cache file " << "in context [" << failContext << "].\n"; #ifdef WARNING *logofs << "Proxy: WARNING! Removing invalid cache '" << fullName << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Removing invalid cache '" << fullName << "'.\n"; unlink(fullName); } void Proxy::handleFailOnLoad(const char *fullName, const char *failContext) const { #ifdef WARNING *logofs << "Proxy: WARNING! Error loading stores from cache file " << "in context [" << failContext << "].\n" << logofs_flush; #endif cerr << "Warning" << ": Error loading stores from cache file " << "in context [" << failContext << "].\n"; #ifdef WARNING *logofs << "Proxy: WARNING! Removing invalid cache '" << fullName << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Removing invalid cache '" << fullName << "'.\n"; unlink(fullName); } int Proxy::handleSaveVersion(unsigned char *buffer, int &major, int &minor, int &patch) const { // Since ProtoStep8 (#issue 108) major = 3; minor = 0; patch = 0; *(buffer + 0) = major; *(buffer + 1) = minor; PutUINT(patch, buffer + 2, storeBigEndian()); return 1; } int Proxy::handleLoadVersion(const unsigned char *buffer, int &major, int &minor, int &patch) const { major = *(buffer + 0); minor = *(buffer + 1); patch = GetUINT(buffer + 2, storeBigEndian()); // // Force the proxy to discard the // incompatible caches. // // Since ProtoStep8 (#issue 108) if (major < 3) { return -1; } return 1; } char *Proxy::handleSaveAllStores(const char *savePath, bool & isTooSmall) const { isTooSmall = false; int cumulativeSize = MessageStore::getCumulativeTotalStorageSize(); if (cumulativeSize < control -> PersistentCacheThreshold) { #ifdef TEST *logofs << "Proxy: Cache not saved as size is " << cumulativeSize << " with threshold set to " << control -> PersistentCacheThreshold << ".\n" << logofs_flush; #endif // // Cumulative store size is smaller than threshold // so the indicator is set to true // isTooSmall = true; return NULL; } else if (savePath == NULL) { #ifdef PANIC *logofs << "Proxy: PANIC! No name provided for save path.\n" << logofs_flush; #endif cerr << "Error" << ": No name provided for save path.\n"; return NULL; } #ifdef TEST *logofs << "Proxy: Going to save content of message stores.\n" << logofs_flush; #endif // // Our parent process is likely going to terminate. // Until we finish saving cache we must ignore its // SIGIPE. // DisableSignals(); ofstream *cachefs = NULL; md5_state_t *md5StateStream = NULL; md5_byte_t *md5DigestStream = NULL; md5_state_t *md5StateClient = NULL; md5_byte_t *md5DigestClient = NULL; char md5String[MD5_LENGTH * 2 + 2]; char fullName[strlen(savePath) + MD5_LENGTH * 2 + 4]; // // Prepare the template for the temporary file // const char* const uniqueTemplate = "XXXXXX"; char tempName[strlen(savePath) + strlen("/") + 4 + strlen(uniqueTemplate) + 1]; snprintf(tempName, sizeof tempName, "%s/%s%s", savePath, control -> ProxyMode == proxy_client ? "Z-C-" : "Z-S-", uniqueTemplate); #ifdef TEST *logofs << "Proxy: Generating temporary file with template '" << tempName << "'.\n" << logofs_flush; #endif // // Change the mask to make the file only // readable by the user, then restore the // old mask. // mode_t fileMode = umask(0077); // // Generate a unique temporary filename from tempName // and then create and open the file // int fdTemp = mkstemp(tempName); if (fdTemp == -1) { #ifdef PANIC *logofs << "Proxy: PANIC! Can't create temporary file in '" << savePath << "'. Cause = " << strerror(errno) << ".\n" << logofs_flush; #endif cerr << "Error" << ": Can't create temporary file in '" << savePath << "'. Cause = " << strerror(errno) << ".\n"; umask(fileMode); EnableSignals(); return NULL; } #ifdef TEST *logofs << "Proxy: Saving cache to file '" << tempName << "'.\n" << logofs_flush; #endif // // Create and open the output stream for the new temporary // file // cachefs = new (std::nothrow) ofstream(tempName, ios::out | ios::binary); if ((cachefs == NULL) || cachefs->fail()) { #ifdef PANIC *logofs << "Proxy: PANIC! Can't create stream for temporary file '" << tempName << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Can't create stream for temporary file '" << tempName << "'.\n"; close(fdTemp); unlink(tempName); umask(fileMode); EnableSignals(); return NULL; } // // Close the file descriptor returned by mkstemp // and restore the old mask // close(fdTemp); umask(fileMode); md5StateStream = new md5_state_t(); md5DigestStream = new md5_byte_t[MD5_LENGTH]; md5_init(md5StateStream); // // First write the proxy version. // unsigned char version[4]; int major; int minor; int patch; handleSaveVersion(version, major, minor, patch); #ifdef TEST *logofs << "Proxy: Saving cache using version '" << major << "." << minor << "." << patch << "'.\n" << logofs_flush; #endif if (PutData(cachefs, version, 4) < 0) { handleFailOnSave(tempName, "A"); delete cachefs; delete md5StateStream; delete [] md5DigestStream; EnableSignals(); return NULL; } // // Make space for the calculated MD5 so we // can later rewind the file and write it // at this position. // if (PutData(cachefs, md5DigestStream, MD5_LENGTH) < 0) { handleFailOnSave(tempName, "B"); delete cachefs; delete md5StateStream; delete [] md5DigestStream; EnableSignals(); return NULL; } md5StateClient = new md5_state_t(); md5DigestClient = new md5_byte_t[MD5_LENGTH]; md5_init(md5StateClient); #ifdef DUMP ofstream *cacheDump = NULL; ofstream *tempfs = (ofstream*) logofs; char cacheDumpName[DEFAULT_STRING_LENGTH]; if (control -> ProxyMode == proxy_client) { snprintf(cacheDumpName, DEFAULT_STRING_LENGTH - 1, "%s/client-cache-dump", control -> TempPath); } else { snprintf(cacheDumpName, DEFAULT_STRING_LENGTH - 1, "%s/server-cache-dump", control -> TempPath); } *(cacheDumpName + DEFAULT_STRING_LENGTH - 1) = '\0'; fileMode = umask(0077); cacheDump = new ofstream(cacheDumpName, ios::out); umask(fileMode); logofs = cacheDump; #endif // // Use the virtual method of the concrete proxy class. // int allSaved = handleSaveAllStores(cachefs, md5StateStream, md5StateClient); #ifdef DUMP logofs = tempfs; delete cacheDump; #endif if (allSaved == -1) { handleFailOnSave(tempName, "C"); delete cachefs; delete md5StateStream; delete [] md5DigestStream; delete md5StateClient; delete [] md5DigestClient; EnableSignals(); return NULL; } md5_finish(md5StateClient, md5DigestClient); for (unsigned int i = 0; i < MD5_LENGTH; i++) { sprintf(md5String + (i * 2), "%02X", md5DigestClient[i]); } strcpy(fullName, (control -> ProxyMode == proxy_client) ? "C-" : "S-"); strcat(fullName, md5String); md5_append(md5StateStream, (const md5_byte_t *) fullName, strlen(fullName)); md5_finish(md5StateStream, md5DigestStream); // // Go to the beginning of file plus // the integer where we wrote our // proxy version. // cachefs -> seekp(4); if (PutData(cachefs, md5DigestStream, MD5_LENGTH) < 0) { handleFailOnSave(tempName, "D"); delete cachefs; delete md5StateStream; delete [] md5DigestStream; delete md5StateClient; delete [] md5DigestClient; EnableSignals(); return NULL; } delete cachefs; // // Copy the resulting cache name without // the path so that we can return it to // the caller. // char *cacheName = new char[MD5_LENGTH * 2 + 4]; strcpy(cacheName, fullName); // // Add the path to the full name and move // the cache into the path. // strcpy(fullName, savePath); strcat(fullName, (control -> ProxyMode == proxy_client) ? "/C-" : "/S-"); strcat(fullName, md5String); #ifdef TEST *logofs << "Proxy: Renaming cache file from '" << tempName << "' to '" << fullName << "'.\n" << logofs_flush; #endif rename(tempName, fullName); delete md5StateStream; delete [] md5DigestStream; delete md5StateClient; delete [] md5DigestClient; // // Restore the original handlers. // EnableSignals(); #ifdef TEST *logofs << "Proxy: Successfully saved cache file '" << cacheName << "'.\n" << logofs_flush; #endif // // This must be enabled only for test // because it requires that client and // server reside on the same machine. // if (control -> PersistentCacheCheckOnShutdown == 1 && control -> ProxyMode == proxy_server) { #if defined(TEST) || defined(INFO) *logofs << "Proxy: MATCH! Checking if the file '" << fullName << "' matches a client cache.\n" << logofs_flush; #endif strcpy(fullName, savePath); strcat(fullName, "/C-"); strcat(fullName, md5String); struct stat fileStat; if (stat(fullName, &fileStat) != 0) { #ifdef PANIC *logofs << "Proxy: PANIC! Can't find a client cache " << "with name '" << fullName << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Can't find a client cache " << "with name '" << fullName << "'.\n"; HandleShutdown(); } #if defined(TEST) || defined(INFO) *logofs << "Proxy: MATCH! Client cache '" << fullName << "' matches the local cache.\n" << logofs_flush; #endif } return cacheName; } const char *Proxy::handleLoadAllStores(const char *loadPath, const char *loadName) const { #ifdef TEST *logofs << "Proxy: Going to load content of message stores.\n" << logofs_flush; #endif // // Until we finish loading cache we // must at least ignore any SIGIPE. // DisableSignals(); if (loadPath == NULL || loadName == NULL) { #ifdef PANIC *logofs << "Proxy: PANIC! No path or no file name provided for cache to restore.\n" << logofs_flush; #endif cerr << "Error" << ": No path or no file name provided for cache to restore.\n"; EnableSignals(); return NULL; } else if (strlen(loadName) != MD5_LENGTH * 2 + 2) { #ifdef PANIC *logofs << "Proxy: PANIC! Bad file name provided for cache to restore.\n" << logofs_flush; #endif cerr << "Error" << ": Bad file name provided for cache to restore.\n"; EnableSignals(); return NULL; } istream *cachefs = NULL; char md5String[(MD5_LENGTH * 2) + 2]; md5_byte_t md5FromFile[MD5_LENGTH]; char *cacheName = new char[strlen(loadPath) + strlen(loadName) + 3]; strcpy(cacheName, loadPath); strcat(cacheName, "/"); strcat(cacheName, loadName); #ifdef TEST *logofs << "Proxy: Name of cache file is '" << cacheName << "'.\n" << logofs_flush; #endif cachefs = new ifstream(cacheName, ios::in | ios::binary); unsigned char version[4]; if (cachefs == NULL || GetData(cachefs, version, 4) < 0) { #ifdef PANIC *logofs << "Proxy: PANIC! Can't read cache file '" << cacheName << "'.\n" << logofs_flush;; #endif handleFailOnLoad(cacheName, "A"); delete cachefs; delete [] cacheName; EnableSignals(); return NULL; } int major; int minor; int patch; if (handleLoadVersion(version, major, minor, patch) < 0) { #ifdef PANIC *logofs << "Proxy: WARNING! Incompatible version '" << major << "." << minor << "." << patch << "' in cache file '" << cacheName << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Incompatible version '" << major << "." << minor << "." << patch << "' in cache file '" << cacheName << "'.\n" << logofs_flush; if (control -> ProxyMode == proxy_server) { handleFailOnLoad(cacheName, "B"); } else { // // Simply remove the cache file. // unlink(cacheName); } delete cachefs; delete [] cacheName; EnableSignals(); return NULL; } #ifdef TEST *logofs << "Proxy: Reading from cache file version '" << major << "." << minor << "." << patch << "'.\n" << logofs_flush; #endif if (GetData(cachefs, md5FromFile, MD5_LENGTH) < 0) { #ifdef PANIC *logofs << "Proxy: PANIC! No checksum in cache file '" << loadName << "'.\n" << logofs_flush; #endif handleFailOnLoad(cacheName, "C"); delete cachefs; delete [] cacheName; EnableSignals(); return NULL; } md5_state_t *md5StateStream = NULL; md5_byte_t *md5DigestStream = NULL; md5StateStream = new md5_state_t(); md5DigestStream = new md5_byte_t[MD5_LENGTH]; md5_init(md5StateStream); // // Use the virtual method of the proxy class. // if (handleLoadAllStores(cachefs, md5StateStream) < 0) { handleFailOnLoad(cacheName, "D"); delete cachefs; delete md5StateStream; delete [] md5DigestStream; delete [] cacheName; EnableSignals(); return NULL; } md5_append(md5StateStream, (const md5_byte_t *) loadName, strlen(loadName)); md5_finish(md5StateStream, md5DigestStream); for (unsigned int i = 0; i < MD5_LENGTH; i++) { if (md5DigestStream[i] != md5FromFile[i]) { #ifdef PANIC *logofs << "Proxy: PANIC! Bad checksum for cache file '" << cacheName << "'.\n" << logofs_flush; for (unsigned int j = 0; j < MD5_LENGTH; j++) { sprintf(md5String + (j * 2), "%02X", md5FromFile[j]); } *logofs << "Proxy: PANIC! Saved checksum is '" << md5String << "'.\n" << logofs_flush; for (unsigned int j = 0; j < MD5_LENGTH; j++) { sprintf(md5String + (j * 2),"%02X", md5DigestStream[i]); } *logofs << "Proxy: PANIC! Calculated checksum is '" << md5String << "'.\n" << logofs_flush; #endif handleFailOnLoad(cacheName, "E"); delete cachefs; delete md5StateStream; delete [] md5DigestStream; delete [] cacheName; EnableSignals(); return NULL; } } delete cachefs; delete md5StateStream; delete [] md5DigestStream; delete [] cacheName; // // Restore the original handlers. // EnableSignals(); #ifdef TEST *logofs << "Proxy: Successfully loaded cache file '" << loadName << "'.\n" << logofs_flush; #endif // // Return the string provided by caller. // return loadName; } int Proxy::allocateChannelMap(int fd) { // // We assume that the fd is lower than // the maximum allowed number. This is // checked at the time the connection // is accepted. // if (fd < 0 || fd >= CONNECTIONS_LIMIT) { #ifdef PANIC *logofs << "Proxy: PANIC! Internal error allocating " << "new channel with FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": Internal error allocating " << "new channel with FD#" << fd_ << ".\n"; HandleCleanup(); } for (int channelId = 0; channelId < CONNECTIONS_LIMIT; channelId++) { if (checkLocalChannelMap(channelId) == 1 && fdMap_[channelId] == -1) { fdMap_[channelId] = fd; channelMap_[fd] = channelId; #ifdef TEST *logofs << "Proxy: Allocated new channel ID#" << channelId << " with FD#" << fd << ".\n" << logofs_flush; #endif return channelId; } } // // No available channel is remaining. // #ifdef TEST *logofs << "Proxy: WARNING! Can't allocate a new channel " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif return -1; } int Proxy::checkChannelMap(int channelId) { // // To be acceptable, the channel id must // be an id that is not possible to use // to allocate channels at this side. // if (checkLocalChannelMap(channelId) == 1) { #ifdef PANIC *logofs << "Proxy: PANIC! Can't open a new channel " << "with invalid ID#" << channelId << ".\n" << logofs_flush; #endif cerr << "Error" << ": Can't open a new channel " << "with invalid ID#" << channelId << ".\n"; return -1; } else if (channels_[channelId] != NULL) { #ifdef PANIC *logofs << "Proxy: PANIC! Can't open a new channel " << "over an existing ID#" << channelId << " with FD#" << getFd(channelId) << ".\n" << logofs_flush; #endif cerr << "Error" << ": Can't open a new channel " << "over an existing ID#" << channelId << " with FD#" << getFd(channelId) << ".\n"; return -1; } return 1; } int Proxy::assignChannelMap(int channelId, int fd) { // // We assume that the fd is lower than // the maximum allowed number. This is // checked at the time the connection // is accepted. // if (channelId < 0 || channelId >= CONNECTIONS_LIMIT || fd < 0 || fd >= CONNECTIONS_LIMIT) { #ifdef PANIC *logofs << "Proxy: PANIC! Internal error assigning " << "new channel with FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": Internal error assigning " << "new channel with FD#" << fd_ << ".\n"; HandleCleanup(); } fdMap_[channelId] = fd; channelMap_[fd] = channelId; return 1; } void Proxy::cleanupChannelMap(int channelId) { int fd = fdMap_[channelId]; if (fd != -1) { fdMap_[channelId] = -1; channelMap_[fd] = -1; } } int Proxy::addControlCodes(T_proxy_code code, int data) { // // Flush the encode buffer plus all the outstanding // control codes if there is not enough space for // the new control message. We need to ensure that // there are further bytes available, in the case // we will need to add more token control messages. // if (controlLength_ + 3 > CONTROL_CODES_THRESHOLD) { #ifdef WARNING *logofs << "Proxy: WARNING! Flushing control messages " << "while sending code '" << DumpControl(code) << "'.\n" << logofs_flush; #endif if (handleFlush() < 0) { return -1; } } controlCodes_[controlLength_++] = 0; controlCodes_[controlLength_++] = (unsigned char) code; controlCodes_[controlLength_++] = (unsigned char) (data == -1 ? 0 : data); // // Account for the control frame. // statistics -> addFrameOut(); return 1; } void Proxy::setSplitTimeout(int channelId) { int needed = channels_[channelId] -> needSplit(); if (needed != isTimestamp(timeouts_.splitTs)) { if (needed == 1) { #if defined(TEST) || defined(INFO) || defined(SPLIT) *logofs << "Proxy: SPLIT! Allocating split timestamp at " << strMsTimestamp() << ".\n" << logofs_flush; #endif timeouts_.splitTs = getTimestamp(); } else { T_list &channelList = activeChannels_.getList(); for (T_list::iterator j = channelList.begin(); j != channelList.end(); j++) { int _channelId = *j; if (channels_[_channelId] != NULL && channels_[_channelId] -> needSplit() == 1) { #ifdef TEST *logofs << "Proxy: SPLIT! Channel for FD#" << getFd(_channelId) << " still needs splits.\n" << logofs_flush; #endif return; } } #if defined(TEST) || defined(INFO) || defined(SPLIT) *logofs << "Proxy: SPLIT! Resetting split timestamp at " << strMsTimestamp() << ".\n" << logofs_flush; #endif timeouts_.splitTs = nullTimestamp(); } } } void Proxy::setMotionTimeout(int channelId) { int needed = channels_[channelId] -> needMotion(); if (needed != isTimestamp(timeouts_.motionTs)) { if (channels_[channelId] -> needMotion() == 1) { #if defined(TEST) || defined(INFO) || defined(SPLIT) *logofs << "Proxy: Allocating motion timestamp at " << strMsTimestamp() << ".\n" << logofs_flush; #endif timeouts_.motionTs = getTimestamp(); } else { T_list &channelList = activeChannels_.getList(); for (T_list::iterator j = channelList.begin(); j != channelList.end(); j++) { int _channelId = *j; if (channels_[_channelId] != NULL && channels_[_channelId] -> needMotion() == 1) { #ifdef TEST *logofs << "Proxy: SPLIT! Channel for FD#" << getFd(_channelId) << " still needs motions.\n" << logofs_flush; #endif return; } } #if defined(TEST) || defined(INFO) || defined(SPLIT) *logofs << "Proxy: Resetting motion timestamp at " << strMsTimestamp() << ".\n" << logofs_flush; #endif timeouts_.motionTs = nullTimestamp(); } } } void Proxy::increaseChannels(int channelId) { #ifdef TEST *logofs << "Proxy: Adding channel " << channelId << " to the list of active channels.\n" << logofs_flush; #endif activeChannels_.add(channelId); #ifdef TEST *logofs << "Proxy: There are " << activeChannels_.getSize() << " allocated channels for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif } void Proxy::decreaseChannels(int channelId) { #ifdef TEST *logofs << "Proxy: Removing channel " << channelId << " from the list of active channels.\n" << logofs_flush; #endif activeChannels_.remove(channelId); #ifdef TEST *logofs << "Proxy: There are " << activeChannels_.getSize() << " allocated channels for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif } int Proxy::allocateTransport(int channelFd, int channelId) { if (transports_[channelId] == NULL) { transports_[channelId] = new Transport(channelFd); if (transports_[channelId] == NULL) { #ifdef PANIC *logofs << "Proxy: PANIC! Can't allocate transport for " << "channel id " << channelId << ".\n" << logofs_flush; #endif cerr << "Error" << ": Can't allocate transport for " << "channel id " << channelId << ".\n"; return -1; } } else if (transports_[channelId] -> getType() != transport_agent) { #ifdef PANIC *logofs << "Proxy: PANIC! Transport for channel id " << channelId << " should be null.\n" << logofs_flush; #endif cerr << "Error" << ": Transport for channel id " << channelId << " should be null.\n"; return -1; } return 1; } int Proxy::deallocateTransport(int channelId) { // // Transport for the agent connection // is passed from the outside when // creating the channel. // if (transports_[channelId] -> getType() != transport_agent) { delete transports_[channelId]; } transports_[channelId] = NULL; return 1; } int Proxy::handleNewGenericConnection(int clientFd, T_channel_type type, const char *label) { int channelId = allocateChannelMap(clientFd); if (channelId == -1) { #ifdef PANIC *logofs << "Proxy: PANIC! Maximum number of available " << "channels exceeded.\n" << logofs_flush; #endif cerr << "Error" << ": Maximum number of available " << "channels exceeded.\n"; return -1; } #ifdef TEST *logofs << "Proxy: Channel for " << label << " descriptor " << "FD#" << clientFd << " mapped to ID#" << channelId << ".\n" << logofs_flush; #endif // // Turn queuing off for path server-to-proxy. // SetNoDelay(clientFd, 1); if (allocateTransport(clientFd, channelId) < 0) { return -1; } switch (type) { case channel_cups: { channels_[channelId] = new CupsChannel(transports_[channelId], compressor_); break; } case channel_smb: { channels_[channelId] = new SmbChannel(transports_[channelId], compressor_); break; } case channel_media: { channels_[channelId] = new MediaChannel(transports_[channelId], compressor_); break; } case channel_http: { channels_[channelId] = new HttpChannel(transports_[channelId], compressor_); break; } case channel_font: { channels_[channelId] = new FontChannel(transports_[channelId], compressor_); break; } default: { channels_[channelId] = new SlaveChannel(transports_[channelId], compressor_); break; } } if (channels_[channelId] == NULL) { deallocateTransport(channelId); return -1; } #ifdef TEST *logofs << "Proxy: Accepted new connection to " << label << " server.\n" << logofs_flush; #endif cerr << "Info" << ": Accepted new connection to " << label << " server.\n"; increaseChannels(channelId); switch (type) { case channel_cups: { if (handleControl(code_new_cups_connection, channelId) < 0) { return -1; } break; } case channel_smb: { if (handleControl(code_new_smb_connection, channelId) < 0) { return -1; } break; } case channel_media: { if (handleControl(code_new_media_connection, channelId) < 0) { return -1; } break; } case channel_http: { if (handleControl(code_new_http_connection, channelId) < 0) { return -1; } break; } case channel_font: { if (handleControl(code_new_font_connection, channelId) < 0) { return -1; } break; } default: { if (handleControl(code_new_slave_connection, channelId) < 0) { return -1; } break; } } channels_[channelId] -> handleConfiguration(); return 1; } int Proxy::handleNewSlaveConnection(int clientFd) { // Since ProtoStep7 (#issue 108) return handleNewGenericConnection(clientFd, channel_slave, "slave"); } int Proxy::handleNewGenericConnectionFromProxy(int channelId, T_channel_type type, ChannelEndPoint &endPoint, const char *label) { char *unixPath = NULL, *host = NULL; long port; if (endPoint.getUnixPath(&unixPath)) { return handleNewGenericConnectionFromProxyUnix(channelId, type, unixPath, label); } if (endPoint.getTCPHostAndPort(&host, &port)) { return handleNewGenericConnectionFromProxyTCP(channelId, type, host, port, label); } #ifdef WARNING *logofs << "Proxy: WARNING! Refusing attempted connection " << "to " << label << " server.\n" << logofs_flush; #endif cerr << "Warning" << ": Refusing attempted connection " << "to " << label << " server.\n"; return -1; } int Proxy::handleNewGenericConnectionFromProxyTCP(int channelId, T_channel_type type, const char *hostname, long port, const char *label) { if (port <= 0) { // // This happens when user has disabled // forwarding of the specific service. // #ifdef WARNING *logofs << "Proxy: WARNING! Refusing attempted connection " << "to " << label << " server.\n" << logofs_flush; #endif cerr << "Warning" << ": Refusing attempted connection " << "to " << label << " server.\n"; return -1; } const char *serverHost = hostname; int serverAddrFamily = AF_INET; sockaddr *serverAddr = NULL; unsigned int serverAddrLength = 0; #ifdef TEST *logofs << "Proxy: Connecting to " << label << " server '" << serverHost << "' on TCP port '" << port << "'.\n" << logofs_flush; #endif int serverIPAddr = GetHostAddress(serverHost); if (serverIPAddr == 0) { #ifdef PANIC *logofs << "Proxy: PANIC! Unknown " << label << " server host '" << serverHost << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Unknown " << label << " server host '" << serverHost << "'.\n"; return -1; } sockaddr_in *serverAddrTCP = new sockaddr_in; serverAddrTCP -> sin_family = AF_INET; serverAddrTCP -> sin_port = htons(port); serverAddrTCP -> sin_addr.s_addr = serverIPAddr; serverAddr = (sockaddr *) serverAddrTCP; serverAddrLength = sizeof(sockaddr_in); // // Connect to the requested server. // int serverFd = socket(serverAddrFamily, SOCK_STREAM, PF_UNSPEC); if (serverFd < 0) { #ifdef PANIC *logofs << "Proxy: PANIC! Call to socket failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Call to socket failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n"; delete serverAddrTCP; return -1; } else if (connect(serverFd, serverAddr, serverAddrLength) < 0) { #ifdef WARNING *logofs << "Proxy: WARNING! Connection to " << label << " server '" << serverHost << ":" << port << "' failed with error '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Connection to " << label << " server '" << serverHost << ":" << port << "' failed with error '" << ESTR() << "'.\n"; close(serverFd); delete serverAddrTCP; return -1; } delete serverAddrTCP; if (handlePostConnectionFromProxy(channelId, serverFd, type, label) < 0) { return -1; } #ifdef TEST *logofs << "Proxy: Forwarded new connection to " << label << " server on port '" << port << "'.\n" << logofs_flush; #endif cerr << "Info" << ": Forwarded new connection to " << label << " server on port '" << port << "'.\n"; return 1; } int Proxy::handleNewGenericConnectionFromProxyUnix(int channelId, T_channel_type type, const char *path, const char *label) { if (path == NULL || *path == '\0' ) { // // This happens when user has disabled // forwarding of the specific service. // #ifdef WARNING *logofs << "Proxy: WARNING! Refusing attempted connection " << "to " << label << " server.\n" << logofs_flush; #endif cerr << "Warning" << ": Refusing attempted connection " << "to " << label << " server.\n"; return -1; } sockaddr_un serverAddrUnix; unsigned int serverAddrLength = sizeof(sockaddr_un); int serverAddrFamily = AF_UNIX; serverAddrUnix.sun_family = AF_UNIX; // determine the maximum number of characters that fit into struct // sockaddr_un's sun_path member std::size_t serverAddrNameLength = sizeof(struct sockaddr_un) - offsetof(struct sockaddr_un, sun_path); snprintf(serverAddrUnix.sun_path, serverAddrNameLength, "%s", path); #ifdef TEST *logofs << "Proxy: Connecting to " << label << " server " << "on Unix port '" << path << "'.\n" << logofs_flush; #endif // // Connect to the requested server. // int serverFd = socket(serverAddrFamily, SOCK_STREAM, PF_UNSPEC); if (serverFd < 0) { #ifdef PANIC *logofs << "Proxy: PANIC! Call to socket failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Call to socket failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n"; return -1; } else if (connect(serverFd, (sockaddr *) &serverAddrUnix, serverAddrLength) < 0) { #ifdef WARNING *logofs << "Proxy: WARNING! Connection to " << label << " server on Unix port '" << path << "' failed " << "with error " << EGET() << ", '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Connection to " << label << " server on Unix port '" << path << "' failed " << "with error " << EGET() << ", '" << ESTR() << "'.\n"; close(serverFd); return -1; } if (handlePostConnectionFromProxy(channelId, serverFd, type, label) < 0) { return -1; } #ifdef TEST *logofs << "Proxy: Forwarded new connection to " << label << " server on Unix port '" << path << "'.\n" << logofs_flush; #endif cerr << "Info" << ": Forwarded new connection to " << label << " server on Unix port '" << path << "'.\n"; return 1; } int Proxy::handleNewSlaveConnectionFromProxy(int channelId) { cerr << "Info" << ": New slave connection on " << "channel ID#" << channelId << "\n"; char *nx_slave_cmd = getenv("NX_SLAVE_CMD"); if (nx_slave_cmd == NULL) { return -1; } int spair[2]; if (socketpair(AF_UNIX, SOCK_STREAM, 0, spair) == -1) { perror("socketpair"); return -1; } int serverFd = spair[0]; int clientFd = spair[1]; if (handlePostConnectionFromProxy(channelId, serverFd, channel_slave, "slave") < 0) { close(serverFd); close(clientFd); return -1; } int pid = fork(); if (pid == 0) { if (dup2(clientFd, 0) == -1) { perror("dup2"); exit(1); } if (dup2(clientFd, 1) == -1) { perror("dup2"); exit(1); } close(serverFd); close(clientFd); /* Close FDs used by NX, QVD #1208 */ for (int fd = 3; fd < 256; fd++) { close(fd); } char *const argv[2] = {nx_slave_cmd, NULL}; if (execv(nx_slave_cmd, argv) == -1) { perror("execv"); } exit(1); } else if (pid == -1) { // TODO Test this! perror("fork"); close(serverFd); close(clientFd); return -1; } close(clientFd); slavePidMap_[channelId] = pid; cerr << "Info" << ": slave channel ID#" << channelId << " handler has PID " << pid << endl; return 1; } void Proxy::checkSlaves() { for (int channelId = 0; channelId 1 && HandleChild(pid)) { slavePidMap_[channelId] = nothing; cerr << "Info:" << " Handled death of slave with pid " << pid << endl; } } } int Proxy::handlePostConnectionFromProxy(int channelId, int serverFd, T_channel_type type, const char *label) { // // Turn queuing off for path proxy-to-server. // SetNoDelay(serverFd, 1); assignChannelMap(channelId, serverFd); #ifdef TEST *logofs << "Proxy: Descriptor FD#" << serverFd << " mapped to channel ID#" << channelId << ".\n" << logofs_flush; #endif if (allocateTransport(serverFd, channelId) < 0) { return -1; } switch (type) { case channel_cups: { channels_[channelId] = new CupsChannel(transports_[channelId], compressor_); break; } case channel_smb: { channels_[channelId] = new SmbChannel(transports_[channelId], compressor_); break; } case channel_media: { channels_[channelId] = new MediaChannel(transports_[channelId], compressor_); break; } case channel_http: { channels_[channelId] = new HttpChannel(transports_[channelId], compressor_); break; } case channel_font: { channels_[channelId] = new FontChannel(transports_[channelId], compressor_); break; } default: { channels_[channelId] = new SlaveChannel(transports_[channelId], compressor_); break; } } if (channels_[channelId] == NULL) { deallocateTransport(channelId); return -1; } increaseChannels(channelId); channels_[channelId] -> handleConfiguration(); return 1; } nx-libs-3.5.99.23/nxcomp/src/Proxy.h0000644000000000000000000006321713614532331013705 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Proxy_H #define Proxy_H #include #ifdef _AIX #include #endif #include "Misc.h" #include "Timestamp.h" #include "List.h" #include "Channel.h" #include "Transport.h" #include "EncodeBuffer.h" #include "ProxyReadBuffer.h" #include "ChannelEndPoint.h" // // Forward declaration as we // need a pointer. // class Agent; // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Log the important tracepoints related // to writing packets to the peer proxy. // #undef FLUSH // // Codes used for control messages in // proxy-to-proxy protocol. // // The following codes are currently // unused. // // code_alert_reply, // code_reset_request, // code_reset_reply, // code_load_reply, // code_save_reply, // code_shutdown_reply, // code_configuration_request, // code_configuration_reply. // // These are for compatibility with // old versions. // // code_sync_request, // code_sync_reply, // // The code_new_aux_connection should not // be used anymore. Auxiliary X connections // are treated as normal X channels since // version 1.5.0. // typedef enum { code_new_x_connection, code_new_cups_connection, code_new_aux_connection, code_new_smb_connection, code_new_media_connection, code_switch_connection, code_drop_connection, code_finish_connection, code_begin_congestion, code_end_congestion, code_alert_request, code_alert_reply, code_reset_request, code_reset_reply, code_load_request, code_load_reply, code_save_request, code_save_reply, code_shutdown_request, code_shutdown_reply, code_control_token_request, code_control_token_reply, code_configuration_request, code_configuration_reply, code_statistics_request, code_statistics_reply, code_new_http_connection, code_sync_request, code_sync_reply, code_new_font_connection, code_new_slave_connection, code_finish_listeners, code_split_token_request, code_split_token_reply, code_data_token_request, code_data_token_reply, code_last_tag } T_proxy_code; typedef enum { operation_in_negotiation, operation_in_messages, operation_in_configuration, operation_in_statistics, operation_last_tag } T_proxy_operation; typedef enum { frame_ping, frame_data, } T_frame_type; typedef enum { token_control, token_split, token_data } T_token_type; typedef enum { load_if_any, load_if_first } T_load_type; class Proxy { public: // // Maximum number of supported channels. // static const int CONNECTIONS_LIMIT = 256; // // Numboer of token types. // static const int TOKEN_TYPES = 3; // // Length of buffer we use to add our // control messages plus the length of // the data frame. // static const int CONTROL_CODES_LENGTH = ENCODE_BUFFER_PREFIX_SIZE - 5; static const int CONTROL_CODES_THRESHOLD = CONTROL_CODES_LENGTH - 9; Proxy(int fd); virtual ~Proxy(); // // Inform the proxy that the negotiation phase is // completed and that it can start handling binary // messages. // int setOperational(); int getOperational() { return (operation_ != operation_in_negotiation); } int setReadDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax); int setWriteDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax); // // Perform the operation on the proxy // link or its own channels. // int handleRead(int &resultFds, fd_set &fdSet); int handleFlush(int &resultFds, fd_set &fdSet); int handleRead(); int handleRead(int fd, const char *data = NULL, int size = 0); int handleEvents(); int handleFlush(); int handleFlush(int fd); int handlePing(); int handleFinish(); int handleShutdown(); int handleStatistics(int type, ostream *statofs); int handleAlert(int alert); int handleRotate() { activeChannels_.rotate(); return 1; } int handleChannelConfiguration(); int handleSocketConfiguration(); int handleLinkConfiguration(); int handleCacheConfiguration(); // // These must be called just after initialization to // tell to the proxy where the network connections // have to be forwarded. // virtual void handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, sockaddr * xServerAddr, unsigned int xServerAddrLength) = 0; virtual void handlePortConfiguration(ChannelEndPoint &cupsServerPort, ChannelEndPoint &smbServerPort, ChannelEndPoint &mediaServerPort, ChannelEndPoint &httpServerPort, const char *fontServerPort) = 0; // // Create new tunneled channels. // virtual int handleNewConnection(T_channel_type type, int clientFd) = 0; virtual int handleNewConnectionFromProxy(T_channel_type type, int channelId) = 0; virtual int handleNewAgentConnection(Agent *agent) = 0; virtual int handleNewXConnection(int clientFd) = 0; virtual int handleNewXConnectionFromProxy(int channelId) = 0; int handleNewGenericConnection(int clientFd, T_channel_type type, const char *label); int handleNewGenericConnectionFromProxy(int channelId, T_channel_type type, ChannelEndPoint &endpoint, const char *label); int handleNewGenericConnectionFromProxyUnix(int channelId, T_channel_type type, const char *path, const char *label); int handleNewGenericConnectionFromProxyTCP(int channelId, T_channel_type type, const char *hostname, long port, const char *label); int handleNewSlaveConnection(int clientFd); int handleNewSlaveConnectionFromProxy(int channelId); void checkSlaves(); // // Force closure of channels. // int handleCloseConnection(int clientFd); int handleCloseAllXConnections(); int handleCloseAllListeners(); // // Called when the loop has replaced // or closed a previous alert. // void handleResetAlert(); // // Handle the persistent cache. // virtual int handleLoad(T_load_type type) = 0; virtual int handleSave() = 0; protected: // // Timeout related data: // // flush // split // motion // // Timeouts in milliseconds after which the // proxy will have to perform the operation. // // readTs, writeTs // // Timestamp of last packet received or sent // to remote proxy. Used to detect lost con- // nection. // // loopTs // // Timestamp of last loop completed by the // proxy // // pingTs // // Timestamp of last ping request sent to the // remote peer. // // alertTs // // Timestamp of last 'no data received' alert // dialog shown to the user. // // loadTs // // Were message stores populated from data on // disk. // // splitTs // motionTs // // Timestamps of the last operation of this // kind handled by the proxy. // typedef struct { int split; int motion; T_timestamp readTs; T_timestamp writeTs; T_timestamp loopTs; T_timestamp pingTs; T_timestamp alertTs; T_timestamp loadTs; T_timestamp splitTs; T_timestamp motionTs; } T_proxy_timeouts; // // Bytes accumulated so far while waiting // to send the next token, number of tokens // remaining for each token type and other // token related information. // typedef struct { int size; int limit; int bytes; int remaining; T_proxy_code request; T_proxy_code reply; T_token_type type; } T_proxy_token; int handlePostConnectionFromProxy(int channelId, int serverFd, T_channel_type type, const char *label); int handleDrain(); int handleFrame(T_frame_type type); int handleFinish(int channelId); int handleDrop(int channelId); int handleFinishFromProxy(int channelId); int handleDropFromProxy(int channelId); int handleStatisticsFromProxy(int type); int handleStatisticsFromProxy(const unsigned char *message, unsigned int length); int handleNegotiation(const unsigned char *message, unsigned int length); int handleNegotiationFromProxy(const unsigned char *message, unsigned int length); int handleToken(T_frame_type type); int handleTokenFromProxy(T_proxy_token &token, int count); int handleTokenReplyFromProxy(T_proxy_token &token, int count); int handleSyncFromProxy(int channelId); int handleSwitch(int channelId); int handleControl(T_proxy_code code, int data = -1); int handleControlFromProxy(const unsigned char *message); // // Interleave reads of the X server // events while writing data to the // remote proxy. // virtual int handleAsyncEvents() = 0; // // Timer related functions. // protected: void setTimer(int value) { SetTimer(value); } void resetTimer() { ResetTimer(); timer_ = 0; } public: void handleTimer() { timer_ = 1; } int getTimer() { return timer_; } // // Can the channel consume data and the // proxy produce more output? // int canRead(int fd) const { return (isTimeToRead() == 1 && isTimeToRead(getChannel(fd)) == 1); } // // Can the proxy read more data from its // peer? // int canRead() const { return (transport_ -> readable() != 0); } int canFlush() const { return (encodeBuffer_.getLength() + controlLength_ + transport_ -> length() + transport_ -> flushable() > 0); } int needFlush(int channelId) const { return (outputChannel_ == channelId && encodeBuffer_.getLength() > 0); } int needFlush() const { return (encodeBuffer_.getLength() > 0); } int shouldFlush() const { if ((int) ((encodeBuffer_.getLength() + controlLength_) / statistics -> getStreamRatio()) >= control -> TokenSize) { #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "Proxy: FLUSH! Requesting a flush with " << (encodeBuffer_.getLength() + controlLength_) << " bytes and stream ratio " << (double) statistics -> getStreamRatio() << ".\n" << logofs_flush; #endif return 1; } #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "Proxy: Not requesting a flush with " << (encodeBuffer_.getLength() + controlLength_) << " bytes and stream ratio " << (double) statistics -> getStreamRatio() << ".\n" << logofs_flush; #endif return 0; } int needDrain() const { return (congestion_ == 1 || transport_ -> length() > control -> TransportProxyBufferThreshold); } int getFd() const { return fd_; } int getFlushable(int fd) const { if (fd == fd_) { return (encodeBuffer_.getLength() + controlLength_ + transport_ -> flushable()); } return 0; } int getSplitSize() { return (clientStore_ != NULL ? clientStore_ -> getSplitTotalSize() : 0); } int getSplitStorageSize() { return (clientStore_ != NULL ? clientStore_ -> getSplitTotalStorageSize() : 0); } // // Returns the number of active channels // that currently managed by this proxy. // int getChannels(T_channel_type type = channel_none); // // If descriptor corresponds to a valid // channel, returns the type of traffic // carried by it. // T_channel_type getType(int fd); // // Given a channel type, returns the // literal name. // const char *getTypeName(T_channel_type type); // // Get a convenient name for 'localhost'. // const char *getComputerName(); // // Set if we have initiated the shutdown // procedure and if the shutdown request // has been received from the remote. // int getFinish() const { return finish_; } int getShutdown() const { return shutdown_; } // // Interfaces to the transport buffers. // int getLength(int fd) const { if (fd == fd_) { return transport_ -> length(); } int channelId = getChannel(fd); if (channelId < 0 || channels_[channelId] == NULL) { return 0; } return transports_[channelId] -> length(); } int getPending(int fd) const { if (fd == fd_) { return transport_ -> pending(); } int channelId = getChannel(fd); if (channelId < 0 || channels_[channelId] == NULL) { return 0; } return transports_[channelId] -> pending(); } // // Check if the proxy or the given channel // has data in the buffer because of a // blocking write. // int getBlocked(int fd) const { if (fd == fd_) { return transport_ -> blocked(); } int channelId = getChannel(fd); if (channelId < 0 || channels_[channelId] == NULL) { return 0; } return transports_[channelId] -> blocked(); } // // Check if the proxy or the given channel has // data to read. // int getReadable(int fd) const { if (fd == fd_) { return transport_ -> readable(); } int channelId = getChannel(fd); if (channelId < 0 || channels_[channelId] == NULL) { return 0; } return transports_[channelId] -> readable(); } // // Return a vale between 0 and 9 in the case // of the proxy descriptor. // int getCongestion(int fd) const { if (fd == fd_) { return (agent_ != nothing && congestions_[agent_] == 1 ? 9 : (int) statistics -> getCongestionInFrame()); } int channelId = getChannel(fd); if (channelId < 0 || channels_[channelId] == NULL) { return 0; } return channels_[channelId] -> getCongestion(); } // // Let the statistics class get info // from the message stores. // const ClientStore * const getClientStore() const { return clientStore_; } const ServerStore * const getServerStore() const { return serverStore_; } // // These can be called asynchronously by // channels during their read or write // loop. // int handleAsyncRead(int fd) { return handleRead(fd); } int handleAsyncCongestion(int fd) { int channelId = getChannel(fd); return handleControl(code_begin_congestion, channelId); } int handleAsyncDecongestion(int fd) { int channelId = getChannel(fd); return handleControl(code_end_congestion, channelId); } int handleAsyncSplit(int fd, Split *split) { return channels_[getChannel(fd)] -> handleSplitEvent(encodeBuffer_, split); } int handleAsyncPriority() { if (control -> FlushPriority == 1) { return handleFlush(); } return 0; } int canAsyncFlush() const { return shouldFlush(); } int handleAsyncFlush() { return handleFlush(); } int handleAsyncSwitch(int fd) { return handleSwitch(getChannel(fd)); } int handleAsyncKeeperCallback() { KeeperCallback(); return 1; } // // Internal interfaces used to verify the // availability of channels and the proxy // link. // protected: int isTimeToRead() const { if (congestion_ == 0 && transport_ -> blocked() == 0) { return 1; } else { #if defined(TEST) || defined(INFO) *logofs << "Proxy: Can't read from channels " << "with congestion " << congestion_ << " and blocked " << transport_ -> blocked() << ".\n" << logofs_flush; #endif return 0; } } int isTimeToRead(int channelId) const { if (channelId >= 0 && channelId < CONNECTIONS_LIMIT && channels_[channelId] != NULL && congestions_[channelId] == 0) { if (channels_[channelId] -> getType() == channel_x11 || tokens_[token_data].remaining > 0 || channels_[channelId] -> getFinish() == 1) { return 1; } #if defined(TEST) || defined(INFO) *logofs << "Proxy: Can't read from generic " << "descriptor FD#" << getFd(channelId) << " channel ID#" << channelId << " with " << tokens_[token_data].remaining << " data tokens remaining.\n" << logofs_flush; #endif return 0; } #if defined(TEST) || defined(INFO) if (channelId < 0 || channelId >= CONNECTIONS_LIMIT || channels_[channelId] == NULL) { *logofs << "Proxy: WARNING! No valid channel for ID#" << channelId << ".\n" << logofs_flush; } else if (channels_[channelId] -> getFinish()) { *logofs << "Proxy: Can't read from finishing " << "descriptor FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; } else if (congestions_[channelId] == 1) { *logofs << "Proxy: Can't read from congested " << "descriptor FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; } #endif return 0; } // // Handle the flush and split timeouts. // All these functions should round up // to the value of the latency timeout // to save a further loop. // protected: int isTimeToSplit() const { if (isTimestamp(timeouts_.splitTs) && getTimeToNextSplit() <= control -> LatencyTimeout) { if (tokens_[token_split].remaining > 0) { return 1; } #if defined(TEST) || defined(INFO) *logofs << "Proxy: WARNING! Can't encode splits " << "with " << tokens_[token_split].remaining << " split tokens remaining.\n" << logofs_flush; #endif } return 0; } int isTimeToMotion() const { return (isTimestamp(timeouts_.motionTs) && getTimeToNextMotion() <= control -> LatencyTimeout); } int getTimeToNextSplit() const { #if defined(TEST) || defined(INFO) || defined(FLUSH) if (isTimestamp(timeouts_.splitTs) == 0) { #ifdef PANIC *logofs << "Proxy: PANIC! No split timeout was set " << "for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": No split timeout was set " << "for proxy FD#" << fd_ << ".\n"; HandleCleanup(); } #endif int diffTs = timeouts_.split - diffTimestamp(timeouts_.splitTs, getTimestamp()); return (diffTs > 0 ? diffTs : 0); } int getTimeToNextMotion() const { #if defined(TEST) || defined(INFO) || defined(FLUSH) if (isTimestamp(timeouts_.motionTs) == 0) { #ifdef PANIC *logofs << "Proxy: PANIC! No motion timeout was set " << "for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": No motion timeout was set " << "for proxy FD#" << fd_ << ".\n"; HandleCleanup(); } #endif int diffTs = timeouts_.motion - diffTimestamp(timeouts_.motionTs, getTimestamp()); return (diffTs > 0 ? diffTs : 0); } protected: // // Implement persistence of cache on disk. // virtual int handleLoadFromProxy() = 0; virtual int handleSaveFromProxy() = 0; int handleLoadStores(); int handleSaveStores(); char *handleSaveAllStores(const char *savePath, bool & isTooSmall) const; virtual int handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, md5_state_t *md5StateClient) const = 0; int handleSaveVersion(unsigned char *buffer, int &major, int &minor, int &patch) const; void handleFailOnSave(const char *fullName, const char *failContext) const; const char *handleLoadAllStores(const char *loadPath, const char *loadName) const; virtual int handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const = 0; int handleLoadVersion(const unsigned char *buffer, int &major, int &minor, int &patch) const; void handleFailOnLoad(const char *fullName, const char *failContext) const; // // Prepare for a new persistent cache. // int handleResetPersistentCache(); // // Reset the stores in the case of a // failure loading the cache. // int handleResetStores(); // // Reset the transport buffer and the // other counters. // void handleResetFlush(); // // Utility functions used to map file // descriptors to channel ids. // protected: int allocateChannelMap(int fd); int checkChannelMap(int channelId); int assignChannelMap(int channelId, int fd); void cleanupChannelMap(int channelId); virtual int checkLocalChannelMap(int channelId) = 0; int addControlCodes(T_proxy_code code, int data); int addTokenCodes(T_proxy_token &token); int getFd(int channelId) const { if (channelId >= 0 && channelId < CONNECTIONS_LIMIT) { return fdMap_[channelId]; } return -1; } int getChannel(int fd) const { if (fd >= 0 && fd < CONNECTIONS_LIMIT) { return channelMap_[fd]; } return -1; } protected: void setSplitTimeout(int channelId); void setMotionTimeout(int channelId); void increaseChannels(int channelId); void decreaseChannels(int channelId); int allocateTransport(int channelFd, int channelId); int deallocateTransport(int channelId); // // The proxy has its own transport. // ProxyTransport *transport_; // // The static compressor is shared among // channels and all the message stores. // StaticCompressor *compressor_; // // Map NX specific opcodes. // OpcodeStore *opcodeStore_; // // Stores are shared between channels. // ClientStore *clientStore_; ServerStore *serverStore_; // // Client and server caches are shared // between channels. // ClientCache *clientCache_; ServerCache *serverCache_; // // The proxy's file descriptor. // int fd_; // // Channels currently selected for I/O // operations. // int inputChannel_; int outputChannel_; // // List of active channels. // List activeChannels_; // // Used to read data sent from peer proxy. // ProxyReadBuffer readBuffer_; // // Used to send data to peer proxy. // EncodeBuffer encodeBuffer_; // // Control messages' array. // int controlLength_; unsigned char controlCodes_[CONTROL_CODES_LENGTH]; // // Table of channel classes taking // care of open X connections. // Channel *channels_[CONNECTIONS_LIMIT]; // // Table of open sockets. // Transport *transports_[CONNECTIONS_LIMIT]; // // Timeout related data. // T_proxy_timeouts timeouts_; // // Proxy can be decoding messages, // handling a link reconfiguration, // or decoding statistics. // int operation_; // // True if we are currently draining // the proxy link. // int draining_; // // Force flush because of prioritized // control messages to send. // int priority_; // // Set if we have initiated the close // down procedure. // int finish_; // // Remote peer requested the shutdown. // int shutdown_; // // We are in the middle of a network // congestion in the path to remote // proxy. // int congestion_; // // Channels at the remote end that // are not consuming their data. // int congestions_[CONNECTIONS_LIMIT]; // // Is the timer expired? // int timer_; // // Did the proxy request an alert? // int alert_; // // The channel id of the agent. // int agent_; // // Token related data. // T_proxy_token tokens_[TOKEN_TYPES]; // // Pointer to stream descriptor where // proxy is producing statistics. // ostream *currentStatistics_; private: // // Map channel ids to file descriptors. // int channelMap_[CONNECTIONS_LIMIT]; int fdMap_[CONNECTIONS_LIMIT]; int slavePidMap_[CONNECTIONS_LIMIT]; }; #endif /* Proxy_H */ nx-libs-3.5.99.23/nxcomp/src/ProxyReadBuffer.cpp0000644000000000000000000001330213614532331016154 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ProxyReadBuffer.h" #include "Transport.h" // // Set the verbosity level. You also // need to define DUMP in Misc.cpp // if DUMP is defined here. // #define WARNING #define PANIC #undef TEST #undef DEBUG #undef DUMP unsigned int ProxyReadBuffer::suggestedLength(unsigned int pendingLength) { // // Always read all the data that // is available. // int readable = transport_ -> readable(); unsigned int readLength = (readable == -1 ? 0 : (unsigned int) readable); if (readLength < pendingLength) { readLength = pendingLength; } // // Even if the readable data is not // enough to make a complete message, // resize the buffer to accommodate // it all. // if (pendingLength < remaining_) { readLength = remaining_; } return readLength; } int ProxyReadBuffer::locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &controlLength, unsigned int &dataLength, unsigned int &trailerLength) { unsigned int lengthLength = 0; const unsigned char *nextSrc = start; unsigned char next; dataLength = 0; #ifdef TEST *logofs << "ProxyReadBuffer: Locating message for FD#" << transport_ -> fd() << " with " << end - start << " bytes.\n" << logofs_flush; #endif // // Use something like the following if // you are looking for errors. // #ifdef DUMP if (control -> ProxyMode == proxy_server && start < end && transport_ -> fd() == 6 || transport_ -> fd() == 11) { *logofs << "ProxyReadBuffer: Partial checksums are:\n"; DumpBlockChecksums(start, end - start, 256); *logofs << logofs_flush; } #endif do { if (nextSrc >= end) { remaining_ = 1; #ifdef TEST *logofs << "ProxyReadBuffer: No message was located " << "with remaining " << remaining_ << ".\n" << logofs_flush; #endif return 0; } next = *nextSrc++; dataLength <<= 7; dataLength |= (unsigned int) (next & 0x7f); lengthLength++; } while (next & 0x80); unsigned int totalLength; if (dataLength == 0) { trailerLength = 0; controlLength = 3; totalLength = controlLength; } else { trailerLength = lengthLength; controlLength = 0; totalLength = dataLength + trailerLength; } if (start + totalLength > end) { // // When having to decompress a ZLIB stream, // a single byte can be enough to complete // the frame. // if (control -> RemoteStreamCompression == 0) { remaining_ = totalLength - (end - start); } else { remaining_ = 1; } #ifdef TEST *logofs << "ProxyReadBuffer: No message was located " << "with remaining " << remaining_ << ".\n" << logofs_flush; #endif return 0; } else { #ifdef DUMP *logofs << "ProxyReadBuffer: Received " << totalLength << " bytes of data " << "with checksum "; DumpChecksum(start, totalLength); *logofs << " on proxy FD#" << transport_ -> fd() << ".\n" << logofs_flush; #endif #if defined(TEST) || defined(INFO) *logofs << "ProxyReadBuffer: Produced plain input for " << dataLength << "+" << trailerLength << "+" << controlLength << " bytes out of " << totalLength << " bytes.\n" << logofs_flush; #endif #ifdef DUMP *logofs << "ProxyReadBuffer: Partial checksums are:\n"; DumpBlockChecksums(start, totalLength, 256); *logofs << logofs_flush; #endif remaining_ = 0; #ifdef TEST *logofs << "ProxyReadBuffer: Located message with " << "remaining " << remaining_ << ".\n" << logofs_flush; #endif return 1; } } nx-libs-3.5.99.23/nxcomp/src/ProxyReadBuffer.h0000644000000000000000000000477413614532331015636 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ProxyReadBuffer_H #define ProxyReadBuffer_H #include "ReadBuffer.h" #include "Control.h" class ProxyReadBuffer : public ReadBuffer { public: ProxyReadBuffer(Transport *transport) : ReadBuffer(transport) { } virtual ~ProxyReadBuffer() { } protected: virtual unsigned int suggestedLength(unsigned int pendingLength); virtual int locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &controlLength, unsigned int &dataLength, unsigned int &trailerLength); }; #endif /* ProxyReadBuffer_H */ nx-libs-3.5.99.23/nxcomp/src/PutImage.cpp0000644000000000000000000003155613614532331014633 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "PutImage.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "WriteBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Constructors and destructors. // PutImageStore::PutImageStore(StaticCompressor *compressor) : MessageStore(compressor) { enableCache = PUTIMAGE_ENABLE_CACHE; enableData = PUTIMAGE_ENABLE_DATA; // Since ProtoStep7 (#issue 108) enableCompress = PUTIMAGE_ENABLE_COMPRESS_IF_PROTO_STEP_7; dataLimit = PUTIMAGE_DATA_LIMIT; dataOffset = PUTIMAGE_DATA_OFFSET; cacheSlots = PUTIMAGE_CACHE_SLOTS; cacheThreshold = PUTIMAGE_CACHE_THRESHOLD; cacheLowerThreshold = PUTIMAGE_CACHE_LOWER_THRESHOLD; // Since ProtoStep8 (#issue 108) enableSplit = PUTIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } PutImageStore::~PutImageStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } // // Here are the methods to handle messages' content. // int PutImageStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; #endif encodeBuffer.encodeValue(GetUINT(buffer + 2, bigEndian), 16, 8); encodeBuffer.encodeValue((unsigned int) buffer[1], 2); encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), clientCache -> drawableCache); encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), clientCache -> gcCache); unsigned int width = GetUINT(buffer + 12, bigEndian); encodeBuffer.encodeCachedValue(width, 16, clientCache -> putImageWidthCache, 8); unsigned int height = GetUINT(buffer + 14, bigEndian); encodeBuffer.encodeCachedValue(height, 16, clientCache -> putImageHeightCache, 8); unsigned int x = GetUINT(buffer + 16, bigEndian); int xDiff = x - clientCache -> putImageLastX; clientCache -> putImageLastX = x; encodeBuffer.encodeCachedValue(xDiff, 16, clientCache -> putImageXCache, 8); unsigned int y = GetUINT(buffer + 18, bigEndian); int yDiff = y - clientCache -> putImageLastY; clientCache -> putImageLastY = y; encodeBuffer.encodeCachedValue(yDiff, 16, clientCache -> putImageYCache, 8); encodeBuffer.encodeCachedValue(buffer[20], 8, clientCache -> putImageLeftPadCache); encodeBuffer.encodeCachedValue(buffer[21], 8, clientCache -> depthCache); #ifdef DEBUG *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; #endif return 1; } int PutImageStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; #endif unsigned int value; unsigned char cValue; decodeBuffer.decodeValue(value, 16, 8); size = (value << 2); buffer = writeBuffer -> addMessage(size); decodeBuffer.decodeValue(value, 2); buffer[1] = (unsigned char) value; decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); PutULONG(value, buffer + 4, bigEndian); decodeBuffer.decodeXidValue(value, clientCache -> gcCache); PutULONG(value, buffer + 8, bigEndian); unsigned int width; decodeBuffer.decodeCachedValue(width, 16, clientCache -> putImageWidthCache, 8); PutUINT(width, buffer + 12, bigEndian); unsigned int height; decodeBuffer.decodeCachedValue(height, 16, clientCache -> putImageHeightCache, 8); PutUINT(height, buffer + 14, bigEndian); decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageXCache, 8); clientCache -> putImageLastX += value; clientCache -> putImageLastX &= 0xffff; PutUINT(clientCache -> putImageLastX, buffer + 16, bigEndian); decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageYCache, 8); clientCache -> putImageLastY += value; clientCache -> putImageLastY &= 0xffff; PutUINT(clientCache -> putImageLastY, buffer + 18, bigEndian); decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> putImageLeftPadCache); buffer[20] = cValue; decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> depthCache); buffer[21] = cValue; #ifdef DEBUG *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; #endif return 1; } int PutImageStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { PutImageMessage *putImage = (PutImageMessage *) message; // // Here is the fingerprint. // putImage -> format = *(buffer + 1); putImage -> depth = *(buffer + 21); putImage -> left_pad = *(buffer + 20); putImage -> width = GetUINT(buffer + 12, bigEndian); putImage -> height = GetUINT(buffer + 14, bigEndian); putImage -> pos_x = GetUINT(buffer + 16, bigEndian); putImage -> pos_y = GetUINT(buffer + 18, bigEndian); putImage -> drawable = GetULONG(buffer + 4, bigEndian); putImage -> gcontext = GetULONG(buffer + 8, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } int PutImageStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { PutImageMessage *putImage = (PutImageMessage *) message; // // Fill all the message's fields. // *(buffer + 1) = putImage -> format; PutULONG(putImage -> drawable, buffer + 4, bigEndian); PutULONG(putImage -> gcontext, buffer + 8, bigEndian); PutUINT(putImage -> width, buffer + 12, bigEndian); PutUINT(putImage -> height, buffer + 14, bigEndian); PutUINT(putImage -> pos_x, buffer + 16, bigEndian); PutUINT(putImage -> pos_y, buffer + 18, bigEndian); *(buffer + 20) = (unsigned char) putImage -> left_pad; *(buffer + 21) = (unsigned char) putImage -> depth; #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } void PutImageStore::dumpIdentity(const Message *message) const { #ifdef DUMP PutImageMessage *putImage = (PutImageMessage *) message; *logofs << name() << ": Identity format " << (unsigned) putImage -> format << ", depth " << (unsigned) putImage -> depth << ", left_pad " << (unsigned) putImage -> left_pad << ", width " << putImage -> width << ", height " << putImage -> height << ", pos_x " << putImage -> pos_x << ", pos_y " << putImage -> pos_y << ", drawable " << putImage -> drawable << ", gcontext " << putImage -> gcontext << ", size " << putImage -> size_ << ".\n" << logofs_flush; #endif } void PutImageStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { // // Fields format, width, height, left_pad, depth. // md5_append(md5_state_, buffer + 1, 1); md5_append(md5_state_, buffer + 12, 4); md5_append(md5_state_, buffer + 20, 2); } void PutImageStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { // // Encode the variant part. // PutImageMessage *putImage = (PutImageMessage *) message; PutImageMessage *cachedPutImage = (PutImageMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << putImage -> drawable << " as drawable field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(putImage -> drawable, clientCache -> drawableCache); cachedPutImage -> drawable = putImage -> drawable; #ifdef TEST *logofs << name() << ": Encoding value " << putImage -> gcontext << " as gcontext field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(putImage -> gcontext, clientCache -> gcCache); cachedPutImage -> gcontext = putImage -> gcontext; #ifdef TEST *logofs << name() << ": Encoding value " << putImage -> pos_x << " as " << "pos_x" << " field.\n" << logofs_flush; #endif unsigned short int diff_x = putImage -> pos_x - cachedPutImage -> pos_x; encodeBuffer.encodeCachedValue(diff_x, 16, clientCache -> putImageXCache, 8); cachedPutImage -> pos_x = putImage -> pos_x; #ifdef TEST *logofs << name() << ": Encoding value " << putImage -> pos_y << " as " << "pos_y" << " field.\n" << logofs_flush; #endif unsigned short int diff_y = putImage -> pos_y - cachedPutImage -> pos_y; encodeBuffer.encodeCachedValue(diff_y, 16, clientCache -> putImageYCache, 8); cachedPutImage -> pos_y = putImage -> pos_y; } void PutImageStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { // // Decode the variant part. // PutImageMessage *putImage = (PutImageMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); putImage -> drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << putImage -> drawable << " as drawable field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> gcCache); putImage -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << putImage -> gcontext << " as gcontext field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageXCache, 8); putImage -> pos_x += value; putImage -> pos_x &= 0xffff; #ifdef DEBUG *logofs << name() << ": Decoded value " << putImage -> pos_x << " as pos_x field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageYCache, 8); putImage -> pos_y += value; putImage -> pos_y &= 0xffff; #ifdef DEBUG *logofs << name() << ": Decoded value " << putImage -> pos_y << " as pos_y field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/PutImage.h0000644000000000000000000001253613614532331014275 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef PutImage_H #define PutImage_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define PUTIMAGE_ENABLE_CACHE 1 #define PUTIMAGE_ENABLE_DATA 1 #define PUTIMAGE_DATA_LIMIT 262144 - 24 #define PUTIMAGE_DATA_OFFSET 24 #define PUTIMAGE_CACHE_SLOTS 6000 #define PUTIMAGE_CACHE_THRESHOLD 70 #define PUTIMAGE_CACHE_LOWER_THRESHOLD 50 #define PUTIMAGE_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 #define PUTIMAGE_CACHE_THRESHOLD_IF_PACKED 10 #define PUTIMAGE_CACHE_LOWER_THRESHOLD_IF_PACKED 5 #define PUTIMAGE_CACHE_THRESHOLD_IF_SHADOW 97 #define PUTIMAGE_CACHE_LOWER_THRESHOLD_IF_SHADOW 90 #define PUTIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8 0 // // The message class. // class PutImageMessage : public Message { friend class PutImageStore; public: PutImageMessage() { } ~PutImageMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char format; unsigned char depth; unsigned char left_pad; unsigned short width; unsigned short height; unsigned int drawable; unsigned int gcontext; unsigned short pos_x; unsigned short pos_y; }; class PutImageStore : public MessageStore { public: PutImageStore(StaticCompressor *compressor); virtual ~PutImageStore(); virtual const char *name() const { return "PutImage"; } virtual unsigned char opcode() const { return X_PutImage; } virtual unsigned int storage() const { return sizeof(PutImageMessage); } // // Message handling methods. // protected: virtual Message *create() const { return new PutImageMessage(); } virtual Message *create(const Message &message) const { return new PutImageMessage((const PutImageMessage &) message); } virtual void destroy(Message *message) const { delete (PutImageMessage *) message; } virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const; virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* PutImage_H */ nx-libs-3.5.99.23/nxcomp/src/PutPackedImage.cpp0000644000000000000000000004764413614532331015750 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "PutPackedImage.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "WriteBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Constructors and destructors. // PutPackedImageStore::PutPackedImageStore(StaticCompressor *compressor) : MessageStore(compressor) { enableCache = PUTPACKEDIMAGE_ENABLE_CACHE; enableData = PUTPACKEDIMAGE_ENABLE_DATA; enableCompress = PUTPACKEDIMAGE_ENABLE_COMPRESS; dataLimit = PUTPACKEDIMAGE_DATA_LIMIT; dataOffset = PUTPACKEDIMAGE_DATA_OFFSET; cacheSlots = PUTPACKEDIMAGE_CACHE_SLOTS; cacheThreshold = PUTPACKEDIMAGE_CACHE_THRESHOLD; cacheLowerThreshold = PUTPACKEDIMAGE_CACHE_LOWER_THRESHOLD; // Since ProtoStep8 (#issue 108) enableSplit = PUTPACKEDIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } PutPackedImageStore::~PutPackedImageStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } // // Here are the methods to handle messages' content. // int PutPackedImageStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; #endif // Client. encodeBuffer.encodeCachedValue(*(buffer + 1), 8, clientCache -> resourceCache); // Size. encodeBuffer.encodeValue(GetUINT(buffer + 2, bigEndian), 16, 10); // Drawable. encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), clientCache -> drawableCache); // GC. encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), clientCache -> gcCache); // Method. encodeBuffer.encodeCachedValue(*(buffer + 12), 8, clientCache -> methodCache); // Format. encodeBuffer.encodeValue(*(buffer + 13), 2); // SrcDepth. encodeBuffer.encodeCachedValue(*(buffer + 14), 8, clientCache -> depthCache); // DstDepth. encodeBuffer.encodeCachedValue(*(buffer + 15), 8, clientCache -> depthCache); // SrcLength. encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 24, clientCache -> putPackedImageSrcLengthCache); // DstLength. encodeBuffer.encodeCachedValue(GetULONG(buffer + 20, bigEndian), 24, clientCache -> putPackedImageDstLengthCache); // SrcX. unsigned int x = GetUINT(buffer + 24, bigEndian); int xDiff = x - clientCache -> putImageLastX; clientCache -> putImageLastX = x; encodeBuffer.encodeCachedValue(xDiff, 16, clientCache -> putImageXCache, 8); // SrcY. unsigned int y = GetUINT(buffer + 26, bigEndian); int yDiff = y - clientCache -> putImageLastY; clientCache -> putImageLastY = y; encodeBuffer.encodeCachedValue(yDiff, 16, clientCache -> putImageYCache, 8); // SrcWidth. encodeBuffer.encodeCachedValue(GetUINT(buffer + 28, bigEndian), 16, clientCache -> putImageWidthCache, 8); // SrcHeight. encodeBuffer.encodeCachedValue(GetUINT(buffer + 30, bigEndian), 16, clientCache -> putImageHeightCache, 8); // DstX. x = GetUINT(buffer + 32, bigEndian); xDiff = x - clientCache -> putImageLastX; clientCache -> putImageLastX = x; encodeBuffer.encodeCachedValue(xDiff, 16, clientCache -> putImageXCache, 8); // DstY. y = GetUINT(buffer + 34, bigEndian); yDiff = y - clientCache -> putImageLastY; clientCache -> putImageLastY = y; encodeBuffer.encodeCachedValue(yDiff, 16, clientCache -> putImageYCache, 8); // DstWidth. encodeBuffer.encodeCachedValue(GetUINT(buffer + 36, bigEndian), 16, clientCache -> putImageWidthCache, 8); // DstHeight. encodeBuffer.encodeCachedValue(GetUINT(buffer + 38, bigEndian), 16, clientCache -> putImageHeightCache, 8); #ifdef DEBUG *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; #endif return 1; } int PutPackedImageStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; #endif unsigned int value; unsigned char cValue; // Client. decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> resourceCache); // Size. decodeBuffer.decodeValue(size, 16, 10); size <<= 2; buffer = writeBuffer -> addMessage(size); *(buffer + 1) = cValue; // Drawable. decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); PutULONG(value, buffer + 4, bigEndian); // GC. decodeBuffer.decodeXidValue(value, clientCache -> gcCache); PutULONG(value, buffer + 8, bigEndian); // Method. decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> methodCache); *(buffer + 12) = cValue; // Format. decodeBuffer.decodeValue(value, 2); *(buffer + 13) = value; // SrcDepth. decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> depthCache); *(buffer + 14) = cValue; // DstDepth. decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> depthCache); *(buffer + 15) = cValue; // SrcLength. decodeBuffer.decodeCachedValue(value, 24, clientCache -> putPackedImageSrcLengthCache); PutULONG(value, buffer + 16, bigEndian); // DstLength. decodeBuffer.decodeCachedValue(value, 24, clientCache -> putPackedImageDstLengthCache); PutULONG(value, buffer + 20, bigEndian); // SrcX. decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageXCache, 8); clientCache -> putImageLastX += value; clientCache -> putImageLastX &= 0xffff; PutUINT(clientCache -> putImageLastX, buffer + 24, bigEndian); // SrcY. decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageYCache, 8); clientCache -> putImageLastY += value; clientCache -> putImageLastY &= 0xffff; PutUINT(clientCache -> putImageLastY, buffer + 26, bigEndian); // SrcWidth. decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageWidthCache, 8); PutUINT(value, buffer + 28, bigEndian); // SrcHeight. decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageHeightCache, 8); PutUINT(value, buffer + 30, bigEndian); // DstX. decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageXCache, 8); clientCache -> putImageLastX += value; clientCache -> putImageLastX &= 0xffff; PutUINT(clientCache -> putImageLastX, buffer + 32, bigEndian); // DstY. decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageYCache, 8); clientCache -> putImageLastY += value; clientCache -> putImageLastY &= 0xffff; PutUINT(clientCache -> putImageLastY, buffer + 34, bigEndian); // DstWidth. decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageWidthCache, 8); PutUINT(value, buffer + 36, bigEndian); // DstHeight. decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageHeightCache, 8); PutUINT(value, buffer + 38, bigEndian); #ifdef DEBUG *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; #endif return 1; } int PutPackedImageStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; // // Here is the fingerprint. // putPackedImage -> client = *(buffer + 1); putPackedImage -> drawable = GetULONG(buffer + 4, bigEndian); putPackedImage -> gcontext = GetULONG(buffer + 8, bigEndian); putPackedImage -> method = *(buffer + 12); putPackedImage -> format = *(buffer + 13); putPackedImage -> src_depth = *(buffer + 14); putPackedImage -> dst_depth = *(buffer + 15); putPackedImage -> src_length = GetULONG(buffer + 16, bigEndian); putPackedImage -> dst_length = GetULONG(buffer + 20, bigEndian); putPackedImage -> src_x = GetUINT(buffer + 24, bigEndian); putPackedImage -> src_y = GetUINT(buffer + 26, bigEndian); putPackedImage -> src_width = GetUINT(buffer + 28, bigEndian); putPackedImage -> src_height = GetUINT(buffer + 30, bigEndian); putPackedImage -> dst_x = GetUINT(buffer + 32, bigEndian); putPackedImage -> dst_y = GetUINT(buffer + 34, bigEndian); putPackedImage -> dst_width = GetUINT(buffer + 36, bigEndian); putPackedImage -> dst_height = GetUINT(buffer + 38, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } int PutPackedImageStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; // // Fill all the message's fields. // *(buffer + 1) = putPackedImage -> client; PutULONG(putPackedImage -> drawable, buffer + 4, bigEndian); PutULONG(putPackedImage -> gcontext, buffer + 8, bigEndian); *(buffer + 12) = putPackedImage -> method; *(buffer + 13) = putPackedImage -> format; *(buffer + 14) = putPackedImage -> src_depth; *(buffer + 15) = putPackedImage -> dst_depth; PutULONG(putPackedImage -> src_length, buffer + 16, bigEndian); PutULONG(putPackedImage -> dst_length, buffer + 20, bigEndian); PutUINT(putPackedImage -> src_x, buffer + 24, bigEndian); PutUINT(putPackedImage -> src_y, buffer + 26, bigEndian); PutUINT(putPackedImage -> src_width, buffer + 28, bigEndian); PutUINT(putPackedImage -> src_height, buffer + 30, bigEndian); PutUINT(putPackedImage -> dst_x, buffer + 32, bigEndian); PutUINT(putPackedImage -> dst_y, buffer + 34, bigEndian); PutUINT(putPackedImage -> dst_width, buffer + 36, bigEndian); PutUINT(putPackedImage -> dst_height, buffer + 38, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } void PutPackedImageStore::dumpIdentity(const Message *message) const { #ifdef DUMP PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; *logofs << name() << ": Identity format " << "drawable " << putPackedImage -> drawable << ", " << "gcontext " << putPackedImage -> gcontext << ", " << "format " << (unsigned int) putPackedImage -> format << ", " << "method " << (unsigned int) putPackedImage -> method << ", " << "src_depth " << (unsigned int) putPackedImage -> src_depth << ", " << "dst_depth " << (unsigned int) putPackedImage -> dst_depth << ", " << "src_length " << putPackedImage -> src_length << ", " << "dst_length " << putPackedImage -> dst_length << ", " << "src_x " << putPackedImage -> src_x << ", " << "src_y " << putPackedImage -> src_y << ", " << "src_width " << putPackedImage -> src_width << ", " << "src_height " << putPackedImage -> src_height << ", " << "dst_x " << putPackedImage -> dst_x << ", " << "dst_y " << putPackedImage -> dst_y << ", " << "dst_width " << putPackedImage -> dst_width << ", " << "dst_height " << putPackedImage -> dst_height << ", " << "size " << putPackedImage -> size_ << ".\n" << logofs_flush; #endif } void PutPackedImageStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { // // Fields method, format, src_depth, dst_depth, // src_length, dst_length, src_x, src_y, src_width, // src_height. // // // TODO: We should better investigate the effect of // having fields src_x and src_y in identity instead // of keeping them in differences. // md5_append(md5_state_, buffer + 12, 20); } void PutPackedImageStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { // // Encode the variant part. // PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; PutPackedImageMessage *cachedPutPackedImage = (PutPackedImageMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << (unsigned int) putPackedImage -> client << " as client field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(putPackedImage -> client, 8, clientCache -> resourceCache); cachedPutPackedImage -> client = putPackedImage -> client; #ifdef TEST *logofs << name() << ": Encoding value " << putPackedImage -> drawable << " as drawable field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(putPackedImage -> drawable, clientCache -> drawableCache); cachedPutPackedImage -> drawable = putPackedImage -> drawable; #ifdef TEST *logofs << name() << ": Encoding value " << putPackedImage -> gcontext << " as gcontext field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(putPackedImage -> gcontext, clientCache -> gcCache); cachedPutPackedImage -> gcontext = putPackedImage -> gcontext; #ifdef TEST *logofs << name() << ": Encoding value " << putPackedImage -> dst_x << " as " << "dst_x" << " field.\n" << logofs_flush; #endif unsigned short int diff_x = putPackedImage -> dst_x - cachedPutPackedImage -> dst_x; encodeBuffer.encodeCachedValue(diff_x, 16, clientCache -> putImageXCache, 8); cachedPutPackedImage -> dst_x = putPackedImage -> dst_x; #ifdef TEST *logofs << name() << ": Encoding value " << putPackedImage -> dst_y << " as " << "dst_y" << " field.\n" << logofs_flush; #endif unsigned short int diff_y = putPackedImage -> dst_y - cachedPutPackedImage -> dst_y; encodeBuffer.encodeCachedValue(diff_y, 16, clientCache -> putImageYCache, 8); cachedPutPackedImage -> dst_y = putPackedImage -> dst_y; #ifdef TEST *logofs << name() << ": Encoding value " << putPackedImage -> dst_width << " as " << "dst_width" << " field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(putPackedImage -> dst_width, 16, clientCache -> putImageWidthCache, 8); cachedPutPackedImage -> dst_width = putPackedImage -> dst_width; #ifdef TEST *logofs << name() << ": Encoding value " << putPackedImage -> dst_height << " as " << "dst_height" << " field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(putPackedImage -> dst_height, 16, clientCache -> putImageHeightCache, 8); cachedPutPackedImage -> dst_height = putPackedImage -> dst_height; } void PutPackedImageStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { // // Decode the variant part. // PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeCachedValue(putPackedImage -> client, 8, clientCache -> resourceCache); #ifdef DEBUG *logofs << name() << ": Decoded value " << (unsigned int) putPackedImage -> client << " as client field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); putPackedImage -> drawable = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << putPackedImage -> drawable << " as drawable field.\n" << logofs_flush; #endif decodeBuffer.decodeXidValue(value, clientCache -> gcCache); putPackedImage -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << putPackedImage -> gcontext << " as gcontext field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageXCache, 8); putPackedImage -> dst_x += value; putPackedImage -> dst_x &= 0xffff; #ifdef DEBUG *logofs << name() << ": Decoded value " << putPackedImage -> dst_x << " as dst_x field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageYCache, 8); putPackedImage -> dst_y += value; putPackedImage -> dst_y &= 0xffff; #ifdef DEBUG *logofs << name() << ": Decoded value " << putPackedImage -> dst_y << " as dst_y field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageWidthCache, 8); putPackedImage -> dst_width = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << putPackedImage -> dst_width << " as dst_width field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, clientCache -> putImageHeightCache, 8); putPackedImage -> dst_height = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << putPackedImage -> dst_height << " as dst_height field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/PutPackedImage.h0000644000000000000000000001435613614532331015407 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef PutPackedImage_H #define PutPackedImage_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define PUTPACKEDIMAGE_ENABLE_CACHE 1 #define PUTPACKEDIMAGE_ENABLE_DATA 1 #define PUTPACKEDIMAGE_ENABLE_COMPRESS 0 // // We can't exceed a length of 262144 bytes. // #define PUTPACKEDIMAGE_DATA_LIMIT 262144 - 40 #define PUTPACKEDIMAGE_DATA_OFFSET 40 #define PUTPACKEDIMAGE_CACHE_SLOTS 6000 #define PUTPACKEDIMAGE_CACHE_THRESHOLD 70 #define PUTPACKEDIMAGE_CACHE_LOWER_THRESHOLD 50 #define PUTPACKEDIMAGE_CACHE_THRESHOLD_IF_PACKED_SHADOW 97 #define PUTPACKEDIMAGE_CACHE_LOWER_THRESHOLD_IF_PACKED_SHADOW 90 #define PUTPACKEDIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8 0 // // The message class. // class PutPackedImageMessage : public Message { friend class PutPackedImageStore; public: PutPackedImageMessage() { } ~PutPackedImageMessage() { } // // Here are the fields which constitute // the 'identity' part of the message. // private: unsigned char client; unsigned int drawable; unsigned int gcontext; unsigned char format; unsigned char method; unsigned char src_depth; unsigned char dst_depth; unsigned int src_length; unsigned int dst_length; short int src_x; short int src_y; unsigned short src_width; unsigned short src_height; short int dst_x; short int dst_y; unsigned short dst_width; unsigned short dst_height; }; class PutPackedImageStore : public MessageStore { // // Constructors and destructors. // public: PutPackedImageStore(StaticCompressor *compressor); virtual ~PutPackedImageStore(); virtual const char *name() const { return "PutPackedImage"; } virtual unsigned char opcode() const { return X_NXPutPackedImage; } virtual unsigned int storage() const { return sizeof(PutPackedImageMessage); } // // Very special of this class. // int getPackedSize(const int position) const { PutPackedImageMessage *message = (PutPackedImageMessage *) (*messages_)[position]; if (message == NULL) { return 0; } return dataOffset + message -> src_length; } int getUnpackedSize(const int position) const { PutPackedImageMessage *message = (PutPackedImageMessage *) (*messages_)[position]; if (message == NULL) { return 0; } return dataOffset + message -> dst_length; } // // Message handling methods. // protected: virtual Message *create() const { return new PutPackedImageMessage(); } virtual Message *create(const Message &message) const { return new PutPackedImageMessage((const PutPackedImageMessage &) message); } virtual void destroy(Message *message) const { delete (PutPackedImageMessage *) message; } virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const; virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* PutPackedImage_H */ nx-libs-3.5.99.23/nxcomp/src/QueryFontReply.cpp0000644000000000000000000001101113614532331016050 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "QueryFontReply.h" #include "ServerCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP QueryFontReplyStore::QueryFontReplyStore(StaticCompressor *compressor) : MessageStore(compressor) { enableCache = QUERYFONTREPLY_ENABLE_CACHE; enableData = QUERYFONTREPLY_ENABLE_DATA; enableSplit = QUERYFONTREPLY_ENABLE_SPLIT; // Since ProtoStep7 (#issue 108) enableCompress = QUERYFONTREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; dataLimit = QUERYFONTREPLY_DATA_LIMIT; dataOffset = QUERYFONTREPLY_DATA_OFFSET; cacheSlots = QUERYFONTREPLY_CACHE_SLOTS; cacheThreshold = QUERYFONTREPLY_CACHE_THRESHOLD; cacheLowerThreshold = QUERYFONTREPLY_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } QueryFontReplyStore::~QueryFontReplyStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } // // Here are the methods to handle messages' content. // int QueryFontReplyStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { // // Clear the padding bytes. // unsigned char *pad = (unsigned char *) buffer; if (size >= 24) { PutULONG(0, pad + 20, bigEndian); } if (size >= 40) { PutULONG(0, pad + 36, bigEndian); } // // TODO: This doesn't work. Probably these // padding bytes are not padding anymore. // This is to be investigated. // // pad += 60; // // while (pad + 16 <= (buffer + size)) // { // PutULONG(0, pad + 12, bigEndian); // // pad += 16; // } // #ifdef DEBUG *logofs << name() << ": Cleaned padding bytes of " << "message at " << message << ".\n" << logofs_flush; #endif return 1; } int QueryFontReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { return 1; } void QueryFontReplyStore::dumpIdentity(const Message *message) const { #ifdef DUMP QueryFontReplyMessage *queryFontReply = (QueryFontReplyMessage *) message; *logofs << name() << ": Identity size " << queryFontReply -> size_ << ".\n"; #endif } void QueryFontReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { } nx-libs-3.5.99.23/nxcomp/src/QueryFontReply.h0000644000000000000000000001013613614532331015524 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef QueryFontReply_H #define QueryFontReply_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define QUERYFONTREPLY_ENABLE_CACHE 1 #define QUERYFONTREPLY_ENABLE_DATA 1 #define QUERYFONTREPLY_ENABLE_SPLIT 0 #define QUERYFONTREPLY_DATA_LIMIT 1048576 - 32 #define QUERYFONTREPLY_DATA_OFFSET 8 #define QUERYFONTREPLY_CACHE_SLOTS 200 #define QUERYFONTREPLY_CACHE_THRESHOLD 20 #define QUERYFONTREPLY_CACHE_LOWER_THRESHOLD 5 #define QUERYFONTREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 // // The message class. // class QueryFontReplyMessage : public Message { friend class QueryFontReplyStore; public: QueryFontReplyMessage() { } ~QueryFontReplyMessage() { } }; class QueryFontReplyStore : public MessageStore { // // Constructors and destructors. // public: QueryFontReplyStore(StaticCompressor *compressor); virtual ~QueryFontReplyStore(); virtual const char *name() const { return "QueryFontReply"; } virtual unsigned char opcode() const { return X_QueryFont; } virtual unsigned int storage() const { return sizeof(QueryFontReplyMessage); } // // Message handling methods. // protected: virtual Message *create() const { return new QueryFontReplyMessage(); } virtual Message *create(const Message &message) const { return new QueryFontReplyMessage((const QueryFontReplyMessage &) message); } virtual void destroy(Message *message) const { delete (QueryFontReplyMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* QueryFontReply_H */ nx-libs-3.5.99.23/nxcomp/src/ReadBuffer.cpp0000644000000000000000000003572213614532331015124 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ReadBuffer.h" #include "Transport.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG ReadBuffer::ReadBuffer(Transport *transport) : transport_(transport) { // // The read buffer will grow until // reaching the maximum buffer size // and then will remain stable at // that size. // initialReadSize_ = READ_BUFFER_DEFAULT_SIZE; maximumBufferSize_ = READ_BUFFER_DEFAULT_SIZE; size_ = 0; buffer_ = NULL; owner_ = 1; length_ = 0; start_ = 0; remaining_ = 0; } ReadBuffer::~ReadBuffer() { if (owner_ == 1) { delete [] buffer_; } } void ReadBuffer::readMessage(const unsigned char *message, unsigned int length) { // // To be here we must be the real owner // of the buffer and there must not be // pending bytes in the transport. // #ifdef TEST if (owner_ == 0) { *logofs << "ReadBuffer: PANIC! Class for FD#" << transport_ -> fd() << " doesn't " << "appear to be the owner of the buffer " << "while borrowing from the caller.\n" << logofs_flush; HandleCleanup(); } #endif // // Be sure that any outstanding data from // the transport is appended to our own // byffer. // if (transport_ -> pending() != 0) { #ifdef WARNING *logofs << "ReadBuffer: WARNING! Class for FD#" << transport_ -> fd() << " has pending " << "data in the transport while " << "borrowing from the caller.\n" << logofs_flush; #endif readMessage(); if (owner_ == 0) { convertBuffer(); } } // // Can't borrow the buffer if there is data // from a partial message. In this case add // the new data to the end of our buffer. // if (length_ == 0) { #ifdef TEST *logofs << "ReadBuffer: Borrowing " << length << " bytes from the caller for FD#" << transport_ -> fd() << " with " << length_ << " bytes in the buffer.\n" << logofs_flush; #endif delete [] buffer_; buffer_ = (unsigned char *) message; size_ = length; length_ = length; owner_ = 0; start_ = 0; } else { #ifdef TEST *logofs << "ReadBuffer: Appending " << length << " bytes from the caller for FD#" << transport_ -> fd() << " with " << length_ << " bytes in the buffer.\n" << logofs_flush; #endif appendBuffer(message, length); } } int ReadBuffer::readMessage() { int pendingLength = transport_ -> pending(); if (pendingLength > 0) { // // Can't move the data in the borrowed buffer, // so use the tansport buffer only if we don't // have any partial message. This can happen // with the proxy where we need to deflate the // stream. // if (length_ == 0) { unsigned char *newBuffer; length_ = transport_ -> getPending(newBuffer); if (newBuffer == NULL) { #ifdef PANIC *logofs << "ReadBuffer: PANIC! Failed to borrow " << length_ << " bytes of memory for buffer " << "in context [A].\n" << logofs_flush; #endif cerr << "Error" << ": Failed to borrow memory for " << "read buffer in context [A].\n"; HandleCleanup(); } delete [] buffer_; buffer_ = newBuffer; size_ = length_; owner_ = 0; start_ = 0; #ifdef TEST *logofs << "ReadBuffer: Borrowed " << length_ << " pending bytes for FD#" << transport_ -> fd() << ".\n" << logofs_flush; #endif return length_; } #ifdef TEST else { *logofs << "ReadBuffer: WARNING! Cannot borrow " << pendingLength << " bytes for FD#" << transport_ -> fd() << " with " << length_ << " bytes in the buffer.\n" << logofs_flush; } #endif } unsigned int readLength = suggestedLength(pendingLength); #ifdef DEBUG *logofs << "ReadBuffer: Requested " << readLength << " bytes for FD#" << transport_ -> fd() << " with readable " << transport_ -> readable() << " remaining " << remaining_ << " pending " << transport_ -> pending() << ".\n" << logofs_flush; #endif if (readLength < initialReadSize_) { readLength = initialReadSize_; } #ifdef DEBUG *logofs << "ReadBuffer: Buffer size is " << size_ << " length " << length_ << " and start " << start_ << ".\n" << logofs_flush; #endif // // We can't use the transport buffer // to read our own data in it. // #ifdef TEST if (owner_ == 0) { *logofs << "ReadBuffer: PANIC! Class for FD#" << transport_ -> fd() << " doesn't " << "appear to be the owner of the buffer " << "while reading.\n" << logofs_flush; HandleCleanup(); } #endif // // Be sure that we have enough space // to store all the requested data. // if (buffer_ == NULL || length_ + readLength > size_) { unsigned int newSize = length_ + readLength; #ifdef TEST *logofs << "ReadBuffer: Resizing buffer for FD#" << transport_ -> fd() << " in read from " << size_ << " to " << newSize << " bytes.\n" << logofs_flush; #endif unsigned char *newBuffer = allocateBuffer(newSize); memcpy(newBuffer, buffer_ + start_, length_); delete [] buffer_; buffer_ = newBuffer; size_ = newSize; transport_ -> pendingReset(); owner_ = 1; } else if (start_ != 0 && length_ != 0) { // // If any bytes are left due to a partial // message, shift them to the beginning // of the buffer. // #ifdef TEST *logofs << "ReadBuffer: Moving " << length_ << " bytes of data " << "at beginning of " << "the buffer for FD#" << transport_ -> fd() << ".\n" << logofs_flush; #endif memmove(buffer_, buffer_ + start_, length_); } start_ = 0; #ifdef DEBUG *logofs << "ReadBuffer: Buffer size is now " << size_ << " length is " << length_ << " and start is " << start_ << ".\n" << logofs_flush; #endif unsigned char *readData = buffer_ + length_; #ifdef DEBUG *logofs << "ReadBuffer: Going to read " << readLength << " bytes from FD#" << transport_ -> fd() << ".\n" << logofs_flush; #endif int bytesRead = transport_ -> read(readData, readLength); if (bytesRead > 0) { #ifdef TEST *logofs << "ReadBuffer: Read " << bytesRead << " bytes from FD#" << transport_ -> fd() << ".\n" << logofs_flush; #endif length_ += bytesRead; } else if (bytesRead < 0) { // // Check if there is more data pending than the // size of the provided buffer. After reading // the requested amount, in fact, the transport // may have decompressed the data and produced // more input. This trick allows us to always // borrow the buffer from the transport, even // when the partial read would have prevented // that. // if (transport_ -> pending() > 0) { #ifdef TEST *logofs << "ReadBuffer: WARNING! Trying to read some " << "more with " << transport_ -> pending() << " bytes pending for FD#" << transport_ -> fd() << ".\n" << logofs_flush; #endif return readMessage(); } #ifdef TEST *logofs << "ReadBuffer: Error detected reading " << "from FD#" << transport_ -> fd() << ".\n" << logofs_flush; #endif return -1; } #ifdef TEST else { *logofs << "ReadBuffer: No data read from FD#" << transport_ -> fd() << " with remaining " << remaining_ << ".\n" << logofs_flush; } #endif return bytesRead; } const unsigned char *ReadBuffer::getMessage(unsigned int &controlLength, unsigned int &dataLength) { #ifdef TEST if (transport_ -> pending() > 0) { *logofs << "ReadBuffer: PANIC! The transport " << "appears to have data pending.\n" << logofs_flush; HandleCleanup(); } #endif if (length_ == 0) { #ifdef DEBUG *logofs << "ReadBuffer: No message can be located " << "for FD#" << transport_ -> fd() << ".\n" << logofs_flush; #endif if (owner_ == 0) { buffer_ = NULL; size_ = 0; transport_ -> pendingReset(); owner_ = 1; start_ = 0; } return NULL; } unsigned int trailerLength; #ifdef DEBUG *logofs << "ReadBuffer: Going to locate message with " << "start at " << start_ << " and length " << length_ << " for FD#" << transport_ -> fd() << ".\n" << logofs_flush; #endif int located = locateMessage(buffer_ + start_, buffer_ + start_ + length_, controlLength, dataLength, trailerLength); if (located == 0) { // // No more complete messages are in // the buffer. // #ifdef DEBUG *logofs << "ReadBuffer: No message was located " << "for FD#" << transport_ -> fd() << ".\n" << logofs_flush; #endif if (owner_ == 0) { // // Must move the remaining bytes in // our own buffer. // convertBuffer(); } return NULL; } else { const unsigned char *result = buffer_ + start_; if (dataLength > 0) { // // Message contains data, so go to the // first byte of payload. // result += trailerLength; start_ += (dataLength + trailerLength); length_ -= (dataLength + trailerLength); } else { // // It is a control message. // start_ += (controlLength + trailerLength); length_ -= (controlLength + trailerLength); } #ifdef DEBUG *logofs << "ReadBuffer: Located message for FD#" << transport_ -> fd() << " with control length " << controlLength << " and data length " << dataLength << ".\n" << logofs_flush; #endif remaining_ = 0; return result; } } int ReadBuffer::setSize(int initialReadSize, int maximumBufferSize) { initialReadSize_ = initialReadSize; maximumBufferSize_ = maximumBufferSize; #ifdef TEST *logofs << "ReadBuffer: WARNING! Set buffer parameters to " << initialReadSize_ << "/" << maximumBufferSize_ << " for object at "<< this << ".\n" << logofs_flush; #endif return 1; } void ReadBuffer::fullReset() { #ifdef TEST if (owner_ == 0) { *logofs << "ReadBuffer: PANIC! Class for FD#" << transport_ -> fd() << " doesn't " << "appear to be the owner of the buffer " << "in reset.\n" << logofs_flush; HandleCleanup(); } #endif if (length_ == 0 && size_ > maximumBufferSize_) { #ifdef TEST *logofs << "ReadBuffer: Resizing buffer for FD#" << transport_ -> fd() << " in reset from " << size_ << " to " << maximumBufferSize_ << " bytes.\n" << logofs_flush; #endif delete [] buffer_; int newSize = maximumBufferSize_; unsigned char *newBuffer = allocateBuffer(newSize); buffer_ = newBuffer; size_ = newSize; transport_ -> pendingReset(); owner_ = 1; start_ = 0; } } unsigned char *ReadBuffer::allocateBuffer(unsigned int newSize) { unsigned char *newBuffer = new unsigned char[newSize]; if (newBuffer == NULL) { #ifdef PANIC *logofs << "ReadBuffer: PANIC! Can't allocate " << newSize << " bytes of memory for buffer " << "in context [B].\n" << logofs_flush; #endif cerr << "Error" << ": Can't allocate memory for " << "read buffer in context [B].\n"; HandleCleanup(); } #ifdef VALGRIND memset(newBuffer, '\0', newSize); #endif return newBuffer; } void ReadBuffer::appendBuffer(const unsigned char *message, unsigned int length) { if (start_ + length_ + length > size_) { unsigned int newSize = length_ + length + initialReadSize_; #ifdef TEST *logofs << "ReadBuffer: WARNING! Resizing buffer " << "for FD#" << transport_ -> fd() << " from " << size_ << " to " << newSize << " bytes.\n" << logofs_flush; #endif unsigned char *newBuffer = allocateBuffer(newSize); memcpy(newBuffer, buffer_ + start_, length_); delete [] buffer_; buffer_ = newBuffer; size_ = newSize; start_ = 0; } memcpy(buffer_ + start_ + length_, message, length); length_ += length; transport_ -> pendingReset(); owner_ = 1; } void ReadBuffer::convertBuffer() { unsigned int newSize = length_ + initialReadSize_; #ifdef TEST *logofs << "ReadBuffer: WARNING! Converting " << length_ << " bytes to own buffer " << "for FD#" << transport_ -> fd() << " with new size " << newSize << " bytes.\n" << logofs_flush; #endif unsigned char *newBuffer = allocateBuffer(newSize); memcpy(newBuffer, buffer_ + start_, length_); buffer_ = newBuffer; size_ = newSize; transport_ -> pendingReset(); owner_ = 1; start_ = 0; } nx-libs-3.5.99.23/nxcomp/src/ReadBuffer.h0000644000000000000000000000753613614532331014573 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ReadBuffer_H #define ReadBuffer_H #include "Misc.h" #include "Timestamp.h" #include "Transport.h" #define READ_BUFFER_DEFAULT_SIZE 8192 #define PANIC #define WARNING #undef TEST #undef DEBUG class ReadBuffer { public: ReadBuffer(Transport *transport); virtual ~ReadBuffer(); int readMessage(); void readMessage(const unsigned char *message, unsigned int length); const unsigned char *getMessage(unsigned int &dataLength) { unsigned int controlLength; return getMessage(controlLength, dataLength); } const unsigned char *getMessage(unsigned int &controlLength, unsigned int &dataLength); unsigned int getLength() const { return length_; } unsigned int getRemaining() const { return remaining_; } int setSize(int initialReadSize, int initialbufferSize); void fullReset(); // // Check if there is a complete // message in the buffer. // int checkMessage() { if (length_ == 0) { return 0; } else { unsigned int controlLength; unsigned int dataLength; unsigned int trailerLength; return (locateMessage(buffer_ + start_, buffer_ + start_ + length_, controlLength, dataLength, trailerLength)); } } protected: virtual unsigned int suggestedLength(unsigned int pendingLength) = 0; virtual int locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &controlLength, unsigned int &dataLength, unsigned int &trailerLength) = 0; unsigned char *allocateBuffer(unsigned int newSize); void appendBuffer(const unsigned char *message, unsigned int length); void convertBuffer(); Transport *transport_; unsigned char *buffer_; unsigned int length_; unsigned int size_; unsigned int start_; unsigned int remaining_; int owner_; unsigned int initialReadSize_; unsigned int maximumBufferSize_; }; #endif /* ReadBuffer_H */ nx-libs-3.5.99.23/nxcomp/src/RenderAddGlyphs.cpp0000644000000000000000000001635513614532331016137 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ // // Include the template for // this message class. // #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "RenderAddGlyphs.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #include MESSAGE_TAGS // // Message handling methods. // MESSAGE_BEGIN_ENCODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, clientCache -> renderLengthCache, 5); #ifdef TEST *logofs << name() << ": Encoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_SIZE MESSAGE_BEGIN_DECODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeCachedValue(size, 16, clientCache -> renderLengthCache, 5); size = MESSAGE_OFFSET + (size << 2); buffer = writeBuffer -> addMessage(size); #ifdef TEST *logofs << name() << ": Decoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_SIZE MESSAGE_BEGIN_ENCODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian), 29, clientCache -> renderGlyphSetCache); encodeBuffer.encodeCachedValue(GetULONG(buffer + 8, bigEndian), 32, clientCache -> renderNumGlyphsCache, 8); #ifdef TEST *logofs << name() << ": Encoded message. Type is " << (unsigned int) *(buffer + 1) << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_MESSAGE MESSAGE_BEGIN_DECODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; *(buffer + 1) = type; decodeBuffer.decodeCachedValue(value, 29, clientCache -> renderGlyphSetCache); PutULONG(value, buffer + 4, bigEndian); decodeBuffer.decodeCachedValue(value, 32, clientCache -> renderNumGlyphsCache, 8); PutULONG(value, buffer + 8, bigEndian); #ifdef TEST *logofs << name() << ": Decoded message. Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_MESSAGE MESSAGE_BEGIN_ENCODE_DATA { encodeCharData(encodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); #ifdef TEST *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_DATA MESSAGE_BEGIN_DECODE_DATA { decodeCharData(decodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); #ifdef TEST *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_DECODE_DATA MESSAGE_BEGIN_PARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; renderExtension -> data.add_glyphs.type = *(buffer + 1); renderExtension -> data.add_glyphs.set_id = GetULONG(buffer + 4, bigEndian); renderExtension -> data.add_glyphs.num_elm = GetULONG(buffer + 8, bigEndian); #ifdef TEST *logofs << name() << ": Parsed identity. Type is " << (unsigned int) renderExtension -> data.add_glyphs.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_PARSE_IDENTITY MESSAGE_BEGIN_UNPARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; *(buffer + 1) = renderExtension -> data.add_glyphs.type; PutULONG(renderExtension -> data.add_glyphs.set_id, buffer + 4, bigEndian); PutULONG(renderExtension -> data.add_glyphs.num_elm, buffer + 8, bigEndian); #ifdef TEST *logofs << name() << ": Unparsed identity. Type is " << (unsigned int) renderExtension -> data.add_glyphs.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_UNPARSE_IDENTITY MESSAGE_BEGIN_IDENTITY_CHECKSUM { md5_append(md5_state, buffer + 1, 3); md5_append(md5_state, buffer + 8, 4); } MESSAGE_END_IDENTITY_CHECKSUM MESSAGE_BEGIN_ENCODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue(renderExtension -> data.add_glyphs.set_id, 29, clientCache -> renderGlyphSetCache); cachedRenderExtension -> data.add_glyphs.set_id = renderExtension -> data.add_glyphs.set_id; #ifdef TEST *logofs << name() << ": Encoded update. Type is " << (unsigned int) renderExtension -> data.add_glyphs.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_UPDATE MESSAGE_BEGIN_DECODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeCachedValue(renderExtension -> data.add_glyphs.set_id, 29, clientCache -> renderGlyphSetCache); #ifdef TEST *logofs << name() << ": Decoded update. Type is " << (unsigned int) renderExtension -> data.add_glyphs.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_UPDATE nx-libs-3.5.99.23/nxcomp/src/RenderAddGlyphs.h0000644000000000000000000000600113614532331015567 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderAddGlyphs_H #define RenderAddGlyphs_H // // Define the characteristics // of this message class here. // #undef MESSAGE_NAME #define MESSAGE_NAME "RenderAddGlyphs" #undef MESSAGE_STORE #define MESSAGE_STORE RenderAddGlyphsStore #undef MESSAGE_CLASS #define MESSAGE_CLASS RenderMinorExtensionStore #undef MESSAGE_METHODS #define MESSAGE_METHODS "RenderMinorExtensionMethods.h" #undef MESSAGE_HEADERS #define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" #undef MESSAGE_TAGS #define MESSAGE_TAGS "RenderMinorExtensionTags.h" #undef MESSAGE_OFFSET #define MESSAGE_OFFSET 12 #undef MESSAGE_HAS_SIZE #define MESSAGE_HAS_SIZE 1 #undef MESSAGE_HAS_DATA #define MESSAGE_HAS_DATA 1 #undef MESSAGE_HAS_FILTER #define MESSAGE_HAS_FILTER 0 // // Declare the message class. // #include MESSAGE_HEADERS class MESSAGE_STORE : public MESSAGE_CLASS { public: virtual const char *name() const { return MESSAGE_NAME; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { return MESSAGE_OFFSET; } #include MESSAGE_METHODS }; #endif /* RenderAddGlyphs_H */ nx-libs-3.5.99.23/nxcomp/src/RenderChangePicture.cpp0000644000000000000000000001627013614532331016775 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ // // Include the template for // this message class. // #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "RenderChangePicture.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #include MESSAGE_TAGS // // Message handling methods. // MESSAGE_BEGIN_ENCODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, clientCache -> renderLengthCache, 5); #ifdef TEST *logofs << name() << ": Encoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_SIZE MESSAGE_BEGIN_DECODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeCachedValue(size, 16, clientCache -> renderLengthCache, 5); size = MESSAGE_OFFSET + (size << 2); buffer = writeBuffer -> addMessage(size); #ifdef TEST *logofs << name() << ": Decoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_SIZE MESSAGE_BEGIN_ENCODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), clientCache -> renderSrcPictureCache); #ifdef TEST *logofs << name() << ": Encoded message. Type is " << (unsigned int) *(buffer + 1) << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_MESSAGE MESSAGE_BEGIN_DECODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; *(buffer + 1) = type; decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); PutULONG(value, buffer + 4, bigEndian); #ifdef TEST *logofs << name() << ": Decoded message. Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_MESSAGE MESSAGE_BEGIN_ENCODE_DATA { #ifdef DEBUG if (size == MESSAGE_OFFSET + 4) { *logofs << name() << ": Mask is " << GetULONG(buffer + 8, bigEndian) << " value is " << GetULONG(buffer + 12, bigEndian) << ".\n" << logofs_flush; } else { *logofs << name() << ": WARNING! Unexpected size. Mask is " << GetULONG(buffer + 8, bigEndian) << ".\n" << logofs_flush; } #endif encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); #ifdef TEST *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_DATA MESSAGE_BEGIN_DECODE_DATA { decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); #ifdef TEST *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_DECODE_DATA MESSAGE_BEGIN_PARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; renderExtension -> data.change_picture.type = *(buffer + 1); renderExtension -> data.change_picture.src_id = GetULONG(buffer + 4, bigEndian); #ifdef TEST *logofs << name() << ": Parsed identity. Type is " << (unsigned int) renderExtension -> data.change_picture.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_PARSE_IDENTITY MESSAGE_BEGIN_UNPARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; *(buffer + 1) = renderExtension -> data.change_picture.type; PutULONG(renderExtension -> data.change_picture.src_id, buffer + 4, bigEndian); #ifdef TEST *logofs << name() << ": Unparsed identity. Type is " << (unsigned int) renderExtension -> data.change_picture.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_UNPARSE_IDENTITY MESSAGE_BEGIN_IDENTITY_CHECKSUM { md5_append(md5_state, buffer + 1, 3); } MESSAGE_END_IDENTITY_CHECKSUM MESSAGE_BEGIN_ENCODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeXidValue(renderExtension -> data.change_picture.src_id, clientCache -> renderSrcPictureCache); cachedRenderExtension -> data.change_picture.src_id = renderExtension -> data.change_picture.src_id; #ifdef TEST *logofs << name() << ": Encoded update. Type is " << (unsigned int) renderExtension -> data.change_picture.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_UPDATE MESSAGE_BEGIN_DECODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeXidValue(renderExtension -> data.change_picture.src_id, clientCache -> renderSrcPictureCache); #ifdef TEST *logofs << name() << ": Decoded update. Type is " << (unsigned int) renderExtension -> data.change_picture.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_UPDATE nx-libs-3.5.99.23/nxcomp/src/RenderChangePicture.h0000644000000000000000000000602413614532331016436 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderChangePicture_H #define RenderChangePicture_H // // Define the characteristics // of this message class here. // #undef MESSAGE_NAME #define MESSAGE_NAME "RenderChangePicture" #undef MESSAGE_STORE #define MESSAGE_STORE RenderChangePictureStore #undef MESSAGE_CLASS #define MESSAGE_CLASS RenderMinorExtensionStore #undef MESSAGE_METHODS #define MESSAGE_METHODS "RenderMinorExtensionMethods.h" #undef MESSAGE_HEADERS #define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" #undef MESSAGE_TAGS #define MESSAGE_TAGS "RenderMinorExtensionTags.h" #undef MESSAGE_OFFSET #define MESSAGE_OFFSET 8 #undef MESSAGE_HAS_SIZE #define MESSAGE_HAS_SIZE 1 #undef MESSAGE_HAS_DATA #define MESSAGE_HAS_DATA 1 #undef MESSAGE_HAS_FILTER #define MESSAGE_HAS_FILTER 0 // // Declare the message class. // #include MESSAGE_HEADERS class MESSAGE_STORE : public MESSAGE_CLASS { public: virtual const char *name() const { return MESSAGE_NAME; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { return MESSAGE_OFFSET; } #include MESSAGE_METHODS }; #endif /* RenderChangePicture_H */ nx-libs-3.5.99.23/nxcomp/src/RenderComposite.cpp0000644000000000000000000003234413614532331016216 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ // // Include the template for // this message class. // #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "RenderComposite.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #include MESSAGE_TAGS // // Message handling methods. // MESSAGE_BEGIN_ENCODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue(*(buffer + 4), 8, clientCache -> renderOpCache); encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), clientCache -> renderSrcPictureCache); encodeBuffer.encodeXidValue(GetULONG(buffer + 12, bigEndian), clientCache -> renderMaskPictureCache); encodeBuffer.encodeXidValue(GetULONG(buffer + 16, bigEndian), clientCache -> renderDstPictureCache); // // Src X and Y. // encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 20, bigEndian), clientCache -> renderLastX, 16, clientCache -> renderXCache, 11); encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 22, bigEndian), clientCache -> renderLastY, 16, clientCache -> renderYCache, 11); // // Mask X and Y. // encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 24, bigEndian), clientCache -> renderLastX, 16, clientCache -> renderXCache, 11); encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 26, bigEndian), clientCache -> renderLastY, 16, clientCache -> renderYCache, 11); // // Dst X and Y. // encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 28, bigEndian), clientCache -> renderLastX, 16, clientCache -> renderXCache, 11); encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 30, bigEndian), clientCache -> renderLastY, 16, clientCache -> renderYCache, 11); // // Width and height. // encodeBuffer.encodeCachedValue(GetUINT(buffer + 32, bigEndian), 16, clientCache -> renderWidthCache, 11); encodeBuffer.encodeCachedValue(GetUINT(buffer + 34, bigEndian), 16, clientCache -> renderHeightCache, 11); #ifdef TEST *logofs << name() << ": Encoded message. Type is " << (unsigned int) *(buffer + 1) << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_MESSAGE MESSAGE_BEGIN_DECODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; *(buffer + 1) = type; decodeBuffer.decodeCachedValue(*(buffer + 4), 8, clientCache -> renderOpCache); decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); PutULONG(value, buffer + 8, bigEndian); decodeBuffer.decodeXidValue(value, clientCache -> renderMaskPictureCache); PutULONG(value, buffer + 12, bigEndian); decodeBuffer.decodeXidValue(value, clientCache -> renderDstPictureCache); PutULONG(value, buffer + 16, bigEndian); // // Src X and Y. // decodeBuffer.decodeDiffCachedValue(value, clientCache -> renderLastX, 16, clientCache -> renderXCache, 11); PutUINT(clientCache -> renderLastX, buffer + 20, bigEndian); decodeBuffer.decodeDiffCachedValue(value, clientCache -> renderLastY, 16, clientCache -> renderYCache, 11); PutUINT(clientCache -> renderLastY, buffer + 22, bigEndian); // // Mask X and Y. // decodeBuffer.decodeDiffCachedValue(value, clientCache -> renderLastX, 16, clientCache -> renderXCache, 11); PutUINT(clientCache -> renderLastX, buffer + 24, bigEndian); decodeBuffer.decodeDiffCachedValue(value, clientCache -> renderLastY, 16, clientCache -> renderYCache, 11); PutUINT(clientCache -> renderLastY, buffer + 26, bigEndian); // // Dst X and Y. // decodeBuffer.decodeDiffCachedValue(value, clientCache -> renderLastX, 16, clientCache -> renderXCache, 11); PutUINT(clientCache -> renderLastX, buffer + 28, bigEndian); decodeBuffer.decodeDiffCachedValue(value, clientCache -> renderLastY, 16, clientCache -> renderYCache, 11); PutUINT(clientCache -> renderLastY, buffer + 30, bigEndian); // // Width and height. // decodeBuffer.decodeCachedValue(value, 16, clientCache -> renderWidthCache, 11); PutUINT(value, buffer + 32, bigEndian); decodeBuffer.decodeCachedValue(value, 16, clientCache -> renderHeightCache, 11); PutUINT(value, buffer + 34, bigEndian); #ifdef TEST *logofs << name() << ": Decoded message. Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_MESSAGE MESSAGE_BEGIN_PARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; renderExtension -> data.composite.type = *(buffer + 1); renderExtension -> data.composite.op = *(buffer + 4); renderExtension -> data.composite.src_id = GetULONG(buffer + 8, bigEndian); renderExtension -> data.composite.msk_id = GetULONG(buffer + 12, bigEndian); renderExtension -> data.composite.dst_id = GetULONG(buffer + 16, bigEndian); renderExtension -> data.composite.src_x = GetUINT(buffer + 20, bigEndian); renderExtension -> data.composite.src_y = GetUINT(buffer + 22, bigEndian); renderExtension -> data.composite.msk_x = GetUINT(buffer + 24, bigEndian); renderExtension -> data.composite.msk_y = GetUINT(buffer + 26, bigEndian); renderExtension -> data.composite.dst_x = GetUINT(buffer + 28, bigEndian); renderExtension -> data.composite.dst_y = GetUINT(buffer + 30, bigEndian); renderExtension -> data.composite.width = GetUINT(buffer + 32, bigEndian); renderExtension -> data.composite.height = GetUINT(buffer + 34, bigEndian); #ifdef TEST *logofs << name() << ": Parsed identity. Type is " << (unsigned int) renderExtension -> data.composite.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_PARSE_IDENTITY MESSAGE_BEGIN_UNPARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; *(buffer + 1) = renderExtension -> data.composite.type; *(buffer + 4) = renderExtension -> data.composite.op; PutULONG(renderExtension -> data.composite.src_id, buffer + 8, bigEndian); PutULONG(renderExtension -> data.composite.msk_id, buffer + 12, bigEndian); PutULONG(renderExtension -> data.composite.dst_id, buffer + 16, bigEndian); PutUINT(renderExtension -> data.composite.src_x, buffer + 20, bigEndian); PutUINT(renderExtension -> data.composite.src_y, buffer + 22, bigEndian); PutUINT(renderExtension -> data.composite.msk_x, buffer + 24, bigEndian); PutUINT(renderExtension -> data.composite.msk_y, buffer + 26, bigEndian); PutUINT(renderExtension -> data.composite.dst_x, buffer + 28, bigEndian); PutUINT(renderExtension -> data.composite.dst_y, buffer + 30, bigEndian); PutUINT(renderExtension -> data.composite.width, buffer + 32, bigEndian); PutUINT(renderExtension -> data.composite.height, buffer + 34, bigEndian); #ifdef TEST *logofs << name() << ": Unparsed identity. Type is " << (unsigned int) renderExtension -> data.composite.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_UNPARSE_IDENTITY MESSAGE_BEGIN_IDENTITY_CHECKSUM { // // Include the minor opcode and size in the // identity, plus the operator, the x and y // of the source and mask and the width and // height of the destination. // md5_append(md5_state, buffer + 1, 4); md5_append(md5_state, buffer + 20, 8); md5_append(md5_state, buffer + 32, 4); } MESSAGE_END_IDENTITY_CHECKSUM MESSAGE_BEGIN_ENCODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Source " << renderExtension -> data.composite.src_id << " mask " << renderExtension -> data.composite.msk_id << " destination " << renderExtension -> data.composite.msk_id << ".\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(renderExtension -> data.composite.src_id, clientCache -> renderSrcPictureCache); cachedRenderExtension -> data.composite.src_id = renderExtension -> data.composite.src_id; encodeBuffer.encodeXidValue(renderExtension -> data.composite.msk_id, clientCache -> renderMaskPictureCache); cachedRenderExtension -> data.composite.msk_id = renderExtension -> data.composite.msk_id; encodeBuffer.encodeXidValue(renderExtension -> data.composite.dst_id, clientCache -> renderDstPictureCache); cachedRenderExtension -> data.composite.dst_id = renderExtension -> data.composite.dst_id; // // Dst X and Y. // unsigned int value; unsigned int previous; value = renderExtension -> data.composite.dst_x; previous = cachedRenderExtension -> data.composite.dst_x; encodeBuffer.encodeDiffCachedValue(value, previous, 16, clientCache -> renderXCache, 11); cachedRenderExtension -> data.composite.dst_x = value; value = renderExtension -> data.composite.dst_y; previous = cachedRenderExtension -> data.composite.dst_y; encodeBuffer.encodeDiffCachedValue(value, previous, 16, clientCache -> renderYCache, 11); cachedRenderExtension -> data.composite.dst_y = value; #ifdef TEST *logofs << name() << ": Encoded update. Type is " << (unsigned int) renderExtension -> data.composite.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_UPDATE MESSAGE_BEGIN_DECODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeXidValue(renderExtension -> data.composite.src_id, clientCache -> renderSrcPictureCache); decodeBuffer.decodeXidValue(renderExtension -> data.composite.msk_id, clientCache -> renderMaskPictureCache); decodeBuffer.decodeXidValue(renderExtension -> data.composite.dst_id, clientCache -> renderDstPictureCache); // // Dst X and Y. // unsigned int value; unsigned int previous; previous = renderExtension -> data.composite.dst_x; decodeBuffer.decodeDiffCachedValue(value, previous, 16, clientCache -> renderXCache, 11); renderExtension -> data.composite.dst_x = value; previous = renderExtension -> data.composite.dst_y; decodeBuffer.decodeDiffCachedValue(value, previous, 16, clientCache -> renderYCache, 11); renderExtension -> data.composite.dst_y = value; #ifdef TEST *logofs << name() << ": Decoded update. Type is " << (unsigned int) renderExtension -> data.composite.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_UPDATE nx-libs-3.5.99.23/nxcomp/src/RenderCompositeGlyphs.cpp0000644000000000000000000004752413614532331017413 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif // // Include the template for // this message class. // #include "RenderCompositeGlyphs.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #include MESSAGE_TAGS // // Message handling methods. // MESSAGE_BEGIN_ENCODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding value " << ((size - MESSAGE_OFFSET) >> 2) << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, clientCache -> renderLengthCache, 5); #ifdef TEST *logofs << name() << ": Encoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_SIZE MESSAGE_BEGIN_DECODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeCachedValue(size, 16, clientCache -> renderLengthCache, 5); #ifdef DEBUG *logofs << name() << ": Decoded value " << size << ".\n" << logofs_flush; #endif size = MESSAGE_OFFSET + (size << 2); buffer = writeBuffer -> addMessage(size); #ifdef TEST *logofs << name() << ": Decoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_SIZE MESSAGE_BEGIN_ENCODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue(*(buffer + 4), 8, clientCache -> renderOpCache); encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), clientCache -> renderSrcPictureCache); encodeBuffer.encodeXidValue(GetULONG(buffer + 12, bigEndian), clientCache -> renderDstPictureCache); encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 32, clientCache -> renderFormatCache); encodeBuffer.encodeCachedValue(GetULONG(buffer + 20, bigEndian), 29, clientCache -> renderGlyphSetCache); unsigned int src_x = GetUINT(buffer + 24, bigEndian); unsigned int src_y = GetUINT(buffer + 26, bigEndian); // Since ProtoStep8 (#issue 108) encodeBuffer.encodeDiffCachedValue(src_x, clientCache -> renderGlyphX, 16, clientCache -> renderGlyphXCache, 11); encodeBuffer.encodeDiffCachedValue(src_y, clientCache -> renderGlyphY, 16, clientCache -> renderGlyphYCache, 11); #ifdef TEST *logofs << name() << ": Encoded source X " << GetUINT(buffer + 24, bigEndian) << " source Y " << GetUINT(buffer + 26, bigEndian) << ".\n" << logofs_flush; #endif // // Bytes from 28 to 36 contain in the order: // // 1 byte for the length of the first string. // 3 bytes of padding. // 2 bytes for the X offset. // 2 bytes for the Y offset. // // Encode these bytes differentially to match // all the strings that have equal glyphs. // // Only manage the first string of glyphs. The // others strings should match, if they contain // the same glyphs, since the offset are rela- // tive to the first offset coordinates. // // Since ProtoStep8 (#issue 108) if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) { unsigned int numGlyphs = *(buffer + 28); encodeBuffer.encodeCachedValue(numGlyphs, 8, clientCache -> renderNumGlyphsCache); unsigned int offset_x = GetUINT(buffer + 32, bigEndian); unsigned int offset_y = GetUINT(buffer + 34, bigEndian); if (offset_x == src_x && offset_y == src_y) { encodeBuffer.encodeBoolValue(0); #ifdef TEST *logofs << name() << ": Matched offset X " << GetUINT(buffer + 32, bigEndian) << " offset Y " << GetUINT(buffer + 34, bigEndian) << ".\n" << logofs_flush; #endif } else { encodeBuffer.encodeBoolValue(1); encodeBuffer.encodeDiffCachedValue(offset_x, clientCache -> renderGlyphX, 16, clientCache -> renderGlyphXCache, 11); encodeBuffer.encodeDiffCachedValue(offset_y, clientCache -> renderGlyphY, 16, clientCache -> renderGlyphYCache, 11); #ifdef TEST *logofs << name() << ": Missed offset X " << GetUINT(buffer + 32, bigEndian) << " offset Y " << GetUINT(buffer + 34, bigEndian) << ".\n" << logofs_flush; #endif } } #ifdef TEST *logofs << name() << ": Encoded message. Type is " << (unsigned int) *(buffer + 1) << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_MESSAGE MESSAGE_BEGIN_DECODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; *(buffer + 1) = type; decodeBuffer.decodeCachedValue(*(buffer + 4), 8, clientCache -> renderOpCache); decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); PutULONG(value, buffer + 8, bigEndian); decodeBuffer.decodeXidValue(value, clientCache -> renderDstPictureCache); PutULONG(value, buffer + 12, bigEndian); decodeBuffer.decodeCachedValue(value, 32, clientCache -> renderFormatCache); PutULONG(value, buffer + 16, bigEndian); decodeBuffer.decodeCachedValue(value, 29, clientCache -> renderGlyphSetCache); PutULONG(value, buffer + 20, bigEndian); unsigned int src_x; unsigned int src_y; // Since ProtoStep8 (#issue 108) decodeBuffer.decodeDiffCachedValue(src_x, clientCache -> renderGlyphX, 16, clientCache -> renderGlyphXCache, 11); decodeBuffer.decodeDiffCachedValue(src_y, clientCache -> renderGlyphY, 16, clientCache -> renderGlyphYCache, 11); PutUINT(src_x, buffer + 24, bigEndian); PutUINT(src_y, buffer + 26, bigEndian); // Since ProtoStep8 (#issue 108) if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) { decodeBuffer.decodeCachedValue(value, 8, clientCache -> renderNumGlyphsCache); *(buffer + 28) = value; decodeBuffer.decodeBoolValue(value); if (value == 0) { PutUINT(src_x, buffer + 32, bigEndian); PutUINT(src_y, buffer + 34, bigEndian); } else { decodeBuffer.decodeDiffCachedValue(src_x, clientCache -> renderGlyphX, 16, clientCache -> renderGlyphXCache, 11); PutUINT(src_x, buffer + 32, bigEndian); decodeBuffer.decodeDiffCachedValue(src_y, clientCache -> renderGlyphY, 16, clientCache -> renderGlyphYCache, 11); PutUINT(src_y, buffer + 34, bigEndian); } } #ifdef TEST *logofs << name() << ": Decoded message. Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_MESSAGE MESSAGE_BEGIN_ENCODE_DATA { // Since ProtoStep8 (#issue 108) if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) { encodeCharData(encodeBuffer, buffer, MESSAGE_OFFSET_IF_PROTO_STEP_8, size, bigEndian, channelCache); } else if (size > MESSAGE_OFFSET) { encodeCharData(encodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); } #ifdef TEST *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET << " bytes of text data.\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_DATA MESSAGE_BEGIN_DECODE_DATA { // Since ProtoStep8 (#issue 108) if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) { decodeCharData(decodeBuffer, buffer, MESSAGE_OFFSET_IF_PROTO_STEP_8, size, bigEndian, channelCache); } else if (size > MESSAGE_OFFSET) { decodeCharData(decodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); } #ifdef TEST *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_DECODE_DATA MESSAGE_BEGIN_PARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; renderExtension -> data.composite_glyphs.type = *(buffer + 1); renderExtension -> data.composite_glyphs.op = *(buffer + 4); renderExtension -> data.composite_glyphs.src_id = GetULONG(buffer + 8, bigEndian); renderExtension -> data.composite_glyphs.dst_id = GetULONG(buffer + 12, bigEndian); renderExtension -> data.composite_glyphs.format = GetULONG(buffer + 16, bigEndian); renderExtension -> data.composite_glyphs.set_id = GetULONG(buffer + 20, bigEndian); renderExtension -> data.composite_glyphs.src_x = GetUINT(buffer + 24, bigEndian); renderExtension -> data.composite_glyphs.src_y = GetUINT(buffer + 26, bigEndian); // Since ProtoStep8 (#issue 108) if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) { renderExtension -> data.composite_glyphs.num_elm = *(buffer + 28); renderExtension -> data.composite_glyphs.offset_x = GetUINT(buffer + 32, bigEndian); renderExtension -> data.composite_glyphs.offset_y = GetUINT(buffer + 34, bigEndian); } #ifdef TEST *logofs << name() << ": Parsed identity. Type is " << (unsigned int) renderExtension -> data.composite_glyphs.type << " size is " << renderExtension -> size_ << " identity size " << renderExtension -> i_size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_PARSE_IDENTITY MESSAGE_BEGIN_UNPARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; *(buffer + 1) = renderExtension -> data.composite_glyphs.type; *(buffer + 4) = renderExtension -> data.composite_glyphs.op; PutULONG(renderExtension -> data.composite_glyphs.src_id, buffer + 8, bigEndian); PutULONG(renderExtension -> data.composite_glyphs.dst_id, buffer + 12, bigEndian); PutULONG(renderExtension -> data.composite_glyphs.format, buffer + 16, bigEndian); PutULONG(renderExtension -> data.composite_glyphs.set_id, buffer + 20, bigEndian); PutUINT(renderExtension -> data.composite_glyphs.src_x, buffer + 24, bigEndian); PutUINT(renderExtension -> data.composite_glyphs.src_y, buffer + 26, bigEndian); // Since ProtoStep8 (#issue 108) if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) { *(buffer + 28) = renderExtension -> data.composite_glyphs.num_elm; PutUINT(renderExtension -> data.composite_glyphs.offset_x, buffer + 32, bigEndian); PutUINT(renderExtension -> data.composite_glyphs.offset_y, buffer + 34, bigEndian); } #ifdef TEST *logofs << name() << ": Unparsed identity. Type is " << (unsigned int) renderExtension -> data.composite_glyphs.type << " size is " << renderExtension -> size_ << " identity size " << renderExtension -> i_size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_UNPARSE_IDENTITY MESSAGE_BEGIN_IDENTITY_CHECKSUM { // // Include minor opcode, size and // the composite operator in the // identity. // md5_append(md5_state, buffer + 1, 4); // // Include the format. // md5_append(md5_state, buffer + 16, 4); // // Also include the length of the // first string. // // Since ProtoStep8 (#issue 108) if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) { md5_append(md5_state, buffer + 28, 1); } } MESSAGE_END_IDENTITY_CHECKSUM MESSAGE_BEGIN_ENCODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeXidValue(renderExtension -> data.composite_glyphs.src_id, clientCache -> renderSrcPictureCache); cachedRenderExtension -> data.composite_glyphs.src_id = renderExtension -> data.composite_glyphs.src_id; encodeBuffer.encodeXidValue(renderExtension -> data.composite_glyphs.dst_id, clientCache -> renderDstPictureCache); cachedRenderExtension -> data.composite_glyphs.dst_id = renderExtension -> data.composite_glyphs.dst_id; encodeBuffer.encodeCachedValue(renderExtension -> data.composite_glyphs.set_id, 29, clientCache -> renderGlyphSetCache); cachedRenderExtension -> data.composite_glyphs.set_id = renderExtension -> data.composite_glyphs.set_id; // // Src X and Y. // // The source X and Y coordinates are // encoded as differerences in respect // to the cached message. // unsigned int value; unsigned int previous; // Since ProtoStep8 (#issue 108) value = renderExtension -> data.composite_glyphs.src_x; previous = cachedRenderExtension -> data.composite_glyphs.src_x; encodeBuffer.encodeDiffCachedValue(value, previous, 16, clientCache -> renderGlyphXCache, 11); cachedRenderExtension -> data.composite_glyphs.src_x = value; value = renderExtension -> data.composite_glyphs.src_y; previous = cachedRenderExtension -> data.composite_glyphs.src_y; encodeBuffer.encodeDiffCachedValue(value, previous, 16, clientCache -> renderGlyphYCache, 11); cachedRenderExtension -> data.composite_glyphs.src_y = value; #ifdef TEST *logofs << name() << ": Encoded source X " << renderExtension -> data.composite_glyphs.src_x << " source Y " << renderExtension -> data.composite_glyphs.src_y << ".\n" << logofs_flush; #endif // Since ProtoStep8 (#issue 108) if (renderExtension -> size_ >= MESSAGE_OFFSET_IF_PROTO_STEP_8) { // // Offset X and Y. // if (renderExtension -> data.composite_glyphs.offset_x == renderExtension -> data.composite_glyphs.src_x && renderExtension -> data.composite_glyphs.offset_y == renderExtension -> data.composite_glyphs.src_y) { encodeBuffer.encodeBoolValue(0); cachedRenderExtension -> data.composite_glyphs.offset_x = renderExtension -> data.composite_glyphs.offset_x; cachedRenderExtension -> data.composite_glyphs.offset_y = renderExtension -> data.composite_glyphs.offset_y; #ifdef TEST *logofs << name() << ": Matched offset X " << renderExtension -> data.composite_glyphs.offset_x << " offset Y " << renderExtension -> data.composite_glyphs.offset_y << ".\n" << logofs_flush; #endif } else { encodeBuffer.encodeBoolValue(1); value = renderExtension -> data.composite_glyphs.offset_x; previous = cachedRenderExtension -> data.composite_glyphs.offset_x; encodeBuffer.encodeDiffCachedValue(value, previous, 16, clientCache -> renderGlyphXCache, 11); cachedRenderExtension -> data.composite_glyphs.offset_x = value; value = renderExtension -> data.composite_glyphs.offset_y; previous = cachedRenderExtension -> data.composite_glyphs.offset_y; encodeBuffer.encodeDiffCachedValue(value, previous, 16, clientCache -> renderGlyphYCache, 11); cachedRenderExtension -> data.composite_glyphs.offset_y = value; #ifdef TEST *logofs << name() << ": Missed offset X " << renderExtension -> data.composite_glyphs.offset_x << " offset Y " << renderExtension -> data.composite_glyphs.offset_y << ".\n" << logofs_flush; #endif } } #ifdef TEST *logofs << name() << ": Encoded update. Type is " << (unsigned int) renderExtension -> data.composite_glyphs.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_UPDATE MESSAGE_BEGIN_DECODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeXidValue(renderExtension -> data.composite_glyphs.src_id, clientCache -> renderSrcPictureCache); decodeBuffer.decodeXidValue(renderExtension -> data.composite_glyphs.dst_id, clientCache -> renderDstPictureCache); decodeBuffer.decodeCachedValue(renderExtension -> data.composite_glyphs.set_id, 29, clientCache -> renderGlyphSetCache); // // Src X and Y. // unsigned int value; unsigned int previous; // Since ProtoStep8 (#issue 108) previous = renderExtension -> data.composite_glyphs.src_x; decodeBuffer.decodeDiffCachedValue(value, previous, 16, clientCache -> renderGlyphXCache, 11); renderExtension -> data.composite_glyphs.src_x = value; previous = renderExtension -> data.composite_glyphs.src_y; decodeBuffer.decodeDiffCachedValue(value, previous, 16, clientCache -> renderGlyphYCache, 11); renderExtension -> data.composite_glyphs.src_y = value; // Since ProtoStep8 (#issue 108) if (renderExtension -> size_ >= MESSAGE_OFFSET_IF_PROTO_STEP_8) { // // Offset X and Y. // decodeBuffer.decodeBoolValue(value); if (value == 0) { renderExtension -> data.composite_glyphs.offset_x = renderExtension -> data.composite_glyphs.src_x; renderExtension -> data.composite_glyphs.offset_y = renderExtension -> data.composite_glyphs.src_y; } else { previous = renderExtension -> data.composite_glyphs.offset_x; decodeBuffer.decodeDiffCachedValue(value, previous, 16, clientCache -> renderGlyphXCache, 11); renderExtension -> data.composite_glyphs.offset_x = value; previous = renderExtension -> data.composite_glyphs.offset_y; decodeBuffer.decodeDiffCachedValue(value, previous, 16, clientCache -> renderGlyphYCache, 11); renderExtension -> data.composite_glyphs.offset_y = value; } } #ifdef TEST *logofs << name() << ": Decoded update. Type is " << (unsigned int) renderExtension -> data.composite_glyphs.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_UPDATE nx-libs-3.5.99.23/nxcomp/src/RenderCompositeGlyphs.h0000644000000000000000000000650413614532331017051 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderCompositeGlyphs_H #define RenderCompositeGlyphs_H // // Define the characteristics // of this message class here. // #undef MESSAGE_NAME #define MESSAGE_NAME "RenderCompositeGlyphs" #undef MESSAGE_STORE #define MESSAGE_STORE RenderCompositeGlyphsStore #undef MESSAGE_CLASS #define MESSAGE_CLASS RenderMinorExtensionStore #undef MESSAGE_METHODS #define MESSAGE_METHODS "RenderMinorExtensionMethods.h" #undef MESSAGE_HEADERS #define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" #undef MESSAGE_TAGS #define MESSAGE_TAGS "RenderMinorExtensionTags.h" #undef MESSAGE_OFFSET #define MESSAGE_OFFSET 28 #undef MESSAGE_HAS_SIZE #define MESSAGE_HAS_SIZE 1 #undef MESSAGE_HAS_DATA #define MESSAGE_HAS_DATA 1 #undef MESSAGE_HAS_FILTER #define MESSAGE_HAS_FILTER 0 // // Encode the first 8 bytes of the // data differentially in newer // protocol versions. // #undef MESSAGE_OFFSET_IF_PROTO_STEP_8 #define MESSAGE_OFFSET_IF_PROTO_STEP_8 36 // // Declare the message class. // #include MESSAGE_HEADERS class MESSAGE_STORE : public MESSAGE_CLASS { public: virtual const char *name() const { return MESSAGE_NAME; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { // Since ProtoStep8 (#issue 108) unsigned int offset = MESSAGE_OFFSET_IF_PROTO_STEP_8; return (size >= offset ? offset : size); } #include MESSAGE_METHODS }; #endif /* RenderCompositeGlyphs_H */ nx-libs-3.5.99.23/nxcomp/src/RenderComposite.h0000644000000000000000000000600113614532331015652 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderComposite_H #define RenderComposite_H // // Define the characteristics // of this message class here. // #undef MESSAGE_NAME #define MESSAGE_NAME "RenderComposite" #undef MESSAGE_STORE #define MESSAGE_STORE RenderCompositeStore #undef MESSAGE_CLASS #define MESSAGE_CLASS RenderMinorExtensionStore #undef MESSAGE_METHODS #define MESSAGE_METHODS "RenderMinorExtensionMethods.h" #undef MESSAGE_HEADERS #define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" #undef MESSAGE_TAGS #define MESSAGE_TAGS "RenderMinorExtensionTags.h" #undef MESSAGE_OFFSET #define MESSAGE_OFFSET 36 #undef MESSAGE_HAS_SIZE #define MESSAGE_HAS_SIZE 0 #undef MESSAGE_HAS_DATA #define MESSAGE_HAS_DATA 0 #undef MESSAGE_HAS_FILTER #define MESSAGE_HAS_FILTER 0 // // Declare the message class. // #include MESSAGE_HEADERS class MESSAGE_STORE : public MESSAGE_CLASS { public: virtual const char *name() const { return MESSAGE_NAME; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { return MESSAGE_OFFSET; } #include MESSAGE_METHODS }; #endif /* RenderComposite_H */ nx-libs-3.5.99.23/nxcomp/src/RenderCreateGlyphSet.cpp0000644000000000000000000001466413614532331017144 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif // // Include the template for // this message class. // #include "RenderCreateGlyphSet.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #include MESSAGE_TAGS // // Message handling methods. // MESSAGE_BEGIN_ENCODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeNewXidValue(GetULONG(buffer + 4, bigEndian), clientCache -> lastId, clientCache -> lastIdCache, clientCache -> renderGlyphSetCache, clientCache -> renderFreeGlyphSetCache); encodeBuffer.encodeCachedValue(GetULONG(buffer + 8, bigEndian), 32, clientCache -> renderFormatCache); #ifdef TEST *logofs << name() << ": Encoded message. Type is " << (unsigned int) *(buffer + 1) << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_MESSAGE MESSAGE_BEGIN_DECODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; *(buffer + 1) = type; decodeBuffer.decodeNewXidValue(value, clientCache -> lastId, clientCache -> lastIdCache, clientCache -> renderGlyphSetCache, clientCache -> renderFreeGlyphSetCache); PutULONG(value, buffer + 4, bigEndian); decodeBuffer.decodeCachedValue(value, 32, clientCache -> renderFormatCache); PutULONG(value, buffer + 8, bigEndian); #ifdef TEST *logofs << name() << ": Decoded message. Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_MESSAGE MESSAGE_BEGIN_PARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; renderExtension -> data.create_set.type = *(buffer + 1); renderExtension -> data.create_set.set_id = GetULONG(buffer + 4, bigEndian); renderExtension -> data.create_set.format = GetULONG(buffer + 8, bigEndian); #ifdef TEST *logofs << name() << ": Parsed identity. Type is " << (unsigned int) renderExtension -> data.create_set.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_PARSE_IDENTITY MESSAGE_BEGIN_UNPARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; *(buffer + 1) = renderExtension -> data.create_set.type; PutULONG(renderExtension -> data.create_set.set_id, buffer + 4, bigEndian); PutULONG(renderExtension -> data.create_set.format, buffer + 8, bigEndian); #ifdef TEST *logofs << name() << ": Unparsed identity. Type is " << (unsigned int) renderExtension -> data.create_set.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_UNPARSE_IDENTITY MESSAGE_BEGIN_IDENTITY_CHECKSUM { md5_append(md5_state, buffer + 1, 3); md5_append(md5_state, buffer + 8, 4); } MESSAGE_END_IDENTITY_CHECKSUM MESSAGE_BEGIN_ENCODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeNewXidValue(renderExtension -> data.create_set.set_id, clientCache -> lastId, clientCache -> lastIdCache, clientCache -> renderGlyphSetCache, clientCache -> renderFreeGlyphSetCache); cachedRenderExtension -> data.create_set.set_id = renderExtension -> data.create_set.set_id; #ifdef TEST *logofs << name() << ": Encoded update. Type is " << (unsigned int) renderExtension -> data.create_set.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_UPDATE MESSAGE_BEGIN_DECODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeNewXidValue(renderExtension -> data.create_set.set_id, clientCache -> lastId, clientCache -> lastIdCache, clientCache -> renderGlyphSetCache, clientCache -> renderFreeGlyphSetCache); #ifdef TEST *logofs << name() << ": Decoded update. Type is " << (unsigned int) renderExtension -> data.create_set.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_UPDATE nx-libs-3.5.99.23/nxcomp/src/RenderCreateGlyphSet.h0000644000000000000000000000603213614532331016577 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderCreateGlyphSet_H #define RenderCreateGlyphSet_H // // Define the characteristics // of this message class here. // #undef MESSAGE_NAME #define MESSAGE_NAME "RenderCreateGlyphSet" #undef MESSAGE_STORE #define MESSAGE_STORE RenderCreateGlyphSetStore #undef MESSAGE_CLASS #define MESSAGE_CLASS RenderMinorExtensionStore #undef MESSAGE_METHODS #define MESSAGE_METHODS "RenderMinorExtensionMethods.h" #undef MESSAGE_HEADERS #define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" #undef MESSAGE_TAGS #define MESSAGE_TAGS "RenderMinorExtensionTags.h" #undef MESSAGE_OFFSET #define MESSAGE_OFFSET 12 #undef MESSAGE_HAS_SIZE #define MESSAGE_HAS_SIZE 0 #undef MESSAGE_HAS_DATA #define MESSAGE_HAS_DATA 0 #undef MESSAGE_HAS_FILTER #define MESSAGE_HAS_FILTER 0 // // Declare the message class. // #include MESSAGE_HEADERS class MESSAGE_STORE : public MESSAGE_CLASS { public: virtual const char *name() const { return MESSAGE_NAME; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { return MESSAGE_OFFSET; } #include MESSAGE_METHODS }; #endif /* RenderCreateGlyphSet_H */ nx-libs-3.5.99.23/nxcomp/src/RenderCreatePicture.cpp0000644000000000000000000002231313614532331017006 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif // // Include the template for // this message class. // #include "RenderCreatePicture.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #include MESSAGE_TAGS // // Message handling methods. // MESSAGE_BEGIN_ENCODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, clientCache -> renderLengthCache, 5); #ifdef TEST *logofs << name() << ": Encoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_SIZE MESSAGE_BEGIN_DECODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeCachedValue(size, 16, clientCache -> renderLengthCache, 5); size = MESSAGE_OFFSET + (size << 2); buffer = writeBuffer -> addMessage(size); #ifdef TEST *logofs << name() << ": Decoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_SIZE MESSAGE_BEGIN_ENCODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeNewXidValue(GetULONG(buffer + 4, bigEndian), clientCache -> lastId, clientCache -> lastIdCache, clientCache -> renderSrcPictureCache, clientCache -> renderFreePictureCache); encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), clientCache -> drawableCache); encodeBuffer.encodeCachedValue(GetULONG(buffer + 12, bigEndian), 32, clientCache -> renderFormatCache); encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 32, clientCache -> renderValueMaskCache); #ifdef TEST *logofs << name() << ": Encoded message. Type is " << (unsigned int) *(buffer + 1) << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_MESSAGE MESSAGE_BEGIN_DECODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; *(buffer + 1) = type; decodeBuffer.decodeNewXidValue(value, clientCache -> lastId, clientCache -> lastIdCache, clientCache -> renderSrcPictureCache, clientCache -> renderFreePictureCache); PutULONG(value, buffer + 4, bigEndian); decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); PutULONG(value, buffer + 8, bigEndian); decodeBuffer.decodeCachedValue(value, 32, clientCache -> renderFormatCache); PutULONG(value, buffer + 12, bigEndian); decodeBuffer.decodeCachedValue(value, 32, clientCache -> renderValueMaskCache); PutULONG(value, buffer + 16, bigEndian); #ifdef TEST *logofs << name() << ": Decoded message. Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_MESSAGE MESSAGE_BEGIN_ENCODE_DATA { encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); #ifdef TEST *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_DATA MESSAGE_BEGIN_DECODE_DATA { decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); #ifdef TEST *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_DECODE_DATA MESSAGE_BEGIN_PARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; renderExtension -> data.create_picture.type = *(buffer + 1); renderExtension -> data.create_picture.src_id = GetULONG(buffer + 4, bigEndian); renderExtension -> data.create_picture.dst_id = GetULONG(buffer + 8, bigEndian); renderExtension -> data.create_picture.format = GetULONG(buffer + 12, bigEndian); renderExtension -> data.create_picture.mask = GetULONG(buffer + 16, bigEndian); #ifdef TEST *logofs << name() << ": Parsed identity. Type is " << (unsigned int) renderExtension -> data.create_picture.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_PARSE_IDENTITY MESSAGE_BEGIN_UNPARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; *(buffer + 1) = renderExtension -> data.create_picture.type; PutULONG(renderExtension -> data.create_picture.src_id, buffer + 4, bigEndian); PutULONG(renderExtension -> data.create_picture.dst_id, buffer + 8, bigEndian); PutULONG(renderExtension -> data.create_picture.format, buffer + 12, bigEndian); PutULONG(renderExtension -> data.create_picture.mask, buffer + 16, bigEndian); #ifdef TEST *logofs << name() << ": Unparsed identity. Type is " << (unsigned int) renderExtension -> data.create_picture.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_UNPARSE_IDENTITY MESSAGE_BEGIN_IDENTITY_CHECKSUM { md5_append(md5_state, buffer + 1, 3); md5_append(md5_state, buffer + 12, 8); } MESSAGE_END_IDENTITY_CHECKSUM MESSAGE_BEGIN_ENCODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding new id value " << renderExtension -> data.create_picture.src_id << ".\n"; #endif encodeBuffer.encodeNewXidValue(renderExtension -> data.create_picture.src_id, clientCache -> lastId, clientCache -> lastIdCache, clientCache -> renderSrcPictureCache, clientCache -> renderFreePictureCache); cachedRenderExtension -> data.create_picture.src_id = renderExtension -> data.create_picture.src_id; encodeBuffer.encodeXidValue(renderExtension -> data.create_picture.dst_id, clientCache -> drawableCache); cachedRenderExtension -> data.create_picture.dst_id = renderExtension -> data.create_picture.dst_id; #ifdef TEST *logofs << name() << ": Encoded update. Type is " << (unsigned int) renderExtension -> data.create_picture.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_UPDATE MESSAGE_BEGIN_DECODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeNewXidValue(renderExtension -> data.create_picture.src_id, clientCache -> lastId, clientCache -> lastIdCache, clientCache -> renderSrcPictureCache, clientCache -> renderFreePictureCache); decodeBuffer.decodeXidValue(renderExtension -> data.create_picture.dst_id, clientCache -> drawableCache); #ifdef TEST *logofs << name() << ": Decoded update. Type is " << (unsigned int) renderExtension -> data.create_picture.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_UPDATE nx-libs-3.5.99.23/nxcomp/src/RenderCreatePicture.h0000644000000000000000000000602513614532331016455 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderCreatePicture_H #define RenderCreatePicture_H // // Define the characteristics // of this message class here. // #undef MESSAGE_NAME #define MESSAGE_NAME "RenderCreatePicture" #undef MESSAGE_STORE #define MESSAGE_STORE RenderCreatePictureStore #undef MESSAGE_CLASS #define MESSAGE_CLASS RenderMinorExtensionStore #undef MESSAGE_METHODS #define MESSAGE_METHODS "RenderMinorExtensionMethods.h" #undef MESSAGE_HEADERS #define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" #undef MESSAGE_TAGS #define MESSAGE_TAGS "RenderMinorExtensionTags.h" #undef MESSAGE_OFFSET #define MESSAGE_OFFSET 20 #undef MESSAGE_HAS_SIZE #define MESSAGE_HAS_SIZE 1 #undef MESSAGE_HAS_DATA #define MESSAGE_HAS_DATA 1 #undef MESSAGE_HAS_FILTER #define MESSAGE_HAS_FILTER 0 // // Declare the message class. // #include MESSAGE_HEADERS class MESSAGE_STORE : public MESSAGE_CLASS { public: virtual const char *name() const { return MESSAGE_NAME; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { return MESSAGE_OFFSET; } #include MESSAGE_METHODS }; #endif /* RenderCreatePicture_H */ nx-libs-3.5.99.23/nxcomp/src/RenderExtension.cpp0000644000000000000000000003676713614532331016245 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "NXrender.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "WriteBuffer.h" #include "RenderExtension.h" #include "RenderGenericRequest.h" #include "RenderCreatePicture.h" #include "RenderChangePicture.h" #include "RenderFreePicture.h" #include "RenderPictureClip.h" #include "RenderPictureTransform.h" #include "RenderPictureFilter.h" #include "RenderCreateGlyphSet.h" #include "RenderFreeGlyphSet.h" #include "RenderAddGlyphs.h" #include "RenderComposite.h" #include "RenderCompositeGlyphs.h" #include "RenderFillRectangles.h" #include "RenderTrapezoids.h" #include "RenderTriangles.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Constructor and destructor. // RenderExtensionStore::RenderExtensionStore(StaticCompressor *compressor) : MessageStore(compressor) { enableCache = RENDEREXTENSION_ENABLE_CACHE; enableData = RENDEREXTENSION_ENABLE_DATA; enableSplit = RENDEREXTENSION_ENABLE_SPLIT; enableCompress = RENDEREXTENSION_ENABLE_COMPRESS; generic_ = new RenderGenericRequestStore(); for (int i = 0; i < RENDEREXTENSION_MINOR_OPCODE_LIMIT; i++) { minors_[i] = generic_; } minors_[X_RenderChangePicture] = new RenderChangePictureStore(); minors_[X_RenderFillRectangles] = new RenderFillRectanglesStore(); minors_[X_RenderAddGlyphs] = new RenderAddGlyphsStore(); // Since ProtoStep7 (#issue 108) minors_[X_RenderCreatePicture] = new RenderCreatePictureStore(); minors_[X_RenderFreePicture] = new RenderFreePictureStore(); minors_[X_RenderSetPictureClipRectangles] = new RenderPictureClipStore(); minors_[X_RenderCreateGlyphSet] = new RenderCreateGlyphSetStore(); minors_[X_RenderComposite] = new RenderCompositeStore(); minors_[X_RenderCompositeGlyphs8] = new RenderCompositeGlyphsStore(); minors_[X_RenderCompositeGlyphs16] = new RenderCompositeGlyphsStore(); minors_[X_RenderCompositeGlyphs32] = new RenderCompositeGlyphsStore(); minors_[X_RenderSetPictureTransform] = new RenderPictureTransformStore(); minors_[X_RenderSetPictureFilter] = new RenderPictureFilterStore(); minors_[X_RenderFreeGlyphSet] = new RenderFreeGlyphSetStore(); minors_[X_RenderTrapezoids] = new RenderTrapezoidsStore(); minors_[X_RenderTriangles] = new RenderTrianglesStore(); dataLimit = RENDEREXTENSION_DATA_LIMIT; dataOffset = RENDEREXTENSION_DATA_OFFSET; // Since ProtoStep7 (#issue 108) cacheSlots = RENDEREXTENSION_CACHE_SLOTS_IF_PROTO_STEP_7; cacheThreshold = RENDEREXTENSION_CACHE_THRESHOLD; cacheLowerThreshold = RENDEREXTENSION_CACHE_LOWER_THRESHOLD; opcode_ = X_NXInternalRenderExtension; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } RenderExtensionStore::~RenderExtensionStore() { for (int i = 0; i < RENDEREXTENSION_MINOR_OPCODE_LIMIT; i++) { if (minors_[i] != generic_) { delete minors_[i]; } } delete generic_; for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } int RenderExtensionStore::validateMessage(const unsigned char *buffer, int size) { #ifdef TEST *logofs << name() << ": Encoding message OPCODE#" << (unsigned) *buffer << " MINOR#" << (unsigned) *(buffer + 1) << " with size " << size << ".\n" << logofs_flush; #endif return (size >= control -> MinimumMessageSize && size <= control -> MaximumMessageSize); } // // Here are the methods to handle the messages' content. // int RenderExtensionStore::identitySize(const unsigned char *buffer, unsigned int size) { return minors_[*(buffer + 1)] -> identitySize(buffer, size); } int RenderExtensionStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const { encodeBuffer.encodeOpcodeValue(*(buffer + 1), ((ClientCache *) channelCache) -> renderOpcodeCache); minors_[*(buffer + 1)] -> encodeMessage(encodeBuffer, buffer, size, bigEndian, channelCache); return 1; } int RenderExtensionStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const { unsigned char type; decodeBuffer.decodeOpcodeValue(type, ((ClientCache *) channelCache) -> renderOpcodeCache); minors_[type] -> decodeMessage(decodeBuffer, buffer, size, type, bigEndian, writeBuffer, channelCache); return 1; } int RenderExtensionStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { return minors_[*(buffer + 1)] -> parseIdentity(message, buffer, size, bigEndian); } int RenderExtensionStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { return minors_[((RenderExtensionMessage *) message) -> data.any.type] -> unparseIdentity(message, buffer, size, bigEndian); } void RenderExtensionStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { minors_[*(buffer + 1)] -> identityChecksum(message, buffer, size, md5_state_, bigEndian); } void RenderExtensionStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { minors_[((RenderExtensionMessage *) message) -> data.any.type] -> updateIdentity(encodeBuffer, message, cachedMessage, channelCache); } void RenderExtensionStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { minors_[((RenderExtensionMessage *) message) -> data.any.type] -> updateIdentity(decodeBuffer, message, channelCache); } void RenderExtensionStore::dumpIdentity(const Message *message) const { #ifdef DUMP #ifdef WARNING *logofs << name() << ": WARNING! Dump of identity not implemented.\n" << logofs_flush; #endif #endif } // // TODO: The following encoding and decoding functions // could be generalized further, for example by passing // the pointer to the data cache, the number of caches // made available by the caller and the first cache to // iterate through. // void RenderMinorExtensionStore::encodeLongData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian, ChannelCache *channelCache) const { // Since ProtoStep7 (#issue 108) encodeBuffer.encodeLongData(buffer + offset, size - offset); #ifdef TEST *logofs << name() << ": Encoded " << size - offset << " bytes of long data.\n" << logofs_flush; #endif } void RenderMinorExtensionStore::encodeIntData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian, ChannelCache *channelCache) const { // Since ProtoStep7 (#issue 108) encodeBuffer.encodeIntData(buffer + offset, size - offset); #ifdef TEST *logofs << name() << ": Encoded " << size - offset << " bytes of int data.\n" << logofs_flush; #endif } void RenderMinorExtensionStore::encodeCharData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian, ChannelCache *channelCache) const { // Since ProtoStep7 (#issue 108) encodeBuffer.encodeTextData(buffer + offset, size - offset); #ifdef TEST *logofs << name() << ": Encoded " << size - offset << " bytes of text data.\n" << logofs_flush; #endif } void RenderMinorExtensionStore::decodeLongData(DecodeBuffer &decodeBuffer, unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian, ChannelCache *channelCache) const { // Since ProtoStep7 (#issue 108) decodeBuffer.decodeLongData(buffer + offset, size - offset); #ifdef TEST *logofs << name() << ": Decoded " << size - offset << " bytes of long data.\n" << logofs_flush; #endif } void RenderMinorExtensionStore::decodeIntData(DecodeBuffer &decodeBuffer, unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian, ChannelCache *channelCache) const { // Since ProtoStep7 (#issue 108) decodeBuffer.decodeIntData(buffer + offset, size - offset); #ifdef TEST *logofs << name() << ": Decoded " << size - offset << " bytes of int data.\n" << logofs_flush; #endif } void RenderMinorExtensionStore::decodeCharData(DecodeBuffer &decodeBuffer, unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian, ChannelCache *channelCache) const { // Since ProtoStep7 (#issue 108) decodeBuffer.decodeTextData(buffer + offset, size - offset); #ifdef TEST *logofs << name() << ": Decoded " << size - offset << " bytes of text data.\n" << logofs_flush; #endif } void RenderMinorExtensionStore::parseIntData(const Message *message, const unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian) const { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; unsigned int last = ((unsigned) message -> i_size_ > size ? size : message -> i_size_); for (unsigned int i = offset, c = (offset - 4) % 16; i < last; i += 2) { #ifdef DEBUG *logofs << name() << ": Parsing int with i = " << i << " c = " << c << ".\n" << logofs_flush; #endif renderExtension -> data.any.short_data[c] = GetUINT(buffer + i, bigEndian); if (++c == 16) c = 0; } } void RenderMinorExtensionStore::unparseIntData(const Message *message, unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian) const { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; unsigned int last = ((unsigned) message -> i_size_ > size ? size : message -> i_size_); for (unsigned int i = offset, c = (offset - 4) % 16; i < last; i += 2) { #ifdef DEBUG *logofs << name() << ": Unparsing int with i = " << i << " c = " << c << ".\n" << logofs_flush; #endif PutUINT(renderExtension -> data.any.short_data[c], buffer + i, bigEndian); if (++c == 16) c = 0; } } void RenderMinorExtensionStore::updateIntData(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, unsigned int offset, unsigned int size, ChannelCache *channelCache) const { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int last = ((unsigned) message -> i_size_ > size ? size : message -> i_size_); for (unsigned int i = offset, c = (offset - 4) % 16; i < last; i += 2) { #ifdef DEBUG *logofs << name() << ": Encoding int update with i = " << i << " c = " << c << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(renderExtension -> data.any.short_data[c], 16, *clientCache -> renderDataCache[c]); cachedRenderExtension -> data.any.short_data[c] = renderExtension -> data.any.short_data[c]; if (++c == 16) c = 0; } } void RenderMinorExtensionStore::updateIntData(DecodeBuffer &decodeBuffer, const Message *message, unsigned int offset, unsigned int size, ChannelCache *channelCache) const { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int last = ((unsigned) message -> i_size_ > size ? size : message -> i_size_); unsigned int value; for (unsigned int i = offset, c = (offset - 4) % 16; i < last; i += 2) { #ifdef DEBUG *logofs << name() << ": Decoding int update with i = " << i << " c = " << c << ".\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(value, 16, *clientCache -> renderDataCache[c]); renderExtension -> data.any.short_data[c] = value; if (++c == 16) c = 0; } } nx-libs-3.5.99.23/nxcomp/src/RenderExtension.h0000644000000000000000000003247213614532331015677 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderExtension_H #define RenderExtension_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Compression of data part is not enabled as // most messages of this type are smaller than // the current data size compression threshold. // #define RENDEREXTENSION_ENABLE_CACHE 1 #define RENDEREXTENSION_ENABLE_DATA 0 #define RENDEREXTENSION_ENABLE_SPLIT 0 #define RENDEREXTENSION_ENABLE_COMPRESS 0 #define RENDEREXTENSION_DATA_LIMIT 6144 #define RENDEREXTENSION_DATA_OFFSET 36 #define RENDEREXTENSION_CACHE_THRESHOLD 20 #define RENDEREXTENSION_CACHE_LOWER_THRESHOLD 10 #define RENDEREXTENSION_CACHE_SLOTS_IF_PROTO_STEP_7 8000 // // Used to build the table of minor opcodes. // #define RENDEREXTENSION_MINOR_OPCODE_LIMIT 256 // // The message class. // class RenderMinorExtensionStore; class RenderExtensionMessage : public Message { friend class RenderExtensionStore; friend class RenderMinorExtensionStore; friend class RenderGenericRequestStore; friend class RenderCreatePictureStore; friend class RenderChangePictureStore; friend class RenderFreePictureStore; friend class RenderPictureClipStore; friend class RenderPictureTransformStore; friend class RenderPictureFilterStore; friend class RenderCreateGlyphSetStore; friend class RenderFreeGlyphSetStore; friend class RenderAddGlyphsStore; friend class RenderCompositeStore; friend class RenderCompositeGlyphsStore; friend class RenderFillRectanglesStore; friend class RenderTrapezoidsStore; friend class RenderTrianglesStore; public: RenderExtensionMessage() { } ~RenderExtensionMessage() { } // // We consider for this message a data offset of 36, // that is size of the biggest among all requests of // this extension. The most common requests have a // specific differential encoding, others are simply // encoded through an array of int or char caches. // private: union { struct { unsigned char type; unsigned char char_data[32]; unsigned short short_data[16]; unsigned short long_data[8]; } any; struct { unsigned char type; unsigned int src_id; unsigned int dst_id; unsigned int format; unsigned int mask; } create_picture; struct { unsigned char type; unsigned int src_id; } change_picture; struct { unsigned char type; unsigned int src_id; } free_picture; struct { unsigned char type; unsigned int src_id; unsigned short src_x; unsigned short src_y; } picture_clip; struct { unsigned char type; unsigned int src_id; } picture_transform; struct { unsigned char type; unsigned int src_id; unsigned int num_elm; } picture_filter; struct { unsigned char type; unsigned int set_id; unsigned int format; } create_set; struct { unsigned char type; unsigned int set_id; } free_set; struct { unsigned char type; unsigned int set_id; unsigned int num_elm; } add_glyphs; struct { unsigned char type; unsigned char op; unsigned int src_id; unsigned int msk_id; unsigned int dst_id; unsigned short src_x; unsigned short src_y; unsigned short msk_x; unsigned short msk_y; unsigned short dst_x; unsigned short dst_y; unsigned short width; unsigned short height; } composite; struct { unsigned char type; unsigned char op; unsigned char num_elm; unsigned int src_id; unsigned int dst_id; unsigned int format; unsigned int set_id; unsigned short src_x; unsigned short src_y; unsigned short offset_x; unsigned short offset_y; } composite_glyphs; struct { unsigned char type; unsigned char op; unsigned int dst_id; } fill_rectangles; struct { unsigned char type; unsigned char op; unsigned int src_id; unsigned int dst_id; unsigned int format; unsigned short src_x; unsigned short src_y; } trapezoids; struct { unsigned char type; unsigned char op; unsigned int src_id; unsigned int dst_id; unsigned int format; unsigned short src_x; unsigned short src_y; } triangles; struct { unsigned char type; unsigned char op; unsigned char num_elm; unsigned int src_id; unsigned int dst_id; unsigned int format; unsigned int set_id; unsigned short src_x; unsigned short src_y; unsigned short delta_x; unsigned short delta_y; } composite_glyphs_compat; } data; }; class RenderExtensionStore : public MessageStore { public: RenderExtensionStore(StaticCompressor *compressor); virtual ~RenderExtensionStore(); virtual const char *name() const { return "RenderExtension"; } virtual unsigned char opcode() const { return opcode_; } virtual unsigned int storage() const { return sizeof(RenderExtensionMessage); } // // Message handling methods. // public: virtual Message *create() const { return new RenderExtensionMessage(); } virtual Message *create(const Message &message) const { return new RenderExtensionMessage((const RenderExtensionMessage &) message); } virtual void destroy(Message *message) const { delete (RenderExtensionMessage *) message; } // // Determine if the message must be stored // in the cache. // virtual int validateMessage(const unsigned char *buffer, int size); // // Since protocol step 5 these methods are // specialized in their minor opcode stores. // virtual int identitySize(const unsigned char *buffer, unsigned int size); virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const; virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; private: unsigned char opcode_; // // Keep pointers to specialized classes. // RenderMinorExtensionStore *minors_[RENDEREXTENSION_MINOR_OPCODE_LIMIT]; RenderMinorExtensionStore *generic_; }; class RenderMinorExtensionStore : public MinorMessageStore { public: virtual const char *name() const = 0; virtual int identitySize(const unsigned char *buffer, unsigned int size) = 0; virtual int encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const = 0; virtual int decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, unsigned char type, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const = 0; virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const = 0; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const = 0; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const = 0; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const = 0; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, md5_state_t *md5_state, int bigEndian) const = 0; // // Internal encode and decode utilities. // protected: void encodeLongData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian, ChannelCache *channelCache) const; void encodeIntData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian, ChannelCache *channelCache) const; void encodeCharData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian, ChannelCache *channelCache) const; void decodeLongData(DecodeBuffer &decodeBuffer, unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian, ChannelCache *channelCache) const; void decodeIntData(DecodeBuffer &decodeBuffer, unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian, ChannelCache *channelCache) const; void decodeCharData(DecodeBuffer &decodeBuffer, unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian, ChannelCache *channelCache) const; /* * The following methods are only used in the * encoding of the generic render request. To * be removed in future. */ void parseIntData(const Message *message, const unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian) const; void unparseIntData(const Message *message, unsigned char *buffer, unsigned int offset, unsigned int size, int bigEndian) const; void updateIntData(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, unsigned int offset, unsigned int size, ChannelCache *channelCache) const; void updateIntData(DecodeBuffer &decodeBuffer, const Message *message, unsigned int offset, unsigned int size, ChannelCache *channelCache) const; }; #endif /* RenderExtension_H */ nx-libs-3.5.99.23/nxcomp/src/RenderFillRectangles.cpp0000644000000000000000000001660413614532331017153 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif // // Include the template for // this message class. // #include "RenderFillRectangles.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #include MESSAGE_TAGS // // Message handling methods. // MESSAGE_BEGIN_ENCODE_SIZE { // // The color structure (4 components, 2 bytes // each) is included in the data part, so that // it gets into the checksum. The rectangles // are in the format x, y, width, height with // 2 bytes per each field, so each request is // at least 12 + 8 + 8 = 28 bytes long. // ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, clientCache -> renderLengthCache, 5); #ifdef TEST *logofs << name() << ": Encoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_SIZE MESSAGE_BEGIN_DECODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeCachedValue(size, 16, clientCache -> renderLengthCache, 5); size = MESSAGE_OFFSET + (size << 2); buffer = writeBuffer -> addMessage(size); #ifdef TEST *logofs << name() << ": Decoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_SIZE MESSAGE_BEGIN_ENCODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue(*(buffer + 4), 8, clientCache -> renderOpCache); encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), clientCache -> renderSrcPictureCache); #ifdef TEST *logofs << name() << ": Encoded message. Type is " << (unsigned int) *(buffer + 1) << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_MESSAGE MESSAGE_BEGIN_DECODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; *(buffer + 1) = type; decodeBuffer.decodeCachedValue(*(buffer + 4), 8, clientCache -> renderOpCache); decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); PutULONG(value, buffer + 8, bigEndian); #ifdef TEST *logofs << name() << ": Decoded message. Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_MESSAGE MESSAGE_BEGIN_ENCODE_DATA { encodeIntData(encodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); #ifdef TEST *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_DATA MESSAGE_BEGIN_DECODE_DATA { decodeIntData(decodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); #ifdef TEST *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_DECODE_DATA MESSAGE_BEGIN_PARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; renderExtension -> data.fill_rectangles.type = *(buffer + 1); renderExtension -> data.fill_rectangles.op = *(buffer + 4); renderExtension -> data.fill_rectangles.dst_id = GetULONG(buffer + 8, bigEndian); #ifdef TEST *logofs << name() << ": Parsed identity. Type is " << (unsigned int) renderExtension -> data.fill_rectangles.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_PARSE_IDENTITY MESSAGE_BEGIN_UNPARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; *(buffer + 1) = renderExtension -> data.fill_rectangles.type; *(buffer + 4) = renderExtension -> data.fill_rectangles.op; PutULONG(renderExtension -> data.fill_rectangles.dst_id, buffer + 8, bigEndian); #ifdef TEST *logofs << name() << ": Unparsed identity. Type is " << (unsigned int) renderExtension -> data.fill_rectangles.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_UNPARSE_IDENTITY MESSAGE_BEGIN_IDENTITY_CHECKSUM { md5_append(md5_state, buffer + 1, 4); } MESSAGE_END_IDENTITY_CHECKSUM MESSAGE_BEGIN_ENCODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeXidValue(renderExtension -> data.fill_rectangles.dst_id, clientCache -> renderSrcPictureCache); cachedRenderExtension -> data.fill_rectangles.dst_id = renderExtension -> data.fill_rectangles.dst_id; #ifdef TEST *logofs << name() << ": Encoded update. Type is " << (unsigned int) renderExtension -> data.fill_rectangles.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_UPDATE MESSAGE_BEGIN_DECODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeXidValue(renderExtension -> data.fill_rectangles.dst_id, clientCache -> renderSrcPictureCache); #ifdef TEST *logofs << name() << ": Decoded update. Type is " << (unsigned int) renderExtension -> data.fill_rectangles.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_UPDATE nx-libs-3.5.99.23/nxcomp/src/RenderFillRectangles.h0000644000000000000000000000603213614532331016612 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderFillRectangles_H #define RenderFillRectangles_H // // Define the characteristics // of this message class here. // #undef MESSAGE_NAME #define MESSAGE_NAME "RenderFillRectangles" #undef MESSAGE_STORE #define MESSAGE_STORE RenderFillRectanglesStore #undef MESSAGE_CLASS #define MESSAGE_CLASS RenderMinorExtensionStore #undef MESSAGE_METHODS #define MESSAGE_METHODS "RenderMinorExtensionMethods.h" #undef MESSAGE_HEADERS #define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" #undef MESSAGE_TAGS #define MESSAGE_TAGS "RenderMinorExtensionTags.h" #undef MESSAGE_OFFSET #define MESSAGE_OFFSET 12 #undef MESSAGE_HAS_SIZE #define MESSAGE_HAS_SIZE 1 #undef MESSAGE_HAS_DATA #define MESSAGE_HAS_DATA 1 #undef MESSAGE_HAS_FILTER #define MESSAGE_HAS_FILTER 0 // // Declare the message class. // #include MESSAGE_HEADERS class MESSAGE_STORE : public MESSAGE_CLASS { public: virtual const char *name() const { return MESSAGE_NAME; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { return MESSAGE_OFFSET; } #include MESSAGE_METHODS }; #endif /* RenderFillRectangles_H */ nx-libs-3.5.99.23/nxcomp/src/RenderFreeGlyphSet.cpp0000644000000000000000000001262213614532331016612 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif // // Include the template for // this message class. // #include "RenderFreeGlyphSet.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #include MESSAGE_TAGS // // Message handling methods. // MESSAGE_BEGIN_ENCODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeFreeXidValue(GetULONG(buffer + 4, bigEndian), clientCache -> renderFreeGlyphSetCache); #ifdef TEST *logofs << name() << ": Encoded message. Type is " << (unsigned int) *(buffer + 1) << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_MESSAGE MESSAGE_BEGIN_DECODE_MESSAGE { unsigned int value; ClientCache *clientCache = (ClientCache *) channelCache; *(buffer + 1) = type; decodeBuffer.decodeFreeXidValue(value, clientCache -> renderFreeGlyphSetCache); PutULONG(value, buffer + 4, bigEndian); #ifdef TEST *logofs << name() << ": Decoded message. Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_MESSAGE MESSAGE_BEGIN_PARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; renderExtension -> data.free_set.type = *(buffer + 1); renderExtension -> data.free_set.set_id = GetULONG(buffer + 4, bigEndian); #ifdef TEST *logofs << name() << ": Parsed identity. Type is " << (unsigned int) renderExtension -> data.free_set.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_PARSE_IDENTITY MESSAGE_BEGIN_UNPARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; *(buffer + 1) = renderExtension -> data.free_set.type; PutULONG(renderExtension -> data.free_set.set_id, buffer + 4, bigEndian); #ifdef TEST *logofs << name() << ": Unparsed identity. Type is " << (unsigned int) renderExtension -> data.free_set.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_UNPARSE_IDENTITY MESSAGE_BEGIN_IDENTITY_CHECKSUM { md5_append(md5_state, buffer + 1, 3); } MESSAGE_END_IDENTITY_CHECKSUM MESSAGE_BEGIN_ENCODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeFreeXidValue(renderExtension -> data.free_set.set_id, clientCache -> renderFreeGlyphSetCache); cachedRenderExtension -> data.free_set.set_id = renderExtension -> data.free_set.set_id; #ifdef TEST *logofs << name() << ": Encoded update. Type is " << (unsigned int) renderExtension -> data.free_set.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_UPDATE MESSAGE_BEGIN_DECODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeFreeXidValue(renderExtension -> data.free_set.set_id, clientCache -> renderFreeGlyphSetCache); #ifdef TEST *logofs << name() << ": Decoded update. Type is " << (unsigned int) renderExtension -> data.free_set.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_UPDATE nx-libs-3.5.99.23/nxcomp/src/RenderFreeGlyphSet.h0000644000000000000000000000601713614532331016260 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderFreeGlyphSet_H #define RenderFreeGlyphSet_H // // Define the characteristics // of this message class here. // #undef MESSAGE_NAME #define MESSAGE_NAME "RenderFreeGlyphSet" #undef MESSAGE_STORE #define MESSAGE_STORE RenderFreeGlyphSetStore #undef MESSAGE_CLASS #define MESSAGE_CLASS RenderMinorExtensionStore #undef MESSAGE_METHODS #define MESSAGE_METHODS "RenderMinorExtensionMethods.h" #undef MESSAGE_HEADERS #define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" #undef MESSAGE_TAGS #define MESSAGE_TAGS "RenderMinorExtensionTags.h" #undef MESSAGE_OFFSET #define MESSAGE_OFFSET 8 #undef MESSAGE_HAS_SIZE #define MESSAGE_HAS_SIZE 0 #undef MESSAGE_HAS_DATA #define MESSAGE_HAS_DATA 0 #undef MESSAGE_HAS_FILTER #define MESSAGE_HAS_FILTER 0 // // Declare the message class. // #include MESSAGE_HEADERS class MESSAGE_STORE : public MESSAGE_CLASS { public: virtual const char *name() const { return MESSAGE_NAME; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { return MESSAGE_OFFSET; } #include MESSAGE_METHODS }; #endif /* RenderFreeGlyphSet_H */ nx-libs-3.5.99.23/nxcomp/src/RenderFreePicture.cpp0000644000000000000000000001267513614532331016476 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif // // Include the template for // this message class. // #include "RenderFreePicture.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #include MESSAGE_TAGS // // Message handling methods. // MESSAGE_BEGIN_ENCODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeFreeXidValue(GetULONG(buffer + 4, bigEndian), clientCache -> renderFreePictureCache); #ifdef TEST *logofs << name() << ": Encoded message. Type is " << (unsigned int) *(buffer + 1) << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_MESSAGE MESSAGE_BEGIN_DECODE_MESSAGE { unsigned int value; ClientCache *clientCache = (ClientCache *) channelCache; *(buffer + 1) = type; decodeBuffer.decodeFreeXidValue(value, clientCache -> renderFreePictureCache); PutULONG(value, buffer + 4, bigEndian); #ifdef TEST *logofs << name() << ": Decoded message. Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_MESSAGE MESSAGE_BEGIN_PARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; renderExtension -> data.free_picture.type = *(buffer + 1); renderExtension -> data.free_picture.src_id = GetULONG(buffer + 4, bigEndian); #ifdef TEST *logofs << name() << ": Parsed identity. Type is " << (unsigned int) renderExtension -> data.free_picture.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_PARSE_IDENTITY MESSAGE_BEGIN_UNPARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; *(buffer + 1) = renderExtension -> data.free_picture.type; PutULONG(renderExtension -> data.free_picture.src_id, buffer + 4, bigEndian); #ifdef TEST *logofs << name() << ": Unparsed identity. Type is " << (unsigned int) renderExtension -> data.free_picture.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_UNPARSE_IDENTITY MESSAGE_BEGIN_IDENTITY_CHECKSUM { md5_append(md5_state, buffer + 1, 3); } MESSAGE_END_IDENTITY_CHECKSUM MESSAGE_BEGIN_ENCODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeFreeXidValue(renderExtension -> data.free_picture.src_id, clientCache -> renderFreePictureCache); cachedRenderExtension -> data.free_picture.src_id = renderExtension -> data.free_picture.src_id; #ifdef TEST *logofs << name() << ": Encoded update. Type is " << (unsigned int) renderExtension -> data.free_picture.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_UPDATE MESSAGE_BEGIN_DECODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeFreeXidValue(renderExtension -> data.free_picture.src_id, clientCache -> renderFreePictureCache); #ifdef TEST *logofs << name() << ": Decoded update. Type is " << (unsigned int) renderExtension -> data.free_picture.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_UPDATE nx-libs-3.5.99.23/nxcomp/src/RenderFreePicture.h0000644000000000000000000000601213614532331016127 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderFreePicture_H #define RenderFreePicture_H // // Define the characteristics // of this message class here. // #undef MESSAGE_NAME #define MESSAGE_NAME "RenderFreePicture" #undef MESSAGE_STORE #define MESSAGE_STORE RenderFreePictureStore #undef MESSAGE_CLASS #define MESSAGE_CLASS RenderMinorExtensionStore #undef MESSAGE_METHODS #define MESSAGE_METHODS "RenderMinorExtensionMethods.h" #undef MESSAGE_HEADERS #define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" #undef MESSAGE_TAGS #define MESSAGE_TAGS "RenderMinorExtensionTags.h" #undef MESSAGE_OFFSET #define MESSAGE_OFFSET 8 #undef MESSAGE_HAS_SIZE #define MESSAGE_HAS_SIZE 0 #undef MESSAGE_HAS_DATA #define MESSAGE_HAS_DATA 0 #undef MESSAGE_HAS_FILTER #define MESSAGE_HAS_FILTER 0 // // Declare the message class. // #include MESSAGE_HEADERS class MESSAGE_STORE : public MESSAGE_CLASS { public: virtual const char *name() const { return MESSAGE_NAME; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { return MESSAGE_OFFSET; } #include MESSAGE_METHODS }; #endif /* RenderFreePicture_H */ nx-libs-3.5.99.23/nxcomp/src/RenderGenericRequest.cpp0000644000000000000000000002171013614532331017174 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "NXrender.h" #include "RenderExtension.h" #include "RenderGenericRequest.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "WriteBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Here are the methods to handle the messages' content. // int RenderGenericRequestStore::encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding full message.\n" << logofs_flush; unsigned char type = *(buffer + 1); #endif encodeBuffer.encodeCachedValue(size >> 2, 16, clientCache -> renderLengthCache, 5); #ifdef DEBUG *logofs << name() << ": Encoding full unhandled message. " << "Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif encodeIntData(encodeBuffer, buffer, 4, size, bigEndian, clientCache); #ifdef DEBUG *logofs << name() << ": Encoded full message.\n" << logofs_flush; #endif return 1; } int RenderGenericRequestStore::decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, unsigned char type, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Decoding full message.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(size, 16, clientCache -> renderLengthCache, 5); size <<= 2; buffer = writeBuffer -> addMessage(size); *(buffer + 1) = type; #ifdef DEBUG *logofs << name() << ": Decoding full unhandled message. " << "Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif decodeIntData(decodeBuffer, buffer, 4, size, bigEndian, clientCache); #ifdef DEBUG *logofs << name() << ": Decoded full message.\n" << logofs_flush; #endif return 1; } void RenderGenericRequestStore::encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, unsigned int size, int bigEndian, ChannelCache *channelCache) const { } void RenderGenericRequestStore::decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, unsigned int size, int bigEndian, ChannelCache *channelCache) const { } int RenderGenericRequestStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { #ifdef DEBUG *logofs << name() << ": Parsing identity for message at " << this << ".\n" << logofs_flush; #endif RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; unsigned char type = *(buffer + 1); renderExtension -> data.any.type = type; #ifdef DEBUG *logofs << name() << ": Parsing unhandled identity. " << "Type is " << (unsigned int) renderExtension -> data.any.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif parseIntData(message, buffer, 4, size, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int RenderGenericRequestStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { #ifdef DEBUG *logofs << name() << ": Unparsing identity for message at " << this << ".\n" << logofs_flush; #endif RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; unsigned char type = renderExtension -> data.any.type; *(buffer + 1) = type; #ifdef DEBUG *logofs << name() << ": Unparsing unhandled identity. " << "Type is " << (unsigned int) renderExtension -> data.any.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif unparseIntData(message, buffer, 4, size, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void RenderGenericRequestStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, md5_state_t *md5_state, int bigEndian) const { // // Include the minor opcode in the checksum. // Because the data offset can be beyond the // real end of the message, we need to include // the size or we will match any message whose // size is less or equal to the data offset. // md5_append(md5_state, buffer + 1, 3); } void RenderGenericRequestStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { // // Encode the variant part. // #ifdef DEBUG *logofs << name() << ": Updating identity for message at " << this << ".\n" << logofs_flush; #endif RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; #ifdef DEBUG *logofs << name() << ": Encoding unhandled update. " << "Type is " << (unsigned int) renderExtension -> data.any.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif updateIntData(encodeBuffer, message, cachedMessage, 4, renderExtension -> size_, channelCache); #ifdef DEBUG *logofs << name() << ": Updated identity for message at " << this << ".\n" << logofs_flush; #endif } void RenderGenericRequestStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { #ifdef DEBUG *logofs << name() << ": Updating identity for message at " << this << ".\n" << logofs_flush; #endif RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; #ifdef DEBUG *logofs << name() << ": Decoding unhandled update. " << "Type is " << (unsigned int) renderExtension -> data.any.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif updateIntData(decodeBuffer, message, 4, renderExtension -> size_, channelCache); #ifdef DEBUG *logofs << name() << ": Updated identity for message at " << this << ".\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/RenderGenericRequest.h0000644000000000000000000001013113614532331016634 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderGenericRequest_H #define RenderGenericRequest_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP class RenderGenericRequestStore : public RenderMinorExtensionStore { public: virtual const char *name() const { return "RenderGenericRequest"; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { return RENDEREXTENSION_DATA_OFFSET; } virtual int encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual int decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, unsigned char type, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const; virtual void encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual void decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, md5_state_t *md5_state, int bigEndian) const; }; #endif /* RenderGenericRequest_H */ nx-libs-3.5.99.23/nxcomp/src/RenderMinorExtensionHeaders.h0000644000000000000000000000414513614532331020174 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderMinorExtensionHeaders_H #define RenderMinorExtensionHeaders_H #include "NXrender.h" #include "Message.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "WriteBuffer.h" #include "RenderExtension.h" #endif /* RenderMinorExtensionHeaders_H */ nx-libs-3.5.99.23/nxcomp/src/RenderMinorExtensionMethods.h0000644000000000000000000001025213614532331020220 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ // // This file is included multiple times, // one for each message inheriting the // parent class. // public: #if MESSAGE_HAS_SIZE virtual void encodeSize(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual void decodeSize(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, unsigned char type, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const; #endif #if MESSAGE_HAS_DATA virtual void encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual void decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, unsigned int size, int bigEndian, ChannelCache *channelCache) const; #endif virtual int encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual int decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, unsigned char type, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const; virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, md5_state_t *md5_state, int bigEndian) const; nx-libs-3.5.99.23/nxcomp/src/RenderMinorExtensionTags.h0000644000000000000000000001424113614532331017515 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderMinorExtensionTags_H #define RenderMinorExtensionTags_H // // Set in the message header file. // #if MESSAGE_HAS_SIZE #define MESSAGE_ENCODE_SIZE encodeSize(encodeBuffer, buffer, size, bigEndian, channelCache) #define MESSAGE_DECODE_SIZE decodeSize(decodeBuffer, buffer, size, type, bigEndian, writeBuffer, channelCache) #else #define MESSAGE_ENCODE_SIZE #define MESSAGE_DECODE_SIZE size = MESSAGE_OFFSET; buffer = writeBuffer -> addMessage(size); #endif #if MESSAGE_HAS_DATA #define MESSAGE_ENCODE_DATA encodeData(encodeBuffer, buffer, size, bigEndian, channelCache) #define MESSAGE_DECODE_DATA decodeData(decodeBuffer, buffer, size, bigEndian, channelCache) #else #define MESSAGE_ENCODE_DATA #define MESSAGE_DECODE_DATA #endif // // Prologue an epilogue of the message // handling functions. // #define MESSAGE_BEGIN_ENCODE_SIZE \ \ void MESSAGE_STORE::encodeSize(EncodeBuffer &encodeBuffer, const unsigned char *buffer, \ const unsigned int size, int bigEndian, \ ChannelCache *channelCache) const \ { #define MESSAGE_END_ENCODE_SIZE \ \ } #define MESSAGE_BEGIN_DECODE_SIZE \ \ void MESSAGE_STORE::decodeSize(DecodeBuffer &decodeBuffer, unsigned char *&buffer, \ unsigned int &size, unsigned char type, int bigEndian, \ WriteBuffer *writeBuffer, ChannelCache *channelCache) const \ { #define MESSAGE_END_DECODE_SIZE \ \ } #define MESSAGE_BEGIN_ENCODE_MESSAGE \ \ int MESSAGE_STORE::encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, \ const unsigned int size, int bigEndian, \ ChannelCache *channelCache) const \ { \ MESSAGE_ENCODE_SIZE; #define MESSAGE_END_ENCODE_MESSAGE \ \ MESSAGE_ENCODE_DATA; \ \ return 1; \ } #define MESSAGE_BEGIN_DECODE_MESSAGE \ \ int MESSAGE_STORE::decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, \ unsigned int &size, unsigned char type, int bigEndian, \ WriteBuffer *writeBuffer, ChannelCache *channelCache) const \ { \ MESSAGE_DECODE_SIZE; #define MESSAGE_END_DECODE_MESSAGE \ \ MESSAGE_DECODE_DATA; \ \ return 1; \ } #define MESSAGE_BEGIN_ENCODE_DATA \ \ void MESSAGE_STORE::encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, \ unsigned int size, int bigEndian, \ ChannelCache *channelCache) const \ { #define MESSAGE_END_ENCODE_DATA \ \ } #define MESSAGE_BEGIN_DECODE_DATA \ \ void MESSAGE_STORE::decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, \ unsigned int size, int bigEndian, \ ChannelCache *channelCache) const \ { #define MESSAGE_END_DECODE_DATA \ \ } #define MESSAGE_BEGIN_PARSE_IDENTITY \ \ int MESSAGE_STORE::parseIdentity(Message *message, const unsigned char *buffer, \ unsigned int size, int bigEndian) const \ { #define MESSAGE_END_PARSE_IDENTITY \ \ return 1; \ \ } #define MESSAGE_BEGIN_UNPARSE_IDENTITY \ \ int MESSAGE_STORE::unparseIdentity(const Message *message, unsigned char *buffer, \ unsigned int size, int bigEndian) const \ { #define MESSAGE_END_UNPARSE_IDENTITY \ \ return 1; \ \ } #define MESSAGE_BEGIN_IDENTITY_CHECKSUM \ \ void MESSAGE_STORE::identityChecksum(const Message *message, const unsigned char *buffer, \ unsigned int size, md5_state_t *md5_state, \ int bigEndian) const \ { #define MESSAGE_END_IDENTITY_CHECKSUM \ \ } #define MESSAGE_BEGIN_ENCODE_UPDATE \ \ void MESSAGE_STORE::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, \ const Message *cachedMessage, \ ChannelCache *channelCache) const \ { #define MESSAGE_END_ENCODE_UPDATE \ \ } #define MESSAGE_BEGIN_DECODE_UPDATE \ \ void MESSAGE_STORE::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, \ ChannelCache *channelCache) const \ { #define MESSAGE_END_DECODE_UPDATE \ \ } #endif /* RenderMinorExtensionTags_H */ nx-libs-3.5.99.23/nxcomp/src/RenderPictureClip.cpp0000644000000000000000000002262313614532331016476 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif // // Include the template for // this message class. // #include "RenderPictureClip.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #include MESSAGE_TAGS // // Message handling methods. // MESSAGE_BEGIN_ENCODE_SIZE { // // The data is constituted by a number of // rectangles. Each rectangle is in the // format x, y, width, height with 2 bytes // per each field, so each request is at // least 12 + 8 = 20 bytes long. // ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, clientCache -> renderLengthCache, 5); #ifdef TEST *logofs << name() << ": Encoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_SIZE MESSAGE_BEGIN_DECODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeCachedValue(size, 16, clientCache -> renderLengthCache, 5); size = MESSAGE_OFFSET + (size << 2); buffer = writeBuffer -> addMessage(size); #ifdef TEST *logofs << name() << ": Decoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_SIZE MESSAGE_BEGIN_ENCODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), clientCache -> renderSrcPictureCache); encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 8, bigEndian), clientCache -> renderLastX, 16, clientCache -> renderXCache, 11); encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 10, bigEndian), clientCache -> renderLastY, 16, clientCache -> renderYCache, 11); #ifdef TEST *logofs << name() << ": Encoded message. Type is " << (unsigned int) *(buffer + 1) << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_MESSAGE MESSAGE_BEGIN_DECODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; *(buffer + 1) = type; decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); PutULONG(value, buffer + 4, bigEndian); decodeBuffer.decodeDiffCachedValue(value, clientCache -> renderLastX, 16, clientCache -> renderXCache, 11); PutUINT(clientCache -> renderLastX, buffer + 8, bigEndian); decodeBuffer.decodeDiffCachedValue(value, clientCache -> renderLastY, 16, clientCache -> renderYCache, 11); PutUINT(clientCache -> renderLastY, buffer + 10, bigEndian); #ifdef TEST *logofs << name() << ": Decoded message. Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_MESSAGE MESSAGE_BEGIN_ENCODE_DATA { encodeIntData(encodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); #ifdef TEST *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_DATA MESSAGE_BEGIN_DECODE_DATA { decodeIntData(decodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); #ifdef TEST *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_DECODE_DATA MESSAGE_BEGIN_PARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; renderExtension -> data.picture_clip.type = *(buffer + 1); renderExtension -> data.picture_clip.src_id = GetULONG(buffer + 4, bigEndian); renderExtension -> data.picture_clip.src_x = GetUINT(buffer + 8, bigEndian); renderExtension -> data.picture_clip.src_y = GetUINT(buffer + 10, bigEndian); #ifdef TEST *logofs << name() << ": Parsed identity. Type is " << (unsigned int) renderExtension -> data.picture_clip.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_PARSE_IDENTITY MESSAGE_BEGIN_UNPARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; *(buffer + 1) = renderExtension -> data.picture_clip.type; PutULONG(renderExtension -> data.picture_clip.src_id, buffer + 4, bigEndian); PutUINT(renderExtension -> data.picture_clip.src_x, buffer + 8, bigEndian); PutUINT(renderExtension -> data.picture_clip.src_y, buffer + 10, bigEndian); #ifdef TEST *logofs << name() << ": Unparsed identity. Type is " << (unsigned int) renderExtension -> data.picture_clip.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_UNPARSE_IDENTITY MESSAGE_BEGIN_IDENTITY_CHECKSUM { // // Encode the picture id and the // source x and y differentially. // md5_append(md5_state, buffer + 1, 3); } MESSAGE_END_IDENTITY_CHECKSUM MESSAGE_BEGIN_ENCODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeXidValue(renderExtension -> data.picture_clip.src_id, clientCache -> renderSrcPictureCache); cachedRenderExtension -> data.picture_clip.src_id = renderExtension -> data.picture_clip.src_id; // // The source x and y coordinates are // encoded as differerences in respect // to the previous cached value. // unsigned int value; unsigned int previous; value = renderExtension -> data.picture_clip.src_x; previous = cachedRenderExtension -> data.picture_clip.src_x; encodeBuffer.encodeDiffCachedValue(value, previous, 16, clientCache -> renderXCache, 11); cachedRenderExtension -> data.picture_clip.src_x = value; value = renderExtension -> data.picture_clip.src_y; previous = cachedRenderExtension -> data.picture_clip.src_y; encodeBuffer.encodeDiffCachedValue(value, previous, 16, clientCache -> renderYCache, 11); cachedRenderExtension -> data.picture_clip.src_y = value; #ifdef TEST *logofs << name() << ": Encoded update. Type is " << (unsigned int) renderExtension -> data.picture_clip.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_UPDATE MESSAGE_BEGIN_DECODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeXidValue(renderExtension -> data.picture_clip.src_id, clientCache -> renderSrcPictureCache); unsigned int value; unsigned int previous; previous = renderExtension -> data.picture_clip.src_x; decodeBuffer.decodeDiffCachedValue(value, previous, 16, clientCache -> renderXCache, 11); renderExtension -> data.picture_clip.src_x = value; previous = renderExtension -> data.picture_clip.src_y; decodeBuffer.decodeDiffCachedValue(value, previous, 16, clientCache -> renderYCache, 11); renderExtension -> data.picture_clip.src_y = value; #ifdef TEST *logofs << name() << ": Decoded update. Type is " << (unsigned int) renderExtension -> data.picture_clip.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_UPDATE nx-libs-3.5.99.23/nxcomp/src/RenderPictureClip.h0000644000000000000000000000601313614532331016136 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderPictureClip_H #define RenderPictureClip_H // // Define the characteristics // of this message class here. // #undef MESSAGE_NAME #define MESSAGE_NAME "RenderPictureClip" #undef MESSAGE_STORE #define MESSAGE_STORE RenderPictureClipStore #undef MESSAGE_CLASS #define MESSAGE_CLASS RenderMinorExtensionStore #undef MESSAGE_METHODS #define MESSAGE_METHODS "RenderMinorExtensionMethods.h" #undef MESSAGE_HEADERS #define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" #undef MESSAGE_TAGS #define MESSAGE_TAGS "RenderMinorExtensionTags.h" #undef MESSAGE_OFFSET #define MESSAGE_OFFSET 12 #undef MESSAGE_HAS_SIZE #define MESSAGE_HAS_SIZE 1 #undef MESSAGE_HAS_DATA #define MESSAGE_HAS_DATA 1 #undef MESSAGE_HAS_FILTER #define MESSAGE_HAS_FILTER 0 // // Declare the message class. // #include MESSAGE_HEADERS class MESSAGE_STORE : public MESSAGE_CLASS { public: virtual const char *name() const { return MESSAGE_NAME; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { return MESSAGE_OFFSET; } #include MESSAGE_METHODS }; #endif /* RenderPictureClip_H */ nx-libs-3.5.99.23/nxcomp/src/RenderPictureFilter.cpp0000644000000000000000000002075213614532331017035 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif // // Include the template for // this message class. // #include "RenderPictureFilter.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #include MESSAGE_TAGS // // Message handling methods. // MESSAGE_BEGIN_ENCODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding value " << ((size - MESSAGE_OFFSET) >> 2) << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, clientCache -> renderLengthCache, 5); #ifdef TEST *logofs << name() << ": Encoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_SIZE MESSAGE_BEGIN_DECODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeCachedValue(size, 16, clientCache -> renderLengthCache, 5); #ifdef DEBUG *logofs << name() << ": Decoded value " << size << ".\n" << logofs_flush; #endif size = MESSAGE_OFFSET + (size << 2); buffer = writeBuffer -> addMessage(size); #ifdef TEST *logofs << name() << ": Decoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_SIZE MESSAGE_BEGIN_ENCODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), clientCache -> renderSrcPictureCache); encodeBuffer.encodeCachedValue(GetUINT(buffer + 8, bigEndian), 16, clientCache -> renderLengthCache, 5); #ifdef TEST *logofs << name() << ": Encoded message. Type is " << (unsigned int) *(buffer + 1) << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_MESSAGE MESSAGE_BEGIN_DECODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; *(buffer + 1) = type; decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); PutULONG(value, buffer + 4, bigEndian); decodeBuffer.decodeCachedValue(value, 16, clientCache -> renderLengthCache, 5); PutUINT(value, buffer + 8, bigEndian); #ifdef TEST *logofs << name() << ": Decoded message. Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_MESSAGE MESSAGE_BEGIN_ENCODE_DATA { encodeCharData(encodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); #ifdef TEST *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_DATA MESSAGE_BEGIN_DECODE_DATA { decodeCharData(decodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); #ifdef TEST *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_DECODE_DATA MESSAGE_BEGIN_PARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; renderExtension -> data.picture_filter.type = *(buffer + 1); renderExtension -> data.picture_filter.src_id = GetULONG(buffer + 4, bigEndian); renderExtension -> data.picture_filter.num_elm = GetUINT(buffer + 8, bigEndian); // // Clean the padding bytes. This // should be the purpose of the // filter. // #ifdef TEST *logofs << name() << ": Cleaning " << RoundUp4(renderExtension -> data.picture_filter.num_elm) - renderExtension -> data.picture_filter.num_elm << " bytes " << "at offset " << MESSAGE_OFFSET + renderExtension -> data.picture_filter.num_elm << " with " << renderExtension -> data.picture_filter.num_elm << " elements and size " << renderExtension -> size_ << ".\n" << logofs_flush; #endif if (size >= MESSAGE_OFFSET + renderExtension -> data.picture_filter.num_elm) { unsigned char *next = (unsigned char *) buffer + MESSAGE_OFFSET + renderExtension -> data.picture_filter.num_elm; while (next < buffer + size) { *next++ = '\0'; } } #ifdef TEST *logofs << name() << ": Parsed identity. Type is " << (unsigned int) renderExtension -> data.picture_filter.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_PARSE_IDENTITY MESSAGE_BEGIN_UNPARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; *(buffer + 1) = renderExtension -> data.picture_filter.type; PutULONG(renderExtension -> data.picture_filter.src_id, buffer + 4, bigEndian); PutUINT(renderExtension -> data.picture_filter.num_elm, buffer + 8, bigEndian); #ifdef TEST *logofs << name() << ": Unparsed identity. Type is " << (unsigned int) renderExtension -> data.picture_filter.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_UNPARSE_IDENTITY MESSAGE_BEGIN_IDENTITY_CHECKSUM { // // Include the length of the filter name // in the checksum. // md5_append(md5_state, buffer + 1, 3); md5_append(md5_state, buffer + 8, 2); } MESSAGE_END_IDENTITY_CHECKSUM MESSAGE_BEGIN_ENCODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeXidValue(renderExtension -> data.picture_filter.src_id, clientCache -> renderSrcPictureCache); cachedRenderExtension -> data.picture_filter.src_id = renderExtension -> data.picture_filter.src_id; #ifdef TEST *logofs << name() << ": Encoded update. Type is " << (unsigned int) renderExtension -> data.picture_filter.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_UPDATE MESSAGE_BEGIN_DECODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeXidValue(renderExtension -> data.picture_filter.src_id, clientCache -> renderSrcPictureCache); #ifdef TEST *logofs << name() << ": Decoded update. Type is " << (unsigned int) renderExtension -> data.picture_filter.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_UPDATE nx-libs-3.5.99.23/nxcomp/src/RenderPictureFilter.h0000644000000000000000000000602513614532331016477 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderPictureFilter_H #define RenderPictureFilter_H // // Define the characteristics // of this message class here. // #undef MESSAGE_NAME #define MESSAGE_NAME "RenderPictureFilter" #undef MESSAGE_STORE #define MESSAGE_STORE RenderPictureFilterStore #undef MESSAGE_CLASS #define MESSAGE_CLASS RenderMinorExtensionStore #undef MESSAGE_METHODS #define MESSAGE_METHODS "RenderMinorExtensionMethods.h" #undef MESSAGE_HEADERS #define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" #undef MESSAGE_TAGS #define MESSAGE_TAGS "RenderMinorExtensionTags.h" #undef MESSAGE_OFFSET #define MESSAGE_OFFSET 12 #undef MESSAGE_HAS_SIZE #define MESSAGE_HAS_SIZE 1 #undef MESSAGE_HAS_DATA #define MESSAGE_HAS_DATA 1 #undef MESSAGE_HAS_FILTER #define MESSAGE_HAS_FILTER 0 // // Declare the message class. // #include MESSAGE_HEADERS class MESSAGE_STORE : public MESSAGE_CLASS { public: virtual const char *name() const { return MESSAGE_NAME; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { return MESSAGE_OFFSET; } #include MESSAGE_METHODS }; #endif /* RenderPictureFilter_H */ nx-libs-3.5.99.23/nxcomp/src/RenderPictureTransform.cpp0000644000000000000000000001500513614532331017556 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif // // Include the template for // this message class. // #include "RenderPictureTransform.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #include MESSAGE_TAGS // // Message handling methods. // MESSAGE_BEGIN_ENCODE_SIZE { // // Size is always 44. The identity size // is set to 8, so we encode the 36 bytes // of the transformation matrix as our // data. // } MESSAGE_END_ENCODE_SIZE MESSAGE_BEGIN_DECODE_SIZE { size = MESSAGE_OFFSET + 36; buffer = writeBuffer -> addMessage(size); #ifdef TEST *logofs << name() << ": Decoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_SIZE MESSAGE_BEGIN_ENCODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), clientCache -> renderSrcPictureCache); #ifdef TEST *logofs << name() << ": Encoded message. Type is " << (unsigned int) *(buffer + 1) << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_MESSAGE MESSAGE_BEGIN_DECODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; *(buffer + 1) = type; decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); PutULONG(value, buffer + 4, bigEndian); #ifdef TEST *logofs << name() << ": Decoded message. Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_MESSAGE MESSAGE_BEGIN_ENCODE_DATA { encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); #ifdef TEST *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_DATA MESSAGE_BEGIN_DECODE_DATA { decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); #ifdef TEST *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_DECODE_DATA MESSAGE_BEGIN_PARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; renderExtension -> data.picture_transform.type = *(buffer + 1); renderExtension -> data.picture_transform.src_id = GetULONG(buffer + 4, bigEndian); #ifdef TEST *logofs << name() << ": Parsed identity. Type is " << (unsigned int) renderExtension -> data.picture_transform.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_PARSE_IDENTITY MESSAGE_BEGIN_UNPARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; *(buffer + 1) = renderExtension -> data.picture_transform.type; PutULONG(renderExtension -> data.picture_transform.src_id, buffer + 4, bigEndian); #ifdef TEST *logofs << name() << ": Unparsed identity. Type is " << (unsigned int) renderExtension -> data.picture_transform.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_UNPARSE_IDENTITY MESSAGE_BEGIN_IDENTITY_CHECKSUM { md5_append(md5_state, buffer + 1, 3); } MESSAGE_END_IDENTITY_CHECKSUM MESSAGE_BEGIN_ENCODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeXidValue(renderExtension -> data.picture_transform.src_id, clientCache -> renderSrcPictureCache); cachedRenderExtension -> data.picture_transform.src_id = renderExtension -> data.picture_transform.src_id; #ifdef TEST *logofs << name() << ": Encoded update. Type is " << (unsigned int) renderExtension -> data.picture_transform.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_UPDATE MESSAGE_BEGIN_DECODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeXidValue(renderExtension -> data.picture_transform.src_id, clientCache -> renderSrcPictureCache); #ifdef TEST *logofs << name() << ": Decoded update. Type is " << (unsigned int) renderExtension -> data.picture_transform.type << " size is " << renderExtension -> size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_UPDATE nx-libs-3.5.99.23/nxcomp/src/RenderPictureTransform.h0000644000000000000000000000604313614532331017225 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderPictureTransform_H #define RenderPictureTransform_H // // Define the characteristics // of this message class here. // #undef MESSAGE_NAME #define MESSAGE_NAME "RenderPictureTransform" #undef MESSAGE_STORE #define MESSAGE_STORE RenderPictureTransformStore #undef MESSAGE_CLASS #define MESSAGE_CLASS RenderMinorExtensionStore #undef MESSAGE_METHODS #define MESSAGE_METHODS "RenderMinorExtensionMethods.h" #undef MESSAGE_HEADERS #define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" #undef MESSAGE_TAGS #define MESSAGE_TAGS "RenderMinorExtensionTags.h" #undef MESSAGE_OFFSET #define MESSAGE_OFFSET 8 #undef MESSAGE_HAS_SIZE #define MESSAGE_HAS_SIZE 1 #undef MESSAGE_HAS_DATA #define MESSAGE_HAS_DATA 1 #undef MESSAGE_HAS_FILTER #define MESSAGE_HAS_FILTER 0 // // Declare the message class. // #include MESSAGE_HEADERS class MESSAGE_STORE : public MESSAGE_CLASS { public: virtual const char *name() const { return MESSAGE_NAME; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { return MESSAGE_OFFSET; } #include MESSAGE_METHODS }; #endif /* RenderPictureTransform_H */ nx-libs-3.5.99.23/nxcomp/src/RenderTrapezoids.cpp0000644000000000000000000002747613614532331016412 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif // // Include the template for // this message class. // #include "RenderTrapezoids.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #include MESSAGE_TAGS // // Message handling methods. // MESSAGE_BEGIN_ENCODE_SIZE { // // The trapezoid data is made up of a structure // containing a top and bottom coordinate in 4 // bytes format, plus two lines, each represent- // ed as four points in 4 bytes format. Thus // each trapezoid is 4 * 2 + (4 * 4) * 2 = 40 // bytes. Bytes are all padded to an long int, // so we don't need to clean the message. // ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding value " << ((size - MESSAGE_OFFSET) >> 2) << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, clientCache -> renderLengthCache, 5); #ifdef TEST *logofs << name() << ": Encoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_SIZE MESSAGE_BEGIN_DECODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeCachedValue(size, 16, clientCache -> renderLengthCache, 5); #ifdef DEBUG *logofs << name() << ": Decoded value " << size << ".\n" << logofs_flush; #endif size = MESSAGE_OFFSET + (size << 2); buffer = writeBuffer -> addMessage(size); #ifdef TEST *logofs << name() << ": Decoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_SIZE MESSAGE_BEGIN_ENCODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue(*(buffer + 4), 8, clientCache -> renderOpCache); encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), clientCache -> renderSrcPictureCache); encodeBuffer.encodeXidValue(GetULONG(buffer + 12, bigEndian), clientCache -> renderDstPictureCache); encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 32, clientCache -> renderFormatCache); encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 20, bigEndian), clientCache -> renderLastX, 16, clientCache -> renderXCache, 11); encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 22, bigEndian), clientCache -> renderLastY, 16, clientCache -> renderYCache, 11); #ifdef TEST *logofs << name() << ": Encoded message. Type is " << (unsigned int) *(buffer + 1) << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_MESSAGE MESSAGE_BEGIN_DECODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; *(buffer + 1) = type; decodeBuffer.decodeCachedValue(*(buffer + 4), 8, clientCache -> renderOpCache); decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); PutULONG(value, buffer + 8, bigEndian); decodeBuffer.decodeXidValue(value, clientCache -> renderDstPictureCache); PutULONG(value, buffer + 12, bigEndian); decodeBuffer.decodeCachedValue(value, 32, clientCache -> renderFormatCache); PutULONG(value, buffer + 16, bigEndian); decodeBuffer.decodeDiffCachedValue(value, clientCache -> renderLastX, 16, clientCache -> renderXCache, 11); PutUINT(clientCache -> renderLastX, buffer + 20, bigEndian); decodeBuffer.decodeDiffCachedValue(value, clientCache -> renderLastY, 16, clientCache -> renderYCache, 11); PutUINT(clientCache -> renderLastY, buffer + 22, bigEndian); #ifdef TEST *logofs << name() << ": Decoded message. Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_MESSAGE MESSAGE_BEGIN_ENCODE_DATA { if (size > MESSAGE_OFFSET) { encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); } #ifdef TEST *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET << " bytes of text data.\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_DATA MESSAGE_BEGIN_DECODE_DATA { if (size > MESSAGE_OFFSET) { decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); } #ifdef TEST *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_DECODE_DATA MESSAGE_BEGIN_PARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; renderExtension -> data.trapezoids.type = *(buffer + 1); renderExtension -> data.trapezoids.op = *(buffer + 4); renderExtension -> data.trapezoids.src_id = GetULONG(buffer + 8, bigEndian); renderExtension -> data.trapezoids.dst_id = GetULONG(buffer + 12, bigEndian); renderExtension -> data.trapezoids.format = GetULONG(buffer + 16, bigEndian); renderExtension -> data.trapezoids.src_x = GetUINT(buffer + 20, bigEndian); renderExtension -> data.trapezoids.src_y = GetUINT(buffer + 22, bigEndian); #ifdef TEST *logofs << name() << ": Parsed identity. Type is " << (unsigned int) renderExtension -> data.trapezoids.type << " size is " << renderExtension -> size_ << " identity size " << renderExtension -> i_size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_PARSE_IDENTITY MESSAGE_BEGIN_UNPARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; *(buffer + 1) = renderExtension -> data.trapezoids.type; *(buffer + 4) = renderExtension -> data.trapezoids.op; PutULONG(renderExtension -> data.trapezoids.src_id, buffer + 8, bigEndian); PutULONG(renderExtension -> data.trapezoids.dst_id, buffer + 12, bigEndian); PutULONG(renderExtension -> data.trapezoids.format, buffer + 16, bigEndian); PutUINT(renderExtension -> data.trapezoids.src_x, buffer + 20, bigEndian); PutUINT(renderExtension -> data.trapezoids.src_y, buffer + 22, bigEndian); #ifdef TEST *logofs << name() << ": Unparsed identity. Type is " << (unsigned int) renderExtension -> data.trapezoids.type << " size is " << renderExtension -> size_ << " identity size " << renderExtension -> i_size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_UNPARSE_IDENTITY MESSAGE_BEGIN_IDENTITY_CHECKSUM { // // Include minor opcode, size and the // operator in the identity. // md5_append(md5_state, buffer + 1, 4); // // Also include the format but not the // x and y source. // md5_append(md5_state, buffer + 16, 4); } MESSAGE_END_IDENTITY_CHECKSUM MESSAGE_BEGIN_ENCODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeXidValue(renderExtension -> data.trapezoids.src_id, clientCache -> renderSrcPictureCache); cachedRenderExtension -> data.trapezoids.src_id = renderExtension -> data.trapezoids.src_id; encodeBuffer.encodeXidValue(renderExtension -> data.trapezoids.dst_id, clientCache -> renderDstPictureCache); cachedRenderExtension -> data.trapezoids.dst_id = renderExtension -> data.trapezoids.dst_id; // // The source x and y coordinates are // encoded as differerences in respect // to the previous cached value. // unsigned int value; unsigned int previous; value = renderExtension -> data.trapezoids.src_x; previous = cachedRenderExtension -> data.trapezoids.src_x; encodeBuffer.encodeDiffCachedValue(value, previous, 16, clientCache -> renderXCache, 11); cachedRenderExtension -> data.trapezoids.src_x = value; value = renderExtension -> data.trapezoids.src_y; previous = cachedRenderExtension -> data.trapezoids.src_y; encodeBuffer.encodeDiffCachedValue(value, previous, 16, clientCache -> renderYCache, 11); cachedRenderExtension -> data.trapezoids.src_y = value; #ifdef TEST *logofs << name() << ": Encoded update. Type is " << (unsigned int) renderExtension -> data.trapezoids.type << " size is " << renderExtension -> size_ << " source x " << renderExtension -> data.trapezoids.src_x << " y " << renderExtension -> data.trapezoids.src_y << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_UPDATE MESSAGE_BEGIN_DECODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeXidValue(renderExtension -> data.trapezoids.src_id, clientCache -> renderSrcPictureCache); decodeBuffer.decodeXidValue(renderExtension -> data.trapezoids.dst_id, clientCache -> renderDstPictureCache); unsigned int value; unsigned int previous; previous = renderExtension -> data.trapezoids.src_x; decodeBuffer.decodeDiffCachedValue(value, previous, 16, clientCache -> renderXCache, 11); renderExtension -> data.trapezoids.src_x = value; previous = renderExtension -> data.trapezoids.src_y; decodeBuffer.decodeDiffCachedValue(value, previous, 16, clientCache -> renderYCache, 11); renderExtension -> data.trapezoids.src_y = value; #ifdef TEST *logofs << name() << ": Decoded update. Type is " << (unsigned int) renderExtension -> data.trapezoids.type << " size is " << renderExtension -> size_ << " source x " << renderExtension -> data.trapezoids.src_x << " y " << renderExtension -> data.trapezoids.src_y << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_UPDATE nx-libs-3.5.99.23/nxcomp/src/RenderTrapezoids.h0000644000000000000000000000605013614532331016040 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderTrapezoids_H #define RenderTrapezoids_H // // Define the characteristics // of this message class here. // #undef MESSAGE_NAME #define MESSAGE_NAME "RenderTrapezoids" #undef MESSAGE_STORE #define MESSAGE_STORE RenderTrapezoidsStore #undef MESSAGE_CLASS #define MESSAGE_CLASS RenderMinorExtensionStore #undef MESSAGE_METHODS #define MESSAGE_METHODS "RenderMinorExtensionMethods.h" #undef MESSAGE_HEADERS #define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" #undef MESSAGE_TAGS #define MESSAGE_TAGS "RenderMinorExtensionTags.h" #undef MESSAGE_OFFSET #define MESSAGE_OFFSET 24 #undef MESSAGE_HAS_SIZE #define MESSAGE_HAS_SIZE 1 #undef MESSAGE_HAS_DATA #define MESSAGE_HAS_DATA 1 #undef MESSAGE_HAS_FILTER #define MESSAGE_HAS_FILTER 0 // // Declare the message class. // #include MESSAGE_HEADERS class MESSAGE_STORE : public MESSAGE_CLASS { public: virtual const char *name() const { return MESSAGE_NAME; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { return (size >= MESSAGE_OFFSET ? MESSAGE_OFFSET : size); } #include MESSAGE_METHODS }; #endif /* RenderTrapezoids_H */ nx-libs-3.5.99.23/nxcomp/src/RenderTriangles.cpp0000644000000000000000000002667013614532331016211 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif // // Include the template for // this message class. // #include "RenderTriangles.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #include MESSAGE_TAGS // // Message handling methods. // MESSAGE_BEGIN_ENCODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding value " << ((size - MESSAGE_OFFSET) >> 2) << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, clientCache -> renderLengthCache, 5); #ifdef TEST *logofs << name() << ": Encoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_SIZE MESSAGE_BEGIN_DECODE_SIZE { ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeCachedValue(size, 16, clientCache -> renderLengthCache, 5); #ifdef DEBUG *logofs << name() << ": Decoded value " << size << ".\n" << logofs_flush; #endif size = MESSAGE_OFFSET + (size << 2); buffer = writeBuffer -> addMessage(size); #ifdef TEST *logofs << name() << ": Decoded size with value " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_SIZE MESSAGE_BEGIN_ENCODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue(*(buffer + 4), 8, clientCache -> renderOpCache); encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), clientCache -> renderSrcPictureCache); encodeBuffer.encodeXidValue(GetULONG(buffer + 12, bigEndian), clientCache -> renderDstPictureCache); encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 32, clientCache -> renderFormatCache); encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 20, bigEndian), clientCache -> renderLastX, 16, clientCache -> renderXCache, 11); encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 22, bigEndian), clientCache -> renderLastY, 16, clientCache -> renderYCache, 11); #ifdef TEST *logofs << name() << ": Encoded message. Type is " << (unsigned int) *(buffer + 1) << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_MESSAGE MESSAGE_BEGIN_DECODE_MESSAGE { ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; *(buffer + 1) = type; decodeBuffer.decodeCachedValue(*(buffer + 4), 8, clientCache -> renderOpCache); decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); PutULONG(value, buffer + 8, bigEndian); decodeBuffer.decodeXidValue(value, clientCache -> renderDstPictureCache); PutULONG(value, buffer + 12, bigEndian); decodeBuffer.decodeCachedValue(value, 32, clientCache -> renderFormatCache); PutULONG(value, buffer + 16, bigEndian); decodeBuffer.decodeDiffCachedValue(value, clientCache -> renderLastX, 16, clientCache -> renderXCache, 11); PutUINT(clientCache -> renderLastX, buffer + 20, bigEndian); decodeBuffer.decodeDiffCachedValue(value, clientCache -> renderLastY, 16, clientCache -> renderYCache, 11); PutUINT(clientCache -> renderLastY, buffer + 22, bigEndian); #ifdef TEST *logofs << name() << ": Decoded message. Type is " << (unsigned int) type << " size is " << size << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_MESSAGE MESSAGE_BEGIN_ENCODE_DATA { if (size > MESSAGE_OFFSET) { encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); } #ifdef TEST *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET << " bytes of text data.\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_DATA MESSAGE_BEGIN_DECODE_DATA { if (size > MESSAGE_OFFSET) { decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, size, bigEndian, channelCache); } #ifdef TEST *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET << " bytes of data.\n" << logofs_flush; #endif } MESSAGE_END_DECODE_DATA MESSAGE_BEGIN_PARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; renderExtension -> data.triangles.type = *(buffer + 1); renderExtension -> data.triangles.op = *(buffer + 4); renderExtension -> data.triangles.src_id = GetULONG(buffer + 8, bigEndian); renderExtension -> data.triangles.dst_id = GetULONG(buffer + 12, bigEndian); renderExtension -> data.triangles.format = GetULONG(buffer + 16, bigEndian); renderExtension -> data.triangles.src_x = GetUINT(buffer + 20, bigEndian); renderExtension -> data.triangles.src_y = GetUINT(buffer + 22, bigEndian); #ifdef TEST *logofs << name() << ": Parsed identity. Type is " << (unsigned int) renderExtension -> data.triangles.type << " size is " << renderExtension -> size_ << " identity size " << renderExtension -> i_size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_PARSE_IDENTITY MESSAGE_BEGIN_UNPARSE_IDENTITY { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; *(buffer + 1) = renderExtension -> data.triangles.type; *(buffer + 4) = renderExtension -> data.triangles.op; PutULONG(renderExtension -> data.triangles.src_id, buffer + 8, bigEndian); PutULONG(renderExtension -> data.triangles.dst_id, buffer + 12, bigEndian); PutULONG(renderExtension -> data.triangles.format, buffer + 16, bigEndian); PutUINT(renderExtension -> data.triangles.src_x, buffer + 20, bigEndian); PutUINT(renderExtension -> data.triangles.src_y, buffer + 22, bigEndian); #ifdef TEST *logofs << name() << ": Unparsed identity. Type is " << (unsigned int) renderExtension -> data.triangles.type << " size is " << renderExtension -> size_ << " identity size " << renderExtension -> i_size_ << ".\n" << logofs_flush; #endif } MESSAGE_END_UNPARSE_IDENTITY MESSAGE_BEGIN_IDENTITY_CHECKSUM { // // Include minor opcode, size and the // operator in the identity. // md5_append(md5_state, buffer + 1, 4); // // Also include the format but not the // x and y source. // md5_append(md5_state, buffer + 16, 4); } MESSAGE_END_IDENTITY_CHECKSUM MESSAGE_BEGIN_ENCODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeXidValue(renderExtension -> data.triangles.src_id, clientCache -> renderSrcPictureCache); cachedRenderExtension -> data.triangles.src_id = renderExtension -> data.triangles.src_id; encodeBuffer.encodeXidValue(renderExtension -> data.triangles.dst_id, clientCache -> renderDstPictureCache); cachedRenderExtension -> data.triangles.dst_id = renderExtension -> data.triangles.dst_id; // // The source x and y coordinates are // encoded as differerences in respect // to the previous cached value. // unsigned int value; unsigned int previous; value = renderExtension -> data.triangles.src_x; previous = cachedRenderExtension -> data.triangles.src_x; encodeBuffer.encodeDiffCachedValue(value, previous, 16, clientCache -> renderXCache, 11); cachedRenderExtension -> data.triangles.src_x = value; value = renderExtension -> data.triangles.src_y; previous = cachedRenderExtension -> data.triangles.src_y; encodeBuffer.encodeDiffCachedValue(value, previous, 16, clientCache -> renderYCache, 11); cachedRenderExtension -> data.triangles.src_y = value; #ifdef TEST *logofs << name() << ": Encoded update. Type is " << (unsigned int) renderExtension -> data.triangles.type << " size is " << renderExtension -> size_ << " source x " << renderExtension -> data.triangles.src_x << " y " << renderExtension -> data.triangles.src_y << ".\n" << logofs_flush; #endif } MESSAGE_END_ENCODE_UPDATE MESSAGE_BEGIN_DECODE_UPDATE { RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeXidValue(renderExtension -> data.triangles.src_id, clientCache -> renderSrcPictureCache); decodeBuffer.decodeXidValue(renderExtension -> data.triangles.dst_id, clientCache -> renderDstPictureCache); unsigned int value; unsigned int previous; previous = renderExtension -> data.triangles.src_x; decodeBuffer.decodeDiffCachedValue(value, previous, 16, clientCache -> renderXCache, 11); renderExtension -> data.triangles.src_x = value; previous = renderExtension -> data.triangles.src_y; decodeBuffer.decodeDiffCachedValue(value, previous, 16, clientCache -> renderYCache, 11); renderExtension -> data.triangles.src_y = value; #ifdef TEST *logofs << name() << ": Decoded update. Type is " << (unsigned int) renderExtension -> data.triangles.type << " size is " << renderExtension -> size_ << " source x " << renderExtension -> data.triangles.src_x << " y " << renderExtension -> data.triangles.src_y << ".\n" << logofs_flush; #endif } MESSAGE_END_DECODE_UPDATE nx-libs-3.5.99.23/nxcomp/src/RenderTriangles.h0000644000000000000000000000604313614532331015646 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef RenderTriangles_H #define RenderTriangles_H // // Define the characteristics // of this message class here. // #undef MESSAGE_NAME #define MESSAGE_NAME "RenderTriangles" #undef MESSAGE_STORE #define MESSAGE_STORE RenderTrianglesStore #undef MESSAGE_CLASS #define MESSAGE_CLASS RenderMinorExtensionStore #undef MESSAGE_METHODS #define MESSAGE_METHODS "RenderMinorExtensionMethods.h" #undef MESSAGE_HEADERS #define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" #undef MESSAGE_TAGS #define MESSAGE_TAGS "RenderMinorExtensionTags.h" #undef MESSAGE_OFFSET #define MESSAGE_OFFSET 24 #undef MESSAGE_HAS_SIZE #define MESSAGE_HAS_SIZE 1 #undef MESSAGE_HAS_DATA #define MESSAGE_HAS_DATA 1 #undef MESSAGE_HAS_FILTER #define MESSAGE_HAS_FILTER 0 // // Declare the message class. // #include MESSAGE_HEADERS class MESSAGE_STORE : public MESSAGE_CLASS { public: virtual const char *name() const { return MESSAGE_NAME; } virtual int identitySize(const unsigned char *buffer, unsigned int size) { return (size >= MESSAGE_OFFSET ? MESSAGE_OFFSET : size); } #include MESSAGE_METHODS }; #endif /* RenderTriangles_H */ nx-libs-3.5.99.23/nxcomp/src/Rgb.cpp0000644000000000000000000000745013614532331013626 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Misc.h" #include "Rgb.h" #define PANIC #define WARNING #undef TEST #undef DEBUG int UnpackRgb(T_geometry *geometry, unsigned char method, unsigned char *src_data, int src_size, int dst_bpp, int dst_width, int dst_height, unsigned char *dst_data, int dst_size) { if (*src_data == 0) { if (dst_size != src_size - 1) { #ifdef TEST *logofs << "UnpackRgb: PANIC! Invalid destination size " << dst_size << " with source " << src_size << ".\n" << logofs_flush; #endif return -1; } #ifdef TEST *logofs << "UnpackRgb: Expanding " << src_size - 1 << " bytes of plain RGB data.\n" << logofs_flush; #endif memcpy(dst_data, src_data + 1, src_size - 1); return 1; } unsigned int check_size = dst_size; int result = ZDecompress(&unpackStream, dst_data, &check_size, src_data + 1, src_size - 1); if (result != Z_OK) { #ifdef PANIC *logofs << "UnpackRgb: PANIC! Failure decompressing RGB data. " << "Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failure decompressing RGB data. " << "Error is '" << zError(result) << "'.\n"; return -1; } else if (check_size != (unsigned int) dst_size) { #ifdef PANIC *logofs << "UnpackRgb: PANIC! Size mismatch in RGB data. " << "Resulting size is " << check_size << " with " << "expected size " << dst_size << ".\n" << logofs_flush; #endif cerr << "Error" << ": Size mismatch in RGB data. " << "Resulting size is " << check_size << " with " << "expected size " << dst_size << ".\n"; return -1; } #ifdef TEST *logofs << "UnpackRgb: Decompressed " << src_size - 1 << " bytes to " << dst_size << " bytes of RGB data.\n" << logofs_flush; #endif return 1; } nx-libs-3.5.99.23/nxcomp/src/Rgb.h0000644000000000000000000000416613614532331013274 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Rgb_H #define Rgb_H #include "Unpack.h" int UnpackRgb(T_geometry *geometry, unsigned char method, unsigned char *src_data, int src_size, int dst_bpp, int dst_width, int dst_height, unsigned char *dst_data, int dst_size); #endif /* Rgb_H */ nx-libs-3.5.99.23/nxcomp/src/Rle.cpp0000644000000000000000000000745013614532331013636 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Misc.h" #include "Rle.h" #define PANIC #define WARNING #undef TEST #undef DEBUG int UnpackRle(T_geometry *geometry, unsigned char method, unsigned char *src_data, int src_size, int dst_bpp, int dst_width, int dst_height, unsigned char *dst_data, int dst_size) { if (*src_data == 0) { if (dst_size != src_size - 1) { #ifdef TEST *logofs << "UnpackRle: PANIC! Invalid destination size " << dst_size << " with source " << src_size << ".\n" << logofs_flush; #endif return -1; } #ifdef TEST *logofs << "UnpackRle: Expanding " << src_size - 1 << " bytes of plain RLE data.\n" << logofs_flush; #endif memcpy(dst_data, src_data + 1, src_size - 1); return 1; } unsigned int check_size = dst_size; int result = ZDecompress(&unpackStream, dst_data, &check_size, src_data + 1, src_size - 1); if (result != Z_OK) { #ifdef PANIC *logofs << "UnpackRle: PANIC! Failure decompressing RLE data. " << "Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failure decompressing RLE data. " << "Error is '" << zError(result) << "'.\n"; return -1; } else if (check_size != (unsigned int) dst_size) { #ifdef PANIC *logofs << "UnpackRle: PANIC! Size mismatch in RLE data. " << "Resulting size is " << check_size << " with " << "expected size " << dst_size << ".\n" << logofs_flush; #endif cerr << "Error" << ": Size mismatch in RLE data. " << "Resulting size is " << check_size << " with " << "expected size " << dst_size << ".\n"; return -1; } #ifdef TEST *logofs << "UnpackRle: Decompressed " << src_size - 1 << " bytes to " << dst_size << " bytes of RLE data.\n" << logofs_flush; #endif return 1; } nx-libs-3.5.99.23/nxcomp/src/Rle.h0000644000000000000000000000416613614532331013304 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Rle_H #define Rle_H #include "Unpack.h" int UnpackRle(T_geometry *geometry, unsigned char method, unsigned char *src_data, int src_size, int dst_bpp, int dst_width, int dst_height, unsigned char *dst_data, int dst_size); #endif /* Rle_H */ nx-libs-3.5.99.23/nxcomp/src/SendEvent.cpp0000644000000000000000000002301513614532331015002 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "SendEvent.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "IntCache.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int SendEventStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { SendEventMessage *sendEvent = (SendEventMessage *) message; // // Here is the fingerprint. // sendEvent -> propagate = *(buffer + 1); sendEvent -> window = GetULONG(buffer + 4, bigEndian); sendEvent -> mask = GetULONG(buffer + 8, bigEndian); sendEvent -> code = *(buffer + 12); sendEvent -> byte_data = *(buffer + 13); sendEvent -> sequence = GetUINT(buffer + 14, bigEndian); sendEvent -> int_data = GetULONG(buffer + 16, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int SendEventStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { SendEventMessage *sendEvent = (SendEventMessage *) message; // // Fill all the message's fields. // *(buffer + 1) = sendEvent -> propagate; PutULONG(sendEvent -> window, buffer + 4, bigEndian); PutULONG(sendEvent -> mask, buffer + 8, bigEndian); *(buffer + 12) = sendEvent -> code; *(buffer + 13) = sendEvent -> byte_data; PutUINT(sendEvent -> sequence, buffer + 14, bigEndian); PutULONG(sendEvent -> int_data, buffer + 16, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void SendEventStore::dumpIdentity(const Message *message) const { #ifdef DUMP SendEventMessage *sendEvent = (SendEventMessage *) message; *logofs << name() << ": Identity propagate " << (unsigned int) sendEvent -> propagate << ", window " << sendEvent -> window << ", mask " << sendEvent -> mask << ", code " << (unsigned int) sendEvent -> code << ", byte_data " << (unsigned int) sendEvent -> byte_data << ", sequence " << sendEvent -> sequence << ", int_data " << sendEvent -> int_data << ", size " << sendEvent -> size_ << ".\n" << logofs_flush; #endif } void SendEventStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { } void SendEventStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { SendEventMessage *sendEvent = (SendEventMessage *) message; SendEventMessage *cachedSendEvent = (SendEventMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << (unsigned int) sendEvent -> propagate << " as propagate field.\n" << logofs_flush; #endif encodeBuffer.encodeBoolValue(sendEvent -> propagate); cachedSendEvent -> propagate = sendEvent -> propagate; #ifdef TEST *logofs << name() << ": Encoding value " << sendEvent -> window << " as window field.\n" << logofs_flush; #endif if (sendEvent -> window == 0 || sendEvent -> window == 1) { encodeBuffer.encodeBoolValue(1); encodeBuffer.encodeBoolValue(sendEvent -> window); } else { encodeBuffer.encodeBoolValue(0); encodeBuffer.encodeXidValue(sendEvent -> window, clientCache -> windowCache); } cachedSendEvent -> window = sendEvent -> window; #ifdef TEST *logofs << name() << ": Encoding value " << sendEvent -> mask << " as mask field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(sendEvent -> mask, 32, clientCache -> sendEventMaskCache); cachedSendEvent -> mask = sendEvent -> mask; #ifdef TEST *logofs << name() << ": Encoding value " << sendEvent -> code << " as code field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(sendEvent -> code, 8, clientCache -> sendEventCodeCache); cachedSendEvent -> code = sendEvent -> code; #ifdef TEST *logofs << name() << ": Encoding value " << sendEvent -> byte_data << " as byte_data field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(sendEvent -> byte_data, 8, clientCache -> sendEventByteDataCache); cachedSendEvent -> byte_data = sendEvent -> byte_data; #ifdef TEST *logofs << name() << ": Encoding value " << sendEvent -> sequence << " as sequence field.\n" << logofs_flush; #endif unsigned int diffSeq = sendEvent -> sequence - clientCache -> sendEventLastSequence; clientCache -> sendEventLastSequence = sendEvent -> sequence; encodeBuffer.encodeValue(diffSeq, 16, 4); cachedSendEvent -> sequence = sendEvent -> sequence; #ifdef TEST *logofs << name() << ": Encoding value " << sendEvent -> int_data << " as int_data field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(sendEvent -> int_data, 32, clientCache -> sendEventIntDataCache); cachedSendEvent -> int_data = sendEvent -> int_data; } void SendEventStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { SendEventMessage *sendEvent = (SendEventMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeBoolValue(value); sendEvent -> propagate = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << (unsigned int) sendEvent -> propagate << " as propagate field.\n" << logofs_flush; #endif decodeBuffer.decodeBoolValue(value); if (value) { decodeBuffer.decodeBoolValue(value); } else { decodeBuffer.decodeXidValue(value, clientCache -> windowCache); } sendEvent -> window = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << sendEvent -> window << " as window field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(sendEvent -> mask, 32, clientCache -> sendEventMaskCache); #ifdef DEBUG *logofs << name() << ": Decoded value " << sendEvent -> mask << " as mask field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(sendEvent -> code, 8, clientCache -> sendEventCodeCache); #ifdef DEBUG *logofs << name() << ": Decoded value " << sendEvent -> code << " as code field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(sendEvent -> byte_data, 8, clientCache -> sendEventByteDataCache); #ifdef DEBUG *logofs << name() << ": Decoded value " << sendEvent -> byte_data << " as byte_data field.\n" << logofs_flush; #endif decodeBuffer.decodeValue(value, 16, 4); clientCache -> sendEventLastSequence += value; clientCache -> sendEventLastSequence &= 0xffff; sendEvent -> sequence = clientCache -> sendEventLastSequence; #ifdef DEBUG *logofs << name() << ": Decoded value " << sendEvent -> sequence << " as sequence field.\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(sendEvent -> int_data, 32, clientCache -> sendEventIntDataCache); #ifdef DEBUG *logofs << name() << ": Decoded value " << sendEvent -> int_data << " as int_data field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/SendEvent.h0000644000000000000000000001253113614532331014450 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef SendEvent_H #define SendEvent_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define SENDEVENT_ENABLE_CACHE 1 #define SENDEVENT_ENABLE_DATA 0 #define SENDEVENT_ENABLE_SPLIT 0 #define SENDEVENT_ENABLE_COMPRESS 0 #define SENDEVENT_DATA_LIMIT 24 #define SENDEVENT_DATA_OFFSET 20 #define SENDEVENT_CACHE_SLOTS 2000 #define SENDEVENT_CACHE_THRESHOLD 2 #define SENDEVENT_CACHE_LOWER_THRESHOLD 1 // // The message class. // class SendEventMessage : public Message { friend class SendEventStore; public: SendEventMessage() { } ~SendEventMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char propagate; unsigned int window; unsigned int mask; // // These are part of the event data. // unsigned char code; unsigned char byte_data; unsigned short sequence; unsigned int int_data; }; class SendEventStore : public MessageStore { // // Constructors and destructors. // public: SendEventStore() : MessageStore() { enableCache = SENDEVENT_ENABLE_CACHE; enableData = SENDEVENT_ENABLE_DATA; enableSplit = SENDEVENT_ENABLE_SPLIT; enableCompress = SENDEVENT_ENABLE_COMPRESS; dataLimit = SENDEVENT_DATA_LIMIT; dataOffset = SENDEVENT_DATA_OFFSET; cacheSlots = SENDEVENT_CACHE_SLOTS; cacheThreshold = SENDEVENT_CACHE_THRESHOLD; cacheLowerThreshold = SENDEVENT_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~SendEventStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "SendEvent"; } virtual unsigned char opcode() const { return X_SendEvent; } virtual unsigned int storage() const { return sizeof(SendEventMessage); } // // Message handling methods. // public: virtual Message *create() const { return new SendEventMessage(); } virtual Message *create(const Message &message) const { return new SendEventMessage((const SendEventMessage &) message); } virtual void destroy(Message *message) const { delete (SendEventMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* SendEvent_H */ nx-libs-3.5.99.23/nxcomp/src/SequenceQueue.cpp0000644000000000000000000001077613614532331015676 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "SequenceQueue.h" static const unsigned int INITIAL_SIZE_ = 16; static const unsigned int GROWTH_INCREMENT = 16; SequenceQueue::SequenceQueue() : queue_(new RequestSequence[INITIAL_SIZE_]), size_(INITIAL_SIZE_), length_(0), start_(0), end_(0) { } SequenceQueue::~SequenceQueue() { delete [] queue_; } void SequenceQueue::push(unsigned short int sequence, unsigned char opcode, unsigned int data1, unsigned int data2, unsigned int data3) { if (length_ == 0) { start_ = end_ = 0; queue_[0].opcode = opcode; queue_[0].sequence = sequence; queue_[0].data1 = data1; queue_[0].data2 = data2; queue_[0].data3 = data3; length_ = 1; return; } if (length_ == size_) { size_ += GROWTH_INCREMENT; RequestSequence *newQueue = new RequestSequence[size_]; for (int i = start_; (unsigned int) i < length_; i++) { newQueue[i - start_] = queue_[i]; } for (int i1 = 0; (unsigned int) i1 < start_; i1++) { newQueue[i1 + length_ - start_] = queue_[i1]; } delete [] queue_; queue_ = newQueue; start_ = 0; end_ = length_ - 1; } end_++; if (end_ == size_) { end_ = 0; } queue_[end_].opcode = opcode; queue_[end_].sequence = sequence; queue_[end_].data1 = data1; queue_[end_].data2 = data2; queue_[end_].data3 = data3; length_++; } int SequenceQueue::peek(unsigned short int &sequence, unsigned char &opcode) { if (length_ == 0) { return 0; } else { opcode = queue_[start_].opcode; sequence = queue_[start_].sequence; return 1; } } int SequenceQueue::peek(unsigned short int &sequence, unsigned char &opcode, unsigned int &data1, unsigned int &data2, unsigned int &data3) { if (length_ == 0) { return 0; } else { opcode = queue_[start_].opcode; sequence = queue_[start_].sequence; data1 = queue_[start_].data1; data2 = queue_[start_].data2; data3 = queue_[start_].data3; return 1; } } int SequenceQueue::pop(unsigned short int &sequence, unsigned char &opcode, unsigned int &data1, unsigned int &data2, unsigned int &data3) { if (length_ == 0) { return 0; } else { opcode = queue_[start_].opcode; sequence = queue_[start_].sequence; data1 = queue_[start_].data1; data2 = queue_[start_].data2; data3 = queue_[start_].data3; start_++; if (start_ == size_) { start_ = 0; } length_--; return 1; } } nx-libs-3.5.99.23/nxcomp/src/SequenceQueue.h0000644000000000000000000000636713614532331015344 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef SequenceQueue_H #define SequenceQueue_H // // List of outstanding request messages which // are waiting for a reply. This class is used // in X client and server channels to correlate // the replies sequence numbers to the original // request type. // class SequenceQueue { public: SequenceQueue(); virtual ~SequenceQueue(); void push(unsigned short int sequence, unsigned char opcode, unsigned int data1 = 0, unsigned int data2 = 0, unsigned int data3 = 0); int peek(unsigned short int &sequence, unsigned char &opcode); int peek(unsigned short int &sequence, unsigned char &opcode, unsigned int &data1, unsigned int &data2, unsigned int &data3); int pop(unsigned short int &sequence, unsigned char &opcode, unsigned int &data1, unsigned int &data2, unsigned int &data3); int pop(unsigned short int &sequence, unsigned char &opcode) { unsigned int data1, data2, data3; return pop(sequence, opcode, data1, data2, data3); } int length() { return length_; } private: struct RequestSequence { unsigned short int sequence; unsigned char opcode; unsigned int data1; unsigned int data2; unsigned int data3; }; RequestSequence *queue_; unsigned int size_; unsigned int length_; unsigned int start_; unsigned int end_; }; #endif /* SequenceQueue_H */ nx-libs-3.5.99.23/nxcomp/src/ServerCache.cpp0000644000000000000000000001211713614532331015302 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ServerCache.h" // // Some global caches used to store information // common to all X connections. // BlockCache ServerCache::lastInitReply; BlockCache ServerCache::lastKeymap; unsigned char ServerCache::getKeyboardMappingLastKeysymsPerKeycode = 0; BlockCache ServerCache::getKeyboardMappingLastMap; BlockCache ServerCache::getModifierMappingLastMap; BlockCache ServerCache::xResources; BlockCacheSet ServerCache::queryFontFontCache(16); ServerCache::ServerCache() : replySequenceCache(6), eventSequenceCache(6), lastTimestamp(0), visualCache(8), colormapCache(8), errorMinorCache(8), colormapNotifyWindowCache(8), colormapNotifyColormapCache(8), createNotifyWindowCache(8), createNotifyLastWindow(0), exposeWindowCache(12), focusInWindowCache(8), keyPressLastKey(0), mapNotifyEventCache(8), mapNotifyWindowCache(8), motionNotifyTimestampCache(8), motionNotifyLastRootX(0), motionNotifyLastRootY(0), motionNotifyRootXCache(8), motionNotifyRootYCache(8), motionNotifyEventXCache(8), motionNotifyEventYCache(8), motionNotifyStateCache(8), noExposeDrawableCache(8), noExposeMinorCache(8), propertyNotifyWindowCache(8), propertyNotifyAtomCache(8), reparentNotifyWindowCache(8), selectionClearWindowCache(8), selectionClearAtomCache(8), visibilityNotifyWindowCache(8), getGeometryRootCache(8), getInputFocusWindowCache(8), getKeyboardMappingKeysymCache(8), getPropertyTypeCache(8), getSelectionOwnerCache(8), getWindowAttributesClassCache(8), getWindowAttributesPlanesCache(8), getWindowAttributesPixelCache(8), getWindowAttributesAllEventsCache(8), getWindowAttributesYourEventsCache(8), getWindowAttributesDontPropagateCache(8), queryPointerRootCache(8), queryPointerChildCache(8), translateCoordsChildCache(8), translateCoordsXCache(8), translateCoordsYCache(8), queryTreeWindowCache(8) { unsigned int i; for (i = 0; i < 3; i++) { configureNotifyWindowCache[i] = new IntCache(8); } for (i = 0; i < 5; i++) { configureNotifyGeomCache[i] = new IntCache(8); } for (i = 0; i < 5; i++) { exposeGeomCache[i] = new IntCache(8); } for (i = 0; i < 3; i++) { motionNotifyWindowCache[i] = new IntCache(8); } for (i = 0; i < 5; i++) { getGeometryGeomCache[i] = new IntCache(8); } for (i = 0; i < 23; i++) { keyPressCache[i] = 0; } for (i = 0; i < 6; i++) { queryFontCharInfoCache[i] = new IntCache(8); queryFontLastCharInfo[i] = 0; } for (i = 0; i < 12; i++) { genericReplyIntCache[i] = new IntCache(8); } for (i = 0; i < 14; i++) { genericEventIntCache[i] = new IntCache(8); } } ServerCache::~ServerCache() { unsigned int i; for (i = 0; i < 3; i++) { delete configureNotifyWindowCache[i]; } for (i = 0; i < 5; i++) { delete configureNotifyGeomCache[i]; } for (i = 0; i < 5; i++) { delete exposeGeomCache[i]; } for (i = 0; i < 3; i++) { delete motionNotifyWindowCache[i]; } for (i = 0; i < 5; i++) { delete getGeometryGeomCache[i]; } for (i = 0; i < 6; i++) { delete queryFontCharInfoCache[i]; } for (i = 0; i < 12; i++) { delete genericReplyIntCache[i]; } for (i = 0; i < 14; i++) { delete genericEventIntCache[i]; } } nx-libs-3.5.99.23/nxcomp/src/ServerCache.h0000644000000000000000000001500613614532331014747 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ServerCache_H #define ServerCache_H #include "Misc.h" #include "IntCache.h" #include "CharCache.h" #include "OpcodeCache.h" #include "BlockCache.h" #include "BlockCacheSet.h" #include "ChannelCache.h" class ServerCache : public ChannelCache { public: ServerCache(); ~ServerCache(); // // Opcode prediction caches. // OpcodeCache opcodeCache; // // General-purpose caches. // IntCache replySequenceCache; IntCache eventSequenceCache; unsigned int lastTimestamp; CharCache depthCache; IntCache visualCache; IntCache colormapCache; CharCache resourceCache; // // X connection startup. // static BlockCache lastInitReply; // // X errors. // CharCache errorCodeCache; IntCache errorMinorCache; CharCache errorMajorCache; // // ButtonPress and ButtonRelease events. // CharCache buttonCache; // // ColormapNotify event. // IntCache colormapNotifyWindowCache; IntCache colormapNotifyColormapCache; // // ConfigureNotify event. // IntCache *configureNotifyWindowCache[3]; IntCache *configureNotifyGeomCache[5]; // // CreateNotify event. // IntCache createNotifyWindowCache; unsigned int createNotifyLastWindow; // // Expose event. // IntCache exposeWindowCache; IntCache *exposeGeomCache[5]; // // FocusIn event (also used for FocusOut). // IntCache focusInWindowCache; // // KeymapNotify event. // static BlockCache lastKeymap; // // KeyPress event. // unsigned char keyPressLastKey; unsigned char keyPressCache[23]; // // MapNotify event (also used for UnmapNotify). // IntCache mapNotifyEventCache; IntCache mapNotifyWindowCache; // // MotionNotify event (also used for KeyPress, // KeyRelease, ButtonPress, ButtonRelease, // EnterNotify, and LeaveNotify events and // QueryPointer reply). // IntCache motionNotifyTimestampCache; unsigned int motionNotifyLastRootX; unsigned int motionNotifyLastRootY; IntCache motionNotifyRootXCache; IntCache motionNotifyRootYCache; IntCache motionNotifyEventXCache; IntCache motionNotifyEventYCache; IntCache motionNotifyStateCache; IntCache *motionNotifyWindowCache[3]; // // NoExpose event. // IntCache noExposeDrawableCache; IntCache noExposeMinorCache; CharCache noExposeMajorCache; // // PropertyNotify event. // IntCache propertyNotifyWindowCache; IntCache propertyNotifyAtomCache; // // ReparentNotify event. // IntCache reparentNotifyWindowCache; // // SelectionClear event. // IntCache selectionClearWindowCache; IntCache selectionClearAtomCache; // // VisibilityNotify event. // IntCache visibilityNotifyWindowCache; // // GetGeometry reply. // IntCache getGeometryRootCache; IntCache *getGeometryGeomCache[5]; // // GetInputFocus reply. // IntCache getInputFocusWindowCache; // // GetKeyboardMapping reply. // static unsigned char getKeyboardMappingLastKeysymsPerKeycode; static BlockCache getKeyboardMappingLastMap; IntCache getKeyboardMappingKeysymCache; CharCache getKeyboardMappingLastByteCache; // // GetModifierMapping reply. // static BlockCache getModifierMappingLastMap; // // GetProperty reply. // CharCache getPropertyFormatCache; IntCache getPropertyTypeCache; static BlockCache xResources; // // GetSelection reply. // IntCache getSelectionOwnerCache; // // GetWindowAttributes reply. // IntCache getWindowAttributesClassCache; CharCache getWindowAttributesBitGravityCache; CharCache getWindowAttributesWinGravityCache; IntCache getWindowAttributesPlanesCache; IntCache getWindowAttributesPixelCache; IntCache getWindowAttributesAllEventsCache; IntCache getWindowAttributesYourEventsCache; IntCache getWindowAttributesDontPropagateCache; // // QueryColors reply. // BlockCache queryColorsLastReply; // // QueryFont reply. // static BlockCacheSet queryFontFontCache; IntCache *queryFontCharInfoCache[6]; unsigned int queryFontLastCharInfo[6]; // // QueryPointer reply. // IntCache queryPointerRootCache; IntCache queryPointerChildCache; // // TranslateCoords reply. // IntCache translateCoordsChildCache; IntCache translateCoordsXCache; IntCache translateCoordsYCache; // // QueryTree reply. // IntCache queryTreeWindowCache; // // Generic reply. Use short data // in protocol versions >= 3. // CharCache genericReplyCharCache; IntCache *genericReplyIntCache[12]; // // Generic event. Only in protocol // versions >= 3. // CharCache genericEventCharCache; IntCache *genericEventIntCache[14]; // // Used in the abort split events. // OpcodeCache abortOpcodeCache; }; #endif /* ServerCache_H */ nx-libs-3.5.99.23/nxcomp/src/ServerChannel.cpp0000644000000000000000000076326513614532331015670 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifndef ANDROID #include #endif #include #include #include "NXproto.h" #include "NXalert.h" #include "NXpack.h" #include "NXmitshm.h" #include "ServerChannel.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "StaticCompressor.h" #include "Statistics.h" #include "Proxy.h" #include "Auth.h" #include "Unpack.h" // // Available unpack methods. // #include "Alpha.h" #include "Colormap.h" #include "Bitmap.h" #include "Jpeg.h" #include "Pgn.h" #include "Rgb.h" #include "Rle.h" extern Proxy *proxy; // // Set the verbosity level. You also // need to define OPCODES in Misc.cpp // if you want literals instead of // opcodes' numbers. // #define PANIC #define WARNING #undef OPCODES #undef TEST #undef DEBUG #undef DUMP // // Log the important tracepoints related // to writing packets to the peer proxy. // #undef FLUSH // // Log the operations related to splits. // #undef SPLIT // // Define this to log when a channel // is created or destroyed. // #undef REFERENCES // // Define this to exit and suspend the // session after a given number of X // messages decoded by the proxy. // #undef SUSPEND // // Define these to hide the server extensions. // #define HIDE_MIT_SHM_EXTENSION #define HIDE_BIG_REQUESTS_EXTENSION #define HIDE_XFree86_Bigfont_EXTENSION #undef HIDE_SHAPE_EXTENSION #undef HIDE_XKEYBOARD_EXTENSION // // Known reasons of connection failures. // #define INVALID_COOKIE_DATA "Invalid MIT-MAGIC-COOKIE-1 key" #define INVALID_COOKIE_SIZE ((int) sizeof(INVALID_COOKIE_DATA) - 1) #define NO_AUTH_PROTO_DATA "No protocol specified" #define NO_AUTH_PROTO_SIZE ((int) sizeof(NO_AUTH_PROTO_DATA) - 1) // // Here are the static members. // #ifdef REFERENCES int ServerChannel::references_ = 0; #endif ServerChannel::ServerChannel(Transport *transport, StaticCompressor *compressor) : Channel(transport, compressor), readBuffer_(transport_, this) { // // Sequence number of the next message // being encoded or decoded. // clientSequence_ = 0; serverSequence_ = 0; // // Save the last motion event and flush // it only when the timeout expires. // lastMotion_[0] = '\0'; // // Clear the queue of sequence numbers // of split commits. Used to mask the // errors. // initCommitQueue(); // // Do we enable or not sending of expose // events to the X client. // enableExpose_ = 1; enableGraphicsExpose_ = 1; enableNoExpose_ = 1; // // Track data of image currently being // decompressed. // imageState_ = NULL; // // Track MIT-SHM resources. // shmemState_ = NULL; // // Store the unpack state for each agent // resource. // for (int i = 0; i < CONNECTIONS_LIMIT; i++) { unpackState_[i] = NULL; } // // Data about the split parameters requested // by the encoding side. // splitState_.resource = nothing; splitState_.current = 0; splitState_.save = 1; splitState_.load = 1; splitState_.commit = 0; // // It will be eventually set by // the server proxy. // fontPort_ = -1; #ifdef REFERENCES *logofs << "ServerChannel: Created new object at " << this << " for FD#" << fd_ << " out of " << ++references_ << " allocated channels.\n" << logofs_flush; #endif } ServerChannel::~ServerChannel() { #ifdef TEST *logofs << "ServerChannel: Freeing image state information.\n" << logofs_flush; #endif handleImageStateRemove(); #ifdef TEST *logofs << "ServerChannel: Freeing shared memory information.\n" << logofs_flush; #endif handleShmemStateRemove(); #ifdef TEST *logofs << "ServerChannel: Freeing unpack state information.\n" << logofs_flush; #endif for (int i = 0; i < CONNECTIONS_LIMIT; i++) { handleUnpackStateRemove(i); } #ifdef TEST *logofs << "ServerChannel: Freeing channel caches.\n" << logofs_flush; #endif #ifdef REFERENCES *logofs << "ServerChannel: Deleted object at " << this << " for FD#" << fd_ << " out of " << --references_ << " allocated channels.\n" << logofs_flush; #endif } // // Beginning of handleRead(). // int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, unsigned int length) { #ifdef DEBUG *logofs << "handleRead: Called for FD#" << fd_ << ".\n" << logofs_flush; #endif // // Pointer to located message and // its size in bytes. // const unsigned char *inputMessage; unsigned int inputLength; // // Set when message is found in // cache. // int hit; #if defined(TEST) || defined(INFO) *logofs << "handleRead: Trying to read from FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif int result = readBuffer_.readMessage(); #if defined(DEBUG) || defined(INFO) *logofs << "handleRead: Read result on FD#" << fd_ << " is " << result << ".\n" << logofs_flush; #endif if (result < 0) { // // Let the proxy close the channel. // return -1; } else if (result == 0) { #if defined(TEST) || defined(INFO) // // This can happen because we have the descriptor // selected in the read set but we already read // the data asynchronously, while decoding data // read from the proxy. // *logofs << "handleRead: WARNING! No data read from FD#" << fd_ << " while encoding messages.\n" << logofs_flush; #endif return 0; } #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "handleRead: Encoding messages for FD#" << fd_ << " with " << readBuffer_.getLength() << " bytes " << "in the buffer.\n" << logofs_flush; #endif // // Extract any complete message which // is available in the buffer. // if (proxy -> handleAsyncSwitch(fd_) < 0) { return -1; } while ((inputMessage = readBuffer_.getMessage(inputLength)) != NULL) { hit = 0; if (firstReply_) { // // Handle the X server's authorization reply. // if (handleAuthorization(inputMessage, inputLength) < 0) { return -1; } imageByteOrder_ = inputMessage[30]; bitmapBitOrder_ = inputMessage[31]; scanlineUnit_ = inputMessage[32]; scanlinePad_ = inputMessage[33]; encodeBuffer.encodeValue((unsigned int) inputMessage[0], 8); encodeBuffer.encodeValue((unsigned int) inputMessage[1], 8); encodeBuffer.encodeValue(GetUINT(inputMessage + 2, bigEndian_), 16); encodeBuffer.encodeValue(GetUINT(inputMessage + 4, bigEndian_), 16); encodeBuffer.encodeValue(GetUINT(inputMessage + 6, bigEndian_), 16); if (ServerCache::lastInitReply.compare(inputLength - 8, inputMessage + 8)) { encodeBuffer.encodeBoolValue(1); } else { encodeBuffer.encodeBoolValue(0); for (unsigned int i = 8; i < inputLength; i++) { encodeBuffer.encodeValue((unsigned int) inputMessage[i], 8); } } firstReply_ = 0; #if defined(TEST) || defined(OPCODES) int bits = encodeBuffer.diffBits(); *logofs << "handleRead: Handled first reply. " << inputLength << " bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; #endif priority_++; } else { // // NX client needs this line to consider // the initialization phase successfully // completed. // if (firstClient_ == -1) { cerr << "Info" << ": Established X server connection.\n" ; firstClient_ = fd_; } // // Check if this is a reply. // if (*inputMessage == X_Reply) { int bits = 0; unsigned char inputOpcode = *inputMessage; unsigned short int requestSequenceNum; unsigned char requestOpcode; unsigned int requestData[3]; unsigned int sequenceNum = GetUINT(inputMessage + 2, bigEndian_); #ifdef SUSPEND if (sequenceNum >= 1000) { cerr << "Warning" << ": Exiting to test the resilience of the agent.\n"; sleep(2); HandleAbort(); } #endif // // We managed all the events and errors caused // by the previous requests. We can now reset // the queue of split commits. // clearCommitQueue(); // // Encode opcode and difference between // current sequence and the last one. // encodeBuffer.encodeOpcodeValue(inputOpcode, serverCache_ -> opcodeCache); unsigned int sequenceDiff = sequenceNum - serverSequence_; serverSequence_ = sequenceNum; #ifdef DEBUG *logofs << "handleRead: Last server sequence number for FD#" << fd_ << " is " << serverSequence_ << " with " << "difference " << sequenceDiff << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(sequenceDiff, 16, serverCache_ -> replySequenceCache, 7); // // Now handle the data part. // if (sequenceQueue_.peek(requestSequenceNum, requestOpcode) && requestSequenceNum == sequenceNum) { // // We've found the request that generated this reply. // It is possible to compress the reply based on the // specific request type. // sequenceQueue_.pop(requestSequenceNum, requestOpcode, requestData[0], requestData[1], requestData[2]); // // If differential compression is disabled // then use the most simple encoding. // if (control -> LocalDeltaCompression == 0) { int _result = handleFastReadReply(encodeBuffer, requestOpcode, inputMessage, inputLength); if (_result < 0) { return -1; } else if (_result > 0) { continue; } } switch (requestOpcode) { case X_AllocColor: { const unsigned char *nextSrc = inputMessage + 8; for (unsigned int i = 0; i < 3; i++) { unsigned int colorValue = GetUINT(nextSrc, bigEndian_); nextSrc += 2; if (colorValue == requestData[i]) encodeBuffer.encodeBoolValue(1); else { encodeBuffer.encodeBoolValue(0); encodeBuffer.encodeValue(colorValue - colorValue, 16, 6); } } unsigned int pixel = GetULONG(inputMessage + 16, bigEndian_); encodeBuffer.encodeValue(pixel, 32, 9); priority_++; } break; case X_GetAtomName: { unsigned int nameLength = GetUINT(inputMessage + 8, bigEndian_); encodeBuffer.encodeValue(nameLength, 16, 6); const unsigned char *nextSrc = inputMessage + 32; // Since ProtoStep7 (#issue 108) encodeBuffer.encodeTextData(nextSrc, nameLength); priority_++; } break; case X_GetGeometry: { // // TODO: This obtains a satisfactory 10:1, but // could be cached to leverage the big amount // of such requests issued by QT clients. // encodeBuffer.encodeCachedValue(inputMessage[1], 8, serverCache_ -> depthCache); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> getGeometryRootCache, 9); const unsigned char *nextSrc = inputMessage + 12; for (unsigned int i = 0; i < 5; i++) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *serverCache_ -> getGeometryGeomCache[i], 8); nextSrc += 2; } priority_++; } break; case X_GetInputFocus: { // // Is it a real X_GetInputFocus or a // masqueraded reply? // if (requestData[0] == X_GetInputFocus) { encodeBuffer.encodeValue((unsigned int) inputMessage[1], 2); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> getInputFocusWindowCache); priority_++; } else { // // TODO: We are not setting priority in case // of replies other than real X_GetInputFocus // or X_NXGetUnpackParameters. We should check // once again that this is OK. // #ifdef TEST *logofs << "handleRead: Received tainted X_GetInputFocus reply " << "for request OPCODE#" << requestData[0] << " with " << "sequence " << sequenceNum << ".\n" << logofs_flush; #endif // // Don't encode any data in case of sync // messages or any other reply for which // opcode is enough. // if (requestData[0] == opcodeStore_ -> getUnpackParameters) { for (int i = 0; i < PACK_METHOD_LIMIT; i++) { encodeBuffer.encodeBoolValue(control -> LocalUnpackMethods[i]); } priority_++; } else if (requestData[0] == opcodeStore_ -> getShmemParameters) { if (handleShmemReply(encodeBuffer, requestOpcode, requestData[1], inputMessage, inputLength) < 0) { return -1; } priority_++; } else if (requestData[0] == opcodeStore_ -> getFontParameters) { if (handleFontReply(encodeBuffer, requestOpcode, inputMessage, inputLength) < 0) { return -1; } } // // Account this data to the original opcode. // requestOpcode = requestData[0]; } } break; case X_GetKeyboardMapping: { unsigned int keysymsPerKeycode = (unsigned int) inputMessage[1]; if (ServerCache::getKeyboardMappingLastMap.compare(inputLength - 32, inputMessage + 32) && (keysymsPerKeycode == ServerCache::getKeyboardMappingLastKeysymsPerKeycode)) { encodeBuffer.encodeBoolValue(1); priority_++; break; } ServerCache::getKeyboardMappingLastKeysymsPerKeycode = keysymsPerKeycode; encodeBuffer.encodeBoolValue(0); unsigned int numKeycodes = (((inputLength - 32) / keysymsPerKeycode) >> 2); encodeBuffer.encodeValue(numKeycodes, 8); encodeBuffer.encodeValue(keysymsPerKeycode, 8, 4); const unsigned char *nextSrc = inputMessage + 32; unsigned char previous = 0; for (unsigned int count = numKeycodes * keysymsPerKeycode; count; --count) { unsigned int keysym = GetULONG(nextSrc, bigEndian_); nextSrc += 4; if (keysym == NoSymbol) encodeBuffer.encodeBoolValue(1); else { encodeBuffer.encodeBoolValue(0); unsigned int first3Bytes = (keysym >> 8); encodeBuffer.encodeCachedValue(first3Bytes, 24, serverCache_ -> getKeyboardMappingKeysymCache, 9); unsigned char lastByte = (unsigned char) (keysym & 0xff); encodeBuffer.encodeCachedValue(lastByte - previous, 8, serverCache_ -> getKeyboardMappingLastByteCache, 5); previous = lastByte; } } priority_++; } break; case X_GetModifierMapping: { encodeBuffer.encodeValue((unsigned int) inputMessage[1], 8); const unsigned char *nextDest = inputMessage + 32; if (ServerCache::getModifierMappingLastMap.compare(inputLength - 32, nextDest)) { encodeBuffer.encodeBoolValue(1); priority_++; break; } encodeBuffer.encodeBoolValue(0); for (unsigned int count = inputLength - 32; count; count--) { unsigned char next = *nextDest++; if (next == 0) encodeBuffer.encodeBoolValue(1); else { encodeBuffer.encodeBoolValue(0); encodeBuffer.encodeValue(next, 8); } } priority_++; } break; case X_GetProperty: { MessageStore *messageStore = serverStore_ -> getReplyStore(X_GetProperty); hit = handleEncode(encodeBuffer, serverCache_, messageStore, requestOpcode, inputMessage, inputLength); priority_++; } break; case X_GetSelectionOwner: { encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> getSelectionOwnerCache, 9); priority_++; } break; case X_GetWindowAttributes: { encodeBuffer.encodeValue((unsigned int) inputMessage[1], 2); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> visualCache); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 12, bigEndian_), 16, serverCache_ -> getWindowAttributesClassCache, 3); encodeBuffer.encodeCachedValue(inputMessage[14], 8, serverCache_ -> getWindowAttributesBitGravityCache); encodeBuffer.encodeCachedValue(inputMessage[15], 8, serverCache_ -> getWindowAttributesWinGravityCache); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), 32, serverCache_ -> getWindowAttributesPlanesCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 20, bigEndian_), 32, serverCache_ -> getWindowAttributesPixelCache, 9); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[24]); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[25]); encodeBuffer.encodeValue((unsigned int) inputMessage[26], 2); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[27]); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 28, bigEndian_), 29, serverCache_ -> colormapCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 32, bigEndian_), 32, serverCache_ -> getWindowAttributesAllEventsCache); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 36, bigEndian_), 32, serverCache_ -> getWindowAttributesYourEventsCache); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 40, bigEndian_), 16, serverCache_ -> getWindowAttributesDontPropagateCache); priority_++; } break; case X_GrabKeyboard: case X_GrabPointer: { encodeBuffer.encodeValue((unsigned int) inputMessage[1], 3); priority_++; } break; case X_InternAtom: { encodeBuffer.encodeValue(GetULONG(inputMessage + 8, bigEndian_), 29, 9); priority_++; } break; case X_ListExtensions: { encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 8); unsigned int numExtensions = (unsigned int) inputMessage[1]; encodeBuffer.encodeValue(numExtensions, 8); const unsigned char *nextSrc = inputMessage + 32; for (; numExtensions; numExtensions--) { unsigned int _length = (unsigned int) (*nextSrc++); encodeBuffer.encodeValue(_length, 8); #ifdef HIDE_MIT_SHM_EXTENSION if (!strncmp((char *) nextSrc, "MIT-SHM", 7)) { #ifdef TEST *logofs << "handleRead: Hiding MIT-SHM extension in reply.\n" << logofs_flush; #endif memcpy((unsigned char *) nextSrc, "NO-MIT-", 7); } #endif #ifdef HIDE_BIG_REQUESTS_EXTENSION if (!strncmp((char *) nextSrc, "BIG-REQUESTS", 12)) { #ifdef TEST *logofs << "handleRead: Hiding BIG-REQUESTS extension in reply.\n" << logofs_flush; #endif memcpy((unsigned char *) nextSrc, "NO-BIG-REQUE", 12); } #endif #ifdef HIDE_XKEYBOARD_EXTENSION if (!strncmp((char *) nextSrc, "XKEYBOARD", 9)) { #ifdef TEST *logofs << "handleRead: Hiding XKEYBOARD extension in reply.\n" << logofs_flush; #endif memcpy((unsigned char *) nextSrc, "NO-XKEYBO", 9); } #endif #ifdef HIDE_XFree86_Bigfont_EXTENSION if (!strncmp((char *) nextSrc, "XFree86-Bigfont", 15)) { #ifdef TEST *logofs << "handleRead: Hiding XFree86-Bigfont extension in reply.\n" << logofs_flush; #endif memcpy((unsigned char *) nextSrc, "NO-XFree86-Bigf", 15); } #endif #ifdef HIDE_SHAPE_EXTENSION if (!strncmp((char *) nextSrc, "SHAPE", 5)) { #ifdef TEST *logofs << "handleRead: Hiding SHAPE extension in reply.\n" << logofs_flush; #endif memcpy((unsigned char *) nextSrc, "NO-SH", 5); } #endif // // Check if user disabled RENDER extension. // if (control -> HideRender == 1 && !strncmp((char *) nextSrc, "RENDER", 6)) { #ifdef TEST *logofs << "handleRead: Hiding RENDER extension in reply.\n" << logofs_flush; #endif memcpy((unsigned char *) nextSrc, "NO-REN", 6); } for (; length; length--) { encodeBuffer.encodeValue((unsigned int) (*nextSrc++), 8); } } priority_++; } break; case X_ListFonts: { MessageStore *messageStore = serverStore_ -> getReplyStore(X_ListFonts); if (handleEncodeCached(encodeBuffer, serverCache_, messageStore, inputMessage, inputLength)) { priority_++; hit = 1; break; } encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 8); unsigned int numFonts = GetUINT(inputMessage + 8, bigEndian_); encodeBuffer.encodeValue(numFonts, 16, 6); // Differential encoding. encodeBuffer.encodeBoolValue(1); const unsigned char* nextSrc = inputMessage + 32; for (; numFonts; numFonts--) { unsigned int _length = (unsigned int) (*nextSrc++); encodeBuffer.encodeValue(_length, 8); // Since ProtoStep7 (#issue 108) encodeBuffer.encodeTextData(nextSrc, _length); nextSrc += _length; } priority_++; } break; case X_LookupColor: case X_AllocNamedColor: { const unsigned char *nextSrc = inputMessage + 8; if (requestOpcode == X_AllocNamedColor) { encodeBuffer.encodeValue(GetULONG(nextSrc, bigEndian_), 32, 9); nextSrc += 4; } unsigned int count = 3; do { unsigned int exactColor = GetUINT(nextSrc, bigEndian_); encodeBuffer.encodeValue(exactColor, 16, 9); unsigned int visualColor = GetUINT(nextSrc + 6, bigEndian_) - exactColor; encodeBuffer.encodeValue(visualColor, 16, 5); nextSrc += 2; } while (--count); priority_++; } break; case X_QueryBestSize: { encodeBuffer.encodeValue(GetUINT(inputMessage + 8, bigEndian_), 16, 8); encodeBuffer.encodeValue(GetUINT(inputMessage + 10, bigEndian_), 16, 8); priority_++; } break; case X_QueryColors: { // Differential encoding. encodeBuffer.encodeBoolValue(1); unsigned int numColors = ((inputLength - 32) >> 3); const unsigned char *nextSrc1 = inputMessage + 40; unsigned char *nextDest = (unsigned char *) inputMessage + 38; for (unsigned int c = 1; c < numColors; c++) { for (unsigned int i = 0; i < 6; i++) *nextDest++ = *nextSrc1++; nextSrc1 += 2; } unsigned int colorsLength = numColors * 6; if (serverCache_ -> queryColorsLastReply.compare(colorsLength, inputMessage + 32)) encodeBuffer.encodeBoolValue(1); else { const unsigned char *nextSrc2 = inputMessage + 32; encodeBuffer.encodeBoolValue(0); encodeBuffer.encodeValue(numColors, 16, 5); for (numColors *= 3; numColors; numColors--) { encodeBuffer.encodeValue(GetUINT(nextSrc2, bigEndian_), 16); nextSrc2 += 2; } } priority_++; } break; case X_QueryExtension: { if (requestData[0] == X_QueryExtension) { // // Value in requestData[0] will be nonzero // if the request is for an extension that // we should hide to the X client. // if (requestData[1]) { encodeBuffer.encodeBoolValue(0); encodeBuffer.encodeValue(0, 8); } else { encodeBuffer.encodeBoolValue((unsigned int) inputMessage[8]); encodeBuffer.encodeValue((unsigned int) inputMessage[9], 8); } encodeBuffer.encodeValue((unsigned int) inputMessage[10], 8); encodeBuffer.encodeValue((unsigned int) inputMessage[11], 8); if (requestData[2] == X_NXInternalShapeExtension) { opcodeStore_ -> shapeExtension = inputMessage[9]; #ifdef TEST *logofs << "handleRead: Shape extension opcode for FD#" << fd_ << " is " << (unsigned int) opcodeStore_ -> shapeExtension << ".\n" << logofs_flush; #endif } else if (requestData[2] == X_NXInternalRenderExtension) { opcodeStore_ -> renderExtension = inputMessage[9]; #ifdef TEST *logofs << "handleRead: Render extension opcode for FD#" << fd_ << " is " << (unsigned int) opcodeStore_ -> renderExtension << ".\n" << logofs_flush; #endif } priority_++; } else { #ifdef TEST *logofs << "handleRead: Received tainted X_QueryExtension reply " << "for request OPCODE#" << requestData[0] << " with " << "sequence " << sequenceNum << ".\n" << logofs_flush; #endif if (requestData[0] == opcodeStore_ -> getShmemParameters) { if (handleShmemReply(encodeBuffer, requestOpcode, requestData[1], inputMessage, inputLength) < 0) { return -1; } priority_++; } // // Account this data to the original opcode. // requestOpcode = requestData[0]; } } break; case X_QueryFont: { MessageStore *messageStore = serverStore_ -> getReplyStore(X_QueryFont); if (handleEncodeCached(encodeBuffer, serverCache_, messageStore, inputMessage, inputLength)) { priority_++; hit = 1; break; } // Differential encoding. encodeBuffer.encodeBoolValue(1); unsigned int numProperties = GetUINT(inputMessage + 46, bigEndian_); unsigned int numCharInfos = GetULONG(inputMessage + 56, bigEndian_); encodeBuffer.encodeValue(numProperties, 16, 8); encodeBuffer.encodeValue(numCharInfos, 32, 10); handleEncodeCharInfo(inputMessage + 8, encodeBuffer); handleEncodeCharInfo(inputMessage + 24, encodeBuffer); encodeBuffer.encodeValue(GetUINT(inputMessage + 40, bigEndian_), 16, 9); encodeBuffer.encodeValue(GetUINT(inputMessage + 42, bigEndian_), 16, 9); encodeBuffer.encodeValue(GetUINT(inputMessage + 44, bigEndian_), 16, 9); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[48]); encodeBuffer.encodeValue((unsigned int) inputMessage[49], 8); encodeBuffer.encodeValue((unsigned int) inputMessage[50], 8); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[51]); encodeBuffer.encodeValue(GetUINT(inputMessage + 52, bigEndian_), 16, 9); encodeBuffer.encodeValue(GetUINT(inputMessage + 54, bigEndian_), 16, 9); const unsigned char *nextSrc = inputMessage + 60; unsigned int index; int end = 0; if (ServerCache::queryFontFontCache.lookup(numProperties * 8 + numCharInfos * 12, nextSrc, index)) { encodeBuffer.encodeBoolValue(1); encodeBuffer.encodeValue(index, 4); end = 1; } if (end == 0) { encodeBuffer.encodeBoolValue(0); for (; numProperties; numProperties--) { encodeBuffer.encodeValue(GetULONG(nextSrc, bigEndian_), 32, 9); encodeBuffer.encodeValue(GetULONG(nextSrc + 4, bigEndian_), 32, 9); nextSrc += 8; } for (; numCharInfos; numCharInfos--) { handleEncodeCharInfo(nextSrc, encodeBuffer); nextSrc += 12; } } priority_++; } break; case X_QueryPointer: { encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> queryPointerRootCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 29, serverCache_ -> queryPointerChildCache, 9); unsigned int rootX = GetUINT(inputMessage + 16, bigEndian_); unsigned int rootY = GetUINT(inputMessage + 18, bigEndian_); unsigned int eventX = GetUINT(inputMessage + 20, bigEndian_); unsigned int eventY = GetUINT(inputMessage + 22, bigEndian_); eventX -= rootX; eventY -= rootY; encodeBuffer.encodeCachedValue( rootX - serverCache_ -> motionNotifyLastRootX, 16, serverCache_ -> motionNotifyRootXCache, 8); serverCache_ -> motionNotifyLastRootX = rootX; encodeBuffer.encodeCachedValue( rootY - serverCache_ -> motionNotifyLastRootY, 16, serverCache_ -> motionNotifyRootYCache, 8); serverCache_ -> motionNotifyLastRootY = rootY; encodeBuffer.encodeCachedValue(eventX, 16, serverCache_ -> motionNotifyEventXCache, 8); encodeBuffer.encodeCachedValue(eventY, 16, serverCache_ -> motionNotifyEventYCache, 8); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 24, bigEndian_), 16, serverCache_ -> motionNotifyStateCache); priority_++; } break; case X_QueryTree: { // // This was very inefficient. In practice // it just copied data on the output. Now // it obtains an average 7:1 compression // and could optionally be cached. // unsigned int children = GetUINT(inputMessage + 16, bigEndian_); encodeBuffer.encodeValue(children, 16, 8); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> queryTreeWindowCache); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 29, serverCache_ -> queryTreeWindowCache); const unsigned char *next = inputMessage + 32; for (unsigned int i = 0; i < children; i++) { encodeBuffer.encodeCachedValue(GetULONG(next + (i * 4), bigEndian_), 29, serverCache_ -> queryTreeWindowCache); } priority_++; } break; case X_TranslateCoords: { encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> translateCoordsChildCache, 9); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 12, bigEndian_), 16, serverCache_ -> translateCoordsXCache, 8); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 14, bigEndian_), 16, serverCache_ -> translateCoordsYCache, 8); priority_++; } break; case X_GetImage: { MessageStore *messageStore = serverStore_ -> getReplyStore(X_GetImage); if (handleEncodeCached(encodeBuffer, serverCache_, messageStore, inputMessage, inputLength)) { priority_++; hit = 1; break; } // Depth. encodeBuffer.encodeCachedValue(inputMessage[1], 8, serverCache_ -> depthCache); // Reply length. encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 9); // Visual. encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> visualCache); // Since ProtoStep8 (#issue 108) handleCopy(encodeBuffer, requestOpcode, messageStore -> dataOffset, inputMessage, inputLength); priority_++; } break; case X_GetPointerMapping: { encodeBuffer.encodeValue(inputMessage[1], 8, 4); encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 4); for (unsigned int i = 32; i < inputLength; i++) encodeBuffer.encodeValue((unsigned int) inputMessage[i], 8, 4); priority_++; } break; case X_GetKeyboardControl: { encodeBuffer.encodeValue(inputMessage[1], 8, 2); encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 8); for (unsigned int i = 8; i < inputLength; i++) encodeBuffer.encodeValue((unsigned int) inputMessage[i], 8, 4); priority_++; } break; default: { #ifdef PANIC *logofs << "ServerChannel: PANIC! No matching request with " << "OPCODE#" << (unsigned int) requestOpcode << " for reply with sequence number " << requestSequenceNum << ".\n" << logofs_flush; #endif cerr << "Error" << ": No matching request with OPCODE#" << (unsigned int) requestOpcode << " for reply with " << "sequence number " << requestSequenceNum << ".\n"; return -1; } } bits = encodeBuffer.diffBits(); #if defined(TEST) || defined(OPCODES) const char *cacheString = (hit ? "cached " : ""); *logofs << "handleRead: Handled " << cacheString << "reply to OPCODE#" << (unsigned int) requestOpcode << " (" << DumpOpcode(requestOpcode) << ") for FD#" << fd_ << " sequence " << serverSequence_ << ". " << inputLength << " bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; #endif } // End of if (sequenceQueue_.peek(requestSequenceNum, requestOpcode) && ... else { // // We didn't push the request opcode. // Check if fast encoding is required. // requestOpcode = X_Reply; if (control -> LocalDeltaCompression == 0) { int _result = handleFastReadReply(encodeBuffer, requestOpcode, inputMessage, inputLength); if (_result < 0) { return -1; } else if (_result > 0) { continue; } } // // Group all replies whose opcode was not // pushed in sequence number queue under // the category 'generic reply'. // #ifdef DEBUG *logofs << "handleRead: Identified generic reply.\n" << logofs_flush; #endif MessageStore *messageStore = serverStore_ -> getReplyStore(X_NXInternalGenericReply); hit = handleEncode(encodeBuffer, serverCache_, messageStore, requestOpcode, inputMessage, inputLength); priority_++; bits = encodeBuffer.diffBits(); #if defined(TEST) || defined(OPCODES) const char *cacheString = (hit ? "cached " : ""); *logofs << "handleRead: Handled " << cacheString << "generic reply " << "OPCODE#" << X_NXInternalGenericReply << " for FD#" << fd_ << " sequence " << serverSequence_ << ". " << inputLength << " bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; #endif } if (hit) { statistics -> addCachedReply(requestOpcode); } statistics -> addReplyBits(requestOpcode, inputLength << 3, bits); } // End of if (inputMessage[0] == 1) ... else { // // Event or error. // unsigned char inputOpcode = *inputMessage; unsigned int inputSequence = GetUINT(inputMessage + 2, bigEndian_); // // Check if this is an event which we can discard. // if ((inputOpcode == Expose && enableExpose_ == 0) || (inputOpcode == GraphicsExpose && enableGraphicsExpose_ == 0) || (inputOpcode == NoExpose && enableNoExpose_ == 0)) { continue; } else if (shmemState_ != NULL && shmemState_ -> enabled == 1 && inputOpcode == shmemState_ -> event && checkShmemEvent(inputOpcode, inputSequence, inputMessage) > 0) { continue; } else if (inputOpcode == MotionNotify) { // // Save the motion event and send when another // event or error is received or the motion ti- // meout is elapsed. If a previous motion event // was already saved, we replace it with the // new one and don't reset the timeout, so we // still have a motion event every given ms. // memcpy(lastMotion_, inputMessage, 32); #ifdef TEST *logofs << "handleRead: Saved suppressed motion event for FD#" << fd_ << ".\n" << logofs_flush; #endif continue; } else if (inputOpcode == X_Error) { // // Check if this is an error that matches a // sequence number for which we are expecting // a reply. // unsigned short int errorSequenceNum; unsigned char errorOpcode; if (sequenceQueue_.peek(errorSequenceNum, errorOpcode) && ((unsigned int) errorSequenceNum == inputSequence)) { sequenceQueue_.pop(errorSequenceNum, errorOpcode); } // // Check if error is due to an image commit // generated at the end of a split. // if (checkCommitError(*(inputMessage + 1), inputSequence, inputMessage) > 0) { #ifdef TEST *logofs << "handleRead: Skipping error on image commit for FD#" << fd_ << ".\n" << logofs_flush; #endif continue; } // // Check if it's an error generated by a request // concerning shared memory support. // else if (shmemState_ != NULL && (shmemState_ -> sequence == inputSequence || (shmemState_ -> enabled == 1 && (shmemState_ -> opcode == *(inputMessage + 10) || shmemState_ -> error == *(inputMessage + 1)))) && checkShmemError(*(inputMessage + 1), inputSequence, inputMessage) > 0) { #ifdef TEST *logofs << "handleRead: Skipping error on shmem operation for FD#" << fd_ << ".\n" << logofs_flush; #endif continue; } } // // Check if user pressed the CTRL+ALT+SHIFT+ESC key // sequence because was unable to kill the session // through the normal procedure. // if (inputOpcode == KeyPress) { if (checkKeyboardEvent(inputOpcode, inputSequence, inputMessage) == 1) { #ifdef TEST *logofs << "handleRead: Removing the key sequence from the " << "event stream for FD#" << fd_ << ".\n" << logofs_flush; #endif continue; } } // // We are going to handle an event or error // that's not a mouse motion. Prepend any // saved motion to it. // if (lastMotion_[0] != '\0') { if (handleMotion(encodeBuffer) < 0) { #ifdef PANIC *logofs << "handleRead: PANIC! Can't encode motion event for FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": Can't encode motion event for FD#" << fd_ << ".\n"; return -1; } } // // Encode opcode and difference between // current sequence and the last one. // encodeBuffer.encodeOpcodeValue(inputOpcode, serverCache_ -> opcodeCache); unsigned int sequenceDiff = inputSequence - serverSequence_; serverSequence_ = inputSequence; #ifdef DEBUG *logofs << "handleRead: Last server sequence number for FD#" << fd_ << " is " << serverSequence_ << " with " << "difference " << sequenceDiff << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(sequenceDiff, 16, serverCache_ -> eventSequenceCache, 7); // // If differential compression is disabled // then use the most simple encoding. // if (control -> LocalDeltaCompression == 0) { int _result = handleFastReadEvent(encodeBuffer, inputOpcode, inputMessage, inputLength); if (_result < 0) { return -1; } else if (_result > 0) { continue; } } switch (inputOpcode) { case X_Error: { // // Set the priority flag in the case of // a X protocol error. This may restart // the client if it was waiting for the // reply. // priority_++; unsigned char errorCode = *(inputMessage + 1); encodeBuffer.encodeCachedValue(errorCode, 8, serverCache_ -> errorCodeCache); if (errorCode != 11 && errorCode != 8 && errorCode != 15 && errorCode != 1) { encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 16); } if (errorCode >= 18) { encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, serverCache_ -> errorMinorCache); } encodeBuffer.encodeCachedValue(inputMessage[10], 8, serverCache_ -> errorMajorCache); if (errorCode >= 18) { const unsigned char *nextSrc = inputMessage + 11; for (unsigned int i = 11; i < 32; i++) encodeBuffer.encodeValue(*nextSrc++, 8); } } break; case ButtonPress: case ButtonRelease: case KeyPress: case KeyRelease: case MotionNotify: case EnterNotify: case LeaveNotify: { // // Set the priority in the case this is // an event that the remote side may // care to receive as soon as possible. // switch (inputOpcode) { case ButtonPress: case ButtonRelease: case KeyPress: case KeyRelease: { priority_++; } } unsigned char detail = inputMessage[1]; if (*inputMessage == MotionNotify) encodeBuffer.encodeBoolValue((unsigned int) detail); else if ((*inputMessage == EnterNotify) || (*inputMessage == LeaveNotify)) encodeBuffer.encodeValue((unsigned int) detail, 3); else if (*inputMessage == KeyRelease) { if (detail == serverCache_ -> keyPressLastKey) encodeBuffer.encodeBoolValue(1); else { encodeBuffer.encodeBoolValue(0); encodeBuffer.encodeValue((unsigned int) detail, 8); } } else if ((*inputMessage == ButtonPress) || (*inputMessage == ButtonRelease)) encodeBuffer.encodeCachedValue(detail, 8, serverCache_ -> buttonCache); else encodeBuffer.encodeValue((unsigned int) detail, 8); unsigned int _timestamp = GetULONG(inputMessage + 4, bigEndian_); unsigned int timestampDiff = _timestamp - serverCache_ -> lastTimestamp; serverCache_ -> lastTimestamp = _timestamp; encodeBuffer.encodeCachedValue(timestampDiff, 32, serverCache_ -> motionNotifyTimestampCache, 9); int skipRest = 0; if (*inputMessage == KeyRelease) { skipRest = 1; for (unsigned int i = 8; i < 31; i++) { if (inputMessage[i] != serverCache_ -> keyPressCache[i - 8]) { skipRest = 0; break; } } encodeBuffer.encodeBoolValue(skipRest); } if (!skipRest) { const unsigned char *nextSrc = inputMessage + 8; for (unsigned int i = 0; i < 3; i++) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 29, *serverCache_ -> motionNotifyWindowCache[i], 6); nextSrc += 4; } unsigned int rootX = GetUINT(inputMessage + 20, bigEndian_); unsigned int rootY = GetUINT(inputMessage + 22, bigEndian_); unsigned int eventX = GetUINT(inputMessage + 24, bigEndian_); unsigned int eventY = GetUINT(inputMessage + 26, bigEndian_); eventX -= rootX; eventY -= rootY; encodeBuffer.encodeCachedValue(rootX - serverCache_ -> motionNotifyLastRootX, 16, serverCache_ -> motionNotifyRootXCache, 6); serverCache_ -> motionNotifyLastRootX = rootX; encodeBuffer.encodeCachedValue(rootY - serverCache_ -> motionNotifyLastRootY, 16, serverCache_ -> motionNotifyRootYCache, 6); serverCache_ -> motionNotifyLastRootY = rootY; encodeBuffer.encodeCachedValue(eventX, 16, serverCache_ -> motionNotifyEventXCache, 6); encodeBuffer.encodeCachedValue(eventY, 16, serverCache_ -> motionNotifyEventYCache, 6); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 28, bigEndian_), 16, serverCache_ -> motionNotifyStateCache); if ((*inputMessage == EnterNotify) || (*inputMessage == LeaveNotify)) encodeBuffer.encodeValue((unsigned int) inputMessage[30], 2); else encodeBuffer.encodeBoolValue((unsigned int) inputMessage[30]); if ((*inputMessage == EnterNotify) || (*inputMessage == LeaveNotify)) encodeBuffer.encodeValue((unsigned int) inputMessage[31], 2); else if (*inputMessage == KeyPress) { serverCache_ -> keyPressLastKey = detail; for (unsigned int i = 8; i < 31; i++) { serverCache_ -> keyPressCache[i - 8] = inputMessage[i]; } } } } break; case ColormapNotify: { encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, serverCache_ -> colormapNotifyWindowCache, 8); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> colormapNotifyColormapCache, 8); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[12]); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[13]); } break; case ConfigureNotify: { const unsigned char *nextSrc = inputMessage + 4; for (unsigned int i = 0; i < 3; i++) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 29, *serverCache_ -> configureNotifyWindowCache[i], 9); nextSrc += 4; } for (unsigned int j = 0; j < 5; j++) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *serverCache_ -> configureNotifyGeomCache[j], 8); nextSrc += 2; } encodeBuffer.encodeBoolValue(*nextSrc); } break; case CreateNotify: { encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, serverCache_ -> createNotifyWindowCache, 9); unsigned int window = GetULONG(inputMessage + 8, bigEndian_); encodeBuffer.encodeValue(window - serverCache_ -> createNotifyLastWindow, 29, 5); serverCache_ -> createNotifyLastWindow = window; const unsigned char* nextSrc = inputMessage + 12; for (unsigned int i = 0; i < 5; i++) { encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16, 9); nextSrc += 2; } encodeBuffer.encodeBoolValue(*nextSrc); } break; case Expose: { encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, serverCache_ -> exposeWindowCache, 9); const unsigned char *nextSrc = inputMessage + 8; for (unsigned int i = 0; i < 5; i++) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *serverCache_ -> exposeGeomCache[i], 6); nextSrc += 2; } } break; case FocusIn: case FocusOut: { encodeBuffer.encodeValue((unsigned int) inputMessage[1], 3); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, serverCache_ -> focusInWindowCache, 9); encodeBuffer.encodeValue((unsigned int) inputMessage[8], 2); } break; case KeymapNotify: { if (ServerCache::lastKeymap.compare(31, inputMessage + 1)) encodeBuffer.encodeBoolValue(1); else { encodeBuffer.encodeBoolValue(0); const unsigned char *nextSrc = inputMessage + 1; for (unsigned int i = 1; i < 32; i++) encodeBuffer.encodeValue((unsigned int) *nextSrc++, 8); } } break; case MapNotify: case UnmapNotify: case DestroyNotify: { encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, serverCache_ -> mapNotifyEventCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> mapNotifyWindowCache, 9); if ((*inputMessage == MapNotify) || (*inputMessage == UnmapNotify)) encodeBuffer.encodeBoolValue((unsigned int) inputMessage[12]); } break; case NoExpose: { encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, serverCache_ -> noExposeDrawableCache, 9); encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, serverCache_ -> noExposeMinorCache); encodeBuffer.encodeCachedValue(inputMessage[10], 8, serverCache_ -> noExposeMajorCache); } break; case PropertyNotify: { encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, serverCache_ -> propertyNotifyWindowCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> propertyNotifyAtomCache, 9); unsigned int _timestamp = GetULONG(inputMessage + 12, bigEndian_); unsigned int timestampDiff = _timestamp - serverCache_ -> lastTimestamp; serverCache_ -> lastTimestamp = _timestamp; encodeBuffer.encodeValue(timestampDiff, 32, 9); encodeBuffer.encodeBoolValue((unsigned int) inputMessage[16]); } break; case ReparentNotify: { const unsigned char* nextSrc = inputMessage + 4; for (unsigned int i = 0; i < 3; i++) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 29, serverCache_ -> reparentNotifyWindowCache, 9); nextSrc += 4; } encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16, 6); encodeBuffer.encodeValue(GetUINT(nextSrc + 2, bigEndian_), 16, 6); encodeBuffer.encodeBoolValue((unsigned int)inputMessage[20]); } break; case SelectionClear: { unsigned int _timestamp = GetULONG(inputMessage + 4, bigEndian_); unsigned int timestampDiff = _timestamp - serverCache_ -> lastTimestamp; serverCache_ -> lastTimestamp = _timestamp; encodeBuffer.encodeValue(timestampDiff, 32, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> selectionClearWindowCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 29, serverCache_ -> selectionClearAtomCache, 9); } break; case SelectionRequest: { unsigned int _timestamp = GetULONG(inputMessage + 4, bigEndian_); unsigned int timestampDiff = _timestamp - serverCache_ -> lastTimestamp; serverCache_ -> lastTimestamp = _timestamp; encodeBuffer.encodeValue(timestampDiff, 32, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, serverCache_ -> selectionClearWindowCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 29, serverCache_ -> selectionClearWindowCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), 29, serverCache_ -> selectionClearAtomCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 20, bigEndian_), 29, serverCache_ -> selectionClearAtomCache, 9); encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 24, bigEndian_), 29, serverCache_ -> selectionClearAtomCache, 9); } break; case VisibilityNotify: { encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, serverCache_ -> visibilityNotifyWindowCache, 9); encodeBuffer.encodeValue((unsigned int) inputMessage[8], 2); } break; default: { #ifdef TEST *logofs << "handleRead: Using generic event compression " << "for OPCODE#" << (unsigned int) inputOpcode << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(*(inputMessage + 1), 8, serverCache_ -> genericEventCharCache); for (unsigned int i = 0; i < 14; i++) { encodeBuffer.encodeCachedValue(GetUINT(inputMessage + i * 2 + 4, bigEndian_), 16, *serverCache_ -> genericEventIntCache[i]); } } } // switch (inputOpcode)... int bits = encodeBuffer.diffBits(); #if defined(TEST) || defined(OPCODES) if (*inputMessage == X_Error) { unsigned char code = *(inputMessage + 1); *logofs << "handleRead: Handled error ERR_CODE#" << (unsigned int) code << " for FD#" << fd_; *logofs << " RES_ID#" << GetULONG(inputMessage + 4, bigEndian_); *logofs << " MIN_OP#" << GetUINT(inputMessage + 8, bigEndian_); *logofs << " MAJ_OP#" << (unsigned int) *(inputMessage + 10); *logofs << " sequence " << inputSequence << ". " << inputLength << " bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; } else { *logofs << "handleRead: Handled event OPCODE#" << (unsigned int) *inputMessage << " for FD#" << fd_ << " sequence " << inputSequence << ". " << inputLength << " bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; } #endif statistics -> addEventBits(*inputMessage, inputLength << 3, bits); } // End of if (inputMessage[0] == X_Reply) ... else ... } // End of if (firstReply_) ... else ... } // End of while ((inputMessage = readBuffer_.getMessage(inputLength)) != 0) ... // // Check if we need to flush because of // prioritized data. // if (priority_ > 0) { #if defined(TEST) || defined(INFO) *logofs << "handleRead: WARNING! Requesting flush " << "because of " << priority_ << " prioritized " << "messages for FD#" << fd_ << ".\n" << logofs_flush; #endif if (proxy -> handleAsyncPriority() < 0) { return -1; } // // Reset the priority flag. // priority_ = 0; } // // Flush if we produced enough data. // if (proxy -> canAsyncFlush() == 1) { #if defined(TEST) || defined(INFO) *logofs << "handleRead: WARNING! Requesting flush " << "because of token length exceeded.\n" << logofs_flush; #endif if (proxy -> handleAsyncFlush() < 0) { return -1; } } #if defined(TEST) || defined(INFO) if (transport_ -> pending() != 0 || readBuffer_.checkMessage() != 0) { *logofs << "handleRead: PANIC! Buffer for X descriptor FD#" << fd_ << " has " << transport_ -> pending() << " bytes to read.\n" << logofs_flush; HandleCleanup(); } #endif // // Reset the read buffer. // readBuffer_.fullReset(); return 1; } // // End of handleRead(). // // // Beginning of handleWrite(). // int ServerChannel::handleWrite(const unsigned char *message, unsigned int length) { #ifdef TEST *logofs << "handleWrite: Called for FD#" << fd_ << ".\n" << logofs_flush; #endif // // Create the buffer from which to // decode messages. // DecodeBuffer decodeBuffer(message, length); #if defined(TEST) || defined(INFO) || defined(FLUSH) *logofs << "handleWrite: Decoding messages for FD#" << fd_ << " with " << length << " bytes in the buffer.\n" << logofs_flush; #endif if (firstRequest_) { // // Need to add the length of the first request // because it was not present in the previous // versions. Length of the first request was // assumed to be the same as the encode buffer // but this may be not the case if a different // encoding is used. // // Since ProtoStep7 (#issue 108) decodeBuffer.decodeValue(length, 8); unsigned int nextByte; unsigned char *outputMessage = writeBuffer_.addMessage(length); unsigned char *nextDest = outputMessage; for (unsigned int i = 0; i < length; i++) { decodeBuffer.decodeValue(nextByte, 8); *nextDest++ = (unsigned char) nextByte; } if (*outputMessage == 0x42) { setBigEndian(1); } else { setBigEndian(0); } #ifdef TEST *logofs << "handleWrite: First request detected.\n" << logofs_flush; #endif // // Handle the fake authorization cookie. // if (handleAuthorization(outputMessage) < 0) { return -1; } firstRequest_ = 0; } // End of if (firstRequest_) // // This was previously in a 'else' block. // Due to the way the first request was // handled, we could not decode multiple // messages in the first frame. // { // Start of the decoding block. unsigned char outputOpcode; unsigned char *outputMessage; unsigned int outputLength; // // Set when message is found in cache. // int hit; while (decodeBuffer.decodeOpcodeValue(outputOpcode, clientCache_ -> opcodeCache, 1)) { hit = 0; // // Splits are sent by client proxy outside the // normal read loop. As we 'insert' splits in // the real client-server X protocol, we must // avoid to increment the sequence number or // our clients would get confused. // if (outputOpcode != opcodeStore_ -> splitData) { clientSequence_++; clientSequence_ &= 0xffff; #ifdef DEBUG *logofs << "handleWrite: Last client sequence number for FD#" << fd_ << " is " << clientSequence_ << ".\n" << logofs_flush; #endif } else { // // It's a split, not a normal // burst of proxy data. // handleSplit(decodeBuffer); continue; } #ifdef SUSPEND if (clientSequence_ == 1000) { cerr << "Warning" << ": Exiting to test the resilience of the agent.\n"; sleep(2); HandleAbort(); } #endif // // Is differential encoding disabled? // if (control -> RemoteDeltaCompression == 0) { int result = handleFastWriteRequest(decodeBuffer, outputOpcode, outputMessage, outputLength); if (result < 0) { return -1; } else if (result > 0) { continue; } } // // General-purpose temp variables for // decoding ints and chars. // unsigned int value; unsigned char cValue; #ifdef DEBUG *logofs << "handleWrite: Going to handle request OPCODE#" << (unsigned int) outputOpcode << " (" << DumpOpcode(outputOpcode) << ") for FD#" << fd_ << " sequence " << clientSequence_ << ".\n" << logofs_flush; #endif switch (outputOpcode) { case X_AllocColor: { outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> colormapCache); PutULONG(value, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 8; unsigned int colorData[3]; for (unsigned int i = 0; i < 3; i++) { decodeBuffer.decodeCachedValue(value, 16, *(clientCache_ -> allocColorRGBCache[i]), 4); PutUINT(value, nextDest, bigEndian_); colorData[i] = value; nextDest += 2; } sequenceQueue_.push(clientSequence_, outputOpcode, colorData[0], colorData[1], colorData[2]); } break; case X_ReparentWindow: { outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 16, 11); PutUINT(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeValue(value, 16, 11); PutUINT(value, outputMessage + 14, bigEndian_); } break; case X_ChangeProperty: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_ChangeProperty); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } unsigned char format; decodeBuffer.decodeCachedValue(format, 8, clientCache_ -> changePropertyFormatCache); unsigned int dataLength; decodeBuffer.decodeValue(dataLength, 32, 6); outputLength = 24 + RoundUp4(dataLength * (format >> 3)); outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 2); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> changePropertyPropertyCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> changePropertyTypeCache, 9); PutULONG(value, outputMessage + 12, bigEndian_); outputMessage[16] = format; PutULONG(dataLength, outputMessage + 20, bigEndian_); unsigned char *nextDest = outputMessage + 24; if (format == 8) { // Since ProtoStep7 (#issue 108) decodeBuffer.decodeTextData(nextDest, dataLength); } else if (format == 32) { for (unsigned int i = 0; i < dataLength; i++) { decodeBuffer.decodeCachedValue(value, 32, clientCache_ -> changePropertyData32Cache); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } } else { for (unsigned int i = 0; i < dataLength; i++) { decodeBuffer.decodeValue(value, 16); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } handleSave(messageStore, outputMessage, outputLength); } break; case X_SendEvent: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_SendEvent); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } outputLength = 44; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeBoolValue(value); *(outputMessage + 1) = value; decodeBuffer.decodeBoolValue(value); if (value) { decodeBuffer.decodeBoolValue(value); } else { decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); } PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 32, clientCache_ -> sendEventMaskCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(*(outputMessage + 12), 8, clientCache_ -> sendEventCodeCache); decodeBuffer.decodeCachedValue(*(outputMessage + 13), 8, clientCache_ -> sendEventByteDataCache); decodeBuffer.decodeValue(value, 16, 4); clientCache_ -> sendEventLastSequence += value; clientCache_ -> sendEventLastSequence &= 0xffff; PutUINT(clientCache_ -> sendEventLastSequence, outputMessage + 14, bigEndian_); decodeBuffer.decodeCachedValue(value, 32, clientCache_ -> sendEventIntDataCache); PutULONG(value, outputMessage + 16, bigEndian_); for (unsigned int i = 20; i < 44; i++) { decodeBuffer.decodeCachedValue(cValue, 8, clientCache_ -> sendEventEventCache); *(outputMessage + i) = cValue; } handleSave(messageStore, outputMessage, outputLength); } break; case X_ChangeWindowAttributes: { unsigned int numAttrs; decodeBuffer.decodeValue(numAttrs, 4); outputLength = 12 + (numAttrs << 2); outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); PutULONG(value, outputMessage + 4, bigEndian_); unsigned int bitmask; decodeBuffer.decodeCachedValue(bitmask, 15, clientCache_ -> createWindowBitmaskCache); PutULONG(bitmask, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; unsigned int mask = 0x1; for (unsigned int i = 0; i < 15; i++) { if (bitmask & mask) { decodeBuffer.decodeCachedValue(value, 32, *clientCache_ -> createWindowAttrCache[i]); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } mask <<= 1; } } break; case X_ClearArea: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_ClearArea); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeBoolValue(value); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); PutULONG(value, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 8; for (unsigned int i = 0; i < 4; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> clearAreaGeomCache[i], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } handleSave(messageStore, outputMessage, outputLength); } break; case X_CloseFont: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 29, 5); clientCache_ -> lastFont += value; clientCache_ -> lastFont &= 0x1fffffff; PutULONG(clientCache_ -> lastFont, outputMessage + 4, bigEndian_); } break; case X_ConfigureWindow: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_ConfigureWindow); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } outputLength = 12; outputMessage = writeBuffer_.addMessage(outputLength); writeBuffer_.registerPointer(&outputMessage); decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); PutULONG(value, outputMessage + 4, bigEndian_); unsigned int bitmask; decodeBuffer.decodeCachedValue(bitmask, 7, clientCache_ -> configureWindowBitmaskCache); PutUINT(bitmask, outputMessage + 8, bigEndian_); unsigned int mask = 0x1; for (unsigned int i = 0; i < 7; i++) { if (bitmask & mask) { unsigned char* nextDest = writeBuffer_.addMessage(4); outputLength += 4; decodeBuffer.decodeCachedValue(value, CONFIGUREWINDOW_FIELD_WIDTH[i], *clientCache_ -> configureWindowAttrCache[i], 8); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } mask <<= 1; } writeBuffer_.unregisterPointer(); handleSave(messageStore, outputMessage, outputLength); } break; case X_ConvertSelection: { outputLength = 24; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> convertSelectionRequestorCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); unsigned char* nextDest = outputMessage + 8; for (unsigned int i = 0; i < 3; i++) { decodeBuffer.decodeCachedValue(value, 29, *(clientCache_ -> convertSelectionAtomCache[i]), 9); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } decodeBuffer.decodeValue(value, 32, 4); clientCache_ -> convertSelectionLastTimestamp += value; PutULONG(clientCache_ -> convertSelectionLastTimestamp, nextDest, bigEndian_); } break; case X_CopyArea: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_CopyArea); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } outputLength = 28; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 12, bigEndian_); unsigned char *nextDest = outputMessage + 16; for (unsigned int i = 0; i < 6; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> copyAreaGeomCache[i], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } handleSave(messageStore, outputMessage, outputLength); } break; case X_CopyGC: { outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 23, clientCache_ -> createGCBitmaskCache); PutULONG(value, outputMessage + 12, bigEndian_); } break; case X_CopyPlane: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 12, bigEndian_); unsigned char *nextDest = outputMessage + 16; for (unsigned int i = 0; i < 6; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> copyPlaneGeomCache[i], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } decodeBuffer.decodeCachedValue(value, 32, clientCache_ -> copyPlaneBitPlaneCache, 10); PutULONG(value, outputMessage + 28, bigEndian_); } break; case X_CreateGC: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_CreateGC); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); writeBuffer_.registerPointer(&outputMessage); // Since ProtoStep7 (#issue 108) decodeBuffer.decodeNewXidValue(value, clientCache_ -> lastId, clientCache_ -> lastIdCache, clientCache_ -> gcCache, clientCache_ -> freeGCCache); PutULONG(value, outputMessage + 4, bigEndian_); unsigned int offset = 8; decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + offset, bigEndian_); offset += 4; unsigned int bitmask; decodeBuffer.decodeCachedValue(bitmask, 23, clientCache_ -> createGCBitmaskCache); PutULONG(bitmask, outputMessage + offset, bigEndian_); unsigned int mask = 0x1; for (unsigned int i = 0; i < 23; i++) { if (bitmask & mask) { unsigned char* nextDest = writeBuffer_.addMessage(4); outputLength += 4; unsigned int fieldWidth = CREATEGC_FIELD_WIDTH[i]; if (fieldWidth <= 4) decodeBuffer.decodeValue(value, fieldWidth); else decodeBuffer.decodeCachedValue(value, fieldWidth, *clientCache_ -> createGCAttrCache[i]); PutULONG(value, nextDest, bigEndian_); } mask <<= 1; } writeBuffer_.unregisterPointer(); handleSave(messageStore, outputMessage, outputLength); } break; case X_ChangeGC: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_ChangeGC); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } outputLength = 12; outputMessage = writeBuffer_.addMessage(outputLength); writeBuffer_.registerPointer(&outputMessage); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 4, bigEndian_); unsigned int offset = 8; unsigned int bitmask; decodeBuffer.decodeCachedValue(bitmask, 23, clientCache_ -> createGCBitmaskCache); PutULONG(bitmask, outputMessage + offset, bigEndian_); unsigned int mask = 0x1; for (unsigned int i = 0; i < 23; i++) { if (bitmask & mask) { unsigned char* nextDest = writeBuffer_.addMessage(4); outputLength += 4; unsigned int fieldWidth = CREATEGC_FIELD_WIDTH[i]; if (fieldWidth <= 4) decodeBuffer.decodeValue(value, fieldWidth); else decodeBuffer.decodeCachedValue(value, fieldWidth, *clientCache_ -> createGCAttrCache[i]); PutULONG(value, nextDest, bigEndian_); } mask <<= 1; } writeBuffer_.unregisterPointer(); handleSave(messageStore, outputMessage, outputLength); } break; case X_CreatePixmap: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_CreatePixmap); hit = handleDecode(decodeBuffer, clientCache_, messageStore, outputOpcode, outputMessage, outputLength); } break; case X_CreateWindow: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); writeBuffer_.registerPointer(&outputMessage); decodeBuffer.decodeCachedValue(cValue, 8, clientCache_ -> depthCache); outputMessage[1] = cValue; decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); PutULONG(value, outputMessage + 8, bigEndian_); // Since ProtoStep7 (#issue 108) decodeBuffer.decodeNewXidValue(value, clientCache_ -> lastId, clientCache_ -> lastIdCache, clientCache_ -> windowCache, clientCache_ -> freeWindowCache); PutULONG(value, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 12; unsigned int i; for (i = 0; i < 6; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> createWindowGeomCache[i], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> visualCache); PutULONG(value, outputMessage + 24, bigEndian_); unsigned int bitmask; decodeBuffer.decodeCachedValue(bitmask, 15, clientCache_ -> createWindowBitmaskCache); PutULONG(bitmask, outputMessage + 28, bigEndian_); unsigned int mask = 0x1; for (i = 0; i < 15; i++) { if (bitmask & mask) { nextDest = writeBuffer_.addMessage(4); outputLength += 4; decodeBuffer.decodeCachedValue(value, 32, *clientCache_ -> createWindowAttrCache[i]); PutULONG(value, nextDest, bigEndian_); } mask <<= 1; } writeBuffer_.unregisterPointer(); } break; case X_DeleteProperty: { outputLength = 12; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 29, 9); PutULONG(value, outputMessage + 8, bigEndian_); } break; case X_FillPoly: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_FillPoly); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } unsigned int numPoints; // Since ProtoStep10 (#issue 108) decodeBuffer.decodeCachedValue(numPoints, 16, clientCache_ -> fillPolyNumPointsCache, 4); outputLength = 16 + (numPoints << 2); outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 2); outputMessage[12] = (unsigned char) value; unsigned int relativeCoordMode; decodeBuffer.decodeBoolValue(relativeCoordMode); outputMessage[13] = (unsigned char) relativeCoordMode; unsigned char *nextDest = outputMessage + 16; unsigned int pointIndex = 0; for (unsigned int i = 0; i < numPoints; i++) { if (relativeCoordMode) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> fillPolyXRelCache[pointIndex], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> fillPolyYRelCache[pointIndex], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } else { unsigned int x, y; decodeBuffer.decodeBoolValue(value); if (value) { decodeBuffer.decodeValue(value, 3); x = clientCache_ -> fillPolyRecentX[value]; y = clientCache_ -> fillPolyRecentY[value]; } else { decodeBuffer.decodeCachedValue(x, 16, *clientCache_ -> fillPolyXAbsCache[pointIndex], 8); decodeBuffer.decodeCachedValue(y, 16, *clientCache_ -> fillPolyYAbsCache[pointIndex], 8); clientCache_ -> fillPolyRecentX[clientCache_ -> fillPolyIndex] = x; clientCache_ -> fillPolyRecentY[clientCache_ -> fillPolyIndex] = y; clientCache_ -> fillPolyIndex++; if (clientCache_ -> fillPolyIndex == 8) clientCache_ -> fillPolyIndex = 0; } PutUINT(x, nextDest, bigEndian_); nextDest += 2; PutUINT(y, nextDest, bigEndian_); nextDest += 2; } if (++pointIndex == 10) pointIndex = 0; } handleSave(messageStore, outputMessage, outputLength); } break; case X_FreeColors: { unsigned int numPixels; decodeBuffer.decodeValue(numPixels, 16, 4); outputLength = 12 + (numPixels << 2); outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> colormapCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 32, 4); PutULONG(value, outputMessage + 8, bigEndian_); unsigned char* nextDest = outputMessage + 12; while (numPixels) { decodeBuffer.decodeValue(value, 32, 8); PutULONG(value, nextDest, bigEndian_); nextDest += 4; numPixels--; } } break; case X_FreeCursor: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> cursorCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); } break; case X_FreeGC: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); // Since ProtoStep7 (#issue 108) decodeBuffer.decodeFreeXidValue(value, clientCache_ -> freeGCCache); PutULONG(value, outputMessage + 4, bigEndian_); } break; case X_FreePixmap: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); // Since ProtoStep7 (#issue 108) decodeBuffer.decodeFreeXidValue(value, clientCache_ -> freeDrawableCache); PutULONG(value, outputMessage + 4, bigEndian_); } break; case X_GetAtomName: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 29, 9); PutULONG(value, outputMessage + 4, bigEndian_); sequenceQueue_.push(clientSequence_, outputOpcode); } break; case X_GetGeometry: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); sequenceQueue_.push(clientSequence_, outputOpcode); } break; case X_GetInputFocus: { outputLength = 4; outputMessage = writeBuffer_.addMessage(outputLength); sequenceQueue_.push(clientSequence_, outputOpcode, outputOpcode); } break; case X_GetModifierMapping: { outputLength = 4; outputMessage = writeBuffer_.addMessage(outputLength); sequenceQueue_.push(clientSequence_, outputOpcode); } break; case X_GetKeyboardMapping: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 8); outputMessage[4] = value; decodeBuffer.decodeValue(value, 8); outputMessage[5] = value; sequenceQueue_.push(clientSequence_, outputOpcode); } break; case X_GetProperty: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_GetProperty); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { // // Save a reference to identify the reply. // unsigned int property = GetULONG(outputMessage + 8, bigEndian_); sequenceQueue_.push(clientSequence_, outputOpcode, property); break; } outputLength = 24; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeBoolValue(value); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); PutULONG(value, outputMessage + 4, bigEndian_); unsigned int property; decodeBuffer.decodeValue(property, 29, 9); PutULONG(property, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 29, 9); PutULONG(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeValue(value, 32, 2); PutULONG(value, outputMessage + 16, bigEndian_); decodeBuffer.decodeValue(value, 32, 8); PutULONG(value, outputMessage + 20, bigEndian_); sequenceQueue_.push(clientSequence_, outputOpcode, property); handleSave(messageStore, outputMessage, outputLength); } break; case X_GetSelectionOwner: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> getSelectionOwnerSelectionCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); sequenceQueue_.push(clientSequence_, outputOpcode); } break; case X_GrabButton: case X_GrabPointer: { outputLength = 24; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeBoolValue(value); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> grabButtonEventMaskCache); PutUINT(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeBoolValue(value); outputMessage[10] = (unsigned char) value; decodeBuffer.decodeBoolValue(value); outputMessage[11] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> grabButtonConfineCache, 9); PutULONG(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> cursorCache, 9); PutULONG(value, outputMessage + 16, bigEndian_); if (outputOpcode == X_GrabButton) { decodeBuffer.decodeCachedValue(cValue, 8, clientCache_ -> grabButtonButtonCache); outputMessage[20] = cValue; decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> grabButtonModifierCache); PutUINT(value, outputMessage + 22, bigEndian_); } else { decodeBuffer.decodeValue(value, 32, 4); clientCache_ -> grabKeyboardLastTimestamp += value; PutULONG(clientCache_ -> grabKeyboardLastTimestamp, outputMessage + 20, bigEndian_); sequenceQueue_.push(clientSequence_, outputOpcode); } } break; case X_GrabKeyboard: { outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeBoolValue(value); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 32, 4); clientCache_ -> grabKeyboardLastTimestamp += value; PutULONG(clientCache_ -> grabKeyboardLastTimestamp, outputMessage + 8, bigEndian_); decodeBuffer.decodeBoolValue(value); outputMessage[12] = (unsigned char) value; decodeBuffer.decodeBoolValue(value); outputMessage[13] = (unsigned char) value; sequenceQueue_.push(clientSequence_, outputOpcode); } break; case X_GrabServer: case X_UngrabServer: case X_NoOperation: { #ifdef DEBUG *logofs << "handleWrite: Managing (probably tainted) X_NoOperation request for FD#" << fd_ << ".\n" << logofs_flush; #endif outputLength = 4; outputMessage = writeBuffer_.addMessage(outputLength); } break; case X_PolyText8: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolyText8); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> polyTextCacheX); clientCache_ -> polyTextLastX += value; clientCache_ -> polyTextLastX &= 0xffff; PutUINT(clientCache_ -> polyTextLastX, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> polyTextCacheY); clientCache_ -> polyTextLastY += value; clientCache_ -> polyTextLastY &= 0xffff; PutUINT(clientCache_ -> polyTextLastY, outputMessage + 14, bigEndian_); unsigned int addedLength = 0; writeBuffer_.registerPointer(&outputMessage); for (;;) { decodeBuffer.decodeBoolValue(value); if (!value) break; unsigned int textLength; decodeBuffer.decodeValue(textLength, 8); if (textLength == 255) { addedLength += 5; unsigned char *nextSegment = writeBuffer_.addMessage(5); *nextSegment = (unsigned char) textLength; decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> polyTextFontCache); PutULONG(value, nextSegment + 1, 1); } else { addedLength += (textLength + 2); unsigned char *nextSegment = writeBuffer_.addMessage(textLength + 2); *nextSegment = (unsigned char) textLength; unsigned char *nextDest = nextSegment + 1; decodeBuffer.decodeCachedValue(cValue, 8, clientCache_ -> polyTextDeltaCache); *nextDest++ = cValue; // Since ProtoStep7 (#issue 108) decodeBuffer.decodeTextData(nextDest, textLength); nextDest += textLength; } } outputLength += addedLength; unsigned int mod4 = (addedLength & 0x3); if (mod4) { unsigned int extra = 4 - mod4; unsigned char *nextDest = writeBuffer_.addMessage(extra); for (unsigned int i = 0; i < extra; i++) *nextDest++ = 0; outputLength += extra; } writeBuffer_.unregisterPointer(); handleSave(messageStore, outputMessage, outputLength); } break; case X_PolyText16: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolyText16); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> polyTextCacheX); clientCache_ -> polyTextLastX += value; clientCache_ -> polyTextLastX &= 0xffff; PutUINT(clientCache_ -> polyTextLastX, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> polyTextCacheY); clientCache_ -> polyTextLastY += value; clientCache_ -> polyTextLastY &= 0xffff; PutUINT(clientCache_ -> polyTextLastY, outputMessage + 14, bigEndian_); unsigned int addedLength = 0; writeBuffer_.registerPointer(&outputMessage); for (;;) { decodeBuffer.decodeBoolValue(value); if (!value) break; unsigned int textLength; decodeBuffer.decodeValue(textLength, 8); if (textLength == 255) { addedLength += 5; unsigned char *nextSegment = writeBuffer_.addMessage(5); *nextSegment = (unsigned char) textLength; decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> polyTextFontCache); PutULONG(value, nextSegment + 1, 1); } else { addedLength += (textLength * 2 + 2); unsigned char *nextSegment = writeBuffer_.addMessage(textLength * 2 + 2); *nextSegment = (unsigned char) textLength; unsigned char *nextDest = nextSegment + 1; decodeBuffer.decodeCachedValue(cValue, 8, clientCache_ -> polyTextDeltaCache); *nextDest++ = cValue; // Since ProtoStep7 (#issue 108) decodeBuffer.decodeTextData(nextDest, textLength * 2); nextDest += textLength * 2; } } outputLength += addedLength; unsigned int mod4 = (addedLength & 0x3); if (mod4) { unsigned int extra = 4 - mod4; unsigned char *nextDest = writeBuffer_.addMessage(extra); for (unsigned int i = 0; i < extra; i++) *nextDest++ = 0; outputLength += extra; } writeBuffer_.unregisterPointer(); handleSave(messageStore, outputMessage, outputLength); } break; case X_ImageText8: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_ImageText8); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } unsigned int textLength; decodeBuffer.decodeCachedValue(textLength, 8, clientCache_ -> imageTextLengthCache, 4); outputLength = 16 + RoundUp4(textLength); outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = (unsigned char) textLength; decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> imageTextCacheX); clientCache_ -> imageTextLastX += value; clientCache_ -> imageTextLastX &= 0xffff; PutUINT(clientCache_ -> imageTextLastX, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> imageTextCacheY); clientCache_ -> imageTextLastY += value; clientCache_ -> imageTextLastY &= 0xffff; PutUINT(clientCache_ -> imageTextLastY, outputMessage + 14, bigEndian_); unsigned char *nextDest = outputMessage + 16; // Since ProtoStep7 (#issue 108) decodeBuffer.decodeTextData(nextDest, textLength); handleSave(messageStore, outputMessage, outputLength); } break; case X_ImageText16: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_ImageText16); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } unsigned int textLength; decodeBuffer.decodeCachedValue(textLength, 8, clientCache_ -> imageTextLengthCache, 4); outputLength = 16 + RoundUp4(textLength * 2); outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = (unsigned char) textLength; decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> imageTextCacheX); clientCache_ -> imageTextLastX += value; clientCache_ -> imageTextLastX &= 0xffff; PutUINT(clientCache_ -> imageTextLastX, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> imageTextCacheY); clientCache_ -> imageTextLastY += value; clientCache_ -> imageTextLastY &= 0xffff; PutUINT(clientCache_ -> imageTextLastY, outputMessage + 14, bigEndian_); unsigned char *nextDest = outputMessage + 16; // Since ProtoStep7 (#issue 108) decodeBuffer.decodeTextData(nextDest, textLength * 2); handleSave(messageStore, outputMessage, outputLength); } break; case X_InternAtom: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_InternAtom); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { sequenceQueue_.push(clientSequence_, outputOpcode); break; } unsigned int nameLength; decodeBuffer.decodeValue(nameLength, 16, 6); outputLength = RoundUp4(nameLength) + 8; outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(nameLength, outputMessage + 4, bigEndian_); decodeBuffer.decodeBoolValue(value); outputMessage[1] = (unsigned char) value; unsigned char *nextDest = outputMessage + 8; // Since ProtoStep7 (#issue 108) decodeBuffer.decodeTextData(nextDest, nameLength); sequenceQueue_.push(clientSequence_, outputOpcode); handleSave(messageStore, outputMessage, outputLength); } break; case X_ListExtensions: { outputLength = 4; outputMessage = writeBuffer_.addMessage(outputLength); sequenceQueue_.push(clientSequence_, outputOpcode); } break; case X_ListFonts: { unsigned int textLength; decodeBuffer.decodeValue(textLength, 16, 6); outputLength = 8 + RoundUp4(textLength); outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(textLength, outputMessage + 6, bigEndian_); decodeBuffer.decodeValue(value, 16, 6); PutUINT(value, outputMessage + 4, bigEndian_); unsigned char* nextDest = outputMessage + 8; // Since ProtoStep7 (#issue 108) decodeBuffer.decodeTextData(nextDest, textLength); sequenceQueue_.push(clientSequence_, outputOpcode); } break; case X_LookupColor: case X_AllocNamedColor: { unsigned int textLength; decodeBuffer.decodeValue(textLength, 16, 6); outputLength = 12 + RoundUp4(textLength); outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> colormapCache); PutULONG(value, outputMessage + 4, bigEndian_); PutUINT(textLength, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; // Since ProtoStep7 (#issue 108) decodeBuffer.decodeTextData(nextDest, textLength); sequenceQueue_.push(clientSequence_, outputOpcode); } break; case X_MapWindow: case X_UnmapWindow: case X_MapSubwindows: case X_GetWindowAttributes: case X_DestroyWindow: case X_DestroySubwindows: case X_QueryPointer: case X_QueryTree: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); if (outputOpcode == X_DestroyWindow) // Since ProtoStep7 (#issue 108) { decodeBuffer.decodeFreeXidValue(value, clientCache_ -> freeWindowCache); } else { decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); } PutULONG(value, outputMessage + 4, bigEndian_); if (outputOpcode == X_QueryPointer || outputOpcode == X_GetWindowAttributes || outputOpcode == X_QueryTree) { sequenceQueue_.push(clientSequence_, outputOpcode); } } break; case X_OpenFont: { unsigned int nameLength; decodeBuffer.decodeValue(nameLength, 16, 7); outputLength = RoundUp4(12 + nameLength); outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(nameLength, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 29, 5); clientCache_ -> lastFont += value; clientCache_ -> lastFont &= 0x1fffffff; PutULONG(clientCache_ -> lastFont, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 12; // Since ProtoStep7 (#issue 108) decodeBuffer.decodeTextData(nextDest, nameLength); } break; case X_PolyFillRectangle: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolyFillRectangle); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } outputLength = 12; outputMessage = writeBuffer_.addMessage(outputLength); writeBuffer_.registerPointer(&outputMessage); decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 8, bigEndian_); unsigned int index = 0; unsigned int lastX = 0, lastY = 0, lastWidth = 0, lastHeight = 0; unsigned int numRectangles = 0; for (;;) { outputLength += 8; writeBuffer_.addMessage(8); unsigned char *nextDest = outputMessage + 12 + (numRectangles << 3); numRectangles++; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyFillRectangleCacheX[index], 8); value += lastX; PutUINT(value, nextDest, bigEndian_); lastX = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyFillRectangleCacheY[index], 8); value += lastY; PutUINT(value, nextDest, bigEndian_); lastY = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyFillRectangleCacheWidth[index], 8); value += lastWidth; PutUINT(value, nextDest, bigEndian_); lastWidth = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyFillRectangleCacheHeight[index], 8); value += lastHeight; PutUINT(value, nextDest, bigEndian_); lastHeight = value; nextDest += 2; if (++index == 4) index = 0; decodeBuffer.decodeBoolValue(value); if (!value) break; } writeBuffer_.unregisterPointer(); handleSave(messageStore, outputMessage, outputLength); } break; case X_PolyFillArc: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolyFillArc); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } outputLength = 12; outputMessage = writeBuffer_.addMessage(outputLength); writeBuffer_.registerPointer(&outputMessage); decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 8, bigEndian_); unsigned int index = 0; unsigned int lastX = 0, lastY = 0, lastWidth = 0, lastHeight = 0, lastAngle1 = 0, lastAngle2 = 0; unsigned int numArcs = 0; for (;;) { outputLength += 12; writeBuffer_.addMessage(12); unsigned char *nextDest = outputMessage + 12 + (numArcs * 12); numArcs++; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyFillArcCacheX[index], 8); value += lastX; PutUINT(value, nextDest, bigEndian_); lastX = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyFillArcCacheY[index], 8); value += lastY; PutUINT(value, nextDest, bigEndian_); lastY = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyFillArcCacheWidth[index], 8); value += lastWidth; PutUINT(value, nextDest, bigEndian_); lastWidth = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyFillArcCacheHeight[index], 8); value += lastHeight; PutUINT(value, nextDest, bigEndian_); lastHeight = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyFillArcCacheAngle1[index], 8); value += lastAngle1; PutUINT(value, nextDest, bigEndian_); lastAngle1 = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyFillArcCacheAngle2[index], 8); value += lastAngle2; PutUINT(value, nextDest, bigEndian_); lastAngle2 = value; nextDest += 2; if (++index == 2) index = 0; decodeBuffer.decodeBoolValue(value); if (!value) break; } writeBuffer_.unregisterPointer(); handleSave(messageStore, outputMessage, outputLength); } break; case X_PolyArc: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolyArc); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } outputLength = 12; outputMessage = writeBuffer_.addMessage(outputLength); writeBuffer_.registerPointer(&outputMessage); decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 8, bigEndian_); unsigned int index = 0; unsigned int lastX = 0, lastY = 0, lastWidth = 0, lastHeight = 0, lastAngle1 = 0, lastAngle2 = 0; unsigned int numArcs = 0; for (;;) { outputLength += 12; writeBuffer_.addMessage(12); unsigned char *nextDest = outputMessage + 12 + (numArcs * 12); numArcs++; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyArcCacheX[index], 8); value += lastX; PutUINT(value, nextDest, bigEndian_); lastX = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyArcCacheY[index], 8); value += lastY; PutUINT(value, nextDest, bigEndian_); lastY = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyArcCacheWidth[index], 8); value += lastWidth; PutUINT(value, nextDest, bigEndian_); lastWidth = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyArcCacheHeight[index], 8); value += lastHeight; PutUINT(value, nextDest, bigEndian_); lastHeight = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyArcCacheAngle1[index], 8); value += lastAngle1; PutUINT(value, nextDest, bigEndian_); lastAngle1 = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyArcCacheAngle2[index], 8); value += lastAngle2; PutUINT(value, nextDest, bigEndian_); lastAngle2 = value; nextDest += 2; if (++index == 2) index = 0; decodeBuffer.decodeBoolValue(value); if (!value) break; } writeBuffer_.unregisterPointer(); handleSave(messageStore, outputMessage, outputLength); } break; case X_PolyPoint: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolyPoint); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } unsigned int numPoints; decodeBuffer.decodeValue(numPoints, 16, 4); outputLength = (numPoints << 2) + 12; outputMessage = writeBuffer_.addMessage(outputLength); unsigned int relativeCoordMode; decodeBuffer.decodeBoolValue(relativeCoordMode); outputMessage[1] = (unsigned char) relativeCoordMode; decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; unsigned int index = 0; unsigned int lastX = 0, lastY = 0; for (unsigned int i = 0; i < numPoints; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyPointCacheX[index], 8); lastX += value; PutUINT(lastX, nextDest, bigEndian_); nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyPointCacheY[index], 8); lastY += value; PutUINT(lastY, nextDest, bigEndian_); nextDest += 2; if (++index == 2) index = 0; } handleSave(messageStore, outputMessage, outputLength); } break; case X_PolyLine: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolyLine); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } unsigned int numPoints; decodeBuffer.decodeValue(numPoints, 16, 4); outputLength = (numPoints << 2) + 12; outputMessage = writeBuffer_.addMessage(outputLength); unsigned int relativeCoordMode; decodeBuffer.decodeBoolValue(relativeCoordMode); outputMessage[1] = (unsigned char) relativeCoordMode; decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; unsigned int index = 0; unsigned int lastX = 0, lastY = 0; for (unsigned int i = 0; i < numPoints; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyLineCacheX[index], 8); lastX += value; PutUINT(lastX, nextDest, bigEndian_); nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyLineCacheY[index], 8); lastY += value; PutUINT(lastY, nextDest, bigEndian_); nextDest += 2; if (++index == 2) index = 0; } handleSave(messageStore, outputMessage, outputLength); } break; case X_PolyRectangle: { unsigned int numRectangles; decodeBuffer.decodeValue(numRectangles, 16, 3); outputLength = (numRectangles << 3) + 12; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; for (unsigned int i = 0; i < numRectangles; i++) for (unsigned int k = 0; k < 4; k++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> polyRectangleGeomCache[k], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } break; case X_PolySegment: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_PolySegment); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } unsigned int numSegments; decodeBuffer.decodeValue(numSegments, 16, 4); outputLength = (numSegments << 3) + 12; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; for (numSegments *= 2; numSegments; numSegments--) { unsigned int index; decodeBuffer.decodeBoolValue(index); unsigned int x; decodeBuffer.decodeCachedValue(x, 16, clientCache_ -> polySegmentCacheX, 6); x += clientCache_ -> polySegmentLastX[index]; PutUINT(x, nextDest, bigEndian_); nextDest += 2; unsigned int y; decodeBuffer.decodeCachedValue(y, 16, clientCache_ -> polySegmentCacheY, 6); y += clientCache_ -> polySegmentLastY[index]; PutUINT(y, nextDest, bigEndian_); nextDest += 2; clientCache_ -> polySegmentLastX[clientCache_ -> polySegmentCacheIndex] = x; clientCache_ -> polySegmentLastY[clientCache_ -> polySegmentCacheIndex] = y; if (clientCache_ -> polySegmentCacheIndex == 1) clientCache_ -> polySegmentCacheIndex = 0; else clientCache_ -> polySegmentCacheIndex = 1; } handleSave(messageStore, outputMessage, outputLength); } break; case X_PutImage: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_PutImage); hit = handleDecode(decodeBuffer, clientCache_, messageStore, outputOpcode, outputMessage, outputLength); if (outputOpcode == X_PutImage) { handleImage(outputOpcode, outputMessage, outputLength); } } break; case X_QueryBestSize: { outputLength = 12; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 2); outputMessage[1] = (unsigned char)value; decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 16, 8); PutUINT(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 16, 8); PutUINT(value, outputMessage + 10, bigEndian_); sequenceQueue_.push(clientSequence_, outputOpcode); } break; case X_QueryColors: { // Differential or plain data compression? decodeBuffer.decodeBoolValue(value); if (value) { unsigned int numColors; decodeBuffer.decodeValue(numColors, 16, 5); outputLength = (numColors << 2) + 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> colormapCache); PutULONG(value, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 8; unsigned int predictedPixel = clientCache_ -> queryColorsLastPixel; for (unsigned int i = 0; i < numColors; i++) { unsigned int pixel; decodeBuffer.decodeBoolValue(value); if (value) pixel = predictedPixel; else decodeBuffer.decodeValue(pixel, 32, 9); PutULONG(pixel, nextDest, bigEndian_); if (i == 0) clientCache_ -> queryColorsLastPixel = pixel; predictedPixel = pixel + 1; nextDest += 4; } } else { // Request length. unsigned int requestLength; decodeBuffer.decodeValue(requestLength, 16, 10); outputLength = (requestLength << 2); outputMessage = writeBuffer_.addMessage(outputLength); const unsigned char *compressedData = NULL; unsigned int compressedDataSize = 0; int decompressed = handleDecompress(decodeBuffer, outputOpcode, 4, outputMessage, outputLength, compressedData, compressedDataSize); if (decompressed < 0) { return -1; } } sequenceQueue_.push(clientSequence_, outputOpcode); } break; case X_QueryExtension: { unsigned int nameLength; decodeBuffer.decodeValue(nameLength, 16, 6); outputLength = 8 + RoundUp4(nameLength); outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(nameLength, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 8; for (unsigned int i = 0; i < nameLength; i++) { decodeBuffer.decodeValue(value, 8); *nextDest++ = (unsigned char) value; } unsigned int hide = 0; #ifdef HIDE_MIT_SHM_EXTENSION if (!strncmp((char *) outputMessage + 8, "MIT-SHM", 7)) { #ifdef TEST *logofs << "handleWrite: Going to hide MIT-SHM extension in reply.\n" << logofs_flush; #endif hide = 1; } #endif #ifdef HIDE_BIG_REQUESTS_EXTENSION if (!strncmp((char *) outputMessage + 8, "BIG-REQUESTS", 12)) { #ifdef TEST *logofs << "handleWrite: Going to hide BIG-REQUESTS extension in reply.\n" << logofs_flush; #endif hide = 1; } #endif #ifdef HIDE_XKEYBOARD_EXTENSION else if (!strncmp((char *) outputMessage + 8, "XKEYBOARD", 9)) { #ifdef TEST *logofs << "handleWrite: Going to hide XKEYBOARD extension in reply.\n" << logofs_flush; #endif hide = 1; } #endif #ifdef HIDE_XFree86_Bigfont_EXTENSION else if (!strncmp((char *) outputMessage + 8, "XFree86-Bigfont", 15)) { #ifdef TEST *logofs << "handleWrite: Going to hide XFree86-Bigfont extension in reply.\n" << logofs_flush; #endif hide = 1; } #endif // // This is if you want to experiment disabling SHAPE extensions. // #ifdef HIDE_SHAPE_EXTENSION if (!strncmp((char *) outputMessage + 8, "SHAPE", 5)) { #ifdef DEBUG *logofs << "handleWrite: Going to hide SHAPE extension in reply.\n" << logofs_flush; #endif hide = 1; } #endif // // Check if user disabled RENDER extension. // if (control -> HideRender == 1 && strncmp((char *) outputMessage + 8, "RENDER", 6) == 0) { #ifdef TEST *logofs << "handleWrite: Going to hide RENDER extension in reply.\n" << logofs_flush; #endif hide = 1; } unsigned int extension = 0; if (strncmp((char *) outputMessage + 8, "SHAPE", 5) == 0) { extension = X_NXInternalShapeExtension; } else if (strncmp((char *) outputMessage + 8, "RENDER", 6) == 0) { extension = X_NXInternalRenderExtension; } sequenceQueue_.push(clientSequence_, outputOpcode, outputOpcode, hide, extension); } break; case X_QueryFont: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 29, 5); clientCache_ -> lastFont += value; clientCache_ -> lastFont &= 0x1fffffff; PutULONG(clientCache_ -> lastFont, outputMessage + 4, bigEndian_); sequenceQueue_.push(clientSequence_, outputOpcode); } break; case X_SetClipRectangles: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_SetClipRectangles); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { break; } unsigned int numRectangles; // Since ProtoStep9 (#issue 108) decodeBuffer.decodeValue(numRectangles, 15, 4); outputLength = (numRectangles << 3) + 12; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 2); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> setClipRectanglesXCache, 8); PutUINT(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> setClipRectanglesYCache, 8); PutUINT(value, outputMessage + 10, bigEndian_); unsigned char *nextDest = outputMessage + 12; for (unsigned int i = 0; i < numRectangles; i++) { for (unsigned int k = 0; k < 4; k++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_ -> setClipRectanglesGeomCache[k], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } handleSave(messageStore, outputMessage, outputLength); } break; case X_SetDashes: { unsigned int numDashes; decodeBuffer.decodeCachedValue(numDashes, 16, clientCache_ -> setDashesLengthCache, 5); outputLength = 12 + RoundUp4(numDashes); outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(numDashes, outputMessage + 10, bigEndian_); decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> setDashesOffsetCache, 5); PutUINT(value, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; for (unsigned int i = 0; i < numDashes; i++) { decodeBuffer.decodeCachedValue(cValue, 8, clientCache_ -> setDashesDashCache_[i & 1], 5); *nextDest++ = cValue; } } break; case X_SetSelectionOwner: { outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> setSelectionOwnerCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> getSelectionOwnerSelectionCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 32, clientCache_ -> setSelectionOwnerTimestampCache, 9); PutULONG(value, outputMessage + 12, bigEndian_); } break; case X_TranslateCoords: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_TranslateCoords); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { sequenceQueue_.push(clientSequence_, outputOpcode); break; } outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> translateCoordsSrcCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> translateCoordsDstCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> translateCoordsXCache, 8); PutUINT(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> translateCoordsYCache, 8); PutUINT(value, outputMessage + 14, bigEndian_); sequenceQueue_.push(clientSequence_, outputOpcode); handleSave(messageStore, outputMessage, outputLength); } break; case X_GetImage: { MessageStore *messageStore = clientStore_ -> getRequestStore(X_GetImage); if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, outputMessage, outputLength)) { sequenceQueue_.push(clientSequence_, outputOpcode); break; } outputLength = 20; outputMessage = writeBuffer_.addMessage(outputLength); // Format. unsigned int format; decodeBuffer.decodeValue(format, 2); outputMessage[1] = (unsigned char) format; // Drawable. decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); PutULONG(value, outputMessage + 4, bigEndian_); // X. decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> putImageXCache, 8); clientCache_ -> putImageLastX += value; clientCache_ -> putImageLastX &= 0xffff; PutUINT(clientCache_ -> putImageLastX, outputMessage + 8, bigEndian_); // Y. decodeBuffer.decodeCachedValue(value, 16, clientCache_ -> putImageYCache, 8); clientCache_ -> putImageLastY += value; clientCache_ -> putImageLastY &= 0xffff; PutUINT(clientCache_ -> putImageLastY, outputMessage + 10, bigEndian_); // Width. unsigned int width; decodeBuffer.decodeCachedValue(width, 16, clientCache_ -> putImageWidthCache, 8); PutUINT(width, outputMessage + 12, bigEndian_); // Height. unsigned int height; decodeBuffer.decodeCachedValue(height, 16, clientCache_ -> putImageHeightCache, 8); PutUINT(height, outputMessage + 14, bigEndian_); // Plane mask. decodeBuffer.decodeCachedValue(value, 32, clientCache_ -> getImagePlaneMaskCache, 5); PutULONG(value, outputMessage + 16, bigEndian_); sequenceQueue_.push(clientSequence_, outputOpcode); handleSave(messageStore, outputMessage, outputLength); } break; case X_GetPointerMapping: { outputLength = 4; outputMessage = writeBuffer_.addMessage(outputLength); sequenceQueue_.push(clientSequence_, outputOpcode); } break; case X_GetKeyboardControl: { outputLength = 4; outputMessage = writeBuffer_.addMessage(outputLength); sequenceQueue_.push(clientSequence_, outputOpcode); } break; default: { if (outputOpcode == opcodeStore_ -> renderExtension) { MessageStore *messageStore = clientStore_ -> getRequestStore(X_NXInternalRenderExtension); hit = handleDecode(decodeBuffer, clientCache_, messageStore, outputOpcode, outputMessage, outputLength); } else if (outputOpcode == opcodeStore_ -> shapeExtension) { MessageStore *messageStore = clientStore_ -> getRequestStore(X_NXInternalShapeExtension); hit = handleDecode(decodeBuffer, clientCache_, messageStore, outputOpcode, outputMessage, outputLength); } else if (outputOpcode == opcodeStore_ -> putPackedImage) { #ifdef DEBUG *logofs << "handleWrite: Decoding packed image request for FD#" << fd_ << ".\n" << logofs_flush; #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_NXPutPackedImage); hit = handleDecode(decodeBuffer, clientCache_, messageStore, outputOpcode, outputMessage, outputLength); if (outputOpcode == opcodeStore_ -> putPackedImage) { handleImage(outputOpcode, outputMessage, outputLength); } } else if (outputOpcode == opcodeStore_ -> setUnpackColormap) { #ifdef DEBUG *logofs << "handleWrite: Decoding set unpack colormap request " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_NXSetUnpackColormap); hit = handleDecode(decodeBuffer, clientCache_, messageStore, outputOpcode, outputMessage, outputLength); // // Message could have been split. // if (outputOpcode == opcodeStore_ -> setUnpackColormap) { handleColormap(outputOpcode, outputMessage, outputLength); } } else if (outputOpcode == opcodeStore_ -> setUnpackAlpha) { #ifdef DEBUG *logofs << "handleWrite: Decoding unpack alpha request for FD#" << fd_ << ".\n" << logofs_flush; #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_NXSetUnpackAlpha); hit = handleDecode(decodeBuffer, clientCache_, messageStore, outputOpcode, outputMessage, outputLength); // // Message could have been split. // if (outputOpcode == opcodeStore_ -> setUnpackAlpha) { handleAlpha(outputOpcode, outputMessage, outputLength); } } else if (outputOpcode == opcodeStore_ -> setUnpackGeometry) { #ifdef DEBUG *logofs << "handleWrite: Decoding set unpack geometry request " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif MessageStore *messageStore = clientStore_ -> getRequestStore(X_NXSetUnpackGeometry); hit = handleDecode(decodeBuffer, clientCache_, messageStore, outputOpcode, outputMessage, outputLength); handleGeometry(outputOpcode, outputMessage, outputLength); } else if (outputOpcode == opcodeStore_ -> startSplit) { handleStartSplitRequest(decodeBuffer, outputOpcode, outputMessage, outputLength); } else if (outputOpcode == opcodeStore_ -> endSplit) { handleEndSplitRequest(decodeBuffer, outputOpcode, outputMessage, outputLength); } else if (outputOpcode == opcodeStore_ -> commitSplit) { int result = handleCommitSplitRequest(decodeBuffer, outputOpcode, outputMessage, outputLength); // // Check if message has been successfully // extracted from the split store. In this // case post-process it in the usual way. // if (result > 0) { if (outputOpcode == opcodeStore_ -> putPackedImage || outputOpcode == X_PutImage) { handleImage(outputOpcode, outputMessage, outputLength); } else if (outputOpcode == opcodeStore_ -> setUnpackColormap) { handleColormap(outputOpcode, outputMessage, outputLength); } else if (outputOpcode == opcodeStore_ -> setUnpackAlpha) { handleAlpha(outputOpcode, outputMessage, outputLength); } } else if (result < 0) { return -1; } } else if (outputOpcode == opcodeStore_ -> abortSplit) { handleAbortSplitRequest(decodeBuffer, outputOpcode, outputMessage, outputLength); } else if (outputOpcode == opcodeStore_ -> finishSplit) { #ifdef DEBUG *logofs << "handleWrite: Decoding finish split request " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(cValue, 8, clientCache_ -> resourceCache); handleNullRequest(outputOpcode, outputMessage, outputLength); } else if (outputOpcode == opcodeStore_ -> freeSplit) { #ifdef DEBUG *logofs << "handleWrite: Decoding free split request " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(cValue, 8, clientCache_ -> resourceCache); handleNullRequest(outputOpcode, outputMessage, outputLength); } else if (outputOpcode == opcodeStore_ -> freeUnpack) { #ifdef DEBUG *logofs << "handleWrite: Decoding free unpack request " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif decodeBuffer.decodeCachedValue(cValue, 8, clientCache_ -> resourceCache); #ifdef DEBUG *logofs << "handleWrite: Freeing unpack state for resource " << (unsigned int) cValue << ".\n" << logofs_flush; #endif handleUnpackStateRemove(cValue); handleNullRequest(outputOpcode, outputMessage, outputLength); } else if (outputOpcode == opcodeStore_ -> setExposeParameters) { // // Send expose events according to agent's wish. // decodeBuffer.decodeBoolValue(enableExpose_); decodeBuffer.decodeBoolValue(enableGraphicsExpose_); decodeBuffer.decodeBoolValue(enableNoExpose_); handleNullRequest(outputOpcode, outputMessage, outputLength); } else if (outputOpcode == opcodeStore_ -> getUnpackParameters) { // // Client proxy needs the list of supported // unpack methods. We would need an encode // buffer, but this is in proxy, not here in // channel. // #ifdef TEST *logofs << "handleWrite: Sending X_GetInputFocus request for FD#" << fd_ << " due to OPCODE#" << (unsigned int) outputOpcode << ".\n" << logofs_flush; #endif outputOpcode = X_GetInputFocus; outputLength = 4; outputMessage = writeBuffer_.addMessage(outputLength); sequenceQueue_.push(clientSequence_, outputOpcode, opcodeStore_ -> getUnpackParameters); } else if (outputOpcode == opcodeStore_ -> getControlParameters || outputOpcode == opcodeStore_ -> getCleanupParameters || outputOpcode == opcodeStore_ -> getImageParameters) { handleNullRequest(outputOpcode, outputMessage, outputLength); } else if (outputOpcode == opcodeStore_ -> getShmemParameters) { if (handleShmemRequest(decodeBuffer, outputOpcode, outputMessage, outputLength) < 0) { return -1; } } else if (outputOpcode == opcodeStore_ -> setCacheParameters) { if (handleCacheRequest(decodeBuffer, outputOpcode, outputMessage, outputLength) < 0) { return -1; } } else if (outputOpcode == opcodeStore_ -> getFontParameters) { if (handleFontRequest(decodeBuffer, outputOpcode, outputMessage, outputLength) < 0) { return -1; } } else { MessageStore *messageStore = clientStore_ -> getRequestStore(X_NXInternalGenericRequest); hit = handleDecode(decodeBuffer, clientCache_, messageStore, outputOpcode, outputMessage, outputLength); } } } // End of switch on opcode. // // TODO: at the moment the variable hit was being set // but not used, so to avoid the corresponding warning // this logging block has been added. // This code will probably be optimized away when none // of the defines is set, but if there is no additional // use for the hit variable in the future, then maybe // it could be removed completely. // if (hit) { #if defined(TEST) || defined(OPCODES) *logofs << "handleWrite: Cached flag enabled in handled request.\n" << logofs_flush; #endif } // // A packed image request can generate more than just // a single X_PutImage. Write buffer is handled inside // handleUnpack(). Cannot simply assume that the final // opcode and size must be put at the buffer offset as // as buffer could have been grown or could have been // replaced by a scratch buffer. The same is true in // the case of a shared memory image. // if (outputOpcode != 0) { // // Commit opcode and size to the buffer. // *outputMessage = (unsigned char) outputOpcode; PutUINT(outputLength >> 2, outputMessage + 2, bigEndian_); #if defined(TEST) || defined(OPCODES) *logofs << "handleWrite: Handled request OPCODE#" << (unsigned int) outputOpcode << " (" << DumpOpcode(outputOpcode) << ") for FD#" << fd_ << " sequence " << clientSequence_ << ". " << outputLength << " bytes out.\n" << logofs_flush; #endif } #if defined(TEST) || defined(OPCODES) else { // // In case of shared memory images the log doesn't // reflect the actual opcode of the request that is // going to be written. It would be possible to find // the opcode of the original request received from // the remote proxy in member imageState_ -> opcode, // but we have probably already deleted the struct. // *logofs << "handleWrite: Handled image request for FD#" << fd_ << " new sequence " << clientSequence_ << ". " << outputLength << " bytes out.\n" << logofs_flush; } #endif // // Check if we produced enough data. We need to // decode all the proxy messages or the decode // buffer will be left in an inconsistent state, // so we just update the finish flag in case of // failure. // handleFlush(flush_if_needed); } // End of while (decodeBuffer.decodeOpcodeValue(outputOpcode, 8, ... } // End of the decoding block. // // Write any remaining data to the X connection. // if (handleFlush(flush_if_any) < 0) { return -1; } // // Reset offset at which we read the // last event looking for the shared // memory completion. // if (shmemState_ != NULL) { shmemState_ -> checked = 0; } return 1; } // // End of handleWrite(). // // // Other members. // int ServerChannel::handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, T_store_action action, int position, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { // Since ProtoStep7 (#issue 108) splitState_.current = splitState_.resource; handleSplitStoreAlloc(&splitResources_, splitState_.current); #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Message OPCODE#" << (unsigned int) store -> opcode() << " of size " << size << " [split] with resource " << splitState_.current << " position " << position << " and action [" << DumpAction(action) << "] at " << strMsTimestamp() << ".\n" << logofs_flush; #endif // // Get the MD5 of the message being // split. // T_checksum checksum = NULL; if (action != IS_HIT) { handleSplitChecksum(decodeBuffer, checksum); } // // The method must abort the connection // if it can't allocate the split. // Split *splitMessage = clientStore_ -> getSplitStore(splitState_.current) -> add(store, splitState_.current, position, action, checksum, buffer, size); // // If the encoding side didn't provide // a checksum, then don't send the split // report. // if (checksum == NULL) { if (action == IS_HIT) { splitMessage -> setState(split_loaded); } else { splitMessage -> setState(split_missed); } #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! There are " << clientStore_ -> getSplitTotalSize() << " messages and " << clientStore_ -> getSplitTotalStorageSize() << " bytes to send in " << "the split stores.\n" << logofs_flush; clientStore_ -> dumpSplitStore(splitState_.current); #endif return 1; } delete [] checksum; // // Tell the split store if it must use // the disk cache to retrieve and save // the message. // splitMessage -> setPolicy(splitState_.load, splitState_.save); // // Try to locate the message on disk. // if (clientStore_ -> getSplitStore(splitState_.current) -> load(splitMessage) == 1) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Loaded the message " << "from the image cache.\n" << logofs_flush; #endif splitMessage -> setState(split_loaded); } else { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: WARNING! SPLIT! Can't find the message " << "in the image cache.\n" << logofs_flush; #endif splitMessage -> setState(split_missed); } #if defined(TEST) || defined(SPLIT) T_timestamp startTs = getTimestamp(); *logofs << "handleSplit: SPLIT! Encoding abort " << "split events for FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif if (proxy -> handleAsyncSplit(fd_, splitMessage) < 0) { return -1; } // // Send the encoded data immediately. We // want the abort split message to reach // the remote proxy as soon as possible. // if (proxy -> handleAsyncFlush() < 0) { return -1; } #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Spent " << diffTimestamp(startTs, getTimestamp()) << " ms " << "handling abort split events for FD#" << fd_ << ".\n" << logofs_flush; *logofs << "handleSplit: SPLIT! There are " << clientStore_ -> getSplitTotalSize() << " messages and " << clientStore_ -> getSplitTotalStorageSize() << " bytes to send in " << "the split stores.\n" << logofs_flush; clientStore_ -> dumpSplitStore(splitState_.current); #endif return 1; } int ServerChannel::handleSplit(DecodeBuffer &decodeBuffer) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Going to handle splits " << "for FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif unsigned char resource; // Since ProtoStep7 (#issue 108) decodeBuffer.decodeCachedValue(resource, 8, clientCache_ -> resourceCache); splitState_.current = resource; handleSplitStoreAlloc(&splitResources_, splitState_.current); SplitStore *splitStore = clientStore_ -> getSplitStore(splitState_.current); #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Handling splits for " << "resource [" << splitState_.current << "] with " << splitStore -> getSize() << " elements " << "in the split store.\n" << logofs_flush; #endif int result = splitStore -> receive(decodeBuffer); if (result < 0) { #ifdef PANIC *logofs << "handleSplit: PANIC! Receive of split for FD#" << fd_ << " failed.\n" << logofs_flush; #endif cerr << "Error" << ": Receive of split for FD#" << fd_ << " failed.\n"; return -1; } else if (result == 0) { // // The split is still incomplete. It's time // to check if we need to start the house- // keeping process to take care of the image // cache. // if (proxy -> handleAsyncKeeperCallback() < 0) { return -1; } } else { // // Note that we don't need the resource id at the // X server side and, thus, we don't provide it // at the time we add split to the split store. // #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Remote agent should " << "now commit a new split for resource [" << splitState_.current << "].\n" << logofs_flush; clientStore_ -> dumpCommitStore(); #endif if (splitStore -> getSize() == 0) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! Removing split store " << "for resource [" << splitState_.current << "] at " << strMsTimestamp() << ".\n" << logofs_flush; #endif handleSplitStoreRemove(&splitResources_, splitState_.current); #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: SPLIT! There are [" << clientStore_ -> getSplitTotalSize() << "] messages and " << clientStore_ -> getSplitTotalStorageSize() << " bytes to send in " << "the split stores.\n" << logofs_flush; #endif } else { // // If the next split is discarded, it can be // that, since the beginning of the split, we // have saved the message on the disk, due to // a more recent split operation. This is also // the case when we had to discard the message // because it was locked but, since then, we // completed the transferral of the split. // Split *splitMessage = splitStore -> getFirstSplit(); if (splitMessage -> getAction() == is_discarded && splitMessage -> getState() == split_missed && splitStore -> load(splitMessage) == 1) { #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: WARNING! SPLIT! Asynchronously " << "loaded the message from the image cache.\n" << logofs_flush; #endif splitMessage -> setState(split_loaded); #if defined(TEST) || defined(SPLIT) T_timestamp startTs = getTimestamp(); *logofs << "handleSplit: WARNING! SPLIT! Asynchronously " << "encoding abort split events for FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif if (proxy -> handleAsyncSplit(fd_, splitMessage) < 0) { return -1; } // // Send the encoded data immediately. We // want the abort split message to reach // the remote proxy as soon as possible. // if (proxy -> handleAsyncFlush() < 0) { return -1; } #if defined(TEST) || defined(SPLIT) *logofs << "handleSplit: WARNING! SPLIT! Spent " << diffTimestamp(startTs, getTimestamp()) << " ms " << "handling asynchronous abort split events for " << "FD#" << fd_ << ".\n" << logofs_flush; *logofs << "handleSplit: SPLIT! There are " << clientStore_ -> getSplitTotalSize() << " messages and " << clientStore_ -> getSplitTotalStorageSize() << " bytes to send in " << "the split stores.\n" << logofs_flush; clientStore_ -> dumpSplitStore(splitState_.current); #endif } } } return 1; } int ServerChannel::handleSplitEvent(EncodeBuffer &encodeBuffer, Split *splitMessage) { int resource = splitMessage -> getResource(); #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitEvent: SPLIT! Going to send a " << "split report for resource " << resource << ".\n" << logofs_flush; #endif // // This function is called only after the message // has been searched in the disk cache. We need to // inform the other side if the data transfer can // start or it must be aborted to let the local // side use the copy that was found on the disk. // #if defined(TEST) || defined(INFO) if (splitMessage -> getState() != split_loaded && splitMessage -> getState() != split_missed) { *logofs << "handleSplitEvent: PANIC! Can't find the split to be aborted.\n" << logofs_flush; HandleCleanup(); } #endif // // We need to send a boolean telling if the split // was found or not, followed by the checksum of // message we are referencing. // T_checksum checksum = splitMessage -> getChecksum(); #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitEvent: SPLIT! Sending split report for " << "checksum [" << DumpChecksum(checksum) << "].\n" << logofs_flush; #endif if (proxy -> handleAsyncSwitch(fd_) < 0) { return -1; } encodeBuffer.encodeOpcodeValue(opcodeStore_ -> splitEvent, serverCache_ -> opcodeCache); // // The encoding in older protocol versions // is different but we will never try to // send a split report if the remote does // not support our version. // encodeBuffer.encodeCachedValue(resource, 8, serverCache_ -> resourceCache); if (splitMessage -> getState() == split_loaded) { encodeBuffer.encodeBoolValue(1); encodeBuffer.encodeOpcodeValue(splitMessage -> getStore() -> opcode(), serverCache_ -> abortOpcodeCache); encodeBuffer.encodeValue(splitMessage -> compressedSize(), 32, 14); } else { encodeBuffer.encodeBoolValue(0); } for (unsigned int i = 0; i < MD5_LENGTH; i++) { encodeBuffer.encodeValue((unsigned int) checksum[i], 8); } // // Update statistics for this special opcode. // int bits = encodeBuffer.diffBits(); #if defined(TEST) || defined(OPCODES) || defined(INFO) || defined(SPLIT) *logofs << "handleSplitEvent: SPLIT! Handled event OPCODE#" << (unsigned int) opcodeStore_ -> splitEvent << " (" << DumpOpcode(opcodeStore_ -> splitEvent) << ")" << " for FD#" << fd_ << " sequence none. 0 bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; #endif statistics -> addEventBits(opcodeStore_ -> splitEvent, 0, bits); return 1; } int ServerChannel::handleAbortSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { unsigned char resource; decodeBuffer.decodeCachedValue(resource, 8, clientCache_ -> resourceCache); #if defined(TEST) || defined(SPLIT) *logofs << "handleAbortSplitRequest: SPLIT! Handling abort split " << "request for FD#" << fd_ << " and resource " << (unsigned) resource << ".\n" << logofs_flush; #endif int splits = 0; SplitStore *splitStore = clientStore_ -> getSplitStore(resource); if (splitStore != NULL) { // // Discard from the memory cache the messages // that are still incomplete and then get rid // of the splits in the store. // #if defined(TEST) || defined(SPLIT) clientStore_ -> dumpSplitStore(resource); #endif Split *splitMessage; for (;;) { splitMessage = splitStore -> getFirstSplit(); if (splitMessage == NULL) { // // Check if we had created the store // but no message was added yet. // #ifdef WARNING if (splits == 0) { *logofs << "handleAbortSplitRequest: WARNING! SPLIT! The " << "split store for resource [" << (unsigned int) resource << "] is unexpectedly empty.\n" << logofs_flush; } #endif break; } // // Splits already aborted can't be in the // split store. // #if defined(TEST) || defined(SPLIT) if (splitMessage -> getState() == split_aborted) { *logofs << "handleAbortSplitRequest: PANIC! SPLIT! Found an " << "aborted split in store [" << (unsigned int) resource << "].\n" << logofs_flush; HandleCleanup(); } #endif if (splitMessage -> getAction() == IS_HIT) { #if defined(TEST) || defined(SPLIT) *logofs << "handleAbortSplitRequest: SPLIT! Removing the " << "split from the memory cache.\n" << logofs_flush; #endif splitMessage -> getStore() -> remove(splitMessage -> getPosition(), discard_checksum, use_data); } #if defined(TEST) || defined(SPLIT) *logofs << "handleAbortSplitRequest: SPLIT! Removing the " << "split from the split store.\n" << logofs_flush; #endif splitMessage = splitStore -> pop(); #if defined(TEST) || defined(SPLIT) *logofs << "handleAbortSplitRequest: SPLIT! Freeing up the " << "aborted split.\n" << logofs_flush; #endif delete splitMessage; splits++; } } #ifdef WARNING else { *logofs << "handleAbortSplitRequest: WARNING! SPLIT! The " << "split store for resource [" << (unsigned int) resource << "] is already empty.\n" << logofs_flush; } #endif handleNullRequest(opcode, buffer, size); return (splits > 0); } int ServerChannel::handleCommitSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { // // Get request type and position of the image // to commit. // unsigned char request; decodeBuffer.decodeOpcodeValue(request, clientCache_ -> opcodeCache); unsigned int diffCommit; decodeBuffer.decodeValue(diffCommit, 32, 5); splitState_.commit += diffCommit; unsigned char resource = 0; unsigned int commit = 1; // // Send the resource id and the commit flag. // The resource id is ignored at the moment. // The message will be handled based on the // resource id that was sent together with // the original message. // decodeBuffer.decodeCachedValue(resource, 8, clientCache_ -> resourceCache); decodeBuffer.decodeBoolValue(commit); Split *split = handleSplitCommitRemove(request, resource, splitState_.commit); if (split == NULL) { return -1; } clientStore_ -> getCommitStore() -> update(split); if (commit == 1) { #if defined(TEST) || defined(SPLIT) *logofs << "handleCommitSplitRequest: SPLIT! Handling split commit " << "for FD#" << fd_ << " with commit " << commit << " request " << (unsigned) request << " resource " << (unsigned) resource << " and position " << splitState_.commit << ".\n" << logofs_flush; #endif // // Allocate as many bytes in the write // buffer as the final length of the // message in uncompressed form. // size = split -> plainSize(); buffer = writeBuffer_.addMessage(size); #if defined(TEST) || defined(SPLIT) *logofs << "handleCommitSplitRequest: SPLIT! Prepared an " << "outgoing buffer of " << size << " bytes.\n" << logofs_flush; #endif if (clientStore_ -> getCommitStore() -> expand(split, buffer, size) < 0) { writeBuffer_.removeMessage(size); commit = 0; } } // // Free the split. // #if defined(TEST) || defined(SPLIT) *logofs << "handleCommitSplitRequest: SPLIT! Freeing up the " << "committed split.\n" << logofs_flush; #endif delete split; // // Discard the operation and send a null // message. // if (commit == 0) { handleNullRequest(opcode, buffer, size); } else { // // Save the sequence number to be able // to mask any error generated by the // request. // updateCommitQueue(clientSequence_); // // Now in the write buffer there is // a copy of this request. // opcode = request; } return commit; } int ServerChannel::handleGeometry(unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { // // Replace the old geometry and taint // the message into a X_NoOperation. // int resource = *(buffer + 1); #ifdef TEST *logofs << "handleGeometry: Setting new unpack geometry " << "for resource " << resource << ".\n" << logofs_flush; #endif handleUnpackStateInit(resource); handleUnpackAllocGeometry(resource); unpackState_[resource] -> geometry -> depth1_bpp = *(buffer + 4); unpackState_[resource] -> geometry -> depth4_bpp = *(buffer + 5); unpackState_[resource] -> geometry -> depth8_bpp = *(buffer + 6); unpackState_[resource] -> geometry -> depth16_bpp = *(buffer + 7); unpackState_[resource] -> geometry -> depth24_bpp = *(buffer + 8); unpackState_[resource] -> geometry -> depth32_bpp = *(buffer + 9); unpackState_[resource] -> geometry -> red_mask = GetULONG(buffer + 12, bigEndian_); unpackState_[resource] -> geometry -> green_mask = GetULONG(buffer + 16, bigEndian_); unpackState_[resource] -> geometry -> blue_mask = GetULONG(buffer + 20, bigEndian_); handleCleanAndNullRequest(opcode, buffer, size); return 1; } int ServerChannel::handleColormap(unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { // // Replace the old colormap and taint // the message into a X_NoOperation. // int resource = *(buffer + 1); #ifdef TEST *logofs << "handleColormap: Setting new unpack colormap " << "for resource " << resource << ".\n" << logofs_flush; #endif handleUnpackStateInit(resource); handleUnpackAllocColormap(resource); // // New protocol versions send the alpha // data in compressed form. // // // Since ProtoStep7 (#issue 108) // { // An anonymous block is used here to limit the scope of local variables unsigned int packed = GetULONG(buffer + 8, bigEndian_); unsigned int unpacked = GetULONG(buffer + 12, bigEndian_); validateSize("colormap", packed, unpacked, 16, size); if (unpackState_[resource] -> colormap -> entries != unpacked >> 2 && unpackState_[resource] -> colormap -> data != NULL) { #ifdef TEST *logofs << "handleColormap: Freeing previously allocated " << "unpack colormap data.\n" << logofs_flush; #endif delete [] unpackState_[resource] -> colormap -> data; unpackState_[resource] -> colormap -> data = NULL; unpackState_[resource] -> colormap -> entries = 0; } #ifdef TEST *logofs << "handleColormap: Setting " << unpacked << " bytes of unpack colormap data for resource " << resource << ".\n" << logofs_flush; #endif if (unpackState_[resource] -> colormap -> data == NULL) { unpackState_[resource] -> colormap -> data = (unsigned int *) new unsigned char[unpacked]; if (unpackState_[resource] -> colormap -> data == NULL) { #ifdef PANIC *logofs << "handleColormap: PANIC! Can't allocate " << unpacked << " entries for unpack colormap data " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif goto handleColormapEnd; } #ifdef DEBUG *logofs << "handleColormap: Size of new colormap data is " << unpacked << ".\n" << logofs_flush; #endif } unsigned int method = *(buffer + 4); if (method == PACK_COLORMAP) { if (UnpackColormap(method, buffer + 16, packed, (unsigned char *) unpackState_[resource] -> colormap -> data, unpacked) < 0) { #ifdef PANIC *logofs << "handleColormap: PANIC! Can't unpack " << packed << " bytes to " << unpacked << " entries for FD#" << fd_ << ".\n" << logofs_flush; #endif delete [] unpackState_[resource] -> colormap -> data; unpackState_[resource] -> colormap -> data = NULL; unpackState_[resource] -> colormap -> entries = 0; goto handleColormapEnd; } } else { memcpy((unsigned char *) unpackState_[resource] -> colormap -> data, buffer + 16, unpacked); } unpackState_[resource] -> colormap -> entries = unpacked >> 2; #if defined(DEBUG) && defined(DUMP) *logofs << "handleColormap: Dumping colormap entries:\n" << logofs_flush; const unsigned char *p = (const unsigned char *) unpackState_[resource] -> colormap -> data; for (unsigned int i = 0; i < unpackState_[resource] -> colormap -> entries; i++) { *logofs << "handleColormap: [" << i << "] [" << (void *) ((int) p[i]) << "].\n" << logofs_flush; } #endif } // end anonymous block handleColormapEnd: handleCleanAndNullRequest(opcode, buffer, size); return 1; } int ServerChannel::handleAlpha(unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { int resource = *(buffer + 1); #ifdef TEST *logofs << "handleAlpha: Setting new unpack alpha " << "for resource " << resource << ".\n" << logofs_flush; #endif handleUnpackStateInit(resource); handleUnpackAllocAlpha(resource); // // New protocol versions send the alpha // data in compressed form. // // // Since ProtoStep7 (#issue 108) // { // An anonymous block is used here to limit the scope of local variables unsigned int packed = GetULONG(buffer + 8, bigEndian_); unsigned int unpacked = GetULONG(buffer + 12, bigEndian_); validateSize("alpha", packed, unpacked, 16, size); if (unpackState_[resource] -> alpha -> entries != unpacked && unpackState_[resource] -> alpha -> data != NULL) { #ifdef TEST *logofs << "handleAlpha: Freeing previously allocated " << "unpack alpha data.\n" << logofs_flush; #endif delete [] unpackState_[resource] -> alpha -> data; unpackState_[resource] -> alpha -> data = NULL; unpackState_[resource] -> alpha -> entries = 0; } #ifdef TEST *logofs << "handleAlpha: Setting " << unpacked << " bytes of unpack alpha data for resource " << resource << ".\n" << logofs_flush; #endif if (unpackState_[resource] -> alpha -> data == NULL) { unpackState_[resource] -> alpha -> data = new unsigned char[unpacked]; if (unpackState_[resource] -> alpha -> data == NULL) { #ifdef PANIC *logofs << "handleAlpha: PANIC! Can't allocate " << unpacked << " entries for unpack alpha data " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif goto handleAlphaEnd; } #ifdef DEBUG *logofs << "handleAlpha: Size of new alpha data is " << unpacked << ".\n" << logofs_flush; #endif } unsigned int method = *(buffer + 4); if (method == PACK_ALPHA) { if (UnpackAlpha(method, buffer + 16, packed, unpackState_[resource] -> alpha -> data, unpacked) < 0) { #ifdef PANIC *logofs << "handleAlpha: PANIC! Can't unpack " << packed << " bytes to " << unpacked << " entries for FD#" << fd_ << ".\n" << logofs_flush; #endif delete [] unpackState_[resource] -> alpha -> data; unpackState_[resource] -> alpha -> data = NULL; unpackState_[resource] -> alpha -> entries = 0; goto handleAlphaEnd; } } else { memcpy((unsigned char *) unpackState_[resource] -> alpha -> data, buffer + 16, unpacked); } unpackState_[resource] -> alpha -> entries = unpacked; #if defined(DEBUG) && defined(DUMP) *logofs << "handleAlpha: Dumping alpha entries:\n" << logofs_flush; const unsigned char *p = unpackState_[resource] -> alpha -> data; for (unsigned int i = 0; i < unpackState_[resource] -> alpha -> entries; i++) { *logofs << "handleAlpha: [" << i << "] [" << (void *) ((int) p[i]) << "].\n" << logofs_flush; } #endif } //end anonymous block handleAlphaEnd: handleCleanAndNullRequest(opcode, buffer, size); return 1; } int ServerChannel::handleImage(unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { int result = 1; // // Save the original opcode together with // the image state so we can later find if // this is a plain or a packed image when // moving data to the shared memory area. // handleImageStateAlloc(opcode); if (opcode == opcodeStore_ -> putPackedImage) { // // Unpack the image and put a X_PutImage in a // new buffer. Save the expected output size, // so, in the case of a decoding error we can // still update the statistics. // int length = GetULONG(buffer + 20, bigEndian_); #ifdef TEST *logofs << "handleImage: Sending image for FD#" << fd_ << " due to OPCODE#" << (unsigned int) opcode << " with " << GetULONG(buffer + 16, bigEndian_) << " bytes packed " << "and " << GetULONG(buffer + 20, bigEndian_) << " bytes unpacked.\n" << logofs_flush; #endif statistics -> addPackedBytesIn(size); result = handleUnpack(opcode, buffer, size); if (result < 0) { // // Recover from the error. Send a X_NoOperation // to keep the sequence counter in sync with // the remote peer. // size = 4; buffer = writeBuffer_.addMessage(size); *buffer = X_NoOperation; PutUINT(size >> 2, buffer + 2, bigEndian_); #ifdef PANIC *logofs << "handleImage: PANIC! Sending X_NoOperation for FD#" << fd_ << " to recover from failed unpack.\n" << logofs_flush; #endif // // Set the output length to reflect the amount of // data that would have been produced by unpacking // the image. This is advisable to keep the count- // ers in sync with those at remote proxy. Setting // the size here doesn't have any effect on the // size of data sent to the X server as the actual // size will be taken from the content of the write // buffer. // size = length; } statistics -> addPackedBytesOut(size); // // Refrain the write loop from putting // opcode and size in the output buffer. // opcode = 0; } // // Now image is unpacked as a X_PutImage // in write buffer. Check if we can send // the image using the MIT-SHM extension. // if (result > 0) { result = handleShmem(opcode, buffer, size); // // We already put opcode and size in // the resulting buffer. // if (result > 0) { opcode = 0; } } return 1; } int ServerChannel::handleMotion(EncodeBuffer &encodeBuffer) { #if defined(TEST) || defined(INFO) if (lastMotion_[0] == '\0') { *logofs << "handleMotion: PANIC! No motion events to send " << "for FD#" << fd_ << ".\n" << logofs_flush; HandleCleanup(); } #endif #if defined(TEST) || defined(INFO) *logofs << "handleMotion: Sending motion events for FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif // // Replicate code from read loop. When have // time and wish, try to split everything // in functions. // if (proxy -> handleAsyncSwitch(fd_) < 0) { return -1; } const unsigned char *buffer = lastMotion_; unsigned char opcode = *lastMotion_; unsigned int size = 32; if (GetUINT(buffer + 2, bigEndian_) < serverSequence_) { PutUINT(serverSequence_, (unsigned char *) buffer + 2, bigEndian_); } encodeBuffer.encodeOpcodeValue(opcode, serverCache_ -> opcodeCache); unsigned int sequenceNum = GetUINT(buffer + 2, bigEndian_); unsigned int sequenceDiff = sequenceNum - serverSequence_; serverSequence_ = sequenceNum; #ifdef DEBUG *logofs << "handleMotion: Last server sequence number for FD#" << fd_ << " is " << serverSequence_ << " with " << "difference " << sequenceDiff << ".\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(sequenceDiff, 16, serverCache_ -> eventSequenceCache, 7); // // If we fast encoded the message // then skip the rest. // if (control -> LocalDeltaCompression == 0) { int result = handleFastReadEvent(encodeBuffer, opcode, buffer, size); #ifdef DEBUG *logofs << "handleMotion: Sent saved motion event for FD#" << fd_ << ".\n" << logofs_flush; #endif lastMotion_[0] = '\0'; #ifdef DEBUG *logofs << "handleMotion: Reset last motion event for FD#" << fd_ << ".\n" << logofs_flush; #endif if (result < 0) { return -1; } else if (result > 0) { return 1; } } // // This should be just the part specific // for motion events but is currently a // copy-paste of code from the read loop. // unsigned char detail = buffer[1]; if (*buffer == MotionNotify) encodeBuffer.encodeBoolValue((unsigned int) detail); else if ((*buffer == EnterNotify) || (*buffer == LeaveNotify)) encodeBuffer.encodeValue((unsigned int) detail, 3); else if (*buffer == KeyRelease) { if (detail == serverCache_ -> keyPressLastKey) encodeBuffer.encodeBoolValue(1); else { encodeBuffer.encodeBoolValue(0); encodeBuffer.encodeValue((unsigned int) detail, 8); } } else if ((*buffer == ButtonPress) || (*buffer == ButtonRelease)) encodeBuffer.encodeCachedValue(detail, 8, serverCache_ -> buttonCache); else encodeBuffer.encodeValue((unsigned int) detail, 8); unsigned int _timestamp = GetULONG(buffer + 4, bigEndian_); unsigned int timestampDiff = _timestamp - serverCache_ -> lastTimestamp; serverCache_ -> lastTimestamp = _timestamp; encodeBuffer.encodeCachedValue(timestampDiff, 32, serverCache_ -> motionNotifyTimestampCache, 9); int skipRest = 0; if (*buffer == KeyRelease) { skipRest = 1; for (unsigned int i = 8; i < 31; i++) { if (buffer[i] != serverCache_ -> keyPressCache[i - 8]) { skipRest = 0; break; } } encodeBuffer.encodeBoolValue(skipRest); } if (!skipRest) { const unsigned char *nextSrc = buffer + 8; for (unsigned int i = 0; i < 3; i++) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 29, *serverCache_ -> motionNotifyWindowCache[i], 6); nextSrc += 4; } unsigned int rootX = GetUINT(buffer + 20, bigEndian_); unsigned int rootY = GetUINT(buffer + 22, bigEndian_); unsigned int eventX = GetUINT(buffer + 24, bigEndian_); unsigned int eventY = GetUINT(buffer + 26, bigEndian_); eventX -= rootX; eventY -= rootY; encodeBuffer.encodeCachedValue(rootX - serverCache_ -> motionNotifyLastRootX, 16, serverCache_ -> motionNotifyRootXCache, 6); serverCache_ -> motionNotifyLastRootX = rootX; encodeBuffer.encodeCachedValue(rootY - serverCache_ -> motionNotifyLastRootY, 16, serverCache_ -> motionNotifyRootYCache, 6); serverCache_ -> motionNotifyLastRootY = rootY; encodeBuffer.encodeCachedValue(eventX, 16, serverCache_ -> motionNotifyEventXCache, 6); encodeBuffer.encodeCachedValue(eventY, 16, serverCache_ -> motionNotifyEventYCache, 6); encodeBuffer.encodeCachedValue(GetUINT(buffer + 28, bigEndian_), 16, serverCache_ -> motionNotifyStateCache); if ((*buffer == EnterNotify) || (*buffer == LeaveNotify)) encodeBuffer.encodeValue((unsigned int) buffer[30], 2); else encodeBuffer.encodeBoolValue((unsigned int) buffer[30]); if ((*buffer == EnterNotify) || (*buffer == LeaveNotify)) encodeBuffer.encodeValue((unsigned int) buffer[31], 2); else if (*buffer == KeyPress) { serverCache_ -> keyPressLastKey = detail; for (unsigned int i = 8; i < 31; i++) { serverCache_ -> keyPressCache[i - 8] = buffer[i]; } } } // // Print info about achieved compression // and update the statistics. // int bits = encodeBuffer.diffBits(); #if defined(TEST) || defined(OPCODES) *logofs << "handleMotion: Handled event OPCODE#" << (unsigned int) buffer[0] << " for FD#" << fd_ << " sequence " << sequenceNum << ". " << size << " bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; #endif statistics -> addEventBits(*buffer, size << 3, bits); #ifdef DEBUG *logofs << "handleMotion: Sent saved motion event for FD#" << fd_ << ".\n" << logofs_flush; #endif lastMotion_[0] = '\0'; #ifdef DEBUG *logofs << "handleMotion: Reset last motion event for FD#" << fd_ << ".\n" << logofs_flush; #endif return 1; } int ServerChannel::handleConfiguration() { #ifdef TEST *logofs << "ServerChannel: Setting new buffer parameters " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif readBuffer_.setSize(control -> ServerInitialReadSize, control -> ServerMaximumBufferSize); writeBuffer_.setSize(control -> TransportXBufferSize, control -> TransportXBufferThreshold, control -> TransportMaximumBufferSize); transport_ -> setSize(control -> TransportXBufferSize, control -> TransportXBufferThreshold, control -> TransportMaximumBufferSize); return 1; } int ServerChannel::handleFinish() { #ifdef TEST *logofs << "ServerChannel: Finishing connection for FD#" << fd_ << ".\n" << logofs_flush; #endif congestion_ = 0; priority_ = 0; finish_ = 1; // // Reset the motion event. // lastMotion_[0] = '\0'; transport_ -> fullReset(); return 1; } int ServerChannel::handleAsyncEvents() { // // Encode more events while decoding the // proxy messages. // if (transport_ -> readable() > 0) { #if defined(TEST) || defined(INFO) *logofs << "handleAsyncEvents: WARNING! Encoding events " << "for FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif #if defined(TEST) || defined(INFO) T_timestamp startTs = getTimestamp(); #endif if (proxy -> handleAsyncRead(fd_) < 0) { return -1; } #if defined(TEST) || defined(INFO) *logofs << "handleAsyncEvents: Spent " << diffTimestamp(startTs, getTimestamp()) << " ms handling events for FD#" << fd_ << ".\n" << logofs_flush; #endif return 1; } return 0; } int ServerChannel::handleUnpack(unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { int resource = *(buffer + 1); #ifdef DEBUG *logofs << "handleUnpack: Unpacking image for resource " << resource << " with method " << (unsigned int) *(buffer + 12) << ".\n" << logofs_flush; #endif handleUnpackStateInit(resource); T_geometry *geometryState = unpackState_[resource] -> geometry; T_colormap *colormapState = unpackState_[resource] -> colormap; T_alpha *alphaState = unpackState_[resource] -> alpha; if (geometryState == NULL) { #ifdef PANIC *logofs << "handleUnpack: PANIC! Missing geometry unpacking " << "image for resource " << resource << ".\n" << logofs_flush; #endif cerr << "Error" << ": Missing geometry unpacking " << "image for resource " << resource << ".\n"; return -1; } // // Get the image data from the buffer. // imageState_ -> drawable = GetULONG(buffer + 4, bigEndian_); imageState_ -> gcontext = GetULONG(buffer + 8, bigEndian_); imageState_ -> method = *(buffer + 12); imageState_ -> format = *(buffer + 13); imageState_ -> srcDepth = *(buffer + 14); imageState_ -> dstDepth = *(buffer + 15); imageState_ -> srcLength = GetULONG(buffer + 16, bigEndian_); imageState_ -> dstLength = GetULONG(buffer + 20, bigEndian_); imageState_ -> srcX = GetUINT(buffer + 24, bigEndian_); imageState_ -> srcY = GetUINT(buffer + 26, bigEndian_); imageState_ -> srcWidth = GetUINT(buffer + 28, bigEndian_); imageState_ -> srcHeight = GetUINT(buffer + 30, bigEndian_); imageState_ -> dstX = GetUINT(buffer + 32, bigEndian_); imageState_ -> dstY = GetUINT(buffer + 34, bigEndian_); imageState_ -> dstWidth = GetUINT(buffer + 36, bigEndian_); imageState_ -> dstHeight = GetUINT(buffer + 38, bigEndian_); #ifdef TEST *logofs << "handleUnpack: Source X is " << imageState_ -> srcX << " Y is " << imageState_ -> srcY << " width is " << imageState_ -> srcWidth << " height is " << imageState_ -> srcHeight << ".\n" << logofs_flush; #endif #ifdef TEST *logofs << "handleUnpack: Destination X is " << imageState_ -> dstX << " Y is " << imageState_ -> dstY << " width is " << imageState_ -> dstWidth << " height is " << imageState_ -> dstHeight << ".\n" << logofs_flush; #endif if (imageState_ -> srcX != 0 || imageState_ -> srcY != 0) { #ifdef PANIC *logofs << "handleUnpack: PANIC! Unsupported source coordinates " << "in unpack request.\n" << logofs_flush; #endif return -1; } else if (imageState_ -> method == PACK_COLORMAP_256_COLORS && (colormapState == NULL || colormapState -> data == NULL)) { #ifdef PANIC *logofs << "handleUnpack: PANIC! Cannot find any unpack colormap.\n" << logofs_flush; #endif return -1; } // // Field srcLength carries size of image data in // packed format. Field dstLength is size of the // image in the original X bitmap format. // unsigned int srcDataOffset = 40; unsigned int srcSize = imageState_ -> srcLength; unsigned int removeSize = size; unsigned char *srcData = buffer + srcDataOffset; // // Get source and destination bits per pixel. // int srcBitsPerPixel = MethodBitsPerPixel(imageState_ -> method); if (srcBitsPerPixel <= 0) { #ifdef PANIC *logofs << "handleUnpack: PANIC! Can't identify source " << "bits per pixel for method " << (unsigned int) imageState_ -> method << ".\n" << logofs_flush; #endif cerr << "Error" << ": Can't identify source bits " << "per pixel for method " << (unsigned int) imageState_ -> method << ".\n"; writeBuffer_.removeMessage(removeSize); return -1; } #ifdef TEST *logofs << "handleUnpack: Source bits per pixel are " << srcBitsPerPixel << " source data size is " << srcSize << ".\n" << logofs_flush; #endif int dstBitsPerPixel = UnpackBitsPerPixel(geometryState, imageState_ -> dstDepth); if (dstBitsPerPixel <= 0) { #ifdef PANIC *logofs << "handleUnpack: PANIC! Can't identify " << "destination bits per pixel for depth " << (unsigned int) imageState_ -> dstDepth << ".\n" << logofs_flush; #endif cerr << "Error" << ": Can't identify " << "destination bits per pixel for depth " << (unsigned int) imageState_ -> dstDepth << ".\n"; writeBuffer_.removeMessage(removeSize); return -1; } // // Destination is a PutImage request. // unsigned int dstDataOffset = 24; // // Output buffer size must match the number of input // pixels multiplied by the number of bytes per pixel // of current geometry. // size = (RoundUp4(imageState_ -> dstWidth * dstBitsPerPixel / 8) * imageState_ -> dstHeight) + dstDataOffset; #ifdef TEST *logofs << "handleUnpack: Destination bits per pixel are " << dstBitsPerPixel << " destination data size is " << size - dstDataOffset << ".\n" << logofs_flush; #endif unsigned int dstSize = size - dstDataOffset; imageState_ -> dstLines = imageState_ -> dstHeight; unsigned char *dstData; // // Size of the final output buffer had to be stored // in the offset field of XImage/NXPackedImage. // #ifdef WARNING if (dstSize != imageState_ -> dstLength) { *logofs << "handleUnpack: WARNING! Destination size mismatch " << "with reported " << imageState_ -> dstLength << " and actual " << dstSize << ".\n" << logofs_flush; } #endif // // The decoding algorithm has put the packed image // in the plain write buffer. Let's use the scratch // buffer to uncompress the image. // buffer = writeBuffer_.addScratchMessage(size); dstData = buffer + dstDataOffset; // // Unpack image into the buffer. // *buffer = (unsigned char) X_PutImage; *(buffer + 1) = imageState_ -> format; PutUINT(size >> 2, buffer + 2, bigEndian_); PutULONG(imageState_ -> drawable, buffer + 4, bigEndian_); PutULONG(imageState_ -> gcontext, buffer + 8, bigEndian_); PutUINT(imageState_ -> dstWidth, buffer + 12, bigEndian_); PutUINT(imageState_ -> dstLines, buffer + 14, bigEndian_); PutUINT(imageState_ -> dstX, buffer + 16, bigEndian_); PutUINT(imageState_ -> dstY, buffer + 18, bigEndian_); *(buffer + 20) = 0; *(buffer + 21) = imageState_ -> dstDepth; #ifdef TEST *logofs << "handleUnpack: Write buffer size is " << writeBuffer_.getLength() << " scratch size is " << writeBuffer_.getScratchLength() << ".\n" << logofs_flush; #endif int result = 0; switch (imageState_ -> method) { case PACK_JPEG_8_COLORS: case PACK_JPEG_64_COLORS: case PACK_JPEG_256_COLORS: case PACK_JPEG_512_COLORS: case PACK_JPEG_4K_COLORS: case PACK_JPEG_32K_COLORS: case PACK_JPEG_64K_COLORS: case PACK_JPEG_256K_COLORS: case PACK_JPEG_2M_COLORS: case PACK_JPEG_16M_COLORS: { result = UnpackJpeg(geometryState, imageState_ -> method, srcData, srcSize, dstBitsPerPixel, imageState_ -> dstWidth, imageState_ -> dstHeight, dstData, dstSize); break; } case PACK_PNG_8_COLORS: case PACK_PNG_64_COLORS: case PACK_PNG_256_COLORS: case PACK_PNG_512_COLORS: case PACK_PNG_4K_COLORS: case PACK_PNG_32K_COLORS: case PACK_PNG_64K_COLORS: case PACK_PNG_256K_COLORS: case PACK_PNG_2M_COLORS: case PACK_PNG_16M_COLORS: { result = UnpackPng(geometryState, imageState_ -> method, srcData, srcSize, dstBitsPerPixel, imageState_ -> dstWidth, imageState_ -> dstHeight, dstData, dstSize); break; } case PACK_RGB_16M_COLORS: { result = UnpackRgb(geometryState, imageState_ -> method, srcData, srcSize, dstBitsPerPixel, imageState_ -> dstWidth, imageState_ -> dstHeight, dstData, dstSize); break; } case PACK_RLE_16M_COLORS: { result = UnpackRle(geometryState, imageState_ -> method, srcData, srcSize, dstBitsPerPixel, imageState_ -> dstWidth, imageState_ -> dstHeight, dstData, dstSize); break; } case PACK_BITMAP_16M_COLORS: { result = UnpackBitmap(geometryState, imageState_ -> method, srcData, srcSize, dstBitsPerPixel, imageState_ -> dstWidth, imageState_ -> dstHeight, dstData, dstSize); break; } case PACK_COLORMAP_256_COLORS: { result = Unpack8(geometryState, colormapState, srcBitsPerPixel, imageState_ -> srcWidth, imageState_ -> srcHeight, srcData, srcSize, dstBitsPerPixel, imageState_ -> dstWidth, imageState_ -> dstHeight, dstData, dstSize); break; } default: { const T_colormask *colorMask = MethodColorMask(imageState_ -> method); switch (imageState_ -> method) { case PACK_MASKED_8_COLORS: case PACK_MASKED_64_COLORS: case PACK_MASKED_256_COLORS: { result = Unpack8(geometryState, colorMask, imageState_ -> srcDepth, imageState_ -> srcWidth, imageState_ -> srcHeight, srcData, srcSize, imageState_ -> dstDepth, imageState_ -> dstWidth, imageState_ -> dstHeight, dstData, dstSize); break; } case PACK_MASKED_512_COLORS: case PACK_MASKED_4K_COLORS: case PACK_MASKED_32K_COLORS: case PACK_MASKED_64K_COLORS: { result = Unpack16(geometryState, colorMask, imageState_ -> srcDepth, imageState_ -> srcWidth, imageState_ -> srcHeight, srcData, srcSize, imageState_ -> dstDepth, imageState_ -> dstWidth, imageState_ -> dstHeight, dstData, dstSize); break; } case PACK_MASKED_256K_COLORS: case PACK_MASKED_2M_COLORS: case PACK_MASKED_16M_COLORS: { result = Unpack24(geometryState, colorMask, imageState_ -> srcDepth, imageState_ -> srcWidth, imageState_ -> srcHeight, srcData, srcSize, imageState_ -> dstDepth, imageState_ -> dstWidth, imageState_ -> dstHeight, dstData, dstSize); break; } default: { break; } } } } writeBuffer_.removeMessage(removeSize); if (result <= 0) { #ifdef PANIC *logofs << "handleUnpack: PANIC! Failed to unpack image " << "with method '" << (unsigned int) imageState_ -> method << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Failed to unpack image " << "with method '" << (unsigned int) imageState_ -> method << "'.\n"; // // TODO: We should mark the image somehow, // and force the remote to remove it from // the cache. // writeBuffer_.removeScratchMessage(); return -1; } // // Alpha channel is used only on some 32 bits pixmaps // and only if render extension is in use. Presently // we don't have an efficient way to know in advance // if mask must be applied or not to the image. If an // alpha channel is set, the function will check if // the size of the alpha data matches the size of the // image. In the worst case we'll create an useless // alpha plane for a pixmap that doesn't need it. // if (alphaState != NULL && alphaState -> data != NULL && imageState_ -> dstDepth == 32) { UnpackAlpha(alphaState, dstData, dstSize, imageByteOrder_); } return 1; } int ServerChannel::handleAuthorization(unsigned char *buffer) { // // At the present moment we don't support more than // a single display for each proxy, so authorization // data is shared among all the channels. // // Use the following code to simulate authentication // failures on a LSB machine: // // memcpy(buffer + 12 + (((buffer[6] + 256 * // buffer[7]) + 3) & ~3), "1234567890123456", 16); // if (auth == NULL) { #if defined(TEST) || defined(INFO) *logofs << "handleAuthorization: Forwarding the real cookie " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif return 0; } else if (auth -> checkCookie(buffer) == 1) { #if defined(TEST) || defined(INFO) *logofs << "handleAuthorization: Matched the fake cookie " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif return 1; } else { #if defined(TEST) || defined(INFO) *logofs << "handleAuthorization: WARNING! Failed to match " << "the fake cookie for FD#" << fd_ << ".\n" << logofs_flush; #endif return -1; } } int ServerChannel::handleAuthorization(const unsigned char *buffer, int size) { // // Check the X server's response and, in the case of // an error, print the textual information reported // by the server. // if (*buffer != 1) { const char *reason = NULL; // // At the moment we don't take into account the end- // ianess of the reply. This should work in any case // because we simply try to match a few well-known // error strings. // if (size >= INVALID_COOKIE_SIZE + 8 && memcmp(buffer + 8, INVALID_COOKIE_DATA, INVALID_COOKIE_SIZE) == 0) { reason = INVALID_COOKIE_DATA; } else if (size >= NO_AUTH_PROTO_SIZE + 8 && memcmp(buffer + 8, NO_AUTH_PROTO_DATA, NO_AUTH_PROTO_SIZE) == 0) { reason = NO_AUTH_PROTO_DATA; } else { reason = "Unknown"; } #ifdef WARNING *logofs << "handleAuthorization: WARNING! X connection failed " << "with error '" << reason << "' on FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Warning" << ": X connection failed " << "with error '" << reason << "'.\n"; } #if defined(TEST) || defined(INFO) else { *logofs << "handleAuthorization: X connection successful " << "on FD#" << fd_ << ".\n" << logofs_flush; } #endif return 1; } // // Use a simple encoding. Need to handle the image // requests in the usual way and the X_ListExtensions // and X_QueryExtension to hide MIT-SHM and RENDER // in the reply. // int ServerChannel::handleFastWriteRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { // // All the NX requests are handled in the // main message loop. // // // Since ProtoStep7 (#issue 108) // // The X_PutImage can be handled here only // if a split was not requested. // if ((opcode >= X_NXFirstOpcode && opcode <= X_NXLastOpcode) || (opcode == X_PutImage && splitState_.resource != nothing) || opcode == X_ListExtensions || opcode == X_QueryExtension) { return 0; } #ifdef DEBUG *logofs << "handleFastWriteRequest: Decoding raw request OPCODE#" << (unsigned int) opcode << " for FD#" << fd_ << ".\n" << logofs_flush; #endif buffer = writeBuffer_.addMessage(4); #ifndef __sun unsigned int *next = (unsigned int *) decodeBuffer.decodeMemory(4); *((unsigned int *) buffer) = *next; #else /* #ifndef __sun */ memcpy(buffer, decodeBuffer.decodeMemory(4), 4); #endif /* #ifndef __sun */ size = GetUINT(buffer + 2, bigEndian_) << 2; if (size < 4) { #ifdef WARNING *logofs << "handleFastWriteRequest: WARNING! Assuming size 4 " << "for suspicious message of size " << size << ".\n" << logofs_flush; #endif size = 4; } writeBuffer_.registerPointer(&buffer); if (writeBuffer_.getAvailable() < size - 4 || (int) size >= control -> TransportFlushBufferSize) { #ifdef DEBUG *logofs << "handleFastWriteRequest: Using scratch buffer for OPCODE#" << (unsigned int) opcode << " with size " << size << " and " << writeBuffer_.getLength() << " bytes in buffer.\n" << logofs_flush; #endif // // The procedure moving data to shared memory // assumes that the full message is stored in // the scratch buffer. We can safely let the // scratch buffer inherit the decode buffer // at the next offset. // writeBuffer_.removeMessage(4); buffer = writeBuffer_.addScratchMessage(((unsigned char *) decodeBuffer.decodeMemory(size - 4)) - 4, size); } else { writeBuffer_.addMessage(size - 4); #ifndef __sun if (size <= 32) { next = (unsigned int *) decodeBuffer.decodeMemory(size - 4); for (unsigned int i = 4; i < size; i += sizeof(unsigned int)) { *((unsigned int *) (buffer + i)) = *next++; } } else { memcpy(buffer + 4, decodeBuffer.decodeMemory(size - 4), size - 4); } #else /* #ifndef __sun */ memcpy(buffer + 4, decodeBuffer.decodeMemory(size - 4), size - 4); #endif /* #ifndef __sun */ } // // Opcode could have been tainted by the client // proxy. Replace the original opcode with the // one sent in the decode buffer. // *buffer = opcode; writeBuffer_.unregisterPointer(); if (opcode == X_PutImage) { handleImage(opcode, buffer, size); } #if defined(TEST) || defined(OPCODES) if (opcode != 0) { *logofs << "handleFastWriteRequest: Handled request " << "OPCODE#" << (unsigned int) opcode << " (" << DumpOpcode(opcode) << ") for FD#" << fd_ << " sequence " << clientSequence_ << ". " << size << " bytes out.\n" << logofs_flush; } else { *logofs << "handleFastWriteRequest: Handled image or " << "other request for FD#" << fd_ << " sequence " << clientSequence_ << ". " << size << " bytes out.\n" << logofs_flush; } #endif handleFlush(flush_if_needed); return 1; } // // Use the simplest encoding except for replies that // need to be managed some way. // int ServerChannel::handleFastReadReply(EncodeBuffer &encodeBuffer, const unsigned char &opcode, const unsigned char *&buffer, const unsigned int &size) { // // If we pushed a X_GetInputFocus in the sequence // queue this means that the original message was // a NX request for which we have to provide a NX // reply. // if ((opcode >= X_NXFirstOpcode && opcode <= X_NXLastOpcode) || opcode == X_QueryExtension || opcode == X_ListExtensions || opcode == X_GetInputFocus) { return 0; } #ifdef DEBUG *logofs << "handleFastReadReply: Encoding raw reply OPCODE#" << (unsigned int) opcode << " for FD#" << fd_ << " with size " << size << ".\n" << logofs_flush; #endif encodeBuffer.encodeMemory(buffer, size); // // Send back the reply as soon // as possible. // priority_++; int bits = encodeBuffer.diffBits(); #if defined(TEST) || defined(OPCODES) *logofs << "handleFastReadReply: Handled raw reply OPCODE#" << (unsigned int) opcode << " for FD#" << fd_ << " sequence " << serverSequence_ << ". " << size << " bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; #endif statistics -> addReplyBits(opcode, size << 3, bits); return 1; } int ServerChannel::handleFastReadEvent(EncodeBuffer &encodeBuffer, const unsigned char &opcode, const unsigned char *&buffer, const unsigned int &size) { #ifdef DEBUG *logofs << "handleFastReadEvent: Encoding raw " << (opcode == X_Error ? "error" : "event") << " OPCODE#" << (unsigned int) opcode << " for FD#" << fd_ << " with size " << size << ".\n" << logofs_flush; #endif encodeBuffer.encodeMemory(buffer, size); switch (opcode) { case X_Error: case ButtonPress: case ButtonRelease: case KeyPress: case KeyRelease: { priority_++; } } int bits = encodeBuffer.diffBits(); #if defined(TEST) || defined(OPCODES) if (opcode == X_Error) { unsigned char code = *(buffer + 1); *logofs << "handleFastReadEvent: Handled error ERR_CODE#" << (unsigned int) code << " for FD#" << fd_; *logofs << " RES_ID#" << GetULONG(buffer + 4, bigEndian_); *logofs << " MIN_OP#" << GetUINT(buffer + 8, bigEndian_); *logofs << " MAJ_OP#" << (unsigned int) *(buffer + 10); *logofs << " sequence " << serverSequence_ << ". " << size << " bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; } else { *logofs << "handleFastReadEvent: Handled event OPCODE#" << (unsigned int) *buffer << " for FD#" << fd_ << " sequence " << serverSequence_ << ". " << size << " bytes in, " << bits << " bits (" << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; } #endif statistics -> addEventBits(opcode, size << 3, bits); return 1; } void ServerChannel::initCommitQueue() { #ifdef TEST *logofs << "initCommitQueue: Resetting the queue of split commits " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif for (int i = 0; i < MAX_COMMIT_SEQUENCE_QUEUE; i++) { commitSequenceQueue_[i] = 0; } } void ServerChannel::updateCommitQueue(unsigned short sequence) { for (int i = 0; i < MAX_COMMIT_SEQUENCE_QUEUE - 1; i++) { commitSequenceQueue_[i + 1] = commitSequenceQueue_[i]; } #ifdef TEST *logofs << "updateCommitQueue: Saved " << sequence << " as last sequence number of image to commit.\n" << logofs_flush; #endif commitSequenceQueue_[0] = sequence; } int ServerChannel::checkCommitError(unsigned char error, unsigned short sequence, const unsigned char *buffer) { // // Check if error is due to an image commit // generated at the end of a split. // // TODO: It should zero the head of the list // when an event comes with a sequence number // greater than the value of the last element // added. // for (int i = 0; i < MAX_COMMIT_SEQUENCE_QUEUE && commitSequenceQueue_[i] != 0; i++) { #ifdef TEST *logofs << "checkCommitError: Checking committed image's " << "sequence number " << commitSequenceQueue_[i] << " with input sequence " << sequence << ".\n" << logofs_flush; #endif if (commitSequenceQueue_[i] == sequence) { #ifdef WARNING *logofs << "checkCommitError: WARNING! Failed operation for " << "FD#" << fd_ << " with ERR_CODE#" << (unsigned int) *(buffer + 1); *logofs << " RES_ID#" << GetULONG(buffer + 4, bigEndian_); *logofs << " MIN_OP#" << GetUINT(buffer + 8, bigEndian_); *logofs << " MAJ_OP#" << (unsigned int) *(buffer + 10); *logofs << " sequence " << sequence << ".\n"; *logofs << logofs_flush; #endif cerr << "Warning" << ": Failed commit operation " << "with ERR_CODE#" << (unsigned int) error; cerr << " RES_ID#" << GetULONG(buffer + 4, bigEndian_); cerr << " MIN_OP#" << GetUINT(buffer + 8, bigEndian_); cerr << " MAJ_OP#" << (unsigned int) *(buffer + 10); cerr << ".\n"; #ifdef WARNING *logofs << "checkCommitError: WARNING! Suppressing error on " << "OPCODE#" << (unsigned int) opcodeStore_ -> commitSplit << " for FD#" << fd_ << " with sequence " << sequence << " at position " << i << ".\n" << logofs_flush; #endif return 0; } } return 0; } // // Check if the user pressed the CTRL+ALT+SHIFT+ESC // keystroke. At the present moment it uses different // keycodes based on the client OS. This should be // implemented in a way that is platform independent // (that's not an easy task, considered that we don't // have access to the higher level X libraries). // int ServerChannel::checkKeyboardEvent(unsigned char event, unsigned short sequence, const unsigned char *buffer) { #ifdef TEST *logofs << "checkKeyboardEvent: Checking escape sequence with byte [1] " << (void *) ((unsigned) *(buffer + 1)) << " and bytes [28-29] " << (void *) ((unsigned) GetUINT(buffer + 28, bigEndian_)) << " for FD#" << fd_ << ".\n" << logofs_flush; #endif #ifdef __APPLE__ int alert = (*(buffer + 1) == 0x3d && GetUINT(buffer + 28, bigEndian_) == 0x2005); #else int alert = (*(buffer + 1) == 0x09 && ((GetUINT(buffer + 28, bigEndian_) & 0x0d) == 0x0d)); #endif if (alert == 1) { #ifdef PANIC *logofs << "checkKeyboardEvent: PANIC! Received sequence " << "CTRL+ALT+SHIFT+ESC " << "for FD#"<< fd_ << ". Showing the abort dialog.\n" << logofs_flush; #endif cerr << "Warning" << ": Received sequence CTRL+ALT+SHIFT+ESC. " << "Showing the abort dialog.\n"; HandleAlert(CLOSE_UNRESPONSIVE_X_SERVER_ALERT, 1); } return alert; } // // Handle the MIT-SHM initialization // messages exchanged with the remote // proxy. // int ServerChannel::handleShmemReply(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned int stage, const unsigned char *buffer, const unsigned int size) { #ifdef TEST *logofs << "handleShmemReply: Returning shmem reply for " << "stage " << stage << ".\n" << logofs_flush; #endif if (opcode == X_QueryExtension) { encodeBuffer.encodeValue(stage, 2); #ifndef ANDROID shmemState_ -> present = *(buffer + 8); #else shmemState_ -> present = 0; cerr << "Info: handleShmemReply: In android no shared memory. Setting present to 0 hardcoded\n"; #endif shmemState_ -> opcode = *(buffer + 9); shmemState_ -> event = *(buffer + 10); shmemState_ -> error = *(buffer + 11); #ifdef TEST *logofs << "handleShmemReply: Extension present is " << shmemState_ -> present << " with base OPCODE#" << (unsigned int) shmemState_ -> opcode << " base event " << (unsigned int) shmemState_ -> event << " base error " << (unsigned int) shmemState_ -> error << ".\n" << logofs_flush; #endif } else if (opcode == X_GetInputFocus) { encodeBuffer.encodeValue(stage, 2); encodeBuffer.encodeBoolValue(0); if (shmemState_ -> present == 1 && shmemState_ -> address != NULL && shmemState_ -> segment > 0 && shmemState_ -> id > 0) { cerr << "Info" << ": Using shared memory parameters 1/" << (shmemState_ -> size / 1024) << "K.\n"; #ifndef ANDROID shmemState_ -> enabled = 1; #else cerr << "Info: handleShmemReply: In android no shared memory. Setting enabled to -1. This should not be displayed\n"; shmemState_ -> enabled = -1; #endif encodeBuffer.encodeBoolValue(1); } else { #ifdef TEST *logofs << "handleShmemReply: WARNING! Not using shared memory " << "support in X server for FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Info" << ": Using shared memory parameters 0/0K.\n"; handleShmemStateRemove(); encodeBuffer.encodeBoolValue(0); } } else { #ifdef PANIC *logofs << "handleShmemReply: PANIC! Conversation error " << "handling shared memory support for FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": Conversation error handling " << "shared memory support.\n"; return -1; } return 1; } int ServerChannel::handleShmemRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { // // We need to query and initialize MIT-SHM on // the real X server. To do this we'll need 3 // requests. At the end we'll have to encode // the final reply for the X client side. // handleShmemStateAlloc(); unsigned int stage; decodeBuffer.decodeValue(stage, 2); unsigned int expected = shmemState_ -> stage + 1; if (stage != expected || stage > 2) { #ifdef PANIC *logofs << "handleShmemRequest: PANIC! Unexpected stage " << stage << " in handling shared memory " << "support for FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": Unexpected stage " << stage << " in handling shared memory " << "support for FD#" << fd_ << ".\n"; return -1; } switch (stage) { case 0: { unsigned int enableClient; unsigned int enableServer; decodeBuffer.decodeBoolValue(enableClient); decodeBuffer.decodeBoolValue(enableServer); unsigned int clientSegment; unsigned int serverSegment; decodeBuffer.decodeValue(clientSegment, 29, 9); decodeBuffer.decodeValue(serverSegment, 29, 9); shmemState_ -> segment = serverSegment; #ifdef TEST *logofs << "handleShmemRequest: Size of the shared memory " << "segment will be " << control -> ShmemServerSize << ".\n" << logofs_flush; #endif #ifdef TEST *logofs << "handleShmemRequest: Sending X_QueryExtension request " << "for FD#" << fd_ << " due to OPCODE#" << (unsigned int) opcodeStore_ -> getShmemParameters << " in stage " << stage << ".\n" << logofs_flush; #endif opcode = X_QueryExtension; size = 16; buffer = writeBuffer_.addMessage(size); PutUINT(7, buffer + 4, bigEndian_); // // Simply make the query fail if shared // memory support is disabled by the // user. // #ifndef ANDROID if (control -> ShmemServer == 1 && control -> ShmemServerSize > 0 && enableServer == 1) { memcpy(buffer + 8, "MIT-SHM", 7); } else { memcpy(buffer + 8, "NO-MIT-", 7); } #else cerr << "Info: handleShmemRequest: In android no shared memory. Returning NO-MIT- answer\n"; memcpy(buffer + 8, "NO-MIT-", 7); #endif sequenceQueue_.push(clientSequence_, opcode, opcodeStore_ -> getShmemParameters, stage); // // Save the sequence number so we can // later identify any matching X error // received from server. // shmemState_ -> sequence = clientSequence_; break; } case 1: { if (shmemState_ -> present == 1) { // // Make the segment read-write for everybody on // Cygwin (to avoid any lack of support or any // performance issue) and on MacOS/X (where the // 0600 mask doesn't seem to work). // #if defined(__CYGWIN32__) || defined(__APPLE__) int permissions = 0777; #else int permissions = 0600; #endif shmemState_ -> size = control -> ShmemServerSize; #ifndef ANDROID shmemState_ -> id = shmget(IPC_PRIVATE, shmemState_ -> size, IPC_CREAT | permissions); #else cerr << "Info: handleShmemReqyest: In android no shared memory (shmget). This message should not be displayed present should never be 1 in android\n"; shmemState_ -> id = -1; #endif if (shmemState_ -> id >= 0) { #if defined(TEST) || defined(INFO) *logofs << "handleShmemRequest: Allocated shared memory " << "segment of " << shmemState_ -> size << " bytes with id " << shmemState_ -> id << ".\n" << logofs_flush; #endif #ifndef ANDROID shmemState_ -> address = shmat(shmemState_ -> id, 0, 0); #else cerr << "Info: handleShmemReqyest: In android no shared memory (shmat). This message should not be displayed. present should never be 1 in android\n"; shmemState_ -> address = NULL; #endif if (shmemState_ -> address != NULL) { #ifdef TEST *logofs << "handleShmemRequest: Sending X_ShmAttach request " << "for FD#" << fd_ << " due to OPCODE#" << (unsigned int) opcodeStore_ -> getShmemParameters << " in stage " << stage << ".\n" << logofs_flush; #endif opcode = shmemState_ -> opcode; size = 16; buffer = writeBuffer_.addMessage(size); *(buffer + 1) = X_ShmAttach; PutULONG(shmemState_ -> segment, buffer + 4, bigEndian_); PutULONG(shmemState_ -> id, buffer + 8, bigEndian_); *(buffer + 12) = 1; shmemState_ -> sequence = clientSequence_; break; } else { #ifdef WARNING *logofs << "handleShmemRequest: WARNING! Can't attach the shared " << "memory segment. Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Can't attach the shared memory " << "segment. Error is " << EGET() << " '" << ESTR() << "'.\n"; } } else { #ifndef __CYGWIN32__ #ifdef WARNING *logofs << "handleShmemRequest: WARNING! Can't create the shared " << "memory segment. Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Can't create the shared memory " << "segment. Error is " << EGET() << " '" << ESTR() << "'.\n"; #else #ifdef TEST *logofs << "handleShmemRequest: WARNING! Can't create the shared " << "memory segment. Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif #endif } } if (shmemState_ -> present != 0) { #ifdef TEST *logofs << "handleShmemRequest: Resetting shared memory " << "presence flag for FD#" << fd_ << ".\n" << logofs_flush; #endif shmemState_ -> present = 0; } handleNullRequest(opcode, buffer, size); break; } default: { #ifdef TEST *logofs << "handleShmemRequest: Sending X_GetInputFocus request " << "for FD#" << fd_ << " due to OPCODE#" << (unsigned int) opcodeStore_ -> getShmemParameters << " in stage " << stage << ".\n" << logofs_flush; #endif opcode = X_GetInputFocus; size = 4; buffer = writeBuffer_.addMessage(size); sequenceQueue_.push(clientSequence_, opcode, opcodeStore_ -> getShmemParameters, stage); break; } } shmemState_ -> stage += 1; return 1; } // // Handling of MIT-SHM extension has been plugged late in // the design, so we have to make some assumptions. Image // is a X_PutImage request contained either in the scratch // buffer or in the normal write buffer. We need to move // the image data to the shared memory segment and replace // the X_PutImage request with a X_ShmPutImage. // int ServerChannel::handleShmem(unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { if (shmemState_ == NULL || shmemState_ -> enabled != 1) { #ifdef TEST if (shmemState_ != NULL) { *logofs << "handleShmem: PANIC! Shared memory " << "state found but support is not enabled " << "for FD#" << fd_ << " in stage " << shmemState_ -> stage << ".\n" << logofs_flush; } #endif return 0; } #ifdef ANDROID cerr << "Info: handleShmem: In android no shared memory. enabled should never be 1. This should not be displayed\n"; return 0; #endif // // Ignore null requests and requests that will not result // in a single X_PutImage. To conform with the other func- // tions, we get the opcode passed as a parameter. It can // be zero if we don't want the write loop to put opcode // and length in the resulting buffer. Anyway we are only // interested in the original opcode of the request, that // is stored in the image state. // unsigned char *dstData = buffer + 24; unsigned int dstDataSize = size - 24; if (dstDataSize == 0 || dstDataSize > (unsigned int) control -> MaximumRequestSize) { #ifdef TEST *logofs << "handleShmem: Ignoring image with opcode " << (unsigned int) imageState_ -> opcode << " and size " << size << " for FD#" << fd_ << ".\n" << logofs_flush; #endif return 0; } #ifdef TEST *logofs << "handleShmem: Handling image with opcode " << (unsigned int) imageState_ -> opcode << " and size " << size << " for FD#" << fd_ << ".\n" << logofs_flush; #endif // // Get image data from buffer. // if (imageState_ -> opcode == X_PutImage) { // // We still need to get the image's data. // imageState_ -> format = *(buffer + 1); imageState_ -> drawable = GetULONG(buffer + 4, bigEndian_); imageState_ -> gcontext = GetULONG(buffer + 8, bigEndian_); imageState_ -> dstWidth = GetUINT(buffer + 12, bigEndian_); imageState_ -> dstHeight = GetUINT(buffer + 14, bigEndian_); imageState_ -> srcX = 0; imageState_ -> srcY = 0; imageState_ -> srcWidth = imageState_ -> dstWidth; imageState_ -> srcHeight = imageState_ -> dstHeight; imageState_ -> dstX = GetUINT(buffer + 16, bigEndian_); imageState_ -> dstY = GetUINT(buffer + 18, bigEndian_); imageState_ -> leftPad = *(buffer + 20); imageState_ -> dstDepth = *(buffer + 21); imageState_ -> dstLines = imageState_ -> dstHeight; imageState_ -> dstLength = size - 24; } // // Skip the MIT-SHM operation if the image // is 1 bits-per-plane. // if (imageState_ -> dstDepth == 1) { #if defined(TEST) || defined(INFO) *logofs << "handleShmem: Ignoring image with opcode " << (unsigned int) imageState_ -> opcode << " depth " << (unsigned int) imageState_ -> dstDepth << " and " << "size " << size << " for FD#" << fd_ << ".\n" << logofs_flush; #endif return 0; } // // If the image can't fit in the available // space, check if the completion event is // arrived. // #if defined(TEST) || defined(INFO) if (isTimestamp(shmemState_ -> last) == 0 && shmemState_ -> offset != 0) { *logofs << "handleShmem: PANIC! No timestamp for sequence " << shmemState_ -> sequence << " with offset " << shmemState_ -> offset << ".\n" << logofs_flush; } #endif if (shmemState_ -> offset + imageState_ -> dstLength > shmemState_ -> size) { if (imageState_ -> dstLength > shmemState_ -> size) { #if defined(TEST) || defined(INFO) *logofs << "handleShmem: WARNING! Can't fit the image " << "in the available memory segment for FD#" << fd_ << ".\n" << logofs_flush; #endif return 0; } else if (handleShmemEvent() <= 0) { #if defined(TEST) || defined(INFO) *logofs << "handleShmem: WARNING! Missing completion " << "after " << diffTimestamp(shmemState_ -> last, getTimestamp()) << " ms for shared memory " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif return 0; } } // // Let image start at current offset // in the shared segment. // #ifdef TEST *logofs << "handleShmem: Copying " << dstDataSize << " bytes to shared memory at offset " << shmemState_ -> offset << " for FD#" << fd_ << ".\n" << logofs_flush; #endif memcpy((unsigned char *) shmemState_ -> address + shmemState_ -> offset, dstData, dstDataSize); // // Get rid of the original X_PutImage // request. // if (writeBuffer_.getScratchData() != NULL) { writeBuffer_.removeScratchMessage(); } else { writeBuffer_.removeMessage(size); } // // Add a X_ShmPutImage request to the // write buffer. // buffer = writeBuffer_.addMessage(40); *buffer = shmemState_ -> opcode; *(buffer + 1) = X_ShmPutImage; PutUINT(40 >> 2, buffer + 2, bigEndian_); PutULONG(imageState_ -> drawable, buffer + 4, bigEndian_); PutULONG(imageState_ -> gcontext, buffer + 8, bigEndian_); PutUINT(imageState_ -> dstWidth, buffer + 12, bigEndian_); PutUINT(imageState_ -> dstLines, buffer + 14, bigEndian_); PutUINT(imageState_ -> srcX, buffer + 16, bigEndian_); PutUINT(imageState_ -> srcY, buffer + 18, bigEndian_); PutUINT(imageState_ -> dstWidth, buffer + 20, bigEndian_); PutUINT(imageState_ -> dstLines, buffer + 22, bigEndian_); PutUINT(imageState_ -> dstX, buffer + 24, bigEndian_); PutUINT(imageState_ -> dstY, buffer + 26, bigEndian_); *(buffer + 28) = imageState_ -> dstDepth; *(buffer + 29) = imageState_ -> format; *(buffer + 30) = 1; PutULONG(shmemState_ -> segment, buffer + 32, bigEndian_); PutULONG(shmemState_ -> offset, buffer + 36, bigEndian_); shmemState_ -> offset += dstDataSize; shmemState_ -> sequence = clientSequence_; shmemState_ -> last = getTimestamp(); #ifdef TEST *logofs << "handleShmem: Saved shared memory sequence " << shmemState_ -> sequence << " for FD#" << fd_ << " with offset " << shmemState_ -> offset << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif // // Make the X server read immediately // from the shared memory buffer and // produce the completion event. // handleFlush(flush_if_any); return 1; } // // Try to read more events from the socket in the // attempt to get the completion event required // to reset the MIT-SHM segment. // int ServerChannel::handleShmemEvent() { #if defined(TEST) || defined(INFO) *logofs << "handleShmemEvent: Waiting for shared memory " << "sequence " << shmemState_ -> sequence << " for X server FD#" << fd_ << ".\n" << logofs_flush; T_timestamp startTs = getTimestamp(); #endif while (isTimestamp(shmemState_ -> last) != 0) { if (handleWait(control -> ShmemTimeout) <= 0) { break; } #if defined(TEST) || defined(INFO) else { *logofs << "handleShmemEvent: WARNING! Encoded events " << "for FD#" << fd_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; } #endif } if (isTimestamp(shmemState_ -> last) == 0) { #if defined(TEST) || defined(INFO) *logofs << "handleShmemEvent: Spent " << diffTimestamp(startTs, getTimestamp()) << " ms " << "waiting for shared memory sequence for FD#" << fd_ << ".\n" << logofs_flush; #endif return 1; } #if defined(TEST) || defined(INFO) *logofs << "handleShmemEvent: WARNING! Can't reset shared " << "memory sequence for FD#" << fd_ << " after " << diffTimestamp(shmemState_ -> last, getTimestamp()) << " ms.\n" << logofs_flush; #endif return 0; } int ServerChannel::checkShmemEvent(unsigned char event, unsigned short sequence, const unsigned char *buffer) { if (isTimestamp(shmemState_ -> last) == 1 && sequence == shmemState_ -> sequence) { #ifdef TEST *logofs << "checkShmemEvent: Reset shared memory sequence " << shmemState_ -> sequence << " for FD#" << fd_ << " after " << diffTimestamp(shmemState_ -> last, getTimestamp()) << " ms.\n" << logofs_flush; #endif shmemState_ -> sequence = 0; shmemState_ -> offset = 0; shmemState_ -> last = nullTimestamp(); } #ifdef TEST else { *logofs << "checkShmemEvent: Skipping past shared memory " << "image sequence " << sequence << " for FD#" << fd_ << ".\n" << logofs_flush; } #endif return 1; } int ServerChannel::checkShmemError(unsigned char error, unsigned short sequence, const unsigned char *buffer) { #ifdef TEST *logofs << "checkShmemError: WARNING! Failed operation for " << "FD#" << fd_ << " in stage " << shmemState_ -> stage << " with ERR_CODE#" << (unsigned int) *(buffer + 1); *logofs << " RES_ID#" << GetULONG(buffer + 4, bigEndian_); *logofs << " MIN_OP#" << GetUINT(buffer + 8, bigEndian_); *logofs << " MAJ_OP#" << (unsigned int) *(buffer + 10); *logofs << " sequence " << sequence << ".\n"; *logofs << logofs_flush; #endif // // If enabled flag is <= 0 we are still // in the inizialization phase. In this // case force presence to false. // if (shmemState_ -> enabled != 1) { if (shmemState_ -> present != 0) { #ifdef TEST *logofs << "checkShmemError: Resetting shared memory " << "presence flag for FD#" << fd_ << ".\n" << logofs_flush; #endif shmemState_ -> present = 0; } return 0; } if (shmemState_ -> sequence == sequence) { // // Reset the sequence and timestamp. // shmemState_ -> sequence = 0; shmemState_ -> offset = 0; shmemState_ -> last = nullTimestamp(); } return 1; } int ServerChannel::handleFontRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { // // Send a synchronization request and use // the reply to return the requested font // path. // #ifdef TEST *logofs << "handleFontRequest: Sending X_GetInputFocus request " << "for FD#" << fd_ << " due to OPCODE#" << (unsigned int) opcodeStore_ -> getFontParameters << ".\n" << logofs_flush; #endif opcode = X_GetInputFocus; size = 4; buffer = writeBuffer_.addMessage(size); sequenceQueue_.push(clientSequence_, X_GetInputFocus, opcodeStore_ -> getFontParameters); return 1; } int ServerChannel::handleFontReply(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size) { #ifdef TEST *logofs << "handleFontReply: Encoding font operation " << "reply with size " << size << ".\n" << logofs_flush; #endif char data[256]; if (fontPort_ != -1) { sprintf(data + 1, "tcp/localhost:%d", fontPort_); } else { *(data + 1) = '\0'; } *data = strlen(data + 1); unsigned char *next = (unsigned char *) data; unsigned int length = (unsigned int) (*next++); encodeBuffer.encodeValue(length, 8); encodeBuffer.encodeTextData(next, length); return 1; } int ServerChannel::handleCacheRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { unsigned int mask; decodeBuffer.decodeCachedValue(mask, 32, clientCache_ -> setCacheParametersCache); splitState_.save = (mask >> 8) & 0xff; splitState_.load = mask & 0xff; #ifdef TEST *logofs << "handleCacheRequest: Set cache parameters to " << "save " << splitState_.save << " load " << splitState_.load << ".\n" << logofs_flush; #endif handleNullRequest(opcode, buffer, size); return 1; } int ServerChannel::handleStartSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { // // Prepare for the split for the selected // resource. Old proxy versions only used // the split store at position 0. // // Since ProtoStep7 (#issue 108) unsigned char resource; decodeBuffer.decodeCachedValue(resource, 8, clientCache_ -> resourceCache); splitState_.resource = resource; splitState_.current = splitState_.resource; #if defined(TEST) || defined(SPLIT) *logofs << "handleStartSplitRequest: SPLIT! Registered id " << splitState_.resource << " as resource " << "waiting for a split.\n" << logofs_flush; #endif handleNullRequest(opcode, buffer, size); return 1; } int ServerChannel::handleEndSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size) { // // Verify that the agent resource matches. // // Since ProtoStep7 (#issue 108) unsigned char resource; decodeBuffer.decodeCachedValue(resource, 8, clientCache_ -> resourceCache); #ifdef TEST if (splitState_.resource == nothing) { #ifdef PANIC *logofs << "handleEndSplitRequest: PANIC! SPLIT! Received an end of " << "split for resource id " << (unsigned int) *(buffer + 1) << " without a previous start.\n" << logofs_flush; #endif HandleCleanup(); } else if (resource != splitState_.resource) { #ifdef PANIC *logofs << "handleEndSplitRequest: PANIC! SPLIT! Invalid resource id " << resource << " received while waiting for resource id " << splitState_.resource << ".\n" << logofs_flush; #endif HandleCleanup(); } #endif #if defined(TEST) || defined(SPLIT) *logofs << "handleEndSplitRequest: SPLIT! Reset id " << splitState_.resource << " as resource " << "selected for splits.\n" << logofs_flush; #endif splitState_.resource = nothing; handleNullRequest(opcode, buffer, size); return 1; } int ServerChannel::handleSplitChecksum(DecodeBuffer &decodeBuffer, T_checksum &checksum) { unsigned int receive; // Since ProtoStep7 (#issue 108) decodeBuffer.decodeBoolValue(receive); if (receive == 1) { checksum = new md5_byte_t[MD5_LENGTH]; for (unsigned int i = 0; i < MD5_LENGTH; i++) { decodeBuffer.decodeValue(receive, 8); if (checksum != NULL) { checksum[i] = (unsigned char) receive; } } #if defined(TEST) || defined(SPLIT) *logofs << "handleSplitChecksum: SPLIT! Received checksum " << "[" << DumpChecksum(checksum) << "].\n" << logofs_flush; #endif return 1; } return 0; } void ServerChannel::handleShmemStateAlloc() { if (shmemState_ == NULL) { shmemState_ = new T_shmem_state(); shmemState_ -> stage = -1; shmemState_ -> present = -1; shmemState_ -> enabled = -1; shmemState_ -> segment = -1; shmemState_ -> id = -1; shmemState_ -> address = NULL; shmemState_ -> size = 0; shmemState_ -> opcode = 0xff; shmemState_ -> event = 0xff; shmemState_ -> error = 0xff; shmemState_ -> sequence = 0; shmemState_ -> offset = 0; shmemState_ -> last = nullTimestamp(); shmemState_ -> checked = 0; } } void ServerChannel::handleShmemStateRemove() { if (shmemState_ != NULL) { if (shmemState_ -> address != NULL) { #ifndef ANDROID shmdt((char *) shmemState_ -> address); #else cerr << "Info: handleShmemStateRemove: In android no shared memory. This should not be displayed. address should always be NULL\n"; #endif } if (shmemState_ -> id > 0) { #ifndef ANDROID shmctl(shmemState_ -> id, IPC_RMID, 0); #else cerr << "Info: handleShmemStateRemove: In android no shared memory. This should not be displayed. id should always be 0\n"; #endif } delete shmemState_; shmemState_ = NULL; } } void ServerChannel::handleUnpackStateInit(int resource) { if (unpackState_[resource] == NULL) { unpackState_[resource] = new T_unpack_state(); if (unpackState_[resource] == NULL) { #ifdef PANIC *logofs << "handleUnpackStateInit: PANIC! Can't allocate " << "memory for unpack state in context [A].\n" << logofs_flush; #endif cerr << "Error" << ": Can't allocate memory for " << "unpack state in context [A].\n"; HandleAbort(); } unpackState_[resource] -> geometry = NULL; unpackState_[resource] -> colormap = NULL; unpackState_[resource] -> alpha = NULL; } } void ServerChannel::handleUnpackAllocGeometry(int resource) { if (unpackState_[resource] -> geometry == NULL) { unpackState_[resource] -> geometry = new T_geometry(); if (unpackState_[resource] -> geometry == NULL) { #ifdef PANIC *logofs << "handleUnpackAllocGeometry: PANIC! Can't allocate " << "memory for unpack state in context [B].\n" << logofs_flush; #endif cerr << "Error" << ": Can't allocate memory for " << "unpack state in context [B].\n"; HandleAbort(); } unpackState_[resource] -> geometry -> depth1_bpp = 4; unpackState_[resource] -> geometry -> depth4_bpp = 4; unpackState_[resource] -> geometry -> depth8_bpp = 8; unpackState_[resource] -> geometry -> depth16_bpp = 16; unpackState_[resource] -> geometry -> depth24_bpp = 32; unpackState_[resource] -> geometry -> depth32_bpp = 32; unpackState_[resource] -> geometry -> red_mask = 0xff0000; unpackState_[resource] -> geometry -> green_mask = 0x00ff00; unpackState_[resource] -> geometry -> blue_mask = 0x0000ff; unpackState_[resource] -> geometry -> image_byte_order = imageByteOrder_; unpackState_[resource] -> geometry -> bitmap_bit_order = bitmapBitOrder_; unpackState_[resource] -> geometry -> scanline_unit = scanlineUnit_; unpackState_[resource] -> geometry -> scanline_pad = scanlinePad_; } } void ServerChannel::handleUnpackAllocColormap(int resource) { if (unpackState_[resource] -> colormap == NULL) { unpackState_[resource] -> colormap = new T_colormap(); if (unpackState_[resource] -> colormap == NULL) { #ifdef PANIC *logofs << "handleUnpackAllocColormap: PANIC! Can't allocate " << "memory for unpack state in context [C].\n" << logofs_flush; #endif cerr << "Error" << ": Can't allocate memory for " << "unpack state in context [C].\n"; HandleAbort(); } unpackState_[resource] -> colormap -> entries = 0; unpackState_[resource] -> colormap -> data = NULL; } } void ServerChannel::handleUnpackAllocAlpha(int resource) { if (unpackState_[resource] -> alpha == NULL) { unpackState_[resource] -> alpha = new T_alpha(); if (unpackState_[resource] -> alpha == NULL) { #ifdef PANIC *logofs << "handleUnpackAllocAlpha: PANIC! Can't allocate " << "memory for unpack state in context [D].\n" << logofs_flush; #endif cerr << "Error" << ": Can't allocate memory for " << "unpack state in context [D].\n"; HandleAbort(); } unpackState_[resource] -> alpha -> entries = 0; unpackState_[resource] -> alpha -> data = NULL; } } void ServerChannel::handleUnpackStateRemove(int resource) { if (unpackState_[resource] != NULL) { delete unpackState_[resource] -> geometry; if (unpackState_[resource] -> colormap != NULL) { delete [] unpackState_[resource] -> colormap -> data; } delete unpackState_[resource] -> colormap; if (unpackState_[resource] -> alpha != NULL) { delete [] unpackState_[resource] -> alpha -> data; } delete unpackState_[resource] -> alpha; delete unpackState_[resource]; unpackState_[resource] = NULL; } } void ServerChannel::handleEncodeCharInfo(const unsigned char *nextSrc, EncodeBuffer &encodeBuffer) { unsigned int value = GetUINT(nextSrc, bigEndian_) | (GetUINT(nextSrc + 10, bigEndian_) << 16); encodeBuffer.encodeCachedValue(value, 32, *serverCache_ -> queryFontCharInfoCache[0], 6); nextSrc += 2; for (unsigned int i = 1; i < 5; i++) { unsigned int _value = GetUINT(nextSrc, bigEndian_); nextSrc += 2; encodeBuffer.encodeCachedValue(_value, 16, *serverCache_ -> queryFontCharInfoCache[i], 6); } } int ServerChannel::setBigEndian(int flag) { bigEndian_ = flag; readBuffer_.setBigEndian(flag); return 1; } int ServerChannel::setReferences() { #ifdef TEST *logofs << "ServerChannel: Initializing the static " << "members for the server channels.\n" << logofs_flush; #endif #ifdef REFERENCES references_ = 0; #endif return 1; } nx-libs-3.5.99.23/nxcomp/src/ServerChannel.h0000644000000000000000000003123413614532331015315 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ServerChannel_H #define ServerChannel_H #include "List.h" #include "Channel.h" #include "SequenceQueue.h" #include "ServerReadBuffer.h" #include "Unpack.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // How many sequence numbers of split commit // requests we are going to save in order to // mask errors. // #define MAX_COMMIT_SEQUENCE_QUEUE 16 // // Define this to know when a channel // is created or destroyed. // #undef REFERENCES // // This class implements the X server // side compression of X protocol. // class ServerChannel : public Channel { public: ServerChannel(Transport *transport, StaticCompressor *compressor); virtual ~ServerChannel(); virtual int handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, unsigned int length); virtual int handleWrite(const unsigned char *message, unsigned int length); virtual int handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, T_store_action action, int position, const unsigned char opcode, const unsigned char *buffer, const unsigned int size) { return 0; } virtual int handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, T_store_action action, int position, unsigned char &opcode, unsigned char *&buffer, unsigned int &size); virtual int handleSplit(EncodeBuffer &encodeBuffer) { return 0; } virtual int handleSplit(DecodeBuffer &decodeBuffer); virtual int handleSplitEvent(EncodeBuffer &encodeBuffer, Split *split); virtual int handleSplitEvent(DecodeBuffer &decodeBuffer) { return 0; } // // Send the last motion notify event // received from the X server to the // remote proxy. // virtual int handleMotion(EncodeBuffer &encodeBuffer); virtual int handleCompletion(EncodeBuffer &encodeBuffer) { return 0; } virtual int handleConfiguration(); virtual int handleFinish(); virtual int handleAsyncEvents(); virtual int needSplit() const { return 0; } virtual int needMotion() const { return (lastMotion_[0] != '\0'); } virtual T_channel_type getType() const { return channel_x11; } int setBigEndian(int flag); // // Initialize the static members. // static int setReferences(); private: int handleFastReadReply(EncodeBuffer &encodeBuffer, const unsigned char &opcode, const unsigned char *&buffer, const unsigned int &size); int handleFastReadEvent(EncodeBuffer &encodeBuffer, const unsigned char &opcode, const unsigned char *&buffer, const unsigned int &size); int handleFastWriteRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size); // // Handle the fake authorization cookie // and the X server's reply. // int handleAuthorization(unsigned char *buffer); int handleAuthorization(const unsigned char *buffer, int size); // // Set the unpack colormap and the alpha // blending data to be used to unpack // images. // int handleGeometry(unsigned char &opcode, unsigned char *&buffer, unsigned int &size); int handleColormap(unsigned char &opcode, unsigned char *&buffer, unsigned int &size); int handleAlpha(unsigned char &opcode, unsigned char *&buffer, unsigned int &size); // // Manage the decoded buffer to unpack // the image and move the data to the // shared memory segment. // int handleImage(unsigned char &opcode, unsigned char *&buffer, unsigned int &size); // // Uncompress a packed image in one // or more graphic X requests. // int handleUnpack(unsigned char &opcode, unsigned char *&buffer, unsigned int &size); // // Move the image to the shared // memory buffer. // int handleShmem(unsigned char &opcode, unsigned char *&buffer, unsigned int &size); // // Handle suppression of error on // commit of image splits. // void initCommitQueue(); void updateCommitQueue(unsigned short sequence); int checkCommitError(unsigned char error, unsigned short sequence, const unsigned char *buffer); void clearCommitQueue() { if (commitSequenceQueue_[0] != 0) { initCommitQueue(); } } // // Check if the user pressed the // CTRL+ALT+SHIFT+ESC keystroke. // int checkKeyboardEvent(unsigned char event, unsigned short sequence, const unsigned char *buffer); // // Other utilities. // void handleEncodeCharInfo(const unsigned char *nextSrc, EncodeBuffer &encodeBuffer); // // Handle the MIT-SHM initialization // messages exchanged with the remote // proxy. // int handleShmemRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size); int handleShmemReply(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned int stage, const unsigned char *buffer, const unsigned int size); // // Try to read more events in the attempt to // get the MIT-SHM image completion event // from the X server. // int handleShmemEvent(); // // Handle the MIT-SHM events as they are read // from the socket. // int checkShmemEvent(unsigned char event, unsigned short sequence, const unsigned char *buffer); int checkShmemError(unsigned char error, unsigned short sequence, const unsigned char *buffer); // // Query the port used to tunnel // the font server connections. // int handleFontRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size); int handleFontReply(EncodeBuffer &encodeBuffer, const unsigned char opcode, const unsigned char *buffer, const unsigned int size); // // Set the cache policy for image // requests. // int handleCacheRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size); // // Decode the start and end split // requests. // int handleStartSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size); int handleEndSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size); // // Remove the split store and the // incomplete messages from the // memory cache. // int handleAbortSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size); // // Send the split requests to the // X server once they have been // recomposed. // int handleCommitSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, unsigned char *&buffer, unsigned int &size); int handleSplitChecksum(DecodeBuffer &decodeBuffer, T_checksum &checksum); // // Allocate and free the shared memory // support resources. // void handleShmemStateAlloc(); void handleShmemStateRemove(); // // Temporary storage for the image info. // void handleImageStateAlloc(unsigned char opcode) { if (imageState_ == NULL) { imageState_ = new T_image_state(); } imageState_ -> opcode = opcode; } void handleImageStateRemove() { if (imageState_ != NULL) { delete imageState_; imageState_ = NULL; } } // // Store the information needed to unpack // images per each known agent's client. // void handleUnpackStateInit(int resource); void handleUnpackAllocGeometry(int resource); void handleUnpackAllocColormap(int resource); void handleUnpackAllocAlpha(int resource); void handleUnpackStateRemove(int resource); typedef struct { T_geometry *geometry; T_colormap *colormap; T_alpha *alpha; } T_unpack_state; T_unpack_state *unpackState_[256]; // // Own read buffer. It is able to identify // full messages read from X descriptor. // ServerReadBuffer readBuffer_; // // Sequence number of last request coming // from X client or X server. // unsigned int clientSequence_; unsigned int serverSequence_; // // Used to identify replies based on sequence // number of original request. // SequenceQueue sequenceQueue_; // // Last motion notify read from the X server. // unsigned char lastMotion_[32]; // // Sequence numbers of last auto-generated // put image requests. Needed to intercept // and suppress errors generated by such // requests. // unsigned int commitSequenceQueue_[MAX_COMMIT_SEQUENCE_QUEUE]; // // Let agent select which expose // events is going to receive. // unsigned int enableExpose_; unsigned int enableGraphicsExpose_; unsigned int enableNoExpose_; // // Used in initialization and handling // of MIT-SHM shared memory put images. // typedef struct { int stage; int present; int enabled; int segment; int id; void *address; unsigned int size; unsigned char opcode; unsigned char event; unsigned char error; unsigned int sequence; unsigned int offset; T_timestamp last; unsigned int checked; } T_shmem_state; T_shmem_state *shmemState_; // // Used to pass current image data between // the different decompression stages. // typedef struct { unsigned char opcode; unsigned int drawable; unsigned int gcontext; unsigned char method; unsigned char format; unsigned char srcDepth; unsigned char dstDepth; unsigned int srcLength; unsigned int dstLength; unsigned int dstLines; short int srcX; short int srcY; unsigned short srcWidth; unsigned short srcHeight; short int dstX; short int dstY; unsigned short dstWidth; unsigned short dstHeight; unsigned char leftPad; } T_image_state; T_image_state *imageState_; // // The flags is set according to the // split load and save policy set by // the encoding side. // typedef struct { int resource; int current; int load; int save; int commit; } T_split_state; T_split_state splitState_; // // List of agent resources. // List splitResources_; // // Keep track of object creation and // deletion. // private: #ifdef REFERENCES static int references_; #endif }; #endif /* ServerChannel_H */ nx-libs-3.5.99.23/nxcomp/src/ServerProxy.cpp0000644000000000000000000003713213614532331015424 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "NXalert.h" #include "Socket.h" #include "ServerProxy.h" #include "ServerChannel.h" #include "GenericChannel.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Log the operations related to sending // and receiving the control tokens. // #undef TOKEN ServerProxy::ServerProxy(int proxyFd) : Proxy(proxyFd) { xServerAddrFamily_ = -1; xServerAddrLength_ = 0; xServerAddr_ = NULL; xServerDisplay_ = NULL; cupsServerPort_ = NULL; smbServerPort_ = NULL; mediaServerPort_ = NULL; httpServerPort_ = NULL; fontServerPort_ = NULL; #ifdef DEBUG *logofs << "ServerProxy: Created new object at " << this << ".\n" << logofs_flush; #endif } ServerProxy::~ServerProxy() { delete xServerAddr_; delete [] xServerDisplay_; delete [] fontServerPort_; #ifdef DEBUG *logofs << "ServerProxy: Deleted object at " << this << ".\n" << logofs_flush; #endif } void ServerProxy::handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, sockaddr *xServerAddr, unsigned int xServerAddrLength) { delete xServerAddr_; xServerAddr_ = xServerAddr; xServerAddrFamily_ = xServerAddrFamily; xServerAddrLength_ = xServerAddrLength; delete [] xServerDisplay_; xServerDisplay_ = new char[strlen(xServerDisplay) + 1]; strcpy(xServerDisplay_, xServerDisplay); #ifdef DEBUG *logofs << "ServerProxy: Set display configuration to display '" << xServerDisplay_ << "'.\n" << logofs_flush; #endif } void ServerProxy::handlePortConfiguration(ChannelEndPoint &cupsServerPort, ChannelEndPoint &smbServerPort, ChannelEndPoint &mediaServerPort, ChannelEndPoint &httpServerPort, const char *fontServerPort) { cupsServerPort_ = cupsServerPort; smbServerPort_ = smbServerPort; mediaServerPort_ = mediaServerPort; httpServerPort_ = httpServerPort; delete [] fontServerPort_; fontServerPort_ = new char[strlen(fontServerPort) + 1]; strcpy(fontServerPort_, fontServerPort); #ifdef DEBUG *logofs << "ServerProxy: Set port configuration to CUPS " << cupsServerPort_ << ", SMB " << smbServerPort_ << ", media " << mediaServerPort_ << ", HTTP " << httpServerPort_ << ".\n" << logofs_flush; #endif } int ServerProxy::handleNewConnection(T_channel_type type, int clientFd) { switch (type) { case channel_font: { return handleNewGenericConnection(clientFd, channel_font, "font"); } case channel_slave: { return handleNewSlaveConnection(clientFd); } default: { #ifdef PANIC *logofs << "ServerProxy: PANIC! Unsupported channel with type '" << getTypeName(type) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Unsupported channel with type '" << getTypeName(type) << "'.\n"; return -1; } } } int ServerProxy::handleNewConnectionFromProxy(T_channel_type type, int channelId) { switch (type) { case channel_x11: { return handleNewXConnectionFromProxy(channelId); } case channel_cups: { return handleNewGenericConnectionFromProxy(channelId, channel_cups, cupsServerPort_, "CUPS"); } case channel_smb: { smbServerPort_.setDefaultTCPInterface(1); return handleNewGenericConnectionFromProxy(channelId, channel_smb, smbServerPort_, "SMB"); } case channel_media: { return handleNewGenericConnectionFromProxy(channelId, channel_media, mediaServerPort_, "media"); } case channel_http: { return handleNewGenericConnectionFromProxy(channelId, channel_http, httpServerPort_, "HTTP"); } case channel_slave: { return handleNewSlaveConnectionFromProxy(channelId); } default: { #ifdef PANIC *logofs << "ServerProxy: PANIC! Unsupported channel with type '" << getTypeName(type) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Unsupported channel with type '" << getTypeName(type) << "'.\n"; return -1; } } } int ServerProxy::handleNewAgentConnection(Agent *agent) { #ifdef PANIC *logofs << "ServerProxy: PANIC! Can't create an agent " << "connection at this side.\n" << logofs_flush; #endif cerr << "Error" << ": Can't create an agent " << "connection at this side.\n"; return -1; } int ServerProxy::handleNewXConnection(int clientFd) { #ifdef PANIC *logofs << "ServerProxy: PANIC! Can't create a new X channel " << "with FD#" << clientFd << " at this side.\n" << logofs_flush; #endif cerr << "Error" << ": Can't create a new X channel " << "with FD#" << clientFd << " at this side.\n"; return -1; } int ServerProxy::handleNewXConnectionFromProxy(int channelId) { // // Connect to the real X server. // int retryConnect = control -> OptionServerRetryConnect; int xServerFd; for (;;) { xServerFd = socket(xServerAddrFamily_, SOCK_STREAM, PF_UNSPEC); if (xServerFd < 0) { #ifdef PANIC *logofs << "ServerProxy: PANIC! Call to socket failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Call to socket failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n"; return -1; } #ifdef TEST *logofs << "ServerProxy: Trying to connect to X server '" << xServerDisplay_ << "'.\n" << logofs_flush; #endif int result = connect(xServerFd, xServerAddr_, xServerAddrLength_); getNewTimestamp(); if (result < 0) { #ifdef WARNING *logofs << "ServerProxy: WARNING! Connection to '" << xServerDisplay_ << "' failed with error '" << ESTR() << "'. Retrying.\n" << logofs_flush; #endif close(xServerFd); if (--retryConnect == 0) { #ifdef PANIC *logofs << "ServerProxy: PANIC! Connection to '" << xServerDisplay_ << "' for channel ID#" << channelId << " failed. Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Connection to '" << xServerDisplay_ << "' failed. Error is " << EGET() << " '" << ESTR() << "'.\n"; close(xServerFd); return -1; } if (activeChannels_.getSize() == 0) { sleep(2); } else { sleep(1); } } else { break; } } assignChannelMap(channelId, xServerFd); #ifdef TEST *logofs << "ServerProxy: X server descriptor FD#" << xServerFd << " mapped to channel ID#" << channelId << ".\n" << logofs_flush; #endif // // Turn queuing off for path proxy-to-X-server. // if (control -> OptionServerNoDelay == 1) { SetNoDelay(xServerFd, control -> OptionServerNoDelay); } // // If requested, set the size of the TCP send // and receive buffers. // if (control -> OptionServerSendBuffer != -1) { SetSendBuffer(xServerFd, control -> OptionServerSendBuffer); } if (control -> OptionServerReceiveBuffer != -1) { SetReceiveBuffer(xServerFd, control -> OptionServerReceiveBuffer); } if (allocateTransport(xServerFd, channelId) < 0) { return -1; } // // Starting from protocol level 3 client and server // caches are created in proxy and shared between all // channels. If remote proxy has older protocol level // pointers are NULL and channels must create their // own instances. // channels_[channelId] = new ServerChannel(transports_[channelId], compressor_); if (channels_[channelId] == NULL) { deallocateTransport(channelId); return -1; } increaseChannels(channelId); // // Propagate channel stores and caches to the new // channel. // channels_[channelId] -> setOpcodes(opcodeStore_); channels_[channelId] -> setStores(clientStore_, serverStore_); channels_[channelId] -> setCaches(clientCache_, serverCache_); int port = atoi(fontServerPort_); if (port > 0) { channels_[channelId] -> setPorts(port); } // // Let channel configure itself according // to control parameters. // channels_[channelId] -> handleConfiguration(); // // Check if we have successfully loaded the // selected cache and, if not, remove it // from disk. // handleCheckLoad(); return 1; } // // Check if we still need to drop a channel. We need // to check this explicitly at the time we receive a // request to load or save the cache because we could // receive the control message before having entered // the function handling the channel events. // int ServerProxy::handleCheckDrop() { T_list channelList = activeChannels_.copyList(); for (T_list::iterator j = channelList.begin(); j != channelList.end(); j++) { int channelId = *j; if (channels_[channelId] != NULL && (channels_[channelId] -> getDrop() == 1 || channels_[channelId] -> getClosing() == 1)) { #ifdef TEST *logofs << "ServerProxy: Dropping the descriptor FD#" << getFd(channelId) << " channel ID#" << channelId << ".\n" << logofs_flush; #endif handleDrop(channelId); } } return 1; } int ServerProxy::handleCheckLoad() { // // Check if we just created the first X channel // but the client side didn't tell us to load // the cache selected at the session negotiation. // This is very likely because the load operation // failed at the remote side, for example because // the cache was invalid or corrupted. // int channelCount = getChannels(channel_x11); if (channelCount != 1) { return 0; } if (control -> PersistentCacheEnableLoad == 1 && control -> PersistentCachePath != NULL && control -> PersistentCacheName != NULL && isTimestamp(timeouts_.loadTs) == 0) { #ifdef WARNING *logofs << "ServerProxy: WARNING! Cache file '" << control -> PersistentCachePath << "/" << control -> PersistentCacheName << "' not loaded.\n" << logofs_flush; #endif // // Remove the cache file. // #ifdef WARNING *logofs << "ServerProxy: WARNING! Removing supposedly " << "incompatible cache '" << control -> PersistentCachePath << "/" << control -> PersistentCacheName << "'.\n" << logofs_flush; #endif handleResetPersistentCache(); } return 1; } int ServerProxy::handleLoadFromProxy() { // // Be sure we drop any confirmed channel. // handleCheckDrop(); // // Check that either no X channel is // remaining or we are inside a reset. // int channelCount = getChannels(channel_x11); if (channelCount > 0) { #ifdef PANIC *logofs << "ServerProxy: PANIC! Protocol violation " << "in command load with " << channelCount << " channels.\n" << logofs_flush; #endif cerr << "Error" << ": Protocol violation " << "in command load from proxy.\n"; return -1; } else if (handleLoadStores() < 0) { #ifdef WARNING *logofs << "ServerProxy: WARNING! Failed to load content " << "of persistent cache.\n" << logofs_flush; #endif return -1; } return 1; } int ServerProxy::handleSaveFromProxy() { // // Be sure we drop any confirmed channel. // handleCheckDrop(); // // Now verify that all channels are gone. // int channelCount = getChannels(channel_x11); if (channelCount > 0) { #ifdef PANIC *logofs << "ServerProxy: PANIC! Protocol violation " << "in command save with " << channelCount << " channels.\n" << logofs_flush; #endif cerr << "Error" << ": Protocol violation " << "in command save from proxy.\n"; return -1; } else if (handleSaveStores() < 0) { #ifdef PANIC *logofs << "ServerProxy: PANIC! Failed to save stores " << "to persistent cache.\n" << logofs_flush; #endif return -1; } return 1; } int ServerProxy::handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, md5_state_t *md5StateClient) const { if (clientStore_ -> saveRequestStores(cachefs, md5StateStream, md5StateClient, discard_checksum, use_data) < 0) { return -1; } else if (serverStore_ -> saveReplyStores(cachefs, md5StateStream, md5StateClient, use_checksum, discard_data) < 0) { return -1; } else if (serverStore_ -> saveEventStores(cachefs, md5StateStream, md5StateClient, use_checksum, discard_data) < 0) { return -1; } return 1; } int ServerProxy::handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const { if (clientStore_ -> loadRequestStores(cachefs, md5StateStream, discard_checksum, use_data) < 0) { return -1; } else if (serverStore_ -> loadReplyStores(cachefs, md5StateStream, use_checksum, discard_data) < 0) { return -1; } else if (serverStore_ -> loadEventStores(cachefs, md5StateStream, use_checksum, discard_data) < 0) { return -1; } return 1; } nx-libs-3.5.99.23/nxcomp/src/ServerProxy.h0000644000000000000000000001106513614532331015066 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ServerProxy_H #define ServerProxy_H #include #include #include "Proxy.h" #include "Misc.h" #include "ChannelEndPoint.h" // // Set the verbosity level. // #undef TEST #undef DEBUG class ServerProxy : public Proxy { public: ServerProxy(int proxyFd); virtual ~ServerProxy(); virtual void handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, sockaddr *xServerAddr, unsigned int xServerAddrLength); virtual void handlePortConfiguration(ChannelEndPoint &cupsServerPort, ChannelEndPoint &smbServerPort, ChannelEndPoint &mediaServerPort, ChannelEndPoint &httpServerPort, const char *fontServerPort); protected: // // Create a new channel. // virtual int handleNewConnection(T_channel_type type, int clientFd); virtual int handleNewConnectionFromProxy(T_channel_type type, int channelId); virtual int handleNewAgentConnection(Agent *agent); virtual int handleNewXConnection(int clientFd); virtual int handleNewXConnectionFromProxy(int channelId); // // Implement persistence according // to our proxy mode. // virtual int handleLoad(T_load_type type) { return 0; } virtual int handleSave() { return 0; } virtual int handleAsyncEvents() { return 0; } virtual int handleLoadFromProxy(); virtual int handleSaveFromProxy(); virtual int handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, md5_state_t *md5StateClient) const; virtual int handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const; int handleCheckDrop(); int handleCheckLoad(); // // Utility function used to realize // a new connection. // protected: virtual int checkLocalChannelMap(int channelId) { // Since ProtoStep7 (#issue 108) return ((channelId & control -> ChannelMask) == 0); } private: // FIXME: Use a ChannelEndPoint object also for the X server! int xServerAddrFamily_; sockaddr *xServerAddr_; unsigned int xServerAddrLength_; // // This is the name of the X display where // we are going to forward connections. // char *xServerDisplay_; // // Ports where to forward extended services' // TCP connections. // ChannelEndPoint cupsServerPort_; ChannelEndPoint smbServerPort_; ChannelEndPoint mediaServerPort_; ChannelEndPoint httpServerPort_; // // It will have to be passed to the channel // so that it can set the port where the // font server connections are tunneled. // char *fontServerPort_; }; #endif /* ServerProxy_H */ nx-libs-3.5.99.23/nxcomp/src/ServerReadBuffer.cpp0000644000000000000000000001473413614532331016313 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ServerReadBuffer.h" #include "ServerChannel.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG unsigned int ServerReadBuffer::suggestedLength(unsigned int pendingLength) { // // Always read all the data that // is available. // int readable = transport_ -> readable(); unsigned int readLength = (readable == -1 ? 0 : (unsigned int) readable); if (readLength < pendingLength) { readLength = pendingLength; } // // Even if the readable data is not // enough to make a complete message, // resize the buffer to accommodate // it all. // if (pendingLength < remaining_) { readLength = remaining_; } return readLength; } int ServerReadBuffer::locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &controlLength, unsigned int &dataLength, unsigned int &trailerLength) { unsigned int size = end - start; #ifdef TEST *logofs << "ServerReadBuffer: Locating message for FD#" << transport_ -> fd() << " with " << size << " bytes.\n" << logofs_flush; #endif if (firstMessage_) { if (size < 8) { remaining_ = 8 - size; #ifdef TEST *logofs << "ServerReadBuffer: No message was located " << "with remaining " << remaining_ << ".\n" << logofs_flush; #endif return 0; } dataLength = 8 + (GetUINT(start + 6, bigEndian_) << 2); } else { if (size < 32) { remaining_ = 32 - size; #ifdef TEST *logofs << "ServerReadBuffer: No message was located " << "with remaining " << remaining_ << ".\n" << logofs_flush; #endif return 0; } if (*start == 1) { dataLength = 32 + (GetULONG(start + 4, bigEndian_) << 2); } else { dataLength = 32; } if (dataLength < 32) { #ifdef TEST *logofs << "ServerReadBuffer: WARNING! Assuming length 32 " << "for suspicious message of length " << dataLength << ".\n" << logofs_flush; #endif dataLength = 32; } } #ifdef TEST *logofs << "ServerReadBuffer: Length of the next message is " << dataLength << ".\n" << logofs_flush; #endif if (size < dataLength) { remaining_ = dataLength - size; #ifdef TEST *logofs << "ServerReadBuffer: No message was located " << "with remaining " << remaining_ << ".\n" << logofs_flush; #endif return 0; } firstMessage_ = 0; controlLength = 0; trailerLength = 0; remaining_ = 0; #ifdef TEST *logofs << "ServerReadBuffer: Located message with " << "remaining " << remaining_ << ".\n" << logofs_flush; #endif return 1; } // // Check if the data already read contains a // message matching the opcode and sequence, // starting at the given offset. // unsigned char *ServerReadBuffer::peekMessage(unsigned int &offset, unsigned char opcode, unsigned short sequence) { #ifdef TEST *logofs << "ServerReadBuffer: Peeking message " << "for FD#" << transport_ -> fd() << " with size " << length_ << " offset " << offset << " opcode " << (unsigned int) opcode << " and sequence " << sequence << ".\n" << logofs_flush; #endif if (firstMessage_) { return NULL; } unsigned char *next = buffer_ + start_ + offset; unsigned char *end = buffer_ + start_ + length_; int found = 0; while (end - next >= 32) { #ifdef DEBUG *logofs << "ServerReadBuffer: Checking opcode " << (unsigned int) *next << " sequence " << GetUINT(next + 2, bigEndian_) << " at " << next - buffer_ + start_ << ".\n" << logofs_flush; #endif if (*next == opcode && GetUINT(next + 2, bigEndian_) == sequence) { found = 1; break; } else if (*next == 1) { next += (32 + (GetULONG(next + 4, bigEndian_) << 2)); } else { next += 32; } } offset = next - buffer_ + start_; if (found == 1) { #ifdef TEST *logofs << "ServerReadBuffer: Found message at " << "offset " << next - buffer_ + start_ << ".\n" << logofs_flush; #endif return next; } #ifdef TEST *logofs << "ServerReadBuffer: Quitting loop at " << "offset " << next - buffer_ + start_ << ".\n" << logofs_flush; #endif return NULL; } nx-libs-3.5.99.23/nxcomp/src/ServerReadBuffer.h0000644000000000000000000000553513614532331015757 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ServerReadBuffer_H #define ServerReadBuffer_H #include "ReadBuffer.h" #include "Control.h" class ServerChannel; class ServerReadBuffer : public ReadBuffer { public: ServerReadBuffer(Transport *transport, ServerChannel *channel) : ReadBuffer(transport), firstMessage_(1), channel_(channel) { } virtual ~ServerReadBuffer() { } void setBigEndian(int flag) { bigEndian_ = flag; } unsigned char *peekMessage(unsigned int &offset, unsigned char opcode, unsigned short sequence); protected: virtual unsigned int suggestedLength(unsigned int pendingLength); virtual int locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &controlLength, unsigned int &dataLength, unsigned int &trailerLength); int bigEndian_; int firstMessage_; ServerChannel *channel_; }; #endif /* ServerReadBuffer_H */ nx-libs-3.5.99.23/nxcomp/src/ServerStore.cpp0000644000000000000000000001403513614532331015374 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ServerStore.h" // // Cached reply classes. // #include "GetImageReply.h" #include "ListFontsReply.h" #include "QueryFontReply.h" #include "GetPropertyReply.h" #include "GenericReply.h" // // Set the verbosity level. // #define WARNING #define PANIC #undef TEST ServerStore::ServerStore(StaticCompressor *compressor) { if (logofs == NULL) { logofs = &cout; } for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) { replies_[i] = NULL; events_[i] = NULL; } replies_[X_ListFonts] = new ListFontsReplyStore(compressor); replies_[X_QueryFont] = new QueryFontReplyStore(compressor); replies_[X_GetImage] = new GetImageReplyStore(compressor); replies_[X_GetProperty] = new GetPropertyReplyStore(compressor); replies_[X_NXInternalGenericReply] = new GenericReplyStore(compressor); } ServerStore::~ServerStore() { if (logofs == NULL) { logofs = &cout; } for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) { delete replies_[i]; delete events_[i]; } } int ServerStore::saveReplyStores(ostream *cachefs, md5_state_t *md5StateStream, md5_state_t *md5StateClient, T_checksum_action checksumAction, T_data_action dataAction) const { for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) { if (replies_[i] != NULL && replies_[i] -> saveStore(cachefs, md5StateStream, md5StateClient, checksumAction, dataAction, storeBigEndian()) < 0) { #ifdef PANIC *logofs << "ServerStore: PANIC! Error saving reply store " << "for OPCODE#" << (unsigned int) i << ".\n" << logofs_flush; #endif cerr << "Error" << ": Error saving reply store " << "for opcode '" << (unsigned int) i << "'.\n"; return -1; } } return 1; } int ServerStore::saveEventStores(ostream *cachefs, md5_state_t *md5StateStream, md5_state_t *md5StateClient, T_checksum_action checksumAction, T_data_action dataAction) const { for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) { if (events_[i] != NULL && events_[i] -> saveStore(cachefs, md5StateStream, md5StateClient, checksumAction, dataAction, storeBigEndian()) < 0) { #ifdef PANIC *logofs << "ServerStore: PANIC! Error saving event store " << "for OPCODE#" << (unsigned int) i << ".\n" << logofs_flush; #endif cerr << "Error" << ": Error saving event store " << "for opcode '" << (unsigned int) i << "'.\n"; return -1; } } return 1; } int ServerStore::loadReplyStores(istream *cachefs, md5_state_t *md5StateStream, T_checksum_action checksumAction, T_data_action dataAction) const { for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) { if (replies_[i] != NULL && replies_[i] -> loadStore(cachefs, md5StateStream, checksumAction, dataAction, storeBigEndian()) < 0) { #ifdef PANIC *logofs << "ServerStore: PANIC! Error loading reply store " << "for OPCODE#" << (unsigned int) i << ".\n" << logofs_flush; #endif return -1; } } return 1; } int ServerStore::loadEventStores(istream *cachefs, md5_state_t *md5StateStream, T_checksum_action checksumAction, T_data_action dataAction) const { for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) { if (events_[i] != NULL && events_[i] -> loadStore(cachefs, md5StateStream, checksumAction, dataAction, storeBigEndian()) < 0) { #ifdef PANIC *logofs << "ServerStore: PANIC! Error loading event store " << "for OPCODE#" << (unsigned int) i << ".\n" << logofs_flush; #endif return -1; } } return 1; } nx-libs-3.5.99.23/nxcomp/src/ServerStore.h0000644000000000000000000000643013614532331015041 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ServerStore_H #define ServerStore_H #include "Message.h" #include "ChannelStore.h" class StaticCompressor; class ServerStore : public ChannelStore { public: ServerStore(StaticCompressor *compressor); virtual ~ServerStore(); MessageStore *getReplyStore(unsigned char opcode) const { return replies_[opcode]; } MessageStore *getEventStore(unsigned char opcode) const { return events_[opcode]; } // // Actually save the message store // to disk according to proxy mode. // int saveReplyStores(ostream *cachefs, md5_state_t *md5StateStream, md5_state_t *md5StateClient, T_checksum_action checksumAction, T_data_action dataAction) const; int saveEventStores(ostream *cachefs, md5_state_t *md5StateStream, md5_state_t *md5StateClient, T_checksum_action checksumAction, T_data_action dataAction) const; int loadReplyStores(istream *cachefs, md5_state_t *md5StateStream, T_checksum_action checksumAction, T_data_action dataAction) const; int loadEventStores(istream *cachefs, md5_state_t *md5StateStream, T_checksum_action checksumAction, T_data_action dataAction) const; private: // // A server store contains replies and events. // MessageStore *replies_[CHANNEL_STORE_OPCODE_LIMIT]; MessageStore *events_[CHANNEL_STORE_OPCODE_LIMIT]; }; #endif /* ServerStore_H */ nx-libs-3.5.99.23/nxcomp/src/SetClipRectangles.cpp0000644000000000000000000001334613614532331016470 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "SetClipRectangles.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int SetClipRectanglesStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; // // Here is the fingerprint. // setClipRectangles -> ordering = *(buffer + 1); setClipRectangles -> gcontext = GetULONG(buffer + 4, bigEndian); setClipRectangles -> x_origin = GetUINT(buffer + 8, bigEndian); setClipRectangles -> y_origin = GetUINT(buffer + 10, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int SetClipRectanglesStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; // // Fill all the message's fields. // *(buffer + 1) = setClipRectangles -> ordering; PutULONG(setClipRectangles -> gcontext, buffer + 4, bigEndian); PutUINT(setClipRectangles -> x_origin, buffer + 8, bigEndian); PutUINT(setClipRectangles -> y_origin, buffer + 10, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void SetClipRectanglesStore::dumpIdentity(const Message *message) const { #ifdef DUMP SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; *logofs << name() << ": Identity ordering " << (unsigned int) setClipRectangles -> ordering << ", gcontext " << setClipRectangles -> gcontext << ", x_origin " << setClipRectangles -> x_origin << ", y_origin " << setClipRectangles -> y_origin << ", size " << setClipRectangles -> size_ << ".\n" << logofs_flush; #endif } void SetClipRectanglesStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { md5_append(md5_state_, buffer + 1, 1); md5_append(md5_state_, buffer + 8, 4); } void SetClipRectanglesStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; SetClipRectanglesMessage *cachedSetClipRectangles = (SetClipRectanglesMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << setClipRectangles -> gcontext << " as gcontext field.\n" << logofs_flush; #endif encodeBuffer.encodeXidValue(setClipRectangles -> gcontext, clientCache -> gcCache); cachedSetClipRectangles -> gcontext = setClipRectangles -> gcontext; } void SetClipRectanglesStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; decodeBuffer.decodeXidValue(value, clientCache -> gcCache); setClipRectangles -> gcontext = value; #ifdef DEBUG *logofs << name() << ": Decoded value " << setClipRectangles -> gcontext << " as gcontext field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/SetClipRectangles.h0000644000000000000000000001276413614532331016140 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef SetClipRectangles_H #define SetClipRectangles_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define SETCLIPRECTANGLES_ENABLE_CACHE 1 #define SETCLIPRECTANGLES_ENABLE_DATA 0 #define SETCLIPRECTANGLES_ENABLE_SPLIT 0 #define SETCLIPRECTANGLES_ENABLE_COMPRESS 0 #define SETCLIPRECTANGLES_DATA_LIMIT 2048 #define SETCLIPRECTANGLES_DATA_OFFSET 12 #define SETCLIPRECTANGLES_CACHE_SLOTS 3000 #define SETCLIPRECTANGLES_CACHE_THRESHOLD 3 #define SETCLIPRECTANGLES_CACHE_LOWER_THRESHOLD 1 // // The message class. // class SetClipRectanglesMessage : public Message { friend class SetClipRectanglesStore; public: SetClipRectanglesMessage() { } ~SetClipRectanglesMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char ordering; unsigned int gcontext; unsigned short x_origin; unsigned short y_origin; }; class SetClipRectanglesStore : public MessageStore { // // Constructors and destructors. // public: SetClipRectanglesStore() : MessageStore() { enableCache = SETCLIPRECTANGLES_ENABLE_CACHE; enableData = SETCLIPRECTANGLES_ENABLE_DATA; enableSplit = SETCLIPRECTANGLES_ENABLE_SPLIT; enableCompress = SETCLIPRECTANGLES_ENABLE_COMPRESS; dataLimit = SETCLIPRECTANGLES_DATA_LIMIT; dataOffset = SETCLIPRECTANGLES_DATA_OFFSET; cacheSlots = SETCLIPRECTANGLES_CACHE_SLOTS; cacheThreshold = SETCLIPRECTANGLES_CACHE_THRESHOLD; cacheLowerThreshold = SETCLIPRECTANGLES_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~SetClipRectanglesStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "SetClipRectangles"; } virtual unsigned char opcode() const { return X_SetClipRectangles; } virtual unsigned int storage() const { return sizeof(SetClipRectanglesMessage); } // // Message handling methods. // public: virtual Message *create() const { return new SetClipRectanglesMessage(); } virtual Message *create(const Message &message) const { return new SetClipRectanglesMessage((const SetClipRectanglesMessage &) message); } virtual void destroy(Message *message) const { delete (SetClipRectanglesMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* SetClipRectangles_H */ nx-libs-3.5.99.23/nxcomp/src/SetUnpackAlpha.cpp0000644000000000000000000002074313614532331015757 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "SetUnpackAlpha.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "WriteBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Constructors and destructors. // SetUnpackAlphaStore::SetUnpackAlphaStore(StaticCompressor *compressor) : MessageStore(compressor) { enableCache = SETUNPACKALPHA_ENABLE_CACHE; enableData = SETUNPACKALPHA_ENABLE_DATA; enableCompress = SETUNPACKALPHA_ENABLE_COMPRESS_IF_PROTO_STEP_7; dataLimit = SETUNPACKALPHA_DATA_LIMIT; dataOffset = SETUNPACKALPHA_DATA_OFFSET_IF_PROTO_STEP_7; cacheSlots = SETUNPACKALPHA_CACHE_SLOTS; cacheThreshold = SETUNPACKALPHA_CACHE_THRESHOLD; cacheLowerThreshold = SETUNPACKALPHA_CACHE_LOWER_THRESHOLD; // Since ProtoStep8 (#issue 108) enableSplit = SETUNPACKALPHA_ENABLE_SPLIT_IF_PROTO_STEP_8; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } SetUnpackAlphaStore::~SetUnpackAlphaStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } // // Here are the methods to handle messages' content. // int SetUnpackAlphaStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; #endif // // Encode the source length first because // we need it to determine the size of // the output buffer. // // SrcLength. encodeBuffer.encodeValue(GetULONG(buffer + 8, bigEndian), 32, 9); // Client. encodeBuffer.encodeCachedValue(*(buffer + 1), 8, clientCache -> resourceCache); // Method. encodeBuffer.encodeCachedValue(*(buffer + 4), 8, clientCache -> methodCache); // DstLength. encodeBuffer.encodeValue(GetULONG(buffer + 12, bigEndian), 32, 9); #ifdef DEBUG *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; #endif return 1; } int SetUnpackAlphaStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; #endif unsigned int value; unsigned char cValue; // SrcLength. decodeBuffer.decodeValue(value, 32, 9); size = RoundUp4(value) + 16; buffer = writeBuffer -> addMessage(size); PutULONG(value, buffer + 8, bigEndian); // Client. decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> resourceCache); *(buffer + 1) = cValue; // Method. decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> methodCache); *(buffer + 4) = cValue; // DstLength. decodeBuffer.decodeValue(value, 32, 9); PutULONG(value, buffer + 12, bigEndian); #ifdef DEBUG *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; #endif return 1; } int SetUnpackAlphaStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; setUnpackAlpha -> client = *(buffer + 1); setUnpackAlpha -> method = *(buffer + 4); setUnpackAlpha -> src_length = GetULONG(buffer + 8, bigEndian); setUnpackAlpha -> dst_length = GetULONG(buffer + 12, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } int SetUnpackAlphaStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; *(buffer + 1) = setUnpackAlpha -> client; *(buffer + 4) = setUnpackAlpha -> method; PutULONG(setUnpackAlpha -> src_length, buffer + 8, bigEndian); PutULONG(setUnpackAlpha -> dst_length, buffer + 12, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } void SetUnpackAlphaStore::dumpIdentity(const Message *message) const { #ifdef DUMP SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; *logofs << name() << ": Identity client " << (unsigned int) setUnpackAlpha -> client << " method " << (unsigned int) setUnpackAlpha -> method << " source length " << setUnpackAlpha -> src_length << " destination length " << setUnpackAlpha -> dst_length << " size " << setUnpackAlpha -> size_ << ".\n"; #endif } void SetUnpackAlphaStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { // // Include the pack method and the source // and destination length. // md5_append(md5_state_, buffer + 4, 1); md5_append(md5_state_, buffer + 8, 8); } void SetUnpackAlphaStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; SetUnpackAlphaMessage *cachedSetUnpackAlpha = (SetUnpackAlphaMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue(setUnpackAlpha -> client, 8, clientCache -> resourceCache); cachedSetUnpackAlpha -> client = setUnpackAlpha -> client; } void SetUnpackAlphaStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeCachedValue(setUnpackAlpha -> client, 8, clientCache -> resourceCache); } nx-libs-3.5.99.23/nxcomp/src/SetUnpackAlpha.h0000644000000000000000000001213013614532331015413 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef SetUnpackAlpha_H #define SetUnpackAlpha_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define SETUNPACKALPHA_ENABLE_CACHE 1 #define SETUNPACKALPHA_ENABLE_DATA 1 #define SETUNPACKALPHA_DATA_LIMIT 16384 #define SETUNPACKALPHA_CACHE_SLOTS 2000 #define SETUNPACKALPHA_CACHE_THRESHOLD 10 #define SETUNPACKALPHA_CACHE_LOWER_THRESHOLD 5 #define SETUNPACKALPHA_DATA_OFFSET_IF_PROTO_STEP_7 16 #define SETUNPACKALPHA_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 #define SETUNPACKALPHA_ENABLE_SPLIT_IF_PROTO_STEP_8 0 // // The message class. // class SetUnpackAlphaMessage : public Message { friend class SetUnpackAlphaStore; public: SetUnpackAlphaMessage() { } ~SetUnpackAlphaMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char client; unsigned char method; unsigned int src_length; unsigned int dst_length; }; class SetUnpackAlphaStore : public MessageStore { public: SetUnpackAlphaStore(StaticCompressor *compressor); virtual ~SetUnpackAlphaStore(); virtual const char *name() const { return "SetUnpackAlpha"; } virtual unsigned char opcode() const { return X_NXSetUnpackAlpha; } virtual unsigned int storage() const { return sizeof(SetUnpackAlphaMessage); } // // Message handling methods. // protected: virtual Message *create() const { return new SetUnpackAlphaMessage(); } virtual Message *create(const Message &message) const { return new SetUnpackAlphaMessage((const SetUnpackAlphaMessage &) message); } virtual void destroy(Message *message) const { delete (SetUnpackAlphaMessage *) message; } virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const; virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* SetUnpackAlpha_H */ nx-libs-3.5.99.23/nxcomp/src/SetUnpackColormap.cpp0000644000000000000000000002125113614532331016501 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "SetUnpackColormap.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "WriteBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Constructors and destructors. // SetUnpackColormapStore::SetUnpackColormapStore(StaticCompressor *compressor) : MessageStore(compressor) { enableCache = SETUNPACKCOLORMAP_ENABLE_CACHE; enableData = SETUNPACKCOLORMAP_ENABLE_DATA; enableCompress = SETUNPACKCOLORMAP_ENABLE_COMPRESS_IF_PROTO_STEP_7; dataLimit = SETUNPACKCOLORMAP_DATA_LIMIT; dataOffset = SETUNPACKCOLORMAP_DATA_OFFSET_IF_PROTO_STEP_7; cacheSlots = SETUNPACKCOLORMAP_CACHE_SLOTS; cacheThreshold = SETUNPACKCOLORMAP_CACHE_THRESHOLD; cacheLowerThreshold = SETUNPACKCOLORMAP_CACHE_LOWER_THRESHOLD; // Since ProtoStep8 (#issue 108) enableSplit = SETUNPACKCOLORMAP_ENABLE_SPLIT_IF_PROTO_STEP_8; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } SetUnpackColormapStore::~SetUnpackColormapStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } // // Here are the methods to handle messages' content. // int SetUnpackColormapStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; #endif // // Encode the source length first because // we need it to determine the size of // the output buffer. // // SrcLength. encodeBuffer.encodeValue(GetULONG(buffer + 8, bigEndian), 32, 9); // Client. encodeBuffer.encodeCachedValue(*(buffer + 1), 8, clientCache -> resourceCache); // Method. encodeBuffer.encodeCachedValue(*(buffer + 4), 8, clientCache -> methodCache); // DstLength. encodeBuffer.encodeValue(GetULONG(buffer + 12, bigEndian), 32, 9); #ifdef DEBUG *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; #endif return 1; } int SetUnpackColormapStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; #endif unsigned int value; unsigned char cValue; // SrcLength. decodeBuffer.decodeValue(value, 32, 9); size = RoundUp4(value) + 16; buffer = writeBuffer -> addMessage(size); PutULONG(value, buffer + 8, bigEndian); // Client. decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> resourceCache); *(buffer + 1) = cValue; // Method. decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> methodCache); *(buffer + 4) = cValue; // DstLength. decodeBuffer.decodeValue(value, 32, 9); PutULONG(value, buffer + 12, bigEndian); #ifdef DEBUG *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; #endif return 1; } int SetUnpackColormapStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; setUnpackColormap -> client = *(buffer + 1); setUnpackColormap -> method = *(buffer + 4); setUnpackColormap -> src_length = GetULONG(buffer + 8, bigEndian); setUnpackColormap -> dst_length = GetULONG(buffer + 12, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } int SetUnpackColormapStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; *(buffer + 1) = setUnpackColormap -> client; *(buffer + 4) = setUnpackColormap -> method; PutULONG(setUnpackColormap -> src_length, buffer + 8, bigEndian); PutULONG(setUnpackColormap -> dst_length, buffer + 12, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } void SetUnpackColormapStore::dumpIdentity(const Message *message) const { #ifdef DUMP SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; *logofs << name() << ": Identity client " << (unsigned int) setUnpackColormap -> client << " method " << (unsigned int) setUnpackColormap -> method << " source length " << setUnpackColormap -> src_length << " destination length " << setUnpackColormap -> dst_length << " size " << setUnpackColormap -> size_ << ".\n"; #endif } void SetUnpackColormapStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { // // Include the pack method and the source // and destination length. // md5_append(md5_state_, buffer + 4, 1); md5_append(md5_state_, buffer + 8, 8); } void SetUnpackColormapStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; SetUnpackColormapMessage *cachedSetUnpackColormap = (SetUnpackColormapMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; encodeBuffer.encodeCachedValue(setUnpackColormap -> client, 8, clientCache -> resourceCache); cachedSetUnpackColormap -> client = setUnpackColormap -> client; } void SetUnpackColormapStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeCachedValue(setUnpackColormap -> client, 8, clientCache -> resourceCache); } nx-libs-3.5.99.23/nxcomp/src/SetUnpackColormap.h0000644000000000000000000001224413614532331016150 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef SetUnpackColormap_H #define SetUnpackColormap_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define SETUNPACKCOLORMAP_ENABLE_CACHE 1 #define SETUNPACKCOLORMAP_ENABLE_DATA 1 #define SETUNPACKCOLORMAP_DATA_LIMIT 4096 #define SETUNPACKCOLORMAP_CACHE_SLOTS 2000 #define SETUNPACKCOLORMAP_CACHE_THRESHOLD 5 #define SETUNPACKCOLORMAP_CACHE_LOWER_THRESHOLD 0 #define SETUNPACKCOLORMAP_DATA_OFFSET_IF_PROTO_STEP_7 16 #define SETUNPACKCOLORMAP_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 #define SETUNPACKCOLORMAP_ENABLE_SPLIT_IF_PROTO_STEP_8 0 // // The message class. // class SetUnpackColormapMessage : public Message { friend class SetUnpackColormapStore; public: SetUnpackColormapMessage() { } ~SetUnpackColormapMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char client; unsigned char method; unsigned int src_length; unsigned int dst_length; }; class SetUnpackColormapStore : public MessageStore { public: SetUnpackColormapStore(StaticCompressor *compressor); virtual ~SetUnpackColormapStore(); virtual const char *name() const { return "SetUnpackColormap"; } virtual unsigned char opcode() const { return X_NXSetUnpackColormap; } virtual unsigned int storage() const { return sizeof(SetUnpackColormapMessage); } // // Message handling methods. // protected: virtual Message *create() const { return new SetUnpackColormapMessage(); } virtual Message *create(const Message &message) const { return new SetUnpackColormapMessage((const SetUnpackColormapMessage &) message); } virtual void destroy(Message *message) const { delete (SetUnpackColormapMessage *) message; } virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const; virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* SetUnpackColormap_H */ nx-libs-3.5.99.23/nxcomp/src/SetUnpackGeometry.cpp0000644000000000000000000002476013614532331016530 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "SetUnpackGeometry.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "WriteBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Constructors and destructors. // SetUnpackGeometryStore::SetUnpackGeometryStore(StaticCompressor *compressor) : MessageStore(compressor) { enableCache = SETUNPACKGEOMETRY_ENABLE_CACHE; enableData = SETUNPACKGEOMETRY_ENABLE_DATA; enableSplit = SETUNPACKGEOMETRY_ENABLE_SPLIT; enableCompress = SETUNPACKGEOMETRY_ENABLE_COMPRESS; dataLimit = SETUNPACKGEOMETRY_DATA_LIMIT; dataOffset = SETUNPACKGEOMETRY_DATA_OFFSET; cacheSlots = SETUNPACKGEOMETRY_CACHE_SLOTS; cacheThreshold = SETUNPACKGEOMETRY_CACHE_THRESHOLD; cacheLowerThreshold = SETUNPACKGEOMETRY_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } SetUnpackGeometryStore::~SetUnpackGeometryStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } // // Here are the methods to handle messages' content. // int SetUnpackGeometryStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(*(buffer + 1), 8, clientCache -> resourceCache); const unsigned char *nextChar = buffer + 4; for (int i = 0; i < 6; i++) { encodeBuffer.encodeCachedValue(*nextChar++, 8, clientCache -> depthCache); } encodeBuffer.encodeValue(GetULONG(buffer + 12, bigEndian), 32); encodeBuffer.encodeValue(GetULONG(buffer + 16, bigEndian), 32); encodeBuffer.encodeValue(GetULONG(buffer + 20, bigEndian), 32); #ifdef DEBUG *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; #endif return 1; } int SetUnpackGeometryStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; #endif size = 24; buffer = writeBuffer -> addMessage(size); unsigned char cValue; decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> resourceCache); *(buffer + 1) = cValue; decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> depthCache); *(buffer + 4) = cValue; decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> depthCache); *(buffer + 5) = cValue; decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> depthCache); *(buffer + 6) = cValue; decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> depthCache); *(buffer + 7) = cValue; decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> depthCache); *(buffer + 8) = cValue; decodeBuffer.decodeCachedValue(cValue, 8, clientCache -> depthCache); *(buffer + 9) = cValue; unsigned int value; decodeBuffer.decodeValue(value, 32); PutULONG(value, buffer + 12, bigEndian); decodeBuffer.decodeValue(value, 32); PutULONG(value, buffer + 16, bigEndian); decodeBuffer.decodeValue(value, 32); PutULONG(value, buffer + 20, bigEndian); #ifdef DEBUG *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; #endif return 1; } int SetUnpackGeometryStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; setUnpackGeometry -> client = *(buffer + 1); setUnpackGeometry -> depth_1_bpp = *(buffer + 4); setUnpackGeometry -> depth_4_bpp = *(buffer + 5); setUnpackGeometry -> depth_8_bpp = *(buffer + 6); setUnpackGeometry -> depth_16_bpp = *(buffer + 7); setUnpackGeometry -> depth_24_bpp = *(buffer + 8); setUnpackGeometry -> depth_32_bpp = *(buffer + 9); setUnpackGeometry -> red_mask = GetULONG(buffer + 12, bigEndian); setUnpackGeometry -> green_mask = GetULONG(buffer + 16, bigEndian); setUnpackGeometry -> blue_mask = GetULONG(buffer + 20, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } int SetUnpackGeometryStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; *(buffer + 1) = setUnpackGeometry -> client; *(buffer + 4) = setUnpackGeometry -> depth_1_bpp; *(buffer + 5) = setUnpackGeometry -> depth_4_bpp; *(buffer + 6) = setUnpackGeometry -> depth_8_bpp; *(buffer + 7) = setUnpackGeometry -> depth_16_bpp; *(buffer + 8) = setUnpackGeometry -> depth_24_bpp; *(buffer + 9) = setUnpackGeometry -> depth_32_bpp; PutULONG(setUnpackGeometry -> red_mask, buffer + 12, bigEndian); PutULONG(setUnpackGeometry -> green_mask, buffer + 16, bigEndian); PutULONG(setUnpackGeometry -> blue_mask, buffer + 20, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; #endif return 1; } void SetUnpackGeometryStore::dumpIdentity(const Message *message) const { #ifdef DUMP SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; *logofs << name() << ": Identity client " << (unsigned) setUnpackGeometry -> client << " depth_1_bpp " << (unsigned) setUnpackGeometry -> depth_1_bpp << " depth_4_bpp " << (unsigned int) setUnpackGeometry -> depth_4_bpp << " depth_8_bpp " << (unsigned int) setUnpackGeometry -> depth_8_bpp << " depth_16_bpp " << (unsigned int) setUnpackGeometry -> depth_16_bpp << " depth_24_bpp " << (unsigned int) setUnpackGeometry -> depth_24_bpp << " depth_32_bpp " << (unsigned int) setUnpackGeometry -> depth_32_bpp << " red_mask " << setUnpackGeometry -> red_mask << " green_mask " << setUnpackGeometry -> green_mask << " blue_mask " << setUnpackGeometry -> blue_mask << " size " << setUnpackGeometry -> size_ << ".\n"; #endif } void SetUnpackGeometryStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { md5_append(md5_state_, buffer + 4, 6); md5_append(md5_state_, buffer + 12, 12); } void SetUnpackGeometryStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; SetUnpackGeometryMessage *cachedSetUnpackGeometry = (SetUnpackGeometryMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; #ifdef TEST *logofs << name() << ": Encoding value " << (unsigned int) setUnpackGeometry -> client << " as client field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue(setUnpackGeometry -> client, 8, clientCache -> resourceCache); cachedSetUnpackGeometry -> client = setUnpackGeometry -> client; } void SetUnpackGeometryStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; decodeBuffer.decodeCachedValue(setUnpackGeometry -> client, 8, clientCache -> resourceCache); #ifdef DEBUG *logofs << name() << ": Decoded value " << (unsigned int) setUnpackGeometry -> client << " as client field.\n" << logofs_flush; #endif } nx-libs-3.5.99.23/nxcomp/src/SetUnpackGeometry.h0000644000000000000000000001241013614532331016162 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef SetUnpackGeometry_H #define SetUnpackGeometry_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define SETUNPACKGEOMETRY_ENABLE_CACHE 1 #define SETUNPACKGEOMETRY_ENABLE_DATA 0 #define SETUNPACKGEOMETRY_ENABLE_SPLIT 0 #define SETUNPACKGEOMETRY_ENABLE_COMPRESS 0 #define SETUNPACKGEOMETRY_DATA_LIMIT 24 #define SETUNPACKGEOMETRY_DATA_OFFSET 24 #define SETUNPACKGEOMETRY_CACHE_SLOTS 20 #define SETUNPACKGEOMETRY_CACHE_THRESHOLD 1 #define SETUNPACKGEOMETRY_CACHE_LOWER_THRESHOLD 0 // // The message class. // class SetUnpackGeometryMessage : public Message { friend class SetUnpackGeometryStore; public: SetUnpackGeometryMessage() { } ~SetUnpackGeometryMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned char client; unsigned char depth_1_bpp; unsigned char depth_4_bpp; unsigned char depth_8_bpp; unsigned char depth_16_bpp; unsigned char depth_24_bpp; unsigned char depth_32_bpp; unsigned int red_mask; unsigned int green_mask; unsigned int blue_mask; }; class SetUnpackGeometryStore : public MessageStore { public: SetUnpackGeometryStore(StaticCompressor *compressor); virtual ~SetUnpackGeometryStore(); virtual const char *name() const { return "SetUnpackGeometry"; } virtual unsigned char opcode() const { return X_NXSetUnpackGeometry; } virtual unsigned int storage() const { return sizeof(SetUnpackGeometryMessage); } // // Message handling methods. // protected: virtual Message *create() const { return new SetUnpackGeometryMessage(); } virtual Message *create(const Message &message) const { return new SetUnpackGeometryMessage((const SetUnpackGeometryMessage &) message); } virtual void destroy(Message *message) const { delete (SetUnpackGeometryMessage *) message; } virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const; virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* SetUnpackGeometry_H */ nx-libs-3.5.99.23/nxcomp/src/ShapeExtension.cpp0000644000000000000000000002234713614532331016053 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "ShapeExtension.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "WriteBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Constructors and destructors. // ShapeExtensionStore::ShapeExtensionStore(StaticCompressor *compressor) : MessageStore(compressor) { enableCache = SHAPEEXTENSION_ENABLE_CACHE; enableData = SHAPEEXTENSION_ENABLE_DATA; enableSplit = SHAPEEXTENSION_ENABLE_SPLIT; // Since ProtoStep7 (#issue 108) enableCompress = SHAPEEXTENSION_ENABLE_COMPRESS_IF_PROTO_STEP_7; dataLimit = SHAPEEXTENSION_DATA_LIMIT; dataOffset = SHAPEEXTENSION_DATA_OFFSET; cacheSlots = SHAPEEXTENSION_CACHE_SLOTS; cacheThreshold = SHAPEEXTENSION_CACHE_THRESHOLD; cacheLowerThreshold = SHAPEEXTENSION_CACHE_LOWER_THRESHOLD; opcode_ = X_NXInternalShapeExtension; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } ShapeExtensionStore::~ShapeExtensionStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } // // Here are the methods to handle messages' content. // int ShapeExtensionStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const { // // Handle this extension in a way similar to shape. // ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; #endif // // We handle all possible requests of this extension // using the same opcode. We give to message a data // offset of 4 (or 16 if proto is >= 3) and handle // the first 16 bytes through an array of caches. // encodeBuffer.encodeValue(size >> 2, 16, 10); encodeBuffer.encodeCachedValue(*(buffer + 1), 8, clientCache -> shapeOpcodeCache); for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) { encodeBuffer.encodeCachedValue(GetUINT(buffer + (i * 2) + 4, bigEndian), 16, *clientCache -> shapeDataCache[i]); } #ifdef DEBUG *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; #endif return 1; } int ShapeExtensionStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const { ClientCache *clientCache = (ClientCache *) channelCache; #ifdef DEBUG *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; #endif decodeBuffer.decodeValue(size, 16, 10); size <<= 2; buffer = writeBuffer -> addMessage(size); decodeBuffer.decodeCachedValue(*(buffer + 1), 8, clientCache -> shapeOpcodeCache); unsigned int value; for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache -> shapeDataCache[i]); PutUINT(value, buffer + 4 + (i * 2), bigEndian); } #ifdef DEBUG *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; #endif return 1; } int ShapeExtensionStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; shapeExtension -> opcode = *(buffer + 1); for (unsigned int i = 0; i < 8; i++) { if ((i * 2 + 4) < size) { shapeExtension -> data[i] = GetUINT(buffer + i * 2 + 4, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed data[" << i << "].\n" << logofs_flush; #endif } else { shapeExtension -> data[i] = 0; } } #ifdef DEBUG *logofs << name() << ": Parsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int ShapeExtensionStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; *(buffer + 1) = shapeExtension -> opcode; for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) { PutUINT(shapeExtension -> data[i], buffer + i * 2 + 4, bigEndian); } #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void ShapeExtensionStore::dumpIdentity(const Message *message) const { #ifdef DUMP ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; *logofs << name() << ": Identity opcode " << (unsigned) shapeExtension -> opcode; for (int i = 0; i < 8; i++) { *logofs << ", data[" << i << "] " << shapeExtension -> data[i]; } *logofs << ", size " << shapeExtension -> size_ << ".\n" << logofs_flush; #endif } void ShapeExtensionStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { // // Include minor opcode in the checksum. As data // offset can be beyond the real end of message, // we need to include size or we will match any // message of size less or equal to data offset. // md5_append(md5_state_, buffer + 1, 3); } void ShapeExtensionStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const { // // Encode the variant part. // ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; ShapeExtensionMessage *cachedShapeExtension = (ShapeExtensionMessage *) cachedMessage; ClientCache *clientCache = (ClientCache *) channelCache; for (int i = 0; i < 8 && (i * 2 + 4) < shapeExtension -> size_; i++) { #ifdef TEST *logofs << name() << ": Encoding value " << shapeExtension -> data[i] << " as data[" << i << "] field.\n" << logofs_flush; #endif encodeBuffer.encodeCachedValue((unsigned int) shapeExtension -> data[i], 16, *clientCache -> shapeDataCache[i]); cachedShapeExtension -> data[i] = shapeExtension -> data[i]; } } void ShapeExtensionStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const { ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; ClientCache *clientCache = (ClientCache *) channelCache; unsigned int value; for (int i = 0; i < 8 && (i * 2 + 4) < shapeExtension -> size_; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache -> shapeDataCache[i]); shapeExtension -> data[i] = (unsigned short) value; #ifdef TEST *logofs << name() << ": Decoded value " << shapeExtension -> data[i] << " as data[" << i << "] field.\n" << logofs_flush; #endif } } nx-libs-3.5.99.23/nxcomp/src/ShapeExtension.h0000644000000000000000000001227413614532331015516 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ShapeExtension_H #define ShapeExtension_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define SHAPEEXTENSION_ENABLE_CACHE 1 #define SHAPEEXTENSION_ENABLE_DATA 1 #define SHAPEEXTENSION_ENABLE_SPLIT 0 #define SHAPEEXTENSION_DATA_LIMIT 3200 #define SHAPEEXTENSION_DATA_OFFSET 20 #define SHAPEEXTENSION_CACHE_SLOTS 3000 #define SHAPEEXTENSION_CACHE_THRESHOLD 10 #define SHAPEEXTENSION_CACHE_LOWER_THRESHOLD 5 #define SHAPEEXTENSION_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 // // The message class. // class ShapeExtensionMessage : public Message { friend class ShapeExtensionStore; public: ShapeExtensionMessage() { } ~ShapeExtensionMessage() { } // // Note for encoding in protocol level 1: we consider // for this message a data offset of 4. Bytes from 5 // to 20, if present, are taken as part of identity // and encoded through an array of int caches. // private: unsigned char opcode; unsigned short data[8]; }; class ShapeExtensionStore : public MessageStore { public: ShapeExtensionStore(StaticCompressor *compressor); virtual ~ShapeExtensionStore(); virtual const char *name() const { return "ShapeExtension"; } virtual unsigned char opcode() const { return opcode_; } virtual unsigned int storage() const { return sizeof(ShapeExtensionMessage); } // // Message handling methods. // public: virtual Message *create() const { return new ShapeExtensionMessage(); } virtual Message *create(const Message &message) const { return new ShapeExtensionMessage((const ShapeExtensionMessage &) message); } virtual void destroy(Message *message) const { delete (ShapeExtensionMessage *) message; } virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, const unsigned int size, int bigEndian, ChannelCache *channelCache) const; virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, ChannelCache *channelCache) const; virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, const Message *cachedMessage, ChannelCache *channelCache) const; virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, ChannelCache *channelCache) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; private: unsigned char opcode_; }; #endif /* ShapeExtension_H */ nx-libs-3.5.99.23/nxcomp/src/Socket.cpp0000644000000000000000000004140313614532331014340 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #if defined(__CYGWIN32__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun) #include #endif #ifdef __sun #include #include #endif #include #include #include #include #include #include // // System specific defines. // #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun) #define SOL_IP IPPROTO_IP #endif #ifdef __sun #define INADDR_NONE ((unsigned int) -1) #endif // // The TIOCOUTQ ioctl is not implemented on Cygwin. // Note also that TIOCOUTQ and IPTOS_LOWDELAY are // disabled when running on MacOS/X. // #ifdef __CYGWIN32__ #define TIOCOUTQ ((unsigned int) -1) #endif // // NX includes. // #include "Misc.h" #include "Socket.h" // // Set verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Set this only once by querying OS details. // static int _kernelStep = -1; int GetKernelStep() { if (_kernelStep < 0) { // // At the moment only NX clients run on Win32 // and MacOS/X so we are not really interested // in the relevant OS dependent functions. // #if defined(__CYGWIN32__) || defined(__APPLE__) _kernelStep = 0; #else struct utsname buffer; if (uname(&buffer) < 0) { #ifdef WARNING *logofs << "Socket: WARNING! Failed to get system info. Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; *logofs << "Socket: WARNING! Assuming lowest system support.\n" << logofs_flush; #endif cerr << "Warning" << ": Failed to get system info. Error is " << EGET() << " '" << ESTR() << "'.\n"; cerr << "Warning" << ": Assuming lowest system support.\n"; _kernelStep = 0; } else { #ifdef TEST *logofs << "Socket: System is '" << buffer.sysname << "' nodename '" << buffer.nodename << "' release '" << buffer.release << "'.\n" << logofs_flush; *logofs << "Socket: Version is '" << buffer.version << "' machine '" << buffer.machine << "'.\n" << logofs_flush; #endif // // Should test support on other operating systems. // if (strcmp(buffer.sysname, "Linux") == 0) { if (strncmp(buffer.release, "2.0.", 4) == 0 || strncmp(buffer.release, "2.2.", 4) == 0) { #ifdef TEST *logofs << "Socket: Assuming level 2 system support.\n" << logofs_flush; #endif _kernelStep = 2; } else { #ifdef TEST *logofs << "Socket: Assuming level 3 system support.\n" << logofs_flush; #endif _kernelStep = 3; } } else if (strcmp(buffer.sysname, "SunOS") == 0) { #ifdef TEST *logofs << "Socket: Assuming level 1 system support.\n" << logofs_flush; #endif _kernelStep = 1; } else { #ifdef TEST *logofs << "Socket: Assuming level 0 system support.\n" << logofs_flush; #endif _kernelStep = 0; } } #endif /* #if defined(__CYGWIN32__) || defined(__APPLE__) */ } return _kernelStep; } int SetReuseAddress(int fd) { int flag = 1; if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &flag, sizeof(flag)) < 0) { #ifdef PANIC *logofs << "Socket: PANIC! Failed to set SO_REUSEADDR flag on FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to set SO_REUSEADDR flag on FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; return -1; } #ifdef TEST else { *logofs << "Socket: Set SO_REUSEADDR flag on FD#" << fd << ".\n" << logofs_flush; } #endif return 1; } int SetNonBlocking(int fd, int value) { int flags = fcntl(fd, F_GETFL); if (flags >= 0) { if (value == 0) { flags &= ~O_NONBLOCK; } else { flags |= O_NONBLOCK; } } if (flags < 0 || fcntl(fd, F_SETFL, flags) < 0) { #ifdef PANIC *logofs << "Socket: PANIC! Failed to set O_NONBLOCK flag on FD#" << fd << " to " << value << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to set O_NONBLOCK flag on FD#" << fd << " to " << value << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; return -1; } #ifdef TEST else { *logofs << "Socket: Set O_NONBLOCK flag on FD#" << fd << " to " << value << ".\n" << logofs_flush; } #endif return 1; } int SetLingerTimeout(int fd, int timeout) { struct linger linger_value; if (timeout > 0) { linger_value.l_onoff = 1; linger_value.l_linger = timeout; } else { linger_value.l_onoff = 0; linger_value.l_linger = 0; } if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &linger_value, sizeof(linger_value)) < 0) { #ifdef PANIC *logofs << "Socket: PANIC! Failed to set SO_LINGER values to " << linger_value.l_onoff << " and " << linger_value.l_linger << " on FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to set SO_LINGER values to " << linger_value.l_onoff << " and " << linger_value.l_linger << " on FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; return -1; } #ifdef TEST else { *logofs << "Socket: Set SO_LINGER values to " << linger_value.l_onoff << " and " << linger_value.l_linger << " on FD#" << fd << ".\n" << logofs_flush; } #endif return 1; } int SetSendBuffer(int fd, int size) { if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)) < 0) { #ifdef PANIC *logofs << "Socket: PANIC! Failed to set SO_SNDBUF size to " << size << " on FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to set SO_SNDBUF size to " << size << " on FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; return -1; } #ifdef TEST else { *logofs << "Socket: Set SO_SNDBUF on FD#" << fd << " to " << size << " bytes.\n" << logofs_flush; } #endif return 1; } int SetReceiveBuffer(int fd, int size) { if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)) < 0) { #ifdef PANIC *logofs << "Socket: PANIC! Failed to set SO_RCVBUF size to " << size << " on FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to set SO_RCVBUF size to " << size << " on FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; return -1; } #ifdef TEST else { *logofs << "Socket: Set SO_RCVBUF on FD#" << fd << " to " << size << " bytes.\n" << logofs_flush; } #endif return 1; } int SetNoDelay(int fd, int value) { int result = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); if (result == 0) { result = 1; } else if (result < 0) { // // Is it become a different error on // Mac OSX 10.4? // #if defined(__APPLE__) result = 0; #endif #if defined(__sun) if (EGET() == ENOPROTOOPT) { result = 0; } #endif #if !defined(__APPLE__) && !defined(__sun) if (EGET() == EOPNOTSUPP) { result = 0; } #endif } if (result < 0) { #ifdef PANIC *logofs << "Socket: PANIC! Failed to set TCP_NODELAY flag on " << "FD#" << fd << " to " << value << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to set TCP_NODELAY flag on " << "FD#" << fd << " to " << value << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; } #ifdef TEST else if (result == 0) { #ifdef TEST *logofs << "Socket: Option TCP_NODELAY not supported " << "on FD#" << fd << ".\n" << logofs_flush; #endif } else { *logofs << "Socket: Set TCP_NODELAY flag on FD#" << fd << " to " << value << ".\n" << logofs_flush; } #endif return result; } int SetKeepAlive(int fd) { int flag = 1; if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &flag, sizeof(flag)) < 0) { #ifdef PANIC *logofs << "Socket: PANIC! Failed to set SO_KEEPALIVE flag on " << "FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to set SO_KEEPALIVE flag on " << "FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; return -1; } #ifdef TEST else { *logofs << "Socket: Set SO_KEEPALIVE flag on FD#" << fd << ".\n" << logofs_flush; } #endif return 1; } int SetLowDelay(int fd) { if (_kernelStep < 0) { GetKernelStep(); } switch (_kernelStep) { case 3: case 2: case 1: { int flag = IPTOS_LOWDELAY; if (setsockopt(fd, SOL_IP, IP_TOS, &flag, sizeof(flag)) < 0) { if (EGET() == EOPNOTSUPP) { #ifdef TEST *logofs << "Socket: Option IPTOS_LOWDELAY not supported " << "on FD#" << fd << ".\n" << logofs_flush; #endif return 0; } else { #ifdef WARNING *logofs << "Socket: WARNING! Failed to set IPTOS_LOWDELAY flag on " << "FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Failed to set IPTOS_LOWDELAY flag on " << "FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; return -1; } } #ifdef TEST else { *logofs << "Socket: Set IPTOS_LOWDELAY flag on FD#" << fd << ".\n" << logofs_flush; } #endif return 1; } default: { #ifdef TEST *logofs << "Socket: Option IPTOS_LOWDELAY not " << "supported on FD#" << fd << ".\n" << logofs_flush; #endif return 0; } } } int SetCloseOnExec(int fd) { if (fcntl(fd, F_SETFD, 1) != 0) { #ifdef TEST *logofs << "NXClient: PANIC! Cannot set close-on-exec " << "on FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Cannot set close-on-exec on FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; return -1; } return 1; } int GetBytesReadable(int fd) { long readable = 0; // // It may fail, for example at session // shutdown. // if (ioctl(fd, FIONREAD, &readable) < 0) { #ifdef TEST *logofs << "Socket: PANIC! Failed to get bytes readable " << "from FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif return -1; } #ifdef TEST *logofs << "Socket: Returning " << (int) readable << " bytes readable on FD#" << fd << ".\n" << logofs_flush; #endif return (int) readable; } int GetBytesWritable(int fd) { if (_kernelStep < 0) { GetKernelStep(); } long writable; switch (_kernelStep) { case 3: { // // TODO: Should query the real size // of the TCP write buffer. // writable = 16384 - GetBytesQueued(fd); if (writable < 0) { writable = 0; } break; } case 2: { if (ioctl(fd, TIOCOUTQ, (void *) &writable) < 0) { #ifdef PANIC *logofs << "Socket: PANIC! Failed to get bytes writable " << "on FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to get bytes writable " << "on FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; return -1; } break; } default: { #ifdef TEST *logofs << "Socket: Option TIOCOUTQ not supported " << "on FD#" << fd << ",\n" << logofs_flush; #endif // // TODO: Should query the real size // of the TCP write buffer. // writable = 16384; break; } } #ifdef TEST *logofs << "Socket: Returning " << writable << " bytes writable on FD#" << fd << ".\n" << logofs_flush; #endif return (int) writable; } int GetBytesQueued(int fd) { // // The TIOCOUTQ ioctl is not implemented on Cygwin // and returns the space available on Linux Kernels // 2.0 and 2.2 (like current MIPS for PS/2). // if (_kernelStep < 0) { GetKernelStep(); } long queued; switch (_kernelStep) { case 3: { if (ioctl(fd, TIOCOUTQ, (void *) &queued) < 0) { #ifdef PANIC *logofs << "Socket: PANIC! Failed to get bytes queued " << "on FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to get bytes queued " << "on FD#" << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; return -1; } break; } case 2: { // // TODO: Should query the real size // of the TCP write buffer. // queued = 16384 - GetBytesWritable(fd); if (queued < 0) { queued = 0; } break; } default: { #ifdef TEST *logofs << "Socket: Option TIOCOUTQ not supported " << "on FD#" << fd << ",\n" << logofs_flush; #endif queued = 0; break; } } #ifdef TEST *logofs << "Socket: Returning " << queued << " bytes queued on FD#" << fd << ".\n" << logofs_flush; #endif return (int) queued; } int GetHostAddress(const char *name) { hostent *host = gethostbyname(name); if (host == NULL) { // // On some Unices gethostbyname() doesn't // accept IP addresses, so try inet_addr. // IN_ADDR_T address = inet_addr(name); if (address == INADDR_NONE) { #ifdef PANIC *logofs << "Socket: PANIC! Failed to resolve address of '" << name << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed to resolve address of '" << name << "'.\n"; return 0; } return (int) address; } else { return (*((int *) host -> h_addr_list[0])); } } nx-libs-3.5.99.23/nxcomp/src/Socket.h0000644000000000000000000000614213614532331014006 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Socket_H #define Socket_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifdef __sun #include #include #endif #ifdef HAVE_IN_ADDR_T #define IN_ADDR_T in_addr_t #else #define IN_ADDR_T unsigned #endif // // Set socket options. // int SetReuseAddress(int fd); int SetNonBlocking(int fd, int value); int SetLingerTimeout(int fd, int timeout); int SetSendBuffer(int fd, int size); int SetReceiveBuffer(int fd, int size); int SetNoDelay(int fd, int value); int SetKeepAlive(int fd); int SetLowDelay(int fd); int SetCloseOnExec(int fd); // // Get kernel support level. // int GetKernelStep(); // // Get socket info. // int GetBytesReadable(int fd); int GetBytesWritable(int fd); int GetBytesQueued(int fd); // // Inline version, providing direct access // to the interface. // #include "Misc.h" inline int GetBytesReadable(int fd, int *readable) { long t; int result = ioctl(fd, FIONREAD, &t); #ifdef DEBUG *logofs << "Socket: Bytes readable from FD#" << fd << " are " << t << " with result " << result << ".\n" << logofs_flush; #endif *readable = (int) t; return result; } // // Query Internet address. // int GetHostAddress(const char *name); #endif /* Socket_H */ nx-libs-3.5.99.23/nxcomp/src/Split.cpp0000644000000000000000000012354513614532331014213 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "Misc.h" #include "Split.h" #include "Control.h" #include "Statistics.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "StaticCompressor.h" #include "Unpack.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Define this to trace elements // allocated and deallocated. // #undef REFERENCES // // Counters used for store control. // int SplitStore::totalSplitSize_; int SplitStore::totalSplitStorageSize_; // // This is used for reference count. // #ifdef REFERENCES int Split::references_ = 0; #endif Split::Split() { resource_ = nothing; position_ = nothing; store_ = NULL; d_size_ = 0; i_size_ = 0; c_size_ = 0; r_size_ = 0; next_ = 0; load_ = 0; save_ = 0; checksum_ = NULL; state_ = split_undefined; mode_ = split_none; action_ = is_discarded; #ifdef REFERENCES references_++; *logofs << "Split: Created new Split at " << this << " out of " << references_ << " allocated references.\n" << logofs_flush; #endif } Split::~Split() { delete [] checksum_; #ifdef REFERENCES references_--; *logofs << "Split: Deleted Split at " << this << " out of " << references_ << " allocated references.\n" << logofs_flush; #endif } SplitStore::SplitStore(StaticCompressor *compressor, CommitStore *commits, int resource) : compressor_(compressor), commits_(commits), resource_(resource) { splits_ = new T_splits(); current_ = splits_ -> end(); splitStorageSize_ = 0; #ifdef TEST *logofs << "SplitStore: Created new store ["; if (resource_ != nothing) { *logofs << resource_; } else { *logofs << "commit"; } *logofs << "].\n" << logofs_flush; *logofs << "SplitStore: Total messages in stores are " << totalSplitSize_ << " with total storage size " << totalSplitStorageSize_ << ".\n" << logofs_flush; #endif } SplitStore::~SplitStore() { totalSplitSize_ -= splits_ -> size(); totalSplitStorageSize_ -= splitStorageSize_; for (T_splits::iterator i = splits_ -> begin(); i != splits_ -> end(); i++) { delete *i; } delete splits_; #ifdef TEST *logofs << "SplitStore: Deleted store ["; if (resource_ != nothing) { *logofs << resource_; } else { *logofs << "commit"; } *logofs << "] with storage size " << splitStorageSize_ << ".\n" << logofs_flush; *logofs << "SplitStore: Total messages in stores are " << totalSplitSize_ << " with total storage size " << totalSplitStorageSize_ << ".\n" << logofs_flush; #endif } // // This is called at the encoding side. // Split *SplitStore::add(MessageStore *store, int resource, T_split_mode mode, int position, T_store_action action, T_checksum checksum, const unsigned char *buffer, const int size) { #ifdef TEST *logofs << "SplitStore: Adding message [" << (unsigned int) store -> opcode() << "] resource " << resource << " mode " << mode << " position " << position << " action [" << DumpAction(action) << "] and checksum [" << DumpChecksum(checksum) << "]" << ".\n" << logofs_flush; #endif Split *split = new Split(); if (split == NULL) { #ifdef PANIC *logofs << "SplitStore: PANIC! Can't allocate " << "memory for the split.\n" << logofs_flush; #endif cerr << "Error" << ": Can't allocate memory " << "for the split.\n"; HandleAbort(); } split -> store_ = store; split -> resource_ = resource; split -> mode_ = mode; split -> position_ = position; split -> action_ = action; split -> store_ -> validateSize(size); // // The checksum is not provided if the // message is cached. // if (checksum != NULL) { split -> checksum_ = new md5_byte_t[MD5_LENGTH]; memcpy(split -> checksum_, checksum, MD5_LENGTH); } // // We don't need the identity data at the // encoding side. This qualifies the split // as a split generated at the encoding // side. // split -> i_size_ = store -> identitySize(buffer, size); split -> d_size_ = size - split -> i_size_; if (action == IS_ADDED || action == is_discarded) { // // If the message was added to message // store or discarded we need to save // the real data so we can transfer it // at later time. // split -> data_.resize(split -> d_size_); memcpy(split -> data_.begin(), buffer + split -> i_size_, split -> d_size_); // // If the message was added, lock it so // it will not be used by the encoding // side until it is recomposed. // if (action == IS_ADDED) { split -> store_ -> lock(split -> position_); #ifdef TEST commits_ -> validate(split); #endif } } #ifdef WARNING else { *logofs << "SplitStore: WARNING! Not copying data for the cached message.\n" << logofs_flush; } #endif push(split); return split; } // // This is called at decoding side. If checksum // is provided, the message can be searched on // disk, then, if message is found, an event is // sent to abort the data transfer. // Split *SplitStore::add(MessageStore *store, int resource, int position, T_store_action action, T_checksum checksum, unsigned char *buffer, const int size) { #ifdef TEST *logofs << "SplitStore: Adding message [" << (unsigned int) store -> opcode() << "] resource " << resource << " position " << position << " action [" << DumpAction(action) << "] and checksum [" << DumpChecksum(checksum) << "].\n" << logofs_flush; #endif Split *split = new Split(); if (split == NULL) { #ifdef PANIC *logofs << "SplitStore: PANIC! Can't allocate " << "memory for the split.\n" << logofs_flush; #endif cerr << "Error" << ": Can't allocate memory " << "for the split.\n"; HandleAbort(); } split -> store_ = store; split -> resource_ = resource; split -> position_ = position; split -> action_ = action; split -> store_ -> validateSize(size); // // Check if the checksum was provided // by the remote. // if (checksum != NULL) { split -> checksum_ = new md5_byte_t[MD5_LENGTH]; memcpy(split -> checksum_, checksum, MD5_LENGTH); } split -> i_size_ = store -> identitySize(buffer, size); // // Copy the identity so we can expand the // message when it is committed. // split -> identity_.resize(split -> i_size_); memcpy(split -> identity_.begin(), buffer, split -> i_size_); split -> d_size_ = size - split -> i_size_; if (action == IS_ADDED || action == is_discarded) { // // The unpack procedure will check if the // first 2 bytes of the buffer contain the // pattern and will not try to expand the // image. // split -> data_.resize(2); unsigned char *data = split -> data_.begin(); data[0] = SPLIT_PATTERN; data[1] = SPLIT_PATTERN; // // If the message was added to the store, // we don't have the data part, yet, so // we need to lock the message until it // is recomposed. // if (action == IS_ADDED) { split -> store_ -> lock(split -> position_); #ifdef TEST commits_ -> validate(split); #endif } } else { #ifdef WARNING *logofs << "SplitStore: WARNING! Copying data for the cached message.\n" << logofs_flush; #endif // // We may optionally take the data from the // message store in compressed form, but, // as the data has been decompressed in the // buffer, we save a further decompression. // split -> data_.resize(split -> d_size_); memcpy(split -> data_.begin(), buffer + split -> i_size_, split -> d_size_); } push(split); return split; } void SplitStore::push(Split *split) { splits_ -> push_back(split); splitStorageSize_ += getNodeSize(split); totalSplitSize_++; totalSplitStorageSize_ += getNodeSize(split); statistics -> addSplit(); #ifdef TEST *logofs << "SplitStore: There are " << splits_ -> size() << " messages in store [" << resource_ << "] with " << "storage size " << splitStorageSize_ << ".\n" << logofs_flush; *logofs << "SplitStore: Total messages in stores are " << totalSplitSize_ << " with total storage size " << totalSplitStorageSize_ << ".\n" << logofs_flush; #endif split -> state_ = split_added; } void SplitStore::dump() { #ifdef DUMP int n; Split *split; *logofs << "SplitStore: DUMP! Dumping content of "; if (commits_ == NULL) { *logofs << "[commits]"; } else { *logofs << "[splits] for store [" << resource_ << "]"; } *logofs << " with [" << getSize() << "] elements " << "in the store.\n" << logofs_flush; n = 0; for (T_splits::iterator i = splits_ -> begin(); i != splits_ -> end(); i++, n++) { split = *i; *logofs << "SplitStore: DUMP! Split [" << n << "] has action [" << DumpAction(split -> action_) << "] state [" << DumpState(split -> state_) << "] "; if (split -> resource_ >= 0) { *logofs << "resource " << split -> resource_; } *logofs << " request " << (unsigned) split -> store_ -> opcode() << " position " << split -> position_ << " size is " << split -> data_.size() << " (" << split -> d_size_ << "/" << split -> c_size_ << "/" << split -> r_size_ << ") with " << split -> data_.size() - split -> next_ << "] bytes to go.\n" << logofs_flush; } #endif } int SplitStore::send(EncodeBuffer &encodeBuffer, int packetSize) { if (splits_ -> size() == 0) { #ifdef PANIC *logofs << "SplitStore: PANIC! Function send called with no splits available.\n" << logofs_flush; #endif cerr << "Error" << ": Function send called with no splits available.\n"; HandleAbort(); } // // A start operation must always be executed on // the split, even in the case the split will be // later aborted. // if (current_ == splits_ -> end()) { start(encodeBuffer); } // // If we have matched the checksum received from // the remote side then we must abort the current // split, else we can send another block of data // to the remote peer. // Split *split = *current_; unsigned int abort = 0; if (split -> state_ == split_loaded) { abort = 1; } encodeBuffer.encodeBoolValue(abort); if (abort == 1) { #ifdef TEST *logofs << "SplitStore: Aborting split for checksum [" << DumpChecksum(split -> checksum_) << "] position " << split -> position_ << " with " << (split -> data_.size() - split -> next_) << " bytes to go " << "out of " << split -> data_.size() << ".\n" << logofs_flush; #endif statistics -> addSplitAborted(); statistics -> addSplitAbortedBytesOut(split -> data_.size() - split -> next_); split -> next_ = split -> data_.size(); split -> state_ = split_aborted; } else { int count = (packetSize <= 0 || split -> next_ + packetSize > (int) split -> data_.size() ? split -> data_.size() - split -> next_ : packetSize); #ifdef TEST *logofs << "SplitStore: Sending split for checksum [" << DumpChecksum(split -> checksum_) << "] count " << count << " position " << split -> position_ << ". Data size is " << split -> data_.size() << " (" << split -> d_size_ << "/" << split -> c_size_ << "), " << split -> data_.size() - (split -> next_ + count) << " to go.\n" << logofs_flush; #endif encodeBuffer.encodeValue(count, 32, 10); encodeBuffer.encodeMemory(split -> data_.begin() + split -> next_, count); split -> next_ += count; } // // Was data completely transferred? We are the // sending side. We must update the message in // store, even if split was aborted. // if (split -> next_ != ((int) split -> data_.size())) { return 0; } // // Move the split at the head of the // list to the commits. // remove(split); // // Reset current position to the // end of repository. // current_ = splits_ -> end(); #ifdef TEST *logofs << "SplitStore: Removed split at head of the list. " << "Resource is " << split -> resource_ << " request " << (unsigned) split -> store_ -> opcode() << " position " << split -> position_ << ".\n" << logofs_flush; #endif return 1; } int SplitStore::start(EncodeBuffer &encodeBuffer) { // // Get the element at the top of the // list. // current_ = splits_ -> begin(); Split *split = *current_; #ifdef TEST *logofs << "SplitStore: Starting split for checksum [" << DumpChecksum(split -> checksum_) << "] position " << split -> position_ << " with " << (split -> data_.size() - split -> next_) << " bytes to go " << "out of " << split -> data_.size() << ".\n" << logofs_flush; #endif // // See if compression of the data part is // enabled. // if (split -> store_ -> enableCompress) { // // If the split is going to be aborted don't // compress the data and go straight to the // send. The new data size will be assumed // from the disk cache. // if (split -> state_ != split_loaded) { unsigned int compressedSize = 0; unsigned char *compressedData = NULL; if (control -> LocalDataCompression && (compressor_ -> compressBuffer(split -> data_.begin(), split -> d_size_, compressedData, compressedSize))) { // // Replace the data with the one in // compressed form. // #ifdef TEST *logofs << "SplitStore: Split data of size " << split -> d_size_ << " has been compressed to " << compressedSize << " bytes.\n" << logofs_flush; #endif split -> data_.clear(); split -> data_.resize(compressedSize); memcpy(split -> data_.begin(), compressedData, compressedSize); split -> c_size_ = compressedSize; // // Inform our peer that the data is // compressed and send the new size. // encodeBuffer.encodeBoolValue(1); encodeBuffer.encodeValue(compressedSize, 32, 14); #ifdef TEST *logofs << "SplitStore: Signaled " << split -> c_size_ << " bytes of compressed data for this message.\n" << logofs_flush; #endif return 1; } } #ifdef TEST else { *logofs << "SplitStore: Not trying to compress the " << "loaded message.\n" << logofs_flush; } #endif // // Tell to the remote that data will // follow uncompressed. // encodeBuffer.encodeBoolValue(0); } return 1; } int SplitStore::start(DecodeBuffer &decodeBuffer) { #ifdef TEST *logofs << "SplitStore: Going to receive a new split from the remote side.\n" << logofs_flush; #endif // // Get the element at the head // of the list. // current_ = splits_ -> begin(); Split *split = *current_; unsigned int compressedSize = 0; // // Save the data size known by the remote. // This information will be needed if the // remote will not have a chance to abort // the split. // split -> r_size_ = split -> d_size_; // // Find out if data was compressed by the // remote. // if (split -> store_ -> enableCompress) { decodeBuffer.decodeBoolValue(compressedSize); if (compressedSize == 1) { // // Get the compressed size. // // Since ProtoStep7 (#issue 108) decodeBuffer.decodeValue(compressedSize, 32, 14); split -> store_ -> validateSize(split -> d_size_, compressedSize); split -> r_size_ = compressedSize; } } // // Update the size if the split // was not already loaded. // if (split -> state_ != split_loaded) { split -> data_.clear(); if (compressedSize > 0) { split -> c_size_ = compressedSize; #ifdef TEST *logofs << "SplitStore: Split data of size " << split -> d_size_ << " was compressed to " << split -> c_size_ << " bytes.\n" << logofs_flush; #endif split -> data_.resize(split -> c_size_); } else { split -> data_.resize(split -> d_size_); } unsigned char *data = split -> data_.begin(); data[0] = SPLIT_PATTERN; data[1] = SPLIT_PATTERN; } #ifdef TEST else { // // The message had been already // loaded from disk. // if (compressedSize > 0) { if ((int) compressedSize != split -> c_size_) { *logofs << "SplitStore: WARNING! Compressed data size is " << "different than the loaded compressed size.\n" << logofs_flush; } *logofs << "SplitStore: Ignoring the new size with " << "loaded compressed size " << split -> c_size_ << ".\n" << logofs_flush; } } #endif return 1; } int SplitStore::receive(DecodeBuffer &decodeBuffer) { if (splits_ -> size() == 0) { #ifdef PANIC *logofs << "SplitStore: PANIC! Function receive called with no splits available.\n" << logofs_flush; #endif cerr << "Error" << ": Function receive called with no splits available.\n"; HandleAbort(); } if (current_ == splits_ -> end()) { start(decodeBuffer); } // // Check first if split was aborted, else add // any new data to message being recomposed. // Split *split = *current_; unsigned int abort = 0; decodeBuffer.decodeBoolValue(abort); if (abort == 1) { #ifdef TEST *logofs << "SplitStore: Aborting split for checksum [" << DumpChecksum(split -> checksum_) << "] position " << split -> position_ << " with " << (split -> data_.size() - split -> next_) << " bytes to go " << "out of " << split -> data_.size() << ".\n" << logofs_flush; #endif statistics -> addSplitAborted(); statistics -> addSplitAbortedBytesOut(split -> r_size_ - split -> next_); split -> next_ = split -> r_size_; split -> state_ = split_aborted; } else { // // Get the size of the packet. // unsigned int count; decodeBuffer.decodeValue(count, 32, 10); // // If the split was not already loaded from // disk, decode the packet and update our // copy of the data. The encoding side may // have not received the abort event, yet, // and may be unaware that the message is // stored in compressed form at our side. // #ifdef TEST *logofs << "SplitStore: Receiving split for checksum [" << DumpChecksum(split -> checksum_) << "] count " << count << " position " << split -> position_ << ". Data size is " << split -> data_.size() << " (" << split -> d_size_ << "/" << split -> c_size_ << "/" << split -> r_size_ << "), " << split -> r_size_ - (split -> next_ + count) << " to go.\n" << logofs_flush; #endif if (split -> next_ + count > (unsigned) split -> r_size_) { #ifdef PANIC *logofs << "SplitStore: PANIC! Invalid data count " << count << "provided in the split.\n" << logofs_flush; *logofs << "SplitStore: PANIC! While receiving split for " << "checksum [" << DumpChecksum(split -> checksum_) << "] with count " << count << " action [" << DumpAction(split -> action_) << "] state [" << DumpState(split -> state_) << "]. Data size is " << split -> data_.size() << " (" << split -> d_size_ << "/" << split -> c_size_ << "), " << split -> data_.size() - (split -> next_ + count) << " to go.\n" << logofs_flush; #endif cerr << "Error" << ": Invalid data count " << count << "provided in the split.\n"; HandleAbort(); } if (split -> state_ != split_loaded) { #ifdef TEST if (split -> next_ + count > split -> data_.size()) { #ifdef PANIC *logofs << "SplitStore: PANIC! Inconsistent split data size " << split -> data_.size() << " with expected size " << split -> r_size_ << ".\n" << logofs_flush; #endif HandleAbort(); } #endif memcpy(split -> data_.begin() + split -> next_, decodeBuffer.decodeMemory(count), count); } else { #ifdef TEST *logofs << "SplitStore: WARNING! Data discarded with split " << "loaded from disk.\n" << logofs_flush; #endif decodeBuffer.decodeMemory(count); } split -> next_ += count; } // // Is unsplit complete? // if (split -> next_ != split -> r_size_) { return 0; } // // If the persistent cache is enabled, // we have a valid checksum and the // split was not originally retrieved // from disk, save the message on disk. // if (split -> state_ != split_loaded && split -> state_ != split_aborted) { save(split); } // // Move the split at the head of the // list to the commits. // remove(split); // // Reset the current position to the // end of the repository. // current_ = splits_ -> end(); #ifdef TEST *logofs << "SplitStore: Removed split at head of the list. " << "Resource is " << split -> resource_ << " request " << (unsigned) split -> store_ -> opcode() << " position " << split -> position_ << ".\n" << logofs_flush; #endif return 1; } Split *SplitStore::pop() { if (splits_ -> size() == 0) { #ifdef TEST *logofs << "SplitStore: The split store is empty.\n" << logofs_flush; #endif return NULL; } // // Move the pointer at the end of the list. // The next send operation will eventually // start a new split. // current_ = splits_ -> end(); Split *split = *(splits_ -> begin()); splits_ -> pop_front(); #ifdef TEST *logofs << "SplitStore: Removed split at the head of the " << "list with resource " << split -> resource_ << " request " << (unsigned) split -> store_ -> opcode() << " position " << split -> position_ << ".\n" << logofs_flush; #endif splitStorageSize_ -= getNodeSize(split); totalSplitSize_--; totalSplitStorageSize_ -= getNodeSize(split); #ifdef TEST *logofs << "SplitStore: There are " << splits_ -> size() << " messages in store [" << resource_ << "] with " << "storage size " << splitStorageSize_ << ".\n" << logofs_flush; *logofs << "SplitStore: Total messages in stores are " << totalSplitSize_ << " with total storage size " << totalSplitStorageSize_ << ".\n" << logofs_flush; #endif return split; } void SplitStore::remove(Split *split) { #ifdef TEST *logofs << "SplitStore: Going to remove the split from the list.\n" << logofs_flush; #endif #ifdef TEST if (split != getFirstSplit()) { #ifdef PANIC *logofs << "SplitStore: PANIC! Trying to remove a split " << "not at the head of the list.\n" << logofs_flush; #endif cerr << "Error" << ": Trying to remove a split " << "not at the head of the list.\n"; HandleAbort(); } #endif // // Move the split to the commit store. // splits_ -> pop_front(); commits_ -> splits_ -> push_back(split); splitStorageSize_ -= getNodeSize(split); totalSplitSize_--; totalSplitStorageSize_ -= getNodeSize(split); #ifdef TEST *logofs << "SplitStore: There are " << splits_ -> size() << " messages in store [" << resource_ << "] with " << "storage size " << splitStorageSize_ << ".\n" << logofs_flush; *logofs << "SplitStore: Total messages in stores are " << totalSplitSize_ << " with total storage size " << totalSplitStorageSize_ << ".\n" << logofs_flush; #endif #ifdef TEST if (splits_ -> size() == 0) { if (splitStorageSize_ != 0) { #ifdef PANIC *logofs << "SplitStore: PANIC! Internal error calculating " << "split data size. It is " << splitStorageSize_ << " while should be 0.\n" << logofs_flush; #endif cerr << "Error" << ": Internal error calculating " << "split data size. It is " << splitStorageSize_ << " while should be 0.\n"; HandleAbort(); } } #endif } const char *SplitStore::name(const T_checksum checksum) { if (checksum == NULL) { return NULL; } char *pathName = control -> ImageCachePath; if (pathName == NULL) { #ifdef PANIC *logofs << "SplitStore: PANIC! Cannot determine directory of " << "NX image files.\n" << logofs_flush; #endif return NULL; } int pathSize = strlen(pathName); // // File name is "[path][/I-c/I-][checksum][\0]", // where c is the first hex digit of checksum. // int nameSize = pathSize + 7 + MD5_LENGTH * 2 + 1; char *fileName = new char[nameSize]; if (fileName == NULL) { #ifdef PANIC *logofs << "SplitStore: PANIC! Cannot allocate space for " << "NX image file name.\n" << logofs_flush; #endif return NULL; } strcpy(fileName, pathName); sprintf(fileName + pathSize, "/I-%1X/I-", *((unsigned char *) checksum) >> 4); for (unsigned int i = 0; i < MD5_LENGTH; i++) { sprintf(fileName + pathSize + 7 + (i * 2), "%02X", ((unsigned char *) checksum)[i]); } return fileName; } int SplitStore::save(Split *split) { // // Check if saving the message on the // persistent cache is enabled. // if (split -> save_ == 0) { return 0; } T_checksum checksum = split -> checksum_; const char *fileName = name(checksum); if (fileName == NULL) { return 0; } unsigned int splitSize; ostream *fileStream = NULL; unsigned char *fileHeader = NULL; // // Get the other data from the split. // unsigned char opcode = split -> store_ -> opcode(); unsigned char *data = split -> data_.begin(); int dataSize = split -> d_size_; int compressedSize = split -> c_size_; #ifdef DEBUG *logofs << "SplitStore: Going to save split OPCODE#" << (unsigned int) opcode << " to file '" << fileName << "' with size " << dataSize << " and compressed size " << compressedSize << ".\n" << logofs_flush; #endif DisableSignals(); // // Change the mask to make the file only // readable by the user, then restore the // old mask. // mode_t fileMode; // // Check if the file already exists. We try to // load the message when the split is started // and save it only if it is not found. Still // the remote side may send the same image mul- // tiple time and we may not have the time to // notify the abort. // struct stat fileStat; if (stat(fileName, &fileStat) == 0) { #ifdef TEST *logofs << "SplitStore: Image file '" << fileName << "' already present on disk.\n" << logofs_flush; #endif goto SplitStoreSaveError; } fileMode = umask(0077); fileStream = new ofstream(fileName, ios::out | ios::binary); umask(fileMode); if (CheckData(fileStream) < 0) { #ifdef PANIC *logofs << "SplitStore: PANIC! Cannot open file '" << fileName << "' for output.\n" << logofs_flush; #endif goto SplitStoreSaveError; } fileHeader = new unsigned char[SPLIT_HEADER_SIZE]; if (fileHeader == NULL) { #ifdef PANIC *logofs << "SplitStore: PANIC! Cannot allocate space for " << "NX image header.\n" << logofs_flush; #endif goto SplitStoreSaveError; } // // Leave 3 bytes for future use. Please note // that, on some CPUs, we can't use PutULONG() // to write integers that are not aligned to // the word boundary. // *fileHeader = opcode; *(fileHeader + 1) = 0; *(fileHeader + 2) = 0; *(fileHeader + 3) = 0; PutULONG(dataSize, fileHeader + 4, false); PutULONG(compressedSize, fileHeader + 8, false); splitSize = (compressedSize > 0 ? compressedSize : dataSize); if (PutData(fileStream, fileHeader, SPLIT_HEADER_SIZE) < 0 || PutData(fileStream, data, splitSize) < 0) { #ifdef PANIC *logofs << "SplitStore: PANIC! Cannot write to NX " << "image file '" << fileName << "'.\n" << logofs_flush; #endif goto SplitStoreSaveError; } // // Check if all the data was written on the // disk and, if not, remove the faulty copy. // FlushData(fileStream); if (CheckData(fileStream) < 0) { #ifdef PANIC *logofs << "SplitStore: PANIC! Failed to write NX " << "image file '" << fileName << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Failed to write NX " << "image file '" << fileName << "'.\n"; goto SplitStoreSaveError; } #ifdef TEST *logofs << "SplitStore: Saved split to file '" << fileName << "' with data size " << dataSize << " and " << "compressed data size " << compressedSize << ".\n" << logofs_flush; #endif delete fileStream; delete [] fileName; delete [] fileHeader; EnableSignals(); // // Update the timestamp as the operation // may have taken some time. // getNewTimestamp(); return 1; SplitStoreSaveError: delete fileStream; if (fileName != NULL) { unlink(fileName); } delete [] fileName; delete [] fileHeader; EnableSignals(); return -1; } int SplitStore::find(Split *split) { const char *fileName = name(split -> checksum_); if (fileName == NULL) { return 0; } #ifdef DEBUG *logofs << "SplitStore: Going to find split OPCODE#" << (unsigned) split -> store_ -> opcode() << " in file '" << fileName << "'.\n" << logofs_flush; #endif // // Check if the file exists and, at the // same time, update the modification // time to prevent its deletion. // if (utime(fileName, NULL) == 0) { #ifdef TEST *logofs << "SplitStore: Found split OPCODE#" << (unsigned) split -> store_ -> opcode() << " in file '" << fileName << "'.\n" << logofs_flush; #endif delete [] fileName; return 1; } #ifdef TEST *logofs << "SplitStore: WARNING! Can't find split " << "OPCODE#" << (unsigned) split -> store_ -> opcode() << " in file '" << fileName << "'.\n" << logofs_flush; #endif delete [] fileName; return 0; } int SplitStore::load(Split *split) { // // Check if loading the image is enabled. // if (split -> load_ == 0) { return 0; } const char *fileName = name(split -> checksum_); if (fileName == NULL) { return 0; } unsigned char fileOpcode; int fileSize; int fileCSize; istream *fileStream = NULL; unsigned char *fileHeader = NULL; DisableSignals(); #ifdef DEBUG *logofs << "SplitStore: Going to load split OPCODE#" << (unsigned int) split -> store_ -> opcode() << " from file '" << fileName << "'.\n" << logofs_flush; #endif fileStream = new ifstream(fileName, ios::in | ios::binary); if (CheckData(fileStream) < 0) { #ifdef TEST *logofs << "SplitStore: WARNING! Can't open image file '" << fileName << "' on disk.\n" << logofs_flush; #endif goto SplitStoreLoadError; } fileHeader = new unsigned char[SPLIT_HEADER_SIZE]; if (fileHeader == NULL) { #ifdef PANIC *logofs << "SplitStore: PANIC! Cannot allocate space for " << "NX image header.\n" << logofs_flush; #endif cerr << "Error" << ": Cannot allocate space for " << "NX image header.\n"; goto SplitStoreLoadError; } if (GetData(fileStream, fileHeader, SPLIT_HEADER_SIZE) < 0) { #ifdef PANIC *logofs << "SplitStore: PANIC! Cannot read header from " << "NX image file '" << fileName << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Cannot read header from " << "NX image file '" << fileName << "'.\n"; goto SplitStoreLoadError; } fileOpcode = *fileHeader; fileSize = GetULONG(fileHeader + 4, false); fileCSize = GetULONG(fileHeader + 8, false); // // Don't complain if we find that data was saved // in compressed form even if we were not aware // of the compressed data size. The remote side // compresses the data only at the time it starts // the transferral of the split. We replace our // copy of the data with whatever we find on the // disk. // if (fileOpcode != split -> store_ -> opcode() || fileSize != split -> d_size_ || fileSize > control -> MaximumRequestSize || fileCSize > control -> MaximumRequestSize) { #ifdef TEST *logofs << "SplitStore: PANIC! Corrupted image file '" << fileName << "'. Expected " << (unsigned int) split -> store_ -> opcode() << "/" << split -> d_size_ << "/" << split -> c_size_ << " found " << (unsigned int) fileOpcode << "/" << fileSize << "/" << fileCSize << ".\n" << logofs_flush; #endif cerr << "Warning" << ": Corrupted image file '" << fileName << "'. Expected " << (unsigned int) split -> store_ -> opcode() << "/" << split -> d_size_ << "/" << split -> c_size_ << " found " << (unsigned int) fileOpcode << "/" << fileSize << "/" << fileCSize << ".\n"; goto SplitStoreLoadError; } // // Update the data size with the size // we got from the disk record. // split -> d_size_ = fileSize; split -> c_size_ = fileCSize; unsigned int splitSize; if (fileCSize > 0) { splitSize = fileCSize; } else { splitSize = fileSize; } // // Allocate a new buffer if we didn't // do that already or if the size is // different. // if (split -> data_.size() != splitSize) { split -> data_.clear(); split -> data_.resize(splitSize); } if (GetData(fileStream, split -> data_.begin(), splitSize) < 0) { #ifdef PANIC *logofs << "SplitStore: PANIC! Cannot read data from " << "NX image file '" << fileName << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Cannot read data from " << "NX image file '" << fileName << "'.\n"; goto SplitStoreLoadError; } delete fileStream; delete [] fileHeader; delete [] fileName; EnableSignals(); // // Update the timestamp as the operation // may have taken some time. // getNewTimestamp(); return 1; SplitStoreLoadError: delete fileStream; unlink(fileName); delete [] fileName; delete [] fileHeader; EnableSignals(); return -1; } Split *CommitStore::pop() { if (splits_ -> size() == 0) { #ifdef TEST *logofs << "CommitStore: The commit store is empty.\n" << logofs_flush; #endif return NULL; } Split *split = *(splits_ -> begin()); splits_ -> pop_front(); #ifdef TEST *logofs << "CommitStore: Removed commit split at the head " << "of the list with resource " << split -> resource_ << " request " << (unsigned) split -> store_ -> opcode() << " position " << split -> position_ << ".\n" << logofs_flush; #endif return split; } int CommitStore::expand(Split *split, unsigned char *buffer, const int size) { #ifdef TEST *logofs << "CommitStore: Expanding split data with " << size << " bytes to write.\n" << logofs_flush; #endif #ifdef TEST if (size < split -> i_size_ + split -> d_size_) { #ifdef PANIC *logofs << "CommitStore: PANIC! Wrong size of the provided " << "buffer. It should be " << split -> i_size_ + split -> d_size_ << " instead of " << size << ".\n" << logofs_flush; #endif cerr << "Error" << ": Wrong size of the provided " << "buffer. It should be " << split -> i_size_ + split -> d_size_ << " instead of " << size << ".\n"; HandleAbort(); } #endif #ifdef DEBUG *logofs << "CommitStore: Copying " << split -> i_size_ << " bytes of identity.\n" << logofs_flush; #endif memcpy(buffer, split -> identity_.begin(), split -> i_size_); // // Copy data, if any, to the buffer. // if (size > split -> i_size_) { // // Check if message has been stored // in compressed format. // if (split -> c_size_ == 0) { #ifdef DEBUG *logofs << "CommitStore: Copying " << split -> d_size_ << " bytes of plain data.\n" << logofs_flush; #endif memcpy(buffer + split -> i_size_, split -> data_.begin(), split -> d_size_); } else { #ifdef DEBUG *logofs << "CommitStore: Decompressing " << split -> c_size_ << " bytes and copying " << split -> d_size_ << " bytes of data.\n" << logofs_flush; #endif if (compressor_ -> decompressBuffer(buffer + split -> i_size_, split -> d_size_, split -> data_.begin(), split -> c_size_) < 0) { #ifdef PANIC *logofs << "CommitStore: PANIC! Split data decompression failed.\n" << logofs_flush; #endif cerr << "Error" << ": Split data decompression failed.\n"; return -1; } } } return 1; } int CommitStore::update(Split *split) { if (split -> action_ != IS_ADDED) { return 0; } // // We don't need the identity data at // the encoding side. // if (split -> identity_.size() == 0) { #ifdef TEST *logofs << "SplitStore: Going to update the size " << "for object at position " << split -> position_ << " with data size " << split -> d_size_ << " and compressed data size " << split -> c_size_ << ".\n" << logofs_flush; #endif split -> store_ -> updateData(split -> position_, split -> d_size_, split -> c_size_); } else { #ifdef TEST *logofs << "SplitStore: Going to update data and size " << "for object at position " << split -> position_ << " with data size " << split -> d_size_ << " and compressed data size " << split -> c_size_ << ".\n" << logofs_flush; #endif split -> store_ -> updateData(split -> position_, split -> data_.begin(), split -> d_size_, split -> c_size_); } // // Unlock message so that we can remove // or save it on disk at shutdown. // if (split -> action_ == IS_ADDED) { split -> store_ -> unlock(split -> position_); #ifdef TEST validate(split); #endif } return 1; } int CommitStore::validate(Split *split) { MessageStore *store = split -> store_; int p, n, s; s = store -> cacheSlots; for (p = 0, n = 0; p < s; p++) { if (store -> getLocks(p) == 1) { n++; } else if (store -> getLocks(p) != 0) { #ifdef PANIC *logofs << "CommitStore: PANIC! Repository for OPCODE#" << (unsigned int) store -> opcode() << " has " << store -> getLocks(p) << " locks for message " << "at position " << p << ".\n" << logofs_flush; #endif cerr << "Error" << ": Repository for OPCODE#" << (unsigned int) store -> opcode() << " has " << store -> getLocks(p) << " locks for message " << "at position " << p << ".\n"; HandleAbort(); } } #ifdef TEST *logofs << "CommitStore: Repository for OPCODE#" << (unsigned int) store -> opcode() << " has " << n << " locked messages.\n" << logofs_flush; #endif return 1; } nx-libs-3.5.99.23/nxcomp/src/Split.h0000644000000000000000000002331313614532331013650 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Split_H #define Split_H #include "Types.h" #include "Timestamp.h" #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Define this to know how many splits // are allocated and deallocated. // #undef REFERENCES // // Size of header of messages saved on // disk. // #define SPLIT_HEADER_SIZE 12 // // This class is used to divide big messages // in smaller chunks and send them at idle // time. // class EncodeBuffer; class DecodeBuffer; class SplitStore; class CommitStore; // // Preferred message streaming policy. // typedef enum { split_none = -1, split_async = 1, split_sync } T_split_mode; // // Current state of the split. Used to // implement the state machine. // typedef enum { split_undefined = -1, split_added, split_missed, split_loaded, split_aborted, split_notified } T_split_state; class Split { friend class SplitStore; friend class CommitStore; public: Split(); ~Split(); // // Note that, differently from the message // store, the split store doesn't account // for the data offset when dealing with // the data. This means that both the size_ // and c_size members represent the actual // size of the data part. // void compressedSize(int size) { c_size_ = size; store_ -> validateSize(d_size_, c_size_); } int compressedSize() { return c_size_; } int plainSize() { return i_size_ + d_size_; } T_checksum getChecksum() { return checksum_; } MessageStore *getStore() { return store_; } T_split_state getState() { return state_; } T_store_action getAction() { return action_; } // // We may need to find the resource // associated to the split message // because old protocol version use // a single store for all splits. // int getResource() { return resource_; } int getRequest() { return store_ -> opcode(); } int getPosition() { return position_; } T_split_mode getMode() { return mode_; } void setPolicy(int load, int save) { load_ = load; save_ = save; } void setState(T_split_state state) { state_ = state; } private: // // The agent's resource which is splitting // the message. // int resource_; // // Where to find the message in the message // store or the X sequence number of the // original request, in recent versions. // int position_; // // Which store is involved. // MessageStore *store_; // // Identity size of the message. // int i_size_; // // This is the uncompressed data size of the // original message. // int d_size_; // // This is the size of the compressed data, // if the data is stored in this form. // int c_size_; // // Size of the data buffer, as known by the // encoding side. This field is only used at // the decoding side. The remote size can be // different from the actual data size, if // the encoding side did not confirm that it // received the abort split event. // int r_size_; // // Position in the data buffer that will be // the target of the next send or receive // operation while streaming the message. // int next_; // // Load or save the split to disk. // int load_; int save_; // // Checksum of the original message. // T_checksum checksum_; // // Was this split confirmed or aborted? // T_split_state state_; // // What's the policy for sending this split? // T_split_mode mode_; // // Operation that had been performed on the // store at the time the split was added. // T_store_action action_; // // Container for the identity and data part // of the X message. // T_data identity_; T_data data_; #ifdef REFERENCES static int references_; #endif }; class SplitStore { public: SplitStore(StaticCompressor *compressor, CommitStore *commits, int resource); ~SplitStore(); Split *getFirstSplit() const { if (splits_ -> size() > 0) { return (*(splits_ -> begin())); } return NULL; } Split *getLastSplit() const { if (splits_ -> size() > 0) { return (*(--(splits_ -> end()))); } return NULL; } int getNodeSize(const Split *split) const { // // Take in account 64 bytes of overhead // for each node. // return (sizeof(class Split) + 64 + split -> i_size_ + split -> d_size_); } int getStorageSize() { return splitStorageSize_; } static int getTotalSize() { return totalSplitSize_; } static int getTotalStorageSize() { return totalSplitStorageSize_; } int getResource() { return resource_; } int getSize() { return splits_ -> size(); } T_splits *getSplits() { return splits_; } // // Used, respectively, at the encoding // and decoding side. // Split *add(MessageStore *store, int resource, T_split_mode mode, int position, T_store_action action, T_checksum checksum, const unsigned char *buffer, const int size); Split *add(MessageStore *store, int resource, int position, T_store_action action, T_checksum checksum, unsigned char *buffer, const int size); // // Handle the streaming of the message data. // int send(EncodeBuffer &encodeBuffer, int packetSize); int receive(DecodeBuffer &decodeBuffer); // // Remove the top element of the split store // and update the storage size. // void remove(Split *split); // // Load the message from disk and replace the // message in the store with the new copy. // int load(Split *split); // // Save the data to disk after the message has // been recomposed at the local side. // int save(Split *split); // // Find the message on disk and update the last // modification time. This is currently unused. // int find(Split *split); // // Remove the element on top of the queue and // discard any split data that still needs to // be transferred. // Split *pop(); // // Dump the content of the store. // void dump(); protected: // // Repository where to add the splits. // T_splits *splits_; // // Compress and decompress the data payload. // StaticCompressor *compressor_; private: int start(EncodeBuffer &encodeBuffer); int start(DecodeBuffer &decodeBuffer); void push(Split *split); // // Determine the name of the file object based // on the checksum. // const char *name(const T_checksum checksum); // // The number of elements and data bytes // in the repository. // int splitStorageSize_; static int totalSplitSize_; static int totalSplitStorageSize_; // // Current element being transferred. // T_splits::iterator current_; // // Repository where to move the splits // after they are completely recomposed. // CommitStore *commits_; // // Index in the client store or none, // if this is a commit store. // int resource_; #ifdef REFERENCES static int references_; #endif }; class CommitStore : public SplitStore { // // This is just a split store. // public: CommitStore(StaticCompressor *compressor) : SplitStore(compressor, NULL, nothing) { } // // Move identity and data of the split to the // provided buffer, uncompressing the message, // if needed. // int expand(Split *split, unsigned char *buffer, const int size); // // We recomposed the data part. If the message // was originally added to the message store, // replace the data and/or update the size. // int update(Split *split); // // Remove the split from the commit queue. // Split *pop(); // // This is just used for debug. It checks // if any message in the message store has // an invalid number of locks. // int validate(Split *split); }; #endif /* Split_H */ nx-libs-3.5.99.23/nxcomp/src/StaticCompressor.cpp0000644000000000000000000003101713614532331016414 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Z.h" #include "Misc.h" #include "Control.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" #include "StaticCompressor.h" #define PANIC #define WARNING #undef TEST #undef DEBUG StaticCompressor::StaticCompressor(int compressionLevel, int compressionThreshold) { buffer_ = NULL; bufferSize_ = 0; compressionStream_.zalloc = (alloc_func) 0; compressionStream_.zfree = (free_func) 0; compressionStream_.opaque = (voidpf) 0; decompressionStream_.zalloc = (alloc_func) 0; decompressionStream_.zfree = (free_func) 0; decompressionStream_.opaque = (void *) 0; decompressionStream_.next_in = (Bytef *) 0; decompressionStream_.avail_in = 0; #ifdef TEST *logofs << "StaticCompressor: Compression level is " << compressionLevel << ".\n" << logofs_flush; #endif int result = deflateInit2(&compressionStream_, compressionLevel, Z_DEFLATED, 15, 9, Z_DEFAULT_STRATEGY); if (result != Z_OK) { #ifdef PANIC *logofs << "StaticCompressor: PANIC! Cannot initialize the " << "compression stream. Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Cannot initialize the compression " << "stream. Error is '" << zError(result) << "'.\n"; HandleAbort(); } result = inflateInit2(&decompressionStream_, 15); if (result != Z_OK) { #ifdef PANIC *logofs << "StaticCompressor: PANIC! Cannot initialize the " << "decompression stream. Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Cannot initialize the decompression " << "stream. Error is '" << zError(result) << "'.\n"; HandleAbort(); } #ifdef TEST *logofs << "StaticCompressor: Compression threshold is " << compressionThreshold << ".\n" << logofs_flush; #endif threshold_ = compressionThreshold; } StaticCompressor::~StaticCompressor() { int result = deflateEnd(&compressionStream_); if (result != Z_OK) { #ifdef PANIC *logofs << "StaticCompressor: PANIC! Cannot deinitialize the " << "compression stream. Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Cannot deinitialize the compression " << "stream. Error is '" << zError(result) << "'.\n"; } result = inflateEnd(&decompressionStream_); if (result != Z_OK) { #ifdef PANIC *logofs << "StaticCompressor: PANIC! Cannot deinitialize the " << "decompression stream. Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Cannot deinitialize the decompression " << "stream. Error is '" << zError(result) << "'.\n"; } delete [] buffer_; } // // This function compresses and encodes the compressed // buffer. It returns a pointer to the internal buffer // where data was compressed. // int StaticCompressor::compressBuffer(const unsigned char *plainBuffer, const unsigned int plainSize, unsigned char *&compressedBuffer, unsigned int &compressedSize, EncodeBuffer &encodeBuffer) { if (control -> LocalDataCompression == 0 || compressBuffer(plainBuffer, plainSize, compressedBuffer, compressedSize) <= 0) { encodeBuffer.encodeBoolValue(0); encodeBuffer.encodeMemory(plainBuffer, plainSize); return 0; } else { encodeBuffer.encodeBoolValue(1); encodeBuffer.encodeValue(compressedSize, 32, 14); encodeBuffer.encodeValue(plainSize, 32, 14); encodeBuffer.encodeMemory(compressedBuffer, compressedSize); return 1; } } // // This function compresses data into a dynamically // allocated buffer and returns a pointer to it, so // application must copy data before the next call. // int StaticCompressor::compressBuffer(const unsigned char *plainBuffer, const unsigned int plainSize, unsigned char *&compressedBuffer, unsigned int &compressedSize) { #ifdef DEBUG *logofs << "StaticCompressor: Called for buffer at " << (void *) plainBuffer << ".\n" << logofs_flush; #endif compressedSize = plainSize; if (plainSize < (unsigned int) threshold_) { #ifdef TEST *logofs << "StaticCompressor: Leaving buffer unchanged. " << "Plain size is " << plainSize << " with threshold " << (unsigned int) threshold_ << ".\n" << logofs_flush; #endif return 0; } // // Determine the size of the temporary // buffer. // unsigned int newSize = plainSize + (plainSize / 1000) + 12; // // Allocate a new buffer if it grows // beyond 64K. // if (buffer_ == NULL || (bufferSize_ > 65536 && newSize < bufferSize_ / 2) || newSize > bufferSize_) { delete [] buffer_; buffer_ = new unsigned char[newSize]; if (buffer_ == NULL) { #ifdef PANIC *logofs << "StaticCompressor: PANIC! Can't allocate compression " << "buffer of " << newSize << " bytes. Error is " << EGET() << " ' " << ESTR() << "'.\n" << logofs_flush; #endif cerr << "Warning" << ": Can't allocate compression buffer of " << newSize << " bytes. Error is " << EGET() << " '" << ESTR() << "'.\n"; bufferSize_ = 0; return 0; } bufferSize_ = newSize; } unsigned int resultingSize = newSize; int result = ZCompress(&compressionStream_, buffer_, &resultingSize, plainBuffer, plainSize); if (result == Z_OK) { if (resultingSize > newSize) { #ifdef PANIC *logofs << "StaticCompressor: PANIC! Overflow in compression " << "buffer size. " << "Expected size was " << newSize << " while it is " << resultingSize << ".\n" << logofs_flush; #endif cerr << "Error" << ": Overflow in compress buffer size. " << "Expected size was " << newSize << " while it is " << resultingSize << ".\n"; return -1; } else if (resultingSize >= plainSize) { #ifdef TEST *logofs << "StaticCompressor: Leaving buffer unchanged. " << "Plain size is " << plainSize << " compressed " << "size is " << resultingSize << ".\n" << logofs_flush; #endif return 0; } compressedBuffer = buffer_; compressedSize = resultingSize; #ifdef TEST *logofs << "StaticCompressor: Compressed buffer from " << plainSize << " to " << resultingSize << " bytes.\n" << logofs_flush; #endif return 1; } #ifdef PANIC *logofs << "StaticCompressor: PANIC! Failed compression of buffer. " << "Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed compression of buffer. " << "Error is '" << zError(result) << "'.\n"; return -1; } int StaticCompressor::decompressBuffer(unsigned char *plainBuffer, unsigned int plainSize, const unsigned char *&compressedBuffer, unsigned int &compressedSize, DecodeBuffer &decodeBuffer) { #ifdef DEBUG *logofs << "StaticCompressor: Called for buffer at " << (void *) plainBuffer << ".\n" << logofs_flush; #endif unsigned int value; decodeBuffer.decodeBoolValue(value); if (value == 0) { memcpy(plainBuffer, decodeBuffer.decodeMemory(plainSize), plainSize); return 0; } unsigned int checkSize = plainSize; decodeBuffer.decodeValue(value, 32, 14); compressedSize = value; decodeBuffer.decodeValue(value, 32, 14); checkSize = value; // // If caller needs the original compressed // data it must copy this to its own buffer // before using any further decode function. // compressedBuffer = decodeBuffer.decodeMemory(compressedSize); int result = ZDecompress(&decompressionStream_, plainBuffer, &checkSize, compressedBuffer, compressedSize); if (result != Z_OK) { #ifdef PANIC *logofs << "StaticCompressor: PANIC! Failure decompressing buffer. " << "Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failure decompressing buffer. " << "Error is '" << zError(result) << "'.\n"; return -1; } else if (plainSize != checkSize) { #ifdef PANIC *logofs << "StaticCompressor: PANIC! Expected decompressed size was " << plainSize << " while it is " << checkSize << ".\n" << logofs_flush; #endif cerr << "Error" << ": Expected decompressed size was " << plainSize << " while it is " << checkSize << ".\n"; return -1; } return 1; } // // This is used to uncompress on-the-fly // messages whose data has been stored // in compressed format. // int StaticCompressor::decompressBuffer(unsigned char *plainBuffer, const unsigned int plainSize, const unsigned char *compressedBuffer, const unsigned int compressedSize) { #ifdef TEST *logofs << "StaticCompressor: Called for buffer at " << (void *) plainBuffer << ".\n" << logofs_flush; #endif unsigned int checkSize = plainSize; int result = ZDecompress(&decompressionStream_, plainBuffer, &checkSize, compressedBuffer, compressedSize); if (result != Z_OK) { #ifdef PANIC *logofs << "StaticCompressor: PANIC! Failure decompressing buffer. " << "Error is '" << zError(result) << "'.\n" << logofs_flush; #endif return -1; } if (plainSize != checkSize) { #ifdef PANIC *logofs << "StaticCompressor: PANIC! Expected decompressed size was " << plainSize << " while it is " << checkSize << ".\n" << logofs_flush; #endif cerr << "Error" << ": Expected decompressed size was " << plainSize << " while it is " << checkSize << ".\n"; return -1; } #ifdef TEST *logofs << "StaticCompressor: Decompressed buffer from " << compressedSize << " to " << plainSize << " bytes.\n" << logofs_flush; #endif return 1; } nx-libs-3.5.99.23/nxcomp/src/StaticCompressor.h0000644000000000000000000000660413614532331016065 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef StaticCompressor_H #define StaticCompressor_H #include "Z.h" class EncodeBuffer; class DecodeBuffer; class StaticCompressor { public: StaticCompressor(int compressionLevel, int compressionThreshold); ~StaticCompressor(); int compressBuffer(const unsigned char *plainBuffer, const unsigned int plainSize, unsigned char *&compressedBuffer, unsigned int &compressedSize, EncodeBuffer &encodeBuffer); int compressBuffer(const unsigned char *plainBuffer, const unsigned int plainSize, unsigned char *&compressedBuffer, unsigned int &compressedSize); int decompressBuffer(unsigned char *plainBuffer, unsigned int plainSize, const unsigned char *&compressedBuffer, unsigned int &compressedSize, DecodeBuffer &decodeBuffer); int decompressBuffer(unsigned char *plainBuffer, const unsigned int plainSize, const unsigned char *compressedBuffer, const unsigned compressedSize); static int isCompressionLevel(int compressionLevel) { return (compressionLevel == Z_DEFAULT_COMPRESSION || (compressionLevel >= Z_NO_COMPRESSION && compressionLevel <= Z_BEST_COMPRESSION)); } int fullReset() { return (deflateReset(&compressionStream_) == Z_OK && inflateReset(&decompressionStream_) == Z_OK); } private: z_stream compressionStream_; z_stream decompressionStream_; unsigned char *buffer_; unsigned int bufferSize_; int threshold_; }; #endif nx-libs-3.5.99.23/nxcomp/src/Statistics.cpp0000644000000000000000000015312013614532331015242 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "Statistics.h" #include "Control.h" #include "Proxy.h" #include "ClientStore.h" #include "ServerStore.h" // // Length of temporary buffer // used to format output. // #define FORMAT_LENGTH 1024 // // Log level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Note that when presenting statistics we invert the // correct semantics of X client and server entities. // This is questionable, but matches the user's pers- // pective of running remote X applications on its // local client. // Statistics::Statistics(Proxy *proxy) : proxy_(proxy) { transportPartial_.idleTime_ = 0; transportPartial_.readTime_ = 0; transportPartial_.writeTime_ = 0; transportPartial_.proxyBytesIn_ = 0; transportPartial_.proxyBytesOut_ = 0; transportPartial_.proxyFramesIn_ = 0; transportPartial_.proxyFramesOut_ = 0; transportPartial_.proxyWritesOut_ = 0; transportPartial_.compressedBytesIn_ = 0; transportPartial_.compressedBytesOut_ = 0; transportPartial_.decompressedBytesIn_ = 0; transportPartial_.decompressedBytesOut_ = 0; transportPartial_.framingBitsOut_ = 0; transportTotal_.idleTime_ = 0; transportTotal_.readTime_ = 0; transportTotal_.writeTime_ = 0; transportTotal_.proxyBytesIn_ = 0; transportTotal_.proxyBytesOut_ = 0; transportTotal_.proxyFramesIn_ = 0; transportTotal_.proxyFramesOut_ = 0; transportTotal_.proxyWritesOut_ = 0; transportTotal_.compressedBytesIn_ = 0; transportTotal_.compressedBytesOut_ = 0; transportTotal_.decompressedBytesIn_ = 0; transportTotal_.decompressedBytesOut_ = 0; transportTotal_.framingBitsOut_ = 0; for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) { protocolPartial_.requestCached_[i] = 0; protocolPartial_.requestReplied_[i] = 0; protocolPartial_.requestCount_[i] = 0; protocolPartial_.requestBitsIn_[i] = 0; protocolPartial_.requestBitsOut_[i] = 0; protocolPartial_.renderRequestCached_[i] = 0; protocolPartial_.renderRequestCount_[i] = 0; protocolPartial_.renderRequestBitsIn_[i] = 0; protocolPartial_.renderRequestBitsOut_[i] = 0; protocolPartial_.replyCached_[i] = 0; protocolPartial_.replyCount_[i] = 0; protocolPartial_.replyBitsIn_[i] = 0; protocolPartial_.replyBitsOut_[i] = 0; protocolPartial_.eventCached_[i] = 0; protocolPartial_.eventCount_[i] = 0; protocolPartial_.eventBitsIn_[i] = 0; protocolPartial_.eventBitsOut_[i] = 0; protocolTotal_.requestCached_[i] = 0; protocolTotal_.requestReplied_[i] = 0; protocolTotal_.requestCount_[i] = 0; protocolTotal_.requestBitsIn_[i] = 0; protocolTotal_.requestBitsOut_[i] = 0; protocolTotal_.renderRequestCached_[i] = 0; protocolTotal_.renderRequestCount_[i] = 0; protocolTotal_.renderRequestBitsIn_[i] = 0; protocolTotal_.renderRequestBitsOut_[i] = 0; protocolTotal_.replyCached_[i] = 0; protocolTotal_.replyCount_[i] = 0; protocolTotal_.replyBitsIn_[i] = 0; protocolTotal_.replyBitsOut_[i] = 0; protocolTotal_.eventCached_[i] = 0; protocolTotal_.eventCount_[i] = 0; protocolTotal_.eventBitsIn_[i] = 0; protocolTotal_.eventBitsOut_[i] = 0; } protocolPartial_.cupsCount_ = 0; protocolPartial_.cupsBitsIn_ = 0; protocolPartial_.cupsBitsOut_ = 0; protocolPartial_.smbCount_ = 0; protocolPartial_.smbBitsIn_ = 0; protocolPartial_.smbBitsOut_ = 0; protocolPartial_.mediaCount_ = 0; protocolPartial_.mediaBitsIn_ = 0; protocolPartial_.mediaBitsOut_ = 0; protocolPartial_.httpCount_ = 0; protocolPartial_.httpBitsIn_ = 0; protocolPartial_.httpBitsOut_ = 0; protocolPartial_.fontCount_ = 0; protocolPartial_.fontBitsIn_ = 0; protocolPartial_.fontBitsOut_ = 0; protocolPartial_.slaveCount_ = 0; protocolPartial_.slaveBitsIn_ = 0; protocolPartial_.slaveBitsOut_ = 0; protocolTotal_.cupsCount_ = 0; protocolTotal_.cupsBitsIn_ = 0; protocolTotal_.cupsBitsOut_ = 0; protocolTotal_.smbCount_ = 0; protocolTotal_.smbBitsIn_ = 0; protocolTotal_.smbBitsOut_ = 0; protocolTotal_.mediaCount_ = 0; protocolTotal_.mediaBitsIn_ = 0; protocolTotal_.mediaBitsOut_ = 0; protocolTotal_.httpCount_ = 0; protocolTotal_.httpBitsIn_ = 0; protocolTotal_.httpBitsOut_ = 0; protocolTotal_.fontCount_ = 0; protocolTotal_.fontBitsIn_ = 0; protocolTotal_.fontBitsOut_ = 0; protocolTotal_.slaveCount_ = 0; protocolTotal_.slaveBitsIn_ = 0; protocolTotal_.slaveBitsOut_ = 0; packedPartial_.packedBytesIn_ = 0; packedPartial_.packedBytesOut_ = 0; packedTotal_.packedBytesIn_ = 0; packedTotal_.packedBytesOut_ = 0; splitPartial_.splitCount_ = 0; splitPartial_.splitAborted_ = 0; splitPartial_.splitAbortedBytesOut_ = 0; splitTotal_.splitCount_ = 0; splitTotal_.splitAborted_ = 0; splitTotal_.splitAbortedBytesOut_ = 0; overallPartial_.overallBytesIn_ = 0; overallPartial_.overallBytesOut_ = 0; overallTotal_.overallBytesIn_ = 0; overallTotal_.overallBytesOut_ = 0; proxyData_.protocolCount_ = 0; proxyData_.controlCount_ = 0; proxyData_.splitCount_ = 0; proxyData_.dataCount_ = 0; proxyData_.streamRatio_ = 1; startShortFrameTs_ = getTimestamp(); startLongFrameTs_ = getTimestamp(); startFrameTs_ = getTimestamp(); bytesInShortFrame_ = 0; bytesInLongFrame_ = 0; bitrateInShortFrame_ = 0; bitrateInLongFrame_ = 0; topBitrate_ = 0; congestionInFrame_ = 0; } Statistics::~Statistics() { } int Statistics::resetPartialStats() { transportPartial_.idleTime_ = 0; transportPartial_.readTime_ = 0; transportPartial_.writeTime_ = 0; transportPartial_.proxyBytesIn_ = 0; transportPartial_.proxyBytesOut_ = 0; transportPartial_.proxyFramesIn_ = 0; transportPartial_.proxyFramesOut_ = 0; transportPartial_.proxyWritesOut_ = 0; transportPartial_.compressedBytesIn_ = 0; transportPartial_.compressedBytesOut_ = 0; transportPartial_.decompressedBytesIn_ = 0; transportPartial_.decompressedBytesOut_ = 0; transportPartial_.framingBitsOut_ = 0; for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) { protocolPartial_.requestCached_[i] = 0; protocolPartial_.requestReplied_[i] = 0; protocolPartial_.requestCount_[i] = 0; protocolPartial_.requestBitsIn_[i] = 0; protocolPartial_.requestBitsOut_[i] = 0; protocolPartial_.renderRequestCached_[i] = 0; protocolPartial_.renderRequestCount_[i] = 0; protocolPartial_.renderRequestBitsIn_[i] = 0; protocolPartial_.renderRequestBitsOut_[i] = 0; protocolPartial_.replyCached_[i] = 0; protocolPartial_.replyCount_[i] = 0; protocolPartial_.replyBitsIn_[i] = 0; protocolPartial_.replyBitsOut_[i] = 0; protocolPartial_.eventCached_[i] = 0; protocolPartial_.eventCount_[i] = 0; protocolPartial_.eventBitsIn_[i] = 0; protocolPartial_.eventBitsOut_[i] = 0; } protocolPartial_.cupsCount_ = 0; protocolPartial_.cupsBitsIn_ = 0; protocolPartial_.cupsBitsOut_ = 0; protocolPartial_.smbCount_ = 0; protocolPartial_.smbBitsIn_ = 0; protocolPartial_.smbBitsOut_ = 0; protocolPartial_.mediaCount_ = 0; protocolPartial_.mediaBitsIn_ = 0; protocolPartial_.mediaBitsOut_ = 0; protocolPartial_.httpCount_ = 0; protocolPartial_.httpBitsIn_ = 0; protocolPartial_.httpBitsOut_ = 0; protocolPartial_.fontCount_ = 0; protocolPartial_.fontBitsIn_ = 0; protocolPartial_.fontBitsOut_ = 0; protocolPartial_.slaveCount_ = 0; protocolPartial_.slaveBitsIn_ = 0; protocolPartial_.slaveBitsOut_ = 0; packedPartial_.packedBytesIn_ = 0; packedPartial_.packedBytesOut_ = 0; splitPartial_.splitCount_ = 0; splitPartial_.splitAborted_ = 0; splitPartial_.splitAbortedBytesOut_ = 0; overallPartial_.overallBytesIn_ = 0; overallPartial_.overallBytesOut_ = 0; return 1; } void Statistics::addCompressedBytes(unsigned int bytesIn, unsigned int bytesOut) { transportPartial_.compressedBytesIn_ += bytesIn; transportTotal_.compressedBytesIn_ += bytesIn; transportPartial_.compressedBytesOut_ += bytesOut; transportTotal_.compressedBytesOut_ += bytesOut; double ratio = bytesIn / bytesOut; if (ratio < 1) { ratio = 1; } #if defined(TEST) || defined(TOKEN) *logofs << "Statistics: TOKEN! Old ratio was " << proxyData_.streamRatio_ << " current is " << (double) ratio << " new ratio is " << (double) ((proxyData_.streamRatio_ * 2) + ratio) / 3 << ".\n" << logofs_flush; #endif proxyData_.streamRatio_ = ((proxyData_.streamRatio_ * 2) + ratio) / 3; #if defined(TEST) || defined(TOKEN) *logofs << "Statistics: TOKEN! Updated compressed bytes " << "with " << bytesIn << " in " << bytesOut << " out " << "and ratio " << (double) proxyData_.streamRatio_ << ".\n" << logofs_flush; #endif } // // Recalculate the current bitrate. The bytes written // are accounted at the time the transport actually // writes the data to the network, not at the time it // receives the data from the upper layers. The reason // is that data can be compressed by the stream com- // pressor, so we can become aware of the new bitrate // only after having flushed the ZLIB stream. This also // means that, to have a reliable estimatation, we need // to flush the link often. // void Statistics::updateBitrate(int bytes) { T_timestamp thisFrameTs = getNewTimestamp(); int diffFramesInMs = diffTimestamp(startFrameTs_, thisFrameTs); #ifdef DEBUG *logofs << "Statistics: Difference since previous timestamp is " << diffFramesInMs << " ms.\n" << logofs_flush; #endif if (diffFramesInMs > 0) { #ifdef DEBUG *logofs << "Statistics: Removing " << diffFramesInMs << " ms in short and long time frame.\n" << logofs_flush; #endif int shortBytesToRemove = (int) (((double) bytesInShortFrame_ * (double) diffFramesInMs) / (double) control -> ShortBitrateTimeFrame); int longBytesToRemove = (int) (((double) bytesInLongFrame_ * (double) diffFramesInMs) / (double) control -> LongBitrateTimeFrame); #ifdef DEBUG *logofs << "Statistics: Removing " << shortBytesToRemove << " bytes from " << bytesInShortFrame_ << " in the short frame.\n" << logofs_flush; #endif bytesInShortFrame_ -= shortBytesToRemove; if (bytesInShortFrame_ < 0) { #ifdef TEST *logofs << "Statistics: Bytes in short frame are " << bytesInShortFrame_ << ". Set to 0.\n" << logofs_flush; #endif bytesInShortFrame_ = 0; } #ifdef DEBUG *logofs << "Statistics: Removing " << longBytesToRemove << " bytes from " << bytesInLongFrame_ << " in the long frame.\n" << logofs_flush; #endif bytesInLongFrame_ -= longBytesToRemove; if (bytesInLongFrame_ < 0) { #ifdef TEST *logofs << "Statistics: Bytes in long frame are " << bytesInLongFrame_ << ". Set to 0.\n" << logofs_flush; #endif bytesInLongFrame_ = 0; } int diffStartInMs; diffStartInMs = diffTimestamp(thisFrameTs, startShortFrameTs_); if (diffStartInMs > control -> ShortBitrateTimeFrame) { addMsTimestamp(startShortFrameTs_, diffStartInMs); } diffStartInMs = diffTimestamp(thisFrameTs, startLongFrameTs_); if (diffStartInMs > control -> LongBitrateTimeFrame) { addMsTimestamp(startLongFrameTs_, diffStartInMs); } startFrameTs_ = thisFrameTs; } #ifdef DEBUG *logofs << "Statistics: Adding " << bytes << " bytes to " << bytesInShortFrame_ << " in the short frame.\n" << logofs_flush; #endif bytesInShortFrame_ = bytesInShortFrame_ + bytes; #ifdef DEBUG *logofs << "Statistics: Adding " << bytes << " bytes to " << bytesInLongFrame_ << " in the long frame.\n" << logofs_flush; #endif bytesInLongFrame_ = bytesInLongFrame_ + bytes; bitrateInShortFrame_ = (int) ((double) bytesInShortFrame_ / ((double) control -> ShortBitrateTimeFrame / 1000)); bitrateInLongFrame_ = (int) ((double) bytesInLongFrame_ / ((double) control -> LongBitrateTimeFrame / 1000)); if (bitrateInShortFrame_ > topBitrate_) { topBitrate_ = bitrateInShortFrame_; } #ifdef TEST *logofs << "Statistics: Current bitrate is short " << bitrateInShortFrame_ << " long " << bitrateInLongFrame_ << " top " << topBitrate_ << ".\n" << logofs_flush; #endif } void Statistics::updateCongestion(int remaining, int limit) { #ifdef TEST *logofs << "Statistics: Updating the congestion " << "counters at " << strMsTimestamp() << ".\n" << logofs_flush; #endif double current = remaining; if (current < 0) { current = 0; } current = 9 * (limit - current) / limit; #ifdef TEST *logofs << "Statistics: Current congestion is " << current << " with " << limit << " tokens " << "and " << remaining << " remaining.\n" << logofs_flush; #endif // // If the current congestion counter is greater // than the previous, take the current value, // otherwise ramp down the value by calculating // the average of the last 8 updates. // #ifdef TEST *logofs << "Statistics: Old congestion was " << congestionInFrame_; #endif if (current >= congestionInFrame_) { congestionInFrame_ = current; } else { congestionInFrame_ = ((congestionInFrame_ * 7) + current) / 8; } #ifdef TEST *logofs << " new congestion is " << ((congestionInFrame_ * 7) + current) / 8 << ".\n" << logofs_flush; #endif // // Call the function with 0 bytes flushed // so the agent can update its congestion // counter. // FlushCallback(0); } int Statistics::getClientCacheStats(int type, char *&buffer) { if (type != PARTIAL_STATS && type != TOTAL_STATS) { #ifdef PANIC *logofs << "Statistics: PANIC! Cannot produce statistics " << "with qualifier '" << type << "'.\n" << logofs_flush; #endif return -1; } // // Print message cache data according // to local and remote view. // MessageStore *currentStore = NULL; MessageStore *anyStore = NULL; char format[FORMAT_LENGTH]; strcat(buffer, "\nNX Cache Statistics\n"); strcat(buffer, "-------------------\n\n"); for (int m = proxy_client; m <= proxy_server; m++) { if (m == proxy_client) { strcat(buffer, "Request\tCached\tSize at Server\t\tSize at Client\t\tCache limit\n"); strcat(buffer, "-------\t------\t--------------\t\t--------------\t\t-----------\n"); } else { strcat(buffer, "\nReply\tCached\tSize at Server\t\tSize at Client\t\tCache limit\n"); strcat(buffer, "-----\t------\t--------------\t\t--------------\t\t-----------\n"); } for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) { if (m == proxy_client) { currentStore = proxy_ -> getClientStore() -> getRequestStore(i); } else { currentStore = proxy_ -> getServerStore() -> getReplyStore(i); } if (currentStore != NULL && (currentStore -> getLocalStorageSize() || currentStore -> getRemoteStorageSize())) { anyStore = currentStore; sprintf(format, "#%d\t%d\t", i, currentStore -> getSize()); strcat(buffer, format); sprintf(format, "%d (%.0f KB)\t\t", currentStore -> getLocalStorageSize(), ((double) currentStore -> getLocalStorageSize()) / 1024); strcat(buffer, format); sprintf(format, "%d (%.0f KB)\t\t", currentStore -> getRemoteStorageSize(), ((double) currentStore -> getRemoteStorageSize()) / 1024); strcat(buffer, format); sprintf(format, "%d/%.0f KB\n", currentStore -> cacheSlots, ((double) control -> getUpperStorageSize() / 100 * currentStore -> cacheThreshold) / 1024); strcat(buffer, format); } } if (anyStore == NULL) { strcat(buffer, "N/A\n"); } } if (anyStore != NULL) { sprintf(format, "\ncache: %d bytes (%d KB) available at server.\n", control -> ClientTotalStorageSize, control -> ClientTotalStorageSize / 1024); strcat(buffer, format); sprintf(format, " %d bytes (%d KB) available at client.\n\n", control -> ServerTotalStorageSize, control -> ServerTotalStorageSize / 1024); strcat(buffer, format); sprintf(format, " %d bytes (%d KB) allocated at server.\n", anyStore -> getLocalTotalStorageSize(), anyStore -> getLocalTotalStorageSize() / 1024); strcat(buffer, format); sprintf(format, " %d bytes (%d KB) allocated at client.\n\n\n", anyStore -> getRemoteTotalStorageSize(), anyStore -> getRemoteTotalStorageSize() / 1024); strcat(buffer, format); } else { strcat(buffer, "\ncache: N/A\n\n"); } return 1; } int Statistics::getClientProtocolStats(int type, char *&buffer) { if (type != PARTIAL_STATS && type != TOTAL_STATS) { #ifdef PANIC *logofs << "Statistics: PANIC! Cannot produce statistics " << "with qualifier '" << type << "'.\n" << logofs_flush; #endif return -1; } struct T_transportData *transportData; struct T_protocolData *protocolData; struct T_overallData *overallData; if (type == PARTIAL_STATS) { transportData = &transportPartial_; protocolData = &protocolPartial_; overallData = &overallPartial_; } else { transportData = &transportTotal_; protocolData = &protocolTotal_; overallData = &overallTotal_; } char format[FORMAT_LENGTH]; double countRequestIn = 0; double countCachedRequestIn = 0; double countRepliedRequestIn = 0; double countRequestBitsIn = 0; double countRequestBitsOut = 0; double countAnyIn = 0; double countBitsIn = 0; double countBitsOut = 0; // // Print request data. // strcat(buffer, "NX Server Side Protocol Statistics\n"); strcat(buffer, "----------------------------------\n\n"); // // Print render data. // strcat(buffer, "Render Total\tCached\tBits In\t\tBits Out\tBits/Request\t\tRatio\n"); strcat(buffer, "------- -----\t------\t-------\t\t--------\t------------\t\t-----\n"); for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) { if (protocolData -> renderRequestCount_[i]) { sprintf(format, "#%d ", i); while (strlen(format) < 8) { strcat(format, " "); } strcat(buffer, format); if (protocolData -> renderRequestCached_[i] > 0) { sprintf(format, "%.0f\t%.0f", protocolData -> renderRequestCount_[i], protocolData -> renderRequestCached_[i]); } else { sprintf(format, "%.0f\t", protocolData -> renderRequestCount_[i]); } strcat(buffer, format); sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", protocolData -> renderRequestBitsIn_[i], protocolData -> renderRequestBitsIn_[i] / 8192, protocolData -> renderRequestBitsOut_[i], protocolData -> renderRequestBitsOut_[i] / 8192, protocolData -> renderRequestBitsIn_[i] / protocolData -> renderRequestCount_[i], protocolData -> renderRequestBitsOut_[i] / protocolData -> renderRequestCount_[i]); strcat(buffer, format); if (protocolData -> renderRequestBitsOut_[i] > 0) { sprintf(format, "%5.3f:1\n", protocolData -> renderRequestBitsIn_[i] / protocolData -> renderRequestBitsOut_[i]); strcat(buffer, format); } else { strcat(buffer, "1:1\n"); } } countRequestIn += protocolData -> renderRequestCount_[i]; countCachedRequestIn += protocolData -> renderRequestCached_[i]; countRequestBitsIn += protocolData -> renderRequestBitsIn_[i]; countRequestBitsOut += protocolData -> renderRequestBitsOut_[i]; countAnyIn += protocolData -> renderRequestCount_[i]; countBitsIn += protocolData -> renderRequestBitsIn_[i]; countBitsOut += protocolData -> renderRequestBitsOut_[i]; } if (countRequestIn > 0) { if (countCachedRequestIn > 0) { sprintf(format, "\ntotal: %.0f\t%.0f", countRequestIn, countCachedRequestIn); } else { sprintf(format, "\ntotal: %.0f\t", countRequestIn); } strcat(buffer, format); sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", countRequestBitsIn, countRequestBitsIn / 8192, countRequestBitsOut, countRequestBitsOut / 8192, countRequestBitsIn / countRequestIn, countRequestBitsOut / countRequestIn); strcat(buffer, format); if (countRequestBitsOut > 0) { sprintf(format, "%5.3f:1\n", countRequestBitsIn / countRequestBitsOut); } else { sprintf(format, "1:1\n"); } strcat(buffer, format); } else { strcat(buffer, "N/A\n\n"); } countRequestIn = 0; countCachedRequestIn = 0; countRequestBitsIn = 0; countRequestBitsOut = 0; countAnyIn = 0; countBitsIn = 0; countBitsOut = 0; // // Print other requests' data. // strcat(buffer, "\nRequest Total\tCached\tBits In\t\tBits Out\tBits/Request\t\tRatio\n"); strcat(buffer, "------- -----\t------\t-------\t\t--------\t------------\t\t-----\n"); for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) { if (protocolData -> requestCount_[i]) { sprintf(format, "#%d ", i); while (strlen(format) < 5) { strcat(format, " "); } // // Mark NX agent-related requests, those // having a reply and finally those that // have been probably tainted by client // side. // if (i >= X_NXFirstOpcode && i <= X_NXLastOpcode) { strcat(format, "A"); } if (i != X_NXInternalGenericReply && protocolData -> requestReplied_[i] > 0) { strcat(format, "R"); } if (i == X_NoOperation && control -> TaintReplies) { strcat(format, "T"); } while (strlen(format) < 8) { strcat(format, " "); } strcat(buffer, format); if (protocolData -> requestCached_[i] > 0) { sprintf(format, "%.0f\t%.0f", protocolData -> requestCount_[i], protocolData -> requestCached_[i]); } else { sprintf(format, "%.0f\t", protocolData -> requestCount_[i]); } strcat(buffer, format); sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", protocolData -> requestBitsIn_[i], protocolData -> requestBitsIn_[i] / 8192, protocolData -> requestBitsOut_[i], protocolData -> requestBitsOut_[i] / 8192, protocolData -> requestBitsIn_[i] / protocolData -> requestCount_[i], protocolData -> requestBitsOut_[i] / protocolData -> requestCount_[i]); strcat(buffer, format); if (protocolData -> requestBitsOut_[i] > 0) { sprintf(format, "%5.3f:1\n", protocolData -> requestBitsIn_[i] / protocolData -> requestBitsOut_[i]); strcat(buffer, format); } else { strcat(buffer, "1:1\n"); } } countRequestIn += protocolData -> requestCount_[i]; countCachedRequestIn += protocolData -> requestCached_[i]; countRepliedRequestIn += protocolData -> requestReplied_[i]; countRequestBitsIn += protocolData -> requestBitsIn_[i]; countRequestBitsOut += protocolData -> requestBitsOut_[i]; countAnyIn += protocolData -> requestCount_[i]; countBitsIn += protocolData -> requestBitsIn_[i]; countBitsOut += protocolData -> requestBitsOut_[i]; } if (countRequestIn > 0) { if (countCachedRequestIn > 0) { sprintf(format, "\ntotal: %.0f\t%.0f", countRequestIn, countCachedRequestIn); } else { sprintf(format, "\ntotal: %.0f\t", countRequestIn); } strcat(buffer, format); sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", countRequestBitsIn, countRequestBitsIn / 8192, countRequestBitsOut, countRequestBitsOut / 8192, countRequestBitsIn / countRequestIn, countRequestBitsOut / countRequestIn); strcat(buffer, format); if (countRequestBitsOut > 0) { sprintf(format, "%5.3f:1\n", countRequestBitsIn / countRequestBitsOut); } else { sprintf(format, "1:1\n"); } strcat(buffer, format); } else { strcat(buffer, "N/A\n\n"); } // // Print transport data. // getTimeStats(type, buffer); countAnyIn += protocolData -> cupsCount_; countBitsIn += protocolData -> cupsBitsIn_; countBitsOut += protocolData -> cupsBitsOut_; countAnyIn += protocolData -> smbCount_; countBitsIn += protocolData -> smbBitsIn_; countBitsOut += protocolData -> smbBitsOut_; countAnyIn += protocolData -> mediaCount_; countBitsIn += protocolData -> mediaBitsIn_; countBitsOut += protocolData -> mediaBitsOut_; countAnyIn += protocolData -> httpCount_; countBitsIn += protocolData -> httpBitsIn_; countBitsOut += protocolData -> httpBitsOut_; countAnyIn += protocolData -> fontCount_; countBitsIn += protocolData -> fontBitsIn_; countBitsOut += protocolData -> fontBitsOut_; countAnyIn += protocolData -> slaveCount_; countBitsIn += protocolData -> slaveBitsIn_; countBitsOut += protocolData -> slaveBitsOut_; // // Save the overall amount of bytes // coming from X clients. // overallData -> overallBytesIn_ = countBitsIn / 8; // // Print performance data. // if (transportData -> readTime_ > 0) { sprintf(format, " %.0f messages (%.0f KB) encoded per second.\n\n", countAnyIn / (transportData -> readTime_ / 1000), (countBitsIn + transportData -> framingBitsOut_) / 8192 / (transportData -> readTime_ / 1000)); } else { sprintf(format, " %.0f messages (%.0f KB) encoded per second.\n\n", countAnyIn, (countBitsIn + transportData -> framingBitsOut_) / 8192); } strcat(buffer, format); strcat(buffer, "link: "); // // ZLIB compression stats. // getStreamStats(type, buffer); // // Save the overall amount of bytes // sent on NX proxy link. // if (transportData -> compressedBytesOut_ > 0) { overallData -> overallBytesOut_ = transportData -> compressedBytesOut_; } else { overallData -> overallBytesOut_ = countBitsOut / 8; } // // Print info on multiplexing overhead. // getFramingStats(type, buffer); // // Print stats about additional channels. // getServicesStats(type, buffer); // // Compression summary. // double ratio = 1; if (transportData -> compressedBytesOut_ / 1024 > 0) { ratio = ((countBitsIn + transportData -> framingBitsOut_) / 8192) / (transportData -> compressedBytesOut_ / 1024); } else if (countBitsOut > 0) { ratio = (countBitsIn + transportData -> framingBitsOut_) / countBitsOut; } sprintf(format, " Protocol compression ratio is %5.3f:1.\n\n", ratio); strcat(buffer, format); getBitrateStats(type, buffer); getSplitStats(type, buffer); sprintf(format, " %.0f total handled replies (%.0f unmatched).\n\n\n", countRepliedRequestIn, protocolData -> requestReplied_[X_NXInternalGenericReply]); strcat(buffer, format); return 1; } int Statistics::getClientOverallStats(int type, char *&buffer) { if (type != PARTIAL_STATS && type != TOTAL_STATS) { #ifdef PANIC *logofs << "Statistics: PANIC! Cannot produce statistics " << "with qualifier '" << type << "'.\n" << logofs_flush; #endif return -1; } struct T_overallData *overallData; struct T_packedData *packedData; if (type == PARTIAL_STATS) { overallData = &overallPartial_; packedData = &packedPartial_; } else { overallData = &overallTotal_; packedData = &packedTotal_; } char format[FORMAT_LENGTH]; // // Print header including link type, // followed by info on packed images. // strcat(buffer, "NX Compression Summary\n"); strcat(buffer, "----------------------\n\n"); char label[FORMAT_LENGTH]; switch (control -> LinkMode) { case LINK_TYPE_NONE: { strcpy(label, "NONE"); break; } case LINK_TYPE_MODEM: { strcpy(label, "MODEM"); break; } case LINK_TYPE_ISDN: { strcpy(label, "ISDN"); break; } case LINK_TYPE_ADSL: { strcpy(label, "ADSL"); break; } case LINK_TYPE_WAN: { strcpy(label, "WAN"); break; } case LINK_TYPE_LAN: { strcpy(label, "LAN"); break; } default: { strcpy(label, "Unknown"); break; } } sprintf(format, "link: %s", label); if (control -> LocalDeltaCompression == 1) { strcat(format, " with protocol compression enabled."); } else { strcat(format, " with protocol compression disabled."); } strcat(format, "\n\n"); strcat(buffer, format); if (packedData -> packedBytesIn_ > 0) { sprintf(format, "images: %.0f bytes (%.0f KB) packed to %.0f (%.0f KB).\n\n", packedData -> packedBytesOut_, packedData -> packedBytesOut_ / 1024, packedData -> packedBytesIn_, packedData -> packedBytesIn_ / 1024); strcat(buffer, format); sprintf(format, " Images compression ratio is %5.3f:1.\n\n", packedData -> packedBytesOut_ / packedData -> packedBytesIn_); strcat(buffer, format); } double overallIn = overallData -> overallBytesIn_ - packedData -> packedBytesIn_ + packedData -> packedBytesOut_; double overallOut = overallData -> overallBytesOut_; sprintf(format, "overall: %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", overallIn, overallIn / 1024, overallOut, overallOut / 1024); strcat(buffer, format); if (overallData -> overallBytesOut_ > 0) { sprintf(format, " Overall NX server compression ratio is %5.3f:1.\n\n\n", overallIn / overallOut); } else { sprintf(format, " Overall NX server compression ratio is 1:1.\n\n\n"); } strcat(buffer, format); return 1; } int Statistics::getServerCacheStats(int type, char *&buffer) { if (type != PARTIAL_STATS && type != TOTAL_STATS) { #ifdef PANIC *logofs << "Statistics: PANIC! Cannot produce statistics " << "with qualifier '" << type << "'.\n" << logofs_flush; #endif return -1; } // // Print message cache data according // to local and remote view. // MessageStore *currentStore = NULL; MessageStore *anyStore = NULL; char format[FORMAT_LENGTH]; strcat(buffer, "\nNX Cache Statistics\n"); strcat(buffer, "-------------------\n\n"); for (int m = proxy_client; m <= proxy_server; m++) { if (m == proxy_client) { strcat(buffer, "Request\tCached\tSize at Server\t\tSize at Client\t\tCache limit\n"); strcat(buffer, "-------\t------\t--------------\t\t--------------\t\t-----------\n"); } else { strcat(buffer, "\nReply\tCached\tSize at Server\t\tSize at Client\t\tCache limit\n"); strcat(buffer, "-----\t------\t--------------\t\t--------------\t\t-----------\n"); } for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) { if (m == proxy_client) { currentStore = proxy_ -> getClientStore() -> getRequestStore(i); } else { currentStore = proxy_ -> getServerStore() -> getReplyStore(i); } if (currentStore != NULL && (currentStore -> getLocalStorageSize() || currentStore -> getRemoteStorageSize())) { anyStore = currentStore; sprintf(format, "#%d\t%d\t", i, currentStore -> getSize()); strcat(buffer, format); sprintf(format, "%d (%.0f KB)\t\t", currentStore -> getRemoteStorageSize(), ((double) currentStore -> getRemoteStorageSize()) / 1024); strcat(buffer, format); sprintf(format, "%d (%.0f KB)\t\t", currentStore -> getLocalStorageSize(), ((double) currentStore -> getLocalStorageSize()) / 1024); strcat(buffer, format); sprintf(format, "%d/%.0f KB\n", currentStore -> cacheSlots, ((double) control -> getUpperStorageSize() / 100 * currentStore -> cacheThreshold) / 1024); strcat(buffer, format); } } if (anyStore == NULL) { strcat(buffer, "N/A\n"); } } if (anyStore != NULL) { sprintf(format, "\ncache: %d bytes (%d KB) available at server.\n", control -> ClientTotalStorageSize, control -> ClientTotalStorageSize / 1024); strcat(buffer, format); sprintf(format, " %d bytes (%d KB) available at client.\n\n", control -> ServerTotalStorageSize, control -> ServerTotalStorageSize / 1024); strcat(buffer, format); sprintf(format, " %d bytes (%d KB) allocated at server.\n", anyStore -> getRemoteTotalStorageSize(), anyStore -> getRemoteTotalStorageSize() / 1024); strcat(buffer, format); sprintf(format, " %d bytes (%d KB) allocated at client.\n\n\n", anyStore -> getLocalTotalStorageSize(), anyStore -> getLocalTotalStorageSize() / 1024); strcat(buffer, format); } else { strcat(buffer, "\ncache: N/A\n\n"); } return 1; } int Statistics::getServerProtocolStats(int type, char *&buffer) { if (type != PARTIAL_STATS && type != TOTAL_STATS) { #ifdef PANIC *logofs << "Statistics: PANIC! Cannot produce statistics " << "with qualifier '" << type << "'.\n" << logofs_flush; #endif return -1; } struct T_transportData *transportData; struct T_protocolData *protocolData; struct T_overallData *overallData; if (type == PARTIAL_STATS) { transportData = &transportPartial_; protocolData = &protocolPartial_; overallData = &overallPartial_; } else { transportData = &transportTotal_; protocolData = &protocolTotal_; overallData = &overallTotal_; } char format[FORMAT_LENGTH]; double countReplyBitsIn = 0; double countReplyBitsOut = 0; double countReplyIn = 0; double countCachedReplyIn = 0; double countEventBitsIn = 0; double countEventBitsOut = 0; double countEventIn = 0; double countCachedEventIn = 0; double countAnyIn = 0; double countBitsIn = 0; double countBitsOut = 0; // // Print reply data. // strcat(buffer, "NX Client Side Protocol Statistics\n"); strcat(buffer, "----------------------------------\n\n"); strcat(buffer, "Reply Total\tCached\tBits In\t\tBits Out\tBits/Reply\t\tRatio\n"); strcat(buffer, "------- -----\t------\t-------\t\t--------\t----------\t\t-----\n"); for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) { if (protocolData -> replyCount_[i]) { sprintf(format, "#%d ", i); while (strlen(format) < 5) { strcat(format, " "); } // // Mark replies originated // by NX agent requests. // if (i >= X_NXFirstOpcode && i <= X_NXLastOpcode) { strcat(format, "A"); } // // Mark replies that we didn't // match against a request. // if (i == 1) { strcat(format, "U"); } while (strlen(format) < 8) { strcat(format, " "); } strcat(buffer, format); if (protocolData -> replyCached_[i] > 0) { sprintf(format, "%.0f\t%.0f", protocolData -> replyCount_[i], protocolData -> replyCached_[i]); } else { sprintf(format, "%.0f\t", protocolData -> replyCount_[i]); } strcat(buffer, format); sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", protocolData -> replyBitsIn_[i], protocolData -> replyBitsIn_[i] / 8192, protocolData -> replyBitsOut_[i], protocolData -> replyBitsOut_[i] / 8192, protocolData -> replyBitsIn_[i] / protocolData -> replyCount_[i], protocolData -> replyBitsOut_[i] / protocolData -> replyCount_[i]); strcat(buffer, format); if (protocolData -> replyBitsOut_[i] > 0) { sprintf(format, "%5.3f:1\n", protocolData -> replyBitsIn_[i] / protocolData -> replyBitsOut_[i]); } else { sprintf(format, "1:1\n"); } strcat(buffer, format); } countReplyIn += protocolData -> replyCount_[i]; countCachedReplyIn += protocolData -> replyCached_[i]; countReplyBitsIn += protocolData -> replyBitsIn_[i]; countReplyBitsOut += protocolData -> replyBitsOut_[i]; countAnyIn += protocolData -> replyCount_[i]; countBitsIn += protocolData -> replyBitsIn_[i]; countBitsOut += protocolData -> replyBitsOut_[i]; } if (countReplyIn > 0) { if (countCachedReplyIn > 0) { sprintf(format, "\ntotal: %.0f\t%.0f", countReplyIn, countCachedReplyIn); } else { sprintf(format, "\ntotal: %.0f\t", countReplyIn); } strcat(buffer, format); sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", countReplyBitsIn, countReplyBitsIn / 8192, countReplyBitsOut, countReplyBitsOut / 8192, countReplyBitsIn / countReplyIn, countReplyBitsOut / countReplyIn); strcat(buffer, format); if (countReplyBitsOut > 0) { sprintf(format, "%5.3f:1\n", countReplyBitsIn / countReplyBitsOut); } else { sprintf(format, "1:1\n"); } strcat(buffer, format); } else { strcat(buffer, "N/A\n"); } strcat(buffer, "\n"); // // Print event and error data. // strcat(buffer, "Event Total\tCached\tBits In\t\tBits Out\tBits/Event\t\tRatio\n"); strcat(buffer, "------- -----\t------\t-------\t\t--------\t----------\t\t-----\n"); for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) { if (protocolData -> eventCount_[i]) { sprintf(format, "#%d ", i); while (strlen(format) < 8) { strcat(format, " "); } strcat(buffer, format); if (protocolData -> eventCached_[i] > 0) { sprintf(format, "%.0f\t%.0f", protocolData -> eventCount_[i], protocolData -> eventCached_[i]); } else { sprintf(format, "%.0f\t", protocolData -> eventCount_[i]); } strcat(buffer, format); sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", protocolData -> eventBitsIn_[i], protocolData -> eventBitsIn_[i] / 8192, protocolData -> eventBitsOut_[i], protocolData -> eventBitsOut_[i] / 8192, protocolData -> eventBitsIn_[i] / protocolData -> eventCount_[i], protocolData -> eventBitsOut_[i] / protocolData -> eventCount_[i]); strcat(buffer, format); if (protocolData -> eventBitsOut_[i] > 0) { sprintf(format, "%5.3f:1\n", protocolData -> eventBitsIn_[i] / protocolData -> eventBitsOut_[i]); } else { sprintf(format, "1:1\n"); } strcat(buffer, format); } countEventIn += protocolData -> eventCount_[i]; countCachedEventIn += protocolData -> eventCached_[i]; countEventBitsIn += protocolData -> eventBitsIn_[i]; countEventBitsOut += protocolData -> eventBitsOut_[i]; countAnyIn += protocolData -> eventCount_[i]; countBitsIn += protocolData -> eventBitsIn_[i]; countBitsOut += protocolData -> eventBitsOut_[i]; } if (countEventIn > 0) { if (countCachedEventIn > 0) { sprintf(format, "\ntotal: %.0f\t%.0f", countEventIn, countCachedEventIn); } else { sprintf(format, "\ntotal: %.0f\t", countEventIn); } strcat(buffer, format); sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", countEventBitsIn, countEventBitsIn / 8192, countEventBitsOut, countEventBitsOut / 8192, countEventBitsIn / countEventIn, countEventBitsOut / countEventIn); strcat(buffer, format); if (countEventBitsOut > 0) { sprintf(format, "%5.3f:1\n", countEventBitsIn / countEventBitsOut); } else { sprintf(format, "1:1\n"); } strcat(buffer, format); } else { strcat(buffer, "N/A\n\n"); } // // Print transport data. // getTimeStats(type, buffer); countAnyIn += protocolData -> cupsCount_; countBitsIn += protocolData -> cupsBitsIn_; countBitsOut += protocolData -> cupsBitsOut_; countAnyIn += protocolData -> smbCount_; countBitsIn += protocolData -> smbBitsIn_; countBitsOut += protocolData -> smbBitsOut_; countAnyIn += protocolData -> mediaCount_; countBitsIn += protocolData -> mediaBitsIn_; countBitsOut += protocolData -> mediaBitsOut_; countAnyIn += protocolData -> httpCount_; countBitsIn += protocolData -> httpBitsIn_; countBitsOut += protocolData -> httpBitsOut_; countAnyIn += protocolData -> fontCount_; countBitsIn += protocolData -> fontBitsIn_; countBitsOut += protocolData -> fontBitsOut_; countAnyIn += protocolData -> slaveCount_; countBitsIn += protocolData -> slaveBitsIn_; countBitsOut += protocolData -> slaveBitsOut_; // // Save the overall amount of bytes // coming from X clients. // overallData -> overallBytesIn_ = countBitsIn / 8; // // Print performance data. // if (transportData -> readTime_ > 0) { sprintf(format, " %.0f messages (%.0f KB) encoded per second.\n\n", countAnyIn / (transportData -> readTime_ / 1000), (countBitsIn + transportData -> framingBitsOut_) / 8192 / (transportData -> readTime_ / 1000)); } else { sprintf(format, " %.0f messages (%.0f KB) encoded per second.\n\n", countAnyIn, (countBitsIn + transportData -> framingBitsOut_) / 8192); } strcat(buffer, format); strcat(buffer, "link: "); // // ZLIB compression stats. // getStreamStats(type, buffer); // // Save the overall amount of bytes // sent on NX proxy link. // if (transportData -> compressedBytesOut_ > 0) { overallData -> overallBytesOut_ = transportData -> compressedBytesOut_; } else { overallData -> overallBytesOut_ = countBitsOut / 8; } // // Print info on multiplexing overhead. // getFramingStats(type, buffer); // // Print stats about additional channels. // getServicesStats(type, buffer); // // Compression summary. // double ratio = 1; if (transportData -> compressedBytesOut_ / 1024 > 0) { ratio = ((countBitsIn + transportData -> framingBitsOut_) / 8192) / (transportData -> compressedBytesOut_ / 1024); } else if (countBitsOut > 0) { ratio = (countBitsIn + transportData -> framingBitsOut_) / countBitsOut; } sprintf(format, " Protocol compression ratio is %5.3f:1.\n\n", ratio); strcat(buffer, format); getBitrateStats(type, buffer); // // These are not included in output. // // getSplitStats(type, buffer); // strcat(buffer, "\n"); // // These statistics are not included in output. // You can check it anyway to get the effective // amount of bytes produced by unpack procedure. // // getClientOverallStats(type, buffer); // return 1; } int Statistics::getServerOverallStats(int type, char *&buffer) { return 1; } int Statistics::getTimeStats(int type, char *&buffer) { struct T_transportData *transportData; if (type == PARTIAL_STATS) { transportData = &transportPartial_; } else { transportData = &transportTotal_; } char format[FORMAT_LENGTH]; sprintf(format, "\ntime: %.0f ms idle, %.0fms (%.0f ms in read, %.0f ms in write) running.\n\n", transportData -> idleTime_, transportData -> readTime_, transportData -> readTime_ - transportData -> writeTime_, transportData -> writeTime_); strcat(buffer, format); return 1; } int Statistics::getStreamStats(int type, char *&buffer) { struct T_transportData *transportData; if (type == PARTIAL_STATS) { transportData = &transportPartial_; } else { transportData = &transportTotal_; } char format[FORMAT_LENGTH]; if (transportData -> compressedBytesOut_ > 0) { sprintf(format, "%.0f bytes (%.0f KB) compressed to %.0f (%.0f KB).\n", transportData -> compressedBytesIn_, transportData -> compressedBytesIn_ / 1024, transportData -> compressedBytesOut_, transportData -> compressedBytesOut_ / 1024); strcat(buffer, format); sprintf(format, " %5.3f:1 stream compression ratio.\n\n", transportData -> compressedBytesIn_ / transportData -> compressedBytesOut_); strcat(buffer, format); } if (transportData -> decompressedBytesOut_ > 0) { if (transportData -> compressedBytesOut_ > 0) { strcat(buffer, " "); } sprintf(format, "%.0f bytes (%.0f KB) decompressed to %.0f (%.0f KB).\n", transportData -> decompressedBytesIn_, transportData -> decompressedBytesIn_ / 1024, transportData -> decompressedBytesOut_, transportData -> decompressedBytesOut_ / 1024); strcat(buffer, format); sprintf(format, " %5.3f:1 stream compression ratio.\n\n", transportData -> decompressedBytesOut_ / transportData -> decompressedBytesIn_); strcat(buffer, format); } if (transportData -> compressedBytesOut_ > 0 || transportData -> decompressedBytesOut_ > 0) { strcat(buffer, " "); } return 1; } int Statistics::getServicesStats(int type, char *&buffer) { struct T_protocolData *protocolData; if (type == PARTIAL_STATS) { protocolData = &protocolPartial_; } else { protocolData = &protocolTotal_; } char format[FORMAT_LENGTH]; if (protocolData -> cupsBitsOut_ > 0) { sprintf(format, " %.0f CUPS messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", protocolData -> cupsCount_ , protocolData -> cupsBitsIn_ / 8, protocolData -> cupsBitsIn_ / 8192, protocolData -> cupsBitsOut_ / 8, protocolData -> cupsBitsOut_ / 8192); strcat(buffer, format); } if (protocolData -> smbBitsOut_ > 0) { sprintf(format, " %.0f SMB messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", protocolData -> smbCount_ , protocolData -> smbBitsIn_ / 8, protocolData -> smbBitsIn_ / 8192, protocolData -> smbBitsOut_ / 8, protocolData -> smbBitsOut_ / 8192); strcat(buffer, format); } if (protocolData -> mediaBitsOut_ > 0) { sprintf(format, " %.0f multimedia messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", protocolData -> mediaCount_ , protocolData -> mediaBitsIn_ / 8, protocolData -> mediaBitsIn_ / 8192, protocolData -> mediaBitsOut_ / 8, protocolData -> mediaBitsOut_ / 8192); strcat(buffer, format); } if (protocolData -> httpBitsOut_ > 0) { sprintf(format, " %.0f HTTP messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", protocolData -> httpCount_ , protocolData -> httpBitsIn_ / 8, protocolData -> httpBitsIn_ / 8192, protocolData -> httpBitsOut_ / 8, protocolData -> httpBitsOut_ / 8192); strcat(buffer, format); } if (protocolData -> fontBitsOut_ > 0) { sprintf(format, " %.0f font server messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", protocolData -> fontCount_ , protocolData -> fontBitsIn_ / 8, protocolData -> fontBitsIn_ / 8192, protocolData -> fontBitsOut_ / 8, protocolData -> fontBitsOut_ / 8192); strcat(buffer, format); } if (protocolData -> slaveBitsOut_ > 0) { sprintf(format, " %.0f slave messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", protocolData -> slaveCount_ , protocolData -> slaveBitsIn_ / 8, protocolData -> slaveBitsIn_ / 8192, protocolData -> slaveBitsOut_ / 8, protocolData -> slaveBitsOut_ / 8192); strcat(buffer, format); } return 1; } int Statistics::getFramingStats(int type, char *&buffer) { struct T_transportData *transportData; if (type == PARTIAL_STATS) { transportData = &transportPartial_; } else { transportData = &transportTotal_; } char format[FORMAT_LENGTH]; // // Print info on multiplexing overhead. // sprintf(format, "%.0f frames in, %.0f frames out, %.0f writes out.\n\n", transportData -> proxyFramesIn_, transportData -> proxyFramesOut_, transportData -> proxyWritesOut_); strcat(buffer, format); sprintf(format, " %.0f bytes (%.0f KB) used for framing and multiplexing.\n\n", transportData -> framingBitsOut_ / 8, transportData -> framingBitsOut_ / 8192); strcat(buffer, format); return 1; } int Statistics::getBitrateStats(int type, char *&buffer) { struct T_transportData *transportData; struct T_overallData *overallData; if (type == PARTIAL_STATS) { transportData = &transportPartial_; overallData = &overallPartial_; } else { transportData = &transportTotal_; overallData = &overallTotal_; } double total = 0; if (transportData -> idleTime_ + transportData -> readTime_ > 0) { total = overallData -> overallBytesOut_ / ((transportData -> idleTime_ + transportData -> readTime_) / 1000); } char format[FORMAT_LENGTH]; sprintf(format, " %.0f B/s average, %d B/s %ds, %d B/s %ds, %d B/s maximum.\n\n", total, getBitrateInShortFrame(), control -> ShortBitrateTimeFrame / 1000, getBitrateInLongFrame(), control -> LongBitrateTimeFrame / 1000, getTopBitrate()); strcat(buffer, format); resetTopBitrate(); return 1; } int Statistics::getSplitStats(int type, char *&buffer) { // // Don't print these statistics if persistent // cache of images is disabled. // if (control -> ImageCacheEnableLoad == 0 && control -> ImageCacheEnableSave == 0) { return 0; } struct T_splitData *splitData; if (type == PARTIAL_STATS) { splitData = &splitPartial_; } else { splitData = &splitTotal_; } char format[FORMAT_LENGTH]; // // Print info on split messages restored from disk. // sprintf(format, " %.0f images streamed, %.0f restored, %.0f bytes (%.0f KB) cached.\n\n", splitData -> splitCount_, splitData -> splitAborted_, splitData -> splitAbortedBytesOut_, splitData -> splitAbortedBytesOut_ / 1024); strcat(buffer, format); return 1; } nx-libs-3.5.99.23/nxcomp/src/Statistics.h0000644000000000000000000004641513614532331014717 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Statistics_H #define Statistics_H #include "NXproto.h" #include "Misc.h" #include "Timestamp.h" class Proxy; // // Opcode 255 is for generic requests, 1 is for // generic replies (those which haven't a speci- // fic differential encoding), opcode 0 is for // generic messages from the auxiliary channels. // #define STATISTICS_OPCODE_MAX 256 // // Maximum length of the buffer allocated for // the statistics output. // #define STATISTICS_LENGTH 16384 // // Query type. // #define TOTAL_STATS 1 #define PARTIAL_STATS 2 #define NO_STATS 3 // // Log level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Log the operations related to updating // the control tokens. // #undef TOKEN class Statistics { public: // // Use the proxy class to get access // to the message stores. // Statistics(Proxy *proxy); ~Statistics(); void addIdleTime(unsigned int numMs) { transportPartial_.idleTime_ += numMs; transportTotal_.idleTime_ += numMs; } void subIdleTime(unsigned int numMs) { transportPartial_.idleTime_ -= numMs; transportTotal_.idleTime_ -= numMs; } void addReadTime(unsigned int numMs) { transportPartial_.readTime_ += numMs; transportTotal_.readTime_ += numMs; } void subReadTime(unsigned int numMs) { transportPartial_.readTime_ -= numMs; transportTotal_.readTime_ -= numMs; } void addWriteTime(unsigned int numMs) { transportPartial_.writeTime_ += numMs; transportTotal_.writeTime_ += numMs; } void subWriteTime(unsigned int numMs) { transportPartial_.writeTime_ -= numMs; transportTotal_.writeTime_ -= numMs; } void addBytesIn(unsigned int numBytes) { transportPartial_.proxyBytesIn_ += numBytes; transportTotal_.proxyBytesIn_ += numBytes; } double getBytesIn() { return transportTotal_.proxyBytesIn_; } void addBytesOut(unsigned int numBytes) { transportPartial_.proxyBytesOut_ += numBytes; transportTotal_.proxyBytesOut_ += numBytes; } double getBytesOut() { return transportTotal_.proxyBytesOut_; } void addFrameIn() { transportPartial_.proxyFramesIn_++; transportTotal_.proxyFramesIn_++; #ifdef TEST *logofs << "Statistics: Updated total proxy frames in to " << transportTotal_.proxyFramesIn_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif } void addFrameOut() { transportPartial_.proxyFramesOut_++; transportTotal_.proxyFramesOut_++; #ifdef TEST *logofs << "Statistics: Updated total proxy frames out to " << transportTotal_.proxyFramesOut_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif } void addWriteOut() { transportPartial_.proxyWritesOut_++; transportTotal_.proxyWritesOut_++; #ifdef TEST *logofs << "Statistics: Updated total proxy writes out to " << transportTotal_.proxyWritesOut_ << " at " << strMsTimestamp() << ".\n" << logofs_flush; #endif } void addCompressedBytes(unsigned int bytesIn, unsigned int bytesOut); void addDecompressedBytes(unsigned int bytesIn, unsigned int bytesOut) { transportPartial_.decompressedBytesIn_ += bytesIn; transportTotal_.decompressedBytesIn_ += bytesIn; transportPartial_.decompressedBytesOut_ += bytesOut; transportTotal_.decompressedBytesOut_ += bytesOut; } void addFramingBits(unsigned int bitsOut) { transportPartial_.framingBitsOut_ += bitsOut; transportTotal_.framingBitsOut_ += bitsOut; proxyData_.protocolCount_ += bitsOut; } void addCachedRequest(unsigned int opcode) { protocolPartial_.requestCached_[opcode]++; protocolTotal_.requestCached_[opcode]++; } void addRenderCachedRequest(unsigned int opcode) { protocolPartial_.renderRequestCached_[opcode]++; protocolTotal_.renderRequestCached_[opcode]++; } void addRepliedRequest(unsigned int opcode) { protocolPartial_.requestReplied_[opcode]++; protocolTotal_.requestReplied_[opcode]++; } void addCachedReply(unsigned int opcode) { protocolPartial_.replyCached_[opcode]++; protocolTotal_.replyCached_[opcode]++; } void addRequestBits(unsigned int opcode, unsigned int bitsIn, unsigned int bitsOut) { #ifdef DEBUG *logofs << "Statistcs: Added " << bitsIn << " bits in and " << bitsOut << " bits out to opcode " << opcode << ".\n" << logofs_flush; #endif protocolPartial_.requestCount_[opcode]++; protocolTotal_.requestCount_[opcode]++; protocolPartial_.requestBitsIn_[opcode] += bitsIn; protocolTotal_.requestBitsIn_[opcode] += bitsIn; protocolPartial_.requestBitsOut_[opcode] += bitsOut; protocolTotal_.requestBitsOut_[opcode] += bitsOut; // // Don't account the split bits // to the control token. // if (opcode != X_NXSplitData && opcode != X_NXSplitEvent) { proxyData_.protocolCount_ += bitsOut; } } void addRenderRequestBits(unsigned int opcode, unsigned int bitsIn, unsigned int bitsOut) { #ifdef DEBUG *logofs << "Statistcs: Added " << bitsIn << " bits in and " << bitsOut << " bits out to render opcode " << opcode << ".\n" << logofs_flush; #endif protocolPartial_.renderRequestCount_[opcode]++; protocolTotal_.renderRequestCount_[opcode]++; protocolPartial_.renderRequestBitsIn_[opcode] += bitsIn; protocolTotal_.renderRequestBitsIn_[opcode] += bitsIn; protocolPartial_.renderRequestBitsOut_[opcode] += bitsOut; protocolTotal_.renderRequestBitsOut_[opcode] += bitsOut; } void addReplyBits(unsigned int opcode, unsigned int bitsIn, unsigned int bitsOut) { protocolPartial_.replyCount_[opcode]++; protocolTotal_.replyCount_[opcode]++; protocolPartial_.replyBitsIn_[opcode] += bitsIn; protocolTotal_.replyBitsIn_[opcode] += bitsIn; protocolPartial_.replyBitsOut_[opcode] += bitsOut; protocolTotal_.replyBitsOut_[opcode] += bitsOut; proxyData_.protocolCount_ += bitsOut; } void addEventBits(unsigned int opcode, unsigned int bitsIn, unsigned int bitsOut) { protocolPartial_.eventCount_[opcode]++; protocolTotal_.eventCount_[opcode]++; protocolPartial_.eventBitsIn_[opcode] += bitsIn; protocolTotal_.eventBitsIn_[opcode] += bitsIn; protocolPartial_.eventBitsOut_[opcode] += bitsOut; protocolTotal_.eventBitsOut_[opcode] += bitsOut; proxyData_.protocolCount_ += bitsOut; } void addCupsBits(unsigned int bitsIn, unsigned int bitsOut) { protocolPartial_.cupsCount_++; protocolTotal_.cupsCount_++; protocolPartial_.cupsBitsIn_ += bitsIn; protocolTotal_.cupsBitsIn_ += bitsIn; protocolPartial_.cupsBitsOut_ += bitsOut; protocolTotal_.cupsBitsOut_ += bitsOut; } void addSmbBits(unsigned int bitsIn, unsigned int bitsOut) { protocolPartial_.smbCount_++; protocolTotal_.smbCount_++; protocolPartial_.smbBitsIn_ += bitsIn; protocolTotal_.smbBitsIn_ += bitsIn; protocolPartial_.smbBitsOut_ += bitsOut; protocolTotal_.smbBitsOut_ += bitsOut; } void addMediaBits(unsigned int bitsIn, unsigned int bitsOut) { protocolPartial_.mediaCount_++; protocolTotal_.mediaCount_++; protocolPartial_.mediaBitsIn_ += bitsIn; protocolTotal_.mediaBitsIn_ += bitsIn; protocolPartial_.mediaBitsOut_ += bitsOut; protocolTotal_.mediaBitsOut_ += bitsOut; } void addHttpBits(unsigned int bitsIn, unsigned int bitsOut) { protocolPartial_.httpCount_++; protocolTotal_.httpCount_++; protocolPartial_.httpBitsIn_ += bitsIn; protocolTotal_.httpBitsIn_ += bitsIn; protocolPartial_.httpBitsOut_ += bitsOut; protocolTotal_.httpBitsOut_ += bitsOut; } void addFontBits(unsigned int bitsIn, unsigned int bitsOut) { protocolPartial_.fontCount_++; protocolTotal_.fontCount_++; protocolPartial_.fontBitsIn_ += bitsIn; protocolTotal_.fontBitsIn_ += bitsIn; protocolPartial_.fontBitsOut_ += bitsOut; protocolTotal_.fontBitsOut_ += bitsOut; } void addSlaveBits(unsigned int bitsIn, unsigned int bitsOut) { protocolPartial_.slaveCount_++; protocolTotal_.slaveCount_++; protocolPartial_.slaveBitsIn_ += bitsIn; protocolTotal_.slaveBitsIn_ += bitsIn; protocolPartial_.slaveBitsOut_ += bitsOut; protocolTotal_.slaveBitsOut_ += bitsOut; } void addPackedBytesIn(unsigned int numBytes) { packedPartial_.packedBytesIn_ += numBytes; packedTotal_.packedBytesIn_ += numBytes; } void addPackedBytesOut(unsigned int numBytes) { packedPartial_.packedBytesOut_ += numBytes; packedTotal_.packedBytesOut_ += numBytes; } void addSplit() { splitPartial_.splitCount_++; splitTotal_.splitCount_++; } void addSplitAborted() { splitPartial_.splitAborted_++; splitTotal_.splitAborted_++; } void addSplitAbortedBytesOut(unsigned int numBytes) { splitPartial_.splitAbortedBytesOut_ += numBytes; splitTotal_.splitAbortedBytesOut_ += numBytes; } // // Add the recorded protocol data to the proxy // token counters. We want to send bpth the token // request message and the data payload using a // single system write, so we must guess how many // output bytes we will generate. // void updateControlToken(int &count) { // // Total is the total number of protocol bytes // generated so far. We have saved the number // of bytes generated the last time the function // was called so we can calculate the difference. // // The number of protocol bits is updated as soon // as new bits are accumulated, to avoid summing // up all the opcodes in this routine. We add a // byte to the control bytes difference to account // for the framing bits that are very likely to // be added to the payload. // double total = proxyData_.protocolCount_ / 8; double diff = total - proxyData_.controlCount_ + 1; #if defined(TEST) || defined(TOKEN) *logofs << "Statistics: TOKEN! Protocol bytes are " << total << " control bytes are " << proxyData_.controlCount_ << " difference is " << diff << ".\n" << logofs_flush; #endif count += (int) (diff / proxyData_.streamRatio_); #if defined(TEST) || defined(TOKEN) *logofs << "Statistics: TOKEN! Adding " << (int) (diff / proxyData_.streamRatio_) << " bytes to the control token with ratio " << proxyData_.streamRatio_ << ".\n" << logofs_flush; #endif proxyData_.controlCount_ = total; #if defined(TEST) || defined(TOKEN) *logofs << "Statistics: TOKEN! New control token has " << count << " bytes with total control bytes " << proxyData_.controlCount_ << ".\n" << logofs_flush; #endif } void updateSplitToken(int &count) { double total = (protocolTotal_.requestBitsOut_[X_NXSplitData] + protocolTotal_.eventBitsOut_[X_NXSplitEvent]) / 8; double diff = total - proxyData_.splitCount_; #if defined(TEST) || defined(TOKEN) *logofs << "Statistics: TOKEN! Protocol bytes are " << total << " split bytes are " << proxyData_.splitCount_ << " difference is " << diff << ".\n" << logofs_flush; #endif count += (int) (diff / proxyData_.streamRatio_); #if defined(TEST) || defined(TOKEN) *logofs << "Statistics: TOKEN! Adding " << (int) (diff / proxyData_.streamRatio_) << " bytes to the split token with ratio " << proxyData_.streamRatio_ << ".\n" << logofs_flush; #endif proxyData_.splitCount_ = total; #if defined(TEST) || defined(TOKEN) *logofs << "Statistics: TOKEN! New split token has " << count << " bytes with total split bytes " << proxyData_.splitCount_ << ".\n" << logofs_flush; #endif } void updateDataToken(int &count) { double total = (protocolTotal_.cupsBitsOut_ + protocolTotal_.smbBitsOut_ + protocolTotal_.mediaBitsOut_ + protocolTotal_.httpBitsOut_ + protocolTotal_.fontBitsOut_ + protocolTotal_.slaveBitsOut_) / 8; double diff = total - proxyData_.dataCount_; #if defined(TEST) || defined(TOKEN) *logofs << "Statistics: TOKEN! Protocol bytes are " << total << " data bytes are " << proxyData_.dataCount_ << " difference is " << diff << ".\n" << logofs_flush; #endif count += (int) (diff / proxyData_.streamRatio_); #if defined(TEST) || defined(TOKEN) *logofs << "Statistics: TOKEN! Adding " << (int) (diff / proxyData_.streamRatio_) << " bytes to the data token with ratio " << proxyData_.streamRatio_ << ".\n" << logofs_flush; #endif proxyData_.dataCount_ = total; #if defined(TEST) || defined(TOKEN) *logofs << "Statistics: TOKEN! New data token has " << count << " bytes with total data bytes " << proxyData_.dataCount_ << ".\n" << logofs_flush; #endif } // // Update the current bitrate. // void updateBitrate(int bytes); // // Return the current bitrate. // int getBitrateInShortFrame() { return bitrateInShortFrame_; } int getBitrateInLongFrame() { return bitrateInLongFrame_; } int getTopBitrate() { return topBitrate_; } void resetTopBitrate() { topBitrate_ = 0; } double getStreamRatio() { return proxyData_.streamRatio_; } // // Manage the congestion level. // void updateCongestion(int remaining, int limit); double getCongestionInFrame() { return congestionInFrame_; } // // Produce a dump of the statistics on // the provided buffer. // int getClientCacheStats(int type, char *&buffer); int getClientProtocolStats(int type, char *&buffer); int getClientOverallStats(int type, char *&buffer); int getServerCacheStats(int type, char *&buffer); int getServerProtocolStats(int type, char *&buffer); int getServerOverallStats(int type, char *&buffer); int resetPartialStats(); private: int getTimeStats(int type, char *&buffer); int getServicesStats(int type, char *&buffer); int getFramingStats(int type, char *&buffer); int getBitrateStats(int type, char *&buffer); int getStreamStats(int type, char *&buffer); int getSplitStats(int type, char *&buffer); struct T_protocolData { double requestCached_[STATISTICS_OPCODE_MAX]; double requestReplied_[STATISTICS_OPCODE_MAX]; double requestCount_[STATISTICS_OPCODE_MAX]; double requestBitsIn_[STATISTICS_OPCODE_MAX]; double requestBitsOut_[STATISTICS_OPCODE_MAX]; double renderRequestCached_[STATISTICS_OPCODE_MAX]; double renderRequestCount_[STATISTICS_OPCODE_MAX]; double renderRequestBitsIn_[STATISTICS_OPCODE_MAX]; double renderRequestBitsOut_[STATISTICS_OPCODE_MAX]; double replyCached_[STATISTICS_OPCODE_MAX]; double replyCount_[STATISTICS_OPCODE_MAX]; double replyBitsIn_[STATISTICS_OPCODE_MAX]; double replyBitsOut_[STATISTICS_OPCODE_MAX]; double eventCached_[STATISTICS_OPCODE_MAX]; double eventCount_[STATISTICS_OPCODE_MAX]; double eventBitsIn_[STATISTICS_OPCODE_MAX]; double eventBitsOut_[STATISTICS_OPCODE_MAX]; double cupsCount_; double cupsBitsIn_; double cupsBitsOut_; double smbCount_; double smbBitsIn_; double smbBitsOut_; double mediaCount_; double mediaBitsIn_; double mediaBitsOut_; double httpCount_; double httpBitsIn_; double httpBitsOut_; double fontCount_; double fontBitsIn_; double fontBitsOut_; double slaveCount_; double slaveBitsIn_; double slaveBitsOut_; }; struct T_transportData { double idleTime_; double readTime_; double writeTime_; double proxyBytesIn_; double proxyBytesOut_; double proxyFramesIn_; double proxyFramesOut_; double proxyWritesOut_; double compressedBytesIn_; double compressedBytesOut_; double decompressedBytesIn_; double decompressedBytesOut_; double framingBitsOut_; }; struct T_packedData { double packedBytesIn_; double packedBytesOut_; }; struct T_splitData { double splitCount_; double splitAborted_; double splitAbortedBytesOut_; }; struct T_overallData { double overallBytesIn_; double overallBytesOut_; }; struct T_proxyData { double protocolCount_; double controlCount_; double splitCount_; double dataCount_; double streamRatio_; }; T_protocolData protocolPartial_; T_protocolData protocolTotal_; T_transportData transportPartial_; T_transportData transportTotal_; T_packedData packedPartial_; T_packedData packedTotal_; T_splitData splitPartial_; T_splitData splitTotal_; T_overallData overallPartial_; T_overallData overallTotal_; T_proxyData proxyData_; // // Used to calculate the bandwidth usage // of the proxy link. // T_timestamp startShortFrameTs_; T_timestamp startLongFrameTs_; T_timestamp startFrameTs_; int bytesInShortFrame_; int bytesInLongFrame_; int bitrateInShortFrame_; int bitrateInLongFrame_; int topBitrate_; double congestionInFrame_; // // Need the proxy pointer to print the // statistics related to the client and // server stores and to add the protocol // data to the proxy token accumulators. // Proxy *proxy_; }; #endif /* Statistics_H */ nx-libs-3.5.99.23/nxcomp/src/Timestamp.cpp0000644000000000000000000000573413614532331015062 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Timestamp.h" // // Log level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Last timestamp taken from the system. // T_timestamp timestamp; std::string strTimestamp(const T_timestamp &ts) { std::string ret; char ctime_now[26] = { }; #if HAVE_CTIME_S errno_t retval = ::ctime_s(ctime_now, sizeof(ctime_now), static_cast(&ts.tv_sec)); if (retval != 0) #else char *retval = ::ctime_r(static_cast(&ts.tv_sec), ctime_now); if (!(retval)) #endif { std::cerr << "WARNING: converting time to string failed." << std::endl; } else { /* Replace newline at position 25 with a NULL byte. */ ctime_now[24] = '\0'; ret = ctime_now; } return ret; } // // This is especially dirty. // std::string strMsTimestamp(const T_timestamp &ts) { std::string ret; std::string ctime_now = strTimestamp(ts); if (!(ctime_now.empty())) { char ctime_new[26] = { }; snprintf(ctime_new, sizeof(ctime_new), "%.8s:%3.3f", ctime_now.c_str() + 11, static_cast(ts.tv_usec) / 1000); ret = ctime_new; } return ret; } nx-libs-3.5.99.23/nxcomp/src/Timestamp.h0000644000000000000000000001544213614532331014524 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Timestamp_H #define Timestamp_H #if HAVE_CTIME_S #define __STDC_WANT_LIB_EXT1__ 1 #include #endif /* HAVE_CTIME_S */ #include #include #include #include #include #include #include "Misc.h" // // Log level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // If not defined, always query the system time. // #undef CACHE_TIMESTAMP // // Log a warning if the time difference since // the last update exceeds the given number // of milliseconds. // #define DRIFT_TIMESTAMP 1 // // Type used for timeout manipulation. // typedef struct timeval T_timestamp; // // Last timestamp taken from the system. If the // timestamp is cached, we need to explicitly // get a new timestamp after any operation that // may have required a relevant amount of time. // extern T_timestamp timestamp; // // Get a timestamp instance with values set // at the given amount of milliseconds. // inline T_timestamp getTimestamp(long ms) { struct timeval ts; ts.tv_sec = ms / 1000; ts.tv_usec = (ms % 1000) * 1000; return ts; } // // Return the difference in milliseconds // between the two timestamps. // inline long diffTimestamp(const T_timestamp &ts1, const T_timestamp &ts2) { // // Add 500 microseconds to round up // to the nearest millisecond. // return ((ts2.tv_sec * 1000 + (ts2.tv_usec + 500) / 1000) - (ts1.tv_sec * 1000 + (ts1.tv_usec + 500) / 1000)); } // // The same in microseconds. It doesn't // round the value. // inline long diffUsTimestamp(const T_timestamp &ts1, const T_timestamp &ts2) { return ((ts2.tv_sec * 1000000 + ts2.tv_usec) - (ts1.tv_sec * 1000000 + ts1.tv_usec)); } // // Return the last timestamp taken from the // system. It doesn't update the timestamp. // inline T_timestamp getTimestamp() { #ifdef CACHE_TIMESTAMP #ifdef TEST T_timestamp ts; gettimeofday(&ts, NULL); long diffTs = diffTimestamp(timestamp, ts); if (diffTs > DRIFT_TIMESTAMP) { *logofs << "Timestamp: WARNING! Time difference since the " << "current timestamp is " << diffTs << "ms.\n" << logofs_flush; } #endif return timestamp; #else gettimeofday(×tamp, NULL); return timestamp; #endif } inline T_timestamp &setTimestamp(T_timestamp &ts, long ms) { ts.tv_sec = ms / 1000; ts.tv_usec = (ms % 1000) * 1000; return ts; } // // Return the smaller between two timestamps. // inline T_timestamp &setMinTimestamp(T_timestamp &ts, long ms) { if ((ts.tv_sec * 1000 + ts.tv_usec / 1000) > ms) { ts.tv_sec = ms / 1000; ts.tv_usec = (ms % 1000) * 1000; } return ts; } inline T_timestamp &setMinTimestamp(T_timestamp &ts1, T_timestamp &ts2) { if ((ts1.tv_sec * 1000000 + ts1.tv_usec) > (ts2.tv_sec * 1000000 + ts2.tv_usec)) { ts1.tv_sec = ts2.tv_sec; ts1.tv_usec = ts2.tv_usec; } return ts1; } // // Convert a timestamp in the total number // of milliseconds. // inline long getMsTimestamp(const T_timestamp &ts) { return ts.tv_sec * 1000 + ts.tv_usec / 1000; } // // A 0 value on both seconds and microseconds // fields means that timestamp is invalid or // not set. // inline T_timestamp nullTimestamp() { struct timeval ts; ts.tv_sec = 0; ts.tv_usec = 0; return ts; } inline bool isTimestamp(const T_timestamp &ts) { if (ts.tv_sec == 0 && ts.tv_usec == 0) { return 0; } return 1; } inline void subMsTimestamp(T_timestamp &ts, long ms) { ts.tv_sec -= ms / 1000; ts.tv_usec -= (ms % 1000) * 1000; } inline void addMsTimestamp(T_timestamp &ts, long ms) { ts.tv_sec += ms / 1000; ts.tv_usec += (ms % 1000) * 1000; } // // Check the difference between timestamps. // Return 0 if the system time went backward // compared to the second timestamp, or the // difference between the timestamps exceeds // the given number of milliseconds. // inline int checkDiffTimestamp(const T_timestamp &ts1, const T_timestamp &ts2, long ms = 30000) { long diffTs = diffTimestamp(ts1, ts2); if (diffTs < 0 || diffTs > ms) { return 0; } return 1; } // // Return a string representing the timestamp. // std::string strTimestamp(const T_timestamp &ts); std::string strMsTimestamp(const T_timestamp &ts); inline std::string strTimestamp() { return strTimestamp(getTimestamp()); } inline std::string strMsTimestamp() { return strMsTimestamp(getTimestamp()); } // // Update the current timestamp. // inline T_timestamp getNewTimestamp() { #ifdef TEST T_timestamp ts; gettimeofday(&ts, NULL); *logofs << "Timestamp: Updating the current timestamp at " << strMsTimestamp(ts) << ".\n" << logofs_flush; long diffTs = diffTimestamp(timestamp, ts); if (diffTs > DRIFT_TIMESTAMP) { *logofs << "Timestamp: WARNING! Time difference since the " << "old timestamp is " << diffTs << "ms.\n" << logofs_flush; } #endif gettimeofday(×tamp, NULL); return timestamp; } #endif /* Timestamp_H */ nx-libs-3.5.99.23/nxcomp/src/TranslateCoords.cpp0000644000000000000000000001046313614532331016221 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "TranslateCoords.h" #include "ClientCache.h" #include "EncodeBuffer.h" #include "DecodeBuffer.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Here are the methods to handle messages' content. // int TranslateCoordsStore::parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { TranslateCoordsMessage *translateCoords = (TranslateCoordsMessage *) message; // // Here is the fingerprint. // translateCoords -> src_window = GetULONG(buffer + 4, bigEndian); translateCoords -> dst_window = GetULONG(buffer + 8, bigEndian); translateCoords -> src_x = GetUINT(buffer + 12, bigEndian); translateCoords -> src_y = GetUINT(buffer + 14, bigEndian); #ifdef DEBUG *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } int TranslateCoordsStore::unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const { TranslateCoordsMessage *translateCoords = (TranslateCoordsMessage *) message; // // Fill all the message's fields. // PutULONG(translateCoords -> src_window, buffer + 4, bigEndian); PutULONG(translateCoords -> dst_window, buffer + 8, bigEndian); PutUINT(translateCoords -> src_x, buffer + 12, bigEndian); PutUINT(translateCoords -> src_y, buffer + 14, bigEndian); #ifdef DEBUG *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; #endif return 1; } void TranslateCoordsStore::dumpIdentity(const Message *message) const { #ifdef DUMP TranslateCoordsMessage *translateCoords = (TranslateCoordsMessage *) message; *logofs << name() << ": Identity src_window " << translateCoords -> src_window << ", dst_window " << translateCoords -> dst_window << ", src_x " << translateCoords -> src_x << ", src_y " << translateCoords -> src_y << ", size " << translateCoords -> size_ << ".\n" << logofs_flush; #endif } void TranslateCoordsStore::identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const { md5_append(md5_state_, buffer + 4, 4); md5_append(md5_state_, buffer + 8, 4); md5_append(md5_state_, buffer + 12, 2); md5_append(md5_state_, buffer + 14, 2); } nx-libs-3.5.99.23/nxcomp/src/TranslateCoords.h0000644000000000000000000001225713614532331015671 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef TranslateCoords_H #define TranslateCoords_H #include "Message.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP // // Set default values. // #define TRANSLATECOORDS_ENABLE_CACHE 1 #define TRANSLATECOORDS_ENABLE_DATA 0 #define TRANSLATECOORDS_ENABLE_SPLIT 0 #define TRANSLATECOORDS_ENABLE_COMPRESS 0 #define TRANSLATECOORDS_DATA_LIMIT 0 #define TRANSLATECOORDS_DATA_OFFSET 16 #define TRANSLATECOORDS_CACHE_SLOTS 3000 #define TRANSLATECOORDS_CACHE_THRESHOLD 3 #define TRANSLATECOORDS_CACHE_LOWER_THRESHOLD 1 // // The message class. // class TranslateCoordsMessage : public Message { friend class TranslateCoordsStore; public: TranslateCoordsMessage() { } ~TranslateCoordsMessage() { } // // Put here the fields which constitute // the 'identity' part of the message. // private: unsigned int src_window; unsigned int dst_window; unsigned int src_x; unsigned int src_y; // unsigned char r_same_screen; // unsigned int r_child_window; // unsigned int r_dst_x; // unsigned int r_dst_y; }; class TranslateCoordsStore : public MessageStore { // // Constructors and destructors. // public: TranslateCoordsStore() : MessageStore() { enableCache = TRANSLATECOORDS_ENABLE_CACHE; enableData = TRANSLATECOORDS_ENABLE_DATA; enableSplit = TRANSLATECOORDS_ENABLE_SPLIT; enableCompress = TRANSLATECOORDS_ENABLE_COMPRESS; dataLimit = TRANSLATECOORDS_DATA_LIMIT; dataOffset = TRANSLATECOORDS_DATA_OFFSET; cacheSlots = TRANSLATECOORDS_CACHE_SLOTS; cacheThreshold = TRANSLATECOORDS_CACHE_THRESHOLD; cacheLowerThreshold = TRANSLATECOORDS_CACHE_LOWER_THRESHOLD; messages_ -> resize(cacheSlots); for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { *i = NULL; } temporary_ = NULL; } virtual ~TranslateCoordsStore() { for (T_messages::iterator i = messages_ -> begin(); i < messages_ -> end(); i++) { destroy(*i); } destroy(temporary_); } virtual const char *name() const { return "TranslateCoords"; } virtual unsigned char opcode() const { return X_TranslateCoords; } virtual unsigned int storage() const { return sizeof(TranslateCoordsMessage); } // // Message handling methods. // public: virtual Message *create() const { return new TranslateCoordsMessage(); } virtual Message *create(const Message &message) const { return new TranslateCoordsMessage((const TranslateCoordsMessage &) message); } virtual void destroy(Message *message) const { delete (TranslateCoordsMessage *) message; } virtual int parseIdentity(Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual int unparseIdentity(const Message *message, unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void identityChecksum(const Message *message, const unsigned char *buffer, unsigned int size, int bigEndian) const; virtual void dumpIdentity(const Message *message) const; }; #endif /* TranslateCoords_H */ nx-libs-3.5.99.23/nxcomp/src/Transport.cpp0000644000000000000000000020567113614532331015115 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "Transport.h" #include "Statistics.h" // // Set the verbosity level. You also // need to define DUMP in Misc.cpp // if DUMP is defined here. // #define PANIC #define WARNING #undef TEST #undef DEBUG #undef INSPECT #undef DUMP // // Used to lock and unlock the transport // buffers before they are accessed by // different threads. // #undef THREADS // // Define this to get logging all the // operations performed by the parent // thread, the one that enqueues and // dequeues data. // #define PARENT // // Define this to know when a channel // is created or destroyed. // #undef REFERENCES // // Reference count for allocated buffers. // #ifdef REFERENCES int Transport::references_; int ProxyTransport::references_; int InternalTransport::references_; #endif // // This is the base class providing methods for read // and write buffering. // Transport::Transport(int fd) : fd_(fd) { #ifdef TEST *logofs << "Transport: Going to create base transport " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif type_ = transport_base; // // Set up the write buffer. // w_buffer_.length_ = 0; w_buffer_.start_ = 0; initialSize_ = TRANSPORT_BUFFER_DEFAULT_SIZE; thresholdSize_ = TRANSPORT_BUFFER_DEFAULT_SIZE << 1; maximumSize_ = TRANSPORT_BUFFER_DEFAULT_SIZE << 4; w_buffer_.data_.resize(initialSize_); // // Set non-blocking IO on socket. // SetNonBlocking(fd_, 1); blocked_ = 0; finish_ = 0; #ifdef REFERENCES *logofs << "Transport: Created new object at " << this << " out of " << ++references_ << " allocated references.\n" << logofs_flush; #endif } Transport::~Transport() { #ifdef TEST *logofs << "Transport: Going to destroy base class " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif ::close(fd_); #ifdef REFERENCES *logofs << "Transport: Deleted object at " << this << " out of " << --references_ << " allocated references.\n" << logofs_flush; #endif } // // Read data from its file descriptor. // int Transport::read(unsigned char *data, unsigned int size) { #ifdef DEBUG *logofs << "Transport: Going to read " << size << " bytes from " << "FD#" << fd_ << ".\n" << logofs_flush; #endif // // Read the available data from the socket. // int result = ::read(fd_, data, size); // // Update the current timestamp as the read // can have scheduled some other process. // getNewTimestamp(); if (result < 0) { if (EGET() == EAGAIN) { #ifdef TEST *logofs << "Transport: WARNING! Read of " << size << " bytes from " << "FD#" << fd_ << " would block.\n" << logofs_flush; #endif return 0; } else if (EGET() == EINTR) { #ifdef TEST *logofs << "Transport: Read of " << size << " bytes from " << "FD#" << fd_ << " was interrupted.\n" << logofs_flush; #endif return 0; } else { #ifdef TEST *logofs << "Transport: Error reading from " << "FD#" << fd_ << ".\n" << logofs_flush; #endif finish(); return -1; } } else if (result == 0) { #ifdef TEST *logofs << "Transport: No data read from " << "FD#" << fd_ << ".\n" << logofs_flush; #endif finish(); return -1; } #ifdef TEST *logofs << "Transport: Read " << result << " bytes out of " << size << " from FD#" << fd_ << ".\n" << logofs_flush; #endif #ifdef DUMP *logofs << "Transport: Dumping content of read data.\n" << logofs_flush; DumpData(data, result); #endif return result; } // // Write as many bytes as possible to socket. // Append the remaining data bytes to the end // of the buffer and update length to reflect // changes. // int Transport::write(T_write type, const unsigned char *data, const unsigned int size) { // // If an immediate write was requested then // flush the enqueued data first. // // Alternatively may try to write only if // the socket is not blocked. // // if (w_buffer_.length_ > 0 && blocked_ == 0 && // type == write_immediate) // { // ... // } // if (w_buffer_.length_ > 0 && type == write_immediate) { #ifdef TEST *logofs << "Transport: Writing " << w_buffer_.length_ << " bytes of previous data to FD#" << fd_ << ".\n" << logofs_flush; #endif int result = Transport::flush(); if (result < 0) { return -1; } } // // If nothing is remained, write immediately // to the socket. // unsigned int written = 0; if (w_buffer_.length_ == 0 && blocked_ == 0 && type == write_immediate) { // // Limit the amount of data sent. // unsigned int toWrite = size; #ifdef DUMP *logofs << "Transport: Going to write " << toWrite << " bytes to FD#" << fd_ << " with checksum "; DumpChecksum(data, size); *logofs << ".\n" << logofs_flush; #endif T_timestamp writeTs; int diffTs; while (written < toWrite) { // // Trace system time spent writing data. // writeTs = getTimestamp(); int result = ::write(fd_, data + written, toWrite - written); diffTs = diffTimestamp(writeTs, getNewTimestamp()); statistics -> addWriteTime(diffTs); if (result <= 0) { if (EGET() == EAGAIN) { #ifdef TEST *logofs << "Transport: Write of " << toWrite - written << " bytes on FD#" << fd_ << " would block.\n" << logofs_flush; #endif blocked_ = 1; break; } else if (EGET() == EINTR) { #ifdef TEST *logofs << "Transport: Write of " << toWrite - written << " bytes on FD#" << fd_ << " was interrupted.\n" << logofs_flush; #endif continue; } else { #ifdef TEST *logofs << "Transport: Write to " << "FD#" << fd_ << " failed.\n" << logofs_flush; #endif finish(); return -1; } } else { #ifdef TEST *logofs << "Transport: Immediately written " << result << " bytes on " << "FD#" << fd_ << ".\n" << logofs_flush; #endif written += result; } } #ifdef DUMP if (written > 0) { *logofs << "Transport: Dumping content of immediately written data.\n" << logofs_flush; DumpData(data, written); } #endif } if (written == size) { // // We will not affect the write buffer. // return written; } #ifdef DEBUG *logofs << "Transport: Going to append " << size - written << " bytes to write buffer for " << "FD#" << fd_ << ".\n" << logofs_flush; #endif if (resize(w_buffer_, size - written) < 0) { return -1; } memmove(w_buffer_.data_.begin() + w_buffer_.start_ + w_buffer_.length_, data + written, size - written); w_buffer_.length_ += size - written; #ifdef TEST *logofs << "Transport: Write buffer for FD#" << fd_ << " has data for " << w_buffer_.length_ << " bytes.\n" << logofs_flush; *logofs << "Transport: Start is " << w_buffer_.start_ << " length is " << w_buffer_.length_ << " size is " << w_buffer_.data_.size() << " capacity is " << w_buffer_.data_.capacity() << ".\n" << logofs_flush; #endif // // Note that this function always returns the whole // size of buffer that was provided, either if not // all the data could be actually written. // return size; } // // Write pending data to its file descriptor. // int Transport::flush() { if (w_buffer_.length_ == 0) { #ifdef TEST *logofs << "Transport: No data to flush on " << "FD#" << fd_ << ".\n" << logofs_flush; #endif #ifdef WARNING if (blocked_ != 0) { *logofs << "Transport: Blocked flag is " << blocked_ << " with no data to flush on FD#" << fd_ << ".\n" << logofs_flush; } #endif return 0; } // // It's time to move data from the // write buffer to the real link. // int written = 0; int toWrite = w_buffer_.length_; // // We will do our best to write any available // data to the socket, so let's say we start // from a clean state. // blocked_ = 0; #ifdef TEST *logofs << "Transport: Going to flush " << toWrite << " bytes on FD#" << fd_ << ".\n" << logofs_flush; #endif T_timestamp writeTs; int diffTs; while (written < toWrite) { writeTs = getTimestamp(); int result = ::write(fd_, w_buffer_.data_.begin() + w_buffer_.start_ + written, toWrite - written); diffTs = diffTimestamp(writeTs, getNewTimestamp()); statistics -> addWriteTime(diffTs); if (result <= 0) { if (EGET() == EAGAIN) { #ifdef TEST *logofs << "Transport: Write of " << toWrite - written << " bytes on FD#" << fd_ << " would block.\n" << logofs_flush; #endif blocked_ = 1; break; } else if (EGET() == EINTR) { #ifdef TEST *logofs << "Transport: Write of " << toWrite - written << " bytes on FD#" << fd_ << " was interrupted.\n" << logofs_flush; #endif continue; } else { #ifdef TEST *logofs << "Transport: Write to " << "FD#" << fd_ << " failed.\n" << logofs_flush; #endif finish(); return -1; } } else { #ifdef TEST *logofs << "Transport: Flushed " << result << " bytes on " << "FD#" << fd_ << ".\n" << logofs_flush; #endif written += result; } } if (written > 0) { #ifdef DUMP *logofs << "Transport: Dumping content of flushed data.\n" << logofs_flush; DumpData(w_buffer_.data_.begin() + w_buffer_.start_, written); #endif // // Update the buffer status. // w_buffer_.length_ -= written; if (w_buffer_.length_ == 0) { w_buffer_.start_ = 0; } else { w_buffer_.start_ += written; } } // // It can be that we wrote less bytes than // available because of the write limit. // if (w_buffer_.length_ > 0) { #ifdef TEST *logofs << "Transport: There are still " << w_buffer_.length_ << " bytes in write buffer for " << "FD#" << fd_ << ".\n" << logofs_flush; #endif blocked_ = 1; } #ifdef TEST *logofs << "Transport: Write buffer for FD#" << fd_ << " has data for " << w_buffer_.length_ << " bytes.\n" << logofs_flush; *logofs << "Transport: Start is " << w_buffer_.start_ << " length is " << w_buffer_.length_ << " size is " << w_buffer_.data_.size() << " capacity is " << w_buffer_.data_.capacity() << ".\n" << logofs_flush; #endif // // No new data was produced for the link except // any outstanding data from previous writes. // return 0; } int Transport::drain(int limit, int timeout) { if (w_buffer_.length_ <= limit) { return 1; } // // Write the data accumulated in the write // buffer until it is below the limit or // the timeout is elapsed. // int toWrite = w_buffer_.length_; int written = 0; #ifdef TEST *logofs << "Transport: Draining " << toWrite - limit << " bytes on FD#" << fd_ << " with limit set to " << limit << ".\n" << logofs_flush; #endif T_timestamp startTs = getNewTimestamp(); T_timestamp selectTs; T_timestamp writeTs; T_timestamp idleTs; T_timestamp nowTs = startTs; int diffTs; fd_set writeSet; fd_set readSet; FD_ZERO(&writeSet); FD_ZERO(&readSet); int result; int ready; while (w_buffer_.length_ - written > limit) { nowTs = getNewTimestamp(); // // Wait for descriptor to become // readable or writable. // FD_SET(fd_, &writeSet); FD_SET(fd_, &readSet); setTimestamp(selectTs, timeout / 2); idleTs = nowTs; result = select(fd_ + 1, &readSet, &writeSet, NULL, &selectTs); nowTs = getNewTimestamp(); diffTs = diffTimestamp(idleTs, nowTs); statistics -> addIdleTime(diffTs); statistics -> subReadTime(diffTs); if (result < 0) { if (EGET() == EINTR) { #ifdef TEST *logofs << "Transport: Select on FD#" << fd_ << " was interrupted.\n" << logofs_flush; #endif continue; } else { #ifdef TEST *logofs << "Transport: Select on FD#" << fd_ << " failed.\n" << logofs_flush; #endif finish(); return -1; } } else if (result > 0) { ready = result; if (FD_ISSET(fd_, &writeSet)) { writeTs = getNewTimestamp(); result = ::write(fd_, w_buffer_.data_.begin() + w_buffer_.start_ + written, toWrite - written); nowTs = getNewTimestamp(); diffTs = diffTimestamp(writeTs, nowTs); statistics -> addWriteTime(diffTs); if (result > 0) { #ifdef TEST *logofs << "Transport: Forced flush of " << result << " bytes on " << "FD#" << fd_ << ".\n" << logofs_flush; #endif written += result; } else if (result < 0 && EGET() == EINTR) { #ifdef TEST *logofs << "Transport: Write to FD#" << fd_ << " was interrupted.\n" << logofs_flush; #endif continue; } else { #ifdef TEST *logofs << "Transport: Write to FD#" << fd_ << " failed.\n" << logofs_flush; #endif finish(); return -1; } ready--; } if (ready > 0) { if (FD_ISSET(fd_, &readSet)) { #ifdef TEST *logofs << "Transport: Not draining further " << "due to data readable on FD#" << fd_ << ".\n" << logofs_flush; #endif break; } } } #ifdef TEST else { *logofs << "Transport: Timeout encountered " << "waiting for FD#" << fd_ << ".\n" << logofs_flush; } #endif nowTs = getNewTimestamp(); diffTs = diffTimestamp(startTs, nowTs); if (diffTs >= timeout) { #ifdef TEST *logofs << "Transport: Not draining further " << "due to the timeout on FD#" << fd_ << ".\n" << logofs_flush; #endif break; } } if (written > 0) { #ifdef DUMP *logofs << "Transport: Dumping content of flushed data.\n" << logofs_flush; DumpData(w_buffer_.data_.begin() + w_buffer_.start_, written); #endif // // Update the buffer status. // w_buffer_.length_ -= written; if (w_buffer_.length_ == 0) { w_buffer_.start_ = 0; blocked_ = 0; } else { w_buffer_.start_ += written; #ifdef TEST *logofs << "Transport: There are still " << w_buffer_.length_ << " bytes in write buffer for " << "FD#" << fd_ << ".\n" << logofs_flush; #endif blocked_ = 1; } } #ifdef TEST else { *logofs << "Transport: WARNING! No data written to FD#" << fd_ << " with " << toWrite << " bytes to drain and limit " << "set to " << limit << ".\n" << logofs_flush; } #endif #ifdef TEST *logofs << "Transport: Write buffer for FD#" << fd_ << " has data for " << w_buffer_.length_ << " bytes.\n" << logofs_flush; *logofs << "Transport: Start is " << w_buffer_.start_ << " length is " << w_buffer_.length_ << " size is " << w_buffer_.data_.size() << " capacity is " << w_buffer_.data_.capacity() << ".\n" << logofs_flush; #endif return (w_buffer_.length_ <= limit); } int Transport::wait(int timeout) const { T_timestamp startTs = getNewTimestamp(); T_timestamp idleTs; T_timestamp selectTs; T_timestamp nowTs = startTs; long available = 0; int result = 0; int diffTs; fd_set readSet; FD_ZERO(&readSet); FD_SET(fd_, &readSet); for (;;) { available = readable(); diffTs = diffTimestamp(startTs, nowTs); if (available != 0 || timeout == 0 || (diffTs + (timeout / 10)) >= timeout) { #ifdef TEST *logofs << "Transport: There are " << available << " bytes on FD#" << fd_ << " after " << diffTs << " ms.\n" << logofs_flush; #endif return available; } else if (available == 0 && result > 0) { #ifdef TEST *logofs << "Transport: Read on " << "FD#" << fd_ << " failed.\n" << logofs_flush; #endif return -1; } // // TODO: Should subtract the time // already spent in select. // selectTs.tv_sec = 0; selectTs.tv_usec = timeout * 1000; idleTs = nowTs; // // Wait for descriptor to become readable. // result = select(fd_ + 1, &readSet, NULL, NULL, &selectTs); nowTs = getNewTimestamp(); diffTs = diffTimestamp(idleTs, nowTs); statistics -> addIdleTime(diffTs); statistics -> subReadTime(diffTs); if (result < 0) { if (EGET() == EINTR) { #ifdef TEST *logofs << "Transport: Select on FD#" << fd_ << " was interrupted.\n" << logofs_flush; #endif continue; } else { #ifdef TEST *logofs << "Transport: Select on " << "FD#" << fd_ << " failed.\n" << logofs_flush; #endif return -1; } } #ifdef TEST else if (result == 0) { *logofs << "Transport: No data available on FD#" << fd_ << " after " << diffTimestamp(startTs, nowTs) << " ms.\n" << logofs_flush; } else { *logofs << "Transport: Data became available on FD#" << fd_ << " after " << diffTimestamp(startTs, nowTs) << " ms.\n" << logofs_flush; } #endif } } void Transport::setSize(unsigned int initialSize, unsigned int thresholdSize, unsigned int maximumSize) { initialSize_ = initialSize; thresholdSize_ = thresholdSize; maximumSize_ = maximumSize; #ifdef TEST *logofs << "Transport: Set buffer sizes for FD#" << fd_ << " to " << initialSize_ << "/" << thresholdSize_ << "/" << maximumSize_ << ".\n" << logofs_flush; #endif } void Transport::fullReset() { blocked_ = 0; finish_ = 0; fullReset(w_buffer_); } int Transport::resize(T_buffer &buffer, const int &size) { if ((int) buffer.data_.size() >= (buffer.length_ + size) && (buffer.start_ + buffer.length_ + size) > (int) buffer.data_.size()) { if (buffer.length_ > 0) { // // There is enough space in buffer but we need // to move existing data at the beginning. // #ifdef TEST *logofs << "Transport: Moving " << buffer.length_ << " bytes of data for " << "FD#" << fd_ << " to make room in the buffer.\n" << logofs_flush; #endif memmove(buffer.data_.begin(), buffer.data_.begin() + buffer.start_, buffer.length_); } buffer.start_ = 0; #ifdef DEBUG *logofs << "Transport: Made room for " << buffer.data_.size() - buffer.start_ << " bytes in buffer for " << "FD#" << fd_ << ".\n" << logofs_flush; #endif } else if ((buffer.length_ + size) > (int) buffer.data_.size()) { // // Not enough space, so increase // the size of the buffer. // if (buffer.start_ != 0 && buffer.length_ > 0) { #ifdef TEST *logofs << "Transport: Moving " << buffer.length_ << " bytes of data for " << "FD#" << fd_ << " to resize the buffer.\n" << logofs_flush; #endif memmove(buffer.data_.begin(), buffer.data_.begin() + buffer.start_, buffer.length_); } buffer.start_ = 0; unsigned int newSize = thresholdSize_; while (newSize < (unsigned int) buffer.length_ + size) { newSize <<= 1; if (newSize >= maximumSize_) { newSize = buffer.length_ + size + initialSize_; } } #ifdef DEBUG *logofs << "Transport: Buffer for " << "FD#" << fd_ << " will be enlarged from " << buffer.data_.size() << " to at least " << buffer.length_ + size << " bytes.\n" << logofs_flush; #endif buffer.data_.resize(newSize); #ifdef TEST if (newSize >= maximumSize_) { *logofs << "Transport: WARNING! Buffer for FD#" << fd_ << " grown to reach size of " << newSize << " bytes.\n" << logofs_flush; } #endif #ifdef TEST *logofs << "Transport: Data buffer for " << "FD#" << fd_ << " has now size " << buffer.data_.size() << " and capacity " << buffer.data_.capacity() << ".\n" << logofs_flush; #endif } return (buffer.length_ + size); } void Transport::fullReset(T_buffer &buffer) { // // Force deallocation and allocation // of the initial size. // #ifdef TEST *logofs << "Transport: Resetting buffer for " << "FD#" << fd_ << " with size " << buffer.data_.size() << " and capacity " << buffer.data_.capacity() << ".\n" << logofs_flush; #endif buffer.start_ = 0; buffer.length_ = 0; if (buffer.data_.size() > (unsigned int) initialSize_ && buffer.data_.capacity() > (unsigned int) initialSize_) { buffer.data_.clear(); buffer.data_.resize(initialSize_); #ifdef TEST *logofs << "Transport: Data buffer for " << "FD#" << fd_ << " shrunk to size " << buffer.data_.size() << " and capacity " << buffer.data_.capacity() << ".\n" << logofs_flush; #endif } } ProxyTransport::ProxyTransport(int fd) : Transport(fd) { #ifdef TEST *logofs << "ProxyTransport: Going to create proxy transport " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif type_ = transport_proxy; // // Set up the read buffer. // r_buffer_.length_ = 0; r_buffer_.start_ = 0; r_buffer_.data_.resize(initialSize_); // // For now we own the buffer. // owner_ = 1; // // Set up ZLIB compression. // int result; r_stream_.zalloc = NULL; r_stream_.zfree = NULL; r_stream_.opaque = NULL; r_stream_.next_in = NULL; r_stream_.avail_in = 0; if ((result = inflateInit2(&r_stream_, 15)) != Z_OK) { #ifdef PANIC *logofs << "ProxyTransport: PANIC! Failed initialization of ZLIB read stream. " << "Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed initialization of ZLIB read stream. " << "Error is '" << zError(result) << "'.\n"; HandleCleanup(); } if (control -> LocalStreamCompression) { w_stream_.zalloc = NULL; w_stream_.zfree = NULL; w_stream_.opaque = NULL; if ((result = deflateInit2(&w_stream_, control -> LocalStreamCompressionLevel, Z_DEFLATED, 15, 9, Z_DEFAULT_STRATEGY)) != Z_OK) { #ifdef PANIC *logofs << "ProxyTransport: PANIC! Failed initialization of ZLIB write stream. " << "Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Failed initialization of ZLIB write stream. " << "Error is '" << zError(result) << "'.\n"; HandleCleanup(); } } // // No ZLIB stream to flush yet. // flush_ = 0; #ifdef REFERENCES *logofs << "ProxyTransport: Created new object at " << this << " out of " << ++references_ << " allocated references.\n" << logofs_flush; #endif } ProxyTransport::~ProxyTransport() { #ifdef TEST *logofs << "ProxyTransport: Going to destroy derived class " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif // // Deallocate the ZLIB stream state. // inflateEnd(&r_stream_); if (control -> LocalStreamCompression) { deflateEnd(&w_stream_); } #ifdef REFERENCES *logofs << "ProxyTransport: Deleted object at " << this << " out of " << --references_ << " allocated references.\n" << logofs_flush; #endif } // // Read data from its file descriptor. // int ProxyTransport::read(unsigned char *data, unsigned int size) { // // If the remote peer is not compressing // the stream then just return any byte // read from the socket. // if (control -> RemoteStreamCompression == 0) { int result = Transport::read(data, size); if (result <= 0) { return result; } statistics -> addBytesIn(result); return result; } // // Return any pending data first. // if (r_buffer_.length_ > 0) { // // If the size of the buffer doesn't // match the amount of data pending, // force the caller to retry. // if ((int) size < r_buffer_.length_) { #ifdef TEST *logofs << "ProxyTransport: WARNING! Forcing a retry with " << r_buffer_.length_ << " bytes pending and " << size << " in the buffer.\n" << logofs_flush; #endif ESET(EAGAIN); return -1; } int copied = (r_buffer_.length_ > ((int) size) ? ((int) size) : r_buffer_.length_); memcpy(data, r_buffer_.data_.begin() + r_buffer_.start_, copied); // // Update the buffer status. // #ifdef DEBUG *logofs << "ProxyTransport: Going to immediately return " << copied << " bytes from proxy FD#" << fd_ << ".\n" << logofs_flush; #endif r_buffer_.length_ -= copied; if (r_buffer_.length_ == 0) { r_buffer_.start_ = 0; } else { r_buffer_.start_ += copied; #ifdef TEST *logofs << "ProxyTransport: There are still " << r_buffer_.length_ << " bytes in read buffer for proxy " << "FD#" << fd_ << ".\n" << logofs_flush; #endif } return copied; } // // Read data in the user buffer. // int result = Transport::read(data, size); if (result <= 0) { return result; } statistics -> addBytesIn(result); // // Decompress the data into the read // buffer. // #ifdef DEBUG *logofs << "ProxyTransport: Going to decompress data for " << "proxy FD#" << fd_ << ".\n" << logofs_flush; #endif int saveTotalIn = r_stream_.total_in; int saveTotalOut = r_stream_.total_out; int oldTotalIn = saveTotalIn; int oldTotalOut = saveTotalOut; int diffTotalIn; int diffTotalOut; #ifdef INSPECT *logofs << "ProxyTransport: oldTotalIn = " << oldTotalIn << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: oldTotalOut = " << oldTotalOut << ".\n" << logofs_flush; #endif r_stream_.next_in = (Bytef *) data; r_stream_.avail_in = result; // // Let ZLIB use all the space already // available in the buffer. // unsigned int newAvailOut = r_buffer_.data_.size() - r_buffer_.start_ - r_buffer_.length_; #ifdef TEST *logofs << "ProxyTransport: Initial decompress buffer is " << newAvailOut << " bytes.\n" << logofs_flush; #endif for (;;) { #ifdef INSPECT *logofs << "\nProxyTransport: Running the decompress loop.\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: r_buffer_.length_ = " << r_buffer_.length_ << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: r_buffer_.data_.size() = " << r_buffer_.data_.size() << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: newAvailOut = " << newAvailOut << ".\n" << logofs_flush; #endif if (resize(r_buffer_, newAvailOut) < 0) { return -1; } #ifdef INSPECT *logofs << "ProxyTransport: r_buffer_.data_.size() = " << r_buffer_.data_.size() << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: r_stream_.next_in = " << (void *) r_stream_.next_in << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: r_stream_.avail_in = " << r_stream_.avail_in << ".\n" << logofs_flush; #endif r_stream_.next_out = r_buffer_.data_.begin() + r_buffer_.start_ + r_buffer_.length_; r_stream_.avail_out = newAvailOut; #ifdef INSPECT *logofs << "ProxyTransport: r_stream_.next_out = " << (void *) r_stream_.next_out << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: r_stream_.avail_out = " << r_stream_.avail_out << ".\n" << logofs_flush; #endif result = inflate(&r_stream_, Z_SYNC_FLUSH); #ifdef INSPECT *logofs << "ProxyTransport: Called inflate() result is " << result << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: r_stream_.avail_in = " << r_stream_.avail_in << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: r_stream_.avail_out = " << r_stream_.avail_out << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: r_stream_.total_in = " << r_stream_.total_in << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: r_stream_.total_out = " << r_stream_.total_out << ".\n" << logofs_flush; #endif diffTotalIn = r_stream_.total_in - oldTotalIn; diffTotalOut = r_stream_.total_out - oldTotalOut; #ifdef INSPECT *logofs << "ProxyTransport: diffTotalIn = " << diffTotalIn << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: diffTotalOut = " << diffTotalOut << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: r_buffer_.length_ = " << r_buffer_.length_ << ".\n" << logofs_flush; #endif r_buffer_.length_ += diffTotalOut; #ifdef INSPECT *logofs << "ProxyTransport: r_buffer_.length_ = " << r_buffer_.length_ << ".\n" << logofs_flush; #endif oldTotalIn = r_stream_.total_in; oldTotalOut = r_stream_.total_out; if (result == Z_OK) { if (r_stream_.avail_in == 0 && r_stream_.avail_out > 0) { break; } } else if (result == Z_BUF_ERROR && r_stream_.avail_out > 0 && r_stream_.avail_in == 0) { #ifdef TEST *logofs << "ProxyTransport: WARNING! Raised Z_BUF_ERROR decompressing data.\n" << logofs_flush; #endif break; } else { #ifdef PANIC *logofs << "ProxyTransport: PANIC! Decompression of data failed. " << "Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Decompression of data failed. Error is '" << zError(result) << "'.\n"; finish(); return -1; } // // Add more bytes to the buffer. // if (newAvailOut < thresholdSize_) { newAvailOut = thresholdSize_; } #ifdef TEST *logofs << "ProxyTransport: Need to add " << newAvailOut << " bytes to the decompress buffer in read.\n" << logofs_flush; #endif } diffTotalIn = r_stream_.total_in - saveTotalIn; diffTotalOut = r_stream_.total_out - saveTotalOut; #ifdef DEBUG *logofs << "ProxyTransport: Decompressed data from " << diffTotalIn << " to " << diffTotalOut << " bytes.\n" << logofs_flush; #endif statistics -> addDecompressedBytes(diffTotalIn, diffTotalOut); // // Check if the size of the buffer // matches the produced data. // if ((int) size < r_buffer_.length_) { #ifdef TEST *logofs << "ProxyTransport: WARNING! Forcing a retry with " << r_buffer_.length_ << " bytes pending and " << size << " in the buffer.\n" << logofs_flush; #endif ESET(EAGAIN); return -1; } // // Copy the decompressed data to the // provided buffer. // int copied = (r_buffer_.length_ > ((int) size) ? ((int) size) : r_buffer_.length_); #ifdef DEBUG *logofs << "ProxyTransport: Going to return " << copied << " bytes from proxy FD#" << fd_ << ".\n" << logofs_flush; #endif memcpy(data, r_buffer_.data_.begin() + r_buffer_.start_, copied); // // Update the buffer status. // r_buffer_.length_ -= copied; if (r_buffer_.length_ == 0) { r_buffer_.start_ = 0; } else { r_buffer_.start_ += copied; #ifdef TEST *logofs << "ProxyTransport: There are still " << r_buffer_.length_ << " bytes in read buffer for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif } return copied; } // // If required compress data, else write it to socket. // int ProxyTransport::write(T_write type, const unsigned char *data, const unsigned int size) { #ifdef TEST if (size == 0) { *logofs << "ProxyTransport: WARNING! Write called for FD#" << fd_ << " without any data to write.\n" << logofs_flush; return 0; } #endif // // If there is no compression revert to // plain socket management. // if (control -> LocalStreamCompression == 0) { int result = Transport::write(type, data, size); if (result <= 0) { return result; } statistics -> addBytesOut(result); statistics -> updateBitrate(result); FlushCallback(result); return result; } #ifdef DEBUG *logofs << "ProxyTransport: Going to compress " << size << " bytes to write buffer for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif // // Compress data into the write buffer. // int saveTotalIn = w_stream_.total_in; int saveTotalOut = w_stream_.total_out; int oldTotalIn = saveTotalIn; int oldTotalOut = saveTotalOut; int diffTotalIn; int diffTotalOut; #ifdef INSPECT *logofs << "ProxyTransport: oldTotalIn = " << oldTotalIn << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: oldTotalOut = " << oldTotalOut << ".\n" << logofs_flush; #endif w_stream_.next_in = (Bytef *) data; w_stream_.avail_in = size; // // Let ZLIB use all the space already // available in the buffer. // unsigned int newAvailOut = w_buffer_.data_.size() - w_buffer_.start_ - w_buffer_.length_; #ifdef TEST *logofs << "ProxyTransport: Initial compress buffer is " << newAvailOut << " bytes.\n" << logofs_flush; #endif for (;;) { #ifdef INSPECT *logofs << "\nProxyTransport: Running the compress loop.\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_buffer_.length_ = " << w_buffer_.length_ << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_buffer_.data_.size() = " << w_buffer_.data_.size() << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: newAvailOut = " << newAvailOut << ".\n" << logofs_flush; #endif if (resize(w_buffer_, newAvailOut) < 0) { return -1; } #ifdef INSPECT *logofs << "ProxyTransport: w_buffer_.data_.size() = " << w_buffer_.data_.size() << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.next_in = " << (void *) w_stream_.next_in << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.avail_in = " << w_stream_.avail_in << ".\n" << logofs_flush; #endif w_stream_.next_out = w_buffer_.data_.begin() + w_buffer_.start_ + w_buffer_.length_; w_stream_.avail_out = newAvailOut; #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.next_out = " << (void *) w_stream_.next_out << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.avail_out = " << w_stream_.avail_out << ".\n" << logofs_flush; #endif int result = deflate(&w_stream_, (type == write_delayed ? Z_NO_FLUSH : Z_SYNC_FLUSH)); #ifdef INSPECT *logofs << "ProxyTransport: Called deflate() result is " << result << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.avail_in = " << w_stream_.avail_in << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.avail_out = " << w_stream_.avail_out << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.total_in = " << w_stream_.total_in << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.total_out = " << w_stream_.total_out << ".\n" << logofs_flush; #endif diffTotalOut = w_stream_.total_out - oldTotalOut; diffTotalIn = w_stream_.total_in - oldTotalIn; #ifdef INSPECT *logofs << "ProxyTransport: diffTotalIn = " << diffTotalIn << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: diffTotalOut = " << diffTotalOut << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_buffer_.length_ = " << w_buffer_.length_ << ".\n" << logofs_flush; #endif w_buffer_.length_ += diffTotalOut; #ifdef INSPECT *logofs << "ProxyTransport: w_buffer_.length_ = " << w_buffer_.length_ << ".\n" << logofs_flush; #endif oldTotalOut = w_stream_.total_out; oldTotalIn = w_stream_.total_in; if (result == Z_OK) { if (w_stream_.avail_in == 0 && w_stream_.avail_out > 0) { break; } } else if (result == Z_BUF_ERROR && w_stream_.avail_out > 0 && w_stream_.avail_in == 0) { #ifdef TEST *logofs << "ProxyTransport: WARNING! Raised Z_BUF_ERROR compressing data.\n" << logofs_flush; #endif break; } else { #ifdef PANIC *logofs << "ProxyTransport: PANIC! Compression of data failed. " << "Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Compression of data failed. Error is '" << zError(result) << "'.\n"; finish(); return -1; } // // Add more bytes to the buffer. // if (newAvailOut < thresholdSize_) { newAvailOut = thresholdSize_; } #ifdef TEST *logofs << "ProxyTransport: Need to add " << newAvailOut << " bytes to the compress buffer in write.\n" << logofs_flush; #endif } diffTotalIn = w_stream_.total_in - saveTotalIn; diffTotalOut = w_stream_.total_out - saveTotalOut; #ifdef TEST *logofs << "ProxyTransport: Compressed data from " << diffTotalIn << " to " << diffTotalOut << " bytes.\n" << logofs_flush; if (diffTotalIn != (int) size) { #ifdef PANIC *logofs << "ProxyTransport: PANIC! Bytes provided to ZLIB stream " << "should be " << size << " but they look to be " << diffTotalIn << ".\n" << logofs_flush; #endif } #endif // // Find out what we have to do with the // produced data. // if (type == write_immediate) { // // If user requested an immediate write we // flushed the ZLIB buffer. We can now reset // the counter and write data to socket. // flush_ = 0; #ifdef TEST *logofs << "ProxyTransport: Write buffer for proxy FD#" << fd_ << " has data for " << w_buffer_.length_ << " bytes.\n" << logofs_flush; *logofs << "ProxyTransport: Start is " << w_buffer_.start_ << " length is " << w_buffer_.length_ << " flush is " << flush_ << " size is " << w_buffer_.data_.size() << " capacity is " << w_buffer_.data_.capacity() << ".\n" << logofs_flush; #endif // // Alternatively may try to write only if // the socket is not blocked. // // if (w_buffer_.length_ > 0 && blocked_ == 0) // { // ... // } // if (w_buffer_.length_ > 0) { #ifdef TEST *logofs << "ProxyTransport: Writing " << w_buffer_.length_ << " bytes of produced data to FD#" << fd_ << ".\n" << logofs_flush; #endif int result = Transport::flush(); if (result < 0) { return -1; } } } else { // // We haven't flushed the ZLIB compression // buffer, so user will have to call proxy // transport's flush explicitly. // flush_ += diffTotalIn; } // // We either wrote the data or added it to the // write buffer. It's convenient to update the // counters at this stage to get the current // bitrate earlier. // statistics -> addCompressedBytes(diffTotalIn, diffTotalOut); statistics -> addBytesOut(diffTotalOut); statistics -> updateBitrate(diffTotalOut); FlushCallback(diffTotalOut); #ifdef TEST *logofs << "ProxyTransport: Write buffer for proxy FD#" << fd_ << " has data for " << w_buffer_.length_ << " bytes.\n" << logofs_flush; *logofs << "ProxyTransport: Start is " << w_buffer_.start_ << " length is " << w_buffer_.length_ << " flush is " << flush_ << " size is " << w_buffer_.data_.size() << " capacity is " << w_buffer_.data_.capacity() << ".\n" << logofs_flush; #endif return size; } // // Write data to its file descriptor. // int ProxyTransport::flush() { // // If there is no compression or we already compressed // outgoing data and just need to write it to socket // because of previous incomplete writes then revert // to plain socket management. // if (flush_ == 0 || control -> LocalStreamCompression == 0) { int result = Transport::flush(); if (result < 0) { return -1; } return result; } #ifdef DEBUG *logofs << "ProxyTransport: Going to flush compression on " << "proxy FD#" << fd_ << ".\n" << logofs_flush; #endif #ifdef TEST *logofs << "ProxyTransport: Flush counter for proxy FD#" << fd_ << " is " << flush_ << " bytes.\n" << logofs_flush; #endif // // Flush ZLIB stream into the write buffer. // int saveTotalIn = w_stream_.total_in; int saveTotalOut = w_stream_.total_out; int oldTotalIn = saveTotalIn; int oldTotalOut = saveTotalOut; int diffTotalOut; int diffTotalIn; #ifdef INSPECT *logofs << "ProxyTransport: oldTotalIn = " << oldTotalIn << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: oldTotalOut = " << oldTotalOut << ".\n" << logofs_flush; #endif w_stream_.next_in = w_buffer_.data_.begin() + w_buffer_.start_ + w_buffer_.length_; w_stream_.avail_in = 0; // // Let ZLIB use all the space already // available in the buffer. // unsigned int newAvailOut = w_buffer_.data_.size() - w_buffer_.start_ - w_buffer_.length_; #ifdef DEBUG *logofs << "ProxyTransport: Initial flush buffer is " << newAvailOut << " bytes.\n" << logofs_flush; #endif for (;;) { #ifdef INSPECT *logofs << "\nProxyTransport: Running the flush loop.\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_buffer_.length_ = " << w_buffer_.length_ << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_buffer_.data_.size() = " << w_buffer_.data_.size() << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: newAvailOut = " << newAvailOut << ".\n" << logofs_flush; #endif if (resize(w_buffer_, newAvailOut) < 0) { return -1; } #ifdef INSPECT *logofs << "ProxyTransport: w_buffer_.data_.size() = " << w_buffer_.data_.size() << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.next_in = " << (void *) w_stream_.next_in << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.avail_in = " << w_stream_.avail_in << ".\n" << logofs_flush; #endif w_stream_.next_out = w_buffer_.data_.begin() + w_buffer_.start_ + w_buffer_.length_; w_stream_.avail_out = newAvailOut; #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.next_out = " << (void *) w_stream_.next_out << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.avail_out = " << w_stream_.avail_out << ".\n" << logofs_flush; #endif int result = deflate(&w_stream_, Z_SYNC_FLUSH); #ifdef INSPECT *logofs << "ProxyTransport: Called deflate() result is " << result << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.avail_in = " << w_stream_.avail_in << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.avail_out = " << w_stream_.avail_out << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.total_in = " << w_stream_.total_in << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_stream_.total_out = " << w_stream_.total_out << ".\n" << logofs_flush; #endif diffTotalOut = w_stream_.total_out - oldTotalOut; diffTotalIn = w_stream_.total_in - oldTotalIn; #ifdef INSPECT *logofs << "ProxyTransport: diffTotalIn = " << diffTotalIn << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: diffTotalOut = " << diffTotalOut << ".\n" << logofs_flush; #endif #ifdef INSPECT *logofs << "ProxyTransport: w_buffer_.length_ = " << w_buffer_.length_ << ".\n" << logofs_flush; #endif w_buffer_.length_ += diffTotalOut; #ifdef INSPECT *logofs << "ProxyTransport: w_buffer_.length_ = " << w_buffer_.length_ << ".\n" << logofs_flush; #endif oldTotalOut = w_stream_.total_out; oldTotalIn = w_stream_.total_in; if (result == Z_OK) { if (w_stream_.avail_in == 0 && w_stream_.avail_out > 0) { break; } } else if (result == Z_BUF_ERROR && w_stream_.avail_out > 0 && w_stream_.avail_in == 0) { #ifdef TEST *logofs << "ProxyTransport: WARNING! Raised Z_BUF_ERROR flushing data.\n" << logofs_flush; #endif break; } else { #ifdef PANIC *logofs << "ProxyTransport: PANIC! Flush of compressed data failed. " << "Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Flush of compressed data failed. Error is '" << zError(result) << "'.\n"; finish(); return -1; } // // Add more bytes to the buffer. // if (newAvailOut < thresholdSize_) { newAvailOut = thresholdSize_; } #ifdef TEST *logofs << "ProxyTransport: Need to add " << newAvailOut << " bytes to the compress buffer in flush.\n" << logofs_flush; #endif } diffTotalIn = w_stream_.total_in - saveTotalIn; diffTotalOut = w_stream_.total_out - saveTotalOut; #ifdef TEST *logofs << "ProxyTransport: Compressed flush data from " << diffTotalIn << " to " << diffTotalOut << " bytes.\n" << logofs_flush; #endif // // Time to move data from the write // buffer to the real link. // #ifdef DEBUG *logofs << "ProxyTransport: Reset flush counter for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif flush_ = 0; #ifdef TEST *logofs << "ProxyTransport: Write buffer for proxy FD#" << fd_ << " has data for " << w_buffer_.length_ << " bytes.\n" << logofs_flush; *logofs << "ProxyTransport: Start is " << w_buffer_.start_ << " length is " << w_buffer_.length_ << " flush is " << flush_ << " size is " << w_buffer_.data_.size() << " capacity is " << w_buffer_.data_.capacity() << ".\n" << logofs_flush; #endif int result = Transport::flush(); if (result < 0) { return -1; } // // Update all the counters. // statistics -> addCompressedBytes(diffTotalIn, diffTotalOut); statistics -> addBytesOut(diffTotalOut); statistics -> updateBitrate(diffTotalOut); FlushCallback(diffTotalOut); return result; } unsigned int ProxyTransport::getPending(unsigned char *&data) { // // Return a pointer to the data in the // read buffer. It is up to the caller // to ensure that the data is consumed // before the read buffer is reused. // if (r_buffer_.length_ > 0) { unsigned int size = r_buffer_.length_; data = r_buffer_.data_.begin() + r_buffer_.start_; #ifdef DEBUG *logofs << "ProxyTransport: Returning " << size << " pending bytes from proxy FD#" << fd_ << ".\n" << logofs_flush; #endif r_buffer_.length_ = 0; r_buffer_.start_ = 0; // // Prevent the deletion of the buffer. // owner_ = 0; return size; } #ifdef TEST *logofs << "ProxyTransport: WARNING! No pending data " << "for proxy FD#" << fd_ << ".\n" << logofs_flush; #endif data = NULL; return 0; } void ProxyTransport::fullReset() { blocked_ = 0; finish_ = 0; flush_ = 0; if (control -> RemoteStreamCompression) { inflateReset(&r_stream_); } if (control -> LocalStreamCompression) { deflateReset(&w_stream_); } if (owner_ == 1) { Transport::fullReset(r_buffer_); } Transport::fullReset(w_buffer_); } AgentTransport::AgentTransport(int fd) : Transport(fd) { #ifdef TEST *logofs << "AgentTransport: Going to create agent transport " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif type_ = transport_agent; // // Set up the read buffer. // r_buffer_.length_ = 0; r_buffer_.start_ = 0; r_buffer_.data_.resize(initialSize_); // // For now we own the buffer. // owner_ = 1; // // Set up the mutexes. // #ifdef THREADS pthread_mutexattr_t m_attributes; pthread_mutexattr_init(&m_attributes); // // Interfaces in pthread to handle mutex // type do not work in current version. // m_attributes.__mutexkind = PTHREAD_MUTEX_ERRORCHECK_NP; if (pthread_mutex_init(&m_read_, &m_attributes) != 0) { #ifdef TEST *logofs << "AgentTransport: Child: Creation of read mutex failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif } if (pthread_mutex_init(&m_write_, &m_attributes) != 0) { #ifdef TEST *logofs << "AgentTransport: Child: Creation of write mutex failed. " << "Error is " << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; #endif } #endif #ifdef REFERENCES *logofs << "AgentTransport: Child: Created new object at " << this << " out of " << ++references_ << " allocated references.\n" << logofs_flush; #endif } AgentTransport::~AgentTransport() { #ifdef TEST *logofs << "AgentTransport: Going to destroy derived class " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif // // Unlock and free all mutexes. // #ifdef THREADS pthread_mutex_unlock(&m_read_); pthread_mutex_unlock(&m_write_); pthread_mutex_destroy(&m_read_); pthread_mutex_destroy(&m_write_); #endif #ifdef REFERENCES *logofs << "AgentTransport: Child: Deleted object at " << this << " out of " << --references_ << " allocated references.\n" << logofs_flush; #endif } // // Read data enqueued by the other thread. // int AgentTransport::read(unsigned char *data, unsigned int size) { #ifdef THREADS lockRead(); #endif #ifdef DEBUG *logofs << "AgentTransport: Child: Going to read " << size << " bytes from " << "FD#" << fd_ << ".\n" << logofs_flush; #endif int copied = -1; if (r_buffer_.length_ > 0) { if ((int) size < r_buffer_.length_) { #ifdef TEST *logofs << "AgentTransport: WARNING! Forcing a retry with " << r_buffer_.length_ << " bytes pending and " << size << " in the buffer.\n" << logofs_flush; #endif ESET(EAGAIN); } else { copied = (r_buffer_.length_ > ((int) size) ? ((int) size) : r_buffer_.length_); memcpy(data, r_buffer_.data_.begin() + r_buffer_.start_, copied); // // Update the buffer status. // #ifdef TEST *logofs << "AgentTransport: Child: Going to immediately return " << copied << " bytes from FD#" << fd_ << ".\n" << logofs_flush; #endif #ifdef DUMP *logofs << "AgentTransport: Child: Dumping content of read data.\n" << logofs_flush; DumpData(data, copied); #endif r_buffer_.length_ -= copied; if (r_buffer_.length_ == 0) { r_buffer_.start_ = 0; } else { r_buffer_.start_ += copied; #ifdef TEST *logofs << "AgentTransport: Child: There are still " << r_buffer_.length_ << " bytes in read buffer for " << "FD#" << fd_ << ".\n" << logofs_flush; #endif } } } else { #ifdef DEBUG *logofs << "AgentTransport: Child: No data can be got " << "from read buffer for FD#" << fd_ << ".\n" << logofs_flush; #endif ESET(EAGAIN); } #ifdef THREADS unlockRead(); #endif return copied; } // // Write data to buffer so that the other // thread can get it. // int AgentTransport::write(T_write type, const unsigned char *data, const unsigned int size) { #ifdef THREADS lockWrite(); #endif // // Just append data to socket's write buffer. // Note that we don't care if buffer exceeds // the size limits set for this type of // transport. // #ifdef TEST *logofs << "AgentTransport: Child: Going to append " << size << " bytes to write buffer for " << "FD#" << fd_ << ".\n" << logofs_flush; #endif int copied = -1; if (resize(w_buffer_, size) < 0) { finish(); ESET(EPIPE); } else { memmove(w_buffer_.data_.begin() + w_buffer_.start_ + w_buffer_.length_, data, size); w_buffer_.length_ += size; #ifdef DUMP *logofs << "AgentTransport: Child: Dumping content of written data.\n" << logofs_flush; DumpData(data, size); #endif #ifdef TEST *logofs << "AgentTransport: Child: Write buffer for FD#" << fd_ << " has data for " << w_buffer_.length_ << " bytes.\n" << logofs_flush; *logofs << "AgentTransport: Child: Start is " << w_buffer_.start_ << " length is " << w_buffer_.length_ << " size is " << w_buffer_.data_.size() << " capacity is " << w_buffer_.data_.capacity() << ".\n" << logofs_flush; #endif copied = size; } // // Let child access again the read buffer. // #ifdef THREADS unlockWrite(); #endif return copied; } int AgentTransport::flush() { // // In case of memory-to-memory transport // this function should never be called. // #ifdef PANIC *logofs << "AgentTransport: Child: PANIC! Called flush() for " << "memory to memory transport on " << "FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": Called flush() for " << "memory to memory transport on " << "FD#" << fd_ << ".\n"; HandleAbort(); } int AgentTransport::drain(int limit, int timeout) { // // We can't drain the channel in the case // of the memory-to-memory transport. Data // is enqueued for the agent to read but // the agent could require multiple loops // to read it all. // // // In case of memory-to-memory transport // this function should never be called. // #ifdef PANIC *logofs << "AgentTransport: Child: PANIC! Called drain() for " << "memory to memory transport on " << "FD#" << fd_ << ".\n" << logofs_flush; #endif cerr << "Error" << ": Called drain() for " << "memory to memory transport on " << "FD#" << fd_ << ".\n"; HandleAbort(); } unsigned int AgentTransport::getPending(unsigned char *&data) { #ifdef THREADS lockRead(); #endif if (r_buffer_.length_ > 0) { unsigned int size = r_buffer_.length_; data = r_buffer_.data_.begin() + r_buffer_.start_; #ifdef DEBUG *logofs << "AgentTransport: Child: Returning " << size << " pending bytes from FD#" << fd_ << ".\n" << logofs_flush; #endif r_buffer_.length_ = 0; r_buffer_.start_ = 0; #ifdef THREADS unlockRead(); #endif // // Prevent the deletion of the buffer. // owner_ = 0; return size; } #ifdef TEST *logofs << "AgentTransport: WARNING! No pending data " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif #ifdef THREADS unlockRead(); #endif data = NULL; return 0; } void AgentTransport::fullReset() { #ifdef THREADS lockRead(); lockWrite(); #endif #ifdef TEST *logofs << "AgentTransport: Child: Resetting transport " << "for FD#" << fd_ << ".\n" << logofs_flush; #endif blocked_ = 0; finish_ = 0; if (owner_ == 1) { Transport::fullReset(r_buffer_); } Transport::fullReset(w_buffer_); } int AgentTransport::enqueue(const char *data, const int size) { #ifdef THREADS lockRead(); #endif if (finish_ == 1) { #if defined(PARENT) && defined(TEST) *logofs << "AgentTransport: Parent: Returning EPIPE in " << "write for finishing FD#" << fd_ << ".\n" << logofs_flush; #endif ESET(EPIPE); return -1; } // // Always allow the agent to write // all its data. // int toPut = size; #if defined(PARENT) && defined(TEST) *logofs << "AgentTransport: Parent: Going to put " << toPut << " bytes into read buffer for FD#" << fd_ << ". Buffer length is " << r_buffer_.length_ << ".\n" << logofs_flush; #endif if (resize(r_buffer_, toPut) < 0) { finish(); #ifdef THREADS unlockRead(); #endif return -1; } memcpy(r_buffer_.data_.begin() + r_buffer_.start_ + r_buffer_.length_, data, toPut); r_buffer_.length_ += toPut; #if defined(DUMP) && defined(PARENT) *logofs << "AgentTransport: Parent: Dumping content of enqueued data.\n" << logofs_flush; DumpData((const unsigned char *) data, toPut); #endif #if defined(PARENT) && defined(TEST) *logofs << "AgentTransport: Parent: Read buffer for FD#" << fd_ << " has now data for " << r_buffer_.length_ << " bytes.\n" << logofs_flush; *logofs << "AgentTransport: Parent: Start is " << r_buffer_.start_ << " length is " << r_buffer_.length_ << " size is " << r_buffer_.data_.size() << " capacity is " << r_buffer_.data_.capacity() << ".\n" << logofs_flush; #endif #ifdef THREADS unlockRead(); #endif return toPut; } int AgentTransport::dequeue(char *data, int size) { #ifdef THREADS lockWrite(); #endif if (w_buffer_.length_ == 0) { if (finish_ == 1) { #if defined(PARENT) && defined(TEST) *logofs << "AgentTransport: Parent: Returning 0 in read " << "for finishing FD#" << fd_ << ".\n" << logofs_flush; #endif return 0; } #if defined(PARENT) && defined(TEST) *logofs << "AgentTransport: Parent: No data can be read " << "from write buffer for FD#" << fd_ << ".\n" << logofs_flush; #endif ESET(EAGAIN); #ifdef THREADS unlockWrite(); #endif return -1; } // // Return as many bytes as possible. // int toGet = ((int) size > w_buffer_.length_ ? w_buffer_.length_ : size); #if defined(PARENT) && defined(TEST) *logofs << "AgentTransport: Parent: Going to get " << toGet << " bytes from write buffer for FD#" << fd_ << ".\n" << logofs_flush; #endif memcpy(data, w_buffer_.data_.begin() + w_buffer_.start_, toGet); w_buffer_.start_ += toGet; w_buffer_.length_ -= toGet; #if defined(DUMP) && defined(PARENT) *logofs << "AgentTransport: Parent: Dumping content of dequeued data.\n" << logofs_flush; DumpData((const unsigned char *) data, toGet); #endif #if defined(PARENT) && defined(TEST) *logofs << "AgentTransport: Parent: Write buffer for FD#" << fd_ << " has now data for " << length() << " bytes.\n" << logofs_flush; *logofs << "AgentTransport: Parent: Start is " << w_buffer_.start_ << " length is " << w_buffer_.length_ << " size is " << w_buffer_.data_.size() << " capacity is " << w_buffer_.data_.capacity() << ".\n" << logofs_flush; #endif #ifdef THREADS unlockWrite(); #endif return toGet; } int AgentTransport::dequeuable() { if (finish_ == 1) { #if defined(PARENT) && defined(TEST) *logofs << "AgentTransport: Parent: Returning EPIPE in " << "readable for finishing FD#" << fd_ << ".\n" << logofs_flush; #endif ESET(EPIPE); return -1; } #if defined(PARENT) && defined(TEST) *logofs << "AgentTransport: Parent: Returning " << w_buffer_.length_ << " as data readable " << "from read buffer for FD#" << fd_ << ".\n" << logofs_flush; #endif return w_buffer_.length_; } #ifdef THREADS int AgentTransport::lockRead() { for (;;) { int result = pthread_mutex_lock(&m_read_); if (result == 0) { #ifdef DEBUG *logofs << "AgentTransport: Read mutex locked by thread id " << pthread_self() << ".\n" << logofs_flush; #endif return 0; } else if (EGET() == EINTR) { continue; } else { #ifdef WARNING *logofs << "AgentTransport: WARNING! Locking of read mutex by thread id " << pthread_self() << " returned " << result << ". Error is '" << ESTR() << "'.\n" << logofs_flush; #endif return result; } } } int AgentTransport::lockWrite() { for (;;) { int result = pthread_mutex_lock(&m_write_); if (result == 0) { #ifdef DEBUG *logofs << "AgentTransport: Write mutex locked by thread id " << pthread_self() << ".\n" << logofs_flush; #endif return 0; } else if (EGET() == EINTR) { continue; } else { #ifdef WARNING *logofs << "AgentTransport: WARNING! Locking of write mutex by thread id " << pthread_self() << " returned " << result << ". Error is '" << ESTR() << "'.\n" << logofs_flush; #endif return result; } } } int AgentTransport::unlockRead() { for (;;) { int result = pthread_mutex_unlock(&m_read_); if (result == 0) { #ifdef DEBUG *logofs << "AgentTransport: Read mutex unlocked by thread id " << pthread_self() << ".\n" << logofs_flush; #endif return 0; } else if (EGET() == EINTR) { continue; } else { #ifdef WARNING *logofs << "AgentTransport: WARNING! Unlocking of read mutex by thread id " << pthread_self() << " returned " << result << ". Error is '" << ESTR() << "'.\n" << logofs_flush; #endif return result; } } } int AgentTransport::unlockWrite() { for (;;) { int result = pthread_mutex_unlock(&m_write_); if (result == 0) { #ifdef DEBUG *logofs << "AgentTransport: Write mutex unlocked by thread id " << pthread_self() << ".\n" << logofs_flush; #endif return 0; } else if (EGET() == EINTR) { continue; } else { #ifdef WARNING *logofs << "AgentTransport: WARNING! Unlocking of write mutex by thread id " << pthread_self() << " returned " << result << ". Error is '" << ESTR() << "'.\n" << logofs_flush; #endif return result; } } } #endif nx-libs-3.5.99.23/nxcomp/src/Transport.h0000644000000000000000000002506113614532331014553 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Transport_H #define Transport_H #include #include #include #include #include #include "Misc.h" #include "Control.h" #include "Types.h" #include "Timestamp.h" #include "Socket.h" // // Set the verbosity level. // #define PANIC #define WARNING #undef TEST #undef DEBUG // // Define this to lock and unlock the // memory-to-memory transport buffers // before they are accessed. The code // is outdated and doesn't work with // the current pthread library. // #undef THREADS // // Define this to know when a socket // is created or destroyed. // #undef REFERENCES // // Size of buffer if not set by user. // #define TRANSPORT_BUFFER_DEFAULT_SIZE 16384 // // Type of transport. // typedef enum { transport_base, transport_proxy, transport_agent, transport_last_tag } T_transport_type; // // This class handles the buffered I/O on // the network sockets. // // // TODO: This class is useful but adds a lot of // overhead. There are many improvements we can // make here: // // - There should be a generic Buffer class, ac- // comodating a list of memory buffers. This // would enable the use of the readv() and // writev() functions to perform the I/O on // the socket. // // - The buffering should be moved to the Write- // Buffer and ReadBuffer classes. By performing // the buffering here and there, we are dupli- // cating a lot of code and are adding a lot // of useless memory copies. // // - Stream compression should be removed. The // proxy should compress the frames based on // the type and should include the length of // the decompressed data in the header of the // packet. Besides avoiding the compression // of packets that cannot be reduced in size, // we would also save the additional memory // allocations due to the fact that we don't // know the size of the decode buffer at the // time we read the packet from the network. // // - The other utilities implemented here, like // the functions forcing a write on the socket // or waiting for more data to become available // should be moved to the Proxy or the Channel // classes. // class Transport { public: // // Member functions. // Transport(int fd); virtual ~Transport(); int fd() const { return fd_; } T_transport_type getType() { return type_; } // // Virtual members redefined by proxy // and 'memory-to-memory' I/O layers. // virtual int read(unsigned char *data, unsigned int size); virtual int write(T_write type, const unsigned char *data, const unsigned int size); virtual int flush(); virtual int drain(int limit, int timeout); virtual void finish() { fullReset(); finish_ = 1; } virtual int length() const { return w_buffer_.length_; } virtual int pending() const { return 0; } virtual int readable() const { return GetBytesReadable(fd_); } virtual int writable() const { return GetBytesWritable(fd_); } virtual int queued() const { return GetBytesQueued(fd_); } virtual int flushable() const { return 0; } virtual int wait(int timeout) const; void setSize(unsigned int initialSize, unsigned int thresholdSize, unsigned int maximumSize); // // Return a pointer to the data // in the read buffer. // virtual unsigned int getPending(unsigned char *&data) { data = NULL; return 0; } virtual void pendingReset() { } virtual void partialReset() { partialReset(w_buffer_); } virtual void fullReset(); int blocked() const { return blocked_; } protected: // // Make room in the buffer to accommodate // at least size bytes. // int resize(T_buffer &buffer, const int &size); void partialReset(T_buffer &buffer) { if (buffer.length_ == 0 && (buffer.data_.size() > initialSize_ || buffer.data_.capacity() > initialSize_)) { fullReset(buffer); } } void fullReset(T_buffer &buffer); // // Data members. // int fd_; int blocked_; int finish_; T_buffer w_buffer_; unsigned int initialSize_; unsigned int thresholdSize_; unsigned int maximumSize_; T_transport_type type_; private: #ifdef REFERENCES static int references_; #endif }; // // This class handles buffered I/O and // compression of the proxy stream. // class ProxyTransport : public Transport { public: ProxyTransport(int fd); virtual ~ProxyTransport(); virtual int read(unsigned char *data, unsigned int size); virtual int write(T_write type, const unsigned char *data, const unsigned int size); virtual int flush(); // // Same as in the base class. // // virtual int drain(int limit, int timeout); // // virtual void finish(); // // // Same as in the base class. // // virtual int length() const // virtual int pending() const { return r_buffer_.length_; } // // Same as in the base class. // // virtual int readable() const; // // virtual int writable() const; // // virtual int queued() const; // virtual int flushable() const { return flush_; } // // Same as in the base class, but // should not be called. // // int drained() const; // // Same as in the base class. // // virtual int wait(int timeout) const; // // Same as in the base class. // // void setSize(unsigned int initialSize, // unsigned int thresholdSize, // unsigned int maximumSize); // virtual unsigned int getPending(unsigned char *&data); virtual void pendingReset() { owner_ = 1; } virtual void partialReset() { if (owner_ == 1) { Transport::partialReset(r_buffer_); } Transport::partialReset(w_buffer_); } virtual void fullReset(); // // Same as in the base class. // // int blocked() const; // protected: int flush_; int owner_; T_buffer r_buffer_; z_stream r_stream_; z_stream w_stream_; private: #ifdef REFERENCES static int references_; #endif }; // // Handle memory-to-memory data transfers between // an agent and the proxy. // class AgentTransport : public Transport { public: AgentTransport(int fd); virtual ~AgentTransport(); virtual int read(unsigned char *data, unsigned int size); virtual int write(T_write type, const unsigned char *data, const unsigned int size); // // These two should never be called. // virtual int flush() __attribute__((noreturn)); virtual int drain(int limit, int timeout) __attribute((noreturn)); // // Same as in the base class. // // virtual void finish(); // // // Same as in the base class. // // virtual int length() const // virtual int pending() const { return r_buffer_.length_; } // // These are intended to operate only // on the internal buffers. // virtual int readable() const { return r_buffer_.length_; } virtual int writable() const { return control -> TransportMaximumBufferSize; } virtual int queued() const { return 0; } // // Same as in the base class. // // virtual int flushable() const; // // Same as in the base class, but // should not be called. // // int drained() const; // // // Return immediately or will // block until the timeout. // virtual int wait(int timeout) const { return 0; } // // Same as in the base class. // // void setSize(unsigned int initialSize, // unsigned int thresholdSize, // unsigned int maximumSize); // virtual unsigned int getPending(unsigned char *&data); virtual void pendingReset() { owner_ = 1; } virtual void partialReset() { if (owner_ == 1) { Transport::partialReset(r_buffer_); } Transport::partialReset(w_buffer_); } virtual void fullReset(); // // Same as in the base class. // // int blocked() const; // // // The following are specific of the // memory-to-memory transport. // int enqueue(const char *data, const int size); int dequeue(char *data, int size); int queuable() { // // Always allow the agent to enqueue // more data. // return control -> TransportMaximumBufferSize; } int dequeuable(); protected: // // Lock the buffer to handle reads and // writes safely. // #ifdef THREADS int lockRead(); int lockWrite(); int unlockRead(); int unlockWrite(); #endif // // Data members. // int owner_; T_buffer r_buffer_; // // Mutexes for safe read and write. // #ifdef THREADS pthread_mutex_t m_read_; pthread_mutex_t m_write_; #endif private: #ifdef REFERENCES static int references_; #endif }; #endif /* Transport_H */ nx-libs-3.5.99.23/nxcomp/src/Types.h0000644000000000000000000001501613614532331013662 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Types_H #define Types_H using namespace std; #include #include #include #include #include "MD5.h" // // This is MD5 length. // #define MD5_LENGTH 16 // // Types of repositories. Replace the original // clear() methods from STL in order to actually // free the unused memory. // class Message; class T_data : public vector < unsigned char > { public: unsigned char *begin() { return &*(vector < unsigned char >::begin()); } const unsigned char *begin() const { return &*(vector < unsigned char >::begin()); } // Avoid overriding clear() when using libc++. Fiddling with STL internals // doesn't really seem like a good idea to me anyway. #ifndef _LIBCPP_VECTOR void clear() { #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) #if defined(__GLIBCPP_INTERNAL_VECTOR_H) _Destroy(_M_start, _M_finish); #else /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ destroy(_M_start, _M_finish); #endif /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ _M_deallocate(_M_start, _M_end_of_storage - _M_start); _M_start = _M_finish = _M_end_of_storage = 0; #else /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ #if defined(_GLIBCXX_VECTOR) _Destroy(this->_M_impl._M_start, this->_M_impl._M_finish); _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); this->_M_impl._M_start = this->_M_impl._M_finish = this->_M_impl._M_end_of_storage = 0; #else /* #if defined(_GLIBCXX_VECTOR) */ destroy(start, finish); deallocate(); start = finish = end_of_storage = 0; #endif /* #if defined(_GLIBCXX_VECTOR) */ #endif /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ } #endif /* #ifdef _LIBCPP_VECTOR */ }; class T_messages : public vector < Message * > { public: // Avoid overriding clear() when using libc++. Fiddling with STL internals // doesn't really seem like a good idea to me anyway. #ifndef _LIBCPP_VECTOR void clear() { #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) #if defined(__GLIBCPP_INTERNAL_VECTOR_H) _Destroy(_M_start, _M_finish); #else /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ destroy(_M_start, _M_finish); #endif /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ _M_deallocate(_M_start, _M_end_of_storage - _M_start); _M_start = _M_finish = _M_end_of_storage = 0; #else /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ #if defined(_GLIBCXX_VECTOR) _Destroy(this->_M_impl._M_start, this->_M_impl._M_finish); _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); this->_M_impl._M_start = this->_M_impl._M_finish = this->_M_impl._M_end_of_storage = 0; #else /* #if defined(_GLIBCXX_VECTOR) */ destroy(start, finish); deallocate(); start = finish = end_of_storage = 0; #endif /* #if defined(_GLIBCXX_VECTOR) */ #endif /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ } #endif /* #ifndef _LIBCPP_VECTOR */ }; typedef md5_byte_t * T_checksum; struct T_less { bool operator()(T_checksum a, T_checksum b) const { return (memcmp(a, b, MD5_LENGTH) < 0); } }; typedef map < T_checksum, int, T_less > T_checksums; class Split; typedef list < Split * > T_splits; class File; struct T_older { bool operator()(File *a, File *b) const; }; typedef set < File *, T_older > T_files; typedef list < int > T_list; // // Used to accommodate data to be read and // written to a socket. // typedef struct { T_data data_; int length_; int start_; } T_buffer; // // The message store operation that was // executed for the message. The channels // use these values to determine how to // handle the message after it has been // received at the decoding side. // // Since ProtoStep8 (#issue 108) enum T_store_action { is_hit, is_added, is_discarded, is_removed }; // Since ProtoStep8 (#issue 108) #define IS_HIT is_hit #define IS_ADDED is_added enum T_checksum_action { use_checksum, discard_checksum }; enum T_data_action { use_data, discard_data }; // // Message is going to be weighted for // deletion at insert or cleanup time? // enum T_rating { rating_for_insert, rating_for_clean }; // // How to handle the writes to the X // and proxy connections. // enum T_write { write_immediate, write_delayed }; enum T_flush { flush_if_needed, flush_if_any }; // // This is the value to indicate an // invalid position in the message // store. // static const int nothing = -1; #endif /* Types_H */ nx-libs-3.5.99.23/nxcomp/src/Unpack.cpp0000644000000000000000000010577713614532331014350 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Misc.h" #include "Unpack.h" #define PANIC #define WARNING #undef TEST #undef DEBUG // // Used for the ZLIB decompression // of RGB, alpha and colormap data. // z_stream unpackStream; static int unpackInitialized; int Unpack8To8(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack8To8(T_colormap *colormap, const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack8To16(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack8To16(T_colormap *colormap, const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack8To24(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack8To24(T_colormap *colormap, const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack8To32(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack8To32(T_colormap *colormap, const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack15To16(const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack15To24(const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack15To32(const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack16To16(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack16To16(const unsigned char *data, unsigned char *out, unsigned char *end, int imageByteOrder); int Unpack16To24(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack16To24(const unsigned char *data, unsigned char *out, unsigned char *end, int imageByteOrder); int Unpack16To32(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack16To32(const unsigned char *data, unsigned char *out, unsigned char *end, int imageByteOrder); int Unpack24To24(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack24To24(const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack24To32(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack24To32(const unsigned char *data, unsigned char *out, unsigned char *end); int Unpack32To32(const T_colormask *colormask, const unsigned int *data, unsigned int *out, unsigned int *end); void UnpackInit() { if (unpackInitialized == 0) { unpackStream.zalloc = (alloc_func) 0; unpackStream.zfree = (free_func) 0; unpackStream.opaque = (voidpf) 0; unpackStream.next_in = (Bytef *) 0; unpackStream.avail_in = 0; int result = inflateInit2(&unpackStream, 15); if (result != Z_OK) { #ifdef PANIC *logofs << "UnpackInit: PANIC! Cannot initialize the Z stream " << "for decompression. Error is '" << zError(result) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Cannot initialize the Z stream for " << "decompression. Error is '" << zError(result) << "'.\n"; } else { unpackInitialized = 1; } } } void UnpackDestroy() { if (unpackInitialized == 1) { inflateEnd(&unpackStream); unpackInitialized = 0; } } // // Get bits per pixel set by client // according to display geometry. // int UnpackBitsPerPixel(T_geometry *geometry, unsigned int depth) { switch (depth) { case 1: { return geometry -> depth1_bpp; } case 4: { return geometry -> depth4_bpp; } case 8: { return geometry -> depth8_bpp; } case 15: case 16: { return geometry -> depth16_bpp; } case 24: { return geometry -> depth24_bpp; } case 32: { return geometry -> depth32_bpp; } default: { return 0; } } } int Unpack8To8(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack8To8: Unpacking " << end - out << " bytes of data.\n" << logofs_flush; #endif memcpy(out, data, end - out); return 1; } int Unpack8To16(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack8To16: Unpacking " << end - out << " bytes of data.\n" << logofs_flush; #endif unsigned short *out16 = (unsigned short *) out; unsigned short *end16 = (unsigned short *) end; while (out16 < end16) { if (*data == 0) { *out16 = 0x0; } else if (*data == 0xff) { *out16 = 0xffff; } else { // // Pixel layout: // // 8bits 00RRGGBB -> 16bits RR000GG0 000BB000. // *out16 = (((((*data & 0x30) << 2) | colormask -> correction_mask) << 8) & 0xf800) | (((((*data & 0xc) << 4) | colormask -> correction_mask) << 3) & 0x7e0) | (((((*data & 0x3) << 6) | colormask -> correction_mask) >> 3) & 0x1f); } out16++; data++; } return 1; } int Unpack8To24(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack8To24: Unpacking " << end - out << " bytes of data.\n" << logofs_flush; #endif while (out < (end - 2)) { if (*data == 0x00) { out[0] = out[1] = out[2] = 0x00; } else if (*data == 0xff) { out[0] = out[1] = out[2] = 0xff; } else { // // Pixel layout: // // 8bits 00RRGGBB -> 24bits RR000000 GG00000 BB000000. // out[0] = (((*data & 0x30) << 2) | colormask -> correction_mask); out[1] = (((*data & 0x0c) << 4) | colormask -> correction_mask); out[2] = (((*data & 0x03) << 6) | colormask -> correction_mask); } out += 3; data += 1; } return 1; } int Unpack8To32(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack8To32: Unpacking " << end - out << " bytes of data.\n" << logofs_flush; #endif unsigned int *out32 = (unsigned int *) out; unsigned int *end32 = (unsigned int *) end; while (out32 < end32) { if (*data == 0) { *out32 = 0x0; } else if (*data == 0xff) { *out32 = 0xffffff; } else { *out32 = ((((*data & 0x30) << 2) | colormask -> correction_mask) << 16) | ((((*data & 0xc) << 4) | colormask -> correction_mask) << 8) | (((*data & 0x3) << 6) | colormask -> correction_mask); } out32++; data++; } return 1; } int Unpack8(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, int src_height, unsigned char *src_data, int src_size, int dst_depth, int dst_width, int dst_height, unsigned char *dst_data, int dst_size) { int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); int (*unpack)(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); switch (dst_bpp) { case 8: { unpack = Unpack8To8; break; } case 16: { unpack = Unpack8To16; break; } case 24: { unpack = Unpack8To24; break; } case 32: { unpack = Unpack8To32; break; } default: { #ifdef PANIC *logofs << "Unpack8: PANIC! Bad destination bits per pixel " << dst_bpp << ". Only 16/24/32 are supported.\n" << logofs_flush; #endif return -1; } } if (dst_bpp == 24) { unsigned char *dst_end = dst_data; #ifdef TEST *logofs << "Unpack8: Handling 24 bits with dst_size " << dst_size << ".\n" << logofs_flush; #endif for (int y = 0; y < dst_height; y++) { dst_data = dst_end; dst_end += RoundUp4(dst_width * 3); (*unpack)(colormask, src_data, dst_data, dst_end); src_data += src_width; } } else { unsigned char *dst_end = dst_data + dst_size; (*unpack)(colormask, src_data, dst_data, dst_end); } return 1; } int Unpack16To16(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack16To16: Unpacking " << end - out << " bytes of data.\n" << logofs_flush; #endif if (colormask -> correction_mask) { unsigned short *data16 = (unsigned short *) data; unsigned short *out16 = (unsigned short *) out; unsigned short *end16 = (unsigned short *) end; while (out16 < end16) { if (*data16 == 0x0000) { *out16 = 0x0000; } else if (*data16 == 0xffff) { *out16 = 0xffff; } else { // // Pixel layout: // // 16bit RRRRRGGG GG0BBBBB -> RRRRRGGG GGGBBBBB. // *out16 = (((((*data16 & 0xf100) >> 8) | colormask -> correction_mask) << 8) & 0xf800) | (((((*data16 & 0x7c0) >> 3) | colormask -> correction_mask) << 3) & 0x7e0) | (((((*data16 & 0x1f) << 3) | colormask -> correction_mask) >> 3) & 0x1f); } out16++; data16++; } } else { #ifdef TEST *logofs << "Unpack16To16: Using bitwise copy due to null correction mask.\n" << logofs_flush; #endif memcpy((unsigned char *) out, (unsigned char *) data, end - out); } return 1; } int Unpack16To24(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack16To24: Unpacking " << end - out << " bytes of data.\n" << logofs_flush; #endif unsigned short *data16 = (unsigned short *) data; while (out < end - 2) { if (*data16 == 0x0) { out[0] = 0x00; out[1] = 0x00; out[2] = 0x00; } else if (*data16 == 0xffff) { out[0] = 0xff; out[1] = 0xff; out[2] = 0xff; } else { #ifdef TEST *logofs << "Unpack16To24: Pixel [" << *data16 << "]\n" << logofs_flush; #endif // // Pixel layout: // // 16bit 0RRRRRGG GGGBBBBB -> 24 bit RRRRR000 GGGGG000 BBBBB000 // out[0] = (((*data16 & 0x7c00) >> 7) | colormask -> correction_mask); out[1] = (((*data16 & 0x03e0) >> 2) | colormask -> correction_mask); out[2] = (((*data16 & 0x001f) << 3) | colormask -> correction_mask); } out += 3; data16 += 1; } return 1; } int Unpack16To32(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack16To32: Unpacking " << end - out << " bytes of data.\n" << logofs_flush; #endif unsigned short *data16 = (unsigned short *) data; unsigned int *out32 = (unsigned int *) out; unsigned int *end32 = (unsigned int *) end; while (out32 < end32) { if (*data16 == 0x0) { *out32 = 0x0; } else if (*data16 == 0xffff) { *out32 = 0xffffff; } else { *out32 = ((((*data16 & 0x7c00) >> 7) | colormask -> correction_mask) << 16) | ((((*data16 & 0x3e0) >> 2) | colormask -> correction_mask) << 8) | (((*data16 & 0x1f) << 3) | colormask -> correction_mask); } out32++; data16++; } return 1; } int Unpack16(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, int src_height, unsigned char *src_data, int src_size, int dst_depth, int dst_width, int dst_height, unsigned char *dst_data, int dst_size) { int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); int (*unpack)(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); switch (dst_bpp) { case 16: { unpack = Unpack16To16; break; } case 24: { unpack = Unpack16To24; break; } case 32: { unpack = Unpack16To32; break; } default: { #ifdef PANIC *logofs << "Unpack16: PANIC! Bad destination bits per pixel " << dst_bpp << ". Only 24/32 are supported.\n" << logofs_flush; #endif return -1; } } if (dst_bpp == 24) { unsigned char *dst_end = dst_data; for (int y = 0; y < dst_height; y++) { dst_data = dst_end; dst_end += RoundUp4(dst_width * 3); (*unpack)(colormask, src_data, dst_data, dst_end); src_data += (src_width * 2); } } else { unsigned char *dst_end = dst_data + dst_size; (*unpack)(colormask, src_data, dst_data, dst_end); } return 1; } int Unpack24To24(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack24To24: Unpacking " << end - out << " bytes of data.\n" << logofs_flush; #endif if (colormask -> correction_mask) { while (out < end) { if (data[0] == 0x00 && data[1] == 0x00 && data[2] == 0x00) { out[0] = out[1] = out[2] = 0x00; } else if (data[0] == 0xff && data[1] == 0xff && data[2] == 0xff) { out[0] = out[1] = out[2] = 0xff; } else { out[0] = (data[0] | colormask -> correction_mask); out[1] = (data[1] | colormask -> correction_mask); out[2] = (data[2] | colormask -> correction_mask); } out += 3; data += 3; } } else { #ifdef TEST *logofs << "Unpack24To24: Using bitwise copy due to null correction mask.\n" << logofs_flush; #endif memcpy((unsigned char *) out, (unsigned char *) data, end - out); } return 1; } int Unpack24To32(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack24To32: Unpacking " << end - out << " bytes of data.\n" << logofs_flush; #endif unsigned int *out32 = (unsigned int *) out; unsigned int *end32 = (unsigned int *) end; while (out32 < end32) { if (colormask -> color_mask == 0xff) { *out32 = (data[0] << 16) | (data[1] << 8) | data[2]; } else { if (data[0] == 0x0 && data[1] == 0x0 && data[2] == 0x0) { *out32 = 0x0; } else if (data[0] == 0xff && data[1] == 0xff && data[2] == 0xff) { *out32 = 0xffffff; } else { *out32 = (((unsigned int) data[0] | colormask -> correction_mask) << 16) | (((unsigned int) data[1] | colormask -> correction_mask) << 8) | ((unsigned int) data[2] | colormask -> correction_mask); } } out32 += 1; data += 3; } return 1; } int Unpack24(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, int src_height, unsigned char *src_data, int src_size, int dst_depth, int dst_width, int dst_height, unsigned char *dst_data, int dst_size) { int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); int (*unpack)(const T_colormask *colormask, const unsigned char *data, unsigned char *out, unsigned char *end); switch (dst_bpp) { case 24: { unpack = Unpack24To24; break; } case 32: { unpack = Unpack24To32; break; } default: { #ifdef PANIC *logofs << "Unpack24: PANIC! Bad destination bits per pixel " << dst_bpp << ". Only 32 is supported.\n" << logofs_flush; #endif return -1; } } if (dst_bpp == 24) { unsigned char *dst_end; unsigned long scanline_size = RoundUp4(dst_width * dst_bpp / 8); dst_end = dst_data; #ifdef TEST *logofs << "Unpack24: Handling 24 bits with dst_height " << dst_height << " scanline_size " << scanline_size << " dst_size " << dst_size << ".\n" << logofs_flush; #endif for (int y = 0; y < dst_height; y++) { dst_data = dst_end; dst_end += scanline_size; (*unpack)(colormask, src_data, dst_data, dst_end); src_data += scanline_size; } } else { unsigned char *dst_end = dst_data + dst_size; (*unpack)(colormask, src_data, dst_data, dst_end); } return 1; } int Unpack8To8(T_colormap *colormap, const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack8To8: Unpacking " << end - out << " bytes of colormapped data.\n" << logofs_flush; #endif while (out < end) { *(out++) = (unsigned char) colormap -> data[*(data++)]; } return 1; } int Unpack8To16(T_colormap *colormap, const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack8To16: Unpacking " << end - out << " bytes of colormapped data.\n" << logofs_flush; #endif unsigned short *out16 = (unsigned short *) out; unsigned short *end16 = (unsigned short *) end; while (out16 < end16) { *(out16++) = (unsigned short) colormap -> data[*(data++)]; } return 1; } int Unpack8To24(T_colormap *colormap, const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack8To24: Unpacking " << end - out << " bytes of colormapped data.\n" << logofs_flush; #endif unsigned int value; while (out < end) { value = colormap -> data[*(data++)]; *(out++) = value; *(out++) = value >> 8; *(out++) = value >> 16; } return 1; } int Unpack8To32(T_colormap *colormap, const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack8To32: Unpacking " << end - out << " bytes of colormapped data.\n" << logofs_flush; #endif unsigned int *out32 = (unsigned int *) out; unsigned int *end32 = (unsigned int *) end; while (out32 < end32) { *(out32++) = colormap -> data[*(data++)]; } return 1; } int Unpack8(T_geometry *geometry, T_colormap *colormap, int src_depth, int src_width, int src_height, unsigned char *src_data, int src_size, int dst_depth, int dst_width, int dst_height, unsigned char *dst_data, int dst_size) { if (src_depth != 8) { #ifdef PANIC *logofs << "Unpack8: PANIC! Cannot unpack colormapped image of source depth " << src_depth << ".\n" << logofs_flush; #endif return -1; } int (*unpack)(T_colormap *colormap, const unsigned char *data, unsigned char *out, unsigned char *end); int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); switch (dst_bpp) { case 8: { unpack = Unpack8To8; break; } case 16: { unpack = Unpack8To16; break; } case 24: { unpack = Unpack8To24; break; } case 32: { unpack = Unpack8To32; break; } default: { #ifdef PANIC *logofs << "Unpack8: PANIC! Bad destination bits per pixel " << dst_bpp << ". Only 8/16/24/32 are supported.\n" << logofs_flush; #endif return -1; } } if (src_width == dst_width && src_height == dst_height) { unsigned char *dst_end = dst_data + dst_size; (*unpack)(colormap, src_data, dst_data, dst_end); } else if (src_width >= dst_width && src_height >= dst_height) { unsigned char *dst_end = dst_data; for (int y = 0; y < dst_height; y++) { dst_data = dst_end; dst_end += RoundUp4(dst_width * dst_bpp / 8); (*unpack)(colormap, src_data, dst_data, dst_end); src_data += src_width; } } else { #ifdef PANIC *logofs << "Unpack8: PANIC! Cannot unpack image. " << "Destination area " << dst_width << "x" << dst_height << " is not fully contained in " << src_width << "x" << src_height << " source.\n" << logofs_flush; #endif return -1; } return 1; } int Unpack15To16(const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack15To16: Unpacking " << end - out << " bytes of colormapped data.\n" << logofs_flush; #endif unsigned short *data16 = (unsigned short *) data; unsigned short *out16 = (unsigned short *) out; unsigned short *end16 = (unsigned short *) end; while (out16 < end16) { if (*data16 == 0x0) { *out16 = 0x0; } else if (*data16 == 0x7fff) { *out16 = 0xffff; } else { #ifdef TEST *logofs << "Unpack15To16: Pixel [" << *data16 << "]\n" << logofs_flush; #endif *out16 = ((*data16 & 0x7ff0) << 1) | (*data16 & 0x001f); } out16 += 1; data16 += 1; } return 1; } int Unpack15To24(const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack15To24: Unpacking " << end - out << " bytes of data.\n" << logofs_flush; #endif unsigned short *data16 = (unsigned short *) data; while (out < end - 2) { if (*data16 == 0x0) { out[0] = 0x00; out[1] = 0x00; out[2] = 0x00; } else if (*data16 == 0x7fff) { out[0] = 0xff; out[1] = 0xff; out[2] = 0xff; } else { #ifdef TEST *logofs << "Unpack15To24: Pixel [" << *data16 << "]\n" << logofs_flush; #endif out[0] = ((*data16 >> 7) & 0xf8) | ((*data16 >> 12) & 0x07); out[1] = ((*data16 >> 2) & 0xf8) | ((*data16 >> 8) & 0x07); out[2] = ((*data16 << 3) & 0xf8) | ((*data16 >> 2) & 0x07); } out += 3; data16 += 1; } return 1; } int Unpack15To32(const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack15To32: Unpacking " << end - out << " bytes of data.\n" << logofs_flush; #endif unsigned short *data16 = (unsigned short *) data; unsigned int *out32 = (unsigned int *) out; unsigned int *end32 = (unsigned int *) end; while (out32 < end32) { if (*data16 == 0x0) { *out32 = 0x0; } else if (*data16 == 0xffff) { *out32 = 0xffffff; } else { *out32 = ((((*data16 >> 7) & 0xf8) | ((*data16 >> 12) & 0x07)) << 16) | ((((*data16 >> 2) & 0xf8) | ((*data16 >> 8) & 0x07)) << 8) | (((*data16 << 3) & 0xf8) | ((*data16 >> 2) & 0x07)); } out32++; data16++; } return 1; } int Unpack15(T_geometry *geometry, int src_depth, int src_width, int src_height, unsigned char *src_data, int src_size, int dst_depth, int dst_width, int dst_height, unsigned char *dst_data, int dst_size) { if (src_depth != 16) { #ifdef PANIC *logofs << "Unpack15: PANIC! Cannot unpack colormapped image of source depth " << src_depth << ".\n" << logofs_flush; #endif return -1; } int (*unpack)(const unsigned char *data, unsigned char *out, unsigned char *end); int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); switch (dst_bpp) { case 16: { unpack = Unpack15To16; break; } case 24: { unpack = Unpack15To24; break; } case 32: { unpack = Unpack15To32; break; } default: { #ifdef PANIC *logofs << "Unpack15: PANIC! Bad destination bits per pixel " << dst_bpp << ". Only 16/24/32 are supported.\n" << logofs_flush; #endif return -1; } } if (src_width == dst_width && src_height == dst_height) { unsigned char *dst_end = dst_data + dst_size; (*unpack)(src_data, dst_data, dst_end); } else if (src_width >= dst_width && src_height >= dst_height) { unsigned char *dst_end = dst_data; for (int y = 0; y < dst_height; y++) { dst_data = dst_end; dst_end += RoundUp4(dst_width * dst_bpp / 8); (*unpack)(src_data, dst_data, dst_end); src_data += src_width * 2; } } else { #ifdef PANIC *logofs << "Unpack15: PANIC! Cannot unpack image. " << "Destination area " << dst_width << "x" << dst_height << " is not fully contained in " << src_width << "x" << src_height << " source.\n" << logofs_flush; #endif return -1; } return 1; } int Unpack16To16(const unsigned char *data, unsigned char *out, unsigned char *end, int imageByteOrder) { #ifdef TEST *logofs << "Unpack16To16: Unpacking " << end - out << " bytes of colormapped data.\n" << logofs_flush; #endif memcpy((unsigned char *) out, (unsigned char *) data, end - out); return 1; } int Unpack16To24(const unsigned char *data, unsigned char *out, unsigned char *end, int imageByteOrder) { #ifdef TEST *logofs << "Unpack16To24: Unpacking " << end - out << " bytes of data.\n" << logofs_flush; #endif unsigned short *data16 = (unsigned short *) data; while (out < end - 2) { if (*data16 == 0x0) { out[0] = 0x00; out[1] = 0x00; out[2] = 0x00; } else if (*data16 == 0xffff) { out[0] = 0xff; out[1] = 0xff; out[2] = 0xff; } else { #ifdef TEST *logofs << "Unpack16To24: Pixel [" << *data16 << "]\n" << logofs_flush; #endif out[0] = ((*data16 >> 8) & 0xf8) | ((*data16 >> 13) & 0x07); out[1] = ((*data16 >> 3) & 0xfc) | ((*data16 >> 9) & 0x03); out[2] = ((*data16 << 3) & 0xf8) | ((*data16 >> 2) & 0x07); } out += 3; data16 += 1; } return 1; } int Unpack16To32(const unsigned char *data, unsigned char *out, unsigned char *end, int imageByteOrder) { #ifdef TEST *logofs << "Unpack16To32: Unpacking " << end - out << " bytes of data.\n" << logofs_flush; #endif unsigned short *data16 = (unsigned short *) data; unsigned int *out32 = (unsigned int *) out; unsigned int *end32 = (unsigned int *) end; unsigned short pixel16; unsigned int pixel32; while (out32 < end32) { pixel16 = GetUINT((unsigned char *)data16, 0); if (pixel16 == 0x0) { PutULONG(0x0, (unsigned char *) out32, imageByteOrder); } else if (pixel16 == 0xffff) { PutULONG(0xffffff, (unsigned char *) out32, imageByteOrder); } else { pixel32 = ((((pixel16 >> 8) & 0xf8) | ((pixel16 >> 13) & 0x07)) << 16) | ((((pixel16 >> 3) & 0xfc) | ((pixel16 >> 9) & 0x03)) << 8) | (((pixel16 << 3) & 0xf8) | ((pixel16 >> 2) & 0x07)); PutULONG(pixel32, (unsigned char *) out32, imageByteOrder); } out32++; data16++; } return 1; } int Unpack16(T_geometry *geometry, int src_depth, int src_width, int src_height, unsigned char *src_data, int src_size, int dst_depth, int dst_width, int dst_height, unsigned char *dst_data, int dst_size) { int imageByteOrder = geometry -> image_byte_order; if (src_depth != 16) { #ifdef PANIC *logofs << "Unpack16: PANIC! Cannot unpack colormapped image of source depth " << src_depth << ".\n" << logofs_flush; #endif return -1; } int (*unpack)(const unsigned char *data, unsigned char *out, unsigned char *end, int imageByteOrder); int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); switch (dst_bpp) { case 16: { unpack = Unpack16To16; break; } case 24: { unpack = Unpack16To24; break; } case 32: { unpack = Unpack16To32; break; } default: { #ifdef PANIC *logofs << "Unpack16: PANIC! Bad destination bits per pixel " << dst_bpp << ". Only 16/24/32 are supported.\n" << logofs_flush; #endif return -1; } } if (src_width == dst_width && src_height == dst_height) { unsigned char *dst_end = dst_data + dst_size; (*unpack)(src_data, dst_data, dst_end, imageByteOrder); } else if (src_width >= dst_width && src_height >= dst_height) { unsigned char *dst_end = dst_data; for (int y = 0; y < dst_height; y++) { dst_data = dst_end; dst_end += RoundUp4(dst_width * dst_bpp / 8); (*unpack)(src_data, dst_data, dst_end, imageByteOrder); src_data += src_width * 2; } } else { #ifdef PANIC *logofs << "Unpack16: PANIC! Cannot unpack image. " << "Destination area " << dst_width << "x" << dst_height << " is not fully contained in " << src_width << "x" << src_height << " source.\n" << logofs_flush; #endif return -1; } return 1; } int Unpack24To24(const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack124To24: Unpacking " << end - out << " bytes of colormapped data.\n" << logofs_flush; #endif while (out < end) { *(out++) = *(data++); } return 1; } int Unpack24To32(const unsigned char *data, unsigned char *out, unsigned char *end) { #ifdef TEST *logofs << "Unpack24To32: Unpacking " << end - out << " bytes of colormapped data.\n" << logofs_flush; #endif unsigned int *out32 = (unsigned int *) out; unsigned int *end32 = (unsigned int *) end; while (out32 < end32) { if (data[0] == 0x0 && data[1] == 0x0 && data[2] == 0x0) { *out32 = 0x0; } else if (data[0] == 0xff && data[1] == 0xff && data[2] == 0xff) { *out32 = 0xffffff; } else { *out32 = (data[2] << 16) | (data[1] << 8) | data[0]; } out32 += 1; data += 3; } return 1; } int Unpack24(T_geometry *geometry, int src_depth, int src_width, int src_height, unsigned char *src_data, int src_size, int dst_depth, int dst_width, int dst_height, unsigned char *dst_data, int dst_size) { if (src_depth != 24) { #ifdef PANIC *logofs << "Unpack24: PANIC! Cannot unpack colormapped image of source depth " << src_depth << ".\n" << logofs_flush; #endif return -1; } int (*unpack)(const unsigned char *data, unsigned char *out, unsigned char *end); int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); switch (dst_bpp) { case 24: { unpack = Unpack24To24; break; } case 32: { unpack = Unpack24To32; break; } default: { #ifdef PANIC *logofs << "Unpack24: PANIC! Bad destination bits per pixel " << dst_bpp << ". Only 24/32 are supported.\n" << logofs_flush; #endif return -1; } } if (src_width == dst_width && src_height == dst_height) { unsigned char *dst_end = dst_data + dst_size; (*unpack)(src_data, dst_data, dst_end); } else if (src_width >= dst_width && src_height >= dst_height) { unsigned char *dst_end = dst_data; for (int y = 0; y < dst_height; y++) { dst_data = dst_end; dst_end += RoundUp4(dst_width * dst_bpp / 8); (*unpack)(src_data, dst_data, dst_end); src_data += src_width * 3; } } else { #ifdef PANIC *logofs << "Unpack24: PANIC! Cannot unpack image. " << "Destination area " << dst_width << "x" << dst_height << " is not fully contained in " << src_width << "x" << src_height << " source.\n" << logofs_flush; #endif return -1; } return 1; } int Unpack32To32(const T_colormask *colormask, const unsigned int *data, unsigned int *out, unsigned int *end) { #ifdef TEST *logofs << "Unpack32To32: Unpacking " << end - out << " bytes of data.\n" << logofs_flush; #endif if (colormask -> correction_mask) { while (out < end) { if (*data == 0x00000000) { *out = 0x00000000; } else if (*data == 0xFFFFFFFF) { *out = 0xFFFFFFFF; } else { *out = *data | ((colormask -> correction_mask << 16) | (colormask -> correction_mask << 8) | colormask -> correction_mask); } out += 1; data += 1; } } else { #ifdef TEST *logofs << "Unpack32To32: Using bitwise copy due to null correction mask.\n" << logofs_flush; #endif memcpy((unsigned char *) out, (unsigned char *) data, end - out); } return 1; } nx-libs-3.5.99.23/nxcomp/src/Unpack.h0000644000000000000000000001172513614532331014002 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Unpack_H #define Unpack_H #include "NXpack.h" #include "Z.h" #define LSBFirst 0 #define MSBFirst 1 #define SPLIT_PATTERN 0x88 typedef ColorMask T_colormask; // // Pixel geometry of channel's display. // typedef struct { unsigned int depth1_bpp; unsigned int depth4_bpp; unsigned int depth8_bpp; unsigned int depth16_bpp; unsigned int depth24_bpp; unsigned int depth32_bpp; unsigned int red_mask; unsigned int green_mask; unsigned int blue_mask; unsigned int image_byte_order; unsigned int bitmap_bit_order; unsigned int scanline_unit; unsigned int scanline_pad; } T_geometry; // // Colormap is used to remap colors // from source to destination depth. // typedef struct { unsigned int entries; unsigned int *data; } T_colormap; // // Alpha channel data is added to 32 // bits images at the time they are // unpacked. // typedef struct { unsigned int entries; unsigned char *data; } T_alpha; // // The ZLIB stream structure used for // the decompression. // extern z_stream unpackStream; // // Initialize the ZLIB stream used for // decompression. // void UnpackInit(); // // Free the ZLIB stream. // void UnpackDestroy(); // // Get the destination bits per pixel // based on the drawable depth. // int UnpackBitsPerPixel(T_geometry *geometry, unsigned int depth); // // Unpack the source data into the X // bitmap. // int Unpack8(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, int src_height, unsigned char *src_data, int src_size, int dst_depth, int dst_width, int dst_height, unsigned char *dst_data, int dst_size); int Unpack16(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, int src_height, unsigned char *src_data, int src_size, int dst_depth, int dst_width, int dst_height, unsigned char *dst_data, int dst_size); int Unpack24(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, int src_height, unsigned char *src_data, int src_size, int dst_depth, int dst_width, int dst_height, unsigned char *dst_data, int dst_size); int Unpack8(T_geometry *geometry, T_colormap *colormap, int src_depth, int src_width, int src_height, unsigned char *src_data, int src_size, int dst_depth, int dst_width, int dst_height, unsigned char *dst_data, int dst_size); int Unpack15(T_geometry *geometry, int src_depth, int src_width, int src_height, unsigned char *src_data, int src_size, int dst_depth, int dst_width, int dst_height, unsigned char *dst_data, int dst_size); int Unpack16(T_geometry *geometry, int src_depth, int src_width, int src_height, unsigned char *src_data, int src_size, int dst_depth, int dst_width, int dst_height, unsigned char *dst_data, int dst_size); int Unpack24(T_geometry *geometry, int src_depth, int src_width, int src_height, unsigned char *src_data, int src_size, int dst_depth, int dst_width, int dst_height, unsigned char *dst_data, int dst_size); #endif /* Unpack_H */ nx-libs-3.5.99.23/nxcomp/src/Vars.c0000644000000000000000000000461713614532331013471 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef __cplusplus extern "C" { #endif #include #include "NXvars.h" /* * Allocate here instances of variables and * pointers declared in NXvars.h. */ int _NXHandleDisplayError = 0; NXDisplayErrorPredicate _NXDisplayErrorFunction = NULL; int _NXUnsetLibraryPath = 0; NXLostSequenceHandler _NXLostSequenceFunction = NULL; NXDisplayBlockHandler _NXDisplayBlockFunction = NULL; NXDisplayWriteHandler _NXDisplayWriteFunction = NULL; NXDisplayFlushHandler _NXDisplayFlushFunction = NULL; NXDisplayStatisticsHandler _NXDisplayStatisticsFunction = NULL; #ifdef __cplusplus } #endif nx-libs-3.5.99.23/nxcomp/src/Version.c0000644000000000000000000000607613614532331014204 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2015 Qindel Formacion y Servicios SL. */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License Version 2, as */ /* published by the Free Software Foundation. */ /* */ /* This program is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTA- */ /* BILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General */ /* Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, you can request a copy from Qindel */ /* or write to the Free Software Foundation, Inc., 51 Franklin Street, */ /* Fifth Floor, Boston, MA 02110-1301 USA. */ /* */ /* All rights reserved. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "NX.h" static int _NXVersionMajor = -1; static int _NXVersionMinor = -1; static int _NXVersionPatch = -1; static int _NXVersionMaintenancePatch = -1; const char* NXVersion() { const char *version = VERSION; return version; } void _parseNXVersion() { char version[32]; int i; strcpy(version, VERSION); char *value; /* Reset values to 0 if undefined */ _NXVersionMajor = _NXVersionMinor = _NXVersionPatch = _NXVersionMaintenancePatch = 0; #define NXVERSIONSEPARATOR "." value = strtok(version, NXVERSIONSEPARATOR); for (i = 0; value != NULL && i < 4; i++) { switch (i) { case 0: _NXVersionMajor = atoi(value); break; case 1: _NXVersionMinor = atoi(value); break; case 2: _NXVersionPatch = atoi(value); break; case 3: _NXVersionMaintenancePatch = atoi(value); break; } value = strtok(NULL, NXVERSIONSEPARATOR); } } int NXMajorVersion() { if (_NXVersionMajor == -1) _parseNXVersion(); return _NXVersionMajor; } int NXMinorVersion() { if (_NXVersionMinor == -1) _parseNXVersion(); return _NXVersionMinor; } int NXPatchVersion() { if (_NXVersionPatch == -1) _parseNXVersion(); return _NXVersionPatch; } int NXMaintenancePatchVersion() { if (_NXVersionMaintenancePatch == -1) _parseNXVersion(); return _NXVersionMaintenancePatch; } nx-libs-3.5.99.23/nxcomp/src/WriteBuffer.cpp0000644000000000000000000003064113614532331015336 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "Misc.h" #include "Control.h" #include "WriteBuffer.h" #define PANIC #define WARNING #undef TEST #undef DEBUG WriteBuffer::WriteBuffer() { size_ = WRITE_BUFFER_DEFAULT_SIZE; buffer_ = new unsigned char[size_]; length_ = 0; index_ = NULL; scratchLength_ = 0; scratchBuffer_ = NULL; scratchOwner_ = 1; initialSize_ = WRITE_BUFFER_DEFAULT_SIZE; thresholdSize_ = WRITE_BUFFER_DEFAULT_SIZE << 1; maximumSize_ = WRITE_BUFFER_DEFAULT_SIZE << 4; #ifdef VALGRIND memset(buffer_, '\0', size_); #endif } WriteBuffer::~WriteBuffer() { if (scratchOwner_ == 1 && scratchBuffer_ != NULL) { delete [] scratchBuffer_; } delete [] buffer_; } void WriteBuffer::setSize(unsigned int initialSize, unsigned int thresholdSize, unsigned int maximumSize) { initialSize_ = initialSize; thresholdSize_ = thresholdSize; maximumSize_ = maximumSize; #ifdef TEST *logofs << "WriteBuffer: Set buffer sizes to " << initialSize_ << "/" << thresholdSize_ << "/" << maximumSize_ << ".\n" << logofs_flush; #endif } void WriteBuffer::partialReset() { if (scratchBuffer_ != NULL) { if (scratchOwner_) { #ifdef DEBUG *logofs << "WriteBuffer: Going to delete " << scratchLength_ << " bytes from the " << "scratch buffer.\n" << logofs_flush; #endif delete [] scratchBuffer_; } scratchLength_ = 0; scratchBuffer_ = NULL; scratchOwner_ = 1; } length_ = 0; index_ = NULL; #ifdef DEBUG *logofs << "WriteBuffer: Performed partial reset with " << size_ << " bytes in buffer.\n" << logofs_flush; #endif } void WriteBuffer::fullReset() { if (scratchBuffer_ != NULL) { if (scratchOwner_ == 1) { #ifdef DEBUG *logofs << "WriteBuffer: Going to delete " << scratchLength_ << " bytes from the " << "scratch buffer.\n" << logofs_flush; #endif delete [] scratchBuffer_; } scratchLength_ = 0; scratchBuffer_ = NULL; scratchOwner_ = 1; } length_ = 0; index_ = NULL; if (size_ > initialSize_) { #ifdef TEST *logofs << "WriteBuffer: Reallocating a new buffer of " << initialSize_ << " bytes.\n" << logofs_flush; #endif delete [] buffer_; size_ = initialSize_; buffer_ = new unsigned char[size_]; if (buffer_ == NULL) { #ifdef PANIC *logofs << "WriteBuffer: PANIC! Can't allocate memory for " << "X messages in context [A].\n" << logofs_flush; #endif cerr << "Error" << ": Can't allocate memory for " << "X messages in context [A].\n"; HandleAbort(); } #ifdef VALGRIND memset(buffer_, '\0', size_); #endif } #ifdef DEBUG *logofs << "WriteBuffer: Performed full reset with " << size_ << " bytes in buffer.\n" << logofs_flush; #endif } unsigned char *WriteBuffer::addMessage(unsigned int numBytes) { #ifdef DEBUG *logofs << "WriteBuffer: Adding " << numBytes << " bytes to " << length_ << " bytes already in buffer.\n" << logofs_flush; #endif if (numBytes > WRITE_BUFFER_OVERFLOW_SIZE) { #ifdef PANIC *logofs << "WriteBuffer: PANIC! Can't add a message of " << numBytes << " bytes.\n" << logofs_flush; *logofs << "WriteBuffer: PANIC! Assuming error handling " << "data in context [B].\n" << logofs_flush; #endif cerr << "Error" << ": Can't add a message of " << numBytes << " bytes to write buffer.\n"; cerr << "Error" << ": Assuming error handling " << "data in context [B].\n"; HandleAbort(); } else if (length_ + numBytes > size_) { unsigned int newSize = thresholdSize_; while (newSize < length_ + numBytes) { newSize <<= 1; if (newSize > maximumSize_) { newSize = length_ + numBytes + initialSize_; } } #ifdef TEST *logofs << "WriteBuffer: Growing buffer from " << size_ << " to " << newSize << " bytes.\n" << logofs_flush; #endif unsigned int indexOffset = 0; if (index_ && *index_) { indexOffset = *index_ - buffer_; } size_ = newSize; unsigned char *newBuffer = new unsigned char[size_]; if (newBuffer == NULL) { #ifdef PANIC *logofs << "WriteBuffer: PANIC! Can't allocate memory for " << "X messages in context [C].\n" << logofs_flush; #endif cerr << "Error" << ": Can't allocate memory for " << "X messages in context [C].\n"; HandleAbort(); } #ifdef TEST if (newSize >= maximumSize_) { *logofs << "WriteBuffer: WARNING! Buffer grown to reach " << "size of " << newSize << " bytes.\n" << logofs_flush; } #endif #ifdef VALGRIND memset(newBuffer, '\0', size_); #endif memcpy(newBuffer, buffer_, length_); #ifdef DEBUG *logofs << "WriteBuffer: Going to delete the " << "old buffer with new size " << size_ << ".\n" << logofs_flush; #endif delete [] buffer_; buffer_ = newBuffer; if (index_ && *index_) { *index_ = buffer_ + indexOffset; } } unsigned char *result = buffer_ + length_; length_ += numBytes; #ifdef DEBUG *logofs << "WriteBuffer: Bytes in buffer are " << length_ << " while size is " << size_ << ".\n" << logofs_flush; #endif return result; } unsigned char *WriteBuffer::removeMessage(unsigned int numBytes) { #ifdef TEST *logofs << "WriteBuffer: Removing " << numBytes << " bytes from buffer.\n" << logofs_flush; #endif if (numBytes > length_) { #ifdef PANIC *logofs << "WriteBuffer: PANIC! Can't remove " << numBytes << " bytes with only " << length_ << " bytes in buffer.\n" << logofs_flush; #endif cerr << "Error" << ": Buffer underflow handling " << "write buffer in context [D].\n"; HandleAbort(); } length_ -= numBytes; #ifdef TEST *logofs << "WriteBuffer: Bytes in buffer are now " << length_ << " while size is " << size_ << ".\n" << logofs_flush; #endif return (buffer_ + length_); } unsigned char *WriteBuffer::addScratchMessage(unsigned int numBytes) { if (numBytes > WRITE_BUFFER_OVERFLOW_SIZE) { #ifdef PANIC *logofs << "WriteBuffer: PANIC! Can't add a message of " << numBytes << " bytes.\n" << logofs_flush; *logofs << "WriteBuffer: PANIC! Assuming error handling " << "data in context [E].\n" << logofs_flush; #endif cerr << "Error" << ": Can't add a message of " << numBytes << " bytes to write buffer.\n"; cerr << "Error" << ": Assuming error handling " << "data in context [E].\n"; HandleAbort(); } else if (scratchBuffer_ != NULL) { #ifdef PANIC *logofs << "WriteBuffer: PANIC! Can't add a message of " << numBytes << " bytes with " << scratchLength_ << " bytes already in scratch buffer.\n" << logofs_flush; *logofs << "WriteBuffer: PANIC! Assuming error handling " << "data in context [F].\n" << logofs_flush; #endif cerr << "Error" << ": Can't add a message of " << numBytes << " bytes with " << scratchLength_ << " bytes already in scratch buffer.\n"; cerr << "Error" << ": Assuming error handling " << "data in context [F].\n"; HandleAbort(); } #ifdef DEBUG *logofs << "WriteBuffer: Adding " << numBytes << " bytes " << "to scratch buffer.\n" << logofs_flush; #endif unsigned char *newBuffer = new unsigned char[numBytes]; if (newBuffer == NULL) { #ifdef PANIC *logofs << "WriteBuffer: PANIC! Can't allocate memory for " << "X messages in context [G].\n" << logofs_flush; #endif cerr << "Error" << ": Can't allocate memory for " << "X messages in context [G].\n"; HandleAbort(); } #ifdef VALGRIND memset(newBuffer, '\0', numBytes); #endif scratchBuffer_ = newBuffer; scratchOwner_ = 1; scratchLength_ = numBytes; return newBuffer; } unsigned char *WriteBuffer::addScratchMessage(unsigned char *newBuffer, unsigned int numBytes) { if (numBytes > WRITE_BUFFER_OVERFLOW_SIZE) { #ifdef PANIC *logofs << "WriteBuffer: PANIC! Can't add a message of " << numBytes << " bytes.\n" << logofs_flush; *logofs << "WriteBuffer: PANIC! Assuming error handling " << "data in context [H].\n" << logofs_flush; #endif cerr << "Error" << ": Can't add a message of " << numBytes << " bytes to write buffer.\n"; cerr << "Error" << ": Assuming error handling " << "data in context [H].\n"; HandleAbort(); } else if (scratchBuffer_ != NULL) { #ifdef PANIC *logofs << "WriteBuffer: PANIC! Can't add a foreign " << "message of " << numBytes << " bytes with " << scratchLength_ << " bytes already in " << "scratch buffer.\n" << logofs_flush; *logofs << "WriteBuffer: PANIC! Assuming error handling " << "data in context [I].\n" << logofs_flush; #endif cerr << "Error" << ": Can't add a foreign message of " << numBytes << " bytes with " << scratchLength_ << " bytes already in scratch buffer.\n"; cerr << "Error" << ": Assuming error handling " << "data in context [I].\n"; HandleAbort(); } #ifdef DEBUG *logofs << "WriteBuffer: Adding " << numBytes << " bytes " << "from a foreign message to scratch buffer.\n" << logofs_flush; #endif scratchBuffer_ = newBuffer; scratchLength_ = numBytes; scratchOwner_ = 0; return newBuffer; } void WriteBuffer::removeScratchMessage() { #ifdef TEST if (scratchLength_ == 0 || scratchBuffer_ == NULL) { #ifdef PANIC *logofs << "WriteBuffer: PANIC! Can't remove non existent scratch message.\n" << logofs_flush; #endif cerr << "Error" << ": Can't remove non existent scratch message.\n"; HandleAbort(); } *logofs << "WriteBuffer: Removing " << scratchLength_ << " bytes from scratch buffer.\n" << logofs_flush; #endif if (scratchOwner_ == 1) { #ifdef DEBUG *logofs << "WriteBuffer: Going to delete " << scratchLength_ << " bytes from the " << "scratch buffer.\n" << logofs_flush; #endif delete [] scratchBuffer_; } scratchLength_ = 0; scratchBuffer_ = NULL; scratchOwner_ = 1; } nx-libs-3.5.99.23/nxcomp/src/WriteBuffer.h0000644000000000000000000000723413614532331015005 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef WriteBuffer_H #define WriteBuffer_H #include "Misc.h" #define PANIC #define WARNING #undef TEST #undef DEBUG #define WRITE_BUFFER_DEFAULT_SIZE 16384 // // Adjust for the biggest reply that we could receive. // This is likely to be a reply to a X_ListFonts where // user has a large amount of installed fonts. // #define WRITE_BUFFER_OVERFLOW_SIZE 4194304 class WriteBuffer { public: WriteBuffer(); ~WriteBuffer(); void setSize(unsigned int initialSize, unsigned int thresholdSize, unsigned int maximumSize); unsigned char *addMessage(unsigned int numBytes); unsigned char *removeMessage(unsigned int numBytes); unsigned char *addScratchMessage(unsigned int numBytes); // // This form allows user to provide its own // buffer as write buffer's scratch area. // unsigned char *addScratchMessage(unsigned char *newBuffer, unsigned int numBytes); void removeScratchMessage(); void partialReset(); void fullReset(); unsigned char *getData() const { return buffer_; } unsigned int getLength() const { return length_; } unsigned int getAvailable() const { return (size_ - length_); } unsigned char *getScratchData() const { return scratchBuffer_; } unsigned int getScratchLength() const { return scratchLength_; } unsigned int getTotalLength() const { return (length_ + scratchLength_); } void registerPointer(unsigned char **pointer) { index_ = pointer; } void unregisterPointer() { index_ = 0; } private: unsigned int size_; unsigned int length_; unsigned char *buffer_; unsigned char **index_; unsigned int scratchLength_; unsigned char *scratchBuffer_; int scratchOwner_; unsigned int initialSize_; unsigned int thresholdSize_; unsigned int maximumSize_; }; #endif /* WriteBuffer_H */ nx-libs-3.5.99.23/nxcomp/src/XidCache.cpp0000644000000000000000000000415313614532331014561 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Control.h" #include "XidCache.h" XidCache::XidCache() { for (int i = 0; i < 256; i++) { base_[i] = new IntCache(8); } slot_ = 0; last_ = 0; } XidCache::~XidCache() { for (int i = 0; i < 256; i++) { delete base_[i]; } } nx-libs-3.5.99.23/nxcomp/src/XidCache.h0000644000000000000000000000413313614532331014224 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef XidCache_H #define XidCache_H #include "IntCache.h" class XidCache { friend class EncodeBuffer; friend class DecodeBuffer; public: XidCache(); ~XidCache(); private: IntCache *base_[256]; unsigned int slot_; unsigned int last_; }; #endif /* XidCache_H */ nx-libs-3.5.99.23/nxcomp/src/Z.cpp0000644000000000000000000001033613614532331013322 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Z.h" #include "Misc.h" int ZCompress(z_stream *stream, unsigned char *dest, unsigned int *destLen, const unsigned char *source, unsigned int sourceLen) { // // Deal with the possible overflow. // if (stream -> total_out & 0x80000000) { #ifdef TEST *logofs << "ZCompress: Reset stream counters with " << "total in " << stream -> total_in << " and total out " << stream -> total_out << ".\n" << logofs_flush; #endif stream -> total_in = 0; stream -> total_out = 0; } unsigned int saveOut = stream -> total_out; stream -> next_in = (Bytef *) source; stream -> avail_in = sourceLen; // // Check if the source is bigger than // 64K on 16-bit machine. // #ifdef MAXSEG_64K if ((uLong) stream -> avail_in != sourceLen) return Z_BUF_ERROR; #endif stream -> next_out = dest; stream -> avail_out = *destLen; #ifdef MAXSEG_64K if ((uLong) stream -> avail_out != *destLen) return Z_BUF_ERROR; #endif int result = deflate(stream, Z_FINISH); if (result != Z_STREAM_END) { deflateReset(stream); return (result == Z_OK ? Z_BUF_ERROR : result); } *destLen = stream -> total_out - saveOut; result = deflateReset(stream); return result; } int ZDecompress(z_stream *stream, unsigned char *dest, unsigned int *destLen, const unsigned char *source, unsigned int sourceLen) { stream -> next_in = (Bytef *) source; stream -> avail_in = sourceLen; // // Deal with the possible overflow. // if (stream -> total_out & 0x80000000) { #ifdef TEST *logofs << "ZDecompress: Reset stream counters with " << "total in " << stream -> total_in << " and total out " << stream -> total_out << ".\n" << logofs_flush; #endif stream -> total_in = 0; stream -> total_out = 0; } unsigned int saveOut = stream -> total_out; if (stream -> avail_in != sourceLen) { return Z_BUF_ERROR; } stream -> next_out = dest; stream -> avail_out = *destLen; if (stream -> avail_out != *destLen) { return Z_BUF_ERROR; } int result = inflate(stream, Z_FINISH); if (result != Z_STREAM_END) { inflateReset(stream); return (result == Z_OK ? Z_BUF_ERROR : result); } *destLen = stream -> total_out - saveOut; result = inflateReset(stream); return result; } nx-libs-3.5.99.23/nxcomp/src/Z.h0000644000000000000000000000424413614532331012770 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE.nxcomp which comes in the */ /* source distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Z_H #define Z_H #include int ZCompress(z_stream *stream, unsigned char *dest, unsigned int *destLen, const unsigned char *source, unsigned int sourceLen); int ZDecompress(z_stream *stream, unsigned char *dest, unsigned int *destLen, const unsigned char *source, unsigned int sourceLen); #endif /* Z_H */ nx-libs-3.5.99.23/nxcomp/test/logging_test.cpp0000644000000000000000000001310013614532331015756 0ustar #include #include #include #include #include #include #include #include #include #include #include #include "logging_test.h" Faulty_Logger faulty_logger; NXLog good_logger; void print_sigmask () { sigset_t orig_mask; sigemptyset (&orig_mask); pthread_sigmask (SIG_SETMASK, NULL, &orig_mask); bool empty = true; for (std::size_t i = 0; i < NSIG; ++i) { if (sigismember (&orig_mask, i)) { nxdbg_good << "Signal i (" << i << ") in signal mask." << std::endl; empty = false; } } if (empty) { nxdbg_good << "Signal mask empty."; } } void* log_task (void* /* unused */) { /* print_sigmask (); */ for (std::size_t i = 0; i < 10; ++i) { nxinfo << "Log message " << i << std::endl; } return (NULL); } void sig_handler (int signo) { nxinfo << "Received signal " << signo << std::endl; } void setup_faulty_logger () { faulty_logger.log_level (true); faulty_logger.log_unix_time (false); faulty_logger.log_time (true); faulty_logger.log_location (true); faulty_logger.log_thread_id (true); faulty_logger.level (NXDEBUG); } void setup_good_logger () { good_logger.log_level (true); good_logger.log_unix_time (false); good_logger.log_time (true); good_logger.log_location (true); good_logger.log_thread_id (true); good_logger.level (NXDEBUG); } pthread_t spawn_thread () { pthread_t thread_id; int pthread_ret; sigset_t block_mask, orig_mask; sigemptyset (&orig_mask); sigfillset (&block_mask); pthread_sigmask (SIG_BLOCK, &block_mask, &orig_mask); pthread_ret = pthread_create (&thread_id, NULL, log_task, NULL); pthread_sigmask (SIG_SETMASK, &orig_mask, NULL); return (thread_id); } void install_signal_handler () { struct sigaction sa; sa.sa_handler = sig_handler; sigemptyset (&sa.sa_mask); sa.sa_flags = SA_RESTART; if (-1 == sigaction (SIGUSR1, &sa, NULL)) { nxerr_good << "Unable to install signal handler!" << std::endl; } else { nxdbg_good << "Signal handler registered successfully for SIGUSR1." << std::endl; } } void killing_process_work (pid_t parent_pid) { /* Seed PRNG. */ std::srand (std::time (0)); for (std::size_t i = 0; i < 25; ++i) { /* Sleep for 4 seconds + some random number up to a second. */ std::size_t rand_add = (std::rand () % 1000000); usleep (4000000 + rand_add); /* Send SIGUSR1 to parent process. */ nxdbg_good << "Sending SIGUSR1 (" << SIGUSR1 << ") to parent_pid (" << parent_pid << ")" << std::endl; if (kill (parent_pid, SIGUSR1)) { int saved_errno = errno; nxerr_good << "Failed to deliver signal to parent, aborting." << std::endl; nxerr_good << "Error " << saved_errno << ": " << strerror (saved_errno) << std::endl; exit (EXIT_FAILURE); } } exit (EXIT_SUCCESS); } void killing_process_init (int argc, char **argv) { /* We're in the "killing process". */ pid_t parent_pid = getppid (); setup_good_logger (); for (std::size_t i = 0; i < argc; ++i) { nxdbg_good << "argv[" << i << "]: " << argv[i] << std::endl; } char *end = NULL; errno = 0; long parent_pid_check = std::strtol (argv[1], &end, 0); if ((errno == ERANGE) && (parent_pid_check == LONG_MAX)) { /* Overflow, handle gracefully. */ parent_pid_check = 1; } if ((errno == ERANGE) && (parent_pid_check == LONG_MIN)) { /* Underflow, handle gracefully. */ parent_pid_check = 1; } if (*end) { /* Conversion error (for inputs like "X", end will point to X.) */ parent_pid_check = 1; } if (parent_pid != parent_pid_check) { nxinfo_good << "Parent PID verification via first argument failed, trusting getppid ()." << std::endl; } killing_process_work (parent_pid); } int main (int argc, char **argv) { if (argc > 1) { killing_process_init (argc, argv); } else { /* That's the main process. */ /* First, fork and create the "killing process". */ pid_t pid = fork (); if (0 == pid) { /* Child process. */ pid_t parent_pid = getppid (); /* Prepare to pass-through parent PID. */ std::stringstream ss; ss << parent_pid; std::vector new_argv; new_argv.push_back (std::string (argv[0])); new_argv.push_back (ss.str ()); std::vector new_argv_c_str; for (std::vector::iterator it = new_argv.begin (); it != new_argv.end (); ++it) { const char *elem = (*it).c_str (); new_argv_c_str.push_back (strndup (elem, std::strlen (elem))); } /* Add null pointer as last element. */ new_argv_c_str.push_back (0); /* Relaunch, with argv[1] containing the ppid. */ if (0 != execvp (new_argv_c_str.front (), &(new_argv_c_str.front ()))) { const int saved_errno = errno; std::cerr << "Failed to start \"killing process\"! Panic!" << std::endl; std::cerr << "System error: " << std::strerror (saved_errno) << std::endl; exit (EXIT_FAILURE); } } else if (0 > pid) { const int saved_errno = errno; std::cerr << "Error while forking main process! Panic!" << std::endl; std::cerr << "System error: " << std::strerror (saved_errno) << std::endl; exit (EXIT_FAILURE); } else { /* Main process. */ /* Falls through to general code below. */ } } setup_faulty_logger (); pthread_t thread_id = spawn_thread (); setup_good_logger (); install_signal_handler (); /* print_sigmask (); */ log_task (NULL); pthread_join (thread_id, NULL); exit (EXIT_SUCCESS); } nx-libs-3.5.99.23/nxcomp/test/logging_test.h0000644000000000000000000000674313614532331015442 0ustar #ifndef LOGGING_TEST_H #define LOGGING_TEST_H #include #define INTERNAL_LOGGING_TEST #include "Log.h" class Faulty_Logger : public NXLog { /* Copied from base class, inserted "fault" within critical section. */ using NXLog::flush; void flush(per_thread_data *pdt) { sigset_t orig_signal_mask, tmp_signal_mask; sigemptyset(&orig_signal_mask); sigfillset(&tmp_signal_mask); pthread_sigmask(SIG_BLOCK, &tmp_signal_mask, &orig_signal_mask); if (!pdt->buffer.empty ()) { const std::string str = pdt->buffer.top()->str(); if (!str.empty()) { pthread_mutex_lock(&output_lock_); usleep (3000000); (*stream()) << str; pthread_mutex_unlock(&output_lock_); } pdt->buffer.pop(); } pthread_sigmask(SIG_SETMASK, &orig_signal_mask, NULL); } template friend Faulty_Logger& operator<<(Faulty_Logger& out, const T& value); friend Faulty_Logger& operator<< (Faulty_Logger& out, const NXLogStamp& value); }; template Faulty_Logger& operator<<(Faulty_Logger& out, const T& value) { if ( out.will_log() ) { if ( out.synchronized() ) { // In synchronized mode, we buffer data until a newline, std::flush, or the buffer // gets full. Then we dump the whole thing at once to the output stream, synchronizing // with a mutex. Faulty_Logger::per_thread_data *pdt = out.get_data(); assert (!pdt->buffer.empty ()); usleep (1000000); (*pdt->buffer.top()) << value; if ( ss_length(pdt->buffer.top()) >= out.thread_buffer_size_ || has_newline(value) ) out.flush(); } else { // In async mode we just dump data on the output stream as-is. // Multithreaded code will have ugly output. *(out.stream()) << value; } } return out; } Faulty_Logger& operator<< (Faulty_Logger& out, const NXLogStamp& value) { out.current_level( value.level() ); out.current_file( value.file() ); // Writing an NXLogStamp to the stream indicates the start of a new entry. // If there's any content in the buffer, create a new entry in the output // queue. if ( out.synchronized() ) out.new_stack_entry(); out << out.stamp_to_string(value); return out; } #undef nxdbg #undef nxinfo #undef nxwarn #undef nxerr #undef nxfatal #define nxdbg faulty_logger << nxstamp(NXDEBUG) #define nxinfo faulty_logger << nxstamp(NXINFO) #define nxwarn faulty_logger << nxstamp(NXWARNING) #define nxerr faulty_logger << nxstamp(NXERROR) #define nxfatal faulty_logger << nxstamp(NXFATAL) #define nxdbg_good good_logger << nxstamp(NXDEBUG) #define nxinfo_good good_logger << nxstamp(NXINFO) #define nxwarn_good good_logger << nxstamp(NXWARNING) #define nxerr_good good_logger << nxstamp(NXERROR) #define nxfatal_good good_logger << nxstamp(NXFATAL) /* Helper functions used by all component. */ void print_sigmask (); void setup_faulty_logger (); void setup_good_logger (); /* Functions used by both main and auxiliary threads. */ void* log_task (void* /* unused */); /* Functions used in main thread only. */ pthread_t spawn_thread (); void install_signal_handler (); void sig_handler (int signo); /* Functions used by "killing" process. */ void killing_process_init (int argc, char **argv); void killing_process_work (pid_t parent_pid); #endif /* !defined (LOGGING_TEST_H) */ nx-libs-3.5.99.23/nxcomp/test/Makefile.am0000644000000000000000000000057513614532331014635 0ustar NULL = noinst_PROGRAMS = logging_test EXTRA_DIST = logging_test AM_CPPFLAGS = -I$(top_srcdir)/src AM_CXXFLAGS = \ @PTHREAD_CFLAGS@ \ $(NULL) logging_test_SOURCES = logging_test.cpp logging_test_LDADD = \ $(top_srcdir)/src/.libs/libXcomp.a \ @PTHREAD_LIBS@ \ $(NULL) logging_test_LDFLAGS = \ $(PTHREAD_LDFLAGS) \ $(NULL) check: all ./logging_test nx-libs-3.5.99.23/nxcomp/VERSION0000644000000000000000000000001213614532424012657 0ustar 3.5.99.23 nx-libs-3.5.99.23/nxdialog/bin/Makefile.am0000644000000000000000000000004413614532331014716 0ustar NULL = dist_bin_SCRIPTS = nxdialog nx-libs-3.5.99.23/nxdialog/bin/nxdialog0000755000000000000000000003046213614532331014424 0ustar #!/usr/bin/env python # # ^^^ This is working with python2 and python3 so we choose a shebang # that will find either version. # Citing PEP394: "One exception to this is scripts that are # deliberately written to be source compatible with both Python # 2.x and 3.x. Such scripts may continue to use python on their # shebang line. # Copyright (C) 2008 Google Inc. # Copyright (C) 2019 Ulrich Sibiller # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # This version is based on the nxdialog.py of the long abandoned # Google project "neatx" (https://code.google.com/archive/p/neatx/). # List of changes: # - pulled in the few parts of the neatx python modules that are actually # to make it a standlone script # - added usage output # - dropped logging code, print errors to stderr # - can handle the "yesno" dialog type # - added missing docstrings # - pylint improvements # - removed neatx entry from the pulldoww menu # - use PyGObject instead of PyGtk and thus Gtk3 # - replace optparse by argparse # - make code compatible to python2 and python3. """nxdialog program for handling dialog display.""" # If an "NX_CLIENT" environment variable is not provided to nxagent # nxcomp library assumes this script is located in /usr/NX/bin/nxclient # # Examples: # nxdialog --dialog yesno --message "message text" --caption "message title" --parent 0 # nxdialog --dialog pulldown --message "message text" --caption "message title" --window 0x123456 --parent 0 from __future__ import print_function import argparse import os import signal import sys import gi gi.require_version('Gtk', '3.0') # pylint: disable=wrong-import-position from gi.repository import Gtk, Gdk, GdkX11 PROGRAM = "nxdialog" DISCONNECT = 1 TERMINATE = 2 EXIT_SUCCESS = 0 EXIT_FAILURE = 1 CANCEL_TEXT = "Cancel" DISCONNECT_TEXT = "Disconnect" TERMINATE_TEXT = "Terminate" YES_TEXT = "Yes" NO_TEXT = "No" DLG_TYPE_ERROR = "error" DLG_TYPE_OK = "ok" DLG_TYPE_PANIC = "panic" DLG_TYPE_PULLDOWN = "pulldown" DLG_TYPE_QUIT = "quit" DLG_TYPE_YESNO = "yesno" DLG_TYPE_YESNOSUSPEND = "yesnosuspend" VALID_DLG_TYPES = frozenset([ DLG_TYPE_ERROR, DLG_TYPE_OK, DLG_TYPE_PANIC, DLG_TYPE_PULLDOWN, DLG_TYPE_QUIT, DLG_TYPE_YESNO, DLG_TYPE_YESNOSUSPEND, ]) class PullDownMenu(object): """ Shows a popup menu to disconnect/terminate session. """ def __init__(self, window_id): """ Initializes this class. @type window_id: int @param window_id: X11 window id of target window """ self.window_id = window_id self.result = None def show(self): """ Shows popup and returns result. """ display = Gdk.Display.get_default() win = GdkX11.X11Window.foreign_new_for_display(display, int(self.window_id, 0)) menu = Gtk.Menu() menu.connect("deactivate", self.menu_deactivate) # TODO: Show title item in bold font title = Gtk.MenuItem(label="Session control") title.set_sensitive(False) menu.append(title) disconnect = Gtk.MenuItem(label=DISCONNECT_TEXT) disconnect.connect("activate", self.item_activate, DISCONNECT) menu.append(disconnect) terminate = Gtk.MenuItem(label=TERMINATE_TEXT) terminate.connect("activate", self.item_activate, TERMINATE) menu.append(terminate) menu.append(Gtk.SeparatorMenuItem()) cancel = Gtk.MenuItem(label=CANCEL_TEXT) menu.append(cancel) menu.show_all() menu.popup(parent_menu_shell=None, parent_menu_item=None, func=self.pos_menu, data=win, button=0, activate_time=Gtk.get_current_event_time()) Gtk.main() return self.result def item_activate(self, _, result): """ called when a menu item is selected """ self.result = result Gtk.main_quit() @staticmethod def menu_deactivate(_): """ called when menu is deactivated """ Gtk.main_quit() @staticmethod def pos_menu(menu, _xpos, _ypos, *data): """ Positions menu at the top center of the parent window. """ parent = data[0] # Get parent geometry and origin _, _, win_width, _ = parent.get_geometry() _, win_x, win_y = parent.get_origin() # Calculate width of menu #menu_width = menu.get_preferred_width().natural_width menu_width = menu.get_allocated_width() # Calculate center center_x = int(win_x + ((win_width - menu_width) / 2)) return (center_x, win_y, True) def show_yes_no_suspend_box(title, text): """ Shows a message box to disconnect/terminate session. @type title: str @param title: Message box title @type text: str @param text: Message box text @return: Chosen action """ dlg = Gtk.MessageDialog(type=Gtk.MessageType.QUESTION, flags=Gtk.DialogFlags.MODAL) dlg.set_title(title) dlg.set_markup(text) dlg.add_button(DISCONNECT_TEXT, DISCONNECT) dlg.add_button(TERMINATE_TEXT, TERMINATE) dlg.add_button(CANCEL_TEXT, Gtk.ResponseType.CANCEL) res = dlg.run() if res in (DISCONNECT, TERMINATE): return res # Everything else is cancel return None def show_yes_no_box(title, text): """ Shows a message box with answers yes and no. @type title: str @param title: Message box title @type text: str @param text: Message box text @return: Chosen action """ dlg = Gtk.MessageDialog(type=Gtk.MessageType.QUESTION, flags=Gtk.DialogFlags.MODAL) dlg.set_title(title) dlg.set_markup(text) dlg.add_button(YES_TEXT, TERMINATE) dlg.add_button(NO_TEXT, Gtk.ResponseType.CANCEL) res = dlg.run() if res == TERMINATE: return res # Everything else is cancel return None def handle_session_action(agentpid, action): """ Execute session action chosen by user. @type agentpid: int @param agentpid: Nxagent process id as passed by command line @type action: int or None @param action: Chosen action """ if action == DISCONNECT: print("Disconnecting from session, sending SIGHUP to %s" % (agentpid)) if agentpid != 0: os.kill(agentpid, signal.SIGHUP) elif action == TERMINATE: print("Terminating session, sending SIGTERM to process %s" % (agentpid)) if agentpid != 0: os.kill(agentpid, signal.SIGTERM) elif action is None: pass else: raise NotImplementedError() def show_simple_message_box(icon, title, text): """ Shows a simple message box. @type icon: QMessageBox.Icon @param icon: Icon for message box @type title: str @param title: Message box title @type text: str @param text: Message box text """ dlg = Gtk.MessageDialog(type=icon, flags=Gtk.DialogFlags.MODAL, buttons=Gtk.ButtonsType.OK) dlg.set_title(title) dlg.set_markup(text) dlg.run() class NxDialogProgram(object): """ the main program """ def __init__(self): self.args = None self.options = None def main(self): """ let's do something """ try: self.options = self.parse_args() self.run() except (SystemExit, KeyboardInterrupt): raise except Exception as expt: sys.stderr.write("Caught exception: %s\n" % (expt)) sys.exit(EXIT_FAILURE) @staticmethod def parse_args(): """ init parser """ parser = argparse.ArgumentParser(description="Helper for nxagent to display dialogs") # nxagent 3.5.99.23 only uses yesno, ok, pulldown and yesnosuspend # yesno dialogs will always kill the session if "yes" is selected parser.add_argument("--dialog", dest="dialog_type", help='type of dialog to show, one of "yesno", \ "ok", "error", "panic", "quit", "pulldown", \ "yesnosuspend"') parser.add_argument("--message", dest="text", help="message text to display in the dialog") parser.add_argument("--caption", dest="caption", help="window title of the dialog") parser.add_argument("--display", dest="display", help="X11 display where the dialog should be \ shown") parser.add_argument("--parent", type=int, dest="agentpid", help="pid of the nxagent") parser.add_argument("--window", dest="window", help="id of window where to embed the \ pulldown dialog type") # -class, -local, -allowmultiple are unused in nxlibs 3.5.99.23 parser.add_argument("--class", dest="dlgclass", default="info", help="class of the message (info, warning, error) \ default: info) [currently unimplemented]") parser.add_argument("--local", action="store_true", dest="local", help="specify that proxy mode is used \ [currently unimplemented]") parser.add_argument("--allowmultiple", action="store_true", dest="allowmultiple", help="allow launching more than one dialog with \ the same message [currently unimplemented]") return parser.parse_args() def run(self): """ Disconnect/terminate NX session upon user's request. """ if not self.options.dialog_type: sys.stderr.write("Dialog type not supplied via --dialog\n") sys.exit(EXIT_FAILURE) dlgtype = self.options.dialog_type if dlgtype not in VALID_DLG_TYPES: sys.stderr.write("Invalid dialog type '%s'\n" % (dlgtype)) sys.exit(EXIT_FAILURE) if dlgtype in (DLG_TYPE_PULLDOWN, DLG_TYPE_YESNOSUSPEND, DLG_TYPE_YESNO) and self.options.agentpid is None: sys.stderr.write("Agent pid not supplied via --parent\n") sys.exit(EXIT_FAILURE) if dlgtype == DLG_TYPE_PULLDOWN and not self.options.window: sys.stderr.write("Window id not supplied via --window\n") sys.exit(EXIT_FAILURE) if self.options.caption: message_caption = self.options.caption else: message_caption = sys.argv[0] if self.options.text: message_text = self.options.text else: message_text = "" if self.options.display: os.environ["DISPLAY"] = self.options.display if dlgtype == DLG_TYPE_OK: show_simple_message_box( Gtk.MessageType.INFO, message_caption, message_text) elif dlgtype in (DLG_TYPE_ERROR, DLG_TYPE_PANIC): show_simple_message_box( Gtk.MessageType.ERROR, message_caption, message_text) elif dlgtype == DLG_TYPE_PULLDOWN: handle_session_action(self.options.agentpid, PullDownMenu(self.options.window).show()) elif dlgtype == DLG_TYPE_YESNOSUSPEND: handle_session_action(self.options.agentpid, show_yes_no_suspend_box(message_caption, message_text)) elif dlgtype == DLG_TYPE_YESNO: handle_session_action(self.options.agentpid, show_yes_no_box(message_caption, message_text)) else: # TODO: Implement all dialog types sys.stderr.write("Dialog type '%s' not implemented" % (dlgtype)) sys.exit(EXIT_FAILURE) NxDialogProgram().main() nx-libs-3.5.99.23/nxdialog/configure.ac0000644000000000000000000000116013614532331014400 0ustar dnl *************************************************************************** dnl *** configure.ac for nxdialog *** dnl *************************************************************************** m4_define([nxdialog_version], m4_esyscmd([tr -d '\n' < VERSION])) # Initialize Autoconf AC_PREREQ(2.60) AC_INIT([NX Dialog], [nxdialog_version], [https://github.com/ArcticaProject/nx-libs/issues]) AC_CONFIG_AUX_DIR([build-aux]) AC_PREFIX_DEFAULT([/usr/local]) AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-bzip2]) AC_CONFIG_FILES([ Makefile bin/Makefile man/Makefile ]) AC_OUTPUT nx-libs-3.5.99.23/nxdialog/m4/.keep0000644000000000000000000000000013614532331013347 0ustar nx-libs-3.5.99.23/nxdialog/Makefile.am0000644000000000000000000000075713614532331014161 0ustar NULL = SUBDIRS = bin man ACLOCAL_AMFLAGS = -I m4 MAINTAINERCLEANFILES = \ $(srcdir)/autom4te.cache/* \ $(srcdir)/build-aux/* \ $(srcdir)/Makefile.in \ $(srcdir)/bin/Makefile.in \ $(srcdir)/man/Makefile.in \ $(srcdir)/src/Makefile.in \ $(srcdir)/aclocal.m4 \ $(srcdir)/config.h.in \ $(srcdir)/config.h.in~ \ $(srcdir)/config.guess \ $(srcdir)/config.sub \ $(srcdir)/configure \ $(NULL) DISTCLEANFILES=$(MAINTAINERCLEANFILES) nx-libs-3.5.99.23/nxdialog/man/Makefile.am0000644000000000000000000000010113614532331014713 0ustar NULL = dist_man_MANS = \ nxdialog.1 \ $(NULL) nx-libs-3.5.99.23/nxdialog/man/nxdialog.10000644000000000000000000000433713614532331014565 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH nxdialog 1 "Jan 2020" "Version 3.5.99.23" "NX Dialog" .SH NAME nxdialog \- NX Dialog Helper .SH SYNOPSIS 'nh .fi .ad l \fBnxdialog\fR \fI[-h] [--dialog DIALOG_TYPE] [--message TEXT] [--caption CAPTION] [--display DISPLAY] [--parent AGENTPID] [--window WINDOW] [--class DLGCLASS] [--local] [--allowmultiple]\fR .SH DESCRIPTION \fBnxdialog\fR is a GUI helper that can be used with nxagent to provide user interaction on certain events inside nxagent. It adds graphical widgets (menus, dialog boxes, etc.) to nxagent that allow a smarter user interaction with the agent. .PP \fBnxagent\fR is not using \fBnxdialog\fR by default, set the \fI$NX_CLIENT\fR environment variable to make the \fBnxdialog\fR path known to \fBnxagent\fR. .PP If you want to disable \fBnxdialog\fR usage in \fBnxagent\fR, then make sure that the \fI$NX_CLIENT\fR environment variable is unset. .PP .SH COMMAND LINE OPTIONS .TP 8 .B \-h, \-\-help Show this help message and exit. .TP 8 .B --dialog DIALOG_TYPE Type of dialog to show, one of "yesno", "ok", "error", "panic", "quit", "pulldown", "yesnosuspend". .TP 8 .B --message \fITEXT\fR Message text to display in the dialog. .TP 8 .B --caption CAPTION Window title of the dialog. .TP 8 .B --display DISPLAY X11 display where the dialog should be shown (default: \fI$DISPLAY\fR). .TP 8 .B --parent AGENTPID PID of the nxagent. The agent PID can be 0 for testing \fBnxdialog\fR. .TP 8 .B --window WINDOW X11 id of window where to embed the pulldown dialog type. .TP 8 .B --class DLGCLASS Class of the message (info, warning, error) default: info) [currently unimplemented]. .TP 8 .B --local Specify that proxy mode is used [currently unimplemented]. .TP 8 .B --allowmultiple Allow launching more than one dialog with the same message [currently unimplemented]. .SH AUTHOR The \fBnxdialog\fR application has been derived from Google's NeatX client application by Ulrich Sibiller . .PP This manual has been written by Mike Gabriel for the X2Go Project (https://wiki.x2go.org) and the Arctica Project (https://arctica-project.org). nx-libs-3.5.99.23/nxdialog/README.md0000644000000000000000000000057513614532331013402 0ustar # NX Dialog Helper Tool The ``nxdialog`` script can be executed with Python 2.6.x (or higher) and Python 3.4.x (or higher) alike. ## Runtime Dependencies Required Python modules: * argparse * gi Required GIR namespaces: * Gtk * Gdk * GdkX11 See the man page for more details. ## License The ``nxdialog`` script and related files have been licensed under GPLv2+. nx-libs-3.5.99.23/nxdialog/VERSION0000644000000000000000000000001213614532424013160 0ustar 3.5.99.23 nx-libs-3.5.99.23/nxproxy/configure.ac0000644000000000000000000000213113614532331014321 0ustar dnl *************************************************************************** dnl *** configure.ac for nxproxy *** dnl *************************************************************************** m4_define([nxproxy_version], m4_esyscmd([tr -d '\n' < VERSION])) # Initialize Autoconf AC_PREREQ(2.60) AC_INIT([NX Proxy], [nxproxy_version], [https://github.com/ArcticaProject/nx-libs/issues]) AC_CONFIG_AUX_DIR([build-aux]) AC_PROG_CC AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-bzip2]) # Initialize libtool AC_PROG_LIBTOOL # enable this to add the variable to the Makefiles #AC_ARG_VAR(NX_VERSION_CUSTOM, [custom version string]) if test "x$NX_VERSION_CUSTOM" != x; then AC_DEFINE_UNQUOTED([NX_VERSION_CUSTOM], ["${NX_VERSION_CUSTOM}"], [user provided custom version string]) fi PROXY_VERSION=nxproxy_version AC_SUBST([PROXY_VERSION]) AC_LANG([C]) NX_COMPILER_BRAND NX_DEFAULT_OPTIONS NX_TARGET_USE_ELF AC_CONFIG_FILES([ Makefile man/Makefile src/Makefile ]) AC_OUTPUT nx-libs-3.5.99.23/nxproxy/m4/ax_cxx_compile_stdcxx_11.m40000644000000000000000000000321513614532424017524 0ustar # ============================================================================= # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html # ============================================================================= # # SYNOPSIS # # AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional]) # # DESCRIPTION # # Check for baseline language coverage in the compiler for the C++11 # standard; if necessary, add switches to CXX and CXXCPP to enable # support. # # This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX # macro with the version set to C++11. The two optional arguments are # forwarded literally as the second and third argument respectively. # Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for # more information. If you want to use this macro, you also need to # download the ax_cxx_compile_stdcxx.m4 file. # # LICENSE # # Copyright (c) 2008 Benjamin Kosnik # Copyright (c) 2012 Zack Weinberg # Copyright (c) 2013 Roy Stogner # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov # Copyright (c) 2015 Paul Norman # Copyright (c) 2015 Moritz Klammler # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 18 AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) nx-libs-3.5.99.23/nxproxy/m4/ax_cxx_compile_stdcxx.m40000644000000000000000000004564713614532424017242 0ustar # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html # =========================================================================== # # SYNOPSIS # # AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) # # DESCRIPTION # # Check for baseline language coverage in the compiler for the specified # version of the C++ standard. If necessary, add switches to CXX and # CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) # or '14' (for the C++14 standard). # # The second argument, if specified, indicates whether you insist on an # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. # -std=c++11). If neither is specified, you get whatever works, with # preference for an extended mode. # # The third argument, if specified 'mandatory' or if left unspecified, # indicates that baseline support for the specified C++ standard is # required and that the macro should error out if no mode with that # support is found. If specified 'optional', then configuration proceeds # regardless, after defining HAVE_CXX${VERSION} if and only if a # supporting mode is found. # # LICENSE # # Copyright (c) 2008 Benjamin Kosnik # Copyright (c) 2012 Zack Weinberg # Copyright (c) 2013 Roy Stogner # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov # Copyright (c) 2015 Paul Norman # Copyright (c) 2015 Moritz Klammler # Copyright (c) 2016, 2018 Krzesimir Nowak # Copyright (c) 2019 Enji Cooper # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 11 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl (serial version number 13). AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], [$1], [14], [ax_cxx_compile_alternatives="14 1y"], [$1], [17], [ax_cxx_compile_alternatives="17 1z"], [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$2], [], [], [$2], [ext], [], [$2], [noext], [], [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], [$3], [optional], [ax_cxx_compile_cxx$1_required=false], [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) AC_LANG_PUSH([C++])dnl ac_success=no m4_if([$2], [noext], [], [dnl if test x$ac_success = xno; then for alternative in ${ax_cxx_compile_alternatives}; do switch="-std=gnu++${alternative}" cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" CXX="$CXX $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], [eval $cachevar=yes], [eval $cachevar=no]) CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done fi]) m4_if([$2], [ext], [], [dnl if test x$ac_success = xno; then dnl HP's aCC needs +std=c++11 according to: dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf dnl Cray's crayCC needs "-h std=c++11" for alternative in ${ax_cxx_compile_alternatives}; do for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" CXX="$CXX $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], [eval $cachevar=yes], [eval $cachevar=no]) CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done if test x$ac_success = xyes; then break fi done fi]) AC_LANG_POP([C++]) if test x$ax_cxx_compile_cxx$1_required = xtrue; then if test x$ac_success = xno; then AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) fi fi if test x$ac_success = xno; then HAVE_CXX$1=0 AC_MSG_NOTICE([No compiler with C++$1 support was found]) else HAVE_CXX$1=1 AC_DEFINE(HAVE_CXX$1,1, [define if the compiler supports basic C++$1 syntax]) fi AC_SUBST(HAVE_CXX$1) ]) dnl Test body for checking C++11 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 ) dnl Test body for checking C++14 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 ) m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 ) dnl Tests for new features in C++11 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ // If the compiler admits that it is not ready for C++11, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201103L #error "This is not a C++11 compiler" #else namespace cxx11 { namespace test_static_assert { template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; } namespace test_final_override { struct Base { virtual ~Base() {} virtual void f() {} }; struct Derived : public Base { virtual ~Derived() override {} virtual void f() override {} }; } namespace test_double_right_angle_brackets { template < typename T > struct check {}; typedef check single_type; typedef check> double_type; typedef check>> triple_type; typedef check>>> quadruple_type; } namespace test_decltype { int f() { int a = 1; decltype(a) b = 2; return a + b; } } namespace test_type_deduction { template < typename T1, typename T2 > struct is_same { static const bool value = false; }; template < typename T > struct is_same { static const bool value = true; }; template < typename T1, typename T2 > auto add(T1 a1, T2 a2) -> decltype(a1 + a2) { return a1 + a2; } int test(const int c, volatile int v) { static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == false, ""); auto ac = c; auto av = v; auto sumi = ac + av + 'x'; auto sumf = ac + av + 1.0; static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == true, ""); return (sumf > 0.0) ? sumi : add(c, v); } } namespace test_noexcept { int f() { return 0; } int g() noexcept { return 0; } static_assert(noexcept(f()) == false, ""); static_assert(noexcept(g()) == true, ""); } namespace test_constexpr { template < typename CharT > unsigned long constexpr strlen_c_r(const CharT *const s, const unsigned long acc) noexcept { return *s ? strlen_c_r(s + 1, acc + 1) : acc; } template < typename CharT > unsigned long constexpr strlen_c(const CharT *const s) noexcept { return strlen_c_r(s, 0UL); } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("1") == 1UL, ""); static_assert(strlen_c("example") == 7UL, ""); static_assert(strlen_c("another\0example") == 7UL, ""); } namespace test_rvalue_references { template < int N > struct answer { static constexpr int value = N; }; answer<1> f(int&) { return answer<1>(); } answer<2> f(const int&) { return answer<2>(); } answer<3> f(int&&) { return answer<3>(); } void test() { int i = 0; const int c = 0; static_assert(decltype(f(i))::value == 1, ""); static_assert(decltype(f(c))::value == 2, ""); static_assert(decltype(f(0))::value == 3, ""); } } namespace test_uniform_initialization { struct test { static const int zero {}; static const int one {1}; }; static_assert(test::zero == 0, ""); static_assert(test::one == 1, ""); } namespace test_lambdas { void test1() { auto lambda1 = [](){}; auto lambda2 = lambda1; lambda1(); lambda2(); } int test2() { auto a = [](int i, int j){ return i + j; }(1, 2); auto b = []() -> int { return '0'; }(); auto c = [=](){ return a + b; }(); auto d = [&](){ return c; }(); auto e = [a, &b](int x) mutable { const auto identity = [](int y){ return y; }; for (auto i = 0; i < a; ++i) a += b--; return x + identity(a + b); }(0); return a + b + c + d + e; } int test3() { const auto nullary = [](){ return 0; }; const auto unary = [](int x){ return x; }; using nullary_t = decltype(nullary); using unary_t = decltype(unary); const auto higher1st = [](nullary_t f){ return f(); }; const auto higher2nd = [unary](nullary_t f1){ return [unary, f1](unary_t f2){ return f2(unary(f1())); }; }; return higher1st(nullary) + higher2nd(nullary)(unary); } } namespace test_variadic_templates { template struct sum; template struct sum { static constexpr auto value = N0 + sum::value; }; template <> struct sum<> { static constexpr auto value = 0; }; static_assert(sum<>::value == 0, ""); static_assert(sum<1>::value == 1, ""); static_assert(sum<23>::value == 23, ""); static_assert(sum<1, 2>::value == 3, ""); static_assert(sum<5, 5, 11>::value == 21, ""); static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); } // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function // because of this. namespace test_template_alias_sfinae { struct foo {}; template using member = typename T::member_type; template void func(...) {} template void func(member*) {} void test(); void test() { func(0); } } } // namespace cxx11 #endif // __cplusplus >= 201103L ]]) dnl Tests for new features in C++14 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ // If the compiler admits that it is not ready for C++14, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201402L #error "This is not a C++14 compiler" #else namespace cxx14 { namespace test_polymorphic_lambdas { int test() { const auto lambda = [](auto&&... args){ const auto istiny = [](auto x){ return (sizeof(x) == 1UL) ? 1 : 0; }; const int aretiny[] = { istiny(args)... }; return aretiny[0]; }; return lambda(1, 1L, 1.0f, '1'); } } namespace test_binary_literals { constexpr auto ivii = 0b0000000000101010; static_assert(ivii == 42, "wrong value"); } namespace test_generalized_constexpr { template < typename CharT > constexpr unsigned long strlen_c(const CharT *const s) noexcept { auto length = 0UL; for (auto p = s; *p; ++p) ++length; return length; } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("x") == 1UL, ""); static_assert(strlen_c("test") == 4UL, ""); static_assert(strlen_c("another\0test") == 7UL, ""); } namespace test_lambda_init_capture { int test() { auto x = 0; const auto lambda1 = [a = x](int b){ return a + b; }; const auto lambda2 = [a = lambda1(x)](){ return a; }; return lambda2(); } } namespace test_digit_separators { constexpr auto ten_million = 100'000'000; static_assert(ten_million == 100000000, ""); } namespace test_return_type_deduction { auto f(int& x) { return x; } decltype(auto) g(int& x) { return x; } template < typename T1, typename T2 > struct is_same { static constexpr auto value = false; }; template < typename T > struct is_same { static constexpr auto value = true; }; int test() { auto x = 0; static_assert(is_same::value, ""); static_assert(is_same::value, ""); return x; } } } // namespace cxx14 #endif // __cplusplus >= 201402L ]]) dnl Tests for new features in C++17 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ // If the compiler admits that it is not ready for C++17, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201703L #error "This is not a C++17 compiler" #else #include #include #include namespace cxx17 { namespace test_constexpr_lambdas { constexpr int foo = [](){return 42;}(); } namespace test::nested_namespace::definitions { } namespace test_fold_expression { template int multiply(Args... args) { return (args * ... * 1); } template bool all(Args... args) { return (args && ...); } } namespace test_extended_static_assert { static_assert (true); } namespace test_auto_brace_init_list { auto foo = {5}; auto bar {5}; static_assert(std::is_same, decltype(foo)>::value); static_assert(std::is_same::value); } namespace test_typename_in_template_template_parameter { template typename X> struct D; } namespace test_fallthrough_nodiscard_maybe_unused_attributes { int f1() { return 42; } [[nodiscard]] int f2() { [[maybe_unused]] auto unused = f1(); switch (f1()) { case 17: f1(); [[fallthrough]]; case 42: f1(); } return f1(); } } namespace test_extended_aggregate_initialization { struct base1 { int b1, b2 = 42; }; struct base2 { base2() { b3 = 42; } int b3; }; struct derived : base1, base2 { int d; }; derived d1 {{1, 2}, {}, 4}; // full initialization derived d2 {{}, {}, 4}; // value-initialized bases } namespace test_general_range_based_for_loop { struct iter { int i; int& operator* () { return i; } const int& operator* () const { return i; } iter& operator++() { ++i; return *this; } }; struct sentinel { int i; }; bool operator== (const iter& i, const sentinel& s) { return i.i == s.i; } bool operator!= (const iter& i, const sentinel& s) { return !(i == s); } struct range { iter begin() const { return {0}; } sentinel end() const { return {5}; } }; void f() { range r {}; for (auto i : r) { [[maybe_unused]] auto v = i; } } } namespace test_lambda_capture_asterisk_this_by_value { struct t { int i; int foo() { return [*this]() { return i; }(); } }; } namespace test_enum_class_construction { enum class byte : unsigned char {}; byte foo {42}; } namespace test_constexpr_if { template int f () { if constexpr(cond) { return 13; } else { return 42; } } } namespace test_selection_statement_with_initializer { int f() { return 13; } int f2() { if (auto i = f(); i > 0) { return 3; } switch (auto i = f(); i + 4) { case 17: return 2; default: return 1; } } } namespace test_template_argument_deduction_for_class_templates { template struct pair { pair (T1 p1, T2 p2) : m1 {p1}, m2 {p2} {} T1 m1; T2 m2; }; void f() { [[maybe_unused]] auto p = pair{13, 42u}; } } namespace test_non_type_auto_template_parameters { template struct B {}; B<5> b1; B<'a'> b2; } namespace test_structured_bindings { int arr[2] = { 1, 2 }; std::pair pr = { 1, 2 }; auto f1() -> int(&)[2] { return arr; } auto f2() -> std::pair& { return pr; } struct S { int x1 : 2; volatile double y1; }; S f3() { return {}; } auto [ x1, y1 ] = f1(); auto& [ xr1, yr1 ] = f1(); auto [ x2, y2 ] = f2(); auto& [ xr2, yr2 ] = f2(); const auto [ x3, y3 ] = f3(); } namespace test_exception_spec_type_system { struct Good {}; struct Bad {}; void g1() noexcept; void g2(); template Bad f(T*, T*); template Good f(T1*, T2*); static_assert (std::is_same_v); } namespace test_inline_variables { template void f(T) {} template inline T g(T) { return T{}; } template<> inline void f<>(int) {} template<> int g<>(int) { return 5; } } } // namespace cxx17 #endif // __cplusplus < 201703L ]]) nx-libs-3.5.99.23/nxproxy/m4/nx-macros.m40000644000000000000000000004165413614532424014544 0ustar dnl nx-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. dnl dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. dnl Copyright (c) 2017, Mike Gabriel dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the "Software"), dnl to deal in the Software without restriction, including without limitation dnl the rights to use, copy, modify, merge, publish, distribute, sublicense, dnl and/or sell copies of the Software, and to permit persons to whom the dnl Software is furnished to do so, subject to the following conditions: dnl dnl The above copyright notice and this permission notice (including the next dnl paragraph) shall be included in all copies or substantial portions of the dnl Software. dnl dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER dnl DEALINGS IN THE SOFTWARE. # NX_COMPILER_BRAND # ------------------- # Checks for various brands of compilers and sets flags as appropriate: # GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes" # GNU g++ - relies on AC_PROG_CXX to set GXX to "yes" # clang compiler - sets CLANGCC to "yes" # Intel compiler - sets INTELCC to "yes" # Sun/Oracle Solaris Studio cc - sets SUNCC to "yes" # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_COMPILER_BRAND], [ AC_LANG_CASE( [C], [ AC_REQUIRE([AC_PROG_CC_C99]) ], [C++], [ AC_REQUIRE([AC_PROG_CXX]) ] ) AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"]) AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) ]) # NX_COMPILER_BRAND # NX_TESTSET_CFLAG(, , [, ...]) # --------------- # Test if the compiler works when passed the given flag as a command line argument. # If it succeeds, the flag is appended to the given variable. If not, it tries the # next flag in the list until there are no more options. # # Note that this does not guarantee that the compiler supports the flag as some # compilers will simply ignore arguments that they do not understand, but we do # attempt to weed out false positives by using -Werror=unknown-warning-option and # -Werror=unused-command-line-argument # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_TESTSET_CFLAG], [ m4_if([$#], 0, [m4_fatal([NX_TESTSET_CFLAG was given with an unsupported number of arguments])]) m4_if([$#], 1, [m4_fatal([NX_TESTSET_CFLAG was given with an unsupported number of arguments])]) AC_LANG_COMPILER_REQUIRE AC_LANG_CASE( [C], [ AC_REQUIRE([AC_PROG_CC_C99]) define([PREFIX], [C]) define([CACHE_PREFIX], [cc]) define([COMPILER], [$CC]) ], [C++], [ define([PREFIX], [CXX]) define([CACHE_PREFIX], [cxx]) define([COMPILER], [$CXX]) ] ) [nx_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]" if test "x$[nx_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option], AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no])) [nx_testset_]CACHE_PREFIX[_unknown_warning_option]=$[nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option] PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" fi if test "x$[nx_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then if test "x$[nx_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" fi PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument], AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no])) [nx_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument] PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" fi found="no" m4_foreach([flag], m4_cdr($@), [ if test $found = "no" ; then if test "x$nx_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" fi if test "x$nx_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" fi PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag[" dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[]) cacheid=AS_TR_SH([nx_cv_]CACHE_PREFIX[_flag_]flag[]) AC_CACHE_VAL($cacheid, [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])], [eval $cacheid=yes], [eval $cacheid=no])]) PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" eval supported=\$$cacheid AC_MSG_RESULT([$supported]) if test "$supported" = "yes" ; then $1="$$1 ]flag[" found="yes" fi fi ]) ]) # NX_TESTSET_CFLAG # NX_COMPILER_FLAGS # --------------- # Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line # arguments supported by the selected compiler which do NOT alter the generated # code. These arguments will cause the compiler to print various warnings # during compilation AND turn a conservative set of warnings into errors. # # The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in # future versions of util-macros as options are added to new compilers. # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_COMPILER_FLAGS], [ AC_REQUIRE([NX_COMPILER_BRAND]) AC_ARG_ENABLE(selective-werror, AS_HELP_STRING([--disable-selective-werror], [Turn off selective compiler errors. (default: enabled)]), [SELECTIVE_WERROR=$enableval], [SELECTIVE_WERROR=yes]) AC_LANG_CASE( [C], [ define([PREFIX], [C]) ], [C++], [ define([PREFIX], [CXX]) ] ) # -v is too short to test reliably with NX_TESTSET_CFLAG if test "x$SUNCC" = "xyes"; then [BASE_]PREFIX[FLAGS]="-v" else [BASE_]PREFIX[FLAGS]="" fi # This chunk of warnings were those that existed in the legacy CWARNFLAGS NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat]) AC_LANG_CASE( [C], [ NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement]) ] ) # This chunk adds additional warnings that could catch undesired effects. NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) # These are currently disabled because they are noisy. They will be enabled # in the future once the codebase is sufficiently modernized to silence # them. For now, I don't want them to drown out the other warnings. # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) # Turn some warnings into errors, so we don't accidentally get successful builds # when there are problems that should be fixed. if test "x$SELECTIVE_WERROR" = "xyes" ; then NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION else AC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors. This should not be necessary. Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast]) fi AC_SUBST([BASE_]PREFIX[FLAGS]) ]) # NX_COMPILER_FLAGS # NX_STRICT_OPTION # ----------------------- # # Add configure option to enable strict compilation flags, such as treating # warnings as fatal errors. # If --enable-strict-compilation is passed to configure, adds strict flags to # $BASE_CFLAGS or $BASE_CXXFLAGS. # # Also exports $STRICT_CFLAGS for use in other tests or when strict compilation # is unconditionally desired. AC_DEFUN([NX_STRICT_OPTION], [ AC_REQUIRE([NX_COMPILER_FLAGS]) AC_ARG_ENABLE(strict-compilation, AS_HELP_STRING([--enable-strict-compilation], [Enable all warnings from compiler and make them errors (default: disabled)]), [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) AC_LANG_CASE( [C], [ define([PREFIX], [C]) ], [C++], [ define([PREFIX], [CXX]) ] ) [STRICT_]PREFIX[FLAGS]="" NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic]) NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn]) # Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not # activate it with -Werror, so we add it here explicitly. NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes]) if test "x$STRICT_COMPILE" = "xyes"; then [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]" fi AC_SUBST([STRICT_]PREFIX[FLAGS]) AC_SUBST([BASE_]PREFIX[FLAGS]) ]) # NX_STRICT_OPTION # NX_DEFAULT_OPTIONS # -------------------- # # Defines default options for X.Org-like modules. # AC_DEFUN([NX_DEFAULT_OPTIONS], [ AC_REQUIRE([AC_PROG_INSTALL]) NX_COMPILER_FLAGS NX_STRICT_OPTION m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) ]) # NX_DEFAULT_OPTIONS # NX_CHECK_MALLOC_ZERO # ---------------------- # Minimum version: 1.0.0 # # Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if # malloc(0) returns NULL. Packages should add one of these cflags to # their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. AC_DEFUN([NX_CHECK_MALLOC_ZERO],[ AC_ARG_ENABLE(malloc0returnsnull, AS_HELP_STRING([--enable-malloc0returnsnull], [malloc(0) returns NULL (default: auto)]), [MALLOC_ZERO_RETURNS_NULL=$enableval], [MALLOC_ZERO_RETURNS_NULL=auto]) AC_MSG_CHECKING([whether malloc(0) returns NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then AC_RUN_IFELSE([AC_LANG_PROGRAM([ #include ],[ char *m0, *r0, *c0, *p; m0 = malloc(0); p = malloc(10); r0 = realloc(p,0); c0 = calloc(0,10); exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); ])], [MALLOC_ZERO_RETURNS_NULL=yes], [MALLOC_ZERO_RETURNS_NULL=no], [MALLOC_ZERO_RETURNS_NULL=yes]) fi AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL" XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC" else MALLOC_ZERO_CFLAGS="" XMALLOC_ZERO_CFLAGS="" XTMALLOC_ZERO_CFLAGS="" fi AC_SUBST([MALLOC_ZERO_CFLAGS]) AC_SUBST([XMALLOC_ZERO_CFLAGS]) AC_SUBST([XTMALLOC_ZERO_CFLAGS]) ]) # NX_CHECK_MALLOC_ZERO dnl Check to see if we're running under Cygwin32. AC_DEFUN([NX_BUILD_ON_CYGWIN32], [AC_CACHE_CHECK([for Cygwin32 environment], nxconf_cv_cygwin32, [AC_TRY_COMPILE(,[return __CYGWIN32__;], nxconf_cv_cygwin32=yes, nxconf_cv_cygwin32=no) rm -f conftest*]) CYGWIN32= test "$nxconf_cv_cygwin32" = yes && CYGWIN32=yes ]) # NX_BUILD_ON_CYGWIN32 dnl Check whether we're building on a AMD64. AC_DEFUN([NX_BUILD_ON_AMD64], [AC_CACHE_CHECK([for Amd64 environment], nxconf_cv_amd64, [AC_TRY_COMPILE(,[return (__amd64__ || __x86_64__);], nxconf_cv_amd64=yes, nxconf_cv_amd64=no) rm -f conftest*]) AMD64= test "$nxconf_cv_amd64" = yes && AMD64=yes ]) # NX_BUILD_ON_AMD64 dnl Check for Darwin environment. AC_DEFUN([NX_BUILD_ON_DARWIN], [AC_CACHE_CHECK([for Darwin environment], nxconf_cv_darwin, [AC_TRY_COMPILE(,[return __APPLE__;], nxconf_cv_darwin=yes, nxconf_cv_darwin=no) rm -f conftest*]) DARWIN= test "$nxconf_cv_darwin" = yes && DARWIN=yes ]) # NX_BUILD_ON_DARWIN # Check to see if we're running under Solaris. AC_DEFUN([NX_BUILD_ON_SUN], [AC_CACHE_CHECK([for Solaris environment], nxconf_cv_sun, [AC_TRY_COMPILE(,[return __sun;], nxconf_cv_sun=yes, nxconf_cv_sun=no) rm -f conftest*]) SUN= test "$nxconf_cv_sun" = yes && SUN=yes ]) # NX_BUILD_ON_SUN # Check to see if we're running under FreeBSD. AC_DEFUN([NX_BUILD_ON_FreeBSD], [AC_CACHE_CHECK([for FreeBSD environment], nxconf_cv_freebsd, [AC_TRY_COMPILE(,[return __FreeBSD__;], nxconf_cv_freebsd=yes, nxconf_cv_freebsd=no) rm -f conftest*]) FreeBSD= test "$nxconf_cv_freebsd" = yes && FreeBSD=yes ]) # NX_BUILD_ON_FreeBSD # Check to see if we're generating binaries in ELF format. AC_DEFUN([NX_TARGET_USE_ELF], [AC_CACHE_CHECK([if target system is ELF-based], [nxconf_cv_targetelf], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[ #ifndef __ELF__ #error not an ELF-based system error! #endif ]], [[ ]])], [nxconf_cv_targetelf=yes], [nxconf_cv_targetelf=no])]) AM_CONDITIONAL([TARGET_ELF], [test x"$nxconf_cv_targetelf" = "xyes"]) ]) # NX_TARGET_USE_ELF AC_DEFUN([LIBJPEG_FALLBACK_CHECK],[ AC_MSG_CHECKING([for libjpeg shared library file and headers]) AC_CHECK_LIB([jpeg], [jpeg_destroy_compress], [have_jpeg_lib=yes], [have_jpeg_lib=no]) AC_CHECK_HEADERS([jpeglib.h], [have_jpeg_headers=yes], [have_jpeg_headers=no]) if test x"$have_jpeg_lib" = "xyes" && test x"$have_jpeg_headers" = "xyes"; then AC_MSG_RESULT([yes]) JPEG_CFLAGS="" JPEG_LIBS="-ljpeg" else AC_MSG_RESULT([no]) AC_MSG_FAILURE([Could not find libjpeg on your system, make sure the JPEG shared library and header files are installed.]) fi ]) # LIBJPEG_FALLBACK_CHECK AC_DEFUN([ZLIB_FALLBACK_CHECK],[ AC_MSG_CHECKING([for zlib shared library file and headers]) AC_CHECK_LIB([z], [inflateEnd], [have_zlib_lib=yes], [have_zlib_lib=no]) AC_CHECK_HEADERS([zlib.h], [have_zlib_headers=yes], [have_zlib_headers=no]) if test x"$have_zlib_lib" = "xyes" && test x"$have_zlib_headers" = "xyes"; then AC_MSG_RESULT([yes]) Z_CFLAGS="" Z_LIBS="-lz" else AC_MSG_RESULT([no]) AC_MSG_FAILURE([Could not find zlib on your system, make sure the zlib shared library and header files are installed.]) fi ]) # ZLIB_FALLBACK_CHECK nx-libs-3.5.99.23/nxproxy/Makefile.am0000644000000000000000000000070613614532331014075 0ustar SUBDIRS = src man ACLOCAL_AMFLAGS = -I m4 MAINTAINERCLEANFILES = \ $(srcdir)/autom4te.cache/* \ $(srcdir)/build-aux/* \ $(srcdir)/Makefile.in \ $(srcdir)/man/Makefile.in \ $(srcdir)/src/Makefile.in \ $(srcdir)/aclocal.m4 \ $(srcdir)/config.h.in \ $(srcdir)/config.h.in~ \ $(srcdir)/config.guess \ $(srcdir)/config.sub \ $(srcdir)/configure \ $(NULL) DISTCLEANFILES=$(MAINTAINERCLEANFILES) nx-libs-3.5.99.23/nxproxy/man/Makefile.am0000644000000000000000000000010013614532331014634 0ustar NULL = dist_man_MANS = \ nxproxy.1 \ $(NULL) nx-libs-3.5.99.23/nxproxy/man/nxproxy.10000644000000000000000000002714613614532331014434 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH nxproxy 1 "Jan 2020" "Version 3.5.99.23" "NX Proxy" .SH NAME nxproxy \- NX Proxy Tool .SH SYNOPSIS 'nh .fi .ad l \fBnxproxy\fR \fI[] :\fR .SH DESCRIPTION \fBnxproxy\fR is a tool that allows one to tunnel X sessions through the NX compression library. \fBnxproxy\fR is a backend application utilized by various client application (Remmina, X2Go Client, PyHoca-Gui, Arctica Client, TheQVD Client, etc.). .PP .SH COMMAND LINE OPTIONS .TP 8 .B -C Specify that nxproxy has to run on the 'X client' side, listening for connections and impersonating an X server. .TP 8 .B -S Specify that nxproxy has to run in 'X server' mode, thus forwarding the connections to daemons running on the client. .TP 8 .B -h Print this message. .TP 8 .B -v Print version information. .TP 8 .B -d Set log level (0 for FATAL, 1 for ERROR, 2 for WARNING, 3 for INFO, 4 for DEBUG). The default is 0. .TP 8 .B -o Name of the log file. Default is stderr. .TP 8 .B -f Specify log format. The characters in define how the loglines are formatted. The following characters are supported, default is '0': .RS 8 .TP 8 .I 0 only the plain text without any additions. This is the default. .TP 8 .I u include time .TP 8 .I l include loglevel .TP 8 .I T include thread ids .TP 8 .I L include the location of the log call in the source code .RE .TP 8 .B : Put at the end, specifies the host and port of the listening proxy. .SH NX/NX DISPLAY OPTIONS Multiple nx/nx options can be specified in the DISPLAY environment or on the command line, by using the nx/nx,option=value notation. .TP 8 .B link= An indication of the link speed that is going to be used between the proxies. Usually the compression and the other link parameters depend on this setting. The value can be either 'modem', 'isdn', 'adsl', 'wan', 'lan', 'local' or a bandwidth specification, like for example '56k', '1m', '100m', etc. .TP 8 .B type= Type of session, for example 'windows', 'unix-kde'. 'unix-application', etc. .TP 8 .B display= Specify the real display where X connections have to be forwarded by the proxy running on the client. .TP 8 .B listen= Local port used for accepting the proxy connection. .TP 8 .B loopback= Bind to the loopback device only. .TP 8 .B accept= Name or IP of host that can connect to the proxy. .TP 8 .B connect= Name or IP of host that the proxy will connect to. .TP 8 .B port= Remote port used for the connection. .TP 8 .B retry= Number of connection atempts. .TP 8 .B root= The root directory for the session. Usually is the C\-* or S\-* in the .nx directory in the user's home, with '*' being the virtual display. .TP 8 .B session= Name of the session file. The default is the name 'session' in the session directory. .TP 8 .B errors= Name of the log file used by the proxy. The default is the name 'errors' in the session directory. .TP 8 .B stats= Name of the file where are written the proxy statistics. The default is a file 'stats' in the session directory. The proxy replaces the data in the file whenever it receives a SIGUSR1 or SIGUSR2 signal: .I SIGUSR1: Gives total statistics, i.e. statistics collected since the beginning of the session. .I SIGUSR2: Gives partial statistics, i.e. statistics collected since the last time this signal was received. .TP 8 .B cookie= Use the provided cookie for authenticating to the remote proxy. The same cookie is used as the fake value used for the X authorization. The fake cookie is replaced on the X server side with the real cookie to be used for the display, so that the real cookie doesn't have to travel over the net. When not using a proxy cookie, any host will be able to connect to the proxy. See also the 'accept' parameter. .TP 8 .B nodelay= A boolean indicating if TCP_NODELAY has to be set on the proxy link. Old Linux kernels had problems with handling TCP_NODELAY on PPP links. .TP 8 .B policy= Let or not the agent decide when it is the best time to flush the proxy link. If set to 0, the proxy will flush any encoded data immediately. The option has only effect on the X client side proxy. .TP 8 .B render= Enable or disable use of the RENDER extension. .TP 8 .B taint= Try to suppress trivial sources of X roundtrips by generating the reply on the X client side. .TP 8 .B delta= Enable X differential compression. .TP 8 .B data= Enable or disable the ZLIB data compression. It is possible to specify a value between 0 and 9. Usually the value is chosen automatically based on the requested link setting. .TP 8 .B stream= Enable or disable the ZLIB stream compression. The value, between 0 and 9, is usually determined according to the requested link setting. Not fully implemented in nx-X11 Agent, yet. .TP 8 .B limit= Specify a bitrate limit allowed for this session. .TP 8 .B memory= Trigger memory optimizations used to keep small the size of X buffers. This is useful on embedded plat- forms, or where memory is scarce. .TP 8 .B cache= Size of the in-memory X message cache. Setting the value to 0 will disable the memory cache as well as the NX differential compression. .TP 8 .B images= Size of the persistent image cache. .TP 8 .B shseg= Enable the use of the MIT-SHM extension between the \fBnxproxy\fR and the real X server. A value greater than 1 is assumed to be the size of requested shared memory segment. By default, the size of the segment is determined based on the size of the in-memory cache. .TP 8 .B load= Enable loading a persistent X message cache at the proxy startup. .TP 8 .B save= Enable saving a persistent X message cache at the end of session. .TP 8 .B cups= Enable or disable forwarding of CUPS connections, by listening on the optional port 'n'. .TP 8 .B aux= Enable or disable forwarding of the auxiliary X channel used for controlling the keyboard. The 'keybd=' form is accepted for backward compatibility. .TP 8 .B smb= Enable or disable forwarding of SMB connections. The 'samba=' form is accepted for backward compatibility. .TP 8 .B media= Enable forwarding of audio connections. .TP 8 .B http= Enable forwarding of HTTP connections. .TP 8 .B font= Enable forwarding of reversed connections to a font server running on the NX server. .TP 8 .B file= Enable forwarding of file transfer connections. .TP 8 .B mask= Determine the distribution of channel ids between the proxies. By default, channels whose ids are multiple of 8 (starting from 0) are reserved for the NX client side. All the other channels can be allocated by the nx-X11 Agent side. .TP 8 .B timeout=t Specify the keep-alive timeout used by proxies to determine if there is a network problem preventing communication with the remote peer. A value of 0 disables the check. .TP 8 .B cleanup=t Specify the number of seconds the proxy has to wait at session shutdown before closing all channels. The feature is used by the NX server to ensure that services are disconnected before shutting down the link. .TP 8 .B pack= Determine the method used to compress images. .TP 8 .B product= The product id of the client or server. The value is ignored by the proxy, but the client or server can provide it to facilitate the support. .TP 8 .B core= Enable production of core dumps when aborting the proxy connection. .TP 8 .B options= Specify an additional file containing options that has to be merged with option read from the command line or the environment. .TP 8 .B kill= Add the given process to the list of daemons that must be terminated at session shutdown. Multiple 'kill=' options can be specified. The proxy will send them a SIGTERM signal just before exiting. .TP 8 .B strict= Optimize for responsiveness, rather than for the best use of all the available bandwidth. .TP 8 .B encryption= Should be set to 1 if the proxy is running as part of a program providing encryption of the point to point communication. .TP 8 .I These options are interpreted by the nx-NX Agent. They are ignored by the proxy. rootless= geometry= resize= fullscreen= keyboard= clipboard= streaming= backingstore= composite= xinerama= shmem= shpix= kbtype= client= shadow= shadowuid= shadowmode= defer= tile= menu= magicpixel= autodpi= sleep= .SH NX ENVIRONMENT VARIABLES The \fBnxproxy\fR application (and also \fBnxagent\fR when using nxcomp support) can be influenced by the following environment variables: .TP 8 .B NX_ROOT The root NX directory is the place where the session directory and the cache files are created. This is usually overridden by passing the 'root=' option. By default, the root NX directory is assumed to be the directory '.nx' in the user's home. .TP 8 .B NX_SYSTEM The directory where NX programs and libraries reside. If not set, the value is assumed to be '/usr/NX'. Programs, libraries and data files are respectedly searched in the 'bin', 'lib' and 'share' subdirectories. .TP 8 .B NX_HOME The NX user's home directory. If NX_ROOT is not set or invalid, the user's NX directory is created here. .TP 8 .B NX_TEMP The directory where all temporary files are to be created. .TP 8 .B NX_CLIENT The full path to the executable. If the variable is not set, the executable will be run assuming that the program is in the system path. This can be useful on platforms like Windows and the MacOS X where is located in a different directory compared to the other programs, to make easier for the user to execute the program from the shell. .TP 8 .B NX_SLAVE_CMD The full path to the slave channel handler. When the slave channel is enabled, the agent will listen on a port and forward the connection to the NX_SLAVE_CMD program. This can be used to implement agent/proxy communication for applications such as serial port and USB forwarding. .SH SHELL ENVIRONMENT VARIABLES .TP 8 .B HOME The variable is checked in the case NX_HOME is not set, null or invalid. .TP 8 .B TEMP The variable is checked whenever the NX_TEMP directory is not set, null or invalid. .TP 8 .B PATH The path where all executables are searched, except . If NX_CLIENT is not set, also the client executable is searched in the system path. .TP 8 .B LD_LIBRARY_PATH System-wide library search order. This should be set by the program invoking the proxy. .TP 8 .B DISPLAY On the X server side, the DISPLAY variable indicates the location of the X11 server. When nxcomp is used as a transport library, the DISPLAY may represent a NX transport specification and options can passed in the form nx/nx,option=value... .TP 8 .B XAUTHORITY This is the file containing the X11 authorization cookie. If not set, the file is assumed to be in the user's home (either NX_HOME or HOME). .SH AUTHOR The \fBnxproxy\fR application has originally been derived from a software project called DXCP. The company NoMachine turned DXCP into nxcomp with nxproxy as executable around nxcomp. .PP The current maintenance of \fBnxproxy\fR (major version 3) is coordinated between various projects, mainly by The Arctica Project, TheQVD (Qindel Group) and the X2Go Project. .PP This manual has been written by Mike Gabriel for the X2Go project (http://www.x2go.org) and later on improved for the Arctica Project (https://arctica-project.org). nx-libs-3.5.99.23/nxproxy/src/Main.c0000644000000000000000000000643313614532331013663 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ /* */ /* NXPROXY, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ /* software is allowed according to terms specified in the file LICENSE */ /* which comes in the source distribution. */ /* */ /* Check http://www.nomachine.com/licensing.html for applicability. */ /* */ /* NX and NoMachine are trademarks of Medialogic S.p.A. */ /* */ /* All rights reserved. */ /* */ /**************************************************************************/ #include #include #include #include #include #include #include "NX.h" #define PANIC #define WARNING #undef TEST #undef DEBUG extern const char *__progname; /* * Entry point when running nxproxy stand-alone. */ int main(int argc, const char **argv) { int result = -1; char *options = NULL; unsigned long int nx_commfd; char *nx_commfd_str = NULL; options = getenv("NX_DISPLAY"); if ((nx_commfd_str = getenv("NX_COMMFD")) != NULL) { errno = 0; nx_commfd = strtoul(nx_commfd_str, NULL, 10); if ((errno) && (0 == nx_commfd)) { fprintf(stderr, "%s: NX_COMMFD environment variable's value [%s] is not a file descriptor number. " "Aborting...\n", __progname, nx_commfd_str ); NXTransCleanup(); } else if ((unsigned long int) INT_MAX < nx_commfd) { fprintf(stderr, "%s: NX_COMMFD environment variable's value [%lu] is out of range for a file descriptor number. " "Aborting...\n", __progname, nx_commfd); NXTransCleanup(); } else { result = NXTransCreate(nx_commfd, NX_MODE_SERVER, options); if (result != 1) { fprintf(stderr, "%s: NXTransCreate failed for FD#%lu\n" "Aborting...", __progname, nx_commfd); NXTransCleanup(); } } // go into endless loop if (result == 1) { while (NXTransRunning(NX_FD_ANY)) result = NXTransContinue(NULL); } } else { if (NXTransParseCommandLine(argc, argv) < 0) { NXTransCleanup(); } if (NXTransParseEnvironment(options, 0) < 0) { NXTransCleanup(); } /* * This should not return... */ #ifdef TEST fprintf(stderr, "%s: Yielding control to NX entry point.\n", __progname); #endif result = NXTransProxy(NX_FD_ANY, NX_MODE_ANY, NX_DISPLAY_ANY); } /* * ...So these should not be called. */ NXTransExit(result); return 0; } nx-libs-3.5.99.23/nxproxy/src/Makefile.am0000644000000000000000000000073313614532331014664 0ustar NULL = nxexecdir = $(bindir) nxexec_PROGRAMS = nxproxy nxproxy_SOURCES = \ Main.c \ $(NULL) nxproxy_LDADD = \ -L$(top_srcdir)/../nxcomp/src/.libs -lXcomp \ $(NULL) nxproxy_LDFLAGS = \ $(NULL) if TARGET_ELF nxproxy_LDFLAGS += \ -Wl,--enable-new-dtags \ $(NULL) endif TARGET_ELF nxproxy_CFLAGS = \ $(BASE_CFLAGS) \ $(NULL) AM_CPPFLAGS = \ -I$(top_srcdir)/../nxcomp/include/ \ $(NULL) nx-libs-3.5.99.23/nxproxy/VERSION0000644000000000000000000000001213614532424013102 0ustar 3.5.99.23 nx-libs-3.5.99.23/nx-X11/config/cf/cross.def0000644000000000000000000000245413614532331014756 0ustar /* * This file contains redefinitions of some symbols to enable * cross compilation: e.g. paths for include files and paths to * compiler images. It will have to be edited to reflect these * given your local configuration. */ #if 0 #undef i386Architecture #define Arm32Architecture #undef OptimizedCDebugFlags #define OptimizedCDebugFlags -O2 #define ServerCDebugFlags -O2 #undef StandardDefines #define StandardDefines -Dlinux -D__arm__ -D_POSIX_SOURCE \ -D_DEFAULT_SOURCE -D_GNU_SOURCE -DX_LOCALE #undef CcCmd #define StdIncDir /opt/Embedix/tools/arm-linux/include #define PreIncDir #undef PostIncDir #define PostIncDir /opt/Embedix/tools/lib/gcc-lib/arm-linux/2.95.2/include #define CcCmd /opt/Embedix/tools/bin/arm-linux-gcc #undef CplusplusCmd #define HasCplusplus YES #define CplusplusCmd /opt/Embedix/tools/bin/arm-linux-g++ #define DoRanlibCmd YES #define RanlibCmd /opt/Embedix/tools/bin/arm-linux-ranlib #undef ExtraLoadFlags #define ExtraLoadFlags #undef ExtraInstallLoadFlags #define ExtraInstallLoadFlags #define FbNoPixelAddrCode #undef TermcapLibrary #define TermcapLibrary -ltermcap #undef LdPostLib #define LdPostLib -L/opt/Embedix/tools/arm-linux/lib #undef ExtensionOSDefines #define ExtensionOSDefines #define ServerXdmcpDefines /**/ #define HostCcCmd cc #endif #include nx-libs-3.5.99.23/nx-X11/config/cf/cross.rules0000644000000000000000000001147513614532331015355 0ustar #ifndef HostCcCmd #define HostCcCmd cc #endif #define HostLinkRule(target,flags,objs,libs) HostCcCmd -I$(BUILDINCDIR) -o target flags objs libs /* ComplexHostProgramTarget - Compile a program such that we can run * it on this host, i.e., don't use the default cross compiler. */ #ifndef ComplexHostProgramTarget #define ComplexHostProgramTarget(program) @@\ CC=HostCcCmd @@\ STD_INCLUDES= @@\ CFLAGS=$(TOP_INCLUDES) $(INCLUDES) $(BOOTSTRAPCFLAGS)\ @@\ $(CROSSCOMPILEDEFINES) $(CROSSCOMPILEBOOTSTRAPDEFINES) @@\ EXTRA_LOAD_FLAGS= @@\ PROGRAM = program @@\ @@\ AllTarget(HostProgramTargetName(program)) @@\ @@\ HostProgramTargetName(program): $(OBJS) $(DEPLIBS) @@\ RemoveTargetProgram($@) @@\ HostLinkRule($@,$(_NOOP_),$(OBJS),$(DEPLIBS) $(LOCAL_LIBRARIES)) @@\ @@\ DependTarget() @@\ @@\ LintTarget() @@\ @@\ clean:: @@\ RemoveFile(HostProgramTargetName(program)) #endif /* ComplexHostProgramTarget */ #ifndef SimpleHostProgramTarget #define SimpleHostProgramTarget(program) @@\ SRCS = program.c @@\ @@\ CC=HostCcCmd @@\ STD_INCLUDES= @@\ CFLAGS=$(TOP_INCLUDES) $(INCLUDES) $(BOOTSTRAPCFLAGS)\ @@\ $(CROSSCOMPILEDEFINES) $(CROSSCOMPILEBOOTSTRAPDEFINES) @@\ EXTRA_LOAD_FLAGS= @@\ PROGRAM = program @@\ @@\ AllTarget(HostProgramTargetName(program)) @@\ @@\ HostProgramTargetName(program): program.o $(DEPLIBS) @@\ RemoveTargetProgram($@) @@\ HostLinkRule($@,$(_NOOP_),program.o,$(DEPLIBS) $(LOCAL_LIBRARIES)) @@\ @@\ DependTarget() @@\ @@\ LintTarget() @@\ @@\ clean:: @@\ RemoveFile(HostProgramTargetName(program)) #endif /* SimpleHostProgramTarget */ #ifndef SimpleHostProgramTarget_1 #define SimpleHostProgramTarget_1(program) @@\ SRCS = program.c @@\ @@\ CC=HostCcCmd @@\ STD_INCLUDES= @@\ CFLAGS=$(TOP_INCLUDES) $(INCLUDES) $(BOOTSTRAPCFLAGS)\ @@\ $(CROSSCOMPILEDEFINES) $(CROSSCOMPILEBOOTSTRAPDEFINES) @@\ EXTRA_LOAD_FLAGS= @@\ PROGRAM = program @@\ @@\ AllTarget(HostProgramTargetName(program)) @@\ @@\ HostProgramTargetName(program): program.o $(DEPLIBS) @@\ RemoveTargetProgram($@) @@\ HostLinkRule($@,$(_NOOP_),program.o,$(DEPLIBS) $(LOCAL_LIBRARIES)) @@\ @@\ DependTarget() @@\ LintTarget() @@\ @@\ clean:: @@\ RemoveFile(HostProgramTargetName(program)) #endif /* SimpleHostProgramTarget_1 */ #ifndef SimpleHostProgramTarget_2 #define SimpleHostProgramTarget_2(program) @@\ SRCS = program.c @@\ @@\ CC=HostCcCmd @@\ STD_INCLUDES= @@\ CFLAGS=$(TOP_INCLUDES) $(INCLUDES) $(BOOTSTRAPCFLAGS)\ @@\ $(CROSSCOMPILEDEFINES) $(CROSSCOMPILEBOOTSTRAPDEFINES) @@\ EXTRA_LOAD_FLAGS= @@\ PROGRAM = program @@\ @@\ AllTarget(HostProgramTargetName(program)) @@\ @@\ HostProgramTargetName(program): program.o $(DEPLIBS) @@\ RemoveTargetProgram($@) @@\ HostLinkRule($@,$(_NOOP_),program.o,$(DEPLIBS) $(LOCAL_LIBRARIES)) @@\ @@\ clean:: @@\ RemoveFile(HostProgramTargetName(program)) #endif /* SimpleHostProgramTarget_2 */ #ifndef SimpleHostProgramTarget_3 #define SimpleHostProgramTarget_3(program) @@\ SRCS = program.c @@\ @@\ CC=HostCcCmd @@\ STD_INCLUDES= @@\ CFLAGS=$(TOP_INCLUDES) $(INCLUDES) $(BOOTSTRAPCFLAGS)\ @@\ $(CROSSCOMPILEDEFINES) $(CROSSCOMPILEBOOTSTRAPDEFINES) @@\ EXTRA_LOAD_FLAGS= @@\ PROGRAM = program @@\ @@\ AllTarget(HostProgramTargetName(program)) @@\ @@\ HostProgramTargetName(program): program.o $(DEPLIBS) @@\ RemoveTargetProgram($@) @@\ HostLinkRule($@,$(_NOOP_),program.o,$(DEPLIBS) $(LOCAL_LIBRARIES)) @@\ @@\ clean:: @@\ RemoveFile(HostProgramTargetName(program)) #endif /* SimpleHostProgramTarget_3 */ #ifndef SimpleHostProgramTarget_4 #define SimpleHostProgramTarget_4(program) @@\ SRCS = program.c @@\ @@\ CC=HostCcCmd @@\ STD_INCLUDES= @@\ CFLAGS=$(TOP_INCLUDES) $(INCLUDES) $(BOOTSTRAPCFLAGS)\ @@\ $(CROSSCOMPILEDEFINES) $(CROSSCOMPILEBOOTSTRAPDEFINES) @@\ EXTRA_LOAD_FLAGS= @@\ PROGRAM = program @@\ @@\ AllTarget(HostProgramTargetName(program)) @@\ @@\ HostProgramTargetName(program): program.o $(DEPLIBS) @@\ RemoveTargetProgram($@) @@\ HostLinkRule($@,$(_NOOP_),program.o,$(DEPLIBS) $(LOCAL_LIBRARIES)) @@\ @@\ clean:: @@\ RemoveFile(HostProgramTargetName(program)) #endif /* SimpleHostProgramTarget_4 */ nx-libs-3.5.99.23/nx-X11/config/cf/.gitignore0000644000000000000000000000002713614532331015127 0ustar date.def nxversion.def nx-libs-3.5.99.23/nx-X11/config/cf/gnu.cf0000644000000000000000000001027013614532331014243 0ustar #ifndef OSName #define OSName DefaultOSName #endif #ifndef OSVendor #define OSVendor /**/ #endif #ifndef OSMajorVersion #define OSMajorVersion DefaultOSMajorVersion #endif #ifndef OSMinorVersion #define OSMinorVersion DefaultOSMinorVersion #endif #ifndef OSTeenyVersion #define OSTeenyVersion DefaultOSTeenyVersion #endif XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVersion) #define GNUSourceDefines -D_POSIX_C_SOURCE=199309L \ -D_POSIX_SOURCE -D_XOPEN_SOURCE \ -D_DEFAULT_SOURCE XCOMM XXXMB: What about _GNU_SOURCE, see Linux/UseInstalled? #define XawI18nDefines -DHAS_WCHAR_H -DHAS_WCTYPE_H -DNO_WIDEC_H #define HasPosixThreads YES #define ThreadedX YES #define HasThreadSafeAPI YES #define ThreadsLibraries -lpthread #define SystemMTDefines -D_REENTRANT #ifndef HasLibCrypt #define HasLibCrypt YES #endif #ifndef BuildXF86RushExt # define BuildXF86RushExt YES #endif #define BuildLibPathVar LD_LIBRARY_PATH #define GccUsesGas YES #define UseGas YES #define GnuCpp YES #define HasDlopen YES #ifndef HasShadowPasswd # define HasShadowPasswd YES #endif #define HasPutenv YES XCOMM Not implemented and will always fail. #ifndef HasShm # define HasShm YES #endif #define HasBSD44Sockets YES #define HasSockets YES #define HasSnprintf YES #define HasMkstemp YES #define HasUsableFileMmap YES #ifndef HasNCurses #define HasNCurses YES #endif #define AvoidNullMakeCommand YES #ifndef DebuggableLibraries #define DebuggableLibraries NO #endif #define CompressAllFonts YES #define Malloc0ReturnsNull YES #define NeedConstPrototypes YES #define NeedFunctionPrototypes YES #define NeedNestedPrototypes YES #define NeedVarargsPrototypes YES #ifndef NeedWidePrototypes #define NeedWidePrototypes NO #endif #define SetTtyGroup YES #ifndef UseStaticTermcapLib #define UseStaticTermcapLib NO #endif #define MkdirHierCmd mkdir -p #ifndef CcCmd #define CcCmd gcc #endif #ifndef AsCmd #define AsCmd as #endif #ifndef LdCmd #define LdCmd ld #endif #define AsmDefines -D__ELF__ #define CplusplusCmd c++ #ifndef TermcapLibrary #if UseStaticTermcapLib #define TermcapLibrary StaticLibrary(/usr/lib,ncurses) #else #define TermcapLibrary -lncurses #endif #endif #ifndef DoLoadableServer #define DoLoadableServer YES #endif #ifndef CppCmd #define CppCmd /lib/cpp #endif #define YaccCmd bison -y #define LexCmd flex -l #define HasFlex YES #define LexLib -lfl #define PreProcessCmd CcCmd -E #define PostIncDir DefaultGccIncludeDir #define LdCombineFlags -r #ifndef LdPostLib #define LdPostLib /* Never needed */ #endif #define HasWChar32 YES #define StandardCppOptions -traditional #define StandardCppDefines StandardDefines #define HasVarRun YES #define VarDbDirectory $(VARDIR)/lib XCOMM i386Architecture #define OptimizedCDebugFlags DefaultGcc2i386Opt #define GNUMachineDefines -D__i386__ #define ServerOSDefines XFree86ServerOSDefines #define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #define HasPlugin YES #define VendorHasX11R6_3libXext YES #ifndef StandardDefines #define StandardDefines GNUMachineDefines GNUSourceDefines #endif #define DlLibrary -rdynamic -ldl #define ServerExtraSysLibs /**/ #define ConnectionFlags -DUNIXCONN -DTCPCONN /* Some of these man page defaults are overridden in the above OS sections */ #ifndef ManSuffix # define ManSuffix 1x #endif #ifndef ManDir # define ManDir $(MANSOURCEPATH)1 #endif #ifndef LibManSuffix # define LibManSuffix 3x #endif #ifndef LibmanDir # define LibmanDir $(MANSOURCEPATH)3 #endif #ifndef FileManSuffix # define FileManSuffix 5x #endif #ifndef FileManDir # define FileManDir $(MANSOURCEPATH)5 #endif #ifndef StaticLibrary #define StaticLibrary(libpath,libname) -Wl,-Bstatic Concat(-L,libpath) Concat(-l,libname) -Wl,-Bdynamic #endif #define HasGnuMake YES #define MakeNamedTargetSubdir(dir,flags,subname)\ $(MAKE) -C dir $(MFLAGS) $(PARALLELMFLAGS) flags subname #define ArchitectureDefines -DGNU_ARCHITECTURE #define XserverNeedsSetUID NO #include XCOMM XXX Might need this if they are not careful with slashes. XCOMM #define DirFailPrefix - #include nx-libs-3.5.99.23/nx-X11/config/cf/gnuLib.rules0000644000000000000000000001375313614532331015445 0ustar /* * GNU/Hurd shared library rules * */ /* * GNU/Hurd shared library rules * Cloned from Linux (ELF) shared library rules * */ #ifndef HasSharedLibraries #define HasSharedLibraries YES #endif #ifndef ForceNormalLib #define ForceNormalLib NO #endif XCOMM XXX To rpath or not to rpath... #ifndef UseRpath #define UseRpath YES #endif #undef SpecialMalloc #define SpecialMalloc NO #define BaseShLibReqs -lc #ifndef SharedDataSeparation #define SharedDataSeparation NO #endif #ifndef SharedCodeDef #define SharedCodeDef /**/ #endif #ifndef SharedLibraryDef #define SharedLibraryDef /**/ #endif #ifndef ShLibIncludeFile #define ShLibIncludeFile #endif #ifndef RpathLoadFlags #if UseRpath #define RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath=\$$ORIGIN/$(BUILDLIBDIR):\$$ORIGIN/../../../nxcomp/src/.libs:\$$ORIGIN/../../../nxcompshad/src/.libs #else #define RpathLoadFlags /**/ #endif #endif #ifndef RpathInstallLoadFlags #if UseRpath #define RpathInstallLoadFlags -Wl,--enable-new-dtags -Wl,-rpath=$(USRLIBDIRPATH) #else #define RpathInstallLoadFlags /**/ #endif #endif #ifndef LibraryRpathLoadFlags #define LibraryRpathLoadFlags RpathLoadFlags #endif #ifndef SharedLibraryLoadFlags #define SharedLibraryLoadFlags -shared LibraryRpathLoadFlags #endif #ifndef PositionIndependentCFlags #define PositionIndependentCFlags -fPIC #endif #ifndef PositionIndependentCplusplusFlags #define PositionIndependentCplusplusFlags -fPIC #endif #ifndef ExtraLoadFlags #ifdef UseInstalled XCOMM XXX Maybe superfluous. #define ExtraLoadFlags RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link=$(USRLIBDIRPATH) #else #define ExtraLoadFlags RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link=\$$ORIGIN/$(BUILDLIBDIR):\$$ORIGIN/../../../nxcomp/src/.libs:\$$ORIGIN/../../../nxcompshad/src/.libs #endif #endif #ifndef ExtraInstallLoadFlags #ifdef UseInstalled XCOMM XXX Maybe superfluous. #define ExtraInstallLoadFlags RpathInstallLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link=$(USRLIBDIRPATH) #else #define ExtraInstallLoadFlags RpathInstallLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link=\$$ORIGIN/$(BUILDLIBDIR):\$$ORIGIN/../../../nxcomp/src/.libs:\$$ORIGIN/../../../nxcompshad/src/.libs #endif #endif /* * InstallSharedLibrary - generate rules to install the shared library. * NOTE: file must be executable, hence "INSTBINFLAGS" */ #ifndef InstallSharedLibrary #define InstallSharedLibrary(libname,rev,dest) @@\ install:: Concat(lib,libname.so.rev) @@\ MakeDir($(DESTDIR)dest) @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\ @T=`echo Concat($(DESTDIR)dest/lib,libname.so.rev) | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`;\ set -x; $(RM) $$T && $(LN) Concat(lib,libname.so.rev) $$T @@\ @if $(SOSYMLINK); then (set -x; \ $(RM) Concat($(DESTDIR)dest/lib,libname.so); \ @@\ $(LN) Concat(lib,libname.so.rev) Concat($(DESTDIR)dest/lib,libname.so)); fi #endif /* InstallSharedLibrary */ /* * InstallSharedLibraryData - generate rules to install the shared library data */ #ifndef InstallSharedLibraryData #define InstallSharedLibraryData(libname,rev,dest) #endif /* InstallSharedLibraryData */ /* * SharedLibraryTarget - generate rules to create a shared library; * build it into a different name so that we do not hose people by having * the library gone for long periods. */ #ifndef SharedLibraryTarget #define SharedLibraryTarget(libname,rev,solist,down,up) @@\ AllTarget(Concat(lib,libname.so.rev)) @@\ @@\ Concat(lib,libname.so.rev): solist $(EXTRALIBRARYDEPS) @@\ $(RM) $@~ @@\ @SONAME=`echo $@ | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; set -x; \ @@\ (cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs); \ @@\ $(RM) $$SONAME; $(LN) $@ $$SONAME; \ @@\ LinkBuildSonameLibrary($$SONAME) @@\ $(RM) $@ @@\ $(MV) $@~ $@ @@\ @if $(SOSYMLINK); then (set -x; \ @@\ $(RM) Concat(lib,libname.so); \ @@\ $(LN) $@ Concat(lib,libname.so)); fi @@\ LinkBuildLibrary($@) @@\ LinkBuildLibraryMaybe(Concat(lib,libname.so),$(SOSYMLINK)) @@\ @@\ clean:: @@\ @MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \ @@\ set -x; $(RM) Concat(lib,libname.so.$$MAJREV) @@\ $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so) #endif /* SharedLibraryTarget */ /* * SharedDepLibraryTarget - generate rules to create a shared library. */ #ifndef SharedDepLibraryTarget #define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up) @@\ AllTarget(Concat(lib,libname.so.rev)) @@\ @@\ Concat(lib,libname.so.rev): deplist $(EXTRALIBRARYDEPS) @@\ $(RM) $@~ @@\ @SONAME=`echo $@ | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; set -x; \ @@\ (cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs); \ @@\ $(RM) $$SONAME; $(LN) $@ $$SONAME; \ @@\ LinkBuildSonameLibrary($$SONAME) @@\ $(RM) $@ @@\ $(MV) $@~ $@ @@\ @if $(SOSYMLINK); then (set -x; \ @@\ $(RM) Concat(lib,libname.so); \ @@\ $(LN) $@ Concat(lib,libname.so)); fi @@\ LinkBuildLibrary($@) @@\ LinkBuildLibraryMaybe(Concat(lib,libname.so),$(SOSYMLINK)) @@\ @@\ clean:: @@\ @MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \ @@\ set -x; $(RM) Concat(lib,libname.so.$$MAJREV) @@\ $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so) #endif /* SharedDepLibraryTarget */ #ifndef SharedDepModuleTarget #define SharedDepModuleTarget(name,deps,solist) @@\ AllTarget(name) @@\ @@\ name: deps @@\ $(RM) $@~ @@\ $(CC) -o $@~ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) BaseShLibReqs @@\ $(RM) $@ @@\ $(MV) $@~ $@ @@\ @@\ clean:: @@\ $(RM) name #endif /* SharedDepModuleTarget */ /* * SharedLibraryDataTarget - generate rules to create shlib data file; */ #ifndef SharedLibraryDataTarget #define SharedLibraryDataTarget(libname,rev,salist) #endif /* SharedLibraryTarget */ nx-libs-3.5.99.23/nx-X11/config/cf/gnuLib.tmpl0000644000000000000000000000017613614532331015262 0ustar XCOMM XCOMM GNU Hurd shared library template XCOMM #define SharedX11Reqs #define SharedXlibi18nReqs $(LDPRELIB) $(XONLYLIB) nx-libs-3.5.99.23/nx-X11/config/cf/host.def0000644000000000000000000003502513614532331014602 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /**************************************************************************/ /******************************************************************************/ /* * This file is to provide a quick method for most people to change the * behaviour of their Xorg installation without having to fully * understand the workings of site.def and all the various '.cf' files. * * In the vast majority of cases, it should not be necessary to use this * file at all or change it in any way. * * This file is divided into two sections. The first contains settings * that end-users might reasonably change. The second contains settings * that developers might want to change. * * IMPORTANT NOTE: In all cases changing the defaults may cause problems * and/or unexpected side-effects. If you don't understand what a setting * does, then it's best to not change it. If you make changes and have * problems, verify that those problems are also present when using an * empty host.def file and unchanged version of this file before reporting * them. * * A good way to use this file is to copy it to host.def, and make the * changes there. That way, future patches to this file won't fail. * The host.def file will never be patched. * * The distributed version of this file MUST contain no uncommented * definitions. Default definitions belong in xorg.cf, or .cf * files. */ /******************************************************************************/ #if defined(SunArchitecture) #define ProjectRoot /usr/openwin #endif /* * Enable use the Cygwin IPC libraries to get MIT-SHM support. */ #if defined(cygwinArchitecture) #define UseCygIPC YES #endif /* * If you have build-specific modifications in your host.def file, but * want an empty host.def file installed when doing 'make install', * uncomment the following * #define InstallEmptyHostDef */ /* * Which servers to build. There is only Xorg server. * It can be disabled by the following. * #define XorgServer NO */ #define XorgServer NO /* * Building libraries with NX enhancements is disabled * by default. You should enable this in your host.def. * #define NXLibraries YES */ #define NXLibraries YES /* * Building the NX agent nested server is disabled * by default. Enable this in your host.def. * #define NXAgentServer YES */ #define NXAgentServer YES #ifdef NXAgentServer #define BuildRenderLibrary YES #endif /* * Define this symbol to build the NX enhanced MS Windows * X server for Cygnus environment. * #define NXWinServer YES */ #if defined(cygwinArchitecture) #define NXWinServer NO #endif /* * Set the default server (ie the one that gets the sym-link to "X") * #define ServerToInstall Xorg */ /* * Force build of X libraries if any nested server is to be built. * #define BuildLibraries YES * * If you just want libraries for NXAgentServer, this should be * enough (never tested, although). * #define BuildLibrariesForXServers YES */ #if NXAgentServer #define BuildLibraries YES #endif #define BuildDocs NO #define BuildComposite YES /* * Server configuration parameters. The defaults are shown here: */ /* * Select the XInput devices you want by uncommenting this. * #define XInputDrivers mouse keyboard acecad calcomp citron \ digitaledge dmc dynapro elographics \ microtouch mutouch penmount spaceorb summa \ wacom void magictouch aiptek */ /* * To use the deprecated, old keyboard driver, uncomment this. But * even better, make the new keyboard driver (hw/xfree86/input/keyboard) * work for your architecture. The old driver will be removed in the * next release. * #define UseDeprecatedKeyboardDriver YES */ /* * Include True Type Fonts to default font path. It is safe to do * this by default as NX intaller carries only misc and TTF in the * basic set of fonts installed under Windows. * #define DefaultFontPath $(FONTDIR)/misc/,$(FONTDIR)/Type1/,$(FONTDIR)/75dpi/,$(FONTDIR)/100dpi/ */ #if defined(LinuxArchitecture) || defined(SunArchitecture) || defined(FreeBSDArchitecture) #define DefaultFontPath $(FONTDIR)/misc/,$(FONTDIR)/Type1/,$(FONTDIR)/75dpi/,$(FONTDIR)/100dpi/,$(FONTDIR)/TTF/ #endif /* #if defined(LinuxArchitecture) || defined(SunArchitecture) */ #if defined(cygwinArchitecture) #define DefaultFontPath /mnt/NX/fonts/base/,/mnt/NX/fonts/misc/,/mnt/NX/fonts/Type1/,/mnt/NX/fonts/75dpi/,/mnt/NX/fonts/100dpi/,/mnt/NX/fonts/TTF/ #endif /* #if defined(cygwinArchitecture) */ /* * To build only the servers with a cut-down source tree, uncomment * this. * #define BuildServersOnly YES */ #define BuildServersOnly YES /* * Undefine the following if you don't want to have config files and * app-defaults installed in a separate directory (i.e. /etc/X11). * #define UseSeparateConfDir NO */ /* * Unless you're a developer you shouldn't need to change anything * beyond this point. */ /* * If you want to enable some developer settings, like more verbose * compiler warnings, uncomment this. * #define XFree86Devel YES */ /* * If using GCC 2.x on a system where it isn't the default, uncomment * the following * */ #if defined(SunArchitecture) #define HasGcc2 YES #define HasGcc YES #endif /* * The default optimisation flags for GCC 2.x. -fno-strength-reduce is * here to work around a bug in -O2 for GCC 2.x on i386 platforms. * If you are using a version that doesn't have this bug, you can * uncomment the following line, and remove '-fno-strength-reduce' * If you are building binaries for a 486, it may be beneficial to add * -m486 * #define DefaultGcc2i386Opt -O2 -fno-strength-reduce */ #if defined (LinuxArchitecture) #define DefaultGcc2i386Opt -g -O3 #endif /* * Enable all the optimizations on AMD64. */ #define DefaultGcc2AMD64Opt -g -O3 GccAliasingArgs /* * This allows the GCC warning flags to be set. The default is shown here. * #define GccWarningOptions -Wall -Wpedantic -Wpointer-arith -Wstrict-prototypes \ -Wmissing-prototypes -Wmissing-declarations \ -Wredundant-decls -Wnested-externs -Wshadow */ /* * Sun Compiler stuff.. * #define HasSunC YES #define HasSunCplusplus YES #define CplusplusCompilerMajorVersion 5 #define CplusplusCompilerMinorVersion 0 #define CCompilerMajorVersion 5 #define CCompilerMinorVersion 0 */ /* * Optimized Sun Compiler Build. * #define DefaultCDebugFlags -xO4 -xtarget=pentium_pro #define OptimizedCDebugFlags -xO4 -xtarget=pentium_pro */ /* * Debuggable Sun Compiler Build. * Note: This builds _EVERYTHING_ as debuggable * #define DefaultCDebugFlags -g -xs #define OptimizedCDebugFlags -g -xs */ /* * For Linux, this should match the Binutils version you have. This example * is for 2.6.0.7. See linux.cf for the default setting. * * This should automatically get set correctly by imake. * #define LinuxBinUtilsMajorVersion 26 */ /* * For Linux, these should match the libc version you have. This example * is for libc.5.4.x. See linux.cf for the default setting. * * This should automatically get set correctly by imake. * #define LinuxCLibMajorVersion 5 #define LinuxClibMinorVersion 4 */ /* * If you want to use the GNU malloc library, uncomment this * #define UseGnuMalloc YES */ /* * Set this to whatever is required to access the GNU malloc library. * The default is '-lgmalloc' unless is specified in the OS's .cf file. * #define GnuMallocLibrary -L/usr/local/lib -lgmalloc */ /* * Some Linux releases don't have a libtermcap. In this case you may need * to uncomment the following * #define TermcapLibrary -lncurses */ /* * Build XAA. This can be disabled with: * #define XF86XAA NO */ /* * Build vgahw. This can be disabled with: * #define XF86VgaHw NO */ /* * Build xf1bpp. This can be disabled with: * #define XF1Bpp NO */ /* * Build xf4bpp. This can be disabled with: * #define XF4Bpp NO */ /* * BSD Console driver support (for FreeBSD and NetBSD). * * By default, support is included for pccons and pcvt for NetBSD, and * pccons, syscons and pcvt for FreeBSD. * * To change the list of supported drivers, set the following parameter. * Possible values are -DPCCONS_SUPPORT, -DSYSCONS_SUPPORT, -DPCVT_SUPPORT. * The following example includes support for syscons and pcvt only. * #define XFree86ConsoleDefines -DSYSCONS_SUPPORT -DPCVT_SUPPORT */ /* * To disable building XInput support, uncomment this * #define BuildXInputExt NO */ #if defined(SunArchitecture) #define BuildXInputExt YES #endif /* * Uncomment this for joystick support. * * Note: Joystick support is broken, so don't enable this. * #define JoystickSupport YES */ /* * To disable the ScreenSaver Extension, uncomment this line. * #define BuildScreenSaverExt NO */ #define BuildScreenSaverExt YES /* * If you don't want to build Xinerama support, uncomment this. * #define BuildXinerama NO */ #define BuildXinerama YES /* * If you don't want to build support for the GLX extension, uncomment this. * #define BuildGlxExt NO */ #define BuildGlxExt YES /* * Taken from xorg.cf. */ #if defined(SparcArchitecture) \ || defined (Sparc64Architecture) \ || defined(ia64Architecture) \ || defined(s390xArchitecture) \ || defined(AMD64Architecture) #define GlxExtraDefines -D__GLX_ALIGN64 #endif #define BuildXKB YES #define BuildXKBlib YES /* * If you want to build against libXfont2, rather than libXfont(1), uncomment this. * #define HasXfont2 YES */ /* * If building against libXfont(1) and using a legacy version (lower than 1.4.2), * uncomment this. * #define HasLegacyXfont1 YES */ /* * If building with SHM support enabled and using a legacy Xext protocol * version (lower than 7.1.0), uncomment this. * #define HasLegacyXextProto YES */ /* * If you are running NetBSD 0.9C or later, and have the aperture driver * installed, uncomment this. * #define HasNetBSDApertureDriver YES */ /* * If you are running SVR3 and have the mmap driver installed (for linear * framebuffer access) uncomment this. * #define HasSVR3mmapDrv YES */ /* * If you are using an SVR3 (like ISC 4.x) which supports long file names, * you can uncomment this to have manual pages installed under their * full names * #define ExpandManNames YES */ /* * For a POSIXized build on Interactive uncomment this * Could be used with gcc 'till Version 2.6.3 * Should be used with gcc 2.7.2. * #define UsePosix YES */ /* * If you don't want XDMAUTH support (if you don't have Wraphelp.c), * comment this out. * */ #if defined(LinuxArchitecture) #define HasXdmAuth YES #endif /* #if defined(LinuxArchitecture) */ /* * To build static and shared libraries with debugging information, uncomment * this. Assumes you have Gcc2. * (If you don't have Gcc2, you can use the DebugLib{X11,...} variables * to build debugging versions of the libraries separately.) * #define DebuggableLibraries YES */ #if defined(LinuxArchitecture) #define DebuggableLibraries YES #endif /* #if defined(LinuxArchitecture) */ /* * To forceably build static libraries in addition to shared libraries, * uncomment this. * #define ForceNormalLib YES */ /* * Uncomment this if your default tools (eg, gcc, ld, as, etc) are * not the Linux ELF versions. * #define LinuxElfDefault NO */ /* * To use ELF format shared libraries for supported OSs, uncomment this. * * For Linux the default setting of this is the same as the setting of * LinuxElfDefault. * * For FreeBSD this should automatically be set correctly by imake. Only * change it here if you need to override the automatic setting. * #define UseElfFormat YES */ /* * For FreeBSD/ELF (FreeBSD 3.0) it is possible to also build and install * a.out compatibility libraries. To enable that, uncomment this. * #define BuildAoutLibraries YES */ /* * If you have trouble with make bombing out in Xlib, try uncommenting this. * You will not get dependencies as a result, but better than nothing. * #define MakeHashTableBug YES */ /* * If you do not want your man pages compress under SVR3 systems that * support it, uncomment this. * #define CompressManPages NO */ /* * If you have sgmlfmt (the XFree86 doctools package) and want to build * formatted docs from the SGML source, uncomment this. * #define HasSgmlFmt YES */ /* * To disable building some document formats, uncomment some of these. * #define BuildLinuxDocText NO #define BuildLinuxDocHtml NO #define BuildLinuxDocPS NO */ /* * To install Japanese versions of the documentation uncomment this. * Note: The Japanese documentation consists of a subset of the * XFree86 3.1 docs. * #define InstallJapaneseDocs YES */ /* * To build/install X specs docs, uncomment the following. * The SpecsDocDirs setting here is recommended because it covers * the docs that XFree86 has changed or added. * #define BuildSpecsDocs YES #define SpecsDocDirs CTEXT GL ICCCM X11 Xext Xmu Xv XvMC i18n */ /* * To build all specs docs, not just those listed in SpecsDocDirs, uncomment * the following. * #define BuildAllSpecsDocs YES */ /* * If your system doesn't support vm86() mode and you have * libx86emu set library path here * #define X86EMU_LIBPATH /usr/local/lib */ nx-libs-3.5.99.23/nx-X11/config/cf/Imake.cf0000644000000000000000000005436113614532331014511 0ustar /* * To add support for another platform: * * 1. Identify a machine-specific cpp symbol. If your preprocessor * does not have any built in, you will need to add the symbol to the * cpp_argv table in config/imake/imakemdep.h and rebuild imake with * the BOOTSTRAPCFLAGS variable set (see the macII for an example). * * 2. Add all machine-specific cpp symbols (either defined by you or by * the preprocessor or compiler) to the predefs table in * config/imake/imakemdep.h. * * 3. But a new #ifdef block below that defines MacroIncludeFile and * MacroFile for your new platform and then #undefs the machine- * specific preprocessor symbols (to avoid problems with file names). * * 4. Create a .cf file with the name given by MacroFile. */ #if defined(__APPLE__) # undef __APPLE__ # define MacroIncludeFile # define MacroFile darwin.cf # define DarwinArchitecture # ifdef __ppc__ # define PpcDarwinArchitecture # undef __ppc__ # endif # ifdef __i386__ # define i386DarwinArchitecture # undef __i386__ # endif #endif #if defined(clipper) || defined(__clipper__) # undef clipper # define MacroIncludeFile # define MacroFile ingr.cf # define IngrArchitecture #endif /* clipper */ #ifdef __CYGWIN__ #define MacroIncludeFile #define MacroFile cygwin.cf #define cygwinArchitecture #define i386Architecture #undef i386 #undef i486 #undef i586 #undef i686 #undef __i386__ #undef _X86_ #undef __CYGWIN__ #endif /* CYGWIN */ #ifdef ultrix # define MacroIncludeFile # define MacroFile ultrix.cf # ifdef vax # undef vax # define VaxArchitecture # endif # ifdef mips # undef mips # define MipsArchitecture # define MipselArchitecture # endif # undef ultrix # define UltrixArchitecture #endif /* ultrix */ #if defined(vax) && !defined(UltrixArchitecture) && !defined(__OpenBSD__) # define MacroIncludeFile # define MacroFile bsd.cf # undef vax # define BSDArchitecture # define VaxArchitecture #endif /* vax */ #ifdef __bsdi__ # define MacroIncludeFile # define MacroFile bsdi.cf # undef __bsdi__ # ifdef bsdi # undef bsdi # endif # define BSDOSArchitecture # if defined(__i386__) || defined(i386) # define i386BsdArchitecture # define i386Architecture # undef i386 # undef __i386__ # endif # if defined(__ppc__) || defined(ppc) # define PpcBsdArchitecture # define PpcArchitecture # undef ppc # undef __ppc__ # endif # if defined(__sparc__) || defined(__sparc_v9__) || defined(sparc) # define SparcBsdArchitecture # define SparcArchitecture # undef sparc # undef __sparc__ # undef __sparc_v9__ # endif #endif /* bsdi */ #ifdef __OpenBSD__ # undef __OpenBSD__ # undef __NetBSD__ # define OpenBSDArchitecture # define KOpenBSDArchitecture # define MacroIncludeFile # define MacroFile OpenBSD.cf # ifdef __i386__ # define i386BsdArchitecture # define i386Architecture # undef i386 # endif # if defined(__sparc__) || defined(sparc) # if !defined(__arch64__) # define SparcArchitecture # else # define Sparc64Architecture # endif # undef sparc # endif # if defined(__mips__) || defined(mips) # define MipsArchitecture # ifdef arc # define ArcArchitecture # undef arc # endif # ifdef pmax # define PmaxArchitecture # undef pmax # endif # undef mips # endif # if defined(__alpha__) || defined(alpha) # define AlphaArchitecture # undef __alpha__ # undef alpha # endif # if defined(__amd64__) || defined(__x86_64__) # define AMD64Architecture # undef __amd64__ # undef __x86_64__ # undef amd64 # endif # if defined(__mc68020__) || defined(mc68020) # define Mc68020Architecture # if defined(amiga) # define AmigaArchitecture # undef amiga # endif # if defined(hp300) # define Hp300Architecture # undef hp300 # endif # if defined(mac68k) # define Mac68kArchitecture # undef mac68k # endif # if defined(mvme68k) # define Mvme68kArchitecture # undef mvme68k # endif # if defined(sun3) # define Sun3Architecture # undef sun3 # endif # undef mc68000 # endif # ifdef __powerpc__ # define PpcArchitecture # undef __powerpc__ # undef __macppc__ # undef macppc # endif # ifdef __vax__ # undef vax # undef __vax__ # define VaxArchitecture # endif # ifdef __hppa__ # ifndef HPArchitecture # define HPArchitecture # endif # undef __hppa__ # endif /* __hppa__ */ #endif /* OpenBSD */ /* Systems based on kernel of OpenBSD */ #if defined(__OpenBSD_kernel__) #define KOpenBSDArchitecture #endif #ifdef __NetBSD__ # define MacroIncludeFile # define MacroFile NetBSD.cf # undef __NetBSD__ # define NetBSDArchitecture # define KNetBSDArchitecture # ifdef __i386__ # define i386BsdArchitecture # define i386Architecture # undef i386 # endif # if defined(__sparc64__) || defined(__sparc_v9__) || defined(__arch64__) # define Sparc64Architecture # endif # if defined(__sparc__) || defined(sparc) # define SparcArchitecture # undef sparc # if defined(__sparc_v9__) || defined(__arch64__) # define Sparc64Architecture # endif # endif # ifdef mips # define MipsArchitecture # define ArcArchitecture # undef mips # endif # ifdef __alpha__ # define AlphaArchitecture # define AlphaBsdArchitecture # undef __alpha__ # endif # ifdef mc68000 # define Mc68020Architecture # endif # ifdef __arm32__ # define Arm32Architecture # undef __arm32__ # endif # ifdef __vax__ # define VaxArchitecture # undef __vax__ # endif # ifdef __powerpc__ # define PpcArchitecture # undef __powerpc__ # endif #endif /* NetBSD */ /* Systems based on kernel of NetBSD */ #if defined(__NetBSD_kernel__) #define KNetBSDArchitecture #endif #ifdef __DragonFly__ # define MacroIncludeFile # define MacroFile DragonFly.cf # undef __DragonFly__ # undef __FreeBSD__ # define DragonFlyArchitecture # define FreeBSDArchitecture # ifdef __i386__ # define i386BsdArchitecture # define i386Architecture # undef i386 # endif # ifdef __sparc64__ # define Sparc64Architecture # undef __sparc64__ # endif # ifdef __ia64__ # define ia64Architecture # undef __ia64__ # endif # ifdef __amd64__ # define x86_64Architecture # undef __amd64__ # undef __x86_64__ # endif #endif /* __DragonFly__ */ #ifdef __FreeBSD__ # define MacroIncludeFile # define MacroFile FreeBSD.cf # undef __FreeBSD__ # define FreeBSDArchitecture # define KFreeBSDArchitecture # ifdef __i386__ # define i386BsdArchitecture # define i386Architecture # undef i386 # endif # ifdef __alpha__ # define AlphaBsdArchitecture # define AlphaArchitecture # undef __alpha__ # endif # ifdef __sparc64__ # define Sparc64Architecture # undef __sparc64__ # endif # ifdef __ia64__ # define ia64Architecture # undef __ia64__ # endif # ifdef __amd64__ # define AMD64Architecture # undef __amd64__ # undef __x86_64__ # endif # ifdef __powerpc__ # define PpcArchitecture # undef __powerpc__ # endif #endif /* __FreeBSD__ */ /* Systems based on kernel of FreeBSD */ #if defined(__FreeBSD_kernel__) #define KFreeBSDArchitecture #endif #ifdef AMOEBA /* Should be before the 'sun' entry because we may be cross-compiling */ # define MacroIncludeFile # define MacroFile Amoeba.cf # if defined(i80386) || defined(__i80386__) # undef i80386 # define i386Architecture # else # if defined(mc68000) || defined(__mc68000__) # undef mc68000 # define Sun3Architecture # define SunArchitecture # else # if defined(sparc) || defined(__sparc__) # undef sparc # define SparcArchitecture # define SunArchitecture # endif # endif # undef sun # endif #endif /* AMOEBA */ #ifdef sun # define MacroIncludeFile # define MacroFile sun.cf # ifdef SVR4 # undef SVR4 # define SVR4Architecture # endif # ifdef sparc # undef sparc # define SparcArchitecture # endif # ifdef __sparcv9 # undef __sparcv9 # define Sparc64Architecture # endif # ifdef mc68000 # undef mc68000 # define Sun3Architecture # endif # if defined(__amd64) || defined(__x86_64) # undef __amd64 # undef __x86_64 # undef amd64 # undef i386 # define AMD64Architecture # endif # ifdef i386 # undef i386 # define i386Architecture # endif # undef sun # define SunArchitecture #endif /* sun */ #ifdef __SCO__ # define MacroIncludeFile # define MacroFile sco5.cf # undef __SCO__ # undef sco # undef USL # undef SYSV # undef i386 # undef SCO # undef SVR4 # define i386Architecture # define SCOArchitecture # define i386SVR3Architecture # define SVR3Architecture # define i386ScoArchitecture # define i386Sco325Architecture # undef i386 # undef i486 # undef i586 # undef i686 # undef k6 # undef __i386__ # undef __i486__ # undef __i586__ # undef __i686__ # undef __k6__ # undef __i386 # undef __i486 # undef __i586 # undef __i686 # undef __k6 # undef pentium # undef __pentium # undef pentiumpro # undef __pentiumpro #endif /* __SCO__ - SCO Open Server 5 */ #ifdef __UNIXWARE__ # define MacroIncludeFile # define MacroFile usl.cf # undef __UNIXWARE__ # undef USL # undef SVR4 # undef i386 # undef SVR5 # undef SYSV5 # define SVR4Architecture # define i386Architecture # define USLArchitecture # define UnixWareArchitecture # undef i386 # undef i486 # undef i586 # undef i686 # undef k6 # undef __i386__ # undef __i486__ # undef __i586__ # undef __i686__ # undef __k6__ # undef __i386 # undef __i486 # undef __i586 # undef __i686 # undef __k6 # undef pentium # undef __pentium # undef pentiumpro # undef __pentiumpro #endif /* __UNIXWARE__ */ #ifdef NCR # define MacroIncludeFile # define MacroFile ncr.cf # undef NCR # undef SVR4 # undef i386 # define SVR4Architecture # define i386Architecture # define NCRArchitecture #endif /* NCR */ #ifdef apollo # define MacroIncludeFile # define MacroFile apollo.cf # undef apollo # define ApolloArchitecture #endif /* apollo */ #ifdef sony # define MacroIncludeFile # define MacroFile sony.cf # undef sony # undef sony_news # define SonyArchitecture # ifdef mc68020 # undef mc68020 # undef mc68030 # define Mc68020Architecture # endif # ifdef mips # undef mips # define MipsArchitecture # endif # ifdef __svr4 # define SVR4Architecture # else # if !defined(bsd43) || defined(SYSTYPE_SYSV) || defined(_SYSTYPE_SYSV) # define SonySysvArchitecture # else # define SonyBsdArchitecture # endif # endif #endif /* sony */ #ifdef M4310 # define MacroIncludeFile # define MacroFile pegasus.cf # undef M4310 # define PegasusArchitecture #endif /* M4310 */ #ifdef M4330 # define MacroIncludeFile # define MacroFile m4330.cf # undef M4330 # define M4330Architecture #endif /* M4330 */ #ifdef macII # define MacroIncludeFile # define MacroFile macII.cf # undef macII # define MacIIArchitecture #endif /* macII */ #ifdef stellar # define MacroIncludeFile # define MacroFile stellar.cf # undef stellar # define StellarArchitecture #endif /* stellar */ #if defined(ibm) || defined(_IBMR2) || defined(ibm032) # define MacroIncludeFile # define MacroFile ibm.cf # ifdef ibm # undef ibm # endif # define IBMArchitecture # ifdef i386 # undef i386 # define PS2Architecture # endif # ifdef ibm032 # undef ibm032 # define RtArchitecture # endif # ifdef _IBMR2 # undef _IBMR2 # if (DefaultOSMajorVersion < 5) # define RsArchitecture # else # define PpcArchitecture # endif # endif #endif /* ibm */ #ifdef luna # undef luna # define MacroIncludeFile # define MacroFile luna.cf # define LunaArchitecture # ifdef mc68000 # undef mc68000 # define Mc68000Architecture # else # undef mc88000 # define Mc88000Architecture # endif #endif /* luna */ #ifdef Mips # define MacroIncludeFile # define MacroFile Mips.cf # undef Mips # undef mips # if defined(SYSTYPE_BSD43) || defined(BSD) || defined(BSD43) # define MipsBsdArchitecture # else /* BSD */ # define MipsSysvArchitecture # endif /* BSD */ #endif /* Mips */ #ifdef MOTOROLA # define MacroIncludeFile # define MacroFile moto.cf # undef MOTOROLA # ifdef SYSV # define MotoR3Architecture # endif # ifdef SVR4 # define MotoR4Architecture # endif #endif /* MOTOROLA */ #if defined(SVR4) # ifdef i386 # define i386Architecture # undef i386 # endif # ifdef PC98 # define PANIX98Architecture # undef PC98 # endif # define SVR4Architecture # define MacroIncludeFile # define MacroFile svr4.cf # undef SVR4 #endif /* SVR4 */ #ifdef SYSV # ifdef i386 # undef i386 # ifdef ISC # define i386Architecture # define i386SVR3Architecture # define MacroIncludeFile # define MacroFile isc.cf # define i386IscArchitecture # undef ISC # ifdef ISC202 # define IscVersion 202 # undef ISC202 # else # ifdef ISC30 # define IscVersion 300 # undef ISC30 # else # ifdef ISC40 # define IscVersion 400 # undef ISC40 # else # define IscVersion 221 # endif /* ISC40 */ # endif /* ISC30 */ # endif /* ISC202 */ # endif /* ISC */ # ifndef MacroFile # define i386SVR3Architecture # define MacroIncludeFile # define MacroFile x386.cf # endif /* MacroFile */ # endif /* i386 */ #endif /* SYSV */ /* SYSV386 is here for backward compatibility only */ #ifdef SYSV386 # undef i386 # ifdef SVR4 # define i386Architecture # define SVR4Architecture # define i386SVR4Architecture # define MacroIncludeFile # define MacroFile svr4.cf # undef SVR4 # else /* ! SVR4 */ # ifdef ISC # define i386Architecture # define i386SVR3Architecture # define MacroIncludeFile # define MacroFile isc.cf # define i386IscArchitecture # undef ISC # ifdef ISC202 # define IscVersion 202 # undef ISC202 # else # ifdef ISC30 # define IscVersion 300 # undef ISC30 # else # ifdef ISC40 # define IscVersion 400 # undef ISC40 # else # define IscVersion 221 # endif /* ISC40 */ # endif /* ISC30 */ # endif /* ISC202 */ # endif /* ISC */ # ifndef MacroFile # define i386SVR3Architecture # define MacroIncludeFile # define MacroFile x386.cf # endif /* MacroFile */ # endif /* ! SVR4 */ #endif /* SYSV386 */ #ifdef __convex__ # define MacroIncludeFile # define MacroFile convex.cf # ifdef convex # undef convex # endif # define ConvexArchitecture #endif /* _convex_ */ #ifdef Oki # define MacroIncludeFile # define MacroFile Oki.cf # undef Oki # define i860SVR4Architecture # define SVR4Architecture # undef SVR4 #endif /* Oki */ #if defined(WIN32) && !defined(__GNUC__) # define MacroIncludeFile # define MacroFile Win32.cf # define Win32Architecture #endif /* WIN32 */ #if defined(WIN32) && defined(__GNUC__) #define MacroIncludeFile #define MacroFile mingw.cf #define Win32Architecture #define mingwArchitecture #define i386Architecture #undef i386 #undef i486 #undef i586 #undef i686 #undef __i386__ #undef _X86_ #undef __MINGW32__ #endif /* CYGWIN */ #if defined(linux) || defined(__GLIBC__) # define MacroIncludeFile # define MacroFile linux.cf # undef linux # ifdef __linux__ # define LinuxArchitecture # endif # ifdef i386 # ifndef i386Architecture # define i386Architecture # endif # undef i386 XCOMM Keep cpp from replacing path elements containing i486/i586/i686 # ifdef i486 # ifndef i386Architecture # define i386Architecture # endif # undef i486 # endif # ifdef i586 # ifndef i386Architecture # define i386Architecture # endif # undef i586 # endif # ifdef i686 # ifndef i386Architecture # define i386Architecture # endif # undef i686 # endif # ifdef k6 # ifndef i386Architecture # define i386Architecture # endif # undef k6 # endif # endif /* k6 */ # ifdef __i386__ # ifndef i386Architecture # define i386Architecture # endif # undef __i386__ # endif /* __i386__ */ # ifdef __i486__ # ifndef i386Architecture # define i386Architecture # endif # undef __i486__ # endif /* __i486__ */ # ifdef __i586__ # ifndef i386Architecture # define i386Architecture # endif # undef __i586__ # endif /* __i586__ */ # ifdef __i686__ # ifndef i386Architecture # define i386Architecture # endif # undef __i686__ # endif /* __i686__ */ # ifdef __k6__ # ifndef i386Architecture # define i386Architecture # endif # undef __k6__ # endif /* __k6__ */ # ifdef __i386 # ifndef i386Architecture # define i386Architecture # endif # undef __i386 # endif /* __i386 */ # ifdef __i486 # ifndef i386Architecture # define i386Architecture # endif # undef __i486 # endif /* __i486 */ # ifdef __i586 # ifndef i386Architecture # define i386Architecture # endif # undef __i586 # endif /* __i586 */ # ifdef __i686 # ifndef i386Architecture # define i386Architecture # endif # undef __i686 # endif /* __i686 */ # ifdef __k6 # ifndef i386Architecture # define i386Architecture # endif # undef __k6 # endif /* __k6 */ /* Keep this order! s390x has also __s390__ defined */ # if defined(__s390x__) # define s390xArchitecture # undef __s390x__ # undef __s390__ # endif # ifdef __s390__ # define s390Architecture # undef __s390__ # endif /* s390 */ # ifdef __alpha # define AlphaArchitecture # undef __alpha # endif /* __alpha */ # ifdef __alpha__ # ifndef AlphaArchitecture # define AlphaArchitecture # endif # undef __alpha__ # endif /* __alpha__ */ # ifdef __arm__ # define Arm32Architecture # undef arm # undef __arm # undef __arm__ # if defined(__ARMEB__) # define Arm32ebArchitecture # endif # undef __ARMEB__ # endif # ifdef __aarch64__ # define Arm64Architecture # endif # ifdef mc68000 # define Mc68020Architecture # undef mc68000 # endif /* mc68000 */ # if defined (powerpc) && !defined(__powerpc64__) && !defined (powerpc64) # define PpcArchitecture # undef powerpc # endif # if defined (__powerpc__) && !defined(__powerpc64__) && !defined (powerpc64) # ifndef PpcArchitecture # define PpcArchitecture # endif # undef __powerpc__ # endif # ifdef __powerpc64__ /* Can be both BE or LE. Trust that __BYTE_ORDER__ is set. */ # undef tmp_set_big_endian # define tmp_set_big_endian 1 # if defined (__BYTE_ORDER__) && defined (__ORDER_LITTLE_ENDIAN__) && defined (__ORDER_BIG_ENDIAN__) # if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ # define tmp_set_big_endian 0 # endif # endif # if tmp_set_big_endian # ifndef Ppc64Architecture # define Ppc64Architecture # endif # else # ifndef Ppc64LeArchitecture # define Ppc64LeArchitecture # endif # endif # undef __powerpc64__ # undef tmp_set_big_endian # endif # ifdef sparc # define SparcArchitecture # undef sparc # endif # ifdef __sparc__ # ifndef SparcArchitecture # define SparcArchitecture # endif # undef __sparc__ # endif # ifdef ia64 # define ia64Architecture # undef ia64 # endif # ifdef __ia64__ # ifndef ia64Architecture # define ia64Architecture # endif # undef __ia64__ # endif # if defined(mips) || defined(__mips__) # define MipsArchitecture # undef mips # undef __mips__ # if defined(MIPSEL) || defined(_MIPSEL) # define MipselArchitecture # if (_MIPS_SIM == _ABI64) # define Mips64elArchitecture # endif # endif # undef MIPSEL # undef _MIPSEL # endif # ifdef __hppa__ # ifndef HPArchitecture # define HPArchitecture # endif # undef __hppa__ # endif /* __hppa__ */ # ifdef __sh__ # ifndef SuperHArchitecture # define SuperHArchitecture # endif # ifdef __BIG_ENDIAN__ # ifndef SuperHebArchitecture # define SuperHebArchitecture # endif # endif # undef __sh__ # endif /* __sh__ */ # if defined(__SH3__) || defined(__sh3__) # ifndef SuperH3Architecture # define SuperH3Architecture # endif # undef __SH3__ # undef __sh3__ # endif /* __SH3__ or __sh3__ */ # ifdef __SH4__ # ifdef __SH4_NOFPU__ # ifndef SuperH4NOFPUArchitecture # define SuperH4NOFPUArchitecture # endif # undef __SH4_NOFPU__ # else # ifndef SuperH4Architecture # define SuperH4Architecture # endif # endif # undef __SH4__ # endif /* __SH4__ */ /* for compatibility with 3.3.x */ # ifdef PpcArchitecture # define PowerPCArchitecture # endif # if defined(__s390x__) # define s390xArchitecture # undef __s390x__ # endif # if defined(__amd64__) || defined (__x86_64__) # undef __amd64__ # undef __x86_64__ # define AMD64Architecture # endif # if defined(amd64__) || defined (x86_64__) # undef amd64__ # undef x86_64__ # ifndef AMD64Architecture # define AMD64Architecture # endif # endif #endif /* linux || __GLIBC__ */ #ifdef __uxp__ # define MacroIncludeFile # define MacroFile fujitsu.cf # define FujitsuArchitecture # undef __uxp__ # define UXPArchitecture # define SVR4Architecture # ifdef sparc # undef sparc # define SparcArchitecture # endif #endif /* __uxp__ */ #ifdef __sxg__ # define MacroIncludeFile # define MacroFile fujitsu.cf # define FujitsuArchitecture # undef __sxg__ # define mc68000Architecture #endif /* __sxg__ */ #ifdef _SEQUENT_ /* undefine assignments resulting from -DSVR4 */ # undef MacroIncludeFile # define MacroIncludeFile # undef MacroFile # define MacroFile sequent.cf # undef _SEQUENT_ # define DynixPtxArchitecture # define SequentArchitecture #endif #if defined(_nec_ews_svr4) || defined(nec_ews_svr4) || defined(nec_ews_svr2) || defined(SX) || defined(_nec_up) || defined(_nec_ft) || defined(PC_UX) # ifdef nec # undef nec # endif # define MacroIncludeFile # define MacroFile nec.cf # define NecArchitecture #endif #ifdef minix #define MacroIncludeFile #define MacroFile minix.cf #undef minix #define MinixArchitecture #define i386Architecture #endif /* minix */ /* Systems with GNU libc and userland */ #if defined(__GNU__) #define GNUArchitecture #define MacroIncludeFile #define MacroFile gnu.cf #ifdef __i386__ #define i386Architecture #endif #endif #ifdef MACH #ifdef __GNU__ /* Mach-based GNU system */ #define GNUMachArchitecture #else #define MacroIncludeFile #define MacroFile mach.cf #endif #undef MACH #ifdef i386 #define i386MachArchitecture #define i386Architecture #endif /* i386 */ #undef i386 #endif /* MACH */ /* On NetBSD, `unix' is not defined, and cpp emits a warning every time * it sees a test using the `unix' symbol */ #if !defined(NetBSDArchitecture) || (defined(NetBSDArchitecture) && DefaultOSMajorVersion == 1 && DefaultOSMinorVersion <= 3) #ifdef unix #undef unix #endif #endif #ifdef SparcArchitecture # if defined(__sparc_v9) || defined(__arch64__) # define Sparc64Architecture # endif #endif #ifndef MacroIncludeFile XCOMM WARNING: Imake.cf not configured; guessing at definitions!!! XCOMM This might mean that BOOTSTRAPCFLAGS was not set when building imake. #define MacroIncludeFile #define MacroFile generic.cf #endif nx-libs-3.5.99.23/nx-X11/config/cf/Imakefile0000644000000000000000000000261713614532331014757 0ustar XCOMM Some compilers generate fatal errors if an -L directory does XCOMM not exist. Since BUILDLIBDIR may not exist yet suppress its use. LDPRELIB = LDPRELIBS = #ifdef LocalConfigFiles LOCALFILES = LocalConfigFiles #endif #ifndef InstallEmptyHostDef HOSTDEFFILES = \ host.def #endif #if defined(XorgVersion) VERSIONDEFFILES = #endif DEFFILES = \ xorgsite.def \ $(VERSIONDEFFILES) \ $(HOSTDEFFILES) \ site.def \ xorgversion.def \ nxversion.def RULEFILES = \ X11.rules \ lnxLib.rules \ noop.rules \ xf86.rules TMPLFILES = \ Library.tmpl \ Server.tmpl \ ServerLib.tmpl \ Threads.tmpl \ X11.tmpl \ lnxLib.tmpl \ xorg.tmpl CFFILES = \ linux.cf \ xorg.cf INSTFILES = $(RULEFILES) $(TMPLFILES) $(DEFFILES) $(CFFILES) $(LOCALFILES) all:: #if BuildLibraries InstallMultipleDestFlags(install,$(INSTFILES),$(CONFIGDIR),$(INSTDATFLAGS)) #endif InstallDriverSDKMultipleDestFlags($(INSTFILES),$(DRIVERSDKDIR)/config/cf,$(INSTDATFLAGS)) #ifdef InstallEmptyHostDef install:: @(TMP=/tmp/tmp.$$$$; \ RemoveFile($${TMP}); \ echo "" > $${TMP}; \ $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) $${TMP} \ $(DESTDIR)$(CONFIGDIR)/host.def; \ RemoveFile($${TMP})) #if defined(XorgVersion) install.sdk:: @(TMP=/tmp/tmp.$$$$; \ RemoveFile($${TMP}); \ echo "" > $${TMP}; \ $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) $${TMP} \ $(DESTDIR)$(DRIVERSDKDIR)/config/cf/host.def; \ RemoveFile($${TMP})) #endif #endif nx-libs-3.5.99.23/nx-X11/config/cf/Imake.rules0000644000000000000000000034041513614532331015251 0ustar XCOMM --------------------------------------------------------------------- XCOMM Imake rules for building libraries, programs, scripts, and data files XCOMM --------------------------------------------------------------------- /* * MACHINE-INDEPENDENT RULES; DO NOT MODIFY * * Warning, when defining rules: make sure you do not include both a trailing * backslash and double ampersand backslash or else you will get an extra * backslash in the Makefile. * * The following macros are defined for the various templates and Imakefiles * (for a list of the applicable make variables, see the template files): * * Concat (a,b) * Concat3 (a,b,c) * Concat4 (a,b,c,d) * _Use (a,b) * _UseCat (a,b,c) * _MUse (a,b) * _MUseCat (a,b,c) * ProgramTargetName (target) * HostProgramTargetName (target) * ProgramRelinkName (target) * RunProgram (progvar,options) * RunProgramWithSetup (setup,progvar,options) * RemoveFile (file) * RemoveFiles (files) * CenterLoadTarget (target,srclist,libs,defines) * CenterProgramTarget (program,srclist,objlist,locallibs,syslibs) * SentinelLinkTarget (step,program,linklist) * SentinelProgramTarget (program,deplist,linklist) * SentinelCplusplusProgramTarget (program,deplist,linklist) * PurifyLinkTarget (step,program,linklist) * PurifyProgramTarget (program,deplist,linklist) * PurifyCplusplusProgramTarget (program,deplist,linklist) * ProofLinkTarget (step,program,linklist) * ProofProgramTarget (program,deplist,linklist) * ProofCplusplusProgramTarget (program,deplist,linklist) * ProofCleanTarget () * RemoveTargetProgram (program) * MakeDir (dir) * InstallDirectory (dir) * BuildIncludesTop (srclist) * BuildIncludes (srclist,dstsubdir,dstupdir) * LinkRule (program,options,objects,libraries) * HostLinkRule (program,options,objects,libraries) * LinkInstallRule (program,options,objects,libraries) * NoCmpScript (target) * NoConfigRec (target) * NormalProgramTarget (program,objects,deplibs,locallibs,syslibs) * SetUIDProgramTarget (program,objects,deplibs,locallibs,syslibs) * SingleProgramTarget (program,objects,locallibs,syslibs) * SimpleProgramTarget (program) * ComplexProgramTarget (program) * ComplexProgramTarget_1 (program,locallib,syslib) * ComplexProgramTarget_2 (program,locallib,syslib) * ComplexProgramTarget_3 (program,locallib,syslib) * ServerTargetWithFlags (server,subdirs,objects,libs,syslibs,flags) * ServerTarget (server,subdirs,objects,libs,syslibs) * LibX11Links () * MoveToBakFile (file) * RMoveToBakFile (file) * RanLibrary (args) * LibraryTargetName (libname) * LibraryTargetNameSuffix (libname,suffix) * InstallNamedTarget (step,srcname,flags,dest,dstname) * InstallTarget (step,file,flags,dest) * InstallLibrary (libname,dest) * MergeIntoInstalledLibrary (tolib,fromlib) * InstallLibraryAlias (libname,alias,dest) * InstallLintLibrary (libname,dest) * InstallManPageLong (file,destdir,dest) * InstallManPage (file,destdir) * InstallManPageAliases (file,destdir,aliases) * ManKeywordsTarget (manpath) * InstallNamedNonExec (srcname,dstname,dest) * InstallNonExecFile (file,dest) * InstallNonExecFileNoClobber (file,dest) * InstallNonExec (file,dest) * InstallProgramWithFlags (program,dest,flags) * RelinkProgram (program,objects,libs,syslibs) * InstallProgram (program,dest) * InstallScript (program,dest) * InstallNamedProg (srcname,dstname,dest) * InstallNamedProgNoClobber (srcname,dstname,dest) * MakeFlagsToShellFlags (makeflags,shellcmd) * MakeNamedTargetSubdir (dir,flags,subname) * LinkConfDirectoryLong (mdir,cdir,rdir,ldir,opath,npath) * LinkConfDirectory (mdir,cdir,rdir,ldir) * LinkConfFileLong (cfile,lfile,opath,npath) * LinkConfFile (cfile,lfile) * LinkFileList (step,list,dir,sub) * LinkVarDirectory (mdir,cdir,rdir,ldir) * InstallMultipleDestFlags (step,list,dest,flags) * InstallMultipleDest (step,list,dest) * InstallMultiple (list,dest) * InstallMultipleFlags (list,dest,flags) * InstallMultipleMan (list,dest) * InstallMultipleManSuffix (list,dest,suffix) * DependDependency () * DependTarget () * DependTarget3 (srcs1,srcs2,srcs3) * CleanTarget () * TagsTarget () * ImakeDependency (target) * BuildMakefileTarget (notused,imakeflags) * MakefileTarget () * LibMkdir (dir) * LibCleanDir (dir) * LintLibReferences (varname,libname,libsource) * UnsharedLibReferences (varname,libname,libsource) * ProjectUnsharedLibReferences (varname,libname,libsource,buildlibdir) * SharedLibDependencies (libname,libsource,revname) * SharedDSLibDependencies (libname,libsource,revname) * SharedLibReferences (varname,libname,libsource,revname,rev) * SharedDSLibReferences (varname,libname,libsource,revname,rev) * ObjectCompile (options) * NormalLibObjCompile (options) * NormalSharedLibObjCompile (options) * NormalRelocLibObjCompile (options) * LibObjCompile (dir,options) * DebuggedLibObjCompile (options) * ProfiledLibObjCompile (options) * SharedLibObjCompile (options) * NormalLibraryObjectRule () * NormalFortranObjectRule () * ObjectFromSpecialSource (dst,src,flags) * SpecialObjectRule (objs,depends,options) * SpecialCObjectRule (basename,depends,options) * LexFile (file) * M4File (file,includes) * YaccFile (file,flags) * YaccFileNoFlags (file) * MakeLibrary (libname,objlist) * LinkBuildLibrary (lib) * LinkBuildSonameLibrary (lib) * NormalLibraryTarget (libname,objlist) * NormalLibraryTarget2 (libname,objlist1,objlist2) * NormalLibraryTarget3 (libname,objlist1,objlist2,objlist3) * NormalDepLibraryTarget (libname,deplist,objlist) * UnsharedLibraryTarget (libname,objlist,down,up) * UnsharedLibraryTarget3 (libname,objlist1,objlist2,objlist3,down,up) * SubdirLibraryRule (objlist) * ProfiledLibraryTarget (libname,objlist) * DebuggedLibraryTarget (libname,objlist) * AliasedLibraryTarget (libname,alias) * NormalRelocatableTarget (objname,objlist) * ProfiledRelocatableTarget (objname,objlist) * DebuggedRelocatableTarget (objname,objlist) * LintLibraryTarget (libname,srclist) * NormalLintTarget (srclist) * LintTarget () * LinkSourceFile (src,dir) * LinkFile (tofile,fromfile) * MakeSubincludesForBuild (step,dir,srclist) * LangNamedTargetSubdirs (lang,name,dirs,verb,flags,subname) * LangNamedMakeSubdirs (lang,name,dirs) * LangMakeSubdirs (lang,dirs) * NamedTargetSubdirs (name,dirs,verb,flags,subname) * NamedMakeSubdirs (name,dirs) * MakeSubdirs (dirs) * DependSubdirs (dirs) * ForceSubdirs (dirs) * InstallSubdirs (dirs) * InstallManSubdirs (dirs) * IncludesSubdirs (dirs) * NamedCleanSubdirs (name,dirs) * CleanSubdirs (dirs) * NamedTagSubdirs (name,dirs) * TagSubdirs (dirs) * MakeLintSubdirs (dirs,target,subtarget) * LintSubdirs (dirs) * MakeLintLibSubdirs (dirs) * MakeMakeSubdirs (dirs,target) * MakefileSubdirs (dirs) * CppScriptTarget (dst,src,defs,deplist) * MakeScriptFromCpp (name,defs) * CppFileTarget (dst,src,defs,deplist) * CppSourceFile (dst,src,defs,deplist) * MakeDirectories (step,dirs) * AllTarget (depends) * StaticLibrary (libpath,libname) * MakeMutex (targets) * LinkBuildModule (module,subdir) * LinkBuildNamedModule (module,name,subdir) * DynamicModuleTarget (module,modlist) * InstallDynamicModule (module,dest,subdir) * InstallDynamicNamedModule (module,instname,dest,subdir) * LinkerRuntimeLibraryPathFlag (path) * * * The following are in specific Lib.rules: * * SharedLibraryTarget (libname,rev,solist,down,up) * SharedLibraryDataTarget (libname,rev,salist) * InstallSharedLibrary (libname,rev,dest) * InstallSharedLibraryData (libname,rev,dest) * SharedDepModuleTarget (name,deps,solist) * */ #define NullParameter /* if [ -d ] or [ ! -d ] causes make to fail, define this as - */ #ifndef DirFailPrefix #define DirFailPrefix #endif /* * NoCmpScript - suppress clearmake build script comparison. */ #ifndef NoCmpScript #if HasClearmake #define NoCmpScript(targ) @@\ XCOMM special target for clearmake @@\ .NO_CMP_SCRIPT: targ #else #define NoCmpScript(targ) /**/ #endif #endif /* * NoConfigRec - suppress using clearmake configuration records. */ #ifndef NoConfigRec #if HasClearmake #define NoConfigRec(targ) @@\ XCOMM special target for clearmake @@\ .NO_CONFIG_REC: targ #else #define NoConfigRec(targ) /**/ #endif #endif /* * Concat - concatenates two strings. */ #ifndef Concat #if (defined(__STDC__) && !defined(UnixCpp)) || defined(AnsiCpp) #define Concat(a,b)a##b #else #define Concat(a,b)a/**/b #endif #endif /* * Concat3 - concatenates three strings. */ #ifndef Concat3 #if (defined(__STDC__) && !defined(UnixCpp)) || defined(AnsiCpp) #define Concat3(a,b,c)a##b##c #else #define Concat3(a,b,c)a/**/b/**/c #endif #endif /* * Concat4 - concatenates four strings. */ #ifndef Concat4 #if (defined(__STDC__) && !defined(UnixCpp)) || defined(AnsiCpp) #define Concat4(a,b,c,d)a##b##c##d #else #define Concat4(a,b,c,d)a/**/b/**/c/**/d #endif #endif /* * _XUse - makes a choice based on UseInstalledX11. */ #ifndef _XUse # if defined(UseInstalled) || UseInstalledX11 # define _XUse(a,b) a # else # define _XUse(a,b) b # endif #endif /* _XUse */ /* * _Use - makes a choice based on UseInstalled. */ #ifndef _Use # define _Use _XUse #endif /* _Use */ /* * _XUseCat - combination of _XUse and Concat. * exists to avoid problems with some preprocessors */ #ifndef _XUseCat # if (defined(__STDC__) && !defined(UnixCpp)) || defined(AnsiCpp) # if defined(UseInstalled) || UseInstalledX11 # define _XUseCat(a,b,c) a##c # else # define _XUseCat(a,b,c) b##c # endif # else # if defined(UseInstalled) || UseInstalledX11 # define _XUseCat(a,b,c) a/**/c # else # define _XUseCat(a,b,c) b/**/c # endif # endif #endif /* _XUseCat */ /* * _UseCat - combination of _Use and Concat. * exists to avoid problems with some preprocessors */ #ifndef _UseCat # define _UseCat _XUseCat #endif /* _UseCat */ #ifndef ProgramTargetName #define ProgramTargetName(target)target #endif #ifndef HostProgramTargetName #define HostProgramTargetName(target)target #endif #ifndef ProgramRelinkName #define ProgramRelinkName(target)Concat(target,-relink) #endif #ifndef RunProgram #define RunProgram(progvar,options) $(progvar) options #endif #ifndef RunProgramWithSetup #define RunProgramWithSetup(setup,progvar,options) setup $(progvar) options #endif #ifndef RunPerlScript #define RunPerlScript(script,options) $(PERLENVSETUP) $(PERL) $(PERLOPTS) script options #endif #ifndef RemoveFile #define RemoveFile(file) $(RM) file #endif /* RemoveFile */ #ifndef RemoveFiles #define RemoveFiles(files) $(RM) files #endif /* RemoveFiles */ #if RemoveObsoleteFiles #define RemoveOldFile(new,old,dir) @@\ @if [ -f new ]; then set -x; \ @@\ RemoveFile($(DESTDIR)dir/old); \ @@\ fi #else #define RemoveOldFile(new,old,dir) $(_NULLCMD_) #endif /* * CenterLoadTarget - generate rules to load files into CodeCenter */ #ifndef CenterLoadTarget #if HasCodeCenter #define CenterLoadTarget(target,srclist,libs,defines) @@\ ProgramTargetName(target):: srclist @@\ XCOMM load defines srclist libs #else #define CenterLoadTarget(target,srclist,libs,defines) /**/ #endif #endif /* CenterLoadTarget */ /* * CenterProgramTarget - generate rules to make CodeCenter read in sources * and objects. */ #ifndef CenterProgramTarget #define CenterProgramTarget(program,srclist,objlist,locallibs,syslibs) @@\ CenterLoadTarget(Concat(debug_,program),srclist,$(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS) $(LDPRELIBS) locallibs $(LDLIBS) syslibs,$(ALLDEFINES)) @@\ @@\ CenterLoadTarget(Concat(odebug_,program),objlist,$(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS) $(LDPRELIBS) locallibs $(LDLIBS) syslibs,$(ALLDEFINES)) #endif /* CenterProgramTarget */ #ifndef SentinelLinkTarget #if HasSentinel #define SentinelLinkTarget(step,program,linklist) @@\ ProgramTargetName(step.sentinel): @@\ RemoveTargetProgram($@) @@\ $(CCENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CC) -o program.sentinel $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) #else #define SentinelLinkTarget(step,program,linklist) /**/ #endif #endif /* SentinelLinkTarget */ /* * SentinelProgramTarget - generate rules to make Sentinel image */ #ifndef SentinelProgramTarget #if HasSentinel #define SentinelProgramTarget(program,deplist,linklist) @@\ ProgramTargetName(program.sentinel): deplist @@\ RemoveTargetProgram($@) @@\ $(CCENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\ @@\ clean clean.sentinel:: @@\ RemoveFile(program.sentinel) #else #define SentinelProgramTarget(program,deplist,linklist) /**/ #endif #endif /* SentinelProgramTarget */ /* * SentinelCplusplusProgramTarget - generate rules to make Sentinel image */ #ifndef SentinelCplusplusProgramTarget #if HasSentinel #define SentinelCplusplusProgramTarget(program,deplist,linklist) @@\ ProgramTargetName(program.sentinel): deplist @@\ RemoveTargetProgram($@) @@\ $(CXXENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\ @@\ clean clean.sentinel:: @@\ RemoveFile(program.sentinel) #else #define SentinelCplusplusProgramTarget(program,deplist,linklist) /**/ #endif #endif /* SentinelCplusplusProgramTarget */ #ifndef PurifyLinkTarget #if HasPurify #define PurifyLinkTarget(step,program,linklist) @@\ ProgramTargetName(step.pure): @@\ RemoveTargetProgram($@) @@\ $(CCENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CC) -o program.pure $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) #else #define PurifyLinkTarget(step,program,linklist) /**/ #endif #endif /* PurifyLinkTarget */ /* * PurifyProgramTarget - generate rules to make Purify'ed image */ #ifndef PurifyProgramTarget #if HasPurify #define PurifyProgramTarget(program,deplist,linklist) @@\ ProgramTargetName(program.pure): deplist @@\ RemoveTargetProgram($@) @@\ $(CCENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\ @@\ clean clean.pure:: @@\ RemoveFile(program.pure) #else #define PurifyProgramTarget(program,deplist,linklist) /**/ #endif #endif /* PurifyProgramTarget */ /* * PurifyCplusplusProgramTarget - generate rules to make Purify'ed image */ #ifndef PurifyCplusplusProgramTarget #if HasPurify #define PurifyCplusplusProgramTarget(program,deplist,linklist) @@\ ProgramTargetName(program.pure): deplist @@\ RemoveTargetProgram($@) @@\ $(CXXENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\ @@\ clean clean.pure:: @@\ RemoveFile(program.pure) #else #define PurifyCplusplusProgramTarget(program,deplist,linklist) /**/ #endif #endif /* PurifyCplusplusProgramTarget */ #ifndef ProofLinkTarget #if HasTestCenter #define ProofLinkTarget(step,program,linklist) @@\ ProgramTargetName(step.tc): @@\ RemoveTargetProgram($@) @@\ $(CCENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CC) -o program.tc $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) #else #define ProofLinkTarget(step,program,linklist) /**/ #endif #endif /* ProofLinkTarget */ /* * ProofProgramTarget - generate rules to make Proof'ed image */ #ifndef ProofProgramTarget #if HasTestCenter #define ProofProgramTarget(program,deplist,linklist) @@\ ProgramTargetName(program.tc): deplist @@\ RemoveTargetProgram($@) @@\ $(CCENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\ @@\ clean cleantc:: @@\ RemoveFiles(program.tc program.tc.*.*) #else #define ProofProgramTarget(program,deplist,linklist) /**/ #endif #endif /* ProofProgramTarget */ /* * ProofCplusplusProgramTarget - generate rules to make Proof'ed image */ #ifndef ProofCplusplusProgramTarget #if HasTestCenter #define ProofCplusplusProgramTarget(program,deplist,linklist) @@\ ProgramTargetName(program.tc): deplist @@\ RemoveTargetProgram($@) @@\ $(CXXENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\ @@\ clean cleantc:: @@\ RemoveFiles(program.tc program.tc.*.*) #else #define ProofCplusplusProgramTarget(program,deplist,linklist) /**/ #endif #endif /* ProofCplusplusProgramTarget */ #ifndef ProofCleanTarget #if HasTestCenter #define ProofCleanTarget() @@\ clean cleantc:: @@\ $(RM) -r TC.Cache #else #define ProofCleanTarget() /**/ #endif #endif /* ProofCleanTarget */ #ifndef RemoveTargetProgram #if RemoveTargetProgramByMoving #define RemoveTargetProgram(program) \ -if [ -f program ]; then RemoveFile(Concat(program,~)); $(MV) program Concat(program,~); fi #else #define RemoveTargetProgram(program) RemoveFile(program) #endif #endif /* RemoveTargetProgram */ #ifndef MakeDir #define MakeDir(dir) DirFailPrefix@if [ -d dir ]; then \ @@\ set +x; \ @@\ else \ @@\ if [ -h dir ]; then \ @@\ (set -x; rm -f dir); \ @@\ fi; \ @@\ (set -x; $(MKDIRHIER) dir); \ @@\ fi #endif /* MakeDir */ #ifndef MakeDirInline #define MakeDirInline(dir) if [ -d dir ]; then \ @@\ :; \ @@\ else \ @@\ if [ -h dir ]; then \ @@\ (set -x; rm -f dir); \ @@\ fi; \ @@\ (set -x; $(MKDIRHIER) dir); \ @@\ fi #endif /* MakeDirInline */ #ifndef InstallDirectory #define InstallDirectory(dir) @@\ install:: @@\ MakeDir(dir) #endif /* InstallDirectory */ #ifndef InstallCreateLink # define InstallCreateLink(dest,from,to) @@\ install:: @@\ cd $(DESTDIR)dest && \ @@\ $(LN) -sf from to #endif #ifndef BuildIncludesTop #define BuildIncludesTop(srclist) @@\ includes:: srclist @@\ MakeDir($(BUILDINCDIR)) @@\ @(set -x; cd $(BUILDINCDIR) && for i in srclist; do \ @@\ RemoveFile(`basename $$i`); \ @@\ $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/$$i .; \ @@\ done) #endif /* BuildIncludesTop */ #ifndef BuildIncludes #define BuildIncludes(srclist,dstsubdir,dstupdir) @@\ includes:: srclist @@\ MakeDir($(BUILDINCDIR)/dstsubdir) @@\ @(set -x; cd $(BUILDINCDIR)/dstsubdir && for i in srclist; do \ @@\ RemoveFile(`basename $$i`); \ @@\ $(LN) $(BUILDINCTOP)/dstupdir/$(CURRENT_DIR)/$$i .; \ @@\ done) #endif /* BuildIncludes */ /* * LinkBuildBinary - export a binary from the build tree. */ #ifndef LinkBuildBinary #define LinkBuildBinary(binary) @@\ all:: $(BUILDBINDIR)/binary binary @@\ @@\ $(BUILDBINDIR)/binary: binary @@\ MakeDir($(BUILDBINDIR)) @@\ RemoveFile($@) @@\ cd $(BUILDBINDIR) && $(LN) $(BUILDBINTOP)/$(CURRENT_DIR)/binary . #endif /* LinkBuildBinary */ #ifndef BuildInterfaces #define BuildInterfaces(srclist,dstsubdir,dstupdir) @@\ interfaces:: @@\ MakeDir($(BUILDINCDIR)/dstsubdir) @@\ @(set -x; cd $(BUILDINCDIR)/dstsubdir && for i in srclist; do \ @@\ RemoveFile($$i); \ @@\ $(LN) $(BUILDINCTOP)/dstupdir/$(CURRENT_DIR)/$$i .; \ @@\ done) #endif /* BuildInterfaces */ /* * LinkRule - link a program */ #ifndef LinkRule #define LinkRule(program,options,objects,libraries) \ $(CCLINK) -o program options objects libraries $(EXTRA_LOAD_FLAGS) #endif /* LinkRule */ /* * LinkRule - link a program, suitable for later installation */ #ifndef LinkInstallRule #define LinkInstallRule(program,options,objects,libraries) \ $(CCLINK) -o program options objects libraries $(EXTRA_INSTALL_LOAD_FLAGS) #endif /* LinkInstallRule */ /* * HostLinkRule - link a utility to be used on the build host * (differs from LinkRule if cross compiling) */ #ifndef HostLinkRule #define HostLinkRule LinkRule #endif #ifndef CplusplusLinkRule #define CplusplusLinkRule(program,options,objects,libraries) \ $(CXXLINK) -o program options objects libraries $(EXTRA_LOAD_FLAGS) #endif /* CplusplusLinkRule */ /* * NormalProgramTarget - generate rules to compile and link the indicated * program; since it does not use any default object files, it may be used for * multiple programs in the same Imakefile. */ #ifndef NormalProgramTarget #define NormalProgramTarget(program,objects,deplibs,locallibs,syslibs) @@\ ProgramTargetName(program): objects deplibs @@\ RemoveTargetProgram($@) @@\ LinkRule($@,$(LDOPTIONS),objects,locallibs $(LDLIBS) syslibs) @@\ @@\ SentinelProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\ PurifyProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\ ProofProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\ @@\ clean:: @@\ RemoveFile(ProgramTargetName(program)) #endif /* NormalProgramTarget */ /* * NormalCplusplusProgramTarget - Like NormalTargetProgram, but uses * C++ linking rules. */ #ifndef NormalCplusplusProgramTarget #define NormalCplusplusProgramTarget(program,objects,deplibs,locallibs,syslibs) @@\ ProgramTargetName(program): objects deplibs @@\ RemoveTargetProgram($@) @@\ CplusplusLinkRule($@,$(CXXLDOPTIONS),objects,locallibs $(LDLIBS) syslibs) @@\ @@\ SentinelCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\ PurifyCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\ ProofCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\ @@\ clean:: @@\ RemoveFile(ProgramTargetName(program)) #endif /* NormalCplusplusProgramTarget */ #ifndef SetUIDProgramTarget #define SetUIDProgramTarget NormalProgramTarget #endif /* * SingleProgramTarget - obsolete version of NormalProgramTarget that does * not have deplibs. */ #ifndef SingleProgramTarget #define SingleProgramTarget(program,objects,locallibs,syslibs) @@\ NormalProgramTarget(program,objects,NullParameter,locallibs,syslibs) #endif /* SingleProgramTarget */ /* * SimpleProgramTarget - generate rules for compiling and linking programs * that only have one C source file. It should only be used in Imakefiles * that describe a single program. */ #ifndef SimpleProgramTarget #define SimpleProgramTarget(program) @@\ OBJS = program.o @@\ SRCS = program.c @@\ @@\ ComplexProgramTarget(program) #endif /* SimpleProgramTarget */ #ifndef SimpleProgramTarget_1 #define SimpleProgramTarget_1(program) @@\ OBJS1 = program.o @@\ SRCS1 = program.c @@\ @@\ ComplexProgramTarget_1(program,$(LOCAL_LIBRARIES),NullParameter) #endif /* SimpleProgramTarget_1 */ #ifndef SimpleProgramTarget_2 #define SimpleProgramTarget_2(program) @@\ OBJS2 = program.o @@\ SRCS2 = program.c @@\ @@\ ComplexProgramTarget_2(program,$(LOCAL_LIBRARIES),NullParameter) #endif /* SimpleProgramTarget_2 */ #ifndef SimpleProgramTarget_3 #define SimpleProgramTarget_3(program) @@\ OBJS3 = program.o @@\ SRCS3 = program.c @@\ @@\ ComplexProgramTarget_3(program,$(LOCAL_LIBRARIES),NullParameter) #endif /* SimpleProgramTarget_3 */ #ifndef SimpleProgramTarget_4 #define SimpleProgramTarget_4(program) @@\ OBJS4 = program.o @@\ SRCS4 = program.c @@\ @@\ ComplexProgramTarget_4(program,$(LOCAL_LIBRARIES),NullParameter) #endif /* SimpleProgramTarget_4 */ #ifndef SimpleProgramTarget_5 #define SimpleProgramTarget_5(program) @@\ OBJS5 = program.o @@\ SRCS5 = program.c @@\ @@\ ComplexProgramTarget_5(program,$(LOCAL_LIBRARIES),NullParameter) #endif /* SimpleProgramTarget_5 */ #ifndef SimpleProgramTarget_6 #define SimpleProgramTarget_6(program) @@\ OBJS6 = program.o @@\ SRCS6 = program.c @@\ @@\ ComplexProgramTarget_6(program,$(LOCAL_LIBRARIES),NullParameter) #endif /* SimpleProgramTarget_6 */ #ifndef SimpleProgramTarget_7 #define SimpleProgramTarget_7(program) @@\ OBJS7 = program.o @@\ SRCS7 = program.c @@\ @@\ ComplexProgramTarget_7(program,$(LOCAL_LIBRARIES),NullParameter) #endif /* SimpleProgramTarget_7 */ #ifndef SimpleProgramTarget_8 #define SimpleProgramTarget_8(program) @@\ OBJS8 = program.o @@\ SRCS8 = program.c @@\ @@\ ComplexProgramTarget_8(program,$(LOCAL_LIBRARIES),NullParameter) #endif /* SimpleProgramTarget_8 */ #ifndef SimpleProgramTarget_9 #define SimpleProgramTarget_9(program) @@\ OBJS9 = program.o @@\ SRCS9 = program.c @@\ @@\ ComplexProgramTarget_9(program,$(LOCAL_LIBRARIES),NullParameter) #endif /* SimpleProgramTarget_9 */ #ifndef SimpleProgramTarget_10 #define SimpleProgramTarget_10(program) @@\ OBJS10 = program.o @@\ SRCS10 = program.c @@\ @@\ ComplexProgramTarget_10(program,$(LOCAL_LIBRARIES),NullParameter) #endif /* SimpleProgramTarget_10 */ #ifndef SimpleCplusplusProgramTarget #define SimpleCplusplusProgramTarget(program) @@\ OBJS = program.o @@\ SRCS = program.CCsuf @@\ @@\ ComplexCplusplusProgramTarget(program) #endif /* SimpleCplusplusProgramTarget */ #ifndef ProgramTargetHelper #define ProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib) @@\ ProgramTargetName(program): $(objs) $(deplib) @@\ RemoveTargetProgram($@) @@\ LinkRule($@,$(LDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\ @@\ CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib) @@\ SentinelProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\ PurifyProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\ ProofProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\ @@\ InstallProgram(program,$(BINDIR)) @@\ InstallManPage(program,$(MANDIR)) #endif /* ProgramTargetHelper */ #ifndef ProgramTargetHelperNoMan #define ProgramTargetHelperNoMan(program,srcs,objs,deplib,locallib,syslib) @@\ ProgramTargetName(program): $(objs) $(deplib) @@\ RemoveTargetProgram($@) @@\ LinkRule($@,$(LDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\ @@\ CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib) @@\ SentinelProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\ PurifyProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\ ProofProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\ @@\ InstallProgram(program,$(BINDIR)) #endif /* ProgramTargetHelperNoMan */ #ifndef CplusplusProgramTargetHelper #define CplusplusProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib) @@\ ProgramTargetName(program): $(objs) $(deplib) @@\ RemoveTargetProgram($@) @@\ CplusplusLinkRule($@,$(CXXLDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\ @@\ CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib) @@\ SentinelCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\ PurifyCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\ ProofCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\ @@\ InstallProgram(program,$(BINDIR)) @@\ InstallManPage(program,$(MANDIR)) #endif /* CplusplusProgramTargetHelper */ #ifndef CplusplusProgramTargetHelperNoMan #define CplusplusProgramTargetHelperNoMan(program,srcs,objs,deplib,locallib,syslib) @@\ ProgramTargetName(program): $(objs) $(deplib) @@\ RemoveTargetProgram($@) @@\ CplusplusLinkRule($@,$(CXXLDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\ @@\ CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib) @@\ SentinelCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\ PurifyCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\ ProofCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\ @@\ InstallProgram(program,$(BINDIR)) @@ #endif /* CplusplusProgramTargetHelperNoMan */ /* * ComplexProgramTarget - generate rules for compiling and linking the * program specified by $(OBJS) and $(SRCS), installing the program and its * man page, and generating dependencies. It should only be used in * Imakefiles that describe a single program. */ #ifndef ComplexProgramTarget #define ComplexProgramTarget(program) @@\ PROGRAM = ProgramTargetName(program) @@\ @@\ AllTarget(ProgramTargetName(program)) @@\ @@\ ProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\ @@\ DependTarget() @@\ LintTarget() @@\ @@\ clean:: @@\ RemoveFile(ProgramTargetName(program)) #endif /* ComplexProgramTarget */ #ifndef ComplexCplusplusProgramTarget #define ComplexCplusplusProgramTarget(program) @@\ PROGRAM = ProgramTargetName(program) @@\ @@\ AllTarget(ProgramTargetName(program)) @@\ @@\ CplusplusProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\ @@\ DependTarget() @@\ LintTarget() @@\ @@\ clean:: @@\ RemoveFile(ProgramTargetName(program)) #endif /* ComplexCplusplusProgramTarget */ /* * ComplexProgramTargetNoMan - generate rules for compiling and linking * the program specified by $(OBJS) and $(SRCS), installing the program * and generating dependencies. It should only be used in Imakefiles * that describe a single program, and have no manual page. */ #ifndef ComplexProgramTargetNoMan #define ComplexProgramTargetNoMan(program) @@\ PROGRAM = ProgramTargetName(program) @@\ @@\ AllTarget(ProgramTargetName(program)) @@\ @@\ ProgramTargetHelperNoMan(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\ @@\ DependTarget() @@\ LintTarget() @@\ @@\ clean:: @@\ RemoveFile(ProgramTargetName(program)) #endif /* ComplexProgramTargetNoMan */ #ifndef ComplexCplusplusProgramTarget #define ComplexCplusplusProgramTarget(program) @@\ PROGRAM = program @@\ @@\ AllTarget(program) @@\ @@\ CplusplusProgramTargetHelperNoMan(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\ @@\ DependTarget() @@\ LintTarget() @@\ @@\ clean:: @@\ RemoveFile(ProgramTargetName(program)) #endif /* ComplexCplusplusProgramTarget */ /* * ComplexProgramTarget_1 - generate rules for compiling and linking the * program specified by $(OBJS1) and $(SRCS1), installing the program and its * man page, and generating dependencies for it and any programs described * by $(SRCS2) through $(SRCS10). It should be used to build the primary * program in Imakefiles that describe multiple programs. */ #ifndef ComplexProgramTarget_1 #define ComplexProgramTarget_1(program,locallib,syslib) @@\ OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) \ @@\ $(OBJS6) $(OBJS7) $(OBJS8) $(OBJS9) $(OBJS10) @@\ SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) \ @@\ $(SRCS6) $(SRCS7) $(SRCS8) $(SRCS9) $(SRCS10) @@\ @@\ AllTarget($(PROGRAMS)) @@\ @@\ ProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib) @@\ @@\ DependTarget() @@\ LintTarget() @@\ @@\ clean:: @@\ RemoveFiles($(PROGRAMS)) #endif /* ComplexProgramTarget_1 */ #ifndef ComplexCplusplusProgramTarget_1 #define ComplexCplusplusProgramTarget_1(program,locallib,syslib) @@\ OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) \ @@\ $(OBJS6) $(OBJS7) $(OBJS8) $(OBJS9) $(OBJS10) @@\ SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) \ @@\ $(SRCS6) $(SRCS7) $(SRCS8) $(SRCS9) $(SRCS10) @@\ @@\ AllTarget($(PROGRAMS)) @@\ @@\ CplusplusProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib)@@\ @@\ DependTarget() @@\ LintTarget() @@\ @@\ clean:: @@\ RemoveFiles($(PROGRAMS)) #endif /* ComplexCplusplusProgramTarget_1 */ /* * ComplexProgramTarget_2 - generate rules for compiling and linking the * program specified by $(OBJS2) and $(SRCS2) and installing the program and * man page. It should be used to build the second program in Imakefiles * describing more than one program. */ #ifndef ComplexProgramTarget_2 #define ComplexProgramTarget_2(program,locallib,syslib) @@\ ProgramTargetHelper(program,SRCS2,OBJS2,DEPLIBS2,locallib,syslib) #endif /* ComplexProgramTarget_2 */ #ifndef ComplexCplusplusProgramTarget_2 #define ComplexCplusplusProgramTarget_2(program,locallib,syslib) @@\ CplusplusProgramTargetHelper(program,SRCS2,OBJS2,DEPLIBS2,locallib,syslib) #endif /* ComplexCplusplusProgramTarget_2 */ /* * ComplexProgramTarget_3 - generate rules for compiling and linking the * program specified by $(OBJS3) and $(SRCS3) and installing the program and * man page. It should be used to build the third program in Imakefiles * describing more than one program. */ #ifndef ComplexProgramTarget_3 #define ComplexProgramTarget_3(program,locallib,syslib) @@\ ProgramTargetHelper(program,SRCS3,OBJS3,DEPLIBS3,locallib,syslib) #endif /* ComplexProgramTarget_3 */ #ifndef ComplexCplusplusProgramTarget_3 #define ComplexCplusplusProgramTarget_3(program,locallib,syslib) @@\ CplusplusProgramTargetHelper(program,SRCS3,OBJS3,DEPLIBS3,locallib,syslib) #endif /* ComplexCplusplusProgramTarget_3 */ /* * ComplexProgramTarget_4 - generate rules for compiling and linking the * program specified by $(OBJS4) and $(SRCS4) and installing the program and * man page. It should be used to build the third program in Imakefiles * describing more than one program. */ #ifndef ComplexProgramTarget_4 #define ComplexProgramTarget_4(program,locallib,syslib) @@\ ProgramTargetHelper(program,SRCS4,OBJS4,DEPLIBS4,locallib,syslib) #endif /* ComplexProgramTarget_4 */ #ifndef ComplexCplusplusProgramTarget_4 #define ComplexCplusplusProgramTarget_4(program,locallib,syslib) @@\ CplusplusProgramTargetHelper(program,SRCS4,OBJS4,DEPLIBS4,locallib,syslib) #endif /* ComplexCplusplusProgramTarget_4 */ /* * ComplexProgramTarget_5 - generate rules for compiling and linking the * program specified by $(OBJS5) and $(SRCS5) and installing the program and * man page. It should be used to build the third program in Imakefiles * describing more than one program. */ #ifndef ComplexProgramTarget_5 #define ComplexProgramTarget_5(program,locallib,syslib) @@\ ProgramTargetHelper(program,SRCS5,OBJS5,DEPLIBS5,locallib,syslib) #endif /* ComplexProgramTarget_5 */ #ifndef ComplexCplusplusProgramTarget_5 #define ComplexCplusplusProgramTarget_5(program,locallib,syslib) @@\ CplusplusProgramTargetHelper(program,SRCS5,OBJS5,DEPLIBS5,locallib,syslib) #endif /* ComplexCplusplusProgramTarget_5 */ /* * ComplexProgramTarget_6 - generate rules for compiling and linking the * program specified by $(OBJS6) and $(SRCS6) and installing the program and * man page. It should be used to build the third program in Imakefiles * describing more than one program. */ #ifndef ComplexProgramTarget_6 #define ComplexProgramTarget_6(program,locallib,syslib) @@\ ProgramTargetHelper(program,SRCS6,OBJS6,DEPLIBS6,locallib,syslib) #endif /* ComplexProgramTarget_6 */ #ifndef ComplexCplusplusProgramTarget_6 #define ComplexCplusplusProgramTarget_6(program,locallib,syslib) @@\ CplusplusProgramTargetHelper(program,SRCS6,OBJS6,DEPLIBS6,locallib,syslib) #endif /* ComplexCplusplusProgramTarget_6 */ /* * ComplexProgramTarget_7 - generate rules for compiling and linking the * program specified by $(OBJS7) and $(SRCS7) and installing the program and * man page. It should be used to build the third program in Imakefiles * describing more than one program. */ #ifndef ComplexProgramTarget_7 #define ComplexProgramTarget_7(program,locallib,syslib) @@\ ProgramTargetHelper(program,SRCS7,OBJS7,DEPLIBS7,locallib,syslib) #endif /* ComplexProgramTarget_7 */ #ifndef ComplexCplusplusProgramTarget_7 #define ComplexCplusplusProgramTarget_7(program,locallib,syslib) @@\ CplusplusProgramTargetHelper(program,SRCS7,OBJS7,DEPLIBS7,locallib,syslib) #endif /* ComplexCplusplusProgramTarget_7 */ /* * ComplexProgramTarget_8 - generate rules for compiling and linking the * program specified by $(OBJS8) and $(SRCS8) and installing the program and * man page. It should be used to build the third program in Imakefiles * describing more than one program. */ #ifndef ComplexProgramTarget_8 #define ComplexProgramTarget_8(program,locallib,syslib) @@\ ProgramTargetHelper(program,SRCS8,OBJS8,DEPLIBS8,locallib,syslib) #endif /* ComplexProgramTarget_8 */ #ifndef ComplexCplusplusProgramTarget_8 #define ComplexCplusplusProgramTarget_8(program,locallib,syslib) @@\ CplusplusProgramTargetHelper(program,SRCS8,OBJS8,DEPLIBS8,locallib,syslib) #endif /* ComplexCplusplusProgramTarget_8 */ /* * ComplexProgramTarget_9 - generate rules for compiling and linking the * program specified by $(OBJS9) and $(SRCS9) and installing the program and * man page. It should be used to build the third program in Imakefiles * describing more than one program. */ #ifndef ComplexProgramTarget_9 #define ComplexProgramTarget_9(program,locallib,syslib) @@\ ProgramTargetHelper(program,SRCS9,OBJS9,DEPLIBS9,locallib,syslib) #endif /* ComplexProgramTarget_9 */ #ifndef ComplexCplusplusProgramTarget_9 #define ComplexCplusplusProgramTarget_9(program,locallib,syslib) @@\ CplusplusProgramTargetHelper(program,SRCS9,OBJS9,DEPLIBS9,locallib,syslib) #endif /* ComplexCplusplusProgramTarget_9 */ /* * ComplexProgramTarget_10 - generate rules for compiling and linking the * program specified by $(OBJS10) and $(SRCS10) and installing the program and * man page. It should be used to build the third program in Imakefiles * describing more than one program. */ #ifndef ComplexProgramTarget_10 #define ComplexProgramTarget_10(program,locallib,syslib) @@\ ProgramTargetHelper(program,SRCS10,OBJS10,DEPLIBS10,locallib,syslib) #endif /* ComplexProgramTarget_10 */ #ifndef ComplexCplusplusProgramTarget_10 #define ComplexCplusplusProgramTarget_10(program,locallib,syslib) @@\ CplusplusProgramTargetHelper(program,SRCS10,OBJS10,DEPLIBS10,locallib,syslib) #endif /* ComplexCplusplusProgramTarget_10 */ #ifndef MoveToBakFile #define MoveToBakFile(file) -@if [ -f file ]; then set -x; \ @@\ $(MV) file file.bak; else exit 0; fi #endif /* MoveToBakFile */ #ifndef RMoveToBakFile #define RMoveToBakFile(file) -@if [ -f file ]; then set -x; \ @@\ RemoveFile(file.bak); $(MV) file file.bak; \ @@\ else exit 0; fi #endif /* RMoveToBakFile */ /* * ServerTargetWithFlags - generate rules to compile, link, and relink a server */ #ifndef ServerTargetWithFlags #define ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,flags) @@\ AllTarget(ProgramTargetName(server)) @@\ AllTarget(ProgramRelinkName(server)) @@\ ProgramTargetName(server): subdirs objects libs @@\ MoveToBakFile($@) @@\ LinkRule($@,$(SERVERLDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\ @@\ Concat(load,server): @@\ MoveToBakFile(ProgramTargetName(server)) @@\ LinkRule(ProgramTargetName(server),$(SERVERLDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\ @@\ loadX:: Concat(load,server) @@\ @@\ SentinelProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\ SentinelLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\ PurifyProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\ PurifyLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\ ProofProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\ ProofLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\ @@\ RelinkProgram(ProgramTargetName(server),objects,libs,syslibs) @@\ InstallProgramWithFlags(server,$(BINDIR),flags) @@\ @@\ clean:: @@\ RemoveFile(ProgramTargetName(server)) @@\ RemoveFile(ProgramRelinkName(server)) #endif /* ServerTargetWithFlags */ /* * ServerTarget - rules to compile, link, and relink a normal server */ #ifndef ServerTarget #define ServerTarget(server,subdirs,objects,libs,syslibs) @@\ ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,$(_NOOP_)) #endif /* ServerTarget */ /* * Creates libX11 compat symlinks to enable execution of rpath-dependent * programs. */ #ifndef LibX11Links #define LibX11Links() @@\ AllTarget(libX11links) @@\ libX11links: @@\ $(LN) libNX_X11.so $(BUILDLIBDIR)/libX11.so @@\ $(LN) libNX_X11.so.6 $(BUILDLIBDIR)/libX11.so.6 @@\ $(LN) libNX_X11.so.6.3.0 $(BUILDLIBDIR)/libX11.so.6.3.0 @@\ touch libX11links @@\ @@\ clean:: @@\ RemoveFile($(BUILDLIBDIR)/libX11.so) @@\ RemoveFile($(BUILDLIBDIR)/libX11.so.6) @@\ RemoveFile($(BUILDLIBDIR)/libX11.so.6.3.0) @@\ RemoveFile(libX11links) #endif /* LibX11Links */ #if DoRanlibCmd #define RanLibrary(args) $(RANLIB) args #else #define RanLibrary(args) $(_NULLCMD_) #endif #ifndef LibraryTargetName #define LibraryTargetName(libname)Concat(lib,libname.a) #endif /* This rule is used for libs in Xserver/Imakefile which are loaded, not * linked into the core module. Since modules are called libXXXX.a, * this rule mustn't be overridden by .cf files. */ #ifndef ModuleLibraryTargetName #define ModuleLibraryTargetName(libname)Concat(lib,libname.a) #endif #ifndef LibraryTargetNameSuffix #define LibraryTargetNameSuffix(libname,suffix)Concat3(lib,libname,suffix.a) #endif #ifndef InstallNamedInline #define InstallNamedInline(srcname,flags,dest,dstname) $(INSTALL) $(INSTALLFLAGS) flags srcname $(DESTDIR)dest/dstname #endif #ifndef InstallNamedTarget #define InstallNamedTarget(step,srcname,flags,dest,dstname) @@\ step:: srcname @@\ MakeDir($(DESTDIR)dest) @@\ InstallNamedInline(srcname,flags,dest,dstname) #endif /* InstallNamedTarget */ /* * InstallNamedTargetNoClobber - Like InstallNamedTarget, but doesn't * do the install if an installed version already exists. Useful * for files that might have local customizations that you don't * want to clobber. Config files are good candidates for this. */ #ifndef InstallNamedTargetNoClobber #define InstallNamedTargetNoClobber(step,srcname,flags,dest,dstname) @@\ step:: srcname @@\ MakeDir($(DESTDIR)dest) @@\ @if [ -f $(DESTDIR)dest/dstname ]; then \ @@\ echo "Not overwriting existing" $(DESTDIR)dest/dstname; \ @@\ else set -x; \ @@\ $(INSTALL) $(INSTALLFLAGS) flags srcname $(DESTDIR)dest/dstname; fi #endif /* InstallNamedTargetNoClobber */ #ifndef InstallTarget #define InstallTarget(step,file,flags,dest) @@\ InstallNamedTarget(step,file,flags,dest,file) #endif /* InstallTarget */ #ifndef InstallInline #define InstallInline(file,flags,dest) InstallNamedInline(file,flags,dest,file) #endif /* * InstallLibrary - generate rules to install the indicated library. */ #ifndef InstallLibrary #define InstallLibrary(libname,dest) @@\ install:: LibraryTargetName(libname) @@\ MakeDir($(DESTDIR)dest) @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetName(libname) $(DESTDIR)dest @@\ RanLibrary($(RANLIBINSTFLAGS) $(DESTDIR)dest/LibraryTargetName(libname)) #endif /* InstallLibrary */ /* * InstallDriverSDKLibrary - rule to install Driver SDK library. * (only used for XFree86). This is a no-op * rule so that Imakefiles on non-XFree86 systems * continue to build Makefiles correctly. */ #ifndef InstallDriverSDKLibrary #define InstallDriverSDKLibrary(lib,dir) #endif /* * InstallDriverSDKNamedLibrary - rule to install Driver SDK library. * (only used for XFree86). This is a no-op * rule so that Imakefiles on non-XFree86 systems * continue to build Makefiles correctly. */ #ifndef InstallDriverSDKNamedLibrary #define InstallDriverSDKNamedLibrary(lib,dlib,dir) #endif /* * InstallDriverSDKLibraryModule - rule to install Driver SDK library module. * (only used for XFree86). This is a no-op * rule so that Imakefiles on non-XFree86 systems * continue to build Makefiles correctly. */ #ifndef InstallDriverSDKLibraryModule #define InstallDriverSDKLibraryModule(lib,dlib,dir) #endif /* * MergeIntoInstalledLibrary - generate rules to merge one library into another */ #ifndef MergeIntoInstalledLibrary #define MergeIntoInstalledLibrary(tolib,fromlib) @@\ install:: fromlib @@\ $(SCRIPTSRC)/mergelib $(DESTDIR)tolib fromlib #endif /* MergeIntoInstalledLibrary */ /* * InstallLibraryAlias - generate rules to create a link from one library name * to another for the purposes of aliasing. */ #ifndef InstallLibraryAlias #define InstallLibraryAlias(libname,alias,dest) @@\ install:: @@\ -(cd $(DESTDIR)dest && ( \ @@\ RemoveFile(LibraryTargetName(alias)); \ @@\ $(LN) LibraryTargetName(libname) LibraryTargetName(alias))) #endif /* InstallLibraryAlias */ /* * InstallLintLibrary - generate rules to install the indicated lint library. */ #ifndef InstallLintLibrary #define InstallLintLibrary(libname,dest) @@\ InstallTarget(install.ln,Concat(llib-l,libname.ln),$(INSTLIBFLAGS),dest) #endif /* InstallLintLibrary */ #if !CompressManPages /* * InstallManPageLong - generate rules to install the indicated manual page, * giving it an alternate name. This is used for installing man pages whose * base name without the .man suffix would normally be longer than 8 characters * (the limit for using source code control systems on files systems with * short file names). */ #ifndef InstallManPageLong #define InstallManPageLong(file,destdir,dest) @@\ BuildInstallHtmlManPage(file,dest,$(MANSUFFIX)) @@\ @@\ CppManTarget(file,$(EXTRAMANDEFS)) @@\ @@\ InstallNamedTarget(install.man,file.$(MANNEWSUFFIX),$(INSTMANFLAGS),destdir,dest.$(MANSUFFIX)) #endif /* InstallManPageLong */ /* * InstallManPageAliases - generate rules to install manual page aliases. */ #ifndef InstallManPageAliases #define InstallManPageAliases(file,destdir,aliases) @@\ InstallHtmlManPageAliases(file,aliases,$(MANSUFFIX)) @@\ @@\ install.man:: @@\ @(TMP="#tmp.$$$$"; \ @@\ RemoveFile($${TMP}); \ @@\ echo .so `basename destdir`/file.$(MANSUFFIX) > $${TMP}; \ @@\ for i in aliases; do (set -x; \ @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) $${TMP} $(DESTDIR)destdir/$$i.$(MANSUFFIX)); \ @@\ done; \ @@\ RemoveFile($${TMP})) #endif /* InstallManPageAliases */ /* * InstallGenManPageLong - More general rules for installing manual pages -- * doesn't assume MANSUFFIX. */ #ifndef InstallGenManPageLong #define InstallGenManPageLong(file,destdir,dest,suffix) @@\ BuildInstallHtmlManPage(file,dest,suffix) @@\ @@\ CppManTarget(file, $(EXTRAMANDEFS)) @@\ @@\ install.man:: file.$(MANNEWSUFFIX) @@\ MakeDir($(DESTDIR)destdir) @@\ $(INSTALL) -c $(INSTMANFLAGS) file.$(MANNEWSUFFIX) \ @@\ $(DESTDIR)destdir/dest.suffix #endif /* InstallGenManPageLong */ /* * InstallGenManPageAliases - general equivalent of InstallManPageAliases */ #ifndef InstallGenManPageAliases #define InstallGenManPageAliases(file,destdir,suffix,aliases) @@\ InstallHtmlManPageAliases(file,aliases,suffix) @@\ @@\ install.man:: @@\ @(TMP="#tmp.$$$$"; \ @@\ RemoveFile($${TMP}); \ @@\ echo .so `basename destdir`/file.suffix > $${TMP}; \ @@\ for i in aliases; do (set -x; \ @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) $${TMP} $(DESTDIR)destdir/$$i.suffix); \ @@\ done; \ @@\ RemoveFile($${TMP})) #endif /* InstallGenManPageAliases */ #else /* CompressManPages */ #ifndef InstallManPageLong #define InstallManPageLong(file,destdir,dest) @@\ BuildInstallHtmlManPage(file,dest,$(MANSUFFIX)) @@\ @@\ CppManTarget(file, $(EXTRAMANDEFS)) @@\ @@\ install.man:: file.$(MANNEWSUFFIX) @@\ MakeDir($(DESTDIR)destdir) @@\ $(RM) $(DESTDIR)destdir/dest.$(MANSUFFIX)* @@\ $(INSTALL) -c $(INSTMANFLAGS) file.$(MANNEWSUFFIX) \ @@\ $(DESTDIR)destdir/dest.$(MANSUFFIX) @@\ -$(COMPRESSMANCMD) $(DESTDIR)destdir/dest.$(MANSUFFIX) #endif #ifndef InstallGenManPageLong #define InstallGenManPageLong(file,destdir,dest,suffix) @@\ BuildInstallHtmlManPage(file,dest,suffix) @@\ @@\ CppManTarget(file, $(EXTRAMANDEFS)) @@\ @@\ install.man:: file.$(MANNEWSUFFIX) @@\ MakeDir($(DESTDIR)destdir) @@\ $(RM) $(DESTDIR)destdir/dest.suffix* @@\ $(INSTALL) -c $(INSTMANFLAGS) file.$(MANNEWSUFFIX) \ @@\ $(DESTDIR)destdir/dest.suffix @@\ -$(COMPRESSMANCMD) $(DESTDIR)destdir/dest.suffix #endif #ifndef InstallMultipleMan #define InstallMultipleMan(list,dest) @@\ install.man:: list @@\ MakeDir($(DESTDIR)dest) @@\ @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ for i in list; do \ @@\ (MNAME=`echo $$i | cut -f1 -d.`; \ @@\ set -x; \ @@\ $(RM) $(DESTDIR)dest/$${MNAME}*; \ @@\ $(INSTALL) -c $(INSTMANFLAGS) $$i \ @@\ $(DESTDIR)dest/$${MNAME}.$(MANSUFFIX); \ @@\ $(COMPRESSMANCMD) $(DESTDIR)dest/$${MNAME}.$(MANSUFFIX)); \ @@\ done #endif /* * InstallManPageAliases - install soft links for aliases. */ #ifndef InstallManPageAliasesBase #define InstallManPageAliasesBase(file,destdir,aliases) @@\ install.man:: @@\ @(SUFFIX=`echo $(DESTDIR)destdir/file.* | sed -e 's,.*/[^\.]*.,,'`; \ @@\ for i in aliases; do (set -x; \ @@\ $(RM) $(DESTDIR)destdir/$$i.*; \ @@\ (cd $(DESTDIR)destdir; $(LN) file.$${SUFFIX} \ @@\ $$i.$${SUFFIX})); \ @@\ done) #endif #ifndef InstallManPageAliases #define InstallManPageAliases(file,destdir,aliases) @@\ InstallHtmlManPageAliases(file,aliases,$(MANSUFFIX)) @@\ @@\ InstallManPageAliasesBase(file,destdir,aliases) #endif /* * InstallGenManPageAliases - install soft links for aliases. */ #ifndef InstallGenManPageAliases #define InstallGenManPageAliases(file,destdir,suffix,aliases) @@\ InstallHtmlManPageAliases(file,aliases,suffix) @@\ @@\ InstallManPageAliasesBase(file,destdir,aliases) #endif #endif /* CompressManPages */ /* * InstallManPage - generate rules to install the indicated manual page. */ #ifndef InstallManPage #define InstallManPage(file,destdir) @@\ InstallManPageLong(file,destdir,file) #endif /* InstallManPage */ /* * InstallGenManPage - general equivalent of InstallManPage */ #ifndef InstallGenManPage #define InstallGenManPage(file,destdir,suffix) @@\ InstallGenManPageLong(file,destdir,file,suffix) #endif /* InstallGenManPage */ /* * RmanDependency - generate rules to build the rman program if * this Imakefile is within the source tree. */ #ifndef RmanDependency #ifdef UseInstalled #define RmanDependency() /**/ #else #define RmanDependency() @@\ NoCmpScript(ProgramTargetName($(RMAN))) @@\ @@\ ProgramTargetName($(RMAN)): @@\ @echo "checking $(RMANBASENAME) over in $(TOP)/config/util first..."; \ @@\ cd $(TOP)/config/util && $(MAKE) rmanonly; \ @@\ echo "okay, continuing in $(CURRENT_DIR)" #endif /* UseInstalled */ #endif /* RmanDependency */ #ifndef RmanCmdDependency #ifdef UseInstalled #define RmanCmdDependency /**/ #else #define RmanCmdDependency ProgramTargetName($(RMAN)) #endif #endif #ifndef BuildInstallHtmlManPage #if BuildHtmlManPages #define BuildInstallHtmlManPage(file,dest,suffix) @@\ AllTarget(dest.suffix.html) @@\ @@\ dest.suffix.html: file.$(MANNEWSUFFIX) RmanCmdDependency @@\ RemoveFiles(dest.suffix.html dest.suffix-html) @@\ RunProgram(RMAN,$(RMANOPTIONS) < file.$(MANNEWSUFFIX) \ @@\ > dest.suffix-html) && $(MV) dest.suffix-html $@ @@\ @@\ install.man:: dest.suffix.html @@\ MakeDir($(DESTDIR)$(DOCHTMLDIR)) @@\ @(SUF=`expr suffix \: '\(.\)'`; \ @@\ set -x; \ @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) dest.suffix.html $(DESTDIR)$(DOCHTMLDIR)/dest.$$SUF.html) @@\ @@\ clean:: @@\ RemoveFiles(dest.suffix.html dest.suffix-html) #else #define BuildInstallHtmlManPage(file,dest,suffix) /**/ #endif #endif #ifndef InstallHtmlManPageAliases #if BuildHtmlManPages #define InstallHtmlManPageAliases(file,aliases,suffix) @@\ install.man:: file.suffix.html @@\ MakeDir($(DESTDIR)$(DOCHTMLDIR)) @@\ @SUF=`expr suffix \: '\(.\)'`; \ @@\ for i in aliases; do (set -x; \ @@\ RemoveFile($(DESTDIR)$(DOCHTMLDIR)/$$i.$$SUF.html); \ @@\ (cd $(DESTDIR)$(DOCHTMLDIR); \ @@\ $(LN) file.$$SUF.html $$i.$$SUF.html)); \ @@\ done #else #define InstallHtmlManPageAliases(file,aliases,suffix) /**/ #endif #endif #ifndef HtmlManIndex #if BuildHtmlManPages #define HtmlManIndex @@\ html_index:: @@\ MakeDir($(DESTDIR)$(DOCHTMLDIR)) @@\ $(HTMLINDEXCMD) $(DESTDIR)$(DOCHTMLDIR) #else #define HtmlManIndex html_index:: #endif #endif /* * ManKeywordsTarget - generate the database used by "man -k". * This rule updates the index in the directory "manpath", which * indexes all the manual pages in the section subdirectories under * it. An update command is defined only on systems that have a * per MANPATH element index. If the OS supports only one system-wide * database, we don't update it, because then we can't do cross * installations or use a non-empty DESTDIR for testing. */ #ifndef ManKeywordsTarget #define ManKeywordsTarget(manpath) man_keywords:: #endif /* * InstallNamedNonExec - generate rules to install a data file */ #ifndef InstallNamedNonExec #define InstallNamedNonExec(srcname,dstname,dest) @@\ InstallNamedTarget(install,srcname,$(INSTDATFLAGS),dest,dstname) #endif /* InstallNamedNonExec */ /* * InstallDriverSDKNamedNonExec - rule for installing server Driver SDK files. * (only used for XFree86). This is a no-op * rule so that Imakefiles on non-XFree86 systems * continue to build Makefiles correctly. */ #ifndef InstallDriverSDKNamedNonExec #define InstallDriverSDKNamedNonExec(srcname,dstname,dest) #endif /* * InstallNonExecFile - generate rules to install a data file */ #ifndef InstallNonExecFile #define InstallNonExecFile(file,dest) @@\ InstallTarget(install,file,$(INSTDATFLAGS),dest) #endif /* InstallNonExecFile */ /* * InstallNonExecFileNoClobber - install a data file once */ #ifndef InstallNonExecFileNoClobber #define InstallNonExecFileNoClobber(file,dest) @@\ InstallNamedTargetNoClobber(install,file,$(INSTDATFLAGS),dest,file) #endif /* InstallNonExecFileNoClobber */ /* * InstallDriverSDKNonExecFile - rule for installing server Driver SDK files. * (only used for XFree86). This is a no-op * rule so that Imakefiles on non-XFree86 systems * continue to build Makefiles correctly. */ #ifndef InstallDriverSDKNonExecFile #define InstallDriverSDKNonExecFile(file,dir) #endif /* * InstallNonExec - generate rules to install a data file, but does not * try to create the destination directory (deprecated) */ #ifndef InstallNonExec #define InstallNonExec(file,dest) @@\ install:: file @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) file $(DESTDIR)dest #endif /* InstallNonExec */ /* * RelinkProgram - relinks an executable program in preparation of installation */ #ifndef RelinkProgram #define RelinkProgram(program,objects,libs,syslibs) @@\ ProgramRelinkName(program): program @@\ MoveToBakFile($@) @@\ LinkInstallRule($@,$(SERVERLDOPTIONS),objects,libs $(LDLIBS) syslibs) #endif /* RelinkProgram */ /* * InstallProgramWithFlags - generate rules to install an executable program * using given install flags. */ #ifndef InstallProgramWithFlags #if StripInstalledPrograms && CrossCompiling #define InstallProgramWithFlags(program,dest,flags) @@\ InstallTarget(install,ProgramRelinkName(program),$(INSTPGMFLAGS) flags,dest) @@\ CrossStripCmd $(DESTDIR)dest/ProgramTargetName(program) #else #define InstallProgramWithFlags(program,dest,flags) @@\ InstallTarget(install,ProgramRelinkName(program),$(INSTPGMFLAGS) flags,dest) #endif /* StripInstalledPrograms && CrossCompiling */ #endif /* InstallProgramWithFlags */ /* * InstallProgram - generate rules to install an executable program using any * special install flags set in $(INSTALLFLAGS). */ #ifndef InstallProgram #define InstallProgram(program,dest) @@\ InstallProgramWithFlags(program,dest,NullParameter) #endif /* InstallProgram */ /* * InstallScript - install a shell script. */ #ifndef InstallScript #define InstallScript(program,dest) @@\ InstallNamedTarget(install,program.script,$(INSTBINFLAGS),dest,program) #endif /* InstallScript */ /* * InstallNamedProg - install a program with renaming and no stripping. */ #ifndef InstallNamedProg #define InstallNamedProg(srcname,dstname,dest) @@\ InstallNamedTarget(install,srcname,$(INSTBINFLAGS),dest,dstname) #endif /* InstallNamedProg */ /* * InstallNamedProgNoClobber - Like InstallNamedProg, but doesn't * do the install if an installed version already exists. */ #ifndef InstallNamedProgNoClobber #define InstallNamedProgNoClobber(srcname,dstname,dest) @@\ InstallNamedTargetNoClobber(install,srcname,$(INSTBINFLAGS),dest,dstname) #endif /* InstallNamedProgNoClobber */ /* * InstallDriverSDKNamedProg - rule for installing server Driver SDK files. * (only used for XFree86). This is a no-op * rule so that Imakefiles on non-XFree86 systems * continue to build Makefiles correctly. */ #ifndef InstallDriverSDKNamedProg #define InstallDriverSDKNamedProg(srcname,dstname,dest) #endif /* * MakeFlagsToShellFlags - set variables before starting a loop. * makeflags is the set of "make" flags to check. * shellcmd is the shell command to execute if any of the flags are set. * * The usual use of this rule is to translate make's "don't quit on error" * flags into the equivalent for the shell. To do this, "make -i" always * becomes "set +e". "make -k" should also turn on "set +e" if the target * is building subdirectories. That is, subdirectories are independent * and should appear to be multiple targets, even though they are * implemented in a loop in a single target. */ #ifndef MakeFlagsToShellFlags #define MakeFlagsToShellFlags(makeflags,shellcmd)\ for flag in ${MAKEFLAGS} ''; do \ @@\ case "$$flag" in *=*) ;; --*) ;; *[makeflags]*) shellcmd;; esac; done #endif /* * MakeNamedTargetSubdir - do make in a subdir. */ #ifndef MakeNamedTargetSubdir #define MakeNamedTargetSubdir(dir,flags,subname)\ (cd dir && $(MAKE) $(MFLAGS) $(PARALLELMFLAGS) \ @@\ flags subname) #endif /* * LinkFileList - link a list of files from one place to another */ #ifndef LinkFileList #define LinkFileList(step,list,dir,sub) @@\ step:: @@\ @MakeFlagsToShellFlags(i,set +e); \ @@\ echo " cd" dir; cd dir && \ @@\ for i in list; do (set -x; $(LN) -f sub/$$i .); done #endif /* * LinkConfDirectoryLong * * Make links from opath (usually /lib/X11) to npath * For example /usr/X11R6/lib/X11/xdm ==> /etc/X11/xdm so that X * binaries can be mounted from a read-only volume like a CD-ROM; * but files that may need to be edited can be stored locally on * read-write media. If someone has an existing installation, be * careful and move existing files to the new location in /etc. * XXX Need to make the installation script do this when installing * binary distributions. * * Since the link is used in the installation process, we need to * make the link relative in order to honor $(DESTDIR) if it is set. * * Note: The sed script used here is not completely general. It assumes * that no elements of the path are '..', and that none start with '.' * that aren't just '.'. * * For a more general solution $(REVPATH) could be used. Even though * it was intended for something a little different, it does do what is * required here. * */ #ifndef LinkConfDirectoryLong #if UseSeparateConfDir && HasSymLinks #define LinkConfDirectoryLong(mdir,cdir,rdir,ldir,opath,npath) @@\ install:: @@\ @MakeFlagsToShellFlags(i,set +e); \ @@\ if [ -h Concat($(DESTDIR),npath/mdir) ]; then \ @@\ $(RM) Concat($(DESTDIR),npath/mdir); \ @@\ fi @@\ MakeDir(Concat($(DESTDIR),opath/cdir)) @@\ MakeDir(Concat($(DESTDIR),npath/mdir)) @@\ @MakeFlagsToShellFlags(i,set +e); \ @@\ if [ -d Concat($(DESTDIR),opath/cdir) ]; then \ @@\ RELPATH=`echo opath/cdir | \ @@\ sed -e 's:^/::' -e 's:[^/.][^/]*:..:'g -e 's:/\.$$::'`; \ @@\ cd Concat($(DESTDIR),opath/cdir); \ @@\ if [ -d rdir -a ! -h rdir ]; then \ @@\ (cd rdir; tar cf - . | \ @@\ (cd Concat($(DESTDIR),npath/mdir); \ @@\ tar xf -; exit 0); exit 0); \ @@\ fi; \ @@\ $(RM) -r rdir; \ @@\ $(LN) Concat($${RELPATH},npath/mdir) ldir; \ @@\ fi #else #define LinkConfDirectoryLong(mdir,cdir,rdir,ldir,opath,npath) #endif #endif #ifndef LinkConfDirectory #define LinkConfDirectory(mdir,cdir,rdir,ldir) LinkConfDirectoryLong(mdir,cdir,rdir,ldir,$(LIBDIR),$(CONFDIR)) #endif #ifndef LinkVarDirectory #define LinkVarDirectory(mdir,cdir,rdir,ldir) LinkConfDirectoryLong(mdir,cdir,rdir,ldir,$(LIBDIR),$(VARDIR)) #endif /* * LinkConfFileLong * * Make links from opath (/lib/X11) to npath * For example /usr/X11R6/lib/X11/xxx ==> /etc/X11/xxx so that X binaries * can be mounted from a read-only volume like a CD-ROM; * but files that may need to be edited can be stored locally on * read-write media. If someone has an existing installation, be * careful and move existing files to the new location in /etc. * XXX Need to make the installation script do this when installing * binary distributions. * * Since the link is used in the installation process, we need to * make the link relative in order to honor $(DESTDIR) if it is set. */ #ifndef LinkConfFileLong #if UseSeparateConfDir && HasSymLinks #define LinkConfFileLong(cfile,lfile,opath,npath) @@\ install:: @@\ MakeDir(Concat($(DESTDIR),opath)) @@\ MakeDir(Concat($(DESTDIR),npath)) @@\ @MakeFlagsToShellFlags(i,set +e); \ @@\ if [ -d Concat($(DESTDIR),opath) ]; then \ @@\ RELPATH=`echo opath | \ @@\ sed -e 's:^.::' -e 's:[^/.][^/]*:..:'g`; \ @@\ cd Concat($(DESTDIR),opath); \ @@\ if [ -f lfile -a ! -h lfile ]; then \ @@\ cp -p lfile Concat($(DESTDIR),npath/cfile); \ @@\ fi; \ @@\ $(RM) -r lfile; \ @@\ $(LN) Concat($${RELPATH},npath/cfile) lfile; \ @@\ fi #else #define LinkConfFileLong(cfile,lfile,opath,npath) #endif #endif #ifndef LinkConfFile #define LinkConfFile(cfile,lfile) LinkConfFileLong(cfile,lfile,$(LIBDIR),$(CONFDIR)) #endif /* * InstallMultipleDestFlags - generate rules to install multiple files at * once during a particular step in the build using a specific set of install * flags. */ #ifndef InstallMultipleDestFlags #define InstallMultipleDestFlags(step,list,dest,flags) @@\ step:: list @@\ MakeDir($(DESTDIR)dest) @@\ @MakeFlagsToShellFlags(i,set +e); \ @@\ for i in list; do \ @@\ (set -x; $(INSTALL) $(INSTALLFLAGS) flags $$i $(DESTDIR)dest); \ @@\ done #endif /* InstallMultipleDestFlags */ /* * InstallDriverSDKMultipleDestFlags - rule for installing server Driver SDK * files. (only used for XFree86). This is a no-op * rule so that Imakefiles on non-XFree86 systems * continue to build Makefiles correctly. */ #ifndef InstallDriverSDKMultipleDestFlags #define InstallDriverSDKMultipleDestFlags(list,dest,flags) #endif /* * InstallMultipleDest - generate rules to install multiple files at once * during a particular step in the build using any install flags set in * $(INSTDATFLAGS). */ #ifndef InstallMultipleDest #define InstallMultipleDest(step,list,dest) @@\ InstallMultipleDestFlags(step,list,dest,$(INSTDATFLAGS)) #endif /* InstallMultipleDest */ /* * InstallMultiple - generate rules to install multiple files at once * during the install step of the build using any install flags set in * $(INSTALLFLAGS). */ #ifndef InstallMultiple #define InstallMultiple(list,dest) @@\ InstallMultipleDest(install,list,dest) #endif /* InstallMultiple */ /* * InstallMultipleFlags - generate rules to install multiple files at once * during the install step of the build using the given install flags. */ #ifndef InstallMultipleFlags #define InstallMultipleFlags(list,dest,flags) @@\ InstallMultipleDestFlags(install,list,dest,flags) #endif /* InstallMultipleFlags */ /* * InstallMultipleMan - generate rules to install a variety of manual pages * during the install.man step of the build. */ #ifndef InstallMultipleMan #define InstallMultipleMan(list,dest) @@\ InstallMultipleDestFlags(install.man,list,dest,$(INSTMANFLAGS)) #endif /* InstallMultipleMan */ /* * InstallMultipleManSuffix - generate rules to install multiple manual * pages dufing the install.man step of the build, where * the target files have the suffix given. */ #ifndef InstallMultipleManSuffix #define InstallMultipleManSuffix(list,dest,suffix) @@\ install.man:: @@\ MakeDir($(DESTDIR)dest) @@\ @MakeFlagsToShellFlags(i,set +e); \ @@\ for i in list; do \ @@\ (set -x; $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) $$i.suffix $(DESTDIR)dest/$$i.$(MANSUFFIX)); \ @@\ done #endif /* InstallMultipleManSuffix */ /* * IncludeMakefile - rule to include another Makefile. * Must not generate an error or even a warning if the named file * is not present, since we use this to include Makefile.dep, which * may not be built yet. * This is defined non-null iff HasMakefileSafeInclude is YES. * The double-@ is to ensure no leading spaces on the line. */ #ifndef IncludeMakefile #if HasClearmake #define IncludeMakefile(file) @@sinclude file #else #if HasBsdMake #define IncludeMakefile(file) @@# dependencies are in .depend #else #define IncludeMakefile(file) /**/ #endif #endif #endif /* * DependDependencyStatement - Used by DependDependency to set up the * most specific dependency, which differs based on whether we support * a separate Makefile.dep on this platform. */ #ifndef DependDependencyStatement #if HasMakefileSafeInclude #define DependDependencyStatement() @@\ DependFileName:: ProgramTargetName($(DEPEND)) #else #define DependDependencyStatement() @@\ depend:: ProgramTargetName($(DEPEND)) #endif #endif /* * DependDependency - generate rules to build the makedepend program if * this Imakefile is within the source tree. */ #ifndef DependDependency #ifdef UseInstalled #define DependDependency() /**/ #else #define DependDependency() @@\ DependDependencyStatement() @@\ @@\ NoCmpScript(ProgramTargetName($(DEPEND))) @@\ @@\ ProgramTargetName($(DEPEND)): @@\ echo "using system-wide depend, continuing in $(CURRENT_DIR)" #endif /* UseInstalled */ #endif /* DependDependency */ /* * DependTarget - generate rules to compute dependencies for all files listed * in $(SRCS). */ #ifndef DependTarget #if HasMakefileSafeInclude #define DependTarget() @@\ DependDependency() @@\ @@\ depend:: DependFileName @@\ @@\ DependFileName:: @@\ RemoveFile($@) @@\ RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS)) > $@ #else /* HasMakefileSafeInclude */ #define DependTarget() @@\ DependDependency() @@\ @@\ depend:: @@\ RunProgram(DEPEND,$(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS)) #endif /* HasMakefileSafeInclude else */ #endif /* DependTarget */ /* * DependTarget3 - generate rules to compute dependencies for all files given. */ #ifndef DependTarget3 #if HasMakefileSafeInclude #define DependTarget3(srcs1,srcs2,srcs3) @@\ DependDependency() @@\ @@\ depend:: DependFileName @@\ @@\ DependFileName:: @@\ RemoveFile($@) @@\ RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs1) > $@ @@\ RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs2) >> $@ @@\ RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs3) >> $@ #else /* HasMakefileSafeInclude */ #define DependTarget3(srcs1,srcs2,srcs3) @@\ DependDependency() @@\ @@\ depend:: @@\ RunProgram(DEPEND,$(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs1) @@\ RunProgram(DEPEND,-a $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs2) @@\ RunProgram(DEPEND,-a $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs3) #endif /* HasMakefileSafeInclude else */ #endif /* DependTarget3 */ /* * CleanTarget - generate rules to remove any garbage files */ #ifndef CleanTarget #define CleanTarget() @@\ clean:: @@\ $(RM) FilesToClean ExtraFilesToClean DocFilesToClean "#"* @@\ @@\ ProofCleanTarget() #endif /* CleanTarget */ /* * TagsTarget - generate rules to compute tags files for C source code. */ #ifndef TagsTarget #define TagsTarget() @@\ tags:: @@\ $(TAGS) -w *.[ch] @@\ $(TAGS) -xw *.[ch] > TAGS #endif /* TagsTarget */ /* * ImakeDependency - generate rules to compile imake if this Imakefile is * within the source tree. */ #ifndef ImakeDependency #ifdef UseInstalled #define ImakeDependency(target) /**/ #else #define ImakeDependency(target) @@\ target:: ProgramTargetName($(IMAKE)) @@\ @@\ NoCmpScript(ProgramTargetName($(IMAKE)) $(IMAKE).Osuf) @@\ @@\ ProgramTargetName($(IMAKE)) $(IMAKE).Osuf: @@\ echo "using system-wide imake, continuing in $(CURRENT_DIR)" #endif /* UseInstalled */ #endif /* ImakeDependency */ /* * BuildMakefileTarget - generate rules to build a Makefile from an Imakefile * and any special imake flags. This is generally done automatically by the * template or by any special Imakefiles. The first argument exists just * because imakeflags is usually empty and some preprocessors will complain * if an empty argument is passed as the sole argument to a macro. */ #ifndef BuildMakefileTarget #define BuildMakefileTarget(notused,imakeflags) @@\ ImakeDependency(Makefile) @@\ @@\ Makefile:: @@\ RMoveToBakFile(Makefile) @@\ $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) imakeflags #endif /* BuildMakefileTarget */ /* * MakefileTarget - generate rules to build a normal Makefile. */ #ifndef MakefileTarget #define MakefileTarget() @@\ BuildMakefileTarget(Imakefile,NullParameter) #endif /* MakefileTarget */ /* * LibMkdir - helper for creating library object subdirectories */ #ifndef LibMkdir #define LibMkdir(dir) DirFailPrefix@if [ -d dir ]; then exit 0; else set -x; mkdir dir; fi #endif #ifndef LibMkdirLinkSubdirs #define LibMkdirLinkSubdirs(dir) DirFailPrefix@if [ -d dir ]; then \ @@\ exit 0; \ @@\ else \ @@\ echo "mkdir dir"; mkdir dir; \ @@\ for i in $(SUBDIRS); do \ @@\ j=`echo "$$i" | sed -e 's;[^/]\{1,\};..;g'`; \ @@\ if [ ! -d "dir/`dirname $$i`" ]; then \ @@\ $(MKDIRHIER) "dir/`dirname $$i`"; \ @@\ fi; \ @@\ echo $(LN) "$$j/$$i/dir" "dir/$$i"; \ @@\ $(LN) "$$j/$$i/dir" "dir/$$i"; \ @@\ done; \ @@\ fi #endif /* * LibCleanDir - helper for cleaning library object subdirectories */ #ifndef LibCleanDir #define LibCleanDir(dir) -@if [ -d dir ]; then \ @@\ set -x; $(RM) -r dir; else exit 0; fi #endif /* * LintLibReferences - variables for lint libraries */ #ifndef LintLibReferences #define LintLibReferences(varname,libname,libsource) @@\ Concat(LINT,varname) = _UseCat($(LINTLIBDIR)/llib-l,libsource/llib-,libname.ln) #endif /* * UnsharedLibReferences - variables for unshared libraries */ #ifndef UnsharedLibReferences #define UnsharedLibReferences(varname,libname,libsource) @@\ ProjectUnsharedLibReferences(varname,libname,libsource,$(BUILDLIBDIR)) #endif /* * ProjectUnsharedLibReferences - variables for unshared libraries */ #ifndef ProjectUnsharedLibReferences #define ProjectUnsharedLibReferences(varname,libname,libsource,buildlibdir) @@\ Concat3(DEP,varname,LIB) = _UseCat($(USRLIBDIR)/,buildlibdir/,LibraryTargetName(libname)) @@\ Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname) @@\ LintLibReferences(varname,libname,libsource) #endif /* * SharedLibDependencies - shared library dependencies */ #ifndef SharedLibDependencies #define SharedLibDependencies(libname,libsource,revname) /**/ #endif /* * SharedDSLibDependencies - shared library dependencies with data separation */ #ifndef SharedDSLibDependencies #define SharedDSLibDependencies(libname,libsource,revname) /**/ #endif /* * SharedLibReferences - variables for shared libraries */ #ifndef SharedLibReferences #define SharedLibReferences(varname,libname,libsource,revname,rev) @@\ revname = rev @@\ Concat3(DEP,varname,LIB) = SharedLibDependencies(libname,libsource,revname) @@\ Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname) @@\ LintLibReferences(varname,libname,libsource) #endif /* * SharedDSLibReferences - variables for shared libraries with data separation */ #ifndef SharedDSLibReferences #define SharedDSLibReferences(varname,libname,libsource,revname,rev) @@\ revname = rev @@\ Concat3(DEP,varname,LIB) = SharedDSLibDependencies(libname,libsource,revname) @@\ Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname) @@\ LintLibReferences(varname,libname,libsource) #endif /* * CPPOnlyCompile - run C compiler's preprocessor only */ #ifndef CPPOnlyCompile #define CPPOnlyCompile(src,options) RemoveFile($@) @@\ ClearmakeOSName \ $(CC) -E $(CFLAGS) options src > $@ #endif /* * ObjectCompile - compile fragment for a normal object file */ #ifndef ObjectCompile #define ObjectCompile(options) RemoveFile($@) @@\ ClearmakeOSName \ $(CC) -c $(CFLAGS) options $*.c #endif /* * CompileCToAsm - compile C file to assembler */ #ifndef CompileCToAsm #define CompileCToAsm(options) RemoveFile($@) @@\ ClearmakeOSName \ $(CC) -S $(CFLAGS) options $*.c #endif /* * CompileCplusplusToAsm - compile C++ file to assembler */ #ifndef CompileCplusplusToAsm #define CompileCplusplusToAsm(options) RemoveFile($@) @@\ ClearmakeOSName \ $(CC) -S $(CFLAGS) options $*.cc #endif #ifndef ObjectCplusplusCompile #define ObjectCplusplusCompile(options) RemoveFile($@) @@\ ClearmakeOSName \ $(CXX) -c $(CXXFLAGS) options $*.CCsuf #endif /* * NormalLibObjCompile - compile fragment for a normal library object file */ #ifndef NormalLibObjCompile #define NormalLibObjCompile(options) ObjectCompile(options) #endif #ifndef NormalRelocLibObjCompile # if !StaticNeedsPicForShared # define NormalRelocLibObjCompile(options) NormalLibObjCompile(options) # else # define NormalRelocLibObjCompile(options) NormalLibObjCompile(options $(PICFLAGS)) # endif #endif #ifndef NormalLibObjCplusplusCompile #define NormalLibObjCplusplusCompile(options) ObjectCplusplusCompile(options) #endif /* * NormalSharedLibObjCompile - compile fragment for shared objects */ #ifndef NormalSharedLibObjCompile #define NormalSharedLibObjCompile(options) NormalLibObjCompile(options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS)) #endif #ifndef NormalSharedLibObjCplusplusCompile #define NormalSharedLibObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options $(SHLIBDEF) $(SHAREDCODEDEF) $(CXXPICFLAGS)) #endif /* * LibObjCompile - compile fragment for unshared/profiled/debugged objects */ #ifndef LibObjCompile #if HasGcc || HasGcc2 #define LibObjCompile(dir,options) RemoveFiles($@ dir/$@) @@\ ClearmakeOSName \ $(CC) -c $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) \ options $*.c -o dir/$@ #else #define LibObjCompile(dir,options) RemoveFiles($@ dir/$@) @@\ ClearmakeOSName \ $(CC) -c $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) \ options $*.c @@\ $(MV) $@ dir/$@ #endif #endif #ifndef LibObjCplusplusCompile #if HasGcc || HasGcc2 #define LibObjCplusplusCompile(dir,options) RemoveFiles($@ dir/$@) @@\ ClearmakeOSName \ $(CXX) -c $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) \ options $*.CCsuf -o dir/$@ #else #define LibObjCplusplusCompile(dir,options) RemoveFiles($@ dir/$@) @@\ ClearmakeOSName \ $(CXX) -c $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) \ options $*.CCsuf @@\ $(MV) $@ dir/$@ #endif #endif /* * DebuggedLibObjCompile - compile fragment for debugged objects */ #ifndef DebuggedLibObjCompile #define DebuggedLibObjCompile(options) LibObjCompile(debugger,DebuggableCDebugFlags options) #endif #ifndef DebuggedLibObjCplusplusCompile #define DebuggedLibObjCplusplusCompile(options) LibObjCplusplusCompile(debugger,DebuggableCplusplusDebugFlags options) #endif /* * ProfiledLibObjCompile - compile fragment for profiled objects */ #ifndef ProfiledLibObjCompile #define ProfiledLibObjCompile(options) LibObjCompile(profiled,ProfiledCDebugFlags options) #endif #ifndef ProfiledLibObjCplusplusCompile #define ProfiledLibObjCplusplusCompile(options) LibObjCplusplusCompile(profiled,ProfiledCplusplusDebugFlags options) #endif /* * UnsharedLibObjCompile - compile fragment for unshared objects */ #ifndef UnsharedLibObjCompile #define UnsharedLibObjCompile(options) LibObjCompile(unshared,$(CDEBUGFLAGS) $(CLIBDEBUGFLAGS) options) #endif #ifndef UnsharedLibObjCplusplusCompile #define UnsharedLibObjCplusplusCompile(options) LibObjCplusplusCompile(unshared,$(CXXDEBUGFLAGS) $(CXXLIBDEBUGFLAGS) options) #endif /* * SharedLibObjCompile - compile fragment for shared objects */ #ifndef SharedLibObjCompile #define SharedLibObjCompile(options) LibObjCompile(shared,options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $(CDEBUGFLAGS) $(CLIBDEBUGFLAGS)) #endif /* * NormalLibraryObjectRule - for simple libraries */ #ifndef NormalLibraryObjectRule #define NormalLibraryObjectRule() @@\ .c.Osuf: @@\ NormalLibObjCompile($(_NOOP_)) #endif /* NormalLibraryObjectRule */ #ifndef NormalCplusplusObjectRule #define NormalCplusplusObjectRule() @@\ .CCsuf.Osuf: @@\ NormalLibObjCplusplusCompile($(_NOOP_)) #endif #ifndef NormalFortranObjectRule #define NormalFortranObjectRule() @@\ .f.Osuf: @@\ RemoveFile($@) @@\ ClearmakeOSName \ $(FC) -c $(FCFLAGS) $*.f #endif /* * SpecialObjectRule - generate rules to compile a file with special flags. */ #ifndef SpecialObjectRule #define SpecialObjectRule(objs,depends,options) @@\ objs: depends @@\ ObjectCompile(options) #endif /* SpecialObjectRule */ #ifndef SpecialCplusplusObjectRule #define SpecialCplusplusObjectRule(baseobj,basedep,options) @@\ baseobj.Osuf: basedep.CCsuf @@\ ObjectCplusplusCompile(options) #endif /* SpecialCplusplusObjectRule */ /* * SpecialCObjectRule - generate rules to compile a C file with special flags. * also handles CodeCenter rules */ #ifndef SpecialCObjectRule #define SpecialCObjectRule(basename,depends,options) @@\ SpecialObjectRule(basename.Osuf,basename.c depends,options) @@\ @@\ basename.i: basename.c depends @@\ CPPOnlyCompile(basename.c,options) @@\ @@\ basename.s: basename.c depends @@\ CompileCToAsm(options) @@\ @@\ CenterLoadTarget(debug_src,basename.c,NullParameter,$(ALLDEFINES) options) #endif /* SpecialCObjectRule */ #ifndef ObjectFromSpecialSource #define ObjectFromSpecialSource(dst,src,flags) @@\ NoConfigRec(dst.c) @@\ @@\ dst.c: src.c @@\ RemoveFile($@) @@\ $(LN) $? $@ @@\ @@\ SpecialCObjectRule(dst,NullParameter,flags) @@\ @@\ includes:: dst.c @@\ @@\ depend:: dst.c @@\ @@\ clean:: @@\ RemoveFile(dst.c) #endif /* ObjectFromSpecialSource */ #ifndef CPPOnlyAsm #define CPPOnlyAsm(basename,options) RemoveFile(basename.i) @@\ $(CPP) AsmDefines $(DEFINES) $(INCLUDES) options basename.S | \ @@\ grep -v '^\#' > basename.i #endif #ifndef AssembleObject #define AssembleObject(basename,flags) CPPOnlyAsm(basename,flags) @@\ RemoveFile(basename.o) @@\ $(AS) -o basename.o basename.i @@\ RemoveFile(basename.i) #endif #ifndef NormalAsmObjectRule #define NormalAsmObjectRule() @@\ .S.o: @@\ AssembleObject($*,$(_NOOP_)) @@\ @@\ .S.i: @@\ CPPOnlyAsm($*,$(_NOOP_)) #endif #ifndef ObjectFromSpecialAsmSource #define ObjectFromSpecialAsmSource(dst,src,flags) @@\ dst.S: src.S @@\ RemoveFile($@) @@\ $(LN) $? $@ @@\ @@\ dst.o: dst.S @@\ AssembleObject(dst,flags) @@\ @@\ dst.i: dst.S @@\ CPPOnlyAsm(dst,flags) @@\ @@\ depend:: dst.S @@\ @@\ clean:: @@\ RemoveFile(dst.S) #endif #ifndef ObjectFromAsmSource #define ObjectFromAsmSource(src,flags) @@\ @@\ src.o: src.S @@\ AssembleObject(src,flags) @@\ @@\ src.i: src.S @@\ CPPOnlyAsm(src,flags) @@\ @@\ depend:: src.S #endif #ifndef SwitchYYPrefix #define SwitchYYPrefix(in,out,prefix) \ sed 's/yy/prefix/g' in | sed 's/__REALLY_YY__/yy/' > out && RemoveFile(in) #endif #ifndef LexFilePrefix #define LexFilePrefix(file,prefix) @@\ file.c: file.l @@\ ClearmakeOSName \ $(LEX) $(LFLAGS) file.l @@\ SwitchYYPrefix(lex.yy.c,file.c,prefix) @@\ @@\ depend:: file.c @@\ @@\ clean:: @@\ RemoveFiles(lex.yy.c file.c) #endif #ifndef LexFileExplicit #if HasClearmake /* provide a place to hang ClearmakeOSName */ #define LexFileExplicit(file) @@\ file.c: file.l @@\ ClearmakeOSName \ $(LEX) $(LFLAGS) file.l @@\ $(MV) lex.yy.c file.c #else #define LexFileExplicit(file) /* the default rule is fine */ #endif #endif #ifndef LexFile #define LexFile(file) @@\ LexFileExplicit(file) @@\ @@\ depend:: file.c @@\ @@\ clean:: @@\ RemoveFiles(lex.yy.c file.c) #endif /* LexFile */ #ifndef M4File #define M4File(file,includes) @@\ file: file.m4 includes @@\ RemoveFile(file) @@\ $(M4) $(M4FLAGS) file.m4 >file @@\ @@\ depend:: file @@\ @@\ clean:: @@\ RemoveFile(file) #endif /* M4File */ #ifndef YaccFilePrefix #if HasGnuMake #define YaccFilePrefix(file,flags,prefix) @@\ depend:: file.c @@\ @@\ file.h: file.c @@\ @@\ file.c: file.y @@\ ClearmakeOSName \ $(YACC) flags file.y @@\ SwitchYYPrefix(y.tab.c,file.c,prefix) @@\ @if [ -f y.tab.h ]; then set -x; SwitchYYPrefix(y.tab.h,file.h,prefix); \@@\ else exit 0; fi @@\ @@\ clean:: @@\ RemoveFiles(y.tab.c y.tab.h file.h file.c) #else #define YaccFilePrefix(file,flags,prefix) @@\ depend:: file.c @@\ @@\ file.h file.c: file.y @@\ ClearmakeOSName \ $(YACC) flags file.y @@\ SwitchYYPrefix(y.tab.c,file.c,prefix) @@\ @if [ -f y.tab.h ]; then set -x; SwitchYYPrefix(y.tab.h,file.h,prefix); \ @@\ else exit 0; fi @@\ @@\ clean:: @@\ RemoveFiles(y.tab.c y.tab.h file.h file.c) #endif #endif /* YaccFile */ #ifndef YaccFile #if HasGnuMake #define YaccFile(file,flags) @@\ depend:: file.c @@\ @@\ file.h: file.c @@\ @@\ file.c: file.y @@\ ClearmakeOSName \ $(YACC) flags file.y @@\ $(MV) y.tab.c file.c @@\ @if [ -f y.tab.h ]; then set -x; $(MV) y.tab.h file.h; \ @@\ else exit 0; fi @@\ @@\ clean:: @@\ RemoveFiles(y.tab.c y.tab.h file.h file.c) #else #define YaccFile(file,flags) @@\ depend:: file.c @@\ @@\ file.h file.c: file.y @@\ ClearmakeOSName \ $(YACC) flags file.y @@\ $(MV) y.tab.c file.c @@\ @if [ -f y.tab.h ]; then set -x; $(MV) y.tab.h file.h; \ @@\ else exit 0; fi @@\ @@\ clean:: @@\ RemoveFiles(y.tab.c y.tab.h file.h file.c) #endif #endif /* YaccFile */ #ifndef YaccFileNoFlags #define YaccFileNoFlags(file) @@\ depend:: file.c @@\ @@\ file.c: file.y @@\ ClearmakeOSName \ $(YACC) file.y @@\ $(MV) y.tab.c file.c @@\ @@\ clean:: @@\ RemoveFiles(y.tab.c file.c) #endif /* YaccFileNoFlags */ #ifndef MakeLibrary #define MakeLibrary(libname,objlist) $(AR) libname objlist #endif #ifndef LinkBuildLibrary #ifdef UseInstalled #define LinkBuildLibrary(lib) $(_NULLCMD_) #else #define LinkBuildLibrary(lib) MakeDir($(BUILDLIBDIR)) @@\ RemoveFile($(BUILDLIBDIR)/lib) @@\ cd $(BUILDLIBDIR) && $(LN) $(BUILDLIBTOP)/$(CURRENT_DIR)/lib . #endif #endif /* LinkBuildLibrary */ #ifndef LinkBuildLibraryMaybe #ifdef UseInstalled #define LinkBuildLibraryMaybe(lib,doit) $(_NULLCMD_) #else #define LinkBuildLibraryMaybe(lib,doit) MakeDir($(BUILDLIBDIR)) @@\ @if doit; then (set -x; \ @@\ RemoveFile($(BUILDLIBDIR)/lib); \ @@\ cd $(BUILDLIBDIR) && $(LN) $(BUILDLIBTOP)/$(CURRENT_DIR)/lib .); fi #endif #endif /* LinkBuildLibraryMaybe */ #ifndef _LinkBuildLibrary /* will get redefined elsewhere */ #define _LinkBuildLibrary(lib) $(_NULLCMD_) #endif /* _LinkBuildLibrary */ #ifndef LinkBuildSonameLibrary #ifdef UseInstalled #define LinkBuildSonameLibrary(lib) true #else #define LinkBuildSonameLibrary(lib) MakeDirInline($(BUILDLIBDIR));\ @@\ (set -x; RemoveFile($(BUILDLIBDIR)/lib);\ @@\ (cd $(BUILDLIBDIR) && $(LN) $(BUILDLIBTOP)/$(CURRENT_DIR)/lib .)) #endif #endif /* LinkBuildSonameLibrary */ #ifndef LinkBuildLibraryInline #define LinkBuildLibraryInline(lib) LinkBuildSonameLibrary(lib) #endif /* LinkBuildLibraryInline */ /* * NormalLibraryTarget - generate rules to create a library. */ #ifndef NormalLibraryTarget #define NormalLibraryTarget(libname,objlist) @@\ AllTarget(LibraryTargetName(libname)) @@\ @@\ LibraryTargetName(libname): objlist $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ MakeLibrary($@,objlist) @@\ RanLibrary($@) @@\ _LinkBuildLibrary($@) #endif /* NormalLibraryTarget */ /* * NormalLibraryTarget2 - generate rules to create a library in two steps. * This is used to create libraries with large numbers of files. */ #ifndef NormalLibraryTarget2 #define NormalLibraryTarget2(libname,objlist1,objlist2) @@\ AllTarget(LibraryTargetName(libname)) @@\ @@\ LibraryTargetName(libname): objlist1 objlist2 $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ MakeLibrary($@,objlist1) @@\ MakeLibrary($@,objlist2) @@\ RanLibrary($@) @@\ _LinkBuildLibrary($@) #endif /* NormalLibraryTarget2 */ /* * NormalLibraryTarget3 - generate rules to create a library in three steps. * This is used to create libraries with very large numbers of files. */ #ifndef NormalLibraryTarget3 #define NormalLibraryTarget3(libname,objlist1,objlist2,objlist3) @@\ AllTarget(LibraryTargetName(libname)) @@\ @@\ LibraryTargetName(libname): objlist1 objlist2 objlist3 $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ MakeLibrary($@,objlist1) @@\ MakeLibrary($@,objlist2) @@\ MakeLibrary($@,objlist3) @@\ RanLibrary($@) @@\ _LinkBuildLibrary($@) #endif /* NormalLibraryTarget3 */ /* * NormalDepLibraryTarget - generate rules to create a library. */ #ifndef NormalDepLibraryTarget #define NormalDepLibraryTarget(libname,deplist,objlist) @@\ AllTarget(LibraryTargetName(libname)) @@\ @@\ LibraryTargetName(libname): deplist $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ MakeLibrary($@,objlist) @@\ RanLibrary($@) @@\ _LinkBuildLibrary($@) #endif /* NormalDepLibraryTarget */ /* * UnsharedLibraryTarget - generate rules to create a library. */ #ifndef UnsharedLibraryTarget #define UnsharedLibraryTarget(libname,objlist,down,up) @@\ AllTarget(LibraryTargetName(libname)) @@\ @@\ LibraryTargetName(libname): objlist $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ @(set -x; cd down && MakeLibrary(up/$@,objlist)) || exit 1; @@\ RanLibrary($@) @@\ _LinkBuildLibrary($@) #endif /* UnsharedLibraryTarget */ /* * UnsharedLibraryTarget3 - generate rules to create a library in three steps. * This is used to create libraries with very large numbers of files. */ #ifndef UnsharedLibraryTarget3 #define UnsharedLibraryTarget3(libname,objlist1,objlist2,objlist3,down,up) @@\ AllTarget(LibraryTargetName(libname)) @@\ @@\ LibraryTargetName(libname): objlist1 objlist2 objlist3 $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ (cd down && MakeLibrary(up/$@,objlist1)) @@\ (cd down && MakeLibrary(up/$@,objlist2)) @@\ (cd down && MakeLibrary(up/$@,objlist3)) @@\ RanLibrary($@) @@\ _LinkBuildLibrary($@) #endif /* UnsharedLibraryTarget3 */ /* * SubdirLibraryRule - */ #ifndef SubdirLibraryRule #define SubdirLibraryRule(objlist) @@\ all:: DONE @@\ @@\ DONE: objlist @@\ RemoveFile($@) @@\ touch $@ @@\ @@\ clean:: @@\ RemoveFile(DONE) #endif /* SubdirLibraryRule */ /* * ProfiledLibraryTarget - generate rules to create a profiled library. */ #ifndef ProfiledLibraryTarget #define ProfiledLibraryTarget(libname,objlist) @@\ AllTarget(LibraryTargetNameSuffix(libname,_p)) @@\ @@\ LibraryTargetNameSuffix(libname,_p): objlist $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ cd profiled && MakeLibrary(../$@,objlist) @@\ RanLibrary($@) #endif /* ProfiledLibraryTarget */ /* * ProfiledDepLibraryTarget - generate rules to create a profiled library. */ #ifndef ProfiledDepLibraryTarget #define ProfiledDepLibraryTarget(libname,deplist,objlist) @@\ AllTarget(LibraryTargetNameSuffix(libname,_p)) @@\ @@\ LibraryTargetNameSuffix(libname,_p): deplist $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ MakeLibrary($@,objlist) @@\ RanLibrary($@) #endif /* ProfiledDepLibraryTarget */ /* * DebuggedLibraryTarget - generate rules to create a debuggable library. */ #ifndef DebuggedLibraryTarget #define DebuggedLibraryTarget(libname,objlist) @@\ AllTarget(LibraryTargetNameSuffix(libname,_d)) @@\ @@\ LibraryTargetNameSuffix(libname,_d): objlist $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ cd debugger && MakeLibrary(../$@,objlist) @@\ RanLibrary($@) #endif /* DebuggedLibraryTarget */ /* * DebuggedDepLibraryTarget - generate rules to create a debuggable library. */ #ifndef DebuggedDepLibraryTarget #define DebuggedDepLibraryTarget(libname,deplist,objlist) @@\ AllTarget(LibraryTargetNameSuffix(libname,_d)) @@\ @@\ LibraryTargetNameSuffix(libname,_d): deplist $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ MakeLibrary($@,objlist) @@\ RanLibrary($@) #endif /* DebuggedDepLibraryTarget */ /* * AliasedLibraryTarget - generate rules to link one library to another. */ #ifndef AliasedLibraryTarget #define AliasedLibraryTarget(libname,alias) @@\ AllTarget(LibraryTargetName(alias)) @@\ @@\ LibraryTargetName(alias): LibraryTargetName(libname) @@\ RemoveFile($@) @@\ $(LN) LibraryTargetName(libname) $@ @@\ @@\ clean:: @@\ RemoveFile(LibraryTargetName(alias)) #endif /* AliasedLibraryTarget */ /* * NormalRelocatableTarget - generate rules to produce a relocatable object * file instead of a library. */ #ifndef NormalRelocatableTarget #define NormalRelocatableTarget(objname,objlist) @@\ AllTarget(objname.Osuf) @@\ @@\ objname.Osuf: objlist $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ $(LD) $(LDCOMBINEFLAGS) objlist -o $@ #endif /* NormalRelocatableTarget */ /* * NormalDepRelocatableTarget - generate rules to produce a relocatable object * file instead of a library. */ #ifndef NormalDepRelocatableTarget #define NormalDepRelocatableTarget(objname,deplist,objlist) @@\ AllTarget(objname.Osuf) @@\ @@\ objname.Osuf: deplist $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ $(LD) $(LDCOMBINEFLAGS) objlist -o $@ #endif /* NormalDepRelocatableTarget */ /* * ProfiledRelocatableTarget - generate rules to produce a profiled relocatable * object file instead of a library. */ #ifndef ProfiledRelocatableTarget #define ProfiledRelocatableTarget(objname,objlist) @@\ AllTarget(Concat(objname,_p.Osuf)) @@\ @@\ Concat(objname,_p.Osuf): objlist $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ $(LD) -X -r objlist -o $@ #endif /* ProfiledRelocatableTarget */ /* * DebuggedRelocatableTarget - generate rules to produce a debuggable * relocatable object file instead of a library. */ #ifndef DebuggedRelocatableTarget #define DebuggedRelocatableTarget(objname,objlist) @@\ AllTarget(Concat(objname,_d.Osuf)) @@\ @@\ Concat(objname,_d.Osuf): objlist $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ $(LD) -X -r objlist -o $@ #endif /* DebuggedRelocatableTarget */ /* * LintLibraryTarget - generate rules to create a lint library. Note that the * lint library is always forced to be newer than the library itself. */ #ifndef LintLibraryTarget #define LintLibraryTarget(libname,srclist) @@\ lintlib:: Concat(llib-l,libname.ln) @@\ @@\ Concat(llib-l,libname.ln): srclist $(EXTRALIBRARYDEPS) @@\ RemoveFile($@) @@\ $(LINT) Concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srclist #endif /* LintLibraryTarget */ /* * NormalLintTarget - generate rules to lint a set of sources. */ #ifndef NormalLintTarget #define NormalLintTarget(srclist) @@\ lint: @@\ $(LINT) $(LINTFLAGS) srclist $(LINTLIBS) @@\ lint1: @@\ $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) #endif /* NormalLintTarget */ /* * LintTarget - generate rules to lint $(SRCS) */ #ifndef LintTarget #define LintTarget() @@\ NormalLintTarget($(SRCS)) #endif /* * LinkSourceFile - snag source file from some other directory */ #ifndef LinkSourceFile #define LinkSourceFile(src,dir) @@\ src: dir/src @@\ RemoveFile($@) @@\ $(LN) $? $@ @@\ @@\ NoConfigRec(src) @@\ @@\ includes:: src @@\ @@\ depend:: src @@\ @@\ clean:: @@\ RemoveFile(src) #endif /* * LinkFile - link a file */ #ifndef LinkFile #define LinkFile(tofile,fromfile) @@\ tofile:: fromfile @@\ RemoveFile($@) @@\ $(LN) $? $@ @@\ @@\ NoConfigRec(tofile) @@\ @@\ includes:: tofile @@\ @@\ depend:: tofile @@\ @@\ clean:: @@\ RemoveFile(tofile) #endif #ifndef MakeSubincludesForBuild #define MakeSubincludesForBuild(step,dir,srclist) @@\ step:: dir srclist @@\ @-(list=`echo srclist | sed -e 's/[^ ]*\///g'`; \ @@\ set -x; cd dir && RemoveFiles($$list)) @@\ @for i in srclist; do \ @@\ (set -x; cd dir && $(LN) ../$$i .); \ @@\ done @@\ @@\ dir:: @@\ $(MKDIRHIER) dir @@\ @@\ clean:: @@\ @-(if [ -d dir ]; then \ @@\ list=`echo srclist | sed -e 's/[^ ]*\///g'`; \ @@\ set -x; cd dir && RemoveFile($$list); else exit 0; fi) #endif /* * LangNamedTargetSubdirs - recursively make a series of steps */ #ifndef LangNamedTargetSubdirs #define LangNamedTargetSubdirs(lang,name,dirs,verb,flags,subname) @@\ name:: @@\ @MakeFlagsToShellFlags(ik,set +e); \ @@\ for i in dirs ;\ @@\ do \ @@\ echo verb "in $(CURRENT_DIR)/$$i..."; \ @@\ (cd $$i && LANG=lang $(MAKE) $(MFLAGS) flags subname);\ @@\ done #endif /* * NamedMakeSubdirs - generate rules to do makes in the given subdirectories. * If you want CDEBUGFLAGS passed along to subdirectories, provide a line like * the following in the appropriate Imakefile * * #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' */ #ifndef LangNamedMakeSubdirs #define LangNamedMakeSubdirs(lang,name,dirs) \ LangNamedTargetSubdirs(lang,name,dirs,"making" name,PassCDebugFlags,all) #endif /* LangNamedMakeSubdirs */ #ifndef LangMakeSubdirs #define LangMakeSubdirs(lang,dirs) @@\ LangNamedMakeSubdirs(lang,all,dirs) #endif /* LangMakeSubdirs */ /* * NamedTargetSubdirs - recursively make a series of steps */ #ifndef NamedTargetSubdirs #define NamedTargetSubdirs(name,dirs,verb,flags,subname) @@\ name:: @@\ @MakeFlagsToShellFlags(ik,set +e); \ @@\ for i in dirs ;\ @@\ do \ @@\ echo verb "in $(CURRENT_DIR)/$$i..."; \ @@\ MakeNamedTargetSubdir($$i,flags,subname); \ @@\ done #endif /* * NamedMakeSubdirs - generate rules to do makes in the given subdirectories. * If you want CDEBUGFLAGS passed along to subdirectories, provide a line like * the following in the appropriate Imakefile * * #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' */ #ifndef NamedMakeSubdirs #define NamedMakeSubdirs(name,dirs) \ NamedTargetSubdirs(name,dirs,"making" name,PassCDebugFlags,all) #endif /* NamedMakeSubdirs */ #ifndef MakeSubdirs #define MakeSubdirs(dirs) @@\ NamedMakeSubdirs(all,dirs) #endif /* MakeSubdirs */ /* * DependSubdirs - generate rules to recursively compute dependencies as * part of the make depend step. */ #ifndef DependSubdirs #define DependSubdirs(dirs) \ NamedTargetSubdirs(depend,dirs,"depending",NullParameter,depend) #endif /* DependSubdirs */ /* * ForceSubdirs - force make to build subdirectories */ #ifndef ForceSubdirs #if !HasBsdMake #define ForceSubdirs(dirs) @@\ dirs: FRC @@\ @echo "making all in $(CURRENT_DIR)/$@..." @@\ @MakeNamedTargetSubdir($@,PassCDebugFlags,all) @@\ @@\ FRC: #else /* For BSD 4.4 make */ #define ForceSubdirs(dirs) @@\ dirs: .EXEC @@\ @cd $@ ; echo "making all in $(CURRENT_DIR)/$@..."; \ @@\ $(MAKE) $(MFLAGS) PassCDebugFlags all @@\ @@\ .EXEC: #endif #endif /* ForceSubdirs */ /* * InstallSubdirs - generate rules to recursively install programs and files. */ #ifndef InstallSubdirs #define InstallSubdirs(dirs) \ NamedTargetSubdirs(install,dirs,"installing",DESTDIR=$(DESTDIR),install) #endif /* InstallSubdirs */ /* * InstallManSubdirs - generate rules to recursively install manual pages. */ #ifndef InstallManSubdirs #define InstallManSubdirs(dirs) \ NamedTargetSubdirs(install.man,dirs,"installing man pages",DESTDIR=$(DESTDIR),install.man) #endif /* InstallManSubdirs */ /* * IncludesSubdirs - generate rules to recursively put include files in build */ #ifndef IncludesSubdirs #define IncludesSubdirs(dirs) \ NamedTargetSubdirs(includes,dirs,including,NullParameter,includes) #endif /* * InstallDriverSDKSubdirs - generate rules to recursively install Driver * SDK (only used for XFree86). This is a no-op * rule so that Imakefiles on non-XFree86 systems * continue to build Makefiles correctly. */ #ifndef InstallDriverSDKSubdirs #define InstallDriverSDKSubdirs(dirs) #endif /* * InstallDriverSDKObjectModule - generate rules to recursively install Driver * SDK (only used for XFree86). This is a no-op * rule so that Imakefiles on non-XFree86 systems * continue to build Makefiles correctly. */ #ifndef InstallDriverSDKObjectModule #define InstallDriverSDKObjectModule(module,dest,subdir) #endif #ifndef InstallDriverSDKObjectSubModule #define InstallDriverSDKObjectSubModule(module,dest,subdir) #endif /* * CleanSubdirs - generate rules to recursively clean out garbage files. */ #define BootstrapCleanSubdirs /**/ /* used at top-level */ #ifndef NamedCleanSubdirs #define NamedCleanSubdirs(name,dirs) \ NamedTargetSubdirs(name,dirs,"cleaning",BootstrapCleanSubdirs,clean) #endif /* NamedCleanSubdirs */ #ifndef CleanSubdirs #define CleanSubdirs(dirs) \ NamedCleanSubdirs(clean,dirs) #endif /* * TagSubdirs - generate rules to recursively create tags files. */ #ifndef NamedTagSubdirs #define NamedTagSubdirs(name,dirs) \ NamedTargetSubdirs(name,dirs,"tagging",TAGS='$(TAGS)',tags) #endif /* TagSubdirs */ #ifndef TagSubdirs #define TagSubdirs(dirs) \ NamedTagSubdirs(tags,dirs) #endif /* * MakeLintSubdirs - generate rules to recursively lint directories as part * of the named step. */ #ifndef MakeLintSubdirs #define MakeLintSubdirs(dirs,target,subtarget) \ NamedTargetSubdirs(target,dirs,"linting" for target and subtarget,DESTDIR=$(DESTDIR) LINTOPTS='$(LINTOPTS)',subtarget) #endif /* MakeLintSubdirs */ /* * LintSubdirs - generate rules to recursively lint directories as part of * the make lint step. */ #ifndef LintSubdirs #define LintSubdirs(dirs) @@\ MakeLintSubdirs(dirs,lint,lint) #endif /* LintSubdirs */ /* * MakeLintLibSubdirs - generate rules to recursively create lint libraries. */ #ifndef MakeLintLibSubdirs #define MakeLintLibSubdirs(dirs) @@\ MakeLintSubdirs(dirs,lintlib,lintlib) #endif /* MakeLintLibSubdirs */ /* * MakeMakeSubdirs - generate rules to recursively recreate Makefiles as part * of the specified step in the build. If $(TOP) is set to an absolute path, * do not prepend the ../ prefix. This makes running things outside of the * source tree much easier. * $(ONESUBDIR)/Makefile exists as a separate, explicit target so that * clearmake will know what its goal is and do wink-in. */ #ifndef MakeMakeSubdirs #define MakeMakeSubdirs(dirs,target) @@\ $(ONESUBDIR)/Makefile: @@\ @MakeFlagsToShellFlags(n,executeit="no"); \ @@\ cd $(ONESUBDIR) && \ @@\ if [ "$$executeit" != "no" ]; then \ @@\ ImakeSubCmdHelper -DTOPDIR=$(IMAKETOP) -DCURDIR=$(ONECURDIR)$(ONESUBDIR); \ @@\ fi; @@\ @@\ target:: @@\ -@MakeFlagsToShellFlags(ik,set +e); \ @@\ MakeFlagsToShellFlags(n,executeit="no"); \ @@\ for i in dirs ;\ @@\ do \ @@\ case "$(CURRENT_DIR)" in \ @@\ .) curdir= ;; \ @@\ *) curdir=$(CURRENT_DIR)/ ;; \ @@\ esac; \ @@\ echo "making Makefiles in $$curdir$$i..."; \ @@\ itmp=`echo $$i | sed -e 's;^\./;;g' -e 's;/\./;/;g'`; \ @@\ curtmp="$(CURRENT_DIR)" \ @@\ toptmp=""; \ @@\ case "$$itmp" in \ @@\ ../?*) \ @@\ while echo "$$itmp" | grep '^\.\./' > /dev/null;\ @@\ do \ @@\ toptmp="/`basename $$curtmp`$$toptmp"; \ @@\ curtmp="`dirname $$curtmp`"; \ @@\ itmp="`echo $$itmp | sed 's;\.\./;;'`"; \ @@\ done \ @@\ ;; \ @@\ esac; \ @@\ case "$$itmp" in \ @@\ */?*/?*/?*/?*) newtop=../../../../..;; \ @@\ */?*/?*/?*) newtop=../../../..;; \ @@\ */?*/?*) newtop=../../..;; \ @@\ */?*) newtop=../..;; \ @@\ *) newtop=..;; \ @@\ esac; \ @@\ newtop="$$newtop$$toptmp"; \ @@\ case "$(TOP)" in \ @@\ /?*) imaketop=$(TOP) \ @@\ imakeprefix= ;; \ @@\ .) imaketop=$$newtop \ @@\ imakeprefix=$$newtop/ ;; \ @@\ *) imaketop=$$newtop/$(TOP) \ @@\ imakeprefix=$$newtop/ ;; \ @@\ esac; \ @@\ RemoveFile($$i/Makefile.bak); \ @@\ if [ -f $$i/Makefile ]; then \ @@\ echo " $(MV) Makefile Makefile.bak"; \ @@\ if [ "$$executeit" != "no" ]; then \ @@\ $(MV) $$i/Makefile $$i/Makefile.bak; \ @@\ fi; \ @@\ fi; \ @@\ $(MAKE) $(MFLAGS) $(MAKE_OPTS) ONESUBDIR=$$i ONECURDIR=$$curdir IMAKETOP=$$imaketop IMAKEPREFIX=$$imakeprefix $$i/Makefile; \ @@\ if [ -d $$i ] ; then \ @@\ cd $$i; \ @@\ $(MAKE) $(MFLAGS) Makefiles; \ @@\ cd $$newtop; \ @@\ else \ @@\ exit 1; \ @@\ fi; \ @@\ done #define ImakeSubCmdHelper $(IMAKE_CMD) -I$(IMAKEPREFIX)$(IRULESRC) \ $(IMAKE_DEFINES) $(IMAKE_WARNINGS) #endif /* MakeMakeSubdirs */ /* * MakefileSubdirs - generate rules to create Makefiles. */ #ifndef MakefileSubdirs #define MakefileSubdirs(dirs) @@\ MakeMakeSubdirs(dirs,Makefiles) #endif /* MakefileSubdirs */ /* * Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM * to cpp, because that trick does not work on all ANSI C preprocessors. * Delete line numbers from the cpp output (-P is not portable, I guess). * Allow XCOMM to be preceded by whitespace and provide a means of generating * output lines with trailing backslashes. * Allow XHASH to always be substituted, even in cases where XCOMM isn't. */ #ifndef CppSedMagic #define CppSedMagic sed -e '/^# *[0-9][0-9]* *.*$$/d' \ -e '/^#line *[0-9][0-9]* *.*$$/d' \ -e '/^[ ]*XCOMM$$/s/XCOMM/#/' \ -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/#/' \ -e '/^[ ]*XHASH/s/XHASH/#/' \ -e '/\@\@$$/s/\@\@$$/\\/' #endif /* CppSedMagic */ #ifndef CppFileTarget #define CppFileTarget(dst,src,defs,deplist) @@\ dst:: src deplist @@\ RemoveFile($@) @@\ ClearmakeOSName \ $(CPP) CppNoLineInfoOption defs $@ @@\ @@\ clean:: @@\ RemoveFiles(dst) #endif /* CppFileTarget */ /* * CppScriptTarget - generate rules to create a shell script by running the * input through cpp. If the ExecableScripts configuration parameter is not * set, then make sure that the first line begins with a colon. */ #ifndef CppScriptTarget #if ExecableScripts /* can use #! instead of colon */ #define CppScriptTarget(dst,src,defs,deplist) @@\ dst:: src deplist @@\ RemoveFile($@) @@\ ClearmakeOSName \ $(CPP) CppNoLineInfoOption defs $@ @@\ chmod a+x $@ @@\ @@\ clean:: @@\ RemoveFiles(dst) #else #define CppScriptTarget(dst,src,defs,deplist) @@\ dst:: src deplist @@\ RemoveFile($@) @@\ ClearmakeOSName \ echo \: >$@ @@\ sed '1d' src | $(CPP) CppNoLineInfoOption defs | CppSedMagic >>$@ @@\ chmod a+x $@ @@\ @@\ clean:: @@\ RemoveFile(dst) #endif /* ExecableScripts */ #endif /* CppScriptTarget */ /* * MakeScriptFromCpp - generate rules to create a script from a file with a * .cpp suffix. */ #ifndef MakeScriptFromCpp #define MakeScriptFromCpp(name,defs) @@\ CppScriptTarget(name,name.cpp,defs,NullParameter) #endif /* MakeScriptFromCpp */ #ifndef CppSourceFile #define CppSourceFile(dst,src,defs,deplist) @@\ CppFileTarget(dst,src,defs,deplist) @@\ @@\ includes:: dst @@\ @@\ depend:: dst #endif /* CppSourceFile */ /* Like CppFileTarget, but don't add any default defines */ #ifndef CppRawFileTarget #define CppRawFileTarget(dst,src,defs,deplist) @@\ dst:: src deplist @@\ RemoveFile($@) @@\ ClearmakeOSName \ $(RAWCPP) CppNoLineInfoOption defs $@ @@\ @@\ clean:: @@\ RemoveFiles(dst) #endif /* CppFileTarget */ /* * CppManTarget - preprocess man pages. OS-specific man sections are replaced. */ #ifndef CppManTarget #define CppManTarget(name,defs) @@\ AllTarget(name.$(MANNEWSUFFIX)) @@\ @@\ name.$(MANNEWSUFFIX): name.$(MANSRCSUFFIX) @@\ RemoveFile($@) @@\ if test -z "$(PREPROCESSMANPAGES)" ; then \ @@\ cd `dirname name` && \ @@\ $(LN) `basename name.$(MANSRCSUFFIX)` `basename $@`; \ @@\ else \ @@\ ClearmakeOSName \ $(RAWCPP) CppNoLineInfoOption $(MANDEFS) defs \ @@\ < name.$(MANSRCSUFFIX) | CppSedMagic >$@; \ @@\ fi @@\ @@\ clean:: @@\ RemoveFile(name.$(MANNEWSUFFIX)) #endif /* CppManTarget */ /* * MakeDirectories - generate rules to create a hierarchy of directories. */ #ifndef MakeDirectories #define MakeDirectories(step,dirs) @@\ step:: @@\ DirFailPrefix@MakeFlagsToShellFlags(i,set +e); \ @@\ for i in dirs; do if [ -d $(DESTDIR)$$i ]; then \ @@\ set +x; else (set -x; $(MKDIRHIER) $(DESTDIR)$$i); fi; \ @@\ done #endif /* MakeDirectories */ /* * AllTarget - generate rules to build necessary things during make all. */ #ifndef AllTarget #define AllTarget(depends) @@\ all:: depends #endif /* AllTarget */ #ifdef DefineOldLibraryRules #include #endif #ifndef StaticLibrary #define StaticLibrary(libpath,libname) Concat3(libpath,/,LibraryTargetName(libname)) #endif /* * MakeMutex - generate mutex rules for parallel make */ #ifndef MakeMutex #ifdef MutexDirective #define MakeMutex(targets) @@\ MutexDirective: targets #endif /* MutexDirective */ #endif /* MakeMutex */ /* * Rules for dynamic modules. These are primarily used by XFree86 */ #ifndef LinkBuildModule #ifdef UseInstalled #define LinkBuildModule(module,subdir) $(_NULLCMD_) #else #define LinkBuildModule(module,subdir)\ MakeDir($(BUILDMODULEDIR)/subdir) @@\ RemoveFile($(BUILDMODULEDIR)/subdir/module) @@\ @(UP="`$(REVPATH) subdir`"; set -x; \ @@\ cd $(BUILDMODULEDIR)/subdir && \ @@\ $(LN) $(BUILDMODULETOP)/$${UP}$(CURRENT_DIR)/module .) #endif #endif /* LinkBuildModule */ #ifndef LinkBuildNamedModule #ifdef UseInstalled #define LinkBuildNamedModule(module,name,subdir) $(_NULLCMD_) #else #define LinkBuildNamedModule(module,name,subdir)\ MakeDir($(BUILDMODULEDIR)/subdir) @@\ RemoveFile($(BUILDMODULEDIR)/subdir/name) @@\ @(UP="`$(REVPATH) subdir`"; set -x; \ @@\ cd $(BUILDMODULEDIR)/subdir && \ @@\ $(LN) $(BUILDMODULETOP)/$${UP}$(CURRENT_DIR)/module name) #endif #endif /* LinkBuildNamedModule */ /* * ModuleObjectRule */ #ifndef ModuleObjectRule #define ModuleObjectRule() NormalLibraryObjectRule() #endif /* * ObjectModuleTarget - build a module as a single object file */ #ifndef ObjectModuleTarget #define ObjectModuleTarget(module,objects) @@\ NormalRelocatableTarget(Concat(module,_drv), objects) #endif /* * LibraryModuleTarget */ #ifndef LibraryModuleTarget #define LibraryModuleTarget(module, objects) @@\ NormalLibraryTarget(module, objects) #endif /* * DepLibraryModuleTarget */ #ifndef DepLibraryModuleTarget #define DepLibraryModuleTarget(module,deplist,objects) @@\ NormalDepLibraryTarget(module, deplist, objects) #endif /* * DynamicModuleTarget - build a module to be dynamically loaded */ #ifndef DynamicModuleTarget #define DynamicModuleTarget(module,modlist) @@\ AllTarget(module) @@\ @@\ module: modlist @@\ RemoveFile($@) @@\ $(CC) -o $@ $(SHLIBLDFLAGS) $(NOSTDLIB) modlist $(POSTNOSTDLIB) @@\ @@\ clean:: @@\ RemoveFile(module) #endif /* DynamicModuleTarget */ /* * DepDynamicModuleTarget - build a module to be dynamically loaded */ #ifndef DepDynamicModuleTarget #define DepDynamicModuleTarget(module,deplist,modlist) @@\ AllTarget(module) @@\ @@\ module: deplist @@\ RemoveFile($@) @@\ $(CC) -o $@ $(SHLIBLDFLAGS) $(NOSTDLIB) modlist $(POSTNOSTDLIB) @@\ @@\ clean:: @@\ RemoveFile(module) #endif /* DepDynamicModuleTarget */ /* * InstallDynamicModule - install a dynamic module */ #ifndef InstallDynamicModule #define InstallDynamicModule(module,dest,subdir) @@\ AllTarget(module) @@\ LinkBuildModule(module,subdir) @@\ @@\ install:: module @@\ MakeDir($(DESTDIR)dest/subdir) @@\ $(INSTALL) -c $(INSTDATFLAGS) module $(DESTDIR)dest/subdir #endif #ifndef InstallDynamicNamedModule #define InstallDynamicNamedModule(module,instname,dest,subdir) @@\ AllTarget(module) @@\ LinkBuildNamedModule(module,instname,subdir) @@\ @@\ install:: module @@\ MakeDir($(DESTDIR)dest/subdir) @@\ $(INSTALL) -c $(INSTDATFLAGS) module $(DESTDIR)dest/subdir/instname #endif /* Shortcuts for installing driver module, one per class */ #ifndef InstallVideoObjectModule #define InstallVideoObjectModule(module,dest) @@\ InstallObjectModule(module,dest,drivers) #endif #ifndef InstallInputObjectModule #define InstallInputObjectModule(module,dest) @@\ InstallObjectModule(module,dest,input) #endif #ifndef InstallExtensionsObjectModule #define InstallExtensionsObjectModule(module,dest) @@\ InstallObjectModule(module,dest,extensions) #endif #ifndef InstallFontsObjectModule #define InstallFontsObjectModule(module,dest) @@\ InstallObjectModule(module,dest,fonts) #endif #ifndef InstallMultimediaObjectModule #define InstallMultimediaObjectModule(module,dest) @@\ InstallObjectModule(module,dest,multimedia) #endif #ifndef InstallObjectModule #define InstallObjectModule(module,dest,subdir) /**/ #endif #ifndef InstallLibraryModule #define InstallLibraryModule(module,dest,subdir) /**/ #endif #ifndef InstallModuleManPage #define InstallModuleManPage(module) @@\ InstallGenManPage(module,$(DRIVERMANDIR),$(DRIVERMANSUFFIX)) #endif #ifndef BuildObjectFromLibraryWithPath #define BuildObjectFromLibraryWithPath(libpath,libname,objname) @@\ AllTarget(objname.Osuf) @@\ @@\ objname.Osuf: Concat3(libpath,/lib,libname.a) @@\ @$(MKDIRHIER) tmp @@\ @$(CP) Concat3(libpath,/lib,libname.a) tmp @@\ @(cd tmp; set -x; ArExtCmd Concat(lib,libname.a); \ @@\ $(LD) $(LDCOMBINEFLAGS) *.Osuf -o ../$@; \ @@\ RemoveFiles(*.Osuf)) @@\ @$(RM) -r tmp @@\ @@\ clean:: @@\ RemoveFile(objname.Osuf) #endif #ifndef BuildObjectFromLibrary #define BuildObjectFromLibrary(libname,objname) BuildObjectFromLibraryWithPath(.,libname,objname) #endif /* * LinkerRuntimeLibraryPathFlag - defined here to be a no-op for systems that * don't need it. Overridden in system-specific config files for systems that * need it, usually with something like "Concat(-R,path)" */ #ifndef LinkerRuntimeLibraryPathFlag # define LinkerRuntimeLibraryPathFlag(path) /* */ #endif /* Phony targets - GNU make has a feature to mark a target as phony, * which means that it won't consider that target to be the name of a * file. In general this speeds up make, since it doesn't have to * look for those files when it sets out to create a phony target. * However, on cygwin, this is actually required for correct * operation, since the Win32 filesystems are case insensitive and the * install target conflicts with the INSTALL file present in some * (autotooled) directories. * * We probably don't need the #ifdef protection, since other make * implementations would just consider this a normal rule. Better * safe than sorry, though. */ #if HasGnuMake .PHONY: all interfaces install install.man install.lib install.sdk \ depend includes clean #endif nx-libs-3.5.99.23/nx-X11/config/cf/Imake.tmpl0000644000000000000000000015026513614532331015075 0ustar XCOMM ---------------------------------------------------------------------- XCOMM Makefile generated from IMAKE_TEMPLATE and INCLUDE_IMAKEFILE XCOMM ---------------------------------------------------------------------- /* * generic imake template */ /* * Modify Imake.cf when adding a new architecture, do not modify this file. * Platform-specific parameters may be set in the appropriate .cf * configuration files. Site-specific parameters should be set in the file * site.def. Full rebuilds are recommended if any parameters are changed. * If your C preprocessor does not define any unique symbols, you will need * to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing * "make World" the first time). */ #define ImakeConfigRelease 6 #define YES 1 #define NO 0 /* Ensure that "all" is the default target in the Makefile. */ all:: .SUFFIXES: .i /* Intercept clean rules for current directory */ #undef clean #define clean cleandir #include XCOMM ----------------------------------------------------------------------- XCOMM site-specific configuration parameters that need to come before XCOMM the platform-specific parameters - edit site.def to change #define BeforeVendorCF #include #undef BeforeVendorCF #if defined(HasGcc3) && !defined(HasGcc2) # define HasGcc2 HasGcc3 #endif #if defined(HasGcc2) && !defined(HasGcc) # define HasGcc HasGcc2 #endif #ifndef HasCenterLineC #define HasCenterLineC NO #endif #ifndef HasCenterLineCplusplus #define HasCenterLineCplusplus NO #endif #ifndef HasClearmake # define HasClearmake NO #endif #ifndef ProPoliceSupport #define ProPoliceSupport NO #endif /* * ClearmakeOSName - insert the current OS type into the clearmake * build script, so .o files from different platforms cannot be winked in. * If clearmake finds the build script for two .o files is the same, it * will share the .o, even across different architectures. Inserting the * O/S name into the build script in a comment prevents unwanted sharing. * Note the trailing double-@ in the macro: end a line using this macro * with backslash without the double-@ usually used. * Like this: * * #define SomeRule() @@\ * something or other @@\ * ClearmakeOSName \ * something else @@\ * and more */ #ifndef ClearmakeOSName # if HasClearmake # define ClearmakeOSName @ XCOMM $(OSNAME) @@ # else # define ClearmakeOSName /**/ # endif #endif #if HasClearmake # ifndef MakeCmd # define MakeCmd clearmake # endif #endif #if HasClearmake XCOMM ---------------------------------------------------------------------- .c.o: ClearmakeOSName $(CC) -c $(CFLAGS) $*.c #endif XCOMM ---------------------------------------------------------------------- XCOMM platform-specific configuration parameters - edit MacroFile to change #include MacroIncludeFile XCOMM ---------------------------------------------------------------------- XCOMM site-specific configuration parameters that go after XCOMM the platform-specific parameters - edit site.def to change #define AfterVendorCF #include #undef AfterVendorCF /* * defaults for various generic parameters; set in site.def if needed */ /* the following are needed before we can include Imake.rules */ #ifndef NothingOutsideProjectRoot #define NothingOutsideProjectRoot NO #endif #ifndef RemoveObsoleteFiles #define RemoveObsoleteFiles YES #endif #ifndef HasVarDirectory #define HasVarDirectory YES #endif #ifndef UseEtcX11 #define UseEtcX11 YES #endif #ifndef UseInstalledX11 # define UseInstalledX11 NO #endif #ifdef UseInstalled # undef UseInstalledX11 # define UseInstalledX11 YES #endif #if NothingOutsideProjectRoot #undef UseEtcX11 #define UseEtcX11 NO #endif #ifndef UseSeparateConfDir #define UseSeparateConfDir (UseEtcX11 || HasVarDirectory) #endif #if NothingOutsideProjectRoot #undef UseSeparateConfDir #define UseSeparateConfDir NO #endif #ifndef SystemV #define SystemV NO /* SYSV (R3) */ #endif #ifndef SystemV4 #define SystemV4 NO /* SVR4 */ #endif #ifndef HasCodeCenter #define HasCodeCenter NO #endif #ifndef HasSentinel #define HasSentinel NO #endif #ifndef HasPurify #define HasPurify NO #endif #ifndef HasTestCenter #define HasTestCenter NO #endif #ifndef HasGnuMake #define HasGnuMake NO #endif /* * The following fixes a glitch with GNU make -j */ #ifndef ForceServerRemake #define ForceServerRemake HasGnuMake #endif #ifndef HasBsdMake #define HasBsdMake NO #endif #ifndef HasParallelMake #define HasParallelMake NO #endif #ifndef RemoveTargetProgramByMoving #define RemoveTargetProgramByMoving NO #endif #ifndef DoRanlibCmd #if SystemV || SystemV4 #define DoRanlibCmd NO #else #define DoRanlibCmd YES #endif #endif #ifndef ExecableScripts #if SystemV #define ExecableScripts NO #else #define ExecableScripts YES /* kernel exec() can handle #! */ #endif #endif #ifndef HasMakefileSafeInclude /* -include or sinclude in a Makefile */ #if HasClearmake || HasBsdMake #define HasMakefileSafeInclude YES #else #define HasMakefileSafeInclude NO /* see also vendor-specific .cf files */ #endif #endif #ifndef HasSymLinks #define HasSymLinks YES #endif #ifndef HasPerl #define HasPerl YES #endif #ifndef HasPerl5 #define HasPerl5 HasPerl #endif #ifndef PerlCmd #define PerlCmd perl #endif #ifndef PerlOptions #define PerlOptions /**/ #endif #ifndef PerlEnvSetup #define PerlEnvSetup env LC_ALL=C #endif #ifndef HasGperf #define HasGperf NO #endif #ifndef GperfCmd #define GperfCmd gperf #endif #ifndef RmanCmd #endif #ifndef RmanOptions #endif #ifndef BuildHtmlManPages #ifdef RmanCmd #define BuildHtmlManPages YES #else #define BuildHtmlManPages NO #endif #endif /* Can't do this while bootstrapping imake */ #ifdef BootStrap #undef BuildHtmlManPages #define BuildHtmlManPages NO #endif #ifndef DontPreprocessManPages #ifdef UseInstalled #define DontPreprocessManPages YES #else #define DontPreprocessManPages NO #endif #endif #ifndef CompressManPages #define CompressManPages NO #endif #ifndef HasGroff #define HasGroff NO #endif #ifndef HasGroffHtml #define HasGroffHtml NO #endif #ifndef HasCookieMaker #define HasCookieMaker NO #endif #ifndef StripInstalledPrograms #define StripInstalledPrograms NO /* leave symbol table just in case */ #endif #ifndef StaticNeedsPicForShared #define StaticNeedsPicForShared NO #endif #include #ifndef HasSharedLibraries #define HasSharedLibraries NO #endif #ifndef OSMajorVersion #define OSMajorVersion 0 #endif #ifndef OSMinorVersion #define OSMinorVersion 0 #endif #ifndef OSTeenyVersion #define OSTeenyVersion 0 #endif #ifndef UnalignedReferencesAllowed #define UnalignedReferencesAllowed NO /* if arbitrary deref is okay */ #endif #ifndef AvoidNullMakeCommand #if !HasBsdMake #define AvoidNullMakeCommand NO #else #define AvoidNullMakeCommand YES #endif #endif #if AvoidNullMakeCommand #ifndef NullMakeCommand #define NullMakeCommand @ echo -n #endif /* * An obscure bug in BSD4.3's original make causes it not to recognize a * macro definition if the macro name starts with a non-alpha and in * column one. */ _NULLCMD_ = NullMakeCommand #endif #ifndef CrossCompiling #define CrossCompiling NO #undef CrossCompileDir #endif #ifndef BourneShell /* to force shell in makefile */ #define BourneShell /bin/sh #endif #ifndef ConstructMFLAGS #if SystemV #define ConstructMFLAGS YES /* build MFLAGS from MAKEFLAGS */ #else #define ConstructMFLAGS NO /* build MFLAGS from MAKEFLAGS */ #endif #endif #ifndef ConstructMAKEFLAGS /* needed on old BSD-based? */ #define ConstructMAKEFLAGS NO /* build MAKEFLAGS from MFLAGS */ #endif #ifndef HasLargeTmp #define HasLargeTmp NO /* be paranoid */ #endif #ifndef HasMotif #define HasMotif NO #endif #ifndef HasMotif2 #define HasMotif2 NO /* only if system has working Motif2 or OpenMotif */ #endif #ifndef HasBSDAuth #define HasBSDAuth NO #endif #ifndef HasBSD44Sockets #define HasBSD44Sockets NO #endif #ifndef HasSockets #define HasSockets YES #endif #ifndef HasPoll #if SystemV || SystemV4 #define HasPoll YES #else #define HasPoll NO #endif #endif #ifndef HasVFork #if SystemV #define HasVFork NO /* not yet... */ #else #define HasVFork YES #endif #endif #ifndef HasSetProcTitle #define HasSetProcTitle NO #endif #ifndef HasSetUserContext #define HasSetUserContext NO #endif #ifndef HasLibCrypt #define HasLibCrypt NO #endif #ifndef HasPutenv #define HasPutenv NO /* assume not */ #endif /* setenv(3) and unsetenv(3) */ #ifndef HasSetenv #define HasSetenv YES /* assume yes */ #endif #ifndef HasVoidSignalReturn #define HasVoidSignalReturn YES /* assume yes */ #endif #ifndef HasBsearch #define HasBsearch YES /* assume yes */ #endif #ifndef HasSnprintf #define HasSnprintf NO /* assume not */ #endif #ifndef HasStrlcat #define HasStrlcat NO /* assume not */ #endif #ifndef HasReallocarray #define HasReallocarray NO /* assume not */ #endif #ifndef HasDlopen #define HasDlopen NO /* assume not */ #endif #ifndef HasWeakSymbols #define HasWeakSymbols NO /* assume not */ #endif #ifndef HasIssetugid #define HasIssetugid NO /* assume not */ #endif #ifndef HasGetresuid #define HasGetresuid NO /* assume not */ #endif #ifndef HasMkstemp #define HasMkstemp NO /* assume not */ #endif #ifndef HasUsableFileMmap #define HasUsableFileMmap NO /* assume not */ #endif #ifndef HasGetIfAddrs #define HasGetIfAddrs NO /* assume not */ #endif #ifndef HasStickyDirBit #define HasStickyDirBit YES #endif #ifndef HasFchown #define HasFchown YES #endif #ifndef HasPam #define HasPam NO #endif #ifndef HasPamMisc #define HasPamMisc NO #endif #ifndef HasGetpeereid #define HasGetpeereid NO #endif #ifndef HasGetpeerucred #define HasGetpeerucred NO #endif #ifndef NoStrstr #define NoStrstr NO #endif #ifndef HasShadowPasswd #define HasShadowPasswd NO #endif #ifndef HasBasename #define HasBasename YES #endif #ifndef HasTimingsafeMemcmp #define HasTimingsafeMemcmp NO /* assume not */ #endif #ifndef HasGetopt # if !defined(Win32Architecture) # define HasGetopt YES # else # define HasGetopt NO # endif #endif #ifndef HasGetoptLong # define HasGetoptLong NO #endif /* byte-order defaults */ #ifndef ByteOrder #if defined(VaxArchitecture) #define ByteOrder X_LITTLE_ENDIAN #elif defined(MipsArchitecture) && defined(MipselArchitecture) #define ByteOrder X_LITTLE_ENDIAN #elif defined(MipsArchitecture) #define ByteOrder X_BIG_ENDIAN #elif defined(i386Architecture) #define ByteOrder X_LITTLE_ENDIAN #elif defined(ia64Architecture) #define ByteOrder X_LITTLE_ENDIAN #elif defined(AMD64Architecture) #define ByteOrder X_LITTLE_ENDIAN #elif defined(SparcArchitecture) || defined(Sparc64Architecture) #define ByteOrder X_BIG_ENDIAN #elif defined(AlphaArchitecture) #define ByteOrder X_LITTLE_ENDIAN #elif defined(Mc68000Architecture) #define ByteOrder X_BIG_ENDIAN #elif defined(Mc68020Architecture) #define ByteOrder X_BIG_ENDIAN #elif defined(Mc88000Architecture) #define ByteOrder X_BIG_ENDIAN #elif defined(s390Architecture) #define ByteOrder X_BIG_ENDIAN #elif defined(s390xArchitecture) #define ByteOrder X_BIG_ENDIAN #elif defined(Arm32ebArchitecture) #define ByteOrder X_BIG_ENDIAN #elif defined(Arm32Architecture) #define ByteOrder X_LITTLE_ENDIAN #elif defined(Arm64ebArchitecture) #define ByteOrder X_BIG_ENDIAN #elif defined(Arm64Architecture) #define ByteOrder X_LITTLE_ENDIAN #elif defined(RsArchitecture) #define ByteOrder X_BIG_ENDIAN #elif defined(PpcArchitecture) || defined(Ppc64Architecture) #define ByteOrder X_BIG_ENDIAN #elif defined(Ppc64LeArchitecture) #define ByteOrder X_LITTLE_ENDIAN #elif defined(HPArchitecture) #define ByteOrder X_BIG_ENDIAN #elif defined(SuperHArchitecture) #define ByteOrder X_LITTLE_ENDIAN #elif defined(SuperHebArchitecture) #define ByteOrder X_BIG_ENDIAN #endif #endif /* ByteOrder */ X_BYTE_ORDER = ByteOrder #ifndef HasFortran #define HasFortran NO #endif #ifndef HasGcc2ForCplusplus #define HasGcc2ForCplusplus NO #endif #ifndef HasCplusplus #if HasGcc2ForCplusplus #define HasCplusplus YES #else #define HasCplusplus NO #endif #endif #ifndef HasMktemp #define HasMktemp NO /* if you have the mktemp command */ #endif #ifndef HasSecureRPC #define HasSecureRPC NO /* if you have Secure RPC */ #endif #ifndef HasLatex #define HasLatex NO #endif #ifndef HasShm #if SystemV || SystemV4 #define HasShm YES #else #define HasShm NO #endif #endif #ifndef HasLegacyXextProto #define HasLegacyXextProto NO #endif #ifndef HasCbrt #define HasCbrt YES #endif #ifndef HasFfs #define HasFfs YES #endif #ifndef HasXfont2 #define HasXfont2 NO #endif #ifndef HasLegacyXfont1 #define HasLegacyXfont1 NO #endif #ifndef UseTIRPC #define UseTIRPC NO #endif #ifndef GzipLibrary /* if OS config didn't define it, assume it's -lz */ #define GzipLibrary -lz #endif #ifndef UseGnuMalloc #define UseGnuMalloc NO #endif #ifndef GnuMallocLibrary #define GnuMallocLibrary -lgmalloc #endif #ifndef MallocLibraries #if UseGnuMalloc #define MallocLibraries GnuMallocLibrary #else #define MallocLibraries /**/ #endif #endif #ifndef HasPosixRegex /* Most modern platforms have it */ #define HasPosixRegex YES #endif #ifndef RegexLibrary #if HasPosixRegex #define RegexLibrary /**/ #else #define RegexLibrary -lregex #endif #endif #ifndef HasNCurses #define HasNCurses NO #endif #ifndef NCursesLibName #if HasNCurses #define NCursesLibName -lncurses #else #define NCursesLibName #endif #endif #ifdef NCursesLibDir NCURSESLIBDIR = NCursesLibDir #endif #ifdef NCursesIncDir NCURSESINCDIR = NCursesIncDir #endif #ifndef HasTk #define HasTk NO #endif #ifndef TkLibName #if HasTk #define TkLibName tk #else #define TkLibName #endif #endif TKLIBNAME = TkLibName #ifndef TkLibDir #if HasTk #define TkLibDir /usr/local/lib #else #define TkLibDir #endif #endif TKLIBDIR = TkLibDir #ifndef TkIncDir #if HasTk #define TkIncDir /usr/local/include #else #define TkIncDir #endif #endif #ifndef TkLibrary #ifdef HasTk #define TkLibrary Concat(-L,$(TKLIBDIR)) Concat(-l,$(TKLIBNAME)) #else #define TkLibrary #endif #endif #ifndef HasTcl #define HasTcl NO #endif #ifndef TclLibName #if HasTcl #define TclLibName tcl #else #define TclLibName #endif #endif TCLLIBNAME = TclLibName #ifndef TclLibDir #if HasTcl #define TclLibDir /usr/local/lib #else #define TclLibDir #endif #endif TCLIBDIR = TclLibDir #ifndef TclIncDir #if HasTcl #define TclIncDir /usr/local/include #else #define TclIncDir #endif #endif #ifndef TclLibrary #ifdef HasTcl #define TclLibrary Concat(-L,$(TCLLIBDIR)) Concat(-l,$(TCLLIBNAME)) #else #define TclLibrary #endif #endif #ifndef HasTsLib #define HasTsLib NO #endif /* * Libtool has two different behaviours for version numbers. * On platforms which support a minor number, the library * version is (version - minor).minor, on those that don't, * the version if version.0. Linux and Darwin support minor * numbers; some BSDs do as well. Set this to YES if libtool * uses minor numbers on your platform. */ #ifndef LibtoolMinorVersions #define LibtoolMinorVersions NO #endif #ifndef NeedConstPrototypes #define NeedConstPrototypes NO #endif #ifndef NeedVarargsPrototypes #define NeedVarargsPrototypes NO #endif #ifndef NeedNestedPrototypes #define NeedNestedPrototypes NO #endif #ifndef NeedFunctionPrototypes #define NeedFunctionPrototypes (NeedVarargsPrototypes || NeedNestedPrototypes) #endif #ifndef NeedWidePrototypes #define NeedWidePrototypes YES /* mix and match ANSI-C, non-ANSI */ #endif #ifndef UseCCMakeDepend /* use slow cc -E script */ #define UseCCMakeDepend NO #endif #ifndef UseGccMakeDepend /* use slowish but correct gcc -M */ #define UseGccMakeDepend NO #endif #ifndef CaseSensitiveFileSystem #define CaseSensitiveFileSystem YES #endif /* DefaultUsrBin is independent of ProjectRoot. This is a directory where programs will be found even if PATH is not set, for example when coming in remotely via rsh. */ #ifndef DefaultUsrBin #define DefaultUsrBin /usr/bin #endif #ifndef LibDirName # define LibDirName lib #endif #ifndef UsrLibDir #ifdef ProjectRoot #define UsrLibDir Concat4(ProjectRoot,/,LibDirName,/nx/X11) #ifndef AlternateUsrLibDir #define AlternateUsrLibDir YES #endif #else #define UsrLibDir Concat4(/usr/local,/,LibDirName,/nx/X11) #ifndef AlternateUsrLibDir #define AlternateUsrLibDir NO #endif #endif #else #ifndef AlternateUsrLibDir #define AlternateUsrLibDir YES #endif #endif #ifndef UsrDataDir #ifdef ProjectRoot #define UsrDataDir Concat4(ProjectRoot,/,share,/nx) #ifndef AlternateUsrDataDir #define AlternateUsrDataDir YES #endif #else #define UsrDataDir Concat4(/usr/local,/,share,/nx) #ifndef AlternateUsrDataDir #define AlternateUsrDataDir NO #endif #endif #else #ifndef AlternateUsrDataDir #define AlternateUsrDataDir YES #endif #endif #ifndef VarDirectory #ifdef ProjectVar #define VarDirectory ProjectVar #else #define VarDirectory /var #endif #endif #ifndef VarLibDir #define VarLibDir $(VARDIR)/lib #endif /* * SystemUsrLibDir is independent of ProjectRoot. It is used primarily * to allow links for shared libraries in /usr/lib for compliance to * various standards (e.g., Linux/OpenGL). */ #ifndef SystemUsrLibDir #define SystemUsrLibDir /usr/LibDirName #endif #ifndef SystemUsrIncDir #define SystemUsrIncDir /usr/include #endif #ifndef SystemXkbConfigDir #define SystemXkbConfigDir /usr/share/X11/xkb #endif #ifndef SystemXkbBinDir #define SystemXkbBinDir /usr/bin #endif #ifndef SystemFontDir #define SystemFontDir /usr/share/fonts/X11 #endif #ifndef ShLibDir #define ShLibDir UsrLibDir #endif #ifndef IncRoot #ifdef ProjectRoot #define IncRoot Concat(ProjectRoot,/include/nx) #ifndef AlternateIncRoot #define AlternateIncRoot YES #endif #else #define IncRoot /usr/include #ifndef AlternateIncRoot #define AlternateIncRoot NO #endif #endif #else #ifndef AlternateIncRoot #define AlternateIncRoot YES #endif #endif #ifndef LintlibDir #define LintlibDir $(USRLIBDIR)/lint #endif #ifndef SystemManDirectory #if SystemV4 #define SystemManDirectory /usr/share/man #else #define SystemManDirectory /usr/man #endif #endif #ifndef ManDirectoryRoot #ifdef ProjectRoot #define ManDirectoryRoot Concat(ProjectRoot,/man) #else #define ManDirectoryRoot SystemManDirectory #endif #endif #ifndef ManPath #define ManPath ManDirectoryRoot #endif #ifndef ManSourcePath #define ManSourcePath $(MANPATH)/man #endif #ifndef ManDir #define ManDir $(MANSOURCEPATH)$(MANSUFFIX) #endif #ifndef LibmanDir #define LibmanDir $(MANSOURCEPATH)$(LIBMANSUFFIX) #endif #ifndef FileManDir #define FileManDir $(MANSOURCEPATH)$(FILEMANSUFFIX) #endif #ifndef MiscManDir #define MiscManDir $(MANSOURCEPATH)$(MISCMANSUFFIX) #endif #ifndef DriverManDir #define DriverManDir $(MANSOURCEPATH)$(DRIVERMANSUFFIX) #endif #ifndef AppLoadDefs #define AppLoadDefs -D__apploaddir__=$(XAPPLOADDIR) #endif #ifndef AppManDefs #define AppManDefs -D__appmansuffix__=$(MANSUFFIX) #endif #ifndef LibManDefs #define LibManDefs -D__libmansuffix__=$(LIBMANSUFFIX) #endif #ifndef FileManDefs #define FileManDefs -D__filemansuffix__=$(FILEMANSUFFIX) #endif #ifndef MiscManDefs #define MiscManDefs -D__miscmansuffix__=$(MISCMANSUFFIX) #endif #ifndef DriverManDefs #define DriverManDefs -D__drivermansuffix__=$(DRIVERMANSUFFIX) #endif #ifndef AdminManDefs #define AdminManDefs -D__adminmansuffix__=$(ADMINMANSUFFIX) #endif #ifndef ProjectManDefs #define ProjectManDefs -D__projectroot__=$(PROJECTROOT) #endif #ifndef XConfigFileManDefs #define XConfigFileManDefs -D__xconfigfile__=$(XCONFIGFILE) #endif #ifndef XConfigDirManDefs #define XConfigDirManDefs -D__xconfigdir__=$(XCONFIGDIR) #endif #ifndef XLogFileManDefs #define XLogFileManDefs -D__xlogfile__=$(XLOGFILE) #endif #ifndef XServerManDefs #define XServerManDefs -D__xservername__=$(XSERVERNAME) #endif #ifndef CompressManCmd #define CompressManCmd gzip -n #endif #ifndef HtmlIndexCmd #if BuildHtmlManPages #define HtmlIndexCmd $(MKHTMLINDEX) #endif #endif #ifndef LogDirectory #if HasVarDirectory #define LogDirectory $(VARDIR)/log #else #define LogDirectory /usr/adm #endif #endif #ifndef HasVarRun #define HasVarRun NO #endif #ifndef VarRunDirectory #if HasVarRun #define VarRunDirectory $(VARDIR)/run #endif #endif #ifndef HasVarDb #define HasVarDb NO #endif #ifndef VarDbDirectory #if HasVarDb #define VarDbDirectory $(VARDIR)/db #endif #endif #ifndef ConfigSrc #define ConfigSrc $(TOP)/config #endif #ifndef DependDir #if UseCCMakeDepend || UseGccMakeDepend #define DependDir $(CONFIGSRC)/util #else #define DependDir $(CONFIGSRC)/makedepend #endif #endif #ifndef UNCOMPRESSPATH #define UNCOMPRESSPATH /usr/ucb/uncompress /* obsolete */ #endif #ifndef OptimizedCDebugFlags #define OptimizedCDebugFlags -O #endif #ifndef OptimizedCplusplusDebugFlags #define OptimizedCplusplusDebugFlags OptimizedCDebugFlags #endif #ifndef DebuggableCDebugFlags #define DebuggableCDebugFlags -g #endif #ifndef DebuggableCplusplusDebugFlags #define DebuggableCplusplusDebugFlags DebuggableCDebugFlags #endif #ifndef ProfiledCDebugFlags #define ProfiledCDebugFlags -pg #endif #ifndef ProfiledCplusplusDebugFlags #define ProfiledCplusplusDebugFlags ProfiledCDebugFlags #endif #ifndef NoOpCDebugFlags #define NoOpCDebugFlags /**/ #endif #ifndef DefaultCDebugFlags #define DefaultCDebugFlags OptimizedCDebugFlags #endif #ifndef DefaultCplusplusDebugFlags #define DefaultCplusplusDebugFlags OptimizedCplusplusDebugFlags #endif #ifndef DefaultCCOptions #define DefaultCCOptions /* floating point, etc. */ #endif #ifndef DefaultCplusplusOptions #define DefaultCplusplusOptions /* floating point, etc. */ #endif #ifndef HardCodeLibdirFlag #define HardCodeLibdirFlag /**/ #endif #ifndef NoRConst #define NoRConst NO /* YES if const for structs of funcs is bad */ #endif #ifndef InstPgmFlags # if CrossCompiling # define InstPgmFlags # else # define InstPgmFlags -s # endif #endif #ifndef InstBinFlags #define InstBinFlags -m 0755 #endif #ifndef InstUidFlags #define InstUidFlags -m 4711 #endif #ifndef InstLibFlags #define InstLibFlags -m 0644 #endif #ifndef InstIncFlags #define InstIncFlags -m 0444 #endif #ifndef InstManFlags #define InstManFlags -m 0444 #endif #ifndef InstDatFlags #define InstDatFlags -m 0444 #endif #ifndef InstKmemFlags /* put -g kmem -m 2711 in site.def... */ #define InstKmemFlags InstUidFlags #endif #ifndef ParallelMakeFlags #define ParallelMakeFlags /**/ #endif #ifndef ArCmdBase #define ArCmdBase ar #endif #ifndef ArCmd #if HasLargeTmp || SystemV4 #define ArCmd ArCmdBase cq #else #define ArCmd ArCmdBase clq #endif #endif #ifndef ArAddCmd #if HasLargeTmp || SystemV4 #define ArAddCmd ArCmdBase ru #else #define ArAddCmd ArCmdBase rul #endif #endif #ifndef ArExtCmd #if HasLargeTmp || SystemV4 #define ArExtCmd ArCmdBase x #else #define ArExtCmd ArCmdBase xl #endif #endif #ifndef BootstrapCFlags #define BootstrapCFlags /**/ #endif #ifndef HasGcc3 #define HasGcc3 NO #endif #ifndef HasGcc2 #define HasGcc2 HasGcc3 #endif #ifndef HasGcc #define HasGcc HasGcc2 #endif #ifndef HasIntelC #define HasIntelC NO #endif #ifndef HasSunC #define HasSunC NO #endif #ifndef HasBrokenCCForLink #define HasBrokenCCForLink NO #endif #ifndef CcCmd #if HasGcc2 #define CcCmd gcc -fpcc-struct-return #else #if HasGcc #define CcCmd gcc -fstrength-reduce -fpcc-struct-return #else #if HasCenterLineC #define CcCmd clcc #else #define CcCmd cc #endif #endif #endif #endif #ifndef CplusplusCmd #if HasGcc2ForCplusplus #define CplusplusCmd g++ #else #define CplusplusCmd CC #endif #endif #ifndef CplusplusFilt # define CplusplusFilt c++filt #endif #ifndef CplusplusLibC #if HasGcc2ForCplusplus #define CplusplusLibC -lstdc++ #else #define CplusplusLibC /**/ #endif #endif #ifndef CplusplusStandardDefines #define CplusplusStandardDefines StandardDefines #endif #ifndef CplusplusExtraDefines #define CplusplusExtraDefines /**/ #endif #ifndef CplusplusExtraIncludes #define CplusplusExtraIncludes /**/ #endif #ifndef CplusplusDependIncludes #define CplusplusDependIncludes /**/ #endif #ifndef CplusplusOptions #define CplusplusOptions DefaultCplusplusOptions #endif #ifndef CplusplusSpecialOptions #define CplusplusSpecialOptions /**/ #endif #if HasFortran #ifndef FortranCmd #define FortranCmd f77 #endif #ifndef FortranFlags #define FortranFlags /**/ #endif #ifndef FortranDebugFlags /* for -O or -g */ #define FortranDebugFlags /**/ #endif #endif #ifndef AsCmd #define AsCmd as #endif #ifndef AsmDefines #define AsmDefines /**/ #endif #ifndef CompressCmd #define CompressCmd compress #endif #ifndef GzipCmd #define GzipCmd gzip #endif #ifndef CppCmd #define CppCmd /LibDirName/cpp #endif #ifndef RawCppCmd #define RawCppCmd CppCmd -undef #endif #ifndef CppNoLineInfoOption #define CppNoLineInfoOption /**/ #endif #ifndef PreProcessCmd #define PreProcessCmd CcCmd -E #endif #ifndef InstallCmd /* hack should be in project */ #if SystemV || SystemV4 #ifdef UseInstalled /* assume BINDIR in path */ #define InstallCmd bsdinst #else #define InstallCmd $(SHELL) $(CONFIGSRC)/util/bsdinst.sh #endif #else #define InstallCmd install #endif #endif #ifndef InstallFlags #define InstallFlags -c #endif #ifndef StripCmd #define StripCmd strip #endif #ifndef LdCmd #define LdCmd ld #endif #ifndef M4Cmd #define M4Cmd m4 #endif #ifndef M4Flags #define M4Flags /**/ #endif #ifndef LexCmd #define LexCmd lex #endif #ifndef LexLib #define LexLib -ll #endif #ifndef HasFlex #define HasFlex NO #endif #ifndef YaccCmd #define YaccCmd yacc #endif #ifndef CplusplusYaccCmd #define CplusplusYaccCmd YaccCmd #endif #ifndef LintCmd #define LintCmd lint #endif #ifndef LintLibFlag #if SystemV || SystemV4 #define LintLibFlag -o #else #define LintLibFlag -C #endif #endif #ifndef LintOpts #if SystemV || SystemV4 #define LintOpts -bh #else #define LintOpts -axz #endif #endif #ifndef CpCmd #define CpCmd cp #endif #ifndef LnCmd /* can use cp instead of ln if necessary */ #if HasSymLinks #define LnCmd ln -s #else #define LnCmd ln #endif #endif #ifndef MakeCmd #define MakeCmd make #endif #ifndef MvCmd #define MvCmd mv -f #endif #ifndef RanlibCmd #define RanlibCmd ranlib #endif #ifndef RanlibInstFlags #define RanlibInstFlags /**/ #endif #ifndef RmCmd #define RmCmd rm -f #endif /* * Module cross-compile stuff. By default they are defined to be exactly the * same as the non-module versions. */ #ifndef ModuleCcCmd #define ModuleCcCmd CcCmd #endif #ifndef ModuleCppCmd #define ModuleCppCmd CppCmd #endif #ifndef ModuleCFlags #define ModuleCFlags $(CFLAGS) #endif #ifndef ModuleAsCmd #define ModuleAsCmd AsCmd #endif #ifndef ModuleAsFlags #define ModuleAsFlags /**/ #endif #ifndef ModuleLdCmd #define ModuleLdCmd LdCmd #endif #ifndef ModuleLdFlags #define ModuleLdFlags /**/ #endif #ifndef ModuleLdCombineFlags #define ModuleLdCombineFlags LdCombineFlags #endif #ifndef ModuleArCmd #define ModuleArCmd ArCmd #endif #ifndef NeedModuleRanlib #define NeedModuleRanlib NO #endif #ifndef ModuleRanlibCmd #define ModuleRanlibCmd RanlibCmd #endif #ifndef HostCcCmd #define HostCcCmd cc #endif #ifndef StandardIncludes /* for platform-specifics */ #define StandardIncludes /**/ #endif #ifndef StandardDefines #if SystemV #define StandardDefines -DSYSV #else #if SystemV4 #define StandardDefines -DSVR4 #else #define StandardDefines /**/ #endif #endif #endif #ifndef StandardCppOptions #define StandardCppOptions /**/ #endif #ifndef StandardCppDefines #define StandardCppDefines StandardCppOptions StandardDefines #endif #ifndef Malloc0ReturnsNull #if UseGnuMalloc #define Malloc0ReturnsNull YES #else #define Malloc0ReturnsNull NO #endif #endif #if Malloc0ReturnsNull #ifndef Malloc0ReturnsNullDefines #define Malloc0ReturnsNullDefines -DMALLOC_0_RETURNS_NULL #endif #endif #ifndef ToolkitStringsABIOptions #define ToolkitStringsABIOptions /**/ #endif #ifndef HasSetitimer #define HasSetitimer YES #endif #ifndef HasSetitimerDefines #define HasSetitimerDefines -DHAVE_SETITIMER=1 #endif #ifndef HasLdRunPath #define HasLdRunPath NO #endif #ifndef LdPreLib # if !defined(UseInstalled) # define LdPreLib -L$(BUILDLIBDIR) # else # if AlternateUsrLibDir # define LdPreLib -L$(USRLIBDIR) # else # define LdPreLib /**/ # endif #endif #endif #ifndef LdPostLib #if !defined(UseInstalled) && AlternateUsrLibDir && !HasLdRunPath && !defined(CrossCompileDir) #define LdPostLib -L$(USRLIBDIR) #else #define LdPostLib /**/ #endif #endif #ifndef MathLibrary #define MathLibrary -lm #endif #ifndef DlLibrary #define DlLibrary -ldl #endif #ifndef ExtraLibraries #if SystemV4 #if HasSockets #define ExtraLibraries -lsocket -lnsl -lw #else #define ExtraLibraries -lnsl -lw #endif #else #define ExtraLibraries /**/ #endif #endif #ifndef ExtraLoadOptions #define ExtraLoadOptions /**/ #endif #ifndef ExtraLoadFlags #define ExtraLoadFlags /**/ #endif #ifndef LdCombineFlags #if SystemV4 #define LdCombineFlags -r #else #define LdCombineFlags -X -r #endif #endif #ifndef LdStripFlags #define LdStripFlags -x #endif #ifndef TagsCmd #define TagsCmd ctags #endif #ifndef LoaderLibPrefix #define LoaderLibPrefix /**/ #endif #ifndef ImakeCmd #define ImakeCmd imake #endif #ifndef ImakeWarningFlags #define ImakeWarningFlags /* Nothing */ #endif #ifndef DependCmd #define DependCmd gccmakedep #endif #ifndef DependDefines # if UseCCMakeDepend || UseGccMakeDepend # define DependDefines /**/ # else # define DependDefines -DUSE_MAKEDEPEND # endif #endif #ifndef DependFlags #define DependFlags /**/ #endif #ifndef DependFileName #if !HasBsdMake #define DependFileName Makefile.dep #else #define DependFileName .depend #endif #endif #ifndef ExportListCmd # ifndef ExportListGenSource # define ExportListCmd /**/ # elif !defined(UseInstalled) # define ExportListCmd $(CONFIGSRC)/util/exportlistgen # else # define ExportListCmd exportlistgen # endif #endif #ifndef MkdirHierCmd #ifdef UseInstalled /* assume BINDIR in path */ #define MkdirHierCmd mkdirhier #else #define MkdirHierCmd $(SHELL) $(CONFIGSRC)/util/mkdirhier.sh #endif #endif #ifndef RevPathCmd #ifdef UseInstalled /* assume BINDIR in path */ #define RevPathCmd revpath #else #define RevPathCmd $(CONFIGSRC)/util/revpath #endif #endif #ifndef TroffCmd #if HasGroff #define TroffCmd groff -Tps #else #define TroffCmd troff -Tps #endif #endif #ifndef NroffCmd #define NroffCmd nroff #endif #ifndef HTMLroffCmd #if HasGroff && HasGroffHtml #define HTMLroffCmd groff -Thtml #endif #endif #ifdef HTMLroffCmd #ifndef DocFilesToClean #define DocFilesToClean grohtml*.png *-auto-*.png #endif #endif #ifndef MsMacros #define MsMacros -ms #endif #ifndef ManMacros #define ManMacros -man #endif #ifndef TblCmd #define TblCmd tbl #endif #ifndef EqnCmd #define EqnCmd eqn #endif #ifndef NeqnCmd #define NeqnCmd neqn #endif #ifndef ColCmd #define ColCmd col #endif #ifndef ColFlags #define ColFlags -b #endif #ifndef DvipsCmd #define DvipsCmd dvips #endif #ifndef LatexCmd #define LatexCmd latex #endif #ifndef HasPdfLatex #define HasPdfLatex NO #endif #ifndef PdfLatexCmd #define PdfLatexCmd pdflatex #endif #ifndef GhostScriptCmd #define GhostScriptCmd gs #endif #ifndef HasGhostPCL #define HasGhostPCL NO #endif #ifndef HasGhostScript #define HasGhostScript NO #endif #ifndef BuildPDFdocs #define BuildPDFdocs (HasGhostScript) #endif #if BuildPDFdocs #define PsToPdfCmd GhostScriptCmd -q -sOutputFile=- -sDEVICE=pdfwrite -dSAFER -dNOPAUSE - #endif #if HasSentinel #ifndef SentinelCmd #define SentinelCmd sentinel #endif #ifndef SentinelOptions #define SentinelOptions /**/ #endif #endif #if HasPurify #ifndef PurifyCmd #define PurifyCmd purify #endif #ifndef PurifyOptions #define PurifyOptions /**/ #endif #endif #if HasTestCenter #ifndef ProofCmd #define ProofCmd proof #endif #ifndef ProofOptions #define ProofOptions /**/ #endif #endif #ifndef PathSeparator #define PathSeparator / #endif #ifndef Osuf #define Osuf o #endif #ifndef CCsuf #define CCsuf cc #endif #ifndef SHsuf #define SHsuf sh #endif #ifndef ManSuffix #define ManSuffix n /* use just one tab or cpp will die */ #endif #ifndef LibManSuffix #define LibManSuffix 3 /* use just one tab or cpp will die */ #endif #ifndef FileManSuffix #if SystemV || SystemV4 #define FileManSuffix 4 /* use just one tab or cpp will die */ #else #define FileManSuffix 5 /* use just one tab or cpp will die */ #endif #endif #ifndef MiscManSuffix #if SystemV || SystemV4 #define MiscManSuffix 5 /* use just one tab or cpp will die */ #else #define MiscManSuffix 7 /* use just one tab or cpp will die */ #endif #endif #ifndef DriverManSuffix #if SystemV || SystemV4 #define DriverManSuffix 7 /* use just one tab or cpp will die */ #else #define DriverManSuffix 4 /* use just one tab or cpp will die */ #endif #endif #ifndef AdminManSuffix #if SystemV || SystemV4 #define AdminManSuffix 1m /* use just one tab or cpp will die */ #else #define AdminManSuffix 8 /* use just one tab or cpp will die */ #endif #endif #ifndef ExpandManNames #if SystemV #define ExpandManNames NO #else #define ExpandManNames YES #endif #endif #ifndef ManSrcSuffix #define ManSrcSuffix man #endif #ifndef ManNewSuffix #define ManNewSuffix _man #endif #ifndef TOPDIR #define TOPDIR . #endif #ifndef CURDIR #define CURDIR . #endif #ifndef SiteIConfigFiles #define SiteIConfigFiles /**/ #endif #ifndef OtherIConfigFiles #define OtherIConfigFiles /**/ #endif #ifndef ExtraFilesToClean #define ExtraFilesToClean /**/ #endif #ifndef DocFilesToClean #define DocFilesToClean /**/ #endif #ifndef FilesToClean #define FilesToClean *.CKP *.ln *.BAK *.bak *.Osuf core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut #endif #ifdef CrossCompileDir # ifndef StripPath # define StripPath(x) `echo x|sed "s%.*/%%"` # endif # ifndef CrossArCmd # define CrossArCmd Concat3(CrossCompileDir,/,StripPath(ArCmd)) # endif # ifndef CrossCcCmd # define CrossCcCmd Concat3(CrossCompileDir,/,StripPath(CcCmd)) # endif # ifndef CrossAsCmd # define CrossAsCmd Concat3(CrossCompileDir,/,StripPath(AsCmd)) # endif # ifdef HasFortran # ifndef CrossFortranCmd # define CrossFortranCmd Concat3(CrossCompileDir,/,StripPath(FortranCmd)) # endif # endif # ifndef CrossCplusplusCmd # define CrossCplusplusCmd Concat3(CrossCompileDir,/,StripPath(CplusplusCmd)) # endif # ifndef CrossCppCmd # define CrossCppCmd Concat3(CrossCompileDir,/,StripPath(CppCmd)) # endif # ifndef CrossRawCppCmdCmd # define CrossRawCppCmd Concat3(CrossCompileDir,/,StripPath(RawCppCmd)) # endif # ifndef CrossPreProcessCmd # define CrossPreProcessCmd Concat3(CrossCompileDir,/,StripPath(PreProcessCmd)) # endif # ifndef CrossAsCmd # define CrossAsCmd Concat3(CrossCompileDir,/,StripPath(AsCmd)) # endif # ifndef CrossLdCmd # define CrossLdCmd Concat3(CrossCompileDir,/,StripPath(LdCmd)) # endif # ifndef CrossModuleLdCmd # define CrossModuleLdCmd CrossLdCmd # endif # ifndef CrossLintCmd # define CrossLintCmd Concat3(CrossCompileDir,/,StripPath(LintCmd)) # endif # ifndef CrossRanlibCmd # define CrossRanlibCmd Concat3(CrossCompileDir,/,StripPath(RanlibCmd)) # endif # ifndef CrossModuleCcCmd # define CrossModuleCcCmd Concat3(CrossCompileDir,/,StripPath(ModuleCcCmd)) # endif # ifndef CrossAsCmd # define CrossAsCmd Concat3(CrossCompileDir,/,StripPath(AsCmd)) # endif # ifndef CrossStripCmd # define CrossStripCmd Concat3(CrossCompileDir,/,StripPath(StripCmd)) # endif #endif PATHSEP = PathSeparator SHELL = BourneShell TOP = TOPDIR CURRENT_DIR = CURDIR IMAKE = ImakeCmd DEPEND = DependCmd MKDIRHIER = MkdirHierCmd REVPATH = RevPathCmd EXPORTLISTGEN = ExportListCmd RMAN = RmanCmd RMANBASENAME = HostProgramTargetName(rman) RMANOPTIONS = RmanOptions CONFIGSRC = ConfigSrc IMAKESRC = $(CONFIGSRC)/imake DEPENDSRC = DependDir INCROOT = IncRoot /* base of where to put header files */ USRLIBDIR = UsrLibDir /* nonshared libraries */ USRDATADIR = UsrDataDir /* arch-indep files (XErrorDB, etc.) */ VARDIR = VarDirectory /* usually /var */ VARLIBDIR = VarLibDir /* xdm runtime files */ SYSTEMUSRLIBDIR = SystemUsrLibDir /* system's "/usr/lib" */ SYSTEMUSRINCDIR = SystemUsrIncDir /* system's "/usr/include" */ SYSTEMXKBCONFDIR = SystemXkbConfigDir /* system's "/usr/share/xkb" */ SYSTEMXKBBINDIR = SystemXkbBinDir /* system's "/usr/bin" */ SYSTEMFONTDIR = SystemFontDir /* system's "/usr/share/fonts/X11" */ SHLIBDIR = ShLibDir /* shared libraries */ LINTLIBDIR = LintlibDir /* lint libraries */ MANPATH = ManPath /* top of manual page tree */ MANSOURCEPATH = ManSourcePath /* prefix for man page sources */ MANDIR = ManDir /* man pages for commands */ LIBMANDIR = LibmanDir /* man pages for library routines */ FILEMANDIR = FileManDir /* man pages for config files */ MISCMANDIR = MiscManDir /* man pages for miscellaneous files */ DRIVERMANDIR = DriverManDir /* man pages for drivers */ LOGDIRECTORY = LogDirectory /* OS location of log files */ #ifdef VarRunDirectory VARRUNDIR = VarRunDirectory /* OS location of PID files */ #endif #ifdef VarDbDirectory VARDBDIR = VarDbDirectory /* OS location of db/state files */ #endif #ifdef CrossCompileDir AR = CrossArCmd #else AR = ArCmd #endif XCOMM Nice try but useless: make will inherit BOOTSTRAPCFLAGS XCOMM from top Makefile BOOTSTRAPCFLAGS = BootstrapCFlags /* set if cpp does not have uniq sym */ #ifdef CrossCompileDir CC = CrossCcCmd AS = CrossAsCmd #else CC = CcCmd AS = AsCmd #endif #if HasFortran # ifdef CrossCompileDir FC = CrossFortranCmd # else FC = FortranCmd # endif FDEBUGFLAGS = FortranDebugFlags FCFLAGS = FortranFlags $(FDEBUGFLAGS) #endif #if HasCplusplus .SUFFIXES: Concat(.,CCsuf) #ifdef CrossCompileDir CXX = CrossCplusplusCmd #else CXX = CplusplusCmd #endif CXXFILT = CplusplusFilt #ifdef CplusplusLibCDir CXXLIBDIR = CplusplusLibCDir CXXLIB = -L$(CXXLIBDIR) CplusplusLibC #else CXXLIB = CplusplusLibC #endif CXXDEBUGFLAGS = DefaultCplusplusDebugFlags CXXDEPENDINCLUDES = CplusplusDependIncludes CXXEXTRA_DEFINES = CplusplusExtraDefines CXXEXTRA_INCLUDES = CplusplusExtraIncludes CXXSTD_DEFINES = CplusplusStandardDefines $(CXXPROJECT_DEFINES) CXXOPTIONS = CplusplusOptions CXXINCLUDES = $(INCLUDES) $(TOP_INCLUDES) $(CXXEXTRA_INCLUDES) CXXDEFINES = $(CXXINCLUDES) $(CXXSTD_DEFINES) $(THREADS_CXXDEFINES) $(DEFINES) $(CXXEXTRA_DEFINES) CXXFLAGS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) #endif COMPRESS = CompressCmd GZIPCMD = GzipCmd #ifdef CrossCompileDir CPP = CrossCppCmd $(STD_CPP_DEFINES) RAWCPP = CrossRawCppCmd $(STD_CPP_OPTIONS) PREPROCESSCMD = CrossPreProcessCmd $(STD_CPP_DEFINES) #else CPP = CppCmd $(STD_CPP_DEFINES) /* simple filters */ RAWCPP = RawCppCmd $(STD_CPP_OPTIONS) PREPROCESSCMD = PreProcessCmd $(STD_CPP_DEFINES) /* preferred; mdep */ #endif INSTALL = InstallCmd INSTALLFLAGS = InstallFlags #ifdef CrossCompileDir LD = CrossLdCmd #else LD = LdCmd #endif LEX = LexCmd M4 = M4Cmd M4FLAGS = M4Flags LEXLIB = LexLib YACC = YaccCmd CCYACC = CplusplusYaccCmd #ifdef CrossCompileDir LINT = CrossLintCmd #else LINT = LintCmd #endif LINTLIBFLAG = LintLibFlag LINTOPTS = LintOpts LN = LnCmd MAKE = MakeCmd MV = MvCmd CP = CpCmd #if DoRanlibCmd #ifdef CrossCompileDir RANLIB = CrossCompileDir/RanlibCmd #else RANLIB = RanlibCmd #endif RANLIBINSTFLAGS = RanlibInstFlags #endif RM = RmCmd PERL = PerlCmd PERLOPTS = PerlOptions PERLENVSETUP = PerlEnvSetup MANSUFFIX = ManSuffix /* suffix for command man pages */ LIBMANSUFFIX = LibManSuffix /* suffix for library man pages */ FILEMANSUFFIX = FileManSuffix /* suffix for file format man pages */ MISCMANSUFFIX = MiscManSuffix /* suffix for misc man pages */ DRIVERMANSUFFIX = DriverManSuffix /* suffix for driver man pages */ ADMINMANSUFFIX = AdminManSuffix /* suffix for admin command man pages */ MANSRCSUFFIX = ManSrcSuffix /* suffix for man page source */ MANNEWSUFFIX = ManNewSuffix /* suffix for preprocessed man source */ MANDEFS = AppLoadDefs AppManDefs FileManDefs LibManDefs MiscManDefs DriverManDefs AdminManDefs ProjectManDefs XConfigFileManDefs XConfigDirManDefs XLogFileManDefs XServerManDefs $(XORGMANDEFS) $(VENDORMANDEFS) COMPRESSMANCMD = CompressManCmd TROFF = TroffCmd NROFF = NroffCmd #ifdef HTMLroffCmd HTMLROFF = HTMLroffCmd #endif #ifdef PsToPdfCmd PSTOPDFCMD = PsToPdfCmd #endif MSMACROS = MsMacros MANMACROS = ManMacros TBL = TblCmd EQN = EqnCmd NEQN = NeqnCmd COL = ColCmd COLFLAGS = ColFlags #ifdef CrossCompileDir MODCC = CrossModuleCcCmd #else MODCC = ModuleCcCmd #endif MODCPP = ModuleCppCmd MODCFLAGS = ModuleCFlags MODAS = ModuleAsCmd MODASFLAGS = ModuleAsFlags #ifdef CrossCompileDir MODLD = CrossModuleLdCmd #else MODLD = ModuleLdCmd #endif MODLDFLAGS = ModuleLdFlags MODLDCOMBINEFLAGS = ModuleLdCombineFlags MODAR = ModuleArCmd #ifdef CrossCompileDir MODRANLIB = CrossCompileDir/ModuleRanlibCmd #else MODRANLIB = ModuleRanlibCmd #endif #if HasLatex DVIPS = DvipsCmd LATEX = LatexCmd #endif #if HasPdfLatex PDFLATEXCMD = PdfLatexCmd #endif #if HasSentinel SENTINEL = SentinelCmd SENTINELOPTIONS = SentinelOptions #endif #if HasPurify PURIFY = PurifyCmd PURIFYOPTIONS = PurifyOptions #endif #if HasTestCenter PROOF = ProofCmd PROOFOPTIONS = ProofOptions #endif #if CrossCompiling HOST_CC = HostCcCmd #endif STD_INCLUDES = StandardIncludes STD_CPP_OPTIONS = StandardCppOptions STD_CPP_DEFINES = StandardCppOptions StandardCppDefines $(PROJECT_DEFINES) STD_DEFINES = StandardDefines $(PROJECT_DEFINES) SETITIMER_DEFINES = HasSetitimerDefines EXTRA_LOAD_FLAGS = ExtraLoadFlags EXTRA_INSTALL_LOAD_FLAGS = ExtraInstallLoadFlags EXTRA_LDOPTIONS = ExtraLoadOptions EXTRA_LIBRARIES = MallocLibraries ExtraLibraries TAGS = TagsCmd #if ConstructMFLAGS MFLAGS = -$(MAKEFLAGS) #endif #if ConstructMAKEFLAGS MAKEFLAGS = $(MFLAGS) #endif PARALLELMFLAGS = ParallelMakeFlags #if HasSharedLibraries SHAREDCODEDEF = SharedCodeDef SHLIBDEF = SharedLibraryDef #ifdef SharedLibraryLoadFlags SHLIBLDFLAGS = SharedLibraryLoadFlags $(SHLIBGLOBALSFLAGS) #if HasGcc NOSTDLIB = -nostdlib POSTNOSTDLIB = -Wl,-Bstatic -lgcc -Wl,-Bdynamic #elif HasIntelC NOSTDLIB = -nostdlib POSTNOSTDLIB = #elif HasSunC NOSTDLIB = -xnolib POSTNOSTDLIB = #endif #endif #if HasXfont2 FONT_DEFINES = -DHAS_XFONT2 XFONTLIB = -lXfont2 #else #if HasLegacyXfont1 FONT_DEFINES = -DLEGACY_XFONT1 #else FONT_DEFINES = #endif XFONTLIB = -lXfont #endif #if HasLegacyXextProto XEXT_EXTRA_DEFINES = -DLEGACY_XEXT_PROTO #else XEXT_EXTRA_DEFINES = #endif /* * Here we set up flags needed to produce position-independent code * when doing C and C++ compilation. The default if you specify C * PIC flags without also specifying C++ PIC flags is to assume that * the C flags work for both. If your C++ compiler requires different * flags, specify them explicitly in PositionIndependentCplusplusFlags. */ #ifdef PositionIndependentCFlags PICFLAGS = PositionIndependentCFlags #endif #ifdef PositionIndependentCplusplusFlags CXXPICFLAGS = PositionIndependentCplusplusFlags #else #ifdef PositionIndependentCFlags CXXPICFLAGS = PositionIndependentCFlags #endif #endif #endif #if !HasVoidSignalReturn SIGNAL_DEFINES = -DSIGNALRETURNSINT #endif /* * The following supports forcing of function prototypes */ #if NeedFunctionPrototypes && NeedVarargsPrototypes && NeedConstPrototypes && NeedNestedPrototypes #define _funcprotodef -DFUNCPROTO=15 #else #if NeedFunctionPrototypes && NeedVarargsPrototypes && NeedNestedPrototypes #define _funcprotodef -DFUNCPROTO=11 #else #if NeedFunctionPrototypes && NeedNestedPrototypes #define _funcprotodef -DFUNCPROTO=9 #else #if NeedFunctionPrototypes && NeedVarargsPrototypes && NeedConstPrototypes #define _funcprotodef -DFUNCPROTO=7 #else #if NeedFunctionPrototypes && NeedConstPrototypes #define _funcprotodef -DFUNCPROTO=5 #else #if NeedFunctionPrototypes && NeedVarargsPrototypes #define _funcprotodef -DFUNCPROTO=3 #else #if NeedFunctionPrototypes #define _funcprotodef -DFUNCPROTO #else #define _funcprotodef /**/ #endif #endif #endif #endif #endif #endif #endif #if NeedWidePrototypes #define _wideprotodef /**/ #else #define _wideprotodef -DNARROWPROTO #endif PROTO_DEFINES = _funcprotodef _wideprotodef #undef _funcprotodef #undef _wideprotodef #if StripInstalledPrograms INSTPGMFLAGS = InstPgmFlags /* install flags for stripping */ #else INSTPGMFLAGS = #endif INSTBINFLAGS = InstBinFlags /* install flags for programs */ INSTUIDFLAGS = InstUidFlags /* install flags for setuid programs */ INSTLIBFLAGS = InstLibFlags /* install flags for libraries */ INSTINCFLAGS = InstIncFlags /* install flags for headers */ INSTMANFLAGS = InstManFlags /* install flags for man pages */ INSTDATFLAGS = InstDatFlags /* install flags for data files */ INSTKMEMFLAGS = InstKmemFlags /* install flags for /dev/kmem progs */ #ifdef ProjectRoot PROJECTROOT = ProjectRoot #endif #ifdef UseInstalled # if AlternateIncRoot # define TopInclude -I$(INCROOT) # else # define TopInclude /**/ # endif #else # define TopInclude -I$(TOP) #endif CDEBUGFLAGS = DefaultCDebugFlags CCOPTIONS = DefaultCCOptions /* to distinguish from param flags */ /* * STD_INCLUDES contains system-specific includes * TOP_INCLUDES specifies how to get to /usr/include or its build substitute * EXTRA_INCLUDES contains project-specific includes set in project incfiles * INCLUDES contains client-specific includes set in Imakefile * LOCAL_LDFLAGS contains client-specific ld flags flags set in Imakefile */ ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(INSTALLED_INCLUDES) $(STD_INCLUDES) ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(SETITIMER_DEFINES) $(FONT_DEFINES) $(PROTO_DEFINES) $(XEXT_EXTRA_DEFINES) $(THREADS_DEFINES) $(MODULE_DEFINES) $(DEFINES) $(EXTRA_DEFINES) CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(MODULE_CFLAGS) $(ALLDEFINES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES) LDPRELIB = LdPreLib $(INSTALLED_LIBS) LDPOSTLIB = LdPostLib LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) SERVERLDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) CXXLDOPTIONS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) LDLIBS = $(LDPOSTLIBS) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) #if HasBrokenCCForLink CCLINK = LdCmd #else #if AlternateUsrLibDir && HasLdRunPath CCENVSETUP = LD_RUN_PATH=$(USRLIBDIRPATH) CCLINK = $(CCENVSETUP) $(CC) #else CCLINK = $(CC) #endif #endif #if AlternateUsrLibDir && HasLdRunPath CXXENVSETUP = LD_RUN_PATH=$(USRLIBDIRPATH) CXXLINK = $(CXXENVSETUP) $(CXX) #else CXXLINK = $(CXX) #endif LDSTRIPFLAGS = LdStripFlags LDCOMBINEFLAGS = LdCombineFlags DEPENDFLAGS = DependFlags DEPEND_DEFINES = DependDefines XCOMM Not sure this belongs here TKLIBDIR = TkLibDir TKINCDIR = TkIncDir TKLIBNAME = TkLibName TKLIBRARY = TkLibrary TCLLIBDIR = TclLibDir TCLINCDIR = TclIncDir TCLLIBNAME = TclLibName TCLLIBRARY = TclLibrary MACROFILE = MacroFile RM_CMD = $(RM) IMAKE_DEFINES = /* leave blank, for command line use only */ IMAKE_WARNINGS = ImakeWarningFlags #ifdef UseInstalled IRULESRC = $(CONFIGDIR) /* used in rules file */ IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) \ $(IMAKE_WARNINGS) #else IRULESRC = $(CONFIGSRC)/cf IMAKE_CMD = $(IMAKE) -I$(IRULESRC) $(IMAKE_DEFINES) $(IMAKE_WARNINGS) #endif #if !HasClearmake /* clearmake records relevant defines and flags in the build script, so it knows when they change and we don't need this coarser-level dependency. We also don't want it, since it prevents sharing if even one config file, say site.def or host.def, changes. */ ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/X11.tmpl \ $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) \ OtherIConfigFiles SiteIConfigFiles $(EXTRA_ICONFIGFILES) #endif #ifndef TopLevelProject # define TopLevelProject X11 #endif #ifndef ProjectRulesFile # define ProjectRulesFile Concat3(<,TopLevelProject,.rules>) #endif #include ProjectRulesFile #ifndef LocalRulesFile /* need this to make ANSI-style preprocessors happy */ #define LocalRulesFile #endif #include LocalRulesFile /* * get project-specific configuration and rules */ #ifndef ProjectTmplFile #define ProjectTmplFile Concat3(<,TopLevelProject,.tmpl>) #endif #include ProjectTmplFile #ifndef LocalTmplFile /* need this to make ANSI-style preprocessors happy */ #define LocalTmplFile #endif #include LocalTmplFile #if !BuildLibraries && AlternateIncRoot && !defined(CrossCompileDir) INSTALLED_INCLUDES = -I$(INCROOT) #endif #if !defined(UseInstalled) && !BuildLibraries && AlternateUsrLibDir && !defined(CrossCompileDir) INSTALLED_LIBS = -L$(USRLIBDIR) #endif #ifdef FixupLibReferences FixupLibReferences() #endif /* ConfigDir comes from X11.tmpl */ CONFIGDIR = ConfigDir /* build configuration information */ #if HasClearmake OSNAME = OSName #endif USRLIBDIRPATH = UsrLibDirPath LDPRELIBS = LdPreLibs $(INSTALLED_LIBS) LDPOSTLIBS = LdPostLibs TOP_INCLUDES = TopIncludes PROJECT_DEFINES = ProjectDefines VENDOR_DEFINES = VendorDefines #if HasCplusplus CXXPROJECT_DEFINES = CplusplusProjectDefines #endif XCOMM ---------------------------------------------------------------------- XCOMM start of Imakefile #include INCLUDE_IMAKEFILE XCOMM ---------------------------------------------------------------------- XCOMM common rules for all Makefiles - do not edit .c.i: CPPOnlyCompile($*.c,$(_NOOP_)) .SUFFIXES: .ii .cc.ii: CPPOnlyCompile($*.cc,$(_NOOP_)) .SUFFIXES: .s .c.s: CompileCToAsm($(_NOOP_)) .cc.s: CompileCplusplusToAsm($(_NOOP_)) /* * These need to be here so that rules in Imakefile occur first; the blank * emptyrule is to make sure that an empty Imakefile does not default to make * clean. */ emptyrule:: CleanTarget() #ifndef IHaveSpecialMakefileTarget MakefileTarget() #endif #if BuildHtmlManPages RmanDependency() #endif TagsTarget() #ifdef MakefileAdditions MakefileAdditions() #endif CenterLoadTarget(debug_src,$(SRCS),NullParameter,$(ALLDEFINES)) CenterLoadTarget(debug_obj,$(OBJS),NullParameter,$(ALLDEFINES)) ManKeywordsTarget($(MANPATH)) HtmlManIndex /* Generate the "real" clean rules */ #undef clean clean:: cleandir distclean:: cleandir #ifdef IHaveSubdirs XCOMM ---------------------------------------------------------------------- XCOMM rules for building in SUBDIRS - do not edit InstallSubdirs($(SUBDIRS)) InstallManSubdirs($(SUBDIRS)) InstallDriverSDKSubdirs($(SUBDIRS)) CleanSubdirs($(SUBDIRS)) TagSubdirs($(SUBDIRS)) MakefileSubdirs($(SUBDIRS)) IncludesSubdirs($(SUBDIRS)) /* "distclean" subdirectories */ #undef BootstrapCleanSubdirs #define BootstrapCleanSubdirs /**/ #define clean distclean CleanSubdirs($(SUBDIRS)) #undef clean #endif #if !DontPreprocessManPages || defined(PreprocessManPages) PREPROCESSMANPAGES = true #endif /* must be after all install.man rules that install anything */ #ifndef MakeManKeywords #define MakeManKeywords NO #endif #if MakeManKeywords /* typically only at top level */ install.man:: man_keywords #endif /* must be after all install.man rules that install anything */ #ifndef MakeHtmlManIndex #define MakeHtmlManIndex NO #endif #if MakeHtmlManIndex /* typically only at top level */ install.man:: html_index #endif #ifndef IHaveSubdirs XCOMM ---------------------------------------------------------------------- XCOMM empty rules for directories that do not have SUBDIRS - do not edit install:: @echo "install in $(CURRENT_DIR) done" install.man:: @echo "install.man in $(CURRENT_DIR) done" install.sdk:: @echo "install.sdk in $(CURRENT_DIR) done" Makefiles:: includes:: depend:: #endif /* if subdirectory rules are needed */ #ifndef IHaveSpecialMakefileTarget /* "distclean" also removes the Makefile and the depend file */ distclean:: RemoveFiles(Makefile DependFileName) #endif XCOMM ---------------------------------------------------------------------- XCOMM dependencies generated by makedepend IncludeMakefile(DependFileName) nx-libs-3.5.99.23/nx-X11/config/cf/Library.tmpl0000644000000000000000000004271513614532331015453 0ustar /* * Library imakefile info - this contains any special redefinitions, etc. * that Imakefiles in the various library subtrees will need. * * Before including this, you must set the following boolean variables: * DoNormalLib, DoSharedLib, DoDebugLib, DoProfileLib * * To get automatic generation of standard rules, also set the variables: * LibName, SoRev, HasSharedData, and optionally HugeLibrary and IncSubdir. * * To suppress installation of the library define LibInstall NO. * To suppress creating (and installing) the library define LibCreate NO. * To suppress installing headers define LibHeaders NO. * Define LargePICTable YES if large (32-bit) PIC tables are needed. */ #ifndef DoNormalLib #define DoNormalLib NO #endif #ifndef DoSharedLib #define DoSharedLib NO #endif #ifndef DoDebugLib #define DoDebugLib NO #endif #ifndef DoProfileLib #define DoProfileLib NO #endif #ifndef DoExtraLib #define DoExtraLib NO #endif #ifndef HasSharedData #define HasSharedData NO #endif #ifndef HugeLibrary #define HugeLibrary NO #endif #ifndef ShlibBindGlobals #define ShlibBindGlobals NO #endif #if ShlibBindGlobals && defined(ShlibGlobalsFlags) SHLIBGLOBALSFLAGS = ShlibGlobalsFlags #endif #ifndef LibraryCplusplusOptions # if DoSharedLib && defined(SharedLibraryCplusplusOptions) # define LibraryCplusplusOptions SharedLibraryCplusplusOptions # else # define LibraryCplusplusOptions DefaultCplusplusOptions # endif #endif #ifndef LibraryDefines # define LibraryDefines StandardDefines #endif #ifndef LibraryDebugOpt # define LibraryDebugOpt /**/ #endif /* Note: Changing LibraryCDebugFlags has no effect because CDEBUGFLAGS is over- ridden by PassCDebugFlags in the parent Makefile or toplevel xmakefile. */ #ifndef LibraryCDebugFlags # define LibraryCDebugFlags DefaultCDebugFlags #endif #ifndef LibraryCplusplusDebugFlags # define LibraryCplusplusDebugFlags DefaultCplusplusDebugFlags #endif #ifndef SeparateSharedCompile # define SeparateSharedCompile YES #endif #ifdef CrossCompileDir # ifndef StripPath # define StripPath(x) `echo x|sed "s%.*/%%"` # endif #endif #ifndef CplusplusSource # ifndef LibraryCcCmd # if DoSharedLib && defined(SharedLibraryCcCmd) # define LibraryCcCmd SharedLibraryCcCmd # else # define LibraryCcCmd CcCmd # endif # endif # ifndef LibraryCCOptions # if DoSharedLib && defined(SharedLibraryCCOptions) # define LibraryCCOptions SharedLibraryCCOptions # else # define LibraryCCOptions DefaultCCOptions # endif # endif #ifdef CrossCompileDir # ifndef CrossLibraryCcCmd # define CrossLibraryCcCmd Concat3(CrossCompileDir,/,StripPath(LibraryCcCmd)) # endif #endif #ifdef CrossCompileDir CC = CrossLibraryCcCmd #else CC = LibraryCcCmd #endif CCOPTIONS = LibraryCCOptions STD_DEFINES = LibraryDefines $(PROJECT_DEFINES) CDEBUGFLAGS = LibraryCDebugFlags CLIBDEBUGFLAGS = LibraryDebugOpt CFLAGS = $(CDEBUGFLAGS) $(CLIBDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) # if defined(LargePICTable) && LargePICTable && defined(LargePositionIndependentCFlags) PICFLAGS = LargePositionIndependentCFlags # endif #else # ifndef CrossCompileDir # ifndef LibraryCplusplusCmd # if DoSharedLib && defined(SharedLibraryCplusplusCmd) # define LibraryCplusplusCmd SharedLibraryCplusplusCmd # else # define LibraryCplusplusCmd CplusplusCmd # endif # endif # else # ifndef CrossLibraryCplusplusCmd # if DoSharedLib && defined(SharedLibraryCplusplusCmd) # define CrossLibraryCplusplusCmd Concat3(CrossCompileDir,/,StripPath(SharedLibraryCplusplusCmd)) # else # define CrossLibraryCplusplusCmd Concat3(CrossCompileDir,/,StripPath(CplusplusCmd)) # endif # endif # endif # ifndef LibraryCplusplusOptions # if DoSharedLib && defined(SharedLibraryCplusplusOptions) # define LibraryCplusplusOptions SharedLibraryCplusplusOptions # else # define LibraryCplusplusOptions DefaultCplusplusOptions # endif # endif #ifdef CrossCompileDir CXX = CrossLibraryCplusplusCmd #else CXX = LibraryCplusplusCmd #endif CXXOPTIONS = LibraryCplusplusOptions STD_DEFINES = LibraryDefines $(PROJECT_DEFINES) CXXDEBUGFLAGS = LibraryCplusplusDebugFlags CXXLIBDEBUGFLAGS = LibraryDebugOpt CXXFLAGS = $(CXXDEBUGFLAGS) $(CXXLIBDEBUGFLAGS) $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) # if defined(LargePICTable) && LargePICTable # ifdef LargePositionIndependentCplusplusFlags CXXPICFLAGS = LargePositionIndependentCplusplusFlags # elif defined(LargePositionIndependentCFlags) CXXPICFLAGS = LargePositionIndependentCFlags # endif # endif #endif #ifdef LibraryMTDefines LIB_MT_DEFINES = LibraryMTDefines #endif #if defined(IHaveSubdirs) && HasSymLinks && !defined(NoLibSubdirs) #define _LibMkdir LibMkdirLinkSubdirs #else #define _LibMkdir LibMkdir #endif #if DoDebugLib # define _DebuggedLibMkdir() _LibMkdir(debugger) # define _DebuggedObjCompile(options) DebuggedLibObjCompile(options) # define _DebuggedObjCplusplusCompile(options) DebuggedLibObjCplusplusCompile(options) # define _DebuggedCleanDir() LibCleanDir(debugger) #else # define _DebuggedLibMkdir() $(_NULLCMD_) # define _DebuggedObjCompile(options) $(_NULLCMD_) # define _DebuggedObjCplusplusCompile(options) $(_NULLCMD_) # define _DebuggedCleanDir() $(_NULLCMD_) #endif #if DoProfileLib # define _ProfiledLibMkdir() _LibMkdir(profiled) # define _ProfiledObjCompile(options) ProfiledLibObjCompile(options) # define _ProfiledObjCplusplusCompile(options) ProfiledLibObjCplusplusCompile(options) # define _ProfiledCleanDir() LibCleanDir(profiled) #else # define _ProfiledLibMkdir() $(_NULLCMD_) # define _ProfiledObjCompile(options) $(_NULLCMD_) # define _ProfiledObjCplusplusCompile(options) $(_NULLCMD_) # define _ProfiledCleanDir() $(_NULLCMD_) #endif #if !DoNormalLib # define _NormalLibMkdir() $(_NULLCMD_) # define _NormalObjCompile(options) $(_NULLCMD_) # define _NormalObjCplusplusCompile(options) $(_NULLCMD_) # define _NormalCleanDir() $(_NULLCMD_) #else # if DoSharedLib && SeparateSharedCompile # define _NormalLibMkdir() _LibMkdir(unshared) # define _NormalObjCompile(options) UnsharedLibObjCompile(options) # define _NormalObjCplusplusCompile(options) UnsharedLibObjCplusplusCompile(options) # define _NormalCleanDir() LibCleanDir(unshared) # else # define _NormalLibMkdir() $(_NULLCMD_) # if !DoSharedLib && defined(IncludeSharedObjectInNormalLib) # define _NormalObjCompile(options) NormalRelocLibObjCompile(options) # else # define _NormalObjCompile(options) NormalLibObjCompile(options) # endif # define _NormalObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options) # define _NormalCleanDir() $(_NULLCMD_) # endif #endif #if !DoSharedLib || (DoNormalLib && !SeparateSharedCompile) # define _SharedObjCompile(options) $(_NULLCMD_) # define _SharedObjCplusplusCompile(options) $(_NULLCMD_) #else # if SeparateSharedCompile # define _SharedObjCompile(options) NormalSharedLibObjCompile(options) # define _SharedObjCplusplusCompile(options) NormalSharedLibObjCplusplusCompile(options) #else # define _SharedObjCompile(options) NormalLibObjCompile(options) # define _SharedObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options) #endif #endif #ifndef LibInstallBuild #define LibInstallBuild NO #endif #if DoExtraLib && defined(ExtraLibRules) # define _ExtraLibMkdir() ExtraLibMkdir() # define _ExtraObjCompile(options) ExtraObjCompile(options) # define _ExtraObjCplusplusCompile(options) ExtraObjCplusplusCompile(options) # define _ExtraCleanDir() ExtraCleanDir() #else # define _ExtraLibMkdir() $(_NULLCMD_) # define _ExtraObjCompile(options) $(_NULLCMD_) # define _ExtraObjCplusplusCompile(options) $(_NULLCMD_) # define _ExtraCleanDir() $(_NULLCMD_) #endif #ifndef CplusplusSource # define SRCsuf c # define Isuf i #else # define SRCsuf CCsuf # define Isuf ii # ifdef SunArchitecture .SUFFIXES: Concat(.,CCsuf) # endif #endif #define _CompileObj(target, options) @@\ target @@\ _DebuggedObjCompile(options) @@\ _ProfiledObjCompile(options) @@\ _NormalObjCompile(options) @@\ _ExtraObjCompile(options) @@\ _SharedObjCompile(options) #ifndef SeparateSharedCompile # define _CompileObjSeparateOpts(target,staticopts,sharedopts) \ _CompileObj(target,sharedopts) #else # define _CompileObjSeparateOpts(target,staticopts,sharedopts) @@\ target @@\ _DebuggedObjCompile(staticopts) @@\ _ProfiledObjCompile(staticopts) @@\ _NormalObjCompile(staticopts) @@\ _ExtraObjCompile(staticopts) @@\ _SharedObjCompile(sharedopts) #endif #ifdef CplusplusSource # define _CompileObjCplusplus(target, options) @@\ target @@\ _DebuggedObjCplusplusCompile(options) @@\ _ProfiledObjCplusplusCompile(options) @@\ _NormalObjCplusplusCompile(options) @@\ _ExtraObjCplusplusCompile(options) @@\ _SharedObjCplusplusCompile(options) #else # define _CompileObjCplusplus(target, options) #endif #ifndef LibraryObjectRule # define LibraryObjectRule() @@\ all:: @@\ _DebuggedLibMkdir() @@\ _ProfiledLibMkdir() @@\ _NormalLibMkdir() @@\ _ExtraLibMkdir() @@\ @@\ includes:: @@\ _DebuggedLibMkdir() @@\ _ProfiledLibMkdir() @@\ _NormalLibMkdir() @@\ _ExtraLibMkdir() @@\ @@\ _CompileObj(.c.Osuf:,$(_NOOP_)) @@\ _CompileObjCplusplus(.SRCsuf.Osuf:,$(_NOOP_)) @@\ @@\ clean:: @@\ _DebuggedCleanDir() @@\ _ProfiledCleanDir() @@\ _NormalCleanDir() @@\ _ExtraCleanDir() @@\ #endif /* LibraryObjectRule */ #ifndef SpecialLibObjectRule # define SpecialLibObjectRule(objs,depends,options) @@\ _CompileObj(objs: depends,options) #endif /* SpecialLibObjectRule */ #ifndef SpecialCLibObjectRule # define SpecialCLibObjectRule(basename,depends,options) @@\ _CompileObj(basename.Osuf: basename.SRCsuf depends,options) @@\ @@\ basename.Isuf: basename.SRCsuf depends @@\ CPPOnlyCompile(basename.SRCsuf,options) @@\ @@\ CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options) #endif /* SpecialCLibObjectRule */ #ifndef SpecialCLibObjectRuleSeparateOpts # define SpecialCLibObjectRuleSeparateOpts(basename,depends,staticopts,shopts) @@\ _CompileObjSeparateOpts(basename.Osuf: basename.SRCsuf depends,staticopts,shopts) @@\ @@\ basename.Isuf: basename.SRCsuf depends @@\ CPPOnlyCompile(basename.SRCsuf,sharedopts) @@\ @@\ CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options) #endif /* SpecialCLibObjectRuleSepareateOpts */ #ifndef SpecialCplusplusLibObjectRule # define SpecialCplusplusLibObjectRule(basename,depends,options) @@\ _CompileObjCplusplus(basename.Osuf: basename.SRCsuf depends,options) @@\ @@\ CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options) #endif /* SpecialCplusplusLibObjectRule */ /* * ToolkitMakeStrings generates a string-table, i.e., a C source * file and the matching header(s), e.g., Xt's StringDefs.c, StringDefs.h, * and Shell.h files; or Motif's XmStrDefs.c and XmStrDefs.h files. * * The 'files' argument is the list of files that will be produced by * this rule, e.g., for Xt they would be "Shell.h StringDefs.c StringDefs.h" * and for Motif they would be "XmStrDefs.c XmStrDefs.h". * * The 'source' argument is the string-list file to be parsed, e.g., in * Xt that would be "util/string.list". For Motif 2.0 it would be * "../../tools/makestr/xmstring.list", and for Motif-CDE1 it would be * "util/xmstring.list". * * The 'options' argument is passed by the library's Imakefile, see the * Xt Imakefile for an example. Typically this would be nothing, -intelabi, * or -sparcabi; there are other choices, but these are typical. * * The 'depends' argument names additional files the target files * depend on. It should name the #ctmpl and #htmpl files from the * 'source' file. * * The 'dest' argument is the C source output file. For Xt this should * be "StringDefs.c", and for all versions of Motif it would be "XmStrDefs.c" * * Headers are generated and named according to data in the 'source' * file. */ /* * The NoCmpScript * prevents clearmake from trying to remake makestrs if it exists. * Including both $(MAKESTRS) and $(MAKESTRS).o as primary targets * prevents clearmake from trying to recompile makestrs from here. * We have includes, not files, depend on makestrs to try to get * clearmake to wink in the files. Bug in clearmake 2.0.2? */ #ifndef MakeStringsDependency # ifndef UseInstalled # define MakeStringsDependency @@\ MAKESTRS = $(CONFIGSRC)/util/makestrs @@\ NoCmpScript(HostProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf) @@\ @@\ HostProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf: @@\ cd $(CONFIGSRC)/util && $(MAKE) HostProgramTargetName(makestrs) @@\ @@\ includes:: HostProgramTargetName($(MAKESTRS)) # else # define MakeStringsDependency /**/ # endif #endif #ifndef ToolkitMakeStrings # if defined(LibTookitMakeStringsDependency) && LibTookitMakeStringsDependency # define ToolkitMakeStrings(files,source,options,depends,dest) @@\ files: source depends @@\ RemoveFiles(files) @@\ RunProgram(MAKESTRS,options < source > dest) @@\ @@\ AllTarget(files) @@\ @@\ includes:: files @@\ @@\ depend:: files @@\ @@\ clean:: @@\ RemoveFiles(files) # else # define ToolkitMakeStrings(files,source,options,depends,dest) @@\ MakeStringsDependency @@\ @@\ files: source depends @@\ RemoveFiles(files) @@\ RunProgram(MAKESTRS,options < source > dest) @@\ @@\ AllTarget(files) @@\ @@\ includes:: files @@\ @@\ depend:: files @@\ @@\ clean:: @@\ RemoveFiles(files) # endif #endif /* ToolkitMakeStrings */ #ifdef LibName LIBNAME = LibName # if defined(LibTookitMakeStringsDependency) && LibTookitMakeStringsDependency /* * Do ToolkitMakeStrings() before BuildIncludes so makestrs is still * built first, even if the generated header will be installed. */ MakeStringsDependency # endif LibraryObjectRule() # undef _LinkBuildLibrary # if !defined(LibInstall) || LibInstall || LibInstallBuild # define _LinkBuildLibrary(lib) LinkBuildLibrary(lib) # else # define _LinkBuildLibrary(lib) $(_NULLCMD_) # endif # if defined(LibBuild) && !LibBuild # define LibCreate NO # endif # if !defined(LibCreate) || LibCreate # if DoSharedLib # if HugeLibrary && defined(SharedLibraryTarget3) SharedLibraryTarget3($(LIBNAME),$(SoRev),$(OBJS1),$(OBJS2),$(OBJS3) $(EXTRASHAREDOBJS),.,.) # else # if defined(SharedLibtoolRev) && defined(SharedLibtoolLibraryTarget) SharedLibtoolLibraryTarget($(LIBNAME),SharedLibtoolRev,$(OBJS) $(EXTRASHAREDOBJS),.,.) # else SharedLibraryTarget($(LIBNAME),$(SoRev),$(OBJS) $(EXTRASHAREDOBJS),.,.) # endif # endif # if !defined(LibInstall) || LibInstall # if defined(SharedLibtoolRev) && defined(InstallSharedLibtoolLibrary) InstallSharedLibtoolLibrary($(LIBNAME),SharedLibtoolRev,$(SHLIBDIR)) # else InstallSharedLibrary($(LIBNAME),$(SoRev),$(SHLIBDIR)) # endif # endif # if HasSharedData SharedLibraryDataTarget($(LIBNAME),$(SoRev),$(UNSHAREDOBJS)) # if !defined(LibInstall) || LibInstall InstallSharedLibraryData($(LIBNAME),$(SoRev),$(SHLIBDIR)) # endif # endif # endif # if DoNormalLib # if HugeLibrary # if DoSharedLib && SeparateSharedCompile UnsharedLibraryTarget3($(LIBNAME),$(OBJS1),$(OBJS2),$(OBJS3) $(EXTRAUNSHAREDOBJS),unshared,..) # else NormalLibraryTarget3($(LIBNAME),$(OBJS1),$(OBJS2),$(OBJS3) $(EXTRAUNSHAREDOBJS)) # endif # else # if DoSharedLib && SeparateSharedCompile UnsharedLibraryTarget($(LIBNAME),$(OBJS) $(EXTRAUNSHAREDOBJS),unshared,..) # else NormalLibraryTarget($(LIBNAME),$(OBJS) $(EXTRAUNSHAREDOBJS)) # endif # endif # if !defined(LibInstall) || LibInstall InstallLibrary($(LIBNAME),$(USRLIBDIR)) # endif # endif # if DoProfileLib ProfiledLibraryTarget($(LIBNAME),$(OBJS) $(EXTRAUNSHAREDOBJS)) # if !defined(LibInstall) || LibInstall InstallLibrary($(LIBNAME)_p,$(USRLIBDIR)) # endif # endif # if DoDebugLib DebuggedLibraryTarget($(LIBNAME),$(OBJS) $(EXTRAUNSHAREDOBJS)) # if !defined(LibInstall) || LibInstall InstallLibrary($(LIBNAME)_d,$(USRLIBDIR)) # endif # endif # if DoExtraLib && defined(ExtraLibRules) ExtraLibraryTarget($(LIBNAME),$(SoRev),$(OBJS) $(EXTRAUNSHAREDOBJS)) # if !defined(LibInstall) || LibInstall ExtraInstallLibrary($(LIBNAME),$(SoRev)) # endif # endif LintLibraryTarget($(LIBNAME),$(SRCS)) # if !defined(LibInstall) || LibInstall InstallLintLibrary($(LIBNAME),$(LINTLIBDIR)) # endif # else /* not LibCreate */ # if LibBuild # if HugeLibrary AllTarget($(OBJS1)) AllTarget($(OBJS2)) AllTarget($(OBJS3)) # else AllTarget($(OBJS)) # endif # if DoSharedLib AllTarget($(EXTRASHAREDOBJS)) # endif # if DoNormalLib AllTarget($(EXTRAUNSHAREDOBJS)) # endif # endif /* LibBuild */ # endif /* LibCreate */ # ifdef IncSubdir # ifdef IncSubSubdir # if !defined(LibHeaders) || LibHeaders BuildIncludes($(HEADERS),IncSubdir/IncSubSubdir,../..) # if BuildLibraries InstallMultipleFlags($(HEADERS),$(INCDIR)/IncSubdir/IncSubSubdir,$(INSTINCFLAGS)) # endif # endif # else # if !defined(LibHeaders) || LibHeaders BuildIncludes($(HEADERS),IncSubdir,..) # if BuildLibraries InstallMultipleFlags($(HEADERS),$(INCDIR)/IncSubdir,$(INSTINCFLAGS)) # endif # endif # endif # else # ifndef CplusplusSource # if !defined(LibHeaders) || LibHeaders BuildIncludesTop($(HEADERS)) # if BuildLibraries InstallMultipleFlags($(HEADERS),$(INCDIR),$(INSTINCFLAGS)) # endif # endif # endif # endif NormalLintTarget($(SRCS)) #endif /* defined(LibName) */ #ifdef NoSoSymlink SOSYMLINK = false #else SOSYMLINK = true #endif nx-libs-3.5.99.23/nx-X11/config/cf/linux.cf0000644000000000000000000006227013614532331014620 0ustar #ifndef LinuxElfDefault # define LinuxElfDefault YES #endif #ifndef UseElfFormat # define UseElfFormat LinuxElfDefault #endif #ifndef OSBinaryType # if UseElfFormat # define OSBinaryType [ELF] # else # ifdef AlphaArchitecture # define OSBinaryType [ECOFF] # else # define OSBinaryType [a.out] # endif # endif #endif #ifndef OSName # define OSName DefaultOSName OSBinaryType #endif #ifndef OSVendor # define OSVendor /**/ #endif #ifndef OSMajorVersion # define OSMajorVersion DefaultOSMajorVersion #endif #ifndef OSMinorVersion # define OSMinorVersion DefaultOSMinorVersion #endif #ifndef OSTeenyVersion # define OSTeenyVersion DefaultOSTeenyVersion #endif #ifndef LinuxDistribution # define LinuxDistribution DefaultLinuxDistribution /* Add "#define LinuxDistribution Linux" to your site.def or host.def. Currently only LinuxSuSE, LinuxRedHat and LinuxDebian will be figured out automatically. Valid values are (from the list at www.linux.org in Oct. '97): LinuxUnknown (0) LinuxSuSE (1) LinuxCaldera (2) LinuxCraftworks (3) LinuxDebian (4) LinuxInfoMagic (5) LinuxKheops (6) LinuxPro (7) LinuxRedHat (8) LinuxSlackware (9) LinuxTurbo (10) LinuxWare (11) LinuxYggdrasil (12) */ #endif #ifndef LinuxDistName # define LinuxDistName DefaultLinuxDistName #endif #ifndef LinuxCLibMajorVersion # define LinuxCLibMajorVersion DefaultLinuxCLibMajorVersion #endif #ifndef LinuxCLibMinorVersion # define LinuxCLibMinorVersion DefaultLinuxCLibMinorVersion #endif #ifndef LinuxCLibTeenyVersion # define LinuxCLibTeenyVersion DefaultLinuxCLibTeenyVersion #endif #ifndef HasGhostScript # define HasGhostScript YES #endif #ifndef BuildPDFdocs # define BuildPDFdocs NO #endif #ifndef LinuxBinUtilsMajorVersion # define LinuxBinUtilsMajorVersion DefaultLinuxBinUtilsMajorVersion #endif XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVersion) XCOMM libc: (LinuxCLibMajorVersion./**/LinuxCLibMinorVersion./**/LinuxCLibTeenyVersion) XCOMM binutils: (LinuxBinUtilsMajorVersion) #if LinuxDistribution == LinuxDebian # if !defined(NothingOutsideProjectRoot) || !NothingOutsideProjectRoot # define SystemManDirectory /usr/share/man # endif # define HasPam YES /* un-comment this when it is un-broken */ /* # define JoystickSupport YES */ # if !defined(NothingOutsideProjectRoot) || !NothingOutsideProjectRoot # define XAppLoadDir EtcX11Directory/app-defaults # define XFileSearchPathDefault Concat4(EtcX11Directory/%L/%T/%N%C,%S:EtcX11Directory/%l/%T/%N%C,%S:EtcX11Directory/%T/%N%C,%S:EtcX11Directory/%L/%T/%N%S:EtcX11Directory/%l/%T/%N%S:EtcX11Directory/%T/%N%S):Concat4($(LIBDIR)/%L/%T/%N%C,%S:$(LIBDIR)/%l/%T/%N%C,%S:$(LIBDIR)/%T/%N%C,%S:$(LIBDIR)/%L/%T/%N%S:$(LIBDIR)/%l/%T/%N%S:$(LIBDIR)/%T/%N%S) /* the relative symlink created by this rule causes problems for us */ # endif /* !defined(NothingOutsideProjectRoot) || !NothingOutsideProjectRoot */ # define SharedLibXdmGreet NO # define FSUseSyslog YES # define DriverManSuffix 4x # define DriverManDir $(MANSOURCEPATH)4 # define MiscManSuffix 7x # define MiscManDir $(MANSOURCEPATH)7 /* * * # define DebianMaintainer YES * * */ # ifdef DebianMaintainer # ifndef XorgCustomVersion # define XorgCustomVersion "Debian" # endif # ifndef BuilderEMailAddr # define BuilderEMailAddr "debian-x@lists.debian.org" # endif # define XFree86Devel YES # define BuildAllSpecsDocs YES # define DebuggableLibraries YES # define ForceNormalLib YES # define BuildSpecsDocs YES # define SpecsDocDirs CTEXT GL ICCCM X11 Xext Xv i18n xterm # define BuildHtmlManPages NO /* m68k has no 2.4 kernel yet */ # ifndef Mc68020Architecture # define HasLinuxInput YES # endif # define HasXdmAuth YES # define HasLatex YES /* extended instruction set support */ # ifdef i386Architecture # define HasX86Support YES # define HasMMXSupport YES # define Has3DNowSupport YES /* 2.4 is not yet the official (or predominant) kernel in unstable */ # define HasSSESupport NO # endif /* i386Architecture */ # endif /* DebianMaintainer */ #endif /* LinuxDebian */ #if LinuxDistribution == LinuxRedHat #define FSUseSyslog YES #endif #ifndef HasDevRandom # define HasDevRandom YES # ifndef RandomDeviceName # define RandomDeviceName /dev/urandom # endif #endif /* * The Linux BinUtils major version. 25 => 2.5.x, which is what is included * with Slackware 3.0 * * This remains for compatibility only. * */ #ifndef BinUtilsMajorVersion # define BinUtilsMajorVersion LinuxBinUtilsMajorVersion #endif #if (LinuxCLibMajorVersion >= 6 || LinuxDistribution == LinuxSuSE) # define LinuxLocaleDefines /**/ #else # define LinuxLocaleDefines -DX_LOCALE #endif #ifndef LinuxAdditionalIncludes # define LinuxAdditionalIncludes /**/ #endif #ifndef LinuxGnuSourceDefines # ifdef UseInstalled # define LinuxGnuSourceDefines /**/ # else # define LinuxGnuSourceDefines -D_GNU_SOURCE # endif #endif #if LinuxCLibMajorVersion >= 6 # define LinuxSourceDefines -D_POSIX_C_SOURCE=199309L \ -D_POSIX_SOURCE -D_XOPEN_SOURCE \ -D_DEFAULT_SOURCE \ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \ LinuxAdditionalIncludes LinuxGnuSourceDefines \ LinuxLocaleDefines # define HasPosixThreads YES # define ThreadedX YES # define HasThreadSafeAPI YES # define ThreadsLibraries -lpthread # define SystemMTDefines -D_REENTRANT # ifndef HasLibCrypt # define HasLibCrypt YES # endif /* netscape wraps select but not poll as of communicator 4.72 */ # ifndef HasPoll # define HasPoll NO # endif #else # define LinuxSourceDefines -D_POSIX_SOURCE -D_POSIX_C_SOURCE=2 \ -D_BSD_SOURCE -D_SVID_SOURCE \ LinuxGnuSourceDefines LinuxLocaleDefines # ifndef HasLibCrypt # define HasLibCrypt NO # endif # ifndef HasBasename # define HasBasename NO # endif /* Proliferation of C99isms makes -ansi unpalatable... */ # if !defined(DefaultCCOptions) && !defined(UseInstalled) && HasGcc # define DefaultCCOptions GccWarningOptions # endif #endif /* * XXX Check which versions of Linux really have IPv6. glibc 2.0 on * Red Hat 5.2 doesn't. */ #if LinuxCLibMajorVersion < 6 || \ (LinuxCLibMajorVersion == 6 && LinuxCLibMinorVersion == 0) #define BuildIPv6 NO #endif /* support mainly for USB support */ #ifndef HasLinuxInput # if defined(__linux__) && (OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 4)) # define HasLinuxInput YES # else # define HasLinuxInput NO # endif #endif #ifndef JoystickSupport # define JoystickSupport NO /* joystick driver is broken */ #endif /* appeared in 2.1.45 (officially) */ #ifndef HasLinuxSupport # if defined(__linux__) && (JoystickSupport || \ (OSMajorVersion > 2) || \ ((OSMajorVersion == 2) && (OSMinorVersion > 1)) || \ ((OSMajorVersion == 2) && (OSMinorVersion == 1) && (OSTeenyVersion >= 45))) # define HasLinuxJoystick YES # else # define HasLinuxJoystick NO # endif #endif /* Libtool on linux always uses minor numbers */ #define LibtoolMinorVersions YES /* On x86, determine whether to build with MTRR support */ #ifndef HasMTRRSupport # if defined (i386Architecture) || defined (AMD64Architecture) # if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion > 1) || \ (OSMajorVersion == 2 && OSMinorVersion == 1 && OSTeenyVersion >= 99) # define HasMTRRSupport YES # else # define HasMTRRSupport NO # endif # else # define HasMTRRSupport NO /* no for non-ix86 */ # endif #endif #ifndef XF86INT10_BUILD # if defined(__linux__) && defined(i386Architecture) # define XF86INT10_BUILD X86VM # elif defined(__linux__) && defined(AMD64Architecture) # define XF86INT10_BUILD X86EMU_OS # else # define XF86INT10_BUILD X86EMU_GENERIC # endif #endif /* * Let the OS restore console fonts instead of the generic VGA * layer. This exists for Linux only at the moment so put it * here. */ #ifndef DoOSFontRestore # define DoOSFontRestore YES #endif /* Should we check the OS version to determine if the kernel supports it? */ #if DoOSFontRestore # ifndef FontRestoreCheckOsVersion # define FontRestoreCheckOsVersion YES # endif #endif #ifndef HasAgpGart # if defined(i386Architecture) || defined(ia64Architecture) || defined(AMD64Architecture) /* The AGPGART header file is included in os-support/linux, which allows all drivers that depend on AGP to build properly. */ # define HasAgpGart YES # else # define HasAgpGart NO # endif #endif /* * Support for Intel's SSE Native Instructions, also known as the * Streaming SIMD Extensions, was introduced in the 2.4.x kernels. */ #ifndef HasSSESupport # if defined(i386Architecture) # if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 4) # define HasSSESupport YES # else # define HasSSESupport NO # endif # else # define HasSSESupport NO # endif #endif /* * Support for MMX isn't present in the Assembler used in Red Hat 4.2, so * don't enable it for libc5 as a reasonable default. */ #ifndef HasMMXSupport # if defined(i386Architecture) # if (LinuxCLibMajorVersion > 5) # define HasMMXSupport YES # else # define HasMMXSupport NO # endif # else # define HasMMXSupport NO # endif #endif /* * Support for 3DNow isn't present in the Assembler used in Red Hat 4.2, so * don't enable it for libc5 as a reasonable default. * * XXX This is preliminary. */ #ifndef Has3DNowSupport # if defined(i386Architecture) # if (LinuxCLibMajorVersion > 5) # define Has3DNowSupport YES # else # define Has3DNowSupport NO # endif # else # define Has3DNowSupport NO # endif #endif #if defined(__linux__) && !defined(LinuxFBDevSupport) # define LinuxFBDevSupport YES #endif /* For compatibility */ #define SourceDefines LinuxSourceDefines #define BuildLibPathVar LD_LIBRARY_PATH #define GccUsesGas YES #define UseGas YES #define GnuCpp YES #if UseElfFormat # ifndef HasDlopen # define HasDlopen YES # endif #endif #define HasWeakSymbols UseElfFormat #ifndef HasShadowPasswd # if UseElfFormat # define HasShadowPasswd YES # else # define HasShadowPasswd NO # endif #endif #define HasPutenv YES #ifndef HasShm # define HasShm YES #endif /* Use SecureRPC (used for SUN-DES-1 auth. and other goodies) when * glibc has support for it */ #ifndef HasSecureRPC # if !(LinuxCLibMajorVersion < 6 || \ (LinuxCLibMajorVersion == 6 && LinuxCLibMinorVersion < 3)) # define HasSecureRPC YES # endif #endif #define HasSockets YES #if UseElfFormat || defined(AlphaArchitecture) #ifndef HasSnprintf #define HasSnprintf YES #endif #ifndef HasReallocarray #define HasReallocarray NO #endif #define HasMkstemp YES #endif /* getresuid() appeared in 2.1.4, and getresgid in 2.1.44 */ #if !defined(HasGetresuid) && \ (((OSMajorVersion*100000) + (OSMinorVersion*1000) + OSTeenyVersion) >= 201044) #define HasGetresuid YES #endif #if OSMajorVersion >= 2 #define HasUsableFileMmap YES #endif #ifndef HasNCurses #define HasNCurses YES #endif #ifndef HasGroff #define HasGroff YES #endif #define AvoidNullMakeCommand YES #ifndef DebuggableLibraries #define DebuggableLibraries NO #endif #define CompressAllFonts YES #define Malloc0ReturnsNull YES #define NeedConstPrototypes YES #define NeedFunctionPrototypes YES #define NeedNestedPrototypes YES #define NeedVarargsPrototypes YES #ifndef NeedWidePrototypes #define NeedWidePrototypes NO #endif #define SetTtyGroup YES #ifndef UseStaticTermcapLib #define UseStaticTermcapLib NO #endif #ifndef HasCookieMaker #define HasCookieMaker YES #define MkCookieCmd mcookie #endif #ifndef BourneShell /* * This will cause builds/installs to terminate on errors, as on other * platforms. */ #define BourneShell /bin/sh -e #endif #define MkdirHierCmd mkdir -p #ifndef HaveLib64 # if defined (AMD64Architecture) || defined (s390xArchitecture) || defined (Ppc64Architecture) || defined (Ppc64LeArchitecture) # define HaveLib64 YES # else # define HaveLib64 NO # endif #endif #if LinuxElfDefault # if UseElfFormat # ifdef MipsArchitecture # ifndef AsCmd # define AsCmd gcc -c -x assembler-with-cpp # endif # endif /* MipsArchitecure */ # if defined (i386Architecture) && ((GccMajorVersion >3) \ || ((GccMajorVersion == 3) && (GccMinorVersion >= 1))) # ifndef CcCmd # define CcCmd gcc -m32 # endif # ifndef CplusplusCmd # define CplusplusCmd c++ -m32 # endif # endif # if defined (Ppc64Architecture) || defined (Ppc64LeArchitecture) # ifndef CcCmd # define CcCmd gcc -m64 # endif # ifndef CplusplusCmd # define CplusplusCmd c++ -m64 # endif # endif # ifndef CcCmd # define CcCmd gcc # define CplusplusCmd c++ # endif # ifndef AsCmd # define AsCmd CcCmd -c -x assembler # endif # define AsmDefines -D__ELF__ # ifndef LdCmd # define LdCmd CcCmd -nostdlib # endif # ifndef LinuxUsesNcurses # if LinuxCLibMajorVersion >= 6 || (LinuxDistribution == LinuxSuSE) # define LinuxUsesNcurses YES # else # define LinuxUsesNcurses NO # endif # endif # ifndef TermcapLibrary # if UseStaticTermcapLib # if LinuxUsesNcurses # if !HaveLib64 # define TermcapLibrary StaticLibrary(/usr/lib,ncurses) # else # define TermcapLibrary StaticLibrary(/usr/lib64,ncurses) # endif # else # if !HaveLib64 # define TermcapLibrary StaticLibrary(/usr/lib/termcap,termcap) # else # define TermcapLibrary StaticLibrary(/usr/lib64/termcap,termcap) # endif # endif # else # if LinuxUsesNcurses # define TermcapLibrary -lncurses # else # define TermcapLibrary -ltermcap # endif # endif # endif # else /* UseElfFormat */ # ifdef AlphaArchitecture # define CcCmd gcc -b alpha-linuxecoff # define CplusplusCmd g++ -b alpha-linuxecoff # define AsCmd CcCmd -c -x assembler # define LdCmd CcCmd -nostdlib -Wl,"-m alpha" # define AsmDefines -DUSE_GAS -U__ELF__ # endif /* AlphaArchitecture */ # ifdef HPArchitecture # define CcCmd gcc # define CplusplusCmd g++ # define AsCmd CcCmd -c -x assembler # define LdCmd CcCmd -nostdlib # define AsmDefines -DUSE_GAS -U__ELF__ # endif /* HPArchitecture */ # ifdef i386Architecture # define CcCmd gcc -b i486-linuxaout # define CplusplusCmd g++ -b i486-linuxaout # define AsCmd CcCmd -c -x assembler # define LdCmd CcCmd -nostdlib -Wl,"-m i386linux" # define AsmDefines -DUSE_GAS -U__ELF__ # endif /* i386Architecture */ # ifdef ia64Architecture # define CcCmd gcc # define CplusplusCmd g++ # define AsCmd CcCmd -c -x assembler # define LdCmd CcCmd -nostdlib # define AsmDefines -DUSE_GAS -U__ELF__ # endif /* ia64Architecture */ # ifdef Mc68020Architecture # define CcCmd gcc -b m68k-linuxaout # define CplusplusCmd g++ -b m68k-linuxaout # define AsCmd CcCmd -c -x assembler # define LdCmd CcCmd -nostdlib -Wl,"-m m68klinux" # define AsmDefines -DUSE_GAS -U__ELF__ # endif /* Mc68020Architecture */ # ifdef AMD64Architecture # define CcCmd gcc # define CplusplusCmd g++ # define AsCmd CcCmd -c -x assembler # define LdCmd CcCmd -nostdlib # define AsmDefines -DUSE_GAS -U__ELF__ # endif /* AMD64Architecture */ # endif /* UseElfFormat */ #else # if UseElfFormat # ifdef AlphaArchitecture # define CcCmd gcc -b alpha-linux # define AsCmd CcCmd -c -x assembler # define LdCmd CcCmd -nostdlib -Wl,"-m elf64alpha" # define AsmDefines -D__ELF__ # define CplusplusCmd c++ -b alpha-linux # endif /* AlphaArchitecture */ # ifdef HPArchitecture # define CcCmd gcc # define CplusplusCmd g++ # define AsCmd CcCmd -c -x assembler # define LdCmd CcCmd -nostdlib # define AsmDefines -D__ELF__ # endif /* HPArchitecture */ # ifdef i386Architecture # define CcCmd gcc -b i486-linux # define AsCmd CcCmd -c -x assembler # define LdCmd CcCmd -nosdlib -Wl,"-m elf_i386" # define AsmDefines -D__ELF__ # define CplusplusCmd c++ -b i486-linux # endif /* i386Architecture */ # ifdef ia64Architecture # define CcCmd gcc # define CplusplusCmd g++ # define AsCmd CcCmd -c -x assembler # define LdCmd CcCmd -nostdlib # define AsmDefines -D__ELF__ # endif /* ia64Architecture */ # ifdef Mc68020Architecture # define CcCmd gcc -b m68k-linux # define AsCmd CcCmd -c -x assembler # define LdCmd CcCmd -nostdlib -W,l"-m m68kelf" # define AsmDefines -D__ELF__ # define CplusplusCmd c++ -b m68k-linux # endif /* Mc68020Architecture */ # ifdef AMD64Architecture # define CcCmd gcc # define CplusplusCmd g++ # define AsCmd CcCmd -c -x assembler # define LdCmd CcCmd -nostdlib # define AsmDefines -D__ELF__ # endif /* AMD64Architecture */ # else # define CcCmd gcc # define AsCmd CcCmd -c -x assembler # define LdCmd CcCmd -nostdlib # define AsmDefines -DUSE_GAS # endif #endif /* * Some older distros still need /lib/cpp. There's probably a better * test, but this handles the older Red Hat releases at least. */ #ifndef CppCmd # if (LinuxDistribution == LinuxRedHat) && \ ((LinuxCLibMajorVersion < 6) || \ (LinuxCLibMajorVersion == 6 && LinuxCLibMinorVersion < 1)) # define CppCmd /lib/cpp # else # define CppCmd cpp # endif #endif /* Some Linux distributions have yacc, some don't. All have bison. */ #define YaccCmd bison -y #define LexCmd flex -l #define HasFlex YES #define LexLib -lfl #define PreProcessCmd CcCmd -E #define PostIncDir DefaultGccIncludeDir #define LdCombineFlags -r #ifndef LdPostLib # define LdPostLib /* Never needed */ #endif #define HasWChar32 YES #define StandardCppOptions -traditional #define StandardCppDefines StandardDefines #define HasVarRun YES #ifndef VarDbDirectory # define VarDbDirectory $(VARDIR)/lib #endif #ifndef OSXInputDrivers # if HasLinuxJoystick # define OSXInputDrivers1 ur98 # else # define OSXInputDrivers1 /**/ # endif # if HasLinuxInput # define OSXInputDrivers2 aiptek evdev # else # define OSXInputDrivers2 /**/ # endif # define OSXInputDrivers OSXInputDrivers1 OSXInputDrivers2 #endif #if UseElfFormat # define HasPlugin YES # define VendorHasX11R6_3libXext YES /* XC or XFree86 >= 3.3.1 */ #endif #ifdef AlphaArchitecture # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags DefaultGcc2AxpOpt # endif # define LinuxMachineDefines -D__alpha__ # define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 -DJENSEN_SUPPORT # ifdef UseCompaqMathLibrary # define MathLibrary -lcpml -lm # endif #endif /* AlphaArchitecture */ #ifdef HPArchitecture # define OptimizedCDebugFlags -O2 GccAliasingArgs # define LinuxMachineDefines -D__hppa__ # define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* HPArchitecture */ #ifdef Arm32Architecture # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags -O3 # endif # define LinuxMachineDefines -D__arm__ -D__arm32__ -U__arm -Uarm # define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* Arm32Achitecture */ #ifdef Arm64Architecture # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags -O3 # endif # define LinuxMachineDefines -D__aarch64__ -U__arm -Uarm # define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* Arm64Achitecture */ #ifdef i386Architecture # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags DefaultGcc2i386Opt # endif # define LinuxMachineDefines -D__i386__ # define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* i386Architecture */ #ifdef ia64Architecture # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags -O2 GccAliasingArgs # endif # define LinuxMachineDefines -D__ia64__ # define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* ia64Architecture */ #ifdef Mc68020Architecture # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags -O2 GccAliasingArgs # endif # define LinuxMachineDefines -D__mc68000__ # define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* Mc68020Architecture */ #if defined(MipsArchitecture) && !defined(MipselArchitecture) # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags DefaultGcc2MipsOpt # endif # define LinuxMachineDefines -D__mips__ # define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif #ifdef MipselArchitecture # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags DefaultGcc2MipsOpt # endif # define LinuxMachineDefines -D__MIPSEL__ # define ServerOSDefines XFree86ServerOSDefines # ifdef Mips64elArchitecture # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 # else # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines # endif #endif #if defined (Ppc64Architecture) || defined (Ppc64LeArchitecture) # define DefaultCCOptions -std=c99 GccWarningOptions -mminimal-toc # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags DefaultGcc2Ppc64Opt # endif # define LinuxMachineDefines -D__powerpc64__ -D__powerpc__ # define ServerOSDefines XFree86ServerOSDefines -DPART_NET # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* Ppc64Architecture */ #ifdef PpcArchitecture # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags DefaultGcc2PpcOpt # endif # define LinuxMachineDefines -D__powerpc__ # define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* PpcArchitecture */ #ifdef s390Architecture # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags -O2 -fomit-frame-pointer GccAliasingArgs # endif # define LinuxMachineDefines -D__s390__ # define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* s390Architecture */ #ifdef s390xArchitecture /*#define DefaultCCOptions -fsigned-char */ #define OptimizedCDebugFlags -O3 -fomit-frame-pointer #define LinuxMachineDefines -D__s390x__ #define ServerOSDefines XFree86ServerOSDefines #define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* s390xArchitecture */ #ifdef SparcArchitecture # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags -O2 GccAliasingArgs # endif # define LinuxMachineDefines -D__sparc__ # define ServerOSDefines XFree86ServerOSDefines # define AsVISOption -Av9a # ifdef Sparc64Architecture # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 # else # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines # endif #endif #ifdef SuperHArchitecture # ifndef SuperHArchOptFlags # ifdef SuperH4Architecture # define SuperHArchOptFlags -m4 # elif defined(SuperH4NOFPUArchitecture) # define SuperHArchOptFlags -m4-nofpu # else # define SuperHArchOptFlags -m3 # endif # endif # ifndef SuperHebArchitecture # ifdef SuperHebArchitecture # define SuperHEndianFlags -mb # else # define SuperHEndianFlags -ml # endif # endif # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags -O2 SuperHArchOptFlags SuperHEndianFlags GccAliasingArgs # endif # define LinuxMachineDefines -D__sh__ # define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif #ifdef AMD64Architecture # ifndef OptimizedCDebugFlags # define OptimizedCDebugFlags DefaultGcc2AMD64Opt # endif # define LinuxMachineDefines -D__amd64__ # define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* AMD64Architecture */ #ifndef StandardDefines # ifdef __linux__ # define StandardDefines -Dlinux LinuxMachineDefines LinuxSourceDefines # else # define StandardDefines LinuxMachineDefines LinuxSourceDefines # endif #endif #if UseElfFormat # define DlLibrary -rdynamic -ldl #else # define DlLibrary /**/ #endif #define ServerExtraSysLibs /**/ #ifndef PamLibraries #define PamLibraries -lpam DlLibrary #endif #ifndef PamMiscLibraries #define PamMiscLibraries -lpam_misc #endif #define ConnectionFlags -DUNIXCONN -DTCPCONN /* Some of these man page defaults are overridden in the above OS sections */ #ifndef ManSuffix # define ManSuffix 1x #endif #ifndef ManDir # define ManDir $(MANSOURCEPATH)1 #endif #ifndef LibManSuffix # define LibManSuffix 3x #endif #ifndef LibmanDir # define LibmanDir $(MANSOURCEPATH)3 #endif #ifndef FileManSuffix # define FileManSuffix 5x #endif #ifndef FileManDir # define FileManDir $(MANSOURCEPATH)5 #endif #ifndef StaticLibrary # define StaticLibrary(libpath,libname) -Wl,-Bstatic Concat(-L,libpath) Concat(-l,libname) -Wl,-Bdynamic #endif #define HasGnuMake YES #define MakeNamedTargetSubdir(dir,flags,subname)\ $(MAKE) -C dir $(MFLAGS) $(PARALLELMFLAGS) flags subname #define ArchitectureDefines -DLINUX_ARCHITECTURE #define TtClientLibs $(TTLIB) $(XTOOLLIB) $(XLIB) #define TtClientDepLibs $(DEPTTLIB) $(DEPXTOOLLIB) $(DEPXLIB) #if HaveLib64 # ifndef LibDirName # define LibDirName lib # endif # ifndef SystemUsrLibDir # define SystemUsrLibDir /usr/lib64 # endif # ifndef TkLibDir # define TkLibDir /usr/lib64 # endif #endif #include # include #ifndef XFree86ServerOSDefines # define XFree86ServerOSDefines #endif nx-libs-3.5.99.23/nx-X11/config/cf/lnxLib.rules0000644000000000000000000005260213614532331015451 0ustar /* * Linux shared library rules (DLL & ELF versions) */ #ifndef HasSharedLibraries # define HasSharedLibraries YES #endif #ifndef ForceNormalLib # define ForceNormalLib NO #endif #ifndef UseRpath #define UseRpath YES #endif #if UseElfFormat # if LinuxCLibMajorVersion <= 5 /* * #define BaseShLibReqs -lc * * I don't want to use this since the normal ELF executables should * be linked with libc.so. If it is not, i.e., static, the variables in * libc.so which is loaded in because of the other shared libraries * may have different values than the ones in the static ELF * executables. That happens if the binaries are linked with libg.a * or libc_p.a. * * If an ELF executable linked with libg.a or libc_p.a loads a shared * object which needs libc.so via dlopen (), I think it should fail. * It is a very bad idea. The moral story is DON'T USE dlopen () IN * ELF EXECUTABLES LINKED WITH libg.a OR libc_p.a. H.J. * */ # define BaseShLibReqs # else /* With GNU libc 2 this works fine. */ # define BaseShLibReqs -lc # endif # ifndef SharedDataSeparation # define SharedDataSeparation NO # endif # ifndef SharedCodeDef # define SharedCodeDef /**/ # endif # ifndef SharedLibraryDef # define SharedLibraryDef /**/ # endif # ifndef ShLibIncludeFile # define ShLibIncludeFile # endif #ifndef RpathLoadFlags #if UseRpath #define RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath,\$$ORIGIN/$(BUILDLIBDIR):\$$ORIGIN/../../../nxcomp/src/.libs:\$$ORIGIN/../../../nxcompshad/src/.libs #else #define RpathLoadFlags /**/ #endif #endif #ifndef RpathInstallLoadFlags #if UseRpath #define RpathInstallLoadFlags -Wl,--enable-new-dtags -Wl,-rpath,$(USRLIBDIRPATH) #else #define RpathInstallLoadFlags /**/ #endif #endif #ifndef LibraryRpathLoadFlags #define LibraryRpathLoadFlags RpathLoadFlags #endif # ifndef SharedLibraryLoadFlags # define SharedLibraryLoadFlags -shared # endif # ifndef PositionIndependentCFlags # define PositionIndependentCFlags -fPIC # endif # ifndef PositionIndependentCplusplusFlags # define PositionIndependentCplusplusFlags -fPIC # endif # ifndef ExtraLoadFlags # if LinuxBinUtilsMajorVersion >= 26 # ifdef UseInstalled # if LinuxBinUtilsMajorVersion < 27 # define ExtraLoadFlags RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link,$(USRLIBDIRPATH) # endif # else # define ExtraLoadFlags RpathLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link,\$$ORIGIN/$(BUILDLIBDIR):\$$ORIGIN/../../../nxcomp/src/.libs:\$$ORIGIN/../../../nxcompshad/src/.libs # endif # else # define ExtraLoadFlags RpathLoadFlags # endif # endif # ifndef ExtraInstallLoadFlags # if LinuxBinUtilsMajorVersion >= 26 # ifdef UseInstalled # if LinuxBinUtilsMajorVersion < 27 # define ExtraInstallLoadFlags RpathInstallLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link,$(USRLIBDIRPATH) # endif # else # define ExtraInstallLoadFlags RpathInstallLoadFlags -Wl,--enable-new-dtags -Wl,-rpath-link,\$$ORIGIN/$(BUILDLIBDIR):\$$ORIGIN/../../../nxcomp/src/.libs:\$$ORIGIN/../../../nxcompshad/src/.libs # endif # else # define ExtraInstallLoadFlags RpathInstallLoadFlags # endif # endif # ifndef HardCodeLibdirFlag # define HardCodeLibdirFlag RpathLoadFlags # endif # if !defined(ShlibGlobalsFlags) # define ShlibGlobalsFlags -Wl,-Bsymbolic # endif /* * InstallSharedLibrary - generate rules to install the shared library. * NOTE: file must be executable, hence "INSTBINFLAGS" */ # ifndef InstallSharedLibrary # define InstallSharedLibrary(libname,rev,dest) @@\ install:: Concat(lib,libname.so.rev) @@\ MakeDir($(DESTDIR)dest) @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\ @T=`echo Concat($(DESTDIR)dest/lib,libname.so.rev) | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`;\ set -x; $(RM) $$T && $(LN) Concat(lib,libname.so.rev) $$T @@\ @if $(SOSYMLINK); then (set -x; \ $(RM) Concat($(DESTDIR)dest/lib,libname.so); \ @@\ $(LN) Concat(lib,libname.so.rev) Concat($(DESTDIR)dest/lib,libname.so)); fi # endif /* InstallSharedLibrary */ # ifndef InstallSharedLibtoolLibrary # define SetRevisions(rev) V=`expr rev : '\([^:]*\)'`; \ @@\ R=`expr rev : '.*:\([^:]*\):'`; \ @@\ A=`expr rev : '.*:\([^:]*\)'`; \ @@\ MAJ=`expr $$V - $$A`; \ @@\ MIN=$$A.$$R # define InstallSharedLibtoolLibrary(libname,rev,dest) @@\ install:: Concat(lib,libname.so) @@\ MakeDir($(DESTDIR)dest) @@\ @set +e; SetRevisions(rev); \ @@\ set -xe; \ @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat(lib,libname.so.$$MAJ.$$MIN) $(DESTDIR)dest; \ @@\ $(RM) Concat($(DESTDIR)dest/lib,libname.so.$$MAJ); \ @@\ $(LN) Concat(lib,libname.so.$$MAJ.$$MIN) Concat($(DESTDIR)dest/lib,libname.so.$$MAJ); \ @@\ $(RM) Concat($(DESTDIR)dest/lib,libname.so); \ @@\ $(LN) Concat(lib,libname.so.$$MAJ.$$MIN) Concat($(DESTDIR)dest/lib,libname.so) # endif /* InstallSharedLibrary */ /* * InstallSharedLibraryData - generate rules to install the shared library data */ # ifndef InstallSharedLibraryData # define InstallSharedLibraryData(libname,rev,dest) # endif /* InstallSharedLibraryData */ /* * SharedLibraryTarget - generate rules to create a shared library; * build it into a different name so that we do not hose people by having * the library gone for long periods. */ # ifndef SharedLibraryTarget # define SharedLibraryTarget(libname,rev,solist,down,up) @@\ AllTarget(Concat(lib,libname.so.rev)) @@\ @@\ Concat(lib,libname.so.rev): solist $(EXTRALIBRARYDEPS) @@\ $(RM) $@~ @@\ @SONAME=`echo $@ | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; (set -x; \ @@\ cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs) || exit 1; \ @@\ (set -x; $(RM) $$SONAME; $(LN) $@ $$SONAME); \ @@\ LinkBuildSonameLibrary($$SONAME) @@\ $(RM) $@ @@\ $(MV) $@~ $@ @@\ @if $(SOSYMLINK); then (set -x; \ @@\ $(RM) Concat(lib,libname.so); \ @@\ $(LN) $@ Concat(lib,libname.so)); fi @@\ LinkBuildLibrary($@) @@\ LinkBuildLibraryMaybe(Concat(lib,libname.so),$(SOSYMLINK)) @@\ @@\ clean:: @@\ @MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \ @@\ set -x; $(RM) Concat(lib,libname.so.$$MAJREV) @@\ $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so) # endif /* SharedLibraryTarget */ # ifndef SharedLibtoolLibraryTarget # define SharedLibtoolLibraryTarget(libname,rev,solist,down,up) @@\ AllTarget(Concat(lib,libname.so)) @@\ @@\ Concat(lib,libname.so): solist $(EXTRALIBRARYDEPS) @@\ $(RM) $@~ @@\ @set +e; SetRevisions(rev); set -e; \ @@\ SONAME=$@.$$MAJ; \ @@\ (set -x; \ @@\ $(RM) $@.$$MAJ.$$MIN~; \ @@\ cd down; $(CC) -o up/$@.$$MAJ.$$MIN~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs) || exit 1; \ @@\ (set -x; \ @@\ $(RM) $$SONAME; $(LN) $@.$$MAJ.$$MIN $$SONAME); \ @@\ LinkBuildSonameLibrary($$SONAME); \ @@\ (set -x; \ @@\ $(RM) $@.$$MAJ.$$MIN; \ @@\ $(MV) $@.$$MAJ.$$MIN~ $@.$$MAJ.$$MIN; \ @@\ $(RM) $@; \ @@\ $(LN) $@.$$MAJ.$$MIN $@); \ @@\ LinkBuildLibraryInline($@.$$MAJ.$$MIN); \ @@\ LinkBuildLibraryInline($@) @@\ @@\ clean:: @@\ @set +e; SetRevisions(rev); \ @@\ set -xe; \ @@\ $(RM) Concat(lib,libname.so.$$MAJ); \ @@\ $(RM) Concat(lib,libname.so.$$MAJ.$$MIN) @@\ $(RM) Concat(lib,libname.so) # endif /* SharedLibtoolLibraryTarget */ /* * SharedDepLibraryTarget - generate rules to create a shared library. */ # ifndef SharedDepLibraryTarget # define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up) @@\ AllTarget(Concat(lib,libname.so.rev)) @@\ @@\ Concat(lib,libname.so.rev): deplist $(EXTRALIBRARYDEPS) @@\ $(RM) $@~ @@\ @SONAME=`echo $@ | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; set -x; \ @@\ (cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs); \ @@\ $(RM) $$SONAME; $(LN) $@ $$SONAME; \ @@\ LinkBuildSonameLibrary($$SONAME) @@\ $(RM) $@ @@\ $(MV) $@~ $@ @@\ @if $(SOSYMLINK); then (set -x; \ @@\ $(RM) Concat(lib,libname.so); \ @@\ $(LN) $@ Concat(lib,libname.so)); fi @@\ LinkBuildLibrary($@) @@\ LinkBuildLibraryMaybe(Concat(lib,libname.so),$(SOSYMLINK)) @@\ @@\ clean:: @@\ @MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \ @@\ set -x; $(RM) Concat(lib,libname.so.$$MAJREV) @@\ $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so) #endif /* SharedDepLibraryTarget */ /* * SharedDepCplusplusLibraryTarget - generate rules to create a shared library. */ #ifndef SharedDepCplusplusLibraryTarget #define SharedDepCplusplusLibraryTarget(libname,rev,deplist,solist,down,up) @@\ AllTarget(Concat(lib,libname.so.rev)) @@\ @@\ Concat(lib,libname.so.rev): deplist $(EXTRALIBRARYDEPS) @@\ $(RM) $@~ @@\ @SONAME=`echo $@ | sed 's/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; set -x; \ @@\ (cd down; $(CXX) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs); \ @@\ $(RM) $$SONAME; $(LN) $@ $$SONAME; \ @@\ LinkBuildSonameLibrary($$SONAME) @@\ $(RM) $@ @@\ $(MV) $@~ $@ @@\ @if $(SOSYMLINK); then (set -x; \ @@\ $(RM) Concat(lib,libname.so); \ @@\ $(LN) $@ Concat(lib,libname.so)); fi @@\ LinkBuildLibrary($@) @@\ LinkBuildLibraryMaybe(Concat(lib,libname.so),$(SOSYMLINK)) @@\ @@\ clean:: @@\ @MAJREV=`echo rev | sed 's/\([0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/'`; \ @@\ set -x; $(RM) Concat(lib,libname.so.$$MAJREV) @@\ $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so) #endif /* SharedDepCplusplusLibraryTarget */ # ifndef SharedDepModuleTarget # define SharedDepModuleTarget(name,deps,solist) @@\ AllTarget(name) @@\ @@\ name: deps @@\ $(RM) $@~ @@\ $(CC) -o $@~ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) BaseShLibReqs @@\ $(RM) $@ @@\ $(MV) $@~ $@ @@\ @@\ clean:: @@\ $(RM) name # endif /* SharedDepModuleTarget */ # ifndef SharedDriModuleTarget # define SharedDriModuleTarget(name,deps,solist) @@\ AllTarget(name) @@\ @@\ name: deps @@\ $(RM) $@~ $@.map @@\ @(echo 'DRI_MODULE { global: __dri*; local: *; };' > $@.map) @@\ $(CC) -o $@~ -Wl,--version-script=$@.map $(SHLIBLDFLAGS) solist $(REQUIREDLIBS) BaseShLibReqs @@\ $(RM) $@ $@.map @@\ $(MV) $@~ $@ @@\ @@\ clean:: @@\ $(RM) name @@\ $(RM) name.map # endif /* SharedDriModuleTarget */ /* * SharedLibraryDataTarget - generate rules to create shlib data file; */ # ifndef SharedLibraryDataTarget # define SharedLibraryDataTarget(libname,rev,salist) # endif /* SharedLibraryTarget */ #else /* UseElfFormat */ # ifndef SharedDataSeparation # define SharedDataSeparation NO # endif # ifndef SharedCodeDef # define SharedCodeDef /**/ # endif # ifndef SharedLibraryDef # define SharedLibraryDef /**/ # endif # ifndef ShLibIncludeFile # define ShLibIncludeFile # endif # ifndef SharedLibraryLoadFlags # define SharedLibraryLoadFlags /**/ # endif # ifndef PositionIndependentCFlags # define PositionIndependentCFlags -B/usr/bin/jump # endif /* * These definitions are now extended to work with the X sources and * external sources wishing to build shared libs. * * A library can create it's own shlibs (.so) or can be incorporated into * another "host" lib. All libraries generate stub (.sa) files. * A "host" lib does all the work to generate the stubs for itself and its * "guests", invoking the "guest" Makefiles to create the objects for * inclusion into the "host" shlib. A "guest" lib will ask the "host" to * create the stubfiles, then copy its own into its directory. * Most external libs are "host" libs; the concept of "guest" is a holdover * from older libs during the days of scarce shared library address space. * * To create a simple "host" shared lib, Xfoo, define: * * JUMP_ROOT_Xfoo = * JUMP_IS_HOST_Xfoo = YES * JUMP_STUBLIBS_Xfoo = libXfoo.sa * JUMP_DIR_Xfoo = $(JUMP_ROOT_Xfoo)/shared * JUMP_DEFS_Xfoo = -DFOO * JUMP_VARS_Xfoo = $(JUMP_ROOT_Xfoo)/jump_vars * JUMP_FUNCS_Xfoo = $(JUMP_ROOT_Xfoo)/jump_funcs * JUMP_IGNORE_Xfoo = $(JUMP_ROOT_Xfoo)/jump_ignore * JUMP_EXPORT_Xfoo = $(JUMP_DIR_Xfoo)/jump.vars * JUMP_IMPORT_Xfoo = $(JUMP_EXPORT_Xbar) * JUMP_ADDRESS_Xfoo = 0xXXXXXXXX * JUMP_JUMPTABLESIZE_Xfoo = 0x4000 * JUMP_GOTSIZE_Xfoo = 4096 * JUMP_STUBNAMES_Xfoo = libXfoo * JUMP_STUBS_IMPORT_Xfoo = /usr/lib/libc.sa * JUMP_LDLIBS_Xfoo = `$(CC) --print-libgcc-file-name` -lc * * To create a complex "host", you need to add * JUMP_SIBARS_Xt = jump/libXbar.a~ * These are the archives of the shared objects of the "guest" libs. They * need to be added to the JUMP_LDLIBS_Xfoo lines. * * For further clarification, study the definitions of libXaw, a simple "host" * lib, libXt, a complex "host" lib, and libXmu, one of libXts "guests". * * As a hint of how to start (with the DLL docs), touch jump_vars, jump_funcs * and jump_ignore, then compile. Then massage the jump.vars and jump.funcs * files in the shared subdirectory into jump_xxx files. */ # ifndef UseInstalled XCOMM These are only needed to build the server # if LinuxElfDefault LIBC_SA = /usr/i486-linuxaout/lib/libc.sa LIBM_SA = /usr/i486-linuxaout/lib/libm.sa # else LIBC_SA = /usr/lib/libc.sa LIBM_SA = /usr/lib/libm.sa # endif JUMP_LDLIBS_libc = `$(CC) --print-libgcc-file-name` -lc XCOMM libX11.so (X11, SM, ICE) JUMP_ROOT_X11 = $(XLIBSRC) JUMP_IS_HOST_X11 = YES JUMP_STUBLIBS_X11 = libNX_X11.sa libNX_SM.sa libNX_ICE.sa JUMP_SIBDIRS_X11 = $(JUMP_ROOT_SM) $(JUMP_ROOT_ICE) JUMP_DIR_X11 = $(JUMP_ROOT_X11)/shared JUMP_DEFS_X11 = $(XDMAUTHDEFS) $(XKB_DEFINES) JUMP_VARS_X11 = $(JUMP_ROOT_X11)/jump_vars JUMP_FUNCS_X11 = $(JUMP_ROOT_X11)/jump_funcs JUMP_IGNORE_X11 = $(JUMP_ROOT_X11)/jump_ignore JUMP_EXPORT_X11 = $(JUMP_DIR_X11)/jump.vars JUMP_ADDRESS_X11 = 0x60200000 JUMP_JUMPTABLESIZE_X11 = 0x4000 JUMP_GOTSIZE_X11 = 4096 JUMP_STUBNAMES_X11 = libNX_X11 libNX_SM libNX_ICE JUMP_STUBS_IMPORT_X11 = $(LIBC_SA) JUMP_SIBARS_X11 = jump/libNX_SM.a~ jump/libNX_ICE.a~ JUMP_LDLIBS_X11 = $(JUMP_SIBARS_X11) $(JUMP_LDLIBS_libc) XCOMM libXext (part of libXt.so) JUMP_ROOT_Xext = $(XEXTLIBSRC) JUMP_IS_HOST_Xext = NO JUMP_HOST_Xext = $(JUMP_ROOT_Xt) JUMP_DIR_Xext = $(JUMP_DIR_Xt) XCOMM libXtst (part of libXt.so) JUMP_ROOT_Xtst = $(XTESTLIBSRC) JUMP_IS_HOST_Xtst = NO JUMP_HOST_Xtst = $(JUMP_ROOT_Xt) JUMP_DIR_Xtst = $(JUMP_DIR_Xt) # endif /* !UseInstalled */ /* * SharedLibraryDataTarget - generate rules to create shared data file */ # ifndef SharedLibraryDataTarget # define SharedLibraryDataTarget(libname,rev,salist) # endif /* * SharedLibraryTarget - generate rules to create a shared library; * There are two basic flavors of libs: self-generating, which create * their own (and possibly other) libs, and hosted, which rely on another * lib for all the work. */ # ifndef SharedLibraryTarget # define SharedLibraryTarget(libname,rev,solist,down,up) @@\ XCOMM This logic is such to compile the libs in their proper order, @@\ XCOMM remain dependent on subsidiary libs, and yet minimize local work @@\ @@\ JUMP_DIR=./jump @@\ JUMP_LIB=Concat(lib,libname) @@\ @@\ XCOMM this is needed for newer gnumake versions @@\ export JUMP_DIR JUMP_LIB @@\ @@\ JUMP_IS_HOST=$(Concat(JUMP_IS_HOST_,libname)) @@\ JUMP_AR=$(JUMP_DIR)/Concat(lib,libname.a~) @@\ JUMP_SA=Concat(lib,libname.sa) @@\ JUMP_SO=Concat(lib,libname.so.rev) @@\ @@\ JUMP_HOST=$(Concat(JUMP_HOST_,libname)) @@\ @@\ INSTSOLIBFLAGS=-m 0555 @@\ @@\ AllTarget($(BUILDLIBDIR)/$(JUMP_SA)) @@\ @@\ $(BUILDLIBDIR)/$(JUMP_SA): $(JUMP_SA) @@\ LinkBuildLibrary($(JUMP_SA)) @@\ @@\ $(JUMP_SA) $(Concat(JUMP_STUBLIBS_,libname)) do_JUMP_SA: \ down/mk_JUMP_SA_$(JUMP_IS_HOST) @@\ @@\ down/mk_JUMP_SA_0:: mk_JUMP_HOST @@\ @@\ down/mk_JUMP_SA_0:: $(JUMP_HOST)/$(JUMP_SA) @@\ $(RM) $(JUMP_SA) @@\ $(LN) $(JUMP_HOST)/$(JUMP_SA) $(JUMP_SA) @@\ touch $@ @@\ @@\ down/mk_JUMP_SA_1:: $(JUMP_SO) @@\ @@\ down/mk_JUMP_SA_1:: down/mk_JUMP_SO_2 @@\ $(RM) $(Concat(JUMP_STUBLIBS_,libname)) @@\ mkstubs -v rev -l $(JUMP_LIB) \ -a $(Concat(JUMP_ADDRESS_,libname)) \ -j $(Concat(JUMP_JUMPTABLESIZE_,libname)) \ -g $(Concat(JUMP_GOTSIZE_,libname)) \ -- $(Concat(JUMP_STUBNAMES_,libname)) @@\ verify-shlib -l $(JUMP_SO) \ $(Concat(JUMP_STUBLIBS_,libname)) @@\ $(MV) verify.out $(JUMP_DIR) @@\ touch $@ @@\ @@\ mk_JUMP_HOST: @@\ @echo checking stub library $(JUMP_SA) in $(JUMP_HOST)... @@\ @(cd $(JUMP_HOST); $(MAKE) $(MFLAGS) $(JUMP_SA)) || exit 1 @@\ @echo ok. continuing in $(Concat(JUMP_ROOT_,libname))... @@\ @@\ $(JUMP_SO): down/mk_JUMP_SO_$(JUMP_IS_HOST) @@\ @@\ down/mk_JUMP_SO_0: @@\ @@\ down/mk_JUMP_SO_1:: $(JUMP_AR) mk_JUMP_SIBDIRS down/mk_JUMP_SO_2 @@\ @@\ down/mk_JUMP_SO_2: down/mk_JUMP_AR $(Concat(JUMP_SIBARS_,libname)) @@\ $(RM) $(JUMP_SO) @@\ mkimage -f -v rev -l $(JUMP_LIB) \ -a $(Concat(JUMP_ADDRESS_,libname)) \ -j $(Concat(JUMP_JUMPTABLESIZE_,libname)) \ -g $(Concat(JUMP_GOTSIZE_,libname)) \ -- $(JUMP_AR) $(Concat(JUMP_LDLIBS_,libname)) @@\ $(RM) $(JUMP_DIR)/__jump.s $(JUMP_DIR)/__jump.o @@\ LinkBuildLibrary($(JUMP_SO)) @@\ touch $@ @@\ @@\ mk_JUMP_SIBDIRS: @@\ @for d in $(Concat(JUMP_SIBDIRS_,libname)); do \ echo checking ar library in $$d...; \ (cd $$d ; $(MAKE) $(MFLAGS) fastdo_JUMP_AR) || exit 1; \ echo ok. continuing in $(Concat(JUMP_ROOT_,libname))...;done@@\ @@\ fastdo_JUMP_AR: $(JUMP_DIR) down/mk_JUMP_AR @@\ @@\ $(JUMP_AR) do_JUMP_AR:: jumpsetup down/mk_JUMP_AR @@\ @@\ jumpsetup: $(JUMP_DIR) jumpsetup_$(JUMP_IS_HOST) @@\ @@\ $(JUMP_DIR): @@\ $(RM) jump @@\ LibMkdir($(Concat(JUMP_DIR_,libname))) @@\ $(LN) $(Concat(JUMP_DIR_,libname)) jump @@\ @@\ jumpsetup_0: @@\ @echo doing jump setup in host $(JUMP_HOST)... @@\ @(cd $(JUMP_HOST); $(MAKE) $(MFLAGS) jumpsetup) || exit 1 @@\ @echo ok. continuing in $(Concat(JUMP_ROOT_,libname))... @@\ @@\ jumpsetup_1:: @@\ @for d in $(Concat(JUMP_SUBDIRS_,libname)); do \ echo checking stub library in $$d...; \ (cd $$d ; $(MAKE) $(MFLAGS) do_JUMP_SA) || exit 1; \ echo ok. continuing in $(Concat(JUMP_ROOT_,libname))...;done@@\ @@\ jumpsetup_1:: $(JUMP_DIR)/jump.funcs $(JUMP_DIR)/jump.vars \ $(JUMP_DIR)/jump.ignore $(JUMP_DIR)/jump.import @@\ @@\ $(JUMP_DIR)/jump.funcs: $(Concat(JUMP_FUNCS_,libname)) @@\ $(RM) $(JUMP_DIR)/jump.funcs @@\ cat $(Concat(JUMP_FUNCS_,libname)) | \ $(CPP) $(ALLDEFINES) $(Concat(JUMP_DEFS_,libname)) > $@ @@\ @@\ $(JUMP_DIR)/jump.vars: $(Concat(JUMP_VARS_,libname)) @@\ $(RM) $(JUMP_DIR)/jump.vars @@\ cat $(Concat(JUMP_VARS_,libname)) | \ $(CPP) $(ALLDEFINES) $(Concat(JUMP_DEFS_,libname)) > $@ @@\ @@\ $(JUMP_DIR)/jump.ignore: $(Concat(JUMP_IGNORE_,libname)) @@\ $(RM) $(JUMP_DIR)/jump.ignore @@\ cat $(Concat(JUMP_IGNORE_,libname)) | \ $(CPP) $(ALLDEFINES) $(Concat(JUMP_DEFS_,libname)) > $@ @@\ @@\ $(JUMP_DIR)/jump.import: $(JUMP_DIR)/stubs.import \ $(Concat(JUMP_IMPORT_,libname)) @@\ $(RM) $(JUMP_DIR)/jump.import @@\ cat $(JUMP_DIR)/stubs.import $(Concat(JUMP_IMPORT_,libname)) > $@ @@\ @@\ $(JUMP_DIR)/stubs.import: $(Concat(JUMP_STUBS_IMPORT_,libname)) @@\ $(RM) $(JUMP_DIR)/stubs.import @@\ nm --no-cplus $(Concat(JUMP_STUBS_IMPORT_,libname)) | grep '__GOT__' | \ sed 's/__GOT__/_/' > $@ @@\ @@\ down/mk_JUMP_AR: solist @@\ $(RM) $(JUMP_AR) @@\ @if [ -s $(JUMP_DIR)/jump.log ]; then \ echo "Error: Leftover globals for shared lib"; \ exit 1; fi @@\ (cd down; $(AR) up/$(JUMP_AR) solist) || exit 1 @@\ $(RANLIB) $(JUMP_AR) @@\ touch $@ @@\ @@\ clean:: jumpclean @@\ @@\ jumpclean: jumpclean_$(JUMP_IS_HOST) @@\ $(RM) $(JUMP_SA) down/mk_JUMP_AR @@\ $(RM) -r $(JUMP_DIR) @@\ @@\ jumpclean_0: @@\ $(RM) down/mk_JUMP_SA_0 @@\ $(RM) $(JUMP_HOST)/$(JUMP_SA) @@\ @@\ jumpclean_1: @@\ $(RM) -r $(JUMP_SO) $(Concat(JUMP_DIR_,libname)) \ @@\ down/mk_JUMP_SA_1 down/mk_JUMP_SO_1 down/mk_JUMP_SO_2 # endif /* SharedLibraryTarget */ /* * InstallSharedLibrary - generate rules to install the shared library. */ # ifndef InstallSharedLibrary # define InstallSharedLibrary(libname,rev,dest) @@\ install:: $(JUMP_SA) $(JUMP_SO) @@\ MakeDir($(DESTDIR)dest) @@\ @if [ "$(JUMP_IS_HOST)" = YES ]; then \ (T=$(DESTDIR)dest/`echo $(JUMP_SO)|sed '/\(lib[^\.]*\.so\.[0-9]*\)\(\.[0-9]*\)\{1,2\}/\1/`;\ set -x; \ $(INSTALL) -s -c $(INSTSOLIBFLAGS) $(JUMP_SO) $(DESTDIR)dest; \ $(RM) $$T && $(LN) $(JUMP_SO) $$T); fi @@\ $(INSTALL) -c $(INSTLIBFLAGS) $(JUMP_SA) $(DESTDIR)dest # endif /* InstallSharedLibrary */ /* * InstallSharedLibraryData - generate rules to install the shared library data */ # ifndef InstallSharedLibraryData # define InstallSharedLibraryData(libname,rev,dest) # endif /* InstallSharedLibraryData */ #endif /* UseElfFormat */ nx-libs-3.5.99.23/nx-X11/config/cf/lnxLib.tmpl0000644000000000000000000000016613614532331015271 0ustar /* * Linux shared library template */ #define SharedX11Reqs $(LDPRELIB) -ldl -lXdmcp #define NoMessageCatalog nx-libs-3.5.99.23/nx-X11/config/cf/noop.rules0000644000000000000000000000000113614532331015156 0ustar nx-libs-3.5.99.23/nx-X11/config/cf/nxcompile.def0000644000000000000000000000163313614532331015621 0ustar /* Rules to have a much cleaner compilation output derived from Imake.rules */ #define RemoveFileQuiet(file) @$(RM) -f file \&>/dev/null #define RunPrintIfFailed(cmd) @cmd || { echo failed command: cmd; exit 1; } #define ObjectCompile(options) RemoveFileQuiet($@) @@\ ClearmakeOSName \ @echo \ \ CC $*.c @@\ RunPrintIfFailed($(CC) -c $(CFLAGS) options $*.c) #define NormalLibraryTarget(libname,objlist) @@\ AllTarget(LibraryTargetName(libname)) @@\ @@\ LibraryTargetName(libname): objlist $(EXTRALIBRARYDEPS) @@\ @echo \ \ CCLD $@ @@\ RemoveFileQuiet($@) @@\ RunPrintIfFailed(MakeLibrary($@,objlist)) @@\ RunPrintIfFailed(RanLibrary($@)) @@\ RunPrintIfFailed(_LinkBuildLibrary($@)) #define DependTarget() @@\ DependDependency() @@\ @@\ depend:: @@\ RunPrintIfFailed($(DEPEND) $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS)) nx-libs-3.5.99.23/nx-X11/config/cf/nxversion.def.in0000644000000000000000000000030013614532331016251 0ustar #define NX_VERSION_MAJOR ###NX_VERSION_MAJOR### #define NX_VERSION_MINOR ###NX_VERSION_MINOR### #define NX_VERSION_MICRO ###NX_VERSION_MICRO### #define NX_VERSION_PATCH ###NX_VERSION_PATCH### nx-libs-3.5.99.23/nx-X11/config/cf/README0000644000000000000000000005576613614532331014043 0ustar The easiest way to write an Imakefile is to find another one that does something similar and copy/modify it! To change any of these variables, edit the site.def file. Imake.tmpl provides defaults for the following variables: AlternateIncRoot compiler needs -I to find project includes AlternateUsrLibDir linker needs -L to find project libraries ArCmd command used to create libraries ArCmdBase program name part of ArCmd ArAddCmd flags to have ArCmdBase add files to a library ArExtCmd flags to have ArCmdBase extract files AsCmd command used to run assembler BootstrapCFlags missing cpp symbols needed to get started BourneShell command used to run Bourne Shell CCsuf suffix that C++ source files have CURDIR current directory relative to top of sources CcCmd command to run C compiler CompressCmd command to run compress program ConstructMFLAGS System V option to set MFLAGS make variable CpCmd command to copy one file to another CplusplusCmd command to run C++ compiler CplusplusFilt command to run C++ name demangler CplusplusYaccCmd command to produce C++ source from yacc source CppCmd command to run C preprocessor CrossCompiling cross compiling? (not fully supported) DebuggableCDebugFlags C compiler -I's and -D's to turn on debug info DefaultCCOptions default special C compiler options DefaultCDebugFlags debug/optimize flags for programs DefaultUsrBin program directory used even if PATH not set DependFlags extra makedepend flags DoRanlibCmd boolean for system uses ranlib EqnCmd command used for eqn ExecableScripts boolean for systems that can exec() #!/bin/sh ExpandManNames boolean to expand man pages names to long form ExtraFilesToClean extra files to remove on make clean ExtraLibraries system-specific libraries need to link ExtraLoadFlags system-specific loader flags ExtraInstallLoadFlags system-specific loader flags for later installation FileManSuffix man suffix for file format pages FilesToClean files to delete in make clean FortranCmd command to run Fortran compiler FortranDebugFlags flags for Fortran debug info FortranFlags Fortran compiler flags GzipCmd command to run gzip program HasBSD44Sockets boolean for system has BSD4.4 sockets HasBsdMake use the 4.4BSD variant of the make program? HasBsearch boolean for libc has bsearch() HasBrokenCCForLink boolean for brain damaged cc driver HasCenterLineC boolean for system has CenterLine C compiler HasCenterLineCplusplus boolean for system has CenterLine C++ compiler HasClearmake use Clearcase's clearmake make program? HasCodeCenter boolean for system has CodeCenter HasCookieMaker boolean for system has xauth cookie generator HasCplusplus system has a C++ compiler? HasFortran boolean for system has Fortran compiler HasGcc boolean for system has GNU gcc compiler HasGcc2 boolean for system has GNU gcc 2.x compiler HasGcc2ForCplusplus use gcc 2 for C++ programs? HasGnuMake use the GNU make program? HasGhostPCL boolean for system has GhostPCL HasGhostScript boolean for system has GhostScript HasLargeTmp boolean for system has /tmp space HasLatex system has LaTeX document preparation software HasLibCrypt boolean for system has libcrypt HasMotif boolean for system has Motif HasMotif2 boolean for system has Motif2 or OpenMotif HasPoll use poll() syscall? HasPurify boolean for system has Purify HasPutenv boolean for libc has putenv() HasSecureRPC boolean for Sun Secure RPC HasSetProcTitle boolean for setproctitle() HasSetUserContext boolean for setusercontext() HasSentinel boolean for system has Sentinel available HasSharedLibraries boolean for system has shared libraries HasShm boolean for System V shared memory HasSockets boolean for system has BSD sockets HasStrcasecmp boolean for system implements str[n]casecmp HasSymLinks boolean for system has symbolic links HasTestCenter boolean for system has TestCenter HasVarDirectory boolean for system has /var HasVFork boolean for system has vfork() HasVoidSignalReturn boolean for POSIX signal() procs IncludeSharedObjectInNormalLib define for static libs to include -fPIC objects on relevant archs IncRoot parent of X11 include directory InstBinFlags install flags for binaries InstDatFlags install flags for data files InstIncFlags install flags for header files InstKmemFlags install flags for xload to get at /dev/kmem InstLibFlags install flags for libraries InstManFlags install flags for manual pages InstPgmFlags install flags for normal programs InstUidFlags install flags for xterm to chown /dev/ptys InstallCmd command to install files LdCmd command to run loader LdCombineFlags flags for incremental loading LexCmd command to run lex LexLib library for programs using lex output LintCmd command to run lint LintLibFlag flags to generate lint libraries LintOpts lint options to control strictness LnCmd command to link two files LoaderLibPrefix loader flags before libraries LocalRulesFile site-specific file with additional imake rules LocalTmplFile file with additional imake variables MacroFile name of machine-dependent config params file MacroIncludeFile MakeCmd command to run make Malloc0ReturnsNull boolean for malloc(0) == NULL Malloc0ReturnsNullDefines -D's to build libX11/libXt MathLibrary library for programs using C math functions MkCookieCmd command to generate an xauth cookie MsMacros macro flag for TroffCmd, normally "-ms" MvCmd command to rename a file NeedConstPrototoypes whether const is supported NeedFunctionPrototypes whether or not to force function prototypes NeedNestedPrototypes whether nested prototypes are supported NeedVarargsPrototypes whether varargs prototypes are supported NeedWidePrototypes whether or not to widen function prototypes NoOpCDebugFlags C compiler flags to not debug or optimize NoRConst YES if const for structs of funcs is bad OSMajorVersion major version number of operating system OSMinorVersion minor version number of operating system OSName operating system name OSTeenyVersion maintenance version number of operating system OptimizedCDebugFlags C compiler flags to turn on optimization XtPopdownConformance XtPopdown conformans to the specification PreProcessCmd command to run /lib/cpp on scripts RanlibCmd command to clean up libraries RanlibInstFlags flags to ranlib after copying ResourceConfigurationManagement boolean for Xt's Resource Configuration Management RmCmd command to delete files ShLibDir directory in which to install shared libraries StandardCppDefines -D's for running cpp StandardDefines -D's for running C compiler StandardIncludes -I's for running C compiler StripInstalledPrograms boolean for sites that want to install -s SystemV boolean for systems that are at least SVR2 SystemV4 boolean for SVR4 systems TOPDIR relative path to top of sources TagsCmd command to run tags TblCmd command to run tbl TroffCmd command to run troff to get PostScript UNCOMPRESSPATH command to run uncompress (obsolete) UnalignedReferencesAllowed boolean for unaligned copies ok UsrLibDir directory in which to install libraries YaccCmd command to run yacc UseTIRPC force usage of libtirpc X11.tmpl provides defaults for the following variables: AdmDir directory containing system log files AllocateLocalDefines -D's to turn on alloca() (should be in Imake.tmpl) BDFTOSNFFILT command to run bdftosnf BaseExtensionDefines universal extensions to use BinDir directory in which to install programs BuildDBE build DOUBLE-BUFFER extension BuildDPMS build Display Power Management Signaling extension BuildIncRoot relative path to location of headers in build BuildIncTop path from build includes directory to top BuildPlugin build xrx plug-in for web browsers BuildRECORD Build RECORD extension BuildServer build X server BuildXCSecurity Build Security Extension BuildXInputExt build X Input extension (requires ddx support, which exists only in Xhp and XFree86) BuildXKB build X Keyboard Extension? BuildXKBlib build X Keyboard Extension into Xlib? UseXKBInClients Use XKB functions in normal clients? ConfigDir install directory for config files ConnectionFlags -D's for supported transports ContribDir location of user-contributed sources DebugLibX11 build libX11_d.a DefaultCursorTheme name of default cursor theme DefaultFontPath default server font path DefaultSystemPath default system xdm PATH environment variable DefaultSystemShell default /bin/sh DefaultUserPath default user xdm PATH environment variable DependCmd command to run makedepend DependDir build directory containing makedepend program DriverManDir directory in which to install driver man pages DriverManSuffix man suffix for driver pages ExtensionDefines -D's for universal extensions ExtensionOSDefines -D's for additional extensions ForceNormalLib force building of .a in addition to shared lib HasXdmAuth boolean for using XDM-AUTHORIZATION-1; needs Wraphelp.c, see Release Notes InstallLibManPages boolean for installing library man pages InstallSecurityConfig install server security policy file over old? LibDir directory in which to install X11 support files LibManSuffix man suffix for library pages LibmanDir directory in which to install library man pages LintlibDir directory in which to install lint libs ManDir directory in which to install program man pages ManDirectoryRoot parent of man directories relative to root ManPath full path of parent directory ManSourcePath common prefix of man page directories ManSuffix man suffix for programs MiscManSuffix man suffix for miscellaneous pages MiscManDir directory in which to install misc man pages NeedDefaultDepLibs boolean for enabling default DEPLIBS NlsDir directory in which to install nls files NormalLibX11 build libX11.a OsNameDefines If uname(2) unavailable, set to -DOS_NAME=OSName PrimaryScreenResolution resolution of default server screen ProfileLibX11 build libX11_p.a ProjectX version indicating this is the X Window System RemoveTargetProgramByMoving boolean for rm -f that doesn't SHELLPATH -D for /bin/sh ServerConfigDir directory for server security config files ServerDefines complete -D's for server ServerExtraDefines special -D's for server ServerOSDefines OS -D's for server ServerAssertDefines -DNDEBUG for no assertions, /**/ for assertions SharedLibX11 boolean for making sharable libX11.so ShmDefines MIT-SHM define TwmDir directory in which to install twm config files UseCCMakeDepend boolean for using alternate makedepend script VarDirectory directory in /var for logs, etc., and config VendorHasX11R6_3libXext don't need Security & AppGroup in xrx plug-in XAppLoadDir directory in which to install app defaults XFileSearchPathBase base file search path XFileSearchPathDefault default path to search for app defaults files XInputDefines XINPUT define XMalloc0ReturnsNullDefines -D's specifically for libX11 XdmConfigurationSubdirectory name of default xdm configuration XdmDir directory in which to install xdm files XinitDir directory in which to install xinit files XmanLocalSearchPath non-standard path for man pages XtErrorPrefix leading text in XtError() msg; eg. 'X Toolkit ' XtWarningPrefix leading text in XtWarning()msg, same as above XtMalloc0ReturnsNullDefines -D's specifically for libXt ZBDFTOSNFFILT -D to run uncompress and bdftosnf (obsolete) Library.tmpl provides defaults for the following variables: AvoidNullMakeCommand for makes that spout about $(_NULLCMD_) LibraryCCOptions special C compiler options for libraries LibraryCDebugFlags library debug/optimize flags to override defs LibraryCcCmd command to run C compiler in libraries LibraryCplusplusOptions special C++ options for libraries LibraryCplusplusDebugFlags library debug/optimize flags for C++ LibraryCplusplusCmd command to run C++ compiler in libraries LibraryDefines -D's for libraries SeparateSharedCompile shared and unshared libs use same binaries? Server.tmpl provides defaults for the following variables: ServerCCOptions server C compiler options to override defaults ServerCcCmd command to run C compiler in server ServerCDebugFlags server debug/opt compiler flags ServerDefines server standard -D's InstallServerSetUID does this system need X server suid to root? Threads.tmpl provides defaults for the following variables: LocalThreads whether to enable multi-threading support LocalThreadsDefines -D flags needed in this directory An Lib.rules file provides defaults for the following variables: HasSharedLibraries boolean for using shared libraries SharedDataSeparation boolean indicating separate data/code SharedCodeDef -D's for compiling shared library files SharedLibraryDef -D's for defining which kind of shared lib ShLibIncludeFile location of the Lib.tmpl file SharedLibraryLoadFlags loader flags when making the library UseExportLists boolean for using an export list PositionIndependentCFlags PIC compiler flags for C PositionIndependentCplusplusFlags PIC compiler flags for C++ Note: PositionIndependentCplusplusFlags is only required if the C and C++ compilers use different flags to build PIC code. The default configuration will try to use PositionIndependentCFlags for both C and C++ compiles. An Lib.tmpl file provides defaults for the following variables: SharedX11Reqs required libs for libX11.so SharedX11Rev version number for libX11.so Vendor.cf files and/or site/host specific .def files may define the following variables: ProjectRoot The directory under which the installation will operate. This value will be hard coded into some programs. As a result do not use it to specify the installation directory for a cross compiled system, use DESTDIR to accomplish that task. The following variables are used by some part of the tree: AckToolset programs/Xserver/hw/xfree86 BuildChooser build the xdm chooser program? SharedLibXdmGreet use xdm shared dynamic greeter library? LatexCmd command to run LaTeX on a document DvipsCmd command to turn .dvi file into PostScript MotifBC using Motif 1.1.1, 1.1.2, or 1.1.3? GetValuesBC compat GetValues behavior for broken apps? SvgaConfig default SVGA configuration HasGetReturnAddress util/memleak HasShadowPasswd system has getspnam() function WebServer host:port of your Web server (see programs/xrx) HtmlDir path used by Web server for HTML and RX docs CgiBinDir path used by Web server for CGI programs ProxyManager ICE network ID to contact a running proxymngr Make Variables The following make variables are used by imake rules and may be set in an individual Imakefile. DEFINES program-specific -D flags and other arguments to pass to the C compiler, lint, and makedepend. DEPEND_DEFINES program-specific flags in addition to $(DEFINES) to pass to lint and makedepend. This is usually used when there are special compilation rules for individual files, and the defines passed to those files affect makedepend results. If they can be passed to all files during the makedepend step without affecting the results for other files, DEPEND_DEFINES is used to do that. Example is the Xlib Imakefile. INCLUDES program-specific -I flags. HEADERS .h files to install with "make includes" and "make install". If this Imakefile includes Library.tmpl there are no headers, include this line instead of a HEADERS definition: #define LibHeaders NO REQUIREDLIBS when building a shared library, other libraries used by this library that should be referenced at link time. LINTLIBS program-specific libraries for lint. LOCAL_LDFLAGS program-specific flags for the linker. LOCAL_LIBRARIES project libraries (usually specified as -lname) needed by this program. For example, "-lXt -lXext -lX11". Used by SimpleProgramTarget and ComplexProgramTarget* rules. Do not include any system-specific libraries here. SYS_LIBRARIES system libraries (usually specified as -lname) needed by this program. For example "MathLibrary". Do not include any system-specific libraries such as "-lnsl" here; they are automatically added to the link command by the vendor-specific .cf file. SUBDIRS for an Imakefile in a directory containing subdirectories, this names the subdirectories. Such an Imakefile also needs to #define IHaveSubdirs and call MakeSubdirs() and DependSubdirs(). MANSUFFIX suffix used by InstallManPage* rules. May be set to $(LIBMANSUFFIX), $(FILEMANSUFFIX), or $(MISCMANSUFFIX) in directories for libraries or data files. Rule-specific variables that may be set in an individual Imakefile. If you aren't using these rules, you may need variables with a similar function, but you need not use these names. However, following these conventions may make your Imakefile easier to read and maintain. DEPLIBS library dependencies for ComplexProgramTarget SRCS source files used by ComplexProgramTarget and DependTarget. OBJS object files used by ComplexProgramTarget PROGRAMS default target used with ComplexProgramTarget_(n) SRCS1 source files used by ComplexProgramTarget_1 OBJS1 object files used by ComplexProgramTarget_1 DEPLIBS1 library dependencies for ComplexProgramTarget_1 SRCS2 source files used by ComplexProgramTarget_2 OBJS2 object files used by ComplexProgramTarget_2 DEPLIBS2 library dependencies for ComplexProgramTarget_2 SRCS3 source files used by ComplexProgramTarget_3 OBJS3 object files used by ComplexProgramTarget_3 DEPLIBS3 library dependencies for ComplexProgramTarget_3 Variables that can be set on the make command line: DESTDIR directory under which "make install" should install instead of "/"; used only for testing "make install" rules, binary package building, and specifying alternative installation directories for cross compiles. FILE file for "lint1" target to run lint on. CDEBUGFLAGS -g and/or -O flag to control C compiler optimization. CXXDEBUGFLAGS -g and/or -O flag to control C++ optimization. LDSTRIPFLAGS flag to have linker strip objects (typically -x). Typically set to the empty string to prevent the linker from stripping objects; use this way when setting CDEBUGFLAGS to "-g". These variables are set in project-specific files such as X11.tmpl. They should NOT be set in an Imakefile. These variables are sometimes misused; they are included here to remind Imakefile writers NOT to use them: EXTRA_DEFINES project-specific -D flags EXTRA_INCLUDES project-specific -I flags EXTRA_ICONFIGFILES Additional project-specific imake config files to add to ICONFIGFILES. This is a list of files that define variables that might affect compilation of some files. Many other make variables are set up by the imake config files and can be used in an Imakefile. The easiest way to discover them is to look at the Makefile generated by an empty Imakefile. Comments Use C comment syntax in an Imakefile for comments that should not appear in the resulting Makefile. Use "XCOMM" at the start of each line to produce a comment that will appear in the Makefile. (The "XCOMM" will be translated into the Makefile comment character "#" by imake.) Do NOT use "#" as a comment character in Imakefiles; it confuses the C preprocessor used by imake on some systems. Imake variables Don't abuse the variables in X11.tmpl that describe particular pieces of X by using them to describe your own subsystems. Instead, create new variables that are defaulted using Imake.tmpl variables. Examples Since the easiest way to write an Imakefile is to start with one that works, here are some short, easy-to-read Imakefile examples in the X distribution: with subdirs: config/Imakefile library: lib/Xau/Imakefile simple program: programs/xdpyinfo/Imakefile complex progs: programs/xclipboard/Imakefile complex prog: programs/xmodmap/Imakefile Common Rules Here are some of the common rules for building programs. How to use them is described in Imake.rules and in the O'Reilly book "Software Portability with imake." Basic program-building rules All of these except NormalProgramTarget also generate rules to install the program and its manual page, and to generate dependencies. SimpleProgramTarget Use if there is only one program to be made and it has only one source file. ComplexProgramTarget Use if there is only one program to be made and it has multiple source files. Set SRCS to the names of the source files, set OBJS to the names of the object files, and set DEPLIBS to the libraries that this program depends on. ComplexProgramTarget_1 Like ComplexProgramTarget, but uses SRCS1, OBJS1, and DEPLIBS1 and can be used with ComplexProgramTarget_2 and ComplexProgramTarget_3 to build up to three programs in the same directory. Set PROGRAMS to the programs built by all of these rules. For more than 3 programs, use NormalProgramTarget for each. ComplexProgramTarget_2 Use after ComplexProgramTarget_1 for the second program in a directory. Uses SRCS2, OBJS2, and DEPLIBS2. ComplexProgramTarget_3 Use after ComplexProgramTarget_2 for the third program in a directory. Uses SRCS3, OBJS3, and DEPLIBS3. NormalProgramTarget Build a program. Can be used multiple times with different arguments in the same Imakefile. Lower level rules, often used with NormalProgramTarget InstallProgram install a program. InstallManPage install a manual page. InstallDirectory install a directory. DependTarget() include once at end of Imakefile with NormalProgramTarget rules or that uses Library.tmpl. Generates dependencies for files named in SRCS. Manual page rules, commonly used only in special documentation directories: InstallManPage InstallManPageLong InstallManPageAliases Other rules: SpecialCObjectRule Compile a C file with special flags. AllTarget Declare additional targets to build. InstallAppDefaults Install X application defaults file. Imakefile for directory with subdirectories XCOMM this is a sample Imakefile for a directory containing subdirectories #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" SUBDIRS = list of subdirs ... MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) Common Targets These targets are typically NOT defined explicitly by the Imakefile writer; rather they are generated automatically by imake rules. They are listed here for the convenience of people using the resulting Makefile, not people writing the original Imakefile. all Default rule; builds whatever is in this directory. Makefile Remake the Makefile (use after changing Imakefile). Run "make depend" after. Makefiles Remake all Makefiles in subdirectories. (Does nothing if no subdirectories.) Run "make depend" after. includes Generate and install in the tree any necessary header files. depend Update dependencies in the Makefile calculated by examining the source files. install Install what "make all" built on the system. install.man Install manual pages. clean Remove built objects and other derived files. lint Run lint. tags Create a tags file. nx-libs-3.5.99.23/nx-X11/config/cf/ServerLib.tmpl0000644000000000000000000000750113614532331015736 0ustar /* * Server Library imakefile info - this contains any special * redefinitions, etc. that Imakefiles in the various server library * subtrees will need. * * Before including this, you must set the following boolean variables: * DoSharedLib, DoNormalLib, DoDebugLib, DoProfileLib * */ #ifndef DoNormalLib #define DoNormalLib YES #endif #ifndef LibraryDefines #define LibraryDefines StandardDefines #endif #ifndef LibraryCDebugFlags #define LibraryCDebugFlags DefaultCDebugFlags #endif #ifndef SeparateSharedCompile #define SeparateSharedCompile YES #endif #ifndef SharedServerLibraryDef #define SharedServerLibraryDef $(__NOOP__) #endif #ifndef LibraryCcCmd #if DoSharedLib && defined(SharedLibraryCcCmd) #define LibraryCcCmd SharedLibraryCcCmd #else #define LibraryCcCmd CcCmd #endif #endif #ifndef LibraryCCOptions #if DoSharedLib && defined(SharedLibraryCCOptions) #define LibraryCCOptions SharedLibraryCCOptions #else #define LibraryCCOptions DefaultCCOptions #endif #endif #if DoDebugLib #define _DebuggedLibMkdir() LibMkdir(debugger) #define _DebuggedObjCompile(options) DebuggedLibObjCompile(options) #define _DebuggedCleanDir() LibCleanDir(debugger) #else #define _DebuggedLibMkdir() $(_NULLCMD_) #define _DebuggedObjCompile(options) $(_NULLCMD_) #define _DebuggedCleanDir() $(_NULLCMD_) #endif #if DoProfileLib #define _ProfiledLibMkdir() LibMkdir(profiled) #define _ProfiledObjCompile(options) ProfiledLibObjCompile(options) #define _ProfiledCleanDir() LibCleanDir(profiled) #else #define _ProfiledLibMkdir() $(_NULLCMD_) #define _ProfiledObjCompile(options) $(_NULLCMD_) #define _ProfiledCleanDir() $(_NULLCMD_) #endif #if !DoNormalLib #define _NormalLibMkdir() $(_NULLCMD_) #define _NormalObjCompile(options) $(_NULLCMD_) #define _NormalCleanDir() $(_NULLCMD_) #else #if DoSharedLib && SeparateSharedCompile #define _NormalLibMkdir() LibMkdir(unshared) #define _NormalObjCompile(options) UnsharedLibObjCompile(options) #define _NormalCleanDir() LibCleanDir(unshared) #else #define _NormalLibMkdir() $(_NULLCMD_) #define _NormalObjCompile(options) NormalLibObjCompile(options) #define _NormalCleanDir() $(_NULLCMD_) #endif #endif #if !DoSharedLib || (DoNormalLib && !SeparateSharedCompile) #define _SharedObjCompile(options) $(_NULLCMD_) #else #if SeparateSharedCompile #define _SharedObjCompile(options) NormalSharedLibObjCompile(options) #else #define _SharedObjCompile(options) NormalLibObjCompile(options) #endif #endif #define SRCsuf c #define Isuf i #ifndef LibraryObjectRule #define LibraryObjectRule() @@\ all:: @@\ _DebuggedLibMkdir() @@\ _ProfiledLibMkdir() @@\ _NormalLibMkdir() @@\ @@\ includes:: @@\ _DebuggedLibMkdir() @@\ _ProfiledLibMkdir() @@\ _NormalLibMkdir() @@\ @@\ .SRCsuf.Osuf: @@\ _DebuggedObjCompile($(_NOOP_)) @@\ _ProfiledObjCompile($(_NOOP_)) @@\ _NormalObjCompile($(_NOOP_)) @@\ _SharedObjCompile(SharedServerLibraryDef) @@\ @@\ clean:: @@\ _DebuggedCleanDir() @@\ _ProfiledCleanDir() @@\ _NormalCleanDir() @@\ #endif /* LibraryObjectRule */ #ifndef SpecialLibObjectRule #define SpecialLibObjectRule(objs,depends,options) @@\ objs: depends @@\ _DebuggedObjCompile(options) @@\ _ProfiledObjCompile(options) @@\ _NormalObjCompile(options) @@\ _SharedObjCompile(options) @@\ #endif /* SpecialLibObjectRule */ #ifndef SpecialCLibObjectRule #define SpecialCLibObjectRule(basename,depends,options) @@\ SpecialLibObjectRule(basename.Osuf,basename.SRCsuf depends,options) @@\ @@\ basename.Isuf: basename.SRCsuf depends @@\ CPPOnlyCompile(basename.SRCsuf,options) @@\ @@\ CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options) #endif /* SpecialCLibObjectRule */ #if DoSharedLib LibraryObjectRule() #else NormalLibraryObjectRule() #endif nx-libs-3.5.99.23/nx-X11/config/cf/Server.tmpl0000644000000000000000000000344113614532331015306 0ustar /* * Server imakefile info - this contains any special redefinitions, etc. * that Imakefiles in the server subtree will need. */ #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" LDSTRIPFLAGS="$(LDSTRIPFLAGS)" #ifndef ServerCcCmd #define ServerCcCmd CcCmd #endif #ifndef ServerCCOptions #define ServerCCOptions DefaultCCOptions #endif #ifndef ServerDefines #define ServerDefines StandardDefines #endif /* Note: Changing ServerCDebugFlags has no effect because CDEBUGFLAGS is over- ridden by PassCDebugFlags in the parent Makefile or toplevel xmakefile. */ #ifndef ServerCDebugFlags #define ServerCDebugFlags DefaultCDebugFlags #endif #ifndef DoThreadedServer #define DoThreadedServer NO #endif #ifndef InstallServerSetUID #define InstallServerSetUID NO #endif #ifdef CrossCompileDir # ifndef StripPath # define StripPath(x) `echo x|sed "s%.*/%%"` # endif # ifndef CrossServerCcCmd # define CrossServerCcCmd Concat3(CrossCompileDir,/,StripPath(ServerCcCmd)) # endif #endif /* * SetUIDServerTarget - compile, link, and relink a setuid server */ #ifndef SetUIDServerTarget #if InstallServerSetUID #define SetUIDServerTarget(server,subdirs,objects,libs,syslibs) @@\ ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,$(INSTUIDFLAGS)) #else #define SetUIDServerTarget ServerTarget #endif #endif /* SetUIDServerTarget */ #ifdef CrossCompileDir CC = CrossServerCcCmd #else CC = ServerCcCmd #endif CCOPTIONS = ServerCCOptions #if DoThreadedServer SERVER_THREAD_DEFINES = XThreadsDefines ThreadTypeDefines #endif STD_DEFINES = ServerDefines $(SERVER_THREAD_DEFINES) CDEBUGFLAGS = ServerCDebugFlags EXT_DEFINES = ExtensionDefines OS_DEFINES = ServerOSDefines GLX_DEFINES = GlxDefines #ifndef GlxUseSGISI #define GlxUseSGISI NO #endif #ifdef XorgVersion #include #endif nx-libs-3.5.99.23/nx-X11/config/cf/site.def0000644000000000000000000000733713614532331014576 0ustar /*************************************************************************** * * * SITE-SPECIFIC DEFINITIONS * * * * This file contains two halves, one included before the vendor-specific * * configuration file (.cf file), and one included after the .cf file. * * The before-half should be protected by #ifdef BeforeVendorCF, and the * * after-half should be protected by #ifdef AfterVendorCF. * * * * The before-half should only set things that the .cf file depends on. * * For the .cf files shipped in this release, the main variables in this * * category are HasGcc, HasGcc2, HasCplusplus, OSMajorVersion, * * OSMinorVersion, and OSTeenyVersion. * * * * The after-half should contain all other definitions. For example, * * place your ProjectRoot definition here. * * * * OS Major and Minor version numbers should be changed directly in the * * .cf file, not overridden in site.def. * * * ***************************************************************************/ /* if you want host-specific customization, this is one way to do it */ /* #ifndef SiteIConfigFiles #define SiteIConfigFiles $(IRULESRC)/host.def #define LocalConfigFiles host.def #endif */ #ifdef BeforeVendorCF /* * Include this for easy XFree86 customisations */ #ifndef SiteIConfigFiles #define SiteIConfigFiles $(IRULESRC)/xorgsite.def $(IRULESRC)/host.def #endif #include #include /* On systems where cpp doesn't correctly expand macros in include directives * the two following macros need to be defined directly (where "X11" is * really whatever the TopLevelProject macro is defined to be). */ # if defined(SVR4Architecture) || \ defined(SCOArchitecture) || defined(Win32Architecture) || \ defined(UXPArchitecture) || defined(SunArchitecture) || \ defined(DynixPtxArchitecture) || defined(i386IscArchitecture) # ifndef ProjectRulesFile # define ProjectRulesFile # endif # ifndef ProjectTmplFile # define ProjectTmplFile # endif # endif /* #ifndef HasGcc2 #define HasGcc2 YES #endif */ #endif /* BeforeVendorCF */ #ifdef AfterVendorCF #ifndef ProjectRoot #define ProjectRoot /usr/local #endif /* * On some platforms, some things may be installed outside of ProjectRoot * by default. To disable this, uncomment the following line. * #define NothingOutsideProjectRoot YES */ /* * Set EtcX11Directory if you want config file links installed under * ProjectRoot rather than in /etc/X11. See also HasVarDirectory, * UseEtcX11 and UseSeparateConfDir. * #define EtcX11Directory /etc/nx */ /* Only set HasXdmAuth to YES if you have a Wraphelp.c file. */ /* #define HasXdmAuth YES */ /* #if defined(SunArchitecture) && defined(SparcArchitecture) #define HasCodeCenter YES #ifndef SVR4Architecture #define HasTestCenter YES #endif #endif */ /* #ifdef __hp9000s800 #define HasCodeCenter YES #endif */ /* #if defined(SunArchitecture) && defined(SparcArchitecture) && !defined(SVR4Architecture) #define HasPurify YES #endif */ /* #define HasSentinel YES */ /* #undef DefaultUserPath #define DefaultUserPath /bin:/usr/bin:$(BINDIR):/usr/ucb:/usr/local/bin */ #include #endif /* AfterVendorCF */ nx-libs-3.5.99.23/nx-X11/config/cf/Threads.tmpl0000644000000000000000000000500613614532331015431 0ustar /* * For a multi-threaded application or library, * Define LocalThreadsDefines in your Imakefile (unless you like the * project default), then include this file. * Everything else should be automatic. */ #ifndef LocalThreadsDefines #ifdef ProjectThreadsDefines #define LocalThreadsDefines ProjectThreadsDefines #else #define LocalThreadsDefines /**/ #endif #endif #ifndef LocalThreads #ifdef ThreadedProject #define LocalThreads ThreadedProject #else #define LocalThreads YES #endif #endif #ifndef HasCThreads #define HasCThreads NO #endif #ifndef ThreadTypeDefines #if HasCThreads #define ThreadTypeDefines -DCTHREADS #else #define ThreadTypeDefines /**/ #endif #endif #ifndef SystemMTDefines #define SystemMTDefines /**/ #endif #ifndef LibraryMTDefines #define LibraryMTDefines /**/ #endif #ifndef HasThreadSafeAPI /* does it have getpwnam_r, etc. */ #define HasThreadSafeAPI YES #endif #ifndef MTSafeAPIDefines #if HasThreadSafeAPI #define MTSafeAPIDefines -DXUSE_MTSAFE_API #else #define MTSafeAPIDefines /**/ #endif #endif #ifndef ThreadPreStdAPIDefines #define ThreadPreStdAPIDefines /* nominally for POSIX P1003.4a (Draft 4) API */ #endif #ifndef CplusplusSystemMTDefines # ifdef SystemMTDefines # define CplusplusSystemMTDefines SystemMTDefines # else # define CplusplusSystemMTDefines /**/ # endif #endif #ifndef ThreadsCompileFlags #define ThreadsCompileFlags /**/ #endif #ifndef ThreadsCplusplusCompileFlags # ifdef ThreadsCompileFlags # define ThreadsCplusplusCompileFlags ThreadsCompileFlags # else # define ThreadsCplusplusCompileFlags /**/ # endif #endif #ifndef ThreadsLibraries #define ThreadsLibraries /**/ #endif #ifndef ThreadsCplusplusLibraries # ifdef ThreadsLibraries # define ThreadsCplusplusLibraries ThreadsLibraries # else # define ThreadsCplusplusLibraries /**/ # endif #endif #ifndef ThreadsLoadFlags #define ThreadsLoadFlags ThreadsCompileFlags #endif #ifndef ThreadsCplusplusLoadFlags #define ThreadsCplusplusLoadFlags ThreadsCplusplusCompileFlags #endif #if LocalThreads THREADS_CFLAGS = ThreadsCompileFlags THREADS_DEFINES = LocalThreadsDefines ThreadTypeDefines SystemMTDefines MTSafeAPIDefines ThreadPreStdAPIDefines $(LIB_MT_DEFINES) THREADS_LDFLAGS = ThreadsLoadFlags THREADS_LIBS = ThreadsLibraries THREADS_CXXFLAGS = ThreadsCplusplusCompileFlags THREADS_CXXDEFINES = LocalThreadsDefines ThreadTypeDefines CplusplusSystemMTDefines MTSafeAPIDefines ThreadPreStdAPIDefines $(LIB_MT_DEFINES) THREADS_CXXLDFLAGS = ThreadsCplusplusLoadFlags THREADS_CXXLIBS = ThreadsCplusplusLibraries #endif nx-libs-3.5.99.23/nx-X11/config/cf/X11.rules0000644000000000000000000000537513614532331014577 0ustar /* Note whether we are the top level project. */ #ifndef SeenTopLevelProject # define SeenTopLevelProject YES # define X11IsTopLevelProject YES #else # define X11IsTopLevelProject NO #endif /* * If no clues are given assume X11 is in the tree, otherwise * UseInstalled overrides UseImports. Do not do both. */ #ifndef UseInstalledX11 # define UseInstalledX11 NO #endif #ifdef UseInstalled # undef UseInstalledX11 # define UseInstalledX11 YES #endif #ifndef ImportX11 # ifdef UseImports # define ImportX11 YES # else # define ImportX11 NO # endif #endif #if UseInstalledX11 # undef ImportX11 # define ImportX11 NO #endif #if defined(X11ProjectRoot) # define XBinDir $(XPROJECTROOT)/lib/nx/bin #elif defined(ProjectRoot) # define XBinDir $(PROJECTROOT)/lib/nx/bin #else # define XBinDir $(BINDIR) #endif #ifdef X11ProjectRoot # define XUsrLibDirPath $(USRLIBDIR):$(XPROJECTROOT) #else # define XUsrLibDirPath $(USRLIBDIR) #endif #ifdef UsrLibDirPath # undef UsrLibDirPath #endif #ifdef ExtraLibDirPath #define UsrLibDirPath XUsrLibDirPath:ExtraLibDirPath #else #define UsrLibDirPath XUsrLibDirPath #endif #if ImportX11 # define XLdPreLibs -L$(LIBSRC) #elif defined(UseInstalledX11) && defined(X11ProjectRoot) # define XLdPreLibs -L$(XPROJECTROOT) #else # define XLdPreLibs /**/ #endif #ifdef LdPreLibs # undef LdPreLibs #endif #define LdPreLibs LdPreLib XLdPreLibs #ifdef X11ProjectRoot # define XLdPostLibs -L$(XPROJECTROOT) #else # define XLdPostLibs /**/ #endif #ifdef LdPostLibs # undef LdPostLibs #endif #define LdPostLibs LdPostLib XLdPostLibs #ifndef TopXInclude # if ImportX11 # define TopXInclude -I$(TOP)/imports/x11/include # elif !UseInstalledX11 # define TopXInclude -I$(TOP)/exports/include #else # ifdef X11ProjectRoot # define TopXInclude -I$(XPROJECTROOT)/../../include/nx # else # define TopXInclude /**/ # endif # endif #endif #ifdef TopIncludes # undef TopIncludes #endif #define TopIncludes TopInclude $(TOP_X_INCLUDES) #if UseInstalledX11 && defined(X11ProjectRoot) # define X11BuildLibPath $(XPROJECTROOT) #elif UseInstalledX11 # define X11BuildLibPath $(USRLIBDIR) #elif ImportX11 # define X11BuildLibPath $(XTOP)/lib #else # define X11BuildLibPath $(TOP)/exports/lib #endif #ifndef BuildLibPath #ifdef SystemBuildLibPath # define BuildLibPath $(XENVLIBDIR):$(SYSTEMENVLIBDIR) #else # define BuildLibPath $(XENVLIBDIR) #endif #endif #ifndef X11ProjectDefines # define X11ProjectDefines /**/ #endif #define ProjectDefines X11ProjectDefines #ifndef X11CplusplusProjectDefines # define X11CplusplusProjectDefines X11ProjectDefines #endif #define CplusplusProjectDefines X11CplusplusProjectDefines #ifndef XtransFailSoft # define XtransFailSoft NO #endif #if XtransFailSoft # define XtransFailDefine /**/ #else # define XtransFailDefine -DFAIL_HARD #endif nx-libs-3.5.99.23/nx-X11/config/cf/X11.tmpl0000644000000000000000000011217413614532331014415 0ustar XCOMM ---------------------------------------------------------------------- XCOMM X Window System Build Parameters and Rules XCOMM ---------------------------------------------------------------------- /*************************************************************************** * * * DEFAULT DEFINITIONS * * * * The following section contains defaults for things that can * * overridden in the various *.cf and site.def files. DO NOT EDIT! * * * **************************************************************************/ #define ProjectX 604 /* do *not* change this line */ /* The following project-specific rules are defined at the end of this file: * * InstallAppDefaults (class) */ /* X.Org release string */ #ifndef XOrgReleaseString # if defined XorgVersionString # define XOrgReleaseString Release XorgVersionString # else # define XOrgReleaseString Release 6.9 # endif #endif #ifndef XOrgManNameString #define XOrgManNameString X Version 11 #endif #ifndef XOrgNameString # define XOrgNameString The X.Org Foundation #endif #ifndef XOrgNameStringShort # define XOrgNameStringShort X.Org #endif #ifndef XOrgStdFilePrefix # define XOrgStdFilePrefix xorg #endif #ifndef XOrgWebSupportAddress # define XOrgWebSupportAddress http://wiki.X.Org #endif XORGRELSTRING = XorgManVersionString XORGMANNAME = XOrgManNameString #ifndef XOrgManDefs #define XOrgManDefs -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" #endif #ifndef XVendorManNameString #define XVendorManNameString XOrgManNameString #endif #ifndef XVendorManVersionString #define XVendorManVersionString XOrgReleaseString #endif #ifndef XVendorNameString # define XVendorNameString XOrgNameString #endif #ifndef XVendorNameStringShort # define XVendorNameStringShort XOrgNameStringShort #endif #ifndef XVendorWebSupport # define XVendorWebSupport XOrgWebSupportAddress #endif #ifndef XVendorStdFilePrefix # define XVendorStdFilePrefix XOrgStdFilePrefix #endif #ifndef VendorManDefs #define VendorManDefs -D__vendorversion__="$(VENDORMANVERSION) $(VENDORMANNAME)" #endif #ifndef VendorDefines #define VendorDefines -DXVENDORNAME='"$(VENDORNAME)"' -DXVENDORNAMESHORT='"$(VENDORNAMESHORT)"' #endif #ifndef VendorSupportDefines # if defined XVendorWebSupport # define VendorSupportDefines -D__VENDORDWEBSUPPORT__='"$(VENDORWEBSUPPORT)"' # endif #endif /* * X-specific things */ #if CrossCompiling && !defined(UseInstalledOnCrossCompile) # if defined(UseInstalled) # define UseInstalledOnCrossCompile YES # else # define UseInstalledOnCrossCompile NO # endif #else # define UseInstalledOnCrossCompile NO #endif #ifndef HasXServer #define HasXServer YES #endif /* xorg.cf sets XorgServer to YES - to build Xorg you must include xorg.cf * from the .cf file for your platform. */ #ifndef XorgServer #define XorgServer NO #endif #ifndef BuildServer #define BuildServer HasXServer #endif #ifndef BuildServersOnly #define BuildServersOnly NO #endif #ifndef BuildClients #define BuildClients !BuildServersOnly #endif #ifndef BuildDocs #define BuildDocs !BuildServersOnly #endif #ifndef BuildLibraries #define BuildLibraries (!BuildServersOnly || BuildClients) #endif #ifndef BuildLibrariesForXServers #define BuildLibrariesForXServers BuildServer #endif #ifndef BuildX11Lib #define BuildX11Lib BuildLibraries #endif #ifndef InstallXcmsTxt #define InstallXcmsTxt YES #endif /* * This disables XLOCALEDIR. */ #ifndef DisableXLocaleDirEnv #define DisableXLocaleDirEnv NO #endif #ifndef BuildLoadableXlibXcursor #define BuildLoadableXlibXcursor (HasDlopen && SharedLibX11) #endif #ifndef BuildTestExt #define BuildTestExt YES #endif #ifndef BuildSyncExt #define BuildSyncExt YES #endif #ifndef BuildXCMiscExt #define BuildXCMiscExt YES #endif #ifndef BuildShapeExt #define BuildShapeExt YES #endif #ifndef BuildBigReqsExt #define BuildBigReqsExt YES #endif #ifndef BuildXInputExt #define BuildXInputExt NO #endif #ifndef BuildDBE #define BuildDBE YES #endif #ifndef BuildDPMS #define BuildDPMS YES #endif #ifndef BuildXKB #define BuildXKB YES #endif #ifndef BuildXKBlib #define BuildXKBlib (BuildXKB && !BuildServersOnly) #endif /* * WARNING: Setting UseXKBInClients to YES cause incompatibilities * between many clients (such as xterm) and pre-XKB shared * libraries. */ #ifndef UseXKBInClients #define UseXKBInClients NO /* use XKB in "normal" clients? */ #endif #ifndef BuildRECORD #define BuildRECORD YES #endif #ifndef BuildRECORDlib #define BuildRECORDlib BuildRECORD #endif #ifndef BuildXinerama #define BuildXinerama NO #endif #ifndef BuildXCSecurity #define BuildXCSecurity YES #endif #ifndef HasPlugin /* Browser plugins are shared libraries - only build them if the OS * supports shared libs. */ #define HasPlugin HasSharedLibraries #endif #ifndef BuildPlugin #define BuildPlugin HasPlugin #endif #ifndef BuildScreenSaverExt #define BuildScreenSaverExt NO #endif #ifndef BuildXF86BigfontExt #define BuildXF86BigfontExt NO #endif #ifndef BuildXResExt #define BuildXResExt NO #endif #ifndef BuildXvExt #define BuildXvExt NO #endif #ifndef BuildXvMCExt #define BuildXvMCExt NO #endif #ifndef BuildGlxExt #define BuildGlxExt NO #endif #ifndef BuildOSMesaLib #define BuildOSMesaLib BuildGlxExt #endif #ifndef BuildRender #define BuildRender YES #endif #ifndef BuildRandR #define BuildRandR YES #endif #ifndef BuildXfixes #define BuildXfixes YES #endif #ifndef BuildDamage #define BuildDamage BuildXfixes #endif #ifndef BuildComposite #define BuildComposite (BuildXfixes && BuildDamage) #endif #ifndef BuildCompositeLibrary #define BuildCompositeLibrary !BuildServersOnly && BuildXfixesLibrary #endif #ifndef BuildRootless #define BuildRootless NO #endif #ifndef DefaultCursorTheme #define DefaultCursorTheme core #endif #ifndef BuildMiscDocs #define BuildMiscDocs NO #endif #ifndef BuildSpecsDocs #define BuildSpecsDocs NO #endif #ifndef BuildAllSpecsDocs #define BuildAllSpecsDocs NO #endif #ifndef InstallHardcopyDocs #define InstallHardcopyDocs YES #endif #ifndef InstallMiscManPages #define InstallMiscManPages YES #endif #ifndef FSUseSyslog #define FSUseSyslog NO #endif #ifndef InstallLibManPages #define InstallLibManPages YES #endif #ifndef UseConfDirForXkb #define UseConfDirForXkb YES #endif #ifndef ThreadedX #if HasPosixThreads || HasCThreads #define ThreadedX YES /* multi-threaded libraries */ #else #define ThreadedX NO #endif #endif #ifndef ThreadedProject #define ThreadedProject ThreadedX #endif #ifndef NeedUIThrStubs #define NeedUIThrStubs NO #endif #ifndef HasWChar32 #define HasWChar32 SystemV4 #endif #ifndef HasXdmAuth #define HasXdmAuth NO /* if you can not use XDM-AUTH* */ #endif #ifndef PrimaryScreenResolution #define PrimaryScreenResolution 72 /* a common resolution */ #endif #ifndef DefaultFontPath # if PrimaryScreenResolution < 88 /* (75 + 100) / 2 */ # define DefaultFontPath $(FONTDIR)/misc/,$(FONTDIR)/TTF/,$(FONTDIR)/Type1/,$(FONTDIR)/CID/,$(FONTDIR)/75dpi/,$(FONTDIR)/100dpi/ # else # define DefaultFontPath $(FONTDIR)/misc/,$(FONTDIR)/TTF/,$(FONTDIR)/Type1/,$(FONTDIR)/CID/,$(FONTDIR)/100dpi/,$(FONTDIR)/75dpi/ # endif #endif #ifndef DefaultFSFontPath # define DefaultFSFontPath DefaultFontPath #endif #ifndef UseMemLeak #define UseMemLeak NO #endif #ifndef ServerErrorDefines #define ServerErrorDefines /**/ #endif /* * NOTE: IPv6Flags could be tacked on to either ConnectionFlags or * ExtraConnectionDefs. Here, we choose the later in order to * maximise exposure of the IPv6 code (a number of .def files * contain ConnectionFlags overrides). */ #ifndef BuildIPv6 /* If the OS also #define's AF_INET6 */ #define BuildIPv6 YES #endif #ifndef IPv6Flags #if BuildIPv6 #define IPv6Flags -DIPv6 #else #define IPv6Flags /**/ #endif #endif /* * Assume by default that IPv6 sockets also listen for IPv4 connections. * XDMCP support currently only works for both IPv4 and IPv6 when this is * true. */ #ifndef IPv6SocketsAlsoIPv4 #define IPv6SocketsAlsoIPv4 YES #endif #ifndef ConnectionFlags #define ConnectionFlags -DTCPCONN -DUNIXCONN #endif #if HasStickyDirBit STICKY_DEFINES = -DHAS_STICKY_DIR_BIT #endif #if HasFchown FCHOWN_DEFINES = -DHAS_FCHOWN #endif #ifndef ExtraConnectionDefs #define ExtraConnectionDefs $(STICKY_DEFINES) $(FCHOWN_DEFINES) IPv6Flags #endif #ifndef ProjectThreadsDefines #define ProjectThreadsDefines -DXTHREADS #endif #if Malloc0ReturnsNull #ifndef XMalloc0ReturnsNullDefines #define XMalloc0ReturnsNullDefines Malloc0ReturnsNullDefines #endif #ifndef XtMalloc0ReturnsNullDefines #define XtMalloc0ReturnsNullDefines Malloc0ReturnsNullDefines -DXTMALLOC_BC #endif #endif #ifndef ExtensionOSDefines #define ExtensionOSDefines /**/ #endif #ifndef ExtensionDefines #ifndef XTestDefines #if BuildTestExt #define XTestDefines -DXTEST #else #define XTestDefines /**/ #endif #endif #ifndef XSyncDefines #if BuildSyncExt #define XSyncDefines -DXSYNC #else #define XSyncDefines /**/ #endif #endif #ifndef XCMiscDefines #if BuildXCMiscExt #define XCMiscDefines -DXCMISC #else #define XCMiscDefines /**/ #endif #endif #ifndef ShapeDefines #if BuildShapeExt #define ShapeDefines -DSHAPE #else #define ShapeDefines /**/ #endif #endif #ifndef GlxDefines #if BuildGlxExt #ifdef GlxExtraDefines #define GlxDefines -DGLXEXT GlxExtraDefines #else #define GlxDefines -DGLXEXT #endif #else #define GlxDefines /**/ #endif #endif #ifndef DRMSrcDir #define DRMSrcDir $(TOP)/extras/drm #endif #ifndef MesaSrcDir #define MesaSrcDir $(TOP)/extras/Mesa #endif #ifndef OglSampleSrcDir #define OglSampleSrcDir $(TOP)/extras/ogl-sample #endif #ifndef ShmDefines #if HasShm #define ShmDefines -DMITSHM #else #define ShmDefines /**/ #endif #endif #ifndef XInputDefines #if BuildXInputExt #define XInputDefines -DXINPUT #else #define XInputDefines /**/ #endif #endif #ifndef XineramaDefines #if BuildXinerama #define XineramaDefines -DPANORAMIX #else #define XineramaDefines /**/ #endif #endif #ifndef XkbDefines #if BuildXKB #define XkbDefines -DXKB #else #define XkbDefines /**/ #endif #endif #ifndef XkbClientDefines #if UseXKBInClients #define XkbClientDefines -DXKB #else #define XkbClientDefines /**/ #endif #endif #ifndef XkbServerDefines #define XkbServerDefines /**/ #endif #ifndef XkbDefRulesDefines #define XkbDefRulesDefines -D__XKBDEFRULES__='"$(XKBDEFRULES)"' #endif # ifndef XkbDefaultRulesFile # define XkbDefaultRulesFile XVendorStdFilePrefix #endif #ifndef BigReqDefines #if BuildBigReqsExt #define BigReqDefines -DBIGREQS #else #define BigReqDefines /**/ #endif #endif #ifndef DBEDefines #if BuildDBE #define DBEDefines -DDBE #else #define DBEDefines /**/ #endif #endif #ifndef PervasiveDBEDefines #define PervasiveDBEDefines /* -DNEED_DBE_BUF_BITS -DNEED_DBE_BUF_VALIDATE */ #endif #ifndef ScreenSaverExtensionDefines #if BuildScreenSaverExt #define ScreenSaverExtensionDefines -DSCREENSAVER #else #define ScreenSaverExtensionDefines /**/ #endif #endif #ifndef XF86BigfontExtensionDefines #if BuildXF86BigfontExt #define XF86BigfontExtensionDefines -DXF86BIGFONT #else #define XF86BigfontExtensionDefines /**/ #endif #endif #ifndef XvExtensionDefines #if BuildXvExt #define XvExtensionDefines -DXV #else #define XvExtensionDefines /**/ #endif #endif #ifndef XvMCExtensionDefines #if BuildXvMCExt #define XvMCExtensionDefines -DXVMC #else #define XvMCExtensionDefines /**/ #endif #endif #ifndef XResExtensionDefines #if BuildXResExt #define XResExtensionDefines -DRES #else #define XResExtensionDefines /**/ #endif #endif #ifndef RECORDDefines #if BuildRECORD #define RECORDDefines -DXRECORD #else #define RECORDDefines /**/ #endif #endif #ifndef XCSecurityDefines #if BuildXCSecurity #define XCSecurityDefines -DXCSECURITY #else #define XCSecurityDefines /**/ #endif #endif #ifndef DPMSDefines #if BuildDPMS #define DPMSDefines -DDPMSExtension #else #define DPMSDefines /**/ #endif #endif #ifndef RenderDefines #if BuildRender #define RenderDefines -DRENDER #else #define RenderDefines /**/ #endif #endif #ifndef RandRDefines #if BuildRandR #define RandRDefines -DRANDR #else #define RandRDefines /**/ #endif #endif #ifndef XfixesDefines #if BuildXfixes #define XfixesDefines -DXFIXES #else #define XfixesDefines /**/ #endif #endif #ifndef XDamageDefines #if BuildDamage #define XDamageDefines -DDAMAGE #else #define XDamageDefines /**/ #endif #endif #ifndef CompositeDefines #if BuildComposite #define CompositeDefines -DCOMPOSITE #else #define CompositeDefines /**/ #endif #endif #ifndef RootlessDefines #if BuildRootless #define RootlessDefines -DROOTLESS #else #define RootlessDefines /**/ #endif #endif #ifndef SitePervasiveExtensionDefines #define SitePervasiveExtensionDefines /**/ #endif #ifndef PervasiveExtensionDefines #define PervasiveExtensionDefines \ PervasiveDBEDefines \ ShapeDefines \ XInputDefines \ XkbDefines \ XCSecurityDefines \ XF86BigfontExtensionDefines \ DPMSDefines \ SitePervasiveExtensionDefines \ RenderDefines \ RandRDefines \ XineramaDefines \ XfixesDefines \ XDamageDefines \ CompositeDefines \ RootlessDefines #endif #ifndef SiteExtensionDefines #define SiteExtensionDefines /**/ #endif #ifndef BaseExtensionDefines #define BaseExtensionDefines \ DBEDefines \ XTestDefines \ XSyncDefines \ XCMiscDefines \ RECORDDefines \ ShmDefines \ BigReqDefines \ DPMSDefines \ ScreenSaverExtensionDefines \ XvExtensionDefines \ XvMCExtensionDefines \ GlxDefines \ SiteExtensionDefines \ XResExtensionDefines #endif #define ExtensionDefines BaseExtensionDefines ExtensionOSDefines #endif /* ExtensionDefines */ #ifndef HasStrcasecmp #define HasStrcasecmp YES #endif #ifndef StrcasecmpDefines # if HasStrcasecmp # define StrcasecmpDefines /**/ # else # define StrcasecmpDefines -DNEED_STRCASECMP # endif #endif #ifndef HasDevRandom #define HasDevRandom NO #endif #ifndef HasArc4Random #define HasArc4Random NO #endif #ifndef RandomDefines # if HasDevRandom # ifndef RandomDeviceFile # define RandomDeviceFile /dev/random # endif # ifndef ExtraRandomDefines # ifdef PollDevRandom /* Set if can poll() /dev/random to avoid blocking */ # define ExtraRandomDefines -DPOLL_DEV_RANDOM # else # define ExtraRandomDefines /**/ # endif # endif # define RandomDefines -DDEV_RANDOM=\"RandomDeviceFile\" ExtraRandomDefines # elif HasArc4Random # define RandomDefines -DARC4_RANDOM # else # define RandomDefines /**/ # endif #endif #ifndef PreferXdmcpIPv6 #define PreferXdmcpIPv6 NO #endif #ifndef ServerXdmcpIPv6Defines #if BuildIPv6 && !IPv6SocketsAlsoIPv4 && !PreferXdmcpIPv6 #define ServerXdmcpIPv6Defines -DXDMCP_NO_IPV6 #else #define ServerXdmcpIPv6Defines /**/ #endif #endif #ifndef ServerXdmcpDefines #define ServerXdmcpDefines -DXDMCP ServerXdmcpIPv6Defines #endif #ifndef ServerOSDefines #define ServerOSDefines /**/ #endif #ifndef ServerExtraDefines #define ServerExtraDefines /* -DPIXPRIV */ #endif #ifndef ServerAssertDefines #define ServerAssertDefines -DNDEBUG #endif #ifndef ServerSnprintfDefines #if !HasSnprintf #define ServerSnprintfDefines -DNEED_SNPRINTF #else #define ServerSnprintfDefines /**/ #endif #endif #ifndef ServerReallocarrayDefines #if HasReallocarray #define ServerReallocarrayDefines -DHAVE_REALLOCARRAY #else #define ServerReallocarrayDefines /**/ #endif #endif #ifndef ServerDefines #define ServerDefines StandardDefines PervasiveExtensionDefines ServerExtraDefines ServerAssertDefines ServerSnprintfDefines ServerReallocarrayDefines #endif #ifndef MesaUseX86Asm /* The current Mesa X86 ASM code doesn't work well with SVR4 shared libs. */ # if HasX86Support && !SystemV4 # define MesaUseX86Asm YES # else # define MesaUseX86Asm NO # endif #endif #ifndef MesaUseMMX #ifdef HasMMXSupport #define MesaUseMMX HasMMXSupport #else #define MesaUseMMX NO #endif #endif #ifndef MesaUse3DNow #ifdef Has3DNowSupport #define MesaUse3DNow Has3DNowSupport #else #define MesaUse3DNow NO #endif #endif #ifndef MesaUseSSE #ifdef HasSSESupport #define MesaUseSSE HasSSESupport #else #define MesaUseSSE NO #endif #endif /* For compatibility */ #ifdef HasSSESupport #undef HasKatmaiSupport #define HasKatmaiSupport HasSSESupport #endif #undef MesaUseKatmai #define MesaUseKatmai MesaUseSSE #ifndef UsbMouseSupport # define UsbMouseSupport NO #endif #ifndef DefaultFSConfigFile #define DefaultFSConfigFile $(LIBDIR)/fs/config #endif #ifndef BinDir #ifdef ProjectRoot #define BinDir Concat(ProjectRoot,/bin) #else #define BinDir /usr/bin/X11 #endif #endif #ifndef BuildIncRoot #define BuildIncRoot $(TOP)/exports #endif #ifndef BuildIncDir #define BuildIncDir $(BUILDINCROOT)/include #endif #ifndef BuildIncTop #define BuildIncTop ../.. /* relative to BuildIncDir */ #endif #ifndef XTop # if ImportX11 # define XTop $(TOP)/imports/x11 # else # define XTop $(TOP) # endif #endif #ifndef XBuildIncRoot # if ImportX11 # define XBuildIncRoot $(XTOP) # else # define XBuildIncRoot $(XTOP)/exports # endif #endif #ifndef XBuildIncDir # define XBuildIncDir $(XBUILDINCROOT)/include/X11 #endif #ifndef XBuildIncTop # define XBuildIncTop ../../.. #endif #ifndef XBuildBinDir # define XBuildBinDir $(XBUILDINCROOT)/bin #endif #ifndef BuildBinDir #define BuildBinDir $(TOP)/exports/bin #endif #ifndef BuildBinTop #define BuildBinTop ../.. /* relative to BuildBinDir */ #endif #ifndef BuildLibDir #define BuildLibDir $(TOP)/exports/lib #endif #ifndef BuildLibTop #define BuildLibTop ../.. /* relative to BuildLibDir */ #endif #ifndef BuildModuleDir #define BuildModuleDir $(BUILDLIBDIR)/modules #endif #ifndef BuildI18NDir # define BuildI18NDir $(BUILDLIBDIR)/locale #endif #ifndef BuildModuleTop #define BuildModuleTop $(BUILDLIBTOP)/.. #endif #ifndef LibDir # ifdef ProjectRoot # define LibDir Concat(ProjectRoot,/lib/nx/X11) # else # define LibDir /usr/lib/X11 # endif #endif #ifndef ModuleDir #define ModuleDir $(USRLIBDIR)/modules #endif #ifndef InstSrcDir #define InstSrcDir Concat(ProjectRoot,/src) #endif #ifndef LibexecDir #ifdef ProjectRoot #define LibexecDir Concat(ProjectRoot,/libexec) #else #define LibexecDir /usr/X11/libexec #endif #endif #ifndef ConfigDir #define ConfigDir $(LIBDIR)/config #endif #ifndef DocDir #define DocDir $(LIBDIR)/doc #endif #ifndef DocHtmlDir #define DocHtmlDir $(DOCDIR)/html #endif #ifndef DocPsDir #define DocPsDir $(DOCDIR)/PostScript #endif #ifndef DocPdfDir #define DocPdfDir $(DOCDIR)/PDF #endif #ifndef FontDir #define FontDir $(USRDATADIR)/fonts #endif #ifndef FontEncDir #define FontEncDir $(USRDATADIR)/fonts/encodings #endif #ifndef AdmDir #define AdmDir /usr/adm #endif #ifndef XinitDir #define XinitDir $(LIBDIR)/xinit #endif #ifndef XdmDir #define XdmDir $(LIBDIR)/xdm #endif #ifndef XdmVarDir #define XdmVarDir $(VARLIBDIR)/xdm #endif #ifndef XdmAuthDir #define XdmAuthDir $(LIBDIR)/xdm #endif #ifndef XdmConfigurationSubdirectory /* under xdm sources */ #define XdmConfigurationSubdirectory config #endif #ifndef TwmDir #define TwmDir $(LIBDIR)/twm #endif #ifndef XsmDir #define XsmDir $(LIBDIR)/xsm #endif #ifndef NlsDir #define NlsDir $(LIBDIR)/nls #endif #ifndef XLocaleDir #define XLocaleDir $(LIBDIR)/locale #endif #ifndef ProxyManagerDir #define ProxyManagerDir $(LIBDIR)/proxymngr #endif #ifndef ServerConfigDir #define ServerConfigDir $(LIBDIR)/xserver #endif #ifndef EtcX11Directory #define EtcX11Directory /etc/X11 #endif #ifndef InstallSecurityConfig #define InstallSecurityConfig YES /* Install sample security policy */ #endif #ifndef XFileSearchPathBase /* avoid SCCS keyword */ #define XFileSearchPathBase Concat4($(LIBDIR)/%L/%T/%N%C,%S:$(LIBDIR)/%l/%T/%N%C,%S:$(LIBDIR)/%T/%N%C,%S:$(LIBDIR)/%L/%T/%N%S:$(LIBDIR)/%l/%T/%N%S:$(LIBDIR)/%T/%N%S) #endif #ifndef XFileSearchPathDefault #ifdef XAppLoadDir /* avoid SCCS keyword */ #define XFileSearchPathDefault XAppLoadDir/Concat(%N%C,%S):XAppLoadDir/%N%S:XFileSearchPathBase #else #define XFileSearchPathDefault XFileSearchPathBase #endif #endif #ifndef XAppLoadDir #define XAppLoadDir $(LIBDIR)/app-defaults #endif #ifndef XtErrorPrefix #define XtErrorPrefix /* as empty string */ #endif #ifndef XtExtraDefines #define XtExtraDefines /* as empty string */ #endif #ifndef XtWarningPrefix #define XtWarningPrefix /* as empty string */ #endif #ifndef OsNameDefines #define OsNameDefines /* as nothing */ #endif #ifndef DefaultUserPath /* for xdm */ #define DefaultUserPath :/bin:/usr/bin:$(BINDIR):/usr/ucb #endif #ifndef DefaultSystemPath /* for xdm */ #define DefaultSystemPath /etc:/bin:/usr/bin:$(BINDIR):/usr/ucb #endif #ifndef DefaultSystemShell /* for xdm to set in SHELL */ #define DefaultSystemShell BourneShell #endif #ifndef ContribDir #define ContribDir $(XTOP)/../contrib /* contrib is outside core tree */ #endif #ifndef UnsupportedDir #define UnsupportedDir $(XTOP)/unsupported #endif #ifndef AllocateLocalDefines #define AllocateLocalDefines /**/ #endif #ifndef ForceNormalLib #define ForceNormalLib (HasGcc && !HasGcc2) #endif #ifndef PsWrap # ifndef UseInstalled # define PsWrap $(PSWRAPSRC)/pswrap # else # define PsWrap pswrap # endif #endif #ifndef ResourceConfigurationManagement #define ResourceConfigurationManagement YES #endif #ifndef XtPopdownConformance #define XtPopdownConformance YES #endif XCOMM ----------------------------------------------------------------------- XCOMM X Window System make variables; these need to be coordinated with rules /* * This list must be reflected in the DIRS_TO_BUILD list in the top-level * Makefile. */ XTOP = XTop BINDIR = BinDir /* programs */ BUILDINCROOT = BuildIncRoot /* base of build loc */ BUILDINCDIR = BuildIncDir /* built headers */ BUILDINCTOP = BuildIncTop /* top relative to BUILDINCDIR */ BUILDLIBDIR = BuildLibDir /* built libraries */ BUILDLIBTOP = BuildLibTop /* top relative to BUILDLIBDIR */ BUILDBINDIR = BuildBinDir /* built binaries */ BUILDBINTOP = BuildBinTop /* top relative to BUILDBINDIR */ BUILDMODULEDIR = BuildModuleDir /* built server modules */ BUILDI18NDIR = BuildI18NDir /* built i81n modules */ BUILDMODULETOP = BuildModuleTop /* top relative to BUILDMODULEDIR */ XBUILDINCROOT = XBuildIncRoot /* base of X build loc */ XBUILDINCDIR = XBuildIncDir XBUILDINCTOP = XBuildIncTop XBUILDBINDIR = XBuildBinDir INCDIR = $(INCROOT) /* header files */ ADMDIR = AdmDir /* server log files */ LIBDIR = LibDir /* rgb, XErrorDB, etc. */ LIBEXECDIR = LibexecDir MODULEDIR = ModuleDir TOP_X_INCLUDES = TopXInclude XBINDIR = XBinDir /* BINDIR for X11ProjectRoot */ INSTSRCDIR = InstSrcDir /* Installed source (kernel modules). */ #ifdef EtcX11Directory ETCX11DIR = EtcX11Directory #endif #if UseEtcX11 CONFDIR = $(ETCX11DIR) #elif HasVarDirectory CONFDIR = $(VARDIR) #endif DOCDIR = DocDir DOCHTMLDIR = DocHtmlDir DOCPSDIR = DocPsDir DOCPDFDIR = DocPdfDir FONTDIR = FontDir /* font directories */ ENCODINGSDIR = FontEncDir /* font encodings directory */ XINITDIR = XinitDir /* xinit config files */ XDMDIR = XdmDir /* xdm config files */ XDMVARDIR = XdmVarDir /* xdm config files */ TWMDIR = TwmDir /* twm config files */ XSMDIR = XsmDir /* xsm config files */ NLSDIR = NlsDir /* nls files */ XLOCALEDIR = XLocaleDir /* locale files */ XLOCALELIBDIR = XlocaleDir /* FIXME: For now take XLOCALEDIR, unsure about the correct setting */ PROXYMANAGERDIR = ProxyManagerDir /* proxy manager config files */ XAPPLOADDIR = XAppLoadDir /* application default resource dir */ INSTAPPFLAGS = $(INSTDATFLAGS) /* XXX - this should go away - XXX */ #if UseInstalledX11 RGB = $(XBINDIR)/rgb MKHTMLINDEX = $(XBINDIR)/mkhtmlindex #else RGB = $(CLIENTENVSETUP) $(XBUILDBINDIR)/rgb # if HasPerl MKHTMLINDEX = RunPerlScript($(CONFIGSRC)/util/mkhtmlindex.pl,) # else MKHTMLINDEX = $(SHELL) $(CONFIGSRC)/util/mkhtmlindex.sh # endif #endif HTMLINDEXCMD = HtmlIndexCmd DOCUTILSRC = $(XTOP)/doc/util CLIENTSRC = $(TOP)/clients DEMOSRC = $(TOP)/demos XDOCMACROS = $(DOCUTILSRC)/macros.t XIDXMACROS = $(DOCUTILSRC)/indexmacros.t PROGRAMSRC = $(TOP)/programs LIBSRC = $(XTOP)/lib INCLUDESRC = BuildIncDir XINCLUDESRC = $(INCLUDESRC)/nx-X11 SERVERSRC = $(XTOP)/programs/Xserver CONTRIBSRC = ContribDir UNSUPPORTEDSRC = UnsupportedDir DOCSRC = $(XTOP)/doc RGBSRC = $(XTOP)/programs/rgb EXTINCSRC = $(XTOP)/include/extensions DRMSRCDIR = DRMSrcDir MESASRCDIR = MesaSrcDir OGLSAMPLESRCDIR = OglSampleSrcDir PSWRAPSRC = $(XTOP)/config/pswrap TRANSCOMMSRC = $(LIBSRC)/xtrans TRANS_INCLUDES = -I$(TRANSCOMMSRC) CONNECTION_FLAGS = ConnectionFlags ExtraConnectionDefs XTRANS_FAILDEFINES = XtransFailDefine #ifdef X11ProjectRoot XPROJECTROOT = X11ProjectRoot #endif VENDORMANNAME = XVendorManNameString VENDORMANVERSION = XVendorManVersionString XORGMANDEFS = XOrgManDefs VENDORMANDEFS = VendorManDefs VENDORNAME = XVendorNameString VENDORNAMESHORT = XVendorNameStringShort #if defined (XVendorWebSupport) VENDORWEBSUPPORT = XVendorWebSupport #endif VENDORSUPPORTDEFS = VendorSupportDefines XKBDEFRULES = XkbDefaultRulesFile XKBDEFRULESDEFS = XkbDefRulesDefines XCONFIGFILE = XConfigFile XCONFIGDIR = XConfigDir XLOGFILE = XLogFile XSERVERNAME = XServerName #if HasSharedLibraries #ifndef DontUseLibPathVar #ifndef BuildLibPathVar #define BuildLibPathVar LD_LIBRARY_PATH #endif #endif #endif #ifdef BuildLibPathVar # ifdef SystemBuildLibPath SYSTEMENVLIBDIR = SystemBuildLibPath # endif #define XlocaleClientSetup Concat3(XLOCALEDIR,=,BuildI18NDir) Concat3(XLOCALELIBDIR,=,BuildI18NDir) XENVLIBDIR = X11BuildLibPath CLIENTENVSETUP = Concat3(BuildLibPathVar,=,BuildLibPath) XlocaleClientSetup #else CLIENTENVSETUP = #endif #ifdef PreloadSetup PRELOADSETUP = PreloadSetup #endif #ifndef ShLibIncludeFile /* need this to make ANSI-style preprocessors happy */ #define ShLibIncludeFile #endif #include ShLibIncludeFile #ifndef XBuildLibDir # define XBuildLibDir BuildLibDir #endif #ifndef NeedLibInsideFlag #define NeedLibInsideFlag NO #endif #ifndef SharedLibX11 #define SharedLibX11 HasSharedLibraries #endif #ifndef NormalLibX11 #define NormalLibX11 (!SharedLibX11 | ForceNormalLib) #endif #ifndef DebugLibX11 #define DebugLibX11 NO /* debugged X library */ #endif #ifndef ProfileLibX11 #define ProfileLibX11 NO /* profiled X library */ #endif XLIBSRC = $(LIBSRC)/X11 #if SharedLibX11 #ifndef SharedX11Rev #define SharedX11Rev 6.2 #endif SharedLibReferences(XONLY,NX_X11,$(XLIBSRC),SOXLIBREV,SharedX11Rev) #else ProjectUnsharedLibReferences(XONLY,NX_X11,$(XLIBSRC),XBuildLibDir) #endif /* Common alternate spellings */ DEPXLIBONLY = $(DEPXONLYLIB) XLIBONLY = $(XONLYLIB) LINTXONLYLIB = $(LINTXONLY) #if HasMotif #ifndef MotifDir #define MotifDir /usr/X11R6 #endif #ifndef MotifDirStandard #define MotifDirStandard NO #endif #ifndef MotifLibDir # define MotifLibDir MotifDir/LibDirName # if MotifDirStandard # define MotifLibDirStandard YES # endif #endif #ifndef MotifLibDirStandard # define MotifLibDirStandard NO #endif #ifndef MotifIncDir # define MotifIncDir MotifDir/include # if MotifDirStandard # define MotifIncDirStandard YES # endif #endif #ifndef MotifIncDirStandard # define MotifIncDirStandard NO #endif MOTIFDIR = MotifDir MOTIFLIBDIR = MotifLibDir MOTIFINCDIR = MotifIncDir #if MotifLibDirStandard MOTIFLIB = -lXm #else MOTIFLIB = -L$(MOTIFLIBDIR) LinkerRuntimeLibraryPathFlag($(MOTIFLIBDIR)) -lXm #endif #if MotifIncDirStandard MOTIFINCLUDES = #else MOTIFINCLUDES = -I$(MOTIFINCDIR) #endif #endif /* HasMotif */ #ifndef LdLibraryPath #define LdLibraryPath LD_LIBRARY_PATH #endif #if BuildXKBlib # ifndef XkbClientDepLibs # define XkbClientDepLibs /**/ # endif # ifndef XkbClientLibs # define XkbClientLibs /**/ # endif #else /* !BuildXKBlib */ # ifndef XkbClientDepLibs # define XkbClientDepLibs # endif # ifndef XkbClientLibs # define XkbClientLibs # endif #endif /* BuildXKBlib */ #ifndef NeedDefaultDepLibs #define NeedDefaultDepLibs YES #endif #if NeedDefaultDepLibs /* * Individual libraries should override this */ #if HasSharedLibraries || defined(UseInstalled) DEPLIBS = $(DEPXLIB) #else DEPLIBS = $(LOCAL_LIBRARIES) #endif DEPLIBS1 = $(DEPLIBS) DEPLIBS2 = $(DEPLIBS) DEPLIBS3 = $(DEPLIBS) DEPLIBS4 = $(DEPLIBS) DEPLIBS5 = $(DEPLIBS) DEPLIBS6 = $(DEPLIBS) DEPLIBS7 = $(DEPLIBS) DEPLIBS8 = $(DEPLIBS) DEPLIBS9 = $(DEPLIBS) DEPLIBS10 = $(DEPLIBS) #endif /* NeedDefaultDepLibs */ /* * InstallAppDefaults - simple rules to install application default file */ #ifndef InstallAppDefaults #define InstallAppDefaults(class) InstallAppDefaultsLong(class,class) #endif /* InstallAppDefaults */ /* * PostProcessTroffPS - by default moves the working output into place, * but can be a hook for more complicated post-processing. */ #ifndef PostProcessTroffPS #define PostProcessTroffPS(temp,real) $(MV) temp real #endif /* * PostProcessTroffHTML - by default moves the working output into place, * but can be a hook for more complicated post-processing. */ #ifndef PostProcessTroffHTML #define PostProcessTroffHTML(temp,real) $(MV) temp real #endif #ifdef HTMLroffCmd #define HtmlTarget(file) file.html #define HtmlClean(file) file.nhtml file.html file*.png #else #define HtmlTarget(file) /**/ #define HtmlClean(file) /**/ #endif #ifdef PsToPdfCmd #define PdfTarget(file) file.pdf #define PdfClean(file) file.pdf #else #define PdfTarget(file) /**/ #define PdfClean(file) /**/ #endif #ifndef ConvertPsToPdf #ifdef PsToPdfCmd #define ConvertPsToPdf(file) @@\ file.pdf: file.ps @@\ RemoveFile(file.pdf) @@\ $(PSTOPDFCMD) < file.ps > file.pdf #else #define ConvertPsToPdf(file) /**/ #endif #endif #if HasPdfLatex #define PdfLatexTarget(file) file.pdf #define PdfLatexClean(file) file.pdf #else #define PdfLatexTarget(file) /**/ #define PdfLatexClean(file) /**/ #endif #ifndef LatexToPdf #if HasPdfLatex && defined(PdfLatexCmd) #define LatexToPdf(file) @@\ file.pdf: file.tex @@\ RemoveFile(file.pdf) @@\ $(PDFLATEXCMD) file.tex #else #define LatexToPdf(file) /**/ #endif #endif #ifndef MakeDepSimpleHtmlDoc #ifdef HTMLroffCmd #define MakeDepSimpleHtmlDoc(file,deps,srcs) @@\ HtmlTarget(file): deps @@\ $(HTMLROFF) $(MSMACROS) $(XDOCMACROS) Concat(-P-I,file) srcs \ @@\ 2> index.raw > file.nhtml \ @@\ && PostProcessTroffHTML(file.nhtml,$@) #else #define MakeDepSimpleHtmlDoc(file,deps,srcs) /**/ #endif #endif #ifndef MakeTblHtmlDoc #ifdef HTMLroffCmd #define MakeTblHtmlDoc(file,srcs) @@\ file.html: srcs @@\ $(TBL) $(XDOCMACROS) srcs | $(HTMLROFF) $(MSMACROS) Concat(-P-I,file) \ @@\ 2> index.raw > file.nhtml \ @@\ && PostProcessTroffHTML(file.nhtml,$@) #else #define MakeTblHtmlDoc(file,srcs) /**/ #endif #endif #ifndef MakeEqnHtmlDoc #ifdef HTMLroffCmd #define MakeEqnHtmlDoc(file,srcs) @@\ file.html: srcs @@\ $(TBL) $(XDOCMACROS) srcs | $(EQN) | $(HTMLROFF) $(MSMACROS) Concat(-P-I,file) \ @@\ 2> index.raw > file.nhtml \ @@\ && PostProcessTroffHTML(file.nhtml,$@) #else #define MakeEqnHtmlDoc(file,srcs) /**/ #endif #endif #ifndef MakeDepSimpleDoc #define MakeDepSimpleDoc(file,deps,srcs) @@\ all:: file.ps file.txt HtmlTarget(file) PdfTarget(file) @@\ .PRECIOUS: file.ps @@\ @@\ file.ps: deps @@\ -$(TROFF) $(MSMACROS) $(XDOCMACROS) srcs \ @@\ 2> index.raw > file.nps \ @@\ && PostProcessTroffPS(file.nps,$@) @@\ @if grep '^[^1-9.]' index.raw | grep -v warning; then exit 1; \ @@\ else test $$? -le 1; fi @@\ @@\ file.txt: deps @@\ $(NROFF) $(MSMACROS) $(XDOCMACROS) srcs 2> index.raw | \ @@\ $(COL) $(COLFLAGS) > $@ @@\ @@\ MakeDepSimpleHtmlDoc(file,deps,srcs) @@\ @@\ ConvertPsToPdf(file) @@\ @@\ clean:: @@\ $(RM) index.raw file.nps file.ps file.txt HtmlClean(file) PdfClean(file) #endif #ifndef MakeSimpleDoc #define MakeSimpleDoc(file,srcs) MakeDepSimpleDoc(file,srcs,srcs) #endif #ifndef MakeTblDoc #define MakeTblDoc(file,srcs) @@\ all:: file.ps file.txt HtmlTarget(file) PdfTarget(file) @@\ .PRECIOUS: file.ps @@\ @@\ file.ps: srcs @@\ -$(TBL) $(XDOCMACROS) srcs | $(TROFF) $(MSMACROS) \ @@\ 2> index.raw > file.nps \ @@\ && PostProcessTroffPS(file.nps,$@) @@\ @if grep '^[^1-9.]' index.raw | grep -v warning; then exit 1; \ @@\ else test $$? -le 1; fi @@\ @@\ file.txt: srcs @@\ $(TBL) $(XDOCMACROS) srcs | $(NROFF) $(MSMACROS) 2> index.raw \ @@\ | $(COL) $(COLFLAGS) > $@ @@\ @@\ MakeTblHtmlDoc(file,srcs) @@\ @@\ ConvertPsToPdf(file) @@\ @@\ clean:: @@\ $(RM) index.raw file.nps file.ps file.txt HtmlClean(file) PdfClean(file) #endif #ifndef MakeEqnDoc #define MakeEqnDoc(file,srcs) @@\ all:: file.ps file.txt HtmlTarget(file) PdfTarget(file) @@\ .PRECIOUS: file.ps @@\ @@\ file.ps: srcs @@\ -$(TBL) $(XDOCMACROS) srcs | $(EQN) | $(TROFF) $(MSMACROS) \ @@\ 2> index.raw > file.nps \ @@\ && PostProcessTroffPS(file.nps,$@) @@\ @if grep '^[^1-9.]' index.raw | grep -v warning; then exit 1; \ @@\ else test $$? -le 1; fi @@\ @@\ file.txt: srcs @@\ $(TBL) $(XDOCMACROS) srcs | $(NEQN) | $(NROFF) $(MSMACROS) \ @@\ 2> index.raw | $(COL) $(COLFLAGS) > $@ @@\ @@\ MakeEqnHtmlDoc(file,srcs) @@\ @@\ ConvertPsToPdf(file) @@\ @@\ clean:: @@\ $(RM) index.raw file.nps file.ps file.txt HtmlClean(file) PdfClean(file) #endif #ifndef MakeDocIndex #define MakeDocIndex(file,srcs) @@\ all:: file.idx.ps @@\ @@\ file.idx.ps: srcs index.raw @@\ sed -n '$$p' index.raw > index.pageno @@\ grep '^[1-9]' index.raw | \ @@\ (sort -f '-t:' -k2,2 -k1,1n 2>/dev/null || \ @@\ sort -f '-t:' +1 -3 +0n -1n) | \ @@\ awk -f $(DOCUTILSRC)/fixindex.awk | \ @@\ awk -f $(DOCUTILSRC)/block.awk > index.troff @@\ cat srcs $(XIDXMACROS) index.troff | \ @@\ $(TROFF) -me > file.idx.nps && \ @@\ $(MV) file.idx.nps $@ @@\ $(RM) index.troff index.pageno @@\ @@\ clean:: @@\ $(RM) index.troff index.pageno file.idx.nps file.idx.ps #endif #ifndef MakeLatexDoc #if HasLatex #define MakeLatexDoc(file,src) @@\ all:: file.ps PdfLatexTarget(file) @@\ @@\ file.dvi: src @@\ $(LATEX) src @@\ @@\ file.ps: file.dvi @@\ $(DVIPS) -o file.nps file && $(MV) file.nps $@ @@\ @@\ LatexToPdf(file) @@\ @@\ clean:: @@\ RemoveFiles(file.nps file.ps file.dvi file.log) @@\ RemoveFiles(file.aux file.toc file.lof file.lot) @@\ $(RM) PdfLatexClean(file) #else /* HasLatex */ #define MakeLatexDoc(file,src) @@\ all:: @@\ file.ps: src @@\ @echo "cannot make file.ps: no latex on this system"; exit 1 #endif /* HasLatex (else) */ #endif /* MakeLatexDoc */ #ifndef InstallDoc #define InstallDoc(name,deps) @@\ install:: deps @@\ MakeDir($(DESTDIR)$(DOCPSDIR)) @@\ @if [ -f name.ps -a X$(NOPS) = X ]; then set -x; \ @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) name.ps \ @@\ $(DESTDIR)$(DOCPSDIR); \ @@\ fi ; RemoveOldFile(name.ps,name.PS,$(DOCPSDIR)) @@\ MakeDir($(DESTDIR)$(DOCDIR)) @@\ @if [ -f name.txt -a X$(NOTXT) = X ]; then set -x; \ @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) name.txt \ @@\ $(DESTDIR)$(DOCDIR); \ @@\ fi ; RemoveOldFile(name.txt,name.TXT,$(DOCDIR)) @@\ MakeDir($(DESTDIR)$(DOCHTMLDIR)) @@\ @if [ -f name.html -a X$(NOHTML) = X ]; then (set -x; \ @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) name.html \ @@\ $(DESTDIR)$(DOCHTMLDIR)); \ @@\ for i in name*.png; do \ @@\ if [ -f $$i ]; then (set -x; \ @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) $$i \ @@\ $(DESTDIR)$(DOCHTMLDIR)); \ @@\ fi; \ @@\ done; \ @@\ fi @@\ MakeDir($(DESTDIR)$(DOCPDFDIR)) @@\ @if [ -f name.pdf -a X$(NOPDF) = X ]; then set -x; \ @@\ $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) name.pdf \ @@\ $(DESTDIR)$(DOCPDFDIR); \ @@\ fi #endif #ifndef InstallRoffDoc #define InstallRoffDoc(name) InstallDoc(name,name.ps name.txt) #endif #ifndef InstallLatexDoc #if HasLatex #define InstallLatexDoc(name) InstallDoc(name,name.ps) #else #define InstallLatexDoc(name) #endif #endif #ifndef LinkHardcopyPS # if CaseSensitiveFileSystem # define LinkHardcopyPS(name) \ @if [ -f name.PS ]; then set -x; \ @@\ RemoveFile(name.ps); \ @@\ $(LN) name.PS name.ps; \ @@\ fi # else # define LinkHardcopyPS(name) # endif #endif #ifndef InstallHardcopyDoc #define InstallHardcopyDoc(name,deps) @@\ all:: name.ps PdfTarget(name) @@\ @@\ name.ps: deps @@\ @if [ -f name.PS.gz ]; then set -x; \ @@\ RemoveFile(name.ps); \ @@\ gzip -d < name.PS.gz > name.ps; \ @@\ fi @@\ LinkHardcopyPS(name) @@\ @@\ ConvertPsToPdf(name) @@\ @@\ clean:: @@\ $(RM) name.ps PdfClean(name) @@\ @@\ InstallDoc(name,deps) #endif XRENDERPRELOADPATTERN = libXrender.so.? XFONTPRELOADPATTERN = libXfont*.so.? nx-libs-3.5.99.23/nx-X11/config/cf/xf86.rules0000644000000000000000000000617413614532331015017 0ustar /* * Rules needed to build the XFree86 X Servers */ #ifndef ObjectMapIncludeFromSpecialSource #define ObjectMapIncludeFromSpecialSource(dst,src,flags) @@\ dst.c: src.c @@\ RemoveFile($@) @@\ echo "#include \"mfbmap.h\"" > $@ @@\ echo "#include \"$?\"" >> $@ @@\ @@\ SpecialCObjectRule(dst,NullParameter,flags) @@\ @@\ depend:: dst.c @@\ @@\ clean:: @@\ RemoveFile(dst.c) #endif /* * Rules for building config files from scripts */ #ifndef Depend # define Depend depend #endif #ifndef ConfigTargetLong #define ConfigTargetLong(target,dep,script,args,extra) @@\ all:: Configure @@\ @@\ Configure:: target.o @@\ @@\ target.c: script dep @@\ $(MAKE) $(MFLAGS) Makefile @@\ $(MAKE) $(MFLAGS) extra Concat(Build,target) @@\ @@\ Concat(Build,target): @@\ $(RM) target.c @@\ $(SHELL) script args @@\ @@\ clean:: @@\ $(RM) target.c #endif #define ConfigTarget(target,dep,script,args) ConfigTargetLong(target,dep,script,args,Depend) #define ConfigTargetNoDepend(target,dep,script,args) ConfigTargetLong(target,dep,script,args,) #ifndef DriverObjectList #define DriverObjectList(drivers,list) @@\ list: $(ICONFIGFILES) drivers @@\ RemoveFile(list) @@\ @echo Creating list for drivers; \ @@\ DRIVERS="drivers"; \ @@\ if [ x"$$DRIVERS" != x ]; then \ @@\ for i in $$DRIVERS; do \ @@\ DRIVER="$$i/*_drv.o"; \ @@\ for j in $$DRIVER; do \ @@\ echo $$j >> list; \ @@\ done; \ @@\ done; \ @@\ else \ @@\ echo "" > list; \ @@\ fi @@\ @@\ clean:: @@\ RemoveFile(list) #endif /* * Rules for installing Driver SDK parts (target is install.sdk) */ #ifndef InstallDriverSDKNonExecFile #define InstallDriverSDKNonExecFile(file,dest) /**/ #endif #ifndef InstallDriverSDKLibrary #define InstallDriverSDKLibrary(libname,dest) /**/ #endif #ifndef InstallDriverSDKNamedLibrary #define InstallDriverSDKNamedLibrary(libname,dlibname,dest) /**/ #endif #ifndef InstallDriverSDKNamedNonExec #define InstallDriverSDKNamedNonExec(srcname,dstname,dest) /**/ #endif #ifndef InstallDriverSDKNamedProg #define InstallDriverSDKNamedProg(srcname,dstname,dest) /**/ #endif #ifndef InstallDriverSDKSubdirs #define InstallDriverSDKSubdirs(dirs) /**/ #endif #ifndef InstallDriverSDKMultipleDestFlags #define InstallDriverSDKMultipleDestFlags(list,dest,flags) /**/ #endif #ifndef InstallDriverSDKDynamicModule #define InstallDriverSDKDynamicModule(module,dest,subdir) /**/ #endif #ifndef InstallDriverSDKObjectModule #define InstallDriverSDKObjectModule(module,dest,subdir) /**/ #endif #ifndef InstallDriverSDKObjectSubModule #define InstallDriverSDKObjectSubModule(module,dest,subdir) /**/ #endif #ifndef InstallDriverSDKLibraryModule #define InstallDriverSDKLibraryModule(module,dest,subdir) /**/ #endif #ifndef ServerDriverSDKTarget #define ServerDriverSDKTarget(program) /**/ #endif #ifndef InstallDriverSDKProgramWithFlags #define InstallDriverSDKProgramWithFlags(program,dest,flags) /**/ #endif nx-libs-3.5.99.23/nx-X11/config/cf/xorg.cf0000644000000000000000000004724113614532331014441 0ustar /* * This configuration file contains all of the configuration * information for the Xorg based X Servers. * * Most of these settings can be overridden in a vendor.cf or the * BeforeVendor part of the site.def file. */ /* Get and set version information. */ #include "xorgversion.def" #if !defined(XorgVersionString) && \ defined(XORG_VERSION_MAJOR) && defined(XORG_VERSION_MINOR) && \ defined(XORG_VERSION_PATCH) && defined(XORG_VERSION_SNAP) # if XORG_VERSION_SNAP == 0 # if XORG_VERSION_PATCH == 0 # define XorgVersionString `echo XORG_VERSION_MAJOR XORG_VERSION_MINOR | sed 's/ /./g'` # else # define XorgVersionString `echo XORG_VERSION_MAJOR XORG_VERSION_MINOR XORG_VERSION_PATCH | sed 's/ /./g'` # endif # else # define XorgVersionString `echo XORG_VERSION_MAJOR XORG_VERSION_MINOR XORG_VERSION_PATCH XORG_VERSION_SNAP | sed 's/ /./g'` # endif #endif #if !defined(XORG_DATE) && defined(XF86_DATE) # define XORG_DATE XF86_DATE #endif /* * Xorg versions are M.m.P.s, and XorgVersion is: * * M * 10000000 + m * 100000 + P * 1000 + s * */ #ifndef XorgVersion # define XorgVersion (((XORG_VERSION_MAJOR) * 10000000) + ((XORG_VERSION_MINOR) * 100000) + ((XORG_VERSION_PATCH) * 1000) + XORG_VERSION_SNAP) #endif #ifndef VersionDefines # define VersionDefines -DXORG_VERSION_CURRENT="$(XORG_VERSION_CURRENT)" #endif /* Place the version of the relevant changelog file here */ #ifndef ReleaseVersion # define ReleaseVersion RELEASE-1 #endif XORG_VERSION_CURRENT = XorgVersion RELEASE_VERSION = ReleaseVersion #if NXAgentServer #include "nxconfig.def" #include "nxcompile.def" #include "nxversion.def" #if !defined(nxVersionString) && \ defined(NX_VERSION_MAJOR) && defined(NX_VERSION_MINOR) && \ defined(NX_VERSION_MICRO) && defined(NX_VERSION_PATCH) #if defined(NX_VERSION_CUSTOM) # define nxVersionString NX_VERSION_CUSTOM (`echo NX_VERSION_MAJOR NX_VERSION_MINOR NX_VERSION_MICRO NX_VERSION_PATCH | sed 's/ /./g'`) #else # define nxVersionString `echo NX_VERSION_MAJOR NX_VERSION_MINOR NX_VERSION_MICRO NX_VERSION_PATCH | sed 's/ /./g'` #endif #endif /* * NX versions are M.m.µ.p, and NXVersion is: * * M * 10000000 + m * 100000 + µ * 1000 + p * */ #if !defined(nxVersion) && defined(nxVersionString) # define nxVersion (((NX_VERSION_MAJOR) * 10000000) + ((NX_VERSION_MINOR) * 100000) + ((NX_VERSION_MICRO) * 1000) + NX_VERSION_PATCH) NX_VERSION_CURRENT = nxVersion NX_VERSION_CURRENT_STRING = nxVersionString #endif #endif /* NXAgentServer */ #if !defined(XorgManVersionString) && \ defined(XORG_VERSION_MAJOR) && defined(XORG_VERSION_MINOR) && \ defined(XORG_VERSION_PATCH) && defined(XORG_VERSION_SNAP) # if XORG_VERSION_SNAP == 0 #define XorgManVersionString `echo XORG_VERSION_MAJOR XORG_VERSION_MINOR XORG_VERSION_PATCH | sed -e 's/ /./g' -e 's/^/Version\\\ /'` #else #define XorgManVersionString `echo XORG_VERSION_MAJOR XORG_VERSION_MINOR XORG_VERSION_PATCH XORG_VERSION_SNAP | sed -e 's/ /./g' -e 's/^/Version\\\ /'` # endif #endif #if !defined(XorgDateString) && defined(XORG_DATE) # define XorgDateString XORG_DATE #endif #if !defined(XFree86DateString) && defined(XorgDateString) # define XFree86DateString XorgDateString #endif #ifndef BuildDateCmd # define BuildDateCmd date +%Y%m%d #endif #if !defined(BuildDate) # define BuildDate `BuildDateCmd` #endif #ifndef ChangelogDateCmd # define ChangelogDateCmd if tail $(CHANGELOGFILE) 2>/dev/null | \ @@\ fgrep '$$XdotOrg:' >/dev/null 2>&1; then \ @@\ tail $(CHANGELOGFILE) | fgrep '$$XdotOrg:' | \ @@\ sed s,'.* \([0-9][0-9]*\)/\([0-9][0-9]*\)/\([0-9][0-9]*\).*,\1\2\3,'; \ @@\ else echo 0; fi #endif #if !defined(ChangelogDate) # define ChangelogDate `ChangelogDateCmd` #endif #ifndef XVendorString # define XVendorString "The X.Org Foundation" #endif #ifndef XVendorRelease # define XVendorRelease XorgVersion #endif #ifndef XVendorManVersionString #define XVendorManVersionString XorgManVersionString #endif #ifndef XVendorManNameString #define XVendorManNameString X.Org #endif /* * This enables some settings for developers. */ #ifndef XFree86Devel # if !defined(PatheticCpp) || !PatheticCpp # if (XorgVersion % 1000) # define XFree86Devel YES # else # define XFree86Devel NO # endif # else # define XFree86Devel NO /* Assume the worst */ # endif #endif #ifndef BuildDebug # define BuildDebug YES #endif /* * settings for the config file parser */ #ifndef XConfigFile #define XConfigFile xorg.conf #endif #ifndef XConfigDir #define XConfigDir $(LIBDIR) #endif #ifndef XLogFile #define XLogFile Xorg #endif #ifndef XServerName # define XServerName Xorg #endif /* * BuildXFree86ConfigTools: * * Turning this on allows the XFree86 config tools to build when * BuildServersOnly is YES. This requires more than the servonly CVS * module. This cannot be used to disable building the config tools with * a full build. */ #ifndef BuildXFree86ConfigTools #ifdef BuildServersOnly #define BuildXFree86ConfigTools !BuildServersOnly #else #define BuildXFree86ConfigTools YES #endif #endif #ifndef BuildLibrariesForConfigTools #define BuildLibrariesForConfigTools BuildXFree86ConfigTools #endif #if BuildXFree86ConfigTools && BuildLibrariesForConfigTools #define BuildLibraries YES #define BuildXKBlib YES #endif /* * When this is set, modules are always built separately from the libraries * that statically link into an Xserver. This is for platforms where the * module and native object formats are different (e.g., OS/2). */ #ifndef BuildModuleInSubdir #define BuildModuleInSubdir NO #endif /* * Default settings for which X Servers to build. */ /* OS.cf files may set this for OS-specific input drivers */ #ifndef OSXInputDrivers #define OSXInputDrivers /**/ #endif /* This may be set in host.def for 3rd party input drivers */ #ifndef ExtraXInputDrivers #define ExtraXInputDrivers /**/ #endif /* XInput drivers */ #ifndef XInputDrivers #define XInputDrivers mouse keyboard acecad calcomp citron \ digitaledge dmc dynapro elographics tek4957 \ microtouch mutouch penmount spaceorb summa \ wacom void magellan /* magictouch */ hyperpen \ jamstudio fpit \ palmax OSXInputDrivers ExtraXInputDrivers #endif /* Deprecated keyboard driver */ #ifndef UseDeprecatedKeyboardDriver #define UseDeprecatedKeyboardDriver NO #endif /* support mainly for USB support */ #ifndef HasLinuxInput # define HasLinuxInput NO #endif /* * Many architectures share common X Server pieces. List them here. */ #if defined(i386Architecture) || defined(ia64Architecture) || \ defined(AMD64Architecture) || defined(SparcArchitecture) || \ defined(Sparc64Architecture) || defined(MipsArchitecture) || \ defined(AlphaArchitecture) || defined(PpcArchitecture) || \ defined(Ppc64Architecture) || defined(Ppc64LeArchitecture) || \ defined(Mc68020Architecture) || defined(Arm32Architecture) || \ defined(HPArchitecture) || defined(SuperHArchitecture) # ifndef XorgServer # define XorgServer YES # endif /* 1bpp module */ # ifndef XF1Bpp # define XF1Bpp YES # endif /* 4bpp module */ # ifndef XF4Bpp # define XF4Bpp YES # endif /* 8/32bpp overlay module */ # ifndef XF8_32Bpp # define XF8_32Bpp YES # endif /* 8/16bpp dual fb module */ # ifndef XF8_16Bpp # define XF8_16Bpp YES # endif /* shadow fb module */ # ifndef XFShadowFB # define XFShadowFB YES # endif /* fbdevhw module */ # ifndef XF86FBDevHw # define XF86FBDevHw YES # endif /* XAA module */ # ifndef XF86XAA # define XF86XAA YES # endif /* Exa module */ # ifndef XF86EXA # define XF86EXA YES # endif /* ramdac module */ # ifndef XF86Ramdac # define XF86Ramdac YES # endif /* I2C module */ # ifndef XF86I2C # define XF86I2C YES # endif /* DDC module */ # ifndef XF86DDC # define XF86DDC YES # endif /* RAC (Resource Access Control) module */ # ifndef XF86RAC # define XF86RAC YES # endif /* int10 module */ # ifndef XF86Int10 # define XF86Int10 YES # endif /* vbe module */ # ifndef XF86VBE # define XF86VBE YES # endif #endif /* * For Mips/Arc platforms, the default is to build all modules which * are supported on this platform. */ #ifdef ArcArchitecture # ifndef XorgServer # define XorgServer YES # endif #endif #if BuildDebug # define DebugDefines -DBUILDDEBUG #else # define DebugDefines /**/ #endif #ifndef XorgServer # define XorgServer NO #endif /* * Fbdev module defines. They are set to indicate the fb types supported * on different architectures. */ #ifndef XF86AFB # define XF86AFB NO #endif #ifndef XF86ILBM # define XF86ILBM NO #endif #ifndef XF86IPLAN2P2 # define XF86IPLAN2P2 NO #endif #ifndef XF86IPLAN2P4 # define XF86IPLAN2P4 NO #endif #ifndef XF86IPLAN2P8 # define XF86IPLAN2P8 NO #endif #if XF86AFB AFB_DEFS = -DUSE_AFB #endif #if XF86ILBM ILBM_DEFS = -DUSE_ILBM #endif #if XF86IPLAN2P2 IPLAN2P2_DEFS = -DUSE_IPLAN2P2 #endif #if XF86IPLAN2P4 IPLAN2P4_DEFS = -DUSE_IPLAN2P4 #endif #if XF86IPLAN2P8 IPLAN2P8_DEFS = -DUSE_IPLAN2P8 #endif #ifndef FbdevDefines # define FbdevDefines $(AFB_DEFS) $(ILBM_DEFS) $(IPLAN2P2_DEFS) \ $(IPLAN2P4_DEFS) $(IPLAN2P8_DEFS) #endif /* * Build GLX server interface * --- Doesn't work for 1-bit and 4-bit servers */ #ifndef BuildGlxExt # define BuildGlxExt YES #endif #if BuildGlxExt # define GlxCoreLibDefines -DGLX_USE_MESA # if defined(SparcArchitecture) \ || defined (Sparc64Architecture) \ || defined(ia64Architecture) \ || defined(s390xArchitecture) \ || defined(AMD64Architecture) # define GlxArchDefines -D__GLX_ALIGN64 # elif defined(AlphaArchitecture) /* On the Alpha we need to ensure floating point accuracy for 3D */ # define GlxArchDefines -D__GLX_ALIGN64 -mieee # elif defined(DarwinArchitecture) /* GLX contains lots of uninitialized globals, which can upset Darwin */ # define GlxArchDefines -fno-common # else # define GlxArchDefines /**/ # endif # ifndef GlxExtraDefines # define GlxExtraDefines GlxCoreLibDefines GlxArchDefines # endif #endif # ifndef UseX86Emu # define UseX86Emu YES # endif #define X86INT10_STUB 0 #define X86EMU_GENERIC 1 #define X86VM 2 #define X86EMU_OS 3 #ifndef XF86INT10_BUILD # if UseX86Emu # define XF86INT10_BUILD X86EMU_GENERIC # else # define XF86INT10_BUILD X86INT10_STUB # endif #endif #ifndef BuildRECORDlib # define BuildRECORDlib YES #endif #ifndef BuildXKBlib # define BuildXKBlib YES #endif #ifndef HasXfont2 # define HasXfont2 NO #endif #ifndef HasLegacyXfont1 # define HasLegacyXfont1 NO #endif #ifndef HasLegacyXextProto # define HasLegacyXextProto NO #endif #ifndef BuildScreenSaverExt # define BuildScreenSaverExt YES #endif /* * Build XInput support */ #ifndef BuildXInputExt # define BuildXInputExt YES #endif /* Build Xinerama (aka panoramiX) extension */ #ifndef BuildXinerama # define BuildXinerama YES #endif /* Build Render extension */ #ifndef BuildRender # define BuildRender YES #endif #if 0 #ifndef JoystickSupport # define JoystickSupport NO #endif #endif /* * Build the XFree86-Bigfont extension */ #ifndef BuildXF86BigfontExt # define BuildXF86BigfontExt YES #endif /* * Build the DPMS extension support */ #ifndef BuildDPMSExt # define BuildDPMSExt YES #endif /* * Build the X Video Extension */ #ifndef BuildXvExt # define BuildXvExt YES #endif /* * Build the X Video Motion Compensation Extension */ #ifndef BuildXvMCExt # define BuildXvMCExt YES #endif /* * Build the X-Resource Extension */ #ifndef BuildXResExt # define BuildXResExt YES #endif #if Malloc0ReturnsNull # ifndef XtMalloc0ReturnsNullDefines # define XtMalloc0ReturnsNullDefines Malloc0ReturnsNullDefines -DXTMALLOC_BC # endif #endif #ifndef HasDlsymBug # define HasDlsymBug NO #endif #ifndef HasMTRRSupport # define HasMTRRSupport NO #endif /* * Build scanpci? */ #ifndef SystemV #define SystemV NO #endif #ifndef SystemV4 #define SystemV4 NO #endif #ifndef BuildScanpci # if SystemV || SystemV4 || \ (defined(LinuxArchitecture) && !defined(Mc68020Architecture)) || \ defined(i386BsdArchitecture) || \ defined(GNUMachArchitecture) || \ (defined(KFreeBSDArchitecture) && defined(i386Architecture)) # define BuildScanpci YES # else # define BuildScanpci NO # endif #endif /* Disable stripping installed programs for this release. */ #ifndef StripInstalledPrograms # define StripInstalledPrograms NO #endif #ifndef InstallJapaneseDocs #define InstallJapaneseDocs NO #endif #if BuildXvExt # define XFree86XvDefines -DXvExtension #else # define XFree86XvDefines /**/ #endif #if BuildXvMCExt # define XFree86XvMCDefines -DXvMCExtension #else # define XFree86XvMCDefines /**/ #endif #if BuildXResExt # define XFree86XResDefines -DXResExtension #else # define XFree86XResDefines /**/ #endif #ifndef DlopenHack # define DlopenHack -DDLOPEN_HACK #endif #ifndef ExtraLoaderDefines # define ExtraLoaderDefines /**/ #endif #ifndef HasBsdMake #define HasBsdMake NO #endif #ifndef MakeHasPosixVariableSubstitutions # if !HasBsdMake && !defined(SunArchitecture) # define MakeHasPosixVariableSubstitutions NO # else # define MakeHasPosixVariableSubstitutions YES # endif #endif /* Server defines required for all OSs */ #ifndef XFree86ServerDefines # define XFree86ServerDefines -DAVOID_GLYPHBLT -DPIXPRIV -DSINGLEDEPTH \ XFree86XvDefines \ -DXFree86Server \ XFree86XvMCDefines \ DebugDefines XFree86XResDefines \ -DX_BYTE_ORDER=$(X_BYTE_ORDER) \ VersionDefines #endif #ifndef XFree86ServerOSDefines # define XFree86ServerOSDefines -DDDXOSINIT -DSERVER_LOCK -DDDXOSFATALERROR \ -DDDXOSVERRORF -DCLIENTIDS #endif #ifndef XFree86ConsoleDefines # if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) || (defined(KFreeBSDArchitecture) && defined(i386Architecture)) # define XFree86ConsoleDefines -DPCCONS_SUPPORT -DSYSCONS_SUPPORT -DPCVT_SUPPORT # elif defined(KFreeBSDArchitecture) # define XFree86ConsoleDefines -DSYSCONS_SUPPORT # else # define XFree86ConsoleDefines /**/ # endif #endif /* Support for USB mouse */ #ifndef UsbMouseSupport # define UsbMouseSupport NO #endif /* Does this OS have libusb ? */ #ifndef HasLibUsb # define HasLibUsb NO #endif #ifndef UseServerLock # define UseServerLock YES #endif #ifndef ServerExtraDefines # define ServerExtraDefines XFree86ServerDefines #endif #ifndef ServerOSDefines # define ServerOSDefines XFree86ServerOSDefines #endif #ifndef DriverSDKDir # define DriverSDKDir $(USRLIBDIR)/Server #endif #ifndef DriverSDKModuleDir # define DriverSDKModuleDir $(USRLIBDIR)/Server/modules #endif #ifndef DriverSDKIncludeDir # define DriverSDKIncludeDir $(USRLIBDIR)/Server/include #endif DRIVERSDKDIR = DriverSDKDir DRIVERSDKMODULEDIR = DriverSDKModuleDir DRIVERSDKINCLUDEDIR = DriverSDKIncludeDir /* * Some commonly referred to directories are defined here. */ XF86SRC = $(SERVERSRC)/hw/xfree86 XF86COMSRC = $(XF86SRC)/common XF86PARSERSRC = $(XF86SRC)/parser XF86OSSRC = $(XF86SRC)/os-support XF86DRIVERSRC = $(XF86SRC)/drivers DRIVERSRC = $(XF86DRIVERSRC) /* * Installed location of the XFree86 documentation */ XFREE86DOCDIR = $(DOCDIR) XFREE86PSDOCDIR = $(DOCPSDIR) XFREE86PDFDOCDIR = $(DOCPDFDIR) XFREE86HTMLDOCDIR = $(DOCHTMLDIR) XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese /* * Other stuff used in the X Server source. */ #ifndef OtherIConfigFiles # define OtherIConfigFiles $(IRULESRC)/xf86.rules #endif #ifndef ManSuffix # define ManSuffix 1 #endif /* * GNU Compiler stuff */ #ifndef HasGcc3 # define HasGcc3 NO #endif #ifndef HasGcc2 # define HasGcc2 HasGcc3 #endif #ifndef HasGcc # define HasGcc HasGcc2 #endif #ifndef HasGcc2ForCplusplus # define HasGcc2ForCplusplus HasGcc2 #endif #if HasGcc # ifndef Gcc28Warnings # if (GccMajorVersion > 2) || \ ((GccMajorVersion == 2) && (GccMinorVersion >= 8)) # define Gcc28Warnings -Wundef # else # define Gcc28Warnings /* */ # endif # ifndef HasGcc34 # if (((GccMajorVersion == 3) && (GccMinorVersion >= 4)) || \ (GccMajorVersion > 3)) # define HasGcc34 YES # else # define HasGcc34 NO # endif # endif # endif # ifndef GccWarningOptions # if XFree86Devel # define GccWarningOptions -Wall -Wpedantic -Wpointer-arith -Wstrict-prototypes \ -Wmissing-prototypes -Wmissing-declarations \ -Wredundant-decls -Wnested-externs -Wshadow Gcc28Warnings # else # define GccWarningOptions -Wall -Wpedantic -Wpointer-arith -Wshadow Gcc28Warnings # endif # endif # ifndef DefaultCCOptions # if defined(UseInstalled) # define DefaultCCOptions /* -std=c99 */ # else # define DefaultCCOptions -std=c99 GccWarningOptions # endif # endif # if defined(UseInstalled) # ifndef UseGccMakeDepend # define UseGccMakeDepend YES # endif # endif #endif /* Make imake noisier. Note that this is ineffective for 3.0 <= GCC <= 3.2 */ #ifndef ImakeWarningFlags # ifdef Gcc28Warnings # define ImakeWarningFlags Gcc28Warnings # else # define ImakeWarningFlags /* */ # endif #endif #if ((GccMajorVersion == 3) && (GccMinorVersion >= 1)) || (GccMajorVersion > 3) # define GccAliasingArgs -fno-strict-aliasing #else # define GccAliasingArgs /* */ #endif #if HasGcc2 && defined(i386Architecture) # ifndef DefaultGcc2i386Opt # define DefaultGcc2i386Opt -O2 -fno-strength-reduce GccAliasingArgs # endif #endif #if HasGcc2 && defined(AMD64Architecture) # ifndef DefaultGcc2AMD64Opt # define DefaultGcc2AMD64Opt -O2 -fno-strength-reduce GccAliasingArgs # endif #endif #if HasGcc2 && defined(AlphaArchitecture) # ifndef DefaultGcc2AxpOpt # define DefaultGcc2AxpOpt -O2 GccAliasingArgs # endif #endif #if HasGcc2 && (defined(Ppc64Architecture) || defined(Ppc64LeArchitecture)) # ifndef DefaultGcc2Ppc64Opt # define DefaultGcc2Ppc64Opt -O2 GccAliasingArgs # endif #endif #if HasGcc2 && defined(MipsArchitecture) # ifndef DefaultGcc2MipsOpt # define DefaultGcc2MipsOpt -O2 GccAliasingArgs # endif #endif #if HasGcc2 && defined(PpcArchitecture) # ifndef DefaultGcc2PpcOpt # define DefaultGcc2PpcOpt -O2 GccAliasingArgs # endif #endif #ifndef DefaultGcc2DebugOpt # define DefaultGcc2DebugOpt -g #endif #ifndef DebuggableLibraries # define DebuggableLibraries NO #endif #if HasGcc2 && DebuggableLibraries # define LibraryDebugOpt DefaultGcc2DebugOpt #endif /* * Some versions of gcc have optimisation bugs that cause problems building * some files. The definitions here cover those. */ #ifndef Egcs112Bug /* Not exactly precise, but it'll do for now... */ # if HasGcc2 && defined(i386Architecture) && \ (GccMajorVersion == 2) && (GccMinorVersion > 8) # define Egcs112Bug YES # else # define Egcs112Bug NO # endif #endif #ifdef i386Architecture # ifndef HasX86Support # define HasX86Support YES # endif # ifndef HasMMXSupport # define HasMMXSupport YES # endif # ifndef HasSSESupport # define HasSSESupport NO # endif # ifndef Has3DNowSupport # define Has3DNowSupport NO # endif #elif defined (AMD64Architecture) # ifndef HasX86Support # define HasX86Support NO # endif # ifndef HasMMXSupport # define HasMMXSupport NO # endif # ifndef HasSSESupport # define HasSSESupport NO # endif # ifndef Has3DNowSupport # define Has3DNowSupport NO # endif #else # ifndef HasX86Support # define HasX86Support NO # endif # ifndef HasMMXSupport # define HasMMXSupport NO # endif # ifndef HasSSESupport # define HasSSESupport NO # endif # ifndef Has3DNowSupport # define Has3DNowSupport NO # endif #endif #ifndef StaticNeedsPicForShared # if defined (AMD64Architecture)\ || defined (AlphaArchitecture) \ || defined (ia64Architecture) \ || defined (PpcArchitecture) \ || defined (SparcArchitecture) \ || defined (s390xArchitecture) # define StaticNeedsPicForShared YES # else # define StaticNeedsPicForShared NO # endif #endif #if (defined(SparcArchitecture) || defined(Sparc64Architecture)) \ && !defined(LargePositionIndependentCFlags) \ && defined(HasGcc) # define LargePositionIndependentCFlags -fPIC #endif #ifndef XF8_32Wid # define XF8_32Wid NO #endif #if CrossCompiling #include #endif #include nx-libs-3.5.99.23/nx-X11/config/cf/xorgsite.def0000644000000000000000000002267713614532331015502 0ustar /******************************************************************************/ /* * This file is to provide a quick method for most people to change the * behaviour of their Xorg installation without having to fully * understand the workings of site.def and all the various '.cf' files. * * In the vast majority of cases, it should not be necessary to use this * file at all or change it in any way. * * This file is divided into two sections. The first contains settings * that end-users might reasonably change. The second contains settings * that developers might want to change. * * IMPORTANT NOTE: In all cases changing the defaults may cause problems * and/or unexpected side-effects. If you don't understand what a setting * does, then it's best to not change it. If you make changes and have * problems, verify that those problems are also present when using an * empty host.def file and unchanged version of this file before reporting * them. * * A good way to use this file is to copy it to host.def, and make the * changes there. That way, future patches to this file won't fail. * The host.def file will never be patched. * * The distributed version of this file MUST contain no uncommented * definitions. Default definitions belong in xorg.cf, or .cf * files. */ /******************************************************************************/ /* * If you have build-specific modifications in your host.def file, but * want an empty host.def file installed when doing 'make install', * uncomment the following * #define InstallEmptyHostDef */ /* * Which servers to build. There is only Xorg server. * It can be disabled by the following. * #define XorgServer NO */ /* * Set the default server (ie the one that gets the sym-link to "X") * #define ServerToInstall Xorg */ /* * Server configuration parameters. The defaults are shown here: */ /* * Select the XInput devices you want by uncommenting this. * #define XInputDrivers mouse keyboard acecad calcomp citron \ digitaledge dmc dynapro elographics \ microtouch mutouch penmount spaceorb summa \ wacom void magictouch aiptek */ /* * To use the deprecated, old keyboard driver, uncomment this. But * even better, make the new keyboard driver (hw/xfree86/input/keyboard) * work for your architecture. The old driver will be removed in the * next release. * #define UseDeprecatedKeyboardDriver YES */ /* * To build only the servers with a cut-down source tree, uncomment * this. * #define BuildServersOnly YES */ /* * Undefine the following if you don't want to have config files and * app-defaults installed in a separate directory (i.e. /etc/X11). * #define UseSeparateConfDir NO */ /* * Unless you're a developer you shouldn't need to change anything * beyond this point. */ /* * If you want to enable some developer settings, like more verbose * compiler warnings, uncomment this. * #define XFree86Devel YES */ /* * The default optimisation flags for GCC 2.x. -fno-strength-reduce is * here to work around a bug in -O2 for GCC 2.x on i386 platforms. * If you are using a version that doesn't have this bug, you can * uncomment the following line, and remove '-fno-strength-reduce' * If you are building binaries for a 486, it may be beneficial to add * -m486 * #define DefaultGcc2i386Opt -O2 -fno-strength-reduce */ /* * This allows the GCC warning flags to be set. The default is shown here. * #define GccWarningOptions -Wall -Wpedantic -Wpointer-arith -Wstrict-prototypes \ -Wmissing-prototypes -Wmissing-declarations \ -Wredundant-decls -Wnested-externs -Wshadow */ /* * Sun Compiler stuff.. * #define HasSunC YES #define HasSunCplusplus YES #define CplusplusCompilerMajorVersion 5 #define CplusplusCompilerMinorVersion 0 #define CCompilerMajorVersion 5 #define CCompilerMinorVersion 0 */ /* * Optimized Sun Compiler Build. * #define DefaultCDebugFlags -xO4 -xtarget=pentium_pro #define OptimizedCDebugFlags -xO4 -xtarget=pentium_pro */ /* * Debuggable Sun Compiler Build. * Note: This builds _EVERYTHING_ as debuggable * #define DefaultCDebugFlags -g -xs #define OptimizedCDebugFlags -g -xs */ /* * For Linux, this should match the Binutils version you have. This example * is for 2.6.0.7. See linux.cf for the default setting. * * This should automatically get set correctly by imake. * #define LinuxBinUtilsMajorVersion 26 */ /* * For Linux, these should match the libc version you have. This example * is for libc.5.4.x. See linux.cf for the default setting. * * This should automatically get set correctly by imake. * #define LinuxCLibMajorVersion 5 #define LinuxClibMinorVersion 4 */ /* * Some Linux releases don't have a libtermcap. In this case you may need * to uncomment the following * #define TermcapLibrary -lncurses */ /* * Build XAA. This can be disabled with: * #define XF86XAA NO */ /* * Build vgahw. This can be disabled with: * #define XF86VgaHw NO */ /* * Build xf1bpp. This can be disabled with: * #define XF1Bpp NO */ /* * Build xf4bpp. This can be disabled with: * #define XF4Bpp NO */ /* * BSD Console driver support (for FreeBSD and NetBSD). * * By default, support is included for pccons and pcvt for NetBSD, and * pccons, syscons and pcvt for FreeBSD. * * To change the list of supported drivers, set the following parameter. * Possible values are -DPCCONS_SUPPORT, -DSYSCONS_SUPPORT, -DPCVT_SUPPORT. * The following example includes support for syscons and pcvt only. * #define XFree86ConsoleDefines -DSYSCONS_SUPPORT -DPCVT_SUPPORT */ /* * To disable building XInput support, uncomment this * #define BuildXInputExt NO */ /* * Uncomment this for joystick support. * * Note: Joystick support is broken, so don't enable this. * #define JoystickSupport YES */ /* * To disable the ScreenSaver Extension, uncomment this line. * #define BuildScreenSaverExt NO */ /* * If you don't want to build Xinerama support, uncomment this. * #define BuildXinerama NO */ /* * If you don't want to build support for the GLX extension, uncomment this. * #define BuildGlxExt NO */ /* * If you are running NetBSD 0.9C or later, and have the aperture driver * installed, uncomment this. * #define HasNetBSDApertureDriver YES */ /* * If you are running SVR3 and have the mmap driver installed (for linear * framebuffer access) uncomment this. * #define HasSVR3mmapDrv YES */ /* * If you are using an SVR3 (like ISC 4.x) which supports long file names, * you can uncomment this to have manual pages installed under their * full names * #define ExpandManNames YES */ /* * For a POSIXized build on Interactive uncomment this * Could be used with gcc 'till Version 2.6.3 * Should be used with gcc 2.7.2. * #define UsePosix YES */ /* * If you don't want XDMAUTH support (if you don't have Wraphelp.c), * comment this out. * */ #define HasXdmAuth YES /* * To build static and shared libraries with debugging information, uncomment * this. Assumes you have Gcc2. * (If you don't have Gcc2, you can use the DebugLib{X11,...} variables * to build debugging versions of the libraries separately.) * #define DebuggableLibraries YES */ /* * To forceably build static libraries in addition to shared libraries, * uncomment this. * #define ForceNormalLib YES */ /* * Uncomment this if your default tools (eg, gcc, ld, as, etc) are * not the Linux ELF versions. * #define LinuxElfDefault NO */ /* * To use ELF format shared libraries for supported OSs, uncomment this. * * For Linux the default setting of this is the same as the setting of * LinuxElfDefault. * * For FreeBSD this should automatically be set correctly by imake. Only * change it here if you need to override the automatic setting. * #define UseElfFormat YES */ /* * For FreeBSD/ELF (FreeBSD 3.0) it is possible to also build and install * a.out compatibility libraries. To enable that, uncomment this. * #define BuildAoutLibraries YES */ /* * If you have trouble with make bombing out in Xlib, try uncommenting this. * You will not get dependencies as a result, but better than nothing. * #define MakeHashTableBug YES */ /* * If you do not want your man pages compress under SVR3 systems that * support it, uncomment this. * #define CompressManPages NO */ /* * If you have sgmlfmt (the XFree86 doctools package) and want to build * formatted docs from the SGML source, uncomment this. * #define HasSgmlFmt YES */ /* * To disable building some document formats, uncomment some of these. * #define BuildLinuxDocText NO #define BuildLinuxDocHtml NO #define BuildLinuxDocPS NO */ /* * To install Japanese versions of the documentation uncomment this. * Note: The Japanese documentation consists of a subset of the * XFree86 3.1 docs. * #define InstallJapaneseDocs YES */ /* * To build/install X specs docs, uncomment the following. * The SpecsDocDirs setting here is recommended because it covers * the docs that XFree86 has changed or added. * #define BuildSpecsDocs YES #define SpecsDocDirs CTEXT GL ICCCM X11 Xext Xmu Xv XvMC i18n */ /* * To build all specs docs, not just those listed in SpecsDocDirs, uncomment * the following. * #define BuildAllSpecsDocs YES */ /* * If your system doesn't support vm86() mode and you have * libx86emu set library path here * #define X86EMU_LIBPATH /usr/local/lib */ nx-libs-3.5.99.23/nx-X11/config/cf/xorg.tmpl0000644000000000000000000000336013614532331015017 0ustar #ifndef ConfigDefines # define ConfigDefines -D__XCONFIGFILE__='"$(XCONFIGFILE)"' \ -D__XCONFIGDIR__='"$(XCONFIGDIR)"' -D__XLOGFILE__='"$(XLOGFILE)"' \ -D__XSERVERNAME__='"$(XSERVERNAME)"' #endif CONFIG_DEFINES = ConfigDefines #ifndef ServerDefines #define ServerDefines StandardDefines VersionDefines #endif #ifdef BuilderEMailAddr BUILDERADDR = BuilderEMailAddr #else BUILDERADDR = "xorg@lists.freedesktop.org" #endif #ifdef VendorSupportAddress VENDORSUPPORT = VendorSupportAddress BUGMSG = -DBUILDERADDR='$(BUILDERADDR)' -DVENDORSUPPORT='$(VENDORSUPPORT)' #else BUGMSG = -DBUILDERADDR='$(BUILDERADDR)' #endif #if defined(XF86DriverSDK) BUILDMODULEDIR = $(DRIVERSDKMODULEDIR) BUILDMODULETOP = .. TOP_INCLUDES = TopIncludes IMAKE_DEFINES = -DXF86DriverSDK=1 #ifdef UseInstalled IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(TOP) -I$(IRULESRC) \ $(IMAKE_DEFINES) $(IMAKE_WARNINGS) #else IMAKE_CMD = $(IMAKE) -I$(TOP) -I$(IRULESRC) \ $(IMAKE_DEFINES) $(IMAKE_WARNINGS) #endif #undef ImakeSubCmdHelper #ifdef UseInstalled #define ImakeSubCmdHelper $(IMAKE) -DUseInstalled -I$(IMAKETOP) \ -I$(IRULESRC) $(IMAKE_DEFINES) $(IMAKE_WARNINGS) #else #define ImakeSubCmdHelper $(IMAKEPREFIX)$(IMAKE) -I$(IMAKETOP) \ $(IMAKE_DEFINES) $(IMAKE_WARNINGS) \ -I$(IMAKEPREFIX)$(IRULESRC) #endif #endif #ifndef JoystickSupport #define JoystickSupport NO #endif /* * Module support: These overrides must be here, not in xf86.rules, * because they will replace rules after having seen the first lines * of Imakefile (include ) */ #ifndef ProPoliceSupport #define ProPoliceSupport O #endif #ifndef HasGccMergeConstants #define HasGccMergeConstants NO #endif MODULE_CFLAGS = $(MODULE_PIC_FLAGS) $(MODULE_GCC_FLAGS) nx-libs-3.5.99.23/nx-X11/config/cf/xorgversion.def0000644000000000000000000000023113614532331016201 0ustar #define XORG_VERSION_MAJOR 6 #define XORG_VERSION_MINOR 9 #define XORG_VERSION_PATCH 0 #define XORG_VERSION_SNAP 0 #define XORG_DATE "21 December 2005" nx-libs-3.5.99.23/nx-X11/config/Imakefile0000644000000000000000000000054313614532331014363 0ustar #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" #undef BootstrapCleanSubdirs #define BootstrapCleanSubdirs BOOTSTRAPSUBDIRS="$(BOOTSTRAPSUBDIRS)" NULL = SUBDIRS = cf #if defined(XorgVersionString) \ && defined(ProjectRoot) && \ defined(BuildBindist) all:: clean:: #endif MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) nx-libs-3.5.99.23/nx-X11/extras/Mesa/include/GL/glext.h0000644000000000000000000121467013614532424016735 0ustar #ifndef __glext_h_ #define __glext_h_ #ifdef __cplusplus extern "C" { #endif /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) ** version 1.2.1 Specification. */ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) #define WIN32_LEAN_AND_MEAN 1 #include #endif #ifndef APIENTRY #define APIENTRY #endif #ifndef APIENTRYP #define APIENTRYP APIENTRY * #endif #ifndef GLAPI #define GLAPI extern #endif /*************************************************************/ /* Header file version number, required by OpenGL ABI for Linux */ /* glext.h last updated 2005/06/20 */ /* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ #define GL_GLEXT_VERSION 29 #ifndef GL_VERSION_1_2 #define GL_UNSIGNED_BYTE_3_3_2 0x8032 #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 #define GL_UNSIGNED_INT_8_8_8_8 0x8035 #define GL_UNSIGNED_INT_10_10_10_2 0x8036 #define GL_RESCALE_NORMAL 0x803A #define GL_TEXTURE_BINDING_3D 0x806A #define GL_PACK_SKIP_IMAGES 0x806B #define GL_PACK_IMAGE_HEIGHT 0x806C #define GL_UNPACK_SKIP_IMAGES 0x806D #define GL_UNPACK_IMAGE_HEIGHT 0x806E #define GL_TEXTURE_3D 0x806F #define GL_PROXY_TEXTURE_3D 0x8070 #define GL_TEXTURE_DEPTH 0x8071 #define GL_TEXTURE_WRAP_R 0x8072 #define GL_MAX_3D_TEXTURE_SIZE 0x8073 #define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 #define GL_UNSIGNED_SHORT_5_6_5 0x8363 #define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 #define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 #define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 #define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 #define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 #define GL_BGR 0x80E0 #define GL_BGRA 0x80E1 #define GL_MAX_ELEMENTS_VERTICES 0x80E8 #define GL_MAX_ELEMENTS_INDICES 0x80E9 #define GL_CLAMP_TO_EDGE 0x812F #define GL_TEXTURE_MIN_LOD 0x813A #define GL_TEXTURE_MAX_LOD 0x813B #define GL_TEXTURE_BASE_LEVEL 0x813C #define GL_TEXTURE_MAX_LEVEL 0x813D #define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 #define GL_SINGLE_COLOR 0x81F9 #define GL_SEPARATE_SPECULAR_COLOR 0x81FA #define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 #define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 #define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 #define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 #define GL_ALIASED_POINT_SIZE_RANGE 0x846D #define GL_ALIASED_LINE_WIDTH_RANGE 0x846E #endif #ifndef GL_ARB_imaging #define GL_CONSTANT_COLOR 0x8001 #define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 #define GL_CONSTANT_ALPHA 0x8003 #define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 #define GL_BLEND_COLOR 0x8005 #define GL_FUNC_ADD 0x8006 #define GL_MIN 0x8007 #define GL_MAX 0x8008 #define GL_BLEND_EQUATION 0x8009 #define GL_FUNC_SUBTRACT 0x800A #define GL_FUNC_REVERSE_SUBTRACT 0x800B #define GL_CONVOLUTION_1D 0x8010 #define GL_CONVOLUTION_2D 0x8011 #define GL_SEPARABLE_2D 0x8012 #define GL_CONVOLUTION_BORDER_MODE 0x8013 #define GL_CONVOLUTION_FILTER_SCALE 0x8014 #define GL_CONVOLUTION_FILTER_BIAS 0x8015 #define GL_REDUCE 0x8016 #define GL_CONVOLUTION_FORMAT 0x8017 #define GL_CONVOLUTION_WIDTH 0x8018 #define GL_CONVOLUTION_HEIGHT 0x8019 #define GL_MAX_CONVOLUTION_WIDTH 0x801A #define GL_MAX_CONVOLUTION_HEIGHT 0x801B #define GL_POST_CONVOLUTION_RED_SCALE 0x801C #define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D #define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E #define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F #define GL_POST_CONVOLUTION_RED_BIAS 0x8020 #define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 #define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 #define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 #define GL_HISTOGRAM 0x8024 #define GL_PROXY_HISTOGRAM 0x8025 #define GL_HISTOGRAM_WIDTH 0x8026 #define GL_HISTOGRAM_FORMAT 0x8027 #define GL_HISTOGRAM_RED_SIZE 0x8028 #define GL_HISTOGRAM_GREEN_SIZE 0x8029 #define GL_HISTOGRAM_BLUE_SIZE 0x802A #define GL_HISTOGRAM_ALPHA_SIZE 0x802B #define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C #define GL_HISTOGRAM_SINK 0x802D #define GL_MINMAX 0x802E #define GL_MINMAX_FORMAT 0x802F #define GL_MINMAX_SINK 0x8030 #define GL_TABLE_TOO_LARGE 0x8031 #define GL_COLOR_MATRIX 0x80B1 #define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 #define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 #define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 #define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 #define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 #define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 #define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 #define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 #define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA #define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB #define GL_COLOR_TABLE 0x80D0 #define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 #define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 #define GL_PROXY_COLOR_TABLE 0x80D3 #define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 #define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 #define GL_COLOR_TABLE_SCALE 0x80D6 #define GL_COLOR_TABLE_BIAS 0x80D7 #define GL_COLOR_TABLE_FORMAT 0x80D8 #define GL_COLOR_TABLE_WIDTH 0x80D9 #define GL_COLOR_TABLE_RED_SIZE 0x80DA #define GL_COLOR_TABLE_GREEN_SIZE 0x80DB #define GL_COLOR_TABLE_BLUE_SIZE 0x80DC #define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD #define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE #define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF #define GL_CONSTANT_BORDER 0x8151 #define GL_REPLICATE_BORDER 0x8153 #define GL_CONVOLUTION_BORDER_COLOR 0x8154 #endif #ifndef GL_VERSION_1_3 #define GL_TEXTURE0 0x84C0 #define GL_TEXTURE1 0x84C1 #define GL_TEXTURE2 0x84C2 #define GL_TEXTURE3 0x84C3 #define GL_TEXTURE4 0x84C4 #define GL_TEXTURE5 0x84C5 #define GL_TEXTURE6 0x84C6 #define GL_TEXTURE7 0x84C7 #define GL_TEXTURE8 0x84C8 #define GL_TEXTURE9 0x84C9 #define GL_TEXTURE10 0x84CA #define GL_TEXTURE11 0x84CB #define GL_TEXTURE12 0x84CC #define GL_TEXTURE13 0x84CD #define GL_TEXTURE14 0x84CE #define GL_TEXTURE15 0x84CF #define GL_TEXTURE16 0x84D0 #define GL_TEXTURE17 0x84D1 #define GL_TEXTURE18 0x84D2 #define GL_TEXTURE19 0x84D3 #define GL_TEXTURE20 0x84D4 #define GL_TEXTURE21 0x84D5 #define GL_TEXTURE22 0x84D6 #define GL_TEXTURE23 0x84D7 #define GL_TEXTURE24 0x84D8 #define GL_TEXTURE25 0x84D9 #define GL_TEXTURE26 0x84DA #define GL_TEXTURE27 0x84DB #define GL_TEXTURE28 0x84DC #define GL_TEXTURE29 0x84DD #define GL_TEXTURE30 0x84DE #define GL_TEXTURE31 0x84DF #define GL_ACTIVE_TEXTURE 0x84E0 #define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 #define GL_MAX_TEXTURE_UNITS 0x84E2 #define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 #define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 #define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 #define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 #define GL_MULTISAMPLE 0x809D #define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E #define GL_SAMPLE_ALPHA_TO_ONE 0x809F #define GL_SAMPLE_COVERAGE 0x80A0 #define GL_SAMPLE_BUFFERS 0x80A8 #define GL_SAMPLES 0x80A9 #define GL_SAMPLE_COVERAGE_VALUE 0x80AA #define GL_SAMPLE_COVERAGE_INVERT 0x80AB #define GL_MULTISAMPLE_BIT 0x20000000 #define GL_NORMAL_MAP 0x8511 #define GL_REFLECTION_MAP 0x8512 #define GL_TEXTURE_CUBE_MAP 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A #define GL_PROXY_TEXTURE_CUBE_MAP 0x851B #define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C #define GL_COMPRESSED_ALPHA 0x84E9 #define GL_COMPRESSED_LUMINANCE 0x84EA #define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB #define GL_COMPRESSED_INTENSITY 0x84EC #define GL_COMPRESSED_RGB 0x84ED #define GL_COMPRESSED_RGBA 0x84EE #define GL_TEXTURE_COMPRESSION_HINT 0x84EF #define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 #define GL_TEXTURE_COMPRESSED 0x86A1 #define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 #define GL_CLAMP_TO_BORDER 0x812D #define GL_COMBINE 0x8570 #define GL_COMBINE_RGB 0x8571 #define GL_COMBINE_ALPHA 0x8572 #define GL_SOURCE0_RGB 0x8580 #define GL_SOURCE1_RGB 0x8581 #define GL_SOURCE2_RGB 0x8582 #define GL_SOURCE0_ALPHA 0x8588 #define GL_SOURCE1_ALPHA 0x8589 #define GL_SOURCE2_ALPHA 0x858A #define GL_OPERAND0_RGB 0x8590 #define GL_OPERAND1_RGB 0x8591 #define GL_OPERAND2_RGB 0x8592 #define GL_OPERAND0_ALPHA 0x8598 #define GL_OPERAND1_ALPHA 0x8599 #define GL_OPERAND2_ALPHA 0x859A #define GL_RGB_SCALE 0x8573 #define GL_ADD_SIGNED 0x8574 #define GL_INTERPOLATE 0x8575 #define GL_SUBTRACT 0x84E7 #define GL_CONSTANT 0x8576 #define GL_PRIMARY_COLOR 0x8577 #define GL_PREVIOUS 0x8578 #define GL_DOT3_RGB 0x86AE #define GL_DOT3_RGBA 0x86AF #endif #ifndef GL_VERSION_1_4 #define GL_BLEND_DST_RGB 0x80C8 #define GL_BLEND_SRC_RGB 0x80C9 #define GL_BLEND_DST_ALPHA 0x80CA #define GL_BLEND_SRC_ALPHA 0x80CB #define GL_POINT_SIZE_MIN 0x8126 #define GL_POINT_SIZE_MAX 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 #define GL_POINT_DISTANCE_ATTENUATION 0x8129 #define GL_GENERATE_MIPMAP 0x8191 #define GL_GENERATE_MIPMAP_HINT 0x8192 #define GL_DEPTH_COMPONENT16 0x81A5 #define GL_DEPTH_COMPONENT24 0x81A6 #define GL_DEPTH_COMPONENT32 0x81A7 #define GL_MIRRORED_REPEAT 0x8370 #define GL_FOG_COORDINATE_SOURCE 0x8450 #define GL_FOG_COORDINATE 0x8451 #define GL_FRAGMENT_DEPTH 0x8452 #define GL_CURRENT_FOG_COORDINATE 0x8453 #define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 #define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 #define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 #define GL_FOG_COORDINATE_ARRAY 0x8457 #define GL_COLOR_SUM 0x8458 #define GL_CURRENT_SECONDARY_COLOR 0x8459 #define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A #define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B #define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C #define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D #define GL_SECONDARY_COLOR_ARRAY 0x845E #define GL_MAX_TEXTURE_LOD_BIAS 0x84FD #define GL_TEXTURE_FILTER_CONTROL 0x8500 #define GL_TEXTURE_LOD_BIAS 0x8501 #define GL_INCR_WRAP 0x8507 #define GL_DECR_WRAP 0x8508 #define GL_TEXTURE_DEPTH_SIZE 0x884A #define GL_DEPTH_TEXTURE_MODE 0x884B #define GL_TEXTURE_COMPARE_MODE 0x884C #define GL_TEXTURE_COMPARE_FUNC 0x884D #define GL_COMPARE_R_TO_TEXTURE 0x884E #endif #ifndef GL_VERSION_1_5 #define GL_BUFFER_SIZE 0x8764 #define GL_BUFFER_USAGE 0x8765 #define GL_QUERY_COUNTER_BITS 0x8864 #define GL_CURRENT_QUERY 0x8865 #define GL_QUERY_RESULT 0x8866 #define GL_QUERY_RESULT_AVAILABLE 0x8867 #define GL_ARRAY_BUFFER 0x8892 #define GL_ELEMENT_ARRAY_BUFFER 0x8893 #define GL_ARRAY_BUFFER_BINDING 0x8894 #define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 #define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 #define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 #define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 #define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 #define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A #define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B #define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C #define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D #define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E #define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F #define GL_READ_ONLY 0x88B8 #define GL_WRITE_ONLY 0x88B9 #define GL_READ_WRITE 0x88BA #define GL_BUFFER_ACCESS 0x88BB #define GL_BUFFER_MAPPED 0x88BC #define GL_BUFFER_MAP_POINTER 0x88BD #define GL_STREAM_DRAW 0x88E0 #define GL_STREAM_READ 0x88E1 #define GL_STREAM_COPY 0x88E2 #define GL_STATIC_DRAW 0x88E4 #define GL_STATIC_READ 0x88E5 #define GL_STATIC_COPY 0x88E6 #define GL_DYNAMIC_DRAW 0x88E8 #define GL_DYNAMIC_READ 0x88E9 #define GL_DYNAMIC_COPY 0x88EA #define GL_SAMPLES_PASSED 0x8914 #define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE #define GL_FOG_COORD GL_FOG_COORDINATE #define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE #define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE #define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE #define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER #define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY #define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING #define GL_SRC0_RGB GL_SOURCE0_RGB #define GL_SRC1_RGB GL_SOURCE1_RGB #define GL_SRC2_RGB GL_SOURCE2_RGB #define GL_SRC0_ALPHA GL_SOURCE0_ALPHA #define GL_SRC1_ALPHA GL_SOURCE1_ALPHA #define GL_SRC2_ALPHA GL_SOURCE2_ALPHA #endif #ifndef GL_VERSION_2_0 #define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION #define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 #define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 #define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 #define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 #define GL_CURRENT_VERTEX_ATTRIB 0x8626 #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 #define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 #define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 #define GL_STENCIL_BACK_FUNC 0x8800 #define GL_STENCIL_BACK_FAIL 0x8801 #define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 #define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 #define GL_MAX_DRAW_BUFFERS 0x8824 #define GL_DRAW_BUFFER0 0x8825 #define GL_DRAW_BUFFER1 0x8826 #define GL_DRAW_BUFFER2 0x8827 #define GL_DRAW_BUFFER3 0x8828 #define GL_DRAW_BUFFER4 0x8829 #define GL_DRAW_BUFFER5 0x882A #define GL_DRAW_BUFFER6 0x882B #define GL_DRAW_BUFFER7 0x882C #define GL_DRAW_BUFFER8 0x882D #define GL_DRAW_BUFFER9 0x882E #define GL_DRAW_BUFFER10 0x882F #define GL_DRAW_BUFFER11 0x8830 #define GL_DRAW_BUFFER12 0x8831 #define GL_DRAW_BUFFER13 0x8832 #define GL_DRAW_BUFFER14 0x8833 #define GL_DRAW_BUFFER15 0x8834 #define GL_BLEND_EQUATION_ALPHA 0x883D #define GL_POINT_SPRITE 0x8861 #define GL_COORD_REPLACE 0x8862 #define GL_MAX_VERTEX_ATTRIBS 0x8869 #define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A #define GL_MAX_TEXTURE_COORDS 0x8871 #define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 #define GL_FRAGMENT_SHADER 0x8B30 #define GL_VERTEX_SHADER 0x8B31 #define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 #define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A #define GL_MAX_VARYING_FLOATS 0x8B4B #define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C #define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D #define GL_SHADER_TYPE 0x8B4F #define GL_FLOAT_VEC2 0x8B50 #define GL_FLOAT_VEC3 0x8B51 #define GL_FLOAT_VEC4 0x8B52 #define GL_INT_VEC2 0x8B53 #define GL_INT_VEC3 0x8B54 #define GL_INT_VEC4 0x8B55 #define GL_BOOL 0x8B56 #define GL_BOOL_VEC2 0x8B57 #define GL_BOOL_VEC3 0x8B58 #define GL_BOOL_VEC4 0x8B59 #define GL_FLOAT_MAT2 0x8B5A #define GL_FLOAT_MAT3 0x8B5B #define GL_FLOAT_MAT4 0x8B5C #define GL_SAMPLER_1D 0x8B5D #define GL_SAMPLER_2D 0x8B5E #define GL_SAMPLER_3D 0x8B5F #define GL_SAMPLER_CUBE 0x8B60 #define GL_SAMPLER_1D_SHADOW 0x8B61 #define GL_SAMPLER_2D_SHADOW 0x8B62 #define GL_DELETE_STATUS 0x8B80 #define GL_COMPILE_STATUS 0x8B81 #define GL_LINK_STATUS 0x8B82 #define GL_VALIDATE_STATUS 0x8B83 #define GL_INFO_LOG_LENGTH 0x8B84 #define GL_ATTACHED_SHADERS 0x8B85 #define GL_ACTIVE_UNIFORMS 0x8B86 #define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 #define GL_SHADER_SOURCE_LENGTH 0x8B88 #define GL_ACTIVE_ATTRIBUTES 0x8B89 #define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A #define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B #define GL_SHADING_LANGUAGE_VERSION 0x8B8C #define GL_CURRENT_PROGRAM 0x8B8D #define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 #define GL_LOWER_LEFT 0x8CA1 #define GL_UPPER_LEFT 0x8CA2 #define GL_STENCIL_BACK_REF 0x8CA3 #define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 #define GL_STENCIL_BACK_WRITEMASK 0x8CA5 #endif #ifndef GL_ARB_multitexture #define GL_TEXTURE0_ARB 0x84C0 #define GL_TEXTURE1_ARB 0x84C1 #define GL_TEXTURE2_ARB 0x84C2 #define GL_TEXTURE3_ARB 0x84C3 #define GL_TEXTURE4_ARB 0x84C4 #define GL_TEXTURE5_ARB 0x84C5 #define GL_TEXTURE6_ARB 0x84C6 #define GL_TEXTURE7_ARB 0x84C7 #define GL_TEXTURE8_ARB 0x84C8 #define GL_TEXTURE9_ARB 0x84C9 #define GL_TEXTURE10_ARB 0x84CA #define GL_TEXTURE11_ARB 0x84CB #define GL_TEXTURE12_ARB 0x84CC #define GL_TEXTURE13_ARB 0x84CD #define GL_TEXTURE14_ARB 0x84CE #define GL_TEXTURE15_ARB 0x84CF #define GL_TEXTURE16_ARB 0x84D0 #define GL_TEXTURE17_ARB 0x84D1 #define GL_TEXTURE18_ARB 0x84D2 #define GL_TEXTURE19_ARB 0x84D3 #define GL_TEXTURE20_ARB 0x84D4 #define GL_TEXTURE21_ARB 0x84D5 #define GL_TEXTURE22_ARB 0x84D6 #define GL_TEXTURE23_ARB 0x84D7 #define GL_TEXTURE24_ARB 0x84D8 #define GL_TEXTURE25_ARB 0x84D9 #define GL_TEXTURE26_ARB 0x84DA #define GL_TEXTURE27_ARB 0x84DB #define GL_TEXTURE28_ARB 0x84DC #define GL_TEXTURE29_ARB 0x84DD #define GL_TEXTURE30_ARB 0x84DE #define GL_TEXTURE31_ARB 0x84DF #define GL_ACTIVE_TEXTURE_ARB 0x84E0 #define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 #define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 #endif #ifndef GL_ARB_transpose_matrix #define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 #define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 #define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 #define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 #endif #ifndef GL_ARB_multisample #define GL_MULTISAMPLE_ARB 0x809D #define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E #define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F #define GL_SAMPLE_COVERAGE_ARB 0x80A0 #define GL_SAMPLE_BUFFERS_ARB 0x80A8 #define GL_SAMPLES_ARB 0x80A9 #define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA #define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB #define GL_MULTISAMPLE_BIT_ARB 0x20000000 #endif #ifndef GL_ARB_texture_env_add #endif #ifndef GL_ARB_texture_cube_map #define GL_NORMAL_MAP_ARB 0x8511 #define GL_REFLECTION_MAP_ARB 0x8512 #define GL_TEXTURE_CUBE_MAP_ARB 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A #define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B #define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C #endif #ifndef GL_ARB_texture_compression #define GL_COMPRESSED_ALPHA_ARB 0x84E9 #define GL_COMPRESSED_LUMINANCE_ARB 0x84EA #define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB #define GL_COMPRESSED_INTENSITY_ARB 0x84EC #define GL_COMPRESSED_RGB_ARB 0x84ED #define GL_COMPRESSED_RGBA_ARB 0x84EE #define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF #define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 #define GL_TEXTURE_COMPRESSED_ARB 0x86A1 #define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 #endif #ifndef GL_ARB_texture_border_clamp #define GL_CLAMP_TO_BORDER_ARB 0x812D #endif #ifndef GL_ARB_point_parameters #define GL_POINT_SIZE_MIN_ARB 0x8126 #define GL_POINT_SIZE_MAX_ARB 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 #define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 #endif #ifndef GL_ARB_vertex_blend #define GL_MAX_VERTEX_UNITS_ARB 0x86A4 #define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 #define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 #define GL_VERTEX_BLEND_ARB 0x86A7 #define GL_CURRENT_WEIGHT_ARB 0x86A8 #define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 #define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA #define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB #define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC #define GL_WEIGHT_ARRAY_ARB 0x86AD #define GL_MODELVIEW0_ARB 0x1700 #define GL_MODELVIEW1_ARB 0x850A #define GL_MODELVIEW2_ARB 0x8722 #define GL_MODELVIEW3_ARB 0x8723 #define GL_MODELVIEW4_ARB 0x8724 #define GL_MODELVIEW5_ARB 0x8725 #define GL_MODELVIEW6_ARB 0x8726 #define GL_MODELVIEW7_ARB 0x8727 #define GL_MODELVIEW8_ARB 0x8728 #define GL_MODELVIEW9_ARB 0x8729 #define GL_MODELVIEW10_ARB 0x872A #define GL_MODELVIEW11_ARB 0x872B #define GL_MODELVIEW12_ARB 0x872C #define GL_MODELVIEW13_ARB 0x872D #define GL_MODELVIEW14_ARB 0x872E #define GL_MODELVIEW15_ARB 0x872F #define GL_MODELVIEW16_ARB 0x8730 #define GL_MODELVIEW17_ARB 0x8731 #define GL_MODELVIEW18_ARB 0x8732 #define GL_MODELVIEW19_ARB 0x8733 #define GL_MODELVIEW20_ARB 0x8734 #define GL_MODELVIEW21_ARB 0x8735 #define GL_MODELVIEW22_ARB 0x8736 #define GL_MODELVIEW23_ARB 0x8737 #define GL_MODELVIEW24_ARB 0x8738 #define GL_MODELVIEW25_ARB 0x8739 #define GL_MODELVIEW26_ARB 0x873A #define GL_MODELVIEW27_ARB 0x873B #define GL_MODELVIEW28_ARB 0x873C #define GL_MODELVIEW29_ARB 0x873D #define GL_MODELVIEW30_ARB 0x873E #define GL_MODELVIEW31_ARB 0x873F #endif #ifndef GL_ARB_matrix_palette #define GL_MATRIX_PALETTE_ARB 0x8840 #define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 #define GL_MAX_PALETTE_MATRICES_ARB 0x8842 #define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 #define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 #define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 #define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 #define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 #define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 #define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 #endif #ifndef GL_ARB_texture_env_combine #define GL_COMBINE_ARB 0x8570 #define GL_COMBINE_RGB_ARB 0x8571 #define GL_COMBINE_ALPHA_ARB 0x8572 #define GL_SOURCE0_RGB_ARB 0x8580 #define GL_SOURCE1_RGB_ARB 0x8581 #define GL_SOURCE2_RGB_ARB 0x8582 #define GL_SOURCE0_ALPHA_ARB 0x8588 #define GL_SOURCE1_ALPHA_ARB 0x8589 #define GL_SOURCE2_ALPHA_ARB 0x858A #define GL_OPERAND0_RGB_ARB 0x8590 #define GL_OPERAND1_RGB_ARB 0x8591 #define GL_OPERAND2_RGB_ARB 0x8592 #define GL_OPERAND0_ALPHA_ARB 0x8598 #define GL_OPERAND1_ALPHA_ARB 0x8599 #define GL_OPERAND2_ALPHA_ARB 0x859A #define GL_RGB_SCALE_ARB 0x8573 #define GL_ADD_SIGNED_ARB 0x8574 #define GL_INTERPOLATE_ARB 0x8575 #define GL_SUBTRACT_ARB 0x84E7 #define GL_CONSTANT_ARB 0x8576 #define GL_PRIMARY_COLOR_ARB 0x8577 #define GL_PREVIOUS_ARB 0x8578 #endif #ifndef GL_ARB_texture_env_crossbar #endif #ifndef GL_ARB_texture_env_dot3 #define GL_DOT3_RGB_ARB 0x86AE #define GL_DOT3_RGBA_ARB 0x86AF #endif #ifndef GL_ARB_texture_mirrored_repeat #define GL_MIRRORED_REPEAT_ARB 0x8370 #endif #ifndef GL_ARB_depth_texture #define GL_DEPTH_COMPONENT16_ARB 0x81A5 #define GL_DEPTH_COMPONENT24_ARB 0x81A6 #define GL_DEPTH_COMPONENT32_ARB 0x81A7 #define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A #define GL_DEPTH_TEXTURE_MODE_ARB 0x884B #endif #ifndef GL_ARB_shadow #define GL_TEXTURE_COMPARE_MODE_ARB 0x884C #define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D #define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E #endif #ifndef GL_ARB_shadow_ambient #define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF #endif #ifndef GL_ARB_window_pos #endif #ifndef GL_ARB_vertex_program #define GL_COLOR_SUM_ARB 0x8458 #define GL_VERTEX_PROGRAM_ARB 0x8620 #define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 #define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 #define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 #define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 #define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 #define GL_PROGRAM_LENGTH_ARB 0x8627 #define GL_PROGRAM_STRING_ARB 0x8628 #define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E #define GL_MAX_PROGRAM_MATRICES_ARB 0x862F #define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 #define GL_CURRENT_MATRIX_ARB 0x8641 #define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 #define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 #define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 #define GL_PROGRAM_ERROR_POSITION_ARB 0x864B #define GL_PROGRAM_BINDING_ARB 0x8677 #define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 #define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A #define GL_PROGRAM_ERROR_STRING_ARB 0x8874 #define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 #define GL_PROGRAM_FORMAT_ARB 0x8876 #define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 #define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 #define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 #define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 #define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 #define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 #define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 #define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 #define GL_PROGRAM_PARAMETERS_ARB 0x88A8 #define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 #define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA #define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB #define GL_PROGRAM_ATTRIBS_ARB 0x88AC #define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD #define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE #define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF #define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 #define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 #define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 #define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 #define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 #define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 #define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 #define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 #define GL_MATRIX0_ARB 0x88C0 #define GL_MATRIX1_ARB 0x88C1 #define GL_MATRIX2_ARB 0x88C2 #define GL_MATRIX3_ARB 0x88C3 #define GL_MATRIX4_ARB 0x88C4 #define GL_MATRIX5_ARB 0x88C5 #define GL_MATRIX6_ARB 0x88C6 #define GL_MATRIX7_ARB 0x88C7 #define GL_MATRIX8_ARB 0x88C8 #define GL_MATRIX9_ARB 0x88C9 #define GL_MATRIX10_ARB 0x88CA #define GL_MATRIX11_ARB 0x88CB #define GL_MATRIX12_ARB 0x88CC #define GL_MATRIX13_ARB 0x88CD #define GL_MATRIX14_ARB 0x88CE #define GL_MATRIX15_ARB 0x88CF #define GL_MATRIX16_ARB 0x88D0 #define GL_MATRIX17_ARB 0x88D1 #define GL_MATRIX18_ARB 0x88D2 #define GL_MATRIX19_ARB 0x88D3 #define GL_MATRIX20_ARB 0x88D4 #define GL_MATRIX21_ARB 0x88D5 #define GL_MATRIX22_ARB 0x88D6 #define GL_MATRIX23_ARB 0x88D7 #define GL_MATRIX24_ARB 0x88D8 #define GL_MATRIX25_ARB 0x88D9 #define GL_MATRIX26_ARB 0x88DA #define GL_MATRIX27_ARB 0x88DB #define GL_MATRIX28_ARB 0x88DC #define GL_MATRIX29_ARB 0x88DD #define GL_MATRIX30_ARB 0x88DE #define GL_MATRIX31_ARB 0x88DF #endif #ifndef GL_ARB_fragment_program #define GL_FRAGMENT_PROGRAM_ARB 0x8804 #define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 #define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 #define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 #define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 #define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 #define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A #define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B #define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C #define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D #define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E #define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F #define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 #define GL_MAX_TEXTURE_COORDS_ARB 0x8871 #define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 #endif #ifndef GL_ARB_vertex_buffer_object #define GL_BUFFER_SIZE_ARB 0x8764 #define GL_BUFFER_USAGE_ARB 0x8765 #define GL_ARRAY_BUFFER_ARB 0x8892 #define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 #define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 #define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 #define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 #define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 #define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 #define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 #define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A #define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B #define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C #define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D #define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E #define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F #define GL_READ_ONLY_ARB 0x88B8 #define GL_WRITE_ONLY_ARB 0x88B9 #define GL_READ_WRITE_ARB 0x88BA #define GL_BUFFER_ACCESS_ARB 0x88BB #define GL_BUFFER_MAPPED_ARB 0x88BC #define GL_BUFFER_MAP_POINTER_ARB 0x88BD #define GL_STREAM_DRAW_ARB 0x88E0 #define GL_STREAM_READ_ARB 0x88E1 #define GL_STREAM_COPY_ARB 0x88E2 #define GL_STATIC_DRAW_ARB 0x88E4 #define GL_STATIC_READ_ARB 0x88E5 #define GL_STATIC_COPY_ARB 0x88E6 #define GL_DYNAMIC_DRAW_ARB 0x88E8 #define GL_DYNAMIC_READ_ARB 0x88E9 #define GL_DYNAMIC_COPY_ARB 0x88EA #endif #ifndef GL_ARB_occlusion_query #define GL_QUERY_COUNTER_BITS_ARB 0x8864 #define GL_CURRENT_QUERY_ARB 0x8865 #define GL_QUERY_RESULT_ARB 0x8866 #define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 #define GL_SAMPLES_PASSED_ARB 0x8914 #endif #ifndef GL_ARB_shader_objects #define GL_PROGRAM_OBJECT_ARB 0x8B40 #define GL_SHADER_OBJECT_ARB 0x8B48 #define GL_OBJECT_TYPE_ARB 0x8B4E #define GL_OBJECT_SUBTYPE_ARB 0x8B4F #define GL_FLOAT_VEC2_ARB 0x8B50 #define GL_FLOAT_VEC3_ARB 0x8B51 #define GL_FLOAT_VEC4_ARB 0x8B52 #define GL_INT_VEC2_ARB 0x8B53 #define GL_INT_VEC3_ARB 0x8B54 #define GL_INT_VEC4_ARB 0x8B55 #define GL_BOOL_ARB 0x8B56 #define GL_BOOL_VEC2_ARB 0x8B57 #define GL_BOOL_VEC3_ARB 0x8B58 #define GL_BOOL_VEC4_ARB 0x8B59 #define GL_FLOAT_MAT2_ARB 0x8B5A #define GL_FLOAT_MAT3_ARB 0x8B5B #define GL_FLOAT_MAT4_ARB 0x8B5C #define GL_SAMPLER_1D_ARB 0x8B5D #define GL_SAMPLER_2D_ARB 0x8B5E #define GL_SAMPLER_3D_ARB 0x8B5F #define GL_SAMPLER_CUBE_ARB 0x8B60 #define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 #define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 #define GL_SAMPLER_2D_RECT_ARB 0x8B63 #define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 #define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 #define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 #define GL_OBJECT_LINK_STATUS_ARB 0x8B82 #define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 #define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 #define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 #define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 #define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 #define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 #endif #ifndef GL_ARB_vertex_shader #define GL_VERTEX_SHADER_ARB 0x8B31 #define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A #define GL_MAX_VARYING_FLOATS_ARB 0x8B4B #define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C #define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D #define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 #define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A #endif #ifndef GL_ARB_fragment_shader #define GL_FRAGMENT_SHADER_ARB 0x8B30 #define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 #define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B #endif #ifndef GL_ARB_shading_language_100 #define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C #endif #ifndef GL_ARB_texture_non_power_of_two #endif #ifndef GL_ARB_point_sprite #define GL_POINT_SPRITE_ARB 0x8861 #define GL_COORD_REPLACE_ARB 0x8862 #endif #ifndef GL_ARB_fragment_program_shadow #endif #ifndef GL_ARB_draw_buffers #define GL_MAX_DRAW_BUFFERS_ARB 0x8824 #define GL_DRAW_BUFFER0_ARB 0x8825 #define GL_DRAW_BUFFER1_ARB 0x8826 #define GL_DRAW_BUFFER2_ARB 0x8827 #define GL_DRAW_BUFFER3_ARB 0x8828 #define GL_DRAW_BUFFER4_ARB 0x8829 #define GL_DRAW_BUFFER5_ARB 0x882A #define GL_DRAW_BUFFER6_ARB 0x882B #define GL_DRAW_BUFFER7_ARB 0x882C #define GL_DRAW_BUFFER8_ARB 0x882D #define GL_DRAW_BUFFER9_ARB 0x882E #define GL_DRAW_BUFFER10_ARB 0x882F #define GL_DRAW_BUFFER11_ARB 0x8830 #define GL_DRAW_BUFFER12_ARB 0x8831 #define GL_DRAW_BUFFER13_ARB 0x8832 #define GL_DRAW_BUFFER14_ARB 0x8833 #define GL_DRAW_BUFFER15_ARB 0x8834 #endif #ifndef GL_ARB_texture_rectangle #define GL_TEXTURE_RECTANGLE_ARB 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 #define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 #endif #ifndef GL_ARB_color_buffer_float #define GL_RGBA_FLOAT_MODE_ARB 0x8820 #define GL_CLAMP_VERTEX_COLOR_ARB 0x891A #define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B #define GL_CLAMP_READ_COLOR_ARB 0x891C #define GL_FIXED_ONLY_ARB 0x891D #endif #ifndef GL_ARB_half_float_pixel #define GL_HALF_FLOAT_ARB 0x140B #endif #ifndef GL_ARB_texture_float #define GL_TEXTURE_RED_TYPE_ARB 0x8C10 #define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 #define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 #define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 #define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 #define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 #define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 #define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 #define GL_RGBA32F_ARB 0x8814 #define GL_RGB32F_ARB 0x8815 #define GL_ALPHA32F_ARB 0x8816 #define GL_INTENSITY32F_ARB 0x8817 #define GL_LUMINANCE32F_ARB 0x8818 #define GL_LUMINANCE_ALPHA32F_ARB 0x8819 #define GL_RGBA16F_ARB 0x881A #define GL_RGB16F_ARB 0x881B #define GL_ALPHA16F_ARB 0x881C #define GL_INTENSITY16F_ARB 0x881D #define GL_LUMINANCE16F_ARB 0x881E #define GL_LUMINANCE_ALPHA16F_ARB 0x881F #endif #ifndef GL_ARB_pixel_buffer_object #define GL_PIXEL_PACK_BUFFER_ARB 0x88EB #define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC #define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED #define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF #endif #ifndef GL_EXT_abgr #define GL_ABGR_EXT 0x8000 #endif #ifndef GL_EXT_blend_color #define GL_CONSTANT_COLOR_EXT 0x8001 #define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 #define GL_CONSTANT_ALPHA_EXT 0x8003 #define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 #define GL_BLEND_COLOR_EXT 0x8005 #endif #ifndef GL_EXT_polygon_offset #define GL_POLYGON_OFFSET_EXT 0x8037 #define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 #define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 #endif #ifndef GL_EXT_texture #define GL_ALPHA4_EXT 0x803B #define GL_ALPHA8_EXT 0x803C #define GL_ALPHA12_EXT 0x803D #define GL_ALPHA16_EXT 0x803E #define GL_LUMINANCE4_EXT 0x803F #define GL_LUMINANCE8_EXT 0x8040 #define GL_LUMINANCE12_EXT 0x8041 #define GL_LUMINANCE16_EXT 0x8042 #define GL_LUMINANCE4_ALPHA4_EXT 0x8043 #define GL_LUMINANCE6_ALPHA2_EXT 0x8044 #define GL_LUMINANCE8_ALPHA8_EXT 0x8045 #define GL_LUMINANCE12_ALPHA4_EXT 0x8046 #define GL_LUMINANCE12_ALPHA12_EXT 0x8047 #define GL_LUMINANCE16_ALPHA16_EXT 0x8048 #define GL_INTENSITY_EXT 0x8049 #define GL_INTENSITY4_EXT 0x804A #define GL_INTENSITY8_EXT 0x804B #define GL_INTENSITY12_EXT 0x804C #define GL_INTENSITY16_EXT 0x804D #define GL_RGB2_EXT 0x804E #define GL_RGB4_EXT 0x804F #define GL_RGB5_EXT 0x8050 #define GL_RGB8_EXT 0x8051 #define GL_RGB10_EXT 0x8052 #define GL_RGB12_EXT 0x8053 #define GL_RGB16_EXT 0x8054 #define GL_RGBA2_EXT 0x8055 #define GL_RGBA4_EXT 0x8056 #define GL_RGB5_A1_EXT 0x8057 #define GL_RGBA8_EXT 0x8058 #define GL_RGB10_A2_EXT 0x8059 #define GL_RGBA12_EXT 0x805A #define GL_RGBA16_EXT 0x805B #define GL_TEXTURE_RED_SIZE_EXT 0x805C #define GL_TEXTURE_GREEN_SIZE_EXT 0x805D #define GL_TEXTURE_BLUE_SIZE_EXT 0x805E #define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F #define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 #define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 #define GL_REPLACE_EXT 0x8062 #define GL_PROXY_TEXTURE_1D_EXT 0x8063 #define GL_PROXY_TEXTURE_2D_EXT 0x8064 #define GL_TEXTURE_TOO_LARGE_EXT 0x8065 #endif #ifndef GL_EXT_texture3D #define GL_PACK_SKIP_IMAGES_EXT 0x806B #define GL_PACK_IMAGE_HEIGHT_EXT 0x806C #define GL_UNPACK_SKIP_IMAGES_EXT 0x806D #define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E #define GL_TEXTURE_3D_EXT 0x806F #define GL_PROXY_TEXTURE_3D_EXT 0x8070 #define GL_TEXTURE_DEPTH_EXT 0x8071 #define GL_TEXTURE_WRAP_R_EXT 0x8072 #define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 #endif #ifndef GL_SGIS_texture_filter4 #define GL_FILTER4_SGIS 0x8146 #define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 #endif #ifndef GL_EXT_subtexture #endif #ifndef GL_EXT_copy_texture #endif #ifndef GL_EXT_histogram #define GL_HISTOGRAM_EXT 0x8024 #define GL_PROXY_HISTOGRAM_EXT 0x8025 #define GL_HISTOGRAM_WIDTH_EXT 0x8026 #define GL_HISTOGRAM_FORMAT_EXT 0x8027 #define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 #define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 #define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A #define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B #define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C #define GL_HISTOGRAM_SINK_EXT 0x802D #define GL_MINMAX_EXT 0x802E #define GL_MINMAX_FORMAT_EXT 0x802F #define GL_MINMAX_SINK_EXT 0x8030 #define GL_TABLE_TOO_LARGE_EXT 0x8031 #endif #ifndef GL_EXT_convolution #define GL_CONVOLUTION_1D_EXT 0x8010 #define GL_CONVOLUTION_2D_EXT 0x8011 #define GL_SEPARABLE_2D_EXT 0x8012 #define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 #define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 #define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 #define GL_REDUCE_EXT 0x8016 #define GL_CONVOLUTION_FORMAT_EXT 0x8017 #define GL_CONVOLUTION_WIDTH_EXT 0x8018 #define GL_CONVOLUTION_HEIGHT_EXT 0x8019 #define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A #define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B #define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C #define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D #define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E #define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F #define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 #define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 #define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 #define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 #endif #ifndef GL_SGI_color_matrix #define GL_COLOR_MATRIX_SGI 0x80B1 #define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 #define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 #define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 #define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 #define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 #define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 #define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 #define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 #define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA #define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB #endif #ifndef GL_SGI_color_table #define GL_COLOR_TABLE_SGI 0x80D0 #define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 #define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 #define GL_PROXY_COLOR_TABLE_SGI 0x80D3 #define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 #define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 #define GL_COLOR_TABLE_SCALE_SGI 0x80D6 #define GL_COLOR_TABLE_BIAS_SGI 0x80D7 #define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 #define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 #define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA #define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB #define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC #define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD #define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE #define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF #endif #ifndef GL_SGIS_pixel_texture #define GL_PIXEL_TEXTURE_SGIS 0x8353 #define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 #define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 #define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 #endif #ifndef GL_SGIX_pixel_texture #define GL_PIXEL_TEX_GEN_SGIX 0x8139 #define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B #endif #ifndef GL_SGIS_texture4D #define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 #define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 #define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 #define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 #define GL_TEXTURE_4D_SGIS 0x8134 #define GL_PROXY_TEXTURE_4D_SGIS 0x8135 #define GL_TEXTURE_4DSIZE_SGIS 0x8136 #define GL_TEXTURE_WRAP_Q_SGIS 0x8137 #define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 #define GL_TEXTURE_4D_BINDING_SGIS 0x814F #endif #ifndef GL_SGI_texture_color_table #define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC #define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD #endif #ifndef GL_EXT_cmyka #define GL_CMYK_EXT 0x800C #define GL_CMYKA_EXT 0x800D #define GL_PACK_CMYK_HINT_EXT 0x800E #define GL_UNPACK_CMYK_HINT_EXT 0x800F #endif #ifndef GL_EXT_texture_object #define GL_TEXTURE_PRIORITY_EXT 0x8066 #define GL_TEXTURE_RESIDENT_EXT 0x8067 #define GL_TEXTURE_1D_BINDING_EXT 0x8068 #define GL_TEXTURE_2D_BINDING_EXT 0x8069 #define GL_TEXTURE_3D_BINDING_EXT 0x806A #endif #ifndef GL_SGIS_detail_texture #define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 #define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 #define GL_LINEAR_DETAIL_SGIS 0x8097 #define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 #define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 #define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A #define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B #define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C #endif #ifndef GL_SGIS_sharpen_texture #define GL_LINEAR_SHARPEN_SGIS 0x80AD #define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE #define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF #define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 #endif #ifndef GL_EXT_packed_pixels #define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 #define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 #define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 #define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 #define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 #endif #ifndef GL_SGIS_texture_lod #define GL_TEXTURE_MIN_LOD_SGIS 0x813A #define GL_TEXTURE_MAX_LOD_SGIS 0x813B #define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C #define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D #endif #ifndef GL_SGIS_multisample #define GL_MULTISAMPLE_SGIS 0x809D #define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E #define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F #define GL_SAMPLE_MASK_SGIS 0x80A0 #define GL_1PASS_SGIS 0x80A1 #define GL_2PASS_0_SGIS 0x80A2 #define GL_2PASS_1_SGIS 0x80A3 #define GL_4PASS_0_SGIS 0x80A4 #define GL_4PASS_1_SGIS 0x80A5 #define GL_4PASS_2_SGIS 0x80A6 #define GL_4PASS_3_SGIS 0x80A7 #define GL_SAMPLE_BUFFERS_SGIS 0x80A8 #define GL_SAMPLES_SGIS 0x80A9 #define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA #define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB #define GL_SAMPLE_PATTERN_SGIS 0x80AC #endif #ifndef GL_EXT_rescale_normal #define GL_RESCALE_NORMAL_EXT 0x803A #endif #ifndef GL_EXT_vertex_array #define GL_VERTEX_ARRAY_EXT 0x8074 #define GL_NORMAL_ARRAY_EXT 0x8075 #define GL_COLOR_ARRAY_EXT 0x8076 #define GL_INDEX_ARRAY_EXT 0x8077 #define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 #define GL_EDGE_FLAG_ARRAY_EXT 0x8079 #define GL_VERTEX_ARRAY_SIZE_EXT 0x807A #define GL_VERTEX_ARRAY_TYPE_EXT 0x807B #define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C #define GL_VERTEX_ARRAY_COUNT_EXT 0x807D #define GL_NORMAL_ARRAY_TYPE_EXT 0x807E #define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F #define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 #define GL_COLOR_ARRAY_SIZE_EXT 0x8081 #define GL_COLOR_ARRAY_TYPE_EXT 0x8082 #define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 #define GL_COLOR_ARRAY_COUNT_EXT 0x8084 #define GL_INDEX_ARRAY_TYPE_EXT 0x8085 #define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 #define GL_INDEX_ARRAY_COUNT_EXT 0x8087 #define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 #define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 #define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A #define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B #define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C #define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D #define GL_VERTEX_ARRAY_POINTER_EXT 0x808E #define GL_NORMAL_ARRAY_POINTER_EXT 0x808F #define GL_COLOR_ARRAY_POINTER_EXT 0x8090 #define GL_INDEX_ARRAY_POINTER_EXT 0x8091 #define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 #define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 #endif #ifndef GL_EXT_misc_attribute #endif #ifndef GL_SGIS_generate_mipmap #define GL_GENERATE_MIPMAP_SGIS 0x8191 #define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 #endif #ifndef GL_SGIX_clipmap #define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 #define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 #define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 #define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 #define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 #define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 #define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 #define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 #define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 #define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D #define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E #define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F #endif #ifndef GL_SGIX_shadow #define GL_TEXTURE_COMPARE_SGIX 0x819A #define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B #define GL_TEXTURE_LEQUAL_R_SGIX 0x819C #define GL_TEXTURE_GEQUAL_R_SGIX 0x819D #endif #ifndef GL_SGIS_texture_edge_clamp #define GL_CLAMP_TO_EDGE_SGIS 0x812F #endif #ifndef GL_SGIS_texture_border_clamp #define GL_CLAMP_TO_BORDER_SGIS 0x812D #endif #ifndef GL_EXT_blend_minmax #define GL_FUNC_ADD_EXT 0x8006 #define GL_MIN_EXT 0x8007 #define GL_MAX_EXT 0x8008 #define GL_BLEND_EQUATION_EXT 0x8009 #endif #ifndef GL_EXT_blend_subtract #define GL_FUNC_SUBTRACT_EXT 0x800A #define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B #endif #ifndef GL_EXT_blend_logic_op #endif #ifndef GL_SGIX_interlace #define GL_INTERLACE_SGIX 0x8094 #endif #ifndef GL_SGIX_pixel_tiles #define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E #define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F #define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 #define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 #define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 #define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 #define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 #define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 #endif #ifndef GL_SGIS_texture_select #define GL_DUAL_ALPHA4_SGIS 0x8110 #define GL_DUAL_ALPHA8_SGIS 0x8111 #define GL_DUAL_ALPHA12_SGIS 0x8112 #define GL_DUAL_ALPHA16_SGIS 0x8113 #define GL_DUAL_LUMINANCE4_SGIS 0x8114 #define GL_DUAL_LUMINANCE8_SGIS 0x8115 #define GL_DUAL_LUMINANCE12_SGIS 0x8116 #define GL_DUAL_LUMINANCE16_SGIS 0x8117 #define GL_DUAL_INTENSITY4_SGIS 0x8118 #define GL_DUAL_INTENSITY8_SGIS 0x8119 #define GL_DUAL_INTENSITY12_SGIS 0x811A #define GL_DUAL_INTENSITY16_SGIS 0x811B #define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C #define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D #define GL_QUAD_ALPHA4_SGIS 0x811E #define GL_QUAD_ALPHA8_SGIS 0x811F #define GL_QUAD_LUMINANCE4_SGIS 0x8120 #define GL_QUAD_LUMINANCE8_SGIS 0x8121 #define GL_QUAD_INTENSITY4_SGIS 0x8122 #define GL_QUAD_INTENSITY8_SGIS 0x8123 #define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 #define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 #endif #ifndef GL_SGIX_sprite #define GL_SPRITE_SGIX 0x8148 #define GL_SPRITE_MODE_SGIX 0x8149 #define GL_SPRITE_AXIS_SGIX 0x814A #define GL_SPRITE_TRANSLATION_SGIX 0x814B #define GL_SPRITE_AXIAL_SGIX 0x814C #define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D #define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E #endif #ifndef GL_SGIX_texture_multi_buffer #define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E #endif #ifndef GL_EXT_point_parameters #define GL_POINT_SIZE_MIN_EXT 0x8126 #define GL_POINT_SIZE_MAX_EXT 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 #define GL_DISTANCE_ATTENUATION_EXT 0x8129 #endif #ifndef GL_SGIS_point_parameters #define GL_POINT_SIZE_MIN_SGIS 0x8126 #define GL_POINT_SIZE_MAX_SGIS 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 #define GL_DISTANCE_ATTENUATION_SGIS 0x8129 #endif #ifndef GL_SGIX_instruments #define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 #define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 #endif #ifndef GL_SGIX_texture_scale_bias #define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 #define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A #define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B #define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C #endif #ifndef GL_SGIX_framezoom #define GL_FRAMEZOOM_SGIX 0x818B #define GL_FRAMEZOOM_FACTOR_SGIX 0x818C #define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D #endif #ifndef GL_SGIX_tag_sample_buffer #endif #ifndef GL_FfdMaskSGIX #define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 #define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 #endif #ifndef GL_SGIX_polynomial_ffd #define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 #define GL_TEXTURE_DEFORMATION_SGIX 0x8195 #define GL_DEFORMATIONS_MASK_SGIX 0x8196 #define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 #endif #ifndef GL_SGIX_reference_plane #define GL_REFERENCE_PLANE_SGIX 0x817D #define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E #endif #ifndef GL_SGIX_flush_raster #endif #ifndef GL_SGIX_depth_texture #define GL_DEPTH_COMPONENT16_SGIX 0x81A5 #define GL_DEPTH_COMPONENT24_SGIX 0x81A6 #define GL_DEPTH_COMPONENT32_SGIX 0x81A7 #endif #ifndef GL_SGIS_fog_function #define GL_FOG_FUNC_SGIS 0x812A #define GL_FOG_FUNC_POINTS_SGIS 0x812B #define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C #endif #ifndef GL_SGIX_fog_offset #define GL_FOG_OFFSET_SGIX 0x8198 #define GL_FOG_OFFSET_VALUE_SGIX 0x8199 #endif #ifndef GL_HP_image_transform #define GL_IMAGE_SCALE_X_HP 0x8155 #define GL_IMAGE_SCALE_Y_HP 0x8156 #define GL_IMAGE_TRANSLATE_X_HP 0x8157 #define GL_IMAGE_TRANSLATE_Y_HP 0x8158 #define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 #define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A #define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B #define GL_IMAGE_MAG_FILTER_HP 0x815C #define GL_IMAGE_MIN_FILTER_HP 0x815D #define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E #define GL_CUBIC_HP 0x815F #define GL_AVERAGE_HP 0x8160 #define GL_IMAGE_TRANSFORM_2D_HP 0x8161 #define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 #define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 #endif #ifndef GL_HP_convolution_border_modes #define GL_IGNORE_BORDER_HP 0x8150 #define GL_CONSTANT_BORDER_HP 0x8151 #define GL_REPLICATE_BORDER_HP 0x8153 #define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 #endif #ifndef GL_INGR_palette_buffer #endif #ifndef GL_SGIX_texture_add_env #define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE #endif #ifndef GL_EXT_color_subtable #endif #ifndef GL_PGI_vertex_hints #define GL_VERTEX_DATA_HINT_PGI 0x1A22A #define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B #define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C #define GL_MAX_VERTEX_HINT_PGI 0x1A22D #define GL_COLOR3_BIT_PGI 0x00010000 #define GL_COLOR4_BIT_PGI 0x00020000 #define GL_EDGEFLAG_BIT_PGI 0x00040000 #define GL_INDEX_BIT_PGI 0x00080000 #define GL_MAT_AMBIENT_BIT_PGI 0x00100000 #define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 #define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 #define GL_MAT_EMISSION_BIT_PGI 0x00800000 #define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 #define GL_MAT_SHININESS_BIT_PGI 0x02000000 #define GL_MAT_SPECULAR_BIT_PGI 0x04000000 #define GL_NORMAL_BIT_PGI 0x08000000 #define GL_TEXCOORD1_BIT_PGI 0x10000000 #define GL_TEXCOORD2_BIT_PGI 0x20000000 #define GL_TEXCOORD3_BIT_PGI 0x40000000 #define GL_TEXCOORD4_BIT_PGI 0x80000000 #define GL_VERTEX23_BIT_PGI 0x00000004 #define GL_VERTEX4_BIT_PGI 0x00000008 #endif #ifndef GL_PGI_misc_hints #define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 #define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD #define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE #define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 #define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 #define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 #define GL_ALWAYS_FAST_HINT_PGI 0x1A20C #define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D #define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E #define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F #define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 #define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 #define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 #define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 #define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 #define GL_FULL_STIPPLE_HINT_PGI 0x1A219 #define GL_CLIP_NEAR_HINT_PGI 0x1A220 #define GL_CLIP_FAR_HINT_PGI 0x1A221 #define GL_WIDE_LINE_HINT_PGI 0x1A222 #define GL_BACK_NORMALS_HINT_PGI 0x1A223 #endif #ifndef GL_EXT_paletted_texture #define GL_COLOR_INDEX1_EXT 0x80E2 #define GL_COLOR_INDEX2_EXT 0x80E3 #define GL_COLOR_INDEX4_EXT 0x80E4 #define GL_COLOR_INDEX8_EXT 0x80E5 #define GL_COLOR_INDEX12_EXT 0x80E6 #define GL_COLOR_INDEX16_EXT 0x80E7 #define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED #endif #ifndef GL_EXT_clip_volume_hint #define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 #endif #ifndef GL_SGIX_list_priority #define GL_LIST_PRIORITY_SGIX 0x8182 #endif #ifndef GL_SGIX_ir_instrument1 #define GL_IR_INSTRUMENT1_SGIX 0x817F #endif #ifndef GL_SGIX_calligraphic_fragment #define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 #endif #ifndef GL_SGIX_texture_lod_bias #define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E #define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F #define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 #endif #ifndef GL_SGIX_shadow_ambient #define GL_SHADOW_AMBIENT_SGIX 0x80BF #endif #ifndef GL_EXT_index_texture #endif #ifndef GL_EXT_index_material #define GL_INDEX_MATERIAL_EXT 0x81B8 #define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 #define GL_INDEX_MATERIAL_FACE_EXT 0x81BA #endif #ifndef GL_EXT_index_func #define GL_INDEX_TEST_EXT 0x81B5 #define GL_INDEX_TEST_FUNC_EXT 0x81B6 #define GL_INDEX_TEST_REF_EXT 0x81B7 #endif #ifndef GL_EXT_index_array_formats #define GL_IUI_V2F_EXT 0x81AD #define GL_IUI_V3F_EXT 0x81AE #define GL_IUI_N3F_V2F_EXT 0x81AF #define GL_IUI_N3F_V3F_EXT 0x81B0 #define GL_T2F_IUI_V2F_EXT 0x81B1 #define GL_T2F_IUI_V3F_EXT 0x81B2 #define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 #define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 #endif #ifndef GL_EXT_compiled_vertex_array #define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 #define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 #endif #ifndef GL_EXT_cull_vertex #define GL_CULL_VERTEX_EXT 0x81AA #define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB #define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC #endif #ifndef GL_SGIX_ycrcb #define GL_YCRCB_422_SGIX 0x81BB #define GL_YCRCB_444_SGIX 0x81BC #endif #ifndef GL_SGIX_fragment_lighting #define GL_FRAGMENT_LIGHTING_SGIX 0x8400 #define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 #define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 #define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 #define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 #define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 #define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 #define GL_LIGHT_ENV_MODE_SGIX 0x8407 #define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 #define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 #define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A #define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B #define GL_FRAGMENT_LIGHT0_SGIX 0x840C #define GL_FRAGMENT_LIGHT1_SGIX 0x840D #define GL_FRAGMENT_LIGHT2_SGIX 0x840E #define GL_FRAGMENT_LIGHT3_SGIX 0x840F #define GL_FRAGMENT_LIGHT4_SGIX 0x8410 #define GL_FRAGMENT_LIGHT5_SGIX 0x8411 #define GL_FRAGMENT_LIGHT6_SGIX 0x8412 #define GL_FRAGMENT_LIGHT7_SGIX 0x8413 #endif #ifndef GL_IBM_rasterpos_clip #define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 #endif #ifndef GL_HP_texture_lighting #define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 #define GL_TEXTURE_POST_SPECULAR_HP 0x8168 #define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 #endif #ifndef GL_EXT_draw_range_elements #define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 #define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 #endif #ifndef GL_WIN_phong_shading #define GL_PHONG_WIN 0x80EA #define GL_PHONG_HINT_WIN 0x80EB #endif #ifndef GL_WIN_specular_fog #define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC #endif #ifndef GL_EXT_light_texture #define GL_FRAGMENT_MATERIAL_EXT 0x8349 #define GL_FRAGMENT_NORMAL_EXT 0x834A #define GL_FRAGMENT_COLOR_EXT 0x834C #define GL_ATTENUATION_EXT 0x834D #define GL_SHADOW_ATTENUATION_EXT 0x834E #define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F #define GL_TEXTURE_LIGHT_EXT 0x8350 #define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 #define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 /* reuse GL_FRAGMENT_DEPTH_EXT */ #endif #ifndef GL_SGIX_blend_alpha_minmax #define GL_ALPHA_MIN_SGIX 0x8320 #define GL_ALPHA_MAX_SGIX 0x8321 #endif #ifndef GL_SGIX_impact_pixel_texture #define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 #define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 #define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 #define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 #define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 #define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 #define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A #endif #ifndef GL_EXT_bgra #define GL_BGR_EXT 0x80E0 #define GL_BGRA_EXT 0x80E1 #endif #ifndef GL_SGIX_async #define GL_ASYNC_MARKER_SGIX 0x8329 #endif #ifndef GL_SGIX_async_pixel #define GL_ASYNC_TEX_IMAGE_SGIX 0x835C #define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D #define GL_ASYNC_READ_PIXELS_SGIX 0x835E #define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F #define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 #define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 #endif #ifndef GL_SGIX_async_histogram #define GL_ASYNC_HISTOGRAM_SGIX 0x832C #define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D #endif #ifndef GL_INTEL_texture_scissor #endif #ifndef GL_INTEL_parallel_arrays #define GL_PARALLEL_ARRAYS_INTEL 0x83F4 #define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 #define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 #define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 #define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 #endif #ifndef GL_HP_occlusion_test #define GL_OCCLUSION_TEST_HP 0x8165 #define GL_OCCLUSION_TEST_RESULT_HP 0x8166 #endif #ifndef GL_EXT_pixel_transform #define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 #define GL_PIXEL_MAG_FILTER_EXT 0x8331 #define GL_PIXEL_MIN_FILTER_EXT 0x8332 #define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 #define GL_CUBIC_EXT 0x8334 #define GL_AVERAGE_EXT 0x8335 #define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 #define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 #define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 #endif #ifndef GL_EXT_pixel_transform_color_table #endif #ifndef GL_EXT_shared_texture_palette #define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB #endif #ifndef GL_EXT_separate_specular_color #define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 #define GL_SINGLE_COLOR_EXT 0x81F9 #define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA #endif #ifndef GL_EXT_secondary_color #define GL_COLOR_SUM_EXT 0x8458 #define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 #define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A #define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B #define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C #define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D #define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E #endif #ifndef GL_EXT_texture_perturb_normal #define GL_PERTURB_EXT 0x85AE #define GL_TEXTURE_NORMAL_EXT 0x85AF #endif #ifndef GL_EXT_multi_draw_arrays #endif #ifndef GL_EXT_fog_coord #define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 #define GL_FOG_COORDINATE_EXT 0x8451 #define GL_FRAGMENT_DEPTH_EXT 0x8452 #define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 #define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 #define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 #define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 #define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 #endif #ifndef GL_REND_screen_coordinates #define GL_SCREEN_COORDINATES_REND 0x8490 #define GL_INVERTED_SCREEN_W_REND 0x8491 #endif #ifndef GL_EXT_coordinate_frame #define GL_TANGENT_ARRAY_EXT 0x8439 #define GL_BINORMAL_ARRAY_EXT 0x843A #define GL_CURRENT_TANGENT_EXT 0x843B #define GL_CURRENT_BINORMAL_EXT 0x843C #define GL_TANGENT_ARRAY_TYPE_EXT 0x843E #define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F #define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 #define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 #define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 #define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 #define GL_MAP1_TANGENT_EXT 0x8444 #define GL_MAP2_TANGENT_EXT 0x8445 #define GL_MAP1_BINORMAL_EXT 0x8446 #define GL_MAP2_BINORMAL_EXT 0x8447 #endif #ifndef GL_EXT_texture_env_combine #define GL_COMBINE_EXT 0x8570 #define GL_COMBINE_RGB_EXT 0x8571 #define GL_COMBINE_ALPHA_EXT 0x8572 #define GL_RGB_SCALE_EXT 0x8573 #define GL_ADD_SIGNED_EXT 0x8574 #define GL_INTERPOLATE_EXT 0x8575 #define GL_CONSTANT_EXT 0x8576 #define GL_PRIMARY_COLOR_EXT 0x8577 #define GL_PREVIOUS_EXT 0x8578 #define GL_SOURCE0_RGB_EXT 0x8580 #define GL_SOURCE1_RGB_EXT 0x8581 #define GL_SOURCE2_RGB_EXT 0x8582 #define GL_SOURCE0_ALPHA_EXT 0x8588 #define GL_SOURCE1_ALPHA_EXT 0x8589 #define GL_SOURCE2_ALPHA_EXT 0x858A #define GL_OPERAND0_RGB_EXT 0x8590 #define GL_OPERAND1_RGB_EXT 0x8591 #define GL_OPERAND2_RGB_EXT 0x8592 #define GL_OPERAND0_ALPHA_EXT 0x8598 #define GL_OPERAND1_ALPHA_EXT 0x8599 #define GL_OPERAND2_ALPHA_EXT 0x859A #endif #ifndef GL_APPLE_specular_vector #define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 #endif #ifndef GL_APPLE_transform_hint #define GL_TRANSFORM_HINT_APPLE 0x85B1 #endif #ifndef GL_SGIX_fog_scale #define GL_FOG_SCALE_SGIX 0x81FC #define GL_FOG_SCALE_VALUE_SGIX 0x81FD #endif #ifndef GL_SUNX_constant_data #define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 #define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 #endif #ifndef GL_SUN_global_alpha #define GL_GLOBAL_ALPHA_SUN 0x81D9 #define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA #endif #ifndef GL_SUN_triangle_list #define GL_RESTART_SUN 0x0001 #define GL_REPLACE_MIDDLE_SUN 0x0002 #define GL_REPLACE_OLDEST_SUN 0x0003 #define GL_TRIANGLE_LIST_SUN 0x81D7 #define GL_REPLACEMENT_CODE_SUN 0x81D8 #define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 #define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 #define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 #define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 #define GL_R1UI_V3F_SUN 0x85C4 #define GL_R1UI_C4UB_V3F_SUN 0x85C5 #define GL_R1UI_C3F_V3F_SUN 0x85C6 #define GL_R1UI_N3F_V3F_SUN 0x85C7 #define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 #define GL_R1UI_T2F_V3F_SUN 0x85C9 #define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA #define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB #endif #ifndef GL_SUN_vertex #endif #ifndef GL_EXT_blend_func_separate #define GL_BLEND_DST_RGB_EXT 0x80C8 #define GL_BLEND_SRC_RGB_EXT 0x80C9 #define GL_BLEND_DST_ALPHA_EXT 0x80CA #define GL_BLEND_SRC_ALPHA_EXT 0x80CB #endif #ifndef GL_INGR_color_clamp #define GL_RED_MIN_CLAMP_INGR 0x8560 #define GL_GREEN_MIN_CLAMP_INGR 0x8561 #define GL_BLUE_MIN_CLAMP_INGR 0x8562 #define GL_ALPHA_MIN_CLAMP_INGR 0x8563 #define GL_RED_MAX_CLAMP_INGR 0x8564 #define GL_GREEN_MAX_CLAMP_INGR 0x8565 #define GL_BLUE_MAX_CLAMP_INGR 0x8566 #define GL_ALPHA_MAX_CLAMP_INGR 0x8567 #endif #ifndef GL_INGR_interlace_read #define GL_INTERLACE_READ_INGR 0x8568 #endif #ifndef GL_EXT_stencil_wrap #define GL_INCR_WRAP_EXT 0x8507 #define GL_DECR_WRAP_EXT 0x8508 #endif #ifndef GL_EXT_422_pixels #define GL_422_EXT 0x80CC #define GL_422_REV_EXT 0x80CD #define GL_422_AVERAGE_EXT 0x80CE #define GL_422_REV_AVERAGE_EXT 0x80CF #endif #ifndef GL_NV_texgen_reflection #define GL_NORMAL_MAP_NV 0x8511 #define GL_REFLECTION_MAP_NV 0x8512 #endif #ifndef GL_EXT_texture_cube_map #define GL_NORMAL_MAP_EXT 0x8511 #define GL_REFLECTION_MAP_EXT 0x8512 #define GL_TEXTURE_CUBE_MAP_EXT 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A #define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B #define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C #endif #ifndef GL_SUN_convolution_border_modes #define GL_WRAP_BORDER_SUN 0x81D4 #endif #ifndef GL_EXT_texture_env_add #endif #ifndef GL_EXT_texture_lod_bias #define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD #define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 #define GL_TEXTURE_LOD_BIAS_EXT 0x8501 #endif #ifndef GL_EXT_texture_filter_anisotropic #define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF #endif #ifndef GL_EXT_vertex_weighting #define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH #define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 #define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX #define GL_MODELVIEW1_MATRIX_EXT 0x8506 #define GL_VERTEX_WEIGHTING_EXT 0x8509 #define GL_MODELVIEW0_EXT GL_MODELVIEW #define GL_MODELVIEW1_EXT 0x850A #define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B #define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C #define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D #define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E #define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F #define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 #endif #ifndef GL_NV_light_max_exponent #define GL_MAX_SHININESS_NV 0x8504 #define GL_MAX_SPOT_EXPONENT_NV 0x8505 #endif #ifndef GL_NV_vertex_array_range #define GL_VERTEX_ARRAY_RANGE_NV 0x851D #define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E #define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F #define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 #define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 #endif #ifndef GL_NV_register_combiners #define GL_REGISTER_COMBINERS_NV 0x8522 #define GL_VARIABLE_A_NV 0x8523 #define GL_VARIABLE_B_NV 0x8524 #define GL_VARIABLE_C_NV 0x8525 #define GL_VARIABLE_D_NV 0x8526 #define GL_VARIABLE_E_NV 0x8527 #define GL_VARIABLE_F_NV 0x8528 #define GL_VARIABLE_G_NV 0x8529 #define GL_CONSTANT_COLOR0_NV 0x852A #define GL_CONSTANT_COLOR1_NV 0x852B #define GL_PRIMARY_COLOR_NV 0x852C #define GL_SECONDARY_COLOR_NV 0x852D #define GL_SPARE0_NV 0x852E #define GL_SPARE1_NV 0x852F #define GL_DISCARD_NV 0x8530 #define GL_E_TIMES_F_NV 0x8531 #define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 #define GL_UNSIGNED_IDENTITY_NV 0x8536 #define GL_UNSIGNED_INVERT_NV 0x8537 #define GL_EXPAND_NORMAL_NV 0x8538 #define GL_EXPAND_NEGATE_NV 0x8539 #define GL_HALF_BIAS_NORMAL_NV 0x853A #define GL_HALF_BIAS_NEGATE_NV 0x853B #define GL_SIGNED_IDENTITY_NV 0x853C #define GL_SIGNED_NEGATE_NV 0x853D #define GL_SCALE_BY_TWO_NV 0x853E #define GL_SCALE_BY_FOUR_NV 0x853F #define GL_SCALE_BY_ONE_HALF_NV 0x8540 #define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 #define GL_COMBINER_INPUT_NV 0x8542 #define GL_COMBINER_MAPPING_NV 0x8543 #define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 #define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 #define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 #define GL_COMBINER_MUX_SUM_NV 0x8547 #define GL_COMBINER_SCALE_NV 0x8548 #define GL_COMBINER_BIAS_NV 0x8549 #define GL_COMBINER_AB_OUTPUT_NV 0x854A #define GL_COMBINER_CD_OUTPUT_NV 0x854B #define GL_COMBINER_SUM_OUTPUT_NV 0x854C #define GL_MAX_GENERAL_COMBINERS_NV 0x854D #define GL_NUM_GENERAL_COMBINERS_NV 0x854E #define GL_COLOR_SUM_CLAMP_NV 0x854F #define GL_COMBINER0_NV 0x8550 #define GL_COMBINER1_NV 0x8551 #define GL_COMBINER2_NV 0x8552 #define GL_COMBINER3_NV 0x8553 #define GL_COMBINER4_NV 0x8554 #define GL_COMBINER5_NV 0x8555 #define GL_COMBINER6_NV 0x8556 #define GL_COMBINER7_NV 0x8557 /* reuse GL_TEXTURE0_ARB */ /* reuse GL_TEXTURE1_ARB */ /* reuse GL_ZERO */ /* reuse GL_NONE */ /* reuse GL_FOG */ #endif #ifndef GL_NV_fog_distance #define GL_FOG_DISTANCE_MODE_NV 0x855A #define GL_EYE_RADIAL_NV 0x855B #define GL_EYE_PLANE_ABSOLUTE_NV 0x855C /* reuse GL_EYE_PLANE */ #endif #ifndef GL_NV_texgen_emboss #define GL_EMBOSS_LIGHT_NV 0x855D #define GL_EMBOSS_CONSTANT_NV 0x855E #define GL_EMBOSS_MAP_NV 0x855F #endif #ifndef GL_NV_blend_square #endif #ifndef GL_NV_texture_env_combine4 #define GL_COMBINE4_NV 0x8503 #define GL_SOURCE3_RGB_NV 0x8583 #define GL_SOURCE3_ALPHA_NV 0x858B #define GL_OPERAND3_RGB_NV 0x8593 #define GL_OPERAND3_ALPHA_NV 0x859B #endif #ifndef GL_MESA_resize_buffers #endif #ifndef GL_MESA_window_pos #endif #ifndef GL_EXT_texture_compression_s3tc #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 #endif #ifndef GL_IBM_cull_vertex #define GL_CULL_VERTEX_IBM 103050 #endif #ifndef GL_IBM_multimode_draw_arrays #endif #ifndef GL_IBM_vertex_array_lists #define GL_VERTEX_ARRAY_LIST_IBM 103070 #define GL_NORMAL_ARRAY_LIST_IBM 103071 #define GL_COLOR_ARRAY_LIST_IBM 103072 #define GL_INDEX_ARRAY_LIST_IBM 103073 #define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 #define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 #define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 #define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 #define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 #define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 #define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 #define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 #define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 #define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 #define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 #define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 #endif #ifndef GL_SGIX_subsample #define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 #define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 #define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 #define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 #define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 #endif #ifndef GL_SGIX_ycrcb_subsample #endif #ifndef GL_SGIX_ycrcba #define GL_YCRCB_SGIX 0x8318 #define GL_YCRCBA_SGIX 0x8319 #endif #ifndef GL_SGI_depth_pass_instrument #define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 #define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 #define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 #endif #ifndef GL_3DFX_texture_compression_FXT1 #define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 #define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 #endif #ifndef GL_3DFX_multisample #define GL_MULTISAMPLE_3DFX 0x86B2 #define GL_SAMPLE_BUFFERS_3DFX 0x86B3 #define GL_SAMPLES_3DFX 0x86B4 #define GL_MULTISAMPLE_BIT_3DFX 0x20000000 #endif #ifndef GL_3DFX_tbuffer #endif #ifndef GL_EXT_multisample #define GL_MULTISAMPLE_EXT 0x809D #define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E #define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F #define GL_SAMPLE_MASK_EXT 0x80A0 #define GL_1PASS_EXT 0x80A1 #define GL_2PASS_0_EXT 0x80A2 #define GL_2PASS_1_EXT 0x80A3 #define GL_4PASS_0_EXT 0x80A4 #define GL_4PASS_1_EXT 0x80A5 #define GL_4PASS_2_EXT 0x80A6 #define GL_4PASS_3_EXT 0x80A7 #define GL_SAMPLE_BUFFERS_EXT 0x80A8 #define GL_SAMPLES_EXT 0x80A9 #define GL_SAMPLE_MASK_VALUE_EXT 0x80AA #define GL_SAMPLE_MASK_INVERT_EXT 0x80AB #define GL_SAMPLE_PATTERN_EXT 0x80AC #define GL_MULTISAMPLE_BIT_EXT 0x20000000 #endif #ifndef GL_SGIX_vertex_preclip #define GL_VERTEX_PRECLIP_SGIX 0x83EE #define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF #endif #ifndef GL_SGIX_convolution_accuracy #define GL_CONVOLUTION_HINT_SGIX 0x8316 #endif #ifndef GL_SGIX_resample #define GL_PACK_RESAMPLE_SGIX 0x842C #define GL_UNPACK_RESAMPLE_SGIX 0x842D #define GL_RESAMPLE_REPLICATE_SGIX 0x842E #define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F #define GL_RESAMPLE_DECIMATE_SGIX 0x8430 #endif #ifndef GL_SGIS_point_line_texgen #define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 #define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 #define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 #define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 #define GL_EYE_POINT_SGIS 0x81F4 #define GL_OBJECT_POINT_SGIS 0x81F5 #define GL_EYE_LINE_SGIS 0x81F6 #define GL_OBJECT_LINE_SGIS 0x81F7 #endif #ifndef GL_SGIS_texture_color_mask #define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF #endif #ifndef GL_EXT_texture_env_dot3 #define GL_DOT3_RGB_EXT 0x8740 #define GL_DOT3_RGBA_EXT 0x8741 #endif #ifndef GL_ATI_texture_mirror_once #define GL_MIRROR_CLAMP_ATI 0x8742 #define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 #endif #ifndef GL_NV_fence #define GL_ALL_COMPLETED_NV 0x84F2 #define GL_FENCE_STATUS_NV 0x84F3 #define GL_FENCE_CONDITION_NV 0x84F4 #endif #ifndef GL_IBM_texture_mirrored_repeat #define GL_MIRRORED_REPEAT_IBM 0x8370 #endif #ifndef GL_NV_evaluators #define GL_EVAL_2D_NV 0x86C0 #define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 #define GL_MAP_TESSELLATION_NV 0x86C2 #define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 #define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 #define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 #define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 #define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 #define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 #define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 #define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA #define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB #define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC #define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD #define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE #define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF #define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 #define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 #define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 #define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 #define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 #define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 #define GL_MAX_MAP_TESSELLATION_NV 0x86D6 #define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 #endif #ifndef GL_NV_packed_depth_stencil #define GL_DEPTH_STENCIL_NV 0x84F9 #define GL_UNSIGNED_INT_24_8_NV 0x84FA #endif #ifndef GL_NV_register_combiners2 #define GL_PER_STAGE_CONSTANTS_NV 0x8535 #endif #ifndef GL_NV_texture_compression_vtc #endif #ifndef GL_NV_texture_rectangle #define GL_TEXTURE_RECTANGLE_NV 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 #define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 #endif #ifndef GL_NV_texture_shader #define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C #define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D #define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E #define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 #define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA #define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB #define GL_DSDT_MAG_INTENSITY_NV 0x86DC #define GL_SHADER_CONSISTENT_NV 0x86DD #define GL_TEXTURE_SHADER_NV 0x86DE #define GL_SHADER_OPERATION_NV 0x86DF #define GL_CULL_MODES_NV 0x86E0 #define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 #define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 #define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 #define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV #define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV #define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV #define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 #define GL_CONST_EYE_NV 0x86E5 #define GL_PASS_THROUGH_NV 0x86E6 #define GL_CULL_FRAGMENT_NV 0x86E7 #define GL_OFFSET_TEXTURE_2D_NV 0x86E8 #define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 #define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA #define GL_DOT_PRODUCT_NV 0x86EC #define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED #define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE #define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 #define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 #define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 #define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 #define GL_HILO_NV 0x86F4 #define GL_DSDT_NV 0x86F5 #define GL_DSDT_MAG_NV 0x86F6 #define GL_DSDT_MAG_VIB_NV 0x86F7 #define GL_HILO16_NV 0x86F8 #define GL_SIGNED_HILO_NV 0x86F9 #define GL_SIGNED_HILO16_NV 0x86FA #define GL_SIGNED_RGBA_NV 0x86FB #define GL_SIGNED_RGBA8_NV 0x86FC #define GL_SIGNED_RGB_NV 0x86FE #define GL_SIGNED_RGB8_NV 0x86FF #define GL_SIGNED_LUMINANCE_NV 0x8701 #define GL_SIGNED_LUMINANCE8_NV 0x8702 #define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 #define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 #define GL_SIGNED_ALPHA_NV 0x8705 #define GL_SIGNED_ALPHA8_NV 0x8706 #define GL_SIGNED_INTENSITY_NV 0x8707 #define GL_SIGNED_INTENSITY8_NV 0x8708 #define GL_DSDT8_NV 0x8709 #define GL_DSDT8_MAG8_NV 0x870A #define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B #define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C #define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D #define GL_HI_SCALE_NV 0x870E #define GL_LO_SCALE_NV 0x870F #define GL_DS_SCALE_NV 0x8710 #define GL_DT_SCALE_NV 0x8711 #define GL_MAGNITUDE_SCALE_NV 0x8712 #define GL_VIBRANCE_SCALE_NV 0x8713 #define GL_HI_BIAS_NV 0x8714 #define GL_LO_BIAS_NV 0x8715 #define GL_DS_BIAS_NV 0x8716 #define GL_DT_BIAS_NV 0x8717 #define GL_MAGNITUDE_BIAS_NV 0x8718 #define GL_VIBRANCE_BIAS_NV 0x8719 #define GL_TEXTURE_BORDER_VALUES_NV 0x871A #define GL_TEXTURE_HI_SIZE_NV 0x871B #define GL_TEXTURE_LO_SIZE_NV 0x871C #define GL_TEXTURE_DS_SIZE_NV 0x871D #define GL_TEXTURE_DT_SIZE_NV 0x871E #define GL_TEXTURE_MAG_SIZE_NV 0x871F #endif #ifndef GL_NV_texture_shader2 #define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF #endif #ifndef GL_NV_vertex_array_range2 #define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 #endif #ifndef GL_NV_vertex_program #define GL_VERTEX_PROGRAM_NV 0x8620 #define GL_VERTEX_STATE_PROGRAM_NV 0x8621 #define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 #define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 #define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 #define GL_CURRENT_ATTRIB_NV 0x8626 #define GL_PROGRAM_LENGTH_NV 0x8627 #define GL_PROGRAM_STRING_NV 0x8628 #define GL_MODELVIEW_PROJECTION_NV 0x8629 #define GL_IDENTITY_NV 0x862A #define GL_INVERSE_NV 0x862B #define GL_TRANSPOSE_NV 0x862C #define GL_INVERSE_TRANSPOSE_NV 0x862D #define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E #define GL_MAX_TRACK_MATRICES_NV 0x862F #define GL_MATRIX0_NV 0x8630 #define GL_MATRIX1_NV 0x8631 #define GL_MATRIX2_NV 0x8632 #define GL_MATRIX3_NV 0x8633 #define GL_MATRIX4_NV 0x8634 #define GL_MATRIX5_NV 0x8635 #define GL_MATRIX6_NV 0x8636 #define GL_MATRIX7_NV 0x8637 #define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 #define GL_CURRENT_MATRIX_NV 0x8641 #define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 #define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 #define GL_PROGRAM_PARAMETER_NV 0x8644 #define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 #define GL_PROGRAM_TARGET_NV 0x8646 #define GL_PROGRAM_RESIDENT_NV 0x8647 #define GL_TRACK_MATRIX_NV 0x8648 #define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 #define GL_VERTEX_PROGRAM_BINDING_NV 0x864A #define GL_PROGRAM_ERROR_POSITION_NV 0x864B #define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 #define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 #define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 #define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 #define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 #define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 #define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 #define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 #define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 #define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 #define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A #define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B #define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C #define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D #define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E #define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F #define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 #define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 #define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 #define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 #define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 #define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 #define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 #define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 #define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 #define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 #define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A #define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B #define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C #define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D #define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E #define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F #define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 #define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 #define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 #define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 #define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 #define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 #define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 #define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 #define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 #define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 #define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A #define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B #define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C #define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D #define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E #define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F #endif #ifndef GL_SGIX_texture_coordinate_clamp #define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 #define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A #define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B #endif #ifndef GL_SGIX_scalebias_hint #define GL_SCALEBIAS_HINT_SGIX 0x8322 #endif #ifndef GL_OML_interlace #define GL_INTERLACE_OML 0x8980 #define GL_INTERLACE_READ_OML 0x8981 #endif #ifndef GL_OML_subsample #define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 #define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 #endif #ifndef GL_OML_resample #define GL_PACK_RESAMPLE_OML 0x8984 #define GL_UNPACK_RESAMPLE_OML 0x8985 #define GL_RESAMPLE_REPLICATE_OML 0x8986 #define GL_RESAMPLE_ZERO_FILL_OML 0x8987 #define GL_RESAMPLE_AVERAGE_OML 0x8988 #define GL_RESAMPLE_DECIMATE_OML 0x8989 #endif #ifndef GL_NV_copy_depth_to_color #define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E #define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F #endif #ifndef GL_ATI_envmap_bumpmap #define GL_BUMP_ROT_MATRIX_ATI 0x8775 #define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 #define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 #define GL_BUMP_TEX_UNITS_ATI 0x8778 #define GL_DUDV_ATI 0x8779 #define GL_DU8DV8_ATI 0x877A #define GL_BUMP_ENVMAP_ATI 0x877B #define GL_BUMP_TARGET_ATI 0x877C #endif #ifndef GL_ATI_fragment_shader #define GL_FRAGMENT_SHADER_ATI 0x8920 #define GL_REG_0_ATI 0x8921 #define GL_REG_1_ATI 0x8922 #define GL_REG_2_ATI 0x8923 #define GL_REG_3_ATI 0x8924 #define GL_REG_4_ATI 0x8925 #define GL_REG_5_ATI 0x8926 #define GL_REG_6_ATI 0x8927 #define GL_REG_7_ATI 0x8928 #define GL_REG_8_ATI 0x8929 #define GL_REG_9_ATI 0x892A #define GL_REG_10_ATI 0x892B #define GL_REG_11_ATI 0x892C #define GL_REG_12_ATI 0x892D #define GL_REG_13_ATI 0x892E #define GL_REG_14_ATI 0x892F #define GL_REG_15_ATI 0x8930 #define GL_REG_16_ATI 0x8931 #define GL_REG_17_ATI 0x8932 #define GL_REG_18_ATI 0x8933 #define GL_REG_19_ATI 0x8934 #define GL_REG_20_ATI 0x8935 #define GL_REG_21_ATI 0x8936 #define GL_REG_22_ATI 0x8937 #define GL_REG_23_ATI 0x8938 #define GL_REG_24_ATI 0x8939 #define GL_REG_25_ATI 0x893A #define GL_REG_26_ATI 0x893B #define GL_REG_27_ATI 0x893C #define GL_REG_28_ATI 0x893D #define GL_REG_29_ATI 0x893E #define GL_REG_30_ATI 0x893F #define GL_REG_31_ATI 0x8940 #define GL_CON_0_ATI 0x8941 #define GL_CON_1_ATI 0x8942 #define GL_CON_2_ATI 0x8943 #define GL_CON_3_ATI 0x8944 #define GL_CON_4_ATI 0x8945 #define GL_CON_5_ATI 0x8946 #define GL_CON_6_ATI 0x8947 #define GL_CON_7_ATI 0x8948 #define GL_CON_8_ATI 0x8949 #define GL_CON_9_ATI 0x894A #define GL_CON_10_ATI 0x894B #define GL_CON_11_ATI 0x894C #define GL_CON_12_ATI 0x894D #define GL_CON_13_ATI 0x894E #define GL_CON_14_ATI 0x894F #define GL_CON_15_ATI 0x8950 #define GL_CON_16_ATI 0x8951 #define GL_CON_17_ATI 0x8952 #define GL_CON_18_ATI 0x8953 #define GL_CON_19_ATI 0x8954 #define GL_CON_20_ATI 0x8955 #define GL_CON_21_ATI 0x8956 #define GL_CON_22_ATI 0x8957 #define GL_CON_23_ATI 0x8958 #define GL_CON_24_ATI 0x8959 #define GL_CON_25_ATI 0x895A #define GL_CON_26_ATI 0x895B #define GL_CON_27_ATI 0x895C #define GL_CON_28_ATI 0x895D #define GL_CON_29_ATI 0x895E #define GL_CON_30_ATI 0x895F #define GL_CON_31_ATI 0x8960 #define GL_MOV_ATI 0x8961 #define GL_ADD_ATI 0x8963 #define GL_MUL_ATI 0x8964 #define GL_SUB_ATI 0x8965 #define GL_DOT3_ATI 0x8966 #define GL_DOT4_ATI 0x8967 #define GL_MAD_ATI 0x8968 #define GL_LERP_ATI 0x8969 #define GL_CND_ATI 0x896A #define GL_CND0_ATI 0x896B #define GL_DOT2_ADD_ATI 0x896C #define GL_SECONDARY_INTERPOLATOR_ATI 0x896D #define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E #define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F #define GL_NUM_PASSES_ATI 0x8970 #define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 #define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 #define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 #define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 #define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 #define GL_SWIZZLE_STR_ATI 0x8976 #define GL_SWIZZLE_STQ_ATI 0x8977 #define GL_SWIZZLE_STR_DR_ATI 0x8978 #define GL_SWIZZLE_STQ_DQ_ATI 0x8979 #define GL_SWIZZLE_STRQ_ATI 0x897A #define GL_SWIZZLE_STRQ_DQ_ATI 0x897B #define GL_RED_BIT_ATI 0x00000001 #define GL_GREEN_BIT_ATI 0x00000002 #define GL_BLUE_BIT_ATI 0x00000004 #define GL_2X_BIT_ATI 0x00000001 #define GL_4X_BIT_ATI 0x00000002 #define GL_8X_BIT_ATI 0x00000004 #define GL_HALF_BIT_ATI 0x00000008 #define GL_QUARTER_BIT_ATI 0x00000010 #define GL_EIGHTH_BIT_ATI 0x00000020 #define GL_SATURATE_BIT_ATI 0x00000040 #define GL_COMP_BIT_ATI 0x00000002 #define GL_NEGATE_BIT_ATI 0x00000004 #define GL_BIAS_BIT_ATI 0x00000008 #endif #ifndef GL_ATI_pn_triangles #define GL_PN_TRIANGLES_ATI 0x87F0 #define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 #define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 #define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 #define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 #define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 #define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 #define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 #define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 #endif #ifndef GL_ATI_vertex_array_object #define GL_STATIC_ATI 0x8760 #define GL_DYNAMIC_ATI 0x8761 #define GL_PRESERVE_ATI 0x8762 #define GL_DISCARD_ATI 0x8763 #define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 #define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 #define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 #define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 #endif #ifndef GL_EXT_vertex_shader #define GL_VERTEX_SHADER_EXT 0x8780 #define GL_VERTEX_SHADER_BINDING_EXT 0x8781 #define GL_OP_INDEX_EXT 0x8782 #define GL_OP_NEGATE_EXT 0x8783 #define GL_OP_DOT3_EXT 0x8784 #define GL_OP_DOT4_EXT 0x8785 #define GL_OP_MUL_EXT 0x8786 #define GL_OP_ADD_EXT 0x8787 #define GL_OP_MADD_EXT 0x8788 #define GL_OP_FRAC_EXT 0x8789 #define GL_OP_MAX_EXT 0x878A #define GL_OP_MIN_EXT 0x878B #define GL_OP_SET_GE_EXT 0x878C #define GL_OP_SET_LT_EXT 0x878D #define GL_OP_CLAMP_EXT 0x878E #define GL_OP_FLOOR_EXT 0x878F #define GL_OP_ROUND_EXT 0x8790 #define GL_OP_EXP_BASE_2_EXT 0x8791 #define GL_OP_LOG_BASE_2_EXT 0x8792 #define GL_OP_POWER_EXT 0x8793 #define GL_OP_RECIP_EXT 0x8794 #define GL_OP_RECIP_SQRT_EXT 0x8795 #define GL_OP_SUB_EXT 0x8796 #define GL_OP_CROSS_PRODUCT_EXT 0x8797 #define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 #define GL_OP_MOV_EXT 0x8799 #define GL_OUTPUT_VERTEX_EXT 0x879A #define GL_OUTPUT_COLOR0_EXT 0x879B #define GL_OUTPUT_COLOR1_EXT 0x879C #define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D #define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E #define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F #define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 #define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 #define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 #define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 #define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 #define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 #define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 #define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 #define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 #define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 #define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA #define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB #define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC #define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD #define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE #define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF #define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 #define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 #define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 #define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 #define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 #define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 #define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 #define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 #define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 #define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 #define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA #define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB #define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC #define GL_OUTPUT_FOG_EXT 0x87BD #define GL_SCALAR_EXT 0x87BE #define GL_VECTOR_EXT 0x87BF #define GL_MATRIX_EXT 0x87C0 #define GL_VARIANT_EXT 0x87C1 #define GL_INVARIANT_EXT 0x87C2 #define GL_LOCAL_CONSTANT_EXT 0x87C3 #define GL_LOCAL_EXT 0x87C4 #define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 #define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 #define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 #define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 #define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 #define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA #define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB #define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC #define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD #define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE #define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF #define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 #define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 #define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 #define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 #define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 #define GL_X_EXT 0x87D5 #define GL_Y_EXT 0x87D6 #define GL_Z_EXT 0x87D7 #define GL_W_EXT 0x87D8 #define GL_NEGATIVE_X_EXT 0x87D9 #define GL_NEGATIVE_Y_EXT 0x87DA #define GL_NEGATIVE_Z_EXT 0x87DB #define GL_NEGATIVE_W_EXT 0x87DC #define GL_ZERO_EXT 0x87DD #define GL_ONE_EXT 0x87DE #define GL_NEGATIVE_ONE_EXT 0x87DF #define GL_NORMALIZED_RANGE_EXT 0x87E0 #define GL_FULL_RANGE_EXT 0x87E1 #define GL_CURRENT_VERTEX_EXT 0x87E2 #define GL_MVP_MATRIX_EXT 0x87E3 #define GL_VARIANT_VALUE_EXT 0x87E4 #define GL_VARIANT_DATATYPE_EXT 0x87E5 #define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 #define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 #define GL_VARIANT_ARRAY_EXT 0x87E8 #define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 #define GL_INVARIANT_VALUE_EXT 0x87EA #define GL_INVARIANT_DATATYPE_EXT 0x87EB #define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC #define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED #endif #ifndef GL_ATI_vertex_streams #define GL_MAX_VERTEX_STREAMS_ATI 0x876B #define GL_VERTEX_STREAM0_ATI 0x876C #define GL_VERTEX_STREAM1_ATI 0x876D #define GL_VERTEX_STREAM2_ATI 0x876E #define GL_VERTEX_STREAM3_ATI 0x876F #define GL_VERTEX_STREAM4_ATI 0x8770 #define GL_VERTEX_STREAM5_ATI 0x8771 #define GL_VERTEX_STREAM6_ATI 0x8772 #define GL_VERTEX_STREAM7_ATI 0x8773 #define GL_VERTEX_SOURCE_ATI 0x8774 #endif #ifndef GL_ATI_element_array #define GL_ELEMENT_ARRAY_ATI 0x8768 #define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 #define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A #endif #ifndef GL_SUN_mesh_array #define GL_QUAD_MESH_SUN 0x8614 #define GL_TRIANGLE_MESH_SUN 0x8615 #endif #ifndef GL_SUN_slice_accum #define GL_SLICE_ACCUM_SUN 0x85CC #endif #ifndef GL_NV_multisample_filter_hint #define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 #endif #ifndef GL_NV_depth_clamp #define GL_DEPTH_CLAMP_NV 0x864F #endif #ifndef GL_NV_occlusion_query #define GL_PIXEL_COUNTER_BITS_NV 0x8864 #define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 #define GL_PIXEL_COUNT_NV 0x8866 #define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 #endif #ifndef GL_NV_point_sprite #define GL_POINT_SPRITE_NV 0x8861 #define GL_COORD_REPLACE_NV 0x8862 #define GL_POINT_SPRITE_R_MODE_NV 0x8863 #endif #ifndef GL_NV_texture_shader3 #define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 #define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 #define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 #define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 #define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 #define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 #define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 #define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 #define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 #define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 #define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A #define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B #define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C #define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D #define GL_HILO8_NV 0x885E #define GL_SIGNED_HILO8_NV 0x885F #define GL_FORCE_BLUE_TO_ONE_NV 0x8860 #endif #ifndef GL_NV_vertex_program1_1 #endif #ifndef GL_EXT_shadow_funcs #endif #ifndef GL_EXT_stencil_two_side #define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 #define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 #endif #ifndef GL_ATI_text_fragment_shader #define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 #endif #ifndef GL_APPLE_client_storage #define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 #endif #ifndef GL_APPLE_element_array #define GL_ELEMENT_ARRAY_APPLE 0x8768 #define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769 #define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A #endif #ifndef GL_APPLE_fence #define GL_DRAW_PIXELS_APPLE 0x8A0A #define GL_FENCE_APPLE 0x8A0B #endif #ifndef GL_APPLE_vertex_array_object #define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 #endif #ifndef GL_APPLE_vertex_array_range #define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D #define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E #define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F #define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 #define GL_STORAGE_CACHED_APPLE 0x85BE #define GL_STORAGE_SHARED_APPLE 0x85BF #endif #ifndef GL_APPLE_ycbcr_422 #define GL_YCBCR_422_APPLE 0x85B9 #define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA #define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB #endif #ifndef GL_S3_s3tc #define GL_RGB_S3TC 0x83A0 #define GL_RGB4_S3TC 0x83A1 #define GL_RGBA_S3TC 0x83A2 #define GL_RGBA4_S3TC 0x83A3 #endif #ifndef GL_ATI_draw_buffers #define GL_MAX_DRAW_BUFFERS_ATI 0x8824 #define GL_DRAW_BUFFER0_ATI 0x8825 #define GL_DRAW_BUFFER1_ATI 0x8826 #define GL_DRAW_BUFFER2_ATI 0x8827 #define GL_DRAW_BUFFER3_ATI 0x8828 #define GL_DRAW_BUFFER4_ATI 0x8829 #define GL_DRAW_BUFFER5_ATI 0x882A #define GL_DRAW_BUFFER6_ATI 0x882B #define GL_DRAW_BUFFER7_ATI 0x882C #define GL_DRAW_BUFFER8_ATI 0x882D #define GL_DRAW_BUFFER9_ATI 0x882E #define GL_DRAW_BUFFER10_ATI 0x882F #define GL_DRAW_BUFFER11_ATI 0x8830 #define GL_DRAW_BUFFER12_ATI 0x8831 #define GL_DRAW_BUFFER13_ATI 0x8832 #define GL_DRAW_BUFFER14_ATI 0x8833 #define GL_DRAW_BUFFER15_ATI 0x8834 #endif #ifndef GL_ATI_pixel_format_float #define GL_TYPE_RGBA_FLOAT_ATI 0x8820 #define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 #endif #ifndef GL_ATI_texture_env_combine3 #define GL_MODULATE_ADD_ATI 0x8744 #define GL_MODULATE_SIGNED_ADD_ATI 0x8745 #define GL_MODULATE_SUBTRACT_ATI 0x8746 #endif #ifndef GL_ATI_texture_float #define GL_RGBA_FLOAT32_ATI 0x8814 #define GL_RGB_FLOAT32_ATI 0x8815 #define GL_ALPHA_FLOAT32_ATI 0x8816 #define GL_INTENSITY_FLOAT32_ATI 0x8817 #define GL_LUMINANCE_FLOAT32_ATI 0x8818 #define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 #define GL_RGBA_FLOAT16_ATI 0x881A #define GL_RGB_FLOAT16_ATI 0x881B #define GL_ALPHA_FLOAT16_ATI 0x881C #define GL_INTENSITY_FLOAT16_ATI 0x881D #define GL_LUMINANCE_FLOAT16_ATI 0x881E #define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F #endif #ifndef GL_NV_float_buffer #define GL_FLOAT_R_NV 0x8880 #define GL_FLOAT_RG_NV 0x8881 #define GL_FLOAT_RGB_NV 0x8882 #define GL_FLOAT_RGBA_NV 0x8883 #define GL_FLOAT_R16_NV 0x8884 #define GL_FLOAT_R32_NV 0x8885 #define GL_FLOAT_RG16_NV 0x8886 #define GL_FLOAT_RG32_NV 0x8887 #define GL_FLOAT_RGB16_NV 0x8888 #define GL_FLOAT_RGB32_NV 0x8889 #define GL_FLOAT_RGBA16_NV 0x888A #define GL_FLOAT_RGBA32_NV 0x888B #define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C #define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D #define GL_FLOAT_RGBA_MODE_NV 0x888E #endif #ifndef GL_NV_fragment_program #define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 #define GL_FRAGMENT_PROGRAM_NV 0x8870 #define GL_MAX_TEXTURE_COORDS_NV 0x8871 #define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 #define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 #define GL_PROGRAM_ERROR_STRING_NV 0x8874 #endif #ifndef GL_NV_half_float #define GL_HALF_FLOAT_NV 0x140B #endif #ifndef GL_NV_pixel_data_range #define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 #define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 #define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A #define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B #define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C #define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D #endif #ifndef GL_NV_primitive_restart #define GL_PRIMITIVE_RESTART_NV 0x8558 #define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 #endif #ifndef GL_NV_texture_expand_normal #define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F #endif #ifndef GL_NV_vertex_program2 #endif #ifndef GL_ATI_map_object_buffer #endif #ifndef GL_ATI_separate_stencil #define GL_STENCIL_BACK_FUNC_ATI 0x8800 #define GL_STENCIL_BACK_FAIL_ATI 0x8801 #define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 #define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 #endif #ifndef GL_ATI_vertex_attrib_array_object #endif #ifndef GL_OES_read_format #define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A #define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B #endif #ifndef GL_EXT_depth_bounds_test #define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 #define GL_DEPTH_BOUNDS_EXT 0x8891 #endif #ifndef GL_EXT_texture_mirror_clamp #define GL_MIRROR_CLAMP_EXT 0x8742 #define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 #define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 #endif #ifndef GL_EXT_blend_equation_separate #define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION #define GL_BLEND_EQUATION_ALPHA_EXT 0x883D #endif #ifndef GL_MESA_pack_invert #define GL_PACK_INVERT_MESA 0x8758 #endif #ifndef GL_MESA_ycbcr_texture #define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA #define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB #define GL_YCBCR_MESA 0x8757 #endif #ifndef GL_EXT_pixel_buffer_object #define GL_PIXEL_PACK_BUFFER_EXT 0x88EB #define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC #define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED #define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF #endif #ifndef GL_NV_fragment_program_option #endif #ifndef GL_NV_fragment_program2 #define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 #define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 #define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 #define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 #define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 #endif #ifndef GL_NV_vertex_program2_option /* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ /* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */ #endif #ifndef GL_NV_vertex_program3 /* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ #endif #ifndef GL_EXT_framebuffer_object #define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 #define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 #define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 #define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 #define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 #define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB #define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC #define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD #define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF #define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 #define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 #define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 #define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 #define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 #define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 #define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 #define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 #define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 #define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 #define GL_COLOR_ATTACHMENT10_EXT 0x8CEA #define GL_COLOR_ATTACHMENT11_EXT 0x8CEB #define GL_COLOR_ATTACHMENT12_EXT 0x8CEC #define GL_COLOR_ATTACHMENT13_EXT 0x8CED #define GL_COLOR_ATTACHMENT14_EXT 0x8CEE #define GL_COLOR_ATTACHMENT15_EXT 0x8CEF #define GL_DEPTH_ATTACHMENT_EXT 0x8D00 #define GL_STENCIL_ATTACHMENT_EXT 0x8D20 #define GL_FRAMEBUFFER_EXT 0x8D40 #define GL_RENDERBUFFER_EXT 0x8D41 #define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 #define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 #define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 #define GL_STENCIL_INDEX1_EXT 0x8D46 #define GL_STENCIL_INDEX4_EXT 0x8D47 #define GL_STENCIL_INDEX8_EXT 0x8D48 #define GL_STENCIL_INDEX16_EXT 0x8D49 #define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 #define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 #define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 #define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 #define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 #define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 #endif #ifndef GL_GREMEDY_string_marker #endif /*************************************************************/ #include #ifndef GL_VERSION_2_0 /* GL type for program/shader text */ typedef char GLchar; /* native character */ #endif #ifndef GL_VERSION_1_5 /* GL types for handling large vertex buffer objects */ typedef ptrdiff_t GLintptr; typedef ptrdiff_t GLsizeiptr; #endif #ifndef GL_ARB_vertex_buffer_object /* GL types for handling large vertex buffer objects */ typedef ptrdiff_t GLintptrARB; typedef ptrdiff_t GLsizeiptrARB; #endif #ifndef GL_ARB_shader_objects /* GL types for handling shader object handles and program/shader text */ typedef char GLcharARB; /* native character */ typedef unsigned int GLhandleARB; /* shader object handle */ #endif /* GL types for "half" precision (s10e5) float data in host memory */ #ifndef GL_ARB_half_float_pixel typedef unsigned short GLhalfARB; #endif #ifndef GL_NV_half_float typedef unsigned short GLhalfNV; #endif #ifndef GL_VERSION_1_2 #define GL_VERSION_1_2 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf); GLAPI void APIENTRY glBlendEquation (GLenum); GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *); GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *); GLAPI void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei); GLAPI void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *); GLAPI void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *); GLAPI void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei); GLAPI void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat); GLAPI void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *); GLAPI void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint); GLAPI void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *); GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei); GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); GLAPI void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *); GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); GLAPI void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); GLAPI void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *); GLAPI void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *); GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *); GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean); GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean); GLAPI void APIENTRY glResetHistogram (GLenum); GLAPI void APIENTRY glResetMinmax (GLenum); GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); #endif #ifndef GL_VERSION_1_3 #define GL_VERSION_1_3 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glActiveTexture (GLenum); GLAPI void APIENTRY glClientActiveTexture (GLenum); GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble); GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *); GLAPI void APIENTRY glMultiTexCoord1f (GLenum, GLfloat); GLAPI void APIENTRY glMultiTexCoord1fv (GLenum, const GLfloat *); GLAPI void APIENTRY glMultiTexCoord1i (GLenum, GLint); GLAPI void APIENTRY glMultiTexCoord1iv (GLenum, const GLint *); GLAPI void APIENTRY glMultiTexCoord1s (GLenum, GLshort); GLAPI void APIENTRY glMultiTexCoord1sv (GLenum, const GLshort *); GLAPI void APIENTRY glMultiTexCoord2d (GLenum, GLdouble, GLdouble); GLAPI void APIENTRY glMultiTexCoord2dv (GLenum, const GLdouble *); GLAPI void APIENTRY glMultiTexCoord2f (GLenum, GLfloat, GLfloat); GLAPI void APIENTRY glMultiTexCoord2fv (GLenum, const GLfloat *); GLAPI void APIENTRY glMultiTexCoord2i (GLenum, GLint, GLint); GLAPI void APIENTRY glMultiTexCoord2iv (GLenum, const GLint *); GLAPI void APIENTRY glMultiTexCoord2s (GLenum, GLshort, GLshort); GLAPI void APIENTRY glMultiTexCoord2sv (GLenum, const GLshort *); GLAPI void APIENTRY glMultiTexCoord3d (GLenum, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glMultiTexCoord3dv (GLenum, const GLdouble *); GLAPI void APIENTRY glMultiTexCoord3f (GLenum, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glMultiTexCoord3fv (GLenum, const GLfloat *); GLAPI void APIENTRY glMultiTexCoord3i (GLenum, GLint, GLint, GLint); GLAPI void APIENTRY glMultiTexCoord3iv (GLenum, const GLint *); GLAPI void APIENTRY glMultiTexCoord3s (GLenum, GLshort, GLshort, GLshort); GLAPI void APIENTRY glMultiTexCoord3sv (GLenum, const GLshort *); GLAPI void APIENTRY glMultiTexCoord4d (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glMultiTexCoord4dv (GLenum, const GLdouble *); GLAPI void APIENTRY glMultiTexCoord4f (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glMultiTexCoord4fv (GLenum, const GLfloat *); GLAPI void APIENTRY glMultiTexCoord4i (GLenum, GLint, GLint, GLint, GLint); GLAPI void APIENTRY glMultiTexCoord4iv (GLenum, const GLint *); GLAPI void APIENTRY glMultiTexCoord4s (GLenum, GLshort, GLshort, GLshort, GLshort); GLAPI void APIENTRY glMultiTexCoord4sv (GLenum, const GLshort *); GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *); GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *); GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *); GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *); GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean); GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); #endif #ifndef GL_VERSION_1_4 #define GL_VERSION_1_4 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum); GLAPI void APIENTRY glFogCoordf (GLfloat); GLAPI void APIENTRY glFogCoordfv (const GLfloat *); GLAPI void APIENTRY glFogCoordd (GLdouble); GLAPI void APIENTRY glFogCoorddv (const GLdouble *); GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei); GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat); GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *); GLAPI void APIENTRY glPointParameteri (GLenum, GLint); GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *); GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte); GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *); GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *); GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *); GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint); GLAPI void APIENTRY glSecondaryColor3iv (const GLint *); GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort); GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *); GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte); GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *); GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint); GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *); GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort); GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *); GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble); GLAPI void APIENTRY glWindowPos2dv (const GLdouble *); GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat); GLAPI void APIENTRY glWindowPos2fv (const GLfloat *); GLAPI void APIENTRY glWindowPos2i (GLint, GLint); GLAPI void APIENTRY glWindowPos2iv (const GLint *); GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort); GLAPI void APIENTRY glWindowPos2sv (const GLshort *); GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glWindowPos3dv (const GLdouble *); GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glWindowPos3fv (const GLfloat *); GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint); GLAPI void APIENTRY glWindowPos3iv (const GLint *); GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort); GLAPI void APIENTRY glWindowPos3sv (const GLshort *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); #endif #ifndef GL_VERSION_1_5 #define GL_VERSION_1_5 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glGenQueries (GLsizei, GLuint *); GLAPI void APIENTRY glDeleteQueries (GLsizei, const GLuint *); GLAPI GLboolean APIENTRY glIsQuery (GLuint); GLAPI void APIENTRY glBeginQuery (GLenum, GLuint); GLAPI void APIENTRY glEndQuery (GLenum); GLAPI void APIENTRY glGetQueryiv (GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetQueryObjectiv (GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetQueryObjectuiv (GLuint, GLenum, GLuint *); GLAPI void APIENTRY glBindBuffer (GLenum, GLuint); GLAPI void APIENTRY glDeleteBuffers (GLsizei, const GLuint *); GLAPI void APIENTRY glGenBuffers (GLsizei, GLuint *); GLAPI GLboolean APIENTRY glIsBuffer (GLuint); GLAPI void APIENTRY glBufferData (GLenum, GLsizeiptr, const GLvoid *, GLenum); GLAPI void APIENTRY glBufferSubData (GLenum, GLintptr, GLsizeiptr, const GLvoid *); GLAPI void APIENTRY glGetBufferSubData (GLenum, GLintptr, GLsizeiptr, GLvoid *); GLAPI GLvoid* APIENTRY glMapBuffer (GLenum, GLenum); GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum); GLAPI void APIENTRY glGetBufferParameteriv (GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetBufferPointerv (GLenum, GLenum, GLvoid* *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params); #endif #ifndef GL_VERSION_2_0 #define GL_VERSION_2_0 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBlendEquationSeparate (GLenum, GLenum); GLAPI void APIENTRY glDrawBuffers (GLsizei, const GLenum *); GLAPI void APIENTRY glStencilOpSeparate (GLenum, GLenum, GLenum, GLenum); GLAPI void APIENTRY glStencilFuncSeparate (GLenum, GLenum, GLint, GLuint); GLAPI void APIENTRY glStencilMaskSeparate (GLenum, GLuint); GLAPI void APIENTRY glAttachShader (GLuint, GLuint); GLAPI void APIENTRY glBindAttribLocation (GLuint, GLuint, const GLchar *); GLAPI void APIENTRY glCompileShader (GLuint); GLAPI GLuint APIENTRY glCreateProgram (void); GLAPI GLuint APIENTRY glCreateShader (GLenum); GLAPI void APIENTRY glDeleteProgram (GLuint); GLAPI void APIENTRY glDeleteShader (GLuint); GLAPI void APIENTRY glDetachShader (GLuint, GLuint); GLAPI void APIENTRY glDisableVertexAttribArray (GLuint); GLAPI void APIENTRY glEnableVertexAttribArray (GLuint); GLAPI void APIENTRY glGetActiveAttrib (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); GLAPI void APIENTRY glGetActiveUniform (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); GLAPI void APIENTRY glGetAttachedShaders (GLuint, GLsizei, GLsizei *, GLuint *); GLAPI GLint APIENTRY glGetAttribLocation (GLuint, const GLchar *); GLAPI void APIENTRY glGetProgramiv (GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetProgramInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); GLAPI void APIENTRY glGetShaderiv (GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetShaderInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); GLAPI void APIENTRY glGetShaderSource (GLuint, GLsizei, GLsizei *, GLchar *); GLAPI GLint APIENTRY glGetUniformLocation (GLuint, const GLchar *); GLAPI void APIENTRY glGetUniformfv (GLuint, GLint, GLfloat *); GLAPI void APIENTRY glGetUniformiv (GLuint, GLint, GLint *); GLAPI void APIENTRY glGetVertexAttribdv (GLuint, GLenum, GLdouble *); GLAPI void APIENTRY glGetVertexAttribfv (GLuint, GLenum, GLfloat *); GLAPI void APIENTRY glGetVertexAttribiv (GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint, GLenum, GLvoid* *); GLAPI GLboolean APIENTRY glIsProgram (GLuint); GLAPI GLboolean APIENTRY glIsShader (GLuint); GLAPI void APIENTRY glLinkProgram (GLuint); GLAPI void APIENTRY glShaderSource (GLuint, GLsizei, const GLchar* *, const GLint *); GLAPI void APIENTRY glUseProgram (GLuint); GLAPI void APIENTRY glUniform1f (GLint, GLfloat); GLAPI void APIENTRY glUniform2f (GLint, GLfloat, GLfloat); GLAPI void APIENTRY glUniform3f (GLint, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glUniform4f (GLint, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glUniform1i (GLint, GLint); GLAPI void APIENTRY glUniform2i (GLint, GLint, GLint); GLAPI void APIENTRY glUniform3i (GLint, GLint, GLint, GLint); GLAPI void APIENTRY glUniform4i (GLint, GLint, GLint, GLint, GLint); GLAPI void APIENTRY glUniform1fv (GLint, GLsizei, const GLfloat *); GLAPI void APIENTRY glUniform2fv (GLint, GLsizei, const GLfloat *); GLAPI void APIENTRY glUniform3fv (GLint, GLsizei, const GLfloat *); GLAPI void APIENTRY glUniform4fv (GLint, GLsizei, const GLfloat *); GLAPI void APIENTRY glUniform1iv (GLint, GLsizei, const GLint *); GLAPI void APIENTRY glUniform2iv (GLint, GLsizei, const GLint *); GLAPI void APIENTRY glUniform3iv (GLint, GLsizei, const GLint *); GLAPI void APIENTRY glUniform4iv (GLint, GLsizei, const GLint *); GLAPI void APIENTRY glUniformMatrix2fv (GLint, GLsizei, GLboolean, const GLfloat *); GLAPI void APIENTRY glUniformMatrix3fv (GLint, GLsizei, GLboolean, const GLfloat *); GLAPI void APIENTRY glUniformMatrix4fv (GLint, GLsizei, GLboolean, const GLfloat *); GLAPI void APIENTRY glValidateProgram (GLuint); GLAPI void APIENTRY glVertexAttrib1d (GLuint, GLdouble); GLAPI void APIENTRY glVertexAttrib1dv (GLuint, const GLdouble *); GLAPI void APIENTRY glVertexAttrib1f (GLuint, GLfloat); GLAPI void APIENTRY glVertexAttrib1fv (GLuint, const GLfloat *); GLAPI void APIENTRY glVertexAttrib1s (GLuint, GLshort); GLAPI void APIENTRY glVertexAttrib1sv (GLuint, const GLshort *); GLAPI void APIENTRY glVertexAttrib2d (GLuint, GLdouble, GLdouble); GLAPI void APIENTRY glVertexAttrib2dv (GLuint, const GLdouble *); GLAPI void APIENTRY glVertexAttrib2f (GLuint, GLfloat, GLfloat); GLAPI void APIENTRY glVertexAttrib2fv (GLuint, const GLfloat *); GLAPI void APIENTRY glVertexAttrib2s (GLuint, GLshort, GLshort); GLAPI void APIENTRY glVertexAttrib2sv (GLuint, const GLshort *); GLAPI void APIENTRY glVertexAttrib3d (GLuint, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glVertexAttrib3dv (GLuint, const GLdouble *); GLAPI void APIENTRY glVertexAttrib3f (GLuint, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glVertexAttrib3fv (GLuint, const GLfloat *); GLAPI void APIENTRY glVertexAttrib3s (GLuint, GLshort, GLshort, GLshort); GLAPI void APIENTRY glVertexAttrib3sv (GLuint, const GLshort *); GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint, const GLbyte *); GLAPI void APIENTRY glVertexAttrib4Niv (GLuint, const GLint *); GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint, const GLshort *); GLAPI void APIENTRY glVertexAttrib4Nub (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint, const GLubyte *); GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint, const GLuint *); GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint, const GLushort *); GLAPI void APIENTRY glVertexAttrib4bv (GLuint, const GLbyte *); GLAPI void APIENTRY glVertexAttrib4d (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glVertexAttrib4dv (GLuint, const GLdouble *); GLAPI void APIENTRY glVertexAttrib4f (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glVertexAttrib4fv (GLuint, const GLfloat *); GLAPI void APIENTRY glVertexAttrib4iv (GLuint, const GLint *); GLAPI void APIENTRY glVertexAttrib4s (GLuint, GLshort, GLshort, GLshort, GLshort); GLAPI void APIENTRY glVertexAttrib4sv (GLuint, const GLshort *); GLAPI void APIENTRY glVertexAttrib4ubv (GLuint, const GLubyte *); GLAPI void APIENTRY glVertexAttrib4uiv (GLuint, const GLuint *); GLAPI void APIENTRY glVertexAttrib4usv (GLuint, const GLushort *); GLAPI void APIENTRY glVertexAttribPointer (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); #endif #ifndef GL_ARB_multitexture #define GL_ARB_multitexture 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glActiveTextureARB (GLenum); GLAPI void APIENTRY glClientActiveTextureARB (GLenum); GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble); GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *); GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat); GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *); GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum, GLint); GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *); GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort); GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *); GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble); GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *); GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat); GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *); GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint); GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *); GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort); GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *); GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *); GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *); GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint); GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *); GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort); GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *); GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *); GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *); GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint); GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *); GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort); GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); #endif #ifndef GL_ARB_transpose_matrix #define GL_ARB_transpose_matrix 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *); GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *); GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *); GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); #endif #ifndef GL_ARB_multisample #define GL_ARB_multisample 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glSampleCoverageARB (GLclampf, GLboolean); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); #endif #ifndef GL_ARB_texture_env_add #define GL_ARB_texture_env_add 1 #endif #ifndef GL_ARB_texture_cube_map #define GL_ARB_texture_cube_map 1 #endif #ifndef GL_ARB_texture_compression #define GL_ARB_texture_compression 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img); #endif #ifndef GL_ARB_texture_border_clamp #define GL_ARB_texture_border_clamp 1 #endif #ifndef GL_ARB_point_parameters #define GL_ARB_point_parameters 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat); GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); #endif #ifndef GL_ARB_vertex_blend #define GL_ARB_vertex_blend 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glWeightbvARB (GLint, const GLbyte *); GLAPI void APIENTRY glWeightsvARB (GLint, const GLshort *); GLAPI void APIENTRY glWeightivARB (GLint, const GLint *); GLAPI void APIENTRY glWeightfvARB (GLint, const GLfloat *); GLAPI void APIENTRY glWeightdvARB (GLint, const GLdouble *); GLAPI void APIENTRY glWeightubvARB (GLint, const GLubyte *); GLAPI void APIENTRY glWeightusvARB (GLint, const GLushort *); GLAPI void APIENTRY glWeightuivARB (GLint, const GLuint *); GLAPI void APIENTRY glWeightPointerARB (GLint, GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glVertexBlendARB (GLint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); #endif #ifndef GL_ARB_matrix_palette #define GL_ARB_matrix_palette 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint); GLAPI void APIENTRY glMatrixIndexubvARB (GLint, const GLubyte *); GLAPI void APIENTRY glMatrixIndexusvARB (GLint, const GLushort *); GLAPI void APIENTRY glMatrixIndexuivARB (GLint, const GLuint *); GLAPI void APIENTRY glMatrixIndexPointerARB (GLint, GLenum, GLsizei, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); #endif #ifndef GL_ARB_texture_env_combine #define GL_ARB_texture_env_combine 1 #endif #ifndef GL_ARB_texture_env_crossbar #define GL_ARB_texture_env_crossbar 1 #endif #ifndef GL_ARB_texture_env_dot3 #define GL_ARB_texture_env_dot3 1 #endif #ifndef GL_ARB_texture_mirrored_repeat #define GL_ARB_texture_mirrored_repeat 1 #endif #ifndef GL_ARB_depth_texture #define GL_ARB_depth_texture 1 #endif #ifndef GL_ARB_shadow #define GL_ARB_shadow 1 #endif #ifndef GL_ARB_shadow_ambient #define GL_ARB_shadow_ambient 1 #endif #ifndef GL_ARB_window_pos #define GL_ARB_window_pos 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glWindowPos2dARB (GLdouble, GLdouble); GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *); GLAPI void APIENTRY glWindowPos2fARB (GLfloat, GLfloat); GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *); GLAPI void APIENTRY glWindowPos2iARB (GLint, GLint); GLAPI void APIENTRY glWindowPos2ivARB (const GLint *); GLAPI void APIENTRY glWindowPos2sARB (GLshort, GLshort); GLAPI void APIENTRY glWindowPos2svARB (const GLshort *); GLAPI void APIENTRY glWindowPos3dARB (GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *); GLAPI void APIENTRY glWindowPos3fARB (GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *); GLAPI void APIENTRY glWindowPos3iARB (GLint, GLint, GLint); GLAPI void APIENTRY glWindowPos3ivARB (const GLint *); GLAPI void APIENTRY glWindowPos3sARB (GLshort, GLshort, GLshort); GLAPI void APIENTRY glWindowPos3svARB (const GLshort *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); #endif #ifndef GL_ARB_vertex_program #define GL_ARB_vertex_program 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble); GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *); GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat); GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *); GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort); GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *); GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble); GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *); GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat); GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *); GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort); GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *); GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *); GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *); GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort); GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *); GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *); GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *); GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *); GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *); GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *); GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *); GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *); GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *); GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *); GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *); GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort); GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *); GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *); GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *); GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *); GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint); GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint); GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint); GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *); GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *); GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *); GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *); GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *); GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *); GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *); GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *); GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *); GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *); GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *); GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *); GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *); GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *); GLAPI GLboolean APIENTRY glIsProgramARB (GLuint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer); typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); #endif #ifndef GL_ARB_fragment_program #define GL_ARB_fragment_program 1 /* All ARB_fragment_program entry points are shared with ARB_vertex_program. */ #endif #ifndef GL_ARB_vertex_buffer_object #define GL_ARB_vertex_buffer_object 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBindBufferARB (GLenum, GLuint); GLAPI void APIENTRY glDeleteBuffersARB (GLsizei, const GLuint *); GLAPI void APIENTRY glGenBuffersARB (GLsizei, GLuint *); GLAPI GLboolean APIENTRY glIsBufferARB (GLuint); GLAPI void APIENTRY glBufferDataARB (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); GLAPI void APIENTRY glBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *); GLAPI void APIENTRY glGetBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *); GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum, GLenum); GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum); GLAPI void APIENTRY glGetBufferParameterivARB (GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetBufferPointervARB (GLenum, GLenum, GLvoid* *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params); #endif #ifndef GL_ARB_occlusion_query #define GL_ARB_occlusion_query 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glGenQueriesARB (GLsizei, GLuint *); GLAPI void APIENTRY glDeleteQueriesARB (GLsizei, const GLuint *); GLAPI GLboolean APIENTRY glIsQueryARB (GLuint); GLAPI void APIENTRY glBeginQueryARB (GLenum, GLuint); GLAPI void APIENTRY glEndQueryARB (GLenum); GLAPI void APIENTRY glGetQueryivARB (GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetQueryObjectivARB (GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint, GLenum, GLuint *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); #endif #ifndef GL_ARB_shader_objects #define GL_ARB_shader_objects 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB); GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum); GLAPI void APIENTRY glDetachObjectARB (GLhandleARB, GLhandleARB); GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum); GLAPI void APIENTRY glShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); GLAPI void APIENTRY glCompileShaderARB (GLhandleARB); GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); GLAPI void APIENTRY glAttachObjectARB (GLhandleARB, GLhandleARB); GLAPI void APIENTRY glLinkProgramARB (GLhandleARB); GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB); GLAPI void APIENTRY glValidateProgramARB (GLhandleARB); GLAPI void APIENTRY glUniform1fARB (GLint, GLfloat); GLAPI void APIENTRY glUniform2fARB (GLint, GLfloat, GLfloat); GLAPI void APIENTRY glUniform3fARB (GLint, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glUniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glUniform1iARB (GLint, GLint); GLAPI void APIENTRY glUniform2iARB (GLint, GLint, GLint); GLAPI void APIENTRY glUniform3iARB (GLint, GLint, GLint, GLint); GLAPI void APIENTRY glUniform4iARB (GLint, GLint, GLint, GLint, GLint); GLAPI void APIENTRY glUniform1fvARB (GLint, GLsizei, const GLfloat *); GLAPI void APIENTRY glUniform2fvARB (GLint, GLsizei, const GLfloat *); GLAPI void APIENTRY glUniform3fvARB (GLint, GLsizei, const GLfloat *); GLAPI void APIENTRY glUniform4fvARB (GLint, GLsizei, const GLfloat *); GLAPI void APIENTRY glUniform1ivARB (GLint, GLsizei, const GLint *); GLAPI void APIENTRY glUniform2ivARB (GLint, GLsizei, const GLint *); GLAPI void APIENTRY glUniform3ivARB (GLint, GLsizei, const GLint *); GLAPI void APIENTRY glUniform4ivARB (GLint, GLsizei, const GLint *); GLAPI void APIENTRY glUniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *); GLAPI void APIENTRY glUniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *); GLAPI void APIENTRY glUniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *); GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *); GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB, GLenum, GLint *); GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB, const GLcharARB *); GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB, GLint, GLfloat *); GLAPI void APIENTRY glGetUniformivARB (GLhandleARB, GLint, GLint *); GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); #endif #ifndef GL_ARB_vertex_shader #define GL_ARB_vertex_shader 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *); GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB, const GLcharARB *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); #endif #ifndef GL_ARB_fragment_shader #define GL_ARB_fragment_shader 1 #endif #ifndef GL_ARB_shading_language_100 #define GL_ARB_shading_language_100 1 #endif #ifndef GL_ARB_texture_non_power_of_two #define GL_ARB_texture_non_power_of_two 1 #endif #ifndef GL_ARB_point_sprite #define GL_ARB_point_sprite 1 #endif #ifndef GL_ARB_fragment_program_shadow #define GL_ARB_fragment_program_shadow 1 #endif #ifndef GL_ARB_draw_buffers #define GL_ARB_draw_buffers 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDrawBuffersARB (GLsizei, const GLenum *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); #endif #ifndef GL_ARB_texture_rectangle #define GL_ARB_texture_rectangle 1 #endif #ifndef GL_ARB_color_buffer_float #define GL_ARB_color_buffer_float 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glClampColorARB (GLenum, GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); #endif #ifndef GL_ARB_half_float_pixel #define GL_ARB_half_float_pixel 1 #endif #ifndef GL_ARB_texture_float #define GL_ARB_texture_float 1 #endif #ifndef GL_ARB_pixel_buffer_object #define GL_ARB_pixel_buffer_object 1 #endif #ifndef GL_EXT_abgr #define GL_EXT_abgr 1 #endif #ifndef GL_EXT_blend_color #define GL_EXT_blend_color 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); #endif #ifndef GL_EXT_polygon_offset #define GL_EXT_polygon_offset 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); #endif #ifndef GL_EXT_texture #define GL_EXT_texture 1 #endif #ifndef GL_EXT_texture3D #define GL_EXT_texture3D 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); #endif #ifndef GL_SGIS_texture_filter4 #define GL_SGIS_texture_filter4 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); #endif #ifndef GL_EXT_subtexture #define GL_EXT_subtexture 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); #endif #ifndef GL_EXT_copy_texture #define GL_EXT_copy_texture 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei); GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); #endif #ifndef GL_EXT_histogram #define GL_EXT_histogram 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *); GLAPI void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean); GLAPI void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean); GLAPI void APIENTRY glResetHistogramEXT (GLenum); GLAPI void APIENTRY glResetMinmaxEXT (GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); #endif #ifndef GL_EXT_convolution #define GL_EXT_convolution 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat); GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *); GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint); GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *); GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei); GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *); GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); #endif #ifndef GL_EXT_color_matrix #define GL_EXT_color_matrix 1 #endif #ifndef GL_SGI_color_table #define GL_SGI_color_table 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *); GLAPI void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *); GLAPI void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei); GLAPI void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *); GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); #endif #ifndef GL_SGIX_pixel_texture #define GL_SGIX_pixel_texture 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glPixelTexGenSGIX (GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); #endif #ifndef GL_SGIS_pixel_texture #define GL_SGIS_pixel_texture 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint); GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *); GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat); GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *); GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *); GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); #endif #ifndef GL_SGIS_texture4D #define GL_SGIS_texture4D 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels); #endif #ifndef GL_SGI_texture_color_table #define GL_SGI_texture_color_table 1 #endif #ifndef GL_EXT_cmyka #define GL_EXT_cmyka 1 #endif #ifndef GL_EXT_texture_object #define GL_EXT_texture_object 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *); GLAPI void APIENTRY glBindTextureEXT (GLenum, GLuint); GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *); GLAPI void APIENTRY glGenTexturesEXT (GLsizei, GLuint *); GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint); GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *); #endif /* GL_GLEXT_PROTOTYPES */ typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); #endif #ifndef GL_SGIS_detail_texture #define GL_SGIS_detail_texture 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *); GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); #endif #ifndef GL_SGIS_sharpen_texture #define GL_SGIS_sharpen_texture 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *); GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); #endif #ifndef GL_EXT_packed_pixels #define GL_EXT_packed_pixels 1 #endif #ifndef GL_SGIS_texture_lod #define GL_SGIS_texture_lod 1 #endif #ifndef GL_SGIS_multisample #define GL_SGIS_multisample 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean); GLAPI void APIENTRY glSamplePatternSGIS (GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); #endif #ifndef GL_EXT_rescale_normal #define GL_EXT_rescale_normal 1 #endif #ifndef GL_EXT_vertex_array #define GL_EXT_vertex_array 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glArrayElementEXT (GLint); GLAPI void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); GLAPI void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei); GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *); GLAPI void APIENTRY glGetPointervEXT (GLenum, GLvoid* *); GLAPI void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); GLAPI void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); GLAPI void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); GLAPI void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); #endif #ifndef GL_EXT_misc_attribute #define GL_EXT_misc_attribute 1 #endif #ifndef GL_SGIS_generate_mipmap #define GL_SGIS_generate_mipmap 1 #endif #ifndef GL_SGIX_clipmap #define GL_SGIX_clipmap 1 #endif #ifndef GL_SGIX_shadow #define GL_SGIX_shadow 1 #endif #ifndef GL_SGIS_texture_edge_clamp #define GL_SGIS_texture_edge_clamp 1 #endif #ifndef GL_SGIS_texture_border_clamp #define GL_SGIS_texture_border_clamp 1 #endif #ifndef GL_EXT_blend_minmax #define GL_EXT_blend_minmax 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBlendEquationEXT (GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); #endif #ifndef GL_EXT_blend_subtract #define GL_EXT_blend_subtract 1 #endif #ifndef GL_EXT_blend_logic_op #define GL_EXT_blend_logic_op 1 #endif #ifndef GL_SGIX_interlace #define GL_SGIX_interlace 1 #endif #ifndef GL_SGIX_pixel_tiles #define GL_SGIX_pixel_tiles 1 #endif #ifndef GL_SGIX_texture_select #define GL_SGIX_texture_select 1 #endif #ifndef GL_SGIX_sprite #define GL_SGIX_sprite 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat); GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *); GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum, GLint); GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); #endif #ifndef GL_SGIX_texture_multi_buffer #define GL_SGIX_texture_multi_buffer 1 #endif #ifndef GL_EXT_point_parameters #define GL_EXT_point_parameters 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glPointParameterfEXT (GLenum, GLfloat); GLAPI void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); #endif #ifndef GL_SGIS_point_parameters #define GL_SGIS_point_parameters 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glPointParameterfSGIS (GLenum, GLfloat); GLAPI void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); #endif #ifndef GL_SGIX_instruments #define GL_SGIX_instruments 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *); GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *); GLAPI void APIENTRY glReadInstrumentsSGIX (GLint); GLAPI void APIENTRY glStartInstrumentsSGIX (void); GLAPI void APIENTRY glStopInstrumentsSGIX (GLint); #endif /* GL_GLEXT_PROTOTYPES */ typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); #endif #ifndef GL_SGIX_texture_scale_bias #define GL_SGIX_texture_scale_bias 1 #endif #ifndef GL_SGIX_framezoom #define GL_SGIX_framezoom 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glFrameZoomSGIX (GLint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); #endif #ifndef GL_SGIX_tag_sample_buffer #define GL_SGIX_tag_sample_buffer 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glTagSampleBufferSGIX (void); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); #endif #ifndef GL_SGIX_polynomial_ffd #define GL_SGIX_polynomial_ffd 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); GLAPI void APIENTRY glDeformSGIX (GLbitfield); GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); #endif #ifndef GL_SGIX_reference_plane #define GL_SGIX_reference_plane 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); #endif #ifndef GL_SGIX_flush_raster #define GL_SGIX_flush_raster 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glFlushRasterSGIX (void); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); #endif #ifndef GL_SGIX_depth_texture #define GL_SGIX_depth_texture 1 #endif #ifndef GL_SGIS_fog_function #define GL_SGIS_fog_function 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *); GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); #endif #ifndef GL_SGIX_fog_offset #define GL_SGIX_fog_offset 1 #endif #ifndef GL_HP_image_transform #define GL_HP_image_transform 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint); GLAPI void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat); GLAPI void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *); GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *); GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); #endif #ifndef GL_HP_convolution_border_modes #define GL_HP_convolution_border_modes 1 #endif #ifndef GL_SGIX_texture_add_env #define GL_SGIX_texture_add_env 1 #endif #ifndef GL_EXT_color_subtable #define GL_EXT_color_subtable 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); #endif #ifndef GL_PGI_vertex_hints #define GL_PGI_vertex_hints 1 #endif #ifndef GL_PGI_misc_hints #define GL_PGI_misc_hints 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glHintPGI (GLenum, GLint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); #endif #ifndef GL_EXT_paletted_texture #define GL_EXT_paletted_texture 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); GLAPI void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *); GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); #endif #ifndef GL_EXT_clip_volume_hint #define GL_EXT_clip_volume_hint 1 #endif #ifndef GL_SGIX_list_priority #define GL_SGIX_list_priority 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *); GLAPI void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *); GLAPI void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat); GLAPI void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *); GLAPI void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint); GLAPI void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); #endif #ifndef GL_SGIX_ir_instrument1 #define GL_SGIX_ir_instrument1 1 #endif #ifndef GL_SGIX_calligraphic_fragment #define GL_SGIX_calligraphic_fragment 1 #endif #ifndef GL_SGIX_texture_lod_bias #define GL_SGIX_texture_lod_bias 1 #endif #ifndef GL_SGIX_shadow_ambient #define GL_SGIX_shadow_ambient 1 #endif #ifndef GL_EXT_index_texture #define GL_EXT_index_texture 1 #endif #ifndef GL_EXT_index_material #define GL_EXT_index_material 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glIndexMaterialEXT (GLenum, GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); #endif #ifndef GL_EXT_index_func #define GL_EXT_index_func 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glIndexFuncEXT (GLenum, GLclampf); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); #endif #ifndef GL_EXT_index_array_formats #define GL_EXT_index_array_formats 1 #endif #ifndef GL_EXT_compiled_vertex_array #define GL_EXT_compiled_vertex_array 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glLockArraysEXT (GLint, GLsizei); GLAPI void APIENTRY glUnlockArraysEXT (void); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); #endif #ifndef GL_EXT_cull_vertex #define GL_EXT_cull_vertex 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *); GLAPI void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); #endif #ifndef GL_SGIX_ycrcb #define GL_SGIX_ycrcb 1 #endif #ifndef GL_SGIX_fragment_lighting #define GL_SGIX_fragment_lighting 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum); GLAPI void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat); GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *); GLAPI void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint); GLAPI void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *); GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat); GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *); GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint); GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *); GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat); GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *); GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint); GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *); GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *); GLAPI void APIENTRY glLightEnviSGIX (GLenum, GLint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); #endif #ifndef GL_IBM_rasterpos_clip #define GL_IBM_rasterpos_clip 1 #endif #ifndef GL_HP_texture_lighting #define GL_HP_texture_lighting 1 #endif #ifndef GL_EXT_draw_range_elements #define GL_EXT_draw_range_elements 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); #endif #ifndef GL_WIN_phong_shading #define GL_WIN_phong_shading 1 #endif #ifndef GL_WIN_specular_fog #define GL_WIN_specular_fog 1 #endif #ifndef GL_EXT_light_texture #define GL_EXT_light_texture 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glApplyTextureEXT (GLenum); GLAPI void APIENTRY glTextureLightEXT (GLenum); GLAPI void APIENTRY glTextureMaterialEXT (GLenum, GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); #endif #ifndef GL_SGIX_blend_alpha_minmax #define GL_SGIX_blend_alpha_minmax 1 #endif #ifndef GL_EXT_bgra #define GL_EXT_bgra 1 #endif #ifndef GL_SGIX_async #define GL_SGIX_async 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint); GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *); GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *); GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei); GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei); GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); #endif #ifndef GL_SGIX_async_pixel #define GL_SGIX_async_pixel 1 #endif #ifndef GL_SGIX_async_histogram #define GL_SGIX_async_histogram 1 #endif #ifndef GL_INTEL_parallel_arrays #define GL_INTEL_parallel_arrays 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *); GLAPI void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *); GLAPI void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *); GLAPI void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); #endif #ifndef GL_HP_occlusion_test #define GL_HP_occlusion_test 1 #endif #ifndef GL_EXT_pixel_transform #define GL_EXT_pixel_transform 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint); GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat); GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *); GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); #endif #ifndef GL_EXT_pixel_transform_color_table #define GL_EXT_pixel_transform_color_table 1 #endif #ifndef GL_EXT_shared_texture_palette #define GL_EXT_shared_texture_palette 1 #endif #ifndef GL_EXT_separate_specular_color #define GL_EXT_separate_specular_color 1 #endif #ifndef GL_EXT_secondary_color #define GL_EXT_secondary_color 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte); GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *); GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *); GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *); GLAPI void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint); GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *); GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort); GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *); GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte); GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *); GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint); GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *); GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort); GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *); GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); #endif #ifndef GL_EXT_texture_perturb_normal #define GL_EXT_texture_perturb_normal 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glTextureNormalEXT (GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); #endif #ifndef GL_EXT_multi_draw_arrays #define GL_EXT_multi_draw_arrays 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); #endif #ifndef GL_EXT_fog_coord #define GL_EXT_fog_coord 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glFogCoordfEXT (GLfloat); GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *); GLAPI void APIENTRY glFogCoorddEXT (GLdouble); GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *); GLAPI void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); #endif #ifndef GL_REND_screen_coordinates #define GL_REND_screen_coordinates 1 #endif #ifndef GL_EXT_coordinate_frame #define GL_EXT_coordinate_frame 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte); GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *); GLAPI void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *); GLAPI void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *); GLAPI void APIENTRY glTangent3iEXT (GLint, GLint, GLint); GLAPI void APIENTRY glTangent3ivEXT (const GLint *); GLAPI void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort); GLAPI void APIENTRY glTangent3svEXT (const GLshort *); GLAPI void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte); GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *); GLAPI void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *); GLAPI void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *); GLAPI void APIENTRY glBinormal3iEXT (GLint, GLint, GLint); GLAPI void APIENTRY glBinormal3ivEXT (const GLint *); GLAPI void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort); GLAPI void APIENTRY glBinormal3svEXT (const GLshort *); GLAPI void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); #endif #ifndef GL_EXT_texture_env_combine #define GL_EXT_texture_env_combine 1 #endif #ifndef GL_APPLE_specular_vector #define GL_APPLE_specular_vector 1 #endif #ifndef GL_APPLE_transform_hint #define GL_APPLE_transform_hint 1 #endif #ifndef GL_SGIX_fog_scale #define GL_SGIX_fog_scale 1 #endif #ifndef GL_SUNX_constant_data #define GL_SUNX_constant_data 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glFinishTextureSUNX (void); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); #endif #ifndef GL_SUN_global_alpha #define GL_SUN_global_alpha 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte); GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort); GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint); GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat); GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble); GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte); GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort); GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); #endif #ifndef GL_SUN_triangle_list #define GL_SUN_triangle_list 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint); GLAPI void APIENTRY glReplacementCodeusSUN (GLushort); GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte); GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *); GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *); GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *); GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); #endif #ifndef GL_SUN_vertex #define GL_SUN_vertex 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat); GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *); GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *); GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *); GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *); GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *); GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *); GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *); GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *, const GLfloat *); GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *, const GLubyte *, const GLfloat *); GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); #endif #ifndef GL_EXT_blend_func_separate #define GL_EXT_blend_func_separate 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); #endif #ifndef GL_INGR_blend_func_separate #define GL_INGR_blend_func_separate 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); #endif #ifndef GL_INGR_color_clamp #define GL_INGR_color_clamp 1 #endif #ifndef GL_INGR_interlace_read #define GL_INGR_interlace_read 1 #endif #ifndef GL_EXT_stencil_wrap #define GL_EXT_stencil_wrap 1 #endif #ifndef GL_EXT_422_pixels #define GL_EXT_422_pixels 1 #endif #ifndef GL_NV_texgen_reflection #define GL_NV_texgen_reflection 1 #endif #ifndef GL_SUN_convolution_border_modes #define GL_SUN_convolution_border_modes 1 #endif #ifndef GL_EXT_texture_env_add #define GL_EXT_texture_env_add 1 #endif #ifndef GL_EXT_texture_lod_bias #define GL_EXT_texture_lod_bias 1 #endif #ifndef GL_EXT_texture_filter_anisotropic #define GL_EXT_texture_filter_anisotropic 1 #endif #ifndef GL_EXT_vertex_weighting #define GL_EXT_vertex_weighting 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glVertexWeightfEXT (GLfloat); GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *); GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); #endif #ifndef GL_NV_light_max_exponent #define GL_NV_light_max_exponent 1 #endif #ifndef GL_NV_vertex_array_range #define GL_NV_vertex_array_range 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer); #endif #ifndef GL_NV_register_combiners #define GL_NV_register_combiners 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *); GLAPI void APIENTRY glCombinerParameterfNV (GLenum, GLfloat); GLAPI void APIENTRY glCombinerParameterivNV (GLenum, const GLint *); GLAPI void APIENTRY glCombinerParameteriNV (GLenum, GLint); GLAPI void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); GLAPI void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); GLAPI void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum); GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); #endif #ifndef GL_NV_fog_distance #define GL_NV_fog_distance 1 #endif #ifndef GL_NV_texgen_emboss #define GL_NV_texgen_emboss 1 #endif #ifndef GL_NV_blend_square #define GL_NV_blend_square 1 #endif #ifndef GL_NV_texture_env_combine4 #define GL_NV_texture_env_combine4 1 #endif #ifndef GL_MESA_resize_buffers #define GL_MESA_resize_buffers 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glResizeBuffersMESA (void); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); #endif #ifndef GL_MESA_window_pos #define GL_MESA_window_pos 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble); GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *); GLAPI void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat); GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *); GLAPI void APIENTRY glWindowPos2iMESA (GLint, GLint); GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *); GLAPI void APIENTRY glWindowPos2sMESA (GLshort, GLshort); GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *); GLAPI void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *); GLAPI void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *); GLAPI void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint); GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *); GLAPI void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort); GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *); GLAPI void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *); GLAPI void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *); GLAPI void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint); GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *); GLAPI void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort); GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); #endif #ifndef GL_IBM_cull_vertex #define GL_IBM_cull_vertex 1 #endif #ifndef GL_IBM_multimode_draw_arrays #define GL_IBM_multimode_draw_arrays 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint); GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* const *, GLsizei, GLint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); #endif #ifndef GL_IBM_vertex_array_lists #define GL_IBM_vertex_array_lists 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint); GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); GLAPI void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); GLAPI void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); GLAPI void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); GLAPI void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); #endif #ifndef GL_SGIX_subsample #define GL_SGIX_subsample 1 #endif #ifndef GL_SGIX_ycrcba #define GL_SGIX_ycrcba 1 #endif #ifndef GL_SGIX_ycrcb_subsample #define GL_SGIX_ycrcb_subsample 1 #endif #ifndef GL_SGIX_depth_pass_instrument #define GL_SGIX_depth_pass_instrument 1 #endif #ifndef GL_3DFX_texture_compression_FXT1 #define GL_3DFX_texture_compression_FXT1 1 #endif #ifndef GL_3DFX_multisample #define GL_3DFX_multisample 1 #endif #ifndef GL_3DFX_tbuffer #define GL_3DFX_tbuffer 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glTbufferMask3DFX (GLuint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); #endif #ifndef GL_EXT_multisample #define GL_EXT_multisample 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glSampleMaskEXT (GLclampf, GLboolean); GLAPI void APIENTRY glSamplePatternEXT (GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); #endif #ifndef GL_SGIX_vertex_preclip #define GL_SGIX_vertex_preclip 1 #endif #ifndef GL_SGIX_convolution_accuracy #define GL_SGIX_convolution_accuracy 1 #endif #ifndef GL_SGIX_resample #define GL_SGIX_resample 1 #endif #ifndef GL_SGIS_point_line_texgen #define GL_SGIS_point_line_texgen 1 #endif #ifndef GL_SGIS_texture_color_mask #define GL_SGIS_texture_color_mask 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); #endif #ifndef GL_SGIX_igloo_interface #define GL_SGIX_igloo_interface 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); #endif #ifndef GL_EXT_texture_env_dot3 #define GL_EXT_texture_env_dot3 1 #endif #ifndef GL_ATI_texture_mirror_once #define GL_ATI_texture_mirror_once 1 #endif #ifndef GL_NV_fence #define GL_NV_fence 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); GLAPI void APIENTRY glGenFencesNV (GLsizei, GLuint *); GLAPI GLboolean APIENTRY glIsFenceNV (GLuint); GLAPI GLboolean APIENTRY glTestFenceNV (GLuint); GLAPI void APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); GLAPI void APIENTRY glFinishFenceNV (GLuint); GLAPI void APIENTRY glSetFenceNV (GLuint, GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); #endif #ifndef GL_NV_evaluators #define GL_NV_evaluators 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, const GLvoid *); GLAPI void APIENTRY glMapParameterivNV (GLenum, GLenum, const GLint *); GLAPI void APIENTRY glMapParameterfvNV (GLenum, GLenum, const GLfloat *); GLAPI void APIENTRY glGetMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, GLvoid *); GLAPI void APIENTRY glGetMapParameterivNV (GLenum, GLenum, GLint *); GLAPI void APIENTRY glGetMapParameterfvNV (GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum, GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); GLAPI void APIENTRY glEvalMapsNV (GLenum, GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); #endif #ifndef GL_NV_packed_depth_stencil #define GL_NV_packed_depth_stencil 1 #endif #ifndef GL_NV_register_combiners2 #define GL_NV_register_combiners2 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum, GLenum, const GLfloat *); GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum, GLenum, GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); #endif #ifndef GL_NV_texture_compression_vtc #define GL_NV_texture_compression_vtc 1 #endif #ifndef GL_NV_texture_rectangle #define GL_NV_texture_rectangle 1 #endif #ifndef GL_NV_texture_shader #define GL_NV_texture_shader 1 #endif #ifndef GL_NV_texture_shader2 #define GL_NV_texture_shader2 1 #endif #ifndef GL_NV_vertex_array_range2 #define GL_NV_vertex_array_range2 1 #endif #ifndef GL_NV_vertex_program #define GL_NV_vertex_program 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei, const GLuint *, GLboolean *); GLAPI void APIENTRY glBindProgramNV (GLenum, GLuint); GLAPI void APIENTRY glDeleteProgramsNV (GLsizei, const GLuint *); GLAPI void APIENTRY glExecuteProgramNV (GLenum, GLuint, const GLfloat *); GLAPI void APIENTRY glGenProgramsNV (GLsizei, GLuint *); GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum, GLuint, GLenum, GLdouble *); GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); GLAPI void APIENTRY glGetProgramivNV (GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetProgramStringNV (GLuint, GLenum, GLubyte *); GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum, GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint, GLenum, GLdouble *); GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint, GLenum, GLfloat *); GLAPI void APIENTRY glGetVertexAttribivNV (GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint, GLenum, GLvoid* *); GLAPI GLboolean APIENTRY glIsProgramNV (GLuint); GLAPI void APIENTRY glLoadProgramNV (GLenum, GLuint, GLsizei, const GLubyte *); GLAPI void APIENTRY glProgramParameter4dNV (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glProgramParameter4dvNV (GLenum, GLuint, const GLdouble *); GLAPI void APIENTRY glProgramParameter4fNV (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glProgramParameter4fvNV (GLenum, GLuint, const GLfloat *); GLAPI void APIENTRY glProgramParameters4dvNV (GLenum, GLuint, GLuint, const GLdouble *); GLAPI void APIENTRY glProgramParameters4fvNV (GLenum, GLuint, GLuint, const GLfloat *); GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei, const GLuint *); GLAPI void APIENTRY glTrackMatrixNV (GLenum, GLuint, GLenum, GLenum); GLAPI void APIENTRY glVertexAttribPointerNV (GLuint, GLint, GLenum, GLsizei, const GLvoid *); GLAPI void APIENTRY glVertexAttrib1dNV (GLuint, GLdouble); GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint, const GLdouble *); GLAPI void APIENTRY glVertexAttrib1fNV (GLuint, GLfloat); GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint, const GLfloat *); GLAPI void APIENTRY glVertexAttrib1sNV (GLuint, GLshort); GLAPI void APIENTRY glVertexAttrib1svNV (GLuint, const GLshort *); GLAPI void APIENTRY glVertexAttrib2dNV (GLuint, GLdouble, GLdouble); GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint, const GLdouble *); GLAPI void APIENTRY glVertexAttrib2fNV (GLuint, GLfloat, GLfloat); GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint, const GLfloat *); GLAPI void APIENTRY glVertexAttrib2sNV (GLuint, GLshort, GLshort); GLAPI void APIENTRY glVertexAttrib2svNV (GLuint, const GLshort *); GLAPI void APIENTRY glVertexAttrib3dNV (GLuint, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint, const GLdouble *); GLAPI void APIENTRY glVertexAttrib3fNV (GLuint, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint, const GLfloat *); GLAPI void APIENTRY glVertexAttrib3sNV (GLuint, GLshort, GLshort, GLshort); GLAPI void APIENTRY glVertexAttrib3svNV (GLuint, const GLshort *); GLAPI void APIENTRY glVertexAttrib4dNV (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint, const GLdouble *); GLAPI void APIENTRY glVertexAttrib4fNV (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint, const GLfloat *); GLAPI void APIENTRY glVertexAttrib4sNV (GLuint, GLshort, GLshort, GLshort, GLshort); GLAPI void APIENTRY glVertexAttrib4svNV (GLuint, const GLshort *); GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint, const GLubyte *); GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint, GLsizei, const GLdouble *); GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint, GLsizei, const GLfloat *); GLAPI void APIENTRY glVertexAttribs1svNV (GLuint, GLsizei, const GLshort *); GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint, GLsizei, const GLdouble *); GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint, GLsizei, const GLfloat *); GLAPI void APIENTRY glVertexAttribs2svNV (GLuint, GLsizei, const GLshort *); GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint, GLsizei, const GLdouble *); GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint, GLsizei, const GLfloat *); GLAPI void APIENTRY glVertexAttribs3svNV (GLuint, GLsizei, const GLshort *); GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint, GLsizei, const GLdouble *); GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint, GLsizei, const GLfloat *); GLAPI void APIENTRY glVertexAttribs4svNV (GLuint, GLsizei, const GLshort *); GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint, GLsizei, const GLubyte *); #endif /* GL_GLEXT_PROTOTYPES */ typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v); typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v); typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); #endif #ifndef GL_SGIX_texture_coordinate_clamp #define GL_SGIX_texture_coordinate_clamp 1 #endif #ifndef GL_SGIX_scalebias_hint #define GL_SGIX_scalebias_hint 1 #endif #ifndef GL_OML_interlace #define GL_OML_interlace 1 #endif #ifndef GL_OML_subsample #define GL_OML_subsample 1 #endif #ifndef GL_OML_resample #define GL_OML_resample 1 #endif #ifndef GL_NV_copy_depth_to_color #define GL_NV_copy_depth_to_color 1 #endif #ifndef GL_ATI_envmap_bumpmap #define GL_ATI_envmap_bumpmap 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glTexBumpParameterivATI (GLenum, const GLint *); GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum, const GLfloat *); GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum, GLint *); GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum, GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); #endif #ifndef GL_ATI_fragment_shader #define GL_ATI_fragment_shader 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint); GLAPI void APIENTRY glBindFragmentShaderATI (GLuint); GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint); GLAPI void APIENTRY glBeginFragmentShaderATI (void); GLAPI void APIENTRY glEndFragmentShaderATI (void); GLAPI void APIENTRY glPassTexCoordATI (GLuint, GLuint, GLenum); GLAPI void APIENTRY glSampleMapATI (GLuint, GLuint, GLenum); GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint, const GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); #endif #ifndef GL_ATI_pn_triangles #define GL_ATI_pn_triangles 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glPNTrianglesiATI (GLenum, GLint); GLAPI void APIENTRY glPNTrianglesfATI (GLenum, GLfloat); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); #endif #ifndef GL_ATI_vertex_array_object #define GL_ATI_vertex_array_object 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei, const GLvoid *, GLenum); GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint); GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint, GLuint, GLsizei, const GLvoid *, GLenum); GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint, GLenum, GLfloat *); GLAPI void APIENTRY glGetObjectBufferivATI (GLuint, GLenum, GLint *); GLAPI void APIENTRY glFreeObjectBufferATI (GLuint); GLAPI void APIENTRY glArrayObjectATI (GLenum, GLint, GLenum, GLsizei, GLuint, GLuint); GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum, GLenum, GLfloat *); GLAPI void APIENTRY glGetArrayObjectivATI (GLenum, GLenum, GLint *); GLAPI void APIENTRY glVariantArrayObjectATI (GLuint, GLenum, GLsizei, GLuint, GLuint); GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint, GLenum, GLfloat *); GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint, GLenum, GLint *); #endif /* GL_GLEXT_PROTOTYPES */ typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage); typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); #endif #ifndef GL_EXT_vertex_shader #define GL_EXT_vertex_shader 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBeginVertexShaderEXT (void); GLAPI void APIENTRY glEndVertexShaderEXT (void); GLAPI void APIENTRY glBindVertexShaderEXT (GLuint); GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint); GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint); GLAPI void APIENTRY glShaderOp1EXT (GLenum, GLuint, GLuint); GLAPI void APIENTRY glShaderOp2EXT (GLenum, GLuint, GLuint, GLuint); GLAPI void APIENTRY glShaderOp3EXT (GLenum, GLuint, GLuint, GLuint, GLuint); GLAPI void APIENTRY glSwizzleEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); GLAPI void APIENTRY glWriteMaskEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); GLAPI void APIENTRY glInsertComponentEXT (GLuint, GLuint, GLuint); GLAPI void APIENTRY glExtractComponentEXT (GLuint, GLuint, GLuint); GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum, GLenum, GLenum, GLuint); GLAPI void APIENTRY glSetInvariantEXT (GLuint, GLenum, const GLvoid *); GLAPI void APIENTRY glSetLocalConstantEXT (GLuint, GLenum, const GLvoid *); GLAPI void APIENTRY glVariantbvEXT (GLuint, const GLbyte *); GLAPI void APIENTRY glVariantsvEXT (GLuint, const GLshort *); GLAPI void APIENTRY glVariantivEXT (GLuint, const GLint *); GLAPI void APIENTRY glVariantfvEXT (GLuint, const GLfloat *); GLAPI void APIENTRY glVariantdvEXT (GLuint, const GLdouble *); GLAPI void APIENTRY glVariantubvEXT (GLuint, const GLubyte *); GLAPI void APIENTRY glVariantusvEXT (GLuint, const GLushort *); GLAPI void APIENTRY glVariantuivEXT (GLuint, const GLuint *); GLAPI void APIENTRY glVariantPointerEXT (GLuint, GLenum, GLuint, const GLvoid *); GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint); GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint); GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum, GLenum); GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum, GLenum); GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum, GLenum, GLenum); GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum, GLenum); GLAPI GLuint APIENTRY glBindParameterEXT (GLenum); GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint, GLenum); GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint, GLenum, GLboolean *); GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint, GLenum, GLfloat *); GLAPI void APIENTRY glGetVariantPointervEXT (GLuint, GLenum, GLvoid* *); GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint, GLenum, GLboolean *); GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint, GLenum, GLfloat *); GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint, GLenum, GLboolean *); GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint, GLenum, GLfloat *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data); typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); #endif #ifndef GL_ATI_vertex_streams #define GL_ATI_vertex_streams 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glVertexStream1sATI (GLenum, GLshort); GLAPI void APIENTRY glVertexStream1svATI (GLenum, const GLshort *); GLAPI void APIENTRY glVertexStream1iATI (GLenum, GLint); GLAPI void APIENTRY glVertexStream1ivATI (GLenum, const GLint *); GLAPI void APIENTRY glVertexStream1fATI (GLenum, GLfloat); GLAPI void APIENTRY glVertexStream1fvATI (GLenum, const GLfloat *); GLAPI void APIENTRY glVertexStream1dATI (GLenum, GLdouble); GLAPI void APIENTRY glVertexStream1dvATI (GLenum, const GLdouble *); GLAPI void APIENTRY glVertexStream2sATI (GLenum, GLshort, GLshort); GLAPI void APIENTRY glVertexStream2svATI (GLenum, const GLshort *); GLAPI void APIENTRY glVertexStream2iATI (GLenum, GLint, GLint); GLAPI void APIENTRY glVertexStream2ivATI (GLenum, const GLint *); GLAPI void APIENTRY glVertexStream2fATI (GLenum, GLfloat, GLfloat); GLAPI void APIENTRY glVertexStream2fvATI (GLenum, const GLfloat *); GLAPI void APIENTRY glVertexStream2dATI (GLenum, GLdouble, GLdouble); GLAPI void APIENTRY glVertexStream2dvATI (GLenum, const GLdouble *); GLAPI void APIENTRY glVertexStream3sATI (GLenum, GLshort, GLshort, GLshort); GLAPI void APIENTRY glVertexStream3svATI (GLenum, const GLshort *); GLAPI void APIENTRY glVertexStream3iATI (GLenum, GLint, GLint, GLint); GLAPI void APIENTRY glVertexStream3ivATI (GLenum, const GLint *); GLAPI void APIENTRY glVertexStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glVertexStream3fvATI (GLenum, const GLfloat *); GLAPI void APIENTRY glVertexStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glVertexStream3dvATI (GLenum, const GLdouble *); GLAPI void APIENTRY glVertexStream4sATI (GLenum, GLshort, GLshort, GLshort, GLshort); GLAPI void APIENTRY glVertexStream4svATI (GLenum, const GLshort *); GLAPI void APIENTRY glVertexStream4iATI (GLenum, GLint, GLint, GLint, GLint); GLAPI void APIENTRY glVertexStream4ivATI (GLenum, const GLint *); GLAPI void APIENTRY glVertexStream4fATI (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glVertexStream4fvATI (GLenum, const GLfloat *); GLAPI void APIENTRY glVertexStream4dATI (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glVertexStream4dvATI (GLenum, const GLdouble *); GLAPI void APIENTRY glNormalStream3bATI (GLenum, GLbyte, GLbyte, GLbyte); GLAPI void APIENTRY glNormalStream3bvATI (GLenum, const GLbyte *); GLAPI void APIENTRY glNormalStream3sATI (GLenum, GLshort, GLshort, GLshort); GLAPI void APIENTRY glNormalStream3svATI (GLenum, const GLshort *); GLAPI void APIENTRY glNormalStream3iATI (GLenum, GLint, GLint, GLint); GLAPI void APIENTRY glNormalStream3ivATI (GLenum, const GLint *); GLAPI void APIENTRY glNormalStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glNormalStream3fvATI (GLenum, const GLfloat *); GLAPI void APIENTRY glNormalStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glNormalStream3dvATI (GLenum, const GLdouble *); GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum); GLAPI void APIENTRY glVertexBlendEnviATI (GLenum, GLint); GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum, GLfloat); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); #endif #ifndef GL_ATI_element_array #define GL_ATI_element_array 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glElementPointerATI (GLenum, const GLvoid *); GLAPI void APIENTRY glDrawElementArrayATI (GLenum, GLsizei); GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum, GLuint, GLuint, GLsizei); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer); typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); #endif #ifndef GL_SUN_mesh_array #define GL_SUN_mesh_array 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum, GLint, GLsizei, GLsizei); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); #endif #ifndef GL_SUN_slice_accum #define GL_SUN_slice_accum 1 #endif #ifndef GL_NV_multisample_filter_hint #define GL_NV_multisample_filter_hint 1 #endif #ifndef GL_NV_depth_clamp #define GL_NV_depth_clamp 1 #endif #ifndef GL_NV_occlusion_query #define GL_NV_occlusion_query 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei, GLuint *); GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei, const GLuint *); GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint); GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint); GLAPI void APIENTRY glEndOcclusionQueryNV (void); GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint, GLenum, GLint *); GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint, GLenum, GLuint *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); #endif #ifndef GL_NV_point_sprite #define GL_NV_point_sprite 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glPointParameteriNV (GLenum, GLint); GLAPI void APIENTRY glPointParameterivNV (GLenum, const GLint *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); #endif #ifndef GL_NV_texture_shader3 #define GL_NV_texture_shader3 1 #endif #ifndef GL_NV_vertex_program1_1 #define GL_NV_vertex_program1_1 1 #endif #ifndef GL_EXT_shadow_funcs #define GL_EXT_shadow_funcs 1 #endif #ifndef GL_EXT_stencil_two_side #define GL_EXT_stencil_two_side 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); #endif #ifndef GL_ATI_text_fragment_shader #define GL_ATI_text_fragment_shader 1 #endif #ifndef GL_APPLE_client_storage #define GL_APPLE_client_storage 1 #endif #ifndef GL_APPLE_element_array #define GL_APPLE_element_array 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glElementPointerAPPLE (GLenum, const GLvoid *); GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum, GLint, GLsizei); GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, GLint, GLsizei); GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum, const GLint *, const GLsizei *, GLsizei); GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, const GLint *, const GLsizei *, GLsizei); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer); typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); #endif #ifndef GL_APPLE_fence #define GL_APPLE_fence 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glGenFencesAPPLE (GLsizei, GLuint *); GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei, const GLuint *); GLAPI void APIENTRY glSetFenceAPPLE (GLuint); GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint); GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint); GLAPI void APIENTRY glFinishFenceAPPLE (GLuint); GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum, GLuint); GLAPI void APIENTRY glFinishObjectAPPLE (GLenum, GLint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); #endif #ifndef GL_APPLE_vertex_array_object #define GL_APPLE_vertex_array_object 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint); GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei, const GLuint *); GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei, const GLuint *); GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); #endif #ifndef GL_APPLE_vertex_array_range #define GL_APPLE_vertex_array_range 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei, GLvoid *); GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei, GLvoid *); GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum, GLint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); #endif #ifndef GL_APPLE_ycbcr_422 #define GL_APPLE_ycbcr_422 1 #endif #ifndef GL_S3_s3tc #define GL_S3_s3tc 1 #endif #ifndef GL_ATI_draw_buffers #define GL_ATI_draw_buffers 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDrawBuffersATI (GLsizei, const GLenum *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); #endif #ifndef GL_ATI_pixel_format_float #define GL_ATI_pixel_format_float 1 /* This is really a WGL extension, but defines some associated GL enums. * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string. */ #endif #ifndef GL_ATI_texture_env_combine3 #define GL_ATI_texture_env_combine3 1 #endif #ifndef GL_ATI_texture_float #define GL_ATI_texture_float 1 #endif #ifndef GL_NV_float_buffer #define GL_NV_float_buffer 1 #endif #ifndef GL_NV_fragment_program #define GL_NV_fragment_program 1 /* Some NV_fragment_program entry points are shared with ARB_vertex_program. */ #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat); GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble); GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint, GLsizei, const GLubyte *, const GLfloat *); GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint, GLsizei, const GLubyte *, const GLdouble *); GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint, GLsizei, const GLubyte *, GLfloat *); GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint, GLsizei, const GLubyte *, GLdouble *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); #endif #ifndef GL_NV_half_float #define GL_NV_half_float 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glVertex2hNV (GLhalfNV, GLhalfNV); GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *); GLAPI void APIENTRY glVertex3hNV (GLhalfNV, GLhalfNV, GLhalfNV); GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *); GLAPI void APIENTRY glVertex4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *); GLAPI void APIENTRY glNormal3hNV (GLhalfNV, GLhalfNV, GLhalfNV); GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *); GLAPI void APIENTRY glColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *); GLAPI void APIENTRY glColor4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *); GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV); GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *); GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV, GLhalfNV); GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *); GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV, GLhalfNV, GLhalfNV); GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *); GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *); GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum, GLhalfNV); GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum, const GLhalfNV *); GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum, GLhalfNV, GLhalfNV); GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum, const GLhalfNV *); GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV); GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum, const GLhalfNV *); GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum, const GLhalfNV *); GLAPI void APIENTRY glFogCoordhNV (GLhalfNV); GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *); GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *); GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV); GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *); GLAPI void APIENTRY glVertexAttrib1hNV (GLuint, GLhalfNV); GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint, const GLhalfNV *); GLAPI void APIENTRY glVertexAttrib2hNV (GLuint, GLhalfNV, GLhalfNV); GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint, const GLhalfNV *); GLAPI void APIENTRY glVertexAttrib3hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV); GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint, const GLhalfNV *); GLAPI void APIENTRY glVertexAttrib4hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint, const GLhalfNV *); GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint, GLsizei, const GLhalfNV *); GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint, GLsizei, const GLhalfNV *); GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint, GLsizei, const GLhalfNV *); GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint, GLsizei, const GLhalfNV *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); #endif #ifndef GL_NV_pixel_data_range #define GL_NV_pixel_data_range 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glPixelDataRangeNV (GLenum, GLsizei, GLvoid *); GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer); typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); #endif #ifndef GL_NV_primitive_restart #define GL_NV_primitive_restart 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glPrimitiveRestartNV (void); GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); #endif #ifndef GL_NV_texture_expand_normal #define GL_NV_texture_expand_normal 1 #endif #ifndef GL_NV_vertex_program2 #define GL_NV_vertex_program2 1 #endif #ifndef GL_ATI_map_object_buffer #define GL_ATI_map_object_buffer 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint); GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint); #endif /* GL_GLEXT_PROTOTYPES */ typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); #endif #ifndef GL_ATI_separate_stencil #define GL_ATI_separate_stencil 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glStencilOpSeparateATI (GLenum, GLenum, GLenum, GLenum); GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum, GLenum, GLint, GLuint); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); #endif #ifndef GL_ATI_vertex_attrib_array_object #define GL_ATI_vertex_attrib_array_object 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint); GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint, GLenum, GLfloat *); GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint, GLenum, GLint *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); #endif #ifndef GL_OES_read_format #define GL_OES_read_format 1 #endif #ifndef GL_EXT_depth_bounds_test #define GL_EXT_depth_bounds_test 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDepthBoundsEXT (GLclampd, GLclampd); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); #endif #ifndef GL_EXT_texture_mirror_clamp #define GL_EXT_texture_mirror_clamp 1 #endif #ifndef GL_EXT_blend_equation_separate #define GL_EXT_blend_equation_separate 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum, GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); #endif #ifndef GL_MESA_pack_invert #define GL_MESA_pack_invert 1 #endif #ifndef GL_MESA_ycbcr_texture #define GL_MESA_ycbcr_texture 1 #endif #ifndef GL_EXT_pixel_buffer_object #define GL_EXT_pixel_buffer_object 1 #endif #ifndef GL_NV_fragment_program_option #define GL_NV_fragment_program_option 1 #endif #ifndef GL_NV_fragment_program2 #define GL_NV_fragment_program2 1 #endif #ifndef GL_NV_vertex_program2_option #define GL_NV_vertex_program2_option 1 #endif #ifndef GL_NV_vertex_program3 #define GL_NV_vertex_program3 1 #endif #ifndef GL_EXT_framebuffer_object #define GL_EXT_framebuffer_object 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint); GLAPI void APIENTRY glBindRenderbufferEXT (GLenum, GLuint); GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei, const GLuint *); GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei, GLuint *); GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum, GLenum, GLsizei, GLsizei); GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum, GLenum, GLint *); GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint); GLAPI void APIENTRY glBindFramebufferEXT (GLenum, GLuint); GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei, const GLuint *); GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei, GLuint *); GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum); GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum, GLenum, GLenum, GLuint, GLint); GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint); GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLint); GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint); GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum, GLenum, GLenum, GLint *); GLAPI void APIENTRY glGenerateMipmapEXT (GLenum); #endif /* GL_GLEXT_PROTOTYPES */ typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); #endif #ifndef GL_GREMEDY_string_marker #define GL_GREMEDY_string_marker 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei, const GLvoid *); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string); #endif #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/include/GL/gl.h0000644000000000000000000026004113614532424016204 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef __gl_h_ #define __gl_h_ #if defined(USE_MGL_NAMESPACE) #include "gl_mangle.h" #endif /********************************************************************** * Begin system-specific stuff. Do not do any of this when building * for SciTech SNAP, as this is all done before this header file is * included. */ #if !defined(__SCITECH_SNAP__) #if defined(__BEOS__) #include /* to get some BeOS-isms */ #endif #if !defined(OPENSTEP) && (defined(NeXT) || defined(NeXT_PDO)) #define OPENSTEP #endif #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) #define __WIN32__ #endif #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) # if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ # define GLAPI __declspec(dllexport) # elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ # define GLAPI __declspec(dllimport) # else /* for use with static link lib build of Win32 edition only */ # define GLAPI extern # endif /* _STATIC_MESA support */ # define GLAPIENTRY __stdcall #elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */ # define GLAPI extern # define GLAPIENTRY __stdcall #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 # define GLAPI __attribute__((visibility("default"))) # define GLAPIENTRY #endif /* WIN32 && !CYGWIN */ #if (defined(__BEOS__) && defined(__POWERPC__)) || defined(__QUICKDRAW__) # define PRAGMA_EXPORT_SUPPORTED 1 #endif /* * WINDOWS: Include windows.h here to define APIENTRY. * It is also useful when applications include this file by * including only glut.h, since glut.h depends on windows.h. * Applications needing to include windows.h with parms other * than "WIN32_LEAN_AND_MEAN" may include windows.h before * glut.h or gl.h. */ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) #define WIN32_LEAN_AND_MEAN 1 #include #endif #if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__) #include #endif #if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED #pragma import on #endif #ifndef GLAPI #define GLAPI extern #endif #ifndef GLAPIENTRY #define GLAPIENTRY #endif #ifndef APIENTRY #define APIENTRY GLAPIENTRY #endif /* "P" suffix to be used for a pointer to a function */ #ifndef APIENTRYP #define APIENTRYP APIENTRY * #endif #ifndef GLAPIENTRYP #define GLAPIENTRYP GLAPIENTRY * #endif #ifdef CENTERLINE_CLPP #define signed #endif #if defined(PRAGMA_EXPORT_SUPPORTED) #pragma export on #endif #endif /* !__SCITECH_SNAP__ */ /* * End system-specific stuff. **********************************************************************/ #ifdef __cplusplus extern "C" { #endif #define GL_VERSION_1_1 1 #define GL_VERSION_1_2 1 #define GL_VERSION_1_3 1 #define GL_ARB_imaging 1 /* * Datatypes */ typedef unsigned int GLenum; typedef unsigned char GLboolean; typedef unsigned int GLbitfield; typedef void GLvoid; typedef signed char GLbyte; /* 1-byte signed */ typedef short GLshort; /* 2-byte signed */ typedef int GLint; /* 4-byte signed */ typedef unsigned char GLubyte; /* 1-byte unsigned */ typedef unsigned short GLushort; /* 2-byte unsigned */ typedef unsigned int GLuint; /* 4-byte unsigned */ typedef int GLsizei; /* 4-byte signed */ typedef float GLfloat; /* single precision float */ typedef float GLclampf; /* single precision float in [0,1] */ typedef double GLdouble; /* double precision float */ typedef double GLclampd; /* double precision float in [0,1] */ /* * Constants */ /* Boolean values */ #define GL_FALSE 0x0 #define GL_TRUE 0x1 /* Data types */ #define GL_BYTE 0x1400 #define GL_UNSIGNED_BYTE 0x1401 #define GL_SHORT 0x1402 #define GL_UNSIGNED_SHORT 0x1403 #define GL_INT 0x1404 #define GL_UNSIGNED_INT 0x1405 #define GL_FLOAT 0x1406 #define GL_2_BYTES 0x1407 #define GL_3_BYTES 0x1408 #define GL_4_BYTES 0x1409 #define GL_DOUBLE 0x140A /* Primitives */ #define GL_POINTS 0x0000 #define GL_LINES 0x0001 #define GL_LINE_LOOP 0x0002 #define GL_LINE_STRIP 0x0003 #define GL_TRIANGLES 0x0004 #define GL_TRIANGLE_STRIP 0x0005 #define GL_TRIANGLE_FAN 0x0006 #define GL_QUADS 0x0007 #define GL_QUAD_STRIP 0x0008 #define GL_POLYGON 0x0009 /* Vertex Arrays */ #define GL_VERTEX_ARRAY 0x8074 #define GL_NORMAL_ARRAY 0x8075 #define GL_COLOR_ARRAY 0x8076 #define GL_INDEX_ARRAY 0x8077 #define GL_TEXTURE_COORD_ARRAY 0x8078 #define GL_EDGE_FLAG_ARRAY 0x8079 #define GL_VERTEX_ARRAY_SIZE 0x807A #define GL_VERTEX_ARRAY_TYPE 0x807B #define GL_VERTEX_ARRAY_STRIDE 0x807C #define GL_NORMAL_ARRAY_TYPE 0x807E #define GL_NORMAL_ARRAY_STRIDE 0x807F #define GL_COLOR_ARRAY_SIZE 0x8081 #define GL_COLOR_ARRAY_TYPE 0x8082 #define GL_COLOR_ARRAY_STRIDE 0x8083 #define GL_INDEX_ARRAY_TYPE 0x8085 #define GL_INDEX_ARRAY_STRIDE 0x8086 #define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 #define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 #define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A #define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C #define GL_VERTEX_ARRAY_POINTER 0x808E #define GL_NORMAL_ARRAY_POINTER 0x808F #define GL_COLOR_ARRAY_POINTER 0x8090 #define GL_INDEX_ARRAY_POINTER 0x8091 #define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 #define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 #define GL_V2F 0x2A20 #define GL_V3F 0x2A21 #define GL_C4UB_V2F 0x2A22 #define GL_C4UB_V3F 0x2A23 #define GL_C3F_V3F 0x2A24 #define GL_N3F_V3F 0x2A25 #define GL_C4F_N3F_V3F 0x2A26 #define GL_T2F_V3F 0x2A27 #define GL_T4F_V4F 0x2A28 #define GL_T2F_C4UB_V3F 0x2A29 #define GL_T2F_C3F_V3F 0x2A2A #define GL_T2F_N3F_V3F 0x2A2B #define GL_T2F_C4F_N3F_V3F 0x2A2C #define GL_T4F_C4F_N3F_V4F 0x2A2D /* Matrix Mode */ #define GL_MATRIX_MODE 0x0BA0 #define GL_MODELVIEW 0x1700 #define GL_PROJECTION 0x1701 #define GL_TEXTURE 0x1702 /* Points */ #define GL_POINT_SMOOTH 0x0B10 #define GL_POINT_SIZE 0x0B11 #define GL_POINT_SIZE_GRANULARITY 0x0B13 #define GL_POINT_SIZE_RANGE 0x0B12 /* Lines */ #define GL_LINE_SMOOTH 0x0B20 #define GL_LINE_STIPPLE 0x0B24 #define GL_LINE_STIPPLE_PATTERN 0x0B25 #define GL_LINE_STIPPLE_REPEAT 0x0B26 #define GL_LINE_WIDTH 0x0B21 #define GL_LINE_WIDTH_GRANULARITY 0x0B23 #define GL_LINE_WIDTH_RANGE 0x0B22 /* Polygons */ #define GL_POINT 0x1B00 #define GL_LINE 0x1B01 #define GL_FILL 0x1B02 #define GL_CW 0x0900 #define GL_CCW 0x0901 #define GL_FRONT 0x0404 #define GL_BACK 0x0405 #define GL_POLYGON_MODE 0x0B40 #define GL_POLYGON_SMOOTH 0x0B41 #define GL_POLYGON_STIPPLE 0x0B42 #define GL_EDGE_FLAG 0x0B43 #define GL_CULL_FACE 0x0B44 #define GL_CULL_FACE_MODE 0x0B45 #define GL_FRONT_FACE 0x0B46 #define GL_POLYGON_OFFSET_FACTOR 0x8038 #define GL_POLYGON_OFFSET_UNITS 0x2A00 #define GL_POLYGON_OFFSET_POINT 0x2A01 #define GL_POLYGON_OFFSET_LINE 0x2A02 #define GL_POLYGON_OFFSET_FILL 0x8037 /* Display Lists */ #define GL_COMPILE 0x1300 #define GL_COMPILE_AND_EXECUTE 0x1301 #define GL_LIST_BASE 0x0B32 #define GL_LIST_INDEX 0x0B33 #define GL_LIST_MODE 0x0B30 /* Depth buffer */ #define GL_NEVER 0x0200 #define GL_LESS 0x0201 #define GL_EQUAL 0x0202 #define GL_LEQUAL 0x0203 #define GL_GREATER 0x0204 #define GL_NOTEQUAL 0x0205 #define GL_GEQUAL 0x0206 #define GL_ALWAYS 0x0207 #define GL_DEPTH_TEST 0x0B71 #define GL_DEPTH_BITS 0x0D56 #define GL_DEPTH_CLEAR_VALUE 0x0B73 #define GL_DEPTH_FUNC 0x0B74 #define GL_DEPTH_RANGE 0x0B70 #define GL_DEPTH_WRITEMASK 0x0B72 #define GL_DEPTH_COMPONENT 0x1902 /* Lighting */ #define GL_LIGHTING 0x0B50 #define GL_LIGHT0 0x4000 #define GL_LIGHT1 0x4001 #define GL_LIGHT2 0x4002 #define GL_LIGHT3 0x4003 #define GL_LIGHT4 0x4004 #define GL_LIGHT5 0x4005 #define GL_LIGHT6 0x4006 #define GL_LIGHT7 0x4007 #define GL_SPOT_EXPONENT 0x1205 #define GL_SPOT_CUTOFF 0x1206 #define GL_CONSTANT_ATTENUATION 0x1207 #define GL_LINEAR_ATTENUATION 0x1208 #define GL_QUADRATIC_ATTENUATION 0x1209 #define GL_AMBIENT 0x1200 #define GL_DIFFUSE 0x1201 #define GL_SPECULAR 0x1202 #define GL_SHININESS 0x1601 #define GL_EMISSION 0x1600 #define GL_POSITION 0x1203 #define GL_SPOT_DIRECTION 0x1204 #define GL_AMBIENT_AND_DIFFUSE 0x1602 #define GL_COLOR_INDEXES 0x1603 #define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 #define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 #define GL_LIGHT_MODEL_AMBIENT 0x0B53 #define GL_FRONT_AND_BACK 0x0408 #define GL_SHADE_MODEL 0x0B54 #define GL_FLAT 0x1D00 #define GL_SMOOTH 0x1D01 #define GL_COLOR_MATERIAL 0x0B57 #define GL_COLOR_MATERIAL_FACE 0x0B55 #define GL_COLOR_MATERIAL_PARAMETER 0x0B56 #define GL_NORMALIZE 0x0BA1 /* User clipping planes */ #define GL_CLIP_PLANE0 0x3000 #define GL_CLIP_PLANE1 0x3001 #define GL_CLIP_PLANE2 0x3002 #define GL_CLIP_PLANE3 0x3003 #define GL_CLIP_PLANE4 0x3004 #define GL_CLIP_PLANE5 0x3005 /* Accumulation buffer */ #define GL_ACCUM_RED_BITS 0x0D58 #define GL_ACCUM_GREEN_BITS 0x0D59 #define GL_ACCUM_BLUE_BITS 0x0D5A #define GL_ACCUM_ALPHA_BITS 0x0D5B #define GL_ACCUM_CLEAR_VALUE 0x0B80 #define GL_ACCUM 0x0100 #define GL_ADD 0x0104 #define GL_LOAD 0x0101 #define GL_MULT 0x0103 #define GL_RETURN 0x0102 /* Alpha testing */ #define GL_ALPHA_TEST 0x0BC0 #define GL_ALPHA_TEST_REF 0x0BC2 #define GL_ALPHA_TEST_FUNC 0x0BC1 /* Blending */ #define GL_BLEND 0x0BE2 #define GL_BLEND_SRC 0x0BE1 #define GL_BLEND_DST 0x0BE0 #define GL_ZERO 0x0 #define GL_ONE 0x1 #define GL_SRC_COLOR 0x0300 #define GL_ONE_MINUS_SRC_COLOR 0x0301 #define GL_SRC_ALPHA 0x0302 #define GL_ONE_MINUS_SRC_ALPHA 0x0303 #define GL_DST_ALPHA 0x0304 #define GL_ONE_MINUS_DST_ALPHA 0x0305 #define GL_DST_COLOR 0x0306 #define GL_ONE_MINUS_DST_COLOR 0x0307 #define GL_SRC_ALPHA_SATURATE 0x0308 /* Render Mode */ #define GL_FEEDBACK 0x1C01 #define GL_RENDER 0x1C00 #define GL_SELECT 0x1C02 /* Feedback */ #define GL_2D 0x0600 #define GL_3D 0x0601 #define GL_3D_COLOR 0x0602 #define GL_3D_COLOR_TEXTURE 0x0603 #define GL_4D_COLOR_TEXTURE 0x0604 #define GL_POINT_TOKEN 0x0701 #define GL_LINE_TOKEN 0x0702 #define GL_LINE_RESET_TOKEN 0x0707 #define GL_POLYGON_TOKEN 0x0703 #define GL_BITMAP_TOKEN 0x0704 #define GL_DRAW_PIXEL_TOKEN 0x0705 #define GL_COPY_PIXEL_TOKEN 0x0706 #define GL_PASS_THROUGH_TOKEN 0x0700 #define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 #define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 #define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 /* Selection */ #define GL_SELECTION_BUFFER_POINTER 0x0DF3 #define GL_SELECTION_BUFFER_SIZE 0x0DF4 /* Fog */ #define GL_FOG 0x0B60 #define GL_FOG_MODE 0x0B65 #define GL_FOG_DENSITY 0x0B62 #define GL_FOG_COLOR 0x0B66 #define GL_FOG_INDEX 0x0B61 #define GL_FOG_START 0x0B63 #define GL_FOG_END 0x0B64 #define GL_LINEAR 0x2601 #define GL_EXP 0x0800 #define GL_EXP2 0x0801 /* Logic Ops */ #define GL_LOGIC_OP 0x0BF1 #define GL_INDEX_LOGIC_OP 0x0BF1 #define GL_COLOR_LOGIC_OP 0x0BF2 #define GL_LOGIC_OP_MODE 0x0BF0 #define GL_CLEAR 0x1500 #define GL_SET 0x150F #define GL_COPY 0x1503 #define GL_COPY_INVERTED 0x150C #define GL_NOOP 0x1505 #define GL_INVERT 0x150A #define GL_AND 0x1501 #define GL_NAND 0x150E #define GL_OR 0x1507 #define GL_NOR 0x1508 #define GL_XOR 0x1506 #define GL_EQUIV 0x1509 #define GL_AND_REVERSE 0x1502 #define GL_AND_INVERTED 0x1504 #define GL_OR_REVERSE 0x150B #define GL_OR_INVERTED 0x150D /* Stencil */ #define GL_STENCIL_TEST 0x0B90 #define GL_STENCIL_WRITEMASK 0x0B98 #define GL_STENCIL_BITS 0x0D57 #define GL_STENCIL_FUNC 0x0B92 #define GL_STENCIL_VALUE_MASK 0x0B93 #define GL_STENCIL_REF 0x0B97 #define GL_STENCIL_FAIL 0x0B94 #define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 #define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 #define GL_STENCIL_CLEAR_VALUE 0x0B91 #define GL_STENCIL_INDEX 0x1901 #define GL_KEEP 0x1E00 #define GL_REPLACE 0x1E01 #define GL_INCR 0x1E02 #define GL_DECR 0x1E03 /* Buffers, Pixel Drawing/Reading */ #define GL_NONE 0x0 #define GL_LEFT 0x0406 #define GL_RIGHT 0x0407 /*GL_FRONT 0x0404 */ /*GL_BACK 0x0405 */ /*GL_FRONT_AND_BACK 0x0408 */ #define GL_FRONT_LEFT 0x0400 #define GL_FRONT_RIGHT 0x0401 #define GL_BACK_LEFT 0x0402 #define GL_BACK_RIGHT 0x0403 #define GL_AUX0 0x0409 #define GL_AUX1 0x040A #define GL_AUX2 0x040B #define GL_AUX3 0x040C #define GL_COLOR_INDEX 0x1900 #define GL_RED 0x1903 #define GL_GREEN 0x1904 #define GL_BLUE 0x1905 #define GL_ALPHA 0x1906 #define GL_LUMINANCE 0x1909 #define GL_LUMINANCE_ALPHA 0x190A #define GL_ALPHA_BITS 0x0D55 #define GL_RED_BITS 0x0D52 #define GL_GREEN_BITS 0x0D53 #define GL_BLUE_BITS 0x0D54 #define GL_INDEX_BITS 0x0D51 #define GL_SUBPIXEL_BITS 0x0D50 #define GL_AUX_BUFFERS 0x0C00 #define GL_READ_BUFFER 0x0C02 #define GL_DRAW_BUFFER 0x0C01 #define GL_DOUBLEBUFFER 0x0C32 #define GL_STEREO 0x0C33 #define GL_BITMAP 0x1A00 #define GL_COLOR 0x1800 #define GL_DEPTH 0x1801 #define GL_STENCIL 0x1802 #define GL_DITHER 0x0BD0 #define GL_RGB 0x1907 #define GL_RGBA 0x1908 /* Implementation limits */ #define GL_MAX_LIST_NESTING 0x0B31 #define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 #define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 #define GL_MAX_NAME_STACK_DEPTH 0x0D37 #define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 #define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 #define GL_MAX_EVAL_ORDER 0x0D30 #define GL_MAX_LIGHTS 0x0D31 #define GL_MAX_CLIP_PLANES 0x0D32 #define GL_MAX_TEXTURE_SIZE 0x0D33 #define GL_MAX_PIXEL_MAP_TABLE 0x0D34 #define GL_MAX_VIEWPORT_DIMS 0x0D3A #define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B /* Gets */ #define GL_ATTRIB_STACK_DEPTH 0x0BB0 #define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 #define GL_COLOR_CLEAR_VALUE 0x0C22 #define GL_COLOR_WRITEMASK 0x0C23 #define GL_CURRENT_INDEX 0x0B01 #define GL_CURRENT_COLOR 0x0B00 #define GL_CURRENT_NORMAL 0x0B02 #define GL_CURRENT_RASTER_COLOR 0x0B04 #define GL_CURRENT_RASTER_DISTANCE 0x0B09 #define GL_CURRENT_RASTER_INDEX 0x0B05 #define GL_CURRENT_RASTER_POSITION 0x0B07 #define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 #define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 #define GL_CURRENT_TEXTURE_COORDS 0x0B03 #define GL_INDEX_CLEAR_VALUE 0x0C20 #define GL_INDEX_MODE 0x0C30 #define GL_INDEX_WRITEMASK 0x0C21 #define GL_MODELVIEW_MATRIX 0x0BA6 #define GL_MODELVIEW_STACK_DEPTH 0x0BA3 #define GL_NAME_STACK_DEPTH 0x0D70 #define GL_PROJECTION_MATRIX 0x0BA7 #define GL_PROJECTION_STACK_DEPTH 0x0BA4 #define GL_RENDER_MODE 0x0C40 #define GL_RGBA_MODE 0x0C31 #define GL_TEXTURE_MATRIX 0x0BA8 #define GL_TEXTURE_STACK_DEPTH 0x0BA5 #define GL_VIEWPORT 0x0BA2 /* Evaluators */ #define GL_AUTO_NORMAL 0x0D80 #define GL_MAP1_COLOR_4 0x0D90 #define GL_MAP1_INDEX 0x0D91 #define GL_MAP1_NORMAL 0x0D92 #define GL_MAP1_TEXTURE_COORD_1 0x0D93 #define GL_MAP1_TEXTURE_COORD_2 0x0D94 #define GL_MAP1_TEXTURE_COORD_3 0x0D95 #define GL_MAP1_TEXTURE_COORD_4 0x0D96 #define GL_MAP1_VERTEX_3 0x0D97 #define GL_MAP1_VERTEX_4 0x0D98 #define GL_MAP2_COLOR_4 0x0DB0 #define GL_MAP2_INDEX 0x0DB1 #define GL_MAP2_NORMAL 0x0DB2 #define GL_MAP2_TEXTURE_COORD_1 0x0DB3 #define GL_MAP2_TEXTURE_COORD_2 0x0DB4 #define GL_MAP2_TEXTURE_COORD_3 0x0DB5 #define GL_MAP2_TEXTURE_COORD_4 0x0DB6 #define GL_MAP2_VERTEX_3 0x0DB7 #define GL_MAP2_VERTEX_4 0x0DB8 #define GL_MAP1_GRID_DOMAIN 0x0DD0 #define GL_MAP1_GRID_SEGMENTS 0x0DD1 #define GL_MAP2_GRID_DOMAIN 0x0DD2 #define GL_MAP2_GRID_SEGMENTS 0x0DD3 #define GL_COEFF 0x0A00 #define GL_DOMAIN 0x0A02 #define GL_ORDER 0x0A01 /* Hints */ #define GL_FOG_HINT 0x0C54 #define GL_LINE_SMOOTH_HINT 0x0C52 #define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 #define GL_POINT_SMOOTH_HINT 0x0C51 #define GL_POLYGON_SMOOTH_HINT 0x0C53 #define GL_DONT_CARE 0x1100 #define GL_FASTEST 0x1101 #define GL_NICEST 0x1102 /* Scissor box */ #define GL_SCISSOR_TEST 0x0C11 #define GL_SCISSOR_BOX 0x0C10 /* Pixel Mode / Transfer */ #define GL_MAP_COLOR 0x0D10 #define GL_MAP_STENCIL 0x0D11 #define GL_INDEX_SHIFT 0x0D12 #define GL_INDEX_OFFSET 0x0D13 #define GL_RED_SCALE 0x0D14 #define GL_RED_BIAS 0x0D15 #define GL_GREEN_SCALE 0x0D18 #define GL_GREEN_BIAS 0x0D19 #define GL_BLUE_SCALE 0x0D1A #define GL_BLUE_BIAS 0x0D1B #define GL_ALPHA_SCALE 0x0D1C #define GL_ALPHA_BIAS 0x0D1D #define GL_DEPTH_SCALE 0x0D1E #define GL_DEPTH_BIAS 0x0D1F #define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 #define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 #define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 #define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 #define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 #define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 #define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 #define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 #define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 #define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 #define GL_PIXEL_MAP_S_TO_S 0x0C71 #define GL_PIXEL_MAP_I_TO_I 0x0C70 #define GL_PIXEL_MAP_I_TO_R 0x0C72 #define GL_PIXEL_MAP_I_TO_G 0x0C73 #define GL_PIXEL_MAP_I_TO_B 0x0C74 #define GL_PIXEL_MAP_I_TO_A 0x0C75 #define GL_PIXEL_MAP_R_TO_R 0x0C76 #define GL_PIXEL_MAP_G_TO_G 0x0C77 #define GL_PIXEL_MAP_B_TO_B 0x0C78 #define GL_PIXEL_MAP_A_TO_A 0x0C79 #define GL_PACK_ALIGNMENT 0x0D05 #define GL_PACK_LSB_FIRST 0x0D01 #define GL_PACK_ROW_LENGTH 0x0D02 #define GL_PACK_SKIP_PIXELS 0x0D04 #define GL_PACK_SKIP_ROWS 0x0D03 #define GL_PACK_SWAP_BYTES 0x0D00 #define GL_UNPACK_ALIGNMENT 0x0CF5 #define GL_UNPACK_LSB_FIRST 0x0CF1 #define GL_UNPACK_ROW_LENGTH 0x0CF2 #define GL_UNPACK_SKIP_PIXELS 0x0CF4 #define GL_UNPACK_SKIP_ROWS 0x0CF3 #define GL_UNPACK_SWAP_BYTES 0x0CF0 #define GL_ZOOM_X 0x0D16 #define GL_ZOOM_Y 0x0D17 /* Texture mapping */ #define GL_TEXTURE_ENV 0x2300 #define GL_TEXTURE_ENV_MODE 0x2200 #define GL_TEXTURE_1D 0x0DE0 #define GL_TEXTURE_2D 0x0DE1 #define GL_TEXTURE_WRAP_S 0x2802 #define GL_TEXTURE_WRAP_T 0x2803 #define GL_TEXTURE_MAG_FILTER 0x2800 #define GL_TEXTURE_MIN_FILTER 0x2801 #define GL_TEXTURE_ENV_COLOR 0x2201 #define GL_TEXTURE_GEN_S 0x0C60 #define GL_TEXTURE_GEN_T 0x0C61 #define GL_TEXTURE_GEN_MODE 0x2500 #define GL_TEXTURE_BORDER_COLOR 0x1004 #define GL_TEXTURE_WIDTH 0x1000 #define GL_TEXTURE_HEIGHT 0x1001 #define GL_TEXTURE_BORDER 0x1005 #define GL_TEXTURE_COMPONENTS 0x1003 #define GL_TEXTURE_RED_SIZE 0x805C #define GL_TEXTURE_GREEN_SIZE 0x805D #define GL_TEXTURE_BLUE_SIZE 0x805E #define GL_TEXTURE_ALPHA_SIZE 0x805F #define GL_TEXTURE_LUMINANCE_SIZE 0x8060 #define GL_TEXTURE_INTENSITY_SIZE 0x8061 #define GL_NEAREST_MIPMAP_NEAREST 0x2700 #define GL_NEAREST_MIPMAP_LINEAR 0x2702 #define GL_LINEAR_MIPMAP_NEAREST 0x2701 #define GL_LINEAR_MIPMAP_LINEAR 0x2703 #define GL_OBJECT_LINEAR 0x2401 #define GL_OBJECT_PLANE 0x2501 #define GL_EYE_LINEAR 0x2400 #define GL_EYE_PLANE 0x2502 #define GL_SPHERE_MAP 0x2402 #define GL_DECAL 0x2101 #define GL_MODULATE 0x2100 #define GL_NEAREST 0x2600 #define GL_REPEAT 0x2901 #define GL_CLAMP 0x2900 #define GL_S 0x2000 #define GL_T 0x2001 #define GL_R 0x2002 #define GL_Q 0x2003 #define GL_TEXTURE_GEN_R 0x0C62 #define GL_TEXTURE_GEN_Q 0x0C63 /* Utility */ #define GL_VENDOR 0x1F00 #define GL_RENDERER 0x1F01 #define GL_VERSION 0x1F02 #define GL_EXTENSIONS 0x1F03 /* Errors */ #define GL_NO_ERROR 0x0 #define GL_INVALID_VALUE 0x0501 #define GL_INVALID_ENUM 0x0500 #define GL_INVALID_OPERATION 0x0502 #define GL_STACK_OVERFLOW 0x0503 #define GL_STACK_UNDERFLOW 0x0504 #define GL_OUT_OF_MEMORY 0x0505 /* glPush/PopAttrib bits */ #define GL_CURRENT_BIT 0x00000001 #define GL_POINT_BIT 0x00000002 #define GL_LINE_BIT 0x00000004 #define GL_POLYGON_BIT 0x00000008 #define GL_POLYGON_STIPPLE_BIT 0x00000010 #define GL_PIXEL_MODE_BIT 0x00000020 #define GL_LIGHTING_BIT 0x00000040 #define GL_FOG_BIT 0x00000080 #define GL_DEPTH_BUFFER_BIT 0x00000100 #define GL_ACCUM_BUFFER_BIT 0x00000200 #define GL_STENCIL_BUFFER_BIT 0x00000400 #define GL_VIEWPORT_BIT 0x00000800 #define GL_TRANSFORM_BIT 0x00001000 #define GL_ENABLE_BIT 0x00002000 #define GL_COLOR_BUFFER_BIT 0x00004000 #define GL_HINT_BIT 0x00008000 #define GL_EVAL_BIT 0x00010000 #define GL_LIST_BIT 0x00020000 #define GL_TEXTURE_BIT 0x00040000 #define GL_SCISSOR_BIT 0x00080000 #define GL_ALL_ATTRIB_BITS 0x000FFFFF /* OpenGL 1.1 */ #define GL_PROXY_TEXTURE_1D 0x8063 #define GL_PROXY_TEXTURE_2D 0x8064 #define GL_TEXTURE_PRIORITY 0x8066 #define GL_TEXTURE_RESIDENT 0x8067 #define GL_TEXTURE_BINDING_1D 0x8068 #define GL_TEXTURE_BINDING_2D 0x8069 #define GL_TEXTURE_INTERNAL_FORMAT 0x1003 #define GL_ALPHA4 0x803B #define GL_ALPHA8 0x803C #define GL_ALPHA12 0x803D #define GL_ALPHA16 0x803E #define GL_LUMINANCE4 0x803F #define GL_LUMINANCE8 0x8040 #define GL_LUMINANCE12 0x8041 #define GL_LUMINANCE16 0x8042 #define GL_LUMINANCE4_ALPHA4 0x8043 #define GL_LUMINANCE6_ALPHA2 0x8044 #define GL_LUMINANCE8_ALPHA8 0x8045 #define GL_LUMINANCE12_ALPHA4 0x8046 #define GL_LUMINANCE12_ALPHA12 0x8047 #define GL_LUMINANCE16_ALPHA16 0x8048 #define GL_INTENSITY 0x8049 #define GL_INTENSITY4 0x804A #define GL_INTENSITY8 0x804B #define GL_INTENSITY12 0x804C #define GL_INTENSITY16 0x804D #define GL_R3_G3_B2 0x2A10 #define GL_RGB4 0x804F #define GL_RGB5 0x8050 #define GL_RGB8 0x8051 #define GL_RGB10 0x8052 #define GL_RGB12 0x8053 #define GL_RGB16 0x8054 #define GL_RGBA2 0x8055 #define GL_RGBA4 0x8056 #define GL_RGB5_A1 0x8057 #define GL_RGBA8 0x8058 #define GL_RGB10_A2 0x8059 #define GL_RGBA12 0x805A #define GL_RGBA16 0x805B #define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 #define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 #define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF #define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF /* * Miscellaneous */ GLAPI void GLAPIENTRY glClearIndex( GLfloat c ); GLAPI void GLAPIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); GLAPI void GLAPIENTRY glClear( GLbitfield mask ); GLAPI void GLAPIENTRY glIndexMask( GLuint mask ); GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ); GLAPI void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref ); GLAPI void GLAPIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor ); GLAPI void GLAPIENTRY glLogicOp( GLenum opcode ); GLAPI void GLAPIENTRY glCullFace( GLenum mode ); GLAPI void GLAPIENTRY glFrontFace( GLenum mode ); GLAPI void GLAPIENTRY glPointSize( GLfloat size ); GLAPI void GLAPIENTRY glLineWidth( GLfloat width ); GLAPI void GLAPIENTRY glLineStipple( GLint factor, GLushort pattern ); GLAPI void GLAPIENTRY glPolygonMode( GLenum face, GLenum mode ); GLAPI void GLAPIENTRY glPolygonOffset( GLfloat factor, GLfloat units ); GLAPI void GLAPIENTRY glPolygonStipple( const GLubyte *mask ); GLAPI void GLAPIENTRY glGetPolygonStipple( GLubyte *mask ); GLAPI void GLAPIENTRY glEdgeFlag( GLboolean flag ); GLAPI void GLAPIENTRY glEdgeFlagv( const GLboolean *flag ); GLAPI void GLAPIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height); GLAPI void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation ); GLAPI void GLAPIENTRY glGetClipPlane( GLenum plane, GLdouble *equation ); GLAPI void GLAPIENTRY glDrawBuffer( GLenum mode ); GLAPI void GLAPIENTRY glReadBuffer( GLenum mode ); GLAPI void GLAPIENTRY glEnable( GLenum cap ); GLAPI void GLAPIENTRY glDisable( GLenum cap ); GLAPI GLboolean GLAPIENTRY glIsEnabled( GLenum cap ); GLAPI void GLAPIENTRY glEnableClientState( GLenum cap ); /* 1.1 */ GLAPI void GLAPIENTRY glDisableClientState( GLenum cap ); /* 1.1 */ GLAPI void GLAPIENTRY glGetBooleanv( GLenum pname, GLboolean *params ); GLAPI void GLAPIENTRY glGetDoublev( GLenum pname, GLdouble *params ); GLAPI void GLAPIENTRY glGetFloatv( GLenum pname, GLfloat *params ); GLAPI void GLAPIENTRY glGetIntegerv( GLenum pname, GLint *params ); GLAPI void GLAPIENTRY glPushAttrib( GLbitfield mask ); GLAPI void GLAPIENTRY glPopAttrib( void ); GLAPI void GLAPIENTRY glPushClientAttrib( GLbitfield mask ); /* 1.1 */ GLAPI void GLAPIENTRY glPopClientAttrib( void ); /* 1.1 */ GLAPI GLint GLAPIENTRY glRenderMode( GLenum mode ); GLAPI GLenum GLAPIENTRY glGetError( void ); GLAPI const GLubyte * GLAPIENTRY glGetString( GLenum name ); GLAPI void GLAPIENTRY glFinish( void ); GLAPI void GLAPIENTRY glFlush( void ); GLAPI void GLAPIENTRY glHint( GLenum target, GLenum mode ); /* * Depth Buffer */ GLAPI void GLAPIENTRY glClearDepth( GLclampd depth ); GLAPI void GLAPIENTRY glDepthFunc( GLenum func ); GLAPI void GLAPIENTRY glDepthMask( GLboolean flag ); GLAPI void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val ); /* * Accumulation Buffer */ GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); GLAPI void GLAPIENTRY glAccum( GLenum op, GLfloat value ); /* * Transformation */ GLAPI void GLAPIENTRY glMatrixMode( GLenum mode ); GLAPI void GLAPIENTRY glOrtho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val ); GLAPI void GLAPIENTRY glFrustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val ); GLAPI void GLAPIENTRY glViewport( GLint x, GLint y, GLsizei width, GLsizei height ); GLAPI void GLAPIENTRY glPushMatrix( void ); GLAPI void GLAPIENTRY glPopMatrix( void ); GLAPI void GLAPIENTRY glLoadIdentity( void ); GLAPI void GLAPIENTRY glLoadMatrixd( const GLdouble *m ); GLAPI void GLAPIENTRY glLoadMatrixf( const GLfloat *m ); GLAPI void GLAPIENTRY glMultMatrixd( const GLdouble *m ); GLAPI void GLAPIENTRY glMultMatrixf( const GLfloat *m ); GLAPI void GLAPIENTRY glRotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ); GLAPI void GLAPIENTRY glRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ); GLAPI void GLAPIENTRY glScaled( GLdouble x, GLdouble y, GLdouble z ); GLAPI void GLAPIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z ); GLAPI void GLAPIENTRY glTranslated( GLdouble x, GLdouble y, GLdouble z ); GLAPI void GLAPIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z ); /* * Display Lists */ GLAPI GLboolean GLAPIENTRY glIsList( GLuint list ); GLAPI void GLAPIENTRY glDeleteLists( GLuint list, GLsizei range ); GLAPI GLuint GLAPIENTRY glGenLists( GLsizei range ); GLAPI void GLAPIENTRY glNewList( GLuint list, GLenum mode ); GLAPI void GLAPIENTRY glEndList( void ); GLAPI void GLAPIENTRY glCallList( GLuint list ); GLAPI void GLAPIENTRY glCallLists( GLsizei n, GLenum type, const GLvoid *lists ); GLAPI void GLAPIENTRY glListBase( GLuint base ); /* * Drawing Functions */ GLAPI void GLAPIENTRY glBegin( GLenum mode ); GLAPI void GLAPIENTRY glEnd( void ); GLAPI void GLAPIENTRY glVertex2d( GLdouble x, GLdouble y ); GLAPI void GLAPIENTRY glVertex2f( GLfloat x, GLfloat y ); GLAPI void GLAPIENTRY glVertex2i( GLint x, GLint y ); GLAPI void GLAPIENTRY glVertex2s( GLshort x, GLshort y ); GLAPI void GLAPIENTRY glVertex3d( GLdouble x, GLdouble y, GLdouble z ); GLAPI void GLAPIENTRY glVertex3f( GLfloat x, GLfloat y, GLfloat z ); GLAPI void GLAPIENTRY glVertex3i( GLint x, GLint y, GLint z ); GLAPI void GLAPIENTRY glVertex3s( GLshort x, GLshort y, GLshort z ); GLAPI void GLAPIENTRY glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); GLAPI void GLAPIENTRY glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); GLAPI void GLAPIENTRY glVertex4i( GLint x, GLint y, GLint z, GLint w ); GLAPI void GLAPIENTRY glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w ); GLAPI void GLAPIENTRY glVertex2dv( const GLdouble *v ); GLAPI void GLAPIENTRY glVertex2fv( const GLfloat *v ); GLAPI void GLAPIENTRY glVertex2iv( const GLint *v ); GLAPI void GLAPIENTRY glVertex2sv( const GLshort *v ); GLAPI void GLAPIENTRY glVertex3dv( const GLdouble *v ); GLAPI void GLAPIENTRY glVertex3fv( const GLfloat *v ); GLAPI void GLAPIENTRY glVertex3iv( const GLint *v ); GLAPI void GLAPIENTRY glVertex3sv( const GLshort *v ); GLAPI void GLAPIENTRY glVertex4dv( const GLdouble *v ); GLAPI void GLAPIENTRY glVertex4fv( const GLfloat *v ); GLAPI void GLAPIENTRY glVertex4iv( const GLint *v ); GLAPI void GLAPIENTRY glVertex4sv( const GLshort *v ); GLAPI void GLAPIENTRY glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz ); GLAPI void GLAPIENTRY glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ); GLAPI void GLAPIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz ); GLAPI void GLAPIENTRY glNormal3i( GLint nx, GLint ny, GLint nz ); GLAPI void GLAPIENTRY glNormal3s( GLshort nx, GLshort ny, GLshort nz ); GLAPI void GLAPIENTRY glNormal3bv( const GLbyte *v ); GLAPI void GLAPIENTRY glNormal3dv( const GLdouble *v ); GLAPI void GLAPIENTRY glNormal3fv( const GLfloat *v ); GLAPI void GLAPIENTRY glNormal3iv( const GLint *v ); GLAPI void GLAPIENTRY glNormal3sv( const GLshort *v ); GLAPI void GLAPIENTRY glIndexd( GLdouble c ); GLAPI void GLAPIENTRY glIndexf( GLfloat c ); GLAPI void GLAPIENTRY glIndexi( GLint c ); GLAPI void GLAPIENTRY glIndexs( GLshort c ); GLAPI void GLAPIENTRY glIndexub( GLubyte c ); /* 1.1 */ GLAPI void GLAPIENTRY glIndexdv( const GLdouble *c ); GLAPI void GLAPIENTRY glIndexfv( const GLfloat *c ); GLAPI void GLAPIENTRY glIndexiv( const GLint *c ); GLAPI void GLAPIENTRY glIndexsv( const GLshort *c ); GLAPI void GLAPIENTRY glIndexubv( const GLubyte *c ); /* 1.1 */ GLAPI void GLAPIENTRY glColor3b( GLbyte red, GLbyte green, GLbyte blue ); GLAPI void GLAPIENTRY glColor3d( GLdouble red, GLdouble green, GLdouble blue ); GLAPI void GLAPIENTRY glColor3f( GLfloat red, GLfloat green, GLfloat blue ); GLAPI void GLAPIENTRY glColor3i( GLint red, GLint green, GLint blue ); GLAPI void GLAPIENTRY glColor3s( GLshort red, GLshort green, GLshort blue ); GLAPI void GLAPIENTRY glColor3ub( GLubyte red, GLubyte green, GLubyte blue ); GLAPI void GLAPIENTRY glColor3ui( GLuint red, GLuint green, GLuint blue ); GLAPI void GLAPIENTRY glColor3us( GLushort red, GLushort green, GLushort blue ); GLAPI void GLAPIENTRY glColor4b( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ); GLAPI void GLAPIENTRY glColor4d( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ); GLAPI void GLAPIENTRY glColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); GLAPI void GLAPIENTRY glColor4i( GLint red, GLint green, GLint blue, GLint alpha ); GLAPI void GLAPIENTRY glColor4s( GLshort red, GLshort green, GLshort blue, GLshort alpha ); GLAPI void GLAPIENTRY glColor4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ); GLAPI void GLAPIENTRY glColor4ui( GLuint red, GLuint green, GLuint blue, GLuint alpha ); GLAPI void GLAPIENTRY glColor4us( GLushort red, GLushort green, GLushort blue, GLushort alpha ); GLAPI void GLAPIENTRY glColor3bv( const GLbyte *v ); GLAPI void GLAPIENTRY glColor3dv( const GLdouble *v ); GLAPI void GLAPIENTRY glColor3fv( const GLfloat *v ); GLAPI void GLAPIENTRY glColor3iv( const GLint *v ); GLAPI void GLAPIENTRY glColor3sv( const GLshort *v ); GLAPI void GLAPIENTRY glColor3ubv( const GLubyte *v ); GLAPI void GLAPIENTRY glColor3uiv( const GLuint *v ); GLAPI void GLAPIENTRY glColor3usv( const GLushort *v ); GLAPI void GLAPIENTRY glColor4bv( const GLbyte *v ); GLAPI void GLAPIENTRY glColor4dv( const GLdouble *v ); GLAPI void GLAPIENTRY glColor4fv( const GLfloat *v ); GLAPI void GLAPIENTRY glColor4iv( const GLint *v ); GLAPI void GLAPIENTRY glColor4sv( const GLshort *v ); GLAPI void GLAPIENTRY glColor4ubv( const GLubyte *v ); GLAPI void GLAPIENTRY glColor4uiv( const GLuint *v ); GLAPI void GLAPIENTRY glColor4usv( const GLushort *v ); GLAPI void GLAPIENTRY glTexCoord1d( GLdouble s ); GLAPI void GLAPIENTRY glTexCoord1f( GLfloat s ); GLAPI void GLAPIENTRY glTexCoord1i( GLint s ); GLAPI void GLAPIENTRY glTexCoord1s( GLshort s ); GLAPI void GLAPIENTRY glTexCoord2d( GLdouble s, GLdouble t ); GLAPI void GLAPIENTRY glTexCoord2f( GLfloat s, GLfloat t ); GLAPI void GLAPIENTRY glTexCoord2i( GLint s, GLint t ); GLAPI void GLAPIENTRY glTexCoord2s( GLshort s, GLshort t ); GLAPI void GLAPIENTRY glTexCoord3d( GLdouble s, GLdouble t, GLdouble r ); GLAPI void GLAPIENTRY glTexCoord3f( GLfloat s, GLfloat t, GLfloat r ); GLAPI void GLAPIENTRY glTexCoord3i( GLint s, GLint t, GLint r ); GLAPI void GLAPIENTRY glTexCoord3s( GLshort s, GLshort t, GLshort r ); GLAPI void GLAPIENTRY glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ); GLAPI void GLAPIENTRY glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ); GLAPI void GLAPIENTRY glTexCoord4i( GLint s, GLint t, GLint r, GLint q ); GLAPI void GLAPIENTRY glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ); GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v ); GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v ); GLAPI void GLAPIENTRY glTexCoord1iv( const GLint *v ); GLAPI void GLAPIENTRY glTexCoord1sv( const GLshort *v ); GLAPI void GLAPIENTRY glTexCoord2dv( const GLdouble *v ); GLAPI void GLAPIENTRY glTexCoord2fv( const GLfloat *v ); GLAPI void GLAPIENTRY glTexCoord2iv( const GLint *v ); GLAPI void GLAPIENTRY glTexCoord2sv( const GLshort *v ); GLAPI void GLAPIENTRY glTexCoord3dv( const GLdouble *v ); GLAPI void GLAPIENTRY glTexCoord3fv( const GLfloat *v ); GLAPI void GLAPIENTRY glTexCoord3iv( const GLint *v ); GLAPI void GLAPIENTRY glTexCoord3sv( const GLshort *v ); GLAPI void GLAPIENTRY glTexCoord4dv( const GLdouble *v ); GLAPI void GLAPIENTRY glTexCoord4fv( const GLfloat *v ); GLAPI void GLAPIENTRY glTexCoord4iv( const GLint *v ); GLAPI void GLAPIENTRY glTexCoord4sv( const GLshort *v ); GLAPI void GLAPIENTRY glRasterPos2d( GLdouble x, GLdouble y ); GLAPI void GLAPIENTRY glRasterPos2f( GLfloat x, GLfloat y ); GLAPI void GLAPIENTRY glRasterPos2i( GLint x, GLint y ); GLAPI void GLAPIENTRY glRasterPos2s( GLshort x, GLshort y ); GLAPI void GLAPIENTRY glRasterPos3d( GLdouble x, GLdouble y, GLdouble z ); GLAPI void GLAPIENTRY glRasterPos3f( GLfloat x, GLfloat y, GLfloat z ); GLAPI void GLAPIENTRY glRasterPos3i( GLint x, GLint y, GLint z ); GLAPI void GLAPIENTRY glRasterPos3s( GLshort x, GLshort y, GLshort z ); GLAPI void GLAPIENTRY glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); GLAPI void GLAPIENTRY glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); GLAPI void GLAPIENTRY glRasterPos4i( GLint x, GLint y, GLint z, GLint w ); GLAPI void GLAPIENTRY glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w ); GLAPI void GLAPIENTRY glRasterPos2dv( const GLdouble *v ); GLAPI void GLAPIENTRY glRasterPos2fv( const GLfloat *v ); GLAPI void GLAPIENTRY glRasterPos2iv( const GLint *v ); GLAPI void GLAPIENTRY glRasterPos2sv( const GLshort *v ); GLAPI void GLAPIENTRY glRasterPos3dv( const GLdouble *v ); GLAPI void GLAPIENTRY glRasterPos3fv( const GLfloat *v ); GLAPI void GLAPIENTRY glRasterPos3iv( const GLint *v ); GLAPI void GLAPIENTRY glRasterPos3sv( const GLshort *v ); GLAPI void GLAPIENTRY glRasterPos4dv( const GLdouble *v ); GLAPI void GLAPIENTRY glRasterPos4fv( const GLfloat *v ); GLAPI void GLAPIENTRY glRasterPos4iv( const GLint *v ); GLAPI void GLAPIENTRY glRasterPos4sv( const GLshort *v ); GLAPI void GLAPIENTRY glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ); GLAPI void GLAPIENTRY glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); GLAPI void GLAPIENTRY glRecti( GLint x1, GLint y1, GLint x2, GLint y2 ); GLAPI void GLAPIENTRY glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ); GLAPI void GLAPIENTRY glRectdv( const GLdouble *v1, const GLdouble *v2 ); GLAPI void GLAPIENTRY glRectfv( const GLfloat *v1, const GLfloat *v2 ); GLAPI void GLAPIENTRY glRectiv( const GLint *v1, const GLint *v2 ); GLAPI void GLAPIENTRY glRectsv( const GLshort *v1, const GLshort *v2 ); /* * Vertex Arrays (1.1) */ GLAPI void GLAPIENTRY glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ); GLAPI void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride, const GLvoid *ptr ); GLAPI void GLAPIENTRY glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ); GLAPI void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride, const GLvoid *ptr ); GLAPI void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ); GLAPI void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr ); GLAPI void GLAPIENTRY glGetPointerv( GLenum pname, GLvoid **params ); GLAPI void GLAPIENTRY glArrayElement( GLint i ); GLAPI void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count ); GLAPI void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ); GLAPI void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride, const GLvoid *pointer ); /* * Lighting */ GLAPI void GLAPIENTRY glShadeModel( GLenum mode ); GLAPI void GLAPIENTRY glLightf( GLenum light, GLenum pname, GLfloat param ); GLAPI void GLAPIENTRY glLighti( GLenum light, GLenum pname, GLint param ); GLAPI void GLAPIENTRY glLightfv( GLenum light, GLenum pname, const GLfloat *params ); GLAPI void GLAPIENTRY glLightiv( GLenum light, GLenum pname, const GLint *params ); GLAPI void GLAPIENTRY glGetLightfv( GLenum light, GLenum pname, GLfloat *params ); GLAPI void GLAPIENTRY glGetLightiv( GLenum light, GLenum pname, GLint *params ); GLAPI void GLAPIENTRY glLightModelf( GLenum pname, GLfloat param ); GLAPI void GLAPIENTRY glLightModeli( GLenum pname, GLint param ); GLAPI void GLAPIENTRY glLightModelfv( GLenum pname, const GLfloat *params ); GLAPI void GLAPIENTRY glLightModeliv( GLenum pname, const GLint *params ); GLAPI void GLAPIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param ); GLAPI void GLAPIENTRY glMateriali( GLenum face, GLenum pname, GLint param ); GLAPI void GLAPIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ); GLAPI void GLAPIENTRY glMaterialiv( GLenum face, GLenum pname, const GLint *params ); GLAPI void GLAPIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params ); GLAPI void GLAPIENTRY glGetMaterialiv( GLenum face, GLenum pname, GLint *params ); GLAPI void GLAPIENTRY glColorMaterial( GLenum face, GLenum mode ); /* * Raster functions */ GLAPI void GLAPIENTRY glPixelZoom( GLfloat xfactor, GLfloat yfactor ); GLAPI void GLAPIENTRY glPixelStoref( GLenum pname, GLfloat param ); GLAPI void GLAPIENTRY glPixelStorei( GLenum pname, GLint param ); GLAPI void GLAPIENTRY glPixelTransferf( GLenum pname, GLfloat param ); GLAPI void GLAPIENTRY glPixelTransferi( GLenum pname, GLint param ); GLAPI void GLAPIENTRY glPixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values ); GLAPI void GLAPIENTRY glPixelMapuiv( GLenum map, GLsizei mapsize, const GLuint *values ); GLAPI void GLAPIENTRY glPixelMapusv( GLenum map, GLsizei mapsize, const GLushort *values ); GLAPI void GLAPIENTRY glGetPixelMapfv( GLenum map, GLfloat *values ); GLAPI void GLAPIENTRY glGetPixelMapuiv( GLenum map, GLuint *values ); GLAPI void GLAPIENTRY glGetPixelMapusv( GLenum map, GLushort *values ); GLAPI void GLAPIENTRY glBitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap ); GLAPI void GLAPIENTRY glReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ); GLAPI void GLAPIENTRY glDrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); GLAPI void GLAPIENTRY glCopyPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ); /* * Stenciling */ GLAPI void GLAPIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask ); GLAPI void GLAPIENTRY glStencilMask( GLuint mask ); GLAPI void GLAPIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass ); GLAPI void GLAPIENTRY glClearStencil( GLint s ); /* * Texture mapping */ GLAPI void GLAPIENTRY glTexGend( GLenum coord, GLenum pname, GLdouble param ); GLAPI void GLAPIENTRY glTexGenf( GLenum coord, GLenum pname, GLfloat param ); GLAPI void GLAPIENTRY glTexGeni( GLenum coord, GLenum pname, GLint param ); GLAPI void GLAPIENTRY glTexGendv( GLenum coord, GLenum pname, const GLdouble *params ); GLAPI void GLAPIENTRY glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); GLAPI void GLAPIENTRY glTexGeniv( GLenum coord, GLenum pname, const GLint *params ); GLAPI void GLAPIENTRY glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); GLAPI void GLAPIENTRY glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); GLAPI void GLAPIENTRY glGetTexGeniv( GLenum coord, GLenum pname, GLint *params ); GLAPI void GLAPIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param ); GLAPI void GLAPIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param ); GLAPI void GLAPIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params ); GLAPI void GLAPIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params ); GLAPI void GLAPIENTRY glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); GLAPI void GLAPIENTRY glGetTexEnviv( GLenum target, GLenum pname, GLint *params ); GLAPI void GLAPIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param ); GLAPI void GLAPIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param ); GLAPI void GLAPIENTRY glTexParameterfv( GLenum target, GLenum pname, const GLfloat *params ); GLAPI void GLAPIENTRY glTexParameteriv( GLenum target, GLenum pname, const GLint *params ); GLAPI void GLAPIENTRY glGetTexParameterfv( GLenum target, GLenum pname, GLfloat *params); GLAPI void GLAPIENTRY glGetTexParameteriv( GLenum target, GLenum pname, GLint *params ); GLAPI void GLAPIENTRY glGetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params ); GLAPI void GLAPIENTRY glGetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params ); GLAPI void GLAPIENTRY glTexImage1D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); GLAPI void GLAPIENTRY glTexImage2D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); GLAPI void GLAPIENTRY glGetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ); /* 1.1 functions */ GLAPI void GLAPIENTRY glGenTextures( GLsizei n, GLuint *textures ); GLAPI void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures); GLAPI void GLAPIENTRY glBindTexture( GLenum target, GLuint texture ); GLAPI void GLAPIENTRY glPrioritizeTextures( GLsizei n, const GLuint *textures, const GLclampf *priorities ); GLAPI GLboolean GLAPIENTRY glAreTexturesResident( GLsizei n, const GLuint *textures, GLboolean *residences ); GLAPI GLboolean GLAPIENTRY glIsTexture( GLuint texture ); GLAPI void GLAPIENTRY glTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels ); GLAPI void GLAPIENTRY glTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); GLAPI void GLAPIENTRY glCopyTexImage1D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border ); GLAPI void GLAPIENTRY glCopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ); GLAPI void GLAPIENTRY glCopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); GLAPI void GLAPIENTRY glCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); /* * Evaluators */ GLAPI void GLAPIENTRY glMap1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points ); GLAPI void GLAPIENTRY glMap1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points ); GLAPI void GLAPIENTRY glMap2d( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points ); GLAPI void GLAPIENTRY glMap2f( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points ); GLAPI void GLAPIENTRY glGetMapdv( GLenum target, GLenum query, GLdouble *v ); GLAPI void GLAPIENTRY glGetMapfv( GLenum target, GLenum query, GLfloat *v ); GLAPI void GLAPIENTRY glGetMapiv( GLenum target, GLenum query, GLint *v ); GLAPI void GLAPIENTRY glEvalCoord1d( GLdouble u ); GLAPI void GLAPIENTRY glEvalCoord1f( GLfloat u ); GLAPI void GLAPIENTRY glEvalCoord1dv( const GLdouble *u ); GLAPI void GLAPIENTRY glEvalCoord1fv( const GLfloat *u ); GLAPI void GLAPIENTRY glEvalCoord2d( GLdouble u, GLdouble v ); GLAPI void GLAPIENTRY glEvalCoord2f( GLfloat u, GLfloat v ); GLAPI void GLAPIENTRY glEvalCoord2dv( const GLdouble *u ); GLAPI void GLAPIENTRY glEvalCoord2fv( const GLfloat *u ); GLAPI void GLAPIENTRY glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); GLAPI void GLAPIENTRY glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); GLAPI void GLAPIENTRY glMapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ); GLAPI void GLAPIENTRY glMapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ); GLAPI void GLAPIENTRY glEvalPoint1( GLint i ); GLAPI void GLAPIENTRY glEvalPoint2( GLint i, GLint j ); GLAPI void GLAPIENTRY glEvalMesh1( GLenum mode, GLint i1, GLint i2 ); GLAPI void GLAPIENTRY glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); /* * Fog */ GLAPI void GLAPIENTRY glFogf( GLenum pname, GLfloat param ); GLAPI void GLAPIENTRY glFogi( GLenum pname, GLint param ); GLAPI void GLAPIENTRY glFogfv( GLenum pname, const GLfloat *params ); GLAPI void GLAPIENTRY glFogiv( GLenum pname, const GLint *params ); /* * Selection and Feedback */ GLAPI void GLAPIENTRY glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ); GLAPI void GLAPIENTRY glPassThrough( GLfloat token ); GLAPI void GLAPIENTRY glSelectBuffer( GLsizei size, GLuint *buffer ); GLAPI void GLAPIENTRY glInitNames( void ); GLAPI void GLAPIENTRY glLoadName( GLuint name ); GLAPI void GLAPIENTRY glPushName( GLuint name ); GLAPI void GLAPIENTRY glPopName( void ); /* * OpenGL 1.2 */ #define GL_RESCALE_NORMAL 0x803A #define GL_CLAMP_TO_EDGE 0x812F #define GL_MAX_ELEMENTS_VERTICES 0x80E8 #define GL_MAX_ELEMENTS_INDICES 0x80E9 #define GL_BGR 0x80E0 #define GL_BGRA 0x80E1 #define GL_UNSIGNED_BYTE_3_3_2 0x8032 #define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 #define GL_UNSIGNED_SHORT_5_6_5 0x8363 #define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 #define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 #define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 #define GL_UNSIGNED_INT_8_8_8_8 0x8035 #define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 #define GL_UNSIGNED_INT_10_10_10_2 0x8036 #define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 #define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 #define GL_SINGLE_COLOR 0x81F9 #define GL_SEPARATE_SPECULAR_COLOR 0x81FA #define GL_TEXTURE_MIN_LOD 0x813A #define GL_TEXTURE_MAX_LOD 0x813B #define GL_TEXTURE_BASE_LEVEL 0x813C #define GL_TEXTURE_MAX_LEVEL 0x813D #define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 #define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 #define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 #define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 #define GL_ALIASED_POINT_SIZE_RANGE 0x846D #define GL_ALIASED_LINE_WIDTH_RANGE 0x846E #define GL_PACK_SKIP_IMAGES 0x806B #define GL_PACK_IMAGE_HEIGHT 0x806C #define GL_UNPACK_SKIP_IMAGES 0x806D #define GL_UNPACK_IMAGE_HEIGHT 0x806E #define GL_TEXTURE_3D 0x806F #define GL_PROXY_TEXTURE_3D 0x8070 #define GL_TEXTURE_DEPTH 0x8071 #define GL_TEXTURE_WRAP_R 0x8072 #define GL_MAX_3D_TEXTURE_SIZE 0x8073 #define GL_TEXTURE_BINDING_3D 0x806A GLAPI void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ); GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* * GL_ARB_imaging */ #define GL_CONSTANT_COLOR 0x8001 #define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 #define GL_CONSTANT_ALPHA 0x8003 #define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 #define GL_COLOR_TABLE 0x80D0 #define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 #define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 #define GL_PROXY_COLOR_TABLE 0x80D3 #define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 #define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 #define GL_COLOR_TABLE_SCALE 0x80D6 #define GL_COLOR_TABLE_BIAS 0x80D7 #define GL_COLOR_TABLE_FORMAT 0x80D8 #define GL_COLOR_TABLE_WIDTH 0x80D9 #define GL_COLOR_TABLE_RED_SIZE 0x80DA #define GL_COLOR_TABLE_GREEN_SIZE 0x80DB #define GL_COLOR_TABLE_BLUE_SIZE 0x80DC #define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD #define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE #define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF #define GL_CONVOLUTION_1D 0x8010 #define GL_CONVOLUTION_2D 0x8011 #define GL_SEPARABLE_2D 0x8012 #define GL_CONVOLUTION_BORDER_MODE 0x8013 #define GL_CONVOLUTION_FILTER_SCALE 0x8014 #define GL_CONVOLUTION_FILTER_BIAS 0x8015 #define GL_REDUCE 0x8016 #define GL_CONVOLUTION_FORMAT 0x8017 #define GL_CONVOLUTION_WIDTH 0x8018 #define GL_CONVOLUTION_HEIGHT 0x8019 #define GL_MAX_CONVOLUTION_WIDTH 0x801A #define GL_MAX_CONVOLUTION_HEIGHT 0x801B #define GL_POST_CONVOLUTION_RED_SCALE 0x801C #define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D #define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E #define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F #define GL_POST_CONVOLUTION_RED_BIAS 0x8020 #define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 #define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 #define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 #define GL_CONSTANT_BORDER 0x8151 #define GL_REPLICATE_BORDER 0x8153 #define GL_CONVOLUTION_BORDER_COLOR 0x8154 #define GL_COLOR_MATRIX 0x80B1 #define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 #define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 #define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 #define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 #define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 #define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 #define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 #define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 #define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA #define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB #define GL_HISTOGRAM 0x8024 #define GL_PROXY_HISTOGRAM 0x8025 #define GL_HISTOGRAM_WIDTH 0x8026 #define GL_HISTOGRAM_FORMAT 0x8027 #define GL_HISTOGRAM_RED_SIZE 0x8028 #define GL_HISTOGRAM_GREEN_SIZE 0x8029 #define GL_HISTOGRAM_BLUE_SIZE 0x802A #define GL_HISTOGRAM_ALPHA_SIZE 0x802B #define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C #define GL_HISTOGRAM_SINK 0x802D #define GL_MINMAX 0x802E #define GL_MINMAX_FORMAT 0x802F #define GL_MINMAX_SINK 0x8030 #define GL_TABLE_TOO_LARGE 0x8031 #define GL_BLEND_EQUATION 0x8009 #define GL_MIN 0x8007 #define GL_MAX 0x8008 #define GL_FUNC_ADD 0x8006 #define GL_FUNC_SUBTRACT 0x800A #define GL_FUNC_REVERSE_SUBTRACT 0x800B #define GL_BLEND_COLOR 0x8005 GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table ); GLAPI void GLAPIENTRY glColorSubTable( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data ); GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname, const GLint *params); GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params); GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start, GLint x, GLint y, GLsizei width ); GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width ); GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format, GLenum type, GLvoid *table ); GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ); GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ); GLAPI void GLAPIENTRY glBlendEquation( GLenum mode ); GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width, GLenum internalformat, GLboolean sink ); GLAPI void GLAPIENTRY glResetHistogram( GLenum target ); GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values ); GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname, GLfloat *params ); GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname, GLint *params ); GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat, GLboolean sink ); GLAPI void GLAPIENTRY glResetMinmax( GLenum target ); GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values ); GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname, GLfloat *params ); GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname, GLint *params ); GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image ); GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image ); GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname, GLfloat params ); GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname, const GLfloat *params ); GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname, GLint params ); GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname, const GLint *params ); GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width ); GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format, GLenum type, GLvoid *image ); GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname, GLfloat *params ); GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname, GLint *params ); GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column ); GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span ); typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); /* * OpenGL 1.3 */ /* multitexture */ #define GL_TEXTURE0 0x84C0 #define GL_TEXTURE1 0x84C1 #define GL_TEXTURE2 0x84C2 #define GL_TEXTURE3 0x84C3 #define GL_TEXTURE4 0x84C4 #define GL_TEXTURE5 0x84C5 #define GL_TEXTURE6 0x84C6 #define GL_TEXTURE7 0x84C7 #define GL_TEXTURE8 0x84C8 #define GL_TEXTURE9 0x84C9 #define GL_TEXTURE10 0x84CA #define GL_TEXTURE11 0x84CB #define GL_TEXTURE12 0x84CC #define GL_TEXTURE13 0x84CD #define GL_TEXTURE14 0x84CE #define GL_TEXTURE15 0x84CF #define GL_TEXTURE16 0x84D0 #define GL_TEXTURE17 0x84D1 #define GL_TEXTURE18 0x84D2 #define GL_TEXTURE19 0x84D3 #define GL_TEXTURE20 0x84D4 #define GL_TEXTURE21 0x84D5 #define GL_TEXTURE22 0x84D6 #define GL_TEXTURE23 0x84D7 #define GL_TEXTURE24 0x84D8 #define GL_TEXTURE25 0x84D9 #define GL_TEXTURE26 0x84DA #define GL_TEXTURE27 0x84DB #define GL_TEXTURE28 0x84DC #define GL_TEXTURE29 0x84DD #define GL_TEXTURE30 0x84DE #define GL_TEXTURE31 0x84DF #define GL_ACTIVE_TEXTURE 0x84E0 #define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 #define GL_MAX_TEXTURE_UNITS 0x84E2 /* texture_cube_map */ #define GL_NORMAL_MAP 0x8511 #define GL_REFLECTION_MAP 0x8512 #define GL_TEXTURE_CUBE_MAP 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A #define GL_PROXY_TEXTURE_CUBE_MAP 0x851B #define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C /* texture_compression */ #define GL_COMPRESSED_ALPHA 0x84E9 #define GL_COMPRESSED_LUMINANCE 0x84EA #define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB #define GL_COMPRESSED_INTENSITY 0x84EC #define GL_COMPRESSED_RGB 0x84ED #define GL_COMPRESSED_RGBA 0x84EE #define GL_TEXTURE_COMPRESSION_HINT 0x84EF #define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 #define GL_TEXTURE_COMPRESSED 0x86A1 #define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 /* multisample */ #define GL_MULTISAMPLE 0x809D #define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E #define GL_SAMPLE_ALPHA_TO_ONE 0x809F #define GL_SAMPLE_COVERAGE 0x80A0 #define GL_SAMPLE_BUFFERS 0x80A8 #define GL_SAMPLES 0x80A9 #define GL_SAMPLE_COVERAGE_VALUE 0x80AA #define GL_SAMPLE_COVERAGE_INVERT 0x80AB #define GL_MULTISAMPLE_BIT 0x20000000 /* transpose_matrix */ #define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 #define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 #define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 #define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 /* texture_env_combine */ #define GL_COMBINE 0x8570 #define GL_COMBINE_RGB 0x8571 #define GL_COMBINE_ALPHA 0x8572 #define GL_SOURCE0_RGB 0x8580 #define GL_SOURCE1_RGB 0x8581 #define GL_SOURCE2_RGB 0x8582 #define GL_SOURCE0_ALPHA 0x8588 #define GL_SOURCE1_ALPHA 0x8589 #define GL_SOURCE2_ALPHA 0x858A #define GL_OPERAND0_RGB 0x8590 #define GL_OPERAND1_RGB 0x8591 #define GL_OPERAND2_RGB 0x8592 #define GL_OPERAND0_ALPHA 0x8598 #define GL_OPERAND1_ALPHA 0x8599 #define GL_OPERAND2_ALPHA 0x859A #define GL_RGB_SCALE 0x8573 #define GL_ADD_SIGNED 0x8574 #define GL_INTERPOLATE 0x8575 #define GL_SUBTRACT 0x84E7 #define GL_CONSTANT 0x8576 #define GL_PRIMARY_COLOR 0x8577 #define GL_PREVIOUS 0x8578 /* texture_env_dot3 */ #define GL_DOT3_RGB 0x86AE #define GL_DOT3_RGBA 0x86AF /* texture_border_clamp */ #define GL_CLAMP_TO_BORDER 0x812D GLAPI void GLAPIENTRY glActiveTexture( GLenum texture ); GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture ); GLAPI void GLAPIENTRY glCompressedTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data ); GLAPI void GLAPIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ); GLAPI void GLAPIENTRY glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data ); GLAPI void GLAPIENTRY glCompressedTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data ); GLAPI void GLAPIENTRY glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ); GLAPI void GLAPIENTRY glCompressedTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data ); GLAPI void GLAPIENTRY glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img ); GLAPI void GLAPIENTRY glMultiTexCoord1d( GLenum target, GLdouble s ); GLAPI void GLAPIENTRY glMultiTexCoord1dv( GLenum target, const GLdouble *v ); GLAPI void GLAPIENTRY glMultiTexCoord1f( GLenum target, GLfloat s ); GLAPI void GLAPIENTRY glMultiTexCoord1fv( GLenum target, const GLfloat *v ); GLAPI void GLAPIENTRY glMultiTexCoord1i( GLenum target, GLint s ); GLAPI void GLAPIENTRY glMultiTexCoord1iv( GLenum target, const GLint *v ); GLAPI void GLAPIENTRY glMultiTexCoord1s( GLenum target, GLshort s ); GLAPI void GLAPIENTRY glMultiTexCoord1sv( GLenum target, const GLshort *v ); GLAPI void GLAPIENTRY glMultiTexCoord2d( GLenum target, GLdouble s, GLdouble t ); GLAPI void GLAPIENTRY glMultiTexCoord2dv( GLenum target, const GLdouble *v ); GLAPI void GLAPIENTRY glMultiTexCoord2f( GLenum target, GLfloat s, GLfloat t ); GLAPI void GLAPIENTRY glMultiTexCoord2fv( GLenum target, const GLfloat *v ); GLAPI void GLAPIENTRY glMultiTexCoord2i( GLenum target, GLint s, GLint t ); GLAPI void GLAPIENTRY glMultiTexCoord2iv( GLenum target, const GLint *v ); GLAPI void GLAPIENTRY glMultiTexCoord2s( GLenum target, GLshort s, GLshort t ); GLAPI void GLAPIENTRY glMultiTexCoord2sv( GLenum target, const GLshort *v ); GLAPI void GLAPIENTRY glMultiTexCoord3d( GLenum target, GLdouble s, GLdouble t, GLdouble r ); GLAPI void GLAPIENTRY glMultiTexCoord3dv( GLenum target, const GLdouble *v ); GLAPI void GLAPIENTRY glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t, GLfloat r ); GLAPI void GLAPIENTRY glMultiTexCoord3fv( GLenum target, const GLfloat *v ); GLAPI void GLAPIENTRY glMultiTexCoord3i( GLenum target, GLint s, GLint t, GLint r ); GLAPI void GLAPIENTRY glMultiTexCoord3iv( GLenum target, const GLint *v ); GLAPI void GLAPIENTRY glMultiTexCoord3s( GLenum target, GLshort s, GLshort t, GLshort r ); GLAPI void GLAPIENTRY glMultiTexCoord3sv( GLenum target, const GLshort *v ); GLAPI void GLAPIENTRY glMultiTexCoord4d( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q ); GLAPI void GLAPIENTRY glMultiTexCoord4dv( GLenum target, const GLdouble *v ); GLAPI void GLAPIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ); GLAPI void GLAPIENTRY glMultiTexCoord4fv( GLenum target, const GLfloat *v ); GLAPI void GLAPIENTRY glMultiTexCoord4i( GLenum target, GLint s, GLint t, GLint r, GLint q ); GLAPI void GLAPIENTRY glMultiTexCoord4iv( GLenum target, const GLint *v ); GLAPI void GLAPIENTRY glMultiTexCoord4s( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q ); GLAPI void GLAPIENTRY glMultiTexCoord4sv( GLenum target, const GLshort *v ); GLAPI void GLAPIENTRY glLoadTransposeMatrixd( const GLdouble m[16] ); GLAPI void GLAPIENTRY glLoadTransposeMatrixf( const GLfloat m[16] ); GLAPI void GLAPIENTRY glMultTransposeMatrixd( const GLdouble m[16] ); GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] ); GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert ); typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img); /* * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1) */ #ifndef GL_ARB_multitexture #define GL_ARB_multitexture 1 #define GL_TEXTURE0_ARB 0x84C0 #define GL_TEXTURE1_ARB 0x84C1 #define GL_TEXTURE2_ARB 0x84C2 #define GL_TEXTURE3_ARB 0x84C3 #define GL_TEXTURE4_ARB 0x84C4 #define GL_TEXTURE5_ARB 0x84C5 #define GL_TEXTURE6_ARB 0x84C6 #define GL_TEXTURE7_ARB 0x84C7 #define GL_TEXTURE8_ARB 0x84C8 #define GL_TEXTURE9_ARB 0x84C9 #define GL_TEXTURE10_ARB 0x84CA #define GL_TEXTURE11_ARB 0x84CB #define GL_TEXTURE12_ARB 0x84CC #define GL_TEXTURE13_ARB 0x84CD #define GL_TEXTURE14_ARB 0x84CE #define GL_TEXTURE15_ARB 0x84CF #define GL_TEXTURE16_ARB 0x84D0 #define GL_TEXTURE17_ARB 0x84D1 #define GL_TEXTURE18_ARB 0x84D2 #define GL_TEXTURE19_ARB 0x84D3 #define GL_TEXTURE20_ARB 0x84D4 #define GL_TEXTURE21_ARB 0x84D5 #define GL_TEXTURE22_ARB 0x84D6 #define GL_TEXTURE23_ARB 0x84D7 #define GL_TEXTURE24_ARB 0x84D8 #define GL_TEXTURE25_ARB 0x84D9 #define GL_TEXTURE26_ARB 0x84DA #define GL_TEXTURE27_ARB 0x84DB #define GL_TEXTURE28_ARB 0x84DC #define GL_TEXTURE29_ARB 0x84DD #define GL_TEXTURE30_ARB 0x84DE #define GL_TEXTURE31_ARB 0x84DF #define GL_ACTIVE_TEXTURE_ARB 0x84E0 #define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 #define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture); GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture); GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s); GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s); GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s); GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v); GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s); GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v); GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v); GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v); GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v); GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v); GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v); GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); #endif /* GL_ARB_multitexture */ /* * Define this token if you want "old-style" header file behaviour (extensions * defined in gl.h). Otherwise, extensions will be included from glext.h. */ #if defined(GL_GLEXT_LEGACY) /* All extensions that used to be here are now found in glext.h */ #else /* GL_GLEXT_LEGACY */ #include #endif /* GL_GLEXT_LEGACY */ /* * ???. GL_MESA_trace * XXX obsolete */ #ifndef GL_MESA_trace #define GL_MESA_trace 1 #define GL_TRACE_ALL_BITS_MESA 0xFFFF #define GL_TRACE_OPERATIONS_BIT_MESA 0x0001 #define GL_TRACE_PRIMITIVES_BIT_MESA 0x0002 #define GL_TRACE_ARRAYS_BIT_MESA 0x0004 #define GL_TRACE_TEXTURES_BIT_MESA 0x0008 #define GL_TRACE_PIXELS_BIT_MESA 0x0010 #define GL_TRACE_ERRORS_BIT_MESA 0x0020 #define GL_TRACE_MASK_MESA 0x8755 #define GL_TRACE_NAME_MESA 0x8756 GLAPI void GLAPIENTRY glEnableTraceMESA( GLbitfield mask ); GLAPI void GLAPIENTRY glDisableTraceMESA( GLbitfield mask ); GLAPI void GLAPIENTRY glNewTraceMESA( GLbitfield mask, const GLubyte * traceName ); GLAPI void GLAPIENTRY glEndTraceMESA( void ); GLAPI void GLAPIENTRY glTraceAssertAttribMESA( GLbitfield attribMask ); GLAPI void GLAPIENTRY glTraceCommentMESA( const GLubyte * comment ); GLAPI void GLAPIENTRY glTraceTextureMESA( GLuint name, const GLubyte* comment ); GLAPI void GLAPIENTRY glTraceListMESA( GLuint name, const GLubyte* comment ); GLAPI void GLAPIENTRY glTracePointerMESA( GLvoid* pointer, const GLubyte* comment ); GLAPI void GLAPIENTRY glTracePointerRangeMESA( const GLvoid* first, const GLvoid* last, const GLubyte* comment ); #endif /* GL_MESA_trace */ /* * ???. GL_MESA_packed_depth_stencil * XXX obsolete */ #ifndef GL_MESA_packed_depth_stencil #define GL_MESA_packed_depth_stencil 1 #define GL_DEPTH_STENCIL_MESA 0x8750 #define GL_UNSIGNED_INT_24_8_MESA 0x8751 #define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752 #define GL_UNSIGNED_SHORT_15_1_MESA 0x8753 #define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754 #endif /* GL_MESA_packed_depth_stencil */ #ifndef GL_MESA_program_debug #define GL_MESA_program_debug 1 #define GL_FRAGMENT_PROGRAM_POSITION_MESA 0x8bb0 #define GL_FRAGMENT_PROGRAM_CALLBACK_MESA 0x8bb1 #define GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA 0x8bb2 #define GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA 0x8bb3 #define GL_VERTEX_PROGRAM_POSITION_MESA 0x8bb4 #define GL_VERTEX_PROGRAM_CALLBACK_MESA 0x8bb5 #define GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA 0x8bb6 #define GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA 0x8bb7 typedef void (*GLprogramcallbackMESA)(GLenum target, GLvoid *data); GLAPI void GLAPIENTRY glProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, GLvoid *data); GLAPI void GLAPIENTRY glGetProgramRegisterfvMESA(GLenum target, GLsizei len, const GLubyte *name, GLfloat *v); #endif /* GL_MESA_program_debug */ #ifndef GL_ATI_blend_equation_separate #define GL_ATI_blend_equation_separate 1 #define GL_ALPHA_BLEND_EQUATION_ATI 0x883D GLAPI void GLAPIENTRY glBlendEquationSeparateATI( GLenum modeRGB, GLenum modeA ); typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLenum modeA); #endif /* GL_ATI_blend_equation_separate */ /** ** NOTE!!!!! If you add new functions to this file, or update ** glext.h be sure to regenerate the gl_mangle.h file. See comments ** in that file for details. **/ /********************************************************************** * Begin system-specific stuff */ #if defined(PRAGMA_EXPORT_SUPPORTED) #pragma export off #endif #if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED #pragma import off #endif /* * End system-specific stuff **********************************************************************/ #ifdef __cplusplus } #endif #endif /* __gl_h_ */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/include/GL/glxext.h0000644000000000000000000007115213614532424017120 0ustar #ifndef __glxext_h_ #define __glxext_h_ #ifdef __cplusplus extern "C" { #endif /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) ** version 1.2.1 Specification. */ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) #define WIN32_LEAN_AND_MEAN 1 #include #endif #ifndef APIENTRY #define APIENTRY #endif #ifndef APIENTRYP #define APIENTRYP APIENTRY * #endif #ifndef GLAPI #define GLAPI extern #endif /*************************************************************/ /* Header file version number, required by OpenGL ABI for Linux */ /* glxext.h last updated 2004/07/26 */ /* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */ #define GLX_GLXEXT_VERSION 6 #ifndef GLX_VERSION_1_3 #define GLX_WINDOW_BIT 0x00000001 #define GLX_PIXMAP_BIT 0x00000002 #define GLX_PBUFFER_BIT 0x00000004 #define GLX_RGBA_BIT 0x00000001 #define GLX_COLOR_INDEX_BIT 0x00000002 #define GLX_PBUFFER_CLOBBER_MASK 0x08000000 #define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 #define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 #define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 #define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 #define GLX_AUX_BUFFERS_BIT 0x00000010 #define GLX_DEPTH_BUFFER_BIT 0x00000020 #define GLX_STENCIL_BUFFER_BIT 0x00000040 #define GLX_ACCUM_BUFFER_BIT 0x00000080 #define GLX_CONFIG_CAVEAT 0x20 #define GLX_X_VISUAL_TYPE 0x22 #define GLX_TRANSPARENT_TYPE 0x23 #define GLX_TRANSPARENT_INDEX_VALUE 0x24 #define GLX_TRANSPARENT_RED_VALUE 0x25 #define GLX_TRANSPARENT_GREEN_VALUE 0x26 #define GLX_TRANSPARENT_BLUE_VALUE 0x27 #define GLX_TRANSPARENT_ALPHA_VALUE 0x28 #define GLX_DONT_CARE 0xFFFFFFFF #define GLX_NONE 0x8000 #define GLX_SLOW_CONFIG 0x8001 #define GLX_TRUE_COLOR 0x8002 #define GLX_DIRECT_COLOR 0x8003 #define GLX_PSEUDO_COLOR 0x8004 #define GLX_STATIC_COLOR 0x8005 #define GLX_GRAY_SCALE 0x8006 #define GLX_STATIC_GRAY 0x8007 #define GLX_TRANSPARENT_RGB 0x8008 #define GLX_TRANSPARENT_INDEX 0x8009 #define GLX_VISUAL_ID 0x800B #define GLX_SCREEN 0x800C #define GLX_NON_CONFORMANT_CONFIG 0x800D #define GLX_DRAWABLE_TYPE 0x8010 #define GLX_RENDER_TYPE 0x8011 #define GLX_X_RENDERABLE 0x8012 #define GLX_FBCONFIG_ID 0x8013 #define GLX_RGBA_TYPE 0x8014 #define GLX_COLOR_INDEX_TYPE 0x8015 #define GLX_MAX_PBUFFER_WIDTH 0x8016 #define GLX_MAX_PBUFFER_HEIGHT 0x8017 #define GLX_MAX_PBUFFER_PIXELS 0x8018 #define GLX_PRESERVED_CONTENTS 0x801B #define GLX_LARGEST_PBUFFER 0x801C #define GLX_WIDTH 0x801D #define GLX_HEIGHT 0x801E #define GLX_EVENT_MASK 0x801F #define GLX_DAMAGED 0x8020 #define GLX_SAVED 0x8021 #define GLX_WINDOW 0x8022 #define GLX_PBUFFER 0x8023 #define GLX_PBUFFER_HEIGHT 0x8040 #define GLX_PBUFFER_WIDTH 0x8041 #endif #ifndef GLX_VERSION_1_4 #define GLX_SAMPLE_BUFFERS 100000 #define GLX_SAMPLES 100001 #endif #ifndef GLX_ARB_get_proc_address #endif #ifndef GLX_ARB_multisample #define GLX_SAMPLE_BUFFERS_ARB 100000 #define GLX_SAMPLES_ARB 100001 #endif #ifndef GLX_SGIS_multisample #define GLX_SAMPLE_BUFFERS_SGIS 100000 #define GLX_SAMPLES_SGIS 100001 #endif #ifndef GLX_EXT_visual_info #define GLX_X_VISUAL_TYPE_EXT 0x22 #define GLX_TRANSPARENT_TYPE_EXT 0x23 #define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 #define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 #define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 #define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 #define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 #define GLX_NONE_EXT 0x8000 #define GLX_TRUE_COLOR_EXT 0x8002 #define GLX_DIRECT_COLOR_EXT 0x8003 #define GLX_PSEUDO_COLOR_EXT 0x8004 #define GLX_STATIC_COLOR_EXT 0x8005 #define GLX_GRAY_SCALE_EXT 0x8006 #define GLX_STATIC_GRAY_EXT 0x8007 #define GLX_TRANSPARENT_RGB_EXT 0x8008 #define GLX_TRANSPARENT_INDEX_EXT 0x8009 #endif #ifndef GLX_SGI_swap_control #endif #ifndef GLX_SGI_video_sync #endif #ifndef GLX_SGI_make_current_read #endif #ifndef GLX_SGIX_video_source #endif #ifndef GLX_EXT_visual_rating #define GLX_VISUAL_CAVEAT_EXT 0x20 #define GLX_SLOW_VISUAL_EXT 0x8001 #define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D /* reuse GLX_NONE_EXT */ #endif #ifndef GLX_EXT_import_context #define GLX_SHARE_CONTEXT_EXT 0x800A #define GLX_VISUAL_ID_EXT 0x800B #define GLX_SCREEN_EXT 0x800C #endif #ifndef GLX_SGIX_fbconfig #define GLX_WINDOW_BIT_SGIX 0x00000001 #define GLX_PIXMAP_BIT_SGIX 0x00000002 #define GLX_RGBA_BIT_SGIX 0x00000001 #define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 #define GLX_DRAWABLE_TYPE_SGIX 0x8010 #define GLX_RENDER_TYPE_SGIX 0x8011 #define GLX_X_RENDERABLE_SGIX 0x8012 #define GLX_FBCONFIG_ID_SGIX 0x8013 #define GLX_RGBA_TYPE_SGIX 0x8014 #define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 /* reuse GLX_SCREEN_EXT */ #endif #ifndef GLX_SGIX_pbuffer #define GLX_PBUFFER_BIT_SGIX 0x00000004 #define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 #define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 #define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 #define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 #define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 #define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 #define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 #define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 #define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 #define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 #define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 #define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 #define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 #define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 #define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A #define GLX_PRESERVED_CONTENTS_SGIX 0x801B #define GLX_LARGEST_PBUFFER_SGIX 0x801C #define GLX_WIDTH_SGIX 0x801D #define GLX_HEIGHT_SGIX 0x801E #define GLX_EVENT_MASK_SGIX 0x801F #define GLX_DAMAGED_SGIX 0x8020 #define GLX_SAVED_SGIX 0x8021 #define GLX_WINDOW_SGIX 0x8022 #define GLX_PBUFFER_SGIX 0x8023 #endif #ifndef GLX_SGI_cushion #endif #ifndef GLX_SGIX_video_resize #define GLX_SYNC_FRAME_SGIX 0x00000000 #define GLX_SYNC_SWAP_SGIX 0x00000001 #endif #ifndef GLX_SGIX_dmbuffer #define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024 #endif #ifndef GLX_SGIX_swap_group #endif #ifndef GLX_SGIX_swap_barrier #endif #ifndef GLX_SGIS_blended_overlay #define GLX_BLENDED_RGBA_SGIS 0x8025 #endif #ifndef GLX_SGIS_shared_multisample #define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 #define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 #endif #ifndef GLX_SUN_get_transparent_index #endif #ifndef GLX_3DFX_multisample #define GLX_SAMPLE_BUFFERS_3DFX 0x8050 #define GLX_SAMPLES_3DFX 0x8051 #endif #ifndef GLX_MESA_copy_sub_buffer #endif #ifndef GLX_MESA_pixmap_colormap #endif #ifndef GLX_MESA_release_buffers #endif #ifndef GLX_MESA_set_3dfx_mode #define GLX_3DFX_WINDOW_MODE_MESA 0x1 #define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 #endif #ifndef GLX_SGIX_visual_select_group #define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 #endif #ifndef GLX_OML_swap_method #define GLX_SWAP_METHOD_OML 0x8060 #define GLX_SWAP_EXCHANGE_OML 0x8061 #define GLX_SWAP_COPY_OML 0x8062 #define GLX_SWAP_UNDEFINED_OML 0x8063 #endif #ifndef GLX_OML_sync_control #endif #ifndef GLX_SGIX_hyperpipe_group #define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80 #define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91 #define GLX_BAD_HYPERPIPE_SGIX 92 #define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001 #define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002 #define GLX_PIPE_RECT_SGIX 0x00000001 #define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002 #define GLX_HYPERPIPE_STEREO_SGIX 0x00000003 #define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004 #define GLX_HYPERPIPE_ID_SGIX 0x8030 #endif #ifndef GLX_MESA_agp_offset #endif /*************************************************************/ #ifndef GLX_ARB_get_proc_address typedef void (*__GLXextFuncPtr)(void); #endif #ifndef GLX_SGIX_video_source typedef XID GLXVideoSourceSGIX; #endif #ifndef GLX_SGIX_fbconfig typedef XID GLXFBConfigIDSGIX; typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; #endif #ifndef GLX_SGIX_pbuffer typedef XID GLXPbufferSGIX; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came for SendEvent request */ Display *display; /* display the event was read from */ GLXDrawable drawable; /* i.d. of Drawable */ int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */ int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */ unsigned int mask; /* mask indicating which buffers are affected*/ int x, y; int width, height; int count; /* if nonzero, at least this many more */ } GLXBufferClobberEventSGIX; #endif #if defined(__sun__) #include #if defined(__STDC__) #if defined(__arch64__) typedef long int int64_t; #else typedef long long int int64_t; #endif /* __arch64__ */ #endif /* __STDC__ */ #elif defined(__UNIXOS2__) || defined(__SOL64__) typedef long int int32_t; typedef long long int int64_t; #elif defined( __VMS ) #include #elif defined(__SCO__) || defined(__USLC__) #include #elif defined(WIN32) && defined(__GNUC__) #include #endif #ifndef GLX_VERSION_1_3 #define GLX_VERSION_1_3 1 #ifdef GLX_GLXEXT_PROTOTYPES extern GLXFBConfig * glXGetFBConfigs (Display *, int, int *); extern GLXFBConfig * glXChooseFBConfig (Display *, int, const int *, int *); extern int glXGetFBConfigAttrib (Display *, GLXFBConfig, int, int *); extern XVisualInfo * glXGetVisualFromFBConfig (Display *, GLXFBConfig); extern GLXWindow glXCreateWindow (Display *, GLXFBConfig, Window, const int *); extern void glXDestroyWindow (Display *, GLXWindow); extern GLXPixmap glXCreatePixmap (Display *, GLXFBConfig, Pixmap, const int *); extern void glXDestroyPixmap (Display *, GLXPixmap); extern GLXPbuffer glXCreatePbuffer (Display *, GLXFBConfig, const int *); extern void glXDestroyPbuffer (Display *, GLXPbuffer); extern void glXQueryDrawable (Display *, GLXDrawable, int, unsigned int *); extern GLXContext glXCreateNewContext (Display *, GLXFBConfig, int, GLXContext, Bool); extern Bool glXMakeContextCurrent (Display *, GLXDrawable, GLXDrawable, GLXContext); extern GLXDrawable glXGetCurrentReadDrawable (void); extern Display * glXGetCurrentDisplay (void); extern int glXQueryContext (Display *, GLXContext, int, int *); extern void glXSelectEvent (Display *, GLXDrawable, unsigned long); extern void glXGetSelectedEvent (Display *, GLXDrawable, unsigned long *); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void); typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void); typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); #endif #ifndef GLX_VERSION_1_4 #define GLX_VERSION_1_4 1 #ifdef GLX_GLXEXT_PROTOTYPES extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName); #endif #ifndef GLX_ARB_get_proc_address #define GLX_ARB_get_proc_address 1 #ifdef GLX_GLXEXT_PROTOTYPES extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName); #endif #ifndef GLX_ARB_multisample #define GLX_ARB_multisample 1 #endif #ifndef GLX_SGIS_multisample #define GLX_SGIS_multisample 1 #endif #ifndef GLX_EXT_visual_info #define GLX_EXT_visual_info 1 #endif #ifndef GLX_SGI_swap_control #define GLX_SGI_swap_control 1 #ifdef GLX_GLXEXT_PROTOTYPES extern int glXSwapIntervalSGI (int); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval); #endif #ifndef GLX_SGI_video_sync #define GLX_SGI_video_sync 1 #ifdef GLX_GLXEXT_PROTOTYPES extern int glXGetVideoSyncSGI (unsigned int *); extern int glXWaitVideoSyncSGI (int, int, unsigned int *); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count); typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count); #endif #ifndef GLX_SGI_make_current_read #define GLX_SGI_make_current_read 1 #ifdef GLX_GLXEXT_PROTOTYPES extern Bool glXMakeCurrentReadSGI (Display *, GLXDrawable, GLXDrawable, GLXContext); extern GLXDrawable glXGetCurrentReadDrawableSGI (void); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void); #endif #ifndef GLX_SGIX_video_source #define GLX_SGIX_video_source 1 #ifdef _VL_H #ifdef GLX_GLXEXT_PROTOTYPES extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *, int, VLServer, VLPath, int, VLNode); extern void glXDestroyGLXVideoSourceSGIX (Display *, GLXVideoSourceSGIX); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef GLXVideoSourceSGIX ( * PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); typedef void ( * PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource); #endif /* _VL_H */ #endif #ifndef GLX_EXT_visual_rating #define GLX_EXT_visual_rating 1 #endif #ifndef GLX_EXT_import_context #define GLX_EXT_import_context 1 #ifdef GLX_GLXEXT_PROTOTYPES extern Display * glXGetCurrentDisplayEXT (void); extern int glXQueryContextInfoEXT (Display *, GLXContext, int, int *); extern GLXContextID glXGetContextIDEXT (const GLXContext); extern GLXContext glXImportContextEXT (Display *, GLXContextID); extern void glXFreeContextEXT (Display *, GLXContext); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void); typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value); typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context); typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID); typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context); #endif #ifndef GLX_SGIX_fbconfig #define GLX_SGIX_fbconfig 1 #ifdef GLX_GLXEXT_PROTOTYPES extern int glXGetFBConfigAttribSGIX (Display *, GLXFBConfigSGIX, int, int *); extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *, int, int *, int *); extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *, GLXFBConfigSGIX, Pixmap); extern GLXContext glXCreateContextWithConfigSGIX (Display *, GLXFBConfigSGIX, int, GLXContext, Bool); extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *, GLXFBConfigSGIX); extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *, XVisualInfo *); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); typedef GLXFBConfigSGIX * ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements); typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config); typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis); #endif #ifndef GLX_SGIX_pbuffer #define GLX_SGIX_pbuffer 1 #ifdef GLX_GLXEXT_PROTOTYPES extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *); extern void glXDestroyGLXPbufferSGIX (Display *, GLXPbufferSGIX); extern int glXQueryGLXPbufferSGIX (Display *, GLXPbufferSGIX, int, unsigned int *); extern void glXSelectEventSGIX (Display *, GLXDrawable, unsigned long); extern void glXGetSelectedEventSGIX (Display *, GLXDrawable, unsigned long *); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf); typedef int ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask); typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask); #endif #ifndef GLX_SGI_cushion #define GLX_SGI_cushion 1 #ifdef GLX_GLXEXT_PROTOTYPES extern void glXCushionSGI (Display *, Window, float); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef void ( * PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion); #endif #ifndef GLX_SGIX_video_resize #define GLX_SGIX_video_resize 1 #ifdef GLX_GLXEXT_PROTOTYPES extern int glXBindChannelToWindowSGIX (Display *, int, int, Window); extern int glXChannelRectSGIX (Display *, int, int, int, int, int, int); extern int glXQueryChannelRectSGIX (Display *, int, int, int *, int *, int *, int *); extern int glXQueryChannelDeltasSGIX (Display *, int, int, int *, int *, int *, int *); extern int glXChannelRectSyncSGIX (Display *, int, int, GLenum); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window); typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h); typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h); typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype); #endif #ifndef GLX_SGIX_dmbuffer #define GLX_SGIX_dmbuffer 1 #ifdef _DM_BUFFER_H_ #ifdef GLX_GLXEXT_PROTOTYPES extern Bool glXAssociateDMPbufferSGIX (Display *, GLXPbufferSGIX, DMparams *, DMbuffer); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); #endif /* _DM_BUFFER_H_ */ #endif #ifndef GLX_SGIX_swap_group #define GLX_SGIX_swap_group 1 #ifdef GLX_GLXEXT_PROTOTYPES extern void glXJoinSwapGroupSGIX (Display *, GLXDrawable, GLXDrawable); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); #endif #ifndef GLX_SGIX_swap_barrier #define GLX_SGIX_swap_barrier 1 #ifdef GLX_GLXEXT_PROTOTYPES extern void glXBindSwapBarrierSGIX (Display *, GLXDrawable, int); extern Bool glXQueryMaxSwapBarriersSGIX (Display *, int, int *); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); #endif #ifndef GLX_SUN_get_transparent_index #define GLX_SUN_get_transparent_index 1 #ifdef GLX_GLXEXT_PROTOTYPES extern Status glXGetTransparentIndexSUN (Display *, Window, Window, long *); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); #endif #ifndef GLX_MESA_copy_sub_buffer #define GLX_MESA_copy_sub_buffer 1 #ifdef GLX_GLXEXT_PROTOTYPES extern void glXCopySubBufferMESA (Display *, GLXDrawable, int, int, int, int); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); #endif #ifndef GLX_MESA_pixmap_colormap #define GLX_MESA_pixmap_colormap 1 #ifdef GLX_GLXEXT_PROTOTYPES extern GLXPixmap glXCreateGLXPixmapMESA (Display *, XVisualInfo *, Pixmap, Colormap); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); #endif #ifndef GLX_MESA_release_buffers #define GLX_MESA_release_buffers 1 #ifdef GLX_GLXEXT_PROTOTYPES extern Bool glXReleaseBuffersMESA (Display *, GLXDrawable); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable); #endif #ifndef GLX_MESA_set_3dfx_mode #define GLX_MESA_set_3dfx_mode 1 #ifdef GLX_GLXEXT_PROTOTYPES extern Bool glXSet3DfxModeMESA (int); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode); #endif #ifndef GLX_SGIX_visual_select_group #define GLX_SGIX_visual_select_group 1 #endif #ifndef GLX_OML_swap_method #define GLX_OML_swap_method 1 #endif #ifndef GLX_OML_sync_control #define GLX_OML_sync_control 1 #ifdef GLX_GLXEXT_PROTOTYPES extern Bool glXGetSyncValuesOML (Display *, GLXDrawable, int64_t *, int64_t *, int64_t *); extern Bool glXGetMscRateOML (Display *, GLXDrawable, int32_t *, int32_t *); extern int64_t glXSwapBuffersMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t); extern Bool glXWaitForMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t, int64_t *, int64_t *, int64_t *); extern Bool glXWaitForSbcOML (Display *, GLXDrawable, int64_t, int64_t *, int64_t *, int64_t *); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc); typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator); typedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc); typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc); #endif #ifndef GLX_SGIX_hyperpipe_group #define GLX_SGIX_hyperpipe_group 1 typedef struct { char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; int networkId; } GLXHyperpipeNetworkSGIX; typedef struct { char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; int channel; unsigned int participationType; int timeSlice; } GLXHyperpipeConfigSGIX; typedef struct { char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; int srcXOrigin, srcYOrigin, srcWidth, srcHeight; int destXOrigin, destYOrigin, destWidth, destHeight; } GLXPipeRect; typedef struct { char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; int XOrigin, YOrigin, maxHeight, maxWidth; } GLXPipeRectLimits; #ifdef GLX_GLXEXT_PROTOTYPES extern GLXHyperpipeNetworkSGIX * glXQueryHyperpipeNetworkSGIX (Display *, int *); extern int glXHyperpipeConfigSGIX (Display *, int, int, GLXHyperpipeConfigSGIX *, int *); extern GLXHyperpipeConfigSGIX * glXQueryHyperpipeConfigSGIX (Display *, int, int *); extern int glXDestroyHyperpipeConfigSGIX (Display *, int); extern int glXBindHyperpipeSGIX (Display *, int); extern int glXQueryHyperpipeBestAttribSGIX (Display *, int, int, int, void *, void *); extern int glXHyperpipeAttribSGIX (Display *, int, int, int, void *); extern int glXQueryHyperpipeAttribSGIX (Display *, int, int, int, void *); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes); typedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId); typedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes); typedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId); typedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId); typedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList); typedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList); typedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList); #endif #ifndef GLX_MESA_agp_offset #define GLX_MESA_agp_offset 1 #ifdef GLX_GLXEXT_PROTOTYPES extern unsigned int glXGetAGPOffsetMESA (const void *); #endif /* GLX_GLXEXT_PROTOTYPES */ typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer); #endif #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/include/GL/internal/glcore.h0000644000000000000000000004010213614532424020663 0ustar /* $XFree86: xc/lib/GL/include/GL/internal/glcore.h,v 1.7 2001/03/25 05:32:00 tsi Exp $ */ #ifndef __gl_core_h_ #define __gl_core_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifndef XFree86LOADER #include #endif #ifdef CAPI #undef CAPI #endif #define CAPI #define GL_CORE_SGI 1 #define GL_CORE_MESA 2 #define GL_CORE_APPLE 4 typedef struct __GLcontextRec __GLcontext; typedef struct __GLinterfaceRec __GLinterface; /* ** This file defines the interface between the GL core and the surrounding ** "operating system" that supports it (currently the GLX or WGL extensions). ** ** Members (data and function pointers) are documented as imported or ** exported according to how they are used by the core rendering functions. ** Imported members are initialized by the "operating system" and used by ** the core functions. Exported members are initialized by the core functions ** and used by the "operating system". */ /* ** Mode and limit information for a context. This information is ** kept around in the context so that values can be used during ** command execution, and for returning information about the ** context to the application. */ typedef struct __GLcontextModesRec { struct __GLcontextModesRec * next; GLboolean rgbMode; GLboolean floatMode; GLboolean colorIndexMode; GLuint doubleBufferMode; GLuint stereoMode; GLboolean haveAccumBuffer; GLboolean haveDepthBuffer; GLboolean haveStencilBuffer; GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ GLuint redMask, greenMask, blueMask, alphaMask; GLint rgbBits; /* total bits for rgb */ GLint indexBits; /* total bits for colorindex */ GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; GLint depthBits; GLint stencilBits; GLint numAuxBuffers; GLint level; GLint pixmapMode; /* GLX */ GLint visualID; GLint visualType; /**< One of the GLX X visual types. (i.e., * \c GLX_TRUE_COLOR, etc.) */ /* EXT_visual_rating / GLX 1.2 */ GLint visualRating; /* EXT_visual_info / GLX 1.2 */ GLint transparentPixel; /* colors are floats scaled to ints */ GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha; GLint transparentIndex; /* ARB_multisample / SGIS_multisample */ GLint sampleBuffers; GLint samples; /* SGIX_fbconfig / GLX 1.3 */ GLint drawableType; GLint renderType; GLint xRenderable; GLint fbconfigID; /* SGIX_pbuffer / GLX 1.3 */ GLint maxPbufferWidth; GLint maxPbufferHeight; GLint maxPbufferPixels; GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */ GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */ /* SGIX_visual_select_group */ GLint visualSelectGroup; /* OML_swap_method */ GLint swapMethod; GLint screen; } __GLcontextModes; /* Several fields of __GLcontextModes can take these as values. Since * GLX header files may not be available everywhere they need to be used, * redefine them here. */ #define GLX_NONE 0x8000 #define GLX_SLOW_CONFIG 0x8001 #define GLX_TRUE_COLOR 0x8002 #define GLX_DIRECT_COLOR 0x8003 #define GLX_PSEUDO_COLOR 0x8004 #define GLX_STATIC_COLOR 0x8005 #define GLX_GRAY_SCALE 0x8006 #define GLX_STATIC_GRAY 0x8007 #define GLX_TRANSPARENT_RGB 0x8008 #define GLX_TRANSPARENT_INDEX 0x8009 #define GLX_NON_CONFORMANT_CONFIG 0x800D #define GLX_SWAP_EXCHANGE_OML 0x8061 #define GLX_SWAP_COPY_OML 0x8062 #define GLX_SWAP_UNDEFINED_OML 0x8063 #define GLX_DONT_CARE 0xFFFFFFFF #define GLX_RGBA_BIT 0x00000001 #define GLX_COLOR_INDEX_BIT 0x00000002 #define GLX_WINDOW_BIT 0x00000001 #define GLX_PIXMAP_BIT 0x00000002 #define GLX_PBUFFER_BIT 0x00000004 /************************************************************************/ /* ** Structure used for allocating and freeing drawable private memory. ** (like software buffers, for example). ** ** The memory allocation routines are provided by the surrounding ** "operating system" code, and they are to be used for allocating ** software buffers and things which are associated with the drawable, ** and used by any context which draws to that drawable. There are ** separate memory allocation functions for drawables and contexts ** since drawables and contexts can be created and destroyed independently ** of one another, and the "operating system" may want to use separate ** allocation arenas for each. ** ** The freePrivate function is filled in by the core routines when they ** allocates software buffers, and stick them in "private". The freePrivate ** function will destroy anything allocated to this drawable (to be called ** when the drawable is destroyed). */ typedef struct __GLdrawableRegionRec __GLdrawableRegion; typedef struct __GLdrawableBufferRec __GLdrawableBuffer; typedef struct __GLdrawablePrivateRec __GLdrawablePrivate; typedef struct __GLregionRectRec { /* lower left (inside the rectangle) */ GLint x0, y0; /* upper right (outside the rectangle) */ GLint x1, y1; } __GLregionRect; struct __GLdrawableRegionRec { GLint numRects; __GLregionRect *rects; __GLregionRect boundingRect; }; /************************************************************************/ /* masks for the buffers */ #define __GL_FRONT_BUFFER_MASK 0x00000001 #define __GL_FRONT_LEFT_BUFFER_MASK 0x00000001 #define __GL_FRONT_RIGHT_BUFFER_MASK 0x00000002 #define __GL_BACK_BUFFER_MASK 0x00000004 #define __GL_BACK_LEFT_BUFFER_MASK 0x00000004 #define __GL_BACK_RIGHT_BUFFER_MASK 0x00000008 #define __GL_ACCUM_BUFFER_MASK 0x00000010 #define __GL_DEPTH_BUFFER_MASK 0x00000020 #define __GL_STENCIL_BUFFER_MASK 0x00000040 #define __GL_AUX_BUFFER_MASK(i) (0x0000080 << (i)) #define __GL_ALL_BUFFER_MASK 0xffffffff /* what Resize routines return if resize resorted to fallback case */ #define __GL_BUFFER_FALLBACK 0x10 typedef void (*__GLbufFallbackInitFn)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits); typedef void (*__GLbufMainInitFn)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits, __GLbufFallbackInitFn back); /* ** A drawable buffer ** ** This data structure describes the context side of a drawable. ** ** According to the spec there could be multiple contexts bound to the same ** drawable at the same time (from different threads). In order to avoid ** multiple-access conflicts, locks are used to serialize access. When a ** thread needs to access (read or write) a member of the drawable, it takes ** a lock first. Some of the entries in the drawable are treated "mostly ** constant", so we take the freedom of allowing access to them without ** taking a lock (for optimization reasons). ** ** For more details regarding locking, see buffers.h in the GL core */ struct __GLdrawableBufferRec { /* ** Buffer dimensions */ GLint width, height, depth; /* ** Framebuffer base address */ void *base; /* ** Framebuffer size (in bytes) */ GLuint size; /* ** Size (in bytes) of each element in the framebuffer */ GLuint elementSize; GLuint elementSizeLog2; /* ** Element skip from one scanline to the next. ** If the buffer is part of another buffer (for example, fullscreen ** front buffer), outerWidth is the width of that buffer. */ GLint outerWidth; /* ** outerWidth * elementSize */ GLint byteWidth; /* ** Allocation/deallocation is done based on this handle. A handle ** is conceptually different from the framebuffer 'base'. */ void *handle; /* imported */ GLboolean (*resize)(__GLdrawableBuffer *buf, GLint x, GLint y, GLuint width, GLuint height, __GLdrawablePrivate *glPriv, GLuint bufferMask); void (*lock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); void (*unlock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); void (*fill)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLuint val, GLint x, GLint y, GLint w, GLint h); void (*free)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); /* exported */ void (*freePrivate)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv); #ifdef __cplusplus void *privatePtr; #else void *private; #endif /* private */ void *other; /* implementation private data */ __GLbufMainInitFn mainInit; __GLbufFallbackInitFn fallbackInit; }; /* ** The context side of the drawable private */ struct __GLdrawablePrivateRec { /* ** Drawable Modes */ __GLcontextModes *modes; /* ** Drawable size */ GLuint width, height; /* ** Origin in screen coordinates of the drawable */ GLint xOrigin, yOrigin; #ifdef __GL_ALIGNED_BUFFERS /* ** Drawable offset from screen origin */ GLint xOffset, yOffset; /* ** Alignment restriction */ GLint xAlignment, yAlignment; #endif /* ** Should we invert the y axis? */ GLint yInverted; /* ** Mask specifying which buffers are renderable by the hw */ GLuint accelBufferMask; /* ** the buffers themselves */ __GLdrawableBuffer frontBuffer; __GLdrawableBuffer backBuffer; __GLdrawableBuffer accumBuffer; __GLdrawableBuffer depthBuffer; __GLdrawableBuffer stencilBuffer; #if defined(__GL_NUMBER_OF_AUX_BUFFERS) && (__GL_NUMBER_OF_AUX_BUFFERS > 0) __GLdrawableBuffer *auxBuffer; #endif __GLdrawableRegion ownershipRegion; /* ** Lock for the drawable private structure */ void *lock; #ifdef DEBUG /* lock debugging info */ int lockRefCount; int lockLine[10]; char *lockFile[10]; #endif /* imported */ void *(*malloc)(size_t size); void *(*calloc)(size_t numElem, size_t elemSize); void *(*realloc)(void *oldAddr, size_t newSize); void (*free)(void *addr); GLboolean (*addSwapRect)(__GLdrawablePrivate *glPriv, GLint x, GLint y, GLsizei width, GLsizei height); void (*setClipRect)(__GLdrawablePrivate *glPriv, GLint x, GLint y, GLsizei width, GLsizei height); void (*updateClipRegion)(__GLdrawablePrivate *glPriv); GLboolean (*resize)(__GLdrawablePrivate *glPriv); void (*getDrawableSize)(__GLdrawablePrivate *glPriv, GLint *x, GLint *y, GLuint *width, GLuint *height); void (*lockDP)(__GLdrawablePrivate *glPriv, __GLcontext *gc); void (*unlockDP)(__GLdrawablePrivate *glPriv); /* exported */ #ifdef __cplusplus void *privatePtr; #else void *private; #endif void (*freePrivate)(__GLdrawablePrivate *); /* client data */ void *other; }; /* ** Macros to lock/unlock the drawable private */ #if defined(DEBUG) #define __GL_LOCK_DP(glPriv,gc) \ (*(glPriv)->lockDP)(glPriv,gc); \ (glPriv)->lockLine[(glPriv)->lockRefCount] = __LINE__; \ (glPriv)->lockFile[(glPriv)->lockRefCount] = __FILE__; \ (glPriv)->lockRefCount++ #define __GL_UNLOCK_DP(glPriv) \ (glPriv)->lockRefCount--; \ (glPriv)->lockLine[(glPriv)->lockRefCount] = 0; \ (glPriv)->lockFile[(glPriv)->lockRefCount] = NULL; \ (*(glPriv)->unlockDP)(glPriv) #else /* DEBUG */ #define __GL_LOCK_DP(glPriv,gc) (*(glPriv)->lockDP)(glPriv,gc) #define __GL_UNLOCK_DP(glPriv) (*(glPriv)->unlockDP)(glPriv) #endif /* DEBUG */ /* ** Procedures which are imported by the GL from the surrounding ** "operating system". Math functions are not considered part of the ** "operating system". */ typedef struct __GLimportsRec { /* Memory management */ void * (*malloc)(__GLcontext *gc, size_t size); void *(*calloc)(__GLcontext *gc, size_t numElem, size_t elemSize); void *(*realloc)(__GLcontext *gc, void *oldAddr, size_t newSize); void (*free)(__GLcontext *gc, void *addr); /* Error handling */ void (*warning)(__GLcontext *gc, char *fmt); void (*fatal)(__GLcontext *gc, char *fmt); /* other system calls */ char *(CAPI *getenv)(__GLcontext *gc, const char *var); int (CAPI *atoi)(__GLcontext *gc, const char *str); int (CAPI *sprintf)(__GLcontext *gc, char *str, const char *fmt, ...); void *(CAPI *fopen)(__GLcontext *gc, const char *path, const char *mode); int (CAPI *fclose)(__GLcontext *gc, void *stream); int (CAPI *fprintf)(__GLcontext *gc, void *stream, const char *fmt, ...); /* Drawing surface management */ __GLdrawablePrivate *(*getDrawablePrivate)(__GLcontext *gc); __GLdrawablePrivate *(*getReadablePrivate)(__GLcontext *gc); /* Operating system dependent data goes here */ void *other; } __GLimports; /************************************************************************/ /* ** Procedures which are exported by the GL to the surrounding "operating ** system" so that it can manage multiple GL context's. */ typedef struct __GLexportsRec { /* Context management (return GL_FALSE on failure) */ GLboolean (*destroyContext)(__GLcontext *gc); GLboolean (*loseCurrent)(__GLcontext *gc); /* oldglPriv isn't used anymore, kept for backwards compatibility */ GLboolean (*makeCurrent)(__GLcontext *gc); GLboolean (*shareContext)(__GLcontext *gc, __GLcontext *gcShare); GLboolean (*copyContext)(__GLcontext *dst, const __GLcontext *src, GLuint mask); GLboolean (*forceCurrent)(__GLcontext *gc); /* Drawing surface notification callbacks */ GLboolean (*notifyResize)(__GLcontext *gc); void (*notifyDestroy)(__GLcontext *gc); void (*notifySwapBuffers)(__GLcontext *gc); /* Dispatch table override control for external agents like libGLS */ struct __GLdispatchStateRec* (*dispatchExec)(__GLcontext *gc); void (*beginDispatchOverride)(__GLcontext *gc); void (*endDispatchOverride)(__GLcontext *gc); } __GLexports; /************************************************************************/ /* ** This must be the first member of a __GLcontext structure. This is the ** only part of a context that is exposed to the outside world; everything ** else is opaque. */ struct __GLinterfaceRec { __GLimports imports; __GLexports exports; }; extern __GLcontext *__glCoreCreateContext(__GLimports *, __GLcontextModes *); extern void __glCoreNopDispatch(void); #endif /* __gl_core_h_ */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/include/GL/osmesa.h0000644000000000000000000002062313614532424017071 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Mesa Off-Screen rendering interface. * * This is an operating system and window system independent interface to * Mesa which allows one to render images into a client-supplied buffer in * main memory. Such images may manipulated or saved in whatever way the * client wants. * * These are the API functions: * OSMesaCreateContext - create a new Off-Screen Mesa rendering context * OSMesaMakeCurrent - bind an OSMesaContext to a client's image buffer * and make the specified context the current one. * OSMesaDestroyContext - destroy an OSMesaContext * OSMesaGetCurrentContext - return thread's current context ID * OSMesaPixelStore - controls how pixels are stored in image buffer * OSMesaGetIntegerv - return OSMesa state parameters * * * The limits on the width and height of an image buffer are MAX_WIDTH and * MAX_HEIGHT as defined in Mesa/src/config.h. Defaults are 1280 and 1024. * You can increase them as needed but beware that many temporary arrays in * Mesa are dimensioned by MAX_WIDTH or MAX_HEIGHT. */ #ifndef OSMESA_H #define OSMESA_H #ifdef __cplusplus extern "C" { #endif #include #define OSMESA_MAJOR_VERSION 6 #define OSMESA_MINOR_VERSION 4 #define OSMESA_PATCH_VERSION 2 /* * Values for the format parameter of OSMesaCreateContext() * New in version 2.0. */ #define OSMESA_COLOR_INDEX GL_COLOR_INDEX #define OSMESA_RGBA GL_RGBA #define OSMESA_BGRA 0x1 #define OSMESA_ARGB 0x2 #define OSMESA_RGB GL_RGB #define OSMESA_BGR 0x4 #define OSMESA_RGB_565 0x5 /* * OSMesaPixelStore() parameters: * New in version 2.0. */ #define OSMESA_ROW_LENGTH 0x10 #define OSMESA_Y_UP 0x11 /* * Accepted by OSMesaGetIntegerv: */ #define OSMESA_WIDTH 0x20 #define OSMESA_HEIGHT 0x21 #define OSMESA_FORMAT 0x22 #define OSMESA_TYPE 0x23 #define OSMESA_MAX_WIDTH 0x24 /* new in 4.0 */ #define OSMESA_MAX_HEIGHT 0x25 /* new in 4.0 */ typedef struct osmesa_context *OSMesaContext; #if defined(__BEOS__) || defined(__QUICKDRAW__) #pragma export on #endif /* * Create an Off-Screen Mesa rendering context. The only attribute needed is * an RGBA vs Color-Index mode flag. * * Input: format - one of OSMESA_COLOR_INDEX, OSMESA_RGBA, OSMESA_BGRA, * OSMESA_ARGB, OSMESA_RGB, or OSMESA_BGR. * sharelist - specifies another OSMesaContext with which to share * display lists. NULL indicates no sharing. * Return: an OSMesaContext or 0 if error */ GLAPI OSMesaContext GLAPIENTRY OSMesaCreateContext( GLenum format, OSMesaContext sharelist ); /* * Create an Off-Screen Mesa rendering context and specify desired * size of depth buffer, stencil buffer and accumulation buffer. * If you specify zero for depthBits, stencilBits, accumBits you * can save some memory. * * New in Mesa 3.5 */ GLAPI OSMesaContext GLAPIENTRY OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, OSMesaContext sharelist); /* * Destroy an Off-Screen Mesa rendering context. * * Input: ctx - the context to destroy */ GLAPI void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx ); /* * Bind an OSMesaContext to an image buffer. The image buffer is just a * block of memory which the client provides. Its size must be at least * as large as width*height*sizeof(type). Its address should be a multiple * of 4 if using RGBA mode. * * Image data is stored in the order of glDrawPixels: row-major order * with the lower-left image pixel stored in the first array position * (ie. bottom-to-top). * * Since the only type initially supported is GL_UNSIGNED_BYTE, if the * context is in RGBA mode, each pixel will be stored as a 4-byte RGBA * value. If the context is in color indexed mode, each pixel will be * stored as a 1-byte value. * * If the context's viewport hasn't been initialized yet, it will now be * initialized to (0,0,width,height). * * Input: ctx - the rendering context * buffer - the image buffer memory * type - data type for pixel components, only GL_UNSIGNED_BYTE * supported now * width, height - size of image buffer in pixels, at least 1 * Return: GL_TRUE if success, GL_FALSE if error because of invalid ctx, * invalid buffer address, type!=GL_UNSIGNED_BYTE, width<1, height<1, * width>internal limit or height>internal limit. */ GLAPI GLboolean GLAPIENTRY OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type, GLsizei width, GLsizei height ); /* * Return the current Off-Screen Mesa rendering context handle. */ GLAPI OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void ); /* * Set pixel store/packing parameters for the current context. * This is similar to glPixelStore. * Input: pname - OSMESA_ROW_LENGTH * specify actual pixels per row in image buffer * 0 = same as image width (default) * OSMESA_Y_UP * zero = Y coordinates increase downward * non-zero = Y coordinates increase upward (default) * value - the value for the parameter pname * * New in version 2.0. */ GLAPI void GLAPIENTRY OSMesaPixelStore( GLint pname, GLint value ); /* * Return an integer value like glGetIntegerv. * Input: pname - * OSMESA_WIDTH return current image width * OSMESA_HEIGHT return current image height * OSMESA_FORMAT return image format * OSMESA_TYPE return color component data type * OSMESA_ROW_LENGTH return row length in pixels * OSMESA_Y_UP returns 1 or 0 to indicate Y axis direction * value - pointer to integer in which to return result. */ GLAPI void GLAPIENTRY OSMesaGetIntegerv( GLint pname, GLint *value ); /* * Return the depth buffer associated with an OSMesa context. * Input: c - the OSMesa context * Output: width, height - size of buffer in pixels * bytesPerValue - bytes per depth value (2 or 4) * buffer - pointer to depth buffer values * Return: GL_TRUE or GL_FALSE to indicate success or failure. * * New in Mesa 2.4. */ GLAPI GLboolean GLAPIENTRY OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height, GLint *bytesPerValue, void **buffer ); /* * Return the color buffer associated with an OSMesa context. * Input: c - the OSMesa context * Output: width, height - size of buffer in pixels * format - buffer format (OSMESA_FORMAT) * buffer - pointer to depth buffer values * Return: GL_TRUE or GL_FALSE to indicate success or failure. * * New in Mesa 3.3. */ GLAPI GLboolean GLAPIENTRY OSMesaGetColorBuffer( OSMesaContext c, GLint *width, GLint *height, GLint *format, void **buffer ); /** * This typedef is new in Mesa 6.3. */ typedef void (*OSMESAproc)(); /* * Return pointer to the named function. * New in Mesa 4.1 * Return OSMESAproc in 6.3. */ GLAPI OSMESAproc GLAPIENTRY OSMesaGetProcAddress( const char *funcName ); /** * Enable/disable color clamping, off by default. * New in Mesa 6.4.2 */ GLAPI void GLAPIENTRY OSMesaColorClamp(GLboolean enable); #if defined(__BEOS__) || defined(__QUICKDRAW__) #pragma export off #endif #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/include/GL/xmesa.h0000644000000000000000000002424113614532424016717 0ustar /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Mesa/X11 interface. This header file serves as the documentation for * the Mesa/X11 interface functions. * * Note: this interface isn't intended for user programs. It's primarily * just for implementing the pseudo-GLX interface. */ /* Sample Usage: In addition to the usual X calls to select a visual, create a colormap and create a window, you must do the following to use the X/Mesa interface: 1. Call XMesaCreateVisual() to make an XMesaVisual from an XVisualInfo. 2. Call XMesaCreateContext() to create an X/Mesa rendering context, given the XMesaVisual. 3. Call XMesaCreateWindowBuffer() to create an XMesaBuffer from an X window and XMesaVisual. 4. Call XMesaMakeCurrent() to bind the XMesaBuffer to an XMesaContext and to make the context the current one. 5. Make gl* calls to render your graphics. 6. Use XMesaSwapBuffers() when double buffering to swap front/back buffers. 7. Before the X window is destroyed, call XMesaDestroyBuffer(). 8. Before exiting, call XMesaDestroyVisual and XMesaDestroyContext. */ #ifndef XMESA_H #define XMESA_H #ifdef __VMS #include #endif #ifdef __cplusplus extern "C" { #endif #ifdef XFree86Server #include "xmesa_xf86.h" #else #include #include #include "xmesa_x.h" #endif #include "GL/gl.h" #ifdef AMIWIN #include extern struct Library *XLibBase; #endif #define XMESA_MAJOR_VERSION 6 #define XMESA_MINOR_VERSION 3 /* * Values passed to XMesaGetString: */ #define XMESA_VERSION 1 #define XMESA_EXTENSIONS 2 /* * Values passed to XMesaSetFXmode: */ #define XMESA_FX_WINDOW 1 #define XMESA_FX_FULLSCREEN 2 typedef struct xmesa_context *XMesaContext; typedef struct xmesa_visual *XMesaVisual; typedef struct xmesa_buffer *XMesaBuffer; /* * Create a new X/Mesa visual. * Input: display - X11 display * visinfo - an XVisualInfo pointer * rgb_flag - GL_TRUE = RGB mode, * GL_FALSE = color index mode * alpha_flag - alpha buffer requested? * db_flag - GL_TRUE = double-buffered, * GL_FALSE = single buffered * stereo_flag - stereo visual? * ximage_flag - GL_TRUE = use an XImage for back buffer, * GL_FALSE = use an off-screen pixmap for back buffer * depth_size - requested bits/depth values, or zero * stencil_size - requested bits/stencil values, or zero * accum_red_size - requested bits/red accum values, or zero * accum_green_size - requested bits/green accum values, or zero * accum_blue_size - requested bits/blue accum values, or zero * accum_alpha_size - requested bits/alpha accum values, or zero * num_samples - number of samples/pixel if multisampling, or zero * level - visual level, usually 0 * visualCaveat - ala the GLX extension, usually GLX_NONE_EXT * Return; a new XMesaVisual or 0 if error. */ extern XMesaVisual XMesaCreateVisual( XMesaDisplay *display, XMesaVisualInfo visinfo, GLboolean rgb_flag, GLboolean alpha_flag, GLboolean db_flag, GLboolean stereo_flag, GLboolean ximage_flag, GLint depth_size, GLint stencil_size, GLint accum_red_size, GLint accum_green_size, GLint accum_blue_size, GLint accum_alpha_size, GLint num_samples, GLint level, GLint visualCaveat ); /* * Destroy an XMesaVisual, but not the associated XVisualInfo. */ extern void XMesaDestroyVisual( XMesaVisual v ); /* * Create a new XMesaContext for rendering into an X11 window. * * Input: visual - an XMesaVisual * share_list - another XMesaContext with which to share display * lists or NULL if no sharing is wanted. * Return: an XMesaContext or NULL if error. */ extern XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ); /* * Destroy a rendering context as returned by XMesaCreateContext() */ extern void XMesaDestroyContext( XMesaContext c ); /* * Create an XMesaBuffer from an X window. */ extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v, XMesaWindow w ); /* * Create an XMesaBuffer from an X pixmap. */ extern XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, XMesaPixmap p, XMesaColormap cmap ); /* * Destroy an XMesaBuffer, but not the corresponding window or pixmap. */ extern void XMesaDestroyBuffer( XMesaBuffer b ); /* * Return the XMesaBuffer handle which corresponds to an X drawable, if any. * * New in Mesa 2.3. */ extern XMesaBuffer XMesaFindBuffer( XMesaDisplay *dpy, XMesaDrawable d ); /* * Bind a buffer to a context and make the context the current one. */ extern GLboolean XMesaMakeCurrent( XMesaContext c, XMesaBuffer b ); /* * Bind two buffers (read and draw) to a context and make the * context the current one. * New in Mesa 3.3 */ extern GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, XMesaBuffer readBuffer ); /* * Unbind the current context from its buffer. */ extern GLboolean XMesaUnbindContext( XMesaContext c ); /* * Return a handle to the current context. */ extern XMesaContext XMesaGetCurrentContext( void ); /* * Return handle to the current (draw) buffer. */ extern XMesaBuffer XMesaGetCurrentBuffer( void ); /* * Return handle to the current read buffer. * New in Mesa 3.3 */ extern XMesaBuffer XMesaGetCurrentReadBuffer( void ); /* * Swap the front and back buffers for the given buffer. No action is * taken if the buffer is not double buffered. */ extern void XMesaSwapBuffers( XMesaBuffer b ); /* * Copy a sub-region of the back buffer to the front buffer. * * New in Mesa 2.6 */ extern void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height ); /* * Return a pointer to the the Pixmap or XImage being used as the back * color buffer of an XMesaBuffer. This function is a way to get "under * the hood" of X/Mesa so one can manipulate the back buffer directly. * Input: b - the XMesaBuffer * Output: pixmap - pointer to back buffer's Pixmap, or 0 * ximage - pointer to back buffer's XImage, or NULL * Return: GL_TRUE = context is double buffered * GL_FALSE = context is single buffered */ extern GLboolean XMesaGetBackBuffer( XMesaBuffer b, XMesaPixmap *pixmap, XMesaImage **ximage ); /* * Return the depth buffer associated with an XMesaBuffer. * Input: b - the XMesa buffer handle * Output: width, height - size of buffer in pixels * bytesPerValue - bytes per depth value (2 or 4) * buffer - pointer to depth buffer values * Return: GL_TRUE or GL_FALSE to indicate success or failure. * * New in Mesa 2.4. */ extern GLboolean XMesaGetDepthBuffer( XMesaBuffer b, GLint *width, GLint *height, GLint *bytesPerValue, void **buffer ); /* * Flush/sync a context */ extern void XMesaFlush( XMesaContext c ); /* * Get an X/Mesa-specific string. * Input: name - either XMESA_VERSION or XMESA_EXTENSIONS */ extern const char *XMesaGetString( XMesaContext c, int name ); /* * Scan for XMesaBuffers whose window/pixmap has been destroyed, then free * any memory used by that buffer. * * New in Mesa 2.3. */ extern void XMesaGarbageCollect( void ); /* * Return a dithered pixel value. * Input: c - XMesaContext * x, y - window coordinate * red, green, blue, alpha - color components in [0,1] * Return: pixel value * * New in Mesa 2.3. */ extern unsigned long XMesaDitherColor( XMesaContext xmesa, GLint x, GLint y, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); /* * 3Dfx Glide driver only! * Set 3Dfx/Glide full-screen or window rendering mode. * Input: mode - either XMESA_FX_WINDOW (window rendering mode) or * XMESA_FX_FULLSCREEN (full-screen rendering mode) * Return: GL_TRUE if success * GL_FALSE if invalid mode or if not using 3Dfx driver * * New in Mesa 2.6. */ extern GLboolean XMesaSetFXmode( GLint mode ); /* * Reallocate the back/depth/stencil/accum/etc/ buffers associated with * buffer if its size has changed. * * New in Mesa 4.0.2 */ extern void XMesaResizeBuffers( XMesaBuffer b ); /* * Create a pbuffer. * New in Mesa 4.1 */ extern XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap, unsigned int width, unsigned int height); #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/include/GL/xmesa_xf86.h0000644000000000000000000001174013614532424017572 0ustar /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Kevin E. Martin * * When we're building the XMesa driver for use in the X server (as the * indirect render) we include this file when building the xm_*.c files. * We need to define some types and macros differently when building * in the Xserver vs. stand-alone Mesa. */ #ifndef _XMESA_XF86_H_ #define _XMESA_XF86_H_ #include "scrnintstr.h" #include "pixmapstr.h" typedef struct _XMesaImageRec XMesaImage; typedef ScreenRec XMesaDisplay; typedef PixmapPtr XMesaPixmap; typedef ColormapPtr XMesaColormap; typedef DrawablePtr XMesaDrawable; typedef WindowPtr XMesaWindow; typedef GCPtr XMesaGC; typedef VisualPtr XMesaVisualInfo; typedef DDXPointRec XMesaPoint; typedef xColorItem XMesaColor; #define XMesaSetGeneric(__d,__gc,__val,__mask) \ do { \ CARD32 __v[1]; \ (void) __d; \ __v[0] = __val; \ dixChangeGC(NullClient, __gc, __mask, __v, NULL); \ } while (0) #define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \ do { \ ChangeGCVal __v[1]; \ (void) __d; \ __v[0].ptr = __pval; \ dixChangeGC(NullClient, __gc, __mask, NULL, __v); \ } while (0) #define XMesaSetForeground(d,gc,v) XMesaSetGeneric(d,gc,v,GCForeground) #define XMesaSetBackground(d,gc,v) XMesaSetGeneric(d,gc,v,GCBackground) #define XMesaSetPlaneMask(d,gc,v) XMesaSetGeneric(d,gc,v,GCPlaneMask) #define XMesaSetFunction(d,gc,v) XMesaSetGeneric(d,gc,v,GCFunction) #define XMesaSetFillStyle(d,gc,v) XMesaSetGeneric(d,gc,v,GCFillStyle) #define XMesaSetTile(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCTile) #define XMesaDrawPoint(__d,__b,__gc,__x,__y) \ do { \ XMesaPoint __p[1]; \ (void) __d; \ __p[0].x = __x; \ __p[0].y = __y; \ ValidateGC(__b, __gc); \ (*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \ } while (0) #define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \ do { \ (void) __d; \ ValidateGC(__b, __gc); \ (*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \ } while (0) #define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \ do { \ xRectangle __r[1]; \ (void) __d; \ ValidateGC((DrawablePtr)__b, __gc); \ __r[0].x = __x; \ __r[0].y = __y; \ __r[0].width = __w; \ __r[0].height = __h; \ (*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \ } while (0) #define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \ do { \ /* Assumes: Images are always in ZPixmap format */ \ (void) __d; \ if (__sx || __sy) /* The non-trivial case */ \ XMesaPutImageHelper(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h); \ ValidateGC(__b, __gc); \ (*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \ __x, __y, __w, __h, 0, ZPixmap, \ ((XMesaImage *)(__i))->data); \ } while (0) #define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \ do { \ (void) __d; \ ValidateGC(__db, __gc); \ (*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \ __sx, __sy, __w, __h, __x, __y); \ } while (0) /* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */ #define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \ (*__d->CreatePixmap)(__d, __w, __h, __depth) #define XMesaFreePixmap(__d,__b) \ (*__d->DestroyPixmap)(__b) #define XMesaFreeGC(__d,__gc) \ do { \ (void) __d; \ FreeScratchGC(__gc); \ } while (0) #define GET_COLORMAP_SIZE(__v) __v->ColormapEntries #define GET_REDMASK(__v) __v->mesa_visual.redMask #define GET_GREENMASK(__v) __v->mesa_visual.greenMask #define GET_BLUEMASK(__v) __v->mesa_visual.blueMask #define GET_VISUAL_DEPTH(__v) __v->nplanes #define GET_BLACK_PIXEL(__v) __v->display->blackPixel #define CHECK_BYTE_ORDER(__v) GL_TRUE #define CHECK_FOR_HPCR(__v) GL_FALSE #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa.patches/4001_Fix-non-working-GLX-in-64bit-Xorg-7.0.patch0000644000000000000000000000351213614532424025012 0ustar From 44518d07398d663448d79e4f546736b40752630c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 16 Mar 2016 14:40:08 +0100 Subject: [PATCH] Fix non-working GLX in 64bit Xorg 7.0 Found the needed patch in debian bugtracker at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=364233 --- src/glx/x11/indirect_vertex_array.c | 2 +- src/mesa/drivers/dri/common/glcontextmodes.c | 3 +++ src/mesa/main/glheader.h | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) Index: Mesa/src/glx/x11/indirect_vertex_array.c =================================================================== --- Mesa.orig/src/glx/x11/indirect_vertex_array.c +++ Mesa/src/glx/x11/indirect_vertex_array.c @@ -530,7 +530,7 @@ static GLubyte * emit_DrawArrays_header_old( __GLXcontext * gc, struct array_state_vector * arrays, size_t * elements_per_request, - size_t * total_requests, + unsigned int * total_requests, GLenum mode, GLsizei count ) { size_t command_size; Index: Mesa/src/mesa/main/glheader.h =================================================================== --- Mesa.orig/src/mesa/main/glheader.h +++ Mesa/src/mesa/main/glheader.h @@ -46,6 +46,9 @@ #ifndef GLHEADER_H #define GLHEADER_H +#ifdef HAVE_DIX_CONFIG_H +#include "dix-config.h" +#endif #if defined(XFree86LOADER) && defined(IN_MODULE) #include "xf86_ansic.h" Index: Mesa/src/mesa/drivers/dri/common/glcontextmodes.c =================================================================== --- Mesa.orig/src/mesa/drivers/dri/common/glcontextmodes.c +++ Mesa/src/mesa/drivers/dri/common/glcontextmodes.c @@ -39,6 +39,9 @@ # include "imports.h" # define __glXMemset memset #else +# if defined (HAVE_DIX_CONFIG_H) +# include +# endif # include # include # include "GL/glxint.h" nx-libs-3.5.99.23/nx-X11/extras/Mesa.patches/4002_no-special-glx-memfunctions.patch0000644000000000000000000000165613614532424024154 0ustar Description: Turn glx_ansic.h into a no-op include. (by using memset, malloc, free directly) Author: Mike Gabriel --- a/src/mesa/drivers/dri/common/glcontextmodes.c +++ b/src/mesa/drivers/dri/common/glcontextmodes.c @@ -44,16 +44,17 @@ # include "GL/glxint.h" # ifdef XFree86Server +# include +# include # include "GL/glx_ansic.h" -extern void * __glXMalloc( size_t size ); -extern void __glXFree( void * ptr ); -# define _mesa_malloc(b) __glXMalloc(b) -# define _mesa_free(m) __glXFree(m) +# define __glXMemset memset +# define _mesa_malloc(b) malloc(b) +# define _mesa_free(m) free(m) # else # include # define __glXMemset memset -# define _mesa_malloc(b) Xmalloc(b) -# define _mesa_free(m) Xfree(m) +# define _mesa_malloc(b) malloc(b) +# define _mesa_free(m) free(m) # endif /* XFree86Server */ #endif /* !defined(IN_MINI_GLX) */ nx-libs-3.5.99.23/nx-X11/extras/Mesa.patches/4003_CreatePixmap-AllocationHints.patch0000644000000000000000000000076713614532424024303 0ustar Index: Mesa/include/GL/xmesa_xf86.h =================================================================== --- Mesa.orig/include/GL/xmesa_xf86.h +++ Mesa/include/GL/xmesa_xf86.h @@ -130,7 +130,7 @@ do { \ /* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */ #define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \ - (*__d->CreatePixmap)(__d, __w, __h, __depth) + (*__d->CreatePixmap)(__d, __w, __h, __depth, 0) #define XMesaFreePixmap(__d,__b) \ (*__d->DestroyPixmap)(__b) nx-libs-3.5.99.23/nx-X11/extras/Mesa.patches/4004_define-USE_IEEE-macro-for-more-platforms.patch0000644000000000000000000000122413614532424026121 0ustar Author: Mike Gabriel Description: define USE_IEEE for __aarch64__ and __mc68000__, as well Index: Mesa/src/mesa/main/imports.h =================================================================== --- Mesa.orig/src/mesa/main/imports.h +++ Mesa/src/mesa/main/imports.h @@ -205,6 +205,8 @@ typedef union { GLfloat f; GLint i; } fi defined(__hppa__) || defined(hpux) || \ defined(__mips) || defined(_MIPS_ARCH) || \ defined(__arm__) || \ + defined(__aarch64__) || \ + defined(__mc68000__) || \ defined(__sh__) || \ (defined(__alpha__) && (defined(__IEEE_FLOAT) || !defined(VMS))) #define USE_IEEE nx-libs-3.5.99.23/nx-X11/extras/Mesa.patches/4005_adapt-all-libX11-include-paths-to-libNX_X11.patch0000644000000000000000000000375113614532424026344 0ustar Description: Assure that headers from libNX_X11 are always included from ${INCDIR}/nx-X11/. Author: Mike Gabriel Index: Mesa/include/GL/xmesa.h =================================================================== --- Mesa.orig/include/GL/xmesa.h +++ Mesa/include/GL/xmesa.h @@ -75,8 +75,8 @@ extern "C" { #ifdef XFree86Server #include "xmesa_xf86.h" #else -#include -#include +#include +#include #include "xmesa_x.h" #endif #include "GL/gl.h" Index: Mesa/src/mesa/drivers/dri/common/glcontextmodes.c =================================================================== --- Mesa.orig/src/mesa/drivers/dri/common/glcontextmodes.c +++ Mesa/src/mesa/drivers/dri/common/glcontextmodes.c @@ -39,7 +39,7 @@ # include "imports.h" # define __glXMemset memset #else -# include +# include # include # include "GL/glxint.h" @@ -49,7 +49,7 @@ # define _mesa_malloc(b) malloc(b) # define _mesa_free(m) free(m) # else -# include +# include # define __glXMemset memset # define _mesa_malloc(b) malloc(b) # define _mesa_free(m) free(m) Index: Mesa/src/mesa/drivers/x11/glxheader.h =================================================================== --- Mesa.orig/src/mesa/drivers/x11/glxheader.h +++ Mesa/src/mesa/drivers/x11/glxheader.h @@ -43,8 +43,8 @@ #else -# include -# include +# include +# include # ifdef USE_XSHM /* was SHM */ # include # include Index: Mesa/src/mesa/glapi/glthread.h =================================================================== --- Mesa.orig/src/mesa/glapi/glthread.h +++ Mesa/src/mesa/glapi/glthread.h @@ -180,7 +180,7 @@ typedef CRITICAL_SECTION _glthread_Mutex * We wrap it again for GL. */ #ifdef USE_XTHREADS -#include +#include typedef struct { xthread_key_t key; nx-libs-3.5.99.23/nx-X11/extras/Mesa.patches/5001_nasty-typo-fixes.patch0000644000000000000000000001145613614532424022067 0ustar Description: Some nasty typos fixed to silence lintian et al. Author: Mike Gabriel Index: Mesa/src/mesa/main/debug.c =================================================================== --- Mesa.orig/src/mesa/main/debug.c +++ Mesa/src/mesa/main/debug.c @@ -43,7 +43,7 @@ const char *_mesa_prim_name[GL_POLYGON+4 "GL_QUAD_STRIP", "GL_POLYGON", "outside begin/end", - "inside unkown primitive", + "inside unknown primitive", "unknown state" }; Index: Mesa/src/mesa/shader/arbprogparse.c =================================================================== --- Mesa.orig/src/mesa/shader/arbprogparse.c +++ Mesa/src/mesa/shader/arbprogparse.c @@ -97,8 +97,8 @@ * * Cosmetic Stuff * ----------------------------------------------------- - * - remove any leftover unused grammer.c stuff (dict_ ?) - * - fix grammer.c error handling so its not static + * - remove any leftover unused grammar.c stuff (dict_ ?) + * - fix grammar.c error handling so its not static * - #ifdef around stuff pertaining to extentions * * Outstanding Questions: @@ -1703,7 +1703,7 @@ parse_attrib (GLcontext * ctx, GLubyte * if (found) { error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) attrib_var->name) + 40); - _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + _mesa_sprintf (error_msg, "Duplicate Variable Declaration: %s", attrib_var->name); _mesa_set_program_error (ctx, Program->Position, error_msg); @@ -1904,7 +1904,7 @@ parse_param (GLcontext * ctx, GLubyte ** if (found) { error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) param_var->name) + 40); - _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + _mesa_sprintf (error_msg, "Duplicate Variable Declaration: %s", param_var->name); _mesa_set_program_error (ctx, Program->Position, error_msg); @@ -2013,7 +2013,7 @@ parse_temp (GLcontext * ctx, GLubyte ** if (found) { error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); - _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + _mesa_sprintf (error_msg, "Duplicate Variable Declaration: %s", temp_var->name); _mesa_set_program_error (ctx, Program->Position, error_msg); @@ -2064,7 +2064,7 @@ parse_output (GLcontext * ctx, GLubyte * char *error_msg; error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) output_var->name) + 40); - _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + _mesa_sprintf (error_msg, "Duplicate Variable Declaration: %s", output_var->name); _mesa_set_program_error (ctx, Program->Position, error_msg); @@ -2099,7 +2099,7 @@ parse_alias (GLcontext * ctx, GLubyte ** if (found) { error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); - _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + _mesa_sprintf (error_msg, "Duplicate Variable Declaration: %s", temp_var->name); _mesa_set_program_error (ctx, Program->Position, error_msg); @@ -2149,7 +2149,7 @@ parse_address (GLcontext * ctx, GLubyte if (found) { error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); - _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + _mesa_sprintf (error_msg, "Duplicate Variable Declaration: %s", temp_var->name); _mesa_set_program_error (ctx, Program->Position, error_msg); @@ -3980,7 +3980,7 @@ _mesa_parse_arb_program (GLcontext * ctx grammar_get_last_error ((GLubyte *) error_msg, 300, &error_pos); _mesa_set_program_error (ctx, error_pos, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, - "Error loading grammer rule set"); + "Error loading grammar rule set"); return GL_FALSE; } @@ -4070,7 +4070,7 @@ _mesa_parse_arb_program (GLcontext * ctx } #if DEBUG_PARSING - printf ("Destroying grammer dict [parse retval: %d]\n", err); + printf ("Destroying grammar dict [parse retval: %d]\n", err); #endif grammar_destroy (arbprogram_syn_id); @@ -4103,11 +4103,11 @@ _mesa_parse_arb_program (GLcontext * ctx /* Start examining the tokens in the array */ inst = parsed; - /* Check the grammer rev */ + /* Check the grammar rev */ if (*inst++ != REVISION) { _mesa_set_program_error (ctx, 0, "Grammar version mismatch"); _mesa_error(ctx, GL_INVALID_OPERATION, - "glProgramStringARB(Grammar verison mismatch)"); + "glProgramStringARB(Grammar version mismatch)"); err = GL_TRUE; } else { nx-libs-3.5.99.23/nx-X11/extras/Mesa.patches/5002_silence-uninitialized.diff0000644000000000000000000000717513614532424022731 0ustar Silence compiler warnings about variables being "maybe uninitialized". --- Mesa.orig/src/mesa/swrast/s_triangle.c +++ Mesa/src/mesa/swrast/s_triangle.c @@ -534,7 +534,7 @@ #define T_SCALE theight #define SETUP_CODE \ - struct affine_info info; \ + struct affine_info info = {0}; \ struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ struct gl_texture_object *obj = unit->Current2D; \ const GLint b = obj->BaseLevel; \ @@ -806,7 +806,7 @@ #define INTERP_TEX 1 #define SETUP_CODE \ - struct persp_info info; \ + struct persp_info info = {0}; \ const struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ const struct gl_texture_object *obj = unit->Current2D; \ const GLint b = obj->BaseLevel; \ --- Mesa.orig/src/mesa/swrast/s_tritemp.h +++ Mesa/src/mesa/swrast/s_tritemp.h @@ -201,7 +201,7 @@ #endif GLinterp vMin_fx, vMin_fy, vMid_fx, vMid_fy, vMax_fx, vMax_fy; - struct sw_span span; + struct sw_span span = {0}; INIT_SPAN(span, GL_POLYGON, 0, 0, 0); @@ -741,14 +741,14 @@ GLfixed tLeft=0, dtOuter=0, dtInner; #endif #ifdef INTERP_TEX - GLfloat sLeft[MAX_TEXTURE_COORD_UNITS]; - GLfloat tLeft[MAX_TEXTURE_COORD_UNITS]; - GLfloat uLeft[MAX_TEXTURE_COORD_UNITS]; - GLfloat vLeft[MAX_TEXTURE_COORD_UNITS]; - GLfloat dsOuter[MAX_TEXTURE_COORD_UNITS], dsInner[MAX_TEXTURE_COORD_UNITS]; - GLfloat dtOuter[MAX_TEXTURE_COORD_UNITS], dtInner[MAX_TEXTURE_COORD_UNITS]; - GLfloat duOuter[MAX_TEXTURE_COORD_UNITS], duInner[MAX_TEXTURE_COORD_UNITS]; - GLfloat dvOuter[MAX_TEXTURE_COORD_UNITS], dvInner[MAX_TEXTURE_COORD_UNITS]; + GLfloat sLeft[MAX_TEXTURE_COORD_UNITS] = {0}; + GLfloat tLeft[MAX_TEXTURE_COORD_UNITS] = {0}; + GLfloat uLeft[MAX_TEXTURE_COORD_UNITS] = {0}; + GLfloat vLeft[MAX_TEXTURE_COORD_UNITS] = {0}; + GLfloat dsOuter[MAX_TEXTURE_COORD_UNITS] = {0}, dsInner[MAX_TEXTURE_COORD_UNITS] = {0}; + GLfloat dtOuter[MAX_TEXTURE_COORD_UNITS] = {0}, dtInner[MAX_TEXTURE_COORD_UNITS] = {0}; + GLfloat duOuter[MAX_TEXTURE_COORD_UNITS] = {0}, duInner[MAX_TEXTURE_COORD_UNITS] = {0}; + GLfloat dvOuter[MAX_TEXTURE_COORD_UNITS] = {0}, dvInner[MAX_TEXTURE_COORD_UNITS] = {0}; #endif for (subTriangle=0; subTriangle<=1; subTriangle++) { --- Mesa.orig/src/mesa/swrast_setup/ss_tritmp.h +++ Mesa/src/mesa/swrast_setup/ss_tritmp.h @@ -30,14 +30,14 @@ { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; - SWvertex *v[3]; - GLfloat z[3]; + SWvertex *v[3] = {0};; + GLfloat z[3] = {0};; GLfloat offset; GLenum mode = GL_FILL; GLuint facing = 0; - GLchan saved_color[3][4]; - GLchan saved_spec[3][4]; - GLfloat saved_index[3]; + GLchan saved_color[3][4] = {0}; + GLchan saved_spec[3][4] = {0}; + GLfloat saved_index[3] = {0};; v[0] = &verts[e0]; v[1] = &verts[e1]; --- Mesa.orig/src/mesa/swrast_setup/ss_triangle.c +++ Mesa/src/mesa/swrast_setup/ss_triangle.c @@ -56,9 +56,9 @@ SWvertex *v0 = &verts[e0]; SWvertex *v1 = &verts[e1]; SWvertex *v2 = &verts[e2]; - GLchan c[2][4]; - GLchan s[2][4]; - GLfloat i[2]; + GLchan c[2][4] = {0}; + GLchan s[2][4] = {0}; + GLfloat i[2] = {0}; /* cull testing */ if (ctx->Polygon.CullFlag) { @@ -115,9 +115,9 @@ SWvertex *v0 = &verts[e0]; SWvertex *v1 = &verts[e1]; SWvertex *v2 = &verts[e2]; - GLchan c[2][4]; - GLchan s[2][4]; - GLfloat i[2]; + GLchan c[2][4] = {0}; + GLchan s[2][4] = {0}; + GLfloat i[2] = {0}; /* cull testing */ if (ctx->Polygon.CullFlag) { nx-libs-3.5.99.23/nx-X11/extras/Mesa.patches/series0000644000000000000000000000045013614532424016343 0ustar #4001_Fix-non-working-GLX-in-64bit-Xorg-7.0.patch 4002_no-special-glx-memfunctions.patch 4003_CreatePixmap-AllocationHints.patch 4004_define-USE_IEEE-macro-for-more-platforms.patch 5001_nasty-typo-fixes.patch 4005_adapt-all-libX11-include-paths-to-libNX_X11.patch 5002_silence-uninitialized.diff nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/glx/x11/compsize.c0000644000000000000000000001362313614532424017475 0ustar /* $XFree86: xc/lib/GL/glx/compsize.c,v 1.6 2004/01/28 18:11:38 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #include #include "indirect_size.h" /* ** Return the number of elements per group of a specified format */ GLint __glElementsPerGroup(GLenum format, GLenum type) { /* ** To make row length computation valid for image extraction, ** packed pixel types assume elements per group equals one. */ switch(type) { case GL_UNSIGNED_BYTE_3_3_2: case GL_UNSIGNED_BYTE_2_3_3_REV: case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL_UNSIGNED_SHORT_8_8_APPLE: case GL_UNSIGNED_SHORT_8_8_REV_APPLE: case GL_UNSIGNED_SHORT_15_1_MESA: case GL_UNSIGNED_SHORT_1_15_REV_MESA: case GL_UNSIGNED_INT_8_8_8_8: case GL_UNSIGNED_INT_8_8_8_8_REV: case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: case GL_UNSIGNED_INT_24_8_NV: case GL_UNSIGNED_INT_24_8_MESA: case GL_UNSIGNED_INT_8_24_REV_MESA: return 1; default: break; } switch(format) { case GL_RGB: case GL_BGR: return 3; case GL_422_EXT: case GL_422_REV_EXT: case GL_422_AVERAGE_EXT: case GL_422_REV_AVERAGE_EXT: case GL_YCBCR_422_APPLE: case GL_LUMINANCE_ALPHA: return 2; case GL_RGBA: case GL_BGRA: case GL_ABGR_EXT: return 4; case GL_COLOR_INDEX: case GL_STENCIL_INDEX: case GL_DEPTH_COMPONENT: case GL_RED: case GL_GREEN: case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: case GL_INTENSITY: return 1; default: return 0; } } /* ** Return the number of bytes per element, based on the element type (other ** than GL_BITMAP). */ GLint __glBytesPerElement(GLenum type) { switch(type) { case GL_UNSIGNED_SHORT: case GL_SHORT: case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL_UNSIGNED_SHORT_8_8_APPLE: case GL_UNSIGNED_SHORT_8_8_REV_APPLE: case GL_UNSIGNED_SHORT_15_1_MESA: case GL_UNSIGNED_SHORT_1_15_REV_MESA: return 2; case GL_UNSIGNED_BYTE: case GL_BYTE: case GL_UNSIGNED_BYTE_3_3_2: case GL_UNSIGNED_BYTE_2_3_3_REV: return 1; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: case GL_UNSIGNED_INT_8_8_8_8: case GL_UNSIGNED_INT_8_8_8_8_REV: case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: case GL_UNSIGNED_INT_24_8_NV: case GL_UNSIGNED_INT_24_8_MESA: case GL_UNSIGNED_INT_8_24_REV_MESA: return 4; default: return 0; } } /* ** Compute memory required for internal packed array of data of given type ** and format. */ GLint __glImageSize(GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLenum target) { int bytes_per_row; int components; switch( target ) { case GL_PROXY_TEXTURE_1D: case GL_PROXY_TEXTURE_2D: case GL_PROXY_TEXTURE_3D: case GL_PROXY_TEXTURE_4D_SGIS: case GL_PROXY_TEXTURE_CUBE_MAP: case GL_PROXY_TEXTURE_RECTANGLE_ARB: case GL_PROXY_HISTOGRAM: case GL_PROXY_COLOR_TABLE: case GL_PROXY_TEXTURE_COLOR_TABLE_SGI: case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: case GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP: return 0; } if (width < 0 || height < 0 || depth < 0) { return 0; } /* ** Zero is returned if either format or type are invalid. */ components = __glElementsPerGroup(format,type); if (type == GL_BITMAP) { if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) { bytes_per_row = (width + 7) >> 3; } else { return 0; } } else { bytes_per_row = __glBytesPerElement(type) * width; } return bytes_per_row * height * depth * components; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/glx/x11/indirect_size.c0000644000000000000000000002416413614532424020501 0ustar /* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ /* * (C) Copyright IBM Corporation 2004 * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sub license, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include #include "indirect_size.h" # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) # define PURE __attribute__((pure)) # else # define PURE # endif # if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) # define FASTCALL __attribute__((fastcall)) # else # define FASTCALL # endif # if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) # define INTERNAL __attribute__((visibility("internal"))) # else # define INTERNAL # endif #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__) # undef HAVE_ALIAS #endif #ifdef HAVE_ALIAS # define ALIAS2(from,to) \ INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \ __attribute__ ((alias( # to ))); # define ALIAS(from,to) ALIAS2( from, __gl ## to ## _size ) #else # define ALIAS(from,to) \ INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \ { return __gl ## to ## _size( e ); } #endif INTERNAL PURE FASTCALL GLint __glCallLists_size( GLenum e ) { switch( e ) { case GL_BYTE: case GL_UNSIGNED_BYTE: return 1; case GL_SHORT: case GL_UNSIGNED_SHORT: case GL_2_BYTES: return 2; case GL_3_BYTES: return 3; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: case GL_4_BYTES: return 4; default: return 0; } } INTERNAL PURE FASTCALL GLint __glFogfv_size( GLenum e ) { switch( e ) { case GL_FOG_INDEX: case GL_FOG_DENSITY: case GL_FOG_START: case GL_FOG_END: case GL_FOG_MODE: case GL_FOG_OFFSET_VALUE_SGIX: case GL_FOG_DISTANCE_MODE_NV: return 1; case GL_FOG_COLOR: return 4; default: return 0; } } INTERNAL PURE FASTCALL GLint __glLightfv_size( GLenum e ) { switch( e ) { case GL_SPOT_EXPONENT: case GL_SPOT_CUTOFF: case GL_CONSTANT_ATTENUATION: case GL_LINEAR_ATTENUATION: case GL_QUADRATIC_ATTENUATION: return 1; case GL_SPOT_DIRECTION: return 3; case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: case GL_POSITION: return 4; default: return 0; } } INTERNAL PURE FASTCALL GLint __glLightModelfv_size( GLenum e ) { switch( e ) { case GL_LIGHT_MODEL_LOCAL_VIEWER: case GL_LIGHT_MODEL_TWO_SIDE: case GL_LIGHT_MODEL_COLOR_CONTROL: /* case GL_LIGHT_MODEL_COLOR_CONTROL_EXT:*/ return 1; case GL_LIGHT_MODEL_AMBIENT: return 4; default: return 0; } } INTERNAL PURE FASTCALL GLint __glMaterialfv_size( GLenum e ) { switch( e ) { case GL_SHININESS: return 1; case GL_COLOR_INDEXES: return 3; case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: case GL_EMISSION: case GL_AMBIENT_AND_DIFFUSE: return 4; default: return 0; } } INTERNAL PURE FASTCALL GLint __glTexParameterfv_size( GLenum e ) { switch( e ) { case GL_TEXTURE_MAG_FILTER: case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: case GL_TEXTURE_PRIORITY: case GL_TEXTURE_WRAP_R: case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: /* case GL_SHADOW_AMBIENT_SGIX:*/ case GL_TEXTURE_MIN_LOD: case GL_TEXTURE_MAX_LOD: case GL_TEXTURE_BASE_LEVEL: case GL_TEXTURE_MAX_LEVEL: case GL_TEXTURE_CLIPMAP_FRAME_SGIX: case GL_TEXTURE_LOD_BIAS_S_SGIX: case GL_TEXTURE_LOD_BIAS_T_SGIX: case GL_TEXTURE_LOD_BIAS_R_SGIX: case GL_GENERATE_MIPMAP: /* case GL_GENERATE_MIPMAP_SGIS:*/ case GL_TEXTURE_COMPARE_SGIX: case GL_TEXTURE_COMPARE_OPERATOR_SGIX: case GL_TEXTURE_MAX_CLAMP_S_SGIX: case GL_TEXTURE_MAX_CLAMP_T_SGIX: case GL_TEXTURE_MAX_CLAMP_R_SGIX: case GL_TEXTURE_MAX_ANISOTROPY_EXT: case GL_TEXTURE_LOD_BIAS: /* case GL_TEXTURE_LOD_BIAS_EXT:*/ case GL_DEPTH_TEXTURE_MODE: /* case GL_DEPTH_TEXTURE_MODE_ARB:*/ case GL_TEXTURE_COMPARE_MODE: /* case GL_TEXTURE_COMPARE_MODE_ARB:*/ case GL_TEXTURE_COMPARE_FUNC: /* case GL_TEXTURE_COMPARE_FUNC_ARB:*/ case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV: return 1; case GL_TEXTURE_CLIPMAP_CENTER_SGIX: case GL_TEXTURE_CLIPMAP_OFFSET_SGIX: return 2; case GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX: return 3; case GL_TEXTURE_BORDER_COLOR: case GL_POST_TEXTURE_FILTER_BIAS_SGIX: case GL_POST_TEXTURE_FILTER_SCALE_SGIX: return 4; default: return 0; } } INTERNAL PURE FASTCALL GLint __glTexEnvfv_size( GLenum e ) { switch( e ) { case GL_ALPHA_SCALE: case GL_TEXTURE_ENV_MODE: case GL_TEXTURE_LOD_BIAS: case GL_COMBINE_RGB: case GL_COMBINE_ALPHA: case GL_RGB_SCALE: case GL_SOURCE0_RGB: case GL_SOURCE1_RGB: case GL_SOURCE2_RGB: case GL_SOURCE3_RGB_NV: case GL_SOURCE0_ALPHA: case GL_SOURCE1_ALPHA: case GL_SOURCE2_ALPHA: case GL_SOURCE3_ALPHA_NV: case GL_OPERAND0_RGB: case GL_OPERAND1_RGB: case GL_OPERAND2_RGB: case GL_OPERAND3_RGB_NV: case GL_OPERAND0_ALPHA: case GL_OPERAND1_ALPHA: case GL_OPERAND2_ALPHA: case GL_OPERAND3_ALPHA_NV: case GL_COORD_REPLACE_ARB: /* case GL_COORD_REPLACE_NV:*/ return 1; case GL_TEXTURE_ENV_COLOR: return 4; default: return 0; } } INTERNAL PURE FASTCALL GLint __glTexGendv_size( GLenum e ) { switch( e ) { case GL_TEXTURE_GEN_MODE: return 1; case GL_OBJECT_PLANE: case GL_EYE_PLANE: return 4; default: return 0; } } INTERNAL PURE FASTCALL GLint __glMap1d_size( GLenum e ) { switch( e ) { case GL_MAP1_INDEX: case GL_MAP1_TEXTURE_COORD_1: return 1; case GL_MAP1_TEXTURE_COORD_2: return 2; case GL_MAP1_NORMAL: case GL_MAP1_TEXTURE_COORD_3: case GL_MAP1_VERTEX_3: return 3; case GL_MAP1_COLOR_4: case GL_MAP1_TEXTURE_COORD_4: case GL_MAP1_VERTEX_4: return 4; default: return 0; } } INTERNAL PURE FASTCALL GLint __glMap2d_size( GLenum e ) { switch( e ) { case GL_MAP2_INDEX: case GL_MAP2_TEXTURE_COORD_1: return 1; case GL_MAP2_TEXTURE_COORD_2: return 2; case GL_MAP2_NORMAL: case GL_MAP2_TEXTURE_COORD_3: case GL_MAP2_VERTEX_3: return 3; case GL_MAP2_COLOR_4: case GL_MAP2_TEXTURE_COORD_4: case GL_MAP2_VERTEX_4: return 4; default: return 0; } } INTERNAL PURE FASTCALL GLint __glColorTableParameterfv_size( GLenum e ) { switch( e ) { case GL_COLOR_TABLE_SCALE: case GL_COLOR_TABLE_BIAS: return 4; default: return 0; } } INTERNAL PURE FASTCALL GLint __glConvolutionParameterfv_size( GLenum e ) { switch( e ) { case GL_CONVOLUTION_BORDER_MODE: /* case GL_CONVOLUTION_BORDER_MODE_EXT:*/ return 1; case GL_CONVOLUTION_FILTER_SCALE: /* case GL_CONVOLUTION_FILTER_SCALE_EXT:*/ case GL_CONVOLUTION_FILTER_BIAS: /* case GL_CONVOLUTION_FILTER_BIAS_EXT:*/ case GL_CONVOLUTION_BORDER_COLOR: /* case GL_CONVOLUTION_BORDER_COLOR_HP:*/ return 4; default: return 0; } } INTERNAL PURE FASTCALL GLint __glPointParameterfvEXT_size( GLenum e ) { switch( e ) { case GL_POINT_SIZE_MIN: /* case GL_POINT_SIZE_MIN_ARB:*/ /* case GL_POINT_SIZE_MIN_SGIS:*/ case GL_POINT_SIZE_MAX: /* case GL_POINT_SIZE_MAX_ARB:*/ /* case GL_POINT_SIZE_MAX_SGIS:*/ case GL_POINT_FADE_THRESHOLD_SIZE: /* case GL_POINT_FADE_THRESHOLD_SIZE_ARB:*/ /* case GL_POINT_FADE_THRESHOLD_SIZE_SGIS:*/ case GL_POINT_SPRITE_R_MODE_NV: case GL_POINT_SPRITE_COORD_ORIGIN: return 1; case GL_POINT_DISTANCE_ATTENUATION: /* case GL_POINT_DISTANCE_ATTENUATION_ARB:*/ /* case GL_POINT_DISTANCE_ATTENUATION_SGIS:*/ return 3; default: return 0; } } ALIAS( Fogiv, Fogfv ) ALIAS( Lightiv, Lightfv ) ALIAS( LightModeliv, LightModelfv ) ALIAS( Materialiv, Materialfv ) ALIAS( TexParameteriv, TexParameterfv ) ALIAS( TexEnviv, TexEnvfv ) ALIAS( TexGenfv, TexGendv ) ALIAS( TexGeniv, TexGendv ) ALIAS( Map1f, Map1d ) ALIAS( Map2f, Map2d ) ALIAS( ColorTableParameteriv, ColorTableParameterfv ) ALIAS( ConvolutionParameteriv, ConvolutionParameterfv ) ALIAS( PointParameterivNV, PointParameterfvEXT ) # undef PURE # undef FASTCALL # undef INTERNAL nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/glx/x11/indirect_size.h0000644000000000000000000000736313614532424020510 0ustar /* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ /* * (C) Copyright IBM Corporation 2004 * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sub license, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #if !defined( _INDIRECT_SIZE_H_ ) # define _INDIRECT_SIZE_H_ /** * \file * Prototypes for functions used to determine the number of data elements in * various GLX protocol messages. * * \author Ian Romanick */ # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) # define PURE __attribute__((pure)) # else # define PURE # endif # if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) # define FASTCALL __attribute__((fastcall)) # else # define FASTCALL # endif # if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) # define INTERNAL __attribute__((visibility("internal"))) # else # define INTERNAL # endif extern INTERNAL PURE FASTCALL GLint __glCallLists_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glFogfv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glFogiv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glLightfv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glLightiv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glLightModelfv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glLightModeliv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glMaterialfv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glMaterialiv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glTexParameterfv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glTexParameteriv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glTexEnvfv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glTexEnviv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glTexGendv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glTexGenfv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glTexGeniv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glMap1d_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glMap1f_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glMap2d_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glMap2f_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glColorTableParameterfv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glColorTableParameteriv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glConvolutionParameterfv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glConvolutionParameteriv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glPointParameterfvEXT_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glPointParameterivNV_size(GLenum); # undef PURE # undef FASTCALL # undef INTERNAL #endif /* !defined( _INDIRECT_SIZE_H_ ) */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/array_cache/acache.h0000644000000000000000000000703413614532424021037 0ustar /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #ifndef _ARRAYCACHE_H #define _ARRAYCACHE_H #include "mtypes.h" extern GLboolean _ac_CreateContext( GLcontext *ctx ); extern void _ac_DestroyContext( GLcontext *ctx ); extern void _ac_InvalidateState( GLcontext *ctx, GLuint new_state ); extern struct gl_client_array * _ac_import_vertex( GLcontext *ctx, GLenum type, GLuint reqstride, GLuint reqsize, GLboolean reqwritable, GLboolean *writable ); extern struct gl_client_array * _ac_import_normal( GLcontext *ctx, GLenum type, GLuint reqstride, GLboolean reqwritable, GLboolean *writable ); extern struct gl_client_array * _ac_import_color( GLcontext *ctx, GLenum type, GLuint reqstride, GLuint reqsize, GLboolean reqwritable, GLboolean *writable ); extern struct gl_client_array * _ac_import_index( GLcontext *ctx, GLenum type, GLuint reqstride, GLboolean reqwritable, GLboolean *writable ); extern struct gl_client_array * _ac_import_secondarycolor( GLcontext *ctx, GLenum type, GLuint reqstride, GLuint reqsize, GLboolean reqwritable, GLboolean *writable ); extern struct gl_client_array * _ac_import_fogcoord( GLcontext *ctx, GLenum type, GLuint reqstride, GLboolean reqwritable, GLboolean *writable ); extern struct gl_client_array * _ac_import_edgeflag( GLcontext *ctx, GLenum type, GLuint reqstride, GLboolean reqwritable, GLboolean *writable ); extern struct gl_client_array * _ac_import_texcoord( GLcontext *ctx, GLuint unit, GLenum type, GLuint reqstride, GLuint reqsize, GLboolean reqwritable, GLboolean *writable ); extern struct gl_client_array * _ac_import_attrib( GLcontext *ctx, GLuint index, GLenum type, GLuint reqstride, GLuint reqsize, GLboolean reqwritable, GLboolean *writable ); /* Clients must call this function to validate state and set bounds * before importing any data: */ extern void _ac_import_range( GLcontext *ctx, GLuint start, GLuint count ); /* Additional convenience function: */ extern CONST void * _ac_import_elements( GLcontext *ctx, GLenum new_type, GLuint count, GLenum old_type, CONST void *indices ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/array_cache/ac_context.c0000644000000000000000000002526013614532424021756 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "macros.h" #include "imports.h" #include "mtypes.h" #include "array_cache/ac_context.h" /* * Initialize the array fallbacks. That is, by default the fallback arrays * point into the current vertex attribute values in ctx->Current.Attrib[] */ static void _ac_fallbacks_init( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); struct gl_client_array *cl; GLuint i; cl = &ac->Fallback.Normal; cl->Size = 3; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 0; cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif cl = &ac->Fallback.Color; cl->Size = 4; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 0; cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif cl = &ac->Fallback.SecondaryColor; cl->Size = 3; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 0; cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif cl = &ac->Fallback.FogCoord; cl->Size = 1; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 0; cl->Ptr = (GLubyte *) &ctx->Current.Attrib[VERT_ATTRIB_FOG]; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif cl = &ac->Fallback.Index; cl->Size = 1; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 0; cl->Ptr = (GLubyte *) &ctx->Current.Index; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++) { cl = &ac->Fallback.TexCoord[i]; cl->Size = 4; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 0; cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i]; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif } cl = &ac->Fallback.EdgeFlag; cl->Size = 1; cl->Type = GL_UNSIGNED_BYTE; cl->Stride = 0; cl->StrideB = 0; cl->Ptr = (GLubyte *) &ctx->Current.EdgeFlag; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif for (i = 0; i < VERT_ATTRIB_MAX; i++) { cl = &ac->Fallback.Attrib[i]; cl->Size = 4; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 0; cl->Ptr = (GLubyte *) ctx->Current.Attrib[i]; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif } } /* * Initialize the array cache pointers, types, strides, etc. */ static void _ac_cache_init( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); struct gl_client_array *cl; GLuint size = ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES; GLuint i; cl = &ac->Cache.Vertex; cl->Size = 4; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 4 * sizeof(GLfloat); cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); cl->Enabled = 1; cl->Flags = 0; #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif cl = &ac->Cache.Normal; cl->Size = 3; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 3 * sizeof(GLfloat); cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); cl->Enabled = 1; cl->Flags = 0; #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif cl = &ac->Cache.Color; cl->Size = 4; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 4 * sizeof(GLfloat); cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); cl->Enabled = 1; cl->Flags = 0; #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif cl = &ac->Cache.SecondaryColor; cl->Size = 3; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 4 * sizeof(GLfloat); cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); cl->Enabled = 1; cl->Flags = 0; #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif cl = &ac->Cache.FogCoord; cl->Size = 1; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = sizeof(GLfloat); cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); cl->Enabled = 1; cl->Flags = 0; #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif cl = &ac->Cache.Index; cl->Size = 1; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = sizeof(GLfloat); cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); cl->Enabled = 1; cl->Flags = 0; #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { cl = &ac->Cache.TexCoord[i]; cl->Size = 4; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 4 * sizeof(GLfloat); cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); cl->Enabled = 1; cl->Flags = 0; #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif } cl = &ac->Cache.EdgeFlag; cl->Size = 1; cl->Type = GL_UNSIGNED_BYTE; cl->Stride = 0; cl->StrideB = sizeof(GLubyte); cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); cl->Enabled = 1; cl->Flags = 0; #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif for (i = 0 ; i < VERT_ATTRIB_MAX; i++) { cl = &ac->Cache.Attrib[i]; cl->Size = 4; cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 4 * sizeof(GLfloat); cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size ); cl->Enabled = 1; cl->Flags = 0; #if FEATURE_ARB_vertex_buffer_object cl->BufferObj = ctx->Array.NullBufferObj; #endif } } /* This storage used to hold translated client data if type or stride * need to be fixed. */ static void _ac_elts_init( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); GLuint size = 1000; ac->Elts = (GLuint *)MALLOC( sizeof(GLuint) * size ); ac->elt_size = size; } static void _ac_raw_init( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); GLuint i; ac->Raw.Color = ac->Fallback.Color; ac->Raw.EdgeFlag = ac->Fallback.EdgeFlag; ac->Raw.FogCoord = ac->Fallback.FogCoord; ac->Raw.Index = ac->Fallback.Index; ac->Raw.Normal = ac->Fallback.Normal; ac->Raw.SecondaryColor = ac->Fallback.SecondaryColor; ac->Raw.Vertex = ctx->Array.Vertex; ac->IsCached.Color = GL_FALSE; ac->IsCached.EdgeFlag = GL_FALSE; ac->IsCached.FogCoord = GL_FALSE; ac->IsCached.Index = GL_FALSE; ac->IsCached.Normal = GL_FALSE; ac->IsCached.SecondaryColor = GL_FALSE; ac->IsCached.Vertex = GL_FALSE; for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++) { ac->Raw.TexCoord[i] = ac->Fallback.TexCoord[i]; ac->IsCached.TexCoord[i] = GL_FALSE; } for (i = 0 ; i < VERT_ATTRIB_MAX ; i++) { ac->Raw.Attrib[i] = ac->Fallback.Attrib[i]; ac->IsCached.Attrib[i] = GL_FALSE; } } GLboolean _ac_CreateContext( GLcontext *ctx ) { ctx->acache_context = CALLOC(sizeof(ACcontext)); if (ctx->acache_context) { _ac_cache_init( ctx ); _ac_fallbacks_init( ctx ); _ac_raw_init( ctx ); _ac_elts_init( ctx ); return GL_TRUE; } return GL_FALSE; } void _ac_DestroyContext( GLcontext *ctx ) { struct gl_buffer_object *nullObj = ctx->Array.NullBufferObj; ACcontext *ac = AC_CONTEXT(ctx); GLint i; /* only free vertex data if it's really a pointer to vertex data and * not an offset into a buffer object. */ if (ac->Cache.Vertex.Ptr && ac->Cache.Vertex.BufferObj == nullObj) FREE( (void *) ac->Cache.Vertex.Ptr ); if (ac->Cache.Normal.Ptr && ac->Cache.Normal.BufferObj == nullObj) FREE( (void *) ac->Cache.Normal.Ptr ); if (ac->Cache.Color.Ptr && ac->Cache.Color.BufferObj == nullObj) FREE( (void *) ac->Cache.Color.Ptr ); if (ac->Cache.SecondaryColor.Ptr && ac->Cache.SecondaryColor.BufferObj == nullObj) FREE( (void *) ac->Cache.SecondaryColor.Ptr ); if (ac->Cache.EdgeFlag.Ptr && ac->Cache.EdgeFlag.BufferObj == nullObj) FREE( (void *) ac->Cache.EdgeFlag.Ptr ); if (ac->Cache.Index.Ptr && ac->Cache.Index.BufferObj == nullObj) FREE( (void *) ac->Cache.Index.Ptr ); if (ac->Cache.FogCoord.Ptr && ac->Cache.FogCoord.BufferObj == nullObj) FREE( (void *) ac->Cache.FogCoord.Ptr ); for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { if (ac->Cache.TexCoord[i].Ptr && ac->Cache.TexCoord[i].BufferObj == nullObj) FREE( (void *) ac->Cache.TexCoord[i].Ptr ); } for (i = 0; i < VERT_ATTRIB_MAX; i++) { if (ac->Cache.Attrib[i].Ptr && ac->Cache.Attrib[i].BufferObj == nullObj) FREE( (void *) ac->Cache.Attrib[i].Ptr ); } if (ac->Elts) FREE( ac->Elts ); /* Free the context structure itself */ FREE(ac); ctx->acache_context = NULL; } void _ac_InvalidateState( GLcontext *ctx, GLuint new_state ) { AC_CONTEXT(ctx)->NewState |= new_state; AC_CONTEXT(ctx)->NewArrayState |= ctx->Array.NewState; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/array_cache/ac_context.h0000644000000000000000000000575713614532424021774 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #ifndef _AC_CONTEXT_H #define _AC_CONTEXT_H #include "glheader.h" #include "mtypes.h" #include "array_cache/acache.h" /* These are used to make the ctx->Current values look like * arrays (with zero StrideB). */ struct ac_arrays { struct gl_client_array Vertex; struct gl_client_array Normal; struct gl_client_array Color; struct gl_client_array SecondaryColor; struct gl_client_array FogCoord; struct gl_client_array Index; struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS]; struct gl_client_array EdgeFlag; struct gl_client_array Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */ }; struct ac_array_pointers { struct gl_client_array *Vertex; struct gl_client_array *Normal; struct gl_client_array *Color; struct gl_client_array *SecondaryColor; struct gl_client_array *FogCoord; struct gl_client_array *Index; struct gl_client_array *TexCoord[MAX_TEXTURE_COORD_UNITS]; struct gl_client_array *EdgeFlag; struct gl_client_array *Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */ }; struct ac_array_flags { GLboolean Vertex; GLboolean Normal; GLboolean Color; GLboolean SecondaryColor; GLboolean FogCoord; GLboolean Index; GLboolean TexCoord[MAX_TEXTURE_COORD_UNITS]; GLboolean EdgeFlag; GLboolean Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */ }; typedef struct { GLuint NewState; /* not needed? */ GLuint NewArrayState; /* Facility for importing and caching array data: */ struct ac_arrays Fallback; struct ac_arrays Cache; struct ac_arrays Raw; struct ac_array_flags IsCached; GLuint start; GLuint count; /* Facility for importing element lists: */ GLuint *Elts; GLuint elt_size; } ACcontext; #define AC_CONTEXT(ctx) ((ACcontext *)ctx->acache_context) #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/array_cache/ac_import.c0000644000000000000000000005470313614532424021610 0ustar /* * Mesa 3-D graphics library * Version: 6.4.2 * * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "macros.h" #include "imports.h" #include "mtypes.h" #include "math/m_translate.h" #include "array_cache/ac_context.h" #include "math/m_translate.h" #define STRIDE_ARRAY( array, offset ) \ do { \ GLubyte *tmp = ADD_POINTERS( (array).BufferObj->Data, (array).Ptr ) \ + (offset) * (array).StrideB; \ (array).Ptr = tmp; \ } while (0) /* Set the array pointer back to its source when the cached data is * invalidated: */ static void reset_texcoord( GLcontext *ctx, GLuint unit ) { ACcontext *ac = AC_CONTEXT(ctx); if (ctx->Array.TexCoord[unit].Enabled) { ac->Raw.TexCoord[unit] = ctx->Array.TexCoord[unit]; STRIDE_ARRAY(ac->Raw.TexCoord[unit], ac->start); } else { ac->Raw.TexCoord[unit] = ac->Fallback.TexCoord[unit]; if (ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3] != 1.0) ac->Raw.TexCoord[unit].Size = 4; else if (ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2] != 0.0) ac->Raw.TexCoord[unit].Size = 3; else ac->Raw.TexCoord[unit].Size = 2; } ac->IsCached.TexCoord[unit] = GL_FALSE; ac->NewArrayState &= ~_NEW_ARRAY_TEXCOORD(unit); } static void reset_vertex( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); ASSERT(ctx->Array.Vertex.Enabled || (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled)); ac->Raw.Vertex = ctx->Array.Vertex; STRIDE_ARRAY(ac->Raw.Vertex, ac->start); ac->IsCached.Vertex = GL_FALSE; ac->NewArrayState &= ~_NEW_ARRAY_VERTEX; } static void reset_normal( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); if (ctx->Array.Normal.Enabled) { ac->Raw.Normal = ctx->Array.Normal; STRIDE_ARRAY(ac->Raw.Normal, ac->start); } else { ac->Raw.Normal = ac->Fallback.Normal; } ac->IsCached.Normal = GL_FALSE; ac->NewArrayState &= ~_NEW_ARRAY_NORMAL; } static void reset_color( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); if (ctx->Array.Color.Enabled) { ac->Raw.Color = ctx->Array.Color; STRIDE_ARRAY(ac->Raw.Color, ac->start); } else ac->Raw.Color = ac->Fallback.Color; ac->IsCached.Color = GL_FALSE; ac->NewArrayState &= ~_NEW_ARRAY_COLOR0; } static void reset_secondarycolor( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); if (ctx->Array.SecondaryColor.Enabled) { ac->Raw.SecondaryColor = ctx->Array.SecondaryColor; STRIDE_ARRAY(ac->Raw.SecondaryColor, ac->start); } else ac->Raw.SecondaryColor = ac->Fallback.SecondaryColor; ac->IsCached.SecondaryColor = GL_FALSE; ac->NewArrayState &= ~_NEW_ARRAY_COLOR1; } static void reset_index( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); if (ctx->Array.Index.Enabled) { ac->Raw.Index = ctx->Array.Index; STRIDE_ARRAY(ac->Raw.Index, ac->start); } else ac->Raw.Index = ac->Fallback.Index; ac->IsCached.Index = GL_FALSE; ac->NewArrayState &= ~_NEW_ARRAY_INDEX; } static void reset_fogcoord( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); if (ctx->Array.FogCoord.Enabled) { ac->Raw.FogCoord = ctx->Array.FogCoord; STRIDE_ARRAY(ac->Raw.FogCoord, ac->start); } else ac->Raw.FogCoord = ac->Fallback.FogCoord; ac->IsCached.FogCoord = GL_FALSE; ac->NewArrayState &= ~_NEW_ARRAY_FOGCOORD; } static void reset_edgeflag( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); if (ctx->Array.EdgeFlag.Enabled) { ac->Raw.EdgeFlag = ctx->Array.EdgeFlag; STRIDE_ARRAY(ac->Raw.EdgeFlag, ac->start); } else ac->Raw.EdgeFlag = ac->Fallback.EdgeFlag; ac->IsCached.EdgeFlag = GL_FALSE; ac->NewArrayState &= ~_NEW_ARRAY_EDGEFLAG; } static void reset_attrib( GLcontext *ctx, GLuint index ) { ACcontext *ac = AC_CONTEXT(ctx); if (ctx->Array.VertexAttrib[index].Enabled) { ac->Raw.Attrib[index] = ctx->Array.VertexAttrib[index]; STRIDE_ARRAY(ac->Raw.Attrib[index], ac->start); } else ac->Raw.Attrib[index] = ac->Fallback.Attrib[index]; ac->IsCached.Attrib[index] = GL_FALSE; ac->NewArrayState &= ~_NEW_ARRAY_ATTRIB(index); } /** * Generic import function for color data */ static void import( const GLcontext *ctx, GLenum destType, struct gl_client_array *to, const struct gl_client_array *from ) { const ACcontext *ac = AC_CONTEXT(ctx); if (destType == 0) destType = from->Type; switch (destType) { case GL_FLOAT: _math_trans_4fc( (GLfloat (*)[4]) to->Ptr, from->Ptr, from->StrideB, from->Type, from->Size, 0, ac->count - ac->start); to->StrideB = 4 * sizeof(GLfloat); to->Type = GL_FLOAT; break; case GL_UNSIGNED_BYTE: _math_trans_4ub( (GLubyte (*)[4]) to->Ptr, from->Ptr, from->StrideB, from->Type, from->Size, 0, ac->count - ac->start); to->StrideB = 4 * sizeof(GLubyte); to->Type = GL_UNSIGNED_BYTE; break; case GL_UNSIGNED_SHORT: _math_trans_4us( (GLushort (*)[4]) to->Ptr, from->Ptr, from->StrideB, from->Type, from->Size, 0, ac->count - ac->start); to->StrideB = 4 * sizeof(GLushort); to->Type = GL_UNSIGNED_SHORT; break; default: _mesa_problem(ctx, "Unexpected dest format in import()"); break; } } /* * Functions to import array ranges with specified types and strides. * For example, if the vertex data is GLshort[2] and we want GLfloat[3] * we'll use an import function to do the data conversion. */ static void import_texcoord( GLcontext *ctx, GLuint unit, GLenum type, GLuint stride ) { ACcontext *ac = AC_CONTEXT(ctx); const struct gl_client_array *from = &ac->Raw.TexCoord[unit]; struct gl_client_array *to = &ac->Cache.TexCoord[unit]; (void) type; (void) stride; ASSERT(unit < ctx->Const.MaxTextureCoordUnits); /* Limited choices at this stage: */ ASSERT(type == GL_FLOAT); ASSERT(stride == 4*sizeof(GLfloat) || stride == 0); ASSERT(ac->count - ac->start < ctx->Const.MaxArrayLockSize); _math_trans_4f( (GLfloat (*)[4]) to->Ptr, from->Ptr, from->StrideB, from->Type, from->Size, 0, ac->count - ac->start); to->Size = from->Size; to->StrideB = 4 * sizeof(GLfloat); to->Type = GL_FLOAT; ac->IsCached.TexCoord[unit] = GL_TRUE; } static void import_vertex( GLcontext *ctx, GLenum type, GLuint stride ) { ACcontext *ac = AC_CONTEXT(ctx); const struct gl_client_array *from = &ac->Raw.Vertex; struct gl_client_array *to = &ac->Cache.Vertex; (void) type; (void) stride; /* Limited choices at this stage: */ ASSERT(type == GL_FLOAT); ASSERT(stride == 4*sizeof(GLfloat) || stride == 0); _math_trans_4f( (GLfloat (*)[4]) to->Ptr, from->Ptr, from->StrideB, from->Type, from->Size, 0, ac->count - ac->start); to->Size = from->Size; to->StrideB = 4 * sizeof(GLfloat); to->Type = GL_FLOAT; ac->IsCached.Vertex = GL_TRUE; } static void import_normal( GLcontext *ctx, GLenum type, GLuint stride ) { ACcontext *ac = AC_CONTEXT(ctx); const struct gl_client_array *from = &ac->Raw.Normal; struct gl_client_array *to = &ac->Cache.Normal; (void) type; (void) stride; /* Limited choices at this stage: */ ASSERT(type == GL_FLOAT); ASSERT(stride == 3*sizeof(GLfloat) || stride == 0); _math_trans_3f( (GLfloat (*)[3]) to->Ptr, from->Ptr, from->StrideB, from->Type, 0, ac->count - ac->start); to->StrideB = 3 * sizeof(GLfloat); to->Type = GL_FLOAT; ac->IsCached.Normal = GL_TRUE; } static void import_color( GLcontext *ctx, GLenum type, GLuint stride ) { ACcontext *ac = AC_CONTEXT(ctx); const struct gl_client_array *from = &ac->Raw.Color; struct gl_client_array *to = &ac->Cache.Color; (void) stride; import( ctx, type, to, from ); ac->IsCached.Color = GL_TRUE; } static void import_index( GLcontext *ctx, GLenum type, GLuint stride ) { ACcontext *ac = AC_CONTEXT(ctx); const struct gl_client_array *from = &ac->Raw.Index; struct gl_client_array *to = &ac->Cache.Index; (void) type; (void) stride; /* Limited choices at this stage: */ ASSERT(type == GL_UNSIGNED_INT); ASSERT(stride == sizeof(GLuint) || stride == 0); _math_trans_1ui( (GLuint *) to->Ptr, from->Ptr, from->StrideB, from->Type, 0, ac->count - ac->start); to->StrideB = sizeof(GLuint); to->Type = GL_UNSIGNED_INT; ac->IsCached.Index = GL_TRUE; } static void import_secondarycolor( GLcontext *ctx, GLenum type, GLuint stride ) { ACcontext *ac = AC_CONTEXT(ctx); const struct gl_client_array *from = &ac->Raw.SecondaryColor; struct gl_client_array *to = &ac->Cache.SecondaryColor; (void) stride; import( ctx, type, to, from ); ac->IsCached.SecondaryColor = GL_TRUE; } static void import_fogcoord( GLcontext *ctx, GLenum type, GLuint stride ) { ACcontext *ac = AC_CONTEXT(ctx); const struct gl_client_array *from = &ac->Raw.FogCoord; struct gl_client_array *to = &ac->Cache.FogCoord; (void) type; (void) stride; /* Limited choices at this stage: */ ASSERT(type == GL_FLOAT); ASSERT(stride == sizeof(GLfloat) || stride == 0); _math_trans_1f( (GLfloat *) to->Ptr, from->Ptr, from->StrideB, from->Type, 0, ac->count - ac->start); to->StrideB = sizeof(GLfloat); to->Type = GL_FLOAT; ac->IsCached.FogCoord = GL_TRUE; } static void import_edgeflag( GLcontext *ctx, GLenum type, GLuint stride ) { ACcontext *ac = AC_CONTEXT(ctx); const struct gl_client_array *from = &ac->Raw.EdgeFlag; struct gl_client_array *to = &ac->Cache.EdgeFlag; (void) type; (void) stride; /* Limited choices at this stage: */ ASSERT(type == GL_UNSIGNED_BYTE); ASSERT(stride == sizeof(GLubyte) || stride == 0); _math_trans_1ub( (GLubyte *) to->Ptr, from->Ptr, from->StrideB, from->Type, 0, ac->count - ac->start); to->StrideB = sizeof(GLubyte); to->Type = GL_UNSIGNED_BYTE; ac->IsCached.EdgeFlag = GL_TRUE; } static void import_attrib( GLcontext *ctx, GLuint index, GLenum type, GLuint stride ) { ACcontext *ac = AC_CONTEXT(ctx); const struct gl_client_array *from = &ac->Raw.Attrib[index]; struct gl_client_array *to = &ac->Cache.Attrib[index]; (void) type; (void) stride; ASSERT(index < MAX_VERTEX_PROGRAM_ATTRIBS); /* Limited choices at this stage: */ ASSERT(type == GL_FLOAT); ASSERT(stride == 4*sizeof(GLfloat) || stride == 0); ASSERT(ac->count - ac->start < ctx->Const.MaxArrayLockSize); _math_trans_4f( (GLfloat (*)[4]) to->Ptr, from->Ptr, from->StrideB, from->Type, from->Size, 0, ac->count - ac->start); to->Size = from->Size; to->StrideB = 4 * sizeof(GLfloat); to->Type = GL_FLOAT; ac->IsCached.Attrib[index] = GL_TRUE; } /* * Externals to request arrays with specific properties: */ struct gl_client_array * _ac_import_texcoord( GLcontext *ctx, GLuint unit, GLenum type, GLuint reqstride, GLuint reqsize, GLboolean reqwriteable, GLboolean *writeable ) { ACcontext *ac = AC_CONTEXT(ctx); ASSERT(unit < MAX_TEXTURE_COORD_UNITS); /* Can we keep the existing version? */ if (ac->NewArrayState & _NEW_ARRAY_TEXCOORD(unit)) reset_texcoord( ctx, unit ); /* Is the request impossible? */ if (reqsize != 0 && ac->Raw.TexCoord[unit].Size > (GLint) reqsize) return NULL; /* Do we need to pull in a copy of the client data: */ if (ac->Raw.TexCoord[unit].Type != type || (reqstride != 0 && ac->Raw.TexCoord[unit].StrideB != (GLint)reqstride) || reqwriteable) { if (!ac->IsCached.TexCoord[unit]) import_texcoord(ctx, unit, type, reqstride ); *writeable = GL_TRUE; return &ac->Cache.TexCoord[unit]; } else { *writeable = GL_FALSE; return &ac->Raw.TexCoord[unit]; } } struct gl_client_array * _ac_import_vertex( GLcontext *ctx, GLenum type, GLuint reqstride, GLuint reqsize, GLboolean reqwriteable, GLboolean *writeable ) { ACcontext *ac = AC_CONTEXT(ctx); /* Can we keep the existing version? */ if (ac->NewArrayState & _NEW_ARRAY_VERTEX) reset_vertex( ctx ); /* Is the request impossible? */ if (reqsize != 0 && ac->Raw.Vertex.Size > (GLint) reqsize) return NULL; /* Do we need to pull in a copy of the client data: */ if (ac->Raw.Vertex.Type != type || (reqstride != 0 && ac->Raw.Vertex.StrideB != (GLint) reqstride) || reqwriteable) { if (!ac->IsCached.Vertex) import_vertex(ctx, type, reqstride ); *writeable = GL_TRUE; return &ac->Cache.Vertex; } else { *writeable = GL_FALSE; return &ac->Raw.Vertex; } } struct gl_client_array * _ac_import_normal( GLcontext *ctx, GLenum type, GLuint reqstride, GLboolean reqwriteable, GLboolean *writeable ) { ACcontext *ac = AC_CONTEXT(ctx); /* Can we keep the existing version? */ if (ac->NewArrayState & _NEW_ARRAY_NORMAL) reset_normal( ctx ); /* Do we need to pull in a copy of the client data: */ if (ac->Raw.Normal.Type != type || (reqstride != 0 && ac->Raw.Normal.StrideB != (GLint) reqstride) || reqwriteable) { if (!ac->IsCached.Normal) import_normal(ctx, type, reqstride ); *writeable = GL_TRUE; return &ac->Cache.Normal; } else { *writeable = GL_FALSE; return &ac->Raw.Normal; } } struct gl_client_array * _ac_import_color( GLcontext *ctx, GLenum type, GLuint reqstride, GLuint reqsize, GLboolean reqwriteable, GLboolean *writeable ) { ACcontext *ac = AC_CONTEXT(ctx); /* Can we keep the existing version? */ if (ac->NewArrayState & _NEW_ARRAY_COLOR0) reset_color( ctx ); /* Is the request impossible? */ if (reqsize != 0 && ac->Raw.Color.Size > (GLint) reqsize) { return NULL; } /* Do we need to pull in a copy of the client data: */ if ((type != 0 && ac->Raw.Color.Type != type) || (reqstride != 0 && ac->Raw.Color.StrideB != (GLint) reqstride) || reqwriteable) { if (!ac->IsCached.Color) { import_color(ctx, type, reqstride ); } *writeable = GL_TRUE; return &ac->Cache.Color; } else { *writeable = GL_FALSE; return &ac->Raw.Color; } } struct gl_client_array * _ac_import_index( GLcontext *ctx, GLenum type, GLuint reqstride, GLboolean reqwriteable, GLboolean *writeable ) { ACcontext *ac = AC_CONTEXT(ctx); /* Can we keep the existing version? */ if (ac->NewArrayState & _NEW_ARRAY_INDEX) reset_index( ctx ); /* Do we need to pull in a copy of the client data: */ if (ac->Raw.Index.Type != type || (reqstride != 0 && ac->Raw.Index.StrideB != (GLint) reqstride) || reqwriteable) { if (!ac->IsCached.Index) import_index(ctx, type, reqstride ); *writeable = GL_TRUE; return &ac->Cache.Index; } else { *writeable = GL_FALSE; return &ac->Raw.Index; } } struct gl_client_array * _ac_import_secondarycolor( GLcontext *ctx, GLenum type, GLuint reqstride, GLuint reqsize, GLboolean reqwriteable, GLboolean *writeable ) { ACcontext *ac = AC_CONTEXT(ctx); /* Can we keep the existing version? */ if (ac->NewArrayState & _NEW_ARRAY_COLOR1) reset_secondarycolor( ctx ); /* Is the request impossible? */ if (reqsize != 0 && ac->Raw.SecondaryColor.Size > (GLint) reqsize) return NULL; /* Do we need to pull in a copy of the client data: */ if ((type != 0 && ac->Raw.SecondaryColor.Type != type) || (reqstride != 0 && ac->Raw.SecondaryColor.StrideB != (GLint)reqstride) || reqwriteable) { if (!ac->IsCached.SecondaryColor) import_secondarycolor(ctx, type, reqstride ); *writeable = GL_TRUE; return &ac->Cache.SecondaryColor; } else { *writeable = GL_FALSE; return &ac->Raw.SecondaryColor; } } struct gl_client_array * _ac_import_fogcoord( GLcontext *ctx, GLenum type, GLuint reqstride, GLboolean reqwriteable, GLboolean *writeable ) { ACcontext *ac = AC_CONTEXT(ctx); /* Can we keep the existing version? */ if (ac->NewArrayState & _NEW_ARRAY_FOGCOORD) reset_fogcoord( ctx ); /* Do we need to pull in a copy of the client data: */ if (ac->Raw.FogCoord.Type != type || (reqstride != 0 && ac->Raw.FogCoord.StrideB != (GLint) reqstride) || reqwriteable) { if (!ac->IsCached.FogCoord) import_fogcoord(ctx, type, reqstride ); *writeable = GL_TRUE; return &ac->Cache.FogCoord; } else { *writeable = GL_FALSE; return &ac->Raw.FogCoord; } } struct gl_client_array * _ac_import_edgeflag( GLcontext *ctx, GLenum type, GLuint reqstride, GLboolean reqwriteable, GLboolean *writeable ) { ACcontext *ac = AC_CONTEXT(ctx); /* Can we keep the existing version? */ if (ac->NewArrayState & _NEW_ARRAY_EDGEFLAG) reset_edgeflag( ctx ); /* Do we need to pull in a copy of the client data: */ if (ac->Raw.EdgeFlag.Type != type || (reqstride != 0 && ac->Raw.EdgeFlag.StrideB != (GLint) reqstride) || reqwriteable) { if (!ac->IsCached.EdgeFlag) import_edgeflag(ctx, type, reqstride ); *writeable = GL_TRUE; return &ac->Cache.EdgeFlag; } else { *writeable = GL_FALSE; return &ac->Raw.EdgeFlag; } } /* GL_NV_vertex_program */ struct gl_client_array * _ac_import_attrib( GLcontext *ctx, GLuint index, GLenum type, GLuint reqstride, GLuint reqsize, GLboolean reqwriteable, GLboolean *writeable ) { ACcontext *ac = AC_CONTEXT(ctx); ASSERT(index < VERT_ATTRIB_MAX); /* Can we keep the existing version? */ if (ac->NewArrayState & _NEW_ARRAY_ATTRIB(index)) reset_attrib( ctx, index ); /* Is the request impossible? */ if (reqsize != 0 && ac->Raw.Attrib[index].Size > (GLint) reqsize) return NULL; /* Do we need to pull in a copy of the client data: */ if (ac->Raw.Attrib[index].Type != type || (reqstride != 0 && ac->Raw.Attrib[index].StrideB != (GLint)reqstride) || reqwriteable) { if (!ac->IsCached.Attrib[index]) import_attrib(ctx, index, type, reqstride ); *writeable = GL_TRUE; return &ac->Cache.Attrib[index]; } else { *writeable = GL_FALSE; return &ac->Raw.Attrib[index]; } } /* Clients must call this function to validate state and set bounds * before importing any data: */ void _ac_import_range( GLcontext *ctx, GLuint start, GLuint count ) { ACcontext *ac = AC_CONTEXT(ctx); if (!ctx->Array.LockCount) { /* Not locked, discard cached data. Changes to lock * status are caught via. _ac_invalidate_state(). */ ac->NewArrayState = _NEW_ARRAY_ALL; ac->start = start; ac->count = count; } else { /* Locked, discard data for any disabled arrays. Require that * the whole locked range always be dealt with, otherwise hard to * maintain cached data in the face of clipping. */ ac->NewArrayState |= ~ctx->Array._Enabled; ac->start = ctx->Array.LockFirst; ac->count = ctx->Array.LockCount; ASSERT(ac->start == start); /* hmm? */ ASSERT(ac->count == count); } } /* Additional convienence function for importing the element list * for glDrawElements() and glDrawRangeElements(). */ CONST void * _ac_import_elements( GLcontext *ctx, GLenum new_type, GLuint count, GLenum old_type, CONST void *indices ) { ACcontext *ac = AC_CONTEXT(ctx); if (old_type == new_type) return indices; if (ac->elt_size < count * sizeof(GLuint)) { if (ac->Elts) FREE(ac->Elts); while (ac->elt_size < count * sizeof(GLuint)) ac->elt_size *= 2; ac->Elts = (GLuint *) MALLOC(ac->elt_size); } switch (new_type) { case GL_UNSIGNED_BYTE: ASSERT(0); return NULL; case GL_UNSIGNED_SHORT: ASSERT(0); return NULL; case GL_UNSIGNED_INT: { GLuint *out = (GLuint *)ac->Elts; GLuint i; switch (old_type) { case GL_UNSIGNED_BYTE: { CONST GLubyte *in = (CONST GLubyte *)indices; for (i = 0 ; i < count ; i++) out[i] = in[i]; break; } case GL_UNSIGNED_SHORT: { CONST GLushort *in = (CONST GLushort *)indices; for (i = 0 ; i < count ; i++) out[i] = in[i]; break; } default: ASSERT(0); } return (CONST void *)out; } default: ASSERT(0); break; } return NULL; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/drivers/common/driverfuncs.c0000644000000000000000000002000313614532424022654 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "imports.h" #include "buffers.h" #include "context.h" #include "framebuffer.h" #include "program.h" #include "renderbuffer.h" #include "texcompress.h" #include "texformat.h" #include "teximage.h" #include "texobj.h" #include "texstore.h" #if FEATURE_ARB_vertex_buffer_object #include "bufferobj.h" #endif #if FEATURE_EXT_framebuffer_object #include "fbobject.h" #include "texrender.h" #endif #include "driverfuncs.h" #include "swrast/swrast.h" #include "tnl/tnl.h" /** * Plug in default functions for all pointers in the dd_function_table * structure. * Device drivers should call this function and then plug in any * functions which it wants to override. * Some functions (pointers) MUST be implemented by all drivers (REQUIRED). * * \param table the dd_function_table to initialize */ void _mesa_init_driver_functions(struct dd_function_table *driver) { _mesa_bzero(driver, sizeof(*driver)); driver->GetString = NULL; /* REQUIRED! */ driver->UpdateState = NULL; /* REQUIRED! */ driver->GetBufferSize = NULL; /* REQUIRED! */ driver->ResizeBuffers = _mesa_resize_framebuffer; driver->Error = NULL; driver->Finish = NULL; driver->Flush = NULL; /* framebuffer/image functions */ driver->Clear = _swrast_Clear; driver->Accum = _swrast_Accum; driver->DrawPixels = _swrast_DrawPixels; driver->ReadPixels = _swrast_ReadPixels; driver->CopyPixels = _swrast_CopyPixels; driver->Bitmap = _swrast_Bitmap; /* Texture functions */ driver->ChooseTextureFormat = _mesa_choose_tex_format; driver->TexImage1D = _mesa_store_teximage1d; driver->TexImage2D = _mesa_store_teximage2d; driver->TexImage3D = _mesa_store_teximage3d; driver->TexSubImage1D = _mesa_store_texsubimage1d; driver->TexSubImage2D = _mesa_store_texsubimage2d; driver->TexSubImage3D = _mesa_store_texsubimage3d; driver->GetTexImage = _mesa_get_teximage; driver->CopyTexImage1D = _swrast_copy_teximage1d; driver->CopyTexImage2D = _swrast_copy_teximage2d; driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d; driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d; driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d; driver->TestProxyTexImage = _mesa_test_proxy_teximage; driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d; driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d; driver->CompressedTexImage3D = _mesa_store_compressed_teximage3d; driver->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d; driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; driver->GetCompressedTexImage = _mesa_get_compressed_teximage; driver->CompressedTextureSize = _mesa_compressed_texture_size; driver->BindTexture = NULL; driver->NewTextureObject = _mesa_new_texture_object; driver->DeleteTexture = _mesa_delete_texture_object; driver->NewTextureImage = _mesa_new_texture_image; driver->FreeTexImageData = _mesa_free_texture_image_data; driver->TextureMemCpy = _mesa_memcpy; driver->IsTextureResident = NULL; driver->PrioritizeTexture = NULL; driver->ActiveTexture = NULL; driver->UpdateTexturePalette = NULL; /* imaging */ driver->CopyColorTable = _swrast_CopyColorTable; driver->CopyColorSubTable = _swrast_CopyColorSubTable; driver->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; driver->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; /* Vertex/fragment programs */ driver->BindProgram = NULL; driver->NewProgram = _mesa_new_program; driver->DeleteProgram = _mesa_delete_program; /* simple state commands */ driver->AlphaFunc = NULL; driver->BlendColor = NULL; driver->BlendEquationSeparate = NULL; driver->BlendFuncSeparate = NULL; driver->ClearColor = NULL; driver->ClearDepth = NULL; driver->ClearIndex = NULL; driver->ClearStencil = NULL; driver->ClipPlane = NULL; driver->ColorMask = NULL; driver->ColorMaterial = NULL; driver->CullFace = NULL; driver->DrawBuffer = _swrast_DrawBuffer; driver->DrawBuffers = NULL; /***_swrast_DrawBuffers;***/ driver->FrontFace = NULL; driver->DepthFunc = NULL; driver->DepthMask = NULL; driver->DepthRange = NULL; driver->Enable = NULL; driver->Fogfv = NULL; driver->Hint = NULL; driver->IndexMask = NULL; driver->Lightfv = NULL; driver->LightModelfv = NULL; driver->LineStipple = NULL; driver->LineWidth = NULL; driver->LogicOpcode = NULL; driver->PointParameterfv = NULL; driver->PointSize = NULL; driver->PolygonMode = NULL; driver->PolygonOffset = NULL; driver->PolygonStipple = NULL; driver->ReadBuffer = NULL; driver->RenderMode = NULL; driver->Scissor = NULL; driver->ShadeModel = NULL; driver->StencilFunc = NULL; driver->StencilMask = NULL; driver->StencilOp = NULL; driver->ActiveStencilFace = NULL; driver->TexGen = NULL; driver->TexEnv = NULL; driver->TexParameter = NULL; driver->TextureMatrix = NULL; driver->Viewport = NULL; /* vertex arrays */ driver->VertexPointer = NULL; driver->NormalPointer = NULL; driver->ColorPointer = NULL; driver->FogCoordPointer = NULL; driver->IndexPointer = NULL; driver->SecondaryColorPointer = NULL; driver->TexCoordPointer = NULL; driver->EdgeFlagPointer = NULL; driver->VertexAttribPointer = NULL; driver->LockArraysEXT = NULL; driver->UnlockArraysEXT = NULL; /* state queries */ driver->GetBooleanv = NULL; driver->GetDoublev = NULL; driver->GetFloatv = NULL; driver->GetIntegerv = NULL; driver->GetPointerv = NULL; #if FEATURE_ARB_vertex_buffer_object driver->NewBufferObject = _mesa_new_buffer_object; driver->DeleteBuffer = _mesa_delete_buffer_object; driver->BindBuffer = NULL; driver->BufferData = _mesa_buffer_data; driver->BufferSubData = _mesa_buffer_subdata; driver->GetBufferSubData = _mesa_buffer_get_subdata; driver->MapBuffer = _mesa_buffer_map; driver->UnmapBuffer = _mesa_buffer_unmap; #endif #if FEATURE_EXT_framebuffer_object driver->NewFramebuffer = _mesa_new_framebuffer; driver->NewRenderbuffer = _mesa_new_soft_renderbuffer; driver->RenderbufferTexture = _mesa_renderbuffer_texture; driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer; #endif /* T&L stuff */ driver->NeedValidate = GL_FALSE; driver->ValidateTnlModule = NULL; driver->CurrentExecPrimitive = 0; driver->CurrentSavePrimitive = 0; driver->NeedFlush = 0; driver->SaveNeedFlush = 0; driver->FlushVertices = NULL; driver->SaveFlushVertices = NULL; driver->NotifySaveBegin = NULL; driver->LightingSpaceChange = NULL; driver->MakeCurrent = NULL; driver->ProgramStringNotify = _tnl_program_string; /* display list */ driver->NewList = NULL; driver->EndList = NULL; driver->BeginCallList = NULL; driver->EndCallList = NULL; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/drivers/common/driverfuncs.h0000644000000000000000000000242313614532424022667 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef DRIVERFUNCS_H #define DRIVERFUNCS_H extern void _mesa_init_driver_functions(struct dd_function_table *driver); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.c0000644000000000000000000003767413614532424024165 0ustar /* * (C) Copyright IBM Corporation 2003 * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * on the rights to use, copy, modify, merge, publish, distribute, sub * license, and/or sell copies of the Software, and to permit persons to whom * the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file glcontextmodes.c * Utility routines for working with \c __GLcontextModes structures. At * some point most or all of these functions will be moved to the Mesa * code base. * * \author Ian Romanick */ #if defined(IN_MINI_GLX) # include # include # include # include "GL/internal/dri_interface.h" # include "imports.h" # define __glXMemset memset #else # include # include # include "GL/glxint.h" # ifdef XFree86Server # include "GL/glx_ansic.h" extern void * __glXMalloc( size_t size ); extern void __glXFree( void * ptr ); # define _mesa_malloc(b) __glXMalloc(b) # define _mesa_free(m) __glXFree(m) # else # include # define __glXMemset memset # define _mesa_malloc(b) Xmalloc(b) # define _mesa_free(m) Xfree(m) # endif /* XFree86Server */ #endif /* !defined(IN_MINI_GLX) */ #include "glcontextmodes.h" #if !defined(IN_MINI_GLX) #define NUM_VISUAL_TYPES 6 /** * Convert an X visual type to a GLX visual type. * * \param visualType X visual type (i.e., \c TrueColor, \c StaticGray, etc.) * to be converted. * \return If \c visualType is a valid X visual type, a GLX visual type will * be returned. Otherwise \c GLX_NONE will be returned. */ GLint _gl_convert_from_x_visual_type( int visualType ) { static const int glx_visual_types[ NUM_VISUAL_TYPES ] = { GLX_STATIC_GRAY, GLX_GRAY_SCALE, GLX_STATIC_COLOR, GLX_PSEUDO_COLOR, GLX_TRUE_COLOR, GLX_DIRECT_COLOR }; return ( (unsigned) visualType < NUM_VISUAL_TYPES ) ? glx_visual_types[ visualType ] : GLX_NONE; } /** * Convert a GLX visual type to an X visual type. * * \param visualType GLX visual type (i.e., \c GLX_TRUE_COLOR, * \c GLX_STATIC_GRAY, etc.) to be converted. * \return If \c visualType is a valid GLX visual type, an X visual type will * be returned. Otherwise -1 will be returned. */ GLint _gl_convert_to_x_visual_type( int visualType ) { static const int x_visual_types[ NUM_VISUAL_TYPES ] = { TrueColor, DirectColor, PseudoColor, StaticColor, GrayScale, StaticGray }; return ( (unsigned) (visualType - GLX_TRUE_COLOR) <= NUM_VISUAL_TYPES ) ? x_visual_types[ visualType - GLX_TRUE_COLOR ] : -1; } /** * Copy a GLX visual config structure to a GL context mode structure. All * of the fields in \c config are copied to \c mode. Additional fields in * \c mode that can be derrived from the fields of \c config (i.e., * \c haveDepthBuffer) are also filled in. The remaining fields in \c mode * that cannot be derrived are set to default values. * * \param mode Destination GL context mode. * \param config Source GLX visual config. * * \note * The \c fbconfigID and \c visualID fields of the \c __GLcontextModes * structure will be set to the \c vid of the \c __GLXvisualConfig structure. */ void _gl_copy_visual_to_context_mode( __GLcontextModes * mode, const __GLXvisualConfig * config ) { __GLcontextModes * const next = mode->next; (void) __glXMemset( mode, 0, sizeof( __GLcontextModes ) ); mode->next = next; mode->visualID = config->vid; mode->visualType = _gl_convert_from_x_visual_type( config->class ); mode->xRenderable = GL_TRUE; mode->fbconfigID = config->vid; mode->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT; mode->rgbMode = (config->rgba != 0); mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT; mode->colorIndexMode = !(mode->rgbMode); mode->doubleBufferMode = (config->doubleBuffer != 0); mode->stereoMode = (config->stereo != 0); mode->haveAccumBuffer = ((config->accumRedSize + config->accumGreenSize + config->accumBlueSize + config->accumAlphaSize) > 0); mode->haveDepthBuffer = (config->depthSize > 0); mode->haveStencilBuffer = (config->stencilSize > 0); mode->redBits = config->redSize; mode->greenBits = config->greenSize; mode->blueBits = config->blueSize; mode->alphaBits = config->alphaSize; mode->redMask = config->redMask; mode->greenMask = config->greenMask; mode->blueMask = config->blueMask; mode->alphaMask = config->alphaMask; mode->rgbBits = mode->rgbMode ? config->bufferSize : 0; mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0; mode->accumRedBits = config->accumRedSize; mode->accumGreenBits = config->accumGreenSize; mode->accumBlueBits = config->accumBlueSize; mode->accumAlphaBits = config->accumAlphaSize; mode->depthBits = config->depthSize; mode->stencilBits = config->stencilSize; mode->numAuxBuffers = config->auxBuffers; mode->level = config->level; mode->visualRating = config->visualRating; mode->transparentPixel = config->transparentPixel; mode->transparentRed = config->transparentRed; mode->transparentGreen = config->transparentGreen; mode->transparentBlue = config->transparentBlue; mode->transparentAlpha = config->transparentAlpha; mode->transparentIndex = config->transparentIndex; mode->swapMethod = GLX_SWAP_UNDEFINED_OML; } /** * Get data from a GL context mode. * * \param mode GL context mode whose data is to be returned. * \param attribute Attribute of \c mode that is to be returned. * \param value_return Location to store the data member of \c mode. * \return If \c attribute is a valid attribute of \c mode, zero is * returned. Otherwise \c GLX_BAD_ATTRIBUTE is returned. */ int _gl_get_context_mode_data(const __GLcontextModes *mode, int attribute, int *value_return) { switch (attribute) { case GLX_USE_GL: *value_return = GL_TRUE; return 0; case GLX_BUFFER_SIZE: *value_return = mode->rgbBits; return 0; case GLX_RGBA: *value_return = mode->rgbMode; return 0; case GLX_RED_SIZE: *value_return = mode->redBits; return 0; case GLX_GREEN_SIZE: *value_return = mode->greenBits; return 0; case GLX_BLUE_SIZE: *value_return = mode->blueBits; return 0; case GLX_ALPHA_SIZE: *value_return = mode->alphaBits; return 0; case GLX_DOUBLEBUFFER: *value_return = mode->doubleBufferMode; return 0; case GLX_STEREO: *value_return = mode->stereoMode; return 0; case GLX_AUX_BUFFERS: *value_return = mode->numAuxBuffers; return 0; case GLX_DEPTH_SIZE: *value_return = mode->depthBits; return 0; case GLX_STENCIL_SIZE: *value_return = mode->stencilBits; return 0; case GLX_ACCUM_RED_SIZE: *value_return = mode->accumRedBits; return 0; case GLX_ACCUM_GREEN_SIZE: *value_return = mode->accumGreenBits; return 0; case GLX_ACCUM_BLUE_SIZE: *value_return = mode->accumBlueBits; return 0; case GLX_ACCUM_ALPHA_SIZE: *value_return = mode->accumAlphaBits; return 0; case GLX_LEVEL: *value_return = mode->level; return 0; case GLX_TRANSPARENT_TYPE_EXT: *value_return = mode->transparentPixel; return 0; case GLX_TRANSPARENT_RED_VALUE: *value_return = mode->transparentRed; return 0; case GLX_TRANSPARENT_GREEN_VALUE: *value_return = mode->transparentGreen; return 0; case GLX_TRANSPARENT_BLUE_VALUE: *value_return = mode->transparentBlue; return 0; case GLX_TRANSPARENT_ALPHA_VALUE: *value_return = mode->transparentAlpha; return 0; case GLX_TRANSPARENT_INDEX_VALUE: *value_return = mode->transparentIndex; return 0; case GLX_X_VISUAL_TYPE: *value_return = mode->visualType; return 0; case GLX_CONFIG_CAVEAT: *value_return = mode->visualRating; return 0; case GLX_VISUAL_ID: *value_return = mode->visualID; return 0; case GLX_DRAWABLE_TYPE: *value_return = mode->drawableType; return 0; case GLX_RENDER_TYPE: *value_return = mode->renderType; return 0; case GLX_X_RENDERABLE: *value_return = mode->xRenderable; return 0; case GLX_FBCONFIG_ID: *value_return = mode->fbconfigID; return 0; case GLX_MAX_PBUFFER_WIDTH: *value_return = mode->maxPbufferWidth; return 0; case GLX_MAX_PBUFFER_HEIGHT: *value_return = mode->maxPbufferHeight; return 0; case GLX_MAX_PBUFFER_PIXELS: *value_return = mode->maxPbufferPixels; return 0; case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX: *value_return = mode->optimalPbufferWidth; return 0; case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX: *value_return = mode->optimalPbufferHeight; return 0; case GLX_SWAP_METHOD_OML: *value_return = mode->swapMethod; return 0; case GLX_SAMPLE_BUFFERS_SGIS: *value_return = mode->sampleBuffers; return 0; case GLX_SAMPLES_SGIS: *value_return = mode->samples; return 0; /* Applications are NOT allowed to query GLX_VISUAL_SELECT_GROUP_SGIX. * It is ONLY for communication between the GLX client and the GLX * server. */ case GLX_VISUAL_SELECT_GROUP_SGIX: default: return GLX_BAD_ATTRIBUTE; } } #endif /* !defined(IN_MINI_GLX) */ /** * Allocate a linked list of \c __GLcontextModes structures. The fields of * each structure will be initialized to "reasonable" default values. In * most cases this is the default value defined by table 3.4 of the GLX * 1.3 specification. This means that most values are either initialized to * zero or \c GLX_DONT_CARE (which is -1). As support for additional * extensions is added, the new values will be initialized to appropriate * values from the extension specification. * * \param count Number of structures to allocate. * \param minimum_size Minimum size of a structure to allocate. This allows * for differences in the version of the * \c __GLcontextModes stucture used in libGL and in a * DRI-based driver. * \returns A pointer to the first element in a linked list of \c count * stuctures on success, or \c NULL on failure. * * \warning Use of \c minimum_size does \b not guarantee binary compatibility. * The fundamental assumption is that if the \c minimum_size * specified by the driver and the size of the \c __GLcontextModes * structure in libGL is the same, then the meaning of each byte in * the structure is the same in both places. \b Be \b careful! * Basically this means that fields have to be added in libGL and * then propagated to drivers. Drivers should \b never arbitrarilly * extend the \c __GLcontextModes data-structure. */ __GLcontextModes * _gl_context_modes_create( unsigned count, size_t minimum_size ) { const size_t size = (minimum_size > sizeof( __GLcontextModes )) ? minimum_size : sizeof( __GLcontextModes ); __GLcontextModes * base = NULL; __GLcontextModes ** next; unsigned i; next = & base; for ( i = 0 ; i < count ; i++ ) { *next = (__GLcontextModes *) _mesa_malloc( size ); if ( *next == NULL ) { _gl_context_modes_destroy( base ); base = NULL; break; } (void) __glXMemset( *next, 0, size ); (*next)->visualID = GLX_DONT_CARE; (*next)->visualType = GLX_DONT_CARE; (*next)->visualRating = GLX_NONE; (*next)->transparentPixel = GLX_NONE; (*next)->transparentRed = GLX_DONT_CARE; (*next)->transparentGreen = GLX_DONT_CARE; (*next)->transparentBlue = GLX_DONT_CARE; (*next)->transparentAlpha = GLX_DONT_CARE; (*next)->transparentIndex = GLX_DONT_CARE; (*next)->xRenderable = GLX_DONT_CARE; (*next)->fbconfigID = GLX_DONT_CARE; (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML; next = & ((*next)->next); } return base; } /** * Destroy a linked list of \c __GLcontextModes structures created by * \c _gl_context_modes_create. * * \param modes Linked list of structures to be destroyed. All structres * in the list will be freed. */ void _gl_context_modes_destroy( __GLcontextModes * modes ) { while ( modes != NULL ) { __GLcontextModes * const next = modes->next; _mesa_free( modes ); modes = next; } } /** * Find a context mode matching a Visual ID. * * \param modes List list of context-mode structures to be searched. * \param vid Visual ID to be found. * \returns A pointer to a context-mode in \c modes if \c vid was found in * the list, or \c NULL if it was not. */ __GLcontextModes * _gl_context_modes_find_visual( __GLcontextModes * modes, int vid ) { while ( modes != NULL ) { if ( modes->visualID == vid ) { break; } modes = modes->next; } return modes; } /** * Determine if two context-modes are the same. This is intended to be used * by libGL implementations to compare to sets of driver generated FBconfigs. * * \param a Context-mode to be compared. * \param b Context-mode to be compared. * \returns \c GL_TRUE if the two context-modes are the same. \c GL_FALSE is * returned otherwise. */ GLboolean _gl_context_modes_are_same( const __GLcontextModes * a, const __GLcontextModes * b ) { return( (a->rgbMode == b->rgbMode) && (a->floatMode == b->floatMode) && (a->colorIndexMode == b->colorIndexMode) && (a->doubleBufferMode == b->doubleBufferMode) && (a->stereoMode == b->stereoMode) && (a->redBits == b->redBits) && (a->greenBits == b->greenBits) && (a->blueBits == b->blueBits) && (a->alphaBits == b->alphaBits) && #if 0 /* For some reason these don't get set on the client-side in libGL. */ (a->redMask == b->redMask) && (a->greenMask == b->greenMask) && (a->blueMask == b->blueMask) && (a->alphaMask == b->alphaMask) && #endif (a->rgbBits == b->rgbBits) && (a->indexBits == b->indexBits) && (a->accumRedBits == b->accumRedBits) && (a->accumGreenBits == b->accumGreenBits) && (a->accumBlueBits == b->accumBlueBits) && (a->accumAlphaBits == b->accumAlphaBits) && (a->depthBits == b->depthBits) && (a->stencilBits == b->stencilBits) && (a->numAuxBuffers == b->numAuxBuffers) && (a->level == b->level) && (a->pixmapMode == b->pixmapMode) && (a->visualRating == b->visualRating) && (a->transparentPixel == b->transparentPixel) && ((a->transparentPixel != GLX_TRANSPARENT_RGB) || ((a->transparentRed == b->transparentRed) && (a->transparentGreen == b->transparentGreen) && (a->transparentBlue == b->transparentBlue) && (a->transparentAlpha == b->transparentAlpha))) && ((a->transparentPixel != GLX_TRANSPARENT_INDEX) || (a->transparentIndex == b->transparentIndex)) && (a->sampleBuffers == b->sampleBuffers) && (a->samples == b->samples) && ((a->drawableType & b->drawableType) != 0) && (a->renderType == b->renderType) && (a->maxPbufferWidth == b->maxPbufferWidth) && (a->maxPbufferHeight == b->maxPbufferHeight) && (a->maxPbufferPixels == b->maxPbufferPixels) && (a->optimalPbufferWidth == b->optimalPbufferWidth) && (a->optimalPbufferHeight == b->optimalPbufferHeight) && (a->swapMethod == b->swapMethod) ); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/drivers/dri/common/glcontextmodes.h0000644000000000000000000000415713614532424024160 0ustar /* * (C) Copyright IBM Corporation 2003 * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * on the rights to use, copy, modify, merge, publish, distribute, sub * license, and/or sell copies of the Software, and to permit persons to whom * the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file glcontextmodes.h * \author Ian Romanick */ #ifndef GLCONTEXTMODES_H #define GLCONTEXTMODES_H #include "GL/internal/glcore.h" #if !defined(IN_MINI_GLX) extern GLint _gl_convert_from_x_visual_type( int visualType ); extern GLint _gl_convert_to_x_visual_type( int visualType ); extern void _gl_copy_visual_to_context_mode( __GLcontextModes * mode, const __GLXvisualConfig * config ); extern int _gl_get_context_mode_data( const __GLcontextModes *mode, int attribute, int *value_return ); #endif /* !defined(IN_MINI_GLX) */ extern __GLcontextModes * _gl_context_modes_create( unsigned count, size_t minimum_size ); extern void _gl_context_modes_destroy( __GLcontextModes * modes ); extern __GLcontextModes * _gl_context_modes_find_visual( __GLcontextModes * modes, int vid ); extern GLboolean _gl_context_modes_are_same( const __GLcontextModes * a, const __GLcontextModes * b ); #endif /* GLCONTEXTMODES_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/drivers/x11/glxheader.h0000644000000000000000000000333713614532424021426 0ustar /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef GLX_HEADER_H #define GLX_HEADER_H #ifdef __VMS #include #endif #include "glheader.h" #ifdef XFree86Server # include "resource.h" # include "windowstr.h" # include "gcstruct.h" # include "GL/xf86glx.h" # include "xf86glx_util.h" #else # include # include # ifdef USE_XSHM /* was SHM */ # include # include # include # endif # include #endif /* this silences a compiler warning on several systems */ struct timespec; struct itimerspec; #endif /*GLX_HEADER*/ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/drivers/x11/xm_api.c0000644000000000000000000024257513614532424020744 0ustar /* * Mesa 3-D graphics library * Version: 6.4.2 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * This file contains the implementations of all the XMesa* functions. * * * NOTES: * * The window coordinate system origin (0,0) is in the lower-left corner * of the window. X11's window coordinate origin is in the upper-left * corner of the window. Therefore, most drawing functions in this * file have to flip Y coordinates. * * Define USE_XSHM in the Makefile with -DUSE_XSHM if you want to compile * in support for the MIT Shared Memory extension. If enabled, when you * use an Ximage for the back buffer in double buffered mode, the "swap" * operation will be faster. You must also link with -lXext. * * Byte swapping: If the Mesa host and the X display use a different * byte order then there's some trickiness to be aware of when using * XImages. The byte ordering used for the XImage is that of the X * display, not the Mesa host. * The color-to-pixel encoding for True/DirectColor must be done * according to the display's visual red_mask, green_mask, and blue_mask. * If XPutPixel is used to put a pixel into an XImage then XPutPixel will * do byte swapping if needed. If one wants to directly "poke" the pixel * into the XImage's buffer then the pixel must be byte swapped first. In * Mesa, when byte swapping is needed we use the PF_TRUECOLOR pixel format * and use XPutPixel everywhere except in the implementation of * glClear(GL_COLOR_BUFFER_BIT). We want this function to be fast so * instead of using XPutPixel we "poke" our values after byte-swapping * the clear pixel value if needed. * */ #ifdef __CYGWIN__ #undef WIN32 #undef __WIN32__ #endif #include "glxheader.h" #include "GL/xmesa.h" #include "xmesaP.h" #include "context.h" #include "extensions.h" #include "framebuffer.h" #include "glthread.h" #include "imports.h" #include "matrix.h" #include "mtypes.h" #include "macros.h" #include "renderbuffer.h" #include "texformat.h" #include "texobj.h" #include "texstore.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "array_cache/acache.h" #include "tnl/tnl.h" #include "tnl/t_context.h" #include "tnl/t_pipeline.h" #include "drivers/common/driverfuncs.h" #ifdef XFree86Server #include #endif /* * Global X driver lock */ _glthread_Mutex _xmesa_lock; /* * Lookup tables for HPCR pixel format: */ static short hpcr_rgbTbl[3][256] = { { 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239 }, { 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239 }, { 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223 } }; /**********************************************************************/ /***** X Utility Functions *****/ /**********************************************************************/ /* * Return the host's byte order as LSBFirst or MSBFirst ala X. */ #ifndef XFree86Server static int host_byte_order( void ) { int i = 1; char *cptr = (char *) &i; return (*cptr==1) ? LSBFirst : MSBFirst; } #endif /* * Error handling. */ #ifndef XFree86Server static volatile int mesaXErrorFlag = 0; static int mesaHandleXError( XMesaDisplay *dpy, XErrorEvent *event ) { (void) dpy; (void) event; mesaXErrorFlag = 1; return 0; } #endif /* * Check if the X Shared Memory extension is available. * Return: 0 = not available * 1 = shared XImage support available * 2 = shared Pixmap support available also */ #ifndef XFree86Server static int check_for_xshm( XMesaDisplay *display ) { #ifdef USE_XSHM int major, minor, ignore; Bool pixmaps; if (XQueryExtension( display, "MIT-SHM", &ignore, &ignore, &ignore )) { if (XShmQueryVersion( display, &major, &minor, &pixmaps )==True) { return (pixmaps==True) ? 2 : 1; } else { return 0; } } else { return 0; } #else /* Can't compile XSHM support */ return 0; #endif } #endif /* * Apply gamma correction to an intensity value in [0..max]. Return the * new intensity value. */ static GLint gamma_adjust( GLfloat gamma, GLint value, GLint max ) { if (gamma == 1.0) { return value; } else { double x = (double) value / (double) max; return IROUND_POS((GLfloat) max * _mesa_pow(x, 1.0F/gamma)); } } /* * Return the true number of bits per pixel for XImages. * For example, if we request a 24-bit deep visual we may actually need/get * 32bpp XImages. This function returns the appropriate bpp. * Input: dpy - the X display * visinfo - desribes the visual to be used for XImages * Return: true number of bits per pixel for XImages */ #ifdef XFree86Server static int bits_per_pixel( XMesaVisual xmv ) { const int depth = xmv->nplanes; int i; for (i = 0; i < screenInfo.numPixmapFormats; i++) { if (screenInfo.formats[i].depth == depth) return screenInfo.formats[i].bitsPerPixel; } return depth; /* should never get here, but this should be safe */ } #else static int bits_per_pixel( XMesaVisual xmv ) { XMesaDisplay *dpy = xmv->display; XMesaVisualInfo visinfo = xmv->visinfo; XMesaImage *img; int bitsPerPixel; /* Create a temporary XImage */ img = XCreateImage( dpy, visinfo->visual, visinfo->depth, ZPixmap, 0, /*format, offset*/ (char*) MALLOC(8), /*data*/ 1, 1, /*width, height*/ 32, /*bitmap_pad*/ 0 /*bytes_per_line*/ ); assert(img); /* grab the bits/pixel value */ bitsPerPixel = img->bits_per_pixel; /* free the XImage */ _mesa_free( img->data ); img->data = NULL; XMesaDestroyImage( img ); return bitsPerPixel; } #endif /* * Determine if a given X window ID is valid (window exists). * Do this by calling XGetWindowAttributes() for the window and * checking if we catch an X error. * Input: dpy - the display * win - the window to check for existance * Return: GL_TRUE - window exists * GL_FALSE - window doesn't exist */ #ifndef XFree86Server static GLboolean WindowExistsFlag; static int window_exists_err_handler( XMesaDisplay* dpy, XErrorEvent* xerr ) { (void) dpy; if (xerr->error_code == BadWindow) { WindowExistsFlag = GL_FALSE; } return 0; } static GLboolean window_exists( XMesaDisplay *dpy, Window win ) { XWindowAttributes wa; int (*old_handler)( XMesaDisplay*, XErrorEvent* ); WindowExistsFlag = GL_TRUE; old_handler = XSetErrorHandler(window_exists_err_handler); XGetWindowAttributes( dpy, win, &wa ); /* dummy request */ XSetErrorHandler(old_handler); return WindowExistsFlag; } #endif /**********************************************************************/ /***** Linked list of XMesaBuffers *****/ /**********************************************************************/ static XMesaBuffer XMesaBufferList = NULL; /** * Allocate a new XMesaBuffer, initialize basic fields and add to * the list of all buffers. */ static XMesaBuffer alloc_xmesa_buffer(XMesaVisual vis, BufferType type, XMesaColormap cmap) { XMesaBuffer b = (XMesaBuffer) CALLOC_STRUCT(xmesa_buffer); if (b) { GLboolean swAlpha; b->display = vis->display; b->xm_visual = vis; b->type = type; b->cmap = cmap; _mesa_initialize_framebuffer(&b->mesa_buffer, &vis->mesa_visual); /* determine back buffer implementation */ if (vis->mesa_visual.doubleBufferMode) { if (vis->ximage_flag) { b->db_state = BACK_XIMAGE; } else { b->db_state = BACK_PIXMAP; } } else { b->db_state = 0; } /* Allocate the framebuffer's renderbuffers */ assert(!b->mesa_buffer.Attachment[BUFFER_FRONT_LEFT].Renderbuffer); assert(!b->mesa_buffer.Attachment[BUFFER_BACK_LEFT].Renderbuffer); /* front renderbuffer */ b->frontxrb = xmesa_new_renderbuffer(NULL, 0, vis->mesa_visual.rgbMode); _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_FRONT_LEFT, &b->frontxrb->Base); /* back renderbuffer */ if (vis->mesa_visual.doubleBufferMode) { b->backxrb =xmesa_new_renderbuffer(NULL, 0, vis->mesa_visual.rgbMode); _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_BACK_LEFT, &b->backxrb->Base); } /* determine if we need software alpha planes */ if (vis->mesa_visual.alphaBits > 0 && vis->undithered_pf != PF_8A8B8G8R && vis->undithered_pf != PF_8A8R8G8B) { /* Visual has alpha, but pixel format doesn't support it. * We'll use an alpha renderbuffer wrapper. */ swAlpha = GL_TRUE; } else { swAlpha = GL_FALSE; } _mesa_add_soft_renderbuffers(&b->mesa_buffer, GL_FALSE, /* color */ vis->mesa_visual.haveDepthBuffer, vis->mesa_visual.haveStencilBuffer, vis->mesa_visual.haveAccumBuffer, swAlpha, vis->mesa_visual.numAuxBuffers > 0 ); /* insert into linked list */ b->Next = XMesaBufferList; XMesaBufferList = b; } return b; } /* * Find an XMesaBuffer by matching X display and colormap but NOT matching * the notThis buffer. */ static XMesaBuffer find_xmesa_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis) { XMesaBuffer b; for (b=XMesaBufferList; b; b=b->Next) { if (b->display==dpy && b->cmap==cmap && b!=notThis) { return b; } } return NULL; } /* * Free an XMesaBuffer, remove from linked list, perhaps free X colormap * entries. */ static void free_xmesa_buffer(int client, XMesaBuffer buffer) { XMesaBuffer prev = NULL, b; (void) client; for (b=XMesaBufferList; b; b=b->Next) { if (b==buffer) { /* unlink bufer from list */ if (prev) prev->Next = buffer->Next; else XMesaBufferList = buffer->Next; /* Check to free X colors */ if (buffer->num_alloced>0) { /* If no other buffer uses this X colormap then free the colors. */ if (!find_xmesa_buffer(buffer->display, buffer->cmap, buffer)) { #ifdef XFree86Server (void)FreeColors(buffer->cmap, client, buffer->num_alloced, buffer->alloced_colors, 0); #else XFreeColors(buffer->display, buffer->cmap, buffer->alloced_colors, buffer->num_alloced, 0); #endif } } _mesa_free_framebuffer_data(&buffer->mesa_buffer); _mesa_free(buffer); return; } /* continue search */ prev = b; } /* buffer not found in XMesaBufferList */ _mesa_problem(NULL,"free_xmesa_buffer() - buffer not found\n"); } /* Copy X color table stuff from one XMesaBuffer to another. */ static void copy_colortable_info(XMesaBuffer dst, const XMesaBuffer src) { MEMCPY(dst->color_table, src->color_table, sizeof(src->color_table)); MEMCPY(dst->pixel_to_r, src->pixel_to_r, sizeof(src->pixel_to_r)); MEMCPY(dst->pixel_to_g, src->pixel_to_g, sizeof(src->pixel_to_g)); MEMCPY(dst->pixel_to_b, src->pixel_to_b, sizeof(src->pixel_to_b)); dst->num_alloced = src->num_alloced; MEMCPY(dst->alloced_colors, src->alloced_colors, sizeof(src->alloced_colors)); } /**********************************************************************/ /***** Misc Private Functions *****/ /**********************************************************************/ /* * Return number of bits set in n. */ static int bitcount( unsigned long n ) { int bits; for (bits=0; n>0; n=n>>1) { if (n&1) { bits++; } } return bits; } /** * Allocate a shared memory XImage back buffer for the given XMesaBuffer. * Return: GL_TRUE if success, GL_FALSE if error */ #ifndef XFree86Server static GLboolean alloc_shm_back_buffer(XMesaBuffer b, GLuint width, GLuint height) { #ifdef USE_XSHM /* * We have to do a _lot_ of error checking here to be sure we can * really use the XSHM extension. It seems different servers trigger * errors at different points if the extension won't work. Therefore * we have to be very careful... */ GC gc; int (*old_handler)( XMesaDisplay *, XErrorEvent * ); if (width == 0 || height == 0) { /* this will be true the first time we're called on 'b' */ return GL_FALSE; } b->backxrb->ximage = XShmCreateImage(b->xm_visual->display, b->xm_visual->visinfo->visual, b->xm_visual->visinfo->depth, ZPixmap, NULL, &b->shminfo, width, height); if (b->backxrb->ximage == NULL) { _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (XShmCreateImage), disabling.\n"); b->shm = 0; return GL_FALSE; } b->shminfo.shmid = shmget( IPC_PRIVATE, b->backxrb->ximage->bytes_per_line * b->backxrb->ximage->height, IPC_CREAT|0777 ); if (b->shminfo.shmid < 0) { _mesa_warning(NULL, "shmget failed while allocating back buffer.\n"); XDestroyImage( b->backxrb->ximage ); b->backxrb->ximage = NULL; _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (shmget), disabling.\n"); b->shm = 0; return GL_FALSE; } b->shminfo.shmaddr = b->backxrb->ximage->data = (char*)shmat( b->shminfo.shmid, 0, 0 ); if (b->shminfo.shmaddr == (char *) -1) { _mesa_warning(NULL, "shmat() failed while allocating back buffer.\n"); XDestroyImage( b->backxrb->ximage ); shmctl( b->shminfo.shmid, IPC_RMID, 0 ); b->backxrb->ximage = NULL; _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (shmat), disabling.\n"); b->shm = 0; return GL_FALSE; } b->shminfo.readOnly = False; mesaXErrorFlag = 0; old_handler = XSetErrorHandler( mesaHandleXError ); /* This may trigger the X protocol error we're ready to catch: */ XShmAttach( b->xm_visual->display, &b->shminfo ); XSync( b->xm_visual->display, False ); if (mesaXErrorFlag) { /* we are on a remote display, this error is normal, don't print it */ XFlush( b->xm_visual->display ); mesaXErrorFlag = 0; XDestroyImage( b->backxrb->ximage ); shmdt( b->shminfo.shmaddr ); shmctl( b->shminfo.shmid, IPC_RMID, 0 ); b->backxrb->ximage = NULL; b->shm = 0; (void) XSetErrorHandler( old_handler ); return GL_FALSE; } shmctl( b->shminfo.shmid, IPC_RMID, 0 ); /* nobody else needs it */ /* Finally, try an XShmPutImage to be really sure the extension works */ gc = XCreateGC( b->xm_visual->display, b->frontxrb->drawable, 0, NULL ); XShmPutImage( b->xm_visual->display, b->frontxrb->drawable, gc, b->backxrb->ximage, 0, 0, 0, 0, 1, 1 /*one pixel*/, False ); XSync( b->xm_visual->display, False ); XFreeGC( b->xm_visual->display, gc ); (void) XSetErrorHandler( old_handler ); if (mesaXErrorFlag) { XFlush( b->xm_visual->display ); mesaXErrorFlag = 0; XDestroyImage( b->backxrb->ximage ); shmdt( b->shminfo.shmaddr ); shmctl( b->shminfo.shmid, IPC_RMID, 0 ); b->backxrb->ximage = NULL; b->shm = 0; return GL_FALSE; } return GL_TRUE; #else /* Can't compile XSHM support */ return GL_FALSE; #endif } #endif /* * Setup an off-screen pixmap or Ximage to use as the back buffer. * Input: b - the X/Mesa buffer */ void xmesa_alloc_back_buffer( XMesaBuffer b, GLuint width, GLuint height ) { if (width == 0 || height == 0) return; if (b->db_state == BACK_XIMAGE) { /* Deallocate the old backxrb->ximage, if any */ if (b->backxrb->ximage) { #if defined(USE_XSHM) && !defined(XFree86Server) if (b->shm) { XShmDetach( b->xm_visual->display, &b->shminfo ); XDestroyImage( b->backxrb->ximage ); shmdt( b->shminfo.shmaddr ); } else #endif XMesaDestroyImage( b->backxrb->ximage ); b->backxrb->ximage = NULL; } /* Allocate new back buffer */ #ifdef XFree86Server { /* Allocate a regular XImage for the back buffer. */ b->backxrb->ximage = XMesaCreateImage(b->xm_visual->BitsPerPixel, width, height, NULL); #else if (b->shm == 0 || !alloc_shm_back_buffer(b, width, height)) { /* Allocate a regular XImage for the back buffer. */ b->backxrb->ximage = XCreateImage( b->xm_visual->display, b->xm_visual->visinfo->visual, GET_VISUAL_DEPTH(b->xm_visual), ZPixmap, 0, /* format, offset */ NULL, width, height, 8, 0 ); /* pad, bytes_per_line */ #endif if (!b->backxrb->ximage) { _mesa_warning(NULL, "alloc_back_buffer: XCreateImage failed.\n"); } b->backxrb->ximage->data = (char *) MALLOC( b->backxrb->ximage->height * b->backxrb->ximage->bytes_per_line ); if (!b->backxrb->ximage->data) { _mesa_warning(NULL, "alloc_back_buffer: MALLOC failed.\n"); XMesaDestroyImage( b->backxrb->ximage ); b->backxrb->ximage = NULL; } else { /* this call just updates the width/origin fields in the xrb */ b->backxrb->Base.AllocStorage(NULL, &b->backxrb->Base, b->backxrb->Base.InternalFormat, b->backxrb->ximage->width, b->backxrb->ximage->height); } } b->backxrb->pixmap = None; } else if (b->db_state==BACK_PIXMAP) { if (!width) width = 1; if (!height) height = 1; /* Free the old back pixmap */ if (b->backxrb->pixmap) { XMesaFreePixmap( b->xm_visual->display, b->backxrb->pixmap ); } /* Allocate new back pixmap */ b->backxrb->pixmap = XMesaCreatePixmap( b->xm_visual->display, b->frontxrb->drawable, width, height, GET_VISUAL_DEPTH(b->xm_visual) ); b->backxrb->ximage = NULL; } } /* * A replacement for XAllocColor. This function should never * fail to allocate a color. When XAllocColor fails, we return * the nearest matching color. If we have to allocate many colors * this function isn't too efficient; the XQueryColors() could be * done just once. * Written by Michael Pichler, Brian Paul, Mark Kilgard * Input: dpy - X display * cmap - X colormap * cmapSize - size of colormap * In/Out: color - the XColor struct * Output: exact - 1=exact color match, 0=closest match * alloced - 1=XAlloc worked, 0=XAlloc failed */ static void noFaultXAllocColor( int client, XMesaDisplay *dpy, XMesaColormap cmap, int cmapSize, XMesaColor *color, int *exact, int *alloced ) { #ifdef XFree86Server Pixel *ppixIn; xrgb *ctable; #else /* we'll try to cache ctable for better remote display performance */ static Display *prevDisplay = NULL; static XMesaColormap prevCmap = 0; static int prevCmapSize = 0; static XMesaColor *ctable = NULL; #endif XMesaColor subColor; int i, bestmatch; double mindist; /* 3*2^16^2 exceeds long int precision. */ (void) client; /* First try just using XAllocColor. */ #ifdef XFree86Server if (AllocColor(cmap, &color->red, &color->green, &color->blue, &color->pixel, client) == Success) { #else if (XAllocColor(dpy, cmap, color)) { #endif *exact = 1; *alloced = 1; return; } /* Alloc failed, search for closest match */ /* Retrieve color table entries. */ /* XXX alloca candidate. */ #ifdef XFree86Server ppixIn = (Pixel *) MALLOC(cmapSize * sizeof(Pixel)); ctable = (xrgb *) MALLOC(cmapSize * sizeof(xrgb)); for (i = 0; i < cmapSize; i++) { ppixIn[i] = i; } QueryColors(cmap, cmapSize, ppixIn, ctable); #else if (prevDisplay != dpy || prevCmap != cmap || prevCmapSize != cmapSize || !ctable) { /* free previously cached color table */ if (ctable) _mesa_free(ctable); /* Get the color table from X */ ctable = (XMesaColor *) MALLOC(cmapSize * sizeof(XMesaColor)); assert(ctable); for (i = 0; i < cmapSize; i++) { ctable[i].pixel = i; } XQueryColors(dpy, cmap, ctable, cmapSize); prevDisplay = dpy; prevCmap = cmap; prevCmapSize = cmapSize; } #endif /* Find best match. */ bestmatch = -1; mindist = 0.0; for (i = 0; i < cmapSize; i++) { double dr = 0.30 * ((double) color->red - (double) ctable[i].red); double dg = 0.59 * ((double) color->green - (double) ctable[i].green); double db = 0.11 * ((double) color->blue - (double) ctable[i].blue); double dist = dr * dr + dg * dg + db * db; if (bestmatch < 0 || dist < mindist) { bestmatch = i; mindist = dist; } } /* Return result. */ subColor.red = ctable[bestmatch].red; subColor.green = ctable[bestmatch].green; subColor.blue = ctable[bestmatch].blue; /* Try to allocate the closest match color. This should only * fail if the cell is read/write. Otherwise, we're incrementing * the cell's reference count. */ #ifdef XFree86Server if (AllocColor(cmap, &subColor.red, &subColor.green, &subColor.blue, &subColor.pixel, client) == Success) { #else if (XAllocColor(dpy, cmap, &subColor)) { #endif *alloced = 1; } else { /* do this to work around a problem reported by Frank Ortega */ subColor.pixel = (unsigned long) bestmatch; subColor.red = ctable[bestmatch].red; subColor.green = ctable[bestmatch].green; subColor.blue = ctable[bestmatch].blue; subColor.flags = DoRed | DoGreen | DoBlue; *alloced = 0; } #ifdef XFree86Server _mesa_free(ppixIn); _mesa_free(ctable); #else /* don't free table, save it for next time */ #endif *color = subColor; *exact = 0; } /* * Do setup for PF_GRAYSCALE pixel format. * Note that buffer may be NULL. */ static GLboolean setup_grayscale( int client, XMesaVisual v, XMesaBuffer buffer, XMesaColormap cmap ) { if (GET_VISUAL_DEPTH(v)<4 || GET_VISUAL_DEPTH(v)>16) { return GL_FALSE; } if (buffer) { XMesaBuffer prevBuffer; if (!cmap) { return GL_FALSE; } prevBuffer = find_xmesa_buffer(v->display, cmap, buffer); if (prevBuffer && (buffer->xm_visual->mesa_visual.rgbMode == prevBuffer->xm_visual->mesa_visual.rgbMode)) { /* Copy colormap stuff from previous XMesaBuffer which uses same * X colormap. Do this to avoid time spent in noFaultXAllocColor. */ copy_colortable_info(buffer, prevBuffer); } else { /* Allocate 256 shades of gray */ int gray; int colorsfailed = 0; for (gray=0;gray<256;gray++) { GLint r = gamma_adjust( v->RedGamma, gray, 255 ); GLint g = gamma_adjust( v->GreenGamma, gray, 255 ); GLint b = gamma_adjust( v->BlueGamma, gray, 255 ); int exact, alloced; XMesaColor xcol; xcol.red = (r << 8) | r; xcol.green = (g << 8) | g; xcol.blue = (b << 8) | b; noFaultXAllocColor( client, v->display, cmap, GET_COLORMAP_SIZE(v), &xcol, &exact, &alloced ); if (!exact) { colorsfailed++; } if (alloced) { assert(buffer->num_alloced<256); buffer->alloced_colors[buffer->num_alloced] = xcol.pixel; buffer->num_alloced++; } /*OLD assert(gray < 576); buffer->color_table[gray*3+0] = xcol.pixel; buffer->color_table[gray*3+1] = xcol.pixel; buffer->color_table[gray*3+2] = xcol.pixel; assert(xcol.pixel < 65536); buffer->pixel_to_r[xcol.pixel] = gray * 30 / 100; buffer->pixel_to_g[xcol.pixel] = gray * 59 / 100; buffer->pixel_to_b[xcol.pixel] = gray * 11 / 100; */ buffer->color_table[gray] = xcol.pixel; assert(xcol.pixel < 65536); buffer->pixel_to_r[xcol.pixel] = gray; buffer->pixel_to_g[xcol.pixel] = gray; buffer->pixel_to_b[xcol.pixel] = gray; } if (colorsfailed && _mesa_getenv("MESA_DEBUG")) { _mesa_warning(NULL, "Note: %d out of 256 needed colors do not match exactly.\n", colorsfailed ); } } } v->dithered_pf = PF_Grayscale; v->undithered_pf = PF_Grayscale; return GL_TRUE; } /* * Setup RGB rendering for a window with a PseudoColor, StaticColor, * or 8-bit TrueColor visual visual. We try to allocate a palette of 225 * colors (5 red, 9 green, 5 blue) and dither to approximate a 24-bit RGB * color. While this function was originally designed just for 8-bit * visuals, it has also proven to work from 4-bit up to 16-bit visuals. * Dithering code contributed by Bob Mercier. */ static GLboolean setup_dithered_color( int client, XMesaVisual v, XMesaBuffer buffer, XMesaColormap cmap ) { if (GET_VISUAL_DEPTH(v)<4 || GET_VISUAL_DEPTH(v)>16) { return GL_FALSE; } if (buffer) { XMesaBuffer prevBuffer; if (!cmap) { return GL_FALSE; } prevBuffer = find_xmesa_buffer(v->display, cmap, buffer); if (prevBuffer && (buffer->xm_visual->mesa_visual.rgbMode == prevBuffer->xm_visual->mesa_visual.rgbMode)) { /* Copy colormap stuff from previous, matching XMesaBuffer. * Do this to avoid time spent in noFaultXAllocColor. */ copy_colortable_info(buffer, prevBuffer); } else { /* Allocate X colors and initialize color_table[], red_table[], etc */ int r, g, b, i; int colorsfailed = 0; for (r = 0; r < DITH_R; r++) { for (g = 0; g < DITH_G; g++) { for (b = 0; b < DITH_B; b++) { XMesaColor xcol; int exact, alloced; xcol.red =gamma_adjust(v->RedGamma, r*65535/(DITH_R-1),65535); xcol.green=gamma_adjust(v->GreenGamma, g*65535/(DITH_G-1),65535); xcol.blue =gamma_adjust(v->BlueGamma, b*65535/(DITH_B-1),65535); noFaultXAllocColor( client, v->display, cmap, GET_COLORMAP_SIZE(v), &xcol, &exact, &alloced ); if (!exact) { colorsfailed++; } if (alloced) { assert(buffer->num_alloced<256); buffer->alloced_colors[buffer->num_alloced] = xcol.pixel; buffer->num_alloced++; } i = DITH_MIX( r, g, b ); assert(i < 576); buffer->color_table[i] = xcol.pixel; assert(xcol.pixel < 65536); buffer->pixel_to_r[xcol.pixel] = r * 255 / (DITH_R-1); buffer->pixel_to_g[xcol.pixel] = g * 255 / (DITH_G-1); buffer->pixel_to_b[xcol.pixel] = b * 255 / (DITH_B-1); } } } if (colorsfailed && _mesa_getenv("MESA_DEBUG")) { _mesa_warning(NULL, "Note: %d out of %d needed colors do not match exactly.\n", colorsfailed, DITH_R * DITH_G * DITH_B ); } } } v->dithered_pf = PF_Dither; v->undithered_pf = PF_Lookup; return GL_TRUE; } /* * Setup for Hewlett Packard Color Recovery 8-bit TrueColor mode. * HPCR simulates 24-bit color fidelity with an 8-bit frame buffer. * Special dithering tables have to be initialized. */ static void setup_8bit_hpcr( XMesaVisual v ) { /* HP Color Recovery contributed by: Alex De Bruyn (ad@lms.be) * To work properly, the atom _HP_RGB_SMOOTH_MAP_LIST must be defined * on the root window AND the colormap obtainable by XGetRGBColormaps * for that atom must be set on the window. (see also tkInitWindow) * If that colormap is not set, the output will look stripy. */ /* Setup color tables with gamma correction */ int i; double g; g = 1.0 / v->RedGamma; for (i=0; i<256; i++) { GLint red = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[0][i]/255.0, g )); v->hpcr_rgbTbl[0][i] = CLAMP( red, 16, 239 ); } g = 1.0 / v->GreenGamma; for (i=0; i<256; i++) { GLint green = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[1][i]/255.0, g )); v->hpcr_rgbTbl[1][i] = CLAMP( green, 16, 239 ); } g = 1.0 / v->BlueGamma; for (i=0; i<256; i++) { GLint blue = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[2][i]/255.0, g )); v->hpcr_rgbTbl[2][i] = CLAMP( blue, 32, 223 ); } v->undithered_pf = PF_HPCR; /* can't really disable dithering for now */ v->dithered_pf = PF_HPCR; /* which method should I use to clear */ /* GL_FALSE: keep the ordinary method */ /* GL_TRUE : clear with dither pattern */ v->hpcr_clear_flag = _mesa_getenv("MESA_HPCR_CLEAR") ? GL_TRUE : GL_FALSE; if (v->hpcr_clear_flag) { v->hpcr_clear_pixmap = XMesaCreatePixmap(v->display, DefaultRootWindow(v->display), 16, 2, 8); #ifndef XFree86Server v->hpcr_clear_ximage = XGetImage(v->display, v->hpcr_clear_pixmap, 0, 0, 16, 2, AllPlanes, ZPixmap); #endif } } /* * Setup RGB rendering for a window with a True/DirectColor visual. */ static void setup_truecolor( XMesaVisual v, XMesaBuffer buffer, XMesaColormap cmap ) { unsigned long rmask, gmask, bmask; (void) buffer; (void) cmap; /* Compute red multiplier (mask) and bit shift */ v->rshift = 0; rmask = GET_REDMASK(v); while ((rmask & 1)==0) { v->rshift++; rmask = rmask >> 1; } /* Compute green multiplier (mask) and bit shift */ v->gshift = 0; gmask = GET_GREENMASK(v); while ((gmask & 1)==0) { v->gshift++; gmask = gmask >> 1; } /* Compute blue multiplier (mask) and bit shift */ v->bshift = 0; bmask = GET_BLUEMASK(v); while ((bmask & 1)==0) { v->bshift++; bmask = bmask >> 1; } /* * Compute component-to-pixel lookup tables and dithering kernel */ { static GLubyte kernel[16] = { 0*16, 8*16, 2*16, 10*16, 12*16, 4*16, 14*16, 6*16, 3*16, 11*16, 1*16, 9*16, 15*16, 7*16, 13*16, 5*16, }; GLint rBits = bitcount(rmask); GLint gBits = bitcount(gmask); GLint bBits = bitcount(bmask); GLint maxBits; GLuint i; /* convert pixel components in [0,_mask] to RGB values in [0,255] */ for (i=0; i<=rmask; i++) v->PixelToR[i] = (unsigned char) ((i * 255) / rmask); for (i=0; i<=gmask; i++) v->PixelToG[i] = (unsigned char) ((i * 255) / gmask); for (i=0; i<=bmask; i++) v->PixelToB[i] = (unsigned char) ((i * 255) / bmask); /* convert RGB values from [0,255] to pixel components */ for (i=0;i<256;i++) { GLint r = gamma_adjust(v->RedGamma, i, 255); GLint g = gamma_adjust(v->GreenGamma, i, 255); GLint b = gamma_adjust(v->BlueGamma, i, 255); v->RtoPixel[i] = (r >> (8-rBits)) << v->rshift; v->GtoPixel[i] = (g >> (8-gBits)) << v->gshift; v->BtoPixel[i] = (b >> (8-bBits)) << v->bshift; } /* overflow protection */ for (i=256;i<512;i++) { v->RtoPixel[i] = v->RtoPixel[255]; v->GtoPixel[i] = v->GtoPixel[255]; v->BtoPixel[i] = v->BtoPixel[255]; } /* setup dithering kernel */ maxBits = rBits; if (gBits > maxBits) maxBits = gBits; if (bBits > maxBits) maxBits = bBits; for (i=0;i<16;i++) { v->Kernel[i] = kernel[i] >> maxBits; } v->undithered_pf = PF_Truecolor; v->dithered_pf = (GET_VISUAL_DEPTH(v)<24) ? PF_Dither_True : PF_Truecolor; } /* * Now check for TrueColor visuals which we can optimize. */ if ( GET_REDMASK(v) ==0x0000ff && GET_GREENMASK(v)==0x00ff00 && GET_BLUEMASK(v) ==0xff0000 && CHECK_BYTE_ORDER(v) && v->BitsPerPixel==32 && sizeof(GLuint)==4 && v->RedGamma==1.0 && v->GreenGamma==1.0 && v->BlueGamma==1.0) { /* common 32 bpp config used on SGI, Sun */ v->undithered_pf = v->dithered_pf = PF_8A8B8G8R; } else if (GET_REDMASK(v) ==0xff0000 && GET_GREENMASK(v)==0x00ff00 && GET_BLUEMASK(v) ==0x0000ff && CHECK_BYTE_ORDER(v) && v->BitsPerPixel==32 && sizeof(GLuint)==4 && v->RedGamma==1.0 && v->GreenGamma==1.0 && v->BlueGamma==1.0) { /* common 32 bpp config used on Linux, HP, IBM */ if (GET_VISUAL_DEPTH(v)==32) v->undithered_pf = v->dithered_pf = PF_8A8R8G8B; else v->undithered_pf = v->dithered_pf = PF_8R8G8B; } else if (GET_REDMASK(v) ==0xff0000 && GET_GREENMASK(v)==0x00ff00 && GET_BLUEMASK(v) ==0x0000ff && CHECK_BYTE_ORDER(v) && v->BitsPerPixel==24 && sizeof(GLuint)==4 && v->RedGamma==1.0 && v->GreenGamma==1.0 && v->BlueGamma==1.0) { /* common packed 24 bpp config used on Linux */ v->undithered_pf = v->dithered_pf = PF_8R8G8B24; } else if (GET_REDMASK(v) ==0xf800 && GET_GREENMASK(v)==0x07e0 && GET_BLUEMASK(v) ==0x001f && CHECK_BYTE_ORDER(v) && v->BitsPerPixel==16 && sizeof(GLushort)==2 && v->RedGamma==1.0 && v->GreenGamma==1.0 && v->BlueGamma==1.0) { /* 5-6-5 color weight on common PC VGA boards */ v->undithered_pf = PF_5R6G5B; v->dithered_pf = PF_Dither_5R6G5B; } else if (GET_REDMASK(v) ==0xe0 && GET_GREENMASK(v)==0x1c && GET_BLUEMASK(v) ==0x03 && CHECK_FOR_HPCR(v)) { setup_8bit_hpcr( v ); } } /* * Setup RGB rendering for a window with a monochrome visual. */ static void setup_monochrome( XMesaVisual v, XMesaBuffer b ) { (void) b; v->dithered_pf = v->undithered_pf = PF_1Bit; /* if black=1 then we must flip pixel values */ v->bitFlip = (GET_BLACK_PIXEL(v) != 0); } /* * When a context is "made current" for the first time, we can finally * finish initializing the context's visual and buffer information. * Input: v - the XMesaVisual to initialize * b - the XMesaBuffer to initialize (may be NULL) * rgb_flag - TRUE = RGBA mode, FALSE = color index mode * window - the window/pixmap we're rendering into * cmap - the colormap associated with the window/pixmap * Return: GL_TRUE=success, GL_FALSE=failure */ static GLboolean initialize_visual_and_buffer( int client, XMesaVisual v, XMesaBuffer b, GLboolean rgb_flag, XMesaDrawable window, XMesaColormap cmap ) { struct xmesa_renderbuffer *front_xrb, *back_xrb; #ifndef XFree86Server XGCValues gcvalues; #endif if (b) { assert(b->xm_visual == v); } if (b) { front_xrb = b->frontxrb; back_xrb = b->backxrb; } else { front_xrb = back_xrb = NULL; } /* Save true bits/pixel */ v->BitsPerPixel = bits_per_pixel(v); assert(v->BitsPerPixel > 0); if (rgb_flag==GL_FALSE) { /* COLOR-INDEXED WINDOW: * Even if the visual is TrueColor or DirectColor we treat it as * being color indexed. This is weird but might be useful to someone. */ v->dithered_pf = v->undithered_pf = PF_Index; v->mesa_visual.indexBits = GET_VISUAL_DEPTH(v); } else { /* RGB WINDOW: * We support RGB rendering into almost any kind of visual. */ const int xclass = v->mesa_visual.visualType; if (xclass==GLX_TRUE_COLOR || xclass==GLX_DIRECT_COLOR) { setup_truecolor( v, b, cmap ); } else if (xclass==GLX_STATIC_GRAY && GET_VISUAL_DEPTH(v)==1) { setup_monochrome( v, b ); } else if (xclass==GLX_GRAY_SCALE || xclass==GLX_STATIC_GRAY) { if (!setup_grayscale( client, v, b, cmap )) { return GL_FALSE; } } else if ((xclass==GLX_PSEUDO_COLOR || xclass==GLX_STATIC_COLOR) && GET_VISUAL_DEPTH(v)>=4 && GET_VISUAL_DEPTH(v)<=16) { if (!setup_dithered_color( client, v, b, cmap )) { return GL_FALSE; } } else { _mesa_warning(NULL, "XMesa: RGB mode rendering not supported in given visual.\n"); return GL_FALSE; } v->mesa_visual.indexBits = 0; if (_mesa_getenv("MESA_NO_DITHER")) { v->dithered_pf = v->undithered_pf; } } /* * If MESA_INFO env var is set print out some debugging info * which can help Brian figure out what's going on when a user * reports bugs. */ if (_mesa_getenv("MESA_INFO")) { _mesa_printf("X/Mesa visual = %p\n", (void *) v); _mesa_printf("X/Mesa dithered pf = %u\n", v->dithered_pf); _mesa_printf("X/Mesa undithered pf = %u\n", v->undithered_pf); _mesa_printf("X/Mesa level = %d\n", v->mesa_visual.level); _mesa_printf("X/Mesa depth = %d\n", GET_VISUAL_DEPTH(v)); _mesa_printf("X/Mesa bits per pixel = %d\n", v->BitsPerPixel); } if (b && window) { /* Do window-specific initializations */ b->frontxrb->drawable = window; b->frontxrb->pixmap = (XMesaPixmap) window; /* Setup for single/double buffering */ if (v->mesa_visual.doubleBufferMode) { /* Double buffered */ #ifndef XFree86Server b->shm = check_for_xshm( v->display ); #endif xmesa_alloc_back_buffer(b, b->mesa_buffer.Width, b->mesa_buffer.Height); } /* X11 graphics contexts */ #ifdef XFree86Server b->gc = CreateScratchGC(v->display, window->depth); #else b->gc = XCreateGC( v->display, window, 0, NULL ); #endif XMesaSetFunction( v->display, b->gc, GXcopy ); /* cleargc - for glClear() */ #ifdef XFree86Server b->cleargc = CreateScratchGC(v->display, window->depth); #else b->cleargc = XCreateGC( v->display, window, 0, NULL ); #endif XMesaSetFunction( v->display, b->cleargc, GXcopy ); /* * Don't generate Graphics Expose/NoExpose events in swapbuffers(). * Patch contributed by Michael Pichler May 15, 1995. */ #ifdef XFree86Server b->swapgc = CreateScratchGC(v->display, window->depth); { CARD32 v[1]; v[0] = FALSE; dixChangeGC(NullClient, b->swapgc, GCGraphicsExposures, v, NULL); } #else gcvalues.graphics_exposures = False; b->swapgc = XCreateGC( v->display, window, GCGraphicsExposures, &gcvalues); #endif XMesaSetFunction( v->display, b->swapgc, GXcopy ); /* * Set fill style and tile pixmap once for all for HPCR stuff * (instead of doing it each time in clear_color_HPCR_pixmap()) * Initialize whole stuff * Patch contributed by Jacques Leroy March 8, 1998. */ if (v->hpcr_clear_flag && back_xrb->pixmap) { int i; for (i=0; i<16; i++) { XMesaPutPixel(v->hpcr_clear_ximage, i, 0, 0); XMesaPutPixel(v->hpcr_clear_ximage, i, 1, 0); } XMesaPutImage(b->display, (XMesaDrawable)v->hpcr_clear_pixmap, b->cleargc, v->hpcr_clear_ximage, 0, 0, 0, 0, 16, 2); XMesaSetFillStyle( v->display, b->cleargc, FillTiled); XMesaSetTile( v->display, b->cleargc, v->hpcr_clear_pixmap ); } /* Initialize the row buffer XImage for use in write_color_span() */ #ifdef XFree86Server b->rowimage = XMesaCreateImage(GET_VISUAL_DEPTH(v), MAX_WIDTH, 1, (char *)MALLOC(MAX_WIDTH*4)); #else b->rowimage = XCreateImage( v->display, v->visinfo->visual, v->visinfo->depth, ZPixmap, 0, /*format, offset*/ (char*) MALLOC(MAX_WIDTH*4), /*data*/ MAX_WIDTH, 1, /*width, height*/ 32, /*bitmap_pad*/ 0 /*bytes_per_line*/ ); #endif if (!b->rowimage) return GL_FALSE; } return GL_TRUE; } /* * Convert an RGBA color to a pixel value. */ unsigned long xmesa_color_to_pixel(GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLuint pixelFormat) { XMesaContext xmesa = XMESA_CONTEXT(ctx); switch (pixelFormat) { case PF_Index: return 0; case PF_Truecolor: { unsigned long p; PACK_TRUECOLOR( p, r, g, b ); return p; } case PF_8A8B8G8R: return PACK_8A8B8G8R( r, g, b, a ); case PF_8A8R8G8B: return PACK_8A8R8G8B( r, g, b, a ); case PF_8R8G8B: /* fall through */ case PF_8R8G8B24: return PACK_8R8G8B( r, g, b ); case PF_5R6G5B: return PACK_5R6G5B( r, g, b ); case PF_Dither: { DITHER_SETUP; return DITHER( 1, 0, r, g, b ); } case PF_1Bit: /* 382 = (3*255)/2 */ return ((r+g+b) > 382) ^ xmesa->xm_visual->bitFlip; case PF_HPCR: return DITHER_HPCR(1, 1, r, g, b); case PF_Lookup: { LOOKUP_SETUP; return LOOKUP( r, g, b ); } case PF_Grayscale: return GRAY_RGB( r, g, b ); case PF_Dither_True: /* fall through */ case PF_Dither_5R6G5B: { unsigned long p; PACK_TRUEDITHER(p, 1, 0, r, g, b); return p; } default: _mesa_problem(ctx, "Bad pixel format in xmesa_color_to_pixel"); } return 0; } #define NUM_VISUAL_TYPES 6 /** * Convert an X visual type to a GLX visual type. * * \param visualType X visual type (i.e., \c TrueColor, \c StaticGray, etc.) * to be converted. * \return If \c visualType is a valid X visual type, a GLX visual type will * be returned. Otherwise \c GLX_NONE will be returned. * * \note * This code was lifted directly from lib/GL/glx/glcontextmodes.c in the * DRI CVS tree. */ static GLint xmesa_convert_from_x_visual_type( int visualType ) { static const int glx_visual_types[ NUM_VISUAL_TYPES ] = { GLX_STATIC_GRAY, GLX_GRAY_SCALE, GLX_STATIC_COLOR, GLX_PSEUDO_COLOR, GLX_TRUE_COLOR, GLX_DIRECT_COLOR }; return ( (unsigned) visualType < NUM_VISUAL_TYPES ) ? glx_visual_types[ visualType ] : GLX_NONE; } /**********************************************************************/ /***** Public Functions *****/ /**********************************************************************/ /* * Create a new X/Mesa visual. * Input: display - X11 display * visinfo - an XVisualInfo pointer * rgb_flag - GL_TRUE = RGB mode, * GL_FALSE = color index mode * alpha_flag - alpha buffer requested? * db_flag - GL_TRUE = double-buffered, * GL_FALSE = single buffered * stereo_flag - stereo visual? * ximage_flag - GL_TRUE = use an XImage for back buffer, * GL_FALSE = use an off-screen pixmap for back buffer * depth_size - requested bits/depth values, or zero * stencil_size - requested bits/stencil values, or zero * accum_red_size - requested bits/red accum values, or zero * accum_green_size - requested bits/green accum values, or zero * accum_blue_size - requested bits/blue accum values, or zero * accum_alpha_size - requested bits/alpha accum values, or zero * num_samples - number of samples/pixel if multisampling, or zero * level - visual level, usually 0 * visualCaveat - ala the GLX extension, usually GLX_NONE * Return; a new XMesaVisual or 0 if error. */ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, XMesaVisualInfo visinfo, GLboolean rgb_flag, GLboolean alpha_flag, GLboolean db_flag, GLboolean stereo_flag, GLboolean ximage_flag, GLint depth_size, GLint stencil_size, GLint accum_red_size, GLint accum_green_size, GLint accum_blue_size, GLint accum_alpha_size, GLint num_samples, GLint level, GLint visualCaveat ) { char *gamma; XMesaVisual v; GLint red_bits, green_bits, blue_bits, alpha_bits; /* For debugging only */ if (_mesa_getenv("MESA_XSYNC")) { /* This makes debugging X easier. * In your debugger, set a breakpoint on _XError to stop when an * X protocol error is generated. */ #ifdef XFree86Server /* NOT_NEEDED */ #else XSynchronize( display, 1 ); #endif } v = (XMesaVisual) CALLOC_STRUCT(xmesa_visual); if (!v) { return NULL; } /* * In the X server, NULL is passed in for the display. It will have * to be set before using this visual. See XMesaSetVisualDisplay() * below. */ v->display = display; /* Save a copy of the XVisualInfo struct because the user may X_mesa_free() * the struct but we may need some of the information contained in it * at a later time. */ #ifndef XFree86Server v->visinfo = (XVisualInfo *) MALLOC(sizeof(*visinfo)); if(!v->visinfo) { _mesa_free(v); return NULL; } MEMCPY(v->visinfo, visinfo, sizeof(*visinfo)); #endif /* check for MESA_GAMMA environment variable */ gamma = _mesa_getenv("MESA_GAMMA"); if (gamma) { v->RedGamma = v->GreenGamma = v->BlueGamma = 0.0; sscanf( gamma, "%f %f %f", &v->RedGamma, &v->GreenGamma, &v->BlueGamma ); if (v->RedGamma<=0.0) v->RedGamma = 1.0; if (v->GreenGamma<=0.0) v->GreenGamma = v->RedGamma; if (v->BlueGamma<=0.0) v->BlueGamma = v->RedGamma; } else { v->RedGamma = v->GreenGamma = v->BlueGamma = 1.0; } v->ximage_flag = ximage_flag; #ifdef XFree86Server /* We could calculate these values by ourselves. nplanes is either the sum * of the red, green, and blue bits or the number index bits. * ColormapEntries is either (1U << index_bits) or * (1U << max(redBits, greenBits, blueBits)). */ v->nplanes = visinfo->nplanes; v->ColormapEntries = visinfo->ColormapEntries; v->mesa_visual.redMask = visinfo->redMask; v->mesa_visual.greenMask = visinfo->greenMask; v->mesa_visual.blueMask = visinfo->blueMask; v->mesa_visual.visualID = visinfo->vid; v->mesa_visual.screen = 0; /* FIXME: What should be done here? */ #else v->mesa_visual.redMask = visinfo->red_mask; v->mesa_visual.greenMask = visinfo->green_mask; v->mesa_visual.blueMask = visinfo->blue_mask; v->mesa_visual.visualID = visinfo->visualid; v->mesa_visual.screen = visinfo->screen; #endif #if defined(XFree86Server) || !(defined(__cplusplus) || defined(c_plusplus)) v->mesa_visual.visualType = xmesa_convert_from_x_visual_type(visinfo->class); #else v->mesa_visual.visualType = xmesa_convert_from_x_visual_type(visinfo->c_class); #endif v->mesa_visual.visualRating = visualCaveat; (void) initialize_visual_and_buffer( 0, v, NULL, rgb_flag, 0, 0 ); { const int xclass = v->mesa_visual.visualType; if (xclass==GLX_TRUE_COLOR || xclass==GLX_DIRECT_COLOR) { red_bits = bitcount(GET_REDMASK(v)); green_bits = bitcount(GET_GREENMASK(v)); blue_bits = bitcount(GET_BLUEMASK(v)); alpha_bits = 0; } else { /* this is an approximation */ int depth; depth = GET_VISUAL_DEPTH(v); red_bits = depth / 3; depth -= red_bits; green_bits = depth / 2; depth -= green_bits; blue_bits = depth; alpha_bits = 0; assert( red_bits + green_bits + blue_bits == GET_VISUAL_DEPTH(v) ); } } if (alpha_flag && alpha_bits == 0) alpha_bits = 8; _mesa_initialize_visual( &v->mesa_visual, rgb_flag, db_flag, stereo_flag, red_bits, green_bits, blue_bits, alpha_bits, v->mesa_visual.indexBits, depth_size, stencil_size, accum_red_size, accum_green_size, accum_blue_size, accum_alpha_size, 0 ); /* XXX minor hack */ v->mesa_visual.level = level; return v; } void XMesaSetVisualDisplay( XMesaDisplay *dpy, XMesaVisual v ) { v->display = dpy; } void XMesaDestroyVisual( XMesaVisual v ) { #ifndef XFree86Server _mesa_free(v->visinfo); #endif _mesa_free(v); } /** * Create a new XMesaContext. * \param v the XMesaVisual * \param share_list another XMesaContext with which to share display * lists or NULL if no sharing is wanted. * \return an XMesaContext or NULL if error. */ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) { static GLboolean firstTime = GL_TRUE; XMesaContext c; GLcontext *mesaCtx; struct dd_function_table functions; TNLcontext *tnl; if (firstTime) { _glthread_INIT_MUTEX(_xmesa_lock); firstTime = GL_FALSE; } /* Note: the XMesaContext contains a Mesa GLcontext struct (inheritance) */ c = (XMesaContext) CALLOC_STRUCT(xmesa_context); if (!c) return NULL; mesaCtx = &(c->mesa); /* initialize with default driver functions, then plug in XMesa funcs */ _mesa_init_driver_functions(&functions); xmesa_init_driver_functions(v, &functions); if (!_mesa_initialize_context(mesaCtx, &v->mesa_visual, share_list ? &(share_list->mesa) : (GLcontext *) NULL, &functions, (void *) c)) { _mesa_free(c); return NULL; } _mesa_enable_sw_extensions(mesaCtx); _mesa_enable_1_3_extensions(mesaCtx); _mesa_enable_1_4_extensions(mesaCtx); _mesa_enable_1_5_extensions(mesaCtx); _mesa_enable_2_0_extensions(mesaCtx); #if SWTC if (c->Mesa_DXTn) { _mesa_enable_extension(c, "GL_EXT_texture_compression_s3tc"); _mesa_enable_extension(c, "GL_S3_s3tc"); } _mesa_enable_extension(c, "GL_3DFX_texture_compression_FXT1"); #endif /* finish up xmesa context initializations */ c->swapbytes = CHECK_BYTE_ORDER(v) ? GL_FALSE : GL_TRUE; c->xm_visual = v; c->xm_buffer = NULL; /* set later by XMesaMakeCurrent */ c->display = v->display; c->pixelformat = v->dithered_pf; /* Dithering is enabled by default */ /* Initialize the software rasterizer and helper modules. */ if (!_swrast_CreateContext( mesaCtx ) || !_ac_CreateContext( mesaCtx ) || !_tnl_CreateContext( mesaCtx ) || !_swsetup_CreateContext( mesaCtx )) { _mesa_free_context_data(&c->mesa); _mesa_free(c); return NULL; } /* tnl setup */ tnl = TNL_CONTEXT(mesaCtx); tnl->Driver.RunPipeline = _tnl_run_pipeline; /* swrast setup */ xmesa_register_swrast_functions( mesaCtx ); _swsetup_Wakeup(mesaCtx); return c; } void XMesaDestroyContext( XMesaContext c ) { GLcontext *mesaCtx = &c->mesa; #ifdef FX XMesaBuffer xmbuf = XMESA_BUFFER(mesaCtx->DrawBuffer); if (xmbuf && xmbuf->FXctx) fxMesaDestroyContext(xmbuf->FXctx); #endif _swsetup_DestroyContext( mesaCtx ); _swrast_DestroyContext( mesaCtx ); _tnl_DestroyContext( mesaCtx ); _ac_DestroyContext( mesaCtx ); _mesa_free_context_data( mesaCtx ); _mesa_free( c ); } /* * XXX this isn't a public function! It's a hack for the 3Dfx driver. * Create a new XMesaBuffer from an X window. * Input: v - the XMesaVisual * w - the window * c - the context * Return: new XMesaBuffer or NULL if error */ XMesaBuffer XMesaCreateWindowBuffer2(XMesaVisual v, XMesaWindow w, XMesaContext c) { #ifndef XFree86Server XWindowAttributes attr; #endif #ifdef FX char *fxEnvVar; #endif int client = 0; XMesaBuffer b; XMesaColormap cmap; assert(v); (void) c; /* Check that window depth matches visual depth */ #ifdef XFree86Server client = CLIENT_ID(((XMesaDrawable)w)->id); if (GET_VISUAL_DEPTH(v) != ((XMesaDrawable)w)->depth) { _mesa_warning(NULL, "XMesaCreateWindowBuffer: depth mismatch between visual (%d) and window (%d)!\n", GET_VISUAL_DEPTH(v), ((XMesaDrawable) w)->depth); return NULL; } #else XGetWindowAttributes( v->display, w, &attr ); if (GET_VISUAL_DEPTH(v) != attr.depth) { _mesa_warning(NULL, "XMesaCreateWindowBuffer: depth mismatch between visual (%d) and window (%d)!\n", GET_VISUAL_DEPTH(v), attr.depth); return NULL; } #endif /* Find colormap */ #ifdef XFree86Server cmap = (ColormapPtr)LookupIDByType(wColormap(w), RT_COLORMAP); #else if (attr.colormap) { cmap = attr.colormap; } else { _mesa_warning(NULL, "Window %u has no colormap!\n", (unsigned int) w); /* this is weird, a window w/out a colormap!? */ /* OK, let's just allocate a new one and hope for the best */ cmap = XCreateColormap(v->display, w, attr.visual, AllocNone); } #endif b = alloc_xmesa_buffer(v, WINDOW, cmap); if (!b) { return NULL; } if (!initialize_visual_and_buffer( client, v, b, v->mesa_visual.rgbMode, (XMesaDrawable)w, cmap )) { free_xmesa_buffer(client, b); return NULL; } #ifdef FX fxEnvVar = _mesa_getenv("MESA_GLX_FX"); if (fxEnvVar) { if (fxEnvVar[0]!='d') { int attribs[100]; int numAttribs = 0; int hw; if (v->mesa_visual.depthBits > 0) { attribs[numAttribs++] = FXMESA_DEPTH_SIZE; attribs[numAttribs++] = v->mesa_visual.depthBits; } if (v->mesa_visual.doubleBufferMode) { attribs[numAttribs++] = FXMESA_DOUBLEBUFFER; } if (v->mesa_visual.accumRedBits > 0) { attribs[numAttribs++] = FXMESA_ACCUM_SIZE; attribs[numAttribs++] = v->mesa_visual.accumRedBits; } if (v->mesa_visual.stencilBits > 0) { attribs[numAttribs++] = FXMESA_STENCIL_SIZE; attribs[numAttribs++] = v->mesa_visual.stencilBits; } if (v->mesa_visual.alphaBits > 0) { attribs[numAttribs++] = FXMESA_ALPHA_SIZE; attribs[numAttribs++] = v->mesa_visual.alphaBits; } if (1) { attribs[numAttribs++] = FXMESA_SHARE_CONTEXT; attribs[numAttribs++] = (int) &(c->mesa); } attribs[numAttribs++] = FXMESA_NONE; /* [dBorca] we should take an envvar for `fxMesaSelectCurrentBoard'!!! */ hw = fxMesaSelectCurrentBoard(0); /* if these fail, there's a new bug somewhere */ ASSERT(b->mesa_buffer.Width > 0); ASSERT(b->mesa_buffer.Height > 0); if ((hw == GR_SSTTYPE_VOODOO) || (hw == GR_SSTTYPE_Voodoo2)) { b->FXctx = fxMesaCreateBestContext(0, b->mesa_buffer.Width, b->mesa_buffer.Height, attribs); if ((v->undithered_pf!=PF_Index) && (b->backxrb->ximage)) { b->FXisHackUsable = b->FXctx ? GL_TRUE : GL_FALSE; if (b->FXctx && (fxEnvVar[0]=='w' || fxEnvVar[0]=='W')) { b->FXwindowHack = GL_TRUE; FX_grSstControl(GR_CONTROL_DEACTIVATE); } else { b->FXwindowHack = GL_FALSE; } } } else { if (fxEnvVar[0]=='w' || fxEnvVar[0]=='W') b->FXctx = fxMesaCreateContext(w, GR_RESOLUTION_NONE, GR_REFRESH_75Hz, attribs); else b->FXctx = fxMesaCreateBestContext(0, b->mesa_buffer.Width, b->mesa_buffer.Height, attribs); b->FXisHackUsable = GL_FALSE; b->FXwindowHack = GL_FALSE; } /* fprintf(stderr, "voodoo %d, wid %d height %d hack: usable %d active %d\n", hw, b->mesa_buffer.Width, b->mesa_buffer.Height, b->FXisHackUsable, b->FXwindowHack); */ } } else { _mesa_warning(NULL, "WARNING: This Mesa Library includes the Glide driver but\n"); _mesa_warning(NULL, " you have not defined the MESA_GLX_FX env. var.\n"); _mesa_warning(NULL, " (check the README.3DFX file for more information).\n\n"); _mesa_warning(NULL, " you can disable this message with a 'export MESA_GLX_FX=disable'.\n"); } #endif return b; } XMesaBuffer XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w) { return XMesaCreateWindowBuffer2( v, w, NULL ); } /** * Create a new XMesaBuffer from an X pixmap. * * \param v the XMesaVisual * \param p the pixmap * \param cmap the colormap, may be 0 if using a \c GLX_TRUE_COLOR or * \c GLX_DIRECT_COLOR visual for the pixmap * \returns new XMesaBuffer or NULL if error */ XMesaBuffer XMesaCreatePixmapBuffer(XMesaVisual v, XMesaPixmap p, XMesaColormap cmap) { int client = 0; XMesaBuffer b; assert(v); b = alloc_xmesa_buffer(v, PIXMAP, cmap); if (!b) { return NULL; } #ifdef XFree86Server client = CLIENT_ID(((XMesaDrawable)p)->id); #endif if (!initialize_visual_and_buffer(client, v, b, v->mesa_visual.rgbMode, (XMesaDrawable)p, cmap)) { free_xmesa_buffer(client, b); return NULL; } return b; } XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap, unsigned int width, unsigned int height) { #ifdef XFree86Server return 0; #else int client = 0; XMesaWindow root; XMesaDrawable drawable; /* X Pixmap Drawable */ XMesaBuffer b; b = alloc_xmesa_buffer(v, PBUFFER, cmap); if (!b) { return NULL; } /* allocate pixmap for front buffer */ root = RootWindow( v->display, v->visinfo->screen ); drawable = XCreatePixmap( v->display, root, width, height, v->visinfo->depth ); if (!initialize_visual_and_buffer(client, v, b, v->mesa_visual.rgbMode, drawable, cmap)) { free_xmesa_buffer(client, b); return NULL; } return b; #endif } /* * Deallocate an XMesaBuffer structure and all related info. */ void XMesaDestroyBuffer( XMesaBuffer b ) { int client = 0; #ifdef XFree86Server if (b->frontxrb->drawable) client = CLIENT_ID(b->frontxrb->drawable->id); #endif if (b->gc) XMesaFreeGC( b->xm_visual->display, b->gc ); if (b->cleargc) XMesaFreeGC( b->xm_visual->display, b->cleargc ); if (b->swapgc) XMesaFreeGC( b->xm_visual->display, b->swapgc ); if (b->xm_visual->mesa_visual.doubleBufferMode) { if (b->backxrb->ximage) { #if defined(USE_XSHM) && !defined(XFree86Server) if (b->shm) { XShmDetach( b->xm_visual->display, &b->shminfo ); XDestroyImage( b->backxrb->ximage ); shmdt( b->shminfo.shmaddr ); } else #endif XMesaDestroyImage( b->backxrb->ximage ); } if (b->backxrb->pixmap) { XMesaFreePixmap( b->xm_visual->display, (XMesaPixmap) b->backxrb->pixmap ); if (b->xm_visual->hpcr_clear_flag) { XMesaFreePixmap( b->xm_visual->display, b->xm_visual->hpcr_clear_pixmap ); XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage ); } } } if (b->rowimage) { _mesa_free( b->rowimage->data ); b->rowimage->data = NULL; XMesaDestroyImage( b->rowimage ); } free_xmesa_buffer(client, b); } /* * Bind buffer b to context c and make c the current rendering context. */ GLboolean XMesaMakeCurrent( XMesaContext c, XMesaBuffer b ) { return XMesaMakeCurrent2( c, b, b ); } /* * Bind buffer b to context c and make c the current rendering context. */ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, XMesaBuffer readBuffer ) { if (c) { if (!drawBuffer || !readBuffer) return GL_FALSE; /* must specify buffers! */ #ifdef FX if (drawBuffer->FXctx) { fxMesaMakeCurrent(drawBuffer->FXctx); c->xm_buffer = drawBuffer; return GL_TRUE; } #endif if (&(c->mesa) == _mesa_get_current_context() && c->mesa.DrawBuffer == &drawBuffer->mesa_buffer && c->mesa.ReadBuffer == &readBuffer->mesa_buffer && ((XMesaBuffer) c->mesa.DrawBuffer)->wasCurrent) { /* same context and buffer, do nothing */ return GL_TRUE; } c->xm_buffer = drawBuffer; _mesa_make_current(&(c->mesa), &drawBuffer->mesa_buffer, &readBuffer->mesa_buffer); if (c->xm_visual->mesa_visual.rgbMode) { /* * Must recompute and set these pixel values because colormap * can be different for different windows. */ c->clearpixel = xmesa_color_to_pixel( &c->mesa, c->clearcolor[0], c->clearcolor[1], c->clearcolor[2], c->clearcolor[3], c->xm_visual->undithered_pf); XMesaSetForeground(c->display, drawBuffer->cleargc, c->clearpixel); } /* Solution to Stephane Rehel's problem with glXReleaseBuffersMESA(): */ drawBuffer->wasCurrent = GL_TRUE; } else { /* Detach */ _mesa_make_current( NULL, NULL, NULL ); } return GL_TRUE; } /* * Unbind the context c from its buffer. */ GLboolean XMesaUnbindContext( XMesaContext c ) { /* A no-op for XFree86 integration purposes */ return GL_TRUE; } XMesaContext XMesaGetCurrentContext( void ) { GET_CURRENT_CONTEXT(ctx); if (ctx) { XMesaContext xmesa = XMESA_CONTEXT(ctx); return xmesa; } else { return 0; } } XMesaBuffer XMesaGetCurrentBuffer( void ) { GET_CURRENT_CONTEXT(ctx); if (ctx) { XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); return xmbuf; } else { return 0; } } /* New in Mesa 3.1 */ XMesaBuffer XMesaGetCurrentReadBuffer( void ) { GET_CURRENT_CONTEXT(ctx); if (ctx) { return (XMesaBuffer) (ctx->ReadBuffer); } else { return 0; } } GLboolean XMesaForceCurrent(XMesaContext c) { if (c) { if (&(c->mesa) != _mesa_get_current_context()) { _mesa_make_current(&c->mesa, c->mesa.DrawBuffer, c->mesa.ReadBuffer); } } else { _mesa_make_current(NULL, NULL, NULL); } return GL_TRUE; } GLboolean XMesaLoseCurrent(XMesaContext c) { (void) c; _mesa_make_current(NULL, NULL, NULL); return GL_TRUE; } /* * Switch 3Dfx support hack between window and full-screen mode. */ GLboolean XMesaSetFXmode( GLint mode ) { #ifdef FX const char *fx = _mesa_getenv("MESA_GLX_FX"); if (fx && fx[0] != 'd') { GET_CURRENT_CONTEXT(ctx); GrHwConfiguration hw; if (!FX_grSstQueryHardware(&hw)) { /*fprintf(stderr, "!grSstQueryHardware\n");*/ return GL_FALSE; } if (hw.num_sst < 1) { /*fprintf(stderr, "hw.num_sst < 1\n");*/ return GL_FALSE; } if (ctx) { /* [dBorca] Hack alert: * oh, this is sooo wrong: ctx above is * really an fxMesaContext, not an XMesaContext */ XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); if (mode == XMESA_FX_WINDOW) { if (xmbuf->FXisHackUsable) { FX_grSstControl(GR_CONTROL_DEACTIVATE); xmbuf->FXwindowHack = GL_TRUE; return GL_TRUE; } } else if (mode == XMESA_FX_FULLSCREEN) { FX_grSstControl(GR_CONTROL_ACTIVATE); xmbuf->FXwindowHack = GL_FALSE; return GL_TRUE; } else { /* Error: Bad mode value */ } } } /*fprintf(stderr, "fallthrough\n");*/ #else (void) mode; #endif return GL_FALSE; } #ifdef FX /* * Read image from VooDoo frame buffer into X/Mesa's back XImage. */ static void FXgetImage( XMesaBuffer b ) { GET_CURRENT_CONTEXT(ctx); static unsigned short pixbuf[MAX_WIDTH]; GLuint x, y; int xpos, ypos; XMesaWindow root; unsigned int bw, depth, width, height; XMesaContext xmesa = XMESA_CONTEXT(ctx); #ifdef XFree86Server x = b->frontxrb->pixmap->x; y = b->frontxrb->pixmap->y; width = b->frontxrb->pixmap->width; height = b->frontxrb->pixmap->height; depth = b->frontxrb->pixmap->depth; #else XGetGeometry( b->xm_visual->display, b->frontxrb->pixmap, &root, &xpos, &ypos, &width, &height, &bw, &depth); #endif if (b->mesa_buffer.Width != width || b->mesa_buffer.Height != height) { b->mesa_buffer.Width = MIN2((int)width, b->FXctx->width); b->mesa_buffer.Height = MIN2((int)height, b->FXctx->height); if (b->mesa_buffer.Width & 1) b->mesa_buffer.Width--; /* prevent odd width */ xmesa_alloc_back_buffer(b, b->mesa_buffer.Width, b->mesa_buffer.Height); } /* [dBorca] we're always in the right GR_COLORFORMAT... aren't we? */ /* grLfbWriteColorFormat(GR_COLORFORMAT_ARGB); */ if (b->xm_visual->undithered_pf==PF_5R6G5B) { /* Special case: 16bpp RGB */ grLfbReadRegion( GR_BUFFER_FRONTBUFFER, /* src buffer */ 0, b->FXctx->height - b->mesa_buffer.Height, /*pos*/ b->mesa_buffer.Width, b->mesa_buffer.Height, /* size */ b->mesa_buffer.Width * sizeof(GLushort), /* stride */ b->backxrb->ximage->data); /* dest buffer */ } else if (b->xm_visual->dithered_pf==PF_Dither && GET_VISUAL_DEPTH(b->xm_visual)==8) { /* Special case: 8bpp RGB */ for (y=0;ymesa_buffer.Height;y++) { GLubyte *ptr = (GLubyte*) b->backxrb->ximage->data + b->backxrb->ximage->bytes_per_line * y; XDITHER_SETUP(y); /* read row from 3Dfx frame buffer */ grLfbReadRegion( GR_BUFFER_FRONTBUFFER, 0, b->FXctx->height-(b->mesa_buffer.Height-y), b->mesa_buffer.Width, 1, 0, pixbuf ); /* write to XImage back buffer */ for (x=0;xmesa_buffer.Width;x++) { GLubyte r = (pixbuf[x] & 0xf800) >> 8; GLubyte g = (pixbuf[x] & 0x07e0) >> 3; GLubyte b = (pixbuf[x] & 0x001f) << 3; *ptr++ = XDITHER( x, r, g, b); } } } else { /* General case: slow! */ for (y=0;ymesa_buffer.Height;y++) { /* read row from 3Dfx frame buffer */ grLfbReadRegion( GR_BUFFER_FRONTBUFFER, 0, b->FXctx->height-(b->mesa_buffer.Height-y), b->mesa_buffer.Width, 1, 0, pixbuf ); /* write to XImage back buffer */ for (x=0;xmesa_buffer.Width;x++) { XMesaPutPixel(b->backxrb->ximage,x,y, xmesa_color_to_pixel(ctx, (pixbuf[x] & 0xf800) >> 8, (pixbuf[x] & 0x07e0) >> 3, (pixbuf[x] & 0x001f) << 3, 0xff, b->xm_visual->undithered_pf)); } } } /* grLfbWriteColorFormat(GR_COLORFORMAT_ABGR); */ } #endif /* * Copy the back buffer to the front buffer. If there's no back buffer * this is a no-op. */ void XMesaSwapBuffers( XMesaBuffer b ) { GET_CURRENT_CONTEXT(ctx); /* If we're swapping the buffer associated with the current context * we have to flush any pending rendering commands first. */ if (ctx && ctx->DrawBuffer == &(b->mesa_buffer)) _mesa_notifySwapBuffers(ctx); if (b->db_state) { #ifdef FX if (b->FXctx) { fxMesaSwapBuffers(); if (b->FXwindowHack) FXgetImage(b); else return; } #endif if (b->backxrb->ximage) { /* Copy Ximage from host's memory to server's window */ #if defined(USE_XSHM) && !defined(XFree86Server) if (b->shm) { /*_glthread_LOCK_MUTEX(_xmesa_lock);*/ XShmPutImage( b->xm_visual->display, b->frontxrb->drawable, b->swapgc, b->backxrb->ximage, 0, 0, 0, 0, b->mesa_buffer.Width, b->mesa_buffer.Height, False ); /*_glthread_UNLOCK_MUTEX(_xmesa_lock);*/ } else #endif { /*_glthread_LOCK_MUTEX(_xmesa_lock);*/ XMesaPutImage( b->xm_visual->display, b->frontxrb->drawable, b->swapgc, b->backxrb->ximage, 0, 0, 0, 0, b->mesa_buffer.Width, b->mesa_buffer.Height ); /*_glthread_UNLOCK_MUTEX(_xmesa_lock);*/ } } else { /* Copy pixmap to window on server */ /*_glthread_LOCK_MUTEX(_xmesa_lock);*/ XMesaCopyArea( b->xm_visual->display, b->backxrb->pixmap, /* source drawable */ b->frontxrb->drawable, /* dest. drawable */ b->swapgc, 0, 0, b->mesa_buffer.Width, b->mesa_buffer.Height, 0, 0 /* dest region */ ); /*_glthread_UNLOCK_MUTEX(_xmesa_lock);*/ } } #if !defined(XFree86Server) XSync( b->xm_visual->display, False ); #endif } /* * Copy sub-region of back buffer to front buffer */ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height ) { GET_CURRENT_CONTEXT(ctx); /* If we're swapping the buffer associated with the current context * we have to flush any pending rendering commands first. */ if (ctx && ctx->DrawBuffer == &(b->mesa_buffer)) _mesa_notifySwapBuffers(ctx); if (b->db_state) { int yTop = b->mesa_buffer.Height - y - height; #ifdef FX if (b->FXctx) { fxMesaSwapBuffers(); if (b->FXwindowHack) FXgetImage(b); else return; } #endif if (b->backxrb->ximage) { /* Copy Ximage from host's memory to server's window */ #if defined(USE_XSHM) && !defined(XFree86Server) if (b->shm) { /* XXX assuming width and height aren't too large! */ XShmPutImage( b->xm_visual->display, b->frontxrb->drawable, b->swapgc, b->backxrb->ximage, x, yTop, x, yTop, width, height, False ); /* wait for finished event??? */ } else #endif { /* XXX assuming width and height aren't too large! */ XMesaPutImage( b->xm_visual->display, b->frontxrb->drawable, b->swapgc, b->backxrb->ximage, x, yTop, x, yTop, width, height ); } } else { /* Copy pixmap to window on server */ XMesaCopyArea( b->xm_visual->display, b->backxrb->pixmap, /* source drawable */ b->frontxrb->drawable, /* dest. drawable */ b->swapgc, x, yTop, width, height, /* source region */ x, yTop /* dest region */ ); } } } /* * Return a pointer to the XMesa backbuffer Pixmap or XImage. This function * is a way to get "under the hood" of X/Mesa so one can manipulate the * back buffer directly. * Output: pixmap - pointer to back buffer's Pixmap, or 0 * ximage - pointer to back buffer's XImage, or NULL * Return: GL_TRUE = context is double buffered * GL_FALSE = context is single buffered */ #ifndef XFree86Server GLboolean XMesaGetBackBuffer( XMesaBuffer b, XMesaPixmap *pixmap, XMesaImage **ximage ) { if (b->db_state) { if (pixmap) *pixmap = b->backxrb->pixmap; if (ximage) *ximage = b->backxrb->ximage; return GL_TRUE; } else { *pixmap = 0; *ximage = NULL; return GL_FALSE; } } #endif /* XFree86Server */ /* * Return the depth buffer associated with an XMesaBuffer. * Input: b - the XMesa buffer handle * Output: width, height - size of buffer in pixels * bytesPerValue - bytes per depth value (2 or 4) * buffer - pointer to depth buffer values * Return: GL_TRUE or GL_FALSE to indicate success or failure. */ GLboolean XMesaGetDepthBuffer( XMesaBuffer b, GLint *width, GLint *height, GLint *bytesPerValue, void **buffer ) { struct gl_renderbuffer *rb = b->mesa_buffer.Attachment[BUFFER_DEPTH].Renderbuffer; if (!rb || !rb->Data) { *width = 0; *height = 0; *bytesPerValue = 0; *buffer = 0; return GL_FALSE; } else { *width = b->mesa_buffer.Width; *height = b->mesa_buffer.Height; *bytesPerValue = b->mesa_buffer.Visual.depthBits <= 16 ? sizeof(GLushort) : sizeof(GLuint); *buffer = rb->Data; return GL_TRUE; } } void XMesaFlush( XMesaContext c ) { if (c && c->xm_visual) { #ifdef XFree86Server /* NOT_NEEDED */ #else XSync( c->xm_visual->display, False ); #endif } } const char *XMesaGetString( XMesaContext c, int name ) { (void) c; if (name==XMESA_VERSION) { return "5.0"; } else if (name==XMESA_EXTENSIONS) { return ""; } else { return NULL; } } XMesaBuffer XMesaFindBuffer( XMesaDisplay *dpy, XMesaDrawable d ) { XMesaBuffer b; for (b=XMesaBufferList; b; b=b->Next) { if (b->frontxrb->drawable == d && b->display == dpy) { return b; } } return NULL; } /* * Look for XMesaBuffers whose X window has been destroyed. * Deallocate any such XMesaBuffers. */ void XMesaGarbageCollect( void ) { XMesaBuffer b, next; for (b=XMesaBufferList; b; b=next) { next = b->Next; if (b->display && b->frontxrb->drawable && b->type == WINDOW) { #ifdef XFree86Server /* NOT_NEEDED */ #else XSync(b->display, False); if (!window_exists( b->display, b->frontxrb->drawable )) { /* found a dead window, free the ancillary info */ XMesaDestroyBuffer( b ); } #endif } } } void XMesaReset( void ) { while (XMesaBufferList) XMesaDestroyBuffer(XMesaBufferList); XMesaBufferList = NULL; } unsigned long XMesaDitherColor( XMesaContext xmesa, GLint x, GLint y, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { GLcontext *ctx = &xmesa->mesa; GLint r = (GLint) (red * 255.0F); GLint g = (GLint) (green * 255.0F); GLint b = (GLint) (blue * 255.0F); GLint a = (GLint) (alpha * 255.0F); switch (xmesa->pixelformat) { case PF_Index: return 0; case PF_Truecolor: { unsigned long p; PACK_TRUECOLOR( p, r, g, b ); return p; } case PF_8A8B8G8R: return PACK_8A8B8G8R( r, g, b, a ); case PF_8A8R8G8B: return PACK_8A8R8G8B( r, g, b, a ); case PF_8R8G8B: return PACK_8R8G8B( r, g, b ); case PF_5R6G5B: return PACK_5R6G5B( r, g, b ); case PF_Dither: { DITHER_SETUP; return DITHER( x, y, r, g, b ); } case PF_1Bit: /* 382 = (3*255)/2 */ return ((r+g+b) > 382) ^ xmesa->xm_visual->bitFlip; case PF_HPCR: return DITHER_HPCR(x, y, r, g, b); case PF_Lookup: { LOOKUP_SETUP; return LOOKUP( r, g, b ); } case PF_Grayscale: return GRAY_RGB( r, g, b ); case PF_Dither_5R6G5B: /* fall through */ case PF_Dither_True: { unsigned long p; PACK_TRUEDITHER(p, x, y, r, g, b); return p; } default: _mesa_problem(NULL, "Bad pixel format in XMesaDitherColor"); } return 0; } /* * This is typically called when the window size changes and we need * to reallocate the buffer's back/depth/stencil/accum buffers. */ void XMesaResizeBuffers( XMesaBuffer b ) { #ifdef XFree86Server GLuint winwidth, winheight; GET_CURRENT_CONTEXT(ctx); winwidth = MIN2(b->frontxrb->drawable->width, MAX_WIDTH); winheight = MIN2(b->frontxrb->drawable->height, MAX_HEIGHT); xmesa_resize_buffers(ctx, &(b->mesa_buffer), winwidth, winheight); #else Window root; int xpos, ypos; unsigned int width, height, bw, depth; GET_CURRENT_CONTEXT(ctx); XGetGeometry( b->xm_visual->display, b->frontxrb->pixmap, &root, &xpos, &ypos, &width, &height, &bw, &depth); xmesa_resize_buffers(ctx, &(b->mesa_buffer), width, height); #endif } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/drivers/x11/xm_buffer.c0000644000000000000000000000722213614532424021430 0ustar /* * Mesa 3-D graphics library * Version: 6.4.2 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glxheader.h" #include "GL/xmesa.h" #include "xmesaP.h" #include "imports.h" #include "renderbuffer.h" static void xmesa_delete_renderbuffer(struct gl_renderbuffer *rb) { /* XXX Note: the ximage or Pixmap attached to this renderbuffer * should probably get freed here, but that's currently done in * XMesaDestroyBuffer(). */ _mesa_free(rb); } /** * Reallocate renderbuffer storage. * This is called when the window's resized. It'll get called once for * the front color renderbuffer and again for the back color renderbuffer. */ static GLboolean xmesa_alloc_storage(GLcontext *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; if (xrb->ximage) { /* Needed by PIXELADDR1 macro */ xrb->width1 = xrb->ximage->bytes_per_line; xrb->origin1 = (GLubyte *) xrb->ximage->data + xrb->width1 * (height - 1); /* Needed by PIXELADDR2 macro */ xrb->width2 = xrb->ximage->bytes_per_line / 2; xrb->origin2 = (GLushort *) xrb->ximage->data + xrb->width2 * (height - 1); /* Needed by PIXELADDR3 macro */ xrb->width3 = xrb->ximage->bytes_per_line; xrb->origin3 = (GLubyte *) xrb->ximage->data + xrb->width3 * (height - 1); /* Needed by PIXELADDR4 macro */ xrb->width4 = xrb->ximage->width; xrb->origin4 = (GLuint *) xrb->ximage->data + xrb->width4 * (height - 1); } else { /* this assertion will fail if we happend to run out of memory */ /*assert(xrb->pixmap);*/ } /* for the FLIP macro: */ xrb->bottom = height - 1; rb->Width = width; rb->Height = height; rb->InternalFormat = internalFormat; return GL_TRUE; } struct xmesa_renderbuffer * xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, GLboolean rgbMode) { struct xmesa_renderbuffer *xrb = CALLOC_STRUCT(xmesa_renderbuffer); if (xrb) { GLuint name = 0; _mesa_init_renderbuffer(&xrb->Base, name); xrb->Base.Delete = xmesa_delete_renderbuffer; xrb->Base.AllocStorage = xmesa_alloc_storage; if (rgbMode) { xrb->Base.InternalFormat = GL_RGBA; xrb->Base._BaseFormat = GL_RGBA; xrb->Base.DataType = GL_UNSIGNED_BYTE; } else { xrb->Base.InternalFormat = GL_COLOR_INDEX; xrb->Base._BaseFormat = GL_COLOR_INDEX; xrb->Base.DataType = GL_UNSIGNED_INT; } xrb->Base.ComponentSizes[0] = 0; /* XXX fix? */ } return xrb; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/drivers/x11/xm_dd.c0000644000000000000000000011336213614532424020551 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glxheader.h" #include "bufferobj.h" #include "buffers.h" #include "context.h" #include "colormac.h" #include "depth.h" #include "drawpix.h" #include "extensions.h" #include "framebuffer.h" #include "macros.h" #include "image.h" #include "imports.h" #include "mtypes.h" #include "state.h" #include "texobj.h" #include "teximage.h" #include "texstore.h" #include "texformat.h" #include "xmesaP.h" #include "array_cache/acache.h" #include "swrast/swrast.h" #include "swrast/s_context.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" #include "tnl/t_context.h" #ifdef XFree86Server #include #endif /* * Dithering kernels and lookup tables. */ const int xmesa_kernel8[DITH_DY * DITH_DX] = { 0 * MAXC, 8 * MAXC, 2 * MAXC, 10 * MAXC, 12 * MAXC, 4 * MAXC, 14 * MAXC, 6 * MAXC, 3 * MAXC, 11 * MAXC, 1 * MAXC, 9 * MAXC, 15 * MAXC, 7 * MAXC, 13 * MAXC, 5 * MAXC, }; const short xmesa_HPCR_DRGB[3][2][16] = { { { 16, -4, 1,-11, 14, -6, 3, -9, 15, -5, 2,-10, 13, -7, 4, -8}, {-15, 5, 0, 12,-13, 7, -2, 10,-14, 6, -1, 11,-12, 8, -3, 9} }, { {-11, 15, -7, 3, -8, 14, -4, 2,-10, 16, -6, 4, -9, 13, -5, 1}, { 12,-14, 8, -2, 9,-13, 5, -1, 11,-15, 7, -3, 10,-12, 6, 0} }, { { 6,-18, 26,-14, 2,-22, 30,-10, 8,-16, 28,-12, 4,-20, 32, -8}, { -4, 20,-24, 16, 0, 24,-28, 12, -6, 18,-26, 14, -2, 22,-30, 10} } }; const int xmesa_kernel1[16] = { 0*47, 9*47, 4*47, 12*47, /* 47 = (255*3)/16 */ 6*47, 2*47, 14*47, 8*47, 10*47, 1*47, 5*47, 11*47, 7*47, 13*47, 3*47, 15*47 }; /* * Return the size (width, height) of the X window for the given GLframebuffer. * Output: width - width of buffer in pixels. * height - height of buffer in pixels. */ static void get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height ) { /* We can do this cast because the first field in the XMesaBuffer * struct is a GLframebuffer struct. If this weren't true, we'd * need a pointer from the GLframebuffer to the XMesaBuffer. */ const XMesaBuffer xmBuffer = (XMesaBuffer) buffer; unsigned int winwidth, winheight; #ifdef XFree86Server /* XFree86 GLX renderer */ winwidth = MIN2(xmBuffer->frontxrb->drawable->width, MAX_WIDTH); winheight = MIN2(xmBuffer->frontxrb->drawable->height, MAX_HEIGHT); #else Window root; int winx, winy; unsigned int bw, d; _glthread_LOCK_MUTEX(_xmesa_lock); XSync(xmBuffer->xm_visual->display, 0); /* added for Chromium */ XGetGeometry( xmBuffer->xm_visual->display, xmBuffer->frontxrb->pixmap, &root, &winx, &winy, &winwidth, &winheight, &bw, &d ); _glthread_UNLOCK_MUTEX(_xmesa_lock); #endif *width = winwidth; *height = winheight; } static void finish_or_flush( GLcontext *ctx ) { #ifdef XFree86Server /* NOT_NEEDED */ #else const XMesaContext xmesa = XMESA_CONTEXT(ctx); if (xmesa) { _glthread_LOCK_MUTEX(_xmesa_lock); XSync( xmesa->display, False ); _glthread_UNLOCK_MUTEX(_xmesa_lock); } #endif } static void clear_index( GLcontext *ctx, GLuint index ) { if (ctx->DrawBuffer->Name == 0) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); xmesa->clearpixel = (unsigned long) index; XMesaSetForeground( xmesa->display, xmbuf->cleargc, (unsigned long) index ); } } static void clear_color( GLcontext *ctx, const GLfloat color[4] ) { if (ctx->DrawBuffer->Name == 0) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]); xmesa->clearpixel = xmesa_color_to_pixel( ctx, xmesa->clearcolor[0], xmesa->clearcolor[1], xmesa->clearcolor[2], xmesa->clearcolor[3], xmesa->xm_visual->undithered_pf ); _glthread_LOCK_MUTEX(_xmesa_lock); XMesaSetForeground( xmesa->display, xmbuf->cleargc, xmesa->clearpixel ); _glthread_UNLOCK_MUTEX(_xmesa_lock); } } /* Set index mask ala glIndexMask */ static void index_mask( GLcontext *ctx, GLuint mask ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); /* not sure this conditional is really needed */ if (xmbuf->backxrb && xmbuf->backxrb->pixmap) { unsigned long m; if (mask==0xffffffff) { m = ((unsigned long)~0L); } else { m = (unsigned long) mask; } XMesaSetPlaneMask( xmesa->display, xmbuf->cleargc, m ); XMesaSetPlaneMask( xmesa->display, xmbuf->gc, m ); } } /* Implements glColorMask() */ static void color_mask(GLcontext *ctx, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); const int xclass = xmesa->xm_visual->mesa_visual.visualType; (void) amask; if (xclass == GLX_TRUE_COLOR || xclass == GLX_DIRECT_COLOR) { unsigned long m; if (rmask && gmask && bmask) { m = ((unsigned long)~0L); } else { m = 0; if (rmask) m |= GET_REDMASK(xmesa->xm_visual); if (gmask) m |= GET_GREENMASK(xmesa->xm_visual); if (bmask) m |= GET_BLUEMASK(xmesa->xm_visual); } XMesaSetPlaneMask( xmesa->display, xmbuf->cleargc, m ); XMesaSetPlaneMask( xmesa->display, xmbuf->gc, m ); } } /**********************************************************************/ /*** glClear implementations ***/ /**********************************************************************/ /** * Clear the front or back color buffer, if it's implemented with a pixmap. */ static void clear_pixmap(GLcontext *ctx, struct xmesa_renderbuffer *xrb, GLboolean all, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); assert(xmbuf); assert(xrb->pixmap); assert(xmesa); assert(xmesa->display); assert(xrb->pixmap); assert(xmbuf->cleargc); if (all) { XMesaFillRectangle( xmesa->display, xrb->pixmap, xmbuf->cleargc, 0, 0, xrb->Base.Width + 1, xrb->Base.Height + 1 ); } else { XMesaFillRectangle( xmesa->display, xrb->pixmap, xmbuf->cleargc, x, xrb->Base.Height - y - height, width, height ); } } static void clear_8bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, GLboolean all, GLint x, GLint y, GLint width, GLint height ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); if (all) { const size_t n = xrb->ximage->bytes_per_line * xrb->Base.Height; MEMSET( xrb->ximage->data, xmesa->clearpixel, n ); } else { GLint i; for (i=0;iclearpixel, width ); } } } static void clear_HPCR_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb, GLboolean all, GLint x, GLint y, GLint width, GLint height ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); if (all) { GLint i, c16 = (xrb->ximage->bytes_per_line>>4)<<4; GLubyte *ptr = (GLubyte *) xrb->ximage->data; for (i = 0; i < xrb->Base.Height; i++) { GLint j; GLubyte *sptr = xmesa->xm_visual->hpcr_clear_ximage_pattern[0]; if (i&1) { sptr += 16; } for (j=0; jximage->bytes_per_line; j++) { *ptr = sptr[j&15]; ptr++; } } } else { GLint i; for (i=y; ixm_visual->hpcr_clear_ximage_pattern[0]; if (i&1) { sptr += 16; } for (j=x; jclearpixel; if (xmesa->swapbytes) { pixel = ((pixel >> 8) & 0x00ff) | ((pixel << 8) & 0xff00); } if (all) { GLuint *ptr4 = (GLuint *) xrb->ximage->data; if ((pixel & 0xff) == ((pixel >> 8) & 0xff)) { /* low and high bytes are equal so use memset() */ const GLuint n = xrb->ximage->bytes_per_line * xrb->Base.Height; MEMSET( ptr4, pixel & 0xff, n ); } else { const GLuint n = xrb->ximage->bytes_per_line * xrb->Base.Height / 4; GLuint i; pixel = pixel | (pixel<<16); for (i = 0; i < n; i++) { ptr4[i] = pixel; } ptr4 += n; /* might be one last GLushort to set */ if ((xrb->ximage->bytes_per_line * xrb->Base.Height) & 0x2) *(GLushort *)ptr4 = pixel & 0xffff; } } else { GLint i, j; for (j=0;j */ static void clear_24bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, GLboolean all, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); const GLubyte r = xmesa->clearcolor[0]; const GLubyte g = xmesa->clearcolor[1]; const GLubyte b = xmesa->clearcolor[2]; if (all) { if (r == g && g == b) { /* same value for all three components (gray) */ const GLint w3 = xrb->Base.Width * 3; const GLint h = xrb->Base.Height; GLint i; for (i = 0; i < h; i++) { bgr_t *ptr3 = PIXEL_ADDR3(xrb, 0, i); MEMSET(ptr3, r, w3); } } else { /* the usual case */ const GLint w = xrb->Base.Width; const GLint h = xrb->Base.Height; GLint i, j; for (i = 0; i < h; i++) { bgr_t *ptr3 = PIXEL_ADDR3(xrb, 0, i); for (j = 0; j < w; j++) { ptr3->r = r; ptr3->g = g; ptr3->b = b; ptr3++; } } } } else { /* only clear subrect of color buffer */ if (r == g && g == b) { /* same value for all three components (gray) */ GLint j; for (j=0;jr = r; ptr3->g = g; ptr3->b = b; ptr3++; } } } } } static void clear_32bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, GLboolean all, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint pixel = (GLuint) xmesa->clearpixel; if (xmesa->swapbytes) { pixel = ((pixel >> 24) & 0x000000ff) | ((pixel >> 8) & 0x0000ff00) | ((pixel << 8) & 0x00ff0000) | ((pixel << 24) & 0xff000000); } if (all) { const GLuint n = xrb->Base.Width * xrb->Base.Height; GLuint *ptr4 = (GLuint *) xrb->ximage->data; if (pixel == 0) { _mesa_memset(ptr4, pixel, 4 * n); } else { GLuint i; for (i = 0; i < n; i++) ptr4[i] = pixel; } } else { GLint i, j; for (j = 0; j < height; j++) { GLuint *ptr4 = PIXEL_ADDR4(xrb, x, y + j); for (i = 0; i < width; i++) { ptr4[i] = pixel; } } } } static void clear_nbit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, GLboolean all, GLint x, GLint y, GLint width, GLint height) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaImage *img = xrb->ximage; GLint i, j; /* We can ignore 'all' here - x, y, width, height are always right */ (void) all; /* TODO: optimize this */ y = YFLIP(xrb, y); for (j = 0; j < height; j++) { for (i = 0; i < width; i++) { XMesaPutPixel(img, x+i, y-j, xmesa->clearpixel); } } } static void clear_buffers( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ) { if (ctx->DrawBuffer->Name == 0) { /* this is a window system framebuffer */ const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask; XMesaBuffer b = (XMesaBuffer) ctx->DrawBuffer; /* we can't handle color or index masking */ if (*colorMask == 0xffffffff && ctx->Color.IndexMask == 0xffffffff) { if (mask & BUFFER_BIT_FRONT_LEFT) { /* clear front color buffer */ if (b->frontxrb == (struct xmesa_renderbuffer *) ctx->DrawBuffer->Attachment[BUFFER_FRONT_LEFT].Renderbuffer) { /* renderbuffer is not wrapped - great! */ b->frontxrb->clearFunc(ctx, b->frontxrb, all, x, y, width, height); mask &= ~BUFFER_BIT_FRONT_LEFT; } else { /* we can't directly clear an alpha-wrapped color buffer */ } } if (mask & BUFFER_BIT_BACK_LEFT) { /* clear back color buffer */ if (b->backxrb == (struct xmesa_renderbuffer *) ctx->DrawBuffer->Attachment[BUFFER_BACK_LEFT].Renderbuffer) { /* renderbuffer is not wrapped - great! */ b->backxrb->clearFunc(ctx, b->backxrb, all, x, y, width, height); mask &= ~BUFFER_BIT_BACK_LEFT; } } } } if (mask) _swrast_Clear( ctx, mask, all, x, y, width, height ); } /** * Called by ctx->Driver.ResizeBuffers() * Resize the front/back colorbuffers to match the latest window size. */ void xmesa_resize_buffers(GLcontext *ctx, GLframebuffer *buffer, GLuint width, GLuint height) { /* We can do this cast because the first field in the XMesaBuffer * struct is a GLframebuffer struct. If this weren't true, we'd * need a pointer from the GLframebuffer to the XMesaBuffer. */ XMesaBuffer xmBuffer = (XMesaBuffer) buffer; xmesa_alloc_back_buffer(xmBuffer, width, height); _mesa_resize_framebuffer(ctx, buffer, width, height); if (ctx) ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */ } #ifndef XFree86Server /* XXX this was never tested in the Xserver environment */ /** * This function implements glDrawPixels() with an XPutImage call when * drawing to the front buffer (X Window drawable). * The image format must be GL_BGRA to match the PF_8R8G8B pixel format. */ static void xmesa_DrawPixels_8R8G8B( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ) { struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0]; const XMesaContext xmesa = XMESA_CONTEXT(ctx); const SWcontext *swrast = SWRAST_CONTEXT( ctx ); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); const XMesaGC gc = xmbuf->gc; ASSERT(dpy); ASSERT(gc); ASSERT(xmesa->xm_visual->dithered_pf == PF_8R8G8B); ASSERT(xmesa->xm_visual->undithered_pf == PF_8R8G8B); if (swrast->NewState) _swrast_validate_derived( ctx ); if (xrb->pixmap && format == GL_BGRA && type == GL_UNSIGNED_BYTE && (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */ ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ ctx->Pixel.ZoomX == 1.0 && /* no zooming */ ctx->Pixel.ZoomY == 1.0) { int dstX = x; int dstY = y; int w = width; int h = height; int srcX = unpack->SkipPixels; int srcY = unpack->SkipRows; int rowLength = unpack->RowLength ? unpack->RowLength : width; if (unpack->BufferObj->Name) { /* unpack from PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, format, type, pixels)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(invalid PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, unpack->BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)"); return; } pixels = ADD_POINTERS(buf, pixels); } if (_mesa_clip_drawpixels(ctx, &dstX, &dstY, &w, &h, &srcX, &srcY)) { /* This is a little tricky since all coordinates up to now have * been in the OpenGL bottom-to-top orientation. X is top-to-bottom * so we have to carefully compute the Y coordinates/addresses here. */ XMesaImage ximage; MEMSET(&ximage, 0, sizeof(XMesaImage)); ximage.width = width; ximage.height = height; ximage.format = ZPixmap; ximage.data = (char *) pixels + ((srcY + h - 1) * rowLength + srcX) * 4; ximage.byte_order = LSBFirst; ximage.bitmap_unit = 32; ximage.bitmap_bit_order = LSBFirst; ximage.bitmap_pad = 32; ximage.depth = 24; ximage.bytes_per_line = -rowLength * 4; /* negative to flip image */ ximage.bits_per_pixel = 32; /* it seems we don't need to set the ximage.red/green/blue_mask fields */ /* flip Y axis for dest position */ dstY = YFLIP(xrb, dstY) - h + 1; XPutImage(dpy, xrb->pixmap, gc, &ximage, 0, 0, dstX, dstY, w, h); } if (unpack->BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, unpack->BufferObj); } } else { /* software fallback */ _swrast_DrawPixels(ctx, x, y, width, height, format, type, unpack, pixels); } } /** * This function implements glDrawPixels() with an XPutImage call when * drawing to the front buffer (X Window drawable). The image format * must be GL_RGB and image type must be GL_UNSIGNED_SHORT_5_6_5 to * match the PF_5R6G5B pixel format. */ static void xmesa_DrawPixels_5R6G5B( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ) { struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0]; const XMesaContext xmesa = XMESA_CONTEXT(ctx); const SWcontext *swrast = SWRAST_CONTEXT( ctx ); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); const XMesaGC gc = xmbuf->gc; ASSERT(dpy); ASSERT(gc); ASSERT(xmesa->xm_visual->undithered_pf == PF_5R6G5B); if (swrast->NewState) _swrast_validate_derived( ctx ); if (xrb->pixmap && format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 && !ctx->Color.DitherFlag && /* no dithering */ (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */ ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ ctx->Pixel.ZoomX == 1.0 && /* no zooming */ ctx->Pixel.ZoomY == 1.0) { int dstX = x; int dstY = y; int w = width; int h = height; int srcX = unpack->SkipPixels; int srcY = unpack->SkipRows; int rowLength = unpack->RowLength ? unpack->RowLength : width; if (unpack->BufferObj->Name) { /* unpack from PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, format, type, pixels)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(invalid PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, unpack->BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)"); return; } pixels = ADD_POINTERS(buf, pixels); } if (_mesa_clip_drawpixels(ctx, &dstX, &dstY, &w, &h, &srcX, &srcY)) { /* This is a little tricky since all coordinates up to now have * been in the OpenGL bottom-to-top orientation. X is top-to-bottom * so we have to carefully compute the Y coordinates/addresses here. */ XMesaImage ximage; MEMSET(&ximage, 0, sizeof(XMesaImage)); ximage.width = width; ximage.height = height; ximage.format = ZPixmap; ximage.data = (char *) pixels + ((srcY + h - 1) * rowLength + srcX) * 2; ximage.byte_order = LSBFirst; ximage.bitmap_unit = 16; ximage.bitmap_bit_order = LSBFirst; ximage.bitmap_pad = 16; ximage.depth = 16; ximage.bytes_per_line = -rowLength * 2; /* negative to flip image */ ximage.bits_per_pixel = 16; /* it seems we don't need to set the ximage.red/green/blue_mask fields */ /* flip Y axis for dest position */ dstY = YFLIP(xrb, dstY) - h + 1; XPutImage(dpy, xrb->pixmap, gc, &ximage, 0, 0, dstX, dstY, w, h); } if (unpack->BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, unpack->BufferObj); } } else { /* software fallback */ _swrast_DrawPixels(ctx, x, y, width, height, format, type, unpack, pixels); } } /** * Implement glCopyPixels for the front color buffer (or back buffer Pixmap) * for the color buffer. Don't support zooming, pixel transfer, etc. * We do support copying from one window to another, ala glXMakeCurrentRead. */ static void xmesa_CopyPixels( GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); const SWcontext *swrast = SWRAST_CONTEXT( ctx ); XMesaDisplay *dpy = xmesa->xm_visual->display; const XMesaGC gc = ((XMesaBuffer) ctx->DrawBuffer)->gc; struct xmesa_renderbuffer *srcXrb = (struct xmesa_renderbuffer *) ctx->ReadBuffer->_ColorReadBuffer; struct xmesa_renderbuffer *dstXrb = (struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0]; ASSERT(dpy); ASSERT(gc); if (swrast->NewState) _swrast_validate_derived( ctx ); if (ctx->Color.DrawBuffer[0] == GL_FRONT && ctx->Pixel.ReadBuffer == GL_FRONT && srcXrb->pixmap && dstXrb->pixmap && type == GL_COLOR && (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */ ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ ctx->Pixel.ZoomX == 1.0 && /* no zooming */ ctx->Pixel.ZoomY == 1.0) { /* Note: we don't do any special clipping work here. We could, * but X will do it for us. */ srcy = YFLIP(srcXrb, srcy) - height + 1; desty = YFLIP(dstXrb, desty) - height + 1; XCopyArea(dpy, srcXrb->pixmap, dstXrb->pixmap, gc, srcx, srcy, width, height, destx, desty); } else { _swrast_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type ); } } #endif /* XFree86Server */ /* * Every driver should implement a GetString function in order to * return a meaningful GL_RENDERER string. */ static const GLubyte * get_string( GLcontext *ctx, GLenum name ) { (void) ctx; switch (name) { case GL_RENDERER: #ifdef XFree86Server return (const GLubyte *) "Mesa GLX Indirect"; #else return (const GLubyte *) "Mesa X11"; #endif case GL_VENDOR: #ifdef XFree86Server return (const GLubyte *) "Mesa project: www.mesa3d.org"; #else return NULL; #endif default: return NULL; } } /* * We implement the glEnable function only because we care about * dither enable/disable. */ static void enable( GLcontext *ctx, GLenum pname, GLboolean state ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); switch (pname) { case GL_DITHER: if (state) xmesa->pixelformat = xmesa->xm_visual->dithered_pf; else xmesa->pixelformat = xmesa->xm_visual->undithered_pf; break; default: ; /* silence compiler warning */ } } static void clear_color_HPCR_ximage( GLcontext *ctx, const GLfloat color[4] ) { int i; const XMesaContext xmesa = XMESA_CONTEXT(ctx); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]); if (color[0] == 0.0 && color[1] == 0.0 && color[2] == 0.0) { /* black is black */ MEMSET( xmesa->xm_visual->hpcr_clear_ximage_pattern, 0x0 , sizeof(xmesa->xm_visual->hpcr_clear_ximage_pattern)); } else { /* build clear pattern */ for (i=0; i<16; i++) { xmesa->xm_visual->hpcr_clear_ximage_pattern[0][i] = DITHER_HPCR(i, 0, xmesa->clearcolor[0], xmesa->clearcolor[1], xmesa->clearcolor[2]); xmesa->xm_visual->hpcr_clear_ximage_pattern[1][i] = DITHER_HPCR(i, 1, xmesa->clearcolor[0], xmesa->clearcolor[1], xmesa->clearcolor[2]); } } } static void clear_color_HPCR_pixmap( GLcontext *ctx, const GLfloat color[4] ) { int i; const XMesaContext xmesa = XMESA_CONTEXT(ctx); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]); CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]); if (color[0] == 0.0 && color[1] == 0.0 && color[2] == 0.0) { /* black is black */ for (i=0; i<16; i++) { XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 0, 0); XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 1, 0); } } else { for (i=0; i<16; i++) { XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 0, DITHER_HPCR(i, 0, xmesa->clearcolor[0], xmesa->clearcolor[1], xmesa->clearcolor[2])); XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 1, DITHER_HPCR(i, 1, xmesa->clearcolor[0], xmesa->clearcolor[1], xmesa->clearcolor[2])); } } /* change tile pixmap content */ XMesaPutImage(xmesa->display, (XMesaDrawable)xmesa->xm_visual->hpcr_clear_pixmap, XMESA_BUFFER(ctx->DrawBuffer)->cleargc, xmesa->xm_visual->hpcr_clear_ximage, 0, 0, 0, 0, 16, 2); } /** * Called when the driver should update it's state, based on the new_state * flags. */ void xmesa_update_state( GLcontext *ctx, GLuint new_state ) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *front_xrb, *back_xrb; /* Propagate statechange information to swrast and swrast_setup * modules. The X11 driver has no internal GL-dependent state. */ _swrast_InvalidateState( ctx, new_state ); _ac_InvalidateState( ctx, new_state ); _tnl_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); if (ctx->DrawBuffer->Name != 0) return; front_xrb = XMESA_BUFFER(ctx->DrawBuffer)->frontxrb; if (front_xrb) { /* XXX check for relevant new_state flags */ xmesa_set_renderbuffer_funcs(front_xrb, xmesa->pixelformat, xmesa->xm_visual->BitsPerPixel); /* setup pointers to front and back buffer clear functions */ front_xrb->clearFunc = clear_pixmap; } back_xrb = XMESA_BUFFER(ctx->DrawBuffer)->backxrb; if (back_xrb) { XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); /* XXX check for relevant new_state flags */ xmesa_set_renderbuffer_funcs(back_xrb, xmesa->pixelformat, xmesa->xm_visual->BitsPerPixel); if (xmbuf->backxrb->pixmap) { back_xrb->clearFunc = clear_pixmap; } else { switch (xmesa->xm_visual->BitsPerPixel) { case 8: if (xmesa->xm_visual->hpcr_clear_flag) { back_xrb->clearFunc = clear_HPCR_ximage; } else { back_xrb->clearFunc = clear_8bit_ximage; } break; case 16: back_xrb->clearFunc = clear_16bit_ximage; break; case 24: back_xrb->clearFunc = clear_24bit_ximage; break; case 32: back_xrb->clearFunc = clear_32bit_ximage; break; default: back_xrb->clearFunc = clear_nbit_ximage; break; } } } if (xmesa->xm_visual->hpcr_clear_flag) { /* this depends on whether we're drawing to the front or back buffer */ /* XXX FIX THIS! */ #if 0 if (pixmap) { ctx->Driver.ClearColor = clear_color_HPCR_pixmap; } else { ctx->Driver.ClearColor = clear_color_HPCR_ximage; } #else (void) clear_color_HPCR_pixmap; (void) clear_color_HPCR_ximage; #endif } } /** * Called via ctx->Driver.TestProxyTeximage(). Normally, we'd just use * the _mesa_test_proxy_teximage() fallback function, but we're going to * special-case the 3D texture case to allow textures up to 512x512x32 * texels. */ static GLboolean test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, GLint depth, GLint border) { if (target == GL_PROXY_TEXTURE_3D) { /* special case for 3D textures */ if (width * height * depth > 512 * 512 * 64 || width < 2 * border || (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(width - 2 * border) != 1) || height < 2 * border || (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(height - 2 * border) != 1) || depth < 2 * border || (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(depth - 2 * border) != 1)) { /* Bad size, or too many texels */ return GL_FALSE; } return GL_TRUE; } else { /* use the fallback routine for 1D, 2D, cube and rect targets */ return _mesa_test_proxy_teximage(ctx, target, level, internalFormat, format, type, width, height, depth, border); } } /** * In SW, we don't really compress GL_COMPRESSED_RGB[A] textures! */ static const struct gl_texture_format * choose_tex_format( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { switch (internalFormat) { case GL_COMPRESSED_RGB_ARB: return &_mesa_texformat_rgb; case GL_COMPRESSED_RGBA_ARB: return &_mesa_texformat_rgba; default: return _mesa_choose_tex_format(ctx, internalFormat, format, type); } } /** * Called by glViewport. * This is a good time for us to poll the current X window size and adjust * our renderbuffers to match the current window size. * Remember, we have no opportunity to respond to conventional * X Resize/StructureNotify events since the X driver has no event loop. * Thus, we poll. * Note that this trick isn't fool-proof. If the application never calls * glViewport, our notion of the current window size may be incorrect. */ static void xmesa_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { #if 1 struct gl_framebuffer *fb = ctx->WinSysDrawBuffer; GLuint newWidth, newHeight; get_buffer_size(fb, &newWidth, &newHeight); if (newWidth != fb->Width || newHeight != fb->Height) { xmesa_resize_buffers(ctx, fb, newWidth, newHeight); } #else /* This also works: */ _mesa_ResizeBuffersMESA(); #endif } /** * Initialize the device driver function table with the functions * we implement in this driver. */ void xmesa_init_driver_functions( XMesaVisual xmvisual, struct dd_function_table *driver ) { driver->GetString = get_string; driver->UpdateState = xmesa_update_state; driver->GetBufferSize = get_buffer_size; driver->Flush = finish_or_flush; driver->Finish = finish_or_flush; driver->ClearIndex = clear_index; driver->ClearColor = clear_color; driver->IndexMask = index_mask; driver->ColorMask = color_mask; driver->Enable = enable; driver->Clear = clear_buffers; driver->ResizeBuffers = xmesa_resize_buffers; driver->Viewport = xmesa_viewport; #ifndef XFree86Server driver->CopyPixels = xmesa_CopyPixels; if (xmvisual->undithered_pf == PF_8R8G8B && xmvisual->dithered_pf == PF_8R8G8B) { driver->DrawPixels = xmesa_DrawPixels_8R8G8B; } else if (xmvisual->undithered_pf == PF_5R6G5B) { driver->DrawPixels = xmesa_DrawPixels_5R6G5B; } #endif driver->TestProxyTexImage = test_proxy_teximage; #if SWTC driver->ChooseTextureFormat = choose_tex_format; #else (void) choose_tex_format; #endif } #define XMESA_NEW_POINT (_NEW_POINT | \ _NEW_RENDERMODE | \ _SWRAST_NEW_RASTERMASK) #define XMESA_NEW_LINE (_NEW_LINE | \ _NEW_TEXTURE | \ _NEW_LIGHT | \ _NEW_DEPTH | \ _NEW_RENDERMODE | \ _SWRAST_NEW_RASTERMASK) #define XMESA_NEW_TRIANGLE (_NEW_POLYGON | \ _NEW_TEXTURE | \ _NEW_LIGHT | \ _NEW_DEPTH | \ _NEW_RENDERMODE | \ _SWRAST_NEW_RASTERMASK) /* Extend the software rasterizer with our line/point/triangle * functions. */ void xmesa_register_swrast_functions( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT( ctx ); swrast->choose_point = xmesa_choose_point; swrast->choose_line = xmesa_choose_line; swrast->choose_triangle = xmesa_choose_triangle; swrast->invalidate_point |= XMESA_NEW_POINT; swrast->invalidate_line |= XMESA_NEW_LINE; swrast->invalidate_triangle |= XMESA_NEW_TRIANGLE; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/drivers/x11/xmesaP.h0000644000000000000000000003765213614532424020727 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XMESAP_H #define XMESAP_H #ifdef XFree86Server # include "GL/xf86glx.h" # include "xf86glx_util.h" #elif defined(USE_XSHM) # include #endif #include "GL/xmesa.h" #include "mtypes.h" #if defined(FX) #include "GL/fxmesa.h" #include "../glide/fxdrv.h" #endif extern _glthread_Mutex _xmesa_lock; /* for PF_8R8G8B24 pixel format */ typedef struct { GLubyte b; GLubyte g; GLubyte r; } bgr_t; struct xmesa_renderbuffer; /* Function pointer for clearing color buffers */ typedef void (*ClearFunc)( GLcontext *ctx, struct xmesa_renderbuffer *xrb, GLboolean all, GLint x, GLint y, GLint width, GLint height ); /** Framebuffer pixel formats */ enum pixel_format { PF_Index, /**< Color Index mode */ PF_Truecolor, /**< TrueColor or DirectColor, any depth */ PF_Dither_True, /**< TrueColor with dithering */ PF_8A8B8G8R, /**< 32-bit TrueColor: 8-A, 8-B, 8-G, 8-R */ PF_8R8G8B, /**< 32-bit TrueColor: 8-R, 8-G, 8-B bits */ PF_5R6G5B, /**< 16-bit TrueColor: 5-R, 6-G, 5-B bits */ PF_Dither, /**< Color-mapped RGB with dither */ PF_Lookup, /**< Color-mapped RGB without dither */ PF_HPCR, /**< HP Color Recovery (ad@lms.be 30/08/95) */ PF_1Bit, /**< monochrome dithering of RGB */ PF_Grayscale, /**< Grayscale or StaticGray */ PF_8R8G8B24, /**< 24-bit TrueColor: 8-R, 8-G, 8-B bits */ PF_Dither_5R6G5B, /**< 16-bit dithered TrueColor: 5-R, 6-G, 5-B */ PF_8A8R8G8B /**< 32-bit TrueColor: 8-A, 8-R, 8-G, 8-B */ }; /* * "Derived" from GLvisual. Basically corresponds to an XVisualInfo. */ struct xmesa_visual { GLvisual mesa_visual; /* Device independent visual parameters */ XMesaDisplay *display; /* The X11 display */ #ifdef XFree86Server GLint ColormapEntries; GLint nplanes; #else XMesaVisualInfo visinfo; /* X's visual info (pointer to private copy) */ XVisualInfo *vishandle; /* Only used in fakeglx.c */ #endif GLint BitsPerPixel; /* True bits per pixel for XImages */ GLboolean ximage_flag; /* Use XImage for back buffer (not pixmap)? */ enum pixel_format dithered_pf; /* Pixel format when dithering */ enum pixel_format undithered_pf;/* Pixel format when not dithering */ GLfloat RedGamma; /* Gamma values, 1.0 is default */ GLfloat GreenGamma; GLfloat BlueGamma; /* For PF_TRUECOLOR */ GLint rshift, gshift, bshift;/* Pixel color component shifts */ GLubyte Kernel[16]; /* Dither kernel */ unsigned long RtoPixel[512]; /* RGB to pixel conversion */ unsigned long GtoPixel[512]; unsigned long BtoPixel[512]; GLubyte PixelToR[256]; /* Pixel to RGB conversion */ GLubyte PixelToG[256]; GLubyte PixelToB[256]; /* For PF_HPCR */ short hpcr_rgbTbl[3][256]; GLboolean hpcr_clear_flag; GLubyte hpcr_clear_ximage_pattern[2][16]; XMesaImage *hpcr_clear_ximage; XMesaPixmap hpcr_clear_pixmap; /* For PF_1BIT */ int bitFlip; }; /* * "Derived" from __GLcontextRec. Basically corresponds to a GLXContext. */ struct xmesa_context { GLcontext mesa; /* the core library context (containment) */ XMesaVisual xm_visual; /* Describes the buffers */ XMesaBuffer xm_buffer; /* current span/point/line/triangle buffer */ XMesaDisplay *display; /* == xm_visual->display */ GLboolean swapbytes; /* Host byte order != display byte order? */ GLboolean direct; /* Direct rendering context? */ enum pixel_format pixelformat; GLubyte clearcolor[4]; /* current clearing color */ unsigned long clearpixel; /* current clearing pixel value */ }; typedef enum { WINDOW, /* An X window */ GLXWINDOW, /* GLX window */ PIXMAP, /* GLX pixmap */ PBUFFER /* GLX Pbuffer */ } BufferType; /** * An xmesa_renderbuffer represents the back or front color buffer. * For the front color buffer: * is the X window * For the back color buffer: * Either or will be used, never both. * In any case, always equals . * For stand-alone Mesa, we could merge and into one * field. We don't do that for the server-side GLcore module because * pixmaps and drawables are different and we'd need a bunch of casts. */ struct xmesa_renderbuffer { struct gl_renderbuffer Base; /* Base class */ XMesaDrawable drawable; /* Usually the X window ID */ XMesaPixmap pixmap; /* Back color buffer */ XMesaImage *ximage; /* The back buffer, if not using a Pixmap */ GLubyte *origin1; /* used for PIXEL_ADDR1 macro */ GLint width1; GLushort *origin2; /* used for PIXEL_ADDR2 macro */ GLint width2; GLubyte *origin3; /* used for PIXEL_ADDR3 macro */ GLint width3; GLuint *origin4; /* used for PIXEL_ADDR4 macro */ GLint width4; GLint bottom; /* used for FLIP macro */ ClearFunc clearFunc; }; /* * "Derived" from GLframebuffer. Basically corresponds to a GLXDrawable. */ struct xmesa_buffer { GLframebuffer mesa_buffer; /* depth, stencil, accum, etc buffers */ /* This MUST BE FIRST! */ GLboolean wasCurrent; /* was ever the current buffer? */ XMesaVisual xm_visual; /* the X/Mesa visual */ XMesaDisplay *display; BufferType type; /* window, pixmap, pbuffer or glxwindow */ struct xmesa_renderbuffer *frontxrb; /* front color renderbuffer */ struct xmesa_renderbuffer *backxrb; /* back color renderbuffer */ XMesaColormap cmap; /* the X colormap */ unsigned long selectedEvents;/* for pbuffers only */ GLint db_state; /* 0 = single buffered */ /* BACK_PIXMAP = use Pixmap for back buffer */ /* BACK_XIMAGE = use XImage for back buffer */ #ifndef XFree86Server GLuint shm; /* X Shared Memory extension status: */ /* 0 = not available */ /* 1 = XImage support available */ /* 2 = Pixmap support available too */ #ifdef USE_XSHM XShmSegmentInfo shminfo; #endif #endif XMesaImage *rowimage; /* Used for optimized span writing */ XMesaPixmap stipple_pixmap; /* For polygon stippling */ XMesaGC stipple_gc; /* For polygon stippling */ XMesaGC gc; /* scratch GC for span, line, tri drawing */ XMesaGC cleargc; /* GC for clearing the color buffer */ XMesaGC swapgc; /* GC for swapping the color buffers */ /* The following are here instead of in the XMesaVisual * because they depend on the window's colormap. */ /* For PF_DITHER, PF_LOOKUP, PF_GRAYSCALE */ unsigned long color_table[576]; /* RGB -> pixel value */ /* For PF_DITHER, PF_LOOKUP, PF_GRAYSCALE */ GLubyte pixel_to_r[65536]; /* pixel value -> red */ GLubyte pixel_to_g[65536]; /* pixel value -> green */ GLubyte pixel_to_b[65536]; /* pixel value -> blue */ /* Used to do XAllocColor/XFreeColors accounting: */ int num_alloced; #if defined(XFree86Server) Pixel alloced_colors[256]; #else unsigned long alloced_colors[256]; #endif #if defined( FX ) /* For 3Dfx Glide only */ GLboolean FXisHackUsable; /* Can we render into window? */ GLboolean FXwindowHack; /* Are we rendering into a window? */ fxMesaContext FXctx; #endif struct xmesa_buffer *Next; /* Linked list pointer: */ }; /* Values for xmesa->db_state: */ #define FRONT_PIXMAP 1 #define BACK_PIXMAP 2 #define BACK_XIMAGE 4 /* * If pixelformat==PF_TRUECOLOR: */ #define PACK_TRUECOLOR( PIXEL, R, G, B ) \ PIXEL = xmesa->xm_visual->RtoPixel[R] \ | xmesa->xm_visual->GtoPixel[G] \ | xmesa->xm_visual->BtoPixel[B]; \ /* * If pixelformat==PF_TRUEDITHER: */ #define PACK_TRUEDITHER( PIXEL, X, Y, R, G, B ) \ { \ int d = xmesa->xm_visual->Kernel[((X)&3) | (((Y)&3)<<2)]; \ PIXEL = xmesa->xm_visual->RtoPixel[(R)+d] \ | xmesa->xm_visual->GtoPixel[(G)+d] \ | xmesa->xm_visual->BtoPixel[(B)+d]; \ } /* * If pixelformat==PF_8A8B8G8R: */ #define PACK_8A8B8G8R( R, G, B, A ) \ ( ((A) << 24) | ((B) << 16) | ((G) << 8) | (R) ) /* * Like PACK_8A8B8G8R() but don't use alpha. This is usually an acceptable * shortcut. */ #define PACK_8B8G8R( R, G, B ) ( ((B) << 16) | ((G) << 8) | (R) ) /* * If pixelformat==PF_8R8G8B: */ #define PACK_8R8G8B( R, G, B) ( ((R) << 16) | ((G) << 8) | (B) ) /* * If pixelformat==PF_5R6G5B: */ #define PACK_5R6G5B( R, G, B) ( (((R) & 0xf8) << 8) | (((G) & 0xfc) << 3) | ((B) >> 3) ) /* * If pixelformat==PF_8A8R8G8B: */ #define PACK_8A8R8G8B( R, G, B, A ) \ ( ((A) << 24) | ((R) << 16) | ((G) << 8) | (B) ) /* * If pixelformat==PF_DITHER: * * Improved 8-bit RGB dithering code contributed by Bob Mercier * (mercier@hollywood.cinenet.net). Thanks Bob! */ #ifdef DITHER666 # define DITH_R 6 # define DITH_G 6 # define DITH_B 6 # define DITH_MIX(r,g,b) (((r) * DITH_G + (g)) * DITH_B + (b)) #else # define DITH_R 5 # define DITH_G 9 # define DITH_B 5 # define DITH_MIX(r,g,b) (((g) << 6) | ((b) << 3) | (r)) #endif #define DITH_DX 4 #define DITH_DY 4 #define DITH_N (DITH_DX * DITH_DY) #define _dither(C, c, d) (((unsigned)((DITH_N * (C - 1) + 1) * c + d)) >> 12) #define MAXC 256 extern const int xmesa_kernel8[DITH_DY * DITH_DX]; /* Dither for random X,Y */ #define DITHER_SETUP \ int __d; \ unsigned long *ctable = XMESA_BUFFER(ctx->DrawBuffer)->color_table; #define DITHER( X, Y, R, G, B ) \ (__d = xmesa_kernel8[(((Y)&3)<<2) | ((X)&3)], \ ctable[DITH_MIX(_dither(DITH_R, (R), __d), \ _dither(DITH_G, (G), __d), \ _dither(DITH_B, (B), __d))]) /* Dither for random X, fixed Y */ #define XDITHER_SETUP(Y) \ int __d; \ unsigned long *ctable = XMESA_BUFFER(ctx->DrawBuffer)->color_table; \ const int *kernel = &xmesa_kernel8[ ((Y)&3) << 2 ]; #define XDITHER( X, R, G, B ) \ (__d = kernel[(X)&3], \ ctable[DITH_MIX(_dither(DITH_R, (R), __d), \ _dither(DITH_G, (G), __d), \ _dither(DITH_B, (B), __d))]) /* * Dithering for flat-shaded triangles. Precompute all 16 possible * pixel values given the triangle's RGB color. Contributed by Martin Shenk. */ #define FLAT_DITHER_SETUP( R, G, B ) \ GLushort ditherValues[16]; \ { \ unsigned long *ctable = XMESA_BUFFER(ctx->DrawBuffer)->color_table; \ int msdr = (DITH_N*((DITH_R)-1)+1) * (R); \ int msdg = (DITH_N*((DITH_G)-1)+1) * (G); \ int msdb = (DITH_N*((DITH_B)-1)+1) * (B); \ int i; \ for (i=0;i<16;i++) { \ int k = xmesa_kernel8[i]; \ int j = DITH_MIX( (msdr+k)>>12, (msdg+k)>>12, (msdb+k)>>12 );\ ditherValues[i] = (GLushort) ctable[j]; \ } \ } #define FLAT_DITHER_ROW_SETUP(Y) \ GLushort *ditherRow = ditherValues + ( ((Y)&3) << 2); #define FLAT_DITHER(X) ditherRow[(X)&3] /* * If pixelformat==PF_LOOKUP: */ #define _dither_lookup(C, c) (((unsigned)((DITH_N * (C - 1) + 1) * c)) >> 12) #define LOOKUP_SETUP \ unsigned long *ctable = XMESA_BUFFER(ctx->DrawBuffer)->color_table #define LOOKUP( R, G, B ) \ ctable[DITH_MIX(_dither_lookup(DITH_R, (R)), \ _dither_lookup(DITH_G, (G)), \ _dither_lookup(DITH_B, (B)))] /* * If pixelformat==PF_HPCR: * * HP Color Recovery dithering (ad@lms.be 30/08/95) * HP has on it's 8-bit 700-series computers, a feature called * 'Color Recovery'. This allows near 24-bit output (so they say). * It is enabled by selecting the 8-bit TrueColor visual AND * corresponding colormap (see tkInitWindow) AND doing some special * dither. */ extern const short xmesa_HPCR_DRGB[3][2][16]; #define DITHER_HPCR( X, Y, R, G, B ) \ ( ((xmesa->xm_visual->hpcr_rgbTbl[0][R] + xmesa_HPCR_DRGB[0][(Y)&1][(X)&15]) & 0xE0) \ |(((xmesa->xm_visual->hpcr_rgbTbl[1][G] + xmesa_HPCR_DRGB[1][(Y)&1][(X)&15]) & 0xE0)>>3) \ | ((xmesa->xm_visual->hpcr_rgbTbl[2][B] + xmesa_HPCR_DRGB[2][(Y)&1][(X)&15])>>6) \ ) /* * If pixelformat==PF_1BIT: */ extern const int xmesa_kernel1[16]; #define SETUP_1BIT int bitFlip = xmesa->xm_visual->bitFlip #define DITHER_1BIT( X, Y, R, G, B ) \ (( ((int)(R)+(int)(G)+(int)(B)) > xmesa_kernel1[(((Y)&3) << 2) | ((X)&3)] ) ^ bitFlip) /* * If pixelformat==PF_GRAYSCALE: */ #define GRAY_RGB( R, G, B ) XMESA_BUFFER(ctx->DrawBuffer)->color_table[((R) + (G) + (B))/3] /* * Converts a GL window Y coord to an X window Y coord: */ #define YFLIP(XRB, Y) ((XRB)->bottom - (Y)) /* * Return the address of a 1, 2 or 4-byte pixel in the buffer's XImage: * X==0 is left, Y==0 is bottom. */ #define PIXEL_ADDR1(XRB, X, Y) \ ( (XRB)->origin1 - (Y) * (XRB)->width1 + (X) ) #define PIXEL_ADDR2(XRB, X, Y) \ ( (XRB)->origin2 - (Y) * (XRB)->width2 + (X) ) #define PIXEL_ADDR3(XRB, X, Y) \ ( (bgr_t *) ( (XRB)->origin3 - (Y) * (XRB)->width3 + 3 * (X) )) #define PIXEL_ADDR4(XRB, X, Y) \ ( (XRB)->origin4 - (Y) * (XRB)->width4 + (X) ) /* * Return pointer to XMesaContext corresponding to a Mesa GLcontext. * Since we're using structure containment, it's just a cast!. */ #define XMESA_CONTEXT(MESACTX) ((XMesaContext) (MESACTX)) /* * Return pointer to XMesaBuffer corresponding to a Mesa GLframebuffer. * Since we're using structure containment, it's just a cast!. */ #define XMESA_BUFFER(MESABUFF) ((XMesaBuffer) (MESABUFF)) /* * External functions: */ extern struct xmesa_renderbuffer * xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, GLboolean rgbMode); extern unsigned long xmesa_color_to_pixel( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLuint pixelFormat ); extern void xmesa_alloc_back_buffer(XMesaBuffer b, GLuint width, GLuint height); extern void xmesa_resize_buffers(GLcontext *ctx, GLframebuffer *buffer, GLuint width, GLuint height); extern void xmesa_init_driver_functions( XMesaVisual xmvisual, struct dd_function_table *driver ); extern void xmesa_update_state( GLcontext *ctx, GLuint new_state ); extern void xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb, enum pixel_format pixelformat, GLint depth); /* Plugged into the software rasterizer. Try to use internal * swrast-style point, line and triangle functions. */ extern void xmesa_choose_point( GLcontext *ctx ); extern void xmesa_choose_line( GLcontext *ctx ); extern void xmesa_choose_triangle( GLcontext *ctx ); extern void xmesa_register_swrast_functions( GLcontext *ctx ); /* XXX this is a hack to implement shared display lists with 3Dfx */ extern XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, XMesaContext c ); /* * These are the extra routines required for integration with XFree86. * None of these routines should be user visible. -KEM */ extern void XMesaSetVisualDisplay( XMesaDisplay *dpy, XMesaVisual v ); extern GLboolean XMesaForceCurrent(XMesaContext c); extern GLboolean XMesaLoseCurrent(XMesaContext c); extern void XMesaReset( void ); #define SWTC 0 /* SW texture compression */ #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/drivers/x11/xm_line.c0000644000000000000000000004721213614532424021111 0ustar /* * Mesa 3-D graphics library * Version: 6.4 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * This file contains "accelerated" point, line, and triangle functions. * It should be fairly easy to write new special-purpose point, line or * triangle functions and hook them into this module. */ #include "glxheader.h" #include "depth.h" #include "macros.h" #include "mtypes.h" #include "xmesaP.h" /* Internal swrast includes: */ #include "swrast/s_depth.h" #include "swrast/s_points.h" #include "swrast/s_lines.h" #include "swrast/s_context.h" /**********************************************************************/ /*** Point rendering ***/ /**********************************************************************/ /* * Render an array of points into a pixmap, any pixel format. */ #if 000 /* XXX don't use this, it doesn't dither correctly */ static void draw_points_ANY_pixmap( GLcontext *ctx, const SWvertex *vert ) { XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; XMesaGC gc = xmesa->xm_buffer->gc; if (xmesa->xm_visual->mesa_visual.RGBAflag) { register int x, y; const GLubyte *color = vert->color; unsigned long pixel = xmesa_color_to_pixel( xmesa, color[0], color[1], color[2], color[3], xmesa->pixelformat); XMesaSetForeground( dpy, gc, pixel ); x = (GLint) vert->win[0]; y = YFLIP( xrb, (GLint) vert->win[1] ); XMesaDrawPoint( dpy, buffer, gc, x, y); } else { /* Color index mode */ register int x, y; XMesaSetForeground( dpy, gc, vert->index ); x = (GLint) vert->win[0]; y = YFLIP( xrb, (GLint) vert->win[1] ); XMesaDrawPoint( dpy, buffer, gc, x, y); } } #endif /* Override the swrast point-selection function. Try to use one of * our internal point functions, otherwise fall back to the standard * swrast functions. */ void xmesa_choose_point( GLcontext *ctx ) { #if 0 XMesaContext xmesa = XMESA_CONTEXT(ctx); SWcontext *swrast = SWRAST_CONTEXT(ctx); if (ctx->RenderMode == GL_RENDER && ctx->Point.Size == 1.0F && !ctx->Point.SmoothFlag && swrast->_RasterMask == 0 && !ctx->Texture._EnabledUnits && xmesa->xm_buffer->buffer != XIMAGE) { swrast->Point = draw_points_ANY_pixmap; } else { _swrast_choose_point( ctx ); } #else _swrast_choose_point( ctx ); #endif } /**********************************************************************/ /*** Line rendering ***/ /**********************************************************************/ #define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \ (struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped /* * Draw a flat-shaded, PF_TRUECOLOR line into an XImage. */ #define NAME flat_TRUECOLOR_line #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; \ unsigned long pixel; \ PACK_TRUECOLOR( pixel, color[0], color[1], color[2] ); #define CLIP_HACK 1 #define PLOT(X,Y) XMesaPutPixel(xrb->ximage, X, YFLIP(xrb, Y), pixel ); #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, PF_8A8B8G8R line into an XImage. */ #define NAME flat_8A8B8G8R_line #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; \ GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] ); #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define CLIP_HACK 1 #define PLOT(X,Y) *pixelPtr = pixel; #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, PF_8A8R8G8B line into an XImage. */ #define NAME flat_8A8R8G8B_line #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; \ GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] ); #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define CLIP_HACK 1 #define PLOT(X,Y) *pixelPtr = pixel; #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, PF_8R8G8B line into an XImage. */ #define NAME flat_8R8G8B_line #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; \ GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] ); #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define CLIP_HACK 1 #define PLOT(X,Y) *pixelPtr = pixel; #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, PF_8R8G8B24 line into an XImage. */ #define NAME flat_8R8G8B24_line #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; #define PIXEL_TYPE bgr_t #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X, Y) #define CLIP_HACK 1 #define PLOT(X,Y) { \ pixelPtr->r = color[RCOMP]; \ pixelPtr->g = color[GCOMP]; \ pixelPtr->b = color[BCOMP]; \ } #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, PF_5R6G5B line into an XImage. */ #define NAME flat_5R6G5B_line #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; \ GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] ); #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) #define CLIP_HACK 1 #define PLOT(X,Y) *pixelPtr = pixel; #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, PF_DITHER_5R6G5B line into an XImage. */ #define NAME flat_DITHER_5R6G5B_line #define SETUP_CODE \ GET_XRB(xrb); \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ const GLubyte *color = vert1->color; #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) #define CLIP_HACK 1 #define PLOT(X,Y) PACK_TRUEDITHER( *pixelPtr, X, Y, color[0], color[1], color[2] ); #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, PF_DITHER 8-bit line into an XImage. */ #define NAME flat_DITHER8_line #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; \ GLint r = color[0], g = color[1], b = color[2]; \ DITHER_SETUP; #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) #define CLIP_HACK 1 #define PLOT(X,Y) *pixelPtr = DITHER(X,Y,r,g,b); #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, PF_LOOKUP 8-bit line into an XImage. */ #define NAME flat_LOOKUP8_line #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; \ GLubyte pixel; \ LOOKUP_SETUP; \ pixel = (GLubyte) LOOKUP( color[0], color[1], color[2] ); #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) *pixelPtr = pixel; #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, PF_HPCR line into an XImage. */ #define NAME flat_HPCR_line #define SETUP_CODE \ GET_XRB(xrb); \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ const GLubyte *color = vert1->color; \ GLint r = color[0], g = color[1], b = color[2]; #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) *pixelPtr = (GLubyte) DITHER_HPCR(X,Y,r,g,b); #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, Z-less, PF_TRUECOLOR line into an XImage. */ #define NAME flat_TRUECOLOR_z_line #define SETUP_CODE \ GET_XRB(xrb); \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ const GLubyte *color = vert1->color; \ unsigned long pixel; \ PACK_TRUECOLOR( pixel, color[0], color[1], color[2] ); #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define CLIP_HACK 1 #define PLOT(X,Y) \ if (Z < *zPtr) { \ *zPtr = Z; \ XMesaPutPixel(xrb->ximage, X, YFLIP(xrb, Y), pixel); \ } #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, Z-less, PF_8A8B8G8R line into an XImage. */ #define NAME flat_8A8B8G8R_z_line #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; \ GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] ); #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) \ if (Z < *zPtr) { \ *zPtr = Z; \ *pixelPtr = pixel; \ } #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, Z-less, PF_8A8R8G8B line into an XImage. */ #define NAME flat_8A8R8G8B_z_line #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; \ GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] ); #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) \ if (Z < *zPtr) { \ *zPtr = Z; \ *pixelPtr = pixel; \ } #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, Z-less, PF_8R8G8B line into an XImage. */ #define NAME flat_8R8G8B_z_line #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; \ GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] ); #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) \ if (Z < *zPtr) { \ *zPtr = Z; \ *pixelPtr = pixel; \ } #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, Z-less, PF_8R8G8B24 line into an XImage. */ #define NAME flat_8R8G8B24_z_line #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE bgr_t #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) \ if (Z < *zPtr) { \ *zPtr = Z; \ pixelPtr->r = color[RCOMP]; \ pixelPtr->g = color[GCOMP]; \ pixelPtr->b = color[BCOMP]; \ } #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, Z-less, PF_5R6G5B line into an XImage. */ #define NAME flat_5R6G5B_z_line #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; \ GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] ); #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) \ if (Z < *zPtr) { \ *zPtr = Z; \ *pixelPtr = pixel; \ } #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, Z-less, PF_DITHER_5R6G5B line into an XImage. */ #define NAME flat_DITHER_5R6G5B_z_line #define SETUP_CODE \ GET_XRB(xrb); \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ const GLubyte *color = vert1->color; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) \ if (Z < *zPtr) { \ *zPtr = Z; \ PACK_TRUEDITHER(*pixelPtr, X, Y, color[0], color[1], color[2]); \ } #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, Z-less, PF_DITHER 8-bit line into an XImage. */ #define NAME flat_DITHER8_z_line #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; \ GLint r = color[0], g = color[1], b = color[2]; \ DITHER_SETUP; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) \ if (Z < *zPtr) { \ *zPtr = Z; \ *pixelPtr = (GLubyte) DITHER( X, Y, r, g, b); \ } #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, Z-less, PF_LOOKUP 8-bit line into an XImage. */ #define NAME flat_LOOKUP8_z_line #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = vert1->color; \ GLubyte pixel; \ LOOKUP_SETUP; \ pixel = (GLubyte) LOOKUP( color[0], color[1], color[2] ); #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) \ if (Z < *zPtr) { \ *zPtr = Z; \ *pixelPtr = pixel; \ } #include "swrast/s_linetemp.h" /* * Draw a flat-shaded, Z-less, PF_HPCR line into an XImage. */ #define NAME flat_HPCR_z_line #define SETUP_CODE \ GET_XRB(xrb); \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ const GLubyte *color = vert1->color; \ GLint r = color[0], g = color[1], b = color[2]; #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X,Y) #define CLIP_HACK 1 #define PLOT(X,Y) \ if (Z < *zPtr) { \ *zPtr = Z; \ *pixelPtr = (GLubyte) DITHER_HPCR( X, Y, r, g, b); \ } #include "swrast/s_linetemp.h" #ifndef XFree86Server /** * Draw fast, XOR line with XDrawLine in front color buffer. * WARNING: this isn't fully OpenGL conformant because different pixels * will be hit versus using the other line functions. * Don't use the code in X server GLcore module since we need a wrapper * for the XSetLineAttributes() function call. */ static void xor_line(GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1) { XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaGC gc = xmesa->xm_buffer->gc; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0]; unsigned long pixel = xmesa_color_to_pixel(ctx, vert1->color[0], vert1->color[1], vert1->color[2], vert1->color[3], xmesa->pixelformat); int x0 = (int) vert0->win[0]; int y0 = YFLIP(xrb, (GLint) vert0->win[1]); int x1 = (int) vert1->win[0]; int y1 = YFLIP(xrb, (GLint) vert1->win[1]); XMesaSetForeground(dpy, gc, pixel); XMesaSetFunction(dpy, gc, GXxor); XSetLineAttributes(dpy, gc, (int) ctx->Line.Width, LineSolid, CapButt, JoinMiter); XDrawLine(dpy, xrb->pixmap, gc, x0, y0, x1, y1); XMesaSetFunction(dpy, gc, GXcopy); /* this gc is used elsewhere */ } #endif /* XFree86Server */ static swrast_line_func get_line_func( GLcontext *ctx ) { XMesaContext xmesa = XMESA_CONTEXT(ctx); SWcontext *swrast = SWRAST_CONTEXT(ctx); int depth = GET_VISUAL_DEPTH(xmesa->xm_visual); GET_XRB(xrb); if ((ctx->DrawBuffer->_ColorDrawBufferMask[0] & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) == 0) return (swrast_line_func) NULL; if (ctx->RenderMode != GL_RENDER) return (swrast_line_func) NULL; if (ctx->Line.SmoothFlag) return (swrast_line_func) NULL; if (ctx->Texture._EnabledUnits) return (swrast_line_func) NULL; if (ctx->Light.ShadeModel != GL_FLAT) return (swrast_line_func) NULL; if (ctx->Line.StippleFlag) return (swrast_line_func) NULL; if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL; if (xrb->ximage && swrast->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Line.Width==1.0F) { switch (xmesa->pixelformat) { case PF_Truecolor: return flat_TRUECOLOR_z_line; case PF_8A8B8G8R: return flat_8A8B8G8R_z_line; case PF_8A8R8G8B: return flat_8A8R8G8B_z_line; case PF_8R8G8B: return flat_8R8G8B_z_line; case PF_8R8G8B24: return flat_8R8G8B24_z_line; case PF_5R6G5B: return flat_5R6G5B_z_line; case PF_Dither_5R6G5B: return flat_DITHER_5R6G5B_z_line; case PF_Dither: return (depth==8) ? flat_DITHER8_z_line : (swrast_line_func) NULL; case PF_Lookup: return (depth==8) ? flat_LOOKUP8_z_line : (swrast_line_func) NULL; case PF_HPCR: return flat_HPCR_z_line; default: return (swrast_line_func)NULL; } } if (xrb->ximage && swrast->_RasterMask==0 && ctx->Line.Width==1.0F) { switch (xmesa->pixelformat) { case PF_Truecolor: return flat_TRUECOLOR_line; case PF_8A8B8G8R: return flat_8A8B8G8R_line; case PF_8A8R8G8B: return flat_8A8R8G8B_line; case PF_8R8G8B: return flat_8R8G8B_line; case PF_8R8G8B24: return flat_8R8G8B24_line; case PF_5R6G5B: return flat_5R6G5B_line; case PF_Dither_5R6G5B: return flat_DITHER_5R6G5B_line; case PF_Dither: return (depth==8) ? flat_DITHER8_line : (swrast_line_func) NULL; case PF_Lookup: return (depth==8) ? flat_LOOKUP8_line : (swrast_line_func) NULL; case PF_HPCR: return flat_HPCR_line; default: return (swrast_line_func)NULL; } } #ifndef XFree86Server if (ctx->DrawBuffer->_NumColorDrawBuffers[0] == 1 && ctx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT && swrast->_RasterMask == LOGIC_OP_BIT && ctx->Color.LogicOp == GL_XOR && !ctx->Line.StippleFlag && !ctx->Line.SmoothFlag) { return xor_line; } #endif /* XFree86Server */ return (swrast_line_func) NULL; } /** * Override for the swrast line-selection function. Try to use one * of our internal line functions, otherwise fall back to the * standard swrast functions. */ void xmesa_choose_line(GLcontext *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (!(swrast->Line = get_line_func( ctx ))) _swrast_choose_line( ctx ); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/drivers/x11/xm_span.c0000644000000000000000000045373413614532424021135 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* $XFree86: xc/extras/Mesa/src/X/xm_span.c,v 1.3 2002/02/27 21:07:54 tsi Exp $ */ #include "glxheader.h" #include "colormac.h" #include "context.h" #include "depth.h" #include "drawpix.h" #include "extensions.h" #include "macros.h" #include "imports.h" #include "mtypes.h" #include "state.h" #include "xmesaP.h" #include "swrast/swrast.h" /* * The following functions are used to trap XGetImage() calls which * generate BadMatch errors if the drawable isn't mapped. */ #ifndef XFree86Server static int caught_xgetimage_error = 0; static int (*old_xerror_handler)( XMesaDisplay *dpy, XErrorEvent *ev ); static unsigned long xgetimage_serial; /* * This is the error handler which will be called if XGetImage fails. */ static int xgetimage_error_handler( XMesaDisplay *dpy, XErrorEvent *ev ) { if (ev->serial==xgetimage_serial && ev->error_code==BadMatch) { /* caught the expected error */ caught_xgetimage_error = 0; } else { /* call the original X error handler, if any. otherwise ignore */ if (old_xerror_handler) { (*old_xerror_handler)( dpy, ev ); } } return 0; } /* * Call this right before XGetImage to setup error trap. */ static void catch_xgetimage_errors( XMesaDisplay *dpy ) { xgetimage_serial = NextRequest( dpy ); old_xerror_handler = XSetErrorHandler( xgetimage_error_handler ); caught_xgetimage_error = 0; } /* * Call this right after XGetImage to check if an error occured. */ static int check_xgetimage_errors( void ) { /* restore old handler */ (void) XSetErrorHandler( old_xerror_handler ); /* return 0=no error, 1=error caught */ return caught_xgetimage_error; } #endif /* * Read a pixel from an X drawable. */ static unsigned long read_pixel( XMesaDisplay *dpy, XMesaDrawable d, int x, int y ) { unsigned long p; #ifndef XFree86Server XMesaImage *pixel = NULL; int error; catch_xgetimage_errors( dpy ); pixel = XGetImage( dpy, d, x, y, 1, 1, AllPlanes, ZPixmap ); error = check_xgetimage_errors(); if (pixel && !error) { p = XMesaGetPixel( pixel, 0, 0 ); } else { p = 0; } if (pixel) { XMesaDestroyImage( pixel ); } #else (*dpy->GetImage)(d, x, y, 1, 1, ZPixmap, ~0L, (pointer)&p); #endif return p; } /* * The Mesa library needs to be able to draw pixels in a number of ways: * 1. RGB vs Color Index * 2. as horizontal spans (polygons, images) vs random locations (points, * lines) * 3. different color per-pixel or same color for all pixels * * Furthermore, the X driver needs to support rendering to 3 possible * "buffers", usually one, but sometimes two at a time: * 1. The front buffer as an X window * 2. The back buffer as a Pixmap * 3. The back buffer as an XImage * * Finally, if the back buffer is an XImage, we can avoid using XPutPixel and * optimize common cases such as 24-bit and 8-bit modes. * * By multiplication, there's at least 48 possible combinations of the above. * * Below are implementations of the most commonly used combinations. They are * accessed through function pointers which get initialized here and are used * directly from the Mesa library. The 8 function pointers directly correspond * to the first 3 cases listed above. * * * The function naming convention is: * * [put|get]_[mono]_[row|values]_[format]_[pixmap|ximage] * * New functions optimized for specific cases can be added without too much * trouble. An example might be the 24-bit TrueColor mode 8A8R8G8B which is * found on IBM RS/6000 X servers. */ /**********************************************************************/ /*** Write COLOR SPAN functions ***/ /**********************************************************************/ #define PUT_ROW_ARGS \ GLcontext *ctx, \ struct gl_renderbuffer *rb, \ GLuint n, GLint x, GLint y, \ const void *values, const GLubyte mask[] #define RGB_SPAN_ARGS \ GLcontext *ctx, \ struct gl_renderbuffer *rb, \ GLuint n, GLint x, GLint y, \ const void *values, const GLubyte mask[] /* NOTE: if mask==NULL, draw all pixels */ /* * Write a span of PF_TRUECOLOR pixels to a pixmap. */ static void put_row_TRUECOLOR_pixmap( PUT_ROW_ARGS ) { const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = XMESA_BUFFER(ctx->DrawBuffer)->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; y = YFLIP(xrb, y); if (mask) { register GLuint i; for (i=0;iDrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; register GLuint pixel; static const GLuint shift[4] = {0, 8, 16, 24}; register GLuint i = 0; int w = n; while (w > 3) { pixel = rgba[i][BCOMP] /* << shift[0]*/; pixel |= rgba[i][GCOMP] << shift[1]; pixel |= rgba[i++][RCOMP] << shift[2]; pixel |= rgba[i][BCOMP] << shift[3]; *ptr4++ = pixel; pixel = rgba[i][GCOMP] /* << shift[0]*/; pixel |= rgba[i++][RCOMP] << shift[1]; pixel |= rgba[i][BCOMP] << shift[2]; pixel |= rgba[i][GCOMP] << shift[3]; *ptr4++ = pixel; pixel = rgba[i++][RCOMP]/* << shift[0]*/; pixel |= rgba[i][BCOMP] << shift[1]; pixel |= rgba[i][GCOMP] << shift[2]; pixel |= rgba[i++][RCOMP] << shift[3]; *ptr4++ = pixel; w -= 4; } switch (w) { case 3: pixel = 0; pixel |= rgba[i][BCOMP] /*<< shift[0]*/; pixel |= rgba[i][GCOMP] << shift[1]; pixel |= rgba[i++][RCOMP] << shift[2]; pixel |= rgba[i][BCOMP] << shift[3]; *ptr4++ = pixel; pixel = 0; pixel |= rgba[i][GCOMP] /*<< shift[0]*/; pixel |= rgba[i++][RCOMP] << shift[1]; pixel |= rgba[i][BCOMP] << shift[2]; pixel |= rgba[i][GCOMP] << shift[3]; *ptr4++ = pixel; pixel = 0xffffff00 & *ptr4; pixel |= rgba[i][RCOMP] /*<< shift[0]*/; *ptr4 = pixel; break; case 2: pixel = 0; pixel |= rgba[i][BCOMP] /*<< shift[0]*/; pixel |= rgba[i][GCOMP] << shift[1]; pixel |= rgba[i++][RCOMP] << shift[2]; pixel |= rgba[i][BCOMP] << shift[3]; *ptr4++ = pixel; pixel = 0xffff0000 & *ptr4; pixel |= rgba[i][GCOMP] /*<< shift[0]*/; pixel |= rgba[i][RCOMP] << shift[1]; *ptr4 = pixel; break; case 1: pixel = 0xff000000 & *ptr4; pixel |= rgba[i][BCOMP] /*<< shift[0]*/; pixel |= rgba[i][GCOMP] << shift[1]; pixel |= rgba[i][RCOMP] << shift[2]; *ptr4 = pixel; break; case 0: break; } XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, n, 1 ); } } /* * Write a span of PF_8R8G8B pixels to a pixmap (no alpha). */ static void put_row_rgb_8R8G8B_pixmap( RGB_SPAN_ARGS ) { const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; y = YFLIP(xrb, y); if (mask) { register GLuint i; for (i=0;iDrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; register GLuint pixel; static const GLuint shift[4] = {0, 8, 16, 24}; unsigned w = n; register GLuint i = 0; while (w > 3) { pixel = 0; pixel |= rgb[i][BCOMP]/* << shift[0]*/; pixel |= rgb[i][GCOMP] << shift[1]; pixel |= rgb[i++][RCOMP] << shift[2]; pixel |= rgb[i][BCOMP] <xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; register GLushort *ptr2 = (GLushort *) rowimg->data; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; register GLushort *ptr2 = (GLushort *) rowimg->data; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; register GLushort *ptr2 = (GLushort *) rowimg->data; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; register GLushort *ptr2 = (GLushort *) rowimg->data; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; XDITHER_SETUP(y); y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; XDITHER_SETUP(y); y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; register GLubyte *ptr = (GLubyte *) XMESA_BUFFER(ctx->DrawBuffer)->rowimage->data; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; register GLubyte *ptr = (GLubyte *) XMESA_BUFFER(ctx->DrawBuffer)->rowimage->data; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; LOOKUP_SETUP; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; LOOKUP_SETUP; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; for (i=0;iximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;i 3) { pixel = rgba[i][BCOMP]; pixel |= rgba[i][GCOMP] << 8; pixel |= rgba[i++][RCOMP] << 16; pixel |= rgba[i][BCOMP] << 24; *ptr4++ = pixel; pixel = rgba[i][GCOMP]; pixel |= rgba[i++][RCOMP] << 8; pixel |= rgba[i][BCOMP] << 16; pixel |= rgba[i][GCOMP] << 24; *ptr4++ = pixel; pixel = rgba[i++][RCOMP]; pixel |= rgba[i][BCOMP] << 8; pixel |= rgba[i][GCOMP] << 16; pixel |= rgba[i++][RCOMP] << 24; *ptr4++ = pixel; w -= 4; } switch (w) { case 0: break; case 1: pixel = *ptr4 & 0xff000000; pixel |= rgba[i][BCOMP]; pixel |= rgba[i][GCOMP] << 8; pixel |= rgba[i][RCOMP] << 16; *ptr4 = pixel; break; case 2: pixel = rgba[i][BCOMP]; pixel |= rgba[i][GCOMP] << 8; pixel |= rgba[i++][RCOMP] << 16; pixel |= rgba[i][BCOMP] << 24; *ptr4++ = pixel; pixel = *ptr4 & 0xffff0000; pixel |= rgba[i][GCOMP]; pixel |= rgba[i][RCOMP] << 8; *ptr4 = pixel; break; case 3: pixel = rgba[i][BCOMP]; pixel |= rgba[i][GCOMP] << 8; pixel |= rgba[i++][RCOMP] << 16; pixel |= rgba[i][BCOMP] << 24; *ptr4++ = pixel; pixel = rgba[i][GCOMP]; pixel |= rgba[i++][RCOMP] << 8; pixel |= rgba[i][BCOMP] << 16; pixel |= rgba[i][GCOMP] << 24; *ptr4++ = pixel; pixel = *ptr4 & 0xffffff00; pixel |= rgba[i][RCOMP]; *ptr4 = pixel; break; } } } /* * Write a span of PF_8R8G8B-format pixels to an ximage (no alpha). */ static void put_row_rgb_8R8G8B_ximage( RGB_SPAN_ARGS ) { const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; register GLuint *ptr = PIXEL_ADDR4(xrb, x, y); if (mask) { for (i=0;iximage; register GLuint i; int yy = YFLIP(xrb, y); XDITHER_SETUP(yy); if (mask) { for (i=0;iximage; register GLuint i; int yy = YFLIP(xrb, y); XDITHER_SETUP(yy); if (mask) { for (i=0;iximage; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); if (mask) { for (i=0;iximage; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); if (mask) { for (i=0;iximage; register GLuint i; LOOKUP_SETUP; y = YFLIP(xrb, y); if (mask) { for (i=0;iximage; register GLuint i; LOOKUP_SETUP; y = YFLIP(xrb, y); if (mask) { for (i=0;iximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; DITHER_SETUP; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; SETUP_1BIT; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; LOOKUP_SETUP; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;iximage; register GLuint i; for (i=0;iximage; register GLuint i; for (i=0;ir = rgba[i][RCOMP]; ptr->g = rgba[i][GCOMP]; ptr->b = rgba[i][BCOMP]; } } } /* * Write an array of PF_5R6G5B pixels to an ximage. */ static void put_values_5R6G5B_ximage( PUT_VALUES_ARGS ) { const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; for (i=0;iximage; register GLuint i; DITHER_SETUP; for (i=0;iximage; register GLuint i; SETUP_1BIT; for (i=0;iximage; register GLuint i; LOOKUP_SETUP; for (i=0;iximage; register GLuint i; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); register GLuint i; XMesaSetForeground( xmesa->display, gc, pixel ); y = YFLIP(xrb, y); /* New code contributed by Jeff Epler and cleaned up by Keith * Whitwell. */ for (i = 0; i < n; ) { GLuint start = i; /* Identify and emit contiguous rendered pixels */ while (i < n && (!mask || mask[i])) i++; if (start < i) XMesaFillRectangle( dpy, buffer, gc, (int)(x+start), (int) y, (int)(i-start), 1); /* Eat up non-rendered pixels */ while (i < n && !mask[i]) i++; } } static void put_mono_row_ci_pixmap( PUT_MONO_ROW_ARGS ) { GLuint colorIndex = *((GLuint *) value); XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; XMesaSetForeground( xmesa->display, gc, colorIndex ); y = YFLIP(xrb, y); for (i = 0 ; i < n ;) { GLuint start = i; /* Identify and emit contiguous rendered pixels */ while (i < n && (!mask || mask[i])) i++; if (start < i) XMesaFillRectangle( dpy, buffer, gc, (int)(x+start), (int) y, (int)(i-start), 1); /* Eat up non-rendered pixels */ while (i < n && !mask[i]) i++; } } /* * Write a span of PF_TRUEDITHER pixels to a pixmap. */ static void put_mono_row_TRUEDITHER_pixmap( PUT_MONO_ROW_ARGS ) { const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; int yy = YFLIP(xrb, y); for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; int yy = YFLIP(xrb, y); XDITHER_SETUP(yy); for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); for (i=0;iximage; register GLuint i; const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); y = YFLIP(xrb, y); for (i=0;iximage; register GLuint i; y = YFLIP(xrb, y); for (i=0;iximage; const GLint r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; GLuint i; y = YFLIP(xrb, y); for (i=0;ipixelformat); ptr = PIXEL_ADDR4(xrb, x, y ); for (i=0;ipixelformat); ptr = PIXEL_ADDR4(xrb, x, y ); for (i=0;iximage; int yy = YFLIP(xrb, y); register GLuint i; XDITHER_SETUP(yy); for (i=0;iximage; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); XMesaSetForeground( xmesa->display, gc, pixel ); for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; XMesaSetForeground( xmesa->display, gc, colorIndex ); for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; DITHER_SETUP; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; SETUP_1BIT; for (i=0;iximage; register GLuint i; const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); for (i=0;iximage; register GLuint i; for (i=0;iximage; register GLuint i; const int r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; for (i=0;ir = r; ptr->g = g; ptr->b = b; } } } /* * Write an array of identical PF_DITHER pixels to an XImage. */ static void put_mono_values_DITHER_ximage( PUT_MONO_VALUES_ARGS ) { const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; XMesaImage *img = xrb->ximage; register GLuint i; DITHER_SETUP; for (i=0;iximage; register GLuint i; SETUP_1BIT; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;iximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;iximage; register GLuint i; for (i=0;iDrawBuffer); Window rootWin = RootWindow(xmesa->display, 0); Window child; GLint screenWidth = WidthOfScreen(DefaultScreenOfDisplay(xmesa->display)); GLint dx, dy; if (source->type == PBUFFER || source->type == PIXMAP) return 0; XTranslateCoordinates(xmesa->display, source->frontxrb->pixmap, rootWin, *x, *y, &dx, &dy, &child); if (dx >= screenWidth) { /* totally clipped on right */ return -1; } if (dx < 0) { /* clipped on left */ GLint clip = -dx; if (clip >= (GLint) *n) return -1; /* totally clipped on left */ *x += clip; *n -= clip; dx = 0; return clip; } if ((GLint) (dx + *n) > screenWidth) { /* clipped on right */ GLint clip = dx + *n - screenWidth; *n -= clip; } return 0; } #endif /* * Read a horizontal span of color-index pixels. */ static void get_row_ci(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values) { GLuint *index = (GLuint *) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; GLuint i; y = YFLIP(xrb, y); if (xrb->pixmap) { #ifndef XFree86Server XMesaImage *span = NULL; int error; int k = clip_for_xgetimage(ctx, &n, &x, &y); if (k < 0) return; index += k; catch_xgetimage_errors( xmesa->display ); span = XGetImage( xmesa->display, xrb->pixmap, x, y, n, 1, AllPlanes, ZPixmap ); error = check_xgetimage_errors(); if (span && !error) { for (i=0;idisplay->GetImage)(xrb->drawable, x, y, n, 1, ZPixmap, ~0L, (pointer)index); #endif } else if (xrb->ximage) { XMesaImage *img = xrb->ximage; for (i=0;iDrawBuffer); if (xrb->pixmap) { /* Read from Pixmap or Window */ XMesaImage *span = NULL; int error; #ifdef XFree86Server span = XMesaCreateImage(xmesa->xm_visual->BitsPerPixel, n, 1, NULL); span->data = (char *)MALLOC(span->height * span->bytes_per_line); error = (!span->data); (*xmesa->display->GetImage)(xrb->drawable, x, YFLIP(xrb, y), n, 1, ZPixmap, ~0L, (pointer)span->data); #else int k; y = YFLIP(xrb, y); k = clip_for_xgetimage(ctx, &n, &x, &y); if (k < 0) return; rgba += k; catch_xgetimage_errors( xmesa->display ); span = XGetImage( xmesa->display, xrb->pixmap, x, y, n, 1, AllPlanes, ZPixmap ); error = check_xgetimage_errors(); #endif if (span && !error) { switch (xmesa->pixelformat) { case PF_Truecolor: case PF_Dither_True: { const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; unsigned long rMask = GET_REDMASK(xmesa->xm_visual); unsigned long gMask = GET_GREENMASK(xmesa->xm_visual); unsigned long bMask = GET_BLUEMASK(xmesa->xm_visual); GLint rShift = xmesa->xm_visual->rshift; GLint gShift = xmesa->xm_visual->gshift; GLint bShift = xmesa->xm_visual->bshift; GLuint i; for (i=0;i> rShift]; rgba[i][GCOMP] = pixelToG[(p & gMask) >> gShift]; rgba[i][BCOMP] = pixelToB[(p & bMask) >> bShift]; rgba[i][ACOMP] = 255; } } break; case PF_5R6G5B: case PF_Dither_5R6G5B: { const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; GLuint i; for (i=0;i> 8) & 0xf8); rgba[i][GCOMP] = ((p >> 3) & 0xfc); rgba[i][BCOMP] = ((p << 3) & 0xff); */ rgba[i][RCOMP] = pixelToR[p >> 11]; rgba[i][GCOMP] = pixelToG[(p >> 5) & 0x3f]; rgba[i][BCOMP] = pixelToB[p & 0x1f]; rgba[i][ACOMP] = 255; } } break; case PF_8A8B8G8R: { const GLuint *ptr4 = (GLuint *) span->data; GLuint i; for (i=0;i> 8) & 0xff); rgba[i][BCOMP] = (GLubyte) ((p4 >> 16) & 0xff); rgba[i][ACOMP] = (GLubyte) ((p4 >> 24) & 0xff); } } break; case PF_8A8R8G8B: { const GLuint *ptr4 = (GLuint *) span->data; GLuint i; for (i=0;i> 16) & 0xff); rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff); rgba[i][BCOMP] = (GLubyte) ( p4 & 0xff); rgba[i][ACOMP] = (GLubyte) ((p4 >> 24) & 0xff); } } break; case PF_8R8G8B: { const GLuint *ptr4 = (GLuint *) span->data; GLuint i; for (i=0;i> 16) & 0xff); rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff); rgba[i][BCOMP] = (GLubyte) ( p4 & 0xff); rgba[i][ACOMP] = 255; } } break; case PF_8R8G8B24: { const bgr_t *ptr3 = (bgr_t *) span->data; GLuint i; for (i=0;idata; GLuint i; for (i=0;ipixel_to_r; GLubyte *gTable = source->pixel_to_g; GLubyte *bTable = source->pixel_to_b; if (GET_VISUAL_DEPTH(xmesa->xm_visual)==8) { const GLubyte *ptr1 = (GLubyte *) span->data; GLuint i; for (i=0;ixm_visual->bitFlip; GLuint i; for (i=0;iximage) { /* Read from XImage back buffer */ switch (xmesa->pixelformat) { case PF_Truecolor: case PF_Dither_True: { const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; unsigned long rMask = GET_REDMASK(xmesa->xm_visual); unsigned long gMask = GET_GREENMASK(xmesa->xm_visual); unsigned long bMask = GET_BLUEMASK(xmesa->xm_visual); GLint rShift = xmesa->xm_visual->rshift; GLint gShift = xmesa->xm_visual->gshift; GLint bShift = xmesa->xm_visual->bshift; XMesaImage *img = xrb->ximage; GLuint i; y = YFLIP(xrb, y); for (i=0;i> rShift]; rgba[i][GCOMP] = pixelToG[(p & gMask) >> gShift]; rgba[i][BCOMP] = pixelToB[(p & bMask) >> bShift]; rgba[i][ACOMP] = 255; } } break; case PF_5R6G5B: case PF_Dither_5R6G5B: { const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; const GLushort *ptr2 = PIXEL_ADDR2(xrb, x, y); GLuint i; #if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ const GLuint *ptr4 = (const GLuint *) ptr2; GLuint extraPixel = (n & 1); n -= extraPixel; for (i = 0; i < n; i += 2) { const GLuint p = *ptr4++; const GLuint p0 = p & 0xffff; const GLuint p1 = p >> 16; /* fast, but not quite accurate rgba[i][RCOMP] = ((p >> 8) & 0xf8); rgba[i][GCOMP] = ((p >> 3) & 0xfc); rgba[i][BCOMP] = ((p << 3) & 0xff); */ rgba[i][RCOMP] = pixelToR[p0 >> 11]; rgba[i][GCOMP] = pixelToG[(p0 >> 5) & 0x3f]; rgba[i][BCOMP] = pixelToB[p0 & 0x1f]; rgba[i][ACOMP] = 255; rgba[i+1][RCOMP] = pixelToR[p1 >> 11]; rgba[i+1][GCOMP] = pixelToG[(p1 >> 5) & 0x3f]; rgba[i+1][BCOMP] = pixelToB[p1 & 0x1f]; rgba[i+1][ACOMP] = 255; } if (extraPixel) { GLushort p = ptr2[n]; rgba[n][RCOMP] = pixelToR[p >> 11]; rgba[n][GCOMP] = pixelToG[(p >> 5) & 0x3f]; rgba[n][BCOMP] = pixelToB[p & 0x1f]; rgba[n][ACOMP] = 255; } #else for (i = 0; i < n; i++) { const GLushort p = ptr2[i]; rgba[i][RCOMP] = pixelToR[p >> 11]; rgba[i][GCOMP] = pixelToG[(p >> 5) & 0x3f]; rgba[i][BCOMP] = pixelToB[p & 0x1f]; rgba[i][ACOMP] = 255; } #endif } break; case PF_8A8B8G8R: { const GLuint *ptr4 = PIXEL_ADDR4(xrb, x, y); GLuint i; for (i=0;i> 8) & 0xff); rgba[i][BCOMP] = (GLubyte) ((p4 >> 16) & 0xff); rgba[i][ACOMP] = (GLint) ((p4 >> 24) & 0xff); } } break; case PF_8A8R8G8B: { const GLuint *ptr4 = PIXEL_ADDR4(xrb, x, y); GLuint i; for (i=0;i> 16) & 0xff); rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff); rgba[i][BCOMP] = (GLubyte) ( p4 & 0xff); rgba[i][ACOMP] = (GLint) ((p4 >> 24) & 0xff); } } break; case PF_8R8G8B: { const GLuint *ptr4 = PIXEL_ADDR4(xrb, x, y); GLuint i; for (i=0;i> 16) & 0xff); rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff); rgba[i][BCOMP] = (GLubyte) ( p4 & 0xff); rgba[i][ACOMP] = 255; } } break; case PF_8R8G8B24: { const bgr_t *ptr3 = PIXEL_ADDR3(xrb, x, y); GLuint i; for (i=0;ipixel_to_r; const GLubyte *gTable = source->pixel_to_g; const GLubyte *bTable = source->pixel_to_b; if (GET_VISUAL_DEPTH(xmesa->xm_visual)==8) { GLubyte *ptr1 = PIXEL_ADDR1(xrb, x, y); GLuint i; for (i=0;iximage; GLuint i; y = YFLIP(xrb, y); for (i=0;iximage; int bitFlip = xmesa->xm_visual->bitFlip; GLuint i; y = YFLIP(xrb, y); for (i=0;ipixmap) { for (i=0;idisplay, xrb->drawable, x[i], YFLIP(xrb, y[i]) ); } } else if (xrb->ximage) { XMesaImage *img = xrb->ximage; for (i=0;ixm_visual->display; XMesaBuffer source = XMESA_BUFFER(ctx->DrawBuffer); register GLuint i; if (xrb->pixmap) { XMesaDrawable buffer = xrb->drawable; switch (xmesa->pixelformat) { case PF_Truecolor: case PF_Dither_True: case PF_5R6G5B: case PF_Dither_5R6G5B: { unsigned long rMask = GET_REDMASK(xmesa->xm_visual); unsigned long gMask = GET_GREENMASK(xmesa->xm_visual); unsigned long bMask = GET_BLUEMASK(xmesa->xm_visual); GLubyte *pixelToR = xmesa->xm_visual->PixelToR; GLubyte *pixelToG = xmesa->xm_visual->PixelToG; GLubyte *pixelToB = xmesa->xm_visual->PixelToB; GLint rShift = xmesa->xm_visual->rshift; GLint gShift = xmesa->xm_visual->gshift; GLint bShift = xmesa->xm_visual->bshift; for (i=0;i> rShift]; rgba[i][GCOMP] = pixelToG[(p & gMask) >> gShift]; rgba[i][BCOMP] = pixelToB[(p & bMask) >> bShift]; rgba[i][ACOMP] = 255; } } break; case PF_8A8B8G8R: for (i=0;i> 8) & 0xff); rgba[i][BCOMP] = (GLubyte) ((p >> 16) & 0xff); rgba[i][ACOMP] = (GLubyte) ((p >> 24) & 0xff); } break; case PF_8A8R8G8B: for (i=0;i> 16) & 0xff); rgba[i][GCOMP] = (GLubyte) ((p >> 8) & 0xff); rgba[i][BCOMP] = (GLubyte) ( p & 0xff); rgba[i][ACOMP] = (GLubyte) ((p >> 24) & 0xff); } break; case PF_8R8G8B: for (i=0;i> 16) & 0xff); rgba[i][GCOMP] = (GLubyte) ((p >> 8) & 0xff); rgba[i][BCOMP] = (GLubyte) ( p & 0xff); rgba[i][ACOMP] = 255; } break; case PF_8R8G8B24: for (i=0;i> 16) & 0xff); rgba[i][GCOMP] = (GLubyte) ((p >> 8) & 0xff); rgba[i][BCOMP] = (GLubyte) ( p & 0xff); rgba[i][ACOMP] = 255; } break; case PF_HPCR: for (i=0;ipixel_to_r; GLubyte *gTable = source->pixel_to_g; GLubyte *bTable = source->pixel_to_b; for (i=0;ixm_visual->bitFlip; for (i=0;iximage) { /* Read from XImage back buffer */ switch (xmesa->pixelformat) { case PF_Truecolor: case PF_Dither_True: case PF_5R6G5B: case PF_Dither_5R6G5B: { unsigned long rMask = GET_REDMASK(xmesa->xm_visual); unsigned long gMask = GET_GREENMASK(xmesa->xm_visual); unsigned long bMask = GET_BLUEMASK(xmesa->xm_visual); GLubyte *pixelToR = xmesa->xm_visual->PixelToR; GLubyte *pixelToG = xmesa->xm_visual->PixelToG; GLubyte *pixelToB = xmesa->xm_visual->PixelToB; GLint rShift = xmesa->xm_visual->rshift; GLint gShift = xmesa->xm_visual->gshift; GLint bShift = xmesa->xm_visual->bshift; XMesaImage *img = xrb->ximage; for (i=0;i> rShift]; rgba[i][GCOMP] = pixelToG[(p & gMask) >> gShift]; rgba[i][BCOMP] = pixelToB[(p & bMask) >> bShift]; rgba[i][ACOMP] = 255; } } break; case PF_8A8B8G8R: for (i=0;i> 8) & 0xff); rgba[i][BCOMP] = (GLubyte) ((p4 >> 16) & 0xff); rgba[i][ACOMP] = (GLubyte) ((p4 >> 24) & 0xff); } break; case PF_8A8R8G8B: for (i=0;i> 16) & 0xff); rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff); rgba[i][BCOMP] = (GLubyte) ( p4 & 0xff); rgba[i][ACOMP] = (GLubyte) ((p4 >> 24) & 0xff); } break; case PF_8R8G8B: for (i=0;i> 16) & 0xff); rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff); rgba[i][BCOMP] = (GLubyte) ( p4 & 0xff); rgba[i][ACOMP] = 255; } break; case PF_8R8G8B24: for (i=0;ir; rgba[i][GCOMP] = ptr3->g; rgba[i][BCOMP] = ptr3->b; rgba[i][ACOMP] = 255; } break; case PF_HPCR: for (i=0;ipixel_to_r; GLubyte *gTable = source->pixel_to_g; GLubyte *bTable = source->pixel_to_b; XMesaImage *img = xrb->ximage; for (i=0;iximage; int bitFlip = xmesa->xm_visual->bitFlip; for (i=0;ipixmap ? GL_TRUE : GL_FALSE; switch (pixelformat) { case PF_Index: ASSERT(xrb->Base.DataType == GL_UNSIGNED_INT); if (pixmap) { xrb->Base.PutRow = put_row_ci_pixmap; xrb->Base.PutRowRGB = NULL; xrb->Base.PutMonoRow = put_mono_row_ci_pixmap; xrb->Base.PutValues = put_values_ci_pixmap; xrb->Base.PutMonoValues = put_mono_values_ci_pixmap; } else { xrb->Base.PutRow = put_row_ci_ximage; xrb->Base.PutRowRGB = NULL; xrb->Base.PutMonoRow = put_mono_row_ci_ximage; xrb->Base.PutValues = put_values_ci_ximage; xrb->Base.PutMonoValues = put_mono_values_ci_ximage; } break; case PF_Truecolor: if (pixmap) { xrb->Base.PutRow = put_row_TRUECOLOR_pixmap; xrb->Base.PutRowRGB = put_row_rgb_TRUECOLOR_pixmap; xrb->Base.PutMonoRow = put_mono_row_pixmap; xrb->Base.PutValues = put_values_TRUECOLOR_pixmap; xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { xrb->Base.PutRow = put_row_TRUECOLOR_ximage; xrb->Base.PutRowRGB = put_row_rgb_TRUECOLOR_ximage; xrb->Base.PutMonoRow = put_mono_row_ximage; xrb->Base.PutValues = put_values_TRUECOLOR_ximage; xrb->Base.PutMonoValues = put_mono_values_ximage; } break; case PF_Dither_True: if (pixmap) { xrb->Base.PutRow = put_row_TRUEDITHER_pixmap; xrb->Base.PutRowRGB = put_row_rgb_TRUEDITHER_pixmap; xrb->Base.PutMonoRow = put_mono_row_TRUEDITHER_pixmap; xrb->Base.PutValues = put_values_TRUEDITHER_pixmap; xrb->Base.PutMonoValues = put_mono_values_TRUEDITHER_pixmap; } else { xrb->Base.PutRow = put_row_TRUEDITHER_ximage; xrb->Base.PutRowRGB = put_row_rgb_TRUEDITHER_ximage; xrb->Base.PutMonoRow = put_mono_row_TRUEDITHER_ximage; xrb->Base.PutValues = put_values_TRUEDITHER_ximage; xrb->Base.PutMonoValues = put_mono_values_TRUEDITHER_ximage; } break; case PF_8A8B8G8R: if (pixmap) { xrb->Base.PutRow = put_row_8A8B8G8R_pixmap; xrb->Base.PutRowRGB = put_row_rgb_8A8B8G8R_pixmap; xrb->Base.PutMonoRow = put_mono_row_pixmap; xrb->Base.PutValues = put_values_8A8B8G8R_pixmap; xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { xrb->Base.PutRow = put_row_8A8B8G8R_ximage; xrb->Base.PutRowRGB = put_row_rgb_8A8B8G8R_ximage; xrb->Base.PutMonoRow = put_mono_row_8A8B8G8R_ximage; xrb->Base.PutValues = put_values_8A8B8G8R_ximage; xrb->Base.PutMonoValues = put_mono_values_8A8B8G8R_ximage; } break; case PF_8A8R8G8B: if (pixmap) { xrb->Base.PutRow = put_row_8A8R8G8B_pixmap; xrb->Base.PutRowRGB = put_row_rgb_8A8R8G8B_pixmap; xrb->Base.PutMonoRow = put_mono_row_pixmap; xrb->Base.PutValues = put_values_8A8R8G8B_pixmap; xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { xrb->Base.PutRow = put_row_8A8R8G8B_ximage; xrb->Base.PutRowRGB = put_row_rgb_8A8R8G8B_ximage; xrb->Base.PutMonoRow = put_mono_row_8A8R8G8B_ximage; xrb->Base.PutValues = put_values_8A8R8G8B_ximage; xrb->Base.PutMonoValues = put_mono_values_8A8R8G8B_ximage; } break; case PF_8R8G8B: if (pixmap) { xrb->Base.PutRow = put_row_8R8G8B_pixmap; xrb->Base.PutRowRGB = put_row_rgb_8R8G8B_pixmap; xrb->Base.PutMonoRow = put_mono_row_pixmap; xrb->Base.PutValues = put_values_8R8G8B_pixmap; xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { xrb->Base.PutRow = put_row_8R8G8B_ximage; xrb->Base.PutRowRGB = put_row_rgb_8R8G8B_ximage; xrb->Base.PutMonoRow = put_mono_row_8R8G8B_ximage; xrb->Base.PutValues = put_values_8R8G8B_ximage; xrb->Base.PutMonoValues = put_mono_values_8R8G8B_ximage; } break; case PF_8R8G8B24: if (pixmap) { xrb->Base.PutRow = put_row_8R8G8B24_pixmap; xrb->Base.PutRowRGB = put_row_rgb_8R8G8B24_pixmap; xrb->Base.PutMonoRow = put_mono_row_pixmap; xrb->Base.PutValues = put_values_8R8G8B24_pixmap; xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { xrb->Base.PutRow = put_row_8R8G8B24_ximage; xrb->Base.PutRowRGB = put_row_rgb_8R8G8B24_ximage; xrb->Base.PutMonoRow = put_mono_row_8R8G8B24_ximage; xrb->Base.PutValues = put_values_8R8G8B24_ximage; xrb->Base.PutMonoValues = put_mono_values_8R8G8B24_ximage; } break; case PF_5R6G5B: if (pixmap) { xrb->Base.PutRow = put_row_5R6G5B_pixmap; xrb->Base.PutRowRGB = put_row_rgb_5R6G5B_pixmap; xrb->Base.PutMonoRow = put_mono_row_pixmap; xrb->Base.PutValues = put_values_5R6G5B_pixmap; xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { xrb->Base.PutRow = put_row_5R6G5B_ximage; xrb->Base.PutRowRGB = put_row_rgb_5R6G5B_ximage; xrb->Base.PutMonoRow = put_mono_row_ximage; xrb->Base.PutValues = put_values_5R6G5B_ximage; xrb->Base.PutMonoValues = put_mono_values_ximage; } break; case PF_Dither_5R6G5B: if (pixmap) { xrb->Base.PutRow = put_row_DITHER_5R6G5B_pixmap; xrb->Base.PutRowRGB = put_row_rgb_DITHER_5R6G5B_pixmap; xrb->Base.PutMonoRow = put_mono_row_TRUEDITHER_pixmap; xrb->Base.PutValues = put_values_DITHER_5R6G5B_pixmap; xrb->Base.PutMonoValues = put_mono_values_TRUEDITHER_pixmap; } else { xrb->Base.PutRow = put_row_DITHER_5R6G5B_ximage; xrb->Base.PutRowRGB = put_row_rgb_DITHER_5R6G5B_ximage; xrb->Base.PutMonoRow = put_mono_row_DITHER_5R6G5B_ximage; xrb->Base.PutValues = put_values_DITHER_5R6G5B_ximage; xrb->Base.PutMonoValues = put_mono_values_DITHER_5R6G5B_ximage; } break; case PF_Dither: if (pixmap) { xrb->Base.PutRow = put_row_DITHER_pixmap; xrb->Base.PutRowRGB = put_row_rgb_DITHER_pixmap; xrb->Base.PutMonoRow = put_mono_row_DITHER_pixmap; xrb->Base.PutValues = put_values_DITHER_pixmap; xrb->Base.PutMonoValues = put_mono_values_DITHER_pixmap; } else { if (depth == 8) { xrb->Base.PutRow = put_row_DITHER8_ximage; xrb->Base.PutRowRGB = put_row_rgb_DITHER8_ximage; xrb->Base.PutMonoRow = put_mono_row_DITHER8_ximage; xrb->Base.PutValues = put_values_DITHER8_ximage; xrb->Base.PutMonoValues = put_mono_values_DITHER8_ximage; } else { xrb->Base.PutRow = put_row_DITHER_ximage; xrb->Base.PutRowRGB = put_row_rgb_DITHER_ximage; xrb->Base.PutMonoRow = put_mono_row_DITHER_ximage; xrb->Base.PutValues = put_values_DITHER_ximage; xrb->Base.PutMonoValues = put_mono_values_DITHER_ximage; } } break; case PF_1Bit: if (pixmap) { xrb->Base.PutRow = put_row_1BIT_pixmap; xrb->Base.PutRowRGB = put_row_rgb_1BIT_pixmap; xrb->Base.PutMonoRow = put_mono_row_1BIT_pixmap; xrb->Base.PutValues = put_values_1BIT_pixmap; xrb->Base.PutMonoValues = put_mono_values_1BIT_pixmap; } else { xrb->Base.PutRow = put_row_1BIT_ximage; xrb->Base.PutRowRGB = put_row_rgb_1BIT_ximage; xrb->Base.PutMonoRow = put_mono_row_1BIT_ximage; xrb->Base.PutValues = put_values_1BIT_ximage; xrb->Base.PutMonoValues = put_mono_values_1BIT_ximage; } break; case PF_HPCR: if (pixmap) { xrb->Base.PutRow = put_row_HPCR_pixmap; xrb->Base.PutRowRGB = put_row_rgb_HPCR_pixmap; xrb->Base.PutMonoRow = put_mono_row_pixmap; xrb->Base.PutValues = put_values_HPCR_pixmap; xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { xrb->Base.PutRow = put_row_HPCR_ximage; xrb->Base.PutRowRGB = put_row_rgb_HPCR_ximage; xrb->Base.PutMonoRow = put_mono_row_HPCR_ximage; xrb->Base.PutValues = put_values_HPCR_ximage; xrb->Base.PutMonoValues = put_mono_values_HPCR_ximage; } break; case PF_Lookup: if (pixmap) { xrb->Base.PutRow = put_row_LOOKUP_pixmap; xrb->Base.PutRowRGB = put_row_rgb_LOOKUP_pixmap; xrb->Base.PutMonoRow = put_mono_row_pixmap; xrb->Base.PutValues = put_values_LOOKUP_pixmap; xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { if (depth==8) { xrb->Base.PutRow = put_row_LOOKUP8_ximage; xrb->Base.PutRowRGB = put_row_rgb_LOOKUP8_ximage; xrb->Base.PutMonoRow = put_mono_row_LOOKUP8_ximage; xrb->Base.PutValues = put_values_LOOKUP8_ximage; xrb->Base.PutMonoValues = put_mono_values_LOOKUP8_ximage; } else { xrb->Base.PutRow = put_row_LOOKUP_ximage; xrb->Base.PutRowRGB = put_row_rgb_LOOKUP_ximage; xrb->Base.PutMonoRow = put_mono_row_ximage; xrb->Base.PutValues = put_values_LOOKUP_ximage; xrb->Base.PutMonoValues = put_mono_values_ximage; } } break; case PF_Grayscale: if (pixmap) { xrb->Base.PutRow = put_row_GRAYSCALE_pixmap; xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE_pixmap; xrb->Base.PutMonoRow = put_mono_row_pixmap; xrb->Base.PutValues = put_values_GRAYSCALE_pixmap; xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { if (depth == 8) { xrb->Base.PutRow = put_row_GRAYSCALE8_ximage; xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE8_ximage; xrb->Base.PutMonoRow = put_mono_row_GRAYSCALE8_ximage; xrb->Base.PutValues = put_values_GRAYSCALE8_ximage; xrb->Base.PutMonoValues = put_mono_values_GRAYSCALE8_ximage; } else { xrb->Base.PutRow = put_row_GRAYSCALE_ximage; xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE_ximage; xrb->Base.PutMonoRow = put_mono_row_ximage; xrb->Base.PutValues = put_values_GRAYSCALE_ximage; xrb->Base.PutMonoValues = put_mono_values_ximage; } } break; default: _mesa_problem(NULL, "Bad pixel format in xmesa_update_state (1)"); return; } /* Get functions */ if (pixelformat == PF_Index) { xrb->Base.GetRow = get_row_ci; xrb->Base.GetValues = get_values_ci; } else { xrb->Base.GetRow = get_row_rgba; xrb->Base.GetValues = get_values_rgba; } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/drivers/x11/xm_tri.c0000644000000000000000000014156013614532424020761 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * This file contains "accelerated" triangle functions. It should be * fairly easy to write new special-purpose triangle functions and hook * them into this module. */ #include "glxheader.h" #include "depth.h" #include "macros.h" #include "imports.h" #include "mtypes.h" #include "xmesaP.h" /* Internal swrast includes: */ #include "swrast/s_context.h" #include "swrast/s_depth.h" #include "swrast/s_triangle.h" #define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \ (struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped /**********************************************************************/ /*** Triangle rendering ***/ /**********************************************************************/ /* * XImage, smooth, depth-buffered, PF_TRUECOLOR triangle. */ #define NAME smooth_TRUECOLOR_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLint x = span.x, y = YFLIP(xrb, span.y); \ GLuint i; \ for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ unsigned long p; \ PACK_TRUECOLOR(p, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ XMesaPutPixel(xrb->ximage, x, y, p); \ zRow[i] = z; \ } \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, depth-buffered, PF_8A8B8G8R triangle. */ #define NAME smooth_8A8B8G8R_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = PACK_8B8G8R(FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ zRow[i] = z; \ } \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, depth-buffered, PF_8A8R8G8B triangle. */ #define NAME smooth_8A8R8G8B_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = PACK_8R8G8B(FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ zRow[i] = z; \ } \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, depth-buffered, PF_8R8G8B triangle. */ #define NAME smooth_8R8G8B_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = PACK_8R8G8B(FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ zRow[i] = z; \ } \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, depth-buffered, PF_8R8G8B24 triangle. */ #define NAME smooth_8R8G8B24_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X, Y) #define PIXEL_TYPE bgr_t #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ PIXEL_TYPE *ptr = pRow + i; \ ptr->r = FixedToInt(span.red); \ ptr->g = FixedToInt(span.green); \ ptr->b = FixedToInt(span.blue); \ zRow[i] = z; \ } \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, depth-buffered, PF_TRUEDITHER triangle. */ #define NAME smooth_TRUEDITHER_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ unsigned long p; \ PACK_TRUEDITHER(p, x, y, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ XMesaPutPixel(xrb->ximage, x, y, p); \ zRow[i] = z; \ } \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, depth-buffered, PF_5R6G5B triangle. */ #define NAME smooth_5R6G5B_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = PACK_5R6G5B(FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ zRow[i] = z; \ } \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, depth-buffered, PF_DITHER_5R6G5B triangle. */ #define NAME smooth_DITHER_5R6G5B_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ zRow[i] = z; \ } \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, depth-buffered, 8-bit, PF_DITHER8 triangle. */ #define NAME smooth_DITHER8_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ XDITHER_SETUP(y); \ for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span.red),\ FixedToInt(span.green), FixedToInt(span.blue) ); \ zRow[i] = z; \ } \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, depth-buffered, PF_DITHER triangle. */ #define NAME smooth_DITHER_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define SETUP_CODE \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ XDITHER_SETUP(y); \ for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ unsigned long p = XDITHER(x, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ XMesaPutPixel(img, x, y, p); \ zRow[i] = z; \ } \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, depth-buffered, 8-bit PF_LOOKUP triangle. */ #define NAME smooth_LOOKUP8_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ LOOKUP_SETUP; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = LOOKUP(FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ zRow[i] = z; \ } \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, depth-buffered, 8-bit PF_HPCR triangle. */ #define NAME smooth_HPCR_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue) ); \ zRow[i] = z; \ } \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, depth-buffered, PF_TRUECOLOR triangle. */ #define NAME flat_TRUECOLOR_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; \ unsigned long pixel; \ PACK_TRUECOLOR(pixel, v2->color[0], v2->color[1], v2->color[2]); #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ XMesaPutPixel(img, x, y, pixel); \ zRow[i] = z; \ } \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, depth-buffered, PF_8A8B8G8R triangle. */ #define NAME flat_8A8B8G8R_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); \ GLuint p = PACK_8B8G8R( v2->color[0], v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) p; \ zRow[i] = z; \ } \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, depth-buffered, PF_8A8R8G8B triangle. */ #define NAME flat_8A8R8G8B_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); \ GLuint p = PACK_8R8G8B( v2->color[0], v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) p; \ zRow[i] = z; \ } \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, depth-buffered, PF_8R8G8B triangle. */ #define NAME flat_8R8G8B_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); \ GLuint p = PACK_8R8G8B( v2->color[0], v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) p; \ zRow[i] = z; \ } \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, depth-buffered, PF_8R8G8B24 triangle. */ #define NAME flat_8R8G8B24_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X, Y) #define PIXEL_TYPE bgr_t #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = v2->color; #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ PIXEL_TYPE *ptr = pRow + i; \ ptr->r = color[RCOMP]; \ ptr->g = color[GCOMP]; \ ptr->b = color[BCOMP]; \ zRow[i] = z; \ } \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, depth-buffered, PF_TRUEDITHER triangle. */ #define NAME flat_TRUEDITHER_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ unsigned long p; \ PACK_TRUEDITHER(p, x, y, v2->color[0], \ v2->color[1], v2->color[2]); \ XMesaPutPixel(img, x, y, p); \ zRow[i] = z; \ } \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, depth-buffered, PF_5R6G5B triangle. */ #define NAME flat_5R6G5B_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); \ GLushort p = PACK_5R6G5B( v2->color[0], v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) p; \ zRow[i] = z; \ } \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, depth-buffered, PF_DITHER_5R6G5B triangle. */ #define NAME flat_DITHER_5R6G5B_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ const GLubyte *color = v2->color; #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ PACK_TRUEDITHER(pRow[i], x, y, color[RCOMP], \ color[GCOMP], color[BCOMP]); \ zRow[i] = z; \ } \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, depth-buffered, 8-bit PF_DITHER triangle. */ #define NAME flat_DITHER8_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); \ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ FLAT_DITHER_ROW_SETUP(YFLIP(xrb, y)); \ for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x); \ zRow[i] = z; \ } \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, depth-buffered, PF_DITHER triangle. */ #define NAME flat_DITHER_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define SETUP_CODE \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; \ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ FLAT_DITHER_ROW_SETUP(y); \ for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ unsigned long p = FLAT_DITHER(x); \ XMesaPutPixel(img, x, y, p); \ zRow[i] = z; \ } \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, depth-buffered, 8-bit PF_HPCR triangle. */ #define NAME flat_HPCR_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ GLubyte r = v2->color[0]; \ GLubyte g = v2->color[1]; \ GLubyte b = v2->color[2]; #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b); \ zRow[i] = z; \ } \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, depth-buffered, 8-bit PF_LOOKUP triangle. */ #define NAME flat_LOOKUP8_z_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); \ LOOKUP_SETUP; \ GLubyte r = v2->color[0]; \ GLubyte g = v2->color[1]; \ GLubyte b = v2->color[2]; \ GLubyte p = LOOKUP(r,g,b); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = p; \ zRow[i] = z; \ } \ span.z += span.zStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, NON-depth-buffered, PF_TRUECOLOR triangle. */ #define NAME smooth_TRUECOLOR_triangle #define INTERP_RGB 1 #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ unsigned long p; \ PACK_TRUECOLOR(p, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ XMesaPutPixel(img, x, y, p); \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, NON-depth-buffered, PF_8A8B8G8R triangle. */ #define NAME smooth_8A8B8G8R_triangle #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = PACK_8B8G8R(FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue) ); \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, NON-depth-buffered, PF_8A8R8G8B triangle. */ #define NAME smooth_8A8R8G8B_triangle #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = PACK_8R8G8B(FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue) ); \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, NON-depth-buffered, PF_8R8G8B triangle. */ #define NAME smooth_8R8G8B_triangle #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = PACK_8R8G8B(FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue) ); \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, NON-depth-buffered, PF_8R8G8B triangle. */ #define NAME smooth_8R8G8B24_triangle #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X, Y) #define PIXEL_TYPE bgr_t #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ PIXEL_TYPE *pixel = pRow; \ for (i = 0; i < span.end; i++, pixel++) { \ pixel->r = FixedToInt(span.red); \ pixel->g = FixedToInt(span.green); \ pixel->b = FixedToInt(span.blue); \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, NON-depth-buffered, PF_TRUEDITHER triangle. */ #define NAME smooth_TRUEDITHER_triangle #define INTERP_RGB 1 #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ unsigned long p; \ PACK_TRUEDITHER(p, x, y, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ XMesaPutPixel(img, x, y, p ); \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, NON-depth-buffered, PF_5R6G5B triangle. */ #define NAME smooth_5R6G5B_triangle #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) PACK_5R6G5B(FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, NON-depth-buffered, PF_DITHER_5R6G5B triangle. */ #define NAME smooth_DITHER_5R6G5B_triangle #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, NON-depth-buffered, 8-bit PF_DITHER triangle. */ #define NAME smooth_DITHER8_triangle #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ XDITHER_SETUP(y); \ for (i = 0; i < span.end; i++, x++) { \ pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue) ); \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, NON-depth-buffered, PF_DITHER triangle. */ #define NAME smooth_DITHER_triangle #define INTERP_RGB 1 #define SETUP_CODE \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ XDITHER_SETUP(y); \ for (i = 0; i < span.end; i++, x++) { \ unsigned long p = XDITHER(x, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue) ); \ XMesaPutPixel(img, x, y, p); \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, NON-depth-buffered, 8-bit PF_LOOKUP triangle. */ #define NAME smooth_LOOKUP8_triangle #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ LOOKUP_SETUP; \ for (i = 0; i < span.end; i++) { \ pRow[i] = LOOKUP(FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } #include "swrast/s_tritemp.h" /* * XImage, smooth, NON-depth-buffered, 8-bit PF_HPCR triangle. */ #define NAME smooth_HPCR_triangle #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, NON-depth-buffered, PF_TRUECOLOR triangle. */ #define NAME flat_TRUECOLOR_triangle #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; \ unsigned long pixel; \ PACK_TRUECOLOR(pixel, v2->color[0], v2->color[1], v2->color[2]); #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ XMesaPutPixel(img, x, y, pixel); \ } #include "swrast/s_tritemp.h" /* * XImage, flat, NON-depth-buffered, PF_8A8B8G8R triangle. */ #define NAME flat_8A8B8G8R_triangle #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); \ unsigned long p = PACK_8B8G8R( v2->color[0], \ v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, NON-depth-buffered, PF_8A8R8G8B triangle. */ #define NAME flat_8A8R8G8B_triangle #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); \ unsigned long p = PACK_8R8G8B( v2->color[0], \ v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, NON-depth-buffered, PF_8R8G8B triangle. */ #define NAME flat_8R8G8B_triangle #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); \ unsigned long p = PACK_8R8G8B( v2->color[0], \ v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, NON-depth-buffered, PF_8R8G8B24 triangle. */ #define NAME flat_8R8G8B24_triangle #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X, Y) #define PIXEL_TYPE bgr_t #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = v2->color; #define RENDER_SPAN( span ) \ GLuint i; \ PIXEL_TYPE *pixel = pRow; \ for (i = 0; i < span.end; i++, pixel++) { \ pixel->r = color[RCOMP]; \ pixel->g = color[GCOMP]; \ pixel->b = color[BCOMP]; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, NON-depth-buffered, PF_TRUEDITHER triangle. */ #define NAME flat_TRUEDITHER_triangle #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ unsigned long p; \ PACK_TRUEDITHER(p, x, y, v2->color[0], \ v2->color[1], v2->color[2] ); \ XMesaPutPixel(img, x, y, p); \ } #include "swrast/s_tritemp.h" /* * XImage, flat, NON-depth-buffered, PF_5R6G5B triangle. */ #define NAME flat_5R6G5B_triangle #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); \ unsigned long p = PACK_5R6G5B( v2->color[0], \ v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ } #include "swrast/s_tritemp.h" /* * XImage, flat, NON-depth-buffered, PF_DITHER_5R6G5B triangle. */ #define NAME flat_DITHER_5R6G5B_triangle #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y) #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ const GLubyte *color = v2->color; #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ PACK_TRUEDITHER(pRow[i], x, y, color[RCOMP], \ color[GCOMP], color[BCOMP]); \ } #include "swrast/s_tritemp.h" /* * XImage, flat, NON-depth-buffered, 8-bit PF_DITHER triangle. */ #define NAME flat_DITHER8_triangle #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); \ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ FLAT_DITHER_ROW_SETUP(YFLIP(xrb, y)); \ for (i = 0; i < span.end; i++, x++) { \ pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x); \ } #include "swrast/s_tritemp.h" /* * XImage, flat, NON-depth-buffered, PF_DITHER triangle. */ #define NAME flat_DITHER_triangle #define SETUP_CODE \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; \ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ FLAT_DITHER_ROW_SETUP(y); \ for (i = 0; i < span.end; i++, x++) { \ unsigned long p = FLAT_DITHER(x); \ XMesaPutPixel(img, x, y, p ); \ } #include "swrast/s_tritemp.h" /* * XImage, flat, NON-depth-buffered, 8-bit PF_HPCR triangle. */ #define NAME flat_HPCR_triangle #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ GLubyte r = v2->color[0]; \ GLubyte g = v2->color[1]; \ GLubyte b = v2->color[2]; #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b); \ } #include "swrast/s_tritemp.h" /* * XImage, flat, NON-depth-buffered, 8-bit PF_LOOKUP triangle. */ #define NAME flat_LOOKUP8_triangle #define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); \ LOOKUP_SETUP; \ GLubyte r = v2->color[0]; \ GLubyte g = v2->color[1]; \ GLubyte b = v2->color[2]; \ GLubyte p = LOOKUP(r,g,b); #define RENDER_SPAN( span ) \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ } #include "swrast/s_tritemp.h" #ifdef DEBUG extern void _xmesa_print_triangle_func( swrast_tri_func triFunc ); void _xmesa_print_triangle_func( swrast_tri_func triFunc ) { _mesa_printf("XMesa tri func = "); if (triFunc ==smooth_TRUECOLOR_z_triangle) _mesa_printf("smooth_TRUECOLOR_z_triangle\n"); else if (triFunc ==smooth_8A8B8G8R_z_triangle) _mesa_printf("smooth_8A8B8G8R_z_triangle\n"); else if (triFunc ==smooth_8A8R8G8B_z_triangle) _mesa_printf("smooth_8A8R8G8B_z_triangle\n"); else if (triFunc ==smooth_8R8G8B_z_triangle) _mesa_printf("smooth_8R8G8B_z_triangle\n"); else if (triFunc ==smooth_8R8G8B24_z_triangle) _mesa_printf("smooth_8R8G8B24_z_triangle\n"); else if (triFunc ==smooth_TRUEDITHER_z_triangle) _mesa_printf("smooth_TRUEDITHER_z_triangle\n"); else if (triFunc ==smooth_5R6G5B_z_triangle) _mesa_printf("smooth_5R6G5B_z_triangle\n"); else if (triFunc ==smooth_DITHER_5R6G5B_z_triangle) _mesa_printf("smooth_DITHER_5R6G5B_z_triangle\n"); else if (triFunc ==smooth_HPCR_z_triangle) _mesa_printf("smooth_HPCR_z_triangle\n"); else if (triFunc ==smooth_DITHER8_z_triangle) _mesa_printf("smooth_DITHER8_z_triangle\n"); else if (triFunc ==smooth_LOOKUP8_z_triangle) _mesa_printf("smooth_LOOKUP8_z_triangle\n"); else if (triFunc ==flat_TRUECOLOR_z_triangle) _mesa_printf("flat_TRUECOLOR_z_triangle\n"); else if (triFunc ==flat_8A8B8G8R_z_triangle) _mesa_printf("flat_8A8B8G8R_z_triangle\n"); else if (triFunc ==flat_8A8R8G8B_z_triangle) _mesa_printf("flat_8A8R8G8B_z_triangle\n"); else if (triFunc ==flat_8R8G8B_z_triangle) _mesa_printf("flat_8R8G8B_z_triangle\n"); else if (triFunc ==flat_8R8G8B24_z_triangle) _mesa_printf("flat_8R8G8B24_z_triangle\n"); else if (triFunc ==flat_TRUEDITHER_z_triangle) _mesa_printf("flat_TRUEDITHER_z_triangle\n"); else if (triFunc ==flat_5R6G5B_z_triangle) _mesa_printf("flat_5R6G5B_z_triangle\n"); else if (triFunc ==flat_DITHER_5R6G5B_z_triangle) _mesa_printf("flat_DITHER_5R6G5B_z_triangle\n"); else if (triFunc ==flat_HPCR_z_triangle) _mesa_printf("flat_HPCR_z_triangle\n"); else if (triFunc ==flat_DITHER8_z_triangle) _mesa_printf("flat_DITHER8_z_triangle\n"); else if (triFunc ==flat_LOOKUP8_z_triangle) _mesa_printf("flat_LOOKUP8_z_triangle\n"); else if (triFunc ==smooth_TRUECOLOR_triangle) _mesa_printf("smooth_TRUECOLOR_triangle\n"); else if (triFunc ==smooth_8A8B8G8R_triangle) _mesa_printf("smooth_8A8B8G8R_triangle\n"); else if (triFunc ==smooth_8A8R8G8B_triangle) _mesa_printf("smooth_8A8R8G8B_triangle\n"); else if (triFunc ==smooth_8R8G8B_triangle) _mesa_printf("smooth_8R8G8B_triangle\n"); else if (triFunc ==smooth_8R8G8B24_triangle) _mesa_printf("smooth_8R8G8B24_triangle\n"); else if (triFunc ==smooth_TRUEDITHER_triangle) _mesa_printf("smooth_TRUEDITHER_triangle\n"); else if (triFunc ==smooth_5R6G5B_triangle) _mesa_printf("smooth_5R6G5B_triangle\n"); else if (triFunc ==smooth_DITHER_5R6G5B_triangle) _mesa_printf("smooth_DITHER_5R6G5B_triangle\n"); else if (triFunc ==smooth_HPCR_triangle) _mesa_printf("smooth_HPCR_triangle\n"); else if (triFunc ==smooth_DITHER8_triangle) _mesa_printf("smooth_DITHER8_triangle\n"); else if (triFunc ==smooth_LOOKUP8_triangle) _mesa_printf("smooth_LOOKUP8_triangle\n"); else if (triFunc ==flat_TRUECOLOR_triangle) _mesa_printf("flat_TRUECOLOR_triangle\n"); else if (triFunc ==flat_TRUEDITHER_triangle) _mesa_printf("flat_TRUEDITHER_triangle\n"); else if (triFunc ==flat_8A8B8G8R_triangle) _mesa_printf("flat_8A8B8G8R_triangle\n"); else if (triFunc ==flat_8A8R8G8B_triangle) _mesa_printf("flat_8A8R8G8B_triangle\n"); else if (triFunc ==flat_8R8G8B_triangle) _mesa_printf("flat_8R8G8B_triangle\n"); else if (triFunc ==flat_8R8G8B24_triangle) _mesa_printf("flat_8R8G8B24_triangle\n"); else if (triFunc ==flat_5R6G5B_triangle) _mesa_printf("flat_5R6G5B_triangle\n"); else if (triFunc ==flat_DITHER_5R6G5B_triangle) _mesa_printf("flat_DITHER_5R6G5B_triangle\n"); else if (triFunc ==flat_HPCR_triangle) _mesa_printf("flat_HPCR_triangle\n"); else if (triFunc ==flat_DITHER8_triangle) _mesa_printf("flat_DITHER8_triangle\n"); else if (triFunc ==flat_LOOKUP8_triangle) _mesa_printf("flat_LOOKUP8_triangle\n"); else _mesa_printf("???\n"); } #endif #ifdef DEBUG /* record the current triangle function name */ static const char *triFuncName = NULL; #define USE(triFunc) \ do { \ triFuncName = #triFunc; \ return triFunc; \ } while (0) #else #define USE(triFunc) return triFunc #endif static swrast_tri_func get_triangle_func( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); XMesaContext xmesa = XMESA_CONTEXT(ctx); int depth = GET_VISUAL_DEPTH(xmesa->xm_visual); GET_XRB(xrb); #ifdef DEBUG triFuncName = NULL; #endif if ((ctx->DrawBuffer->_ColorDrawBufferMask[0] & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) == 0) return (swrast_tri_func) NULL; if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL; if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL; if (ctx->Texture._EnabledUnits) return (swrast_tri_func) NULL; if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_tri_func) NULL; if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) return (swrast_tri_func) NULL; if (xrb->ximage) { if ( ctx->Light.ShadeModel==GL_SMOOTH && swrast->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_Truecolor: USE(smooth_TRUECOLOR_z_triangle); case PF_8A8B8G8R: USE(smooth_8A8B8G8R_z_triangle); case PF_8A8R8G8B: USE(smooth_8A8R8G8B_z_triangle); case PF_8R8G8B: USE(smooth_8R8G8B_z_triangle); case PF_8R8G8B24: USE(smooth_8R8G8B24_z_triangle); case PF_Dither_True: USE(smooth_TRUEDITHER_z_triangle); case PF_5R6G5B: USE(smooth_5R6G5B_z_triangle); case PF_Dither_5R6G5B: USE(smooth_DITHER_5R6G5B_z_triangle); case PF_HPCR: USE(smooth_HPCR_z_triangle); case PF_Dither: if (depth == 8) USE(smooth_DITHER8_z_triangle); else USE(smooth_DITHER_z_triangle); case PF_Lookup: if (depth == 8) USE(smooth_LOOKUP8_z_triangle); else return (swrast_tri_func) NULL; default: return (swrast_tri_func) NULL; } } if ( ctx->Light.ShadeModel==GL_FLAT && swrast->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_Truecolor: USE(flat_TRUECOLOR_z_triangle); case PF_8A8B8G8R: USE(flat_8A8B8G8R_z_triangle); case PF_8A8R8G8B: USE(flat_8A8R8G8B_z_triangle); case PF_8R8G8B: USE(flat_8R8G8B_z_triangle); case PF_8R8G8B24: USE(flat_8R8G8B24_z_triangle); case PF_Dither_True: USE(flat_TRUEDITHER_z_triangle); case PF_5R6G5B: USE(flat_5R6G5B_z_triangle); case PF_Dither_5R6G5B: USE(flat_DITHER_5R6G5B_z_triangle); case PF_HPCR: USE(flat_HPCR_z_triangle); case PF_Dither: if (depth == 8) USE(flat_DITHER8_z_triangle); else USE(flat_DITHER_z_triangle); case PF_Lookup: if (depth == 8) USE(flat_LOOKUP8_z_triangle); else return (swrast_tri_func) NULL; default: return (swrast_tri_func) NULL; } } if ( swrast->_RasterMask==0 /* no depth test */ && ctx->Light.ShadeModel==GL_SMOOTH && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_Truecolor: USE(smooth_TRUECOLOR_triangle); case PF_8A8B8G8R: USE(smooth_8A8B8G8R_triangle); case PF_8A8R8G8B: USE(smooth_8A8R8G8B_triangle); case PF_8R8G8B: USE(smooth_8R8G8B_triangle); case PF_8R8G8B24: USE(smooth_8R8G8B24_triangle); case PF_Dither_True: USE(smooth_TRUEDITHER_triangle); case PF_5R6G5B: USE(smooth_5R6G5B_triangle); case PF_Dither_5R6G5B: USE(smooth_DITHER_5R6G5B_triangle); case PF_HPCR: USE(smooth_HPCR_triangle); case PF_Dither: if (depth == 8) USE(smooth_DITHER8_triangle); else USE(smooth_DITHER_triangle); case PF_Lookup: if (depth == 8) USE(smooth_LOOKUP8_triangle); else return (swrast_tri_func) NULL; default: return (swrast_tri_func) NULL; } } if ( swrast->_RasterMask==0 /* no depth test */ && ctx->Light.ShadeModel==GL_FLAT && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_Truecolor: USE(flat_TRUECOLOR_triangle); case PF_Dither_True: USE(flat_TRUEDITHER_triangle); case PF_8A8B8G8R: USE(flat_8A8B8G8R_triangle); case PF_8A8R8G8B: USE(flat_8A8R8G8B_triangle); case PF_8R8G8B: USE(flat_8R8G8B_triangle); case PF_8R8G8B24: USE(flat_8R8G8B24_triangle); case PF_5R6G5B: USE(flat_5R6G5B_triangle); case PF_Dither_5R6G5B: USE(flat_DITHER_5R6G5B_triangle); case PF_HPCR: USE(flat_HPCR_triangle); case PF_Dither: if (depth == 8) USE(flat_DITHER8_triangle); else USE(flat_DITHER_triangle); case PF_Lookup: if (depth == 8) USE(flat_LOOKUP8_triangle); else return (swrast_tri_func) NULL; default: return (swrast_tri_func) NULL; } } return (swrast_tri_func) NULL; } else { /* draw to pixmap */ return (swrast_tri_func) NULL; } } /* Override for the swrast tri-selection function. Try to use one * of our internal tri functions, otherwise fall back to the * standard swrast functions. */ void xmesa_choose_triangle( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (!(swrast->Triangle = get_triangle_func( ctx ))) _swrast_choose_triangle( ctx ); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/glapi/dispatch.h0000644000000000000000000132316113614532424020270 0ustar /* DO NOT EDIT - This file generated automatically by gl_table.py (from Mesa) script */ /* * (C) Copyright IBM Corporation 2005 * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sub license, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #if !defined( _DISPATCH_H_ ) # define _DISPATCH_H_ /** * \file dispatch.h * Macros for handling GL dispatch tables. * * For each known GL function, there are 3 macros in this file. The first * macro is named CALL_FuncName and is used to call that GL function using * the specified dispatch table. The other 2 macros, called GET_FuncName * can SET_FuncName, are used to get and set the dispatch pointer for the * named function in the specified dispatch table. */ #define CALL_by_offset(disp, cast, offset, parameters) \ (*(cast (GET_by_offset(disp, offset)))) parameters #define GET_by_offset(disp, offset) \ (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL #define SET_by_offset(disp, offset, fn) \ do { \ if ( (offset) < 0 ) { \ /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\n", */ \ /* __func__, __LINE__, disp, offset, # fn); */ \ /* abort(); */ \ } \ else { \ ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \ } \ } while(0) #define CALL_NewList(disp, parameters) (*((disp)->NewList)) parameters #define GET_NewList(disp) ((disp)->NewList) #define SET_NewList(disp, fn) ((disp)->NewList = fn) #define CALL_EndList(disp, parameters) (*((disp)->EndList)) parameters #define GET_EndList(disp) ((disp)->EndList) #define SET_EndList(disp, fn) ((disp)->EndList = fn) #define CALL_CallList(disp, parameters) (*((disp)->CallList)) parameters #define GET_CallList(disp) ((disp)->CallList) #define SET_CallList(disp, fn) ((disp)->CallList = fn) #define CALL_CallLists(disp, parameters) (*((disp)->CallLists)) parameters #define GET_CallLists(disp) ((disp)->CallLists) #define SET_CallLists(disp, fn) ((disp)->CallLists = fn) #define CALL_DeleteLists(disp, parameters) (*((disp)->DeleteLists)) parameters #define GET_DeleteLists(disp) ((disp)->DeleteLists) #define SET_DeleteLists(disp, fn) ((disp)->DeleteLists = fn) #define CALL_GenLists(disp, parameters) (*((disp)->GenLists)) parameters #define GET_GenLists(disp) ((disp)->GenLists) #define SET_GenLists(disp, fn) ((disp)->GenLists = fn) #define CALL_ListBase(disp, parameters) (*((disp)->ListBase)) parameters #define GET_ListBase(disp) ((disp)->ListBase) #define SET_ListBase(disp, fn) ((disp)->ListBase = fn) #define CALL_Begin(disp, parameters) (*((disp)->Begin)) parameters #define GET_Begin(disp) ((disp)->Begin) #define SET_Begin(disp, fn) ((disp)->Begin = fn) #define CALL_Bitmap(disp, parameters) (*((disp)->Bitmap)) parameters #define GET_Bitmap(disp) ((disp)->Bitmap) #define SET_Bitmap(disp, fn) ((disp)->Bitmap = fn) #define CALL_Color3b(disp, parameters) (*((disp)->Color3b)) parameters #define GET_Color3b(disp) ((disp)->Color3b) #define SET_Color3b(disp, fn) ((disp)->Color3b = fn) #define CALL_Color3bv(disp, parameters) (*((disp)->Color3bv)) parameters #define GET_Color3bv(disp) ((disp)->Color3bv) #define SET_Color3bv(disp, fn) ((disp)->Color3bv = fn) #define CALL_Color3d(disp, parameters) (*((disp)->Color3d)) parameters #define GET_Color3d(disp) ((disp)->Color3d) #define SET_Color3d(disp, fn) ((disp)->Color3d = fn) #define CALL_Color3dv(disp, parameters) (*((disp)->Color3dv)) parameters #define GET_Color3dv(disp) ((disp)->Color3dv) #define SET_Color3dv(disp, fn) ((disp)->Color3dv = fn) #define CALL_Color3f(disp, parameters) (*((disp)->Color3f)) parameters #define GET_Color3f(disp) ((disp)->Color3f) #define SET_Color3f(disp, fn) ((disp)->Color3f = fn) #define CALL_Color3fv(disp, parameters) (*((disp)->Color3fv)) parameters #define GET_Color3fv(disp) ((disp)->Color3fv) #define SET_Color3fv(disp, fn) ((disp)->Color3fv = fn) #define CALL_Color3i(disp, parameters) (*((disp)->Color3i)) parameters #define GET_Color3i(disp) ((disp)->Color3i) #define SET_Color3i(disp, fn) ((disp)->Color3i = fn) #define CALL_Color3iv(disp, parameters) (*((disp)->Color3iv)) parameters #define GET_Color3iv(disp) ((disp)->Color3iv) #define SET_Color3iv(disp, fn) ((disp)->Color3iv = fn) #define CALL_Color3s(disp, parameters) (*((disp)->Color3s)) parameters #define GET_Color3s(disp) ((disp)->Color3s) #define SET_Color3s(disp, fn) ((disp)->Color3s = fn) #define CALL_Color3sv(disp, parameters) (*((disp)->Color3sv)) parameters #define GET_Color3sv(disp) ((disp)->Color3sv) #define SET_Color3sv(disp, fn) ((disp)->Color3sv = fn) #define CALL_Color3ub(disp, parameters) (*((disp)->Color3ub)) parameters #define GET_Color3ub(disp) ((disp)->Color3ub) #define SET_Color3ub(disp, fn) ((disp)->Color3ub = fn) #define CALL_Color3ubv(disp, parameters) (*((disp)->Color3ubv)) parameters #define GET_Color3ubv(disp) ((disp)->Color3ubv) #define SET_Color3ubv(disp, fn) ((disp)->Color3ubv = fn) #define CALL_Color3ui(disp, parameters) (*((disp)->Color3ui)) parameters #define GET_Color3ui(disp) ((disp)->Color3ui) #define SET_Color3ui(disp, fn) ((disp)->Color3ui = fn) #define CALL_Color3uiv(disp, parameters) (*((disp)->Color3uiv)) parameters #define GET_Color3uiv(disp) ((disp)->Color3uiv) #define SET_Color3uiv(disp, fn) ((disp)->Color3uiv = fn) #define CALL_Color3us(disp, parameters) (*((disp)->Color3us)) parameters #define GET_Color3us(disp) ((disp)->Color3us) #define SET_Color3us(disp, fn) ((disp)->Color3us = fn) #define CALL_Color3usv(disp, parameters) (*((disp)->Color3usv)) parameters #define GET_Color3usv(disp) ((disp)->Color3usv) #define SET_Color3usv(disp, fn) ((disp)->Color3usv = fn) #define CALL_Color4b(disp, parameters) (*((disp)->Color4b)) parameters #define GET_Color4b(disp) ((disp)->Color4b) #define SET_Color4b(disp, fn) ((disp)->Color4b = fn) #define CALL_Color4bv(disp, parameters) (*((disp)->Color4bv)) parameters #define GET_Color4bv(disp) ((disp)->Color4bv) #define SET_Color4bv(disp, fn) ((disp)->Color4bv = fn) #define CALL_Color4d(disp, parameters) (*((disp)->Color4d)) parameters #define GET_Color4d(disp) ((disp)->Color4d) #define SET_Color4d(disp, fn) ((disp)->Color4d = fn) #define CALL_Color4dv(disp, parameters) (*((disp)->Color4dv)) parameters #define GET_Color4dv(disp) ((disp)->Color4dv) #define SET_Color4dv(disp, fn) ((disp)->Color4dv = fn) #define CALL_Color4f(disp, parameters) (*((disp)->Color4f)) parameters #define GET_Color4f(disp) ((disp)->Color4f) #define SET_Color4f(disp, fn) ((disp)->Color4f = fn) #define CALL_Color4fv(disp, parameters) (*((disp)->Color4fv)) parameters #define GET_Color4fv(disp) ((disp)->Color4fv) #define SET_Color4fv(disp, fn) ((disp)->Color4fv = fn) #define CALL_Color4i(disp, parameters) (*((disp)->Color4i)) parameters #define GET_Color4i(disp) ((disp)->Color4i) #define SET_Color4i(disp, fn) ((disp)->Color4i = fn) #define CALL_Color4iv(disp, parameters) (*((disp)->Color4iv)) parameters #define GET_Color4iv(disp) ((disp)->Color4iv) #define SET_Color4iv(disp, fn) ((disp)->Color4iv = fn) #define CALL_Color4s(disp, parameters) (*((disp)->Color4s)) parameters #define GET_Color4s(disp) ((disp)->Color4s) #define SET_Color4s(disp, fn) ((disp)->Color4s = fn) #define CALL_Color4sv(disp, parameters) (*((disp)->Color4sv)) parameters #define GET_Color4sv(disp) ((disp)->Color4sv) #define SET_Color4sv(disp, fn) ((disp)->Color4sv = fn) #define CALL_Color4ub(disp, parameters) (*((disp)->Color4ub)) parameters #define GET_Color4ub(disp) ((disp)->Color4ub) #define SET_Color4ub(disp, fn) ((disp)->Color4ub = fn) #define CALL_Color4ubv(disp, parameters) (*((disp)->Color4ubv)) parameters #define GET_Color4ubv(disp) ((disp)->Color4ubv) #define SET_Color4ubv(disp, fn) ((disp)->Color4ubv = fn) #define CALL_Color4ui(disp, parameters) (*((disp)->Color4ui)) parameters #define GET_Color4ui(disp) ((disp)->Color4ui) #define SET_Color4ui(disp, fn) ((disp)->Color4ui = fn) #define CALL_Color4uiv(disp, parameters) (*((disp)->Color4uiv)) parameters #define GET_Color4uiv(disp) ((disp)->Color4uiv) #define SET_Color4uiv(disp, fn) ((disp)->Color4uiv = fn) #define CALL_Color4us(disp, parameters) (*((disp)->Color4us)) parameters #define GET_Color4us(disp) ((disp)->Color4us) #define SET_Color4us(disp, fn) ((disp)->Color4us = fn) #define CALL_Color4usv(disp, parameters) (*((disp)->Color4usv)) parameters #define GET_Color4usv(disp) ((disp)->Color4usv) #define SET_Color4usv(disp, fn) ((disp)->Color4usv = fn) #define CALL_EdgeFlag(disp, parameters) (*((disp)->EdgeFlag)) parameters #define GET_EdgeFlag(disp) ((disp)->EdgeFlag) #define SET_EdgeFlag(disp, fn) ((disp)->EdgeFlag = fn) #define CALL_EdgeFlagv(disp, parameters) (*((disp)->EdgeFlagv)) parameters #define GET_EdgeFlagv(disp) ((disp)->EdgeFlagv) #define SET_EdgeFlagv(disp, fn) ((disp)->EdgeFlagv = fn) #define CALL_End(disp, parameters) (*((disp)->End)) parameters #define GET_End(disp) ((disp)->End) #define SET_End(disp, fn) ((disp)->End = fn) #define CALL_Indexd(disp, parameters) (*((disp)->Indexd)) parameters #define GET_Indexd(disp) ((disp)->Indexd) #define SET_Indexd(disp, fn) ((disp)->Indexd = fn) #define CALL_Indexdv(disp, parameters) (*((disp)->Indexdv)) parameters #define GET_Indexdv(disp) ((disp)->Indexdv) #define SET_Indexdv(disp, fn) ((disp)->Indexdv = fn) #define CALL_Indexf(disp, parameters) (*((disp)->Indexf)) parameters #define GET_Indexf(disp) ((disp)->Indexf) #define SET_Indexf(disp, fn) ((disp)->Indexf = fn) #define CALL_Indexfv(disp, parameters) (*((disp)->Indexfv)) parameters #define GET_Indexfv(disp) ((disp)->Indexfv) #define SET_Indexfv(disp, fn) ((disp)->Indexfv = fn) #define CALL_Indexi(disp, parameters) (*((disp)->Indexi)) parameters #define GET_Indexi(disp) ((disp)->Indexi) #define SET_Indexi(disp, fn) ((disp)->Indexi = fn) #define CALL_Indexiv(disp, parameters) (*((disp)->Indexiv)) parameters #define GET_Indexiv(disp) ((disp)->Indexiv) #define SET_Indexiv(disp, fn) ((disp)->Indexiv = fn) #define CALL_Indexs(disp, parameters) (*((disp)->Indexs)) parameters #define GET_Indexs(disp) ((disp)->Indexs) #define SET_Indexs(disp, fn) ((disp)->Indexs = fn) #define CALL_Indexsv(disp, parameters) (*((disp)->Indexsv)) parameters #define GET_Indexsv(disp) ((disp)->Indexsv) #define SET_Indexsv(disp, fn) ((disp)->Indexsv = fn) #define CALL_Normal3b(disp, parameters) (*((disp)->Normal3b)) parameters #define GET_Normal3b(disp) ((disp)->Normal3b) #define SET_Normal3b(disp, fn) ((disp)->Normal3b = fn) #define CALL_Normal3bv(disp, parameters) (*((disp)->Normal3bv)) parameters #define GET_Normal3bv(disp) ((disp)->Normal3bv) #define SET_Normal3bv(disp, fn) ((disp)->Normal3bv = fn) #define CALL_Normal3d(disp, parameters) (*((disp)->Normal3d)) parameters #define GET_Normal3d(disp) ((disp)->Normal3d) #define SET_Normal3d(disp, fn) ((disp)->Normal3d = fn) #define CALL_Normal3dv(disp, parameters) (*((disp)->Normal3dv)) parameters #define GET_Normal3dv(disp) ((disp)->Normal3dv) #define SET_Normal3dv(disp, fn) ((disp)->Normal3dv = fn) #define CALL_Normal3f(disp, parameters) (*((disp)->Normal3f)) parameters #define GET_Normal3f(disp) ((disp)->Normal3f) #define SET_Normal3f(disp, fn) ((disp)->Normal3f = fn) #define CALL_Normal3fv(disp, parameters) (*((disp)->Normal3fv)) parameters #define GET_Normal3fv(disp) ((disp)->Normal3fv) #define SET_Normal3fv(disp, fn) ((disp)->Normal3fv = fn) #define CALL_Normal3i(disp, parameters) (*((disp)->Normal3i)) parameters #define GET_Normal3i(disp) ((disp)->Normal3i) #define SET_Normal3i(disp, fn) ((disp)->Normal3i = fn) #define CALL_Normal3iv(disp, parameters) (*((disp)->Normal3iv)) parameters #define GET_Normal3iv(disp) ((disp)->Normal3iv) #define SET_Normal3iv(disp, fn) ((disp)->Normal3iv = fn) #define CALL_Normal3s(disp, parameters) (*((disp)->Normal3s)) parameters #define GET_Normal3s(disp) ((disp)->Normal3s) #define SET_Normal3s(disp, fn) ((disp)->Normal3s = fn) #define CALL_Normal3sv(disp, parameters) (*((disp)->Normal3sv)) parameters #define GET_Normal3sv(disp) ((disp)->Normal3sv) #define SET_Normal3sv(disp, fn) ((disp)->Normal3sv = fn) #define CALL_RasterPos2d(disp, parameters) (*((disp)->RasterPos2d)) parameters #define GET_RasterPos2d(disp) ((disp)->RasterPos2d) #define SET_RasterPos2d(disp, fn) ((disp)->RasterPos2d = fn) #define CALL_RasterPos2dv(disp, parameters) (*((disp)->RasterPos2dv)) parameters #define GET_RasterPos2dv(disp) ((disp)->RasterPos2dv) #define SET_RasterPos2dv(disp, fn) ((disp)->RasterPos2dv = fn) #define CALL_RasterPos2f(disp, parameters) (*((disp)->RasterPos2f)) parameters #define GET_RasterPos2f(disp) ((disp)->RasterPos2f) #define SET_RasterPos2f(disp, fn) ((disp)->RasterPos2f = fn) #define CALL_RasterPos2fv(disp, parameters) (*((disp)->RasterPos2fv)) parameters #define GET_RasterPos2fv(disp) ((disp)->RasterPos2fv) #define SET_RasterPos2fv(disp, fn) ((disp)->RasterPos2fv = fn) #define CALL_RasterPos2i(disp, parameters) (*((disp)->RasterPos2i)) parameters #define GET_RasterPos2i(disp) ((disp)->RasterPos2i) #define SET_RasterPos2i(disp, fn) ((disp)->RasterPos2i = fn) #define CALL_RasterPos2iv(disp, parameters) (*((disp)->RasterPos2iv)) parameters #define GET_RasterPos2iv(disp) ((disp)->RasterPos2iv) #define SET_RasterPos2iv(disp, fn) ((disp)->RasterPos2iv = fn) #define CALL_RasterPos2s(disp, parameters) (*((disp)->RasterPos2s)) parameters #define GET_RasterPos2s(disp) ((disp)->RasterPos2s) #define SET_RasterPos2s(disp, fn) ((disp)->RasterPos2s = fn) #define CALL_RasterPos2sv(disp, parameters) (*((disp)->RasterPos2sv)) parameters #define GET_RasterPos2sv(disp) ((disp)->RasterPos2sv) #define SET_RasterPos2sv(disp, fn) ((disp)->RasterPos2sv = fn) #define CALL_RasterPos3d(disp, parameters) (*((disp)->RasterPos3d)) parameters #define GET_RasterPos3d(disp) ((disp)->RasterPos3d) #define SET_RasterPos3d(disp, fn) ((disp)->RasterPos3d = fn) #define CALL_RasterPos3dv(disp, parameters) (*((disp)->RasterPos3dv)) parameters #define GET_RasterPos3dv(disp) ((disp)->RasterPos3dv) #define SET_RasterPos3dv(disp, fn) ((disp)->RasterPos3dv = fn) #define CALL_RasterPos3f(disp, parameters) (*((disp)->RasterPos3f)) parameters #define GET_RasterPos3f(disp) ((disp)->RasterPos3f) #define SET_RasterPos3f(disp, fn) ((disp)->RasterPos3f = fn) #define CALL_RasterPos3fv(disp, parameters) (*((disp)->RasterPos3fv)) parameters #define GET_RasterPos3fv(disp) ((disp)->RasterPos3fv) #define SET_RasterPos3fv(disp, fn) ((disp)->RasterPos3fv = fn) #define CALL_RasterPos3i(disp, parameters) (*((disp)->RasterPos3i)) parameters #define GET_RasterPos3i(disp) ((disp)->RasterPos3i) #define SET_RasterPos3i(disp, fn) ((disp)->RasterPos3i = fn) #define CALL_RasterPos3iv(disp, parameters) (*((disp)->RasterPos3iv)) parameters #define GET_RasterPos3iv(disp) ((disp)->RasterPos3iv) #define SET_RasterPos3iv(disp, fn) ((disp)->RasterPos3iv = fn) #define CALL_RasterPos3s(disp, parameters) (*((disp)->RasterPos3s)) parameters #define GET_RasterPos3s(disp) ((disp)->RasterPos3s) #define SET_RasterPos3s(disp, fn) ((disp)->RasterPos3s = fn) #define CALL_RasterPos3sv(disp, parameters) (*((disp)->RasterPos3sv)) parameters #define GET_RasterPos3sv(disp) ((disp)->RasterPos3sv) #define SET_RasterPos3sv(disp, fn) ((disp)->RasterPos3sv = fn) #define CALL_RasterPos4d(disp, parameters) (*((disp)->RasterPos4d)) parameters #define GET_RasterPos4d(disp) ((disp)->RasterPos4d) #define SET_RasterPos4d(disp, fn) ((disp)->RasterPos4d = fn) #define CALL_RasterPos4dv(disp, parameters) (*((disp)->RasterPos4dv)) parameters #define GET_RasterPos4dv(disp) ((disp)->RasterPos4dv) #define SET_RasterPos4dv(disp, fn) ((disp)->RasterPos4dv = fn) #define CALL_RasterPos4f(disp, parameters) (*((disp)->RasterPos4f)) parameters #define GET_RasterPos4f(disp) ((disp)->RasterPos4f) #define SET_RasterPos4f(disp, fn) ((disp)->RasterPos4f = fn) #define CALL_RasterPos4fv(disp, parameters) (*((disp)->RasterPos4fv)) parameters #define GET_RasterPos4fv(disp) ((disp)->RasterPos4fv) #define SET_RasterPos4fv(disp, fn) ((disp)->RasterPos4fv = fn) #define CALL_RasterPos4i(disp, parameters) (*((disp)->RasterPos4i)) parameters #define GET_RasterPos4i(disp) ((disp)->RasterPos4i) #define SET_RasterPos4i(disp, fn) ((disp)->RasterPos4i = fn) #define CALL_RasterPos4iv(disp, parameters) (*((disp)->RasterPos4iv)) parameters #define GET_RasterPos4iv(disp) ((disp)->RasterPos4iv) #define SET_RasterPos4iv(disp, fn) ((disp)->RasterPos4iv = fn) #define CALL_RasterPos4s(disp, parameters) (*((disp)->RasterPos4s)) parameters #define GET_RasterPos4s(disp) ((disp)->RasterPos4s) #define SET_RasterPos4s(disp, fn) ((disp)->RasterPos4s = fn) #define CALL_RasterPos4sv(disp, parameters) (*((disp)->RasterPos4sv)) parameters #define GET_RasterPos4sv(disp) ((disp)->RasterPos4sv) #define SET_RasterPos4sv(disp, fn) ((disp)->RasterPos4sv = fn) #define CALL_Rectd(disp, parameters) (*((disp)->Rectd)) parameters #define GET_Rectd(disp) ((disp)->Rectd) #define SET_Rectd(disp, fn) ((disp)->Rectd = fn) #define CALL_Rectdv(disp, parameters) (*((disp)->Rectdv)) parameters #define GET_Rectdv(disp) ((disp)->Rectdv) #define SET_Rectdv(disp, fn) ((disp)->Rectdv = fn) #define CALL_Rectf(disp, parameters) (*((disp)->Rectf)) parameters #define GET_Rectf(disp) ((disp)->Rectf) #define SET_Rectf(disp, fn) ((disp)->Rectf = fn) #define CALL_Rectfv(disp, parameters) (*((disp)->Rectfv)) parameters #define GET_Rectfv(disp) ((disp)->Rectfv) #define SET_Rectfv(disp, fn) ((disp)->Rectfv = fn) #define CALL_Recti(disp, parameters) (*((disp)->Recti)) parameters #define GET_Recti(disp) ((disp)->Recti) #define SET_Recti(disp, fn) ((disp)->Recti = fn) #define CALL_Rectiv(disp, parameters) (*((disp)->Rectiv)) parameters #define GET_Rectiv(disp) ((disp)->Rectiv) #define SET_Rectiv(disp, fn) ((disp)->Rectiv = fn) #define CALL_Rects(disp, parameters) (*((disp)->Rects)) parameters #define GET_Rects(disp) ((disp)->Rects) #define SET_Rects(disp, fn) ((disp)->Rects = fn) #define CALL_Rectsv(disp, parameters) (*((disp)->Rectsv)) parameters #define GET_Rectsv(disp) ((disp)->Rectsv) #define SET_Rectsv(disp, fn) ((disp)->Rectsv = fn) #define CALL_TexCoord1d(disp, parameters) (*((disp)->TexCoord1d)) parameters #define GET_TexCoord1d(disp) ((disp)->TexCoord1d) #define SET_TexCoord1d(disp, fn) ((disp)->TexCoord1d = fn) #define CALL_TexCoord1dv(disp, parameters) (*((disp)->TexCoord1dv)) parameters #define GET_TexCoord1dv(disp) ((disp)->TexCoord1dv) #define SET_TexCoord1dv(disp, fn) ((disp)->TexCoord1dv = fn) #define CALL_TexCoord1f(disp, parameters) (*((disp)->TexCoord1f)) parameters #define GET_TexCoord1f(disp) ((disp)->TexCoord1f) #define SET_TexCoord1f(disp, fn) ((disp)->TexCoord1f = fn) #define CALL_TexCoord1fv(disp, parameters) (*((disp)->TexCoord1fv)) parameters #define GET_TexCoord1fv(disp) ((disp)->TexCoord1fv) #define SET_TexCoord1fv(disp, fn) ((disp)->TexCoord1fv = fn) #define CALL_TexCoord1i(disp, parameters) (*((disp)->TexCoord1i)) parameters #define GET_TexCoord1i(disp) ((disp)->TexCoord1i) #define SET_TexCoord1i(disp, fn) ((disp)->TexCoord1i = fn) #define CALL_TexCoord1iv(disp, parameters) (*((disp)->TexCoord1iv)) parameters #define GET_TexCoord1iv(disp) ((disp)->TexCoord1iv) #define SET_TexCoord1iv(disp, fn) ((disp)->TexCoord1iv = fn) #define CALL_TexCoord1s(disp, parameters) (*((disp)->TexCoord1s)) parameters #define GET_TexCoord1s(disp) ((disp)->TexCoord1s) #define SET_TexCoord1s(disp, fn) ((disp)->TexCoord1s = fn) #define CALL_TexCoord1sv(disp, parameters) (*((disp)->TexCoord1sv)) parameters #define GET_TexCoord1sv(disp) ((disp)->TexCoord1sv) #define SET_TexCoord1sv(disp, fn) ((disp)->TexCoord1sv = fn) #define CALL_TexCoord2d(disp, parameters) (*((disp)->TexCoord2d)) parameters #define GET_TexCoord2d(disp) ((disp)->TexCoord2d) #define SET_TexCoord2d(disp, fn) ((disp)->TexCoord2d = fn) #define CALL_TexCoord2dv(disp, parameters) (*((disp)->TexCoord2dv)) parameters #define GET_TexCoord2dv(disp) ((disp)->TexCoord2dv) #define SET_TexCoord2dv(disp, fn) ((disp)->TexCoord2dv = fn) #define CALL_TexCoord2f(disp, parameters) (*((disp)->TexCoord2f)) parameters #define GET_TexCoord2f(disp) ((disp)->TexCoord2f) #define SET_TexCoord2f(disp, fn) ((disp)->TexCoord2f = fn) #define CALL_TexCoord2fv(disp, parameters) (*((disp)->TexCoord2fv)) parameters #define GET_TexCoord2fv(disp) ((disp)->TexCoord2fv) #define SET_TexCoord2fv(disp, fn) ((disp)->TexCoord2fv = fn) #define CALL_TexCoord2i(disp, parameters) (*((disp)->TexCoord2i)) parameters #define GET_TexCoord2i(disp) ((disp)->TexCoord2i) #define SET_TexCoord2i(disp, fn) ((disp)->TexCoord2i = fn) #define CALL_TexCoord2iv(disp, parameters) (*((disp)->TexCoord2iv)) parameters #define GET_TexCoord2iv(disp) ((disp)->TexCoord2iv) #define SET_TexCoord2iv(disp, fn) ((disp)->TexCoord2iv = fn) #define CALL_TexCoord2s(disp, parameters) (*((disp)->TexCoord2s)) parameters #define GET_TexCoord2s(disp) ((disp)->TexCoord2s) #define SET_TexCoord2s(disp, fn) ((disp)->TexCoord2s = fn) #define CALL_TexCoord2sv(disp, parameters) (*((disp)->TexCoord2sv)) parameters #define GET_TexCoord2sv(disp) ((disp)->TexCoord2sv) #define SET_TexCoord2sv(disp, fn) ((disp)->TexCoord2sv = fn) #define CALL_TexCoord3d(disp, parameters) (*((disp)->TexCoord3d)) parameters #define GET_TexCoord3d(disp) ((disp)->TexCoord3d) #define SET_TexCoord3d(disp, fn) ((disp)->TexCoord3d = fn) #define CALL_TexCoord3dv(disp, parameters) (*((disp)->TexCoord3dv)) parameters #define GET_TexCoord3dv(disp) ((disp)->TexCoord3dv) #define SET_TexCoord3dv(disp, fn) ((disp)->TexCoord3dv = fn) #define CALL_TexCoord3f(disp, parameters) (*((disp)->TexCoord3f)) parameters #define GET_TexCoord3f(disp) ((disp)->TexCoord3f) #define SET_TexCoord3f(disp, fn) ((disp)->TexCoord3f = fn) #define CALL_TexCoord3fv(disp, parameters) (*((disp)->TexCoord3fv)) parameters #define GET_TexCoord3fv(disp) ((disp)->TexCoord3fv) #define SET_TexCoord3fv(disp, fn) ((disp)->TexCoord3fv = fn) #define CALL_TexCoord3i(disp, parameters) (*((disp)->TexCoord3i)) parameters #define GET_TexCoord3i(disp) ((disp)->TexCoord3i) #define SET_TexCoord3i(disp, fn) ((disp)->TexCoord3i = fn) #define CALL_TexCoord3iv(disp, parameters) (*((disp)->TexCoord3iv)) parameters #define GET_TexCoord3iv(disp) ((disp)->TexCoord3iv) #define SET_TexCoord3iv(disp, fn) ((disp)->TexCoord3iv = fn) #define CALL_TexCoord3s(disp, parameters) (*((disp)->TexCoord3s)) parameters #define GET_TexCoord3s(disp) ((disp)->TexCoord3s) #define SET_TexCoord3s(disp, fn) ((disp)->TexCoord3s = fn) #define CALL_TexCoord3sv(disp, parameters) (*((disp)->TexCoord3sv)) parameters #define GET_TexCoord3sv(disp) ((disp)->TexCoord3sv) #define SET_TexCoord3sv(disp, fn) ((disp)->TexCoord3sv = fn) #define CALL_TexCoord4d(disp, parameters) (*((disp)->TexCoord4d)) parameters #define GET_TexCoord4d(disp) ((disp)->TexCoord4d) #define SET_TexCoord4d(disp, fn) ((disp)->TexCoord4d = fn) #define CALL_TexCoord4dv(disp, parameters) (*((disp)->TexCoord4dv)) parameters #define GET_TexCoord4dv(disp) ((disp)->TexCoord4dv) #define SET_TexCoord4dv(disp, fn) ((disp)->TexCoord4dv = fn) #define CALL_TexCoord4f(disp, parameters) (*((disp)->TexCoord4f)) parameters #define GET_TexCoord4f(disp) ((disp)->TexCoord4f) #define SET_TexCoord4f(disp, fn) ((disp)->TexCoord4f = fn) #define CALL_TexCoord4fv(disp, parameters) (*((disp)->TexCoord4fv)) parameters #define GET_TexCoord4fv(disp) ((disp)->TexCoord4fv) #define SET_TexCoord4fv(disp, fn) ((disp)->TexCoord4fv = fn) #define CALL_TexCoord4i(disp, parameters) (*((disp)->TexCoord4i)) parameters #define GET_TexCoord4i(disp) ((disp)->TexCoord4i) #define SET_TexCoord4i(disp, fn) ((disp)->TexCoord4i = fn) #define CALL_TexCoord4iv(disp, parameters) (*((disp)->TexCoord4iv)) parameters #define GET_TexCoord4iv(disp) ((disp)->TexCoord4iv) #define SET_TexCoord4iv(disp, fn) ((disp)->TexCoord4iv = fn) #define CALL_TexCoord4s(disp, parameters) (*((disp)->TexCoord4s)) parameters #define GET_TexCoord4s(disp) ((disp)->TexCoord4s) #define SET_TexCoord4s(disp, fn) ((disp)->TexCoord4s = fn) #define CALL_TexCoord4sv(disp, parameters) (*((disp)->TexCoord4sv)) parameters #define GET_TexCoord4sv(disp) ((disp)->TexCoord4sv) #define SET_TexCoord4sv(disp, fn) ((disp)->TexCoord4sv = fn) #define CALL_Vertex2d(disp, parameters) (*((disp)->Vertex2d)) parameters #define GET_Vertex2d(disp) ((disp)->Vertex2d) #define SET_Vertex2d(disp, fn) ((disp)->Vertex2d = fn) #define CALL_Vertex2dv(disp, parameters) (*((disp)->Vertex2dv)) parameters #define GET_Vertex2dv(disp) ((disp)->Vertex2dv) #define SET_Vertex2dv(disp, fn) ((disp)->Vertex2dv = fn) #define CALL_Vertex2f(disp, parameters) (*((disp)->Vertex2f)) parameters #define GET_Vertex2f(disp) ((disp)->Vertex2f) #define SET_Vertex2f(disp, fn) ((disp)->Vertex2f = fn) #define CALL_Vertex2fv(disp, parameters) (*((disp)->Vertex2fv)) parameters #define GET_Vertex2fv(disp) ((disp)->Vertex2fv) #define SET_Vertex2fv(disp, fn) ((disp)->Vertex2fv = fn) #define CALL_Vertex2i(disp, parameters) (*((disp)->Vertex2i)) parameters #define GET_Vertex2i(disp) ((disp)->Vertex2i) #define SET_Vertex2i(disp, fn) ((disp)->Vertex2i = fn) #define CALL_Vertex2iv(disp, parameters) (*((disp)->Vertex2iv)) parameters #define GET_Vertex2iv(disp) ((disp)->Vertex2iv) #define SET_Vertex2iv(disp, fn) ((disp)->Vertex2iv = fn) #define CALL_Vertex2s(disp, parameters) (*((disp)->Vertex2s)) parameters #define GET_Vertex2s(disp) ((disp)->Vertex2s) #define SET_Vertex2s(disp, fn) ((disp)->Vertex2s = fn) #define CALL_Vertex2sv(disp, parameters) (*((disp)->Vertex2sv)) parameters #define GET_Vertex2sv(disp) ((disp)->Vertex2sv) #define SET_Vertex2sv(disp, fn) ((disp)->Vertex2sv = fn) #define CALL_Vertex3d(disp, parameters) (*((disp)->Vertex3d)) parameters #define GET_Vertex3d(disp) ((disp)->Vertex3d) #define SET_Vertex3d(disp, fn) ((disp)->Vertex3d = fn) #define CALL_Vertex3dv(disp, parameters) (*((disp)->Vertex3dv)) parameters #define GET_Vertex3dv(disp) ((disp)->Vertex3dv) #define SET_Vertex3dv(disp, fn) ((disp)->Vertex3dv = fn) #define CALL_Vertex3f(disp, parameters) (*((disp)->Vertex3f)) parameters #define GET_Vertex3f(disp) ((disp)->Vertex3f) #define SET_Vertex3f(disp, fn) ((disp)->Vertex3f = fn) #define CALL_Vertex3fv(disp, parameters) (*((disp)->Vertex3fv)) parameters #define GET_Vertex3fv(disp) ((disp)->Vertex3fv) #define SET_Vertex3fv(disp, fn) ((disp)->Vertex3fv = fn) #define CALL_Vertex3i(disp, parameters) (*((disp)->Vertex3i)) parameters #define GET_Vertex3i(disp) ((disp)->Vertex3i) #define SET_Vertex3i(disp, fn) ((disp)->Vertex3i = fn) #define CALL_Vertex3iv(disp, parameters) (*((disp)->Vertex3iv)) parameters #define GET_Vertex3iv(disp) ((disp)->Vertex3iv) #define SET_Vertex3iv(disp, fn) ((disp)->Vertex3iv = fn) #define CALL_Vertex3s(disp, parameters) (*((disp)->Vertex3s)) parameters #define GET_Vertex3s(disp) ((disp)->Vertex3s) #define SET_Vertex3s(disp, fn) ((disp)->Vertex3s = fn) #define CALL_Vertex3sv(disp, parameters) (*((disp)->Vertex3sv)) parameters #define GET_Vertex3sv(disp) ((disp)->Vertex3sv) #define SET_Vertex3sv(disp, fn) ((disp)->Vertex3sv = fn) #define CALL_Vertex4d(disp, parameters) (*((disp)->Vertex4d)) parameters #define GET_Vertex4d(disp) ((disp)->Vertex4d) #define SET_Vertex4d(disp, fn) ((disp)->Vertex4d = fn) #define CALL_Vertex4dv(disp, parameters) (*((disp)->Vertex4dv)) parameters #define GET_Vertex4dv(disp) ((disp)->Vertex4dv) #define SET_Vertex4dv(disp, fn) ((disp)->Vertex4dv = fn) #define CALL_Vertex4f(disp, parameters) (*((disp)->Vertex4f)) parameters #define GET_Vertex4f(disp) ((disp)->Vertex4f) #define SET_Vertex4f(disp, fn) ((disp)->Vertex4f = fn) #define CALL_Vertex4fv(disp, parameters) (*((disp)->Vertex4fv)) parameters #define GET_Vertex4fv(disp) ((disp)->Vertex4fv) #define SET_Vertex4fv(disp, fn) ((disp)->Vertex4fv = fn) #define CALL_Vertex4i(disp, parameters) (*((disp)->Vertex4i)) parameters #define GET_Vertex4i(disp) ((disp)->Vertex4i) #define SET_Vertex4i(disp, fn) ((disp)->Vertex4i = fn) #define CALL_Vertex4iv(disp, parameters) (*((disp)->Vertex4iv)) parameters #define GET_Vertex4iv(disp) ((disp)->Vertex4iv) #define SET_Vertex4iv(disp, fn) ((disp)->Vertex4iv = fn) #define CALL_Vertex4s(disp, parameters) (*((disp)->Vertex4s)) parameters #define GET_Vertex4s(disp) ((disp)->Vertex4s) #define SET_Vertex4s(disp, fn) ((disp)->Vertex4s = fn) #define CALL_Vertex4sv(disp, parameters) (*((disp)->Vertex4sv)) parameters #define GET_Vertex4sv(disp) ((disp)->Vertex4sv) #define SET_Vertex4sv(disp, fn) ((disp)->Vertex4sv = fn) #define CALL_ClipPlane(disp, parameters) (*((disp)->ClipPlane)) parameters #define GET_ClipPlane(disp) ((disp)->ClipPlane) #define SET_ClipPlane(disp, fn) ((disp)->ClipPlane = fn) #define CALL_ColorMaterial(disp, parameters) (*((disp)->ColorMaterial)) parameters #define GET_ColorMaterial(disp) ((disp)->ColorMaterial) #define SET_ColorMaterial(disp, fn) ((disp)->ColorMaterial = fn) #define CALL_CullFace(disp, parameters) (*((disp)->CullFace)) parameters #define GET_CullFace(disp) ((disp)->CullFace) #define SET_CullFace(disp, fn) ((disp)->CullFace = fn) #define CALL_Fogf(disp, parameters) (*((disp)->Fogf)) parameters #define GET_Fogf(disp) ((disp)->Fogf) #define SET_Fogf(disp, fn) ((disp)->Fogf = fn) #define CALL_Fogfv(disp, parameters) (*((disp)->Fogfv)) parameters #define GET_Fogfv(disp) ((disp)->Fogfv) #define SET_Fogfv(disp, fn) ((disp)->Fogfv = fn) #define CALL_Fogi(disp, parameters) (*((disp)->Fogi)) parameters #define GET_Fogi(disp) ((disp)->Fogi) #define SET_Fogi(disp, fn) ((disp)->Fogi = fn) #define CALL_Fogiv(disp, parameters) (*((disp)->Fogiv)) parameters #define GET_Fogiv(disp) ((disp)->Fogiv) #define SET_Fogiv(disp, fn) ((disp)->Fogiv = fn) #define CALL_FrontFace(disp, parameters) (*((disp)->FrontFace)) parameters #define GET_FrontFace(disp) ((disp)->FrontFace) #define SET_FrontFace(disp, fn) ((disp)->FrontFace = fn) #define CALL_Hint(disp, parameters) (*((disp)->Hint)) parameters #define GET_Hint(disp) ((disp)->Hint) #define SET_Hint(disp, fn) ((disp)->Hint = fn) #define CALL_Lightf(disp, parameters) (*((disp)->Lightf)) parameters #define GET_Lightf(disp) ((disp)->Lightf) #define SET_Lightf(disp, fn) ((disp)->Lightf = fn) #define CALL_Lightfv(disp, parameters) (*((disp)->Lightfv)) parameters #define GET_Lightfv(disp) ((disp)->Lightfv) #define SET_Lightfv(disp, fn) ((disp)->Lightfv = fn) #define CALL_Lighti(disp, parameters) (*((disp)->Lighti)) parameters #define GET_Lighti(disp) ((disp)->Lighti) #define SET_Lighti(disp, fn) ((disp)->Lighti = fn) #define CALL_Lightiv(disp, parameters) (*((disp)->Lightiv)) parameters #define GET_Lightiv(disp) ((disp)->Lightiv) #define SET_Lightiv(disp, fn) ((disp)->Lightiv = fn) #define CALL_LightModelf(disp, parameters) (*((disp)->LightModelf)) parameters #define GET_LightModelf(disp) ((disp)->LightModelf) #define SET_LightModelf(disp, fn) ((disp)->LightModelf = fn) #define CALL_LightModelfv(disp, parameters) (*((disp)->LightModelfv)) parameters #define GET_LightModelfv(disp) ((disp)->LightModelfv) #define SET_LightModelfv(disp, fn) ((disp)->LightModelfv = fn) #define CALL_LightModeli(disp, parameters) (*((disp)->LightModeli)) parameters #define GET_LightModeli(disp) ((disp)->LightModeli) #define SET_LightModeli(disp, fn) ((disp)->LightModeli = fn) #define CALL_LightModeliv(disp, parameters) (*((disp)->LightModeliv)) parameters #define GET_LightModeliv(disp) ((disp)->LightModeliv) #define SET_LightModeliv(disp, fn) ((disp)->LightModeliv = fn) #define CALL_LineStipple(disp, parameters) (*((disp)->LineStipple)) parameters #define GET_LineStipple(disp) ((disp)->LineStipple) #define SET_LineStipple(disp, fn) ((disp)->LineStipple = fn) #define CALL_LineWidth(disp, parameters) (*((disp)->LineWidth)) parameters #define GET_LineWidth(disp) ((disp)->LineWidth) #define SET_LineWidth(disp, fn) ((disp)->LineWidth = fn) #define CALL_Materialf(disp, parameters) (*((disp)->Materialf)) parameters #define GET_Materialf(disp) ((disp)->Materialf) #define SET_Materialf(disp, fn) ((disp)->Materialf = fn) #define CALL_Materialfv(disp, parameters) (*((disp)->Materialfv)) parameters #define GET_Materialfv(disp) ((disp)->Materialfv) #define SET_Materialfv(disp, fn) ((disp)->Materialfv = fn) #define CALL_Materiali(disp, parameters) (*((disp)->Materiali)) parameters #define GET_Materiali(disp) ((disp)->Materiali) #define SET_Materiali(disp, fn) ((disp)->Materiali = fn) #define CALL_Materialiv(disp, parameters) (*((disp)->Materialiv)) parameters #define GET_Materialiv(disp) ((disp)->Materialiv) #define SET_Materialiv(disp, fn) ((disp)->Materialiv = fn) #define CALL_PointSize(disp, parameters) (*((disp)->PointSize)) parameters #define GET_PointSize(disp) ((disp)->PointSize) #define SET_PointSize(disp, fn) ((disp)->PointSize = fn) #define CALL_PolygonMode(disp, parameters) (*((disp)->PolygonMode)) parameters #define GET_PolygonMode(disp) ((disp)->PolygonMode) #define SET_PolygonMode(disp, fn) ((disp)->PolygonMode = fn) #define CALL_PolygonStipple(disp, parameters) (*((disp)->PolygonStipple)) parameters #define GET_PolygonStipple(disp) ((disp)->PolygonStipple) #define SET_PolygonStipple(disp, fn) ((disp)->PolygonStipple = fn) #define CALL_Scissor(disp, parameters) (*((disp)->Scissor)) parameters #define GET_Scissor(disp) ((disp)->Scissor) #define SET_Scissor(disp, fn) ((disp)->Scissor = fn) #define CALL_ShadeModel(disp, parameters) (*((disp)->ShadeModel)) parameters #define GET_ShadeModel(disp) ((disp)->ShadeModel) #define SET_ShadeModel(disp, fn) ((disp)->ShadeModel = fn) #define CALL_TexParameterf(disp, parameters) (*((disp)->TexParameterf)) parameters #define GET_TexParameterf(disp) ((disp)->TexParameterf) #define SET_TexParameterf(disp, fn) ((disp)->TexParameterf = fn) #define CALL_TexParameterfv(disp, parameters) (*((disp)->TexParameterfv)) parameters #define GET_TexParameterfv(disp) ((disp)->TexParameterfv) #define SET_TexParameterfv(disp, fn) ((disp)->TexParameterfv = fn) #define CALL_TexParameteri(disp, parameters) (*((disp)->TexParameteri)) parameters #define GET_TexParameteri(disp) ((disp)->TexParameteri) #define SET_TexParameteri(disp, fn) ((disp)->TexParameteri = fn) #define CALL_TexParameteriv(disp, parameters) (*((disp)->TexParameteriv)) parameters #define GET_TexParameteriv(disp) ((disp)->TexParameteriv) #define SET_TexParameteriv(disp, fn) ((disp)->TexParameteriv = fn) #define CALL_TexImage1D(disp, parameters) (*((disp)->TexImage1D)) parameters #define GET_TexImage1D(disp) ((disp)->TexImage1D) #define SET_TexImage1D(disp, fn) ((disp)->TexImage1D = fn) #define CALL_TexImage2D(disp, parameters) (*((disp)->TexImage2D)) parameters #define GET_TexImage2D(disp) ((disp)->TexImage2D) #define SET_TexImage2D(disp, fn) ((disp)->TexImage2D = fn) #define CALL_TexEnvf(disp, parameters) (*((disp)->TexEnvf)) parameters #define GET_TexEnvf(disp) ((disp)->TexEnvf) #define SET_TexEnvf(disp, fn) ((disp)->TexEnvf = fn) #define CALL_TexEnvfv(disp, parameters) (*((disp)->TexEnvfv)) parameters #define GET_TexEnvfv(disp) ((disp)->TexEnvfv) #define SET_TexEnvfv(disp, fn) ((disp)->TexEnvfv = fn) #define CALL_TexEnvi(disp, parameters) (*((disp)->TexEnvi)) parameters #define GET_TexEnvi(disp) ((disp)->TexEnvi) #define SET_TexEnvi(disp, fn) ((disp)->TexEnvi = fn) #define CALL_TexEnviv(disp, parameters) (*((disp)->TexEnviv)) parameters #define GET_TexEnviv(disp) ((disp)->TexEnviv) #define SET_TexEnviv(disp, fn) ((disp)->TexEnviv = fn) #define CALL_TexGend(disp, parameters) (*((disp)->TexGend)) parameters #define GET_TexGend(disp) ((disp)->TexGend) #define SET_TexGend(disp, fn) ((disp)->TexGend = fn) #define CALL_TexGendv(disp, parameters) (*((disp)->TexGendv)) parameters #define GET_TexGendv(disp) ((disp)->TexGendv) #define SET_TexGendv(disp, fn) ((disp)->TexGendv = fn) #define CALL_TexGenf(disp, parameters) (*((disp)->TexGenf)) parameters #define GET_TexGenf(disp) ((disp)->TexGenf) #define SET_TexGenf(disp, fn) ((disp)->TexGenf = fn) #define CALL_TexGenfv(disp, parameters) (*((disp)->TexGenfv)) parameters #define GET_TexGenfv(disp) ((disp)->TexGenfv) #define SET_TexGenfv(disp, fn) ((disp)->TexGenfv = fn) #define CALL_TexGeni(disp, parameters) (*((disp)->TexGeni)) parameters #define GET_TexGeni(disp) ((disp)->TexGeni) #define SET_TexGeni(disp, fn) ((disp)->TexGeni = fn) #define CALL_TexGeniv(disp, parameters) (*((disp)->TexGeniv)) parameters #define GET_TexGeniv(disp) ((disp)->TexGeniv) #define SET_TexGeniv(disp, fn) ((disp)->TexGeniv = fn) #define CALL_FeedbackBuffer(disp, parameters) (*((disp)->FeedbackBuffer)) parameters #define GET_FeedbackBuffer(disp) ((disp)->FeedbackBuffer) #define SET_FeedbackBuffer(disp, fn) ((disp)->FeedbackBuffer = fn) #define CALL_SelectBuffer(disp, parameters) (*((disp)->SelectBuffer)) parameters #define GET_SelectBuffer(disp) ((disp)->SelectBuffer) #define SET_SelectBuffer(disp, fn) ((disp)->SelectBuffer = fn) #define CALL_RenderMode(disp, parameters) (*((disp)->RenderMode)) parameters #define GET_RenderMode(disp) ((disp)->RenderMode) #define SET_RenderMode(disp, fn) ((disp)->RenderMode = fn) #define CALL_InitNames(disp, parameters) (*((disp)->InitNames)) parameters #define GET_InitNames(disp) ((disp)->InitNames) #define SET_InitNames(disp, fn) ((disp)->InitNames = fn) #define CALL_LoadName(disp, parameters) (*((disp)->LoadName)) parameters #define GET_LoadName(disp) ((disp)->LoadName) #define SET_LoadName(disp, fn) ((disp)->LoadName = fn) #define CALL_PassThrough(disp, parameters) (*((disp)->PassThrough)) parameters #define GET_PassThrough(disp) ((disp)->PassThrough) #define SET_PassThrough(disp, fn) ((disp)->PassThrough = fn) #define CALL_PopName(disp, parameters) (*((disp)->PopName)) parameters #define GET_PopName(disp) ((disp)->PopName) #define SET_PopName(disp, fn) ((disp)->PopName = fn) #define CALL_PushName(disp, parameters) (*((disp)->PushName)) parameters #define GET_PushName(disp) ((disp)->PushName) #define SET_PushName(disp, fn) ((disp)->PushName = fn) #define CALL_DrawBuffer(disp, parameters) (*((disp)->DrawBuffer)) parameters #define GET_DrawBuffer(disp) ((disp)->DrawBuffer) #define SET_DrawBuffer(disp, fn) ((disp)->DrawBuffer = fn) #define CALL_Clear(disp, parameters) (*((disp)->Clear)) parameters #define GET_Clear(disp) ((disp)->Clear) #define SET_Clear(disp, fn) ((disp)->Clear = fn) #define CALL_ClearAccum(disp, parameters) (*((disp)->ClearAccum)) parameters #define GET_ClearAccum(disp) ((disp)->ClearAccum) #define SET_ClearAccum(disp, fn) ((disp)->ClearAccum = fn) #define CALL_ClearIndex(disp, parameters) (*((disp)->ClearIndex)) parameters #define GET_ClearIndex(disp) ((disp)->ClearIndex) #define SET_ClearIndex(disp, fn) ((disp)->ClearIndex = fn) #define CALL_ClearColor(disp, parameters) (*((disp)->ClearColor)) parameters #define GET_ClearColor(disp) ((disp)->ClearColor) #define SET_ClearColor(disp, fn) ((disp)->ClearColor = fn) #define CALL_ClearStencil(disp, parameters) (*((disp)->ClearStencil)) parameters #define GET_ClearStencil(disp) ((disp)->ClearStencil) #define SET_ClearStencil(disp, fn) ((disp)->ClearStencil = fn) #define CALL_ClearDepth(disp, parameters) (*((disp)->ClearDepth)) parameters #define GET_ClearDepth(disp) ((disp)->ClearDepth) #define SET_ClearDepth(disp, fn) ((disp)->ClearDepth = fn) #define CALL_StencilMask(disp, parameters) (*((disp)->StencilMask)) parameters #define GET_StencilMask(disp) ((disp)->StencilMask) #define SET_StencilMask(disp, fn) ((disp)->StencilMask = fn) #define CALL_ColorMask(disp, parameters) (*((disp)->ColorMask)) parameters #define GET_ColorMask(disp) ((disp)->ColorMask) #define SET_ColorMask(disp, fn) ((disp)->ColorMask = fn) #define CALL_DepthMask(disp, parameters) (*((disp)->DepthMask)) parameters #define GET_DepthMask(disp) ((disp)->DepthMask) #define SET_DepthMask(disp, fn) ((disp)->DepthMask = fn) #define CALL_IndexMask(disp, parameters) (*((disp)->IndexMask)) parameters #define GET_IndexMask(disp) ((disp)->IndexMask) #define SET_IndexMask(disp, fn) ((disp)->IndexMask = fn) #define CALL_Accum(disp, parameters) (*((disp)->Accum)) parameters #define GET_Accum(disp) ((disp)->Accum) #define SET_Accum(disp, fn) ((disp)->Accum = fn) #define CALL_Disable(disp, parameters) (*((disp)->Disable)) parameters #define GET_Disable(disp) ((disp)->Disable) #define SET_Disable(disp, fn) ((disp)->Disable = fn) #define CALL_Enable(disp, parameters) (*((disp)->Enable)) parameters #define GET_Enable(disp) ((disp)->Enable) #define SET_Enable(disp, fn) ((disp)->Enable = fn) #define CALL_Finish(disp, parameters) (*((disp)->Finish)) parameters #define GET_Finish(disp) ((disp)->Finish) #define SET_Finish(disp, fn) ((disp)->Finish = fn) #define CALL_Flush(disp, parameters) (*((disp)->Flush)) parameters #define GET_Flush(disp) ((disp)->Flush) #define SET_Flush(disp, fn) ((disp)->Flush = fn) #define CALL_PopAttrib(disp, parameters) (*((disp)->PopAttrib)) parameters #define GET_PopAttrib(disp) ((disp)->PopAttrib) #define SET_PopAttrib(disp, fn) ((disp)->PopAttrib = fn) #define CALL_PushAttrib(disp, parameters) (*((disp)->PushAttrib)) parameters #define GET_PushAttrib(disp) ((disp)->PushAttrib) #define SET_PushAttrib(disp, fn) ((disp)->PushAttrib = fn) #define CALL_Map1d(disp, parameters) (*((disp)->Map1d)) parameters #define GET_Map1d(disp) ((disp)->Map1d) #define SET_Map1d(disp, fn) ((disp)->Map1d = fn) #define CALL_Map1f(disp, parameters) (*((disp)->Map1f)) parameters #define GET_Map1f(disp) ((disp)->Map1f) #define SET_Map1f(disp, fn) ((disp)->Map1f = fn) #define CALL_Map2d(disp, parameters) (*((disp)->Map2d)) parameters #define GET_Map2d(disp) ((disp)->Map2d) #define SET_Map2d(disp, fn) ((disp)->Map2d = fn) #define CALL_Map2f(disp, parameters) (*((disp)->Map2f)) parameters #define GET_Map2f(disp) ((disp)->Map2f) #define SET_Map2f(disp, fn) ((disp)->Map2f = fn) #define CALL_MapGrid1d(disp, parameters) (*((disp)->MapGrid1d)) parameters #define GET_MapGrid1d(disp) ((disp)->MapGrid1d) #define SET_MapGrid1d(disp, fn) ((disp)->MapGrid1d = fn) #define CALL_MapGrid1f(disp, parameters) (*((disp)->MapGrid1f)) parameters #define GET_MapGrid1f(disp) ((disp)->MapGrid1f) #define SET_MapGrid1f(disp, fn) ((disp)->MapGrid1f = fn) #define CALL_MapGrid2d(disp, parameters) (*((disp)->MapGrid2d)) parameters #define GET_MapGrid2d(disp) ((disp)->MapGrid2d) #define SET_MapGrid2d(disp, fn) ((disp)->MapGrid2d = fn) #define CALL_MapGrid2f(disp, parameters) (*((disp)->MapGrid2f)) parameters #define GET_MapGrid2f(disp) ((disp)->MapGrid2f) #define SET_MapGrid2f(disp, fn) ((disp)->MapGrid2f = fn) #define CALL_EvalCoord1d(disp, parameters) (*((disp)->EvalCoord1d)) parameters #define GET_EvalCoord1d(disp) ((disp)->EvalCoord1d) #define SET_EvalCoord1d(disp, fn) ((disp)->EvalCoord1d = fn) #define CALL_EvalCoord1dv(disp, parameters) (*((disp)->EvalCoord1dv)) parameters #define GET_EvalCoord1dv(disp) ((disp)->EvalCoord1dv) #define SET_EvalCoord1dv(disp, fn) ((disp)->EvalCoord1dv = fn) #define CALL_EvalCoord1f(disp, parameters) (*((disp)->EvalCoord1f)) parameters #define GET_EvalCoord1f(disp) ((disp)->EvalCoord1f) #define SET_EvalCoord1f(disp, fn) ((disp)->EvalCoord1f = fn) #define CALL_EvalCoord1fv(disp, parameters) (*((disp)->EvalCoord1fv)) parameters #define GET_EvalCoord1fv(disp) ((disp)->EvalCoord1fv) #define SET_EvalCoord1fv(disp, fn) ((disp)->EvalCoord1fv = fn) #define CALL_EvalCoord2d(disp, parameters) (*((disp)->EvalCoord2d)) parameters #define GET_EvalCoord2d(disp) ((disp)->EvalCoord2d) #define SET_EvalCoord2d(disp, fn) ((disp)->EvalCoord2d = fn) #define CALL_EvalCoord2dv(disp, parameters) (*((disp)->EvalCoord2dv)) parameters #define GET_EvalCoord2dv(disp) ((disp)->EvalCoord2dv) #define SET_EvalCoord2dv(disp, fn) ((disp)->EvalCoord2dv = fn) #define CALL_EvalCoord2f(disp, parameters) (*((disp)->EvalCoord2f)) parameters #define GET_EvalCoord2f(disp) ((disp)->EvalCoord2f) #define SET_EvalCoord2f(disp, fn) ((disp)->EvalCoord2f = fn) #define CALL_EvalCoord2fv(disp, parameters) (*((disp)->EvalCoord2fv)) parameters #define GET_EvalCoord2fv(disp) ((disp)->EvalCoord2fv) #define SET_EvalCoord2fv(disp, fn) ((disp)->EvalCoord2fv = fn) #define CALL_EvalMesh1(disp, parameters) (*((disp)->EvalMesh1)) parameters #define GET_EvalMesh1(disp) ((disp)->EvalMesh1) #define SET_EvalMesh1(disp, fn) ((disp)->EvalMesh1 = fn) #define CALL_EvalPoint1(disp, parameters) (*((disp)->EvalPoint1)) parameters #define GET_EvalPoint1(disp) ((disp)->EvalPoint1) #define SET_EvalPoint1(disp, fn) ((disp)->EvalPoint1 = fn) #define CALL_EvalMesh2(disp, parameters) (*((disp)->EvalMesh2)) parameters #define GET_EvalMesh2(disp) ((disp)->EvalMesh2) #define SET_EvalMesh2(disp, fn) ((disp)->EvalMesh2 = fn) #define CALL_EvalPoint2(disp, parameters) (*((disp)->EvalPoint2)) parameters #define GET_EvalPoint2(disp) ((disp)->EvalPoint2) #define SET_EvalPoint2(disp, fn) ((disp)->EvalPoint2 = fn) #define CALL_AlphaFunc(disp, parameters) (*((disp)->AlphaFunc)) parameters #define GET_AlphaFunc(disp) ((disp)->AlphaFunc) #define SET_AlphaFunc(disp, fn) ((disp)->AlphaFunc = fn) #define CALL_BlendFunc(disp, parameters) (*((disp)->BlendFunc)) parameters #define GET_BlendFunc(disp) ((disp)->BlendFunc) #define SET_BlendFunc(disp, fn) ((disp)->BlendFunc = fn) #define CALL_LogicOp(disp, parameters) (*((disp)->LogicOp)) parameters #define GET_LogicOp(disp) ((disp)->LogicOp) #define SET_LogicOp(disp, fn) ((disp)->LogicOp = fn) #define CALL_StencilFunc(disp, parameters) (*((disp)->StencilFunc)) parameters #define GET_StencilFunc(disp) ((disp)->StencilFunc) #define SET_StencilFunc(disp, fn) ((disp)->StencilFunc = fn) #define CALL_StencilOp(disp, parameters) (*((disp)->StencilOp)) parameters #define GET_StencilOp(disp) ((disp)->StencilOp) #define SET_StencilOp(disp, fn) ((disp)->StencilOp = fn) #define CALL_DepthFunc(disp, parameters) (*((disp)->DepthFunc)) parameters #define GET_DepthFunc(disp) ((disp)->DepthFunc) #define SET_DepthFunc(disp, fn) ((disp)->DepthFunc = fn) #define CALL_PixelZoom(disp, parameters) (*((disp)->PixelZoom)) parameters #define GET_PixelZoom(disp) ((disp)->PixelZoom) #define SET_PixelZoom(disp, fn) ((disp)->PixelZoom = fn) #define CALL_PixelTransferf(disp, parameters) (*((disp)->PixelTransferf)) parameters #define GET_PixelTransferf(disp) ((disp)->PixelTransferf) #define SET_PixelTransferf(disp, fn) ((disp)->PixelTransferf = fn) #define CALL_PixelTransferi(disp, parameters) (*((disp)->PixelTransferi)) parameters #define GET_PixelTransferi(disp) ((disp)->PixelTransferi) #define SET_PixelTransferi(disp, fn) ((disp)->PixelTransferi = fn) #define CALL_PixelStoref(disp, parameters) (*((disp)->PixelStoref)) parameters #define GET_PixelStoref(disp) ((disp)->PixelStoref) #define SET_PixelStoref(disp, fn) ((disp)->PixelStoref = fn) #define CALL_PixelStorei(disp, parameters) (*((disp)->PixelStorei)) parameters #define GET_PixelStorei(disp) ((disp)->PixelStorei) #define SET_PixelStorei(disp, fn) ((disp)->PixelStorei = fn) #define CALL_PixelMapfv(disp, parameters) (*((disp)->PixelMapfv)) parameters #define GET_PixelMapfv(disp) ((disp)->PixelMapfv) #define SET_PixelMapfv(disp, fn) ((disp)->PixelMapfv = fn) #define CALL_PixelMapuiv(disp, parameters) (*((disp)->PixelMapuiv)) parameters #define GET_PixelMapuiv(disp) ((disp)->PixelMapuiv) #define SET_PixelMapuiv(disp, fn) ((disp)->PixelMapuiv = fn) #define CALL_PixelMapusv(disp, parameters) (*((disp)->PixelMapusv)) parameters #define GET_PixelMapusv(disp) ((disp)->PixelMapusv) #define SET_PixelMapusv(disp, fn) ((disp)->PixelMapusv = fn) #define CALL_ReadBuffer(disp, parameters) (*((disp)->ReadBuffer)) parameters #define GET_ReadBuffer(disp) ((disp)->ReadBuffer) #define SET_ReadBuffer(disp, fn) ((disp)->ReadBuffer = fn) #define CALL_CopyPixels(disp, parameters) (*((disp)->CopyPixels)) parameters #define GET_CopyPixels(disp) ((disp)->CopyPixels) #define SET_CopyPixels(disp, fn) ((disp)->CopyPixels = fn) #define CALL_ReadPixels(disp, parameters) (*((disp)->ReadPixels)) parameters #define GET_ReadPixels(disp) ((disp)->ReadPixels) #define SET_ReadPixels(disp, fn) ((disp)->ReadPixels = fn) #define CALL_DrawPixels(disp, parameters) (*((disp)->DrawPixels)) parameters #define GET_DrawPixels(disp) ((disp)->DrawPixels) #define SET_DrawPixels(disp, fn) ((disp)->DrawPixels = fn) #define CALL_GetBooleanv(disp, parameters) (*((disp)->GetBooleanv)) parameters #define GET_GetBooleanv(disp) ((disp)->GetBooleanv) #define SET_GetBooleanv(disp, fn) ((disp)->GetBooleanv = fn) #define CALL_GetClipPlane(disp, parameters) (*((disp)->GetClipPlane)) parameters #define GET_GetClipPlane(disp) ((disp)->GetClipPlane) #define SET_GetClipPlane(disp, fn) ((disp)->GetClipPlane = fn) #define CALL_GetDoublev(disp, parameters) (*((disp)->GetDoublev)) parameters #define GET_GetDoublev(disp) ((disp)->GetDoublev) #define SET_GetDoublev(disp, fn) ((disp)->GetDoublev = fn) #define CALL_GetError(disp, parameters) (*((disp)->GetError)) parameters #define GET_GetError(disp) ((disp)->GetError) #define SET_GetError(disp, fn) ((disp)->GetError = fn) #define CALL_GetFloatv(disp, parameters) (*((disp)->GetFloatv)) parameters #define GET_GetFloatv(disp) ((disp)->GetFloatv) #define SET_GetFloatv(disp, fn) ((disp)->GetFloatv = fn) #define CALL_GetIntegerv(disp, parameters) (*((disp)->GetIntegerv)) parameters #define GET_GetIntegerv(disp) ((disp)->GetIntegerv) #define SET_GetIntegerv(disp, fn) ((disp)->GetIntegerv = fn) #define CALL_GetLightfv(disp, parameters) (*((disp)->GetLightfv)) parameters #define GET_GetLightfv(disp) ((disp)->GetLightfv) #define SET_GetLightfv(disp, fn) ((disp)->GetLightfv = fn) #define CALL_GetLightiv(disp, parameters) (*((disp)->GetLightiv)) parameters #define GET_GetLightiv(disp) ((disp)->GetLightiv) #define SET_GetLightiv(disp, fn) ((disp)->GetLightiv = fn) #define CALL_GetMapdv(disp, parameters) (*((disp)->GetMapdv)) parameters #define GET_GetMapdv(disp) ((disp)->GetMapdv) #define SET_GetMapdv(disp, fn) ((disp)->GetMapdv = fn) #define CALL_GetMapfv(disp, parameters) (*((disp)->GetMapfv)) parameters #define GET_GetMapfv(disp) ((disp)->GetMapfv) #define SET_GetMapfv(disp, fn) ((disp)->GetMapfv = fn) #define CALL_GetMapiv(disp, parameters) (*((disp)->GetMapiv)) parameters #define GET_GetMapiv(disp) ((disp)->GetMapiv) #define SET_GetMapiv(disp, fn) ((disp)->GetMapiv = fn) #define CALL_GetMaterialfv(disp, parameters) (*((disp)->GetMaterialfv)) parameters #define GET_GetMaterialfv(disp) ((disp)->GetMaterialfv) #define SET_GetMaterialfv(disp, fn) ((disp)->GetMaterialfv = fn) #define CALL_GetMaterialiv(disp, parameters) (*((disp)->GetMaterialiv)) parameters #define GET_GetMaterialiv(disp) ((disp)->GetMaterialiv) #define SET_GetMaterialiv(disp, fn) ((disp)->GetMaterialiv = fn) #define CALL_GetPixelMapfv(disp, parameters) (*((disp)->GetPixelMapfv)) parameters #define GET_GetPixelMapfv(disp) ((disp)->GetPixelMapfv) #define SET_GetPixelMapfv(disp, fn) ((disp)->GetPixelMapfv = fn) #define CALL_GetPixelMapuiv(disp, parameters) (*((disp)->GetPixelMapuiv)) parameters #define GET_GetPixelMapuiv(disp) ((disp)->GetPixelMapuiv) #define SET_GetPixelMapuiv(disp, fn) ((disp)->GetPixelMapuiv = fn) #define CALL_GetPixelMapusv(disp, parameters) (*((disp)->GetPixelMapusv)) parameters #define GET_GetPixelMapusv(disp) ((disp)->GetPixelMapusv) #define SET_GetPixelMapusv(disp, fn) ((disp)->GetPixelMapusv = fn) #define CALL_GetPolygonStipple(disp, parameters) (*((disp)->GetPolygonStipple)) parameters #define GET_GetPolygonStipple(disp) ((disp)->GetPolygonStipple) #define SET_GetPolygonStipple(disp, fn) ((disp)->GetPolygonStipple = fn) #define CALL_GetString(disp, parameters) (*((disp)->GetString)) parameters #define GET_GetString(disp) ((disp)->GetString) #define SET_GetString(disp, fn) ((disp)->GetString = fn) #define CALL_GetTexEnvfv(disp, parameters) (*((disp)->GetTexEnvfv)) parameters #define GET_GetTexEnvfv(disp) ((disp)->GetTexEnvfv) #define SET_GetTexEnvfv(disp, fn) ((disp)->GetTexEnvfv = fn) #define CALL_GetTexEnviv(disp, parameters) (*((disp)->GetTexEnviv)) parameters #define GET_GetTexEnviv(disp) ((disp)->GetTexEnviv) #define SET_GetTexEnviv(disp, fn) ((disp)->GetTexEnviv = fn) #define CALL_GetTexGendv(disp, parameters) (*((disp)->GetTexGendv)) parameters #define GET_GetTexGendv(disp) ((disp)->GetTexGendv) #define SET_GetTexGendv(disp, fn) ((disp)->GetTexGendv = fn) #define CALL_GetTexGenfv(disp, parameters) (*((disp)->GetTexGenfv)) parameters #define GET_GetTexGenfv(disp) ((disp)->GetTexGenfv) #define SET_GetTexGenfv(disp, fn) ((disp)->GetTexGenfv = fn) #define CALL_GetTexGeniv(disp, parameters) (*((disp)->GetTexGeniv)) parameters #define GET_GetTexGeniv(disp) ((disp)->GetTexGeniv) #define SET_GetTexGeniv(disp, fn) ((disp)->GetTexGeniv = fn) #define CALL_GetTexImage(disp, parameters) (*((disp)->GetTexImage)) parameters #define GET_GetTexImage(disp) ((disp)->GetTexImage) #define SET_GetTexImage(disp, fn) ((disp)->GetTexImage = fn) #define CALL_GetTexParameterfv(disp, parameters) (*((disp)->GetTexParameterfv)) parameters #define GET_GetTexParameterfv(disp) ((disp)->GetTexParameterfv) #define SET_GetTexParameterfv(disp, fn) ((disp)->GetTexParameterfv = fn) #define CALL_GetTexParameteriv(disp, parameters) (*((disp)->GetTexParameteriv)) parameters #define GET_GetTexParameteriv(disp) ((disp)->GetTexParameteriv) #define SET_GetTexParameteriv(disp, fn) ((disp)->GetTexParameteriv = fn) #define CALL_GetTexLevelParameterfv(disp, parameters) (*((disp)->GetTexLevelParameterfv)) parameters #define GET_GetTexLevelParameterfv(disp) ((disp)->GetTexLevelParameterfv) #define SET_GetTexLevelParameterfv(disp, fn) ((disp)->GetTexLevelParameterfv = fn) #define CALL_GetTexLevelParameteriv(disp, parameters) (*((disp)->GetTexLevelParameteriv)) parameters #define GET_GetTexLevelParameteriv(disp) ((disp)->GetTexLevelParameteriv) #define SET_GetTexLevelParameteriv(disp, fn) ((disp)->GetTexLevelParameteriv = fn) #define CALL_IsEnabled(disp, parameters) (*((disp)->IsEnabled)) parameters #define GET_IsEnabled(disp) ((disp)->IsEnabled) #define SET_IsEnabled(disp, fn) ((disp)->IsEnabled = fn) #define CALL_IsList(disp, parameters) (*((disp)->IsList)) parameters #define GET_IsList(disp) ((disp)->IsList) #define SET_IsList(disp, fn) ((disp)->IsList = fn) #define CALL_DepthRange(disp, parameters) (*((disp)->DepthRange)) parameters #define GET_DepthRange(disp) ((disp)->DepthRange) #define SET_DepthRange(disp, fn) ((disp)->DepthRange = fn) #define CALL_Frustum(disp, parameters) (*((disp)->Frustum)) parameters #define GET_Frustum(disp) ((disp)->Frustum) #define SET_Frustum(disp, fn) ((disp)->Frustum = fn) #define CALL_LoadIdentity(disp, parameters) (*((disp)->LoadIdentity)) parameters #define GET_LoadIdentity(disp) ((disp)->LoadIdentity) #define SET_LoadIdentity(disp, fn) ((disp)->LoadIdentity = fn) #define CALL_LoadMatrixf(disp, parameters) (*((disp)->LoadMatrixf)) parameters #define GET_LoadMatrixf(disp) ((disp)->LoadMatrixf) #define SET_LoadMatrixf(disp, fn) ((disp)->LoadMatrixf = fn) #define CALL_LoadMatrixd(disp, parameters) (*((disp)->LoadMatrixd)) parameters #define GET_LoadMatrixd(disp) ((disp)->LoadMatrixd) #define SET_LoadMatrixd(disp, fn) ((disp)->LoadMatrixd = fn) #define CALL_MatrixMode(disp, parameters) (*((disp)->MatrixMode)) parameters #define GET_MatrixMode(disp) ((disp)->MatrixMode) #define SET_MatrixMode(disp, fn) ((disp)->MatrixMode = fn) #define CALL_MultMatrixf(disp, parameters) (*((disp)->MultMatrixf)) parameters #define GET_MultMatrixf(disp) ((disp)->MultMatrixf) #define SET_MultMatrixf(disp, fn) ((disp)->MultMatrixf = fn) #define CALL_MultMatrixd(disp, parameters) (*((disp)->MultMatrixd)) parameters #define GET_MultMatrixd(disp) ((disp)->MultMatrixd) #define SET_MultMatrixd(disp, fn) ((disp)->MultMatrixd = fn) #define CALL_Ortho(disp, parameters) (*((disp)->Ortho)) parameters #define GET_Ortho(disp) ((disp)->Ortho) #define SET_Ortho(disp, fn) ((disp)->Ortho = fn) #define CALL_PopMatrix(disp, parameters) (*((disp)->PopMatrix)) parameters #define GET_PopMatrix(disp) ((disp)->PopMatrix) #define SET_PopMatrix(disp, fn) ((disp)->PopMatrix = fn) #define CALL_PushMatrix(disp, parameters) (*((disp)->PushMatrix)) parameters #define GET_PushMatrix(disp) ((disp)->PushMatrix) #define SET_PushMatrix(disp, fn) ((disp)->PushMatrix = fn) #define CALL_Rotated(disp, parameters) (*((disp)->Rotated)) parameters #define GET_Rotated(disp) ((disp)->Rotated) #define SET_Rotated(disp, fn) ((disp)->Rotated = fn) #define CALL_Rotatef(disp, parameters) (*((disp)->Rotatef)) parameters #define GET_Rotatef(disp) ((disp)->Rotatef) #define SET_Rotatef(disp, fn) ((disp)->Rotatef = fn) #define CALL_Scaled(disp, parameters) (*((disp)->Scaled)) parameters #define GET_Scaled(disp) ((disp)->Scaled) #define SET_Scaled(disp, fn) ((disp)->Scaled = fn) #define CALL_Scalef(disp, parameters) (*((disp)->Scalef)) parameters #define GET_Scalef(disp) ((disp)->Scalef) #define SET_Scalef(disp, fn) ((disp)->Scalef = fn) #define CALL_Translated(disp, parameters) (*((disp)->Translated)) parameters #define GET_Translated(disp) ((disp)->Translated) #define SET_Translated(disp, fn) ((disp)->Translated = fn) #define CALL_Translatef(disp, parameters) (*((disp)->Translatef)) parameters #define GET_Translatef(disp) ((disp)->Translatef) #define SET_Translatef(disp, fn) ((disp)->Translatef = fn) #define CALL_Viewport(disp, parameters) (*((disp)->Viewport)) parameters #define GET_Viewport(disp) ((disp)->Viewport) #define SET_Viewport(disp, fn) ((disp)->Viewport = fn) #define CALL_ArrayElement(disp, parameters) (*((disp)->ArrayElement)) parameters #define GET_ArrayElement(disp) ((disp)->ArrayElement) #define SET_ArrayElement(disp, fn) ((disp)->ArrayElement = fn) #define CALL_BindTexture(disp, parameters) (*((disp)->BindTexture)) parameters #define GET_BindTexture(disp) ((disp)->BindTexture) #define SET_BindTexture(disp, fn) ((disp)->BindTexture = fn) #define CALL_ColorPointer(disp, parameters) (*((disp)->ColorPointer)) parameters #define GET_ColorPointer(disp) ((disp)->ColorPointer) #define SET_ColorPointer(disp, fn) ((disp)->ColorPointer = fn) #define CALL_DisableClientState(disp, parameters) (*((disp)->DisableClientState)) parameters #define GET_DisableClientState(disp) ((disp)->DisableClientState) #define SET_DisableClientState(disp, fn) ((disp)->DisableClientState = fn) #define CALL_DrawArrays(disp, parameters) (*((disp)->DrawArrays)) parameters #define GET_DrawArrays(disp) ((disp)->DrawArrays) #define SET_DrawArrays(disp, fn) ((disp)->DrawArrays = fn) #define CALL_DrawElements(disp, parameters) (*((disp)->DrawElements)) parameters #define GET_DrawElements(disp) ((disp)->DrawElements) #define SET_DrawElements(disp, fn) ((disp)->DrawElements = fn) #define CALL_EdgeFlagPointer(disp, parameters) (*((disp)->EdgeFlagPointer)) parameters #define GET_EdgeFlagPointer(disp) ((disp)->EdgeFlagPointer) #define SET_EdgeFlagPointer(disp, fn) ((disp)->EdgeFlagPointer = fn) #define CALL_EnableClientState(disp, parameters) (*((disp)->EnableClientState)) parameters #define GET_EnableClientState(disp) ((disp)->EnableClientState) #define SET_EnableClientState(disp, fn) ((disp)->EnableClientState = fn) #define CALL_IndexPointer(disp, parameters) (*((disp)->IndexPointer)) parameters #define GET_IndexPointer(disp) ((disp)->IndexPointer) #define SET_IndexPointer(disp, fn) ((disp)->IndexPointer = fn) #define CALL_Indexub(disp, parameters) (*((disp)->Indexub)) parameters #define GET_Indexub(disp) ((disp)->Indexub) #define SET_Indexub(disp, fn) ((disp)->Indexub = fn) #define CALL_Indexubv(disp, parameters) (*((disp)->Indexubv)) parameters #define GET_Indexubv(disp) ((disp)->Indexubv) #define SET_Indexubv(disp, fn) ((disp)->Indexubv = fn) #define CALL_InterleavedArrays(disp, parameters) (*((disp)->InterleavedArrays)) parameters #define GET_InterleavedArrays(disp) ((disp)->InterleavedArrays) #define SET_InterleavedArrays(disp, fn) ((disp)->InterleavedArrays = fn) #define CALL_NormalPointer(disp, parameters) (*((disp)->NormalPointer)) parameters #define GET_NormalPointer(disp) ((disp)->NormalPointer) #define SET_NormalPointer(disp, fn) ((disp)->NormalPointer = fn) #define CALL_PolygonOffset(disp, parameters) (*((disp)->PolygonOffset)) parameters #define GET_PolygonOffset(disp) ((disp)->PolygonOffset) #define SET_PolygonOffset(disp, fn) ((disp)->PolygonOffset = fn) #define CALL_TexCoordPointer(disp, parameters) (*((disp)->TexCoordPointer)) parameters #define GET_TexCoordPointer(disp) ((disp)->TexCoordPointer) #define SET_TexCoordPointer(disp, fn) ((disp)->TexCoordPointer = fn) #define CALL_VertexPointer(disp, parameters) (*((disp)->VertexPointer)) parameters #define GET_VertexPointer(disp) ((disp)->VertexPointer) #define SET_VertexPointer(disp, fn) ((disp)->VertexPointer = fn) #define CALL_AreTexturesResident(disp, parameters) (*((disp)->AreTexturesResident)) parameters #define GET_AreTexturesResident(disp) ((disp)->AreTexturesResident) #define SET_AreTexturesResident(disp, fn) ((disp)->AreTexturesResident = fn) #define CALL_CopyTexImage1D(disp, parameters) (*((disp)->CopyTexImage1D)) parameters #define GET_CopyTexImage1D(disp) ((disp)->CopyTexImage1D) #define SET_CopyTexImage1D(disp, fn) ((disp)->CopyTexImage1D = fn) #define CALL_CopyTexImage2D(disp, parameters) (*((disp)->CopyTexImage2D)) parameters #define GET_CopyTexImage2D(disp) ((disp)->CopyTexImage2D) #define SET_CopyTexImage2D(disp, fn) ((disp)->CopyTexImage2D = fn) #define CALL_CopyTexSubImage1D(disp, parameters) (*((disp)->CopyTexSubImage1D)) parameters #define GET_CopyTexSubImage1D(disp) ((disp)->CopyTexSubImage1D) #define SET_CopyTexSubImage1D(disp, fn) ((disp)->CopyTexSubImage1D = fn) #define CALL_CopyTexSubImage2D(disp, parameters) (*((disp)->CopyTexSubImage2D)) parameters #define GET_CopyTexSubImage2D(disp) ((disp)->CopyTexSubImage2D) #define SET_CopyTexSubImage2D(disp, fn) ((disp)->CopyTexSubImage2D = fn) #define CALL_DeleteTextures(disp, parameters) (*((disp)->DeleteTextures)) parameters #define GET_DeleteTextures(disp) ((disp)->DeleteTextures) #define SET_DeleteTextures(disp, fn) ((disp)->DeleteTextures = fn) #define CALL_GenTextures(disp, parameters) (*((disp)->GenTextures)) parameters #define GET_GenTextures(disp) ((disp)->GenTextures) #define SET_GenTextures(disp, fn) ((disp)->GenTextures = fn) #define CALL_GetPointerv(disp, parameters) (*((disp)->GetPointerv)) parameters #define GET_GetPointerv(disp) ((disp)->GetPointerv) #define SET_GetPointerv(disp, fn) ((disp)->GetPointerv = fn) #define CALL_IsTexture(disp, parameters) (*((disp)->IsTexture)) parameters #define GET_IsTexture(disp) ((disp)->IsTexture) #define SET_IsTexture(disp, fn) ((disp)->IsTexture = fn) #define CALL_PrioritizeTextures(disp, parameters) (*((disp)->PrioritizeTextures)) parameters #define GET_PrioritizeTextures(disp) ((disp)->PrioritizeTextures) #define SET_PrioritizeTextures(disp, fn) ((disp)->PrioritizeTextures = fn) #define CALL_TexSubImage1D(disp, parameters) (*((disp)->TexSubImage1D)) parameters #define GET_TexSubImage1D(disp) ((disp)->TexSubImage1D) #define SET_TexSubImage1D(disp, fn) ((disp)->TexSubImage1D = fn) #define CALL_TexSubImage2D(disp, parameters) (*((disp)->TexSubImage2D)) parameters #define GET_TexSubImage2D(disp) ((disp)->TexSubImage2D) #define SET_TexSubImage2D(disp, fn) ((disp)->TexSubImage2D = fn) #define CALL_PopClientAttrib(disp, parameters) (*((disp)->PopClientAttrib)) parameters #define GET_PopClientAttrib(disp) ((disp)->PopClientAttrib) #define SET_PopClientAttrib(disp, fn) ((disp)->PopClientAttrib = fn) #define CALL_PushClientAttrib(disp, parameters) (*((disp)->PushClientAttrib)) parameters #define GET_PushClientAttrib(disp) ((disp)->PushClientAttrib) #define SET_PushClientAttrib(disp, fn) ((disp)->PushClientAttrib = fn) #define CALL_BlendColor(disp, parameters) (*((disp)->BlendColor)) parameters #define GET_BlendColor(disp) ((disp)->BlendColor) #define SET_BlendColor(disp, fn) ((disp)->BlendColor = fn) #define CALL_BlendEquation(disp, parameters) (*((disp)->BlendEquation)) parameters #define GET_BlendEquation(disp) ((disp)->BlendEquation) #define SET_BlendEquation(disp, fn) ((disp)->BlendEquation = fn) #define CALL_DrawRangeElements(disp, parameters) (*((disp)->DrawRangeElements)) parameters #define GET_DrawRangeElements(disp) ((disp)->DrawRangeElements) #define SET_DrawRangeElements(disp, fn) ((disp)->DrawRangeElements = fn) #define CALL_ColorTable(disp, parameters) (*((disp)->ColorTable)) parameters #define GET_ColorTable(disp) ((disp)->ColorTable) #define SET_ColorTable(disp, fn) ((disp)->ColorTable = fn) #define CALL_ColorTableParameterfv(disp, parameters) (*((disp)->ColorTableParameterfv)) parameters #define GET_ColorTableParameterfv(disp) ((disp)->ColorTableParameterfv) #define SET_ColorTableParameterfv(disp, fn) ((disp)->ColorTableParameterfv = fn) #define CALL_ColorTableParameteriv(disp, parameters) (*((disp)->ColorTableParameteriv)) parameters #define GET_ColorTableParameteriv(disp) ((disp)->ColorTableParameteriv) #define SET_ColorTableParameteriv(disp, fn) ((disp)->ColorTableParameteriv = fn) #define CALL_CopyColorTable(disp, parameters) (*((disp)->CopyColorTable)) parameters #define GET_CopyColorTable(disp) ((disp)->CopyColorTable) #define SET_CopyColorTable(disp, fn) ((disp)->CopyColorTable = fn) #define CALL_GetColorTable(disp, parameters) (*((disp)->GetColorTable)) parameters #define GET_GetColorTable(disp) ((disp)->GetColorTable) #define SET_GetColorTable(disp, fn) ((disp)->GetColorTable = fn) #define CALL_GetColorTableParameterfv(disp, parameters) (*((disp)->GetColorTableParameterfv)) parameters #define GET_GetColorTableParameterfv(disp) ((disp)->GetColorTableParameterfv) #define SET_GetColorTableParameterfv(disp, fn) ((disp)->GetColorTableParameterfv = fn) #define CALL_GetColorTableParameteriv(disp, parameters) (*((disp)->GetColorTableParameteriv)) parameters #define GET_GetColorTableParameteriv(disp) ((disp)->GetColorTableParameteriv) #define SET_GetColorTableParameteriv(disp, fn) ((disp)->GetColorTableParameteriv = fn) #define CALL_ColorSubTable(disp, parameters) (*((disp)->ColorSubTable)) parameters #define GET_ColorSubTable(disp) ((disp)->ColorSubTable) #define SET_ColorSubTable(disp, fn) ((disp)->ColorSubTable = fn) #define CALL_CopyColorSubTable(disp, parameters) (*((disp)->CopyColorSubTable)) parameters #define GET_CopyColorSubTable(disp) ((disp)->CopyColorSubTable) #define SET_CopyColorSubTable(disp, fn) ((disp)->CopyColorSubTable = fn) #define CALL_ConvolutionFilter1D(disp, parameters) (*((disp)->ConvolutionFilter1D)) parameters #define GET_ConvolutionFilter1D(disp) ((disp)->ConvolutionFilter1D) #define SET_ConvolutionFilter1D(disp, fn) ((disp)->ConvolutionFilter1D = fn) #define CALL_ConvolutionFilter2D(disp, parameters) (*((disp)->ConvolutionFilter2D)) parameters #define GET_ConvolutionFilter2D(disp) ((disp)->ConvolutionFilter2D) #define SET_ConvolutionFilter2D(disp, fn) ((disp)->ConvolutionFilter2D = fn) #define CALL_ConvolutionParameterf(disp, parameters) (*((disp)->ConvolutionParameterf)) parameters #define GET_ConvolutionParameterf(disp) ((disp)->ConvolutionParameterf) #define SET_ConvolutionParameterf(disp, fn) ((disp)->ConvolutionParameterf = fn) #define CALL_ConvolutionParameterfv(disp, parameters) (*((disp)->ConvolutionParameterfv)) parameters #define GET_ConvolutionParameterfv(disp) ((disp)->ConvolutionParameterfv) #define SET_ConvolutionParameterfv(disp, fn) ((disp)->ConvolutionParameterfv = fn) #define CALL_ConvolutionParameteri(disp, parameters) (*((disp)->ConvolutionParameteri)) parameters #define GET_ConvolutionParameteri(disp) ((disp)->ConvolutionParameteri) #define SET_ConvolutionParameteri(disp, fn) ((disp)->ConvolutionParameteri = fn) #define CALL_ConvolutionParameteriv(disp, parameters) (*((disp)->ConvolutionParameteriv)) parameters #define GET_ConvolutionParameteriv(disp) ((disp)->ConvolutionParameteriv) #define SET_ConvolutionParameteriv(disp, fn) ((disp)->ConvolutionParameteriv = fn) #define CALL_CopyConvolutionFilter1D(disp, parameters) (*((disp)->CopyConvolutionFilter1D)) parameters #define GET_CopyConvolutionFilter1D(disp) ((disp)->CopyConvolutionFilter1D) #define SET_CopyConvolutionFilter1D(disp, fn) ((disp)->CopyConvolutionFilter1D = fn) #define CALL_CopyConvolutionFilter2D(disp, parameters) (*((disp)->CopyConvolutionFilter2D)) parameters #define GET_CopyConvolutionFilter2D(disp) ((disp)->CopyConvolutionFilter2D) #define SET_CopyConvolutionFilter2D(disp, fn) ((disp)->CopyConvolutionFilter2D = fn) #define CALL_GetConvolutionFilter(disp, parameters) (*((disp)->GetConvolutionFilter)) parameters #define GET_GetConvolutionFilter(disp) ((disp)->GetConvolutionFilter) #define SET_GetConvolutionFilter(disp, fn) ((disp)->GetConvolutionFilter = fn) #define CALL_GetConvolutionParameterfv(disp, parameters) (*((disp)->GetConvolutionParameterfv)) parameters #define GET_GetConvolutionParameterfv(disp) ((disp)->GetConvolutionParameterfv) #define SET_GetConvolutionParameterfv(disp, fn) ((disp)->GetConvolutionParameterfv = fn) #define CALL_GetConvolutionParameteriv(disp, parameters) (*((disp)->GetConvolutionParameteriv)) parameters #define GET_GetConvolutionParameteriv(disp) ((disp)->GetConvolutionParameteriv) #define SET_GetConvolutionParameteriv(disp, fn) ((disp)->GetConvolutionParameteriv = fn) #define CALL_GetSeparableFilter(disp, parameters) (*((disp)->GetSeparableFilter)) parameters #define GET_GetSeparableFilter(disp) ((disp)->GetSeparableFilter) #define SET_GetSeparableFilter(disp, fn) ((disp)->GetSeparableFilter = fn) #define CALL_SeparableFilter2D(disp, parameters) (*((disp)->SeparableFilter2D)) parameters #define GET_SeparableFilter2D(disp) ((disp)->SeparableFilter2D) #define SET_SeparableFilter2D(disp, fn) ((disp)->SeparableFilter2D = fn) #define CALL_GetHistogram(disp, parameters) (*((disp)->GetHistogram)) parameters #define GET_GetHistogram(disp) ((disp)->GetHistogram) #define SET_GetHistogram(disp, fn) ((disp)->GetHistogram = fn) #define CALL_GetHistogramParameterfv(disp, parameters) (*((disp)->GetHistogramParameterfv)) parameters #define GET_GetHistogramParameterfv(disp) ((disp)->GetHistogramParameterfv) #define SET_GetHistogramParameterfv(disp, fn) ((disp)->GetHistogramParameterfv = fn) #define CALL_GetHistogramParameteriv(disp, parameters) (*((disp)->GetHistogramParameteriv)) parameters #define GET_GetHistogramParameteriv(disp) ((disp)->GetHistogramParameteriv) #define SET_GetHistogramParameteriv(disp, fn) ((disp)->GetHistogramParameteriv = fn) #define CALL_GetMinmax(disp, parameters) (*((disp)->GetMinmax)) parameters #define GET_GetMinmax(disp) ((disp)->GetMinmax) #define SET_GetMinmax(disp, fn) ((disp)->GetMinmax = fn) #define CALL_GetMinmaxParameterfv(disp, parameters) (*((disp)->GetMinmaxParameterfv)) parameters #define GET_GetMinmaxParameterfv(disp) ((disp)->GetMinmaxParameterfv) #define SET_GetMinmaxParameterfv(disp, fn) ((disp)->GetMinmaxParameterfv = fn) #define CALL_GetMinmaxParameteriv(disp, parameters) (*((disp)->GetMinmaxParameteriv)) parameters #define GET_GetMinmaxParameteriv(disp) ((disp)->GetMinmaxParameteriv) #define SET_GetMinmaxParameteriv(disp, fn) ((disp)->GetMinmaxParameteriv = fn) #define CALL_Histogram(disp, parameters) (*((disp)->Histogram)) parameters #define GET_Histogram(disp) ((disp)->Histogram) #define SET_Histogram(disp, fn) ((disp)->Histogram = fn) #define CALL_Minmax(disp, parameters) (*((disp)->Minmax)) parameters #define GET_Minmax(disp) ((disp)->Minmax) #define SET_Minmax(disp, fn) ((disp)->Minmax = fn) #define CALL_ResetHistogram(disp, parameters) (*((disp)->ResetHistogram)) parameters #define GET_ResetHistogram(disp) ((disp)->ResetHistogram) #define SET_ResetHistogram(disp, fn) ((disp)->ResetHistogram = fn) #define CALL_ResetMinmax(disp, parameters) (*((disp)->ResetMinmax)) parameters #define GET_ResetMinmax(disp) ((disp)->ResetMinmax) #define SET_ResetMinmax(disp, fn) ((disp)->ResetMinmax = fn) #define CALL_TexImage3D(disp, parameters) (*((disp)->TexImage3D)) parameters #define GET_TexImage3D(disp) ((disp)->TexImage3D) #define SET_TexImage3D(disp, fn) ((disp)->TexImage3D = fn) #define CALL_TexSubImage3D(disp, parameters) (*((disp)->TexSubImage3D)) parameters #define GET_TexSubImage3D(disp) ((disp)->TexSubImage3D) #define SET_TexSubImage3D(disp, fn) ((disp)->TexSubImage3D = fn) #define CALL_CopyTexSubImage3D(disp, parameters) (*((disp)->CopyTexSubImage3D)) parameters #define GET_CopyTexSubImage3D(disp) ((disp)->CopyTexSubImage3D) #define SET_CopyTexSubImage3D(disp, fn) ((disp)->CopyTexSubImage3D = fn) #define CALL_ActiveTextureARB(disp, parameters) (*((disp)->ActiveTextureARB)) parameters #define GET_ActiveTextureARB(disp) ((disp)->ActiveTextureARB) #define SET_ActiveTextureARB(disp, fn) ((disp)->ActiveTextureARB = fn) #define CALL_ClientActiveTextureARB(disp, parameters) (*((disp)->ClientActiveTextureARB)) parameters #define GET_ClientActiveTextureARB(disp) ((disp)->ClientActiveTextureARB) #define SET_ClientActiveTextureARB(disp, fn) ((disp)->ClientActiveTextureARB = fn) #define CALL_MultiTexCoord1dARB(disp, parameters) (*((disp)->MultiTexCoord1dARB)) parameters #define GET_MultiTexCoord1dARB(disp) ((disp)->MultiTexCoord1dARB) #define SET_MultiTexCoord1dARB(disp, fn) ((disp)->MultiTexCoord1dARB = fn) #define CALL_MultiTexCoord1dvARB(disp, parameters) (*((disp)->MultiTexCoord1dvARB)) parameters #define GET_MultiTexCoord1dvARB(disp) ((disp)->MultiTexCoord1dvARB) #define SET_MultiTexCoord1dvARB(disp, fn) ((disp)->MultiTexCoord1dvARB = fn) #define CALL_MultiTexCoord1fARB(disp, parameters) (*((disp)->MultiTexCoord1fARB)) parameters #define GET_MultiTexCoord1fARB(disp) ((disp)->MultiTexCoord1fARB) #define SET_MultiTexCoord1fARB(disp, fn) ((disp)->MultiTexCoord1fARB = fn) #define CALL_MultiTexCoord1fvARB(disp, parameters) (*((disp)->MultiTexCoord1fvARB)) parameters #define GET_MultiTexCoord1fvARB(disp) ((disp)->MultiTexCoord1fvARB) #define SET_MultiTexCoord1fvARB(disp, fn) ((disp)->MultiTexCoord1fvARB = fn) #define CALL_MultiTexCoord1iARB(disp, parameters) (*((disp)->MultiTexCoord1iARB)) parameters #define GET_MultiTexCoord1iARB(disp) ((disp)->MultiTexCoord1iARB) #define SET_MultiTexCoord1iARB(disp, fn) ((disp)->MultiTexCoord1iARB = fn) #define CALL_MultiTexCoord1ivARB(disp, parameters) (*((disp)->MultiTexCoord1ivARB)) parameters #define GET_MultiTexCoord1ivARB(disp) ((disp)->MultiTexCoord1ivARB) #define SET_MultiTexCoord1ivARB(disp, fn) ((disp)->MultiTexCoord1ivARB = fn) #define CALL_MultiTexCoord1sARB(disp, parameters) (*((disp)->MultiTexCoord1sARB)) parameters #define GET_MultiTexCoord1sARB(disp) ((disp)->MultiTexCoord1sARB) #define SET_MultiTexCoord1sARB(disp, fn) ((disp)->MultiTexCoord1sARB = fn) #define CALL_MultiTexCoord1svARB(disp, parameters) (*((disp)->MultiTexCoord1svARB)) parameters #define GET_MultiTexCoord1svARB(disp) ((disp)->MultiTexCoord1svARB) #define SET_MultiTexCoord1svARB(disp, fn) ((disp)->MultiTexCoord1svARB = fn) #define CALL_MultiTexCoord2dARB(disp, parameters) (*((disp)->MultiTexCoord2dARB)) parameters #define GET_MultiTexCoord2dARB(disp) ((disp)->MultiTexCoord2dARB) #define SET_MultiTexCoord2dARB(disp, fn) ((disp)->MultiTexCoord2dARB = fn) #define CALL_MultiTexCoord2dvARB(disp, parameters) (*((disp)->MultiTexCoord2dvARB)) parameters #define GET_MultiTexCoord2dvARB(disp) ((disp)->MultiTexCoord2dvARB) #define SET_MultiTexCoord2dvARB(disp, fn) ((disp)->MultiTexCoord2dvARB = fn) #define CALL_MultiTexCoord2fARB(disp, parameters) (*((disp)->MultiTexCoord2fARB)) parameters #define GET_MultiTexCoord2fARB(disp) ((disp)->MultiTexCoord2fARB) #define SET_MultiTexCoord2fARB(disp, fn) ((disp)->MultiTexCoord2fARB = fn) #define CALL_MultiTexCoord2fvARB(disp, parameters) (*((disp)->MultiTexCoord2fvARB)) parameters #define GET_MultiTexCoord2fvARB(disp) ((disp)->MultiTexCoord2fvARB) #define SET_MultiTexCoord2fvARB(disp, fn) ((disp)->MultiTexCoord2fvARB = fn) #define CALL_MultiTexCoord2iARB(disp, parameters) (*((disp)->MultiTexCoord2iARB)) parameters #define GET_MultiTexCoord2iARB(disp) ((disp)->MultiTexCoord2iARB) #define SET_MultiTexCoord2iARB(disp, fn) ((disp)->MultiTexCoord2iARB = fn) #define CALL_MultiTexCoord2ivARB(disp, parameters) (*((disp)->MultiTexCoord2ivARB)) parameters #define GET_MultiTexCoord2ivARB(disp) ((disp)->MultiTexCoord2ivARB) #define SET_MultiTexCoord2ivARB(disp, fn) ((disp)->MultiTexCoord2ivARB = fn) #define CALL_MultiTexCoord2sARB(disp, parameters) (*((disp)->MultiTexCoord2sARB)) parameters #define GET_MultiTexCoord2sARB(disp) ((disp)->MultiTexCoord2sARB) #define SET_MultiTexCoord2sARB(disp, fn) ((disp)->MultiTexCoord2sARB = fn) #define CALL_MultiTexCoord2svARB(disp, parameters) (*((disp)->MultiTexCoord2svARB)) parameters #define GET_MultiTexCoord2svARB(disp) ((disp)->MultiTexCoord2svARB) #define SET_MultiTexCoord2svARB(disp, fn) ((disp)->MultiTexCoord2svARB = fn) #define CALL_MultiTexCoord3dARB(disp, parameters) (*((disp)->MultiTexCoord3dARB)) parameters #define GET_MultiTexCoord3dARB(disp) ((disp)->MultiTexCoord3dARB) #define SET_MultiTexCoord3dARB(disp, fn) ((disp)->MultiTexCoord3dARB = fn) #define CALL_MultiTexCoord3dvARB(disp, parameters) (*((disp)->MultiTexCoord3dvARB)) parameters #define GET_MultiTexCoord3dvARB(disp) ((disp)->MultiTexCoord3dvARB) #define SET_MultiTexCoord3dvARB(disp, fn) ((disp)->MultiTexCoord3dvARB = fn) #define CALL_MultiTexCoord3fARB(disp, parameters) (*((disp)->MultiTexCoord3fARB)) parameters #define GET_MultiTexCoord3fARB(disp) ((disp)->MultiTexCoord3fARB) #define SET_MultiTexCoord3fARB(disp, fn) ((disp)->MultiTexCoord3fARB = fn) #define CALL_MultiTexCoord3fvARB(disp, parameters) (*((disp)->MultiTexCoord3fvARB)) parameters #define GET_MultiTexCoord3fvARB(disp) ((disp)->MultiTexCoord3fvARB) #define SET_MultiTexCoord3fvARB(disp, fn) ((disp)->MultiTexCoord3fvARB = fn) #define CALL_MultiTexCoord3iARB(disp, parameters) (*((disp)->MultiTexCoord3iARB)) parameters #define GET_MultiTexCoord3iARB(disp) ((disp)->MultiTexCoord3iARB) #define SET_MultiTexCoord3iARB(disp, fn) ((disp)->MultiTexCoord3iARB = fn) #define CALL_MultiTexCoord3ivARB(disp, parameters) (*((disp)->MultiTexCoord3ivARB)) parameters #define GET_MultiTexCoord3ivARB(disp) ((disp)->MultiTexCoord3ivARB) #define SET_MultiTexCoord3ivARB(disp, fn) ((disp)->MultiTexCoord3ivARB = fn) #define CALL_MultiTexCoord3sARB(disp, parameters) (*((disp)->MultiTexCoord3sARB)) parameters #define GET_MultiTexCoord3sARB(disp) ((disp)->MultiTexCoord3sARB) #define SET_MultiTexCoord3sARB(disp, fn) ((disp)->MultiTexCoord3sARB = fn) #define CALL_MultiTexCoord3svARB(disp, parameters) (*((disp)->MultiTexCoord3svARB)) parameters #define GET_MultiTexCoord3svARB(disp) ((disp)->MultiTexCoord3svARB) #define SET_MultiTexCoord3svARB(disp, fn) ((disp)->MultiTexCoord3svARB = fn) #define CALL_MultiTexCoord4dARB(disp, parameters) (*((disp)->MultiTexCoord4dARB)) parameters #define GET_MultiTexCoord4dARB(disp) ((disp)->MultiTexCoord4dARB) #define SET_MultiTexCoord4dARB(disp, fn) ((disp)->MultiTexCoord4dARB = fn) #define CALL_MultiTexCoord4dvARB(disp, parameters) (*((disp)->MultiTexCoord4dvARB)) parameters #define GET_MultiTexCoord4dvARB(disp) ((disp)->MultiTexCoord4dvARB) #define SET_MultiTexCoord4dvARB(disp, fn) ((disp)->MultiTexCoord4dvARB = fn) #define CALL_MultiTexCoord4fARB(disp, parameters) (*((disp)->MultiTexCoord4fARB)) parameters #define GET_MultiTexCoord4fARB(disp) ((disp)->MultiTexCoord4fARB) #define SET_MultiTexCoord4fARB(disp, fn) ((disp)->MultiTexCoord4fARB = fn) #define CALL_MultiTexCoord4fvARB(disp, parameters) (*((disp)->MultiTexCoord4fvARB)) parameters #define GET_MultiTexCoord4fvARB(disp) ((disp)->MultiTexCoord4fvARB) #define SET_MultiTexCoord4fvARB(disp, fn) ((disp)->MultiTexCoord4fvARB = fn) #define CALL_MultiTexCoord4iARB(disp, parameters) (*((disp)->MultiTexCoord4iARB)) parameters #define GET_MultiTexCoord4iARB(disp) ((disp)->MultiTexCoord4iARB) #define SET_MultiTexCoord4iARB(disp, fn) ((disp)->MultiTexCoord4iARB = fn) #define CALL_MultiTexCoord4ivARB(disp, parameters) (*((disp)->MultiTexCoord4ivARB)) parameters #define GET_MultiTexCoord4ivARB(disp) ((disp)->MultiTexCoord4ivARB) #define SET_MultiTexCoord4ivARB(disp, fn) ((disp)->MultiTexCoord4ivARB = fn) #define CALL_MultiTexCoord4sARB(disp, parameters) (*((disp)->MultiTexCoord4sARB)) parameters #define GET_MultiTexCoord4sARB(disp) ((disp)->MultiTexCoord4sARB) #define SET_MultiTexCoord4sARB(disp, fn) ((disp)->MultiTexCoord4sARB = fn) #define CALL_MultiTexCoord4svARB(disp, parameters) (*((disp)->MultiTexCoord4svARB)) parameters #define GET_MultiTexCoord4svARB(disp) ((disp)->MultiTexCoord4svARB) #define SET_MultiTexCoord4svARB(disp, fn) ((disp)->MultiTexCoord4svARB = fn) #if !defined(IN_DRI_DRIVER) #define CALL_LoadTransposeMatrixfARB(disp, parameters) (*((disp)->LoadTransposeMatrixfARB)) parameters #define GET_LoadTransposeMatrixfARB(disp) ((disp)->LoadTransposeMatrixfARB) #define SET_LoadTransposeMatrixfARB(disp, fn) ((disp)->LoadTransposeMatrixfARB = fn) #define CALL_LoadTransposeMatrixdARB(disp, parameters) (*((disp)->LoadTransposeMatrixdARB)) parameters #define GET_LoadTransposeMatrixdARB(disp) ((disp)->LoadTransposeMatrixdARB) #define SET_LoadTransposeMatrixdARB(disp, fn) ((disp)->LoadTransposeMatrixdARB = fn) #define CALL_MultTransposeMatrixfARB(disp, parameters) (*((disp)->MultTransposeMatrixfARB)) parameters #define GET_MultTransposeMatrixfARB(disp) ((disp)->MultTransposeMatrixfARB) #define SET_MultTransposeMatrixfARB(disp, fn) ((disp)->MultTransposeMatrixfARB = fn) #define CALL_MultTransposeMatrixdARB(disp, parameters) (*((disp)->MultTransposeMatrixdARB)) parameters #define GET_MultTransposeMatrixdARB(disp) ((disp)->MultTransposeMatrixdARB) #define SET_MultTransposeMatrixdARB(disp, fn) ((disp)->MultTransposeMatrixdARB = fn) #define CALL_SampleCoverageARB(disp, parameters) (*((disp)->SampleCoverageARB)) parameters #define GET_SampleCoverageARB(disp) ((disp)->SampleCoverageARB) #define SET_SampleCoverageARB(disp, fn) ((disp)->SampleCoverageARB = fn) #define CALL_DrawBuffersARB(disp, parameters) (*((disp)->DrawBuffersARB)) parameters #define GET_DrawBuffersARB(disp) ((disp)->DrawBuffersARB) #define SET_DrawBuffersARB(disp, fn) ((disp)->DrawBuffersARB = fn) #define CALL_PolygonOffsetEXT(disp, parameters) (*((disp)->PolygonOffsetEXT)) parameters #define GET_PolygonOffsetEXT(disp) ((disp)->PolygonOffsetEXT) #define SET_PolygonOffsetEXT(disp, fn) ((disp)->PolygonOffsetEXT = fn) #define CALL_GetTexFilterFuncSGIS(disp, parameters) (*((disp)->GetTexFilterFuncSGIS)) parameters #define GET_GetTexFilterFuncSGIS(disp) ((disp)->GetTexFilterFuncSGIS) #define SET_GetTexFilterFuncSGIS(disp, fn) ((disp)->GetTexFilterFuncSGIS = fn) #define CALL_TexFilterFuncSGIS(disp, parameters) (*((disp)->TexFilterFuncSGIS)) parameters #define GET_TexFilterFuncSGIS(disp) ((disp)->TexFilterFuncSGIS) #define SET_TexFilterFuncSGIS(disp, fn) ((disp)->TexFilterFuncSGIS = fn) #define CALL_GetHistogramEXT(disp, parameters) (*((disp)->GetHistogramEXT)) parameters #define GET_GetHistogramEXT(disp) ((disp)->GetHistogramEXT) #define SET_GetHistogramEXT(disp, fn) ((disp)->GetHistogramEXT = fn) #define CALL_GetHistogramParameterfvEXT(disp, parameters) (*((disp)->GetHistogramParameterfvEXT)) parameters #define GET_GetHistogramParameterfvEXT(disp) ((disp)->GetHistogramParameterfvEXT) #define SET_GetHistogramParameterfvEXT(disp, fn) ((disp)->GetHistogramParameterfvEXT = fn) #define CALL_GetHistogramParameterivEXT(disp, parameters) (*((disp)->GetHistogramParameterivEXT)) parameters #define GET_GetHistogramParameterivEXT(disp) ((disp)->GetHistogramParameterivEXT) #define SET_GetHistogramParameterivEXT(disp, fn) ((disp)->GetHistogramParameterivEXT = fn) #define CALL_GetMinmaxEXT(disp, parameters) (*((disp)->GetMinmaxEXT)) parameters #define GET_GetMinmaxEXT(disp) ((disp)->GetMinmaxEXT) #define SET_GetMinmaxEXT(disp, fn) ((disp)->GetMinmaxEXT = fn) #define CALL_GetMinmaxParameterfvEXT(disp, parameters) (*((disp)->GetMinmaxParameterfvEXT)) parameters #define GET_GetMinmaxParameterfvEXT(disp) ((disp)->GetMinmaxParameterfvEXT) #define SET_GetMinmaxParameterfvEXT(disp, fn) ((disp)->GetMinmaxParameterfvEXT = fn) #define CALL_GetMinmaxParameterivEXT(disp, parameters) (*((disp)->GetMinmaxParameterivEXT)) parameters #define GET_GetMinmaxParameterivEXT(disp) ((disp)->GetMinmaxParameterivEXT) #define SET_GetMinmaxParameterivEXT(disp, fn) ((disp)->GetMinmaxParameterivEXT = fn) #define CALL_GetConvolutionFilterEXT(disp, parameters) (*((disp)->GetConvolutionFilterEXT)) parameters #define GET_GetConvolutionFilterEXT(disp) ((disp)->GetConvolutionFilterEXT) #define SET_GetConvolutionFilterEXT(disp, fn) ((disp)->GetConvolutionFilterEXT = fn) #define CALL_GetConvolutionParameterfvEXT(disp, parameters) (*((disp)->GetConvolutionParameterfvEXT)) parameters #define GET_GetConvolutionParameterfvEXT(disp) ((disp)->GetConvolutionParameterfvEXT) #define SET_GetConvolutionParameterfvEXT(disp, fn) ((disp)->GetConvolutionParameterfvEXT = fn) #define CALL_GetConvolutionParameterivEXT(disp, parameters) (*((disp)->GetConvolutionParameterivEXT)) parameters #define GET_GetConvolutionParameterivEXT(disp) ((disp)->GetConvolutionParameterivEXT) #define SET_GetConvolutionParameterivEXT(disp, fn) ((disp)->GetConvolutionParameterivEXT = fn) #define CALL_GetSeparableFilterEXT(disp, parameters) (*((disp)->GetSeparableFilterEXT)) parameters #define GET_GetSeparableFilterEXT(disp) ((disp)->GetSeparableFilterEXT) #define SET_GetSeparableFilterEXT(disp, fn) ((disp)->GetSeparableFilterEXT = fn) #define CALL_GetColorTableSGI(disp, parameters) (*((disp)->GetColorTableSGI)) parameters #define GET_GetColorTableSGI(disp) ((disp)->GetColorTableSGI) #define SET_GetColorTableSGI(disp, fn) ((disp)->GetColorTableSGI = fn) #define CALL_GetColorTableParameterfvSGI(disp, parameters) (*((disp)->GetColorTableParameterfvSGI)) parameters #define GET_GetColorTableParameterfvSGI(disp) ((disp)->GetColorTableParameterfvSGI) #define SET_GetColorTableParameterfvSGI(disp, fn) ((disp)->GetColorTableParameterfvSGI = fn) #define CALL_GetColorTableParameterivSGI(disp, parameters) (*((disp)->GetColorTableParameterivSGI)) parameters #define GET_GetColorTableParameterivSGI(disp) ((disp)->GetColorTableParameterivSGI) #define SET_GetColorTableParameterivSGI(disp, fn) ((disp)->GetColorTableParameterivSGI = fn) #define CALL_PixelTexGenSGIX(disp, parameters) (*((disp)->PixelTexGenSGIX)) parameters #define GET_PixelTexGenSGIX(disp) ((disp)->PixelTexGenSGIX) #define SET_PixelTexGenSGIX(disp, fn) ((disp)->PixelTexGenSGIX = fn) #define CALL_PixelTexGenParameteriSGIS(disp, parameters) (*((disp)->PixelTexGenParameteriSGIS)) parameters #define GET_PixelTexGenParameteriSGIS(disp) ((disp)->PixelTexGenParameteriSGIS) #define SET_PixelTexGenParameteriSGIS(disp, fn) ((disp)->PixelTexGenParameteriSGIS = fn) #define CALL_PixelTexGenParameterivSGIS(disp, parameters) (*((disp)->PixelTexGenParameterivSGIS)) parameters #define GET_PixelTexGenParameterivSGIS(disp) ((disp)->PixelTexGenParameterivSGIS) #define SET_PixelTexGenParameterivSGIS(disp, fn) ((disp)->PixelTexGenParameterivSGIS = fn) #define CALL_PixelTexGenParameterfSGIS(disp, parameters) (*((disp)->PixelTexGenParameterfSGIS)) parameters #define GET_PixelTexGenParameterfSGIS(disp) ((disp)->PixelTexGenParameterfSGIS) #define SET_PixelTexGenParameterfSGIS(disp, fn) ((disp)->PixelTexGenParameterfSGIS = fn) #define CALL_PixelTexGenParameterfvSGIS(disp, parameters) (*((disp)->PixelTexGenParameterfvSGIS)) parameters #define GET_PixelTexGenParameterfvSGIS(disp) ((disp)->PixelTexGenParameterfvSGIS) #define SET_PixelTexGenParameterfvSGIS(disp, fn) ((disp)->PixelTexGenParameterfvSGIS = fn) #define CALL_GetPixelTexGenParameterivSGIS(disp, parameters) (*((disp)->GetPixelTexGenParameterivSGIS)) parameters #define GET_GetPixelTexGenParameterivSGIS(disp) ((disp)->GetPixelTexGenParameterivSGIS) #define SET_GetPixelTexGenParameterivSGIS(disp, fn) ((disp)->GetPixelTexGenParameterivSGIS = fn) #define CALL_GetPixelTexGenParameterfvSGIS(disp, parameters) (*((disp)->GetPixelTexGenParameterfvSGIS)) parameters #define GET_GetPixelTexGenParameterfvSGIS(disp) ((disp)->GetPixelTexGenParameterfvSGIS) #define SET_GetPixelTexGenParameterfvSGIS(disp, fn) ((disp)->GetPixelTexGenParameterfvSGIS = fn) #define CALL_TexImage4DSGIS(disp, parameters) (*((disp)->TexImage4DSGIS)) parameters #define GET_TexImage4DSGIS(disp) ((disp)->TexImage4DSGIS) #define SET_TexImage4DSGIS(disp, fn) ((disp)->TexImage4DSGIS = fn) #define CALL_TexSubImage4DSGIS(disp, parameters) (*((disp)->TexSubImage4DSGIS)) parameters #define GET_TexSubImage4DSGIS(disp) ((disp)->TexSubImage4DSGIS) #define SET_TexSubImage4DSGIS(disp, fn) ((disp)->TexSubImage4DSGIS = fn) #define CALL_AreTexturesResidentEXT(disp, parameters) (*((disp)->AreTexturesResidentEXT)) parameters #define GET_AreTexturesResidentEXT(disp) ((disp)->AreTexturesResidentEXT) #define SET_AreTexturesResidentEXT(disp, fn) ((disp)->AreTexturesResidentEXT = fn) #define CALL_GenTexturesEXT(disp, parameters) (*((disp)->GenTexturesEXT)) parameters #define GET_GenTexturesEXT(disp) ((disp)->GenTexturesEXT) #define SET_GenTexturesEXT(disp, fn) ((disp)->GenTexturesEXT = fn) #define CALL_IsTextureEXT(disp, parameters) (*((disp)->IsTextureEXT)) parameters #define GET_IsTextureEXT(disp) ((disp)->IsTextureEXT) #define SET_IsTextureEXT(disp, fn) ((disp)->IsTextureEXT = fn) #define CALL_DetailTexFuncSGIS(disp, parameters) (*((disp)->DetailTexFuncSGIS)) parameters #define GET_DetailTexFuncSGIS(disp) ((disp)->DetailTexFuncSGIS) #define SET_DetailTexFuncSGIS(disp, fn) ((disp)->DetailTexFuncSGIS = fn) #define CALL_GetDetailTexFuncSGIS(disp, parameters) (*((disp)->GetDetailTexFuncSGIS)) parameters #define GET_GetDetailTexFuncSGIS(disp) ((disp)->GetDetailTexFuncSGIS) #define SET_GetDetailTexFuncSGIS(disp, fn) ((disp)->GetDetailTexFuncSGIS = fn) #define CALL_SharpenTexFuncSGIS(disp, parameters) (*((disp)->SharpenTexFuncSGIS)) parameters #define GET_SharpenTexFuncSGIS(disp) ((disp)->SharpenTexFuncSGIS) #define SET_SharpenTexFuncSGIS(disp, fn) ((disp)->SharpenTexFuncSGIS = fn) #define CALL_GetSharpenTexFuncSGIS(disp, parameters) (*((disp)->GetSharpenTexFuncSGIS)) parameters #define GET_GetSharpenTexFuncSGIS(disp) ((disp)->GetSharpenTexFuncSGIS) #define SET_GetSharpenTexFuncSGIS(disp, fn) ((disp)->GetSharpenTexFuncSGIS = fn) #define CALL_SampleMaskSGIS(disp, parameters) (*((disp)->SampleMaskSGIS)) parameters #define GET_SampleMaskSGIS(disp) ((disp)->SampleMaskSGIS) #define SET_SampleMaskSGIS(disp, fn) ((disp)->SampleMaskSGIS = fn) #define CALL_SamplePatternSGIS(disp, parameters) (*((disp)->SamplePatternSGIS)) parameters #define GET_SamplePatternSGIS(disp) ((disp)->SamplePatternSGIS) #define SET_SamplePatternSGIS(disp, fn) ((disp)->SamplePatternSGIS = fn) #define CALL_ColorPointerEXT(disp, parameters) (*((disp)->ColorPointerEXT)) parameters #define GET_ColorPointerEXT(disp) ((disp)->ColorPointerEXT) #define SET_ColorPointerEXT(disp, fn) ((disp)->ColorPointerEXT = fn) #define CALL_EdgeFlagPointerEXT(disp, parameters) (*((disp)->EdgeFlagPointerEXT)) parameters #define GET_EdgeFlagPointerEXT(disp) ((disp)->EdgeFlagPointerEXT) #define SET_EdgeFlagPointerEXT(disp, fn) ((disp)->EdgeFlagPointerEXT = fn) #define CALL_IndexPointerEXT(disp, parameters) (*((disp)->IndexPointerEXT)) parameters #define GET_IndexPointerEXT(disp) ((disp)->IndexPointerEXT) #define SET_IndexPointerEXT(disp, fn) ((disp)->IndexPointerEXT = fn) #define CALL_NormalPointerEXT(disp, parameters) (*((disp)->NormalPointerEXT)) parameters #define GET_NormalPointerEXT(disp) ((disp)->NormalPointerEXT) #define SET_NormalPointerEXT(disp, fn) ((disp)->NormalPointerEXT = fn) #define CALL_TexCoordPointerEXT(disp, parameters) (*((disp)->TexCoordPointerEXT)) parameters #define GET_TexCoordPointerEXT(disp) ((disp)->TexCoordPointerEXT) #define SET_TexCoordPointerEXT(disp, fn) ((disp)->TexCoordPointerEXT = fn) #define CALL_VertexPointerEXT(disp, parameters) (*((disp)->VertexPointerEXT)) parameters #define GET_VertexPointerEXT(disp) ((disp)->VertexPointerEXT) #define SET_VertexPointerEXT(disp, fn) ((disp)->VertexPointerEXT = fn) #define CALL_SpriteParameterfSGIX(disp, parameters) (*((disp)->SpriteParameterfSGIX)) parameters #define GET_SpriteParameterfSGIX(disp) ((disp)->SpriteParameterfSGIX) #define SET_SpriteParameterfSGIX(disp, fn) ((disp)->SpriteParameterfSGIX = fn) #define CALL_SpriteParameterfvSGIX(disp, parameters) (*((disp)->SpriteParameterfvSGIX)) parameters #define GET_SpriteParameterfvSGIX(disp) ((disp)->SpriteParameterfvSGIX) #define SET_SpriteParameterfvSGIX(disp, fn) ((disp)->SpriteParameterfvSGIX = fn) #define CALL_SpriteParameteriSGIX(disp, parameters) (*((disp)->SpriteParameteriSGIX)) parameters #define GET_SpriteParameteriSGIX(disp) ((disp)->SpriteParameteriSGIX) #define SET_SpriteParameteriSGIX(disp, fn) ((disp)->SpriteParameteriSGIX = fn) #define CALL_SpriteParameterivSGIX(disp, parameters) (*((disp)->SpriteParameterivSGIX)) parameters #define GET_SpriteParameterivSGIX(disp) ((disp)->SpriteParameterivSGIX) #define SET_SpriteParameterivSGIX(disp, fn) ((disp)->SpriteParameterivSGIX = fn) #define CALL_PointParameterfEXT(disp, parameters) (*((disp)->PointParameterfEXT)) parameters #define GET_PointParameterfEXT(disp) ((disp)->PointParameterfEXT) #define SET_PointParameterfEXT(disp, fn) ((disp)->PointParameterfEXT = fn) #define CALL_PointParameterfvEXT(disp, parameters) (*((disp)->PointParameterfvEXT)) parameters #define GET_PointParameterfvEXT(disp) ((disp)->PointParameterfvEXT) #define SET_PointParameterfvEXT(disp, fn) ((disp)->PointParameterfvEXT = fn) #define CALL_GetInstrumentsSGIX(disp, parameters) (*((disp)->GetInstrumentsSGIX)) parameters #define GET_GetInstrumentsSGIX(disp) ((disp)->GetInstrumentsSGIX) #define SET_GetInstrumentsSGIX(disp, fn) ((disp)->GetInstrumentsSGIX = fn) #define CALL_InstrumentsBufferSGIX(disp, parameters) (*((disp)->InstrumentsBufferSGIX)) parameters #define GET_InstrumentsBufferSGIX(disp) ((disp)->InstrumentsBufferSGIX) #define SET_InstrumentsBufferSGIX(disp, fn) ((disp)->InstrumentsBufferSGIX = fn) #define CALL_PollInstrumentsSGIX(disp, parameters) (*((disp)->PollInstrumentsSGIX)) parameters #define GET_PollInstrumentsSGIX(disp) ((disp)->PollInstrumentsSGIX) #define SET_PollInstrumentsSGIX(disp, fn) ((disp)->PollInstrumentsSGIX = fn) #define CALL_ReadInstrumentsSGIX(disp, parameters) (*((disp)->ReadInstrumentsSGIX)) parameters #define GET_ReadInstrumentsSGIX(disp) ((disp)->ReadInstrumentsSGIX) #define SET_ReadInstrumentsSGIX(disp, fn) ((disp)->ReadInstrumentsSGIX = fn) #define CALL_StartInstrumentsSGIX(disp, parameters) (*((disp)->StartInstrumentsSGIX)) parameters #define GET_StartInstrumentsSGIX(disp) ((disp)->StartInstrumentsSGIX) #define SET_StartInstrumentsSGIX(disp, fn) ((disp)->StartInstrumentsSGIX = fn) #define CALL_StopInstrumentsSGIX(disp, parameters) (*((disp)->StopInstrumentsSGIX)) parameters #define GET_StopInstrumentsSGIX(disp) ((disp)->StopInstrumentsSGIX) #define SET_StopInstrumentsSGIX(disp, fn) ((disp)->StopInstrumentsSGIX = fn) #define CALL_FrameZoomSGIX(disp, parameters) (*((disp)->FrameZoomSGIX)) parameters #define GET_FrameZoomSGIX(disp) ((disp)->FrameZoomSGIX) #define SET_FrameZoomSGIX(disp, fn) ((disp)->FrameZoomSGIX = fn) #define CALL_TagSampleBufferSGIX(disp, parameters) (*((disp)->TagSampleBufferSGIX)) parameters #define GET_TagSampleBufferSGIX(disp) ((disp)->TagSampleBufferSGIX) #define SET_TagSampleBufferSGIX(disp, fn) ((disp)->TagSampleBufferSGIX = fn) #define CALL_ReferencePlaneSGIX(disp, parameters) (*((disp)->ReferencePlaneSGIX)) parameters #define GET_ReferencePlaneSGIX(disp) ((disp)->ReferencePlaneSGIX) #define SET_ReferencePlaneSGIX(disp, fn) ((disp)->ReferencePlaneSGIX = fn) #define CALL_FlushRasterSGIX(disp, parameters) (*((disp)->FlushRasterSGIX)) parameters #define GET_FlushRasterSGIX(disp) ((disp)->FlushRasterSGIX) #define SET_FlushRasterSGIX(disp, fn) ((disp)->FlushRasterSGIX = fn) #define CALL_GetListParameterfvSGIX(disp, parameters) (*((disp)->GetListParameterfvSGIX)) parameters #define GET_GetListParameterfvSGIX(disp) ((disp)->GetListParameterfvSGIX) #define SET_GetListParameterfvSGIX(disp, fn) ((disp)->GetListParameterfvSGIX = fn) #define CALL_GetListParameterivSGIX(disp, parameters) (*((disp)->GetListParameterivSGIX)) parameters #define GET_GetListParameterivSGIX(disp) ((disp)->GetListParameterivSGIX) #define SET_GetListParameterivSGIX(disp, fn) ((disp)->GetListParameterivSGIX = fn) #define CALL_ListParameterfSGIX(disp, parameters) (*((disp)->ListParameterfSGIX)) parameters #define GET_ListParameterfSGIX(disp) ((disp)->ListParameterfSGIX) #define SET_ListParameterfSGIX(disp, fn) ((disp)->ListParameterfSGIX = fn) #define CALL_ListParameterfvSGIX(disp, parameters) (*((disp)->ListParameterfvSGIX)) parameters #define GET_ListParameterfvSGIX(disp) ((disp)->ListParameterfvSGIX) #define SET_ListParameterfvSGIX(disp, fn) ((disp)->ListParameterfvSGIX = fn) #define CALL_ListParameteriSGIX(disp, parameters) (*((disp)->ListParameteriSGIX)) parameters #define GET_ListParameteriSGIX(disp) ((disp)->ListParameteriSGIX) #define SET_ListParameteriSGIX(disp, fn) ((disp)->ListParameteriSGIX = fn) #define CALL_ListParameterivSGIX(disp, parameters) (*((disp)->ListParameterivSGIX)) parameters #define GET_ListParameterivSGIX(disp) ((disp)->ListParameterivSGIX) #define SET_ListParameterivSGIX(disp, fn) ((disp)->ListParameterivSGIX = fn) #define CALL_FragmentColorMaterialSGIX(disp, parameters) (*((disp)->FragmentColorMaterialSGIX)) parameters #define GET_FragmentColorMaterialSGIX(disp) ((disp)->FragmentColorMaterialSGIX) #define SET_FragmentColorMaterialSGIX(disp, fn) ((disp)->FragmentColorMaterialSGIX = fn) #define CALL_FragmentLightfSGIX(disp, parameters) (*((disp)->FragmentLightfSGIX)) parameters #define GET_FragmentLightfSGIX(disp) ((disp)->FragmentLightfSGIX) #define SET_FragmentLightfSGIX(disp, fn) ((disp)->FragmentLightfSGIX = fn) #define CALL_FragmentLightfvSGIX(disp, parameters) (*((disp)->FragmentLightfvSGIX)) parameters #define GET_FragmentLightfvSGIX(disp) ((disp)->FragmentLightfvSGIX) #define SET_FragmentLightfvSGIX(disp, fn) ((disp)->FragmentLightfvSGIX = fn) #define CALL_FragmentLightiSGIX(disp, parameters) (*((disp)->FragmentLightiSGIX)) parameters #define GET_FragmentLightiSGIX(disp) ((disp)->FragmentLightiSGIX) #define SET_FragmentLightiSGIX(disp, fn) ((disp)->FragmentLightiSGIX = fn) #define CALL_FragmentLightivSGIX(disp, parameters) (*((disp)->FragmentLightivSGIX)) parameters #define GET_FragmentLightivSGIX(disp) ((disp)->FragmentLightivSGIX) #define SET_FragmentLightivSGIX(disp, fn) ((disp)->FragmentLightivSGIX = fn) #define CALL_FragmentLightModelfSGIX(disp, parameters) (*((disp)->FragmentLightModelfSGIX)) parameters #define GET_FragmentLightModelfSGIX(disp) ((disp)->FragmentLightModelfSGIX) #define SET_FragmentLightModelfSGIX(disp, fn) ((disp)->FragmentLightModelfSGIX = fn) #define CALL_FragmentLightModelfvSGIX(disp, parameters) (*((disp)->FragmentLightModelfvSGIX)) parameters #define GET_FragmentLightModelfvSGIX(disp) ((disp)->FragmentLightModelfvSGIX) #define SET_FragmentLightModelfvSGIX(disp, fn) ((disp)->FragmentLightModelfvSGIX = fn) #define CALL_FragmentLightModeliSGIX(disp, parameters) (*((disp)->FragmentLightModeliSGIX)) parameters #define GET_FragmentLightModeliSGIX(disp) ((disp)->FragmentLightModeliSGIX) #define SET_FragmentLightModeliSGIX(disp, fn) ((disp)->FragmentLightModeliSGIX = fn) #define CALL_FragmentLightModelivSGIX(disp, parameters) (*((disp)->FragmentLightModelivSGIX)) parameters #define GET_FragmentLightModelivSGIX(disp) ((disp)->FragmentLightModelivSGIX) #define SET_FragmentLightModelivSGIX(disp, fn) ((disp)->FragmentLightModelivSGIX = fn) #define CALL_FragmentMaterialfSGIX(disp, parameters) (*((disp)->FragmentMaterialfSGIX)) parameters #define GET_FragmentMaterialfSGIX(disp) ((disp)->FragmentMaterialfSGIX) #define SET_FragmentMaterialfSGIX(disp, fn) ((disp)->FragmentMaterialfSGIX = fn) #define CALL_FragmentMaterialfvSGIX(disp, parameters) (*((disp)->FragmentMaterialfvSGIX)) parameters #define GET_FragmentMaterialfvSGIX(disp) ((disp)->FragmentMaterialfvSGIX) #define SET_FragmentMaterialfvSGIX(disp, fn) ((disp)->FragmentMaterialfvSGIX = fn) #define CALL_FragmentMaterialiSGIX(disp, parameters) (*((disp)->FragmentMaterialiSGIX)) parameters #define GET_FragmentMaterialiSGIX(disp) ((disp)->FragmentMaterialiSGIX) #define SET_FragmentMaterialiSGIX(disp, fn) ((disp)->FragmentMaterialiSGIX = fn) #define CALL_FragmentMaterialivSGIX(disp, parameters) (*((disp)->FragmentMaterialivSGIX)) parameters #define GET_FragmentMaterialivSGIX(disp) ((disp)->FragmentMaterialivSGIX) #define SET_FragmentMaterialivSGIX(disp, fn) ((disp)->FragmentMaterialivSGIX = fn) #define CALL_GetFragmentLightfvSGIX(disp, parameters) (*((disp)->GetFragmentLightfvSGIX)) parameters #define GET_GetFragmentLightfvSGIX(disp) ((disp)->GetFragmentLightfvSGIX) #define SET_GetFragmentLightfvSGIX(disp, fn) ((disp)->GetFragmentLightfvSGIX = fn) #define CALL_GetFragmentLightivSGIX(disp, parameters) (*((disp)->GetFragmentLightivSGIX)) parameters #define GET_GetFragmentLightivSGIX(disp) ((disp)->GetFragmentLightivSGIX) #define SET_GetFragmentLightivSGIX(disp, fn) ((disp)->GetFragmentLightivSGIX = fn) #define CALL_GetFragmentMaterialfvSGIX(disp, parameters) (*((disp)->GetFragmentMaterialfvSGIX)) parameters #define GET_GetFragmentMaterialfvSGIX(disp) ((disp)->GetFragmentMaterialfvSGIX) #define SET_GetFragmentMaterialfvSGIX(disp, fn) ((disp)->GetFragmentMaterialfvSGIX = fn) #define CALL_GetFragmentMaterialivSGIX(disp, parameters) (*((disp)->GetFragmentMaterialivSGIX)) parameters #define GET_GetFragmentMaterialivSGIX(disp) ((disp)->GetFragmentMaterialivSGIX) #define SET_GetFragmentMaterialivSGIX(disp, fn) ((disp)->GetFragmentMaterialivSGIX = fn) #define CALL_LightEnviSGIX(disp, parameters) (*((disp)->LightEnviSGIX)) parameters #define GET_LightEnviSGIX(disp) ((disp)->LightEnviSGIX) #define SET_LightEnviSGIX(disp, fn) ((disp)->LightEnviSGIX = fn) #define CALL_VertexWeightfEXT(disp, parameters) (*((disp)->VertexWeightfEXT)) parameters #define GET_VertexWeightfEXT(disp) ((disp)->VertexWeightfEXT) #define SET_VertexWeightfEXT(disp, fn) ((disp)->VertexWeightfEXT = fn) #define CALL_VertexWeightfvEXT(disp, parameters) (*((disp)->VertexWeightfvEXT)) parameters #define GET_VertexWeightfvEXT(disp) ((disp)->VertexWeightfvEXT) #define SET_VertexWeightfvEXT(disp, fn) ((disp)->VertexWeightfvEXT = fn) #define CALL_VertexWeightPointerEXT(disp, parameters) (*((disp)->VertexWeightPointerEXT)) parameters #define GET_VertexWeightPointerEXT(disp) ((disp)->VertexWeightPointerEXT) #define SET_VertexWeightPointerEXT(disp, fn) ((disp)->VertexWeightPointerEXT = fn) #define CALL_FlushVertexArrayRangeNV(disp, parameters) (*((disp)->FlushVertexArrayRangeNV)) parameters #define GET_FlushVertexArrayRangeNV(disp) ((disp)->FlushVertexArrayRangeNV) #define SET_FlushVertexArrayRangeNV(disp, fn) ((disp)->FlushVertexArrayRangeNV = fn) #define CALL_VertexArrayRangeNV(disp, parameters) (*((disp)->VertexArrayRangeNV)) parameters #define GET_VertexArrayRangeNV(disp) ((disp)->VertexArrayRangeNV) #define SET_VertexArrayRangeNV(disp, fn) ((disp)->VertexArrayRangeNV = fn) #define CALL_CombinerParameterfvNV(disp, parameters) (*((disp)->CombinerParameterfvNV)) parameters #define GET_CombinerParameterfvNV(disp) ((disp)->CombinerParameterfvNV) #define SET_CombinerParameterfvNV(disp, fn) ((disp)->CombinerParameterfvNV = fn) #define CALL_CombinerParameterfNV(disp, parameters) (*((disp)->CombinerParameterfNV)) parameters #define GET_CombinerParameterfNV(disp) ((disp)->CombinerParameterfNV) #define SET_CombinerParameterfNV(disp, fn) ((disp)->CombinerParameterfNV = fn) #define CALL_CombinerParameterivNV(disp, parameters) (*((disp)->CombinerParameterivNV)) parameters #define GET_CombinerParameterivNV(disp) ((disp)->CombinerParameterivNV) #define SET_CombinerParameterivNV(disp, fn) ((disp)->CombinerParameterivNV = fn) #define CALL_CombinerParameteriNV(disp, parameters) (*((disp)->CombinerParameteriNV)) parameters #define GET_CombinerParameteriNV(disp) ((disp)->CombinerParameteriNV) #define SET_CombinerParameteriNV(disp, fn) ((disp)->CombinerParameteriNV = fn) #define CALL_CombinerInputNV(disp, parameters) (*((disp)->CombinerInputNV)) parameters #define GET_CombinerInputNV(disp) ((disp)->CombinerInputNV) #define SET_CombinerInputNV(disp, fn) ((disp)->CombinerInputNV = fn) #define CALL_CombinerOutputNV(disp, parameters) (*((disp)->CombinerOutputNV)) parameters #define GET_CombinerOutputNV(disp) ((disp)->CombinerOutputNV) #define SET_CombinerOutputNV(disp, fn) ((disp)->CombinerOutputNV = fn) #define CALL_FinalCombinerInputNV(disp, parameters) (*((disp)->FinalCombinerInputNV)) parameters #define GET_FinalCombinerInputNV(disp) ((disp)->FinalCombinerInputNV) #define SET_FinalCombinerInputNV(disp, fn) ((disp)->FinalCombinerInputNV = fn) #define CALL_GetCombinerInputParameterfvNV(disp, parameters) (*((disp)->GetCombinerInputParameterfvNV)) parameters #define GET_GetCombinerInputParameterfvNV(disp) ((disp)->GetCombinerInputParameterfvNV) #define SET_GetCombinerInputParameterfvNV(disp, fn) ((disp)->GetCombinerInputParameterfvNV = fn) #define CALL_GetCombinerInputParameterivNV(disp, parameters) (*((disp)->GetCombinerInputParameterivNV)) parameters #define GET_GetCombinerInputParameterivNV(disp) ((disp)->GetCombinerInputParameterivNV) #define SET_GetCombinerInputParameterivNV(disp, fn) ((disp)->GetCombinerInputParameterivNV = fn) #define CALL_GetCombinerOutputParameterfvNV(disp, parameters) (*((disp)->GetCombinerOutputParameterfvNV)) parameters #define GET_GetCombinerOutputParameterfvNV(disp) ((disp)->GetCombinerOutputParameterfvNV) #define SET_GetCombinerOutputParameterfvNV(disp, fn) ((disp)->GetCombinerOutputParameterfvNV = fn) #define CALL_GetCombinerOutputParameterivNV(disp, parameters) (*((disp)->GetCombinerOutputParameterivNV)) parameters #define GET_GetCombinerOutputParameterivNV(disp) ((disp)->GetCombinerOutputParameterivNV) #define SET_GetCombinerOutputParameterivNV(disp, fn) ((disp)->GetCombinerOutputParameterivNV = fn) #define CALL_GetFinalCombinerInputParameterfvNV(disp, parameters) (*((disp)->GetFinalCombinerInputParameterfvNV)) parameters #define GET_GetFinalCombinerInputParameterfvNV(disp) ((disp)->GetFinalCombinerInputParameterfvNV) #define SET_GetFinalCombinerInputParameterfvNV(disp, fn) ((disp)->GetFinalCombinerInputParameterfvNV = fn) #define CALL_GetFinalCombinerInputParameterivNV(disp, parameters) (*((disp)->GetFinalCombinerInputParameterivNV)) parameters #define GET_GetFinalCombinerInputParameterivNV(disp) ((disp)->GetFinalCombinerInputParameterivNV) #define SET_GetFinalCombinerInputParameterivNV(disp, fn) ((disp)->GetFinalCombinerInputParameterivNV = fn) #define CALL_ResizeBuffersMESA(disp, parameters) (*((disp)->ResizeBuffersMESA)) parameters #define GET_ResizeBuffersMESA(disp) ((disp)->ResizeBuffersMESA) #define SET_ResizeBuffersMESA(disp, fn) ((disp)->ResizeBuffersMESA = fn) #define CALL_WindowPos2dMESA(disp, parameters) (*((disp)->WindowPos2dMESA)) parameters #define GET_WindowPos2dMESA(disp) ((disp)->WindowPos2dMESA) #define SET_WindowPos2dMESA(disp, fn) ((disp)->WindowPos2dMESA = fn) #define CALL_WindowPos2dvMESA(disp, parameters) (*((disp)->WindowPos2dvMESA)) parameters #define GET_WindowPos2dvMESA(disp) ((disp)->WindowPos2dvMESA) #define SET_WindowPos2dvMESA(disp, fn) ((disp)->WindowPos2dvMESA = fn) #define CALL_WindowPos2fMESA(disp, parameters) (*((disp)->WindowPos2fMESA)) parameters #define GET_WindowPos2fMESA(disp) ((disp)->WindowPos2fMESA) #define SET_WindowPos2fMESA(disp, fn) ((disp)->WindowPos2fMESA = fn) #define CALL_WindowPos2fvMESA(disp, parameters) (*((disp)->WindowPos2fvMESA)) parameters #define GET_WindowPos2fvMESA(disp) ((disp)->WindowPos2fvMESA) #define SET_WindowPos2fvMESA(disp, fn) ((disp)->WindowPos2fvMESA = fn) #define CALL_WindowPos2iMESA(disp, parameters) (*((disp)->WindowPos2iMESA)) parameters #define GET_WindowPos2iMESA(disp) ((disp)->WindowPos2iMESA) #define SET_WindowPos2iMESA(disp, fn) ((disp)->WindowPos2iMESA = fn) #define CALL_WindowPos2ivMESA(disp, parameters) (*((disp)->WindowPos2ivMESA)) parameters #define GET_WindowPos2ivMESA(disp) ((disp)->WindowPos2ivMESA) #define SET_WindowPos2ivMESA(disp, fn) ((disp)->WindowPos2ivMESA = fn) #define CALL_WindowPos2sMESA(disp, parameters) (*((disp)->WindowPos2sMESA)) parameters #define GET_WindowPos2sMESA(disp) ((disp)->WindowPos2sMESA) #define SET_WindowPos2sMESA(disp, fn) ((disp)->WindowPos2sMESA = fn) #define CALL_WindowPos2svMESA(disp, parameters) (*((disp)->WindowPos2svMESA)) parameters #define GET_WindowPos2svMESA(disp) ((disp)->WindowPos2svMESA) #define SET_WindowPos2svMESA(disp, fn) ((disp)->WindowPos2svMESA = fn) #define CALL_WindowPos3dMESA(disp, parameters) (*((disp)->WindowPos3dMESA)) parameters #define GET_WindowPos3dMESA(disp) ((disp)->WindowPos3dMESA) #define SET_WindowPos3dMESA(disp, fn) ((disp)->WindowPos3dMESA = fn) #define CALL_WindowPos3dvMESA(disp, parameters) (*((disp)->WindowPos3dvMESA)) parameters #define GET_WindowPos3dvMESA(disp) ((disp)->WindowPos3dvMESA) #define SET_WindowPos3dvMESA(disp, fn) ((disp)->WindowPos3dvMESA = fn) #define CALL_WindowPos3fMESA(disp, parameters) (*((disp)->WindowPos3fMESA)) parameters #define GET_WindowPos3fMESA(disp) ((disp)->WindowPos3fMESA) #define SET_WindowPos3fMESA(disp, fn) ((disp)->WindowPos3fMESA = fn) #define CALL_WindowPos3fvMESA(disp, parameters) (*((disp)->WindowPos3fvMESA)) parameters #define GET_WindowPos3fvMESA(disp) ((disp)->WindowPos3fvMESA) #define SET_WindowPos3fvMESA(disp, fn) ((disp)->WindowPos3fvMESA = fn) #define CALL_WindowPos3iMESA(disp, parameters) (*((disp)->WindowPos3iMESA)) parameters #define GET_WindowPos3iMESA(disp) ((disp)->WindowPos3iMESA) #define SET_WindowPos3iMESA(disp, fn) ((disp)->WindowPos3iMESA = fn) #define CALL_WindowPos3ivMESA(disp, parameters) (*((disp)->WindowPos3ivMESA)) parameters #define GET_WindowPos3ivMESA(disp) ((disp)->WindowPos3ivMESA) #define SET_WindowPos3ivMESA(disp, fn) ((disp)->WindowPos3ivMESA = fn) #define CALL_WindowPos3sMESA(disp, parameters) (*((disp)->WindowPos3sMESA)) parameters #define GET_WindowPos3sMESA(disp) ((disp)->WindowPos3sMESA) #define SET_WindowPos3sMESA(disp, fn) ((disp)->WindowPos3sMESA = fn) #define CALL_WindowPos3svMESA(disp, parameters) (*((disp)->WindowPos3svMESA)) parameters #define GET_WindowPos3svMESA(disp) ((disp)->WindowPos3svMESA) #define SET_WindowPos3svMESA(disp, fn) ((disp)->WindowPos3svMESA = fn) #define CALL_WindowPos4dMESA(disp, parameters) (*((disp)->WindowPos4dMESA)) parameters #define GET_WindowPos4dMESA(disp) ((disp)->WindowPos4dMESA) #define SET_WindowPos4dMESA(disp, fn) ((disp)->WindowPos4dMESA = fn) #define CALL_WindowPos4dvMESA(disp, parameters) (*((disp)->WindowPos4dvMESA)) parameters #define GET_WindowPos4dvMESA(disp) ((disp)->WindowPos4dvMESA) #define SET_WindowPos4dvMESA(disp, fn) ((disp)->WindowPos4dvMESA = fn) #define CALL_WindowPos4fMESA(disp, parameters) (*((disp)->WindowPos4fMESA)) parameters #define GET_WindowPos4fMESA(disp) ((disp)->WindowPos4fMESA) #define SET_WindowPos4fMESA(disp, fn) ((disp)->WindowPos4fMESA = fn) #define CALL_WindowPos4fvMESA(disp, parameters) (*((disp)->WindowPos4fvMESA)) parameters #define GET_WindowPos4fvMESA(disp) ((disp)->WindowPos4fvMESA) #define SET_WindowPos4fvMESA(disp, fn) ((disp)->WindowPos4fvMESA = fn) #define CALL_WindowPos4iMESA(disp, parameters) (*((disp)->WindowPos4iMESA)) parameters #define GET_WindowPos4iMESA(disp) ((disp)->WindowPos4iMESA) #define SET_WindowPos4iMESA(disp, fn) ((disp)->WindowPos4iMESA = fn) #define CALL_WindowPos4ivMESA(disp, parameters) (*((disp)->WindowPos4ivMESA)) parameters #define GET_WindowPos4ivMESA(disp) ((disp)->WindowPos4ivMESA) #define SET_WindowPos4ivMESA(disp, fn) ((disp)->WindowPos4ivMESA = fn) #define CALL_WindowPos4sMESA(disp, parameters) (*((disp)->WindowPos4sMESA)) parameters #define GET_WindowPos4sMESA(disp) ((disp)->WindowPos4sMESA) #define SET_WindowPos4sMESA(disp, fn) ((disp)->WindowPos4sMESA = fn) #define CALL_WindowPos4svMESA(disp, parameters) (*((disp)->WindowPos4svMESA)) parameters #define GET_WindowPos4svMESA(disp) ((disp)->WindowPos4svMESA) #define SET_WindowPos4svMESA(disp, fn) ((disp)->WindowPos4svMESA = fn) #define CALL_BlendFuncSeparateEXT(disp, parameters) (*((disp)->BlendFuncSeparateEXT)) parameters #define GET_BlendFuncSeparateEXT(disp) ((disp)->BlendFuncSeparateEXT) #define SET_BlendFuncSeparateEXT(disp, fn) ((disp)->BlendFuncSeparateEXT = fn) #define CALL_IndexMaterialEXT(disp, parameters) (*((disp)->IndexMaterialEXT)) parameters #define GET_IndexMaterialEXT(disp) ((disp)->IndexMaterialEXT) #define SET_IndexMaterialEXT(disp, fn) ((disp)->IndexMaterialEXT = fn) #define CALL_IndexFuncEXT(disp, parameters) (*((disp)->IndexFuncEXT)) parameters #define GET_IndexFuncEXT(disp) ((disp)->IndexFuncEXT) #define SET_IndexFuncEXT(disp, fn) ((disp)->IndexFuncEXT = fn) #define CALL_LockArraysEXT(disp, parameters) (*((disp)->LockArraysEXT)) parameters #define GET_LockArraysEXT(disp) ((disp)->LockArraysEXT) #define SET_LockArraysEXT(disp, fn) ((disp)->LockArraysEXT = fn) #define CALL_UnlockArraysEXT(disp, parameters) (*((disp)->UnlockArraysEXT)) parameters #define GET_UnlockArraysEXT(disp) ((disp)->UnlockArraysEXT) #define SET_UnlockArraysEXT(disp, fn) ((disp)->UnlockArraysEXT = fn) #define CALL_CullParameterdvEXT(disp, parameters) (*((disp)->CullParameterdvEXT)) parameters #define GET_CullParameterdvEXT(disp) ((disp)->CullParameterdvEXT) #define SET_CullParameterdvEXT(disp, fn) ((disp)->CullParameterdvEXT = fn) #define CALL_CullParameterfvEXT(disp, parameters) (*((disp)->CullParameterfvEXT)) parameters #define GET_CullParameterfvEXT(disp) ((disp)->CullParameterfvEXT) #define SET_CullParameterfvEXT(disp, fn) ((disp)->CullParameterfvEXT = fn) #define CALL_HintPGI(disp, parameters) (*((disp)->HintPGI)) parameters #define GET_HintPGI(disp) ((disp)->HintPGI) #define SET_HintPGI(disp, fn) ((disp)->HintPGI = fn) #define CALL_FogCoordfEXT(disp, parameters) (*((disp)->FogCoordfEXT)) parameters #define GET_FogCoordfEXT(disp) ((disp)->FogCoordfEXT) #define SET_FogCoordfEXT(disp, fn) ((disp)->FogCoordfEXT = fn) #define CALL_FogCoordfvEXT(disp, parameters) (*((disp)->FogCoordfvEXT)) parameters #define GET_FogCoordfvEXT(disp) ((disp)->FogCoordfvEXT) #define SET_FogCoordfvEXT(disp, fn) ((disp)->FogCoordfvEXT = fn) #define CALL_FogCoorddEXT(disp, parameters) (*((disp)->FogCoorddEXT)) parameters #define GET_FogCoorddEXT(disp) ((disp)->FogCoorddEXT) #define SET_FogCoorddEXT(disp, fn) ((disp)->FogCoorddEXT = fn) #define CALL_FogCoorddvEXT(disp, parameters) (*((disp)->FogCoorddvEXT)) parameters #define GET_FogCoorddvEXT(disp) ((disp)->FogCoorddvEXT) #define SET_FogCoorddvEXT(disp, fn) ((disp)->FogCoorddvEXT = fn) #define CALL_FogCoordPointerEXT(disp, parameters) (*((disp)->FogCoordPointerEXT)) parameters #define GET_FogCoordPointerEXT(disp) ((disp)->FogCoordPointerEXT) #define SET_FogCoordPointerEXT(disp, fn) ((disp)->FogCoordPointerEXT = fn) #define CALL_GetColorTableEXT(disp, parameters) (*((disp)->GetColorTableEXT)) parameters #define GET_GetColorTableEXT(disp) ((disp)->GetColorTableEXT) #define SET_GetColorTableEXT(disp, fn) ((disp)->GetColorTableEXT = fn) #define CALL_GetColorTableParameterivEXT(disp, parameters) (*((disp)->GetColorTableParameterivEXT)) parameters #define GET_GetColorTableParameterivEXT(disp) ((disp)->GetColorTableParameterivEXT) #define SET_GetColorTableParameterivEXT(disp, fn) ((disp)->GetColorTableParameterivEXT = fn) #define CALL_GetColorTableParameterfvEXT(disp, parameters) (*((disp)->GetColorTableParameterfvEXT)) parameters #define GET_GetColorTableParameterfvEXT(disp) ((disp)->GetColorTableParameterfvEXT) #define SET_GetColorTableParameterfvEXT(disp, fn) ((disp)->GetColorTableParameterfvEXT = fn) #define CALL_TbufferMask3DFX(disp, parameters) (*((disp)->TbufferMask3DFX)) parameters #define GET_TbufferMask3DFX(disp) ((disp)->TbufferMask3DFX) #define SET_TbufferMask3DFX(disp, fn) ((disp)->TbufferMask3DFX = fn) #define CALL_CompressedTexImage3DARB(disp, parameters) (*((disp)->CompressedTexImage3DARB)) parameters #define GET_CompressedTexImage3DARB(disp) ((disp)->CompressedTexImage3DARB) #define SET_CompressedTexImage3DARB(disp, fn) ((disp)->CompressedTexImage3DARB = fn) #define CALL_CompressedTexImage2DARB(disp, parameters) (*((disp)->CompressedTexImage2DARB)) parameters #define GET_CompressedTexImage2DARB(disp) ((disp)->CompressedTexImage2DARB) #define SET_CompressedTexImage2DARB(disp, fn) ((disp)->CompressedTexImage2DARB = fn) #define CALL_CompressedTexImage1DARB(disp, parameters) (*((disp)->CompressedTexImage1DARB)) parameters #define GET_CompressedTexImage1DARB(disp) ((disp)->CompressedTexImage1DARB) #define SET_CompressedTexImage1DARB(disp, fn) ((disp)->CompressedTexImage1DARB = fn) #define CALL_CompressedTexSubImage3DARB(disp, parameters) (*((disp)->CompressedTexSubImage3DARB)) parameters #define GET_CompressedTexSubImage3DARB(disp) ((disp)->CompressedTexSubImage3DARB) #define SET_CompressedTexSubImage3DARB(disp, fn) ((disp)->CompressedTexSubImage3DARB = fn) #define CALL_CompressedTexSubImage2DARB(disp, parameters) (*((disp)->CompressedTexSubImage2DARB)) parameters #define GET_CompressedTexSubImage2DARB(disp) ((disp)->CompressedTexSubImage2DARB) #define SET_CompressedTexSubImage2DARB(disp, fn) ((disp)->CompressedTexSubImage2DARB = fn) #define CALL_CompressedTexSubImage1DARB(disp, parameters) (*((disp)->CompressedTexSubImage1DARB)) parameters #define GET_CompressedTexSubImage1DARB(disp) ((disp)->CompressedTexSubImage1DARB) #define SET_CompressedTexSubImage1DARB(disp, fn) ((disp)->CompressedTexSubImage1DARB = fn) #define CALL_GetCompressedTexImageARB(disp, parameters) (*((disp)->GetCompressedTexImageARB)) parameters #define GET_GetCompressedTexImageARB(disp) ((disp)->GetCompressedTexImageARB) #define SET_GetCompressedTexImageARB(disp, fn) ((disp)->GetCompressedTexImageARB = fn) #define CALL_SecondaryColor3bEXT(disp, parameters) (*((disp)->SecondaryColor3bEXT)) parameters #define GET_SecondaryColor3bEXT(disp) ((disp)->SecondaryColor3bEXT) #define SET_SecondaryColor3bEXT(disp, fn) ((disp)->SecondaryColor3bEXT = fn) #define CALL_SecondaryColor3bvEXT(disp, parameters) (*((disp)->SecondaryColor3bvEXT)) parameters #define GET_SecondaryColor3bvEXT(disp) ((disp)->SecondaryColor3bvEXT) #define SET_SecondaryColor3bvEXT(disp, fn) ((disp)->SecondaryColor3bvEXT = fn) #define CALL_SecondaryColor3dEXT(disp, parameters) (*((disp)->SecondaryColor3dEXT)) parameters #define GET_SecondaryColor3dEXT(disp) ((disp)->SecondaryColor3dEXT) #define SET_SecondaryColor3dEXT(disp, fn) ((disp)->SecondaryColor3dEXT = fn) #define CALL_SecondaryColor3dvEXT(disp, parameters) (*((disp)->SecondaryColor3dvEXT)) parameters #define GET_SecondaryColor3dvEXT(disp) ((disp)->SecondaryColor3dvEXT) #define SET_SecondaryColor3dvEXT(disp, fn) ((disp)->SecondaryColor3dvEXT = fn) #define CALL_SecondaryColor3fEXT(disp, parameters) (*((disp)->SecondaryColor3fEXT)) parameters #define GET_SecondaryColor3fEXT(disp) ((disp)->SecondaryColor3fEXT) #define SET_SecondaryColor3fEXT(disp, fn) ((disp)->SecondaryColor3fEXT = fn) #define CALL_SecondaryColor3fvEXT(disp, parameters) (*((disp)->SecondaryColor3fvEXT)) parameters #define GET_SecondaryColor3fvEXT(disp) ((disp)->SecondaryColor3fvEXT) #define SET_SecondaryColor3fvEXT(disp, fn) ((disp)->SecondaryColor3fvEXT = fn) #define CALL_SecondaryColor3iEXT(disp, parameters) (*((disp)->SecondaryColor3iEXT)) parameters #define GET_SecondaryColor3iEXT(disp) ((disp)->SecondaryColor3iEXT) #define SET_SecondaryColor3iEXT(disp, fn) ((disp)->SecondaryColor3iEXT = fn) #define CALL_SecondaryColor3ivEXT(disp, parameters) (*((disp)->SecondaryColor3ivEXT)) parameters #define GET_SecondaryColor3ivEXT(disp) ((disp)->SecondaryColor3ivEXT) #define SET_SecondaryColor3ivEXT(disp, fn) ((disp)->SecondaryColor3ivEXT = fn) #define CALL_SecondaryColor3sEXT(disp, parameters) (*((disp)->SecondaryColor3sEXT)) parameters #define GET_SecondaryColor3sEXT(disp) ((disp)->SecondaryColor3sEXT) #define SET_SecondaryColor3sEXT(disp, fn) ((disp)->SecondaryColor3sEXT = fn) #define CALL_SecondaryColor3svEXT(disp, parameters) (*((disp)->SecondaryColor3svEXT)) parameters #define GET_SecondaryColor3svEXT(disp) ((disp)->SecondaryColor3svEXT) #define SET_SecondaryColor3svEXT(disp, fn) ((disp)->SecondaryColor3svEXT = fn) #define CALL_SecondaryColor3ubEXT(disp, parameters) (*((disp)->SecondaryColor3ubEXT)) parameters #define GET_SecondaryColor3ubEXT(disp) ((disp)->SecondaryColor3ubEXT) #define SET_SecondaryColor3ubEXT(disp, fn) ((disp)->SecondaryColor3ubEXT = fn) #define CALL_SecondaryColor3ubvEXT(disp, parameters) (*((disp)->SecondaryColor3ubvEXT)) parameters #define GET_SecondaryColor3ubvEXT(disp) ((disp)->SecondaryColor3ubvEXT) #define SET_SecondaryColor3ubvEXT(disp, fn) ((disp)->SecondaryColor3ubvEXT = fn) #define CALL_SecondaryColor3uiEXT(disp, parameters) (*((disp)->SecondaryColor3uiEXT)) parameters #define GET_SecondaryColor3uiEXT(disp) ((disp)->SecondaryColor3uiEXT) #define SET_SecondaryColor3uiEXT(disp, fn) ((disp)->SecondaryColor3uiEXT = fn) #define CALL_SecondaryColor3uivEXT(disp, parameters) (*((disp)->SecondaryColor3uivEXT)) parameters #define GET_SecondaryColor3uivEXT(disp) ((disp)->SecondaryColor3uivEXT) #define SET_SecondaryColor3uivEXT(disp, fn) ((disp)->SecondaryColor3uivEXT = fn) #define CALL_SecondaryColor3usEXT(disp, parameters) (*((disp)->SecondaryColor3usEXT)) parameters #define GET_SecondaryColor3usEXT(disp) ((disp)->SecondaryColor3usEXT) #define SET_SecondaryColor3usEXT(disp, fn) ((disp)->SecondaryColor3usEXT = fn) #define CALL_SecondaryColor3usvEXT(disp, parameters) (*((disp)->SecondaryColor3usvEXT)) parameters #define GET_SecondaryColor3usvEXT(disp) ((disp)->SecondaryColor3usvEXT) #define SET_SecondaryColor3usvEXT(disp, fn) ((disp)->SecondaryColor3usvEXT = fn) #define CALL_SecondaryColorPointerEXT(disp, parameters) (*((disp)->SecondaryColorPointerEXT)) parameters #define GET_SecondaryColorPointerEXT(disp) ((disp)->SecondaryColorPointerEXT) #define SET_SecondaryColorPointerEXT(disp, fn) ((disp)->SecondaryColorPointerEXT = fn) #define CALL_AreProgramsResidentNV(disp, parameters) (*((disp)->AreProgramsResidentNV)) parameters #define GET_AreProgramsResidentNV(disp) ((disp)->AreProgramsResidentNV) #define SET_AreProgramsResidentNV(disp, fn) ((disp)->AreProgramsResidentNV = fn) #define CALL_BindProgramNV(disp, parameters) (*((disp)->BindProgramNV)) parameters #define GET_BindProgramNV(disp) ((disp)->BindProgramNV) #define SET_BindProgramNV(disp, fn) ((disp)->BindProgramNV = fn) #define CALL_DeleteProgramsNV(disp, parameters) (*((disp)->DeleteProgramsNV)) parameters #define GET_DeleteProgramsNV(disp) ((disp)->DeleteProgramsNV) #define SET_DeleteProgramsNV(disp, fn) ((disp)->DeleteProgramsNV = fn) #define CALL_ExecuteProgramNV(disp, parameters) (*((disp)->ExecuteProgramNV)) parameters #define GET_ExecuteProgramNV(disp) ((disp)->ExecuteProgramNV) #define SET_ExecuteProgramNV(disp, fn) ((disp)->ExecuteProgramNV = fn) #define CALL_GenProgramsNV(disp, parameters) (*((disp)->GenProgramsNV)) parameters #define GET_GenProgramsNV(disp) ((disp)->GenProgramsNV) #define SET_GenProgramsNV(disp, fn) ((disp)->GenProgramsNV = fn) #define CALL_GetProgramParameterdvNV(disp, parameters) (*((disp)->GetProgramParameterdvNV)) parameters #define GET_GetProgramParameterdvNV(disp) ((disp)->GetProgramParameterdvNV) #define SET_GetProgramParameterdvNV(disp, fn) ((disp)->GetProgramParameterdvNV = fn) #define CALL_GetProgramParameterfvNV(disp, parameters) (*((disp)->GetProgramParameterfvNV)) parameters #define GET_GetProgramParameterfvNV(disp) ((disp)->GetProgramParameterfvNV) #define SET_GetProgramParameterfvNV(disp, fn) ((disp)->GetProgramParameterfvNV = fn) #define CALL_GetProgramivNV(disp, parameters) (*((disp)->GetProgramivNV)) parameters #define GET_GetProgramivNV(disp) ((disp)->GetProgramivNV) #define SET_GetProgramivNV(disp, fn) ((disp)->GetProgramivNV = fn) #define CALL_GetProgramStringNV(disp, parameters) (*((disp)->GetProgramStringNV)) parameters #define GET_GetProgramStringNV(disp) ((disp)->GetProgramStringNV) #define SET_GetProgramStringNV(disp, fn) ((disp)->GetProgramStringNV = fn) #define CALL_GetTrackMatrixivNV(disp, parameters) (*((disp)->GetTrackMatrixivNV)) parameters #define GET_GetTrackMatrixivNV(disp) ((disp)->GetTrackMatrixivNV) #define SET_GetTrackMatrixivNV(disp, fn) ((disp)->GetTrackMatrixivNV = fn) #define CALL_GetVertexAttribdvARB(disp, parameters) (*((disp)->GetVertexAttribdvARB)) parameters #define GET_GetVertexAttribdvARB(disp) ((disp)->GetVertexAttribdvARB) #define SET_GetVertexAttribdvARB(disp, fn) ((disp)->GetVertexAttribdvARB = fn) #define CALL_GetVertexAttribfvARB(disp, parameters) (*((disp)->GetVertexAttribfvARB)) parameters #define GET_GetVertexAttribfvARB(disp) ((disp)->GetVertexAttribfvARB) #define SET_GetVertexAttribfvARB(disp, fn) ((disp)->GetVertexAttribfvARB = fn) #define CALL_GetVertexAttribivARB(disp, parameters) (*((disp)->GetVertexAttribivARB)) parameters #define GET_GetVertexAttribivARB(disp) ((disp)->GetVertexAttribivARB) #define SET_GetVertexAttribivARB(disp, fn) ((disp)->GetVertexAttribivARB = fn) #define CALL_GetVertexAttribPointervNV(disp, parameters) (*((disp)->GetVertexAttribPointervNV)) parameters #define GET_GetVertexAttribPointervNV(disp) ((disp)->GetVertexAttribPointervNV) #define SET_GetVertexAttribPointervNV(disp, fn) ((disp)->GetVertexAttribPointervNV = fn) #define CALL_IsProgramNV(disp, parameters) (*((disp)->IsProgramNV)) parameters #define GET_IsProgramNV(disp) ((disp)->IsProgramNV) #define SET_IsProgramNV(disp, fn) ((disp)->IsProgramNV = fn) #define CALL_LoadProgramNV(disp, parameters) (*((disp)->LoadProgramNV)) parameters #define GET_LoadProgramNV(disp) ((disp)->LoadProgramNV) #define SET_LoadProgramNV(disp, fn) ((disp)->LoadProgramNV = fn) #define CALL_ProgramParameter4dNV(disp, parameters) (*((disp)->ProgramParameter4dNV)) parameters #define GET_ProgramParameter4dNV(disp) ((disp)->ProgramParameter4dNV) #define SET_ProgramParameter4dNV(disp, fn) ((disp)->ProgramParameter4dNV = fn) #define CALL_ProgramParameter4dvNV(disp, parameters) (*((disp)->ProgramParameter4dvNV)) parameters #define GET_ProgramParameter4dvNV(disp) ((disp)->ProgramParameter4dvNV) #define SET_ProgramParameter4dvNV(disp, fn) ((disp)->ProgramParameter4dvNV = fn) #define CALL_ProgramParameter4fNV(disp, parameters) (*((disp)->ProgramParameter4fNV)) parameters #define GET_ProgramParameter4fNV(disp) ((disp)->ProgramParameter4fNV) #define SET_ProgramParameter4fNV(disp, fn) ((disp)->ProgramParameter4fNV = fn) #define CALL_ProgramParameter4fvNV(disp, parameters) (*((disp)->ProgramParameter4fvNV)) parameters #define GET_ProgramParameter4fvNV(disp) ((disp)->ProgramParameter4fvNV) #define SET_ProgramParameter4fvNV(disp, fn) ((disp)->ProgramParameter4fvNV = fn) #define CALL_ProgramParameters4dvNV(disp, parameters) (*((disp)->ProgramParameters4dvNV)) parameters #define GET_ProgramParameters4dvNV(disp) ((disp)->ProgramParameters4dvNV) #define SET_ProgramParameters4dvNV(disp, fn) ((disp)->ProgramParameters4dvNV = fn) #define CALL_ProgramParameters4fvNV(disp, parameters) (*((disp)->ProgramParameters4fvNV)) parameters #define GET_ProgramParameters4fvNV(disp) ((disp)->ProgramParameters4fvNV) #define SET_ProgramParameters4fvNV(disp, fn) ((disp)->ProgramParameters4fvNV = fn) #define CALL_RequestResidentProgramsNV(disp, parameters) (*((disp)->RequestResidentProgramsNV)) parameters #define GET_RequestResidentProgramsNV(disp) ((disp)->RequestResidentProgramsNV) #define SET_RequestResidentProgramsNV(disp, fn) ((disp)->RequestResidentProgramsNV = fn) #define CALL_TrackMatrixNV(disp, parameters) (*((disp)->TrackMatrixNV)) parameters #define GET_TrackMatrixNV(disp) ((disp)->TrackMatrixNV) #define SET_TrackMatrixNV(disp, fn) ((disp)->TrackMatrixNV = fn) #define CALL_VertexAttribPointerNV(disp, parameters) (*((disp)->VertexAttribPointerNV)) parameters #define GET_VertexAttribPointerNV(disp) ((disp)->VertexAttribPointerNV) #define SET_VertexAttribPointerNV(disp, fn) ((disp)->VertexAttribPointerNV = fn) #define CALL_VertexAttrib1dARB(disp, parameters) (*((disp)->VertexAttrib1dARB)) parameters #define GET_VertexAttrib1dARB(disp) ((disp)->VertexAttrib1dARB) #define SET_VertexAttrib1dARB(disp, fn) ((disp)->VertexAttrib1dARB = fn) #define CALL_VertexAttrib1dvARB(disp, parameters) (*((disp)->VertexAttrib1dvARB)) parameters #define GET_VertexAttrib1dvARB(disp) ((disp)->VertexAttrib1dvARB) #define SET_VertexAttrib1dvARB(disp, fn) ((disp)->VertexAttrib1dvARB = fn) #define CALL_VertexAttrib1fARB(disp, parameters) (*((disp)->VertexAttrib1fARB)) parameters #define GET_VertexAttrib1fARB(disp) ((disp)->VertexAttrib1fARB) #define SET_VertexAttrib1fARB(disp, fn) ((disp)->VertexAttrib1fARB = fn) #define CALL_VertexAttrib1fvARB(disp, parameters) (*((disp)->VertexAttrib1fvARB)) parameters #define GET_VertexAttrib1fvARB(disp) ((disp)->VertexAttrib1fvARB) #define SET_VertexAttrib1fvARB(disp, fn) ((disp)->VertexAttrib1fvARB = fn) #define CALL_VertexAttrib1sARB(disp, parameters) (*((disp)->VertexAttrib1sARB)) parameters #define GET_VertexAttrib1sARB(disp) ((disp)->VertexAttrib1sARB) #define SET_VertexAttrib1sARB(disp, fn) ((disp)->VertexAttrib1sARB = fn) #define CALL_VertexAttrib1svARB(disp, parameters) (*((disp)->VertexAttrib1svARB)) parameters #define GET_VertexAttrib1svARB(disp) ((disp)->VertexAttrib1svARB) #define SET_VertexAttrib1svARB(disp, fn) ((disp)->VertexAttrib1svARB = fn) #define CALL_VertexAttrib2dARB(disp, parameters) (*((disp)->VertexAttrib2dARB)) parameters #define GET_VertexAttrib2dARB(disp) ((disp)->VertexAttrib2dARB) #define SET_VertexAttrib2dARB(disp, fn) ((disp)->VertexAttrib2dARB = fn) #define CALL_VertexAttrib2dvARB(disp, parameters) (*((disp)->VertexAttrib2dvARB)) parameters #define GET_VertexAttrib2dvARB(disp) ((disp)->VertexAttrib2dvARB) #define SET_VertexAttrib2dvARB(disp, fn) ((disp)->VertexAttrib2dvARB = fn) #define CALL_VertexAttrib2fARB(disp, parameters) (*((disp)->VertexAttrib2fARB)) parameters #define GET_VertexAttrib2fARB(disp) ((disp)->VertexAttrib2fARB) #define SET_VertexAttrib2fARB(disp, fn) ((disp)->VertexAttrib2fARB = fn) #define CALL_VertexAttrib2fvARB(disp, parameters) (*((disp)->VertexAttrib2fvARB)) parameters #define GET_VertexAttrib2fvARB(disp) ((disp)->VertexAttrib2fvARB) #define SET_VertexAttrib2fvARB(disp, fn) ((disp)->VertexAttrib2fvARB = fn) #define CALL_VertexAttrib2sARB(disp, parameters) (*((disp)->VertexAttrib2sARB)) parameters #define GET_VertexAttrib2sARB(disp) ((disp)->VertexAttrib2sARB) #define SET_VertexAttrib2sARB(disp, fn) ((disp)->VertexAttrib2sARB = fn) #define CALL_VertexAttrib2svARB(disp, parameters) (*((disp)->VertexAttrib2svARB)) parameters #define GET_VertexAttrib2svARB(disp) ((disp)->VertexAttrib2svARB) #define SET_VertexAttrib2svARB(disp, fn) ((disp)->VertexAttrib2svARB = fn) #define CALL_VertexAttrib3dARB(disp, parameters) (*((disp)->VertexAttrib3dARB)) parameters #define GET_VertexAttrib3dARB(disp) ((disp)->VertexAttrib3dARB) #define SET_VertexAttrib3dARB(disp, fn) ((disp)->VertexAttrib3dARB = fn) #define CALL_VertexAttrib3dvARB(disp, parameters) (*((disp)->VertexAttrib3dvARB)) parameters #define GET_VertexAttrib3dvARB(disp) ((disp)->VertexAttrib3dvARB) #define SET_VertexAttrib3dvARB(disp, fn) ((disp)->VertexAttrib3dvARB = fn) #define CALL_VertexAttrib3fARB(disp, parameters) (*((disp)->VertexAttrib3fARB)) parameters #define GET_VertexAttrib3fARB(disp) ((disp)->VertexAttrib3fARB) #define SET_VertexAttrib3fARB(disp, fn) ((disp)->VertexAttrib3fARB = fn) #define CALL_VertexAttrib3fvARB(disp, parameters) (*((disp)->VertexAttrib3fvARB)) parameters #define GET_VertexAttrib3fvARB(disp) ((disp)->VertexAttrib3fvARB) #define SET_VertexAttrib3fvARB(disp, fn) ((disp)->VertexAttrib3fvARB = fn) #define CALL_VertexAttrib3sARB(disp, parameters) (*((disp)->VertexAttrib3sARB)) parameters #define GET_VertexAttrib3sARB(disp) ((disp)->VertexAttrib3sARB) #define SET_VertexAttrib3sARB(disp, fn) ((disp)->VertexAttrib3sARB = fn) #define CALL_VertexAttrib3svARB(disp, parameters) (*((disp)->VertexAttrib3svARB)) parameters #define GET_VertexAttrib3svARB(disp) ((disp)->VertexAttrib3svARB) #define SET_VertexAttrib3svARB(disp, fn) ((disp)->VertexAttrib3svARB = fn) #define CALL_VertexAttrib4dARB(disp, parameters) (*((disp)->VertexAttrib4dARB)) parameters #define GET_VertexAttrib4dARB(disp) ((disp)->VertexAttrib4dARB) #define SET_VertexAttrib4dARB(disp, fn) ((disp)->VertexAttrib4dARB = fn) #define CALL_VertexAttrib4dvARB(disp, parameters) (*((disp)->VertexAttrib4dvARB)) parameters #define GET_VertexAttrib4dvARB(disp) ((disp)->VertexAttrib4dvARB) #define SET_VertexAttrib4dvARB(disp, fn) ((disp)->VertexAttrib4dvARB = fn) #define CALL_VertexAttrib4fARB(disp, parameters) (*((disp)->VertexAttrib4fARB)) parameters #define GET_VertexAttrib4fARB(disp) ((disp)->VertexAttrib4fARB) #define SET_VertexAttrib4fARB(disp, fn) ((disp)->VertexAttrib4fARB = fn) #define CALL_VertexAttrib4fvARB(disp, parameters) (*((disp)->VertexAttrib4fvARB)) parameters #define GET_VertexAttrib4fvARB(disp) ((disp)->VertexAttrib4fvARB) #define SET_VertexAttrib4fvARB(disp, fn) ((disp)->VertexAttrib4fvARB = fn) #define CALL_VertexAttrib4sARB(disp, parameters) (*((disp)->VertexAttrib4sARB)) parameters #define GET_VertexAttrib4sARB(disp) ((disp)->VertexAttrib4sARB) #define SET_VertexAttrib4sARB(disp, fn) ((disp)->VertexAttrib4sARB = fn) #define CALL_VertexAttrib4svARB(disp, parameters) (*((disp)->VertexAttrib4svARB)) parameters #define GET_VertexAttrib4svARB(disp) ((disp)->VertexAttrib4svARB) #define SET_VertexAttrib4svARB(disp, fn) ((disp)->VertexAttrib4svARB = fn) #define CALL_VertexAttrib4NubARB(disp, parameters) (*((disp)->VertexAttrib4NubARB)) parameters #define GET_VertexAttrib4NubARB(disp) ((disp)->VertexAttrib4NubARB) #define SET_VertexAttrib4NubARB(disp, fn) ((disp)->VertexAttrib4NubARB = fn) #define CALL_VertexAttrib4NubvARB(disp, parameters) (*((disp)->VertexAttrib4NubvARB)) parameters #define GET_VertexAttrib4NubvARB(disp) ((disp)->VertexAttrib4NubvARB) #define SET_VertexAttrib4NubvARB(disp, fn) ((disp)->VertexAttrib4NubvARB = fn) #define CALL_VertexAttribs1dvNV(disp, parameters) (*((disp)->VertexAttribs1dvNV)) parameters #define GET_VertexAttribs1dvNV(disp) ((disp)->VertexAttribs1dvNV) #define SET_VertexAttribs1dvNV(disp, fn) ((disp)->VertexAttribs1dvNV = fn) #define CALL_VertexAttribs1fvNV(disp, parameters) (*((disp)->VertexAttribs1fvNV)) parameters #define GET_VertexAttribs1fvNV(disp) ((disp)->VertexAttribs1fvNV) #define SET_VertexAttribs1fvNV(disp, fn) ((disp)->VertexAttribs1fvNV = fn) #define CALL_VertexAttribs1svNV(disp, parameters) (*((disp)->VertexAttribs1svNV)) parameters #define GET_VertexAttribs1svNV(disp) ((disp)->VertexAttribs1svNV) #define SET_VertexAttribs1svNV(disp, fn) ((disp)->VertexAttribs1svNV = fn) #define CALL_VertexAttribs2dvNV(disp, parameters) (*((disp)->VertexAttribs2dvNV)) parameters #define GET_VertexAttribs2dvNV(disp) ((disp)->VertexAttribs2dvNV) #define SET_VertexAttribs2dvNV(disp, fn) ((disp)->VertexAttribs2dvNV = fn) #define CALL_VertexAttribs2fvNV(disp, parameters) (*((disp)->VertexAttribs2fvNV)) parameters #define GET_VertexAttribs2fvNV(disp) ((disp)->VertexAttribs2fvNV) #define SET_VertexAttribs2fvNV(disp, fn) ((disp)->VertexAttribs2fvNV = fn) #define CALL_VertexAttribs2svNV(disp, parameters) (*((disp)->VertexAttribs2svNV)) parameters #define GET_VertexAttribs2svNV(disp) ((disp)->VertexAttribs2svNV) #define SET_VertexAttribs2svNV(disp, fn) ((disp)->VertexAttribs2svNV = fn) #define CALL_VertexAttribs3dvNV(disp, parameters) (*((disp)->VertexAttribs3dvNV)) parameters #define GET_VertexAttribs3dvNV(disp) ((disp)->VertexAttribs3dvNV) #define SET_VertexAttribs3dvNV(disp, fn) ((disp)->VertexAttribs3dvNV = fn) #define CALL_VertexAttribs3fvNV(disp, parameters) (*((disp)->VertexAttribs3fvNV)) parameters #define GET_VertexAttribs3fvNV(disp) ((disp)->VertexAttribs3fvNV) #define SET_VertexAttribs3fvNV(disp, fn) ((disp)->VertexAttribs3fvNV = fn) #define CALL_VertexAttribs3svNV(disp, parameters) (*((disp)->VertexAttribs3svNV)) parameters #define GET_VertexAttribs3svNV(disp) ((disp)->VertexAttribs3svNV) #define SET_VertexAttribs3svNV(disp, fn) ((disp)->VertexAttribs3svNV = fn) #define CALL_VertexAttribs4dvNV(disp, parameters) (*((disp)->VertexAttribs4dvNV)) parameters #define GET_VertexAttribs4dvNV(disp) ((disp)->VertexAttribs4dvNV) #define SET_VertexAttribs4dvNV(disp, fn) ((disp)->VertexAttribs4dvNV = fn) #define CALL_VertexAttribs4fvNV(disp, parameters) (*((disp)->VertexAttribs4fvNV)) parameters #define GET_VertexAttribs4fvNV(disp) ((disp)->VertexAttribs4fvNV) #define SET_VertexAttribs4fvNV(disp, fn) ((disp)->VertexAttribs4fvNV = fn) #define CALL_VertexAttribs4svNV(disp, parameters) (*((disp)->VertexAttribs4svNV)) parameters #define GET_VertexAttribs4svNV(disp) ((disp)->VertexAttribs4svNV) #define SET_VertexAttribs4svNV(disp, fn) ((disp)->VertexAttribs4svNV = fn) #define CALL_VertexAttribs4ubvNV(disp, parameters) (*((disp)->VertexAttribs4ubvNV)) parameters #define GET_VertexAttribs4ubvNV(disp) ((disp)->VertexAttribs4ubvNV) #define SET_VertexAttribs4ubvNV(disp, fn) ((disp)->VertexAttribs4ubvNV = fn) #define CALL_PointParameteriNV(disp, parameters) (*((disp)->PointParameteriNV)) parameters #define GET_PointParameteriNV(disp) ((disp)->PointParameteriNV) #define SET_PointParameteriNV(disp, fn) ((disp)->PointParameteriNV = fn) #define CALL_PointParameterivNV(disp, parameters) (*((disp)->PointParameterivNV)) parameters #define GET_PointParameterivNV(disp) ((disp)->PointParameterivNV) #define SET_PointParameterivNV(disp, fn) ((disp)->PointParameterivNV = fn) #define CALL_MultiDrawArraysEXT(disp, parameters) (*((disp)->MultiDrawArraysEXT)) parameters #define GET_MultiDrawArraysEXT(disp) ((disp)->MultiDrawArraysEXT) #define SET_MultiDrawArraysEXT(disp, fn) ((disp)->MultiDrawArraysEXT = fn) #define CALL_MultiDrawElementsEXT(disp, parameters) (*((disp)->MultiDrawElementsEXT)) parameters #define GET_MultiDrawElementsEXT(disp) ((disp)->MultiDrawElementsEXT) #define SET_MultiDrawElementsEXT(disp, fn) ((disp)->MultiDrawElementsEXT = fn) #define CALL_ActiveStencilFaceEXT(disp, parameters) (*((disp)->ActiveStencilFaceEXT)) parameters #define GET_ActiveStencilFaceEXT(disp) ((disp)->ActiveStencilFaceEXT) #define SET_ActiveStencilFaceEXT(disp, fn) ((disp)->ActiveStencilFaceEXT = fn) #define CALL_DeleteFencesNV(disp, parameters) (*((disp)->DeleteFencesNV)) parameters #define GET_DeleteFencesNV(disp) ((disp)->DeleteFencesNV) #define SET_DeleteFencesNV(disp, fn) ((disp)->DeleteFencesNV = fn) #define CALL_GenFencesNV(disp, parameters) (*((disp)->GenFencesNV)) parameters #define GET_GenFencesNV(disp) ((disp)->GenFencesNV) #define SET_GenFencesNV(disp, fn) ((disp)->GenFencesNV = fn) #define CALL_IsFenceNV(disp, parameters) (*((disp)->IsFenceNV)) parameters #define GET_IsFenceNV(disp) ((disp)->IsFenceNV) #define SET_IsFenceNV(disp, fn) ((disp)->IsFenceNV = fn) #define CALL_TestFenceNV(disp, parameters) (*((disp)->TestFenceNV)) parameters #define GET_TestFenceNV(disp) ((disp)->TestFenceNV) #define SET_TestFenceNV(disp, fn) ((disp)->TestFenceNV = fn) #define CALL_GetFenceivNV(disp, parameters) (*((disp)->GetFenceivNV)) parameters #define GET_GetFenceivNV(disp) ((disp)->GetFenceivNV) #define SET_GetFenceivNV(disp, fn) ((disp)->GetFenceivNV = fn) #define CALL_FinishFenceNV(disp, parameters) (*((disp)->FinishFenceNV)) parameters #define GET_FinishFenceNV(disp) ((disp)->FinishFenceNV) #define SET_FinishFenceNV(disp, fn) ((disp)->FinishFenceNV = fn) #define CALL_SetFenceNV(disp, parameters) (*((disp)->SetFenceNV)) parameters #define GET_SetFenceNV(disp) ((disp)->SetFenceNV) #define SET_SetFenceNV(disp, fn) ((disp)->SetFenceNV = fn) #define CALL_VertexAttrib4bvARB(disp, parameters) (*((disp)->VertexAttrib4bvARB)) parameters #define GET_VertexAttrib4bvARB(disp) ((disp)->VertexAttrib4bvARB) #define SET_VertexAttrib4bvARB(disp, fn) ((disp)->VertexAttrib4bvARB = fn) #define CALL_VertexAttrib4ivARB(disp, parameters) (*((disp)->VertexAttrib4ivARB)) parameters #define GET_VertexAttrib4ivARB(disp) ((disp)->VertexAttrib4ivARB) #define SET_VertexAttrib4ivARB(disp, fn) ((disp)->VertexAttrib4ivARB = fn) #define CALL_VertexAttrib4ubvARB(disp, parameters) (*((disp)->VertexAttrib4ubvARB)) parameters #define GET_VertexAttrib4ubvARB(disp) ((disp)->VertexAttrib4ubvARB) #define SET_VertexAttrib4ubvARB(disp, fn) ((disp)->VertexAttrib4ubvARB = fn) #define CALL_VertexAttrib4usvARB(disp, parameters) (*((disp)->VertexAttrib4usvARB)) parameters #define GET_VertexAttrib4usvARB(disp) ((disp)->VertexAttrib4usvARB) #define SET_VertexAttrib4usvARB(disp, fn) ((disp)->VertexAttrib4usvARB = fn) #define CALL_VertexAttrib4uivARB(disp, parameters) (*((disp)->VertexAttrib4uivARB)) parameters #define GET_VertexAttrib4uivARB(disp) ((disp)->VertexAttrib4uivARB) #define SET_VertexAttrib4uivARB(disp, fn) ((disp)->VertexAttrib4uivARB = fn) #define CALL_VertexAttrib4NbvARB(disp, parameters) (*((disp)->VertexAttrib4NbvARB)) parameters #define GET_VertexAttrib4NbvARB(disp) ((disp)->VertexAttrib4NbvARB) #define SET_VertexAttrib4NbvARB(disp, fn) ((disp)->VertexAttrib4NbvARB = fn) #define CALL_VertexAttrib4NsvARB(disp, parameters) (*((disp)->VertexAttrib4NsvARB)) parameters #define GET_VertexAttrib4NsvARB(disp) ((disp)->VertexAttrib4NsvARB) #define SET_VertexAttrib4NsvARB(disp, fn) ((disp)->VertexAttrib4NsvARB = fn) #define CALL_VertexAttrib4NivARB(disp, parameters) (*((disp)->VertexAttrib4NivARB)) parameters #define GET_VertexAttrib4NivARB(disp) ((disp)->VertexAttrib4NivARB) #define SET_VertexAttrib4NivARB(disp, fn) ((disp)->VertexAttrib4NivARB = fn) #define CALL_VertexAttrib4NusvARB(disp, parameters) (*((disp)->VertexAttrib4NusvARB)) parameters #define GET_VertexAttrib4NusvARB(disp) ((disp)->VertexAttrib4NusvARB) #define SET_VertexAttrib4NusvARB(disp, fn) ((disp)->VertexAttrib4NusvARB = fn) #define CALL_VertexAttrib4NuivARB(disp, parameters) (*((disp)->VertexAttrib4NuivARB)) parameters #define GET_VertexAttrib4NuivARB(disp) ((disp)->VertexAttrib4NuivARB) #define SET_VertexAttrib4NuivARB(disp, fn) ((disp)->VertexAttrib4NuivARB = fn) #define CALL_VertexAttribPointerARB(disp, parameters) (*((disp)->VertexAttribPointerARB)) parameters #define GET_VertexAttribPointerARB(disp) ((disp)->VertexAttribPointerARB) #define SET_VertexAttribPointerARB(disp, fn) ((disp)->VertexAttribPointerARB = fn) #define CALL_EnableVertexAttribArrayARB(disp, parameters) (*((disp)->EnableVertexAttribArrayARB)) parameters #define GET_EnableVertexAttribArrayARB(disp) ((disp)->EnableVertexAttribArrayARB) #define SET_EnableVertexAttribArrayARB(disp, fn) ((disp)->EnableVertexAttribArrayARB = fn) #define CALL_DisableVertexAttribArrayARB(disp, parameters) (*((disp)->DisableVertexAttribArrayARB)) parameters #define GET_DisableVertexAttribArrayARB(disp) ((disp)->DisableVertexAttribArrayARB) #define SET_DisableVertexAttribArrayARB(disp, fn) ((disp)->DisableVertexAttribArrayARB = fn) #define CALL_ProgramStringARB(disp, parameters) (*((disp)->ProgramStringARB)) parameters #define GET_ProgramStringARB(disp) ((disp)->ProgramStringARB) #define SET_ProgramStringARB(disp, fn) ((disp)->ProgramStringARB = fn) #define CALL_ProgramEnvParameter4dARB(disp, parameters) (*((disp)->ProgramEnvParameter4dARB)) parameters #define GET_ProgramEnvParameter4dARB(disp) ((disp)->ProgramEnvParameter4dARB) #define SET_ProgramEnvParameter4dARB(disp, fn) ((disp)->ProgramEnvParameter4dARB = fn) #define CALL_ProgramEnvParameter4dvARB(disp, parameters) (*((disp)->ProgramEnvParameter4dvARB)) parameters #define GET_ProgramEnvParameter4dvARB(disp) ((disp)->ProgramEnvParameter4dvARB) #define SET_ProgramEnvParameter4dvARB(disp, fn) ((disp)->ProgramEnvParameter4dvARB = fn) #define CALL_ProgramEnvParameter4fARB(disp, parameters) (*((disp)->ProgramEnvParameter4fARB)) parameters #define GET_ProgramEnvParameter4fARB(disp) ((disp)->ProgramEnvParameter4fARB) #define SET_ProgramEnvParameter4fARB(disp, fn) ((disp)->ProgramEnvParameter4fARB = fn) #define CALL_ProgramEnvParameter4fvARB(disp, parameters) (*((disp)->ProgramEnvParameter4fvARB)) parameters #define GET_ProgramEnvParameter4fvARB(disp) ((disp)->ProgramEnvParameter4fvARB) #define SET_ProgramEnvParameter4fvARB(disp, fn) ((disp)->ProgramEnvParameter4fvARB = fn) #define CALL_ProgramLocalParameter4dARB(disp, parameters) (*((disp)->ProgramLocalParameter4dARB)) parameters #define GET_ProgramLocalParameter4dARB(disp) ((disp)->ProgramLocalParameter4dARB) #define SET_ProgramLocalParameter4dARB(disp, fn) ((disp)->ProgramLocalParameter4dARB = fn) #define CALL_ProgramLocalParameter4dvARB(disp, parameters) (*((disp)->ProgramLocalParameter4dvARB)) parameters #define GET_ProgramLocalParameter4dvARB(disp) ((disp)->ProgramLocalParameter4dvARB) #define SET_ProgramLocalParameter4dvARB(disp, fn) ((disp)->ProgramLocalParameter4dvARB = fn) #define CALL_ProgramLocalParameter4fARB(disp, parameters) (*((disp)->ProgramLocalParameter4fARB)) parameters #define GET_ProgramLocalParameter4fARB(disp) ((disp)->ProgramLocalParameter4fARB) #define SET_ProgramLocalParameter4fARB(disp, fn) ((disp)->ProgramLocalParameter4fARB = fn) #define CALL_ProgramLocalParameter4fvARB(disp, parameters) (*((disp)->ProgramLocalParameter4fvARB)) parameters #define GET_ProgramLocalParameter4fvARB(disp) ((disp)->ProgramLocalParameter4fvARB) #define SET_ProgramLocalParameter4fvARB(disp, fn) ((disp)->ProgramLocalParameter4fvARB = fn) #define CALL_GetProgramEnvParameterdvARB(disp, parameters) (*((disp)->GetProgramEnvParameterdvARB)) parameters #define GET_GetProgramEnvParameterdvARB(disp) ((disp)->GetProgramEnvParameterdvARB) #define SET_GetProgramEnvParameterdvARB(disp, fn) ((disp)->GetProgramEnvParameterdvARB = fn) #define CALL_GetProgramEnvParameterfvARB(disp, parameters) (*((disp)->GetProgramEnvParameterfvARB)) parameters #define GET_GetProgramEnvParameterfvARB(disp) ((disp)->GetProgramEnvParameterfvARB) #define SET_GetProgramEnvParameterfvARB(disp, fn) ((disp)->GetProgramEnvParameterfvARB = fn) #define CALL_GetProgramLocalParameterdvARB(disp, parameters) (*((disp)->GetProgramLocalParameterdvARB)) parameters #define GET_GetProgramLocalParameterdvARB(disp) ((disp)->GetProgramLocalParameterdvARB) #define SET_GetProgramLocalParameterdvARB(disp, fn) ((disp)->GetProgramLocalParameterdvARB = fn) #define CALL_GetProgramLocalParameterfvARB(disp, parameters) (*((disp)->GetProgramLocalParameterfvARB)) parameters #define GET_GetProgramLocalParameterfvARB(disp) ((disp)->GetProgramLocalParameterfvARB) #define SET_GetProgramLocalParameterfvARB(disp, fn) ((disp)->GetProgramLocalParameterfvARB = fn) #define CALL_GetProgramivARB(disp, parameters) (*((disp)->GetProgramivARB)) parameters #define GET_GetProgramivARB(disp) ((disp)->GetProgramivARB) #define SET_GetProgramivARB(disp, fn) ((disp)->GetProgramivARB = fn) #define CALL_GetProgramStringARB(disp, parameters) (*((disp)->GetProgramStringARB)) parameters #define GET_GetProgramStringARB(disp) ((disp)->GetProgramStringARB) #define SET_GetProgramStringARB(disp, fn) ((disp)->GetProgramStringARB = fn) #define CALL_ProgramNamedParameter4fNV(disp, parameters) (*((disp)->ProgramNamedParameter4fNV)) parameters #define GET_ProgramNamedParameter4fNV(disp) ((disp)->ProgramNamedParameter4fNV) #define SET_ProgramNamedParameter4fNV(disp, fn) ((disp)->ProgramNamedParameter4fNV = fn) #define CALL_ProgramNamedParameter4dNV(disp, parameters) (*((disp)->ProgramNamedParameter4dNV)) parameters #define GET_ProgramNamedParameter4dNV(disp) ((disp)->ProgramNamedParameter4dNV) #define SET_ProgramNamedParameter4dNV(disp, fn) ((disp)->ProgramNamedParameter4dNV = fn) #define CALL_ProgramNamedParameter4fvNV(disp, parameters) (*((disp)->ProgramNamedParameter4fvNV)) parameters #define GET_ProgramNamedParameter4fvNV(disp) ((disp)->ProgramNamedParameter4fvNV) #define SET_ProgramNamedParameter4fvNV(disp, fn) ((disp)->ProgramNamedParameter4fvNV = fn) #define CALL_ProgramNamedParameter4dvNV(disp, parameters) (*((disp)->ProgramNamedParameter4dvNV)) parameters #define GET_ProgramNamedParameter4dvNV(disp) ((disp)->ProgramNamedParameter4dvNV) #define SET_ProgramNamedParameter4dvNV(disp, fn) ((disp)->ProgramNamedParameter4dvNV = fn) #define CALL_GetProgramNamedParameterfvNV(disp, parameters) (*((disp)->GetProgramNamedParameterfvNV)) parameters #define GET_GetProgramNamedParameterfvNV(disp) ((disp)->GetProgramNamedParameterfvNV) #define SET_GetProgramNamedParameterfvNV(disp, fn) ((disp)->GetProgramNamedParameterfvNV = fn) #define CALL_GetProgramNamedParameterdvNV(disp, parameters) (*((disp)->GetProgramNamedParameterdvNV)) parameters #define GET_GetProgramNamedParameterdvNV(disp) ((disp)->GetProgramNamedParameterdvNV) #define SET_GetProgramNamedParameterdvNV(disp, fn) ((disp)->GetProgramNamedParameterdvNV = fn) #define CALL_BindBufferARB(disp, parameters) (*((disp)->BindBufferARB)) parameters #define GET_BindBufferARB(disp) ((disp)->BindBufferARB) #define SET_BindBufferARB(disp, fn) ((disp)->BindBufferARB = fn) #define CALL_BufferDataARB(disp, parameters) (*((disp)->BufferDataARB)) parameters #define GET_BufferDataARB(disp) ((disp)->BufferDataARB) #define SET_BufferDataARB(disp, fn) ((disp)->BufferDataARB = fn) #define CALL_BufferSubDataARB(disp, parameters) (*((disp)->BufferSubDataARB)) parameters #define GET_BufferSubDataARB(disp) ((disp)->BufferSubDataARB) #define SET_BufferSubDataARB(disp, fn) ((disp)->BufferSubDataARB = fn) #define CALL_DeleteBuffersARB(disp, parameters) (*((disp)->DeleteBuffersARB)) parameters #define GET_DeleteBuffersARB(disp) ((disp)->DeleteBuffersARB) #define SET_DeleteBuffersARB(disp, fn) ((disp)->DeleteBuffersARB = fn) #define CALL_GenBuffersARB(disp, parameters) (*((disp)->GenBuffersARB)) parameters #define GET_GenBuffersARB(disp) ((disp)->GenBuffersARB) #define SET_GenBuffersARB(disp, fn) ((disp)->GenBuffersARB = fn) #define CALL_GetBufferParameterivARB(disp, parameters) (*((disp)->GetBufferParameterivARB)) parameters #define GET_GetBufferParameterivARB(disp) ((disp)->GetBufferParameterivARB) #define SET_GetBufferParameterivARB(disp, fn) ((disp)->GetBufferParameterivARB = fn) #define CALL_GetBufferPointervARB(disp, parameters) (*((disp)->GetBufferPointervARB)) parameters #define GET_GetBufferPointervARB(disp) ((disp)->GetBufferPointervARB) #define SET_GetBufferPointervARB(disp, fn) ((disp)->GetBufferPointervARB = fn) #define CALL_GetBufferSubDataARB(disp, parameters) (*((disp)->GetBufferSubDataARB)) parameters #define GET_GetBufferSubDataARB(disp) ((disp)->GetBufferSubDataARB) #define SET_GetBufferSubDataARB(disp, fn) ((disp)->GetBufferSubDataARB = fn) #define CALL_IsBufferARB(disp, parameters) (*((disp)->IsBufferARB)) parameters #define GET_IsBufferARB(disp) ((disp)->IsBufferARB) #define SET_IsBufferARB(disp, fn) ((disp)->IsBufferARB = fn) #define CALL_MapBufferARB(disp, parameters) (*((disp)->MapBufferARB)) parameters #define GET_MapBufferARB(disp) ((disp)->MapBufferARB) #define SET_MapBufferARB(disp, fn) ((disp)->MapBufferARB = fn) #define CALL_UnmapBufferARB(disp, parameters) (*((disp)->UnmapBufferARB)) parameters #define GET_UnmapBufferARB(disp) ((disp)->UnmapBufferARB) #define SET_UnmapBufferARB(disp, fn) ((disp)->UnmapBufferARB = fn) #define CALL_DepthBoundsEXT(disp, parameters) (*((disp)->DepthBoundsEXT)) parameters #define GET_DepthBoundsEXT(disp) ((disp)->DepthBoundsEXT) #define SET_DepthBoundsEXT(disp, fn) ((disp)->DepthBoundsEXT = fn) #define CALL_GenQueriesARB(disp, parameters) (*((disp)->GenQueriesARB)) parameters #define GET_GenQueriesARB(disp) ((disp)->GenQueriesARB) #define SET_GenQueriesARB(disp, fn) ((disp)->GenQueriesARB = fn) #define CALL_DeleteQueriesARB(disp, parameters) (*((disp)->DeleteQueriesARB)) parameters #define GET_DeleteQueriesARB(disp) ((disp)->DeleteQueriesARB) #define SET_DeleteQueriesARB(disp, fn) ((disp)->DeleteQueriesARB = fn) #define CALL_IsQueryARB(disp, parameters) (*((disp)->IsQueryARB)) parameters #define GET_IsQueryARB(disp) ((disp)->IsQueryARB) #define SET_IsQueryARB(disp, fn) ((disp)->IsQueryARB = fn) #define CALL_BeginQueryARB(disp, parameters) (*((disp)->BeginQueryARB)) parameters #define GET_BeginQueryARB(disp) ((disp)->BeginQueryARB) #define SET_BeginQueryARB(disp, fn) ((disp)->BeginQueryARB = fn) #define CALL_EndQueryARB(disp, parameters) (*((disp)->EndQueryARB)) parameters #define GET_EndQueryARB(disp) ((disp)->EndQueryARB) #define SET_EndQueryARB(disp, fn) ((disp)->EndQueryARB = fn) #define CALL_GetQueryivARB(disp, parameters) (*((disp)->GetQueryivARB)) parameters #define GET_GetQueryivARB(disp) ((disp)->GetQueryivARB) #define SET_GetQueryivARB(disp, fn) ((disp)->GetQueryivARB = fn) #define CALL_GetQueryObjectivARB(disp, parameters) (*((disp)->GetQueryObjectivARB)) parameters #define GET_GetQueryObjectivARB(disp) ((disp)->GetQueryObjectivARB) #define SET_GetQueryObjectivARB(disp, fn) ((disp)->GetQueryObjectivARB = fn) #define CALL_GetQueryObjectuivARB(disp, parameters) (*((disp)->GetQueryObjectuivARB)) parameters #define GET_GetQueryObjectuivARB(disp) ((disp)->GetQueryObjectuivARB) #define SET_GetQueryObjectuivARB(disp, fn) ((disp)->GetQueryObjectuivARB = fn) #define CALL_MultiModeDrawArraysIBM(disp, parameters) (*((disp)->MultiModeDrawArraysIBM)) parameters #define GET_MultiModeDrawArraysIBM(disp) ((disp)->MultiModeDrawArraysIBM) #define SET_MultiModeDrawArraysIBM(disp, fn) ((disp)->MultiModeDrawArraysIBM = fn) #define CALL_MultiModeDrawElementsIBM(disp, parameters) (*((disp)->MultiModeDrawElementsIBM)) parameters #define GET_MultiModeDrawElementsIBM(disp) ((disp)->MultiModeDrawElementsIBM) #define SET_MultiModeDrawElementsIBM(disp, fn) ((disp)->MultiModeDrawElementsIBM = fn) #define CALL_BlendEquationSeparateEXT(disp, parameters) (*((disp)->BlendEquationSeparateEXT)) parameters #define GET_BlendEquationSeparateEXT(disp) ((disp)->BlendEquationSeparateEXT) #define SET_BlendEquationSeparateEXT(disp, fn) ((disp)->BlendEquationSeparateEXT = fn) #define CALL_DeleteObjectARB(disp, parameters) (*((disp)->DeleteObjectARB)) parameters #define GET_DeleteObjectARB(disp) ((disp)->DeleteObjectARB) #define SET_DeleteObjectARB(disp, fn) ((disp)->DeleteObjectARB = fn) #define CALL_GetHandleARB(disp, parameters) (*((disp)->GetHandleARB)) parameters #define GET_GetHandleARB(disp) ((disp)->GetHandleARB) #define SET_GetHandleARB(disp, fn) ((disp)->GetHandleARB = fn) #define CALL_DetachObjectARB(disp, parameters) (*((disp)->DetachObjectARB)) parameters #define GET_DetachObjectARB(disp) ((disp)->DetachObjectARB) #define SET_DetachObjectARB(disp, fn) ((disp)->DetachObjectARB = fn) #define CALL_CreateShaderObjectARB(disp, parameters) (*((disp)->CreateShaderObjectARB)) parameters #define GET_CreateShaderObjectARB(disp) ((disp)->CreateShaderObjectARB) #define SET_CreateShaderObjectARB(disp, fn) ((disp)->CreateShaderObjectARB = fn) #define CALL_ShaderSourceARB(disp, parameters) (*((disp)->ShaderSourceARB)) parameters #define GET_ShaderSourceARB(disp) ((disp)->ShaderSourceARB) #define SET_ShaderSourceARB(disp, fn) ((disp)->ShaderSourceARB = fn) #define CALL_CompileShaderARB(disp, parameters) (*((disp)->CompileShaderARB)) parameters #define GET_CompileShaderARB(disp) ((disp)->CompileShaderARB) #define SET_CompileShaderARB(disp, fn) ((disp)->CompileShaderARB = fn) #define CALL_CreateProgramObjectARB(disp, parameters) (*((disp)->CreateProgramObjectARB)) parameters #define GET_CreateProgramObjectARB(disp) ((disp)->CreateProgramObjectARB) #define SET_CreateProgramObjectARB(disp, fn) ((disp)->CreateProgramObjectARB = fn) #define CALL_AttachObjectARB(disp, parameters) (*((disp)->AttachObjectARB)) parameters #define GET_AttachObjectARB(disp) ((disp)->AttachObjectARB) #define SET_AttachObjectARB(disp, fn) ((disp)->AttachObjectARB = fn) #define CALL_LinkProgramARB(disp, parameters) (*((disp)->LinkProgramARB)) parameters #define GET_LinkProgramARB(disp) ((disp)->LinkProgramARB) #define SET_LinkProgramARB(disp, fn) ((disp)->LinkProgramARB = fn) #define CALL_UseProgramObjectARB(disp, parameters) (*((disp)->UseProgramObjectARB)) parameters #define GET_UseProgramObjectARB(disp) ((disp)->UseProgramObjectARB) #define SET_UseProgramObjectARB(disp, fn) ((disp)->UseProgramObjectARB = fn) #define CALL_ValidateProgramARB(disp, parameters) (*((disp)->ValidateProgramARB)) parameters #define GET_ValidateProgramARB(disp) ((disp)->ValidateProgramARB) #define SET_ValidateProgramARB(disp, fn) ((disp)->ValidateProgramARB = fn) #define CALL_Uniform1fARB(disp, parameters) (*((disp)->Uniform1fARB)) parameters #define GET_Uniform1fARB(disp) ((disp)->Uniform1fARB) #define SET_Uniform1fARB(disp, fn) ((disp)->Uniform1fARB = fn) #define CALL_Uniform2fARB(disp, parameters) (*((disp)->Uniform2fARB)) parameters #define GET_Uniform2fARB(disp) ((disp)->Uniform2fARB) #define SET_Uniform2fARB(disp, fn) ((disp)->Uniform2fARB = fn) #define CALL_Uniform3fARB(disp, parameters) (*((disp)->Uniform3fARB)) parameters #define GET_Uniform3fARB(disp) ((disp)->Uniform3fARB) #define SET_Uniform3fARB(disp, fn) ((disp)->Uniform3fARB = fn) #define CALL_Uniform4fARB(disp, parameters) (*((disp)->Uniform4fARB)) parameters #define GET_Uniform4fARB(disp) ((disp)->Uniform4fARB) #define SET_Uniform4fARB(disp, fn) ((disp)->Uniform4fARB = fn) #define CALL_Uniform1iARB(disp, parameters) (*((disp)->Uniform1iARB)) parameters #define GET_Uniform1iARB(disp) ((disp)->Uniform1iARB) #define SET_Uniform1iARB(disp, fn) ((disp)->Uniform1iARB = fn) #define CALL_Uniform2iARB(disp, parameters) (*((disp)->Uniform2iARB)) parameters #define GET_Uniform2iARB(disp) ((disp)->Uniform2iARB) #define SET_Uniform2iARB(disp, fn) ((disp)->Uniform2iARB = fn) #define CALL_Uniform3iARB(disp, parameters) (*((disp)->Uniform3iARB)) parameters #define GET_Uniform3iARB(disp) ((disp)->Uniform3iARB) #define SET_Uniform3iARB(disp, fn) ((disp)->Uniform3iARB = fn) #define CALL_Uniform4iARB(disp, parameters) (*((disp)->Uniform4iARB)) parameters #define GET_Uniform4iARB(disp) ((disp)->Uniform4iARB) #define SET_Uniform4iARB(disp, fn) ((disp)->Uniform4iARB = fn) #define CALL_Uniform1fvARB(disp, parameters) (*((disp)->Uniform1fvARB)) parameters #define GET_Uniform1fvARB(disp) ((disp)->Uniform1fvARB) #define SET_Uniform1fvARB(disp, fn) ((disp)->Uniform1fvARB = fn) #define CALL_Uniform2fvARB(disp, parameters) (*((disp)->Uniform2fvARB)) parameters #define GET_Uniform2fvARB(disp) ((disp)->Uniform2fvARB) #define SET_Uniform2fvARB(disp, fn) ((disp)->Uniform2fvARB = fn) #define CALL_Uniform3fvARB(disp, parameters) (*((disp)->Uniform3fvARB)) parameters #define GET_Uniform3fvARB(disp) ((disp)->Uniform3fvARB) #define SET_Uniform3fvARB(disp, fn) ((disp)->Uniform3fvARB = fn) #define CALL_Uniform4fvARB(disp, parameters) (*((disp)->Uniform4fvARB)) parameters #define GET_Uniform4fvARB(disp) ((disp)->Uniform4fvARB) #define SET_Uniform4fvARB(disp, fn) ((disp)->Uniform4fvARB = fn) #define CALL_Uniform1ivARB(disp, parameters) (*((disp)->Uniform1ivARB)) parameters #define GET_Uniform1ivARB(disp) ((disp)->Uniform1ivARB) #define SET_Uniform1ivARB(disp, fn) ((disp)->Uniform1ivARB = fn) #define CALL_Uniform2ivARB(disp, parameters) (*((disp)->Uniform2ivARB)) parameters #define GET_Uniform2ivARB(disp) ((disp)->Uniform2ivARB) #define SET_Uniform2ivARB(disp, fn) ((disp)->Uniform2ivARB = fn) #define CALL_Uniform3ivARB(disp, parameters) (*((disp)->Uniform3ivARB)) parameters #define GET_Uniform3ivARB(disp) ((disp)->Uniform3ivARB) #define SET_Uniform3ivARB(disp, fn) ((disp)->Uniform3ivARB = fn) #define CALL_Uniform4ivARB(disp, parameters) (*((disp)->Uniform4ivARB)) parameters #define GET_Uniform4ivARB(disp) ((disp)->Uniform4ivARB) #define SET_Uniform4ivARB(disp, fn) ((disp)->Uniform4ivARB = fn) #define CALL_UniformMatrix2fvARB(disp, parameters) (*((disp)->UniformMatrix2fvARB)) parameters #define GET_UniformMatrix2fvARB(disp) ((disp)->UniformMatrix2fvARB) #define SET_UniformMatrix2fvARB(disp, fn) ((disp)->UniformMatrix2fvARB = fn) #define CALL_UniformMatrix3fvARB(disp, parameters) (*((disp)->UniformMatrix3fvARB)) parameters #define GET_UniformMatrix3fvARB(disp) ((disp)->UniformMatrix3fvARB) #define SET_UniformMatrix3fvARB(disp, fn) ((disp)->UniformMatrix3fvARB = fn) #define CALL_UniformMatrix4fvARB(disp, parameters) (*((disp)->UniformMatrix4fvARB)) parameters #define GET_UniformMatrix4fvARB(disp) ((disp)->UniformMatrix4fvARB) #define SET_UniformMatrix4fvARB(disp, fn) ((disp)->UniformMatrix4fvARB = fn) #define CALL_GetObjectParameterfvARB(disp, parameters) (*((disp)->GetObjectParameterfvARB)) parameters #define GET_GetObjectParameterfvARB(disp) ((disp)->GetObjectParameterfvARB) #define SET_GetObjectParameterfvARB(disp, fn) ((disp)->GetObjectParameterfvARB = fn) #define CALL_GetObjectParameterivARB(disp, parameters) (*((disp)->GetObjectParameterivARB)) parameters #define GET_GetObjectParameterivARB(disp) ((disp)->GetObjectParameterivARB) #define SET_GetObjectParameterivARB(disp, fn) ((disp)->GetObjectParameterivARB = fn) #define CALL_GetInfoLogARB(disp, parameters) (*((disp)->GetInfoLogARB)) parameters #define GET_GetInfoLogARB(disp) ((disp)->GetInfoLogARB) #define SET_GetInfoLogARB(disp, fn) ((disp)->GetInfoLogARB = fn) #define CALL_GetAttachedObjectsARB(disp, parameters) (*((disp)->GetAttachedObjectsARB)) parameters #define GET_GetAttachedObjectsARB(disp) ((disp)->GetAttachedObjectsARB) #define SET_GetAttachedObjectsARB(disp, fn) ((disp)->GetAttachedObjectsARB = fn) #define CALL_GetUniformLocationARB(disp, parameters) (*((disp)->GetUniformLocationARB)) parameters #define GET_GetUniformLocationARB(disp) ((disp)->GetUniformLocationARB) #define SET_GetUniformLocationARB(disp, fn) ((disp)->GetUniformLocationARB = fn) #define CALL_GetActiveUniformARB(disp, parameters) (*((disp)->GetActiveUniformARB)) parameters #define GET_GetActiveUniformARB(disp) ((disp)->GetActiveUniformARB) #define SET_GetActiveUniformARB(disp, fn) ((disp)->GetActiveUniformARB = fn) #define CALL_GetUniformfvARB(disp, parameters) (*((disp)->GetUniformfvARB)) parameters #define GET_GetUniformfvARB(disp) ((disp)->GetUniformfvARB) #define SET_GetUniformfvARB(disp, fn) ((disp)->GetUniformfvARB = fn) #define CALL_GetUniformivARB(disp, parameters) (*((disp)->GetUniformivARB)) parameters #define GET_GetUniformivARB(disp) ((disp)->GetUniformivARB) #define SET_GetUniformivARB(disp, fn) ((disp)->GetUniformivARB = fn) #define CALL_GetShaderSourceARB(disp, parameters) (*((disp)->GetShaderSourceARB)) parameters #define GET_GetShaderSourceARB(disp) ((disp)->GetShaderSourceARB) #define SET_GetShaderSourceARB(disp, fn) ((disp)->GetShaderSourceARB = fn) #define CALL_BindAttribLocationARB(disp, parameters) (*((disp)->BindAttribLocationARB)) parameters #define GET_BindAttribLocationARB(disp) ((disp)->BindAttribLocationARB) #define SET_BindAttribLocationARB(disp, fn) ((disp)->BindAttribLocationARB = fn) #define CALL_GetActiveAttribARB(disp, parameters) (*((disp)->GetActiveAttribARB)) parameters #define GET_GetActiveAttribARB(disp) ((disp)->GetActiveAttribARB) #define SET_GetActiveAttribARB(disp, fn) ((disp)->GetActiveAttribARB = fn) #define CALL_GetAttribLocationARB(disp, parameters) (*((disp)->GetAttribLocationARB)) parameters #define GET_GetAttribLocationARB(disp) ((disp)->GetAttribLocationARB) #define SET_GetAttribLocationARB(disp, fn) ((disp)->GetAttribLocationARB = fn) #define CALL_GetVertexAttribdvNV(disp, parameters) (*((disp)->GetVertexAttribdvNV)) parameters #define GET_GetVertexAttribdvNV(disp) ((disp)->GetVertexAttribdvNV) #define SET_GetVertexAttribdvNV(disp, fn) ((disp)->GetVertexAttribdvNV = fn) #define CALL_GetVertexAttribfvNV(disp, parameters) (*((disp)->GetVertexAttribfvNV)) parameters #define GET_GetVertexAttribfvNV(disp) ((disp)->GetVertexAttribfvNV) #define SET_GetVertexAttribfvNV(disp, fn) ((disp)->GetVertexAttribfvNV = fn) #define CALL_GetVertexAttribivNV(disp, parameters) (*((disp)->GetVertexAttribivNV)) parameters #define GET_GetVertexAttribivNV(disp) ((disp)->GetVertexAttribivNV) #define SET_GetVertexAttribivNV(disp, fn) ((disp)->GetVertexAttribivNV = fn) #define CALL_VertexAttrib1dNV(disp, parameters) (*((disp)->VertexAttrib1dNV)) parameters #define GET_VertexAttrib1dNV(disp) ((disp)->VertexAttrib1dNV) #define SET_VertexAttrib1dNV(disp, fn) ((disp)->VertexAttrib1dNV = fn) #define CALL_VertexAttrib1dvNV(disp, parameters) (*((disp)->VertexAttrib1dvNV)) parameters #define GET_VertexAttrib1dvNV(disp) ((disp)->VertexAttrib1dvNV) #define SET_VertexAttrib1dvNV(disp, fn) ((disp)->VertexAttrib1dvNV = fn) #define CALL_VertexAttrib1fNV(disp, parameters) (*((disp)->VertexAttrib1fNV)) parameters #define GET_VertexAttrib1fNV(disp) ((disp)->VertexAttrib1fNV) #define SET_VertexAttrib1fNV(disp, fn) ((disp)->VertexAttrib1fNV = fn) #define CALL_VertexAttrib1fvNV(disp, parameters) (*((disp)->VertexAttrib1fvNV)) parameters #define GET_VertexAttrib1fvNV(disp) ((disp)->VertexAttrib1fvNV) #define SET_VertexAttrib1fvNV(disp, fn) ((disp)->VertexAttrib1fvNV = fn) #define CALL_VertexAttrib1sNV(disp, parameters) (*((disp)->VertexAttrib1sNV)) parameters #define GET_VertexAttrib1sNV(disp) ((disp)->VertexAttrib1sNV) #define SET_VertexAttrib1sNV(disp, fn) ((disp)->VertexAttrib1sNV = fn) #define CALL_VertexAttrib1svNV(disp, parameters) (*((disp)->VertexAttrib1svNV)) parameters #define GET_VertexAttrib1svNV(disp) ((disp)->VertexAttrib1svNV) #define SET_VertexAttrib1svNV(disp, fn) ((disp)->VertexAttrib1svNV = fn) #define CALL_VertexAttrib2dNV(disp, parameters) (*((disp)->VertexAttrib2dNV)) parameters #define GET_VertexAttrib2dNV(disp) ((disp)->VertexAttrib2dNV) #define SET_VertexAttrib2dNV(disp, fn) ((disp)->VertexAttrib2dNV = fn) #define CALL_VertexAttrib2dvNV(disp, parameters) (*((disp)->VertexAttrib2dvNV)) parameters #define GET_VertexAttrib2dvNV(disp) ((disp)->VertexAttrib2dvNV) #define SET_VertexAttrib2dvNV(disp, fn) ((disp)->VertexAttrib2dvNV = fn) #define CALL_VertexAttrib2fNV(disp, parameters) (*((disp)->VertexAttrib2fNV)) parameters #define GET_VertexAttrib2fNV(disp) ((disp)->VertexAttrib2fNV) #define SET_VertexAttrib2fNV(disp, fn) ((disp)->VertexAttrib2fNV = fn) #define CALL_VertexAttrib2fvNV(disp, parameters) (*((disp)->VertexAttrib2fvNV)) parameters #define GET_VertexAttrib2fvNV(disp) ((disp)->VertexAttrib2fvNV) #define SET_VertexAttrib2fvNV(disp, fn) ((disp)->VertexAttrib2fvNV = fn) #define CALL_VertexAttrib2sNV(disp, parameters) (*((disp)->VertexAttrib2sNV)) parameters #define GET_VertexAttrib2sNV(disp) ((disp)->VertexAttrib2sNV) #define SET_VertexAttrib2sNV(disp, fn) ((disp)->VertexAttrib2sNV = fn) #define CALL_VertexAttrib2svNV(disp, parameters) (*((disp)->VertexAttrib2svNV)) parameters #define GET_VertexAttrib2svNV(disp) ((disp)->VertexAttrib2svNV) #define SET_VertexAttrib2svNV(disp, fn) ((disp)->VertexAttrib2svNV = fn) #define CALL_VertexAttrib3dNV(disp, parameters) (*((disp)->VertexAttrib3dNV)) parameters #define GET_VertexAttrib3dNV(disp) ((disp)->VertexAttrib3dNV) #define SET_VertexAttrib3dNV(disp, fn) ((disp)->VertexAttrib3dNV = fn) #define CALL_VertexAttrib3dvNV(disp, parameters) (*((disp)->VertexAttrib3dvNV)) parameters #define GET_VertexAttrib3dvNV(disp) ((disp)->VertexAttrib3dvNV) #define SET_VertexAttrib3dvNV(disp, fn) ((disp)->VertexAttrib3dvNV = fn) #define CALL_VertexAttrib3fNV(disp, parameters) (*((disp)->VertexAttrib3fNV)) parameters #define GET_VertexAttrib3fNV(disp) ((disp)->VertexAttrib3fNV) #define SET_VertexAttrib3fNV(disp, fn) ((disp)->VertexAttrib3fNV = fn) #define CALL_VertexAttrib3fvNV(disp, parameters) (*((disp)->VertexAttrib3fvNV)) parameters #define GET_VertexAttrib3fvNV(disp) ((disp)->VertexAttrib3fvNV) #define SET_VertexAttrib3fvNV(disp, fn) ((disp)->VertexAttrib3fvNV = fn) #define CALL_VertexAttrib3sNV(disp, parameters) (*((disp)->VertexAttrib3sNV)) parameters #define GET_VertexAttrib3sNV(disp) ((disp)->VertexAttrib3sNV) #define SET_VertexAttrib3sNV(disp, fn) ((disp)->VertexAttrib3sNV = fn) #define CALL_VertexAttrib3svNV(disp, parameters) (*((disp)->VertexAttrib3svNV)) parameters #define GET_VertexAttrib3svNV(disp) ((disp)->VertexAttrib3svNV) #define SET_VertexAttrib3svNV(disp, fn) ((disp)->VertexAttrib3svNV = fn) #define CALL_VertexAttrib4dNV(disp, parameters) (*((disp)->VertexAttrib4dNV)) parameters #define GET_VertexAttrib4dNV(disp) ((disp)->VertexAttrib4dNV) #define SET_VertexAttrib4dNV(disp, fn) ((disp)->VertexAttrib4dNV = fn) #define CALL_VertexAttrib4dvNV(disp, parameters) (*((disp)->VertexAttrib4dvNV)) parameters #define GET_VertexAttrib4dvNV(disp) ((disp)->VertexAttrib4dvNV) #define SET_VertexAttrib4dvNV(disp, fn) ((disp)->VertexAttrib4dvNV = fn) #define CALL_VertexAttrib4fNV(disp, parameters) (*((disp)->VertexAttrib4fNV)) parameters #define GET_VertexAttrib4fNV(disp) ((disp)->VertexAttrib4fNV) #define SET_VertexAttrib4fNV(disp, fn) ((disp)->VertexAttrib4fNV = fn) #define CALL_VertexAttrib4fvNV(disp, parameters) (*((disp)->VertexAttrib4fvNV)) parameters #define GET_VertexAttrib4fvNV(disp) ((disp)->VertexAttrib4fvNV) #define SET_VertexAttrib4fvNV(disp, fn) ((disp)->VertexAttrib4fvNV = fn) #define CALL_VertexAttrib4sNV(disp, parameters) (*((disp)->VertexAttrib4sNV)) parameters #define GET_VertexAttrib4sNV(disp) ((disp)->VertexAttrib4sNV) #define SET_VertexAttrib4sNV(disp, fn) ((disp)->VertexAttrib4sNV = fn) #define CALL_VertexAttrib4svNV(disp, parameters) (*((disp)->VertexAttrib4svNV)) parameters #define GET_VertexAttrib4svNV(disp) ((disp)->VertexAttrib4svNV) #define SET_VertexAttrib4svNV(disp, fn) ((disp)->VertexAttrib4svNV = fn) #define CALL_VertexAttrib4ubNV(disp, parameters) (*((disp)->VertexAttrib4ubNV)) parameters #define GET_VertexAttrib4ubNV(disp) ((disp)->VertexAttrib4ubNV) #define SET_VertexAttrib4ubNV(disp, fn) ((disp)->VertexAttrib4ubNV = fn) #define CALL_VertexAttrib4ubvNV(disp, parameters) (*((disp)->VertexAttrib4ubvNV)) parameters #define GET_VertexAttrib4ubvNV(disp) ((disp)->VertexAttrib4ubvNV) #define SET_VertexAttrib4ubvNV(disp, fn) ((disp)->VertexAttrib4ubvNV = fn) #define CALL_GenFragmentShadersATI(disp, parameters) (*((disp)->GenFragmentShadersATI)) parameters #define GET_GenFragmentShadersATI(disp) ((disp)->GenFragmentShadersATI) #define SET_GenFragmentShadersATI(disp, fn) ((disp)->GenFragmentShadersATI = fn) #define CALL_BindFragmentShaderATI(disp, parameters) (*((disp)->BindFragmentShaderATI)) parameters #define GET_BindFragmentShaderATI(disp) ((disp)->BindFragmentShaderATI) #define SET_BindFragmentShaderATI(disp, fn) ((disp)->BindFragmentShaderATI = fn) #define CALL_DeleteFragmentShaderATI(disp, parameters) (*((disp)->DeleteFragmentShaderATI)) parameters #define GET_DeleteFragmentShaderATI(disp) ((disp)->DeleteFragmentShaderATI) #define SET_DeleteFragmentShaderATI(disp, fn) ((disp)->DeleteFragmentShaderATI = fn) #define CALL_BeginFragmentShaderATI(disp, parameters) (*((disp)->BeginFragmentShaderATI)) parameters #define GET_BeginFragmentShaderATI(disp) ((disp)->BeginFragmentShaderATI) #define SET_BeginFragmentShaderATI(disp, fn) ((disp)->BeginFragmentShaderATI = fn) #define CALL_EndFragmentShaderATI(disp, parameters) (*((disp)->EndFragmentShaderATI)) parameters #define GET_EndFragmentShaderATI(disp) ((disp)->EndFragmentShaderATI) #define SET_EndFragmentShaderATI(disp, fn) ((disp)->EndFragmentShaderATI = fn) #define CALL_PassTexCoordATI(disp, parameters) (*((disp)->PassTexCoordATI)) parameters #define GET_PassTexCoordATI(disp) ((disp)->PassTexCoordATI) #define SET_PassTexCoordATI(disp, fn) ((disp)->PassTexCoordATI = fn) #define CALL_SampleMapATI(disp, parameters) (*((disp)->SampleMapATI)) parameters #define GET_SampleMapATI(disp) ((disp)->SampleMapATI) #define SET_SampleMapATI(disp, fn) ((disp)->SampleMapATI = fn) #define CALL_ColorFragmentOp1ATI(disp, parameters) (*((disp)->ColorFragmentOp1ATI)) parameters #define GET_ColorFragmentOp1ATI(disp) ((disp)->ColorFragmentOp1ATI) #define SET_ColorFragmentOp1ATI(disp, fn) ((disp)->ColorFragmentOp1ATI = fn) #define CALL_ColorFragmentOp2ATI(disp, parameters) (*((disp)->ColorFragmentOp2ATI)) parameters #define GET_ColorFragmentOp2ATI(disp) ((disp)->ColorFragmentOp2ATI) #define SET_ColorFragmentOp2ATI(disp, fn) ((disp)->ColorFragmentOp2ATI = fn) #define CALL_ColorFragmentOp3ATI(disp, parameters) (*((disp)->ColorFragmentOp3ATI)) parameters #define GET_ColorFragmentOp3ATI(disp) ((disp)->ColorFragmentOp3ATI) #define SET_ColorFragmentOp3ATI(disp, fn) ((disp)->ColorFragmentOp3ATI = fn) #define CALL_AlphaFragmentOp1ATI(disp, parameters) (*((disp)->AlphaFragmentOp1ATI)) parameters #define GET_AlphaFragmentOp1ATI(disp) ((disp)->AlphaFragmentOp1ATI) #define SET_AlphaFragmentOp1ATI(disp, fn) ((disp)->AlphaFragmentOp1ATI = fn) #define CALL_AlphaFragmentOp2ATI(disp, parameters) (*((disp)->AlphaFragmentOp2ATI)) parameters #define GET_AlphaFragmentOp2ATI(disp) ((disp)->AlphaFragmentOp2ATI) #define SET_AlphaFragmentOp2ATI(disp, fn) ((disp)->AlphaFragmentOp2ATI = fn) #define CALL_AlphaFragmentOp3ATI(disp, parameters) (*((disp)->AlphaFragmentOp3ATI)) parameters #define GET_AlphaFragmentOp3ATI(disp) ((disp)->AlphaFragmentOp3ATI) #define SET_AlphaFragmentOp3ATI(disp, fn) ((disp)->AlphaFragmentOp3ATI = fn) #define CALL_SetFragmentShaderConstantATI(disp, parameters) (*((disp)->SetFragmentShaderConstantATI)) parameters #define GET_SetFragmentShaderConstantATI(disp) ((disp)->SetFragmentShaderConstantATI) #define SET_SetFragmentShaderConstantATI(disp, fn) ((disp)->SetFragmentShaderConstantATI = fn) #define CALL_IsRenderbufferEXT(disp, parameters) (*((disp)->IsRenderbufferEXT)) parameters #define GET_IsRenderbufferEXT(disp) ((disp)->IsRenderbufferEXT) #define SET_IsRenderbufferEXT(disp, fn) ((disp)->IsRenderbufferEXT = fn) #define CALL_BindRenderbufferEXT(disp, parameters) (*((disp)->BindRenderbufferEXT)) parameters #define GET_BindRenderbufferEXT(disp) ((disp)->BindRenderbufferEXT) #define SET_BindRenderbufferEXT(disp, fn) ((disp)->BindRenderbufferEXT = fn) #define CALL_DeleteRenderbuffersEXT(disp, parameters) (*((disp)->DeleteRenderbuffersEXT)) parameters #define GET_DeleteRenderbuffersEXT(disp) ((disp)->DeleteRenderbuffersEXT) #define SET_DeleteRenderbuffersEXT(disp, fn) ((disp)->DeleteRenderbuffersEXT = fn) #define CALL_GenRenderbuffersEXT(disp, parameters) (*((disp)->GenRenderbuffersEXT)) parameters #define GET_GenRenderbuffersEXT(disp) ((disp)->GenRenderbuffersEXT) #define SET_GenRenderbuffersEXT(disp, fn) ((disp)->GenRenderbuffersEXT = fn) #define CALL_RenderbufferStorageEXT(disp, parameters) (*((disp)->RenderbufferStorageEXT)) parameters #define GET_RenderbufferStorageEXT(disp) ((disp)->RenderbufferStorageEXT) #define SET_RenderbufferStorageEXT(disp, fn) ((disp)->RenderbufferStorageEXT = fn) #define CALL_GetRenderbufferParameterivEXT(disp, parameters) (*((disp)->GetRenderbufferParameterivEXT)) parameters #define GET_GetRenderbufferParameterivEXT(disp) ((disp)->GetRenderbufferParameterivEXT) #define SET_GetRenderbufferParameterivEXT(disp, fn) ((disp)->GetRenderbufferParameterivEXT = fn) #define CALL_IsFramebufferEXT(disp, parameters) (*((disp)->IsFramebufferEXT)) parameters #define GET_IsFramebufferEXT(disp) ((disp)->IsFramebufferEXT) #define SET_IsFramebufferEXT(disp, fn) ((disp)->IsFramebufferEXT = fn) #define CALL_BindFramebufferEXT(disp, parameters) (*((disp)->BindFramebufferEXT)) parameters #define GET_BindFramebufferEXT(disp) ((disp)->BindFramebufferEXT) #define SET_BindFramebufferEXT(disp, fn) ((disp)->BindFramebufferEXT = fn) #define CALL_DeleteFramebuffersEXT(disp, parameters) (*((disp)->DeleteFramebuffersEXT)) parameters #define GET_DeleteFramebuffersEXT(disp) ((disp)->DeleteFramebuffersEXT) #define SET_DeleteFramebuffersEXT(disp, fn) ((disp)->DeleteFramebuffersEXT = fn) #define CALL_GenFramebuffersEXT(disp, parameters) (*((disp)->GenFramebuffersEXT)) parameters #define GET_GenFramebuffersEXT(disp) ((disp)->GenFramebuffersEXT) #define SET_GenFramebuffersEXT(disp, fn) ((disp)->GenFramebuffersEXT = fn) #define CALL_CheckFramebufferStatusEXT(disp, parameters) (*((disp)->CheckFramebufferStatusEXT)) parameters #define GET_CheckFramebufferStatusEXT(disp) ((disp)->CheckFramebufferStatusEXT) #define SET_CheckFramebufferStatusEXT(disp, fn) ((disp)->CheckFramebufferStatusEXT = fn) #define CALL_FramebufferTexture1DEXT(disp, parameters) (*((disp)->FramebufferTexture1DEXT)) parameters #define GET_FramebufferTexture1DEXT(disp) ((disp)->FramebufferTexture1DEXT) #define SET_FramebufferTexture1DEXT(disp, fn) ((disp)->FramebufferTexture1DEXT = fn) #define CALL_FramebufferTexture2DEXT(disp, parameters) (*((disp)->FramebufferTexture2DEXT)) parameters #define GET_FramebufferTexture2DEXT(disp) ((disp)->FramebufferTexture2DEXT) #define SET_FramebufferTexture2DEXT(disp, fn) ((disp)->FramebufferTexture2DEXT = fn) #define CALL_FramebufferTexture3DEXT(disp, parameters) (*((disp)->FramebufferTexture3DEXT)) parameters #define GET_FramebufferTexture3DEXT(disp) ((disp)->FramebufferTexture3DEXT) #define SET_FramebufferTexture3DEXT(disp, fn) ((disp)->FramebufferTexture3DEXT = fn) #define CALL_FramebufferRenderbufferEXT(disp, parameters) (*((disp)->FramebufferRenderbufferEXT)) parameters #define GET_FramebufferRenderbufferEXT(disp) ((disp)->FramebufferRenderbufferEXT) #define SET_FramebufferRenderbufferEXT(disp, fn) ((disp)->FramebufferRenderbufferEXT = fn) #define CALL_GetFramebufferAttachmentParameterivEXT(disp, parameters) (*((disp)->GetFramebufferAttachmentParameterivEXT)) parameters #define GET_GetFramebufferAttachmentParameterivEXT(disp) ((disp)->GetFramebufferAttachmentParameterivEXT) #define SET_GetFramebufferAttachmentParameterivEXT(disp, fn) ((disp)->GetFramebufferAttachmentParameterivEXT = fn) #define CALL_GenerateMipmapEXT(disp, parameters) (*((disp)->GenerateMipmapEXT)) parameters #define GET_GenerateMipmapEXT(disp) ((disp)->GenerateMipmapEXT) #define SET_GenerateMipmapEXT(disp, fn) ((disp)->GenerateMipmapEXT = fn) #define CALL_StencilFuncSeparate(disp, parameters) (*((disp)->StencilFuncSeparate)) parameters #define GET_StencilFuncSeparate(disp) ((disp)->StencilFuncSeparate) #define SET_StencilFuncSeparate(disp, fn) ((disp)->StencilFuncSeparate = fn) #define CALL_StencilOpSeparate(disp, parameters) (*((disp)->StencilOpSeparate)) parameters #define GET_StencilOpSeparate(disp) ((disp)->StencilOpSeparate) #define SET_StencilOpSeparate(disp, fn) ((disp)->StencilOpSeparate = fn) #define CALL_StencilMaskSeparate(disp, parameters) (*((disp)->StencilMaskSeparate)) parameters #define GET_StencilMaskSeparate(disp) ((disp)->StencilMaskSeparate) #define SET_StencilMaskSeparate(disp, fn) ((disp)->StencilMaskSeparate = fn) #else #define driDispatchRemapTable_size 408 extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define LoadTransposeMatrixfARB_remap_index 0 #define LoadTransposeMatrixdARB_remap_index 1 #define MultTransposeMatrixfARB_remap_index 2 #define MultTransposeMatrixdARB_remap_index 3 #define SampleCoverageARB_remap_index 4 #define DrawBuffersARB_remap_index 5 #define PolygonOffsetEXT_remap_index 6 #define GetTexFilterFuncSGIS_remap_index 7 #define TexFilterFuncSGIS_remap_index 8 #define GetHistogramEXT_remap_index 9 #define GetHistogramParameterfvEXT_remap_index 10 #define GetHistogramParameterivEXT_remap_index 11 #define GetMinmaxEXT_remap_index 12 #define GetMinmaxParameterfvEXT_remap_index 13 #define GetMinmaxParameterivEXT_remap_index 14 #define GetConvolutionFilterEXT_remap_index 15 #define GetConvolutionParameterfvEXT_remap_index 16 #define GetConvolutionParameterivEXT_remap_index 17 #define GetSeparableFilterEXT_remap_index 18 #define GetColorTableSGI_remap_index 19 #define GetColorTableParameterfvSGI_remap_index 20 #define GetColorTableParameterivSGI_remap_index 21 #define PixelTexGenSGIX_remap_index 22 #define PixelTexGenParameteriSGIS_remap_index 23 #define PixelTexGenParameterivSGIS_remap_index 24 #define PixelTexGenParameterfSGIS_remap_index 25 #define PixelTexGenParameterfvSGIS_remap_index 26 #define GetPixelTexGenParameterivSGIS_remap_index 27 #define GetPixelTexGenParameterfvSGIS_remap_index 28 #define TexImage4DSGIS_remap_index 29 #define TexSubImage4DSGIS_remap_index 30 #define AreTexturesResidentEXT_remap_index 31 #define GenTexturesEXT_remap_index 32 #define IsTextureEXT_remap_index 33 #define DetailTexFuncSGIS_remap_index 34 #define GetDetailTexFuncSGIS_remap_index 35 #define SharpenTexFuncSGIS_remap_index 36 #define GetSharpenTexFuncSGIS_remap_index 37 #define SampleMaskSGIS_remap_index 38 #define SamplePatternSGIS_remap_index 39 #define ColorPointerEXT_remap_index 40 #define EdgeFlagPointerEXT_remap_index 41 #define IndexPointerEXT_remap_index 42 #define NormalPointerEXT_remap_index 43 #define TexCoordPointerEXT_remap_index 44 #define VertexPointerEXT_remap_index 45 #define SpriteParameterfSGIX_remap_index 46 #define SpriteParameterfvSGIX_remap_index 47 #define SpriteParameteriSGIX_remap_index 48 #define SpriteParameterivSGIX_remap_index 49 #define PointParameterfEXT_remap_index 50 #define PointParameterfvEXT_remap_index 51 #define GetInstrumentsSGIX_remap_index 52 #define InstrumentsBufferSGIX_remap_index 53 #define PollInstrumentsSGIX_remap_index 54 #define ReadInstrumentsSGIX_remap_index 55 #define StartInstrumentsSGIX_remap_index 56 #define StopInstrumentsSGIX_remap_index 57 #define FrameZoomSGIX_remap_index 58 #define TagSampleBufferSGIX_remap_index 59 #define ReferencePlaneSGIX_remap_index 60 #define FlushRasterSGIX_remap_index 61 #define GetListParameterfvSGIX_remap_index 62 #define GetListParameterivSGIX_remap_index 63 #define ListParameterfSGIX_remap_index 64 #define ListParameterfvSGIX_remap_index 65 #define ListParameteriSGIX_remap_index 66 #define ListParameterivSGIX_remap_index 67 #define FragmentColorMaterialSGIX_remap_index 68 #define FragmentLightfSGIX_remap_index 69 #define FragmentLightfvSGIX_remap_index 70 #define FragmentLightiSGIX_remap_index 71 #define FragmentLightivSGIX_remap_index 72 #define FragmentLightModelfSGIX_remap_index 73 #define FragmentLightModelfvSGIX_remap_index 74 #define FragmentLightModeliSGIX_remap_index 75 #define FragmentLightModelivSGIX_remap_index 76 #define FragmentMaterialfSGIX_remap_index 77 #define FragmentMaterialfvSGIX_remap_index 78 #define FragmentMaterialiSGIX_remap_index 79 #define FragmentMaterialivSGIX_remap_index 80 #define GetFragmentLightfvSGIX_remap_index 81 #define GetFragmentLightivSGIX_remap_index 82 #define GetFragmentMaterialfvSGIX_remap_index 83 #define GetFragmentMaterialivSGIX_remap_index 84 #define LightEnviSGIX_remap_index 85 #define VertexWeightfEXT_remap_index 86 #define VertexWeightfvEXT_remap_index 87 #define VertexWeightPointerEXT_remap_index 88 #define FlushVertexArrayRangeNV_remap_index 89 #define VertexArrayRangeNV_remap_index 90 #define CombinerParameterfvNV_remap_index 91 #define CombinerParameterfNV_remap_index 92 #define CombinerParameterivNV_remap_index 93 #define CombinerParameteriNV_remap_index 94 #define CombinerInputNV_remap_index 95 #define CombinerOutputNV_remap_index 96 #define FinalCombinerInputNV_remap_index 97 #define GetCombinerInputParameterfvNV_remap_index 98 #define GetCombinerInputParameterivNV_remap_index 99 #define GetCombinerOutputParameterfvNV_remap_index 100 #define GetCombinerOutputParameterivNV_remap_index 101 #define GetFinalCombinerInputParameterfvNV_remap_index 102 #define GetFinalCombinerInputParameterivNV_remap_index 103 #define ResizeBuffersMESA_remap_index 104 #define WindowPos2dMESA_remap_index 105 #define WindowPos2dvMESA_remap_index 106 #define WindowPos2fMESA_remap_index 107 #define WindowPos2fvMESA_remap_index 108 #define WindowPos2iMESA_remap_index 109 #define WindowPos2ivMESA_remap_index 110 #define WindowPos2sMESA_remap_index 111 #define WindowPos2svMESA_remap_index 112 #define WindowPos3dMESA_remap_index 113 #define WindowPos3dvMESA_remap_index 114 #define WindowPos3fMESA_remap_index 115 #define WindowPos3fvMESA_remap_index 116 #define WindowPos3iMESA_remap_index 117 #define WindowPos3ivMESA_remap_index 118 #define WindowPos3sMESA_remap_index 119 #define WindowPos3svMESA_remap_index 120 #define WindowPos4dMESA_remap_index 121 #define WindowPos4dvMESA_remap_index 122 #define WindowPos4fMESA_remap_index 123 #define WindowPos4fvMESA_remap_index 124 #define WindowPos4iMESA_remap_index 125 #define WindowPos4ivMESA_remap_index 126 #define WindowPos4sMESA_remap_index 127 #define WindowPos4svMESA_remap_index 128 #define BlendFuncSeparateEXT_remap_index 129 #define IndexMaterialEXT_remap_index 130 #define IndexFuncEXT_remap_index 131 #define LockArraysEXT_remap_index 132 #define UnlockArraysEXT_remap_index 133 #define CullParameterdvEXT_remap_index 134 #define CullParameterfvEXT_remap_index 135 #define HintPGI_remap_index 136 #define FogCoordfEXT_remap_index 137 #define FogCoordfvEXT_remap_index 138 #define FogCoorddEXT_remap_index 139 #define FogCoorddvEXT_remap_index 140 #define FogCoordPointerEXT_remap_index 141 #define GetColorTableEXT_remap_index 142 #define GetColorTableParameterivEXT_remap_index 143 #define GetColorTableParameterfvEXT_remap_index 144 #define TbufferMask3DFX_remap_index 145 #define CompressedTexImage3DARB_remap_index 146 #define CompressedTexImage2DARB_remap_index 147 #define CompressedTexImage1DARB_remap_index 148 #define CompressedTexSubImage3DARB_remap_index 149 #define CompressedTexSubImage2DARB_remap_index 150 #define CompressedTexSubImage1DARB_remap_index 151 #define GetCompressedTexImageARB_remap_index 152 #define SecondaryColor3bEXT_remap_index 153 #define SecondaryColor3bvEXT_remap_index 154 #define SecondaryColor3dEXT_remap_index 155 #define SecondaryColor3dvEXT_remap_index 156 #define SecondaryColor3fEXT_remap_index 157 #define SecondaryColor3fvEXT_remap_index 158 #define SecondaryColor3iEXT_remap_index 159 #define SecondaryColor3ivEXT_remap_index 160 #define SecondaryColor3sEXT_remap_index 161 #define SecondaryColor3svEXT_remap_index 162 #define SecondaryColor3ubEXT_remap_index 163 #define SecondaryColor3ubvEXT_remap_index 164 #define SecondaryColor3uiEXT_remap_index 165 #define SecondaryColor3uivEXT_remap_index 166 #define SecondaryColor3usEXT_remap_index 167 #define SecondaryColor3usvEXT_remap_index 168 #define SecondaryColorPointerEXT_remap_index 169 #define AreProgramsResidentNV_remap_index 170 #define BindProgramNV_remap_index 171 #define DeleteProgramsNV_remap_index 172 #define ExecuteProgramNV_remap_index 173 #define GenProgramsNV_remap_index 174 #define GetProgramParameterdvNV_remap_index 175 #define GetProgramParameterfvNV_remap_index 176 #define GetProgramivNV_remap_index 177 #define GetProgramStringNV_remap_index 178 #define GetTrackMatrixivNV_remap_index 179 #define GetVertexAttribdvARB_remap_index 180 #define GetVertexAttribfvARB_remap_index 181 #define GetVertexAttribivARB_remap_index 182 #define GetVertexAttribPointervNV_remap_index 183 #define IsProgramNV_remap_index 184 #define LoadProgramNV_remap_index 185 #define ProgramParameter4dNV_remap_index 186 #define ProgramParameter4dvNV_remap_index 187 #define ProgramParameter4fNV_remap_index 188 #define ProgramParameter4fvNV_remap_index 189 #define ProgramParameters4dvNV_remap_index 190 #define ProgramParameters4fvNV_remap_index 191 #define RequestResidentProgramsNV_remap_index 192 #define TrackMatrixNV_remap_index 193 #define VertexAttribPointerNV_remap_index 194 #define VertexAttrib1dARB_remap_index 195 #define VertexAttrib1dvARB_remap_index 196 #define VertexAttrib1fARB_remap_index 197 #define VertexAttrib1fvARB_remap_index 198 #define VertexAttrib1sARB_remap_index 199 #define VertexAttrib1svARB_remap_index 200 #define VertexAttrib2dARB_remap_index 201 #define VertexAttrib2dvARB_remap_index 202 #define VertexAttrib2fARB_remap_index 203 #define VertexAttrib2fvARB_remap_index 204 #define VertexAttrib2sARB_remap_index 205 #define VertexAttrib2svARB_remap_index 206 #define VertexAttrib3dARB_remap_index 207 #define VertexAttrib3dvARB_remap_index 208 #define VertexAttrib3fARB_remap_index 209 #define VertexAttrib3fvARB_remap_index 210 #define VertexAttrib3sARB_remap_index 211 #define VertexAttrib3svARB_remap_index 212 #define VertexAttrib4dARB_remap_index 213 #define VertexAttrib4dvARB_remap_index 214 #define VertexAttrib4fARB_remap_index 215 #define VertexAttrib4fvARB_remap_index 216 #define VertexAttrib4sARB_remap_index 217 #define VertexAttrib4svARB_remap_index 218 #define VertexAttrib4NubARB_remap_index 219 #define VertexAttrib4NubvARB_remap_index 220 #define VertexAttribs1dvNV_remap_index 221 #define VertexAttribs1fvNV_remap_index 222 #define VertexAttribs1svNV_remap_index 223 #define VertexAttribs2dvNV_remap_index 224 #define VertexAttribs2fvNV_remap_index 225 #define VertexAttribs2svNV_remap_index 226 #define VertexAttribs3dvNV_remap_index 227 #define VertexAttribs3fvNV_remap_index 228 #define VertexAttribs3svNV_remap_index 229 #define VertexAttribs4dvNV_remap_index 230 #define VertexAttribs4fvNV_remap_index 231 #define VertexAttribs4svNV_remap_index 232 #define VertexAttribs4ubvNV_remap_index 233 #define PointParameteriNV_remap_index 234 #define PointParameterivNV_remap_index 235 #define MultiDrawArraysEXT_remap_index 236 #define MultiDrawElementsEXT_remap_index 237 #define ActiveStencilFaceEXT_remap_index 238 #define DeleteFencesNV_remap_index 239 #define GenFencesNV_remap_index 240 #define IsFenceNV_remap_index 241 #define TestFenceNV_remap_index 242 #define GetFenceivNV_remap_index 243 #define FinishFenceNV_remap_index 244 #define SetFenceNV_remap_index 245 #define VertexAttrib4bvARB_remap_index 246 #define VertexAttrib4ivARB_remap_index 247 #define VertexAttrib4ubvARB_remap_index 248 #define VertexAttrib4usvARB_remap_index 249 #define VertexAttrib4uivARB_remap_index 250 #define VertexAttrib4NbvARB_remap_index 251 #define VertexAttrib4NsvARB_remap_index 252 #define VertexAttrib4NivARB_remap_index 253 #define VertexAttrib4NusvARB_remap_index 254 #define VertexAttrib4NuivARB_remap_index 255 #define VertexAttribPointerARB_remap_index 256 #define EnableVertexAttribArrayARB_remap_index 257 #define DisableVertexAttribArrayARB_remap_index 258 #define ProgramStringARB_remap_index 259 #define ProgramEnvParameter4dARB_remap_index 260 #define ProgramEnvParameter4dvARB_remap_index 261 #define ProgramEnvParameter4fARB_remap_index 262 #define ProgramEnvParameter4fvARB_remap_index 263 #define ProgramLocalParameter4dARB_remap_index 264 #define ProgramLocalParameter4dvARB_remap_index 265 #define ProgramLocalParameter4fARB_remap_index 266 #define ProgramLocalParameter4fvARB_remap_index 267 #define GetProgramEnvParameterdvARB_remap_index 268 #define GetProgramEnvParameterfvARB_remap_index 269 #define GetProgramLocalParameterdvARB_remap_index 270 #define GetProgramLocalParameterfvARB_remap_index 271 #define GetProgramivARB_remap_index 272 #define GetProgramStringARB_remap_index 273 #define ProgramNamedParameter4fNV_remap_index 274 #define ProgramNamedParameter4dNV_remap_index 275 #define ProgramNamedParameter4fvNV_remap_index 276 #define ProgramNamedParameter4dvNV_remap_index 277 #define GetProgramNamedParameterfvNV_remap_index 278 #define GetProgramNamedParameterdvNV_remap_index 279 #define BindBufferARB_remap_index 280 #define BufferDataARB_remap_index 281 #define BufferSubDataARB_remap_index 282 #define DeleteBuffersARB_remap_index 283 #define GenBuffersARB_remap_index 284 #define GetBufferParameterivARB_remap_index 285 #define GetBufferPointervARB_remap_index 286 #define GetBufferSubDataARB_remap_index 287 #define IsBufferARB_remap_index 288 #define MapBufferARB_remap_index 289 #define UnmapBufferARB_remap_index 290 #define DepthBoundsEXT_remap_index 291 #define GenQueriesARB_remap_index 292 #define DeleteQueriesARB_remap_index 293 #define IsQueryARB_remap_index 294 #define BeginQueryARB_remap_index 295 #define EndQueryARB_remap_index 296 #define GetQueryivARB_remap_index 297 #define GetQueryObjectivARB_remap_index 298 #define GetQueryObjectuivARB_remap_index 299 #define MultiModeDrawArraysIBM_remap_index 300 #define MultiModeDrawElementsIBM_remap_index 301 #define BlendEquationSeparateEXT_remap_index 302 #define DeleteObjectARB_remap_index 303 #define GetHandleARB_remap_index 304 #define DetachObjectARB_remap_index 305 #define CreateShaderObjectARB_remap_index 306 #define ShaderSourceARB_remap_index 307 #define CompileShaderARB_remap_index 308 #define CreateProgramObjectARB_remap_index 309 #define AttachObjectARB_remap_index 310 #define LinkProgramARB_remap_index 311 #define UseProgramObjectARB_remap_index 312 #define ValidateProgramARB_remap_index 313 #define Uniform1fARB_remap_index 314 #define Uniform2fARB_remap_index 315 #define Uniform3fARB_remap_index 316 #define Uniform4fARB_remap_index 317 #define Uniform1iARB_remap_index 318 #define Uniform2iARB_remap_index 319 #define Uniform3iARB_remap_index 320 #define Uniform4iARB_remap_index 321 #define Uniform1fvARB_remap_index 322 #define Uniform2fvARB_remap_index 323 #define Uniform3fvARB_remap_index 324 #define Uniform4fvARB_remap_index 325 #define Uniform1ivARB_remap_index 326 #define Uniform2ivARB_remap_index 327 #define Uniform3ivARB_remap_index 328 #define Uniform4ivARB_remap_index 329 #define UniformMatrix2fvARB_remap_index 330 #define UniformMatrix3fvARB_remap_index 331 #define UniformMatrix4fvARB_remap_index 332 #define GetObjectParameterfvARB_remap_index 333 #define GetObjectParameterivARB_remap_index 334 #define GetInfoLogARB_remap_index 335 #define GetAttachedObjectsARB_remap_index 336 #define GetUniformLocationARB_remap_index 337 #define GetActiveUniformARB_remap_index 338 #define GetUniformfvARB_remap_index 339 #define GetUniformivARB_remap_index 340 #define GetShaderSourceARB_remap_index 341 #define BindAttribLocationARB_remap_index 342 #define GetActiveAttribARB_remap_index 343 #define GetAttribLocationARB_remap_index 344 #define GetVertexAttribdvNV_remap_index 345 #define GetVertexAttribfvNV_remap_index 346 #define GetVertexAttribivNV_remap_index 347 #define VertexAttrib1dNV_remap_index 348 #define VertexAttrib1dvNV_remap_index 349 #define VertexAttrib1fNV_remap_index 350 #define VertexAttrib1fvNV_remap_index 351 #define VertexAttrib1sNV_remap_index 352 #define VertexAttrib1svNV_remap_index 353 #define VertexAttrib2dNV_remap_index 354 #define VertexAttrib2dvNV_remap_index 355 #define VertexAttrib2fNV_remap_index 356 #define VertexAttrib2fvNV_remap_index 357 #define VertexAttrib2sNV_remap_index 358 #define VertexAttrib2svNV_remap_index 359 #define VertexAttrib3dNV_remap_index 360 #define VertexAttrib3dvNV_remap_index 361 #define VertexAttrib3fNV_remap_index 362 #define VertexAttrib3fvNV_remap_index 363 #define VertexAttrib3sNV_remap_index 364 #define VertexAttrib3svNV_remap_index 365 #define VertexAttrib4dNV_remap_index 366 #define VertexAttrib4dvNV_remap_index 367 #define VertexAttrib4fNV_remap_index 368 #define VertexAttrib4fvNV_remap_index 369 #define VertexAttrib4sNV_remap_index 370 #define VertexAttrib4svNV_remap_index 371 #define VertexAttrib4ubNV_remap_index 372 #define VertexAttrib4ubvNV_remap_index 373 #define GenFragmentShadersATI_remap_index 374 #define BindFragmentShaderATI_remap_index 375 #define DeleteFragmentShaderATI_remap_index 376 #define BeginFragmentShaderATI_remap_index 377 #define EndFragmentShaderATI_remap_index 378 #define PassTexCoordATI_remap_index 379 #define SampleMapATI_remap_index 380 #define ColorFragmentOp1ATI_remap_index 381 #define ColorFragmentOp2ATI_remap_index 382 #define ColorFragmentOp3ATI_remap_index 383 #define AlphaFragmentOp1ATI_remap_index 384 #define AlphaFragmentOp2ATI_remap_index 385 #define AlphaFragmentOp3ATI_remap_index 386 #define SetFragmentShaderConstantATI_remap_index 387 #define IsRenderbufferEXT_remap_index 388 #define BindRenderbufferEXT_remap_index 389 #define DeleteRenderbuffersEXT_remap_index 390 #define GenRenderbuffersEXT_remap_index 391 #define RenderbufferStorageEXT_remap_index 392 #define GetRenderbufferParameterivEXT_remap_index 393 #define IsFramebufferEXT_remap_index 394 #define BindFramebufferEXT_remap_index 395 #define DeleteFramebuffersEXT_remap_index 396 #define GenFramebuffersEXT_remap_index 397 #define CheckFramebufferStatusEXT_remap_index 398 #define FramebufferTexture1DEXT_remap_index 399 #define FramebufferTexture2DEXT_remap_index 400 #define FramebufferTexture3DEXT_remap_index 401 #define FramebufferRenderbufferEXT_remap_index 402 #define GetFramebufferAttachmentParameterivEXT_remap_index 403 #define GenerateMipmapEXT_remap_index 404 #define StencilFuncSeparate_remap_index 405 #define StencilOpSeparate_remap_index 406 #define StencilMaskSeparate_remap_index 407 #define CALL_LoadTransposeMatrixfARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index], parameters) #define GET_LoadTransposeMatrixfARB(disp) GET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index]) #define SET_LoadTransposeMatrixfARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index], fn) #define CALL_LoadTransposeMatrixdARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index], parameters) #define GET_LoadTransposeMatrixdARB(disp) GET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index]) #define SET_LoadTransposeMatrixdARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index], fn) #define CALL_MultTransposeMatrixfARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[MultTransposeMatrixfARB_remap_index], parameters) #define GET_MultTransposeMatrixfARB(disp) GET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixfARB_remap_index]) #define SET_MultTransposeMatrixfARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixfARB_remap_index], fn) #define CALL_MultTransposeMatrixdARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[MultTransposeMatrixdARB_remap_index], parameters) #define GET_MultTransposeMatrixdARB(disp) GET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixdARB_remap_index]) #define SET_MultTransposeMatrixdARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixdARB_remap_index], fn) #define CALL_SampleCoverageARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLclampf, GLboolean)), driDispatchRemapTable[SampleCoverageARB_remap_index], parameters) #define GET_SampleCoverageARB(disp) GET_by_offset(disp, driDispatchRemapTable[SampleCoverageARB_remap_index]) #define SET_SampleCoverageARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SampleCoverageARB_remap_index], fn) #define CALL_DrawBuffersARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLenum *)), driDispatchRemapTable[DrawBuffersARB_remap_index], parameters) #define GET_DrawBuffersARB(disp) GET_by_offset(disp, driDispatchRemapTable[DrawBuffersARB_remap_index]) #define SET_DrawBuffersARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DrawBuffersARB_remap_index], fn) #define CALL_PolygonOffsetEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat)), driDispatchRemapTable[PolygonOffsetEXT_remap_index], parameters) #define GET_PolygonOffsetEXT(disp) GET_by_offset(disp, driDispatchRemapTable[PolygonOffsetEXT_remap_index]) #define SET_PolygonOffsetEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PolygonOffsetEXT_remap_index], fn) #define CALL_GetTexFilterFuncSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetTexFilterFuncSGIS_remap_index], parameters) #define GET_GetTexFilterFuncSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[GetTexFilterFuncSGIS_remap_index]) #define SET_GetTexFilterFuncSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTexFilterFuncSGIS_remap_index], fn) #define CALL_TexFilterFuncSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLsizei, const GLfloat *)), driDispatchRemapTable[TexFilterFuncSGIS_remap_index], parameters) #define GET_TexFilterFuncSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[TexFilterFuncSGIS_remap_index]) #define SET_TexFilterFuncSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexFilterFuncSGIS_remap_index], fn) #define CALL_GetHistogramEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLboolean, GLenum, GLenum, GLvoid *)), driDispatchRemapTable[GetHistogramEXT_remap_index], parameters) #define GET_GetHistogramEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetHistogramEXT_remap_index]) #define SET_GetHistogramEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetHistogramEXT_remap_index], fn) #define CALL_GetHistogramParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetHistogramParameterfvEXT_remap_index], parameters) #define GET_GetHistogramParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetHistogramParameterfvEXT_remap_index]) #define SET_GetHistogramParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetHistogramParameterfvEXT_remap_index], fn) #define CALL_GetHistogramParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetHistogramParameterivEXT_remap_index], parameters) #define GET_GetHistogramParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetHistogramParameterivEXT_remap_index]) #define SET_GetHistogramParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetHistogramParameterivEXT_remap_index], fn) #define CALL_GetMinmaxEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLboolean, GLenum, GLenum, GLvoid *)), driDispatchRemapTable[GetMinmaxEXT_remap_index], parameters) #define GET_GetMinmaxEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetMinmaxEXT_remap_index]) #define SET_GetMinmaxEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetMinmaxEXT_remap_index], fn) #define CALL_GetMinmaxParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetMinmaxParameterfvEXT_remap_index], parameters) #define GET_GetMinmaxParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetMinmaxParameterfvEXT_remap_index]) #define SET_GetMinmaxParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetMinmaxParameterfvEXT_remap_index], fn) #define CALL_GetMinmaxParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetMinmaxParameterivEXT_remap_index], parameters) #define GET_GetMinmaxParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetMinmaxParameterivEXT_remap_index]) #define SET_GetMinmaxParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetMinmaxParameterivEXT_remap_index], fn) #define CALL_GetConvolutionFilterEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLvoid *)), driDispatchRemapTable[GetConvolutionFilterEXT_remap_index], parameters) #define GET_GetConvolutionFilterEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetConvolutionFilterEXT_remap_index]) #define SET_GetConvolutionFilterEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetConvolutionFilterEXT_remap_index], fn) #define CALL_GetConvolutionParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetConvolutionParameterfvEXT_remap_index], parameters) #define GET_GetConvolutionParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetConvolutionParameterfvEXT_remap_index]) #define SET_GetConvolutionParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetConvolutionParameterfvEXT_remap_index], fn) #define CALL_GetConvolutionParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetConvolutionParameterivEXT_remap_index], parameters) #define GET_GetConvolutionParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetConvolutionParameterivEXT_remap_index]) #define SET_GetConvolutionParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetConvolutionParameterivEXT_remap_index], fn) #define CALL_GetSeparableFilterEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *)), driDispatchRemapTable[GetSeparableFilterEXT_remap_index], parameters) #define GET_GetSeparableFilterEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetSeparableFilterEXT_remap_index]) #define SET_GetSeparableFilterEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetSeparableFilterEXT_remap_index], fn) #define CALL_GetColorTableSGI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLvoid *)), driDispatchRemapTable[GetColorTableSGI_remap_index], parameters) #define GET_GetColorTableSGI(disp) GET_by_offset(disp, driDispatchRemapTable[GetColorTableSGI_remap_index]) #define SET_GetColorTableSGI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetColorTableSGI_remap_index], fn) #define CALL_GetColorTableParameterfvSGI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetColorTableParameterfvSGI_remap_index], parameters) #define GET_GetColorTableParameterfvSGI(disp) GET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterfvSGI_remap_index]) #define SET_GetColorTableParameterfvSGI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterfvSGI_remap_index], fn) #define CALL_GetColorTableParameterivSGI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetColorTableParameterivSGI_remap_index], parameters) #define GET_GetColorTableParameterivSGI(disp) GET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterivSGI_remap_index]) #define SET_GetColorTableParameterivSGI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterivSGI_remap_index], fn) #define CALL_PixelTexGenSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[PixelTexGenSGIX_remap_index], parameters) #define GET_PixelTexGenSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenSGIX_remap_index]) #define SET_PixelTexGenSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenSGIX_remap_index], fn) #define CALL_PixelTexGenParameteriSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index], parameters) #define GET_PixelTexGenParameteriSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index]) #define SET_PixelTexGenParameteriSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index], fn) #define CALL_PixelTexGenParameterivSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index], parameters) #define GET_PixelTexGenParameterivSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index]) #define SET_PixelTexGenParameterivSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index], fn) #define CALL_PixelTexGenParameterfSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index], parameters) #define GET_PixelTexGenParameterfSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index]) #define SET_PixelTexGenParameterfSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index], fn) #define CALL_PixelTexGenParameterfvSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index], parameters) #define GET_PixelTexGenParameterfvSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index]) #define SET_PixelTexGenParameterfvSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index], fn) #define CALL_GetPixelTexGenParameterivSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint *)), driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index], parameters) #define GET_GetPixelTexGenParameterivSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index]) #define SET_GetPixelTexGenParameterivSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index], fn) #define CALL_GetPixelTexGenParameterfvSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index], parameters) #define GET_GetPixelTexGenParameterfvSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index]) #define SET_GetPixelTexGenParameterfvSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index], fn) #define CALL_TexImage4DSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)), driDispatchRemapTable[TexImage4DSGIS_remap_index], parameters) #define GET_TexImage4DSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[TexImage4DSGIS_remap_index]) #define SET_TexImage4DSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexImage4DSGIS_remap_index], fn) #define CALL_TexSubImage4DSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)), driDispatchRemapTable[TexSubImage4DSGIS_remap_index], parameters) #define GET_TexSubImage4DSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[TexSubImage4DSGIS_remap_index]) #define SET_TexSubImage4DSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexSubImage4DSGIS_remap_index], fn) #define CALL_AreTexturesResidentEXT(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLsizei, const GLuint *, GLboolean *)), driDispatchRemapTable[AreTexturesResidentEXT_remap_index], parameters) #define GET_AreTexturesResidentEXT(disp) GET_by_offset(disp, driDispatchRemapTable[AreTexturesResidentEXT_remap_index]) #define SET_AreTexturesResidentEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AreTexturesResidentEXT_remap_index], fn) #define CALL_GenTexturesEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenTexturesEXT_remap_index], parameters) #define GET_GenTexturesEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GenTexturesEXT_remap_index]) #define SET_GenTexturesEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenTexturesEXT_remap_index], fn) #define CALL_IsTextureEXT(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsTextureEXT_remap_index], parameters) #define GET_IsTextureEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IsTextureEXT_remap_index]) #define SET_IsTextureEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsTextureEXT_remap_index], fn) #define CALL_DetailTexFuncSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, const GLfloat *)), driDispatchRemapTable[DetailTexFuncSGIS_remap_index], parameters) #define GET_DetailTexFuncSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[DetailTexFuncSGIS_remap_index]) #define SET_DetailTexFuncSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DetailTexFuncSGIS_remap_index], fn) #define CALL_GetDetailTexFuncSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[GetDetailTexFuncSGIS_remap_index], parameters) #define GET_GetDetailTexFuncSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[GetDetailTexFuncSGIS_remap_index]) #define SET_GetDetailTexFuncSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetDetailTexFuncSGIS_remap_index], fn) #define CALL_SharpenTexFuncSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, const GLfloat *)), driDispatchRemapTable[SharpenTexFuncSGIS_remap_index], parameters) #define GET_SharpenTexFuncSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[SharpenTexFuncSGIS_remap_index]) #define SET_SharpenTexFuncSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SharpenTexFuncSGIS_remap_index], fn) #define CALL_GetSharpenTexFuncSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[GetSharpenTexFuncSGIS_remap_index], parameters) #define GET_GetSharpenTexFuncSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[GetSharpenTexFuncSGIS_remap_index]) #define SET_GetSharpenTexFuncSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetSharpenTexFuncSGIS_remap_index], fn) #define CALL_SampleMaskSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLclampf, GLboolean)), driDispatchRemapTable[SampleMaskSGIS_remap_index], parameters) #define GET_SampleMaskSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[SampleMaskSGIS_remap_index]) #define SET_SampleMaskSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SampleMaskSGIS_remap_index], fn) #define CALL_SamplePatternSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[SamplePatternSGIS_remap_index], parameters) #define GET_SamplePatternSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[SamplePatternSGIS_remap_index]) #define SET_SamplePatternSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SamplePatternSGIS_remap_index], fn) #define CALL_ColorPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[ColorPointerEXT_remap_index], parameters) #define GET_ColorPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ColorPointerEXT_remap_index]) #define SET_ColorPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorPointerEXT_remap_index], fn) #define CALL_EdgeFlagPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLsizei, const GLboolean *)), driDispatchRemapTable[EdgeFlagPointerEXT_remap_index], parameters) #define GET_EdgeFlagPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[EdgeFlagPointerEXT_remap_index]) #define SET_EdgeFlagPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EdgeFlagPointerEXT_remap_index], fn) #define CALL_IndexPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[IndexPointerEXT_remap_index], parameters) #define GET_IndexPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IndexPointerEXT_remap_index]) #define SET_IndexPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IndexPointerEXT_remap_index], fn) #define CALL_NormalPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[NormalPointerEXT_remap_index], parameters) #define GET_NormalPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[NormalPointerEXT_remap_index]) #define SET_NormalPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[NormalPointerEXT_remap_index], fn) #define CALL_TexCoordPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[TexCoordPointerEXT_remap_index], parameters) #define GET_TexCoordPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[TexCoordPointerEXT_remap_index]) #define SET_TexCoordPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexCoordPointerEXT_remap_index], fn) #define CALL_VertexPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[VertexPointerEXT_remap_index], parameters) #define GET_VertexPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[VertexPointerEXT_remap_index]) #define SET_VertexPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexPointerEXT_remap_index], fn) #define CALL_SpriteParameterfSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[SpriteParameterfSGIX_remap_index], parameters) #define GET_SpriteParameterfSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[SpriteParameterfSGIX_remap_index]) #define SET_SpriteParameterfSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SpriteParameterfSGIX_remap_index], fn) #define CALL_SpriteParameterfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[SpriteParameterfvSGIX_remap_index], parameters) #define GET_SpriteParameterfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[SpriteParameterfvSGIX_remap_index]) #define SET_SpriteParameterfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SpriteParameterfvSGIX_remap_index], fn) #define CALL_SpriteParameteriSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[SpriteParameteriSGIX_remap_index], parameters) #define GET_SpriteParameteriSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[SpriteParameteriSGIX_remap_index]) #define SET_SpriteParameteriSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SpriteParameteriSGIX_remap_index], fn) #define CALL_SpriteParameterivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[SpriteParameterivSGIX_remap_index], parameters) #define GET_SpriteParameterivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[SpriteParameterivSGIX_remap_index]) #define SET_SpriteParameterivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SpriteParameterivSGIX_remap_index], fn) #define CALL_PointParameterfEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[PointParameterfEXT_remap_index], parameters) #define GET_PointParameterfEXT(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameterfEXT_remap_index]) #define SET_PointParameterfEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameterfEXT_remap_index], fn) #define CALL_PointParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[PointParameterfvEXT_remap_index], parameters) #define GET_PointParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameterfvEXT_remap_index]) #define SET_PointParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameterfvEXT_remap_index], fn) #define CALL_GetInstrumentsSGIX(disp, parameters) CALL_by_offset(disp, (GLint (GLAPIENTRYP)(void)), driDispatchRemapTable[GetInstrumentsSGIX_remap_index], parameters) #define GET_GetInstrumentsSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[GetInstrumentsSGIX_remap_index]) #define SET_GetInstrumentsSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetInstrumentsSGIX_remap_index], fn) #define CALL_InstrumentsBufferSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLint *)), driDispatchRemapTable[InstrumentsBufferSGIX_remap_index], parameters) #define GET_InstrumentsBufferSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[InstrumentsBufferSGIX_remap_index]) #define SET_InstrumentsBufferSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[InstrumentsBufferSGIX_remap_index], fn) #define CALL_PollInstrumentsSGIX(disp, parameters) CALL_by_offset(disp, (GLint (GLAPIENTRYP)(GLint *)), driDispatchRemapTable[PollInstrumentsSGIX_remap_index], parameters) #define GET_PollInstrumentsSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[PollInstrumentsSGIX_remap_index]) #define SET_PollInstrumentsSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PollInstrumentsSGIX_remap_index], fn) #define CALL_ReadInstrumentsSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint)), driDispatchRemapTable[ReadInstrumentsSGIX_remap_index], parameters) #define GET_ReadInstrumentsSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[ReadInstrumentsSGIX_remap_index]) #define SET_ReadInstrumentsSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ReadInstrumentsSGIX_remap_index], fn) #define CALL_StartInstrumentsSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[StartInstrumentsSGIX_remap_index], parameters) #define GET_StartInstrumentsSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[StartInstrumentsSGIX_remap_index]) #define SET_StartInstrumentsSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StartInstrumentsSGIX_remap_index], fn) #define CALL_StopInstrumentsSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint)), driDispatchRemapTable[StopInstrumentsSGIX_remap_index], parameters) #define GET_StopInstrumentsSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[StopInstrumentsSGIX_remap_index]) #define SET_StopInstrumentsSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StopInstrumentsSGIX_remap_index], fn) #define CALL_FrameZoomSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint)), driDispatchRemapTable[FrameZoomSGIX_remap_index], parameters) #define GET_FrameZoomSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FrameZoomSGIX_remap_index]) #define SET_FrameZoomSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FrameZoomSGIX_remap_index], fn) #define CALL_TagSampleBufferSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[TagSampleBufferSGIX_remap_index], parameters) #define GET_TagSampleBufferSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[TagSampleBufferSGIX_remap_index]) #define SET_TagSampleBufferSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TagSampleBufferSGIX_remap_index], fn) #define CALL_ReferencePlaneSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[ReferencePlaneSGIX_remap_index], parameters) #define GET_ReferencePlaneSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[ReferencePlaneSGIX_remap_index]) #define SET_ReferencePlaneSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ReferencePlaneSGIX_remap_index], fn) #define CALL_FlushRasterSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[FlushRasterSGIX_remap_index], parameters) #define GET_FlushRasterSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FlushRasterSGIX_remap_index]) #define SET_FlushRasterSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FlushRasterSGIX_remap_index], fn) #define CALL_GetListParameterfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLfloat *)), driDispatchRemapTable[GetListParameterfvSGIX_remap_index], parameters) #define GET_GetListParameterfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[GetListParameterfvSGIX_remap_index]) #define SET_GetListParameterfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetListParameterfvSGIX_remap_index], fn) #define CALL_GetListParameterivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetListParameterivSGIX_remap_index], parameters) #define GET_GetListParameterivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[GetListParameterivSGIX_remap_index]) #define SET_GetListParameterivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetListParameterivSGIX_remap_index], fn) #define CALL_ListParameterfSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLfloat)), driDispatchRemapTable[ListParameterfSGIX_remap_index], parameters) #define GET_ListParameterfSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[ListParameterfSGIX_remap_index]) #define SET_ListParameterfSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ListParameterfSGIX_remap_index], fn) #define CALL_ListParameterfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, const GLfloat *)), driDispatchRemapTable[ListParameterfvSGIX_remap_index], parameters) #define GET_ListParameterfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[ListParameterfvSGIX_remap_index]) #define SET_ListParameterfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ListParameterfvSGIX_remap_index], fn) #define CALL_ListParameteriSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint)), driDispatchRemapTable[ListParameteriSGIX_remap_index], parameters) #define GET_ListParameteriSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[ListParameteriSGIX_remap_index]) #define SET_ListParameteriSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ListParameteriSGIX_remap_index], fn) #define CALL_ListParameterivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, const GLint *)), driDispatchRemapTable[ListParameterivSGIX_remap_index], parameters) #define GET_ListParameterivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[ListParameterivSGIX_remap_index]) #define SET_ListParameterivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ListParameterivSGIX_remap_index], fn) #define CALL_FragmentColorMaterialSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum)), driDispatchRemapTable[FragmentColorMaterialSGIX_remap_index], parameters) #define GET_FragmentColorMaterialSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentColorMaterialSGIX_remap_index]) #define SET_FragmentColorMaterialSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentColorMaterialSGIX_remap_index], fn) #define CALL_FragmentLightfSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat)), driDispatchRemapTable[FragmentLightfSGIX_remap_index], parameters) #define GET_FragmentLightfSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightfSGIX_remap_index]) #define SET_FragmentLightfSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightfSGIX_remap_index], fn) #define CALL_FragmentLightfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, const GLfloat *)), driDispatchRemapTable[FragmentLightfvSGIX_remap_index], parameters) #define GET_FragmentLightfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightfvSGIX_remap_index]) #define SET_FragmentLightfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightfvSGIX_remap_index], fn) #define CALL_FragmentLightiSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint)), driDispatchRemapTable[FragmentLightiSGIX_remap_index], parameters) #define GET_FragmentLightiSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightiSGIX_remap_index]) #define SET_FragmentLightiSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightiSGIX_remap_index], fn) #define CALL_FragmentLightivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, const GLint *)), driDispatchRemapTable[FragmentLightivSGIX_remap_index], parameters) #define GET_FragmentLightivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightivSGIX_remap_index]) #define SET_FragmentLightivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightivSGIX_remap_index], fn) #define CALL_FragmentLightModelfSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[FragmentLightModelfSGIX_remap_index], parameters) #define GET_FragmentLightModelfSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightModelfSGIX_remap_index]) #define SET_FragmentLightModelfSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightModelfSGIX_remap_index], fn) #define CALL_FragmentLightModelfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[FragmentLightModelfvSGIX_remap_index], parameters) #define GET_FragmentLightModelfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightModelfvSGIX_remap_index]) #define SET_FragmentLightModelfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightModelfvSGIX_remap_index], fn) #define CALL_FragmentLightModeliSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[FragmentLightModeliSGIX_remap_index], parameters) #define GET_FragmentLightModeliSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightModeliSGIX_remap_index]) #define SET_FragmentLightModeliSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightModeliSGIX_remap_index], fn) #define CALL_FragmentLightModelivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[FragmentLightModelivSGIX_remap_index], parameters) #define GET_FragmentLightModelivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentLightModelivSGIX_remap_index]) #define SET_FragmentLightModelivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentLightModelivSGIX_remap_index], fn) #define CALL_FragmentMaterialfSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat)), driDispatchRemapTable[FragmentMaterialfSGIX_remap_index], parameters) #define GET_FragmentMaterialfSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentMaterialfSGIX_remap_index]) #define SET_FragmentMaterialfSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentMaterialfSGIX_remap_index], fn) #define CALL_FragmentMaterialfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, const GLfloat *)), driDispatchRemapTable[FragmentMaterialfvSGIX_remap_index], parameters) #define GET_FragmentMaterialfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentMaterialfvSGIX_remap_index]) #define SET_FragmentMaterialfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentMaterialfvSGIX_remap_index], fn) #define CALL_FragmentMaterialiSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint)), driDispatchRemapTable[FragmentMaterialiSGIX_remap_index], parameters) #define GET_FragmentMaterialiSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentMaterialiSGIX_remap_index]) #define SET_FragmentMaterialiSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentMaterialiSGIX_remap_index], fn) #define CALL_FragmentMaterialivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, const GLint *)), driDispatchRemapTable[FragmentMaterialivSGIX_remap_index], parameters) #define GET_FragmentMaterialivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[FragmentMaterialivSGIX_remap_index]) #define SET_FragmentMaterialivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FragmentMaterialivSGIX_remap_index], fn) #define CALL_GetFragmentLightfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetFragmentLightfvSGIX_remap_index], parameters) #define GET_GetFragmentLightfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[GetFragmentLightfvSGIX_remap_index]) #define SET_GetFragmentLightfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFragmentLightfvSGIX_remap_index], fn) #define CALL_GetFragmentLightivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetFragmentLightivSGIX_remap_index], parameters) #define GET_GetFragmentLightivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[GetFragmentLightivSGIX_remap_index]) #define SET_GetFragmentLightivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFragmentLightivSGIX_remap_index], fn) #define CALL_GetFragmentMaterialfvSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetFragmentMaterialfvSGIX_remap_index], parameters) #define GET_GetFragmentMaterialfvSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[GetFragmentMaterialfvSGIX_remap_index]) #define SET_GetFragmentMaterialfvSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFragmentMaterialfvSGIX_remap_index], fn) #define CALL_GetFragmentMaterialivSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetFragmentMaterialivSGIX_remap_index], parameters) #define GET_GetFragmentMaterialivSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[GetFragmentMaterialivSGIX_remap_index]) #define SET_GetFragmentMaterialivSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFragmentMaterialivSGIX_remap_index], fn) #define CALL_LightEnviSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[LightEnviSGIX_remap_index], parameters) #define GET_LightEnviSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[LightEnviSGIX_remap_index]) #define SET_LightEnviSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LightEnviSGIX_remap_index], fn) #define CALL_VertexWeightfEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat)), driDispatchRemapTable[VertexWeightfEXT_remap_index], parameters) #define GET_VertexWeightfEXT(disp) GET_by_offset(disp, driDispatchRemapTable[VertexWeightfEXT_remap_index]) #define SET_VertexWeightfEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexWeightfEXT_remap_index], fn) #define CALL_VertexWeightfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[VertexWeightfvEXT_remap_index], parameters) #define GET_VertexWeightfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[VertexWeightfvEXT_remap_index]) #define SET_VertexWeightfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexWeightfvEXT_remap_index], fn) #define CALL_VertexWeightPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[VertexWeightPointerEXT_remap_index], parameters) #define GET_VertexWeightPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[VertexWeightPointerEXT_remap_index]) #define SET_VertexWeightPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexWeightPointerEXT_remap_index], fn) #define CALL_FlushVertexArrayRangeNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index], parameters) #define GET_FlushVertexArrayRangeNV(disp) GET_by_offset(disp, driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index]) #define SET_FlushVertexArrayRangeNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index], fn) #define CALL_VertexArrayRangeNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLvoid *)), driDispatchRemapTable[VertexArrayRangeNV_remap_index], parameters) #define GET_VertexArrayRangeNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexArrayRangeNV_remap_index]) #define SET_VertexArrayRangeNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexArrayRangeNV_remap_index], fn) #define CALL_CombinerParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[CombinerParameterfvNV_remap_index], parameters) #define GET_CombinerParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameterfvNV_remap_index]) #define SET_CombinerParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameterfvNV_remap_index], fn) #define CALL_CombinerParameterfNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[CombinerParameterfNV_remap_index], parameters) #define GET_CombinerParameterfNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameterfNV_remap_index]) #define SET_CombinerParameterfNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameterfNV_remap_index], fn) #define CALL_CombinerParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[CombinerParameterivNV_remap_index], parameters) #define GET_CombinerParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameterivNV_remap_index]) #define SET_CombinerParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameterivNV_remap_index], fn) #define CALL_CombinerParameteriNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[CombinerParameteriNV_remap_index], parameters) #define GET_CombinerParameteriNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameteriNV_remap_index]) #define SET_CombinerParameteriNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameteriNV_remap_index], fn) #define CALL_CombinerInputNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[CombinerInputNV_remap_index], parameters) #define GET_CombinerInputNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerInputNV_remap_index]) #define SET_CombinerInputNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerInputNV_remap_index], fn) #define CALL_CombinerOutputNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean)), driDispatchRemapTable[CombinerOutputNV_remap_index], parameters) #define GET_CombinerOutputNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerOutputNV_remap_index]) #define SET_CombinerOutputNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerOutputNV_remap_index], fn) #define CALL_FinalCombinerInputNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[FinalCombinerInputNV_remap_index], parameters) #define GET_FinalCombinerInputNV(disp) GET_by_offset(disp, driDispatchRemapTable[FinalCombinerInputNV_remap_index]) #define SET_FinalCombinerInputNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FinalCombinerInputNV_remap_index], fn) #define CALL_GetCombinerInputParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index], parameters) #define GET_GetCombinerInputParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index]) #define SET_GetCombinerInputParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index], fn) #define CALL_GetCombinerInputParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLint *)), driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index], parameters) #define GET_GetCombinerInputParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index]) #define SET_GetCombinerInputParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index], fn) #define CALL_GetCombinerOutputParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index], parameters) #define GET_GetCombinerOutputParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index]) #define SET_GetCombinerOutputParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index], fn) #define CALL_GetCombinerOutputParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLint *)), driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index], parameters) #define GET_GetCombinerOutputParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index]) #define SET_GetCombinerOutputParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index], fn) #define CALL_GetFinalCombinerInputParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index], parameters) #define GET_GetFinalCombinerInputParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index]) #define SET_GetFinalCombinerInputParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index], fn) #define CALL_GetFinalCombinerInputParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index], parameters) #define GET_GetFinalCombinerInputParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index]) #define SET_GetFinalCombinerInputParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index], fn) #define CALL_ResizeBuffersMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[ResizeBuffersMESA_remap_index], parameters) #define GET_ResizeBuffersMESA(disp) GET_by_offset(disp, driDispatchRemapTable[ResizeBuffersMESA_remap_index]) #define SET_ResizeBuffersMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ResizeBuffersMESA_remap_index], fn) #define CALL_WindowPos2dMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble)), driDispatchRemapTable[WindowPos2dMESA_remap_index], parameters) #define GET_WindowPos2dMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2dMESA_remap_index]) #define SET_WindowPos2dMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2dMESA_remap_index], fn) #define CALL_WindowPos2dvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[WindowPos2dvMESA_remap_index], parameters) #define GET_WindowPos2dvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2dvMESA_remap_index]) #define SET_WindowPos2dvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2dvMESA_remap_index], fn) #define CALL_WindowPos2fMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat)), driDispatchRemapTable[WindowPos2fMESA_remap_index], parameters) #define GET_WindowPos2fMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2fMESA_remap_index]) #define SET_WindowPos2fMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2fMESA_remap_index], fn) #define CALL_WindowPos2fvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[WindowPos2fvMESA_remap_index], parameters) #define GET_WindowPos2fvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2fvMESA_remap_index]) #define SET_WindowPos2fvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2fvMESA_remap_index], fn) #define CALL_WindowPos2iMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint)), driDispatchRemapTable[WindowPos2iMESA_remap_index], parameters) #define GET_WindowPos2iMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2iMESA_remap_index]) #define SET_WindowPos2iMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2iMESA_remap_index], fn) #define CALL_WindowPos2ivMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[WindowPos2ivMESA_remap_index], parameters) #define GET_WindowPos2ivMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2ivMESA_remap_index]) #define SET_WindowPos2ivMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2ivMESA_remap_index], fn) #define CALL_WindowPos2sMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort)), driDispatchRemapTable[WindowPos2sMESA_remap_index], parameters) #define GET_WindowPos2sMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2sMESA_remap_index]) #define SET_WindowPos2sMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2sMESA_remap_index], fn) #define CALL_WindowPos2svMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[WindowPos2svMESA_remap_index], parameters) #define GET_WindowPos2svMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2svMESA_remap_index]) #define SET_WindowPos2svMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2svMESA_remap_index], fn) #define CALL_WindowPos3dMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[WindowPos3dMESA_remap_index], parameters) #define GET_WindowPos3dMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3dMESA_remap_index]) #define SET_WindowPos3dMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3dMESA_remap_index], fn) #define CALL_WindowPos3dvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[WindowPos3dvMESA_remap_index], parameters) #define GET_WindowPos3dvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3dvMESA_remap_index]) #define SET_WindowPos3dvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3dvMESA_remap_index], fn) #define CALL_WindowPos3fMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[WindowPos3fMESA_remap_index], parameters) #define GET_WindowPos3fMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3fMESA_remap_index]) #define SET_WindowPos3fMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3fMESA_remap_index], fn) #define CALL_WindowPos3fvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[WindowPos3fvMESA_remap_index], parameters) #define GET_WindowPos3fvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3fvMESA_remap_index]) #define SET_WindowPos3fvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3fvMESA_remap_index], fn) #define CALL_WindowPos3iMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint)), driDispatchRemapTable[WindowPos3iMESA_remap_index], parameters) #define GET_WindowPos3iMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3iMESA_remap_index]) #define SET_WindowPos3iMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3iMESA_remap_index], fn) #define CALL_WindowPos3ivMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[WindowPos3ivMESA_remap_index], parameters) #define GET_WindowPos3ivMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3ivMESA_remap_index]) #define SET_WindowPos3ivMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3ivMESA_remap_index], fn) #define CALL_WindowPos3sMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort, GLshort)), driDispatchRemapTable[WindowPos3sMESA_remap_index], parameters) #define GET_WindowPos3sMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3sMESA_remap_index]) #define SET_WindowPos3sMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3sMESA_remap_index], fn) #define CALL_WindowPos3svMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[WindowPos3svMESA_remap_index], parameters) #define GET_WindowPos3svMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3svMESA_remap_index]) #define SET_WindowPos3svMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3svMESA_remap_index], fn) #define CALL_WindowPos4dMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[WindowPos4dMESA_remap_index], parameters) #define GET_WindowPos4dMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4dMESA_remap_index]) #define SET_WindowPos4dMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4dMESA_remap_index], fn) #define CALL_WindowPos4dvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[WindowPos4dvMESA_remap_index], parameters) #define GET_WindowPos4dvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4dvMESA_remap_index]) #define SET_WindowPos4dvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4dvMESA_remap_index], fn) #define CALL_WindowPos4fMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[WindowPos4fMESA_remap_index], parameters) #define GET_WindowPos4fMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4fMESA_remap_index]) #define SET_WindowPos4fMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4fMESA_remap_index], fn) #define CALL_WindowPos4fvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[WindowPos4fvMESA_remap_index], parameters) #define GET_WindowPos4fvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4fvMESA_remap_index]) #define SET_WindowPos4fvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4fvMESA_remap_index], fn) #define CALL_WindowPos4iMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint)), driDispatchRemapTable[WindowPos4iMESA_remap_index], parameters) #define GET_WindowPos4iMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4iMESA_remap_index]) #define SET_WindowPos4iMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4iMESA_remap_index], fn) #define CALL_WindowPos4ivMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[WindowPos4ivMESA_remap_index], parameters) #define GET_WindowPos4ivMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4ivMESA_remap_index]) #define SET_WindowPos4ivMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4ivMESA_remap_index], fn) #define CALL_WindowPos4sMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort, GLshort, GLshort)), driDispatchRemapTable[WindowPos4sMESA_remap_index], parameters) #define GET_WindowPos4sMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4sMESA_remap_index]) #define SET_WindowPos4sMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4sMESA_remap_index], fn) #define CALL_WindowPos4svMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[WindowPos4svMESA_remap_index], parameters) #define GET_WindowPos4svMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4svMESA_remap_index]) #define SET_WindowPos4svMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4svMESA_remap_index], fn) #define CALL_BlendFuncSeparateEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[BlendFuncSeparateEXT_remap_index], parameters) #define GET_BlendFuncSeparateEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BlendFuncSeparateEXT_remap_index]) #define SET_BlendFuncSeparateEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BlendFuncSeparateEXT_remap_index], fn) #define CALL_IndexMaterialEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum)), driDispatchRemapTable[IndexMaterialEXT_remap_index], parameters) #define GET_IndexMaterialEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IndexMaterialEXT_remap_index]) #define SET_IndexMaterialEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IndexMaterialEXT_remap_index], fn) #define CALL_IndexFuncEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLclampf)), driDispatchRemapTable[IndexFuncEXT_remap_index], parameters) #define GET_IndexFuncEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IndexFuncEXT_remap_index]) #define SET_IndexFuncEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IndexFuncEXT_remap_index], fn) #define CALL_LockArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei)), driDispatchRemapTable[LockArraysEXT_remap_index], parameters) #define GET_LockArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[LockArraysEXT_remap_index]) #define SET_LockArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LockArraysEXT_remap_index], fn) #define CALL_UnlockArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[UnlockArraysEXT_remap_index], parameters) #define GET_UnlockArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[UnlockArraysEXT_remap_index]) #define SET_UnlockArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UnlockArraysEXT_remap_index], fn) #define CALL_CullParameterdvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLdouble *)), driDispatchRemapTable[CullParameterdvEXT_remap_index], parameters) #define GET_CullParameterdvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[CullParameterdvEXT_remap_index]) #define SET_CullParameterdvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CullParameterdvEXT_remap_index], fn) #define CALL_CullParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[CullParameterfvEXT_remap_index], parameters) #define GET_CullParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[CullParameterfvEXT_remap_index]) #define SET_CullParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CullParameterfvEXT_remap_index], fn) #define CALL_HintPGI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[HintPGI_remap_index], parameters) #define GET_HintPGI(disp) GET_by_offset(disp, driDispatchRemapTable[HintPGI_remap_index]) #define SET_HintPGI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[HintPGI_remap_index], fn) #define CALL_FogCoordfEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat)), driDispatchRemapTable[FogCoordfEXT_remap_index], parameters) #define GET_FogCoordfEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoordfEXT_remap_index]) #define SET_FogCoordfEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoordfEXT_remap_index], fn) #define CALL_FogCoordfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[FogCoordfvEXT_remap_index], parameters) #define GET_FogCoordfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoordfvEXT_remap_index]) #define SET_FogCoordfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoordfvEXT_remap_index], fn) #define CALL_FogCoorddEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble)), driDispatchRemapTable[FogCoorddEXT_remap_index], parameters) #define GET_FogCoorddEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoorddEXT_remap_index]) #define SET_FogCoorddEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoorddEXT_remap_index], fn) #define CALL_FogCoorddvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[FogCoorddvEXT_remap_index], parameters) #define GET_FogCoorddvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoorddvEXT_remap_index]) #define SET_FogCoorddvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoorddvEXT_remap_index], fn) #define CALL_FogCoordPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[FogCoordPointerEXT_remap_index], parameters) #define GET_FogCoordPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoordPointerEXT_remap_index]) #define SET_FogCoordPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoordPointerEXT_remap_index], fn) #define CALL_GetColorTableEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLvoid *)), driDispatchRemapTable[GetColorTableEXT_remap_index], parameters) #define GET_GetColorTableEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetColorTableEXT_remap_index]) #define SET_GetColorTableEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetColorTableEXT_remap_index], fn) #define CALL_GetColorTableParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetColorTableParameterivEXT_remap_index], parameters) #define GET_GetColorTableParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterivEXT_remap_index]) #define SET_GetColorTableParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterivEXT_remap_index], fn) #define CALL_GetColorTableParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetColorTableParameterfvEXT_remap_index], parameters) #define GET_GetColorTableParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterfvEXT_remap_index]) #define SET_GetColorTableParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetColorTableParameterfvEXT_remap_index], fn) #define CALL_TbufferMask3DFX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[TbufferMask3DFX_remap_index], parameters) #define GET_TbufferMask3DFX(disp) GET_by_offset(disp, driDispatchRemapTable[TbufferMask3DFX_remap_index]) #define SET_TbufferMask3DFX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TbufferMask3DFX_remap_index], fn) #define CALL_CompressedTexImage3DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexImage3DARB_remap_index], parameters) #define GET_CompressedTexImage3DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexImage3DARB_remap_index]) #define SET_CompressedTexImage3DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexImage3DARB_remap_index], fn) #define CALL_CompressedTexImage2DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexImage2DARB_remap_index], parameters) #define GET_CompressedTexImage2DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexImage2DARB_remap_index]) #define SET_CompressedTexImage2DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexImage2DARB_remap_index], fn) #define CALL_CompressedTexImage1DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexImage1DARB_remap_index], parameters) #define GET_CompressedTexImage1DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexImage1DARB_remap_index]) #define SET_CompressedTexImage1DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexImage1DARB_remap_index], fn) #define CALL_CompressedTexSubImage3DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index], parameters) #define GET_CompressedTexSubImage3DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index]) #define SET_CompressedTexSubImage3DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index], fn) #define CALL_CompressedTexSubImage2DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index], parameters) #define GET_CompressedTexSubImage2DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index]) #define SET_CompressedTexSubImage2DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index], fn) #define CALL_CompressedTexSubImage1DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index], parameters) #define GET_CompressedTexSubImage1DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index]) #define SET_CompressedTexSubImage1DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index], fn) #define CALL_GetCompressedTexImageARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLvoid *)), driDispatchRemapTable[GetCompressedTexImageARB_remap_index], parameters) #define GET_GetCompressedTexImageARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetCompressedTexImageARB_remap_index]) #define SET_GetCompressedTexImageARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCompressedTexImageARB_remap_index], fn) #define CALL_SecondaryColor3bEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLbyte, GLbyte, GLbyte)), driDispatchRemapTable[SecondaryColor3bEXT_remap_index], parameters) #define GET_SecondaryColor3bEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bEXT_remap_index]) #define SET_SecondaryColor3bEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bEXT_remap_index], fn) #define CALL_SecondaryColor3bvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLbyte *)), driDispatchRemapTable[SecondaryColor3bvEXT_remap_index], parameters) #define GET_SecondaryColor3bvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bvEXT_remap_index]) #define SET_SecondaryColor3bvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bvEXT_remap_index], fn) #define CALL_SecondaryColor3dEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[SecondaryColor3dEXT_remap_index], parameters) #define GET_SecondaryColor3dEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dEXT_remap_index]) #define SET_SecondaryColor3dEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dEXT_remap_index], fn) #define CALL_SecondaryColor3dvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[SecondaryColor3dvEXT_remap_index], parameters) #define GET_SecondaryColor3dvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dvEXT_remap_index]) #define SET_SecondaryColor3dvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dvEXT_remap_index], fn) #define CALL_SecondaryColor3fEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[SecondaryColor3fEXT_remap_index], parameters) #define GET_SecondaryColor3fEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fEXT_remap_index]) #define SET_SecondaryColor3fEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fEXT_remap_index], fn) #define CALL_SecondaryColor3fvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[SecondaryColor3fvEXT_remap_index], parameters) #define GET_SecondaryColor3fvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fvEXT_remap_index]) #define SET_SecondaryColor3fvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fvEXT_remap_index], fn) #define CALL_SecondaryColor3iEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint)), driDispatchRemapTable[SecondaryColor3iEXT_remap_index], parameters) #define GET_SecondaryColor3iEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3iEXT_remap_index]) #define SET_SecondaryColor3iEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3iEXT_remap_index], fn) #define CALL_SecondaryColor3ivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[SecondaryColor3ivEXT_remap_index], parameters) #define GET_SecondaryColor3ivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ivEXT_remap_index]) #define SET_SecondaryColor3ivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ivEXT_remap_index], fn) #define CALL_SecondaryColor3sEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort, GLshort)), driDispatchRemapTable[SecondaryColor3sEXT_remap_index], parameters) #define GET_SecondaryColor3sEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3sEXT_remap_index]) #define SET_SecondaryColor3sEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3sEXT_remap_index], fn) #define CALL_SecondaryColor3svEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[SecondaryColor3svEXT_remap_index], parameters) #define GET_SecondaryColor3svEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3svEXT_remap_index]) #define SET_SecondaryColor3svEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3svEXT_remap_index], fn) #define CALL_SecondaryColor3ubEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLubyte, GLubyte, GLubyte)), driDispatchRemapTable[SecondaryColor3ubEXT_remap_index], parameters) #define GET_SecondaryColor3ubEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubEXT_remap_index]) #define SET_SecondaryColor3ubEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubEXT_remap_index], fn) #define CALL_SecondaryColor3ubvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLubyte *)), driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index], parameters) #define GET_SecondaryColor3ubvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index]) #define SET_SecondaryColor3ubvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index], fn) #define CALL_SecondaryColor3uiEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint, GLuint)), driDispatchRemapTable[SecondaryColor3uiEXT_remap_index], parameters) #define GET_SecondaryColor3uiEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uiEXT_remap_index]) #define SET_SecondaryColor3uiEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uiEXT_remap_index], fn) #define CALL_SecondaryColor3uivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLuint *)), driDispatchRemapTable[SecondaryColor3uivEXT_remap_index], parameters) #define GET_SecondaryColor3uivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uivEXT_remap_index]) #define SET_SecondaryColor3uivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uivEXT_remap_index], fn) #define CALL_SecondaryColor3usEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLushort, GLushort, GLushort)), driDispatchRemapTable[SecondaryColor3usEXT_remap_index], parameters) #define GET_SecondaryColor3usEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usEXT_remap_index]) #define SET_SecondaryColor3usEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usEXT_remap_index], fn) #define CALL_SecondaryColor3usvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLushort *)), driDispatchRemapTable[SecondaryColor3usvEXT_remap_index], parameters) #define GET_SecondaryColor3usvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usvEXT_remap_index]) #define SET_SecondaryColor3usvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usvEXT_remap_index], fn) #define CALL_SecondaryColorPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[SecondaryColorPointerEXT_remap_index], parameters) #define GET_SecondaryColorPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColorPointerEXT_remap_index]) #define SET_SecondaryColorPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColorPointerEXT_remap_index], fn) #define CALL_AreProgramsResidentNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLsizei, const GLuint *, GLboolean *)), driDispatchRemapTable[AreProgramsResidentNV_remap_index], parameters) #define GET_AreProgramsResidentNV(disp) GET_by_offset(disp, driDispatchRemapTable[AreProgramsResidentNV_remap_index]) #define SET_AreProgramsResidentNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AreProgramsResidentNV_remap_index], fn) #define CALL_BindProgramNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindProgramNV_remap_index], parameters) #define GET_BindProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[BindProgramNV_remap_index]) #define SET_BindProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindProgramNV_remap_index], fn) #define CALL_DeleteProgramsNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteProgramsNV_remap_index], parameters) #define GET_DeleteProgramsNV(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteProgramsNV_remap_index]) #define SET_DeleteProgramsNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteProgramsNV_remap_index], fn) #define CALL_ExecuteProgramNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLfloat *)), driDispatchRemapTable[ExecuteProgramNV_remap_index], parameters) #define GET_ExecuteProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[ExecuteProgramNV_remap_index]) #define SET_ExecuteProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ExecuteProgramNV_remap_index], fn) #define CALL_GenProgramsNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenProgramsNV_remap_index], parameters) #define GET_GenProgramsNV(disp) GET_by_offset(disp, driDispatchRemapTable[GenProgramsNV_remap_index]) #define SET_GenProgramsNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenProgramsNV_remap_index], fn) #define CALL_GetProgramParameterdvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLdouble *)), driDispatchRemapTable[GetProgramParameterdvNV_remap_index], parameters) #define GET_GetProgramParameterdvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramParameterdvNV_remap_index]) #define SET_GetProgramParameterdvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramParameterdvNV_remap_index], fn) #define CALL_GetProgramParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLfloat *)), driDispatchRemapTable[GetProgramParameterfvNV_remap_index], parameters) #define GET_GetProgramParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramParameterfvNV_remap_index]) #define SET_GetProgramParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramParameterfvNV_remap_index], fn) #define CALL_GetProgramivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetProgramivNV_remap_index], parameters) #define GET_GetProgramivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramivNV_remap_index]) #define SET_GetProgramivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramivNV_remap_index], fn) #define CALL_GetProgramStringNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLubyte *)), driDispatchRemapTable[GetProgramStringNV_remap_index], parameters) #define GET_GetProgramStringNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramStringNV_remap_index]) #define SET_GetProgramStringNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramStringNV_remap_index], fn) #define CALL_GetTrackMatrixivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLint *)), driDispatchRemapTable[GetTrackMatrixivNV_remap_index], parameters) #define GET_GetTrackMatrixivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetTrackMatrixivNV_remap_index]) #define SET_GetTrackMatrixivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTrackMatrixivNV_remap_index], fn) #define CALL_GetVertexAttribdvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLdouble *)), driDispatchRemapTable[GetVertexAttribdvARB_remap_index], parameters) #define GET_GetVertexAttribdvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvARB_remap_index]) #define SET_GetVertexAttribdvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvARB_remap_index], fn) #define CALL_GetVertexAttribfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLfloat *)), driDispatchRemapTable[GetVertexAttribfvARB_remap_index], parameters) #define GET_GetVertexAttribfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvARB_remap_index]) #define SET_GetVertexAttribfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvARB_remap_index], fn) #define CALL_GetVertexAttribivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetVertexAttribivARB_remap_index], parameters) #define GET_GetVertexAttribivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivARB_remap_index]) #define SET_GetVertexAttribivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivARB_remap_index], fn) #define CALL_GetVertexAttribPointervNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLvoid **)), driDispatchRemapTable[GetVertexAttribPointervNV_remap_index], parameters) #define GET_GetVertexAttribPointervNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribPointervNV_remap_index]) #define SET_GetVertexAttribPointervNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribPointervNV_remap_index], fn) #define CALL_IsProgramNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsProgramNV_remap_index], parameters) #define GET_IsProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[IsProgramNV_remap_index]) #define SET_IsProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsProgramNV_remap_index], fn) #define CALL_LoadProgramNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLsizei, const GLubyte *)), driDispatchRemapTable[LoadProgramNV_remap_index], parameters) #define GET_LoadProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[LoadProgramNV_remap_index]) #define SET_LoadProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LoadProgramNV_remap_index], fn) #define CALL_ProgramParameter4dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[ProgramParameter4dNV_remap_index], parameters) #define GET_ProgramParameter4dNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameter4dNV_remap_index]) #define SET_ProgramParameter4dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameter4dNV_remap_index], fn) #define CALL_ProgramParameter4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLdouble *)), driDispatchRemapTable[ProgramParameter4dvNV_remap_index], parameters) #define GET_ProgramParameter4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameter4dvNV_remap_index]) #define SET_ProgramParameter4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameter4dvNV_remap_index], fn) #define CALL_ProgramParameter4fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[ProgramParameter4fNV_remap_index], parameters) #define GET_ProgramParameter4fNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameter4fNV_remap_index]) #define SET_ProgramParameter4fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameter4fNV_remap_index], fn) #define CALL_ProgramParameter4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLfloat *)), driDispatchRemapTable[ProgramParameter4fvNV_remap_index], parameters) #define GET_ProgramParameter4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameter4fvNV_remap_index]) #define SET_ProgramParameter4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameter4fvNV_remap_index], fn) #define CALL_ProgramParameters4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, const GLdouble *)), driDispatchRemapTable[ProgramParameters4dvNV_remap_index], parameters) #define GET_ProgramParameters4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameters4dvNV_remap_index]) #define SET_ProgramParameters4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameters4dvNV_remap_index], fn) #define CALL_ProgramParameters4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, const GLfloat *)), driDispatchRemapTable[ProgramParameters4fvNV_remap_index], parameters) #define GET_ProgramParameters4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameters4fvNV_remap_index]) #define SET_ProgramParameters4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameters4fvNV_remap_index], fn) #define CALL_RequestResidentProgramsNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[RequestResidentProgramsNV_remap_index], parameters) #define GET_RequestResidentProgramsNV(disp) GET_by_offset(disp, driDispatchRemapTable[RequestResidentProgramsNV_remap_index]) #define SET_RequestResidentProgramsNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[RequestResidentProgramsNV_remap_index], fn) #define CALL_TrackMatrixNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLenum)), driDispatchRemapTable[TrackMatrixNV_remap_index], parameters) #define GET_TrackMatrixNV(disp) GET_by_offset(disp, driDispatchRemapTable[TrackMatrixNV_remap_index]) #define SET_TrackMatrixNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TrackMatrixNV_remap_index], fn) #define CALL_VertexAttribPointerNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLint, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[VertexAttribPointerNV_remap_index], parameters) #define GET_VertexAttribPointerNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerNV_remap_index]) #define SET_VertexAttribPointerNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerNV_remap_index], fn) #define CALL_VertexAttrib1dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble)), driDispatchRemapTable[VertexAttrib1dARB_remap_index], parameters) #define GET_VertexAttrib1dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dARB_remap_index]) #define SET_VertexAttrib1dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dARB_remap_index], fn) #define CALL_VertexAttrib1dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib1dvARB_remap_index], parameters) #define GET_VertexAttrib1dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvARB_remap_index]) #define SET_VertexAttrib1dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvARB_remap_index], fn) #define CALL_VertexAttrib1fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat)), driDispatchRemapTable[VertexAttrib1fARB_remap_index], parameters) #define GET_VertexAttrib1fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fARB_remap_index]) #define SET_VertexAttrib1fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fARB_remap_index], fn) #define CALL_VertexAttrib1fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib1fvARB_remap_index], parameters) #define GET_VertexAttrib1fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvARB_remap_index]) #define SET_VertexAttrib1fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvARB_remap_index], fn) #define CALL_VertexAttrib1sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort)), driDispatchRemapTable[VertexAttrib1sARB_remap_index], parameters) #define GET_VertexAttrib1sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sARB_remap_index]) #define SET_VertexAttrib1sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sARB_remap_index], fn) #define CALL_VertexAttrib1svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib1svARB_remap_index], parameters) #define GET_VertexAttrib1svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svARB_remap_index]) #define SET_VertexAttrib1svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svARB_remap_index], fn) #define CALL_VertexAttrib2dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib2dARB_remap_index], parameters) #define GET_VertexAttrib2dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dARB_remap_index]) #define SET_VertexAttrib2dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dARB_remap_index], fn) #define CALL_VertexAttrib2dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib2dvARB_remap_index], parameters) #define GET_VertexAttrib2dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvARB_remap_index]) #define SET_VertexAttrib2dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvARB_remap_index], fn) #define CALL_VertexAttrib2fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib2fARB_remap_index], parameters) #define GET_VertexAttrib2fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fARB_remap_index]) #define SET_VertexAttrib2fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fARB_remap_index], fn) #define CALL_VertexAttrib2fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib2fvARB_remap_index], parameters) #define GET_VertexAttrib2fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvARB_remap_index]) #define SET_VertexAttrib2fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvARB_remap_index], fn) #define CALL_VertexAttrib2sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib2sARB_remap_index], parameters) #define GET_VertexAttrib2sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sARB_remap_index]) #define SET_VertexAttrib2sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sARB_remap_index], fn) #define CALL_VertexAttrib2svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib2svARB_remap_index], parameters) #define GET_VertexAttrib2svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svARB_remap_index]) #define SET_VertexAttrib2svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svARB_remap_index], fn) #define CALL_VertexAttrib3dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib3dARB_remap_index], parameters) #define GET_VertexAttrib3dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dARB_remap_index]) #define SET_VertexAttrib3dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dARB_remap_index], fn) #define CALL_VertexAttrib3dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib3dvARB_remap_index], parameters) #define GET_VertexAttrib3dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvARB_remap_index]) #define SET_VertexAttrib3dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvARB_remap_index], fn) #define CALL_VertexAttrib3fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib3fARB_remap_index], parameters) #define GET_VertexAttrib3fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fARB_remap_index]) #define SET_VertexAttrib3fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fARB_remap_index], fn) #define CALL_VertexAttrib3fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib3fvARB_remap_index], parameters) #define GET_VertexAttrib3fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvARB_remap_index]) #define SET_VertexAttrib3fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvARB_remap_index], fn) #define CALL_VertexAttrib3sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib3sARB_remap_index], parameters) #define GET_VertexAttrib3sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sARB_remap_index]) #define SET_VertexAttrib3sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sARB_remap_index], fn) #define CALL_VertexAttrib3svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib3svARB_remap_index], parameters) #define GET_VertexAttrib3svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svARB_remap_index]) #define SET_VertexAttrib3svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svARB_remap_index], fn) #define CALL_VertexAttrib4dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib4dARB_remap_index], parameters) #define GET_VertexAttrib4dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dARB_remap_index]) #define SET_VertexAttrib4dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dARB_remap_index], fn) #define CALL_VertexAttrib4dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib4dvARB_remap_index], parameters) #define GET_VertexAttrib4dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvARB_remap_index]) #define SET_VertexAttrib4dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvARB_remap_index], fn) #define CALL_VertexAttrib4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib4fARB_remap_index], parameters) #define GET_VertexAttrib4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fARB_remap_index]) #define SET_VertexAttrib4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fARB_remap_index], fn) #define CALL_VertexAttrib4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib4fvARB_remap_index], parameters) #define GET_VertexAttrib4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvARB_remap_index]) #define SET_VertexAttrib4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvARB_remap_index], fn) #define CALL_VertexAttrib4sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib4sARB_remap_index], parameters) #define GET_VertexAttrib4sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sARB_remap_index]) #define SET_VertexAttrib4sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sARB_remap_index], fn) #define CALL_VertexAttrib4svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib4svARB_remap_index], parameters) #define GET_VertexAttrib4svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svARB_remap_index]) #define SET_VertexAttrib4svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svARB_remap_index], fn) #define CALL_VertexAttrib4NubARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte)), driDispatchRemapTable[VertexAttrib4NubARB_remap_index], parameters) #define GET_VertexAttrib4NubARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubARB_remap_index]) #define SET_VertexAttrib4NubARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubARB_remap_index], fn) #define CALL_VertexAttrib4NubvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLubyte *)), driDispatchRemapTable[VertexAttrib4NubvARB_remap_index], parameters) #define GET_VertexAttrib4NubvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubvARB_remap_index]) #define SET_VertexAttrib4NubvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubvARB_remap_index], fn) #define CALL_VertexAttribs1dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs1dvNV_remap_index], parameters) #define GET_VertexAttribs1dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs1dvNV_remap_index]) #define SET_VertexAttribs1dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs1dvNV_remap_index], fn) #define CALL_VertexAttribs1fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs1fvNV_remap_index], parameters) #define GET_VertexAttribs1fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs1fvNV_remap_index]) #define SET_VertexAttribs1fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs1fvNV_remap_index], fn) #define CALL_VertexAttribs1svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs1svNV_remap_index], parameters) #define GET_VertexAttribs1svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs1svNV_remap_index]) #define SET_VertexAttribs1svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs1svNV_remap_index], fn) #define CALL_VertexAttribs2dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs2dvNV_remap_index], parameters) #define GET_VertexAttribs2dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs2dvNV_remap_index]) #define SET_VertexAttribs2dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs2dvNV_remap_index], fn) #define CALL_VertexAttribs2fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs2fvNV_remap_index], parameters) #define GET_VertexAttribs2fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs2fvNV_remap_index]) #define SET_VertexAttribs2fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs2fvNV_remap_index], fn) #define CALL_VertexAttribs2svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs2svNV_remap_index], parameters) #define GET_VertexAttribs2svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs2svNV_remap_index]) #define SET_VertexAttribs2svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs2svNV_remap_index], fn) #define CALL_VertexAttribs3dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs3dvNV_remap_index], parameters) #define GET_VertexAttribs3dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs3dvNV_remap_index]) #define SET_VertexAttribs3dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs3dvNV_remap_index], fn) #define CALL_VertexAttribs3fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs3fvNV_remap_index], parameters) #define GET_VertexAttribs3fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs3fvNV_remap_index]) #define SET_VertexAttribs3fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs3fvNV_remap_index], fn) #define CALL_VertexAttribs3svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs3svNV_remap_index], parameters) #define GET_VertexAttribs3svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs3svNV_remap_index]) #define SET_VertexAttribs3svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs3svNV_remap_index], fn) #define CALL_VertexAttribs4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs4dvNV_remap_index], parameters) #define GET_VertexAttribs4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4dvNV_remap_index]) #define SET_VertexAttribs4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4dvNV_remap_index], fn) #define CALL_VertexAttribs4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs4fvNV_remap_index], parameters) #define GET_VertexAttribs4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4fvNV_remap_index]) #define SET_VertexAttribs4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4fvNV_remap_index], fn) #define CALL_VertexAttribs4svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs4svNV_remap_index], parameters) #define GET_VertexAttribs4svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4svNV_remap_index]) #define SET_VertexAttribs4svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4svNV_remap_index], fn) #define CALL_VertexAttribs4ubvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *)), driDispatchRemapTable[VertexAttribs4ubvNV_remap_index], parameters) #define GET_VertexAttribs4ubvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4ubvNV_remap_index]) #define SET_VertexAttribs4ubvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4ubvNV_remap_index], fn) #define CALL_PointParameteriNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[PointParameteriNV_remap_index], parameters) #define GET_PointParameteriNV(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameteriNV_remap_index]) #define SET_PointParameteriNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameteriNV_remap_index], fn) #define CALL_PointParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[PointParameterivNV_remap_index], parameters) #define GET_PointParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameterivNV_remap_index]) #define SET_PointParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameterivNV_remap_index], fn) #define CALL_MultiDrawArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint *, GLsizei *, GLsizei)), driDispatchRemapTable[MultiDrawArraysEXT_remap_index], parameters) #define GET_MultiDrawArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[MultiDrawArraysEXT_remap_index]) #define SET_MultiDrawArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiDrawArraysEXT_remap_index], fn) #define CALL_MultiDrawElementsEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei)), driDispatchRemapTable[MultiDrawElementsEXT_remap_index], parameters) #define GET_MultiDrawElementsEXT(disp) GET_by_offset(disp, driDispatchRemapTable[MultiDrawElementsEXT_remap_index]) #define SET_MultiDrawElementsEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiDrawElementsEXT_remap_index], fn) #define CALL_ActiveStencilFaceEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[ActiveStencilFaceEXT_remap_index], parameters) #define GET_ActiveStencilFaceEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ActiveStencilFaceEXT_remap_index]) #define SET_ActiveStencilFaceEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ActiveStencilFaceEXT_remap_index], fn) #define CALL_DeleteFencesNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteFencesNV_remap_index], parameters) #define GET_DeleteFencesNV(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteFencesNV_remap_index]) #define SET_DeleteFencesNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteFencesNV_remap_index], fn) #define CALL_GenFencesNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenFencesNV_remap_index], parameters) #define GET_GenFencesNV(disp) GET_by_offset(disp, driDispatchRemapTable[GenFencesNV_remap_index]) #define SET_GenFencesNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenFencesNV_remap_index], fn) #define CALL_IsFenceNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsFenceNV_remap_index], parameters) #define GET_IsFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[IsFenceNV_remap_index]) #define SET_IsFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsFenceNV_remap_index], fn) #define CALL_TestFenceNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[TestFenceNV_remap_index], parameters) #define GET_TestFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[TestFenceNV_remap_index]) #define SET_TestFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TestFenceNV_remap_index], fn) #define CALL_GetFenceivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetFenceivNV_remap_index], parameters) #define GET_GetFenceivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetFenceivNV_remap_index]) #define SET_GetFenceivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFenceivNV_remap_index], fn) #define CALL_FinishFenceNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[FinishFenceNV_remap_index], parameters) #define GET_FinishFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[FinishFenceNV_remap_index]) #define SET_FinishFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FinishFenceNV_remap_index], fn) #define CALL_SetFenceNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum)), driDispatchRemapTable[SetFenceNV_remap_index], parameters) #define GET_SetFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[SetFenceNV_remap_index]) #define SET_SetFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SetFenceNV_remap_index], fn) #define CALL_VertexAttrib4bvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLbyte *)), driDispatchRemapTable[VertexAttrib4bvARB_remap_index], parameters) #define GET_VertexAttrib4bvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4bvARB_remap_index]) #define SET_VertexAttrib4bvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4bvARB_remap_index], fn) #define CALL_VertexAttrib4ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLint *)), driDispatchRemapTable[VertexAttrib4ivARB_remap_index], parameters) #define GET_VertexAttrib4ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ivARB_remap_index]) #define SET_VertexAttrib4ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ivARB_remap_index], fn) #define CALL_VertexAttrib4ubvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLubyte *)), driDispatchRemapTable[VertexAttrib4ubvARB_remap_index], parameters) #define GET_VertexAttrib4ubvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvARB_remap_index]) #define SET_VertexAttrib4ubvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvARB_remap_index], fn) #define CALL_VertexAttrib4usvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLushort *)), driDispatchRemapTable[VertexAttrib4usvARB_remap_index], parameters) #define GET_VertexAttrib4usvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4usvARB_remap_index]) #define SET_VertexAttrib4usvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4usvARB_remap_index], fn) #define CALL_VertexAttrib4uivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLuint *)), driDispatchRemapTable[VertexAttrib4uivARB_remap_index], parameters) #define GET_VertexAttrib4uivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4uivARB_remap_index]) #define SET_VertexAttrib4uivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4uivARB_remap_index], fn) #define CALL_VertexAttrib4NbvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLbyte *)), driDispatchRemapTable[VertexAttrib4NbvARB_remap_index], parameters) #define GET_VertexAttrib4NbvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NbvARB_remap_index]) #define SET_VertexAttrib4NbvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NbvARB_remap_index], fn) #define CALL_VertexAttrib4NsvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib4NsvARB_remap_index], parameters) #define GET_VertexAttrib4NsvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NsvARB_remap_index]) #define SET_VertexAttrib4NsvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NsvARB_remap_index], fn) #define CALL_VertexAttrib4NivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLint *)), driDispatchRemapTable[VertexAttrib4NivARB_remap_index], parameters) #define GET_VertexAttrib4NivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NivARB_remap_index]) #define SET_VertexAttrib4NivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NivARB_remap_index], fn) #define CALL_VertexAttrib4NusvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLushort *)), driDispatchRemapTable[VertexAttrib4NusvARB_remap_index], parameters) #define GET_VertexAttrib4NusvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NusvARB_remap_index]) #define SET_VertexAttrib4NusvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NusvARB_remap_index], fn) #define CALL_VertexAttrib4NuivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLuint *)), driDispatchRemapTable[VertexAttrib4NuivARB_remap_index], parameters) #define GET_VertexAttrib4NuivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NuivARB_remap_index]) #define SET_VertexAttrib4NuivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NuivARB_remap_index], fn) #define CALL_VertexAttribPointerARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *)), driDispatchRemapTable[VertexAttribPointerARB_remap_index], parameters) #define GET_VertexAttribPointerARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerARB_remap_index]) #define SET_VertexAttribPointerARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerARB_remap_index], fn) #define CALL_EnableVertexAttribArrayARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index], parameters) #define GET_EnableVertexAttribArrayARB(disp) GET_by_offset(disp, driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index]) #define SET_EnableVertexAttribArrayARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index], fn) #define CALL_DisableVertexAttribArrayARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index], parameters) #define GET_DisableVertexAttribArrayARB(disp) GET_by_offset(disp, driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index]) #define SET_DisableVertexAttribArrayARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index], fn) #define CALL_ProgramStringARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[ProgramStringARB_remap_index], parameters) #define GET_ProgramStringARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramStringARB_remap_index]) #define SET_ProgramStringARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramStringARB_remap_index], fn) #define CALL_ProgramEnvParameter4dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index], parameters) #define GET_ProgramEnvParameter4dARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index]) #define SET_ProgramEnvParameter4dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index], fn) #define CALL_ProgramEnvParameter4dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLdouble *)), driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index], parameters) #define GET_ProgramEnvParameter4dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index]) #define SET_ProgramEnvParameter4dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index], fn) #define CALL_ProgramEnvParameter4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index], parameters) #define GET_ProgramEnvParameter4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index]) #define SET_ProgramEnvParameter4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index], fn) #define CALL_ProgramEnvParameter4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLfloat *)), driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index], parameters) #define GET_ProgramEnvParameter4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index]) #define SET_ProgramEnvParameter4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index], fn) #define CALL_ProgramLocalParameter4dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index], parameters) #define GET_ProgramLocalParameter4dARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index]) #define SET_ProgramLocalParameter4dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index], fn) #define CALL_ProgramLocalParameter4dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLdouble *)), driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index], parameters) #define GET_ProgramLocalParameter4dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index]) #define SET_ProgramLocalParameter4dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index], fn) #define CALL_ProgramLocalParameter4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index], parameters) #define GET_ProgramLocalParameter4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index]) #define SET_ProgramLocalParameter4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index], fn) #define CALL_ProgramLocalParameter4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLfloat *)), driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index], parameters) #define GET_ProgramLocalParameter4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index]) #define SET_ProgramLocalParameter4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index], fn) #define CALL_GetProgramEnvParameterdvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble *)), driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index], parameters) #define GET_GetProgramEnvParameterdvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index]) #define SET_GetProgramEnvParameterdvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index], fn) #define CALL_GetProgramEnvParameterfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat *)), driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index], parameters) #define GET_GetProgramEnvParameterfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index]) #define SET_GetProgramEnvParameterfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index], fn) #define CALL_GetProgramLocalParameterdvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble *)), driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index], parameters) #define GET_GetProgramLocalParameterdvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index]) #define SET_GetProgramLocalParameterdvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index], fn) #define CALL_GetProgramLocalParameterfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat *)), driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index], parameters) #define GET_GetProgramLocalParameterfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index]) #define SET_GetProgramLocalParameterfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index], fn) #define CALL_GetProgramivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetProgramivARB_remap_index], parameters) #define GET_GetProgramivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramivARB_remap_index]) #define SET_GetProgramivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramivARB_remap_index], fn) #define CALL_GetProgramStringARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLvoid *)), driDispatchRemapTable[GetProgramStringARB_remap_index], parameters) #define GET_GetProgramStringARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramStringARB_remap_index]) #define SET_GetProgramStringARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramStringARB_remap_index], fn) #define CALL_ProgramNamedParameter4fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index], parameters) #define GET_ProgramNamedParameter4fNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index]) #define SET_ProgramNamedParameter4fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index], fn) #define CALL_ProgramNamedParameter4dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index], parameters) #define GET_ProgramNamedParameter4dNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index]) #define SET_ProgramNamedParameter4dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index], fn) #define CALL_ProgramNamedParameter4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, const GLfloat *)), driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index], parameters) #define GET_ProgramNamedParameter4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index]) #define SET_ProgramNamedParameter4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index], fn) #define CALL_ProgramNamedParameter4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, const GLdouble *)), driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index], parameters) #define GET_ProgramNamedParameter4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index]) #define SET_ProgramNamedParameter4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index], fn) #define CALL_GetProgramNamedParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLfloat *)), driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index], parameters) #define GET_GetProgramNamedParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index]) #define SET_GetProgramNamedParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index], fn) #define CALL_GetProgramNamedParameterdvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLdouble *)), driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index], parameters) #define GET_GetProgramNamedParameterdvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index]) #define SET_GetProgramNamedParameterdvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index], fn) #define CALL_BindBufferARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindBufferARB_remap_index], parameters) #define GET_BindBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[BindBufferARB_remap_index]) #define SET_BindBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindBufferARB_remap_index], fn) #define CALL_BufferDataARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizeiptrARB, const GLvoid *, GLenum)), driDispatchRemapTable[BufferDataARB_remap_index], parameters) #define GET_BufferDataARB(disp) GET_by_offset(disp, driDispatchRemapTable[BufferDataARB_remap_index]) #define SET_BufferDataARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BufferDataARB_remap_index], fn) #define CALL_BufferSubDataARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *)), driDispatchRemapTable[BufferSubDataARB_remap_index], parameters) #define GET_BufferSubDataARB(disp) GET_by_offset(disp, driDispatchRemapTable[BufferSubDataARB_remap_index]) #define SET_BufferSubDataARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BufferSubDataARB_remap_index], fn) #define CALL_DeleteBuffersARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteBuffersARB_remap_index], parameters) #define GET_DeleteBuffersARB(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteBuffersARB_remap_index]) #define SET_DeleteBuffersARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteBuffersARB_remap_index], fn) #define CALL_GenBuffersARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenBuffersARB_remap_index], parameters) #define GET_GenBuffersARB(disp) GET_by_offset(disp, driDispatchRemapTable[GenBuffersARB_remap_index]) #define SET_GenBuffersARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenBuffersARB_remap_index], fn) #define CALL_GetBufferParameterivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetBufferParameterivARB_remap_index], parameters) #define GET_GetBufferParameterivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetBufferParameterivARB_remap_index]) #define SET_GetBufferParameterivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetBufferParameterivARB_remap_index], fn) #define CALL_GetBufferPointervARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLvoid **)), driDispatchRemapTable[GetBufferPointervARB_remap_index], parameters) #define GET_GetBufferPointervARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetBufferPointervARB_remap_index]) #define SET_GetBufferPointervARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetBufferPointervARB_remap_index], fn) #define CALL_GetBufferSubDataARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *)), driDispatchRemapTable[GetBufferSubDataARB_remap_index], parameters) #define GET_GetBufferSubDataARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetBufferSubDataARB_remap_index]) #define SET_GetBufferSubDataARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetBufferSubDataARB_remap_index], fn) #define CALL_IsBufferARB(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsBufferARB_remap_index], parameters) #define GET_IsBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[IsBufferARB_remap_index]) #define SET_IsBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsBufferARB_remap_index], fn) #define CALL_MapBufferARB(disp, parameters) CALL_by_offset(disp, (GLvoid * (GLAPIENTRYP)(GLenum, GLenum)), driDispatchRemapTable[MapBufferARB_remap_index], parameters) #define GET_MapBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[MapBufferARB_remap_index]) #define SET_MapBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MapBufferARB_remap_index], fn) #define CALL_UnmapBufferARB(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[UnmapBufferARB_remap_index], parameters) #define GET_UnmapBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[UnmapBufferARB_remap_index]) #define SET_UnmapBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UnmapBufferARB_remap_index], fn) #define CALL_DepthBoundsEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLclampd, GLclampd)), driDispatchRemapTable[DepthBoundsEXT_remap_index], parameters) #define GET_DepthBoundsEXT(disp) GET_by_offset(disp, driDispatchRemapTable[DepthBoundsEXT_remap_index]) #define SET_DepthBoundsEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DepthBoundsEXT_remap_index], fn) #define CALL_GenQueriesARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenQueriesARB_remap_index], parameters) #define GET_GenQueriesARB(disp) GET_by_offset(disp, driDispatchRemapTable[GenQueriesARB_remap_index]) #define SET_GenQueriesARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenQueriesARB_remap_index], fn) #define CALL_DeleteQueriesARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteQueriesARB_remap_index], parameters) #define GET_DeleteQueriesARB(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteQueriesARB_remap_index]) #define SET_DeleteQueriesARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteQueriesARB_remap_index], fn) #define CALL_IsQueryARB(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsQueryARB_remap_index], parameters) #define GET_IsQueryARB(disp) GET_by_offset(disp, driDispatchRemapTable[IsQueryARB_remap_index]) #define SET_IsQueryARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsQueryARB_remap_index], fn) #define CALL_BeginQueryARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BeginQueryARB_remap_index], parameters) #define GET_BeginQueryARB(disp) GET_by_offset(disp, driDispatchRemapTable[BeginQueryARB_remap_index]) #define SET_BeginQueryARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BeginQueryARB_remap_index], fn) #define CALL_EndQueryARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[EndQueryARB_remap_index], parameters) #define GET_EndQueryARB(disp) GET_by_offset(disp, driDispatchRemapTable[EndQueryARB_remap_index]) #define SET_EndQueryARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EndQueryARB_remap_index], fn) #define CALL_GetQueryivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetQueryivARB_remap_index], parameters) #define GET_GetQueryivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryivARB_remap_index]) #define SET_GetQueryivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryivARB_remap_index], fn) #define CALL_GetQueryObjectivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetQueryObjectivARB_remap_index], parameters) #define GET_GetQueryObjectivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryObjectivARB_remap_index]) #define SET_GetQueryObjectivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryObjectivARB_remap_index], fn) #define CALL_GetQueryObjectuivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLuint *)), driDispatchRemapTable[GetQueryObjectuivARB_remap_index], parameters) #define GET_GetQueryObjectuivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryObjectuivARB_remap_index]) #define SET_GetQueryObjectuivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryObjectuivARB_remap_index], fn) #define CALL_MultiModeDrawArraysIBM(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint)), driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index], parameters) #define GET_MultiModeDrawArraysIBM(disp) GET_by_offset(disp, driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index]) #define SET_MultiModeDrawArraysIBM(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index], fn) #define CALL_MultiModeDrawElementsIBM(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLenum *, const GLsizei *, GLenum, const GLvoid * const *, GLsizei, GLint)), driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index], parameters) #define GET_MultiModeDrawElementsIBM(disp) GET_by_offset(disp, driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index]) #define SET_MultiModeDrawElementsIBM(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index], fn) #define CALL_BlendEquationSeparateEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum)), driDispatchRemapTable[BlendEquationSeparateEXT_remap_index], parameters) #define GET_BlendEquationSeparateEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BlendEquationSeparateEXT_remap_index]) #define SET_BlendEquationSeparateEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BlendEquationSeparateEXT_remap_index], fn) #define CALL_DeleteObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[DeleteObjectARB_remap_index], parameters) #define GET_DeleteObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteObjectARB_remap_index]) #define SET_DeleteObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteObjectARB_remap_index], fn) #define CALL_GetHandleARB(disp, parameters) CALL_by_offset(disp, (GLhandleARB (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[GetHandleARB_remap_index], parameters) #define GET_GetHandleARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetHandleARB_remap_index]) #define SET_GetHandleARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetHandleARB_remap_index], fn) #define CALL_DetachObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLhandleARB)), driDispatchRemapTable[DetachObjectARB_remap_index], parameters) #define GET_DetachObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[DetachObjectARB_remap_index]) #define SET_DetachObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DetachObjectARB_remap_index], fn) #define CALL_CreateShaderObjectARB(disp, parameters) CALL_by_offset(disp, (GLhandleARB (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[CreateShaderObjectARB_remap_index], parameters) #define GET_CreateShaderObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[CreateShaderObjectARB_remap_index]) #define SET_CreateShaderObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CreateShaderObjectARB_remap_index], fn) #define CALL_ShaderSourceARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, const GLcharARB **, const GLint *)), driDispatchRemapTable[ShaderSourceARB_remap_index], parameters) #define GET_ShaderSourceARB(disp) GET_by_offset(disp, driDispatchRemapTable[ShaderSourceARB_remap_index]) #define SET_ShaderSourceARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ShaderSourceARB_remap_index], fn) #define CALL_CompileShaderARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[CompileShaderARB_remap_index], parameters) #define GET_CompileShaderARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompileShaderARB_remap_index]) #define SET_CompileShaderARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompileShaderARB_remap_index], fn) #define CALL_CreateProgramObjectARB(disp, parameters) CALL_by_offset(disp, (GLhandleARB (GLAPIENTRYP)(void)), driDispatchRemapTable[CreateProgramObjectARB_remap_index], parameters) #define GET_CreateProgramObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[CreateProgramObjectARB_remap_index]) #define SET_CreateProgramObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CreateProgramObjectARB_remap_index], fn) #define CALL_AttachObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLhandleARB)), driDispatchRemapTable[AttachObjectARB_remap_index], parameters) #define GET_AttachObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[AttachObjectARB_remap_index]) #define SET_AttachObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AttachObjectARB_remap_index], fn) #define CALL_LinkProgramARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[LinkProgramARB_remap_index], parameters) #define GET_LinkProgramARB(disp) GET_by_offset(disp, driDispatchRemapTable[LinkProgramARB_remap_index]) #define SET_LinkProgramARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LinkProgramARB_remap_index], fn) #define CALL_UseProgramObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[UseProgramObjectARB_remap_index], parameters) #define GET_UseProgramObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[UseProgramObjectARB_remap_index]) #define SET_UseProgramObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UseProgramObjectARB_remap_index], fn) #define CALL_ValidateProgramARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[ValidateProgramARB_remap_index], parameters) #define GET_ValidateProgramARB(disp) GET_by_offset(disp, driDispatchRemapTable[ValidateProgramARB_remap_index]) #define SET_ValidateProgramARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ValidateProgramARB_remap_index], fn) #define CALL_Uniform1fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat)), driDispatchRemapTable[Uniform1fARB_remap_index], parameters) #define GET_Uniform1fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1fARB_remap_index]) #define SET_Uniform1fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1fARB_remap_index], fn) #define CALL_Uniform2fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat, GLfloat)), driDispatchRemapTable[Uniform2fARB_remap_index], parameters) #define GET_Uniform2fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2fARB_remap_index]) #define SET_Uniform2fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2fARB_remap_index], fn) #define CALL_Uniform3fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[Uniform3fARB_remap_index], parameters) #define GET_Uniform3fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3fARB_remap_index]) #define SET_Uniform3fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3fARB_remap_index], fn) #define CALL_Uniform4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[Uniform4fARB_remap_index], parameters) #define GET_Uniform4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4fARB_remap_index]) #define SET_Uniform4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4fARB_remap_index], fn) #define CALL_Uniform1iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint)), driDispatchRemapTable[Uniform1iARB_remap_index], parameters) #define GET_Uniform1iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1iARB_remap_index]) #define SET_Uniform1iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1iARB_remap_index], fn) #define CALL_Uniform2iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint)), driDispatchRemapTable[Uniform2iARB_remap_index], parameters) #define GET_Uniform2iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2iARB_remap_index]) #define SET_Uniform2iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2iARB_remap_index], fn) #define CALL_Uniform3iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint)), driDispatchRemapTable[Uniform3iARB_remap_index], parameters) #define GET_Uniform3iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3iARB_remap_index]) #define SET_Uniform3iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3iARB_remap_index], fn) #define CALL_Uniform4iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint, GLint)), driDispatchRemapTable[Uniform4iARB_remap_index], parameters) #define GET_Uniform4iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4iARB_remap_index]) #define SET_Uniform4iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4iARB_remap_index], fn) #define CALL_Uniform1fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform1fvARB_remap_index], parameters) #define GET_Uniform1fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1fvARB_remap_index]) #define SET_Uniform1fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1fvARB_remap_index], fn) #define CALL_Uniform2fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform2fvARB_remap_index], parameters) #define GET_Uniform2fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2fvARB_remap_index]) #define SET_Uniform2fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2fvARB_remap_index], fn) #define CALL_Uniform3fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform3fvARB_remap_index], parameters) #define GET_Uniform3fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3fvARB_remap_index]) #define SET_Uniform3fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3fvARB_remap_index], fn) #define CALL_Uniform4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform4fvARB_remap_index], parameters) #define GET_Uniform4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4fvARB_remap_index]) #define SET_Uniform4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4fvARB_remap_index], fn) #define CALL_Uniform1ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform1ivARB_remap_index], parameters) #define GET_Uniform1ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1ivARB_remap_index]) #define SET_Uniform1ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1ivARB_remap_index], fn) #define CALL_Uniform2ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform2ivARB_remap_index], parameters) #define GET_Uniform2ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2ivARB_remap_index]) #define SET_Uniform2ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2ivARB_remap_index], fn) #define CALL_Uniform3ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform3ivARB_remap_index], parameters) #define GET_Uniform3ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3ivARB_remap_index]) #define SET_Uniform3ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3ivARB_remap_index], fn) #define CALL_Uniform4ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform4ivARB_remap_index], parameters) #define GET_Uniform4ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4ivARB_remap_index]) #define SET_Uniform4ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4ivARB_remap_index], fn) #define CALL_UniformMatrix2fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix2fvARB_remap_index], parameters) #define GET_UniformMatrix2fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix2fvARB_remap_index]) #define SET_UniformMatrix2fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix2fvARB_remap_index], fn) #define CALL_UniformMatrix3fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix3fvARB_remap_index], parameters) #define GET_UniformMatrix3fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix3fvARB_remap_index]) #define SET_UniformMatrix3fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix3fvARB_remap_index], fn) #define CALL_UniformMatrix4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix4fvARB_remap_index], parameters) #define GET_UniformMatrix4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix4fvARB_remap_index]) #define SET_UniformMatrix4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix4fvARB_remap_index], fn) #define CALL_GetObjectParameterfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLenum, GLfloat *)), driDispatchRemapTable[GetObjectParameterfvARB_remap_index], parameters) #define GET_GetObjectParameterfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetObjectParameterfvARB_remap_index]) #define SET_GetObjectParameterfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetObjectParameterfvARB_remap_index], fn) #define CALL_GetObjectParameterivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLenum, GLint *)), driDispatchRemapTable[GetObjectParameterivARB_remap_index], parameters) #define GET_GetObjectParameterivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetObjectParameterivARB_remap_index]) #define SET_GetObjectParameterivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetObjectParameterivARB_remap_index], fn) #define CALL_GetInfoLogARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *)), driDispatchRemapTable[GetInfoLogARB_remap_index], parameters) #define GET_GetInfoLogARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetInfoLogARB_remap_index]) #define SET_GetInfoLogARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetInfoLogARB_remap_index], fn) #define CALL_GetAttachedObjectsARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *)), driDispatchRemapTable[GetAttachedObjectsARB_remap_index], parameters) #define GET_GetAttachedObjectsARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetAttachedObjectsARB_remap_index]) #define SET_GetAttachedObjectsARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetAttachedObjectsARB_remap_index], fn) #define CALL_GetUniformLocationARB(disp, parameters) CALL_by_offset(disp, (GLint (GLAPIENTRYP)(GLhandleARB, const GLcharARB *)), driDispatchRemapTable[GetUniformLocationARB_remap_index], parameters) #define GET_GetUniformLocationARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetUniformLocationARB_remap_index]) #define SET_GetUniformLocationARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetUniformLocationARB_remap_index], fn) #define CALL_GetActiveUniformARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *)), driDispatchRemapTable[GetActiveUniformARB_remap_index], parameters) #define GET_GetActiveUniformARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetActiveUniformARB_remap_index]) #define SET_GetActiveUniformARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetActiveUniformARB_remap_index], fn) #define CALL_GetUniformfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLint, GLfloat *)), driDispatchRemapTable[GetUniformfvARB_remap_index], parameters) #define GET_GetUniformfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetUniformfvARB_remap_index]) #define SET_GetUniformfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetUniformfvARB_remap_index], fn) #define CALL_GetUniformivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLint, GLint *)), driDispatchRemapTable[GetUniformivARB_remap_index], parameters) #define GET_GetUniformivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetUniformivARB_remap_index]) #define SET_GetUniformivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetUniformivARB_remap_index], fn) #define CALL_GetShaderSourceARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *)), driDispatchRemapTable[GetShaderSourceARB_remap_index], parameters) #define GET_GetShaderSourceARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetShaderSourceARB_remap_index]) #define SET_GetShaderSourceARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetShaderSourceARB_remap_index], fn) #define CALL_BindAttribLocationARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLuint, const GLcharARB *)), driDispatchRemapTable[BindAttribLocationARB_remap_index], parameters) #define GET_BindAttribLocationARB(disp) GET_by_offset(disp, driDispatchRemapTable[BindAttribLocationARB_remap_index]) #define SET_BindAttribLocationARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindAttribLocationARB_remap_index], fn) #define CALL_GetActiveAttribARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *)), driDispatchRemapTable[GetActiveAttribARB_remap_index], parameters) #define GET_GetActiveAttribARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetActiveAttribARB_remap_index]) #define SET_GetActiveAttribARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetActiveAttribARB_remap_index], fn) #define CALL_GetAttribLocationARB(disp, parameters) CALL_by_offset(disp, (GLint (GLAPIENTRYP)(GLhandleARB, const GLcharARB *)), driDispatchRemapTable[GetAttribLocationARB_remap_index], parameters) #define GET_GetAttribLocationARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetAttribLocationARB_remap_index]) #define SET_GetAttribLocationARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetAttribLocationARB_remap_index], fn) #define CALL_GetVertexAttribdvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLdouble *)), driDispatchRemapTable[GetVertexAttribdvNV_remap_index], parameters) #define GET_GetVertexAttribdvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvNV_remap_index]) #define SET_GetVertexAttribdvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvNV_remap_index], fn) #define CALL_GetVertexAttribfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLfloat *)), driDispatchRemapTable[GetVertexAttribfvNV_remap_index], parameters) #define GET_GetVertexAttribfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvNV_remap_index]) #define SET_GetVertexAttribfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvNV_remap_index], fn) #define CALL_GetVertexAttribivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetVertexAttribivNV_remap_index], parameters) #define GET_GetVertexAttribivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivNV_remap_index]) #define SET_GetVertexAttribivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivNV_remap_index], fn) #define CALL_VertexAttrib1dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble)), driDispatchRemapTable[VertexAttrib1dNV_remap_index], parameters) #define GET_VertexAttrib1dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dNV_remap_index]) #define SET_VertexAttrib1dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dNV_remap_index], fn) #define CALL_VertexAttrib1dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib1dvNV_remap_index], parameters) #define GET_VertexAttrib1dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvNV_remap_index]) #define SET_VertexAttrib1dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvNV_remap_index], fn) #define CALL_VertexAttrib1fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat)), driDispatchRemapTable[VertexAttrib1fNV_remap_index], parameters) #define GET_VertexAttrib1fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fNV_remap_index]) #define SET_VertexAttrib1fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fNV_remap_index], fn) #define CALL_VertexAttrib1fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib1fvNV_remap_index], parameters) #define GET_VertexAttrib1fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvNV_remap_index]) #define SET_VertexAttrib1fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvNV_remap_index], fn) #define CALL_VertexAttrib1sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort)), driDispatchRemapTable[VertexAttrib1sNV_remap_index], parameters) #define GET_VertexAttrib1sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sNV_remap_index]) #define SET_VertexAttrib1sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sNV_remap_index], fn) #define CALL_VertexAttrib1svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib1svNV_remap_index], parameters) #define GET_VertexAttrib1svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svNV_remap_index]) #define SET_VertexAttrib1svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svNV_remap_index], fn) #define CALL_VertexAttrib2dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib2dNV_remap_index], parameters) #define GET_VertexAttrib2dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dNV_remap_index]) #define SET_VertexAttrib2dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dNV_remap_index], fn) #define CALL_VertexAttrib2dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib2dvNV_remap_index], parameters) #define GET_VertexAttrib2dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvNV_remap_index]) #define SET_VertexAttrib2dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvNV_remap_index], fn) #define CALL_VertexAttrib2fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib2fNV_remap_index], parameters) #define GET_VertexAttrib2fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fNV_remap_index]) #define SET_VertexAttrib2fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fNV_remap_index], fn) #define CALL_VertexAttrib2fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib2fvNV_remap_index], parameters) #define GET_VertexAttrib2fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvNV_remap_index]) #define SET_VertexAttrib2fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvNV_remap_index], fn) #define CALL_VertexAttrib2sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib2sNV_remap_index], parameters) #define GET_VertexAttrib2sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sNV_remap_index]) #define SET_VertexAttrib2sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sNV_remap_index], fn) #define CALL_VertexAttrib2svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib2svNV_remap_index], parameters) #define GET_VertexAttrib2svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svNV_remap_index]) #define SET_VertexAttrib2svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svNV_remap_index], fn) #define CALL_VertexAttrib3dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib3dNV_remap_index], parameters) #define GET_VertexAttrib3dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dNV_remap_index]) #define SET_VertexAttrib3dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dNV_remap_index], fn) #define CALL_VertexAttrib3dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib3dvNV_remap_index], parameters) #define GET_VertexAttrib3dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvNV_remap_index]) #define SET_VertexAttrib3dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvNV_remap_index], fn) #define CALL_VertexAttrib3fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib3fNV_remap_index], parameters) #define GET_VertexAttrib3fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fNV_remap_index]) #define SET_VertexAttrib3fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fNV_remap_index], fn) #define CALL_VertexAttrib3fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib3fvNV_remap_index], parameters) #define GET_VertexAttrib3fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvNV_remap_index]) #define SET_VertexAttrib3fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvNV_remap_index], fn) #define CALL_VertexAttrib3sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib3sNV_remap_index], parameters) #define GET_VertexAttrib3sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sNV_remap_index]) #define SET_VertexAttrib3sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sNV_remap_index], fn) #define CALL_VertexAttrib3svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib3svNV_remap_index], parameters) #define GET_VertexAttrib3svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svNV_remap_index]) #define SET_VertexAttrib3svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svNV_remap_index], fn) #define CALL_VertexAttrib4dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib4dNV_remap_index], parameters) #define GET_VertexAttrib4dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dNV_remap_index]) #define SET_VertexAttrib4dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dNV_remap_index], fn) #define CALL_VertexAttrib4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib4dvNV_remap_index], parameters) #define GET_VertexAttrib4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvNV_remap_index]) #define SET_VertexAttrib4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvNV_remap_index], fn) #define CALL_VertexAttrib4fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib4fNV_remap_index], parameters) #define GET_VertexAttrib4fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fNV_remap_index]) #define SET_VertexAttrib4fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fNV_remap_index], fn) #define CALL_VertexAttrib4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib4fvNV_remap_index], parameters) #define GET_VertexAttrib4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvNV_remap_index]) #define SET_VertexAttrib4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvNV_remap_index], fn) #define CALL_VertexAttrib4sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib4sNV_remap_index], parameters) #define GET_VertexAttrib4sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sNV_remap_index]) #define SET_VertexAttrib4sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sNV_remap_index], fn) #define CALL_VertexAttrib4svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib4svNV_remap_index], parameters) #define GET_VertexAttrib4svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svNV_remap_index]) #define SET_VertexAttrib4svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svNV_remap_index], fn) #define CALL_VertexAttrib4ubNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte)), driDispatchRemapTable[VertexAttrib4ubNV_remap_index], parameters) #define GET_VertexAttrib4ubNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubNV_remap_index]) #define SET_VertexAttrib4ubNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubNV_remap_index], fn) #define CALL_VertexAttrib4ubvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLubyte *)), driDispatchRemapTable[VertexAttrib4ubvNV_remap_index], parameters) #define GET_VertexAttrib4ubvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvNV_remap_index]) #define SET_VertexAttrib4ubvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvNV_remap_index], fn) #define CALL_GenFragmentShadersATI(disp, parameters) CALL_by_offset(disp, (GLuint (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[GenFragmentShadersATI_remap_index], parameters) #define GET_GenFragmentShadersATI(disp) GET_by_offset(disp, driDispatchRemapTable[GenFragmentShadersATI_remap_index]) #define SET_GenFragmentShadersATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenFragmentShadersATI_remap_index], fn) #define CALL_BindFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[BindFragmentShaderATI_remap_index], parameters) #define GET_BindFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[BindFragmentShaderATI_remap_index]) #define SET_BindFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindFragmentShaderATI_remap_index], fn) #define CALL_DeleteFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[DeleteFragmentShaderATI_remap_index], parameters) #define GET_DeleteFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteFragmentShaderATI_remap_index]) #define SET_DeleteFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteFragmentShaderATI_remap_index], fn) #define CALL_BeginFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[BeginFragmentShaderATI_remap_index], parameters) #define GET_BeginFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[BeginFragmentShaderATI_remap_index]) #define SET_BeginFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BeginFragmentShaderATI_remap_index], fn) #define CALL_EndFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[EndFragmentShaderATI_remap_index], parameters) #define GET_EndFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[EndFragmentShaderATI_remap_index]) #define SET_EndFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EndFragmentShaderATI_remap_index], fn) #define CALL_PassTexCoordATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint, GLenum)), driDispatchRemapTable[PassTexCoordATI_remap_index], parameters) #define GET_PassTexCoordATI(disp) GET_by_offset(disp, driDispatchRemapTable[PassTexCoordATI_remap_index]) #define SET_PassTexCoordATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PassTexCoordATI_remap_index], fn) #define CALL_SampleMapATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint, GLenum)), driDispatchRemapTable[SampleMapATI_remap_index], parameters) #define GET_SampleMapATI(disp) GET_by_offset(disp, driDispatchRemapTable[SampleMapATI_remap_index]) #define SET_SampleMapATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SampleMapATI_remap_index], fn) #define CALL_ColorFragmentOp1ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[ColorFragmentOp1ATI_remap_index], parameters) #define GET_ColorFragmentOp1ATI(disp) GET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp1ATI_remap_index]) #define SET_ColorFragmentOp1ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp1ATI_remap_index], fn) #define CALL_ColorFragmentOp2ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[ColorFragmentOp2ATI_remap_index], parameters) #define GET_ColorFragmentOp2ATI(disp) GET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp2ATI_remap_index]) #define SET_ColorFragmentOp2ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp2ATI_remap_index], fn) #define CALL_ColorFragmentOp3ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[ColorFragmentOp3ATI_remap_index], parameters) #define GET_ColorFragmentOp3ATI(disp) GET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp3ATI_remap_index]) #define SET_ColorFragmentOp3ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp3ATI_remap_index], fn) #define CALL_AlphaFragmentOp1ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index], parameters) #define GET_AlphaFragmentOp1ATI(disp) GET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index]) #define SET_AlphaFragmentOp1ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index], fn) #define CALL_AlphaFragmentOp2ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index], parameters) #define GET_AlphaFragmentOp2ATI(disp) GET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index]) #define SET_AlphaFragmentOp2ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index], fn) #define CALL_AlphaFragmentOp3ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index], parameters) #define GET_AlphaFragmentOp3ATI(disp) GET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index]) #define SET_AlphaFragmentOp3ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index], fn) #define CALL_SetFragmentShaderConstantATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index], parameters) #define GET_SetFragmentShaderConstantATI(disp) GET_by_offset(disp, driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index]) #define SET_SetFragmentShaderConstantATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index], fn) #define CALL_IsRenderbufferEXT(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsRenderbufferEXT_remap_index], parameters) #define GET_IsRenderbufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IsRenderbufferEXT_remap_index]) #define SET_IsRenderbufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsRenderbufferEXT_remap_index], fn) #define CALL_BindRenderbufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindRenderbufferEXT_remap_index], parameters) #define GET_BindRenderbufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BindRenderbufferEXT_remap_index]) #define SET_BindRenderbufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindRenderbufferEXT_remap_index], fn) #define CALL_DeleteRenderbuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index], parameters) #define GET_DeleteRenderbuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index]) #define SET_DeleteRenderbuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index], fn) #define CALL_GenRenderbuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenRenderbuffersEXT_remap_index], parameters) #define GET_GenRenderbuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GenRenderbuffersEXT_remap_index]) #define SET_GenRenderbuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenRenderbuffersEXT_remap_index], fn) #define CALL_RenderbufferStorageEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLsizei, GLsizei)), driDispatchRemapTable[RenderbufferStorageEXT_remap_index], parameters) #define GET_RenderbufferStorageEXT(disp) GET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageEXT_remap_index]) #define SET_RenderbufferStorageEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageEXT_remap_index], fn) #define CALL_GetRenderbufferParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index], parameters) #define GET_GetRenderbufferParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index]) #define SET_GetRenderbufferParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index], fn) #define CALL_IsFramebufferEXT(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsFramebufferEXT_remap_index], parameters) #define GET_IsFramebufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IsFramebufferEXT_remap_index]) #define SET_IsFramebufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsFramebufferEXT_remap_index], fn) #define CALL_BindFramebufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindFramebufferEXT_remap_index], parameters) #define GET_BindFramebufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BindFramebufferEXT_remap_index]) #define SET_BindFramebufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindFramebufferEXT_remap_index], fn) #define CALL_DeleteFramebuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteFramebuffersEXT_remap_index], parameters) #define GET_DeleteFramebuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteFramebuffersEXT_remap_index]) #define SET_DeleteFramebuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteFramebuffersEXT_remap_index], fn) #define CALL_GenFramebuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenFramebuffersEXT_remap_index], parameters) #define GET_GenFramebuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GenFramebuffersEXT_remap_index]) #define SET_GenFramebuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenFramebuffersEXT_remap_index], fn) #define CALL_CheckFramebufferStatusEXT(disp, parameters) CALL_by_offset(disp, (GLenum (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index], parameters) #define GET_CheckFramebufferStatusEXT(disp) GET_by_offset(disp, driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index]) #define SET_CheckFramebufferStatusEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index], fn) #define CALL_FramebufferTexture1DEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint)), driDispatchRemapTable[FramebufferTexture1DEXT_remap_index], parameters) #define GET_FramebufferTexture1DEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTexture1DEXT_remap_index]) #define SET_FramebufferTexture1DEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTexture1DEXT_remap_index], fn) #define CALL_FramebufferTexture2DEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint)), driDispatchRemapTable[FramebufferTexture2DEXT_remap_index], parameters) #define GET_FramebufferTexture2DEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTexture2DEXT_remap_index]) #define SET_FramebufferTexture2DEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTexture2DEXT_remap_index], fn) #define CALL_FramebufferTexture3DEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint, GLint)), driDispatchRemapTable[FramebufferTexture3DEXT_remap_index], parameters) #define GET_FramebufferTexture3DEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTexture3DEXT_remap_index]) #define SET_FramebufferTexture3DEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTexture3DEXT_remap_index], fn) #define CALL_FramebufferRenderbufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint)), driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index], parameters) #define GET_FramebufferRenderbufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index]) #define SET_FramebufferRenderbufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index], fn) #define CALL_GetFramebufferAttachmentParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLint *)), driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index], parameters) #define GET_GetFramebufferAttachmentParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index]) #define SET_GetFramebufferAttachmentParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index], fn) #define CALL_GenerateMipmapEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[GenerateMipmapEXT_remap_index], parameters) #define GET_GenerateMipmapEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GenerateMipmapEXT_remap_index]) #define SET_GenerateMipmapEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenerateMipmapEXT_remap_index], fn) #define CALL_StencilFuncSeparate(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint, GLuint)), driDispatchRemapTable[StencilFuncSeparate_remap_index], parameters) #define GET_StencilFuncSeparate(disp) GET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparate_remap_index]) #define SET_StencilFuncSeparate(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparate_remap_index], fn) #define CALL_StencilOpSeparate(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[StencilOpSeparate_remap_index], parameters) #define GET_StencilOpSeparate(disp) GET_by_offset(disp, driDispatchRemapTable[StencilOpSeparate_remap_index]) #define SET_StencilOpSeparate(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilOpSeparate_remap_index], fn) #define CALL_StencilMaskSeparate(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[StencilMaskSeparate_remap_index], parameters) #define GET_StencilMaskSeparate(disp) GET_by_offset(disp, driDispatchRemapTable[StencilMaskSeparate_remap_index]) #define SET_StencilMaskSeparate(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilMaskSeparate_remap_index], fn) #endif /* !defined(IN_DRI_DRIVER) */ #endif /* !defined( _DISPATCH_H_ ) */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/glapi/glapi.c0000644000000000000000000007415413614532424017564 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * This file manages the OpenGL API dispatch layer. * The dispatch table (struct _glapi_table) is basically just a list * of function pointers. * There are functions to set/get the current dispatch table for the * current thread and to manage registration/dispatch of dynamically * added extension functions. * * It's intended that this file and the other glapi*.[ch] files are * flexible enough to be reused in several places: XFree86, DRI- * based libGL.so, and perhaps the SGI SI. * * NOTE: There are no dependencies on Mesa in this code. * * Versions (API changes): * 2000/02/23 - original version for Mesa 3.3 and XFree86 4.0 * 2001/01/16 - added dispatch override feature for Mesa 3.5 * 2002/06/28 - added _glapi_set_warning_func(), Mesa 4.1. * 2002/10/01 - _glapi_get_proc_address() will now generate new entrypoints * itself (using offset ~0). _glapi_add_entrypoint() can be * called afterward and it'll fill in the correct dispatch * offset. This allows DRI libGL to avoid probing for DRI * drivers! No changes to the public glapi interface. */ #include "glheader.h" #include "glapi.h" #include "glapioffsets.h" #include "glapitable.h" #include "glthread.h" /***** BEGIN NO-OP DISPATCH *****/ static GLboolean WarnFlag = GL_FALSE; static _glapi_warning_func warning_func; static void init_glapi_relocs(void); static _glapi_proc generate_entrypoint(GLuint functionOffset); static void fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset); /* * Enable/disable printing of warning messages. */ PUBLIC void _glapi_noop_enable_warnings(GLboolean enable) { WarnFlag = enable; } /* * Register a callback function for reporting errors. */ PUBLIC void _glapi_set_warning_func( _glapi_warning_func func ) { warning_func = func; } static GLboolean warn(void) { if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) && warning_func) { return GL_TRUE; } else { return GL_FALSE; } } #define KEYWORD1 static #define KEYWORD2 GLAPIENTRY #define NAME(func) NoOp##func #define F NULL #define DISPATCH(func, args, msg) \ if (warn()) { \ warning_func(NULL, "GL User Error: called without context: %s", #func); \ } #define RETURN_DISPATCH(func, args, msg) \ if (warn()) { \ warning_func(NULL, "GL User Error: called without context: %s", #func); \ } \ return 0 #define DISPATCH_TABLE_NAME __glapi_noop_table #define UNUSED_TABLE_NAME __unused_noop_functions #define TABLE_ENTRY(name) (_glapi_proc) NoOp##name static GLint NoOpUnused(void) { if (warn()) { warning_func(NULL, "GL User Error: calling extension function without a current context\n"); } return 0; } #include "glapitemp.h" /***** END NO-OP DISPATCH *****/ /** * \name Current dispatch and current context control variables * * Depending on whether or not multithreading is support, and the type of * support available, several variables are used to store the current context * pointer and the current dispatch table pointer. In the non-threaded case, * the variables \c _glapi_Dispatch and \c _glapi_Context are used for this * purpose. * * In the "normal" threaded case, the variables \c _glapi_Dispatch and * \c _glapi_Context will be \c NULL if an application is detected as being * multithreaded. Single-threaded applications will use \c _glapi_Dispatch * and \c _glapi_Context just like the case without any threading support. * When \c _glapi_Dispatch and \c _glapi_Context are \c NULL, the thread state * data \c _gl_DispatchTSD and \c ContextTSD are used. Drivers and the * static dispatch functions access these variables via \c _glapi_get_dispatch * and \c _glapi_get_context. * * There is a race condition in setting \c _glapi_Dispatch to \c NULL. It is * possible for the original thread to be setting it at the same instant a new * thread, perhaps running on a different processor, is clearing it. Because * of that, \c ThreadSafe, which can only ever be changed to \c GL_TRUE, is * used to determine whether or not the application is multithreaded. * * In the TLS case, the variables \c _glapi_Dispatch and \c _glapi_Context are * hardcoded to \c NULL. Instead the TLS variables \c _glapi_tls_Dispatch and * \c _glapi_tls_Context are used. Having \c _glapi_Dispatch and * \c _glapi_Context be hardcoded to \c NULL maintains binary compatability * between TLS enabled loaders and non-TLS DRI drivers. */ /*@{*/ #if defined(GLX_USE_TLS) PUBLIC __thread struct _glapi_table * _glapi_tls_Dispatch __attribute__((tls_model("initial-exec"))) = (struct _glapi_table *) __glapi_noop_table; PUBLIC __thread void * _glapi_tls_Context __attribute__((tls_model("initial-exec"))); PUBLIC const struct _glapi_table *_glapi_Dispatch = NULL; PUBLIC const void *_glapi_Context = NULL; #else #if defined(THREADS) static GLboolean ThreadSafe = GL_FALSE; /**< In thread-safe mode? */ _glthread_TSD _gl_DispatchTSD; /**< Per-thread dispatch pointer */ static _glthread_TSD ContextTSD; /**< Per-thread context pointer */ #endif /* defined(THREADS) */ PUBLIC struct _glapi_table *_glapi_Dispatch = (struct _glapi_table *) __glapi_noop_table; PUBLIC void *_glapi_Context = NULL; #endif /* defined(GLX_USE_TLS) */ /*@}*/ /** * strdup() is actually not a standard ANSI C or POSIX routine. * Irix will not define it if ANSI mode is in effect. */ static char * str_dup(const char *str) { char *copy; copy = (char*) malloc(strlen(str) + 1); if (!copy) return NULL; strcpy(copy, str); return copy; } /** * We should call this periodically from a function such as glXMakeCurrent * in order to test if multiple threads are being used. */ void _glapi_check_multithread(void) { #if defined(THREADS) && !defined(GLX_USE_TLS) if (!ThreadSafe) { static unsigned long knownID; static GLboolean firstCall = GL_TRUE; if (firstCall) { knownID = _glthread_GetID(); firstCall = GL_FALSE; } else if (knownID != _glthread_GetID()) { ThreadSafe = GL_TRUE; _glapi_set_dispatch(NULL); } } else if (!_glapi_get_dispatch()) { /* make sure that this thread's dispatch pointer isn't null */ _glapi_set_dispatch(NULL); } #endif } /** * Set the current context pointer for this thread. * The context pointer is an opaque type which should be cast to * void from the real context pointer type. */ PUBLIC void _glapi_set_context(void *context) { (void) __unused_noop_functions; /* silence a warning */ #if defined(GLX_USE_TLS) _glapi_tls_Context = context; #elif defined(THREADS) _glthread_SetTSD(&ContextTSD, context); _glapi_Context = (ThreadSafe) ? NULL : context; #else _glapi_Context = context; #endif } /** * Get the current context pointer for this thread. * The context pointer is an opaque type which should be cast from * void to the real context pointer type. */ PUBLIC void * _glapi_get_context(void) { #if defined(GLX_USE_TLS) return _glapi_tls_Context; #elif defined(THREADS) if (ThreadSafe) { return _glthread_GetTSD(&ContextTSD); } else { return _glapi_Context; } #else return _glapi_Context; #endif } /** * Set the global or per-thread dispatch table pointer. */ PUBLIC void _glapi_set_dispatch(struct _glapi_table *dispatch) { #if defined(PTHREADS) || defined(GLX_USE_TLS) static pthread_once_t once_control = PTHREAD_ONCE_INIT; pthread_once( & once_control, init_glapi_relocs ); #endif if (!dispatch) { /* use the no-op functions */ dispatch = (struct _glapi_table *) __glapi_noop_table; } #ifdef DEBUG else { _glapi_check_table(dispatch); } #endif #if defined(GLX_USE_TLS) _glapi_tls_Dispatch = dispatch; #elif defined(THREADS) _glthread_SetTSD(&_gl_DispatchTSD, (void *) dispatch); _glapi_Dispatch = (ThreadSafe) ? NULL : dispatch; #else /*THREADS*/ _glapi_Dispatch = dispatch; #endif /*THREADS*/ } /** * Return pointer to current dispatch table for calling thread. */ PUBLIC struct _glapi_table * _glapi_get_dispatch(void) { struct _glapi_table * api; #if defined(GLX_USE_TLS) api = _glapi_tls_Dispatch; #elif defined(THREADS) api = (ThreadSafe) ? (struct _glapi_table *) _glthread_GetTSD(&_gl_DispatchTSD) : _glapi_Dispatch; #else api = _glapi_Dispatch; #endif assert( api != NULL ); return api; } #if !defined( USE_X86_ASM ) && !defined( XFree86Server ) #define NEED_FUNCTION_POINTER #endif /* The code in this file is auto-generated with Python */ #include "glprocs.h" /** * Search the table of static entrypoint functions for the named function * and return the corresponding glprocs_table_t entry. */ static const glprocs_table_t * find_entry( const char * n ) { GLuint i; for (i = 0; static_functions[i].Name_offset >= 0; i++) { const char * test_name; test_name = gl_string_table + static_functions[i].Name_offset; if (strcmp(test_name, n) == 0) { return & static_functions[i]; } } return NULL; } /** * Return dispatch table offset of the named static (built-in) function. * Return -1 if function not found. */ static GLint get_static_proc_offset(const char *funcName) { const glprocs_table_t * const f = find_entry( funcName ); if ( f != NULL ) { return f->Offset; } return -1; } #if !defined( XFree86Server ) #ifdef USE_X86_ASM #if defined( GLX_USE_TLS ) extern GLubyte gl_dispatch_functions_start[]; extern GLubyte gl_dispatch_functions_end[]; #else extern const GLubyte gl_dispatch_functions_start[]; #endif # if defined(THREADS) && !defined(GLX_USE_TLS) # define X86_DISPATCH_FUNCTION_SIZE 32 # else # define X86_DISPATCH_FUNCTION_SIZE 16 # endif /** * Return dispatch function address the named static (built-in) function. * Return NULL if function not found. */ static const _glapi_proc get_static_proc_address(const char *funcName) { const glprocs_table_t * const f = find_entry( funcName ); if ( f != NULL ) { return (_glapi_proc) (gl_dispatch_functions_start + (X86_DISPATCH_FUNCTION_SIZE * f->Offset)); } else { return NULL; } } #else /** * Return pointer to the named static (built-in) function. * \return NULL if function not found. */ static const _glapi_proc get_static_proc_address(const char *funcName) { const glprocs_table_t * const f = find_entry( funcName ); return ( f != NULL ) ? f->Address : NULL; } #endif /* USE_X86_ASM */ #endif /* !defined( XFree86Server ) */ /** * Return the name of the function at the given offset in the dispatch * table. For debugging only. */ static const char * get_static_proc_name( GLuint offset ) { GLuint i; for (i = 0; static_functions[i].Name_offset >= 0; i++) { if (static_functions[i].Offset == offset) { return gl_string_table + static_functions[i].Name_offset; } } return NULL; } /********************************************************************** * Extension function management. */ /* * Number of extension functions which we can dynamically add at runtime. */ #define MAX_EXTENSION_FUNCS 300 /* * The dispatch table size (number of entries) is the size of the * _glapi_table struct plus the number of dynamic entries we can add. * The extra slots can be filled in by DRI drivers that register new extension * functions. */ #define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS) /** * Track information about a function added to the GL API. */ struct _glapi_function { /** * Name of the function. */ const char * name; /** * Text string that describes the types of the parameters passed to the * named function. Parameter types are converted to characters using the * following rules: * - 'i' for \c GLint, \c GLuint, and \c GLenum * - 'p' for any pointer type * - 'f' for \c GLfloat and \c GLclampf * - 'd' for \c GLdouble and \c GLclampd */ const char * parameter_signature; /** * Offset in the dispatch table where the pointer to the real function is * located. If the driver has not requested that the named function be * added to the dispatch table, this will have the value ~0. */ unsigned dispatch_offset; /** * Pointer to the dispatch stub for the named function. * * \todo * The semantic of this field should be changed slightly. Currently, it * is always expected to be non-\c NULL. However, it would be better to * only allocate the entry-point stub when the application requests the * function via \c glXGetProcAddress. This would save memory for all the * functions that the driver exports but that the application never wants * to call. */ _glapi_proc dispatch_stub; }; static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS]; static GLuint NumExtEntryPoints = 0; #ifdef USE_SPARC_ASM extern void __glapi_sparc_icache_flush(unsigned int *); #endif /** * Generate a dispatch function (entrypoint) which jumps through * the given slot number (offset) in the current dispatch table. * We need assembly language in order to accomplish this. */ static _glapi_proc generate_entrypoint(GLuint functionOffset) { #if defined(USE_X86_ASM) /* 32 is chosen as something of a magic offset. For x86, the dispatch * at offset 32 is the first one where the offset in the * "jmp OFFSET*4(%eax)" can't be encoded in a single byte. */ const GLubyte * const template_func = gl_dispatch_functions_start + (X86_DISPATCH_FUNCTION_SIZE * 32); GLubyte * const code = (GLubyte *) malloc( X86_DISPATCH_FUNCTION_SIZE ); if ( code != NULL ) { (void) memcpy( code, template_func, X86_DISPATCH_FUNCTION_SIZE ); fill_in_entrypoint_offset( (_glapi_proc) code, functionOffset ); } return (_glapi_proc) code; #elif defined(USE_SPARC_ASM) #ifdef __arch64__ static const unsigned int insn_template[] = { 0x05000000, /* sethi %uhi(_glapi_Dispatch), %g2 */ 0x03000000, /* sethi %hi(_glapi_Dispatch), %g1 */ 0x8410a000, /* or %g2, %ulo(_glapi_Dispatch), %g2 */ 0x82106000, /* or %g1, %lo(_glapi_Dispatch), %g1 */ 0x8528b020, /* sllx %g2, 32, %g2 */ 0xc2584002, /* ldx [%g1 + %g2], %g1 */ 0x05000000, /* sethi %hi(8 * glapioffset), %g2 */ 0x8410a000, /* or %g2, %lo(8 * glapioffset), %g2 */ 0xc6584002, /* ldx [%g1 + %g2], %g3 */ 0x81c0c000, /* jmpl %g3, %g0 */ 0x01000000 /* nop */ }; #else static const unsigned int insn_template[] = { 0x03000000, /* sethi %hi(_glapi_Dispatch), %g1 */ 0xc2006000, /* ld [%g1 + %lo(_glapi_Dispatch)], %g1 */ 0xc6006000, /* ld [%g1 + %lo(4*glapioffset)], %g3 */ 0x81c0c000, /* jmpl %g3, %g0 */ 0x01000000 /* nop */ }; #endif unsigned int *code = (unsigned int *) malloc(sizeof(insn_template)); unsigned long glapi_addr = (unsigned long) &_glapi_Dispatch; if (code) { memcpy(code, insn_template, sizeof(insn_template)); #ifdef __arch64__ code[0] |= (glapi_addr >> (32 + 10)); code[1] |= ((glapi_addr & 0xffffffff) >> 10); __glapi_sparc_icache_flush(&code[0]); code[2] |= ((glapi_addr >> 32) & ((1 << 10) - 1)); code[3] |= (glapi_addr & ((1 << 10) - 1)); __glapi_sparc_icache_flush(&code[2]); code[6] |= ((functionOffset * 8) >> 10); code[7] |= ((functionOffset * 8) & ((1 << 10) - 1)); __glapi_sparc_icache_flush(&code[6]); #else code[0] |= (glapi_addr >> 10); code[1] |= (glapi_addr & ((1 << 10) - 1)); __glapi_sparc_icache_flush(&code[0]); code[2] |= (functionOffset * 4); __glapi_sparc_icache_flush(&code[2]); #endif } return (_glapi_proc) code; #else (void) functionOffset; return NULL; #endif /* USE_*_ASM */ } /** * This function inserts a new dispatch offset into the assembly language * stub that was generated with the preceeding function. */ static void fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset) { #if defined(USE_X86_ASM) GLubyte * const code = (GLubyte *) entrypoint; #if X86_DISPATCH_FUNCTION_SIZE == 32 *((unsigned int *)(code + 11)) = 4 * offset; *((unsigned int *)(code + 22)) = 4 * offset; #elif X86_DISPATCH_FUNCTION_SIZE == 16 && defined( GLX_USE_TLS ) *((unsigned int *)(code + 8)) = 4 * offset; #elif X86_DISPATCH_FUNCTION_SIZE == 16 *((unsigned int *)(code + 7)) = 4 * offset; #else # error Invalid X86_DISPATCH_FUNCTION_SIZE! #endif #elif defined(USE_SPARC_ASM) /* XXX this hasn't been tested! */ unsigned int *code = (unsigned int *) entrypoint; #ifdef __arch64__ code[6] = 0x05000000; /* sethi %hi(8 * glapioffset), %g2 */ code[7] = 0x8410a000; /* or %g2, %lo(8 * glapioffset), %g2 */ code[6] |= ((offset * 8) >> 10); code[7] |= ((offset * 8) & ((1 << 10) - 1)); __glapi_sparc_icache_flush(&code[6]); #else /* __arch64__ */ code[2] = 0xc6006000; /* ld [%g1 + %lo(4*glapioffset)], %g3 */ code[2] |= (offset * 4); __glapi_sparc_icache_flush(&code[2]); #endif /* __arch64__ */ #else /* an unimplemented architecture */ (void) entrypoint; (void) offset; #endif /* USE_*_ASM */ } /** * Generate new entrypoint * * Use a temporary dispatch offset of ~0 (i.e. -1). Later, when the driver * calls \c _glapi_add_dispatch we'll put in the proper offset. If that * never happens, and the user calls this function, he'll segfault. That's * what you get when you try calling a GL function that doesn't really exist. * * \param funcName Name of the function to create an entry-point for. * * \sa _glapi_add_entrypoint */ static struct _glapi_function * add_function_name( const char * funcName ) { struct _glapi_function * entry = NULL; if (NumExtEntryPoints < MAX_EXTENSION_FUNCS) { _glapi_proc entrypoint = generate_entrypoint(~0); if (entrypoint != NULL) { entry = & ExtEntryTable[NumExtEntryPoints]; ExtEntryTable[NumExtEntryPoints].name = str_dup(funcName); ExtEntryTable[NumExtEntryPoints].parameter_signature = NULL; ExtEntryTable[NumExtEntryPoints].dispatch_offset = ~0; ExtEntryTable[NumExtEntryPoints].dispatch_stub = entrypoint; NumExtEntryPoints++; } } return entry; } /** * Fill-in the dispatch stub for the named function. * * This function is intended to be called by a hardware driver. When called, * a dispatch stub may be created created for the function. A pointer to this * dispatch function will be returned by glXGetProcAddress. * * \param function_names Array of pointers to function names that should * share a common dispatch offset. * \param parameter_signature String representing the types of the parameters * passed to the named function. Parameter types * are converted to characters using the following * rules: * - 'i' for \c GLint, \c GLuint, and \c GLenum * - 'p' for any pointer type * - 'f' for \c GLfloat and \c GLclampf * - 'd' for \c GLdouble and \c GLclampd * * \returns * The offset in the dispatch table of the named function. A pointer to the * driver's implementation of the named function should be stored at * \c dispatch_table[\c offset]. * * \sa glXGetProcAddress * * \warning * This function can only handle up to 8 names at a time. As far as I know, * the maximum number of names ever associated with an existing GL function is * 4 (\c glPointParameterfSGIS, \c glPointParameterfEXT, * \c glPointParameterfARB, and \c glPointParameterf), so this should not be * too painful of a limitation. * * \todo * Determine whether or not \c parameter_signature should be allowed to be * \c NULL. It doesn't seem like much of a hardship for drivers to have to * pass in an empty string. * * \todo * Determine if code should be added to reject function names that start with * 'glX'. * * \bug * Add code to compare \c parameter_signature with the parameter signature of * a static function. In order to do that, we need to find a way to \b get * the parameter signature of a static function. */ PUBLIC int _glapi_add_dispatch( const char * const * function_names, const char * parameter_signature ) { static int next_dynamic_offset = _gloffset_FIRST_DYNAMIC; const char * const real_sig = (parameter_signature != NULL) ? parameter_signature : ""; struct _glapi_function * entry[8]; GLboolean is_static[8]; unsigned i; unsigned j; int offset = ~0; int new_offset; (void) memset( is_static, 0, sizeof( is_static ) ); (void) memset( entry, 0, sizeof( entry ) ); for ( i = 0 ; function_names[i] != NULL ; i++ ) { /* Do some trivial validation on the name of the function. */ #ifdef MANGLE if (!function_names[i] || function_names[i][0] != 'm' || function_names[i][1] != 'g' || function_names[i][2] != 'l') return GL_FALSE; #else if (!function_names[i] || function_names[i][0] != 'g' || function_names[i][1] != 'l') return GL_FALSE; #endif /* Determine if the named function already exists. If the function does * exist, it must have the same parameter signature as the function * being added. */ new_offset = get_static_proc_offset(function_names[i]); if (new_offset >= 0) { /* FIXME: Make sure the parameter signatures match! How do we get * FIXME: the parameter signature for static functions? */ if ( (offset != ~0) && (new_offset != offset) ) { return -1; } is_static[i] = GL_TRUE; offset = new_offset; } for ( j = 0 ; j < NumExtEntryPoints ; j++ ) { if (strcmp(ExtEntryTable[j].name, function_names[i]) == 0) { /* The offset may be ~0 if the function name was added by * glXGetProcAddress but never filled in by the driver. */ if (ExtEntryTable[j].dispatch_offset != ~0) { if (strcmp(real_sig, ExtEntryTable[j].parameter_signature) != 0) { return -1; } if ( (offset != ~0) && (ExtEntryTable[j].dispatch_offset != offset) ) { return -1; } offset = ExtEntryTable[j].dispatch_offset; } entry[i] = & ExtEntryTable[j]; break; } } } if (offset == ~0) { offset = next_dynamic_offset; next_dynamic_offset++; } for ( i = 0 ; function_names[i] != NULL ; i++ ) { if (! is_static[i] ) { if (entry[i] == NULL) { entry[i] = add_function_name( function_names[i] ); if (entry[i] == NULL) { /* FIXME: Possible memory leak here. */ return -1; } } entry[i]->parameter_signature = str_dup(real_sig); fill_in_entrypoint_offset(entry[i]->dispatch_stub, offset); entry[i]->dispatch_offset = offset; } } return offset; } /** * Return offset of entrypoint for named function within dispatch table. */ PUBLIC GLint _glapi_get_proc_offset(const char *funcName) { /* search extension functions first */ GLuint i; for (i = 0; i < NumExtEntryPoints; i++) { if (strcmp(ExtEntryTable[i].name, funcName) == 0) { return ExtEntryTable[i].dispatch_offset; } } /* search static functions */ return get_static_proc_offset(funcName); } /** * Return pointer to the named function. If the function name isn't found * in the name of static functions, try generating a new API entrypoint on * the fly with assembly language. */ _glapi_proc _glapi_get_proc_address(const char *funcName) { struct _glapi_function * entry; GLuint i; #ifdef MANGLE if (funcName[0] != 'm' || funcName[1] != 'g' || funcName[2] != 'l') return NULL; #else if (funcName[0] != 'g' || funcName[1] != 'l') return NULL; #endif /* search extension functions first */ for (i = 0; i < NumExtEntryPoints; i++) { if (strcmp(ExtEntryTable[i].name, funcName) == 0) { return ExtEntryTable[i].dispatch_stub; } } #if !defined( XFree86Server ) /* search static functions */ { const _glapi_proc func = get_static_proc_address(funcName); if (func) return func; } #endif /* !defined( XFree86Server ) */ entry = add_function_name(funcName); return (entry == NULL) ? NULL : entry->dispatch_stub; } /** * Return the name of the function at the given dispatch offset. * This is only intended for debugging. */ const char * _glapi_get_proc_name(GLuint offset) { GLuint i; const char * n; /* search built-in functions */ n = get_static_proc_name(offset); if ( n != NULL ) { return n; } /* search added extension functions */ for (i = 0; i < NumExtEntryPoints; i++) { if (ExtEntryTable[i].dispatch_offset == offset) { return ExtEntryTable[i].name; } } return NULL; } /** * Return size of dispatch table struct as number of functions (or * slots). */ PUBLIC GLuint _glapi_get_dispatch_table_size(void) { return DISPATCH_TABLE_SIZE; } /** * Make sure there are no NULL pointers in the given dispatch table. * Intended for debugging purposes. */ void _glapi_check_table(const struct _glapi_table *table) { #ifdef DEBUG const GLuint entries = _glapi_get_dispatch_table_size(); const void **tab = (const void **) table; GLuint i; for (i = 1; i < entries; i++) { assert(tab[i]); } /* Do some spot checks to be sure that the dispatch table * slots are assigned correctly. */ { GLuint BeginOffset = _glapi_get_proc_offset("glBegin"); char *BeginFunc = (char*) &table->Begin; GLuint offset = (BeginFunc - (char *) table) / sizeof(void *); assert(BeginOffset == _gloffset_Begin); assert(BeginOffset == offset); } { GLuint viewportOffset = _glapi_get_proc_offset("glViewport"); char *viewportFunc = (char*) &table->Viewport; GLuint offset = (viewportFunc - (char *) table) / sizeof(void *); assert(viewportOffset == _gloffset_Viewport); assert(viewportOffset == offset); } { GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer"); char *VertexPointerFunc = (char*) &table->VertexPointer; GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *); assert(VertexPointerOffset == _gloffset_VertexPointer); assert(VertexPointerOffset == offset); } { GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax"); char *ResetMinMaxFunc = (char*) &table->ResetMinmax; GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *); assert(ResetMinMaxOffset == _gloffset_ResetMinmax); assert(ResetMinMaxOffset == offset); } { GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor"); char *blendColorFunc = (char*) &table->BlendColor; GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *); assert(blendColorOffset == _gloffset_BlendColor); assert(blendColorOffset == offset); } { GLuint istextureOffset = _glapi_get_proc_offset("glIsTextureEXT"); char *istextureFunc = (char*) &table->IsTextureEXT; GLuint offset = (istextureFunc - (char *) table) / sizeof(void *); assert(istextureOffset == _gloffset_IsTextureEXT); assert(istextureOffset == offset); } { GLuint secondaryColor3fOffset = _glapi_get_proc_offset("glSecondaryColor3fEXT"); char *secondaryColor3fFunc = (char*) &table->SecondaryColor3fEXT; GLuint offset = (secondaryColor3fFunc - (char *) table) / sizeof(void *); assert(secondaryColor3fOffset == _gloffset_SecondaryColor3fEXT); assert(secondaryColor3fOffset == offset); assert(_glapi_get_proc_address("glSecondaryColor3fEXT") == (_glapi_proc) &glSecondaryColor3fEXT); } { GLuint pointParameterivOffset = _glapi_get_proc_offset("glPointParameterivNV"); char *pointParameterivFunc = (char*) &table->PointParameterivNV; GLuint offset = (pointParameterivFunc - (char *) table) / sizeof(void *); assert(pointParameterivOffset == _gloffset_PointParameterivNV); assert(pointParameterivOffset == offset); assert(_glapi_get_proc_address("glPointParameterivNV") == (_glapi_proc) &glPointParameterivNV); } { GLuint setFenceOffset = _glapi_get_proc_offset("glSetFenceNV"); char *setFenceFunc = (char*) &table->SetFenceNV; GLuint offset = (setFenceFunc - (char *) table) / sizeof(void *); assert(setFenceOffset == _gloffset_SetFenceNV); assert(setFenceOffset == offset); assert(_glapi_get_proc_address("glSetFenceNV") == (_glapi_proc) &glSetFenceNV); } #else (void) table; #endif } /** * Perform platform-specific GL API entry-point fixups. * * */ static void init_glapi_relocs( void ) { #if defined( USE_X86_ASM ) && defined( GLX_USE_TLS ) extern void * _x86_get_dispatch(void); const GLubyte * const get_disp = (const GLubyte *) _x86_get_dispatch; GLubyte * curr_func = (GLubyte *) gl_dispatch_functions_start; while ( curr_func != (GLubyte *) gl_dispatch_functions_end ) { (void) memcpy( curr_func, get_disp, 6 ); curr_func += X86_DISPATCH_FUNCTION_SIZE; } #endif /* defined( USE_X86_ASM ) && defined( GLX_USE_TLS ) */ } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/glapi/glapi.h0000644000000000000000000000727713614532424017573 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \mainpage Mesa GL API Module * * \section GLAPIIntroduction Introduction * * The Mesa GL API module is responsible for dispatching all the * gl*() functions. All GL functions are dispatched by jumping through * the current dispatch table (basically a struct full of function * pointers.) * * A per-thread current dispatch table and per-thread current context * pointer are managed by this module too. * * This module is intended to be non-Mesa-specific so it can be used * with the X/DRI libGL also. */ #ifndef _GLAPI_H #define _GLAPI_H #include "GL/gl.h" #include "glapitable.h" typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...); #if defined (GLX_USE_TLS) const extern void *_glapi_Context; const extern struct _glapi_table *_glapi_Dispatch; extern __thread void * _glapi_tls_Context __attribute__((tls_model("initial-exec"))); # define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context #else extern void *_glapi_Context; extern struct _glapi_table *_glapi_Dispatch; /** * Macro for declaration and fetching the current context. * * \param C local variable which will hold the current context. * * It should be used in the variable declaration area of a function: * \code * ... * { * GET_CURRENT_CONTEXT(ctx); * ... * \endcode */ # ifdef THREADS # define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) (_glapi_Context ? _glapi_Context : _glapi_get_context()) # else # define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context # endif #endif /* defined (GLX_USE_TLS) */ extern void _glapi_noop_enable_warnings(GLboolean enable); extern void _glapi_set_warning_func(_glapi_warning_func func); extern void _glapi_check_multithread(void); extern void _glapi_set_context(void *context); extern void * _glapi_get_context(void); extern void _glapi_set_dispatch(struct _glapi_table *dispatch); extern struct _glapi_table * _glapi_get_dispatch(void); extern int _glapi_begin_dispatch_override(struct _glapi_table *override); extern void _glapi_end_dispatch_override(int layer); struct _glapi_table * _glapi_get_override_dispatch(int layer); extern GLuint _glapi_get_dispatch_table_size(void); extern void _glapi_check_table(const struct _glapi_table *table); extern int _glapi_add_dispatch( const char * const * function_names, const char * parameter_signature ); extern GLint _glapi_get_proc_offset(const char *funcName); extern _glapi_proc _glapi_get_proc_address(const char *funcName); extern const char * _glapi_get_proc_name(GLuint offset); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/glapi/glapioffsets.h0000644000000000000000000021114413614532424021153 0ustar /* DO NOT EDIT - This file generated automatically by gl_offsets.py (from Mesa) script */ /* * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * (C) Copyright IBM Corporation 2004 * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sub license, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL, IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #if !defined( _GLAPI_OFFSETS_H_ ) # define _GLAPI_OFFSETS_H_ #define _gloffset_NewList 0 #define _gloffset_EndList 1 #define _gloffset_CallList 2 #define _gloffset_CallLists 3 #define _gloffset_DeleteLists 4 #define _gloffset_GenLists 5 #define _gloffset_ListBase 6 #define _gloffset_Begin 7 #define _gloffset_Bitmap 8 #define _gloffset_Color3b 9 #define _gloffset_Color3bv 10 #define _gloffset_Color3d 11 #define _gloffset_Color3dv 12 #define _gloffset_Color3f 13 #define _gloffset_Color3fv 14 #define _gloffset_Color3i 15 #define _gloffset_Color3iv 16 #define _gloffset_Color3s 17 #define _gloffset_Color3sv 18 #define _gloffset_Color3ub 19 #define _gloffset_Color3ubv 20 #define _gloffset_Color3ui 21 #define _gloffset_Color3uiv 22 #define _gloffset_Color3us 23 #define _gloffset_Color3usv 24 #define _gloffset_Color4b 25 #define _gloffset_Color4bv 26 #define _gloffset_Color4d 27 #define _gloffset_Color4dv 28 #define _gloffset_Color4f 29 #define _gloffset_Color4fv 30 #define _gloffset_Color4i 31 #define _gloffset_Color4iv 32 #define _gloffset_Color4s 33 #define _gloffset_Color4sv 34 #define _gloffset_Color4ub 35 #define _gloffset_Color4ubv 36 #define _gloffset_Color4ui 37 #define _gloffset_Color4uiv 38 #define _gloffset_Color4us 39 #define _gloffset_Color4usv 40 #define _gloffset_EdgeFlag 41 #define _gloffset_EdgeFlagv 42 #define _gloffset_End 43 #define _gloffset_Indexd 44 #define _gloffset_Indexdv 45 #define _gloffset_Indexf 46 #define _gloffset_Indexfv 47 #define _gloffset_Indexi 48 #define _gloffset_Indexiv 49 #define _gloffset_Indexs 50 #define _gloffset_Indexsv 51 #define _gloffset_Normal3b 52 #define _gloffset_Normal3bv 53 #define _gloffset_Normal3d 54 #define _gloffset_Normal3dv 55 #define _gloffset_Normal3f 56 #define _gloffset_Normal3fv 57 #define _gloffset_Normal3i 58 #define _gloffset_Normal3iv 59 #define _gloffset_Normal3s 60 #define _gloffset_Normal3sv 61 #define _gloffset_RasterPos2d 62 #define _gloffset_RasterPos2dv 63 #define _gloffset_RasterPos2f 64 #define _gloffset_RasterPos2fv 65 #define _gloffset_RasterPos2i 66 #define _gloffset_RasterPos2iv 67 #define _gloffset_RasterPos2s 68 #define _gloffset_RasterPos2sv 69 #define _gloffset_RasterPos3d 70 #define _gloffset_RasterPos3dv 71 #define _gloffset_RasterPos3f 72 #define _gloffset_RasterPos3fv 73 #define _gloffset_RasterPos3i 74 #define _gloffset_RasterPos3iv 75 #define _gloffset_RasterPos3s 76 #define _gloffset_RasterPos3sv 77 #define _gloffset_RasterPos4d 78 #define _gloffset_RasterPos4dv 79 #define _gloffset_RasterPos4f 80 #define _gloffset_RasterPos4fv 81 #define _gloffset_RasterPos4i 82 #define _gloffset_RasterPos4iv 83 #define _gloffset_RasterPos4s 84 #define _gloffset_RasterPos4sv 85 #define _gloffset_Rectd 86 #define _gloffset_Rectdv 87 #define _gloffset_Rectf 88 #define _gloffset_Rectfv 89 #define _gloffset_Recti 90 #define _gloffset_Rectiv 91 #define _gloffset_Rects 92 #define _gloffset_Rectsv 93 #define _gloffset_TexCoord1d 94 #define _gloffset_TexCoord1dv 95 #define _gloffset_TexCoord1f 96 #define _gloffset_TexCoord1fv 97 #define _gloffset_TexCoord1i 98 #define _gloffset_TexCoord1iv 99 #define _gloffset_TexCoord1s 100 #define _gloffset_TexCoord1sv 101 #define _gloffset_TexCoord2d 102 #define _gloffset_TexCoord2dv 103 #define _gloffset_TexCoord2f 104 #define _gloffset_TexCoord2fv 105 #define _gloffset_TexCoord2i 106 #define _gloffset_TexCoord2iv 107 #define _gloffset_TexCoord2s 108 #define _gloffset_TexCoord2sv 109 #define _gloffset_TexCoord3d 110 #define _gloffset_TexCoord3dv 111 #define _gloffset_TexCoord3f 112 #define _gloffset_TexCoord3fv 113 #define _gloffset_TexCoord3i 114 #define _gloffset_TexCoord3iv 115 #define _gloffset_TexCoord3s 116 #define _gloffset_TexCoord3sv 117 #define _gloffset_TexCoord4d 118 #define _gloffset_TexCoord4dv 119 #define _gloffset_TexCoord4f 120 #define _gloffset_TexCoord4fv 121 #define _gloffset_TexCoord4i 122 #define _gloffset_TexCoord4iv 123 #define _gloffset_TexCoord4s 124 #define _gloffset_TexCoord4sv 125 #define _gloffset_Vertex2d 126 #define _gloffset_Vertex2dv 127 #define _gloffset_Vertex2f 128 #define _gloffset_Vertex2fv 129 #define _gloffset_Vertex2i 130 #define _gloffset_Vertex2iv 131 #define _gloffset_Vertex2s 132 #define _gloffset_Vertex2sv 133 #define _gloffset_Vertex3d 134 #define _gloffset_Vertex3dv 135 #define _gloffset_Vertex3f 136 #define _gloffset_Vertex3fv 137 #define _gloffset_Vertex3i 138 #define _gloffset_Vertex3iv 139 #define _gloffset_Vertex3s 140 #define _gloffset_Vertex3sv 141 #define _gloffset_Vertex4d 142 #define _gloffset_Vertex4dv 143 #define _gloffset_Vertex4f 144 #define _gloffset_Vertex4fv 145 #define _gloffset_Vertex4i 146 #define _gloffset_Vertex4iv 147 #define _gloffset_Vertex4s 148 #define _gloffset_Vertex4sv 149 #define _gloffset_ClipPlane 150 #define _gloffset_ColorMaterial 151 #define _gloffset_CullFace 152 #define _gloffset_Fogf 153 #define _gloffset_Fogfv 154 #define _gloffset_Fogi 155 #define _gloffset_Fogiv 156 #define _gloffset_FrontFace 157 #define _gloffset_Hint 158 #define _gloffset_Lightf 159 #define _gloffset_Lightfv 160 #define _gloffset_Lighti 161 #define _gloffset_Lightiv 162 #define _gloffset_LightModelf 163 #define _gloffset_LightModelfv 164 #define _gloffset_LightModeli 165 #define _gloffset_LightModeliv 166 #define _gloffset_LineStipple 167 #define _gloffset_LineWidth 168 #define _gloffset_Materialf 169 #define _gloffset_Materialfv 170 #define _gloffset_Materiali 171 #define _gloffset_Materialiv 172 #define _gloffset_PointSize 173 #define _gloffset_PolygonMode 174 #define _gloffset_PolygonStipple 175 #define _gloffset_Scissor 176 #define _gloffset_ShadeModel 177 #define _gloffset_TexParameterf 178 #define _gloffset_TexParameterfv 179 #define _gloffset_TexParameteri 180 #define _gloffset_TexParameteriv 181 #define _gloffset_TexImage1D 182 #define _gloffset_TexImage2D 183 #define _gloffset_TexEnvf 184 #define _gloffset_TexEnvfv 185 #define _gloffset_TexEnvi 186 #define _gloffset_TexEnviv 187 #define _gloffset_TexGend 188 #define _gloffset_TexGendv 189 #define _gloffset_TexGenf 190 #define _gloffset_TexGenfv 191 #define _gloffset_TexGeni 192 #define _gloffset_TexGeniv 193 #define _gloffset_FeedbackBuffer 194 #define _gloffset_SelectBuffer 195 #define _gloffset_RenderMode 196 #define _gloffset_InitNames 197 #define _gloffset_LoadName 198 #define _gloffset_PassThrough 199 #define _gloffset_PopName 200 #define _gloffset_PushName 201 #define _gloffset_DrawBuffer 202 #define _gloffset_Clear 203 #define _gloffset_ClearAccum 204 #define _gloffset_ClearIndex 205 #define _gloffset_ClearColor 206 #define _gloffset_ClearStencil 207 #define _gloffset_ClearDepth 208 #define _gloffset_StencilMask 209 #define _gloffset_ColorMask 210 #define _gloffset_DepthMask 211 #define _gloffset_IndexMask 212 #define _gloffset_Accum 213 #define _gloffset_Disable 214 #define _gloffset_Enable 215 #define _gloffset_Finish 216 #define _gloffset_Flush 217 #define _gloffset_PopAttrib 218 #define _gloffset_PushAttrib 219 #define _gloffset_Map1d 220 #define _gloffset_Map1f 221 #define _gloffset_Map2d 222 #define _gloffset_Map2f 223 #define _gloffset_MapGrid1d 224 #define _gloffset_MapGrid1f 225 #define _gloffset_MapGrid2d 226 #define _gloffset_MapGrid2f 227 #define _gloffset_EvalCoord1d 228 #define _gloffset_EvalCoord1dv 229 #define _gloffset_EvalCoord1f 230 #define _gloffset_EvalCoord1fv 231 #define _gloffset_EvalCoord2d 232 #define _gloffset_EvalCoord2dv 233 #define _gloffset_EvalCoord2f 234 #define _gloffset_EvalCoord2fv 235 #define _gloffset_EvalMesh1 236 #define _gloffset_EvalPoint1 237 #define _gloffset_EvalMesh2 238 #define _gloffset_EvalPoint2 239 #define _gloffset_AlphaFunc 240 #define _gloffset_BlendFunc 241 #define _gloffset_LogicOp 242 #define _gloffset_StencilFunc 243 #define _gloffset_StencilOp 244 #define _gloffset_DepthFunc 245 #define _gloffset_PixelZoom 246 #define _gloffset_PixelTransferf 247 #define _gloffset_PixelTransferi 248 #define _gloffset_PixelStoref 249 #define _gloffset_PixelStorei 250 #define _gloffset_PixelMapfv 251 #define _gloffset_PixelMapuiv 252 #define _gloffset_PixelMapusv 253 #define _gloffset_ReadBuffer 254 #define _gloffset_CopyPixels 255 #define _gloffset_ReadPixels 256 #define _gloffset_DrawPixels 257 #define _gloffset_GetBooleanv 258 #define _gloffset_GetClipPlane 259 #define _gloffset_GetDoublev 260 #define _gloffset_GetError 261 #define _gloffset_GetFloatv 262 #define _gloffset_GetIntegerv 263 #define _gloffset_GetLightfv 264 #define _gloffset_GetLightiv 265 #define _gloffset_GetMapdv 266 #define _gloffset_GetMapfv 267 #define _gloffset_GetMapiv 268 #define _gloffset_GetMaterialfv 269 #define _gloffset_GetMaterialiv 270 #define _gloffset_GetPixelMapfv 271 #define _gloffset_GetPixelMapuiv 272 #define _gloffset_GetPixelMapusv 273 #define _gloffset_GetPolygonStipple 274 #define _gloffset_GetString 275 #define _gloffset_GetTexEnvfv 276 #define _gloffset_GetTexEnviv 277 #define _gloffset_GetTexGendv 278 #define _gloffset_GetTexGenfv 279 #define _gloffset_GetTexGeniv 280 #define _gloffset_GetTexImage 281 #define _gloffset_GetTexParameterfv 282 #define _gloffset_GetTexParameteriv 283 #define _gloffset_GetTexLevelParameterfv 284 #define _gloffset_GetTexLevelParameteriv 285 #define _gloffset_IsEnabled 286 #define _gloffset_IsList 287 #define _gloffset_DepthRange 288 #define _gloffset_Frustum 289 #define _gloffset_LoadIdentity 290 #define _gloffset_LoadMatrixf 291 #define _gloffset_LoadMatrixd 292 #define _gloffset_MatrixMode 293 #define _gloffset_MultMatrixf 294 #define _gloffset_MultMatrixd 295 #define _gloffset_Ortho 296 #define _gloffset_PopMatrix 297 #define _gloffset_PushMatrix 298 #define _gloffset_Rotated 299 #define _gloffset_Rotatef 300 #define _gloffset_Scaled 301 #define _gloffset_Scalef 302 #define _gloffset_Translated 303 #define _gloffset_Translatef 304 #define _gloffset_Viewport 305 #define _gloffset_ArrayElement 306 #define _gloffset_BindTexture 307 #define _gloffset_ColorPointer 308 #define _gloffset_DisableClientState 309 #define _gloffset_DrawArrays 310 #define _gloffset_DrawElements 311 #define _gloffset_EdgeFlagPointer 312 #define _gloffset_EnableClientState 313 #define _gloffset_IndexPointer 314 #define _gloffset_Indexub 315 #define _gloffset_Indexubv 316 #define _gloffset_InterleavedArrays 317 #define _gloffset_NormalPointer 318 #define _gloffset_PolygonOffset 319 #define _gloffset_TexCoordPointer 320 #define _gloffset_VertexPointer 321 #define _gloffset_AreTexturesResident 322 #define _gloffset_CopyTexImage1D 323 #define _gloffset_CopyTexImage2D 324 #define _gloffset_CopyTexSubImage1D 325 #define _gloffset_CopyTexSubImage2D 326 #define _gloffset_DeleteTextures 327 #define _gloffset_GenTextures 328 #define _gloffset_GetPointerv 329 #define _gloffset_IsTexture 330 #define _gloffset_PrioritizeTextures 331 #define _gloffset_TexSubImage1D 332 #define _gloffset_TexSubImage2D 333 #define _gloffset_PopClientAttrib 334 #define _gloffset_PushClientAttrib 335 #define _gloffset_BlendColor 336 #define _gloffset_BlendEquation 337 #define _gloffset_DrawRangeElements 338 #define _gloffset_ColorTable 339 #define _gloffset_ColorTableParameterfv 340 #define _gloffset_ColorTableParameteriv 341 #define _gloffset_CopyColorTable 342 #define _gloffset_GetColorTable 343 #define _gloffset_GetColorTableParameterfv 344 #define _gloffset_GetColorTableParameteriv 345 #define _gloffset_ColorSubTable 346 #define _gloffset_CopyColorSubTable 347 #define _gloffset_ConvolutionFilter1D 348 #define _gloffset_ConvolutionFilter2D 349 #define _gloffset_ConvolutionParameterf 350 #define _gloffset_ConvolutionParameterfv 351 #define _gloffset_ConvolutionParameteri 352 #define _gloffset_ConvolutionParameteriv 353 #define _gloffset_CopyConvolutionFilter1D 354 #define _gloffset_CopyConvolutionFilter2D 355 #define _gloffset_GetConvolutionFilter 356 #define _gloffset_GetConvolutionParameterfv 357 #define _gloffset_GetConvolutionParameteriv 358 #define _gloffset_GetSeparableFilter 359 #define _gloffset_SeparableFilter2D 360 #define _gloffset_GetHistogram 361 #define _gloffset_GetHistogramParameterfv 362 #define _gloffset_GetHistogramParameteriv 363 #define _gloffset_GetMinmax 364 #define _gloffset_GetMinmaxParameterfv 365 #define _gloffset_GetMinmaxParameteriv 366 #define _gloffset_Histogram 367 #define _gloffset_Minmax 368 #define _gloffset_ResetHistogram 369 #define _gloffset_ResetMinmax 370 #define _gloffset_TexImage3D 371 #define _gloffset_TexSubImage3D 372 #define _gloffset_CopyTexSubImage3D 373 #define _gloffset_ActiveTextureARB 374 #define _gloffset_ClientActiveTextureARB 375 #define _gloffset_MultiTexCoord1dARB 376 #define _gloffset_MultiTexCoord1dvARB 377 #define _gloffset_MultiTexCoord1fARB 378 #define _gloffset_MultiTexCoord1fvARB 379 #define _gloffset_MultiTexCoord1iARB 380 #define _gloffset_MultiTexCoord1ivARB 381 #define _gloffset_MultiTexCoord1sARB 382 #define _gloffset_MultiTexCoord1svARB 383 #define _gloffset_MultiTexCoord2dARB 384 #define _gloffset_MultiTexCoord2dvARB 385 #define _gloffset_MultiTexCoord2fARB 386 #define _gloffset_MultiTexCoord2fvARB 387 #define _gloffset_MultiTexCoord2iARB 388 #define _gloffset_MultiTexCoord2ivARB 389 #define _gloffset_MultiTexCoord2sARB 390 #define _gloffset_MultiTexCoord2svARB 391 #define _gloffset_MultiTexCoord3dARB 392 #define _gloffset_MultiTexCoord3dvARB 393 #define _gloffset_MultiTexCoord3fARB 394 #define _gloffset_MultiTexCoord3fvARB 395 #define _gloffset_MultiTexCoord3iARB 396 #define _gloffset_MultiTexCoord3ivARB 397 #define _gloffset_MultiTexCoord3sARB 398 #define _gloffset_MultiTexCoord3svARB 399 #define _gloffset_MultiTexCoord4dARB 400 #define _gloffset_MultiTexCoord4dvARB 401 #define _gloffset_MultiTexCoord4fARB 402 #define _gloffset_MultiTexCoord4fvARB 403 #define _gloffset_MultiTexCoord4iARB 404 #define _gloffset_MultiTexCoord4ivARB 405 #define _gloffset_MultiTexCoord4sARB 406 #define _gloffset_MultiTexCoord4svARB 407 #if !defined(IN_DRI_DRIVER) #define _gloffset_LoadTransposeMatrixfARB 408 #define _gloffset_LoadTransposeMatrixdARB 409 #define _gloffset_MultTransposeMatrixfARB 410 #define _gloffset_MultTransposeMatrixdARB 411 #define _gloffset_SampleCoverageARB 412 #define _gloffset_DrawBuffersARB 413 #define _gloffset_PolygonOffsetEXT 414 #define _gloffset_GetTexFilterFuncSGIS 415 #define _gloffset_TexFilterFuncSGIS 416 #define _gloffset_GetHistogramEXT 417 #define _gloffset_GetHistogramParameterfvEXT 418 #define _gloffset_GetHistogramParameterivEXT 419 #define _gloffset_GetMinmaxEXT 420 #define _gloffset_GetMinmaxParameterfvEXT 421 #define _gloffset_GetMinmaxParameterivEXT 422 #define _gloffset_GetConvolutionFilterEXT 423 #define _gloffset_GetConvolutionParameterfvEXT 424 #define _gloffset_GetConvolutionParameterivEXT 425 #define _gloffset_GetSeparableFilterEXT 426 #define _gloffset_GetColorTableSGI 427 #define _gloffset_GetColorTableParameterfvSGI 428 #define _gloffset_GetColorTableParameterivSGI 429 #define _gloffset_PixelTexGenSGIX 430 #define _gloffset_PixelTexGenParameteriSGIS 431 #define _gloffset_PixelTexGenParameterivSGIS 432 #define _gloffset_PixelTexGenParameterfSGIS 433 #define _gloffset_PixelTexGenParameterfvSGIS 434 #define _gloffset_GetPixelTexGenParameterivSGIS 435 #define _gloffset_GetPixelTexGenParameterfvSGIS 436 #define _gloffset_TexImage4DSGIS 437 #define _gloffset_TexSubImage4DSGIS 438 #define _gloffset_AreTexturesResidentEXT 439 #define _gloffset_GenTexturesEXT 440 #define _gloffset_IsTextureEXT 441 #define _gloffset_DetailTexFuncSGIS 442 #define _gloffset_GetDetailTexFuncSGIS 443 #define _gloffset_SharpenTexFuncSGIS 444 #define _gloffset_GetSharpenTexFuncSGIS 445 #define _gloffset_SampleMaskSGIS 446 #define _gloffset_SamplePatternSGIS 447 #define _gloffset_ColorPointerEXT 448 #define _gloffset_EdgeFlagPointerEXT 449 #define _gloffset_IndexPointerEXT 450 #define _gloffset_NormalPointerEXT 451 #define _gloffset_TexCoordPointerEXT 452 #define _gloffset_VertexPointerEXT 453 #define _gloffset_SpriteParameterfSGIX 454 #define _gloffset_SpriteParameterfvSGIX 455 #define _gloffset_SpriteParameteriSGIX 456 #define _gloffset_SpriteParameterivSGIX 457 #define _gloffset_PointParameterfEXT 458 #define _gloffset_PointParameterfvEXT 459 #define _gloffset_GetInstrumentsSGIX 460 #define _gloffset_InstrumentsBufferSGIX 461 #define _gloffset_PollInstrumentsSGIX 462 #define _gloffset_ReadInstrumentsSGIX 463 #define _gloffset_StartInstrumentsSGIX 464 #define _gloffset_StopInstrumentsSGIX 465 #define _gloffset_FrameZoomSGIX 466 #define _gloffset_TagSampleBufferSGIX 467 #define _gloffset_ReferencePlaneSGIX 468 #define _gloffset_FlushRasterSGIX 469 #define _gloffset_GetListParameterfvSGIX 470 #define _gloffset_GetListParameterivSGIX 471 #define _gloffset_ListParameterfSGIX 472 #define _gloffset_ListParameterfvSGIX 473 #define _gloffset_ListParameteriSGIX 474 #define _gloffset_ListParameterivSGIX 475 #define _gloffset_FragmentColorMaterialSGIX 476 #define _gloffset_FragmentLightfSGIX 477 #define _gloffset_FragmentLightfvSGIX 478 #define _gloffset_FragmentLightiSGIX 479 #define _gloffset_FragmentLightivSGIX 480 #define _gloffset_FragmentLightModelfSGIX 481 #define _gloffset_FragmentLightModelfvSGIX 482 #define _gloffset_FragmentLightModeliSGIX 483 #define _gloffset_FragmentLightModelivSGIX 484 #define _gloffset_FragmentMaterialfSGIX 485 #define _gloffset_FragmentMaterialfvSGIX 486 #define _gloffset_FragmentMaterialiSGIX 487 #define _gloffset_FragmentMaterialivSGIX 488 #define _gloffset_GetFragmentLightfvSGIX 489 #define _gloffset_GetFragmentLightivSGIX 490 #define _gloffset_GetFragmentMaterialfvSGIX 491 #define _gloffset_GetFragmentMaterialivSGIX 492 #define _gloffset_LightEnviSGIX 493 #define _gloffset_VertexWeightfEXT 494 #define _gloffset_VertexWeightfvEXT 495 #define _gloffset_VertexWeightPointerEXT 496 #define _gloffset_FlushVertexArrayRangeNV 497 #define _gloffset_VertexArrayRangeNV 498 #define _gloffset_CombinerParameterfvNV 499 #define _gloffset_CombinerParameterfNV 500 #define _gloffset_CombinerParameterivNV 501 #define _gloffset_CombinerParameteriNV 502 #define _gloffset_CombinerInputNV 503 #define _gloffset_CombinerOutputNV 504 #define _gloffset_FinalCombinerInputNV 505 #define _gloffset_GetCombinerInputParameterfvNV 506 #define _gloffset_GetCombinerInputParameterivNV 507 #define _gloffset_GetCombinerOutputParameterfvNV 508 #define _gloffset_GetCombinerOutputParameterivNV 509 #define _gloffset_GetFinalCombinerInputParameterfvNV 510 #define _gloffset_GetFinalCombinerInputParameterivNV 511 #define _gloffset_ResizeBuffersMESA 512 #define _gloffset_WindowPos2dMESA 513 #define _gloffset_WindowPos2dvMESA 514 #define _gloffset_WindowPos2fMESA 515 #define _gloffset_WindowPos2fvMESA 516 #define _gloffset_WindowPos2iMESA 517 #define _gloffset_WindowPos2ivMESA 518 #define _gloffset_WindowPos2sMESA 519 #define _gloffset_WindowPos2svMESA 520 #define _gloffset_WindowPos3dMESA 521 #define _gloffset_WindowPos3dvMESA 522 #define _gloffset_WindowPos3fMESA 523 #define _gloffset_WindowPos3fvMESA 524 #define _gloffset_WindowPos3iMESA 525 #define _gloffset_WindowPos3ivMESA 526 #define _gloffset_WindowPos3sMESA 527 #define _gloffset_WindowPos3svMESA 528 #define _gloffset_WindowPos4dMESA 529 #define _gloffset_WindowPos4dvMESA 530 #define _gloffset_WindowPos4fMESA 531 #define _gloffset_WindowPos4fvMESA 532 #define _gloffset_WindowPos4iMESA 533 #define _gloffset_WindowPos4ivMESA 534 #define _gloffset_WindowPos4sMESA 535 #define _gloffset_WindowPos4svMESA 536 #define _gloffset_BlendFuncSeparateEXT 537 #define _gloffset_IndexMaterialEXT 538 #define _gloffset_IndexFuncEXT 539 #define _gloffset_LockArraysEXT 540 #define _gloffset_UnlockArraysEXT 541 #define _gloffset_CullParameterdvEXT 542 #define _gloffset_CullParameterfvEXT 543 #define _gloffset_HintPGI 544 #define _gloffset_FogCoordfEXT 545 #define _gloffset_FogCoordfvEXT 546 #define _gloffset_FogCoorddEXT 547 #define _gloffset_FogCoorddvEXT 548 #define _gloffset_FogCoordPointerEXT 549 #define _gloffset_GetColorTableEXT 550 #define _gloffset_GetColorTableParameterivEXT 551 #define _gloffset_GetColorTableParameterfvEXT 552 #define _gloffset_TbufferMask3DFX 553 #define _gloffset_CompressedTexImage3DARB 554 #define _gloffset_CompressedTexImage2DARB 555 #define _gloffset_CompressedTexImage1DARB 556 #define _gloffset_CompressedTexSubImage3DARB 557 #define _gloffset_CompressedTexSubImage2DARB 558 #define _gloffset_CompressedTexSubImage1DARB 559 #define _gloffset_GetCompressedTexImageARB 560 #define _gloffset_SecondaryColor3bEXT 561 #define _gloffset_SecondaryColor3bvEXT 562 #define _gloffset_SecondaryColor3dEXT 563 #define _gloffset_SecondaryColor3dvEXT 564 #define _gloffset_SecondaryColor3fEXT 565 #define _gloffset_SecondaryColor3fvEXT 566 #define _gloffset_SecondaryColor3iEXT 567 #define _gloffset_SecondaryColor3ivEXT 568 #define _gloffset_SecondaryColor3sEXT 569 #define _gloffset_SecondaryColor3svEXT 570 #define _gloffset_SecondaryColor3ubEXT 571 #define _gloffset_SecondaryColor3ubvEXT 572 #define _gloffset_SecondaryColor3uiEXT 573 #define _gloffset_SecondaryColor3uivEXT 574 #define _gloffset_SecondaryColor3usEXT 575 #define _gloffset_SecondaryColor3usvEXT 576 #define _gloffset_SecondaryColorPointerEXT 577 #define _gloffset_AreProgramsResidentNV 578 #define _gloffset_BindProgramNV 579 #define _gloffset_DeleteProgramsNV 580 #define _gloffset_ExecuteProgramNV 581 #define _gloffset_GenProgramsNV 582 #define _gloffset_GetProgramParameterdvNV 583 #define _gloffset_GetProgramParameterfvNV 584 #define _gloffset_GetProgramivNV 585 #define _gloffset_GetProgramStringNV 586 #define _gloffset_GetTrackMatrixivNV 587 #define _gloffset_GetVertexAttribdvARB 588 #define _gloffset_GetVertexAttribfvARB 589 #define _gloffset_GetVertexAttribivARB 590 #define _gloffset_GetVertexAttribPointervNV 591 #define _gloffset_IsProgramNV 592 #define _gloffset_LoadProgramNV 593 #define _gloffset_ProgramParameter4dNV 594 #define _gloffset_ProgramParameter4dvNV 595 #define _gloffset_ProgramParameter4fNV 596 #define _gloffset_ProgramParameter4fvNV 597 #define _gloffset_ProgramParameters4dvNV 598 #define _gloffset_ProgramParameters4fvNV 599 #define _gloffset_RequestResidentProgramsNV 600 #define _gloffset_TrackMatrixNV 601 #define _gloffset_VertexAttribPointerNV 602 #define _gloffset_VertexAttrib1dARB 603 #define _gloffset_VertexAttrib1dvARB 604 #define _gloffset_VertexAttrib1fARB 605 #define _gloffset_VertexAttrib1fvARB 606 #define _gloffset_VertexAttrib1sARB 607 #define _gloffset_VertexAttrib1svARB 608 #define _gloffset_VertexAttrib2dARB 609 #define _gloffset_VertexAttrib2dvARB 610 #define _gloffset_VertexAttrib2fARB 611 #define _gloffset_VertexAttrib2fvARB 612 #define _gloffset_VertexAttrib2sARB 613 #define _gloffset_VertexAttrib2svARB 614 #define _gloffset_VertexAttrib3dARB 615 #define _gloffset_VertexAttrib3dvARB 616 #define _gloffset_VertexAttrib3fARB 617 #define _gloffset_VertexAttrib3fvARB 618 #define _gloffset_VertexAttrib3sARB 619 #define _gloffset_VertexAttrib3svARB 620 #define _gloffset_VertexAttrib4dARB 621 #define _gloffset_VertexAttrib4dvARB 622 #define _gloffset_VertexAttrib4fARB 623 #define _gloffset_VertexAttrib4fvARB 624 #define _gloffset_VertexAttrib4sARB 625 #define _gloffset_VertexAttrib4svARB 626 #define _gloffset_VertexAttrib4NubARB 627 #define _gloffset_VertexAttrib4NubvARB 628 #define _gloffset_VertexAttribs1dvNV 629 #define _gloffset_VertexAttribs1fvNV 630 #define _gloffset_VertexAttribs1svNV 631 #define _gloffset_VertexAttribs2dvNV 632 #define _gloffset_VertexAttribs2fvNV 633 #define _gloffset_VertexAttribs2svNV 634 #define _gloffset_VertexAttribs3dvNV 635 #define _gloffset_VertexAttribs3fvNV 636 #define _gloffset_VertexAttribs3svNV 637 #define _gloffset_VertexAttribs4dvNV 638 #define _gloffset_VertexAttribs4fvNV 639 #define _gloffset_VertexAttribs4svNV 640 #define _gloffset_VertexAttribs4ubvNV 641 #define _gloffset_PointParameteriNV 642 #define _gloffset_PointParameterivNV 643 #define _gloffset_MultiDrawArraysEXT 644 #define _gloffset_MultiDrawElementsEXT 645 #define _gloffset_ActiveStencilFaceEXT 646 #define _gloffset_DeleteFencesNV 647 #define _gloffset_GenFencesNV 648 #define _gloffset_IsFenceNV 649 #define _gloffset_TestFenceNV 650 #define _gloffset_GetFenceivNV 651 #define _gloffset_FinishFenceNV 652 #define _gloffset_SetFenceNV 653 #define _gloffset_VertexAttrib4bvARB 654 #define _gloffset_VertexAttrib4ivARB 655 #define _gloffset_VertexAttrib4ubvARB 656 #define _gloffset_VertexAttrib4usvARB 657 #define _gloffset_VertexAttrib4uivARB 658 #define _gloffset_VertexAttrib4NbvARB 659 #define _gloffset_VertexAttrib4NsvARB 660 #define _gloffset_VertexAttrib4NivARB 661 #define _gloffset_VertexAttrib4NusvARB 662 #define _gloffset_VertexAttrib4NuivARB 663 #define _gloffset_VertexAttribPointerARB 664 #define _gloffset_EnableVertexAttribArrayARB 665 #define _gloffset_DisableVertexAttribArrayARB 666 #define _gloffset_ProgramStringARB 667 #define _gloffset_ProgramEnvParameter4dARB 668 #define _gloffset_ProgramEnvParameter4dvARB 669 #define _gloffset_ProgramEnvParameter4fARB 670 #define _gloffset_ProgramEnvParameter4fvARB 671 #define _gloffset_ProgramLocalParameter4dARB 672 #define _gloffset_ProgramLocalParameter4dvARB 673 #define _gloffset_ProgramLocalParameter4fARB 674 #define _gloffset_ProgramLocalParameter4fvARB 675 #define _gloffset_GetProgramEnvParameterdvARB 676 #define _gloffset_GetProgramEnvParameterfvARB 677 #define _gloffset_GetProgramLocalParameterdvARB 678 #define _gloffset_GetProgramLocalParameterfvARB 679 #define _gloffset_GetProgramivARB 680 #define _gloffset_GetProgramStringARB 681 #define _gloffset_ProgramNamedParameter4fNV 682 #define _gloffset_ProgramNamedParameter4dNV 683 #define _gloffset_ProgramNamedParameter4fvNV 684 #define _gloffset_ProgramNamedParameter4dvNV 685 #define _gloffset_GetProgramNamedParameterfvNV 686 #define _gloffset_GetProgramNamedParameterdvNV 687 #define _gloffset_BindBufferARB 688 #define _gloffset_BufferDataARB 689 #define _gloffset_BufferSubDataARB 690 #define _gloffset_DeleteBuffersARB 691 #define _gloffset_GenBuffersARB 692 #define _gloffset_GetBufferParameterivARB 693 #define _gloffset_GetBufferPointervARB 694 #define _gloffset_GetBufferSubDataARB 695 #define _gloffset_IsBufferARB 696 #define _gloffset_MapBufferARB 697 #define _gloffset_UnmapBufferARB 698 #define _gloffset_DepthBoundsEXT 699 #define _gloffset_GenQueriesARB 700 #define _gloffset_DeleteQueriesARB 701 #define _gloffset_IsQueryARB 702 #define _gloffset_BeginQueryARB 703 #define _gloffset_EndQueryARB 704 #define _gloffset_GetQueryivARB 705 #define _gloffset_GetQueryObjectivARB 706 #define _gloffset_GetQueryObjectuivARB 707 #define _gloffset_MultiModeDrawArraysIBM 708 #define _gloffset_MultiModeDrawElementsIBM 709 #define _gloffset_BlendEquationSeparateEXT 710 #define _gloffset_DeleteObjectARB 711 #define _gloffset_GetHandleARB 712 #define _gloffset_DetachObjectARB 713 #define _gloffset_CreateShaderObjectARB 714 #define _gloffset_ShaderSourceARB 715 #define _gloffset_CompileShaderARB 716 #define _gloffset_CreateProgramObjectARB 717 #define _gloffset_AttachObjectARB 718 #define _gloffset_LinkProgramARB 719 #define _gloffset_UseProgramObjectARB 720 #define _gloffset_ValidateProgramARB 721 #define _gloffset_Uniform1fARB 722 #define _gloffset_Uniform2fARB 723 #define _gloffset_Uniform3fARB 724 #define _gloffset_Uniform4fARB 725 #define _gloffset_Uniform1iARB 726 #define _gloffset_Uniform2iARB 727 #define _gloffset_Uniform3iARB 728 #define _gloffset_Uniform4iARB 729 #define _gloffset_Uniform1fvARB 730 #define _gloffset_Uniform2fvARB 731 #define _gloffset_Uniform3fvARB 732 #define _gloffset_Uniform4fvARB 733 #define _gloffset_Uniform1ivARB 734 #define _gloffset_Uniform2ivARB 735 #define _gloffset_Uniform3ivARB 736 #define _gloffset_Uniform4ivARB 737 #define _gloffset_UniformMatrix2fvARB 738 #define _gloffset_UniformMatrix3fvARB 739 #define _gloffset_UniformMatrix4fvARB 740 #define _gloffset_GetObjectParameterfvARB 741 #define _gloffset_GetObjectParameterivARB 742 #define _gloffset_GetInfoLogARB 743 #define _gloffset_GetAttachedObjectsARB 744 #define _gloffset_GetUniformLocationARB 745 #define _gloffset_GetActiveUniformARB 746 #define _gloffset_GetUniformfvARB 747 #define _gloffset_GetUniformivARB 748 #define _gloffset_GetShaderSourceARB 749 #define _gloffset_BindAttribLocationARB 750 #define _gloffset_GetActiveAttribARB 751 #define _gloffset_GetAttribLocationARB 752 #define _gloffset_GetVertexAttribdvNV 753 #define _gloffset_GetVertexAttribfvNV 754 #define _gloffset_GetVertexAttribivNV 755 #define _gloffset_VertexAttrib1dNV 756 #define _gloffset_VertexAttrib1dvNV 757 #define _gloffset_VertexAttrib1fNV 758 #define _gloffset_VertexAttrib1fvNV 759 #define _gloffset_VertexAttrib1sNV 760 #define _gloffset_VertexAttrib1svNV 761 #define _gloffset_VertexAttrib2dNV 762 #define _gloffset_VertexAttrib2dvNV 763 #define _gloffset_VertexAttrib2fNV 764 #define _gloffset_VertexAttrib2fvNV 765 #define _gloffset_VertexAttrib2sNV 766 #define _gloffset_VertexAttrib2svNV 767 #define _gloffset_VertexAttrib3dNV 768 #define _gloffset_VertexAttrib3dvNV 769 #define _gloffset_VertexAttrib3fNV 770 #define _gloffset_VertexAttrib3fvNV 771 #define _gloffset_VertexAttrib3sNV 772 #define _gloffset_VertexAttrib3svNV 773 #define _gloffset_VertexAttrib4dNV 774 #define _gloffset_VertexAttrib4dvNV 775 #define _gloffset_VertexAttrib4fNV 776 #define _gloffset_VertexAttrib4fvNV 777 #define _gloffset_VertexAttrib4sNV 778 #define _gloffset_VertexAttrib4svNV 779 #define _gloffset_VertexAttrib4ubNV 780 #define _gloffset_VertexAttrib4ubvNV 781 #define _gloffset_GenFragmentShadersATI 782 #define _gloffset_BindFragmentShaderATI 783 #define _gloffset_DeleteFragmentShaderATI 784 #define _gloffset_BeginFragmentShaderATI 785 #define _gloffset_EndFragmentShaderATI 786 #define _gloffset_PassTexCoordATI 787 #define _gloffset_SampleMapATI 788 #define _gloffset_ColorFragmentOp1ATI 789 #define _gloffset_ColorFragmentOp2ATI 790 #define _gloffset_ColorFragmentOp3ATI 791 #define _gloffset_AlphaFragmentOp1ATI 792 #define _gloffset_AlphaFragmentOp2ATI 793 #define _gloffset_AlphaFragmentOp3ATI 794 #define _gloffset_SetFragmentShaderConstantATI 795 #define _gloffset_IsRenderbufferEXT 796 #define _gloffset_BindRenderbufferEXT 797 #define _gloffset_DeleteRenderbuffersEXT 798 #define _gloffset_GenRenderbuffersEXT 799 #define _gloffset_RenderbufferStorageEXT 800 #define _gloffset_GetRenderbufferParameterivEXT 801 #define _gloffset_IsFramebufferEXT 802 #define _gloffset_BindFramebufferEXT 803 #define _gloffset_DeleteFramebuffersEXT 804 #define _gloffset_GenFramebuffersEXT 805 #define _gloffset_CheckFramebufferStatusEXT 806 #define _gloffset_FramebufferTexture1DEXT 807 #define _gloffset_FramebufferTexture2DEXT 808 #define _gloffset_FramebufferTexture3DEXT 809 #define _gloffset_FramebufferRenderbufferEXT 810 #define _gloffset_GetFramebufferAttachmentParameterivEXT 811 #define _gloffset_GenerateMipmapEXT 812 #define _gloffset_StencilFuncSeparate 813 #define _gloffset_StencilOpSeparate 814 #define _gloffset_StencilMaskSeparate 815 #define _gloffset_FIRST_DYNAMIC 816 #else #define _gloffset_LoadTransposeMatrixfARB driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index] #define _gloffset_LoadTransposeMatrixdARB driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index] #define _gloffset_MultTransposeMatrixfARB driDispatchRemapTable[MultTransposeMatrixfARB_remap_index] #define _gloffset_MultTransposeMatrixdARB driDispatchRemapTable[MultTransposeMatrixdARB_remap_index] #define _gloffset_SampleCoverageARB driDispatchRemapTable[SampleCoverageARB_remap_index] #define _gloffset_DrawBuffersARB driDispatchRemapTable[DrawBuffersARB_remap_index] #define _gloffset_PolygonOffsetEXT driDispatchRemapTable[PolygonOffsetEXT_remap_index] #define _gloffset_GetTexFilterFuncSGIS driDispatchRemapTable[GetTexFilterFuncSGIS_remap_index] #define _gloffset_TexFilterFuncSGIS driDispatchRemapTable[TexFilterFuncSGIS_remap_index] #define _gloffset_GetHistogramEXT driDispatchRemapTable[GetHistogramEXT_remap_index] #define _gloffset_GetHistogramParameterfvEXT driDispatchRemapTable[GetHistogramParameterfvEXT_remap_index] #define _gloffset_GetHistogramParameterivEXT driDispatchRemapTable[GetHistogramParameterivEXT_remap_index] #define _gloffset_GetMinmaxEXT driDispatchRemapTable[GetMinmaxEXT_remap_index] #define _gloffset_GetMinmaxParameterfvEXT driDispatchRemapTable[GetMinmaxParameterfvEXT_remap_index] #define _gloffset_GetMinmaxParameterivEXT driDispatchRemapTable[GetMinmaxParameterivEXT_remap_index] #define _gloffset_GetConvolutionFilterEXT driDispatchRemapTable[GetConvolutionFilterEXT_remap_index] #define _gloffset_GetConvolutionParameterfvEXT driDispatchRemapTable[GetConvolutionParameterfvEXT_remap_index] #define _gloffset_GetConvolutionParameterivEXT driDispatchRemapTable[GetConvolutionParameterivEXT_remap_index] #define _gloffset_GetSeparableFilterEXT driDispatchRemapTable[GetSeparableFilterEXT_remap_index] #define _gloffset_GetColorTableSGI driDispatchRemapTable[GetColorTableSGI_remap_index] #define _gloffset_GetColorTableParameterfvSGI driDispatchRemapTable[GetColorTableParameterfvSGI_remap_index] #define _gloffset_GetColorTableParameterivSGI driDispatchRemapTable[GetColorTableParameterivSGI_remap_index] #define _gloffset_PixelTexGenSGIX driDispatchRemapTable[PixelTexGenSGIX_remap_index] #define _gloffset_PixelTexGenParameteriSGIS driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index] #define _gloffset_PixelTexGenParameterivSGIS driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index] #define _gloffset_PixelTexGenParameterfSGIS driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index] #define _gloffset_PixelTexGenParameterfvSGIS driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index] #define _gloffset_GetPixelTexGenParameterivSGIS driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index] #define _gloffset_GetPixelTexGenParameterfvSGIS driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index] #define _gloffset_TexImage4DSGIS driDispatchRemapTable[TexImage4DSGIS_remap_index] #define _gloffset_TexSubImage4DSGIS driDispatchRemapTable[TexSubImage4DSGIS_remap_index] #define _gloffset_AreTexturesResidentEXT driDispatchRemapTable[AreTexturesResidentEXT_remap_index] #define _gloffset_GenTexturesEXT driDispatchRemapTable[GenTexturesEXT_remap_index] #define _gloffset_IsTextureEXT driDispatchRemapTable[IsTextureEXT_remap_index] #define _gloffset_DetailTexFuncSGIS driDispatchRemapTable[DetailTexFuncSGIS_remap_index] #define _gloffset_GetDetailTexFuncSGIS driDispatchRemapTable[GetDetailTexFuncSGIS_remap_index] #define _gloffset_SharpenTexFuncSGIS driDispatchRemapTable[SharpenTexFuncSGIS_remap_index] #define _gloffset_GetSharpenTexFuncSGIS driDispatchRemapTable[GetSharpenTexFuncSGIS_remap_index] #define _gloffset_SampleMaskSGIS driDispatchRemapTable[SampleMaskSGIS_remap_index] #define _gloffset_SamplePatternSGIS driDispatchRemapTable[SamplePatternSGIS_remap_index] #define _gloffset_ColorPointerEXT driDispatchRemapTable[ColorPointerEXT_remap_index] #define _gloffset_EdgeFlagPointerEXT driDispatchRemapTable[EdgeFlagPointerEXT_remap_index] #define _gloffset_IndexPointerEXT driDispatchRemapTable[IndexPointerEXT_remap_index] #define _gloffset_NormalPointerEXT driDispatchRemapTable[NormalPointerEXT_remap_index] #define _gloffset_TexCoordPointerEXT driDispatchRemapTable[TexCoordPointerEXT_remap_index] #define _gloffset_VertexPointerEXT driDispatchRemapTable[VertexPointerEXT_remap_index] #define _gloffset_SpriteParameterfSGIX driDispatchRemapTable[SpriteParameterfSGIX_remap_index] #define _gloffset_SpriteParameterfvSGIX driDispatchRemapTable[SpriteParameterfvSGIX_remap_index] #define _gloffset_SpriteParameteriSGIX driDispatchRemapTable[SpriteParameteriSGIX_remap_index] #define _gloffset_SpriteParameterivSGIX driDispatchRemapTable[SpriteParameterivSGIX_remap_index] #define _gloffset_PointParameterfEXT driDispatchRemapTable[PointParameterfEXT_remap_index] #define _gloffset_PointParameterfvEXT driDispatchRemapTable[PointParameterfvEXT_remap_index] #define _gloffset_GetInstrumentsSGIX driDispatchRemapTable[GetInstrumentsSGIX_remap_index] #define _gloffset_InstrumentsBufferSGIX driDispatchRemapTable[InstrumentsBufferSGIX_remap_index] #define _gloffset_PollInstrumentsSGIX driDispatchRemapTable[PollInstrumentsSGIX_remap_index] #define _gloffset_ReadInstrumentsSGIX driDispatchRemapTable[ReadInstrumentsSGIX_remap_index] #define _gloffset_StartInstrumentsSGIX driDispatchRemapTable[StartInstrumentsSGIX_remap_index] #define _gloffset_StopInstrumentsSGIX driDispatchRemapTable[StopInstrumentsSGIX_remap_index] #define _gloffset_FrameZoomSGIX driDispatchRemapTable[FrameZoomSGIX_remap_index] #define _gloffset_TagSampleBufferSGIX driDispatchRemapTable[TagSampleBufferSGIX_remap_index] #define _gloffset_ReferencePlaneSGIX driDispatchRemapTable[ReferencePlaneSGIX_remap_index] #define _gloffset_FlushRasterSGIX driDispatchRemapTable[FlushRasterSGIX_remap_index] #define _gloffset_GetListParameterfvSGIX driDispatchRemapTable[GetListParameterfvSGIX_remap_index] #define _gloffset_GetListParameterivSGIX driDispatchRemapTable[GetListParameterivSGIX_remap_index] #define _gloffset_ListParameterfSGIX driDispatchRemapTable[ListParameterfSGIX_remap_index] #define _gloffset_ListParameterfvSGIX driDispatchRemapTable[ListParameterfvSGIX_remap_index] #define _gloffset_ListParameteriSGIX driDispatchRemapTable[ListParameteriSGIX_remap_index] #define _gloffset_ListParameterivSGIX driDispatchRemapTable[ListParameterivSGIX_remap_index] #define _gloffset_FragmentColorMaterialSGIX driDispatchRemapTable[FragmentColorMaterialSGIX_remap_index] #define _gloffset_FragmentLightfSGIX driDispatchRemapTable[FragmentLightfSGIX_remap_index] #define _gloffset_FragmentLightfvSGIX driDispatchRemapTable[FragmentLightfvSGIX_remap_index] #define _gloffset_FragmentLightiSGIX driDispatchRemapTable[FragmentLightiSGIX_remap_index] #define _gloffset_FragmentLightivSGIX driDispatchRemapTable[FragmentLightivSGIX_remap_index] #define _gloffset_FragmentLightModelfSGIX driDispatchRemapTable[FragmentLightModelfSGIX_remap_index] #define _gloffset_FragmentLightModelfvSGIX driDispatchRemapTable[FragmentLightModelfvSGIX_remap_index] #define _gloffset_FragmentLightModeliSGIX driDispatchRemapTable[FragmentLightModeliSGIX_remap_index] #define _gloffset_FragmentLightModelivSGIX driDispatchRemapTable[FragmentLightModelivSGIX_remap_index] #define _gloffset_FragmentMaterialfSGIX driDispatchRemapTable[FragmentMaterialfSGIX_remap_index] #define _gloffset_FragmentMaterialfvSGIX driDispatchRemapTable[FragmentMaterialfvSGIX_remap_index] #define _gloffset_FragmentMaterialiSGIX driDispatchRemapTable[FragmentMaterialiSGIX_remap_index] #define _gloffset_FragmentMaterialivSGIX driDispatchRemapTable[FragmentMaterialivSGIX_remap_index] #define _gloffset_GetFragmentLightfvSGIX driDispatchRemapTable[GetFragmentLightfvSGIX_remap_index] #define _gloffset_GetFragmentLightivSGIX driDispatchRemapTable[GetFragmentLightivSGIX_remap_index] #define _gloffset_GetFragmentMaterialfvSGIX driDispatchRemapTable[GetFragmentMaterialfvSGIX_remap_index] #define _gloffset_GetFragmentMaterialivSGIX driDispatchRemapTable[GetFragmentMaterialivSGIX_remap_index] #define _gloffset_LightEnviSGIX driDispatchRemapTable[LightEnviSGIX_remap_index] #define _gloffset_VertexWeightfEXT driDispatchRemapTable[VertexWeightfEXT_remap_index] #define _gloffset_VertexWeightfvEXT driDispatchRemapTable[VertexWeightfvEXT_remap_index] #define _gloffset_VertexWeightPointerEXT driDispatchRemapTable[VertexWeightPointerEXT_remap_index] #define _gloffset_FlushVertexArrayRangeNV driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index] #define _gloffset_VertexArrayRangeNV driDispatchRemapTable[VertexArrayRangeNV_remap_index] #define _gloffset_CombinerParameterfvNV driDispatchRemapTable[CombinerParameterfvNV_remap_index] #define _gloffset_CombinerParameterfNV driDispatchRemapTable[CombinerParameterfNV_remap_index] #define _gloffset_CombinerParameterivNV driDispatchRemapTable[CombinerParameterivNV_remap_index] #define _gloffset_CombinerParameteriNV driDispatchRemapTable[CombinerParameteriNV_remap_index] #define _gloffset_CombinerInputNV driDispatchRemapTable[CombinerInputNV_remap_index] #define _gloffset_CombinerOutputNV driDispatchRemapTable[CombinerOutputNV_remap_index] #define _gloffset_FinalCombinerInputNV driDispatchRemapTable[FinalCombinerInputNV_remap_index] #define _gloffset_GetCombinerInputParameterfvNV driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index] #define _gloffset_GetCombinerInputParameterivNV driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index] #define _gloffset_GetCombinerOutputParameterfvNV driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index] #define _gloffset_GetCombinerOutputParameterivNV driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index] #define _gloffset_GetFinalCombinerInputParameterfvNV driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index] #define _gloffset_GetFinalCombinerInputParameterivNV driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index] #define _gloffset_ResizeBuffersMESA driDispatchRemapTable[ResizeBuffersMESA_remap_index] #define _gloffset_WindowPos2dMESA driDispatchRemapTable[WindowPos2dMESA_remap_index] #define _gloffset_WindowPos2dvMESA driDispatchRemapTable[WindowPos2dvMESA_remap_index] #define _gloffset_WindowPos2fMESA driDispatchRemapTable[WindowPos2fMESA_remap_index] #define _gloffset_WindowPos2fvMESA driDispatchRemapTable[WindowPos2fvMESA_remap_index] #define _gloffset_WindowPos2iMESA driDispatchRemapTable[WindowPos2iMESA_remap_index] #define _gloffset_WindowPos2ivMESA driDispatchRemapTable[WindowPos2ivMESA_remap_index] #define _gloffset_WindowPos2sMESA driDispatchRemapTable[WindowPos2sMESA_remap_index] #define _gloffset_WindowPos2svMESA driDispatchRemapTable[WindowPos2svMESA_remap_index] #define _gloffset_WindowPos3dMESA driDispatchRemapTable[WindowPos3dMESA_remap_index] #define _gloffset_WindowPos3dvMESA driDispatchRemapTable[WindowPos3dvMESA_remap_index] #define _gloffset_WindowPos3fMESA driDispatchRemapTable[WindowPos3fMESA_remap_index] #define _gloffset_WindowPos3fvMESA driDispatchRemapTable[WindowPos3fvMESA_remap_index] #define _gloffset_WindowPos3iMESA driDispatchRemapTable[WindowPos3iMESA_remap_index] #define _gloffset_WindowPos3ivMESA driDispatchRemapTable[WindowPos3ivMESA_remap_index] #define _gloffset_WindowPos3sMESA driDispatchRemapTable[WindowPos3sMESA_remap_index] #define _gloffset_WindowPos3svMESA driDispatchRemapTable[WindowPos3svMESA_remap_index] #define _gloffset_WindowPos4dMESA driDispatchRemapTable[WindowPos4dMESA_remap_index] #define _gloffset_WindowPos4dvMESA driDispatchRemapTable[WindowPos4dvMESA_remap_index] #define _gloffset_WindowPos4fMESA driDispatchRemapTable[WindowPos4fMESA_remap_index] #define _gloffset_WindowPos4fvMESA driDispatchRemapTable[WindowPos4fvMESA_remap_index] #define _gloffset_WindowPos4iMESA driDispatchRemapTable[WindowPos4iMESA_remap_index] #define _gloffset_WindowPos4ivMESA driDispatchRemapTable[WindowPos4ivMESA_remap_index] #define _gloffset_WindowPos4sMESA driDispatchRemapTable[WindowPos4sMESA_remap_index] #define _gloffset_WindowPos4svMESA driDispatchRemapTable[WindowPos4svMESA_remap_index] #define _gloffset_BlendFuncSeparateEXT driDispatchRemapTable[BlendFuncSeparateEXT_remap_index] #define _gloffset_IndexMaterialEXT driDispatchRemapTable[IndexMaterialEXT_remap_index] #define _gloffset_IndexFuncEXT driDispatchRemapTable[IndexFuncEXT_remap_index] #define _gloffset_LockArraysEXT driDispatchRemapTable[LockArraysEXT_remap_index] #define _gloffset_UnlockArraysEXT driDispatchRemapTable[UnlockArraysEXT_remap_index] #define _gloffset_CullParameterdvEXT driDispatchRemapTable[CullParameterdvEXT_remap_index] #define _gloffset_CullParameterfvEXT driDispatchRemapTable[CullParameterfvEXT_remap_index] #define _gloffset_HintPGI driDispatchRemapTable[HintPGI_remap_index] #define _gloffset_FogCoordfEXT driDispatchRemapTable[FogCoordfEXT_remap_index] #define _gloffset_FogCoordfvEXT driDispatchRemapTable[FogCoordfvEXT_remap_index] #define _gloffset_FogCoorddEXT driDispatchRemapTable[FogCoorddEXT_remap_index] #define _gloffset_FogCoorddvEXT driDispatchRemapTable[FogCoorddvEXT_remap_index] #define _gloffset_FogCoordPointerEXT driDispatchRemapTable[FogCoordPointerEXT_remap_index] #define _gloffset_GetColorTableEXT driDispatchRemapTable[GetColorTableEXT_remap_index] #define _gloffset_GetColorTableParameterivEXT driDispatchRemapTable[GetColorTableParameterivEXT_remap_index] #define _gloffset_GetColorTableParameterfvEXT driDispatchRemapTable[GetColorTableParameterfvEXT_remap_index] #define _gloffset_TbufferMask3DFX driDispatchRemapTable[TbufferMask3DFX_remap_index] #define _gloffset_CompressedTexImage3DARB driDispatchRemapTable[CompressedTexImage3DARB_remap_index] #define _gloffset_CompressedTexImage2DARB driDispatchRemapTable[CompressedTexImage2DARB_remap_index] #define _gloffset_CompressedTexImage1DARB driDispatchRemapTable[CompressedTexImage1DARB_remap_index] #define _gloffset_CompressedTexSubImage3DARB driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index] #define _gloffset_CompressedTexSubImage2DARB driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index] #define _gloffset_CompressedTexSubImage1DARB driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index] #define _gloffset_GetCompressedTexImageARB driDispatchRemapTable[GetCompressedTexImageARB_remap_index] #define _gloffset_SecondaryColor3bEXT driDispatchRemapTable[SecondaryColor3bEXT_remap_index] #define _gloffset_SecondaryColor3bvEXT driDispatchRemapTable[SecondaryColor3bvEXT_remap_index] #define _gloffset_SecondaryColor3dEXT driDispatchRemapTable[SecondaryColor3dEXT_remap_index] #define _gloffset_SecondaryColor3dvEXT driDispatchRemapTable[SecondaryColor3dvEXT_remap_index] #define _gloffset_SecondaryColor3fEXT driDispatchRemapTable[SecondaryColor3fEXT_remap_index] #define _gloffset_SecondaryColor3fvEXT driDispatchRemapTable[SecondaryColor3fvEXT_remap_index] #define _gloffset_SecondaryColor3iEXT driDispatchRemapTable[SecondaryColor3iEXT_remap_index] #define _gloffset_SecondaryColor3ivEXT driDispatchRemapTable[SecondaryColor3ivEXT_remap_index] #define _gloffset_SecondaryColor3sEXT driDispatchRemapTable[SecondaryColor3sEXT_remap_index] #define _gloffset_SecondaryColor3svEXT driDispatchRemapTable[SecondaryColor3svEXT_remap_index] #define _gloffset_SecondaryColor3ubEXT driDispatchRemapTable[SecondaryColor3ubEXT_remap_index] #define _gloffset_SecondaryColor3ubvEXT driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index] #define _gloffset_SecondaryColor3uiEXT driDispatchRemapTable[SecondaryColor3uiEXT_remap_index] #define _gloffset_SecondaryColor3uivEXT driDispatchRemapTable[SecondaryColor3uivEXT_remap_index] #define _gloffset_SecondaryColor3usEXT driDispatchRemapTable[SecondaryColor3usEXT_remap_index] #define _gloffset_SecondaryColor3usvEXT driDispatchRemapTable[SecondaryColor3usvEXT_remap_index] #define _gloffset_SecondaryColorPointerEXT driDispatchRemapTable[SecondaryColorPointerEXT_remap_index] #define _gloffset_AreProgramsResidentNV driDispatchRemapTable[AreProgramsResidentNV_remap_index] #define _gloffset_BindProgramNV driDispatchRemapTable[BindProgramNV_remap_index] #define _gloffset_DeleteProgramsNV driDispatchRemapTable[DeleteProgramsNV_remap_index] #define _gloffset_ExecuteProgramNV driDispatchRemapTable[ExecuteProgramNV_remap_index] #define _gloffset_GenProgramsNV driDispatchRemapTable[GenProgramsNV_remap_index] #define _gloffset_GetProgramParameterdvNV driDispatchRemapTable[GetProgramParameterdvNV_remap_index] #define _gloffset_GetProgramParameterfvNV driDispatchRemapTable[GetProgramParameterfvNV_remap_index] #define _gloffset_GetProgramivNV driDispatchRemapTable[GetProgramivNV_remap_index] #define _gloffset_GetProgramStringNV driDispatchRemapTable[GetProgramStringNV_remap_index] #define _gloffset_GetTrackMatrixivNV driDispatchRemapTable[GetTrackMatrixivNV_remap_index] #define _gloffset_GetVertexAttribdvARB driDispatchRemapTable[GetVertexAttribdvARB_remap_index] #define _gloffset_GetVertexAttribfvARB driDispatchRemapTable[GetVertexAttribfvARB_remap_index] #define _gloffset_GetVertexAttribivARB driDispatchRemapTable[GetVertexAttribivARB_remap_index] #define _gloffset_GetVertexAttribPointervNV driDispatchRemapTable[GetVertexAttribPointervNV_remap_index] #define _gloffset_IsProgramNV driDispatchRemapTable[IsProgramNV_remap_index] #define _gloffset_LoadProgramNV driDispatchRemapTable[LoadProgramNV_remap_index] #define _gloffset_ProgramParameter4dNV driDispatchRemapTable[ProgramParameter4dNV_remap_index] #define _gloffset_ProgramParameter4dvNV driDispatchRemapTable[ProgramParameter4dvNV_remap_index] #define _gloffset_ProgramParameter4fNV driDispatchRemapTable[ProgramParameter4fNV_remap_index] #define _gloffset_ProgramParameter4fvNV driDispatchRemapTable[ProgramParameter4fvNV_remap_index] #define _gloffset_ProgramParameters4dvNV driDispatchRemapTable[ProgramParameters4dvNV_remap_index] #define _gloffset_ProgramParameters4fvNV driDispatchRemapTable[ProgramParameters4fvNV_remap_index] #define _gloffset_RequestResidentProgramsNV driDispatchRemapTable[RequestResidentProgramsNV_remap_index] #define _gloffset_TrackMatrixNV driDispatchRemapTable[TrackMatrixNV_remap_index] #define _gloffset_VertexAttribPointerNV driDispatchRemapTable[VertexAttribPointerNV_remap_index] #define _gloffset_VertexAttrib1dARB driDispatchRemapTable[VertexAttrib1dARB_remap_index] #define _gloffset_VertexAttrib1dvARB driDispatchRemapTable[VertexAttrib1dvARB_remap_index] #define _gloffset_VertexAttrib1fARB driDispatchRemapTable[VertexAttrib1fARB_remap_index] #define _gloffset_VertexAttrib1fvARB driDispatchRemapTable[VertexAttrib1fvARB_remap_index] #define _gloffset_VertexAttrib1sARB driDispatchRemapTable[VertexAttrib1sARB_remap_index] #define _gloffset_VertexAttrib1svARB driDispatchRemapTable[VertexAttrib1svARB_remap_index] #define _gloffset_VertexAttrib2dARB driDispatchRemapTable[VertexAttrib2dARB_remap_index] #define _gloffset_VertexAttrib2dvARB driDispatchRemapTable[VertexAttrib2dvARB_remap_index] #define _gloffset_VertexAttrib2fARB driDispatchRemapTable[VertexAttrib2fARB_remap_index] #define _gloffset_VertexAttrib2fvARB driDispatchRemapTable[VertexAttrib2fvARB_remap_index] #define _gloffset_VertexAttrib2sARB driDispatchRemapTable[VertexAttrib2sARB_remap_index] #define _gloffset_VertexAttrib2svARB driDispatchRemapTable[VertexAttrib2svARB_remap_index] #define _gloffset_VertexAttrib3dARB driDispatchRemapTable[VertexAttrib3dARB_remap_index] #define _gloffset_VertexAttrib3dvARB driDispatchRemapTable[VertexAttrib3dvARB_remap_index] #define _gloffset_VertexAttrib3fARB driDispatchRemapTable[VertexAttrib3fARB_remap_index] #define _gloffset_VertexAttrib3fvARB driDispatchRemapTable[VertexAttrib3fvARB_remap_index] #define _gloffset_VertexAttrib3sARB driDispatchRemapTable[VertexAttrib3sARB_remap_index] #define _gloffset_VertexAttrib3svARB driDispatchRemapTable[VertexAttrib3svARB_remap_index] #define _gloffset_VertexAttrib4dARB driDispatchRemapTable[VertexAttrib4dARB_remap_index] #define _gloffset_VertexAttrib4dvARB driDispatchRemapTable[VertexAttrib4dvARB_remap_index] #define _gloffset_VertexAttrib4fARB driDispatchRemapTable[VertexAttrib4fARB_remap_index] #define _gloffset_VertexAttrib4fvARB driDispatchRemapTable[VertexAttrib4fvARB_remap_index] #define _gloffset_VertexAttrib4sARB driDispatchRemapTable[VertexAttrib4sARB_remap_index] #define _gloffset_VertexAttrib4svARB driDispatchRemapTable[VertexAttrib4svARB_remap_index] #define _gloffset_VertexAttrib4NubARB driDispatchRemapTable[VertexAttrib4NubARB_remap_index] #define _gloffset_VertexAttrib4NubvARB driDispatchRemapTable[VertexAttrib4NubvARB_remap_index] #define _gloffset_VertexAttribs1dvNV driDispatchRemapTable[VertexAttribs1dvNV_remap_index] #define _gloffset_VertexAttribs1fvNV driDispatchRemapTable[VertexAttribs1fvNV_remap_index] #define _gloffset_VertexAttribs1svNV driDispatchRemapTable[VertexAttribs1svNV_remap_index] #define _gloffset_VertexAttribs2dvNV driDispatchRemapTable[VertexAttribs2dvNV_remap_index] #define _gloffset_VertexAttribs2fvNV driDispatchRemapTable[VertexAttribs2fvNV_remap_index] #define _gloffset_VertexAttribs2svNV driDispatchRemapTable[VertexAttribs2svNV_remap_index] #define _gloffset_VertexAttribs3dvNV driDispatchRemapTable[VertexAttribs3dvNV_remap_index] #define _gloffset_VertexAttribs3fvNV driDispatchRemapTable[VertexAttribs3fvNV_remap_index] #define _gloffset_VertexAttribs3svNV driDispatchRemapTable[VertexAttribs3svNV_remap_index] #define _gloffset_VertexAttribs4dvNV driDispatchRemapTable[VertexAttribs4dvNV_remap_index] #define _gloffset_VertexAttribs4fvNV driDispatchRemapTable[VertexAttribs4fvNV_remap_index] #define _gloffset_VertexAttribs4svNV driDispatchRemapTable[VertexAttribs4svNV_remap_index] #define _gloffset_VertexAttribs4ubvNV driDispatchRemapTable[VertexAttribs4ubvNV_remap_index] #define _gloffset_PointParameteriNV driDispatchRemapTable[PointParameteriNV_remap_index] #define _gloffset_PointParameterivNV driDispatchRemapTable[PointParameterivNV_remap_index] #define _gloffset_MultiDrawArraysEXT driDispatchRemapTable[MultiDrawArraysEXT_remap_index] #define _gloffset_MultiDrawElementsEXT driDispatchRemapTable[MultiDrawElementsEXT_remap_index] #define _gloffset_ActiveStencilFaceEXT driDispatchRemapTable[ActiveStencilFaceEXT_remap_index] #define _gloffset_DeleteFencesNV driDispatchRemapTable[DeleteFencesNV_remap_index] #define _gloffset_GenFencesNV driDispatchRemapTable[GenFencesNV_remap_index] #define _gloffset_IsFenceNV driDispatchRemapTable[IsFenceNV_remap_index] #define _gloffset_TestFenceNV driDispatchRemapTable[TestFenceNV_remap_index] #define _gloffset_GetFenceivNV driDispatchRemapTable[GetFenceivNV_remap_index] #define _gloffset_FinishFenceNV driDispatchRemapTable[FinishFenceNV_remap_index] #define _gloffset_SetFenceNV driDispatchRemapTable[SetFenceNV_remap_index] #define _gloffset_VertexAttrib4bvARB driDispatchRemapTable[VertexAttrib4bvARB_remap_index] #define _gloffset_VertexAttrib4ivARB driDispatchRemapTable[VertexAttrib4ivARB_remap_index] #define _gloffset_VertexAttrib4ubvARB driDispatchRemapTable[VertexAttrib4ubvARB_remap_index] #define _gloffset_VertexAttrib4usvARB driDispatchRemapTable[VertexAttrib4usvARB_remap_index] #define _gloffset_VertexAttrib4uivARB driDispatchRemapTable[VertexAttrib4uivARB_remap_index] #define _gloffset_VertexAttrib4NbvARB driDispatchRemapTable[VertexAttrib4NbvARB_remap_index] #define _gloffset_VertexAttrib4NsvARB driDispatchRemapTable[VertexAttrib4NsvARB_remap_index] #define _gloffset_VertexAttrib4NivARB driDispatchRemapTable[VertexAttrib4NivARB_remap_index] #define _gloffset_VertexAttrib4NusvARB driDispatchRemapTable[VertexAttrib4NusvARB_remap_index] #define _gloffset_VertexAttrib4NuivARB driDispatchRemapTable[VertexAttrib4NuivARB_remap_index] #define _gloffset_VertexAttribPointerARB driDispatchRemapTable[VertexAttribPointerARB_remap_index] #define _gloffset_EnableVertexAttribArrayARB driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index] #define _gloffset_DisableVertexAttribArrayARB driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index] #define _gloffset_ProgramStringARB driDispatchRemapTable[ProgramStringARB_remap_index] #define _gloffset_ProgramEnvParameter4dARB driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index] #define _gloffset_ProgramEnvParameter4dvARB driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index] #define _gloffset_ProgramEnvParameter4fARB driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index] #define _gloffset_ProgramEnvParameter4fvARB driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index] #define _gloffset_ProgramLocalParameter4dARB driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index] #define _gloffset_ProgramLocalParameter4dvARB driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index] #define _gloffset_ProgramLocalParameter4fARB driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index] #define _gloffset_ProgramLocalParameter4fvARB driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index] #define _gloffset_GetProgramEnvParameterdvARB driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index] #define _gloffset_GetProgramEnvParameterfvARB driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index] #define _gloffset_GetProgramLocalParameterdvARB driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index] #define _gloffset_GetProgramLocalParameterfvARB driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index] #define _gloffset_GetProgramivARB driDispatchRemapTable[GetProgramivARB_remap_index] #define _gloffset_GetProgramStringARB driDispatchRemapTable[GetProgramStringARB_remap_index] #define _gloffset_ProgramNamedParameter4fNV driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index] #define _gloffset_ProgramNamedParameter4dNV driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index] #define _gloffset_ProgramNamedParameter4fvNV driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index] #define _gloffset_ProgramNamedParameter4dvNV driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index] #define _gloffset_GetProgramNamedParameterfvNV driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index] #define _gloffset_GetProgramNamedParameterdvNV driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index] #define _gloffset_BindBufferARB driDispatchRemapTable[BindBufferARB_remap_index] #define _gloffset_BufferDataARB driDispatchRemapTable[BufferDataARB_remap_index] #define _gloffset_BufferSubDataARB driDispatchRemapTable[BufferSubDataARB_remap_index] #define _gloffset_DeleteBuffersARB driDispatchRemapTable[DeleteBuffersARB_remap_index] #define _gloffset_GenBuffersARB driDispatchRemapTable[GenBuffersARB_remap_index] #define _gloffset_GetBufferParameterivARB driDispatchRemapTable[GetBufferParameterivARB_remap_index] #define _gloffset_GetBufferPointervARB driDispatchRemapTable[GetBufferPointervARB_remap_index] #define _gloffset_GetBufferSubDataARB driDispatchRemapTable[GetBufferSubDataARB_remap_index] #define _gloffset_IsBufferARB driDispatchRemapTable[IsBufferARB_remap_index] #define _gloffset_MapBufferARB driDispatchRemapTable[MapBufferARB_remap_index] #define _gloffset_UnmapBufferARB driDispatchRemapTable[UnmapBufferARB_remap_index] #define _gloffset_DepthBoundsEXT driDispatchRemapTable[DepthBoundsEXT_remap_index] #define _gloffset_GenQueriesARB driDispatchRemapTable[GenQueriesARB_remap_index] #define _gloffset_DeleteQueriesARB driDispatchRemapTable[DeleteQueriesARB_remap_index] #define _gloffset_IsQueryARB driDispatchRemapTable[IsQueryARB_remap_index] #define _gloffset_BeginQueryARB driDispatchRemapTable[BeginQueryARB_remap_index] #define _gloffset_EndQueryARB driDispatchRemapTable[EndQueryARB_remap_index] #define _gloffset_GetQueryivARB driDispatchRemapTable[GetQueryivARB_remap_index] #define _gloffset_GetQueryObjectivARB driDispatchRemapTable[GetQueryObjectivARB_remap_index] #define _gloffset_GetQueryObjectuivARB driDispatchRemapTable[GetQueryObjectuivARB_remap_index] #define _gloffset_MultiModeDrawArraysIBM driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index] #define _gloffset_MultiModeDrawElementsIBM driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index] #define _gloffset_BlendEquationSeparateEXT driDispatchRemapTable[BlendEquationSeparateEXT_remap_index] #define _gloffset_DeleteObjectARB driDispatchRemapTable[DeleteObjectARB_remap_index] #define _gloffset_GetHandleARB driDispatchRemapTable[GetHandleARB_remap_index] #define _gloffset_DetachObjectARB driDispatchRemapTable[DetachObjectARB_remap_index] #define _gloffset_CreateShaderObjectARB driDispatchRemapTable[CreateShaderObjectARB_remap_index] #define _gloffset_ShaderSourceARB driDispatchRemapTable[ShaderSourceARB_remap_index] #define _gloffset_CompileShaderARB driDispatchRemapTable[CompileShaderARB_remap_index] #define _gloffset_CreateProgramObjectARB driDispatchRemapTable[CreateProgramObjectARB_remap_index] #define _gloffset_AttachObjectARB driDispatchRemapTable[AttachObjectARB_remap_index] #define _gloffset_LinkProgramARB driDispatchRemapTable[LinkProgramARB_remap_index] #define _gloffset_UseProgramObjectARB driDispatchRemapTable[UseProgramObjectARB_remap_index] #define _gloffset_ValidateProgramARB driDispatchRemapTable[ValidateProgramARB_remap_index] #define _gloffset_Uniform1fARB driDispatchRemapTable[Uniform1fARB_remap_index] #define _gloffset_Uniform2fARB driDispatchRemapTable[Uniform2fARB_remap_index] #define _gloffset_Uniform3fARB driDispatchRemapTable[Uniform3fARB_remap_index] #define _gloffset_Uniform4fARB driDispatchRemapTable[Uniform4fARB_remap_index] #define _gloffset_Uniform1iARB driDispatchRemapTable[Uniform1iARB_remap_index] #define _gloffset_Uniform2iARB driDispatchRemapTable[Uniform2iARB_remap_index] #define _gloffset_Uniform3iARB driDispatchRemapTable[Uniform3iARB_remap_index] #define _gloffset_Uniform4iARB driDispatchRemapTable[Uniform4iARB_remap_index] #define _gloffset_Uniform1fvARB driDispatchRemapTable[Uniform1fvARB_remap_index] #define _gloffset_Uniform2fvARB driDispatchRemapTable[Uniform2fvARB_remap_index] #define _gloffset_Uniform3fvARB driDispatchRemapTable[Uniform3fvARB_remap_index] #define _gloffset_Uniform4fvARB driDispatchRemapTable[Uniform4fvARB_remap_index] #define _gloffset_Uniform1ivARB driDispatchRemapTable[Uniform1ivARB_remap_index] #define _gloffset_Uniform2ivARB driDispatchRemapTable[Uniform2ivARB_remap_index] #define _gloffset_Uniform3ivARB driDispatchRemapTable[Uniform3ivARB_remap_index] #define _gloffset_Uniform4ivARB driDispatchRemapTable[Uniform4ivARB_remap_index] #define _gloffset_UniformMatrix2fvARB driDispatchRemapTable[UniformMatrix2fvARB_remap_index] #define _gloffset_UniformMatrix3fvARB driDispatchRemapTable[UniformMatrix3fvARB_remap_index] #define _gloffset_UniformMatrix4fvARB driDispatchRemapTable[UniformMatrix4fvARB_remap_index] #define _gloffset_GetObjectParameterfvARB driDispatchRemapTable[GetObjectParameterfvARB_remap_index] #define _gloffset_GetObjectParameterivARB driDispatchRemapTable[GetObjectParameterivARB_remap_index] #define _gloffset_GetInfoLogARB driDispatchRemapTable[GetInfoLogARB_remap_index] #define _gloffset_GetAttachedObjectsARB driDispatchRemapTable[GetAttachedObjectsARB_remap_index] #define _gloffset_GetUniformLocationARB driDispatchRemapTable[GetUniformLocationARB_remap_index] #define _gloffset_GetActiveUniformARB driDispatchRemapTable[GetActiveUniformARB_remap_index] #define _gloffset_GetUniformfvARB driDispatchRemapTable[GetUniformfvARB_remap_index] #define _gloffset_GetUniformivARB driDispatchRemapTable[GetUniformivARB_remap_index] #define _gloffset_GetShaderSourceARB driDispatchRemapTable[GetShaderSourceARB_remap_index] #define _gloffset_BindAttribLocationARB driDispatchRemapTable[BindAttribLocationARB_remap_index] #define _gloffset_GetActiveAttribARB driDispatchRemapTable[GetActiveAttribARB_remap_index] #define _gloffset_GetAttribLocationARB driDispatchRemapTable[GetAttribLocationARB_remap_index] #define _gloffset_GetVertexAttribdvNV driDispatchRemapTable[GetVertexAttribdvNV_remap_index] #define _gloffset_GetVertexAttribfvNV driDispatchRemapTable[GetVertexAttribfvNV_remap_index] #define _gloffset_GetVertexAttribivNV driDispatchRemapTable[GetVertexAttribivNV_remap_index] #define _gloffset_VertexAttrib1dNV driDispatchRemapTable[VertexAttrib1dNV_remap_index] #define _gloffset_VertexAttrib1dvNV driDispatchRemapTable[VertexAttrib1dvNV_remap_index] #define _gloffset_VertexAttrib1fNV driDispatchRemapTable[VertexAttrib1fNV_remap_index] #define _gloffset_VertexAttrib1fvNV driDispatchRemapTable[VertexAttrib1fvNV_remap_index] #define _gloffset_VertexAttrib1sNV driDispatchRemapTable[VertexAttrib1sNV_remap_index] #define _gloffset_VertexAttrib1svNV driDispatchRemapTable[VertexAttrib1svNV_remap_index] #define _gloffset_VertexAttrib2dNV driDispatchRemapTable[VertexAttrib2dNV_remap_index] #define _gloffset_VertexAttrib2dvNV driDispatchRemapTable[VertexAttrib2dvNV_remap_index] #define _gloffset_VertexAttrib2fNV driDispatchRemapTable[VertexAttrib2fNV_remap_index] #define _gloffset_VertexAttrib2fvNV driDispatchRemapTable[VertexAttrib2fvNV_remap_index] #define _gloffset_VertexAttrib2sNV driDispatchRemapTable[VertexAttrib2sNV_remap_index] #define _gloffset_VertexAttrib2svNV driDispatchRemapTable[VertexAttrib2svNV_remap_index] #define _gloffset_VertexAttrib3dNV driDispatchRemapTable[VertexAttrib3dNV_remap_index] #define _gloffset_VertexAttrib3dvNV driDispatchRemapTable[VertexAttrib3dvNV_remap_index] #define _gloffset_VertexAttrib3fNV driDispatchRemapTable[VertexAttrib3fNV_remap_index] #define _gloffset_VertexAttrib3fvNV driDispatchRemapTable[VertexAttrib3fvNV_remap_index] #define _gloffset_VertexAttrib3sNV driDispatchRemapTable[VertexAttrib3sNV_remap_index] #define _gloffset_VertexAttrib3svNV driDispatchRemapTable[VertexAttrib3svNV_remap_index] #define _gloffset_VertexAttrib4dNV driDispatchRemapTable[VertexAttrib4dNV_remap_index] #define _gloffset_VertexAttrib4dvNV driDispatchRemapTable[VertexAttrib4dvNV_remap_index] #define _gloffset_VertexAttrib4fNV driDispatchRemapTable[VertexAttrib4fNV_remap_index] #define _gloffset_VertexAttrib4fvNV driDispatchRemapTable[VertexAttrib4fvNV_remap_index] #define _gloffset_VertexAttrib4sNV driDispatchRemapTable[VertexAttrib4sNV_remap_index] #define _gloffset_VertexAttrib4svNV driDispatchRemapTable[VertexAttrib4svNV_remap_index] #define _gloffset_VertexAttrib4ubNV driDispatchRemapTable[VertexAttrib4ubNV_remap_index] #define _gloffset_VertexAttrib4ubvNV driDispatchRemapTable[VertexAttrib4ubvNV_remap_index] #define _gloffset_GenFragmentShadersATI driDispatchRemapTable[GenFragmentShadersATI_remap_index] #define _gloffset_BindFragmentShaderATI driDispatchRemapTable[BindFragmentShaderATI_remap_index] #define _gloffset_DeleteFragmentShaderATI driDispatchRemapTable[DeleteFragmentShaderATI_remap_index] #define _gloffset_BeginFragmentShaderATI driDispatchRemapTable[BeginFragmentShaderATI_remap_index] #define _gloffset_EndFragmentShaderATI driDispatchRemapTable[EndFragmentShaderATI_remap_index] #define _gloffset_PassTexCoordATI driDispatchRemapTable[PassTexCoordATI_remap_index] #define _gloffset_SampleMapATI driDispatchRemapTable[SampleMapATI_remap_index] #define _gloffset_ColorFragmentOp1ATI driDispatchRemapTable[ColorFragmentOp1ATI_remap_index] #define _gloffset_ColorFragmentOp2ATI driDispatchRemapTable[ColorFragmentOp2ATI_remap_index] #define _gloffset_ColorFragmentOp3ATI driDispatchRemapTable[ColorFragmentOp3ATI_remap_index] #define _gloffset_AlphaFragmentOp1ATI driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index] #define _gloffset_AlphaFragmentOp2ATI driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index] #define _gloffset_AlphaFragmentOp3ATI driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index] #define _gloffset_SetFragmentShaderConstantATI driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index] #define _gloffset_IsRenderbufferEXT driDispatchRemapTable[IsRenderbufferEXT_remap_index] #define _gloffset_BindRenderbufferEXT driDispatchRemapTable[BindRenderbufferEXT_remap_index] #define _gloffset_DeleteRenderbuffersEXT driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index] #define _gloffset_GenRenderbuffersEXT driDispatchRemapTable[GenRenderbuffersEXT_remap_index] #define _gloffset_RenderbufferStorageEXT driDispatchRemapTable[RenderbufferStorageEXT_remap_index] #define _gloffset_GetRenderbufferParameterivEXT driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index] #define _gloffset_IsFramebufferEXT driDispatchRemapTable[IsFramebufferEXT_remap_index] #define _gloffset_BindFramebufferEXT driDispatchRemapTable[BindFramebufferEXT_remap_index] #define _gloffset_DeleteFramebuffersEXT driDispatchRemapTable[DeleteFramebuffersEXT_remap_index] #define _gloffset_GenFramebuffersEXT driDispatchRemapTable[GenFramebuffersEXT_remap_index] #define _gloffset_CheckFramebufferStatusEXT driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index] #define _gloffset_FramebufferTexture1DEXT driDispatchRemapTable[FramebufferTexture1DEXT_remap_index] #define _gloffset_FramebufferTexture2DEXT driDispatchRemapTable[FramebufferTexture2DEXT_remap_index] #define _gloffset_FramebufferTexture3DEXT driDispatchRemapTable[FramebufferTexture3DEXT_remap_index] #define _gloffset_FramebufferRenderbufferEXT driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index] #define _gloffset_GetFramebufferAttachmentParameterivEXT driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index] #define _gloffset_GenerateMipmapEXT driDispatchRemapTable[GenerateMipmapEXT_remap_index] #define _gloffset_StencilFuncSeparate driDispatchRemapTable[StencilFuncSeparate_remap_index] #define _gloffset_StencilOpSeparate driDispatchRemapTable[StencilOpSeparate_remap_index] #define _gloffset_StencilMaskSeparate driDispatchRemapTable[StencilMaskSeparate_remap_index] #endif /* !defined(IN_DRI_DRIVER) */ #endif /* !defined( _GLAPI_OFFSETS_H_ ) */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/glapi/glapitable.h0000644000000000000000000022323513614532424020575 0ustar /* DO NOT EDIT - This file generated automatically by gl_table.py (from Mesa) script */ /* * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * (C) Copyright IBM Corporation 2004 * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sub license, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL, IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #if !defined( _GLAPI_TABLE_H_ ) # define _GLAPI_TABLE_H_ #ifndef GLAPIENTRYP #define GLAPIENTRYP #endif typedef void (*_glapi_proc)(void); /* generic function pointer */ struct _glapi_table { void (GLAPIENTRYP NewList)(GLuint list, GLenum mode); /* 0 */ void (GLAPIENTRYP EndList)(void); /* 1 */ void (GLAPIENTRYP CallList)(GLuint list); /* 2 */ void (GLAPIENTRYP CallLists)(GLsizei n, GLenum type, const GLvoid * lists); /* 3 */ void (GLAPIENTRYP DeleteLists)(GLuint list, GLsizei range); /* 4 */ GLuint (GLAPIENTRYP GenLists)(GLsizei range); /* 5 */ void (GLAPIENTRYP ListBase)(GLuint base); /* 6 */ void (GLAPIENTRYP Begin)(GLenum mode); /* 7 */ void (GLAPIENTRYP Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap); /* 8 */ void (GLAPIENTRYP Color3b)(GLbyte red, GLbyte green, GLbyte blue); /* 9 */ void (GLAPIENTRYP Color3bv)(const GLbyte * v); /* 10 */ void (GLAPIENTRYP Color3d)(GLdouble red, GLdouble green, GLdouble blue); /* 11 */ void (GLAPIENTRYP Color3dv)(const GLdouble * v); /* 12 */ void (GLAPIENTRYP Color3f)(GLfloat red, GLfloat green, GLfloat blue); /* 13 */ void (GLAPIENTRYP Color3fv)(const GLfloat * v); /* 14 */ void (GLAPIENTRYP Color3i)(GLint red, GLint green, GLint blue); /* 15 */ void (GLAPIENTRYP Color3iv)(const GLint * v); /* 16 */ void (GLAPIENTRYP Color3s)(GLshort red, GLshort green, GLshort blue); /* 17 */ void (GLAPIENTRYP Color3sv)(const GLshort * v); /* 18 */ void (GLAPIENTRYP Color3ub)(GLubyte red, GLubyte green, GLubyte blue); /* 19 */ void (GLAPIENTRYP Color3ubv)(const GLubyte * v); /* 20 */ void (GLAPIENTRYP Color3ui)(GLuint red, GLuint green, GLuint blue); /* 21 */ void (GLAPIENTRYP Color3uiv)(const GLuint * v); /* 22 */ void (GLAPIENTRYP Color3us)(GLushort red, GLushort green, GLushort blue); /* 23 */ void (GLAPIENTRYP Color3usv)(const GLushort * v); /* 24 */ void (GLAPIENTRYP Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); /* 25 */ void (GLAPIENTRYP Color4bv)(const GLbyte * v); /* 26 */ void (GLAPIENTRYP Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); /* 27 */ void (GLAPIENTRYP Color4dv)(const GLdouble * v); /* 28 */ void (GLAPIENTRYP Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 29 */ void (GLAPIENTRYP Color4fv)(const GLfloat * v); /* 30 */ void (GLAPIENTRYP Color4i)(GLint red, GLint green, GLint blue, GLint alpha); /* 31 */ void (GLAPIENTRYP Color4iv)(const GLint * v); /* 32 */ void (GLAPIENTRYP Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha); /* 33 */ void (GLAPIENTRYP Color4sv)(const GLshort * v); /* 34 */ void (GLAPIENTRYP Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); /* 35 */ void (GLAPIENTRYP Color4ubv)(const GLubyte * v); /* 36 */ void (GLAPIENTRYP Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha); /* 37 */ void (GLAPIENTRYP Color4uiv)(const GLuint * v); /* 38 */ void (GLAPIENTRYP Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha); /* 39 */ void (GLAPIENTRYP Color4usv)(const GLushort * v); /* 40 */ void (GLAPIENTRYP EdgeFlag)(GLboolean flag); /* 41 */ void (GLAPIENTRYP EdgeFlagv)(const GLboolean * flag); /* 42 */ void (GLAPIENTRYP End)(void); /* 43 */ void (GLAPIENTRYP Indexd)(GLdouble c); /* 44 */ void (GLAPIENTRYP Indexdv)(const GLdouble * c); /* 45 */ void (GLAPIENTRYP Indexf)(GLfloat c); /* 46 */ void (GLAPIENTRYP Indexfv)(const GLfloat * c); /* 47 */ void (GLAPIENTRYP Indexi)(GLint c); /* 48 */ void (GLAPIENTRYP Indexiv)(const GLint * c); /* 49 */ void (GLAPIENTRYP Indexs)(GLshort c); /* 50 */ void (GLAPIENTRYP Indexsv)(const GLshort * c); /* 51 */ void (GLAPIENTRYP Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz); /* 52 */ void (GLAPIENTRYP Normal3bv)(const GLbyte * v); /* 53 */ void (GLAPIENTRYP Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz); /* 54 */ void (GLAPIENTRYP Normal3dv)(const GLdouble * v); /* 55 */ void (GLAPIENTRYP Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz); /* 56 */ void (GLAPIENTRYP Normal3fv)(const GLfloat * v); /* 57 */ void (GLAPIENTRYP Normal3i)(GLint nx, GLint ny, GLint nz); /* 58 */ void (GLAPIENTRYP Normal3iv)(const GLint * v); /* 59 */ void (GLAPIENTRYP Normal3s)(GLshort nx, GLshort ny, GLshort nz); /* 60 */ void (GLAPIENTRYP Normal3sv)(const GLshort * v); /* 61 */ void (GLAPIENTRYP RasterPos2d)(GLdouble x, GLdouble y); /* 62 */ void (GLAPIENTRYP RasterPos2dv)(const GLdouble * v); /* 63 */ void (GLAPIENTRYP RasterPos2f)(GLfloat x, GLfloat y); /* 64 */ void (GLAPIENTRYP RasterPos2fv)(const GLfloat * v); /* 65 */ void (GLAPIENTRYP RasterPos2i)(GLint x, GLint y); /* 66 */ void (GLAPIENTRYP RasterPos2iv)(const GLint * v); /* 67 */ void (GLAPIENTRYP RasterPos2s)(GLshort x, GLshort y); /* 68 */ void (GLAPIENTRYP RasterPos2sv)(const GLshort * v); /* 69 */ void (GLAPIENTRYP RasterPos3d)(GLdouble x, GLdouble y, GLdouble z); /* 70 */ void (GLAPIENTRYP RasterPos3dv)(const GLdouble * v); /* 71 */ void (GLAPIENTRYP RasterPos3f)(GLfloat x, GLfloat y, GLfloat z); /* 72 */ void (GLAPIENTRYP RasterPos3fv)(const GLfloat * v); /* 73 */ void (GLAPIENTRYP RasterPos3i)(GLint x, GLint y, GLint z); /* 74 */ void (GLAPIENTRYP RasterPos3iv)(const GLint * v); /* 75 */ void (GLAPIENTRYP RasterPos3s)(GLshort x, GLshort y, GLshort z); /* 76 */ void (GLAPIENTRYP RasterPos3sv)(const GLshort * v); /* 77 */ void (GLAPIENTRYP RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 78 */ void (GLAPIENTRYP RasterPos4dv)(const GLdouble * v); /* 79 */ void (GLAPIENTRYP RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 80 */ void (GLAPIENTRYP RasterPos4fv)(const GLfloat * v); /* 81 */ void (GLAPIENTRYP RasterPos4i)(GLint x, GLint y, GLint z, GLint w); /* 82 */ void (GLAPIENTRYP RasterPos4iv)(const GLint * v); /* 83 */ void (GLAPIENTRYP RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 84 */ void (GLAPIENTRYP RasterPos4sv)(const GLshort * v); /* 85 */ void (GLAPIENTRYP Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); /* 86 */ void (GLAPIENTRYP Rectdv)(const GLdouble * v1, const GLdouble * v2); /* 87 */ void (GLAPIENTRYP Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); /* 88 */ void (GLAPIENTRYP Rectfv)(const GLfloat * v1, const GLfloat * v2); /* 89 */ void (GLAPIENTRYP Recti)(GLint x1, GLint y1, GLint x2, GLint y2); /* 90 */ void (GLAPIENTRYP Rectiv)(const GLint * v1, const GLint * v2); /* 91 */ void (GLAPIENTRYP Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); /* 92 */ void (GLAPIENTRYP Rectsv)(const GLshort * v1, const GLshort * v2); /* 93 */ void (GLAPIENTRYP TexCoord1d)(GLdouble s); /* 94 */ void (GLAPIENTRYP TexCoord1dv)(const GLdouble * v); /* 95 */ void (GLAPIENTRYP TexCoord1f)(GLfloat s); /* 96 */ void (GLAPIENTRYP TexCoord1fv)(const GLfloat * v); /* 97 */ void (GLAPIENTRYP TexCoord1i)(GLint s); /* 98 */ void (GLAPIENTRYP TexCoord1iv)(const GLint * v); /* 99 */ void (GLAPIENTRYP TexCoord1s)(GLshort s); /* 100 */ void (GLAPIENTRYP TexCoord1sv)(const GLshort * v); /* 101 */ void (GLAPIENTRYP TexCoord2d)(GLdouble s, GLdouble t); /* 102 */ void (GLAPIENTRYP TexCoord2dv)(const GLdouble * v); /* 103 */ void (GLAPIENTRYP TexCoord2f)(GLfloat s, GLfloat t); /* 104 */ void (GLAPIENTRYP TexCoord2fv)(const GLfloat * v); /* 105 */ void (GLAPIENTRYP TexCoord2i)(GLint s, GLint t); /* 106 */ void (GLAPIENTRYP TexCoord2iv)(const GLint * v); /* 107 */ void (GLAPIENTRYP TexCoord2s)(GLshort s, GLshort t); /* 108 */ void (GLAPIENTRYP TexCoord2sv)(const GLshort * v); /* 109 */ void (GLAPIENTRYP TexCoord3d)(GLdouble s, GLdouble t, GLdouble r); /* 110 */ void (GLAPIENTRYP TexCoord3dv)(const GLdouble * v); /* 111 */ void (GLAPIENTRYP TexCoord3f)(GLfloat s, GLfloat t, GLfloat r); /* 112 */ void (GLAPIENTRYP TexCoord3fv)(const GLfloat * v); /* 113 */ void (GLAPIENTRYP TexCoord3i)(GLint s, GLint t, GLint r); /* 114 */ void (GLAPIENTRYP TexCoord3iv)(const GLint * v); /* 115 */ void (GLAPIENTRYP TexCoord3s)(GLshort s, GLshort t, GLshort r); /* 116 */ void (GLAPIENTRYP TexCoord3sv)(const GLshort * v); /* 117 */ void (GLAPIENTRYP TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 118 */ void (GLAPIENTRYP TexCoord4dv)(const GLdouble * v); /* 119 */ void (GLAPIENTRYP TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 120 */ void (GLAPIENTRYP TexCoord4fv)(const GLfloat * v); /* 121 */ void (GLAPIENTRYP TexCoord4i)(GLint s, GLint t, GLint r, GLint q); /* 122 */ void (GLAPIENTRYP TexCoord4iv)(const GLint * v); /* 123 */ void (GLAPIENTRYP TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q); /* 124 */ void (GLAPIENTRYP TexCoord4sv)(const GLshort * v); /* 125 */ void (GLAPIENTRYP Vertex2d)(GLdouble x, GLdouble y); /* 126 */ void (GLAPIENTRYP Vertex2dv)(const GLdouble * v); /* 127 */ void (GLAPIENTRYP Vertex2f)(GLfloat x, GLfloat y); /* 128 */ void (GLAPIENTRYP Vertex2fv)(const GLfloat * v); /* 129 */ void (GLAPIENTRYP Vertex2i)(GLint x, GLint y); /* 130 */ void (GLAPIENTRYP Vertex2iv)(const GLint * v); /* 131 */ void (GLAPIENTRYP Vertex2s)(GLshort x, GLshort y); /* 132 */ void (GLAPIENTRYP Vertex2sv)(const GLshort * v); /* 133 */ void (GLAPIENTRYP Vertex3d)(GLdouble x, GLdouble y, GLdouble z); /* 134 */ void (GLAPIENTRYP Vertex3dv)(const GLdouble * v); /* 135 */ void (GLAPIENTRYP Vertex3f)(GLfloat x, GLfloat y, GLfloat z); /* 136 */ void (GLAPIENTRYP Vertex3fv)(const GLfloat * v); /* 137 */ void (GLAPIENTRYP Vertex3i)(GLint x, GLint y, GLint z); /* 138 */ void (GLAPIENTRYP Vertex3iv)(const GLint * v); /* 139 */ void (GLAPIENTRYP Vertex3s)(GLshort x, GLshort y, GLshort z); /* 140 */ void (GLAPIENTRYP Vertex3sv)(const GLshort * v); /* 141 */ void (GLAPIENTRYP Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 142 */ void (GLAPIENTRYP Vertex4dv)(const GLdouble * v); /* 143 */ void (GLAPIENTRYP Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 144 */ void (GLAPIENTRYP Vertex4fv)(const GLfloat * v); /* 145 */ void (GLAPIENTRYP Vertex4i)(GLint x, GLint y, GLint z, GLint w); /* 146 */ void (GLAPIENTRYP Vertex4iv)(const GLint * v); /* 147 */ void (GLAPIENTRYP Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 148 */ void (GLAPIENTRYP Vertex4sv)(const GLshort * v); /* 149 */ void (GLAPIENTRYP ClipPlane)(GLenum plane, const GLdouble * equation); /* 150 */ void (GLAPIENTRYP ColorMaterial)(GLenum face, GLenum mode); /* 151 */ void (GLAPIENTRYP CullFace)(GLenum mode); /* 152 */ void (GLAPIENTRYP Fogf)(GLenum pname, GLfloat param); /* 153 */ void (GLAPIENTRYP Fogfv)(GLenum pname, const GLfloat * params); /* 154 */ void (GLAPIENTRYP Fogi)(GLenum pname, GLint param); /* 155 */ void (GLAPIENTRYP Fogiv)(GLenum pname, const GLint * params); /* 156 */ void (GLAPIENTRYP FrontFace)(GLenum mode); /* 157 */ void (GLAPIENTRYP Hint)(GLenum target, GLenum mode); /* 158 */ void (GLAPIENTRYP Lightf)(GLenum light, GLenum pname, GLfloat param); /* 159 */ void (GLAPIENTRYP Lightfv)(GLenum light, GLenum pname, const GLfloat * params); /* 160 */ void (GLAPIENTRYP Lighti)(GLenum light, GLenum pname, GLint param); /* 161 */ void (GLAPIENTRYP Lightiv)(GLenum light, GLenum pname, const GLint * params); /* 162 */ void (GLAPIENTRYP LightModelf)(GLenum pname, GLfloat param); /* 163 */ void (GLAPIENTRYP LightModelfv)(GLenum pname, const GLfloat * params); /* 164 */ void (GLAPIENTRYP LightModeli)(GLenum pname, GLint param); /* 165 */ void (GLAPIENTRYP LightModeliv)(GLenum pname, const GLint * params); /* 166 */ void (GLAPIENTRYP LineStipple)(GLint factor, GLushort pattern); /* 167 */ void (GLAPIENTRYP LineWidth)(GLfloat width); /* 168 */ void (GLAPIENTRYP Materialf)(GLenum face, GLenum pname, GLfloat param); /* 169 */ void (GLAPIENTRYP Materialfv)(GLenum face, GLenum pname, const GLfloat * params); /* 170 */ void (GLAPIENTRYP Materiali)(GLenum face, GLenum pname, GLint param); /* 171 */ void (GLAPIENTRYP Materialiv)(GLenum face, GLenum pname, const GLint * params); /* 172 */ void (GLAPIENTRYP PointSize)(GLfloat size); /* 173 */ void (GLAPIENTRYP PolygonMode)(GLenum face, GLenum mode); /* 174 */ void (GLAPIENTRYP PolygonStipple)(const GLubyte * mask); /* 175 */ void (GLAPIENTRYP Scissor)(GLint x, GLint y, GLsizei width, GLsizei height); /* 176 */ void (GLAPIENTRYP ShadeModel)(GLenum mode); /* 177 */ void (GLAPIENTRYP TexParameterf)(GLenum target, GLenum pname, GLfloat param); /* 178 */ void (GLAPIENTRYP TexParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 179 */ void (GLAPIENTRYP TexParameteri)(GLenum target, GLenum pname, GLint param); /* 180 */ void (GLAPIENTRYP TexParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 181 */ void (GLAPIENTRYP TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 182 */ void (GLAPIENTRYP TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 183 */ void (GLAPIENTRYP TexEnvf)(GLenum target, GLenum pname, GLfloat param); /* 184 */ void (GLAPIENTRYP TexEnvfv)(GLenum target, GLenum pname, const GLfloat * params); /* 185 */ void (GLAPIENTRYP TexEnvi)(GLenum target, GLenum pname, GLint param); /* 186 */ void (GLAPIENTRYP TexEnviv)(GLenum target, GLenum pname, const GLint * params); /* 187 */ void (GLAPIENTRYP TexGend)(GLenum coord, GLenum pname, GLdouble param); /* 188 */ void (GLAPIENTRYP TexGendv)(GLenum coord, GLenum pname, const GLdouble * params); /* 189 */ void (GLAPIENTRYP TexGenf)(GLenum coord, GLenum pname, GLfloat param); /* 190 */ void (GLAPIENTRYP TexGenfv)(GLenum coord, GLenum pname, const GLfloat * params); /* 191 */ void (GLAPIENTRYP TexGeni)(GLenum coord, GLenum pname, GLint param); /* 192 */ void (GLAPIENTRYP TexGeniv)(GLenum coord, GLenum pname, const GLint * params); /* 193 */ void (GLAPIENTRYP FeedbackBuffer)(GLsizei size, GLenum type, GLfloat * buffer); /* 194 */ void (GLAPIENTRYP SelectBuffer)(GLsizei size, GLuint * buffer); /* 195 */ GLint (GLAPIENTRYP RenderMode)(GLenum mode); /* 196 */ void (GLAPIENTRYP InitNames)(void); /* 197 */ void (GLAPIENTRYP LoadName)(GLuint name); /* 198 */ void (GLAPIENTRYP PassThrough)(GLfloat token); /* 199 */ void (GLAPIENTRYP PopName)(void); /* 200 */ void (GLAPIENTRYP PushName)(GLuint name); /* 201 */ void (GLAPIENTRYP DrawBuffer)(GLenum mode); /* 202 */ void (GLAPIENTRYP Clear)(GLbitfield mask); /* 203 */ void (GLAPIENTRYP ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 204 */ void (GLAPIENTRYP ClearIndex)(GLfloat c); /* 205 */ void (GLAPIENTRYP ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 206 */ void (GLAPIENTRYP ClearStencil)(GLint s); /* 207 */ void (GLAPIENTRYP ClearDepth)(GLclampd depth); /* 208 */ void (GLAPIENTRYP StencilMask)(GLuint mask); /* 209 */ void (GLAPIENTRYP ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); /* 210 */ void (GLAPIENTRYP DepthMask)(GLboolean flag); /* 211 */ void (GLAPIENTRYP IndexMask)(GLuint mask); /* 212 */ void (GLAPIENTRYP Accum)(GLenum op, GLfloat value); /* 213 */ void (GLAPIENTRYP Disable)(GLenum cap); /* 214 */ void (GLAPIENTRYP Enable)(GLenum cap); /* 215 */ void (GLAPIENTRYP Finish)(void); /* 216 */ void (GLAPIENTRYP Flush)(void); /* 217 */ void (GLAPIENTRYP PopAttrib)(void); /* 218 */ void (GLAPIENTRYP PushAttrib)(GLbitfield mask); /* 219 */ void (GLAPIENTRYP Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points); /* 220 */ void (GLAPIENTRYP Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points); /* 221 */ void (GLAPIENTRYP Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points); /* 222 */ void (GLAPIENTRYP Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points); /* 223 */ void (GLAPIENTRYP MapGrid1d)(GLint un, GLdouble u1, GLdouble u2); /* 224 */ void (GLAPIENTRYP MapGrid1f)(GLint un, GLfloat u1, GLfloat u2); /* 225 */ void (GLAPIENTRYP MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); /* 226 */ void (GLAPIENTRYP MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); /* 227 */ void (GLAPIENTRYP EvalCoord1d)(GLdouble u); /* 228 */ void (GLAPIENTRYP EvalCoord1dv)(const GLdouble * u); /* 229 */ void (GLAPIENTRYP EvalCoord1f)(GLfloat u); /* 230 */ void (GLAPIENTRYP EvalCoord1fv)(const GLfloat * u); /* 231 */ void (GLAPIENTRYP EvalCoord2d)(GLdouble u, GLdouble v); /* 232 */ void (GLAPIENTRYP EvalCoord2dv)(const GLdouble * u); /* 233 */ void (GLAPIENTRYP EvalCoord2f)(GLfloat u, GLfloat v); /* 234 */ void (GLAPIENTRYP EvalCoord2fv)(const GLfloat * u); /* 235 */ void (GLAPIENTRYP EvalMesh1)(GLenum mode, GLint i1, GLint i2); /* 236 */ void (GLAPIENTRYP EvalPoint1)(GLint i); /* 237 */ void (GLAPIENTRYP EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); /* 238 */ void (GLAPIENTRYP EvalPoint2)(GLint i, GLint j); /* 239 */ void (GLAPIENTRYP AlphaFunc)(GLenum func, GLclampf ref); /* 240 */ void (GLAPIENTRYP BlendFunc)(GLenum sfactor, GLenum dfactor); /* 241 */ void (GLAPIENTRYP LogicOp)(GLenum opcode); /* 242 */ void (GLAPIENTRYP StencilFunc)(GLenum func, GLint ref, GLuint mask); /* 243 */ void (GLAPIENTRYP StencilOp)(GLenum fail, GLenum zfail, GLenum zpass); /* 244 */ void (GLAPIENTRYP DepthFunc)(GLenum func); /* 245 */ void (GLAPIENTRYP PixelZoom)(GLfloat xfactor, GLfloat yfactor); /* 246 */ void (GLAPIENTRYP PixelTransferf)(GLenum pname, GLfloat param); /* 247 */ void (GLAPIENTRYP PixelTransferi)(GLenum pname, GLint param); /* 248 */ void (GLAPIENTRYP PixelStoref)(GLenum pname, GLfloat param); /* 249 */ void (GLAPIENTRYP PixelStorei)(GLenum pname, GLint param); /* 250 */ void (GLAPIENTRYP PixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat * values); /* 251 */ void (GLAPIENTRYP PixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint * values); /* 252 */ void (GLAPIENTRYP PixelMapusv)(GLenum map, GLsizei mapsize, const GLushort * values); /* 253 */ void (GLAPIENTRYP ReadBuffer)(GLenum mode); /* 254 */ void (GLAPIENTRYP CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); /* 255 */ void (GLAPIENTRYP ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels); /* 256 */ void (GLAPIENTRYP DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 257 */ void (GLAPIENTRYP GetBooleanv)(GLenum pname, GLboolean * params); /* 258 */ void (GLAPIENTRYP GetClipPlane)(GLenum plane, GLdouble * equation); /* 259 */ void (GLAPIENTRYP GetDoublev)(GLenum pname, GLdouble * params); /* 260 */ GLenum (GLAPIENTRYP GetError)(void); /* 261 */ void (GLAPIENTRYP GetFloatv)(GLenum pname, GLfloat * params); /* 262 */ void (GLAPIENTRYP GetIntegerv)(GLenum pname, GLint * params); /* 263 */ void (GLAPIENTRYP GetLightfv)(GLenum light, GLenum pname, GLfloat * params); /* 264 */ void (GLAPIENTRYP GetLightiv)(GLenum light, GLenum pname, GLint * params); /* 265 */ void (GLAPIENTRYP GetMapdv)(GLenum target, GLenum query, GLdouble * v); /* 266 */ void (GLAPIENTRYP GetMapfv)(GLenum target, GLenum query, GLfloat * v); /* 267 */ void (GLAPIENTRYP GetMapiv)(GLenum target, GLenum query, GLint * v); /* 268 */ void (GLAPIENTRYP GetMaterialfv)(GLenum face, GLenum pname, GLfloat * params); /* 269 */ void (GLAPIENTRYP GetMaterialiv)(GLenum face, GLenum pname, GLint * params); /* 270 */ void (GLAPIENTRYP GetPixelMapfv)(GLenum map, GLfloat * values); /* 271 */ void (GLAPIENTRYP GetPixelMapuiv)(GLenum map, GLuint * values); /* 272 */ void (GLAPIENTRYP GetPixelMapusv)(GLenum map, GLushort * values); /* 273 */ void (GLAPIENTRYP GetPolygonStipple)(GLubyte * mask); /* 274 */ const GLubyte * (GLAPIENTRYP GetString)(GLenum name); /* 275 */ void (GLAPIENTRYP GetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params); /* 276 */ void (GLAPIENTRYP GetTexEnviv)(GLenum target, GLenum pname, GLint * params); /* 277 */ void (GLAPIENTRYP GetTexGendv)(GLenum coord, GLenum pname, GLdouble * params); /* 278 */ void (GLAPIENTRYP GetTexGenfv)(GLenum coord, GLenum pname, GLfloat * params); /* 279 */ void (GLAPIENTRYP GetTexGeniv)(GLenum coord, GLenum pname, GLint * params); /* 280 */ void (GLAPIENTRYP GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels); /* 281 */ void (GLAPIENTRYP GetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 282 */ void (GLAPIENTRYP GetTexParameteriv)(GLenum target, GLenum pname, GLint * params); /* 283 */ void (GLAPIENTRYP GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params); /* 284 */ void (GLAPIENTRYP GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params); /* 285 */ GLboolean (GLAPIENTRYP IsEnabled)(GLenum cap); /* 286 */ GLboolean (GLAPIENTRYP IsList)(GLuint list); /* 287 */ void (GLAPIENTRYP DepthRange)(GLclampd zNear, GLclampd zFar); /* 288 */ void (GLAPIENTRYP Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 289 */ void (GLAPIENTRYP LoadIdentity)(void); /* 290 */ void (GLAPIENTRYP LoadMatrixf)(const GLfloat * m); /* 291 */ void (GLAPIENTRYP LoadMatrixd)(const GLdouble * m); /* 292 */ void (GLAPIENTRYP MatrixMode)(GLenum mode); /* 293 */ void (GLAPIENTRYP MultMatrixf)(const GLfloat * m); /* 294 */ void (GLAPIENTRYP MultMatrixd)(const GLdouble * m); /* 295 */ void (GLAPIENTRYP Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 296 */ void (GLAPIENTRYP PopMatrix)(void); /* 297 */ void (GLAPIENTRYP PushMatrix)(void); /* 298 */ void (GLAPIENTRYP Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); /* 299 */ void (GLAPIENTRYP Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); /* 300 */ void (GLAPIENTRYP Scaled)(GLdouble x, GLdouble y, GLdouble z); /* 301 */ void (GLAPIENTRYP Scalef)(GLfloat x, GLfloat y, GLfloat z); /* 302 */ void (GLAPIENTRYP Translated)(GLdouble x, GLdouble y, GLdouble z); /* 303 */ void (GLAPIENTRYP Translatef)(GLfloat x, GLfloat y, GLfloat z); /* 304 */ void (GLAPIENTRYP Viewport)(GLint x, GLint y, GLsizei width, GLsizei height); /* 305 */ void (GLAPIENTRYP ArrayElement)(GLint i); /* 306 */ void (GLAPIENTRYP BindTexture)(GLenum target, GLuint texture); /* 307 */ void (GLAPIENTRYP ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 308 */ void (GLAPIENTRYP DisableClientState)(GLenum array); /* 309 */ void (GLAPIENTRYP DrawArrays)(GLenum mode, GLint first, GLsizei count); /* 310 */ void (GLAPIENTRYP DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices); /* 311 */ void (GLAPIENTRYP EdgeFlagPointer)(GLsizei stride, const GLvoid * pointer); /* 312 */ void (GLAPIENTRYP EnableClientState)(GLenum array); /* 313 */ void (GLAPIENTRYP IndexPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 314 */ void (GLAPIENTRYP Indexub)(GLubyte c); /* 315 */ void (GLAPIENTRYP Indexubv)(const GLubyte * c); /* 316 */ void (GLAPIENTRYP InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid * pointer); /* 317 */ void (GLAPIENTRYP NormalPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 318 */ void (GLAPIENTRYP PolygonOffset)(GLfloat factor, GLfloat units); /* 319 */ void (GLAPIENTRYP TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 320 */ void (GLAPIENTRYP VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 321 */ GLboolean (GLAPIENTRYP AreTexturesResident)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 322 */ void (GLAPIENTRYP CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); /* 323 */ void (GLAPIENTRYP CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); /* 324 */ void (GLAPIENTRYP CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); /* 325 */ void (GLAPIENTRYP CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 326 */ void (GLAPIENTRYP DeleteTextures)(GLsizei n, const GLuint * textures); /* 327 */ void (GLAPIENTRYP GenTextures)(GLsizei n, GLuint * textures); /* 328 */ void (GLAPIENTRYP GetPointerv)(GLenum pname, GLvoid ** params); /* 329 */ GLboolean (GLAPIENTRYP IsTexture)(GLuint texture); /* 330 */ void (GLAPIENTRYP PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities); /* 331 */ void (GLAPIENTRYP TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels); /* 332 */ void (GLAPIENTRYP TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 333 */ void (GLAPIENTRYP PopClientAttrib)(void); /* 334 */ void (GLAPIENTRYP PushClientAttrib)(GLbitfield mask); /* 335 */ void (GLAPIENTRYP BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 336 */ void (GLAPIENTRYP BlendEquation)(GLenum mode); /* 337 */ void (GLAPIENTRYP DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices); /* 338 */ void (GLAPIENTRYP ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table); /* 339 */ void (GLAPIENTRYP ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 340 */ void (GLAPIENTRYP ColorTableParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 341 */ void (GLAPIENTRYP CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 342 */ void (GLAPIENTRYP GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 343 */ void (GLAPIENTRYP GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 344 */ void (GLAPIENTRYP GetColorTableParameteriv)(GLenum target, GLenum pname, GLint * params); /* 345 */ void (GLAPIENTRYP ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data); /* 346 */ void (GLAPIENTRYP CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); /* 347 */ void (GLAPIENTRYP ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image); /* 348 */ void (GLAPIENTRYP ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image); /* 349 */ void (GLAPIENTRYP ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params); /* 350 */ void (GLAPIENTRYP ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 351 */ void (GLAPIENTRYP ConvolutionParameteri)(GLenum target, GLenum pname, GLint params); /* 352 */ void (GLAPIENTRYP ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 353 */ void (GLAPIENTRYP CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 354 */ void (GLAPIENTRYP CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); /* 355 */ void (GLAPIENTRYP GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 356 */ void (GLAPIENTRYP GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 357 */ void (GLAPIENTRYP GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint * params); /* 358 */ void (GLAPIENTRYP GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 359 */ void (GLAPIENTRYP SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column); /* 360 */ void (GLAPIENTRYP GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 361 */ void (GLAPIENTRYP GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 362 */ void (GLAPIENTRYP GetHistogramParameteriv)(GLenum target, GLenum pname, GLint * params); /* 363 */ void (GLAPIENTRYP GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 364 */ void (GLAPIENTRYP GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 365 */ void (GLAPIENTRYP GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint * params); /* 366 */ void (GLAPIENTRYP Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); /* 367 */ void (GLAPIENTRYP Minmax)(GLenum target, GLenum internalformat, GLboolean sink); /* 368 */ void (GLAPIENTRYP ResetHistogram)(GLenum target); /* 369 */ void (GLAPIENTRYP ResetMinmax)(GLenum target); /* 370 */ void (GLAPIENTRYP TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 371 */ void (GLAPIENTRYP TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels); /* 372 */ void (GLAPIENTRYP CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 373 */ void (GLAPIENTRYP ActiveTextureARB)(GLenum texture); /* 374 */ void (GLAPIENTRYP ClientActiveTextureARB)(GLenum texture); /* 375 */ void (GLAPIENTRYP MultiTexCoord1dARB)(GLenum target, GLdouble s); /* 376 */ void (GLAPIENTRYP MultiTexCoord1dvARB)(GLenum target, const GLdouble * v); /* 377 */ void (GLAPIENTRYP MultiTexCoord1fARB)(GLenum target, GLfloat s); /* 378 */ void (GLAPIENTRYP MultiTexCoord1fvARB)(GLenum target, const GLfloat * v); /* 379 */ void (GLAPIENTRYP MultiTexCoord1iARB)(GLenum target, GLint s); /* 380 */ void (GLAPIENTRYP MultiTexCoord1ivARB)(GLenum target, const GLint * v); /* 381 */ void (GLAPIENTRYP MultiTexCoord1sARB)(GLenum target, GLshort s); /* 382 */ void (GLAPIENTRYP MultiTexCoord1svARB)(GLenum target, const GLshort * v); /* 383 */ void (GLAPIENTRYP MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t); /* 384 */ void (GLAPIENTRYP MultiTexCoord2dvARB)(GLenum target, const GLdouble * v); /* 385 */ void (GLAPIENTRYP MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t); /* 386 */ void (GLAPIENTRYP MultiTexCoord2fvARB)(GLenum target, const GLfloat * v); /* 387 */ void (GLAPIENTRYP MultiTexCoord2iARB)(GLenum target, GLint s, GLint t); /* 388 */ void (GLAPIENTRYP MultiTexCoord2ivARB)(GLenum target, const GLint * v); /* 389 */ void (GLAPIENTRYP MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t); /* 390 */ void (GLAPIENTRYP MultiTexCoord2svARB)(GLenum target, const GLshort * v); /* 391 */ void (GLAPIENTRYP MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r); /* 392 */ void (GLAPIENTRYP MultiTexCoord3dvARB)(GLenum target, const GLdouble * v); /* 393 */ void (GLAPIENTRYP MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r); /* 394 */ void (GLAPIENTRYP MultiTexCoord3fvARB)(GLenum target, const GLfloat * v); /* 395 */ void (GLAPIENTRYP MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r); /* 396 */ void (GLAPIENTRYP MultiTexCoord3ivARB)(GLenum target, const GLint * v); /* 397 */ void (GLAPIENTRYP MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r); /* 398 */ void (GLAPIENTRYP MultiTexCoord3svARB)(GLenum target, const GLshort * v); /* 399 */ void (GLAPIENTRYP MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 400 */ void (GLAPIENTRYP MultiTexCoord4dvARB)(GLenum target, const GLdouble * v); /* 401 */ void (GLAPIENTRYP MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 402 */ void (GLAPIENTRYP MultiTexCoord4fvARB)(GLenum target, const GLfloat * v); /* 403 */ void (GLAPIENTRYP MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q); /* 404 */ void (GLAPIENTRYP MultiTexCoord4ivARB)(GLenum target, const GLint * v); /* 405 */ void (GLAPIENTRYP MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); /* 406 */ void (GLAPIENTRYP MultiTexCoord4svARB)(GLenum target, const GLshort * v); /* 407 */ void (GLAPIENTRYP LoadTransposeMatrixfARB)(const GLfloat * m); /* 408 */ void (GLAPIENTRYP LoadTransposeMatrixdARB)(const GLdouble * m); /* 409 */ void (GLAPIENTRYP MultTransposeMatrixfARB)(const GLfloat * m); /* 410 */ void (GLAPIENTRYP MultTransposeMatrixdARB)(const GLdouble * m); /* 411 */ void (GLAPIENTRYP SampleCoverageARB)(GLclampf value, GLboolean invert); /* 412 */ void (GLAPIENTRYP DrawBuffersARB)(GLsizei n, const GLenum * bufs); /* 413 */ void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 414 */ void (GLAPIENTRYP GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat * weights); /* 415 */ void (GLAPIENTRYP TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat * weights); /* 416 */ void (GLAPIENTRYP GetHistogramEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 417 */ void (GLAPIENTRYP GetHistogramParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 418 */ void (GLAPIENTRYP GetHistogramParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 419 */ void (GLAPIENTRYP GetMinmaxEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 420 */ void (GLAPIENTRYP GetMinmaxParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 421 */ void (GLAPIENTRYP GetMinmaxParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 422 */ void (GLAPIENTRYP GetConvolutionFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 423 */ void (GLAPIENTRYP GetConvolutionParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 424 */ void (GLAPIENTRYP GetConvolutionParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 425 */ void (GLAPIENTRYP GetSeparableFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 426 */ void (GLAPIENTRYP GetColorTableSGI)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 427 */ void (GLAPIENTRYP GetColorTableParameterfvSGI)(GLenum target, GLenum pname, GLfloat * params); /* 428 */ void (GLAPIENTRYP GetColorTableParameterivSGI)(GLenum target, GLenum pname, GLint * params); /* 429 */ void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 430 */ void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 431 */ void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 432 */ void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 433 */ void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 434 */ void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 435 */ void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 436 */ void (GLAPIENTRYP TexImage4DSGIS)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 437 */ void (GLAPIENTRYP TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid * pixels); /* 438 */ GLboolean (GLAPIENTRYP AreTexturesResidentEXT)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 439 */ void (GLAPIENTRYP GenTexturesEXT)(GLsizei n, GLuint * textures); /* 440 */ GLboolean (GLAPIENTRYP IsTextureEXT)(GLuint texture); /* 441 */ void (GLAPIENTRYP DetailTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points); /* 442 */ void (GLAPIENTRYP GetDetailTexFuncSGIS)(GLenum target, GLfloat * points); /* 443 */ void (GLAPIENTRYP SharpenTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points); /* 444 */ void (GLAPIENTRYP GetSharpenTexFuncSGIS)(GLenum target, GLfloat * points); /* 445 */ void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 446 */ void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 447 */ void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 448 */ void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 449 */ void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 450 */ void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 451 */ void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 452 */ void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 453 */ void (GLAPIENTRYP SpriteParameterfSGIX)(GLenum pname, GLfloat param); /* 454 */ void (GLAPIENTRYP SpriteParameterfvSGIX)(GLenum pname, const GLfloat * params); /* 455 */ void (GLAPIENTRYP SpriteParameteriSGIX)(GLenum pname, GLint param); /* 456 */ void (GLAPIENTRYP SpriteParameterivSGIX)(GLenum pname, const GLint * params); /* 457 */ void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 458 */ void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 459 */ GLint (GLAPIENTRYP GetInstrumentsSGIX)(void); /* 460 */ void (GLAPIENTRYP InstrumentsBufferSGIX)(GLsizei size, GLint * buffer); /* 461 */ GLint (GLAPIENTRYP PollInstrumentsSGIX)(GLint * marker_p); /* 462 */ void (GLAPIENTRYP ReadInstrumentsSGIX)(GLint marker); /* 463 */ void (GLAPIENTRYP StartInstrumentsSGIX)(void); /* 464 */ void (GLAPIENTRYP StopInstrumentsSGIX)(GLint marker); /* 465 */ void (GLAPIENTRYP FrameZoomSGIX)(GLint factor); /* 466 */ void (GLAPIENTRYP TagSampleBufferSGIX)(void); /* 467 */ void (GLAPIENTRYP ReferencePlaneSGIX)(const GLdouble * equation); /* 468 */ void (GLAPIENTRYP FlushRasterSGIX)(void); /* 469 */ void (GLAPIENTRYP GetListParameterfvSGIX)(GLuint list, GLenum pname, GLfloat * params); /* 470 */ void (GLAPIENTRYP GetListParameterivSGIX)(GLuint list, GLenum pname, GLint * params); /* 471 */ void (GLAPIENTRYP ListParameterfSGIX)(GLuint list, GLenum pname, GLfloat param); /* 472 */ void (GLAPIENTRYP ListParameterfvSGIX)(GLuint list, GLenum pname, const GLfloat * params); /* 473 */ void (GLAPIENTRYP ListParameteriSGIX)(GLuint list, GLenum pname, GLint param); /* 474 */ void (GLAPIENTRYP ListParameterivSGIX)(GLuint list, GLenum pname, const GLint * params); /* 475 */ void (GLAPIENTRYP FragmentColorMaterialSGIX)(GLenum face, GLenum mode); /* 476 */ void (GLAPIENTRYP FragmentLightfSGIX)(GLenum light, GLenum pname, GLfloat param); /* 477 */ void (GLAPIENTRYP FragmentLightfvSGIX)(GLenum light, GLenum pname, const GLfloat * params); /* 478 */ void (GLAPIENTRYP FragmentLightiSGIX)(GLenum light, GLenum pname, GLint param); /* 479 */ void (GLAPIENTRYP FragmentLightivSGIX)(GLenum light, GLenum pname, const GLint * params); /* 480 */ void (GLAPIENTRYP FragmentLightModelfSGIX)(GLenum pname, GLfloat param); /* 481 */ void (GLAPIENTRYP FragmentLightModelfvSGIX)(GLenum pname, const GLfloat * params); /* 482 */ void (GLAPIENTRYP FragmentLightModeliSGIX)(GLenum pname, GLint param); /* 483 */ void (GLAPIENTRYP FragmentLightModelivSGIX)(GLenum pname, const GLint * params); /* 484 */ void (GLAPIENTRYP FragmentMaterialfSGIX)(GLenum face, GLenum pname, GLfloat param); /* 485 */ void (GLAPIENTRYP FragmentMaterialfvSGIX)(GLenum face, GLenum pname, const GLfloat * params); /* 486 */ void (GLAPIENTRYP FragmentMaterialiSGIX)(GLenum face, GLenum pname, GLint param); /* 487 */ void (GLAPIENTRYP FragmentMaterialivSGIX)(GLenum face, GLenum pname, const GLint * params); /* 488 */ void (GLAPIENTRYP GetFragmentLightfvSGIX)(GLenum light, GLenum pname, GLfloat * params); /* 489 */ void (GLAPIENTRYP GetFragmentLightivSGIX)(GLenum light, GLenum pname, GLint * params); /* 490 */ void (GLAPIENTRYP GetFragmentMaterialfvSGIX)(GLenum face, GLenum pname, GLfloat * params); /* 491 */ void (GLAPIENTRYP GetFragmentMaterialivSGIX)(GLenum face, GLenum pname, GLint * params); /* 492 */ void (GLAPIENTRYP LightEnviSGIX)(GLenum pname, GLint param); /* 493 */ void (GLAPIENTRYP VertexWeightfEXT)(GLfloat weight); /* 494 */ void (GLAPIENTRYP VertexWeightfvEXT)(const GLfloat * weight); /* 495 */ void (GLAPIENTRYP VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 496 */ void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 497 */ void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 498 */ void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 499 */ void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 500 */ void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 501 */ void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 502 */ void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 503 */ void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 504 */ void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 505 */ void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 506 */ void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 507 */ void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 508 */ void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 509 */ void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 510 */ void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 511 */ void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 512 */ void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 513 */ void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 514 */ void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 515 */ void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 516 */ void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 517 */ void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 518 */ void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 519 */ void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 520 */ void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 521 */ void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 522 */ void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 523 */ void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 524 */ void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 525 */ void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 526 */ void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 527 */ void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 528 */ void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 529 */ void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 530 */ void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 531 */ void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 532 */ void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 533 */ void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 534 */ void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 535 */ void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 536 */ void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 537 */ void (GLAPIENTRYP IndexMaterialEXT)(GLenum face, GLenum mode); /* 538 */ void (GLAPIENTRYP IndexFuncEXT)(GLenum func, GLclampf ref); /* 539 */ void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 540 */ void (GLAPIENTRYP UnlockArraysEXT)(void); /* 541 */ void (GLAPIENTRYP CullParameterdvEXT)(GLenum pname, GLdouble * params); /* 542 */ void (GLAPIENTRYP CullParameterfvEXT)(GLenum pname, GLfloat * params); /* 543 */ void (GLAPIENTRYP HintPGI)(GLenum target, GLint mode); /* 544 */ void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 545 */ void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 546 */ void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 547 */ void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 548 */ void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 549 */ void (GLAPIENTRYP GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid * data); /* 550 */ void (GLAPIENTRYP GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 551 */ void (GLAPIENTRYP GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 552 */ void (GLAPIENTRYP TbufferMask3DFX)(GLuint mask); /* 553 */ void (GLAPIENTRYP CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data); /* 554 */ void (GLAPIENTRYP CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data); /* 555 */ void (GLAPIENTRYP CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data); /* 556 */ void (GLAPIENTRYP CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data); /* 557 */ void (GLAPIENTRYP CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data); /* 558 */ void (GLAPIENTRYP CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data); /* 559 */ void (GLAPIENTRYP GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img); /* 560 */ void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 561 */ void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 562 */ void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 563 */ void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 564 */ void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 565 */ void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 566 */ void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 567 */ void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 568 */ void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 569 */ void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 570 */ void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 571 */ void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 572 */ void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 573 */ void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 574 */ void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 575 */ void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 576 */ void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 577 */ GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 578 */ void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 579 */ void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 580 */ void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 581 */ void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 582 */ void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 583 */ void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 584 */ void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 585 */ void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 586 */ void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 587 */ void (GLAPIENTRYP GetVertexAttribdvARB)(GLuint index, GLenum pname, GLdouble * params); /* 588 */ void (GLAPIENTRYP GetVertexAttribfvARB)(GLuint index, GLenum pname, GLfloat * params); /* 589 */ void (GLAPIENTRYP GetVertexAttribivARB)(GLuint index, GLenum pname, GLint * params); /* 590 */ void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** params); /* 591 */ GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 592 */ void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 593 */ void (GLAPIENTRYP ProgramParameter4dNV)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 594 */ void (GLAPIENTRYP ProgramParameter4dvNV)(GLenum target, GLuint index, const GLdouble * params); /* 595 */ void (GLAPIENTRYP ProgramParameter4fNV)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 596 */ void (GLAPIENTRYP ProgramParameter4fvNV)(GLenum target, GLuint index, const GLfloat * params); /* 597 */ void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 598 */ void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 599 */ void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 600 */ void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 601 */ void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 602 */ void (GLAPIENTRYP VertexAttrib1dARB)(GLuint index, GLdouble x); /* 603 */ void (GLAPIENTRYP VertexAttrib1dvARB)(GLuint index, const GLdouble * v); /* 604 */ void (GLAPIENTRYP VertexAttrib1fARB)(GLuint index, GLfloat x); /* 605 */ void (GLAPIENTRYP VertexAttrib1fvARB)(GLuint index, const GLfloat * v); /* 606 */ void (GLAPIENTRYP VertexAttrib1sARB)(GLuint index, GLshort x); /* 607 */ void (GLAPIENTRYP VertexAttrib1svARB)(GLuint index, const GLshort * v); /* 608 */ void (GLAPIENTRYP VertexAttrib2dARB)(GLuint index, GLdouble x, GLdouble y); /* 609 */ void (GLAPIENTRYP VertexAttrib2dvARB)(GLuint index, const GLdouble * v); /* 610 */ void (GLAPIENTRYP VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y); /* 611 */ void (GLAPIENTRYP VertexAttrib2fvARB)(GLuint index, const GLfloat * v); /* 612 */ void (GLAPIENTRYP VertexAttrib2sARB)(GLuint index, GLshort x, GLshort y); /* 613 */ void (GLAPIENTRYP VertexAttrib2svARB)(GLuint index, const GLshort * v); /* 614 */ void (GLAPIENTRYP VertexAttrib3dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 615 */ void (GLAPIENTRYP VertexAttrib3dvARB)(GLuint index, const GLdouble * v); /* 616 */ void (GLAPIENTRYP VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 617 */ void (GLAPIENTRYP VertexAttrib3fvARB)(GLuint index, const GLfloat * v); /* 618 */ void (GLAPIENTRYP VertexAttrib3sARB)(GLuint index, GLshort x, GLshort y, GLshort z); /* 619 */ void (GLAPIENTRYP VertexAttrib3svARB)(GLuint index, const GLshort * v); /* 620 */ void (GLAPIENTRYP VertexAttrib4dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 621 */ void (GLAPIENTRYP VertexAttrib4dvARB)(GLuint index, const GLdouble * v); /* 622 */ void (GLAPIENTRYP VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 623 */ void (GLAPIENTRYP VertexAttrib4fvARB)(GLuint index, const GLfloat * v); /* 624 */ void (GLAPIENTRYP VertexAttrib4sARB)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 625 */ void (GLAPIENTRYP VertexAttrib4svARB)(GLuint index, const GLshort * v); /* 626 */ void (GLAPIENTRYP VertexAttrib4NubARB)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 627 */ void (GLAPIENTRYP VertexAttrib4NubvARB)(GLuint index, const GLubyte * v); /* 628 */ void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 629 */ void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 630 */ void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 631 */ void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 632 */ void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 633 */ void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 634 */ void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 635 */ void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 636 */ void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 637 */ void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 638 */ void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 639 */ void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 640 */ void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 641 */ void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 642 */ void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 643 */ void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount); /* 644 */ void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 645 */ void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 646 */ void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 647 */ void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 648 */ GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 649 */ GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 650 */ void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 651 */ void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 652 */ void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 653 */ void (GLAPIENTRYP VertexAttrib4bvARB)(GLuint index, const GLbyte * v); /* 654 */ void (GLAPIENTRYP VertexAttrib4ivARB)(GLuint index, const GLint * v); /* 655 */ void (GLAPIENTRYP VertexAttrib4ubvARB)(GLuint index, const GLubyte * v); /* 656 */ void (GLAPIENTRYP VertexAttrib4usvARB)(GLuint index, const GLushort * v); /* 657 */ void (GLAPIENTRYP VertexAttrib4uivARB)(GLuint index, const GLuint * v); /* 658 */ void (GLAPIENTRYP VertexAttrib4NbvARB)(GLuint index, const GLbyte * v); /* 659 */ void (GLAPIENTRYP VertexAttrib4NsvARB)(GLuint index, const GLshort * v); /* 660 */ void (GLAPIENTRYP VertexAttrib4NivARB)(GLuint index, const GLint * v); /* 661 */ void (GLAPIENTRYP VertexAttrib4NusvARB)(GLuint index, const GLushort * v); /* 662 */ void (GLAPIENTRYP VertexAttrib4NuivARB)(GLuint index, const GLuint * v); /* 663 */ void (GLAPIENTRYP VertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer); /* 664 */ void (GLAPIENTRYP EnableVertexAttribArrayARB)(GLuint index); /* 665 */ void (GLAPIENTRYP DisableVertexAttribArrayARB)(GLuint index); /* 666 */ void (GLAPIENTRYP ProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid * string); /* 667 */ void (GLAPIENTRYP ProgramEnvParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 668 */ void (GLAPIENTRYP ProgramEnvParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 669 */ void (GLAPIENTRYP ProgramEnvParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 670 */ void (GLAPIENTRYP ProgramEnvParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 671 */ void (GLAPIENTRYP ProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 672 */ void (GLAPIENTRYP ProgramLocalParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 673 */ void (GLAPIENTRYP ProgramLocalParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 674 */ void (GLAPIENTRYP ProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 675 */ void (GLAPIENTRYP GetProgramEnvParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 676 */ void (GLAPIENTRYP GetProgramEnvParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 677 */ void (GLAPIENTRYP GetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 678 */ void (GLAPIENTRYP GetProgramLocalParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 679 */ void (GLAPIENTRYP GetProgramivARB)(GLenum target, GLenum pname, GLint * params); /* 680 */ void (GLAPIENTRYP GetProgramStringARB)(GLenum target, GLenum pname, GLvoid * string); /* 681 */ void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 682 */ void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 683 */ void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 684 */ void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 685 */ void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 686 */ void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 687 */ void (GLAPIENTRYP BindBufferARB)(GLenum target, GLuint buffer); /* 688 */ void (GLAPIENTRYP BufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); /* 689 */ void (GLAPIENTRYP BufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); /* 690 */ void (GLAPIENTRYP DeleteBuffersARB)(GLsizei n, const GLuint * buffer); /* 691 */ void (GLAPIENTRYP GenBuffersARB)(GLsizei n, GLuint * buffer); /* 692 */ void (GLAPIENTRYP GetBufferParameterivARB)(GLenum target, GLenum pname, GLint * params); /* 693 */ void (GLAPIENTRYP GetBufferPointervARB)(GLenum target, GLenum pname, GLvoid ** params); /* 694 */ void (GLAPIENTRYP GetBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data); /* 695 */ GLboolean (GLAPIENTRYP IsBufferARB)(GLuint buffer); /* 696 */ GLvoid * (GLAPIENTRYP MapBufferARB)(GLenum target, GLenum access); /* 697 */ GLboolean (GLAPIENTRYP UnmapBufferARB)(GLenum target); /* 698 */ void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 699 */ void (GLAPIENTRYP GenQueriesARB)(GLsizei n, GLuint * ids); /* 700 */ void (GLAPIENTRYP DeleteQueriesARB)(GLsizei n, const GLuint * ids); /* 701 */ GLboolean (GLAPIENTRYP IsQueryARB)(GLuint id); /* 702 */ void (GLAPIENTRYP BeginQueryARB)(GLenum target, GLuint id); /* 703 */ void (GLAPIENTRYP EndQueryARB)(GLenum target); /* 704 */ void (GLAPIENTRYP GetQueryivARB)(GLenum target, GLenum pname, GLint * params); /* 705 */ void (GLAPIENTRYP GetQueryObjectivARB)(GLuint id, GLenum pname, GLint * params); /* 706 */ void (GLAPIENTRYP GetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint * params); /* 707 */ void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 708 */ void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 709 */ void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 710 */ void (GLAPIENTRYP DeleteObjectARB)(GLhandleARB obj); /* 711 */ GLhandleARB (GLAPIENTRYP GetHandleARB)(GLenum pname); /* 712 */ void (GLAPIENTRYP DetachObjectARB)(GLhandleARB containerObj, GLhandleARB attachedObj); /* 713 */ GLhandleARB (GLAPIENTRYP CreateShaderObjectARB)(GLenum shaderType); /* 714 */ void (GLAPIENTRYP ShaderSourceARB)(GLhandleARB shaderObj, GLsizei count, const GLcharARB ** string, const GLint * length); /* 715 */ void (GLAPIENTRYP CompileShaderARB)(GLhandleARB shaderObj); /* 716 */ GLhandleARB (GLAPIENTRYP CreateProgramObjectARB)(void); /* 717 */ void (GLAPIENTRYP AttachObjectARB)(GLhandleARB containerObj, GLhandleARB obj); /* 718 */ void (GLAPIENTRYP LinkProgramARB)(GLhandleARB programObj); /* 719 */ void (GLAPIENTRYP UseProgramObjectARB)(GLhandleARB programObj); /* 720 */ void (GLAPIENTRYP ValidateProgramARB)(GLhandleARB programObj); /* 721 */ void (GLAPIENTRYP Uniform1fARB)(GLint location, GLfloat v0); /* 722 */ void (GLAPIENTRYP Uniform2fARB)(GLint location, GLfloat v0, GLfloat v1); /* 723 */ void (GLAPIENTRYP Uniform3fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); /* 724 */ void (GLAPIENTRYP Uniform4fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); /* 725 */ void (GLAPIENTRYP Uniform1iARB)(GLint location, GLint v0); /* 726 */ void (GLAPIENTRYP Uniform2iARB)(GLint location, GLint v0, GLint v1); /* 727 */ void (GLAPIENTRYP Uniform3iARB)(GLint location, GLint v0, GLint v1, GLint v2); /* 728 */ void (GLAPIENTRYP Uniform4iARB)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); /* 729 */ void (GLAPIENTRYP Uniform1fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 730 */ void (GLAPIENTRYP Uniform2fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 731 */ void (GLAPIENTRYP Uniform3fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 732 */ void (GLAPIENTRYP Uniform4fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 733 */ void (GLAPIENTRYP Uniform1ivARB)(GLint location, GLsizei count, const GLint * value); /* 734 */ void (GLAPIENTRYP Uniform2ivARB)(GLint location, GLsizei count, const GLint * value); /* 735 */ void (GLAPIENTRYP Uniform3ivARB)(GLint location, GLsizei count, const GLint * value); /* 736 */ void (GLAPIENTRYP Uniform4ivARB)(GLint location, GLsizei count, const GLint * value); /* 737 */ void (GLAPIENTRYP UniformMatrix2fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 738 */ void (GLAPIENTRYP UniformMatrix3fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 739 */ void (GLAPIENTRYP UniformMatrix4fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 740 */ void (GLAPIENTRYP GetObjectParameterfvARB)(GLhandleARB obj, GLenum pname, GLfloat * params); /* 741 */ void (GLAPIENTRYP GetObjectParameterivARB)(GLhandleARB obj, GLenum pname, GLint * params); /* 742 */ void (GLAPIENTRYP GetInfoLogARB)(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog); /* 743 */ void (GLAPIENTRYP GetAttachedObjectsARB)(GLhandleARB containerObj, GLsizei maxLength, GLsizei * length, GLhandleARB * infoLog); /* 744 */ GLint (GLAPIENTRYP GetUniformLocationARB)(GLhandleARB programObj, const GLcharARB * name); /* 745 */ void (GLAPIENTRYP GetActiveUniformARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name); /* 746 */ void (GLAPIENTRYP GetUniformfvARB)(GLhandleARB programObj, GLint location, GLfloat * params); /* 747 */ void (GLAPIENTRYP GetUniformivARB)(GLhandleARB programObj, GLint location, GLint * params); /* 748 */ void (GLAPIENTRYP GetShaderSourceARB)(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * source); /* 749 */ void (GLAPIENTRYP BindAttribLocationARB)(GLhandleARB programObj, GLuint index, const GLcharARB * name); /* 750 */ void (GLAPIENTRYP GetActiveAttribARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name); /* 751 */ GLint (GLAPIENTRYP GetAttribLocationARB)(GLhandleARB programObj, const GLcharARB * name); /* 752 */ void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 753 */ void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 754 */ void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 755 */ void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 756 */ void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 757 */ void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 758 */ void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 759 */ void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 760 */ void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 761 */ void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 762 */ void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 763 */ void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 764 */ void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 765 */ void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 766 */ void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 767 */ void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 768 */ void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 769 */ void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 770 */ void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 771 */ void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 772 */ void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 773 */ void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 774 */ void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 775 */ void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 776 */ void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 777 */ void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 778 */ void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 779 */ void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 780 */ void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 781 */ GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 782 */ void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 783 */ void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 784 */ void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 785 */ void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 786 */ void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 787 */ void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 788 */ void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 789 */ void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 790 */ void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 791 */ void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 792 */ void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 793 */ void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 794 */ void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 795 */ GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 796 */ void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 797 */ void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 798 */ void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 799 */ void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 800 */ void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 801 */ GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 802 */ void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 803 */ void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 804 */ void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 805 */ GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 806 */ void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 807 */ void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 808 */ void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 809 */ void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 810 */ void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 811 */ void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 812 */ void (GLAPIENTRYP StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); /* 813 */ void (GLAPIENTRYP StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); /* 814 */ void (GLAPIENTRYP StencilMaskSeparate)(GLenum face, GLuint mask); /* 815 */ }; #endif /* !defined( _GLAPI_TABLE_H_ ) */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/glapi/glapitemp.h0000644000000000000000000074516713614532424020470 0ustar /* DO NOT EDIT - This file generated automatically by gl_apitemp.py (from Mesa) script */ /* * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * (C) Copyright IBM Corporation 2004 * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sub license, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL, IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * This file is a template which generates the OpenGL API entry point * functions. It should be included by a .c file which first defines * the following macros: * KEYWORD1 - usually nothing, but might be __declspec(dllexport) on Win32 * KEYWORD2 - usually nothing, but might be __stdcall on Win32 * NAME(n) - builds the final function name (usually add "gl" prefix) * DISPATCH(func, args, msg) - code to do dispatch of named function. * msg is a printf-style debug message. * RETURN_DISPATCH(func, args, msg) - code to do dispatch with a return value * * Here is an example which generates the usual OpenGL functions: * #define KEYWORD1 * #define KEYWORD2 * #define NAME(func) gl##func * #define DISPATCH(func, args, msg) \ * struct _glapi_table *dispatch = CurrentDispatch; \ * (*dispatch->func) args * #define RETURN DISPATCH(func, args, msg) \ * struct _glapi_table *dispatch = CurrentDispatch; \ * return (*dispatch->func) args * */ #if defined( NAME ) #ifndef KEYWORD1 #define KEYWORD1 #endif #ifndef KEYWORD2 #define KEYWORD2 #endif #ifndef DISPATCH #error DISPATCH must be defined #endif #ifndef RETURN_DISPATCH #error RETURN_DISPATCH must be defined #endif KEYWORD1 void KEYWORD2 NAME(NewList)(GLuint list, GLenum mode) { DISPATCH(NewList, (list, mode), (F, "glNewList(%d, 0x%x);\n", list, mode)); } KEYWORD1 void KEYWORD2 NAME(EndList)(void) { DISPATCH(EndList, (), (F, "glEndList();\n")); } KEYWORD1 void KEYWORD2 NAME(CallList)(GLuint list) { DISPATCH(CallList, (list), (F, "glCallList(%d);\n", list)); } KEYWORD1 void KEYWORD2 NAME(CallLists)(GLsizei n, GLenum type, const GLvoid * lists) { DISPATCH(CallLists, (n, type, lists), (F, "glCallLists(%d, 0x%x, %p);\n", n, type, (const void *) lists)); } KEYWORD1 void KEYWORD2 NAME(DeleteLists)(GLuint list, GLsizei range) { DISPATCH(DeleteLists, (list, range), (F, "glDeleteLists(%d, %d);\n", list, range)); } KEYWORD1 GLuint KEYWORD2 NAME(GenLists)(GLsizei range) { RETURN_DISPATCH(GenLists, (range), (F, "glGenLists(%d);\n", range)); } KEYWORD1 void KEYWORD2 NAME(ListBase)(GLuint base) { DISPATCH(ListBase, (base), (F, "glListBase(%d);\n", base)); } KEYWORD1 void KEYWORD2 NAME(Begin)(GLenum mode) { DISPATCH(Begin, (mode), (F, "glBegin(0x%x);\n", mode)); } KEYWORD1 void KEYWORD2 NAME(Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap) { DISPATCH(Bitmap, (width, height, xorig, yorig, xmove, ymove, bitmap), (F, "glBitmap(%d, %d, %f, %f, %f, %f, %p);\n", width, height, xorig, yorig, xmove, ymove, (const void *) bitmap)); } KEYWORD1 void KEYWORD2 NAME(Color3b)(GLbyte red, GLbyte green, GLbyte blue) { DISPATCH(Color3b, (red, green, blue), (F, "glColor3b(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(Color3bv)(const GLbyte * v) { DISPATCH(Color3bv, (v), (F, "glColor3bv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color3d)(GLdouble red, GLdouble green, GLdouble blue) { DISPATCH(Color3d, (red, green, blue), (F, "glColor3d(%f, %f, %f);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(Color3dv)(const GLdouble * v) { DISPATCH(Color3dv, (v), (F, "glColor3dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color3f)(GLfloat red, GLfloat green, GLfloat blue) { DISPATCH(Color3f, (red, green, blue), (F, "glColor3f(%f, %f, %f);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(Color3fv)(const GLfloat * v) { DISPATCH(Color3fv, (v), (F, "glColor3fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color3i)(GLint red, GLint green, GLint blue) { DISPATCH(Color3i, (red, green, blue), (F, "glColor3i(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(Color3iv)(const GLint * v) { DISPATCH(Color3iv, (v), (F, "glColor3iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color3s)(GLshort red, GLshort green, GLshort blue) { DISPATCH(Color3s, (red, green, blue), (F, "glColor3s(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(Color3sv)(const GLshort * v) { DISPATCH(Color3sv, (v), (F, "glColor3sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color3ub)(GLubyte red, GLubyte green, GLubyte blue) { DISPATCH(Color3ub, (red, green, blue), (F, "glColor3ub(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(Color3ubv)(const GLubyte * v) { DISPATCH(Color3ubv, (v), (F, "glColor3ubv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color3ui)(GLuint red, GLuint green, GLuint blue) { DISPATCH(Color3ui, (red, green, blue), (F, "glColor3ui(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(Color3uiv)(const GLuint * v) { DISPATCH(Color3uiv, (v), (F, "glColor3uiv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color3us)(GLushort red, GLushort green, GLushort blue) { DISPATCH(Color3us, (red, green, blue), (F, "glColor3us(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(Color3usv)(const GLushort * v) { DISPATCH(Color3usv, (v), (F, "glColor3usv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha) { DISPATCH(Color4b, (red, green, blue, alpha), (F, "glColor4b(%d, %d, %d, %d);\n", red, green, blue, alpha)); } KEYWORD1 void KEYWORD2 NAME(Color4bv)(const GLbyte * v) { DISPATCH(Color4bv, (v), (F, "glColor4bv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) { DISPATCH(Color4d, (red, green, blue, alpha), (F, "glColor4d(%f, %f, %f, %f);\n", red, green, blue, alpha)); } KEYWORD1 void KEYWORD2 NAME(Color4dv)(const GLdouble * v) { DISPATCH(Color4dv, (v), (F, "glColor4dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { DISPATCH(Color4f, (red, green, blue, alpha), (F, "glColor4f(%f, %f, %f, %f);\n", red, green, blue, alpha)); } KEYWORD1 void KEYWORD2 NAME(Color4fv)(const GLfloat * v) { DISPATCH(Color4fv, (v), (F, "glColor4fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color4i)(GLint red, GLint green, GLint blue, GLint alpha) { DISPATCH(Color4i, (red, green, blue, alpha), (F, "glColor4i(%d, %d, %d, %d);\n", red, green, blue, alpha)); } KEYWORD1 void KEYWORD2 NAME(Color4iv)(const GLint * v) { DISPATCH(Color4iv, (v), (F, "glColor4iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha) { DISPATCH(Color4s, (red, green, blue, alpha), (F, "glColor4s(%d, %d, %d, %d);\n", red, green, blue, alpha)); } KEYWORD1 void KEYWORD2 NAME(Color4sv)(const GLshort * v) { DISPATCH(Color4sv, (v), (F, "glColor4sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { DISPATCH(Color4ub, (red, green, blue, alpha), (F, "glColor4ub(%d, %d, %d, %d);\n", red, green, blue, alpha)); } KEYWORD1 void KEYWORD2 NAME(Color4ubv)(const GLubyte * v) { DISPATCH(Color4ubv, (v), (F, "glColor4ubv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha) { DISPATCH(Color4ui, (red, green, blue, alpha), (F, "glColor4ui(%d, %d, %d, %d);\n", red, green, blue, alpha)); } KEYWORD1 void KEYWORD2 NAME(Color4uiv)(const GLuint * v) { DISPATCH(Color4uiv, (v), (F, "glColor4uiv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha) { DISPATCH(Color4us, (red, green, blue, alpha), (F, "glColor4us(%d, %d, %d, %d);\n", red, green, blue, alpha)); } KEYWORD1 void KEYWORD2 NAME(Color4usv)(const GLushort * v) { DISPATCH(Color4usv, (v), (F, "glColor4usv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(EdgeFlag)(GLboolean flag) { DISPATCH(EdgeFlag, (flag), (F, "glEdgeFlag(%d);\n", flag)); } KEYWORD1 void KEYWORD2 NAME(EdgeFlagv)(const GLboolean * flag) { DISPATCH(EdgeFlagv, (flag), (F, "glEdgeFlagv(%p);\n", (const void *) flag)); } KEYWORD1 void KEYWORD2 NAME(End)(void) { DISPATCH(End, (), (F, "glEnd();\n")); } KEYWORD1 void KEYWORD2 NAME(Indexd)(GLdouble c) { DISPATCH(Indexd, (c), (F, "glIndexd(%f);\n", c)); } KEYWORD1 void KEYWORD2 NAME(Indexdv)(const GLdouble * c) { DISPATCH(Indexdv, (c), (F, "glIndexdv(%p);\n", (const void *) c)); } KEYWORD1 void KEYWORD2 NAME(Indexf)(GLfloat c) { DISPATCH(Indexf, (c), (F, "glIndexf(%f);\n", c)); } KEYWORD1 void KEYWORD2 NAME(Indexfv)(const GLfloat * c) { DISPATCH(Indexfv, (c), (F, "glIndexfv(%p);\n", (const void *) c)); } KEYWORD1 void KEYWORD2 NAME(Indexi)(GLint c) { DISPATCH(Indexi, (c), (F, "glIndexi(%d);\n", c)); } KEYWORD1 void KEYWORD2 NAME(Indexiv)(const GLint * c) { DISPATCH(Indexiv, (c), (F, "glIndexiv(%p);\n", (const void *) c)); } KEYWORD1 void KEYWORD2 NAME(Indexs)(GLshort c) { DISPATCH(Indexs, (c), (F, "glIndexs(%d);\n", c)); } KEYWORD1 void KEYWORD2 NAME(Indexsv)(const GLshort * c) { DISPATCH(Indexsv, (c), (F, "glIndexsv(%p);\n", (const void *) c)); } KEYWORD1 void KEYWORD2 NAME(Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz) { DISPATCH(Normal3b, (nx, ny, nz), (F, "glNormal3b(%d, %d, %d);\n", nx, ny, nz)); } KEYWORD1 void KEYWORD2 NAME(Normal3bv)(const GLbyte * v) { DISPATCH(Normal3bv, (v), (F, "glNormal3bv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz) { DISPATCH(Normal3d, (nx, ny, nz), (F, "glNormal3d(%f, %f, %f);\n", nx, ny, nz)); } KEYWORD1 void KEYWORD2 NAME(Normal3dv)(const GLdouble * v) { DISPATCH(Normal3dv, (v), (F, "glNormal3dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz) { DISPATCH(Normal3f, (nx, ny, nz), (F, "glNormal3f(%f, %f, %f);\n", nx, ny, nz)); } KEYWORD1 void KEYWORD2 NAME(Normal3fv)(const GLfloat * v) { DISPATCH(Normal3fv, (v), (F, "glNormal3fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Normal3i)(GLint nx, GLint ny, GLint nz) { DISPATCH(Normal3i, (nx, ny, nz), (F, "glNormal3i(%d, %d, %d);\n", nx, ny, nz)); } KEYWORD1 void KEYWORD2 NAME(Normal3iv)(const GLint * v) { DISPATCH(Normal3iv, (v), (F, "glNormal3iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Normal3s)(GLshort nx, GLshort ny, GLshort nz) { DISPATCH(Normal3s, (nx, ny, nz), (F, "glNormal3s(%d, %d, %d);\n", nx, ny, nz)); } KEYWORD1 void KEYWORD2 NAME(Normal3sv)(const GLshort * v) { DISPATCH(Normal3sv, (v), (F, "glNormal3sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(RasterPos2d)(GLdouble x, GLdouble y) { DISPATCH(RasterPos2d, (x, y), (F, "glRasterPos2d(%f, %f);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(RasterPos2dv)(const GLdouble * v) { DISPATCH(RasterPos2dv, (v), (F, "glRasterPos2dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(RasterPos2f)(GLfloat x, GLfloat y) { DISPATCH(RasterPos2f, (x, y), (F, "glRasterPos2f(%f, %f);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(RasterPos2fv)(const GLfloat * v) { DISPATCH(RasterPos2fv, (v), (F, "glRasterPos2fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(RasterPos2i)(GLint x, GLint y) { DISPATCH(RasterPos2i, (x, y), (F, "glRasterPos2i(%d, %d);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(RasterPos2iv)(const GLint * v) { DISPATCH(RasterPos2iv, (v), (F, "glRasterPos2iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(RasterPos2s)(GLshort x, GLshort y) { DISPATCH(RasterPos2s, (x, y), (F, "glRasterPos2s(%d, %d);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(RasterPos2sv)(const GLshort * v) { DISPATCH(RasterPos2sv, (v), (F, "glRasterPos2sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(RasterPos3d)(GLdouble x, GLdouble y, GLdouble z) { DISPATCH(RasterPos3d, (x, y, z), (F, "glRasterPos3d(%f, %f, %f);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(RasterPos3dv)(const GLdouble * v) { DISPATCH(RasterPos3dv, (v), (F, "glRasterPos3dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(RasterPos3f)(GLfloat x, GLfloat y, GLfloat z) { DISPATCH(RasterPos3f, (x, y, z), (F, "glRasterPos3f(%f, %f, %f);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(RasterPos3fv)(const GLfloat * v) { DISPATCH(RasterPos3fv, (v), (F, "glRasterPos3fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(RasterPos3i)(GLint x, GLint y, GLint z) { DISPATCH(RasterPos3i, (x, y, z), (F, "glRasterPos3i(%d, %d, %d);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(RasterPos3iv)(const GLint * v) { DISPATCH(RasterPos3iv, (v), (F, "glRasterPos3iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(RasterPos3s)(GLshort x, GLshort y, GLshort z) { DISPATCH(RasterPos3s, (x, y, z), (F, "glRasterPos3s(%d, %d, %d);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(RasterPos3sv)(const GLshort * v) { DISPATCH(RasterPos3sv, (v), (F, "glRasterPos3sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { DISPATCH(RasterPos4d, (x, y, z, w), (F, "glRasterPos4d(%f, %f, %f, %f);\n", x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(RasterPos4dv)(const GLdouble * v) { DISPATCH(RasterPos4dv, (v), (F, "glRasterPos4dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { DISPATCH(RasterPos4f, (x, y, z, w), (F, "glRasterPos4f(%f, %f, %f, %f);\n", x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(RasterPos4fv)(const GLfloat * v) { DISPATCH(RasterPos4fv, (v), (F, "glRasterPos4fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(RasterPos4i)(GLint x, GLint y, GLint z, GLint w) { DISPATCH(RasterPos4i, (x, y, z, w), (F, "glRasterPos4i(%d, %d, %d, %d);\n", x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(RasterPos4iv)(const GLint * v) { DISPATCH(RasterPos4iv, (v), (F, "glRasterPos4iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w) { DISPATCH(RasterPos4s, (x, y, z, w), (F, "glRasterPos4s(%d, %d, %d, %d);\n", x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(RasterPos4sv)(const GLshort * v) { DISPATCH(RasterPos4sv, (v), (F, "glRasterPos4sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) { DISPATCH(Rectd, (x1, y1, x2, y2), (F, "glRectd(%f, %f, %f, %f);\n", x1, y1, x2, y2)); } KEYWORD1 void KEYWORD2 NAME(Rectdv)(const GLdouble * v1, const GLdouble * v2) { DISPATCH(Rectdv, (v1, v2), (F, "glRectdv(%p, %p);\n", (const void *) v1, (const void *) v2)); } KEYWORD1 void KEYWORD2 NAME(Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) { DISPATCH(Rectf, (x1, y1, x2, y2), (F, "glRectf(%f, %f, %f, %f);\n", x1, y1, x2, y2)); } KEYWORD1 void KEYWORD2 NAME(Rectfv)(const GLfloat * v1, const GLfloat * v2) { DISPATCH(Rectfv, (v1, v2), (F, "glRectfv(%p, %p);\n", (const void *) v1, (const void *) v2)); } KEYWORD1 void KEYWORD2 NAME(Recti)(GLint x1, GLint y1, GLint x2, GLint y2) { DISPATCH(Recti, (x1, y1, x2, y2), (F, "glRecti(%d, %d, %d, %d);\n", x1, y1, x2, y2)); } KEYWORD1 void KEYWORD2 NAME(Rectiv)(const GLint * v1, const GLint * v2) { DISPATCH(Rectiv, (v1, v2), (F, "glRectiv(%p, %p);\n", (const void *) v1, (const void *) v2)); } KEYWORD1 void KEYWORD2 NAME(Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2) { DISPATCH(Rects, (x1, y1, x2, y2), (F, "glRects(%d, %d, %d, %d);\n", x1, y1, x2, y2)); } KEYWORD1 void KEYWORD2 NAME(Rectsv)(const GLshort * v1, const GLshort * v2) { DISPATCH(Rectsv, (v1, v2), (F, "glRectsv(%p, %p);\n", (const void *) v1, (const void *) v2)); } KEYWORD1 void KEYWORD2 NAME(TexCoord1d)(GLdouble s) { DISPATCH(TexCoord1d, (s), (F, "glTexCoord1d(%f);\n", s)); } KEYWORD1 void KEYWORD2 NAME(TexCoord1dv)(const GLdouble * v) { DISPATCH(TexCoord1dv, (v), (F, "glTexCoord1dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord1f)(GLfloat s) { DISPATCH(TexCoord1f, (s), (F, "glTexCoord1f(%f);\n", s)); } KEYWORD1 void KEYWORD2 NAME(TexCoord1fv)(const GLfloat * v) { DISPATCH(TexCoord1fv, (v), (F, "glTexCoord1fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord1i)(GLint s) { DISPATCH(TexCoord1i, (s), (F, "glTexCoord1i(%d);\n", s)); } KEYWORD1 void KEYWORD2 NAME(TexCoord1iv)(const GLint * v) { DISPATCH(TexCoord1iv, (v), (F, "glTexCoord1iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord1s)(GLshort s) { DISPATCH(TexCoord1s, (s), (F, "glTexCoord1s(%d);\n", s)); } KEYWORD1 void KEYWORD2 NAME(TexCoord1sv)(const GLshort * v) { DISPATCH(TexCoord1sv, (v), (F, "glTexCoord1sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord2d)(GLdouble s, GLdouble t) { DISPATCH(TexCoord2d, (s, t), (F, "glTexCoord2d(%f, %f);\n", s, t)); } KEYWORD1 void KEYWORD2 NAME(TexCoord2dv)(const GLdouble * v) { DISPATCH(TexCoord2dv, (v), (F, "glTexCoord2dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord2f)(GLfloat s, GLfloat t) { DISPATCH(TexCoord2f, (s, t), (F, "glTexCoord2f(%f, %f);\n", s, t)); } KEYWORD1 void KEYWORD2 NAME(TexCoord2fv)(const GLfloat * v) { DISPATCH(TexCoord2fv, (v), (F, "glTexCoord2fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord2i)(GLint s, GLint t) { DISPATCH(TexCoord2i, (s, t), (F, "glTexCoord2i(%d, %d);\n", s, t)); } KEYWORD1 void KEYWORD2 NAME(TexCoord2iv)(const GLint * v) { DISPATCH(TexCoord2iv, (v), (F, "glTexCoord2iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord2s)(GLshort s, GLshort t) { DISPATCH(TexCoord2s, (s, t), (F, "glTexCoord2s(%d, %d);\n", s, t)); } KEYWORD1 void KEYWORD2 NAME(TexCoord2sv)(const GLshort * v) { DISPATCH(TexCoord2sv, (v), (F, "glTexCoord2sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord3d)(GLdouble s, GLdouble t, GLdouble r) { DISPATCH(TexCoord3d, (s, t, r), (F, "glTexCoord3d(%f, %f, %f);\n", s, t, r)); } KEYWORD1 void KEYWORD2 NAME(TexCoord3dv)(const GLdouble * v) { DISPATCH(TexCoord3dv, (v), (F, "glTexCoord3dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord3f)(GLfloat s, GLfloat t, GLfloat r) { DISPATCH(TexCoord3f, (s, t, r), (F, "glTexCoord3f(%f, %f, %f);\n", s, t, r)); } KEYWORD1 void KEYWORD2 NAME(TexCoord3fv)(const GLfloat * v) { DISPATCH(TexCoord3fv, (v), (F, "glTexCoord3fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord3i)(GLint s, GLint t, GLint r) { DISPATCH(TexCoord3i, (s, t, r), (F, "glTexCoord3i(%d, %d, %d);\n", s, t, r)); } KEYWORD1 void KEYWORD2 NAME(TexCoord3iv)(const GLint * v) { DISPATCH(TexCoord3iv, (v), (F, "glTexCoord3iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord3s)(GLshort s, GLshort t, GLshort r) { DISPATCH(TexCoord3s, (s, t, r), (F, "glTexCoord3s(%d, %d, %d);\n", s, t, r)); } KEYWORD1 void KEYWORD2 NAME(TexCoord3sv)(const GLshort * v) { DISPATCH(TexCoord3sv, (v), (F, "glTexCoord3sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q) { DISPATCH(TexCoord4d, (s, t, r, q), (F, "glTexCoord4d(%f, %f, %f, %f);\n", s, t, r, q)); } KEYWORD1 void KEYWORD2 NAME(TexCoord4dv)(const GLdouble * v) { DISPATCH(TexCoord4dv, (v), (F, "glTexCoord4dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q) { DISPATCH(TexCoord4f, (s, t, r, q), (F, "glTexCoord4f(%f, %f, %f, %f);\n", s, t, r, q)); } KEYWORD1 void KEYWORD2 NAME(TexCoord4fv)(const GLfloat * v) { DISPATCH(TexCoord4fv, (v), (F, "glTexCoord4fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord4i)(GLint s, GLint t, GLint r, GLint q) { DISPATCH(TexCoord4i, (s, t, r, q), (F, "glTexCoord4i(%d, %d, %d, %d);\n", s, t, r, q)); } KEYWORD1 void KEYWORD2 NAME(TexCoord4iv)(const GLint * v) { DISPATCH(TexCoord4iv, (v), (F, "glTexCoord4iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q) { DISPATCH(TexCoord4s, (s, t, r, q), (F, "glTexCoord4s(%d, %d, %d, %d);\n", s, t, r, q)); } KEYWORD1 void KEYWORD2 NAME(TexCoord4sv)(const GLshort * v) { DISPATCH(TexCoord4sv, (v), (F, "glTexCoord4sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Vertex2d)(GLdouble x, GLdouble y) { DISPATCH(Vertex2d, (x, y), (F, "glVertex2d(%f, %f);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(Vertex2dv)(const GLdouble * v) { DISPATCH(Vertex2dv, (v), (F, "glVertex2dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Vertex2f)(GLfloat x, GLfloat y) { DISPATCH(Vertex2f, (x, y), (F, "glVertex2f(%f, %f);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(Vertex2fv)(const GLfloat * v) { DISPATCH(Vertex2fv, (v), (F, "glVertex2fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Vertex2i)(GLint x, GLint y) { DISPATCH(Vertex2i, (x, y), (F, "glVertex2i(%d, %d);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(Vertex2iv)(const GLint * v) { DISPATCH(Vertex2iv, (v), (F, "glVertex2iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Vertex2s)(GLshort x, GLshort y) { DISPATCH(Vertex2s, (x, y), (F, "glVertex2s(%d, %d);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(Vertex2sv)(const GLshort * v) { DISPATCH(Vertex2sv, (v), (F, "glVertex2sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Vertex3d)(GLdouble x, GLdouble y, GLdouble z) { DISPATCH(Vertex3d, (x, y, z), (F, "glVertex3d(%f, %f, %f);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(Vertex3dv)(const GLdouble * v) { DISPATCH(Vertex3dv, (v), (F, "glVertex3dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Vertex3f)(GLfloat x, GLfloat y, GLfloat z) { DISPATCH(Vertex3f, (x, y, z), (F, "glVertex3f(%f, %f, %f);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(Vertex3fv)(const GLfloat * v) { DISPATCH(Vertex3fv, (v), (F, "glVertex3fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Vertex3i)(GLint x, GLint y, GLint z) { DISPATCH(Vertex3i, (x, y, z), (F, "glVertex3i(%d, %d, %d);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(Vertex3iv)(const GLint * v) { DISPATCH(Vertex3iv, (v), (F, "glVertex3iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Vertex3s)(GLshort x, GLshort y, GLshort z) { DISPATCH(Vertex3s, (x, y, z), (F, "glVertex3s(%d, %d, %d);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(Vertex3sv)(const GLshort * v) { DISPATCH(Vertex3sv, (v), (F, "glVertex3sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { DISPATCH(Vertex4d, (x, y, z, w), (F, "glVertex4d(%f, %f, %f, %f);\n", x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(Vertex4dv)(const GLdouble * v) { DISPATCH(Vertex4dv, (v), (F, "glVertex4dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { DISPATCH(Vertex4f, (x, y, z, w), (F, "glVertex4f(%f, %f, %f, %f);\n", x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(Vertex4fv)(const GLfloat * v) { DISPATCH(Vertex4fv, (v), (F, "glVertex4fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Vertex4i)(GLint x, GLint y, GLint z, GLint w) { DISPATCH(Vertex4i, (x, y, z, w), (F, "glVertex4i(%d, %d, %d, %d);\n", x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(Vertex4iv)(const GLint * v) { DISPATCH(Vertex4iv, (v), (F, "glVertex4iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w) { DISPATCH(Vertex4s, (x, y, z, w), (F, "glVertex4s(%d, %d, %d, %d);\n", x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(Vertex4sv)(const GLshort * v) { DISPATCH(Vertex4sv, (v), (F, "glVertex4sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(ClipPlane)(GLenum plane, const GLdouble * equation) { DISPATCH(ClipPlane, (plane, equation), (F, "glClipPlane(0x%x, %p);\n", plane, (const void *) equation)); } KEYWORD1 void KEYWORD2 NAME(ColorMaterial)(GLenum face, GLenum mode) { DISPATCH(ColorMaterial, (face, mode), (F, "glColorMaterial(0x%x, 0x%x);\n", face, mode)); } KEYWORD1 void KEYWORD2 NAME(CullFace)(GLenum mode) { DISPATCH(CullFace, (mode), (F, "glCullFace(0x%x);\n", mode)); } KEYWORD1 void KEYWORD2 NAME(Fogf)(GLenum pname, GLfloat param) { DISPATCH(Fogf, (pname, param), (F, "glFogf(0x%x, %f);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(Fogfv)(GLenum pname, const GLfloat * params) { DISPATCH(Fogfv, (pname, params), (F, "glFogfv(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(Fogi)(GLenum pname, GLint param) { DISPATCH(Fogi, (pname, param), (F, "glFogi(0x%x, %d);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(Fogiv)(GLenum pname, const GLint * params) { DISPATCH(Fogiv, (pname, params), (F, "glFogiv(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(FrontFace)(GLenum mode) { DISPATCH(FrontFace, (mode), (F, "glFrontFace(0x%x);\n", mode)); } KEYWORD1 void KEYWORD2 NAME(Hint)(GLenum target, GLenum mode) { DISPATCH(Hint, (target, mode), (F, "glHint(0x%x, 0x%x);\n", target, mode)); } KEYWORD1 void KEYWORD2 NAME(Lightf)(GLenum light, GLenum pname, GLfloat param) { DISPATCH(Lightf, (light, pname, param), (F, "glLightf(0x%x, 0x%x, %f);\n", light, pname, param)); } KEYWORD1 void KEYWORD2 NAME(Lightfv)(GLenum light, GLenum pname, const GLfloat * params) { DISPATCH(Lightfv, (light, pname, params), (F, "glLightfv(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(Lighti)(GLenum light, GLenum pname, GLint param) { DISPATCH(Lighti, (light, pname, param), (F, "glLighti(0x%x, 0x%x, %d);\n", light, pname, param)); } KEYWORD1 void KEYWORD2 NAME(Lightiv)(GLenum light, GLenum pname, const GLint * params) { DISPATCH(Lightiv, (light, pname, params), (F, "glLightiv(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(LightModelf)(GLenum pname, GLfloat param) { DISPATCH(LightModelf, (pname, param), (F, "glLightModelf(0x%x, %f);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(LightModelfv)(GLenum pname, const GLfloat * params) { DISPATCH(LightModelfv, (pname, params), (F, "glLightModelfv(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(LightModeli)(GLenum pname, GLint param) { DISPATCH(LightModeli, (pname, param), (F, "glLightModeli(0x%x, %d);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(LightModeliv)(GLenum pname, const GLint * params) { DISPATCH(LightModeliv, (pname, params), (F, "glLightModeliv(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(LineStipple)(GLint factor, GLushort pattern) { DISPATCH(LineStipple, (factor, pattern), (F, "glLineStipple(%d, %d);\n", factor, pattern)); } KEYWORD1 void KEYWORD2 NAME(LineWidth)(GLfloat width) { DISPATCH(LineWidth, (width), (F, "glLineWidth(%f);\n", width)); } KEYWORD1 void KEYWORD2 NAME(Materialf)(GLenum face, GLenum pname, GLfloat param) { DISPATCH(Materialf, (face, pname, param), (F, "glMaterialf(0x%x, 0x%x, %f);\n", face, pname, param)); } KEYWORD1 void KEYWORD2 NAME(Materialfv)(GLenum face, GLenum pname, const GLfloat * params) { DISPATCH(Materialfv, (face, pname, params), (F, "glMaterialfv(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(Materiali)(GLenum face, GLenum pname, GLint param) { DISPATCH(Materiali, (face, pname, param), (F, "glMateriali(0x%x, 0x%x, %d);\n", face, pname, param)); } KEYWORD1 void KEYWORD2 NAME(Materialiv)(GLenum face, GLenum pname, const GLint * params) { DISPATCH(Materialiv, (face, pname, params), (F, "glMaterialiv(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(PointSize)(GLfloat size) { DISPATCH(PointSize, (size), (F, "glPointSize(%f);\n", size)); } KEYWORD1 void KEYWORD2 NAME(PolygonMode)(GLenum face, GLenum mode) { DISPATCH(PolygonMode, (face, mode), (F, "glPolygonMode(0x%x, 0x%x);\n", face, mode)); } KEYWORD1 void KEYWORD2 NAME(PolygonStipple)(const GLubyte * mask) { DISPATCH(PolygonStipple, (mask), (F, "glPolygonStipple(%p);\n", (const void *) mask)); } KEYWORD1 void KEYWORD2 NAME(Scissor)(GLint x, GLint y, GLsizei width, GLsizei height) { DISPATCH(Scissor, (x, y, width, height), (F, "glScissor(%d, %d, %d, %d);\n", x, y, width, height)); } KEYWORD1 void KEYWORD2 NAME(ShadeModel)(GLenum mode) { DISPATCH(ShadeModel, (mode), (F, "glShadeModel(0x%x);\n", mode)); } KEYWORD1 void KEYWORD2 NAME(TexParameterf)(GLenum target, GLenum pname, GLfloat param) { DISPATCH(TexParameterf, (target, pname, param), (F, "glTexParameterf(0x%x, 0x%x, %f);\n", target, pname, param)); } KEYWORD1 void KEYWORD2 NAME(TexParameterfv)(GLenum target, GLenum pname, const GLfloat * params) { DISPATCH(TexParameterfv, (target, pname, params), (F, "glTexParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(TexParameteri)(GLenum target, GLenum pname, GLint param) { DISPATCH(TexParameteri, (target, pname, param), (F, "glTexParameteri(0x%x, 0x%x, %d);\n", target, pname, param)); } KEYWORD1 void KEYWORD2 NAME(TexParameteriv)(GLenum target, GLenum pname, const GLint * params) { DISPATCH(TexParameteriv, (target, pname, params), (F, "glTexParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels) { DISPATCH(TexImage1D, (target, level, internalformat, width, border, format, type, pixels), (F, "glTexImage1D(0x%x, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, border, format, type, (const void *) pixels)); } KEYWORD1 void KEYWORD2 NAME(TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels) { DISPATCH(TexImage2D, (target, level, internalformat, width, height, border, format, type, pixels), (F, "glTexImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, border, format, type, (const void *) pixels)); } KEYWORD1 void KEYWORD2 NAME(TexEnvf)(GLenum target, GLenum pname, GLfloat param) { DISPATCH(TexEnvf, (target, pname, param), (F, "glTexEnvf(0x%x, 0x%x, %f);\n", target, pname, param)); } KEYWORD1 void KEYWORD2 NAME(TexEnvfv)(GLenum target, GLenum pname, const GLfloat * params) { DISPATCH(TexEnvfv, (target, pname, params), (F, "glTexEnvfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(TexEnvi)(GLenum target, GLenum pname, GLint param) { DISPATCH(TexEnvi, (target, pname, param), (F, "glTexEnvi(0x%x, 0x%x, %d);\n", target, pname, param)); } KEYWORD1 void KEYWORD2 NAME(TexEnviv)(GLenum target, GLenum pname, const GLint * params) { DISPATCH(TexEnviv, (target, pname, params), (F, "glTexEnviv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(TexGend)(GLenum coord, GLenum pname, GLdouble param) { DISPATCH(TexGend, (coord, pname, param), (F, "glTexGend(0x%x, 0x%x, %f);\n", coord, pname, param)); } KEYWORD1 void KEYWORD2 NAME(TexGendv)(GLenum coord, GLenum pname, const GLdouble * params) { DISPATCH(TexGendv, (coord, pname, params), (F, "glTexGendv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(TexGenf)(GLenum coord, GLenum pname, GLfloat param) { DISPATCH(TexGenf, (coord, pname, param), (F, "glTexGenf(0x%x, 0x%x, %f);\n", coord, pname, param)); } KEYWORD1 void KEYWORD2 NAME(TexGenfv)(GLenum coord, GLenum pname, const GLfloat * params) { DISPATCH(TexGenfv, (coord, pname, params), (F, "glTexGenfv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(TexGeni)(GLenum coord, GLenum pname, GLint param) { DISPATCH(TexGeni, (coord, pname, param), (F, "glTexGeni(0x%x, 0x%x, %d);\n", coord, pname, param)); } KEYWORD1 void KEYWORD2 NAME(TexGeniv)(GLenum coord, GLenum pname, const GLint * params) { DISPATCH(TexGeniv, (coord, pname, params), (F, "glTexGeniv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(FeedbackBuffer)(GLsizei size, GLenum type, GLfloat * buffer) { DISPATCH(FeedbackBuffer, (size, type, buffer), (F, "glFeedbackBuffer(%d, 0x%x, %p);\n", size, type, (const void *) buffer)); } KEYWORD1 void KEYWORD2 NAME(SelectBuffer)(GLsizei size, GLuint * buffer) { DISPATCH(SelectBuffer, (size, buffer), (F, "glSelectBuffer(%d, %p);\n", size, (const void *) buffer)); } KEYWORD1 GLint KEYWORD2 NAME(RenderMode)(GLenum mode) { RETURN_DISPATCH(RenderMode, (mode), (F, "glRenderMode(0x%x);\n", mode)); } KEYWORD1 void KEYWORD2 NAME(InitNames)(void) { DISPATCH(InitNames, (), (F, "glInitNames();\n")); } KEYWORD1 void KEYWORD2 NAME(LoadName)(GLuint name) { DISPATCH(LoadName, (name), (F, "glLoadName(%d);\n", name)); } KEYWORD1 void KEYWORD2 NAME(PassThrough)(GLfloat token) { DISPATCH(PassThrough, (token), (F, "glPassThrough(%f);\n", token)); } KEYWORD1 void KEYWORD2 NAME(PopName)(void) { DISPATCH(PopName, (), (F, "glPopName();\n")); } KEYWORD1 void KEYWORD2 NAME(PushName)(GLuint name) { DISPATCH(PushName, (name), (F, "glPushName(%d);\n", name)); } KEYWORD1 void KEYWORD2 NAME(DrawBuffer)(GLenum mode) { DISPATCH(DrawBuffer, (mode), (F, "glDrawBuffer(0x%x);\n", mode)); } KEYWORD1 void KEYWORD2 NAME(Clear)(GLbitfield mask) { DISPATCH(Clear, (mask), (F, "glClear(%d);\n", mask)); } KEYWORD1 void KEYWORD2 NAME(ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { DISPATCH(ClearAccum, (red, green, blue, alpha), (F, "glClearAccum(%f, %f, %f, %f);\n", red, green, blue, alpha)); } KEYWORD1 void KEYWORD2 NAME(ClearIndex)(GLfloat c) { DISPATCH(ClearIndex, (c), (F, "glClearIndex(%f);\n", c)); } KEYWORD1 void KEYWORD2 NAME(ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { DISPATCH(ClearColor, (red, green, blue, alpha), (F, "glClearColor(%f, %f, %f, %f);\n", red, green, blue, alpha)); } KEYWORD1 void KEYWORD2 NAME(ClearStencil)(GLint s) { DISPATCH(ClearStencil, (s), (F, "glClearStencil(%d);\n", s)); } KEYWORD1 void KEYWORD2 NAME(ClearDepth)(GLclampd depth) { DISPATCH(ClearDepth, (depth), (F, "glClearDepth(%f);\n", depth)); } KEYWORD1 void KEYWORD2 NAME(StencilMask)(GLuint mask) { DISPATCH(StencilMask, (mask), (F, "glStencilMask(%d);\n", mask)); } KEYWORD1 void KEYWORD2 NAME(ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { DISPATCH(ColorMask, (red, green, blue, alpha), (F, "glColorMask(%d, %d, %d, %d);\n", red, green, blue, alpha)); } KEYWORD1 void KEYWORD2 NAME(DepthMask)(GLboolean flag) { DISPATCH(DepthMask, (flag), (F, "glDepthMask(%d);\n", flag)); } KEYWORD1 void KEYWORD2 NAME(IndexMask)(GLuint mask) { DISPATCH(IndexMask, (mask), (F, "glIndexMask(%d);\n", mask)); } KEYWORD1 void KEYWORD2 NAME(Accum)(GLenum op, GLfloat value) { DISPATCH(Accum, (op, value), (F, "glAccum(0x%x, %f);\n", op, value)); } KEYWORD1 void KEYWORD2 NAME(Disable)(GLenum cap) { DISPATCH(Disable, (cap), (F, "glDisable(0x%x);\n", cap)); } KEYWORD1 void KEYWORD2 NAME(Enable)(GLenum cap) { DISPATCH(Enable, (cap), (F, "glEnable(0x%x);\n", cap)); } KEYWORD1 void KEYWORD2 NAME(Finish)(void) { DISPATCH(Finish, (), (F, "glFinish();\n")); } KEYWORD1 void KEYWORD2 NAME(Flush)(void) { DISPATCH(Flush, (), (F, "glFlush();\n")); } KEYWORD1 void KEYWORD2 NAME(PopAttrib)(void) { DISPATCH(PopAttrib, (), (F, "glPopAttrib();\n")); } KEYWORD1 void KEYWORD2 NAME(PushAttrib)(GLbitfield mask) { DISPATCH(PushAttrib, (mask), (F, "glPushAttrib(%d);\n", mask)); } KEYWORD1 void KEYWORD2 NAME(Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points) { DISPATCH(Map1d, (target, u1, u2, stride, order, points), (F, "glMap1d(0x%x, %f, %f, %d, %d, %p);\n", target, u1, u2, stride, order, (const void *) points)); } KEYWORD1 void KEYWORD2 NAME(Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points) { DISPATCH(Map1f, (target, u1, u2, stride, order, points), (F, "glMap1f(0x%x, %f, %f, %d, %d, %p);\n", target, u1, u2, stride, order, (const void *) points)); } KEYWORD1 void KEYWORD2 NAME(Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points) { DISPATCH(Map2d, (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points), (F, "glMap2d(0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p);\n", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, (const void *) points)); } KEYWORD1 void KEYWORD2 NAME(Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points) { DISPATCH(Map2f, (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points), (F, "glMap2f(0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p);\n", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, (const void *) points)); } KEYWORD1 void KEYWORD2 NAME(MapGrid1d)(GLint un, GLdouble u1, GLdouble u2) { DISPATCH(MapGrid1d, (un, u1, u2), (F, "glMapGrid1d(%d, %f, %f);\n", un, u1, u2)); } KEYWORD1 void KEYWORD2 NAME(MapGrid1f)(GLint un, GLfloat u1, GLfloat u2) { DISPATCH(MapGrid1f, (un, u1, u2), (F, "glMapGrid1f(%d, %f, %f);\n", un, u1, u2)); } KEYWORD1 void KEYWORD2 NAME(MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2) { DISPATCH(MapGrid2d, (un, u1, u2, vn, v1, v2), (F, "glMapGrid2d(%d, %f, %f, %d, %f, %f);\n", un, u1, u2, vn, v1, v2)); } KEYWORD1 void KEYWORD2 NAME(MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2) { DISPATCH(MapGrid2f, (un, u1, u2, vn, v1, v2), (F, "glMapGrid2f(%d, %f, %f, %d, %f, %f);\n", un, u1, u2, vn, v1, v2)); } KEYWORD1 void KEYWORD2 NAME(EvalCoord1d)(GLdouble u) { DISPATCH(EvalCoord1d, (u), (F, "glEvalCoord1d(%f);\n", u)); } KEYWORD1 void KEYWORD2 NAME(EvalCoord1dv)(const GLdouble * u) { DISPATCH(EvalCoord1dv, (u), (F, "glEvalCoord1dv(%p);\n", (const void *) u)); } KEYWORD1 void KEYWORD2 NAME(EvalCoord1f)(GLfloat u) { DISPATCH(EvalCoord1f, (u), (F, "glEvalCoord1f(%f);\n", u)); } KEYWORD1 void KEYWORD2 NAME(EvalCoord1fv)(const GLfloat * u) { DISPATCH(EvalCoord1fv, (u), (F, "glEvalCoord1fv(%p);\n", (const void *) u)); } KEYWORD1 void KEYWORD2 NAME(EvalCoord2d)(GLdouble u, GLdouble v) { DISPATCH(EvalCoord2d, (u, v), (F, "glEvalCoord2d(%f, %f);\n", u, v)); } KEYWORD1 void KEYWORD2 NAME(EvalCoord2dv)(const GLdouble * u) { DISPATCH(EvalCoord2dv, (u), (F, "glEvalCoord2dv(%p);\n", (const void *) u)); } KEYWORD1 void KEYWORD2 NAME(EvalCoord2f)(GLfloat u, GLfloat v) { DISPATCH(EvalCoord2f, (u, v), (F, "glEvalCoord2f(%f, %f);\n", u, v)); } KEYWORD1 void KEYWORD2 NAME(EvalCoord2fv)(const GLfloat * u) { DISPATCH(EvalCoord2fv, (u), (F, "glEvalCoord2fv(%p);\n", (const void *) u)); } KEYWORD1 void KEYWORD2 NAME(EvalMesh1)(GLenum mode, GLint i1, GLint i2) { DISPATCH(EvalMesh1, (mode, i1, i2), (F, "glEvalMesh1(0x%x, %d, %d);\n", mode, i1, i2)); } KEYWORD1 void KEYWORD2 NAME(EvalPoint1)(GLint i) { DISPATCH(EvalPoint1, (i), (F, "glEvalPoint1(%d);\n", i)); } KEYWORD1 void KEYWORD2 NAME(EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) { DISPATCH(EvalMesh2, (mode, i1, i2, j1, j2), (F, "glEvalMesh2(0x%x, %d, %d, %d, %d);\n", mode, i1, i2, j1, j2)); } KEYWORD1 void KEYWORD2 NAME(EvalPoint2)(GLint i, GLint j) { DISPATCH(EvalPoint2, (i, j), (F, "glEvalPoint2(%d, %d);\n", i, j)); } KEYWORD1 void KEYWORD2 NAME(AlphaFunc)(GLenum func, GLclampf ref) { DISPATCH(AlphaFunc, (func, ref), (F, "glAlphaFunc(0x%x, %f);\n", func, ref)); } KEYWORD1 void KEYWORD2 NAME(BlendFunc)(GLenum sfactor, GLenum dfactor) { DISPATCH(BlendFunc, (sfactor, dfactor), (F, "glBlendFunc(0x%x, 0x%x);\n", sfactor, dfactor)); } KEYWORD1 void KEYWORD2 NAME(LogicOp)(GLenum opcode) { DISPATCH(LogicOp, (opcode), (F, "glLogicOp(0x%x);\n", opcode)); } KEYWORD1 void KEYWORD2 NAME(StencilFunc)(GLenum func, GLint ref, GLuint mask) { DISPATCH(StencilFunc, (func, ref, mask), (F, "glStencilFunc(0x%x, %d, %d);\n", func, ref, mask)); } KEYWORD1 void KEYWORD2 NAME(StencilOp)(GLenum fail, GLenum zfail, GLenum zpass) { DISPATCH(StencilOp, (fail, zfail, zpass), (F, "glStencilOp(0x%x, 0x%x, 0x%x);\n", fail, zfail, zpass)); } KEYWORD1 void KEYWORD2 NAME(DepthFunc)(GLenum func) { DISPATCH(DepthFunc, (func), (F, "glDepthFunc(0x%x);\n", func)); } KEYWORD1 void KEYWORD2 NAME(PixelZoom)(GLfloat xfactor, GLfloat yfactor) { DISPATCH(PixelZoom, (xfactor, yfactor), (F, "glPixelZoom(%f, %f);\n", xfactor, yfactor)); } KEYWORD1 void KEYWORD2 NAME(PixelTransferf)(GLenum pname, GLfloat param) { DISPATCH(PixelTransferf, (pname, param), (F, "glPixelTransferf(0x%x, %f);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(PixelTransferi)(GLenum pname, GLint param) { DISPATCH(PixelTransferi, (pname, param), (F, "glPixelTransferi(0x%x, %d);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(PixelStoref)(GLenum pname, GLfloat param) { DISPATCH(PixelStoref, (pname, param), (F, "glPixelStoref(0x%x, %f);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(PixelStorei)(GLenum pname, GLint param) { DISPATCH(PixelStorei, (pname, param), (F, "glPixelStorei(0x%x, %d);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(PixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat * values) { DISPATCH(PixelMapfv, (map, mapsize, values), (F, "glPixelMapfv(0x%x, %d, %p);\n", map, mapsize, (const void *) values)); } KEYWORD1 void KEYWORD2 NAME(PixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint * values) { DISPATCH(PixelMapuiv, (map, mapsize, values), (F, "glPixelMapuiv(0x%x, %d, %p);\n", map, mapsize, (const void *) values)); } KEYWORD1 void KEYWORD2 NAME(PixelMapusv)(GLenum map, GLsizei mapsize, const GLushort * values) { DISPATCH(PixelMapusv, (map, mapsize, values), (F, "glPixelMapusv(0x%x, %d, %p);\n", map, mapsize, (const void *) values)); } KEYWORD1 void KEYWORD2 NAME(ReadBuffer)(GLenum mode) { DISPATCH(ReadBuffer, (mode), (F, "glReadBuffer(0x%x);\n", mode)); } KEYWORD1 void KEYWORD2 NAME(CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) { DISPATCH(CopyPixels, (x, y, width, height, type), (F, "glCopyPixels(%d, %d, %d, %d, 0x%x);\n", x, y, width, height, type)); } KEYWORD1 void KEYWORD2 NAME(ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels) { DISPATCH(ReadPixels, (x, y, width, height, format, type, pixels), (F, "glReadPixels(%d, %d, %d, %d, 0x%x, 0x%x, %p);\n", x, y, width, height, format, type, (const void *) pixels)); } KEYWORD1 void KEYWORD2 NAME(DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels) { DISPATCH(DrawPixels, (width, height, format, type, pixels), (F, "glDrawPixels(%d, %d, 0x%x, 0x%x, %p);\n", width, height, format, type, (const void *) pixels)); } KEYWORD1 void KEYWORD2 NAME(GetBooleanv)(GLenum pname, GLboolean * params) { DISPATCH(GetBooleanv, (pname, params), (F, "glGetBooleanv(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetClipPlane)(GLenum plane, GLdouble * equation) { DISPATCH(GetClipPlane, (plane, equation), (F, "glGetClipPlane(0x%x, %p);\n", plane, (const void *) equation)); } KEYWORD1 void KEYWORD2 NAME(GetDoublev)(GLenum pname, GLdouble * params) { DISPATCH(GetDoublev, (pname, params), (F, "glGetDoublev(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 GLenum KEYWORD2 NAME(GetError)(void) { RETURN_DISPATCH(GetError, (), (F, "glGetError();\n")); } KEYWORD1 void KEYWORD2 NAME(GetFloatv)(GLenum pname, GLfloat * params) { DISPATCH(GetFloatv, (pname, params), (F, "glGetFloatv(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetIntegerv)(GLenum pname, GLint * params) { DISPATCH(GetIntegerv, (pname, params), (F, "glGetIntegerv(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetLightfv)(GLenum light, GLenum pname, GLfloat * params) { DISPATCH(GetLightfv, (light, pname, params), (F, "glGetLightfv(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetLightiv)(GLenum light, GLenum pname, GLint * params) { DISPATCH(GetLightiv, (light, pname, params), (F, "glGetLightiv(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetMapdv)(GLenum target, GLenum query, GLdouble * v) { DISPATCH(GetMapdv, (target, query, v), (F, "glGetMapdv(0x%x, 0x%x, %p);\n", target, query, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(GetMapfv)(GLenum target, GLenum query, GLfloat * v) { DISPATCH(GetMapfv, (target, query, v), (F, "glGetMapfv(0x%x, 0x%x, %p);\n", target, query, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(GetMapiv)(GLenum target, GLenum query, GLint * v) { DISPATCH(GetMapiv, (target, query, v), (F, "glGetMapiv(0x%x, 0x%x, %p);\n", target, query, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(GetMaterialfv)(GLenum face, GLenum pname, GLfloat * params) { DISPATCH(GetMaterialfv, (face, pname, params), (F, "glGetMaterialfv(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetMaterialiv)(GLenum face, GLenum pname, GLint * params) { DISPATCH(GetMaterialiv, (face, pname, params), (F, "glGetMaterialiv(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetPixelMapfv)(GLenum map, GLfloat * values) { DISPATCH(GetPixelMapfv, (map, values), (F, "glGetPixelMapfv(0x%x, %p);\n", map, (const void *) values)); } KEYWORD1 void KEYWORD2 NAME(GetPixelMapuiv)(GLenum map, GLuint * values) { DISPATCH(GetPixelMapuiv, (map, values), (F, "glGetPixelMapuiv(0x%x, %p);\n", map, (const void *) values)); } KEYWORD1 void KEYWORD2 NAME(GetPixelMapusv)(GLenum map, GLushort * values) { DISPATCH(GetPixelMapusv, (map, values), (F, "glGetPixelMapusv(0x%x, %p);\n", map, (const void *) values)); } KEYWORD1 void KEYWORD2 NAME(GetPolygonStipple)(GLubyte * mask) { DISPATCH(GetPolygonStipple, (mask), (F, "glGetPolygonStipple(%p);\n", (const void *) mask)); } KEYWORD1 const GLubyte * KEYWORD2 NAME(GetString)(GLenum name) { RETURN_DISPATCH(GetString, (name), (F, "glGetString(0x%x);\n", name)); } KEYWORD1 void KEYWORD2 NAME(GetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params) { DISPATCH(GetTexEnvfv, (target, pname, params), (F, "glGetTexEnvfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetTexEnviv)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetTexEnviv, (target, pname, params), (F, "glGetTexEnviv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetTexGendv)(GLenum coord, GLenum pname, GLdouble * params) { DISPATCH(GetTexGendv, (coord, pname, params), (F, "glGetTexGendv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetTexGenfv)(GLenum coord, GLenum pname, GLfloat * params) { DISPATCH(GetTexGenfv, (coord, pname, params), (F, "glGetTexGenfv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetTexGeniv)(GLenum coord, GLenum pname, GLint * params) { DISPATCH(GetTexGeniv, (coord, pname, params), (F, "glGetTexGeniv(0x%x, 0x%x, %p);\n", coord, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels) { DISPATCH(GetTexImage, (target, level, format, type, pixels), (F, "glGetTexImage(0x%x, %d, 0x%x, 0x%x, %p);\n", target, level, format, type, (const void *) pixels)); } KEYWORD1 void KEYWORD2 NAME(GetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params) { DISPATCH(GetTexParameterfv, (target, pname, params), (F, "glGetTexParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetTexParameteriv)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetTexParameteriv, (target, pname, params), (F, "glGetTexParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params) { DISPATCH(GetTexLevelParameterfv, (target, level, pname, params), (F, "glGetTexLevelParameterfv(0x%x, %d, 0x%x, %p);\n", target, level, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params) { DISPATCH(GetTexLevelParameteriv, (target, level, pname, params), (F, "glGetTexLevelParameteriv(0x%x, %d, 0x%x, %p);\n", target, level, pname, (const void *) params)); } KEYWORD1 GLboolean KEYWORD2 NAME(IsEnabled)(GLenum cap) { RETURN_DISPATCH(IsEnabled, (cap), (F, "glIsEnabled(0x%x);\n", cap)); } KEYWORD1 GLboolean KEYWORD2 NAME(IsList)(GLuint list) { RETURN_DISPATCH(IsList, (list), (F, "glIsList(%d);\n", list)); } KEYWORD1 void KEYWORD2 NAME(DepthRange)(GLclampd zNear, GLclampd zFar) { DISPATCH(DepthRange, (zNear, zFar), (F, "glDepthRange(%f, %f);\n", zNear, zFar)); } KEYWORD1 void KEYWORD2 NAME(Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) { DISPATCH(Frustum, (left, right, bottom, top, zNear, zFar), (F, "glFrustum(%f, %f, %f, %f, %f, %f);\n", left, right, bottom, top, zNear, zFar)); } KEYWORD1 void KEYWORD2 NAME(LoadIdentity)(void) { DISPATCH(LoadIdentity, (), (F, "glLoadIdentity();\n")); } KEYWORD1 void KEYWORD2 NAME(LoadMatrixf)(const GLfloat * m) { DISPATCH(LoadMatrixf, (m), (F, "glLoadMatrixf(%p);\n", (const void *) m)); } KEYWORD1 void KEYWORD2 NAME(LoadMatrixd)(const GLdouble * m) { DISPATCH(LoadMatrixd, (m), (F, "glLoadMatrixd(%p);\n", (const void *) m)); } KEYWORD1 void KEYWORD2 NAME(MatrixMode)(GLenum mode) { DISPATCH(MatrixMode, (mode), (F, "glMatrixMode(0x%x);\n", mode)); } KEYWORD1 void KEYWORD2 NAME(MultMatrixf)(const GLfloat * m) { DISPATCH(MultMatrixf, (m), (F, "glMultMatrixf(%p);\n", (const void *) m)); } KEYWORD1 void KEYWORD2 NAME(MultMatrixd)(const GLdouble * m) { DISPATCH(MultMatrixd, (m), (F, "glMultMatrixd(%p);\n", (const void *) m)); } KEYWORD1 void KEYWORD2 NAME(Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) { DISPATCH(Ortho, (left, right, bottom, top, zNear, zFar), (F, "glOrtho(%f, %f, %f, %f, %f, %f);\n", left, right, bottom, top, zNear, zFar)); } KEYWORD1 void KEYWORD2 NAME(PopMatrix)(void) { DISPATCH(PopMatrix, (), (F, "glPopMatrix();\n")); } KEYWORD1 void KEYWORD2 NAME(PushMatrix)(void) { DISPATCH(PushMatrix, (), (F, "glPushMatrix();\n")); } KEYWORD1 void KEYWORD2 NAME(Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z) { DISPATCH(Rotated, (angle, x, y, z), (F, "glRotated(%f, %f, %f, %f);\n", angle, x, y, z)); } KEYWORD1 void KEYWORD2 NAME(Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { DISPATCH(Rotatef, (angle, x, y, z), (F, "glRotatef(%f, %f, %f, %f);\n", angle, x, y, z)); } KEYWORD1 void KEYWORD2 NAME(Scaled)(GLdouble x, GLdouble y, GLdouble z) { DISPATCH(Scaled, (x, y, z), (F, "glScaled(%f, %f, %f);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(Scalef)(GLfloat x, GLfloat y, GLfloat z) { DISPATCH(Scalef, (x, y, z), (F, "glScalef(%f, %f, %f);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(Translated)(GLdouble x, GLdouble y, GLdouble z) { DISPATCH(Translated, (x, y, z), (F, "glTranslated(%f, %f, %f);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(Translatef)(GLfloat x, GLfloat y, GLfloat z) { DISPATCH(Translatef, (x, y, z), (F, "glTranslatef(%f, %f, %f);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(Viewport)(GLint x, GLint y, GLsizei width, GLsizei height) { DISPATCH(Viewport, (x, y, width, height), (F, "glViewport(%d, %d, %d, %d);\n", x, y, width, height)); } KEYWORD1 void KEYWORD2 NAME(ArrayElement)(GLint i) { DISPATCH(ArrayElement, (i), (F, "glArrayElement(%d);\n", i)); } KEYWORD1 void KEYWORD2 NAME(ArrayElementEXT)(GLint i) { DISPATCH(ArrayElement, (i), (F, "glArrayElementEXT(%d);\n", i)); } KEYWORD1 void KEYWORD2 NAME(BindTexture)(GLenum target, GLuint texture) { DISPATCH(BindTexture, (target, texture), (F, "glBindTexture(0x%x, %d);\n", target, texture)); } KEYWORD1 void KEYWORD2 NAME(BindTextureEXT)(GLenum target, GLuint texture) { DISPATCH(BindTexture, (target, texture), (F, "glBindTextureEXT(0x%x, %d);\n", target, texture)); } KEYWORD1 void KEYWORD2 NAME(ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) { DISPATCH(ColorPointer, (size, type, stride, pointer), (F, "glColorPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(DisableClientState)(GLenum array) { DISPATCH(DisableClientState, (array), (F, "glDisableClientState(0x%x);\n", array)); } KEYWORD1 void KEYWORD2 NAME(DrawArrays)(GLenum mode, GLint first, GLsizei count) { DISPATCH(DrawArrays, (mode, first, count), (F, "glDrawArrays(0x%x, %d, %d);\n", mode, first, count)); } KEYWORD1 void KEYWORD2 NAME(DrawArraysEXT)(GLenum mode, GLint first, GLsizei count) { DISPATCH(DrawArrays, (mode, first, count), (F, "glDrawArraysEXT(0x%x, %d, %d);\n", mode, first, count)); } KEYWORD1 void KEYWORD2 NAME(DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices) { DISPATCH(DrawElements, (mode, count, type, indices), (F, "glDrawElements(0x%x, %d, 0x%x, %p);\n", mode, count, type, (const void *) indices)); } KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointer)(GLsizei stride, const GLvoid * pointer) { DISPATCH(EdgeFlagPointer, (stride, pointer), (F, "glEdgeFlagPointer(%d, %p);\n", stride, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(EnableClientState)(GLenum array) { DISPATCH(EnableClientState, (array), (F, "glEnableClientState(0x%x);\n", array)); } KEYWORD1 void KEYWORD2 NAME(IndexPointer)(GLenum type, GLsizei stride, const GLvoid * pointer) { DISPATCH(IndexPointer, (type, stride, pointer), (F, "glIndexPointer(0x%x, %d, %p);\n", type, stride, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(Indexub)(GLubyte c) { DISPATCH(Indexub, (c), (F, "glIndexub(%d);\n", c)); } KEYWORD1 void KEYWORD2 NAME(Indexubv)(const GLubyte * c) { DISPATCH(Indexubv, (c), (F, "glIndexubv(%p);\n", (const void *) c)); } KEYWORD1 void KEYWORD2 NAME(InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid * pointer) { DISPATCH(InterleavedArrays, (format, stride, pointer), (F, "glInterleavedArrays(0x%x, %d, %p);\n", format, stride, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(NormalPointer)(GLenum type, GLsizei stride, const GLvoid * pointer) { DISPATCH(NormalPointer, (type, stride, pointer), (F, "glNormalPointer(0x%x, %d, %p);\n", type, stride, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(PolygonOffset)(GLfloat factor, GLfloat units) { DISPATCH(PolygonOffset, (factor, units), (F, "glPolygonOffset(%f, %f);\n", factor, units)); } KEYWORD1 void KEYWORD2 NAME(TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) { DISPATCH(TexCoordPointer, (size, type, stride, pointer), (F, "glTexCoordPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) { DISPATCH(VertexPointer, (size, type, stride, pointer), (F, "glVertexPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer)); } KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResident)(GLsizei n, const GLuint * textures, GLboolean * residences) { RETURN_DISPATCH(AreTexturesResident, (n, textures, residences), (F, "glAreTexturesResident(%d, %p, %p);\n", n, (const void *) textures, (const void *) residences)); } KEYWORD1 void KEYWORD2 NAME(CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) { DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, "glCopyTexImage1D(0x%x, %d, 0x%x, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, border)); } KEYWORD1 void KEYWORD2 NAME(CopyTexImage1DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) { DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, "glCopyTexImage1DEXT(0x%x, %d, 0x%x, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, border)); } KEYWORD1 void KEYWORD2 NAME(CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, "glCopyTexImage2D(0x%x, %d, 0x%x, %d, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, height, border)); } KEYWORD1 void KEYWORD2 NAME(CopyTexImage2DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, "glCopyTexImage2DEXT(0x%x, %d, 0x%x, %d, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, height, border)); } KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, "glCopyTexSubImage1D(0x%x, %d, %d, %d, %d, %d);\n", target, level, xoffset, x, y, width)); } KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, "glCopyTexSubImage1DEXT(0x%x, %d, %d, %d, %d, %d);\n", target, level, xoffset, x, y, width)); } KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, "glCopyTexSubImage2D(0x%x, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, x, y, width, height)); } KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, "glCopyTexSubImage2DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, x, y, width, height)); } KEYWORD1 void KEYWORD2 NAME(DeleteTextures)(GLsizei n, const GLuint * textures) { DISPATCH(DeleteTextures, (n, textures), (F, "glDeleteTextures(%d, %p);\n", n, (const void *) textures)); } KEYWORD1 void KEYWORD2 NAME(DeleteTexturesEXT)(GLsizei n, const GLuint * textures) { DISPATCH(DeleteTextures, (n, textures), (F, "glDeleteTexturesEXT(%d, %p);\n", n, (const void *) textures)); } KEYWORD1 void KEYWORD2 NAME(GenTextures)(GLsizei n, GLuint * textures) { DISPATCH(GenTextures, (n, textures), (F, "glGenTextures(%d, %p);\n", n, (const void *) textures)); } KEYWORD1 void KEYWORD2 NAME(GetPointerv)(GLenum pname, GLvoid ** params) { DISPATCH(GetPointerv, (pname, params), (F, "glGetPointerv(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetPointervEXT)(GLenum pname, GLvoid ** params) { DISPATCH(GetPointerv, (pname, params), (F, "glGetPointervEXT(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 GLboolean KEYWORD2 NAME(IsTexture)(GLuint texture) { RETURN_DISPATCH(IsTexture, (texture), (F, "glIsTexture(%d);\n", texture)); } KEYWORD1 void KEYWORD2 NAME(PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities) { DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, "glPrioritizeTextures(%d, %p, %p);\n", n, (const void *) textures, (const void *) priorities)); } KEYWORD1 void KEYWORD2 NAME(PrioritizeTexturesEXT)(GLsizei n, const GLuint * textures, const GLclampf * priorities) { DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, "glPrioritizeTexturesEXT(%d, %p, %p);\n", n, (const void *) textures, (const void *) priorities)); } KEYWORD1 void KEYWORD2 NAME(TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels) { DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, "glTexSubImage1D(0x%x, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, width, format, type, (const void *) pixels)); } KEYWORD1 void KEYWORD2 NAME(TexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels) { DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, "glTexSubImage1DEXT(0x%x, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, width, format, type, (const void *) pixels)); } KEYWORD1 void KEYWORD2 NAME(TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels) { DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, "glTexSubImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, width, height, format, type, (const void *) pixels)); } KEYWORD1 void KEYWORD2 NAME(TexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels) { DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, "glTexSubImage2DEXT(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, width, height, format, type, (const void *) pixels)); } KEYWORD1 void KEYWORD2 NAME(PopClientAttrib)(void) { DISPATCH(PopClientAttrib, (), (F, "glPopClientAttrib();\n")); } KEYWORD1 void KEYWORD2 NAME(PushClientAttrib)(GLbitfield mask) { DISPATCH(PushClientAttrib, (mask), (F, "glPushClientAttrib(%d);\n", mask)); } KEYWORD1 void KEYWORD2 NAME(BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { DISPATCH(BlendColor, (red, green, blue, alpha), (F, "glBlendColor(%f, %f, %f, %f);\n", red, green, blue, alpha)); } KEYWORD1 void KEYWORD2 NAME(BlendColorEXT)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { DISPATCH(BlendColor, (red, green, blue, alpha), (F, "glBlendColorEXT(%f, %f, %f, %f);\n", red, green, blue, alpha)); } KEYWORD1 void KEYWORD2 NAME(BlendEquation)(GLenum mode) { DISPATCH(BlendEquation, (mode), (F, "glBlendEquation(0x%x);\n", mode)); } KEYWORD1 void KEYWORD2 NAME(BlendEquationEXT)(GLenum mode) { DISPATCH(BlendEquation, (mode), (F, "glBlendEquationEXT(0x%x);\n", mode)); } KEYWORD1 void KEYWORD2 NAME(DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices) { DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, "glDrawRangeElements(0x%x, %d, %d, %d, 0x%x, %p);\n", mode, start, end, count, type, (const void *) indices)); } KEYWORD1 void KEYWORD2 NAME(DrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices) { DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, "glDrawRangeElementsEXT(0x%x, %d, %d, %d, 0x%x, %p);\n", mode, start, end, count, type, (const void *) indices)); } KEYWORD1 void KEYWORD2 NAME(ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table) { DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, "glColorTable(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (const void *) table)); } KEYWORD1 void KEYWORD2 NAME(ColorTableSGI)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table) { DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, "glColorTableSGI(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (const void *) table)); } KEYWORD1 void KEYWORD2 NAME(ColorTableEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table) { DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, "glColorTableEXT(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (const void *) table)); } KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat * params) { DISPATCH(ColorTableParameterfv, (target, pname, params), (F, "glColorTableParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfvSGI)(GLenum target, GLenum pname, const GLfloat * params) { DISPATCH(ColorTableParameterfv, (target, pname, params), (F, "glColorTableParameterfvSGI(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ColorTableParameteriv)(GLenum target, GLenum pname, const GLint * params) { DISPATCH(ColorTableParameteriv, (target, pname, params), (F, "glColorTableParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ColorTableParameterivSGI)(GLenum target, GLenum pname, const GLint * params) { DISPATCH(ColorTableParameteriv, (target, pname, params), (F, "glColorTableParameterivSGI(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { DISPATCH(CopyColorTable, (target, internalformat, x, y, width), (F, "glCopyColorTable(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); } KEYWORD1 void KEYWORD2 NAME(CopyColorTableSGI)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { DISPATCH(CopyColorTable, (target, internalformat, x, y, width), (F, "glCopyColorTableSGI(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); } KEYWORD1 void KEYWORD2 NAME(GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid * table) { DISPATCH(GetColorTable, (target, format, type, table), (F, "glGetColorTable(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) table)); } KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat * params) { DISPATCH(GetColorTableParameterfv, (target, pname, params), (F, "glGetColorTableParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetColorTableParameteriv)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetColorTableParameteriv, (target, pname, params), (F, "glGetColorTableParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data) { DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, "glColorSubTable(0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, start, count, format, type, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(ColorSubTableEXT)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data) { DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, "glColorSubTableEXT(0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, start, count, format, type, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, "glCopyColorSubTable(0x%x, %d, %d, %d, %d);\n", target, start, x, y, width)); } KEYWORD1 void KEYWORD2 NAME(CopyColorSubTableEXT)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, "glCopyColorSubTableEXT(0x%x, %d, %d, %d, %d);\n", target, start, x, y, width)); } KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image) { DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, "glConvolutionFilter1D(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (const void *) image)); } KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image) { DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, "glConvolutionFilter1DEXT(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (const void *) image)); } KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image) { DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, "glConvolutionFilter2D(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, height, format, type, (const void *) image)); } KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image) { DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, "glConvolutionFilter2DEXT(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, height, format, type, (const void *) image)); } KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params) { DISPATCH(ConvolutionParameterf, (target, pname, params), (F, "glConvolutionParameterf(0x%x, 0x%x, %f);\n", target, pname, params)); } KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfEXT)(GLenum target, GLenum pname, GLfloat params) { DISPATCH(ConvolutionParameterf, (target, pname, params), (F, "glConvolutionParameterfEXT(0x%x, 0x%x, %f);\n", target, pname, params)); } KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat * params) { DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, "glConvolutionParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfvEXT)(GLenum target, GLenum pname, const GLfloat * params) { DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, "glConvolutionParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteri)(GLenum target, GLenum pname, GLint params) { DISPATCH(ConvolutionParameteri, (target, pname, params), (F, "glConvolutionParameteri(0x%x, 0x%x, %d);\n", target, pname, params)); } KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriEXT)(GLenum target, GLenum pname, GLint params) { DISPATCH(ConvolutionParameteri, (target, pname, params), (F, "glConvolutionParameteriEXT(0x%x, 0x%x, %d);\n", target, pname, params)); } KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint * params) { DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, "glConvolutionParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterivEXT)(GLenum target, GLenum pname, const GLint * params) { DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, "glConvolutionParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, "glCopyConvolutionFilter1D(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); } KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, "glCopyConvolutionFilter1DEXT(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); } KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) { DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, "glCopyConvolutionFilter2D(0x%x, 0x%x, %d, %d, %d, %d);\n", target, internalformat, x, y, width, height)); } KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) { DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, "glCopyConvolutionFilter2DEXT(0x%x, 0x%x, %d, %d, %d, %d);\n", target, internalformat, x, y, width, height)); } KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid * image) { DISPATCH(GetConvolutionFilter, (target, format, type, image), (F, "glGetConvolutionFilter(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) image)); } KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat * params) { DISPATCH(GetConvolutionParameterfv, (target, pname, params), (F, "glGetConvolutionParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetConvolutionParameteriv, (target, pname, params), (F, "glGetConvolutionParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span) { DISPATCH(GetSeparableFilter, (target, format, type, row, column, span), (F, "glGetSeparableFilter(0x%x, 0x%x, 0x%x, %p, %p, %p);\n", target, format, type, (const void *) row, (const void *) column, (const void *) span)); } KEYWORD1 void KEYWORD2 NAME(SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column) { DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, "glSeparableFilter2D(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p, %p);\n", target, internalformat, width, height, format, type, (const void *) row, (const void *) column)); } KEYWORD1 void KEYWORD2 NAME(SeparableFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column) { DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, "glSeparableFilter2DEXT(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p, %p);\n", target, internalformat, width, height, format, type, (const void *) row, (const void *) column)); } KEYWORD1 void KEYWORD2 NAME(GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) { DISPATCH(GetHistogram, (target, reset, format, type, values), (F, "glGetHistogram(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (const void *) values)); } KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat * params) { DISPATCH(GetHistogramParameterfv, (target, pname, params), (F, "glGetHistogramParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetHistogramParameteriv)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetHistogramParameteriv, (target, pname, params), (F, "glGetHistogramParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) { DISPATCH(GetMinmax, (target, reset, format, type, values), (F, "glGetMinmax(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (const void *) values)); } KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat * params) { DISPATCH(GetMinmaxParameterfv, (target, pname, params), (F, "glGetMinmaxParameterfv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetMinmaxParameteriv, (target, pname, params), (F, "glGetMinmaxParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) { DISPATCH(Histogram, (target, width, internalformat, sink), (F, "glHistogram(0x%x, %d, 0x%x, %d);\n", target, width, internalformat, sink)); } KEYWORD1 void KEYWORD2 NAME(HistogramEXT)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) { DISPATCH(Histogram, (target, width, internalformat, sink), (F, "glHistogramEXT(0x%x, %d, 0x%x, %d);\n", target, width, internalformat, sink)); } KEYWORD1 void KEYWORD2 NAME(Minmax)(GLenum target, GLenum internalformat, GLboolean sink) { DISPATCH(Minmax, (target, internalformat, sink), (F, "glMinmax(0x%x, 0x%x, %d);\n", target, internalformat, sink)); } KEYWORD1 void KEYWORD2 NAME(MinmaxEXT)(GLenum target, GLenum internalformat, GLboolean sink) { DISPATCH(Minmax, (target, internalformat, sink), (F, "glMinmaxEXT(0x%x, 0x%x, %d);\n", target, internalformat, sink)); } KEYWORD1 void KEYWORD2 NAME(ResetHistogram)(GLenum target) { DISPATCH(ResetHistogram, (target), (F, "glResetHistogram(0x%x);\n", target)); } KEYWORD1 void KEYWORD2 NAME(ResetHistogramEXT)(GLenum target) { DISPATCH(ResetHistogram, (target), (F, "glResetHistogramEXT(0x%x);\n", target)); } KEYWORD1 void KEYWORD2 NAME(ResetMinmax)(GLenum target) { DISPATCH(ResetMinmax, (target), (F, "glResetMinmax(0x%x);\n", target)); } KEYWORD1 void KEYWORD2 NAME(ResetMinmaxEXT)(GLenum target) { DISPATCH(ResetMinmax, (target), (F, "glResetMinmaxEXT(0x%x);\n", target)); } KEYWORD1 void KEYWORD2 NAME(TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels) { DISPATCH(TexImage3D, (target, level, internalformat, width, height, depth, border, format, type, pixels), (F, "glTexImage3D(0x%x, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, border, format, type, (const void *) pixels)); } KEYWORD1 void KEYWORD2 NAME(TexImage3DEXT)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels) { DISPATCH(TexImage3D, (target, level, internalformat, width, height, depth, border, format, type, pixels), (F, "glTexImage3DEXT(0x%x, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, border, format, type, (const void *) pixels)); } KEYWORD1 void KEYWORD2 NAME(TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels) { DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, "glTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (const void *) pixels)); } KEYWORD1 void KEYWORD2 NAME(TexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels) { DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, "glTexSubImage3DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (const void *) pixels)); } KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, "glCopyTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, zoffset, x, y, width, height)); } KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, "glCopyTexSubImage3DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, zoffset, x, y, width, height)); } KEYWORD1 void KEYWORD2 NAME(ActiveTexture)(GLenum texture) { DISPATCH(ActiveTextureARB, (texture), (F, "glActiveTexture(0x%x);\n", texture)); } KEYWORD1 void KEYWORD2 NAME(ActiveTextureARB)(GLenum texture) { DISPATCH(ActiveTextureARB, (texture), (F, "glActiveTextureARB(0x%x);\n", texture)); } KEYWORD1 void KEYWORD2 NAME(ClientActiveTexture)(GLenum texture) { DISPATCH(ClientActiveTextureARB, (texture), (F, "glClientActiveTexture(0x%x);\n", texture)); } KEYWORD1 void KEYWORD2 NAME(ClientActiveTextureARB)(GLenum texture) { DISPATCH(ClientActiveTextureARB, (texture), (F, "glClientActiveTextureARB(0x%x);\n", texture)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1d)(GLenum target, GLdouble s) { DISPATCH(MultiTexCoord1dARB, (target, s), (F, "glMultiTexCoord1d(0x%x, %f);\n", target, s)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dARB)(GLenum target, GLdouble s) { DISPATCH(MultiTexCoord1dARB, (target, s), (F, "glMultiTexCoord1dARB(0x%x, %f);\n", target, s)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dv)(GLenum target, const GLdouble * v) { DISPATCH(MultiTexCoord1dvARB, (target, v), (F, "glMultiTexCoord1dv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dvARB)(GLenum target, const GLdouble * v) { DISPATCH(MultiTexCoord1dvARB, (target, v), (F, "glMultiTexCoord1dvARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1f)(GLenum target, GLfloat s) { DISPATCH(MultiTexCoord1fARB, (target, s), (F, "glMultiTexCoord1f(0x%x, %f);\n", target, s)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fARB)(GLenum target, GLfloat s) { DISPATCH(MultiTexCoord1fARB, (target, s), (F, "glMultiTexCoord1fARB(0x%x, %f);\n", target, s)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fv)(GLenum target, const GLfloat * v) { DISPATCH(MultiTexCoord1fvARB, (target, v), (F, "glMultiTexCoord1fv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fvARB)(GLenum target, const GLfloat * v) { DISPATCH(MultiTexCoord1fvARB, (target, v), (F, "glMultiTexCoord1fvARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1i)(GLenum target, GLint s) { DISPATCH(MultiTexCoord1iARB, (target, s), (F, "glMultiTexCoord1i(0x%x, %d);\n", target, s)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iARB)(GLenum target, GLint s) { DISPATCH(MultiTexCoord1iARB, (target, s), (F, "glMultiTexCoord1iARB(0x%x, %d);\n", target, s)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iv)(GLenum target, const GLint * v) { DISPATCH(MultiTexCoord1ivARB, (target, v), (F, "glMultiTexCoord1iv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1ivARB)(GLenum target, const GLint * v) { DISPATCH(MultiTexCoord1ivARB, (target, v), (F, "glMultiTexCoord1ivARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1s)(GLenum target, GLshort s) { DISPATCH(MultiTexCoord1sARB, (target, s), (F, "glMultiTexCoord1s(0x%x, %d);\n", target, s)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sARB)(GLenum target, GLshort s) { DISPATCH(MultiTexCoord1sARB, (target, s), (F, "glMultiTexCoord1sARB(0x%x, %d);\n", target, s)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sv)(GLenum target, const GLshort * v) { DISPATCH(MultiTexCoord1svARB, (target, v), (F, "glMultiTexCoord1sv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1svARB)(GLenum target, const GLshort * v) { DISPATCH(MultiTexCoord1svARB, (target, v), (F, "glMultiTexCoord1svARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2d)(GLenum target, GLdouble s, GLdouble t) { DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, "glMultiTexCoord2d(0x%x, %f, %f);\n", target, s, t)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t) { DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, "glMultiTexCoord2dARB(0x%x, %f, %f);\n", target, s, t)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dv)(GLenum target, const GLdouble * v) { DISPATCH(MultiTexCoord2dvARB, (target, v), (F, "glMultiTexCoord2dv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dvARB)(GLenum target, const GLdouble * v) { DISPATCH(MultiTexCoord2dvARB, (target, v), (F, "glMultiTexCoord2dvARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2f)(GLenum target, GLfloat s, GLfloat t) { DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, "glMultiTexCoord2f(0x%x, %f, %f);\n", target, s, t)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t) { DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, "glMultiTexCoord2fARB(0x%x, %f, %f);\n", target, s, t)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fv)(GLenum target, const GLfloat * v) { DISPATCH(MultiTexCoord2fvARB, (target, v), (F, "glMultiTexCoord2fv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fvARB)(GLenum target, const GLfloat * v) { DISPATCH(MultiTexCoord2fvARB, (target, v), (F, "glMultiTexCoord2fvARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2i)(GLenum target, GLint s, GLint t) { DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, "glMultiTexCoord2i(0x%x, %d, %d);\n", target, s, t)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iARB)(GLenum target, GLint s, GLint t) { DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, "glMultiTexCoord2iARB(0x%x, %d, %d);\n", target, s, t)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iv)(GLenum target, const GLint * v) { DISPATCH(MultiTexCoord2ivARB, (target, v), (F, "glMultiTexCoord2iv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2ivARB)(GLenum target, const GLint * v) { DISPATCH(MultiTexCoord2ivARB, (target, v), (F, "glMultiTexCoord2ivARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2s)(GLenum target, GLshort s, GLshort t) { DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, "glMultiTexCoord2s(0x%x, %d, %d);\n", target, s, t)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t) { DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, "glMultiTexCoord2sARB(0x%x, %d, %d);\n", target, s, t)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sv)(GLenum target, const GLshort * v) { DISPATCH(MultiTexCoord2svARB, (target, v), (F, "glMultiTexCoord2sv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2svARB)(GLenum target, const GLshort * v) { DISPATCH(MultiTexCoord2svARB, (target, v), (F, "glMultiTexCoord2svARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3d)(GLenum target, GLdouble s, GLdouble t, GLdouble r) { DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, "glMultiTexCoord3d(0x%x, %f, %f, %f);\n", target, s, t, r)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r) { DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, "glMultiTexCoord3dARB(0x%x, %f, %f, %f);\n", target, s, t, r)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dv)(GLenum target, const GLdouble * v) { DISPATCH(MultiTexCoord3dvARB, (target, v), (F, "glMultiTexCoord3dv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dvARB)(GLenum target, const GLdouble * v) { DISPATCH(MultiTexCoord3dvARB, (target, v), (F, "glMultiTexCoord3dvARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3f)(GLenum target, GLfloat s, GLfloat t, GLfloat r) { DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, "glMultiTexCoord3f(0x%x, %f, %f, %f);\n", target, s, t, r)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r) { DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, "glMultiTexCoord3fARB(0x%x, %f, %f, %f);\n", target, s, t, r)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fv)(GLenum target, const GLfloat * v) { DISPATCH(MultiTexCoord3fvARB, (target, v), (F, "glMultiTexCoord3fv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fvARB)(GLenum target, const GLfloat * v) { DISPATCH(MultiTexCoord3fvARB, (target, v), (F, "glMultiTexCoord3fvARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3i)(GLenum target, GLint s, GLint t, GLint r) { DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, "glMultiTexCoord3i(0x%x, %d, %d, %d);\n", target, s, t, r)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r) { DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, "glMultiTexCoord3iARB(0x%x, %d, %d, %d);\n", target, s, t, r)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iv)(GLenum target, const GLint * v) { DISPATCH(MultiTexCoord3ivARB, (target, v), (F, "glMultiTexCoord3iv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3ivARB)(GLenum target, const GLint * v) { DISPATCH(MultiTexCoord3ivARB, (target, v), (F, "glMultiTexCoord3ivARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3s)(GLenum target, GLshort s, GLshort t, GLshort r) { DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, "glMultiTexCoord3s(0x%x, %d, %d, %d);\n", target, s, t, r)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r) { DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, "glMultiTexCoord3sARB(0x%x, %d, %d, %d);\n", target, s, t, r)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sv)(GLenum target, const GLshort * v) { DISPATCH(MultiTexCoord3svARB, (target, v), (F, "glMultiTexCoord3sv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3svARB)(GLenum target, const GLshort * v) { DISPATCH(MultiTexCoord3svARB, (target, v), (F, "glMultiTexCoord3svARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4d)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) { DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, "glMultiTexCoord4d(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) { DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, "glMultiTexCoord4dARB(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dv)(GLenum target, const GLdouble * v) { DISPATCH(MultiTexCoord4dvARB, (target, v), (F, "glMultiTexCoord4dv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dvARB)(GLenum target, const GLdouble * v) { DISPATCH(MultiTexCoord4dvARB, (target, v), (F, "glMultiTexCoord4dvARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, "glMultiTexCoord4f(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, "glMultiTexCoord4fARB(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fv)(GLenum target, const GLfloat * v) { DISPATCH(MultiTexCoord4fvARB, (target, v), (F, "glMultiTexCoord4fv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fvARB)(GLenum target, const GLfloat * v) { DISPATCH(MultiTexCoord4fvARB, (target, v), (F, "glMultiTexCoord4fvARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4i)(GLenum target, GLint s, GLint t, GLint r, GLint q) { DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, "glMultiTexCoord4i(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q) { DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, "glMultiTexCoord4iARB(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iv)(GLenum target, const GLint * v) { DISPATCH(MultiTexCoord4ivARB, (target, v), (F, "glMultiTexCoord4iv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4ivARB)(GLenum target, const GLint * v) { DISPATCH(MultiTexCoord4ivARB, (target, v), (F, "glMultiTexCoord4ivARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4s)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) { DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, "glMultiTexCoord4s(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) { DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, "glMultiTexCoord4sARB(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sv)(GLenum target, const GLshort * v) { DISPATCH(MultiTexCoord4svARB, (target, v), (F, "glMultiTexCoord4sv(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4svARB)(GLenum target, const GLshort * v) { DISPATCH(MultiTexCoord4svARB, (target, v), (F, "glMultiTexCoord4svARB(0x%x, %p);\n", target, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixf)(const GLfloat * m) { DISPATCH(LoadTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixf(%p);\n", (const void *) m)); } KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixfARB)(const GLfloat * m) { DISPATCH(LoadTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixfARB(%p);\n", (const void *) m)); } KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixd)(const GLdouble * m) { DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixd(%p);\n", (const void *) m)); } KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixdARB)(const GLdouble * m) { DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixdARB(%p);\n", (const void *) m)); } KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixf)(const GLfloat * m) { DISPATCH(MultTransposeMatrixfARB, (m), (F, "glMultTransposeMatrixf(%p);\n", (const void *) m)); } KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixfARB)(const GLfloat * m) { DISPATCH(MultTransposeMatrixfARB, (m), (F, "glMultTransposeMatrixfARB(%p);\n", (const void *) m)); } KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixd)(const GLdouble * m) { DISPATCH(MultTransposeMatrixdARB, (m), (F, "glMultTransposeMatrixd(%p);\n", (const void *) m)); } KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixdARB)(const GLdouble * m) { DISPATCH(MultTransposeMatrixdARB, (m), (F, "glMultTransposeMatrixdARB(%p);\n", (const void *) m)); } KEYWORD1 void KEYWORD2 NAME(SampleCoverage)(GLclampf value, GLboolean invert) { DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverage(%f, %d);\n", value, invert)); } KEYWORD1 void KEYWORD2 NAME(SampleCoverageARB)(GLclampf value, GLboolean invert) { DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverageARB(%f, %d);\n", value, invert)); } KEYWORD1 void KEYWORD2 NAME(DrawBuffersARB)(GLsizei n, const GLenum * bufs) { DISPATCH(DrawBuffersARB, (n, bufs), (F, "glDrawBuffersARB(%d, %p);\n", n, (const void *) bufs)); } KEYWORD1 void KEYWORD2 NAME(DrawBuffersATI)(GLsizei n, const GLenum * bufs) { DISPATCH(DrawBuffersARB, (n, bufs), (F, "glDrawBuffersATI(%d, %p);\n", n, (const void *) bufs)); } KEYWORD1 void KEYWORD2 NAME(PolygonOffsetEXT)(GLfloat factor, GLfloat bias) { DISPATCH(PolygonOffsetEXT, (factor, bias), (F, "glPolygonOffsetEXT(%f, %f);\n", factor, bias)); } KEYWORD1 void KEYWORD2 NAME(GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat * weights) { DISPATCH(GetTexFilterFuncSGIS, (target, filter, weights), (F, "glGetTexFilterFuncSGIS(0x%x, 0x%x, %p);\n", target, filter, (const void *) weights)); } KEYWORD1 void KEYWORD2 NAME(TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat * weights) { DISPATCH(TexFilterFuncSGIS, (target, filter, n, weights), (F, "glTexFilterFuncSGIS(0x%x, 0x%x, %d, %p);\n", target, filter, n, (const void *) weights)); } KEYWORD1 void KEYWORD2 NAME(GetHistogramEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) { DISPATCH(GetHistogramEXT, (target, reset, format, type, values), (F, "glGetHistogramEXT(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (const void *) values)); } KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) { DISPATCH(GetHistogramParameterfvEXT, (target, pname, params), (F, "glGetHistogramParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterivEXT)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetHistogramParameterivEXT, (target, pname, params), (F, "glGetHistogramParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetMinmaxEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) { DISPATCH(GetMinmaxEXT, (target, reset, format, type, values), (F, "glGetMinmaxEXT(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (const void *) values)); } KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) { DISPATCH(GetMinmaxParameterfvEXT, (target, pname, params), (F, "glGetMinmaxParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterivEXT)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetMinmaxParameterivEXT, (target, pname, params), (F, "glGetMinmaxParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * image) { DISPATCH(GetConvolutionFilterEXT, (target, format, type, image), (F, "glGetConvolutionFilterEXT(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) image)); } KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) { DISPATCH(GetConvolutionParameterfvEXT, (target, pname, params), (F, "glGetConvolutionParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterivEXT)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetConvolutionParameterivEXT, (target, pname, params), (F, "glGetConvolutionParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetSeparableFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span) { DISPATCH(GetSeparableFilterEXT, (target, format, type, row, column, span), (F, "glGetSeparableFilterEXT(0x%x, 0x%x, 0x%x, %p, %p, %p);\n", target, format, type, (const void *) row, (const void *) column, (const void *) span)); } KEYWORD1 void KEYWORD2 NAME(GetColorTableSGI)(GLenum target, GLenum format, GLenum type, GLvoid * table) { DISPATCH(GetColorTableSGI, (target, format, type, table), (F, "glGetColorTableSGI(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) table)); } KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvSGI)(GLenum target, GLenum pname, GLfloat * params) { DISPATCH(GetColorTableParameterfvSGI, (target, pname, params), (F, "glGetColorTableParameterfvSGI(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivSGI)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetColorTableParameterivSGI, (target, pname, params), (F, "glGetColorTableParameterivSGI(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(PixelTexGenSGIX)(GLenum mode) { DISPATCH(PixelTexGenSGIX, (mode), (F, "glPixelTexGenSGIX(0x%x);\n", mode)); } KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameteriSGIS)(GLenum pname, GLint param) { DISPATCH(PixelTexGenParameteriSGIS, (pname, param), (F, "glPixelTexGenParameteriSGIS(0x%x, %d);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params) { DISPATCH(PixelTexGenParameterivSGIS, (pname, params), (F, "glPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param) { DISPATCH(PixelTexGenParameterfSGIS, (pname, param), (F, "glPixelTexGenParameterfSGIS(0x%x, %f);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params) { DISPATCH(PixelTexGenParameterfvSGIS, (pname, params), (F, "glPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params) { DISPATCH(GetPixelTexGenParameterivSGIS, (pname, params), (F, "glGetPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params) { DISPATCH(GetPixelTexGenParameterfvSGIS, (pname, params), (F, "glGetPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(TexImage4DSGIS)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels) { DISPATCH(TexImage4DSGIS, (target, level, internalformat, width, height, depth, size4d, border, format, type, pixels), (F, "glTexImage4DSGIS(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, size4d, border, format, type, (const void *) pixels)); } KEYWORD1 void KEYWORD2 NAME(TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid * pixels) { DISPATCH(TexSubImage4DSGIS, (target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, size4d, format, type, pixels), (F, "glTexSubImage4DSGIS(0x%x, %d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, size4d, format, type, (const void *) pixels)); } KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResidentEXT)(GLsizei n, const GLuint * textures, GLboolean * residences) { RETURN_DISPATCH(AreTexturesResidentEXT, (n, textures, residences), (F, "glAreTexturesResidentEXT(%d, %p, %p);\n", n, (const void *) textures, (const void *) residences)); } KEYWORD1 void KEYWORD2 NAME(GenTexturesEXT)(GLsizei n, GLuint * textures) { DISPATCH(GenTexturesEXT, (n, textures), (F, "glGenTexturesEXT(%d, %p);\n", n, (const void *) textures)); } KEYWORD1 GLboolean KEYWORD2 NAME(IsTextureEXT)(GLuint texture) { RETURN_DISPATCH(IsTextureEXT, (texture), (F, "glIsTextureEXT(%d);\n", texture)); } KEYWORD1 void KEYWORD2 NAME(DetailTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points) { DISPATCH(DetailTexFuncSGIS, (target, n, points), (F, "glDetailTexFuncSGIS(0x%x, %d, %p);\n", target, n, (const void *) points)); } KEYWORD1 void KEYWORD2 NAME(GetDetailTexFuncSGIS)(GLenum target, GLfloat * points) { DISPATCH(GetDetailTexFuncSGIS, (target, points), (F, "glGetDetailTexFuncSGIS(0x%x, %p);\n", target, (const void *) points)); } KEYWORD1 void KEYWORD2 NAME(SharpenTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points) { DISPATCH(SharpenTexFuncSGIS, (target, n, points), (F, "glSharpenTexFuncSGIS(0x%x, %d, %p);\n", target, n, (const void *) points)); } KEYWORD1 void KEYWORD2 NAME(GetSharpenTexFuncSGIS)(GLenum target, GLfloat * points) { DISPATCH(GetSharpenTexFuncSGIS, (target, points), (F, "glGetSharpenTexFuncSGIS(0x%x, %p);\n", target, (const void *) points)); } KEYWORD1 void KEYWORD2 NAME(SampleMaskSGIS)(GLclampf value, GLboolean invert) { DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskSGIS(%f, %d);\n", value, invert)); } KEYWORD1 void KEYWORD2 NAME(SampleMaskEXT)(GLclampf value, GLboolean invert) { DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskEXT(%f, %d);\n", value, invert)); } KEYWORD1 void KEYWORD2 NAME(SamplePatternSGIS)(GLenum pattern) { DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternSGIS(0x%x);\n", pattern)); } KEYWORD1 void KEYWORD2 NAME(SamplePatternEXT)(GLenum pattern) { DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternEXT(0x%x);\n", pattern)); } KEYWORD1 void KEYWORD2 NAME(ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) { DISPATCH(ColorPointerEXT, (size, type, stride, count, pointer), (F, "glColorPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer) { DISPATCH(EdgeFlagPointerEXT, (stride, count, pointer), (F, "glEdgeFlagPointerEXT(%d, %d, %p);\n", stride, count, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) { DISPATCH(IndexPointerEXT, (type, stride, count, pointer), (F, "glIndexPointerEXT(0x%x, %d, %d, %p);\n", type, stride, count, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) { DISPATCH(NormalPointerEXT, (type, stride, count, pointer), (F, "glNormalPointerEXT(0x%x, %d, %d, %p);\n", type, stride, count, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) { DISPATCH(TexCoordPointerEXT, (size, type, stride, count, pointer), (F, "glTexCoordPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) { DISPATCH(VertexPointerEXT, (size, type, stride, count, pointer), (F, "glVertexPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(SpriteParameterfSGIX)(GLenum pname, GLfloat param) { DISPATCH(SpriteParameterfSGIX, (pname, param), (F, "glSpriteParameterfSGIX(0x%x, %f);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(SpriteParameterfvSGIX)(GLenum pname, const GLfloat * params) { DISPATCH(SpriteParameterfvSGIX, (pname, params), (F, "glSpriteParameterfvSGIX(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(SpriteParameteriSGIX)(GLenum pname, GLint param) { DISPATCH(SpriteParameteriSGIX, (pname, param), (F, "glSpriteParameteriSGIX(0x%x, %d);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(SpriteParameterivSGIX)(GLenum pname, const GLint * params) { DISPATCH(SpriteParameterivSGIX, (pname, params), (F, "glSpriteParameterivSGIX(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(PointParameterf)(GLenum pname, GLfloat param) { DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterf(0x%x, %f);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(PointParameterfARB)(GLenum pname, GLfloat param) { DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfARB(0x%x, %f);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(PointParameterfEXT)(GLenum pname, GLfloat param) { DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfEXT(0x%x, %f);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(PointParameterfSGIS)(GLenum pname, GLfloat param) { DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfSGIS(0x%x, %f);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(PointParameterfv)(GLenum pname, const GLfloat * params) { DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfv(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(PointParameterfvARB)(GLenum pname, const GLfloat * params) { DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvARB(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum pname, const GLfloat * params) { DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvEXT(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(PointParameterfvSGIS)(GLenum pname, const GLfloat * params) { DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 GLint KEYWORD2 NAME(GetInstrumentsSGIX)(void) { RETURN_DISPATCH(GetInstrumentsSGIX, (), (F, "glGetInstrumentsSGIX();\n")); } KEYWORD1 void KEYWORD2 NAME(InstrumentsBufferSGIX)(GLsizei size, GLint * buffer) { DISPATCH(InstrumentsBufferSGIX, (size, buffer), (F, "glInstrumentsBufferSGIX(%d, %p);\n", size, (const void *) buffer)); } KEYWORD1 GLint KEYWORD2 NAME(PollInstrumentsSGIX)(GLint * marker_p) { RETURN_DISPATCH(PollInstrumentsSGIX, (marker_p), (F, "glPollInstrumentsSGIX(%p);\n", (const void *) marker_p)); } KEYWORD1 void KEYWORD2 NAME(ReadInstrumentsSGIX)(GLint marker) { DISPATCH(ReadInstrumentsSGIX, (marker), (F, "glReadInstrumentsSGIX(%d);\n", marker)); } KEYWORD1 void KEYWORD2 NAME(StartInstrumentsSGIX)(void) { DISPATCH(StartInstrumentsSGIX, (), (F, "glStartInstrumentsSGIX();\n")); } KEYWORD1 void KEYWORD2 NAME(StopInstrumentsSGIX)(GLint marker) { DISPATCH(StopInstrumentsSGIX, (marker), (F, "glStopInstrumentsSGIX(%d);\n", marker)); } KEYWORD1 void KEYWORD2 NAME(FrameZoomSGIX)(GLint factor) { DISPATCH(FrameZoomSGIX, (factor), (F, "glFrameZoomSGIX(%d);\n", factor)); } KEYWORD1 void KEYWORD2 NAME(TagSampleBufferSGIX)(void) { DISPATCH(TagSampleBufferSGIX, (), (F, "glTagSampleBufferSGIX();\n")); } KEYWORD1 void KEYWORD2 NAME(ReferencePlaneSGIX)(const GLdouble * equation) { DISPATCH(ReferencePlaneSGIX, (equation), (F, "glReferencePlaneSGIX(%p);\n", (const void *) equation)); } KEYWORD1 void KEYWORD2 NAME(FlushRasterSGIX)(void) { DISPATCH(FlushRasterSGIX, (), (F, "glFlushRasterSGIX();\n")); } KEYWORD1 void KEYWORD2 NAME(GetListParameterfvSGIX)(GLuint list, GLenum pname, GLfloat * params) { DISPATCH(GetListParameterfvSGIX, (list, pname, params), (F, "glGetListParameterfvSGIX(%d, 0x%x, %p);\n", list, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetListParameterivSGIX)(GLuint list, GLenum pname, GLint * params) { DISPATCH(GetListParameterivSGIX, (list, pname, params), (F, "glGetListParameterivSGIX(%d, 0x%x, %p);\n", list, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ListParameterfSGIX)(GLuint list, GLenum pname, GLfloat param) { DISPATCH(ListParameterfSGIX, (list, pname, param), (F, "glListParameterfSGIX(%d, 0x%x, %f);\n", list, pname, param)); } KEYWORD1 void KEYWORD2 NAME(ListParameterfvSGIX)(GLuint list, GLenum pname, const GLfloat * params) { DISPATCH(ListParameterfvSGIX, (list, pname, params), (F, "glListParameterfvSGIX(%d, 0x%x, %p);\n", list, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ListParameteriSGIX)(GLuint list, GLenum pname, GLint param) { DISPATCH(ListParameteriSGIX, (list, pname, param), (F, "glListParameteriSGIX(%d, 0x%x, %d);\n", list, pname, param)); } KEYWORD1 void KEYWORD2 NAME(ListParameterivSGIX)(GLuint list, GLenum pname, const GLint * params) { DISPATCH(ListParameterivSGIX, (list, pname, params), (F, "glListParameterivSGIX(%d, 0x%x, %p);\n", list, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(FragmentColorMaterialSGIX)(GLenum face, GLenum mode) { DISPATCH(FragmentColorMaterialSGIX, (face, mode), (F, "glFragmentColorMaterialSGIX(0x%x, 0x%x);\n", face, mode)); } KEYWORD1 void KEYWORD2 NAME(FragmentLightfSGIX)(GLenum light, GLenum pname, GLfloat param) { DISPATCH(FragmentLightfSGIX, (light, pname, param), (F, "glFragmentLightfSGIX(0x%x, 0x%x, %f);\n", light, pname, param)); } KEYWORD1 void KEYWORD2 NAME(FragmentLightfvSGIX)(GLenum light, GLenum pname, const GLfloat * params) { DISPATCH(FragmentLightfvSGIX, (light, pname, params), (F, "glFragmentLightfvSGIX(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(FragmentLightiSGIX)(GLenum light, GLenum pname, GLint param) { DISPATCH(FragmentLightiSGIX, (light, pname, param), (F, "glFragmentLightiSGIX(0x%x, 0x%x, %d);\n", light, pname, param)); } KEYWORD1 void KEYWORD2 NAME(FragmentLightivSGIX)(GLenum light, GLenum pname, const GLint * params) { DISPATCH(FragmentLightivSGIX, (light, pname, params), (F, "glFragmentLightivSGIX(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfSGIX)(GLenum pname, GLfloat param) { DISPATCH(FragmentLightModelfSGIX, (pname, param), (F, "glFragmentLightModelfSGIX(0x%x, %f);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfvSGIX)(GLenum pname, const GLfloat * params) { DISPATCH(FragmentLightModelfvSGIX, (pname, params), (F, "glFragmentLightModelfvSGIX(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(FragmentLightModeliSGIX)(GLenum pname, GLint param) { DISPATCH(FragmentLightModeliSGIX, (pname, param), (F, "glFragmentLightModeliSGIX(0x%x, %d);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(FragmentLightModelivSGIX)(GLenum pname, const GLint * params) { DISPATCH(FragmentLightModelivSGIX, (pname, params), (F, "glFragmentLightModelivSGIX(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfSGIX)(GLenum face, GLenum pname, GLfloat param) { DISPATCH(FragmentMaterialfSGIX, (face, pname, param), (F, "glFragmentMaterialfSGIX(0x%x, 0x%x, %f);\n", face, pname, param)); } KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfvSGIX)(GLenum face, GLenum pname, const GLfloat * params) { DISPATCH(FragmentMaterialfvSGIX, (face, pname, params), (F, "glFragmentMaterialfvSGIX(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(FragmentMaterialiSGIX)(GLenum face, GLenum pname, GLint param) { DISPATCH(FragmentMaterialiSGIX, (face, pname, param), (F, "glFragmentMaterialiSGIX(0x%x, 0x%x, %d);\n", face, pname, param)); } KEYWORD1 void KEYWORD2 NAME(FragmentMaterialivSGIX)(GLenum face, GLenum pname, const GLint * params) { DISPATCH(FragmentMaterialivSGIX, (face, pname, params), (F, "glFragmentMaterialivSGIX(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetFragmentLightfvSGIX)(GLenum light, GLenum pname, GLfloat * params) { DISPATCH(GetFragmentLightfvSGIX, (light, pname, params), (F, "glGetFragmentLightfvSGIX(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetFragmentLightivSGIX)(GLenum light, GLenum pname, GLint * params) { DISPATCH(GetFragmentLightivSGIX, (light, pname, params), (F, "glGetFragmentLightivSGIX(0x%x, 0x%x, %p);\n", light, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialfvSGIX)(GLenum face, GLenum pname, GLfloat * params) { DISPATCH(GetFragmentMaterialfvSGIX, (face, pname, params), (F, "glGetFragmentMaterialfvSGIX(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialivSGIX)(GLenum face, GLenum pname, GLint * params) { DISPATCH(GetFragmentMaterialivSGIX, (face, pname, params), (F, "glGetFragmentMaterialivSGIX(0x%x, 0x%x, %p);\n", face, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(LightEnviSGIX)(GLenum pname, GLint param) { DISPATCH(LightEnviSGIX, (pname, param), (F, "glLightEnviSGIX(0x%x, %d);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(VertexWeightfEXT)(GLfloat weight) { DISPATCH(VertexWeightfEXT, (weight), (F, "glVertexWeightfEXT(%f);\n", weight)); } KEYWORD1 void KEYWORD2 NAME(VertexWeightfvEXT)(const GLfloat * weight) { DISPATCH(VertexWeightfvEXT, (weight), (F, "glVertexWeightfvEXT(%p);\n", (const void *) weight)); } KEYWORD1 void KEYWORD2 NAME(VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer) { DISPATCH(VertexWeightPointerEXT, (size, type, stride, pointer), (F, "glVertexWeightPointerEXT(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(FlushVertexArrayRangeNV)(void) { DISPATCH(FlushVertexArrayRangeNV, (), (F, "glFlushVertexArrayRangeNV();\n")); } KEYWORD1 void KEYWORD2 NAME(VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer) { DISPATCH(VertexArrayRangeNV, (length, pointer), (F, "glVertexArrayRangeNV(%d, %p);\n", length, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(CombinerParameterfvNV)(GLenum pname, const GLfloat * params) { DISPATCH(CombinerParameterfvNV, (pname, params), (F, "glCombinerParameterfvNV(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(CombinerParameterfNV)(GLenum pname, GLfloat param) { DISPATCH(CombinerParameterfNV, (pname, param), (F, "glCombinerParameterfNV(0x%x, %f);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(CombinerParameterivNV)(GLenum pname, const GLint * params) { DISPATCH(CombinerParameterivNV, (pname, params), (F, "glCombinerParameterivNV(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(CombinerParameteriNV)(GLenum pname, GLint param) { DISPATCH(CombinerParameteriNV, (pname, param), (F, "glCombinerParameteriNV(0x%x, %d);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage) { DISPATCH(CombinerInputNV, (stage, portion, variable, input, mapping, componentUsage), (F, "glCombinerInputNV(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x);\n", stage, portion, variable, input, mapping, componentUsage)); } KEYWORD1 void KEYWORD2 NAME(CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum) { DISPATCH(CombinerOutputNV, (stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum), (F, "glCombinerOutputNV(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, %d, %d, %d);\n", stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum)); } KEYWORD1 void KEYWORD2 NAME(FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage) { DISPATCH(FinalCombinerInputNV, (variable, input, mapping, componentUsage), (F, "glFinalCombinerInputNV(0x%x, 0x%x, 0x%x, 0x%x);\n", variable, input, mapping, componentUsage)); } KEYWORD1 void KEYWORD2 NAME(GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params) { DISPATCH(GetCombinerInputParameterfvNV, (stage, portion, variable, pname, params), (F, "glGetCombinerInputParameterfvNV(0x%x, 0x%x, 0x%x, 0x%x, %p);\n", stage, portion, variable, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params) { DISPATCH(GetCombinerInputParameterivNV, (stage, portion, variable, pname, params), (F, "glGetCombinerInputParameterivNV(0x%x, 0x%x, 0x%x, 0x%x, %p);\n", stage, portion, variable, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params) { DISPATCH(GetCombinerOutputParameterfvNV, (stage, portion, pname, params), (F, "glGetCombinerOutputParameterfvNV(0x%x, 0x%x, 0x%x, %p);\n", stage, portion, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params) { DISPATCH(GetCombinerOutputParameterivNV, (stage, portion, pname, params), (F, "glGetCombinerOutputParameterivNV(0x%x, 0x%x, 0x%x, %p);\n", stage, portion, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params) { DISPATCH(GetFinalCombinerInputParameterfvNV, (variable, pname, params), (F, "glGetFinalCombinerInputParameterfvNV(0x%x, 0x%x, %p);\n", variable, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params) { DISPATCH(GetFinalCombinerInputParameterivNV, (variable, pname, params), (F, "glGetFinalCombinerInputParameterivNV(0x%x, 0x%x, %p);\n", variable, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ResizeBuffersMESA)(void) { DISPATCH(ResizeBuffersMESA, (), (F, "glResizeBuffersMESA();\n")); } KEYWORD1 void KEYWORD2 NAME(WindowPos2d)(GLdouble x, GLdouble y) { DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2d(%f, %f);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2dARB)(GLdouble x, GLdouble y) { DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2dARB(%f, %f);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2dMESA)(GLdouble x, GLdouble y) { DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2dMESA(%f, %f);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2dv)(const GLdouble * v) { DISPATCH(WindowPos2dvMESA, (v), (F, "glWindowPos2dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2dvARB)(const GLdouble * v) { DISPATCH(WindowPos2dvMESA, (v), (F, "glWindowPos2dvARB(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2dvMESA)(const GLdouble * v) { DISPATCH(WindowPos2dvMESA, (v), (F, "glWindowPos2dvMESA(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2f)(GLfloat x, GLfloat y) { DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2f(%f, %f);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2fARB)(GLfloat x, GLfloat y) { DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2fARB(%f, %f);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2fMESA)(GLfloat x, GLfloat y) { DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2fMESA(%f, %f);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2fv)(const GLfloat * v) { DISPATCH(WindowPos2fvMESA, (v), (F, "glWindowPos2fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2fvARB)(const GLfloat * v) { DISPATCH(WindowPos2fvMESA, (v), (F, "glWindowPos2fvARB(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2fvMESA)(const GLfloat * v) { DISPATCH(WindowPos2fvMESA, (v), (F, "glWindowPos2fvMESA(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2i)(GLint x, GLint y) { DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2i(%d, %d);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2iARB)(GLint x, GLint y) { DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2iARB(%d, %d);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2iMESA)(GLint x, GLint y) { DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2iMESA(%d, %d);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2iv)(const GLint * v) { DISPATCH(WindowPos2ivMESA, (v), (F, "glWindowPos2iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2ivARB)(const GLint * v) { DISPATCH(WindowPos2ivMESA, (v), (F, "glWindowPos2ivARB(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2ivMESA)(const GLint * v) { DISPATCH(WindowPos2ivMESA, (v), (F, "glWindowPos2ivMESA(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2s)(GLshort x, GLshort y) { DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2s(%d, %d);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2sARB)(GLshort x, GLshort y) { DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2sARB(%d, %d);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2sMESA)(GLshort x, GLshort y) { DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2sMESA(%d, %d);\n", x, y)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2sv)(const GLshort * v) { DISPATCH(WindowPos2svMESA, (v), (F, "glWindowPos2sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2svARB)(const GLshort * v) { DISPATCH(WindowPos2svMESA, (v), (F, "glWindowPos2svARB(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos2svMESA)(const GLshort * v) { DISPATCH(WindowPos2svMESA, (v), (F, "glWindowPos2svMESA(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3d)(GLdouble x, GLdouble y, GLdouble z) { DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3d(%f, %f, %f);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3dARB)(GLdouble x, GLdouble y, GLdouble z) { DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3dARB(%f, %f, %f);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z) { DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3dMESA(%f, %f, %f);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3dv)(const GLdouble * v) { DISPATCH(WindowPos3dvMESA, (v), (F, "glWindowPos3dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3dvARB)(const GLdouble * v) { DISPATCH(WindowPos3dvMESA, (v), (F, "glWindowPos3dvARB(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3dvMESA)(const GLdouble * v) { DISPATCH(WindowPos3dvMESA, (v), (F, "glWindowPos3dvMESA(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3f)(GLfloat x, GLfloat y, GLfloat z) { DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3f(%f, %f, %f);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3fARB)(GLfloat x, GLfloat y, GLfloat z) { DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3fARB(%f, %f, %f);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z) { DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3fMESA(%f, %f, %f);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3fv)(const GLfloat * v) { DISPATCH(WindowPos3fvMESA, (v), (F, "glWindowPos3fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3fvARB)(const GLfloat * v) { DISPATCH(WindowPos3fvMESA, (v), (F, "glWindowPos3fvARB(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3fvMESA)(const GLfloat * v) { DISPATCH(WindowPos3fvMESA, (v), (F, "glWindowPos3fvMESA(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3i)(GLint x, GLint y, GLint z) { DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3i(%d, %d, %d);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3iARB)(GLint x, GLint y, GLint z) { DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3iARB(%d, %d, %d);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3iMESA)(GLint x, GLint y, GLint z) { DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3iMESA(%d, %d, %d);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3iv)(const GLint * v) { DISPATCH(WindowPos3ivMESA, (v), (F, "glWindowPos3iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3ivARB)(const GLint * v) { DISPATCH(WindowPos3ivMESA, (v), (F, "glWindowPos3ivARB(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3ivMESA)(const GLint * v) { DISPATCH(WindowPos3ivMESA, (v), (F, "glWindowPos3ivMESA(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3s)(GLshort x, GLshort y, GLshort z) { DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3s(%d, %d, %d);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3sARB)(GLshort x, GLshort y, GLshort z) { DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3sARB(%d, %d, %d);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3sMESA)(GLshort x, GLshort y, GLshort z) { DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3sMESA(%d, %d, %d);\n", x, y, z)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3sv)(const GLshort * v) { DISPATCH(WindowPos3svMESA, (v), (F, "glWindowPos3sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3svARB)(const GLshort * v) { DISPATCH(WindowPos3svMESA, (v), (F, "glWindowPos3svARB(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos3svMESA)(const GLshort * v) { DISPATCH(WindowPos3svMESA, (v), (F, "glWindowPos3svMESA(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { DISPATCH(WindowPos4dMESA, (x, y, z, w), (F, "glWindowPos4dMESA(%f, %f, %f, %f);\n", x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(WindowPos4dvMESA)(const GLdouble * v) { DISPATCH(WindowPos4dvMESA, (v), (F, "glWindowPos4dvMESA(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { DISPATCH(WindowPos4fMESA, (x, y, z, w), (F, "glWindowPos4fMESA(%f, %f, %f, %f);\n", x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(WindowPos4fvMESA)(const GLfloat * v) { DISPATCH(WindowPos4fvMESA, (v), (F, "glWindowPos4fvMESA(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w) { DISPATCH(WindowPos4iMESA, (x, y, z, w), (F, "glWindowPos4iMESA(%d, %d, %d, %d);\n", x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(WindowPos4ivMESA)(const GLint * v) { DISPATCH(WindowPos4ivMESA, (v), (F, "glWindowPos4ivMESA(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w) { DISPATCH(WindowPos4sMESA, (x, y, z, w), (F, "glWindowPos4sMESA(%d, %d, %d, %d);\n", x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(WindowPos4svMESA)(const GLshort * v) { DISPATCH(WindowPos4svMESA, (v), (F, "glWindowPos4svMESA(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparate)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); } KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateEXT(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); } KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateINGR)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateINGR(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); } KEYWORD1 void KEYWORD2 NAME(IndexMaterialEXT)(GLenum face, GLenum mode) { DISPATCH(IndexMaterialEXT, (face, mode), (F, "glIndexMaterialEXT(0x%x, 0x%x);\n", face, mode)); } KEYWORD1 void KEYWORD2 NAME(IndexFuncEXT)(GLenum func, GLclampf ref) { DISPATCH(IndexFuncEXT, (func, ref), (F, "glIndexFuncEXT(0x%x, %f);\n", func, ref)); } KEYWORD1 void KEYWORD2 NAME(LockArraysEXT)(GLint first, GLsizei count) { DISPATCH(LockArraysEXT, (first, count), (F, "glLockArraysEXT(%d, %d);\n", first, count)); } KEYWORD1 void KEYWORD2 NAME(UnlockArraysEXT)(void) { DISPATCH(UnlockArraysEXT, (), (F, "glUnlockArraysEXT();\n")); } KEYWORD1 void KEYWORD2 NAME(CullParameterdvEXT)(GLenum pname, GLdouble * params) { DISPATCH(CullParameterdvEXT, (pname, params), (F, "glCullParameterdvEXT(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(CullParameterfvEXT)(GLenum pname, GLfloat * params) { DISPATCH(CullParameterfvEXT, (pname, params), (F, "glCullParameterfvEXT(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(HintPGI)(GLenum target, GLint mode) { DISPATCH(HintPGI, (target, mode), (F, "glHintPGI(0x%x, %d);\n", target, mode)); } KEYWORD1 void KEYWORD2 NAME(FogCoordf)(GLfloat coord) { DISPATCH(FogCoordfEXT, (coord), (F, "glFogCoordf(%f);\n", coord)); } KEYWORD1 void KEYWORD2 NAME(FogCoordfEXT)(GLfloat coord) { DISPATCH(FogCoordfEXT, (coord), (F, "glFogCoordfEXT(%f);\n", coord)); } KEYWORD1 void KEYWORD2 NAME(FogCoordfv)(const GLfloat * coord) { DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfv(%p);\n", (const void *) coord)); } KEYWORD1 void KEYWORD2 NAME(FogCoordfvEXT)(const GLfloat * coord) { DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfvEXT(%p);\n", (const void *) coord)); } KEYWORD1 void KEYWORD2 NAME(FogCoordd)(GLdouble coord) { DISPATCH(FogCoorddEXT, (coord), (F, "glFogCoordd(%f);\n", coord)); } KEYWORD1 void KEYWORD2 NAME(FogCoorddEXT)(GLdouble coord) { DISPATCH(FogCoorddEXT, (coord), (F, "glFogCoorddEXT(%f);\n", coord)); } KEYWORD1 void KEYWORD2 NAME(FogCoorddv)(const GLdouble * coord) { DISPATCH(FogCoorddvEXT, (coord), (F, "glFogCoorddv(%p);\n", (const void *) coord)); } KEYWORD1 void KEYWORD2 NAME(FogCoorddvEXT)(const GLdouble * coord) { DISPATCH(FogCoorddvEXT, (coord), (F, "glFogCoorddvEXT(%p);\n", (const void *) coord)); } KEYWORD1 void KEYWORD2 NAME(FogCoordPointer)(GLenum type, GLsizei stride, const GLvoid * pointer) { DISPATCH(FogCoordPointerEXT, (type, stride, pointer), (F, "glFogCoordPointer(0x%x, %d, %p);\n", type, stride, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer) { DISPATCH(FogCoordPointerEXT, (type, stride, pointer), (F, "glFogCoordPointerEXT(0x%x, %d, %p);\n", type, stride, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid * data) { DISPATCH(GetColorTableEXT, (target, format, type, data), (F, "glGetColorTableEXT(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetColorTableParameterivEXT, (target, pname, params), (F, "glGetColorTableParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) { DISPATCH(GetColorTableParameterfvEXT, (target, pname, params), (F, "glGetColorTableParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(TbufferMask3DFX)(GLuint mask) { DISPATCH(TbufferMask3DFX, (mask), (F, "glTbufferMask3DFX(%d);\n", mask)); } KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data) { DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3D(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, depth, border, imageSize, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data) { DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3DARB(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, depth, border, imageSize, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data) { DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2D(0x%x, %d, 0x%x, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, border, imageSize, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data) { DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2DARB(0x%x, %d, 0x%x, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, border, imageSize, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data) { DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1D(0x%x, %d, 0x%x, %d, %d, %d, %p);\n", target, level, internalformat, width, border, imageSize, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data) { DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1DARB(0x%x, %d, 0x%x, %d, %d, %d, %p);\n", target, level, internalformat, width, border, imageSize, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data) { DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data) { DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3DARB(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data) { DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, width, height, format, imageSize, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data) { DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2DARB(0x%x, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, width, height, format, imageSize, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data) { DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1D(0x%x, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, width, format, imageSize, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data) { DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1DARB(0x%x, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, width, format, imageSize, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImage)(GLenum target, GLint level, GLvoid * img) { DISPATCH(GetCompressedTexImageARB, (target, level, img), (F, "glGetCompressedTexImage(0x%x, %d, %p);\n", target, level, (const void *) img)); } KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img) { DISPATCH(GetCompressedTexImageARB, (target, level, img), (F, "glGetCompressedTexImageARB(0x%x, %d, %p);\n", target, level, (const void *) img)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3b)(GLbyte red, GLbyte green, GLbyte blue) { DISPATCH(SecondaryColor3bEXT, (red, green, blue), (F, "glSecondaryColor3b(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue) { DISPATCH(SecondaryColor3bEXT, (red, green, blue), (F, "glSecondaryColor3bEXT(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bv)(const GLbyte * v) { DISPATCH(SecondaryColor3bvEXT, (v), (F, "glSecondaryColor3bv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bvEXT)(const GLbyte * v) { DISPATCH(SecondaryColor3bvEXT, (v), (F, "glSecondaryColor3bvEXT(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3d)(GLdouble red, GLdouble green, GLdouble blue) { DISPATCH(SecondaryColor3dEXT, (red, green, blue), (F, "glSecondaryColor3d(%f, %f, %f);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue) { DISPATCH(SecondaryColor3dEXT, (red, green, blue), (F, "glSecondaryColor3dEXT(%f, %f, %f);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dv)(const GLdouble * v) { DISPATCH(SecondaryColor3dvEXT, (v), (F, "glSecondaryColor3dv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dvEXT)(const GLdouble * v) { DISPATCH(SecondaryColor3dvEXT, (v), (F, "glSecondaryColor3dvEXT(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3f)(GLfloat red, GLfloat green, GLfloat blue) { DISPATCH(SecondaryColor3fEXT, (red, green, blue), (F, "glSecondaryColor3f(%f, %f, %f);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue) { DISPATCH(SecondaryColor3fEXT, (red, green, blue), (F, "glSecondaryColor3fEXT(%f, %f, %f);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fv)(const GLfloat * v) { DISPATCH(SecondaryColor3fvEXT, (v), (F, "glSecondaryColor3fv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fvEXT)(const GLfloat * v) { DISPATCH(SecondaryColor3fvEXT, (v), (F, "glSecondaryColor3fvEXT(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3i)(GLint red, GLint green, GLint blue) { DISPATCH(SecondaryColor3iEXT, (red, green, blue), (F, "glSecondaryColor3i(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3iEXT)(GLint red, GLint green, GLint blue) { DISPATCH(SecondaryColor3iEXT, (red, green, blue), (F, "glSecondaryColor3iEXT(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3iv)(const GLint * v) { DISPATCH(SecondaryColor3ivEXT, (v), (F, "glSecondaryColor3iv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ivEXT)(const GLint * v) { DISPATCH(SecondaryColor3ivEXT, (v), (F, "glSecondaryColor3ivEXT(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3s)(GLshort red, GLshort green, GLshort blue) { DISPATCH(SecondaryColor3sEXT, (red, green, blue), (F, "glSecondaryColor3s(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue) { DISPATCH(SecondaryColor3sEXT, (red, green, blue), (F, "glSecondaryColor3sEXT(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3sv)(const GLshort * v) { DISPATCH(SecondaryColor3svEXT, (v), (F, "glSecondaryColor3sv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3svEXT)(const GLshort * v) { DISPATCH(SecondaryColor3svEXT, (v), (F, "glSecondaryColor3svEXT(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ub)(GLubyte red, GLubyte green, GLubyte blue) { DISPATCH(SecondaryColor3ubEXT, (red, green, blue), (F, "glSecondaryColor3ub(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue) { DISPATCH(SecondaryColor3ubEXT, (red, green, blue), (F, "glSecondaryColor3ubEXT(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubv)(const GLubyte * v) { DISPATCH(SecondaryColor3ubvEXT, (v), (F, "glSecondaryColor3ubv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubvEXT)(const GLubyte * v) { DISPATCH(SecondaryColor3ubvEXT, (v), (F, "glSecondaryColor3ubvEXT(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ui)(GLuint red, GLuint green, GLuint blue) { DISPATCH(SecondaryColor3uiEXT, (red, green, blue), (F, "glSecondaryColor3ui(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue) { DISPATCH(SecondaryColor3uiEXT, (red, green, blue), (F, "glSecondaryColor3uiEXT(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uiv)(const GLuint * v) { DISPATCH(SecondaryColor3uivEXT, (v), (F, "glSecondaryColor3uiv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uivEXT)(const GLuint * v) { DISPATCH(SecondaryColor3uivEXT, (v), (F, "glSecondaryColor3uivEXT(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3us)(GLushort red, GLushort green, GLushort blue) { DISPATCH(SecondaryColor3usEXT, (red, green, blue), (F, "glSecondaryColor3us(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue) { DISPATCH(SecondaryColor3usEXT, (red, green, blue), (F, "glSecondaryColor3usEXT(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usv)(const GLushort * v) { DISPATCH(SecondaryColor3usvEXT, (v), (F, "glSecondaryColor3usv(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usvEXT)(const GLushort * v) { DISPATCH(SecondaryColor3usvEXT, (v), (F, "glSecondaryColor3usvEXT(%p);\n", (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) { DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) { DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointerEXT(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer)); } KEYWORD1 GLboolean KEYWORD2 NAME(AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences) { RETURN_DISPATCH(AreProgramsResidentNV, (n, ids, residences), (F, "glAreProgramsResidentNV(%d, %p, %p);\n", n, (const void *) ids, (const void *) residences)); } KEYWORD1 void KEYWORD2 NAME(BindProgramARB)(GLenum target, GLuint program) { DISPATCH(BindProgramNV, (target, program), (F, "glBindProgramARB(0x%x, %d);\n", target, program)); } KEYWORD1 void KEYWORD2 NAME(BindProgramNV)(GLenum target, GLuint program) { DISPATCH(BindProgramNV, (target, program), (F, "glBindProgramNV(0x%x, %d);\n", target, program)); } KEYWORD1 void KEYWORD2 NAME(DeleteProgramsARB)(GLsizei n, const GLuint * programs) { DISPATCH(DeleteProgramsNV, (n, programs), (F, "glDeleteProgramsARB(%d, %p);\n", n, (const void *) programs)); } KEYWORD1 void KEYWORD2 NAME(DeleteProgramsNV)(GLsizei n, const GLuint * programs) { DISPATCH(DeleteProgramsNV, (n, programs), (F, "glDeleteProgramsNV(%d, %p);\n", n, (const void *) programs)); } KEYWORD1 void KEYWORD2 NAME(ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params) { DISPATCH(ExecuteProgramNV, (target, id, params), (F, "glExecuteProgramNV(0x%x, %d, %p);\n", target, id, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GenProgramsARB)(GLsizei n, GLuint * programs) { DISPATCH(GenProgramsNV, (n, programs), (F, "glGenProgramsARB(%d, %p);\n", n, (const void *) programs)); } KEYWORD1 void KEYWORD2 NAME(GenProgramsNV)(GLsizei n, GLuint * programs) { DISPATCH(GenProgramsNV, (n, programs), (F, "glGenProgramsNV(%d, %p);\n", n, (const void *) programs)); } KEYWORD1 void KEYWORD2 NAME(GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params) { DISPATCH(GetProgramParameterdvNV, (target, index, pname, params), (F, "glGetProgramParameterdvNV(0x%x, %d, 0x%x, %p);\n", target, index, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params) { DISPATCH(GetProgramParameterfvNV, (target, index, pname, params), (F, "glGetProgramParameterfvNV(0x%x, %d, 0x%x, %p);\n", target, index, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetProgramivNV)(GLuint id, GLenum pname, GLint * params) { DISPATCH(GetProgramivNV, (id, pname, params), (F, "glGetProgramivNV(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program) { DISPATCH(GetProgramStringNV, (id, pname, program), (F, "glGetProgramStringNV(%d, 0x%x, %p);\n", id, pname, (const void *) program)); } KEYWORD1 void KEYWORD2 NAME(GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params) { DISPATCH(GetTrackMatrixivNV, (target, address, pname, params), (F, "glGetTrackMatrixivNV(0x%x, %d, 0x%x, %p);\n", target, address, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetVertexAttribdvARB)(GLuint index, GLenum pname, GLdouble * params) { DISPATCH(GetVertexAttribdvARB, (index, pname, params), (F, "glGetVertexAttribdvARB(%d, 0x%x, %p);\n", index, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetVertexAttribfvARB)(GLuint index, GLenum pname, GLfloat * params) { DISPATCH(GetVertexAttribfvARB, (index, pname, params), (F, "glGetVertexAttribfvARB(%d, 0x%x, %p);\n", index, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetVertexAttribivARB)(GLuint index, GLenum pname, GLint * params) { DISPATCH(GetVertexAttribivARB, (index, pname, params), (F, "glGetVertexAttribivARB(%d, 0x%x, %p);\n", index, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetVertexAttribPointervARB)(GLuint index, GLenum pname, GLvoid ** params) { DISPATCH(GetVertexAttribPointervNV, (index, pname, params), (F, "glGetVertexAttribPointervARB(%d, 0x%x, %p);\n", index, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** params) { DISPATCH(GetVertexAttribPointervNV, (index, pname, params), (F, "glGetVertexAttribPointervNV(%d, 0x%x, %p);\n", index, pname, (const void *) params)); } KEYWORD1 GLboolean KEYWORD2 NAME(IsProgramARB)(GLuint program) { RETURN_DISPATCH(IsProgramNV, (program), (F, "glIsProgramARB(%d);\n", program)); } KEYWORD1 GLboolean KEYWORD2 NAME(IsProgramNV)(GLuint program) { RETURN_DISPATCH(IsProgramNV, (program), (F, "glIsProgramNV(%d);\n", program)); } KEYWORD1 void KEYWORD2 NAME(LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program) { DISPATCH(LoadProgramNV, (target, id, len, program), (F, "glLoadProgramNV(0x%x, %d, %d, %p);\n", target, id, len, (const void *) program)); } KEYWORD1 void KEYWORD2 NAME(ProgramParameter4dNV)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { DISPATCH(ProgramParameter4dNV, (target, index, x, y, z, w), (F, "glProgramParameter4dNV(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(ProgramParameter4dvNV)(GLenum target, GLuint index, const GLdouble * params) { DISPATCH(ProgramParameter4dvNV, (target, index, params), (F, "glProgramParameter4dvNV(0x%x, %d, %p);\n", target, index, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ProgramParameter4fNV)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { DISPATCH(ProgramParameter4fNV, (target, index, x, y, z, w), (F, "glProgramParameter4fNV(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(ProgramParameter4fvNV)(GLenum target, GLuint index, const GLfloat * params) { DISPATCH(ProgramParameter4fvNV, (target, index, params), (F, "glProgramParameter4fvNV(0x%x, %d, %p);\n", target, index, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params) { DISPATCH(ProgramParameters4dvNV, (target, index, num, params), (F, "glProgramParameters4dvNV(0x%x, %d, %d, %p);\n", target, index, num, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params) { DISPATCH(ProgramParameters4fvNV, (target, index, num, params), (F, "glProgramParameters4fvNV(0x%x, %d, %d, %p);\n", target, index, num, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(RequestResidentProgramsNV)(GLsizei n, const GLuint * ids) { DISPATCH(RequestResidentProgramsNV, (n, ids), (F, "glRequestResidentProgramsNV(%d, %p);\n", n, (const void *) ids)); } KEYWORD1 void KEYWORD2 NAME(TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform) { DISPATCH(TrackMatrixNV, (target, address, matrix, transform), (F, "glTrackMatrixNV(0x%x, %d, 0x%x, 0x%x);\n", target, address, matrix, transform)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) { DISPATCH(VertexAttribPointerNV, (index, size, type, stride, pointer), (F, "glVertexAttribPointerNV(%d, %d, 0x%x, %d, %p);\n", index, size, type, stride, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dARB)(GLuint index, GLdouble x) { DISPATCH(VertexAttrib1dARB, (index, x), (F, "glVertexAttrib1dARB(%d, %f);\n", index, x)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dvARB)(GLuint index, const GLdouble * v) { DISPATCH(VertexAttrib1dvARB, (index, v), (F, "glVertexAttrib1dvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fARB)(GLuint index, GLfloat x) { DISPATCH(VertexAttrib1fARB, (index, x), (F, "glVertexAttrib1fARB(%d, %f);\n", index, x)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fvARB)(GLuint index, const GLfloat * v) { DISPATCH(VertexAttrib1fvARB, (index, v), (F, "glVertexAttrib1fvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib1sARB)(GLuint index, GLshort x) { DISPATCH(VertexAttrib1sARB, (index, x), (F, "glVertexAttrib1sARB(%d, %d);\n", index, x)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib1svARB)(GLuint index, const GLshort * v) { DISPATCH(VertexAttrib1svARB, (index, v), (F, "glVertexAttrib1svARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dARB)(GLuint index, GLdouble x, GLdouble y) { DISPATCH(VertexAttrib2dARB, (index, x, y), (F, "glVertexAttrib2dARB(%d, %f, %f);\n", index, x, y)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dvARB)(GLuint index, const GLdouble * v) { DISPATCH(VertexAttrib2dvARB, (index, v), (F, "glVertexAttrib2dvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y) { DISPATCH(VertexAttrib2fARB, (index, x, y), (F, "glVertexAttrib2fARB(%d, %f, %f);\n", index, x, y)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fvARB)(GLuint index, const GLfloat * v) { DISPATCH(VertexAttrib2fvARB, (index, v), (F, "glVertexAttrib2fvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib2sARB)(GLuint index, GLshort x, GLshort y) { DISPATCH(VertexAttrib2sARB, (index, x, y), (F, "glVertexAttrib2sARB(%d, %d, %d);\n", index, x, y)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib2svARB)(GLuint index, const GLshort * v) { DISPATCH(VertexAttrib2svARB, (index, v), (F, "glVertexAttrib2svARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z) { DISPATCH(VertexAttrib3dARB, (index, x, y, z), (F, "glVertexAttrib3dARB(%d, %f, %f, %f);\n", index, x, y, z)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dvARB)(GLuint index, const GLdouble * v) { DISPATCH(VertexAttrib3dvARB, (index, v), (F, "glVertexAttrib3dvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z) { DISPATCH(VertexAttrib3fARB, (index, x, y, z), (F, "glVertexAttrib3fARB(%d, %f, %f, %f);\n", index, x, y, z)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fvARB)(GLuint index, const GLfloat * v) { DISPATCH(VertexAttrib3fvARB, (index, v), (F, "glVertexAttrib3fvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib3sARB)(GLuint index, GLshort x, GLshort y, GLshort z) { DISPATCH(VertexAttrib3sARB, (index, x, y, z), (F, "glVertexAttrib3sARB(%d, %d, %d, %d);\n", index, x, y, z)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib3svARB)(GLuint index, const GLshort * v) { DISPATCH(VertexAttrib3svARB, (index, v), (F, "glVertexAttrib3svARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { DISPATCH(VertexAttrib4dARB, (index, x, y, z, w), (F, "glVertexAttrib4dARB(%d, %f, %f, %f, %f);\n", index, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dvARB)(GLuint index, const GLdouble * v) { DISPATCH(VertexAttrib4dvARB, (index, v), (F, "glVertexAttrib4dvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { DISPATCH(VertexAttrib4fARB, (index, x, y, z, w), (F, "glVertexAttrib4fARB(%d, %f, %f, %f, %f);\n", index, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fvARB)(GLuint index, const GLfloat * v) { DISPATCH(VertexAttrib4fvARB, (index, v), (F, "glVertexAttrib4fvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4sARB)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) { DISPATCH(VertexAttrib4sARB, (index, x, y, z, w), (F, "glVertexAttrib4sARB(%d, %d, %d, %d, %d);\n", index, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4svARB)(GLuint index, const GLshort * v) { DISPATCH(VertexAttrib4svARB, (index, v), (F, "glVertexAttrib4svARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NubARB)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) { DISPATCH(VertexAttrib4NubARB, (index, x, y, z, w), (F, "glVertexAttrib4NubARB(%d, %d, %d, %d, %d);\n", index, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NubvARB)(GLuint index, const GLubyte * v) { DISPATCH(VertexAttrib4NubvARB, (index, v), (F, "glVertexAttrib4NubvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v) { DISPATCH(VertexAttribs1dvNV, (index, n, v), (F, "glVertexAttribs1dvNV(%d, %d, %p);\n", index, n, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v) { DISPATCH(VertexAttribs1fvNV, (index, n, v), (F, "glVertexAttribs1fvNV(%d, %d, %p);\n", index, n, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v) { DISPATCH(VertexAttribs1svNV, (index, n, v), (F, "glVertexAttribs1svNV(%d, %d, %p);\n", index, n, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v) { DISPATCH(VertexAttribs2dvNV, (index, n, v), (F, "glVertexAttribs2dvNV(%d, %d, %p);\n", index, n, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v) { DISPATCH(VertexAttribs2fvNV, (index, n, v), (F, "glVertexAttribs2fvNV(%d, %d, %p);\n", index, n, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v) { DISPATCH(VertexAttribs2svNV, (index, n, v), (F, "glVertexAttribs2svNV(%d, %d, %p);\n", index, n, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v) { DISPATCH(VertexAttribs3dvNV, (index, n, v), (F, "glVertexAttribs3dvNV(%d, %d, %p);\n", index, n, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v) { DISPATCH(VertexAttribs3fvNV, (index, n, v), (F, "glVertexAttribs3fvNV(%d, %d, %p);\n", index, n, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v) { DISPATCH(VertexAttribs3svNV, (index, n, v), (F, "glVertexAttribs3svNV(%d, %d, %p);\n", index, n, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v) { DISPATCH(VertexAttribs4dvNV, (index, n, v), (F, "glVertexAttribs4dvNV(%d, %d, %p);\n", index, n, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v) { DISPATCH(VertexAttribs4fvNV, (index, n, v), (F, "glVertexAttribs4fvNV(%d, %d, %p);\n", index, n, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v) { DISPATCH(VertexAttribs4svNV, (index, n, v), (F, "glVertexAttribs4svNV(%d, %d, %p);\n", index, n, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v) { DISPATCH(VertexAttribs4ubvNV, (index, n, v), (F, "glVertexAttribs4ubvNV(%d, %d, %p);\n", index, n, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(PointParameteri)(GLenum pname, GLint param) { DISPATCH(PointParameteriNV, (pname, param), (F, "glPointParameteri(0x%x, %d);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(PointParameteriNV)(GLenum pname, GLint param) { DISPATCH(PointParameteriNV, (pname, param), (F, "glPointParameteriNV(0x%x, %d);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(PointParameteriv)(GLenum pname, const GLint * params) { DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameteriv(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(PointParameterivNV)(GLenum pname, const GLint * params) { DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameterivNV(0x%x, %p);\n", pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(MultiDrawArrays)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount) { DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArrays(0x%x, %p, %p, %d);\n", mode, (const void *) first, (const void *) count, primcount)); } KEYWORD1 void KEYWORD2 NAME(MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount) { DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArraysEXT(0x%x, %p, %p, %d);\n", mode, (const void *) first, (const void *) count, primcount)); } KEYWORD1 void KEYWORD2 NAME(MultiDrawElements)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount) { DISPATCH(MultiDrawElementsEXT, (mode, count, type, indices, primcount), (F, "glMultiDrawElements(0x%x, %p, 0x%x, %p, %d);\n", mode, (const void *) count, type, (const void *) indices, primcount)); } KEYWORD1 void KEYWORD2 NAME(MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount) { DISPATCH(MultiDrawElementsEXT, (mode, count, type, indices, primcount), (F, "glMultiDrawElementsEXT(0x%x, %p, 0x%x, %p, %d);\n", mode, (const void *) count, type, (const void *) indices, primcount)); } KEYWORD1 void KEYWORD2 NAME(ActiveStencilFaceEXT)(GLenum face) { DISPATCH(ActiveStencilFaceEXT, (face), (F, "glActiveStencilFaceEXT(0x%x);\n", face)); } KEYWORD1 void KEYWORD2 NAME(DeleteFencesNV)(GLsizei n, const GLuint * fences) { DISPATCH(DeleteFencesNV, (n, fences), (F, "glDeleteFencesNV(%d, %p);\n", n, (const void *) fences)); } KEYWORD1 void KEYWORD2 NAME(GenFencesNV)(GLsizei n, GLuint * fences) { DISPATCH(GenFencesNV, (n, fences), (F, "glGenFencesNV(%d, %p);\n", n, (const void *) fences)); } KEYWORD1 GLboolean KEYWORD2 NAME(IsFenceNV)(GLuint fence) { RETURN_DISPATCH(IsFenceNV, (fence), (F, "glIsFenceNV(%d);\n", fence)); } KEYWORD1 GLboolean KEYWORD2 NAME(TestFenceNV)(GLuint fence) { RETURN_DISPATCH(TestFenceNV, (fence), (F, "glTestFenceNV(%d);\n", fence)); } KEYWORD1 void KEYWORD2 NAME(GetFenceivNV)(GLuint fence, GLenum pname, GLint * params) { DISPATCH(GetFenceivNV, (fence, pname, params), (F, "glGetFenceivNV(%d, 0x%x, %p);\n", fence, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(FinishFenceNV)(GLuint fence) { DISPATCH(FinishFenceNV, (fence), (F, "glFinishFenceNV(%d);\n", fence)); } KEYWORD1 void KEYWORD2 NAME(SetFenceNV)(GLuint fence, GLenum condition) { DISPATCH(SetFenceNV, (fence, condition), (F, "glSetFenceNV(%d, 0x%x);\n", fence, condition)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4bvARB)(GLuint index, const GLbyte * v) { DISPATCH(VertexAttrib4bvARB, (index, v), (F, "glVertexAttrib4bvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ivARB)(GLuint index, const GLint * v) { DISPATCH(VertexAttrib4ivARB, (index, v), (F, "glVertexAttrib4ivARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubvARB)(GLuint index, const GLubyte * v) { DISPATCH(VertexAttrib4ubvARB, (index, v), (F, "glVertexAttrib4ubvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4usvARB)(GLuint index, const GLushort * v) { DISPATCH(VertexAttrib4usvARB, (index, v), (F, "glVertexAttrib4usvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4uivARB)(GLuint index, const GLuint * v) { DISPATCH(VertexAttrib4uivARB, (index, v), (F, "glVertexAttrib4uivARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NbvARB)(GLuint index, const GLbyte * v) { DISPATCH(VertexAttrib4NbvARB, (index, v), (F, "glVertexAttrib4NbvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NsvARB)(GLuint index, const GLshort * v) { DISPATCH(VertexAttrib4NsvARB, (index, v), (F, "glVertexAttrib4NsvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NivARB)(GLuint index, const GLint * v) { DISPATCH(VertexAttrib4NivARB, (index, v), (F, "glVertexAttrib4NivARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NusvARB)(GLuint index, const GLushort * v) { DISPATCH(VertexAttrib4NusvARB, (index, v), (F, "glVertexAttrib4NusvARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4NuivARB)(GLuint index, const GLuint * v) { DISPATCH(VertexAttrib4NuivARB, (index, v), (F, "glVertexAttrib4NuivARB(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer) { DISPATCH(VertexAttribPointerARB, (index, size, type, normalized, stride, pointer), (F, "glVertexAttribPointerARB(%d, %d, 0x%x, %d, %d, %p);\n", index, size, type, normalized, stride, (const void *) pointer)); } KEYWORD1 void KEYWORD2 NAME(EnableVertexAttribArrayARB)(GLuint index) { DISPATCH(EnableVertexAttribArrayARB, (index), (F, "glEnableVertexAttribArrayARB(%d);\n", index)); } KEYWORD1 void KEYWORD2 NAME(DisableVertexAttribArrayARB)(GLuint index) { DISPATCH(DisableVertexAttribArrayARB, (index), (F, "glDisableVertexAttribArrayARB(%d);\n", index)); } KEYWORD1 void KEYWORD2 NAME(ProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid * string) { DISPATCH(ProgramStringARB, (target, format, len, string), (F, "glProgramStringARB(0x%x, 0x%x, %d, %p);\n", target, format, len, (const void *) string)); } KEYWORD1 void KEYWORD2 NAME(ProgramEnvParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { DISPATCH(ProgramEnvParameter4dARB, (target, index, x, y, z, w), (F, "glProgramEnvParameter4dARB(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(ProgramEnvParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params) { DISPATCH(ProgramEnvParameter4dvARB, (target, index, params), (F, "glProgramEnvParameter4dvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ProgramEnvParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { DISPATCH(ProgramEnvParameter4fARB, (target, index, x, y, z, w), (F, "glProgramEnvParameter4fARB(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(ProgramEnvParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params) { DISPATCH(ProgramEnvParameter4fvARB, (target, index, params), (F, "glProgramEnvParameter4fvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { DISPATCH(ProgramLocalParameter4dARB, (target, index, x, y, z, w), (F, "glProgramLocalParameter4dARB(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(ProgramLocalParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params) { DISPATCH(ProgramLocalParameter4dvARB, (target, index, params), (F, "glProgramLocalParameter4dvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(ProgramLocalParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { DISPATCH(ProgramLocalParameter4fARB, (target, index, x, y, z, w), (F, "glProgramLocalParameter4fARB(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(ProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params) { DISPATCH(ProgramLocalParameter4fvARB, (target, index, params), (F, "glProgramLocalParameter4fvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetProgramEnvParameterdvARB)(GLenum target, GLuint index, GLdouble * params) { DISPATCH(GetProgramEnvParameterdvARB, (target, index, params), (F, "glGetProgramEnvParameterdvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetProgramEnvParameterfvARB)(GLenum target, GLuint index, GLfloat * params) { DISPATCH(GetProgramEnvParameterfvARB, (target, index, params), (F, "glGetProgramEnvParameterfvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble * params) { DISPATCH(GetProgramLocalParameterdvARB, (target, index, params), (F, "glGetProgramLocalParameterdvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetProgramLocalParameterfvARB)(GLenum target, GLuint index, GLfloat * params) { DISPATCH(GetProgramLocalParameterfvARB, (target, index, params), (F, "glGetProgramLocalParameterfvARB(0x%x, %d, %p);\n", target, index, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetProgramivARB)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetProgramivARB, (target, pname, params), (F, "glGetProgramivARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetProgramStringARB)(GLenum target, GLenum pname, GLvoid * string) { DISPATCH(GetProgramStringARB, (target, pname, string), (F, "glGetProgramStringARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) string)); } KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { DISPATCH(ProgramNamedParameter4fNV, (id, len, name, x, y, z, w), (F, "glProgramNamedParameter4fNV(%d, %d, %p, %f, %f, %f, %f);\n", id, len, (const void *) name, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { DISPATCH(ProgramNamedParameter4dNV, (id, len, name, x, y, z, w), (F, "glProgramNamedParameter4dNV(%d, %d, %p, %f, %f, %f, %f);\n", id, len, (const void *) name, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v) { DISPATCH(ProgramNamedParameter4fvNV, (id, len, name, v), (F, "glProgramNamedParameter4fvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v) { DISPATCH(ProgramNamedParameter4dvNV, (id, len, name, v), (F, "glProgramNamedParameter4dvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params) { DISPATCH(GetProgramNamedParameterfvNV, (id, len, name, params), (F, "glGetProgramNamedParameterfvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params) { DISPATCH(GetProgramNamedParameterdvNV, (id, len, name, params), (F, "glGetProgramNamedParameterdvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(BindBuffer)(GLenum target, GLuint buffer) { DISPATCH(BindBufferARB, (target, buffer), (F, "glBindBuffer(0x%x, %d);\n", target, buffer)); } KEYWORD1 void KEYWORD2 NAME(BindBufferARB)(GLenum target, GLuint buffer) { DISPATCH(BindBufferARB, (target, buffer), (F, "glBindBufferARB(0x%x, %d);\n", target, buffer)); } KEYWORD1 void KEYWORD2 NAME(BufferData)(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage) { DISPATCH(BufferDataARB, (target, size, data, usage), (F, "glBufferData(0x%x, %d, %p, 0x%x);\n", target, size, (const void *) data, usage)); } KEYWORD1 void KEYWORD2 NAME(BufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage) { DISPATCH(BufferDataARB, (target, size, data, usage), (F, "glBufferDataARB(0x%x, %d, %p, 0x%x);\n", target, size, (const void *) data, usage)); } KEYWORD1 void KEYWORD2 NAME(BufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data) { DISPATCH(BufferSubDataARB, (target, offset, size, data), (F, "glBufferSubData(0x%x, %d, %d, %p);\n", target, offset, size, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(BufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data) { DISPATCH(BufferSubDataARB, (target, offset, size, data), (F, "glBufferSubDataARB(0x%x, %d, %d, %p);\n", target, offset, size, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(DeleteBuffers)(GLsizei n, const GLuint * buffer) { DISPATCH(DeleteBuffersARB, (n, buffer), (F, "glDeleteBuffers(%d, %p);\n", n, (const void *) buffer)); } KEYWORD1 void KEYWORD2 NAME(DeleteBuffersARB)(GLsizei n, const GLuint * buffer) { DISPATCH(DeleteBuffersARB, (n, buffer), (F, "glDeleteBuffersARB(%d, %p);\n", n, (const void *) buffer)); } KEYWORD1 void KEYWORD2 NAME(GenBuffers)(GLsizei n, GLuint * buffer) { DISPATCH(GenBuffersARB, (n, buffer), (F, "glGenBuffers(%d, %p);\n", n, (const void *) buffer)); } KEYWORD1 void KEYWORD2 NAME(GenBuffersARB)(GLsizei n, GLuint * buffer) { DISPATCH(GenBuffersARB, (n, buffer), (F, "glGenBuffersARB(%d, %p);\n", n, (const void *) buffer)); } KEYWORD1 void KEYWORD2 NAME(GetBufferParameteriv)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetBufferParameterivARB, (target, pname, params), (F, "glGetBufferParameteriv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetBufferParameterivARB)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetBufferParameterivARB, (target, pname, params), (F, "glGetBufferParameterivARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetBufferPointerv)(GLenum target, GLenum pname, GLvoid ** params) { DISPATCH(GetBufferPointervARB, (target, pname, params), (F, "glGetBufferPointerv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetBufferPointervARB)(GLenum target, GLenum pname, GLvoid ** params) { DISPATCH(GetBufferPointervARB, (target, pname, params), (F, "glGetBufferPointervARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid * data) { DISPATCH(GetBufferSubDataARB, (target, offset, size, data), (F, "glGetBufferSubData(0x%x, %d, %d, %p);\n", target, offset, size, (const void *) data)); } KEYWORD1 void KEYWORD2 NAME(GetBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data) { DISPATCH(GetBufferSubDataARB, (target, offset, size, data), (F, "glGetBufferSubDataARB(0x%x, %d, %d, %p);\n", target, offset, size, (const void *) data)); } KEYWORD1 GLboolean KEYWORD2 NAME(IsBuffer)(GLuint buffer) { RETURN_DISPATCH(IsBufferARB, (buffer), (F, "glIsBuffer(%d);\n", buffer)); } KEYWORD1 GLboolean KEYWORD2 NAME(IsBufferARB)(GLuint buffer) { RETURN_DISPATCH(IsBufferARB, (buffer), (F, "glIsBufferARB(%d);\n", buffer)); } KEYWORD1 GLvoid * KEYWORD2 NAME(MapBuffer)(GLenum target, GLenum access) { RETURN_DISPATCH(MapBufferARB, (target, access), (F, "glMapBuffer(0x%x, 0x%x);\n", target, access)); } KEYWORD1 GLvoid * KEYWORD2 NAME(MapBufferARB)(GLenum target, GLenum access) { RETURN_DISPATCH(MapBufferARB, (target, access), (F, "glMapBufferARB(0x%x, 0x%x);\n", target, access)); } KEYWORD1 GLboolean KEYWORD2 NAME(UnmapBuffer)(GLenum target) { RETURN_DISPATCH(UnmapBufferARB, (target), (F, "glUnmapBuffer(0x%x);\n", target)); } KEYWORD1 GLboolean KEYWORD2 NAME(UnmapBufferARB)(GLenum target) { RETURN_DISPATCH(UnmapBufferARB, (target), (F, "glUnmapBufferARB(0x%x);\n", target)); } KEYWORD1 void KEYWORD2 NAME(DepthBoundsEXT)(GLclampd zmin, GLclampd zmax) { DISPATCH(DepthBoundsEXT, (zmin, zmax), (F, "glDepthBoundsEXT(%f, %f);\n", zmin, zmax)); } KEYWORD1 void KEYWORD2 NAME(GenQueries)(GLsizei n, GLuint * ids) { DISPATCH(GenQueriesARB, (n, ids), (F, "glGenQueries(%d, %p);\n", n, (const void *) ids)); } KEYWORD1 void KEYWORD2 NAME(GenQueriesARB)(GLsizei n, GLuint * ids) { DISPATCH(GenQueriesARB, (n, ids), (F, "glGenQueriesARB(%d, %p);\n", n, (const void *) ids)); } KEYWORD1 void KEYWORD2 NAME(DeleteQueries)(GLsizei n, const GLuint * ids) { DISPATCH(DeleteQueriesARB, (n, ids), (F, "glDeleteQueries(%d, %p);\n", n, (const void *) ids)); } KEYWORD1 void KEYWORD2 NAME(DeleteQueriesARB)(GLsizei n, const GLuint * ids) { DISPATCH(DeleteQueriesARB, (n, ids), (F, "glDeleteQueriesARB(%d, %p);\n", n, (const void *) ids)); } KEYWORD1 GLboolean KEYWORD2 NAME(IsQuery)(GLuint id) { RETURN_DISPATCH(IsQueryARB, (id), (F, "glIsQuery(%d);\n", id)); } KEYWORD1 GLboolean KEYWORD2 NAME(IsQueryARB)(GLuint id) { RETURN_DISPATCH(IsQueryARB, (id), (F, "glIsQueryARB(%d);\n", id)); } KEYWORD1 void KEYWORD2 NAME(BeginQuery)(GLenum target, GLuint id) { DISPATCH(BeginQueryARB, (target, id), (F, "glBeginQuery(0x%x, %d);\n", target, id)); } KEYWORD1 void KEYWORD2 NAME(BeginQueryARB)(GLenum target, GLuint id) { DISPATCH(BeginQueryARB, (target, id), (F, "glBeginQueryARB(0x%x, %d);\n", target, id)); } KEYWORD1 void KEYWORD2 NAME(EndQuery)(GLenum target) { DISPATCH(EndQueryARB, (target), (F, "glEndQuery(0x%x);\n", target)); } KEYWORD1 void KEYWORD2 NAME(EndQueryARB)(GLenum target) { DISPATCH(EndQueryARB, (target), (F, "glEndQueryARB(0x%x);\n", target)); } KEYWORD1 void KEYWORD2 NAME(GetQueryiv)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetQueryivARB, (target, pname, params), (F, "glGetQueryiv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetQueryivARB)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetQueryivARB, (target, pname, params), (F, "glGetQueryivARB(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetQueryObjectiv)(GLuint id, GLenum pname, GLint * params) { DISPATCH(GetQueryObjectivARB, (id, pname, params), (F, "glGetQueryObjectiv(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetQueryObjectivARB)(GLuint id, GLenum pname, GLint * params) { DISPATCH(GetQueryObjectivARB, (id, pname, params), (F, "glGetQueryObjectivARB(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetQueryObjectuiv)(GLuint id, GLenum pname, GLuint * params) { DISPATCH(GetQueryObjectuivARB, (id, pname, params), (F, "glGetQueryObjectuiv(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint * params) { DISPATCH(GetQueryObjectuivARB, (id, pname, params), (F, "glGetQueryObjectuivARB(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride) { DISPATCH(MultiModeDrawArraysIBM, (mode, first, count, primcount, modestride), (F, "glMultiModeDrawArraysIBM(%p, %p, %p, %d, %d);\n", (const void *) mode, (const void *) first, (const void *) count, primcount, modestride)); } KEYWORD1 void KEYWORD2 NAME(MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride) { DISPATCH(MultiModeDrawElementsIBM, (mode, count, type, indices, primcount, modestride), (F, "glMultiModeDrawElementsIBM(%p, %p, 0x%x, %p, %d, %d);\n", (const void *) mode, (const void *) count, type, (const void *) indices, primcount, modestride)); } KEYWORD1 void KEYWORD2 NAME(BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA) { DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparateEXT(0x%x, 0x%x);\n", modeRGB, modeA)); } KEYWORD1 void KEYWORD2 NAME(BlendEquationSeparateATI)(GLenum modeRGB, GLenum modeA) { DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparateATI(0x%x, 0x%x);\n", modeRGB, modeA)); } KEYWORD1 void KEYWORD2 NAME(DeleteObjectARB)(GLhandleARB obj) { DISPATCH(DeleteObjectARB, (obj), (F, "glDeleteObjectARB(%d);\n", obj)); } KEYWORD1 GLhandleARB KEYWORD2 NAME(GetHandleARB)(GLenum pname) { RETURN_DISPATCH(GetHandleARB, (pname), (F, "glGetHandleARB(0x%x);\n", pname)); } KEYWORD1 void KEYWORD2 NAME(DetachObjectARB)(GLhandleARB containerObj, GLhandleARB attachedObj) { DISPATCH(DetachObjectARB, (containerObj, attachedObj), (F, "glDetachObjectARB(%d, %d);\n", containerObj, attachedObj)); } KEYWORD1 GLhandleARB KEYWORD2 NAME(CreateShaderObjectARB)(GLenum shaderType) { RETURN_DISPATCH(CreateShaderObjectARB, (shaderType), (F, "glCreateShaderObjectARB(0x%x);\n", shaderType)); } KEYWORD1 void KEYWORD2 NAME(ShaderSourceARB)(GLhandleARB shaderObj, GLsizei count, const GLcharARB ** string, const GLint * length) { DISPATCH(ShaderSourceARB, (shaderObj, count, string, length), (F, "glShaderSourceARB(%d, %d, %p, %p);\n", shaderObj, count, (const void *) string, (const void *) length)); } KEYWORD1 void KEYWORD2 NAME(CompileShaderARB)(GLhandleARB shaderObj) { DISPATCH(CompileShaderARB, (shaderObj), (F, "glCompileShaderARB(%d);\n", shaderObj)); } KEYWORD1 GLhandleARB KEYWORD2 NAME(CreateProgramObjectARB)(void) { RETURN_DISPATCH(CreateProgramObjectARB, (), (F, "glCreateProgramObjectARB();\n")); } KEYWORD1 void KEYWORD2 NAME(AttachObjectARB)(GLhandleARB containerObj, GLhandleARB obj) { DISPATCH(AttachObjectARB, (containerObj, obj), (F, "glAttachObjectARB(%d, %d);\n", containerObj, obj)); } KEYWORD1 void KEYWORD2 NAME(LinkProgramARB)(GLhandleARB programObj) { DISPATCH(LinkProgramARB, (programObj), (F, "glLinkProgramARB(%d);\n", programObj)); } KEYWORD1 void KEYWORD2 NAME(UseProgramObjectARB)(GLhandleARB programObj) { DISPATCH(UseProgramObjectARB, (programObj), (F, "glUseProgramObjectARB(%d);\n", programObj)); } KEYWORD1 void KEYWORD2 NAME(ValidateProgramARB)(GLhandleARB programObj) { DISPATCH(ValidateProgramARB, (programObj), (F, "glValidateProgramARB(%d);\n", programObj)); } KEYWORD1 void KEYWORD2 NAME(Uniform1fARB)(GLint location, GLfloat v0) { DISPATCH(Uniform1fARB, (location, v0), (F, "glUniform1fARB(%d, %f);\n", location, v0)); } KEYWORD1 void KEYWORD2 NAME(Uniform2fARB)(GLint location, GLfloat v0, GLfloat v1) { DISPATCH(Uniform2fARB, (location, v0, v1), (F, "glUniform2fARB(%d, %f, %f);\n", location, v0, v1)); } KEYWORD1 void KEYWORD2 NAME(Uniform3fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) { DISPATCH(Uniform3fARB, (location, v0, v1, v2), (F, "glUniform3fARB(%d, %f, %f, %f);\n", location, v0, v1, v2)); } KEYWORD1 void KEYWORD2 NAME(Uniform4fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { DISPATCH(Uniform4fARB, (location, v0, v1, v2, v3), (F, "glUniform4fARB(%d, %f, %f, %f, %f);\n", location, v0, v1, v2, v3)); } KEYWORD1 void KEYWORD2 NAME(Uniform1iARB)(GLint location, GLint v0) { DISPATCH(Uniform1iARB, (location, v0), (F, "glUniform1iARB(%d, %d);\n", location, v0)); } KEYWORD1 void KEYWORD2 NAME(Uniform2iARB)(GLint location, GLint v0, GLint v1) { DISPATCH(Uniform2iARB, (location, v0, v1), (F, "glUniform2iARB(%d, %d, %d);\n", location, v0, v1)); } KEYWORD1 void KEYWORD2 NAME(Uniform3iARB)(GLint location, GLint v0, GLint v1, GLint v2) { DISPATCH(Uniform3iARB, (location, v0, v1, v2), (F, "glUniform3iARB(%d, %d, %d, %d);\n", location, v0, v1, v2)); } KEYWORD1 void KEYWORD2 NAME(Uniform4iARB)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) { DISPATCH(Uniform4iARB, (location, v0, v1, v2, v3), (F, "glUniform4iARB(%d, %d, %d, %d, %d);\n", location, v0, v1, v2, v3)); } KEYWORD1 void KEYWORD2 NAME(Uniform1fvARB)(GLint location, GLsizei count, const GLfloat * value) { DISPATCH(Uniform1fvARB, (location, count, value), (F, "glUniform1fvARB(%d, %d, %p);\n", location, count, (const void *) value)); } KEYWORD1 void KEYWORD2 NAME(Uniform2fvARB)(GLint location, GLsizei count, const GLfloat * value) { DISPATCH(Uniform2fvARB, (location, count, value), (F, "glUniform2fvARB(%d, %d, %p);\n", location, count, (const void *) value)); } KEYWORD1 void KEYWORD2 NAME(Uniform3fvARB)(GLint location, GLsizei count, const GLfloat * value) { DISPATCH(Uniform3fvARB, (location, count, value), (F, "glUniform3fvARB(%d, %d, %p);\n", location, count, (const void *) value)); } KEYWORD1 void KEYWORD2 NAME(Uniform4fvARB)(GLint location, GLsizei count, const GLfloat * value) { DISPATCH(Uniform4fvARB, (location, count, value), (F, "glUniform4fvARB(%d, %d, %p);\n", location, count, (const void *) value)); } KEYWORD1 void KEYWORD2 NAME(Uniform1ivARB)(GLint location, GLsizei count, const GLint * value) { DISPATCH(Uniform1ivARB, (location, count, value), (F, "glUniform1ivARB(%d, %d, %p);\n", location, count, (const void *) value)); } KEYWORD1 void KEYWORD2 NAME(Uniform2ivARB)(GLint location, GLsizei count, const GLint * value) { DISPATCH(Uniform2ivARB, (location, count, value), (F, "glUniform2ivARB(%d, %d, %p);\n", location, count, (const void *) value)); } KEYWORD1 void KEYWORD2 NAME(Uniform3ivARB)(GLint location, GLsizei count, const GLint * value) { DISPATCH(Uniform3ivARB, (location, count, value), (F, "glUniform3ivARB(%d, %d, %p);\n", location, count, (const void *) value)); } KEYWORD1 void KEYWORD2 NAME(Uniform4ivARB)(GLint location, GLsizei count, const GLint * value) { DISPATCH(Uniform4ivARB, (location, count, value), (F, "glUniform4ivARB(%d, %d, %p);\n", location, count, (const void *) value)); } KEYWORD1 void KEYWORD2 NAME(UniformMatrix2fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { DISPATCH(UniformMatrix2fvARB, (location, count, transpose, value), (F, "glUniformMatrix2fvARB(%d, %d, %d, %p);\n", location, count, transpose, (const void *) value)); } KEYWORD1 void KEYWORD2 NAME(UniformMatrix3fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { DISPATCH(UniformMatrix3fvARB, (location, count, transpose, value), (F, "glUniformMatrix3fvARB(%d, %d, %d, %p);\n", location, count, transpose, (const void *) value)); } KEYWORD1 void KEYWORD2 NAME(UniformMatrix4fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { DISPATCH(UniformMatrix4fvARB, (location, count, transpose, value), (F, "glUniformMatrix4fvARB(%d, %d, %d, %p);\n", location, count, transpose, (const void *) value)); } KEYWORD1 void KEYWORD2 NAME(GetObjectParameterfvARB)(GLhandleARB obj, GLenum pname, GLfloat * params) { DISPATCH(GetObjectParameterfvARB, (obj, pname, params), (F, "glGetObjectParameterfvARB(%d, 0x%x, %p);\n", obj, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetObjectParameterivARB)(GLhandleARB obj, GLenum pname, GLint * params) { DISPATCH(GetObjectParameterivARB, (obj, pname, params), (F, "glGetObjectParameterivARB(%d, 0x%x, %p);\n", obj, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetInfoLogARB)(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog) { DISPATCH(GetInfoLogARB, (obj, maxLength, length, infoLog), (F, "glGetInfoLogARB(%d, %d, %p, %p);\n", obj, maxLength, (const void *) length, (const void *) infoLog)); } KEYWORD1 void KEYWORD2 NAME(GetAttachedObjectsARB)(GLhandleARB containerObj, GLsizei maxLength, GLsizei * length, GLhandleARB * infoLog) { DISPATCH(GetAttachedObjectsARB, (containerObj, maxLength, length, infoLog), (F, "glGetAttachedObjectsARB(%d, %d, %p, %p);\n", containerObj, maxLength, (const void *) length, (const void *) infoLog)); } KEYWORD1 GLint KEYWORD2 NAME(GetUniformLocationARB)(GLhandleARB programObj, const GLcharARB * name) { RETURN_DISPATCH(GetUniformLocationARB, (programObj, name), (F, "glGetUniformLocationARB(%d, %p);\n", programObj, (const void *) name)); } KEYWORD1 void KEYWORD2 NAME(GetActiveUniformARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name) { DISPATCH(GetActiveUniformARB, (programObj, index, maxLength, length, size, type, name), (F, "glGetActiveUniformARB(%d, %d, %d, %p, %p, %p, %p);\n", programObj, index, maxLength, (const void *) length, (const void *) size, (const void *) type, (const void *) name)); } KEYWORD1 void KEYWORD2 NAME(GetUniformfvARB)(GLhandleARB programObj, GLint location, GLfloat * params) { DISPATCH(GetUniformfvARB, (programObj, location, params), (F, "glGetUniformfvARB(%d, %d, %p);\n", programObj, location, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetUniformivARB)(GLhandleARB programObj, GLint location, GLint * params) { DISPATCH(GetUniformivARB, (programObj, location, params), (F, "glGetUniformivARB(%d, %d, %p);\n", programObj, location, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetShaderSourceARB)(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * source) { DISPATCH(GetShaderSourceARB, (obj, maxLength, length, source), (F, "glGetShaderSourceARB(%d, %d, %p, %p);\n", obj, maxLength, (const void *) length, (const void *) source)); } KEYWORD1 void KEYWORD2 NAME(BindAttribLocationARB)(GLhandleARB programObj, GLuint index, const GLcharARB * name) { DISPATCH(BindAttribLocationARB, (programObj, index, name), (F, "glBindAttribLocationARB(%d, %d, %p);\n", programObj, index, (const void *) name)); } KEYWORD1 void KEYWORD2 NAME(GetActiveAttribARB)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name) { DISPATCH(GetActiveAttribARB, (programObj, index, maxLength, length, size, type, name), (F, "glGetActiveAttribARB(%d, %d, %d, %p, %p, %p, %p);\n", programObj, index, maxLength, (const void *) length, (const void *) size, (const void *) type, (const void *) name)); } KEYWORD1 GLint KEYWORD2 NAME(GetAttribLocationARB)(GLhandleARB programObj, const GLcharARB * name) { RETURN_DISPATCH(GetAttribLocationARB, (programObj, name), (F, "glGetAttribLocationARB(%d, %p);\n", programObj, (const void *) name)); } KEYWORD1 void KEYWORD2 NAME(GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params) { DISPATCH(GetVertexAttribdvNV, (index, pname, params), (F, "glGetVertexAttribdvNV(%d, 0x%x, %p);\n", index, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params) { DISPATCH(GetVertexAttribfvNV, (index, pname, params), (F, "glGetVertexAttribfvNV(%d, 0x%x, %p);\n", index, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params) { DISPATCH(GetVertexAttribivNV, (index, pname, params), (F, "glGetVertexAttribivNV(%d, 0x%x, %p);\n", index, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dNV)(GLuint index, GLdouble x) { DISPATCH(VertexAttrib1dNV, (index, x), (F, "glVertexAttrib1dNV(%d, %f);\n", index, x)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dvNV)(GLuint index, const GLdouble * v) { DISPATCH(VertexAttrib1dvNV, (index, v), (F, "glVertexAttrib1dvNV(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fNV)(GLuint index, GLfloat x) { DISPATCH(VertexAttrib1fNV, (index, x), (F, "glVertexAttrib1fNV(%d, %f);\n", index, x)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fvNV)(GLuint index, const GLfloat * v) { DISPATCH(VertexAttrib1fvNV, (index, v), (F, "glVertexAttrib1fvNV(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib1sNV)(GLuint index, GLshort x) { DISPATCH(VertexAttrib1sNV, (index, x), (F, "glVertexAttrib1sNV(%d, %d);\n", index, x)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib1svNV)(GLuint index, const GLshort * v) { DISPATCH(VertexAttrib1svNV, (index, v), (F, "glVertexAttrib1svNV(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y) { DISPATCH(VertexAttrib2dNV, (index, x, y), (F, "glVertexAttrib2dNV(%d, %f, %f);\n", index, x, y)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dvNV)(GLuint index, const GLdouble * v) { DISPATCH(VertexAttrib2dvNV, (index, v), (F, "glVertexAttrib2dvNV(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y) { DISPATCH(VertexAttrib2fNV, (index, x, y), (F, "glVertexAttrib2fNV(%d, %f, %f);\n", index, x, y)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fvNV)(GLuint index, const GLfloat * v) { DISPATCH(VertexAttrib2fvNV, (index, v), (F, "glVertexAttrib2fvNV(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y) { DISPATCH(VertexAttrib2sNV, (index, x, y), (F, "glVertexAttrib2sNV(%d, %d, %d);\n", index, x, y)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib2svNV)(GLuint index, const GLshort * v) { DISPATCH(VertexAttrib2svNV, (index, v), (F, "glVertexAttrib2svNV(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z) { DISPATCH(VertexAttrib3dNV, (index, x, y, z), (F, "glVertexAttrib3dNV(%d, %f, %f, %f);\n", index, x, y, z)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dvNV)(GLuint index, const GLdouble * v) { DISPATCH(VertexAttrib3dvNV, (index, v), (F, "glVertexAttrib3dvNV(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z) { DISPATCH(VertexAttrib3fNV, (index, x, y, z), (F, "glVertexAttrib3fNV(%d, %f, %f, %f);\n", index, x, y, z)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fvNV)(GLuint index, const GLfloat * v) { DISPATCH(VertexAttrib3fvNV, (index, v), (F, "glVertexAttrib3fvNV(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z) { DISPATCH(VertexAttrib3sNV, (index, x, y, z), (F, "glVertexAttrib3sNV(%d, %d, %d, %d);\n", index, x, y, z)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib3svNV)(GLuint index, const GLshort * v) { DISPATCH(VertexAttrib3svNV, (index, v), (F, "glVertexAttrib3svNV(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { DISPATCH(VertexAttrib4dNV, (index, x, y, z, w), (F, "glVertexAttrib4dNV(%d, %f, %f, %f, %f);\n", index, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dvNV)(GLuint index, const GLdouble * v) { DISPATCH(VertexAttrib4dvNV, (index, v), (F, "glVertexAttrib4dvNV(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { DISPATCH(VertexAttrib4fNV, (index, x, y, z, w), (F, "glVertexAttrib4fNV(%d, %f, %f, %f, %f);\n", index, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fvNV)(GLuint index, const GLfloat * v) { DISPATCH(VertexAttrib4fvNV, (index, v), (F, "glVertexAttrib4fvNV(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) { DISPATCH(VertexAttrib4sNV, (index, x, y, z, w), (F, "glVertexAttrib4sNV(%d, %d, %d, %d, %d);\n", index, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4svNV)(GLuint index, const GLshort * v) { DISPATCH(VertexAttrib4svNV, (index, v), (F, "glVertexAttrib4svNV(%d, %p);\n", index, (const void *) v)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) { DISPATCH(VertexAttrib4ubNV, (index, x, y, z, w), (F, "glVertexAttrib4ubNV(%d, %d, %d, %d, %d);\n", index, x, y, z, w)); } KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubvNV)(GLuint index, const GLubyte * v) { DISPATCH(VertexAttrib4ubvNV, (index, v), (F, "glVertexAttrib4ubvNV(%d, %p);\n", index, (const void *) v)); } KEYWORD1 GLuint KEYWORD2 NAME(GenFragmentShadersATI)(GLuint range) { RETURN_DISPATCH(GenFragmentShadersATI, (range), (F, "glGenFragmentShadersATI(%d);\n", range)); } KEYWORD1 void KEYWORD2 NAME(BindFragmentShaderATI)(GLuint id) { DISPATCH(BindFragmentShaderATI, (id), (F, "glBindFragmentShaderATI(%d);\n", id)); } KEYWORD1 void KEYWORD2 NAME(DeleteFragmentShaderATI)(GLuint id) { DISPATCH(DeleteFragmentShaderATI, (id), (F, "glDeleteFragmentShaderATI(%d);\n", id)); } KEYWORD1 void KEYWORD2 NAME(BeginFragmentShaderATI)(void) { DISPATCH(BeginFragmentShaderATI, (), (F, "glBeginFragmentShaderATI();\n")); } KEYWORD1 void KEYWORD2 NAME(EndFragmentShaderATI)(void) { DISPATCH(EndFragmentShaderATI, (), (F, "glEndFragmentShaderATI();\n")); } KEYWORD1 void KEYWORD2 NAME(PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle) { DISPATCH(PassTexCoordATI, (dst, coord, swizzle), (F, "glPassTexCoordATI(%d, %d, 0x%x);\n", dst, coord, swizzle)); } KEYWORD1 void KEYWORD2 NAME(SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle) { DISPATCH(SampleMapATI, (dst, interp, swizzle), (F, "glSampleMapATI(%d, %d, 0x%x);\n", dst, interp, swizzle)); } KEYWORD1 void KEYWORD2 NAME(ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod) { DISPATCH(ColorFragmentOp1ATI, (op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod), (F, "glColorFragmentOp1ATI(0x%x, %d, %d, %d, %d, %d, %d);\n", op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod)); } KEYWORD1 void KEYWORD2 NAME(ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod) { DISPATCH(ColorFragmentOp2ATI, (op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod), (F, "glColorFragmentOp2ATI(0x%x, %d, %d, %d, %d, %d, %d, %d, %d, %d);\n", op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod)); } KEYWORD1 void KEYWORD2 NAME(ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod) { DISPATCH(ColorFragmentOp3ATI, (op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod), (F, "glColorFragmentOp3ATI(0x%x, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d);\n", op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod)); } KEYWORD1 void KEYWORD2 NAME(AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod) { DISPATCH(AlphaFragmentOp1ATI, (op, dst, dstMod, arg1, arg1Rep, arg1Mod), (F, "glAlphaFragmentOp1ATI(0x%x, %d, %d, %d, %d, %d);\n", op, dst, dstMod, arg1, arg1Rep, arg1Mod)); } KEYWORD1 void KEYWORD2 NAME(AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod) { DISPATCH(AlphaFragmentOp2ATI, (op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod), (F, "glAlphaFragmentOp2ATI(0x%x, %d, %d, %d, %d, %d, %d, %d, %d);\n", op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod)); } KEYWORD1 void KEYWORD2 NAME(AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod) { DISPATCH(AlphaFragmentOp3ATI, (op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod), (F, "glAlphaFragmentOp3ATI(0x%x, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d);\n", op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod)); } KEYWORD1 void KEYWORD2 NAME(SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value) { DISPATCH(SetFragmentShaderConstantATI, (dst, value), (F, "glSetFragmentShaderConstantATI(%d, %p);\n", dst, (const void *) value)); } KEYWORD1 GLboolean KEYWORD2 NAME(IsRenderbufferEXT)(GLuint renderbuffer) { RETURN_DISPATCH(IsRenderbufferEXT, (renderbuffer), (F, "glIsRenderbufferEXT(%d);\n", renderbuffer)); } KEYWORD1 void KEYWORD2 NAME(BindRenderbufferEXT)(GLenum target, GLuint renderbuffer) { DISPATCH(BindRenderbufferEXT, (target, renderbuffer), (F, "glBindRenderbufferEXT(0x%x, %d);\n", target, renderbuffer)); } KEYWORD1 void KEYWORD2 NAME(DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers) { DISPATCH(DeleteRenderbuffersEXT, (n, renderbuffers), (F, "glDeleteRenderbuffersEXT(%d, %p);\n", n, (const void *) renderbuffers)); } KEYWORD1 void KEYWORD2 NAME(GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers) { DISPATCH(GenRenderbuffersEXT, (n, renderbuffers), (F, "glGenRenderbuffersEXT(%d, %p);\n", n, (const void *) renderbuffers)); } KEYWORD1 void KEYWORD2 NAME(RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { DISPATCH(RenderbufferStorageEXT, (target, internalformat, width, height), (F, "glRenderbufferStorageEXT(0x%x, 0x%x, %d, %d);\n", target, internalformat, width, height)); } KEYWORD1 void KEYWORD2 NAME(GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params) { DISPATCH(GetRenderbufferParameterivEXT, (target, pname, params), (F, "glGetRenderbufferParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } KEYWORD1 GLboolean KEYWORD2 NAME(IsFramebufferEXT)(GLuint framebuffer) { RETURN_DISPATCH(IsFramebufferEXT, (framebuffer), (F, "glIsFramebufferEXT(%d);\n", framebuffer)); } KEYWORD1 void KEYWORD2 NAME(BindFramebufferEXT)(GLenum target, GLuint framebuffer) { DISPATCH(BindFramebufferEXT, (target, framebuffer), (F, "glBindFramebufferEXT(0x%x, %d);\n", target, framebuffer)); } KEYWORD1 void KEYWORD2 NAME(DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers) { DISPATCH(DeleteFramebuffersEXT, (n, framebuffers), (F, "glDeleteFramebuffersEXT(%d, %p);\n", n, (const void *) framebuffers)); } KEYWORD1 void KEYWORD2 NAME(GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers) { DISPATCH(GenFramebuffersEXT, (n, framebuffers), (F, "glGenFramebuffersEXT(%d, %p);\n", n, (const void *) framebuffers)); } KEYWORD1 GLenum KEYWORD2 NAME(CheckFramebufferStatusEXT)(GLenum target) { RETURN_DISPATCH(CheckFramebufferStatusEXT, (target), (F, "glCheckFramebufferStatusEXT(0x%x);\n", target)); } KEYWORD1 void KEYWORD2 NAME(FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { DISPATCH(FramebufferTexture1DEXT, (target, attachment, textarget, texture, level), (F, "glFramebufferTexture1DEXT(0x%x, 0x%x, 0x%x, %d, %d);\n", target, attachment, textarget, texture, level)); } KEYWORD1 void KEYWORD2 NAME(FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { DISPATCH(FramebufferTexture2DEXT, (target, attachment, textarget, texture, level), (F, "glFramebufferTexture2DEXT(0x%x, 0x%x, 0x%x, %d, %d);\n", target, attachment, textarget, texture, level)); } KEYWORD1 void KEYWORD2 NAME(FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) { DISPATCH(FramebufferTexture3DEXT, (target, attachment, textarget, texture, level, zoffset), (F, "glFramebufferTexture3DEXT(0x%x, 0x%x, 0x%x, %d, %d, %d);\n", target, attachment, textarget, texture, level, zoffset)); } KEYWORD1 void KEYWORD2 NAME(FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { DISPATCH(FramebufferRenderbufferEXT, (target, attachment, renderbuffertarget, renderbuffer), (F, "glFramebufferRenderbufferEXT(0x%x, 0x%x, 0x%x, %d);\n", target, attachment, renderbuffertarget, renderbuffer)); } KEYWORD1 void KEYWORD2 NAME(GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params) { DISPATCH(GetFramebufferAttachmentParameterivEXT, (target, attachment, pname, params), (F, "glGetFramebufferAttachmentParameterivEXT(0x%x, 0x%x, 0x%x, %p);\n", target, attachment, pname, (const void *) params)); } KEYWORD1 void KEYWORD2 NAME(GenerateMipmapEXT)(GLenum target) { DISPATCH(GenerateMipmapEXT, (target), (F, "glGenerateMipmapEXT(0x%x);\n", target)); } KEYWORD1 void KEYWORD2 NAME(StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask) { DISPATCH(StencilFuncSeparate, (face, func, ref, mask), (F, "glStencilFuncSeparate(0x%x, 0x%x, %d, %d);\n", face, func, ref, mask)); } KEYWORD1 void KEYWORD2 NAME(StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { DISPATCH(StencilOpSeparate, (face, fail, zfail, zpass), (F, "glStencilOpSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", face, fail, zfail, zpass)); } KEYWORD1 void KEYWORD2 NAME(StencilMaskSeparate)(GLenum face, GLuint mask) { DISPATCH(StencilMaskSeparate, (face, mask), (F, "glStencilMaskSeparate(0x%x, %d);\n", face, mask)); } #endif /* defined( NAME ) */ /* * This is how a dispatch table can be initialized with all the functions * we generated above. */ #ifdef DISPATCH_TABLE_NAME #ifndef TABLE_ENTRY #error TABLE_ENTRY must be defined #endif static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(NewList), TABLE_ENTRY(EndList), TABLE_ENTRY(CallList), TABLE_ENTRY(CallLists), TABLE_ENTRY(DeleteLists), TABLE_ENTRY(GenLists), TABLE_ENTRY(ListBase), TABLE_ENTRY(Begin), TABLE_ENTRY(Bitmap), TABLE_ENTRY(Color3b), TABLE_ENTRY(Color3bv), TABLE_ENTRY(Color3d), TABLE_ENTRY(Color3dv), TABLE_ENTRY(Color3f), TABLE_ENTRY(Color3fv), TABLE_ENTRY(Color3i), TABLE_ENTRY(Color3iv), TABLE_ENTRY(Color3s), TABLE_ENTRY(Color3sv), TABLE_ENTRY(Color3ub), TABLE_ENTRY(Color3ubv), TABLE_ENTRY(Color3ui), TABLE_ENTRY(Color3uiv), TABLE_ENTRY(Color3us), TABLE_ENTRY(Color3usv), TABLE_ENTRY(Color4b), TABLE_ENTRY(Color4bv), TABLE_ENTRY(Color4d), TABLE_ENTRY(Color4dv), TABLE_ENTRY(Color4f), TABLE_ENTRY(Color4fv), TABLE_ENTRY(Color4i), TABLE_ENTRY(Color4iv), TABLE_ENTRY(Color4s), TABLE_ENTRY(Color4sv), TABLE_ENTRY(Color4ub), TABLE_ENTRY(Color4ubv), TABLE_ENTRY(Color4ui), TABLE_ENTRY(Color4uiv), TABLE_ENTRY(Color4us), TABLE_ENTRY(Color4usv), TABLE_ENTRY(EdgeFlag), TABLE_ENTRY(EdgeFlagv), TABLE_ENTRY(End), TABLE_ENTRY(Indexd), TABLE_ENTRY(Indexdv), TABLE_ENTRY(Indexf), TABLE_ENTRY(Indexfv), TABLE_ENTRY(Indexi), TABLE_ENTRY(Indexiv), TABLE_ENTRY(Indexs), TABLE_ENTRY(Indexsv), TABLE_ENTRY(Normal3b), TABLE_ENTRY(Normal3bv), TABLE_ENTRY(Normal3d), TABLE_ENTRY(Normal3dv), TABLE_ENTRY(Normal3f), TABLE_ENTRY(Normal3fv), TABLE_ENTRY(Normal3i), TABLE_ENTRY(Normal3iv), TABLE_ENTRY(Normal3s), TABLE_ENTRY(Normal3sv), TABLE_ENTRY(RasterPos2d), TABLE_ENTRY(RasterPos2dv), TABLE_ENTRY(RasterPos2f), TABLE_ENTRY(RasterPos2fv), TABLE_ENTRY(RasterPos2i), TABLE_ENTRY(RasterPos2iv), TABLE_ENTRY(RasterPos2s), TABLE_ENTRY(RasterPos2sv), TABLE_ENTRY(RasterPos3d), TABLE_ENTRY(RasterPos3dv), TABLE_ENTRY(RasterPos3f), TABLE_ENTRY(RasterPos3fv), TABLE_ENTRY(RasterPos3i), TABLE_ENTRY(RasterPos3iv), TABLE_ENTRY(RasterPos3s), TABLE_ENTRY(RasterPos3sv), TABLE_ENTRY(RasterPos4d), TABLE_ENTRY(RasterPos4dv), TABLE_ENTRY(RasterPos4f), TABLE_ENTRY(RasterPos4fv), TABLE_ENTRY(RasterPos4i), TABLE_ENTRY(RasterPos4iv), TABLE_ENTRY(RasterPos4s), TABLE_ENTRY(RasterPos4sv), TABLE_ENTRY(Rectd), TABLE_ENTRY(Rectdv), TABLE_ENTRY(Rectf), TABLE_ENTRY(Rectfv), TABLE_ENTRY(Recti), TABLE_ENTRY(Rectiv), TABLE_ENTRY(Rects), TABLE_ENTRY(Rectsv), TABLE_ENTRY(TexCoord1d), TABLE_ENTRY(TexCoord1dv), TABLE_ENTRY(TexCoord1f), TABLE_ENTRY(TexCoord1fv), TABLE_ENTRY(TexCoord1i), TABLE_ENTRY(TexCoord1iv), TABLE_ENTRY(TexCoord1s), TABLE_ENTRY(TexCoord1sv), TABLE_ENTRY(TexCoord2d), TABLE_ENTRY(TexCoord2dv), TABLE_ENTRY(TexCoord2f), TABLE_ENTRY(TexCoord2fv), TABLE_ENTRY(TexCoord2i), TABLE_ENTRY(TexCoord2iv), TABLE_ENTRY(TexCoord2s), TABLE_ENTRY(TexCoord2sv), TABLE_ENTRY(TexCoord3d), TABLE_ENTRY(TexCoord3dv), TABLE_ENTRY(TexCoord3f), TABLE_ENTRY(TexCoord3fv), TABLE_ENTRY(TexCoord3i), TABLE_ENTRY(TexCoord3iv), TABLE_ENTRY(TexCoord3s), TABLE_ENTRY(TexCoord3sv), TABLE_ENTRY(TexCoord4d), TABLE_ENTRY(TexCoord4dv), TABLE_ENTRY(TexCoord4f), TABLE_ENTRY(TexCoord4fv), TABLE_ENTRY(TexCoord4i), TABLE_ENTRY(TexCoord4iv), TABLE_ENTRY(TexCoord4s), TABLE_ENTRY(TexCoord4sv), TABLE_ENTRY(Vertex2d), TABLE_ENTRY(Vertex2dv), TABLE_ENTRY(Vertex2f), TABLE_ENTRY(Vertex2fv), TABLE_ENTRY(Vertex2i), TABLE_ENTRY(Vertex2iv), TABLE_ENTRY(Vertex2s), TABLE_ENTRY(Vertex2sv), TABLE_ENTRY(Vertex3d), TABLE_ENTRY(Vertex3dv), TABLE_ENTRY(Vertex3f), TABLE_ENTRY(Vertex3fv), TABLE_ENTRY(Vertex3i), TABLE_ENTRY(Vertex3iv), TABLE_ENTRY(Vertex3s), TABLE_ENTRY(Vertex3sv), TABLE_ENTRY(Vertex4d), TABLE_ENTRY(Vertex4dv), TABLE_ENTRY(Vertex4f), TABLE_ENTRY(Vertex4fv), TABLE_ENTRY(Vertex4i), TABLE_ENTRY(Vertex4iv), TABLE_ENTRY(Vertex4s), TABLE_ENTRY(Vertex4sv), TABLE_ENTRY(ClipPlane), TABLE_ENTRY(ColorMaterial), TABLE_ENTRY(CullFace), TABLE_ENTRY(Fogf), TABLE_ENTRY(Fogfv), TABLE_ENTRY(Fogi), TABLE_ENTRY(Fogiv), TABLE_ENTRY(FrontFace), TABLE_ENTRY(Hint), TABLE_ENTRY(Lightf), TABLE_ENTRY(Lightfv), TABLE_ENTRY(Lighti), TABLE_ENTRY(Lightiv), TABLE_ENTRY(LightModelf), TABLE_ENTRY(LightModelfv), TABLE_ENTRY(LightModeli), TABLE_ENTRY(LightModeliv), TABLE_ENTRY(LineStipple), TABLE_ENTRY(LineWidth), TABLE_ENTRY(Materialf), TABLE_ENTRY(Materialfv), TABLE_ENTRY(Materiali), TABLE_ENTRY(Materialiv), TABLE_ENTRY(PointSize), TABLE_ENTRY(PolygonMode), TABLE_ENTRY(PolygonStipple), TABLE_ENTRY(Scissor), TABLE_ENTRY(ShadeModel), TABLE_ENTRY(TexParameterf), TABLE_ENTRY(TexParameterfv), TABLE_ENTRY(TexParameteri), TABLE_ENTRY(TexParameteriv), TABLE_ENTRY(TexImage1D), TABLE_ENTRY(TexImage2D), TABLE_ENTRY(TexEnvf), TABLE_ENTRY(TexEnvfv), TABLE_ENTRY(TexEnvi), TABLE_ENTRY(TexEnviv), TABLE_ENTRY(TexGend), TABLE_ENTRY(TexGendv), TABLE_ENTRY(TexGenf), TABLE_ENTRY(TexGenfv), TABLE_ENTRY(TexGeni), TABLE_ENTRY(TexGeniv), TABLE_ENTRY(FeedbackBuffer), TABLE_ENTRY(SelectBuffer), TABLE_ENTRY(RenderMode), TABLE_ENTRY(InitNames), TABLE_ENTRY(LoadName), TABLE_ENTRY(PassThrough), TABLE_ENTRY(PopName), TABLE_ENTRY(PushName), TABLE_ENTRY(DrawBuffer), TABLE_ENTRY(Clear), TABLE_ENTRY(ClearAccum), TABLE_ENTRY(ClearIndex), TABLE_ENTRY(ClearColor), TABLE_ENTRY(ClearStencil), TABLE_ENTRY(ClearDepth), TABLE_ENTRY(StencilMask), TABLE_ENTRY(ColorMask), TABLE_ENTRY(DepthMask), TABLE_ENTRY(IndexMask), TABLE_ENTRY(Accum), TABLE_ENTRY(Disable), TABLE_ENTRY(Enable), TABLE_ENTRY(Finish), TABLE_ENTRY(Flush), TABLE_ENTRY(PopAttrib), TABLE_ENTRY(PushAttrib), TABLE_ENTRY(Map1d), TABLE_ENTRY(Map1f), TABLE_ENTRY(Map2d), TABLE_ENTRY(Map2f), TABLE_ENTRY(MapGrid1d), TABLE_ENTRY(MapGrid1f), TABLE_ENTRY(MapGrid2d), TABLE_ENTRY(MapGrid2f), TABLE_ENTRY(EvalCoord1d), TABLE_ENTRY(EvalCoord1dv), TABLE_ENTRY(EvalCoord1f), TABLE_ENTRY(EvalCoord1fv), TABLE_ENTRY(EvalCoord2d), TABLE_ENTRY(EvalCoord2dv), TABLE_ENTRY(EvalCoord2f), TABLE_ENTRY(EvalCoord2fv), TABLE_ENTRY(EvalMesh1), TABLE_ENTRY(EvalPoint1), TABLE_ENTRY(EvalMesh2), TABLE_ENTRY(EvalPoint2), TABLE_ENTRY(AlphaFunc), TABLE_ENTRY(BlendFunc), TABLE_ENTRY(LogicOp), TABLE_ENTRY(StencilFunc), TABLE_ENTRY(StencilOp), TABLE_ENTRY(DepthFunc), TABLE_ENTRY(PixelZoom), TABLE_ENTRY(PixelTransferf), TABLE_ENTRY(PixelTransferi), TABLE_ENTRY(PixelStoref), TABLE_ENTRY(PixelStorei), TABLE_ENTRY(PixelMapfv), TABLE_ENTRY(PixelMapuiv), TABLE_ENTRY(PixelMapusv), TABLE_ENTRY(ReadBuffer), TABLE_ENTRY(CopyPixels), TABLE_ENTRY(ReadPixels), TABLE_ENTRY(DrawPixels), TABLE_ENTRY(GetBooleanv), TABLE_ENTRY(GetClipPlane), TABLE_ENTRY(GetDoublev), TABLE_ENTRY(GetError), TABLE_ENTRY(GetFloatv), TABLE_ENTRY(GetIntegerv), TABLE_ENTRY(GetLightfv), TABLE_ENTRY(GetLightiv), TABLE_ENTRY(GetMapdv), TABLE_ENTRY(GetMapfv), TABLE_ENTRY(GetMapiv), TABLE_ENTRY(GetMaterialfv), TABLE_ENTRY(GetMaterialiv), TABLE_ENTRY(GetPixelMapfv), TABLE_ENTRY(GetPixelMapuiv), TABLE_ENTRY(GetPixelMapusv), TABLE_ENTRY(GetPolygonStipple), TABLE_ENTRY(GetString), TABLE_ENTRY(GetTexEnvfv), TABLE_ENTRY(GetTexEnviv), TABLE_ENTRY(GetTexGendv), TABLE_ENTRY(GetTexGenfv), TABLE_ENTRY(GetTexGeniv), TABLE_ENTRY(GetTexImage), TABLE_ENTRY(GetTexParameterfv), TABLE_ENTRY(GetTexParameteriv), TABLE_ENTRY(GetTexLevelParameterfv), TABLE_ENTRY(GetTexLevelParameteriv), TABLE_ENTRY(IsEnabled), TABLE_ENTRY(IsList), TABLE_ENTRY(DepthRange), TABLE_ENTRY(Frustum), TABLE_ENTRY(LoadIdentity), TABLE_ENTRY(LoadMatrixf), TABLE_ENTRY(LoadMatrixd), TABLE_ENTRY(MatrixMode), TABLE_ENTRY(MultMatrixf), TABLE_ENTRY(MultMatrixd), TABLE_ENTRY(Ortho), TABLE_ENTRY(PopMatrix), TABLE_ENTRY(PushMatrix), TABLE_ENTRY(Rotated), TABLE_ENTRY(Rotatef), TABLE_ENTRY(Scaled), TABLE_ENTRY(Scalef), TABLE_ENTRY(Translated), TABLE_ENTRY(Translatef), TABLE_ENTRY(Viewport), TABLE_ENTRY(ArrayElement), TABLE_ENTRY(BindTexture), TABLE_ENTRY(ColorPointer), TABLE_ENTRY(DisableClientState), TABLE_ENTRY(DrawArrays), TABLE_ENTRY(DrawElements), TABLE_ENTRY(EdgeFlagPointer), TABLE_ENTRY(EnableClientState), TABLE_ENTRY(IndexPointer), TABLE_ENTRY(Indexub), TABLE_ENTRY(Indexubv), TABLE_ENTRY(InterleavedArrays), TABLE_ENTRY(NormalPointer), TABLE_ENTRY(PolygonOffset), TABLE_ENTRY(TexCoordPointer), TABLE_ENTRY(VertexPointer), TABLE_ENTRY(AreTexturesResident), TABLE_ENTRY(CopyTexImage1D), TABLE_ENTRY(CopyTexImage2D), TABLE_ENTRY(CopyTexSubImage1D), TABLE_ENTRY(CopyTexSubImage2D), TABLE_ENTRY(DeleteTextures), TABLE_ENTRY(GenTextures), TABLE_ENTRY(GetPointerv), TABLE_ENTRY(IsTexture), TABLE_ENTRY(PrioritizeTextures), TABLE_ENTRY(TexSubImage1D), TABLE_ENTRY(TexSubImage2D), TABLE_ENTRY(PopClientAttrib), TABLE_ENTRY(PushClientAttrib), TABLE_ENTRY(BlendColor), TABLE_ENTRY(BlendEquation), TABLE_ENTRY(DrawRangeElements), TABLE_ENTRY(ColorTable), TABLE_ENTRY(ColorTableParameterfv), TABLE_ENTRY(ColorTableParameteriv), TABLE_ENTRY(CopyColorTable), TABLE_ENTRY(GetColorTable), TABLE_ENTRY(GetColorTableParameterfv), TABLE_ENTRY(GetColorTableParameteriv), TABLE_ENTRY(ColorSubTable), TABLE_ENTRY(CopyColorSubTable), TABLE_ENTRY(ConvolutionFilter1D), TABLE_ENTRY(ConvolutionFilter2D), TABLE_ENTRY(ConvolutionParameterf), TABLE_ENTRY(ConvolutionParameterfv), TABLE_ENTRY(ConvolutionParameteri), TABLE_ENTRY(ConvolutionParameteriv), TABLE_ENTRY(CopyConvolutionFilter1D), TABLE_ENTRY(CopyConvolutionFilter2D), TABLE_ENTRY(GetConvolutionFilter), TABLE_ENTRY(GetConvolutionParameterfv), TABLE_ENTRY(GetConvolutionParameteriv), TABLE_ENTRY(GetSeparableFilter), TABLE_ENTRY(SeparableFilter2D), TABLE_ENTRY(GetHistogram), TABLE_ENTRY(GetHistogramParameterfv), TABLE_ENTRY(GetHistogramParameteriv), TABLE_ENTRY(GetMinmax), TABLE_ENTRY(GetMinmaxParameterfv), TABLE_ENTRY(GetMinmaxParameteriv), TABLE_ENTRY(Histogram), TABLE_ENTRY(Minmax), TABLE_ENTRY(ResetHistogram), TABLE_ENTRY(ResetMinmax), TABLE_ENTRY(TexImage3D), TABLE_ENTRY(TexSubImage3D), TABLE_ENTRY(CopyTexSubImage3D), TABLE_ENTRY(ActiveTextureARB), TABLE_ENTRY(ClientActiveTextureARB), TABLE_ENTRY(MultiTexCoord1dARB), TABLE_ENTRY(MultiTexCoord1dvARB), TABLE_ENTRY(MultiTexCoord1fARB), TABLE_ENTRY(MultiTexCoord1fvARB), TABLE_ENTRY(MultiTexCoord1iARB), TABLE_ENTRY(MultiTexCoord1ivARB), TABLE_ENTRY(MultiTexCoord1sARB), TABLE_ENTRY(MultiTexCoord1svARB), TABLE_ENTRY(MultiTexCoord2dARB), TABLE_ENTRY(MultiTexCoord2dvARB), TABLE_ENTRY(MultiTexCoord2fARB), TABLE_ENTRY(MultiTexCoord2fvARB), TABLE_ENTRY(MultiTexCoord2iARB), TABLE_ENTRY(MultiTexCoord2ivARB), TABLE_ENTRY(MultiTexCoord2sARB), TABLE_ENTRY(MultiTexCoord2svARB), TABLE_ENTRY(MultiTexCoord3dARB), TABLE_ENTRY(MultiTexCoord3dvARB), TABLE_ENTRY(MultiTexCoord3fARB), TABLE_ENTRY(MultiTexCoord3fvARB), TABLE_ENTRY(MultiTexCoord3iARB), TABLE_ENTRY(MultiTexCoord3ivARB), TABLE_ENTRY(MultiTexCoord3sARB), TABLE_ENTRY(MultiTexCoord3svARB), TABLE_ENTRY(MultiTexCoord4dARB), TABLE_ENTRY(MultiTexCoord4dvARB), TABLE_ENTRY(MultiTexCoord4fARB), TABLE_ENTRY(MultiTexCoord4fvARB), TABLE_ENTRY(MultiTexCoord4iARB), TABLE_ENTRY(MultiTexCoord4ivARB), TABLE_ENTRY(MultiTexCoord4sARB), TABLE_ENTRY(MultiTexCoord4svARB), TABLE_ENTRY(LoadTransposeMatrixfARB), TABLE_ENTRY(LoadTransposeMatrixdARB), TABLE_ENTRY(MultTransposeMatrixfARB), TABLE_ENTRY(MultTransposeMatrixdARB), TABLE_ENTRY(SampleCoverageARB), TABLE_ENTRY(DrawBuffersARB), TABLE_ENTRY(PolygonOffsetEXT), TABLE_ENTRY(GetTexFilterFuncSGIS), TABLE_ENTRY(TexFilterFuncSGIS), TABLE_ENTRY(GetHistogramEXT), TABLE_ENTRY(GetHistogramParameterfvEXT), TABLE_ENTRY(GetHistogramParameterivEXT), TABLE_ENTRY(GetMinmaxEXT), TABLE_ENTRY(GetMinmaxParameterfvEXT), TABLE_ENTRY(GetMinmaxParameterivEXT), TABLE_ENTRY(GetConvolutionFilterEXT), TABLE_ENTRY(GetConvolutionParameterfvEXT), TABLE_ENTRY(GetConvolutionParameterivEXT), TABLE_ENTRY(GetSeparableFilterEXT), TABLE_ENTRY(GetColorTableSGI), TABLE_ENTRY(GetColorTableParameterfvSGI), TABLE_ENTRY(GetColorTableParameterivSGI), TABLE_ENTRY(PixelTexGenSGIX), TABLE_ENTRY(PixelTexGenParameteriSGIS), TABLE_ENTRY(PixelTexGenParameterivSGIS), TABLE_ENTRY(PixelTexGenParameterfSGIS), TABLE_ENTRY(PixelTexGenParameterfvSGIS), TABLE_ENTRY(GetPixelTexGenParameterivSGIS), TABLE_ENTRY(GetPixelTexGenParameterfvSGIS), TABLE_ENTRY(TexImage4DSGIS), TABLE_ENTRY(TexSubImage4DSGIS), TABLE_ENTRY(AreTexturesResidentEXT), TABLE_ENTRY(GenTexturesEXT), TABLE_ENTRY(IsTextureEXT), TABLE_ENTRY(DetailTexFuncSGIS), TABLE_ENTRY(GetDetailTexFuncSGIS), TABLE_ENTRY(SharpenTexFuncSGIS), TABLE_ENTRY(GetSharpenTexFuncSGIS), TABLE_ENTRY(SampleMaskSGIS), TABLE_ENTRY(SamplePatternSGIS), TABLE_ENTRY(ColorPointerEXT), TABLE_ENTRY(EdgeFlagPointerEXT), TABLE_ENTRY(IndexPointerEXT), TABLE_ENTRY(NormalPointerEXT), TABLE_ENTRY(TexCoordPointerEXT), TABLE_ENTRY(VertexPointerEXT), TABLE_ENTRY(SpriteParameterfSGIX), TABLE_ENTRY(SpriteParameterfvSGIX), TABLE_ENTRY(SpriteParameteriSGIX), TABLE_ENTRY(SpriteParameterivSGIX), TABLE_ENTRY(PointParameterfEXT), TABLE_ENTRY(PointParameterfvEXT), TABLE_ENTRY(GetInstrumentsSGIX), TABLE_ENTRY(InstrumentsBufferSGIX), TABLE_ENTRY(PollInstrumentsSGIX), TABLE_ENTRY(ReadInstrumentsSGIX), TABLE_ENTRY(StartInstrumentsSGIX), TABLE_ENTRY(StopInstrumentsSGIX), TABLE_ENTRY(FrameZoomSGIX), TABLE_ENTRY(TagSampleBufferSGIX), TABLE_ENTRY(ReferencePlaneSGIX), TABLE_ENTRY(FlushRasterSGIX), TABLE_ENTRY(GetListParameterfvSGIX), TABLE_ENTRY(GetListParameterivSGIX), TABLE_ENTRY(ListParameterfSGIX), TABLE_ENTRY(ListParameterfvSGIX), TABLE_ENTRY(ListParameteriSGIX), TABLE_ENTRY(ListParameterivSGIX), TABLE_ENTRY(FragmentColorMaterialSGIX), TABLE_ENTRY(FragmentLightfSGIX), TABLE_ENTRY(FragmentLightfvSGIX), TABLE_ENTRY(FragmentLightiSGIX), TABLE_ENTRY(FragmentLightivSGIX), TABLE_ENTRY(FragmentLightModelfSGIX), TABLE_ENTRY(FragmentLightModelfvSGIX), TABLE_ENTRY(FragmentLightModeliSGIX), TABLE_ENTRY(FragmentLightModelivSGIX), TABLE_ENTRY(FragmentMaterialfSGIX), TABLE_ENTRY(FragmentMaterialfvSGIX), TABLE_ENTRY(FragmentMaterialiSGIX), TABLE_ENTRY(FragmentMaterialivSGIX), TABLE_ENTRY(GetFragmentLightfvSGIX), TABLE_ENTRY(GetFragmentLightivSGIX), TABLE_ENTRY(GetFragmentMaterialfvSGIX), TABLE_ENTRY(GetFragmentMaterialivSGIX), TABLE_ENTRY(LightEnviSGIX), TABLE_ENTRY(VertexWeightfEXT), TABLE_ENTRY(VertexWeightfvEXT), TABLE_ENTRY(VertexWeightPointerEXT), TABLE_ENTRY(FlushVertexArrayRangeNV), TABLE_ENTRY(VertexArrayRangeNV), TABLE_ENTRY(CombinerParameterfvNV), TABLE_ENTRY(CombinerParameterfNV), TABLE_ENTRY(CombinerParameterivNV), TABLE_ENTRY(CombinerParameteriNV), TABLE_ENTRY(CombinerInputNV), TABLE_ENTRY(CombinerOutputNV), TABLE_ENTRY(FinalCombinerInputNV), TABLE_ENTRY(GetCombinerInputParameterfvNV), TABLE_ENTRY(GetCombinerInputParameterivNV), TABLE_ENTRY(GetCombinerOutputParameterfvNV), TABLE_ENTRY(GetCombinerOutputParameterivNV), TABLE_ENTRY(GetFinalCombinerInputParameterfvNV), TABLE_ENTRY(GetFinalCombinerInputParameterivNV), TABLE_ENTRY(ResizeBuffersMESA), TABLE_ENTRY(WindowPos2dMESA), TABLE_ENTRY(WindowPos2dvMESA), TABLE_ENTRY(WindowPos2fMESA), TABLE_ENTRY(WindowPos2fvMESA), TABLE_ENTRY(WindowPos2iMESA), TABLE_ENTRY(WindowPos2ivMESA), TABLE_ENTRY(WindowPos2sMESA), TABLE_ENTRY(WindowPos2svMESA), TABLE_ENTRY(WindowPos3dMESA), TABLE_ENTRY(WindowPos3dvMESA), TABLE_ENTRY(WindowPos3fMESA), TABLE_ENTRY(WindowPos3fvMESA), TABLE_ENTRY(WindowPos3iMESA), TABLE_ENTRY(WindowPos3ivMESA), TABLE_ENTRY(WindowPos3sMESA), TABLE_ENTRY(WindowPos3svMESA), TABLE_ENTRY(WindowPos4dMESA), TABLE_ENTRY(WindowPos4dvMESA), TABLE_ENTRY(WindowPos4fMESA), TABLE_ENTRY(WindowPos4fvMESA), TABLE_ENTRY(WindowPos4iMESA), TABLE_ENTRY(WindowPos4ivMESA), TABLE_ENTRY(WindowPos4sMESA), TABLE_ENTRY(WindowPos4svMESA), TABLE_ENTRY(BlendFuncSeparateEXT), TABLE_ENTRY(IndexMaterialEXT), TABLE_ENTRY(IndexFuncEXT), TABLE_ENTRY(LockArraysEXT), TABLE_ENTRY(UnlockArraysEXT), TABLE_ENTRY(CullParameterdvEXT), TABLE_ENTRY(CullParameterfvEXT), TABLE_ENTRY(HintPGI), TABLE_ENTRY(FogCoordfEXT), TABLE_ENTRY(FogCoordfvEXT), TABLE_ENTRY(FogCoorddEXT), TABLE_ENTRY(FogCoorddvEXT), TABLE_ENTRY(FogCoordPointerEXT), TABLE_ENTRY(GetColorTableEXT), TABLE_ENTRY(GetColorTableParameterivEXT), TABLE_ENTRY(GetColorTableParameterfvEXT), TABLE_ENTRY(TbufferMask3DFX), TABLE_ENTRY(CompressedTexImage3DARB), TABLE_ENTRY(CompressedTexImage2DARB), TABLE_ENTRY(CompressedTexImage1DARB), TABLE_ENTRY(CompressedTexSubImage3DARB), TABLE_ENTRY(CompressedTexSubImage2DARB), TABLE_ENTRY(CompressedTexSubImage1DARB), TABLE_ENTRY(GetCompressedTexImageARB), TABLE_ENTRY(SecondaryColor3bEXT), TABLE_ENTRY(SecondaryColor3bvEXT), TABLE_ENTRY(SecondaryColor3dEXT), TABLE_ENTRY(SecondaryColor3dvEXT), TABLE_ENTRY(SecondaryColor3fEXT), TABLE_ENTRY(SecondaryColor3fvEXT), TABLE_ENTRY(SecondaryColor3iEXT), TABLE_ENTRY(SecondaryColor3ivEXT), TABLE_ENTRY(SecondaryColor3sEXT), TABLE_ENTRY(SecondaryColor3svEXT), TABLE_ENTRY(SecondaryColor3ubEXT), TABLE_ENTRY(SecondaryColor3ubvEXT), TABLE_ENTRY(SecondaryColor3uiEXT), TABLE_ENTRY(SecondaryColor3uivEXT), TABLE_ENTRY(SecondaryColor3usEXT), TABLE_ENTRY(SecondaryColor3usvEXT), TABLE_ENTRY(SecondaryColorPointerEXT), TABLE_ENTRY(AreProgramsResidentNV), TABLE_ENTRY(BindProgramNV), TABLE_ENTRY(DeleteProgramsNV), TABLE_ENTRY(ExecuteProgramNV), TABLE_ENTRY(GenProgramsNV), TABLE_ENTRY(GetProgramParameterdvNV), TABLE_ENTRY(GetProgramParameterfvNV), TABLE_ENTRY(GetProgramivNV), TABLE_ENTRY(GetProgramStringNV), TABLE_ENTRY(GetTrackMatrixivNV), TABLE_ENTRY(GetVertexAttribdvARB), TABLE_ENTRY(GetVertexAttribfvARB), TABLE_ENTRY(GetVertexAttribivARB), TABLE_ENTRY(GetVertexAttribPointervNV), TABLE_ENTRY(IsProgramNV), TABLE_ENTRY(LoadProgramNV), TABLE_ENTRY(ProgramParameter4dNV), TABLE_ENTRY(ProgramParameter4dvNV), TABLE_ENTRY(ProgramParameter4fNV), TABLE_ENTRY(ProgramParameter4fvNV), TABLE_ENTRY(ProgramParameters4dvNV), TABLE_ENTRY(ProgramParameters4fvNV), TABLE_ENTRY(RequestResidentProgramsNV), TABLE_ENTRY(TrackMatrixNV), TABLE_ENTRY(VertexAttribPointerNV), TABLE_ENTRY(VertexAttrib1dARB), TABLE_ENTRY(VertexAttrib1dvARB), TABLE_ENTRY(VertexAttrib1fARB), TABLE_ENTRY(VertexAttrib1fvARB), TABLE_ENTRY(VertexAttrib1sARB), TABLE_ENTRY(VertexAttrib1svARB), TABLE_ENTRY(VertexAttrib2dARB), TABLE_ENTRY(VertexAttrib2dvARB), TABLE_ENTRY(VertexAttrib2fARB), TABLE_ENTRY(VertexAttrib2fvARB), TABLE_ENTRY(VertexAttrib2sARB), TABLE_ENTRY(VertexAttrib2svARB), TABLE_ENTRY(VertexAttrib3dARB), TABLE_ENTRY(VertexAttrib3dvARB), TABLE_ENTRY(VertexAttrib3fARB), TABLE_ENTRY(VertexAttrib3fvARB), TABLE_ENTRY(VertexAttrib3sARB), TABLE_ENTRY(VertexAttrib3svARB), TABLE_ENTRY(VertexAttrib4dARB), TABLE_ENTRY(VertexAttrib4dvARB), TABLE_ENTRY(VertexAttrib4fARB), TABLE_ENTRY(VertexAttrib4fvARB), TABLE_ENTRY(VertexAttrib4sARB), TABLE_ENTRY(VertexAttrib4svARB), TABLE_ENTRY(VertexAttrib4NubARB), TABLE_ENTRY(VertexAttrib4NubvARB), TABLE_ENTRY(VertexAttribs1dvNV), TABLE_ENTRY(VertexAttribs1fvNV), TABLE_ENTRY(VertexAttribs1svNV), TABLE_ENTRY(VertexAttribs2dvNV), TABLE_ENTRY(VertexAttribs2fvNV), TABLE_ENTRY(VertexAttribs2svNV), TABLE_ENTRY(VertexAttribs3dvNV), TABLE_ENTRY(VertexAttribs3fvNV), TABLE_ENTRY(VertexAttribs3svNV), TABLE_ENTRY(VertexAttribs4dvNV), TABLE_ENTRY(VertexAttribs4fvNV), TABLE_ENTRY(VertexAttribs4svNV), TABLE_ENTRY(VertexAttribs4ubvNV), TABLE_ENTRY(PointParameteriNV), TABLE_ENTRY(PointParameterivNV), TABLE_ENTRY(MultiDrawArraysEXT), TABLE_ENTRY(MultiDrawElementsEXT), TABLE_ENTRY(ActiveStencilFaceEXT), TABLE_ENTRY(DeleteFencesNV), TABLE_ENTRY(GenFencesNV), TABLE_ENTRY(IsFenceNV), TABLE_ENTRY(TestFenceNV), TABLE_ENTRY(GetFenceivNV), TABLE_ENTRY(FinishFenceNV), TABLE_ENTRY(SetFenceNV), TABLE_ENTRY(VertexAttrib4bvARB), TABLE_ENTRY(VertexAttrib4ivARB), TABLE_ENTRY(VertexAttrib4ubvARB), TABLE_ENTRY(VertexAttrib4usvARB), TABLE_ENTRY(VertexAttrib4uivARB), TABLE_ENTRY(VertexAttrib4NbvARB), TABLE_ENTRY(VertexAttrib4NsvARB), TABLE_ENTRY(VertexAttrib4NivARB), TABLE_ENTRY(VertexAttrib4NusvARB), TABLE_ENTRY(VertexAttrib4NuivARB), TABLE_ENTRY(VertexAttribPointerARB), TABLE_ENTRY(EnableVertexAttribArrayARB), TABLE_ENTRY(DisableVertexAttribArrayARB), TABLE_ENTRY(ProgramStringARB), TABLE_ENTRY(ProgramEnvParameter4dARB), TABLE_ENTRY(ProgramEnvParameter4dvARB), TABLE_ENTRY(ProgramEnvParameter4fARB), TABLE_ENTRY(ProgramEnvParameter4fvARB), TABLE_ENTRY(ProgramLocalParameter4dARB), TABLE_ENTRY(ProgramLocalParameter4dvARB), TABLE_ENTRY(ProgramLocalParameter4fARB), TABLE_ENTRY(ProgramLocalParameter4fvARB), TABLE_ENTRY(GetProgramEnvParameterdvARB), TABLE_ENTRY(GetProgramEnvParameterfvARB), TABLE_ENTRY(GetProgramLocalParameterdvARB), TABLE_ENTRY(GetProgramLocalParameterfvARB), TABLE_ENTRY(GetProgramivARB), TABLE_ENTRY(GetProgramStringARB), TABLE_ENTRY(ProgramNamedParameter4fNV), TABLE_ENTRY(ProgramNamedParameter4dNV), TABLE_ENTRY(ProgramNamedParameter4fvNV), TABLE_ENTRY(ProgramNamedParameter4dvNV), TABLE_ENTRY(GetProgramNamedParameterfvNV), TABLE_ENTRY(GetProgramNamedParameterdvNV), TABLE_ENTRY(BindBufferARB), TABLE_ENTRY(BufferDataARB), TABLE_ENTRY(BufferSubDataARB), TABLE_ENTRY(DeleteBuffersARB), TABLE_ENTRY(GenBuffersARB), TABLE_ENTRY(GetBufferParameterivARB), TABLE_ENTRY(GetBufferPointervARB), TABLE_ENTRY(GetBufferSubDataARB), TABLE_ENTRY(IsBufferARB), TABLE_ENTRY(MapBufferARB), TABLE_ENTRY(UnmapBufferARB), TABLE_ENTRY(DepthBoundsEXT), TABLE_ENTRY(GenQueriesARB), TABLE_ENTRY(DeleteQueriesARB), TABLE_ENTRY(IsQueryARB), TABLE_ENTRY(BeginQueryARB), TABLE_ENTRY(EndQueryARB), TABLE_ENTRY(GetQueryivARB), TABLE_ENTRY(GetQueryObjectivARB), TABLE_ENTRY(GetQueryObjectuivARB), TABLE_ENTRY(MultiModeDrawArraysIBM), TABLE_ENTRY(MultiModeDrawElementsIBM), TABLE_ENTRY(BlendEquationSeparateEXT), TABLE_ENTRY(DeleteObjectARB), TABLE_ENTRY(GetHandleARB), TABLE_ENTRY(DetachObjectARB), TABLE_ENTRY(CreateShaderObjectARB), TABLE_ENTRY(ShaderSourceARB), TABLE_ENTRY(CompileShaderARB), TABLE_ENTRY(CreateProgramObjectARB), TABLE_ENTRY(AttachObjectARB), TABLE_ENTRY(LinkProgramARB), TABLE_ENTRY(UseProgramObjectARB), TABLE_ENTRY(ValidateProgramARB), TABLE_ENTRY(Uniform1fARB), TABLE_ENTRY(Uniform2fARB), TABLE_ENTRY(Uniform3fARB), TABLE_ENTRY(Uniform4fARB), TABLE_ENTRY(Uniform1iARB), TABLE_ENTRY(Uniform2iARB), TABLE_ENTRY(Uniform3iARB), TABLE_ENTRY(Uniform4iARB), TABLE_ENTRY(Uniform1fvARB), TABLE_ENTRY(Uniform2fvARB), TABLE_ENTRY(Uniform3fvARB), TABLE_ENTRY(Uniform4fvARB), TABLE_ENTRY(Uniform1ivARB), TABLE_ENTRY(Uniform2ivARB), TABLE_ENTRY(Uniform3ivARB), TABLE_ENTRY(Uniform4ivARB), TABLE_ENTRY(UniformMatrix2fvARB), TABLE_ENTRY(UniformMatrix3fvARB), TABLE_ENTRY(UniformMatrix4fvARB), TABLE_ENTRY(GetObjectParameterfvARB), TABLE_ENTRY(GetObjectParameterivARB), TABLE_ENTRY(GetInfoLogARB), TABLE_ENTRY(GetAttachedObjectsARB), TABLE_ENTRY(GetUniformLocationARB), TABLE_ENTRY(GetActiveUniformARB), TABLE_ENTRY(GetUniformfvARB), TABLE_ENTRY(GetUniformivARB), TABLE_ENTRY(GetShaderSourceARB), TABLE_ENTRY(BindAttribLocationARB), TABLE_ENTRY(GetActiveAttribARB), TABLE_ENTRY(GetAttribLocationARB), TABLE_ENTRY(GetVertexAttribdvNV), TABLE_ENTRY(GetVertexAttribfvNV), TABLE_ENTRY(GetVertexAttribivNV), TABLE_ENTRY(VertexAttrib1dNV), TABLE_ENTRY(VertexAttrib1dvNV), TABLE_ENTRY(VertexAttrib1fNV), TABLE_ENTRY(VertexAttrib1fvNV), TABLE_ENTRY(VertexAttrib1sNV), TABLE_ENTRY(VertexAttrib1svNV), TABLE_ENTRY(VertexAttrib2dNV), TABLE_ENTRY(VertexAttrib2dvNV), TABLE_ENTRY(VertexAttrib2fNV), TABLE_ENTRY(VertexAttrib2fvNV), TABLE_ENTRY(VertexAttrib2sNV), TABLE_ENTRY(VertexAttrib2svNV), TABLE_ENTRY(VertexAttrib3dNV), TABLE_ENTRY(VertexAttrib3dvNV), TABLE_ENTRY(VertexAttrib3fNV), TABLE_ENTRY(VertexAttrib3fvNV), TABLE_ENTRY(VertexAttrib3sNV), TABLE_ENTRY(VertexAttrib3svNV), TABLE_ENTRY(VertexAttrib4dNV), TABLE_ENTRY(VertexAttrib4dvNV), TABLE_ENTRY(VertexAttrib4fNV), TABLE_ENTRY(VertexAttrib4fvNV), TABLE_ENTRY(VertexAttrib4sNV), TABLE_ENTRY(VertexAttrib4svNV), TABLE_ENTRY(VertexAttrib4ubNV), TABLE_ENTRY(VertexAttrib4ubvNV), TABLE_ENTRY(GenFragmentShadersATI), TABLE_ENTRY(BindFragmentShaderATI), TABLE_ENTRY(DeleteFragmentShaderATI), TABLE_ENTRY(BeginFragmentShaderATI), TABLE_ENTRY(EndFragmentShaderATI), TABLE_ENTRY(PassTexCoordATI), TABLE_ENTRY(SampleMapATI), TABLE_ENTRY(ColorFragmentOp1ATI), TABLE_ENTRY(ColorFragmentOp2ATI), TABLE_ENTRY(ColorFragmentOp3ATI), TABLE_ENTRY(AlphaFragmentOp1ATI), TABLE_ENTRY(AlphaFragmentOp2ATI), TABLE_ENTRY(AlphaFragmentOp3ATI), TABLE_ENTRY(SetFragmentShaderConstantATI), TABLE_ENTRY(IsRenderbufferEXT), TABLE_ENTRY(BindRenderbufferEXT), TABLE_ENTRY(DeleteRenderbuffersEXT), TABLE_ENTRY(GenRenderbuffersEXT), TABLE_ENTRY(RenderbufferStorageEXT), TABLE_ENTRY(GetRenderbufferParameterivEXT), TABLE_ENTRY(IsFramebufferEXT), TABLE_ENTRY(BindFramebufferEXT), TABLE_ENTRY(DeleteFramebuffersEXT), TABLE_ENTRY(GenFramebuffersEXT), TABLE_ENTRY(CheckFramebufferStatusEXT), TABLE_ENTRY(FramebufferTexture1DEXT), TABLE_ENTRY(FramebufferTexture2DEXT), TABLE_ENTRY(FramebufferTexture3DEXT), TABLE_ENTRY(FramebufferRenderbufferEXT), TABLE_ENTRY(GetFramebufferAttachmentParameterivEXT), TABLE_ENTRY(GenerateMipmapEXT), TABLE_ENTRY(StencilFuncSeparate), TABLE_ENTRY(StencilOpSeparate), TABLE_ENTRY(StencilMaskSeparate), /* A whole bunch of no-op functions. These might be called * when someone tries to call a dynamically-registered * extension function without a current rendering context. */ TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), }; #endif /* DISPATCH_TABLE_NAME */ /* * This is just used to silence compiler warnings. * We list the functions which are not otherwise used. */ #ifdef UNUSED_TABLE_NAME static _glapi_proc UNUSED_TABLE_NAME[] = { TABLE_ENTRY(ArrayElementEXT), TABLE_ENTRY(BindTextureEXT), TABLE_ENTRY(DrawArraysEXT), TABLE_ENTRY(CopyTexImage1DEXT), TABLE_ENTRY(CopyTexImage2DEXT), TABLE_ENTRY(CopyTexSubImage1DEXT), TABLE_ENTRY(CopyTexSubImage2DEXT), TABLE_ENTRY(DeleteTexturesEXT), TABLE_ENTRY(GetPointervEXT), TABLE_ENTRY(PrioritizeTexturesEXT), TABLE_ENTRY(TexSubImage1DEXT), TABLE_ENTRY(TexSubImage2DEXT), TABLE_ENTRY(BlendColorEXT), TABLE_ENTRY(BlendEquationEXT), TABLE_ENTRY(DrawRangeElementsEXT), TABLE_ENTRY(ColorTableSGI), TABLE_ENTRY(ColorTableEXT), TABLE_ENTRY(ColorTableParameterfvSGI), TABLE_ENTRY(ColorTableParameterivSGI), TABLE_ENTRY(CopyColorTableSGI), TABLE_ENTRY(ColorSubTableEXT), TABLE_ENTRY(CopyColorSubTableEXT), TABLE_ENTRY(ConvolutionFilter1DEXT), TABLE_ENTRY(ConvolutionFilter2DEXT), TABLE_ENTRY(ConvolutionParameterfEXT), TABLE_ENTRY(ConvolutionParameterfvEXT), TABLE_ENTRY(ConvolutionParameteriEXT), TABLE_ENTRY(ConvolutionParameterivEXT), TABLE_ENTRY(CopyConvolutionFilter1DEXT), TABLE_ENTRY(CopyConvolutionFilter2DEXT), TABLE_ENTRY(SeparableFilter2DEXT), TABLE_ENTRY(HistogramEXT), TABLE_ENTRY(MinmaxEXT), TABLE_ENTRY(ResetHistogramEXT), TABLE_ENTRY(ResetMinmaxEXT), TABLE_ENTRY(TexImage3DEXT), TABLE_ENTRY(TexSubImage3DEXT), TABLE_ENTRY(CopyTexSubImage3DEXT), TABLE_ENTRY(ActiveTexture), TABLE_ENTRY(ClientActiveTexture), TABLE_ENTRY(MultiTexCoord1d), TABLE_ENTRY(MultiTexCoord1dv), TABLE_ENTRY(MultiTexCoord1f), TABLE_ENTRY(MultiTexCoord1fv), TABLE_ENTRY(MultiTexCoord1i), TABLE_ENTRY(MultiTexCoord1iv), TABLE_ENTRY(MultiTexCoord1s), TABLE_ENTRY(MultiTexCoord1sv), TABLE_ENTRY(MultiTexCoord2d), TABLE_ENTRY(MultiTexCoord2dv), TABLE_ENTRY(MultiTexCoord2f), TABLE_ENTRY(MultiTexCoord2fv), TABLE_ENTRY(MultiTexCoord2i), TABLE_ENTRY(MultiTexCoord2iv), TABLE_ENTRY(MultiTexCoord2s), TABLE_ENTRY(MultiTexCoord2sv), TABLE_ENTRY(MultiTexCoord3d), TABLE_ENTRY(MultiTexCoord3dv), TABLE_ENTRY(MultiTexCoord3f), TABLE_ENTRY(MultiTexCoord3fv), TABLE_ENTRY(MultiTexCoord3i), TABLE_ENTRY(MultiTexCoord3iv), TABLE_ENTRY(MultiTexCoord3s), TABLE_ENTRY(MultiTexCoord3sv), TABLE_ENTRY(MultiTexCoord4d), TABLE_ENTRY(MultiTexCoord4dv), TABLE_ENTRY(MultiTexCoord4f), TABLE_ENTRY(MultiTexCoord4fv), TABLE_ENTRY(MultiTexCoord4i), TABLE_ENTRY(MultiTexCoord4iv), TABLE_ENTRY(MultiTexCoord4s), TABLE_ENTRY(MultiTexCoord4sv), TABLE_ENTRY(LoadTransposeMatrixf), TABLE_ENTRY(LoadTransposeMatrixd), TABLE_ENTRY(MultTransposeMatrixf), TABLE_ENTRY(MultTransposeMatrixd), TABLE_ENTRY(SampleCoverage), TABLE_ENTRY(DrawBuffersATI), TABLE_ENTRY(SampleMaskEXT), TABLE_ENTRY(SamplePatternEXT), TABLE_ENTRY(PointParameterf), TABLE_ENTRY(PointParameterfARB), TABLE_ENTRY(PointParameterfSGIS), TABLE_ENTRY(PointParameterfv), TABLE_ENTRY(PointParameterfvARB), TABLE_ENTRY(PointParameterfvSGIS), TABLE_ENTRY(WindowPos2d), TABLE_ENTRY(WindowPos2dARB), TABLE_ENTRY(WindowPos2dv), TABLE_ENTRY(WindowPos2dvARB), TABLE_ENTRY(WindowPos2f), TABLE_ENTRY(WindowPos2fARB), TABLE_ENTRY(WindowPos2fv), TABLE_ENTRY(WindowPos2fvARB), TABLE_ENTRY(WindowPos2i), TABLE_ENTRY(WindowPos2iARB), TABLE_ENTRY(WindowPos2iv), TABLE_ENTRY(WindowPos2ivARB), TABLE_ENTRY(WindowPos2s), TABLE_ENTRY(WindowPos2sARB), TABLE_ENTRY(WindowPos2sv), TABLE_ENTRY(WindowPos2svARB), TABLE_ENTRY(WindowPos3d), TABLE_ENTRY(WindowPos3dARB), TABLE_ENTRY(WindowPos3dv), TABLE_ENTRY(WindowPos3dvARB), TABLE_ENTRY(WindowPos3f), TABLE_ENTRY(WindowPos3fARB), TABLE_ENTRY(WindowPos3fv), TABLE_ENTRY(WindowPos3fvARB), TABLE_ENTRY(WindowPos3i), TABLE_ENTRY(WindowPos3iARB), TABLE_ENTRY(WindowPos3iv), TABLE_ENTRY(WindowPos3ivARB), TABLE_ENTRY(WindowPos3s), TABLE_ENTRY(WindowPos3sARB), TABLE_ENTRY(WindowPos3sv), TABLE_ENTRY(WindowPos3svARB), TABLE_ENTRY(BlendFuncSeparate), TABLE_ENTRY(BlendFuncSeparateINGR), TABLE_ENTRY(FogCoordf), TABLE_ENTRY(FogCoordfv), TABLE_ENTRY(FogCoordd), TABLE_ENTRY(FogCoorddv), TABLE_ENTRY(FogCoordPointer), TABLE_ENTRY(CompressedTexImage3D), TABLE_ENTRY(CompressedTexImage2D), TABLE_ENTRY(CompressedTexImage1D), TABLE_ENTRY(CompressedTexSubImage3D), TABLE_ENTRY(CompressedTexSubImage2D), TABLE_ENTRY(CompressedTexSubImage1D), TABLE_ENTRY(GetCompressedTexImage), TABLE_ENTRY(SecondaryColor3b), TABLE_ENTRY(SecondaryColor3bv), TABLE_ENTRY(SecondaryColor3d), TABLE_ENTRY(SecondaryColor3dv), TABLE_ENTRY(SecondaryColor3f), TABLE_ENTRY(SecondaryColor3fv), TABLE_ENTRY(SecondaryColor3i), TABLE_ENTRY(SecondaryColor3iv), TABLE_ENTRY(SecondaryColor3s), TABLE_ENTRY(SecondaryColor3sv), TABLE_ENTRY(SecondaryColor3ub), TABLE_ENTRY(SecondaryColor3ubv), TABLE_ENTRY(SecondaryColor3ui), TABLE_ENTRY(SecondaryColor3uiv), TABLE_ENTRY(SecondaryColor3us), TABLE_ENTRY(SecondaryColor3usv), TABLE_ENTRY(SecondaryColorPointer), TABLE_ENTRY(BindProgramARB), TABLE_ENTRY(DeleteProgramsARB), TABLE_ENTRY(GenProgramsARB), TABLE_ENTRY(GetVertexAttribPointervARB), TABLE_ENTRY(IsProgramARB), TABLE_ENTRY(PointParameteri), TABLE_ENTRY(PointParameteriv), TABLE_ENTRY(MultiDrawArrays), TABLE_ENTRY(MultiDrawElements), TABLE_ENTRY(BindBuffer), TABLE_ENTRY(BufferData), TABLE_ENTRY(BufferSubData), TABLE_ENTRY(DeleteBuffers), TABLE_ENTRY(GenBuffers), TABLE_ENTRY(GetBufferParameteriv), TABLE_ENTRY(GetBufferPointerv), TABLE_ENTRY(GetBufferSubData), TABLE_ENTRY(IsBuffer), TABLE_ENTRY(MapBuffer), TABLE_ENTRY(UnmapBuffer), TABLE_ENTRY(GenQueries), TABLE_ENTRY(DeleteQueries), TABLE_ENTRY(IsQuery), TABLE_ENTRY(BeginQuery), TABLE_ENTRY(EndQuery), TABLE_ENTRY(GetQueryiv), TABLE_ENTRY(GetQueryObjectiv), TABLE_ENTRY(GetQueryObjectuiv), TABLE_ENTRY(BlendEquationSeparateATI), }; #endif /*UNUSED_TABLE_NAME*/ # undef KEYWORD1 # undef KEYWORD2 # undef NAME # undef DISPATCH # undef RETURN_DISPATCH # undef DISPATCH_TABLE_NAME # undef UNUSED_TABLE_NAME # undef TABLE_ENTRY nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/glapi/glprocs.h0000644000000000000000000031466013614532424020145 0ustar /* DO NOT EDIT - This file generated automatically by gl_procs.py (from Mesa) script */ /* * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * (C) Copyright IBM Corporation 2004 * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sub license, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL, IBM, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* This file is only included by glapi.c and is used for * the GetProcAddress() function */ typedef struct { GLint Name_offset; #ifdef NEED_FUNCTION_POINTER _glapi_proc Address; #endif GLuint Offset; } glprocs_table_t; #ifdef NEED_FUNCTION_POINTER # define NAME_FUNC_OFFSET(n,f,o) { n , (_glapi_proc) f , o } #else # define NAME_FUNC_OFFSET(n,f,o) { n , o } #endif static const char gl_string_table[] = "glNewList\0" "glEndList\0" "glCallList\0" "glCallLists\0" "glDeleteLists\0" "glGenLists\0" "glListBase\0" "glBegin\0" "glBitmap\0" "glColor3b\0" "glColor3bv\0" "glColor3d\0" "glColor3dv\0" "glColor3f\0" "glColor3fv\0" "glColor3i\0" "glColor3iv\0" "glColor3s\0" "glColor3sv\0" "glColor3ub\0" "glColor3ubv\0" "glColor3ui\0" "glColor3uiv\0" "glColor3us\0" "glColor3usv\0" "glColor4b\0" "glColor4bv\0" "glColor4d\0" "glColor4dv\0" "glColor4f\0" "glColor4fv\0" "glColor4i\0" "glColor4iv\0" "glColor4s\0" "glColor4sv\0" "glColor4ub\0" "glColor4ubv\0" "glColor4ui\0" "glColor4uiv\0" "glColor4us\0" "glColor4usv\0" "glEdgeFlag\0" "glEdgeFlagv\0" "glEnd\0" "glIndexd\0" "glIndexdv\0" "glIndexf\0" "glIndexfv\0" "glIndexi\0" "glIndexiv\0" "glIndexs\0" "glIndexsv\0" "glNormal3b\0" "glNormal3bv\0" "glNormal3d\0" "glNormal3dv\0" "glNormal3f\0" "glNormal3fv\0" "glNormal3i\0" "glNormal3iv\0" "glNormal3s\0" "glNormal3sv\0" "glRasterPos2d\0" "glRasterPos2dv\0" "glRasterPos2f\0" "glRasterPos2fv\0" "glRasterPos2i\0" "glRasterPos2iv\0" "glRasterPos2s\0" "glRasterPos2sv\0" "glRasterPos3d\0" "glRasterPos3dv\0" "glRasterPos3f\0" "glRasterPos3fv\0" "glRasterPos3i\0" "glRasterPos3iv\0" "glRasterPos3s\0" "glRasterPos3sv\0" "glRasterPos4d\0" "glRasterPos4dv\0" "glRasterPos4f\0" "glRasterPos4fv\0" "glRasterPos4i\0" "glRasterPos4iv\0" "glRasterPos4s\0" "glRasterPos4sv\0" "glRectd\0" "glRectdv\0" "glRectf\0" "glRectfv\0" "glRecti\0" "glRectiv\0" "glRects\0" "glRectsv\0" "glTexCoord1d\0" "glTexCoord1dv\0" "glTexCoord1f\0" "glTexCoord1fv\0" "glTexCoord1i\0" "glTexCoord1iv\0" "glTexCoord1s\0" "glTexCoord1sv\0" "glTexCoord2d\0" "glTexCoord2dv\0" "glTexCoord2f\0" "glTexCoord2fv\0" "glTexCoord2i\0" "glTexCoord2iv\0" "glTexCoord2s\0" "glTexCoord2sv\0" "glTexCoord3d\0" "glTexCoord3dv\0" "glTexCoord3f\0" "glTexCoord3fv\0" "glTexCoord3i\0" "glTexCoord3iv\0" "glTexCoord3s\0" "glTexCoord3sv\0" "glTexCoord4d\0" "glTexCoord4dv\0" "glTexCoord4f\0" "glTexCoord4fv\0" "glTexCoord4i\0" "glTexCoord4iv\0" "glTexCoord4s\0" "glTexCoord4sv\0" "glVertex2d\0" "glVertex2dv\0" "glVertex2f\0" "glVertex2fv\0" "glVertex2i\0" "glVertex2iv\0" "glVertex2s\0" "glVertex2sv\0" "glVertex3d\0" "glVertex3dv\0" "glVertex3f\0" "glVertex3fv\0" "glVertex3i\0" "glVertex3iv\0" "glVertex3s\0" "glVertex3sv\0" "glVertex4d\0" "glVertex4dv\0" "glVertex4f\0" "glVertex4fv\0" "glVertex4i\0" "glVertex4iv\0" "glVertex4s\0" "glVertex4sv\0" "glClipPlane\0" "glColorMaterial\0" "glCullFace\0" "glFogf\0" "glFogfv\0" "glFogi\0" "glFogiv\0" "glFrontFace\0" "glHint\0" "glLightf\0" "glLightfv\0" "glLighti\0" "glLightiv\0" "glLightModelf\0" "glLightModelfv\0" "glLightModeli\0" "glLightModeliv\0" "glLineStipple\0" "glLineWidth\0" "glMaterialf\0" "glMaterialfv\0" "glMateriali\0" "glMaterialiv\0" "glPointSize\0" "glPolygonMode\0" "glPolygonStipple\0" "glScissor\0" "glShadeModel\0" "glTexParameterf\0" "glTexParameterfv\0" "glTexParameteri\0" "glTexParameteriv\0" "glTexImage1D\0" "glTexImage2D\0" "glTexEnvf\0" "glTexEnvfv\0" "glTexEnvi\0" "glTexEnviv\0" "glTexGend\0" "glTexGendv\0" "glTexGenf\0" "glTexGenfv\0" "glTexGeni\0" "glTexGeniv\0" "glFeedbackBuffer\0" "glSelectBuffer\0" "glRenderMode\0" "glInitNames\0" "glLoadName\0" "glPassThrough\0" "glPopName\0" "glPushName\0" "glDrawBuffer\0" "glClear\0" "glClearAccum\0" "glClearIndex\0" "glClearColor\0" "glClearStencil\0" "glClearDepth\0" "glStencilMask\0" "glColorMask\0" "glDepthMask\0" "glIndexMask\0" "glAccum\0" "glDisable\0" "glEnable\0" "glFinish\0" "glFlush\0" "glPopAttrib\0" "glPushAttrib\0" "glMap1d\0" "glMap1f\0" "glMap2d\0" "glMap2f\0" "glMapGrid1d\0" "glMapGrid1f\0" "glMapGrid2d\0" "glMapGrid2f\0" "glEvalCoord1d\0" "glEvalCoord1dv\0" "glEvalCoord1f\0" "glEvalCoord1fv\0" "glEvalCoord2d\0" "glEvalCoord2dv\0" "glEvalCoord2f\0" "glEvalCoord2fv\0" "glEvalMesh1\0" "glEvalPoint1\0" "glEvalMesh2\0" "glEvalPoint2\0" "glAlphaFunc\0" "glBlendFunc\0" "glLogicOp\0" "glStencilFunc\0" "glStencilOp\0" "glDepthFunc\0" "glPixelZoom\0" "glPixelTransferf\0" "glPixelTransferi\0" "glPixelStoref\0" "glPixelStorei\0" "glPixelMapfv\0" "glPixelMapuiv\0" "glPixelMapusv\0" "glReadBuffer\0" "glCopyPixels\0" "glReadPixels\0" "glDrawPixels\0" "glGetBooleanv\0" "glGetClipPlane\0" "glGetDoublev\0" "glGetError\0" "glGetFloatv\0" "glGetIntegerv\0" "glGetLightfv\0" "glGetLightiv\0" "glGetMapdv\0" "glGetMapfv\0" "glGetMapiv\0" "glGetMaterialfv\0" "glGetMaterialiv\0" "glGetPixelMapfv\0" "glGetPixelMapuiv\0" "glGetPixelMapusv\0" "glGetPolygonStipple\0" "glGetString\0" "glGetTexEnvfv\0" "glGetTexEnviv\0" "glGetTexGendv\0" "glGetTexGenfv\0" "glGetTexGeniv\0" "glGetTexImage\0" "glGetTexParameterfv\0" "glGetTexParameteriv\0" "glGetTexLevelParameterfv\0" "glGetTexLevelParameteriv\0" "glIsEnabled\0" "glIsList\0" "glDepthRange\0" "glFrustum\0" "glLoadIdentity\0" "glLoadMatrixf\0" "glLoadMatrixd\0" "glMatrixMode\0" "glMultMatrixf\0" "glMultMatrixd\0" "glOrtho\0" "glPopMatrix\0" "glPushMatrix\0" "glRotated\0" "glRotatef\0" "glScaled\0" "glScalef\0" "glTranslated\0" "glTranslatef\0" "glViewport\0" "glArrayElement\0" "glBindTexture\0" "glColorPointer\0" "glDisableClientState\0" "glDrawArrays\0" "glDrawElements\0" "glEdgeFlagPointer\0" "glEnableClientState\0" "glIndexPointer\0" "glIndexub\0" "glIndexubv\0" "glInterleavedArrays\0" "glNormalPointer\0" "glPolygonOffset\0" "glTexCoordPointer\0" "glVertexPointer\0" "glAreTexturesResident\0" "glCopyTexImage1D\0" "glCopyTexImage2D\0" "glCopyTexSubImage1D\0" "glCopyTexSubImage2D\0" "glDeleteTextures\0" "glGenTextures\0" "glGetPointerv\0" "glIsTexture\0" "glPrioritizeTextures\0" "glTexSubImage1D\0" "glTexSubImage2D\0" "glPopClientAttrib\0" "glPushClientAttrib\0" "glBlendColor\0" "glBlendEquation\0" "glDrawRangeElements\0" "glColorTable\0" "glColorTableParameterfv\0" "glColorTableParameteriv\0" "glCopyColorTable\0" "glGetColorTable\0" "glGetColorTableParameterfv\0" "glGetColorTableParameteriv\0" "glColorSubTable\0" "glCopyColorSubTable\0" "glConvolutionFilter1D\0" "glConvolutionFilter2D\0" "glConvolutionParameterf\0" "glConvolutionParameterfv\0" "glConvolutionParameteri\0" "glConvolutionParameteriv\0" "glCopyConvolutionFilter1D\0" "glCopyConvolutionFilter2D\0" "glGetConvolutionFilter\0" "glGetConvolutionParameterfv\0" "glGetConvolutionParameteriv\0" "glGetSeparableFilter\0" "glSeparableFilter2D\0" "glGetHistogram\0" "glGetHistogramParameterfv\0" "glGetHistogramParameteriv\0" "glGetMinmax\0" "glGetMinmaxParameterfv\0" "glGetMinmaxParameteriv\0" "glHistogram\0" "glMinmax\0" "glResetHistogram\0" "glResetMinmax\0" "glTexImage3D\0" "glTexSubImage3D\0" "glCopyTexSubImage3D\0" "glActiveTextureARB\0" "glClientActiveTextureARB\0" "glMultiTexCoord1dARB\0" "glMultiTexCoord1dvARB\0" "glMultiTexCoord1fARB\0" "glMultiTexCoord1fvARB\0" "glMultiTexCoord1iARB\0" "glMultiTexCoord1ivARB\0" "glMultiTexCoord1sARB\0" "glMultiTexCoord1svARB\0" "glMultiTexCoord2dARB\0" "glMultiTexCoord2dvARB\0" "glMultiTexCoord2fARB\0" "glMultiTexCoord2fvARB\0" "glMultiTexCoord2iARB\0" "glMultiTexCoord2ivARB\0" "glMultiTexCoord2sARB\0" "glMultiTexCoord2svARB\0" "glMultiTexCoord3dARB\0" "glMultiTexCoord3dvARB\0" "glMultiTexCoord3fARB\0" "glMultiTexCoord3fvARB\0" "glMultiTexCoord3iARB\0" "glMultiTexCoord3ivARB\0" "glMultiTexCoord3sARB\0" "glMultiTexCoord3svARB\0" "glMultiTexCoord4dARB\0" "glMultiTexCoord4dvARB\0" "glMultiTexCoord4fARB\0" "glMultiTexCoord4fvARB\0" "glMultiTexCoord4iARB\0" "glMultiTexCoord4ivARB\0" "glMultiTexCoord4sARB\0" "glMultiTexCoord4svARB\0" "glLoadTransposeMatrixfARB\0" "glLoadTransposeMatrixdARB\0" "glMultTransposeMatrixfARB\0" "glMultTransposeMatrixdARB\0" "glSampleCoverageARB\0" "glDrawBuffersARB\0" "glPolygonOffsetEXT\0" "glGetTexFilterFuncSGIS\0" "glTexFilterFuncSGIS\0" "glGetHistogramEXT\0" "glGetHistogramParameterfvEXT\0" "glGetHistogramParameterivEXT\0" "glGetMinmaxEXT\0" "glGetMinmaxParameterfvEXT\0" "glGetMinmaxParameterivEXT\0" "glGetConvolutionFilterEXT\0" "glGetConvolutionParameterfvEXT\0" "glGetConvolutionParameterivEXT\0" "glGetSeparableFilterEXT\0" "glGetColorTableSGI\0" "glGetColorTableParameterfvSGI\0" "glGetColorTableParameterivSGI\0" "glPixelTexGenSGIX\0" "glPixelTexGenParameteriSGIS\0" "glPixelTexGenParameterivSGIS\0" "glPixelTexGenParameterfSGIS\0" "glPixelTexGenParameterfvSGIS\0" "glGetPixelTexGenParameterivSGIS\0" "glGetPixelTexGenParameterfvSGIS\0" "glTexImage4DSGIS\0" "glTexSubImage4DSGIS\0" "glAreTexturesResidentEXT\0" "glGenTexturesEXT\0" "glIsTextureEXT\0" "glDetailTexFuncSGIS\0" "glGetDetailTexFuncSGIS\0" "glSharpenTexFuncSGIS\0" "glGetSharpenTexFuncSGIS\0" "glSampleMaskSGIS\0" "glSamplePatternSGIS\0" "glColorPointerEXT\0" "glEdgeFlagPointerEXT\0" "glIndexPointerEXT\0" "glNormalPointerEXT\0" "glTexCoordPointerEXT\0" "glVertexPointerEXT\0" "glSpriteParameterfSGIX\0" "glSpriteParameterfvSGIX\0" "glSpriteParameteriSGIX\0" "glSpriteParameterivSGIX\0" "glPointParameterfEXT\0" "glPointParameterfvEXT\0" "glGetInstrumentsSGIX\0" "glInstrumentsBufferSGIX\0" "glPollInstrumentsSGIX\0" "glReadInstrumentsSGIX\0" "glStartInstrumentsSGIX\0" "glStopInstrumentsSGIX\0" "glFrameZoomSGIX\0" "glTagSampleBufferSGIX\0" "glReferencePlaneSGIX\0" "glFlushRasterSGIX\0" "glGetListParameterfvSGIX\0" "glGetListParameterivSGIX\0" "glListParameterfSGIX\0" "glListParameterfvSGIX\0" "glListParameteriSGIX\0" "glListParameterivSGIX\0" "glFragmentColorMaterialSGIX\0" "glFragmentLightfSGIX\0" "glFragmentLightfvSGIX\0" "glFragmentLightiSGIX\0" "glFragmentLightivSGIX\0" "glFragmentLightModelfSGIX\0" "glFragmentLightModelfvSGIX\0" "glFragmentLightModeliSGIX\0" "glFragmentLightModelivSGIX\0" "glFragmentMaterialfSGIX\0" "glFragmentMaterialfvSGIX\0" "glFragmentMaterialiSGIX\0" "glFragmentMaterialivSGIX\0" "glGetFragmentLightfvSGIX\0" "glGetFragmentLightivSGIX\0" "glGetFragmentMaterialfvSGIX\0" "glGetFragmentMaterialivSGIX\0" "glLightEnviSGIX\0" "glVertexWeightfEXT\0" "glVertexWeightfvEXT\0" "glVertexWeightPointerEXT\0" "glFlushVertexArrayRangeNV\0" "glVertexArrayRangeNV\0" "glCombinerParameterfvNV\0" "glCombinerParameterfNV\0" "glCombinerParameterivNV\0" "glCombinerParameteriNV\0" "glCombinerInputNV\0" "glCombinerOutputNV\0" "glFinalCombinerInputNV\0" "glGetCombinerInputParameterfvNV\0" "glGetCombinerInputParameterivNV\0" "glGetCombinerOutputParameterfvNV\0" "glGetCombinerOutputParameterivNV\0" "glGetFinalCombinerInputParameterfvNV\0" "glGetFinalCombinerInputParameterivNV\0" "glResizeBuffersMESA\0" "glWindowPos2dMESA\0" "glWindowPos2dvMESA\0" "glWindowPos2fMESA\0" "glWindowPos2fvMESA\0" "glWindowPos2iMESA\0" "glWindowPos2ivMESA\0" "glWindowPos2sMESA\0" "glWindowPos2svMESA\0" "glWindowPos3dMESA\0" "glWindowPos3dvMESA\0" "glWindowPos3fMESA\0" "glWindowPos3fvMESA\0" "glWindowPos3iMESA\0" "glWindowPos3ivMESA\0" "glWindowPos3sMESA\0" "glWindowPos3svMESA\0" "glWindowPos4dMESA\0" "glWindowPos4dvMESA\0" "glWindowPos4fMESA\0" "glWindowPos4fvMESA\0" "glWindowPos4iMESA\0" "glWindowPos4ivMESA\0" "glWindowPos4sMESA\0" "glWindowPos4svMESA\0" "glBlendFuncSeparateEXT\0" "glIndexMaterialEXT\0" "glIndexFuncEXT\0" "glLockArraysEXT\0" "glUnlockArraysEXT\0" "glCullParameterdvEXT\0" "glCullParameterfvEXT\0" "glHintPGI\0" "glFogCoordfEXT\0" "glFogCoordfvEXT\0" "glFogCoorddEXT\0" "glFogCoorddvEXT\0" "glFogCoordPointerEXT\0" "glGetColorTableEXT\0" "glGetColorTableParameterivEXT\0" "glGetColorTableParameterfvEXT\0" "glTbufferMask3DFX\0" "glCompressedTexImage3DARB\0" "glCompressedTexImage2DARB\0" "glCompressedTexImage1DARB\0" "glCompressedTexSubImage3DARB\0" "glCompressedTexSubImage2DARB\0" "glCompressedTexSubImage1DARB\0" "glGetCompressedTexImageARB\0" "glSecondaryColor3bEXT\0" "glSecondaryColor3bvEXT\0" "glSecondaryColor3dEXT\0" "glSecondaryColor3dvEXT\0" "glSecondaryColor3fEXT\0" "glSecondaryColor3fvEXT\0" "glSecondaryColor3iEXT\0" "glSecondaryColor3ivEXT\0" "glSecondaryColor3sEXT\0" "glSecondaryColor3svEXT\0" "glSecondaryColor3ubEXT\0" "glSecondaryColor3ubvEXT\0" "glSecondaryColor3uiEXT\0" "glSecondaryColor3uivEXT\0" "glSecondaryColor3usEXT\0" "glSecondaryColor3usvEXT\0" "glSecondaryColorPointerEXT\0" "glAreProgramsResidentNV\0" "glBindProgramNV\0" "glDeleteProgramsNV\0" "glExecuteProgramNV\0" "glGenProgramsNV\0" "glGetProgramParameterdvNV\0" "glGetProgramParameterfvNV\0" "glGetProgramivNV\0" "glGetProgramStringNV\0" "glGetTrackMatrixivNV\0" "glGetVertexAttribdvARB\0" "glGetVertexAttribfvARB\0" "glGetVertexAttribivARB\0" "glGetVertexAttribPointervNV\0" "glIsProgramNV\0" "glLoadProgramNV\0" "glProgramParameter4dNV\0" "glProgramParameter4dvNV\0" "glProgramParameter4fNV\0" "glProgramParameter4fvNV\0" "glProgramParameters4dvNV\0" "glProgramParameters4fvNV\0" "glRequestResidentProgramsNV\0" "glTrackMatrixNV\0" "glVertexAttribPointerNV\0" "glVertexAttrib1dARB\0" "glVertexAttrib1dvARB\0" "glVertexAttrib1fARB\0" "glVertexAttrib1fvARB\0" "glVertexAttrib1sARB\0" "glVertexAttrib1svARB\0" "glVertexAttrib2dARB\0" "glVertexAttrib2dvARB\0" "glVertexAttrib2fARB\0" "glVertexAttrib2fvARB\0" "glVertexAttrib2sARB\0" "glVertexAttrib2svARB\0" "glVertexAttrib3dARB\0" "glVertexAttrib3dvARB\0" "glVertexAttrib3fARB\0" "glVertexAttrib3fvARB\0" "glVertexAttrib3sARB\0" "glVertexAttrib3svARB\0" "glVertexAttrib4dARB\0" "glVertexAttrib4dvARB\0" "glVertexAttrib4fARB\0" "glVertexAttrib4fvARB\0" "glVertexAttrib4sARB\0" "glVertexAttrib4svARB\0" "glVertexAttrib4NubARB\0" "glVertexAttrib4NubvARB\0" "glVertexAttribs1dvNV\0" "glVertexAttribs1fvNV\0" "glVertexAttribs1svNV\0" "glVertexAttribs2dvNV\0" "glVertexAttribs2fvNV\0" "glVertexAttribs2svNV\0" "glVertexAttribs3dvNV\0" "glVertexAttribs3fvNV\0" "glVertexAttribs3svNV\0" "glVertexAttribs4dvNV\0" "glVertexAttribs4fvNV\0" "glVertexAttribs4svNV\0" "glVertexAttribs4ubvNV\0" "glPointParameteriNV\0" "glPointParameterivNV\0" "glMultiDrawArraysEXT\0" "glMultiDrawElementsEXT\0" "glActiveStencilFaceEXT\0" "glDeleteFencesNV\0" "glGenFencesNV\0" "glIsFenceNV\0" "glTestFenceNV\0" "glGetFenceivNV\0" "glFinishFenceNV\0" "glSetFenceNV\0" "glVertexAttrib4bvARB\0" "glVertexAttrib4ivARB\0" "glVertexAttrib4ubvARB\0" "glVertexAttrib4usvARB\0" "glVertexAttrib4uivARB\0" "glVertexAttrib4NbvARB\0" "glVertexAttrib4NsvARB\0" "glVertexAttrib4NivARB\0" "glVertexAttrib4NusvARB\0" "glVertexAttrib4NuivARB\0" "glVertexAttribPointerARB\0" "glEnableVertexAttribArrayARB\0" "glDisableVertexAttribArrayARB\0" "glProgramStringARB\0" "glProgramEnvParameter4dARB\0" "glProgramEnvParameter4dvARB\0" "glProgramEnvParameter4fARB\0" "glProgramEnvParameter4fvARB\0" "glProgramLocalParameter4dARB\0" "glProgramLocalParameter4dvARB\0" "glProgramLocalParameter4fARB\0" "glProgramLocalParameter4fvARB\0" "glGetProgramEnvParameterdvARB\0" "glGetProgramEnvParameterfvARB\0" "glGetProgramLocalParameterdvARB\0" "glGetProgramLocalParameterfvARB\0" "glGetProgramivARB\0" "glGetProgramStringARB\0" "glProgramNamedParameter4fNV\0" "glProgramNamedParameter4dNV\0" "glProgramNamedParameter4fvNV\0" "glProgramNamedParameter4dvNV\0" "glGetProgramNamedParameterfvNV\0" "glGetProgramNamedParameterdvNV\0" "glBindBufferARB\0" "glBufferDataARB\0" "glBufferSubDataARB\0" "glDeleteBuffersARB\0" "glGenBuffersARB\0" "glGetBufferParameterivARB\0" "glGetBufferPointervARB\0" "glGetBufferSubDataARB\0" "glIsBufferARB\0" "glMapBufferARB\0" "glUnmapBufferARB\0" "glDepthBoundsEXT\0" "glGenQueriesARB\0" "glDeleteQueriesARB\0" "glIsQueryARB\0" "glBeginQueryARB\0" "glEndQueryARB\0" "glGetQueryivARB\0" "glGetQueryObjectivARB\0" "glGetQueryObjectuivARB\0" "glMultiModeDrawArraysIBM\0" "glMultiModeDrawElementsIBM\0" "glBlendEquationSeparateEXT\0" "glDeleteObjectARB\0" "glGetHandleARB\0" "glDetachObjectARB\0" "glCreateShaderObjectARB\0" "glShaderSourceARB\0" "glCompileShaderARB\0" "glCreateProgramObjectARB\0" "glAttachObjectARB\0" "glLinkProgramARB\0" "glUseProgramObjectARB\0" "glValidateProgramARB\0" "glUniform1fARB\0" "glUniform2fARB\0" "glUniform3fARB\0" "glUniform4fARB\0" "glUniform1iARB\0" "glUniform2iARB\0" "glUniform3iARB\0" "glUniform4iARB\0" "glUniform1fvARB\0" "glUniform2fvARB\0" "glUniform3fvARB\0" "glUniform4fvARB\0" "glUniform1ivARB\0" "glUniform2ivARB\0" "glUniform3ivARB\0" "glUniform4ivARB\0" "glUniformMatrix2fvARB\0" "glUniformMatrix3fvARB\0" "glUniformMatrix4fvARB\0" "glGetObjectParameterfvARB\0" "glGetObjectParameterivARB\0" "glGetInfoLogARB\0" "glGetAttachedObjectsARB\0" "glGetUniformLocationARB\0" "glGetActiveUniformARB\0" "glGetUniformfvARB\0" "glGetUniformivARB\0" "glGetShaderSourceARB\0" "glBindAttribLocationARB\0" "glGetActiveAttribARB\0" "glGetAttribLocationARB\0" "glGetVertexAttribdvNV\0" "glGetVertexAttribfvNV\0" "glGetVertexAttribivNV\0" "glVertexAttrib1dNV\0" "glVertexAttrib1dvNV\0" "glVertexAttrib1fNV\0" "glVertexAttrib1fvNV\0" "glVertexAttrib1sNV\0" "glVertexAttrib1svNV\0" "glVertexAttrib2dNV\0" "glVertexAttrib2dvNV\0" "glVertexAttrib2fNV\0" "glVertexAttrib2fvNV\0" "glVertexAttrib2sNV\0" "glVertexAttrib2svNV\0" "glVertexAttrib3dNV\0" "glVertexAttrib3dvNV\0" "glVertexAttrib3fNV\0" "glVertexAttrib3fvNV\0" "glVertexAttrib3sNV\0" "glVertexAttrib3svNV\0" "glVertexAttrib4dNV\0" "glVertexAttrib4dvNV\0" "glVertexAttrib4fNV\0" "glVertexAttrib4fvNV\0" "glVertexAttrib4sNV\0" "glVertexAttrib4svNV\0" "glVertexAttrib4ubNV\0" "glVertexAttrib4ubvNV\0" "glGenFragmentShadersATI\0" "glBindFragmentShaderATI\0" "glDeleteFragmentShaderATI\0" "glBeginFragmentShaderATI\0" "glEndFragmentShaderATI\0" "glPassTexCoordATI\0" "glSampleMapATI\0" "glColorFragmentOp1ATI\0" "glColorFragmentOp2ATI\0" "glColorFragmentOp3ATI\0" "glAlphaFragmentOp1ATI\0" "glAlphaFragmentOp2ATI\0" "glAlphaFragmentOp3ATI\0" "glSetFragmentShaderConstantATI\0" "glIsRenderbufferEXT\0" "glBindRenderbufferEXT\0" "glDeleteRenderbuffersEXT\0" "glGenRenderbuffersEXT\0" "glRenderbufferStorageEXT\0" "glGetRenderbufferParameterivEXT\0" "glIsFramebufferEXT\0" "glBindFramebufferEXT\0" "glDeleteFramebuffersEXT\0" "glGenFramebuffersEXT\0" "glCheckFramebufferStatusEXT\0" "glFramebufferTexture1DEXT\0" "glFramebufferTexture2DEXT\0" "glFramebufferTexture3DEXT\0" "glFramebufferRenderbufferEXT\0" "glGetFramebufferAttachmentParameterivEXT\0" "glGenerateMipmapEXT\0" "glStencilFuncSeparate\0" "glStencilOpSeparate\0" "glStencilMaskSeparate\0" "glArrayElementEXT\0" "glBindTextureEXT\0" "glDrawArraysEXT\0" "glCopyTexImage1DEXT\0" "glCopyTexImage2DEXT\0" "glCopyTexSubImage1DEXT\0" "glCopyTexSubImage2DEXT\0" "glDeleteTexturesEXT\0" "glGetPointervEXT\0" "glPrioritizeTexturesEXT\0" "glTexSubImage1DEXT\0" "glTexSubImage2DEXT\0" "glBlendColorEXT\0" "glBlendEquationEXT\0" "glDrawRangeElementsEXT\0" "glColorTableSGI\0" "glColorTableEXT\0" "glColorTableParameterfvSGI\0" "glColorTableParameterivSGI\0" "glCopyColorTableSGI\0" "glColorSubTableEXT\0" "glCopyColorSubTableEXT\0" "glConvolutionFilter1DEXT\0" "glConvolutionFilter2DEXT\0" "glConvolutionParameterfEXT\0" "glConvolutionParameterfvEXT\0" "glConvolutionParameteriEXT\0" "glConvolutionParameterivEXT\0" "glCopyConvolutionFilter1DEXT\0" "glCopyConvolutionFilter2DEXT\0" "glSeparableFilter2DEXT\0" "glHistogramEXT\0" "glMinmaxEXT\0" "glResetHistogramEXT\0" "glResetMinmaxEXT\0" "glTexImage3DEXT\0" "glTexSubImage3DEXT\0" "glCopyTexSubImage3DEXT\0" "glActiveTexture\0" "glClientActiveTexture\0" "glMultiTexCoord1d\0" "glMultiTexCoord1dv\0" "glMultiTexCoord1f\0" "glMultiTexCoord1fv\0" "glMultiTexCoord1i\0" "glMultiTexCoord1iv\0" "glMultiTexCoord1s\0" "glMultiTexCoord1sv\0" "glMultiTexCoord2d\0" "glMultiTexCoord2dv\0" "glMultiTexCoord2f\0" "glMultiTexCoord2fv\0" "glMultiTexCoord2i\0" "glMultiTexCoord2iv\0" "glMultiTexCoord2s\0" "glMultiTexCoord2sv\0" "glMultiTexCoord3d\0" "glMultiTexCoord3dv\0" "glMultiTexCoord3f\0" "glMultiTexCoord3fv\0" "glMultiTexCoord3i\0" "glMultiTexCoord3iv\0" "glMultiTexCoord3s\0" "glMultiTexCoord3sv\0" "glMultiTexCoord4d\0" "glMultiTexCoord4dv\0" "glMultiTexCoord4f\0" "glMultiTexCoord4fv\0" "glMultiTexCoord4i\0" "glMultiTexCoord4iv\0" "glMultiTexCoord4s\0" "glMultiTexCoord4sv\0" "glLoadTransposeMatrixf\0" "glLoadTransposeMatrixd\0" "glMultTransposeMatrixf\0" "glMultTransposeMatrixd\0" "glSampleCoverage\0" "glDrawBuffersATI\0" "glSampleMaskEXT\0" "glSamplePatternEXT\0" "glPointParameterf\0" "glPointParameterfARB\0" "glPointParameterfSGIS\0" "glPointParameterfv\0" "glPointParameterfvARB\0" "glPointParameterfvSGIS\0" "glWindowPos2d\0" "glWindowPos2dARB\0" "glWindowPos2dv\0" "glWindowPos2dvARB\0" "glWindowPos2f\0" "glWindowPos2fARB\0" "glWindowPos2fv\0" "glWindowPos2fvARB\0" "glWindowPos2i\0" "glWindowPos2iARB\0" "glWindowPos2iv\0" "glWindowPos2ivARB\0" "glWindowPos2s\0" "glWindowPos2sARB\0" "glWindowPos2sv\0" "glWindowPos2svARB\0" "glWindowPos3d\0" "glWindowPos3dARB\0" "glWindowPos3dv\0" "glWindowPos3dvARB\0" "glWindowPos3f\0" "glWindowPos3fARB\0" "glWindowPos3fv\0" "glWindowPos3fvARB\0" "glWindowPos3i\0" "glWindowPos3iARB\0" "glWindowPos3iv\0" "glWindowPos3ivARB\0" "glWindowPos3s\0" "glWindowPos3sARB\0" "glWindowPos3sv\0" "glWindowPos3svARB\0" "glBlendFuncSeparate\0" "glBlendFuncSeparateINGR\0" "glFogCoordf\0" "glFogCoordfv\0" "glFogCoordd\0" "glFogCoorddv\0" "glFogCoordPointer\0" "glCompressedTexImage3D\0" "glCompressedTexImage2D\0" "glCompressedTexImage1D\0" "glCompressedTexSubImage3D\0" "glCompressedTexSubImage2D\0" "glCompressedTexSubImage1D\0" "glGetCompressedTexImage\0" "glSecondaryColor3b\0" "glSecondaryColor3bv\0" "glSecondaryColor3d\0" "glSecondaryColor3dv\0" "glSecondaryColor3f\0" "glSecondaryColor3fv\0" "glSecondaryColor3i\0" "glSecondaryColor3iv\0" "glSecondaryColor3s\0" "glSecondaryColor3sv\0" "glSecondaryColor3ub\0" "glSecondaryColor3ubv\0" "glSecondaryColor3ui\0" "glSecondaryColor3uiv\0" "glSecondaryColor3us\0" "glSecondaryColor3usv\0" "glSecondaryColorPointer\0" "glBindProgramARB\0" "glDeleteProgramsARB\0" "glGenProgramsARB\0" "glGetVertexAttribPointervARB\0" "glIsProgramARB\0" "glPointParameteri\0" "glPointParameteriv\0" "glMultiDrawArrays\0" "glMultiDrawElements\0" "glBindBuffer\0" "glBufferData\0" "glBufferSubData\0" "glDeleteBuffers\0" "glGenBuffers\0" "glGetBufferParameteriv\0" "glGetBufferPointerv\0" "glGetBufferSubData\0" "glIsBuffer\0" "glMapBuffer\0" "glUnmapBuffer\0" "glGenQueries\0" "glDeleteQueries\0" "glIsQuery\0" "glBeginQuery\0" "glEndQuery\0" "glGetQueryiv\0" "glGetQueryObjectiv\0" "glGetQueryObjectuiv\0" "glBlendEquationSeparateATI\0" ; static const glprocs_table_t static_functions[] = { NAME_FUNC_OFFSET( 0, glNewList, _gloffset_NewList ), NAME_FUNC_OFFSET( 10, glEndList, _gloffset_EndList ), NAME_FUNC_OFFSET( 20, glCallList, _gloffset_CallList ), NAME_FUNC_OFFSET( 31, glCallLists, _gloffset_CallLists ), NAME_FUNC_OFFSET( 43, glDeleteLists, _gloffset_DeleteLists ), NAME_FUNC_OFFSET( 57, glGenLists, _gloffset_GenLists ), NAME_FUNC_OFFSET( 68, glListBase, _gloffset_ListBase ), NAME_FUNC_OFFSET( 79, glBegin, _gloffset_Begin ), NAME_FUNC_OFFSET( 87, glBitmap, _gloffset_Bitmap ), NAME_FUNC_OFFSET( 96, glColor3b, _gloffset_Color3b ), NAME_FUNC_OFFSET( 106, glColor3bv, _gloffset_Color3bv ), NAME_FUNC_OFFSET( 117, glColor3d, _gloffset_Color3d ), NAME_FUNC_OFFSET( 127, glColor3dv, _gloffset_Color3dv ), NAME_FUNC_OFFSET( 138, glColor3f, _gloffset_Color3f ), NAME_FUNC_OFFSET( 148, glColor3fv, _gloffset_Color3fv ), NAME_FUNC_OFFSET( 159, glColor3i, _gloffset_Color3i ), NAME_FUNC_OFFSET( 169, glColor3iv, _gloffset_Color3iv ), NAME_FUNC_OFFSET( 180, glColor3s, _gloffset_Color3s ), NAME_FUNC_OFFSET( 190, glColor3sv, _gloffset_Color3sv ), NAME_FUNC_OFFSET( 201, glColor3ub, _gloffset_Color3ub ), NAME_FUNC_OFFSET( 212, glColor3ubv, _gloffset_Color3ubv ), NAME_FUNC_OFFSET( 224, glColor3ui, _gloffset_Color3ui ), NAME_FUNC_OFFSET( 235, glColor3uiv, _gloffset_Color3uiv ), NAME_FUNC_OFFSET( 247, glColor3us, _gloffset_Color3us ), NAME_FUNC_OFFSET( 258, glColor3usv, _gloffset_Color3usv ), NAME_FUNC_OFFSET( 270, glColor4b, _gloffset_Color4b ), NAME_FUNC_OFFSET( 280, glColor4bv, _gloffset_Color4bv ), NAME_FUNC_OFFSET( 291, glColor4d, _gloffset_Color4d ), NAME_FUNC_OFFSET( 301, glColor4dv, _gloffset_Color4dv ), NAME_FUNC_OFFSET( 312, glColor4f, _gloffset_Color4f ), NAME_FUNC_OFFSET( 322, glColor4fv, _gloffset_Color4fv ), NAME_FUNC_OFFSET( 333, glColor4i, _gloffset_Color4i ), NAME_FUNC_OFFSET( 343, glColor4iv, _gloffset_Color4iv ), NAME_FUNC_OFFSET( 354, glColor4s, _gloffset_Color4s ), NAME_FUNC_OFFSET( 364, glColor4sv, _gloffset_Color4sv ), NAME_FUNC_OFFSET( 375, glColor4ub, _gloffset_Color4ub ), NAME_FUNC_OFFSET( 386, glColor4ubv, _gloffset_Color4ubv ), NAME_FUNC_OFFSET( 398, glColor4ui, _gloffset_Color4ui ), NAME_FUNC_OFFSET( 409, glColor4uiv, _gloffset_Color4uiv ), NAME_FUNC_OFFSET( 421, glColor4us, _gloffset_Color4us ), NAME_FUNC_OFFSET( 432, glColor4usv, _gloffset_Color4usv ), NAME_FUNC_OFFSET( 444, glEdgeFlag, _gloffset_EdgeFlag ), NAME_FUNC_OFFSET( 455, glEdgeFlagv, _gloffset_EdgeFlagv ), NAME_FUNC_OFFSET( 467, glEnd, _gloffset_End ), NAME_FUNC_OFFSET( 473, glIndexd, _gloffset_Indexd ), NAME_FUNC_OFFSET( 482, glIndexdv, _gloffset_Indexdv ), NAME_FUNC_OFFSET( 492, glIndexf, _gloffset_Indexf ), NAME_FUNC_OFFSET( 501, glIndexfv, _gloffset_Indexfv ), NAME_FUNC_OFFSET( 511, glIndexi, _gloffset_Indexi ), NAME_FUNC_OFFSET( 520, glIndexiv, _gloffset_Indexiv ), NAME_FUNC_OFFSET( 530, glIndexs, _gloffset_Indexs ), NAME_FUNC_OFFSET( 539, glIndexsv, _gloffset_Indexsv ), NAME_FUNC_OFFSET( 549, glNormal3b, _gloffset_Normal3b ), NAME_FUNC_OFFSET( 560, glNormal3bv, _gloffset_Normal3bv ), NAME_FUNC_OFFSET( 572, glNormal3d, _gloffset_Normal3d ), NAME_FUNC_OFFSET( 583, glNormal3dv, _gloffset_Normal3dv ), NAME_FUNC_OFFSET( 595, glNormal3f, _gloffset_Normal3f ), NAME_FUNC_OFFSET( 606, glNormal3fv, _gloffset_Normal3fv ), NAME_FUNC_OFFSET( 618, glNormal3i, _gloffset_Normal3i ), NAME_FUNC_OFFSET( 629, glNormal3iv, _gloffset_Normal3iv ), NAME_FUNC_OFFSET( 641, glNormal3s, _gloffset_Normal3s ), NAME_FUNC_OFFSET( 652, glNormal3sv, _gloffset_Normal3sv ), NAME_FUNC_OFFSET( 664, glRasterPos2d, _gloffset_RasterPos2d ), NAME_FUNC_OFFSET( 678, glRasterPos2dv, _gloffset_RasterPos2dv ), NAME_FUNC_OFFSET( 693, glRasterPos2f, _gloffset_RasterPos2f ), NAME_FUNC_OFFSET( 707, glRasterPos2fv, _gloffset_RasterPos2fv ), NAME_FUNC_OFFSET( 722, glRasterPos2i, _gloffset_RasterPos2i ), NAME_FUNC_OFFSET( 736, glRasterPos2iv, _gloffset_RasterPos2iv ), NAME_FUNC_OFFSET( 751, glRasterPos2s, _gloffset_RasterPos2s ), NAME_FUNC_OFFSET( 765, glRasterPos2sv, _gloffset_RasterPos2sv ), NAME_FUNC_OFFSET( 780, glRasterPos3d, _gloffset_RasterPos3d ), NAME_FUNC_OFFSET( 794, glRasterPos3dv, _gloffset_RasterPos3dv ), NAME_FUNC_OFFSET( 809, glRasterPos3f, _gloffset_RasterPos3f ), NAME_FUNC_OFFSET( 823, glRasterPos3fv, _gloffset_RasterPos3fv ), NAME_FUNC_OFFSET( 838, glRasterPos3i, _gloffset_RasterPos3i ), NAME_FUNC_OFFSET( 852, glRasterPos3iv, _gloffset_RasterPos3iv ), NAME_FUNC_OFFSET( 867, glRasterPos3s, _gloffset_RasterPos3s ), NAME_FUNC_OFFSET( 881, glRasterPos3sv, _gloffset_RasterPos3sv ), NAME_FUNC_OFFSET( 896, glRasterPos4d, _gloffset_RasterPos4d ), NAME_FUNC_OFFSET( 910, glRasterPos4dv, _gloffset_RasterPos4dv ), NAME_FUNC_OFFSET( 925, glRasterPos4f, _gloffset_RasterPos4f ), NAME_FUNC_OFFSET( 939, glRasterPos4fv, _gloffset_RasterPos4fv ), NAME_FUNC_OFFSET( 954, glRasterPos4i, _gloffset_RasterPos4i ), NAME_FUNC_OFFSET( 968, glRasterPos4iv, _gloffset_RasterPos4iv ), NAME_FUNC_OFFSET( 983, glRasterPos4s, _gloffset_RasterPos4s ), NAME_FUNC_OFFSET( 997, glRasterPos4sv, _gloffset_RasterPos4sv ), NAME_FUNC_OFFSET( 1012, glRectd, _gloffset_Rectd ), NAME_FUNC_OFFSET( 1020, glRectdv, _gloffset_Rectdv ), NAME_FUNC_OFFSET( 1029, glRectf, _gloffset_Rectf ), NAME_FUNC_OFFSET( 1037, glRectfv, _gloffset_Rectfv ), NAME_FUNC_OFFSET( 1046, glRecti, _gloffset_Recti ), NAME_FUNC_OFFSET( 1054, glRectiv, _gloffset_Rectiv ), NAME_FUNC_OFFSET( 1063, glRects, _gloffset_Rects ), NAME_FUNC_OFFSET( 1071, glRectsv, _gloffset_Rectsv ), NAME_FUNC_OFFSET( 1080, glTexCoord1d, _gloffset_TexCoord1d ), NAME_FUNC_OFFSET( 1093, glTexCoord1dv, _gloffset_TexCoord1dv ), NAME_FUNC_OFFSET( 1107, glTexCoord1f, _gloffset_TexCoord1f ), NAME_FUNC_OFFSET( 1120, glTexCoord1fv, _gloffset_TexCoord1fv ), NAME_FUNC_OFFSET( 1134, glTexCoord1i, _gloffset_TexCoord1i ), NAME_FUNC_OFFSET( 1147, glTexCoord1iv, _gloffset_TexCoord1iv ), NAME_FUNC_OFFSET( 1161, glTexCoord1s, _gloffset_TexCoord1s ), NAME_FUNC_OFFSET( 1174, glTexCoord1sv, _gloffset_TexCoord1sv ), NAME_FUNC_OFFSET( 1188, glTexCoord2d, _gloffset_TexCoord2d ), NAME_FUNC_OFFSET( 1201, glTexCoord2dv, _gloffset_TexCoord2dv ), NAME_FUNC_OFFSET( 1215, glTexCoord2f, _gloffset_TexCoord2f ), NAME_FUNC_OFFSET( 1228, glTexCoord2fv, _gloffset_TexCoord2fv ), NAME_FUNC_OFFSET( 1242, glTexCoord2i, _gloffset_TexCoord2i ), NAME_FUNC_OFFSET( 1255, glTexCoord2iv, _gloffset_TexCoord2iv ), NAME_FUNC_OFFSET( 1269, glTexCoord2s, _gloffset_TexCoord2s ), NAME_FUNC_OFFSET( 1282, glTexCoord2sv, _gloffset_TexCoord2sv ), NAME_FUNC_OFFSET( 1296, glTexCoord3d, _gloffset_TexCoord3d ), NAME_FUNC_OFFSET( 1309, glTexCoord3dv, _gloffset_TexCoord3dv ), NAME_FUNC_OFFSET( 1323, glTexCoord3f, _gloffset_TexCoord3f ), NAME_FUNC_OFFSET( 1336, glTexCoord3fv, _gloffset_TexCoord3fv ), NAME_FUNC_OFFSET( 1350, glTexCoord3i, _gloffset_TexCoord3i ), NAME_FUNC_OFFSET( 1363, glTexCoord3iv, _gloffset_TexCoord3iv ), NAME_FUNC_OFFSET( 1377, glTexCoord3s, _gloffset_TexCoord3s ), NAME_FUNC_OFFSET( 1390, glTexCoord3sv, _gloffset_TexCoord3sv ), NAME_FUNC_OFFSET( 1404, glTexCoord4d, _gloffset_TexCoord4d ), NAME_FUNC_OFFSET( 1417, glTexCoord4dv, _gloffset_TexCoord4dv ), NAME_FUNC_OFFSET( 1431, glTexCoord4f, _gloffset_TexCoord4f ), NAME_FUNC_OFFSET( 1444, glTexCoord4fv, _gloffset_TexCoord4fv ), NAME_FUNC_OFFSET( 1458, glTexCoord4i, _gloffset_TexCoord4i ), NAME_FUNC_OFFSET( 1471, glTexCoord4iv, _gloffset_TexCoord4iv ), NAME_FUNC_OFFSET( 1485, glTexCoord4s, _gloffset_TexCoord4s ), NAME_FUNC_OFFSET( 1498, glTexCoord4sv, _gloffset_TexCoord4sv ), NAME_FUNC_OFFSET( 1512, glVertex2d, _gloffset_Vertex2d ), NAME_FUNC_OFFSET( 1523, glVertex2dv, _gloffset_Vertex2dv ), NAME_FUNC_OFFSET( 1535, glVertex2f, _gloffset_Vertex2f ), NAME_FUNC_OFFSET( 1546, glVertex2fv, _gloffset_Vertex2fv ), NAME_FUNC_OFFSET( 1558, glVertex2i, _gloffset_Vertex2i ), NAME_FUNC_OFFSET( 1569, glVertex2iv, _gloffset_Vertex2iv ), NAME_FUNC_OFFSET( 1581, glVertex2s, _gloffset_Vertex2s ), NAME_FUNC_OFFSET( 1592, glVertex2sv, _gloffset_Vertex2sv ), NAME_FUNC_OFFSET( 1604, glVertex3d, _gloffset_Vertex3d ), NAME_FUNC_OFFSET( 1615, glVertex3dv, _gloffset_Vertex3dv ), NAME_FUNC_OFFSET( 1627, glVertex3f, _gloffset_Vertex3f ), NAME_FUNC_OFFSET( 1638, glVertex3fv, _gloffset_Vertex3fv ), NAME_FUNC_OFFSET( 1650, glVertex3i, _gloffset_Vertex3i ), NAME_FUNC_OFFSET( 1661, glVertex3iv, _gloffset_Vertex3iv ), NAME_FUNC_OFFSET( 1673, glVertex3s, _gloffset_Vertex3s ), NAME_FUNC_OFFSET( 1684, glVertex3sv, _gloffset_Vertex3sv ), NAME_FUNC_OFFSET( 1696, glVertex4d, _gloffset_Vertex4d ), NAME_FUNC_OFFSET( 1707, glVertex4dv, _gloffset_Vertex4dv ), NAME_FUNC_OFFSET( 1719, glVertex4f, _gloffset_Vertex4f ), NAME_FUNC_OFFSET( 1730, glVertex4fv, _gloffset_Vertex4fv ), NAME_FUNC_OFFSET( 1742, glVertex4i, _gloffset_Vertex4i ), NAME_FUNC_OFFSET( 1753, glVertex4iv, _gloffset_Vertex4iv ), NAME_FUNC_OFFSET( 1765, glVertex4s, _gloffset_Vertex4s ), NAME_FUNC_OFFSET( 1776, glVertex4sv, _gloffset_Vertex4sv ), NAME_FUNC_OFFSET( 1788, glClipPlane, _gloffset_ClipPlane ), NAME_FUNC_OFFSET( 1800, glColorMaterial, _gloffset_ColorMaterial ), NAME_FUNC_OFFSET( 1816, glCullFace, _gloffset_CullFace ), NAME_FUNC_OFFSET( 1827, glFogf, _gloffset_Fogf ), NAME_FUNC_OFFSET( 1834, glFogfv, _gloffset_Fogfv ), NAME_FUNC_OFFSET( 1842, glFogi, _gloffset_Fogi ), NAME_FUNC_OFFSET( 1849, glFogiv, _gloffset_Fogiv ), NAME_FUNC_OFFSET( 1857, glFrontFace, _gloffset_FrontFace ), NAME_FUNC_OFFSET( 1869, glHint, _gloffset_Hint ), NAME_FUNC_OFFSET( 1876, glLightf, _gloffset_Lightf ), NAME_FUNC_OFFSET( 1885, glLightfv, _gloffset_Lightfv ), NAME_FUNC_OFFSET( 1895, glLighti, _gloffset_Lighti ), NAME_FUNC_OFFSET( 1904, glLightiv, _gloffset_Lightiv ), NAME_FUNC_OFFSET( 1914, glLightModelf, _gloffset_LightModelf ), NAME_FUNC_OFFSET( 1928, glLightModelfv, _gloffset_LightModelfv ), NAME_FUNC_OFFSET( 1943, glLightModeli, _gloffset_LightModeli ), NAME_FUNC_OFFSET( 1957, glLightModeliv, _gloffset_LightModeliv ), NAME_FUNC_OFFSET( 1972, glLineStipple, _gloffset_LineStipple ), NAME_FUNC_OFFSET( 1986, glLineWidth, _gloffset_LineWidth ), NAME_FUNC_OFFSET( 1998, glMaterialf, _gloffset_Materialf ), NAME_FUNC_OFFSET( 2010, glMaterialfv, _gloffset_Materialfv ), NAME_FUNC_OFFSET( 2023, glMateriali, _gloffset_Materiali ), NAME_FUNC_OFFSET( 2035, glMaterialiv, _gloffset_Materialiv ), NAME_FUNC_OFFSET( 2048, glPointSize, _gloffset_PointSize ), NAME_FUNC_OFFSET( 2060, glPolygonMode, _gloffset_PolygonMode ), NAME_FUNC_OFFSET( 2074, glPolygonStipple, _gloffset_PolygonStipple ), NAME_FUNC_OFFSET( 2091, glScissor, _gloffset_Scissor ), NAME_FUNC_OFFSET( 2101, glShadeModel, _gloffset_ShadeModel ), NAME_FUNC_OFFSET( 2114, glTexParameterf, _gloffset_TexParameterf ), NAME_FUNC_OFFSET( 2130, glTexParameterfv, _gloffset_TexParameterfv ), NAME_FUNC_OFFSET( 2147, glTexParameteri, _gloffset_TexParameteri ), NAME_FUNC_OFFSET( 2163, glTexParameteriv, _gloffset_TexParameteriv ), NAME_FUNC_OFFSET( 2180, glTexImage1D, _gloffset_TexImage1D ), NAME_FUNC_OFFSET( 2193, glTexImage2D, _gloffset_TexImage2D ), NAME_FUNC_OFFSET( 2206, glTexEnvf, _gloffset_TexEnvf ), NAME_FUNC_OFFSET( 2216, glTexEnvfv, _gloffset_TexEnvfv ), NAME_FUNC_OFFSET( 2227, glTexEnvi, _gloffset_TexEnvi ), NAME_FUNC_OFFSET( 2237, glTexEnviv, _gloffset_TexEnviv ), NAME_FUNC_OFFSET( 2248, glTexGend, _gloffset_TexGend ), NAME_FUNC_OFFSET( 2258, glTexGendv, _gloffset_TexGendv ), NAME_FUNC_OFFSET( 2269, glTexGenf, _gloffset_TexGenf ), NAME_FUNC_OFFSET( 2279, glTexGenfv, _gloffset_TexGenfv ), NAME_FUNC_OFFSET( 2290, glTexGeni, _gloffset_TexGeni ), NAME_FUNC_OFFSET( 2300, glTexGeniv, _gloffset_TexGeniv ), NAME_FUNC_OFFSET( 2311, glFeedbackBuffer, _gloffset_FeedbackBuffer ), NAME_FUNC_OFFSET( 2328, glSelectBuffer, _gloffset_SelectBuffer ), NAME_FUNC_OFFSET( 2343, glRenderMode, _gloffset_RenderMode ), NAME_FUNC_OFFSET( 2356, glInitNames, _gloffset_InitNames ), NAME_FUNC_OFFSET( 2368, glLoadName, _gloffset_LoadName ), NAME_FUNC_OFFSET( 2379, glPassThrough, _gloffset_PassThrough ), NAME_FUNC_OFFSET( 2393, glPopName, _gloffset_PopName ), NAME_FUNC_OFFSET( 2403, glPushName, _gloffset_PushName ), NAME_FUNC_OFFSET( 2414, glDrawBuffer, _gloffset_DrawBuffer ), NAME_FUNC_OFFSET( 2427, glClear, _gloffset_Clear ), NAME_FUNC_OFFSET( 2435, glClearAccum, _gloffset_ClearAccum ), NAME_FUNC_OFFSET( 2448, glClearIndex, _gloffset_ClearIndex ), NAME_FUNC_OFFSET( 2461, glClearColor, _gloffset_ClearColor ), NAME_FUNC_OFFSET( 2474, glClearStencil, _gloffset_ClearStencil ), NAME_FUNC_OFFSET( 2489, glClearDepth, _gloffset_ClearDepth ), NAME_FUNC_OFFSET( 2502, glStencilMask, _gloffset_StencilMask ), NAME_FUNC_OFFSET( 2516, glColorMask, _gloffset_ColorMask ), NAME_FUNC_OFFSET( 2528, glDepthMask, _gloffset_DepthMask ), NAME_FUNC_OFFSET( 2540, glIndexMask, _gloffset_IndexMask ), NAME_FUNC_OFFSET( 2552, glAccum, _gloffset_Accum ), NAME_FUNC_OFFSET( 2560, glDisable, _gloffset_Disable ), NAME_FUNC_OFFSET( 2570, glEnable, _gloffset_Enable ), NAME_FUNC_OFFSET( 2579, glFinish, _gloffset_Finish ), NAME_FUNC_OFFSET( 2588, glFlush, _gloffset_Flush ), NAME_FUNC_OFFSET( 2596, glPopAttrib, _gloffset_PopAttrib ), NAME_FUNC_OFFSET( 2608, glPushAttrib, _gloffset_PushAttrib ), NAME_FUNC_OFFSET( 2621, glMap1d, _gloffset_Map1d ), NAME_FUNC_OFFSET( 2629, glMap1f, _gloffset_Map1f ), NAME_FUNC_OFFSET( 2637, glMap2d, _gloffset_Map2d ), NAME_FUNC_OFFSET( 2645, glMap2f, _gloffset_Map2f ), NAME_FUNC_OFFSET( 2653, glMapGrid1d, _gloffset_MapGrid1d ), NAME_FUNC_OFFSET( 2665, glMapGrid1f, _gloffset_MapGrid1f ), NAME_FUNC_OFFSET( 2677, glMapGrid2d, _gloffset_MapGrid2d ), NAME_FUNC_OFFSET( 2689, glMapGrid2f, _gloffset_MapGrid2f ), NAME_FUNC_OFFSET( 2701, glEvalCoord1d, _gloffset_EvalCoord1d ), NAME_FUNC_OFFSET( 2715, glEvalCoord1dv, _gloffset_EvalCoord1dv ), NAME_FUNC_OFFSET( 2730, glEvalCoord1f, _gloffset_EvalCoord1f ), NAME_FUNC_OFFSET( 2744, glEvalCoord1fv, _gloffset_EvalCoord1fv ), NAME_FUNC_OFFSET( 2759, glEvalCoord2d, _gloffset_EvalCoord2d ), NAME_FUNC_OFFSET( 2773, glEvalCoord2dv, _gloffset_EvalCoord2dv ), NAME_FUNC_OFFSET( 2788, glEvalCoord2f, _gloffset_EvalCoord2f ), NAME_FUNC_OFFSET( 2802, glEvalCoord2fv, _gloffset_EvalCoord2fv ), NAME_FUNC_OFFSET( 2817, glEvalMesh1, _gloffset_EvalMesh1 ), NAME_FUNC_OFFSET( 2829, glEvalPoint1, _gloffset_EvalPoint1 ), NAME_FUNC_OFFSET( 2842, glEvalMesh2, _gloffset_EvalMesh2 ), NAME_FUNC_OFFSET( 2854, glEvalPoint2, _gloffset_EvalPoint2 ), NAME_FUNC_OFFSET( 2867, glAlphaFunc, _gloffset_AlphaFunc ), NAME_FUNC_OFFSET( 2879, glBlendFunc, _gloffset_BlendFunc ), NAME_FUNC_OFFSET( 2891, glLogicOp, _gloffset_LogicOp ), NAME_FUNC_OFFSET( 2901, glStencilFunc, _gloffset_StencilFunc ), NAME_FUNC_OFFSET( 2915, glStencilOp, _gloffset_StencilOp ), NAME_FUNC_OFFSET( 2927, glDepthFunc, _gloffset_DepthFunc ), NAME_FUNC_OFFSET( 2939, glPixelZoom, _gloffset_PixelZoom ), NAME_FUNC_OFFSET( 2951, glPixelTransferf, _gloffset_PixelTransferf ), NAME_FUNC_OFFSET( 2968, glPixelTransferi, _gloffset_PixelTransferi ), NAME_FUNC_OFFSET( 2985, glPixelStoref, _gloffset_PixelStoref ), NAME_FUNC_OFFSET( 2999, glPixelStorei, _gloffset_PixelStorei ), NAME_FUNC_OFFSET( 3013, glPixelMapfv, _gloffset_PixelMapfv ), NAME_FUNC_OFFSET( 3026, glPixelMapuiv, _gloffset_PixelMapuiv ), NAME_FUNC_OFFSET( 3040, glPixelMapusv, _gloffset_PixelMapusv ), NAME_FUNC_OFFSET( 3054, glReadBuffer, _gloffset_ReadBuffer ), NAME_FUNC_OFFSET( 3067, glCopyPixels, _gloffset_CopyPixels ), NAME_FUNC_OFFSET( 3080, glReadPixels, _gloffset_ReadPixels ), NAME_FUNC_OFFSET( 3093, glDrawPixels, _gloffset_DrawPixels ), NAME_FUNC_OFFSET( 3106, glGetBooleanv, _gloffset_GetBooleanv ), NAME_FUNC_OFFSET( 3120, glGetClipPlane, _gloffset_GetClipPlane ), NAME_FUNC_OFFSET( 3135, glGetDoublev, _gloffset_GetDoublev ), NAME_FUNC_OFFSET( 3148, glGetError, _gloffset_GetError ), NAME_FUNC_OFFSET( 3159, glGetFloatv, _gloffset_GetFloatv ), NAME_FUNC_OFFSET( 3171, glGetIntegerv, _gloffset_GetIntegerv ), NAME_FUNC_OFFSET( 3185, glGetLightfv, _gloffset_GetLightfv ), NAME_FUNC_OFFSET( 3198, glGetLightiv, _gloffset_GetLightiv ), NAME_FUNC_OFFSET( 3211, glGetMapdv, _gloffset_GetMapdv ), NAME_FUNC_OFFSET( 3222, glGetMapfv, _gloffset_GetMapfv ), NAME_FUNC_OFFSET( 3233, glGetMapiv, _gloffset_GetMapiv ), NAME_FUNC_OFFSET( 3244, glGetMaterialfv, _gloffset_GetMaterialfv ), NAME_FUNC_OFFSET( 3260, glGetMaterialiv, _gloffset_GetMaterialiv ), NAME_FUNC_OFFSET( 3276, glGetPixelMapfv, _gloffset_GetPixelMapfv ), NAME_FUNC_OFFSET( 3292, glGetPixelMapuiv, _gloffset_GetPixelMapuiv ), NAME_FUNC_OFFSET( 3309, glGetPixelMapusv, _gloffset_GetPixelMapusv ), NAME_FUNC_OFFSET( 3326, glGetPolygonStipple, _gloffset_GetPolygonStipple ), NAME_FUNC_OFFSET( 3346, glGetString, _gloffset_GetString ), NAME_FUNC_OFFSET( 3358, glGetTexEnvfv, _gloffset_GetTexEnvfv ), NAME_FUNC_OFFSET( 3372, glGetTexEnviv, _gloffset_GetTexEnviv ), NAME_FUNC_OFFSET( 3386, glGetTexGendv, _gloffset_GetTexGendv ), NAME_FUNC_OFFSET( 3400, glGetTexGenfv, _gloffset_GetTexGenfv ), NAME_FUNC_OFFSET( 3414, glGetTexGeniv, _gloffset_GetTexGeniv ), NAME_FUNC_OFFSET( 3428, glGetTexImage, _gloffset_GetTexImage ), NAME_FUNC_OFFSET( 3442, glGetTexParameterfv, _gloffset_GetTexParameterfv ), NAME_FUNC_OFFSET( 3462, glGetTexParameteriv, _gloffset_GetTexParameteriv ), NAME_FUNC_OFFSET( 3482, glGetTexLevelParameterfv, _gloffset_GetTexLevelParameterfv ), NAME_FUNC_OFFSET( 3507, glGetTexLevelParameteriv, _gloffset_GetTexLevelParameteriv ), NAME_FUNC_OFFSET( 3532, glIsEnabled, _gloffset_IsEnabled ), NAME_FUNC_OFFSET( 3544, glIsList, _gloffset_IsList ), NAME_FUNC_OFFSET( 3553, glDepthRange, _gloffset_DepthRange ), NAME_FUNC_OFFSET( 3566, glFrustum, _gloffset_Frustum ), NAME_FUNC_OFFSET( 3576, glLoadIdentity, _gloffset_LoadIdentity ), NAME_FUNC_OFFSET( 3591, glLoadMatrixf, _gloffset_LoadMatrixf ), NAME_FUNC_OFFSET( 3605, glLoadMatrixd, _gloffset_LoadMatrixd ), NAME_FUNC_OFFSET( 3619, glMatrixMode, _gloffset_MatrixMode ), NAME_FUNC_OFFSET( 3632, glMultMatrixf, _gloffset_MultMatrixf ), NAME_FUNC_OFFSET( 3646, glMultMatrixd, _gloffset_MultMatrixd ), NAME_FUNC_OFFSET( 3660, glOrtho, _gloffset_Ortho ), NAME_FUNC_OFFSET( 3668, glPopMatrix, _gloffset_PopMatrix ), NAME_FUNC_OFFSET( 3680, glPushMatrix, _gloffset_PushMatrix ), NAME_FUNC_OFFSET( 3693, glRotated, _gloffset_Rotated ), NAME_FUNC_OFFSET( 3703, glRotatef, _gloffset_Rotatef ), NAME_FUNC_OFFSET( 3713, glScaled, _gloffset_Scaled ), NAME_FUNC_OFFSET( 3722, glScalef, _gloffset_Scalef ), NAME_FUNC_OFFSET( 3731, glTranslated, _gloffset_Translated ), NAME_FUNC_OFFSET( 3744, glTranslatef, _gloffset_Translatef ), NAME_FUNC_OFFSET( 3757, glViewport, _gloffset_Viewport ), NAME_FUNC_OFFSET( 3768, glArrayElement, _gloffset_ArrayElement ), NAME_FUNC_OFFSET( 3783, glBindTexture, _gloffset_BindTexture ), NAME_FUNC_OFFSET( 3797, glColorPointer, _gloffset_ColorPointer ), NAME_FUNC_OFFSET( 3812, glDisableClientState, _gloffset_DisableClientState ), NAME_FUNC_OFFSET( 3833, glDrawArrays, _gloffset_DrawArrays ), NAME_FUNC_OFFSET( 3846, glDrawElements, _gloffset_DrawElements ), NAME_FUNC_OFFSET( 3861, glEdgeFlagPointer, _gloffset_EdgeFlagPointer ), NAME_FUNC_OFFSET( 3879, glEnableClientState, _gloffset_EnableClientState ), NAME_FUNC_OFFSET( 3899, glIndexPointer, _gloffset_IndexPointer ), NAME_FUNC_OFFSET( 3914, glIndexub, _gloffset_Indexub ), NAME_FUNC_OFFSET( 3924, glIndexubv, _gloffset_Indexubv ), NAME_FUNC_OFFSET( 3935, glInterleavedArrays, _gloffset_InterleavedArrays ), NAME_FUNC_OFFSET( 3955, glNormalPointer, _gloffset_NormalPointer ), NAME_FUNC_OFFSET( 3971, glPolygonOffset, _gloffset_PolygonOffset ), NAME_FUNC_OFFSET( 3987, glTexCoordPointer, _gloffset_TexCoordPointer ), NAME_FUNC_OFFSET( 4005, glVertexPointer, _gloffset_VertexPointer ), NAME_FUNC_OFFSET( 4021, glAreTexturesResident, _gloffset_AreTexturesResident ), NAME_FUNC_OFFSET( 4043, glCopyTexImage1D, _gloffset_CopyTexImage1D ), NAME_FUNC_OFFSET( 4060, glCopyTexImage2D, _gloffset_CopyTexImage2D ), NAME_FUNC_OFFSET( 4077, glCopyTexSubImage1D, _gloffset_CopyTexSubImage1D ), NAME_FUNC_OFFSET( 4097, glCopyTexSubImage2D, _gloffset_CopyTexSubImage2D ), NAME_FUNC_OFFSET( 4117, glDeleteTextures, _gloffset_DeleteTextures ), NAME_FUNC_OFFSET( 4134, glGenTextures, _gloffset_GenTextures ), NAME_FUNC_OFFSET( 4148, glGetPointerv, _gloffset_GetPointerv ), NAME_FUNC_OFFSET( 4162, glIsTexture, _gloffset_IsTexture ), NAME_FUNC_OFFSET( 4174, glPrioritizeTextures, _gloffset_PrioritizeTextures ), NAME_FUNC_OFFSET( 4195, glTexSubImage1D, _gloffset_TexSubImage1D ), NAME_FUNC_OFFSET( 4211, glTexSubImage2D, _gloffset_TexSubImage2D ), NAME_FUNC_OFFSET( 4227, glPopClientAttrib, _gloffset_PopClientAttrib ), NAME_FUNC_OFFSET( 4245, glPushClientAttrib, _gloffset_PushClientAttrib ), NAME_FUNC_OFFSET( 4264, glBlendColor, _gloffset_BlendColor ), NAME_FUNC_OFFSET( 4277, glBlendEquation, _gloffset_BlendEquation ), NAME_FUNC_OFFSET( 4293, glDrawRangeElements, _gloffset_DrawRangeElements ), NAME_FUNC_OFFSET( 4313, glColorTable, _gloffset_ColorTable ), NAME_FUNC_OFFSET( 4326, glColorTableParameterfv, _gloffset_ColorTableParameterfv ), NAME_FUNC_OFFSET( 4350, glColorTableParameteriv, _gloffset_ColorTableParameteriv ), NAME_FUNC_OFFSET( 4374, glCopyColorTable, _gloffset_CopyColorTable ), NAME_FUNC_OFFSET( 4391, glGetColorTable, _gloffset_GetColorTable ), NAME_FUNC_OFFSET( 4407, glGetColorTableParameterfv, _gloffset_GetColorTableParameterfv ), NAME_FUNC_OFFSET( 4434, glGetColorTableParameteriv, _gloffset_GetColorTableParameteriv ), NAME_FUNC_OFFSET( 4461, glColorSubTable, _gloffset_ColorSubTable ), NAME_FUNC_OFFSET( 4477, glCopyColorSubTable, _gloffset_CopyColorSubTable ), NAME_FUNC_OFFSET( 4497, glConvolutionFilter1D, _gloffset_ConvolutionFilter1D ), NAME_FUNC_OFFSET( 4519, glConvolutionFilter2D, _gloffset_ConvolutionFilter2D ), NAME_FUNC_OFFSET( 4541, glConvolutionParameterf, _gloffset_ConvolutionParameterf ), NAME_FUNC_OFFSET( 4565, glConvolutionParameterfv, _gloffset_ConvolutionParameterfv ), NAME_FUNC_OFFSET( 4590, glConvolutionParameteri, _gloffset_ConvolutionParameteri ), NAME_FUNC_OFFSET( 4614, glConvolutionParameteriv, _gloffset_ConvolutionParameteriv ), NAME_FUNC_OFFSET( 4639, glCopyConvolutionFilter1D, _gloffset_CopyConvolutionFilter1D ), NAME_FUNC_OFFSET( 4665, glCopyConvolutionFilter2D, _gloffset_CopyConvolutionFilter2D ), NAME_FUNC_OFFSET( 4691, glGetConvolutionFilter, _gloffset_GetConvolutionFilter ), NAME_FUNC_OFFSET( 4714, glGetConvolutionParameterfv, _gloffset_GetConvolutionParameterfv ), NAME_FUNC_OFFSET( 4742, glGetConvolutionParameteriv, _gloffset_GetConvolutionParameteriv ), NAME_FUNC_OFFSET( 4770, glGetSeparableFilter, _gloffset_GetSeparableFilter ), NAME_FUNC_OFFSET( 4791, glSeparableFilter2D, _gloffset_SeparableFilter2D ), NAME_FUNC_OFFSET( 4811, glGetHistogram, _gloffset_GetHistogram ), NAME_FUNC_OFFSET( 4826, glGetHistogramParameterfv, _gloffset_GetHistogramParameterfv ), NAME_FUNC_OFFSET( 4852, glGetHistogramParameteriv, _gloffset_GetHistogramParameteriv ), NAME_FUNC_OFFSET( 4878, glGetMinmax, _gloffset_GetMinmax ), NAME_FUNC_OFFSET( 4890, glGetMinmaxParameterfv, _gloffset_GetMinmaxParameterfv ), NAME_FUNC_OFFSET( 4913, glGetMinmaxParameteriv, _gloffset_GetMinmaxParameteriv ), NAME_FUNC_OFFSET( 4936, glHistogram, _gloffset_Histogram ), NAME_FUNC_OFFSET( 4948, glMinmax, _gloffset_Minmax ), NAME_FUNC_OFFSET( 4957, glResetHistogram, _gloffset_ResetHistogram ), NAME_FUNC_OFFSET( 4974, glResetMinmax, _gloffset_ResetMinmax ), NAME_FUNC_OFFSET( 4988, glTexImage3D, _gloffset_TexImage3D ), NAME_FUNC_OFFSET( 5001, glTexSubImage3D, _gloffset_TexSubImage3D ), NAME_FUNC_OFFSET( 5017, glCopyTexSubImage3D, _gloffset_CopyTexSubImage3D ), NAME_FUNC_OFFSET( 5037, glActiveTextureARB, _gloffset_ActiveTextureARB ), NAME_FUNC_OFFSET( 5056, glClientActiveTextureARB, _gloffset_ClientActiveTextureARB ), NAME_FUNC_OFFSET( 5081, glMultiTexCoord1dARB, _gloffset_MultiTexCoord1dARB ), NAME_FUNC_OFFSET( 5102, glMultiTexCoord1dvARB, _gloffset_MultiTexCoord1dvARB ), NAME_FUNC_OFFSET( 5124, glMultiTexCoord1fARB, _gloffset_MultiTexCoord1fARB ), NAME_FUNC_OFFSET( 5145, glMultiTexCoord1fvARB, _gloffset_MultiTexCoord1fvARB ), NAME_FUNC_OFFSET( 5167, glMultiTexCoord1iARB, _gloffset_MultiTexCoord1iARB ), NAME_FUNC_OFFSET( 5188, glMultiTexCoord1ivARB, _gloffset_MultiTexCoord1ivARB ), NAME_FUNC_OFFSET( 5210, glMultiTexCoord1sARB, _gloffset_MultiTexCoord1sARB ), NAME_FUNC_OFFSET( 5231, glMultiTexCoord1svARB, _gloffset_MultiTexCoord1svARB ), NAME_FUNC_OFFSET( 5253, glMultiTexCoord2dARB, _gloffset_MultiTexCoord2dARB ), NAME_FUNC_OFFSET( 5274, glMultiTexCoord2dvARB, _gloffset_MultiTexCoord2dvARB ), NAME_FUNC_OFFSET( 5296, glMultiTexCoord2fARB, _gloffset_MultiTexCoord2fARB ), NAME_FUNC_OFFSET( 5317, glMultiTexCoord2fvARB, _gloffset_MultiTexCoord2fvARB ), NAME_FUNC_OFFSET( 5339, glMultiTexCoord2iARB, _gloffset_MultiTexCoord2iARB ), NAME_FUNC_OFFSET( 5360, glMultiTexCoord2ivARB, _gloffset_MultiTexCoord2ivARB ), NAME_FUNC_OFFSET( 5382, glMultiTexCoord2sARB, _gloffset_MultiTexCoord2sARB ), NAME_FUNC_OFFSET( 5403, glMultiTexCoord2svARB, _gloffset_MultiTexCoord2svARB ), NAME_FUNC_OFFSET( 5425, glMultiTexCoord3dARB, _gloffset_MultiTexCoord3dARB ), NAME_FUNC_OFFSET( 5446, glMultiTexCoord3dvARB, _gloffset_MultiTexCoord3dvARB ), NAME_FUNC_OFFSET( 5468, glMultiTexCoord3fARB, _gloffset_MultiTexCoord3fARB ), NAME_FUNC_OFFSET( 5489, glMultiTexCoord3fvARB, _gloffset_MultiTexCoord3fvARB ), NAME_FUNC_OFFSET( 5511, glMultiTexCoord3iARB, _gloffset_MultiTexCoord3iARB ), NAME_FUNC_OFFSET( 5532, glMultiTexCoord3ivARB, _gloffset_MultiTexCoord3ivARB ), NAME_FUNC_OFFSET( 5554, glMultiTexCoord3sARB, _gloffset_MultiTexCoord3sARB ), NAME_FUNC_OFFSET( 5575, glMultiTexCoord3svARB, _gloffset_MultiTexCoord3svARB ), NAME_FUNC_OFFSET( 5597, glMultiTexCoord4dARB, _gloffset_MultiTexCoord4dARB ), NAME_FUNC_OFFSET( 5618, glMultiTexCoord4dvARB, _gloffset_MultiTexCoord4dvARB ), NAME_FUNC_OFFSET( 5640, glMultiTexCoord4fARB, _gloffset_MultiTexCoord4fARB ), NAME_FUNC_OFFSET( 5661, glMultiTexCoord4fvARB, _gloffset_MultiTexCoord4fvARB ), NAME_FUNC_OFFSET( 5683, glMultiTexCoord4iARB, _gloffset_MultiTexCoord4iARB ), NAME_FUNC_OFFSET( 5704, glMultiTexCoord4ivARB, _gloffset_MultiTexCoord4ivARB ), NAME_FUNC_OFFSET( 5726, glMultiTexCoord4sARB, _gloffset_MultiTexCoord4sARB ), NAME_FUNC_OFFSET( 5747, glMultiTexCoord4svARB, _gloffset_MultiTexCoord4svARB ), NAME_FUNC_OFFSET( 5769, glLoadTransposeMatrixfARB, _gloffset_LoadTransposeMatrixfARB ), NAME_FUNC_OFFSET( 5795, glLoadTransposeMatrixdARB, _gloffset_LoadTransposeMatrixdARB ), NAME_FUNC_OFFSET( 5821, glMultTransposeMatrixfARB, _gloffset_MultTransposeMatrixfARB ), NAME_FUNC_OFFSET( 5847, glMultTransposeMatrixdARB, _gloffset_MultTransposeMatrixdARB ), NAME_FUNC_OFFSET( 5873, glSampleCoverageARB, _gloffset_SampleCoverageARB ), NAME_FUNC_OFFSET( 5893, glDrawBuffersARB, _gloffset_DrawBuffersARB ), NAME_FUNC_OFFSET( 5910, glPolygonOffsetEXT, _gloffset_PolygonOffsetEXT ), NAME_FUNC_OFFSET( 5929, glGetTexFilterFuncSGIS, _gloffset_GetTexFilterFuncSGIS ), NAME_FUNC_OFFSET( 5952, glTexFilterFuncSGIS, _gloffset_TexFilterFuncSGIS ), NAME_FUNC_OFFSET( 5972, glGetHistogramEXT, _gloffset_GetHistogramEXT ), NAME_FUNC_OFFSET( 5990, glGetHistogramParameterfvEXT, _gloffset_GetHistogramParameterfvEXT ), NAME_FUNC_OFFSET( 6019, glGetHistogramParameterivEXT, _gloffset_GetHistogramParameterivEXT ), NAME_FUNC_OFFSET( 6048, glGetMinmaxEXT, _gloffset_GetMinmaxEXT ), NAME_FUNC_OFFSET( 6063, glGetMinmaxParameterfvEXT, _gloffset_GetMinmaxParameterfvEXT ), NAME_FUNC_OFFSET( 6089, glGetMinmaxParameterivEXT, _gloffset_GetMinmaxParameterivEXT ), NAME_FUNC_OFFSET( 6115, glGetConvolutionFilterEXT, _gloffset_GetConvolutionFilterEXT ), NAME_FUNC_OFFSET( 6141, glGetConvolutionParameterfvEXT, _gloffset_GetConvolutionParameterfvEXT ), NAME_FUNC_OFFSET( 6172, glGetConvolutionParameterivEXT, _gloffset_GetConvolutionParameterivEXT ), NAME_FUNC_OFFSET( 6203, glGetSeparableFilterEXT, _gloffset_GetSeparableFilterEXT ), NAME_FUNC_OFFSET( 6227, glGetColorTableSGI, _gloffset_GetColorTableSGI ), NAME_FUNC_OFFSET( 6246, glGetColorTableParameterfvSGI, _gloffset_GetColorTableParameterfvSGI ), NAME_FUNC_OFFSET( 6276, glGetColorTableParameterivSGI, _gloffset_GetColorTableParameterivSGI ), NAME_FUNC_OFFSET( 6306, glPixelTexGenSGIX, _gloffset_PixelTexGenSGIX ), NAME_FUNC_OFFSET( 6324, glPixelTexGenParameteriSGIS, _gloffset_PixelTexGenParameteriSGIS ), NAME_FUNC_OFFSET( 6352, glPixelTexGenParameterivSGIS, _gloffset_PixelTexGenParameterivSGIS ), NAME_FUNC_OFFSET( 6381, glPixelTexGenParameterfSGIS, _gloffset_PixelTexGenParameterfSGIS ), NAME_FUNC_OFFSET( 6409, glPixelTexGenParameterfvSGIS, _gloffset_PixelTexGenParameterfvSGIS ), NAME_FUNC_OFFSET( 6438, glGetPixelTexGenParameterivSGIS, _gloffset_GetPixelTexGenParameterivSGIS ), NAME_FUNC_OFFSET( 6470, glGetPixelTexGenParameterfvSGIS, _gloffset_GetPixelTexGenParameterfvSGIS ), NAME_FUNC_OFFSET( 6502, glTexImage4DSGIS, _gloffset_TexImage4DSGIS ), NAME_FUNC_OFFSET( 6519, glTexSubImage4DSGIS, _gloffset_TexSubImage4DSGIS ), NAME_FUNC_OFFSET( 6539, glAreTexturesResidentEXT, _gloffset_AreTexturesResidentEXT ), NAME_FUNC_OFFSET( 6564, glGenTexturesEXT, _gloffset_GenTexturesEXT ), NAME_FUNC_OFFSET( 6581, glIsTextureEXT, _gloffset_IsTextureEXT ), NAME_FUNC_OFFSET( 6596, glDetailTexFuncSGIS, _gloffset_DetailTexFuncSGIS ), NAME_FUNC_OFFSET( 6616, glGetDetailTexFuncSGIS, _gloffset_GetDetailTexFuncSGIS ), NAME_FUNC_OFFSET( 6639, glSharpenTexFuncSGIS, _gloffset_SharpenTexFuncSGIS ), NAME_FUNC_OFFSET( 6660, glGetSharpenTexFuncSGIS, _gloffset_GetSharpenTexFuncSGIS ), NAME_FUNC_OFFSET( 6684, glSampleMaskSGIS, _gloffset_SampleMaskSGIS ), NAME_FUNC_OFFSET( 6701, glSamplePatternSGIS, _gloffset_SamplePatternSGIS ), NAME_FUNC_OFFSET( 6721, glColorPointerEXT, _gloffset_ColorPointerEXT ), NAME_FUNC_OFFSET( 6739, glEdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT ), NAME_FUNC_OFFSET( 6760, glIndexPointerEXT, _gloffset_IndexPointerEXT ), NAME_FUNC_OFFSET( 6778, glNormalPointerEXT, _gloffset_NormalPointerEXT ), NAME_FUNC_OFFSET( 6797, glTexCoordPointerEXT, _gloffset_TexCoordPointerEXT ), NAME_FUNC_OFFSET( 6818, glVertexPointerEXT, _gloffset_VertexPointerEXT ), NAME_FUNC_OFFSET( 6837, glSpriteParameterfSGIX, _gloffset_SpriteParameterfSGIX ), NAME_FUNC_OFFSET( 6860, glSpriteParameterfvSGIX, _gloffset_SpriteParameterfvSGIX ), NAME_FUNC_OFFSET( 6884, glSpriteParameteriSGIX, _gloffset_SpriteParameteriSGIX ), NAME_FUNC_OFFSET( 6907, glSpriteParameterivSGIX, _gloffset_SpriteParameterivSGIX ), NAME_FUNC_OFFSET( 6931, glPointParameterfEXT, _gloffset_PointParameterfEXT ), NAME_FUNC_OFFSET( 6952, glPointParameterfvEXT, _gloffset_PointParameterfvEXT ), NAME_FUNC_OFFSET( 6974, glGetInstrumentsSGIX, _gloffset_GetInstrumentsSGIX ), NAME_FUNC_OFFSET( 6995, glInstrumentsBufferSGIX, _gloffset_InstrumentsBufferSGIX ), NAME_FUNC_OFFSET( 7019, glPollInstrumentsSGIX, _gloffset_PollInstrumentsSGIX ), NAME_FUNC_OFFSET( 7041, glReadInstrumentsSGIX, _gloffset_ReadInstrumentsSGIX ), NAME_FUNC_OFFSET( 7063, glStartInstrumentsSGIX, _gloffset_StartInstrumentsSGIX ), NAME_FUNC_OFFSET( 7086, glStopInstrumentsSGIX, _gloffset_StopInstrumentsSGIX ), NAME_FUNC_OFFSET( 7108, glFrameZoomSGIX, _gloffset_FrameZoomSGIX ), NAME_FUNC_OFFSET( 7124, glTagSampleBufferSGIX, _gloffset_TagSampleBufferSGIX ), NAME_FUNC_OFFSET( 7146, glReferencePlaneSGIX, _gloffset_ReferencePlaneSGIX ), NAME_FUNC_OFFSET( 7167, glFlushRasterSGIX, _gloffset_FlushRasterSGIX ), NAME_FUNC_OFFSET( 7185, glGetListParameterfvSGIX, _gloffset_GetListParameterfvSGIX ), NAME_FUNC_OFFSET( 7210, glGetListParameterivSGIX, _gloffset_GetListParameterivSGIX ), NAME_FUNC_OFFSET( 7235, glListParameterfSGIX, _gloffset_ListParameterfSGIX ), NAME_FUNC_OFFSET( 7256, glListParameterfvSGIX, _gloffset_ListParameterfvSGIX ), NAME_FUNC_OFFSET( 7278, glListParameteriSGIX, _gloffset_ListParameteriSGIX ), NAME_FUNC_OFFSET( 7299, glListParameterivSGIX, _gloffset_ListParameterivSGIX ), NAME_FUNC_OFFSET( 7321, glFragmentColorMaterialSGIX, _gloffset_FragmentColorMaterialSGIX ), NAME_FUNC_OFFSET( 7349, glFragmentLightfSGIX, _gloffset_FragmentLightfSGIX ), NAME_FUNC_OFFSET( 7370, glFragmentLightfvSGIX, _gloffset_FragmentLightfvSGIX ), NAME_FUNC_OFFSET( 7392, glFragmentLightiSGIX, _gloffset_FragmentLightiSGIX ), NAME_FUNC_OFFSET( 7413, glFragmentLightivSGIX, _gloffset_FragmentLightivSGIX ), NAME_FUNC_OFFSET( 7435, glFragmentLightModelfSGIX, _gloffset_FragmentLightModelfSGIX ), NAME_FUNC_OFFSET( 7461, glFragmentLightModelfvSGIX, _gloffset_FragmentLightModelfvSGIX ), NAME_FUNC_OFFSET( 7488, glFragmentLightModeliSGIX, _gloffset_FragmentLightModeliSGIX ), NAME_FUNC_OFFSET( 7514, glFragmentLightModelivSGIX, _gloffset_FragmentLightModelivSGIX ), NAME_FUNC_OFFSET( 7541, glFragmentMaterialfSGIX, _gloffset_FragmentMaterialfSGIX ), NAME_FUNC_OFFSET( 7565, glFragmentMaterialfvSGIX, _gloffset_FragmentMaterialfvSGIX ), NAME_FUNC_OFFSET( 7590, glFragmentMaterialiSGIX, _gloffset_FragmentMaterialiSGIX ), NAME_FUNC_OFFSET( 7614, glFragmentMaterialivSGIX, _gloffset_FragmentMaterialivSGIX ), NAME_FUNC_OFFSET( 7639, glGetFragmentLightfvSGIX, _gloffset_GetFragmentLightfvSGIX ), NAME_FUNC_OFFSET( 7664, glGetFragmentLightivSGIX, _gloffset_GetFragmentLightivSGIX ), NAME_FUNC_OFFSET( 7689, glGetFragmentMaterialfvSGIX, _gloffset_GetFragmentMaterialfvSGIX ), NAME_FUNC_OFFSET( 7717, glGetFragmentMaterialivSGIX, _gloffset_GetFragmentMaterialivSGIX ), NAME_FUNC_OFFSET( 7745, glLightEnviSGIX, _gloffset_LightEnviSGIX ), NAME_FUNC_OFFSET( 7761, glVertexWeightfEXT, _gloffset_VertexWeightfEXT ), NAME_FUNC_OFFSET( 7780, glVertexWeightfvEXT, _gloffset_VertexWeightfvEXT ), NAME_FUNC_OFFSET( 7800, glVertexWeightPointerEXT, _gloffset_VertexWeightPointerEXT ), NAME_FUNC_OFFSET( 7825, glFlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV ), NAME_FUNC_OFFSET( 7851, glVertexArrayRangeNV, _gloffset_VertexArrayRangeNV ), NAME_FUNC_OFFSET( 7872, glCombinerParameterfvNV, _gloffset_CombinerParameterfvNV ), NAME_FUNC_OFFSET( 7896, glCombinerParameterfNV, _gloffset_CombinerParameterfNV ), NAME_FUNC_OFFSET( 7919, glCombinerParameterivNV, _gloffset_CombinerParameterivNV ), NAME_FUNC_OFFSET( 7943, glCombinerParameteriNV, _gloffset_CombinerParameteriNV ), NAME_FUNC_OFFSET( 7966, glCombinerInputNV, _gloffset_CombinerInputNV ), NAME_FUNC_OFFSET( 7984, glCombinerOutputNV, _gloffset_CombinerOutputNV ), NAME_FUNC_OFFSET( 8003, glFinalCombinerInputNV, _gloffset_FinalCombinerInputNV ), NAME_FUNC_OFFSET( 8026, glGetCombinerInputParameterfvNV, _gloffset_GetCombinerInputParameterfvNV ), NAME_FUNC_OFFSET( 8058, glGetCombinerInputParameterivNV, _gloffset_GetCombinerInputParameterivNV ), NAME_FUNC_OFFSET( 8090, glGetCombinerOutputParameterfvNV, _gloffset_GetCombinerOutputParameterfvNV ), NAME_FUNC_OFFSET( 8123, glGetCombinerOutputParameterivNV, _gloffset_GetCombinerOutputParameterivNV ), NAME_FUNC_OFFSET( 8156, glGetFinalCombinerInputParameterfvNV, _gloffset_GetFinalCombinerInputParameterfvNV ), NAME_FUNC_OFFSET( 8193, glGetFinalCombinerInputParameterivNV, _gloffset_GetFinalCombinerInputParameterivNV ), NAME_FUNC_OFFSET( 8230, glResizeBuffersMESA, _gloffset_ResizeBuffersMESA ), NAME_FUNC_OFFSET( 8250, glWindowPos2dMESA, _gloffset_WindowPos2dMESA ), NAME_FUNC_OFFSET( 8268, glWindowPos2dvMESA, _gloffset_WindowPos2dvMESA ), NAME_FUNC_OFFSET( 8287, glWindowPos2fMESA, _gloffset_WindowPos2fMESA ), NAME_FUNC_OFFSET( 8305, glWindowPos2fvMESA, _gloffset_WindowPos2fvMESA ), NAME_FUNC_OFFSET( 8324, glWindowPos2iMESA, _gloffset_WindowPos2iMESA ), NAME_FUNC_OFFSET( 8342, glWindowPos2ivMESA, _gloffset_WindowPos2ivMESA ), NAME_FUNC_OFFSET( 8361, glWindowPos2sMESA, _gloffset_WindowPos2sMESA ), NAME_FUNC_OFFSET( 8379, glWindowPos2svMESA, _gloffset_WindowPos2svMESA ), NAME_FUNC_OFFSET( 8398, glWindowPos3dMESA, _gloffset_WindowPos3dMESA ), NAME_FUNC_OFFSET( 8416, glWindowPos3dvMESA, _gloffset_WindowPos3dvMESA ), NAME_FUNC_OFFSET( 8435, glWindowPos3fMESA, _gloffset_WindowPos3fMESA ), NAME_FUNC_OFFSET( 8453, glWindowPos3fvMESA, _gloffset_WindowPos3fvMESA ), NAME_FUNC_OFFSET( 8472, glWindowPos3iMESA, _gloffset_WindowPos3iMESA ), NAME_FUNC_OFFSET( 8490, glWindowPos3ivMESA, _gloffset_WindowPos3ivMESA ), NAME_FUNC_OFFSET( 8509, glWindowPos3sMESA, _gloffset_WindowPos3sMESA ), NAME_FUNC_OFFSET( 8527, glWindowPos3svMESA, _gloffset_WindowPos3svMESA ), NAME_FUNC_OFFSET( 8546, glWindowPos4dMESA, _gloffset_WindowPos4dMESA ), NAME_FUNC_OFFSET( 8564, glWindowPos4dvMESA, _gloffset_WindowPos4dvMESA ), NAME_FUNC_OFFSET( 8583, glWindowPos4fMESA, _gloffset_WindowPos4fMESA ), NAME_FUNC_OFFSET( 8601, glWindowPos4fvMESA, _gloffset_WindowPos4fvMESA ), NAME_FUNC_OFFSET( 8620, glWindowPos4iMESA, _gloffset_WindowPos4iMESA ), NAME_FUNC_OFFSET( 8638, glWindowPos4ivMESA, _gloffset_WindowPos4ivMESA ), NAME_FUNC_OFFSET( 8657, glWindowPos4sMESA, _gloffset_WindowPos4sMESA ), NAME_FUNC_OFFSET( 8675, glWindowPos4svMESA, _gloffset_WindowPos4svMESA ), NAME_FUNC_OFFSET( 8694, glBlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT ), NAME_FUNC_OFFSET( 8717, glIndexMaterialEXT, _gloffset_IndexMaterialEXT ), NAME_FUNC_OFFSET( 8736, glIndexFuncEXT, _gloffset_IndexFuncEXT ), NAME_FUNC_OFFSET( 8751, glLockArraysEXT, _gloffset_LockArraysEXT ), NAME_FUNC_OFFSET( 8767, glUnlockArraysEXT, _gloffset_UnlockArraysEXT ), NAME_FUNC_OFFSET( 8785, glCullParameterdvEXT, _gloffset_CullParameterdvEXT ), NAME_FUNC_OFFSET( 8806, glCullParameterfvEXT, _gloffset_CullParameterfvEXT ), NAME_FUNC_OFFSET( 8827, glHintPGI, _gloffset_HintPGI ), NAME_FUNC_OFFSET( 8837, glFogCoordfEXT, _gloffset_FogCoordfEXT ), NAME_FUNC_OFFSET( 8852, glFogCoordfvEXT, _gloffset_FogCoordfvEXT ), NAME_FUNC_OFFSET( 8868, glFogCoorddEXT, _gloffset_FogCoorddEXT ), NAME_FUNC_OFFSET( 8883, glFogCoorddvEXT, _gloffset_FogCoorddvEXT ), NAME_FUNC_OFFSET( 8899, glFogCoordPointerEXT, _gloffset_FogCoordPointerEXT ), NAME_FUNC_OFFSET( 8920, glGetColorTableEXT, _gloffset_GetColorTableEXT ), NAME_FUNC_OFFSET( 8939, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameterivEXT ), NAME_FUNC_OFFSET( 8969, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfvEXT ), NAME_FUNC_OFFSET( 8999, glTbufferMask3DFX, _gloffset_TbufferMask3DFX ), NAME_FUNC_OFFSET( 9017, glCompressedTexImage3DARB, _gloffset_CompressedTexImage3DARB ), NAME_FUNC_OFFSET( 9043, glCompressedTexImage2DARB, _gloffset_CompressedTexImage2DARB ), NAME_FUNC_OFFSET( 9069, glCompressedTexImage1DARB, _gloffset_CompressedTexImage1DARB ), NAME_FUNC_OFFSET( 9095, glCompressedTexSubImage3DARB, _gloffset_CompressedTexSubImage3DARB ), NAME_FUNC_OFFSET( 9124, glCompressedTexSubImage2DARB, _gloffset_CompressedTexSubImage2DARB ), NAME_FUNC_OFFSET( 9153, glCompressedTexSubImage1DARB, _gloffset_CompressedTexSubImage1DARB ), NAME_FUNC_OFFSET( 9182, glGetCompressedTexImageARB, _gloffset_GetCompressedTexImageARB ), NAME_FUNC_OFFSET( 9209, glSecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT ), NAME_FUNC_OFFSET( 9231, glSecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT ), NAME_FUNC_OFFSET( 9254, glSecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT ), NAME_FUNC_OFFSET( 9276, glSecondaryColor3dvEXT, _gloffset_SecondaryColor3dvEXT ), NAME_FUNC_OFFSET( 9299, glSecondaryColor3fEXT, _gloffset_SecondaryColor3fEXT ), NAME_FUNC_OFFSET( 9321, glSecondaryColor3fvEXT, _gloffset_SecondaryColor3fvEXT ), NAME_FUNC_OFFSET( 9344, glSecondaryColor3iEXT, _gloffset_SecondaryColor3iEXT ), NAME_FUNC_OFFSET( 9366, glSecondaryColor3ivEXT, _gloffset_SecondaryColor3ivEXT ), NAME_FUNC_OFFSET( 9389, glSecondaryColor3sEXT, _gloffset_SecondaryColor3sEXT ), NAME_FUNC_OFFSET( 9411, glSecondaryColor3svEXT, _gloffset_SecondaryColor3svEXT ), NAME_FUNC_OFFSET( 9434, glSecondaryColor3ubEXT, _gloffset_SecondaryColor3ubEXT ), NAME_FUNC_OFFSET( 9457, glSecondaryColor3ubvEXT, _gloffset_SecondaryColor3ubvEXT ), NAME_FUNC_OFFSET( 9481, glSecondaryColor3uiEXT, _gloffset_SecondaryColor3uiEXT ), NAME_FUNC_OFFSET( 9504, glSecondaryColor3uivEXT, _gloffset_SecondaryColor3uivEXT ), NAME_FUNC_OFFSET( 9528, glSecondaryColor3usEXT, _gloffset_SecondaryColor3usEXT ), NAME_FUNC_OFFSET( 9551, glSecondaryColor3usvEXT, _gloffset_SecondaryColor3usvEXT ), NAME_FUNC_OFFSET( 9575, glSecondaryColorPointerEXT, _gloffset_SecondaryColorPointerEXT ), NAME_FUNC_OFFSET( 9602, glAreProgramsResidentNV, _gloffset_AreProgramsResidentNV ), NAME_FUNC_OFFSET( 9626, glBindProgramNV, _gloffset_BindProgramNV ), NAME_FUNC_OFFSET( 9642, glDeleteProgramsNV, _gloffset_DeleteProgramsNV ), NAME_FUNC_OFFSET( 9661, glExecuteProgramNV, _gloffset_ExecuteProgramNV ), NAME_FUNC_OFFSET( 9680, glGenProgramsNV, _gloffset_GenProgramsNV ), NAME_FUNC_OFFSET( 9696, glGetProgramParameterdvNV, _gloffset_GetProgramParameterdvNV ), NAME_FUNC_OFFSET( 9722, glGetProgramParameterfvNV, _gloffset_GetProgramParameterfvNV ), NAME_FUNC_OFFSET( 9748, glGetProgramivNV, _gloffset_GetProgramivNV ), NAME_FUNC_OFFSET( 9765, glGetProgramStringNV, _gloffset_GetProgramStringNV ), NAME_FUNC_OFFSET( 9786, glGetTrackMatrixivNV, _gloffset_GetTrackMatrixivNV ), NAME_FUNC_OFFSET( 9807, glGetVertexAttribdvARB, _gloffset_GetVertexAttribdvARB ), NAME_FUNC_OFFSET( 9830, glGetVertexAttribfvARB, _gloffset_GetVertexAttribfvARB ), NAME_FUNC_OFFSET( 9853, glGetVertexAttribivARB, _gloffset_GetVertexAttribivARB ), NAME_FUNC_OFFSET( 9876, glGetVertexAttribPointervNV, _gloffset_GetVertexAttribPointervNV ), NAME_FUNC_OFFSET( 9904, glIsProgramNV, _gloffset_IsProgramNV ), NAME_FUNC_OFFSET( 9918, glLoadProgramNV, _gloffset_LoadProgramNV ), NAME_FUNC_OFFSET( 9934, glProgramParameter4dNV, _gloffset_ProgramParameter4dNV ), NAME_FUNC_OFFSET( 9957, glProgramParameter4dvNV, _gloffset_ProgramParameter4dvNV ), NAME_FUNC_OFFSET( 9981, glProgramParameter4fNV, _gloffset_ProgramParameter4fNV ), NAME_FUNC_OFFSET( 10004, glProgramParameter4fvNV, _gloffset_ProgramParameter4fvNV ), NAME_FUNC_OFFSET( 10028, glProgramParameters4dvNV, _gloffset_ProgramParameters4dvNV ), NAME_FUNC_OFFSET( 10053, glProgramParameters4fvNV, _gloffset_ProgramParameters4fvNV ), NAME_FUNC_OFFSET( 10078, glRequestResidentProgramsNV, _gloffset_RequestResidentProgramsNV ), NAME_FUNC_OFFSET( 10106, glTrackMatrixNV, _gloffset_TrackMatrixNV ), NAME_FUNC_OFFSET( 10122, glVertexAttribPointerNV, _gloffset_VertexAttribPointerNV ), NAME_FUNC_OFFSET( 10146, glVertexAttrib1dARB, _gloffset_VertexAttrib1dARB ), NAME_FUNC_OFFSET( 10166, glVertexAttrib1dvARB, _gloffset_VertexAttrib1dvARB ), NAME_FUNC_OFFSET( 10187, glVertexAttrib1fARB, _gloffset_VertexAttrib1fARB ), NAME_FUNC_OFFSET( 10207, glVertexAttrib1fvARB, _gloffset_VertexAttrib1fvARB ), NAME_FUNC_OFFSET( 10228, glVertexAttrib1sARB, _gloffset_VertexAttrib1sARB ), NAME_FUNC_OFFSET( 10248, glVertexAttrib1svARB, _gloffset_VertexAttrib1svARB ), NAME_FUNC_OFFSET( 10269, glVertexAttrib2dARB, _gloffset_VertexAttrib2dARB ), NAME_FUNC_OFFSET( 10289, glVertexAttrib2dvARB, _gloffset_VertexAttrib2dvARB ), NAME_FUNC_OFFSET( 10310, glVertexAttrib2fARB, _gloffset_VertexAttrib2fARB ), NAME_FUNC_OFFSET( 10330, glVertexAttrib2fvARB, _gloffset_VertexAttrib2fvARB ), NAME_FUNC_OFFSET( 10351, glVertexAttrib2sARB, _gloffset_VertexAttrib2sARB ), NAME_FUNC_OFFSET( 10371, glVertexAttrib2svARB, _gloffset_VertexAttrib2svARB ), NAME_FUNC_OFFSET( 10392, glVertexAttrib3dARB, _gloffset_VertexAttrib3dARB ), NAME_FUNC_OFFSET( 10412, glVertexAttrib3dvARB, _gloffset_VertexAttrib3dvARB ), NAME_FUNC_OFFSET( 10433, glVertexAttrib3fARB, _gloffset_VertexAttrib3fARB ), NAME_FUNC_OFFSET( 10453, glVertexAttrib3fvARB, _gloffset_VertexAttrib3fvARB ), NAME_FUNC_OFFSET( 10474, glVertexAttrib3sARB, _gloffset_VertexAttrib3sARB ), NAME_FUNC_OFFSET( 10494, glVertexAttrib3svARB, _gloffset_VertexAttrib3svARB ), NAME_FUNC_OFFSET( 10515, glVertexAttrib4dARB, _gloffset_VertexAttrib4dARB ), NAME_FUNC_OFFSET( 10535, glVertexAttrib4dvARB, _gloffset_VertexAttrib4dvARB ), NAME_FUNC_OFFSET( 10556, glVertexAttrib4fARB, _gloffset_VertexAttrib4fARB ), NAME_FUNC_OFFSET( 10576, glVertexAttrib4fvARB, _gloffset_VertexAttrib4fvARB ), NAME_FUNC_OFFSET( 10597, glVertexAttrib4sARB, _gloffset_VertexAttrib4sARB ), NAME_FUNC_OFFSET( 10617, glVertexAttrib4svARB, _gloffset_VertexAttrib4svARB ), NAME_FUNC_OFFSET( 10638, glVertexAttrib4NubARB, _gloffset_VertexAttrib4NubARB ), NAME_FUNC_OFFSET( 10660, glVertexAttrib4NubvARB, _gloffset_VertexAttrib4NubvARB ), NAME_FUNC_OFFSET( 10683, glVertexAttribs1dvNV, _gloffset_VertexAttribs1dvNV ), NAME_FUNC_OFFSET( 10704, glVertexAttribs1fvNV, _gloffset_VertexAttribs1fvNV ), NAME_FUNC_OFFSET( 10725, glVertexAttribs1svNV, _gloffset_VertexAttribs1svNV ), NAME_FUNC_OFFSET( 10746, glVertexAttribs2dvNV, _gloffset_VertexAttribs2dvNV ), NAME_FUNC_OFFSET( 10767, glVertexAttribs2fvNV, _gloffset_VertexAttribs2fvNV ), NAME_FUNC_OFFSET( 10788, glVertexAttribs2svNV, _gloffset_VertexAttribs2svNV ), NAME_FUNC_OFFSET( 10809, glVertexAttribs3dvNV, _gloffset_VertexAttribs3dvNV ), NAME_FUNC_OFFSET( 10830, glVertexAttribs3fvNV, _gloffset_VertexAttribs3fvNV ), NAME_FUNC_OFFSET( 10851, glVertexAttribs3svNV, _gloffset_VertexAttribs3svNV ), NAME_FUNC_OFFSET( 10872, glVertexAttribs4dvNV, _gloffset_VertexAttribs4dvNV ), NAME_FUNC_OFFSET( 10893, glVertexAttribs4fvNV, _gloffset_VertexAttribs4fvNV ), NAME_FUNC_OFFSET( 10914, glVertexAttribs4svNV, _gloffset_VertexAttribs4svNV ), NAME_FUNC_OFFSET( 10935, glVertexAttribs4ubvNV, _gloffset_VertexAttribs4ubvNV ), NAME_FUNC_OFFSET( 10957, glPointParameteriNV, _gloffset_PointParameteriNV ), NAME_FUNC_OFFSET( 10977, glPointParameterivNV, _gloffset_PointParameterivNV ), NAME_FUNC_OFFSET( 10998, glMultiDrawArraysEXT, _gloffset_MultiDrawArraysEXT ), NAME_FUNC_OFFSET( 11019, glMultiDrawElementsEXT, _gloffset_MultiDrawElementsEXT ), NAME_FUNC_OFFSET( 11042, glActiveStencilFaceEXT, _gloffset_ActiveStencilFaceEXT ), NAME_FUNC_OFFSET( 11065, glDeleteFencesNV, _gloffset_DeleteFencesNV ), NAME_FUNC_OFFSET( 11082, glGenFencesNV, _gloffset_GenFencesNV ), NAME_FUNC_OFFSET( 11096, glIsFenceNV, _gloffset_IsFenceNV ), NAME_FUNC_OFFSET( 11108, glTestFenceNV, _gloffset_TestFenceNV ), NAME_FUNC_OFFSET( 11122, glGetFenceivNV, _gloffset_GetFenceivNV ), NAME_FUNC_OFFSET( 11137, glFinishFenceNV, _gloffset_FinishFenceNV ), NAME_FUNC_OFFSET( 11153, glSetFenceNV, _gloffset_SetFenceNV ), NAME_FUNC_OFFSET( 11166, glVertexAttrib4bvARB, _gloffset_VertexAttrib4bvARB ), NAME_FUNC_OFFSET( 11187, glVertexAttrib4ivARB, _gloffset_VertexAttrib4ivARB ), NAME_FUNC_OFFSET( 11208, glVertexAttrib4ubvARB, _gloffset_VertexAttrib4ubvARB ), NAME_FUNC_OFFSET( 11230, glVertexAttrib4usvARB, _gloffset_VertexAttrib4usvARB ), NAME_FUNC_OFFSET( 11252, glVertexAttrib4uivARB, _gloffset_VertexAttrib4uivARB ), NAME_FUNC_OFFSET( 11274, glVertexAttrib4NbvARB, _gloffset_VertexAttrib4NbvARB ), NAME_FUNC_OFFSET( 11296, glVertexAttrib4NsvARB, _gloffset_VertexAttrib4NsvARB ), NAME_FUNC_OFFSET( 11318, glVertexAttrib4NivARB, _gloffset_VertexAttrib4NivARB ), NAME_FUNC_OFFSET( 11340, glVertexAttrib4NusvARB, _gloffset_VertexAttrib4NusvARB ), NAME_FUNC_OFFSET( 11363, glVertexAttrib4NuivARB, _gloffset_VertexAttrib4NuivARB ), NAME_FUNC_OFFSET( 11386, glVertexAttribPointerARB, _gloffset_VertexAttribPointerARB ), NAME_FUNC_OFFSET( 11411, glEnableVertexAttribArrayARB, _gloffset_EnableVertexAttribArrayARB ), NAME_FUNC_OFFSET( 11440, glDisableVertexAttribArrayARB, _gloffset_DisableVertexAttribArrayARB ), NAME_FUNC_OFFSET( 11470, glProgramStringARB, _gloffset_ProgramStringARB ), NAME_FUNC_OFFSET( 11489, glProgramEnvParameter4dARB, _gloffset_ProgramEnvParameter4dARB ), NAME_FUNC_OFFSET( 11516, glProgramEnvParameter4dvARB, _gloffset_ProgramEnvParameter4dvARB ), NAME_FUNC_OFFSET( 11544, glProgramEnvParameter4fARB, _gloffset_ProgramEnvParameter4fARB ), NAME_FUNC_OFFSET( 11571, glProgramEnvParameter4fvARB, _gloffset_ProgramEnvParameter4fvARB ), NAME_FUNC_OFFSET( 11599, glProgramLocalParameter4dARB, _gloffset_ProgramLocalParameter4dARB ), NAME_FUNC_OFFSET( 11628, glProgramLocalParameter4dvARB, _gloffset_ProgramLocalParameter4dvARB ), NAME_FUNC_OFFSET( 11658, glProgramLocalParameter4fARB, _gloffset_ProgramLocalParameter4fARB ), NAME_FUNC_OFFSET( 11687, glProgramLocalParameter4fvARB, _gloffset_ProgramLocalParameter4fvARB ), NAME_FUNC_OFFSET( 11717, glGetProgramEnvParameterdvARB, _gloffset_GetProgramEnvParameterdvARB ), NAME_FUNC_OFFSET( 11747, glGetProgramEnvParameterfvARB, _gloffset_GetProgramEnvParameterfvARB ), NAME_FUNC_OFFSET( 11777, glGetProgramLocalParameterdvARB, _gloffset_GetProgramLocalParameterdvARB ), NAME_FUNC_OFFSET( 11809, glGetProgramLocalParameterfvARB, _gloffset_GetProgramLocalParameterfvARB ), NAME_FUNC_OFFSET( 11841, glGetProgramivARB, _gloffset_GetProgramivARB ), NAME_FUNC_OFFSET( 11859, glGetProgramStringARB, _gloffset_GetProgramStringARB ), NAME_FUNC_OFFSET( 11881, glProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV ), NAME_FUNC_OFFSET( 11909, glProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV ), NAME_FUNC_OFFSET( 11937, glProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV ), NAME_FUNC_OFFSET( 11966, glProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV ), NAME_FUNC_OFFSET( 11995, glGetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV ), NAME_FUNC_OFFSET( 12026, glGetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV ), NAME_FUNC_OFFSET( 12057, glBindBufferARB, _gloffset_BindBufferARB ), NAME_FUNC_OFFSET( 12073, glBufferDataARB, _gloffset_BufferDataARB ), NAME_FUNC_OFFSET( 12089, glBufferSubDataARB, _gloffset_BufferSubDataARB ), NAME_FUNC_OFFSET( 12108, glDeleteBuffersARB, _gloffset_DeleteBuffersARB ), NAME_FUNC_OFFSET( 12127, glGenBuffersARB, _gloffset_GenBuffersARB ), NAME_FUNC_OFFSET( 12143, glGetBufferParameterivARB, _gloffset_GetBufferParameterivARB ), NAME_FUNC_OFFSET( 12169, glGetBufferPointervARB, _gloffset_GetBufferPointervARB ), NAME_FUNC_OFFSET( 12192, glGetBufferSubDataARB, _gloffset_GetBufferSubDataARB ), NAME_FUNC_OFFSET( 12214, glIsBufferARB, _gloffset_IsBufferARB ), NAME_FUNC_OFFSET( 12228, glMapBufferARB, _gloffset_MapBufferARB ), NAME_FUNC_OFFSET( 12243, glUnmapBufferARB, _gloffset_UnmapBufferARB ), NAME_FUNC_OFFSET( 12260, glDepthBoundsEXT, _gloffset_DepthBoundsEXT ), NAME_FUNC_OFFSET( 12277, glGenQueriesARB, _gloffset_GenQueriesARB ), NAME_FUNC_OFFSET( 12293, glDeleteQueriesARB, _gloffset_DeleteQueriesARB ), NAME_FUNC_OFFSET( 12312, glIsQueryARB, _gloffset_IsQueryARB ), NAME_FUNC_OFFSET( 12325, glBeginQueryARB, _gloffset_BeginQueryARB ), NAME_FUNC_OFFSET( 12341, glEndQueryARB, _gloffset_EndQueryARB ), NAME_FUNC_OFFSET( 12355, glGetQueryivARB, _gloffset_GetQueryivARB ), NAME_FUNC_OFFSET( 12371, glGetQueryObjectivARB, _gloffset_GetQueryObjectivARB ), NAME_FUNC_OFFSET( 12393, glGetQueryObjectuivARB, _gloffset_GetQueryObjectuivARB ), NAME_FUNC_OFFSET( 12416, glMultiModeDrawArraysIBM, _gloffset_MultiModeDrawArraysIBM ), NAME_FUNC_OFFSET( 12441, glMultiModeDrawElementsIBM, _gloffset_MultiModeDrawElementsIBM ), NAME_FUNC_OFFSET( 12468, glBlendEquationSeparateEXT, _gloffset_BlendEquationSeparateEXT ), NAME_FUNC_OFFSET( 12495, glDeleteObjectARB, _gloffset_DeleteObjectARB ), NAME_FUNC_OFFSET( 12513, glGetHandleARB, _gloffset_GetHandleARB ), NAME_FUNC_OFFSET( 12528, glDetachObjectARB, _gloffset_DetachObjectARB ), NAME_FUNC_OFFSET( 12546, glCreateShaderObjectARB, _gloffset_CreateShaderObjectARB ), NAME_FUNC_OFFSET( 12570, glShaderSourceARB, _gloffset_ShaderSourceARB ), NAME_FUNC_OFFSET( 12588, glCompileShaderARB, _gloffset_CompileShaderARB ), NAME_FUNC_OFFSET( 12607, glCreateProgramObjectARB, _gloffset_CreateProgramObjectARB ), NAME_FUNC_OFFSET( 12632, glAttachObjectARB, _gloffset_AttachObjectARB ), NAME_FUNC_OFFSET( 12650, glLinkProgramARB, _gloffset_LinkProgramARB ), NAME_FUNC_OFFSET( 12667, glUseProgramObjectARB, _gloffset_UseProgramObjectARB ), NAME_FUNC_OFFSET( 12689, glValidateProgramARB, _gloffset_ValidateProgramARB ), NAME_FUNC_OFFSET( 12710, glUniform1fARB, _gloffset_Uniform1fARB ), NAME_FUNC_OFFSET( 12725, glUniform2fARB, _gloffset_Uniform2fARB ), NAME_FUNC_OFFSET( 12740, glUniform3fARB, _gloffset_Uniform3fARB ), NAME_FUNC_OFFSET( 12755, glUniform4fARB, _gloffset_Uniform4fARB ), NAME_FUNC_OFFSET( 12770, glUniform1iARB, _gloffset_Uniform1iARB ), NAME_FUNC_OFFSET( 12785, glUniform2iARB, _gloffset_Uniform2iARB ), NAME_FUNC_OFFSET( 12800, glUniform3iARB, _gloffset_Uniform3iARB ), NAME_FUNC_OFFSET( 12815, glUniform4iARB, _gloffset_Uniform4iARB ), NAME_FUNC_OFFSET( 12830, glUniform1fvARB, _gloffset_Uniform1fvARB ), NAME_FUNC_OFFSET( 12846, glUniform2fvARB, _gloffset_Uniform2fvARB ), NAME_FUNC_OFFSET( 12862, glUniform3fvARB, _gloffset_Uniform3fvARB ), NAME_FUNC_OFFSET( 12878, glUniform4fvARB, _gloffset_Uniform4fvARB ), NAME_FUNC_OFFSET( 12894, glUniform1ivARB, _gloffset_Uniform1ivARB ), NAME_FUNC_OFFSET( 12910, glUniform2ivARB, _gloffset_Uniform2ivARB ), NAME_FUNC_OFFSET( 12926, glUniform3ivARB, _gloffset_Uniform3ivARB ), NAME_FUNC_OFFSET( 12942, glUniform4ivARB, _gloffset_Uniform4ivARB ), NAME_FUNC_OFFSET( 12958, glUniformMatrix2fvARB, _gloffset_UniformMatrix2fvARB ), NAME_FUNC_OFFSET( 12980, glUniformMatrix3fvARB, _gloffset_UniformMatrix3fvARB ), NAME_FUNC_OFFSET( 13002, glUniformMatrix4fvARB, _gloffset_UniformMatrix4fvARB ), NAME_FUNC_OFFSET( 13024, glGetObjectParameterfvARB, _gloffset_GetObjectParameterfvARB ), NAME_FUNC_OFFSET( 13050, glGetObjectParameterivARB, _gloffset_GetObjectParameterivARB ), NAME_FUNC_OFFSET( 13076, glGetInfoLogARB, _gloffset_GetInfoLogARB ), NAME_FUNC_OFFSET( 13092, glGetAttachedObjectsARB, _gloffset_GetAttachedObjectsARB ), NAME_FUNC_OFFSET( 13116, glGetUniformLocationARB, _gloffset_GetUniformLocationARB ), NAME_FUNC_OFFSET( 13140, glGetActiveUniformARB, _gloffset_GetActiveUniformARB ), NAME_FUNC_OFFSET( 13162, glGetUniformfvARB, _gloffset_GetUniformfvARB ), NAME_FUNC_OFFSET( 13180, glGetUniformivARB, _gloffset_GetUniformivARB ), NAME_FUNC_OFFSET( 13198, glGetShaderSourceARB, _gloffset_GetShaderSourceARB ), NAME_FUNC_OFFSET( 13219, glBindAttribLocationARB, _gloffset_BindAttribLocationARB ), NAME_FUNC_OFFSET( 13243, glGetActiveAttribARB, _gloffset_GetActiveAttribARB ), NAME_FUNC_OFFSET( 13264, glGetAttribLocationARB, _gloffset_GetAttribLocationARB ), NAME_FUNC_OFFSET( 13287, glGetVertexAttribdvNV, _gloffset_GetVertexAttribdvNV ), NAME_FUNC_OFFSET( 13309, glGetVertexAttribfvNV, _gloffset_GetVertexAttribfvNV ), NAME_FUNC_OFFSET( 13331, glGetVertexAttribivNV, _gloffset_GetVertexAttribivNV ), NAME_FUNC_OFFSET( 13353, glVertexAttrib1dNV, _gloffset_VertexAttrib1dNV ), NAME_FUNC_OFFSET( 13372, glVertexAttrib1dvNV, _gloffset_VertexAttrib1dvNV ), NAME_FUNC_OFFSET( 13392, glVertexAttrib1fNV, _gloffset_VertexAttrib1fNV ), NAME_FUNC_OFFSET( 13411, glVertexAttrib1fvNV, _gloffset_VertexAttrib1fvNV ), NAME_FUNC_OFFSET( 13431, glVertexAttrib1sNV, _gloffset_VertexAttrib1sNV ), NAME_FUNC_OFFSET( 13450, glVertexAttrib1svNV, _gloffset_VertexAttrib1svNV ), NAME_FUNC_OFFSET( 13470, glVertexAttrib2dNV, _gloffset_VertexAttrib2dNV ), NAME_FUNC_OFFSET( 13489, glVertexAttrib2dvNV, _gloffset_VertexAttrib2dvNV ), NAME_FUNC_OFFSET( 13509, glVertexAttrib2fNV, _gloffset_VertexAttrib2fNV ), NAME_FUNC_OFFSET( 13528, glVertexAttrib2fvNV, _gloffset_VertexAttrib2fvNV ), NAME_FUNC_OFFSET( 13548, glVertexAttrib2sNV, _gloffset_VertexAttrib2sNV ), NAME_FUNC_OFFSET( 13567, glVertexAttrib2svNV, _gloffset_VertexAttrib2svNV ), NAME_FUNC_OFFSET( 13587, glVertexAttrib3dNV, _gloffset_VertexAttrib3dNV ), NAME_FUNC_OFFSET( 13606, glVertexAttrib3dvNV, _gloffset_VertexAttrib3dvNV ), NAME_FUNC_OFFSET( 13626, glVertexAttrib3fNV, _gloffset_VertexAttrib3fNV ), NAME_FUNC_OFFSET( 13645, glVertexAttrib3fvNV, _gloffset_VertexAttrib3fvNV ), NAME_FUNC_OFFSET( 13665, glVertexAttrib3sNV, _gloffset_VertexAttrib3sNV ), NAME_FUNC_OFFSET( 13684, glVertexAttrib3svNV, _gloffset_VertexAttrib3svNV ), NAME_FUNC_OFFSET( 13704, glVertexAttrib4dNV, _gloffset_VertexAttrib4dNV ), NAME_FUNC_OFFSET( 13723, glVertexAttrib4dvNV, _gloffset_VertexAttrib4dvNV ), NAME_FUNC_OFFSET( 13743, glVertexAttrib4fNV, _gloffset_VertexAttrib4fNV ), NAME_FUNC_OFFSET( 13762, glVertexAttrib4fvNV, _gloffset_VertexAttrib4fvNV ), NAME_FUNC_OFFSET( 13782, glVertexAttrib4sNV, _gloffset_VertexAttrib4sNV ), NAME_FUNC_OFFSET( 13801, glVertexAttrib4svNV, _gloffset_VertexAttrib4svNV ), NAME_FUNC_OFFSET( 13821, glVertexAttrib4ubNV, _gloffset_VertexAttrib4ubNV ), NAME_FUNC_OFFSET( 13841, glVertexAttrib4ubvNV, _gloffset_VertexAttrib4ubvNV ), NAME_FUNC_OFFSET( 13862, glGenFragmentShadersATI, _gloffset_GenFragmentShadersATI ), NAME_FUNC_OFFSET( 13886, glBindFragmentShaderATI, _gloffset_BindFragmentShaderATI ), NAME_FUNC_OFFSET( 13910, glDeleteFragmentShaderATI, _gloffset_DeleteFragmentShaderATI ), NAME_FUNC_OFFSET( 13936, glBeginFragmentShaderATI, _gloffset_BeginFragmentShaderATI ), NAME_FUNC_OFFSET( 13961, glEndFragmentShaderATI, _gloffset_EndFragmentShaderATI ), NAME_FUNC_OFFSET( 13984, glPassTexCoordATI, _gloffset_PassTexCoordATI ), NAME_FUNC_OFFSET( 14002, glSampleMapATI, _gloffset_SampleMapATI ), NAME_FUNC_OFFSET( 14017, glColorFragmentOp1ATI, _gloffset_ColorFragmentOp1ATI ), NAME_FUNC_OFFSET( 14039, glColorFragmentOp2ATI, _gloffset_ColorFragmentOp2ATI ), NAME_FUNC_OFFSET( 14061, glColorFragmentOp3ATI, _gloffset_ColorFragmentOp3ATI ), NAME_FUNC_OFFSET( 14083, glAlphaFragmentOp1ATI, _gloffset_AlphaFragmentOp1ATI ), NAME_FUNC_OFFSET( 14105, glAlphaFragmentOp2ATI, _gloffset_AlphaFragmentOp2ATI ), NAME_FUNC_OFFSET( 14127, glAlphaFragmentOp3ATI, _gloffset_AlphaFragmentOp3ATI ), NAME_FUNC_OFFSET( 14149, glSetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI ), NAME_FUNC_OFFSET( 14180, glIsRenderbufferEXT, _gloffset_IsRenderbufferEXT ), NAME_FUNC_OFFSET( 14200, glBindRenderbufferEXT, _gloffset_BindRenderbufferEXT ), NAME_FUNC_OFFSET( 14222, glDeleteRenderbuffersEXT, _gloffset_DeleteRenderbuffersEXT ), NAME_FUNC_OFFSET( 14247, glGenRenderbuffersEXT, _gloffset_GenRenderbuffersEXT ), NAME_FUNC_OFFSET( 14269, glRenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT ), NAME_FUNC_OFFSET( 14294, glGetRenderbufferParameterivEXT, _gloffset_GetRenderbufferParameterivEXT ), NAME_FUNC_OFFSET( 14326, glIsFramebufferEXT, _gloffset_IsFramebufferEXT ), NAME_FUNC_OFFSET( 14345, glBindFramebufferEXT, _gloffset_BindFramebufferEXT ), NAME_FUNC_OFFSET( 14366, glDeleteFramebuffersEXT, _gloffset_DeleteFramebuffersEXT ), NAME_FUNC_OFFSET( 14390, glGenFramebuffersEXT, _gloffset_GenFramebuffersEXT ), NAME_FUNC_OFFSET( 14411, glCheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT ), NAME_FUNC_OFFSET( 14439, glFramebufferTexture1DEXT, _gloffset_FramebufferTexture1DEXT ), NAME_FUNC_OFFSET( 14465, glFramebufferTexture2DEXT, _gloffset_FramebufferTexture2DEXT ), NAME_FUNC_OFFSET( 14491, glFramebufferTexture3DEXT, _gloffset_FramebufferTexture3DEXT ), NAME_FUNC_OFFSET( 14517, glFramebufferRenderbufferEXT, _gloffset_FramebufferRenderbufferEXT ), NAME_FUNC_OFFSET( 14546, glGetFramebufferAttachmentParameterivEXT, _gloffset_GetFramebufferAttachmentParameterivEXT ), NAME_FUNC_OFFSET( 14587, glGenerateMipmapEXT, _gloffset_GenerateMipmapEXT ), NAME_FUNC_OFFSET( 14607, glStencilFuncSeparate, _gloffset_StencilFuncSeparate ), NAME_FUNC_OFFSET( 14629, glStencilOpSeparate, _gloffset_StencilOpSeparate ), NAME_FUNC_OFFSET( 14649, glStencilMaskSeparate, _gloffset_StencilMaskSeparate ), NAME_FUNC_OFFSET( 14671, glArrayElementEXT, _gloffset_ArrayElement ), NAME_FUNC_OFFSET( 14689, glBindTextureEXT, _gloffset_BindTexture ), NAME_FUNC_OFFSET( 14706, glDrawArraysEXT, _gloffset_DrawArrays ), NAME_FUNC_OFFSET( 14722, glCopyTexImage1DEXT, _gloffset_CopyTexImage1D ), NAME_FUNC_OFFSET( 14742, glCopyTexImage2DEXT, _gloffset_CopyTexImage2D ), NAME_FUNC_OFFSET( 14762, glCopyTexSubImage1DEXT, _gloffset_CopyTexSubImage1D ), NAME_FUNC_OFFSET( 14785, glCopyTexSubImage2DEXT, _gloffset_CopyTexSubImage2D ), NAME_FUNC_OFFSET( 14808, glDeleteTexturesEXT, _gloffset_DeleteTextures ), NAME_FUNC_OFFSET( 14828, glGetPointervEXT, _gloffset_GetPointerv ), NAME_FUNC_OFFSET( 14845, glPrioritizeTexturesEXT, _gloffset_PrioritizeTextures ), NAME_FUNC_OFFSET( 14869, glTexSubImage1DEXT, _gloffset_TexSubImage1D ), NAME_FUNC_OFFSET( 14888, glTexSubImage2DEXT, _gloffset_TexSubImage2D ), NAME_FUNC_OFFSET( 14907, glBlendColorEXT, _gloffset_BlendColor ), NAME_FUNC_OFFSET( 14923, glBlendEquationEXT, _gloffset_BlendEquation ), NAME_FUNC_OFFSET( 14942, glDrawRangeElementsEXT, _gloffset_DrawRangeElements ), NAME_FUNC_OFFSET( 14965, glColorTableSGI, _gloffset_ColorTable ), NAME_FUNC_OFFSET( 14981, glColorTableEXT, _gloffset_ColorTable ), NAME_FUNC_OFFSET( 14997, glColorTableParameterfvSGI, _gloffset_ColorTableParameterfv ), NAME_FUNC_OFFSET( 15024, glColorTableParameterivSGI, _gloffset_ColorTableParameteriv ), NAME_FUNC_OFFSET( 15051, glCopyColorTableSGI, _gloffset_CopyColorTable ), NAME_FUNC_OFFSET( 15071, glColorSubTableEXT, _gloffset_ColorSubTable ), NAME_FUNC_OFFSET( 15090, glCopyColorSubTableEXT, _gloffset_CopyColorSubTable ), NAME_FUNC_OFFSET( 15113, glConvolutionFilter1DEXT, _gloffset_ConvolutionFilter1D ), NAME_FUNC_OFFSET( 15138, glConvolutionFilter2DEXT, _gloffset_ConvolutionFilter2D ), NAME_FUNC_OFFSET( 15163, glConvolutionParameterfEXT, _gloffset_ConvolutionParameterf ), NAME_FUNC_OFFSET( 15190, glConvolutionParameterfvEXT, _gloffset_ConvolutionParameterfv ), NAME_FUNC_OFFSET( 15218, glConvolutionParameteriEXT, _gloffset_ConvolutionParameteri ), NAME_FUNC_OFFSET( 15245, glConvolutionParameterivEXT, _gloffset_ConvolutionParameteriv ), NAME_FUNC_OFFSET( 15273, glCopyConvolutionFilter1DEXT, _gloffset_CopyConvolutionFilter1D ), NAME_FUNC_OFFSET( 15302, glCopyConvolutionFilter2DEXT, _gloffset_CopyConvolutionFilter2D ), NAME_FUNC_OFFSET( 15331, glSeparableFilter2DEXT, _gloffset_SeparableFilter2D ), NAME_FUNC_OFFSET( 15354, glHistogramEXT, _gloffset_Histogram ), NAME_FUNC_OFFSET( 15369, glMinmaxEXT, _gloffset_Minmax ), NAME_FUNC_OFFSET( 15381, glResetHistogramEXT, _gloffset_ResetHistogram ), NAME_FUNC_OFFSET( 15401, glResetMinmaxEXT, _gloffset_ResetMinmax ), NAME_FUNC_OFFSET( 15418, glTexImage3DEXT, _gloffset_TexImage3D ), NAME_FUNC_OFFSET( 15434, glTexSubImage3DEXT, _gloffset_TexSubImage3D ), NAME_FUNC_OFFSET( 15453, glCopyTexSubImage3DEXT, _gloffset_CopyTexSubImage3D ), NAME_FUNC_OFFSET( 15476, glActiveTexture, _gloffset_ActiveTextureARB ), NAME_FUNC_OFFSET( 15492, glClientActiveTexture, _gloffset_ClientActiveTextureARB ), NAME_FUNC_OFFSET( 15514, glMultiTexCoord1d, _gloffset_MultiTexCoord1dARB ), NAME_FUNC_OFFSET( 15532, glMultiTexCoord1dv, _gloffset_MultiTexCoord1dvARB ), NAME_FUNC_OFFSET( 15551, glMultiTexCoord1f, _gloffset_MultiTexCoord1fARB ), NAME_FUNC_OFFSET( 15569, glMultiTexCoord1fv, _gloffset_MultiTexCoord1fvARB ), NAME_FUNC_OFFSET( 15588, glMultiTexCoord1i, _gloffset_MultiTexCoord1iARB ), NAME_FUNC_OFFSET( 15606, glMultiTexCoord1iv, _gloffset_MultiTexCoord1ivARB ), NAME_FUNC_OFFSET( 15625, glMultiTexCoord1s, _gloffset_MultiTexCoord1sARB ), NAME_FUNC_OFFSET( 15643, glMultiTexCoord1sv, _gloffset_MultiTexCoord1svARB ), NAME_FUNC_OFFSET( 15662, glMultiTexCoord2d, _gloffset_MultiTexCoord2dARB ), NAME_FUNC_OFFSET( 15680, glMultiTexCoord2dv, _gloffset_MultiTexCoord2dvARB ), NAME_FUNC_OFFSET( 15699, glMultiTexCoord2f, _gloffset_MultiTexCoord2fARB ), NAME_FUNC_OFFSET( 15717, glMultiTexCoord2fv, _gloffset_MultiTexCoord2fvARB ), NAME_FUNC_OFFSET( 15736, glMultiTexCoord2i, _gloffset_MultiTexCoord2iARB ), NAME_FUNC_OFFSET( 15754, glMultiTexCoord2iv, _gloffset_MultiTexCoord2ivARB ), NAME_FUNC_OFFSET( 15773, glMultiTexCoord2s, _gloffset_MultiTexCoord2sARB ), NAME_FUNC_OFFSET( 15791, glMultiTexCoord2sv, _gloffset_MultiTexCoord2svARB ), NAME_FUNC_OFFSET( 15810, glMultiTexCoord3d, _gloffset_MultiTexCoord3dARB ), NAME_FUNC_OFFSET( 15828, glMultiTexCoord3dv, _gloffset_MultiTexCoord3dvARB ), NAME_FUNC_OFFSET( 15847, glMultiTexCoord3f, _gloffset_MultiTexCoord3fARB ), NAME_FUNC_OFFSET( 15865, glMultiTexCoord3fv, _gloffset_MultiTexCoord3fvARB ), NAME_FUNC_OFFSET( 15884, glMultiTexCoord3i, _gloffset_MultiTexCoord3iARB ), NAME_FUNC_OFFSET( 15902, glMultiTexCoord3iv, _gloffset_MultiTexCoord3ivARB ), NAME_FUNC_OFFSET( 15921, glMultiTexCoord3s, _gloffset_MultiTexCoord3sARB ), NAME_FUNC_OFFSET( 15939, glMultiTexCoord3sv, _gloffset_MultiTexCoord3svARB ), NAME_FUNC_OFFSET( 15958, glMultiTexCoord4d, _gloffset_MultiTexCoord4dARB ), NAME_FUNC_OFFSET( 15976, glMultiTexCoord4dv, _gloffset_MultiTexCoord4dvARB ), NAME_FUNC_OFFSET( 15995, glMultiTexCoord4f, _gloffset_MultiTexCoord4fARB ), NAME_FUNC_OFFSET( 16013, glMultiTexCoord4fv, _gloffset_MultiTexCoord4fvARB ), NAME_FUNC_OFFSET( 16032, glMultiTexCoord4i, _gloffset_MultiTexCoord4iARB ), NAME_FUNC_OFFSET( 16050, glMultiTexCoord4iv, _gloffset_MultiTexCoord4ivARB ), NAME_FUNC_OFFSET( 16069, glMultiTexCoord4s, _gloffset_MultiTexCoord4sARB ), NAME_FUNC_OFFSET( 16087, glMultiTexCoord4sv, _gloffset_MultiTexCoord4svARB ), NAME_FUNC_OFFSET( 16106, glLoadTransposeMatrixf, _gloffset_LoadTransposeMatrixfARB ), NAME_FUNC_OFFSET( 16129, glLoadTransposeMatrixd, _gloffset_LoadTransposeMatrixdARB ), NAME_FUNC_OFFSET( 16152, glMultTransposeMatrixf, _gloffset_MultTransposeMatrixfARB ), NAME_FUNC_OFFSET( 16175, glMultTransposeMatrixd, _gloffset_MultTransposeMatrixdARB ), NAME_FUNC_OFFSET( 16198, glSampleCoverage, _gloffset_SampleCoverageARB ), NAME_FUNC_OFFSET( 16215, glDrawBuffersATI, _gloffset_DrawBuffersARB ), NAME_FUNC_OFFSET( 16232, glSampleMaskEXT, _gloffset_SampleMaskSGIS ), NAME_FUNC_OFFSET( 16248, glSamplePatternEXT, _gloffset_SamplePatternSGIS ), NAME_FUNC_OFFSET( 16267, glPointParameterf, _gloffset_PointParameterfEXT ), NAME_FUNC_OFFSET( 16285, glPointParameterfARB, _gloffset_PointParameterfEXT ), NAME_FUNC_OFFSET( 16306, glPointParameterfSGIS, _gloffset_PointParameterfEXT ), NAME_FUNC_OFFSET( 16328, glPointParameterfv, _gloffset_PointParameterfvEXT ), NAME_FUNC_OFFSET( 16347, glPointParameterfvARB, _gloffset_PointParameterfvEXT ), NAME_FUNC_OFFSET( 16369, glPointParameterfvSGIS, _gloffset_PointParameterfvEXT ), NAME_FUNC_OFFSET( 16392, glWindowPos2d, _gloffset_WindowPos2dMESA ), NAME_FUNC_OFFSET( 16406, glWindowPos2dARB, _gloffset_WindowPos2dMESA ), NAME_FUNC_OFFSET( 16423, glWindowPos2dv, _gloffset_WindowPos2dvMESA ), NAME_FUNC_OFFSET( 16438, glWindowPos2dvARB, _gloffset_WindowPos2dvMESA ), NAME_FUNC_OFFSET( 16456, glWindowPos2f, _gloffset_WindowPos2fMESA ), NAME_FUNC_OFFSET( 16470, glWindowPos2fARB, _gloffset_WindowPos2fMESA ), NAME_FUNC_OFFSET( 16487, glWindowPos2fv, _gloffset_WindowPos2fvMESA ), NAME_FUNC_OFFSET( 16502, glWindowPos2fvARB, _gloffset_WindowPos2fvMESA ), NAME_FUNC_OFFSET( 16520, glWindowPos2i, _gloffset_WindowPos2iMESA ), NAME_FUNC_OFFSET( 16534, glWindowPos2iARB, _gloffset_WindowPos2iMESA ), NAME_FUNC_OFFSET( 16551, glWindowPos2iv, _gloffset_WindowPos2ivMESA ), NAME_FUNC_OFFSET( 16566, glWindowPos2ivARB, _gloffset_WindowPos2ivMESA ), NAME_FUNC_OFFSET( 16584, glWindowPos2s, _gloffset_WindowPos2sMESA ), NAME_FUNC_OFFSET( 16598, glWindowPos2sARB, _gloffset_WindowPos2sMESA ), NAME_FUNC_OFFSET( 16615, glWindowPos2sv, _gloffset_WindowPos2svMESA ), NAME_FUNC_OFFSET( 16630, glWindowPos2svARB, _gloffset_WindowPos2svMESA ), NAME_FUNC_OFFSET( 16648, glWindowPos3d, _gloffset_WindowPos3dMESA ), NAME_FUNC_OFFSET( 16662, glWindowPos3dARB, _gloffset_WindowPos3dMESA ), NAME_FUNC_OFFSET( 16679, glWindowPos3dv, _gloffset_WindowPos3dvMESA ), NAME_FUNC_OFFSET( 16694, glWindowPos3dvARB, _gloffset_WindowPos3dvMESA ), NAME_FUNC_OFFSET( 16712, glWindowPos3f, _gloffset_WindowPos3fMESA ), NAME_FUNC_OFFSET( 16726, glWindowPos3fARB, _gloffset_WindowPos3fMESA ), NAME_FUNC_OFFSET( 16743, glWindowPos3fv, _gloffset_WindowPos3fvMESA ), NAME_FUNC_OFFSET( 16758, glWindowPos3fvARB, _gloffset_WindowPos3fvMESA ), NAME_FUNC_OFFSET( 16776, glWindowPos3i, _gloffset_WindowPos3iMESA ), NAME_FUNC_OFFSET( 16790, glWindowPos3iARB, _gloffset_WindowPos3iMESA ), NAME_FUNC_OFFSET( 16807, glWindowPos3iv, _gloffset_WindowPos3ivMESA ), NAME_FUNC_OFFSET( 16822, glWindowPos3ivARB, _gloffset_WindowPos3ivMESA ), NAME_FUNC_OFFSET( 16840, glWindowPos3s, _gloffset_WindowPos3sMESA ), NAME_FUNC_OFFSET( 16854, glWindowPos3sARB, _gloffset_WindowPos3sMESA ), NAME_FUNC_OFFSET( 16871, glWindowPos3sv, _gloffset_WindowPos3svMESA ), NAME_FUNC_OFFSET( 16886, glWindowPos3svARB, _gloffset_WindowPos3svMESA ), NAME_FUNC_OFFSET( 16904, glBlendFuncSeparate, _gloffset_BlendFuncSeparateEXT ), NAME_FUNC_OFFSET( 16924, glBlendFuncSeparateINGR, _gloffset_BlendFuncSeparateEXT ), NAME_FUNC_OFFSET( 16948, glFogCoordf, _gloffset_FogCoordfEXT ), NAME_FUNC_OFFSET( 16960, glFogCoordfv, _gloffset_FogCoordfvEXT ), NAME_FUNC_OFFSET( 16973, glFogCoordd, _gloffset_FogCoorddEXT ), NAME_FUNC_OFFSET( 16985, glFogCoorddv, _gloffset_FogCoorddvEXT ), NAME_FUNC_OFFSET( 16998, glFogCoordPointer, _gloffset_FogCoordPointerEXT ), NAME_FUNC_OFFSET( 17016, glCompressedTexImage3D, _gloffset_CompressedTexImage3DARB ), NAME_FUNC_OFFSET( 17039, glCompressedTexImage2D, _gloffset_CompressedTexImage2DARB ), NAME_FUNC_OFFSET( 17062, glCompressedTexImage1D, _gloffset_CompressedTexImage1DARB ), NAME_FUNC_OFFSET( 17085, glCompressedTexSubImage3D, _gloffset_CompressedTexSubImage3DARB ), NAME_FUNC_OFFSET( 17111, glCompressedTexSubImage2D, _gloffset_CompressedTexSubImage2DARB ), NAME_FUNC_OFFSET( 17137, glCompressedTexSubImage1D, _gloffset_CompressedTexSubImage1DARB ), NAME_FUNC_OFFSET( 17163, glGetCompressedTexImage, _gloffset_GetCompressedTexImageARB ), NAME_FUNC_OFFSET( 17187, glSecondaryColor3b, _gloffset_SecondaryColor3bEXT ), NAME_FUNC_OFFSET( 17206, glSecondaryColor3bv, _gloffset_SecondaryColor3bvEXT ), NAME_FUNC_OFFSET( 17226, glSecondaryColor3d, _gloffset_SecondaryColor3dEXT ), NAME_FUNC_OFFSET( 17245, glSecondaryColor3dv, _gloffset_SecondaryColor3dvEXT ), NAME_FUNC_OFFSET( 17265, glSecondaryColor3f, _gloffset_SecondaryColor3fEXT ), NAME_FUNC_OFFSET( 17284, glSecondaryColor3fv, _gloffset_SecondaryColor3fvEXT ), NAME_FUNC_OFFSET( 17304, glSecondaryColor3i, _gloffset_SecondaryColor3iEXT ), NAME_FUNC_OFFSET( 17323, glSecondaryColor3iv, _gloffset_SecondaryColor3ivEXT ), NAME_FUNC_OFFSET( 17343, glSecondaryColor3s, _gloffset_SecondaryColor3sEXT ), NAME_FUNC_OFFSET( 17362, glSecondaryColor3sv, _gloffset_SecondaryColor3svEXT ), NAME_FUNC_OFFSET( 17382, glSecondaryColor3ub, _gloffset_SecondaryColor3ubEXT ), NAME_FUNC_OFFSET( 17402, glSecondaryColor3ubv, _gloffset_SecondaryColor3ubvEXT ), NAME_FUNC_OFFSET( 17423, glSecondaryColor3ui, _gloffset_SecondaryColor3uiEXT ), NAME_FUNC_OFFSET( 17443, glSecondaryColor3uiv, _gloffset_SecondaryColor3uivEXT ), NAME_FUNC_OFFSET( 17464, glSecondaryColor3us, _gloffset_SecondaryColor3usEXT ), NAME_FUNC_OFFSET( 17484, glSecondaryColor3usv, _gloffset_SecondaryColor3usvEXT ), NAME_FUNC_OFFSET( 17505, glSecondaryColorPointer, _gloffset_SecondaryColorPointerEXT ), NAME_FUNC_OFFSET( 17529, glBindProgramARB, _gloffset_BindProgramNV ), NAME_FUNC_OFFSET( 17546, glDeleteProgramsARB, _gloffset_DeleteProgramsNV ), NAME_FUNC_OFFSET( 17566, glGenProgramsARB, _gloffset_GenProgramsNV ), NAME_FUNC_OFFSET( 17583, glGetVertexAttribPointervARB, _gloffset_GetVertexAttribPointervNV ), NAME_FUNC_OFFSET( 17612, glIsProgramARB, _gloffset_IsProgramNV ), NAME_FUNC_OFFSET( 17627, glPointParameteri, _gloffset_PointParameteriNV ), NAME_FUNC_OFFSET( 17645, glPointParameteriv, _gloffset_PointParameterivNV ), NAME_FUNC_OFFSET( 17664, glMultiDrawArrays, _gloffset_MultiDrawArraysEXT ), NAME_FUNC_OFFSET( 17682, glMultiDrawElements, _gloffset_MultiDrawElementsEXT ), NAME_FUNC_OFFSET( 17702, glBindBuffer, _gloffset_BindBufferARB ), NAME_FUNC_OFFSET( 17715, glBufferData, _gloffset_BufferDataARB ), NAME_FUNC_OFFSET( 17728, glBufferSubData, _gloffset_BufferSubDataARB ), NAME_FUNC_OFFSET( 17744, glDeleteBuffers, _gloffset_DeleteBuffersARB ), NAME_FUNC_OFFSET( 17760, glGenBuffers, _gloffset_GenBuffersARB ), NAME_FUNC_OFFSET( 17773, glGetBufferParameteriv, _gloffset_GetBufferParameterivARB ), NAME_FUNC_OFFSET( 17796, glGetBufferPointerv, _gloffset_GetBufferPointervARB ), NAME_FUNC_OFFSET( 17816, glGetBufferSubData, _gloffset_GetBufferSubDataARB ), NAME_FUNC_OFFSET( 17835, glIsBuffer, _gloffset_IsBufferARB ), NAME_FUNC_OFFSET( 17846, glMapBuffer, _gloffset_MapBufferARB ), NAME_FUNC_OFFSET( 17858, glUnmapBuffer, _gloffset_UnmapBufferARB ), NAME_FUNC_OFFSET( 17872, glGenQueries, _gloffset_GenQueriesARB ), NAME_FUNC_OFFSET( 17885, glDeleteQueries, _gloffset_DeleteQueriesARB ), NAME_FUNC_OFFSET( 17901, glIsQuery, _gloffset_IsQueryARB ), NAME_FUNC_OFFSET( 17911, glBeginQuery, _gloffset_BeginQueryARB ), NAME_FUNC_OFFSET( 17924, glEndQuery, _gloffset_EndQueryARB ), NAME_FUNC_OFFSET( 17935, glGetQueryiv, _gloffset_GetQueryivARB ), NAME_FUNC_OFFSET( 17948, glGetQueryObjectiv, _gloffset_GetQueryObjectivARB ), NAME_FUNC_OFFSET( 17967, glGetQueryObjectuiv, _gloffset_GetQueryObjectuivARB ), NAME_FUNC_OFFSET( 17987, glBlendEquationSeparateATI, _gloffset_BlendEquationSeparateEXT ), NAME_FUNC_OFFSET( -1, NULL, 0 ) }; #undef NAME_FUNC_OFFSET nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/glapi/glthread.c0000644000000000000000000001645713614532424020264 0ustar /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * XXX There's probably some work to do in order to make this file * truly reusable outside of Mesa. First, the glheader.h include must go. */ #include "glheader.h" #include "glthread.h" /* * This file should still compile even when THREADS is not defined. * This is to make things easier to deal with on the makefile scene.. */ #ifdef THREADS #include /* * Error messages */ #define INIT_TSD_ERROR "_glthread_: failed to allocate key for thread specific data" #define GET_TSD_ERROR "_glthread_: failed to get thread specific data" #define SET_TSD_ERROR "_glthread_: thread failed to set thread specific data" /* * Magic number to determine if a TSD object has been initialized. * Kind of a hack but there doesn't appear to be a better cross-platform * solution. */ #define INIT_MAGIC 0xff8adc98 /* * POSIX Threads -- The best way to go if your platform supports them. * Solaris >= 2.5 have POSIX threads, IRIX >= 6.4 reportedly * has them, and many of the free Unixes now have them. * Be sure to use appropriate -mt or -D_REENTRANT type * compile flags when building. */ #ifdef PTHREADS unsigned long _glthread_GetID(void) { return (unsigned long) pthread_self(); } void _glthread_InitTSD(_glthread_TSD *tsd) { if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) { perror(INIT_TSD_ERROR); exit(-1); } tsd->initMagic = INIT_MAGIC; } void * _glthread_GetTSD(_glthread_TSD *tsd) { if (tsd->initMagic != (int) INIT_MAGIC) { _glthread_InitTSD(tsd); } return pthread_getspecific(tsd->key); } void _glthread_SetTSD(_glthread_TSD *tsd, void *ptr) { if (tsd->initMagic != (int) INIT_MAGIC) { _glthread_InitTSD(tsd); } if (pthread_setspecific(tsd->key, ptr) != 0) { perror(SET_TSD_ERROR); exit(-1); } } #endif /* PTHREADS */ /* * Solaris/Unix International Threads -- Use only if POSIX threads * aren't available on your Unix platform. Solaris 2.[34] are examples * of platforms where this is the case. Be sure to use -mt and/or * -D_REENTRANT when compiling. */ #ifdef SOLARIS_THREADS #define USE_LOCK_FOR_KEY /* undef this to try a version without lock for the global key... */ unsigned long _glthread_GetID(void) { abort(); /* XXX not implemented yet */ return (unsigned long) 0; } void _glthread_InitTSD(_glthread_TSD *tsd) { if ((errno = mutex_init(&tsd->keylock, 0, NULL)) != 0 || (errno = thr_keycreate(&(tsd->key), free)) != 0) { perror(INIT_TSD_ERROR); exit(-1); } tsd->initMagic = INIT_MAGIC; } void * _glthread_GetTSD(_glthread_TSD *tsd) { void* ret; if (tsd->initMagic != INIT_MAGIC) { _glthread_InitTSD(tsd); } #ifdef USE_LOCK_FOR_KEY mutex_lock(&tsd->keylock); thr_getspecific(tsd->key, &ret); mutex_unlock(&tsd->keylock); #else if ((errno = thr_getspecific(tsd->key, &ret)) != 0) { perror(GET_TSD_ERROR); exit(-1); } #endif return ret; } void _glthread_SetTSD(_glthread_TSD *tsd, void *ptr) { if (tsd->initMagic != INIT_MAGIC) { _glthread_InitTSD(tsd); } if ((errno = thr_setspecific(tsd->key, ptr)) != 0) { perror(SET_TSD_ERROR); exit(-1); } } #undef USE_LOCK_FOR_KEY #endif /* SOLARIS_THREADS */ /* * Win32 Threads. The only available option for Windows 95/NT. * Be sure that you compile using the Multithreaded runtime, otherwise * bad things will happen. */ #ifdef WIN32_THREADS unsigned long _glthread_GetID(void) { abort(); /* XXX not implemented yet */ return (unsigned long) 0; } void _glthread_InitTSD(_glthread_TSD *tsd) { tsd->key = TlsAlloc(); if (tsd->key == 0xffffffff) { /* Can Windows handle stderr messages for non-console applications? Does Windows have perror? */ /* perror(SET_INIT_ERROR);*/ exit(-1); } tsd->initMagic = INIT_MAGIC; } void * _glthread_GetTSD(_glthread_TSD *tsd) { if (tsd->initMagic != INIT_MAGIC) { _glthread_InitTSD(tsd); } return TlsGetValue(tsd->key); } void _glthread_SetTSD(_glthread_TSD *tsd, void *ptr) { /* the following code assumes that the _glthread_TSD has been initialized to zero at creation */ if (tsd->initMagic != INIT_MAGIC) { _glthread_InitTSD(tsd); } if (TlsSetValue(tsd->key, ptr) == 0) { /* Can Windows handle stderr messages for non-console applications? Does Windows have perror? */ /* perror(SET_TSD_ERROR);*/ exit(-1); } } #endif /* WIN32_THREADS */ /* * XFree86 has its own thread wrapper, Xthreads.h * We wrap it again for GL. */ #ifdef USE_XTHREADS unsigned long _glthread_GetID(void) { return (unsigned long) xthread_self(); } void _glthread_InitTSD(_glthread_TSD *tsd) { if (xthread_key_create(&tsd->key, NULL) != 0) { perror(INIT_TSD_ERROR); exit(-1); } tsd->initMagic = INIT_MAGIC; } void * _glthread_GetTSD(_glthread_TSD *tsd) { void *ptr; if (tsd->initMagic != INIT_MAGIC) { _glthread_InitTSD(tsd); } xthread_get_specific(tsd->key, &ptr); return ptr; } void _glthread_SetTSD(_glthread_TSD *tsd, void *ptr) { if (tsd->initMagic != INIT_MAGIC) { _glthread_InitTSD(tsd); } xthread_set_specific(tsd->key, ptr); } #endif /* XTHREAD */ /* * BeOS threads */ #ifdef BEOS_THREADS unsigned long _glthread_GetID(void) { return (unsigned long) find_thread(NULL); } void _glthread_InitTSD(_glthread_TSD *tsd) { tsd->key = tls_allocate(); tsd->initMagic = INIT_MAGIC; } void * _glthread_GetTSD(_glthread_TSD *tsd) { if (tsd->initMagic != (int) INIT_MAGIC) { _glthread_InitTSD(tsd); } return tls_get(tsd->key); } void _glthread_SetTSD(_glthread_TSD *tsd, void *ptr) { if (tsd->initMagic != (int) INIT_MAGIC) { _glthread_InitTSD(tsd); } tls_set(tsd->key, ptr); } #endif /* BEOS_THREADS */ #else /* THREADS */ /* * no-op functions */ unsigned long _glthread_GetID(void) { return 0; } void _glthread_InitTSD(_glthread_TSD *tsd) { (void) tsd; } void * _glthread_GetTSD(_glthread_TSD *tsd) { (void) tsd; return NULL; } void _glthread_SetTSD(_glthread_TSD *tsd, void *ptr) { (void) tsd; (void) ptr; } #endif /* THREADS */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/glapi/glthread.h0000644000000000000000000001770013614532424020261 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Thread support for gl dispatch. * * Initial version by John Stone (j.stone@acm.org) (johns@cs.umr.edu) * and Christoph Poliwoda (poliwoda@volumegraphics.com) * Revised by Keith Whitwell * Adapted for new gl dispatcher by Brian Paul * * * * DOCUMENTATION * * This thread module exports the following types: * _glthread_TSD Thread-specific data area * _glthread_Thread Thread datatype * _glthread_Mutex Mutual exclusion lock * * Macros: * _glthread_DECLARE_STATIC_MUTEX(name) Declare a non-local mutex * _glthread_INIT_MUTEX(name) Initialize a mutex * _glthread_LOCK_MUTEX(name) Lock a mutex * _glthread_UNLOCK_MUTEX(name) Unlock a mutex * * Functions: * _glthread_GetID(v) Get integer thread ID * _glthread_InitTSD() Initialize thread-specific data * _glthread_GetTSD() Get thread-specific data * _glthread_SetTSD() Set thread-specific data * */ /* * If this file is accidentally included by a non-threaded build, * it should not cause the build to fail, or otherwise cause problems. * In general, it should only be included when needed however. */ #ifndef GLTHREAD_H #define GLTHREAD_H #if (defined(PTHREADS) || defined(SOLARIS_THREADS) ||\ defined(WIN32_THREADS) || defined(USE_XTHREADS) || defined(BEOS_THREADS)) \ && !defined(THREADS) # define THREADS #endif #ifdef VMS #include #endif /* * POSIX threads. This should be your choice in the Unix world * whenever possible. When building with POSIX threads, be sure * to enable any compiler flags which will cause the MT-safe * libc (if one exists) to be used when linking, as well as any * header macros for MT-safe errno, etc. For Solaris, this is the -mt * compiler flag. On Solaris with gcc, use -D_REENTRANT to enable * proper compiling for MT-safe libc etc. */ #if defined(PTHREADS) #include /* POSIX threads headers */ typedef struct { pthread_key_t key; int initMagic; } _glthread_TSD; typedef pthread_t _glthread_Thread; typedef pthread_mutex_t _glthread_Mutex; #define _glthread_DECLARE_STATIC_MUTEX(name) \ static _glthread_Mutex name = PTHREAD_MUTEX_INITIALIZER #define _glthread_INIT_MUTEX(name) \ pthread_mutex_init(&(name), NULL) #define _glthread_DESTROY_MUTEX(name) \ pthread_mutex_destroy(&(name)) #define _glthread_LOCK_MUTEX(name) \ (void) pthread_mutex_lock(&(name)) #define _glthread_UNLOCK_MUTEX(name) \ (void) pthread_mutex_unlock(&(name)) #endif /* PTHREADS */ /* * Solaris threads. Use only up to Solaris 2.4. * Solaris 2.5 and higher provide POSIX threads. * Be sure to compile with -mt on the Solaris compilers, or * use -D_REENTRANT if using gcc. */ #ifdef SOLARIS_THREADS #include typedef struct { thread_key_t key; mutex_t keylock; int initMagic; } _glthread_TSD; typedef thread_t _glthread_Thread; typedef mutex_t _glthread_Mutex; /* XXX need to really implement mutex-related macros */ #define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0 #define _glthread_INIT_MUTEX(name) (void) name #define _glthread_DESTROY_MUTEX(name) (void) name #define _glthread_LOCK_MUTEX(name) (void) name #define _glthread_UNLOCK_MUTEX(name) (void) name #endif /* SOLARIS_THREADS */ /* * Windows threads. Should work with Windows NT and 95. * IMPORTANT: Link with multithreaded runtime library when THREADS are * used! */ #ifdef WIN32_THREADS #include typedef struct { DWORD key; int initMagic; } _glthread_TSD; typedef HANDLE _glthread_Thread; typedef CRITICAL_SECTION _glthread_Mutex; /* XXX need to really implement mutex-related macros */ #define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0 #define _glthread_INIT_MUTEX(name) (void) name #define _glthread_DESTROY_MUTEX(name) (void) name #define _glthread_LOCK_MUTEX(name) (void) name #define _glthread_UNLOCK_MUTEX(name) (void) name #endif /* WIN32_THREADS */ /* * XFree86 has its own thread wrapper, Xthreads.h * We wrap it again for GL. */ #ifdef USE_XTHREADS #include typedef struct { xthread_key_t key; int initMagic; } _glthread_TSD; typedef xthread_t _glthread_Thread; typedef xmutex_rec _glthread_Mutex; #ifdef XMUTEX_INITIALIZER #define _glthread_DECLARE_STATIC_MUTEX(name) \ static _glthread_Mutex name = XMUTEX_INITIALIZER #else #define _glthread_DECLARE_STATIC_MUTEX(name) \ static _glthread_Mutex name #endif #define _glthread_INIT_MUTEX(name) \ xmutex_init(&(name)) #define _glthread_DESTROY_MUTEX(name) \ xmutex_clear(&(name)) #define _glthread_LOCK_MUTEX(name) \ (void) xmutex_lock(&(name)) #define _glthread_UNLOCK_MUTEX(name) \ (void) xmutex_unlock(&(name)) #endif /* USE_XTHREADS */ /* * BeOS threads. R5.x required. */ #ifdef BEOS_THREADS #include #include typedef struct { int32 key; int initMagic; } _glthread_TSD; typedef thread_id _glthread_Thread; /* Use Benaphore, aka speeder semaphore */ typedef struct { int32 lock; sem_id sem; } benaphore; typedef benaphore _glthread_Mutex; #define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = { 0, 0 } #define _glthread_INIT_MUTEX(name) name.sem = create_sem(0, #name"_benaphore"), name.lock = 0 #define _glthread_DESTROY_MUTEX(name) delete_sem(name.sem), name.lock = 0 #define _glthread_LOCK_MUTEX(name) if (name.sem == 0) _glthread_INIT_MUTEX(name); \ if (atomic_add(&(name.lock), 1) >= 1) acquire_sem(name.sem) #define _glthread_UNLOCK_MUTEX(name) if (atomic_add(&(name.lock), -1) > 1) release_sem(name.sem) #endif /* BEOS_THREADS */ #ifndef THREADS /* * THREADS not defined */ typedef GLuint _glthread_TSD; typedef GLuint _glthread_Thread; typedef GLuint _glthread_Mutex; #define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0 #define _glthread_INIT_MUTEX(name) (void) name #define _glthread_DESTROY_MUTEX(name) (void) name #define _glthread_LOCK_MUTEX(name) (void) name #define _glthread_UNLOCK_MUTEX(name) (void) name #endif /* THREADS */ /* * Platform independent thread specific data API. */ extern unsigned long _glthread_GetID(void); extern void _glthread_InitTSD(_glthread_TSD *); extern void * _glthread_GetTSD(_glthread_TSD *); extern void _glthread_SetTSD(_glthread_TSD *, void *); #if defined(GLX_USE_TLS) extern __thread struct _glapi_table * _glapi_tls_Dispatch __attribute__((tls_model("initial-exec"))); #define GET_DISPATCH() _glapi_tls_Dispatch #elif !defined(GL_CALL) # if defined(THREADS) # define GET_DISPATCH() \ ((__builtin_expect( _glapi_Dispatch != NULL, 1 )) \ ? _glapi_Dispatch : _glapi_get_dispatch()) # else # define GET_DISPATCH() _glapi_Dispatch # endif /* defined(THREADS) */ #endif /* ndef GL_CALL */ #endif /* THREADS_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/accum.c0000644000000000000000000000630113614532424017375 0ustar /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "accum.h" #include "context.h" #include "imports.h" #include "macros.h" #include "state.h" #include "mtypes.h" void GLAPIENTRY _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { GLfloat tmp[4]; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); tmp[0] = CLAMP( red, -1.0F, 1.0F ); tmp[1] = CLAMP( green, -1.0F, 1.0F ); tmp[2] = CLAMP( blue, -1.0F, 1.0F ); tmp[3] = CLAMP( alpha, -1.0F, 1.0F ); if (TEST_EQ_4V(tmp, ctx->Accum.ClearColor)) return; FLUSH_VERTICES(ctx, _NEW_ACCUM); COPY_4FV( ctx->Accum.ClearColor, tmp ); } void GLAPIENTRY _mesa_Accum( GLenum op, GLfloat value ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (op) { case GL_ADD: case GL_MULT: case GL_ACCUM: case GL_LOAD: case GL_RETURN: /* OK */ break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glAccum(op)"); return; } if (ctx->DrawBuffer->Visual.haveAccumBuffer == 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glAccum(no accum buffer)"); return; } if (ctx->DrawBuffer != ctx->ReadBuffer) { /* See GLX_SGI_make_current_read or WGL_ARB_make_current_read */ _mesa_error(ctx, GL_INVALID_OPERATION, "glAccum(different read/draw buffers)"); return; } if (ctx->NewState) _mesa_update_state(ctx); if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "glAccum(incomplete framebuffer)"); return; } if (ctx->RenderMode == GL_RENDER) { GLint x = ctx->DrawBuffer->_Xmin; GLint y = ctx->DrawBuffer->_Ymin; GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; ctx->Driver.Accum(ctx, op, value, x, y, width, height); } } void _mesa_init_accum( GLcontext *ctx ) { /* Accumulate buffer group */ ASSIGN_4V( ctx->Accum.ClearColor, 0.0, 0.0, 0.0, 0.0 ); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/accum.h0000644000000000000000000000315213614532424017403 0ustar /** * \file accum.h * Accumulation buffer operations. * * \if subset * (No-op) * * \endif */ /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ACCUM_H #define ACCUM_H #include "mtypes.h" #if _HAVE_FULL_GL extern void GLAPIENTRY _mesa_Accum( GLenum op, GLfloat value ); extern void GLAPIENTRY _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); extern void _mesa_init_accum( GLcontext *ctx ); #else /** No-op */ #define _mesa_init_accum( c ) ((void)0) #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/api_arrayelt.c0000644000000000000000000005447213614532424020775 0ustar /* * Mesa 3-D graphics library * Version: 6.4.1 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Author: * Keith Whitwell */ #include "glheader.h" #include "api_arrayelt.h" #include "context.h" #include "glapi.h" #include "imports.h" #include "macros.h" #include "mtypes.h" #include "glapioffsets.h" #include "dispatch.h" typedef void (GLAPIENTRY *array_func)( const void * ); typedef struct { const struct gl_client_array *array; int offset; } AEarray; typedef void (GLAPIENTRY *attrib_func)( GLuint indx, const void *data ); typedef struct { const struct gl_client_array *array; attrib_func func; GLuint index; } AEattrib; typedef struct { AEarray arrays[32]; AEattrib attribs[VERT_ATTRIB_MAX + 1]; GLuint NewState; } AEcontext; #define AE_CONTEXT(ctx) ((AEcontext *)(ctx)->aelt_context) /* * Convert GL_BYTE, GL_UNSIGNED_BYTE, .. GL_DOUBLE into an integer * in the range [0, 7]. Luckily these type tokens are sequentially * numbered in gl.h, except for GL_DOUBLE. */ #define TYPE_IDX(t) ( (t) == GL_DOUBLE ? 7 : (t) & 7 ) static const int ColorFuncs[2][8] = { { _gloffset_Color3bv, _gloffset_Color3ubv, _gloffset_Color3sv, _gloffset_Color3usv, _gloffset_Color3iv, _gloffset_Color3uiv, _gloffset_Color3fv, _gloffset_Color3dv, }, { _gloffset_Color4bv, _gloffset_Color4ubv, _gloffset_Color4sv, _gloffset_Color4usv, _gloffset_Color4iv, _gloffset_Color4uiv, _gloffset_Color4fv, _gloffset_Color4dv, }, }; static const int VertexFuncs[3][8] = { { -1, -1, _gloffset_Vertex2sv, -1, _gloffset_Vertex2iv, -1, _gloffset_Vertex2fv, _gloffset_Vertex2dv, }, { -1, -1, _gloffset_Vertex3sv, -1, _gloffset_Vertex3iv, -1, _gloffset_Vertex3fv, _gloffset_Vertex3dv, }, { -1, -1, _gloffset_Vertex4sv, -1, _gloffset_Vertex4iv, -1, _gloffset_Vertex4fv, _gloffset_Vertex4dv, }, }; static const int IndexFuncs[8] = { -1, _gloffset_Indexubv, _gloffset_Indexsv, -1, _gloffset_Indexiv, -1, _gloffset_Indexfv, _gloffset_Indexdv, }; static const int NormalFuncs[8] = { _gloffset_Normal3bv, -1, _gloffset_Normal3sv, -1, _gloffset_Normal3iv, -1, _gloffset_Normal3fv, _gloffset_Normal3dv, }; #if defined(IN_DRI_DRIVER) static int SecondaryColorFuncs[8]; static int FogCoordFuncs[8] = { -1, -1, -1, -1, -1, -1, 0, 0, }; #else static const int SecondaryColorFuncs[8] = { _gloffset_SecondaryColor3bvEXT, _gloffset_SecondaryColor3ubvEXT, _gloffset_SecondaryColor3svEXT, _gloffset_SecondaryColor3usvEXT, _gloffset_SecondaryColor3ivEXT, _gloffset_SecondaryColor3uivEXT, _gloffset_SecondaryColor3fvEXT, _gloffset_SecondaryColor3dvEXT, }; static const int FogCoordFuncs[8] = { -1, -1, -1, -1, -1, -1, _gloffset_FogCoordfvEXT, _gloffset_FogCoorddvEXT }; #endif /**********************************************************************/ /* GL_BYTE attributes */ static void GLAPIENTRY VertexAttrib1NbvNV(GLuint index, const GLbyte *v) { CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]))); } static void GLAPIENTRY VertexAttrib1bvNV(GLuint index, const GLbyte *v) { CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); } static void GLAPIENTRY VertexAttrib2NbvNV(GLuint index, const GLbyte *v) { CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]))); } static void GLAPIENTRY VertexAttrib2bvNV(GLuint index, const GLbyte *v) { CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); } static void GLAPIENTRY VertexAttrib3NbvNV(GLuint index, const GLbyte *v) { CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]))); } static void GLAPIENTRY VertexAttrib3bvNV(GLuint index, const GLbyte *v) { CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); } static void GLAPIENTRY VertexAttrib4NbvNV(GLuint index, const GLbyte *v) { CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]))); } static void GLAPIENTRY VertexAttrib4bvNV(GLuint index, const GLbyte *v) { CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); } /* GL_UNSIGNED_BYTE attributes */ static void GLAPIENTRY VertexAttrib1NubvNV(GLuint index, const GLubyte *v) { CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]))); } static void GLAPIENTRY VertexAttrib1ubvNV(GLuint index, const GLubyte *v) { CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); } static void GLAPIENTRY VertexAttrib2NubvNV(GLuint index, const GLubyte *v) { CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]))); } static void GLAPIENTRY VertexAttrib2ubvNV(GLuint index, const GLubyte *v) { CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); } static void GLAPIENTRY VertexAttrib3NubvNV(GLuint index, const GLubyte *v) { CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), UBYTE_TO_FLOAT(v[2]))); } static void GLAPIENTRY VertexAttrib3ubvNV(GLuint index, const GLubyte *v) { CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); } static void GLAPIENTRY VertexAttrib4NubvNV(GLuint index, const GLubyte *v) { CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]))); } static void GLAPIENTRY VertexAttrib4ubvNV(GLuint index, const GLubyte *v) { CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); } /* GL_SHORT attributes */ static void GLAPIENTRY VertexAttrib1NsvNV(GLuint index, const GLshort *v) { CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]))); } static void GLAPIENTRY VertexAttrib1svNV(GLuint index, const GLshort *v) { CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); } static void GLAPIENTRY VertexAttrib2NsvNV(GLuint index, const GLshort *v) { CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]))); } static void GLAPIENTRY VertexAttrib2svNV(GLuint index, const GLshort *v) { CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); } static void GLAPIENTRY VertexAttrib3NsvNV(GLuint index, const GLshort *v) { CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]))); } static void GLAPIENTRY VertexAttrib3svNV(GLuint index, const GLshort *v) { CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); } static void GLAPIENTRY VertexAttrib4NsvNV(GLuint index, const GLshort *v) { CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3]))); } static void GLAPIENTRY VertexAttrib4svNV(GLuint index, const GLshort *v) { CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); } /* GL_UNSIGNED_SHORT attributes */ static void GLAPIENTRY VertexAttrib1NusvNV(GLuint index, const GLushort *v) { CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]))); } static void GLAPIENTRY VertexAttrib1usvNV(GLuint index, const GLushort *v) { CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); } static void GLAPIENTRY VertexAttrib2NusvNV(GLuint index, const GLushort *v) { CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]))); } static void GLAPIENTRY VertexAttrib2usvNV(GLuint index, const GLushort *v) { CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); } static void GLAPIENTRY VertexAttrib3NusvNV(GLuint index, const GLushort *v) { CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), USHORT_TO_FLOAT(v[2]))); } static void GLAPIENTRY VertexAttrib3usvNV(GLuint index, const GLushort *v) { CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); } static void GLAPIENTRY VertexAttrib4NusvNV(GLuint index, const GLushort *v) { CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]))); } static void GLAPIENTRY VertexAttrib4usvNV(GLuint index, const GLushort *v) { CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); } /* GL_INT attributes */ static void GLAPIENTRY VertexAttrib1NivNV(GLuint index, const GLint *v) { CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]))); } static void GLAPIENTRY VertexAttrib1ivNV(GLuint index, const GLint *v) { CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); } static void GLAPIENTRY VertexAttrib2NivNV(GLuint index, const GLint *v) { CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]))); } static void GLAPIENTRY VertexAttrib2ivNV(GLuint index, const GLint *v) { CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); } static void GLAPIENTRY VertexAttrib3NivNV(GLuint index, const GLint *v) { CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]))); } static void GLAPIENTRY VertexAttrib3ivNV(GLuint index, const GLint *v) { CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); } static void GLAPIENTRY VertexAttrib4NivNV(GLuint index, const GLint *v) { CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]))); } static void GLAPIENTRY VertexAttrib4ivNV(GLuint index, const GLint *v) { CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); } /* GL_UNSIGNED_INT attributes */ static void GLAPIENTRY VertexAttrib1NuivNV(GLuint index, const GLuint *v) { CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]))); } static void GLAPIENTRY VertexAttrib1uivNV(GLuint index, const GLuint *v) { CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); } static void GLAPIENTRY VertexAttrib2NuivNV(GLuint index, const GLuint *v) { CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]))); } static void GLAPIENTRY VertexAttrib2uivNV(GLuint index, const GLuint *v) { CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); } static void GLAPIENTRY VertexAttrib3NuivNV(GLuint index, const GLuint *v) { CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), UINT_TO_FLOAT(v[2]))); } static void GLAPIENTRY VertexAttrib3uivNV(GLuint index, const GLuint *v) { CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); } static void GLAPIENTRY VertexAttrib4NuivNV(GLuint index, const GLuint *v) { CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]))); } static void GLAPIENTRY VertexAttrib4uivNV(GLuint index, const GLuint *v) { CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); } /* GL_FLOAT attributes */ static void GLAPIENTRY VertexAttrib1fvNV(GLuint index, const GLfloat *v) { CALL_VertexAttrib1fvNV(GET_DISPATCH(), (index, v)); } static void GLAPIENTRY VertexAttrib2fvNV(GLuint index, const GLfloat *v) { CALL_VertexAttrib2fvNV(GET_DISPATCH(), (index, v)); } static void GLAPIENTRY VertexAttrib3fvNV(GLuint index, const GLfloat *v) { CALL_VertexAttrib3fvNV(GET_DISPATCH(), (index, v)); } static void GLAPIENTRY VertexAttrib4fvNV(GLuint index, const GLfloat *v) { CALL_VertexAttrib4fvNV(GET_DISPATCH(), (index, v)); } /* GL_DOUBLE attributes */ static void GLAPIENTRY VertexAttrib1dvNV(GLuint index, const GLdouble *v) { CALL_VertexAttrib1dvNV(GET_DISPATCH(), (index, v)); } static void GLAPIENTRY VertexAttrib2dvNV(GLuint index, const GLdouble *v) { CALL_VertexAttrib2dvNV(GET_DISPATCH(), (index, v)); } static void GLAPIENTRY VertexAttrib3dvNV(GLuint index, const GLdouble *v) { CALL_VertexAttrib3dvNV(GET_DISPATCH(), (index, v)); } static void GLAPIENTRY VertexAttrib4dvNV(GLuint index, const GLdouble *v) { CALL_VertexAttrib4dvNV(GET_DISPATCH(), (index, v)); } /* * Array [size][type] of VertexAttrib functions */ static attrib_func AttribFuncsNV[2][4][8] = { { /* non-normalized */ { /* size 1 */ (attrib_func) VertexAttrib1bvNV, (attrib_func) VertexAttrib1ubvNV, (attrib_func) VertexAttrib1svNV, (attrib_func) VertexAttrib1usvNV, (attrib_func) VertexAttrib1ivNV, (attrib_func) VertexAttrib1uivNV, (attrib_func) VertexAttrib1fvNV, (attrib_func) VertexAttrib1dvNV }, { /* size 2 */ (attrib_func) VertexAttrib2bvNV, (attrib_func) VertexAttrib2ubvNV, (attrib_func) VertexAttrib2svNV, (attrib_func) VertexAttrib2usvNV, (attrib_func) VertexAttrib2ivNV, (attrib_func) VertexAttrib2uivNV, (attrib_func) VertexAttrib2fvNV, (attrib_func) VertexAttrib2dvNV }, { /* size 3 */ (attrib_func) VertexAttrib3bvNV, (attrib_func) VertexAttrib3ubvNV, (attrib_func) VertexAttrib3svNV, (attrib_func) VertexAttrib3usvNV, (attrib_func) VertexAttrib3ivNV, (attrib_func) VertexAttrib3uivNV, (attrib_func) VertexAttrib3fvNV, (attrib_func) VertexAttrib3dvNV }, { /* size 4 */ (attrib_func) VertexAttrib4bvNV, (attrib_func) VertexAttrib4ubvNV, (attrib_func) VertexAttrib4svNV, (attrib_func) VertexAttrib4usvNV, (attrib_func) VertexAttrib4ivNV, (attrib_func) VertexAttrib4uivNV, (attrib_func) VertexAttrib4fvNV, (attrib_func) VertexAttrib4dvNV } }, { /* normalized (except for float/double) */ { /* size 1 */ (attrib_func) VertexAttrib1NbvNV, (attrib_func) VertexAttrib1NubvNV, (attrib_func) VertexAttrib1NsvNV, (attrib_func) VertexAttrib1NusvNV, (attrib_func) VertexAttrib1NivNV, (attrib_func) VertexAttrib1NuivNV, (attrib_func) VertexAttrib1fvNV, (attrib_func) VertexAttrib1dvNV }, { /* size 2 */ (attrib_func) VertexAttrib2NbvNV, (attrib_func) VertexAttrib2NubvNV, (attrib_func) VertexAttrib2NsvNV, (attrib_func) VertexAttrib2NusvNV, (attrib_func) VertexAttrib2NivNV, (attrib_func) VertexAttrib2NuivNV, (attrib_func) VertexAttrib2fvNV, (attrib_func) VertexAttrib2dvNV }, { /* size 3 */ (attrib_func) VertexAttrib3NbvNV, (attrib_func) VertexAttrib3NubvNV, (attrib_func) VertexAttrib3NsvNV, (attrib_func) VertexAttrib3NusvNV, (attrib_func) VertexAttrib3NivNV, (attrib_func) VertexAttrib3NuivNV, (attrib_func) VertexAttrib3fvNV, (attrib_func) VertexAttrib3dvNV }, { /* size 4 */ (attrib_func) VertexAttrib4NbvNV, (attrib_func) VertexAttrib4NubvNV, (attrib_func) VertexAttrib4NsvNV, (attrib_func) VertexAttrib4NusvNV, (attrib_func) VertexAttrib4NivNV, (attrib_func) VertexAttrib4NuivNV, (attrib_func) VertexAttrib4fvNV, (attrib_func) VertexAttrib4dvNV } } }; /**********************************************************************/ GLboolean _ae_create_context( GLcontext *ctx ) { if (ctx->aelt_context) return GL_TRUE; #if defined(IN_DRI_DRIVER) SecondaryColorFuncs[0] = _gloffset_SecondaryColor3bvEXT; SecondaryColorFuncs[1] = _gloffset_SecondaryColor3ubvEXT; SecondaryColorFuncs[2] = _gloffset_SecondaryColor3svEXT; SecondaryColorFuncs[3] = _gloffset_SecondaryColor3usvEXT; SecondaryColorFuncs[4] = _gloffset_SecondaryColor3ivEXT; SecondaryColorFuncs[5] = _gloffset_SecondaryColor3uivEXT; SecondaryColorFuncs[6] = _gloffset_SecondaryColor3fvEXT; SecondaryColorFuncs[7] = _gloffset_SecondaryColor3dvEXT; FogCoordFuncs[6] = _gloffset_FogCoordfvEXT; FogCoordFuncs[7] = _gloffset_FogCoorddvEXT; #endif ctx->aelt_context = MALLOC( sizeof(AEcontext) ); if (!ctx->aelt_context) return GL_FALSE; AE_CONTEXT(ctx)->NewState = ~0; return GL_TRUE; } void _ae_destroy_context( GLcontext *ctx ) { if ( AE_CONTEXT( ctx ) ) { FREE( ctx->aelt_context ); ctx->aelt_context = NULL; } } /** * Make a list of per-vertex functions to call for each glArrayElement call. * These functions access the array data (i.e. glVertex, glColor, glNormal, * etc). * Note: this may be called during display list construction. */ static void _ae_update_state( GLcontext *ctx ) { AEcontext *actx = AE_CONTEXT(ctx); AEarray *aa = actx->arrays; AEattrib *at = actx->attribs; GLuint i; /* conventional vertex arrays */ if (ctx->Array.Index.Enabled) { aa->array = &ctx->Array.Index; aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)]; aa++; } if (ctx->Array.EdgeFlag.Enabled) { aa->array = &ctx->Array.EdgeFlag; aa->offset = _gloffset_EdgeFlagv; aa++; } if (ctx->Array.Normal.Enabled) { aa->array = &ctx->Array.Normal; aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)]; aa++; } if (ctx->Array.Color.Enabled) { aa->array = &ctx->Array.Color; aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)]; aa++; } if (ctx->Array.SecondaryColor.Enabled) { aa->array = &ctx->Array.SecondaryColor; aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)]; aa++; } if (ctx->Array.FogCoord.Enabled) { aa->array = &ctx->Array.FogCoord; aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)]; aa++; } for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { if (ctx->Array.TexCoord[i].Enabled) { /* NOTE: we use generic glVertexAttrib functions here. * If we ever de-alias conventional/generic vertex attribs this * will have to change. */ struct gl_client_array *attribArray = &ctx->Array.TexCoord[i]; at->array = attribArray; at->func = AttribFuncsNV[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)]; at->index = VERT_ATTRIB_TEX0 + i; at++; } } /* generic vertex attribute arrays */ for (i = 1; i < VERT_ATTRIB_MAX; i++) { /* skip zero! */ if (ctx->Array.VertexAttrib[i].Enabled) { struct gl_client_array *attribArray = &ctx->Array.VertexAttrib[i]; at->array = attribArray; /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV * function pointer here (for float arrays) since the pointer may * change from one execution of _ae_loopback_array_elt() to * the next. Doing so caused UT to break. */ at->func = AttribFuncsNV[at->array->Normalized][at->array->Size-1][TYPE_IDX(at->array->Type)]; at->index = i; at++; } } /* finally, vertex position */ if (ctx->Array.VertexAttrib[0].Enabled) { /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's * issued as the last (proviking) attribute). */ aa->array = &ctx->Array.VertexAttrib[0]; assert(aa->array->Size >= 2); /* XXX fix someday? */ aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; aa++; } else if (ctx->Array.Vertex.Enabled) { aa->array = &ctx->Array.Vertex; aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; aa++; } ASSERT(at - actx->attribs <= VERT_ATTRIB_MAX); ASSERT(aa - actx->arrays < 32); at->func = NULL; /* terminate the list */ aa->offset = -1; /* terminate the list */ actx->NewState = 0; } /** * Called via glArrayElement() and glDrawArrays(). * Issue the glNormal, glVertex, glColor, glVertexAttrib, etc functions * for all enabled vertex arrays (for elt-th element). * Note: this may be called during display list construction. */ void GLAPIENTRY _ae_loopback_array_elt( GLint elt ) { GET_CURRENT_CONTEXT(ctx); const AEcontext *actx = AE_CONTEXT(ctx); const AEarray *aa; const AEattrib *at; const struct _glapi_table * const disp = GET_DISPATCH(); if (actx->NewState) _ae_update_state( ctx ); /* generic attributes */ for (at = actx->attribs; at->func; at++) { const GLubyte *src = ADD_POINTERS(at->array->BufferObj->Data, at->array->Ptr) + elt * at->array->StrideB; at->func( at->index, src ); } /* conventional arrays */ for (aa = actx->arrays; aa->offset != -1 ; aa++) { const GLubyte *src = ADD_POINTERS(aa->array->BufferObj->Data, aa->array->Ptr) + elt * aa->array->StrideB; CALL_by_offset( disp, (array_func), aa->offset, ((const void *) src) ); } } void _ae_invalidate_state( GLcontext *ctx, GLuint new_state ) { AE_CONTEXT(ctx)->NewState |= new_state; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/api_arrayelt.h0000644000000000000000000000271413614532424020772 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef API_ARRAYELT_H #define API_ARRAYELT_H #include "mtypes.h" extern GLboolean _ae_create_context( GLcontext *ctx ); extern void _ae_destroy_context( GLcontext *ctx ); extern void _ae_invalidate_state( GLcontext *ctx, GLuint new_state ); extern void GLAPIENTRY _ae_loopback_array_elt( GLint elt ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/api_eval.h0000644000000000000000000000300113614532424020064 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef API_EVAL_H #define API_EVAL_H #include "mtypes.h" extern void _mesa_EvalPoint1( GLint i ); extern void _mesa_EvalPoint2( GLint i, GLint j ); extern void _mesa_EvalCoord1f( GLfloat u ); extern void _mesa_EvalCoord2f( GLfloat u, GLfloat v ); extern void _mesa_EvalCoord1fv( const GLfloat *u ); extern void _mesa_EvalCoord2fv( const GLfloat *u ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/api_loopback.c0000644000000000000000000013373213614532424020741 0ustar /** * \file api_loopback.c * * \author Keith Whitwell */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "glapi.h" #include "glapitable.h" #include "macros.h" #include "colormac.h" #include "api_loopback.h" #include "glthread.h" #include "mtypes.h" #include "dispatch.h" /* KW: A set of functions to convert unusual Color/Normal/Vertex/etc * calls to a smaller set of driver-provided formats. Currently just * go back to dispatch to find these (eg. call glNormal3f directly), * hence 'loopback'. * * The driver must supply all of the remaining entry points, which are * listed in dd.h. The easiest way for a driver to do this is to * install the supplied software t&l module. */ #define COLORF(r,g,b,a) CALL_Color4f(GET_DISPATCH(), (r,g,b,a)) #define VERTEX2(x,y) CALL_Vertex2f(GET_DISPATCH(), (x,y)) #define VERTEX3(x,y,z) CALL_Vertex3f(GET_DISPATCH(), (x,y,z)) #define VERTEX4(x,y,z,w) CALL_Vertex4f(GET_DISPATCH(), (x,y,z,w)) #define NORMAL(x,y,z) CALL_Normal3f(GET_DISPATCH(), (x,y,z)) #define TEXCOORD1(s) CALL_TexCoord1f(GET_DISPATCH(), (s)) #define TEXCOORD2(s,t) CALL_TexCoord2f(GET_DISPATCH(), (s,t)) #define TEXCOORD3(s,t,u) CALL_TexCoord3f(GET_DISPATCH(), (s,t,u)) #define TEXCOORD4(s,t,u,v) CALL_TexCoord4f(GET_DISPATCH(), (s,t,u,v)) #define INDEX(c) CALL_Indexf(GET_DISPATCH(), (c)) #define MULTI_TEXCOORD1(z,s) CALL_MultiTexCoord1fARB(GET_DISPATCH(), (z,s)) #define MULTI_TEXCOORD2(z,s,t) CALL_MultiTexCoord2fARB(GET_DISPATCH(), (z,s,t)) #define MULTI_TEXCOORD3(z,s,t,u) CALL_MultiTexCoord3fARB(GET_DISPATCH(), (z,s,t,u)) #define MULTI_TEXCOORD4(z,s,t,u,v) CALL_MultiTexCoord4fARB(GET_DISPATCH(), (z,s,t,u,v)) #define EVALCOORD1(x) CALL_EvalCoord1f(GET_DISPATCH(), (x)) #define EVALCOORD2(x,y) CALL_EvalCoord2f(GET_DISPATCH(), (x,y)) #define MATERIALFV(a,b,c) CALL_Materialfv(GET_DISPATCH(), (a,b,c)) #define RECTF(a,b,c,d) CALL_Rectf(GET_DISPATCH(), (a,b,c,d)) #define ATTRIB1NV(index,x) CALL_VertexAttrib1fNV(GET_DISPATCH(), (index,x)) #define ATTRIB2NV(index,x,y) CALL_VertexAttrib2fNV(GET_DISPATCH(), (index,x,y)) #define ATTRIB3NV(index,x,y,z) CALL_VertexAttrib3fNV(GET_DISPATCH(), (index,x,y,z)) #define ATTRIB4NV(index,x,y,z,w) CALL_VertexAttrib4fNV(GET_DISPATCH(), (index,x,y,z,w)) #define ATTRIB1ARB(index,x) CALL_VertexAttrib1fARB(GET_DISPATCH(), (index,x)) #define ATTRIB2ARB(index,x,y) CALL_VertexAttrib2fARB(GET_DISPATCH(), (index,x,y)) #define ATTRIB3ARB(index,x,y,z) CALL_VertexAttrib3fARB(GET_DISPATCH(), (index,x,y,z)) #define ATTRIB4ARB(index,x,y,z,w) CALL_VertexAttrib4fARB(GET_DISPATCH(), (index,x,y,z,w)) #define FOGCOORDF(x) CALL_FogCoordfEXT(GET_DISPATCH(), (x)) #define SECONDARYCOLORF(a,b,c) CALL_SecondaryColor3fEXT(GET_DISPATCH(), (a,b,c)) static void GLAPIENTRY loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue ) { COLORF( BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green), BYTE_TO_FLOAT(blue), 1.0 ); } static void GLAPIENTRY loopback_Color3d_f( GLdouble red, GLdouble green, GLdouble blue ) { COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, 1.0 ); } static void GLAPIENTRY loopback_Color3i_f( GLint red, GLint green, GLint blue ) { COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), INT_TO_FLOAT(blue), 1.0); } static void GLAPIENTRY loopback_Color3s_f( GLshort red, GLshort green, GLshort blue ) { COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), SHORT_TO_FLOAT(blue), 1.0); } static void GLAPIENTRY loopback_Color3ui_f( GLuint red, GLuint green, GLuint blue ) { COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), UINT_TO_FLOAT(blue), 1.0 ); } static void GLAPIENTRY loopback_Color3us_f( GLushort red, GLushort green, GLushort blue ) { COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), USHORT_TO_FLOAT(blue), 1.0 ); } static void GLAPIENTRY loopback_Color3ub_f( GLubyte red, GLubyte green, GLubyte blue ) { COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), UBYTE_TO_FLOAT(blue), 1.0 ); } static void GLAPIENTRY loopback_Color3bv_f( const GLbyte *v ) { COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]), 1.0 ); } static void GLAPIENTRY loopback_Color3dv_f( const GLdouble *v ) { COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0 ); } static void GLAPIENTRY loopback_Color3iv_f( const GLint *v ) { COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) ); } static void GLAPIENTRY loopback_Color3sv_f( const GLshort *v ) { COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]), 1.0 ); } static void GLAPIENTRY loopback_Color3uiv_f( const GLuint *v ) { COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), UINT_TO_FLOAT(v[2]), 1.0 ); } static void GLAPIENTRY loopback_Color3usv_f( const GLushort *v ) { COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), USHORT_TO_FLOAT(v[2]), 1.0 ); } static void GLAPIENTRY loopback_Color3ubv_f( const GLubyte *v ) { COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), UBYTE_TO_FLOAT(v[2]), 1.0 ); } static void GLAPIENTRY loopback_Color4b_f( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) { COLORF( BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green), BYTE_TO_FLOAT(blue), BYTE_TO_FLOAT(alpha) ); } static void GLAPIENTRY loopback_Color4d_f( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) { COLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue, (GLfloat) alpha ); } static void GLAPIENTRY loopback_Color4i_f( GLint red, GLint green, GLint blue, GLint alpha ) { COLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), INT_TO_FLOAT(blue), INT_TO_FLOAT(alpha) ); } static void GLAPIENTRY loopback_Color4s_f( GLshort red, GLshort green, GLshort blue, GLshort alpha ) { COLORF( SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), SHORT_TO_FLOAT(blue), SHORT_TO_FLOAT(alpha) ); } static void GLAPIENTRY loopback_Color4ui_f( GLuint red, GLuint green, GLuint blue, GLuint alpha ) { COLORF( UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), UINT_TO_FLOAT(blue), UINT_TO_FLOAT(alpha) ); } static void GLAPIENTRY loopback_Color4us_f( GLushort red, GLushort green, GLushort blue, GLushort alpha ) { COLORF( USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), USHORT_TO_FLOAT(blue), USHORT_TO_FLOAT(alpha) ); } static void GLAPIENTRY loopback_Color4ub_f( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) { COLORF( UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), UBYTE_TO_FLOAT(blue), UBYTE_TO_FLOAT(alpha) ); } static void GLAPIENTRY loopback_Color4iv_f( const GLint *v ) { COLORF( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) ); } static void GLAPIENTRY loopback_Color4bv_f( const GLbyte *v ) { COLORF( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]) ); } static void GLAPIENTRY loopback_Color4dv_f( const GLdouble *v ) { COLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); } static void GLAPIENTRY loopback_Color4sv_f( const GLshort *v) { COLORF( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3]) ); } static void GLAPIENTRY loopback_Color4uiv_f( const GLuint *v) { COLORF( UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]) ); } static void GLAPIENTRY loopback_Color4usv_f( const GLushort *v) { COLORF( USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]) ); } static void GLAPIENTRY loopback_Color4ubv_f( const GLubyte *v) { COLORF( UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3]) ); } static void GLAPIENTRY loopback_FogCoorddEXT( GLdouble d ) { FOGCOORDF( (GLfloat) d ); } static void GLAPIENTRY loopback_FogCoorddvEXT( const GLdouble *v ) { FOGCOORDF( (GLfloat) *v ); } static void GLAPIENTRY loopback_Indexd( GLdouble c ) { INDEX( (GLfloat) c ); } static void GLAPIENTRY loopback_Indexi( GLint c ) { INDEX( (GLfloat) c ); } static void GLAPIENTRY loopback_Indexs( GLshort c ) { INDEX( (GLfloat) c ); } static void GLAPIENTRY loopback_Indexub( GLubyte c ) { INDEX( (GLfloat) c ); } static void GLAPIENTRY loopback_Indexdv( const GLdouble *c ) { INDEX( (GLfloat) *c ); } static void GLAPIENTRY loopback_Indexiv( const GLint *c ) { INDEX( (GLfloat) *c ); } static void GLAPIENTRY loopback_Indexsv( const GLshort *c ) { INDEX( (GLfloat) *c ); } static void GLAPIENTRY loopback_Indexubv( const GLubyte *c ) { INDEX( (GLfloat) *c ); } static void GLAPIENTRY loopback_Normal3b( GLbyte nx, GLbyte ny, GLbyte nz ) { NORMAL( BYTE_TO_FLOAT(nx), BYTE_TO_FLOAT(ny), BYTE_TO_FLOAT(nz) ); } static void GLAPIENTRY loopback_Normal3d( GLdouble nx, GLdouble ny, GLdouble nz ) { NORMAL((GLfloat) nx, (GLfloat) ny, (GLfloat) nz); } static void GLAPIENTRY loopback_Normal3i( GLint nx, GLint ny, GLint nz ) { NORMAL( INT_TO_FLOAT(nx), INT_TO_FLOAT(ny), INT_TO_FLOAT(nz) ); } static void GLAPIENTRY loopback_Normal3s( GLshort nx, GLshort ny, GLshort nz ) { NORMAL( SHORT_TO_FLOAT(nx), SHORT_TO_FLOAT(ny), SHORT_TO_FLOAT(nz) ); } static void GLAPIENTRY loopback_Normal3bv( const GLbyte *v ) { NORMAL( BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]) ); } static void GLAPIENTRY loopback_Normal3dv( const GLdouble *v ) { NORMAL( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } static void GLAPIENTRY loopback_Normal3iv( const GLint *v ) { NORMAL( INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]) ); } static void GLAPIENTRY loopback_Normal3sv( const GLshort *v ) { NORMAL( SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]) ); } static void GLAPIENTRY loopback_TexCoord1d( GLdouble s ) { TEXCOORD1((GLfloat) s); } static void GLAPIENTRY loopback_TexCoord1i( GLint s ) { TEXCOORD1((GLfloat) s); } static void GLAPIENTRY loopback_TexCoord1s( GLshort s ) { TEXCOORD1((GLfloat) s); } static void GLAPIENTRY loopback_TexCoord2d( GLdouble s, GLdouble t ) { TEXCOORD2((GLfloat) s,(GLfloat) t); } static void GLAPIENTRY loopback_TexCoord2s( GLshort s, GLshort t ) { TEXCOORD2((GLfloat) s,(GLfloat) t); } static void GLAPIENTRY loopback_TexCoord2i( GLint s, GLint t ) { TEXCOORD2((GLfloat) s,(GLfloat) t); } static void GLAPIENTRY loopback_TexCoord3d( GLdouble s, GLdouble t, GLdouble r ) { TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); } static void GLAPIENTRY loopback_TexCoord3i( GLint s, GLint t, GLint r ) { TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); } static void GLAPIENTRY loopback_TexCoord3s( GLshort s, GLshort t, GLshort r ) { TEXCOORD3((GLfloat) s,(GLfloat) t,(GLfloat) r); } static void GLAPIENTRY loopback_TexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) { TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); } static void GLAPIENTRY loopback_TexCoord4i( GLint s, GLint t, GLint r, GLint q ) { TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); } static void GLAPIENTRY loopback_TexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ) { TEXCOORD4((GLfloat) s,(GLfloat) t,(GLfloat) r,(GLfloat) q); } static void GLAPIENTRY loopback_TexCoord1dv( const GLdouble *v ) { TEXCOORD1((GLfloat) v[0]); } static void GLAPIENTRY loopback_TexCoord1iv( const GLint *v ) { TEXCOORD1((GLfloat) v[0]); } static void GLAPIENTRY loopback_TexCoord1sv( const GLshort *v ) { TEXCOORD1((GLfloat) v[0]); } static void GLAPIENTRY loopback_TexCoord2dv( const GLdouble *v ) { TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); } static void GLAPIENTRY loopback_TexCoord2iv( const GLint *v ) { TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); } static void GLAPIENTRY loopback_TexCoord2sv( const GLshort *v ) { TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); } static void GLAPIENTRY loopback_TexCoord3dv( const GLdouble *v ) { TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]); } static void GLAPIENTRY loopback_TexCoord3iv( const GLint *v ) { TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); } static void GLAPIENTRY loopback_TexCoord3sv( const GLshort *v ) { TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]); } static void GLAPIENTRY loopback_TexCoord4dv( const GLdouble *v ) { TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); } static void GLAPIENTRY loopback_TexCoord4iv( const GLint *v ) { TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); } static void GLAPIENTRY loopback_TexCoord4sv( const GLshort *v ) { TEXCOORD4((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2],(GLfloat) v[3]); } static void GLAPIENTRY loopback_Vertex2d( GLdouble x, GLdouble y ) { VERTEX2( (GLfloat) x, (GLfloat) y ); } static void GLAPIENTRY loopback_Vertex2i( GLint x, GLint y ) { VERTEX2( (GLfloat) x, (GLfloat) y ); } static void GLAPIENTRY loopback_Vertex2s( GLshort x, GLshort y ) { VERTEX2( (GLfloat) x, (GLfloat) y ); } static void GLAPIENTRY loopback_Vertex3d( GLdouble x, GLdouble y, GLdouble z ) { VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); } static void GLAPIENTRY loopback_Vertex3i( GLint x, GLint y, GLint z ) { VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); } static void GLAPIENTRY loopback_Vertex3s( GLshort x, GLshort y, GLshort z ) { VERTEX3( (GLfloat) x, (GLfloat) y, (GLfloat) z ); } static void GLAPIENTRY loopback_Vertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) { VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); } static void GLAPIENTRY loopback_Vertex4i( GLint x, GLint y, GLint z, GLint w ) { VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); } static void GLAPIENTRY loopback_Vertex4s( GLshort x, GLshort y, GLshort z, GLshort w ) { VERTEX4( (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w ); } static void GLAPIENTRY loopback_Vertex2dv( const GLdouble *v ) { VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); } static void GLAPIENTRY loopback_Vertex2iv( const GLint *v ) { VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); } static void GLAPIENTRY loopback_Vertex2sv( const GLshort *v ) { VERTEX2( (GLfloat) v[0], (GLfloat) v[1] ); } static void GLAPIENTRY loopback_Vertex3dv( const GLdouble *v ) { VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } static void GLAPIENTRY loopback_Vertex3iv( const GLint *v ) { VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } static void GLAPIENTRY loopback_Vertex3sv( const GLshort *v ) { VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } static void GLAPIENTRY loopback_Vertex4dv( const GLdouble *v ) { VERTEX4( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); } static void GLAPIENTRY loopback_Vertex4iv( const GLint *v ) { VERTEX4( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); } static void GLAPIENTRY loopback_Vertex4sv( const GLshort *v ) { VERTEX4( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); } static void GLAPIENTRY loopback_MultiTexCoord1dARB(GLenum target, GLdouble s) { MULTI_TEXCOORD1( target, (GLfloat) s ); } static void GLAPIENTRY loopback_MultiTexCoord1dvARB(GLenum target, const GLdouble *v) { MULTI_TEXCOORD1( target, (GLfloat) v[0] ); } static void GLAPIENTRY loopback_MultiTexCoord1iARB(GLenum target, GLint s) { MULTI_TEXCOORD1( target, (GLfloat) s ); } static void GLAPIENTRY loopback_MultiTexCoord1ivARB(GLenum target, const GLint *v) { MULTI_TEXCOORD1( target, (GLfloat) v[0] ); } static void GLAPIENTRY loopback_MultiTexCoord1sARB(GLenum target, GLshort s) { MULTI_TEXCOORD1( target, (GLfloat) s ); } static void GLAPIENTRY loopback_MultiTexCoord1svARB(GLenum target, const GLshort *v) { MULTI_TEXCOORD1( target, (GLfloat) v[0] ); } static void GLAPIENTRY loopback_MultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t) { MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); } static void GLAPIENTRY loopback_MultiTexCoord2dvARB(GLenum target, const GLdouble *v) { MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); } static void GLAPIENTRY loopback_MultiTexCoord2iARB(GLenum target, GLint s, GLint t) { MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); } static void GLAPIENTRY loopback_MultiTexCoord2ivARB(GLenum target, const GLint *v) { MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); } static void GLAPIENTRY loopback_MultiTexCoord2sARB(GLenum target, GLshort s, GLshort t) { MULTI_TEXCOORD2( target, (GLfloat) s, (GLfloat) t ); } static void GLAPIENTRY loopback_MultiTexCoord2svARB(GLenum target, const GLshort *v) { MULTI_TEXCOORD2( target, (GLfloat) v[0], (GLfloat) v[1] ); } static void GLAPIENTRY loopback_MultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r) { MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); } static void GLAPIENTRY loopback_MultiTexCoord3dvARB(GLenum target, const GLdouble *v) { MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } static void GLAPIENTRY loopback_MultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r) { MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); } static void GLAPIENTRY loopback_MultiTexCoord3ivARB(GLenum target, const GLint *v) { MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } static void GLAPIENTRY loopback_MultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r) { MULTI_TEXCOORD3( target, (GLfloat) s, (GLfloat) t, (GLfloat) r ); } static void GLAPIENTRY loopback_MultiTexCoord3svARB(GLenum target, const GLshort *v) { MULTI_TEXCOORD3( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } static void GLAPIENTRY loopback_MultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) { MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, (GLfloat) r, (GLfloat) q ); } static void GLAPIENTRY loopback_MultiTexCoord4dvARB(GLenum target, const GLdouble *v) { MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); } static void GLAPIENTRY loopback_MultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q) { MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, (GLfloat) r, (GLfloat) q ); } static void GLAPIENTRY loopback_MultiTexCoord4ivARB(GLenum target, const GLint *v) { MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); } static void GLAPIENTRY loopback_MultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) { MULTI_TEXCOORD4( target, (GLfloat) s, (GLfloat) t, (GLfloat) r, (GLfloat) q ); } static void GLAPIENTRY loopback_MultiTexCoord4svARB(GLenum target, const GLshort *v) { MULTI_TEXCOORD4( target, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3] ); } static void GLAPIENTRY loopback_EvalCoord2dv( const GLdouble *u ) { EVALCOORD2( (GLfloat) u[0], (GLfloat) u[1] ); } static void GLAPIENTRY loopback_EvalCoord2fv( const GLfloat *u ) { EVALCOORD2( u[0], u[1] ); } static void GLAPIENTRY loopback_EvalCoord2d( GLdouble u, GLdouble v ) { EVALCOORD2( (GLfloat) u, (GLfloat) v ); } static void GLAPIENTRY loopback_EvalCoord1dv( const GLdouble *u ) { EVALCOORD1( (GLfloat) *u ); } static void GLAPIENTRY loopback_EvalCoord1fv( const GLfloat *u ) { EVALCOORD1( (GLfloat) *u ); } static void GLAPIENTRY loopback_EvalCoord1d( GLdouble u ) { EVALCOORD1( (GLfloat) u ); } static void GLAPIENTRY loopback_Materialf( GLenum face, GLenum pname, GLfloat param ) { GLfloat fparam[4]; fparam[0] = param; MATERIALFV( face, pname, fparam ); } static void GLAPIENTRY loopback_Materiali(GLenum face, GLenum pname, GLint param ) { GLfloat p = (GLfloat) param; MATERIALFV(face, pname, &p); } static void GLAPIENTRY loopback_Materialiv(GLenum face, GLenum pname, const GLint *params ) { GLfloat fparam[4]; switch (pname) { case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: case GL_EMISSION: case GL_AMBIENT_AND_DIFFUSE: fparam[0] = INT_TO_FLOAT( params[0] ); fparam[1] = INT_TO_FLOAT( params[1] ); fparam[2] = INT_TO_FLOAT( params[2] ); fparam[3] = INT_TO_FLOAT( params[3] ); break; case GL_SHININESS: fparam[0] = (GLfloat) params[0]; break; case GL_COLOR_INDEXES: fparam[0] = (GLfloat) params[0]; fparam[1] = (GLfloat) params[1]; fparam[2] = (GLfloat) params[2]; break; default: ; } MATERIALFV(face, pname, fparam); } static void GLAPIENTRY loopback_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) { RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); } static void GLAPIENTRY loopback_Rectdv(const GLdouble *v1, const GLdouble *v2) { RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); } static void GLAPIENTRY loopback_Rectfv(const GLfloat *v1, const GLfloat *v2) { RECTF(v1[0], v1[1], v2[0], v2[1]); } static void GLAPIENTRY loopback_Recti(GLint x1, GLint y1, GLint x2, GLint y2) { RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); } static void GLAPIENTRY loopback_Rectiv(const GLint *v1, const GLint *v2) { RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); } static void GLAPIENTRY loopback_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2) { RECTF((GLfloat) x1, (GLfloat) y1, (GLfloat) x2, (GLfloat) y2); } static void GLAPIENTRY loopback_Rectsv(const GLshort *v1, const GLshort *v2) { RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]); } static void GLAPIENTRY loopback_SecondaryColor3bEXT_f( GLbyte red, GLbyte green, GLbyte blue ) { SECONDARYCOLORF( BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green), BYTE_TO_FLOAT(blue) ); } static void GLAPIENTRY loopback_SecondaryColor3dEXT_f( GLdouble red, GLdouble green, GLdouble blue ) { SECONDARYCOLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue ); } static void GLAPIENTRY loopback_SecondaryColor3iEXT_f( GLint red, GLint green, GLint blue ) { SECONDARYCOLORF( INT_TO_FLOAT(red), INT_TO_FLOAT(green), INT_TO_FLOAT(blue)); } static void GLAPIENTRY loopback_SecondaryColor3sEXT_f( GLshort red, GLshort green, GLshort blue ) { SECONDARYCOLORF(SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green), SHORT_TO_FLOAT(blue)); } static void GLAPIENTRY loopback_SecondaryColor3uiEXT_f( GLuint red, GLuint green, GLuint blue ) { SECONDARYCOLORF(UINT_TO_FLOAT(red), UINT_TO_FLOAT(green), UINT_TO_FLOAT(blue)); } static void GLAPIENTRY loopback_SecondaryColor3usEXT_f( GLushort red, GLushort green, GLushort blue ) { SECONDARYCOLORF(USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green), USHORT_TO_FLOAT(blue)); } static void GLAPIENTRY loopback_SecondaryColor3ubEXT_f( GLubyte red, GLubyte green, GLubyte blue ) { SECONDARYCOLORF(UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), UBYTE_TO_FLOAT(blue)); } static void GLAPIENTRY loopback_SecondaryColor3bvEXT_f( const GLbyte *v ) { SECONDARYCOLORF(BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2])); } static void GLAPIENTRY loopback_SecondaryColor3dvEXT_f( const GLdouble *v ) { SECONDARYCOLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] ); } static void GLAPIENTRY loopback_SecondaryColor3ivEXT_f( const GLint *v ) { SECONDARYCOLORF(INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2])); } static void GLAPIENTRY loopback_SecondaryColor3svEXT_f( const GLshort *v ) { SECONDARYCOLORF(SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2])); } static void GLAPIENTRY loopback_SecondaryColor3uivEXT_f( const GLuint *v ) { SECONDARYCOLORF(UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), UINT_TO_FLOAT(v[2])); } static void GLAPIENTRY loopback_SecondaryColor3usvEXT_f( const GLushort *v ) { SECONDARYCOLORF(USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), USHORT_TO_FLOAT(v[2])); } static void GLAPIENTRY loopback_SecondaryColor3ubvEXT_f( const GLubyte *v ) { SECONDARYCOLORF(UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), UBYTE_TO_FLOAT(v[2])); } /* * GL_NV_vertex_program: * Always loop-back to one of the VertexAttrib[1234]f[v]NV functions. */ static void GLAPIENTRY loopback_VertexAttrib1sNV(GLuint index, GLshort x) { ATTRIB1NV(index, (GLfloat) x); } static void GLAPIENTRY loopback_VertexAttrib1dNV(GLuint index, GLdouble x) { ATTRIB1NV(index, (GLfloat) x); } static void GLAPIENTRY loopback_VertexAttrib2sNV(GLuint index, GLshort x, GLshort y) { ATTRIB2NV(index, (GLfloat) x, y); } static void GLAPIENTRY loopback_VertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y) { ATTRIB2NV(index, (GLfloat) x, (GLfloat) y); } static void GLAPIENTRY loopback_VertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z) { ATTRIB3NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z); } static void GLAPIENTRY loopback_VertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z) { ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } static void GLAPIENTRY loopback_VertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) { ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } static void GLAPIENTRY loopback_VertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { ATTRIB4NV(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } static void GLAPIENTRY loopback_VertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) { ATTRIB4NV(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); } static void GLAPIENTRY loopback_VertexAttrib1svNV(GLuint index, const GLshort *v) { ATTRIB1NV(index, (GLfloat) v[0]); } static void GLAPIENTRY loopback_VertexAttrib1dvNV(GLuint index, const GLdouble *v) { ATTRIB1NV(index, (GLfloat) v[0]); } static void GLAPIENTRY loopback_VertexAttrib2svNV(GLuint index, const GLshort *v) { ATTRIB2NV(index, (GLfloat) v[0], (GLfloat) v[1]); } static void GLAPIENTRY loopback_VertexAttrib2dvNV(GLuint index, const GLdouble *v) { ATTRIB2NV(index, (GLfloat) v[0], (GLfloat) v[1]); } static void GLAPIENTRY loopback_VertexAttrib3svNV(GLuint index, const GLshort *v) { ATTRIB3NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); } static void GLAPIENTRY loopback_VertexAttrib3dvNV(GLuint index, const GLdouble *v) { ATTRIB3NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); } static void GLAPIENTRY loopback_VertexAttrib4svNV(GLuint index, const GLshort *v) { ATTRIB4NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat)v[3]); } static void GLAPIENTRY loopback_VertexAttrib4dvNV(GLuint index, const GLdouble *v) { ATTRIB4NV(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void GLAPIENTRY loopback_VertexAttrib4ubvNV(GLuint index, const GLubyte *v) { ATTRIB4NV(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); } static void GLAPIENTRY loopback_VertexAttribs1svNV(GLuint index, GLsizei n, const GLshort *v) { GLint i; for (i = n - 1; i >= 0; i--) loopback_VertexAttrib1svNV(index + i, v + i); } static void GLAPIENTRY loopback_VertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat *v) { GLint i; for (i = n - 1; i >= 0; i--) ATTRIB1NV(index + i, v[i]); } static void GLAPIENTRY loopback_VertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble *v) { GLint i; for (i = n - 1; i >= 0; i--) loopback_VertexAttrib1dvNV(index + i, v + i); } static void GLAPIENTRY loopback_VertexAttribs2svNV(GLuint index, GLsizei n, const GLshort *v) { GLint i; for (i = n - 1; i >= 0; i--) loopback_VertexAttrib2svNV(index + i, v + 2 * i); } static void GLAPIENTRY loopback_VertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat *v) { GLint i; for (i = n - 1; i >= 0; i--) ATTRIB2NV(index + i, v[2 * i], v[2 * i + 1]); } static void GLAPIENTRY loopback_VertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble *v) { GLint i; for (i = n - 1; i >= 0; i--) loopback_VertexAttrib2dvNV(index + i, v + 2 * i); } static void GLAPIENTRY loopback_VertexAttribs3svNV(GLuint index, GLsizei n, const GLshort *v) { GLint i; for (i = n - 1; i >= 0; i--) loopback_VertexAttrib3svNV(index + i, v + 3 * i); } static void GLAPIENTRY loopback_VertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat *v) { GLint i; for (i = n - 1; i >= 0; i--) ATTRIB3NV(index + i, v[3 * i], v[3 * i + 1], v[3 * i + 2]); } static void GLAPIENTRY loopback_VertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble *v) { GLint i; for (i = n - 1; i >= 0; i--) loopback_VertexAttrib3dvNV(index + i, v + 3 * i); } static void GLAPIENTRY loopback_VertexAttribs4svNV(GLuint index, GLsizei n, const GLshort *v) { GLint i; for (i = n - 1; i >= 0; i--) loopback_VertexAttrib4svNV(index + i, v + 4 * i); } static void GLAPIENTRY loopback_VertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat *v) { GLint i; for (i = n - 1; i >= 0; i--) ATTRIB4NV(index + i, v[4 * i], v[4 * i + 1], v[4 * i + 2], v[4 * i + 3]); } static void GLAPIENTRY loopback_VertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble *v) { GLint i; for (i = n - 1; i >= 0; i--) loopback_VertexAttrib4dvNV(index + i, v + 4 * i); } static void GLAPIENTRY loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v) { GLint i; for (i = n - 1; i >= 0; i--) loopback_VertexAttrib4ubvNV(index + i, v + 4 * i); } /* * GL_ARB_vertex_program * Always loop-back to one of the VertexAttrib[1234]f[v]ARB functions. */ static void GLAPIENTRY loopback_VertexAttrib1sARB(GLuint index, GLshort x) { ATTRIB1ARB(index, (GLfloat) x); } static void GLAPIENTRY loopback_VertexAttrib1dARB(GLuint index, GLdouble x) { ATTRIB1ARB(index, (GLfloat) x); } static void GLAPIENTRY loopback_VertexAttrib2sARB(GLuint index, GLshort x, GLshort y) { ATTRIB2ARB(index, (GLfloat) x, y); } static void GLAPIENTRY loopback_VertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y) { ATTRIB2ARB(index, (GLfloat) x, (GLfloat) y); } static void GLAPIENTRY loopback_VertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z) { ATTRIB3ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z); } static void GLAPIENTRY loopback_VertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z) { ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } static void GLAPIENTRY loopback_VertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) { ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } static void GLAPIENTRY loopback_VertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } static void GLAPIENTRY loopback_VertexAttrib1svARB(GLuint index, const GLshort *v) { ATTRIB1ARB(index, (GLfloat) v[0]); } static void GLAPIENTRY loopback_VertexAttrib1dvARB(GLuint index, const GLdouble *v) { ATTRIB1ARB(index, (GLfloat) v[0]); } static void GLAPIENTRY loopback_VertexAttrib2svARB(GLuint index, const GLshort *v) { ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]); } static void GLAPIENTRY loopback_VertexAttrib2dvARB(GLuint index, const GLdouble *v) { ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]); } static void GLAPIENTRY loopback_VertexAttrib3svARB(GLuint index, const GLshort *v) { ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); } static void GLAPIENTRY loopback_VertexAttrib3dvARB(GLuint index, const GLdouble *v) { ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); } static void GLAPIENTRY loopback_VertexAttrib4svARB(GLuint index, const GLshort *v) { ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat)v[3]); } static void GLAPIENTRY loopback_VertexAttrib4dvARB(GLuint index, const GLdouble *v) { ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void GLAPIENTRY loopback_VertexAttrib4bvARB(GLuint index, const GLbyte * v) { ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void GLAPIENTRY loopback_VertexAttrib4ivARB(GLuint index, const GLint * v) { ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void GLAPIENTRY loopback_VertexAttrib4ubvARB(GLuint index, const GLubyte * v) { ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void GLAPIENTRY loopback_VertexAttrib4usvARB(GLuint index, const GLushort * v) { ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void GLAPIENTRY loopback_VertexAttrib4uivARB(GLuint index, const GLuint * v) { ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void GLAPIENTRY loopback_VertexAttrib4NbvARB(GLuint index, const GLbyte * v) { ATTRIB4ARB(index, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3])); } static void GLAPIENTRY loopback_VertexAttrib4NsvARB(GLuint index, const GLshort * v) { ATTRIB4ARB(index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3])); } static void GLAPIENTRY loopback_VertexAttrib4NivARB(GLuint index, const GLint * v) { ATTRIB4ARB(index, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3])); } static void GLAPIENTRY loopback_VertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) { ATTRIB4ARB(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); } static void GLAPIENTRY loopback_VertexAttrib4NubvARB(GLuint index, const GLubyte * v) { ATTRIB4ARB(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); } static void GLAPIENTRY loopback_VertexAttrib4NusvARB(GLuint index, const GLushort * v) { ATTRIB4ARB(index, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]), USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3])); } static void GLAPIENTRY loopback_VertexAttrib4NuivARB(GLuint index, const GLuint * v) { ATTRIB4ARB(index, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]), UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3])); } /* * This code never registers handlers for any of the entry points * listed in vtxfmt.h. */ void _mesa_loopback_init_api_table( struct _glapi_table *dest ) { SET_Color3b(dest, loopback_Color3b_f); SET_Color3d(dest, loopback_Color3d_f); SET_Color3i(dest, loopback_Color3i_f); SET_Color3s(dest, loopback_Color3s_f); SET_Color3ui(dest, loopback_Color3ui_f); SET_Color3us(dest, loopback_Color3us_f); SET_Color3ub(dest, loopback_Color3ub_f); SET_Color4b(dest, loopback_Color4b_f); SET_Color4d(dest, loopback_Color4d_f); SET_Color4i(dest, loopback_Color4i_f); SET_Color4s(dest, loopback_Color4s_f); SET_Color4ui(dest, loopback_Color4ui_f); SET_Color4us(dest, loopback_Color4us_f); SET_Color4ub(dest, loopback_Color4ub_f); SET_Color3bv(dest, loopback_Color3bv_f); SET_Color3dv(dest, loopback_Color3dv_f); SET_Color3iv(dest, loopback_Color3iv_f); SET_Color3sv(dest, loopback_Color3sv_f); SET_Color3uiv(dest, loopback_Color3uiv_f); SET_Color3usv(dest, loopback_Color3usv_f); SET_Color3ubv(dest, loopback_Color3ubv_f); SET_Color4bv(dest, loopback_Color4bv_f); SET_Color4dv(dest, loopback_Color4dv_f); SET_Color4iv(dest, loopback_Color4iv_f); SET_Color4sv(dest, loopback_Color4sv_f); SET_Color4uiv(dest, loopback_Color4uiv_f); SET_Color4usv(dest, loopback_Color4usv_f); SET_Color4ubv(dest, loopback_Color4ubv_f); SET_SecondaryColor3bEXT(dest, loopback_SecondaryColor3bEXT_f); SET_SecondaryColor3dEXT(dest, loopback_SecondaryColor3dEXT_f); SET_SecondaryColor3iEXT(dest, loopback_SecondaryColor3iEXT_f); SET_SecondaryColor3sEXT(dest, loopback_SecondaryColor3sEXT_f); SET_SecondaryColor3uiEXT(dest, loopback_SecondaryColor3uiEXT_f); SET_SecondaryColor3usEXT(dest, loopback_SecondaryColor3usEXT_f); SET_SecondaryColor3ubEXT(dest, loopback_SecondaryColor3ubEXT_f); SET_SecondaryColor3bvEXT(dest, loopback_SecondaryColor3bvEXT_f); SET_SecondaryColor3dvEXT(dest, loopback_SecondaryColor3dvEXT_f); SET_SecondaryColor3ivEXT(dest, loopback_SecondaryColor3ivEXT_f); SET_SecondaryColor3svEXT(dest, loopback_SecondaryColor3svEXT_f); SET_SecondaryColor3uivEXT(dest, loopback_SecondaryColor3uivEXT_f); SET_SecondaryColor3usvEXT(dest, loopback_SecondaryColor3usvEXT_f); SET_SecondaryColor3ubvEXT(dest, loopback_SecondaryColor3ubvEXT_f); SET_Indexd(dest, loopback_Indexd); SET_Indexi(dest, loopback_Indexi); SET_Indexs(dest, loopback_Indexs); SET_Indexub(dest, loopback_Indexub); SET_Indexdv(dest, loopback_Indexdv); SET_Indexiv(dest, loopback_Indexiv); SET_Indexsv(dest, loopback_Indexsv); SET_Indexubv(dest, loopback_Indexubv); SET_Normal3b(dest, loopback_Normal3b); SET_Normal3d(dest, loopback_Normal3d); SET_Normal3i(dest, loopback_Normal3i); SET_Normal3s(dest, loopback_Normal3s); SET_Normal3bv(dest, loopback_Normal3bv); SET_Normal3dv(dest, loopback_Normal3dv); SET_Normal3iv(dest, loopback_Normal3iv); SET_Normal3sv(dest, loopback_Normal3sv); SET_TexCoord1d(dest, loopback_TexCoord1d); SET_TexCoord1i(dest, loopback_TexCoord1i); SET_TexCoord1s(dest, loopback_TexCoord1s); SET_TexCoord2d(dest, loopback_TexCoord2d); SET_TexCoord2s(dest, loopback_TexCoord2s); SET_TexCoord2i(dest, loopback_TexCoord2i); SET_TexCoord3d(dest, loopback_TexCoord3d); SET_TexCoord3i(dest, loopback_TexCoord3i); SET_TexCoord3s(dest, loopback_TexCoord3s); SET_TexCoord4d(dest, loopback_TexCoord4d); SET_TexCoord4i(dest, loopback_TexCoord4i); SET_TexCoord4s(dest, loopback_TexCoord4s); SET_TexCoord1dv(dest, loopback_TexCoord1dv); SET_TexCoord1iv(dest, loopback_TexCoord1iv); SET_TexCoord1sv(dest, loopback_TexCoord1sv); SET_TexCoord2dv(dest, loopback_TexCoord2dv); SET_TexCoord2iv(dest, loopback_TexCoord2iv); SET_TexCoord2sv(dest, loopback_TexCoord2sv); SET_TexCoord3dv(dest, loopback_TexCoord3dv); SET_TexCoord3iv(dest, loopback_TexCoord3iv); SET_TexCoord3sv(dest, loopback_TexCoord3sv); SET_TexCoord4dv(dest, loopback_TexCoord4dv); SET_TexCoord4iv(dest, loopback_TexCoord4iv); SET_TexCoord4sv(dest, loopback_TexCoord4sv); SET_Vertex2d(dest, loopback_Vertex2d); SET_Vertex2i(dest, loopback_Vertex2i); SET_Vertex2s(dest, loopback_Vertex2s); SET_Vertex3d(dest, loopback_Vertex3d); SET_Vertex3i(dest, loopback_Vertex3i); SET_Vertex3s(dest, loopback_Vertex3s); SET_Vertex4d(dest, loopback_Vertex4d); SET_Vertex4i(dest, loopback_Vertex4i); SET_Vertex4s(dest, loopback_Vertex4s); SET_Vertex2dv(dest, loopback_Vertex2dv); SET_Vertex2iv(dest, loopback_Vertex2iv); SET_Vertex2sv(dest, loopback_Vertex2sv); SET_Vertex3dv(dest, loopback_Vertex3dv); SET_Vertex3iv(dest, loopback_Vertex3iv); SET_Vertex3sv(dest, loopback_Vertex3sv); SET_Vertex4dv(dest, loopback_Vertex4dv); SET_Vertex4iv(dest, loopback_Vertex4iv); SET_Vertex4sv(dest, loopback_Vertex4sv); SET_MultiTexCoord1dARB(dest, loopback_MultiTexCoord1dARB); SET_MultiTexCoord1dvARB(dest, loopback_MultiTexCoord1dvARB); SET_MultiTexCoord1iARB(dest, loopback_MultiTexCoord1iARB); SET_MultiTexCoord1ivARB(dest, loopback_MultiTexCoord1ivARB); SET_MultiTexCoord1sARB(dest, loopback_MultiTexCoord1sARB); SET_MultiTexCoord1svARB(dest, loopback_MultiTexCoord1svARB); SET_MultiTexCoord2dARB(dest, loopback_MultiTexCoord2dARB); SET_MultiTexCoord2dvARB(dest, loopback_MultiTexCoord2dvARB); SET_MultiTexCoord2iARB(dest, loopback_MultiTexCoord2iARB); SET_MultiTexCoord2ivARB(dest, loopback_MultiTexCoord2ivARB); SET_MultiTexCoord2sARB(dest, loopback_MultiTexCoord2sARB); SET_MultiTexCoord2svARB(dest, loopback_MultiTexCoord2svARB); SET_MultiTexCoord3dARB(dest, loopback_MultiTexCoord3dARB); SET_MultiTexCoord3dvARB(dest, loopback_MultiTexCoord3dvARB); SET_MultiTexCoord3iARB(dest, loopback_MultiTexCoord3iARB); SET_MultiTexCoord3ivARB(dest, loopback_MultiTexCoord3ivARB); SET_MultiTexCoord3sARB(dest, loopback_MultiTexCoord3sARB); SET_MultiTexCoord3svARB(dest, loopback_MultiTexCoord3svARB); SET_MultiTexCoord4dARB(dest, loopback_MultiTexCoord4dARB); SET_MultiTexCoord4dvARB(dest, loopback_MultiTexCoord4dvARB); SET_MultiTexCoord4iARB(dest, loopback_MultiTexCoord4iARB); SET_MultiTexCoord4ivARB(dest, loopback_MultiTexCoord4ivARB); SET_MultiTexCoord4sARB(dest, loopback_MultiTexCoord4sARB); SET_MultiTexCoord4svARB(dest, loopback_MultiTexCoord4svARB); SET_EvalCoord2dv(dest, loopback_EvalCoord2dv); SET_EvalCoord2fv(dest, loopback_EvalCoord2fv); SET_EvalCoord2d(dest, loopback_EvalCoord2d); SET_EvalCoord1dv(dest, loopback_EvalCoord1dv); SET_EvalCoord1fv(dest, loopback_EvalCoord1fv); SET_EvalCoord1d(dest, loopback_EvalCoord1d); SET_Materialf(dest, loopback_Materialf); SET_Materiali(dest, loopback_Materiali); SET_Materialiv(dest, loopback_Materialiv); SET_Rectd(dest, loopback_Rectd); SET_Rectdv(dest, loopback_Rectdv); SET_Rectfv(dest, loopback_Rectfv); SET_Recti(dest, loopback_Recti); SET_Rectiv(dest, loopback_Rectiv); SET_Rects(dest, loopback_Rects); SET_Rectsv(dest, loopback_Rectsv); SET_FogCoorddEXT(dest, loopback_FogCoorddEXT); SET_FogCoorddvEXT(dest, loopback_FogCoorddvEXT); SET_VertexAttrib1sNV(dest, loopback_VertexAttrib1sNV); SET_VertexAttrib1dNV(dest, loopback_VertexAttrib1dNV); SET_VertexAttrib2sNV(dest, loopback_VertexAttrib2sNV); SET_VertexAttrib2dNV(dest, loopback_VertexAttrib2dNV); SET_VertexAttrib3sNV(dest, loopback_VertexAttrib3sNV); SET_VertexAttrib3dNV(dest, loopback_VertexAttrib3dNV); SET_VertexAttrib4sNV(dest, loopback_VertexAttrib4sNV); SET_VertexAttrib4dNV(dest, loopback_VertexAttrib4dNV); SET_VertexAttrib4ubNV(dest, loopback_VertexAttrib4ubNV); SET_VertexAttrib1svNV(dest, loopback_VertexAttrib1svNV); SET_VertexAttrib1dvNV(dest, loopback_VertexAttrib1dvNV); SET_VertexAttrib2svNV(dest, loopback_VertexAttrib2svNV); SET_VertexAttrib2dvNV(dest, loopback_VertexAttrib2dvNV); SET_VertexAttrib3svNV(dest, loopback_VertexAttrib3svNV); SET_VertexAttrib3dvNV(dest, loopback_VertexAttrib3dvNV); SET_VertexAttrib4svNV(dest, loopback_VertexAttrib4svNV); SET_VertexAttrib4dvNV(dest, loopback_VertexAttrib4dvNV); SET_VertexAttrib4ubvNV(dest, loopback_VertexAttrib4ubvNV); SET_VertexAttribs1svNV(dest, loopback_VertexAttribs1svNV); SET_VertexAttribs1fvNV(dest, loopback_VertexAttribs1fvNV); SET_VertexAttribs1dvNV(dest, loopback_VertexAttribs1dvNV); SET_VertexAttribs2svNV(dest, loopback_VertexAttribs2svNV); SET_VertexAttribs2fvNV(dest, loopback_VertexAttribs2fvNV); SET_VertexAttribs2dvNV(dest, loopback_VertexAttribs2dvNV); SET_VertexAttribs3svNV(dest, loopback_VertexAttribs3svNV); SET_VertexAttribs3fvNV(dest, loopback_VertexAttribs3fvNV); SET_VertexAttribs3dvNV(dest, loopback_VertexAttribs3dvNV); SET_VertexAttribs4svNV(dest, loopback_VertexAttribs4svNV); SET_VertexAttribs4fvNV(dest, loopback_VertexAttribs4fvNV); SET_VertexAttribs4dvNV(dest, loopback_VertexAttribs4dvNV); SET_VertexAttribs4ubvNV(dest, loopback_VertexAttribs4ubvNV); SET_VertexAttrib1sARB(dest, loopback_VertexAttrib1sARB); SET_VertexAttrib1dARB(dest, loopback_VertexAttrib1dARB); SET_VertexAttrib2sARB(dest, loopback_VertexAttrib2sARB); SET_VertexAttrib2dARB(dest, loopback_VertexAttrib2dARB); SET_VertexAttrib3sARB(dest, loopback_VertexAttrib3sARB); SET_VertexAttrib3dARB(dest, loopback_VertexAttrib3dARB); SET_VertexAttrib4sARB(dest, loopback_VertexAttrib4sARB); SET_VertexAttrib4dARB(dest, loopback_VertexAttrib4dARB); SET_VertexAttrib1svARB(dest, loopback_VertexAttrib1svARB); SET_VertexAttrib1dvARB(dest, loopback_VertexAttrib1dvARB); SET_VertexAttrib2svARB(dest, loopback_VertexAttrib2svARB); SET_VertexAttrib2dvARB(dest, loopback_VertexAttrib2dvARB); SET_VertexAttrib3svARB(dest, loopback_VertexAttrib3svARB); SET_VertexAttrib3dvARB(dest, loopback_VertexAttrib3dvARB); SET_VertexAttrib4svARB(dest, loopback_VertexAttrib4svARB); SET_VertexAttrib4dvARB(dest, loopback_VertexAttrib4dvARB); SET_VertexAttrib4NubARB(dest, loopback_VertexAttrib4NubARB); SET_VertexAttrib4NubvARB(dest, loopback_VertexAttrib4NubvARB); SET_VertexAttrib4bvARB(dest, loopback_VertexAttrib4bvARB); SET_VertexAttrib4ivARB(dest, loopback_VertexAttrib4ivARB); SET_VertexAttrib4ubvARB(dest, loopback_VertexAttrib4ubvARB); SET_VertexAttrib4usvARB(dest, loopback_VertexAttrib4usvARB); SET_VertexAttrib4uivARB(dest, loopback_VertexAttrib4uivARB); SET_VertexAttrib4NbvARB(dest, loopback_VertexAttrib4NbvARB); SET_VertexAttrib4NsvARB(dest, loopback_VertexAttrib4NsvARB); SET_VertexAttrib4NivARB(dest, loopback_VertexAttrib4NivARB); SET_VertexAttrib4NusvARB(dest, loopback_VertexAttrib4NusvARB); SET_VertexAttrib4NuivARB(dest, loopback_VertexAttrib4NuivARB); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/api_loopback.h0000644000000000000000000000250113614532424020733 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef API_LOOPBACK_H #define API_LOOPBACK_H #include "glheader.h" struct _glapi_table; extern void _mesa_loopback_init_api_table( struct _glapi_table *dest ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/api_noop.c0000644000000000000000000006275513614532424020130 0ustar /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "api_noop.h" #include "api_validate.h" #include "api_arrayelt.h" #include "context.h" #include "colormac.h" #include "light.h" #include "macros.h" #include "mtypes.h" #include "dlist.h" #include "dispatch.h" /* In states where certain vertex components are required for t&l or * rasterization, we still need to keep track of the current values. * These functions provide this service by keeping uptodate the * 'ctx->Current' struct for all data elements not included in the * currently enabled hardware vertex. * I.e. these functions would typically be used when outside of glBegin/End. */ void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b ) { GET_CURRENT_CONTEXT(ctx); ctx->Current.EdgeFlag = b; } void GLAPIENTRY _mesa_noop_EdgeFlagv( const GLboolean *b ) { GET_CURRENT_CONTEXT(ctx); ctx->Current.EdgeFlag = *b; } void GLAPIENTRY _mesa_noop_Indexf( GLfloat f ) { GET_CURRENT_CONTEXT(ctx); ctx->Current.Index = f; } void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); ctx->Current.Index = *v; } void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_FOG]; dest[0] = a; dest[1] = 0.0; dest[2] = 0.0; dest[3] = 1.0; } void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_FOG]; dest[0] = v[0]; dest[1] = 0.0; dest[2] = 0.0; dest[3] = 1.0; } void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; dest[0] = a; dest[1] = b; dest[2] = c; dest[3] = 1.0; } void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; dest[0] = v[0]; dest[1] = v[1]; dest[2] = v[2]; dest[3] = 1.0; } void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) { GET_CURRENT_CONTEXT(ctx); GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = a; color[1] = b; color[2] = c; color[3] = d; } void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = v[0]; color[1] = v[1]; color[2] = v[2]; color[3] = v[3]; } void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = a; color[1] = b; color[2] = c; color[3] = 1.0; } void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = v[0]; color[1] = v[1]; color[2] = v[2]; color[3] = 1.0; } void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; /* unit is unsigned -- cannot be less than zero. */ if (unit < MAX_TEXTURE_COORD_UNITS) { GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; dest[0] = a; dest[1] = 0; dest[2] = 0; dest[3] = 1; } } void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; /* unit is unsigned -- cannot be less than zero. */ if (unit < MAX_TEXTURE_COORD_UNITS) { GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; dest[0] = v[0]; dest[1] = 0; dest[2] = 0; dest[3] = 1; } } void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; /* unit is unsigned -- cannot be less than zero. */ if (unit < MAX_TEXTURE_COORD_UNITS) { GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; dest[0] = a; dest[1] = b; dest[2] = 0; dest[3] = 1; } } void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; /* unit is unsigned -- cannot be less than zero. */ if (unit < MAX_TEXTURE_COORD_UNITS) { GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; dest[0] = v[0]; dest[1] = v[1]; dest[2] = 0; dest[3] = 1; } } void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; /* unit is unsigned -- cannot be less than zero. */ if (unit < MAX_TEXTURE_COORD_UNITS) { GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; dest[0] = a; dest[1] = b; dest[2] = c; dest[3] = 1; } } void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; /* unit is unsigned -- cannot be less than zero. */ if (unit < MAX_TEXTURE_COORD_UNITS) { GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; dest[0] = v[0]; dest[1] = v[1]; dest[2] = v[2]; dest[3] = 1; } } void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c, GLfloat d ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; /* unit is unsigned -- cannot be less than zero. */ if (unit < MAX_TEXTURE_COORD_UNITS) { GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; dest[0] = a; dest[1] = b; dest[2] = c; dest[3] = d; } } void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; /* unit is unsigned -- cannot be less than zero. */ if (unit < MAX_TEXTURE_COORD_UNITS) { GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; dest[0] = v[0]; dest[1] = v[1]; dest[2] = v[2]; dest[3] = v[3]; } } void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; color[0] = a; color[1] = b; color[2] = c; color[3] = 1.0; } void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; color[0] = v[0]; color[1] = v[1]; color[2] = v[2]; color[3] = 1.0; } void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; dest[0] = a; dest[1] = 0; dest[2] = 0; dest[3] = 1; } void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; dest[0] = v[0]; dest[1] = 0; dest[2] = 0; dest[3] = 1; } void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; dest[0] = a; dest[1] = b; dest[2] = 0; dest[3] = 1; } void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; dest[0] = v[0]; dest[1] = v[1]; dest[2] = 0; dest[3] = 1; } void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; dest[0] = a; dest[1] = b; dest[2] = c; dest[3] = 1; } void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; dest[0] = v[0]; dest[1] = v[1]; dest[2] = v[2]; dest[3] = 1; } void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; dest[0] = a; dest[1] = b; dest[2] = c; dest[3] = d; } void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; dest[0] = v[0]; dest[1] = v[1]; dest[2] = v[2]; dest[3] = v[3]; } void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fNV" ); } void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fvNV" ); } void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fNV" ); } void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fvNV" ); } void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fNV" ); } void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fvNV" ); } void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fNV" ); } void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fvNV" ); } /* * XXX Un-alias attribs here */ void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fARB" ); } void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fvARB" ); } void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fARB" ); } void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fvARB" ); } void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fARB" ); } void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fvARB" ); } void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fARB" ); } void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]); } else _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fvARB" ); } /* Material */ void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); GLint i, nr; struct gl_material *mat = &ctx->Light.Material; GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0, "_mesa_noop_Materialfv" ); if (ctx->Light.ColorMaterialEnabled) bitmask &= ~ctx->Light.ColorMaterialBitmask; if (bitmask == 0) return; switch (pname) { case GL_SHININESS: nr = 1; break; case GL_COLOR_INDEXES: nr = 3; break; default: nr = 4 ; break; } for (i = 0 ; i < MAT_ATTRIB_MAX ; i++) if (bitmask & (1<Attrib[i], nr, params ); _mesa_update_material( ctx, bitmask ); } /* These really are noops outside begin/end: */ void GLAPIENTRY _mesa_noop_Vertex2fv( const GLfloat *v ) { (void) v; } void GLAPIENTRY _mesa_noop_Vertex3fv( const GLfloat *v ) { (void) v; } void GLAPIENTRY _mesa_noop_Vertex4fv( const GLfloat *v ) { (void) v; } void GLAPIENTRY _mesa_noop_Vertex2f( GLfloat a, GLfloat b ) { (void) a; (void) b; } void GLAPIENTRY _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c ) { (void) a; (void) b; (void) c; } void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) { (void) a; (void) b; (void) c; (void) d; } /* Similarly, these have no effect outside begin/end: */ void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a ) { (void) a; } void GLAPIENTRY _mesa_noop_EvalCoord1fv( const GLfloat *v ) { (void) v; } void GLAPIENTRY _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b ) { (void) a; (void) b; } void GLAPIENTRY _mesa_noop_EvalCoord2fv( const GLfloat *v ) { (void) v; } void GLAPIENTRY _mesa_noop_EvalPoint1( GLint a ) { (void) a; } void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b ) { (void) a; (void) b; } /* Begin -- call into driver, should result in the vtxfmt being * swapped out: */ void GLAPIENTRY _mesa_noop_Begin( GLenum mode ) { (void) mode; } /* End -- just raise an error */ void GLAPIENTRY _mesa_noop_End( void ) { GET_CURRENT_CONTEXT(ctx); _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" ); } /* Execute a glRectf() function. This is not suitable for GL_COMPILE * modes (as the test for outside begin/end is not compiled), * but may be useful for drivers in circumstances which exclude * display list interactions. * * (None of the functions in this file are suitable for GL_COMPILE * modes). */ void GLAPIENTRY _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) { { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); } CALL_Begin(GET_DISPATCH(), (GL_QUADS)); CALL_Vertex2f(GET_DISPATCH(), (x1, y1)); CALL_Vertex2f(GET_DISPATCH(), (x2, y1)); CALL_Vertex2f(GET_DISPATCH(), (x2, y2)); CALL_Vertex2f(GET_DISPATCH(), (x1, y2)); CALL_End(GET_DISPATCH(), ()); } /* Some very basic support for arrays. Drivers without explicit array * support can hook these in, but still need to supply an array-elt * implementation. */ void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count) { GET_CURRENT_CONTEXT(ctx); GLint i; if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) return; CALL_Begin(GET_DISPATCH(), (mode)); for (i = 0; i < count; i++) CALL_ArrayElement(GET_DISPATCH(), (start + i)); CALL_End(GET_DISPATCH(), ()); } void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); GLint i; if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) return; CALL_Begin(GET_DISPATCH(), (mode)); switch (type) { case GL_UNSIGNED_BYTE: for (i = 0 ; i < count ; i++) CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte *)indices)[i] )); break; case GL_UNSIGNED_SHORT: for (i = 0 ; i < count ; i++) CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort *)indices)[i] )); break; case GL_UNSIGNED_INT: for (i = 0 ; i < count ; i++) CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint *)indices)[i] )); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); break; } CALL_End(GET_DISPATCH(), ()); } void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); if (_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, type, indices )) CALL_DrawElements(GET_DISPATCH(), (mode, count, type, indices)); } /* * Eval Mesh */ /* KW: If are compiling, we don't know whether eval will produce a * vertex when it is run in the future. If this is pure immediate * mode, eval is a noop if neither vertex map is enabled. * * Thus we need to have a check in the display list code or * elsewhere for eval(1,2) vertices in the case where * map(1,2)_vertex is disabled, and to purge those vertices from * the vb. */ void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) { GET_CURRENT_CONTEXT(ctx); GLint i; GLfloat u, du; GLenum prim; switch (mode) { case GL_POINT: prim = GL_POINTS; break; case GL_LINE: prim = GL_LINE_STRIP; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh1(mode)" ); return; } /* No effect if vertex maps disabled. */ if (!ctx->Eval.Map1Vertex4 && !ctx->Eval.Map1Vertex3 && !(ctx->VertexProgram._Enabled && ctx->Eval.Map1Attrib[VERT_ATTRIB_POS])) return; du = ctx->Eval.MapGrid1du; u = ctx->Eval.MapGrid1u1 + i1 * du; CALL_Begin(GET_DISPATCH(), (prim)); for (i=i1;i<=i2;i++,u+=du) { CALL_EvalCoord1f(GET_DISPATCH(), (u)); } CALL_End(GET_DISPATCH(), ()); } void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) { GET_CURRENT_CONTEXT(ctx); GLfloat u, du, v, dv, v1, u1; GLint i, j; switch (mode) { case GL_POINT: case GL_LINE: case GL_FILL: break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh2(mode)" ); return; } /* No effect if vertex maps disabled. */ if (!ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3 && !(ctx->VertexProgram._Enabled && ctx->Eval.Map2Attrib[VERT_ATTRIB_POS])) return; du = ctx->Eval.MapGrid2du; dv = ctx->Eval.MapGrid2dv; v1 = ctx->Eval.MapGrid2v1 + j1 * dv; u1 = ctx->Eval.MapGrid2u1 + i1 * du; switch (mode) { case GL_POINT: CALL_Begin(GET_DISPATCH(), (GL_POINTS)); for (v=v1,j=j1;j<=j2;j++,v+=dv) { for (u=u1,i=i1;i<=i2;i++,u+=du) { CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); } } CALL_End(GET_DISPATCH(), ()); break; case GL_LINE: for (v=v1,j=j1;j<=j2;j++,v+=dv) { CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP)); for (u=u1,i=i1;i<=i2;i++,u+=du) { CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); } CALL_End(GET_DISPATCH(), ()); } for (u=u1,i=i1;i<=i2;i++,u+=du) { CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP)); for (v=v1,j=j1;j<=j2;j++,v+=dv) { CALL_EvalCoord2f(GET_DISPATCH(), (u, v)); } CALL_End(GET_DISPATCH(), ()); } break; case GL_FILL: for (v=v1,j=j1;jArrayElement = _ae_loopback_array_elt; /* generic helper */ vfmt->Begin = _mesa_noop_Begin; vfmt->CallList = _mesa_CallList; vfmt->CallLists = _mesa_CallLists; vfmt->Color3f = _mesa_noop_Color3f; vfmt->Color3fv = _mesa_noop_Color3fv; vfmt->Color4f = _mesa_noop_Color4f; vfmt->Color4fv = _mesa_noop_Color4fv; vfmt->EdgeFlag = _mesa_noop_EdgeFlag; vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv; vfmt->End = _mesa_noop_End; vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f; vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv; vfmt->EvalCoord2f = _mesa_noop_EvalCoord2f; vfmt->EvalCoord2fv = _mesa_noop_EvalCoord2fv; vfmt->EvalPoint1 = _mesa_noop_EvalPoint1; vfmt->EvalPoint2 = _mesa_noop_EvalPoint2; vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT; vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT; vfmt->Indexf = _mesa_noop_Indexf; vfmt->Indexfv = _mesa_noop_Indexfv; vfmt->Materialfv = _mesa_noop_Materialfv; vfmt->MultiTexCoord1fARB = _mesa_noop_MultiTexCoord1fARB; vfmt->MultiTexCoord1fvARB = _mesa_noop_MultiTexCoord1fvARB; vfmt->MultiTexCoord2fARB = _mesa_noop_MultiTexCoord2fARB; vfmt->MultiTexCoord2fvARB = _mesa_noop_MultiTexCoord2fvARB; vfmt->MultiTexCoord3fARB = _mesa_noop_MultiTexCoord3fARB; vfmt->MultiTexCoord3fvARB = _mesa_noop_MultiTexCoord3fvARB; vfmt->MultiTexCoord4fARB = _mesa_noop_MultiTexCoord4fARB; vfmt->MultiTexCoord4fvARB = _mesa_noop_MultiTexCoord4fvARB; vfmt->Normal3f = _mesa_noop_Normal3f; vfmt->Normal3fv = _mesa_noop_Normal3fv; vfmt->SecondaryColor3fEXT = _mesa_noop_SecondaryColor3fEXT; vfmt->SecondaryColor3fvEXT = _mesa_noop_SecondaryColor3fvEXT; vfmt->TexCoord1f = _mesa_noop_TexCoord1f; vfmt->TexCoord1fv = _mesa_noop_TexCoord1fv; vfmt->TexCoord2f = _mesa_noop_TexCoord2f; vfmt->TexCoord2fv = _mesa_noop_TexCoord2fv; vfmt->TexCoord3f = _mesa_noop_TexCoord3f; vfmt->TexCoord3fv = _mesa_noop_TexCoord3fv; vfmt->TexCoord4f = _mesa_noop_TexCoord4f; vfmt->TexCoord4fv = _mesa_noop_TexCoord4fv; vfmt->Vertex2f = _mesa_noop_Vertex2f; vfmt->Vertex2fv = _mesa_noop_Vertex2fv; vfmt->Vertex3f = _mesa_noop_Vertex3f; vfmt->Vertex3fv = _mesa_noop_Vertex3fv; vfmt->Vertex4f = _mesa_noop_Vertex4f; vfmt->Vertex4fv = _mesa_noop_Vertex4fv; vfmt->VertexAttrib1fNV = _mesa_noop_VertexAttrib1fNV; vfmt->VertexAttrib1fvNV = _mesa_noop_VertexAttrib1fvNV; vfmt->VertexAttrib2fNV = _mesa_noop_VertexAttrib2fNV; vfmt->VertexAttrib2fvNV = _mesa_noop_VertexAttrib2fvNV; vfmt->VertexAttrib3fNV = _mesa_noop_VertexAttrib3fNV; vfmt->VertexAttrib3fvNV = _mesa_noop_VertexAttrib3fvNV; vfmt->VertexAttrib4fNV = _mesa_noop_VertexAttrib4fNV; vfmt->VertexAttrib4fvNV = _mesa_noop_VertexAttrib4fvNV; vfmt->VertexAttrib1fARB = _mesa_noop_VertexAttrib1fARB; vfmt->VertexAttrib1fvARB = _mesa_noop_VertexAttrib1fvARB; vfmt->VertexAttrib2fARB = _mesa_noop_VertexAttrib2fARB; vfmt->VertexAttrib2fvARB = _mesa_noop_VertexAttrib2fvARB; vfmt->VertexAttrib3fARB = _mesa_noop_VertexAttrib3fARB; vfmt->VertexAttrib3fvARB = _mesa_noop_VertexAttrib3fvARB; vfmt->VertexAttrib4fARB = _mesa_noop_VertexAttrib4fARB; vfmt->VertexAttrib4fvARB = _mesa_noop_VertexAttrib4fvARB; vfmt->Rectf = _mesa_noop_Rectf; vfmt->DrawArrays = _mesa_noop_DrawArrays; vfmt->DrawElements = _mesa_noop_DrawElements; vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements; vfmt->EvalMesh1 = _mesa_noop_EvalMesh1; vfmt->EvalMesh2 = _mesa_noop_EvalMesh2; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/api_noop.h0000644000000000000000000001710613614532424020123 0ustar /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _API_NOOP_H #define _API_NOOP_H #include "glheader.h" #include "mtypes.h" #include "context.h" /* In states where certain vertex components are required for t&l or * rasterization, we still need to keep track of the current values. * These functions provide this service by keeping uptodate the * 'ctx->Current' struct for all data elements not included in the * currently enabled hardware vertex. * */ extern void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b ); extern void GLAPIENTRY _mesa_noop_EdgeFlagv( const GLboolean *b ); extern void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a ); extern void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_Indexf( GLfloat i ); extern void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c ); extern void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *param ); extern void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d ); extern void _mesa_noop_Color4ubv( const GLubyte *v ); extern void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ); extern void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v ); extern void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c ); extern void _mesa_noop_Color3ubv( const GLubyte *v ); extern void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c ); extern void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a ); extern void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b ); extern void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c); extern void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c, GLfloat d ); extern void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c ); extern void GLAPIENTRY _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v ); extern void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c ); extern void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a ); extern void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ); extern void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ); extern void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ); extern void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_Vertex2f( GLfloat a, GLfloat b ); extern void GLAPIENTRY _mesa_noop_Vertex2fv( const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c ); extern void GLAPIENTRY _mesa_noop_Vertex3fv( const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ); extern void GLAPIENTRY _mesa_noop_Vertex4fv( const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x ); extern void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ); extern void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z ); extern void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); extern void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x ); extern void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y ); extern void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z ); extern void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); extern void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_End( void ); extern void GLAPIENTRY _mesa_noop_Begin( GLenum mode ); extern void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b ); extern void GLAPIENTRY _mesa_noop_EvalPoint1( GLint a ); extern void GLAPIENTRY _mesa_noop_EvalCoord2fv( const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b ); extern void GLAPIENTRY _mesa_noop_EvalCoord1fv( const GLfloat *v ); extern void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a ); extern void _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ); extern void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); extern void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 ); /* Not strictly a noop -- translate Rectf down to Begin/End and * vertices. Closer to the loopback operations, but doesn't meet the * criteria for inclusion there (cannot be used in the Save table). */ extern void GLAPIENTRY _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); extern void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count); extern void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); extern void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/api_validate.c0000644000000000000000000001566313614532424020742 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "api_validate.h" #include "context.h" #include "imports.h" #include "mtypes.h" #include "state.h" GLboolean _mesa_validate_DrawElements(GLcontext *ctx, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (count <= 0) { if (count < 0) _mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" ); return GL_FALSE; } if (mode > GL_POLYGON) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(mode)" ); return GL_FALSE; } if (type != GL_UNSIGNED_INT && type != GL_UNSIGNED_BYTE && type != GL_UNSIGNED_SHORT) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); return GL_FALSE; } if (ctx->NewState) _mesa_update_state(ctx); /* Always need vertex positions */ if (!ctx->Array.Vertex.Enabled && !(ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled)) return GL_FALSE; /* Vertex buffer object tests */ if (ctx->Array.ElementArrayBufferObj->Name) { GLuint indexBytes; /* use indices in the buffer object */ if (!ctx->Array.ElementArrayBufferObj->Data) { _mesa_warning(ctx, "DrawElements with empty vertex elements buffer!"); return GL_FALSE; } /* make sure count doesn't go outside buffer bounds */ if (type == GL_UNSIGNED_INT) { indexBytes = count * sizeof(GLuint); } else if (type == GL_UNSIGNED_BYTE) { indexBytes = count * sizeof(GLubyte); } else { ASSERT(type == GL_UNSIGNED_SHORT); indexBytes = count * sizeof(GLushort); } if ((GLubyte *) indices + indexBytes > ctx->Array.ElementArrayBufferObj->Data + ctx->Array.ElementArrayBufferObj->Size) { _mesa_warning(ctx, "glDrawElements index out of buffer bounds"); return GL_FALSE; } /* Actual address is the sum of pointers. Indices may be used below. */ if (ctx->Const.CheckArrayBounds) { indices = (const GLvoid *) ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data, (const GLubyte *) indices); } } if (ctx->Const.CheckArrayBounds) { /* find max array index */ GLuint max = 0; GLint i; if (type == GL_UNSIGNED_INT) { for (i = 0; i < count; i++) if (((GLuint *) indices)[i] > max) max = ((GLuint *) indices)[i]; } else if (type == GL_UNSIGNED_SHORT) { for (i = 0; i < count; i++) if (((GLushort *) indices)[i] > max) max = ((GLushort *) indices)[i]; } else { ASSERT(type == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) if (((GLubyte *) indices)[i] > max) max = ((GLubyte *) indices)[i]; } if (max >= ctx->Array._MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ return GL_FALSE; } } return GL_TRUE; } GLboolean _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) { ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (count <= 0) { if (count < 0) _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" ); return GL_FALSE; } if (mode > GL_POLYGON) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(mode)" ); return GL_FALSE; } if (end < start) { _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(endNewState) _mesa_update_state(ctx); /* Always need vertex positions */ if (!ctx->Array.Vertex.Enabled && !(ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled)) return GL_FALSE; if (ctx->Const.CheckArrayBounds) { /* Find max array index. * We don't trust the user's start and end values. */ GLuint max = 0; GLint i; if (type == GL_UNSIGNED_INT) { for (i = 0; i < count; i++) if (((GLuint *) indices)[i] > max) max = ((GLuint *) indices)[i]; } else if (type == GL_UNSIGNED_SHORT) { for (i = 0; i < count; i++) if (((GLushort *) indices)[i] > max) max = ((GLushort *) indices)[i]; } else { ASSERT(type == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) if (((GLubyte *) indices)[i] > max) max = ((GLubyte *) indices)[i]; } if (max >= ctx->Array._MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ return GL_FALSE; } } return GL_TRUE; } /** * Called from the tnl module to error check the function parameters and * verify that we really can draw something. */ GLboolean _mesa_validate_DrawArrays(GLcontext *ctx, GLenum mode, GLint start, GLsizei count) { ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (count < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" ); return GL_FALSE; } if (mode > GL_POLYGON) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); return GL_FALSE; } if (ctx->NewState) _mesa_update_state(ctx); /* Always need vertex positions */ if (!ctx->Array.Vertex.Enabled && !ctx->Array.VertexAttrib[0].Enabled) return GL_FALSE; if (ctx->Const.CheckArrayBounds) { if (start + count > (GLint) ctx->Array._MaxElement) return GL_FALSE; } return GL_TRUE; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/api_validate.h0000644000000000000000000000320613614532424020735 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef API_VALIDATE_H #define API_VALIDATE_H #include "mtypes.h" extern GLboolean _mesa_validate_DrawArrays(GLcontext *ctx, GLenum mode, GLint start, GLsizei count); extern GLboolean _mesa_validate_DrawElements(GLcontext *ctx, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); extern GLboolean _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/attrib.c0000644000000000000000000015424013614532424017600 0ustar /* * Mesa 3-D graphics library * Version: 6.4.1 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "imports.h" #include "accum.h" #include "attrib.h" #include "blend.h" #include "buffers.h" #include "bufferobj.h" #include "colormac.h" #include "colortab.h" #include "context.h" #include "depth.h" #include "enable.h" #include "enums.h" #include "fog.h" #include "hint.h" #include "light.h" #include "lines.h" #include "matrix.h" #include "points.h" #include "polygon.h" #include "simple_list.h" #include "stencil.h" #include "texobj.h" #include "texstate.h" #include "mtypes.h" #include "math/m_xform.h" /* * Allocate a new attribute state node. These nodes have a * "kind" value and a pointer to a struct of state data. */ static struct gl_attrib_node * new_attrib_node( GLbitfield kind ) { struct gl_attrib_node *an = MALLOC_STRUCT(gl_attrib_node); if (an) { an->kind = kind; } return an; } void GLAPIENTRY _mesa_PushAttrib(GLbitfield mask) { struct gl_attrib_node *newnode; struct gl_attrib_node *head; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glPushAttrib %x\n", (int) mask); if (ctx->AttribStackDepth >= MAX_ATTRIB_STACK_DEPTH) { _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushAttrib" ); return; } /* Build linked list of attribute nodes which save all attribute */ /* groups specified by the mask. */ head = NULL; if (mask & GL_ACCUM_BUFFER_BIT) { struct gl_accum_attrib *attr; attr = MALLOC_STRUCT( gl_accum_attrib ); MEMCPY( attr, &ctx->Accum, sizeof(struct gl_accum_attrib) ); newnode = new_attrib_node( GL_ACCUM_BUFFER_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_COLOR_BUFFER_BIT) { struct gl_colorbuffer_attrib *attr; attr = MALLOC_STRUCT( gl_colorbuffer_attrib ); MEMCPY( attr, &ctx->Color, sizeof(struct gl_colorbuffer_attrib) ); newnode = new_attrib_node( GL_COLOR_BUFFER_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_CURRENT_BIT) { struct gl_current_attrib *attr; FLUSH_CURRENT( ctx, 0 ); attr = MALLOC_STRUCT( gl_current_attrib ); MEMCPY( attr, &ctx->Current, sizeof(struct gl_current_attrib) ); newnode = new_attrib_node( GL_CURRENT_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_DEPTH_BUFFER_BIT) { struct gl_depthbuffer_attrib *attr; attr = MALLOC_STRUCT( gl_depthbuffer_attrib ); MEMCPY( attr, &ctx->Depth, sizeof(struct gl_depthbuffer_attrib) ); newnode = new_attrib_node( GL_DEPTH_BUFFER_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_ENABLE_BIT) { struct gl_enable_attrib *attr; GLuint i; attr = MALLOC_STRUCT( gl_enable_attrib ); /* Copy enable flags from all other attributes into the enable struct. */ attr->AlphaTest = ctx->Color.AlphaEnabled; attr->AutoNormal = ctx->Eval.AutoNormal; attr->Blend = ctx->Color.BlendEnabled; attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled; attr->ColorMaterial = ctx->Light.ColorMaterialEnabled; attr->ColorTable = ctx->Pixel.ColorTableEnabled; attr->PostColorMatrixColorTable = ctx->Pixel.PostColorMatrixColorTableEnabled; attr->PostConvolutionColorTable = ctx->Pixel.PostConvolutionColorTableEnabled; attr->Convolution1D = ctx->Pixel.Convolution1DEnabled; attr->Convolution2D = ctx->Pixel.Convolution2DEnabled; attr->Separable2D = ctx->Pixel.Separable2DEnabled; attr->CullFace = ctx->Polygon.CullFlag; attr->DepthTest = ctx->Depth.Test; attr->Dither = ctx->Color.DitherFlag; attr->Fog = ctx->Fog.Enabled; for (i=0;iLight[i] = ctx->Light.Light[i].Enabled; } attr->Lighting = ctx->Light.Enabled; attr->LineSmooth = ctx->Line.SmoothFlag; attr->LineStipple = ctx->Line.StippleFlag; attr->Histogram = ctx->Pixel.HistogramEnabled; attr->MinMax = ctx->Pixel.MinMaxEnabled; attr->IndexLogicOp = ctx->Color.IndexLogicOpEnabled; attr->ColorLogicOp = ctx->Color.ColorLogicOpEnabled; attr->Map1Color4 = ctx->Eval.Map1Color4; attr->Map1Index = ctx->Eval.Map1Index; attr->Map1Normal = ctx->Eval.Map1Normal; attr->Map1TextureCoord1 = ctx->Eval.Map1TextureCoord1; attr->Map1TextureCoord2 = ctx->Eval.Map1TextureCoord2; attr->Map1TextureCoord3 = ctx->Eval.Map1TextureCoord3; attr->Map1TextureCoord4 = ctx->Eval.Map1TextureCoord4; attr->Map1Vertex3 = ctx->Eval.Map1Vertex3; attr->Map1Vertex4 = ctx->Eval.Map1Vertex4; MEMCPY(attr->Map1Attrib, ctx->Eval.Map1Attrib, sizeof(ctx->Eval.Map1Attrib)); attr->Map2Color4 = ctx->Eval.Map2Color4; attr->Map2Index = ctx->Eval.Map2Index; attr->Map2Normal = ctx->Eval.Map2Normal; attr->Map2TextureCoord1 = ctx->Eval.Map2TextureCoord1; attr->Map2TextureCoord2 = ctx->Eval.Map2TextureCoord2; attr->Map2TextureCoord3 = ctx->Eval.Map2TextureCoord3; attr->Map2TextureCoord4 = ctx->Eval.Map2TextureCoord4; attr->Map2Vertex3 = ctx->Eval.Map2Vertex3; attr->Map2Vertex4 = ctx->Eval.Map2Vertex4; MEMCPY(attr->Map2Attrib, ctx->Eval.Map2Attrib, sizeof(ctx->Eval.Map2Attrib)); attr->Normalize = ctx->Transform.Normalize; attr->RasterPositionUnclipped = ctx->Transform.RasterPositionUnclipped; attr->PixelTexture = ctx->Pixel.PixelTextureEnabled; attr->PointSmooth = ctx->Point.SmoothFlag; attr->PointSprite = ctx->Point.PointSprite; attr->PolygonOffsetPoint = ctx->Polygon.OffsetPoint; attr->PolygonOffsetLine = ctx->Polygon.OffsetLine; attr->PolygonOffsetFill = ctx->Polygon.OffsetFill; attr->PolygonSmooth = ctx->Polygon.SmoothFlag; attr->PolygonStipple = ctx->Polygon.StippleFlag; attr->RescaleNormals = ctx->Transform.RescaleNormals; attr->Scissor = ctx->Scissor.Enabled; attr->Stencil = ctx->Stencil.Enabled; attr->StencilTwoSide = ctx->Stencil.TestTwoSide; attr->MultisampleEnabled = ctx->Multisample.Enabled; attr->SampleAlphaToCoverage = ctx->Multisample.SampleAlphaToCoverage; attr->SampleAlphaToOne = ctx->Multisample.SampleAlphaToOne; attr->SampleCoverage = ctx->Multisample.SampleCoverage; attr->SampleCoverageInvert = ctx->Multisample.SampleCoverageInvert; for (i=0; iTexture[i] = ctx->Texture.Unit[i].Enabled; attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled; attr->TextureColorTable[i] = ctx->Texture.Unit[i].ColorTableEnabled; } /* GL_NV_vertex_program */ attr->VertexProgram = ctx->VertexProgram.Enabled; attr->VertexProgramPointSize = ctx->VertexProgram.PointSizeEnabled; attr->VertexProgramTwoSide = ctx->VertexProgram.TwoSideEnabled; newnode = new_attrib_node( GL_ENABLE_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_EVAL_BIT) { struct gl_eval_attrib *attr; attr = MALLOC_STRUCT( gl_eval_attrib ); MEMCPY( attr, &ctx->Eval, sizeof(struct gl_eval_attrib) ); newnode = new_attrib_node( GL_EVAL_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_FOG_BIT) { struct gl_fog_attrib *attr; attr = MALLOC_STRUCT( gl_fog_attrib ); MEMCPY( attr, &ctx->Fog, sizeof(struct gl_fog_attrib) ); newnode = new_attrib_node( GL_FOG_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_HINT_BIT) { struct gl_hint_attrib *attr; attr = MALLOC_STRUCT( gl_hint_attrib ); MEMCPY( attr, &ctx->Hint, sizeof(struct gl_hint_attrib) ); newnode = new_attrib_node( GL_HINT_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_LIGHTING_BIT) { struct gl_light_attrib *attr; FLUSH_CURRENT(ctx, 0); /* flush material changes */ attr = MALLOC_STRUCT( gl_light_attrib ); MEMCPY( attr, &ctx->Light, sizeof(struct gl_light_attrib) ); newnode = new_attrib_node( GL_LIGHTING_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_LINE_BIT) { struct gl_line_attrib *attr; attr = MALLOC_STRUCT( gl_line_attrib ); MEMCPY( attr, &ctx->Line, sizeof(struct gl_line_attrib) ); newnode = new_attrib_node( GL_LINE_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_LIST_BIT) { struct gl_list_attrib *attr; attr = MALLOC_STRUCT( gl_list_attrib ); MEMCPY( attr, &ctx->List, sizeof(struct gl_list_attrib) ); newnode = new_attrib_node( GL_LIST_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_PIXEL_MODE_BIT) { struct gl_pixel_attrib *attr; attr = MALLOC_STRUCT( gl_pixel_attrib ); MEMCPY( attr, &ctx->Pixel, sizeof(struct gl_pixel_attrib) ); newnode = new_attrib_node( GL_PIXEL_MODE_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_POINT_BIT) { struct gl_point_attrib *attr; attr = MALLOC_STRUCT( gl_point_attrib ); MEMCPY( attr, &ctx->Point, sizeof(struct gl_point_attrib) ); newnode = new_attrib_node( GL_POINT_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_POLYGON_BIT) { struct gl_polygon_attrib *attr; attr = MALLOC_STRUCT( gl_polygon_attrib ); MEMCPY( attr, &ctx->Polygon, sizeof(struct gl_polygon_attrib) ); newnode = new_attrib_node( GL_POLYGON_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_POLYGON_STIPPLE_BIT) { GLuint *stipple; stipple = (GLuint *) MALLOC( 32*sizeof(GLuint) ); MEMCPY( stipple, ctx->PolygonStipple, 32*sizeof(GLuint) ); newnode = new_attrib_node( GL_POLYGON_STIPPLE_BIT ); newnode->data = stipple; newnode->next = head; head = newnode; } if (mask & GL_SCISSOR_BIT) { struct gl_scissor_attrib *attr; attr = MALLOC_STRUCT( gl_scissor_attrib ); MEMCPY( attr, &ctx->Scissor, sizeof(struct gl_scissor_attrib) ); newnode = new_attrib_node( GL_SCISSOR_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_STENCIL_BUFFER_BIT) { struct gl_stencil_attrib *attr; attr = MALLOC_STRUCT( gl_stencil_attrib ); MEMCPY( attr, &ctx->Stencil, sizeof(struct gl_stencil_attrib) ); newnode = new_attrib_node( GL_STENCIL_BUFFER_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_TEXTURE_BIT) { struct gl_texture_attrib *attr; GLuint u; /* Bump the texture object reference counts so that they don't * inadvertantly get deleted. */ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { ctx->Texture.Unit[u].Current1D->RefCount++; ctx->Texture.Unit[u].Current2D->RefCount++; ctx->Texture.Unit[u].Current3D->RefCount++; ctx->Texture.Unit[u].CurrentCubeMap->RefCount++; ctx->Texture.Unit[u].CurrentRect->RefCount++; } attr = MALLOC_STRUCT( gl_texture_attrib ); MEMCPY( attr, &ctx->Texture, sizeof(struct gl_texture_attrib) ); /* copy state of the currently bound texture objects */ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { _mesa_copy_texture_object(&attr->Unit[u].Saved1D, attr->Unit[u].Current1D); _mesa_copy_texture_object(&attr->Unit[u].Saved2D, attr->Unit[u].Current2D); _mesa_copy_texture_object(&attr->Unit[u].Saved3D, attr->Unit[u].Current3D); _mesa_copy_texture_object(&attr->Unit[u].SavedCubeMap, attr->Unit[u].CurrentCubeMap); _mesa_copy_texture_object(&attr->Unit[u].SavedRect, attr->Unit[u].CurrentRect); } newnode = new_attrib_node( GL_TEXTURE_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_TRANSFORM_BIT) { struct gl_transform_attrib *attr; attr = MALLOC_STRUCT( gl_transform_attrib ); MEMCPY( attr, &ctx->Transform, sizeof(struct gl_transform_attrib) ); newnode = new_attrib_node( GL_TRANSFORM_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_VIEWPORT_BIT) { struct gl_viewport_attrib *attr; attr = MALLOC_STRUCT( gl_viewport_attrib ); MEMCPY( attr, &ctx->Viewport, sizeof(struct gl_viewport_attrib) ); newnode = new_attrib_node( GL_VIEWPORT_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } /* GL_ARB_multisample */ if (mask & GL_MULTISAMPLE_BIT_ARB) { struct gl_multisample_attrib *attr; attr = MALLOC_STRUCT( gl_multisample_attrib ); MEMCPY( attr, &ctx->Multisample, sizeof(struct gl_multisample_attrib) ); newnode = new_attrib_node( GL_MULTISAMPLE_BIT_ARB ); newnode->data = attr; newnode->next = head; head = newnode; } ctx->AttribStack[ctx->AttribStackDepth] = head; ctx->AttribStackDepth++; } static void pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) { GLuint i; #define TEST_AND_UPDATE(VALUE, NEWVALUE, ENUM) \ if ((VALUE) != (NEWVALUE)) { \ _mesa_set_enable( ctx, ENUM, (NEWVALUE) ); \ } TEST_AND_UPDATE(ctx->Color.AlphaEnabled, enable->AlphaTest, GL_ALPHA_TEST); TEST_AND_UPDATE(ctx->Color.BlendEnabled, enable->Blend, GL_BLEND); for (i=0;iTransform.ClipPlanesEnabled & mask) != (enable->ClipPlanes & mask)) _mesa_set_enable(ctx, (GLenum) (GL_CLIP_PLANE0 + i), (GLboolean) ((enable->ClipPlanes & mask) ? GL_TRUE : GL_FALSE)); } TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial, GL_COLOR_MATERIAL); TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled, enable->ColorTable, GL_COLOR_TABLE); TEST_AND_UPDATE(ctx->Pixel.PostColorMatrixColorTableEnabled, enable->PostColorMatrixColorTable, GL_POST_COLOR_MATRIX_COLOR_TABLE); TEST_AND_UPDATE(ctx->Pixel.PostConvolutionColorTableEnabled, enable->PostConvolutionColorTable, GL_POST_CONVOLUTION_COLOR_TABLE); TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE); TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST); TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER); TEST_AND_UPDATE(ctx->Pixel.Convolution1DEnabled, enable->Convolution1D, GL_CONVOLUTION_1D); TEST_AND_UPDATE(ctx->Pixel.Convolution2DEnabled, enable->Convolution2D, GL_CONVOLUTION_2D); TEST_AND_UPDATE(ctx->Pixel.Separable2DEnabled, enable->Separable2D, GL_SEPARABLE_2D); TEST_AND_UPDATE(ctx->Fog.Enabled, enable->Fog, GL_FOG); TEST_AND_UPDATE(ctx->Light.Enabled, enable->Lighting, GL_LIGHTING); TEST_AND_UPDATE(ctx->Line.SmoothFlag, enable->LineSmooth, GL_LINE_SMOOTH); TEST_AND_UPDATE(ctx->Line.StippleFlag, enable->LineStipple, GL_LINE_STIPPLE); TEST_AND_UPDATE(ctx->Color.IndexLogicOpEnabled, enable->IndexLogicOp, GL_INDEX_LOGIC_OP); TEST_AND_UPDATE(ctx->Color.ColorLogicOpEnabled, enable->ColorLogicOp, GL_COLOR_LOGIC_OP); TEST_AND_UPDATE(ctx->Eval.Map1Color4, enable->Map1Color4, GL_MAP1_COLOR_4); TEST_AND_UPDATE(ctx->Eval.Map1Index, enable->Map1Index, GL_MAP1_INDEX); TEST_AND_UPDATE(ctx->Eval.Map1Normal, enable->Map1Normal, GL_MAP1_NORMAL); TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord1, enable->Map1TextureCoord1, GL_MAP1_TEXTURE_COORD_1); TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord2, enable->Map1TextureCoord2, GL_MAP1_TEXTURE_COORD_2); TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord3, enable->Map1TextureCoord3, GL_MAP1_TEXTURE_COORD_3); TEST_AND_UPDATE(ctx->Eval.Map1TextureCoord4, enable->Map1TextureCoord4, GL_MAP1_TEXTURE_COORD_4); TEST_AND_UPDATE(ctx->Eval.Map1Vertex3, enable->Map1Vertex3, GL_MAP1_VERTEX_3); TEST_AND_UPDATE(ctx->Eval.Map1Vertex4, enable->Map1Vertex4, GL_MAP1_VERTEX_4); for (i = 0; i < 16; i++) { TEST_AND_UPDATE(ctx->Eval.Map1Attrib[i], enable->Map1Attrib[i], GL_MAP1_VERTEX_ATTRIB0_4_NV + i); } TEST_AND_UPDATE(ctx->Eval.Map2Color4, enable->Map2Color4, GL_MAP2_COLOR_4); TEST_AND_UPDATE(ctx->Eval.Map2Index, enable->Map2Index, GL_MAP2_INDEX); TEST_AND_UPDATE(ctx->Eval.Map2Normal, enable->Map2Normal, GL_MAP2_NORMAL); TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord1, enable->Map2TextureCoord1, GL_MAP2_TEXTURE_COORD_1); TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord2, enable->Map2TextureCoord2, GL_MAP2_TEXTURE_COORD_2); TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord3, enable->Map2TextureCoord3, GL_MAP2_TEXTURE_COORD_3); TEST_AND_UPDATE(ctx->Eval.Map2TextureCoord4, enable->Map2TextureCoord4, GL_MAP2_TEXTURE_COORD_4); TEST_AND_UPDATE(ctx->Eval.Map2Vertex3, enable->Map2Vertex3, GL_MAP2_VERTEX_3); TEST_AND_UPDATE(ctx->Eval.Map2Vertex4, enable->Map2Vertex4, GL_MAP2_VERTEX_4); for (i = 0; i < 16; i++) { TEST_AND_UPDATE(ctx->Eval.Map2Attrib[i], enable->Map2Attrib[i], GL_MAP2_VERTEX_ATTRIB0_4_NV + i); } TEST_AND_UPDATE(ctx->Eval.AutoNormal, enable->AutoNormal, GL_AUTO_NORMAL); TEST_AND_UPDATE(ctx->Transform.Normalize, enable->Normalize, GL_NORMALIZE); TEST_AND_UPDATE(ctx->Transform.RescaleNormals, enable->RescaleNormals, GL_RESCALE_NORMAL_EXT); TEST_AND_UPDATE(ctx->Transform.RasterPositionUnclipped, enable->RasterPositionUnclipped, GL_RASTER_POSITION_UNCLIPPED_IBM); TEST_AND_UPDATE(ctx->Pixel.PixelTextureEnabled, enable->PixelTexture, GL_POINT_SMOOTH); TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth, GL_POINT_SMOOTH); if (ctx->Extensions.NV_point_sprite || ctx->Extensions.ARB_point_sprite) { TEST_AND_UPDATE(ctx->Point.PointSprite, enable->PointSprite, GL_POINT_SPRITE_NV); } TEST_AND_UPDATE(ctx->Polygon.OffsetPoint, enable->PolygonOffsetPoint, GL_POLYGON_OFFSET_POINT); TEST_AND_UPDATE(ctx->Polygon.OffsetLine, enable->PolygonOffsetLine, GL_POLYGON_OFFSET_LINE); TEST_AND_UPDATE(ctx->Polygon.OffsetFill, enable->PolygonOffsetFill, GL_POLYGON_OFFSET_FILL); TEST_AND_UPDATE(ctx->Polygon.SmoothFlag, enable->PolygonSmooth, GL_POLYGON_SMOOTH); TEST_AND_UPDATE(ctx->Polygon.StippleFlag, enable->PolygonStipple, GL_POLYGON_STIPPLE); TEST_AND_UPDATE(ctx->Scissor.Enabled, enable->Scissor, GL_SCISSOR_TEST); TEST_AND_UPDATE(ctx->Stencil.Enabled, enable->Stencil, GL_STENCIL_TEST); if (ctx->Extensions.EXT_stencil_two_side) { TEST_AND_UPDATE(ctx->Stencil.TestTwoSide, enable->StencilTwoSide, GL_STENCIL_TEST_TWO_SIDE_EXT); } TEST_AND_UPDATE(ctx->Multisample.Enabled, enable->MultisampleEnabled, GL_MULTISAMPLE_ARB); TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToCoverage, enable->SampleAlphaToCoverage, GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToOne, enable->SampleAlphaToOne, GL_SAMPLE_ALPHA_TO_ONE_ARB); TEST_AND_UPDATE(ctx->Multisample.SampleCoverage, enable->SampleCoverage, GL_SAMPLE_COVERAGE_ARB); TEST_AND_UPDATE(ctx->Multisample.SampleCoverageInvert, enable->SampleCoverageInvert, GL_SAMPLE_COVERAGE_INVERT_ARB); /* GL_NV_vertex_program */ TEST_AND_UPDATE(ctx->VertexProgram.Enabled, enable->VertexProgram, GL_VERTEX_PROGRAM_NV); TEST_AND_UPDATE(ctx->VertexProgram.PointSizeEnabled, enable->VertexProgramPointSize, GL_VERTEX_PROGRAM_POINT_SIZE_NV); TEST_AND_UPDATE(ctx->VertexProgram.TwoSideEnabled, enable->VertexProgramTwoSide, GL_VERTEX_PROGRAM_TWO_SIDE_NV); #undef TEST_AND_UPDATE /* texture unit enables */ for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (ctx->Texture.Unit[i].Enabled != enable->Texture[i]) { ctx->Texture.Unit[i].Enabled = enable->Texture[i]; if (ctx->Driver.Enable) { if (ctx->Driver.ActiveTexture) { (*ctx->Driver.ActiveTexture)(ctx, i); } (*ctx->Driver.Enable)( ctx, GL_TEXTURE_1D, (GLboolean) (enable->Texture[i] & TEXTURE_1D_BIT) ); (*ctx->Driver.Enable)( ctx, GL_TEXTURE_2D, (GLboolean) (enable->Texture[i] & TEXTURE_2D_BIT) ); (*ctx->Driver.Enable)( ctx, GL_TEXTURE_3D, (GLboolean) (enable->Texture[i] & TEXTURE_3D_BIT) ); if (ctx->Extensions.ARB_texture_cube_map) (*ctx->Driver.Enable)( ctx, GL_TEXTURE_CUBE_MAP_ARB, (GLboolean) (enable->Texture[i] & TEXTURE_CUBE_BIT) ); if (ctx->Extensions.NV_texture_rectangle) (*ctx->Driver.Enable)( ctx, GL_TEXTURE_RECTANGLE_NV, (GLboolean) (enable->Texture[i] & TEXTURE_RECT_BIT) ); } } if (ctx->Texture.Unit[i].TexGenEnabled != enable->TexGen[i]) { ctx->Texture.Unit[i].TexGenEnabled = enable->TexGen[i]; if (ctx->Driver.Enable) { if (ctx->Driver.ActiveTexture) { (*ctx->Driver.ActiveTexture)(ctx, i); } if (enable->TexGen[i] & S_BIT) (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_S, GL_TRUE); else (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_S, GL_FALSE); if (enable->TexGen[i] & T_BIT) (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_T, GL_TRUE); else (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_T, GL_FALSE); if (enable->TexGen[i] & R_BIT) (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_R, GL_TRUE); else (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_R, GL_FALSE); if (enable->TexGen[i] & Q_BIT) (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_TRUE); else (*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_FALSE); } } /* GL_SGI_texture_color_table */ ctx->Texture.Unit[i].ColorTableEnabled = enable->TextureColorTable[i]; } if (ctx->Driver.ActiveTexture) { (*ctx->Driver.ActiveTexture)(ctx, ctx->Texture.CurrentUnit); } } static void pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) { GLuint u; for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { const struct gl_texture_unit *unit = &texAttrib->Unit[u]; GLuint i; _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + u); _mesa_set_enable(ctx, GL_TEXTURE_1D, (unit->Enabled & TEXTURE_1D_BIT) ? GL_TRUE : GL_FALSE); _mesa_set_enable(ctx, GL_TEXTURE_2D, (unit->Enabled & TEXTURE_2D_BIT) ? GL_TRUE : GL_FALSE); _mesa_set_enable(ctx, GL_TEXTURE_3D, (unit->Enabled & TEXTURE_3D_BIT) ? GL_TRUE : GL_FALSE); if (ctx->Extensions.ARB_texture_cube_map) { _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB, (unit->Enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE); } if (ctx->Extensions.NV_texture_rectangle) { _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_NV, (unit->Enabled & TEXTURE_RECT_BIT) ? GL_TRUE : GL_FALSE); } if (ctx->Extensions.SGI_texture_color_table) { _mesa_set_enable(ctx, GL_TEXTURE_COLOR_TABLE_SGI, unit->ColorTableEnabled); } _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode); _mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor); _mesa_TexGeni(GL_S, GL_TEXTURE_GEN_MODE, unit->GenModeS); _mesa_TexGeni(GL_T, GL_TEXTURE_GEN_MODE, unit->GenModeT); _mesa_TexGeni(GL_R, GL_TEXTURE_GEN_MODE, unit->GenModeR); _mesa_TexGeni(GL_Q, GL_TEXTURE_GEN_MODE, unit->GenModeQ); _mesa_TexGenfv(GL_S, GL_OBJECT_PLANE, unit->ObjectPlaneS); _mesa_TexGenfv(GL_T, GL_OBJECT_PLANE, unit->ObjectPlaneT); _mesa_TexGenfv(GL_R, GL_OBJECT_PLANE, unit->ObjectPlaneR); _mesa_TexGenfv(GL_Q, GL_OBJECT_PLANE, unit->ObjectPlaneQ); /* Eye plane done differently to avoid re-transformation */ { struct gl_texture_unit *destUnit = &ctx->Texture.Unit[u]; COPY_4FV(destUnit->EyePlaneS, unit->EyePlaneS); COPY_4FV(destUnit->EyePlaneT, unit->EyePlaneT); COPY_4FV(destUnit->EyePlaneR, unit->EyePlaneR); COPY_4FV(destUnit->EyePlaneQ, unit->EyePlaneQ); if (ctx->Driver.TexGen) { ctx->Driver.TexGen(ctx, GL_S, GL_EYE_PLANE, unit->EyePlaneS); ctx->Driver.TexGen(ctx, GL_T, GL_EYE_PLANE, unit->EyePlaneT); ctx->Driver.TexGen(ctx, GL_R, GL_EYE_PLANE, unit->EyePlaneR); ctx->Driver.TexGen(ctx, GL_Q, GL_EYE_PLANE, unit->EyePlaneQ); } } _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, ((unit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE)); _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, ((unit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE)); _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, ((unit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE)); _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, ((unit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE)); if (ctx->Extensions.EXT_texture_lod_bias) { _mesa_TexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, unit->LodBias); } if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { _mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, unit->Combine.ModeRGB); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, unit->Combine.ModeA); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, unit->Combine.SourceRGB[0]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, unit->Combine.SourceRGB[1]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, unit->Combine.SourceRGB[2]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, unit->Combine.SourceA[0]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, unit->Combine.SourceA[1]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA, unit->Combine.SourceA[2]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, unit->Combine.OperandRGB[0]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, unit->Combine.OperandRGB[1]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, unit->Combine.OperandRGB[2]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, unit->Combine.OperandA[0]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, unit->Combine.OperandA[1]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, unit->Combine.OperandA[2]); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, 1 << unit->Combine.ScaleShiftRGB); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE, 1 << unit->Combine.ScaleShiftA); } /* Restore texture object state */ for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { GLenum target = 0; const struct gl_texture_object *obj = NULL; GLfloat bordColor[4]; switch (i) { case 0: target = GL_TEXTURE_1D; obj = &unit->Saved1D; break; case 1: target = GL_TEXTURE_2D; obj = &unit->Saved2D; break; case 2: target = GL_TEXTURE_3D; obj = &unit->Saved3D; break; case 3: if (!ctx->Extensions.ARB_texture_cube_map) continue; target = GL_TEXTURE_CUBE_MAP_ARB; obj = &unit->SavedCubeMap; break; case 4: if (!ctx->Extensions.NV_texture_rectangle) continue; target = GL_TEXTURE_RECTANGLE_NV; obj = &unit->SavedRect; break; default: ; /* silence warnings */ } _mesa_BindTexture(target, obj->Name); bordColor[0] = CHAN_TO_FLOAT(obj->BorderColor[0]); bordColor[1] = CHAN_TO_FLOAT(obj->BorderColor[1]); bordColor[2] = CHAN_TO_FLOAT(obj->BorderColor[2]); bordColor[3] = CHAN_TO_FLOAT(obj->BorderColor[3]); _mesa_TexParameterf(target, GL_TEXTURE_PRIORITY, obj->Priority); _mesa_TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, bordColor); _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, obj->WrapS); _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, obj->WrapT); _mesa_TexParameteri(target, GL_TEXTURE_WRAP_R, obj->WrapR); _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, obj->MinFilter); _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, obj->MagFilter); _mesa_TexParameterf(target, GL_TEXTURE_MIN_LOD, obj->MinLod); _mesa_TexParameterf(target, GL_TEXTURE_MAX_LOD, obj->MaxLod); _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, obj->BaseLevel); _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, obj->MaxLevel); if (ctx->Extensions.EXT_texture_filter_anisotropic) { _mesa_TexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, obj->MaxAnisotropy); } if (ctx->Extensions.SGIX_shadow) { _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_SGIX, obj->CompareFlag); _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_OPERATOR_SGIX, obj->CompareOperator); } if (ctx->Extensions.SGIX_shadow_ambient) { _mesa_TexParameterf(target, GL_SHADOW_AMBIENT_SGIX, obj->ShadowAmbient); } } } _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + texAttrib->CurrentUnit); /* "un-bump" the texture object reference counts. We did that so they * wouldn't inadvertantly get deleted while they were still referenced * inside the attribute state stack. */ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { ctx->Texture.Unit[u].Current1D->RefCount--; ctx->Texture.Unit[u].Current2D->RefCount--; ctx->Texture.Unit[u].Current3D->RefCount--; ctx->Texture.Unit[u].CurrentCubeMap->RefCount--; ctx->Texture.Unit[u].CurrentRect->RefCount--; } } /* * This function is kind of long just because we have to call a lot * of device driver functions to update device driver state. * * XXX As it is now, most of the pop-code calls immediate-mode Mesa functions * in order to restore GL state. This isn't terribly efficient but it * ensures that dirty flags and any derived state gets updated correctly. * We could at least check if the value to restore equals the current value * and then skip the Mesa call. */ void GLAPIENTRY _mesa_PopAttrib(void) { struct gl_attrib_node *attr, *next; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->AttribStackDepth == 0) { _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopAttrib" ); return; } ctx->AttribStackDepth--; attr = ctx->AttribStack[ctx->AttribStackDepth]; while (attr) { if (MESA_VERBOSE & VERBOSE_API) { _mesa_debug(ctx, "glPopAttrib %s\n", _mesa_lookup_enum_by_nr(attr->kind)); } switch (attr->kind) { case GL_ACCUM_BUFFER_BIT: { const struct gl_accum_attrib *accum; accum = (const struct gl_accum_attrib *) attr->data; _mesa_ClearAccum(accum->ClearColor[0], accum->ClearColor[1], accum->ClearColor[2], accum->ClearColor[3]); } break; case GL_COLOR_BUFFER_BIT: { const struct gl_colorbuffer_attrib *color; color = (const struct gl_colorbuffer_attrib *) attr->data; _mesa_ClearIndex((GLfloat) color->ClearIndex); _mesa_ClearColor(color->ClearColor[0], color->ClearColor[1], color->ClearColor[2], color->ClearColor[3]); _mesa_IndexMask(color->IndexMask); _mesa_ColorMask((GLboolean) (color->ColorMask[0] != 0), (GLboolean) (color->ColorMask[1] != 0), (GLboolean) (color->ColorMask[2] != 0), (GLboolean) (color->ColorMask[3] != 0)); #if 0 _mesa_DrawBuffersARB(ctx->Const.MaxDrawBuffers, color->DrawBuffer); #else _mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers, color->DrawBuffer, NULL); #endif _mesa_set_enable(ctx, GL_ALPHA_TEST, color->AlphaEnabled); _mesa_AlphaFunc(color->AlphaFunc, color->AlphaRef); _mesa_set_enable(ctx, GL_BLEND, color->BlendEnabled); _mesa_BlendFuncSeparateEXT(color->BlendSrcRGB, color->BlendDstRGB, color->BlendSrcA, color->BlendDstA); /* This special case is because glBlendEquationSeparateEXT * cannot take GL_LOGIC_OP as a parameter. */ if ( color->BlendEquationRGB == color->BlendEquationA ) { _mesa_BlendEquation(color->BlendEquationRGB); } else { _mesa_BlendEquationSeparateEXT(color->BlendEquationRGB, color->BlendEquationA); } _mesa_BlendColor(color->BlendColor[0], color->BlendColor[1], color->BlendColor[2], color->BlendColor[3]); _mesa_LogicOp(color->LogicOp); _mesa_set_enable(ctx, GL_COLOR_LOGIC_OP, color->ColorLogicOpEnabled); _mesa_set_enable(ctx, GL_INDEX_LOGIC_OP, color->IndexLogicOpEnabled); _mesa_set_enable(ctx, GL_DITHER, color->DitherFlag); } break; case GL_CURRENT_BIT: FLUSH_CURRENT( ctx, 0 ); MEMCPY( &ctx->Current, attr->data, sizeof(struct gl_current_attrib) ); break; case GL_DEPTH_BUFFER_BIT: { const struct gl_depthbuffer_attrib *depth; depth = (const struct gl_depthbuffer_attrib *) attr->data; _mesa_DepthFunc(depth->Func); _mesa_ClearDepth(depth->Clear); _mesa_set_enable(ctx, GL_DEPTH_TEST, depth->Test); _mesa_DepthMask(depth->Mask); if (ctx->Extensions.HP_occlusion_test) _mesa_set_enable(ctx, GL_OCCLUSION_TEST_HP, depth->OcclusionTest); } break; case GL_ENABLE_BIT: { const struct gl_enable_attrib *enable; enable = (const struct gl_enable_attrib *) attr->data; pop_enable_group(ctx, enable); ctx->NewState |= _NEW_ALL; } break; case GL_EVAL_BIT: MEMCPY( &ctx->Eval, attr->data, sizeof(struct gl_eval_attrib) ); ctx->NewState |= _NEW_EVAL; break; case GL_FOG_BIT: { const struct gl_fog_attrib *fog; fog = (const struct gl_fog_attrib *) attr->data; _mesa_set_enable(ctx, GL_FOG, fog->Enabled); _mesa_Fogfv(GL_FOG_COLOR, fog->Color); _mesa_Fogf(GL_FOG_DENSITY, fog->Density); _mesa_Fogf(GL_FOG_START, fog->Start); _mesa_Fogf(GL_FOG_END, fog->End); _mesa_Fogf(GL_FOG_INDEX, fog->Index); _mesa_Fogi(GL_FOG_MODE, fog->Mode); } break; case GL_HINT_BIT: { const struct gl_hint_attrib *hint; hint = (const struct gl_hint_attrib *) attr->data; _mesa_Hint(GL_PERSPECTIVE_CORRECTION_HINT, hint->PerspectiveCorrection ); _mesa_Hint(GL_POINT_SMOOTH_HINT, hint->PointSmooth); _mesa_Hint(GL_LINE_SMOOTH_HINT, hint->LineSmooth); _mesa_Hint(GL_POLYGON_SMOOTH_HINT, hint->PolygonSmooth); _mesa_Hint(GL_FOG_HINT, hint->Fog); _mesa_Hint(GL_CLIP_VOLUME_CLIPPING_HINT_EXT, hint->ClipVolumeClipping); if (ctx->Extensions.ARB_texture_compression) _mesa_Hint(GL_TEXTURE_COMPRESSION_HINT_ARB, hint->TextureCompression); } break; case GL_LIGHTING_BIT: { GLuint i; const struct gl_light_attrib *light; light = (const struct gl_light_attrib *) attr->data; /* lighting enable */ _mesa_set_enable(ctx, GL_LIGHTING, light->Enabled); /* per-light state */ if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); for (i = 0; i < MAX_LIGHTS; i++) { GLenum lgt = (GLenum) (GL_LIGHT0 + i); const struct gl_light *l = &light->Light[i]; GLfloat tmp[4]; _mesa_set_enable(ctx, lgt, l->Enabled); _mesa_Lightfv( lgt, GL_AMBIENT, l->Ambient ); _mesa_Lightfv( lgt, GL_DIFFUSE, l->Diffuse ); _mesa_Lightfv( lgt, GL_SPECULAR, l->Specular ); TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->inv, l->EyePosition ); _mesa_Lightfv( lgt, GL_POSITION, tmp ); TRANSFORM_NORMAL( tmp, l->EyeDirection, ctx->ModelviewMatrixStack.Top->m ); _mesa_Lightfv( lgt, GL_SPOT_DIRECTION, tmp ); _mesa_Lightfv( lgt, GL_SPOT_EXPONENT, &l->SpotExponent ); _mesa_Lightfv( lgt, GL_SPOT_CUTOFF, &l->SpotCutoff ); _mesa_Lightfv( lgt, GL_CONSTANT_ATTENUATION, &l->ConstantAttenuation ); _mesa_Lightfv( lgt, GL_LINEAR_ATTENUATION, &l->LinearAttenuation ); _mesa_Lightfv( lgt, GL_QUADRATIC_ATTENUATION, &l->QuadraticAttenuation ); } /* light model */ _mesa_LightModelfv(GL_LIGHT_MODEL_AMBIENT, light->Model.Ambient); _mesa_LightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, (GLfloat) light->Model.LocalViewer); _mesa_LightModelf(GL_LIGHT_MODEL_TWO_SIDE, (GLfloat) light->Model.TwoSide); _mesa_LightModelf(GL_LIGHT_MODEL_COLOR_CONTROL, (GLfloat) light->Model.ColorControl); /* materials */ MEMCPY(&ctx->Light.Material, &light->Material, sizeof(struct gl_material)); /* shade model */ _mesa_ShadeModel(light->ShadeModel); /* color material */ _mesa_ColorMaterial(light->ColorMaterialFace, light->ColorMaterialMode); _mesa_set_enable(ctx, GL_COLOR_MATERIAL, light->ColorMaterialEnabled); } break; case GL_LINE_BIT: { const struct gl_line_attrib *line; line = (const struct gl_line_attrib *) attr->data; _mesa_set_enable(ctx, GL_LINE_SMOOTH, line->SmoothFlag); _mesa_set_enable(ctx, GL_LINE_STIPPLE, line->StippleFlag); _mesa_LineStipple(line->StippleFactor, line->StipplePattern); _mesa_LineWidth(line->Width); } break; case GL_LIST_BIT: MEMCPY( &ctx->List, attr->data, sizeof(struct gl_list_attrib) ); break; case GL_PIXEL_MODE_BIT: MEMCPY( &ctx->Pixel, attr->data, sizeof(struct gl_pixel_attrib) ); /* XXX what other pixel state needs to be set by function calls? */ _mesa_ReadBuffer(ctx->Pixel.ReadBuffer); ctx->NewState |= _NEW_PIXEL; break; case GL_POINT_BIT: { const struct gl_point_attrib *point; point = (const struct gl_point_attrib *) attr->data; _mesa_PointSize(point->Size); _mesa_set_enable(ctx, GL_POINT_SMOOTH, point->SmoothFlag); if (ctx->Extensions.EXT_point_parameters) { _mesa_PointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, point->Params); _mesa_PointParameterfEXT(GL_POINT_SIZE_MIN_EXT, point->MinSize); _mesa_PointParameterfEXT(GL_POINT_SIZE_MAX_EXT, point->MaxSize); _mesa_PointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, point->Threshold); } if (ctx->Extensions.NV_point_sprite || ctx->Extensions.ARB_point_sprite) { GLuint u; for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { _mesa_TexEnvi(GL_POINT_SPRITE_NV, GL_COORD_REPLACE_NV, (GLint) point->CoordReplace[u]); } _mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite); _mesa_PointParameteriNV(GL_POINT_SPRITE_R_MODE_NV, ctx->Point.SpriteRMode); _mesa_PointParameterfEXT(GL_POINT_SPRITE_COORD_ORIGIN, (GLfloat)ctx->Point.SpriteOrigin); } } break; case GL_POLYGON_BIT: { const struct gl_polygon_attrib *polygon; polygon = (const struct gl_polygon_attrib *) attr->data; _mesa_CullFace(polygon->CullFaceMode); _mesa_FrontFace(polygon->FrontFace); _mesa_PolygonMode(GL_FRONT, polygon->FrontMode); _mesa_PolygonMode(GL_BACK, polygon->BackMode); _mesa_PolygonOffset(polygon->OffsetFactor, polygon->OffsetUnits); _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, polygon->SmoothFlag); _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, polygon->StippleFlag); _mesa_set_enable(ctx, GL_CULL_FACE, polygon->CullFlag); _mesa_set_enable(ctx, GL_POLYGON_OFFSET_POINT, polygon->OffsetPoint); _mesa_set_enable(ctx, GL_POLYGON_OFFSET_LINE, polygon->OffsetLine); _mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL, polygon->OffsetFill); } break; case GL_POLYGON_STIPPLE_BIT: MEMCPY( ctx->PolygonStipple, attr->data, 32*sizeof(GLuint) ); ctx->NewState |= _NEW_POLYGONSTIPPLE; if (ctx->Driver.PolygonStipple) ctx->Driver.PolygonStipple( ctx, (const GLubyte *) attr->data ); break; case GL_SCISSOR_BIT: { const struct gl_scissor_attrib *scissor; scissor = (const struct gl_scissor_attrib *) attr->data; _mesa_Scissor(scissor->X, scissor->Y, scissor->Width, scissor->Height); _mesa_set_enable(ctx, GL_SCISSOR_TEST, scissor->Enabled); } break; case GL_STENCIL_BUFFER_BIT: { GLint face; const struct gl_stencil_attrib *stencil; stencil = (const struct gl_stencil_attrib *) attr->data; _mesa_set_enable(ctx, GL_STENCIL_TEST, stencil->Enabled); _mesa_ClearStencil(stencil->Clear); face = stencil->ActiveFace; if (ctx->Extensions.EXT_stencil_two_side) { _mesa_set_enable(ctx, GL_STENCIL_TEST_TWO_SIDE_EXT, stencil->TestTwoSide); face ^= 1; } do { _mesa_ActiveStencilFaceEXT(face); _mesa_StencilFunc(stencil->Function[face], stencil->Ref[face], stencil->ValueMask[face]); _mesa_StencilMask(stencil->WriteMask[face]); _mesa_StencilOp(stencil->FailFunc[face], stencil->ZFailFunc[face], stencil->ZPassFunc[face]); face ^= 1; } while (face != (stencil->ActiveFace ^ 1)); } break; case GL_TRANSFORM_BIT: { GLuint i; const struct gl_transform_attrib *xform; xform = (const struct gl_transform_attrib *) attr->data; _mesa_MatrixMode(xform->MatrixMode); if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top)) _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); /* restore clip planes */ for (i = 0; i < MAX_CLIP_PLANES; i++) { const GLuint mask = 1 << 1; const GLfloat *eyePlane = xform->EyeUserPlane[i]; COPY_4V(ctx->Transform.EyeUserPlane[i], eyePlane); if (xform->ClipPlanesEnabled & mask) { _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_TRUE); } else { _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_FALSE); } if (ctx->Driver.ClipPlane) ctx->Driver.ClipPlane( ctx, GL_CLIP_PLANE0 + i, eyePlane ); } /* normalize/rescale */ if (xform->Normalize != ctx->Transform.Normalize) _mesa_set_enable(ctx, GL_NORMALIZE,ctx->Transform.Normalize); if (xform->RescaleNormals != ctx->Transform.RescaleNormals) _mesa_set_enable(ctx, GL_RESCALE_NORMAL_EXT, ctx->Transform.RescaleNormals); } break; case GL_TEXTURE_BIT: /* Take care of texture object reference counters */ { const struct gl_texture_attrib *texture; texture = (const struct gl_texture_attrib *) attr->data; pop_texture_group(ctx, texture); ctx->NewState |= _NEW_TEXTURE; } break; case GL_VIEWPORT_BIT: { const struct gl_viewport_attrib *vp; vp = (const struct gl_viewport_attrib *) attr->data; _mesa_Viewport(vp->X, vp->Y, vp->Width, vp->Height); _mesa_DepthRange(vp->Near, vp->Far); } break; case GL_MULTISAMPLE_BIT_ARB: { const struct gl_multisample_attrib *ms; ms = (const struct gl_multisample_attrib *) attr->data; _mesa_SampleCoverageARB(ms->SampleCoverageValue, ms->SampleCoverageInvert); } break; default: _mesa_problem( ctx, "Bad attrib flag in PopAttrib"); break; } next = attr->next; FREE( attr->data ); FREE( attr ); attr = next; } } /** * Helper for incrementing/decrementing vertex buffer object reference * counts when pushing/popping the GL_CLIENT_VERTEX_ARRAY_BIT attribute group. */ static void adjust_buffer_object_ref_counts(struct gl_array_attrib *array, GLint step) { GLuint i; array->Vertex.BufferObj->RefCount += step; array->Normal.BufferObj->RefCount += step; array->Color.BufferObj->RefCount += step; array->SecondaryColor.BufferObj->RefCount += step; array->FogCoord.BufferObj->RefCount += step; array->Index.BufferObj->RefCount += step; array->EdgeFlag.BufferObj->RefCount += step; for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) array->TexCoord[i].BufferObj->RefCount += step; for (i = 0; i < VERT_ATTRIB_MAX; i++) array->VertexAttrib[i].BufferObj->RefCount += step; array->ArrayBufferObj->RefCount += step; array->ElementArrayBufferObj->RefCount += step; } #define GL_CLIENT_PACK_BIT (1<<20) #define GL_CLIENT_UNPACK_BIT (1<<21) void GLAPIENTRY _mesa_PushClientAttrib(GLbitfield mask) { struct gl_attrib_node *newnode; struct gl_attrib_node *head; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->ClientAttribStackDepth >= MAX_CLIENT_ATTRIB_STACK_DEPTH) { _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushClientAttrib" ); return; } /* Build linked list of attribute nodes which save all attribute */ /* groups specified by the mask. */ head = NULL; if (mask & GL_CLIENT_PIXEL_STORE_BIT) { struct gl_pixelstore_attrib *attr; #if FEATURE_EXT_pixel_buffer_object ctx->Pack.BufferObj->RefCount++; ctx->Unpack.BufferObj->RefCount++; #endif /* packing attribs */ attr = MALLOC_STRUCT( gl_pixelstore_attrib ); MEMCPY( attr, &ctx->Pack, sizeof(struct gl_pixelstore_attrib) ); newnode = new_attrib_node( GL_CLIENT_PACK_BIT ); newnode->data = attr; newnode->next = head; head = newnode; /* unpacking attribs */ attr = MALLOC_STRUCT( gl_pixelstore_attrib ); MEMCPY( attr, &ctx->Unpack, sizeof(struct gl_pixelstore_attrib) ); newnode = new_attrib_node( GL_CLIENT_UNPACK_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) { struct gl_array_attrib *attr; attr = MALLOC_STRUCT( gl_array_attrib ); MEMCPY( attr, &ctx->Array, sizeof(struct gl_array_attrib) ); newnode = new_attrib_node( GL_CLIENT_VERTEX_ARRAY_BIT ); newnode->data = attr; newnode->next = head; head = newnode; /* bump reference counts on buffer objects */ adjust_buffer_object_ref_counts(&ctx->Array, 1); } ctx->ClientAttribStack[ctx->ClientAttribStackDepth] = head; ctx->ClientAttribStackDepth++; } void GLAPIENTRY _mesa_PopClientAttrib(void) { struct gl_attrib_node *attr, *next; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->ClientAttribStackDepth == 0) { _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopClientAttrib" ); return; } ctx->ClientAttribStackDepth--; attr = ctx->ClientAttribStack[ctx->ClientAttribStackDepth]; while (attr) { switch (attr->kind) { case GL_CLIENT_PACK_BIT: #if FEATURE_EXT_pixel_buffer_object ctx->Pack.BufferObj->RefCount--; if (ctx->Pack.BufferObj->RefCount <= 0) { _mesa_remove_buffer_object( ctx, ctx->Pack.BufferObj ); (*ctx->Driver.DeleteBuffer)( ctx, ctx->Pack.BufferObj ); } #endif MEMCPY( &ctx->Pack, attr->data, sizeof(struct gl_pixelstore_attrib) ); ctx->NewState |= _NEW_PACKUNPACK; break; case GL_CLIENT_UNPACK_BIT: #if FEATURE_EXT_pixel_buffer_object ctx->Unpack.BufferObj->RefCount--; if (ctx->Unpack.BufferObj->RefCount <= 0) { _mesa_remove_buffer_object( ctx, ctx->Unpack.BufferObj ); (*ctx->Driver.DeleteBuffer)( ctx, ctx->Unpack.BufferObj ); } #endif MEMCPY( &ctx->Unpack, attr->data, sizeof(struct gl_pixelstore_attrib) ); ctx->NewState |= _NEW_PACKUNPACK; break; case GL_CLIENT_VERTEX_ARRAY_BIT: adjust_buffer_object_ref_counts(&ctx->Array, -1); MEMCPY( &ctx->Array, attr->data, sizeof(struct gl_array_attrib) ); /* decrement reference counts on buffer objects */ ctx->NewState |= _NEW_ARRAY; break; default: _mesa_problem( ctx, "Bad attrib flag in PopClientAttrib"); break; } next = attr->next; FREE( attr->data ); FREE( attr ); attr = next; } } void _mesa_init_attrib( GLcontext *ctx ) { /* Renderer and client attribute stacks */ ctx->AttribStackDepth = 0; ctx->ClientAttribStackDepth = 0; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/attrib.h0000644000000000000000000000324313614532424017601 0ustar /** * \file attrib.h * Attribute stacks. * * \if subset * (No-op) * * \endif */ /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ATTRIB_H #define ATTRIB_H #include "mtypes.h" #if _HAVE_FULL_GL extern void GLAPIENTRY _mesa_PushAttrib( GLbitfield mask ); extern void GLAPIENTRY _mesa_PopAttrib( void ); extern void GLAPIENTRY _mesa_PushClientAttrib( GLbitfield mask ); extern void GLAPIENTRY _mesa_PopClientAttrib( void ); extern void _mesa_init_attrib( GLcontext *ctx ); #else /** No-op */ #define _mesa_init_attrib( c ) ((void)0) #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/blend.c0000644000000000000000000004031413614532424017373 0ustar /** * \file blend.c * Blending operations. */ /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "blend.h" #include "colormac.h" #include "context.h" #include "enums.h" #include "macros.h" #include "mtypes.h" /** * Specify the blending operation. * * \param sfactor source factor operator. * \param dfactor destination factor operator. * * \sa glBlendFunc, glBlendFuncSeparateEXT * * Swizzles the inputs and calls \c glBlendFuncSeparateEXT. This is done * using the \c CurrentDispatch table in the context, so this same function * can be used while compiling display lists. Therefore, there is no need * for the display list code to save and restore this function. */ void GLAPIENTRY _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) { GET_CURRENT_CONTEXT(ctx); (*ctx->CurrentDispatch->BlendFuncSeparateEXT)( sfactor, dfactor, sfactor, dfactor ); } /** * Process GL_EXT_blend_func_separate(). * * \param sfactorRGB RGB source factor operator. * \param dfactorRGB RGB destination factor operator. * \param sfactorA alpha source factor operator. * \param dfactorA alpha destination factor operator. * * Verifies the parameters and updates gl_colorbuffer_attrib. * On a change, flush the vertices and notify the driver via * dd_function_table::BlendFuncSeparate. */ void GLAPIENTRY _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glBlendFuncSeparate %s %s %s %s\n", _mesa_lookup_enum_by_nr(sfactorRGB), _mesa_lookup_enum_by_nr(dfactorRGB), _mesa_lookup_enum_by_nr(sfactorA), _mesa_lookup_enum_by_nr(dfactorA)); switch (sfactorRGB) { case GL_SRC_COLOR: case GL_ONE_MINUS_SRC_COLOR: if (!ctx->Extensions.NV_blend_square) { _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (sfactorRGB)"); return; } /* fall-through */ case GL_ZERO: case GL_ONE: case GL_DST_COLOR: case GL_ONE_MINUS_DST_COLOR: case GL_SRC_ALPHA: case GL_ONE_MINUS_SRC_ALPHA: case GL_DST_ALPHA: case GL_ONE_MINUS_DST_ALPHA: case GL_SRC_ALPHA_SATURATE: case GL_CONSTANT_COLOR: case GL_ONE_MINUS_CONSTANT_COLOR: case GL_CONSTANT_ALPHA: case GL_ONE_MINUS_CONSTANT_ALPHA: break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (sfactorRGB)"); return; } switch (dfactorRGB) { case GL_DST_COLOR: case GL_ONE_MINUS_DST_COLOR: if (!ctx->Extensions.NV_blend_square) { _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (dfactorRGB)"); return; } /* fall-through */ case GL_ZERO: case GL_ONE: case GL_SRC_COLOR: case GL_ONE_MINUS_SRC_COLOR: case GL_SRC_ALPHA: case GL_ONE_MINUS_SRC_ALPHA: case GL_DST_ALPHA: case GL_ONE_MINUS_DST_ALPHA: case GL_CONSTANT_COLOR: case GL_ONE_MINUS_CONSTANT_COLOR: case GL_CONSTANT_ALPHA: case GL_ONE_MINUS_CONSTANT_ALPHA: break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (dfactorRGB)"); return; } switch (sfactorA) { case GL_SRC_COLOR: case GL_ONE_MINUS_SRC_COLOR: if (!ctx->Extensions.NV_blend_square) { _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (sfactorA)"); return; } /* fall-through */ case GL_ZERO: case GL_ONE: case GL_DST_COLOR: case GL_ONE_MINUS_DST_COLOR: case GL_SRC_ALPHA: case GL_ONE_MINUS_SRC_ALPHA: case GL_DST_ALPHA: case GL_ONE_MINUS_DST_ALPHA: case GL_SRC_ALPHA_SATURATE: case GL_CONSTANT_COLOR: case GL_ONE_MINUS_CONSTANT_COLOR: case GL_CONSTANT_ALPHA: case GL_ONE_MINUS_CONSTANT_ALPHA: break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (sfactorA)"); return; } switch (dfactorA) { case GL_DST_COLOR: case GL_ONE_MINUS_DST_COLOR: if (!ctx->Extensions.NV_blend_square) { _mesa_error(ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (dfactorA)"); return; } /* fall-through */ case GL_ZERO: case GL_ONE: case GL_SRC_COLOR: case GL_ONE_MINUS_SRC_COLOR: case GL_SRC_ALPHA: case GL_ONE_MINUS_SRC_ALPHA: case GL_DST_ALPHA: case GL_ONE_MINUS_DST_ALPHA: case GL_CONSTANT_COLOR: case GL_ONE_MINUS_CONSTANT_COLOR: case GL_CONSTANT_ALPHA: case GL_ONE_MINUS_CONSTANT_ALPHA: break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glBlendFunc or glBlendFuncSeparate (dfactorA)" ); return; } if (ctx->Color.BlendSrcRGB == sfactorRGB && ctx->Color.BlendDstRGB == dfactorRGB && ctx->Color.BlendSrcA == sfactorA && ctx->Color.BlendDstA == dfactorA) return; FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.BlendSrcRGB = sfactorRGB; ctx->Color.BlendDstRGB = dfactorRGB; ctx->Color.BlendSrcA = sfactorA; ctx->Color.BlendDstA = dfactorA; if (ctx->Driver.BlendFuncSeparate) { (*ctx->Driver.BlendFuncSeparate)( ctx, sfactorRGB, dfactorRGB, sfactorA, dfactorA ); } } #if _HAVE_FULL_GL static GLboolean _mesa_validate_blend_equation( GLcontext *ctx, GLenum mode, GLboolean is_separate ) { switch (mode) { case GL_FUNC_ADD: break; case GL_MIN: case GL_MAX: if (!ctx->Extensions.EXT_blend_minmax && !ctx->Extensions.ARB_imaging) { return GL_FALSE; } break; /* glBlendEquationSeparate cannot take GL_LOGIC_OP as a parameter. */ case GL_LOGIC_OP: if (!ctx->Extensions.EXT_blend_logic_op || is_separate) { return GL_FALSE; } break; case GL_FUNC_SUBTRACT: case GL_FUNC_REVERSE_SUBTRACT: if (!ctx->Extensions.EXT_blend_subtract && !ctx->Extensions.ARB_imaging) { return GL_FALSE; } break; default: return GL_FALSE; } return GL_TRUE; } /* This is really an extension function! */ void GLAPIENTRY _mesa_BlendEquation( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glBlendEquation %s\n", _mesa_lookup_enum_by_nr(mode)); if ( ! _mesa_validate_blend_equation( ctx, mode, GL_FALSE ) ) { _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquation"); return; } if ( (ctx->Color.BlendEquationRGB == mode) && (ctx->Color.BlendEquationA == mode) ) return; FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.BlendEquationRGB = mode; ctx->Color.BlendEquationA = mode; /* This is needed to support 1.1's RGB logic ops AND * 1.0's blending logicops. */ ctx->Color._LogicOpEnabled = (ctx->Color.ColorLogicOpEnabled || (ctx->Color.BlendEnabled && mode == GL_LOGIC_OP)); if (ctx->Driver.BlendEquationSeparate) (*ctx->Driver.BlendEquationSeparate)( ctx, mode, mode ); } void GLAPIENTRY _mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glBlendEquationSeparateEXT %s %s\n", _mesa_lookup_enum_by_nr(modeRGB), _mesa_lookup_enum_by_nr(modeA)); if ( (modeRGB != modeA) && !ctx->Extensions.EXT_blend_equation_separate ) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBlendEquationSeparateEXT not supported by driver"); return; } if ( ! _mesa_validate_blend_equation( ctx, modeRGB, GL_TRUE ) ) { _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparateEXT(modeRGB)"); return; } if ( ! _mesa_validate_blend_equation( ctx, modeA, GL_TRUE ) ) { _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparateEXT(modeA)"); return; } if ( (ctx->Color.BlendEquationRGB == modeRGB) && (ctx->Color.BlendEquationA == modeA) ) return; FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.BlendEquationRGB = modeRGB; ctx->Color.BlendEquationA = modeA; /* This is needed to support 1.1's RGB logic ops AND * 1.0's blending logicops. This test is simplified over glBlendEquation * because modeRGB cannot be GL_LOGIC_OP. */ ctx->Color._LogicOpEnabled = (ctx->Color.ColorLogicOpEnabled); if (ctx->Driver.BlendEquationSeparate) (*ctx->Driver.BlendEquationSeparate)( ctx, modeRGB, modeA ); } #endif /** * Set the blending color. * * \param red red color component. * \param green green color component. * \param blue blue color component. * \param alpha alpha color component. * * \sa glBlendColor(). * * Clamps the parameters and updates gl_colorbuffer_attrib::BlendColor. On a * change, flushes the vertices and notifies the driver via * dd_function_table::BlendColor callback. */ void GLAPIENTRY _mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { GLfloat tmp[4]; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); tmp[0] = CLAMP( red, 0.0F, 1.0F ); tmp[1] = CLAMP( green, 0.0F, 1.0F ); tmp[2] = CLAMP( blue, 0.0F, 1.0F ); tmp[3] = CLAMP( alpha, 0.0F, 1.0F ); if (TEST_EQ_4V(tmp, ctx->Color.BlendColor)) return; FLUSH_VERTICES(ctx, _NEW_COLOR); COPY_4FV( ctx->Color.BlendColor, tmp ); if (ctx->Driver.BlendColor) (*ctx->Driver.BlendColor)(ctx, tmp); } /** * Specify the alpha test function. * * \param func alpha comparison function. * \param ref reference value. * * Verifies the parameters and updates gl_colorbuffer_attrib. * On a change, flushes the vertices and notifies the driver via * dd_function_table::AlphaFunc callback. */ void GLAPIENTRY _mesa_AlphaFunc( GLenum func, GLclampf ref ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); switch (func) { case GL_NEVER: case GL_LESS: case GL_EQUAL: case GL_LEQUAL: case GL_GREATER: case GL_NOTEQUAL: case GL_GEQUAL: case GL_ALWAYS: ref = CLAMP(ref, 0.0F, 1.0F); if (ctx->Color.AlphaFunc == func && ctx->Color.AlphaRef == ref) return; /* no change */ FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.AlphaFunc = func; ctx->Color.AlphaRef = ref; if (ctx->Driver.AlphaFunc) ctx->Driver.AlphaFunc(ctx, func, ref); return; default: _mesa_error( ctx, GL_INVALID_ENUM, "glAlphaFunc(func)" ); return; } } /** * Specify a logic pixel operation for color index rendering. * * \param opcode operation. * * Verifies that \p opcode is a valid enum and updates gl_colorbuffer_attrib::LogicOp. * On a change, flushes the vertices and notifies the driver via the * dd_function_table::LogicOpcode callback. */ void GLAPIENTRY _mesa_LogicOp( GLenum opcode ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); switch (opcode) { case GL_CLEAR: case GL_SET: case GL_COPY: case GL_COPY_INVERTED: case GL_NOOP: case GL_INVERT: case GL_AND: case GL_NAND: case GL_OR: case GL_NOR: case GL_XOR: case GL_EQUIV: case GL_AND_REVERSE: case GL_AND_INVERTED: case GL_OR_REVERSE: case GL_OR_INVERTED: break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glLogicOp" ); return; } if (ctx->Color.LogicOp == opcode) return; FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.LogicOp = opcode; if (ctx->Driver.LogicOpcode) ctx->Driver.LogicOpcode( ctx, opcode ); } #if _HAVE_FULL_GL void GLAPIENTRY _mesa_IndexMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Color.IndexMask == mask) return; FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.IndexMask = mask; if (ctx->Driver.IndexMask) ctx->Driver.IndexMask( ctx, mask ); } #endif /** * Enable or disable writing of frame buffer color components. * * \param red whether to mask writing of the red color component. * \param green whether to mask writing of the green color component. * \param blue whether to mask writing of the blue color component. * \param alpha whether to mask writing of the alpha color component. * * \sa glColorMask(). * * Sets the appropriate value of gl_colorbuffer_attrib::ColorMask. On a * change, flushes the vertices and notifies the driver via the * dd_function_table::ColorMask callback. */ void GLAPIENTRY _mesa_ColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) { GET_CURRENT_CONTEXT(ctx); GLubyte tmp[4]; ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glColorMask %d %d %d %d\n", red, green, blue, alpha); /* Shouldn't have any information about channel depth in core mesa * -- should probably store these as the native booleans: */ tmp[RCOMP] = red ? 0xff : 0x0; tmp[GCOMP] = green ? 0xff : 0x0; tmp[BCOMP] = blue ? 0xff : 0x0; tmp[ACOMP] = alpha ? 0xff : 0x0; if (TEST_EQ_4UBV(tmp, ctx->Color.ColorMask)) return; FLUSH_VERTICES(ctx, _NEW_COLOR); COPY_4UBV(ctx->Color.ColorMask, tmp); if (ctx->Driver.ColorMask) ctx->Driver.ColorMask( ctx, red, green, blue, alpha ); } /**********************************************************************/ /** \name Initialization */ /*@{*/ /** * Initialization of the context's Color attribute group. * * \param ctx GL context. * * Initializes the related fields in the context color attribute group, * __GLcontextRec::Color. */ void _mesa_init_color( GLcontext * ctx ) { /* Color buffer group */ ctx->Color.IndexMask = ~0u; ctx->Color.ColorMask[0] = 0xff; ctx->Color.ColorMask[1] = 0xff; ctx->Color.ColorMask[2] = 0xff; ctx->Color.ColorMask[3] = 0xff; ctx->Color.ClearIndex = 0; ASSIGN_4V( ctx->Color.ClearColor, 0, 0, 0, 0 ); ctx->Color.AlphaEnabled = GL_FALSE; ctx->Color.AlphaFunc = GL_ALWAYS; ctx->Color.AlphaRef = 0; ctx->Color.BlendEnabled = GL_FALSE; ctx->Color.BlendSrcRGB = GL_ONE; ctx->Color.BlendDstRGB = GL_ZERO; ctx->Color.BlendSrcA = GL_ONE; ctx->Color.BlendDstA = GL_ZERO; ctx->Color.BlendEquationRGB = GL_FUNC_ADD; ctx->Color.BlendEquationA = GL_FUNC_ADD; ASSIGN_4V( ctx->Color.BlendColor, 0.0, 0.0, 0.0, 0.0 ); ctx->Color.IndexLogicOpEnabled = GL_FALSE; ctx->Color.ColorLogicOpEnabled = GL_FALSE; ctx->Color._LogicOpEnabled = GL_FALSE; ctx->Color.LogicOp = GL_COPY; ctx->Color.DitherFlag = GL_TRUE; if (ctx->Visual.doubleBufferMode) { ctx->Color.DrawBuffer[0] = GL_BACK; } else { ctx->Color.DrawBuffer[0] = GL_FRONT; } ctx->Color.ClampFragmentColor = GL_FIXED_ONLY_ARB; ctx->Color.ClampReadColor = GL_FIXED_ONLY_ARB; } /*@}*/ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/blend.h0000644000000000000000000000413513614532424017401 0ustar /** * \file blend.h * Blending functions operations. */ /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef BLEND_H #define BLEND_H #include "mtypes.h" extern void GLAPIENTRY _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ); extern void GLAPIENTRY _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ); extern void GLAPIENTRY _mesa_BlendEquation( GLenum mode ); extern void GLAPIENTRY _mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA ); extern void GLAPIENTRY _mesa_BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); extern void GLAPIENTRY _mesa_AlphaFunc( GLenum func, GLclampf ref ); extern void GLAPIENTRY _mesa_LogicOp( GLenum opcode ); extern void GLAPIENTRY _mesa_IndexMask( GLuint mask ); extern void GLAPIENTRY _mesa_ColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ); extern void _mesa_init_color( GLcontext * ctx ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/bufferobj.c0000644000000000000000000006752413614532424020267 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file bufferobj.c * \brief Functions for the GL_ARB_vertex_buffer_object extension. * \author Brian Paul, Ian Romanick */ #include "glheader.h" #include "hash.h" #include "imports.h" #include "image.h" #include "context.h" #include "bufferobj.h" /** * Get the buffer object bound to the specified target in a GL context. * * \param ctx GL context * \param target Buffer object target to be retrieved. Currently this must * be either \c GL_ARRAY_BUFFER or \c GL_ELEMENT_ARRAY_BUFFER. * \param str Name of caller for logging errors. * \return A pointer to the buffer object bound to \c target in the * specified context or \c NULL if \c target is invalid or no * buffer object is bound. */ static INLINE struct gl_buffer_object * buffer_object_get_target( GLcontext *ctx, GLenum target, const char * str ) { struct gl_buffer_object * bufObj = NULL; switch (target) { case GL_ARRAY_BUFFER_ARB: bufObj = ctx->Array.ArrayBufferObj; break; case GL_ELEMENT_ARRAY_BUFFER_ARB: bufObj = ctx->Array.ElementArrayBufferObj; break; case GL_PIXEL_PACK_BUFFER_EXT: bufObj = ctx->Pack.BufferObj; break; case GL_PIXEL_UNPACK_BUFFER_EXT: bufObj = ctx->Unpack.BufferObj; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(target)", str); return NULL; } if (bufObj->Name == 0) return NULL; return bufObj; } /** * Tests the subdata range parameters and sets the GL error code for * \c glBufferSubDataARB and \c glGetBufferSubDataARB. * * \param ctx GL context. * \param target Buffer object target on which to operate. * \param offset Offset of the first byte of the subdata range. * \param size Size, in bytes, of the subdata range. * \param str Name of caller for logging errors. * \return A pointer to the buffer object bound to \c target in the * specified context or \c NULL if any of the parameter or state * conditions for \c glBufferSubDataARB or \c glGetBufferSubDataARB * are invalid. * * \sa glBufferSubDataARB, glGetBufferSubDataARB */ static struct gl_buffer_object * buffer_object_subdata_range_good( GLcontext * ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const char * str ) { struct gl_buffer_object *bufObj; if (size < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "%s(size < 0)", str); return NULL; } if (offset < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "%s(offset < 0)", str); return NULL; } bufObj = buffer_object_get_target( ctx, target, str ); if (!bufObj || bufObj->Name == 0) { return NULL; } if ((GLuint) (offset + size) > bufObj->Size) { _mesa_error(ctx, GL_INVALID_VALUE, "%s(size + offset > buffer size)", str); return NULL; } if (bufObj->Pointer) { /* Buffer is currently mapped */ _mesa_error(ctx, GL_INVALID_OPERATION, "%s", str); return NULL; } return bufObj; } /** * Allocate and initialize a new buffer object. * * This function is intended to be called via * \c dd_function_table::NewBufferObject. */ struct gl_buffer_object * _mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target ) { struct gl_buffer_object *obj; (void) ctx; obj = MALLOC_STRUCT(gl_buffer_object); _mesa_initialize_buffer_object(obj, name, target); return obj; } /** * Delete a buffer object. * * This function is intended to be called via * \c dd_function_table::DeleteBuffer. */ void _mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) { (void) ctx; if (bufObj->Data) _mesa_free(bufObj->Data); _mesa_free(bufObj); } /** * Initialize a buffer object to default values. */ void _mesa_initialize_buffer_object( struct gl_buffer_object *obj, GLuint name, GLenum target ) { (void) target; _mesa_bzero(obj, sizeof(struct gl_buffer_object)); obj->RefCount = 1; obj->Name = name; obj->Usage = GL_STATIC_DRAW_ARB; obj->Access = GL_READ_WRITE_ARB; } /** * Add the given buffer object to the buffer object pool. */ void _mesa_save_buffer_object( GLcontext *ctx, struct gl_buffer_object *obj ) { if (obj->Name > 0) { /* insert into hash table */ _mesa_HashInsert(ctx->Shared->BufferObjects, obj->Name, obj); } } /** * Remove the given buffer object from the buffer object pool. * Do not deallocate the buffer object though. */ void _mesa_remove_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) { if (bufObj->Name > 0) { /* remove from hash table */ _mesa_HashRemove(ctx->Shared->BufferObjects, bufObj->Name); } } /** * Allocate space for and store data in a buffer object. Any data that was * previously stored in the buffer object is lost. If \c data is \c NULL, * memory will be allocated, but no copy will occur. * * This function is intended to be called via * \c dd_function_table::BufferData. This function need not set GL error * codes. The input parameters will have been tested before calling. * * \param ctx GL context. * \param target Buffer object target on which to operate. * \param size Size, in bytes, of the new data store. * \param data Pointer to the data to store in the buffer object. This * pointer may be \c NULL. * \param usage Hints about how the data will be used. * \param bufObj Object to be used. * * \sa glBufferDataARB, dd_function_table::BufferData. */ void _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage, struct gl_buffer_object * bufObj ) { void * new_data; (void) ctx; (void) target; new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size ); if (new_data) { bufObj->Data = (GLubyte *) new_data; bufObj->Size = size; bufObj->Usage = usage; if (data) { _mesa_memcpy( bufObj->Data, data, size ); } } } /** * Replace data in a subrange of buffer object. If the data range * specified by \c size + \c offset extends beyond the end of the buffer or * if \c data is \c NULL, no copy is performed. * * This function is intended to be called by * \c dd_function_table::BufferSubData. This function need not set GL error * codes. The input parameters will have been tested before calling. * * \param ctx GL context. * \param target Buffer object target on which to operate. * \param offset Offset of the first byte to be modified. * \param size Size, in bytes, of the data range. * \param data Pointer to the data to store in the buffer object. * \param bufObj Object to be used. * * \sa glBufferSubDataARB, dd_function_table::BufferSubData. */ void _mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data, struct gl_buffer_object * bufObj ) { (void) ctx; (void) target; if (bufObj->Data && ((GLuint) (size + offset) <= bufObj->Size)) { _mesa_memcpy( (GLubyte *) bufObj->Data + offset, data, size ); } } /** * Retrieve data from a subrange of buffer object. If the data range * specified by \c size + \c offset extends beyond the end of the buffer or * if \c data is \c NULL, no copy is performed. * * This function is intended to be called by * \c dd_function_table::BufferGetSubData. This function need not set GL error * codes. The input parameters will have been tested before calling. * * \param ctx GL context. * \param target Buffer object target on which to operate. * \param offset Offset of the first byte to be modified. * \param size Size, in bytes, of the data range. * \param data Pointer to the data to store in the buffer object. * \param bufObj Object to be used. * * \sa glBufferGetSubDataARB, dd_function_table::GetBufferSubData. */ void _mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data, struct gl_buffer_object * bufObj ) { (void) ctx; (void) target; if (bufObj->Data && ((GLsizeiptrARB) (size + offset) <= bufObj->Size)) { _mesa_memcpy( data, (GLubyte *) bufObj->Data + offset, size ); } } /** * Fallback function called via ctx->Driver.MapBuffer(). * Hardware drivers that really implement buffer objects should never use * function. * * The input parameters will have been already tested for errors. * * \param ctx GL context. * \param target Buffer object target on which to operate. * \param access Information about how the buffer will be accessed. * \param bufObj Object to be mapped. * \return A pointer to the object's internal data store that can be accessed * by the processor * * \sa glMapBufferARB, dd_function_table::MapBuffer */ void * _mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, struct gl_buffer_object *bufObj ) { (void) ctx; (void) target; (void) access; ASSERT(!bufObj->OnCard); /* Just return a direct pointer to the data */ if (bufObj->Pointer) { /* already mapped! */ return NULL; } bufObj->Pointer = bufObj->Data; return bufObj->Pointer; } /** * Fallback function called via ctx->Driver.MapBuffer(). * Hardware drivers that really implement buffer objects should never use * function. * * The input parameters will have been already tested for errors. * * \sa glUnmapBufferARB, dd_function_table::UnmapBuffer */ GLboolean _mesa_buffer_unmap( GLcontext *ctx, GLenum target, struct gl_buffer_object *bufObj ) { (void) ctx; (void) target; ASSERT(!bufObj->OnCard); /* XXX we might assert here that bufObj->Pointer is non-null */ bufObj->Pointer = NULL; return GL_TRUE; } /** * Initialize the state associated with buffer objects */ void _mesa_init_buffer_objects( GLcontext *ctx ) { GLuint i; /* Allocate the default buffer object and set refcount so high that * it never gets deleted. */ ctx->Array.NullBufferObj = _mesa_new_buffer_object(ctx, 0, 0); if (ctx->Array.NullBufferObj) ctx->Array.NullBufferObj->RefCount = 1000; ctx->Array.ArrayBufferObj = ctx->Array.NullBufferObj; ctx->Array.ElementArrayBufferObj = ctx->Array.NullBufferObj; /* Vertex array buffers */ ctx->Array.Vertex.BufferObj = ctx->Array.NullBufferObj; ctx->Array.Normal.BufferObj = ctx->Array.NullBufferObj; ctx->Array.Color.BufferObj = ctx->Array.NullBufferObj; ctx->Array.SecondaryColor.BufferObj = ctx->Array.NullBufferObj; ctx->Array.FogCoord.BufferObj = ctx->Array.NullBufferObj; ctx->Array.Index.BufferObj = ctx->Array.NullBufferObj; for (i = 0; i < MAX_TEXTURE_UNITS; i++) { ctx->Array.TexCoord[i].BufferObj = ctx->Array.NullBufferObj; } ctx->Array.EdgeFlag.BufferObj = ctx->Array.NullBufferObj; for (i = 0; i < VERT_ATTRIB_MAX; i++) { ctx->Array.VertexAttrib[i].BufferObj = ctx->Array.NullBufferObj; } } /** * When we're about to read pixel data out of a PBO (via glDrawPixels, * glTexImage, etc) or write data into a PBO (via glReadPixels, * glGetTexImage, etc) we call this function to check that we're not * going to read out of bounds. * * XXX This would also be a convenient time to check that the PBO isn't * currently mapped. Whoever calls this function should check for that. * Remember, we can't use a PBO when it's mapped! * * \param width width of image to read/write * \param height height of image to read/write * \param depth depth of image to read/write * \param format format of image to read/write * \param type datatype of image to read/write * \param ptr the user-provided pointer/offset * \return GL_TRUE if the PBO access is OK, GL_FALSE if the access would * go out of bounds. */ GLboolean _mesa_validate_pbo_access(GLuint dimensions, const struct gl_pixelstore_attrib *pack, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *ptr) { GLvoid *start, *end; ASSERT(pack->BufferObj->Name != 0); if (pack->BufferObj->Size == 0) /* no buffer! */ return GL_FALSE; /* get address of first pixel we'll read */ start = _mesa_image_address(dimensions, pack, ptr, width, height, format, type, 0, 0, 0); /* get address just past the last pixel we'll read */ end = _mesa_image_address(dimensions, pack, ptr, width, height, format, type, depth-1, height-1, width); if ((const GLubyte *) start > (const GLubyte *)(uintptr_t) pack->BufferObj->Size) { /* This will catch negative values / wrap-around */ return GL_FALSE; } if ((const GLubyte *) end > (const GLubyte *)(uintptr_t) pack->BufferObj->Size) { /* Image read goes beyond end of buffer */ return GL_FALSE; } /* OK! */ return GL_TRUE; } /**********************************************************************/ /* API Functions */ /**********************************************************************/ void GLAPIENTRY _mesa_BindBufferARB(GLenum target, GLuint buffer) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *oldBufObj; struct gl_buffer_object *newBufObj = NULL; ASSERT_OUTSIDE_BEGIN_END(ctx); oldBufObj = buffer_object_get_target( ctx, target, "BindBufferARB" ); if (oldBufObj && oldBufObj->Name == buffer) return; /* rebinding the same buffer object- no change */ /* * Get pointer to new buffer object (newBufObj) */ if (buffer == 0) { /* The spec says there's not a buffer object named 0, but we use * one internally because it simplifies things. */ newBufObj = ctx->Array.NullBufferObj; } else { /* non-default buffer object */ const struct _mesa_HashTable *hash = ctx->Shared->BufferObjects; newBufObj = (struct gl_buffer_object *) _mesa_HashLookup(hash, buffer); if (!newBufObj) { /* if this is a new buffer object id, allocate a buffer object now */ newBufObj = (*ctx->Driver.NewBufferObject)(ctx, buffer, target); if (!newBufObj) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB"); return; } _mesa_save_buffer_object(ctx, newBufObj); } newBufObj->RefCount++; } switch (target) { case GL_ARRAY_BUFFER_ARB: ctx->Array.ArrayBufferObj = newBufObj; break; case GL_ELEMENT_ARRAY_BUFFER_ARB: ctx->Array.ElementArrayBufferObj = newBufObj; break; case GL_PIXEL_PACK_BUFFER_EXT: ctx->Pack.BufferObj = newBufObj; break; case GL_PIXEL_UNPACK_BUFFER_EXT: ctx->Unpack.BufferObj = newBufObj; break; default: _mesa_problem(ctx, "Bad target in _mesa_BindBufferARB"); return; } /* Pass BindBuffer call to device driver */ if (ctx->Driver.BindBuffer && newBufObj) (*ctx->Driver.BindBuffer)( ctx, target, newBufObj ); if (oldBufObj) { oldBufObj->RefCount--; assert(oldBufObj->RefCount >= 0); if (oldBufObj->RefCount == 0) { assert(oldBufObj->Name != 0); ASSERT(ctx->Driver.DeleteBuffer); ctx->Driver.DeleteBuffer( ctx, oldBufObj ); } } } /** * Delete a set of buffer objects. * * \param n Number of buffer objects to delete. * \param ids Array of \c n buffer object IDs. */ void GLAPIENTRY _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) { GET_CURRENT_CONTEXT(ctx); GLsizei i; ASSERT_OUTSIDE_BEGIN_END(ctx); if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteBuffersARB(n)"); return; } _glthread_LOCK_MUTEX(ctx->Shared->Mutex); for (i = 0; i < n; i++) { if (ids[i] != 0) { struct gl_buffer_object *bufObj = (struct gl_buffer_object *) _mesa_HashLookup(ctx->Shared->BufferObjects, ids[i]); if (bufObj) { /* unbind any vertex pointers bound to this buffer */ GLuint j; ASSERT(bufObj->Name == ids[i]); if (ctx->Array.Vertex.BufferObj == bufObj) { bufObj->RefCount--; ctx->Array.Vertex.BufferObj = ctx->Array.NullBufferObj; ctx->Array.NullBufferObj->RefCount++; } if (ctx->Array.Normal.BufferObj == bufObj) { bufObj->RefCount--; ctx->Array.Normal.BufferObj = ctx->Array.NullBufferObj; ctx->Array.NullBufferObj->RefCount++; } if (ctx->Array.Color.BufferObj == bufObj) { bufObj->RefCount--; ctx->Array.Color.BufferObj = ctx->Array.NullBufferObj; ctx->Array.NullBufferObj->RefCount++; } if (ctx->Array.SecondaryColor.BufferObj == bufObj) { bufObj->RefCount--; ctx->Array.SecondaryColor.BufferObj = ctx->Array.NullBufferObj; ctx->Array.NullBufferObj->RefCount++; } if (ctx->Array.FogCoord.BufferObj == bufObj) { bufObj->RefCount--; ctx->Array.FogCoord.BufferObj = ctx->Array.NullBufferObj; ctx->Array.NullBufferObj->RefCount++; } if (ctx->Array.Index.BufferObj == bufObj) { bufObj->RefCount--; ctx->Array.Index.BufferObj = ctx->Array.NullBufferObj; ctx->Array.NullBufferObj->RefCount++; } if (ctx->Array.EdgeFlag.BufferObj == bufObj) { bufObj->RefCount--; ctx->Array.EdgeFlag.BufferObj = ctx->Array.NullBufferObj; ctx->Array.NullBufferObj->RefCount++; } for (j = 0; j < MAX_TEXTURE_UNITS; j++) { if (ctx->Array.TexCoord[j].BufferObj == bufObj) { bufObj->RefCount--; ctx->Array.TexCoord[j].BufferObj = ctx->Array.NullBufferObj; ctx->Array.NullBufferObj->RefCount++; } } for (j = 0; j < VERT_ATTRIB_MAX; j++) { if (ctx->Array.VertexAttrib[j].BufferObj == bufObj) { bufObj->RefCount--; ctx->Array.VertexAttrib[j].BufferObj = ctx->Array.NullBufferObj; ctx->Array.NullBufferObj->RefCount++; } } if (ctx->Array.ArrayBufferObj == bufObj) { _mesa_BindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); } if (ctx->Array.ElementArrayBufferObj == bufObj) { _mesa_BindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 ); } if (ctx->Pack.BufferObj == bufObj) { _mesa_BindBufferARB( GL_PIXEL_PACK_BUFFER_EXT, 0 ); } if (ctx->Unpack.BufferObj == bufObj) { _mesa_BindBufferARB( GL_PIXEL_UNPACK_BUFFER_EXT, 0 ); } /* The ID is immediately freed for re-use */ _mesa_remove_buffer_object(ctx, bufObj); bufObj->RefCount--; if (bufObj->RefCount <= 0) { ASSERT(ctx->Array.ArrayBufferObj != bufObj); ASSERT(ctx->Array.ElementArrayBufferObj != bufObj); ASSERT(ctx->Array.Vertex.BufferObj != bufObj); ASSERT(ctx->Driver.DeleteBuffer); ctx->Driver.DeleteBuffer(ctx, bufObj); } } } } _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); } /** * Generate a set of unique buffer object IDs and store them in \c buffer. * * \param n Number of IDs to generate. * \param buffer Array of \c n locations to store the IDs. */ void GLAPIENTRY _mesa_GenBuffersARB(GLsizei n, GLuint *buffer) { GET_CURRENT_CONTEXT(ctx); GLuint first; GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx); if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glGenBuffersARB"); return; } if (!buffer) { return; } /* * This must be atomic (generation and allocation of buffer object IDs) */ _glthread_LOCK_MUTEX(ctx->Shared->Mutex); first = _mesa_HashFindFreeKeyBlock(ctx->Shared->BufferObjects, n); /* Allocate new, empty buffer objects and return identifiers */ for (i = 0; i < n; i++) { struct gl_buffer_object *bufObj; GLuint name = first + i; GLenum target = 0; bufObj = (*ctx->Driver.NewBufferObject)( ctx, name, target ); if (!bufObj) { _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenBuffersARB"); return; } _mesa_save_buffer_object(ctx, bufObj); buffer[i] = first + i; } _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); } /** * Determine if ID is the name of a buffer object. * * \param id ID of the potential buffer object. * \return \c GL_TRUE if \c id is the name of a buffer object, * \c GL_FALSE otherwise. */ GLboolean GLAPIENTRY _mesa_IsBufferARB(GLuint id) { struct gl_buffer_object * bufObj; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (id == 0) return GL_FALSE; _glthread_LOCK_MUTEX(ctx->Shared->Mutex); bufObj = (struct gl_buffer_object *) _mesa_HashLookup(ctx->Shared->BufferObjects, id); _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); return bufObj ? GL_TRUE : GL_FALSE; } void GLAPIENTRY _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *bufObj; ASSERT_OUTSIDE_BEGIN_END(ctx); if (size < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glBufferDataARB(size < 0)"); return; } switch (usage) { case GL_STREAM_DRAW_ARB: case GL_STREAM_READ_ARB: case GL_STREAM_COPY_ARB: case GL_STATIC_DRAW_ARB: case GL_STATIC_READ_ARB: case GL_STATIC_COPY_ARB: case GL_DYNAMIC_DRAW_ARB: case GL_DYNAMIC_READ_ARB: case GL_DYNAMIC_COPY_ARB: /* OK */ break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glBufferDataARB(usage)"); return; } bufObj = buffer_object_get_target( ctx, target, "BufferDataARB" ); if (!bufObj || bufObj->Name ==0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB" ); return; } if (bufObj->Pointer) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB(buffer is mapped)" ); return; } ASSERT(ctx->Driver.BufferData); /* Give the buffer object to the driver! may be null! */ (*ctx->Driver.BufferData)( ctx, target, size, data, usage, bufObj ); } void GLAPIENTRY _mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *bufObj; ASSERT_OUTSIDE_BEGIN_END(ctx); bufObj = buffer_object_subdata_range_good( ctx, target, offset, size, "BufferSubDataARB" ); if (!bufObj) { /* error already recorded */ return; } ASSERT(ctx->Driver.BufferSubData); (*ctx->Driver.BufferSubData)( ctx, target, offset, size, data, bufObj ); } void GLAPIENTRY _mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *bufObj; ASSERT_OUTSIDE_BEGIN_END(ctx); bufObj = buffer_object_subdata_range_good( ctx, target, offset, size, "GetBufferSubDataARB" ); if (!bufObj) { /* error already recorded */ return; } ASSERT(ctx->Driver.GetBufferSubData); (*ctx->Driver.GetBufferSubData)( ctx, target, offset, size, data, bufObj ); } void * GLAPIENTRY _mesa_MapBufferARB(GLenum target, GLenum access) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object * bufObj; ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL); switch (access) { case GL_READ_ONLY_ARB: case GL_WRITE_ONLY_ARB: case GL_READ_WRITE_ARB: /* OK */ break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(access)"); return NULL; } bufObj = buffer_object_get_target( ctx, target, "MapBufferARB" ); if (!bufObj || bufObj->Name == 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB" ); return NULL; } if (bufObj->Pointer) { _mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB(already mapped)"); return NULL; } ASSERT(ctx->Driver.MapBuffer); bufObj->Pointer = (*ctx->Driver.MapBuffer)( ctx, target, access, bufObj ); if (!bufObj->Pointer) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(access)"); } bufObj->Access = access; return bufObj->Pointer; } GLboolean GLAPIENTRY _mesa_UnmapBufferARB(GLenum target) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *bufObj; GLboolean status = GL_TRUE; ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); bufObj = buffer_object_get_target( ctx, target, "UnmapBufferARB" ); if (!bufObj || bufObj->Name == 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB" ); return GL_FALSE; } if (!bufObj->Pointer) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB"); return GL_FALSE; } if (ctx->Driver.UnmapBuffer) { status = (*ctx->Driver.UnmapBuffer)( ctx, target, bufObj ); } bufObj->Access = GL_READ_WRITE_ARB; /* initial value, OK? */ bufObj->Pointer = NULL; return status; } void GLAPIENTRY _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *bufObj; ASSERT_OUTSIDE_BEGIN_END(ctx); bufObj = buffer_object_get_target( ctx, target, "GetBufferParameterivARB" ); if (!bufObj || bufObj->Name == 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "GetBufferParameterivARB" ); return; } switch (pname) { case GL_BUFFER_SIZE_ARB: *params = (GLint) bufObj->Size; break; case GL_BUFFER_USAGE_ARB: *params = bufObj->Usage; break; case GL_BUFFER_ACCESS_ARB: *params = bufObj->Access; break; case GL_BUFFER_MAPPED_ARB: *params = (bufObj->Pointer != NULL); break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(pname)"); return; } } void GLAPIENTRY _mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object * bufObj; ASSERT_OUTSIDE_BEGIN_END(ctx); if (pname != GL_BUFFER_MAP_POINTER_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointervARB(pname)"); return; } bufObj = buffer_object_get_target( ctx, target, "GetBufferPointervARB" ); if (!bufObj || bufObj->Name == 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferPointervARB" ); return; } *params = bufObj->Pointer; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/bufferobj.h0000644000000000000000000000743313614532424020265 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef BUFFEROBJ_H #define BUFFEROBJ_H #include "context.h" /* * Internal functions */ extern void _mesa_init_buffer_objects( GLcontext *ctx ); extern struct gl_buffer_object * _mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target ); extern void _mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ); extern void _mesa_initialize_buffer_object( struct gl_buffer_object *obj, GLuint name, GLenum target ); extern void _mesa_save_buffer_object( GLcontext *ctx, struct gl_buffer_object *obj ); extern void _mesa_remove_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ); extern void _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage, struct gl_buffer_object * bufObj ); extern void _mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data, struct gl_buffer_object * bufObj ); extern void _mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data, struct gl_buffer_object * bufObj ); extern void * _mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access, struct gl_buffer_object * bufObj ); extern GLboolean _mesa_buffer_unmap( GLcontext *ctx, GLenum target, struct gl_buffer_object * bufObj ); extern GLboolean _mesa_validate_pbo_access(GLuint dimensions, const struct gl_pixelstore_attrib *pack, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *ptr); /* * API functions */ extern void GLAPIENTRY _mesa_BindBufferARB(GLenum target, GLuint buffer); extern void GLAPIENTRY _mesa_DeleteBuffersARB(GLsizei n, const GLuint * buffer); extern void GLAPIENTRY _mesa_GenBuffersARB(GLsizei n, GLuint * buffer); extern GLboolean GLAPIENTRY _mesa_IsBufferARB(GLuint buffer); extern void GLAPIENTRY _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); extern void GLAPIENTRY _mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); extern void GLAPIENTRY _mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data); extern void * GLAPIENTRY _mesa_MapBufferARB(GLenum target, GLenum access); extern GLboolean GLAPIENTRY _mesa_UnmapBufferARB(GLenum target); extern void GLAPIENTRY _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/buffers.c0000644000000000000000000005046013614532424017746 0ustar /** * \file buffers.c * Frame buffer management. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "buffers.h" #include "colormac.h" #include "context.h" #include "enums.h" #include "fbobject.h" #include "state.h" #define BAD_MASK ~0u #if _HAVE_FULL_GL void GLAPIENTRY _mesa_ClearIndex( GLfloat c ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Color.ClearIndex == (GLuint) c) return; FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.ClearIndex = (GLuint) c; if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) { /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */ (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex ); } } #endif /** * Specify the clear values for the color buffers. * * \param red red color component. * \param green green color component. * \param blue blue color component. * \param alpha alpha component. * * \sa glClearColor(). * * Clamps the parameters and updates gl_colorbuffer_attrib::ClearColor. On a * change, flushes the vertices and notifies the driver via the * dd_function_table::ClearColor callback. */ void GLAPIENTRY _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { GLfloat tmp[4]; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); tmp[0] = CLAMP(red, 0.0F, 1.0F); tmp[1] = CLAMP(green, 0.0F, 1.0F); tmp[2] = CLAMP(blue, 0.0F, 1.0F); tmp[3] = CLAMP(alpha, 0.0F, 1.0F); if (TEST_EQ_4V(tmp, ctx->Color.ClearColor)) return; /* no change */ FLUSH_VERTICES(ctx, _NEW_COLOR); COPY_4V(ctx->Color.ClearColor, tmp); if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) { /* it's OK to call glClearColor in CI mode but it should be a NOP */ (*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor); } } /** * Clear buffers. * * \param mask bit-mask indicating the buffers to be cleared. * * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin, * etc. If the rasterization mode is set to GL_RENDER then requests the driver * to clear the buffers, via the dd_function_table::Clear callback. */ void GLAPIENTRY _mesa_Clear( GLbitfield mask ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glClear 0x%x\n", mask); if (mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_ACCUM_BUFFER_BIT)) { /* invalid bit set */ _mesa_error( ctx, GL_INVALID_VALUE, "glClear(0x%x)", mask); return; } if (ctx->NewState) { _mesa_update_state( ctx ); /* update _Xmin, etc */ } if (ctx->RenderMode == GL_RENDER) { const GLint x = ctx->DrawBuffer->_Xmin; const GLint y = ctx->DrawBuffer->_Ymin; const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; GLbitfield bufferMask; /* don't clear depth buffer if depth writing disabled */ if (!ctx->Depth.Mask) mask &= ~GL_DEPTH_BUFFER_BIT; /* Build the bitmask to send to device driver's Clear function. * Note that the GL_COLOR_BUFFER_BIT flag will expand to 0, 1, 2 or 4 * of the BUFFER_BIT_FRONT/BACK_LEFT/RIGHT flags, or one of the * BUFFER_BIT_COLORn flags. */ bufferMask = 0; if (mask & GL_COLOR_BUFFER_BIT) { bufferMask |= ctx->DrawBuffer->_ColorDrawBufferMask[0]; } if ((mask & GL_DEPTH_BUFFER_BIT) && ctx->DrawBuffer->Visual.haveDepthBuffer) { bufferMask |= BUFFER_BIT_DEPTH; } if ((mask & GL_STENCIL_BUFFER_BIT) && ctx->DrawBuffer->Visual.haveStencilBuffer) { bufferMask |= BUFFER_BIT_STENCIL; } if ((mask & GL_ACCUM_BUFFER_BIT) && ctx->DrawBuffer->Visual.haveAccumBuffer) { bufferMask |= BUFFER_BIT_ACCUM; } ASSERT(ctx->Driver.Clear); ctx->Driver.Clear( ctx, bufferMask, (GLboolean) !ctx->Scissor.Enabled, x, y, width, height ); } } /** * Return bitmask of BUFFER_BIT_* flags indicating which color buffers are * available to the rendering context. * This depends on the framebuffer we're writing to. For window system * framebuffers we look at the framebuffer's visual. But for user- * create framebuffers we look at the number of supported color attachments. */ static GLuint supported_buffer_bitmask(const GLcontext *ctx, GLuint framebufferID) { GLuint mask = 0x0; GLint i; if (framebufferID > 0) { /* A user-created renderbuffer */ ASSERT(ctx->Extensions.EXT_framebuffer_object); for (i = 0; i < ctx->Const.MaxColorAttachments; i++) { mask |= (BUFFER_BIT_COLOR0 << i); } } else { /* A window system renderbuffer */ mask = BUFFER_BIT_FRONT_LEFT; /* always have this */ if (ctx->Visual.stereoMode) { mask |= BUFFER_BIT_FRONT_RIGHT; if (ctx->Visual.doubleBufferMode) { mask |= BUFFER_BIT_BACK_LEFT | BUFFER_BIT_BACK_RIGHT; } } else if (ctx->Visual.doubleBufferMode) { mask |= BUFFER_BIT_BACK_LEFT; } for (i = 0; i < ctx->Visual.numAuxBuffers; i++) { mask |= (BUFFER_BIT_AUX0 << i); } } return mask; } /** * Helper routine used by glDrawBuffer and glDrawBuffersARB. * Given a GLenum naming one or more color buffers (such as * GL_FRONT_AND_BACK), return the corresponding bitmask of BUFFER_BIT_* flags. */ static GLuint draw_buffer_enum_to_bitmask(GLenum buffer) { switch (buffer) { case GL_NONE: return 0; case GL_FRONT: return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT; case GL_BACK: return BUFFER_BIT_BACK_LEFT | BUFFER_BIT_BACK_RIGHT; case GL_RIGHT: return BUFFER_BIT_FRONT_RIGHT | BUFFER_BIT_BACK_RIGHT; case GL_FRONT_RIGHT: return BUFFER_BIT_FRONT_RIGHT; case GL_BACK_RIGHT: return BUFFER_BIT_BACK_RIGHT; case GL_BACK_LEFT: return BUFFER_BIT_BACK_LEFT; case GL_FRONT_AND_BACK: return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT | BUFFER_BIT_FRONT_RIGHT | BUFFER_BIT_BACK_RIGHT; case GL_LEFT: return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT; case GL_FRONT_LEFT: return BUFFER_BIT_FRONT_LEFT; case GL_AUX0: return BUFFER_BIT_AUX0; case GL_AUX1: return BUFFER_BIT_AUX1; case GL_AUX2: return BUFFER_BIT_AUX2; case GL_AUX3: return BUFFER_BIT_AUX3; case GL_COLOR_ATTACHMENT0_EXT: return BUFFER_BIT_COLOR0; case GL_COLOR_ATTACHMENT1_EXT: return BUFFER_BIT_COLOR1; case GL_COLOR_ATTACHMENT2_EXT: return BUFFER_BIT_COLOR2; case GL_COLOR_ATTACHMENT3_EXT: return BUFFER_BIT_COLOR3; default: /* error */ return BAD_MASK; } } /** * Helper routine used by glReadBuffer. * Given a GLenum naming (a) color buffer(s), return the corresponding * bitmask of DD_* flags. */ static GLuint read_buffer_enum_to_bitmask(GLenum buffer) { switch (buffer) { case GL_FRONT: return BUFFER_BIT_FRONT_LEFT; case GL_BACK: return BUFFER_BIT_BACK_LEFT; case GL_RIGHT: return BUFFER_BIT_FRONT_RIGHT; case GL_FRONT_RIGHT: return BUFFER_BIT_FRONT_RIGHT; case GL_BACK_RIGHT: return BUFFER_BIT_BACK_RIGHT; case GL_BACK_LEFT: return BUFFER_BIT_BACK_LEFT; case GL_LEFT: return BUFFER_BIT_FRONT_LEFT; case GL_FRONT_LEFT: return BUFFER_BIT_FRONT_LEFT; case GL_AUX0: return BUFFER_BIT_AUX0; case GL_AUX1: return BUFFER_BIT_AUX1; case GL_AUX2: return BUFFER_BIT_AUX2; case GL_AUX3: return BUFFER_BIT_AUX3; case GL_COLOR_ATTACHMENT0_EXT: return BUFFER_BIT_COLOR0; case GL_COLOR_ATTACHMENT1_EXT: return BUFFER_BIT_COLOR1; case GL_COLOR_ATTACHMENT2_EXT: return BUFFER_BIT_COLOR2; case GL_COLOR_ATTACHMENT3_EXT: return BUFFER_BIT_COLOR3; default: /* error */ return BAD_MASK; } } /** * Specify which color buffers to draw into. * * \param buffer color buffer, such as GL_LEFT or GL_FRONT_AND_BACK. * * Flushes the vertices and verifies the parameter and updates the * gl_colorbuffer_attrib::_DrawDestMask bitfield. Marks new color state in * __GLcontextRec::NewState and notifies the driver via the * dd_function_table::DrawBuffer callback. */ void GLAPIENTRY _mesa_DrawBuffer(GLenum buffer) { GLuint bufferID; GLuint destMask; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex... */ if (MESA_VERBOSE & VERBOSE_API) { _mesa_debug(ctx, "glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(buffer)); } bufferID = ctx->DrawBuffer->Name; if (buffer == GL_NONE) { destMask = 0x0; } else { const GLuint supportedMask = supported_buffer_bitmask(ctx, bufferID); destMask = draw_buffer_enum_to_bitmask(buffer); if (destMask == BAD_MASK) { /* totally bogus buffer */ _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffer(buffer)"); return; } destMask &= supportedMask; if (destMask == 0x0) { /* none of the named color buffers exist! */ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffer(buffer)"); return; } } /* if we get here, there's no error so set new state */ _mesa_drawbuffers(ctx, 1, &buffer, &destMask); } /** * Called by glDrawBuffersARB; specifies the destination color buffers * for N fragment program color outputs. * * XXX This function is called by _mesa_PopAttrib() and we need to do * some more work to deal with the current framebuffer binding state! */ void GLAPIENTRY _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers) { GLint output; GLuint usedBufferMask, supportedMask; GLuint bufferID; GLuint destMask[MAX_DRAW_BUFFERS]; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (!ctx->Extensions.ARB_draw_buffers) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffersARB"); return; } if (n < 1 || n > (GLsizei) ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "glDrawBuffersARB(n)"); return; } bufferID = ctx->DrawBuffer->Name; supportedMask = supported_buffer_bitmask(ctx, bufferID); usedBufferMask = 0x0; /* complicated error checking... */ for (output = 0; output < n; output++) { if (buffers[output] == GL_NONE) { destMask[output] = 0x0; } else { destMask[output] = draw_buffer_enum_to_bitmask(buffers[output]); if (destMask[output] == BAD_MASK || _mesa_bitcount(destMask[output]) > 1) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffersARB(buffer)"); return; } destMask[output] &= supportedMask; if (destMask[output] == 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffersARB(unsupported buffer)"); return; } if (destMask[output] & usedBufferMask) { /* can't specify a dest buffer more than once! */ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffersARB(duplicated buffer)"); return; } /* update bitmask */ usedBufferMask |= destMask[output]; } } /* OK, if we get here, there were no errors so set the new state */ _mesa_drawbuffers(ctx, n, buffers, destMask); } /** * Set color output state. Traditionally, there was only one color * output, but fragment programs can now have several distinct color * outputs (see GL_ARB_draw_buffers). This function sets the state * for one such color output. */ static void set_color_output(GLcontext *ctx, GLuint output, GLenum buffer, GLuint destMask) { struct gl_framebuffer *fb = ctx->DrawBuffer; ASSERT(output < ctx->Const.MaxDrawBuffers); fb->ColorDrawBuffer[output] = buffer; fb->_ColorDrawBufferMask[output] = destMask; if (fb->Name == 0) { /* Set traditional state var */ ctx->Color.DrawBuffer[output] = buffer; } /* not really needed, will be set later */ fb->_NumColorDrawBuffers[output] = 0; } /** * Helper routine used by _mesa_DrawBuffer, _mesa_DrawBuffersARB and * _mesa_PopAttrib to set drawbuffer state. */ void _mesa_drawbuffers(GLcontext *ctx, GLsizei n, const GLenum *buffers, const GLuint *destMask) { GLuint mask[MAX_DRAW_BUFFERS]; GLint output; if (!destMask) { /* compute destMask values now */ const GLuint bufferID = ctx->DrawBuffer->Name; const GLuint supportedMask = supported_buffer_bitmask(ctx, bufferID); for (output = 0; output < n; output++) { mask[output] = draw_buffer_enum_to_bitmask(buffers[output]); ASSERT(mask[output] != BAD_MASK); mask[output] &= supportedMask; } destMask = mask; } for (output = 0; output < n; output++) { set_color_output(ctx, output, buffers[output], destMask[output]); } /* set remaining color outputs to NONE */ for (output = n; output < ctx->Const.MaxDrawBuffers; output++) { set_color_output(ctx, output, GL_NONE, 0x0); } ctx->NewState |= _NEW_COLOR; /* * Call device driver function. */ if (ctx->Driver.DrawBuffers) ctx->Driver.DrawBuffers(ctx, n, buffers); else if (ctx->Driver.DrawBuffer) ctx->Driver.DrawBuffer(ctx, buffers[0]); } /** * Set the color buffer source for reading pixels. * * \param mode color buffer. * * \sa glReadBuffer(). * */ void GLAPIENTRY _mesa_ReadBuffer(GLenum buffer) { struct gl_framebuffer *fb; GLuint srcMask, supportedMask; GLuint bufferID; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); fb = ctx->ReadBuffer; bufferID = fb->Name; if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer)); if (bufferID > 0 && buffer == GL_NONE) { /* legal! */ srcMask = 0x0; } else { /* general case */ srcMask = read_buffer_enum_to_bitmask(buffer); if (srcMask == BAD_MASK) { _mesa_error(ctx, GL_INVALID_ENUM, "glReadBuffer(buffer)"); return; } supportedMask = supported_buffer_bitmask(ctx, bufferID); if ((srcMask & supportedMask) == 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glReadBuffer(buffer)"); return; } } if (bufferID == 0) { ctx->Pixel.ReadBuffer = buffer; } fb->ColorReadBuffer = buffer; fb->_ColorReadBufferMask = srcMask; ctx->NewState |= _NEW_PIXEL; /* * Call device driver function. */ if (ctx->Driver.ReadBuffer) (*ctx->Driver.ReadBuffer)(ctx, buffer); } #if _HAVE_FULL_GL /** * GL_MESA_resize_buffers extension. * * When this function is called, we'll ask the window system how large * the current window is. If it's a new size, we'll call the driver's * ResizeBuffers function. The driver will then resize its color buffers * as needed, and maybe call the swrast's routine for reallocating * swrast-managed depth/stencil/accum/etc buffers. * \note This function may be called from within Mesa or called by the * user directly (see the GL_MESA_resize_buffers extension). */ void GLAPIENTRY _mesa_ResizeBuffersMESA( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glResizeBuffersMESA\n"); if (ctx->DrawBuffer && ctx->DrawBuffer->Name == 0) { GLuint newWidth, newHeight; GLframebuffer *buffer = ctx->DrawBuffer; /* ask device driver for size of output buffer */ ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight ); /* see if size of device driver's color buffer (window) has changed */ if (buffer->Width != newWidth || buffer->Height != newHeight) { if (ctx->Driver.ResizeBuffers) ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight ); } } if (ctx->ReadBuffer && ctx->ReadBuffer != ctx->DrawBuffer && ctx->ReadBuffer->Name == 0) { GLuint newWidth, newHeight; GLframebuffer *buffer = ctx->ReadBuffer; /* ask device driver for size of read buffer */ ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight ); /* see if size of device driver's color buffer (window) has changed */ if (buffer->Width != newWidth || buffer->Height != newHeight) { if (ctx->Driver.ResizeBuffers) ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight ); } } ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */ } /* * XXX move somewhere else someday? */ void GLAPIENTRY _mesa_SampleCoverageARB(GLclampf value, GLboolean invert) { GET_CURRENT_CONTEXT(ctx); if (!ctx->Extensions.ARB_multisample) { _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleCoverageARB"); return; } ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0); ctx->Multisample.SampleCoverageInvert = invert; ctx->NewState |= _NEW_MULTISAMPLE; } #endif /* _HAVE_FULL_GL */ /** * Define the scissor box. * * \param x, y coordinates of the scissor box lower-left corner. * \param width width of the scissor box. * \param height height of the scissor box. * * \sa glScissor(). * * Verifies the parameters and updates __GLcontextRec::Scissor. On a * change flushes the vertices and notifies the driver via * the dd_function_table::Scissor callback. */ void GLAPIENTRY _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (width < 0 || height < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" ); return; } if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height); if (x == ctx->Scissor.X && y == ctx->Scissor.Y && width == ctx->Scissor.Width && height == ctx->Scissor.Height) return; FLUSH_VERTICES(ctx, _NEW_SCISSOR); ctx->Scissor.X = x; ctx->Scissor.Y = y; ctx->Scissor.Width = width; ctx->Scissor.Height = height; if (ctx->Driver.Scissor) ctx->Driver.Scissor( ctx, x, y, width, height ); } /**********************************************************************/ /** \name Initialization */ /*@{*/ /** * Initialize the context's scissor state. * \param ctx the GL context. */ void _mesa_init_scissor(GLcontext *ctx) { /* Scissor group */ ctx->Scissor.Enabled = GL_FALSE; ctx->Scissor.X = 0; ctx->Scissor.Y = 0; ctx->Scissor.Width = 0; ctx->Scissor.Height = 0; } /** * Initialize the context's multisample state. * \param ctx the GL context. */ void _mesa_init_multisample(GLcontext *ctx) { ctx->Multisample.Enabled = GL_FALSE; ctx->Multisample.SampleAlphaToCoverage = GL_FALSE; ctx->Multisample.SampleAlphaToOne = GL_FALSE; ctx->Multisample.SampleCoverage = GL_FALSE; ctx->Multisample.SampleCoverageValue = 1.0; ctx->Multisample.SampleCoverageInvert = GL_FALSE; } /*@}*/ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/buffers.h0000644000000000000000000000423513614532424017752 0ustar /** * \file buffers.h * Frame buffer management functions declarations. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef BUFFERS_H #define BUFFERS_H #include "mtypes.h" extern void GLAPIENTRY _mesa_ClearIndex( GLfloat c ); extern void GLAPIENTRY _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); extern void GLAPIENTRY _mesa_Clear( GLbitfield mask ); extern void GLAPIENTRY _mesa_DrawBuffer( GLenum mode ); extern void GLAPIENTRY _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers); extern void _mesa_drawbuffers(GLcontext *ctx, GLsizei n, const GLenum *buffers, const GLuint *destMask); extern void GLAPIENTRY _mesa_ReadBuffer( GLenum mode ); extern void GLAPIENTRY _mesa_ResizeBuffersMESA( void ); extern void GLAPIENTRY _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); extern void GLAPIENTRY _mesa_SampleCoverageARB(GLclampf value, GLboolean invert); extern void _mesa_init_scissor(GLcontext *ctx); extern void _mesa_init_multisample(GLcontext *ctx); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/clip.c0000644000000000000000000001167313614532424017244 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "clip.h" #include "context.h" #include "macros.h" #include "mtypes.h" #include "math/m_xform.h" #include "math/m_matrix.h" /**********************************************************************/ /* Get/Set User clip-planes. */ /**********************************************************************/ void GLAPIENTRY _mesa_ClipPlane( GLenum plane, const GLdouble *eq ) { GET_CURRENT_CONTEXT(ctx); GLint p; GLfloat equation[4]; ASSERT_OUTSIDE_BEGIN_END(ctx); p = (GLint) plane - (GLint) GL_CLIP_PLANE0; if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { _mesa_error( ctx, GL_INVALID_ENUM, "glClipPlane" ); return; } equation[0] = (GLfloat) eq[0]; equation[1] = (GLfloat) eq[1]; equation[2] = (GLfloat) eq[2]; equation[3] = (GLfloat) eq[3]; /* * The equation is transformed by the transpose of the inverse of the * current modelview matrix and stored in the resulting eye coordinates. * * KW: Eqn is then transformed to the current clip space, where user * clipping now takes place. The clip-space equations are recalculated * whenever the projection matrix changes. */ if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); _mesa_transform_vector( equation, equation, ctx->ModelviewMatrixStack.Top->inv ); if (TEST_EQ_4V(ctx->Transform.EyeUserPlane[p], equation)) return; FLUSH_VERTICES(ctx, _NEW_TRANSFORM); COPY_4FV(ctx->Transform.EyeUserPlane[p], equation); /* Update derived state. This state also depends on the projection * matrix, and is recalculated on changes to the projection matrix by * code in _mesa_update_state(). */ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top)) _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); _mesa_transform_vector( ctx->Transform._ClipUserPlane[p], ctx->Transform.EyeUserPlane[p], ctx->ProjectionMatrixStack.Top->inv ); } if (ctx->Driver.ClipPlane) ctx->Driver.ClipPlane( ctx, plane, equation ); } void GLAPIENTRY _mesa_GetClipPlane( GLenum plane, GLdouble *equation ) { GET_CURRENT_CONTEXT(ctx); GLint p; ASSERT_OUTSIDE_BEGIN_END(ctx); p = (GLint) (plane - GL_CLIP_PLANE0); if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetClipPlane" ); return; } equation[0] = (GLdouble) ctx->Transform.EyeUserPlane[p][0]; equation[1] = (GLdouble) ctx->Transform.EyeUserPlane[p][1]; equation[2] = (GLdouble) ctx->Transform.EyeUserPlane[p][2]; equation[3] = (GLdouble) ctx->Transform.EyeUserPlane[p][3]; } void GLAPIENTRY _mesa_CullParameterfvEXT (GLenum cap, GLfloat *v) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); switch (cap) { case GL_CULL_VERTEX_EYE_POSITION_EXT: FLUSH_VERTICES(ctx, _NEW_TRANSFORM); COPY_4FV(ctx->Transform.CullEyePos, v); _mesa_transform_vector( ctx->Transform.CullObjPos, ctx->Transform.CullEyePos, ctx->ModelviewMatrixStack.Top->inv ); break; case GL_CULL_VERTEX_OBJECT_POSITION_EXT: FLUSH_VERTICES(ctx, _NEW_TRANSFORM); COPY_4FV(ctx->Transform.CullObjPos, v); _mesa_transform_vector( ctx->Transform.CullEyePos, ctx->Transform.CullObjPos, ctx->ModelviewMatrixStack.Top->m ); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glCullParameterfvEXT" ); } } void GLAPIENTRY _mesa_CullParameterdvEXT (GLenum cap, GLdouble *v) { GLfloat f[4]; f[0] = (GLfloat)v[0]; f[1] = (GLfloat)v[1]; f[2] = (GLfloat)v[2]; f[3] = (GLfloat)v[3]; _mesa_CullParameterfvEXT(cap, f); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/clip.h0000644000000000000000000000304713614532424017245 0ustar /** * \file clip.h */ /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef CLIP_H #define CLIP_H #include "mtypes.h" extern void GLAPIENTRY _mesa_ClipPlane( GLenum plane, const GLdouble *equation ); extern void GLAPIENTRY _mesa_GetClipPlane( GLenum plane, GLdouble *equation ); extern void GLAPIENTRY _mesa_CullParameterfvEXT (GLenum cap, GLfloat *v); extern void GLAPIENTRY _mesa_CullParameterdvEXT (GLenum cap, GLdouble *v); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/colormac.h0000644000000000000000000001501613614532424020114 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file colormac.h * Color-related macros */ #ifndef COLORMAC_H #define COLORMAC_H #include "imports.h" #include "config.h" #include "macros.h" /** \def BYTE_TO_CHAN * Convert from GLbyte to GLchan */ /** \def UBYTE_TO_CHAN * Convert from GLubyte to GLchan */ /** \def SHORT_TO_CHAN * Convert from GLshort to GLchan */ /** \def USHORT_TO_CHAN * Convert from GLushort to GLchan */ /** \def INT_TO_CHAN * Convert from GLint to GLchan */ /** \def UINT_TO_CHAN * Convert from GLuint to GLchan */ /** \def CHAN_TO_UBYTE * Convert from GLchan to GLubyte */ /** \def CHAN_TO_FLOAT * Convert from GLchan to GLfloat */ /** \def CLAMPED_FLOAT_TO_CHAN * Convert from GLclampf to GLchan */ /** \def UNCLAMPED_FLOAT_TO_CHAN * Convert from GLfloat to GLchan */ /** \def COPY_CHAN4 * Copy a GLchan[4] array */ /** \def CHAN_PRODUCT * Scaled product (usually approximated) between two GLchan arguments */ #if CHAN_BITS == 8 #define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (GLchan) (b)) #define UBYTE_TO_CHAN(b) (b) #define SHORT_TO_CHAN(s) ((s) < 0 ? 0 : (GLchan) ((s) >> 7)) #define USHORT_TO_CHAN(s) ((GLchan) ((s) >> 8)) #define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 23)) #define UINT_TO_CHAN(i) ((GLchan) ((i) >> 24)) #define CHAN_TO_UBYTE(c) (c) #define CHAN_TO_FLOAT(c) UBYTE_TO_FLOAT(c) #define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_UBYTE(c, f) #define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_UBYTE(c, f) #define COPY_CHAN4(DST, SRC) COPY_4UBV(DST, SRC) #define CHAN_PRODUCT(a, b) ((GLubyte) (((GLint)(a) * ((GLint)(b) + 1)) >> 8)) #elif CHAN_BITS == 16 #define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (((GLchan) (b)) * 516)) #define UBYTE_TO_CHAN(b) ((((GLchan) (b)) << 8) | ((GLchan) (b))) #define SHORT_TO_CHAN(s) ((s) < 0 ? 0 : (GLchan) (s)) #define USHORT_TO_CHAN(s) (s) #define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 15)) #define UINT_TO_CHAN(i) ((GLchan) ((i) >> 16)) #define CHAN_TO_UBYTE(c) ((c) >> 8) #define CHAN_TO_FLOAT(c) ((GLfloat) ((c) * (1.0 / CHAN_MAXF))) #define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_USHORT(c, f) #define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_USHORT(c, f) #define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC) #define CHAN_PRODUCT(a, b) ((GLchan) ((((GLuint) (a)) * ((GLuint) (b))) / 65535)) #elif CHAN_BITS == 32 /* XXX floating-point color channels not fully thought-out */ #define BYTE_TO_CHAN(b) ((GLfloat) ((b) * (1.0F / 127.0F))) #define UBYTE_TO_CHAN(b) ((GLfloat) ((b) * (1.0F / 255.0F))) #define SHORT_TO_CHAN(s) ((GLfloat) ((s) * (1.0F / 32767.0F))) #define USHORT_TO_CHAN(s) ((GLfloat) ((s) * (1.0F / 65535.0F))) #define INT_TO_CHAN(i) ((GLfloat) ((i) * (1.0F / 2147483647.0F))) #define UINT_TO_CHAN(i) ((GLfloat) ((i) * (1.0F / 4294967295.0F))) #define CHAN_TO_UBYTE(c) FLOAT_TO_UBYTE(c) #define CHAN_TO_FLOAT(c) (c) #define CLAMPED_FLOAT_TO_CHAN(c, f) c = (f) #define UNCLAMPED_FLOAT_TO_CHAN(c, f) c = (f) #define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC) #define CHAN_PRODUCT(a, b) ((a) * (b)) #else #error unexpected CHAN_BITS size #endif /** * Convert 3 channels at once. * * \param dst pointer to destination GLchan[3] array. * \param f pointer to source GLfloat[3] array. * * \sa #UNCLAMPED_FLOAT_TO_CHAN. */ #define UNCLAMPED_FLOAT_TO_RGB_CHAN(dst, f) \ do { \ UNCLAMPED_FLOAT_TO_CHAN(dst[0], f[0]); \ UNCLAMPED_FLOAT_TO_CHAN(dst[1], f[1]); \ UNCLAMPED_FLOAT_TO_CHAN(dst[2], f[2]); \ } while (0) /** * Convert 4 channels at once. * * \param dst pointer to destination GLchan[4] array. * \param f pointer to source GLfloat[4] array. * * \sa #UNCLAMPED_FLOAT_TO_CHAN. */ #define UNCLAMPED_FLOAT_TO_RGBA_CHAN(dst, f) \ do { \ UNCLAMPED_FLOAT_TO_CHAN(dst[0], f[0]); \ UNCLAMPED_FLOAT_TO_CHAN(dst[1], f[1]); \ UNCLAMPED_FLOAT_TO_CHAN(dst[2], f[2]); \ UNCLAMPED_FLOAT_TO_CHAN(dst[3], f[3]); \ } while (0) /** * \name Generic color packing macros. All inputs should be GLubytes. * * \todo We may move these into texstore.h at some point. */ /*@{*/ #define PACK_COLOR_8888( R, G, B, A ) \ (((R) << 24) | ((G) << 16) | ((B) << 8) | (A)) #define PACK_COLOR_8888_REV( R, G, B, A ) \ (((A) << 24) | ((B) << 16) | ((G) << 8) | (R)) #define PACK_COLOR_888( R, G, B ) \ (((R) << 16) | ((G) << 8) | (B)) #define PACK_COLOR_565( R, G, B ) \ ((((R) & 0xf8) << 8) | (((G) & 0xfc) << 3) | (((B) & 0xf8) >> 3)) #define PACK_COLOR_565_REV( R, G, B ) \ (((R) & 0xf8) | ((G) & 0xe0) >> 5 | (((G) & 0x1c) << 11) | (((B) & 0xf8) << 5)) #define PACK_COLOR_1555( A, B, G, R ) \ ((((B) & 0xf8) << 7) | (((G) & 0xf8) << 2) | (((R) & 0xf8) >> 3) | \ ((A) ? 0x8000 : 0)) #define PACK_COLOR_1555_REV( A, B, G, R ) \ ((((B) & 0xf8) >> 1) | (((G) & 0xc0) >> 6) | (((G) & 0x38) << 10) | (((R) & 0xf8) << 5) | \ ((A) ? 0x80 : 0)) #define PACK_COLOR_4444( R, G, B, A ) \ ((((R) & 0xf0) << 8) | (((G) & 0xf0) << 4) | ((B) & 0xf0) | ((A) >> 4)) #define PACK_COLOR_4444_REV( R, G, B, A ) \ ((((B) & 0xf0) << 8) | (((A) & 0xf0) << 4) | ((R) & 0xf0) | ((G) >> 4)) #define PACK_COLOR_88( L, A ) \ (((L) << 8) | (A)) #define PACK_COLOR_88_REV( L, A ) \ (((A) << 8) | (L)) #define PACK_COLOR_332( R, G, B ) \ (((R) & 0xe0) | (((G) & 0xe0) >> 3) | (((B) & 0xc0) >> 6)) #define PACK_COLOR_233( B, G, R ) \ (((B) & 0xc0) | (((G) & 0xe0) >> 2) | (((R) & 0xe0) >> 5)) /*@}*/ #endif /* COLORMAC_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/colortab.c0000644000000000000000000013745313614532424020127 0ustar /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "bufferobj.h" #include "colortab.h" #include "context.h" #include "image.h" #include "macros.h" #include "state.h" /* * Given an internalFormat token passed to glColorTable, * return the corresponding base format. * Return -1 if invalid token. */ static GLint base_colortab_format( GLenum format ) { switch (format) { case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8: case GL_ALPHA12: case GL_ALPHA16: return GL_ALPHA; case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8: case GL_LUMINANCE12: case GL_LUMINANCE16: return GL_LUMINANCE; case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE6_ALPHA2: case GL_LUMINANCE8_ALPHA8: case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: return GL_LUMINANCE_ALPHA; case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: return GL_INTENSITY; case GL_RGB: case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: return GL_RGB; case GL_RGBA: case GL_RGBA2: case GL_RGBA4: case GL_RGB5_A1: case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: return GL_RGBA; default: return -1; /* error */ } } /* * Examine table's format and set the component sizes accordingly. */ static void set_component_sizes( struct gl_color_table *table ) { GLubyte sz; switch (table->Type) { case GL_UNSIGNED_BYTE: sz = 8 * sizeof(GLubyte); break; case GL_UNSIGNED_SHORT: sz = 8 * sizeof(GLushort); break; case GL_FLOAT: /* Don't actually return 32 here since that causes the conformance * tests to blow up. Conform thinks the component is an integer, * not a float. */ sz = 8; /** 8 * sizeof(GLfloat); **/ break; default: _mesa_problem(NULL, "bad color table type in set_component_sizes 0x%x", table->Type); return; } switch (table->Format) { case GL_ALPHA: table->RedSize = 0; table->GreenSize = 0; table->BlueSize = 0; table->AlphaSize = sz; table->IntensitySize = 0; table->LuminanceSize = 0; break; case GL_LUMINANCE: table->RedSize = 0; table->GreenSize = 0; table->BlueSize = 0; table->AlphaSize = 0; table->IntensitySize = 0; table->LuminanceSize = sz; break; case GL_LUMINANCE_ALPHA: table->RedSize = 0; table->GreenSize = 0; table->BlueSize = 0; table->AlphaSize = sz; table->IntensitySize = 0; table->LuminanceSize = sz; break; case GL_INTENSITY: table->RedSize = 0; table->GreenSize = 0; table->BlueSize = 0; table->AlphaSize = 0; table->IntensitySize = sz; table->LuminanceSize = 0; break; case GL_RGB: table->RedSize = sz; table->GreenSize = sz; table->BlueSize = sz; table->AlphaSize = 0; table->IntensitySize = 0; table->LuminanceSize = 0; break; case GL_RGBA: table->RedSize = sz; table->GreenSize = sz; table->BlueSize = sz; table->AlphaSize = sz; table->IntensitySize = 0; table->LuminanceSize = 0; break; default: _mesa_problem(NULL, "unexpected format in set_component_sizes"); } } /** * Update/replace all or part of a color table. Helper function * used by _mesa_ColorTable() and _mesa_ColorSubTable(). * The table->Table buffer should already be allocated. * \param start first entry to update * \param count number of entries to update * \param format format of user-provided table data * \param type datatype of user-provided table data * \param data user-provided table data * \param [rgba]Scale - RGBA scale factors * \param [rgba]Bias - RGBA bias factors */ static void store_colortable_entries(GLcontext *ctx, struct gl_color_table *table, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data, GLfloat rScale, GLfloat rBias, GLfloat gScale, GLfloat gBias, GLfloat bScale, GLfloat bBias, GLfloat aScale, GLfloat aBias) { if (ctx->Unpack.BufferObj->Name) { /* Get/unpack the color table data from a PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(1, &ctx->Unpack, count, 1, 1, format, type, data)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glColor[Sub]Table(bad PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, ctx->Unpack.BufferObj); if (!buf) { _mesa_error(ctx, GL_INVALID_OPERATION, "glColor[Sub]Table(PBO mapped)"); return; } data = ADD_POINTERS(buf, data); } if (table->Type == GL_FLOAT) { /* convert user-provided data to GLfloat values */ GLfloat tempTab[MAX_COLOR_TABLE_SIZE * 4]; GLfloat *tableF; GLint i; _mesa_unpack_color_span_float(ctx, count, /* number of pixels */ table->Format, /* dest format */ tempTab, /* dest address */ format, type, /* src format/type */ data, /* src data */ &ctx->Unpack, IMAGE_CLAMP_BIT); /* transfer ops */ /* the destination */ tableF = (GLfloat *) table->Table; /* Apply scale & bias & clamp now */ switch (table->Format) { case GL_INTENSITY: for (i = 0; i < count; i++) { GLuint j = start + i; tableF[j] = CLAMP(tempTab[i] * rScale + rBias, 0.0F, 1.0F); } break; case GL_LUMINANCE: for (i = 0; i < count; i++) { GLuint j = start + i; tableF[j] = CLAMP(tempTab[i] * rScale + rBias, 0.0F, 1.0F); } break; case GL_ALPHA: for (i = 0; i < count; i++) { GLuint j = start + i; tableF[j] = CLAMP(tempTab[i] * aScale + aBias, 0.0F, 1.0F); } break; case GL_LUMINANCE_ALPHA: for (i = 0; i < count; i++) { GLuint j = start + i; tableF[j*2+0] = CLAMP(tempTab[i*2+0] * rScale + rBias, 0.0F, 1.0F); tableF[j*2+1] = CLAMP(tempTab[i*2+1] * aScale + aBias, 0.0F, 1.0F); } break; case GL_RGB: for (i = 0; i < count; i++) { GLuint j = start + i; tableF[j*3+0] = CLAMP(tempTab[i*3+0] * rScale + rBias, 0.0F, 1.0F); tableF[j*3+1] = CLAMP(tempTab[i*3+1] * gScale + gBias, 0.0F, 1.0F); tableF[j*3+2] = CLAMP(tempTab[i*3+2] * bScale + bBias, 0.0F, 1.0F); } break; case GL_RGBA: for (i = 0; i < count; i++) { GLuint j = start + i; tableF[j*4+0] = CLAMP(tempTab[i*4+0] * rScale + rBias, 0.0F, 1.0F); tableF[j*4+1] = CLAMP(tempTab[i*4+1] * gScale + gBias, 0.0F, 1.0F); tableF[j*4+2] = CLAMP(tempTab[i*4+2] * bScale + bBias, 0.0F, 1.0F); tableF[j*4+3] = CLAMP(tempTab[i*4+3] * aScale + aBias, 0.0F, 1.0F); } break; default: _mesa_problem(ctx, "Bad format in store_colortable_entries"); return; } } else { /* non-float (GLchan) */ const GLint comps = _mesa_components_in_format(table->Format); GLchan *dest = (GLchan *) table->Table + start * comps; _mesa_unpack_color_span_chan(ctx, count, /* number of entries */ table->Format, /* dest format */ dest, /* dest address */ format, type, data, /* src data */ &ctx->Unpack, 0); /* transfer ops */ } if (ctx->Unpack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, ctx->Unpack.BufferObj); } } void GLAPIENTRY _mesa_ColorTable( GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_object *texObj = NULL; struct gl_color_table *table = NULL; GLboolean proxy = GL_FALSE; GLint baseFormat; GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0; GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0; GLenum tableType = CHAN_TYPE; GLint comps; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */ switch (target) { case GL_TEXTURE_1D: texObj = texUnit->Current1D; table = &texObj->Palette; break; case GL_TEXTURE_2D: texObj = texUnit->Current2D; table = &texObj->Palette; break; case GL_TEXTURE_3D: texObj = texUnit->Current3D; table = &texObj->Palette; break; case GL_TEXTURE_CUBE_MAP_ARB: if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); return; } texObj = texUnit->CurrentCubeMap; table = &texObj->Palette; break; case GL_PROXY_TEXTURE_1D: texObj = ctx->Texture.Proxy1D; table = &texObj->Palette; proxy = GL_TRUE; break; case GL_PROXY_TEXTURE_2D: texObj = ctx->Texture.Proxy2D; table = &texObj->Palette; proxy = GL_TRUE; break; case GL_PROXY_TEXTURE_3D: texObj = ctx->Texture.Proxy3D; table = &texObj->Palette; proxy = GL_TRUE; break; case GL_PROXY_TEXTURE_CUBE_MAP_ARB: if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); return; } texObj = ctx->Texture.ProxyCubeMap; table = &texObj->Palette; break; case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; tableType = GL_FLOAT; break; case GL_COLOR_TABLE: table = &ctx->ColorTable; tableType = GL_FLOAT; rScale = ctx->Pixel.ColorTableScale[0]; gScale = ctx->Pixel.ColorTableScale[1]; bScale = ctx->Pixel.ColorTableScale[2]; aScale = ctx->Pixel.ColorTableScale[3]; rBias = ctx->Pixel.ColorTableBias[0]; gBias = ctx->Pixel.ColorTableBias[1]; bBias = ctx->Pixel.ColorTableBias[2]; aBias = ctx->Pixel.ColorTableBias[3]; break; case GL_PROXY_COLOR_TABLE: table = &ctx->ProxyColorTable; proxy = GL_TRUE; break; case GL_TEXTURE_COLOR_TABLE_SGI: if (!ctx->Extensions.SGI_texture_color_table) { _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); return; } table = &(texUnit->ColorTable); tableType = GL_FLOAT; rScale = ctx->Pixel.TextureColorTableScale[0]; gScale = ctx->Pixel.TextureColorTableScale[1]; bScale = ctx->Pixel.TextureColorTableScale[2]; aScale = ctx->Pixel.TextureColorTableScale[3]; rBias = ctx->Pixel.TextureColorTableBias[0]; gBias = ctx->Pixel.TextureColorTableBias[1]; bBias = ctx->Pixel.TextureColorTableBias[2]; aBias = ctx->Pixel.TextureColorTableBias[3]; break; case GL_PROXY_TEXTURE_COLOR_TABLE_SGI: if (!ctx->Extensions.SGI_texture_color_table) { _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); return; } table = &(texUnit->ProxyColorTable); tableType = GL_FLOAT; proxy = GL_TRUE; break; case GL_POST_CONVOLUTION_COLOR_TABLE: table = &ctx->PostConvolutionColorTable; tableType = GL_FLOAT; rScale = ctx->Pixel.PCCTscale[0]; gScale = ctx->Pixel.PCCTscale[1]; bScale = ctx->Pixel.PCCTscale[2]; aScale = ctx->Pixel.PCCTscale[3]; rBias = ctx->Pixel.PCCTbias[0]; gBias = ctx->Pixel.PCCTbias[1]; bBias = ctx->Pixel.PCCTbias[2]; aBias = ctx->Pixel.PCCTbias[3]; break; case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: table = &ctx->ProxyPostConvolutionColorTable; tableType = GL_FLOAT; proxy = GL_TRUE; break; case GL_POST_COLOR_MATRIX_COLOR_TABLE: table = &ctx->PostColorMatrixColorTable; tableType = GL_FLOAT; rScale = ctx->Pixel.PCMCTscale[0]; gScale = ctx->Pixel.PCMCTscale[1]; bScale = ctx->Pixel.PCMCTscale[2]; aScale = ctx->Pixel.PCMCTscale[3]; rBias = ctx->Pixel.PCMCTbias[0]; gBias = ctx->Pixel.PCMCTbias[1]; bBias = ctx->Pixel.PCMCTbias[2]; aBias = ctx->Pixel.PCMCTbias[3]; break; case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: table = &ctx->ProxyPostColorMatrixColorTable; tableType = GL_FLOAT; proxy = GL_TRUE; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); return; } assert(table); if (!_mesa_is_legal_format_and_type(ctx, format, type) || format == GL_INTENSITY) { _mesa_error(ctx, GL_INVALID_OPERATION, "glColorTable(format or type)"); return; } baseFormat = base_colortab_format(internalFormat); if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(internalFormat)"); return; } if (width < 0 || (width != 0 && _mesa_bitcount(width) != 1)) { /* error */ if (proxy) { table->Size = 0; table->IntFormat = (GLenum) 0; table->Format = (GLenum) 0; } else { _mesa_error(ctx, GL_INVALID_VALUE, "glColorTable(width=%d)", width); } return; } if (width > (GLsizei) ctx->Const.MaxColorTableSize) { if (proxy) { table->Size = 0; table->IntFormat = (GLenum) 0; table->Format = (GLenum) 0; } else { _mesa_error(ctx, GL_TABLE_TOO_LARGE, "glColorTable(width)"); } return; } table->Size = width; table->IntFormat = internalFormat; table->Format = (GLenum) baseFormat; table->Type = (tableType == GL_FLOAT) ? GL_FLOAT : CHAN_TYPE; comps = _mesa_components_in_format(table->Format); assert(comps > 0); /* error should have been caught sooner */ if (!proxy) { /* free old table, if any */ if (table->Table) { FREE(table->Table); table->Table = NULL; } if (width > 0) { if (table->Type == GL_FLOAT) { table->Table = MALLOC(comps * width * sizeof(GLfloat)); } else { table->Table = MALLOC(comps * width * sizeof(GLchan)); } if (!table->Table) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorTable"); return; } store_colortable_entries(ctx, table, 0, width, /* start, count */ format, type, data, rScale, rBias, gScale, gBias, bScale, bBias, aScale, aBias); } } /* proxy */ /* do this after the table's Type and Format are set */ set_component_sizes(table); if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) { /* texture object palette, texObj==NULL means the shared palette */ if (ctx->Driver.UpdateTexturePalette) { (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); } } ctx->NewState |= _NEW_PIXEL; } void GLAPIENTRY _mesa_ColorSubTable( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_object *texObj = NULL; struct gl_color_table *table = NULL; GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0; GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { case GL_TEXTURE_1D: texObj = texUnit->Current1D; table = &texObj->Palette; break; case GL_TEXTURE_2D: texObj = texUnit->Current2D; table = &texObj->Palette; break; case GL_TEXTURE_3D: texObj = texUnit->Current3D; table = &texObj->Palette; break; case GL_TEXTURE_CUBE_MAP_ARB: if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); return; } texObj = texUnit->CurrentCubeMap; table = &texObj->Palette; break; case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; break; case GL_COLOR_TABLE: table = &ctx->ColorTable; rScale = ctx->Pixel.ColorTableScale[0]; gScale = ctx->Pixel.ColorTableScale[1]; bScale = ctx->Pixel.ColorTableScale[2]; aScale = ctx->Pixel.ColorTableScale[3]; rBias = ctx->Pixel.ColorTableBias[0]; gBias = ctx->Pixel.ColorTableBias[1]; bBias = ctx->Pixel.ColorTableBias[2]; aBias = ctx->Pixel.ColorTableBias[3]; break; case GL_TEXTURE_COLOR_TABLE_SGI: if (!ctx->Extensions.SGI_texture_color_table) { _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); return; } table = &(texUnit->ColorTable); rScale = ctx->Pixel.TextureColorTableScale[0]; gScale = ctx->Pixel.TextureColorTableScale[1]; bScale = ctx->Pixel.TextureColorTableScale[2]; aScale = ctx->Pixel.TextureColorTableScale[3]; rBias = ctx->Pixel.TextureColorTableBias[0]; gBias = ctx->Pixel.TextureColorTableBias[1]; bBias = ctx->Pixel.TextureColorTableBias[2]; aBias = ctx->Pixel.TextureColorTableBias[3]; break; case GL_POST_CONVOLUTION_COLOR_TABLE: table = &ctx->PostConvolutionColorTable; rScale = ctx->Pixel.PCCTscale[0]; gScale = ctx->Pixel.PCCTscale[1]; bScale = ctx->Pixel.PCCTscale[2]; aScale = ctx->Pixel.PCCTscale[3]; rBias = ctx->Pixel.PCCTbias[0]; gBias = ctx->Pixel.PCCTbias[1]; bBias = ctx->Pixel.PCCTbias[2]; aBias = ctx->Pixel.PCCTbias[3]; break; case GL_POST_COLOR_MATRIX_COLOR_TABLE: table = &ctx->PostColorMatrixColorTable; rScale = ctx->Pixel.PCMCTscale[0]; gScale = ctx->Pixel.PCMCTscale[1]; bScale = ctx->Pixel.PCMCTscale[2]; aScale = ctx->Pixel.PCMCTscale[3]; rBias = ctx->Pixel.PCMCTbias[0]; gBias = ctx->Pixel.PCMCTbias[1]; bBias = ctx->Pixel.PCMCTbias[2]; aBias = ctx->Pixel.PCMCTbias[3]; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); return; } assert(table); if (!_mesa_is_legal_format_and_type(ctx, format, type) || format == GL_INTENSITY) { _mesa_error(ctx, GL_INVALID_OPERATION, "glColorSubTable(format or type)"); return; } if (count < 1) { _mesa_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)"); return; } /* error should have been caught sooner */ assert(_mesa_components_in_format(table->Format) > 0); if (start + count > (GLint) table->Size) { _mesa_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)"); return; } if (!table->Table) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorSubTable"); return; } store_colortable_entries(ctx, table, start, count, format, type, data, rScale, rBias, gScale, gBias, bScale, bBias, aScale, aBias); if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) { /* per-texture object palette */ if (ctx->Driver.UpdateTexturePalette) { (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); } } ctx->NewState |= _NEW_PIXEL; } void GLAPIENTRY _mesa_CopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* Select buffer to read from */ ctx->Driver.CopyColorTable( ctx, target, internalformat, x, y, width ); } void GLAPIENTRY _mesa_CopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); ctx->Driver.CopyColorSubTable( ctx, target, start, x, y, width ); } void GLAPIENTRY _mesa_GetColorTable( GLenum target, GLenum format, GLenum type, GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_color_table *table = NULL; GLchan rgba[MAX_COLOR_TABLE_SIZE][4]; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState) { _mesa_update_state(ctx); } switch (target) { case GL_TEXTURE_1D: table = &texUnit->Current1D->Palette; break; case GL_TEXTURE_2D: table = &texUnit->Current2D->Palette; break; case GL_TEXTURE_3D: table = &texUnit->Current3D->Palette; break; case GL_TEXTURE_CUBE_MAP_ARB: if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); return; } table = &texUnit->CurrentCubeMap->Palette; break; case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; break; case GL_COLOR_TABLE: table = &ctx->ColorTable; break; case GL_TEXTURE_COLOR_TABLE_SGI: if (!ctx->Extensions.SGI_texture_color_table) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); return; } table = &(texUnit->ColorTable); break; case GL_POST_CONVOLUTION_COLOR_TABLE: table = &ctx->PostConvolutionColorTable; break; case GL_POST_COLOR_MATRIX_COLOR_TABLE: table = &ctx->PostColorMatrixColorTable; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); return; } ASSERT(table); switch (table->Format) { case GL_ALPHA: if (table->Type == GL_FLOAT) { const GLfloat *tableF = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < table->Size; i++) { rgba[i][RCOMP] = 0; rgba[i][GCOMP] = 0; rgba[i][BCOMP] = 0; rgba[i][ACOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); } } else { const GLchan *tableUB = (const GLchan *) table->Table; GLuint i; for (i = 0; i < table->Size; i++) { rgba[i][RCOMP] = 0; rgba[i][GCOMP] = 0; rgba[i][BCOMP] = 0; rgba[i][ACOMP] = tableUB[i]; } } break; case GL_LUMINANCE: if (table->Type == GL_FLOAT) { const GLfloat *tableF = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < table->Size; i++) { rgba[i][RCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); rgba[i][GCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); rgba[i][BCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); rgba[i][ACOMP] = CHAN_MAX; } } else { const GLchan *tableUB = (const GLchan *) table->Table; GLuint i; for (i = 0; i < table->Size; i++) { rgba[i][RCOMP] = tableUB[i]; rgba[i][GCOMP] = tableUB[i]; rgba[i][BCOMP] = tableUB[i]; rgba[i][ACOMP] = CHAN_MAX; } } break; case GL_LUMINANCE_ALPHA: if (table->Type == GL_FLOAT) { const GLfloat *tableF = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < table->Size; i++) { rgba[i][RCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF); rgba[i][GCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF); rgba[i][BCOMP] = IROUND_POS(tableF[i*2+0] * CHAN_MAXF); rgba[i][ACOMP] = IROUND_POS(tableF[i*2+1] * CHAN_MAXF); } } else { const GLchan *tableUB = (const GLchan *) table->Table; GLuint i; for (i = 0; i < table->Size; i++) { rgba[i][RCOMP] = tableUB[i*2+0]; rgba[i][GCOMP] = tableUB[i*2+0]; rgba[i][BCOMP] = tableUB[i*2+0]; rgba[i][ACOMP] = tableUB[i*2+1]; } } break; case GL_INTENSITY: if (table->Type == GL_FLOAT) { const GLfloat *tableF = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < table->Size; i++) { rgba[i][RCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); rgba[i][GCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); rgba[i][BCOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); rgba[i][ACOMP] = IROUND_POS(tableF[i] * CHAN_MAXF); } } else { const GLchan *tableUB = (const GLchan *) table->Table; GLuint i; for (i = 0; i < table->Size; i++) { rgba[i][RCOMP] = tableUB[i]; rgba[i][GCOMP] = tableUB[i]; rgba[i][BCOMP] = tableUB[i]; rgba[i][ACOMP] = tableUB[i]; } } break; case GL_RGB: if (table->Type == GL_FLOAT) { const GLfloat *tableF = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < table->Size; i++) { rgba[i][RCOMP] = IROUND_POS(tableF[i*3+0] * CHAN_MAXF); rgba[i][GCOMP] = IROUND_POS(tableF[i*3+1] * CHAN_MAXF); rgba[i][BCOMP] = IROUND_POS(tableF[i*3+2] * CHAN_MAXF); rgba[i][ACOMP] = CHAN_MAX; } } else { const GLchan *tableUB = (const GLchan *) table->Table; GLuint i; for (i = 0; i < table->Size; i++) { rgba[i][RCOMP] = tableUB[i*3+0]; rgba[i][GCOMP] = tableUB[i*3+1]; rgba[i][BCOMP] = tableUB[i*3+2]; rgba[i][ACOMP] = CHAN_MAX; } } break; case GL_RGBA: if (table->Type == GL_FLOAT) { const GLfloat *tableF = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < table->Size; i++) { rgba[i][RCOMP] = IROUND_POS(tableF[i*4+0] * CHAN_MAXF); rgba[i][GCOMP] = IROUND_POS(tableF[i*4+1] * CHAN_MAXF); rgba[i][BCOMP] = IROUND_POS(tableF[i*4+2] * CHAN_MAXF); rgba[i][ACOMP] = IROUND_POS(tableF[i*4+3] * CHAN_MAXF); } } else { const GLchan *tableUB = (const GLchan *) table->Table; GLuint i; for (i = 0; i < table->Size; i++) { rgba[i][RCOMP] = tableUB[i*4+0]; rgba[i][GCOMP] = tableUB[i*4+1]; rgba[i][BCOMP] = tableUB[i*4+2]; rgba[i][ACOMP] = tableUB[i*4+3]; } } break; default: _mesa_problem(ctx, "bad table format in glGetColorTable"); return; } if (ctx->Pack.BufferObj->Name) { /* pack color table into PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(1, &ctx->Pack, table->Size, 1, 1, format, type, data)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetColorTable(invalid PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetColorTable(PBO is mapped)"); return; } data = ADD_POINTERS(buf, data); } _mesa_pack_rgba_span_chan(ctx, table->Size, (const GLchan (*)[4]) rgba, format, type, data, &ctx->Pack, GL_FALSE); if (ctx->Pack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, ctx->Pack.BufferObj); } } void GLAPIENTRY _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { case GL_COLOR_TABLE_SGI: if (pname == GL_COLOR_TABLE_SCALE_SGI) { ctx->Pixel.ColorTableScale[0] = params[0]; ctx->Pixel.ColorTableScale[1] = params[1]; ctx->Pixel.ColorTableScale[2] = params[2]; ctx->Pixel.ColorTableScale[3] = params[3]; } else if (pname == GL_COLOR_TABLE_BIAS_SGI) { ctx->Pixel.ColorTableBias[0] = params[0]; ctx->Pixel.ColorTableBias[1] = params[1]; ctx->Pixel.ColorTableBias[2] = params[2]; ctx->Pixel.ColorTableBias[3] = params[3]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); return; } break; case GL_TEXTURE_COLOR_TABLE_SGI: if (!ctx->Extensions.SGI_texture_color_table) { _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)"); return; } if (pname == GL_COLOR_TABLE_SCALE_SGI) { ctx->Pixel.TextureColorTableScale[0] = params[0]; ctx->Pixel.TextureColorTableScale[1] = params[1]; ctx->Pixel.TextureColorTableScale[2] = params[2]; ctx->Pixel.TextureColorTableScale[3] = params[3]; } else if (pname == GL_COLOR_TABLE_BIAS_SGI) { ctx->Pixel.TextureColorTableBias[0] = params[0]; ctx->Pixel.TextureColorTableBias[1] = params[1]; ctx->Pixel.TextureColorTableBias[2] = params[2]; ctx->Pixel.TextureColorTableBias[3] = params[3]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); return; } break; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: if (pname == GL_COLOR_TABLE_SCALE_SGI) { ctx->Pixel.PCCTscale[0] = params[0]; ctx->Pixel.PCCTscale[1] = params[1]; ctx->Pixel.PCCTscale[2] = params[2]; ctx->Pixel.PCCTscale[3] = params[3]; } else if (pname == GL_COLOR_TABLE_BIAS_SGI) { ctx->Pixel.PCCTbias[0] = params[0]; ctx->Pixel.PCCTbias[1] = params[1]; ctx->Pixel.PCCTbias[2] = params[2]; ctx->Pixel.PCCTbias[3] = params[3]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); return; } break; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: if (pname == GL_COLOR_TABLE_SCALE_SGI) { ctx->Pixel.PCMCTscale[0] = params[0]; ctx->Pixel.PCMCTscale[1] = params[1]; ctx->Pixel.PCMCTscale[2] = params[2]; ctx->Pixel.PCMCTscale[3] = params[3]; } else if (pname == GL_COLOR_TABLE_BIAS_SGI) { ctx->Pixel.PCMCTbias[0] = params[0]; ctx->Pixel.PCMCTbias[1] = params[1]; ctx->Pixel.PCMCTbias[2] = params[2]; ctx->Pixel.PCMCTbias[3] = params[3]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); return; } break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)"); return; } ctx->NewState |= _NEW_PIXEL; } void GLAPIENTRY _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) { GLfloat fparams[4]; if (pname == GL_COLOR_TABLE_SGI || pname == GL_TEXTURE_COLOR_TABLE_SGI || pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) { /* four values */ fparams[0] = (GLfloat) params[0]; fparams[1] = (GLfloat) params[1]; fparams[2] = (GLfloat) params[2]; fparams[3] = (GLfloat) params[3]; } else { /* one values */ fparams[0] = (GLfloat) params[0]; } _mesa_ColorTableParameterfv(target, pname, fparams); } void GLAPIENTRY _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_color_table *table = NULL; ASSERT_OUTSIDE_BEGIN_END(ctx); switch (target) { case GL_TEXTURE_1D: table = &texUnit->Current1D->Palette; break; case GL_TEXTURE_2D: table = &texUnit->Current2D->Palette; break; case GL_TEXTURE_3D: table = &texUnit->Current3D->Palette; break; case GL_TEXTURE_CUBE_MAP_ARB: if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)"); return; } table = &texUnit->CurrentCubeMap->Palette; break; case GL_PROXY_TEXTURE_1D: table = &ctx->Texture.Proxy1D->Palette; break; case GL_PROXY_TEXTURE_2D: table = &ctx->Texture.Proxy2D->Palette; break; case GL_PROXY_TEXTURE_3D: table = &ctx->Texture.Proxy3D->Palette; break; case GL_PROXY_TEXTURE_CUBE_MAP_ARB: if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)"); return; } table = &ctx->Texture.ProxyCubeMap->Palette; break; case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; break; case GL_COLOR_TABLE: table = &ctx->ColorTable; if (pname == GL_COLOR_TABLE_SCALE_SGI) { params[0] = ctx->Pixel.ColorTableScale[0]; params[1] = ctx->Pixel.ColorTableScale[1]; params[2] = ctx->Pixel.ColorTableScale[2]; params[3] = ctx->Pixel.ColorTableScale[3]; return; } else if (pname == GL_COLOR_TABLE_BIAS_SGI) { params[0] = ctx->Pixel.ColorTableBias[0]; params[1] = ctx->Pixel.ColorTableBias[1]; params[2] = ctx->Pixel.ColorTableBias[2]; params[3] = ctx->Pixel.ColorTableBias[3]; return; } break; case GL_PROXY_COLOR_TABLE: table = &ctx->ProxyColorTable; break; case GL_TEXTURE_COLOR_TABLE_SGI: if (!ctx->Extensions.SGI_texture_color_table) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); return; } table = &(texUnit->ColorTable); if (pname == GL_COLOR_TABLE_SCALE_SGI) { params[0] = ctx->Pixel.TextureColorTableScale[0]; params[1] = ctx->Pixel.TextureColorTableScale[1]; params[2] = ctx->Pixel.TextureColorTableScale[2]; params[3] = ctx->Pixel.TextureColorTableScale[3]; return; } else if (pname == GL_COLOR_TABLE_BIAS_SGI) { params[0] = ctx->Pixel.TextureColorTableBias[0]; params[1] = ctx->Pixel.TextureColorTableBias[1]; params[2] = ctx->Pixel.TextureColorTableBias[2]; params[3] = ctx->Pixel.TextureColorTableBias[3]; return; } break; case GL_PROXY_TEXTURE_COLOR_TABLE_SGI: if (!ctx->Extensions.SGI_texture_color_table) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); return; } table = &(texUnit->ProxyColorTable); break; case GL_POST_CONVOLUTION_COLOR_TABLE: table = &ctx->PostConvolutionColorTable; if (pname == GL_COLOR_TABLE_SCALE_SGI) { params[0] = ctx->Pixel.PCCTscale[0]; params[1] = ctx->Pixel.PCCTscale[1]; params[2] = ctx->Pixel.PCCTscale[2]; params[3] = ctx->Pixel.PCCTscale[3]; return; } else if (pname == GL_COLOR_TABLE_BIAS_SGI) { params[0] = ctx->Pixel.PCCTbias[0]; params[1] = ctx->Pixel.PCCTbias[1]; params[2] = ctx->Pixel.PCCTbias[2]; params[3] = ctx->Pixel.PCCTbias[3]; return; } break; case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: table = &ctx->ProxyPostConvolutionColorTable; break; case GL_POST_COLOR_MATRIX_COLOR_TABLE: table = &ctx->PostColorMatrixColorTable; if (pname == GL_COLOR_TABLE_SCALE_SGI) { params[0] = ctx->Pixel.PCMCTscale[0]; params[1] = ctx->Pixel.PCMCTscale[1]; params[2] = ctx->Pixel.PCMCTscale[2]; params[3] = ctx->Pixel.PCMCTscale[3]; return; } else if (pname == GL_COLOR_TABLE_BIAS_SGI) { params[0] = ctx->Pixel.PCMCTbias[0]; params[1] = ctx->Pixel.PCMCTbias[1]; params[2] = ctx->Pixel.PCMCTbias[2]; params[3] = ctx->Pixel.PCMCTbias[3]; return; } break; case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: table = &ctx->ProxyPostColorMatrixColorTable; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)"); return; } assert(table); switch (pname) { case GL_COLOR_TABLE_FORMAT: *params = (GLfloat) table->IntFormat; break; case GL_COLOR_TABLE_WIDTH: *params = (GLfloat) table->Size; break; case GL_COLOR_TABLE_RED_SIZE: *params = (GLfloat) table->RedSize; break; case GL_COLOR_TABLE_GREEN_SIZE: *params = (GLfloat) table->GreenSize; break; case GL_COLOR_TABLE_BLUE_SIZE: *params = (GLfloat) table->BlueSize; break; case GL_COLOR_TABLE_ALPHA_SIZE: *params = (GLfloat) table->AlphaSize; break; case GL_COLOR_TABLE_LUMINANCE_SIZE: *params = (GLfloat) table->LuminanceSize; break; case GL_COLOR_TABLE_INTENSITY_SIZE: *params = (GLfloat) table->IntensitySize; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(pname)" ); return; } } void GLAPIENTRY _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_color_table *table = NULL; ASSERT_OUTSIDE_BEGIN_END(ctx); switch (target) { case GL_TEXTURE_1D: table = &texUnit->Current1D->Palette; break; case GL_TEXTURE_2D: table = &texUnit->Current2D->Palette; break; case GL_TEXTURE_3D: table = &texUnit->Current3D->Palette; break; case GL_TEXTURE_CUBE_MAP_ARB: if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)"); return; } table = &texUnit->CurrentCubeMap->Palette; break; case GL_PROXY_TEXTURE_1D: table = &ctx->Texture.Proxy1D->Palette; break; case GL_PROXY_TEXTURE_2D: table = &ctx->Texture.Proxy2D->Palette; break; case GL_PROXY_TEXTURE_3D: table = &ctx->Texture.Proxy3D->Palette; break; case GL_PROXY_TEXTURE_CUBE_MAP_ARB: if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)"); return; } table = &ctx->Texture.ProxyCubeMap->Palette; break; case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; break; case GL_COLOR_TABLE: table = &ctx->ColorTable; if (pname == GL_COLOR_TABLE_SCALE_SGI) { params[0] = (GLint) ctx->Pixel.ColorTableScale[0]; params[1] = (GLint) ctx->Pixel.ColorTableScale[1]; params[2] = (GLint) ctx->Pixel.ColorTableScale[2]; params[3] = (GLint) ctx->Pixel.ColorTableScale[3]; return; } else if (pname == GL_COLOR_TABLE_BIAS_SGI) { params[0] = (GLint) ctx->Pixel.ColorTableBias[0]; params[1] = (GLint) ctx->Pixel.ColorTableBias[1]; params[2] = (GLint) ctx->Pixel.ColorTableBias[2]; params[3] = (GLint) ctx->Pixel.ColorTableBias[3]; return; } break; case GL_PROXY_COLOR_TABLE: table = &ctx->ProxyColorTable; break; case GL_TEXTURE_COLOR_TABLE_SGI: if (!ctx->Extensions.SGI_texture_color_table) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); return; } table = &(texUnit->ColorTable); if (pname == GL_COLOR_TABLE_SCALE_SGI) { params[0] = (GLint) ctx->Pixel.TextureColorTableScale[0]; params[1] = (GLint) ctx->Pixel.TextureColorTableScale[1]; params[2] = (GLint) ctx->Pixel.TextureColorTableScale[2]; params[3] = (GLint) ctx->Pixel.TextureColorTableScale[3]; return; } else if (pname == GL_COLOR_TABLE_BIAS_SGI) { params[0] = (GLint) ctx->Pixel.TextureColorTableBias[0]; params[1] = (GLint) ctx->Pixel.TextureColorTableBias[1]; params[2] = (GLint) ctx->Pixel.TextureColorTableBias[2]; params[3] = (GLint) ctx->Pixel.TextureColorTableBias[3]; return; } break; case GL_PROXY_TEXTURE_COLOR_TABLE_SGI: if (!ctx->Extensions.SGI_texture_color_table) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); return; } table = &(texUnit->ProxyColorTable); break; case GL_POST_CONVOLUTION_COLOR_TABLE: table = &ctx->PostConvolutionColorTable; if (pname == GL_COLOR_TABLE_SCALE_SGI) { params[0] = (GLint) ctx->Pixel.PCCTscale[0]; params[1] = (GLint) ctx->Pixel.PCCTscale[1]; params[2] = (GLint) ctx->Pixel.PCCTscale[2]; params[3] = (GLint) ctx->Pixel.PCCTscale[3]; return; } else if (pname == GL_COLOR_TABLE_BIAS_SGI) { params[0] = (GLint) ctx->Pixel.PCCTbias[0]; params[1] = (GLint) ctx->Pixel.PCCTbias[1]; params[2] = (GLint) ctx->Pixel.PCCTbias[2]; params[3] = (GLint) ctx->Pixel.PCCTbias[3]; return; } break; case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: table = &ctx->ProxyPostConvolutionColorTable; break; case GL_POST_COLOR_MATRIX_COLOR_TABLE: table = &ctx->PostColorMatrixColorTable; if (pname == GL_COLOR_TABLE_SCALE_SGI) { params[0] = (GLint) ctx->Pixel.PCMCTscale[0]; params[1] = (GLint) ctx->Pixel.PCMCTscale[1]; params[2] = (GLint) ctx->Pixel.PCMCTscale[2]; params[3] = (GLint) ctx->Pixel.PCMCTscale[3]; return; } else if (pname == GL_COLOR_TABLE_BIAS_SGI) { params[0] = (GLint) ctx->Pixel.PCMCTbias[0]; params[1] = (GLint) ctx->Pixel.PCMCTbias[1]; params[2] = (GLint) ctx->Pixel.PCMCTbias[2]; params[3] = (GLint) ctx->Pixel.PCMCTbias[3]; return; } break; case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: table = &ctx->ProxyPostColorMatrixColorTable; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)"); return; } assert(table); switch (pname) { case GL_COLOR_TABLE_FORMAT: *params = table->IntFormat; break; case GL_COLOR_TABLE_WIDTH: *params = table->Size; break; case GL_COLOR_TABLE_RED_SIZE: *params = table->RedSize; break; case GL_COLOR_TABLE_GREEN_SIZE: *params = table->GreenSize; break; case GL_COLOR_TABLE_BLUE_SIZE: *params = table->BlueSize; break; case GL_COLOR_TABLE_ALPHA_SIZE: *params = table->AlphaSize; break; case GL_COLOR_TABLE_LUMINANCE_SIZE: *params = table->LuminanceSize; break; case GL_COLOR_TABLE_INTENSITY_SIZE: *params = table->IntensitySize; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(pname)" ); return; } } /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ void _mesa_init_colortable( struct gl_color_table *p ) { p->Type = CHAN_TYPE; p->Table = NULL; p->Size = 0; p->IntFormat = GL_RGBA; } void _mesa_free_colortable_data( struct gl_color_table *p ) { if (p->Table) { FREE(p->Table); p->Table = NULL; } } /* * Initialize all colortables for a context. */ void _mesa_init_colortables( GLcontext * ctx ) { /* Color tables */ _mesa_init_colortable(&ctx->ColorTable); _mesa_init_colortable(&ctx->ProxyColorTable); _mesa_init_colortable(&ctx->PostConvolutionColorTable); _mesa_init_colortable(&ctx->ProxyPostConvolutionColorTable); _mesa_init_colortable(&ctx->PostColorMatrixColorTable); _mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable); } /* * Free all colortable data for a context */ void _mesa_free_colortables_data( GLcontext *ctx ) { _mesa_free_colortable_data(&ctx->ColorTable); _mesa_free_colortable_data(&ctx->ProxyColorTable); _mesa_free_colortable_data(&ctx->PostConvolutionColorTable); _mesa_free_colortable_data(&ctx->ProxyPostConvolutionColorTable); _mesa_free_colortable_data(&ctx->PostColorMatrixColorTable); _mesa_free_colortable_data(&ctx->ProxyPostColorMatrixColorTable); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/colortab.h0000644000000000000000000000604213614532424020121 0ustar /** * \file colortab.h * Color tables. * * \if subset * (No-op) * * \endif */ /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef COLORTAB_H #define COLORTAB_H #include "mtypes.h" #if _HAVE_FULL_GL extern void GLAPIENTRY _mesa_ColorTable( GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table ); extern void GLAPIENTRY _mesa_ColorSubTable( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table ); extern void GLAPIENTRY _mesa_CopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); extern void GLAPIENTRY _mesa_CopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); extern void GLAPIENTRY _mesa_GetColorTable( GLenum target, GLenum format, GLenum type, GLvoid *table ); extern void GLAPIENTRY _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params); extern void GLAPIENTRY _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params); extern void GLAPIENTRY _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ); extern void GLAPIENTRY _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ); extern void _mesa_init_colortable( struct gl_color_table *table ); extern void _mesa_free_colortable_data( struct gl_color_table *table ); extern void _mesa_init_colortables( GLcontext *ctx ); extern void _mesa_free_colortables_data( GLcontext *ctx ); #else /** No-op */ #define _mesa_init_colortable( p ) ((void) 0) /** No-op */ #define _mesa_free_colortable_data( p ) ((void) 0) /** No-op */ #define _mesa_init_colortables( p ) ((void)0) /** No-op */ #define _mesa_free_colortables_data( p ) ((void)0) #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/config.h0000644000000000000000000002057313614532424017566 0ustar /** * \file config.h * Tunable configuration parameters. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef CONFIG_H #define CONFIG_H /** * \name OpenGL implementation limits */ /*@{*/ /** Maximum modelview matrix stack depth */ #define MAX_MODELVIEW_STACK_DEPTH 32 /** Maximum projection matrix stack depth */ #define MAX_PROJECTION_STACK_DEPTH 32 /** Maximum texture matrix stack depth */ #define MAX_TEXTURE_STACK_DEPTH 10 /** Maximum color matrix stack depth */ #define MAX_COLOR_STACK_DEPTH 4 /** Maximum attribute stack depth */ #define MAX_ATTRIB_STACK_DEPTH 16 /** Maximum client attribute stack depth */ #define MAX_CLIENT_ATTRIB_STACK_DEPTH 16 /** Maximum recursion depth of display list calls */ #define MAX_LIST_NESTING 64 /** Maximum number of lights */ #define MAX_LIGHTS 8 /** Maximum user-defined clipping planes */ #define MAX_CLIP_PLANES 6 /** Maximum pixel map lookup table size */ #define MAX_PIXEL_MAP_TABLE 256 /** Maximum number of auxillary color buffers */ #define MAX_AUX_BUFFERS 4 /** Maximum order (degree) of curves */ #ifdef AMIGA # define MAX_EVAL_ORDER 12 #else # define MAX_EVAL_ORDER 30 #endif /** Maximum Name stack depth */ #define MAX_NAME_STACK_DEPTH 64 /** Minimum point size */ #define MIN_POINT_SIZE 1.0 /** Maximum point size */ #define MAX_POINT_SIZE 20.0 /** Point size granularity */ #define POINT_SIZE_GRANULARITY 0.1 /** Minimum line width */ #define MIN_LINE_WIDTH 1.0 /** Maximum line width */ #define MAX_LINE_WIDTH 10.0 /** Line width granularity */ #define LINE_WIDTH_GRANULARITY 0.1 /** Max texture palette / color table size */ #define MAX_COLOR_TABLE_SIZE 256 /** Number of 1D/2D texture mipmap levels */ #define MAX_TEXTURE_LEVELS 12 /** Number of 3D texture mipmap levels */ #define MAX_3D_TEXTURE_LEVELS 9 /** Number of cube texture mipmap levels - GL_ARB_texture_cube_map */ #define MAX_CUBE_TEXTURE_LEVELS 12 /** Maximum rectangular texture size - GL_NV_texture_rectangle */ #define MAX_TEXTURE_RECT_SIZE 2048 /** Number of texture units - GL_ARB_multitexture */ #define MAX_TEXTURE_UNITS 8 /*@}*/ /** * \name Separate numbers of texture coordinates and texture image units. * * These values will eventually replace most instances of MAX_TEXTURE_UNITS. * We should always have MAX_TEXTURE_COORD_UNITS <= MAX_TEXTURE_IMAGE_UNITS. * And, GL_MAX_TEXTURE_UNITS <= MAX_TEXTURE_COORD_UNITS. */ /*@{*/ #define MAX_TEXTURE_COORD_UNITS 8 #define MAX_TEXTURE_IMAGE_UNITS 8 /*@}*/ /** * Maximum viewport/image width. Must accomodate all texture sizes too. */ #define MAX_WIDTH 4096 /** Maximum viewport/image height */ #define MAX_HEIGHT 4096 /** Maxmimum size for CVA. May be overridden by the drivers. */ #define MAX_ARRAY_LOCK_SIZE 3000 /** Subpixel precision for antialiasing, window coordinate snapping */ #define SUB_PIXEL_BITS 4 /** Size of histogram tables */ #define HISTOGRAM_TABLE_SIZE 256 /** Max convolution filter width */ #define MAX_CONVOLUTION_WIDTH 9 /** Max convolution filter height */ #define MAX_CONVOLUTION_HEIGHT 9 /** For GL_ARB_texture_compression */ #define MAX_COMPRESSED_TEXTURE_FORMATS 25 /** For GL_EXT_texture_filter_anisotropic */ #define MAX_TEXTURE_MAX_ANISOTROPY 16.0 /** For GL_EXT_texture_lod_bias (typically MAX_TEXTURE_LEVELS - 1) */ #define MAX_TEXTURE_LOD_BIAS 11.0 /** For GL_NV_vertex_program */ /*@{*/ #define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128 #define MAX_NV_VERTEX_PROGRAM_TEMPS 12 #define MAX_NV_VERTEX_PROGRAM_PARAMS 128 /* KW: power of two */ #define MAX_NV_VERTEX_PROGRAM_INPUTS 16 #define MAX_NV_VERTEX_PROGRAM_OUTPUTS 15 /*@}*/ /** For GL_NV_fragment_program */ /*@{*/ #define MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS 128 #define MAX_NV_FRAGMENT_PROGRAM_TEMPS 96 #define MAX_NV_FRAGMENT_PROGRAM_PARAMS 64 #define MAX_NV_FRAGMENT_PROGRAM_INPUTS 12 #define MAX_NV_FRAGMENT_PROGRAM_OUTPUTS 3 #define MAX_NV_FRAGMENT_PROGRAM_WRITE_ONLYS 2 /*@}*/ /** For GL_ARB_vertex_program */ /*@{*/ #define MAX_VERTEX_PROGRAM_ADDRESS_REGS 1 #define MAX_VERTEX_PROGRAM_ATTRIBS 16 /*@}*/ /** For GL_ARB_fragment_program */ /*@{*/ #define MAX_FRAGMENT_PROGRAM_ADDRESS_REGS 1 #define MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS 48 #define MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS 24 #define MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS 4 /*@}*/ /** For any program target/extension */ /*@{*/ #define MAX_PROGRAM_LOCAL_PARAMS 128 /* KW: power of two */ #define MAX_PROGRAM_MATRICES 8 #define MAX_PROGRAM_MATRIX_STACK_DEPTH 4 /*@}*/ /** For GL_ARB_fragment_shader */ /*@{*/ #define MAX_FRAGMENT_UNIFORM_COMPONENTS 64 /*@}*/ /** For GL_ARB_vertex_shader */ /*@{*/ #define MAX_VERTEX_UNIFORM_COMPONENTS 512 #define MAX_VARYING_FLOATS 32 #define MAX_VERTEX_TEXTURE_IMAGE_UNITS 0 #define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS) /*@}*/ /** For GL_ARB_draw_buffers */ /*@{*/ #define MAX_DRAW_BUFFERS 1 /*@}*/ /** For GL_EXT_framebuffer_object */ /*@{*/ #define MAX_COLOR_ATTACHMENTS 8 /*@}*/ /** * \name Mesa-specific parameters */ /*@{*/ /** * If non-zero use GLdouble for walking triangle edges, for better accuracy. */ #define TRIANGLE_WALK_DOUBLE 0 /** * Bits per accumulation buffer color component: 8, 16 or 32 */ #define ACCUM_BITS 16 /** * Bits per depth buffer value. * * Any reasonable value up to 31 will work. 32 doesn't work because of integer * overflow problems in the rasterizer code. */ #ifndef DEFAULT_SOFTWARE_DEPTH_BITS #define DEFAULT_SOFTWARE_DEPTH_BITS 16 #endif /** Depth buffer data type */ #if DEFAULT_SOFTWARE_DEPTH_BITS <= 16 #define DEFAULT_SOFTWARE_DEPTH_TYPE GLushort #else #define DEFAULT_SOFTWARE_DEPTH_TYPE GLuint #endif /** * Bits per stencil value: 8 */ #define STENCIL_BITS 8 /** * Bits per color channel: 8, 16 or 32 */ #ifndef CHAN_BITS #define CHAN_BITS 8 #endif /* * Color channel component order * * \note Changes will almost certainly cause problems at this time. */ #define RCOMP 0 #define GCOMP 1 #define BCOMP 2 #define ACOMP 3 /* * Enable/disable features (blocks of code) by setting FEATURE_xyz to 0 or 1. */ #ifndef _HAVE_FULL_GL #define _HAVE_FULL_GL 1 #endif #define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL #define FEATURE_ARB_vertex_program _HAVE_FULL_GL #define FEATURE_ARB_fragment_program _HAVE_FULL_GL #define FEATURE_ARB_occlusion_query _HAVE_FULL_GL #define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL #define FEATURE_MESA_program_debug _HAVE_FULL_GL #define FEATURE_NV_fence _HAVE_FULL_GL #define FEATURE_NV_fragment_program _HAVE_FULL_GL #define FEATURE_NV_vertex_program _HAVE_FULL_GL #define FEATURE_userclip _HAVE_FULL_GL #define FEATURE_texgen _HAVE_FULL_GL #define FEATURE_windowpos _HAVE_FULL_GL #define FEATURE_ARB_vertex_shader _HAVE_FULL_GL #define FEATURE_ARB_fragment_shader _HAVE_FULL_GL #define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader) #define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects #define FEATURE_ATI_fragment_shader _HAVE_FULL_GL #define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL /*@}*/ /** * Maximum number of temporary vertices required for clipping. * * Used in array_cache and tnl modules. */ #define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1) /* XXX everything marked with OLD_RENDERBUFFER will be going away... */ #define OLD_RENDERBUFFER 1 #endif /* CONFIG_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/context.c0000644000000000000000000014207513614532424020002 0ustar /** * \file context.c * Mesa context/visual/framebuffer management functions. * \author Brian Paul */ /* * Mesa 3-D graphics library * Version: 6.4 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \mainpage Mesa Main Module * * \section MainIntroduction Introduction * * The Mesa Main module consists of all the files in the main/ directory. * Among the features of this module are: *
    *
  • Structures to represent most GL state
  • *
  • State set/get functions
  • *
  • Display lists
  • *
  • Texture unit, object and image handling
  • *
  • Matrix and attribute stacks
  • *
* * Other modules are responsible for API dispatch, vertex transformation, * point/line/triangle setup, rasterization, vertex array caching, * vertex/fragment programs/shaders, etc. * * * \section AboutDoxygen About Doxygen * * If you're viewing this information as Doxygen-generated HTML you'll * see the documentation index at the top of this page. * * The first line lists the Mesa source code modules. * The second line lists the indexes available for viewing the documentation * for each module. * * Selecting the Main page link will display a summary of the module * (this page). * * Selecting Data Structures will list all C structures. * * Selecting the File List link will list all the source files in * the module. * Selecting a filename will show a list of all functions defined in that file. * * Selecting the Data Fields link will display a list of all * documented structure members. * * Selecting the Globals link will display a list * of all functions, structures, global variables and macros in the module. * */ #include "glheader.h" #include "imports.h" #include "accum.h" #include "attrib.h" #include "blend.h" #include "buffers.h" #include "bufferobj.h" #include "colortab.h" #include "context.h" #include "debug.h" #include "depth.h" #include "dlist.h" #include "eval.h" #include "enums.h" #include "extensions.h" #include "fbobject.h" #include "feedback.h" #include "fog.h" #include "get.h" #include "glthread.h" #include "glapioffsets.h" #include "histogram.h" #include "hint.h" #include "hash.h" #include "light.h" #include "lines.h" #include "macros.h" #include "matrix.h" #include "occlude.h" #include "pixel.h" #include "points.h" #include "polygon.h" #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program #include "program.h" #endif #include "rastpos.h" #include "simple_list.h" #include "state.h" #include "stencil.h" #include "texcompress.h" #include "teximage.h" #include "texobj.h" #include "texstate.h" #include "mtypes.h" #include "varray.h" #include "version.h" #include "vtxfmt.h" #if _HAVE_FULL_GL #include "math/m_translate.h" #include "math/m_matrix.h" #include "math/m_xform.h" #include "math/mathmod.h" #endif #include "shaderobjects.h" #ifdef USE_SPARC_ASM #include "sparc/sparc.h" #endif #ifndef MESA_VERBOSE int MESA_VERBOSE = 0; #endif #ifndef MESA_DEBUG_FLAGS int MESA_DEBUG_FLAGS = 0; #endif /* ubyte -> float conversion */ GLfloat _mesa_ubyte_to_float_color_tab[256]; static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ); /**********************************************************************/ /** \name OpenGL SI-style interface (new in Mesa 3.5) * * \if subset * \note Most of these functions are never called in the Mesa subset. * \endif */ /*@{*/ /** * Destroy context callback. * * \param gc context. * \return GL_TRUE on success, or GL_FALSE on failure. * * \ifnot subset * Called by window system/device driver (via __GLexports::destroyCurrent) when * the rendering context is to be destroyed. * \endif * * Frees the context data and the context structure. */ GLboolean _mesa_destroyContext(__GLcontext *gc) { if (gc) { _mesa_free_context_data(gc); _mesa_free(gc); } return GL_TRUE; } /** * Unbind context callback. * * \param gc context. * \return GL_TRUE on success, or GL_FALSE on failure. * * \ifnot subset * Called by window system/device driver (via __GLexports::loseCurrent) * when the rendering context is made non-current. * \endif * * No-op */ GLboolean _mesa_loseCurrent(__GLcontext *gc) { /* XXX unbind context from thread */ (void) gc; return GL_TRUE; } /** * Bind context callback. * * \param gc context. * \return GL_TRUE on success, or GL_FALSE on failure. * * \ifnot subset * Called by window system/device driver (via __GLexports::makeCurrent) * when the rendering context is made current. * \endif * * No-op */ GLboolean _mesa_makeCurrent(__GLcontext *gc) { /* XXX bind context to thread */ (void) gc; return GL_TRUE; } /** * Share context callback. * * \param gc context. * \param gcShare shared context. * \return GL_TRUE on success, or GL_FALSE on failure. * * \ifnot subset * Called by window system/device driver (via __GLexports::shareContext) * \endif * * Update the shared context reference count, gl_shared_state::RefCount. */ GLboolean _mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare) { if (gc && gcShare && gc->Shared && gcShare->Shared) { gc->Shared->RefCount--; if (gc->Shared->RefCount == 0) { free_shared_state(gc, gc->Shared); } gc->Shared = gcShare->Shared; gc->Shared->RefCount++; return GL_TRUE; } else { return GL_FALSE; } } #if _HAVE_FULL_GL /** * Copy context callback. */ GLboolean _mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask) { if (dst && src) { _mesa_copy_context( src, dst, mask ); return GL_TRUE; } else { return GL_FALSE; } } #endif /** No-op */ GLboolean _mesa_forceCurrent(__GLcontext *gc) { (void) gc; return GL_TRUE; } /** * Windows/buffer resizing notification callback. * * \param gc GL context. * \return GL_TRUE on success, or GL_FALSE on failure. */ GLboolean _mesa_notifyResize(__GLcontext *gc) { GLint x, y; GLuint width, height; __GLdrawablePrivate *d = gc->imports.getDrawablePrivate(gc); if (!d || !d->getDrawableSize) return GL_FALSE; d->getDrawableSize( d, &x, &y, &width, &height ); /* update viewport, resize software buffers, etc. */ return GL_TRUE; } /** * Window/buffer destruction notification callback. * * \param gc GL context. * * Called when the context's window/buffer is going to be destroyed. * * No-op */ void _mesa_notifyDestroy(__GLcontext *gc) { /* Unbind from it. */ (void) gc; } /** * Swap buffers notification callback. * * \param gc GL context. * * Called by window system just before swapping buffers. * We have to finish any pending rendering. */ void _mesa_notifySwapBuffers(__GLcontext *gc) { FLUSH_VERTICES( gc, 0 ); } /** No-op */ struct __GLdispatchStateRec * _mesa_dispatchExec(__GLcontext *gc) { (void) gc; return NULL; } /** No-op */ void _mesa_beginDispatchOverride(__GLcontext *gc) { (void) gc; } /** No-op */ void _mesa_endDispatchOverride(__GLcontext *gc) { (void) gc; } /** * \ifnot subset * Setup the exports. * * The window system will call these functions when it needs Mesa to do * something. * * \note Device drivers should override these functions! For example, * the Xlib driver should plug in the XMesa*-style functions into this * structure. The XMesa-style functions should then call the _mesa_* * version of these functions. This is an approximation to OO design * (inheritance and virtual functions). * \endif * * \if subset * No-op. * * \endif */ static void _mesa_init_default_exports(__GLexports *exports) { #if _HAVE_FULL_GL exports->destroyContext = _mesa_destroyContext; exports->loseCurrent = _mesa_loseCurrent; exports->makeCurrent = _mesa_makeCurrent; exports->shareContext = _mesa_shareContext; exports->copyContext = _mesa_copyContext; exports->forceCurrent = _mesa_forceCurrent; exports->notifyResize = _mesa_notifyResize; exports->notifyDestroy = _mesa_notifyDestroy; exports->notifySwapBuffers = _mesa_notifySwapBuffers; exports->dispatchExec = _mesa_dispatchExec; exports->beginDispatchOverride = _mesa_beginDispatchOverride; exports->endDispatchOverride = _mesa_endDispatchOverride; #else (void) exports; #endif } /** * Exported OpenGL SI interface. */ __GLcontext * __glCoreCreateContext(__GLimports *imports, __GLcontextModes *modes) { GLcontext *ctx; ctx = (GLcontext *) (*imports->calloc)(NULL, 1, sizeof(GLcontext)); if (ctx == NULL) { return NULL; } /* XXX doesn't work at this time */ _mesa_initialize_context(ctx, modes, NULL, NULL, NULL); ctx->imports = *imports; return ctx; } /** * Exported OpenGL SI interface. */ void __glCoreNopDispatch(void) { #if 0 /* SI */ __gl_dispatch = __glNopDispatchState; #else /* Mesa */ _glapi_set_dispatch(NULL); #endif } /*@}*/ /**********************************************************************/ /** \name GL Visual allocation/destruction */ /**********************************************************************/ /*@{*/ /** * Allocates a GLvisual structure and initializes it via * _mesa_initialize_visual(). * * \param rgbFlag GL_TRUE for RGB(A) mode, GL_FALSE for Color Index mode. * \param dbFlag double buffering * \param stereoFlag stereo buffer * \param depthBits requested bits per depth buffer value. Any value in [0, 32] * is acceptable but the actual depth type will be GLushort or GLuint as * needed. * \param stencilBits requested minimum bits per stencil buffer value * \param accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits number of bits per color component in accum buffer. * \param indexBits number of bits per pixel if \p rgbFlag is GL_FALSE * \param redBits number of bits per color component in frame buffer for RGB(A) * mode. We always use 8 in core Mesa though. * \param greenBits same as above. * \param blueBits same as above. * \param alphaBits same as above. * \param numSamples not really used. * * \return pointer to new GLvisual or NULL if requested parameters can't be * met. * * \note Need to add params for level and numAuxBuffers (at least) */ GLvisual * _mesa_create_visual( GLboolean rgbFlag, GLboolean dbFlag, GLboolean stereoFlag, GLint redBits, GLint greenBits, GLint blueBits, GLint alphaBits, GLint indexBits, GLint depthBits, GLint stencilBits, GLint accumRedBits, GLint accumGreenBits, GLint accumBlueBits, GLint accumAlphaBits, GLint numSamples ) { GLvisual *vis = (GLvisual *) CALLOC( sizeof(GLvisual) ); if (vis) { if (!_mesa_initialize_visual(vis, rgbFlag, dbFlag, stereoFlag, redBits, greenBits, blueBits, alphaBits, indexBits, depthBits, stencilBits, accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits, numSamples)) { FREE(vis); return NULL; } } return vis; } /** * Makes some sanity checks and fills in the fields of the * GLvisual object with the given parameters. If the caller needs * to set additional fields, he should just probably init the whole GLvisual * object himself. * \return GL_TRUE on success, or GL_FALSE on failure. * * \sa _mesa_create_visual() above for the parameter description. */ GLboolean _mesa_initialize_visual( GLvisual *vis, GLboolean rgbFlag, GLboolean dbFlag, GLboolean stereoFlag, GLint redBits, GLint greenBits, GLint blueBits, GLint alphaBits, GLint indexBits, GLint depthBits, GLint stencilBits, GLint accumRedBits, GLint accumGreenBits, GLint accumBlueBits, GLint accumAlphaBits, GLint numSamples ) { assert(vis); if (depthBits < 0 || depthBits > 32) { return GL_FALSE; } if (stencilBits < 0 || stencilBits > STENCIL_BITS) { return GL_FALSE; } if (accumRedBits < 0 || accumRedBits > ACCUM_BITS) { return GL_FALSE; } if (accumGreenBits < 0 || accumGreenBits > ACCUM_BITS) { return GL_FALSE; } if (accumBlueBits < 0 || accumBlueBits > ACCUM_BITS) { return GL_FALSE; } if (accumAlphaBits < 0 || accumAlphaBits > ACCUM_BITS) { return GL_FALSE; } vis->rgbMode = rgbFlag; vis->doubleBufferMode = dbFlag; vis->stereoMode = stereoFlag; vis->redBits = redBits; vis->greenBits = greenBits; vis->blueBits = blueBits; vis->alphaBits = alphaBits; vis->rgbBits = redBits + greenBits + blueBits; vis->indexBits = indexBits; vis->depthBits = depthBits; vis->stencilBits = stencilBits; vis->accumRedBits = accumRedBits; vis->accumGreenBits = accumGreenBits; vis->accumBlueBits = accumBlueBits; vis->accumAlphaBits = accumAlphaBits; vis->haveAccumBuffer = accumRedBits > 0; vis->haveDepthBuffer = depthBits > 0; vis->haveStencilBuffer = stencilBits > 0; vis->numAuxBuffers = 0; vis->level = 0; vis->pixmapMode = 0; vis->sampleBuffers = numSamples > 0 ? 1 : 0; vis->samples = numSamples; return GL_TRUE; } /** * Destroy a visual and free its memory. * * \param vis visual. * * Frees the visual structure. */ void _mesa_destroy_visual( GLvisual *vis ) { FREE(vis); } /*@}*/ /**********************************************************************/ /** \name Context allocation, initialization, destroying * * The purpose of the most initialization functions here is to provide the * default state values according to the OpenGL specification. */ /**********************************************************************/ /*@{*/ /** * One-time initialization mutex lock. * * \sa Used by one_time_init(). */ _glthread_DECLARE_STATIC_MUTEX(OneTimeLock); /** * Calls all the various one-time-init functions in Mesa. * * While holding a global mutex lock, calls several initialization functions, * and sets the glapi callbacks if the \c MESA_DEBUG environment variable is * defined. * * \sa _mesa_init_lists(), _math_init(). */ static void one_time_init( GLcontext *ctx ) { static GLboolean alreadyCalled = GL_FALSE; (void) ctx; _glthread_LOCK_MUTEX(OneTimeLock); if (!alreadyCalled) { GLuint i; /* do some implementation tests */ assert( sizeof(GLbyte) == 1 ); assert( sizeof(GLubyte) == 1 ); assert( sizeof(GLshort) == 2 ); assert( sizeof(GLushort) == 2 ); assert( sizeof(GLint) == 4 ); assert( sizeof(GLuint) == 4 ); _mesa_init_lists(); #if _HAVE_FULL_GL _math_init(); for (i = 0; i < 256; i++) { _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F; } #endif #ifdef USE_SPARC_ASM _mesa_init_sparc_glapi_relocs(); #endif if (_mesa_getenv("MESA_DEBUG")) { _glapi_noop_enable_warnings(GL_TRUE); _glapi_set_warning_func( (_glapi_warning_func) _mesa_warning ); } else { _glapi_noop_enable_warnings(GL_FALSE); } #if defined(DEBUG) && defined(__DATE__) && defined(__TIME__) _mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n", MESA_VERSION_STRING, __DATE__, __TIME__); #endif alreadyCalled = GL_TRUE; } _glthread_UNLOCK_MUTEX(OneTimeLock); } /** * Allocate and initialize a shared context state structure. * Initializes the display list, texture objects and vertex programs hash * tables, allocates the texture objects. If it runs out of memory, frees * everything already allocated before returning NULL. * * \return pointer to a gl_shared_state structure on success, or NULL on * failure. */ static GLboolean alloc_shared_state( GLcontext *ctx ) { struct gl_shared_state *ss = CALLOC_STRUCT(gl_shared_state); if (!ss) return GL_FALSE; ctx->Shared = ss; _glthread_INIT_MUTEX(ss->Mutex); ss->DisplayList = _mesa_NewHashTable(); ss->TexObjects = _mesa_NewHashTable(); #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program ss->Programs = _mesa_NewHashTable(); #endif #if FEATURE_ARB_vertex_program ss->DefaultVertexProgram = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); if (!ss->DefaultVertexProgram) goto cleanup; #endif #if FEATURE_ARB_fragment_program ss->DefaultFragmentProgram = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); if (!ss->DefaultFragmentProgram) goto cleanup; #endif #if FEATURE_ATI_fragment_shader ss->DefaultFragmentShader = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_SHADER_ATI, 0); if (!ss->DefaultFragmentShader) goto cleanup; #endif ss->BufferObjects = _mesa_NewHashTable(); ss->GL2Objects = _mesa_NewHashTable (); ss->Default1D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D); if (!ss->Default1D) goto cleanup; ss->Default2D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_2D); if (!ss->Default2D) goto cleanup; ss->Default3D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_3D); if (!ss->Default3D) goto cleanup; ss->DefaultCubeMap = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_CUBE_MAP_ARB); if (!ss->DefaultCubeMap) goto cleanup; ss->DefaultRect = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_RECTANGLE_NV); if (!ss->DefaultRect) goto cleanup; /* Effectively bind the default textures to all texture units */ ss->Default1D->RefCount += MAX_TEXTURE_IMAGE_UNITS; ss->Default2D->RefCount += MAX_TEXTURE_IMAGE_UNITS; ss->Default3D->RefCount += MAX_TEXTURE_IMAGE_UNITS; ss->DefaultCubeMap->RefCount += MAX_TEXTURE_IMAGE_UNITS; ss->DefaultRect->RefCount += MAX_TEXTURE_IMAGE_UNITS; #if FEATURE_EXT_framebuffer_object ss->FrameBuffers = _mesa_NewHashTable(); if (!ss->FrameBuffers) goto cleanup; ss->RenderBuffers = _mesa_NewHashTable(); if (!ss->RenderBuffers) goto cleanup; #endif return GL_TRUE; cleanup: /* Ran out of memory at some point. Free everything and return NULL */ if (ss->DisplayList) _mesa_DeleteHashTable(ss->DisplayList); if (ss->TexObjects) _mesa_DeleteHashTable(ss->TexObjects); #if FEATURE_NV_vertex_program if (ss->Programs) _mesa_DeleteHashTable(ss->Programs); #endif #if FEATURE_ARB_vertex_program if (ss->DefaultVertexProgram) ctx->Driver.DeleteProgram(ctx, ss->DefaultVertexProgram); #endif #if FEATURE_ARB_fragment_program if (ss->DefaultFragmentProgram) ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentProgram); #endif #if FEATURE_ATI_fragment_shader if (ss->DefaultFragmentShader) ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentShader); #endif #if FEATURE_ARB_vertex_buffer_object if (ss->BufferObjects) _mesa_DeleteHashTable(ss->BufferObjects); #endif if (ss->GL2Objects) _mesa_DeleteHashTable (ss->GL2Objects); #if FEATURE_EXT_framebuffer_object if (ss->FrameBuffers) _mesa_DeleteHashTable(ss->FrameBuffers); if (ss->RenderBuffers) _mesa_DeleteHashTable(ss->RenderBuffers); #endif if (ss->Default1D) (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D); if (ss->Default2D) (*ctx->Driver.DeleteTexture)(ctx, ss->Default2D); if (ss->Default3D) (*ctx->Driver.DeleteTexture)(ctx, ss->Default3D); if (ss->DefaultCubeMap) (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap); if (ss->DefaultRect) (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect); if (ss) _mesa_free(ss); return GL_FALSE; } /** * Deallocate a shared state context and all children structures. * * \param ctx GL context. * \param ss shared state pointer. * * Frees the display lists, the texture objects (calling the driver texture * deletion callback to free its private data) and the vertex programs, as well * as their hash tables. * * \sa alloc_shared_state(). */ static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) { /* Free display lists */ while (1) { GLuint list = _mesa_HashFirstEntry(ss->DisplayList); if (list) { _mesa_destroy_list(ctx, list); } else { break; } } _mesa_DeleteHashTable(ss->DisplayList); /* Free texture objects */ ASSERT(ctx->Driver.DeleteTexture); /* the default textures */ (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D); (*ctx->Driver.DeleteTexture)(ctx, ss->Default2D); (*ctx->Driver.DeleteTexture)(ctx, ss->Default3D); (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap); (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect); /* all other textures */ while (1) { GLuint texName = _mesa_HashFirstEntry(ss->TexObjects); if (texName) { struct gl_texture_object *texObj = (struct gl_texture_object *) _mesa_HashLookup(ss->TexObjects, texName); ASSERT(texObj); (*ctx->Driver.DeleteTexture)(ctx, texObj); _mesa_HashRemove(ss->TexObjects, texName); } else { break; } } _mesa_DeleteHashTable(ss->TexObjects); #if FEATURE_NV_vertex_program /* Free vertex programs */ while (1) { GLuint prog = _mesa_HashFirstEntry(ss->Programs); if (prog) { struct program *p = (struct program *) _mesa_HashLookup(ss->Programs, prog); ASSERT(p); ctx->Driver.DeleteProgram(ctx, p); _mesa_HashRemove(ss->Programs, prog); } else { break; } } _mesa_DeleteHashTable(ss->Programs); #endif #if FEATURE_ARB_vertex_program _mesa_delete_program(ctx, ss->DefaultVertexProgram); #endif #if FEATURE_ARB_fragment_program _mesa_delete_program(ctx, ss->DefaultFragmentProgram); #endif #if FEATURE_ATI_fragment_shader _mesa_delete_program(ctx, ss->DefaultFragmentShader); #endif #if FEATURE_ARB_vertex_buffer_object _mesa_DeleteHashTable(ss->BufferObjects); #endif _mesa_DeleteHashTable (ss->GL2Objects); #if FEATURE_EXT_framebuffer_object _mesa_DeleteHashTable(ss->FrameBuffers); _mesa_DeleteHashTable(ss->RenderBuffers); #endif _glthread_DESTROY_MUTEX(ss->Mutex); FREE(ss); } /** * Initialize fields of gl_current_attrib (aka ctx->Current.*) */ static void _mesa_init_current( GLcontext *ctx ) { GLuint i; /* Current group */ for (i = 0; i < VERT_ATTRIB_MAX; i++) { ASSIGN_4V( ctx->Current.Attrib[i], 0.0, 0.0, 0.0, 1.0 ); } /* special cases: */ ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 1.0, 0.0, 0.0, 1.0 ); ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 1.0 ); ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 ); ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 1.0 ); ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_FOG], 0.0, 0.0, 0.0, 0.0 ); ctx->Current.Index = 1; ctx->Current.EdgeFlag = GL_TRUE; } /** * Initialize fields of gl_constants (aka ctx->Const.*). * Use defaults from config.h. The device drivers will often override * some of these values (such as number of texture units). */ static void _mesa_init_constants( GLcontext *ctx ) { assert(ctx); assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS); assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS); /* Constants, may be overriden (usually only reduced) by device drivers */ ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS; ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS; ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS; ctx->Const.MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE; ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS; ctx->Const.MaxTextureCoordUnits = MAX_TEXTURE_COORD_UNITS; ctx->Const.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS; ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY; ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS; ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE; ctx->Const.SubPixelBits = SUB_PIXEL_BITS; ctx->Const.MinPointSize = MIN_POINT_SIZE; ctx->Const.MaxPointSize = MAX_POINT_SIZE; ctx->Const.MinPointSizeAA = MIN_POINT_SIZE; ctx->Const.MaxPointSizeAA = MAX_POINT_SIZE; ctx->Const.PointSizeGranularity = (GLfloat) POINT_SIZE_GRANULARITY; ctx->Const.MinLineWidth = MIN_LINE_WIDTH; ctx->Const.MaxLineWidth = MAX_LINE_WIDTH; ctx->Const.MinLineWidthAA = MIN_LINE_WIDTH; ctx->Const.MaxLineWidthAA = MAX_LINE_WIDTH; ctx->Const.LineWidthGranularity = (GLfloat) LINE_WIDTH_GRANULARITY; ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE; ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH; ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT; ctx->Const.MaxClipPlanes = MAX_CLIP_PLANES; ctx->Const.MaxLights = MAX_LIGHTS; ctx->Const.MaxShininess = 128.0; ctx->Const.MaxSpotExponent = 128.0; ctx->Const.MaxViewportWidth = MAX_WIDTH; ctx->Const.MaxViewportHeight = MAX_HEIGHT; #if FEATURE_ARB_vertex_program ctx->Const.MaxVertexProgramInstructions = MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS; ctx->Const.MaxVertexProgramAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS; ctx->Const.MaxVertexProgramTemps = MAX_NV_VERTEX_PROGRAM_TEMPS; ctx->Const.MaxVertexProgramLocalParams = MAX_NV_VERTEX_PROGRAM_PARAMS; ctx->Const.MaxVertexProgramEnvParams = MAX_NV_VERTEX_PROGRAM_PARAMS;/*XXX*/ ctx->Const.MaxVertexProgramAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS; #endif #if FEATURE_ARB_fragment_program ctx->Const.MaxFragmentProgramInstructions = MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS; ctx->Const.MaxFragmentProgramAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS; ctx->Const.MaxFragmentProgramTemps = MAX_NV_FRAGMENT_PROGRAM_TEMPS; ctx->Const.MaxFragmentProgramLocalParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS; ctx->Const.MaxFragmentProgramEnvParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS;/*XXX*/ ctx->Const.MaxFragmentProgramAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS; ctx->Const.MaxFragmentProgramAluInstructions = MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS; ctx->Const.MaxFragmentProgramTexInstructions = MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS; ctx->Const.MaxFragmentProgramTexIndirections = MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS; #endif ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES; ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH; /* If we're running in the X server, do bounds checking to prevent * segfaults and server crashes! */ #if defined(XFree86LOADER) && defined(IN_MODULE) ctx->Const.CheckArrayBounds = GL_TRUE; #else ctx->Const.CheckArrayBounds = GL_FALSE; #endif ctx->Const.MaxDrawBuffers = MAX_DRAW_BUFFERS; /* GL_OES_read_format */ ctx->Const.ColorReadFormat = GL_RGBA; ctx->Const.ColorReadType = GL_UNSIGNED_BYTE; #if FEATURE_EXT_framebuffer_object ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS; ctx->Const.MaxRenderbufferSize = MAX_WIDTH; #endif /* sanity checks */ ASSERT(ctx->Const.MaxTextureUnits == MAX2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits)); } /** * Initialize the attribute groups in a GL context. * * \param ctx GL context. * * Initializes all the attributes, calling the respective init* * functions for the more complex data structures. */ static GLboolean init_attrib_groups( GLcontext *ctx ) { assert(ctx); /* Constants */ _mesa_init_constants( ctx ); /* Extensions */ _mesa_init_extensions( ctx ); /* Attribute Groups */ _mesa_init_accum( ctx ); _mesa_init_attrib( ctx ); _mesa_init_buffer_objects( ctx ); _mesa_init_color( ctx ); _mesa_init_colortables( ctx ); _mesa_init_current( ctx ); _mesa_init_depth( ctx ); _mesa_init_debug( ctx ); _mesa_init_display_list( ctx ); _mesa_init_eval( ctx ); _mesa_init_feedback( ctx ); _mesa_init_fog( ctx ); _mesa_init_histogram( ctx ); _mesa_init_hint( ctx ); _mesa_init_line( ctx ); _mesa_init_lighting( ctx ); _mesa_init_matrix( ctx ); _mesa_init_multisample( ctx ); _mesa_init_occlude( ctx ); _mesa_init_pixel( ctx ); _mesa_init_point( ctx ); _mesa_init_polygon( ctx ); _mesa_init_program( ctx ); _mesa_init_rastpos( ctx ); _mesa_init_scissor( ctx ); _mesa_init_shaderobjects (ctx); _mesa_init_stencil( ctx ); _mesa_init_transform( ctx ); _mesa_init_varray( ctx ); _mesa_init_viewport( ctx ); if (!_mesa_init_texture( ctx )) return GL_FALSE; _mesa_init_texture_s3tc( ctx ); _mesa_init_texture_fxt1( ctx ); /* Miscellaneous */ ctx->NewState = _NEW_ALL; ctx->ErrorValue = (GLenum) GL_NO_ERROR; ctx->_Facing = 0; return GL_TRUE; } /** * This is the default function we plug into all dispatch table slots * This helps prevents a segfault when someone calls a GL function without * first checking if the extension's supported. */ static int generic_nop(void) { _mesa_problem(NULL, "User called no-op dispatch function (an unsupported extension function?)"); return 0; } /** * Allocate and initialize a new dispatch table. */ static struct _glapi_table * alloc_dispatch_table(void) { /* Find the larger of Mesa's dispatch table and libGL's dispatch table. * In practice, this'll be the same for stand-alone Mesa. But for DRI * Mesa we do this to accomodate different versions of libGL and various * DRI drivers. */ GLint numEntries = MAX2(_glapi_get_dispatch_table_size(), sizeof(struct _glapi_table) / sizeof(_glapi_proc)); struct _glapi_table *table = (struct _glapi_table *) _mesa_malloc(numEntries * sizeof(_glapi_proc)); if (table) { _glapi_proc *entry = (_glapi_proc *) table; GLint i; for (i = 0; i < numEntries; i++) { entry[i] = (_glapi_proc) generic_nop; } } return table; } /** * Initialize a GLcontext struct (rendering context). * * This includes allocating all the other structs and arrays which hang off of * the context by pointers. * Note that the driver needs to pass in its dd_function_table here since * we need to at least call driverFunctions->NewTextureObject to create the * default texture objects. * * Called by _mesa_create_context(). * * Performs the imports and exports callback tables initialization, and * miscellaneous one-time initializations. If no shared context is supplied one * is allocated, and increase its reference count. Setups the GL API dispatch * tables. Initialize the TNL module. Sets the maximum Z buffer depth. * Finally queries the \c MESA_DEBUG and \c MESA_VERBOSE environment variables * for debug flags. * * \param ctx the context to initialize * \param visual describes the visual attributes for this context * \param share_list points to context to share textures, display lists, * etc with, or NULL * \param driverFunctions table of device driver functions for this context * to use * \param driverContext pointer to driver-specific context data */ GLboolean _mesa_initialize_context( GLcontext *ctx, const GLvisual *visual, GLcontext *share_list, const struct dd_function_table *driverFunctions, void *driverContext ) { ASSERT(driverContext); assert(driverFunctions->NewTextureObject); assert(driverFunctions->FreeTexImageData); /* If the driver wants core Mesa to use special imports, it'll have to * override these defaults. */ _mesa_init_default_imports( &(ctx->imports), driverContext ); /* initialize the exports (Mesa functions called by the window system) */ _mesa_init_default_exports( &(ctx->exports) ); /* misc one-time initializations */ one_time_init(ctx); ctx->Visual = *visual; ctx->DrawBuffer = NULL; ctx->ReadBuffer = NULL; ctx->WinSysDrawBuffer = NULL; ctx->WinSysReadBuffer = NULL; /* Plug in driver functions and context pointer here. * This is important because when we call alloc_shared_state() below * we'll call ctx->Driver.NewTextureObject() to create the default * textures. */ ctx->Driver = *driverFunctions; ctx->DriverCtx = driverContext; if (share_list) { /* share state with another context */ ctx->Shared = share_list->Shared; } else { /* allocate new, unshared state */ if (!alloc_shared_state( ctx )) { return GL_FALSE; } } _glthread_LOCK_MUTEX(ctx->Shared->Mutex); ctx->Shared->RefCount++; _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); if (!init_attrib_groups( ctx )) { free_shared_state(ctx, ctx->Shared); return GL_FALSE; } /* setup the API dispatch tables */ ctx->Exec = alloc_dispatch_table(); ctx->Save = alloc_dispatch_table(); if (!ctx->Exec || !ctx->Save) { free_shared_state(ctx, ctx->Shared); if (ctx->Exec) _mesa_free(ctx->Exec); } _mesa_init_exec_table(ctx->Exec); ctx->CurrentDispatch = ctx->Exec; #if _HAVE_FULL_GL _mesa_init_dlist_table(ctx->Save); _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); /* Neutral tnl module stuff */ _mesa_init_exec_vtxfmt( ctx ); ctx->TnlModule.Current = NULL; ctx->TnlModule.SwapCount = 0; #endif ctx->_MaintainTexEnvProgram = (_mesa_getenv("MESA_TEX_PROG") != NULL); ctx->_MaintainTnlProgram = (_mesa_getenv("MESA_TNL_PROG") != NULL); return GL_TRUE; } /** * Allocate and initialize a GLcontext structure. * Note that the driver needs to pass in its dd_function_table here since * we need to at least call driverFunctions->NewTextureObject to initialize * the rendering context. * * \param visual a GLvisual pointer (we copy the struct contents) * \param share_list another context to share display lists with or NULL * \param driverFunctions points to the dd_function_table into which the * driver has plugged in all its special functions. * \param driverCtx points to the device driver's private context state * * \return pointer to a new __GLcontextRec or NULL if error. */ GLcontext * _mesa_create_context( const GLvisual *visual, GLcontext *share_list, const struct dd_function_table *driverFunctions, void *driverContext ) { GLcontext *ctx; ASSERT(visual); ASSERT(driverContext); ctx = (GLcontext *) _mesa_calloc(sizeof(GLcontext)); if (!ctx) return NULL; if (_mesa_initialize_context(ctx, visual, share_list, driverFunctions, driverContext)) { return ctx; } else { _mesa_free(ctx); return NULL; } } /** * Free the data associated with the given context. * * But doesn't free the GLcontext struct itself. * * \sa _mesa_initialize_context() and init_attrib_groups(). */ void _mesa_free_context_data( GLcontext *ctx ) { /* if we're destroying the current context, unbind it first */ if (ctx == _mesa_get_current_context()) { _mesa_make_current(NULL, NULL, NULL); } _mesa_free_lighting_data( ctx ); _mesa_free_eval_data( ctx ); _mesa_free_texture_data( ctx ); _mesa_free_matrix_data( ctx ); _mesa_free_viewport_data( ctx ); _mesa_free_colortables_data( ctx ); _mesa_free_program_data(ctx); _mesa_free_occlude_data(ctx); #if FEATURE_ARB_vertex_buffer_object _mesa_delete_buffer_object(ctx, ctx->Array.NullBufferObj); #endif /* free dispatch tables */ _mesa_free(ctx->Exec); _mesa_free(ctx->Save); /* Shared context state (display lists, textures, etc) */ _glthread_LOCK_MUTEX(ctx->Shared->Mutex); ctx->Shared->RefCount--; assert(ctx->Shared->RefCount >= 0); _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); if (ctx->Shared->RefCount == 0) { /* free shared state */ free_shared_state( ctx, ctx->Shared ); } if (ctx->Extensions.String) FREE((void *) ctx->Extensions.String); } /** * Destroy a GLcontext structure. * * \param ctx GL context. * * Calls _mesa_free_context_data() and frees the GLcontext structure itself. */ void _mesa_destroy_context( GLcontext *ctx ) { if (ctx) { _mesa_free_context_data(ctx); FREE( (void *) ctx ); } } #if _HAVE_FULL_GL /** * Copy attribute groups from one context to another. * * \param src source context * \param dst destination context * \param mask bitwise OR of GL_*_BIT flags * * According to the bits specified in \p mask, copies the corresponding * attributes from \p src into \p dst. For many of the attributes a simple \c * memcpy is not enough due to the existence of internal pointers in their data * structures. */ void _mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) { if (mask & GL_ACCUM_BUFFER_BIT) { /* OK to memcpy */ dst->Accum = src->Accum; } if (mask & GL_COLOR_BUFFER_BIT) { /* OK to memcpy */ dst->Color = src->Color; } if (mask & GL_CURRENT_BIT) { /* OK to memcpy */ dst->Current = src->Current; } if (mask & GL_DEPTH_BUFFER_BIT) { /* OK to memcpy */ dst->Depth = src->Depth; } if (mask & GL_ENABLE_BIT) { /* no op */ } if (mask & GL_EVAL_BIT) { /* OK to memcpy */ dst->Eval = src->Eval; } if (mask & GL_FOG_BIT) { /* OK to memcpy */ dst->Fog = src->Fog; } if (mask & GL_HINT_BIT) { /* OK to memcpy */ dst->Hint = src->Hint; } if (mask & GL_LIGHTING_BIT) { GLuint i; /* begin with memcpy */ MEMCPY( &dst->Light, &src->Light, sizeof(struct gl_light) ); /* fixup linked lists to prevent pointer insanity */ make_empty_list( &(dst->Light.EnabledList) ); for (i = 0; i < MAX_LIGHTS; i++) { if (dst->Light.Light[i].Enabled) { insert_at_tail(&(dst->Light.EnabledList), &(dst->Light.Light[i])); } } } if (mask & GL_LINE_BIT) { /* OK to memcpy */ dst->Line = src->Line; } if (mask & GL_LIST_BIT) { /* OK to memcpy */ dst->List = src->List; } if (mask & GL_PIXEL_MODE_BIT) { /* OK to memcpy */ dst->Pixel = src->Pixel; } if (mask & GL_POINT_BIT) { /* OK to memcpy */ dst->Point = src->Point; } if (mask & GL_POLYGON_BIT) { /* OK to memcpy */ dst->Polygon = src->Polygon; } if (mask & GL_POLYGON_STIPPLE_BIT) { /* Use loop instead of MEMCPY due to problem with Portland Group's * C compiler. Reported by John Stone. */ GLuint i; for (i = 0; i < 32; i++) { dst->PolygonStipple[i] = src->PolygonStipple[i]; } } if (mask & GL_SCISSOR_BIT) { /* OK to memcpy */ dst->Scissor = src->Scissor; } if (mask & GL_STENCIL_BUFFER_BIT) { /* OK to memcpy */ dst->Stencil = src->Stencil; } if (mask & GL_TEXTURE_BIT) { /* Cannot memcpy because of pointers */ _mesa_copy_texture_state(src, dst); } if (mask & GL_TRANSFORM_BIT) { /* OK to memcpy */ dst->Transform = src->Transform; } if (mask & GL_VIEWPORT_BIT) { /* Cannot use memcpy, because of pointers in GLmatrix _WindowMap */ dst->Viewport.X = src->Viewport.X; dst->Viewport.Y = src->Viewport.Y; dst->Viewport.Width = src->Viewport.Width; dst->Viewport.Height = src->Viewport.Height; dst->Viewport.Near = src->Viewport.Near; dst->Viewport.Far = src->Viewport.Far; _math_matrix_copy(&dst->Viewport._WindowMap, &src->Viewport._WindowMap); } /* XXX FIXME: Call callbacks? */ dst->NewState = _NEW_ALL; } #endif /** * Check if the given context can render into the given framebuffer * by checking visual attributes. * \return GL_TRUE if compatible, GL_FALSE otherwise. */ static GLboolean check_compatible(const GLcontext *ctx, const GLframebuffer *buffer) { const GLvisual *ctxvis = &ctx->Visual; const GLvisual *bufvis = &buffer->Visual; if (ctxvis == bufvis) return GL_TRUE; if (ctxvis->rgbMode != bufvis->rgbMode) return GL_FALSE; if (ctxvis->doubleBufferMode && !bufvis->doubleBufferMode) return GL_FALSE; if (ctxvis->stereoMode && !bufvis->stereoMode) return GL_FALSE; if (ctxvis->haveAccumBuffer && !bufvis->haveAccumBuffer) return GL_FALSE; if (ctxvis->haveDepthBuffer && !bufvis->haveDepthBuffer) return GL_FALSE; if (ctxvis->haveStencilBuffer && !bufvis->haveStencilBuffer) return GL_FALSE; if (ctxvis->redMask && ctxvis->redMask != bufvis->redMask) return GL_FALSE; if (ctxvis->greenMask && ctxvis->greenMask != bufvis->greenMask) return GL_FALSE; if (ctxvis->blueMask && ctxvis->blueMask != bufvis->blueMask) return GL_FALSE; if (ctxvis->depthBits && ctxvis->depthBits != bufvis->depthBits) return GL_FALSE; if (ctxvis->stencilBits && ctxvis->stencilBits != bufvis->stencilBits) return GL_FALSE; return GL_TRUE; } /** * Bind the given context to the given draw-buffer and read-buffer and * make it the current context for this thread. * * \param newCtx new GL context. If NULL then there will be no current GL * context. * \param drawBuffer draw framebuffer. * \param readBuffer read framebuffer. * * Check that the context's and framebuffer's visuals are compatible, returning * immediately otherwise. Sets the glapi current context via * _glapi_set_context(). If \p newCtx is not NULL, associates \p drawBuffer and * \p readBuffer with it and calls dd_function_table::ResizeBuffers if the buffers size has changed. * Calls dd_function_table::MakeCurrent callback if defined. * * When a context is bound by the first time and the \c MESA_INFO environment * variable is set it calls print_info() as an aid for remote user * troubleshooting. */ void _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ) { if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(newCtx, "_mesa_make_current()\n"); /* Check that the context's and framebuffer's visuals are compatible. */ if (newCtx && drawBuffer && newCtx->DrawBuffer != drawBuffer) { if (!check_compatible(newCtx, drawBuffer)) return; } if (newCtx && readBuffer && newCtx->ReadBuffer != readBuffer) { if (!check_compatible(newCtx, readBuffer)) return; } #if !defined(IN_DRI_DRIVER) /* We call this function periodically (just here for now) in * order to detect when multithreading has begun. In a DRI driver, this * step is done by the driver loader (e.g., libGL). */ _glapi_check_multithread(); #endif /* !defined(IN_DRI_DRIVER) */ _glapi_set_context((void *) newCtx); ASSERT(_mesa_get_current_context() == newCtx); if (!newCtx) { _glapi_set_dispatch(NULL); /* none current */ } else { _glapi_set_dispatch(newCtx->CurrentDispatch); if (drawBuffer && readBuffer) { /* TODO: check if newCtx and buffer's visual match??? */ ASSERT(drawBuffer->Name == 0); ASSERT(readBuffer->Name == 0); newCtx->WinSysDrawBuffer = drawBuffer; newCtx->WinSysReadBuffer = readBuffer; /* don't replace user-buffer bindings with window system buffer */ if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) { newCtx->DrawBuffer = drawBuffer; newCtx->ReadBuffer = readBuffer; } newCtx->NewState |= _NEW_BUFFERS; #if _HAVE_FULL_GL if (!drawBuffer->Initialized) { /* get initial window size */ GLuint bufWidth, bufHeight; /* ask device driver for size of the buffer */ (*newCtx->Driver.GetBufferSize)(drawBuffer, &bufWidth, &bufHeight); /* set initial buffer size */ if (newCtx->Driver.ResizeBuffers) newCtx->Driver.ResizeBuffers(newCtx, drawBuffer, bufWidth, bufHeight); drawBuffer->Initialized = GL_TRUE; } if (readBuffer != drawBuffer && !readBuffer->Initialized) { /* get initial window size */ GLuint bufWidth, bufHeight; /* ask device driver for size of the buffer */ (*newCtx->Driver.GetBufferSize)(readBuffer, &bufWidth, &bufHeight); /* set initial buffer size */ if (newCtx->Driver.ResizeBuffers) newCtx->Driver.ResizeBuffers(newCtx, readBuffer, bufWidth, bufHeight); readBuffer->Initialized = GL_TRUE; } #endif if (newCtx->FirstTimeCurrent) { /* set initial viewport and scissor size now */ _mesa_set_viewport(newCtx, 0, 0, drawBuffer->Width, drawBuffer->Height); newCtx->Scissor.Width = drawBuffer->Width; newCtx->Scissor.Height = drawBuffer->Height; } } /* Alert the driver - usually passed on to the sw t&l module, * but also used to detect threaded cases in the radeon codegen * hw t&l module. */ if (newCtx->Driver.MakeCurrent) newCtx->Driver.MakeCurrent( newCtx, drawBuffer, readBuffer ); /* We can use this to help debug user's problems. Tell them to set * the MESA_INFO env variable before running their app. Then the * first time each context is made current we'll print some useful * information. */ if (newCtx->FirstTimeCurrent) { if (_mesa_getenv("MESA_INFO")) { _mesa_print_info(); } newCtx->FirstTimeCurrent = GL_FALSE; } } } /** * Make context 'ctx' share the display lists, textures and programs * that are associated with 'ctxToShare'. * Any display lists, textures or programs associated with 'ctx' will * be deleted if nobody else is sharing them. */ GLboolean _mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare) { if (ctx && ctxToShare && ctx->Shared && ctxToShare->Shared) { ctx->Shared->RefCount--; if (ctx->Shared->RefCount == 0) { free_shared_state(ctx, ctx->Shared); } ctx->Shared = ctxToShare->Shared; ctx->Shared->RefCount++; return GL_TRUE; } else { return GL_FALSE; } } /** * Get current context for the calling thread. * * \return pointer to the current GL context. * * Calls _glapi_get_context(). This isn't the fastest way to get the current * context. If you need speed, see the #GET_CURRENT_CONTEXT macro in context.h. */ GLcontext * _mesa_get_current_context( void ) { return (GLcontext *) _glapi_get_context(); } /** * Get context's current API dispatch table. * * It'll either be the immediate-mode execute dispatcher or the display list * compile dispatcher. * * \param ctx GL context. * * \return pointer to dispatch_table. * * Simply returns __GLcontextRec::CurrentDispatch. */ struct _glapi_table * _mesa_get_dispatch(GLcontext *ctx) { return ctx->CurrentDispatch; } /*@}*/ /**********************************************************************/ /** \name Miscellaneous functions */ /**********************************************************************/ /*@{*/ /** * Record an error. * * \param ctx GL context. * \param error error code. * * Records the given error code and call the driver's dd_function_table::Error * function if defined. * * \sa * This is called via _mesa_error(). */ void _mesa_record_error( GLcontext *ctx, GLenum error ) { if (!ctx) return; if (ctx->ErrorValue == GL_NO_ERROR) { ctx->ErrorValue = error; } /* Call device driver's error handler, if any. This is used on the Mac. */ if (ctx->Driver.Error) { (*ctx->Driver.Error)( ctx ); } } /** * Execute glFinish(). * * Calls the #ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH macro and the * dd_function_table::Finish driver callback, if not NULL. */ void GLAPIENTRY _mesa_Finish( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->Driver.Finish) { (*ctx->Driver.Finish)( ctx ); } } /** * Execute glFlush(). * * Calls the #ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH macro and the * dd_function_table::Flush driver callback, if not NULL. */ void GLAPIENTRY _mesa_Flush( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->Driver.Flush) { (*ctx->Driver.Flush)( ctx ); } } /*@}*/ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/context.h0000644000000000000000000002242413614532424020002 0ustar /** * \file context.h * Mesa context/visual/framebuffer management functions. * * There are three Mesa data types which are meant to be used by device * drivers: * - GLcontext: this contains the Mesa rendering state * - GLvisual: this describes the color buffer (RGB vs. ci), whether or not * there's a depth buffer, stencil buffer, etc. * - GLframebuffer: contains pointers to the depth buffer, stencil buffer, * accum buffer and alpha buffers. * * These types should be encapsulated by corresponding device driver * data types. See xmesa.h and xmesaP.h for an example. * * In OOP terms, GLcontext, GLvisual, and GLframebuffer are base classes * which the device driver must derive from. * * The following functions create and destroy these data types. */ /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef CONTEXT_H #define CONTEXT_H #include "glapi.h" #include "imports.h" #include "mtypes.h" /**********************************************************************/ /** \name Create/destroy a GLvisual. */ /*@{*/ extern GLvisual * _mesa_create_visual( GLboolean rgbFlag, GLboolean dbFlag, GLboolean stereoFlag, GLint redBits, GLint greenBits, GLint blueBits, GLint alphaBits, GLint indexBits, GLint depthBits, GLint stencilBits, GLint accumRedBits, GLint accumGreenBits, GLint accumBlueBits, GLint accumAlphaBits, GLint numSamples ); extern GLboolean _mesa_initialize_visual( GLvisual *v, GLboolean rgbFlag, GLboolean dbFlag, GLboolean stereoFlag, GLint redBits, GLint greenBits, GLint blueBits, GLint alphaBits, GLint indexBits, GLint depthBits, GLint stencilBits, GLint accumRedBits, GLint accumGreenBits, GLint accumBlueBits, GLint accumAlphaBits, GLint numSamples ); extern void _mesa_destroy_visual( GLvisual *vis ); /*@}*/ /**********************************************************************/ /** \name Create/destroy a GLcontext. */ /*@{*/ extern GLcontext * _mesa_create_context( const GLvisual *visual, GLcontext *share_list, const struct dd_function_table *driverFunctions, void *driverContext ); extern GLboolean _mesa_initialize_context( GLcontext *ctx, const GLvisual *visual, GLcontext *share_list, const struct dd_function_table *driverFunctions, void *driverContext ); extern void _mesa_free_context_data( GLcontext *ctx ); extern void _mesa_destroy_context( GLcontext *ctx ); extern void _mesa_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); extern void _mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ); extern GLboolean _mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare); extern GLcontext * _mesa_get_current_context(void); /*@}*/ /**********************************************************************/ /** \name OpenGL SI-style export functions. */ /*@{*/ extern GLboolean _mesa_destroyContext(__GLcontext *gc); extern GLboolean _mesa_loseCurrent(__GLcontext *gc); extern GLboolean _mesa_makeCurrent(__GLcontext *gc); extern GLboolean _mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare); extern GLboolean _mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask); extern GLboolean _mesa_forceCurrent(__GLcontext *gc); extern GLboolean _mesa_notifyResize(__GLcontext *gc); extern void _mesa_notifyDestroy(__GLcontext *gc); extern void _mesa_notifySwapBuffers(__GLcontext *gc); extern struct __GLdispatchStateRec * _mesa_dispatchExec(__GLcontext *gc); extern void _mesa_beginDispatchOverride(__GLcontext *gc); extern void _mesa_endDispatchOverride(__GLcontext *gc); /*@}*/ extern struct _glapi_table * _mesa_get_dispatch(GLcontext *ctx); /**********************************************************************/ /** \name Miscellaneous */ /*@{*/ extern void _mesa_record_error( GLcontext *ctx, GLenum error ); extern void GLAPIENTRY _mesa_Finish( void ); extern void GLAPIENTRY _mesa_Flush( void ); /*@}*/ /**********************************************************************/ /** \name Macros for contexts/flushing. */ /*@{*/ /** * Flush vertices. * * \param ctx GL context. * \param newstate new state. * * Checks if dd_function_table::NeedFlush is marked to flush stored vertices, * and calls dd_function_table::FlushVertices if so. Marks * __GLcontextRec::NewState with \p newstate. */ #define FLUSH_VERTICES(ctx, newstate) \ do { \ if (MESA_VERBOSE & VERBOSE_STATE) \ _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", MESA_FUNCTION);\ if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \ ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \ ctx->NewState |= newstate; \ } while (0) /** * Flush current state. * * \param ctx GL context. * \param newstate new state. * * Checks if dd_function_table::NeedFlush is marked to flush current state, * and calls dd_function_table::FlushVertices if so. Marks * __GLcontextRec::NewState with \p newstate. */ #define FLUSH_CURRENT(ctx, newstate) \ do { \ if (MESA_VERBOSE & VERBOSE_STATE) \ _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", MESA_FUNCTION); \ if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \ ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \ ctx->NewState |= newstate; \ } while (0) /** * Macro to assert that the API call was made outside the * glBegin()/glEnd() pair, with return value. * * \param ctx GL context. * \param retval value to return value in case the assertion fails. */ #define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \ do { \ if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \ _mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \ return retval; \ } \ } while (0) /** * Macro to assert that the API call was made outside the * glBegin()/glEnd() pair. * * \param ctx GL context. */ #define ASSERT_OUTSIDE_BEGIN_END(ctx) \ do { \ if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \ _mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \ return; \ } \ } while (0) /** * Macro to assert that the API call was made outside the * glBegin()/glEnd() pair and flush the vertices. * * \param ctx GL context. */ #define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx) \ do { \ ASSERT_OUTSIDE_BEGIN_END(ctx); \ FLUSH_VERTICES(ctx, 0); \ } while (0) /** * Macro to assert that the API call was made outside the * glBegin()/glEnd() pair and flush the vertices, with return value. * * \param ctx GL context. * \param retval value to return value in case the assertion fails. */ #define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \ do { \ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval); \ FLUSH_VERTICES(ctx, 0); \ } while (0) /*@}*/ /** * Macros to help evaluate current state conditions */ /*@{*/ /** * Is the secondary color needed? */ #define NEED_SECONDARY_COLOR(CTX) \ (((CTX)->Light.Enabled && \ (CTX)->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) \ || (CTX)->Fog.ColorSumEnabled \ || ((CTX)->VertexProgram._Enabled && \ ((CTX)->VertexProgram.Current->InputsRead & VERT_BIT_COLOR1)) \ || ((CTX)->FragmentProgram._Enabled && \ ((CTX)->FragmentProgram.Current->InputsRead & FRAG_BIT_COL1)) \ ) /** * Is two-sided lighting in effect? */ #define NEED_TWO_SIDED_LIGHTING(CTX) \ (ctx->Light.Enabled && ctx->Light.Model.TwoSide) /*@}*/ #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/convolve.c0000644000000000000000000014650413614532424020152 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Image convolution functions. * * Notes: filter kernel elements are indexed by and as in * the GL spec. */ #include "glheader.h" #include "bufferobj.h" #include "colormac.h" #include "convolve.h" #include "context.h" #include "image.h" #include "mtypes.h" #include "pixel.h" #include "state.h" /* * Given an internalFormat token passed to glConvolutionFilter * or glSeparableFilter, return the corresponding base format. * Return -1 if invalid token. */ static GLint base_filter_format( GLenum format ) { switch (format) { case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8: case GL_ALPHA12: case GL_ALPHA16: return GL_ALPHA; case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8: case GL_LUMINANCE12: case GL_LUMINANCE16: return GL_LUMINANCE; case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE6_ALPHA2: case GL_LUMINANCE8_ALPHA8: case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: return GL_LUMINANCE_ALPHA; case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: return GL_INTENSITY; case GL_RGB: case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: return GL_RGB; case 4: case GL_RGBA: case GL_RGBA2: case GL_RGBA4: case GL_RGB5_A1: case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: return GL_RGBA; default: return -1; /* error */ } } void GLAPIENTRY _mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) { GLint baseFormat; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target != GL_CONVOLUTION_1D) { _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(target)"); return; } baseFormat = base_filter_format(internalFormat); if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(internalFormat)"); return; } if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter1D(width)"); return; } if (!_mesa_is_legal_format_and_type(ctx, format, type)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter1D(format or type)"); return; } if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT || format == GL_INTENSITY || type == GL_BITMAP) { _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(format or type)"); return; } ctx->Convolution1D.Format = format; ctx->Convolution1D.InternalFormat = internalFormat; ctx->Convolution1D.Width = width; ctx->Convolution1D.Height = 1; if (ctx->Unpack.BufferObj->Name) { /* unpack filter from PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(1, &ctx->Unpack, width, 1, 1, format, type, image)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter1D(invalid PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, ctx->Unpack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter1D(PBO is mapped)"); return; } image = ADD_POINTERS(buf, image); } else if (!image) { return; } _mesa_unpack_color_span_float(ctx, width, GL_RGBA, ctx->Convolution1D.Filter, format, type, image, &ctx->Unpack, 0); /* transferOps */ if (ctx->Unpack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, ctx->Unpack.BufferObj); } _mesa_scale_and_bias_rgba(width, (GLfloat (*)[4]) ctx->Convolution1D.Filter, ctx->Pixel.ConvolutionFilterScale[0][0], ctx->Pixel.ConvolutionFilterScale[0][1], ctx->Pixel.ConvolutionFilterScale[0][2], ctx->Pixel.ConvolutionFilterScale[0][3], ctx->Pixel.ConvolutionFilterBias[0][0], ctx->Pixel.ConvolutionFilterBias[0][1], ctx->Pixel.ConvolutionFilterBias[0][2], ctx->Pixel.ConvolutionFilterBias[0][3]); ctx->NewState |= _NEW_PIXEL; } void GLAPIENTRY _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) { GLint baseFormat; GLint i; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target != GL_CONVOLUTION_2D) { _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(target)"); return; } baseFormat = base_filter_format(internalFormat); if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(internalFormat)"); return; } if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(width)"); return; } if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { _mesa_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(height)"); return; } if (!_mesa_is_legal_format_and_type(ctx, format, type)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter2D(format or type)"); return; } if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT || format == GL_INTENSITY || type == GL_BITMAP) { _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(format or type)"); return; } /* this should have been caught earlier */ assert(_mesa_components_in_format(format)); ctx->Convolution2D.Format = format; ctx->Convolution2D.InternalFormat = internalFormat; ctx->Convolution2D.Width = width; ctx->Convolution2D.Height = height; if (ctx->Unpack.BufferObj->Name) { /* unpack filter from PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1, format, type, image)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter2D(invalid PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, ctx->Unpack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glConvolutionFilter2D(PBO is mapped)"); return; } image = ADD_POINTERS(buf, image); } else if (!image) { return; } /* Unpack filter image. We always store filters in RGBA format. */ for (i = 0; i < height; i++) { const GLvoid *src = _mesa_image_address2d(&ctx->Unpack, image, width, height, format, type, i, 0); GLfloat *dst = ctx->Convolution2D.Filter + i * width * 4; _mesa_unpack_color_span_float(ctx, width, GL_RGBA, dst, format, type, src, &ctx->Unpack, 0); /* transferOps */ } if (ctx->Unpack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, ctx->Unpack.BufferObj); } _mesa_scale_and_bias_rgba(width * height, (GLfloat (*)[4]) ctx->Convolution2D.Filter, ctx->Pixel.ConvolutionFilterScale[1][0], ctx->Pixel.ConvolutionFilterScale[1][1], ctx->Pixel.ConvolutionFilterScale[1][2], ctx->Pixel.ConvolutionFilterScale[1][3], ctx->Pixel.ConvolutionFilterBias[1][0], ctx->Pixel.ConvolutionFilterBias[1][1], ctx->Pixel.ConvolutionFilterBias[1][2], ctx->Pixel.ConvolutionFilterBias[1][3]); ctx->NewState |= _NEW_PIXEL; } void GLAPIENTRY _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) { GET_CURRENT_CONTEXT(ctx); GLuint c; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { case GL_CONVOLUTION_1D: c = 0; break; case GL_CONVOLUTION_2D: c = 1; break; case GL_SEPARABLE_2D: c = 2; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(target)"); return; } switch (pname) { case GL_CONVOLUTION_BORDER_MODE: if (param == (GLfloat) GL_REDUCE || param == (GLfloat) GL_CONSTANT_BORDER || param == (GLfloat) GL_REPLICATE_BORDER) { ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(params)"); return; } break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(pname)"); return; } ctx->NewState |= _NEW_PIXEL; } void GLAPIENTRY _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); GLuint c; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { case GL_CONVOLUTION_1D: c = 0; break; case GL_CONVOLUTION_2D: c = 1; break; case GL_SEPARABLE_2D: c = 2; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(target)"); return; } switch (pname) { case GL_CONVOLUTION_BORDER_COLOR: COPY_4V(ctx->Pixel.ConvolutionBorderColor[c], params); break; case GL_CONVOLUTION_BORDER_MODE: if (params[0] == (GLfloat) GL_REDUCE || params[0] == (GLfloat) GL_CONSTANT_BORDER || params[0] == (GLfloat) GL_REPLICATE_BORDER) { ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(params)"); return; } break; case GL_CONVOLUTION_FILTER_SCALE: COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); break; case GL_CONVOLUTION_FILTER_BIAS: COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(pname)"); return; } ctx->NewState |= _NEW_PIXEL; } void GLAPIENTRY _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) { GET_CURRENT_CONTEXT(ctx); GLuint c; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { case GL_CONVOLUTION_1D: c = 0; break; case GL_CONVOLUTION_2D: c = 1; break; case GL_SEPARABLE_2D: c = 2; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(target)"); return; } switch (pname) { case GL_CONVOLUTION_BORDER_MODE: if (param == (GLint) GL_REDUCE || param == (GLint) GL_CONSTANT_BORDER || param == (GLint) GL_REPLICATE_BORDER) { ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(params)"); return; } break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(pname)"); return; } ctx->NewState |= _NEW_PIXEL; } void GLAPIENTRY _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) { GET_CURRENT_CONTEXT(ctx); GLuint c; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { case GL_CONVOLUTION_1D: c = 0; break; case GL_CONVOLUTION_2D: c = 1; break; case GL_SEPARABLE_2D: c = 2; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(target)"); return; } switch (pname) { case GL_CONVOLUTION_BORDER_COLOR: ctx->Pixel.ConvolutionBorderColor[c][0] = INT_TO_FLOAT(params[0]); ctx->Pixel.ConvolutionBorderColor[c][1] = INT_TO_FLOAT(params[1]); ctx->Pixel.ConvolutionBorderColor[c][2] = INT_TO_FLOAT(params[2]); ctx->Pixel.ConvolutionBorderColor[c][3] = INT_TO_FLOAT(params[3]); break; case GL_CONVOLUTION_BORDER_MODE: if (params[0] == (GLint) GL_REDUCE || params[0] == (GLint) GL_CONSTANT_BORDER || params[0] == (GLint) GL_REPLICATE_BORDER) { ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(params)"); return; } break; case GL_CONVOLUTION_FILTER_SCALE: /* COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); */ /* need cast to prevent compiler warnings */ ctx->Pixel.ConvolutionFilterScale[c][0] = (GLfloat) params[0]; ctx->Pixel.ConvolutionFilterScale[c][1] = (GLfloat) params[1]; ctx->Pixel.ConvolutionFilterScale[c][2] = (GLfloat) params[2]; ctx->Pixel.ConvolutionFilterScale[c][3] = (GLfloat) params[3]; break; case GL_CONVOLUTION_FILTER_BIAS: /* COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); */ /* need cast to prevent compiler warnings */ ctx->Pixel.ConvolutionFilterBias[c][0] = (GLfloat) params[0]; ctx->Pixel.ConvolutionFilterBias[c][1] = (GLfloat) params[1]; ctx->Pixel.ConvolutionFilterBias[c][2] = (GLfloat) params[2]; ctx->Pixel.ConvolutionFilterBias[c][3] = (GLfloat) params[3]; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(pname)"); return; } ctx->NewState |= _NEW_PIXEL; } void GLAPIENTRY _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) { GLint baseFormat; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target != GL_CONVOLUTION_1D) { _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(target)"); return; } baseFormat = base_filter_format(internalFormat); if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(internalFormat)"); return; } if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter1D(width)"); return; } ctx->Driver.CopyConvolutionFilter1D( ctx, target, internalFormat, x, y, width); } void GLAPIENTRY _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height) { GLint baseFormat; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target != GL_CONVOLUTION_2D) { _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(target)"); return; } baseFormat = base_filter_format(internalFormat); if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(internalFormat)"); return; } if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(width)"); return; } if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(height)"); return; } ctx->Driver.CopyConvolutionFilter2D( ctx, target, internalFormat, x, y, width, height ); } void GLAPIENTRY _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) { const struct gl_convolution_attrib *filter; GLuint row; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->NewState) { _mesa_update_state(ctx); } if (!_mesa_is_legal_format_and_type(ctx, format, type)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)"); return; } if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT || format == GL_INTENSITY || type == GL_BITMAP) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)"); return; } switch (target) { case GL_CONVOLUTION_1D: filter = &(ctx->Convolution1D); break; case GL_CONVOLUTION_2D: filter = &(ctx->Convolution2D); break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(target)"); return; } if (ctx->Pack.BufferObj->Name) { /* Pack the filter into a PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(2, &ctx->Pack, filter->Width, filter->Height, 1, format, type, image)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(invalid PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(PBO is mapped)"); return; } image = ADD_POINTERS(image, buf); } for (row = 0; row < filter->Height; row++) { GLvoid *dst = _mesa_image_address2d(&ctx->Pack, image, filter->Width, filter->Height, format, type, row, 0); const GLfloat *src = filter->Filter + row * filter->Width * 4; _mesa_pack_rgba_span_float(ctx, filter->Width, (const GLfloat (*)[4]) src, format, type, dst, &ctx->Pack, 0); } if (ctx->Pack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, ctx->Pack.BufferObj); } } void GLAPIENTRY _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); const struct gl_convolution_attrib *conv; GLuint c; ASSERT_OUTSIDE_BEGIN_END(ctx); switch (target) { case GL_CONVOLUTION_1D: c = 0; conv = &ctx->Convolution1D; break; case GL_CONVOLUTION_2D: c = 1; conv = &ctx->Convolution2D; break; case GL_SEPARABLE_2D: c = 2; conv = &ctx->Separable2D; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(target)"); return; } switch (pname) { case GL_CONVOLUTION_BORDER_COLOR: COPY_4V(params, ctx->Pixel.ConvolutionBorderColor[c]); break; case GL_CONVOLUTION_BORDER_MODE: *params = (GLfloat) ctx->Pixel.ConvolutionBorderMode[c]; break; case GL_CONVOLUTION_FILTER_SCALE: COPY_4V(params, ctx->Pixel.ConvolutionFilterScale[c]); break; case GL_CONVOLUTION_FILTER_BIAS: COPY_4V(params, ctx->Pixel.ConvolutionFilterBias[c]); break; case GL_CONVOLUTION_FORMAT: *params = (GLfloat) conv->Format; break; case GL_CONVOLUTION_WIDTH: *params = (GLfloat) conv->Width; break; case GL_CONVOLUTION_HEIGHT: *params = (GLfloat) conv->Height; break; case GL_MAX_CONVOLUTION_WIDTH: *params = (GLfloat) ctx->Const.MaxConvolutionWidth; break; case GL_MAX_CONVOLUTION_HEIGHT: *params = (GLfloat) ctx->Const.MaxConvolutionHeight; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(pname)"); return; } } void GLAPIENTRY _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); const struct gl_convolution_attrib *conv; GLuint c; ASSERT_OUTSIDE_BEGIN_END(ctx); switch (target) { case GL_CONVOLUTION_1D: c = 0; conv = &ctx->Convolution1D; break; case GL_CONVOLUTION_2D: c = 1; conv = &ctx->Convolution2D; break; case GL_SEPARABLE_2D: c = 2; conv = &ctx->Separable2D; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(target)"); return; } switch (pname) { case GL_CONVOLUTION_BORDER_COLOR: params[0] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][0]); params[1] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][1]); params[2] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][2]); params[3] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][3]); break; case GL_CONVOLUTION_BORDER_MODE: *params = (GLint) ctx->Pixel.ConvolutionBorderMode[c]; break; case GL_CONVOLUTION_FILTER_SCALE: params[0] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][0]; params[1] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][1]; params[2] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][2]; params[3] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][3]; break; case GL_CONVOLUTION_FILTER_BIAS: params[0] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][0]; params[1] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][1]; params[2] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][2]; params[3] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][3]; break; case GL_CONVOLUTION_FORMAT: *params = (GLint) conv->Format; break; case GL_CONVOLUTION_WIDTH: *params = (GLint) conv->Width; break; case GL_CONVOLUTION_HEIGHT: *params = (GLint) conv->Height; break; case GL_MAX_CONVOLUTION_WIDTH: *params = (GLint) ctx->Const.MaxConvolutionWidth; break; case GL_MAX_CONVOLUTION_HEIGHT: *params = (GLint) ctx->Const.MaxConvolutionHeight; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(pname)"); return; } } void GLAPIENTRY _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) { const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; const struct gl_convolution_attrib *filter; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->NewState) { _mesa_update_state(ctx); } if (target != GL_SEPARABLE_2D) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter(target)"); return; } if (!_mesa_is_legal_format_and_type(ctx, format, type)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter(format or type)"); return; } if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT || format == GL_INTENSITY || type == GL_BITMAP) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)"); return; } filter = &ctx->Separable2D; if (ctx->Pack.BufferObj->Name) { /* Pack filter into PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(1, &ctx->Pack, filter->Width, 1, 1, format, type, row)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetSeparableFilter(invalid PBO access, width)"); return; } if (!_mesa_validate_pbo_access(1, &ctx->Pack, filter->Height, 1, 1, format, type, column)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetSeparableFilter(invalid PBO access, height)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetSeparableFilter(PBO is mapped)"); return; } row = ADD_POINTERS(buf, row); column = ADD_POINTERS(buf, column); } /* Row filter */ if (row) { GLvoid *dst = _mesa_image_address1d(&ctx->Pack, row, filter->Width, format, type, 0); _mesa_pack_rgba_span_float(ctx, filter->Width, (const GLfloat (*)[4]) filter->Filter, format, type, dst, &ctx->Pack, 0); } /* Column filter */ if (column) { GLvoid *dst = _mesa_image_address1d(&ctx->Pack, column, filter->Height, format, type, 0); const GLfloat *src = filter->Filter + colStart; _mesa_pack_rgba_span_float(ctx, filter->Height, (const GLfloat (*)[4]) src, format, type, dst, &ctx->Pack, 0); } (void) span; /* unused at this time */ if (ctx->Pack.BufferObj->Name) { /* Pack filter into PBO */ ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, ctx->Unpack.BufferObj); } } void GLAPIENTRY _mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) { const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; GLint baseFormat; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target != GL_SEPARABLE_2D) { _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(target)"); return; } baseFormat = base_filter_format(internalFormat); if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(internalFormat)"); return; } if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { _mesa_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(width)"); return; } if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { _mesa_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(height)"); return; } if (!_mesa_is_legal_format_and_type(ctx, format, type)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glSeparableFilter2D(format or type)"); return; } if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT || format == GL_INTENSITY || type == GL_BITMAP) { _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(format or type)"); return; } ctx->Separable2D.Format = format; ctx->Separable2D.InternalFormat = internalFormat; ctx->Separable2D.Width = width; ctx->Separable2D.Height = height; if (ctx->Unpack.BufferObj->Name) { /* unpack filter from PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(1, &ctx->Unpack, width, 1, 1, format, type, row)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glSeparableFilter2D(invalid PBO access, width)"); return; } if (!_mesa_validate_pbo_access(1, &ctx->Unpack, height, 1, 1, format, type, column)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glSeparableFilter2D(invalid PBO access, height)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, ctx->Unpack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glSeparableFilter2D(PBO is mapped)"); return; } row = ADD_POINTERS(buf, row); column = ADD_POINTERS(buf, column); } /* unpack row filter */ if (row) { _mesa_unpack_color_span_float(ctx, width, GL_RGBA, ctx->Separable2D.Filter, format, type, row, &ctx->Unpack, 0); /* transferOps */ _mesa_scale_and_bias_rgba(width, (GLfloat (*)[4]) ctx->Separable2D.Filter, ctx->Pixel.ConvolutionFilterScale[2][0], ctx->Pixel.ConvolutionFilterScale[2][1], ctx->Pixel.ConvolutionFilterScale[2][2], ctx->Pixel.ConvolutionFilterScale[2][3], ctx->Pixel.ConvolutionFilterBias[2][0], ctx->Pixel.ConvolutionFilterBias[2][1], ctx->Pixel.ConvolutionFilterBias[2][2], ctx->Pixel.ConvolutionFilterBias[2][3]); } /* unpack column filter */ if (column) { _mesa_unpack_color_span_float(ctx, height, GL_RGBA, &ctx->Separable2D.Filter[colStart], format, type, column, &ctx->Unpack, 0); /* transferOps */ _mesa_scale_and_bias_rgba(height, (GLfloat (*)[4]) (ctx->Separable2D.Filter + colStart), ctx->Pixel.ConvolutionFilterScale[2][0], ctx->Pixel.ConvolutionFilterScale[2][1], ctx->Pixel.ConvolutionFilterScale[2][2], ctx->Pixel.ConvolutionFilterScale[2][3], ctx->Pixel.ConvolutionFilterBias[2][0], ctx->Pixel.ConvolutionFilterBias[2][1], ctx->Pixel.ConvolutionFilterBias[2][2], ctx->Pixel.ConvolutionFilterBias[2][3]); } if (ctx->Unpack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, ctx->Unpack.BufferObj); } ctx->NewState |= _NEW_PIXEL; } /**********************************************************************/ /*** image convolution functions ***/ /**********************************************************************/ static void convolve_1d_reduce(GLint srcWidth, const GLfloat src[][4], GLint filterWidth, const GLfloat filter[][4], GLfloat dest[][4]) { GLint dstWidth; GLint i, n; if (filterWidth >= 1) dstWidth = srcWidth - (filterWidth - 1); else dstWidth = srcWidth; if (dstWidth <= 0) return; /* null result */ for (i = 0; i < dstWidth; i++) { GLfloat sumR = 0.0; GLfloat sumG = 0.0; GLfloat sumB = 0.0; GLfloat sumA = 0.0; for (n = 0; n < filterWidth; n++) { sumR += src[i + n][RCOMP] * filter[n][RCOMP]; sumG += src[i + n][GCOMP] * filter[n][GCOMP]; sumB += src[i + n][BCOMP] * filter[n][BCOMP]; sumA += src[i + n][ACOMP] * filter[n][ACOMP]; } dest[i][RCOMP] = sumR; dest[i][GCOMP] = sumG; dest[i][BCOMP] = sumB; dest[i][ACOMP] = sumA; } } static void convolve_1d_constant(GLint srcWidth, const GLfloat src[][4], GLint filterWidth, const GLfloat filter[][4], GLfloat dest[][4], const GLfloat borderColor[4]) { const GLint halfFilterWidth = filterWidth / 2; GLint i, n; for (i = 0; i < srcWidth; i++) { GLfloat sumR = 0.0; GLfloat sumG = 0.0; GLfloat sumB = 0.0; GLfloat sumA = 0.0; for (n = 0; n < filterWidth; n++) { if (i + n < halfFilterWidth || i + n - halfFilterWidth >= srcWidth) { sumR += borderColor[RCOMP] * filter[n][RCOMP]; sumG += borderColor[GCOMP] * filter[n][GCOMP]; sumB += borderColor[BCOMP] * filter[n][BCOMP]; sumA += borderColor[ACOMP] * filter[n][ACOMP]; } else { sumR += src[i + n - halfFilterWidth][RCOMP] * filter[n][RCOMP]; sumG += src[i + n - halfFilterWidth][GCOMP] * filter[n][GCOMP]; sumB += src[i + n - halfFilterWidth][BCOMP] * filter[n][BCOMP]; sumA += src[i + n - halfFilterWidth][ACOMP] * filter[n][ACOMP]; } } dest[i][RCOMP] = sumR; dest[i][GCOMP] = sumG; dest[i][BCOMP] = sumB; dest[i][ACOMP] = sumA; } } static void convolve_1d_replicate(GLint srcWidth, const GLfloat src[][4], GLint filterWidth, const GLfloat filter[][4], GLfloat dest[][4]) { const GLint halfFilterWidth = filterWidth / 2; GLint i, n; for (i = 0; i < srcWidth; i++) { GLfloat sumR = 0.0; GLfloat sumG = 0.0; GLfloat sumB = 0.0; GLfloat sumA = 0.0; for (n = 0; n < filterWidth; n++) { if (i + n < halfFilterWidth) { sumR += src[0][RCOMP] * filter[n][RCOMP]; sumG += src[0][GCOMP] * filter[n][GCOMP]; sumB += src[0][BCOMP] * filter[n][BCOMP]; sumA += src[0][ACOMP] * filter[n][ACOMP]; } else if (i + n - halfFilterWidth >= srcWidth) { sumR += src[srcWidth - 1][RCOMP] * filter[n][RCOMP]; sumG += src[srcWidth - 1][GCOMP] * filter[n][GCOMP]; sumB += src[srcWidth - 1][BCOMP] * filter[n][BCOMP]; sumA += src[srcWidth - 1][ACOMP] * filter[n][ACOMP]; } else { sumR += src[i + n - halfFilterWidth][RCOMP] * filter[n][RCOMP]; sumG += src[i + n - halfFilterWidth][GCOMP] * filter[n][GCOMP]; sumB += src[i + n - halfFilterWidth][BCOMP] * filter[n][BCOMP]; sumA += src[i + n - halfFilterWidth][ACOMP] * filter[n][ACOMP]; } } dest[i][RCOMP] = sumR; dest[i][GCOMP] = sumG; dest[i][BCOMP] = sumB; dest[i][ACOMP] = sumA; } } static void convolve_2d_reduce(GLint srcWidth, GLint srcHeight, const GLfloat src[][4], GLint filterWidth, GLint filterHeight, const GLfloat filter[][4], GLfloat dest[][4]) { GLint dstWidth, dstHeight; GLint i, j, n, m; if (filterWidth >= 1) dstWidth = srcWidth - (filterWidth - 1); else dstWidth = srcWidth; if (filterHeight >= 1) dstHeight = srcHeight - (filterHeight - 1); else dstHeight = srcHeight; if (dstWidth <= 0 || dstHeight <= 0) return; for (j = 0; j < dstHeight; j++) { for (i = 0; i < dstWidth; i++) { GLfloat sumR = 0.0; GLfloat sumG = 0.0; GLfloat sumB = 0.0; GLfloat sumA = 0.0; for (m = 0; m < filterHeight; m++) { for (n = 0; n < filterWidth; n++) { const GLint k = (j + m) * srcWidth + i + n; const GLint f = m * filterWidth + n; sumR += src[k][RCOMP] * filter[f][RCOMP]; sumG += src[k][GCOMP] * filter[f][GCOMP]; sumB += src[k][BCOMP] * filter[f][BCOMP]; sumA += src[k][ACOMP] * filter[f][ACOMP]; } } dest[j * dstWidth + i][RCOMP] = sumR; dest[j * dstWidth + i][GCOMP] = sumG; dest[j * dstWidth + i][BCOMP] = sumB; dest[j * dstWidth + i][ACOMP] = sumA; } } } static void convolve_2d_constant(GLint srcWidth, GLint srcHeight, const GLfloat src[][4], GLint filterWidth, GLint filterHeight, const GLfloat filter[][4], GLfloat dest[][4], const GLfloat borderColor[4]) { const GLint halfFilterWidth = filterWidth / 2; const GLint halfFilterHeight = filterHeight / 2; GLint i, j, n, m; for (j = 0; j < srcHeight; j++) { for (i = 0; i < srcWidth; i++) { GLfloat sumR = 0.0; GLfloat sumG = 0.0; GLfloat sumB = 0.0; GLfloat sumA = 0.0; for (m = 0; m < filterHeight; m++) { for (n = 0; n < filterWidth; n++) { const GLint f = m * filterWidth + n; const GLint is = i + n - halfFilterWidth; const GLint js = j + m - halfFilterHeight; if (is < 0 || is >= srcWidth || js < 0 || js >= srcHeight) { sumR += borderColor[RCOMP] * filter[f][RCOMP]; sumG += borderColor[GCOMP] * filter[f][GCOMP]; sumB += borderColor[BCOMP] * filter[f][BCOMP]; sumA += borderColor[ACOMP] * filter[f][ACOMP]; } else { const GLint k = js * srcWidth + is; sumR += src[k][RCOMP] * filter[f][RCOMP]; sumG += src[k][GCOMP] * filter[f][GCOMP]; sumB += src[k][BCOMP] * filter[f][BCOMP]; sumA += src[k][ACOMP] * filter[f][ACOMP]; } } } dest[j * srcWidth + i][RCOMP] = sumR; dest[j * srcWidth + i][GCOMP] = sumG; dest[j * srcWidth + i][BCOMP] = sumB; dest[j * srcWidth + i][ACOMP] = sumA; } } } static void convolve_2d_replicate(GLint srcWidth, GLint srcHeight, const GLfloat src[][4], GLint filterWidth, GLint filterHeight, const GLfloat filter[][4], GLfloat dest[][4]) { const GLint halfFilterWidth = filterWidth / 2; const GLint halfFilterHeight = filterHeight / 2; GLint i, j, n, m; for (j = 0; j < srcHeight; j++) { for (i = 0; i < srcWidth; i++) { GLfloat sumR = 0.0; GLfloat sumG = 0.0; GLfloat sumB = 0.0; GLfloat sumA = 0.0; for (m = 0; m < filterHeight; m++) { for (n = 0; n < filterWidth; n++) { const GLint f = m * filterWidth + n; GLint is = i + n - halfFilterWidth; GLint js = j + m - halfFilterHeight; GLint k; if (is < 0) is = 0; else if (is >= srcWidth) is = srcWidth - 1; if (js < 0) js = 0; else if (js >= srcHeight) js = srcHeight - 1; k = js * srcWidth + is; sumR += src[k][RCOMP] * filter[f][RCOMP]; sumG += src[k][GCOMP] * filter[f][GCOMP]; sumB += src[k][BCOMP] * filter[f][BCOMP]; sumA += src[k][ACOMP] * filter[f][ACOMP]; } } dest[j * srcWidth + i][RCOMP] = sumR; dest[j * srcWidth + i][GCOMP] = sumG; dest[j * srcWidth + i][BCOMP] = sumB; dest[j * srcWidth + i][ACOMP] = sumA; } } } static void convolve_sep_reduce(GLint srcWidth, GLint srcHeight, const GLfloat src[][4], GLint filterWidth, GLint filterHeight, const GLfloat rowFilt[][4], const GLfloat colFilt[][4], GLfloat dest[][4]) { GLint dstWidth, dstHeight; GLint i, j, n, m; if (filterWidth >= 1) dstWidth = srcWidth - (filterWidth - 1); else dstWidth = srcWidth; if (filterHeight >= 1) dstHeight = srcHeight - (filterHeight - 1); else dstHeight = srcHeight; if (dstWidth <= 0 || dstHeight <= 0) return; for (j = 0; j < dstHeight; j++) { for (i = 0; i < dstWidth; i++) { GLfloat sumR = 0.0; GLfloat sumG = 0.0; GLfloat sumB = 0.0; GLfloat sumA = 0.0; for (m = 0; m < filterHeight; m++) { for (n = 0; n < filterWidth; n++) { GLint k = (j + m) * srcWidth + i + n; sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; } } dest[j * dstWidth + i][RCOMP] = sumR; dest[j * dstWidth + i][GCOMP] = sumG; dest[j * dstWidth + i][BCOMP] = sumB; dest[j * dstWidth + i][ACOMP] = sumA; } } } static void convolve_sep_constant(GLint srcWidth, GLint srcHeight, const GLfloat src[][4], GLint filterWidth, GLint filterHeight, const GLfloat rowFilt[][4], const GLfloat colFilt[][4], GLfloat dest[][4], const GLfloat borderColor[4]) { const GLint halfFilterWidth = filterWidth / 2; const GLint halfFilterHeight = filterHeight / 2; GLint i, j, n, m; for (j = 0; j < srcHeight; j++) { for (i = 0; i < srcWidth; i++) { GLfloat sumR = 0.0; GLfloat sumG = 0.0; GLfloat sumB = 0.0; GLfloat sumA = 0.0; for (m = 0; m < filterHeight; m++) { for (n = 0; n < filterWidth; n++) { const GLint is = i + n - halfFilterWidth; const GLint js = j + m - halfFilterHeight; if (is < 0 || is >= srcWidth || js < 0 || js >= srcHeight) { sumR += borderColor[RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; sumG += borderColor[GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; sumB += borderColor[BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; sumA += borderColor[ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; } else { GLint k = js * srcWidth + is; sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; } } } dest[j * srcWidth + i][RCOMP] = sumR; dest[j * srcWidth + i][GCOMP] = sumG; dest[j * srcWidth + i][BCOMP] = sumB; dest[j * srcWidth + i][ACOMP] = sumA; } } } static void convolve_sep_replicate(GLint srcWidth, GLint srcHeight, const GLfloat src[][4], GLint filterWidth, GLint filterHeight, const GLfloat rowFilt[][4], const GLfloat colFilt[][4], GLfloat dest[][4]) { const GLint halfFilterWidth = filterWidth / 2; const GLint halfFilterHeight = filterHeight / 2; GLint i, j, n, m; for (j = 0; j < srcHeight; j++) { for (i = 0; i < srcWidth; i++) { GLfloat sumR = 0.0; GLfloat sumG = 0.0; GLfloat sumB = 0.0; GLfloat sumA = 0.0; for (m = 0; m < filterHeight; m++) { for (n = 0; n < filterWidth; n++) { GLint is = i + n - halfFilterWidth; GLint js = j + m - halfFilterHeight; GLint k; if (is < 0) is = 0; else if (is >= srcWidth) is = srcWidth - 1; if (js < 0) js = 0; else if (js >= srcHeight) js = srcHeight - 1; k = js * srcWidth + is; sumR += src[k][RCOMP] * rowFilt[n][RCOMP] * colFilt[m][RCOMP]; sumG += src[k][GCOMP] * rowFilt[n][GCOMP] * colFilt[m][GCOMP]; sumB += src[k][BCOMP] * rowFilt[n][BCOMP] * colFilt[m][BCOMP]; sumA += src[k][ACOMP] * rowFilt[n][ACOMP] * colFilt[m][ACOMP]; } } dest[j * srcWidth + i][RCOMP] = sumR; dest[j * srcWidth + i][GCOMP] = sumG; dest[j * srcWidth + i][BCOMP] = sumB; dest[j * srcWidth + i][ACOMP] = sumA; } } } void _mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width, const GLfloat *srcImage, GLfloat *dstImage) { switch (ctx->Pixel.ConvolutionBorderMode[0]) { case GL_REDUCE: convolve_1d_reduce(*width, (const GLfloat (*)[4]) srcImage, ctx->Convolution1D.Width, (const GLfloat (*)[4]) ctx->Convolution1D.Filter, (GLfloat (*)[4]) dstImage); *width = *width - (MAX2(ctx->Convolution1D.Width, 1) - 1); break; case GL_CONSTANT_BORDER: convolve_1d_constant(*width, (const GLfloat (*)[4]) srcImage, ctx->Convolution1D.Width, (const GLfloat (*)[4]) ctx->Convolution1D.Filter, (GLfloat (*)[4]) dstImage, ctx->Pixel.ConvolutionBorderColor[0]); break; case GL_REPLICATE_BORDER: convolve_1d_replicate(*width, (const GLfloat (*)[4]) srcImage, ctx->Convolution1D.Width, (const GLfloat (*)[4]) ctx->Convolution1D.Filter, (GLfloat (*)[4]) dstImage); break; default: ; } } void _mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, const GLfloat *srcImage, GLfloat *dstImage) { switch (ctx->Pixel.ConvolutionBorderMode[1]) { case GL_REDUCE: convolve_2d_reduce(*width, *height, (const GLfloat (*)[4]) srcImage, ctx->Convolution2D.Width, ctx->Convolution2D.Height, (const GLfloat (*)[4]) ctx->Convolution2D.Filter, (GLfloat (*)[4]) dstImage); *width = *width - (MAX2(ctx->Convolution2D.Width, 1) - 1); *height = *height - (MAX2(ctx->Convolution2D.Height, 1) - 1); break; case GL_CONSTANT_BORDER: convolve_2d_constant(*width, *height, (const GLfloat (*)[4]) srcImage, ctx->Convolution2D.Width, ctx->Convolution2D.Height, (const GLfloat (*)[4]) ctx->Convolution2D.Filter, (GLfloat (*)[4]) dstImage, ctx->Pixel.ConvolutionBorderColor[1]); break; case GL_REPLICATE_BORDER: convolve_2d_replicate(*width, *height, (const GLfloat (*)[4]) srcImage, ctx->Convolution2D.Width, ctx->Convolution2D.Height, (const GLfloat (*)[4])ctx->Convolution2D.Filter, (GLfloat (*)[4]) dstImage); break; default: ; } } void _mesa_convolve_sep_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, const GLfloat *srcImage, GLfloat *dstImage) { const GLfloat *rowFilter = ctx->Separable2D.Filter; const GLfloat *colFilter = rowFilter + 4 * MAX_CONVOLUTION_WIDTH; switch (ctx->Pixel.ConvolutionBorderMode[2]) { case GL_REDUCE: convolve_sep_reduce(*width, *height, (const GLfloat (*)[4]) srcImage, ctx->Separable2D.Width, ctx->Separable2D.Height, (const GLfloat (*)[4]) rowFilter, (const GLfloat (*)[4]) colFilter, (GLfloat (*)[4]) dstImage); *width = *width - (MAX2(ctx->Separable2D.Width, 1) - 1); *height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1); break; case GL_CONSTANT_BORDER: convolve_sep_constant(*width, *height, (const GLfloat (*)[4]) srcImage, ctx->Separable2D.Width, ctx->Separable2D.Height, (const GLfloat (*)[4]) rowFilter, (const GLfloat (*)[4]) colFilter, (GLfloat (*)[4]) dstImage, ctx->Pixel.ConvolutionBorderColor[2]); break; case GL_REPLICATE_BORDER: convolve_sep_replicate(*width, *height, (const GLfloat (*)[4]) srcImage, ctx->Separable2D.Width, ctx->Separable2D.Height, (const GLfloat (*)[4]) rowFilter, (const GLfloat (*)[4]) colFilter, (GLfloat (*)[4]) dstImage); break; default: ; } } /* * This function computes an image's size after convolution. * If the convolution border mode is GL_REDUCE, the post-convolution * image will be smaller than the original. */ void _mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions, GLsizei *width, GLsizei *height) { if (ctx->Pixel.Convolution1DEnabled && dimensions == 1 && ctx->Pixel.ConvolutionBorderMode[0] == GL_REDUCE) { *width = *width - (MAX2(ctx->Convolution1D.Width, 1) - 1); } else if (ctx->Pixel.Convolution2DEnabled && dimensions > 1 && ctx->Pixel.ConvolutionBorderMode[1] == GL_REDUCE) { *width = *width - (MAX2(ctx->Convolution2D.Width, 1) - 1); *height = *height - (MAX2(ctx->Convolution2D.Height, 1) - 1); } else if (ctx->Pixel.Separable2DEnabled && dimensions > 1 && ctx->Pixel.ConvolutionBorderMode[2] == GL_REDUCE) { *width = *width - (MAX2(ctx->Separable2D.Width, 1) - 1); *height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1); } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/convolve.h0000644000000000000000000000775213614532424020160 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef CONVOLVE_H #define CONVOLVE_H #include "mtypes.h" #if _HAVE_FULL_GL extern void GLAPIENTRY _mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); extern void GLAPIENTRY _mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); extern void GLAPIENTRY _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat params); extern void GLAPIENTRY _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params); extern void GLAPIENTRY _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint params); extern void GLAPIENTRY _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params); extern void GLAPIENTRY _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); extern void GLAPIENTRY _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); extern void GLAPIENTRY _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image); extern void GLAPIENTRY _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params); extern void GLAPIENTRY _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); extern void GLAPIENTRY _mesa_SeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); extern void _mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width, const GLfloat *srcImage, GLfloat *dstImage); extern void _mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, const GLfloat *srcImage, GLfloat *dstImage); extern void _mesa_convolve_sep_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, const GLfloat *srcImage, GLfloat *dstImage); extern void _mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions, GLsizei *width, GLsizei *height); #else #define _mesa_adjust_image_for_convolution(c, d, w, h) ((void)0) #define _mesa_convolve_1d_image(c,w,s,d) ((void)0) #define _mesa_convolve_2d_image(c,w,h,s,d) ((void)0) #define _mesa_convolve_sep_image(c,w,h,s,d) ((void)0) #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/dd.h0000644000000000000000000012157413614532424016713 0ustar /** * \file dd.h * Device driver interfaces. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef DD_INCLUDED #define DD_INCLUDED /* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */ struct gl_pixelstore_attrib; struct mesa_display_list; /** * Device driver function table. * Core Mesa uses these function pointers to call into device drivers. * Most of these functions directly correspond to OpenGL state commands. * Core Mesa will call these functions after error checking has been done * so that the drivers don't have to worry about error testing. * * Vertex transformation/clipping/lighting is patched into the T&L module. * Rasterization functions are patched into the swrast module. * * Note: when new functions are added here, the drivers/common/driverfuncs.c * file should be updated too!!! */ struct dd_function_table { /** * Return a string as needed by glGetString(). * * Only the GL_RENDERER token must be implemented. Otherwise, NULL can be * returned. */ const GLubyte * (*GetString)( GLcontext *ctx, GLenum name ); /** * Notify the driver after Mesa has made some internal state changes. * * This is in addition to any state change callbacks Mesa may already have * made. */ void (*UpdateState)( GLcontext *ctx, GLuint new_state ); /** * Get the width and height of the named buffer/window. * * Mesa uses this to determine when the driver's window size has changed. */ void (*GetBufferSize)( GLframebuffer *buffer, GLuint *width, GLuint *height ); /** * Resize the given framebuffer to the given size. */ void (*ResizeBuffers)( GLcontext *ctx, GLframebuffer *fb, GLuint width, GLuint height); /** * Called whenever an error is generated. * * __GLcontextRec::ErrorValue contains the error value. */ void (*Error)( GLcontext *ctx ); /** * This is called whenever glFinish() is called. */ void (*Finish)( GLcontext *ctx ); /** * This is called whenever glFlush() is called. */ void (*Flush)( GLcontext *ctx ); /** * Clear the color/depth/stencil/accum buffer(s). * * \param mask a bitmask of the DD_*_BIT values defined above that indicates * which buffers need to be cleared. * \param all if true then clear the whole buffer, else clear only the * region defined by (x, y, width, height). * * This function must obey the glColorMask(), glIndexMask() and * glStencilMask() settings! * Software Mesa can do masked clears if the device driver can't. */ void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); /** * \name For hardware accumulation buffer */ /*@{*/ /** * Execute glAccum command within the given scissor region. */ void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ); /*@}*/ /** * \name glDraw(), glRead(), glCopyPixels() and glBitmap() functions */ /*@{*/ /** * This is called by glDrawPixels(). * * \p unpack describes how to unpack the source image data. */ void (*DrawPixels)( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ); /** * Called by glReadPixels(). */ void (*ReadPixels)( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest ); /** * Do a glCopyPixels(). * * This function must respect all rasterization state, glPixelTransfer(), * glPixelZoom(), etc. */ void (*CopyPixels)( GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type ); /** * This is called by glBitmap(). * * Works the same as dd_function_table::DrawPixels, above. */ void (*Bitmap)( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ); /*@}*/ /** * \name Texture image functions */ /*@{*/ /** * Choose texture format. * * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback * functions. The driver should examine \p internalFormat and return a * pointer to an appropriate gl_texture_format. */ const struct gl_texture_format *(*ChooseTextureFormat)( GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType ); /** * Called by glTexImage1D(). * * \param target user specified. * \param format user specified. * \param type user specified. * \param pixels user specified. * \param packing indicates the image packing of pixels. * \param texObj is the target texture object. * \param texImage is the target texture image. It will have the texture \p * width, \p height, \p depth, \p border and \p internalFormat information. * * \p retainInternalCopy is returned by this function and indicates whether * core Mesa should keep an internal copy of the texture image. * * Drivers should call a fallback routine from texstore.c if needed. */ void (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); /** * Called by glTexImage2D(). * * \sa dd_function_table::TexImage1D. */ void (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); /** * Called by glTexImage3D(). * * \sa dd_function_table::TexImage1D. */ void (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); /** * Called by glTexSubImage1D(). * * \param target user specified. * \param level user specified. * \param xoffset user specified. * \param yoffset user specified. * \param zoffset user specified. * \param width user specified. * \param height user specified. * \param depth user specified. * \param format user specified. * \param type user specified. * \param pixels user specified. * \param packing indicates the image packing of pixels. * \param texObj is the target texture object. * \param texImage is the target texture image. It will have the texture \p * width, \p height, \p border and \p internalFormat information. * * The driver should use a fallback routine from texstore.c if needed. */ void (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); /** * Called by glTexSubImage2D(). * * \sa dd_function_table::TexSubImage1D. */ void (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); /** * Called by glTexSubImage3D(). * * \sa dd_function_table::TexSubImage1D. */ void (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLint depth, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); /** * Called by glGetTexImage(). */ void (*GetTexImage)( GLcontext *ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels, const struct gl_texture_object *texObj, const struct gl_texture_image *texImage ); /** * Called by glCopyTexImage1D(). * * Drivers should use a fallback routine from texstore.c if needed. */ void (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border ); /** * Called by glCopyTexImage2D(). * * Drivers should use a fallback routine from texstore.c if needed. */ void (*CopyTexImage2D)( GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ); /** * Called by glCopyTexSubImage1D(). * * Drivers should use a fallback routine from texstore.c if needed. */ void (*CopyTexSubImage1D)( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); /** * Called by glCopyTexSubImage2D(). * * Drivers should use a fallback routine from texstore.c if needed. */ void (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); /** * Called by glCopyTexSubImage3D(). * * Drivers should use a fallback routine from texstore.c if needed. */ void (*CopyTexSubImage3D)( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); /** * Called by glTexImage[123]D when user specifies a proxy texture * target. * * \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails. */ GLboolean (*TestProxyTexImage)(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, GLint depth, GLint border); /*@}*/ /** * \name Compressed texture functions */ /*@{*/ /** * Called by glCompressedTexImage1D(). * * \param target user specified. * \param format user specified. * \param type user specified. * \param pixels user specified. * \param packing indicates the image packing of pixels. * \param texObj is the target texture object. * \param texImage is the target texture image. It will have the texture \p * width, \p height, \p depth, \p border and \p internalFormat information. * * \a retainInternalCopy is returned by this function and indicates whether * core Mesa should keep an internal copy of the texture image. */ void (*CompressedTexImage1D)( GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); /** * Called by glCompressedTexImage2D(). * * \sa dd_function_table::CompressedTexImage1D. */ void (*CompressedTexImage2D)( GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); /** * Called by glCompressedTexImage3D(). * * \sa dd_function_table::CompressedTexImage3D. */ void (*CompressedTexImage3D)( GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage ); /** * Called by glCompressedTexSubImage1D(). * * \param target user specified. * \param level user specified. * \param xoffset user specified. * \param yoffset user specified. * \param zoffset user specified. * \param width user specified. * \param height user specified. * \param depth user specified. * \param imageSize user specified. * \param data user specified. * \param texObj is the target texture object. * \param texImage is the target texture image. It will have the texture \p * width, \p height, \p depth, \p border and \p internalFormat information. */ void (*CompressedTexSubImage1D)(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage); /** * Called by glCompressedTexSubImage2D(). * * \sa dd_function_table::CompressedTexImage3D. */ void (*CompressedTexSubImage2D)(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLint height, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage); /** * Called by glCompressedTexSubImage3D(). * * \sa dd_function_table::CompressedTexImage3D. */ void (*CompressedTexSubImage3D)(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLint height, GLint depth, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage); /** * Called by glGetCompressedTexImage. */ void (*GetCompressedTexImage)(GLcontext *ctx, GLenum target, GLint level, GLvoid *img, const struct gl_texture_object *texObj, const struct gl_texture_image *texImage); /** * Called to query number of bytes of storage needed to store the * specified compressed texture. */ GLuint (*CompressedTextureSize)( GLcontext *ctx, GLsizei width, GLsizei height, GLsizei depth, GLenum format ); /*@}*/ /** * \name Texture object functions */ /*@{*/ /** * Called by glBindTexture(). */ void (*BindTexture)( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj ); /** * Called to allocate a new texture object. * A new gl_texture_object should be returned. The driver should * attach to it any device-specific info it needs. */ struct gl_texture_object * (*NewTextureObject)( GLcontext *ctx, GLuint name, GLenum target ); /** * Called when a texture object is about to be deallocated. * * Driver should delete the gl_texture_object object and anything * hanging off of it. */ void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj ); /** * Called to allocate a new texture image object. */ struct gl_texture_image * (*NewTextureImage)( GLcontext *ctx ); /** * Called to free tImage->Data. */ void (*FreeTexImageData)( GLcontext *ctx, struct gl_texture_image *tImage ); /** * Note: no context argument. This function doesn't initially look * like it belongs here, except that the driver is the only entity * that knows for sure how the texture memory is allocated - via * the above callbacks. There is then an argument that the driver * knows what memcpy paths might be fast. Typically this is invoked with * * to -- a pointer into texture memory allocated by NewTextureImage() above. * from -- a pointer into client memory or a mesa temporary. * sz -- nr bytes to copy. */ void* (*TextureMemCpy)( void *to, const void *from, size_t sz ); /** * Called by glAreTextureResident(). */ GLboolean (*IsTextureResident)( GLcontext *ctx, struct gl_texture_object *t ); /** * Called by glPrioritizeTextures(). */ void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t, GLclampf priority ); /** * Called by glActiveTextureARB() to set current texture unit. */ void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber ); /** * Called when the texture's color lookup table is changed. * * If \p tObj is NULL then the shared texture palette * gl_texture_object::Palette is to be updated. */ void (*UpdateTexturePalette)( GLcontext *ctx, struct gl_texture_object *tObj ); /*@}*/ /** * \name Imaging functionality */ /*@{*/ void (*CopyColorTable)( GLcontext *ctx, GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width ); void (*CopyColorSubTable)( GLcontext *ctx, GLenum target, GLsizei start, GLint x, GLint y, GLsizei width ); void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width ); void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height ); /*@}*/ /** * \name Vertex/fragment program functions */ /*@{*/ /** Bind a vertex/fragment program */ void (*BindProgram)(GLcontext *ctx, GLenum target, struct program *prog); /** Allocate a new program */ struct program * (*NewProgram)(GLcontext *ctx, GLenum target, GLuint id); /** Delete a program */ void (*DeleteProgram)(GLcontext *ctx, struct program *prog); /** Notify driver that a program string has been specified. */ void (*ProgramStringNotify)(GLcontext *ctx, GLenum target, struct program *prog); /** Query if program can be loaded onto hardware */ GLboolean (*IsProgramNative)(GLcontext *ctx, GLenum target, struct program *prog); /*@}*/ /** * \name State-changing functions. * * \note drawing functions are above. * * These functions are called by their corresponding OpenGL API functions. * They are \e also called by the gl_PopAttrib() function!!! * May add more functions like these to the device driver in the future. */ /*@{*/ /** Specify the alpha test function */ void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLfloat ref); /** Set the blend color */ void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]); /** Set the blend equation */ void (*BlendEquationSeparate)(GLcontext *ctx, GLenum modeRGB, GLenum modeA); /** Specify pixel arithmetic */ void (*BlendFuncSeparate)(GLcontext *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA); /** Specify clear values for the color buffers */ void (*ClearColor)(GLcontext *ctx, const GLfloat color[4]); /** Specify the clear value for the depth buffer */ void (*ClearDepth)(GLcontext *ctx, GLclampd d); /** Specify the clear value for the color index buffers */ void (*ClearIndex)(GLcontext *ctx, GLuint index); /** Specify the clear value for the stencil buffer */ void (*ClearStencil)(GLcontext *ctx, GLint s); /** Specify a plane against which all geometry is clipped */ void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation ); /** Enable and disable writing of frame buffer color components */ void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask ); /** Cause a material color to track the current color */ void (*ColorMaterial)(GLcontext *ctx, GLenum face, GLenum mode); /** Specify whether front- or back-facing facets can be culled */ void (*CullFace)(GLcontext *ctx, GLenum mode); /** Define front- and back-facing polygons */ void (*FrontFace)(GLcontext *ctx, GLenum mode); /** Specify the value used for depth buffer comparisons */ void (*DepthFunc)(GLcontext *ctx, GLenum func); /** Enable or disable writing into the depth buffer */ void (*DepthMask)(GLcontext *ctx, GLboolean flag); /** Specify mapping of depth values from NDC to window coordinates */ void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval); /** Specify the current buffer for writing */ void (*DrawBuffer)( GLcontext *ctx, GLenum buffer ); /** Specify the buffers for writing for fragment programs*/ void (*DrawBuffers)( GLcontext *ctx, GLsizei n, const GLenum *buffers ); /** Enable or disable server-side gl capabilities */ void (*Enable)(GLcontext *ctx, GLenum cap, GLboolean state); /** Specify fog parameters */ void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); /** Specify implementation-specific hints */ void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode); /** Control the writing of individual bits in the color index buffers */ void (*IndexMask)(GLcontext *ctx, GLuint mask); /** Set light source parameters */ void (*Lightfv)(GLcontext *ctx, GLenum light, GLenum pname, const GLfloat *params ); /** Set the lighting model parameters */ void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); /** Specify the line stipple pattern */ void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern ); /** Specify the width of rasterized lines */ void (*LineWidth)(GLcontext *ctx, GLfloat width); /** Specify a logical pixel operation for color index rendering */ void (*LogicOpcode)(GLcontext *ctx, GLenum opcode); void (*PointParameterfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); /** Specify the diameter of rasterized points */ void (*PointSize)(GLcontext *ctx, GLfloat size); /** Select a polygon rasterization mode */ void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode); /** Set the scale and units used to calculate depth values */ void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units); /** Set the polygon stippling pattern */ void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask ); /* Specifies the current buffer for reading */ void (*ReadBuffer)( GLcontext *ctx, GLenum buffer ); /** Set rasterization mode */ void (*RenderMode)(GLcontext *ctx, GLenum mode ); /** Define the scissor box */ void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); /** Select flat or smooth shading */ void (*ShadeModel)(GLcontext *ctx, GLenum mode); /** Set function and reference value for stencil testing */ void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask); /** Control the writing of individual bits in the stencil planes */ void (*StencilMask)(GLcontext *ctx, GLuint mask); /** Set stencil test actions */ void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass); /** Set active stencil face (GL_EXT_stencil_two_side) */ void (*ActiveStencilFace)(GLcontext *ctx, GLuint face); /** OpenGL 2.0 two-sided StencilFunc */ void (*StencilFuncSeparate)(GLcontext *ctx, GLenum face, GLenum func, GLint ref, GLuint mask); /** OpenGL 2.0 two-sided StencilMask */ void (*StencilMaskSeparate)(GLcontext *ctx, GLenum face, GLuint mask); /** OpenGL 2.0 two-sided StencilOp */ void (*StencilOpSeparate)(GLcontext *ctx, GLenum face, GLenum fail, GLenum zfail, GLenum zpass); /** Control the generation of texture coordinates */ void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname, const GLfloat *params); /** Set texture environment parameters */ void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *param); /** Set texture parameters */ void (*TexParameter)(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat *params); void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat); /** Set the viewport */ void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); /*@}*/ /** * \name Vertex array functions * * Called by the corresponding OpenGL functions. */ /*@{*/ void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); void (*NormalPointer)(GLcontext *ctx, GLenum type, GLsizei stride, const GLvoid *ptr); void (*ColorPointer)(GLcontext *ctx, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); void (*FogCoordPointer)(GLcontext *ctx, GLenum type, GLsizei stride, const GLvoid *ptr); void (*IndexPointer)(GLcontext *ctx, GLenum type, GLsizei stride, const GLvoid *ptr); void (*SecondaryColorPointer)(GLcontext *ctx, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr); void (*VertexAttribPointer)(GLcontext *ctx, GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count ); void (*UnlockArraysEXT)( GLcontext *ctx ); /*@}*/ /** * \name State-query functions * * Return GL_TRUE if query was completed, GL_FALSE otherwise. */ /*@{*/ /** Return the value or values of a selected parameter */ GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result); /** Return the value or values of a selected parameter */ GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result); /** Return the value or values of a selected parameter */ GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result); /** Return the value or values of a selected parameter */ GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result); /** Return the value or values of a selected parameter */ GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result); /*@}*/ /** * \name Vertex/pixel buffer object functions */ #if FEATURE_ARB_vertex_buffer_object /*@{*/ void (*BindBuffer)( GLcontext *ctx, GLenum target, struct gl_buffer_object *obj ); struct gl_buffer_object * (*NewBufferObject)( GLcontext *ctx, GLuint buffer, GLenum target ); void (*DeleteBuffer)( GLcontext *ctx, struct gl_buffer_object *obj ); void (*BufferData)( GLcontext *ctx, GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage, struct gl_buffer_object *obj ); void (*BufferSubData)( GLcontext *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data, struct gl_buffer_object *obj ); void (*GetBufferSubData)( GLcontext *ctx, GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data, struct gl_buffer_object *obj ); void * (*MapBuffer)( GLcontext *ctx, GLenum target, GLenum access, struct gl_buffer_object *obj ); GLboolean (*UnmapBuffer)( GLcontext *ctx, GLenum target, struct gl_buffer_object *obj ); /*@}*/ #endif /** * \name Functions for GL_EXT_framebuffer_object */ #if FEATURE_EXT_framebuffer_object /*@{*/ struct gl_framebuffer * (*NewFramebuffer)(GLcontext *ctx, GLuint name); struct gl_renderbuffer * (*NewRenderbuffer)(GLcontext *ctx, GLuint name); void (*FramebufferRenderbuffer)(GLcontext *ctx, struct gl_renderbuffer_attachment *att, struct gl_renderbuffer *rb); void (*RenderbufferTexture)(GLcontext *ctx, struct gl_renderbuffer_attachment *att, struct gl_texture_object *texObj, GLenum texTarget, GLuint level, GLuint zoffset); /*@}*/ #endif /** * \name Support for multiple T&L engines */ /*@{*/ /** * Bitmask of state changes that require the current T&L module to be * validated, using ValidateTnlModule() below. */ GLuint NeedValidate; /** * Validate the current T&L module. * * This is called directly after UpdateState() when a state change that has * occurred matches the dd_function_table::NeedValidate bitmask above. This * ensures all computed values are up to date, thus allowing the driver to * decide if the current T&L module needs to be swapped out. * * This must be non-NULL if a driver installs a custom T&L module and sets * the dd_function_table::NeedValidate bitmask, but may be NULL otherwise. */ void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state ); #define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1 #define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2 #define PRIM_UNKNOWN GL_POLYGON+3 /** * Set by the driver-supplied T&L engine. * * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd(). */ GLuint CurrentExecPrimitive; /** * Current state of an in-progress compilation. * * May take on any of the additional values PRIM_OUTSIDE_BEGIN_END, * PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above. */ GLuint CurrentSavePrimitive; #define FLUSH_STORED_VERTICES 0x1 #define FLUSH_UPDATE_CURRENT 0x2 /** * Set by the driver-supplied T&L engine whenever vertices are buffered * between glBegin()/glEnd() objects or __GLcontextRec::Current is not * updated. * * The dd_function_table::FlushVertices call below may be used to resolve * these conditions. */ GLuint NeedFlush; GLuint SaveNeedFlush; /** * If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered * vertices, if FLUSH_UPDATE_CURRENT bit is set updates * __GLcontextRec::Current and gl_light_attrib::Material * * Note that the default T&L engine never clears the * FLUSH_UPDATE_CURRENT bit, even after performing the update. */ void (*FlushVertices)( GLcontext *ctx, GLuint flags ); void (*SaveFlushVertices)( GLcontext *ctx ); /** * Give the driver the opportunity to hook in its own vtxfmt for * compiling optimized display lists. This is called on each valid * glBegin() during list compilation. */ GLboolean (*NotifySaveBegin)( GLcontext *ctx, GLenum mode ); /** * Notify driver that the special derived value _NeedEyeCoords has * changed. */ void (*LightingSpaceChange)( GLcontext *ctx ); /** * Let the T&L component know when the context becomes current. */ void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ); /** * Called by glNewList(). * * Let the T&L component know what is going on with display lists * in time to make changes to dispatch tables, etc. */ void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode ); /** * Called by glEndList(). * * \sa dd_function_table::NewList. */ void (*EndList)( GLcontext *ctx ); /** * Called by glCallList(s). * * Notify the T&L component before and after calling a display list. */ void (*BeginCallList)( GLcontext *ctx, struct mesa_display_list *dlist ); /** * Called by glEndCallList(). * * \sa dd_function_table::BeginCallList. */ void (*EndCallList)( GLcontext *ctx ); }; /** * Transform/Clip/Lighting interface * * Drivers present a reduced set of the functions possible in * glBegin()/glEnd() objects. Core mesa provides translation stubs for the * remaining functions to map down to these entry points. * * These are the initial values to be installed into dispatch by * mesa. If the T&L driver wants to modify the dispatch table * while installed, it must do so itself. It would be possible for * the vertexformat to install it's own initial values for these * functions, but this way there is an obvious list of what is * expected of the driver. * * If the driver wants to hook in entry points other than those * listed, it must restore them to their original values in * the disable() callback, below. */ typedef struct { /** * \name Vertex */ /*@{*/ void (GLAPIENTRYP ArrayElement)( GLint ); /* NOTE */ void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP Color3fv)( const GLfloat * ); void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP Color4fv)( const GLfloat * ); void (GLAPIENTRYP EdgeFlag)( GLboolean ); void (GLAPIENTRYP EdgeFlagv)( const GLboolean * ); void (GLAPIENTRYP EvalCoord1f)( GLfloat ); /* NOTE */ void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * ); /* NOTE */ void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */ void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * ); /* NOTE */ void (GLAPIENTRYP EvalPoint1)( GLint ); /* NOTE */ void (GLAPIENTRYP EvalPoint2)( GLint, GLint ); /* NOTE */ void (GLAPIENTRYP FogCoordfEXT)( GLfloat ); void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * ); void (GLAPIENTRYP Indexf)( GLfloat ); void (GLAPIENTRYP Indexfv)( const GLfloat * ); void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */ void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat ); void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * ); void (GLAPIENTRYP MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat ); void (GLAPIENTRYP MultiTexCoord2fvARB)( GLenum, const GLfloat * ); void (GLAPIENTRYP MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP MultiTexCoord3fvARB)( GLenum, const GLfloat * ); void (GLAPIENTRYP MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP MultiTexCoord4fvARB)( GLenum, const GLfloat * ); void (GLAPIENTRYP Normal3f)( GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP Normal3fv)( const GLfloat * ); void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * ); void (GLAPIENTRYP TexCoord1f)( GLfloat ); void (GLAPIENTRYP TexCoord1fv)( const GLfloat * ); void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat ); void (GLAPIENTRYP TexCoord2fv)( const GLfloat * ); void (GLAPIENTRYP TexCoord3f)( GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP TexCoord3fv)( const GLfloat * ); void (GLAPIENTRYP TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP TexCoord4fv)( const GLfloat * ); void (GLAPIENTRYP Vertex2f)( GLfloat, GLfloat ); void (GLAPIENTRYP Vertex2fv)( const GLfloat * ); void (GLAPIENTRYP Vertex3f)( GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP Vertex3fv)( const GLfloat * ); void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP Vertex4fv)( const GLfloat * ); void (GLAPIENTRYP CallList)( GLuint ); /* NOTE */ void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * ); /* NOTE */ void (GLAPIENTRYP Begin)( GLenum ); void (GLAPIENTRYP End)( void ); void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x ); void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y ); void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z ); void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x ); void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y ); void (GLAPIENTRYP VertexAttrib2fvARB)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib3fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z ); void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v ); /*@}*/ /* */ void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat ); /** * \name Array */ /*@{*/ void (GLAPIENTRYP DrawArrays)( GLenum mode, GLint start, GLsizei count ); void (GLAPIENTRYP DrawElements)( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ); void (GLAPIENTRYP DrawRangeElements)( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ); /*@}*/ /** * \name Eval * * If you don't support eval, fallback to the default vertex format * on receiving an eval call and use the pipeline mechanism to * provide partial T&L acceleration. * * Mesa will provide a set of helper functions to do eval within * accelerated vertex formats, eventually... */ /*@{*/ void (GLAPIENTRYP EvalMesh1)( GLenum mode, GLint i1, GLint i2 ); void (GLAPIENTRYP EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); /*@}*/ } GLvertexformat; #endif /* DD_INCLUDED */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/debug.c0000644000000000000000000001553313614532424017402 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "mtypes.h" #include "context.h" #include "imports.h" #include "debug.h" #include "get.h" /** * Primitive names */ const char *_mesa_prim_name[GL_POLYGON+4] = { "GL_POINTS", "GL_LINES", "GL_LINE_LOOP", "GL_LINE_STRIP", "GL_TRIANGLES", "GL_TRIANGLE_STRIP", "GL_TRIANGLE_FAN", "GL_QUADS", "GL_QUAD_STRIP", "GL_POLYGON", "outside begin/end", "inside unkown primitive", "unknown state" }; void _mesa_print_state( const char *msg, GLuint state ) { _mesa_debug(NULL, "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", msg, state, (state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "", (state & _NEW_PROJECTION) ? "ctx->Projection, " : "", (state & _NEW_TEXTURE_MATRIX) ? "ctx->TextureMatrix, " : "", (state & _NEW_COLOR_MATRIX) ? "ctx->ColorMatrix, " : "", (state & _NEW_ACCUM) ? "ctx->Accum, " : "", (state & _NEW_COLOR) ? "ctx->Color, " : "", (state & _NEW_DEPTH) ? "ctx->Depth, " : "", (state & _NEW_EVAL) ? "ctx->Eval/EvalMap, " : "", (state & _NEW_FOG) ? "ctx->Fog, " : "", (state & _NEW_HINT) ? "ctx->Hint, " : "", (state & _NEW_LIGHT) ? "ctx->Light, " : "", (state & _NEW_LINE) ? "ctx->Line, " : "", (state & _NEW_PIXEL) ? "ctx->Pixel, " : "", (state & _NEW_POINT) ? "ctx->Point, " : "", (state & _NEW_POLYGON) ? "ctx->Polygon, " : "", (state & _NEW_POLYGONSTIPPLE) ? "ctx->PolygonStipple, " : "", (state & _NEW_SCISSOR) ? "ctx->Scissor, " : "", (state & _NEW_TEXTURE) ? "ctx->Texture, " : "", (state & _NEW_TRANSFORM) ? "ctx->Transform, " : "", (state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "", (state & _NEW_PACKUNPACK) ? "ctx->Pack/Unpack, " : "", (state & _NEW_ARRAY) ? "ctx->Array, " : "", (state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "", (state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : ""); } void _mesa_print_tri_caps( const char *name, GLuint flags ) { _mesa_debug(NULL, "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", name, flags, (flags & DD_FLATSHADE) ? "flat-shade, " : "", (flags & DD_SEPARATE_SPECULAR) ? "separate-specular, " : "", (flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "", (flags & DD_TRI_TWOSTENCIL) ? "tri-twostencil, " : "", (flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : "", (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "", (flags & DD_TRI_OFFSET) ? "tri-offset, " : "", (flags & DD_TRI_SMOOTH) ? "tri-smooth, " : "", (flags & DD_LINE_SMOOTH) ? "line-smooth, " : "", (flags & DD_LINE_STIPPLE) ? "line-stipple, " : "", (flags & DD_LINE_WIDTH) ? "line-wide, " : "", (flags & DD_POINT_SMOOTH) ? "point-smooth, " : "", (flags & DD_POINT_SIZE) ? "point-size, " : "", (flags & DD_POINT_ATTEN) ? "point-atten, " : "", (flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : "" ); } /** * Print information about this Mesa version and build options. */ void _mesa_print_info( void ) { _mesa_debug(NULL, "Mesa GL_VERSION = %s\n", (char *) _mesa_GetString(GL_VERSION)); _mesa_debug(NULL, "Mesa GL_RENDERER = %s\n", (char *) _mesa_GetString(GL_RENDERER)); _mesa_debug(NULL, "Mesa GL_VENDOR = %s\n", (char *) _mesa_GetString(GL_VENDOR)); _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", (char *) _mesa_GetString(GL_EXTENSIONS)); #if defined(THREADS) _mesa_debug(NULL, "Mesa thread-safe: YES\n"); #else _mesa_debug(NULL, "Mesa thread-safe: NO\n"); #endif #if defined(USE_X86_ASM) _mesa_debug(NULL, "Mesa x86-optimized: YES\n"); #else _mesa_debug(NULL, "Mesa x86-optimized: NO\n"); #endif #if defined(USE_SPARC_ASM) _mesa_debug(NULL, "Mesa sparc-optimized: YES\n"); #else _mesa_debug(NULL, "Mesa sparc-optimized: NO\n"); #endif } /** * Set the debugging flags. * * \param debug debug string * * If compiled with debugging support then search for keywords in \p debug and * enables the verbose debug output of the respective feature. */ static void add_debug_flags( const char *debug ) { #ifdef MESA_DEBUG if (_mesa_strstr(debug, "varray")) MESA_VERBOSE |= VERBOSE_VARRAY; if (_mesa_strstr(debug, "tex")) MESA_VERBOSE |= VERBOSE_TEXTURE; if (_mesa_strstr(debug, "imm")) MESA_VERBOSE |= VERBOSE_IMMEDIATE; if (_mesa_strstr(debug, "pipe")) MESA_VERBOSE |= VERBOSE_PIPELINE; if (_mesa_strstr(debug, "driver")) MESA_VERBOSE |= VERBOSE_DRIVER; if (_mesa_strstr(debug, "state")) MESA_VERBOSE |= VERBOSE_STATE; if (_mesa_strstr(debug, "api")) MESA_VERBOSE |= VERBOSE_API; if (_mesa_strstr(debug, "list")) MESA_VERBOSE |= VERBOSE_DISPLAY_LIST; if (_mesa_strstr(debug, "lighting")) MESA_VERBOSE |= VERBOSE_LIGHTING; if (_mesa_strstr(debug, "disassem")) MESA_VERBOSE |= VERBOSE_DISASSEM; /* Debug flag: */ if (_mesa_strstr(debug, "flush")) MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH; #else (void) debug; #endif } void _mesa_init_debug( GLcontext *ctx ) { char *c; /* For debug/development only */ ctx->FirstTimeCurrent = GL_TRUE; /* Dither disable */ ctx->NoDither = _mesa_getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE; if (ctx->NoDither) { if (_mesa_getenv("MESA_DEBUG")) { _mesa_debug(ctx, "MESA_NO_DITHER set - dithering disabled\n"); } ctx->Color.DitherFlag = GL_FALSE; } c = _mesa_getenv("MESA_DEBUG"); if (c) add_debug_flags(c); c = _mesa_getenv("MESA_VERBOSE"); if (c) add_debug_flags(c); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/debug.h0000644000000000000000000000340013614532424017375 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file debug.h * Debugging functions. * * \if subset * (No-op) * * \endif */ #ifndef _DEBUG_H #define _DEBUG_H #if _HAVE_FULL_GL extern void _mesa_print_tri_caps( const char *name, GLuint flags ); extern void _mesa_print_enable_flags( const char *msg, GLuint flags ); extern void _mesa_print_state( const char *msg, GLuint state ); extern void _mesa_print_info( void ); extern void _mesa_init_debug( GLcontext *ctx ); #else /** No-op */ #define _mesa_print_state( m, s ) ((void)0) /** No-op */ #define _mesa_print_info() ((void)0) /** No-op */ #define _mesa_init_debug( c ) ((void)0) #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/depth.c0000644000000000000000000001215113614532424017411 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "imports.h" #include "context.h" #include "depth.h" #include "enums.h" #include "hash.h" #include "macros.h" #include "mtypes.h" /**********************************************************************/ /***** API Functions *****/ /**********************************************************************/ void GLAPIENTRY _mesa_ClearDepth( GLclampd depth ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); depth = CLAMP( depth, 0.0, 1.0 ); if (ctx->Depth.Clear == depth) return; FLUSH_VERTICES(ctx, _NEW_DEPTH); ctx->Depth.Clear = depth; if (ctx->Driver.ClearDepth) (*ctx->Driver.ClearDepth)( ctx, ctx->Depth.Clear ); } void GLAPIENTRY _mesa_DepthFunc( GLenum func ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func)); switch (func) { case GL_LESS: /* (default) pass if incoming z < stored z */ case GL_GEQUAL: case GL_LEQUAL: case GL_GREATER: case GL_NOTEQUAL: case GL_EQUAL: case GL_ALWAYS: case GL_NEVER: break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glDepth.Func" ); return; } if (ctx->Depth.Func == func) return; FLUSH_VERTICES(ctx, _NEW_DEPTH); ctx->Depth.Func = func; if (ctx->Driver.DepthFunc) ctx->Driver.DepthFunc( ctx, func ); } void GLAPIENTRY _mesa_DepthMask( GLboolean flag ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glDepthMask %d\n", flag); /* * GL_TRUE indicates depth buffer writing is enabled (default) * GL_FALSE indicates depth buffer writing is disabled */ if (ctx->Depth.Mask == flag) return; FLUSH_VERTICES(ctx, _NEW_DEPTH); ctx->Depth.Mask = flag; if (ctx->Driver.DepthMask) ctx->Driver.DepthMask( ctx, flag ); } /** * Specified by the GL_EXT_depth_bounds_test extension. */ void GLAPIENTRY _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (zmin > zmax) { _mesa_error(ctx, GL_INVALID_VALUE, "glDepthBoundsEXT(zmin > zmax)"); return; } zmin = CLAMP(zmin, 0.0, 1.0); zmax = CLAMP(zmax, 0.0, 1.0); if (ctx->Depth.BoundsMin == zmin && ctx->Depth.BoundsMax == zmax) return; FLUSH_VERTICES(ctx, _NEW_DEPTH); ctx->Depth.BoundsMin = (GLfloat) zmin; ctx->Depth.BoundsMax = (GLfloat) zmax; } /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ /** * Initialize the depth buffer attribute group in the given context. */ void _mesa_init_depth( GLcontext * ctx ) { /* Depth buffer group */ ctx->Depth.Test = GL_FALSE; ctx->Depth.Clear = 1.0; ctx->Depth.Func = GL_LESS; ctx->Depth.Mask = GL_TRUE; ctx->Depth.OcclusionTest = GL_FALSE; /* XXX this is now per-framebuffer state */ #if 00 /* Z buffer stuff */ if (ctx->Visual.depthBits == 0) { /* Special case. Even if we don't have a depth buffer we need * good values for DepthMax for Z vertex transformation purposes * and for per-fragment fog computation. */ ctx->DepthMax = (1 << 16) - 1; ctx->DepthMaxF = (GLfloat) ctx->DepthMax; } else if (ctx->Visual.depthBits < 32) { ctx->DepthMax = (1 << ctx->Visual.depthBits) - 1; ctx->DepthMaxF = (GLfloat) ctx->DepthMax; } else { /* Special case since shift values greater than or equal to the * number of bits in the left hand expression's type are undefined. */ ctx->DepthMax = 0xffffffff; ctx->DepthMaxF = (GLfloat) ctx->DepthMax; } ctx->MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */ #endif } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/depth.h0000644000000000000000000000322013614532424017413 0ustar /** * \file depth.h * Depth buffer operations. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef DEPTH_H #define DEPTH_H #include "mtypes.h" #if _HAVE_FULL_GL extern void GLAPIENTRY _mesa_ClearDepth( GLclampd depth ); extern void GLAPIENTRY _mesa_DepthFunc( GLenum func ); extern void GLAPIENTRY _mesa_DepthMask( GLboolean flag ); extern void GLAPIENTRY _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ); extern void _mesa_init_depth( GLcontext * ctx ); #else /** No-op */ #define _mesa_init_depth( c ) ((void)0) #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/dispatch.c0000644000000000000000000000520113614532424020102 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file dispatch.c * * This file generates all the gl* function entrypoints. This code is not * used if optimized assembly stubs are available (e.g., using x86/glapi_x86.S * on IA32 or sparc/glapi_sparc.S on SPARC). * * \note * This file is also used to build the client-side libGL that loads DRI-based * device drivers. At build-time it is symlinked to src/glx/x11. * * \author Brian Paul */ #ifndef GLX_USE_APPLEGL #include "glheader.h" #include "glapi.h" #include "glapitable.h" #include "glthread.h" #if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) #if defined(WIN32) #define KEYWORD1 GLAPI #else #define KEYWORD1 PUBLIC #endif #define KEYWORD2 GLAPIENTRY #if defined(USE_MGL_NAMESPACE) #define NAME(func) mgl##func #else #define NAME(func) gl##func #endif #if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */ #define F stdout #define DISPATCH(FUNC, ARGS, MESSAGE) \ fprintf MESSAGE; \ CALL_ ## FUNC(GET_DISPATCH(), ARGS); #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ fprintf MESSAGE; \ return CALL_ ## FUNC(GET_DISPATCH(), ARGS); #else #define DISPATCH(FUNC, ARGS, MESSAGE) \ CALL_ ## FUNC(GET_DISPATCH(), ARGS); #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ return CALL_ ## FUNC(GET_DISPATCH(), ARGS); #endif /* logging */ #ifndef GLAPIENTRY #define GLAPIENTRY #endif #include "dispatch.h" #include "glapitemp.h" #endif /* USE_X86_ASM */ #endif /* !GLX_USE_APPLEGL */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/dlist.c0000644000000000000000000073331513614532424017440 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file dlist.c * Display lists management functions. */ #include "glheader.h" #include "imports.h" #include "api_arrayelt.h" #include "api_loopback.h" #include "config.h" #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program #include "arbprogram.h" #include "program.h" #endif #include "attrib.h" #include "blend.h" #include "buffers.h" #if FEATURE_ARB_vertex_buffer_object #include "bufferobj.h" #endif #include "clip.h" #include "colormac.h" #include "colortab.h" #include "context.h" #include "convolve.h" #include "depth.h" #include "dlist.h" #include "enable.h" #include "enums.h" #include "eval.h" #include "extensions.h" #include "feedback.h" #include "get.h" #include "glapi.h" #include "hash.h" #include "histogram.h" #include "image.h" #include "light.h" #include "lines.h" #include "dlist.h" #include "macros.h" #include "matrix.h" #include "occlude.h" #include "pixel.h" #include "points.h" #include "polygon.h" #include "state.h" #include "texobj.h" #include "teximage.h" #include "texstate.h" #include "mtypes.h" #include "varray.h" #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program #include "nvprogram.h" #include "program.h" #endif #if FEATURE_ATI_fragment_shader #include "atifragshader.h" #endif #include "math/m_matrix.h" #include "math/m_xform.h" #include "dispatch.h" /** * Flush vertices. * * \param ctx GL context. * * Checks if dd_function_table::SaveNeedFlush is marked to flush * stored (save) vertices, and calls * dd_function_table::SaveFlushVertices if so. */ #define SAVE_FLUSH_VERTICES(ctx) \ do { \ if (ctx->Driver.SaveNeedFlush) \ ctx->Driver.SaveFlushVertices(ctx); \ } while (0) /** * Macro to assert that the API call was made outside the * glBegin()/glEnd() pair, with return value. * * \param ctx GL context. * \param retval value to return value in case the assertion fails. */ #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \ do { \ if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \ ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \ _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \ return retval; \ } \ } while (0) /** * Macro to assert that the API call was made outside the * glBegin()/glEnd() pair. * * \param ctx GL context. */ #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \ do { \ if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \ ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \ _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \ return; \ } \ } while (0) /** * Macro to assert that the API call was made outside the * glBegin()/glEnd() pair and flush the vertices. * * \param ctx GL context. */ #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \ do { \ ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \ SAVE_FLUSH_VERTICES(ctx); \ } while (0) /** * Macro to assert that the API call was made outside the * glBegin()/glEnd() pair and flush the vertices, with return value. * * \param ctx GL context. * \param retval value to return value in case the assertion fails. */ #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\ do { \ ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \ SAVE_FLUSH_VERTICES(ctx); \ } while (0) /** * Display list opcodes. * * The fact that these identifiers are assigned consecutive * integer values starting at 0 is very important, see InstSize array usage) */ typedef enum { OPCODE_INVALID = -1, /* Force signed enum */ OPCODE_ACCUM, OPCODE_ALPHA_FUNC, OPCODE_BIND_TEXTURE, OPCODE_BITMAP, OPCODE_BLEND_COLOR, OPCODE_BLEND_EQUATION, OPCODE_BLEND_EQUATION_SEPARATE, OPCODE_BLEND_FUNC_SEPARATE, OPCODE_CALL_LIST, OPCODE_CALL_LIST_OFFSET, OPCODE_CLEAR, OPCODE_CLEAR_ACCUM, OPCODE_CLEAR_COLOR, OPCODE_CLEAR_DEPTH, OPCODE_CLEAR_INDEX, OPCODE_CLEAR_STENCIL, OPCODE_CLIP_PLANE, OPCODE_COLOR_MASK, OPCODE_COLOR_MATERIAL, OPCODE_COLOR_TABLE, OPCODE_COLOR_TABLE_PARAMETER_FV, OPCODE_COLOR_TABLE_PARAMETER_IV, OPCODE_COLOR_SUB_TABLE, OPCODE_CONVOLUTION_FILTER_1D, OPCODE_CONVOLUTION_FILTER_2D, OPCODE_CONVOLUTION_PARAMETER_I, OPCODE_CONVOLUTION_PARAMETER_IV, OPCODE_CONVOLUTION_PARAMETER_F, OPCODE_CONVOLUTION_PARAMETER_FV, OPCODE_COPY_COLOR_SUB_TABLE, OPCODE_COPY_COLOR_TABLE, OPCODE_COPY_PIXELS, OPCODE_COPY_TEX_IMAGE1D, OPCODE_COPY_TEX_IMAGE2D, OPCODE_COPY_TEX_SUB_IMAGE1D, OPCODE_COPY_TEX_SUB_IMAGE2D, OPCODE_COPY_TEX_SUB_IMAGE3D, OPCODE_CULL_FACE, OPCODE_DEPTH_FUNC, OPCODE_DEPTH_MASK, OPCODE_DEPTH_RANGE, OPCODE_DISABLE, OPCODE_DRAW_BUFFER, OPCODE_DRAW_PIXELS, OPCODE_ENABLE, OPCODE_EVALMESH1, OPCODE_EVALMESH2, OPCODE_FOG, OPCODE_FRONT_FACE, OPCODE_FRUSTUM, OPCODE_HINT, OPCODE_HISTOGRAM, OPCODE_INDEX_MASK, OPCODE_INIT_NAMES, OPCODE_LIGHT, OPCODE_LIGHT_MODEL, OPCODE_LINE_STIPPLE, OPCODE_LINE_WIDTH, OPCODE_LIST_BASE, OPCODE_LOAD_IDENTITY, OPCODE_LOAD_MATRIX, OPCODE_LOAD_NAME, OPCODE_LOGIC_OP, OPCODE_MAP1, OPCODE_MAP2, OPCODE_MAPGRID1, OPCODE_MAPGRID2, OPCODE_MATRIX_MODE, OPCODE_MIN_MAX, OPCODE_MULT_MATRIX, OPCODE_ORTHO, OPCODE_PASSTHROUGH, OPCODE_PIXEL_MAP, OPCODE_PIXEL_TRANSFER, OPCODE_PIXEL_ZOOM, OPCODE_POINT_SIZE, OPCODE_POINT_PARAMETERS, OPCODE_POLYGON_MODE, OPCODE_POLYGON_STIPPLE, OPCODE_POLYGON_OFFSET, OPCODE_POP_ATTRIB, OPCODE_POP_MATRIX, OPCODE_POP_NAME, OPCODE_PRIORITIZE_TEXTURE, OPCODE_PUSH_ATTRIB, OPCODE_PUSH_MATRIX, OPCODE_PUSH_NAME, OPCODE_RASTER_POS, OPCODE_READ_BUFFER, OPCODE_RESET_HISTOGRAM, OPCODE_RESET_MIN_MAX, OPCODE_ROTATE, OPCODE_SCALE, OPCODE_SCISSOR, OPCODE_SELECT_TEXTURE_SGIS, OPCODE_SELECT_TEXTURE_COORD_SET, OPCODE_SHADE_MODEL, OPCODE_STENCIL_FUNC, OPCODE_STENCIL_MASK, OPCODE_STENCIL_OP, OPCODE_TEXENV, OPCODE_TEXGEN, OPCODE_TEXPARAMETER, OPCODE_TEX_IMAGE1D, OPCODE_TEX_IMAGE2D, OPCODE_TEX_IMAGE3D, OPCODE_TEX_SUB_IMAGE1D, OPCODE_TEX_SUB_IMAGE2D, OPCODE_TEX_SUB_IMAGE3D, OPCODE_TRANSLATE, OPCODE_VIEWPORT, OPCODE_WINDOW_POS, /* GL_ARB_multitexture */ OPCODE_ACTIVE_TEXTURE, /* GL_SGIX/SGIS_pixel_texture */ OPCODE_PIXEL_TEXGEN_SGIX, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, /* GL_ARB_texture_compression */ OPCODE_COMPRESSED_TEX_IMAGE_1D, OPCODE_COMPRESSED_TEX_IMAGE_2D, OPCODE_COMPRESSED_TEX_IMAGE_3D, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, /* GL_ARB_multisample */ OPCODE_SAMPLE_COVERAGE, /* GL_ARB_window_pos */ OPCODE_WINDOW_POS_ARB, /* GL_NV_vertex_program */ OPCODE_BIND_PROGRAM_NV, OPCODE_EXECUTE_PROGRAM_NV, OPCODE_REQUEST_RESIDENT_PROGRAMS_NV, OPCODE_LOAD_PROGRAM_NV, OPCODE_PROGRAM_PARAMETER4F_NV, OPCODE_TRACK_MATRIX_NV, /* GL_NV_fragment_program */ OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, OPCODE_PROGRAM_NAMED_PARAMETER_NV, /* GL_EXT_stencil_two_side */ OPCODE_ACTIVE_STENCIL_FACE_EXT, /* GL_EXT_depth_bounds_test */ OPCODE_DEPTH_BOUNDS_EXT, /* GL_ARB_vertex/fragment_program */ OPCODE_PROGRAM_STRING_ARB, OPCODE_PROGRAM_ENV_PARAMETER_ARB, /* GL_ARB_occlusion_query */ OPCODE_BEGIN_QUERY_ARB, OPCODE_END_QUERY_ARB, /* GL_ARB_draw_buffers */ OPCODE_DRAW_BUFFERS_ARB, /* GL_ATI_fragment_shader */ OPCODE_BIND_FRAGMENT_SHADER_ATI, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, /* OpenGL 2.0 */ OPCODE_STENCIL_FUNC_SEPARATE, OPCODE_STENCIL_OP_SEPARATE, OPCODE_STENCIL_MASK_SEPARATE, /* Vertex attributes -- fallback for when optimized display * list build isn't active. */ OPCODE_ATTR_1F_NV, OPCODE_ATTR_2F_NV, OPCODE_ATTR_3F_NV, OPCODE_ATTR_4F_NV, OPCODE_ATTR_1F_ARB, OPCODE_ATTR_2F_ARB, OPCODE_ATTR_3F_ARB, OPCODE_ATTR_4F_ARB, OPCODE_MATERIAL, OPCODE_INDEX, OPCODE_EDGEFLAG, OPCODE_BEGIN, OPCODE_END, OPCODE_RECTF, OPCODE_EVAL_C1, OPCODE_EVAL_C2, OPCODE_EVAL_P1, OPCODE_EVAL_P2, /* The following three are meta instructions */ OPCODE_ERROR, /* raise compiled-in error */ OPCODE_CONTINUE, OPCODE_END_OF_LIST, OPCODE_EXT_0 } OpCode; /** * Display list node. * * Display list instructions are stored as sequences of "nodes". Nodes * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks * are linked together with a pointer. * * Each instruction in the display list is stored as a sequence of * contiguous nodes in memory. * Each node is the union of a variety of data types. */ union node { OpCode opcode; GLboolean b; GLbitfield bf; GLubyte ub; GLshort s; GLushort us; GLint i; GLuint ui; GLenum e; GLfloat f; GLvoid *data; void *next; /* If prev node's opcode==OPCODE_CONTINUE */ }; /** * How many nodes to allocate at a time. * * \note Reduced now that we hold vertices etc. elsewhere. */ #define BLOCK_SIZE 256 /** * Number of nodes of storage needed for each instruction. * Sizes for dynamically allocated opcodes are stored in the context struct. */ static GLuint InstSize[ OPCODE_END_OF_LIST+1 ]; void mesa_print_display_list( GLuint list ); /**********************************************************************/ /***** Private *****/ /**********************************************************************/ /* * Make an empty display list. This is used by glGenLists() to * reserver display list IDs. */ static struct mesa_display_list *make_list( GLuint list, GLuint count ) { struct mesa_display_list *dlist = CALLOC_STRUCT( mesa_display_list ); dlist->id = list; dlist->node = (Node *) MALLOC( sizeof(Node) * count ); dlist->node[0].opcode = OPCODE_END_OF_LIST; return dlist; } /* * Destroy all nodes in a display list. * \param list - display list number */ void _mesa_destroy_list( GLcontext *ctx, GLuint list ) { struct mesa_display_list *dlist; Node *n, *block; GLboolean done; if (list==0) return; dlist = (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list); if (!dlist) return; n = block = dlist->node; done = block ? GL_FALSE : GL_TRUE; while (!done) { /* check for extension opcodes first */ GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0; if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { ctx->ListExt.Opcode[i].Destroy(ctx, &n[1]); n += ctx->ListExt.Opcode[i].Size; } else { switch (n[0].opcode) { /* for some commands, we need to free malloc'd memory */ case OPCODE_MAP1: FREE(n[6].data); n += InstSize[n[0].opcode]; break; case OPCODE_MAP2: FREE(n[10].data); n += InstSize[n[0].opcode]; break; case OPCODE_DRAW_PIXELS: FREE( n[5].data ); n += InstSize[n[0].opcode]; break; case OPCODE_BITMAP: FREE( n[7].data ); n += InstSize[n[0].opcode]; break; case OPCODE_COLOR_TABLE: FREE( n[6].data ); n += InstSize[n[0].opcode]; break; case OPCODE_COLOR_SUB_TABLE: FREE( n[6].data ); n += InstSize[n[0].opcode]; break; case OPCODE_CONVOLUTION_FILTER_1D: FREE( n[6].data ); n += InstSize[n[0].opcode]; break; case OPCODE_CONVOLUTION_FILTER_2D: FREE( n[7].data ); n += InstSize[n[0].opcode]; break; case OPCODE_POLYGON_STIPPLE: FREE( n[1].data ); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_IMAGE1D: FREE(n[8].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_IMAGE2D: FREE( n[9]. data ); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_IMAGE3D: FREE( n[10]. data ); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_SUB_IMAGE1D: FREE(n[7].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_SUB_IMAGE2D: FREE(n[9].data); n += InstSize[n[0].opcode]; break; case OPCODE_TEX_SUB_IMAGE3D: FREE(n[11].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_IMAGE_1D: FREE(n[7].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_IMAGE_2D: FREE(n[8].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_IMAGE_3D: FREE(n[9].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: FREE(n[7].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: FREE(n[9].data); n += InstSize[n[0].opcode]; break; case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: FREE(n[11].data); n += InstSize[n[0].opcode]; break; #if FEATURE_NV_vertex_program case OPCODE_LOAD_PROGRAM_NV: FREE(n[4].data); /* program string */ n += InstSize[n[0].opcode]; break; case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV: FREE(n[2].data); /* array of program ids */ n += InstSize[n[0].opcode]; break; #endif #if FEATURE_NV_fragment_program case OPCODE_PROGRAM_NAMED_PARAMETER_NV: FREE(n[3].data); /* parameter name */ n += InstSize[n[0].opcode]; break; #endif #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program case OPCODE_PROGRAM_STRING_ARB: FREE(n[4].data); /* program string */ n += InstSize[n[0].opcode]; break; #endif case OPCODE_CONTINUE: n = (Node *) n[1].next; FREE( block ); block = n; break; case OPCODE_END_OF_LIST: FREE( block ); done = GL_TRUE; break; default: /* Most frequent case */ n += InstSize[n[0].opcode]; break; } } } FREE( dlist ); _mesa_HashRemove(ctx->Shared->DisplayList, list); } /* * Translate the nth element of list from type to GLuint. */ static GLuint translate_id( GLsizei n, GLenum type, const GLvoid *list ) { GLbyte *bptr; GLubyte *ubptr; GLshort *sptr; GLushort *usptr; GLint *iptr; GLuint *uiptr; GLfloat *fptr; switch (type) { case GL_BYTE: bptr = (GLbyte *) list; return (GLuint) *(bptr+n); case GL_UNSIGNED_BYTE: ubptr = (GLubyte *) list; return (GLuint) *(ubptr+n); case GL_SHORT: sptr = (GLshort *) list; return (GLuint) *(sptr+n); case GL_UNSIGNED_SHORT: usptr = (GLushort *) list; return (GLuint) *(usptr+n); case GL_INT: iptr = (GLint *) list; return (GLuint) *(iptr+n); case GL_UNSIGNED_INT: uiptr = (GLuint *) list; return (GLuint) *(uiptr+n); case GL_FLOAT: fptr = (GLfloat *) list; return (GLuint) *(fptr+n); case GL_2_BYTES: ubptr = ((GLubyte *) list) + 2*n; return (GLuint) *ubptr * 256 + (GLuint) *(ubptr+1); case GL_3_BYTES: ubptr = ((GLubyte *) list) + 3*n; return (GLuint) *ubptr * 65536 + (GLuint) *(ubptr+1) * 256 + (GLuint) *(ubptr+2); case GL_4_BYTES: ubptr = ((GLubyte *) list) + 4*n; return (GLuint) *ubptr * 16777216 + (GLuint) *(ubptr+1) * 65536 + (GLuint) *(ubptr+2) * 256 + (GLuint) *(ubptr+3); default: return 0; } } /**********************************************************************/ /***** Public *****/ /**********************************************************************/ /** * Do one-time initialiazations for display lists. */ void _mesa_init_lists( void ) { static int init_flag = 0; if (init_flag==0) { InstSize[OPCODE_ACCUM] = 3; InstSize[OPCODE_ALPHA_FUNC] = 3; InstSize[OPCODE_BIND_TEXTURE] = 3; InstSize[OPCODE_BITMAP] = 8; InstSize[OPCODE_BLEND_COLOR] = 5; InstSize[OPCODE_BLEND_EQUATION] = 2; InstSize[OPCODE_BLEND_EQUATION_SEPARATE] = 3; InstSize[OPCODE_BLEND_FUNC_SEPARATE] = 5; InstSize[OPCODE_CALL_LIST] = 2; InstSize[OPCODE_CALL_LIST_OFFSET] = 3; InstSize[OPCODE_CLEAR] = 2; InstSize[OPCODE_CLEAR_ACCUM] = 5; InstSize[OPCODE_CLEAR_COLOR] = 5; InstSize[OPCODE_CLEAR_DEPTH] = 2; InstSize[OPCODE_CLEAR_INDEX] = 2; InstSize[OPCODE_CLEAR_STENCIL] = 2; InstSize[OPCODE_CLIP_PLANE] = 6; InstSize[OPCODE_COLOR_MASK] = 5; InstSize[OPCODE_COLOR_MATERIAL] = 3; InstSize[OPCODE_COLOR_TABLE] = 7; InstSize[OPCODE_COLOR_TABLE_PARAMETER_FV] = 7; InstSize[OPCODE_COLOR_TABLE_PARAMETER_IV] = 7; InstSize[OPCODE_COLOR_SUB_TABLE] = 7; InstSize[OPCODE_CONVOLUTION_FILTER_1D] = 7; InstSize[OPCODE_CONVOLUTION_FILTER_2D] = 8; InstSize[OPCODE_CONVOLUTION_PARAMETER_I] = 4; InstSize[OPCODE_CONVOLUTION_PARAMETER_IV] = 7; InstSize[OPCODE_CONVOLUTION_PARAMETER_F] = 4; InstSize[OPCODE_CONVOLUTION_PARAMETER_FV] = 7; InstSize[OPCODE_COPY_PIXELS] = 6; InstSize[OPCODE_COPY_COLOR_SUB_TABLE] = 6; InstSize[OPCODE_COPY_COLOR_TABLE] = 6; InstSize[OPCODE_COPY_TEX_IMAGE1D] = 8; InstSize[OPCODE_COPY_TEX_IMAGE2D] = 9; InstSize[OPCODE_COPY_TEX_SUB_IMAGE1D] = 7; InstSize[OPCODE_COPY_TEX_SUB_IMAGE2D] = 9; InstSize[OPCODE_COPY_TEX_SUB_IMAGE3D] = 10; InstSize[OPCODE_CULL_FACE] = 2; InstSize[OPCODE_DEPTH_FUNC] = 2; InstSize[OPCODE_DEPTH_MASK] = 2; InstSize[OPCODE_DEPTH_RANGE] = 3; InstSize[OPCODE_DISABLE] = 2; InstSize[OPCODE_DRAW_BUFFER] = 2; InstSize[OPCODE_DRAW_PIXELS] = 6; InstSize[OPCODE_ENABLE] = 2; InstSize[OPCODE_EVALMESH1] = 4; InstSize[OPCODE_EVALMESH2] = 6; InstSize[OPCODE_FOG] = 6; InstSize[OPCODE_FRONT_FACE] = 2; InstSize[OPCODE_FRUSTUM] = 7; InstSize[OPCODE_HINT] = 3; InstSize[OPCODE_HISTOGRAM] = 5; InstSize[OPCODE_INDEX_MASK] = 2; InstSize[OPCODE_INIT_NAMES] = 1; InstSize[OPCODE_LIGHT] = 7; InstSize[OPCODE_LIGHT_MODEL] = 6; InstSize[OPCODE_LINE_STIPPLE] = 3; InstSize[OPCODE_LINE_WIDTH] = 2; InstSize[OPCODE_LIST_BASE] = 2; InstSize[OPCODE_LOAD_IDENTITY] = 1; InstSize[OPCODE_LOAD_MATRIX] = 17; InstSize[OPCODE_LOAD_NAME] = 2; InstSize[OPCODE_LOGIC_OP] = 2; InstSize[OPCODE_MAP1] = 7; InstSize[OPCODE_MAP2] = 11; InstSize[OPCODE_MAPGRID1] = 4; InstSize[OPCODE_MAPGRID2] = 7; InstSize[OPCODE_MATRIX_MODE] = 2; InstSize[OPCODE_MIN_MAX] = 4; InstSize[OPCODE_MULT_MATRIX] = 17; InstSize[OPCODE_ORTHO] = 7; InstSize[OPCODE_PASSTHROUGH] = 2; InstSize[OPCODE_PIXEL_MAP] = 4; InstSize[OPCODE_PIXEL_TRANSFER] = 3; InstSize[OPCODE_PIXEL_ZOOM] = 3; InstSize[OPCODE_POINT_SIZE] = 2; InstSize[OPCODE_POINT_PARAMETERS] = 5; InstSize[OPCODE_POLYGON_MODE] = 3; InstSize[OPCODE_POLYGON_STIPPLE] = 2; InstSize[OPCODE_POLYGON_OFFSET] = 3; InstSize[OPCODE_POP_ATTRIB] = 1; InstSize[OPCODE_POP_MATRIX] = 1; InstSize[OPCODE_POP_NAME] = 1; InstSize[OPCODE_PRIORITIZE_TEXTURE] = 3; InstSize[OPCODE_PUSH_ATTRIB] = 2; InstSize[OPCODE_PUSH_MATRIX] = 1; InstSize[OPCODE_PUSH_NAME] = 2; InstSize[OPCODE_RASTER_POS] = 5; InstSize[OPCODE_READ_BUFFER] = 2; InstSize[OPCODE_RESET_HISTOGRAM] = 2; InstSize[OPCODE_RESET_MIN_MAX] = 2; InstSize[OPCODE_ROTATE] = 5; InstSize[OPCODE_SCALE] = 4; InstSize[OPCODE_SCISSOR] = 5; InstSize[OPCODE_STENCIL_FUNC] = 4; InstSize[OPCODE_STENCIL_MASK] = 2; InstSize[OPCODE_STENCIL_OP] = 4; InstSize[OPCODE_SHADE_MODEL] = 2; InstSize[OPCODE_TEXENV] = 7; InstSize[OPCODE_TEXGEN] = 7; InstSize[OPCODE_TEXPARAMETER] = 7; InstSize[OPCODE_TEX_IMAGE1D] = 9; InstSize[OPCODE_TEX_IMAGE2D] = 10; InstSize[OPCODE_TEX_IMAGE3D] = 11; InstSize[OPCODE_TEX_SUB_IMAGE1D] = 8; InstSize[OPCODE_TEX_SUB_IMAGE2D] = 10; InstSize[OPCODE_TEX_SUB_IMAGE3D] = 12; InstSize[OPCODE_TRANSLATE] = 4; InstSize[OPCODE_VIEWPORT] = 5; InstSize[OPCODE_WINDOW_POS] = 5; InstSize[OPCODE_CONTINUE] = 2; InstSize[OPCODE_ERROR] = 3; InstSize[OPCODE_END_OF_LIST] = 1; /* GL_SGIX/SGIS_pixel_texture */ InstSize[OPCODE_PIXEL_TEXGEN_SGIX] = 2; InstSize[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS] = 3; /* GL_ARB_texture_compression */ InstSize[OPCODE_COMPRESSED_TEX_IMAGE_1D] = 8; InstSize[OPCODE_COMPRESSED_TEX_IMAGE_2D] = 9; InstSize[OPCODE_COMPRESSED_TEX_IMAGE_3D] = 10; InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D] = 8; InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D] = 10; InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D] = 12; /* GL_ARB_multisample */ InstSize[OPCODE_SAMPLE_COVERAGE] = 3; /* GL_ARB_multitexture */ InstSize[OPCODE_ACTIVE_TEXTURE] = 2; /* GL_ARB_window_pos */ InstSize[OPCODE_WINDOW_POS_ARB] = 4; /* GL_NV_vertex_program */ InstSize[OPCODE_BIND_PROGRAM_NV] = 3; InstSize[OPCODE_EXECUTE_PROGRAM_NV] = 7; InstSize[OPCODE_REQUEST_RESIDENT_PROGRAMS_NV] = 2; InstSize[OPCODE_LOAD_PROGRAM_NV] = 5; InstSize[OPCODE_PROGRAM_PARAMETER4F_NV] = 7; InstSize[OPCODE_TRACK_MATRIX_NV] = 5; /* GL_NV_fragment_program */ InstSize[OPCODE_PROGRAM_LOCAL_PARAMETER_ARB] = 7; InstSize[OPCODE_PROGRAM_NAMED_PARAMETER_NV] = 8; /* GL_EXT_stencil_two_side */ InstSize[OPCODE_ACTIVE_STENCIL_FACE_EXT] = 2; /* GL_EXT_depth_bounds_test */ InstSize[OPCODE_DEPTH_BOUNDS_EXT] = 3; #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program InstSize[OPCODE_PROGRAM_STRING_ARB] = 5; InstSize[OPCODE_PROGRAM_ENV_PARAMETER_ARB] = 7; #endif #if FEATURE_ARB_occlusion_query InstSize[OPCODE_BEGIN_QUERY_ARB] = 3; InstSize[OPCODE_END_QUERY_ARB] = 2; #endif InstSize[OPCODE_DRAW_BUFFERS_ARB] = 2 + MAX_DRAW_BUFFERS; #if FEATURE_ATI_fragment_shader InstSize[OPCODE_BIND_FRAGMENT_SHADER_ATI] = 2; InstSize[OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI] = 6; #endif /* OpenGL 2.0 */ InstSize[OPCODE_STENCIL_FUNC_SEPARATE] = 5; InstSize[OPCODE_STENCIL_MASK_SEPARATE] = 3; InstSize[OPCODE_STENCIL_OP_SEPARATE] = 5; InstSize[OPCODE_ATTR_1F_NV] = 3; InstSize[OPCODE_ATTR_2F_NV] = 4; InstSize[OPCODE_ATTR_3F_NV] = 5; InstSize[OPCODE_ATTR_4F_NV] = 6; InstSize[OPCODE_ATTR_1F_ARB] = 3; InstSize[OPCODE_ATTR_2F_ARB] = 4; InstSize[OPCODE_ATTR_3F_ARB] = 5; InstSize[OPCODE_ATTR_4F_ARB] = 6; InstSize[OPCODE_MATERIAL] = 7; InstSize[OPCODE_INDEX] = 2; InstSize[OPCODE_EDGEFLAG] = 2; InstSize[OPCODE_BEGIN] = 2; InstSize[OPCODE_END] = 1; InstSize[OPCODE_RECTF] = 5; InstSize[OPCODE_EVAL_C1] = 2; InstSize[OPCODE_EVAL_C2] = 3; InstSize[OPCODE_EVAL_P1] = 2; InstSize[OPCODE_EVAL_P2] = 3; } init_flag = 1; } /** * Wrapper for _mesa_unpack_image() that handles pixel buffer objects. * \todo This won't suffice when the PBO is really in VRAM/GPU memory. */ static GLvoid * unpack_image( GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *unpack ) { if (unpack->BufferObj->Name == 0) { /* no PBO */ return _mesa_unpack_image(dimensions, width, height, depth, format, type, pixels, unpack); } else if (_mesa_validate_pbo_access(dimensions, unpack, width, height, depth, format, type, pixels)) { const GLubyte *src = ADD_POINTERS(unpack->BufferObj->Data, pixels); return _mesa_unpack_image(dimensions, width, height, depth, format, type, src, unpack); } /* bad access! */ return NULL; } /* * Allocate space for a display list instruction. * \param opcode - type of instruction * argcount - size in bytes of data required. * \return pointer to the usable data area (not including the internal * opcode). */ void * _mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz ) { Node *n, *newblock; GLuint count = 1 + (sz + sizeof(Node) - 1) / sizeof(Node); #ifdef DEBUG if (opcode < (int) OPCODE_EXT_0) { assert( count == InstSize[opcode] ); } #endif if (ctx->ListState.CurrentPos + count + 2 > BLOCK_SIZE) { /* This block is full. Allocate a new block and chain to it */ n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos; n[0].opcode = OPCODE_CONTINUE; newblock = (Node *) MALLOC( sizeof(Node) * BLOCK_SIZE ); if (!newblock) { _mesa_error( ctx, GL_OUT_OF_MEMORY, "Building display list" ); return NULL; } n[1].next = (Node *) newblock; ctx->ListState.CurrentBlock = newblock; ctx->ListState.CurrentPos = 0; } n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos; ctx->ListState.CurrentPos += count; n[0].opcode = (OpCode) opcode; return (void *)&n[1]; } /** * This function allows modules and drivers to get their own opcodes * for extending display list functionality. * \param ctx the rendering context * \param size number of bytes for storing the new display list command * \param execute function to execute the new display list command * \param destroy function to destroy the new display list command * \param print function to print the new display list command * \return the new opcode number or -1 if error */ GLint _mesa_alloc_opcode( GLcontext *ctx, GLuint size, void (*execute)( GLcontext *, void * ), void (*destroy)( GLcontext *, void * ), void (*print)( GLcontext *, void * ) ) { if (ctx->ListExt.NumOpcodes < MAX_DLIST_EXT_OPCODES) { const GLuint i = ctx->ListExt.NumOpcodes++; ctx->ListExt.Opcode[i].Size = 1 + (size + sizeof(Node) - 1)/sizeof(Node); ctx->ListExt.Opcode[i].Execute = execute; ctx->ListExt.Opcode[i].Destroy = destroy; ctx->ListExt.Opcode[i].Print = print; return i + OPCODE_EXT_0; } return -1; } /* Mimic the old behaviour of alloc_instruction: * - sz is in units of sizeof(Node) * - return value a pointer to sizeof(Node) before the actual * usable data area. */ #define ALLOC_INSTRUCTION(ctx, opcode, sz) \ ((Node *)_mesa_alloc_instruction(ctx, opcode, sz*sizeof(Node)) - 1) /* * Display List compilation functions */ static void GLAPIENTRY save_Accum( GLenum op, GLfloat value ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_ACCUM, 2 ); if (n) { n[1].e = op; n[2].f = value; } if (ctx->ExecuteFlag) { CALL_Accum(ctx->Exec, ( op, value )); } } static void GLAPIENTRY save_AlphaFunc( GLenum func, GLclampf ref ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_ALPHA_FUNC, 2 ); if (n) { n[1].e = func; n[2].f = (GLfloat) ref; } if (ctx->ExecuteFlag) { CALL_AlphaFunc(ctx->Exec, ( func, ref )); } } static void GLAPIENTRY save_BindTexture( GLenum target, GLuint texture ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_BIND_TEXTURE, 2 ); if (n) { n[1].e = target; n[2].ui = texture; } if (ctx->ExecuteFlag) { CALL_BindTexture(ctx->Exec, ( target, texture )); } } static void GLAPIENTRY save_Bitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *pixels ) { GET_CURRENT_CONTEXT(ctx); GLvoid *image = _mesa_unpack_bitmap( width, height, pixels, &ctx->Unpack ); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_BITMAP, 7 ); if (n) { n[1].i = (GLint) width; n[2].i = (GLint) height; n[3].f = xorig; n[4].f = yorig; n[5].f = xmove; n[6].f = ymove; n[7].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_Bitmap(ctx->Exec, ( width, height, xorig, yorig, xmove, ymove, pixels )); } } static void GLAPIENTRY save_BlendEquation( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_EQUATION, 1 ); if (n) { n[1].e = mode; } if (ctx->ExecuteFlag) { CALL_BlendEquation(ctx->Exec, ( mode )); } } static void GLAPIENTRY save_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2 ); if (n) { n[1].e = modeRGB; n[2].e = modeA; } if (ctx->ExecuteFlag) { CALL_BlendEquationSeparateEXT(ctx->Exec, ( modeRGB, modeA )); } } static void GLAPIENTRY save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_FUNC_SEPARATE, 4 ); if (n) { n[1].e = sfactorRGB; n[2].e = dfactorRGB; n[3].e = sfactorA; n[4].e = dfactorA; } if (ctx->ExecuteFlag) { CALL_BlendFuncSeparateEXT(ctx->Exec, (sfactorRGB, dfactorRGB, sfactorA, dfactorA)); } } static void GLAPIENTRY save_BlendColor( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_COLOR, 4 ); if (n) { n[1].f = red; n[2].f = green; n[3].f = blue; n[4].f = alpha; } if (ctx->ExecuteFlag) { CALL_BlendColor(ctx->Exec, ( red, green, blue, alpha )); } } void GLAPIENTRY _mesa_save_CallList( GLuint list ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CALL_LIST, 1 ); if (n) { n[1].ui = list; } /* After this, we don't know what begin/end state we're in: */ ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; if (ctx->ExecuteFlag) { CALL_CallList(ctx->Exec, ( list )); } } void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) { GET_CURRENT_CONTEXT(ctx); GLint i; GLboolean typeErrorFlag; SAVE_FLUSH_VERTICES(ctx); switch (type) { case GL_BYTE: case GL_UNSIGNED_BYTE: case GL_SHORT: case GL_UNSIGNED_SHORT: case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: case GL_2_BYTES: case GL_3_BYTES: case GL_4_BYTES: typeErrorFlag = GL_FALSE; break; default: typeErrorFlag = GL_TRUE; } for (i=0;iDriver.CurrentSavePrimitive = PRIM_UNKNOWN; if (ctx->ExecuteFlag) { CALL_CallLists(ctx->Exec, ( n, type, lists )); } } static void GLAPIENTRY save_Clear( GLbitfield mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR, 1 ); if (n) { n[1].bf = mask; } if (ctx->ExecuteFlag) { CALL_Clear(ctx->Exec, ( mask )); } } static void GLAPIENTRY save_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_ACCUM, 4 ); if (n) { n[1].f = red; n[2].f = green; n[3].f = blue; n[4].f = alpha; } if (ctx->ExecuteFlag) { CALL_ClearAccum(ctx->Exec, ( red, green, blue, alpha )); } } static void GLAPIENTRY save_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_COLOR, 4 ); if (n) { n[1].f = red; n[2].f = green; n[3].f = blue; n[4].f = alpha; } if (ctx->ExecuteFlag) { CALL_ClearColor(ctx->Exec, ( red, green, blue, alpha )); } } static void GLAPIENTRY save_ClearDepth( GLclampd depth ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_DEPTH, 1 ); if (n) { n[1].f = (GLfloat) depth; } if (ctx->ExecuteFlag) { CALL_ClearDepth(ctx->Exec, ( depth )); } } static void GLAPIENTRY save_ClearIndex( GLfloat c ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_INDEX, 1 ); if (n) { n[1].f = c; } if (ctx->ExecuteFlag) { CALL_ClearIndex(ctx->Exec, ( c )); } } static void GLAPIENTRY save_ClearStencil( GLint s ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CLEAR_STENCIL, 1 ); if (n) { n[1].i = s; } if (ctx->ExecuteFlag) { CALL_ClearStencil(ctx->Exec, ( s )); } } static void GLAPIENTRY save_ClipPlane( GLenum plane, const GLdouble *equ ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CLIP_PLANE, 5 ); if (n) { n[1].e = plane; n[2].f = (GLfloat) equ[0]; n[3].f = (GLfloat) equ[1]; n[4].f = (GLfloat) equ[2]; n[5].f = (GLfloat) equ[3]; } if (ctx->ExecuteFlag) { CALL_ClipPlane(ctx->Exec, ( plane, equ )); } } static void GLAPIENTRY save_ColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_MASK, 4 ); if (n) { n[1].b = red; n[2].b = green; n[3].b = blue; n[4].b = alpha; } if (ctx->ExecuteFlag) { CALL_ColorMask(ctx->Exec, ( red, green, blue, alpha )); } } static void GLAPIENTRY save_ColorMaterial( GLenum face, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_MATERIAL, 2 ); if (n) { n[1].e = face; n[2].e = mode; } if (ctx->ExecuteFlag) { CALL_ColorMaterial(ctx->Exec, ( face, mode )); } } static void GLAPIENTRY save_ColorTable( GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table ) { GET_CURRENT_CONTEXT(ctx); if (target == GL_PROXY_TEXTURE_1D || target == GL_PROXY_TEXTURE_2D || target == GL_PROXY_TEXTURE_3D || target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) { /* execute immediately */ CALL_ColorTable(ctx->Exec, ( target, internalFormat, width, format, type, table )); } else { GLvoid *image = unpack_image(1, width, 1, 1, format, type, table, &ctx->Unpack); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE, 6 ); if (n) { n[1].e = target; n[2].e = internalFormat; n[3].i = width; n[4].e = format; n[5].e = type; n[6].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_ColorTable(ctx->Exec, ( target, internalFormat, width, format, type, table )); } } } static void GLAPIENTRY save_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6 ); if (n) { n[1].e = target; n[2].e = pname; n[3].f = params[0]; if (pname == GL_COLOR_TABLE_SGI || pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI || pname == GL_TEXTURE_COLOR_TABLE_SGI) { n[4].f = params[1]; n[5].f = params[2]; n[6].f = params[3]; } } if (ctx->ExecuteFlag) { CALL_ColorTableParameterfv(ctx->Exec, ( target, pname, params )); } } static void GLAPIENTRY save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6 ); if (n) { n[1].e = target; n[2].e = pname; n[3].i = params[0]; if (pname == GL_COLOR_TABLE_SGI || pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI || pname == GL_TEXTURE_COLOR_TABLE_SGI) { n[4].i = params[1]; n[5].i = params[2]; n[6].i = params[3]; } } if (ctx->ExecuteFlag) { CALL_ColorTableParameteriv(ctx->Exec, ( target, pname, params )); } } static void GLAPIENTRY save_ColorSubTable( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table) { GET_CURRENT_CONTEXT(ctx); GLvoid *image = unpack_image(1, count, 1, 1, format, type, table, &ctx->Unpack); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_SUB_TABLE, 6 ); if (n) { n[1].e = target; n[2].i = start; n[3].i = count; n[4].e = format; n[5].e = type; n[6].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_ColorSubTable(ctx->Exec, (target, start, count, format, type, table)); } } static void GLAPIENTRY save_CopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_COLOR_SUB_TABLE, 5 ); if (n) { n[1].e = target; n[2].i = start; n[3].i = x; n[4].i = y; n[5].i = width; } if (ctx->ExecuteFlag) { CALL_CopyColorSubTable(ctx->Exec, (target, start, x, y, width)); } } static void GLAPIENTRY save_CopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_COLOR_TABLE, 5 ); if (n) { n[1].e = target; n[2].e = internalformat; n[3].i = x; n[4].i = y; n[5].i = width; } if (ctx->ExecuteFlag) { CALL_CopyColorTable(ctx->Exec, (target, internalformat, x, y, width)); } } static void GLAPIENTRY save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *filter) { GET_CURRENT_CONTEXT(ctx); GLvoid *image = unpack_image(1, width, 1, 1, format, type, filter, &ctx->Unpack); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_FILTER_1D, 6 ); if (n) { n[1].e = target; n[2].e = internalFormat; n[3].i = width; n[4].e = format; n[5].e = type; n[6].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_ConvolutionFilter1D(ctx->Exec, ( target, internalFormat, width, format, type, filter )); } } static void GLAPIENTRY save_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *filter) { GET_CURRENT_CONTEXT(ctx); GLvoid *image = unpack_image(2, width, height, 1, format, type, filter, &ctx->Unpack); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_FILTER_2D, 7 ); if (n) { n[1].e = target; n[2].e = internalFormat; n[3].i = width; n[4].i = height; n[5].e = format; n[6].e = type; n[7].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_ConvolutionFilter2D(ctx->Exec, ( target, internalFormat, width, height, format, type, filter )); } } static void GLAPIENTRY save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3 ); if (n) { n[1].e = target; n[2].e = pname; n[3].i = param; } if (ctx->ExecuteFlag) { CALL_ConvolutionParameteri(ctx->Exec, ( target, pname, param )); } } static void GLAPIENTRY save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6 ); if (n) { n[1].e = target; n[2].e = pname; n[3].i = params[0]; if (pname == GL_CONVOLUTION_BORDER_COLOR || pname == GL_CONVOLUTION_FILTER_SCALE || pname == GL_CONVOLUTION_FILTER_BIAS) { n[4].i = params[1]; n[5].i = params[2]; n[6].i = params[3]; } else { n[4].i = n[5].i = n[6].i = 0; } } if (ctx->ExecuteFlag) { CALL_ConvolutionParameteriv(ctx->Exec, ( target, pname, params )); } } static void GLAPIENTRY save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3 ); if (n) { n[1].e = target; n[2].e = pname; n[3].f = param; } if (ctx->ExecuteFlag) { CALL_ConvolutionParameterf(ctx->Exec, ( target, pname, param )); } } static void GLAPIENTRY save_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_FV, 6 ); if (n) { n[1].e = target; n[2].e = pname; n[3].f = params[0]; if (pname == GL_CONVOLUTION_BORDER_COLOR || pname == GL_CONVOLUTION_FILTER_SCALE || pname == GL_CONVOLUTION_FILTER_BIAS) { n[4].f = params[1]; n[5].f = params[2]; n[6].f = params[3]; } else { n[4].f = n[5].f = n[6].f = 0.0F; } } if (ctx->ExecuteFlag) { CALL_ConvolutionParameterfv(ctx->Exec, ( target, pname, params )); } } static void GLAPIENTRY save_CopyPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_PIXELS, 5 ); if (n) { n[1].i = x; n[2].i = y; n[3].i = (GLint) width; n[4].i = (GLint) height; n[5].e = type; } if (ctx->ExecuteFlag) { CALL_CopyPixels(ctx->Exec, ( x, y, width, height, type )); } } static void GLAPIENTRY save_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_IMAGE1D, 7 ); if (n) { n[1].e = target; n[2].i = level; n[3].e = internalformat; n[4].i = x; n[5].i = y; n[6].i = width; n[7].i = border; } if (ctx->ExecuteFlag) { CALL_CopyTexImage1D(ctx->Exec, ( target, level, internalformat, x, y, width, border )); } } static void GLAPIENTRY save_CopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_IMAGE2D, 8 ); if (n) { n[1].e = target; n[2].i = level; n[3].e = internalformat; n[4].i = x; n[5].i = y; n[6].i = width; n[7].i = height; n[8].i = border; } if (ctx->ExecuteFlag) { CALL_CopyTexImage2D(ctx->Exec, ( target, level, internalformat, x, y, width, height, border )); } } static void GLAPIENTRY save_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6 ); if (n) { n[1].e = target; n[2].i = level; n[3].i = xoffset; n[4].i = x; n[5].i = y; n[6].i = width; } if (ctx->ExecuteFlag) { CALL_CopyTexSubImage1D(ctx->Exec, ( target, level, xoffset, x, y, width )); } } static void GLAPIENTRY save_CopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLint height ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8 ); if (n) { n[1].e = target; n[2].i = level; n[3].i = xoffset; n[4].i = yoffset; n[5].i = x; n[6].i = y; n[7].i = width; n[8].i = height; } if (ctx->ExecuteFlag) { CALL_CopyTexSubImage2D(ctx->Exec, ( target, level, xoffset, yoffset, x, y, width, height )); } } static void GLAPIENTRY save_CopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLint height ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9 ); if (n) { n[1].e = target; n[2].i = level; n[3].i = xoffset; n[4].i = yoffset; n[5].i = zoffset; n[6].i = x; n[7].i = y; n[8].i = width; n[9].i = height; } if (ctx->ExecuteFlag) { CALL_CopyTexSubImage3D(ctx->Exec, ( target, level, xoffset, yoffset, zoffset, x, y, width, height )); } } static void GLAPIENTRY save_CullFace( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CULL_FACE, 1 ); if (n) { n[1].e = mode; } if (ctx->ExecuteFlag) { CALL_CullFace(ctx->Exec, ( mode )); } } static void GLAPIENTRY save_DepthFunc( GLenum func ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_FUNC, 1 ); if (n) { n[1].e = func; } if (ctx->ExecuteFlag) { CALL_DepthFunc(ctx->Exec, ( func )); } } static void GLAPIENTRY save_DepthMask( GLboolean mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_MASK, 1 ); if (n) { n[1].b = mask; } if (ctx->ExecuteFlag) { CALL_DepthMask(ctx->Exec, ( mask )); } } static void GLAPIENTRY save_DepthRange( GLclampd nearval, GLclampd farval ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_RANGE, 2 ); if (n) { n[1].f = (GLfloat) nearval; n[2].f = (GLfloat) farval; } if (ctx->ExecuteFlag) { CALL_DepthRange(ctx->Exec, ( nearval, farval )); } } static void GLAPIENTRY save_Disable( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_DISABLE, 1 ); if (n) { n[1].e = cap; } if (ctx->ExecuteFlag) { CALL_Disable(ctx->Exec, ( cap )); } } static void GLAPIENTRY save_DrawBuffer( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_BUFFER, 1 ); if (n) { n[1].e = mode; } if (ctx->ExecuteFlag) { CALL_DrawBuffer(ctx->Exec, ( mode )); } } static void GLAPIENTRY save_DrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); GLvoid *image = unpack_image(2, width, height, 1, format, type, pixels, &ctx->Unpack); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_PIXELS, 5 ); if (n) { n[1].i = width; n[2].i = height; n[3].e = format; n[4].e = type; n[5].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_DrawPixels(ctx->Exec, ( width, height, format, type, pixels )); } } static void GLAPIENTRY save_Enable( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_ENABLE, 1 ); if (n) { n[1].e = cap; } if (ctx->ExecuteFlag) { CALL_Enable(ctx->Exec, ( cap )); } } void GLAPIENTRY _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_EVALMESH1, 3 ); if (n) { n[1].e = mode; n[2].i = i1; n[3].i = i2; } if (ctx->ExecuteFlag) { CALL_EvalMesh1(ctx->Exec, ( mode, i1, i2 )); } } void GLAPIENTRY _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_EVALMESH2, 5 ); if (n) { n[1].e = mode; n[2].i = i1; n[3].i = i2; n[4].i = j1; n[5].i = j2; } if (ctx->ExecuteFlag) { CALL_EvalMesh2(ctx->Exec, ( mode, i1, i2, j1, j2 )); } } static void GLAPIENTRY save_Fogfv( GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_FOG, 5 ); if (n) { n[1].e = pname; n[2].f = params[0]; n[3].f = params[1]; n[4].f = params[2]; n[5].f = params[3]; } if (ctx->ExecuteFlag) { CALL_Fogfv(ctx->Exec, ( pname, params )); } } static void GLAPIENTRY save_Fogf( GLenum pname, GLfloat param ) { save_Fogfv(pname, ¶m); } static void GLAPIENTRY save_Fogiv(GLenum pname, const GLint *params ) { GLfloat p[4]; switch (pname) { case GL_FOG_MODE: case GL_FOG_DENSITY: case GL_FOG_START: case GL_FOG_END: case GL_FOG_INDEX: p[0] = (GLfloat) *params; break; case GL_FOG_COLOR: p[0] = INT_TO_FLOAT( params[0] ); p[1] = INT_TO_FLOAT( params[1] ); p[2] = INT_TO_FLOAT( params[2] ); p[3] = INT_TO_FLOAT( params[3] ); break; default: /* Error will be caught later in gl_Fogfv */ ; } save_Fogfv(pname, p); } static void GLAPIENTRY save_Fogi(GLenum pname, GLint param ) { save_Fogiv(pname, ¶m); } static void GLAPIENTRY save_FrontFace( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_FRONT_FACE, 1 ); if (n) { n[1].e = mode; } if (ctx->ExecuteFlag) { CALL_FrontFace(ctx->Exec, ( mode )); } } static void GLAPIENTRY save_Frustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_FRUSTUM, 6 ); if (n) { n[1].f = (GLfloat) left; n[2].f = (GLfloat) right; n[3].f = (GLfloat) bottom; n[4].f = (GLfloat) top; n[5].f = (GLfloat) nearval; n[6].f = (GLfloat) farval; } if (ctx->ExecuteFlag) { CALL_Frustum(ctx->Exec, ( left, right, bottom, top, nearval, farval )); } } static void GLAPIENTRY save_Hint( GLenum target, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_HINT, 2 ); if (n) { n[1].e = target; n[2].e = mode; } if (ctx->ExecuteFlag) { CALL_Hint(ctx->Exec, ( target, mode )); } } static void GLAPIENTRY save_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_HISTOGRAM, 4 ); if (n) { n[1].e = target; n[2].i = width; n[3].e = internalFormat; n[4].b = sink; } if (ctx->ExecuteFlag) { CALL_Histogram(ctx->Exec, ( target, width, internalFormat, sink )); } } static void GLAPIENTRY save_IndexMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_INDEX_MASK, 1 ); if (n) { n[1].ui = mask; } if (ctx->ExecuteFlag) { CALL_IndexMask(ctx->Exec, ( mask )); } } static void GLAPIENTRY save_InitNames( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); (void) ALLOC_INSTRUCTION( ctx, OPCODE_INIT_NAMES, 0 ); if (ctx->ExecuteFlag) { CALL_InitNames(ctx->Exec, ()); } } static void GLAPIENTRY save_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LIGHT, 6 ); if (OPCODE_LIGHT) { GLint i, nParams; n[1].e = light; n[2].e = pname; switch (pname) { case GL_AMBIENT: nParams = 4; break; case GL_DIFFUSE: nParams = 4; break; case GL_SPECULAR: nParams = 4; break; case GL_POSITION: nParams = 4; break; case GL_SPOT_DIRECTION: nParams = 3; break; case GL_SPOT_EXPONENT: nParams = 1; break; case GL_SPOT_CUTOFF: nParams = 1; break; case GL_CONSTANT_ATTENUATION: nParams = 1; break; case GL_LINEAR_ATTENUATION: nParams = 1; break; case GL_QUADRATIC_ATTENUATION: nParams = 1; break; default: nParams = 0; } for (i = 0; i < nParams; i++) { n[3+i].f = params[i]; } } if (ctx->ExecuteFlag) { CALL_Lightfv(ctx->Exec, ( light, pname, params )); } } static void GLAPIENTRY save_Lightf( GLenum light, GLenum pname, GLfloat params ) { save_Lightfv(light, pname, ¶ms); } static void GLAPIENTRY save_Lightiv( GLenum light, GLenum pname, const GLint *params ) { GLfloat fparam[4]; switch (pname) { case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: fparam[0] = INT_TO_FLOAT( params[0] ); fparam[1] = INT_TO_FLOAT( params[1] ); fparam[2] = INT_TO_FLOAT( params[2] ); fparam[3] = INT_TO_FLOAT( params[3] ); break; case GL_POSITION: fparam[0] = (GLfloat) params[0]; fparam[1] = (GLfloat) params[1]; fparam[2] = (GLfloat) params[2]; fparam[3] = (GLfloat) params[3]; break; case GL_SPOT_DIRECTION: fparam[0] = (GLfloat) params[0]; fparam[1] = (GLfloat) params[1]; fparam[2] = (GLfloat) params[2]; break; case GL_SPOT_EXPONENT: case GL_SPOT_CUTOFF: case GL_CONSTANT_ATTENUATION: case GL_LINEAR_ATTENUATION: case GL_QUADRATIC_ATTENUATION: fparam[0] = (GLfloat) params[0]; break; default: /* error will be caught later in gl_Lightfv */ ; } save_Lightfv( light, pname, fparam ); } static void GLAPIENTRY save_Lighti( GLenum light, GLenum pname, GLint param ) { save_Lightiv( light, pname, ¶m ); } static void GLAPIENTRY save_LightModelfv( GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LIGHT_MODEL, 5 ); if (n) { n[1].e = pname; n[2].f = params[0]; n[3].f = params[1]; n[4].f = params[2]; n[5].f = params[3]; } if (ctx->ExecuteFlag) { CALL_LightModelfv(ctx->Exec, ( pname, params )); } } static void GLAPIENTRY save_LightModelf( GLenum pname, GLfloat param ) { save_LightModelfv(pname, ¶m); } static void GLAPIENTRY save_LightModeliv( GLenum pname, const GLint *params ) { GLfloat fparam[4]; switch (pname) { case GL_LIGHT_MODEL_AMBIENT: fparam[0] = INT_TO_FLOAT( params[0] ); fparam[1] = INT_TO_FLOAT( params[1] ); fparam[2] = INT_TO_FLOAT( params[2] ); fparam[3] = INT_TO_FLOAT( params[3] ); break; case GL_LIGHT_MODEL_LOCAL_VIEWER: case GL_LIGHT_MODEL_TWO_SIDE: case GL_LIGHT_MODEL_COLOR_CONTROL: fparam[0] = (GLfloat) params[0]; break; default: /* Error will be caught later in gl_LightModelfv */ ; } save_LightModelfv(pname, fparam); } static void GLAPIENTRY save_LightModeli( GLenum pname, GLint param ) { save_LightModeliv(pname, ¶m); } static void GLAPIENTRY save_LineStipple( GLint factor, GLushort pattern ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LINE_STIPPLE, 2 ); if (n) { n[1].i = factor; n[2].us = pattern; } if (ctx->ExecuteFlag) { CALL_LineStipple(ctx->Exec, ( factor, pattern )); } } static void GLAPIENTRY save_LineWidth( GLfloat width ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LINE_WIDTH, 1 ); if (n) { n[1].f = width; } if (ctx->ExecuteFlag) { CALL_LineWidth(ctx->Exec, ( width )); } } static void GLAPIENTRY save_ListBase( GLuint base ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LIST_BASE, 1 ); if (n) { n[1].ui = base; } if (ctx->ExecuteFlag) { CALL_ListBase(ctx->Exec, ( base )); } } static void GLAPIENTRY save_LoadIdentity( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); (void) ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_IDENTITY, 0 ); if (ctx->ExecuteFlag) { CALL_LoadIdentity(ctx->Exec, ()); } } static void GLAPIENTRY save_LoadMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_MATRIX, 16 ); if (n) { GLuint i; for (i=0;i<16;i++) { n[1+i].f = m[i]; } } if (ctx->ExecuteFlag) { CALL_LoadMatrixf(ctx->Exec, ( m )); } } static void GLAPIENTRY save_LoadMatrixd( const GLdouble *m ) { GLfloat f[16]; GLint i; for (i = 0; i < 16; i++) { f[i] = (GLfloat) m[i]; } save_LoadMatrixf(f); } static void GLAPIENTRY save_LoadName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_NAME, 1 ); if (n) { n[1].ui = name; } if (ctx->ExecuteFlag) { CALL_LoadName(ctx->Exec, ( name )); } } static void GLAPIENTRY save_LogicOp( GLenum opcode ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LOGIC_OP, 1 ); if (n) { n[1].e = opcode; } if (ctx->ExecuteFlag) { CALL_LogicOp(ctx->Exec, ( opcode )); } } static void GLAPIENTRY save_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP1, 6 ); if (n) { GLfloat *pnts = _mesa_copy_map_points1d( target, stride, order, points ); n[1].e = target; n[2].f = (GLfloat) u1; n[3].f = (GLfloat) u2; n[4].i = _mesa_evaluator_components(target); /* stride */ n[5].i = order; n[6].data = (void *) pnts; } if (ctx->ExecuteFlag) { CALL_Map1d(ctx->Exec, ( target, u1, u2, stride, order, points )); } } static void GLAPIENTRY save_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP1, 6 ); if (n) { GLfloat *pnts = _mesa_copy_map_points1f( target, stride, order, points ); n[1].e = target; n[2].f = u1; n[3].f = u2; n[4].i = _mesa_evaluator_components(target); /* stride */ n[5].i = order; n[6].data = (void *) pnts; } if (ctx->ExecuteFlag) { CALL_Map1f(ctx->Exec, ( target, u1, u2, stride, order, points )); } } static void GLAPIENTRY save_Map2d( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP2, 10 ); if (n) { GLfloat *pnts = _mesa_copy_map_points2d( target, ustride, uorder, vstride, vorder, points ); n[1].e = target; n[2].f = (GLfloat) u1; n[3].f = (GLfloat) u2; n[4].f = (GLfloat) v1; n[5].f = (GLfloat) v2; /* XXX verify these strides are correct */ n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride*/ n[7].i = _mesa_evaluator_components(target); /*vstride*/ n[8].i = uorder; n[9].i = vorder; n[10].data = (void *) pnts; } if (ctx->ExecuteFlag) { CALL_Map2d(ctx->Exec, ( target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points )); } } static void GLAPIENTRY save_Map2f( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP2, 10 ); if (n) { GLfloat *pnts = _mesa_copy_map_points2f( target, ustride, uorder, vstride, vorder, points ); n[1].e = target; n[2].f = u1; n[3].f = u2; n[4].f = v1; n[5].f = v2; /* XXX verify these strides are correct */ n[6].i = _mesa_evaluator_components(target) * vorder; /*ustride*/ n[7].i = _mesa_evaluator_components(target); /*vstride*/ n[8].i = uorder; n[9].i = vorder; n[10].data = (void *) pnts; } if (ctx->ExecuteFlag) { CALL_Map2f(ctx->Exec, ( target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points )); } } static void GLAPIENTRY save_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MAPGRID1, 3 ); if (n) { n[1].i = un; n[2].f = u1; n[3].f = u2; } if (ctx->ExecuteFlag) { CALL_MapGrid1f(ctx->Exec, ( un, u1, u2 )); } } static void GLAPIENTRY save_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ) { save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2); } static void GLAPIENTRY save_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MAPGRID2, 6 ); if (n) { n[1].i = un; n[2].f = u1; n[3].f = u2; n[4].i = vn; n[5].f = v1; n[6].f = v2; } if (ctx->ExecuteFlag) { CALL_MapGrid2f(ctx->Exec, ( un, u1, u2, vn, v1, v2 )); } } static void GLAPIENTRY save_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ) { save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2, vn, (GLfloat) v1, (GLfloat) v2); } static void GLAPIENTRY save_MatrixMode( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MATRIX_MODE, 1 ); if (n) { n[1].e = mode; } if (ctx->ExecuteFlag) { CALL_MatrixMode(ctx->Exec, ( mode )); } } static void GLAPIENTRY save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MIN_MAX, 3 ); if (n) { n[1].e = target; n[2].e = internalFormat; n[3].b = sink; } if (ctx->ExecuteFlag) { CALL_Minmax(ctx->Exec, ( target, internalFormat, sink )); } } static void GLAPIENTRY save_MultMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MULT_MATRIX, 16 ); if (n) { GLuint i; for (i=0;i<16;i++) { n[1+i].f = m[i]; } } if (ctx->ExecuteFlag) { CALL_MultMatrixf(ctx->Exec, ( m )); } } static void GLAPIENTRY save_MultMatrixd( const GLdouble *m ) { GLfloat f[16]; GLint i; for (i = 0; i < 16; i++) { f[i] = (GLfloat) m[i]; } save_MultMatrixf(f); } static void GLAPIENTRY save_NewList( GLuint list, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); /* It's an error to call this function while building a display list */ _mesa_error( ctx, GL_INVALID_OPERATION, "glNewList" ); (void) list; (void) mode; } static void GLAPIENTRY save_Ortho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_ORTHO, 6 ); if (n) { n[1].f = (GLfloat) left; n[2].f = (GLfloat) right; n[3].f = (GLfloat) bottom; n[4].f = (GLfloat) top; n[5].f = (GLfloat) nearval; n[6].f = (GLfloat) farval; } if (ctx->ExecuteFlag) { CALL_Ortho(ctx->Exec, ( left, right, bottom, top, nearval, farval )); } } static void GLAPIENTRY save_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_MAP, 3 ); if (n) { n[1].e = map; n[2].i = mapsize; n[3].data = (void *) MALLOC( mapsize * sizeof(GLfloat) ); MEMCPY( n[3].data, (void *) values, mapsize * sizeof(GLfloat) ); } if (ctx->ExecuteFlag) { CALL_PixelMapfv(ctx->Exec, ( map, mapsize, values )); } } static void GLAPIENTRY save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values ) { GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; GLint i; if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) { for (i=0;iExecuteFlag) { CALL_PixelTransferf(ctx->Exec, ( pname, param )); } } static void GLAPIENTRY save_PixelTransferi( GLenum pname, GLint param ) { save_PixelTransferf( pname, (GLfloat) param ); } static void GLAPIENTRY save_PixelZoom( GLfloat xfactor, GLfloat yfactor ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_ZOOM, 2 ); if (n) { n[1].f = xfactor; n[2].f = yfactor; } if (ctx->ExecuteFlag) { CALL_PixelZoom(ctx->Exec, ( xfactor, yfactor )); } } static void GLAPIENTRY save_PointParameterfvEXT( GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_POINT_PARAMETERS, 4 ); if (n) { n[1].e = pname; n[2].f = params[0]; n[3].f = params[1]; n[4].f = params[2]; } if (ctx->ExecuteFlag) { CALL_PointParameterfvEXT(ctx->Exec, ( pname, params )); } } static void GLAPIENTRY save_PointParameterfEXT( GLenum pname, GLfloat param ) { save_PointParameterfvEXT(pname, ¶m); } static void GLAPIENTRY save_PointParameteriNV( GLenum pname, GLint param ) { GLfloat p = (GLfloat) param; save_PointParameterfvEXT(pname, &p); } static void GLAPIENTRY save_PointParameterivNV( GLenum pname, const GLint *param ) { GLfloat p = (GLfloat) param[0]; save_PointParameterfvEXT(pname, &p); } static void GLAPIENTRY save_PointSize( GLfloat size ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_POINT_SIZE, 1 ); if (n) { n[1].f = size; } if (ctx->ExecuteFlag) { CALL_PointSize(ctx->Exec, ( size )); } } static void GLAPIENTRY save_PolygonMode( GLenum face, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_MODE, 2 ); if (n) { n[1].e = face; n[2].e = mode; } if (ctx->ExecuteFlag) { CALL_PolygonMode(ctx->Exec, ( face, mode )); } } /* * Polygon stipple must have been upacked already! */ static void GLAPIENTRY save_PolygonStipple( const GLubyte *pattern ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_STIPPLE, 1 ); if (n) { void *data; n[1].data = MALLOC( 32 * 4 ); data = n[1].data; /* This needed for Acorn compiler */ MEMCPY( data, pattern, 32 * 4 ); } if (ctx->ExecuteFlag) { CALL_PolygonStipple(ctx->Exec, ( (GLubyte*) pattern )); } } static void GLAPIENTRY save_PolygonOffset( GLfloat factor, GLfloat units ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_OFFSET, 2 ); if (n) { n[1].f = factor; n[2].f = units; } if (ctx->ExecuteFlag) { CALL_PolygonOffset(ctx->Exec, ( factor, units )); } } static void GLAPIENTRY save_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) { GET_CURRENT_CONTEXT(ctx); /* XXX mult by DepthMaxF here??? */ save_PolygonOffset(factor, ctx->DrawBuffer->_DepthMaxF * bias); } static void GLAPIENTRY save_PopAttrib( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); (void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_ATTRIB, 0 ); if (ctx->ExecuteFlag) { CALL_PopAttrib(ctx->Exec, ()); } } static void GLAPIENTRY save_PopMatrix( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); (void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_MATRIX, 0 ); if (ctx->ExecuteFlag) { CALL_PopMatrix(ctx->Exec, ()); } } static void GLAPIENTRY save_PopName( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); (void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_NAME, 0 ); if (ctx->ExecuteFlag) { CALL_PopName(ctx->Exec, ()); } } static void GLAPIENTRY save_PrioritizeTextures( GLsizei num, const GLuint *textures, const GLclampf *priorities ) { GET_CURRENT_CONTEXT(ctx); GLint i; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); for (i=0;iExecuteFlag) { CALL_PrioritizeTextures(ctx->Exec, ( num, textures, priorities )); } } static void GLAPIENTRY save_PushAttrib( GLbitfield mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_ATTRIB, 1 ); if (n) { n[1].bf = mask; } if (ctx->ExecuteFlag) { CALL_PushAttrib(ctx->Exec, ( mask )); } } static void GLAPIENTRY save_PushMatrix( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); (void) ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_MATRIX, 0 ); if (ctx->ExecuteFlag) { CALL_PushMatrix(ctx->Exec, ()); } } static void GLAPIENTRY save_PushName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_NAME, 1 ); if (n) { n[1].ui = name; } if (ctx->ExecuteFlag) { CALL_PushName(ctx->Exec, ( name )); } } static void GLAPIENTRY save_RasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_RASTER_POS, 4 ); if (n) { n[1].f = x; n[2].f = y; n[3].f = z; n[4].f = w; } if (ctx->ExecuteFlag) { CALL_RasterPos4f(ctx->Exec, ( x, y, z, w )); } } static void GLAPIENTRY save_RasterPos2d(GLdouble x, GLdouble y) { save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } static void GLAPIENTRY save_RasterPos2f(GLfloat x, GLfloat y) { save_RasterPos4f(x, y, 0.0F, 1.0F); } static void GLAPIENTRY save_RasterPos2i(GLint x, GLint y) { save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } static void GLAPIENTRY save_RasterPos2s(GLshort x, GLshort y) { save_RasterPos4f(x, y, 0.0F, 1.0F); } static void GLAPIENTRY save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) { save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } static void GLAPIENTRY save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) { save_RasterPos4f(x, y, z, 1.0F); } static void GLAPIENTRY save_RasterPos3i(GLint x, GLint y, GLint z) { save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } static void GLAPIENTRY save_RasterPos3s(GLshort x, GLshort y, GLshort z) { save_RasterPos4f(x, y, z, 1.0F); } static void GLAPIENTRY save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } static void GLAPIENTRY save_RasterPos4i(GLint x, GLint y, GLint z, GLint w) { save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } static void GLAPIENTRY save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) { save_RasterPos4f(x, y, z, w); } static void GLAPIENTRY save_RasterPos2dv(const GLdouble *v) { save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } static void GLAPIENTRY save_RasterPos2fv(const GLfloat *v) { save_RasterPos4f(v[0], v[1], 0.0F, 1.0F); } static void GLAPIENTRY save_RasterPos2iv(const GLint *v) { save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } static void GLAPIENTRY save_RasterPos2sv(const GLshort *v) { save_RasterPos4f(v[0], v[1], 0.0F, 1.0F); } static void GLAPIENTRY save_RasterPos3dv(const GLdouble *v) { save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } static void GLAPIENTRY save_RasterPos3fv(const GLfloat *v) { save_RasterPos4f(v[0], v[1], v[2], 1.0F); } static void GLAPIENTRY save_RasterPos3iv(const GLint *v) { save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } static void GLAPIENTRY save_RasterPos3sv(const GLshort *v) { save_RasterPos4f(v[0], v[1], v[2], 1.0F); } static void GLAPIENTRY save_RasterPos4dv(const GLdouble *v) { save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void GLAPIENTRY save_RasterPos4fv(const GLfloat *v) { save_RasterPos4f(v[0], v[1], v[2], v[3]); } static void GLAPIENTRY save_RasterPos4iv(const GLint *v) { save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void GLAPIENTRY save_RasterPos4sv(const GLshort *v) { save_RasterPos4f(v[0], v[1], v[2], v[3]); } static void GLAPIENTRY save_PassThrough( GLfloat token ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PASSTHROUGH, 1 ); if (n) { n[1].f = token; } if (ctx->ExecuteFlag) { CALL_PassThrough(ctx->Exec, ( token )); } } static void GLAPIENTRY save_ReadBuffer( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_READ_BUFFER, 1 ); if (n) { n[1].e = mode; } if (ctx->ExecuteFlag) { CALL_ReadBuffer(ctx->Exec, ( mode )); } } static void GLAPIENTRY save_ResetHistogram(GLenum target) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_RESET_HISTOGRAM, 1 ); if (n) { n[1].e = target; } if (ctx->ExecuteFlag) { CALL_ResetHistogram(ctx->Exec, ( target )); } } static void GLAPIENTRY save_ResetMinmax(GLenum target) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_RESET_MIN_MAX, 1 ); if (n) { n[1].e = target; } if (ctx->ExecuteFlag) { CALL_ResetMinmax(ctx->Exec, ( target )); } } static void GLAPIENTRY save_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_ROTATE, 4 ); if (n) { n[1].f = angle; n[2].f = x; n[3].f = y; n[4].f = z; } if (ctx->ExecuteFlag) { CALL_Rotatef(ctx->Exec, ( angle, x, y, z )); } } static void GLAPIENTRY save_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) { save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z); } static void GLAPIENTRY save_Scalef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_SCALE, 3 ); if (n) { n[1].f = x; n[2].f = y; n[3].f = z; } if (ctx->ExecuteFlag) { CALL_Scalef(ctx->Exec, ( x, y, z )); } } static void GLAPIENTRY save_Scaled( GLdouble x, GLdouble y, GLdouble z ) { save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z); } static void GLAPIENTRY save_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_SCISSOR, 4 ); if (n) { n[1].i = x; n[2].i = y; n[3].i = width; n[4].i = height; } if (ctx->ExecuteFlag) { CALL_Scissor(ctx->Exec, ( x, y, width, height )); } } static void GLAPIENTRY save_ShadeModel( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_SHADE_MODEL, 1 ); if (n) { n[1].e = mode; } if (ctx->ExecuteFlag) { CALL_ShadeModel(ctx->Exec, ( mode )); } } static void GLAPIENTRY save_StencilFunc( GLenum func, GLint ref, GLuint mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_FUNC, 3 ); if (n) { n[1].e = func; n[2].i = ref; n[3].ui = mask; } if (ctx->ExecuteFlag) { CALL_StencilFunc(ctx->Exec, ( func, ref, mask )); } } static void GLAPIENTRY save_StencilMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_MASK, 1 ); if (n) { n[1].ui = mask; } if (ctx->ExecuteFlag) { CALL_StencilMask(ctx->Exec, ( mask )); } } static void GLAPIENTRY save_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_OP, 3 ); if (n) { n[1].e = fail; n[2].e = zfail; n[3].e = zpass; } if (ctx->ExecuteFlag) { CALL_StencilOp(ctx->Exec, ( fail, zfail, zpass )); } } static void GLAPIENTRY save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4); if (n) { n[1].e = face; n[2].e = func; n[3].i = ref; n[4].ui = mask; } if (ctx->ExecuteFlag) { CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask)); } } static void GLAPIENTRY save_StencilMaskSeparate(GLenum face, GLuint mask) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2); if (n) { n[1].e = face; n[2].ui = mask; } if (ctx->ExecuteFlag) { CALL_StencilMaskSeparate(ctx->Exec, (face, mask)); } } static void GLAPIENTRY save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_OP_SEPARATE, 4 ); if (n) { n[1].e = face; n[2].e = fail; n[3].e = zfail; n[4].e = zpass; } if (ctx->ExecuteFlag) { CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass)); } } static void GLAPIENTRY save_TexEnvfv( GLenum target, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXENV, 6 ); if (n) { n[1].e = target; n[2].e = pname; if (pname == GL_TEXTURE_ENV_COLOR) { n[3].f = params[0]; n[4].f = params[1]; n[5].f = params[2]; n[6].f = params[3]; } else { n[3].f = params[0]; n[4].f = n[5].f = n[6].f = 0.0F; } } if (ctx->ExecuteFlag) { CALL_TexEnvfv(ctx->Exec, ( target, pname, params )); } } static void GLAPIENTRY save_TexEnvf( GLenum target, GLenum pname, GLfloat param ) { save_TexEnvfv( target, pname, ¶m ); } static void GLAPIENTRY save_TexEnvi( GLenum target, GLenum pname, GLint param ) { GLfloat p[4]; p[0] = (GLfloat) param; p[1] = p[2] = p[3] = 0.0; save_TexEnvfv( target, pname, p ); } static void GLAPIENTRY save_TexEnviv( GLenum target, GLenum pname, const GLint *param ) { GLfloat p[4]; if (pname == GL_TEXTURE_ENV_COLOR) { p[0] = INT_TO_FLOAT( param[0] ); p[1] = INT_TO_FLOAT( param[1] ); p[2] = INT_TO_FLOAT( param[2] ); p[3] = INT_TO_FLOAT( param[3] ); } else { p[0] = (GLfloat) param[0]; p[1] = p[2] = p[3] = 0.0F; } save_TexEnvfv( target, pname, p ); } static void GLAPIENTRY save_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXGEN, 6 ); if (n) { n[1].e = coord; n[2].e = pname; n[3].f = params[0]; n[4].f = params[1]; n[5].f = params[2]; n[6].f = params[3]; } if (ctx->ExecuteFlag) { CALL_TexGenfv(ctx->Exec, ( coord, pname, params )); } } static void GLAPIENTRY save_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) { GLfloat p[4]; p[0] = (GLfloat) params[0]; p[1] = (GLfloat) params[1]; p[2] = (GLfloat) params[2]; p[3] = (GLfloat) params[3]; save_TexGenfv(coord, pname, p); } static void GLAPIENTRY save_TexGend(GLenum coord, GLenum pname, GLdouble param ) { GLfloat p = (GLfloat) param; save_TexGenfv( coord, pname, &p ); } static void GLAPIENTRY save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) { GLfloat p[4]; p[0] = (GLfloat) params[0]; p[1] = (GLfloat) params[1]; p[2] = (GLfloat) params[2]; p[3] = (GLfloat) params[3]; save_TexGenfv( coord, pname, p ); } static void GLAPIENTRY save_TexGenf( GLenum coord, GLenum pname, GLfloat param ) { save_TexGenfv(coord, pname, ¶m); } static void GLAPIENTRY save_TexGeni( GLenum coord, GLenum pname, GLint param ) { save_TexGeniv( coord, pname, ¶m ); } static void GLAPIENTRY save_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXPARAMETER, 6 ); if (n) { n[1].e = target; n[2].e = pname; n[3].f = params[0]; n[4].f = params[1]; n[5].f = params[2]; n[6].f = params[3]; } if (ctx->ExecuteFlag) { CALL_TexParameterfv(ctx->Exec, ( target, pname, params )); } } static void GLAPIENTRY save_TexParameterf( GLenum target, GLenum pname, GLfloat param ) { save_TexParameterfv(target, pname, ¶m); } static void GLAPIENTRY save_TexParameteri( GLenum target, GLenum pname, GLint param ) { GLfloat fparam[4]; fparam[0] = (GLfloat) param; fparam[1] = fparam[2] = fparam[3] = 0.0; save_TexParameterfv(target, pname, fparam); } static void GLAPIENTRY save_TexParameteriv( GLenum target, GLenum pname, const GLint *params ) { GLfloat fparam[4]; fparam[0] = (GLfloat) params[0]; fparam[1] = fparam[2] = fparam[3] = 0.0; save_TexParameterfv(target, pname, fparam); } static void GLAPIENTRY save_TexImage1D( GLenum target, GLint level, GLint components, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); if (target == GL_PROXY_TEXTURE_1D) { /* don't compile, execute immediately */ CALL_TexImage1D(ctx->Exec, ( target, level, components, width, border, format, type, pixels )); } else { GLvoid *image = unpack_image(1, width, 1, 1, format, type, pixels, &ctx->Unpack); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE1D, 8 ); if (n) { n[1].e = target; n[2].i = level; n[3].i = components; n[4].i = (GLint) width; n[5].i = border; n[6].e = format; n[7].e = type; n[8].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_TexImage1D(ctx->Exec, ( target, level, components, width, border, format, type, pixels )); } } } static void GLAPIENTRY save_TexImage2D( GLenum target, GLint level, GLint components, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) { GET_CURRENT_CONTEXT(ctx); if (target == GL_PROXY_TEXTURE_2D) { /* don't compile, execute immediately */ CALL_TexImage2D(ctx->Exec, ( target, level, components, width, height, border, format, type, pixels )); } else { GLvoid *image = unpack_image(2, width, height, 1, format, type, pixels, &ctx->Unpack); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE2D, 9 ); if (n) { n[1].e = target; n[2].i = level; n[3].i = components; n[4].i = (GLint) width; n[5].i = (GLint) height; n[6].i = border; n[7].e = format; n[8].e = type; n[9].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_TexImage2D(ctx->Exec, ( target, level, components, width, height, border, format, type, pixels )); } } } static void GLAPIENTRY save_TexImage3D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); if (target == GL_PROXY_TEXTURE_3D) { /* don't compile, execute immediately */ CALL_TexImage3D(ctx->Exec, ( target, level, internalFormat, width, height, depth, border, format, type, pixels )); } else { Node *n; GLvoid *image = unpack_image(3, width, height, depth, format, type, pixels, &ctx->Unpack); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE3D, 10 ); if (n) { n[1].e = target; n[2].i = level; n[3].i = (GLint) internalFormat; n[4].i = (GLint) width; n[5].i = (GLint) height; n[6].i = (GLint) depth; n[7].i = border; n[8].e = format; n[9].e = type; n[10].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_TexImage3D(ctx->Exec, ( target, level, internalFormat, width, height, depth, border, format, type, pixels )); } } } static void GLAPIENTRY save_TexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); Node *n; GLvoid *image = unpack_image(1, width, 1, 1, format, type, pixels, &ctx->Unpack); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE1D, 7 ); if (n) { n[1].e = target; n[2].i = level; n[3].i = xoffset; n[4].i = (GLint) width; n[5].e = format; n[6].e = type; n[7].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_TexSubImage1D(ctx->Exec, ( target, level, xoffset, width, format, type, pixels )); } } static void GLAPIENTRY save_TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); Node *n; GLvoid *image = unpack_image(2, width, height, 1, format, type, pixels, &ctx->Unpack); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE2D, 9 ); if (n) { n[1].e = target; n[2].i = level; n[3].i = xoffset; n[4].i = yoffset; n[5].i = (GLint) width; n[6].i = (GLint) height; n[7].e = format; n[8].e = type; n[9].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_TexSubImage2D(ctx->Exec, ( target, level, xoffset, yoffset, width, height, format, type, pixels )); } } static void GLAPIENTRY save_TexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset,GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); Node *n; GLvoid *image = unpack_image(3, width, height, depth, format, type, pixels, &ctx->Unpack); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE3D, 11 ); if (n) { n[1].e = target; n[2].i = level; n[3].i = xoffset; n[4].i = yoffset; n[5].i = zoffset; n[6].i = (GLint) width; n[7].i = (GLint) height; n[8].i = (GLint) depth; n[9].e = format; n[10].e = type; n[11].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_TexSubImage3D(ctx->Exec, ( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels )); } } static void GLAPIENTRY save_Translatef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TRANSLATE, 3 ); if (n) { n[1].f = x; n[2].f = y; n[3].f = z; } if (ctx->ExecuteFlag) { CALL_Translatef(ctx->Exec, ( x, y, z )); } } static void GLAPIENTRY save_Translated( GLdouble x, GLdouble y, GLdouble z ) { save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z); } static void GLAPIENTRY save_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_VIEWPORT, 4 ); if (n) { n[1].i = x; n[2].i = y; n[3].i = (GLint) width; n[4].i = (GLint) height; } if (ctx->ExecuteFlag) { CALL_Viewport(ctx->Exec, ( x, y, width, height )); } } static void GLAPIENTRY save_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_WINDOW_POS, 4 ); if (n) { n[1].f = x; n[2].f = y; n[3].f = z; n[4].f = w; } if (ctx->ExecuteFlag) { CALL_WindowPos4fMESA(ctx->Exec, ( x, y, z, w )); } } static void GLAPIENTRY save_WindowPos2dMESA(GLdouble x, GLdouble y) { save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } static void GLAPIENTRY save_WindowPos2fMESA(GLfloat x, GLfloat y) { save_WindowPos4fMESA(x, y, 0.0F, 1.0F); } static void GLAPIENTRY save_WindowPos2iMESA(GLint x, GLint y) { save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } static void GLAPIENTRY save_WindowPos2sMESA(GLshort x, GLshort y) { save_WindowPos4fMESA(x, y, 0.0F, 1.0F); } static void GLAPIENTRY save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) { save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } static void GLAPIENTRY save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) { save_WindowPos4fMESA(x, y, z, 1.0F); } static void GLAPIENTRY save_WindowPos3iMESA(GLint x, GLint y, GLint z) { save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } static void GLAPIENTRY save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) { save_WindowPos4fMESA(x, y, z, 1.0F); } static void GLAPIENTRY save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } static void GLAPIENTRY save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) { save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } static void GLAPIENTRY save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) { save_WindowPos4fMESA(x, y, z, w); } static void GLAPIENTRY save_WindowPos2dvMESA(const GLdouble *v) { save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } static void GLAPIENTRY save_WindowPos2fvMESA(const GLfloat *v) { save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); } static void GLAPIENTRY save_WindowPos2ivMESA(const GLint *v) { save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } static void GLAPIENTRY save_WindowPos2svMESA(const GLshort *v) { save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); } static void GLAPIENTRY save_WindowPos3dvMESA(const GLdouble *v) { save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } static void GLAPIENTRY save_WindowPos3fvMESA(const GLfloat *v) { save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); } static void GLAPIENTRY save_WindowPos3ivMESA(const GLint *v) { save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } static void GLAPIENTRY save_WindowPos3svMESA(const GLshort *v) { save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); } static void GLAPIENTRY save_WindowPos4dvMESA(const GLdouble *v) { save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void GLAPIENTRY save_WindowPos4fvMESA(const GLfloat *v) { save_WindowPos4fMESA(v[0], v[1], v[2], v[3]); } static void GLAPIENTRY save_WindowPos4ivMESA(const GLint *v) { save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } static void GLAPIENTRY save_WindowPos4svMESA(const GLshort *v) { save_WindowPos4fMESA(v[0], v[1], v[2], v[3]); } /* GL_ARB_multitexture */ static void GLAPIENTRY save_ActiveTextureARB( GLenum target ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_TEXTURE, 1 ); if (n) { n[1].e = target; } if (ctx->ExecuteFlag) { CALL_ActiveTextureARB(ctx->Exec, ( target )); } } /* GL_ARB_transpose_matrix */ static void GLAPIENTRY save_LoadTransposeMatrixdARB( const GLdouble m[16] ) { GLfloat tm[16]; _math_transposefd(tm, m); save_LoadMatrixf(tm); } static void GLAPIENTRY save_LoadTransposeMatrixfARB( const GLfloat m[16] ) { GLfloat tm[16]; _math_transposef(tm, m); save_LoadMatrixf(tm); } static void GLAPIENTRY save_MultTransposeMatrixdARB( const GLdouble m[16] ) { GLfloat tm[16]; _math_transposefd(tm, m); save_MultMatrixf(tm); } static void GLAPIENTRY save_MultTransposeMatrixfARB( const GLfloat m[16] ) { GLfloat tm[16]; _math_transposef(tm, m); save_MultMatrixf(tm); } static void GLAPIENTRY save_PixelTexGenSGIX(GLenum mode) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_SGIX, 1 ); if (n) { n[1].e = mode; } if (ctx->ExecuteFlag) { CALL_PixelTexGenSGIX(ctx->Exec, ( mode )); } } /* GL_ARB_texture_compression */ static void GLAPIENTRY save_CompressedTexImage1DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data) { GET_CURRENT_CONTEXT(ctx); if (target == GL_PROXY_TEXTURE_1D) { /* don't compile, execute immediately */ CALL_CompressedTexImage1DARB(ctx->Exec, (target, level, internalFormat, width, border, imageSize, data)); } else { Node *n; GLvoid *image; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ image = MALLOC(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB"); return; } MEMCPY(image, data, imageSize); n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7 ); if (n) { n[1].e = target; n[2].i = level; n[3].e = internalFormat; n[4].i = (GLint) width; n[5].i = border; n[6].i = imageSize; n[7].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexImage1DARB(ctx->Exec, (target, level, internalFormat, width, border, imageSize, data)); } } } static void GLAPIENTRY save_CompressedTexImage2DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) { GET_CURRENT_CONTEXT(ctx); if (target == GL_PROXY_TEXTURE_2D) { /* don't compile, execute immediately */ CALL_CompressedTexImage2DARB(ctx->Exec, (target, level, internalFormat, width, height, border, imageSize, data)); } else { Node *n; GLvoid *image; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ image = MALLOC(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); return; } MEMCPY(image, data, imageSize); n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8 ); if (n) { n[1].e = target; n[2].i = level; n[3].e = internalFormat; n[4].i = (GLint) width; n[5].i = (GLint) height; n[6].i = border; n[7].i = imageSize; n[8].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexImage2DARB(ctx->Exec, (target, level, internalFormat, width, height, border, imageSize, data)); } } } static void GLAPIENTRY save_CompressedTexImage3DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data) { GET_CURRENT_CONTEXT(ctx); if (target == GL_PROXY_TEXTURE_3D) { /* don't compile, execute immediately */ CALL_CompressedTexImage3DARB(ctx->Exec, (target, level, internalFormat, width, height, depth, border, imageSize, data)); } else { Node *n; GLvoid *image; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ image = MALLOC(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB"); return; } MEMCPY(image, data, imageSize); n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9 ); if (n) { n[1].e = target; n[2].i = level; n[3].e = internalFormat; n[4].i = (GLint) width; n[5].i = (GLint) height; n[6].i = (GLint) depth; n[7].i = border; n[8].i = imageSize; n[9].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexImage3DARB(ctx->Exec, (target, level, internalFormat, width, height, depth, border, imageSize, data)); } } } static void GLAPIENTRY save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) { Node *n; GLvoid *image; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ image = MALLOC(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage1DARB"); return; } MEMCPY(image, data, imageSize); n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7 ); if (n) { n[1].e = target; n[2].i = level; n[3].i = xoffset; n[4].i = (GLint) width; n[5].e = format; n[6].i = imageSize; n[7].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexSubImage1DARB(ctx->Exec, (target, level, xoffset, width, format, imageSize, data)); } } static void GLAPIENTRY save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) { Node *n; GLvoid *image; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ image = MALLOC(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2DARB"); return; } MEMCPY(image, data, imageSize); n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9 ); if (n) { n[1].e = target; n[2].i = level; n[3].i = xoffset; n[4].i = yoffset; n[5].i = (GLint) width; n[6].i = (GLint) height; n[7].e = format; n[8].i = imageSize; n[9].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexSubImage2DARB(ctx->Exec, (target, level, xoffset, yoffset, width, height, format, imageSize, data)); } } static void GLAPIENTRY save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) { Node *n; GLvoid *image; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ image = MALLOC(imageSize); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3DARB"); return; } MEMCPY(image, data, imageSize); n = ALLOC_INSTRUCTION( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11 ); if (n) { n[1].e = target; n[2].i = level; n[3].i = xoffset; n[4].i = yoffset; n[5].i = zoffset; n[6].i = (GLint) width; n[7].i = (GLint) height; n[8].i = (GLint) depth; n[9].e = format; n[10].i = imageSize; n[11].data = image; } else if (image) { FREE(image); } if (ctx->ExecuteFlag) { CALL_CompressedTexSubImage3DARB(ctx->Exec, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data)); } } /* GL_ARB_multisample */ static void GLAPIENTRY save_SampleCoverageARB(GLclampf value, GLboolean invert) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_SAMPLE_COVERAGE, 2 ); if (n) { n[1].f = value; n[2].b = invert; } if (ctx->ExecuteFlag) { CALL_SampleCoverageARB(ctx->Exec, ( value, invert )); } } /* GL_SGIS_pixel_texture */ static void GLAPIENTRY save_PixelTexGenParameteriSGIS(GLenum target, GLint value) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, 2 ); if (n) { n[1].e = target; n[2].i = value; } if (ctx->ExecuteFlag) { CALL_PixelTexGenParameteriSGIS(ctx->Exec, ( target, value )); } } static void GLAPIENTRY save_PixelTexGenParameterfSGIS(GLenum target, GLfloat value) { save_PixelTexGenParameteriSGIS(target, (GLint) value); } static void GLAPIENTRY save_PixelTexGenParameterivSGIS(GLenum target, const GLint *value) { save_PixelTexGenParameteriSGIS(target, *value); } static void GLAPIENTRY save_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) { save_PixelTexGenParameteriSGIS(target, (GLint) *value); } /* * GL_NV_vertex_program */ #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program static void GLAPIENTRY save_BindProgramNV(GLenum target, GLuint id) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_BIND_PROGRAM_NV, 2 ); if (n) { n[1].e = target; n[2].ui = id; } if (ctx->ExecuteFlag) { CALL_BindProgramNV(ctx->Exec, ( target, id )); } } #endif /* FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */ #if FEATURE_NV_vertex_program static void GLAPIENTRY save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_EXECUTE_PROGRAM_NV, 6 ); if (n) { n[1].e = target; n[2].ui = id; n[3].f = params[0]; n[4].f = params[1]; n[5].f = params[2]; n[6].f = params[3]; } if (ctx->ExecuteFlag) { CALL_ExecuteProgramNV(ctx->Exec, (target, id, params)); } } static void GLAPIENTRY save_ProgramParameter4fNV(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_PARAMETER4F_NV, 6 ); if (n) { n[1].e = target; n[2].ui = index; n[3].f = x; n[4].f = y; n[5].f = z; n[6].f = w; } if (ctx->ExecuteFlag) { CALL_ProgramParameter4fNV(ctx->Exec, (target, index, x, y, z, w)); } } static void GLAPIENTRY save_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params) { save_ProgramParameter4fNV(target, index, params[0], params[1], params[2], params[3]); } static void GLAPIENTRY save_ProgramParameter4dNV(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { save_ProgramParameter4fNV(target, index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } static void GLAPIENTRY save_ProgramParameter4dvNV(GLenum target, GLuint index, const GLdouble *params) { save_ProgramParameter4fNV(target, index, (GLfloat) params[0], (GLfloat) params[1], (GLfloat) params[2], (GLfloat) params[3]); } static void GLAPIENTRY save_ProgramParameters4dvNV(GLenum target, GLuint index, GLuint num, const GLdouble *params) { GLuint i; for (i = 0; i < num; i++) { save_ProgramParameter4dvNV(target, index + i, params + 4 * i); } } static void GLAPIENTRY save_ProgramParameters4fvNV(GLenum target, GLuint index, GLuint num, const GLfloat *params) { GLuint i; for (i = 0; i < num; i++) { save_ProgramParameter4fvNV(target, index + i, params + 4 * i); } } static void GLAPIENTRY save_LoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte *program) { GET_CURRENT_CONTEXT(ctx); Node *n; GLubyte *programCopy; programCopy = (GLubyte *) _mesa_malloc(len); if (!programCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); return; } _mesa_memcpy(programCopy, program, len); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_PROGRAM_NV, 4 ); if (n) { n[1].e = target; n[2].ui = id; n[3].i = len; n[4].data = programCopy; } if (ctx->ExecuteFlag) { CALL_LoadProgramNV(ctx->Exec, (target, id, len, program)); } } static void GLAPIENTRY save_RequestResidentProgramsNV(GLsizei num, const GLuint *ids) { GET_CURRENT_CONTEXT(ctx); Node *n; GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint)); if (!idCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV"); return; } _mesa_memcpy(idCopy, ids, num * sizeof(GLuint)); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TRACK_MATRIX_NV, 2 ); if (n) { n[1].i = num; n[2].data = idCopy; } if (ctx->ExecuteFlag) { CALL_RequestResidentProgramsNV(ctx->Exec, (num, ids)); } } static void GLAPIENTRY save_TrackMatrixNV(GLenum target, GLuint address, GLenum matrix, GLenum transform) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TRACK_MATRIX_NV, 4 ); if (n) { n[1].e = target; n[2].ui = address; n[3].e = matrix; n[4].e = transform; } if (ctx->ExecuteFlag) { CALL_TrackMatrixNV(ctx->Exec, (target, address, matrix, transform)); } } #endif /* FEATURE_NV_vertex_program */ /* * GL_NV_fragment_program */ #if FEATURE_NV_fragment_program static void GLAPIENTRY save_ProgramLocalParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6 ); if (n) { n[1].e = target; n[2].ui = index; n[3].f = x; n[4].f = y; n[5].f = z; n[6].f = w; } if (ctx->ExecuteFlag) { CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w)); } } static void GLAPIENTRY save_ProgramLocalParameter4fvARB(GLenum target, GLuint index, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6 ); if (n) { n[1].e = target; n[2].ui = index; n[3].f = params[0]; n[4].f = params[1]; n[5].f = params[2]; n[6].f = params[3]; } if (ctx->ExecuteFlag) { CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params)); } } static void GLAPIENTRY save_ProgramLocalParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6 ); if (n) { n[1].e = target; n[2].ui = index; n[3].f = (GLfloat) x; n[4].f = (GLfloat) y; n[5].f = (GLfloat) z; n[6].f = (GLfloat) w; } if (ctx->ExecuteFlag) { CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w)); } } static void GLAPIENTRY save_ProgramLocalParameter4dvARB(GLenum target, GLuint index, const GLdouble *params) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6 ); if (n) { n[1].e = target; n[2].ui = index; n[3].f = (GLfloat) params[0]; n[4].f = (GLfloat) params[1]; n[5].f = (GLfloat) params[2]; n[6].f = (GLfloat) params[3]; } if (ctx->ExecuteFlag) { CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params)); } } static void GLAPIENTRY save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GET_CURRENT_CONTEXT(ctx); Node *n; GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len); if (!nameCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV"); return; } _mesa_memcpy(nameCopy, name, len); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6 ); if (n) { n[1].ui = id; n[2].i = len; n[3].data = nameCopy; n[4].f = x; n[5].f = y; n[6].f = z; n[7].f = w; } if (ctx->ExecuteFlag) { CALL_ProgramNamedParameter4fNV(ctx->Exec, (id, len, name, x, y, z, w)); } } static void GLAPIENTRY save_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name, const float v[]) { save_ProgramNamedParameter4fNV(id, len, name, v[0], v[1], v[2], v[3]); } static void GLAPIENTRY save_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) x, (GLfloat) y, (GLfloat) z,(GLfloat) w); } static void GLAPIENTRY save_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name, const double v[]) { save_ProgramNamedParameter4fNV(id, len, name, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } #endif /* FEATURE_NV_fragment_program */ /* GL_EXT_stencil_two_side */ static void GLAPIENTRY save_ActiveStencilFaceEXT( GLenum face ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1 ); if (n) { n[1].e = face; } if (ctx->ExecuteFlag) { CALL_ActiveStencilFaceEXT(ctx->Exec, ( face )); } } /* GL_EXT_depth_bounds_test */ static void GLAPIENTRY save_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_BOUNDS_EXT, 2 ); if (n) { n[1].f = (GLfloat) zmin; n[2].f = (GLfloat) zmax; } if (ctx->ExecuteFlag) { CALL_DepthBoundsEXT(ctx->Exec, ( zmin, zmax )); } } #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program static void GLAPIENTRY save_ProgramStringARB(GLenum target, GLenum format, GLsizei len, const GLvoid *string) { GET_CURRENT_CONTEXT(ctx); Node *n; GLubyte *programCopy; programCopy = (GLubyte *) _mesa_malloc(len); if (!programCopy) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB"); return; } _mesa_memcpy(programCopy, string, len); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_STRING_ARB, 4 ); if (n) { n[1].e = target; n[2].e = format; n[3].i = len; n[4].data = programCopy; } if (ctx->ExecuteFlag) { CALL_ProgramStringARB(ctx->Exec, (target, format, len, string)); } } static void GLAPIENTRY save_ProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6 ); if (n) { n[1].e = target; n[2].ui = index; n[3].f = x; n[4].f = y; n[5].f = z; n[6].f = w; } if (ctx->ExecuteFlag) { CALL_ProgramEnvParameter4fARB(ctx->Exec, ( target, index, x, y, z, w)); } } static void GLAPIENTRY save_ProgramEnvParameter4fvARB(GLenum target, GLuint index, const GLfloat *params) { save_ProgramEnvParameter4fARB(target, index, params[0], params[1], params[2], params[3]); } static void GLAPIENTRY save_ProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { save_ProgramEnvParameter4fARB(target, index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } static void GLAPIENTRY save_ProgramEnvParameter4dvARB(GLenum target, GLuint index, const GLdouble *params) { save_ProgramEnvParameter4fARB(target, index, (GLfloat) params[0], (GLfloat) params[1], (GLfloat) params[2], (GLfloat) params[3]); } #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */ #ifdef FEATURE_ARB_occlusion_query static void GLAPIENTRY save_BeginQueryARB(GLenum target, GLuint id) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_BEGIN_QUERY_ARB, 2 ); if (n) { n[1].e = target; n[2].ui = id; } if (ctx->ExecuteFlag) { CALL_BeginQueryARB(ctx->Exec, ( target, id )); } } static void GLAPIENTRY save_EndQueryARB(GLenum target) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_END_QUERY_ARB, 1 ); if (n) { n[1].e = target; } if (ctx->ExecuteFlag) { CALL_EndQueryARB(ctx->Exec, ( target )); } } #endif /* FEATURE_ARB_occlusion_query */ static void GLAPIENTRY save_DrawBuffersARB(GLsizei count, const GLenum *buffers) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS ); if (n) { GLint i; n[1].i = count; if (count > MAX_DRAW_BUFFERS) count = MAX_DRAW_BUFFERS; for (i = 0; i < count; i++) { n[2 + i].e = buffers[i]; } } if (ctx->ExecuteFlag) { CALL_DrawBuffersARB(ctx->Exec, (count, buffers)); } } #if FEATURE_ATI_fragment_shader static void GLAPIENTRY save_BindFragmentShaderATI(GLuint id) { GET_CURRENT_CONTEXT(ctx); Node *n; n = ALLOC_INSTRUCTION( ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1); if (n) { n[1].ui = id; } if (ctx->ExecuteFlag) { CALL_BindFragmentShaderATI(ctx->Exec, (id)); } } static void GLAPIENTRY save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); Node *n; n = ALLOC_INSTRUCTION( ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5); if (n) { n[1].ui = dst; n[2].f = value[0]; n[3].f = value[1]; n[4].f = value[2]; n[5].f = value[3]; } if (ctx->ExecuteFlag) { CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value)); } } #endif static void save_Attr1fNV( GLenum attr, GLfloat x ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_1F_NV, 2 ); if (n) { n[1].e = attr; n[2].f = x; } ASSERT(attr < VERT_ATTRIB_MAX); ctx->ListState.ActiveAttribSize[attr] = 1; ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1); if (ctx->ExecuteFlag) { CALL_VertexAttrib1fNV(ctx->Exec, ( attr, x )); } } static void save_Attr2fNV( GLenum attr, GLfloat x, GLfloat y ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_2F_NV, 3 ); if (n) { n[1].e = attr; n[2].f = x; n[3].f = y; } ASSERT(attr < VERT_ATTRIB_MAX); ctx->ListState.ActiveAttribSize[attr] = 2; ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, 0, 1); if (ctx->ExecuteFlag) { CALL_VertexAttrib2fNV(ctx->Exec, ( attr, x, y )); } } static void save_Attr3fNV( GLenum attr, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_3F_NV, 4 ); if (n) { n[1].e = attr; n[2].f = x; n[3].f = y; n[4].f = z; } ASSERT(attr < VERT_ATTRIB_MAX); ctx->ListState.ActiveAttribSize[attr] = 3; ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, 1); if (ctx->ExecuteFlag) { CALL_VertexAttrib3fNV(ctx->Exec, ( attr, x, y, z )); } } static void save_Attr4fNV( GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_4F_NV, 5 ); if (n) { n[1].e = attr; n[2].f = x; n[3].f = y; n[4].f = z; n[5].f = w; } ASSERT(attr < VERT_ATTRIB_MAX); ctx->ListState.ActiveAttribSize[attr] = 4; ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, w); if (ctx->ExecuteFlag) { CALL_VertexAttrib4fNV(ctx->Exec, ( attr, x, y, z, w )); } } static void save_Attr1fARB( GLenum attr, GLfloat x ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_1F_ARB, 2 ); if (n) { n[1].e = attr; n[2].f = x; } ASSERT(attr < VERT_ATTRIB_MAX); ctx->ListState.ActiveAttribSize[attr] = 1; ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1); if (ctx->ExecuteFlag) { CALL_VertexAttrib1fARB(ctx->Exec, ( attr, x )); } } static void save_Attr2fARB( GLenum attr, GLfloat x, GLfloat y ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_2F_ARB, 3 ); if (n) { n[1].e = attr; n[2].f = x; n[3].f = y; } ASSERT(attr < VERT_ATTRIB_MAX); ctx->ListState.ActiveAttribSize[attr] = 2; ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, 0, 1); if (ctx->ExecuteFlag) { CALL_VertexAttrib2fARB(ctx->Exec, ( attr, x, y )); } } static void save_Attr3fARB( GLenum attr, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_3F_ARB, 4 ); if (n) { n[1].e = attr; n[2].f = x; n[3].f = y; n[4].f = z; } ASSERT(attr < VERT_ATTRIB_MAX); ctx->ListState.ActiveAttribSize[attr] = 3; ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, 1); if (ctx->ExecuteFlag) { CALL_VertexAttrib3fARB(ctx->Exec, ( attr, x, y, z )); } } static void save_Attr4fARB( GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_4F_ARB, 5 ); if (n) { n[1].e = attr; n[2].f = x; n[3].f = y; n[4].f = z; n[5].f = w; } ASSERT(attr < VERT_ATTRIB_MAX); ctx->ListState.ActiveAttribSize[attr] = 4; ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, w); if (ctx->ExecuteFlag) { CALL_VertexAttrib4fARB(ctx->Exec, ( attr, x, y, z, w )); } } static void GLAPIENTRY save_EvalCoord1f( GLfloat x ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_C1, 1 ); if (n) { n[1].f = x; } if (ctx->ExecuteFlag) { CALL_EvalCoord1f(ctx->Exec, ( x )); } } static void GLAPIENTRY save_EvalCoord1fv( const GLfloat *v ) { save_EvalCoord1f( v[0] ); } static void GLAPIENTRY save_EvalCoord2f( GLfloat x, GLfloat y ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_C2, 2 ); if (n) { n[1].f = x; n[2].f = y; } if (ctx->ExecuteFlag) { CALL_EvalCoord2f(ctx->Exec, ( x, y )); } } static void GLAPIENTRY save_EvalCoord2fv( const GLfloat *v ) { save_EvalCoord2f( v[0], v[1] ); } static void GLAPIENTRY save_EvalPoint1( GLint x ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_P1, 1 ); if (n) { n[1].i = x; } if (ctx->ExecuteFlag) { CALL_EvalPoint1(ctx->Exec, ( x )); } } static void GLAPIENTRY save_EvalPoint2( GLint x, GLint y ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_P2, 2 ); if (n) { n[1].i = x; n[2].i = y; } if (ctx->ExecuteFlag) { CALL_EvalPoint2(ctx->Exec, ( x, y )); } } static void GLAPIENTRY save_Indexf( GLfloat x ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_INDEX, 1 ); if (n) { n[1].f = x; } ctx->ListState.ActiveIndex = 1; ctx->ListState.CurrentIndex = x; if (ctx->ExecuteFlag) { CALL_Indexi(ctx->Exec, ( (GLint) x )); } } static void GLAPIENTRY save_Indexfv( const GLfloat *v ) { save_Indexf( v[0] ); } static void GLAPIENTRY save_EdgeFlag( GLboolean x ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_EDGEFLAG, 1 ); if (n) { n[1].b = x; } ctx->ListState.ActiveEdgeFlag = 1; ctx->ListState.CurrentEdgeFlag = x; if (ctx->ExecuteFlag) { CALL_EdgeFlag(ctx->Exec, ( x )); } } static void GLAPIENTRY save_EdgeFlagv( const GLboolean *v ) { save_EdgeFlag( v[0] ); } static void GLAPIENTRY save_Materialfv( GLenum face, GLenum pname, const GLfloat *param ) { GET_CURRENT_CONTEXT(ctx); Node *n; int args, i; SAVE_FLUSH_VERTICES( ctx ); switch (face) { case GL_BACK: case GL_FRONT: case GL_FRONT_AND_BACK: break; default: _mesa_compile_error( ctx, GL_INVALID_ENUM, "material(face)" ); return; } switch (pname) { case GL_EMISSION: case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: case GL_AMBIENT_AND_DIFFUSE: args = 4; break; case GL_SHININESS: args = 1; break; case GL_COLOR_INDEXES: args = 3; break; default: _mesa_compile_error( ctx, GL_INVALID_ENUM, "material(pname)" ); return; } n = ALLOC_INSTRUCTION( ctx, OPCODE_MATERIAL, 6 ); if (n) { n[1].e = face; n[2].e = pname; for (i = 0 ; i < args ; i++) n[3+i].f = param[i]; } { GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0, NULL ); for (i = 0 ; i < MAT_ATTRIB_MAX ; i++) if (bitmask & (1<ListState.ActiveMaterialSize[i] = args; COPY_SZ_4V( ctx->ListState.CurrentMaterial[i], args, param ); } } if (ctx->ExecuteFlag) { CALL_Materialfv(ctx->Exec, ( face, pname, param )); } } static void GLAPIENTRY save_Begin( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; GLboolean error = GL_FALSE; if (/*mode < GL_POINTS ||*/ mode > GL_POLYGON) { _mesa_compile_error( ctx, GL_INVALID_ENUM, "Begin (mode)"); error = GL_TRUE; } else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) { /* Typically the first begin. This may raise an error on * playback, depending on whether CallList is issued from inside * a begin/end or not. */ ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM; } else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) { ctx->Driver.CurrentSavePrimitive = mode; } else { _mesa_compile_error( ctx, GL_INVALID_OPERATION, "recursive begin" ); error = GL_TRUE; } if (!error) { /* Give the driver an opportunity to hook in an optimized * display list compiler. */ if (ctx->Driver.NotifySaveBegin( ctx, mode )) return; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_BEGIN, 1 ); if (n) { n[1].e = mode; } } if (ctx->ExecuteFlag) { CALL_Begin(ctx->Exec, ( mode )); } } static void GLAPIENTRY save_End( void ) { GET_CURRENT_CONTEXT(ctx); SAVE_FLUSH_VERTICES( ctx ); (void) ALLOC_INSTRUCTION( ctx, OPCODE_END, 0 ); ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; if (ctx->ExecuteFlag) { CALL_End(ctx->Exec, ( )); } } static void GLAPIENTRY save_Rectf( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) { GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES( ctx ); n = ALLOC_INSTRUCTION( ctx, OPCODE_RECTF, 4 ); if (n) { n[1].f = a; n[2].f = b; n[3].f = c; n[4].f = d; } if (ctx->ExecuteFlag) { CALL_Rectf(ctx->Exec, ( a, b, c, d )); } } static void GLAPIENTRY save_Vertex2f( GLfloat x, GLfloat y ) { save_Attr2fNV( VERT_ATTRIB_POS, x, y ); } static void GLAPIENTRY save_Vertex2fv( const GLfloat *v ) { save_Attr2fNV( VERT_ATTRIB_POS, v[0], v[1] ); } static void GLAPIENTRY save_Vertex3f( GLfloat x, GLfloat y, GLfloat z ) { save_Attr3fNV( VERT_ATTRIB_POS, x, y, z ); } static void GLAPIENTRY save_Vertex3fv( const GLfloat *v ) { save_Attr3fNV( VERT_ATTRIB_POS, v[0], v[1], v[2] ); } static void GLAPIENTRY save_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { save_Attr4fNV( VERT_ATTRIB_POS, x, y, z, w ); } static void GLAPIENTRY save_Vertex4fv( const GLfloat *v ) { save_Attr4fNV( VERT_ATTRIB_POS, v[0], v[1], v[2], v[3] ); } static void GLAPIENTRY save_TexCoord1f( GLfloat x ) { save_Attr1fNV( VERT_ATTRIB_TEX0, x ); } static void GLAPIENTRY save_TexCoord1fv( const GLfloat *v ) { save_Attr1fNV( VERT_ATTRIB_TEX0, v[0] ); } static void GLAPIENTRY save_TexCoord2f( GLfloat x, GLfloat y ) { save_Attr2fNV( VERT_ATTRIB_TEX0, x, y ); } static void GLAPIENTRY save_TexCoord2fv( const GLfloat *v ) { save_Attr2fNV( VERT_ATTRIB_TEX0, v[0], v[1] ); } static void GLAPIENTRY save_TexCoord3f( GLfloat x, GLfloat y, GLfloat z ) { save_Attr3fNV( VERT_ATTRIB_TEX0, x, y, z ); } static void GLAPIENTRY save_TexCoord3fv( const GLfloat *v ) { save_Attr3fNV( VERT_ATTRIB_TEX0, v[0], v[1], v[2] ); } static void GLAPIENTRY save_TexCoord4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { save_Attr4fNV( VERT_ATTRIB_TEX0, x, y, z, w ); } static void GLAPIENTRY save_TexCoord4fv( const GLfloat *v ) { save_Attr4fNV( VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3] ); } static void GLAPIENTRY save_Normal3f( GLfloat x, GLfloat y, GLfloat z ) { save_Attr3fNV( VERT_ATTRIB_NORMAL, x, y, z ); } static void GLAPIENTRY save_Normal3fv( const GLfloat *v ) { save_Attr3fNV( VERT_ATTRIB_NORMAL, v[0], v[1], v[2] ); } static void GLAPIENTRY save_FogCoordfEXT( GLfloat x ) { save_Attr1fNV( VERT_ATTRIB_FOG, x ); } static void GLAPIENTRY save_FogCoordfvEXT( const GLfloat *v ) { save_Attr1fNV( VERT_ATTRIB_FOG, v[0] ); } static void GLAPIENTRY save_Color3f( GLfloat x, GLfloat y, GLfloat z ) { save_Attr3fNV( VERT_ATTRIB_COLOR0, x, y, z ); } static void GLAPIENTRY save_Color3fv( const GLfloat *v ) { save_Attr3fNV( VERT_ATTRIB_COLOR0, v[0], v[1], v[2] ); } static void GLAPIENTRY save_Color4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { save_Attr4fNV( VERT_ATTRIB_COLOR0, x, y, z, w ); } static void GLAPIENTRY save_Color4fv( const GLfloat *v ) { save_Attr4fNV( VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3] ); } static void GLAPIENTRY save_SecondaryColor3fEXT( GLfloat x, GLfloat y, GLfloat z ) { save_Attr3fNV( VERT_ATTRIB_COLOR1, x, y, z ); } static void GLAPIENTRY save_SecondaryColor3fvEXT( const GLfloat *v ) { save_Attr3fNV( VERT_ATTRIB_COLOR1, v[0], v[1], v[2] ); } /* Just call the respective ATTR for texcoord */ static void GLAPIENTRY save_MultiTexCoord1f( GLenum target, GLfloat x ) { GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; save_Attr1fNV( attr, x ); } static void GLAPIENTRY save_MultiTexCoord1fv( GLenum target, const GLfloat *v ) { GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; save_Attr1fNV( attr, v[0] ); } static void GLAPIENTRY save_MultiTexCoord2f( GLenum target, GLfloat x, GLfloat y ) { GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; save_Attr2fNV( attr, x, y ); } static void GLAPIENTRY save_MultiTexCoord2fv( GLenum target, const GLfloat *v ) { GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; save_Attr2fNV( attr, v[0], v[1] ); } static void GLAPIENTRY save_MultiTexCoord3f( GLenum target, GLfloat x, GLfloat y, GLfloat z) { GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; save_Attr3fNV( attr, x, y, z ); } static void GLAPIENTRY save_MultiTexCoord3fv( GLenum target, const GLfloat *v ) { GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; save_Attr3fNV( attr, v[0], v[1], v[2] ); } static void GLAPIENTRY save_MultiTexCoord4f( GLenum target, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; save_Attr4fNV( attr, x, y, z, w ); } static void GLAPIENTRY save_MultiTexCoord4fv( GLenum target, const GLfloat *v ) { GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0; save_Attr4fNV( attr, v[0], v[1], v[2], v[3] ); } static void enum_error( void ) { GET_CURRENT_CONTEXT( ctx ); _mesa_error( ctx, GL_INVALID_ENUM, "VertexAttribfNV" ); } /* First level for NV_vertex_program: * * Check for errors at compile time?. */ static void GLAPIENTRY save_VertexAttrib1fNV( GLuint index, GLfloat x ) { if (index < VERT_ATTRIB_MAX) save_Attr1fNV( index, x ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) save_Attr1fNV( index, v[0] ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) { if (index < VERT_ATTRIB_MAX) save_Attr2fNV( index, x, y ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) save_Attr2fNV( index, v[0], v[1] ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { if (index < VERT_ATTRIB_MAX) save_Attr3fNV( index, x, y, z ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) save_Attr3fNV( index, v[0], v[1], v[2] ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { if (index < VERT_ATTRIB_MAX) save_Attr4fNV( index, x, y, z, w ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) save_Attr4fNV( index, v[0], v[1], v[2], v[3] ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib1fARB( GLuint index, GLfloat x ) { if (index < VERT_ATTRIB_MAX) save_Attr1fARB( index, x ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib1fvARB( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) save_Attr1fARB( index, v[0] ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y ) { if (index < VERT_ATTRIB_MAX) save_Attr2fARB( index, x, y ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib2fvARB( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) save_Attr2fARB( index, v[0], v[1] ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { if (index < VERT_ATTRIB_MAX) save_Attr3fARB( index, x, y, z ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib3fvARB( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) save_Attr3fARB( index, v[0], v[1], v[2] ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { if (index < VERT_ATTRIB_MAX) save_Attr4fARB( index, x, y, z, w ); else enum_error(); } static void GLAPIENTRY save_VertexAttrib4fvARB( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) save_Attr4fARB( index, v[0], v[1], v[2], v[3] ); else enum_error(); } /* KW: Compile commands * * Will appear in the list before the vertex buffer containing the * command that provoked the error. I don't see this as a problem. */ void _mesa_save_error( GLcontext *ctx, GLenum error, const char *s ) { Node *n; n = ALLOC_INSTRUCTION( ctx, OPCODE_ERROR, 2 ); if (n) { n[1].e = error; n[2].data = (void *) s; } /* execute already done */ } /* * Compile an error into current display list. */ void _mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ) { if (ctx->CompileFlag) _mesa_save_error( ctx, error, s ); if (ctx->ExecuteFlag) _mesa_error( ctx, error, s ); } static GLboolean islist(GLcontext *ctx, GLuint list) { if (list > 0 && _mesa_HashLookup(ctx->Shared->DisplayList, list)) { return GL_TRUE; } else { return GL_FALSE; } } /**********************************************************************/ /* Display list execution */ /**********************************************************************/ /* * Execute a display list. Note that the ListBase offset must have already * been added before calling this function. I.e. the list argument is * the absolute list number, not relative to ListBase. * \param list - display list number */ static void GLAPIENTRY execute_list( GLcontext *ctx, GLuint list ) { struct mesa_display_list *dlist; Node *n; GLboolean done; if (list == 0 || !islist(ctx,list)) return; if (ctx->ListState.CallDepth == MAX_LIST_NESTING) { /* raise an error? */ return; } dlist = (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list); if (!dlist) return; ctx->ListState.CallStack[ctx->ListState.CallDepth++] = dlist; if (ctx->Driver.BeginCallList) ctx->Driver.BeginCallList( ctx, dlist ); n = dlist->node; done = GL_FALSE; while (!done) { OpCode opcode = n[0].opcode; int i = (int)n[0].opcode - (int)OPCODE_EXT_0; if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { /* this is a driver-extended opcode */ ctx->ListExt.Opcode[i].Execute(ctx, &n[1]); n += ctx->ListExt.Opcode[i].Size; } else { switch (opcode) { case OPCODE_ERROR: _mesa_error( ctx, n[1].e, (const char *) n[2].data ); break; case OPCODE_ACCUM: CALL_Accum(ctx->Exec, ( n[1].e, n[2].f )); break; case OPCODE_ALPHA_FUNC: CALL_AlphaFunc(ctx->Exec, ( n[1].e, n[2].f )); break; case OPCODE_BIND_TEXTURE: CALL_BindTexture(ctx->Exec, ( n[1].e, n[2].ui )); break; case OPCODE_BITMAP: { const struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = ctx->DefaultPacking; CALL_Bitmap(ctx->Exec, ( (GLsizei) n[1].i, (GLsizei) n[2].i, n[3].f, n[4].f, n[5].f, n[6].f, (const GLubyte *) n[7].data )); ctx->Unpack = save; /* restore */ } break; case OPCODE_BLEND_COLOR: CALL_BlendColor(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f )); break; case OPCODE_BLEND_EQUATION: CALL_BlendEquation(ctx->Exec, ( n[1].e )); break; case OPCODE_BLEND_EQUATION_SEPARATE: CALL_BlendEquationSeparateEXT(ctx->Exec, ( n[1].e, n[2].e )); break; case OPCODE_BLEND_FUNC_SEPARATE: CALL_BlendFuncSeparateEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, n[4].e)); break; case OPCODE_CALL_LIST: /* Generated by glCallList(), don't add ListBase */ if (ctx->ListState.CallDepthListState.CallDepth < MAX_LIST_NESTING) { execute_list( ctx, ctx->List.ListBase + n[1].ui ); } break; case OPCODE_CLEAR: CALL_Clear(ctx->Exec, ( n[1].bf )); break; case OPCODE_CLEAR_COLOR: CALL_ClearColor(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f )); break; case OPCODE_CLEAR_ACCUM: CALL_ClearAccum(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f )); break; case OPCODE_CLEAR_DEPTH: CALL_ClearDepth(ctx->Exec, ( (GLclampd) n[1].f )); break; case OPCODE_CLEAR_INDEX: CALL_ClearIndex(ctx->Exec, ( (GLfloat) n[1].ui )); break; case OPCODE_CLEAR_STENCIL: CALL_ClearStencil(ctx->Exec, ( n[1].i )); break; case OPCODE_CLIP_PLANE: { GLdouble eq[4]; eq[0] = n[2].f; eq[1] = n[3].f; eq[2] = n[4].f; eq[3] = n[5].f; CALL_ClipPlane(ctx->Exec, ( n[1].e, eq )); } break; case OPCODE_COLOR_MASK: CALL_ColorMask(ctx->Exec, ( n[1].b, n[2].b, n[3].b, n[4].b )); break; case OPCODE_COLOR_MATERIAL: CALL_ColorMaterial(ctx->Exec, ( n[1].e, n[2].e )); break; case OPCODE_COLOR_TABLE: { const struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = ctx->DefaultPacking; CALL_ColorTable(ctx->Exec, ( n[1].e, n[2].e, n[3].i, n[4].e, n[5].e, n[6].data )); ctx->Unpack = save; /* restore */ } break; case OPCODE_COLOR_TABLE_PARAMETER_FV: { GLfloat params[4]; params[0] = n[3].f; params[1] = n[4].f; params[2] = n[5].f; params[3] = n[6].f; CALL_ColorTableParameterfv(ctx->Exec, ( n[1].e, n[2].e, params )); } break; case OPCODE_COLOR_TABLE_PARAMETER_IV: { GLint params[4]; params[0] = n[3].i; params[1] = n[4].i; params[2] = n[5].i; params[3] = n[6].i; CALL_ColorTableParameteriv(ctx->Exec, ( n[1].e, n[2].e, params )); } break; case OPCODE_COLOR_SUB_TABLE: { const struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = ctx->DefaultPacking; CALL_ColorSubTable(ctx->Exec, ( n[1].e, n[2].i, n[3].i, n[4].e, n[5].e, n[6].data )); ctx->Unpack = save; /* restore */ } break; case OPCODE_CONVOLUTION_FILTER_1D: { const struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = ctx->DefaultPacking; CALL_ConvolutionFilter1D(ctx->Exec, ( n[1].e, n[2].i, n[3].i, n[4].e, n[5].e, n[6].data )); ctx->Unpack = save; /* restore */ } break; case OPCODE_CONVOLUTION_FILTER_2D: { const struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = ctx->DefaultPacking; CALL_ConvolutionFilter2D(ctx->Exec, ( n[1].e, n[2].i, n[3].i, n[4].i, n[5].e, n[6].e, n[7].data )); ctx->Unpack = save; /* restore */ } break; case OPCODE_CONVOLUTION_PARAMETER_I: CALL_ConvolutionParameteri(ctx->Exec, ( n[1].e, n[2].e, n[3].i )); break; case OPCODE_CONVOLUTION_PARAMETER_IV: { GLint params[4]; params[0] = n[3].i; params[1] = n[4].i; params[2] = n[5].i; params[3] = n[6].i; CALL_ConvolutionParameteriv(ctx->Exec, ( n[1].e, n[2].e, params )); } break; case OPCODE_CONVOLUTION_PARAMETER_F: CALL_ConvolutionParameterf(ctx->Exec, ( n[1].e, n[2].e, n[3].f )); break; case OPCODE_CONVOLUTION_PARAMETER_FV: { GLfloat params[4]; params[0] = n[3].f; params[1] = n[4].f; params[2] = n[5].f; params[3] = n[6].f; CALL_ConvolutionParameterfv(ctx->Exec, ( n[1].e, n[2].e, params )); } break; case OPCODE_COPY_COLOR_SUB_TABLE: CALL_CopyColorSubTable(ctx->Exec, ( n[1].e, n[2].i, n[3].i, n[4].i, n[5].i )); break; case OPCODE_COPY_COLOR_TABLE: CALL_CopyColorSubTable(ctx->Exec, ( n[1].e, n[2].i, n[3].i, n[4].i, n[5].i )); break; case OPCODE_COPY_PIXELS: CALL_CopyPixels(ctx->Exec, ( n[1].i, n[2].i, (GLsizei) n[3].i, (GLsizei) n[4].i, n[5].e )); break; case OPCODE_COPY_TEX_IMAGE1D: CALL_CopyTexImage1D(ctx->Exec, ( n[1].e, n[2].i, n[3].e, n[4].i, n[5].i, n[6].i, n[7].i )); break; case OPCODE_COPY_TEX_IMAGE2D: CALL_CopyTexImage2D(ctx->Exec, ( n[1].e, n[2].i, n[3].e, n[4].i, n[5].i, n[6].i, n[7].i, n[8].i )); break; case OPCODE_COPY_TEX_SUB_IMAGE1D: CALL_CopyTexSubImage1D(ctx->Exec, ( n[1].e, n[2].i, n[3].i, n[4].i, n[5].i, n[6].i )); break; case OPCODE_COPY_TEX_SUB_IMAGE2D: CALL_CopyTexSubImage2D(ctx->Exec, ( n[1].e, n[2].i, n[3].i, n[4].i, n[5].i, n[6].i, n[7].i, n[8].i )); break; case OPCODE_COPY_TEX_SUB_IMAGE3D: CALL_CopyTexSubImage3D(ctx->Exec, ( n[1].e, n[2].i, n[3].i, n[4].i, n[5].i, n[6].i, n[7].i, n[8].i , n[9].i)); break; case OPCODE_CULL_FACE: CALL_CullFace(ctx->Exec, ( n[1].e )); break; case OPCODE_DEPTH_FUNC: CALL_DepthFunc(ctx->Exec, ( n[1].e )); break; case OPCODE_DEPTH_MASK: CALL_DepthMask(ctx->Exec, ( n[1].b )); break; case OPCODE_DEPTH_RANGE: CALL_DepthRange(ctx->Exec, ( (GLclampd) n[1].f, (GLclampd) n[2].f )); break; case OPCODE_DISABLE: CALL_Disable(ctx->Exec, ( n[1].e )); break; case OPCODE_DRAW_BUFFER: CALL_DrawBuffer(ctx->Exec, ( n[1].e )); break; case OPCODE_DRAW_PIXELS: { const struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = ctx->DefaultPacking; CALL_DrawPixels(ctx->Exec, ( n[1].i, n[2].i, n[3].e, n[4].e, n[5].data )); ctx->Unpack = save; /* restore */ } break; case OPCODE_ENABLE: CALL_Enable(ctx->Exec, ( n[1].e )); break; case OPCODE_EVALMESH1: CALL_EvalMesh1(ctx->Exec, ( n[1].e, n[2].i, n[3].i )); break; case OPCODE_EVALMESH2: CALL_EvalMesh2(ctx->Exec, ( n[1].e, n[2].i, n[3].i, n[4].i, n[5].i )); break; case OPCODE_FOG: { GLfloat p[4]; p[0] = n[2].f; p[1] = n[3].f; p[2] = n[4].f; p[3] = n[5].f; CALL_Fogfv(ctx->Exec, ( n[1].e, p )); } break; case OPCODE_FRONT_FACE: CALL_FrontFace(ctx->Exec, ( n[1].e )); break; case OPCODE_FRUSTUM: CALL_Frustum(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f )); break; case OPCODE_HINT: CALL_Hint(ctx->Exec, ( n[1].e, n[2].e )); break; case OPCODE_HISTOGRAM: CALL_Histogram(ctx->Exec, ( n[1].e, n[2].i, n[3].e, n[4].b )); break; case OPCODE_INDEX_MASK: CALL_IndexMask(ctx->Exec, ( n[1].ui )); break; case OPCODE_INIT_NAMES: CALL_InitNames(ctx->Exec, ()); break; case OPCODE_LIGHT: { GLfloat p[4]; p[0] = n[3].f; p[1] = n[4].f; p[2] = n[5].f; p[3] = n[6].f; CALL_Lightfv(ctx->Exec, ( n[1].e, n[2].e, p )); } break; case OPCODE_LIGHT_MODEL: { GLfloat p[4]; p[0] = n[2].f; p[1] = n[3].f; p[2] = n[4].f; p[3] = n[5].f; CALL_LightModelfv(ctx->Exec, ( n[1].e, p )); } break; case OPCODE_LINE_STIPPLE: CALL_LineStipple(ctx->Exec, ( n[1].i, n[2].us )); break; case OPCODE_LINE_WIDTH: CALL_LineWidth(ctx->Exec, ( n[1].f )); break; case OPCODE_LIST_BASE: CALL_ListBase(ctx->Exec, ( n[1].ui )); break; case OPCODE_LOAD_IDENTITY: CALL_LoadIdentity(ctx->Exec, ()); break; case OPCODE_LOAD_MATRIX: if (sizeof(Node)==sizeof(GLfloat)) { CALL_LoadMatrixf(ctx->Exec, ( &n[1].f )); } else { GLfloat m[16]; GLuint i; for (i=0;i<16;i++) { m[i] = n[1+i].f; } CALL_LoadMatrixf(ctx->Exec, ( m )); } break; case OPCODE_LOAD_NAME: CALL_LoadName(ctx->Exec, ( n[1].ui )); break; case OPCODE_LOGIC_OP: CALL_LogicOp(ctx->Exec, ( n[1].e )); break; case OPCODE_MAP1: { GLenum target = n[1].e; GLint ustride = _mesa_evaluator_components(target); GLint uorder = n[5].i; GLfloat u1 = n[2].f; GLfloat u2 = n[3].f; CALL_Map1f(ctx->Exec, ( target, u1, u2, ustride, uorder, (GLfloat *) n[6].data )); } break; case OPCODE_MAP2: { GLenum target = n[1].e; GLfloat u1 = n[2].f; GLfloat u2 = n[3].f; GLfloat v1 = n[4].f; GLfloat v2 = n[5].f; GLint ustride = n[6].i; GLint vstride = n[7].i; GLint uorder = n[8].i; GLint vorder = n[9].i; CALL_Map2f(ctx->Exec, ( target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, (GLfloat *) n[10].data )); } break; case OPCODE_MAPGRID1: CALL_MapGrid1f(ctx->Exec, ( n[1].i, n[2].f, n[3].f )); break; case OPCODE_MAPGRID2: CALL_MapGrid2f(ctx->Exec, ( n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f)); break; case OPCODE_MATRIX_MODE: CALL_MatrixMode(ctx->Exec, ( n[1].e )); break; case OPCODE_MIN_MAX: CALL_Minmax(ctx->Exec, (n[1].e, n[2].e, n[3].b)); break; case OPCODE_MULT_MATRIX: if (sizeof(Node)==sizeof(GLfloat)) { CALL_MultMatrixf(ctx->Exec, ( &n[1].f )); } else { GLfloat m[16]; GLuint i; for (i=0;i<16;i++) { m[i] = n[1+i].f; } CALL_MultMatrixf(ctx->Exec, ( m )); } break; case OPCODE_ORTHO: CALL_Ortho(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f )); break; case OPCODE_PASSTHROUGH: CALL_PassThrough(ctx->Exec, ( n[1].f )); break; case OPCODE_PIXEL_MAP: CALL_PixelMapfv(ctx->Exec, ( n[1].e, n[2].i, (GLfloat *) n[3].data )); break; case OPCODE_PIXEL_TRANSFER: CALL_PixelTransferf(ctx->Exec, ( n[1].e, n[2].f )); break; case OPCODE_PIXEL_ZOOM: CALL_PixelZoom(ctx->Exec, ( n[1].f, n[2].f )); break; case OPCODE_POINT_SIZE: CALL_PointSize(ctx->Exec, ( n[1].f )); break; case OPCODE_POINT_PARAMETERS: { GLfloat params[3]; params[0] = n[2].f; params[1] = n[3].f; params[2] = n[4].f; CALL_PointParameterfvEXT(ctx->Exec, ( n[1].e, params )); } break; case OPCODE_POLYGON_MODE: CALL_PolygonMode(ctx->Exec, ( n[1].e, n[2].e )); break; case OPCODE_POLYGON_STIPPLE: CALL_PolygonStipple(ctx->Exec, ( (GLubyte *) n[1].data )); break; case OPCODE_POLYGON_OFFSET: CALL_PolygonOffset(ctx->Exec, ( n[1].f, n[2].f )); break; case OPCODE_POP_ATTRIB: CALL_PopAttrib(ctx->Exec, ()); break; case OPCODE_POP_MATRIX: CALL_PopMatrix(ctx->Exec, ()); break; case OPCODE_POP_NAME: CALL_PopName(ctx->Exec, ()); break; case OPCODE_PRIORITIZE_TEXTURE: CALL_PrioritizeTextures(ctx->Exec, ( 1, &n[1].ui, &n[2].f )); break; case OPCODE_PUSH_ATTRIB: CALL_PushAttrib(ctx->Exec, ( n[1].bf )); break; case OPCODE_PUSH_MATRIX: CALL_PushMatrix(ctx->Exec, ()); break; case OPCODE_PUSH_NAME: CALL_PushName(ctx->Exec, ( n[1].ui )); break; case OPCODE_RASTER_POS: CALL_RasterPos4f(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f )); break; case OPCODE_READ_BUFFER: CALL_ReadBuffer(ctx->Exec, ( n[1].e )); break; case OPCODE_RESET_HISTOGRAM: CALL_ResetHistogram(ctx->Exec, ( n[1].e )); break; case OPCODE_RESET_MIN_MAX: CALL_ResetMinmax(ctx->Exec, ( n[1].e )); break; case OPCODE_ROTATE: CALL_Rotatef(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f )); break; case OPCODE_SCALE: CALL_Scalef(ctx->Exec, ( n[1].f, n[2].f, n[3].f )); break; case OPCODE_SCISSOR: CALL_Scissor(ctx->Exec, ( n[1].i, n[2].i, n[3].i, n[4].i )); break; case OPCODE_SHADE_MODEL: CALL_ShadeModel(ctx->Exec, ( n[1].e )); break; case OPCODE_STENCIL_FUNC: CALL_StencilFunc(ctx->Exec, ( n[1].e, n[2].i, n[3].ui )); break; case OPCODE_STENCIL_MASK: CALL_StencilMask(ctx->Exec, ( n[1].ui )); break; case OPCODE_STENCIL_OP: CALL_StencilOp(ctx->Exec, ( n[1].e, n[2].e, n[3].e )); break; case OPCODE_STENCIL_FUNC_SEPARATE: CALL_StencilFuncSeparate(ctx->Exec, ( n[1].e, n[2].e, n[3].i, n[4].ui )); break; case OPCODE_STENCIL_MASK_SEPARATE: CALL_StencilMaskSeparate(ctx->Exec, ( n[1].e, n[2].ui )); break; case OPCODE_STENCIL_OP_SEPARATE: CALL_StencilOpSeparate(ctx->Exec, ( n[1].e, n[2].e, n[3].e, n[4].e )); break; case OPCODE_TEXENV: { GLfloat params[4]; params[0] = n[3].f; params[1] = n[4].f; params[2] = n[5].f; params[3] = n[6].f; CALL_TexEnvfv(ctx->Exec, ( n[1].e, n[2].e, params )); } break; case OPCODE_TEXGEN: { GLfloat params[4]; params[0] = n[3].f; params[1] = n[4].f; params[2] = n[5].f; params[3] = n[6].f; CALL_TexGenfv(ctx->Exec, ( n[1].e, n[2].e, params )); } break; case OPCODE_TEXPARAMETER: { GLfloat params[4]; params[0] = n[3].f; params[1] = n[4].f; params[2] = n[5].f; params[3] = n[6].f; CALL_TexParameterfv(ctx->Exec, ( n[1].e, n[2].e, params )); } break; case OPCODE_TEX_IMAGE1D: { const struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = ctx->DefaultPacking; CALL_TexImage1D(ctx->Exec, ( n[1].e, /* target */ n[2].i, /* level */ n[3].i, /* components */ n[4].i, /* width */ n[5].e, /* border */ n[6].e, /* format */ n[7].e, /* type */ n[8].data )); ctx->Unpack = save; /* restore */ } break; case OPCODE_TEX_IMAGE2D: { const struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = ctx->DefaultPacking; CALL_TexImage2D(ctx->Exec, ( n[1].e, /* target */ n[2].i, /* level */ n[3].i, /* components */ n[4].i, /* width */ n[5].i, /* height */ n[6].e, /* border */ n[7].e, /* format */ n[8].e, /* type */ n[9].data )); ctx->Unpack = save; /* restore */ } break; case OPCODE_TEX_IMAGE3D: { const struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = ctx->DefaultPacking; CALL_TexImage3D(ctx->Exec, ( n[1].e, /* target */ n[2].i, /* level */ n[3].i, /* components */ n[4].i, /* width */ n[5].i, /* height */ n[6].i, /* depth */ n[7].e, /* border */ n[8].e, /* format */ n[9].e, /* type */ n[10].data )); ctx->Unpack = save; /* restore */ } break; case OPCODE_TEX_SUB_IMAGE1D: { const struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = ctx->DefaultPacking; CALL_TexSubImage1D(ctx->Exec, ( n[1].e, n[2].i, n[3].i, n[4].i, n[5].e, n[6].e, n[7].data )); ctx->Unpack = save; /* restore */ } break; case OPCODE_TEX_SUB_IMAGE2D: { const struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = ctx->DefaultPacking; CALL_TexSubImage2D(ctx->Exec, ( n[1].e, n[2].i, n[3].i, n[4].i, n[5].e, n[6].i, n[7].e, n[8].e, n[9].data )); ctx->Unpack = save; /* restore */ } break; case OPCODE_TEX_SUB_IMAGE3D: { const struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = ctx->DefaultPacking; CALL_TexSubImage3D(ctx->Exec, ( n[1].e, n[2].i, n[3].i, n[4].i, n[5].i, n[6].i, n[7].i, n[8].i, n[9].e, n[10].e, n[11].data )); ctx->Unpack = save; /* restore */ } break; case OPCODE_TRANSLATE: CALL_Translatef(ctx->Exec, ( n[1].f, n[2].f, n[3].f )); break; case OPCODE_VIEWPORT: CALL_Viewport(ctx->Exec, (n[1].i, n[2].i, (GLsizei) n[3].i, (GLsizei) n[4].i)); break; case OPCODE_WINDOW_POS: CALL_WindowPos4fMESA(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f )); break; case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */ CALL_ActiveTextureARB(ctx->Exec, ( n[1].e )); break; case OPCODE_PIXEL_TEXGEN_SGIX: /* GL_SGIX_pixel_texture */ CALL_PixelTexGenSGIX(ctx->Exec, ( n[1].e )); break; case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS: /* GL_SGIS_pixel_texture */ CALL_PixelTexGenParameteriSGIS(ctx->Exec, ( n[1].e, n[2].i )); break; case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */ CALL_CompressedTexImage1DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i, n[5].i, n[6].i, n[7].data)); break; case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */ CALL_CompressedTexImage2DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i, n[5].i, n[6].i, n[7].i, n[8].data)); break; case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */ CALL_CompressedTexImage3DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e, n[4].i, n[5].i, n[6].i, n[7].i, n[8].i, n[9].data)); break; case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */ CALL_CompressedTexSubImage1DARB(ctx->Exec, (n[1].e, n[2].i, n[3].i, n[4].i, n[5].e, n[6].i, n[7].data)); break; case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */ CALL_CompressedTexSubImage2DARB(ctx->Exec, (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i, n[6].i, n[7].e, n[8].i, n[9].data)); break; case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */ CALL_CompressedTexSubImage3DARB(ctx->Exec, (n[1].e, n[2].i, n[3].i, n[4].i, n[5].i, n[6].i, n[7].i, n[8].i, n[9].e, n[10].i, n[11].data)); break; case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */ CALL_SampleCoverageARB(ctx->Exec, (n[1].f, n[2].b)); break; case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */ CALL_WindowPos3fMESA(ctx->Exec, ( n[1].f, n[2].f, n[3].f )); break; #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program case OPCODE_BIND_PROGRAM_NV: /* GL_NV_vertex_program */ CALL_BindProgramNV(ctx->Exec, ( n[1].e, n[2].ui )); break; #endif #if FEATURE_NV_vertex_program case OPCODE_EXECUTE_PROGRAM_NV: { GLfloat v[4]; v[0] = n[3].f; v[1] = n[4].f; v[2] = n[5].f; v[3] = n[6].f; CALL_ExecuteProgramNV(ctx->Exec, (n[1].e, n[2].ui, v)); } break; case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV: CALL_RequestResidentProgramsNV(ctx->Exec, (n[1].ui, (GLuint *) n[2].data)); break; case OPCODE_LOAD_PROGRAM_NV: CALL_LoadProgramNV(ctx->Exec, (n[1].e, n[2].ui, n[3].i, (const GLubyte *) n[4].data)); break; case OPCODE_PROGRAM_PARAMETER4F_NV: CALL_ProgramParameter4fNV(ctx->Exec, (n[1].e, n[2].ui, n[3].f, n[4].f, n[5].f, n[6].f)); break; case OPCODE_TRACK_MATRIX_NV: CALL_TrackMatrixNV(ctx->Exec, (n[1].e, n[2].ui, n[3].e, n[4].e)); break; #endif #if FEATURE_NV_fragment_program case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB: CALL_ProgramLocalParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f, n[4].f, n[5].f, n[6].f)); break; case OPCODE_PROGRAM_NAMED_PARAMETER_NV: CALL_ProgramNamedParameter4fNV(ctx->Exec, (n[1].ui, n[2].i, (const GLubyte *) n[3].data, n[4].f, n[5].f, n[6].f, n[7].f)); break; #endif case OPCODE_ACTIVE_STENCIL_FACE_EXT: CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e)); break; case OPCODE_DEPTH_BOUNDS_EXT: CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f)); break; #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program case OPCODE_PROGRAM_STRING_ARB: CALL_ProgramStringARB(ctx->Exec, (n[1].e, n[2].e, n[3].i, n[4].data)); break; case OPCODE_PROGRAM_ENV_PARAMETER_ARB: CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f, n[4].f, n[5].f, n[6].f)); break; #endif #if FEATURE_ARB_occlusion_query case OPCODE_BEGIN_QUERY_ARB: CALL_BeginQueryARB(ctx->Exec, (n[1].e, n[2].ui)); break; case OPCODE_END_QUERY_ARB: CALL_EndQueryARB(ctx->Exec, (n[1].e)); break; #endif case OPCODE_DRAW_BUFFERS_ARB: { GLenum buffers[MAX_DRAW_BUFFERS]; GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS); for (i = 0; i < count; i++) buffers[i] = n[2 + i].e; CALL_DrawBuffersARB(ctx->Exec, (n[1].i, buffers)); } break; #if FEATURE_ATI_fragment_shader case OPCODE_BIND_FRAGMENT_SHADER_ATI: CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i)); break; case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI: { GLfloat values[4]; GLuint i, dst = n[1].ui; for (i = 0; i < 4; i++) values[i] = n[1+i].f; CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, values)); } break; #endif case OPCODE_ATTR_1F_NV: CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f)); break; case OPCODE_ATTR_2F_NV: /* Really shouldn't have to do this - the Node structure * is convenient, but it would be better to store the data * packed appropriately so that it can be sent directly * on. With x86_64 becoming common, this will start to * matter more. */ if (sizeof(Node)==sizeof(GLfloat)) CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f)); else CALL_VertexAttrib2fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f)); break; case OPCODE_ATTR_3F_NV: if (sizeof(Node)==sizeof(GLfloat)) CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f)); else CALL_VertexAttrib3fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f)); break; case OPCODE_ATTR_4F_NV: if (sizeof(Node)==sizeof(GLfloat)) CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f)); else CALL_VertexAttrib4fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f, n[5].f)); break; case OPCODE_ATTR_1F_ARB: CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f)); break; case OPCODE_ATTR_2F_ARB: /* Really shouldn't have to do this - the Node structure * is convenient, but it would be better to store the data * packed appropriately so that it can be sent directly * on. With x86_64 becoming common, this will start to * matter more. */ if (sizeof(Node)==sizeof(GLfloat)) CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f)); else CALL_VertexAttrib2fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f)); break; case OPCODE_ATTR_3F_ARB: if (sizeof(Node)==sizeof(GLfloat)) CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f)); else CALL_VertexAttrib3fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f)); break; case OPCODE_ATTR_4F_ARB: if (sizeof(Node)==sizeof(GLfloat)) CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f)); else CALL_VertexAttrib4fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f, n[4].f, n[5].f)); break; case OPCODE_MATERIAL: if (sizeof(Node)==sizeof(GLfloat)) CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f)); else { GLfloat f[4]; f[0] = n[3].f; f[1] = n[4].f; f[2] = n[5].f; f[3] = n[6].f; CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, f)); } break; case OPCODE_INDEX: CALL_Indexi(ctx->Exec, (n[1].i)); break; case OPCODE_EDGEFLAG: CALL_EdgeFlag(ctx->Exec, (n[1].b)); break; case OPCODE_BEGIN: CALL_Begin(ctx->Exec, (n[1].e)); break; case OPCODE_END: CALL_End(ctx->Exec, ()); break; case OPCODE_RECTF: CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f)); break; case OPCODE_EVAL_C1: CALL_EvalCoord1f(ctx->Exec, (n[1].f)); break; case OPCODE_EVAL_C2: CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f)); break; case OPCODE_EVAL_P1: CALL_EvalPoint1(ctx->Exec, (n[1].i)); break; case OPCODE_EVAL_P2: CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i)); break; case OPCODE_CONTINUE: n = (Node *) n[1].next; break; case OPCODE_END_OF_LIST: done = GL_TRUE; break; default: { char msg[1000]; _mesa_sprintf(msg, "Error in execute_list: opcode=%d", (int) opcode); _mesa_problem(ctx, msg); } done = GL_TRUE; } /* increment n to point to next compiled command */ if (opcode!=OPCODE_CONTINUE) { n += InstSize[opcode]; } } } if (ctx->Driver.EndCallList) ctx->Driver.EndCallList( ctx ); ctx->ListState.CallStack[ctx->ListState.CallDepth--] = NULL; } /**********************************************************************/ /* GL functions */ /**********************************************************************/ /* * Test if a display list number is valid. */ GLboolean GLAPIENTRY _mesa_IsList( GLuint list ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); /* must be called before assert */ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); return islist(ctx, list); } /* * Delete a sequence of consecutive display lists. */ void GLAPIENTRY _mesa_DeleteLists( GLuint list, GLsizei range ) { GET_CURRENT_CONTEXT(ctx); GLuint i; FLUSH_VERTICES(ctx, 0); /* must be called before assert */ ASSERT_OUTSIDE_BEGIN_END(ctx); if (range<0) { _mesa_error( ctx, GL_INVALID_VALUE, "glDeleteLists" ); return; } for (i=list;iShared->Mutex); base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range); if (base) { /* reserve the list IDs by with empty/dummy lists */ GLint i; for (i=0; iShared->DisplayList, base+i, make_list(base+i, 1)); } } _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); return base; } /* * Begin a new display list. */ void GLAPIENTRY _mesa_NewList( GLuint list, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); GLint i; FLUSH_CURRENT(ctx, 0); /* must be called before assert */ ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glNewList %u %s\n", list, _mesa_lookup_enum_by_nr(mode)); if (list==0) { _mesa_error( ctx, GL_INVALID_VALUE, "glNewList" ); return; } if (mode!=GL_COMPILE && mode!=GL_COMPILE_AND_EXECUTE) { _mesa_error( ctx, GL_INVALID_ENUM, "glNewList" ); return; } if (ctx->ListState.CurrentListPtr) { /* already compiling a display list */ _mesa_error( ctx, GL_INVALID_OPERATION, "glNewList" ); return; } ctx->CompileFlag = GL_TRUE; ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE); /* Allocate new display list */ ctx->ListState.CurrentListNum = list; ctx->ListState.CurrentList = make_list( list, BLOCK_SIZE ); ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->node; ctx->ListState.CurrentListPtr = ctx->ListState.CurrentBlock; ctx->ListState.CurrentPos = 0; /* Reset acumulated list state: */ for (i = 0; i < VERT_ATTRIB_MAX; i++) ctx->ListState.ActiveAttribSize[i] = 0; for (i = 0; i < MAT_ATTRIB_MAX; i++) ctx->ListState.ActiveMaterialSize[i] = 0; ctx->ListState.ActiveIndex = 0; ctx->ListState.ActiveEdgeFlag = 0; ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; ctx->Driver.NewList( ctx, list, mode ); ctx->CurrentDispatch = ctx->Save; _glapi_set_dispatch( ctx->CurrentDispatch ); } /* * End definition of current display list. */ void GLAPIENTRY _mesa_EndList( void ) { GET_CURRENT_CONTEXT(ctx); SAVE_FLUSH_VERTICES(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glEndList\n"); /* Check that a list is under construction */ if (!ctx->ListState.CurrentListPtr) { _mesa_error( ctx, GL_INVALID_OPERATION, "glEndList" ); return; } (void) ALLOC_INSTRUCTION( ctx, OPCODE_END_OF_LIST, 0 ); /* Destroy old list, if any */ _mesa_destroy_list(ctx, ctx->ListState.CurrentListNum); /* Install the list */ _mesa_HashInsert(ctx->Shared->DisplayList, ctx->ListState.CurrentListNum, ctx->ListState.CurrentList); if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) mesa_print_display_list(ctx->ListState.CurrentListNum); ctx->Driver.EndList( ctx ); ctx->ListState.CurrentList = NULL; ctx->ListState.CurrentListNum = 0; ctx->ListState.CurrentListPtr = NULL; ctx->ExecuteFlag = GL_TRUE; ctx->CompileFlag = GL_FALSE; ctx->CurrentDispatch = ctx->Exec; _glapi_set_dispatch( ctx->CurrentDispatch ); } void GLAPIENTRY _mesa_CallList( GLuint list ) { GLboolean save_compile_flag; GET_CURRENT_CONTEXT(ctx); FLUSH_CURRENT(ctx, 0); /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */ /* execute the display list, and restore the CompileFlag. */ if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glCallList %d\n", list); if (list == 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)"); return; } /* mesa_print_display_list( list ); */ save_compile_flag = ctx->CompileFlag; if (save_compile_flag) { ctx->CompileFlag = GL_FALSE; } execute_list( ctx, list ); ctx->CompileFlag = save_compile_flag; /* also restore API function pointers to point to "save" versions */ if (save_compile_flag) { ctx->CurrentDispatch = ctx->Save; _glapi_set_dispatch( ctx->CurrentDispatch ); } } /* * Execute glCallLists: call multiple display lists. */ void GLAPIENTRY _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) { GET_CURRENT_CONTEXT(ctx); GLuint list; GLint i; GLboolean save_compile_flag; if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glCallLists %d\n", n); switch (type) { case GL_BYTE: case GL_UNSIGNED_BYTE: case GL_SHORT: case GL_UNSIGNED_SHORT: case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: case GL_2_BYTES: case GL_3_BYTES: case GL_4_BYTES: /* OK */ break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)"); return; } /* Save the CompileFlag status, turn it off, execute display list, * and restore the CompileFlag. */ save_compile_flag = ctx->CompileFlag; ctx->CompileFlag = GL_FALSE; for (i=0;iList.ListBase + list ); } ctx->CompileFlag = save_compile_flag; /* also restore API function pointers to point to "save" versions */ if (save_compile_flag) { ctx->CurrentDispatch = ctx->Save; _glapi_set_dispatch( ctx->CurrentDispatch ); } } /* * Set the offset added to list numbers in glCallLists. */ void GLAPIENTRY _mesa_ListBase( GLuint base ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); /* must be called before assert */ ASSERT_OUTSIDE_BEGIN_END(ctx); ctx->List.ListBase = base; } /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func. */ static void GLAPIENTRY exec_Finish( void ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_Finish(ctx->Exec, ()); } static void GLAPIENTRY exec_Flush( void ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_Flush(ctx->Exec, ( )); } static void GLAPIENTRY exec_GetBooleanv( GLenum pname, GLboolean *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetBooleanv(ctx->Exec, ( pname, params )); } static void GLAPIENTRY exec_GetClipPlane( GLenum plane, GLdouble *equation ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetClipPlane(ctx->Exec, ( plane, equation )); } static void GLAPIENTRY exec_GetDoublev( GLenum pname, GLdouble *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetDoublev(ctx->Exec, ( pname, params )); } static GLenum GLAPIENTRY exec_GetError( void ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); return CALL_GetError(ctx->Exec, ( )); } static void GLAPIENTRY exec_GetFloatv( GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetFloatv(ctx->Exec, ( pname, params )); } static void GLAPIENTRY exec_GetIntegerv( GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetIntegerv(ctx->Exec, ( pname, params )); } static void GLAPIENTRY exec_GetLightfv( GLenum light, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetLightfv(ctx->Exec, ( light, pname, params )); } static void GLAPIENTRY exec_GetLightiv( GLenum light, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetLightiv(ctx->Exec, ( light, pname, params )); } static void GLAPIENTRY exec_GetMapdv( GLenum target, GLenum query, GLdouble *v ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetMapdv(ctx->Exec, ( target, query, v )); } static void GLAPIENTRY exec_GetMapfv( GLenum target, GLenum query, GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetMapfv(ctx->Exec, ( target, query, v )); } static void GLAPIENTRY exec_GetMapiv( GLenum target, GLenum query, GLint *v ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetMapiv(ctx->Exec, ( target, query, v )); } static void GLAPIENTRY exec_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetMaterialfv(ctx->Exec, ( face, pname, params )); } static void GLAPIENTRY exec_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetMaterialiv(ctx->Exec, ( face, pname, params )); } static void GLAPIENTRY exec_GetPixelMapfv( GLenum map, GLfloat *values ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetPixelMapfv(ctx->Exec, ( map, values )); } static void GLAPIENTRY exec_GetPixelMapuiv( GLenum map, GLuint *values ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetPixelMapuiv(ctx->Exec, ( map, values )); } static void GLAPIENTRY exec_GetPixelMapusv( GLenum map, GLushort *values ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetPixelMapusv(ctx->Exec, ( map, values )); } static void GLAPIENTRY exec_GetPolygonStipple( GLubyte *dest ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetPolygonStipple(ctx->Exec, ( dest )); } static const GLubyte * GLAPIENTRY exec_GetString( GLenum name ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); return CALL_GetString(ctx->Exec, ( name )); } static void GLAPIENTRY exec_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetTexEnvfv(ctx->Exec, ( target, pname, params )); } static void GLAPIENTRY exec_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetTexEnviv(ctx->Exec, ( target, pname, params )); } static void GLAPIENTRY exec_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetTexGendv(ctx->Exec, ( coord, pname, params )); } static void GLAPIENTRY exec_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetTexGenfv(ctx->Exec, ( coord, pname, params )); } static void GLAPIENTRY exec_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetTexGeniv(ctx->Exec, ( coord, pname, params )); } static void GLAPIENTRY exec_GetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetTexImage(ctx->Exec, ( target, level, format, type, pixels )); } static void GLAPIENTRY exec_GetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetTexLevelParameterfv(ctx->Exec, ( target, level, pname, params )); } static void GLAPIENTRY exec_GetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetTexLevelParameteriv(ctx->Exec, ( target, level, pname, params )); } static void GLAPIENTRY exec_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetTexParameterfv(ctx->Exec, ( target, pname, params )); } static void GLAPIENTRY exec_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetTexParameteriv(ctx->Exec, ( target, pname, params )); } static GLboolean GLAPIENTRY exec_IsEnabled( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); return CALL_IsEnabled(ctx->Exec, ( cap )); } static void GLAPIENTRY exec_PixelStoref( GLenum pname, GLfloat param ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_PixelStoref(ctx->Exec, ( pname, param )); } static void GLAPIENTRY exec_PixelStorei( GLenum pname, GLint param ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_PixelStorei(ctx->Exec, ( pname, param )); } static void GLAPIENTRY exec_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_ReadPixels(ctx->Exec, ( x, y, width, height, format, type, pixels )); } static GLint GLAPIENTRY exec_RenderMode( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); return CALL_RenderMode(ctx->Exec, ( mode )); } static void GLAPIENTRY exec_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_FeedbackBuffer(ctx->Exec, ( size, type, buffer )); } static void GLAPIENTRY exec_SelectBuffer( GLsizei size, GLuint *buffer ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_SelectBuffer(ctx->Exec, ( size, buffer )); } static GLboolean GLAPIENTRY exec_AreTexturesResident(GLsizei n, const GLuint *texName, GLboolean *residences) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); return CALL_AreTexturesResident(ctx->Exec, ( n, texName, residences)); } static void GLAPIENTRY exec_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_ColorPointer(ctx->Exec, ( size, type, stride, ptr)); } static void GLAPIENTRY exec_DeleteTextures( GLsizei n, const GLuint *texName) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_DeleteTextures(ctx->Exec, ( n, texName)); } static void GLAPIENTRY exec_DisableClientState( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_DisableClientState(ctx->Exec, ( cap )); } static void GLAPIENTRY exec_EdgeFlagPointer(GLsizei stride, const GLvoid *vptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_EdgeFlagPointer(ctx->Exec, ( stride, vptr)); } static void GLAPIENTRY exec_EnableClientState( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_EnableClientState(ctx->Exec, ( cap )); } static void GLAPIENTRY exec_GenTextures( GLsizei n, GLuint *texName ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GenTextures(ctx->Exec, ( n, texName )); } static void GLAPIENTRY exec_GetPointerv( GLenum pname, GLvoid **params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetPointerv(ctx->Exec, ( pname, params )); } static void GLAPIENTRY exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_IndexPointer(ctx->Exec, ( type, stride, ptr)); } static void GLAPIENTRY exec_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_InterleavedArrays(ctx->Exec, ( format, stride, pointer)); } static GLboolean GLAPIENTRY exec_IsTexture( GLuint texture ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); return CALL_IsTexture(ctx->Exec, ( texture )); } static void GLAPIENTRY exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_NormalPointer(ctx->Exec, ( type, stride, ptr )); } static void GLAPIENTRY exec_PopClientAttrib(void) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_PopClientAttrib(ctx->Exec, ()); } static void GLAPIENTRY exec_PushClientAttrib(GLbitfield mask) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_PushClientAttrib(ctx->Exec, ( mask)); } static void GLAPIENTRY exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_TexCoordPointer(ctx->Exec, ( size, type, stride, ptr)); } static void GLAPIENTRY exec_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetCompressedTexImageARB(ctx->Exec, ( target, level, img)); } static void GLAPIENTRY exec_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_VertexPointer(ctx->Exec, ( size, type, stride, ptr)); } static void GLAPIENTRY exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_CopyConvolutionFilter1D(ctx->Exec, ( target, internalFormat, x, y, width)); } static void GLAPIENTRY exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_CopyConvolutionFilter2D(ctx->Exec, ( target, internalFormat, x, y, width, height)); } static void GLAPIENTRY exec_GetColorTable( GLenum target, GLenum format, GLenum type, GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetColorTable(ctx->Exec, ( target, format, type, data )); } static void GLAPIENTRY exec_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetColorTableParameterfv(ctx->Exec, ( target, pname, params )); } static void GLAPIENTRY exec_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetColorTableParameteriv(ctx->Exec, ( target, pname, params )); } static void GLAPIENTRY exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetConvolutionFilter(ctx->Exec, ( target, format, type, image)); } static void GLAPIENTRY exec_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetConvolutionParameterfv(ctx->Exec, ( target, pname, params)); } static void GLAPIENTRY exec_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetConvolutionParameteriv(ctx->Exec, ( target, pname, params)); } static void GLAPIENTRY exec_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetHistogram(ctx->Exec, ( target, reset, format, type, values)); } static void GLAPIENTRY exec_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetHistogramParameterfv(ctx->Exec, ( target, pname, params)); } static void GLAPIENTRY exec_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetHistogramParameteriv(ctx->Exec, ( target, pname, params)); } static void GLAPIENTRY exec_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetMinmax(ctx->Exec, ( target, reset, format, type, values)); } static void GLAPIENTRY exec_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetMinmaxParameterfv(ctx->Exec, ( target, pname, params)); } static void GLAPIENTRY exec_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetMinmaxParameteriv(ctx->Exec, ( target, pname, params)); } static void GLAPIENTRY exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetSeparableFilter(ctx->Exec, ( target, format, type, row, column, span)); } static void GLAPIENTRY exec_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_SeparableFilter2D(ctx->Exec, ( target, internalFormat, width, height, format, type, row, column)); } static void GLAPIENTRY exec_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetPixelTexGenParameterivSGIS(ctx->Exec, ( target, value)); } static void GLAPIENTRY exec_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_GetPixelTexGenParameterfvSGIS(ctx->Exec, ( target, value)); } static void GLAPIENTRY exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_ColorPointerEXT(ctx->Exec, ( size, type, stride, count, ptr)); } static void GLAPIENTRY exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_EdgeFlagPointerEXT(ctx->Exec, ( stride, count, ptr)); } static void GLAPIENTRY exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_IndexPointerEXT(ctx->Exec, ( type, stride, count, ptr)); } static void GLAPIENTRY exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_NormalPointerEXT(ctx->Exec, ( type, stride, count, ptr)); } static void GLAPIENTRY exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_TexCoordPointerEXT(ctx->Exec, ( size, type, stride, count, ptr)); } static void GLAPIENTRY exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_VertexPointerEXT(ctx->Exec, ( size, type, stride, count, ptr)); } static void GLAPIENTRY exec_LockArraysEXT(GLint first, GLsizei count) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_LockArraysEXT(ctx->Exec, ( first, count)); } static void GLAPIENTRY exec_UnlockArraysEXT( void ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_UnlockArraysEXT(ctx->Exec, ( )); } static void GLAPIENTRY exec_ClientActiveTextureARB( GLenum target ) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_ClientActiveTextureARB(ctx->Exec, (target)); } static void GLAPIENTRY exec_SecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_SecondaryColorPointerEXT(ctx->Exec, ( size, type, stride, ptr)); } static void GLAPIENTRY exec_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_FogCoordPointerEXT(ctx->Exec, ( type, stride, ptr)); } /* GL_EXT_multi_draw_arrays */ static void GLAPIENTRY exec_MultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_MultiDrawArraysEXT(ctx->Exec, ( mode, first, count, primcount )); } /* GL_EXT_multi_draw_arrays */ static void GLAPIENTRY exec_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_MultiDrawElementsEXT(ctx->Exec, (mode, count, type, indices, primcount)); } /* GL_IBM_multimode_draw_arrays */ static void GLAPIENTRY exec_MultiModeDrawArraysIBM(const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_MultiModeDrawArraysIBM(ctx->Exec, (mode, first, count, primcount, modestride)); } /* GL_IBM_multimode_draw_arrays */ static void GLAPIENTRY exec_MultiModeDrawElementsIBM(const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid * const *indices, GLsizei primcount, GLint modestride) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); CALL_MultiModeDrawElementsIBM(ctx->Exec, (mode, count, type, indices, primcount, modestride)); } /** * Setup the given dispatch table to point to Mesa's display list * building functions. * * This does not include any of the tnl functions - they are * initialized from _mesa_init_api_defaults and from the active vtxfmt * struct. */ void _mesa_init_dlist_table( struct _glapi_table *table ) { _mesa_loopback_init_api_table( table ); /* GL 1.0 */ SET_Accum(table, save_Accum); SET_AlphaFunc(table, save_AlphaFunc); SET_Bitmap(table, save_Bitmap); SET_BlendFunc(table, _mesa_BlendFunc); /* loops-back to BlendFuncSeparate */ SET_CallList(table, _mesa_save_CallList); SET_CallLists(table, _mesa_save_CallLists); SET_Clear(table, save_Clear); SET_ClearAccum(table, save_ClearAccum); SET_ClearColor(table, save_ClearColor); SET_ClearDepth(table, save_ClearDepth); SET_ClearIndex(table, save_ClearIndex); SET_ClearStencil(table, save_ClearStencil); SET_ClipPlane(table, save_ClipPlane); SET_ColorMask(table, save_ColorMask); SET_ColorMaterial(table, save_ColorMaterial); SET_CopyPixels(table, save_CopyPixels); SET_CullFace(table, save_CullFace); SET_DeleteLists(table, _mesa_DeleteLists); SET_DepthFunc(table, save_DepthFunc); SET_DepthMask(table, save_DepthMask); SET_DepthRange(table, save_DepthRange); SET_Disable(table, save_Disable); SET_DrawBuffer(table, save_DrawBuffer); SET_DrawPixels(table, save_DrawPixels); SET_Enable(table, save_Enable); SET_EndList(table, _mesa_EndList); SET_EvalMesh1(table, _mesa_save_EvalMesh1); SET_EvalMesh2(table, _mesa_save_EvalMesh2); SET_Finish(table, exec_Finish); SET_Flush(table, exec_Flush); SET_Fogf(table, save_Fogf); SET_Fogfv(table, save_Fogfv); SET_Fogi(table, save_Fogi); SET_Fogiv(table, save_Fogiv); SET_FrontFace(table, save_FrontFace); SET_Frustum(table, save_Frustum); SET_GenLists(table, _mesa_GenLists); SET_GetBooleanv(table, exec_GetBooleanv); SET_GetClipPlane(table, exec_GetClipPlane); SET_GetDoublev(table, exec_GetDoublev); SET_GetError(table, exec_GetError); SET_GetFloatv(table, exec_GetFloatv); SET_GetIntegerv(table, exec_GetIntegerv); SET_GetLightfv(table, exec_GetLightfv); SET_GetLightiv(table, exec_GetLightiv); SET_GetMapdv(table, exec_GetMapdv); SET_GetMapfv(table, exec_GetMapfv); SET_GetMapiv(table, exec_GetMapiv); SET_GetMaterialfv(table, exec_GetMaterialfv); SET_GetMaterialiv(table, exec_GetMaterialiv); SET_GetPixelMapfv(table, exec_GetPixelMapfv); SET_GetPixelMapuiv(table, exec_GetPixelMapuiv); SET_GetPixelMapusv(table, exec_GetPixelMapusv); SET_GetPolygonStipple(table, exec_GetPolygonStipple); SET_GetString(table, exec_GetString); SET_GetTexEnvfv(table, exec_GetTexEnvfv); SET_GetTexEnviv(table, exec_GetTexEnviv); SET_GetTexGendv(table, exec_GetTexGendv); SET_GetTexGenfv(table, exec_GetTexGenfv); SET_GetTexGeniv(table, exec_GetTexGeniv); SET_GetTexImage(table, exec_GetTexImage); SET_GetTexLevelParameterfv(table, exec_GetTexLevelParameterfv); SET_GetTexLevelParameteriv(table, exec_GetTexLevelParameteriv); SET_GetTexParameterfv(table, exec_GetTexParameterfv); SET_GetTexParameteriv(table, exec_GetTexParameteriv); SET_Hint(table, save_Hint); SET_IndexMask(table, save_IndexMask); SET_InitNames(table, save_InitNames); SET_IsEnabled(table, exec_IsEnabled); SET_IsList(table, _mesa_IsList); SET_LightModelf(table, save_LightModelf); SET_LightModelfv(table, save_LightModelfv); SET_LightModeli(table, save_LightModeli); SET_LightModeliv(table, save_LightModeliv); SET_Lightf(table, save_Lightf); SET_Lightfv(table, save_Lightfv); SET_Lighti(table, save_Lighti); SET_Lightiv(table, save_Lightiv); SET_LineStipple(table, save_LineStipple); SET_LineWidth(table, save_LineWidth); SET_ListBase(table, save_ListBase); SET_LoadIdentity(table, save_LoadIdentity); SET_LoadMatrixd(table, save_LoadMatrixd); SET_LoadMatrixf(table, save_LoadMatrixf); SET_LoadName(table, save_LoadName); SET_LogicOp(table, save_LogicOp); SET_Map1d(table, save_Map1d); SET_Map1f(table, save_Map1f); SET_Map2d(table, save_Map2d); SET_Map2f(table, save_Map2f); SET_MapGrid1d(table, save_MapGrid1d); SET_MapGrid1f(table, save_MapGrid1f); SET_MapGrid2d(table, save_MapGrid2d); SET_MapGrid2f(table, save_MapGrid2f); SET_MatrixMode(table, save_MatrixMode); SET_MultMatrixd(table, save_MultMatrixd); SET_MultMatrixf(table, save_MultMatrixf); SET_NewList(table, save_NewList); SET_Ortho(table, save_Ortho); SET_PassThrough(table, save_PassThrough); SET_PixelMapfv(table, save_PixelMapfv); SET_PixelMapuiv(table, save_PixelMapuiv); SET_PixelMapusv(table, save_PixelMapusv); SET_PixelStoref(table, exec_PixelStoref); SET_PixelStorei(table, exec_PixelStorei); SET_PixelTransferf(table, save_PixelTransferf); SET_PixelTransferi(table, save_PixelTransferi); SET_PixelZoom(table, save_PixelZoom); SET_PointSize(table, save_PointSize); SET_PolygonMode(table, save_PolygonMode); SET_PolygonOffset(table, save_PolygonOffset); SET_PolygonStipple(table, save_PolygonStipple); SET_PopAttrib(table, save_PopAttrib); SET_PopMatrix(table, save_PopMatrix); SET_PopName(table, save_PopName); SET_PushAttrib(table, save_PushAttrib); SET_PushMatrix(table, save_PushMatrix); SET_PushName(table, save_PushName); SET_RasterPos2d(table, save_RasterPos2d); SET_RasterPos2dv(table, save_RasterPos2dv); SET_RasterPos2f(table, save_RasterPos2f); SET_RasterPos2fv(table, save_RasterPos2fv); SET_RasterPos2i(table, save_RasterPos2i); SET_RasterPos2iv(table, save_RasterPos2iv); SET_RasterPos2s(table, save_RasterPos2s); SET_RasterPos2sv(table, save_RasterPos2sv); SET_RasterPos3d(table, save_RasterPos3d); SET_RasterPos3dv(table, save_RasterPos3dv); SET_RasterPos3f(table, save_RasterPos3f); SET_RasterPos3fv(table, save_RasterPos3fv); SET_RasterPos3i(table, save_RasterPos3i); SET_RasterPos3iv(table, save_RasterPos3iv); SET_RasterPos3s(table, save_RasterPos3s); SET_RasterPos3sv(table, save_RasterPos3sv); SET_RasterPos4d(table, save_RasterPos4d); SET_RasterPos4dv(table, save_RasterPos4dv); SET_RasterPos4f(table, save_RasterPos4f); SET_RasterPos4fv(table, save_RasterPos4fv); SET_RasterPos4i(table, save_RasterPos4i); SET_RasterPos4iv(table, save_RasterPos4iv); SET_RasterPos4s(table, save_RasterPos4s); SET_RasterPos4sv(table, save_RasterPos4sv); SET_ReadBuffer(table, save_ReadBuffer); SET_ReadPixels(table, exec_ReadPixels); SET_RenderMode(table, exec_RenderMode); SET_Rotated(table, save_Rotated); SET_Rotatef(table, save_Rotatef); SET_Scaled(table, save_Scaled); SET_Scalef(table, save_Scalef); SET_Scissor(table, save_Scissor); SET_FeedbackBuffer(table, exec_FeedbackBuffer); SET_SelectBuffer(table, exec_SelectBuffer); SET_ShadeModel(table, save_ShadeModel); SET_StencilFunc(table, save_StencilFunc); SET_StencilMask(table, save_StencilMask); SET_StencilOp(table, save_StencilOp); SET_TexEnvf(table, save_TexEnvf); SET_TexEnvfv(table, save_TexEnvfv); SET_TexEnvi(table, save_TexEnvi); SET_TexEnviv(table, save_TexEnviv); SET_TexGend(table, save_TexGend); SET_TexGendv(table, save_TexGendv); SET_TexGenf(table, save_TexGenf); SET_TexGenfv(table, save_TexGenfv); SET_TexGeni(table, save_TexGeni); SET_TexGeniv(table, save_TexGeniv); SET_TexImage1D(table, save_TexImage1D); SET_TexImage2D(table, save_TexImage2D); SET_TexParameterf(table, save_TexParameterf); SET_TexParameterfv(table, save_TexParameterfv); SET_TexParameteri(table, save_TexParameteri); SET_TexParameteriv(table, save_TexParameteriv); SET_Translated(table, save_Translated); SET_Translatef(table, save_Translatef); SET_Viewport(table, save_Viewport); /* GL 1.1 */ SET_AreTexturesResident(table, exec_AreTexturesResident); SET_AreTexturesResidentEXT(table, exec_AreTexturesResident); SET_BindTexture(table, save_BindTexture); SET_ColorPointer(table, exec_ColorPointer); SET_CopyTexImage1D(table, save_CopyTexImage1D); SET_CopyTexImage2D(table, save_CopyTexImage2D); SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D); SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D); SET_DeleteTextures(table, exec_DeleteTextures); SET_DisableClientState(table, exec_DisableClientState); SET_EdgeFlagPointer(table, exec_EdgeFlagPointer); SET_EnableClientState(table, exec_EnableClientState); SET_GenTextures(table, exec_GenTextures); SET_GenTexturesEXT(table, exec_GenTextures); SET_GetPointerv(table, exec_GetPointerv); SET_IndexPointer(table, exec_IndexPointer); SET_InterleavedArrays(table, exec_InterleavedArrays); SET_IsTexture(table, exec_IsTexture); SET_IsTextureEXT(table, exec_IsTexture); SET_NormalPointer(table, exec_NormalPointer); SET_PopClientAttrib(table, exec_PopClientAttrib); SET_PrioritizeTextures(table, save_PrioritizeTextures); SET_PushClientAttrib(table, exec_PushClientAttrib); SET_TexCoordPointer(table, exec_TexCoordPointer); SET_TexSubImage1D(table, save_TexSubImage1D); SET_TexSubImage2D(table, save_TexSubImage2D); SET_VertexPointer(table, exec_VertexPointer); /* GL 1.2 */ SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D); SET_TexImage3D(table, save_TexImage3D); SET_TexSubImage3D(table, save_TexSubImage3D); /* GL 2.0 */ SET_StencilFuncSeparate(table, save_StencilFuncSeparate); SET_StencilMaskSeparate(table, save_StencilMaskSeparate); SET_StencilOpSeparate(table, save_StencilOpSeparate); /* GL_ARB_imaging */ /* Not all are supported */ SET_BlendColor(table, save_BlendColor); SET_BlendEquation(table, save_BlendEquation); SET_ColorSubTable(table, save_ColorSubTable); SET_ColorTable(table, save_ColorTable); SET_ColorTableParameterfv(table, save_ColorTableParameterfv); SET_ColorTableParameteriv(table, save_ColorTableParameteriv); SET_ConvolutionFilter1D(table, save_ConvolutionFilter1D); SET_ConvolutionFilter2D(table, save_ConvolutionFilter2D); SET_ConvolutionParameterf(table, save_ConvolutionParameterf); SET_ConvolutionParameterfv(table, save_ConvolutionParameterfv); SET_ConvolutionParameteri(table, save_ConvolutionParameteri); SET_ConvolutionParameteriv(table, save_ConvolutionParameteriv); SET_CopyColorSubTable(table, save_CopyColorSubTable); SET_CopyColorTable(table, save_CopyColorTable); SET_CopyConvolutionFilter1D(table, exec_CopyConvolutionFilter1D); SET_CopyConvolutionFilter2D(table, exec_CopyConvolutionFilter2D); SET_GetColorTable(table, exec_GetColorTable); SET_GetColorTableEXT(table, exec_GetColorTable); SET_GetColorTableParameterfv(table, exec_GetColorTableParameterfv); SET_GetColorTableParameterfvEXT(table, exec_GetColorTableParameterfv); SET_GetColorTableParameteriv(table, exec_GetColorTableParameteriv); SET_GetColorTableParameterivEXT(table, exec_GetColorTableParameteriv); SET_GetConvolutionFilter(table, exec_GetConvolutionFilter); SET_GetConvolutionFilterEXT(table, exec_GetConvolutionFilter); SET_GetConvolutionParameterfv(table, exec_GetConvolutionParameterfv); SET_GetConvolutionParameterfvEXT(table, exec_GetConvolutionParameterfv); SET_GetConvolutionParameteriv(table, exec_GetConvolutionParameteriv); SET_GetConvolutionParameterivEXT(table, exec_GetConvolutionParameteriv); SET_GetHistogram(table, exec_GetHistogram); SET_GetHistogramEXT(table, exec_GetHistogram); SET_GetHistogramParameterfv(table, exec_GetHistogramParameterfv); SET_GetHistogramParameterfvEXT(table, exec_GetHistogramParameterfv); SET_GetHistogramParameteriv(table, exec_GetHistogramParameteriv); SET_GetHistogramParameterivEXT(table, exec_GetHistogramParameteriv); SET_GetMinmax(table, exec_GetMinmax); SET_GetMinmaxEXT(table, exec_GetMinmax); SET_GetMinmaxParameterfv(table, exec_GetMinmaxParameterfv); SET_GetMinmaxParameterfvEXT(table, exec_GetMinmaxParameterfv); SET_GetMinmaxParameteriv(table, exec_GetMinmaxParameteriv); SET_GetMinmaxParameterivEXT(table, exec_GetMinmaxParameteriv); SET_GetSeparableFilter(table, exec_GetSeparableFilter); SET_GetSeparableFilterEXT(table, exec_GetSeparableFilter); SET_Histogram(table, save_Histogram); SET_Minmax(table, save_Minmax); SET_ResetHistogram(table, save_ResetHistogram); SET_ResetMinmax(table, save_ResetMinmax); SET_SeparableFilter2D(table, exec_SeparableFilter2D); /* 2. GL_EXT_blend_color */ #if 0 SET_BlendColorEXT(table, save_BlendColorEXT); #endif /* 3. GL_EXT_polygon_offset */ SET_PolygonOffsetEXT(table, save_PolygonOffsetEXT); /* 6. GL_EXT_texture3d */ #if 0 SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D); SET_TexImage3DEXT(table, save_TexImage3DEXT); SET_TexSubImage3DEXT(table, save_TexSubImage3D); #endif /* 15. GL_SGIX_pixel_texture */ SET_PixelTexGenSGIX(table, save_PixelTexGenSGIX); /* 15. GL_SGIS_pixel_texture */ SET_PixelTexGenParameteriSGIS(table, save_PixelTexGenParameteriSGIS); SET_PixelTexGenParameterfSGIS(table, save_PixelTexGenParameterfSGIS); SET_PixelTexGenParameterivSGIS(table, save_PixelTexGenParameterivSGIS); SET_PixelTexGenParameterfvSGIS(table, save_PixelTexGenParameterfvSGIS); SET_GetPixelTexGenParameterivSGIS(table, exec_GetPixelTexGenParameterivSGIS); SET_GetPixelTexGenParameterfvSGIS(table, exec_GetPixelTexGenParameterfvSGIS); /* 30. GL_EXT_vertex_array */ SET_ColorPointerEXT(table, exec_ColorPointerEXT); SET_EdgeFlagPointerEXT(table, exec_EdgeFlagPointerEXT); SET_IndexPointerEXT(table, exec_IndexPointerEXT); SET_NormalPointerEXT(table, exec_NormalPointerEXT); SET_TexCoordPointerEXT(table, exec_TexCoordPointerEXT); SET_VertexPointerEXT(table, exec_VertexPointerEXT); /* 37. GL_EXT_blend_minmax */ #if 0 SET_BlendEquationEXT(table, save_BlendEquationEXT); #endif /* 54. GL_EXT_point_parameters */ SET_PointParameterfEXT(table, save_PointParameterfEXT); SET_PointParameterfvEXT(table, save_PointParameterfvEXT); /* 78. GL_EXT_paletted_texture */ #if 0 SET_ColorTableEXT(table, save_ColorTable); SET_ColorSubTableEXT(table, save_ColorSubTable); #endif SET_GetColorTableEXT(table, exec_GetColorTable); SET_GetColorTableParameterfvEXT(table, exec_GetColorTableParameterfv); SET_GetColorTableParameterivEXT(table, exec_GetColorTableParameteriv); /* 97. GL_EXT_compiled_vertex_array */ SET_LockArraysEXT(table, exec_LockArraysEXT); SET_UnlockArraysEXT(table, exec_UnlockArraysEXT); /* 145. GL_EXT_secondary_color */ SET_SecondaryColorPointerEXT(table, exec_SecondaryColorPointerEXT); /* 148. GL_EXT_multi_draw_arrays */ SET_MultiDrawArraysEXT(table, exec_MultiDrawArraysEXT); SET_MultiDrawElementsEXT(table, exec_MultiDrawElementsEXT); /* 149. GL_EXT_fog_coord */ SET_FogCoordPointerEXT(table, exec_FogCoordPointerEXT); /* 173. GL_EXT_blend_func_separate */ SET_BlendFuncSeparateEXT(table, save_BlendFuncSeparateEXT); /* 196. GL_MESA_resize_buffers */ SET_ResizeBuffersMESA(table, _mesa_ResizeBuffersMESA); /* 197. GL_MESA_window_pos */ SET_WindowPos2dMESA(table, save_WindowPos2dMESA); SET_WindowPos2dvMESA(table, save_WindowPos2dvMESA); SET_WindowPos2fMESA(table, save_WindowPos2fMESA); SET_WindowPos2fvMESA(table, save_WindowPos2fvMESA); SET_WindowPos2iMESA(table, save_WindowPos2iMESA); SET_WindowPos2ivMESA(table, save_WindowPos2ivMESA); SET_WindowPos2sMESA(table, save_WindowPos2sMESA); SET_WindowPos2svMESA(table, save_WindowPos2svMESA); SET_WindowPos3dMESA(table, save_WindowPos3dMESA); SET_WindowPos3dvMESA(table, save_WindowPos3dvMESA); SET_WindowPos3fMESA(table, save_WindowPos3fMESA); SET_WindowPos3fvMESA(table, save_WindowPos3fvMESA); SET_WindowPos3iMESA(table, save_WindowPos3iMESA); SET_WindowPos3ivMESA(table, save_WindowPos3ivMESA); SET_WindowPos3sMESA(table, save_WindowPos3sMESA); SET_WindowPos3svMESA(table, save_WindowPos3svMESA); SET_WindowPos4dMESA(table, save_WindowPos4dMESA); SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA); SET_WindowPos4fMESA(table, save_WindowPos4fMESA); SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA); SET_WindowPos4iMESA(table, save_WindowPos4iMESA); SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA); SET_WindowPos4sMESA(table, save_WindowPos4sMESA); SET_WindowPos4svMESA(table, save_WindowPos4svMESA); /* 200. GL_IBM_multimode_draw_arrays */ SET_MultiModeDrawArraysIBM(table, exec_MultiModeDrawArraysIBM); SET_MultiModeDrawElementsIBM(table, exec_MultiModeDrawElementsIBM); #if FEATURE_NV_vertex_program /* 233. GL_NV_vertex_program */ /* The following commands DO NOT go into display lists: * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV, * VertexAttribPointerNV, GetProgram*, GetVertexAttrib* */ SET_BindProgramNV(table, save_BindProgramNV); SET_DeleteProgramsNV(table, _mesa_DeletePrograms); SET_ExecuteProgramNV(table, save_ExecuteProgramNV); SET_GenProgramsNV(table, _mesa_GenPrograms); SET_AreProgramsResidentNV(table, _mesa_AreProgramsResidentNV); SET_RequestResidentProgramsNV(table, save_RequestResidentProgramsNV); SET_GetProgramParameterfvNV(table, _mesa_GetProgramParameterfvNV); SET_GetProgramParameterdvNV(table, _mesa_GetProgramParameterdvNV); SET_GetProgramivNV(table, _mesa_GetProgramivNV); SET_GetProgramStringNV(table, _mesa_GetProgramStringNV); SET_GetTrackMatrixivNV(table, _mesa_GetTrackMatrixivNV); SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV); SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV); SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV); SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV); SET_IsProgramNV(table, _mesa_IsProgram); SET_LoadProgramNV(table, save_LoadProgramNV); SET_ProgramParameter4dNV(table, save_ProgramParameter4dNV); SET_ProgramParameter4dvNV(table, save_ProgramParameter4dvNV); SET_ProgramParameter4fNV(table, save_ProgramParameter4fNV); SET_ProgramParameter4fvNV(table, save_ProgramParameter4fvNV); SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV); SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV); SET_TrackMatrixNV(table, save_TrackMatrixNV); SET_VertexAttribPointerNV(table, _mesa_VertexAttribPointerNV); #endif /* 245. GL_ATI_fragment_shader */ #if FEATURE_ATI_fragment_shader SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI); SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI); #endif /* 282. GL_NV_fragment_program */ #if FEATURE_NV_fragment_program SET_ProgramNamedParameter4fNV(table, save_ProgramNamedParameter4fNV); SET_ProgramNamedParameter4dNV(table, save_ProgramNamedParameter4dNV); SET_ProgramNamedParameter4fvNV(table, save_ProgramNamedParameter4fvNV); SET_ProgramNamedParameter4dvNV(table, save_ProgramNamedParameter4dvNV); SET_GetProgramNamedParameterfvNV(table, _mesa_GetProgramNamedParameterfvNV); SET_GetProgramNamedParameterdvNV(table, _mesa_GetProgramNamedParameterdvNV); SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB); SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB); SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB); SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB); SET_GetProgramLocalParameterdvARB(table, _mesa_GetProgramLocalParameterdvARB); SET_GetProgramLocalParameterfvARB(table, _mesa_GetProgramLocalParameterfvARB); #endif /* 262. GL_NV_point_sprite */ SET_PointParameteriNV(table, save_PointParameteriNV); SET_PointParameterivNV(table, save_PointParameterivNV); /* 268. GL_EXT_stencil_two_side */ SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT); /* ???. GL_EXT_depth_bounds_test */ SET_DepthBoundsEXT(table, save_DepthBoundsEXT); /* ARB 1. GL_ARB_multitexture */ SET_ActiveTextureARB(table, save_ActiveTextureARB); SET_ClientActiveTextureARB(table, exec_ClientActiveTextureARB); /* ARB 3. GL_ARB_transpose_matrix */ SET_LoadTransposeMatrixdARB(table, save_LoadTransposeMatrixdARB); SET_LoadTransposeMatrixfARB(table, save_LoadTransposeMatrixfARB); SET_MultTransposeMatrixdARB(table, save_MultTransposeMatrixdARB); SET_MultTransposeMatrixfARB(table, save_MultTransposeMatrixfARB); /* ARB 5. GL_ARB_multisample */ SET_SampleCoverageARB(table, save_SampleCoverageARB); /* ARB 12. GL_ARB_texture_compression */ SET_CompressedTexImage3DARB(table, save_CompressedTexImage3DARB); SET_CompressedTexImage2DARB(table, save_CompressedTexImage2DARB); SET_CompressedTexImage1DARB(table, save_CompressedTexImage1DARB); SET_CompressedTexSubImage3DARB(table, save_CompressedTexSubImage3DARB); SET_CompressedTexSubImage2DARB(table, save_CompressedTexSubImage2DARB); SET_CompressedTexSubImage1DARB(table, save_CompressedTexSubImage1DARB); SET_GetCompressedTexImageARB(table, exec_GetCompressedTexImageARB); /* ARB 14. GL_ARB_point_parameters */ /* aliased with EXT_point_parameters functions */ /* ARB 25. GL_ARB_window_pos */ /* aliased with MESA_window_pos functions */ /* ARB 26. GL_ARB_vertex_program */ /* ARB 27. GL_ARB_fragment_program */ #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program /* glVertexAttrib* functions alias the NV ones, handled elsewhere */ SET_VertexAttribPointerARB(table, _mesa_VertexAttribPointerARB); SET_EnableVertexAttribArrayARB(table, _mesa_EnableVertexAttribArrayARB); SET_DisableVertexAttribArrayARB(table, _mesa_DisableVertexAttribArrayARB); SET_ProgramStringARB(table, save_ProgramStringARB); SET_BindProgramNV(table, save_BindProgramNV); SET_DeleteProgramsNV(table, _mesa_DeletePrograms); SET_GenProgramsNV(table, _mesa_GenPrograms); SET_IsProgramNV(table, _mesa_IsProgram); SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV); SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV); SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV); SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV); SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB); SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB); SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB); SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB); SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB); SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB); SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB); SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB); SET_GetProgramEnvParameterdvARB(table, _mesa_GetProgramEnvParameterdvARB); SET_GetProgramEnvParameterfvARB(table, _mesa_GetProgramEnvParameterfvARB); SET_GetProgramLocalParameterdvARB(table, _mesa_GetProgramLocalParameterdvARB); SET_GetProgramLocalParameterfvARB(table, _mesa_GetProgramLocalParameterfvARB); SET_GetProgramivARB(table, _mesa_GetProgramivARB); SET_GetProgramStringARB(table, _mesa_GetProgramStringARB); #endif /* ARB 28. GL_ARB_vertex_buffer_object */ #if FEATURE_ARB_vertex_buffer_object /* None of the extension's functions get compiled */ SET_BindBufferARB(table, _mesa_BindBufferARB); SET_BufferDataARB(table, _mesa_BufferDataARB); SET_BufferSubDataARB(table, _mesa_BufferSubDataARB); SET_DeleteBuffersARB(table, _mesa_DeleteBuffersARB); SET_GenBuffersARB(table, _mesa_GenBuffersARB); SET_GetBufferParameterivARB(table, _mesa_GetBufferParameterivARB); SET_GetBufferPointervARB(table, _mesa_GetBufferPointervARB); SET_GetBufferSubDataARB(table, _mesa_GetBufferSubDataARB); SET_IsBufferARB(table, _mesa_IsBufferARB); SET_MapBufferARB(table, _mesa_MapBufferARB); SET_UnmapBufferARB(table, _mesa_UnmapBufferARB); #endif #if FEATURE_ARB_occlusion_query SET_BeginQueryARB(table, save_BeginQueryARB); SET_EndQueryARB(table, save_EndQueryARB); SET_GenQueriesARB(table, _mesa_GenQueriesARB); SET_DeleteQueriesARB(table, _mesa_DeleteQueriesARB); SET_IsQueryARB(table, _mesa_IsQueryARB); SET_GetQueryivARB(table, _mesa_GetQueryivARB); SET_GetQueryObjectivARB(table, _mesa_GetQueryObjectivARB); SET_GetQueryObjectuivARB(table, _mesa_GetQueryObjectuivARB); #endif SET_DrawBuffersARB(table, save_DrawBuffersARB); /* 299. GL_EXT_blend_equation_separate */ SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT); } /*** *** Debugging code ***/ static const char *enum_string( GLenum k ) { return _mesa_lookup_enum_by_nr( k ); } /* * Print the commands in a display list. For debugging only. * TODO: many commands aren't handled yet. */ static void GLAPIENTRY print_list( GLcontext *ctx, GLuint list ) { struct mesa_display_list *dlist; Node *n; GLboolean done; if (!CALL_IsList(GET_DISPATCH(), (list))) { _mesa_printf("%u is not a display list ID\n", list); return; } dlist = (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list); if (!dlist) return; n = dlist->node; _mesa_printf("START-LIST %u, address %p\n", list, (void*)n ); done = n ? GL_FALSE : GL_TRUE; while (!done) { OpCode opcode = n[0].opcode; GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0; if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { /* this is a driver-extended opcode */ ctx->ListExt.Opcode[i].Print(ctx, &n[1]); n += ctx->ListExt.Opcode[i].Size; } else { switch (opcode) { case OPCODE_ACCUM: _mesa_printf("accum %s %g\n", enum_string(n[1].e), n[2].f ); break; case OPCODE_BITMAP: _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f, (void *) n[7].data ); break; case OPCODE_CALL_LIST: _mesa_printf("CallList %d\n", (int) n[1].ui ); break; case OPCODE_CALL_LIST_OFFSET: _mesa_printf("CallList %d + offset %u = %u\n", (int) n[1].ui, ctx->List.ListBase, ctx->List.ListBase + n[1].ui ); break; case OPCODE_COLOR_TABLE_PARAMETER_FV: _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n", enum_string(n[1].e), enum_string(n[2].e), n[3].f, n[4].f, n[5].f, n[6].f); break; case OPCODE_COLOR_TABLE_PARAMETER_IV: _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n", enum_string(n[1].e), enum_string(n[2].e), n[3].i, n[4].i, n[5].i, n[6].i); break; case OPCODE_DISABLE: _mesa_printf("Disable %s\n", enum_string(n[1].e)); break; case OPCODE_ENABLE: _mesa_printf("Enable %s\n", enum_string(n[1].e)); break; case OPCODE_FRUSTUM: _mesa_printf("Frustum %g %g %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f ); break; case OPCODE_LINE_STIPPLE: _mesa_printf("LineStipple %d %x\n", n[1].i, (int) n[2].us ); break; case OPCODE_LOAD_IDENTITY: _mesa_printf("LoadIdentity\n"); break; case OPCODE_LOAD_MATRIX: _mesa_printf("LoadMatrix\n"); _mesa_printf(" %8f %8f %8f %8f\n", n[1].f, n[5].f, n[9].f, n[13].f); _mesa_printf(" %8f %8f %8f %8f\n", n[2].f, n[6].f, n[10].f, n[14].f); _mesa_printf(" %8f %8f %8f %8f\n", n[3].f, n[7].f, n[11].f, n[15].f); _mesa_printf(" %8f %8f %8f %8f\n", n[4].f, n[8].f, n[12].f, n[16].f); break; case OPCODE_MULT_MATRIX: _mesa_printf("MultMatrix (or Rotate)\n"); _mesa_printf(" %8f %8f %8f %8f\n", n[1].f, n[5].f, n[9].f, n[13].f); _mesa_printf(" %8f %8f %8f %8f\n", n[2].f, n[6].f, n[10].f, n[14].f); _mesa_printf(" %8f %8f %8f %8f\n", n[3].f, n[7].f, n[11].f, n[15].f); _mesa_printf(" %8f %8f %8f %8f\n", n[4].f, n[8].f, n[12].f, n[16].f); break; case OPCODE_ORTHO: _mesa_printf("Ortho %g %g %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f ); break; case OPCODE_POP_ATTRIB: _mesa_printf("PopAttrib\n"); break; case OPCODE_POP_MATRIX: _mesa_printf("PopMatrix\n"); break; case OPCODE_POP_NAME: _mesa_printf("PopName\n"); break; case OPCODE_PUSH_ATTRIB: _mesa_printf("PushAttrib %x\n", n[1].bf ); break; case OPCODE_PUSH_MATRIX: _mesa_printf("PushMatrix\n"); break; case OPCODE_PUSH_NAME: _mesa_printf("PushName %d\n", (int) n[1].ui ); break; case OPCODE_RASTER_POS: _mesa_printf("RasterPos %g %g %g %g\n", n[1].f, n[2].f,n[3].f,n[4].f); break; case OPCODE_ROTATE: _mesa_printf("Rotate %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f ); break; case OPCODE_SCALE: _mesa_printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f ); break; case OPCODE_TRANSLATE: _mesa_printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f ); break; case OPCODE_BIND_TEXTURE: _mesa_printf("BindTexture %s %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui); break; case OPCODE_SHADE_MODEL: _mesa_printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui)); break; case OPCODE_MAP1: _mesa_printf("Map1 %s %.3f %.3f %d %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].f, n[3].f, n[4].i, n[5].i); break; case OPCODE_MAP2: _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].f, n[3].f, n[4].f, n[5].f, n[6].i, n[7].i, n[8].i, n[9].i); break; case OPCODE_MAPGRID1: _mesa_printf("MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f); break; case OPCODE_MAPGRID2: _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f); break; case OPCODE_EVALMESH1: _mesa_printf("EvalMesh1 %d %d\n", n[1].i, n[2].i); break; case OPCODE_EVALMESH2: _mesa_printf("EvalMesh2 %d %d %d %d\n", n[1].i, n[2].i, n[3].i, n[4].i); break; case OPCODE_ATTR_1F_NV: _mesa_printf("ATTR_1F_NV attr %d: %f\n", n[1].i, n[2].f); break; case OPCODE_ATTR_2F_NV: _mesa_printf("ATTR_2F_NV attr %d: %f %f\n", n[1].i, n[2].f, n[3].f); break; case OPCODE_ATTR_3F_NV: _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f); break; case OPCODE_ATTR_4F_NV: _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f, n[5].f); break; case OPCODE_ATTR_1F_ARB: _mesa_printf("ATTR_1F_ARB attr %d: %f\n", n[1].i, n[2].f); break; case OPCODE_ATTR_2F_ARB: _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n", n[1].i, n[2].f, n[3].f); break; case OPCODE_ATTR_3F_ARB: _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f); break; case OPCODE_ATTR_4F_ARB: _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n", n[1].i, n[2].f, n[3].f, n[4].f, n[5].f); break; case OPCODE_MATERIAL: _mesa_printf("MATERIAL %x %x: %f %f %f %f\n", n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f); break; case OPCODE_INDEX: _mesa_printf("INDEX: %f\n", n[1].f); break; case OPCODE_EDGEFLAG: _mesa_printf("EDGEFLAG: %d\n", n[1].i); break; case OPCODE_BEGIN: _mesa_printf("BEGIN %x\n", n[1].i); break; case OPCODE_END: _mesa_printf("END\n"); break; case OPCODE_RECTF: _mesa_printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f, n[4].f); break; case OPCODE_EVAL_C1: _mesa_printf("EVAL_C1 %f\n", n[1].f); break; case OPCODE_EVAL_C2: _mesa_printf("EVAL_C2 %f %f\n", n[1].f, n[2].f); break; case OPCODE_EVAL_P1: _mesa_printf("EVAL_P1 %d\n", n[1].i); break; case OPCODE_EVAL_P2: _mesa_printf("EVAL_P2 %d %d\n", n[1].i, n[2].i); break; /* * meta opcodes/commands */ case OPCODE_ERROR: _mesa_printf("Error: %s %s\n", enum_string(n[1].e), (const char *)n[2].data ); break; case OPCODE_CONTINUE: _mesa_printf("DISPLAY-LIST-CONTINUE\n"); n = (Node *) n[1].next; break; case OPCODE_END_OF_LIST: _mesa_printf("END-LIST %u\n", list); done = GL_TRUE; break; default: if (opcode < 0 || opcode > OPCODE_END_OF_LIST) { _mesa_printf("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n", opcode, (void*) n); return; } else { _mesa_printf("command %d, %u operands\n", opcode, InstSize[opcode]); } } /* increment n to point to next compiled command */ if (opcode!=OPCODE_CONTINUE) { n += InstSize[opcode]; } } } } /* * Clients may call this function to help debug display list problems. * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed, * changed, or break in the future without notice. */ void mesa_print_display_list( GLuint list ) { GET_CURRENT_CONTEXT(ctx); print_list( ctx, list ); } /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ void _mesa_save_vtxfmt_init( GLvertexformat *vfmt ) { vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ vfmt->Begin = save_Begin; vfmt->CallList = _mesa_save_CallList; vfmt->CallLists = _mesa_save_CallLists; vfmt->Color3f = save_Color3f; vfmt->Color3fv = save_Color3fv; vfmt->Color4f = save_Color4f; vfmt->Color4fv = save_Color4fv; vfmt->EdgeFlag = save_EdgeFlag; vfmt->EdgeFlagv = save_EdgeFlagv; vfmt->End = save_End; vfmt->EvalCoord1f = save_EvalCoord1f; vfmt->EvalCoord1fv = save_EvalCoord1fv; vfmt->EvalCoord2f = save_EvalCoord2f; vfmt->EvalCoord2fv = save_EvalCoord2fv; vfmt->EvalPoint1 = save_EvalPoint1; vfmt->EvalPoint2 = save_EvalPoint2; vfmt->FogCoordfEXT = save_FogCoordfEXT; vfmt->FogCoordfvEXT = save_FogCoordfvEXT; vfmt->Indexf = save_Indexf; vfmt->Indexfv = save_Indexfv; vfmt->Materialfv = save_Materialfv; vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f; vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv; vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f; vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv; vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f; vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv; vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f; vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv; vfmt->Normal3f = save_Normal3f; vfmt->Normal3fv = save_Normal3fv; vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT; vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT; vfmt->TexCoord1f = save_TexCoord1f; vfmt->TexCoord1fv = save_TexCoord1fv; vfmt->TexCoord2f = save_TexCoord2f; vfmt->TexCoord2fv = save_TexCoord2fv; vfmt->TexCoord3f = save_TexCoord3f; vfmt->TexCoord3fv = save_TexCoord3fv; vfmt->TexCoord4f = save_TexCoord4f; vfmt->TexCoord4fv = save_TexCoord4fv; vfmt->Vertex2f = save_Vertex2f; vfmt->Vertex2fv = save_Vertex2fv; vfmt->Vertex3f = save_Vertex3f; vfmt->Vertex3fv = save_Vertex3fv; vfmt->Vertex4f = save_Vertex4f; vfmt->Vertex4fv = save_Vertex4fv; vfmt->VertexAttrib1fNV = save_VertexAttrib1fNV; vfmt->VertexAttrib1fvNV = save_VertexAttrib1fvNV; vfmt->VertexAttrib2fNV = save_VertexAttrib2fNV; vfmt->VertexAttrib2fvNV = save_VertexAttrib2fvNV; vfmt->VertexAttrib3fNV = save_VertexAttrib3fNV; vfmt->VertexAttrib3fvNV = save_VertexAttrib3fvNV; vfmt->VertexAttrib4fNV = save_VertexAttrib4fNV; vfmt->VertexAttrib4fvNV = save_VertexAttrib4fvNV; vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB; vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB; vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB; vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB; vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB; vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB; vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB; vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB; vfmt->EvalMesh1 = _mesa_save_EvalMesh1; vfmt->EvalMesh2 = _mesa_save_EvalMesh2; vfmt->Rectf = save_Rectf; /* The driver is required to implement these as * 1) They can probably do a better job. * 2) A lot of new mechanisms would have to be added to this module * to support it. That code would probably never get used, * because of (1). */ #if 0 vfmt->DrawArrays = 0; vfmt->DrawElements = 0; vfmt->DrawRangeElements = 0; #endif } void _mesa_init_display_list( GLcontext * ctx ) { /* Display list */ ctx->ListState.CallDepth = 0; ctx->ExecuteFlag = GL_TRUE; ctx->CompileFlag = GL_FALSE; ctx->ListState.CurrentListPtr = NULL; ctx->ListState.CurrentBlock = NULL; ctx->ListState.CurrentListNum = 0; ctx->ListState.CurrentPos = 0; /* Display List group */ ctx->List.ListBase = 0; _mesa_save_vtxfmt_init( &ctx->ListState.ListVtxfmt ); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/dlist.h0000644000000000000000000000626513614532424017442 0ustar /** * \file dlist.h * Display lists management. */ /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef DLIST_H #define DLIST_H #include "mtypes.h" #if _HAVE_FULL_GL extern void _mesa_init_lists( void ); extern void _mesa_destroy_list( GLcontext *ctx, GLuint list ); extern void GLAPIENTRY _mesa_CallList( GLuint list ); extern void GLAPIENTRY _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); extern void GLAPIENTRY _mesa_DeleteLists( GLuint list, GLsizei range ); extern void GLAPIENTRY _mesa_EndList( void ); extern GLuint GLAPIENTRY _mesa_GenLists( GLsizei range ); extern GLboolean GLAPIENTRY _mesa_IsList( GLuint list ); extern void GLAPIENTRY _mesa_ListBase( GLuint base ); extern void GLAPIENTRY _mesa_NewList( GLuint list, GLenum mode ); extern void _mesa_init_dlist_table( struct _glapi_table *table ); extern void _mesa_save_error( GLcontext *ctx, GLenum error, const char *s ); extern void _mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ); extern void *_mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz ); extern GLint _mesa_alloc_opcode( GLcontext *ctx, GLuint sz, void (*execute)( GLcontext *, void * ), void (*destroy)( GLcontext *, void * ), void (*print)( GLcontext *, void * ) ); extern void GLAPIENTRY _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); extern void GLAPIENTRY _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ); extern void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); extern void GLAPIENTRY _mesa_save_CallList( GLuint list ); extern void _mesa_init_display_list( GLcontext * ctx ); extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt ); #else /** No-op */ #define _mesa_init_lists() ((void)0) /** No-op */ #define _mesa_destroy_list(c,l) ((void)0) /** No-op */ #define _mesa_init_dlist_table(t,ts) ((void)0) /** No-op */ #define _mesa_init_display_list(c) ((void)0) /** No-op */ #define _mesa_save_vtxfmt_init(v) ((void)0) #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/drawpix.c0000644000000000000000000002367113614532424017774 0ustar /* * Mesa 3-D graphics library * Version: 6.4 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "imports.h" #include "colormac.h" #include "context.h" #include "drawpix.h" #include "feedback.h" #include "macros.h" #include "state.h" #include "mtypes.h" #if _HAVE_FULL_GL /* * Execute glDrawPixels */ void GLAPIENTRY _mesa_DrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels (invalid fragment program)"); return; } if (width < 0 || height < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glDrawPixels(width or height < 0" ); return; } if (ctx->NewState) { _mesa_update_state(ctx); } if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "glDrawPixels(incomplete framebuffer)" ); return; } if (!ctx->Current.RasterPosValid) { return; } if (ctx->RenderMode == GL_RENDER) { /* Round, to satisfy conformance tests (matches SGI's OpenGL) */ GLint x = IROUND(ctx->Current.RasterPos[0]); GLint y = IROUND(ctx->Current.RasterPos[1]); ctx->OcclusionResult = GL_TRUE; ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type, &ctx->Unpack, pixels); } else if (ctx->RenderMode == GL_FEEDBACK) { /* Feedback the current raster pos info */ FLUSH_CURRENT( ctx, 0 ); FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); _mesa_feedback_vertex( ctx, ctx->Current.RasterPos, ctx->Current.RasterColor, ctx->Current.RasterIndex, ctx->Current.RasterTexCoords[0] ); } else { ASSERT(ctx->RenderMode == GL_SELECT); /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ } } void GLAPIENTRY _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLenum type ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyPixels (invalid fragment program)"); return; } if (width < 0 || height < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glCopyPixels(width or height < 0)" ); return; } if (ctx->NewState) { _mesa_update_state(ctx); } if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT || ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "glCopyPixels(incomplete framebuffer)" ); return; } if (!ctx->Current.RasterPosValid) { return; } if (ctx->RenderMode == GL_RENDER) { /* Round to satisfy conformance tests (matches SGI's OpenGL) */ GLint destx = IROUND(ctx->Current.RasterPos[0]); GLint desty = IROUND(ctx->Current.RasterPos[1]); ctx->OcclusionResult = GL_TRUE; ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty, type ); } else if (ctx->RenderMode == GL_FEEDBACK) { FLUSH_CURRENT( ctx, 0 ); FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN ); _mesa_feedback_vertex( ctx, ctx->Current.RasterPos, ctx->Current.RasterColor, ctx->Current.RasterIndex, ctx->Current.RasterTexCoords[0] ); } else { ASSERT(ctx->RenderMode == GL_SELECT); /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ } } #endif /* _HAVE_FULL_GL */ void GLAPIENTRY _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); const struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (width < 0 || height < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glReadPixels(width=%d height=%d)", width, height ); return; } if (ctx->NewState) _mesa_update_state(ctx); if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "glReadPixels(incomplete framebuffer)" ); return; } if (!rb) { _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(no readbuffer)"); return; } ctx->Driver.ReadPixels(ctx, x, y, width, height, format, type, &ctx->Pack, pixels); } void GLAPIENTRY _mesa_Bitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap (invalid fragment program)"); return; } if (width < 0 || height < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glBitmap(width or height < 0)" ); return; } if (!ctx->Current.RasterPosValid) { return; /* do nothing */ } if (ctx->NewState) { _mesa_update_state(ctx); } if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "glBitmap(incomplete framebuffer)"); return; } if (ctx->RenderMode == GL_RENDER) { /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); ctx->OcclusionResult = GL_TRUE; ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); } #if _HAVE_FULL_GL else if (ctx->RenderMode == GL_FEEDBACK) { FLUSH_CURRENT(ctx, 0); FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN ); _mesa_feedback_vertex( ctx, ctx->Current.RasterPos, ctx->Current.RasterColor, ctx->Current.RasterIndex, ctx->Current.RasterTexCoords[0] ); } else { ASSERT(ctx->RenderMode == GL_SELECT); /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ } #endif /* update raster position */ ctx->Current.RasterPos[0] += xmove; ctx->Current.RasterPos[1] += ymove; } #if 0 /* experimental */ /* * Execute glDrawDepthPixelsMESA(). This function accepts both a color * image and depth (Z) image. Rasterization produces fragments with * color and Z taken from these images. This function is intended for * Z-compositing. Normally, this operation requires two glDrawPixels * calls with stencil testing. */ void GLAPIENTRY _mesa_DrawDepthPixelsMESA( GLsizei width, GLsizei height, GLenum colorFormat, GLenum colorType, const GLvoid *colors, GLenum depthType, const GLvoid *depths ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (width < 0 || height < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glDrawDepthPixelsMESA(width or height < 0" ); return; } if (!ctx->Current.RasterPosValid) { return; } if (ctx->NewState) { _mesa_update_state(ctx); } if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "glDrawDepthPixelsMESA(incomplete framebuffer)"); return; } if (ctx->RenderMode == GL_RENDER) { /* Round, to satisfy conformance tests (matches SGI's OpenGL) */ GLint x = IROUND(ctx->Current.RasterPos[0]); GLint y = IROUND(ctx->Current.RasterPos[1]); ctx->OcclusionResult = GL_TRUE; ctx->Driver.DrawDepthPixelsMESA(ctx, x, y, width, height, colorFormat, colorType, colors, depthType, depths, &ctx->Unpack); } else if (ctx->RenderMode == GL_FEEDBACK) { /* Feedback the current raster pos info */ FLUSH_CURRENT( ctx, 0 ); FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); _mesa_feedback_vertex( ctx, ctx->Current.RasterPos, ctx->Current.RasterColor, ctx->Current.RasterIndex, ctx->Current.RasterTexCoords[0] ); } else { ASSERT(ctx->RenderMode == GL_SELECT); /* Do nothing. See OpenGL Spec, Appendix B, Corollary 6. */ } } #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/drawpix.h0000644000000000000000000000350313614532424017771 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef DRAWPIXELS_H #define DRAWPIXELS_H #include "mtypes.h" extern void GLAPIENTRY _mesa_DrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); extern void GLAPIENTRY _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ); extern void GLAPIENTRY _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLenum type ); extern void GLAPIENTRY _mesa_Bitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/enable.c0000644000000000000000000014007713614532424017544 0ustar /** * \file enable.c * Enable/disable/query GL capabilities. */ /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "context.h" #include "enable.h" #include "light.h" #include "macros.h" #include "simple_list.h" #include "mtypes.h" #include "enums.h" #include "math/m_matrix.h" #include "math/m_xform.h" #define CHECK_EXTENSION(EXTNAME, CAP) \ if (!ctx->Extensions.EXTNAME) { \ _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)", \ state ? "Enable" : "Disable", CAP); \ return; \ } static void client_state( GLcontext *ctx, GLenum cap, GLboolean state ) { GLuint flag; GLuint *var; switch (cap) { case GL_VERTEX_ARRAY: var = &ctx->Array.Vertex.Enabled; flag = _NEW_ARRAY_VERTEX; break; case GL_NORMAL_ARRAY: var = &ctx->Array.Normal.Enabled; flag = _NEW_ARRAY_NORMAL; break; case GL_COLOR_ARRAY: var = &ctx->Array.Color.Enabled; flag = _NEW_ARRAY_COLOR0; break; case GL_INDEX_ARRAY: var = &ctx->Array.Index.Enabled; flag = _NEW_ARRAY_INDEX; break; case GL_TEXTURE_COORD_ARRAY: var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture); break; case GL_EDGE_FLAG_ARRAY: var = &ctx->Array.EdgeFlag.Enabled; flag = _NEW_ARRAY_EDGEFLAG; break; case GL_FOG_COORDINATE_ARRAY_EXT: var = &ctx->Array.FogCoord.Enabled; flag = _NEW_ARRAY_FOGCOORD; break; case GL_SECONDARY_COLOR_ARRAY_EXT: var = &ctx->Array.SecondaryColor.Enabled; flag = _NEW_ARRAY_COLOR1; break; #if FEATURE_NV_vertex_program case GL_VERTEX_ATTRIB_ARRAY0_NV: case GL_VERTEX_ATTRIB_ARRAY1_NV: case GL_VERTEX_ATTRIB_ARRAY2_NV: case GL_VERTEX_ATTRIB_ARRAY3_NV: case GL_VERTEX_ATTRIB_ARRAY4_NV: case GL_VERTEX_ATTRIB_ARRAY5_NV: case GL_VERTEX_ATTRIB_ARRAY6_NV: case GL_VERTEX_ATTRIB_ARRAY7_NV: case GL_VERTEX_ATTRIB_ARRAY8_NV: case GL_VERTEX_ATTRIB_ARRAY9_NV: case GL_VERTEX_ATTRIB_ARRAY10_NV: case GL_VERTEX_ATTRIB_ARRAY11_NV: case GL_VERTEX_ATTRIB_ARRAY12_NV: case GL_VERTEX_ATTRIB_ARRAY13_NV: case GL_VERTEX_ATTRIB_ARRAY14_NV: case GL_VERTEX_ATTRIB_ARRAY15_NV: CHECK_EXTENSION(NV_vertex_program, cap); { GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; var = &ctx->Array.VertexAttrib[n].Enabled; flag = _NEW_ARRAY_ATTRIB(n); } break; #endif /* FEATURE_NV_vertex_program */ default: _mesa_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState(0x%x)", cap); return; } if (*var == state) return; FLUSH_VERTICES(ctx, _NEW_ARRAY); ctx->Array.NewState |= flag; *var = state; if (state) ctx->Array._Enabled |= flag; else ctx->Array._Enabled &= ~flag; if (ctx->Driver.Enable) { (*ctx->Driver.Enable)( ctx, cap, state ); } } /** * Enable GL capability. * * \param cap capability. * * \sa glEnable(). * * Get's the current context, assures that we're outside glBegin()/glEnd() and * calls client_state(). */ void GLAPIENTRY _mesa_EnableClientState( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); client_state( ctx, cap, GL_TRUE ); } /** * Disable GL capability. * * \param cap capability. * * \sa glDisable(). * * Get's the current context, assures that we're outside glBegin()/glEnd() and * calls client_state(). */ void GLAPIENTRY _mesa_DisableClientState( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); client_state( ctx, cap, GL_FALSE ); } #undef CHECK_EXTENSION #define CHECK_EXTENSION(EXTNAME, CAP) \ if (!ctx->Extensions.EXTNAME) { \ _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \ state ? "Enable" : "Disable", CAP); \ return; \ } #define CHECK_EXTENSION2(EXT1, EXT2, CAP) \ if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \ _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \ state ? "Enable" : "Disable", CAP); \ return; \ } /** * Perform glEnable() and glDisable() calls. * * \param ctx GL context. * \param cap capability. * \param state whether to enable or disable the specified capability. * * Updates the current context and flushes the vertices as needed. For * capabilities associated with extensions it verifies that those extensions * are effectivly present before updating. Notifies the driver via * dd_function_table::Enable. */ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) { if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "%s %s (newstate is %x)\n", state ? "glEnable" : "glDisable", _mesa_lookup_enum_by_nr(cap), ctx->NewState); switch (cap) { case GL_ALPHA_TEST: if (ctx->Color.AlphaEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.AlphaEnabled = state; break; case GL_AUTO_NORMAL: if (ctx->Eval.AutoNormal == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.AutoNormal = state; break; case GL_BLEND: if (ctx->Color.BlendEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.BlendEnabled = state; /* This is needed to support 1.1's RGB logic ops AND * 1.0's blending logicops. */ ctx->Color._LogicOpEnabled = (ctx->Color.ColorLogicOpEnabled || (state && ctx->Color.BlendEquationRGB == GL_LOGIC_OP)); break; #if FEATURE_userclip case GL_CLIP_PLANE0: case GL_CLIP_PLANE1: case GL_CLIP_PLANE2: case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: { const GLuint p = cap - GL_CLIP_PLANE0; if ((ctx->Transform.ClipPlanesEnabled & (1 << p)) == ((GLuint) state << p)) return; FLUSH_VERTICES(ctx, _NEW_TRANSFORM); if (state) { ctx->Transform.ClipPlanesEnabled |= (1 << p); if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top)) _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); /* This derived state also calculated in clip.c and * from _mesa_update_state() on changes to EyeUserPlane * and ctx->ProjectionMatrix respectively. */ _mesa_transform_vector( ctx->Transform._ClipUserPlane[p], ctx->Transform.EyeUserPlane[p], ctx->ProjectionMatrixStack.Top->inv ); } else { ctx->Transform.ClipPlanesEnabled &= ~(1 << p); } } break; #endif case GL_COLOR_MATERIAL: if (ctx->Light.ColorMaterialEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); FLUSH_CURRENT(ctx, 0); ctx->Light.ColorMaterialEnabled = state; if (state) { _mesa_update_color_material( ctx, ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); } break; case GL_CULL_FACE: if (ctx->Polygon.CullFlag == state) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.CullFlag = state; break; case GL_CULL_VERTEX_EXT: CHECK_EXTENSION(EXT_cull_vertex, cap); if (ctx->Transform.CullVertexFlag == state) return; FLUSH_VERTICES(ctx, _NEW_TRANSFORM); ctx->Transform.CullVertexFlag = state; break; case GL_DEPTH_TEST: if (state && ctx->DrawBuffer->Visual.depthBits == 0) { _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); return; } if (ctx->Depth.Test==state) return; FLUSH_VERTICES(ctx, _NEW_DEPTH); ctx->Depth.Test = state; break; case GL_DITHER: if (ctx->NoDither) { state = GL_FALSE; /* MESA_NO_DITHER env var */ } if (ctx->Color.DitherFlag==state) return; FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.DitherFlag = state; break; case GL_FOG: if (ctx->Fog.Enabled==state) return; FLUSH_VERTICES(ctx, _NEW_FOG); ctx->Fog.Enabled = state; break; case GL_HISTOGRAM: CHECK_EXTENSION(EXT_histogram, cap); if (ctx->Pixel.HistogramEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.HistogramEnabled = state; break; case GL_LIGHT0: case GL_LIGHT1: case GL_LIGHT2: case GL_LIGHT3: case GL_LIGHT4: case GL_LIGHT5: case GL_LIGHT6: case GL_LIGHT7: if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); ctx->Light.Light[cap-GL_LIGHT0].Enabled = state; if (state) { insert_at_tail(&ctx->Light.EnabledList, &ctx->Light.Light[cap-GL_LIGHT0]); } else { remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]); } break; case GL_LIGHTING: if (ctx->Light.Enabled == state) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); ctx->Light.Enabled = state; if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE; else ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE; break; case GL_LINE_SMOOTH: if (ctx->Line.SmoothFlag == state) return; FLUSH_VERTICES(ctx, _NEW_LINE); ctx->Line.SmoothFlag = state; ctx->_TriangleCaps ^= DD_LINE_SMOOTH; break; case GL_LINE_STIPPLE: if (ctx->Line.StippleFlag == state) return; FLUSH_VERTICES(ctx, _NEW_LINE); ctx->Line.StippleFlag = state; ctx->_TriangleCaps ^= DD_LINE_STIPPLE; break; case GL_INDEX_LOGIC_OP: if (ctx->Color.IndexLogicOpEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.IndexLogicOpEnabled = state; break; case GL_COLOR_LOGIC_OP: if (ctx->Color.ColorLogicOpEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.ColorLogicOpEnabled = state; /* This is needed to support 1.1's RGB logic ops AND * 1.0's blending logicops. */ ctx->Color._LogicOpEnabled = (state || (ctx->Color.BlendEnabled && ctx->Color.BlendEquationRGB == GL_LOGIC_OP)); break; case GL_MAP1_COLOR_4: if (ctx->Eval.Map1Color4 == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map1Color4 = state; break; case GL_MAP1_INDEX: if (ctx->Eval.Map1Index == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map1Index = state; break; case GL_MAP1_NORMAL: if (ctx->Eval.Map1Normal == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map1Normal = state; break; case GL_MAP1_TEXTURE_COORD_1: if (ctx->Eval.Map1TextureCoord1 == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map1TextureCoord1 = state; break; case GL_MAP1_TEXTURE_COORD_2: if (ctx->Eval.Map1TextureCoord2 == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map1TextureCoord2 = state; break; case GL_MAP1_TEXTURE_COORD_3: if (ctx->Eval.Map1TextureCoord3 == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map1TextureCoord3 = state; break; case GL_MAP1_TEXTURE_COORD_4: if (ctx->Eval.Map1TextureCoord4 == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map1TextureCoord4 = state; break; case GL_MAP1_VERTEX_3: if (ctx->Eval.Map1Vertex3 == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map1Vertex3 = state; break; case GL_MAP1_VERTEX_4: if (ctx->Eval.Map1Vertex4 == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map1Vertex4 = state; break; case GL_MAP2_COLOR_4: if (ctx->Eval.Map2Color4 == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map2Color4 = state; break; case GL_MAP2_INDEX: if (ctx->Eval.Map2Index == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map2Index = state; break; case GL_MAP2_NORMAL: if (ctx->Eval.Map2Normal == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map2Normal = state; break; case GL_MAP2_TEXTURE_COORD_1: if (ctx->Eval.Map2TextureCoord1 == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map2TextureCoord1 = state; break; case GL_MAP2_TEXTURE_COORD_2: if (ctx->Eval.Map2TextureCoord2 == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map2TextureCoord2 = state; break; case GL_MAP2_TEXTURE_COORD_3: if (ctx->Eval.Map2TextureCoord3 == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map2TextureCoord3 = state; break; case GL_MAP2_TEXTURE_COORD_4: if (ctx->Eval.Map2TextureCoord4 == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map2TextureCoord4 = state; break; case GL_MAP2_VERTEX_3: if (ctx->Eval.Map2Vertex3 == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map2Vertex3 = state; break; case GL_MAP2_VERTEX_4: if (ctx->Eval.Map2Vertex4 == state) return; FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map2Vertex4 = state; break; case GL_MINMAX: if (ctx->Pixel.MinMaxEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.MinMaxEnabled = state; break; case GL_NORMALIZE: if (ctx->Transform.Normalize == state) return; FLUSH_VERTICES(ctx, _NEW_TRANSFORM); ctx->Transform.Normalize = state; break; case GL_POINT_SMOOTH: if (ctx->Point.SmoothFlag==state) return; FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.SmoothFlag = state; ctx->_TriangleCaps ^= DD_POINT_SMOOTH; break; case GL_POLYGON_SMOOTH: if (ctx->Polygon.SmoothFlag==state) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.SmoothFlag = state; ctx->_TriangleCaps ^= DD_TRI_SMOOTH; break; case GL_POLYGON_STIPPLE: if (ctx->Polygon.StippleFlag==state) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.StippleFlag = state; ctx->_TriangleCaps ^= DD_TRI_STIPPLE; break; case GL_POLYGON_OFFSET_POINT: if (ctx->Polygon.OffsetPoint==state) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.OffsetPoint = state; break; case GL_POLYGON_OFFSET_LINE: if (ctx->Polygon.OffsetLine==state) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.OffsetLine = state; break; case GL_POLYGON_OFFSET_FILL: /*case GL_POLYGON_OFFSET_EXT:*/ if (ctx->Polygon.OffsetFill==state) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.OffsetFill = state; break; case GL_RESCALE_NORMAL_EXT: if (ctx->Transform.RescaleNormals == state) return; FLUSH_VERTICES(ctx, _NEW_TRANSFORM); ctx->Transform.RescaleNormals = state; break; case GL_SCISSOR_TEST: if (ctx->Scissor.Enabled==state) return; FLUSH_VERTICES(ctx, _NEW_SCISSOR); ctx->Scissor.Enabled = state; break; case GL_SHARED_TEXTURE_PALETTE_EXT: if (ctx->Texture.SharedPalette == state) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); ctx->Texture.SharedPalette = state; break; case GL_STENCIL_TEST: if (state && ctx->DrawBuffer->Visual.stencilBits == 0) { _mesa_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer"); return; } if (ctx->Stencil.Enabled==state) return; FLUSH_VERTICES(ctx, _NEW_STENCIL); ctx->Stencil.Enabled = state; break; case GL_TEXTURE_1D: { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; GLuint newenabled = texUnit->Enabled & ~TEXTURE_1D_BIT; if (state) newenabled |= TEXTURE_1D_BIT; if (!ctx->DrawBuffer->Visual.rgbMode || texUnit->Enabled == newenabled) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Enabled = newenabled; break; } case GL_TEXTURE_2D: { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; GLuint newenabled = texUnit->Enabled & ~TEXTURE_2D_BIT; if (state) newenabled |= TEXTURE_2D_BIT; if (!ctx->DrawBuffer->Visual.rgbMode || texUnit->Enabled == newenabled) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Enabled = newenabled; break; } case GL_TEXTURE_3D: { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; GLuint newenabled = texUnit->Enabled & ~TEXTURE_3D_BIT; if (state) newenabled |= TEXTURE_3D_BIT; if (!ctx->DrawBuffer->Visual.rgbMode || texUnit->Enabled == newenabled) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Enabled = newenabled; break; } case GL_TEXTURE_GEN_Q: { GLuint unit = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT; if (state) newenabled |= Q_BIT; if (texUnit->TexGenEnabled == newenabled) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->TexGenEnabled = newenabled; break; } case GL_TEXTURE_GEN_R: { GLuint unit = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT; if (state) newenabled |= R_BIT; if (texUnit->TexGenEnabled == newenabled) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->TexGenEnabled = newenabled; break; } case GL_TEXTURE_GEN_S: { GLuint unit = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT; if (state) newenabled |= S_BIT; if (texUnit->TexGenEnabled == newenabled) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->TexGenEnabled = newenabled; break; } case GL_TEXTURE_GEN_T: { GLuint unit = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT; if (state) newenabled |= T_BIT; if (texUnit->TexGenEnabled == newenabled) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->TexGenEnabled = newenabled; break; } /* * CLIENT STATE!!! */ case GL_VERTEX_ARRAY: case GL_NORMAL_ARRAY: case GL_COLOR_ARRAY: case GL_INDEX_ARRAY: case GL_TEXTURE_COORD_ARRAY: case GL_EDGE_FLAG_ARRAY: case GL_FOG_COORDINATE_ARRAY_EXT: case GL_SECONDARY_COLOR_ARRAY_EXT: client_state( ctx, cap, state ); return; /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: CHECK_EXTENSION(HP_occlusion_test, cap); if (ctx->Depth.OcclusionTest == state) return; FLUSH_VERTICES(ctx, _NEW_DEPTH); ctx->Depth.OcclusionTest = state; if (state) ctx->OcclusionResult = ctx->OcclusionResultSaved; else ctx->OcclusionResultSaved = ctx->OcclusionResult; break; /* GL_SGIS_pixel_texture */ case GL_PIXEL_TEXTURE_SGIS: CHECK_EXTENSION(SGIS_pixel_texture, cap); if (ctx->Pixel.PixelTextureEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PixelTextureEnabled = state; break; /* GL_SGIX_pixel_texture */ case GL_PIXEL_TEX_GEN_SGIX: CHECK_EXTENSION(SGIX_pixel_texture, cap); if (ctx->Pixel.PixelTextureEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PixelTextureEnabled = state; break; /* GL_SGI_color_table */ case GL_COLOR_TABLE_SGI: CHECK_EXTENSION(SGI_color_table, cap); if (ctx->Pixel.ColorTableEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.ColorTableEnabled = state; break; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: CHECK_EXTENSION(SGI_color_table, cap); if (ctx->Pixel.PostConvolutionColorTableEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionColorTableEnabled = state; break; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: CHECK_EXTENSION(SGI_color_table, cap); if (ctx->Pixel.PostColorMatrixColorTableEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixColorTableEnabled = state; break; case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXTENSION(SGI_texture_color_table, cap); if (ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled = state; break; /* GL_EXT_convolution */ case GL_CONVOLUTION_1D: CHECK_EXTENSION(EXT_convolution, cap); if (ctx->Pixel.Convolution1DEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.Convolution1DEnabled = state; break; case GL_CONVOLUTION_2D: CHECK_EXTENSION(EXT_convolution, cap); if (ctx->Pixel.Convolution2DEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.Convolution2DEnabled = state; break; case GL_SEPARABLE_2D: CHECK_EXTENSION(EXT_convolution, cap); if (ctx->Pixel.Separable2DEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.Separable2DEnabled = state; break; /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; GLuint newenabled = texUnit->Enabled & ~TEXTURE_CUBE_BIT; CHECK_EXTENSION(ARB_texture_cube_map, cap); if (state) newenabled |= TEXTURE_CUBE_BIT; if (!ctx->DrawBuffer->Visual.rgbMode || texUnit->Enabled == newenabled) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Enabled = newenabled; } break; /* GL_EXT_secondary_color */ case GL_COLOR_SUM_EXT: CHECK_EXTENSION(EXT_secondary_color, cap); if (ctx->Fog.ColorSumEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_FOG); ctx->Fog.ColorSumEnabled = state; break; /* GL_ARB_multisample */ case GL_MULTISAMPLE_ARB: CHECK_EXTENSION(ARB_multisample, cap); if (ctx->Multisample.Enabled == state) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); ctx->Multisample.Enabled = state; break; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: CHECK_EXTENSION(ARB_multisample, cap); if (ctx->Multisample.SampleAlphaToCoverage == state) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); ctx->Multisample.SampleAlphaToCoverage = state; break; case GL_SAMPLE_ALPHA_TO_ONE_ARB: CHECK_EXTENSION(ARB_multisample, cap); if (ctx->Multisample.SampleAlphaToOne == state) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); ctx->Multisample.SampleAlphaToOne = state; break; case GL_SAMPLE_COVERAGE_ARB: CHECK_EXTENSION(ARB_multisample, cap); if (ctx->Multisample.SampleCoverage == state) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); ctx->Multisample.SampleCoverage = state; break; case GL_SAMPLE_COVERAGE_INVERT_ARB: CHECK_EXTENSION(ARB_multisample, cap); if (ctx->Multisample.SampleCoverageInvert == state) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); ctx->Multisample.SampleCoverageInvert = state; break; /* GL_IBM_rasterpos_clip */ case GL_RASTER_POSITION_UNCLIPPED_IBM: CHECK_EXTENSION(IBM_rasterpos_clip, cap); if (ctx->Transform.RasterPositionUnclipped == state) return; FLUSH_VERTICES(ctx, _NEW_TRANSFORM); ctx->Transform.RasterPositionUnclipped = state; break; /* GL_NV_point_sprite */ case GL_POINT_SPRITE_NV: CHECK_EXTENSION2(NV_point_sprite, ARB_point_sprite, cap); if (ctx->Point.PointSprite == state) return; FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.PointSprite = state; break; #if FEATURE_NV_vertex_program case GL_VERTEX_PROGRAM_NV: CHECK_EXTENSION2(NV_vertex_program, ARB_vertex_program, cap); if (ctx->VertexProgram.Enabled == state) return; FLUSH_VERTICES(ctx, _NEW_PROGRAM); ctx->VertexProgram.Enabled = state; break; case GL_VERTEX_PROGRAM_POINT_SIZE_NV: CHECK_EXTENSION2(NV_vertex_program, ARB_vertex_program, cap); if (ctx->VertexProgram.PointSizeEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PROGRAM); ctx->VertexProgram.PointSizeEnabled = state; break; case GL_VERTEX_PROGRAM_TWO_SIDE_NV: CHECK_EXTENSION2(NV_vertex_program, ARB_vertex_program, cap); if (ctx->VertexProgram.TwoSideEnabled == state) return; FLUSH_VERTICES(ctx, _NEW_PROGRAM); ctx->VertexProgram.TwoSideEnabled = state; break; case GL_MAP1_VERTEX_ATTRIB0_4_NV: case GL_MAP1_VERTEX_ATTRIB1_4_NV: case GL_MAP1_VERTEX_ATTRIB2_4_NV: case GL_MAP1_VERTEX_ATTRIB3_4_NV: case GL_MAP1_VERTEX_ATTRIB4_4_NV: case GL_MAP1_VERTEX_ATTRIB5_4_NV: case GL_MAP1_VERTEX_ATTRIB6_4_NV: case GL_MAP1_VERTEX_ATTRIB7_4_NV: case GL_MAP1_VERTEX_ATTRIB8_4_NV: case GL_MAP1_VERTEX_ATTRIB9_4_NV: case GL_MAP1_VERTEX_ATTRIB10_4_NV: case GL_MAP1_VERTEX_ATTRIB11_4_NV: case GL_MAP1_VERTEX_ATTRIB12_4_NV: case GL_MAP1_VERTEX_ATTRIB13_4_NV: case GL_MAP1_VERTEX_ATTRIB14_4_NV: case GL_MAP1_VERTEX_ATTRIB15_4_NV: CHECK_EXTENSION(NV_vertex_program, cap); { const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV); FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map1Attrib[map] = state; } break; case GL_MAP2_VERTEX_ATTRIB0_4_NV: case GL_MAP2_VERTEX_ATTRIB1_4_NV: case GL_MAP2_VERTEX_ATTRIB2_4_NV: case GL_MAP2_VERTEX_ATTRIB3_4_NV: case GL_MAP2_VERTEX_ATTRIB4_4_NV: case GL_MAP2_VERTEX_ATTRIB5_4_NV: case GL_MAP2_VERTEX_ATTRIB6_4_NV: case GL_MAP2_VERTEX_ATTRIB7_4_NV: case GL_MAP2_VERTEX_ATTRIB8_4_NV: case GL_MAP2_VERTEX_ATTRIB9_4_NV: case GL_MAP2_VERTEX_ATTRIB10_4_NV: case GL_MAP2_VERTEX_ATTRIB11_4_NV: case GL_MAP2_VERTEX_ATTRIB12_4_NV: case GL_MAP2_VERTEX_ATTRIB13_4_NV: case GL_MAP2_VERTEX_ATTRIB14_4_NV: case GL_MAP2_VERTEX_ATTRIB15_4_NV: CHECK_EXTENSION(NV_vertex_program, cap); { const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV); FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.Map2Attrib[map] = state; } break; #endif /* FEATURE_NV_vertex_program */ #if FEATURE_NV_fragment_program case GL_FRAGMENT_PROGRAM_NV: CHECK_EXTENSION(NV_fragment_program, cap); if (ctx->FragmentProgram.Enabled == state) return; FLUSH_VERTICES(ctx, _NEW_PROGRAM); ctx->FragmentProgram.Enabled = state; break; #endif /* FEATURE_NV_fragment_program */ /* GL_NV_texture_rectangle */ case GL_TEXTURE_RECTANGLE_NV: CHECK_EXTENSION(NV_texture_rectangle, cap); { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; GLuint newenabled = texUnit->Enabled & ~TEXTURE_RECT_BIT; CHECK_EXTENSION(NV_texture_rectangle, cap); if (state) newenabled |= TEXTURE_RECT_BIT; if (!ctx->DrawBuffer->Visual.rgbMode || texUnit->Enabled == newenabled) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Enabled = newenabled; } break; /* GL_EXT_stencil_two_side */ case GL_STENCIL_TEST_TWO_SIDE_EXT: CHECK_EXTENSION(EXT_stencil_two_side, cap); if (ctx->Stencil.TestTwoSide == state) return; FLUSH_VERTICES(ctx, _NEW_STENCIL); ctx->Stencil.TestTwoSide = state; if (state) { ctx->_TriangleCaps |= DD_TRI_TWOSTENCIL; } else { ctx->_TriangleCaps &= ~DD_TRI_TWOSTENCIL; } break; #if FEATURE_ARB_fragment_program case GL_FRAGMENT_PROGRAM_ARB: CHECK_EXTENSION(ARB_fragment_program, cap); if (ctx->FragmentProgram.Enabled == state) return; FLUSH_VERTICES(ctx, _NEW_PROGRAM); ctx->FragmentProgram.Enabled = state; break; #endif /* FEATURE_ARB_fragment_program */ /* GL_EXT_depth_bounds_test */ case GL_DEPTH_BOUNDS_TEST_EXT: CHECK_EXTENSION(EXT_depth_bounds_test, cap); if (state && ctx->DrawBuffer->Visual.depthBits == 0) { _mesa_warning(ctx, "glEnable(GL_DEPTH_BOUNDS_TEST_EXT) but no depth buffer"); return; } if (ctx->Depth.BoundsTest == state) return; FLUSH_VERTICES(ctx, _NEW_DEPTH); ctx->Depth.BoundsTest = state; break; /* GL_MESA_program_debug */ case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: CHECK_EXTENSION(MESA_program_debug, cap); ctx->FragmentProgram.CallbackEnabled = state; break; case GL_VERTEX_PROGRAM_CALLBACK_MESA: CHECK_EXTENSION(MESA_program_debug, cap); ctx->VertexProgram.CallbackEnabled = state; break; #if FEATURE_ATI_fragment_shader case GL_FRAGMENT_SHADER_ATI: CHECK_EXTENSION(ATI_fragment_shader, cap); if (ctx->ATIFragmentShader.Enabled == state) return; FLUSH_VERTICES(ctx, _NEW_PROGRAM); ctx->ATIFragmentShader.Enabled = state; break; #endif default: _mesa_error(ctx, GL_INVALID_ENUM, "%s(0x%x)", state ? "glEnable" : "glDisable", cap); return; } if (ctx->Driver.Enable) { (*ctx->Driver.Enable)( ctx, cap, state ); } } /** * Enable GL capability. * * \param cap capability. * * \sa glEnable(). * * Get's the current context, assures that we're outside glBegin()/glEnd() and * calls _mesa_set_enable(). */ void GLAPIENTRY _mesa_Enable( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); _mesa_set_enable( ctx, cap, GL_TRUE ); } /** * Disable GL capability. * * \param cap capability. * * \sa glDisable(). * * Get's the current context, assures that we're outside glBegin()/glEnd() and * calls _mesa_set_enable(). */ void GLAPIENTRY _mesa_Disable( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); _mesa_set_enable( ctx, cap, GL_FALSE ); } #undef CHECK_EXTENSION #define CHECK_EXTENSION(EXTNAME) \ if (!ctx->Extensions.EXTNAME) { \ _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \ return GL_FALSE; \ } /** * Test whether a capability is enabled. * * \param cap capability. * * Returns the state of the specified capability from the current GL context. * For the capabilities associated with extensions verifies that those * extensions are effectively present before reporting. */ GLboolean GLAPIENTRY _mesa_IsEnabled( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); switch (cap) { case GL_ALPHA_TEST: return ctx->Color.AlphaEnabled; case GL_AUTO_NORMAL: return ctx->Eval.AutoNormal; case GL_BLEND: return ctx->Color.BlendEnabled; case GL_CLIP_PLANE0: case GL_CLIP_PLANE1: case GL_CLIP_PLANE2: case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: return (ctx->Transform.ClipPlanesEnabled >> (cap - GL_CLIP_PLANE0)) & 1; case GL_COLOR_MATERIAL: return ctx->Light.ColorMaterialEnabled; case GL_CULL_FACE: return ctx->Polygon.CullFlag; case GL_DEPTH_TEST: return ctx->Depth.Test; case GL_DITHER: return ctx->Color.DitherFlag; case GL_FOG: return ctx->Fog.Enabled; case GL_LIGHTING: return ctx->Light.Enabled; case GL_LIGHT0: case GL_LIGHT1: case GL_LIGHT2: case GL_LIGHT3: case GL_LIGHT4: case GL_LIGHT5: case GL_LIGHT6: case GL_LIGHT7: return ctx->Light.Light[cap-GL_LIGHT0].Enabled; case GL_LINE_SMOOTH: return ctx->Line.SmoothFlag; case GL_LINE_STIPPLE: return ctx->Line.StippleFlag; case GL_INDEX_LOGIC_OP: return ctx->Color.IndexLogicOpEnabled; case GL_COLOR_LOGIC_OP: return ctx->Color.ColorLogicOpEnabled; case GL_MAP1_COLOR_4: return ctx->Eval.Map1Color4; case GL_MAP1_INDEX: return ctx->Eval.Map1Index; case GL_MAP1_NORMAL: return ctx->Eval.Map1Normal; case GL_MAP1_TEXTURE_COORD_1: return ctx->Eval.Map1TextureCoord1; case GL_MAP1_TEXTURE_COORD_2: return ctx->Eval.Map1TextureCoord2; case GL_MAP1_TEXTURE_COORD_3: return ctx->Eval.Map1TextureCoord3; case GL_MAP1_TEXTURE_COORD_4: return ctx->Eval.Map1TextureCoord4; case GL_MAP1_VERTEX_3: return ctx->Eval.Map1Vertex3; case GL_MAP1_VERTEX_4: return ctx->Eval.Map1Vertex4; case GL_MAP2_COLOR_4: return ctx->Eval.Map2Color4; case GL_MAP2_INDEX: return ctx->Eval.Map2Index; case GL_MAP2_NORMAL: return ctx->Eval.Map2Normal; case GL_MAP2_TEXTURE_COORD_1: return ctx->Eval.Map2TextureCoord1; case GL_MAP2_TEXTURE_COORD_2: return ctx->Eval.Map2TextureCoord2; case GL_MAP2_TEXTURE_COORD_3: return ctx->Eval.Map2TextureCoord3; case GL_MAP2_TEXTURE_COORD_4: return ctx->Eval.Map2TextureCoord4; case GL_MAP2_VERTEX_3: return ctx->Eval.Map2Vertex3; case GL_MAP2_VERTEX_4: return ctx->Eval.Map2Vertex4; case GL_NORMALIZE: return ctx->Transform.Normalize; case GL_POINT_SMOOTH: return ctx->Point.SmoothFlag; case GL_POLYGON_SMOOTH: return ctx->Polygon.SmoothFlag; case GL_POLYGON_STIPPLE: return ctx->Polygon.StippleFlag; case GL_POLYGON_OFFSET_POINT: return ctx->Polygon.OffsetPoint; case GL_POLYGON_OFFSET_LINE: return ctx->Polygon.OffsetLine; case GL_POLYGON_OFFSET_FILL: /*case GL_POLYGON_OFFSET_EXT:*/ return ctx->Polygon.OffsetFill; case GL_RESCALE_NORMAL_EXT: return ctx->Transform.RescaleNormals; case GL_SCISSOR_TEST: return ctx->Scissor.Enabled; case GL_SHARED_TEXTURE_PALETTE_EXT: return ctx->Texture.SharedPalette; case GL_STENCIL_TEST: return ctx->Stencil.Enabled; case GL_TEXTURE_1D: { const struct gl_texture_unit *texUnit; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->Enabled & TEXTURE_1D_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_2D: { const struct gl_texture_unit *texUnit; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->Enabled & TEXTURE_2D_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_3D: { const struct gl_texture_unit *texUnit; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->Enabled & TEXTURE_3D_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_GEN_Q: { const struct gl_texture_unit *texUnit; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_GEN_R: { const struct gl_texture_unit *texUnit; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_GEN_S: { const struct gl_texture_unit *texUnit; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_GEN_T: { const struct gl_texture_unit *texUnit; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE; } /* * CLIENT STATE!!! */ case GL_VERTEX_ARRAY: return (ctx->Array.Vertex.Enabled != 0); case GL_NORMAL_ARRAY: return (ctx->Array.Normal.Enabled != 0); case GL_COLOR_ARRAY: return (ctx->Array.Color.Enabled != 0); case GL_INDEX_ARRAY: return (ctx->Array.Index.Enabled != 0); case GL_TEXTURE_COORD_ARRAY: return (ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled != 0); case GL_EDGE_FLAG_ARRAY: return (ctx->Array.EdgeFlag.Enabled != 0); case GL_FOG_COORDINATE_ARRAY_EXT: CHECK_EXTENSION(EXT_fog_coord); return (ctx->Array.FogCoord.Enabled != 0); case GL_SECONDARY_COLOR_ARRAY_EXT: CHECK_EXTENSION(EXT_secondary_color); return (ctx->Array.SecondaryColor.Enabled != 0); /* GL_EXT_histogram */ case GL_HISTOGRAM: CHECK_EXTENSION(EXT_histogram); return ctx->Pixel.HistogramEnabled; case GL_MINMAX: CHECK_EXTENSION(EXT_histogram); return ctx->Pixel.MinMaxEnabled; /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: CHECK_EXTENSION(HP_occlusion_test); return ctx->Depth.OcclusionTest; /* GL_SGIS_pixel_texture */ case GL_PIXEL_TEXTURE_SGIS: CHECK_EXTENSION(SGIS_pixel_texture); return ctx->Pixel.PixelTextureEnabled; /* GL_SGIX_pixel_texture */ case GL_PIXEL_TEX_GEN_SGIX: CHECK_EXTENSION(SGIX_pixel_texture); return ctx->Pixel.PixelTextureEnabled; /* GL_SGI_color_table */ case GL_COLOR_TABLE_SGI: CHECK_EXTENSION(SGI_color_table); return ctx->Pixel.ColorTableEnabled; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: CHECK_EXTENSION(SGI_color_table); return ctx->Pixel.PostConvolutionColorTableEnabled; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: CHECK_EXTENSION(SGI_color_table); return ctx->Pixel.PostColorMatrixColorTableEnabled; /* GL_SGI_texture_color_table */ case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXTENSION(SGI_texture_color_table); return ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled; /* GL_EXT_convolution */ case GL_CONVOLUTION_1D: CHECK_EXTENSION(EXT_convolution); return ctx->Pixel.Convolution1DEnabled; case GL_CONVOLUTION_2D: CHECK_EXTENSION(EXT_convolution); return ctx->Pixel.Convolution2DEnabled; case GL_SEPARABLE_2D: CHECK_EXTENSION(EXT_convolution); return ctx->Pixel.Separable2DEnabled; /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: CHECK_EXTENSION(ARB_texture_cube_map); { const struct gl_texture_unit *texUnit; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->Enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE; } /* GL_ARB_multisample */ case GL_MULTISAMPLE_ARB: CHECK_EXTENSION(ARB_multisample); return ctx->Multisample.Enabled; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: CHECK_EXTENSION(ARB_multisample); return ctx->Multisample.SampleAlphaToCoverage; case GL_SAMPLE_ALPHA_TO_ONE_ARB: CHECK_EXTENSION(ARB_multisample); return ctx->Multisample.SampleAlphaToOne; case GL_SAMPLE_COVERAGE_ARB: CHECK_EXTENSION(ARB_multisample); return ctx->Multisample.SampleCoverage; case GL_SAMPLE_COVERAGE_INVERT_ARB: CHECK_EXTENSION(ARB_multisample); return ctx->Multisample.SampleCoverageInvert; /* GL_IBM_rasterpos_clip */ case GL_RASTER_POSITION_UNCLIPPED_IBM: CHECK_EXTENSION(IBM_rasterpos_clip); return ctx->Transform.RasterPositionUnclipped; /* GL_NV_point_sprite */ case GL_POINT_SPRITE_NV: return ctx->Point.PointSprite; #if FEATURE_NV_vertex_program case GL_VERTEX_PROGRAM_NV: CHECK_EXTENSION(NV_vertex_program); return ctx->VertexProgram.Enabled; case GL_VERTEX_PROGRAM_POINT_SIZE_NV: CHECK_EXTENSION(NV_vertex_program); return ctx->VertexProgram.PointSizeEnabled; case GL_VERTEX_PROGRAM_TWO_SIDE_NV: CHECK_EXTENSION(NV_vertex_program); return ctx->VertexProgram.TwoSideEnabled; case GL_VERTEX_ATTRIB_ARRAY0_NV: case GL_VERTEX_ATTRIB_ARRAY1_NV: case GL_VERTEX_ATTRIB_ARRAY2_NV: case GL_VERTEX_ATTRIB_ARRAY3_NV: case GL_VERTEX_ATTRIB_ARRAY4_NV: case GL_VERTEX_ATTRIB_ARRAY5_NV: case GL_VERTEX_ATTRIB_ARRAY6_NV: case GL_VERTEX_ATTRIB_ARRAY7_NV: case GL_VERTEX_ATTRIB_ARRAY8_NV: case GL_VERTEX_ATTRIB_ARRAY9_NV: case GL_VERTEX_ATTRIB_ARRAY10_NV: case GL_VERTEX_ATTRIB_ARRAY11_NV: case GL_VERTEX_ATTRIB_ARRAY12_NV: case GL_VERTEX_ATTRIB_ARRAY13_NV: case GL_VERTEX_ATTRIB_ARRAY14_NV: case GL_VERTEX_ATTRIB_ARRAY15_NV: CHECK_EXTENSION(NV_vertex_program); { GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; return (ctx->Array.VertexAttrib[n].Enabled != 0); } case GL_MAP1_VERTEX_ATTRIB0_4_NV: case GL_MAP1_VERTEX_ATTRIB1_4_NV: case GL_MAP1_VERTEX_ATTRIB2_4_NV: case GL_MAP1_VERTEX_ATTRIB3_4_NV: case GL_MAP1_VERTEX_ATTRIB4_4_NV: case GL_MAP1_VERTEX_ATTRIB5_4_NV: case GL_MAP1_VERTEX_ATTRIB6_4_NV: case GL_MAP1_VERTEX_ATTRIB7_4_NV: case GL_MAP1_VERTEX_ATTRIB8_4_NV: case GL_MAP1_VERTEX_ATTRIB9_4_NV: case GL_MAP1_VERTEX_ATTRIB10_4_NV: case GL_MAP1_VERTEX_ATTRIB11_4_NV: case GL_MAP1_VERTEX_ATTRIB12_4_NV: case GL_MAP1_VERTEX_ATTRIB13_4_NV: case GL_MAP1_VERTEX_ATTRIB14_4_NV: case GL_MAP1_VERTEX_ATTRIB15_4_NV: CHECK_EXTENSION(NV_vertex_program); { const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV); return ctx->Eval.Map1Attrib[map]; } case GL_MAP2_VERTEX_ATTRIB0_4_NV: case GL_MAP2_VERTEX_ATTRIB1_4_NV: case GL_MAP2_VERTEX_ATTRIB2_4_NV: case GL_MAP2_VERTEX_ATTRIB3_4_NV: case GL_MAP2_VERTEX_ATTRIB4_4_NV: case GL_MAP2_VERTEX_ATTRIB5_4_NV: case GL_MAP2_VERTEX_ATTRIB6_4_NV: case GL_MAP2_VERTEX_ATTRIB7_4_NV: case GL_MAP2_VERTEX_ATTRIB8_4_NV: case GL_MAP2_VERTEX_ATTRIB9_4_NV: case GL_MAP2_VERTEX_ATTRIB10_4_NV: case GL_MAP2_VERTEX_ATTRIB11_4_NV: case GL_MAP2_VERTEX_ATTRIB12_4_NV: case GL_MAP2_VERTEX_ATTRIB13_4_NV: case GL_MAP2_VERTEX_ATTRIB14_4_NV: case GL_MAP2_VERTEX_ATTRIB15_4_NV: CHECK_EXTENSION(NV_vertex_program); { const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV); return ctx->Eval.Map2Attrib[map]; } #endif /* FEATURE_NV_vertex_program */ #if FEATURE_NV_fragment_program case GL_FRAGMENT_PROGRAM_NV: CHECK_EXTENSION(NV_fragment_program); return ctx->FragmentProgram.Enabled; #endif /* FEATURE_NV_fragment_program */ /* GL_NV_texture_rectangle */ case GL_TEXTURE_RECTANGLE_NV: CHECK_EXTENSION(NV_texture_rectangle); { const struct gl_texture_unit *texUnit; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->Enabled & TEXTURE_RECT_BIT) ? GL_TRUE : GL_FALSE; } /* GL_EXT_stencil_two_side */ case GL_STENCIL_TEST_TWO_SIDE_EXT: CHECK_EXTENSION(EXT_stencil_two_side); return ctx->Stencil.TestTwoSide; #if FEATURE_ARB_fragment_program case GL_FRAGMENT_PROGRAM_ARB: return ctx->FragmentProgram.Enabled; #endif /* FEATURE_ARB_fragment_program */ /* GL_EXT_depth_bounds_test */ case GL_DEPTH_BOUNDS_TEST_EXT: CHECK_EXTENSION(EXT_depth_bounds_test); return ctx->Depth.BoundsTest; /* GL_MESA_program_debug */ case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: CHECK_EXTENSION(MESA_program_debug); return ctx->FragmentProgram.CallbackEnabled; case GL_VERTEX_PROGRAM_CALLBACK_MESA: CHECK_EXTENSION(MESA_program_debug); return ctx->VertexProgram.CallbackEnabled; #if FEATURE_ATI_fragment_shader case GL_FRAGMENT_SHADER_ATI: CHECK_EXTENSION(ATI_fragment_shader); return ctx->ATIFragmentShader.Enabled; #endif /* FEATURE_ATI_fragment_shader */ default: _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap); return GL_FALSE; } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/enable.h0000644000000000000000000000321313614532424017537 0ustar /** * \file enable.h * Enable/disable/query GL capabilities. */ /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ENABLE_H #define ENABLE_H #include "mtypes.h" extern void _mesa_set_enable( GLcontext* ctx, GLenum cap, GLboolean state ); extern void GLAPIENTRY _mesa_Disable( GLenum cap ); extern void GLAPIENTRY _mesa_Enable( GLenum cap ); extern GLboolean GLAPIENTRY _mesa_IsEnabled( GLenum cap ); extern void GLAPIENTRY _mesa_EnableClientState( GLenum cap ); extern void GLAPIENTRY _mesa_DisableClientState( GLenum cap ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/enums.c0000644000000000000000000054572313614532424017454 0ustar /* DO NOT EDIT - This file generated automatically by gl_enums.py (from Mesa) script */ /* * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sub license, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL, * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include "glheader.h" #include "enums.h" #include "imports.h" typedef struct { size_t offset; int n; } enum_elt; static const char enum_string_table[] = "GL_2D\0" "GL_2_BYTES\0" "GL_3D\0" "GL_3D_COLOR\0" "GL_3D_COLOR_TEXTURE\0" "GL_3_BYTES\0" "GL_4D_COLOR_TEXTURE\0" "GL_4_BYTES\0" "GL_ACCUM\0" "GL_ACCUM_ALPHA_BITS\0" "GL_ACCUM_BLUE_BITS\0" "GL_ACCUM_BUFFER_BIT\0" "GL_ACCUM_CLEAR_VALUE\0" "GL_ACCUM_GREEN_BITS\0" "GL_ACCUM_RED_BITS\0" "GL_ACTIVE_STENCIL_FACE_EXT\0" "GL_ACTIVE_TEXTURE\0" "GL_ACTIVE_TEXTURE_ARB\0" "GL_ACTIVE_VERTEX_UNITS_ARB\0" "GL_ADD\0" "GL_ADD_SIGNED\0" "GL_ADD_SIGNED_ARB\0" "GL_ADD_SIGNED_EXT\0" "GL_ALIASED_LINE_WIDTH_RANGE\0" "GL_ALIASED_POINT_SIZE_RANGE\0" "GL_ALL_ATTRIB_BITS\0" "GL_ALL_CLIENT_ATTRIB_BITS\0" "GL_ALPHA\0" "GL_ALPHA12\0" "GL_ALPHA12_EXT\0" "GL_ALPHA16\0" "GL_ALPHA16_EXT\0" "GL_ALPHA4\0" "GL_ALPHA4_EXT\0" "GL_ALPHA8\0" "GL_ALPHA8_EXT\0" "GL_ALPHA_BIAS\0" "GL_ALPHA_BITS\0" "GL_ALPHA_SCALE\0" "GL_ALPHA_TEST\0" "GL_ALPHA_TEST_FUNC\0" "GL_ALPHA_TEST_REF\0" "GL_ALWAYS\0" "GL_AMBIENT\0" "GL_AMBIENT_AND_DIFFUSE\0" "GL_AND\0" "GL_AND_INVERTED\0" "GL_AND_REVERSE\0" "GL_ARRAY_BUFFER\0" "GL_ARRAY_BUFFER_ARB\0" "GL_ARRAY_BUFFER_BINDING\0" "GL_ARRAY_BUFFER_BINDING_ARB\0" "GL_ATTRIB_ARRAY_POINTER_NV\0" "GL_ATTRIB_ARRAY_SIZE_NV\0" "GL_ATTRIB_ARRAY_STRIDE_NV\0" "GL_ATTRIB_ARRAY_TYPE_NV\0" "GL_ATTRIB_STACK_DEPTH\0" "GL_AUTO_NORMAL\0" "GL_AUX0\0" "GL_AUX1\0" "GL_AUX2\0" "GL_AUX3\0" "GL_AUX_BUFFERS\0" "GL_BACK\0" "GL_BACK_LEFT\0" "GL_BACK_RIGHT\0" "GL_BGR\0" "GL_BGRA\0" "GL_BITMAP\0" "GL_BITMAP_TOKEN\0" "GL_BLEND\0" "GL_BLEND_COLOR\0" "GL_BLEND_COLOR_EXT\0" "GL_BLEND_DST\0" "GL_BLEND_DST_ALPHA\0" "GL_BLEND_DST_RGB\0" "GL_BLEND_EQUATION\0" "GL_BLEND_EQUATION_ALPHA_EXT\0" "GL_BLEND_EQUATION_EXT\0" "GL_BLEND_EQUATION_RGB_EXT\0" "GL_BLEND_SRC\0" "GL_BLEND_SRC_ALPHA\0" "GL_BLEND_SRC_RGB\0" "GL_BLUE\0" "GL_BLUE_BIAS\0" "GL_BLUE_BITS\0" "GL_BLUE_SCALE\0" "GL_BOOL_ARB\0" "GL_BOOL_VEC2_ARB\0" "GL_BOOL_VEC3_ARB\0" "GL_BOOL_VEC4_ARB\0" "GL_BUFFER_ACCESS\0" "GL_BUFFER_ACCESS_ARB\0" "GL_BUFFER_MAPPED\0" "GL_BUFFER_MAPPED_ARB\0" "GL_BUFFER_MAP_POINTER\0" "GL_BUFFER_MAP_POINTER_ARB\0" "GL_BUFFER_SIZE\0" "GL_BUFFER_SIZE_ARB\0" "GL_BUFFER_USAGE\0" "GL_BUFFER_USAGE_ARB\0" "GL_BYTE\0" "GL_C3F_V3F\0" "GL_C4F_N3F_V3F\0" "GL_C4UB_V2F\0" "GL_C4UB_V3F\0" "GL_CCW\0" "GL_CLAMP\0" "GL_CLAMP_TO_BORDER\0" "GL_CLAMP_TO_BORDER_ARB\0" "GL_CLAMP_TO_BORDER_SGIS\0" "GL_CLAMP_TO_EDGE\0" "GL_CLAMP_TO_EDGE_SGIS\0" "GL_CLEAR\0" "GL_CLIENT_ACTIVE_TEXTURE\0" "GL_CLIENT_ACTIVE_TEXTURE_ARB\0" "GL_CLIENT_ALL_ATTRIB_BITS\0" "GL_CLIENT_ATTRIB_STACK_DEPTH\0" "GL_CLIENT_PIXEL_STORE_BIT\0" "GL_CLIENT_VERTEX_ARRAY_BIT\0" "GL_CLIP_PLANE0\0" "GL_CLIP_PLANE1\0" "GL_CLIP_PLANE2\0" "GL_CLIP_PLANE3\0" "GL_CLIP_PLANE4\0" "GL_CLIP_PLANE5\0" "GL_CLIP_VOLUME_CLIPPING_HINT_EXT\0" "GL_COEFF\0" "GL_COLOR\0" "GL_COLOR_ARRAY\0" "GL_COLOR_ARRAY_BUFFER_BINDING\0" "GL_COLOR_ARRAY_BUFFER_BINDING_ARB\0" "GL_COLOR_ARRAY_POINTER\0" "GL_COLOR_ARRAY_SIZE\0" "GL_COLOR_ARRAY_STRIDE\0" "GL_COLOR_ARRAY_TYPE\0" "GL_COLOR_ATTACHMENT0_EXT\0" "GL_COLOR_ATTACHMENT10_EXT\0" "GL_COLOR_ATTACHMENT11_EXT\0" "GL_COLOR_ATTACHMENT12_EXT\0" "GL_COLOR_ATTACHMENT13_EXT\0" "GL_COLOR_ATTACHMENT14_EXT\0" "GL_COLOR_ATTACHMENT15_EXT\0" "GL_COLOR_ATTACHMENT1_EXT\0" "GL_COLOR_ATTACHMENT2_EXT\0" "GL_COLOR_ATTACHMENT3_EXT\0" "GL_COLOR_ATTACHMENT4_EXT\0" "GL_COLOR_ATTACHMENT5_EXT\0" "GL_COLOR_ATTACHMENT6_EXT\0" "GL_COLOR_ATTACHMENT7_EXT\0" "GL_COLOR_ATTACHMENT8_EXT\0" "GL_COLOR_ATTACHMENT9_EXT\0" "GL_COLOR_BUFFER_BIT\0" "GL_COLOR_CLEAR_VALUE\0" "GL_COLOR_INDEX\0" "GL_COLOR_INDEXES\0" "GL_COLOR_LOGIC_OP\0" "GL_COLOR_MATERIAL\0" "GL_COLOR_MATERIAL_FACE\0" "GL_COLOR_MATERIAL_PARAMETER\0" "GL_COLOR_MATRIX\0" "GL_COLOR_MATRIX_SGI\0" "GL_COLOR_MATRIX_STACK_DEPTH\0" "GL_COLOR_MATRIX_STACK_DEPTH_SGI\0" "GL_COLOR_SUM\0" "GL_COLOR_SUM_ARB\0" "GL_COLOR_TABLE\0" "GL_COLOR_TABLE_ALPHA_SIZE\0" "GL_COLOR_TABLE_ALPHA_SIZE_EXT\0" "GL_COLOR_TABLE_BIAS\0" "GL_COLOR_TABLE_BLUE_SIZE\0" "GL_COLOR_TABLE_BLUE_SIZE_EXT\0" "GL_COLOR_TABLE_FORMAT\0" "GL_COLOR_TABLE_FORMAT_EXT\0" "GL_COLOR_TABLE_GREEN_SIZE\0" "GL_COLOR_TABLE_GREEN_SIZE_EXT\0" "GL_COLOR_TABLE_INTENSITY_SIZE\0" "GL_COLOR_TABLE_INTENSITY_SIZE_EXT\0" "GL_COLOR_TABLE_LUMINANCE_SIZE\0" "GL_COLOR_TABLE_LUMINANCE_SIZE_EXT\0" "GL_COLOR_TABLE_RED_SIZE\0" "GL_COLOR_TABLE_RED_SIZE_EXT\0" "GL_COLOR_TABLE_SCALE\0" "GL_COLOR_TABLE_WIDTH\0" "GL_COLOR_TABLE_WIDTH_EXT\0" "GL_COLOR_WRITEMASK\0" "GL_COMBINE\0" "GL_COMBINE4\0" "GL_COMBINE_ALPHA\0" "GL_COMBINE_ALPHA_ARB\0" "GL_COMBINE_ALPHA_EXT\0" "GL_COMBINE_ARB\0" "GL_COMBINE_EXT\0" "GL_COMBINE_RGB\0" "GL_COMBINE_RGB_ARB\0" "GL_COMBINE_RGB_EXT\0" "GL_COMPARE_R_TO_TEXTURE\0" "GL_COMPARE_R_TO_TEXTURE_ARB\0" "GL_COMPILE\0" "GL_COMPILE_AND_EXECUTE\0" "GL_COMPRESSED_ALPHA\0" "GL_COMPRESSED_ALPHA_ARB\0" "GL_COMPRESSED_INTENSITY\0" "GL_COMPRESSED_INTENSITY_ARB\0" "GL_COMPRESSED_LUMINANCE\0" "GL_COMPRESSED_LUMINANCE_ALPHA\0" "GL_COMPRESSED_LUMINANCE_ALPHA_ARB\0" "GL_COMPRESSED_LUMINANCE_ARB\0" "GL_COMPRESSED_RGB\0" "GL_COMPRESSED_RGBA\0" "GL_COMPRESSED_RGBA_ARB\0" "GL_COMPRESSED_RGBA_FXT1_3DFX\0" "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT\0" "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT\0" "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT\0" "GL_COMPRESSED_RGB_ARB\0" "GL_COMPRESSED_RGB_FXT1_3DFX\0" "GL_COMPRESSED_RGB_S3TC_DXT1_EXT\0" "GL_COMPRESSED_TEXTURE_FORMATS\0" "GL_CONSTANT\0" "GL_CONSTANT_ALPHA\0" "GL_CONSTANT_ALPHA_EXT\0" "GL_CONSTANT_ARB\0" "GL_CONSTANT_ATTENUATION\0" "GL_CONSTANT_BORDER_HP\0" "GL_CONSTANT_COLOR\0" "GL_CONSTANT_COLOR_EXT\0" "GL_CONSTANT_EXT\0" "GL_CONVOLUTION_1D\0" "GL_CONVOLUTION_2D\0" "GL_CONVOLUTION_BORDER_COLOR\0" "GL_CONVOLUTION_BORDER_COLOR_HP\0" "GL_CONVOLUTION_BORDER_MODE\0" "GL_CONVOLUTION_BORDER_MODE_EXT\0" "GL_CONVOLUTION_FILTER_BIAS\0" "GL_CONVOLUTION_FILTER_BIAS_EXT\0" "GL_CONVOLUTION_FILTER_SCALE\0" "GL_CONVOLUTION_FILTER_SCALE_EXT\0" "GL_CONVOLUTION_FORMAT\0" "GL_CONVOLUTION_FORMAT_EXT\0" "GL_CONVOLUTION_HEIGHT\0" "GL_CONVOLUTION_HEIGHT_EXT\0" "GL_CONVOLUTION_WIDTH\0" "GL_CONVOLUTION_WIDTH_EXT\0" "GL_COORD_REPLACE_ARB\0" "GL_COORD_REPLACE_NV\0" "GL_COPY\0" "GL_COPY_INVERTED\0" "GL_COPY_PIXEL_TOKEN\0" "GL_CULL_FACE\0" "GL_CULL_FACE_MODE\0" "GL_CULL_VERTEX_EXT\0" "GL_CULL_VERTEX_EYE_POSITION_EXT\0" "GL_CULL_VERTEX_OBJECT_POSITION_EXT\0" "GL_CURRENT_ATTRIB_NV\0" "GL_CURRENT_BIT\0" "GL_CURRENT_COLOR\0" "GL_CURRENT_FOG_COORD\0" "GL_CURRENT_FOG_COORDINATE\0" "GL_CURRENT_INDEX\0" "GL_CURRENT_MATRIX_ARB\0" "GL_CURRENT_MATRIX_INDEX_ARB\0" "GL_CURRENT_MATRIX_NV\0" "GL_CURRENT_MATRIX_STACK_DEPTH_ARB\0" "GL_CURRENT_MATRIX_STACK_DEPTH_NV\0" "GL_CURRENT_NORMAL\0" "GL_CURRENT_PALETTE_MATRIX_ARB\0" "GL_CURRENT_QUERY\0" "GL_CURRENT_QUERY_ARB\0" "GL_CURRENT_RASTER_COLOR\0" "GL_CURRENT_RASTER_DISTANCE\0" "GL_CURRENT_RASTER_INDEX\0" "GL_CURRENT_RASTER_POSITION\0" "GL_CURRENT_RASTER_POSITION_VALID\0" "GL_CURRENT_RASTER_TEXTURE_COORDS\0" "GL_CURRENT_SECONDARY_COLOR\0" "GL_CURRENT_TEXTURE_COORDS\0" "GL_CURRENT_VERTEX_ATTRIB_ARB\0" "GL_CURRENT_WEIGHT_ARB\0" "GL_CW\0" "GL_DECAL\0" "GL_DECR\0" "GL_DECR_WRAP\0" "GL_DECR_WRAP_EXT\0" "GL_DEPTH\0" "GL_DEPTH_ATTACHMENT_EXT\0" "GL_DEPTH_BIAS\0" "GL_DEPTH_BITS\0" "GL_DEPTH_BOUNDS_EXT\0" "GL_DEPTH_BOUNDS_TEST_EXT\0" "GL_DEPTH_BUFFER_BIT\0" "GL_DEPTH_CLAMP_NV\0" "GL_DEPTH_CLEAR_VALUE\0" "GL_DEPTH_COMPONENT\0" "GL_DEPTH_COMPONENT16\0" "GL_DEPTH_COMPONENT16_ARB\0" "GL_DEPTH_COMPONENT16_SGIX\0" "GL_DEPTH_COMPONENT24\0" "GL_DEPTH_COMPONENT24_ARB\0" "GL_DEPTH_COMPONENT24_SGIX\0" "GL_DEPTH_COMPONENT32\0" "GL_DEPTH_COMPONENT32_ARB\0" "GL_DEPTH_COMPONENT32_SGIX\0" "GL_DEPTH_FUNC\0" "GL_DEPTH_RANGE\0" "GL_DEPTH_SCALE\0" "GL_DEPTH_STENCIL_NV\0" "GL_DEPTH_STENCIL_TO_BGRA_NV\0" "GL_DEPTH_STENCIL_TO_RGBA_NV\0" "GL_DEPTH_TEST\0" "GL_DEPTH_TEXTURE_MODE\0" "GL_DEPTH_TEXTURE_MODE_ARB\0" "GL_DEPTH_WRITEMASK\0" "GL_DIFFUSE\0" "GL_DITHER\0" "GL_DOMAIN\0" "GL_DONT_CARE\0" "GL_DOT3_RGB\0" "GL_DOT3_RGBA\0" "GL_DOT3_RGBA_ARB\0" "GL_DOT3_RGBA_EXT\0" "GL_DOT3_RGB_ARB\0" "GL_DOT3_RGB_EXT\0" "GL_DOUBLE\0" "GL_DOUBLEBUFFER\0" "GL_DRAW_BUFFER\0" "GL_DRAW_BUFFER0_ARB\0" "GL_DRAW_BUFFER0_ATI\0" "GL_DRAW_BUFFER10_ARB\0" "GL_DRAW_BUFFER10_ATI\0" "GL_DRAW_BUFFER11_ARB\0" "GL_DRAW_BUFFER11_ATI\0" "GL_DRAW_BUFFER12_ARB\0" "GL_DRAW_BUFFER12_ATI\0" "GL_DRAW_BUFFER13_ARB\0" "GL_DRAW_BUFFER13_ATI\0" "GL_DRAW_BUFFER14_ARB\0" "GL_DRAW_BUFFER14_ATI\0" "GL_DRAW_BUFFER15_ARB\0" "GL_DRAW_BUFFER15_ATI\0" "GL_DRAW_BUFFER1_ARB\0" "GL_DRAW_BUFFER1_ATI\0" "GL_DRAW_BUFFER2_ARB\0" "GL_DRAW_BUFFER2_ATI\0" "GL_DRAW_BUFFER3_ARB\0" "GL_DRAW_BUFFER3_ATI\0" "GL_DRAW_BUFFER4_ARB\0" "GL_DRAW_BUFFER4_ATI\0" "GL_DRAW_BUFFER5_ARB\0" "GL_DRAW_BUFFER5_ATI\0" "GL_DRAW_BUFFER6_ARB\0" "GL_DRAW_BUFFER6_ATI\0" "GL_DRAW_BUFFER7_ARB\0" "GL_DRAW_BUFFER7_ATI\0" "GL_DRAW_BUFFER8_ARB\0" "GL_DRAW_BUFFER8_ATI\0" "GL_DRAW_BUFFER9_ARB\0" "GL_DRAW_BUFFER9_ATI\0" "GL_DRAW_PIXEL_TOKEN\0" "GL_DST_ALPHA\0" "GL_DST_COLOR\0" "GL_DYNAMIC_COPY\0" "GL_DYNAMIC_COPY_ARB\0" "GL_DYNAMIC_DRAW\0" "GL_DYNAMIC_DRAW_ARB\0" "GL_DYNAMIC_READ\0" "GL_DYNAMIC_READ_ARB\0" "GL_EDGE_FLAG\0" "GL_EDGE_FLAG_ARRAY\0" "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING\0" "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB\0" "GL_EDGE_FLAG_ARRAY_POINTER\0" "GL_EDGE_FLAG_ARRAY_STRIDE\0" "GL_ELEMENT_ARRAY_BUFFER\0" "GL_ELEMENT_ARRAY_BUFFER_ARB\0" "GL_ELEMENT_ARRAY_BUFFER_BINDING\0" "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB\0" "GL_EMISSION\0" "GL_ENABLE_BIT\0" "GL_EQUAL\0" "GL_EQUIV\0" "GL_EVAL_BIT\0" "GL_EXP\0" "GL_EXP2\0" "GL_EXTENSIONS\0" "GL_EYE_LINEAR\0" "GL_EYE_PLANE\0" "GL_EYE_PLANE_ABSOLUTE_NV\0" "GL_EYE_RADIAL_NV\0" "GL_FALSE\0" "GL_FASTEST\0" "GL_FEEDBACK\0" "GL_FEEDBACK_BUFFER_POINTER\0" "GL_FEEDBACK_BUFFER_SIZE\0" "GL_FEEDBACK_BUFFER_TYPE\0" "GL_FILL\0" "GL_FLAT\0" "GL_FLOAT\0" "GL_FLOAT_MAT2_ARB\0" "GL_FLOAT_MAT3_ARB\0" "GL_FLOAT_MAT4_ARB\0" "GL_FLOAT_VEC2_ARB\0" "GL_FLOAT_VEC3_ARB\0" "GL_FLOAT_VEC4_ARB\0" "GL_FOG\0" "GL_FOG_BIT\0" "GL_FOG_COLOR\0" "GL_FOG_COORD\0" "GL_FOG_COORDINATE\0" "GL_FOG_COORDINATE_ARRAY\0" "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING\0" "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB\0" "GL_FOG_COORDINATE_ARRAY_POINTER\0" "GL_FOG_COORDINATE_ARRAY_STRIDE\0" "GL_FOG_COORDINATE_ARRAY_TYPE\0" "GL_FOG_COORDINATE_SOURCE\0" "GL_FOG_COORD_ARRAY\0" "GL_FOG_COORD_ARRAY_BUFFER_BINDING\0" "GL_FOG_COORD_ARRAY_POINTER\0" "GL_FOG_COORD_ARRAY_STRIDE\0" "GL_FOG_COORD_ARRAY_TYPE\0" "GL_FOG_COORD_SOURCE\0" "GL_FOG_DENSITY\0" "GL_FOG_DISTANCE_MODE_NV\0" "GL_FOG_END\0" "GL_FOG_HINT\0" "GL_FOG_INDEX\0" "GL_FOG_MODE\0" "GL_FOG_OFFSET_SGIX\0" "GL_FOG_OFFSET_VALUE_SGIX\0" "GL_FOG_START\0" "GL_FRAGMENT_DEPTH\0" "GL_FRAGMENT_PROGRAM_ARB\0" "GL_FRAGMENT_SHADER_ARB\0" "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT\0" "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT\0" "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT\0" "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT\0" "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT\0" "GL_FRAMEBUFFER_BINDING_EXT\0" "GL_FRAMEBUFFER_COMPLETE_EXT\0" "GL_FRAMEBUFFER_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT\0" "GL_FRAMEBUFFER_STATUS_ERROR_EXT\0" "GL_FRAMEBUFFER_UNSUPPORTED_EXT\0" "GL_FRONT\0" "GL_FRONT_AND_BACK\0" "GL_FRONT_FACE\0" "GL_FRONT_LEFT\0" "GL_FRONT_RIGHT\0" "GL_FUNC_ADD\0" "GL_FUNC_ADD_EXT\0" "GL_FUNC_REVERSE_SUBTRACT\0" "GL_FUNC_REVERSE_SUBTRACT_EXT\0" "GL_FUNC_SUBTRACT\0" "GL_FUNC_SUBTRACT_EXT\0" "GL_GENERATE_MIPMAP\0" "GL_GENERATE_MIPMAP_HINT\0" "GL_GENERATE_MIPMAP_HINT_SGIS\0" "GL_GENERATE_MIPMAP_SGIS\0" "GL_GEQUAL\0" "GL_GREATER\0" "GL_GREEN\0" "GL_GREEN_BIAS\0" "GL_GREEN_BITS\0" "GL_GREEN_SCALE\0" "GL_HINT_BIT\0" "GL_HISTOGRAM\0" "GL_HISTOGRAM_ALPHA_SIZE\0" "GL_HISTOGRAM_ALPHA_SIZE_EXT\0" "GL_HISTOGRAM_BLUE_SIZE\0" "GL_HISTOGRAM_BLUE_SIZE_EXT\0" "GL_HISTOGRAM_EXT\0" "GL_HISTOGRAM_FORMAT\0" "GL_HISTOGRAM_FORMAT_EXT\0" "GL_HISTOGRAM_GREEN_SIZE\0" "GL_HISTOGRAM_GREEN_SIZE_EXT\0" "GL_HISTOGRAM_LUMINANCE_SIZE\0" "GL_HISTOGRAM_LUMINANCE_SIZE_EXT\0" "GL_HISTOGRAM_RED_SIZE\0" "GL_HISTOGRAM_RED_SIZE_EXT\0" "GL_HISTOGRAM_SINK\0" "GL_HISTOGRAM_SINK_EXT\0" "GL_HISTOGRAM_WIDTH\0" "GL_HISTOGRAM_WIDTH_EXT\0" "GL_IDENTITY_NV\0" "GL_IGNORE_BORDER_HP\0" "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES\0" "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES\0" "GL_INCR\0" "GL_INCR_WRAP\0" "GL_INCR_WRAP_EXT\0" "GL_INDEX_ARRAY\0" "GL_INDEX_ARRAY_BUFFER_BINDING\0" "GL_INDEX_ARRAY_BUFFER_BINDING_ARB\0" "GL_INDEX_ARRAY_POINTER\0" "GL_INDEX_ARRAY_STRIDE\0" "GL_INDEX_ARRAY_TYPE\0" "GL_INDEX_BITS\0" "GL_INDEX_CLEAR_VALUE\0" "GL_INDEX_LOGIC_OP\0" "GL_INDEX_MODE\0" "GL_INDEX_OFFSET\0" "GL_INDEX_SHIFT\0" "GL_INDEX_WRITEMASK\0" "GL_INT\0" "GL_INTENSITY\0" "GL_INTENSITY12\0" "GL_INTENSITY12_EXT\0" "GL_INTENSITY16\0" "GL_INTENSITY16_EXT\0" "GL_INTENSITY4\0" "GL_INTENSITY4_EXT\0" "GL_INTENSITY8\0" "GL_INTENSITY8_EXT\0" "GL_INTENSITY_EXT\0" "GL_INTERPOLATE\0" "GL_INTERPOLATE_ARB\0" "GL_INTERPOLATE_EXT\0" "GL_INT_VEC2_ARB\0" "GL_INT_VEC3_ARB\0" "GL_INT_VEC4_ARB\0" "GL_INVALID_ENUM\0" "GL_INVALID_FRAMEBUFFER_OPERATION_EXT\0" "GL_INVALID_OPERATION\0" "GL_INVALID_VALUE\0" "GL_INVERSE_NV\0" "GL_INVERSE_TRANSPOSE_NV\0" "GL_INVERT\0" "GL_KEEP\0" "GL_LEFT\0" "GL_LEQUAL\0" "GL_LESS\0" "GL_LIGHT0\0" "GL_LIGHT1\0" "GL_LIGHT2\0" "GL_LIGHT3\0" "GL_LIGHT4\0" "GL_LIGHT5\0" "GL_LIGHT6\0" "GL_LIGHT7\0" "GL_LIGHTING\0" "GL_LIGHTING_BIT\0" "GL_LIGHT_MODEL_AMBIENT\0" "GL_LIGHT_MODEL_COLOR_CONTROL\0" "GL_LIGHT_MODEL_COLOR_CONTROL_EXT\0" "GL_LIGHT_MODEL_LOCAL_VIEWER\0" "GL_LIGHT_MODEL_TWO_SIDE\0" "GL_LINE\0" "GL_LINEAR\0" "GL_LINEAR_ATTENUATION\0" "GL_LINEAR_CLIPMAP_LINEAR_SGIX\0" "GL_LINEAR_CLIPMAP_NEAREST_SGIX\0" "GL_LINEAR_MIPMAP_LINEAR\0" "GL_LINEAR_MIPMAP_NEAREST\0" "GL_LINES\0" "GL_LINE_BIT\0" "GL_LINE_LOOP\0" "GL_LINE_RESET_TOKEN\0" "GL_LINE_SMOOTH\0" "GL_LINE_SMOOTH_HINT\0" "GL_LINE_STIPPLE\0" "GL_LINE_STIPPLE_PATTERN\0" "GL_LINE_STIPPLE_REPEAT\0" "GL_LINE_STRIP\0" "GL_LINE_TOKEN\0" "GL_LINE_WIDTH\0" "GL_LINE_WIDTH_GRANULARITY\0" "GL_LINE_WIDTH_RANGE\0" "GL_LIST_BASE\0" "GL_LIST_BIT\0" "GL_LIST_INDEX\0" "GL_LIST_MODE\0" "GL_LOAD\0" "GL_LOGIC_OP\0" "GL_LOGIC_OP_MODE\0" "GL_LUMINANCE\0" "GL_LUMINANCE12\0" "GL_LUMINANCE12_ALPHA12\0" "GL_LUMINANCE12_ALPHA12_EXT\0" "GL_LUMINANCE12_ALPHA4\0" "GL_LUMINANCE12_ALPHA4_EXT\0" "GL_LUMINANCE12_EXT\0" "GL_LUMINANCE16\0" "GL_LUMINANCE16_ALPHA16\0" "GL_LUMINANCE16_ALPHA16_EXT\0" "GL_LUMINANCE16_EXT\0" "GL_LUMINANCE4\0" "GL_LUMINANCE4_ALPHA4\0" "GL_LUMINANCE4_ALPHA4_EXT\0" "GL_LUMINANCE4_EXT\0" "GL_LUMINANCE6_ALPHA2\0" "GL_LUMINANCE6_ALPHA2_EXT\0" "GL_LUMINANCE8\0" "GL_LUMINANCE8_ALPHA8\0" "GL_LUMINANCE8_ALPHA8_EXT\0" "GL_LUMINANCE8_EXT\0" "GL_LUMINANCE_ALPHA\0" "GL_MAP1_COLOR_4\0" "GL_MAP1_GRID_DOMAIN\0" "GL_MAP1_GRID_SEGMENTS\0" "GL_MAP1_INDEX\0" "GL_MAP1_NORMAL\0" "GL_MAP1_TEXTURE_COORD_1\0" "GL_MAP1_TEXTURE_COORD_2\0" "GL_MAP1_TEXTURE_COORD_3\0" "GL_MAP1_TEXTURE_COORD_4\0" "GL_MAP1_VERTEX_3\0" "GL_MAP1_VERTEX_4\0" "GL_MAP1_VERTEX_ATTRIB0_4_NV\0" "GL_MAP1_VERTEX_ATTRIB10_4_NV\0" "GL_MAP1_VERTEX_ATTRIB11_4_NV\0" "GL_MAP1_VERTEX_ATTRIB12_4_NV\0" "GL_MAP1_VERTEX_ATTRIB13_4_NV\0" "GL_MAP1_VERTEX_ATTRIB14_4_NV\0" "GL_MAP1_VERTEX_ATTRIB15_4_NV\0" "GL_MAP1_VERTEX_ATTRIB1_4_NV\0" "GL_MAP1_VERTEX_ATTRIB2_4_NV\0" "GL_MAP1_VERTEX_ATTRIB3_4_NV\0" "GL_MAP1_VERTEX_ATTRIB4_4_NV\0" "GL_MAP1_VERTEX_ATTRIB5_4_NV\0" "GL_MAP1_VERTEX_ATTRIB6_4_NV\0" "GL_MAP1_VERTEX_ATTRIB7_4_NV\0" "GL_MAP1_VERTEX_ATTRIB8_4_NV\0" "GL_MAP1_VERTEX_ATTRIB9_4_NV\0" "GL_MAP2_COLOR_4\0" "GL_MAP2_GRID_DOMAIN\0" "GL_MAP2_GRID_SEGMENTS\0" "GL_MAP2_INDEX\0" "GL_MAP2_NORMAL\0" "GL_MAP2_TEXTURE_COORD_1\0" "GL_MAP2_TEXTURE_COORD_2\0" "GL_MAP2_TEXTURE_COORD_3\0" "GL_MAP2_TEXTURE_COORD_4\0" "GL_MAP2_VERTEX_3\0" "GL_MAP2_VERTEX_4\0" "GL_MAP2_VERTEX_ATTRIB0_4_NV\0" "GL_MAP2_VERTEX_ATTRIB10_4_NV\0" "GL_MAP2_VERTEX_ATTRIB11_4_NV\0" "GL_MAP2_VERTEX_ATTRIB12_4_NV\0" "GL_MAP2_VERTEX_ATTRIB13_4_NV\0" "GL_MAP2_VERTEX_ATTRIB14_4_NV\0" "GL_MAP2_VERTEX_ATTRIB15_4_NV\0" "GL_MAP2_VERTEX_ATTRIB1_4_NV\0" "GL_MAP2_VERTEX_ATTRIB2_4_NV\0" "GL_MAP2_VERTEX_ATTRIB3_4_NV\0" "GL_MAP2_VERTEX_ATTRIB4_4_NV\0" "GL_MAP2_VERTEX_ATTRIB5_4_NV\0" "GL_MAP2_VERTEX_ATTRIB6_4_NV\0" "GL_MAP2_VERTEX_ATTRIB7_4_NV\0" "GL_MAP2_VERTEX_ATTRIB8_4_NV\0" "GL_MAP2_VERTEX_ATTRIB9_4_NV\0" "GL_MAP_COLOR\0" "GL_MAP_STENCIL\0" "GL_MATRIX0_ARB\0" "GL_MATRIX0_NV\0" "GL_MATRIX10_ARB\0" "GL_MATRIX11_ARB\0" "GL_MATRIX12_ARB\0" "GL_MATRIX13_ARB\0" "GL_MATRIX14_ARB\0" "GL_MATRIX15_ARB\0" "GL_MATRIX16_ARB\0" "GL_MATRIX17_ARB\0" "GL_MATRIX18_ARB\0" "GL_MATRIX19_ARB\0" "GL_MATRIX1_ARB\0" "GL_MATRIX1_NV\0" "GL_MATRIX20_ARB\0" "GL_MATRIX21_ARB\0" "GL_MATRIX22_ARB\0" "GL_MATRIX23_ARB\0" "GL_MATRIX24_ARB\0" "GL_MATRIX25_ARB\0" "GL_MATRIX26_ARB\0" "GL_MATRIX27_ARB\0" "GL_MATRIX28_ARB\0" "GL_MATRIX29_ARB\0" "GL_MATRIX2_ARB\0" "GL_MATRIX2_NV\0" "GL_MATRIX30_ARB\0" "GL_MATRIX31_ARB\0" "GL_MATRIX3_ARB\0" "GL_MATRIX3_NV\0" "GL_MATRIX4_ARB\0" "GL_MATRIX4_NV\0" "GL_MATRIX5_ARB\0" "GL_MATRIX5_NV\0" "GL_MATRIX6_ARB\0" "GL_MATRIX6_NV\0" "GL_MATRIX7_ARB\0" "GL_MATRIX7_NV\0" "GL_MATRIX8_ARB\0" "GL_MATRIX9_ARB\0" "GL_MATRIX_INDEX_ARRAY_ARB\0" "GL_MATRIX_INDEX_ARRAY_POINTER_ARB\0" "GL_MATRIX_INDEX_ARRAY_SIZE_ARB\0" "GL_MATRIX_INDEX_ARRAY_STRIDE_ARB\0" "GL_MATRIX_INDEX_ARRAY_TYPE_ARB\0" "GL_MATRIX_MODE\0" "GL_MATRIX_PALETTE_ARB\0" "GL_MAX\0" "GL_MAX_3D_TEXTURE_SIZE\0" "GL_MAX_ATTRIB_STACK_DEPTH\0" "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH\0" "GL_MAX_CLIPMAP_DEPTH_SGIX\0" "GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX\0" "GL_MAX_CLIP_PLANES\0" "GL_MAX_COLOR_ATTACHMENTS_EXT\0" "GL_MAX_COLOR_MATRIX_STACK_DEPTH\0" "GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI\0" "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB\0" "GL_MAX_CONVOLUTION_HEIGHT\0" "GL_MAX_CONVOLUTION_HEIGHT_EXT\0" "GL_MAX_CONVOLUTION_WIDTH\0" "GL_MAX_CONVOLUTION_WIDTH_EXT\0" "GL_MAX_CUBE_MAP_TEXTURE_SIZE\0" "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB\0" "GL_MAX_DRAW_BUFFERS_ARB\0" "GL_MAX_DRAW_BUFFERS_ATI\0" "GL_MAX_ELEMENTS_INDICES\0" "GL_MAX_ELEMENTS_VERTICES\0" "GL_MAX_EVAL_ORDER\0" "GL_MAX_EXT\0" "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB\0" "GL_MAX_LIGHTS\0" "GL_MAX_LIST_NESTING\0" "GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB\0" "GL_MAX_MODELVIEW_STACK_DEPTH\0" "GL_MAX_NAME_STACK_DEPTH\0" "GL_MAX_PALETTE_MATRICES_ARB\0" "GL_MAX_PIXEL_MAP_TABLE\0" "GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB\0" "GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB\0" "GL_MAX_PROGRAM_ATTRIBS_ARB\0" "GL_MAX_PROGRAM_CALL_DEPTH_NV\0" "GL_MAX_PROGRAM_ENV_PARAMETERS_ARB\0" "GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV\0" "GL_MAX_PROGRAM_IF_DEPTH_NV\0" "GL_MAX_PROGRAM_INSTRUCTIONS_ARB\0" "GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB\0" "GL_MAX_PROGRAM_LOOP_COUNT_NV\0" "GL_MAX_PROGRAM_LOOP_DEPTH_NV\0" "GL_MAX_PROGRAM_MATRICES_ARB\0" "GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB\0" "GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB\0" "GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB\0" "GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB\0" "GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB\0" "GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB\0" "GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB\0" "GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB\0" "GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB\0" "GL_MAX_PROGRAM_PARAMETERS_ARB\0" "GL_MAX_PROGRAM_TEMPORARIES_ARB\0" "GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB\0" "GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB\0" "GL_MAX_PROJECTION_STACK_DEPTH\0" "GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB\0" "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV\0" "GL_MAX_RENDERBUFFER_SIZE_EXT\0" "GL_MAX_SHININESS_NV\0" "GL_MAX_SPOT_EXPONENT_NV\0" "GL_MAX_TEXTURE_COORDS_ARB\0" "GL_MAX_TEXTURE_IMAGE_UNITS_ARB\0" "GL_MAX_TEXTURE_LOD_BIAS\0" "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT\0" "GL_MAX_TEXTURE_SIZE\0" "GL_MAX_TEXTURE_STACK_DEPTH\0" "GL_MAX_TEXTURE_UNITS\0" "GL_MAX_TEXTURE_UNITS_ARB\0" "GL_MAX_TRACK_MATRICES_NV\0" "GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV\0" "GL_MAX_VARYING_FLOATS_ARB\0" "GL_MAX_VERTEX_ATTRIBS_ARB\0" "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB\0" "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB\0" "GL_MAX_VERTEX_UNITS_ARB\0" "GL_MAX_VIEWPORT_DIMS\0" "GL_MIN\0" "GL_MINMAX\0" "GL_MINMAX_EXT\0" "GL_MINMAX_FORMAT\0" "GL_MINMAX_FORMAT_EXT\0" "GL_MINMAX_SINK\0" "GL_MINMAX_SINK_EXT\0" "GL_MIN_EXT\0" "GL_MIRRORED_REPEAT\0" "GL_MIRRORED_REPEAT_ARB\0" "GL_MIRRORED_REPEAT_IBM\0" "GL_MIRROR_CLAMP_ATI\0" "GL_MIRROR_CLAMP_EXT\0" "GL_MIRROR_CLAMP_TO_BORDER_EXT\0" "GL_MIRROR_CLAMP_TO_EDGE_ATI\0" "GL_MIRROR_CLAMP_TO_EDGE_EXT\0" "GL_MODELVIEW\0" "GL_MODELVIEW0_ARB\0" "GL_MODELVIEW10_ARB\0" "GL_MODELVIEW11_ARB\0" "GL_MODELVIEW12_ARB\0" "GL_MODELVIEW13_ARB\0" "GL_MODELVIEW14_ARB\0" "GL_MODELVIEW15_ARB\0" "GL_MODELVIEW16_ARB\0" "GL_MODELVIEW17_ARB\0" "GL_MODELVIEW18_ARB\0" "GL_MODELVIEW19_ARB\0" "GL_MODELVIEW1_ARB\0" "GL_MODELVIEW20_ARB\0" "GL_MODELVIEW21_ARB\0" "GL_MODELVIEW22_ARB\0" "GL_MODELVIEW23_ARB\0" "GL_MODELVIEW24_ARB\0" "GL_MODELVIEW25_ARB\0" "GL_MODELVIEW26_ARB\0" "GL_MODELVIEW27_ARB\0" "GL_MODELVIEW28_ARB\0" "GL_MODELVIEW29_ARB\0" "GL_MODELVIEW2_ARB\0" "GL_MODELVIEW30_ARB\0" "GL_MODELVIEW31_ARB\0" "GL_MODELVIEW3_ARB\0" "GL_MODELVIEW4_ARB\0" "GL_MODELVIEW5_ARB\0" "GL_MODELVIEW6_ARB\0" "GL_MODELVIEW7_ARB\0" "GL_MODELVIEW8_ARB\0" "GL_MODELVIEW9_ARB\0" "GL_MODELVIEW_MATRIX\0" "GL_MODELVIEW_PROJECTION_NV\0" "GL_MODELVIEW_STACK_DEPTH\0" "GL_MODULATE\0" "GL_MODULATE_ADD_ATI\0" "GL_MODULATE_SIGNED_ADD_ATI\0" "GL_MODULATE_SUBTRACT_ATI\0" "GL_MULT\0" "GL_MULTISAMPLE\0" "GL_MULTISAMPLE_3DFX\0" "GL_MULTISAMPLE_ARB\0" "GL_MULTISAMPLE_BIT\0" "GL_MULTISAMPLE_BIT_3DFX\0" "GL_MULTISAMPLE_BIT_ARB\0" "GL_MULTISAMPLE_FILTER_HINT_NV\0" "GL_N3F_V3F\0" "GL_NAME_STACK_DEPTH\0" "GL_NAND\0" "GL_NEAREST\0" "GL_NEAREST_CLIPMAP_LINEAR_SGIX\0" "GL_NEAREST_CLIPMAP_NEAREST_SGIX\0" "GL_NEAREST_MIPMAP_LINEAR\0" "GL_NEAREST_MIPMAP_NEAREST\0" "GL_NEVER\0" "GL_NICEST\0" "GL_NONE\0" "GL_NOOP\0" "GL_NOR\0" "GL_NORMALIZE\0" "GL_NORMAL_ARRAY\0" "GL_NORMAL_ARRAY_BUFFER_BINDING\0" "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB\0" "GL_NORMAL_ARRAY_POINTER\0" "GL_NORMAL_ARRAY_STRIDE\0" "GL_NORMAL_ARRAY_TYPE\0" "GL_NORMAL_MAP\0" "GL_NORMAL_MAP_ARB\0" "GL_NORMAL_MAP_NV\0" "GL_NOTEQUAL\0" "GL_NO_ERROR\0" "GL_NUM_COMPRESSED_TEXTURE_FORMATS\0" "GL_NUM_TEXTURE_COMPRESSED_FORMATS_ARB\0" "GL_OBJECT_ACTIVE_ATTRIBUTES_ARB\0" "GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB\0" "GL_OBJECT_ACTIVE_UNIFORMS_ARB\0" "GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB\0" "GL_OBJECT_ATTACHED_OBJECTS_ARB\0" "GL_OBJECT_COMPILE_STATUS_ARB\0" "GL_OBJECT_DELETE_STATUS_ARB\0" "GL_OBJECT_INFO_LOG_LENGTH_ARB\0" "GL_OBJECT_LINEAR\0" "GL_OBJECT_LINK_STATUS_ARB\0" "GL_OBJECT_PLANE\0" "GL_OBJECT_SHADER_SOURCE_LENGTH_ARB\0" "GL_OBJECT_SUBTYPE_ARB\0" "GL_OBJECT_TYPE_ARB\0" "GL_OBJECT_VALIDATE_STATUS_ARB\0" "GL_OCCLUSION_TEST_HP\0" "GL_OCCLUSION_TEST_RESULT_HP\0" "GL_ONE\0" "GL_ONE_MINUS_CONSTANT_ALPHA\0" "GL_ONE_MINUS_CONSTANT_ALPHA_EXT\0" "GL_ONE_MINUS_CONSTANT_COLOR\0" "GL_ONE_MINUS_CONSTANT_COLOR_EXT\0" "GL_ONE_MINUS_DST_ALPHA\0" "GL_ONE_MINUS_DST_COLOR\0" "GL_ONE_MINUS_SRC_ALPHA\0" "GL_ONE_MINUS_SRC_COLOR\0" "GL_OPERAND0_ALPHA\0" "GL_OPERAND0_ALPHA_ARB\0" "GL_OPERAND0_ALPHA_EXT\0" "GL_OPERAND0_RGB\0" "GL_OPERAND0_RGB_ARB\0" "GL_OPERAND0_RGB_EXT\0" "GL_OPERAND1_ALPHA\0" "GL_OPERAND1_ALPHA_ARB\0" "GL_OPERAND1_ALPHA_EXT\0" "GL_OPERAND1_RGB\0" "GL_OPERAND1_RGB_ARB\0" "GL_OPERAND1_RGB_EXT\0" "GL_OPERAND2_ALPHA\0" "GL_OPERAND2_ALPHA_ARB\0" "GL_OPERAND2_ALPHA_EXT\0" "GL_OPERAND2_RGB\0" "GL_OPERAND2_RGB_ARB\0" "GL_OPERAND2_RGB_EXT\0" "GL_OPERAND3_ALPHA_NV\0" "GL_OPERAND3_RGB_NV\0" "GL_OR\0" "GL_ORDER\0" "GL_OR_INVERTED\0" "GL_OR_REVERSE\0" "GL_OUT_OF_MEMORY\0" "GL_PACK_ALIGNMENT\0" "GL_PACK_IMAGE_HEIGHT\0" "GL_PACK_INVERT_MESA\0" "GL_PACK_LSB_FIRST\0" "GL_PACK_ROW_LENGTH\0" "GL_PACK_SKIP_IMAGES\0" "GL_PACK_SKIP_PIXELS\0" "GL_PACK_SKIP_ROWS\0" "GL_PACK_SWAP_BYTES\0" "GL_PALETTE4_R5_G6_B5_OES\0" "GL_PALETTE4_RGB5_A1_OES\0" "GL_PALETTE4_RGB8_OES\0" "GL_PALETTE4_RGBA4_OES\0" "GL_PALETTE4_RGBA8_OES\0" "GL_PALETTE8_R5_G6_B5_OES\0" "GL_PALETTE8_RGB5_A1_OES\0" "GL_PALETTE8_RGB8_OES\0" "GL_PALETTE8_RGBA4_OES\0" "GL_PALETTE8_RGBA8_OES\0" "GL_PASS_THROUGH_TOKEN\0" "GL_PERSPECTIVE_CORRECTION_HINT\0" "GL_PIXEL_MAP_A_TO_A\0" "GL_PIXEL_MAP_A_TO_A_SIZE\0" "GL_PIXEL_MAP_B_TO_B\0" "GL_PIXEL_MAP_B_TO_B_SIZE\0" "GL_PIXEL_MAP_G_TO_G\0" "GL_PIXEL_MAP_G_TO_G_SIZE\0" "GL_PIXEL_MAP_I_TO_A\0" "GL_PIXEL_MAP_I_TO_A_SIZE\0" "GL_PIXEL_MAP_I_TO_B\0" "GL_PIXEL_MAP_I_TO_B_SIZE\0" "GL_PIXEL_MAP_I_TO_G\0" "GL_PIXEL_MAP_I_TO_G_SIZE\0" "GL_PIXEL_MAP_I_TO_I\0" "GL_PIXEL_MAP_I_TO_I_SIZE\0" "GL_PIXEL_MAP_I_TO_R\0" "GL_PIXEL_MAP_I_TO_R_SIZE\0" "GL_PIXEL_MAP_R_TO_R\0" "GL_PIXEL_MAP_R_TO_R_SIZE\0" "GL_PIXEL_MAP_S_TO_S\0" "GL_PIXEL_MAP_S_TO_S_SIZE\0" "GL_PIXEL_MODE_BIT\0" "GL_PIXEL_PACK_BUFFER_BINDING_EXT\0" "GL_PIXEL_PACK_BUFFER_EXT\0" "GL_PIXEL_UNPACK_BUFFER_BINDING_EXT\0" "GL_PIXEL_UNPACK_BUFFER_EXT\0" "GL_POINT\0" "GL_POINTS\0" "GL_POINT_BIT\0" "GL_POINT_DISTANCE_ATTENUATION\0" "GL_POINT_DISTANCE_ATTENUATION_ARB\0" "GL_POINT_DISTANCE_ATTENUATION_EXT\0" "GL_POINT_DISTANCE_ATTENUATION_SGIS\0" "GL_POINT_FADE_THRESHOLD_SIZE\0" "GL_POINT_FADE_THRESHOLD_SIZE_ARB\0" "GL_POINT_FADE_THRESHOLD_SIZE_EXT\0" "GL_POINT_FADE_THRESHOLD_SIZE_SGIS\0" "GL_POINT_SIZE\0" "GL_POINT_SIZE_GRANULARITY\0" "GL_POINT_SIZE_MAX\0" "GL_POINT_SIZE_MAX_ARB\0" "GL_POINT_SIZE_MAX_EXT\0" "GL_POINT_SIZE_MAX_SGIS\0" "GL_POINT_SIZE_MIN\0" "GL_POINT_SIZE_MIN_ARB\0" "GL_POINT_SIZE_MIN_EXT\0" "GL_POINT_SIZE_MIN_SGIS\0" "GL_POINT_SIZE_RANGE\0" "GL_POINT_SMOOTH\0" "GL_POINT_SMOOTH_HINT\0" "GL_POINT_SPRITE_ARB\0" "GL_POINT_SPRITE_COORD_ORIGIN\0" "GL_POINT_SPRITE_NV\0" "GL_POINT_SPRITE_R_MODE_NV\0" "GL_POINT_TOKEN\0" "GL_POLYGON\0" "GL_POLYGON_BIT\0" "GL_POLYGON_MODE\0" "GL_POLYGON_OFFSET_BIAS\0" "GL_POLYGON_OFFSET_FACTOR\0" "GL_POLYGON_OFFSET_FILL\0" "GL_POLYGON_OFFSET_LINE\0" "GL_POLYGON_OFFSET_POINT\0" "GL_POLYGON_OFFSET_UNITS\0" "GL_POLYGON_SMOOTH\0" "GL_POLYGON_SMOOTH_HINT\0" "GL_POLYGON_STIPPLE\0" "GL_POLYGON_STIPPLE_BIT\0" "GL_POLYGON_TOKEN\0" "GL_POSITION\0" "GL_POST_COLOR_MATRIX_ALPHA_BIAS\0" "GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI\0" "GL_POST_COLOR_MATRIX_ALPHA_SCALE\0" "GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI\0" "GL_POST_COLOR_MATRIX_BLUE_BIAS\0" "GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI\0" "GL_POST_COLOR_MATRIX_BLUE_SCALE\0" "GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI\0" "GL_POST_COLOR_MATRIX_COLOR_TABLE\0" "GL_POST_COLOR_MATRIX_GREEN_BIAS\0" "GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI\0" "GL_POST_COLOR_MATRIX_GREEN_SCALE\0" "GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI\0" "GL_POST_COLOR_MATRIX_RED_BIAS\0" "GL_POST_COLOR_MATRIX_RED_BIAS_SGI\0" "GL_POST_COLOR_MATRIX_RED_SCALE\0" "GL_POST_COLOR_MATRIX_RED_SCALE_SGI\0" "GL_POST_CONVOLUTION_ALPHA_BIAS\0" "GL_POST_CONVOLUTION_ALPHA_BIAS_EXT\0" "GL_POST_CONVOLUTION_ALPHA_SCALE\0" "GL_POST_CONVOLUTION_ALPHA_SCALE_EXT\0" "GL_POST_CONVOLUTION_BLUE_BIAS\0" "GL_POST_CONVOLUTION_BLUE_BIAS_EXT\0" "GL_POST_CONVOLUTION_BLUE_SCALE\0" "GL_POST_CONVOLUTION_BLUE_SCALE_EXT\0" "GL_POST_CONVOLUTION_COLOR_TABLE\0" "GL_POST_CONVOLUTION_GREEN_BIAS\0" "GL_POST_CONVOLUTION_GREEN_BIAS_EXT\0" "GL_POST_CONVOLUTION_GREEN_SCALE\0" "GL_POST_CONVOLUTION_GREEN_SCALE_EXT\0" "GL_POST_CONVOLUTION_RED_BIAS\0" "GL_POST_CONVOLUTION_RED_BIAS_EXT\0" "GL_POST_CONVOLUTION_RED_SCALE\0" "GL_POST_CONVOLUTION_RED_SCALE_EXT\0" "GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX\0" "GL_POST_TEXTURE_FILTER_BIAS_SGIX\0" "GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX\0" "GL_POST_TEXTURE_FILTER_SCALE_SGIX\0" "GL_PREVIOUS\0" "GL_PREVIOUS_ARB\0" "GL_PREVIOUS_EXT\0" "GL_PRIMARY_COLOR\0" "GL_PRIMARY_COLOR_ARB\0" "GL_PRIMARY_COLOR_EXT\0" "GL_PROGRAM_ADDRESS_REGISTERS_ARB\0" "GL_PROGRAM_ALU_INSTRUCTIONS_ARB\0" "GL_PROGRAM_ATTRIBS_ARB\0" "GL_PROGRAM_BINDING_ARB\0" "GL_PROGRAM_ERROR_POSITION_ARB\0" "GL_PROGRAM_ERROR_POSITION_NV\0" "GL_PROGRAM_ERROR_STRING_ARB\0" "GL_PROGRAM_FORMAT_ARB\0" "GL_PROGRAM_FORMAT_ASCII_ARB\0" "GL_PROGRAM_INSTRUCTIONS_ARB\0" "GL_PROGRAM_LENGTH_ARB\0" "GL_PROGRAM_LENGTH_NV\0" "GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB\0" "GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB\0" "GL_PROGRAM_NATIVE_ATTRIBS_ARB\0" "GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB\0" "GL_PROGRAM_NATIVE_PARAMETERS_ARB\0" "GL_PROGRAM_NATIVE_TEMPORARIES_ARB\0" "GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB\0" "GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB\0" "GL_PROGRAM_OBJECT_ARB\0" "GL_PROGRAM_PARAMETERS_ARB\0" "GL_PROGRAM_PARAMETER_NV\0" "GL_PROGRAM_RESIDENT_NV\0" "GL_PROGRAM_STRING_ARB\0" "GL_PROGRAM_STRING_NV\0" "GL_PROGRAM_TARGET_NV\0" "GL_PROGRAM_TEMPORARIES_ARB\0" "GL_PROGRAM_TEX_INDIRECTIONS_ARB\0" "GL_PROGRAM_TEX_INSTRUCTIONS_ARB\0" "GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB\0" "GL_PROJECTION\0" "GL_PROJECTION_MATRIX\0" "GL_PROJECTION_STACK_DEPTH\0" "GL_PROXY_COLOR_TABLE\0" "GL_PROXY_HISTOGRAM\0" "GL_PROXY_HISTOGRAM_EXT\0" "GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE\0" "GL_PROXY_POST_CONVOLUTION_COLOR_TABLE\0" "GL_PROXY_TEXTURE_1D\0" "GL_PROXY_TEXTURE_1D_EXT\0" "GL_PROXY_TEXTURE_2D\0" "GL_PROXY_TEXTURE_2D_EXT\0" "GL_PROXY_TEXTURE_3D\0" "GL_PROXY_TEXTURE_COLOR_TABLE_SGI\0" "GL_PROXY_TEXTURE_CUBE_MAP\0" "GL_PROXY_TEXTURE_CUBE_MAP_ARB\0" "GL_PROXY_TEXTURE_RECTANGLE_ARB\0" "GL_PROXY_TEXTURE_RECTANGLE_NV\0" "GL_Q\0" "GL_QUADRATIC_ATTENUATION\0" "GL_QUADS\0" "GL_QUAD_MESH_SUN\0" "GL_QUAD_STRIP\0" "GL_QUERY_COUNTER_BITS\0" "GL_QUERY_COUNTER_BITS_ARB\0" "GL_QUERY_RESULT\0" "GL_QUERY_RESULT_ARB\0" "GL_QUERY_RESULT_AVAILABLE\0" "GL_QUERY_RESULT_AVAILABLE_ARB\0" "GL_R\0" "GL_R3_G3_B2\0" "GL_RASTER_POSITION_UNCLIPPED_IBM\0" "GL_READ_BUFFER\0" "GL_READ_ONLY\0" "GL_READ_ONLY_ARB\0" "GL_READ_WRITE\0" "GL_READ_WRITE_ARB\0" "GL_RED\0" "GL_REDUCE\0" "GL_REDUCE_EXT\0" "GL_RED_BIAS\0" "GL_RED_BITS\0" "GL_RED_SCALE\0" "GL_REFLECTION_MAP\0" "GL_REFLECTION_MAP_ARB\0" "GL_REFLECTION_MAP_NV\0" "GL_RENDER\0" "GL_RENDERBUFFER_BINDING_EXT\0" "GL_RENDERBUFFER_EXT\0" "GL_RENDERBUFFER_HEIGHT_EXT\0" "GL_RENDERBUFFER_INTERNAL_FORMAT_EXT\0" "GL_RENDERBUFFER_WIDTH_EXT\0" "GL_RENDERER\0" "GL_RENDER_MODE\0" "GL_REPEAT\0" "GL_REPLACE\0" "GL_REPLACE_EXT\0" "GL_REPLICATE_BORDER_HP\0" "GL_RESCALE_NORMAL\0" "GL_RESCALE_NORMAL_EXT\0" "GL_RETURN\0" "GL_RGB\0" "GL_RGB10\0" "GL_RGB10_A2\0" "GL_RGB10_A2_EXT\0" "GL_RGB10_EXT\0" "GL_RGB12\0" "GL_RGB12_EXT\0" "GL_RGB16\0" "GL_RGB16_EXT\0" "GL_RGB2_EXT\0" "GL_RGB4\0" "GL_RGB4_EXT\0" "GL_RGB4_S3TC\0" "GL_RGB5\0" "GL_RGB5_A1\0" "GL_RGB5_A1_EXT\0" "GL_RGB5_EXT\0" "GL_RGB8\0" "GL_RGB8_EXT\0" "GL_RGBA\0" "GL_RGBA12\0" "GL_RGBA12_EXT\0" "GL_RGBA16\0" "GL_RGBA16_EXT\0" "GL_RGBA2\0" "GL_RGBA2_EXT\0" "GL_RGBA4\0" "GL_RGBA4_DXT5_S3TC\0" "GL_RGBA4_EXT\0" "GL_RGBA4_S3TC\0" "GL_RGBA8\0" "GL_RGBA8_EXT\0" "GL_RGBA_DXT5_S3TC\0" "GL_RGBA_MODE\0" "GL_RGBA_S3TC\0" "GL_RGB_S3TC\0" "GL_RGB_SCALE\0" "GL_RGB_SCALE_ARB\0" "GL_RGB_SCALE_EXT\0" "GL_RIGHT\0" "GL_S\0" "GL_SAMPLES\0" "GL_SAMPLES_3DFX\0" "GL_SAMPLES_ARB\0" "GL_SAMPLES_PASSED\0" "GL_SAMPLES_PASSED_ARB\0" "GL_SAMPLE_ALPHA_TO_COVERAGE\0" "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB\0" "GL_SAMPLE_ALPHA_TO_ONE\0" "GL_SAMPLE_ALPHA_TO_ONE_ARB\0" "GL_SAMPLE_BUFFERS\0" "GL_SAMPLE_BUFFERS_3DFX\0" "GL_SAMPLE_BUFFERS_ARB\0" "GL_SAMPLE_COVERAGE\0" "GL_SAMPLE_COVERAGE_ARB\0" "GL_SAMPLE_COVERAGE_INVERT\0" "GL_SAMPLE_COVERAGE_INVERT_ARB\0" "GL_SAMPLE_COVERAGE_VALUE\0" "GL_SAMPLE_COVERAGE_VALUE_ARB\0" "GL_SCISSOR_BIT\0" "GL_SCISSOR_BOX\0" "GL_SCISSOR_TEST\0" "GL_SECONDARY_COLOR_ARRAY\0" "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING\0" "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB\0" "GL_SECONDARY_COLOR_ARRAY_POINTER\0" "GL_SECONDARY_COLOR_ARRAY_SIZE\0" "GL_SECONDARY_COLOR_ARRAY_STRIDE\0" "GL_SECONDARY_COLOR_ARRAY_TYPE\0" "GL_SELECT\0" "GL_SELECTION_BUFFER_POINTER\0" "GL_SELECTION_BUFFER_SIZE\0" "GL_SEPARABLE_2D\0" "GL_SEPARATE_SPECULAR_COLOR\0" "GL_SEPARATE_SPECULAR_COLOR_EXT\0" "GL_SET\0" "GL_SHADER_OBJECT_ARB\0" "GL_SHADE_MODEL\0" "GL_SHADOW_AMBIENT_SGIX\0" "GL_SHARED_TEXTURE_PALETTE_EXT\0" "GL_SHININESS\0" "GL_SHORT\0" "GL_SINGLE_COLOR\0" "GL_SINGLE_COLOR_EXT\0" "GL_SLICE_ACCUM_SUN\0" "GL_SMOOTH\0" "GL_SMOOTH_LINE_WIDTH_GRANULARITY\0" "GL_SMOOTH_LINE_WIDTH_RANGE\0" "GL_SMOOTH_POINT_SIZE_GRANULARITY\0" "GL_SMOOTH_POINT_SIZE_RANGE\0" "GL_SOURCE0_ALPHA\0" "GL_SOURCE0_ALPHA_ARB\0" "GL_SOURCE0_ALPHA_EXT\0" "GL_SOURCE0_RGB\0" "GL_SOURCE0_RGB_ARB\0" "GL_SOURCE0_RGB_EXT\0" "GL_SOURCE1_ALPHA\0" "GL_SOURCE1_ALPHA_ARB\0" "GL_SOURCE1_ALPHA_EXT\0" "GL_SOURCE1_RGB\0" "GL_SOURCE1_RGB_ARB\0" "GL_SOURCE1_RGB_EXT\0" "GL_SOURCE2_ALPHA\0" "GL_SOURCE2_ALPHA_ARB\0" "GL_SOURCE2_ALPHA_EXT\0" "GL_SOURCE2_RGB\0" "GL_SOURCE2_RGB_ARB\0" "GL_SOURCE2_RGB_EXT\0" "GL_SOURCE3_ALPHA_NV\0" "GL_SOURCE3_RGB_NV\0" "GL_SPECULAR\0" "GL_SPHERE_MAP\0" "GL_SPOT_CUTOFF\0" "GL_SPOT_DIRECTION\0" "GL_SPOT_EXPONENT\0" "GL_SRC0_ALPHA\0" "GL_SRC0_RGB\0" "GL_SRC1_ALPHA\0" "GL_SRC1_RGB\0" "GL_SRC2_ALPHA\0" "GL_SRC2_RGB\0" "GL_SRC_ALPHA\0" "GL_SRC_ALPHA_SATURATE\0" "GL_SRC_COLOR\0" "GL_STACK_OVERFLOW\0" "GL_STACK_UNDERFLOW\0" "GL_STATIC_COPY\0" "GL_STATIC_COPY_ARB\0" "GL_STATIC_DRAW\0" "GL_STATIC_DRAW_ARB\0" "GL_STATIC_READ\0" "GL_STATIC_READ_ARB\0" "GL_STENCIL\0" "GL_STENCIL_ATTACHMENT_EXT\0" "GL_STENCIL_BITS\0" "GL_STENCIL_BUFFER_BIT\0" "GL_STENCIL_CLEAR_VALUE\0" "GL_STENCIL_FAIL\0" "GL_STENCIL_FUNC\0" "GL_STENCIL_INDEX\0" "GL_STENCIL_INDEX16_EXT\0" "GL_STENCIL_INDEX1_EXT\0" "GL_STENCIL_INDEX4_EXT\0" "GL_STENCIL_INDEX8_EXT\0" "GL_STENCIL_INDEX_EXT\0" "GL_STENCIL_PASS_DEPTH_FAIL\0" "GL_STENCIL_PASS_DEPTH_PASS\0" "GL_STENCIL_REF\0" "GL_STENCIL_TEST\0" "GL_STENCIL_TEST_TWO_SIDE_EXT\0" "GL_STENCIL_VALUE_MASK\0" "GL_STENCIL_WRITEMASK\0" "GL_STEREO\0" "GL_STREAM_COPY\0" "GL_STREAM_COPY_ARB\0" "GL_STREAM_DRAW\0" "GL_STREAM_DRAW_ARB\0" "GL_STREAM_READ\0" "GL_STREAM_READ_ARB\0" "GL_SUBPIXEL_BITS\0" "GL_SUBTRACT\0" "GL_SUBTRACT_ARB\0" "GL_T\0" "GL_T2F_C3F_V3F\0" "GL_T2F_C4F_N3F_V3F\0" "GL_T2F_C4UB_V3F\0" "GL_T2F_N3F_V3F\0" "GL_T2F_V3F\0" "GL_T4F_C4F_N3F_V4F\0" "GL_T4F_V4F\0" "GL_TABLE_TOO_LARGE_EXT\0" "GL_TEXTURE\0" "GL_TEXTURE0\0" "GL_TEXTURE0_ARB\0" "GL_TEXTURE1\0" "GL_TEXTURE10\0" "GL_TEXTURE10_ARB\0" "GL_TEXTURE11\0" "GL_TEXTURE11_ARB\0" "GL_TEXTURE12\0" "GL_TEXTURE12_ARB\0" "GL_TEXTURE13\0" "GL_TEXTURE13_ARB\0" "GL_TEXTURE14\0" "GL_TEXTURE14_ARB\0" "GL_TEXTURE15\0" "GL_TEXTURE15_ARB\0" "GL_TEXTURE16\0" "GL_TEXTURE16_ARB\0" "GL_TEXTURE17\0" "GL_TEXTURE17_ARB\0" "GL_TEXTURE18\0" "GL_TEXTURE18_ARB\0" "GL_TEXTURE19\0" "GL_TEXTURE19_ARB\0" "GL_TEXTURE1_ARB\0" "GL_TEXTURE2\0" "GL_TEXTURE20\0" "GL_TEXTURE20_ARB\0" "GL_TEXTURE21\0" "GL_TEXTURE21_ARB\0" "GL_TEXTURE22\0" "GL_TEXTURE22_ARB\0" "GL_TEXTURE23\0" "GL_TEXTURE23_ARB\0" "GL_TEXTURE24\0" "GL_TEXTURE24_ARB\0" "GL_TEXTURE25\0" "GL_TEXTURE25_ARB\0" "GL_TEXTURE26\0" "GL_TEXTURE26_ARB\0" "GL_TEXTURE27\0" "GL_TEXTURE27_ARB\0" "GL_TEXTURE28\0" "GL_TEXTURE28_ARB\0" "GL_TEXTURE29\0" "GL_TEXTURE29_ARB\0" "GL_TEXTURE2_ARB\0" "GL_TEXTURE3\0" "GL_TEXTURE30\0" "GL_TEXTURE30_ARB\0" "GL_TEXTURE31\0" "GL_TEXTURE31_ARB\0" "GL_TEXTURE3_ARB\0" "GL_TEXTURE4\0" "GL_TEXTURE4_ARB\0" "GL_TEXTURE5\0" "GL_TEXTURE5_ARB\0" "GL_TEXTURE6\0" "GL_TEXTURE6_ARB\0" "GL_TEXTURE7\0" "GL_TEXTURE7_ARB\0" "GL_TEXTURE8\0" "GL_TEXTURE8_ARB\0" "GL_TEXTURE9\0" "GL_TEXTURE9_ARB\0" "GL_TEXTURE_1D\0" "GL_TEXTURE_2D\0" "GL_TEXTURE_3D\0" "GL_TEXTURE_ALPHA_SIZE\0" "GL_TEXTURE_ALPHA_SIZE_EXT\0" "GL_TEXTURE_BASE_LEVEL\0" "GL_TEXTURE_BINDING_1D\0" "GL_TEXTURE_BINDING_2D\0" "GL_TEXTURE_BINDING_3D\0" "GL_TEXTURE_BINDING_CUBE_MAP\0" "GL_TEXTURE_BINDING_CUBE_MAP_ARB\0" "GL_TEXTURE_BINDING_RECTANGLE_ARB\0" "GL_TEXTURE_BINDING_RECTANGLE_NV\0" "GL_TEXTURE_BIT\0" "GL_TEXTURE_BLUE_SIZE\0" "GL_TEXTURE_BLUE_SIZE_EXT\0" "GL_TEXTURE_BORDER\0" "GL_TEXTURE_BORDER_COLOR\0" "GL_TEXTURE_CLIPMAP_CENTER_SGIX\0" "GL_TEXTURE_CLIPMAP_DEPTH_SGIX\0" "GL_TEXTURE_CLIPMAP_FRAME_SGIX\0" "GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX\0" "GL_TEXTURE_CLIPMAP_OFFSET_SGIX\0" "GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX\0" "GL_TEXTURE_COLOR_TABLE_SGI\0" "GL_TEXTURE_COLOR_WRITEMASK_SGIS\0" "GL_TEXTURE_COMPARE_FAIL_VALUE_ARB\0" "GL_TEXTURE_COMPARE_FUNC\0" "GL_TEXTURE_COMPARE_FUNC_ARB\0" "GL_TEXTURE_COMPARE_MODE\0" "GL_TEXTURE_COMPARE_MODE_ARB\0" "GL_TEXTURE_COMPARE_OPERATOR_SGIX\0" "GL_TEXTURE_COMPARE_SGIX\0" "GL_TEXTURE_COMPONENTS\0" "GL_TEXTURE_COMPRESSED\0" "GL_TEXTURE_COMPRESSED_ARB\0" "GL_TEXTURE_COMPRESSED_FORMATS_ARB\0" "GL_TEXTURE_COMPRESSED_IMAGE_SIZE\0" "GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB\0" "GL_TEXTURE_COMPRESSION_HINT\0" "GL_TEXTURE_COMPRESSION_HINT_ARB\0" "GL_TEXTURE_COORD_ARRAY\0" "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING\0" "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB\0" "GL_TEXTURE_COORD_ARRAY_POINTER\0" "GL_TEXTURE_COORD_ARRAY_SIZE\0" "GL_TEXTURE_COORD_ARRAY_STRIDE\0" "GL_TEXTURE_COORD_ARRAY_TYPE\0" "GL_TEXTURE_CUBE_MAP\0" "GL_TEXTURE_CUBE_MAP_ARB\0" "GL_TEXTURE_CUBE_MAP_NEGATIVE_X\0" "GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB\0" "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y\0" "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB\0" "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z\0" "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB\0" "GL_TEXTURE_CUBE_MAP_POSITIVE_X\0" "GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB\0" "GL_TEXTURE_CUBE_MAP_POSITIVE_Y\0" "GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB\0" "GL_TEXTURE_CUBE_MAP_POSITIVE_Z\0" "GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB\0" "GL_TEXTURE_DEPTH\0" "GL_TEXTURE_DEPTH_SIZE\0" "GL_TEXTURE_DEPTH_SIZE_ARB\0" "GL_TEXTURE_ENV\0" "GL_TEXTURE_ENV_COLOR\0" "GL_TEXTURE_ENV_MODE\0" "GL_TEXTURE_FILTER_CONTROL\0" "GL_TEXTURE_GEN_MODE\0" "GL_TEXTURE_GEN_Q\0" "GL_TEXTURE_GEN_R\0" "GL_TEXTURE_GEN_S\0" "GL_TEXTURE_GEN_T\0" "GL_TEXTURE_GEQUAL_R_SGIX\0" "GL_TEXTURE_GREEN_SIZE\0" "GL_TEXTURE_GREEN_SIZE_EXT\0" "GL_TEXTURE_HEIGHT\0" "GL_TEXTURE_INDEX_SIZE_EXT\0" "GL_TEXTURE_INTENSITY_SIZE\0" "GL_TEXTURE_INTENSITY_SIZE_EXT\0" "GL_TEXTURE_INTERNAL_FORMAT\0" "GL_TEXTURE_LEQUAL_R_SGIX\0" "GL_TEXTURE_LOD_BIAS\0" "GL_TEXTURE_LOD_BIAS_EXT\0" "GL_TEXTURE_LOD_BIAS_R_SGIX\0" "GL_TEXTURE_LOD_BIAS_S_SGIX\0" "GL_TEXTURE_LOD_BIAS_T_SGIX\0" "GL_TEXTURE_LUMINANCE_SIZE\0" "GL_TEXTURE_LUMINANCE_SIZE_EXT\0" "GL_TEXTURE_MAG_FILTER\0" "GL_TEXTURE_MATRIX\0" "GL_TEXTURE_MAX_ANISOTROPY_EXT\0" "GL_TEXTURE_MAX_CLAMP_R_SGIX\0" "GL_TEXTURE_MAX_CLAMP_S_SGIX\0" "GL_TEXTURE_MAX_CLAMP_T_SGIX\0" "GL_TEXTURE_MAX_LEVEL\0" "GL_TEXTURE_MAX_LOD\0" "GL_TEXTURE_MIN_FILTER\0" "GL_TEXTURE_MIN_LOD\0" "GL_TEXTURE_PRIORITY\0" "GL_TEXTURE_RECTANGLE_ARB\0" "GL_TEXTURE_RECTANGLE_NV\0" "GL_TEXTURE_RED_SIZE\0" "GL_TEXTURE_RED_SIZE_EXT\0" "GL_TEXTURE_RESIDENT\0" "GL_TEXTURE_STACK_DEPTH\0" "GL_TEXTURE_TOO_LARGE_EXT\0" "GL_TEXTURE_UNSIGNED_REMAP_MODE_NV\0" "GL_TEXTURE_WIDTH\0" "GL_TEXTURE_WRAP_R\0" "GL_TEXTURE_WRAP_S\0" "GL_TEXTURE_WRAP_T\0" "GL_TRACK_MATRIX_NV\0" "GL_TRACK_MATRIX_TRANSFORM_NV\0" "GL_TRANSFORM_BIT\0" "GL_TRANSPOSE_COLOR_MATRIX\0" "GL_TRANSPOSE_COLOR_MATRIX_ARB\0" "GL_TRANSPOSE_CURRENT_MATRIX_ARB\0" "GL_TRANSPOSE_MODELVIEW_MATRIX\0" "GL_TRANSPOSE_MODELVIEW_MATRIX_ARB\0" "GL_TRANSPOSE_NV\0" "GL_TRANSPOSE_PROJECTION_MATRIX\0" "GL_TRANSPOSE_PROJECTION_MATRIX_ARB\0" "GL_TRANSPOSE_TEXTURE_MATRIX\0" "GL_TRANSPOSE_TEXTURE_MATRIX_ARB\0" "GL_TRIANGLES\0" "GL_TRIANGLE_FAN\0" "GL_TRIANGLE_MESH_SUN\0" "GL_TRIANGLE_STRIP\0" "GL_TRUE\0" "GL_UNPACK_ALIGNMENT\0" "GL_UNPACK_IMAGE_HEIGHT\0" "GL_UNPACK_LSB_FIRST\0" "GL_UNPACK_ROW_LENGTH\0" "GL_UNPACK_SKIP_IMAGES\0" "GL_UNPACK_SKIP_PIXELS\0" "GL_UNPACK_SKIP_ROWS\0" "GL_UNPACK_SWAP_BYTES\0" "GL_UNSIGNED_BYTE\0" "GL_UNSIGNED_BYTE_2_3_3_REV\0" "GL_UNSIGNED_BYTE_3_3_2\0" "GL_UNSIGNED_INT\0" "GL_UNSIGNED_INT_10_10_10_2\0" "GL_UNSIGNED_INT_24_8_NV\0" "GL_UNSIGNED_INT_2_10_10_10_REV\0" "GL_UNSIGNED_INT_8_8_8_8\0" "GL_UNSIGNED_INT_8_8_8_8_REV\0" "GL_UNSIGNED_SHORT\0" "GL_UNSIGNED_SHORT_1_5_5_5_REV\0" "GL_UNSIGNED_SHORT_4_4_4_4\0" "GL_UNSIGNED_SHORT_4_4_4_4_REV\0" "GL_UNSIGNED_SHORT_5_5_5_1\0" "GL_UNSIGNED_SHORT_5_6_5\0" "GL_UNSIGNED_SHORT_5_6_5_REV\0" "GL_UNSIGNED_SHORT_8_8_APPLE\0" "GL_UNSIGNED_SHORT_8_8_MESA\0" "GL_UNSIGNED_SHORT_8_8_REV_APPLE\0" "GL_UNSIGNED_SHORT_8_8_REV_MESA\0" "GL_V2F\0" "GL_V3F\0" "GL_VENDOR\0" "GL_VERSION\0" "GL_VERTEX_ARRAY\0" "GL_VERTEX_ARRAY_BUFFER_BINDING\0" "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB\0" "GL_VERTEX_ARRAY_POINTER\0" "GL_VERTEX_ARRAY_SIZE\0" "GL_VERTEX_ARRAY_STRIDE\0" "GL_VERTEX_ARRAY_TYPE\0" "GL_VERTEX_ATTRIB_ARRAY0_NV\0" "GL_VERTEX_ATTRIB_ARRAY10_NV\0" "GL_VERTEX_ATTRIB_ARRAY11_NV\0" "GL_VERTEX_ATTRIB_ARRAY12_NV\0" "GL_VERTEX_ATTRIB_ARRAY13_NV\0" "GL_VERTEX_ATTRIB_ARRAY14_NV\0" "GL_VERTEX_ATTRIB_ARRAY15_NV\0" "GL_VERTEX_ATTRIB_ARRAY1_NV\0" "GL_VERTEX_ATTRIB_ARRAY2_NV\0" "GL_VERTEX_ATTRIB_ARRAY3_NV\0" "GL_VERTEX_ATTRIB_ARRAY4_NV\0" "GL_VERTEX_ATTRIB_ARRAY5_NV\0" "GL_VERTEX_ATTRIB_ARRAY6_NV\0" "GL_VERTEX_ATTRIB_ARRAY7_NV\0" "GL_VERTEX_ATTRIB_ARRAY8_NV\0" "GL_VERTEX_ATTRIB_ARRAY9_NV\0" "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING\0" "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB\0" "GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB\0" "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB\0" "GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB\0" "GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB\0" "GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB\0" "GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB\0" "GL_VERTEX_BLEND_ARB\0" "GL_VERTEX_PROGRAM_ARB\0" "GL_VERTEX_PROGRAM_BINDING_NV\0" "GL_VERTEX_PROGRAM_NV\0" "GL_VERTEX_PROGRAM_POINT_SIZE_ARB\0" "GL_VERTEX_PROGRAM_POINT_SIZE_NV\0" "GL_VERTEX_PROGRAM_TWO_SIDE_ARB\0" "GL_VERTEX_PROGRAM_TWO_SIDE_NV\0" "GL_VERTEX_SHADER_ARB\0" "GL_VERTEX_STATE_PROGRAM_NV\0" "GL_VIEWPORT\0" "GL_VIEWPORT_BIT\0" "GL_WEIGHT_ARRAY_ARB\0" "GL_WEIGHT_ARRAY_BUFFER_BINDING\0" "GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB\0" "GL_WEIGHT_ARRAY_POINTER_ARB\0" "GL_WEIGHT_ARRAY_SIZE_ARB\0" "GL_WEIGHT_ARRAY_STRIDE_ARB\0" "GL_WEIGHT_ARRAY_TYPE_ARB\0" "GL_WEIGHT_SUM_UNITY_ARB\0" "GL_WRAP_BORDER_SUN\0" "GL_WRITE_ONLY\0" "GL_WRITE_ONLY_ARB\0" "GL_XOR\0" "GL_YCBCR_422_APPLE\0" "GL_YCBCR_MESA\0" "GL_ZERO\0" "GL_ZOOM_X\0" "GL_ZOOM_Y\0" ; static const enum_elt all_enums[1612] = { { 0, 0x00000600 }, /* GL_2D */ { 6, 0x00001407 }, /* GL_2_BYTES */ { 17, 0x00000601 }, /* GL_3D */ { 23, 0x00000602 }, /* GL_3D_COLOR */ { 35, 0x00000603 }, /* GL_3D_COLOR_TEXTURE */ { 55, 0x00001408 }, /* GL_3_BYTES */ { 66, 0x00000604 }, /* GL_4D_COLOR_TEXTURE */ { 86, 0x00001409 }, /* GL_4_BYTES */ { 97, 0x00000100 }, /* GL_ACCUM */ { 106, 0x00000D5B }, /* GL_ACCUM_ALPHA_BITS */ { 126, 0x00000D5A }, /* GL_ACCUM_BLUE_BITS */ { 145, 0x00000200 }, /* GL_ACCUM_BUFFER_BIT */ { 165, 0x00000B80 }, /* GL_ACCUM_CLEAR_VALUE */ { 186, 0x00000D59 }, /* GL_ACCUM_GREEN_BITS */ { 206, 0x00000D58 }, /* GL_ACCUM_RED_BITS */ { 224, 0x00008911 }, /* GL_ACTIVE_STENCIL_FACE_EXT */ { 251, 0x000084E0 }, /* GL_ACTIVE_TEXTURE */ { 269, 0x000084E0 }, /* GL_ACTIVE_TEXTURE_ARB */ { 291, 0x000086A5 }, /* GL_ACTIVE_VERTEX_UNITS_ARB */ { 318, 0x00000104 }, /* GL_ADD */ { 325, 0x00008574 }, /* GL_ADD_SIGNED */ { 339, 0x00008574 }, /* GL_ADD_SIGNED_ARB */ { 357, 0x00008574 }, /* GL_ADD_SIGNED_EXT */ { 375, 0x0000846E }, /* GL_ALIASED_LINE_WIDTH_RANGE */ { 403, 0x0000846D }, /* GL_ALIASED_POINT_SIZE_RANGE */ { 431, 0x000FFFFF }, /* GL_ALL_ATTRIB_BITS */ { 450, 0xFFFFFFFF }, /* GL_ALL_CLIENT_ATTRIB_BITS */ { 476, 0x00001906 }, /* GL_ALPHA */ { 485, 0x0000803D }, /* GL_ALPHA12 */ { 496, 0x0000803D }, /* GL_ALPHA12_EXT */ { 511, 0x0000803E }, /* GL_ALPHA16 */ { 522, 0x0000803E }, /* GL_ALPHA16_EXT */ { 537, 0x0000803B }, /* GL_ALPHA4 */ { 547, 0x0000803B }, /* GL_ALPHA4_EXT */ { 561, 0x0000803C }, /* GL_ALPHA8 */ { 571, 0x0000803C }, /* GL_ALPHA8_EXT */ { 585, 0x00000D1D }, /* GL_ALPHA_BIAS */ { 599, 0x00000D55 }, /* GL_ALPHA_BITS */ { 613, 0x00000D1C }, /* GL_ALPHA_SCALE */ { 628, 0x00000BC0 }, /* GL_ALPHA_TEST */ { 642, 0x00000BC1 }, /* GL_ALPHA_TEST_FUNC */ { 661, 0x00000BC2 }, /* GL_ALPHA_TEST_REF */ { 679, 0x00000207 }, /* GL_ALWAYS */ { 689, 0x00001200 }, /* GL_AMBIENT */ { 700, 0x00001602 }, /* GL_AMBIENT_AND_DIFFUSE */ { 723, 0x00001501 }, /* GL_AND */ { 730, 0x00001504 }, /* GL_AND_INVERTED */ { 746, 0x00001502 }, /* GL_AND_REVERSE */ { 761, 0x00008892 }, /* GL_ARRAY_BUFFER */ { 777, 0x00008892 }, /* GL_ARRAY_BUFFER_ARB */ { 797, 0x00008894 }, /* GL_ARRAY_BUFFER_BINDING */ { 821, 0x00008894 }, /* GL_ARRAY_BUFFER_BINDING_ARB */ { 849, 0x00008645 }, /* GL_ATTRIB_ARRAY_POINTER_NV */ { 876, 0x00008623 }, /* GL_ATTRIB_ARRAY_SIZE_NV */ { 900, 0x00008624 }, /* GL_ATTRIB_ARRAY_STRIDE_NV */ { 926, 0x00008625 }, /* GL_ATTRIB_ARRAY_TYPE_NV */ { 950, 0x00000BB0 }, /* GL_ATTRIB_STACK_DEPTH */ { 972, 0x00000D80 }, /* GL_AUTO_NORMAL */ { 987, 0x00000409 }, /* GL_AUX0 */ { 995, 0x0000040A }, /* GL_AUX1 */ { 1003, 0x0000040B }, /* GL_AUX2 */ { 1011, 0x0000040C }, /* GL_AUX3 */ { 1019, 0x00000C00 }, /* GL_AUX_BUFFERS */ { 1034, 0x00000405 }, /* GL_BACK */ { 1042, 0x00000402 }, /* GL_BACK_LEFT */ { 1055, 0x00000403 }, /* GL_BACK_RIGHT */ { 1069, 0x000080E0 }, /* GL_BGR */ { 1076, 0x000080E1 }, /* GL_BGRA */ { 1084, 0x00001A00 }, /* GL_BITMAP */ { 1094, 0x00000704 }, /* GL_BITMAP_TOKEN */ { 1110, 0x00000BE2 }, /* GL_BLEND */ { 1119, 0x00008005 }, /* GL_BLEND_COLOR */ { 1134, 0x00008005 }, /* GL_BLEND_COLOR_EXT */ { 1153, 0x00000BE0 }, /* GL_BLEND_DST */ { 1166, 0x000080CA }, /* GL_BLEND_DST_ALPHA */ { 1185, 0x000080C8 }, /* GL_BLEND_DST_RGB */ { 1202, 0x00008009 }, /* GL_BLEND_EQUATION */ { 1220, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA_EXT */ { 1248, 0x00008009 }, /* GL_BLEND_EQUATION_EXT */ { 1270, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_EXT */ { 1296, 0x00000BE1 }, /* GL_BLEND_SRC */ { 1309, 0x000080CB }, /* GL_BLEND_SRC_ALPHA */ { 1328, 0x000080C9 }, /* GL_BLEND_SRC_RGB */ { 1345, 0x00001905 }, /* GL_BLUE */ { 1353, 0x00000D1B }, /* GL_BLUE_BIAS */ { 1366, 0x00000D54 }, /* GL_BLUE_BITS */ { 1379, 0x00000D1A }, /* GL_BLUE_SCALE */ { 1393, 0x00008B56 }, /* GL_BOOL_ARB */ { 1405, 0x00008B57 }, /* GL_BOOL_VEC2_ARB */ { 1422, 0x00008B58 }, /* GL_BOOL_VEC3_ARB */ { 1439, 0x00008B59 }, /* GL_BOOL_VEC4_ARB */ { 1456, 0x000088BB }, /* GL_BUFFER_ACCESS */ { 1473, 0x000088BB }, /* GL_BUFFER_ACCESS_ARB */ { 1494, 0x000088BC }, /* GL_BUFFER_MAPPED */ { 1511, 0x000088BC }, /* GL_BUFFER_MAPPED_ARB */ { 1532, 0x000088BD }, /* GL_BUFFER_MAP_POINTER */ { 1554, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_ARB */ { 1580, 0x00008764 }, /* GL_BUFFER_SIZE */ { 1595, 0x00008764 }, /* GL_BUFFER_SIZE_ARB */ { 1614, 0x00008765 }, /* GL_BUFFER_USAGE */ { 1630, 0x00008765 }, /* GL_BUFFER_USAGE_ARB */ { 1650, 0x00001400 }, /* GL_BYTE */ { 1658, 0x00002A24 }, /* GL_C3F_V3F */ { 1669, 0x00002A26 }, /* GL_C4F_N3F_V3F */ { 1684, 0x00002A22 }, /* GL_C4UB_V2F */ { 1696, 0x00002A23 }, /* GL_C4UB_V3F */ { 1708, 0x00000901 }, /* GL_CCW */ { 1715, 0x00002900 }, /* GL_CLAMP */ { 1724, 0x0000812D }, /* GL_CLAMP_TO_BORDER */ { 1743, 0x0000812D }, /* GL_CLAMP_TO_BORDER_ARB */ { 1766, 0x0000812D }, /* GL_CLAMP_TO_BORDER_SGIS */ { 1790, 0x0000812F }, /* GL_CLAMP_TO_EDGE */ { 1807, 0x0000812F }, /* GL_CLAMP_TO_EDGE_SGIS */ { 1829, 0x00001500 }, /* GL_CLEAR */ { 1838, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE */ { 1863, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE_ARB */ { 1892, 0xFFFFFFFF }, /* GL_CLIENT_ALL_ATTRIB_BITS */ { 1918, 0x00000BB1 }, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ { 1947, 0x00000001 }, /* GL_CLIENT_PIXEL_STORE_BIT */ { 1973, 0x00000002 }, /* GL_CLIENT_VERTEX_ARRAY_BIT */ { 2000, 0x00003000 }, /* GL_CLIP_PLANE0 */ { 2015, 0x00003001 }, /* GL_CLIP_PLANE1 */ { 2030, 0x00003002 }, /* GL_CLIP_PLANE2 */ { 2045, 0x00003003 }, /* GL_CLIP_PLANE3 */ { 2060, 0x00003004 }, /* GL_CLIP_PLANE4 */ { 2075, 0x00003005 }, /* GL_CLIP_PLANE5 */ { 2090, 0x000080F0 }, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ { 2123, 0x00000A00 }, /* GL_COEFF */ { 2132, 0x00001800 }, /* GL_COLOR */ { 2141, 0x00008076 }, /* GL_COLOR_ARRAY */ { 2156, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING */ { 2186, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING_ARB */ { 2220, 0x00008090 }, /* GL_COLOR_ARRAY_POINTER */ { 2243, 0x00008081 }, /* GL_COLOR_ARRAY_SIZE */ { 2263, 0x00008083 }, /* GL_COLOR_ARRAY_STRIDE */ { 2285, 0x00008082 }, /* GL_COLOR_ARRAY_TYPE */ { 2305, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_EXT */ { 2330, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10_EXT */ { 2356, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11_EXT */ { 2382, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12_EXT */ { 2408, 0x00008CED }, /* GL_COLOR_ATTACHMENT13_EXT */ { 2434, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14_EXT */ { 2460, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15_EXT */ { 2486, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1_EXT */ { 2511, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2_EXT */ { 2536, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3_EXT */ { 2561, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4_EXT */ { 2586, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5_EXT */ { 2611, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6_EXT */ { 2636, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7_EXT */ { 2661, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8_EXT */ { 2686, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9_EXT */ { 2711, 0x00004000 }, /* GL_COLOR_BUFFER_BIT */ { 2731, 0x00000C22 }, /* GL_COLOR_CLEAR_VALUE */ { 2752, 0x00001900 }, /* GL_COLOR_INDEX */ { 2767, 0x00001603 }, /* GL_COLOR_INDEXES */ { 2784, 0x00000BF2 }, /* GL_COLOR_LOGIC_OP */ { 2802, 0x00000B57 }, /* GL_COLOR_MATERIAL */ { 2820, 0x00000B55 }, /* GL_COLOR_MATERIAL_FACE */ { 2843, 0x00000B56 }, /* GL_COLOR_MATERIAL_PARAMETER */ { 2871, 0x000080B1 }, /* GL_COLOR_MATRIX */ { 2887, 0x000080B1 }, /* GL_COLOR_MATRIX_SGI */ { 2907, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH */ { 2935, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH_SGI */ { 2967, 0x00008458 }, /* GL_COLOR_SUM */ { 2980, 0x00008458 }, /* GL_COLOR_SUM_ARB */ { 2997, 0x000080D0 }, /* GL_COLOR_TABLE */ { 3012, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE */ { 3038, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_EXT */ { 3068, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS */ { 3088, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE */ { 3113, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_EXT */ { 3142, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT */ { 3164, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_EXT */ { 3190, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE */ { 3216, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_EXT */ { 3246, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE */ { 3276, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_EXT */ { 3310, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ { 3340, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_EXT */ { 3374, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE */ { 3398, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_EXT */ { 3426, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE */ { 3447, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH */ { 3468, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_EXT */ { 3493, 0x00000C23 }, /* GL_COLOR_WRITEMASK */ { 3512, 0x00008570 }, /* GL_COMBINE */ { 3523, 0x00008503 }, /* GL_COMBINE4 */ { 3535, 0x00008572 }, /* GL_COMBINE_ALPHA */ { 3552, 0x00008572 }, /* GL_COMBINE_ALPHA_ARB */ { 3573, 0x00008572 }, /* GL_COMBINE_ALPHA_EXT */ { 3594, 0x00008570 }, /* GL_COMBINE_ARB */ { 3609, 0x00008570 }, /* GL_COMBINE_EXT */ { 3624, 0x00008571 }, /* GL_COMBINE_RGB */ { 3639, 0x00008571 }, /* GL_COMBINE_RGB_ARB */ { 3658, 0x00008571 }, /* GL_COMBINE_RGB_EXT */ { 3677, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE */ { 3701, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE_ARB */ { 3729, 0x00001300 }, /* GL_COMPILE */ { 3740, 0x00001301 }, /* GL_COMPILE_AND_EXECUTE */ { 3763, 0x000084E9 }, /* GL_COMPRESSED_ALPHA */ { 3783, 0x000084E9 }, /* GL_COMPRESSED_ALPHA_ARB */ { 3807, 0x000084EC }, /* GL_COMPRESSED_INTENSITY */ { 3831, 0x000084EC }, /* GL_COMPRESSED_INTENSITY_ARB */ { 3859, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE */ { 3883, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA */ { 3913, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA_ARB */ { 3947, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE_ARB */ { 3975, 0x000084ED }, /* GL_COMPRESSED_RGB */ { 3993, 0x000084EE }, /* GL_COMPRESSED_RGBA */ { 4012, 0x000084EE }, /* GL_COMPRESSED_RGBA_ARB */ { 4035, 0x000086B1 }, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ { 4064, 0x000083F1 }, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ { 4097, 0x000083F2 }, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ { 4130, 0x000083F3 }, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ { 4163, 0x000084ED }, /* GL_COMPRESSED_RGB_ARB */ { 4185, 0x000086B0 }, /* GL_COMPRESSED_RGB_FXT1_3DFX */ { 4213, 0x000083F0 }, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ { 4245, 0x000086A3 }, /* GL_COMPRESSED_TEXTURE_FORMATS */ { 4275, 0x00008576 }, /* GL_CONSTANT */ { 4287, 0x00008003 }, /* GL_CONSTANT_ALPHA */ { 4305, 0x00008003 }, /* GL_CONSTANT_ALPHA_EXT */ { 4327, 0x00008576 }, /* GL_CONSTANT_ARB */ { 4343, 0x00001207 }, /* GL_CONSTANT_ATTENUATION */ { 4367, 0x00008151 }, /* GL_CONSTANT_BORDER_HP */ { 4389, 0x00008001 }, /* GL_CONSTANT_COLOR */ { 4407, 0x00008001 }, /* GL_CONSTANT_COLOR_EXT */ { 4429, 0x00008576 }, /* GL_CONSTANT_EXT */ { 4445, 0x00008010 }, /* GL_CONVOLUTION_1D */ { 4463, 0x00008011 }, /* GL_CONVOLUTION_2D */ { 4481, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */ { 4509, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */ { 4540, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */ { 4567, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */ { 4598, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */ { 4625, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */ { 4656, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */ { 4684, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */ { 4716, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */ { 4738, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */ { 4764, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */ { 4786, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */ { 4812, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */ { 4833, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */ { 4858, 0x00008862 }, /* GL_COORD_REPLACE_ARB */ { 4879, 0x00008862 }, /* GL_COORD_REPLACE_NV */ { 4899, 0x00001503 }, /* GL_COPY */ { 4907, 0x0000150C }, /* GL_COPY_INVERTED */ { 4924, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */ { 4944, 0x00000B44 }, /* GL_CULL_FACE */ { 4957, 0x00000B45 }, /* GL_CULL_FACE_MODE */ { 4975, 0x000081AA }, /* GL_CULL_VERTEX_EXT */ { 4994, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ { 5026, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ { 5061, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */ { 5082, 0x00000001 }, /* GL_CURRENT_BIT */ { 5097, 0x00000B00 }, /* GL_CURRENT_COLOR */ { 5114, 0x00008453 }, /* GL_CURRENT_FOG_COORD */ { 5135, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */ { 5161, 0x00000B01 }, /* GL_CURRENT_INDEX */ { 5178, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */ { 5200, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */ { 5228, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */ { 5249, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ { 5283, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */ { 5316, 0x00000B02 }, /* GL_CURRENT_NORMAL */ { 5334, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */ { 5364, 0x00008865 }, /* GL_CURRENT_QUERY */ { 5381, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */ { 5402, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */ { 5426, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */ { 5453, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */ { 5477, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */ { 5504, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */ { 5537, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ { 5570, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */ { 5597, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */ { 5623, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */ { 5652, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */ { 5674, 0x00000900 }, /* GL_CW */ { 5680, 0x00002101 }, /* GL_DECAL */ { 5689, 0x00001E03 }, /* GL_DECR */ { 5697, 0x00008508 }, /* GL_DECR_WRAP */ { 5710, 0x00008508 }, /* GL_DECR_WRAP_EXT */ { 5727, 0x00001801 }, /* GL_DEPTH */ { 5736, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */ { 5760, 0x00000D1F }, /* GL_DEPTH_BIAS */ { 5774, 0x00000D56 }, /* GL_DEPTH_BITS */ { 5788, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */ { 5808, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */ { 5833, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */ { 5853, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */ { 5871, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */ { 5892, 0x00001902 }, /* GL_DEPTH_COMPONENT */ { 5911, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */ { 5932, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */ { 5957, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */ { 5983, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */ { 6004, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */ { 6029, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */ { 6055, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */ { 6076, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */ { 6101, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */ { 6127, 0x00000B74 }, /* GL_DEPTH_FUNC */ { 6141, 0x00000B70 }, /* GL_DEPTH_RANGE */ { 6156, 0x00000D1E }, /* GL_DEPTH_SCALE */ { 6171, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */ { 6191, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ { 6219, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ { 6247, 0x00000B71 }, /* GL_DEPTH_TEST */ { 6261, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */ { 6283, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */ { 6309, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */ { 6328, 0x00001201 }, /* GL_DIFFUSE */ { 6339, 0x00000BD0 }, /* GL_DITHER */ { 6349, 0x00000A02 }, /* GL_DOMAIN */ { 6359, 0x00001100 }, /* GL_DONT_CARE */ { 6372, 0x000086AE }, /* GL_DOT3_RGB */ { 6384, 0x000086AF }, /* GL_DOT3_RGBA */ { 6397, 0x000086AF }, /* GL_DOT3_RGBA_ARB */ { 6414, 0x00008741 }, /* GL_DOT3_RGBA_EXT */ { 6431, 0x000086AE }, /* GL_DOT3_RGB_ARB */ { 6447, 0x00008740 }, /* GL_DOT3_RGB_EXT */ { 6463, 0x0000140A }, /* GL_DOUBLE */ { 6473, 0x00000C32 }, /* GL_DOUBLEBUFFER */ { 6489, 0x00000C01 }, /* GL_DRAW_BUFFER */ { 6504, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */ { 6524, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */ { 6544, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */ { 6565, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */ { 6586, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */ { 6607, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */ { 6628, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */ { 6649, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */ { 6670, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */ { 6691, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */ { 6712, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */ { 6733, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */ { 6754, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */ { 6775, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */ { 6796, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */ { 6816, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */ { 6836, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */ { 6856, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */ { 6876, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */ { 6896, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */ { 6916, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */ { 6936, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */ { 6956, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */ { 6976, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */ { 6996, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */ { 7016, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */ { 7036, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */ { 7056, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */ { 7076, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */ { 7096, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */ { 7116, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */ { 7136, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */ { 7156, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */ { 7176, 0x00000304 }, /* GL_DST_ALPHA */ { 7189, 0x00000306 }, /* GL_DST_COLOR */ { 7202, 0x000088EA }, /* GL_DYNAMIC_COPY */ { 7218, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */ { 7238, 0x000088E8 }, /* GL_DYNAMIC_DRAW */ { 7254, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */ { 7274, 0x000088E9 }, /* GL_DYNAMIC_READ */ { 7290, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */ { 7310, 0x00000B43 }, /* GL_EDGE_FLAG */ { 7323, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */ { 7342, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ { 7376, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */ { 7414, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */ { 7441, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */ { 7467, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */ { 7491, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER_ARB */ { 7519, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ { 7551, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */ { 7587, 0x00001600 }, /* GL_EMISSION */ { 7599, 0x00002000 }, /* GL_ENABLE_BIT */ { 7613, 0x00000202 }, /* GL_EQUAL */ { 7622, 0x00001509 }, /* GL_EQUIV */ { 7631, 0x00010000 }, /* GL_EVAL_BIT */ { 7643, 0x00000800 }, /* GL_EXP */ { 7650, 0x00000801 }, /* GL_EXP2 */ { 7658, 0x00001F03 }, /* GL_EXTENSIONS */ { 7672, 0x00002400 }, /* GL_EYE_LINEAR */ { 7686, 0x00002502 }, /* GL_EYE_PLANE */ { 7699, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */ { 7724, 0x0000855B }, /* GL_EYE_RADIAL_NV */ { 7741, 0x00000000 }, /* GL_FALSE */ { 7750, 0x00001101 }, /* GL_FASTEST */ { 7761, 0x00001C01 }, /* GL_FEEDBACK */ { 7773, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */ { 7800, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */ { 7824, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */ { 7848, 0x00001B02 }, /* GL_FILL */ { 7856, 0x00001D00 }, /* GL_FLAT */ { 7864, 0x00001406 }, /* GL_FLOAT */ { 7873, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ { 7891, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ { 7909, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ { 7927, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ { 7945, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ { 7963, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ { 7981, 0x00000B60 }, /* GL_FOG */ { 7988, 0x00000080 }, /* GL_FOG_BIT */ { 7999, 0x00000B66 }, /* GL_FOG_COLOR */ { 8012, 0x00008451 }, /* GL_FOG_COORD */ { 8025, 0x00008451 }, /* GL_FOG_COORDINATE */ { 8043, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ { 8067, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ { 8106, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ { 8149, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ { 8181, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ { 8212, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ { 8241, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ { 8266, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ { 8285, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ { 8319, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ { 8346, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ { 8372, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ { 8396, 0x00008450 }, /* GL_FOG_COORD_SOURCE */ { 8416, 0x00000B62 }, /* GL_FOG_DENSITY */ { 8431, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ { 8455, 0x00000B64 }, /* GL_FOG_END */ { 8466, 0x00000C54 }, /* GL_FOG_HINT */ { 8478, 0x00000B61 }, /* GL_FOG_INDEX */ { 8491, 0x00000B65 }, /* GL_FOG_MODE */ { 8503, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ { 8522, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ { 8547, 0x00000B63 }, /* GL_FOG_START */ { 8560, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ { 8578, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ { 8602, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ { 8625, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ { 8667, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ { 8709, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ { 8758, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ { 8810, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ { 8854, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ { 8881, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ { 8909, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ { 8928, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ { 8969, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ { 9010, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ { 9052, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ { 9103, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ { 9141, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ { 9190, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ { 9232, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ { 9264, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ { 9295, 0x00000404 }, /* GL_FRONT */ { 9304, 0x00000408 }, /* GL_FRONT_AND_BACK */ { 9322, 0x00000B46 }, /* GL_FRONT_FACE */ { 9336, 0x00000400 }, /* GL_FRONT_LEFT */ { 9350, 0x00000401 }, /* GL_FRONT_RIGHT */ { 9365, 0x00008006 }, /* GL_FUNC_ADD */ { 9377, 0x00008006 }, /* GL_FUNC_ADD_EXT */ { 9393, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ { 9418, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ { 9447, 0x0000800A }, /* GL_FUNC_SUBTRACT */ { 9464, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ { 9485, 0x00008191 }, /* GL_GENERATE_MIPMAP */ { 9504, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ { 9528, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ { 9557, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ { 9581, 0x00000206 }, /* GL_GEQUAL */ { 9591, 0x00000204 }, /* GL_GREATER */ { 9602, 0x00001904 }, /* GL_GREEN */ { 9611, 0x00000D19 }, /* GL_GREEN_BIAS */ { 9625, 0x00000D53 }, /* GL_GREEN_BITS */ { 9639, 0x00000D18 }, /* GL_GREEN_SCALE */ { 9654, 0x00008000 }, /* GL_HINT_BIT */ { 9666, 0x00008024 }, /* GL_HISTOGRAM */ { 9679, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ { 9703, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ { 9731, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ { 9754, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ { 9781, 0x00008024 }, /* GL_HISTOGRAM_EXT */ { 9798, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ { 9818, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ { 9842, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ { 9866, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ { 9894, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ { 9922, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ { 9954, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ { 9976, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ { 10002, 0x0000802D }, /* GL_HISTOGRAM_SINK */ { 10020, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ { 10042, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ { 10061, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ { 10084, 0x0000862A }, /* GL_IDENTITY_NV */ { 10099, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ { 10119, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ { 10159, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ { 10197, 0x00001E02 }, /* GL_INCR */ { 10205, 0x00008507 }, /* GL_INCR_WRAP */ { 10218, 0x00008507 }, /* GL_INCR_WRAP_EXT */ { 10235, 0x00008077 }, /* GL_INDEX_ARRAY */ { 10250, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ { 10280, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ { 10314, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ { 10337, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ { 10359, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ { 10379, 0x00000D51 }, /* GL_INDEX_BITS */ { 10393, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ { 10414, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ { 10432, 0x00000C30 }, /* GL_INDEX_MODE */ { 10446, 0x00000D13 }, /* GL_INDEX_OFFSET */ { 10462, 0x00000D12 }, /* GL_INDEX_SHIFT */ { 10477, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ { 10496, 0x00001404 }, /* GL_INT */ { 10503, 0x00008049 }, /* GL_INTENSITY */ { 10516, 0x0000804C }, /* GL_INTENSITY12 */ { 10531, 0x0000804C }, /* GL_INTENSITY12_EXT */ { 10550, 0x0000804D }, /* GL_INTENSITY16 */ { 10565, 0x0000804D }, /* GL_INTENSITY16_EXT */ { 10584, 0x0000804A }, /* GL_INTENSITY4 */ { 10598, 0x0000804A }, /* GL_INTENSITY4_EXT */ { 10616, 0x0000804B }, /* GL_INTENSITY8 */ { 10630, 0x0000804B }, /* GL_INTENSITY8_EXT */ { 10648, 0x00008049 }, /* GL_INTENSITY_EXT */ { 10665, 0x00008575 }, /* GL_INTERPOLATE */ { 10680, 0x00008575 }, /* GL_INTERPOLATE_ARB */ { 10699, 0x00008575 }, /* GL_INTERPOLATE_EXT */ { 10718, 0x00008B53 }, /* GL_INT_VEC2_ARB */ { 10734, 0x00008B54 }, /* GL_INT_VEC3_ARB */ { 10750, 0x00008B55 }, /* GL_INT_VEC4_ARB */ { 10766, 0x00000500 }, /* GL_INVALID_ENUM */ { 10782, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ { 10819, 0x00000502 }, /* GL_INVALID_OPERATION */ { 10840, 0x00000501 }, /* GL_INVALID_VALUE */ { 10857, 0x0000862B }, /* GL_INVERSE_NV */ { 10871, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ { 10895, 0x0000150A }, /* GL_INVERT */ { 10905, 0x00001E00 }, /* GL_KEEP */ { 10913, 0x00000406 }, /* GL_LEFT */ { 10921, 0x00000203 }, /* GL_LEQUAL */ { 10931, 0x00000201 }, /* GL_LESS */ { 10939, 0x00004000 }, /* GL_LIGHT0 */ { 10949, 0x00004001 }, /* GL_LIGHT1 */ { 10959, 0x00004002 }, /* GL_LIGHT2 */ { 10969, 0x00004003 }, /* GL_LIGHT3 */ { 10979, 0x00004004 }, /* GL_LIGHT4 */ { 10989, 0x00004005 }, /* GL_LIGHT5 */ { 10999, 0x00004006 }, /* GL_LIGHT6 */ { 11009, 0x00004007 }, /* GL_LIGHT7 */ { 11019, 0x00000B50 }, /* GL_LIGHTING */ { 11031, 0x00000040 }, /* GL_LIGHTING_BIT */ { 11047, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ { 11070, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ { 11099, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ { 11132, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ { 11160, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ { 11184, 0x00001B01 }, /* GL_LINE */ { 11192, 0x00002601 }, /* GL_LINEAR */ { 11202, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ { 11224, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ { 11254, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ { 11285, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ { 11309, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ { 11334, 0x00000001 }, /* GL_LINES */ { 11343, 0x00000004 }, /* GL_LINE_BIT */ { 11355, 0x00000002 }, /* GL_LINE_LOOP */ { 11368, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ { 11388, 0x00000B20 }, /* GL_LINE_SMOOTH */ { 11403, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ { 11423, 0x00000B24 }, /* GL_LINE_STIPPLE */ { 11439, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ { 11463, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ { 11486, 0x00000003 }, /* GL_LINE_STRIP */ { 11500, 0x00000702 }, /* GL_LINE_TOKEN */ { 11514, 0x00000B21 }, /* GL_LINE_WIDTH */ { 11528, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ { 11554, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ { 11574, 0x00000B32 }, /* GL_LIST_BASE */ { 11587, 0x00020000 }, /* GL_LIST_BIT */ { 11599, 0x00000B33 }, /* GL_LIST_INDEX */ { 11613, 0x00000B30 }, /* GL_LIST_MODE */ { 11626, 0x00000101 }, /* GL_LOAD */ { 11634, 0x00000BF1 }, /* GL_LOGIC_OP */ { 11646, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ { 11663, 0x00001909 }, /* GL_LUMINANCE */ { 11676, 0x00008041 }, /* GL_LUMINANCE12 */ { 11691, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ { 11714, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ { 11741, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ { 11763, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ { 11789, 0x00008041 }, /* GL_LUMINANCE12_EXT */ { 11808, 0x00008042 }, /* GL_LUMINANCE16 */ { 11823, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ { 11846, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ { 11873, 0x00008042 }, /* GL_LUMINANCE16_EXT */ { 11892, 0x0000803F }, /* GL_LUMINANCE4 */ { 11906, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ { 11927, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ { 11952, 0x0000803F }, /* GL_LUMINANCE4_EXT */ { 11970, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ { 11991, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ { 12016, 0x00008040 }, /* GL_LUMINANCE8 */ { 12030, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ { 12051, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ { 12076, 0x00008040 }, /* GL_LUMINANCE8_EXT */ { 12094, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ { 12113, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ { 12129, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ { 12149, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ { 12171, 0x00000D91 }, /* GL_MAP1_INDEX */ { 12185, 0x00000D92 }, /* GL_MAP1_NORMAL */ { 12200, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ { 12224, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ { 12248, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ { 12272, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ { 12296, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ { 12313, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ { 12330, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ { 12358, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ { 12387, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ { 12416, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ { 12445, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ { 12474, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ { 12503, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ { 12532, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ { 12560, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ { 12588, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ { 12616, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ { 12644, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ { 12672, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ { 12700, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ { 12728, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ { 12756, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ { 12784, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ { 12800, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ { 12820, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ { 12842, 0x00000DB1 }, /* GL_MAP2_INDEX */ { 12856, 0x00000DB2 }, /* GL_MAP2_NORMAL */ { 12871, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ { 12895, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ { 12919, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ { 12943, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ { 12967, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ { 12984, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ { 13001, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ { 13029, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ { 13058, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ { 13087, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ { 13116, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ { 13145, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ { 13174, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ { 13203, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ { 13231, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ { 13259, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ { 13287, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ { 13315, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ { 13343, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ { 13371, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ { 13399, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ { 13427, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ { 13455, 0x00000D10 }, /* GL_MAP_COLOR */ { 13468, 0x00000D11 }, /* GL_MAP_STENCIL */ { 13483, 0x000088C0 }, /* GL_MATRIX0_ARB */ { 13498, 0x00008630 }, /* GL_MATRIX0_NV */ { 13512, 0x000088CA }, /* GL_MATRIX10_ARB */ { 13528, 0x000088CB }, /* GL_MATRIX11_ARB */ { 13544, 0x000088CC }, /* GL_MATRIX12_ARB */ { 13560, 0x000088CD }, /* GL_MATRIX13_ARB */ { 13576, 0x000088CE }, /* GL_MATRIX14_ARB */ { 13592, 0x000088CF }, /* GL_MATRIX15_ARB */ { 13608, 0x000088D0 }, /* GL_MATRIX16_ARB */ { 13624, 0x000088D1 }, /* GL_MATRIX17_ARB */ { 13640, 0x000088D2 }, /* GL_MATRIX18_ARB */ { 13656, 0x000088D3 }, /* GL_MATRIX19_ARB */ { 13672, 0x000088C1 }, /* GL_MATRIX1_ARB */ { 13687, 0x00008631 }, /* GL_MATRIX1_NV */ { 13701, 0x000088D4 }, /* GL_MATRIX20_ARB */ { 13717, 0x000088D5 }, /* GL_MATRIX21_ARB */ { 13733, 0x000088D6 }, /* GL_MATRIX22_ARB */ { 13749, 0x000088D7 }, /* GL_MATRIX23_ARB */ { 13765, 0x000088D8 }, /* GL_MATRIX24_ARB */ { 13781, 0x000088D9 }, /* GL_MATRIX25_ARB */ { 13797, 0x000088DA }, /* GL_MATRIX26_ARB */ { 13813, 0x000088DB }, /* GL_MATRIX27_ARB */ { 13829, 0x000088DC }, /* GL_MATRIX28_ARB */ { 13845, 0x000088DD }, /* GL_MATRIX29_ARB */ { 13861, 0x000088C2 }, /* GL_MATRIX2_ARB */ { 13876, 0x00008632 }, /* GL_MATRIX2_NV */ { 13890, 0x000088DE }, /* GL_MATRIX30_ARB */ { 13906, 0x000088DF }, /* GL_MATRIX31_ARB */ { 13922, 0x000088C3 }, /* GL_MATRIX3_ARB */ { 13937, 0x00008633 }, /* GL_MATRIX3_NV */ { 13951, 0x000088C4 }, /* GL_MATRIX4_ARB */ { 13966, 0x00008634 }, /* GL_MATRIX4_NV */ { 13980, 0x000088C5 }, /* GL_MATRIX5_ARB */ { 13995, 0x00008635 }, /* GL_MATRIX5_NV */ { 14009, 0x000088C6 }, /* GL_MATRIX6_ARB */ { 14024, 0x00008636 }, /* GL_MATRIX6_NV */ { 14038, 0x000088C7 }, /* GL_MATRIX7_ARB */ { 14053, 0x00008637 }, /* GL_MATRIX7_NV */ { 14067, 0x000088C8 }, /* GL_MATRIX8_ARB */ { 14082, 0x000088C9 }, /* GL_MATRIX9_ARB */ { 14097, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ { 14123, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ { 14157, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ { 14188, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ { 14221, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ { 14252, 0x00000BA0 }, /* GL_MATRIX_MODE */ { 14267, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ { 14289, 0x00008008 }, /* GL_MAX */ { 14296, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ { 14319, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ { 14345, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ { 14378, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ { 14404, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ { 14438, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ { 14457, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ { 14486, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ { 14518, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ { 14554, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ { 14594, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ { 14620, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ { 14650, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ { 14675, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ { 14704, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ { 14733, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ { 14766, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ { 14790, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ { 14814, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ { 14838, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ { 14863, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ { 14881, 0x00008008 }, /* GL_MAX_EXT */ { 14892, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ { 14931, 0x00000D31 }, /* GL_MAX_LIGHTS */ { 14945, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ { 14965, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ { 15003, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ { 15032, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ { 15056, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ { 15084, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ { 15107, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ { 15144, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ { 15180, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ { 15207, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ { 15236, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ { 15270, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ { 15306, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ { 15333, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ { 15365, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ { 15401, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ { 15430, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ { 15459, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ { 15487, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ { 15525, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ { 15569, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ { 15612, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ { 15646, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ { 15685, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ { 15722, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ { 15760, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ { 15803, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ { 15846, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ { 15876, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ { 15907, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ { 15943, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ { 15979, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ { 16009, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ { 16043, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ { 16076, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ { 16105, 0x00008504 }, /* GL_MAX_SHININESS_NV */ { 16125, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ { 16149, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ { 16175, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ { 16206, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ { 16230, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ { 16264, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ { 16284, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ { 16311, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ { 16332, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ { 16357, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ { 16382, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ { 16417, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ { 16443, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ { 16469, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ { 16507, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ { 16544, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ { 16568, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ { 16589, 0x00008007 }, /* GL_MIN */ { 16596, 0x0000802E }, /* GL_MINMAX */ { 16606, 0x0000802E }, /* GL_MINMAX_EXT */ { 16620, 0x0000802F }, /* GL_MINMAX_FORMAT */ { 16637, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ { 16658, 0x00008030 }, /* GL_MINMAX_SINK */ { 16673, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ { 16692, 0x00008007 }, /* GL_MIN_EXT */ { 16703, 0x00008370 }, /* GL_MIRRORED_REPEAT */ { 16722, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ { 16745, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ { 16768, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ { 16788, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ { 16808, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ { 16838, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ { 16866, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ { 16894, 0x00001700 }, /* GL_MODELVIEW */ { 16907, 0x00001700 }, /* GL_MODELVIEW0_ARB */ { 16925, 0x0000872A }, /* GL_MODELVIEW10_ARB */ { 16944, 0x0000872B }, /* GL_MODELVIEW11_ARB */ { 16963, 0x0000872C }, /* GL_MODELVIEW12_ARB */ { 16982, 0x0000872D }, /* GL_MODELVIEW13_ARB */ { 17001, 0x0000872E }, /* GL_MODELVIEW14_ARB */ { 17020, 0x0000872F }, /* GL_MODELVIEW15_ARB */ { 17039, 0x00008730 }, /* GL_MODELVIEW16_ARB */ { 17058, 0x00008731 }, /* GL_MODELVIEW17_ARB */ { 17077, 0x00008732 }, /* GL_MODELVIEW18_ARB */ { 17096, 0x00008733 }, /* GL_MODELVIEW19_ARB */ { 17115, 0x0000850A }, /* GL_MODELVIEW1_ARB */ { 17133, 0x00008734 }, /* GL_MODELVIEW20_ARB */ { 17152, 0x00008735 }, /* GL_MODELVIEW21_ARB */ { 17171, 0x00008736 }, /* GL_MODELVIEW22_ARB */ { 17190, 0x00008737 }, /* GL_MODELVIEW23_ARB */ { 17209, 0x00008738 }, /* GL_MODELVIEW24_ARB */ { 17228, 0x00008739 }, /* GL_MODELVIEW25_ARB */ { 17247, 0x0000873A }, /* GL_MODELVIEW26_ARB */ { 17266, 0x0000873B }, /* GL_MODELVIEW27_ARB */ { 17285, 0x0000873C }, /* GL_MODELVIEW28_ARB */ { 17304, 0x0000873D }, /* GL_MODELVIEW29_ARB */ { 17323, 0x00008722 }, /* GL_MODELVIEW2_ARB */ { 17341, 0x0000873E }, /* GL_MODELVIEW30_ARB */ { 17360, 0x0000873F }, /* GL_MODELVIEW31_ARB */ { 17379, 0x00008723 }, /* GL_MODELVIEW3_ARB */ { 17397, 0x00008724 }, /* GL_MODELVIEW4_ARB */ { 17415, 0x00008725 }, /* GL_MODELVIEW5_ARB */ { 17433, 0x00008726 }, /* GL_MODELVIEW6_ARB */ { 17451, 0x00008727 }, /* GL_MODELVIEW7_ARB */ { 17469, 0x00008728 }, /* GL_MODELVIEW8_ARB */ { 17487, 0x00008729 }, /* GL_MODELVIEW9_ARB */ { 17505, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ { 17525, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ { 17552, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ { 17577, 0x00002100 }, /* GL_MODULATE */ { 17589, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ { 17609, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ { 17636, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ { 17661, 0x00000103 }, /* GL_MULT */ { 17669, 0x0000809D }, /* GL_MULTISAMPLE */ { 17684, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ { 17704, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ { 17723, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ { 17742, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ { 17766, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ { 17789, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ { 17819, 0x00002A25 }, /* GL_N3F_V3F */ { 17830, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ { 17850, 0x0000150E }, /* GL_NAND */ { 17858, 0x00002600 }, /* GL_NEAREST */ { 17869, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ { 17900, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ { 17932, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ { 17957, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ { 17983, 0x00000200 }, /* GL_NEVER */ { 17992, 0x00001102 }, /* GL_NICEST */ { 18002, 0x00000000 }, /* GL_NONE */ { 18010, 0x00001505 }, /* GL_NOOP */ { 18018, 0x00001508 }, /* GL_NOR */ { 18025, 0x00000BA1 }, /* GL_NORMALIZE */ { 18038, 0x00008075 }, /* GL_NORMAL_ARRAY */ { 18054, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ { 18085, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ { 18120, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ { 18144, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ { 18167, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ { 18188, 0x00008511 }, /* GL_NORMAL_MAP */ { 18202, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ { 18220, 0x00008511 }, /* GL_NORMAL_MAP_NV */ { 18237, 0x00000205 }, /* GL_NOTEQUAL */ { 18249, 0x00000000 }, /* GL_NO_ERROR */ { 18261, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ { 18295, 0x000086A2 }, /* GL_NUM_TEXTURE_COMPRESSED_FORMATS_ARB */ { 18333, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ { 18365, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ { 18407, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ { 18437, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ { 18477, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ { 18508, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ { 18537, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ { 18565, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ { 18595, 0x00002401 }, /* GL_OBJECT_LINEAR */ { 18612, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ { 18638, 0x00002501 }, /* GL_OBJECT_PLANE */ { 18654, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ { 18689, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ { 18711, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ { 18730, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ { 18760, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ { 18781, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ { 18809, 0x00000001 }, /* GL_ONE */ { 18816, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ { 18844, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ { 18876, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ { 18904, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ { 18936, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ { 18959, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ { 18982, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ { 19005, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ { 19028, 0x00008598 }, /* GL_OPERAND0_ALPHA */ { 19046, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ { 19068, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ { 19090, 0x00008590 }, /* GL_OPERAND0_RGB */ { 19106, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ { 19126, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ { 19146, 0x00008599 }, /* GL_OPERAND1_ALPHA */ { 19164, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ { 19186, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ { 19208, 0x00008591 }, /* GL_OPERAND1_RGB */ { 19224, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ { 19244, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ { 19264, 0x0000859A }, /* GL_OPERAND2_ALPHA */ { 19282, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ { 19304, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ { 19326, 0x00008592 }, /* GL_OPERAND2_RGB */ { 19342, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ { 19362, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ { 19382, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ { 19403, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ { 19422, 0x00001507 }, /* GL_OR */ { 19428, 0x00000A01 }, /* GL_ORDER */ { 19437, 0x0000150D }, /* GL_OR_INVERTED */ { 19452, 0x0000150B }, /* GL_OR_REVERSE */ { 19466, 0x00000505 }, /* GL_OUT_OF_MEMORY */ { 19483, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ { 19501, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ { 19522, 0x00008758 }, /* GL_PACK_INVERT_MESA */ { 19542, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ { 19560, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ { 19579, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ { 19599, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ { 19619, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ { 19637, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ { 19656, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ { 19681, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ { 19705, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ { 19726, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ { 19748, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ { 19770, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ { 19795, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ { 19819, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ { 19840, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ { 19862, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ { 19884, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ { 19906, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ { 19937, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ { 19957, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ { 19982, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ { 20002, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ { 20027, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ { 20047, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ { 20072, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ { 20092, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ { 20117, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ { 20137, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ { 20162, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ { 20182, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ { 20207, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ { 20227, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ { 20252, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ { 20272, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ { 20297, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ { 20317, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ { 20342, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ { 20362, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ { 20387, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ { 20405, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ { 20438, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ { 20463, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ { 20498, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ { 20525, 0x00001B00 }, /* GL_POINT */ { 20534, 0x00000000 }, /* GL_POINTS */ { 20544, 0x00000002 }, /* GL_POINT_BIT */ { 20557, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ { 20587, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ { 20621, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ { 20655, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ { 20690, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ { 20719, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ { 20752, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ { 20785, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ { 20819, 0x00000B11 }, /* GL_POINT_SIZE */ { 20833, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ { 20859, 0x00008127 }, /* GL_POINT_SIZE_MAX */ { 20877, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ { 20899, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ { 20921, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ { 20944, 0x00008126 }, /* GL_POINT_SIZE_MIN */ { 20962, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ { 20984, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ { 21006, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ { 21029, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ { 21049, 0x00000B10 }, /* GL_POINT_SMOOTH */ { 21065, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ { 21086, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ { 21106, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ { 21135, 0x00008861 }, /* GL_POINT_SPRITE_NV */ { 21154, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ { 21180, 0x00000701 }, /* GL_POINT_TOKEN */ { 21195, 0x00000009 }, /* GL_POLYGON */ { 21206, 0x00000008 }, /* GL_POLYGON_BIT */ { 21221, 0x00000B40 }, /* GL_POLYGON_MODE */ { 21237, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ { 21260, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ { 21285, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ { 21308, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ { 21331, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ { 21355, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ { 21379, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ { 21397, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ { 21420, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ { 21439, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ { 21462, 0x00000703 }, /* GL_POLYGON_TOKEN */ { 21479, 0x00001203 }, /* GL_POSITION */ { 21491, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ { 21523, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ { 21559, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ { 21592, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ { 21629, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ { 21660, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ { 21695, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ { 21727, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ { 21763, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ { 21796, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ { 21828, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ { 21864, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ { 21897, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ { 21934, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ { 21964, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ { 21998, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ { 22029, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ { 22064, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ { 22095, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ { 22130, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ { 22162, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ { 22198, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ { 22228, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ { 22262, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ { 22293, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ { 22328, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ { 22360, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ { 22391, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ { 22426, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ { 22458, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ { 22494, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ { 22523, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ { 22556, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ { 22586, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ { 22620, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ { 22659, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ { 22692, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ { 22732, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ { 22766, 0x00008578 }, /* GL_PREVIOUS */ { 22778, 0x00008578 }, /* GL_PREVIOUS_ARB */ { 22794, 0x00008578 }, /* GL_PREVIOUS_EXT */ { 22810, 0x00008577 }, /* GL_PRIMARY_COLOR */ { 22827, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ { 22848, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ { 22869, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ { 22902, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ { 22934, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ { 22957, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ { 22980, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ { 23010, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ { 23039, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ { 23067, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ { 23089, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ { 23117, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ { 23145, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ { 23167, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ { 23188, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ { 23228, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ { 23267, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ { 23297, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ { 23332, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ { 23365, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ { 23399, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ { 23438, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ { 23477, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ { 23499, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ { 23525, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ { 23549, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ { 23572, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ { 23594, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ { 23615, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ { 23636, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ { 23663, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ { 23695, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ { 23727, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ { 23762, 0x00001701 }, /* GL_PROJECTION */ { 23776, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ { 23797, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ { 23823, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ { 23844, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ { 23863, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ { 23886, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ { 23925, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ { 23963, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ { 23983, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ { 24007, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ { 24027, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ { 24051, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ { 24071, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ { 24104, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ { 24130, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ { 24160, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ { 24191, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ { 24221, 0x00002003 }, /* GL_Q */ { 24226, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ { 24251, 0x00000007 }, /* GL_QUADS */ { 24260, 0x00008614 }, /* GL_QUAD_MESH_SUN */ { 24277, 0x00000008 }, /* GL_QUAD_STRIP */ { 24291, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ { 24313, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ { 24339, 0x00008866 }, /* GL_QUERY_RESULT */ { 24355, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ { 24375, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ { 24401, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ { 24431, 0x00002002 }, /* GL_R */ { 24436, 0x00002A10 }, /* GL_R3_G3_B2 */ { 24448, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ { 24481, 0x00000C02 }, /* GL_READ_BUFFER */ { 24496, 0x000088B8 }, /* GL_READ_ONLY */ { 24509, 0x000088B8 }, /* GL_READ_ONLY_ARB */ { 24526, 0x000088BA }, /* GL_READ_WRITE */ { 24540, 0x000088BA }, /* GL_READ_WRITE_ARB */ { 24558, 0x00001903 }, /* GL_RED */ { 24565, 0x00008016 }, /* GL_REDUCE */ { 24575, 0x00008016 }, /* GL_REDUCE_EXT */ { 24589, 0x00000D15 }, /* GL_RED_BIAS */ { 24601, 0x00000D52 }, /* GL_RED_BITS */ { 24613, 0x00000D14 }, /* GL_RED_SCALE */ { 24626, 0x00008512 }, /* GL_REFLECTION_MAP */ { 24644, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ { 24666, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ { 24687, 0x00001C00 }, /* GL_RENDER */ { 24697, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ { 24725, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ { 24745, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ { 24772, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ { 24808, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ { 24834, 0x00001F01 }, /* GL_RENDERER */ { 24846, 0x00000C40 }, /* GL_RENDER_MODE */ { 24861, 0x00002901 }, /* GL_REPEAT */ { 24871, 0x00001E01 }, /* GL_REPLACE */ { 24882, 0x00008062 }, /* GL_REPLACE_EXT */ { 24897, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ { 24920, 0x0000803A }, /* GL_RESCALE_NORMAL */ { 24938, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ { 24960, 0x00000102 }, /* GL_RETURN */ { 24970, 0x00001907 }, /* GL_RGB */ { 24977, 0x00008052 }, /* GL_RGB10 */ { 24986, 0x00008059 }, /* GL_RGB10_A2 */ { 24998, 0x00008059 }, /* GL_RGB10_A2_EXT */ { 25014, 0x00008052 }, /* GL_RGB10_EXT */ { 25027, 0x00008053 }, /* GL_RGB12 */ { 25036, 0x00008053 }, /* GL_RGB12_EXT */ { 25049, 0x00008054 }, /* GL_RGB16 */ { 25058, 0x00008054 }, /* GL_RGB16_EXT */ { 25071, 0x0000804E }, /* GL_RGB2_EXT */ { 25083, 0x0000804F }, /* GL_RGB4 */ { 25091, 0x0000804F }, /* GL_RGB4_EXT */ { 25103, 0x000083A1 }, /* GL_RGB4_S3TC */ { 25116, 0x00008050 }, /* GL_RGB5 */ { 25124, 0x00008057 }, /* GL_RGB5_A1 */ { 25135, 0x00008057 }, /* GL_RGB5_A1_EXT */ { 25150, 0x00008050 }, /* GL_RGB5_EXT */ { 25162, 0x00008051 }, /* GL_RGB8 */ { 25170, 0x00008051 }, /* GL_RGB8_EXT */ { 25182, 0x00001908 }, /* GL_RGBA */ { 25190, 0x0000805A }, /* GL_RGBA12 */ { 25200, 0x0000805A }, /* GL_RGBA12_EXT */ { 25214, 0x0000805B }, /* GL_RGBA16 */ { 25224, 0x0000805B }, /* GL_RGBA16_EXT */ { 25238, 0x00008055 }, /* GL_RGBA2 */ { 25247, 0x00008055 }, /* GL_RGBA2_EXT */ { 25260, 0x00008056 }, /* GL_RGBA4 */ { 25269, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ { 25288, 0x00008056 }, /* GL_RGBA4_EXT */ { 25301, 0x000083A3 }, /* GL_RGBA4_S3TC */ { 25315, 0x00008058 }, /* GL_RGBA8 */ { 25324, 0x00008058 }, /* GL_RGBA8_EXT */ { 25337, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ { 25355, 0x00000C31 }, /* GL_RGBA_MODE */ { 25368, 0x000083A2 }, /* GL_RGBA_S3TC */ { 25381, 0x000083A0 }, /* GL_RGB_S3TC */ { 25393, 0x00008573 }, /* GL_RGB_SCALE */ { 25406, 0x00008573 }, /* GL_RGB_SCALE_ARB */ { 25423, 0x00008573 }, /* GL_RGB_SCALE_EXT */ { 25440, 0x00000407 }, /* GL_RIGHT */ { 25449, 0x00002000 }, /* GL_S */ { 25454, 0x000080A9 }, /* GL_SAMPLES */ { 25465, 0x000086B4 }, /* GL_SAMPLES_3DFX */ { 25481, 0x000080A9 }, /* GL_SAMPLES_ARB */ { 25496, 0x00008914 }, /* GL_SAMPLES_PASSED */ { 25514, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ { 25536, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ { 25564, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ { 25596, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ { 25619, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ { 25646, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ { 25664, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ { 25687, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ { 25709, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ { 25728, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ { 25751, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ { 25777, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ { 25807, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ { 25832, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ { 25861, 0x00080000 }, /* GL_SCISSOR_BIT */ { 25876, 0x00000C10 }, /* GL_SCISSOR_BOX */ { 25891, 0x00000C11 }, /* GL_SCISSOR_TEST */ { 25907, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ { 25932, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ { 25972, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ { 26016, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ { 26049, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ { 26079, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ { 26111, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ { 26141, 0x00001C02 }, /* GL_SELECT */ { 26151, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ { 26179, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ { 26204, 0x00008012 }, /* GL_SEPARABLE_2D */ { 26220, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ { 26247, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ { 26278, 0x0000150F }, /* GL_SET */ { 26285, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ { 26306, 0x00000B54 }, /* GL_SHADE_MODEL */ { 26321, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ { 26344, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ { 26374, 0x00001601 }, /* GL_SHININESS */ { 26387, 0x00001402 }, /* GL_SHORT */ { 26396, 0x000081F9 }, /* GL_SINGLE_COLOR */ { 26412, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ { 26432, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ { 26451, 0x00001D01 }, /* GL_SMOOTH */ { 26461, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ { 26494, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ { 26521, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ { 26554, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ { 26581, 0x00008588 }, /* GL_SOURCE0_ALPHA */ { 26598, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ { 26619, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ { 26640, 0x00008580 }, /* GL_SOURCE0_RGB */ { 26655, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ { 26674, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ { 26693, 0x00008589 }, /* GL_SOURCE1_ALPHA */ { 26710, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ { 26731, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ { 26752, 0x00008581 }, /* GL_SOURCE1_RGB */ { 26767, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ { 26786, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ { 26805, 0x0000858A }, /* GL_SOURCE2_ALPHA */ { 26822, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ { 26843, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ { 26864, 0x00008582 }, /* GL_SOURCE2_RGB */ { 26879, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ { 26898, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ { 26917, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ { 26937, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ { 26955, 0x00001202 }, /* GL_SPECULAR */ { 26967, 0x00002402 }, /* GL_SPHERE_MAP */ { 26981, 0x00001206 }, /* GL_SPOT_CUTOFF */ { 26996, 0x00001204 }, /* GL_SPOT_DIRECTION */ { 27014, 0x00001205 }, /* GL_SPOT_EXPONENT */ { 27031, 0x00008588 }, /* GL_SRC0_ALPHA */ { 27045, 0x00008580 }, /* GL_SRC0_RGB */ { 27057, 0x00008589 }, /* GL_SRC1_ALPHA */ { 27071, 0x00008581 }, /* GL_SRC1_RGB */ { 27083, 0x0000858A }, /* GL_SRC2_ALPHA */ { 27097, 0x00008582 }, /* GL_SRC2_RGB */ { 27109, 0x00000302 }, /* GL_SRC_ALPHA */ { 27122, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ { 27144, 0x00000300 }, /* GL_SRC_COLOR */ { 27157, 0x00000503 }, /* GL_STACK_OVERFLOW */ { 27175, 0x00000504 }, /* GL_STACK_UNDERFLOW */ { 27194, 0x000088E6 }, /* GL_STATIC_COPY */ { 27209, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ { 27228, 0x000088E4 }, /* GL_STATIC_DRAW */ { 27243, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ { 27262, 0x000088E5 }, /* GL_STATIC_READ */ { 27277, 0x000088E5 }, /* GL_STATIC_READ_ARB */ { 27296, 0x00001802 }, /* GL_STENCIL */ { 27307, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ { 27333, 0x00000D57 }, /* GL_STENCIL_BITS */ { 27349, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ { 27371, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ { 27394, 0x00000B94 }, /* GL_STENCIL_FAIL */ { 27410, 0x00000B92 }, /* GL_STENCIL_FUNC */ { 27426, 0x00001901 }, /* GL_STENCIL_INDEX */ { 27443, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ { 27466, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ { 27488, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ { 27510, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ { 27532, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ { 27553, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ { 27580, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ { 27607, 0x00000B97 }, /* GL_STENCIL_REF */ { 27622, 0x00000B90 }, /* GL_STENCIL_TEST */ { 27638, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ { 27667, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ { 27689, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ { 27710, 0x00000C33 }, /* GL_STEREO */ { 27720, 0x000088E2 }, /* GL_STREAM_COPY */ { 27735, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ { 27754, 0x000088E0 }, /* GL_STREAM_DRAW */ { 27769, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ { 27788, 0x000088E1 }, /* GL_STREAM_READ */ { 27803, 0x000088E1 }, /* GL_STREAM_READ_ARB */ { 27822, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ { 27839, 0x000084E7 }, /* GL_SUBTRACT */ { 27851, 0x000084E7 }, /* GL_SUBTRACT_ARB */ { 27867, 0x00002001 }, /* GL_T */ { 27872, 0x00002A2A }, /* GL_T2F_C3F_V3F */ { 27887, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ { 27906, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ { 27922, 0x00002A2B }, /* GL_T2F_N3F_V3F */ { 27937, 0x00002A27 }, /* GL_T2F_V3F */ { 27948, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ { 27967, 0x00002A28 }, /* GL_T4F_V4F */ { 27978, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ { 28001, 0x00001702 }, /* GL_TEXTURE */ { 28012, 0x000084C0 }, /* GL_TEXTURE0 */ { 28024, 0x000084C0 }, /* GL_TEXTURE0_ARB */ { 28040, 0x000084C1 }, /* GL_TEXTURE1 */ { 28052, 0x000084CA }, /* GL_TEXTURE10 */ { 28065, 0x000084CA }, /* GL_TEXTURE10_ARB */ { 28082, 0x000084CB }, /* GL_TEXTURE11 */ { 28095, 0x000084CB }, /* GL_TEXTURE11_ARB */ { 28112, 0x000084CC }, /* GL_TEXTURE12 */ { 28125, 0x000084CC }, /* GL_TEXTURE12_ARB */ { 28142, 0x000084CD }, /* GL_TEXTURE13 */ { 28155, 0x000084CD }, /* GL_TEXTURE13_ARB */ { 28172, 0x000084CE }, /* GL_TEXTURE14 */ { 28185, 0x000084CE }, /* GL_TEXTURE14_ARB */ { 28202, 0x000084CF }, /* GL_TEXTURE15 */ { 28215, 0x000084CF }, /* GL_TEXTURE15_ARB */ { 28232, 0x000084D0 }, /* GL_TEXTURE16 */ { 28245, 0x000084D0 }, /* GL_TEXTURE16_ARB */ { 28262, 0x000084D1 }, /* GL_TEXTURE17 */ { 28275, 0x000084D1 }, /* GL_TEXTURE17_ARB */ { 28292, 0x000084D2 }, /* GL_TEXTURE18 */ { 28305, 0x000084D2 }, /* GL_TEXTURE18_ARB */ { 28322, 0x000084D3 }, /* GL_TEXTURE19 */ { 28335, 0x000084D3 }, /* GL_TEXTURE19_ARB */ { 28352, 0x000084C1 }, /* GL_TEXTURE1_ARB */ { 28368, 0x000084C2 }, /* GL_TEXTURE2 */ { 28380, 0x000084D4 }, /* GL_TEXTURE20 */ { 28393, 0x000084D4 }, /* GL_TEXTURE20_ARB */ { 28410, 0x000084D5 }, /* GL_TEXTURE21 */ { 28423, 0x000084D5 }, /* GL_TEXTURE21_ARB */ { 28440, 0x000084D6 }, /* GL_TEXTURE22 */ { 28453, 0x000084D6 }, /* GL_TEXTURE22_ARB */ { 28470, 0x000084D7 }, /* GL_TEXTURE23 */ { 28483, 0x000084D7 }, /* GL_TEXTURE23_ARB */ { 28500, 0x000084D8 }, /* GL_TEXTURE24 */ { 28513, 0x000084D8 }, /* GL_TEXTURE24_ARB */ { 28530, 0x000084D9 }, /* GL_TEXTURE25 */ { 28543, 0x000084D9 }, /* GL_TEXTURE25_ARB */ { 28560, 0x000084DA }, /* GL_TEXTURE26 */ { 28573, 0x000084DA }, /* GL_TEXTURE26_ARB */ { 28590, 0x000084DB }, /* GL_TEXTURE27 */ { 28603, 0x000084DB }, /* GL_TEXTURE27_ARB */ { 28620, 0x000084DC }, /* GL_TEXTURE28 */ { 28633, 0x000084DC }, /* GL_TEXTURE28_ARB */ { 28650, 0x000084DD }, /* GL_TEXTURE29 */ { 28663, 0x000084DD }, /* GL_TEXTURE29_ARB */ { 28680, 0x000084C2 }, /* GL_TEXTURE2_ARB */ { 28696, 0x000084C3 }, /* GL_TEXTURE3 */ { 28708, 0x000084DE }, /* GL_TEXTURE30 */ { 28721, 0x000084DE }, /* GL_TEXTURE30_ARB */ { 28738, 0x000084DF }, /* GL_TEXTURE31 */ { 28751, 0x000084DF }, /* GL_TEXTURE31_ARB */ { 28768, 0x000084C3 }, /* GL_TEXTURE3_ARB */ { 28784, 0x000084C4 }, /* GL_TEXTURE4 */ { 28796, 0x000084C4 }, /* GL_TEXTURE4_ARB */ { 28812, 0x000084C5 }, /* GL_TEXTURE5 */ { 28824, 0x000084C5 }, /* GL_TEXTURE5_ARB */ { 28840, 0x000084C6 }, /* GL_TEXTURE6 */ { 28852, 0x000084C6 }, /* GL_TEXTURE6_ARB */ { 28868, 0x000084C7 }, /* GL_TEXTURE7 */ { 28880, 0x000084C7 }, /* GL_TEXTURE7_ARB */ { 28896, 0x000084C8 }, /* GL_TEXTURE8 */ { 28908, 0x000084C8 }, /* GL_TEXTURE8_ARB */ { 28924, 0x000084C9 }, /* GL_TEXTURE9 */ { 28936, 0x000084C9 }, /* GL_TEXTURE9_ARB */ { 28952, 0x00000DE0 }, /* GL_TEXTURE_1D */ { 28966, 0x00000DE1 }, /* GL_TEXTURE_2D */ { 28980, 0x0000806F }, /* GL_TEXTURE_3D */ { 28994, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ { 29016, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ { 29042, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ { 29064, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ { 29086, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ { 29108, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ { 29130, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ { 29158, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ { 29190, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ { 29223, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ { 29255, 0x00040000 }, /* GL_TEXTURE_BIT */ { 29270, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ { 29291, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ { 29316, 0x00001005 }, /* GL_TEXTURE_BORDER */ { 29334, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ { 29358, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ { 29389, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ { 29419, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ { 29449, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ { 29484, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ { 29515, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ { 29553, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ { 29580, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ { 29612, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ { 29646, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ { 29670, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ { 29698, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ { 29722, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ { 29750, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ { 29783, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ { 29807, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ { 29829, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ { 29851, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ { 29877, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ { 29911, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ { 29944, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ { 29981, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ { 30009, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ { 30041, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ { 30064, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ { 30102, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ { 30144, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ { 30175, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ { 30203, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ { 30233, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ { 30261, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ { 30281, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ { 30305, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ { 30336, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ { 30371, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ { 30402, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ { 30437, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ { 30468, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ { 30503, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ { 30534, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ { 30569, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ { 30600, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ { 30635, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ { 30666, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ { 30701, 0x00008071 }, /* GL_TEXTURE_DEPTH */ { 30718, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ { 30740, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ { 30766, 0x00002300 }, /* GL_TEXTURE_ENV */ { 30781, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ { 30802, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ { 30822, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ { 30848, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ { 30868, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ { 30885, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ { 30902, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ { 30919, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ { 30936, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ { 30961, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ { 30983, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ { 31009, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ { 31027, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ { 31053, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ { 31079, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ { 31109, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ { 31136, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ { 31161, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ { 31181, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ { 31205, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ { 31232, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ { 31259, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ { 31286, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ { 31312, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ { 31342, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ { 31364, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ { 31382, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ { 31412, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ { 31440, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ { 31468, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ { 31496, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ { 31517, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ { 31536, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ { 31558, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ { 31577, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ { 31597, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ { 31622, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ { 31646, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ { 31666, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ { 31690, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ { 31710, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ { 31733, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ { 31758, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ { 31792, 0x00001000 }, /* GL_TEXTURE_WIDTH */ { 31809, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ { 31827, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ { 31845, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ { 31863, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ { 31882, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ { 31911, 0x00001000 }, /* GL_TRANSFORM_BIT */ { 31928, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ { 31954, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ { 31984, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ { 32016, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ { 32046, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ { 32080, 0x0000862C }, /* GL_TRANSPOSE_NV */ { 32096, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ { 32127, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ { 32162, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ { 32190, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ { 32222, 0x00000004 }, /* GL_TRIANGLES */ { 32235, 0x00000006 }, /* GL_TRIANGLE_FAN */ { 32251, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ { 32272, 0x00000005 }, /* GL_TRIANGLE_STRIP */ { 32290, 0x00000001 }, /* GL_TRUE */ { 32298, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ { 32318, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ { 32341, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ { 32361, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ { 32382, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ { 32404, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ { 32426, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ { 32446, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ { 32467, 0x00001401 }, /* GL_UNSIGNED_BYTE */ { 32484, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ { 32511, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ { 32534, 0x00001405 }, /* GL_UNSIGNED_INT */ { 32550, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ { 32577, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ { 32601, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ { 32632, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ { 32656, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ { 32684, 0x00001403 }, /* GL_UNSIGNED_SHORT */ { 32702, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ { 32732, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ { 32758, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ { 32788, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ { 32814, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ { 32838, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ { 32866, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ { 32894, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ { 32921, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ { 32953, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ { 32984, 0x00002A20 }, /* GL_V2F */ { 32991, 0x00002A21 }, /* GL_V3F */ { 32998, 0x00001F00 }, /* GL_VENDOR */ { 33008, 0x00001F02 }, /* GL_VERSION */ { 33019, 0x00008074 }, /* GL_VERTEX_ARRAY */ { 33035, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ { 33066, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ { 33101, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ { 33125, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ { 33146, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ { 33169, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ { 33190, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ { 33217, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ { 33245, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ { 33273, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ { 33301, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ { 33329, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ { 33357, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ { 33385, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ { 33412, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ { 33439, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ { 33466, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ { 33493, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ { 33520, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ { 33547, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ { 33574, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ { 33601, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ { 33628, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ { 33666, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ { 33708, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ { 33743, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ { 33781, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ { 33816, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ { 33848, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ { 33882, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ { 33914, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ { 33934, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ { 33956, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ { 33985, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ { 34006, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ { 34039, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ { 34071, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ { 34102, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ { 34132, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ { 34153, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ { 34180, 0x00000BA2 }, /* GL_VIEWPORT */ { 34192, 0x00000800 }, /* GL_VIEWPORT_BIT */ { 34208, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ { 34228, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ { 34259, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ { 34294, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ { 34322, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ { 34347, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ { 34374, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ { 34399, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ { 34423, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ { 34442, 0x000088B9 }, /* GL_WRITE_ONLY */ { 34456, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ { 34474, 0x00001506 }, /* GL_XOR */ { 34481, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ { 34500, 0x00008757 }, /* GL_YCBCR_MESA */ { 34514, 0x00000000 }, /* GL_ZERO */ { 34522, 0x00000D16 }, /* GL_ZOOM_X */ { 34532, 0x00000D17 }, /* GL_ZOOM_Y */ }; static const unsigned reduced_enums[1232] = { 26, /* GL_ALL_CLIENT_ATTRIB_BITS */ 389, /* GL_FALSE */ 561, /* GL_LINES */ 563, /* GL_LINE_LOOP */ 570, /* GL_LINE_STRIP */ 1515, /* GL_TRIANGLES */ 1518, /* GL_TRIANGLE_STRIP */ 1516, /* GL_TRIANGLE_FAN */ 1112, /* GL_QUADS */ 1114, /* GL_QUAD_STRIP */ 1002, /* GL_POLYGON */ 1014, /* GL_POLYGON_STIPPLE_BIT */ 968, /* GL_PIXEL_MODE_BIT */ 548, /* GL_LIGHTING_BIT */ 405, /* GL_FOG_BIT */ 8, /* GL_ACCUM */ 579, /* GL_LOAD */ 1152, /* GL_RETURN */ 841, /* GL_MULT */ 19, /* GL_ADD */ 857, /* GL_NEVER */ 538, /* GL_LESS */ 379, /* GL_EQUAL */ 537, /* GL_LEQUAL */ 467, /* GL_GREATER */ 872, /* GL_NOTEQUAL */ 466, /* GL_GEQUAL */ 42, /* GL_ALWAYS */ 1276, /* GL_SRC_COLOR */ 901, /* GL_ONE_MINUS_SRC_COLOR */ 1274, /* GL_SRC_ALPHA */ 900, /* GL_ONE_MINUS_SRC_ALPHA */ 359, /* GL_DST_ALPHA */ 898, /* GL_ONE_MINUS_DST_ALPHA */ 360, /* GL_DST_COLOR */ 899, /* GL_ONE_MINUS_DST_COLOR */ 1275, /* GL_SRC_ALPHA_SATURATE */ 454, /* GL_FRONT_LEFT */ 455, /* GL_FRONT_RIGHT */ 64, /* GL_BACK_LEFT */ 65, /* GL_BACK_RIGHT */ 451, /* GL_FRONT */ 63, /* GL_BACK */ 536, /* GL_LEFT */ 1192, /* GL_RIGHT */ 452, /* GL_FRONT_AND_BACK */ 58, /* GL_AUX0 */ 59, /* GL_AUX1 */ 60, /* GL_AUX2 */ 61, /* GL_AUX3 */ 528, /* GL_INVALID_ENUM */ 531, /* GL_INVALID_VALUE */ 530, /* GL_INVALID_OPERATION */ 1277, /* GL_STACK_OVERFLOW */ 1278, /* GL_STACK_UNDERFLOW */ 926, /* GL_OUT_OF_MEMORY */ 529, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ 0, /* GL_2D */ 2, /* GL_3D */ 3, /* GL_3D_COLOR */ 4, /* GL_3D_COLOR_TEXTURE */ 6, /* GL_4D_COLOR_TEXTURE */ 946, /* GL_PASS_THROUGH_TOKEN */ 1001, /* GL_POINT_TOKEN */ 571, /* GL_LINE_TOKEN */ 1015, /* GL_POLYGON_TOKEN */ 69, /* GL_BITMAP_TOKEN */ 358, /* GL_DRAW_PIXEL_TOKEN */ 248, /* GL_COPY_PIXEL_TOKEN */ 564, /* GL_LINE_RESET_TOKEN */ 382, /* GL_EXP */ 383, /* GL_EXP2 */ 279, /* GL_CW */ 106, /* GL_CCW */ 127, /* GL_COEFF */ 923, /* GL_ORDER */ 315, /* GL_DOMAIN */ 256, /* GL_CURRENT_COLOR */ 259, /* GL_CURRENT_INDEX */ 265, /* GL_CURRENT_NORMAL */ 276, /* GL_CURRENT_TEXTURE_COORDS */ 269, /* GL_CURRENT_RASTER_COLOR */ 271, /* GL_CURRENT_RASTER_INDEX */ 274, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ 272, /* GL_CURRENT_RASTER_POSITION */ 273, /* GL_CURRENT_RASTER_POSITION_VALID */ 270, /* GL_CURRENT_RASTER_DISTANCE */ 995, /* GL_POINT_SMOOTH */ 984, /* GL_POINT_SIZE */ 994, /* GL_POINT_SIZE_RANGE */ 985, /* GL_POINT_SIZE_GRANULARITY */ 565, /* GL_LINE_SMOOTH */ 572, /* GL_LINE_WIDTH */ 574, /* GL_LINE_WIDTH_RANGE */ 573, /* GL_LINE_WIDTH_GRANULARITY */ 567, /* GL_LINE_STIPPLE */ 568, /* GL_LINE_STIPPLE_PATTERN */ 569, /* GL_LINE_STIPPLE_REPEAT */ 578, /* GL_LIST_MODE */ 732, /* GL_MAX_LIST_NESTING */ 575, /* GL_LIST_BASE */ 577, /* GL_LIST_INDEX */ 1004, /* GL_POLYGON_MODE */ 1011, /* GL_POLYGON_SMOOTH */ 1013, /* GL_POLYGON_STIPPLE */ 367, /* GL_EDGE_FLAG */ 249, /* GL_CULL_FACE */ 250, /* GL_CULL_FACE_MODE */ 453, /* GL_FRONT_FACE */ 547, /* GL_LIGHTING */ 552, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ 553, /* GL_LIGHT_MODEL_TWO_SIDE */ 549, /* GL_LIGHT_MODEL_AMBIENT */ 1230, /* GL_SHADE_MODEL */ 158, /* GL_COLOR_MATERIAL_FACE */ 159, /* GL_COLOR_MATERIAL_PARAMETER */ 157, /* GL_COLOR_MATERIAL */ 404, /* GL_FOG */ 426, /* GL_FOG_INDEX */ 422, /* GL_FOG_DENSITY */ 430, /* GL_FOG_START */ 424, /* GL_FOG_END */ 427, /* GL_FOG_MODE */ 406, /* GL_FOG_COLOR */ 304, /* GL_DEPTH_RANGE */ 309, /* GL_DEPTH_TEST */ 312, /* GL_DEPTH_WRITEMASK */ 292, /* GL_DEPTH_CLEAR_VALUE */ 303, /* GL_DEPTH_FUNC */ 12, /* GL_ACCUM_CLEAR_VALUE */ 1301, /* GL_STENCIL_TEST */ 1289, /* GL_STENCIL_CLEAR_VALUE */ 1291, /* GL_STENCIL_FUNC */ 1303, /* GL_STENCIL_VALUE_MASK */ 1290, /* GL_STENCIL_FAIL */ 1298, /* GL_STENCIL_PASS_DEPTH_FAIL */ 1299, /* GL_STENCIL_PASS_DEPTH_PASS */ 1300, /* GL_STENCIL_REF */ 1304, /* GL_STENCIL_WRITEMASK */ 705, /* GL_MATRIX_MODE */ 862, /* GL_NORMALIZE */ 1593, /* GL_VIEWPORT */ 836, /* GL_MODELVIEW_STACK_DEPTH */ 1094, /* GL_PROJECTION_STACK_DEPTH */ 1495, /* GL_TEXTURE_STACK_DEPTH */ 834, /* GL_MODELVIEW_MATRIX */ 1093, /* GL_PROJECTION_MATRIX */ 1480, /* GL_TEXTURE_MATRIX */ 56, /* GL_ATTRIB_STACK_DEPTH */ 117, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ 39, /* GL_ALPHA_TEST */ 40, /* GL_ALPHA_TEST_FUNC */ 41, /* GL_ALPHA_TEST_REF */ 314, /* GL_DITHER */ 73, /* GL_BLEND_DST */ 80, /* GL_BLEND_SRC */ 70, /* GL_BLEND */ 581, /* GL_LOGIC_OP_MODE */ 506, /* GL_INDEX_LOGIC_OP */ 156, /* GL_COLOR_LOGIC_OP */ 62, /* GL_AUX_BUFFERS */ 325, /* GL_DRAW_BUFFER */ 1124, /* GL_READ_BUFFER */ 1213, /* GL_SCISSOR_BOX */ 1214, /* GL_SCISSOR_TEST */ 505, /* GL_INDEX_CLEAR_VALUE */ 510, /* GL_INDEX_WRITEMASK */ 153, /* GL_COLOR_CLEAR_VALUE */ 185, /* GL_COLOR_WRITEMASK */ 507, /* GL_INDEX_MODE */ 1186, /* GL_RGBA_MODE */ 324, /* GL_DOUBLEBUFFER */ 1305, /* GL_STEREO */ 1145, /* GL_RENDER_MODE */ 947, /* GL_PERSPECTIVE_CORRECTION_HINT */ 996, /* GL_POINT_SMOOTH_HINT */ 566, /* GL_LINE_SMOOTH_HINT */ 1012, /* GL_POLYGON_SMOOTH_HINT */ 425, /* GL_FOG_HINT */ 1461, /* GL_TEXTURE_GEN_S */ 1462, /* GL_TEXTURE_GEN_T */ 1460, /* GL_TEXTURE_GEN_R */ 1459, /* GL_TEXTURE_GEN_Q */ 960, /* GL_PIXEL_MAP_I_TO_I */ 966, /* GL_PIXEL_MAP_S_TO_S */ 962, /* GL_PIXEL_MAP_I_TO_R */ 958, /* GL_PIXEL_MAP_I_TO_G */ 956, /* GL_PIXEL_MAP_I_TO_B */ 954, /* GL_PIXEL_MAP_I_TO_A */ 964, /* GL_PIXEL_MAP_R_TO_R */ 952, /* GL_PIXEL_MAP_G_TO_G */ 950, /* GL_PIXEL_MAP_B_TO_B */ 948, /* GL_PIXEL_MAP_A_TO_A */ 961, /* GL_PIXEL_MAP_I_TO_I_SIZE */ 967, /* GL_PIXEL_MAP_S_TO_S_SIZE */ 963, /* GL_PIXEL_MAP_I_TO_R_SIZE */ 959, /* GL_PIXEL_MAP_I_TO_G_SIZE */ 957, /* GL_PIXEL_MAP_I_TO_B_SIZE */ 955, /* GL_PIXEL_MAP_I_TO_A_SIZE */ 965, /* GL_PIXEL_MAP_R_TO_R_SIZE */ 953, /* GL_PIXEL_MAP_G_TO_G_SIZE */ 951, /* GL_PIXEL_MAP_B_TO_B_SIZE */ 949, /* GL_PIXEL_MAP_A_TO_A_SIZE */ 1527, /* GL_UNPACK_SWAP_BYTES */ 1522, /* GL_UNPACK_LSB_FIRST */ 1523, /* GL_UNPACK_ROW_LENGTH */ 1526, /* GL_UNPACK_SKIP_ROWS */ 1525, /* GL_UNPACK_SKIP_PIXELS */ 1520, /* GL_UNPACK_ALIGNMENT */ 935, /* GL_PACK_SWAP_BYTES */ 930, /* GL_PACK_LSB_FIRST */ 931, /* GL_PACK_ROW_LENGTH */ 934, /* GL_PACK_SKIP_ROWS */ 933, /* GL_PACK_SKIP_PIXELS */ 927, /* GL_PACK_ALIGNMENT */ 658, /* GL_MAP_COLOR */ 659, /* GL_MAP_STENCIL */ 509, /* GL_INDEX_SHIFT */ 508, /* GL_INDEX_OFFSET */ 1134, /* GL_RED_SCALE */ 1132, /* GL_RED_BIAS */ 1610, /* GL_ZOOM_X */ 1611, /* GL_ZOOM_Y */ 471, /* GL_GREEN_SCALE */ 469, /* GL_GREEN_BIAS */ 86, /* GL_BLUE_SCALE */ 84, /* GL_BLUE_BIAS */ 38, /* GL_ALPHA_SCALE */ 36, /* GL_ALPHA_BIAS */ 305, /* GL_DEPTH_SCALE */ 286, /* GL_DEPTH_BIAS */ 728, /* GL_MAX_EVAL_ORDER */ 731, /* GL_MAX_LIGHTS */ 713, /* GL_MAX_CLIP_PLANES */ 773, /* GL_MAX_TEXTURE_SIZE */ 737, /* GL_MAX_PIXEL_MAP_TABLE */ 709, /* GL_MAX_ATTRIB_STACK_DEPTH */ 734, /* GL_MAX_MODELVIEW_STACK_DEPTH */ 735, /* GL_MAX_NAME_STACK_DEPTH */ 763, /* GL_MAX_PROJECTION_STACK_DEPTH */ 774, /* GL_MAX_TEXTURE_STACK_DEPTH */ 784, /* GL_MAX_VIEWPORT_DIMS */ 710, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ 1312, /* GL_SUBPIXEL_BITS */ 504, /* GL_INDEX_BITS */ 1133, /* GL_RED_BITS */ 470, /* GL_GREEN_BITS */ 85, /* GL_BLUE_BITS */ 37, /* GL_ALPHA_BITS */ 287, /* GL_DEPTH_BITS */ 1287, /* GL_STENCIL_BITS */ 14, /* GL_ACCUM_RED_BITS */ 13, /* GL_ACCUM_GREEN_BITS */ 10, /* GL_ACCUM_BLUE_BITS */ 9, /* GL_ACCUM_ALPHA_BITS */ 850, /* GL_NAME_STACK_DEPTH */ 57, /* GL_AUTO_NORMAL */ 604, /* GL_MAP1_COLOR_4 */ 607, /* GL_MAP1_INDEX */ 608, /* GL_MAP1_NORMAL */ 609, /* GL_MAP1_TEXTURE_COORD_1 */ 610, /* GL_MAP1_TEXTURE_COORD_2 */ 611, /* GL_MAP1_TEXTURE_COORD_3 */ 612, /* GL_MAP1_TEXTURE_COORD_4 */ 613, /* GL_MAP1_VERTEX_3 */ 614, /* GL_MAP1_VERTEX_4 */ 631, /* GL_MAP2_COLOR_4 */ 634, /* GL_MAP2_INDEX */ 635, /* GL_MAP2_NORMAL */ 636, /* GL_MAP2_TEXTURE_COORD_1 */ 637, /* GL_MAP2_TEXTURE_COORD_2 */ 638, /* GL_MAP2_TEXTURE_COORD_3 */ 639, /* GL_MAP2_TEXTURE_COORD_4 */ 640, /* GL_MAP2_VERTEX_3 */ 641, /* GL_MAP2_VERTEX_4 */ 605, /* GL_MAP1_GRID_DOMAIN */ 606, /* GL_MAP1_GRID_SEGMENTS */ 632, /* GL_MAP2_GRID_DOMAIN */ 633, /* GL_MAP2_GRID_SEGMENTS */ 1389, /* GL_TEXTURE_1D */ 1390, /* GL_TEXTURE_2D */ 392, /* GL_FEEDBACK_BUFFER_POINTER */ 393, /* GL_FEEDBACK_BUFFER_SIZE */ 394, /* GL_FEEDBACK_BUFFER_TYPE */ 1223, /* GL_SELECTION_BUFFER_POINTER */ 1224, /* GL_SELECTION_BUFFER_SIZE */ 1498, /* GL_TEXTURE_WIDTH */ 1466, /* GL_TEXTURE_HEIGHT */ 1422, /* GL_TEXTURE_COMPONENTS */ 1406, /* GL_TEXTURE_BORDER_COLOR */ 1405, /* GL_TEXTURE_BORDER */ 316, /* GL_DONT_CARE */ 390, /* GL_FASTEST */ 858, /* GL_NICEST */ 43, /* GL_AMBIENT */ 313, /* GL_DIFFUSE */ 1263, /* GL_SPECULAR */ 1016, /* GL_POSITION */ 1266, /* GL_SPOT_DIRECTION */ 1267, /* GL_SPOT_EXPONENT */ 1265, /* GL_SPOT_CUTOFF */ 223, /* GL_CONSTANT_ATTENUATION */ 556, /* GL_LINEAR_ATTENUATION */ 1111, /* GL_QUADRATIC_ATTENUATION */ 198, /* GL_COMPILE */ 199, /* GL_COMPILE_AND_EXECUTE */ 101, /* GL_BYTE */ 1528, /* GL_UNSIGNED_BYTE */ 1234, /* GL_SHORT */ 1537, /* GL_UNSIGNED_SHORT */ 511, /* GL_INT */ 1531, /* GL_UNSIGNED_INT */ 397, /* GL_FLOAT */ 1, /* GL_2_BYTES */ 5, /* GL_3_BYTES */ 7, /* GL_4_BYTES */ 323, /* GL_DOUBLE */ 113, /* GL_CLEAR */ 45, /* GL_AND */ 47, /* GL_AND_REVERSE */ 246, /* GL_COPY */ 46, /* GL_AND_INVERTED */ 860, /* GL_NOOP */ 1606, /* GL_XOR */ 922, /* GL_OR */ 861, /* GL_NOR */ 380, /* GL_EQUIV */ 534, /* GL_INVERT */ 925, /* GL_OR_REVERSE */ 247, /* GL_COPY_INVERTED */ 924, /* GL_OR_INVERTED */ 851, /* GL_NAND */ 1228, /* GL_SET */ 377, /* GL_EMISSION */ 1233, /* GL_SHININESS */ 44, /* GL_AMBIENT_AND_DIFFUSE */ 155, /* GL_COLOR_INDEXES */ 801, /* GL_MODELVIEW */ 1092, /* GL_PROJECTION */ 1324, /* GL_TEXTURE */ 128, /* GL_COLOR */ 284, /* GL_DEPTH */ 1285, /* GL_STENCIL */ 154, /* GL_COLOR_INDEX */ 1292, /* GL_STENCIL_INDEX */ 293, /* GL_DEPTH_COMPONENT */ 1129, /* GL_RED */ 468, /* GL_GREEN */ 83, /* GL_BLUE */ 27, /* GL_ALPHA */ 1153, /* GL_RGB */ 1172, /* GL_RGBA */ 582, /* GL_LUMINANCE */ 603, /* GL_LUMINANCE_ALPHA */ 68, /* GL_BITMAP */ 973, /* GL_POINT */ 554, /* GL_LINE */ 395, /* GL_FILL */ 1138, /* GL_RENDER */ 391, /* GL_FEEDBACK */ 1222, /* GL_SELECT */ 396, /* GL_FLAT */ 1238, /* GL_SMOOTH */ 535, /* GL_KEEP */ 1147, /* GL_REPLACE */ 495, /* GL_INCR */ 281, /* GL_DECR */ 1550, /* GL_VENDOR */ 1144, /* GL_RENDERER */ 1551, /* GL_VERSION */ 384, /* GL_EXTENSIONS */ 1193, /* GL_S */ 1315, /* GL_T */ 1121, /* GL_R */ 1110, /* GL_Q */ 837, /* GL_MODULATE */ 280, /* GL_DECAL */ 1456, /* GL_TEXTURE_ENV_MODE */ 1455, /* GL_TEXTURE_ENV_COLOR */ 1454, /* GL_TEXTURE_ENV */ 385, /* GL_EYE_LINEAR */ 884, /* GL_OBJECT_LINEAR */ 1264, /* GL_SPHERE_MAP */ 1458, /* GL_TEXTURE_GEN_MODE */ 886, /* GL_OBJECT_PLANE */ 386, /* GL_EYE_PLANE */ 852, /* GL_NEAREST */ 555, /* GL_LINEAR */ 856, /* GL_NEAREST_MIPMAP_NEAREST */ 560, /* GL_LINEAR_MIPMAP_NEAREST */ 855, /* GL_NEAREST_MIPMAP_LINEAR */ 559, /* GL_LINEAR_MIPMAP_LINEAR */ 1479, /* GL_TEXTURE_MAG_FILTER */ 1487, /* GL_TEXTURE_MIN_FILTER */ 1500, /* GL_TEXTURE_WRAP_S */ 1501, /* GL_TEXTURE_WRAP_T */ 107, /* GL_CLAMP */ 1146, /* GL_REPEAT */ 1010, /* GL_POLYGON_OFFSET_UNITS */ 1009, /* GL_POLYGON_OFFSET_POINT */ 1008, /* GL_POLYGON_OFFSET_LINE */ 1122, /* GL_R3_G3_B2 */ 1548, /* GL_V2F */ 1549, /* GL_V3F */ 104, /* GL_C4UB_V2F */ 105, /* GL_C4UB_V3F */ 102, /* GL_C3F_V3F */ 849, /* GL_N3F_V3F */ 103, /* GL_C4F_N3F_V3F */ 1320, /* GL_T2F_V3F */ 1322, /* GL_T4F_V4F */ 1318, /* GL_T2F_C4UB_V3F */ 1316, /* GL_T2F_C3F_V3F */ 1319, /* GL_T2F_N3F_V3F */ 1317, /* GL_T2F_C4F_N3F_V3F */ 1321, /* GL_T4F_C4F_N3F_V4F */ 120, /* GL_CLIP_PLANE0 */ 121, /* GL_CLIP_PLANE1 */ 122, /* GL_CLIP_PLANE2 */ 123, /* GL_CLIP_PLANE3 */ 124, /* GL_CLIP_PLANE4 */ 125, /* GL_CLIP_PLANE5 */ 539, /* GL_LIGHT0 */ 540, /* GL_LIGHT1 */ 541, /* GL_LIGHT2 */ 542, /* GL_LIGHT3 */ 543, /* GL_LIGHT4 */ 544, /* GL_LIGHT5 */ 545, /* GL_LIGHT6 */ 546, /* GL_LIGHT7 */ 472, /* GL_HINT_BIT */ 225, /* GL_CONSTANT_COLOR */ 896, /* GL_ONE_MINUS_CONSTANT_COLOR */ 220, /* GL_CONSTANT_ALPHA */ 894, /* GL_ONE_MINUS_CONSTANT_ALPHA */ 71, /* GL_BLEND_COLOR */ 456, /* GL_FUNC_ADD */ 785, /* GL_MIN */ 707, /* GL_MAX */ 76, /* GL_BLEND_EQUATION */ 460, /* GL_FUNC_SUBTRACT */ 458, /* GL_FUNC_REVERSE_SUBTRACT */ 228, /* GL_CONVOLUTION_1D */ 229, /* GL_CONVOLUTION_2D */ 1225, /* GL_SEPARABLE_2D */ 232, /* GL_CONVOLUTION_BORDER_MODE */ 236, /* GL_CONVOLUTION_FILTER_SCALE */ 234, /* GL_CONVOLUTION_FILTER_BIAS */ 1130, /* GL_REDUCE */ 238, /* GL_CONVOLUTION_FORMAT */ 242, /* GL_CONVOLUTION_WIDTH */ 240, /* GL_CONVOLUTION_HEIGHT */ 720, /* GL_MAX_CONVOLUTION_WIDTH */ 718, /* GL_MAX_CONVOLUTION_HEIGHT */ 1049, /* GL_POST_CONVOLUTION_RED_SCALE */ 1045, /* GL_POST_CONVOLUTION_GREEN_SCALE */ 1040, /* GL_POST_CONVOLUTION_BLUE_SCALE */ 1036, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ 1047, /* GL_POST_CONVOLUTION_RED_BIAS */ 1043, /* GL_POST_CONVOLUTION_GREEN_BIAS */ 1038, /* GL_POST_CONVOLUTION_BLUE_BIAS */ 1034, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ 473, /* GL_HISTOGRAM */ 1096, /* GL_PROXY_HISTOGRAM */ 489, /* GL_HISTOGRAM_WIDTH */ 479, /* GL_HISTOGRAM_FORMAT */ 485, /* GL_HISTOGRAM_RED_SIZE */ 481, /* GL_HISTOGRAM_GREEN_SIZE */ 476, /* GL_HISTOGRAM_BLUE_SIZE */ 474, /* GL_HISTOGRAM_ALPHA_SIZE */ 483, /* GL_HISTOGRAM_LUMINANCE_SIZE */ 487, /* GL_HISTOGRAM_SINK */ 786, /* GL_MINMAX */ 788, /* GL_MINMAX_FORMAT */ 790, /* GL_MINMAX_SINK */ 1323, /* GL_TABLE_TOO_LARGE_EXT */ 1530, /* GL_UNSIGNED_BYTE_3_3_2 */ 1539, /* GL_UNSIGNED_SHORT_4_4_4_4 */ 1541, /* GL_UNSIGNED_SHORT_5_5_5_1 */ 1535, /* GL_UNSIGNED_INT_8_8_8_8 */ 1532, /* GL_UNSIGNED_INT_10_10_10_2 */ 1007, /* GL_POLYGON_OFFSET_FILL */ 1006, /* GL_POLYGON_OFFSET_FACTOR */ 1005, /* GL_POLYGON_OFFSET_BIAS */ 1150, /* GL_RESCALE_NORMAL */ 32, /* GL_ALPHA4 */ 34, /* GL_ALPHA8 */ 28, /* GL_ALPHA12 */ 30, /* GL_ALPHA16 */ 593, /* GL_LUMINANCE4 */ 599, /* GL_LUMINANCE8 */ 583, /* GL_LUMINANCE12 */ 589, /* GL_LUMINANCE16 */ 594, /* GL_LUMINANCE4_ALPHA4 */ 597, /* GL_LUMINANCE6_ALPHA2 */ 600, /* GL_LUMINANCE8_ALPHA8 */ 586, /* GL_LUMINANCE12_ALPHA4 */ 584, /* GL_LUMINANCE12_ALPHA12 */ 590, /* GL_LUMINANCE16_ALPHA16 */ 512, /* GL_INTENSITY */ 517, /* GL_INTENSITY4 */ 519, /* GL_INTENSITY8 */ 513, /* GL_INTENSITY12 */ 515, /* GL_INTENSITY16 */ 1162, /* GL_RGB2_EXT */ 1163, /* GL_RGB4 */ 1166, /* GL_RGB5 */ 1170, /* GL_RGB8 */ 1154, /* GL_RGB10 */ 1158, /* GL_RGB12 */ 1160, /* GL_RGB16 */ 1177, /* GL_RGBA2 */ 1179, /* GL_RGBA4 */ 1167, /* GL_RGB5_A1 */ 1183, /* GL_RGBA8 */ 1155, /* GL_RGB10_A2 */ 1173, /* GL_RGBA12 */ 1175, /* GL_RGBA16 */ 1492, /* GL_TEXTURE_RED_SIZE */ 1464, /* GL_TEXTURE_GREEN_SIZE */ 1403, /* GL_TEXTURE_BLUE_SIZE */ 1392, /* GL_TEXTURE_ALPHA_SIZE */ 1477, /* GL_TEXTURE_LUMINANCE_SIZE */ 1468, /* GL_TEXTURE_INTENSITY_SIZE */ 1148, /* GL_REPLACE_EXT */ 1100, /* GL_PROXY_TEXTURE_1D */ 1102, /* GL_PROXY_TEXTURE_2D */ 1496, /* GL_TEXTURE_TOO_LARGE_EXT */ 1489, /* GL_TEXTURE_PRIORITY */ 1494, /* GL_TEXTURE_RESIDENT */ 1395, /* GL_TEXTURE_BINDING_1D */ 1396, /* GL_TEXTURE_BINDING_2D */ 1397, /* GL_TEXTURE_BINDING_3D */ 932, /* GL_PACK_SKIP_IMAGES */ 928, /* GL_PACK_IMAGE_HEIGHT */ 1524, /* GL_UNPACK_SKIP_IMAGES */ 1521, /* GL_UNPACK_IMAGE_HEIGHT */ 1391, /* GL_TEXTURE_3D */ 1104, /* GL_PROXY_TEXTURE_3D */ 1451, /* GL_TEXTURE_DEPTH */ 1499, /* GL_TEXTURE_WRAP_R */ 708, /* GL_MAX_3D_TEXTURE_SIZE */ 1552, /* GL_VERTEX_ARRAY */ 863, /* GL_NORMAL_ARRAY */ 129, /* GL_COLOR_ARRAY */ 498, /* GL_INDEX_ARRAY */ 1430, /* GL_TEXTURE_COORD_ARRAY */ 368, /* GL_EDGE_FLAG_ARRAY */ 1556, /* GL_VERTEX_ARRAY_SIZE */ 1558, /* GL_VERTEX_ARRAY_TYPE */ 1557, /* GL_VERTEX_ARRAY_STRIDE */ 868, /* GL_NORMAL_ARRAY_TYPE */ 867, /* GL_NORMAL_ARRAY_STRIDE */ 133, /* GL_COLOR_ARRAY_SIZE */ 135, /* GL_COLOR_ARRAY_TYPE */ 134, /* GL_COLOR_ARRAY_STRIDE */ 503, /* GL_INDEX_ARRAY_TYPE */ 502, /* GL_INDEX_ARRAY_STRIDE */ 1434, /* GL_TEXTURE_COORD_ARRAY_SIZE */ 1436, /* GL_TEXTURE_COORD_ARRAY_TYPE */ 1435, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ 372, /* GL_EDGE_FLAG_ARRAY_STRIDE */ 1555, /* GL_VERTEX_ARRAY_POINTER */ 866, /* GL_NORMAL_ARRAY_POINTER */ 132, /* GL_COLOR_ARRAY_POINTER */ 501, /* GL_INDEX_ARRAY_POINTER */ 1433, /* GL_TEXTURE_COORD_ARRAY_POINTER */ 371, /* GL_EDGE_FLAG_ARRAY_POINTER */ 842, /* GL_MULTISAMPLE */ 1199, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ 1201, /* GL_SAMPLE_ALPHA_TO_ONE */ 1206, /* GL_SAMPLE_COVERAGE */ 1203, /* GL_SAMPLE_BUFFERS */ 1194, /* GL_SAMPLES */ 1210, /* GL_SAMPLE_COVERAGE_VALUE */ 1208, /* GL_SAMPLE_COVERAGE_INVERT */ 160, /* GL_COLOR_MATRIX */ 162, /* GL_COLOR_MATRIX_STACK_DEPTH */ 715, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ 1032, /* GL_POST_COLOR_MATRIX_RED_SCALE */ 1028, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ 1023, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ 1019, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ 1030, /* GL_POST_COLOR_MATRIX_RED_BIAS */ 1026, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ 1021, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ 1017, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ 1413, /* GL_TEXTURE_COLOR_TABLE_SGI */ 1105, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ 1415, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ 75, /* GL_BLEND_DST_RGB */ 82, /* GL_BLEND_SRC_RGB */ 74, /* GL_BLEND_DST_ALPHA */ 81, /* GL_BLEND_SRC_ALPHA */ 166, /* GL_COLOR_TABLE */ 1042, /* GL_POST_CONVOLUTION_COLOR_TABLE */ 1025, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ 1095, /* GL_PROXY_COLOR_TABLE */ 1099, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ 1098, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ 182, /* GL_COLOR_TABLE_SCALE */ 169, /* GL_COLOR_TABLE_BIAS */ 172, /* GL_COLOR_TABLE_FORMAT */ 183, /* GL_COLOR_TABLE_WIDTH */ 180, /* GL_COLOR_TABLE_RED_SIZE */ 174, /* GL_COLOR_TABLE_GREEN_SIZE */ 170, /* GL_COLOR_TABLE_BLUE_SIZE */ 167, /* GL_COLOR_TABLE_ALPHA_SIZE */ 178, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ 176, /* GL_COLOR_TABLE_INTENSITY_SIZE */ 66, /* GL_BGR */ 67, /* GL_BGRA */ 727, /* GL_MAX_ELEMENTS_VERTICES */ 726, /* GL_MAX_ELEMENTS_INDICES */ 1467, /* GL_TEXTURE_INDEX_SIZE_EXT */ 126, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ 990, /* GL_POINT_SIZE_MIN */ 986, /* GL_POINT_SIZE_MAX */ 980, /* GL_POINT_FADE_THRESHOLD_SIZE */ 976, /* GL_POINT_DISTANCE_ATTENUATION */ 108, /* GL_CLAMP_TO_BORDER */ 111, /* GL_CLAMP_TO_EDGE */ 1488, /* GL_TEXTURE_MIN_LOD */ 1486, /* GL_TEXTURE_MAX_LOD */ 1394, /* GL_TEXTURE_BASE_LEVEL */ 1485, /* GL_TEXTURE_MAX_LEVEL */ 492, /* GL_IGNORE_BORDER_HP */ 224, /* GL_CONSTANT_BORDER_HP */ 1149, /* GL_REPLICATE_BORDER_HP */ 230, /* GL_CONVOLUTION_BORDER_COLOR */ 891, /* GL_OCCLUSION_TEST_HP */ 892, /* GL_OCCLUSION_TEST_RESULT_HP */ 557, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ 1407, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ 1409, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ 1411, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ 1412, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ 1410, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ 1408, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ 711, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ 712, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ 1052, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ 1054, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ 1051, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ 1053, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ 1475, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ 1476, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ 1474, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ 462, /* GL_GENERATE_MIPMAP */ 463, /* GL_GENERATE_MIPMAP_HINT */ 428, /* GL_FOG_OFFSET_SGIX */ 429, /* GL_FOG_OFFSET_VALUE_SGIX */ 1421, /* GL_TEXTURE_COMPARE_SGIX */ 1420, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ 1471, /* GL_TEXTURE_LEQUAL_R_SGIX */ 1463, /* GL_TEXTURE_GEQUAL_R_SGIX */ 294, /* GL_DEPTH_COMPONENT16 */ 297, /* GL_DEPTH_COMPONENT24 */ 300, /* GL_DEPTH_COMPONENT32 */ 251, /* GL_CULL_VERTEX_EXT */ 253, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ 252, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ 1603, /* GL_WRAP_BORDER_SUN */ 1414, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ 550, /* GL_LIGHT_MODEL_COLOR_CONTROL */ 1235, /* GL_SINGLE_COLOR */ 1226, /* GL_SEPARATE_SPECULAR_COLOR */ 1232, /* GL_SHARED_TEXTURE_PALETTE_EXT */ 1529, /* GL_UNSIGNED_BYTE_2_3_3_REV */ 1542, /* GL_UNSIGNED_SHORT_5_6_5 */ 1543, /* GL_UNSIGNED_SHORT_5_6_5_REV */ 1540, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ 1538, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ 1536, /* GL_UNSIGNED_INT_8_8_8_8_REV */ 1534, /* GL_UNSIGNED_INT_2_10_10_10_REV */ 1483, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ 1484, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ 1482, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ 793, /* GL_MIRRORED_REPEAT */ 1188, /* GL_RGB_S3TC */ 1165, /* GL_RGB4_S3TC */ 1187, /* GL_RGBA_S3TC */ 1182, /* GL_RGBA4_S3TC */ 1185, /* GL_RGBA_DXT5_S3TC */ 1180, /* GL_RGBA4_DXT5_S3TC */ 217, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ 212, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ 213, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ 214, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ 854, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ 853, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ 558, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ 415, /* GL_FOG_COORDINATE_SOURCE */ 407, /* GL_FOG_COORD */ 431, /* GL_FRAGMENT_DEPTH */ 257, /* GL_CURRENT_FOG_COORD */ 414, /* GL_FOG_COORDINATE_ARRAY_TYPE */ 413, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ 412, /* GL_FOG_COORDINATE_ARRAY_POINTER */ 409, /* GL_FOG_COORDINATE_ARRAY */ 164, /* GL_COLOR_SUM */ 275, /* GL_CURRENT_SECONDARY_COLOR */ 1219, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ 1221, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ 1220, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ 1218, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ 1215, /* GL_SECONDARY_COLOR_ARRAY */ 24, /* GL_ALIASED_POINT_SIZE_RANGE */ 23, /* GL_ALIASED_LINE_WIDTH_RANGE */ 1325, /* GL_TEXTURE0 */ 1327, /* GL_TEXTURE1 */ 1349, /* GL_TEXTURE2 */ 1371, /* GL_TEXTURE3 */ 1377, /* GL_TEXTURE4 */ 1379, /* GL_TEXTURE5 */ 1381, /* GL_TEXTURE6 */ 1383, /* GL_TEXTURE7 */ 1385, /* GL_TEXTURE8 */ 1387, /* GL_TEXTURE9 */ 1328, /* GL_TEXTURE10 */ 1330, /* GL_TEXTURE11 */ 1332, /* GL_TEXTURE12 */ 1334, /* GL_TEXTURE13 */ 1336, /* GL_TEXTURE14 */ 1338, /* GL_TEXTURE15 */ 1340, /* GL_TEXTURE16 */ 1342, /* GL_TEXTURE17 */ 1344, /* GL_TEXTURE18 */ 1346, /* GL_TEXTURE19 */ 1350, /* GL_TEXTURE20 */ 1352, /* GL_TEXTURE21 */ 1354, /* GL_TEXTURE22 */ 1356, /* GL_TEXTURE23 */ 1358, /* GL_TEXTURE24 */ 1360, /* GL_TEXTURE25 */ 1362, /* GL_TEXTURE26 */ 1364, /* GL_TEXTURE27 */ 1366, /* GL_TEXTURE28 */ 1368, /* GL_TEXTURE29 */ 1372, /* GL_TEXTURE30 */ 1374, /* GL_TEXTURE31 */ 16, /* GL_ACTIVE_TEXTURE */ 114, /* GL_CLIENT_ACTIVE_TEXTURE */ 775, /* GL_MAX_TEXTURE_UNITS */ 1508, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ 1511, /* GL_TRANSPOSE_PROJECTION_MATRIX */ 1513, /* GL_TRANSPOSE_TEXTURE_MATRIX */ 1505, /* GL_TRANSPOSE_COLOR_MATRIX */ 1313, /* GL_SUBTRACT */ 766, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ 200, /* GL_COMPRESSED_ALPHA */ 204, /* GL_COMPRESSED_LUMINANCE */ 205, /* GL_COMPRESSED_LUMINANCE_ALPHA */ 202, /* GL_COMPRESSED_INTENSITY */ 208, /* GL_COMPRESSED_RGB */ 209, /* GL_COMPRESSED_RGBA */ 1428, /* GL_TEXTURE_COMPRESSION_HINT */ 1490, /* GL_TEXTURE_RECTANGLE_ARB */ 1400, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ 1108, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ 764, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ 306, /* GL_DEPTH_STENCIL_NV */ 1533, /* GL_UNSIGNED_INT_24_8_NV */ 771, /* GL_MAX_TEXTURE_LOD_BIAS */ 1481, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ 772, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ 1457, /* GL_TEXTURE_FILTER_CONTROL */ 1472, /* GL_TEXTURE_LOD_BIAS */ 187, /* GL_COMBINE4 */ 767, /* GL_MAX_SHININESS_NV */ 768, /* GL_MAX_SPOT_EXPONENT_NV */ 496, /* GL_INCR_WRAP */ 282, /* GL_DECR_WRAP */ 813, /* GL_MODELVIEW1_ARB */ 869, /* GL_NORMAL_MAP */ 1135, /* GL_REFLECTION_MAP */ 1437, /* GL_TEXTURE_CUBE_MAP */ 1398, /* GL_TEXTURE_BINDING_CUBE_MAP */ 1445, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ 1439, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ 1447, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ 1441, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ 1449, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ 1443, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ 1106, /* GL_PROXY_TEXTURE_CUBE_MAP */ 722, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ 848, /* GL_MULTISAMPLE_FILTER_HINT_NV */ 423, /* GL_FOG_DISTANCE_MODE_NV */ 388, /* GL_EYE_RADIAL_NV */ 387, /* GL_EYE_PLANE_ABSOLUTE_NV */ 186, /* GL_COMBINE */ 193, /* GL_COMBINE_RGB */ 188, /* GL_COMBINE_ALPHA */ 1189, /* GL_RGB_SCALE */ 20, /* GL_ADD_SIGNED */ 522, /* GL_INTERPOLATE */ 219, /* GL_CONSTANT */ 1058, /* GL_PRIMARY_COLOR */ 1055, /* GL_PREVIOUS */ 1246, /* GL_SOURCE0_RGB */ 1252, /* GL_SOURCE1_RGB */ 1258, /* GL_SOURCE2_RGB */ 1262, /* GL_SOURCE3_RGB_NV */ 1243, /* GL_SOURCE0_ALPHA */ 1249, /* GL_SOURCE1_ALPHA */ 1255, /* GL_SOURCE2_ALPHA */ 1261, /* GL_SOURCE3_ALPHA_NV */ 905, /* GL_OPERAND0_RGB */ 911, /* GL_OPERAND1_RGB */ 917, /* GL_OPERAND2_RGB */ 921, /* GL_OPERAND3_RGB_NV */ 902, /* GL_OPERAND0_ALPHA */ 908, /* GL_OPERAND1_ALPHA */ 914, /* GL_OPERAND2_ALPHA */ 920, /* GL_OPERAND3_ALPHA_NV */ 1607, /* GL_YCBCR_422_APPLE */ 1544, /* GL_UNSIGNED_SHORT_8_8_APPLE */ 1546, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ 1237, /* GL_SLICE_ACCUM_SUN */ 1113, /* GL_QUAD_MESH_SUN */ 1517, /* GL_TRIANGLE_MESH_SUN */ 1584, /* GL_VERTEX_PROGRAM_ARB */ 1592, /* GL_VERTEX_STATE_PROGRAM_NV */ 1577, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ 1580, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ 1581, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ 1582, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ 277, /* GL_CURRENT_VERTEX_ATTRIB_ARB */ 1071, /* GL_PROGRAM_LENGTH_ARB */ 1085, /* GL_PROGRAM_STRING_ARB */ 835, /* GL_MODELVIEW_PROJECTION_NV */ 491, /* GL_IDENTITY_NV */ 532, /* GL_INVERSE_NV */ 1510, /* GL_TRANSPOSE_NV */ 533, /* GL_INVERSE_TRANSPOSE_NV */ 750, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ 749, /* GL_MAX_PROGRAM_MATRICES_ARB */ 661, /* GL_MATRIX0_NV */ 673, /* GL_MATRIX1_NV */ 685, /* GL_MATRIX2_NV */ 689, /* GL_MATRIX3_NV */ 691, /* GL_MATRIX4_NV */ 693, /* GL_MATRIX5_NV */ 695, /* GL_MATRIX6_NV */ 697, /* GL_MATRIX7_NV */ 263, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ 260, /* GL_CURRENT_MATRIX_ARB */ 1587, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ 1589, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ 1083, /* GL_PROGRAM_PARAMETER_NV */ 1579, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ 1087, /* GL_PROGRAM_TARGET_NV */ 1084, /* GL_PROGRAM_RESIDENT_NV */ 1502, /* GL_TRACK_MATRIX_NV */ 1503, /* GL_TRACK_MATRIX_TRANSFORM_NV */ 1585, /* GL_VERTEX_PROGRAM_BINDING_NV */ 1065, /* GL_PROGRAM_ERROR_POSITION_ARB */ 291, /* GL_DEPTH_CLAMP_NV */ 1559, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ 1566, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ 1567, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ 1568, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ 1569, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ 1570, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ 1571, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ 1572, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ 1573, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ 1574, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ 1560, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ 1561, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ 1562, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ 1563, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ 1564, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ 1565, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ 615, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ 622, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ 623, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ 624, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ 625, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ 626, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ 627, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ 628, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ 629, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ 630, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ 616, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ 617, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ 618, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ 619, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ 620, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ 621, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ 642, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ 649, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ 650, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ 651, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ 652, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ 653, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ 654, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ 1064, /* GL_PROGRAM_BINDING_ARB */ 656, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ 657, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ 643, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ 644, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ 645, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ 646, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ 647, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ 648, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ 1426, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ 1423, /* GL_TEXTURE_COMPRESSED */ 874, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ 218, /* GL_COMPRESSED_TEXTURE_FORMATS */ 783, /* GL_MAX_VERTEX_UNITS_ARB */ 18, /* GL_ACTIVE_VERTEX_UNITS_ARB */ 1602, /* GL_WEIGHT_SUM_UNITY_ARB */ 1583, /* GL_VERTEX_BLEND_ARB */ 278, /* GL_CURRENT_WEIGHT_ARB */ 1601, /* GL_WEIGHT_ARRAY_TYPE_ARB */ 1600, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ 1599, /* GL_WEIGHT_ARRAY_SIZE_ARB */ 1598, /* GL_WEIGHT_ARRAY_POINTER_ARB */ 1595, /* GL_WEIGHT_ARRAY_ARB */ 317, /* GL_DOT3_RGB */ 318, /* GL_DOT3_RGBA */ 216, /* GL_COMPRESSED_RGB_FXT1_3DFX */ 211, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ 843, /* GL_MULTISAMPLE_3DFX */ 1204, /* GL_SAMPLE_BUFFERS_3DFX */ 1195, /* GL_SAMPLES_3DFX */ 824, /* GL_MODELVIEW2_ARB */ 827, /* GL_MODELVIEW3_ARB */ 828, /* GL_MODELVIEW4_ARB */ 829, /* GL_MODELVIEW5_ARB */ 830, /* GL_MODELVIEW6_ARB */ 831, /* GL_MODELVIEW7_ARB */ 832, /* GL_MODELVIEW8_ARB */ 833, /* GL_MODELVIEW9_ARB */ 803, /* GL_MODELVIEW10_ARB */ 804, /* GL_MODELVIEW11_ARB */ 805, /* GL_MODELVIEW12_ARB */ 806, /* GL_MODELVIEW13_ARB */ 807, /* GL_MODELVIEW14_ARB */ 808, /* GL_MODELVIEW15_ARB */ 809, /* GL_MODELVIEW16_ARB */ 810, /* GL_MODELVIEW17_ARB */ 811, /* GL_MODELVIEW18_ARB */ 812, /* GL_MODELVIEW19_ARB */ 814, /* GL_MODELVIEW20_ARB */ 815, /* GL_MODELVIEW21_ARB */ 816, /* GL_MODELVIEW22_ARB */ 817, /* GL_MODELVIEW23_ARB */ 818, /* GL_MODELVIEW24_ARB */ 819, /* GL_MODELVIEW25_ARB */ 820, /* GL_MODELVIEW26_ARB */ 821, /* GL_MODELVIEW27_ARB */ 822, /* GL_MODELVIEW28_ARB */ 823, /* GL_MODELVIEW29_ARB */ 825, /* GL_MODELVIEW30_ARB */ 826, /* GL_MODELVIEW31_ARB */ 322, /* GL_DOT3_RGB_EXT */ 320, /* GL_DOT3_RGBA_EXT */ 797, /* GL_MIRROR_CLAMP_EXT */ 800, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ 838, /* GL_MODULATE_ADD_ATI */ 839, /* GL_MODULATE_SIGNED_ADD_ATI */ 840, /* GL_MODULATE_SUBTRACT_ATI */ 1608, /* GL_YCBCR_MESA */ 929, /* GL_PACK_INVERT_MESA */ 97, /* GL_BUFFER_SIZE */ 99, /* GL_BUFFER_USAGE */ 432, /* GL_FRAGMENT_PROGRAM_ARB */ 1062, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ 1090, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ 1089, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ 1074, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ 1080, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ 1079, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ 739, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ 762, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ 761, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ 752, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ 758, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ 757, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ 724, /* GL_MAX_DRAW_BUFFERS_ARB */ 326, /* GL_DRAW_BUFFER0_ARB */ 340, /* GL_DRAW_BUFFER1_ARB */ 342, /* GL_DRAW_BUFFER2_ARB */ 344, /* GL_DRAW_BUFFER3_ARB */ 346, /* GL_DRAW_BUFFER4_ARB */ 348, /* GL_DRAW_BUFFER5_ARB */ 350, /* GL_DRAW_BUFFER6_ARB */ 352, /* GL_DRAW_BUFFER7_ARB */ 354, /* GL_DRAW_BUFFER8_ARB */ 356, /* GL_DRAW_BUFFER9_ARB */ 328, /* GL_DRAW_BUFFER10_ARB */ 330, /* GL_DRAW_BUFFER11_ARB */ 332, /* GL_DRAW_BUFFER12_ARB */ 334, /* GL_DRAW_BUFFER13_ARB */ 336, /* GL_DRAW_BUFFER14_ARB */ 338, /* GL_DRAW_BUFFER15_ARB */ 77, /* GL_BLEND_EQUATION_ALPHA_EXT */ 706, /* GL_MATRIX_PALETTE_ARB */ 733, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ 736, /* GL_MAX_PALETTE_MATRICES_ARB */ 266, /* GL_CURRENT_PALETTE_MATRIX_ARB */ 700, /* GL_MATRIX_INDEX_ARRAY_ARB */ 261, /* GL_CURRENT_MATRIX_INDEX_ARB */ 702, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ 704, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ 703, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ 701, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ 1452, /* GL_TEXTURE_DEPTH_SIZE */ 310, /* GL_DEPTH_TEXTURE_MODE */ 1418, /* GL_TEXTURE_COMPARE_MODE */ 1416, /* GL_TEXTURE_COMPARE_FUNC */ 196, /* GL_COMPARE_R_TO_TEXTURE */ 997, /* GL_POINT_SPRITE_ARB */ 244, /* GL_COORD_REPLACE_ARB */ 1000, /* GL_POINT_SPRITE_R_MODE_NV */ 1115, /* GL_QUERY_COUNTER_BITS */ 267, /* GL_CURRENT_QUERY */ 1117, /* GL_QUERY_RESULT */ 1119, /* GL_QUERY_RESULT_AVAILABLE */ 780, /* GL_MAX_VERTEX_ATTRIBS_ARB */ 1578, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ 308, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ 307, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ 769, /* GL_MAX_TEXTURE_COORDS_ARB */ 770, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ 1067, /* GL_PROGRAM_ERROR_STRING_ARB */ 1069, /* GL_PROGRAM_FORMAT_ASCII_ARB */ 1068, /* GL_PROGRAM_FORMAT_ARB */ 1497, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ 289, /* GL_DEPTH_BOUNDS_TEST_EXT */ 288, /* GL_DEPTH_BOUNDS_EXT */ 48, /* GL_ARRAY_BUFFER */ 373, /* GL_ELEMENT_ARRAY_BUFFER */ 50, /* GL_ARRAY_BUFFER_BINDING */ 375, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ 1553, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ 864, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ 130, /* GL_COLOR_ARRAY_BUFFER_BINDING */ 499, /* GL_INDEX_ARRAY_BUFFER_BINDING */ 1431, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ 369, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ 1216, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ 410, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ 1596, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ 1575, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ 1070, /* GL_PROGRAM_INSTRUCTIONS_ARB */ 745, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ 1076, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ 754, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ 1088, /* GL_PROGRAM_TEMPORARIES_ARB */ 760, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ 1078, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ 756, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ 1082, /* GL_PROGRAM_PARAMETERS_ARB */ 759, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ 1077, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ 755, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ 1063, /* GL_PROGRAM_ATTRIBS_ARB */ 740, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ 1075, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ 753, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ 1061, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ 738, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ 1073, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ 751, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ 746, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ 742, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ 1091, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ 1507, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ 1125, /* GL_READ_ONLY */ 1604, /* GL_WRITE_ONLY */ 1127, /* GL_READ_WRITE */ 91, /* GL_BUFFER_ACCESS */ 93, /* GL_BUFFER_MAPPED */ 95, /* GL_BUFFER_MAP_POINTER */ 660, /* GL_MATRIX0_ARB */ 672, /* GL_MATRIX1_ARB */ 684, /* GL_MATRIX2_ARB */ 688, /* GL_MATRIX3_ARB */ 690, /* GL_MATRIX4_ARB */ 692, /* GL_MATRIX5_ARB */ 694, /* GL_MATRIX6_ARB */ 696, /* GL_MATRIX7_ARB */ 698, /* GL_MATRIX8_ARB */ 699, /* GL_MATRIX9_ARB */ 662, /* GL_MATRIX10_ARB */ 663, /* GL_MATRIX11_ARB */ 664, /* GL_MATRIX12_ARB */ 665, /* GL_MATRIX13_ARB */ 666, /* GL_MATRIX14_ARB */ 667, /* GL_MATRIX15_ARB */ 668, /* GL_MATRIX16_ARB */ 669, /* GL_MATRIX17_ARB */ 670, /* GL_MATRIX18_ARB */ 671, /* GL_MATRIX19_ARB */ 674, /* GL_MATRIX20_ARB */ 675, /* GL_MATRIX21_ARB */ 676, /* GL_MATRIX22_ARB */ 677, /* GL_MATRIX23_ARB */ 678, /* GL_MATRIX24_ARB */ 679, /* GL_MATRIX25_ARB */ 680, /* GL_MATRIX26_ARB */ 681, /* GL_MATRIX27_ARB */ 682, /* GL_MATRIX28_ARB */ 683, /* GL_MATRIX29_ARB */ 686, /* GL_MATRIX30_ARB */ 687, /* GL_MATRIX31_ARB */ 1308, /* GL_STREAM_DRAW */ 1310, /* GL_STREAM_READ */ 1306, /* GL_STREAM_COPY */ 1281, /* GL_STATIC_DRAW */ 1283, /* GL_STATIC_READ */ 1279, /* GL_STATIC_COPY */ 363, /* GL_DYNAMIC_DRAW */ 365, /* GL_DYNAMIC_READ */ 361, /* GL_DYNAMIC_COPY */ 970, /* GL_PIXEL_PACK_BUFFER_EXT */ 972, /* GL_PIXEL_UNPACK_BUFFER_EXT */ 969, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ 971, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ 743, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ 741, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ 744, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ 748, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ 747, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ 1302, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ 15, /* GL_ACTIVE_STENCIL_FACE_EXT */ 798, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ 1197, /* GL_SAMPLES_PASSED */ 433, /* GL_FRAGMENT_SHADER_ARB */ 1591, /* GL_VERTEX_SHADER_ARB */ 1081, /* GL_PROGRAM_OBJECT_ARB */ 1229, /* GL_SHADER_OBJECT_ARB */ 730, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ 782, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ 779, /* GL_MAX_VARYING_FLOATS_ARB */ 781, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ 717, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ 889, /* GL_OBJECT_TYPE_ARB */ 888, /* GL_OBJECT_SUBTYPE_ARB */ 401, /* GL_FLOAT_VEC2_ARB */ 402, /* GL_FLOAT_VEC3_ARB */ 403, /* GL_FLOAT_VEC4_ARB */ 525, /* GL_INT_VEC2_ARB */ 526, /* GL_INT_VEC3_ARB */ 527, /* GL_INT_VEC4_ARB */ 87, /* GL_BOOL_ARB */ 88, /* GL_BOOL_VEC2_ARB */ 89, /* GL_BOOL_VEC3_ARB */ 90, /* GL_BOOL_VEC4_ARB */ 398, /* GL_FLOAT_MAT2_ARB */ 399, /* GL_FLOAT_MAT3_ARB */ 400, /* GL_FLOAT_MAT4_ARB */ 882, /* GL_OBJECT_DELETE_STATUS_ARB */ 881, /* GL_OBJECT_COMPILE_STATUS_ARB */ 885, /* GL_OBJECT_LINK_STATUS_ARB */ 890, /* GL_OBJECT_VALIDATE_STATUS_ARB */ 883, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ 880, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ 878, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ 879, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ 887, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ 876, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ 877, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ 938, /* GL_PALETTE4_RGB8_OES */ 940, /* GL_PALETTE4_RGBA8_OES */ 936, /* GL_PALETTE4_R5_G6_B5_OES */ 939, /* GL_PALETTE4_RGBA4_OES */ 937, /* GL_PALETTE4_RGB5_A1_OES */ 943, /* GL_PALETTE8_RGB8_OES */ 945, /* GL_PALETTE8_RGBA8_OES */ 941, /* GL_PALETTE8_R5_G6_B5_OES */ 944, /* GL_PALETTE8_RGBA4_OES */ 942, /* GL_PALETTE8_RGB5_A1_OES */ 494, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ 493, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ 998, /* GL_POINT_SPRITE_COORD_ORIGIN */ 439, /* GL_FRAMEBUFFER_BINDING_EXT */ 1139, /* GL_RENDERBUFFER_BINDING_EXT */ 435, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ 434, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ 438, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ 437, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ 436, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ 440, /* GL_FRAMEBUFFER_COMPLETE_EXT */ 442, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ 447, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ 445, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ 443, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ 446, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ 444, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ 448, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ 450, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ 449, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ 714, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ 136, /* GL_COLOR_ATTACHMENT0_EXT */ 143, /* GL_COLOR_ATTACHMENT1_EXT */ 144, /* GL_COLOR_ATTACHMENT2_EXT */ 145, /* GL_COLOR_ATTACHMENT3_EXT */ 146, /* GL_COLOR_ATTACHMENT4_EXT */ 147, /* GL_COLOR_ATTACHMENT5_EXT */ 148, /* GL_COLOR_ATTACHMENT6_EXT */ 149, /* GL_COLOR_ATTACHMENT7_EXT */ 150, /* GL_COLOR_ATTACHMENT8_EXT */ 151, /* GL_COLOR_ATTACHMENT9_EXT */ 137, /* GL_COLOR_ATTACHMENT10_EXT */ 138, /* GL_COLOR_ATTACHMENT11_EXT */ 139, /* GL_COLOR_ATTACHMENT12_EXT */ 140, /* GL_COLOR_ATTACHMENT13_EXT */ 141, /* GL_COLOR_ATTACHMENT14_EXT */ 142, /* GL_COLOR_ATTACHMENT15_EXT */ 285, /* GL_DEPTH_ATTACHMENT_EXT */ 1286, /* GL_STENCIL_ATTACHMENT_EXT */ 441, /* GL_FRAMEBUFFER_EXT */ 1140, /* GL_RENDERBUFFER_EXT */ 1143, /* GL_RENDERBUFFER_WIDTH_EXT */ 1141, /* GL_RENDERBUFFER_HEIGHT_EXT */ 1142, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ 1297, /* GL_STENCIL_INDEX_EXT */ 1294, /* GL_STENCIL_INDEX1_EXT */ 1295, /* GL_STENCIL_INDEX4_EXT */ 1296, /* GL_STENCIL_INDEX8_EXT */ 1293, /* GL_STENCIL_INDEX16_EXT */ 381, /* GL_EVAL_BIT */ 1123, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ 576, /* GL_LIST_BIT */ 1402, /* GL_TEXTURE_BIT */ 1212, /* GL_SCISSOR_BIT */ 25, /* GL_ALL_ATTRIB_BITS */ 845, /* GL_MULTISAMPLE_BIT */ }; #define Elements(x) sizeof(x)/sizeof(*x) typedef int (*cfunc)(const void *, const void *); /** * Compare a key name to an element in the \c all_enums array. * * \c bsearch always passes the key as the first parameter and the pointer * to the array element as the second parameter. We can elimiate some * extra work by taking advantage of that fact. * * \param a Pointer to the desired enum name. * \param b Pointer to an element of the \c all_enums array. */ static int compar_name( const char *a, const enum_elt *b ) { return _mesa_strcmp( a, & enum_string_table[ b->offset ] ); } /** * Compare a key enum value to an element in the \c all_enums array. * * \c bsearch always passes the key as the first parameter and the pointer * to the array element as the second parameter. We can elimiate some * extra work by taking advantage of that fact. * * \param a Pointer to the desired enum name. * \param b Pointer to an index into the \c all_enums array. */ static int compar_nr( const int *a, const unsigned *b ) { return a[0] - all_enums[*b].n; } static char token_tmp[20]; const char *_mesa_lookup_enum_by_nr( int nr ) { unsigned * i; i = (unsigned *)bsearch( & nr, reduced_enums, Elements(reduced_enums), sizeof(reduced_enums[0]), (cfunc) compar_nr ); if ( i != NULL ) { return & enum_string_table[ all_enums[ *i ].offset ]; } else { /* this is not re-entrant safe, no big deal here */ _mesa_sprintf(token_tmp, "0x%x", nr); return token_tmp; } } int _mesa_lookup_enum_by_name( const char *symbol ) { enum_elt * f = NULL; if ( symbol != NULL ) { f = (enum_elt *)bsearch( symbol, all_enums, Elements(all_enums), sizeof( enum_elt ), (cfunc) compar_name ); } return (f != NULL) ? f->n : -1; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/enums.h0000644000000000000000000000325413614532424017445 0ustar /** * \file enums.h * Enumeration name/number lookup functions. * * \if subset * (No-op) * * \endif */ /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* $XFree86: xc/extras/Mesa/src/mesa/main/enums.h,v 1.2 2004/06/23 19:40:14 tsi Exp $ */ #ifndef _ENUMS_H_ #define _ENUMS_H_ #if defined(_HAVE_FULL_GL) && _HAVE_FULL_GL extern const char *_mesa_lookup_enum_by_nr( int nr ); extern int _mesa_lookup_enum_by_name( const char *symbol ); #else /** No-op */ #define _mesa_lookup_enum_by_name( s ) 0 /** No-op */ #define _mesa_lookup_enum_by_nr( n ) "unknown" #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/eval.c0000644000000000000000000006530713614532424017247 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * eval.c was written by * Bernd Barsuhn (bdbarsuh@cip.informatik.uni-erlangen.de) and * Volker Weiss (vrweiss@cip.informatik.uni-erlangen.de). * * My original implementation of evaluators was simplistic and didn't * compute surface normal vectors properly. Bernd and Volker applied * used more sophisticated methods to get better results. * * Thanks guys! */ #include "glheader.h" #include "imports.h" #include "colormac.h" #include "context.h" #include "eval.h" #include "macros.h" #include "mtypes.h" /* * Return the number of components per control point for any type of * evaluator. Return 0 if bad target. * See table 5.1 in the OpenGL 1.2 spec. */ GLuint _mesa_evaluator_components( GLenum target ) { switch (target) { case GL_MAP1_VERTEX_3: return 3; case GL_MAP1_VERTEX_4: return 4; case GL_MAP1_INDEX: return 1; case GL_MAP1_COLOR_4: return 4; case GL_MAP1_NORMAL: return 3; case GL_MAP1_TEXTURE_COORD_1: return 1; case GL_MAP1_TEXTURE_COORD_2: return 2; case GL_MAP1_TEXTURE_COORD_3: return 3; case GL_MAP1_TEXTURE_COORD_4: return 4; case GL_MAP2_VERTEX_3: return 3; case GL_MAP2_VERTEX_4: return 4; case GL_MAP2_INDEX: return 1; case GL_MAP2_COLOR_4: return 4; case GL_MAP2_NORMAL: return 3; case GL_MAP2_TEXTURE_COORD_1: return 1; case GL_MAP2_TEXTURE_COORD_2: return 2; case GL_MAP2_TEXTURE_COORD_3: return 3; case GL_MAP2_TEXTURE_COORD_4: return 4; default: break; } /* XXX need to check for the vertex program extension if (!ctx->Extensions.NV_vertex_program) return 0; */ if (target >= GL_MAP1_VERTEX_ATTRIB0_4_NV && target <= GL_MAP1_VERTEX_ATTRIB15_4_NV) return 4; if (target >= GL_MAP2_VERTEX_ATTRIB0_4_NV && target <= GL_MAP2_VERTEX_ATTRIB15_4_NV) return 4; return 0; } /* * Return pointer to the gl_1d_map struct for the named target. */ static struct gl_1d_map * get_1d_map( GLcontext *ctx, GLenum target ) { switch (target) { case GL_MAP1_VERTEX_3: return &ctx->EvalMap.Map1Vertex3; case GL_MAP1_VERTEX_4: return &ctx->EvalMap.Map1Vertex4; case GL_MAP1_INDEX: return &ctx->EvalMap.Map1Index; case GL_MAP1_COLOR_4: return &ctx->EvalMap.Map1Color4; case GL_MAP1_NORMAL: return &ctx->EvalMap.Map1Normal; case GL_MAP1_TEXTURE_COORD_1: return &ctx->EvalMap.Map1Texture1; case GL_MAP1_TEXTURE_COORD_2: return &ctx->EvalMap.Map1Texture2; case GL_MAP1_TEXTURE_COORD_3: return &ctx->EvalMap.Map1Texture3; case GL_MAP1_TEXTURE_COORD_4: return &ctx->EvalMap.Map1Texture4; case GL_MAP1_VERTEX_ATTRIB0_4_NV: case GL_MAP1_VERTEX_ATTRIB1_4_NV: case GL_MAP1_VERTEX_ATTRIB2_4_NV: case GL_MAP1_VERTEX_ATTRIB3_4_NV: case GL_MAP1_VERTEX_ATTRIB4_4_NV: case GL_MAP1_VERTEX_ATTRIB5_4_NV: case GL_MAP1_VERTEX_ATTRIB6_4_NV: case GL_MAP1_VERTEX_ATTRIB7_4_NV: case GL_MAP1_VERTEX_ATTRIB8_4_NV: case GL_MAP1_VERTEX_ATTRIB9_4_NV: case GL_MAP1_VERTEX_ATTRIB10_4_NV: case GL_MAP1_VERTEX_ATTRIB11_4_NV: case GL_MAP1_VERTEX_ATTRIB12_4_NV: case GL_MAP1_VERTEX_ATTRIB13_4_NV: case GL_MAP1_VERTEX_ATTRIB14_4_NV: case GL_MAP1_VERTEX_ATTRIB15_4_NV: if (!ctx->Extensions.NV_vertex_program) return NULL; return &ctx->EvalMap.Map1Attrib[target - GL_MAP1_VERTEX_ATTRIB0_4_NV]; default: return NULL; } } /* * Return pointer to the gl_2d_map struct for the named target. */ static struct gl_2d_map * get_2d_map( GLcontext *ctx, GLenum target ) { switch (target) { case GL_MAP2_VERTEX_3: return &ctx->EvalMap.Map2Vertex3; case GL_MAP2_VERTEX_4: return &ctx->EvalMap.Map2Vertex4; case GL_MAP2_INDEX: return &ctx->EvalMap.Map2Index; case GL_MAP2_COLOR_4: return &ctx->EvalMap.Map2Color4; case GL_MAP2_NORMAL: return &ctx->EvalMap.Map2Normal; case GL_MAP2_TEXTURE_COORD_1: return &ctx->EvalMap.Map2Texture1; case GL_MAP2_TEXTURE_COORD_2: return &ctx->EvalMap.Map2Texture2; case GL_MAP2_TEXTURE_COORD_3: return &ctx->EvalMap.Map2Texture3; case GL_MAP2_TEXTURE_COORD_4: return &ctx->EvalMap.Map2Texture4; case GL_MAP2_VERTEX_ATTRIB0_4_NV: case GL_MAP2_VERTEX_ATTRIB1_4_NV: case GL_MAP2_VERTEX_ATTRIB2_4_NV: case GL_MAP2_VERTEX_ATTRIB3_4_NV: case GL_MAP2_VERTEX_ATTRIB4_4_NV: case GL_MAP2_VERTEX_ATTRIB5_4_NV: case GL_MAP2_VERTEX_ATTRIB6_4_NV: case GL_MAP2_VERTEX_ATTRIB7_4_NV: case GL_MAP2_VERTEX_ATTRIB8_4_NV: case GL_MAP2_VERTEX_ATTRIB9_4_NV: case GL_MAP2_VERTEX_ATTRIB10_4_NV: case GL_MAP2_VERTEX_ATTRIB11_4_NV: case GL_MAP2_VERTEX_ATTRIB12_4_NV: case GL_MAP2_VERTEX_ATTRIB13_4_NV: case GL_MAP2_VERTEX_ATTRIB14_4_NV: case GL_MAP2_VERTEX_ATTRIB15_4_NV: if (!ctx->Extensions.NV_vertex_program) return NULL; return &ctx->EvalMap.Map2Attrib[target - GL_MAP2_VERTEX_ATTRIB0_4_NV]; default: return NULL; } } /**********************************************************************/ /*** Copy and deallocate control points ***/ /**********************************************************************/ /* * Copy 1-parametric evaluator control points from user-specified * memory space to a buffer of contiguous control points. * \param see glMap1f for details * \return pointer to buffer of contiguous control points or NULL if out * of memory. */ GLfloat *_mesa_copy_map_points1f( GLenum target, GLint ustride, GLint uorder, const GLfloat *points ) { GLfloat *buffer, *p; GLint i, k, size = _mesa_evaluator_components(target); if (!points || !size) return NULL; buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat)); if (buffer) for (i = 0, p = buffer; i < uorder; i++, points += ustride) for (k = 0; k < size; k++) *p++ = points[k]; return buffer; } /* * Same as above but convert doubles to floats. */ GLfloat *_mesa_copy_map_points1d( GLenum target, GLint ustride, GLint uorder, const GLdouble *points ) { GLfloat *buffer, *p; GLint i, k, size = _mesa_evaluator_components(target); if (!points || !size) return NULL; buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat)); if (buffer) for (i = 0, p = buffer; i < uorder; i++, points += ustride) for (k = 0; k < size; k++) *p++ = (GLfloat) points[k]; return buffer; } /* * Copy 2-parametric evaluator control points from user-specified * memory space to a buffer of contiguous control points. * Additional memory is allocated to be used by the horner and * de Casteljau evaluation schemes. * * \param see glMap2f for details * \return pointer to buffer of contiguous control points or NULL if out * of memory. */ GLfloat *_mesa_copy_map_points2f( GLenum target, GLint ustride, GLint uorder, GLint vstride, GLint vorder, const GLfloat *points ) { GLfloat *buffer, *p; GLint i, j, k, size, dsize, hsize; GLint uinc; size = _mesa_evaluator_components(target); if (!points || size==0) { return NULL; } /* max(uorder, vorder) additional points are used in */ /* horner evaluation and uorder*vorder additional */ /* values are needed for de Casteljau */ dsize = (uorder == 2 && vorder == 2)? 0 : uorder*vorder; hsize = (uorder > vorder ? uorder : vorder)*size; if(hsize>dsize) buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat)); else buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat)); /* compute the increment value for the u-loop */ uinc = ustride - vorder*vstride; if (buffer) for (i=0, p=buffer; i vorder ? uorder : vorder)*size; if(hsize>dsize) buffer = (GLfloat *) MALLOC((uorder*vorder*size+hsize)*sizeof(GLfloat)); else buffer = (GLfloat *) MALLOC((uorder*vorder*size+dsize)*sizeof(GLfloat)); /* compute the increment value for the u-loop */ uinc = ustride - vorder*vstride; if (buffer) for (i=0, p=buffer; i MAX_EVAL_ORDER) { _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(order)" ); return; } if (!points) { _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(points)" ); return; } k = _mesa_evaluator_components( target ); if (k == 0) { _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" ); } if (ustride < k) { _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(stride)" ); return; } if (ctx->Texture.CurrentUnit != 0) { /* See OpenGL 1.2.1 spec, section F.2.13 */ _mesa_error( ctx, GL_INVALID_OPERATION, "glMap2(ACTIVE_TEXTURE != 0)" ); return; } map = get_1d_map(ctx, target); if (!map) { _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" ); return; } /* make copy of the control points */ if (type == GL_FLOAT) pnts = _mesa_copy_map_points1f(target, ustride, uorder, (GLfloat*) points); else pnts = _mesa_copy_map_points1d(target, ustride, uorder, (GLdouble*) points); FLUSH_VERTICES(ctx, _NEW_EVAL); map->Order = uorder; map->u1 = u1; map->u2 = u2; map->du = 1.0F / (u2 - u1); if (map->Points) FREE( map->Points ); map->Points = pnts; } void GLAPIENTRY _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points ) { map1(target, u1, u2, stride, order, points, GL_FLOAT); } void GLAPIENTRY _mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points ) { map1(target, (GLfloat) u1, (GLfloat) u2, stride, order, points, GL_DOUBLE); } static void map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLvoid *points, GLenum type ) { GET_CURRENT_CONTEXT(ctx); GLint k; GLfloat *pnts; struct gl_2d_map *map = NULL; ASSERT_OUTSIDE_BEGIN_END(ctx); ASSERT(type == GL_FLOAT || type == GL_DOUBLE); if (u1==u2) { _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" ); return; } if (v1==v2) { _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(v1,v2)" ); return; } if (uorder<1 || uorder>MAX_EVAL_ORDER) { _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(uorder)" ); return; } if (vorder<1 || vorder>MAX_EVAL_ORDER) { _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vorder)" ); return; } k = _mesa_evaluator_components( target ); if (k==0) { _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" ); } if (ustride < k) { _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(ustride)" ); return; } if (vstride < k) { _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vstride)" ); return; } if (ctx->Texture.CurrentUnit != 0) { /* See OpenGL 1.2.1 spec, section F.2.13 */ _mesa_error( ctx, GL_INVALID_OPERATION, "glMap2(ACTIVE_TEXTURE != 0)" ); return; } map = get_2d_map(ctx, target); if (!map) { _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" ); return; } /* make copy of the control points */ if (type == GL_FLOAT) pnts = _mesa_copy_map_points2f(target, ustride, uorder, vstride, vorder, (GLfloat*) points); else pnts = _mesa_copy_map_points2d(target, ustride, uorder, vstride, vorder, (GLdouble*) points); FLUSH_VERTICES(ctx, _NEW_EVAL); map->Uorder = uorder; map->u1 = u1; map->u2 = u2; map->du = 1.0F / (u2 - u1); map->Vorder = vorder; map->v1 = v1; map->v2 = v2; map->dv = 1.0F / (v2 - v1); if (map->Points) FREE( map->Points ); map->Points = pnts; } void GLAPIENTRY _mesa_Map2f( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points) { map2(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points, GL_FLOAT); } void GLAPIENTRY _mesa_Map2d( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points ) { map2(target, (GLfloat) u1, (GLfloat) u2, ustride, uorder, (GLfloat) v1, (GLfloat) v2, vstride, vorder, points, GL_DOUBLE); } void GLAPIENTRY _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) { GET_CURRENT_CONTEXT(ctx); struct gl_1d_map *map1d; struct gl_2d_map *map2d; GLint i, n; GLfloat *data; GLuint comps; ASSERT_OUTSIDE_BEGIN_END(ctx); comps = _mesa_evaluator_components(target); if (!comps) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" ); return; } map1d = get_1d_map(ctx, target); map2d = get_2d_map(ctx, target); ASSERT(map1d || map2d); switch (query) { case GL_COEFF: if (map1d) { data = map1d->Points; n = map1d->Order * comps; } else { data = map2d->Points; n = map2d->Uorder * map2d->Vorder * comps; } if (data) { for (i=0;iOrder; } else { v[0] = (GLdouble) map2d->Uorder; v[1] = (GLdouble) map2d->Vorder; } break; case GL_DOMAIN: if (map1d) { v[0] = (GLdouble) map1d->u1; v[1] = (GLdouble) map1d->u2; } else { v[0] = (GLdouble) map2d->u1; v[1] = (GLdouble) map2d->u2; v[2] = (GLdouble) map2d->v1; v[3] = (GLdouble) map2d->v2; } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(query)" ); } } void GLAPIENTRY _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); struct gl_1d_map *map1d; struct gl_2d_map *map2d; GLint i, n; GLfloat *data; GLuint comps; ASSERT_OUTSIDE_BEGIN_END(ctx); comps = _mesa_evaluator_components(target); if (!comps) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" ); return; } map1d = get_1d_map(ctx, target); map2d = get_2d_map(ctx, target); ASSERT(map1d || map2d); switch (query) { case GL_COEFF: if (map1d) { data = map1d->Points; n = map1d->Order * comps; } else { data = map2d->Points; n = map2d->Uorder * map2d->Vorder * comps; } if (data) { for (i=0;iOrder; } else { v[0] = (GLfloat) map2d->Uorder; v[1] = (GLfloat) map2d->Vorder; } break; case GL_DOMAIN: if (map1d) { v[0] = map1d->u1; v[1] = map1d->u2; } else { v[0] = map2d->u1; v[1] = map2d->u2; v[2] = map2d->v1; v[3] = map2d->v2; } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(query)" ); } } void GLAPIENTRY _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) { GET_CURRENT_CONTEXT(ctx); struct gl_1d_map *map1d; struct gl_2d_map *map2d; GLuint i, n; GLfloat *data; GLuint comps; ASSERT_OUTSIDE_BEGIN_END(ctx); comps = _mesa_evaluator_components(target); if (!comps) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" ); return; } map1d = get_1d_map(ctx, target); map2d = get_2d_map(ctx, target); ASSERT(map1d || map2d); switch (query) { case GL_COEFF: if (map1d) { data = map1d->Points; n = map1d->Order * comps; } else { data = map2d->Points; n = map2d->Uorder * map2d->Vorder * comps; } if (data) { for (i=0;iOrder; } else { v[0] = map2d->Uorder; v[1] = map2d->Vorder; } break; case GL_DOMAIN: if (map1d) { v[0] = IROUND(map1d->u1); v[1] = IROUND(map1d->u2); } else { v[0] = IROUND(map2d->u1); v[1] = IROUND(map2d->u2); v[2] = IROUND(map2d->v1); v[3] = IROUND(map2d->v2); } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(query)" ); } } void GLAPIENTRY _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (un<1) { _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" ); return; } FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.MapGrid1un = un; ctx->Eval.MapGrid1u1 = u1; ctx->Eval.MapGrid1u2 = u2; ctx->Eval.MapGrid1du = (u2 - u1) / (GLfloat) un; } void GLAPIENTRY _mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ) { _mesa_MapGrid1f( un, (GLfloat) u1, (GLfloat) u2 ); } void GLAPIENTRY _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (un<1) { _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" ); return; } if (vn<1) { _mesa_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(vn)" ); return; } FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.MapGrid2un = un; ctx->Eval.MapGrid2u1 = u1; ctx->Eval.MapGrid2u2 = u2; ctx->Eval.MapGrid2du = (u2 - u1) / (GLfloat) un; ctx->Eval.MapGrid2vn = vn; ctx->Eval.MapGrid2v1 = v1; ctx->Eval.MapGrid2v2 = v2; ctx->Eval.MapGrid2dv = (v2 - v1) / (GLfloat) vn; } void GLAPIENTRY _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ) { _mesa_MapGrid2f( un, (GLfloat) u1, (GLfloat) u2, vn, (GLfloat) v1, (GLfloat) v2 ); } /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ /** * Initialize a 1-D evaluator map. */ static void init_1d_map( struct gl_1d_map *map, int n, const float *initial ) { map->Order = 1; map->u1 = 0.0; map->u2 = 1.0; map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat)); if (map->Points) { GLint i; for (i=0;iPoints[i] = initial[i]; } } /** * Initialize a 2-D evaluator map */ static void init_2d_map( struct gl_2d_map *map, int n, const float *initial ) { map->Uorder = 1; map->Vorder = 1; map->u1 = 0.0; map->u2 = 1.0; map->v1 = 0.0; map->v2 = 1.0; map->Points = (GLfloat *) MALLOC(n * sizeof(GLfloat)); if (map->Points) { GLint i; for (i=0;iPoints[i] = initial[i]; } } void _mesa_init_eval( GLcontext *ctx ) { int i; /* Evaluators group */ ctx->Eval.Map1Color4 = GL_FALSE; ctx->Eval.Map1Index = GL_FALSE; ctx->Eval.Map1Normal = GL_FALSE; ctx->Eval.Map1TextureCoord1 = GL_FALSE; ctx->Eval.Map1TextureCoord2 = GL_FALSE; ctx->Eval.Map1TextureCoord3 = GL_FALSE; ctx->Eval.Map1TextureCoord4 = GL_FALSE; ctx->Eval.Map1Vertex3 = GL_FALSE; ctx->Eval.Map1Vertex4 = GL_FALSE; MEMSET(ctx->Eval.Map1Attrib, 0, sizeof(ctx->Eval.Map1Attrib)); ctx->Eval.Map2Color4 = GL_FALSE; ctx->Eval.Map2Index = GL_FALSE; ctx->Eval.Map2Normal = GL_FALSE; ctx->Eval.Map2TextureCoord1 = GL_FALSE; ctx->Eval.Map2TextureCoord2 = GL_FALSE; ctx->Eval.Map2TextureCoord3 = GL_FALSE; ctx->Eval.Map2TextureCoord4 = GL_FALSE; ctx->Eval.Map2Vertex3 = GL_FALSE; ctx->Eval.Map2Vertex4 = GL_FALSE; MEMSET(ctx->Eval.Map2Attrib, 0, sizeof(ctx->Eval.Map2Attrib)); ctx->Eval.AutoNormal = GL_FALSE; ctx->Eval.MapGrid1un = 1; ctx->Eval.MapGrid1u1 = 0.0; ctx->Eval.MapGrid1u2 = 1.0; ctx->Eval.MapGrid2un = 1; ctx->Eval.MapGrid2vn = 1; ctx->Eval.MapGrid2u1 = 0.0; ctx->Eval.MapGrid2u2 = 1.0; ctx->Eval.MapGrid2v1 = 0.0; ctx->Eval.MapGrid2v2 = 1.0; /* Evaluator data */ { static GLfloat vertex[4] = { 0.0, 0.0, 0.0, 1.0 }; static GLfloat normal[3] = { 0.0, 0.0, 1.0 }; static GLfloat index[1] = { 1.0 }; static GLfloat color[4] = { 1.0, 1.0, 1.0, 1.0 }; static GLfloat texcoord[4] = { 0.0, 0.0, 0.0, 1.0 }; static GLfloat attrib[4] = { 0.0, 0.0, 0.0, 1.0 }; init_1d_map( &ctx->EvalMap.Map1Vertex3, 3, vertex ); init_1d_map( &ctx->EvalMap.Map1Vertex4, 4, vertex ); init_1d_map( &ctx->EvalMap.Map1Index, 1, index ); init_1d_map( &ctx->EvalMap.Map1Color4, 4, color ); init_1d_map( &ctx->EvalMap.Map1Normal, 3, normal ); init_1d_map( &ctx->EvalMap.Map1Texture1, 1, texcoord ); init_1d_map( &ctx->EvalMap.Map1Texture2, 2, texcoord ); init_1d_map( &ctx->EvalMap.Map1Texture3, 3, texcoord ); init_1d_map( &ctx->EvalMap.Map1Texture4, 4, texcoord ); for (i = 0; i < 16; i++) init_1d_map( ctx->EvalMap.Map1Attrib + i, 4, attrib ); init_2d_map( &ctx->EvalMap.Map2Vertex3, 3, vertex ); init_2d_map( &ctx->EvalMap.Map2Vertex4, 4, vertex ); init_2d_map( &ctx->EvalMap.Map2Index, 1, index ); init_2d_map( &ctx->EvalMap.Map2Color4, 4, color ); init_2d_map( &ctx->EvalMap.Map2Normal, 3, normal ); init_2d_map( &ctx->EvalMap.Map2Texture1, 1, texcoord ); init_2d_map( &ctx->EvalMap.Map2Texture2, 2, texcoord ); init_2d_map( &ctx->EvalMap.Map2Texture3, 3, texcoord ); init_2d_map( &ctx->EvalMap.Map2Texture4, 4, texcoord ); for (i = 0; i < 16; i++) init_2d_map( ctx->EvalMap.Map2Attrib + i, 4, attrib ); } } void _mesa_free_eval_data( GLcontext *ctx ) { int i; /* Free evaluator data */ if (ctx->EvalMap.Map1Vertex3.Points) FREE( ctx->EvalMap.Map1Vertex3.Points ); if (ctx->EvalMap.Map1Vertex4.Points) FREE( ctx->EvalMap.Map1Vertex4.Points ); if (ctx->EvalMap.Map1Index.Points) FREE( ctx->EvalMap.Map1Index.Points ); if (ctx->EvalMap.Map1Color4.Points) FREE( ctx->EvalMap.Map1Color4.Points ); if (ctx->EvalMap.Map1Normal.Points) FREE( ctx->EvalMap.Map1Normal.Points ); if (ctx->EvalMap.Map1Texture1.Points) FREE( ctx->EvalMap.Map1Texture1.Points ); if (ctx->EvalMap.Map1Texture2.Points) FREE( ctx->EvalMap.Map1Texture2.Points ); if (ctx->EvalMap.Map1Texture3.Points) FREE( ctx->EvalMap.Map1Texture3.Points ); if (ctx->EvalMap.Map1Texture4.Points) FREE( ctx->EvalMap.Map1Texture4.Points ); for (i = 0; i < 16; i++) FREE((ctx->EvalMap.Map1Attrib[i].Points)); if (ctx->EvalMap.Map2Vertex3.Points) FREE( ctx->EvalMap.Map2Vertex3.Points ); if (ctx->EvalMap.Map2Vertex4.Points) FREE( ctx->EvalMap.Map2Vertex4.Points ); if (ctx->EvalMap.Map2Index.Points) FREE( ctx->EvalMap.Map2Index.Points ); if (ctx->EvalMap.Map2Color4.Points) FREE( ctx->EvalMap.Map2Color4.Points ); if (ctx->EvalMap.Map2Normal.Points) FREE( ctx->EvalMap.Map2Normal.Points ); if (ctx->EvalMap.Map2Texture1.Points) FREE( ctx->EvalMap.Map2Texture1.Points ); if (ctx->EvalMap.Map2Texture2.Points) FREE( ctx->EvalMap.Map2Texture2.Points ); if (ctx->EvalMap.Map2Texture3.Points) FREE( ctx->EvalMap.Map2Texture3.Points ); if (ctx->EvalMap.Map2Texture4.Points) FREE( ctx->EvalMap.Map2Texture4.Points ); for (i = 0; i < 16; i++) FREE((ctx->EvalMap.Map2Attrib[i].Points)); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/eval.h0000644000000000000000000000767313614532424017256 0ustar /** * \file eval.h * Eval operations. * * \if subset * (No-op) * * \endif */ /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef EVAL_H #define EVAL_H #include "mtypes.h" #if _HAVE_FULL_GL extern void _mesa_init_eval( GLcontext *ctx ); extern void _mesa_free_eval_data( GLcontext *ctx ); extern GLuint _mesa_evaluator_components( GLenum target ); extern void gl_free_control_points( GLcontext *ctx, GLenum target, GLfloat *data ); extern GLfloat *_mesa_copy_map_points1f( GLenum target, GLint ustride, GLint uorder, const GLfloat *points ); extern GLfloat *_mesa_copy_map_points1d( GLenum target, GLint ustride, GLint uorder, const GLdouble *points ); extern GLfloat *_mesa_copy_map_points2f( GLenum target, GLint ustride, GLint uorder, GLint vstride, GLint vorder, const GLfloat *points ); extern GLfloat *_mesa_copy_map_points2d(GLenum target, GLint ustride, GLint uorder, GLint vstride, GLint vorder, const GLdouble *points ); extern void GLAPIENTRY _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points ); extern void GLAPIENTRY _mesa_Map2f( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points ); extern void GLAPIENTRY _mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points ); extern void GLAPIENTRY _mesa_Map2d( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points ); extern void GLAPIENTRY _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); extern void GLAPIENTRY _mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); extern void GLAPIENTRY _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ); extern void GLAPIENTRY _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ); extern void GLAPIENTRY _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ); extern void GLAPIENTRY _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ); extern void GLAPIENTRY _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ); #else /** No-op */ #define _mesa_init_eval( c ) ((void)0) /** No-op */ #define _mesa_free_eval_data( c ) ((void)0) #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/execmem.c0000644000000000000000000000540113614532424017730 0ustar /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file exemem.c * Functions for allocating executable memory. * * \author Keith Whitwell */ #include "imports.h" #include "glthread.h" #if defined(__linux__) && !defined(XFree86Server) /* * Allocate a large block of memory which can hold code then dole it out * in pieces by means of the generic memory manager code. */ #include #include #include "mm.h" #define EXEC_HEAP_SIZE (128*1024) _glthread_DECLARE_STATIC_MUTEX(exec_mutex); static memHeap_t *exec_heap = NULL; static unsigned char *exec_mem = NULL; static void init_heap(void) { if (!exec_heap) exec_heap = mmInit( 0, EXEC_HEAP_SIZE ); if (!exec_mem) exec_mem = (unsigned char *) mmap(0, EXEC_HEAP_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); } void * _mesa_exec_malloc(GLuint size) { PMemBlock block = NULL; void *addr = NULL; _glthread_LOCK_MUTEX(exec_mutex); init_heap(); if (exec_heap) { size = (size + 31) & ~31; block = mmAllocMem( exec_heap, size, 32, 0 ); } if (block) addr = exec_mem + block->ofs; _glthread_UNLOCK_MUTEX(exec_mutex); return addr; } void _mesa_exec_free(void *addr) { _glthread_LOCK_MUTEX(exec_mutex); if (exec_heap) { PMemBlock block = mmFindBlock(exec_heap, (unsigned char *)addr - exec_mem); if (block) mmFreeMem(block); } _glthread_UNLOCK_MUTEX(exec_mutex); } #else /* * Just use regular memory. */ void * _mesa_exec_malloc(GLuint size) { return _mesa_malloc( size ); } void _mesa_exec_free(void *addr) { _mesa_free(addr); } #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/extensions.c0000644000000000000000000005176313614532424020520 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "imports.h" #include "context.h" #include "extensions.h" #include "simple_list.h" #include "mtypes.h" #define F(x) (int)(uintptr_t)&(((struct gl_extensions *)0)->x) #define ON GL_TRUE #define OFF GL_FALSE /* * Note: The GL_MESAX_* extensions are placeholders for future ARB extensions. */ static const struct { GLboolean enabled; const char *name; int flag_offset; } default_extensions[] = { { OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) }, { OFF, "GL_ARB_draw_buffers", F(ARB_draw_buffers) }, { OFF, "GL_ARB_fragment_program", F(ARB_fragment_program) }, { OFF, "GL_ARB_fragment_shader", F(ARB_fragment_shader) }, { OFF, "GL_MESAX_half_float_pixel", F(ARB_half_float_pixel) }, { OFF, "GL_ARB_imaging", F(ARB_imaging) }, { OFF, "GL_ARB_multisample", F(ARB_multisample) }, { OFF, "GL_ARB_multitexture", F(ARB_multitexture) }, { OFF, "GL_ARB_occlusion_query", F(ARB_occlusion_query) }, { OFF, "GL_ARB_pixel_buffer_object", F(EXT_pixel_buffer_object) }, { OFF, "GL_ARB_point_parameters", F(EXT_point_parameters) }, { OFF, "GL_ARB_point_sprite", F(ARB_point_sprite) }, { OFF, "GL_ARB_shader_objects", F(ARB_shader_objects) }, { OFF, "GL_ARB_shading_language_100", F(ARB_shading_language_100) }, { OFF, "GL_ARB_shadow", F(ARB_shadow) }, { OFF, "GL_ARB_shadow_ambient", F(SGIX_shadow_ambient) }, { OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) }, { OFF, "GL_ARB_texture_compression", F(ARB_texture_compression) }, { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) }, { OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) }, { OFF, "GL_ARB_texture_env_combine", F(ARB_texture_env_combine) }, { OFF, "GL_ARB_texture_env_crossbar", F(ARB_texture_env_crossbar) }, { OFF, "GL_ARB_texture_env_dot3", F(ARB_texture_env_dot3) }, { OFF, "GL_MESAX_texture_float", F(ARB_texture_float) }, { OFF, "GL_ARB_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, { OFF, "GL_ARB_texture_non_power_of_two", F(ARB_texture_non_power_of_two)}, { OFF, "GL_ARB_texture_rectangle", F(NV_texture_rectangle) }, { ON, "GL_ARB_transpose_matrix", F(ARB_transpose_matrix) }, { OFF, "GL_ARB_vertex_buffer_object", F(ARB_vertex_buffer_object) }, { OFF, "GL_ARB_vertex_program", F(ARB_vertex_program) }, { OFF, "GL_ARB_vertex_shader", F(ARB_vertex_shader) }, { ON, "GL_ARB_window_pos", F(ARB_window_pos) }, { ON, "GL_EXT_abgr", F(EXT_abgr) }, { ON, "GL_EXT_bgra", F(EXT_bgra) }, { OFF, "GL_EXT_blend_color", F(EXT_blend_color) }, { OFF, "GL_EXT_blend_equation_separate", F(EXT_blend_equation_separate) }, { OFF, "GL_EXT_blend_func_separate", F(EXT_blend_func_separate) }, { OFF, "GL_EXT_blend_logic_op", F(EXT_blend_logic_op) }, { OFF, "GL_EXT_blend_minmax", F(EXT_blend_minmax) }, { OFF, "GL_EXT_blend_subtract", F(EXT_blend_subtract) }, { ON, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) }, { OFF, "GL_EXT_cull_vertex", F(EXT_cull_vertex) }, { ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) }, { OFF, "GL_EXT_convolution", F(EXT_convolution) }, { ON, "GL_EXT_copy_texture", F(EXT_copy_texture) }, { OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) }, { ON, "GL_EXT_draw_range_elements", F(EXT_draw_range_elements) }, { OFF, "GL_EXT_framebuffer_object", F(EXT_framebuffer_object) }, { OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) }, { OFF, "GL_EXT_histogram", F(EXT_histogram) }, { OFF, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) }, { ON, "GL_EXT_packed_pixels", F(EXT_packed_pixels) }, { OFF, "GL_EXT_paletted_texture", F(EXT_paletted_texture) }, { OFF, "GL_EXT_pixel_buffer_object", F(EXT_pixel_buffer_object) }, { OFF, "GL_EXT_point_parameters", F(EXT_point_parameters) }, { ON, "GL_EXT_polygon_offset", F(EXT_polygon_offset) }, { ON, "GL_EXT_rescale_normal", F(EXT_rescale_normal) }, { OFF, "GL_EXT_secondary_color", F(EXT_secondary_color) }, { ON, "GL_EXT_separate_specular_color", F(EXT_separate_specular_color) }, { OFF, "GL_EXT_shadow_funcs", F(EXT_shadow_funcs) }, { OFF, "GL_EXT_shared_texture_palette", F(EXT_shared_texture_palette) }, { OFF, "GL_EXT_stencil_two_side", F(EXT_stencil_two_side) }, { OFF, "GL_EXT_stencil_wrap", F(EXT_stencil_wrap) }, { ON, "GL_EXT_subtexture", F(EXT_subtexture) }, { ON, "GL_EXT_texture", F(EXT_texture) }, { ON, "GL_EXT_texture3D", F(EXT_texture3D) }, { OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) }, { ON, "GL_EXT_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, { OFF, "GL_EXT_texture_env_add", F(EXT_texture_env_add) }, { OFF, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine) }, { OFF, "GL_EXT_texture_env_dot3", F(EXT_texture_env_dot3) }, { OFF, "GL_EXT_texture_filter_anisotropic", F(EXT_texture_filter_anisotropic) }, { OFF, "GL_EXT_texture_lod_bias", F(EXT_texture_lod_bias) }, { OFF, "GL_EXT_texture_mirror_clamp", F(EXT_texture_mirror_clamp) }, { ON, "GL_EXT_texture_object", F(EXT_texture_object) }, { OFF, "GL_EXT_texture_rectangle", F(NV_texture_rectangle) }, { ON, "GL_EXT_vertex_array", F(EXT_vertex_array) }, { OFF, "GL_EXT_vertex_array_set", F(EXT_vertex_array_set) }, { OFF, "GL_3DFX_texture_compression_FXT1", F(TDFX_texture_compression_FXT1) }, { OFF, "GL_APPLE_client_storage", F(APPLE_client_storage) }, { ON, "GL_APPLE_packed_pixels", F(APPLE_packed_pixels) }, { OFF, "GL_ATI_blend_equation_separate", F(EXT_blend_equation_separate) }, { OFF, "GL_ATI_texture_env_combine3", F(ATI_texture_env_combine3)}, { OFF, "GL_ATI_texture_mirror_once", F(ATI_texture_mirror_once)}, { OFF, "GL_ATI_fragment_shader", F(ATI_fragment_shader)}, { OFF, "GL_HP_occlusion_test", F(HP_occlusion_test) }, { OFF, "GL_IBM_multimode_draw_arrays", F(IBM_multimode_draw_arrays) }, { ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) }, { OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, { OFF, "GL_INGR_blend_func_separate", F(EXT_blend_func_separate) }, { OFF, "GL_MESA_pack_invert", F(MESA_pack_invert) }, { OFF, "GL_MESA_packed_depth_stencil", F(MESA_packed_depth_stencil) }, { OFF, "GL_MESA_program_debug", F(MESA_program_debug) }, { OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) }, { OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) }, { ON, "GL_MESA_window_pos", F(ARB_window_pos) }, { OFF, "GL_NV_blend_square", F(NV_blend_square) }, { OFF, "GL_NV_fragment_program", F(NV_fragment_program) }, { ON, "GL_NV_light_max_exponent", F(NV_light_max_exponent) }, { OFF, "GL_NV_point_sprite", F(NV_point_sprite) }, { OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) }, { ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) }, { OFF, "GL_NV_vertex_program", F(NV_vertex_program) }, { OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) }, { ON, "GL_OES_read_format", F(OES_read_format) }, { OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) }, { OFF, "GL_SGI_color_table", F(SGI_color_table) }, { OFF, "GL_SGI_texture_color_table", F(SGI_texture_color_table) }, { OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) }, { OFF, "GL_SGIS_pixel_texture", F(SGIS_pixel_texture) }, { OFF, "GL_SGIS_texture_border_clamp", F(ARB_texture_border_clamp) }, { ON, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, { ON, "GL_SGIS_texture_lod", F(SGIS_texture_lod) }, { OFF, "GL_SGIX_depth_texture", F(SGIX_depth_texture) }, { OFF, "GL_SGIX_pixel_texture", F(SGIX_pixel_texture) }, { OFF, "GL_SGIX_shadow", F(SGIX_shadow) }, { OFF, "GL_SGIX_shadow_ambient", F(SGIX_shadow_ambient) }, { OFF, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) }, { OFF, "GL_S3_s3tc", F(S3_s3tc) }, }; /** * Enable all extensions suitable for a software-only renderer. * This is a convenience function used by the XMesa, OSMesa, GGI drivers, etc. */ void _mesa_enable_sw_extensions(GLcontext *ctx) { ctx->Extensions.ARB_depth_texture = GL_TRUE; ctx->Extensions.ARB_draw_buffers = GL_TRUE; #if FEATURE_ARB_fragment_program ctx->Extensions.ARB_fragment_program = GL_TRUE; #endif #if 0 && FEATURE_ARB_fragment_shader ctx->Extensions.ARB_fragment_shader = GL_TRUE; #endif /*ctx->Extensions.ARB_half_float_pixel = GL_TRUE;*/ ctx->Extensions.ARB_imaging = GL_TRUE; ctx->Extensions.ARB_multitexture = GL_TRUE; #if FEATURE_ARB_occlusion_query ctx->Extensions.ARB_occlusion_query = GL_TRUE; #endif ctx->Extensions.ARB_point_sprite = GL_TRUE; #if 0 && FEATURE_ARB_shader_objects ctx->Extensions.ARB_shader_objects = GL_TRUE; #endif #if 0 && FEATURE_ARB_shading_language_100 ctx->Extensions.ARB_shading_language_100 = GL_TRUE; #endif ctx->Extensions.ARB_shadow = GL_TRUE; ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; ctx->Extensions.ARB_texture_cube_map = GL_TRUE; ctx->Extensions.ARB_texture_env_combine = GL_TRUE; ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE; ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE; /*ctx->Extensions.ARB_texture_float = GL_TRUE;*/ ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE; ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; #if FEATURE_ARB_vertex_program ctx->Extensions.ARB_vertex_program = GL_TRUE; #endif #if 0 && FEATURE_ARB_vertex_shader ctx->Extensions.ARB_vertex_shader = GL_TRUE; #endif #if FEATURE_ARB_vertex_buffer_object ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE; #endif #if FEATURE_ATI_fragment_shader ctx->Extensions.ATI_fragment_shader = GL_TRUE; #endif ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE; ctx->Extensions.ATI_texture_mirror_once = GL_TRUE; ctx->Extensions.EXT_blend_color = GL_TRUE; ctx->Extensions.EXT_blend_equation_separate = GL_TRUE; ctx->Extensions.EXT_blend_func_separate = GL_TRUE; ctx->Extensions.EXT_blend_logic_op = GL_TRUE; ctx->Extensions.EXT_blend_minmax = GL_TRUE; ctx->Extensions.EXT_blend_subtract = GL_TRUE; ctx->Extensions.EXT_convolution = GL_TRUE; ctx->Extensions.EXT_depth_bounds_test = GL_TRUE; ctx->Extensions.EXT_fog_coord = GL_TRUE; #if FEATURE_EXT_framebuffer_object ctx->Extensions.EXT_framebuffer_object = GL_TRUE; #endif ctx->Extensions.EXT_histogram = GL_TRUE; ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE; ctx->Extensions.EXT_paletted_texture = GL_TRUE; #if FEATURE_EXT_pixel_buffer_object ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE; #endif ctx->Extensions.EXT_point_parameters = GL_TRUE; ctx->Extensions.EXT_shadow_funcs = GL_TRUE; ctx->Extensions.EXT_secondary_color = GL_TRUE; ctx->Extensions.EXT_shared_texture_palette = GL_TRUE; ctx->Extensions.EXT_stencil_wrap = GL_TRUE; ctx->Extensions.EXT_stencil_two_side = GL_TRUE; ctx->Extensions.EXT_texture_env_add = GL_TRUE; ctx->Extensions.EXT_texture_env_combine = GL_TRUE; ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE; ctx->Extensions.EXT_texture_mirror_clamp = GL_TRUE; ctx->Extensions.EXT_texture_lod_bias = GL_TRUE; ctx->Extensions.HP_occlusion_test = GL_TRUE; ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE; ctx->Extensions.MESA_pack_invert = GL_TRUE; #if FEATURE_MESA_program_debug ctx->Extensions.MESA_program_debug = GL_TRUE; #endif ctx->Extensions.MESA_resize_buffers = GL_TRUE; ctx->Extensions.MESA_ycbcr_texture = GL_TRUE; ctx->Extensions.NV_blend_square = GL_TRUE; /*ctx->Extensions.NV_light_max_exponent = GL_TRUE;*/ ctx->Extensions.NV_point_sprite = GL_TRUE; ctx->Extensions.NV_texture_rectangle = GL_TRUE; /*ctx->Extensions.NV_texgen_reflection = GL_TRUE;*/ #if FEATURE_NV_vertex_program ctx->Extensions.NV_vertex_program = GL_TRUE; ctx->Extensions.NV_vertex_program1_1 = GL_TRUE; #endif #if FEATURE_NV_fragment_program ctx->Extensions.NV_fragment_program = GL_TRUE; #endif ctx->Extensions.SGI_color_matrix = GL_TRUE; ctx->Extensions.SGI_color_table = GL_TRUE; ctx->Extensions.SGI_texture_color_table = GL_TRUE; ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; ctx->Extensions.SGIS_pixel_texture = GL_TRUE; ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE; ctx->Extensions.SGIX_depth_texture = GL_TRUE; ctx->Extensions.SGIX_pixel_texture = GL_TRUE; ctx->Extensions.SGIX_shadow = GL_TRUE; ctx->Extensions.SGIX_shadow_ambient = GL_TRUE; } /** * Enable GL_ARB_imaging and all the EXT extensions that are subsets of it. */ void _mesa_enable_imaging_extensions(GLcontext *ctx) { ctx->Extensions.ARB_imaging = GL_TRUE; ctx->Extensions.EXT_blend_color = GL_TRUE; ctx->Extensions.EXT_blend_minmax = GL_TRUE; ctx->Extensions.EXT_blend_subtract = GL_TRUE; ctx->Extensions.EXT_convolution = GL_TRUE; ctx->Extensions.EXT_histogram = GL_TRUE; ctx->Extensions.SGI_color_matrix = GL_TRUE; ctx->Extensions.SGI_color_table = GL_TRUE; } /** * Enable all OpenGL 1.3 features and extensions. * A convenience function to be called by drivers. */ void _mesa_enable_1_3_extensions(GLcontext *ctx) { ctx->Extensions.ARB_multisample = GL_TRUE; ctx->Extensions.ARB_multitexture = GL_TRUE; ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; ctx->Extensions.ARB_texture_compression = GL_TRUE; ctx->Extensions.ARB_texture_cube_map = GL_TRUE; ctx->Extensions.ARB_texture_env_combine = GL_TRUE; ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE; ctx->Extensions.EXT_texture_env_add = GL_TRUE; /*ctx->Extensions.ARB_transpose_matrix = GL_TRUE;*/ } /** * Enable all OpenGL 1.4 features and extensions. * A convenience function to be called by drivers. */ void _mesa_enable_1_4_extensions(GLcontext *ctx) { ctx->Extensions.ARB_depth_texture = GL_TRUE; ctx->Extensions.ARB_shadow = GL_TRUE; ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE; ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE; ctx->Extensions.ARB_window_pos = GL_TRUE; ctx->Extensions.EXT_blend_color = GL_TRUE; ctx->Extensions.EXT_blend_func_separate = GL_TRUE; ctx->Extensions.EXT_blend_logic_op = GL_TRUE; ctx->Extensions.EXT_blend_minmax = GL_TRUE; ctx->Extensions.EXT_blend_subtract = GL_TRUE; ctx->Extensions.EXT_fog_coord = GL_TRUE; ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE; ctx->Extensions.EXT_point_parameters = GL_TRUE; ctx->Extensions.EXT_secondary_color = GL_TRUE; ctx->Extensions.EXT_stencil_wrap = GL_TRUE; ctx->Extensions.EXT_texture_lod_bias = GL_TRUE; ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; } /** * Enable all OpenGL 1.5 features and extensions. * A convenience function to be called by drivers. */ void _mesa_enable_1_5_extensions(GLcontext *ctx) { ctx->Extensions.ARB_occlusion_query = GL_TRUE; ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE; ctx->Extensions.EXT_shadow_funcs = GL_TRUE; } /** * Enable all OpenGL 2.0 features and extensions. * A convenience function to be called by drivers. */ void _mesa_enable_2_0_extensions(GLcontext *ctx) { ctx->Extensions.ARB_draw_buffers = GL_TRUE; #if 0 && FEATURE_ARB_fragment_shader ctx->Extensions.ARB_fragment_shader = GL_TRUE; #endif ctx->Extensions.ARB_point_sprite = GL_TRUE; ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; #if 0 && FEATURE_ARB_shader_objects ctx->Extensions.ARB_shader_objects = GL_TRUE; #endif #if 0 && FEATURE_ARB_shading_language_100 ctx->Extensions.ARB_shading_language_100 = GL_TRUE; #endif ctx->Extensions.EXT_stencil_two_side = GL_TRUE; #if 0 && FEATURE_ARB_vertex_shader ctx->Extensions.ARB_vertex_shader = GL_TRUE; #endif } /** * Either enable or disable the named extension. */ static void set_extension( GLcontext *ctx, const char *name, GLboolean state ) { GLboolean *base = (GLboolean *) &ctx->Extensions; GLuint i; if (ctx->Extensions.String) { /* The string was already queried - can't change it now! */ _mesa_problem(ctx, "Trying to enable/disable extension after glGetString(GL_EXTENSIONS): %s", name); return; } for (i = 0 ; i < Elements(default_extensions) ; i++) { if (_mesa_strcmp(default_extensions[i].name, name) == 0) { if (default_extensions[i].flag_offset) { GLboolean *enabled = base + default_extensions[i].flag_offset; *enabled = state; } return; } } _mesa_problem(ctx, "Trying to enable unknown extension: %s", name); } /** * Enable the named extension. * Typically called by drivers. */ void _mesa_enable_extension( GLcontext *ctx, const char *name ) { set_extension(ctx, name, GL_TRUE); } /** * Disable the named extension. * XXX is this really needed??? */ void _mesa_disable_extension( GLcontext *ctx, const char *name ) { set_extension(ctx, name, GL_FALSE); } /** * Test if the named extension is enabled in this context. */ GLboolean _mesa_extension_is_enabled( GLcontext *ctx, const char *name ) { const GLboolean *base = (const GLboolean *) &ctx->Extensions; GLuint i; for (i = 0 ; i < Elements(default_extensions) ; i++) { if (_mesa_strcmp(default_extensions[i].name, name) == 0) { if (!default_extensions[i].flag_offset) return GL_TRUE; return *(base + default_extensions[i].flag_offset); } } return GL_FALSE; } /** * Run through the default_extensions array above and set the * ctx->Extensions.ARB/EXT_* flags accordingly. * To be called during context initialization. */ void _mesa_init_extensions( GLcontext *ctx ) { GLboolean *base = (GLboolean *) &ctx->Extensions; GLuint i; for (i = 0 ; i < Elements(default_extensions) ; i++) { if (default_extensions[i].enabled && default_extensions[i].flag_offset) { *(base + default_extensions[i].flag_offset) = GL_TRUE; } } } /** * Construct the GL_EXTENSIONS string. Called the first time that * glGetString(GL_EXTENSIONS) is called. */ GLubyte * _mesa_make_extension_string( GLcontext *ctx ) { const GLboolean *base = (const GLboolean *) &ctx->Extensions; GLuint extStrLen = 0; GLubyte *s; GLuint i; /* first, compute length of the extension string */ for (i = 0 ; i < Elements(default_extensions) ; i++) { if (!default_extensions[i].flag_offset || *(base + default_extensions[i].flag_offset)) { extStrLen += (GLuint)_mesa_strlen(default_extensions[i].name) + 1; } } s = (GLubyte *) _mesa_malloc(extStrLen); /* second, build the extension string */ extStrLen = 0; for (i = 0 ; i < Elements(default_extensions) ; i++) { if (!default_extensions[i].flag_offset || *(base + default_extensions[i].flag_offset)) { GLuint len = (GLuint)_mesa_strlen(default_extensions[i].name); _mesa_memcpy(s + extStrLen, default_extensions[i].name, len); extStrLen += len; s[extStrLen] = (GLubyte) ' '; extStrLen++; } } ASSERT(extStrLen > 0); s[extStrLen - 1] = 0; return s; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/extensions.h0000644000000000000000000000453513614532424020520 0ustar /** * \file extensions.h * Extension handling. * * \if subset * (No-op) * * \endif */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXTENSIONS_H_ #define _EXTENSIONS_H_ #include "mtypes.h" #if _HAVE_FULL_GL extern void _mesa_enable_sw_extensions(GLcontext *ctx); extern void _mesa_enable_imaging_extensions(GLcontext *ctx); extern void _mesa_enable_1_3_extensions(GLcontext *ctx); extern void _mesa_enable_1_4_extensions(GLcontext *ctx); extern void _mesa_enable_1_5_extensions(GLcontext *ctx); extern void _mesa_enable_2_0_extensions(GLcontext *ctx); extern void _mesa_enable_extension(GLcontext *ctx, const char *name); extern void _mesa_disable_extension(GLcontext *ctx, const char *name); extern GLboolean _mesa_extension_is_enabled(GLcontext *ctx, const char *name); extern void _mesa_init_extensions(GLcontext *ctx); extern GLubyte *_mesa_make_extension_string(GLcontext *ctx); #else /** No-op */ #define _mesa_extensions_dtr( ctx ) ((void)0) /** No-op */ #define _mesa_extensions_ctr( ctx ) ((void)0) /** No-op */ #define _mesa_extensions_get_string( ctx ) "GL_EXT_texture_object" /** No-op */ #define _mesa_enable_imaging_extensions( c ) ((void)0) /** No-op */ #define _mesa_enable_extension( c, n ) ((void)0) #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/fbobject.c0000644000000000000000000011070513614532424020067 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Authors: * Brian Paul */ #include "context.h" #include "fbobject.h" #include "framebuffer.h" #include "hash.h" #include "renderbuffer.h" #include "teximage.h" #include "texstore.h" /** * Notes: * * None of the GL_EXT_framebuffer_object functions are compiled into * display lists. */ /* * When glGenRender/FramebuffersEXT() is called we insert pointers to * these placeholder objects into the hash table. * Later, when the object ID is first bound, we replace the placeholder * with the real frame/renderbuffer. */ static struct gl_framebuffer DummyFramebuffer; static struct gl_renderbuffer DummyRenderbuffer; #define IS_CUBE_FACE(TARGET) \ ((TARGET) >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && \ (TARGET) <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) /** * Helper routine for getting a gl_renderbuffer. */ static struct gl_renderbuffer * lookup_renderbuffer(GLcontext *ctx, GLuint id) { struct gl_renderbuffer *rb; if (id == 0) return NULL; rb = (struct gl_renderbuffer *) _mesa_HashLookup(ctx->Shared->RenderBuffers, id); return rb; } /** * Helper routine for getting a gl_framebuffer. */ static struct gl_framebuffer * lookup_framebuffer(GLcontext *ctx, GLuint id) { struct gl_framebuffer *fb; if (id == 0) return NULL; fb = (struct gl_framebuffer *) _mesa_HashLookup(ctx->Shared->FrameBuffers, id); return fb; } /** * Given a GL_*_ATTACHMENTn token, return a pointer to the corresponding * gl_renderbuffer_attachment object. */ static struct gl_renderbuffer_attachment * get_attachment(GLcontext *ctx, struct gl_framebuffer *fb, GLenum attachment) { GLuint i; switch (attachment) { case GL_COLOR_ATTACHMENT0_EXT: case GL_COLOR_ATTACHMENT1_EXT: case GL_COLOR_ATTACHMENT2_EXT: case GL_COLOR_ATTACHMENT3_EXT: case GL_COLOR_ATTACHMENT4_EXT: case GL_COLOR_ATTACHMENT5_EXT: case GL_COLOR_ATTACHMENT6_EXT: case GL_COLOR_ATTACHMENT7_EXT: case GL_COLOR_ATTACHMENT8_EXT: case GL_COLOR_ATTACHMENT9_EXT: case GL_COLOR_ATTACHMENT10_EXT: case GL_COLOR_ATTACHMENT11_EXT: case GL_COLOR_ATTACHMENT12_EXT: case GL_COLOR_ATTACHMENT13_EXT: case GL_COLOR_ATTACHMENT14_EXT: case GL_COLOR_ATTACHMENT15_EXT: i = attachment - GL_COLOR_ATTACHMENT0_EXT; if (i >= ctx->Const.MaxColorAttachments) { return NULL; } return &fb->Attachment[BUFFER_COLOR0 + i]; case GL_DEPTH_ATTACHMENT_EXT: return &fb->Attachment[BUFFER_DEPTH]; case GL_STENCIL_ATTACHMENT_EXT: return &fb->Attachment[BUFFER_STENCIL]; default: return NULL; } } /** * Remove any texture or renderbuffer attached to the given attachment * point. Update reference counts, etc. */ void _mesa_remove_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att) { if (att->Type == GL_TEXTURE) { ASSERT(att->Texture); if (att->Renderbuffer) { /* delete/remove the 'wrapper' renderbuffer */ /* XXX do we really want to do this??? */ att->Renderbuffer->Delete(att->Renderbuffer); att->Renderbuffer = NULL; } att->Texture->RefCount--; if (att->Texture->RefCount == 0) { ctx->Driver.DeleteTexture(ctx, att->Texture); } att->Texture = NULL; } else if (att->Type == GL_RENDERBUFFER_EXT) { ASSERT(att->Renderbuffer); ASSERT(!att->Texture); att->Renderbuffer->RefCount--; if (att->Renderbuffer->RefCount == 0) { att->Renderbuffer->Delete(att->Renderbuffer); } att->Renderbuffer = NULL; } att->Type = GL_NONE; att->Complete = GL_TRUE; } /** * Bind a texture object to an attachment point. * The previous binding, if any, will be removed first. */ void _mesa_set_texture_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att, struct gl_texture_object *texObj, GLenum texTarget, GLuint level, GLuint zoffset) { _mesa_remove_attachment(ctx, att); att->Type = GL_TEXTURE; att->Texture = texObj; att->TextureLevel = level; if (IS_CUBE_FACE(texTarget)) { att->CubeMapFace = texTarget - GL_TEXTURE_CUBE_MAP_POSITIVE_X; } else { att->CubeMapFace = 0; } att->Zoffset = zoffset; att->Complete = GL_FALSE; texObj->RefCount++; /* XXX when we attach to a texture, we should probably set the * att->Renderbuffer pointer to a "wrapper renderbuffer" which * makes the texture image look like renderbuffer. */ } /** * Bind a renderbuffer to an attachment point. * The previous binding, if any, will be removed first. */ void _mesa_set_renderbuffer_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att, struct gl_renderbuffer *rb) { _mesa_remove_attachment(ctx, att); att->Type = GL_RENDERBUFFER_EXT; att->Renderbuffer = rb; att->Texture = NULL; /* just to be safe */ att->Complete = GL_FALSE; rb->RefCount++; } /** * Fallback for ctx->Driver.FramebufferRenderbuffer() * Sets a framebuffer attachment to a particular renderbuffer. * The framebuffer in question is ctx->DrawBuffer. * \sa _mesa_renderbuffer_texture */ void _mesa_framebuffer_renderbuffer(GLcontext *ctx, struct gl_renderbuffer_attachment *att, struct gl_renderbuffer *rb) { if (rb) { _mesa_set_renderbuffer_attachment(ctx, att, rb); } else { _mesa_remove_attachment(ctx, att); } } /** * Test if an attachment point is complete and update its Complete field. * \param format if GL_COLOR, this is a color attachment point, * if GL_DEPTH, this is a depth component attachment point, * if GL_STENCIL, this is a stencil component attachment point. */ static void test_attachment_completeness(const GLcontext *ctx, GLenum format, struct gl_renderbuffer_attachment *att) { assert(format == GL_COLOR || format == GL_DEPTH || format == GL_STENCIL); /* assume complete */ att->Complete = GL_TRUE; /* Look for reasons why the attachment might be incomplete */ if (att->Type == GL_TEXTURE) { const struct gl_texture_object *texObj = att->Texture; struct gl_texture_image *texImage; if (!texObj) { att->Complete = GL_FALSE; return; } texImage = texObj->Image[att->CubeMapFace][att->TextureLevel]; if (!texImage) { att->Complete = GL_FALSE; return; } if (texImage->Width < 1 || texImage->Height < 1) { att->Complete = GL_FALSE; return; } if (texObj->Target == GL_TEXTURE_3D && att->Zoffset >= texImage->Depth) { att->Complete = GL_FALSE; return; } if (format == GL_COLOR) { if (texImage->TexFormat->BaseFormat != GL_RGB && texImage->TexFormat->BaseFormat != GL_RGBA) { att->Complete = GL_FALSE; return; } } else if (format == GL_DEPTH) { if (texImage->TexFormat->BaseFormat != GL_DEPTH_COMPONENT) { att->Complete = GL_FALSE; return; } } else { /* no such thing as stencil textures */ att->Complete = GL_FALSE; return; } } else if (att->Type == GL_RENDERBUFFER_EXT) { if (att->Renderbuffer->Width < 1 || att->Renderbuffer->Height < 1) { att->Complete = GL_FALSE; return; } if (format == GL_COLOR) { if (att->Renderbuffer->_BaseFormat != GL_RGB && att->Renderbuffer->_BaseFormat != GL_RGBA) { att->Complete = GL_FALSE; return; } } else if (format == GL_DEPTH) { if (att->Renderbuffer->_BaseFormat != GL_DEPTH_COMPONENT) { att->Complete = GL_FALSE; return; } } else { assert(format == GL_STENCIL); if (att->Renderbuffer->_BaseFormat != GL_STENCIL_INDEX) { att->Complete = GL_FALSE; return; } } } else { ASSERT(att->Type == GL_NONE); /* complete */ return; } } /** * Test if the given framebuffer object is complete and update its * Status field with the results. * Also update the framebuffer's Width and Height fields if the * framebuffer is complete. */ void _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb) { GLuint numImages, width = 0, height = 0; GLenum intFormat = GL_NONE; GLuint w = 0, h = 0; GLint i; assert(fb->Name != 0); numImages = 0; fb->Width = 0; fb->Height = 0; /* Start at -2 to more easily loop over all attachment points */ for (i = -2; i < (GLint) ctx->Const.MaxColorAttachments; i++) { struct gl_renderbuffer_attachment *att; GLenum f; if (i == -2) { att = &fb->Attachment[BUFFER_DEPTH]; test_attachment_completeness(ctx, GL_DEPTH, att); if (!att->Complete) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT; return; } } else if (i == -1) { att = &fb->Attachment[BUFFER_STENCIL]; test_attachment_completeness(ctx, GL_STENCIL, att); if (!att->Complete) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT; return; } } else { att = &fb->Attachment[BUFFER_COLOR0 + i]; test_attachment_completeness(ctx, GL_COLOR, att); if (!att->Complete) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT; return; } } if (att->Type == GL_TEXTURE) { w = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Width; h = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Height; f = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Format; numImages++; if (f != GL_RGB && f != GL_RGBA && f != GL_DEPTH_COMPONENT) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT; return; } } else if (att->Type == GL_RENDERBUFFER_EXT) { w = att->Renderbuffer->Width; h = att->Renderbuffer->Height; f = att->Renderbuffer->InternalFormat; numImages++; } else { assert(att->Type == GL_NONE); continue; } if (numImages == 1) { /* set required width, height and format */ width = w; height = h; if (i >= 0) intFormat = f; } else { /* check that width, height, format are same */ if (w != width || h != height) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT; return; } if (intFormat != GL_NONE && f != intFormat) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT; return; } } } /* Check that all DrawBuffers are present */ for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) { if (fb->ColorDrawBuffer[i] != GL_NONE) { const struct gl_renderbuffer_attachment *att = get_attachment(ctx, fb, fb->ColorDrawBuffer[i]); assert(att); if (att->Type == GL_NONE) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT; return; } } } /* Check that the ReadBuffer is present */ if (fb->ColorReadBuffer != GL_NONE) { const struct gl_renderbuffer_attachment *att = get_attachment(ctx, fb, fb->ColorReadBuffer); assert(att); if (att->Type == GL_NONE) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT; return; } } /* Check if any renderbuffer is attached more than once */ for (i = 0; i < BUFFER_COUNT - 1; i++) { struct gl_renderbuffer *rb_i = fb->Attachment[i].Renderbuffer; if (rb_i) { GLint j; for (j = i + 1; j < BUFFER_COUNT; j++) { struct gl_renderbuffer *rb_j = fb->Attachment[j].Renderbuffer; if (rb_i == rb_j) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT; return; } } } } if (numImages == 0) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT; return; } /* * If we get here, the framebuffer is complete! */ fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT; fb->Width = w; fb->Height = h; } GLboolean GLAPIENTRY _mesa_IsRenderbufferEXT(GLuint renderbuffer) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (renderbuffer) { struct gl_renderbuffer *rb = lookup_renderbuffer(ctx, renderbuffer); if (rb != NULL && rb != &DummyRenderbuffer) return GL_TRUE; } return GL_FALSE; } void GLAPIENTRY _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer) { struct gl_renderbuffer *newRb, *oldRb; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target != GL_RENDERBUFFER_EXT) { _mesa_error(ctx, GL_INVALID_ENUM, "glBindRenderbufferEXT(target)"); return; } FLUSH_VERTICES(ctx, _NEW_BUFFERS); if (renderbuffer) { newRb = lookup_renderbuffer(ctx, renderbuffer); if (newRb == &DummyRenderbuffer) { /* ID was reserved, but no real renderbuffer object made yet */ newRb = NULL; } if (!newRb) { /* create new renderbuffer object */ newRb = ctx->Driver.NewRenderbuffer(ctx, renderbuffer); if (!newRb) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindRenderbufferEXT"); return; } ASSERT(newRb->AllocStorage); _mesa_HashInsert(ctx->Shared->RenderBuffers, renderbuffer, newRb); } newRb->RefCount++; } else { newRb = NULL; } oldRb = ctx->CurrentRenderbuffer; if (oldRb) { oldRb->RefCount--; if (oldRb->RefCount == 0) { oldRb->Delete(oldRb); } } ASSERT(newRb != &DummyRenderbuffer); ctx->CurrentRenderbuffer = newRb; } void GLAPIENTRY _mesa_DeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers) { GLint i; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_BUFFERS); for (i = 0; i < n; i++) { if (renderbuffers[i] > 0) { struct gl_renderbuffer *rb; rb = lookup_renderbuffer(ctx, renderbuffers[i]); if (rb) { /* check if deleting currently bound renderbuffer object */ if (rb == ctx->CurrentRenderbuffer) { /* bind default */ ASSERT(rb->RefCount >= 2); _mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); } /* remove from hash table immediately, to free the ID */ _mesa_HashRemove(ctx->Shared->RenderBuffers, renderbuffers[i]); if (rb != &DummyRenderbuffer) { /* But the object will not be freed until it's no longer * bound in any context. */ rb->RefCount--; if (rb->RefCount == 0) { rb->Delete(rb); } } } } } } void GLAPIENTRY _mesa_GenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers) { GET_CURRENT_CONTEXT(ctx); GLuint first; GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx); if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glGenRenderbuffersEXT(n)"); return; } if (!renderbuffers) return; first = _mesa_HashFindFreeKeyBlock(ctx->Shared->RenderBuffers, n); for (i = 0; i < n; i++) { GLuint name = first + i; renderbuffers[i] = name; /* insert dummy placeholder into hash table */ _glthread_LOCK_MUTEX(ctx->Shared->Mutex); _mesa_HashInsert(ctx->Shared->RenderBuffers, name, &DummyRenderbuffer); _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); } } /** * Given an internal format token for a render buffer, return the * corresponding base format. * \return one of GL_RGB, GL_RGBA, GL_STENCIL_INDEX, GL_DEPTH_COMPONENT * or zero if error. */ static GLenum base_internal_format(GLcontext *ctx, GLenum internalFormat) { switch (internalFormat) { case GL_RGB: case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: return GL_RGB; case GL_RGBA: case GL_RGBA2: case GL_RGBA4: case GL_RGB5_A1: case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: return GL_RGBA; case GL_STENCIL_INDEX: case GL_STENCIL_INDEX1_EXT: case GL_STENCIL_INDEX4_EXT: case GL_STENCIL_INDEX8_EXT: case GL_STENCIL_INDEX16_EXT: return GL_STENCIL_INDEX; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: return GL_DEPTH_COMPONENT; /* XXX add floating point formats eventually */ default: return 0; } } void GLAPIENTRY _mesa_RenderbufferStorageEXT(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height) { struct gl_renderbuffer *rb; GLenum baseFormat; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target != GL_RENDERBUFFER_EXT) { _mesa_error(ctx, GL_INVALID_ENUM, "glRenderbufferStorageEXT(target)"); return; } baseFormat = base_internal_format(ctx, internalFormat); if (baseFormat == 0) { _mesa_error(ctx, GL_INVALID_ENUM, "glRenderbufferStorageEXT(internalFormat)"); return; } if (width < 1 || width > ctx->Const.MaxRenderbufferSize) { _mesa_error(ctx, GL_INVALID_VALUE, "glRenderbufferStorageEXT(width)"); return; } if (height < 1 || height > ctx->Const.MaxRenderbufferSize) { _mesa_error(ctx, GL_INVALID_VALUE, "glRenderbufferStorageEXT(height)"); return; } rb = ctx->CurrentRenderbuffer; if (!rb) { _mesa_error(ctx, GL_INVALID_OPERATION, "glRenderbufferStorageEXT"); return; } FLUSH_VERTICES(ctx, _NEW_BUFFERS); /* Now allocate the storage */ ASSERT(rb->AllocStorage); if (rb->AllocStorage(ctx, rb, internalFormat, width, height)) { /* No error - check/set fields now */ assert(rb->Width == width); assert(rb->Height == height); assert(rb->InternalFormat); rb->_BaseFormat = baseFormat; } else { /* Probably ran out of memory - clear the fields */ rb->Width = 0; rb->Height = 0; rb->InternalFormat = GL_NONE; rb->_BaseFormat = GL_NONE; } /* test_framebuffer_completeness(ctx, fb); */ /* XXX if this renderbuffer is attached anywhere, invalidate attachment * points??? */ } void GLAPIENTRY _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target != GL_RENDERBUFFER_EXT) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetRenderbufferParameterivEXT(target)"); return; } if (!ctx->CurrentRenderbuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetRenderbufferParameterivEXT"); return; } FLUSH_VERTICES(ctx, _NEW_BUFFERS); switch (pname) { case GL_RENDERBUFFER_WIDTH_EXT: *params = ctx->CurrentRenderbuffer->Width; return; case GL_RENDERBUFFER_HEIGHT_EXT: *params = ctx->CurrentRenderbuffer->Height; return; case GL_RENDERBUFFER_INTERNAL_FORMAT_EXT: *params = ctx->CurrentRenderbuffer->InternalFormat; return; case GL_RENDERBUFFER_RED_SIZE_EXT: if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB || ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) { *params = ctx->CurrentRenderbuffer->ComponentSizes[0]; } else { *params = 0; } break; case GL_RENDERBUFFER_GREEN_SIZE_EXT: if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB || ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) { *params = ctx->CurrentRenderbuffer->ComponentSizes[1]; } else { *params = 0; } break; case GL_RENDERBUFFER_BLUE_SIZE_EXT: if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB || ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) { *params = ctx->CurrentRenderbuffer->ComponentSizes[2]; } else { *params = 0; } break; case GL_RENDERBUFFER_ALPHA_SIZE_EXT: if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB || ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) { *params = ctx->CurrentRenderbuffer->ComponentSizes[3]; } else { *params = 0; } break; case GL_RENDERBUFFER_DEPTH_SIZE_EXT: if (ctx->CurrentRenderbuffer->_BaseFormat == GL_DEPTH_COMPONENT) { *params = ctx->CurrentRenderbuffer->ComponentSizes[0]; } else { *params = 0; } break; case GL_RENDERBUFFER_STENCIL_SIZE_EXT: if (ctx->CurrentRenderbuffer->_BaseFormat == GL_STENCIL_INDEX) { *params = ctx->CurrentRenderbuffer->ComponentSizes[0]; } else { *params = 0; } break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetRenderbufferParameterivEXT(target)"); return; } } GLboolean GLAPIENTRY _mesa_IsFramebufferEXT(GLuint framebuffer) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (framebuffer) { struct gl_framebuffer *rb = lookup_framebuffer(ctx, framebuffer); if (rb != NULL && rb != &DummyFramebuffer) return GL_TRUE; } return GL_FALSE; } void GLAPIENTRY _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) { struct gl_framebuffer *newFb, *newReadFb, *oldFb; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target != GL_FRAMEBUFFER_EXT) { _mesa_error(ctx, GL_INVALID_ENUM, "glBindFramebufferEXT(target)"); return; } FLUSH_VERTICES(ctx, _NEW_BUFFERS); if (framebuffer) { /* Binding a user-created framebuffer object */ newFb = lookup_framebuffer(ctx, framebuffer); if (newFb == &DummyFramebuffer) { /* ID was reserved, but no real framebuffer object made yet */ newFb = NULL; } if (!newFb) { /* create new framebuffer object */ newFb = ctx->Driver.NewFramebuffer(ctx, framebuffer); if (!newFb) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindFramebufferEXT"); return; } _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, newFb); } newFb->RefCount++; newReadFb = newFb; } else { /* Binding the window system framebuffer (which was originally set * with MakeCurrent). */ newFb = ctx->WinSysDrawBuffer; newReadFb = ctx->WinSysReadBuffer; } oldFb = ctx->DrawBuffer; if (oldFb && oldFb->Name != 0) { oldFb->RefCount--; if (oldFb->RefCount == 0) { oldFb->Delete(oldFb); } } ASSERT(newFb != &DummyFramebuffer); /* Note, we set both the GL_DRAW_BUFFER and GL_READ_BUFFER state: */ ctx->DrawBuffer = newFb; ctx->ReadBuffer = newReadFb; } void GLAPIENTRY _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers) { GLint i; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_BUFFERS); for (i = 0; i < n; i++) { if (framebuffers[i] > 0) { struct gl_framebuffer *fb; fb = lookup_framebuffer(ctx, framebuffers[i]); if (fb) { ASSERT(fb == &DummyFramebuffer || fb->Name == framebuffers[i]); /* check if deleting currently bound framebuffer object */ if (fb == ctx->DrawBuffer) { /* bind default */ ASSERT(fb->RefCount >= 2); _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); } /* remove from hash table immediately, to free the ID */ _mesa_HashRemove(ctx->Shared->FrameBuffers, framebuffers[i]); if (fb != &DummyFramebuffer) { /* But the object will not be freed until it's no longer * bound in any context. */ fb->RefCount--; if (fb->RefCount == 0) { fb->Delete(fb); } } } } } } void GLAPIENTRY _mesa_GenFramebuffersEXT(GLsizei n, GLuint *framebuffers) { GET_CURRENT_CONTEXT(ctx); GLuint first; GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx); if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glGenFramebuffersEXT(n)"); return; } if (!framebuffers) return; first = _mesa_HashFindFreeKeyBlock(ctx->Shared->FrameBuffers, n); for (i = 0; i < n; i++) { GLuint name = first + i; framebuffers[i] = name; /* insert dummy placeholder into hash table */ _glthread_LOCK_MUTEX(ctx->Shared->Mutex); _mesa_HashInsert(ctx->Shared->FrameBuffers, name, &DummyFramebuffer); _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); } } GLenum GLAPIENTRY _mesa_CheckFramebufferStatusEXT(GLenum target) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); if (target != GL_FRAMEBUFFER_EXT) { _mesa_error(ctx, GL_INVALID_ENUM, "glCheckFramebufferStatus(target)"); return 0; /* formerly GL_FRAMEBUFFER_STATUS_ERROR_EXT */ } if (ctx->DrawBuffer->Name == 0) { /* The window system / default framebuffer is always complete */ return GL_FRAMEBUFFER_COMPLETE_EXT; } FLUSH_VERTICES(ctx, _NEW_BUFFERS); _mesa_test_framebuffer_completeness(ctx, ctx->DrawBuffer); return ctx->DrawBuffer->_Status; } /** * Do error checking common to glFramebufferTexture1D/2D/3DEXT. * \return GL_TRUE if any error, GL_FALSE otherwise */ static GLboolean error_check_framebuffer_texture(GLcontext *ctx, GLuint dims, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { ASSERT(dims >= 1 && dims <= 3); if (target != GL_FRAMEBUFFER_EXT) { _mesa_error(ctx, GL_INVALID_ENUM, "glFramebufferTexture%dDEXT(target)", dims); return GL_TRUE; } /* check framebuffer binding */ if (ctx->DrawBuffer->Name == 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferTexture%dDEXT", dims); return GL_TRUE; } /* only check textarget, level if texture ID is non-zero */ if (texture) { if ((dims == 1 && textarget != GL_TEXTURE_1D) || (dims == 3 && textarget != GL_TEXTURE_3D) || (dims == 2 && textarget != GL_TEXTURE_2D && textarget != GL_TEXTURE_RECTANGLE_ARB && !IS_CUBE_FACE(textarget))) { _mesa_error(ctx, GL_INVALID_VALUE, "glFramebufferTexture%dDEXT(textarget)", dims); return GL_TRUE; } if ((level < 0) || level >= _mesa_max_texture_levels(ctx, textarget)) { _mesa_error(ctx, GL_INVALID_VALUE, "glFramebufferTexture%dDEXT(level)", dims); return GL_TRUE; } } return GL_FALSE; } void GLAPIENTRY _mesa_FramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { struct gl_renderbuffer_attachment *att; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (error_check_framebuffer_texture(ctx, 1, target, attachment, textarget, texture, level)) return; ASSERT(textarget == GL_TEXTURE_1D); att = get_attachment(ctx, ctx->DrawBuffer, attachment); if (att == NULL) { _mesa_error(ctx, GL_INVALID_ENUM, "glFramebufferTexture1DEXT(attachment)"); return; } FLUSH_VERTICES(ctx, _NEW_BUFFERS); if (texture) { texObj = (struct gl_texture_object *) _mesa_HashLookup(ctx->Shared->TexObjects, texture); if (!texObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glFramebufferTexture1DEXT(texture)"); return; } if (texObj->Target != textarget) { _mesa_error(ctx, GL_INVALID_OPERATION, /* XXX correct error? */ "glFramebufferTexture1DEXT(texture target)"); return; } } else { /* remove texture attachment */ texObj = NULL; } ctx->Driver.RenderbufferTexture(ctx, att, texObj, textarget, level, 0); } void GLAPIENTRY _mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { struct gl_renderbuffer_attachment *att; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (error_check_framebuffer_texture(ctx, 2, target, attachment, textarget, texture, level)) return; ASSERT(textarget == GL_TEXTURE_2D || textarget == GL_TEXTURE_RECTANGLE_ARB || IS_CUBE_FACE(textarget)); att = get_attachment(ctx, ctx->DrawBuffer, attachment); if (att == NULL) { _mesa_error(ctx, GL_INVALID_ENUM, "glFramebufferTexture2DEXT(attachment)"); return; } FLUSH_VERTICES(ctx, _NEW_BUFFERS); if (texture) { texObj = (struct gl_texture_object *) _mesa_HashLookup(ctx->Shared->TexObjects, texture); if (!texObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glFramebufferTexture2DEXT(texture)"); return; } if ((texObj->Target == GL_TEXTURE_2D && textarget != GL_TEXTURE_2D) || (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && textarget != GL_TEXTURE_RECTANGLE_ARB) || (texObj->Target == GL_TEXTURE_CUBE_MAP && !IS_CUBE_FACE(textarget))) { _mesa_error(ctx, GL_INVALID_OPERATION, /* XXX correct error? */ "glFramebufferTexture2DEXT(texture target)"); return; } } else { /* remove texture attachment */ texObj = NULL; } ctx->Driver.RenderbufferTexture(ctx, att, texObj, textarget, level, 0); } void GLAPIENTRY _mesa_FramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) { struct gl_renderbuffer_attachment *att; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (error_check_framebuffer_texture(ctx, 3, target, attachment, textarget, texture, level)) return; ASSERT(textarget == GL_TEXTURE_3D); att = get_attachment(ctx, ctx->DrawBuffer, attachment); if (att == NULL) { _mesa_error(ctx, GL_INVALID_ENUM, "glFramebufferTexture1DEXT(attachment)"); return; } FLUSH_VERTICES(ctx, _NEW_BUFFERS); if (texture) { const GLint maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1); texObj = (struct gl_texture_object *) _mesa_HashLookup(ctx->Shared->TexObjects, texture); if (!texObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glFramebufferTexture3DEXT(texture)"); return; } if (texObj->Target != textarget) { _mesa_error(ctx, GL_INVALID_OPERATION, /* XXX correct error? */ "glFramebufferTexture3DEXT(texture target)"); return; } if (zoffset < 0 || zoffset >= maxSize) { _mesa_error(ctx, GL_INVALID_VALUE, "glFramebufferTexture3DEXT(zoffset)"); return; } } else { /* remove texture attachment */ texObj = NULL; } ctx->Driver.RenderbufferTexture(ctx, att, texObj, textarget, level, zoffset); } void GLAPIENTRY _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbufferTarget, GLuint renderbuffer) { struct gl_renderbuffer_attachment *att; struct gl_renderbuffer *rb; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target != GL_FRAMEBUFFER_EXT) { _mesa_error(ctx, GL_INVALID_ENUM, "glFramebufferRenderbufferEXT(target)"); return; } if (renderbufferTarget != GL_RENDERBUFFER_EXT) { _mesa_error(ctx, GL_INVALID_ENUM, "glFramebufferRenderbufferEXT(renderbufferTarget)"); return; } if (ctx->DrawBuffer->Name == 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferRenderbufferEXT"); return; } att = get_attachment(ctx, ctx->DrawBuffer, attachment); if (att == NULL) { _mesa_error(ctx, GL_INVALID_ENUM, "glFramebufferRenderbufferEXT(attachment)"); return; } if (renderbuffer) { rb = lookup_renderbuffer(ctx, renderbuffer); if (!rb) { _mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferRenderbufferEXT(renderbuffer)"); return; } } else { /* remove renderbuffer attachment */ rb = NULL; } FLUSH_VERTICES(ctx, _NEW_BUFFERS); assert(ctx->Driver.FramebufferRenderbuffer); ctx->Driver.FramebufferRenderbuffer(ctx, att, rb); } void GLAPIENTRY _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint *params) { const struct gl_renderbuffer_attachment *att; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target != GL_FRAMEBUFFER_EXT) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetFramebufferAttachmentParameterivEXT(target)"); return; } if (ctx->DrawBuffer->Name == 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetFramebufferAttachmentParameterivEXT"); return; } att = get_attachment(ctx, ctx->DrawBuffer, attachment); if (att == NULL) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetFramebufferAttachmentParameterivEXT(attachment)"); return; } FLUSH_VERTICES(ctx, _NEW_BUFFERS); switch (pname) { case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT: *params = att->Type; return; case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT: if (att->Type == GL_RENDERBUFFER_EXT) { *params = att->Renderbuffer->Name; } else if (att->Type == GL_TEXTURE) { *params = att->Texture->Name; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetFramebufferAttachmentParameterivEXT(pname)"); } return; case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT: if (att->Type == GL_TEXTURE) { *params = att->TextureLevel; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetFramebufferAttachmentParameterivEXT(pname)"); } return; case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT: if (att->Type == GL_TEXTURE) { *params = GL_TEXTURE_CUBE_MAP_POSITIVE_X + att->CubeMapFace; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetFramebufferAttachmentParameterivEXT(pname)"); } return; case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT: if (att->Type == GL_TEXTURE) { *params = att->Zoffset; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetFramebufferAttachmentParameterivEXT(pname)"); } return; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetFramebufferAttachmentParameterivEXT(pname)"); return; } } void GLAPIENTRY _mesa_GenerateMipmapEXT(GLenum target) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_BUFFERS); switch (target) { case GL_TEXTURE_1D: case GL_TEXTURE_2D: case GL_TEXTURE_3D: case GL_TEXTURE_CUBE_MAP: /* OK, legal value */ break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGenerateMipmapEXT(target)"); return; } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); /* XXX this might not handle cube maps correctly */ _mesa_generate_mipmap(ctx, target, texUnit, texObj); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/fbobject.h0000644000000000000000000001005213614532424020066 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef FBOBJECT_H #define FBOBJECT_H extern void _mesa_remove_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att); extern void _mesa_set_texture_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att, struct gl_texture_object *texObj, GLenum texTarget, GLuint level, GLuint zoffset); extern void _mesa_set_renderbuffer_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att, struct gl_renderbuffer *rb); extern void _mesa_framebuffer_renderbuffer(GLcontext *ctx, struct gl_renderbuffer_attachment *att, struct gl_renderbuffer *rb); extern void _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb); extern GLboolean GLAPIENTRY _mesa_IsRenderbufferEXT(GLuint renderbuffer); extern void GLAPIENTRY _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer); extern void GLAPIENTRY _mesa_DeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers); extern void GLAPIENTRY _mesa_GenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers); extern void GLAPIENTRY _mesa_RenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); extern void GLAPIENTRY _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params); extern GLboolean GLAPIENTRY _mesa_IsFramebufferEXT(GLuint framebuffer); extern void GLAPIENTRY _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer); extern void GLAPIENTRY _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers); extern void GLAPIENTRY _mesa_GenFramebuffersEXT(GLsizei n, GLuint *framebuffers); extern GLenum GLAPIENTRY _mesa_CheckFramebufferStatusEXT(GLenum target); extern void GLAPIENTRY _mesa_FramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); extern void GLAPIENTRY _mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); extern void GLAPIENTRY _mesa_FramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); extern void GLAPIENTRY _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); extern void GLAPIENTRY _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GenerateMipmapEXT(GLenum target); #endif /* FBOBJECT_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/feedback.c0000644000000000000000000003241613614532424020037 0ustar /** * \file feedback.c * Selection and feedback modes functions. */ /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "enums.h" #include "feedback.h" #include "macros.h" #include "mtypes.h" #if _HAVE_FULL_GL #define FB_3D 0x01 #define FB_4D 0x02 #define FB_INDEX 0x04 #define FB_COLOR 0x08 #define FB_TEXTURE 0X10 void GLAPIENTRY _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode==GL_FEEDBACK) { _mesa_error( ctx, GL_INVALID_OPERATION, "glFeedbackBuffer" ); return; } if (size<0) { _mesa_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(size<0)" ); return; } if (!buffer) { _mesa_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(buffer==NULL)" ); ctx->Feedback.BufferSize = 0; return; } switch (type) { case GL_2D: ctx->Feedback._Mask = 0; break; case GL_3D: ctx->Feedback._Mask = FB_3D; break; case GL_3D_COLOR: ctx->Feedback._Mask = (FB_3D | (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX)); break; case GL_3D_COLOR_TEXTURE: ctx->Feedback._Mask = (FB_3D | (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX) | FB_TEXTURE); break; case GL_4D_COLOR_TEXTURE: ctx->Feedback._Mask = (FB_3D | FB_4D | (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX) | FB_TEXTURE); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glFeedbackBuffer" ); return; } FLUSH_VERTICES(ctx, _NEW_RENDERMODE); /* Always flush */ ctx->Feedback.Type = type; ctx->Feedback.BufferSize = size; ctx->Feedback.Buffer = buffer; ctx->Feedback.Count = 0; /* Becaues of this. */ } void GLAPIENTRY _mesa_PassThrough( GLfloat token ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode==GL_FEEDBACK) { FLUSH_VERTICES(ctx, 0); FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN ); FEEDBACK_TOKEN( ctx, token ); } } /* * Put a vertex into the feedback buffer. */ void _mesa_feedback_vertex( GLcontext *ctx, const GLfloat win[4], const GLfloat color[4], GLfloat index, const GLfloat texcoord[4] ) { #if 0 { /* snap window x, y to fractional pixel position */ const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1); GLfixed x, y; x = FloatToFixed(win[0]) & snapMask; y = FloatToFixed(win[1]) & snapMask; FEEDBACK_TOKEN(ctx, FixedToFloat(x)); FEEDBACK_TOKEN(ctx, FixedToFloat(y) ); } #else FEEDBACK_TOKEN( ctx, win[0] ); FEEDBACK_TOKEN( ctx, win[1] ); #endif if (ctx->Feedback._Mask & FB_3D) { FEEDBACK_TOKEN( ctx, win[2] ); } if (ctx->Feedback._Mask & FB_4D) { FEEDBACK_TOKEN( ctx, win[3] ); } if (ctx->Feedback._Mask & FB_INDEX) { FEEDBACK_TOKEN( ctx, (GLfloat) index ); } if (ctx->Feedback._Mask & FB_COLOR) { FEEDBACK_TOKEN( ctx, color[0] ); FEEDBACK_TOKEN( ctx, color[1] ); FEEDBACK_TOKEN( ctx, color[2] ); FEEDBACK_TOKEN( ctx, color[3] ); } if (ctx->Feedback._Mask & FB_TEXTURE) { FEEDBACK_TOKEN( ctx, texcoord[0] ); FEEDBACK_TOKEN( ctx, texcoord[1] ); FEEDBACK_TOKEN( ctx, texcoord[2] ); FEEDBACK_TOKEN( ctx, texcoord[3] ); } } #endif /**********************************************************************/ /** \name Selection */ /*@{*/ /** * Establish a buffer for selection mode values. * * \param size buffer size. * \param buffer buffer. * * \sa glSelectBuffer(). * * \note this function can't be put in a display list. * * Verifies we're not in selection mode, flushes the vertices and initialize * the fields in __GLcontextRec::Select with the given buffer. */ void GLAPIENTRY _mesa_SelectBuffer( GLsizei size, GLuint *buffer ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode==GL_SELECT) { _mesa_error( ctx, GL_INVALID_OPERATION, "glSelectBuffer" ); return; /* KW: added return */ } FLUSH_VERTICES(ctx, _NEW_RENDERMODE); ctx->Select.Buffer = buffer; ctx->Select.BufferSize = size; ctx->Select.BufferCount = 0; ctx->Select.HitFlag = GL_FALSE; ctx->Select.HitMinZ = 1.0; ctx->Select.HitMaxZ = 0.0; } /** * Write a value of a record into the selection buffer. * * \param CTX GL context. * \param V value. * * Verifies there is free space in the buffer to write the value and * increments the pointer. */ #define WRITE_RECORD( CTX, V ) \ if (CTX->Select.BufferCount < CTX->Select.BufferSize) { \ CTX->Select.Buffer[CTX->Select.BufferCount] = (V); \ } \ CTX->Select.BufferCount++; /** * Update the hit flag and the maximum and minimum depth values. * * \param ctx GL context. * \param z depth. * * Sets gl_selection::HitFlag and updates gl_selection::HitMinZ and * gl_selection::HitMaxZ. */ void _mesa_update_hitflag( GLcontext *ctx, GLfloat z ) { ctx->Select.HitFlag = GL_TRUE; if (z < ctx->Select.HitMinZ) { ctx->Select.HitMinZ = z; } if (z > ctx->Select.HitMaxZ) { ctx->Select.HitMaxZ = z; } } /** * Write the hit record. * * \param ctx GL context. * * Write the hit record, i.e., the number of names in the stack, the minimum and * maximum depth values and the number of names in the name stack at the time * of the event. Resets the hit flag. * * \sa gl_selection. */ static void write_hit_record( GLcontext *ctx ) { GLuint i; GLuint zmin, zmax, zscale = (~0u); /* HitMinZ and HitMaxZ are in [0,1]. Multiply these values by */ /* 2^32-1 and round to nearest unsigned integer. */ assert( ctx != NULL ); /* this line magically fixes a SunOS 5.x/gcc bug */ zmin = (GLuint) ((GLfloat) zscale * ctx->Select.HitMinZ); zmax = (GLuint) ((GLfloat) zscale * ctx->Select.HitMaxZ); WRITE_RECORD( ctx, ctx->Select.NameStackDepth ); WRITE_RECORD( ctx, zmin ); WRITE_RECORD( ctx, zmax ); for (i = 0; i < ctx->Select.NameStackDepth; i++) { WRITE_RECORD( ctx, ctx->Select.NameStack[i] ); } ctx->Select.Hits++; ctx->Select.HitFlag = GL_FALSE; ctx->Select.HitMinZ = 1.0; ctx->Select.HitMaxZ = -1.0; } /** * Initialize the name stack. * * Verifies we are in select mode and resets the name stack depth and resets * the hit record data in gl_selection. Marks new render mode in * __GLcontextRec::NewState. */ void GLAPIENTRY _mesa_InitNames( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* Record the hit before the HitFlag is wiped out again. */ if (ctx->RenderMode == GL_SELECT) { if (ctx->Select.HitFlag) { write_hit_record( ctx ); } } ctx->Select.NameStackDepth = 0; ctx->Select.HitFlag = GL_FALSE; ctx->Select.HitMinZ = 1.0; ctx->Select.HitMaxZ = 0.0; ctx->NewState |= _NEW_RENDERMODE; } /** * Load the top-most name of the name stack. * * \param name name. * * Verifies we are in selection mode and that the name stack is not empty. * Flushes vertices. If there is a hit flag writes it (via write_hit_record()), * and replace the top-most name in the stack. * * sa __GLcontextRec::Select. */ void GLAPIENTRY _mesa_LoadName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode != GL_SELECT) { return; } if (ctx->Select.NameStackDepth == 0) { _mesa_error( ctx, GL_INVALID_OPERATION, "glLoadName" ); return; } FLUSH_VERTICES(ctx, _NEW_RENDERMODE); if (ctx->Select.HitFlag) { write_hit_record( ctx ); } if (ctx->Select.NameStackDepth < MAX_NAME_STACK_DEPTH) { ctx->Select.NameStack[ctx->Select.NameStackDepth-1] = name; } else { ctx->Select.NameStack[MAX_NAME_STACK_DEPTH-1] = name; } } /** * Push a name into the name stack. * * \param name name. * * Verifies we are in selection mode and that the name stack is not full. * Flushes vertices. If there is a hit flag writes it (via write_hit_record()), * and adds the name to the top of the name stack. * * sa __GLcontextRec::Select. */ void GLAPIENTRY _mesa_PushName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode != GL_SELECT) { return; } FLUSH_VERTICES(ctx, _NEW_RENDERMODE); if (ctx->Select.HitFlag) { write_hit_record( ctx ); } if (ctx->Select.NameStackDepth >= MAX_NAME_STACK_DEPTH) { _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushName" ); } else ctx->Select.NameStack[ctx->Select.NameStackDepth++] = name; } /** * Pop a name into the name stack. * * Verifies we are in selection mode and that the name stack is not empty. * Flushes vertices. If there is a hit flag writes it (via write_hit_record()), * and removes top-most name in the name stack. * * sa __GLcontextRec::Select. */ void GLAPIENTRY _mesa_PopName( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode != GL_SELECT) { return; } FLUSH_VERTICES(ctx, _NEW_RENDERMODE); if (ctx->Select.HitFlag) { write_hit_record( ctx ); } if (ctx->Select.NameStackDepth == 0) { _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopName" ); } else ctx->Select.NameStackDepth--; } /*@}*/ /**********************************************************************/ /** \name Render Mode */ /*@{*/ /** * Set rasterization mode. * * \param mode rasterization mode. * * \note this function can't be put in a display list. * * \sa glRenderMode(). * * Flushes the vertices and do the necessary cleanup according to the previous * rasterization mode, such as writing the hit record or resent the select * buffer index when exiting the select mode. Updates * __GLcontextRec::RenderMode and notifies the driver via the * dd_function_table::RenderMode callback. */ GLint GLAPIENTRY _mesa_RenderMode( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); GLint result; ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glRenderMode %s\n", _mesa_lookup_enum_by_nr(mode)); FLUSH_VERTICES(ctx, _NEW_RENDERMODE); switch (ctx->RenderMode) { case GL_RENDER: result = 0; break; case GL_SELECT: if (ctx->Select.HitFlag) { write_hit_record( ctx ); } if (ctx->Select.BufferCount > ctx->Select.BufferSize) { /* overflow */ #ifdef DEBUG _mesa_warning(ctx, "Feedback buffer overflow"); #endif result = -1; } else { result = ctx->Select.Hits; } ctx->Select.BufferCount = 0; ctx->Select.Hits = 0; ctx->Select.NameStackDepth = 0; break; #if _HAVE_FULL_GL case GL_FEEDBACK: if (ctx->Feedback.Count > ctx->Feedback.BufferSize) { /* overflow */ result = -1; } else { result = ctx->Feedback.Count; } ctx->Feedback.Count = 0; break; #endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glRenderMode" ); return 0; } switch (mode) { case GL_RENDER: break; case GL_SELECT: if (ctx->Select.BufferSize==0) { /* haven't called glSelectBuffer yet */ _mesa_error( ctx, GL_INVALID_OPERATION, "glRenderMode" ); } break; #if _HAVE_FULL_GL case GL_FEEDBACK: if (ctx->Feedback.BufferSize==0) { /* haven't called glFeedbackBuffer yet */ _mesa_error( ctx, GL_INVALID_OPERATION, "glRenderMode" ); } break; #endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glRenderMode" ); return 0; } ctx->RenderMode = mode; if (ctx->Driver.RenderMode) ctx->Driver.RenderMode( ctx, mode ); return result; } /*@}*/ /**********************************************************************/ /** \name Initialization */ /*@{*/ /** * Initialize context feedback data. */ void _mesa_init_feedback( GLcontext * ctx ) { /* Feedback */ ctx->Feedback.Type = GL_2D; /* TODO: verify */ ctx->Feedback.Buffer = NULL; ctx->Feedback.BufferSize = 0; ctx->Feedback.Count = 0; /* Selection/picking */ ctx->Select.Buffer = NULL; ctx->Select.BufferSize = 0; ctx->Select.BufferCount = 0; ctx->Select.Hits = 0; ctx->Select.NameStackDepth = 0; /* Miscellaneous */ ctx->RenderMode = GL_RENDER; } /*@}*/ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/feedback.h0000644000000000000000000000447313614532424020046 0ustar /** * \file feedback.h * Selection and feedback modes functions. */ /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef FEEDBACK_H #define FEEDBACK_H #include "mtypes.h" #define FEEDBACK_TOKEN( CTX, T ) \ if (CTX->Feedback.Count < CTX->Feedback.BufferSize) { \ CTX->Feedback.Buffer[CTX->Feedback.Count] = (GLfloat) (T); \ } \ CTX->Feedback.Count++; extern void _mesa_init_feedback( GLcontext * ctx ); extern void _mesa_feedback_vertex( GLcontext *ctx, const GLfloat win[4], const GLfloat color[4], GLfloat index, const GLfloat texcoord[4] ); extern void _mesa_update_hitflag( GLcontext *ctx, GLfloat z ); extern void GLAPIENTRY _mesa_PassThrough( GLfloat token ); extern void GLAPIENTRY _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ); extern void GLAPIENTRY _mesa_SelectBuffer( GLsizei size, GLuint *buffer ); extern void GLAPIENTRY _mesa_InitNames( void ); extern void GLAPIENTRY _mesa_LoadName( GLuint name ); extern void GLAPIENTRY _mesa_PushName( GLuint name ); extern void GLAPIENTRY _mesa_PopName( void ); extern GLint GLAPIENTRY _mesa_RenderMode( GLenum mode ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/fog.c0000644000000000000000000001124513614532424017063 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "fog.h" #include "mtypes.h" void GLAPIENTRY _mesa_Fogf(GLenum pname, GLfloat param) { _mesa_Fogfv(pname, ¶m); } void GLAPIENTRY _mesa_Fogi(GLenum pname, GLint param ) { GLfloat fparam = (GLfloat) param; _mesa_Fogfv(pname, &fparam); } void GLAPIENTRY _mesa_Fogiv(GLenum pname, const GLint *params ) { GLfloat p[4]; switch (pname) { case GL_FOG_MODE: case GL_FOG_DENSITY: case GL_FOG_START: case GL_FOG_END: case GL_FOG_INDEX: case GL_FOG_COORDINATE_SOURCE_EXT: p[0] = (GLfloat) *params; break; case GL_FOG_COLOR: p[0] = INT_TO_FLOAT( params[0] ); p[1] = INT_TO_FLOAT( params[1] ); p[2] = INT_TO_FLOAT( params[2] ); p[3] = INT_TO_FLOAT( params[3] ); break; default: /* Error will be caught later in _mesa_Fogfv */ ; } _mesa_Fogfv(pname, p); } void GLAPIENTRY _mesa_Fogfv( GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); GLenum m; ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { case GL_FOG_MODE: m = (GLenum) (GLint) *params; switch (m) { case GL_LINEAR: case GL_EXP: case GL_EXP2: break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glFog" ); return; } if (ctx->Fog.Mode == m) return; FLUSH_VERTICES(ctx, _NEW_FOG); ctx->Fog.Mode = m; break; case GL_FOG_DENSITY: if (*params<0.0) { _mesa_error( ctx, GL_INVALID_VALUE, "glFog" ); return; } if (ctx->Fog.Density == *params) return; FLUSH_VERTICES(ctx, _NEW_FOG); ctx->Fog.Density = *params; break; case GL_FOG_START: if (ctx->Fog.Start == *params) return; FLUSH_VERTICES(ctx, _NEW_FOG); ctx->Fog.Start = *params; break; case GL_FOG_END: if (ctx->Fog.End == *params) return; FLUSH_VERTICES(ctx, _NEW_FOG); ctx->Fog.End = *params; break; case GL_FOG_INDEX: if (ctx->Fog.Index == *params) return; FLUSH_VERTICES(ctx, _NEW_FOG); ctx->Fog.Index = *params; break; case GL_FOG_COLOR: if (TEST_EQ_4V(ctx->Fog.Color, params)) return; FLUSH_VERTICES(ctx, _NEW_FOG); ctx->Fog.Color[0] = CLAMP(params[0], 0.0F, 1.0F); ctx->Fog.Color[1] = CLAMP(params[1], 0.0F, 1.0F); ctx->Fog.Color[2] = CLAMP(params[2], 0.0F, 1.0F); ctx->Fog.Color[3] = CLAMP(params[3], 0.0F, 1.0F); break; case GL_FOG_COORDINATE_SOURCE_EXT: { GLenum p = (GLenum) (GLint) *params; if (!ctx->Extensions.EXT_fog_coord || (p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT)) { _mesa_error(ctx, GL_INVALID_ENUM, "glFog"); return; } if (ctx->Fog.FogCoordinateSource == p) return; FLUSH_VERTICES(ctx, _NEW_FOG); ctx->Fog.FogCoordinateSource = p; break; } default: _mesa_error( ctx, GL_INVALID_ENUM, "glFog" ); return; } if (ctx->Driver.Fogfv) { (*ctx->Driver.Fogfv)( ctx, pname, params ); } } /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ void _mesa_init_fog( GLcontext * ctx ) { /* Fog group */ ctx->Fog.Enabled = GL_FALSE; ctx->Fog.Mode = GL_EXP; ASSIGN_4V( ctx->Fog.Color, 0.0, 0.0, 0.0, 0.0 ); ctx->Fog.Index = 0.0; ctx->Fog.Density = 1.0; ctx->Fog.Start = 0.0; ctx->Fog.End = 1.0; ctx->Fog.ColorSumEnabled = GL_FALSE; ctx->Fog.FogCoordinateSource = GL_FRAGMENT_DEPTH_EXT; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/fog.h0000644000000000000000000000327613614532424017075 0ustar /** * \file fog.h * Fog operations. * * \if subset * (No-op) * * \endif */ /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef FOG_H #define FOG_H #include "mtypes.h" #if _HAVE_FULL_GL extern void GLAPIENTRY _mesa_Fogf(GLenum pname, GLfloat param); extern void GLAPIENTRY _mesa_Fogi(GLenum pname, GLint param ); extern void GLAPIENTRY _mesa_Fogfv(GLenum pname, const GLfloat *params ); extern void GLAPIENTRY _mesa_Fogiv(GLenum pname, const GLint *params ); extern void _mesa_init_fog( GLcontext * ctx ); #else /** No-op */ #define _mesa_init_fog( c ) ((void)0) #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/framebuffer.c0000644000000000000000000003727213614532424020604 0ustar /* * Mesa 3-D graphics library * Version: 6.4 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * Functions for allocating/managing framebuffers and renderbuffers. * Also, routines for reading/writing renderbuffer data as ubytes, * ushorts, uints, etc. */ #include "glheader.h" #include "imports.h" #include "context.h" #include "mtypes.h" #include "fbobject.h" #include "framebuffer.h" #include "renderbuffer.h" /** * Compute/set the _DepthMax field for the given framebuffer. * This value depends on the Z buffer resolution. */ static void compute_depth_max(struct gl_framebuffer *fb) { if (fb->Visual.depthBits == 0) { /* Special case. Even if we don't have a depth buffer we need * good values for DepthMax for Z vertex transformation purposes * and for per-fragment fog computation. */ fb->_DepthMax = (1 << 16) - 1; } else if (fb->Visual.depthBits < 32) { fb->_DepthMax = (1 << fb->Visual.depthBits) - 1; } else { /* Special case since shift values greater than or equal to the * number of bits in the left hand expression's type are undefined. */ fb->_DepthMax = 0xffffffff; } fb->_DepthMaxF = (GLfloat) fb->_DepthMax; fb->_MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */ } /** * Create and initialize a gl_framebuffer object. * This is intended for creating _window_system_ framebuffers, not generic * framebuffer objects ala GL_EXT_framebuffer_object. * * \sa _mesa_new_framebuffer */ struct gl_framebuffer * _mesa_create_framebuffer(const GLvisual *visual) { struct gl_framebuffer *fb = CALLOC_STRUCT(gl_framebuffer); assert(visual); if (fb) { _mesa_initialize_framebuffer(fb, visual); } return fb; } /** * Allocate a new gl_framebuffer object. * This is the default function for ctx->Driver.NewFramebuffer(). * This is for allocating user-created framebuffers, not window-system * framebuffers! * \sa _mesa_create_framebuffer */ struct gl_framebuffer * _mesa_new_framebuffer(GLcontext *ctx, GLuint name) { struct gl_framebuffer *fb; assert(name != 0); fb = CALLOC_STRUCT(gl_framebuffer); if (fb) { fb->Name = name; fb->RefCount = 1; fb->Delete = _mesa_destroy_framebuffer; fb->ColorDrawBuffer[0] = GL_COLOR_ATTACHMENT0_EXT; fb->_ColorDrawBufferMask[0] = BUFFER_BIT_COLOR0; fb->ColorReadBuffer = GL_COLOR_ATTACHMENT0_EXT; fb->_ColorReadBufferMask = BUFFER_BIT_COLOR0; fb->Delete = _mesa_destroy_framebuffer; } return fb; } /** * Initialize a gl_framebuffer object. * \sa _mesa_create_framebuffer */ void _mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual *visual) { assert(fb); assert(visual); _mesa_bzero(fb, sizeof(struct gl_framebuffer)); /* save the visual */ fb->Visual = *visual; /* Init glRead/DrawBuffer state */ if (visual->doubleBufferMode) { fb->ColorDrawBuffer[0] = GL_BACK; fb->_ColorDrawBufferMask[0] = BUFFER_BIT_BACK_LEFT; fb->ColorReadBuffer = GL_BACK; fb->_ColorReadBufferMask = BUFFER_BIT_BACK_LEFT; } else { fb->ColorDrawBuffer[0] = GL_FRONT; fb->_ColorDrawBufferMask[0] = BUFFER_BIT_FRONT_LEFT; fb->ColorReadBuffer = GL_FRONT; fb->_ColorReadBufferMask = BUFFER_BIT_FRONT_LEFT; } fb->Delete = _mesa_destroy_framebuffer; fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT; compute_depth_max(fb); } /** * Create/attach software-based renderbuffers to the given framebuffer. * This is a helper routine for device drivers. Drivers can just as well * call the individual _mesa_add_*_renderbuffer() routines directly. */ void _mesa_add_soft_renderbuffers(struct gl_framebuffer *fb, GLboolean color, GLboolean depth, GLboolean stencil, GLboolean accum, GLboolean alpha, GLboolean aux) { GLboolean frontLeft = GL_TRUE; GLboolean backLeft = fb->Visual.doubleBufferMode; GLboolean frontRight = fb->Visual.stereoMode; GLboolean backRight = fb->Visual.stereoMode && fb->Visual.doubleBufferMode; if (color) { if (fb->Visual.rgbMode) { assert(fb->Visual.redBits == fb->Visual.greenBits); assert(fb->Visual.redBits == fb->Visual.blueBits); _mesa_add_color_renderbuffers(NULL, fb, fb->Visual.redBits, fb->Visual.alphaBits, frontLeft, backLeft, frontRight, backRight); } else { _mesa_add_color_index_renderbuffers(NULL, fb, fb->Visual.indexBits, frontLeft, backLeft, frontRight, backRight); } } if (depth) { assert(fb->Visual.depthBits > 0); _mesa_add_depth_renderbuffer(NULL, fb, fb->Visual.depthBits); } if (stencil) { assert(fb->Visual.stencilBits > 0); _mesa_add_stencil_renderbuffer(NULL, fb, fb->Visual.stencilBits); } if (accum) { assert(fb->Visual.rgbMode); assert(fb->Visual.accumRedBits > 0); assert(fb->Visual.accumGreenBits > 0); assert(fb->Visual.accumBlueBits > 0); _mesa_add_accum_renderbuffer(NULL, fb, fb->Visual.accumRedBits, fb->Visual.accumGreenBits, fb->Visual.accumBlueBits, fb->Visual.accumAlphaBits); } if (aux) { assert(fb->Visual.rgbMode); assert(fb->Visual.numAuxBuffers > 0); _mesa_add_aux_renderbuffers(NULL, fb, fb->Visual.redBits, fb->Visual.numAuxBuffers); } #if 1 if (alpha) { assert(fb->Visual.rgbMode); assert(fb->Visual.alphaBits > 0); _mesa_add_alpha_renderbuffers(NULL, fb, fb->Visual.alphaBits, frontLeft, backLeft, frontRight, backRight); } #endif #if 0 if (multisample) { /* maybe someday */ } #endif } /** * Deallocate buffer and everything attached to it. */ void _mesa_destroy_framebuffer(struct gl_framebuffer *buffer) { if (buffer) { _mesa_free_framebuffer_data(buffer); FREE(buffer); } } /** * Free all the data hanging off the given gl_framebuffer, but don't free * the gl_framebuffer object itself. */ void _mesa_free_framebuffer_data(struct gl_framebuffer *fb) { GLuint i; assert(fb); for (i = 0; i < BUFFER_COUNT; i++) { struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; if (att->Type == GL_RENDERBUFFER_EXT && att->Renderbuffer) { struct gl_renderbuffer *rb = att->Renderbuffer; rb->RefCount--; if (rb->RefCount == 0) { rb->Delete(rb); } } att->Type = GL_NONE; att->Renderbuffer = NULL; } } /** * Resize the given framebuffer's renderbuffers to the new width and height. * This should only be used for window-system framebuffers, not * user-created renderbuffers (i.e. made with GL_EXT_framebuffer_object). * This will typically be called via ctx->Driver.ResizeBuffers() */ void _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, GLuint width, GLuint height) { GLuint i; /* For window system framebuffers, Name is zero */ assert(fb->Name == 0); for (i = 0; i < BUFFER_COUNT; i++) { struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; if (att->Type == GL_RENDERBUFFER_EXT && att->Renderbuffer) { struct gl_renderbuffer *rb = att->Renderbuffer; /* only resize if size is changing */ if (rb->Width != width || rb->Height != height) { if (rb->AllocStorage(ctx, rb, rb->InternalFormat, width, height)) { rb->Width = width; rb->Height = height; } else { _mesa_error(ctx, GL_OUT_OF_MEMORY, "Resizing framebuffer"); } } } } fb->Width = width; fb->Height = height; /* to update scissor / window bounds */ if (ctx) ctx->NewState |= _NEW_BUFFERS; } /** * Examine all the framebuffer's renderbuffers to update the Width/Height * fields of the framebuffer. If we have renderbuffers with different * sizes, set the framebuffer's width and height to zero. * Note: this is only intended for user-created framebuffers, not * window-system framebuffes. */ static void update_framebuffer_size(struct gl_framebuffer *fb) { GLboolean haveSize = GL_FALSE; GLuint i; /* user-created framebuffers only */ assert(fb->Name); for (i = 0; i < BUFFER_COUNT; i++) { struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; const struct gl_renderbuffer *rb = att->Renderbuffer; if (rb) { if (haveSize) { if (rb->Width != fb->Width && rb->Height != fb->Height) { /* size mismatch! */ fb->Width = 0; fb->Height = 0; return; } } else { fb->Width = rb->Width; fb->Height = rb->Height; haveSize = GL_TRUE; } } } } /** * Update the context's current drawing buffer's Xmin, Xmax, Ymin, Ymax fields. * These values are computed from the buffer's width and height and * the scissor box, if it's enabled. * \param ctx the GL context. */ void _mesa_update_draw_buffer_bounds(GLcontext *ctx) { struct gl_framebuffer *buffer = ctx->DrawBuffer; if (buffer->Name) { /* user-created framebuffer size depends on the renderbuffers */ update_framebuffer_size(buffer); } buffer->_Xmin = 0; buffer->_Ymin = 0; buffer->_Xmax = buffer->Width; buffer->_Ymax = buffer->Height; if (ctx->Scissor.Enabled) { if (ctx->Scissor.X > buffer->_Xmin) { buffer->_Xmin = ctx->Scissor.X; } if (ctx->Scissor.Y > buffer->_Ymin) { buffer->_Ymin = ctx->Scissor.Y; } if (ctx->Scissor.X + ctx->Scissor.Width < buffer->_Xmax) { buffer->_Xmax = ctx->Scissor.X + ctx->Scissor.Width; } if (ctx->Scissor.Y + ctx->Scissor.Height < buffer->_Ymax) { buffer->_Ymax = ctx->Scissor.Y + ctx->Scissor.Height; } /* finally, check for empty region */ if (buffer->_Xmin > buffer->_Xmax) { buffer->_Xmin = buffer->_Xmax; } if (buffer->_Ymin > buffer->_Ymax) { buffer->_Ymin = buffer->_Ymax; } } ASSERT(buffer->_Xmin <= buffer->_Xmax); ASSERT(buffer->_Ymin <= buffer->_Ymax); } /** * The glGet queries of the framebuffer red/green/blue size, stencil size, * etc. are satisfied by the fields of ctx->DrawBuffer->Visual. These can * change depending on the renderbuffer bindings. This function update's * the given framebuffer's Visual from the current renderbuffer bindings. * This is only intended for user-created framebuffers. */ void _mesa_update_framebuffer_visual(struct gl_framebuffer *fb) { GLuint i; assert(fb->Name != 0); _mesa_bzero(&fb->Visual, sizeof(fb->Visual)); fb->Visual.rgbMode = GL_TRUE; /* find first RGB or CI renderbuffer */ for (i = 0; i < BUFFER_COUNT; i++) { if (fb->Attachment[i].Renderbuffer) { const struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer; if (rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB) { fb->Visual.redBits = rb->ComponentSizes[0]; fb->Visual.greenBits = rb->ComponentSizes[1]; fb->Visual.blueBits = rb->ComponentSizes[2]; fb->Visual.alphaBits = rb->ComponentSizes[3]; fb->Visual.floatMode = GL_FALSE; break; } else if (rb->_BaseFormat == GL_COLOR_INDEX) { fb->Visual.indexBits = rb->ComponentSizes[0]; fb->Visual.rgbMode = GL_FALSE; break; } } } if (fb->Attachment[BUFFER_DEPTH].Renderbuffer) { fb->Visual.haveDepthBuffer = GL_TRUE; fb->Visual.depthBits = fb->Attachment[BUFFER_DEPTH].Renderbuffer->ComponentSizes[0]; } if (fb->Attachment[BUFFER_STENCIL].Renderbuffer) { fb->Visual.haveStencilBuffer = GL_TRUE; fb->Visual.stencilBits = fb->Attachment[BUFFER_STENCIL].Renderbuffer->ComponentSizes[0]; } compute_depth_max(fb); } /** * Given a framebuffer and a buffer bit (like BUFFER_BIT_FRONT_LEFT), return * the corresponding renderbuffer. */ static struct gl_renderbuffer * get_renderbuffer(struct gl_framebuffer *fb, GLuint bufferBit) { GLuint index; for (index = 0; index < BUFFER_COUNT; index++) { if ((1 << index) == bufferBit) { return fb->Attachment[index].Renderbuffer; } } _mesa_problem(NULL, "Bad bufferBit in get_renderbuffer"); return NULL; } /** * Update state related to the current draw/read framebuffers. * If the current framebuffer is user-created, make sure it's complete. */ void _mesa_update_framebuffer(GLcontext *ctx) { struct gl_framebuffer *fb = ctx->DrawBuffer; GLuint output; /* Completeness only matters for user-created framebuffers */ if (fb->Name != 0) { _mesa_test_framebuffer_completeness(ctx, fb); _mesa_update_framebuffer_visual(fb); } /* * Update the list of drawing renderbuffer pointers. * Later, when we're rendering we'll loop from 0 to _NumColorDrawBuffers * writing colors. We have a loop because glDrawBuffer(GL_FRONT_AND_BACK) * can specify writing to two or four color buffers. */ for (output = 0; output < ctx->Const.MaxDrawBuffers; output++) { GLuint bufferMask = fb->_ColorDrawBufferMask[output]; GLuint count = 0; GLuint bufferBit; /* for each bit that's set in the bufferMask... */ for (bufferBit = 1; bufferMask; bufferBit <<= 1) { if (bufferBit & bufferMask) { struct gl_renderbuffer *rb = get_renderbuffer(fb, bufferBit); if (rb) { fb->_ColorDrawBuffers[output][count] = rb; fb->_ColorDrawBit[output][count] = bufferBit; count++; } else { /*_mesa_warning(ctx, "DrawBuffer names a missing buffer!");*/ } bufferMask &= ~bufferBit; } } fb->_NumColorDrawBuffers[output] = count; } /* * Update the read renderbuffer pointer. * Unlike the DrawBuffer, we can only read from one (or zero) color buffers. */ if (fb->_ColorReadBufferMask == 0x0) fb->_ColorReadBuffer = NULL; /* legal! */ else fb->_ColorReadBuffer = get_renderbuffer(fb, fb->_ColorReadBufferMask); compute_depth_max(fb); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/framebuffer.h0000644000000000000000000000442013614532424020576 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef FRAMEBUFFER_H #define FRAMEBUFFER_H extern struct gl_framebuffer * _mesa_create_framebuffer(const GLvisual *visual); extern struct gl_framebuffer * _mesa_new_framebuffer(GLcontext *ctx, GLuint name); extern void _mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual *visual); extern void _mesa_add_soft_renderbuffers(struct gl_framebuffer *fb, GLboolean color, GLboolean depth, GLboolean stencil, GLboolean accum, GLboolean alpha, GLboolean aux); extern void _mesa_destroy_framebuffer(struct gl_framebuffer *buffer); extern void _mesa_free_framebuffer_data(struct gl_framebuffer *buffer); extern void _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *b, GLuint width, GLuint height); extern void _mesa_update_draw_buffer_bounds(GLcontext *ctx); extern void _mesa_update_framebuffer_visual(struct gl_framebuffer *fb); extern void _mesa_update_framebuffer(GLcontext *ctx); #endif /* FRAMEBUFFER_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/get.c0000644000000000000000000065561613614532424017107 0ustar /*** *** NOTE!!! DO NOT EDIT THIS FILE!!! IT IS GENERATED BY get_gen.py ***/ #include "glheader.h" #include "context.h" #include "enable.h" #include "extensions.h" #include "fbobject.h" #include "get.h" #include "macros.h" #include "mtypes.h" #include "state.h" #include "texcompress.h" #define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE ) #define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE ) #define ENUM_TO_BOOLEAN(E) ( (E) ? GL_TRUE : GL_FALSE ) #define ENUM_TO_INT(E) ( (GLint) (E) ) #define ENUM_TO_FLOAT(E) ( (GLfloat) (E) ) #define BOOLEAN_TO_INT(B) ( (GLint) (B) ) #define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F ) /* Check if named extension is enabled, if not generate error and return */ #define CHECK1(E1, str, PNAME) \ if (!ctx->Extensions.E1) { \ _mesa_error(ctx, GL_INVALID_VALUE, \ "glGet" str "v(0x%x)", (int) PNAME); \ return; \ } #define CHECK2(E1, E2, str, PNAME) \ if (!ctx->Extensions.E1 && !ctx->Extensions.E2) { \ _mesa_error(ctx, GL_INVALID_VALUE, \ "glGet" str "v(0x%x)", (int) PNAME); \ return; \ } #define CHECK_EXTENSION_B(EXTNAME, PNAME) \ CHECK1(EXTNAME, "Boolean", PNAME ) #define CHECK_EXTENSION_I(EXTNAME, PNAME) \ CHECK1(EXTNAME, "Integer", PNAME ) #define CHECK_EXTENSION_F(EXTNAME, PNAME) \ CHECK1(EXTNAME, "Float", PNAME ) /** * Helper routine. */ static GLenum pixel_texgen_mode(const GLcontext *ctx) { if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_POSITION) { if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { return GL_RGBA; } else { return GL_RGB; } } else { if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { return GL_ALPHA; } else { return GL_NONE; } } } void GLAPIENTRY _mesa_GetBooleanv( GLenum pname, GLboolean *params ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (!params) return; if (ctx->NewState) _mesa_update_state(ctx); if (ctx->Driver.GetBooleanv && ctx->Driver.GetBooleanv(ctx, pname, params)) return; switch (pname) { case GL_ACCUM_RED_BITS: params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumRedBits); break; case GL_ACCUM_GREEN_BITS: params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumGreenBits); break; case GL_ACCUM_BLUE_BITS: params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumBlueBits); break; case GL_ACCUM_ALPHA_BITS: params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumAlphaBits); break; case GL_ACCUM_CLEAR_VALUE: params[0] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[2]); params[3] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[3]); break; case GL_ALPHA_BIAS: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaBias); break; case GL_ALPHA_BITS: params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.alphaBits); break; case GL_ALPHA_SCALE: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaScale); break; case GL_ALPHA_TEST: params[0] = ctx->Color.AlphaEnabled; break; case GL_ALPHA_TEST_FUNC: params[0] = ENUM_TO_BOOLEAN(ctx->Color.AlphaFunc); break; case GL_ALPHA_TEST_REF: params[0] = FLOAT_TO_BOOLEAN(ctx->Color.AlphaRef); break; case GL_ATTRIB_STACK_DEPTH: params[0] = INT_TO_BOOLEAN(ctx->AttribStackDepth); break; case GL_AUTO_NORMAL: params[0] = ctx->Eval.AutoNormal; break; case GL_AUX_BUFFERS: params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.numAuxBuffers); break; case GL_BLEND: params[0] = ctx->Color.BlendEnabled; break; case GL_BLEND_DST: params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstRGB); break; case GL_BLEND_SRC: params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcRGB); break; case GL_BLEND_SRC_RGB_EXT: params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcRGB); break; case GL_BLEND_DST_RGB_EXT: params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstRGB); break; case GL_BLEND_SRC_ALPHA_EXT: params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcA); break; case GL_BLEND_DST_ALPHA_EXT: params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstA); break; case GL_BLEND_EQUATION: params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendEquationRGB ); break; case GL_BLEND_EQUATION_ALPHA_EXT: params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendEquationA ); break; case GL_BLEND_COLOR_EXT: params[0] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[2]); params[3] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[3]); break; case GL_BLUE_BIAS: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueBias); break; case GL_BLUE_BITS: params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.blueBits); break; case GL_BLUE_SCALE: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueScale); break; case GL_CLIENT_ATTRIB_STACK_DEPTH: params[0] = INT_TO_BOOLEAN(ctx->ClientAttribStackDepth); break; case GL_CLIP_PLANE0: params[0] = (ctx->Transform.ClipPlanesEnabled >> 0) & 1; break; case GL_CLIP_PLANE1: params[0] = (ctx->Transform.ClipPlanesEnabled >> 1) & 1; break; case GL_CLIP_PLANE2: params[0] = (ctx->Transform.ClipPlanesEnabled >> 2) & 1; break; case GL_CLIP_PLANE3: params[0] = (ctx->Transform.ClipPlanesEnabled >> 3) & 1; break; case GL_CLIP_PLANE4: params[0] = (ctx->Transform.ClipPlanesEnabled >> 4) & 1; break; case GL_CLIP_PLANE5: params[0] = (ctx->Transform.ClipPlanesEnabled >> 5) & 1; break; case GL_COLOR_CLEAR_VALUE: params[0] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[2]); params[3] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[3]); break; case GL_COLOR_MATERIAL: params[0] = ctx->Light.ColorMaterialEnabled; break; case GL_COLOR_MATERIAL_FACE: params[0] = ENUM_TO_BOOLEAN(ctx->Light.ColorMaterialFace); break; case GL_COLOR_MATERIAL_PARAMETER: params[0] = ENUM_TO_BOOLEAN(ctx->Light.ColorMaterialMode); break; case GL_COLOR_WRITEMASK: params[0] = INT_TO_BOOLEAN(ctx->Color.ColorMask[RCOMP] ? 1 : 0); params[1] = INT_TO_BOOLEAN(ctx->Color.ColorMask[GCOMP] ? 1 : 0); params[2] = INT_TO_BOOLEAN(ctx->Color.ColorMask[BCOMP] ? 1 : 0); params[3] = INT_TO_BOOLEAN(ctx->Color.ColorMask[ACOMP] ? 1 : 0); break; case GL_CULL_FACE: params[0] = ctx->Polygon.CullFlag; break; case GL_CULL_FACE_MODE: params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.CullFaceMode); break; case GL_CURRENT_COLOR: { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); } break; case GL_CURRENT_INDEX: { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Index); } break; case GL_CURRENT_NORMAL: { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); } break; case GL_CURRENT_RASTER_COLOR: params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[2]); params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[3]); break; case GL_CURRENT_RASTER_DISTANCE: params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterDistance); break; case GL_CURRENT_RASTER_INDEX: params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterIndex); break; case GL_CURRENT_RASTER_POSITION: params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[2]); params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[3]); break; case GL_CURRENT_RASTER_TEXTURE_COORDS: { const GLuint texUnit = ctx->Texture.CurrentUnit; params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][2]); params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[texUnit][3]); } break; case GL_CURRENT_RASTER_POSITION_VALID: params[0] = ctx->Current.RasterPosValid; break; case GL_CURRENT_TEXTURE_COORDS: { const GLuint texUnit = ctx->Texture.CurrentUnit; params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]); params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]); } break; case GL_DEPTH_BIAS: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.DepthBias); break; case GL_DEPTH_BITS: params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.depthBits); break; case GL_DEPTH_CLEAR_VALUE: params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.Clear); break; case GL_DEPTH_FUNC: params[0] = ENUM_TO_BOOLEAN(ctx->Depth.Func); break; case GL_DEPTH_RANGE: params[0] = FLOAT_TO_BOOLEAN(ctx->Viewport.Near); params[1] = FLOAT_TO_BOOLEAN(ctx->Viewport.Far); break; case GL_DEPTH_SCALE: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.DepthScale); break; case GL_DEPTH_TEST: params[0] = ctx->Depth.Test; break; case GL_DEPTH_WRITEMASK: params[0] = ctx->Depth.Mask; break; case GL_DITHER: params[0] = ctx->Color.DitherFlag; break; case GL_DOUBLEBUFFER: params[0] = ctx->DrawBuffer->Visual.doubleBufferMode; break; case GL_DRAW_BUFFER: params[0] = ENUM_TO_BOOLEAN(ctx->Color.DrawBuffer[0]); break; case GL_EDGE_FLAG: { FLUSH_CURRENT(ctx, 0); params[0] = ctx->Current.EdgeFlag; } break; case GL_FEEDBACK_BUFFER_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Feedback.BufferSize); break; case GL_FEEDBACK_BUFFER_TYPE: params[0] = ENUM_TO_BOOLEAN(ctx->Feedback.Type); break; case GL_FOG: params[0] = ctx->Fog.Enabled; break; case GL_FOG_COLOR: params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[2]); params[3] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[3]); break; case GL_FOG_DENSITY: params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Density); break; case GL_FOG_END: params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.End); break; case GL_FOG_HINT: params[0] = ENUM_TO_BOOLEAN(ctx->Hint.Fog); break; case GL_FOG_INDEX: params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Index); break; case GL_FOG_MODE: params[0] = ENUM_TO_BOOLEAN(ctx->Fog.Mode); break; case GL_FOG_START: params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Start); break; case GL_FRONT_FACE: params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.FrontFace); break; case GL_GREEN_BIAS: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenBias); break; case GL_GREEN_BITS: params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.greenBits); break; case GL_GREEN_SCALE: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenScale); break; case GL_INDEX_BITS: params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.indexBits); break; case GL_INDEX_CLEAR_VALUE: params[0] = INT_TO_BOOLEAN(ctx->Color.ClearIndex); break; case GL_INDEX_MODE: params[0] = !ctx->DrawBuffer->Visual.rgbMode; break; case GL_INDEX_OFFSET: params[0] = INT_TO_BOOLEAN(ctx->Pixel.IndexOffset); break; case GL_INDEX_SHIFT: params[0] = INT_TO_BOOLEAN(ctx->Pixel.IndexShift); break; case GL_INDEX_WRITEMASK: params[0] = INT_TO_BOOLEAN(ctx->Color.IndexMask); break; case GL_LIGHT0: params[0] = ctx->Light.Light[0].Enabled; break; case GL_LIGHT1: params[0] = ctx->Light.Light[1].Enabled; break; case GL_LIGHT2: params[0] = ctx->Light.Light[2].Enabled; break; case GL_LIGHT3: params[0] = ctx->Light.Light[3].Enabled; break; case GL_LIGHT4: params[0] = ctx->Light.Light[4].Enabled; break; case GL_LIGHT5: params[0] = ctx->Light.Light[5].Enabled; break; case GL_LIGHT6: params[0] = ctx->Light.Light[6].Enabled; break; case GL_LIGHT7: params[0] = ctx->Light.Light[7].Enabled; break; case GL_LIGHTING: params[0] = ctx->Light.Enabled; break; case GL_LIGHT_MODEL_AMBIENT: params[0] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[2]); params[3] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[3]); break; case GL_LIGHT_MODEL_COLOR_CONTROL: params[0] = ENUM_TO_BOOLEAN(ctx->Light.Model.ColorControl); break; case GL_LIGHT_MODEL_LOCAL_VIEWER: params[0] = ctx->Light.Model.LocalViewer; break; case GL_LIGHT_MODEL_TWO_SIDE: params[0] = ctx->Light.Model.TwoSide; break; case GL_LINE_SMOOTH: params[0] = ctx->Line.SmoothFlag; break; case GL_LINE_SMOOTH_HINT: params[0] = ENUM_TO_BOOLEAN(ctx->Hint.LineSmooth); break; case GL_LINE_STIPPLE: params[0] = ctx->Line.StippleFlag; break; case GL_LINE_STIPPLE_PATTERN: params[0] = INT_TO_BOOLEAN(ctx->Line.StipplePattern); break; case GL_LINE_STIPPLE_REPEAT: params[0] = INT_TO_BOOLEAN(ctx->Line.StippleFactor); break; case GL_LINE_WIDTH: params[0] = FLOAT_TO_BOOLEAN(ctx->Line.Width); break; case GL_LINE_WIDTH_GRANULARITY: params[0] = FLOAT_TO_BOOLEAN(ctx->Const.LineWidthGranularity); break; case GL_LINE_WIDTH_RANGE: params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinLineWidthAA); params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxLineWidthAA); break; case GL_ALIASED_LINE_WIDTH_RANGE: params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinLineWidth); params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxLineWidth); break; case GL_LIST_BASE: params[0] = INT_TO_BOOLEAN(ctx->List.ListBase); break; case GL_LIST_INDEX: params[0] = INT_TO_BOOLEAN(ctx->ListState.CurrentListNum); break; case GL_LIST_MODE: { GLenum mode; if (!ctx->CompileFlag) mode = 0; else if (ctx->ExecuteFlag) mode = GL_COMPILE_AND_EXECUTE; else mode = GL_COMPILE; params[0] = ENUM_TO_BOOLEAN(mode); } break; case GL_INDEX_LOGIC_OP: params[0] = ctx->Color.IndexLogicOpEnabled; break; case GL_COLOR_LOGIC_OP: params[0] = ctx->Color.ColorLogicOpEnabled; break; case GL_LOGIC_OP_MODE: params[0] = ENUM_TO_BOOLEAN(ctx->Color.LogicOp); break; case GL_MAP1_COLOR_4: params[0] = ctx->Eval.Map1Color4; break; case GL_MAP1_GRID_DOMAIN: params[0] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid1u1); params[1] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid1u2); break; case GL_MAP1_GRID_SEGMENTS: params[0] = INT_TO_BOOLEAN(ctx->Eval.MapGrid1un); break; case GL_MAP1_INDEX: params[0] = ctx->Eval.Map1Index; break; case GL_MAP1_NORMAL: params[0] = ctx->Eval.Map1Normal; break; case GL_MAP1_TEXTURE_COORD_1: params[0] = ctx->Eval.Map1TextureCoord1; break; case GL_MAP1_TEXTURE_COORD_2: params[0] = ctx->Eval.Map1TextureCoord2; break; case GL_MAP1_TEXTURE_COORD_3: params[0] = ctx->Eval.Map1TextureCoord3; break; case GL_MAP1_TEXTURE_COORD_4: params[0] = ctx->Eval.Map1TextureCoord4; break; case GL_MAP1_VERTEX_3: params[0] = ctx->Eval.Map1Vertex3; break; case GL_MAP1_VERTEX_4: params[0] = ctx->Eval.Map1Vertex4; break; case GL_MAP2_COLOR_4: params[0] = ctx->Eval.Map2Color4; break; case GL_MAP2_GRID_DOMAIN: params[0] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2u1); params[1] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2u2); params[2] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2v1); params[3] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2v2); break; case GL_MAP2_GRID_SEGMENTS: params[0] = INT_TO_BOOLEAN(ctx->Eval.MapGrid2un); params[1] = INT_TO_BOOLEAN(ctx->Eval.MapGrid2vn); break; case GL_MAP2_INDEX: params[0] = ctx->Eval.Map2Index; break; case GL_MAP2_NORMAL: params[0] = ctx->Eval.Map2Normal; break; case GL_MAP2_TEXTURE_COORD_1: params[0] = ctx->Eval.Map2TextureCoord1; break; case GL_MAP2_TEXTURE_COORD_2: params[0] = ctx->Eval.Map2TextureCoord2; break; case GL_MAP2_TEXTURE_COORD_3: params[0] = ctx->Eval.Map2TextureCoord3; break; case GL_MAP2_TEXTURE_COORD_4: params[0] = ctx->Eval.Map2TextureCoord4; break; case GL_MAP2_VERTEX_3: params[0] = ctx->Eval.Map2Vertex3; break; case GL_MAP2_VERTEX_4: params[0] = ctx->Eval.Map2Vertex4; break; case GL_MAP_COLOR: params[0] = ctx->Pixel.MapColorFlag; break; case GL_MAP_STENCIL: params[0] = ctx->Pixel.MapStencilFlag; break; case GL_MATRIX_MODE: params[0] = ENUM_TO_BOOLEAN(ctx->Transform.MatrixMode); break; case GL_MAX_ATTRIB_STACK_DEPTH: params[0] = INT_TO_BOOLEAN(MAX_ATTRIB_STACK_DEPTH); break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: params[0] = INT_TO_BOOLEAN(MAX_CLIENT_ATTRIB_STACK_DEPTH); break; case GL_MAX_CLIP_PLANES: params[0] = INT_TO_BOOLEAN(ctx->Const.MaxClipPlanes); break; case GL_MAX_ELEMENTS_VERTICES: params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayLockSize); break; case GL_MAX_ELEMENTS_INDICES: params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayLockSize); break; case GL_MAX_EVAL_ORDER: params[0] = INT_TO_BOOLEAN(MAX_EVAL_ORDER); break; case GL_MAX_LIGHTS: params[0] = INT_TO_BOOLEAN(ctx->Const.MaxLights); break; case GL_MAX_LIST_NESTING: params[0] = INT_TO_BOOLEAN(MAX_LIST_NESTING); break; case GL_MAX_MODELVIEW_STACK_DEPTH: params[0] = INT_TO_BOOLEAN(MAX_MODELVIEW_STACK_DEPTH); break; case GL_MAX_NAME_STACK_DEPTH: params[0] = INT_TO_BOOLEAN(MAX_NAME_STACK_DEPTH); break; case GL_MAX_PIXEL_MAP_TABLE: params[0] = INT_TO_BOOLEAN(MAX_PIXEL_MAP_TABLE); break; case GL_MAX_PROJECTION_STACK_DEPTH: params[0] = INT_TO_BOOLEAN(MAX_PROJECTION_STACK_DEPTH); break; case GL_MAX_TEXTURE_SIZE: params[0] = INT_TO_BOOLEAN(1 << (ctx->Const.MaxTextureLevels - 1)); break; case GL_MAX_3D_TEXTURE_SIZE: params[0] = INT_TO_BOOLEAN(1 << (ctx->Const.Max3DTextureLevels - 1)); break; case GL_MAX_TEXTURE_STACK_DEPTH: params[0] = INT_TO_BOOLEAN(MAX_TEXTURE_STACK_DEPTH); break; case GL_MAX_VIEWPORT_DIMS: params[0] = INT_TO_BOOLEAN(ctx->Const.MaxViewportWidth); params[1] = INT_TO_BOOLEAN(ctx->Const.MaxViewportHeight); break; case GL_MODELVIEW_MATRIX: { const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; params[0] = FLOAT_TO_BOOLEAN(matrix[0]); params[1] = FLOAT_TO_BOOLEAN(matrix[1]); params[2] = FLOAT_TO_BOOLEAN(matrix[2]); params[3] = FLOAT_TO_BOOLEAN(matrix[3]); params[4] = FLOAT_TO_BOOLEAN(matrix[4]); params[5] = FLOAT_TO_BOOLEAN(matrix[5]); params[6] = FLOAT_TO_BOOLEAN(matrix[6]); params[7] = FLOAT_TO_BOOLEAN(matrix[7]); params[8] = FLOAT_TO_BOOLEAN(matrix[8]); params[9] = FLOAT_TO_BOOLEAN(matrix[9]); params[10] = FLOAT_TO_BOOLEAN(matrix[10]); params[11] = FLOAT_TO_BOOLEAN(matrix[11]); params[12] = FLOAT_TO_BOOLEAN(matrix[12]); params[13] = FLOAT_TO_BOOLEAN(matrix[13]); params[14] = FLOAT_TO_BOOLEAN(matrix[14]); params[15] = FLOAT_TO_BOOLEAN(matrix[15]); } break; case GL_MODELVIEW_STACK_DEPTH: params[0] = INT_TO_BOOLEAN(ctx->ModelviewMatrixStack.Depth + 1); break; case GL_NAME_STACK_DEPTH: params[0] = INT_TO_BOOLEAN(ctx->Select.NameStackDepth); break; case GL_NORMALIZE: params[0] = ctx->Transform.Normalize; break; case GL_PACK_ALIGNMENT: params[0] = INT_TO_BOOLEAN(ctx->Pack.Alignment); break; case GL_PACK_LSB_FIRST: params[0] = ctx->Pack.LsbFirst; break; case GL_PACK_ROW_LENGTH: params[0] = INT_TO_BOOLEAN(ctx->Pack.RowLength); break; case GL_PACK_SKIP_PIXELS: params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipPixels); break; case GL_PACK_SKIP_ROWS: params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipRows); break; case GL_PACK_SWAP_BYTES: params[0] = ctx->Pack.SwapBytes; break; case GL_PACK_SKIP_IMAGES_EXT: params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipImages); break; case GL_PACK_IMAGE_HEIGHT_EXT: params[0] = INT_TO_BOOLEAN(ctx->Pack.ImageHeight); break; case GL_PACK_INVERT_MESA: params[0] = ctx->Pack.Invert; break; case GL_PERSPECTIVE_CORRECTION_HINT: params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PerspectiveCorrection); break; case GL_PIXEL_MAP_A_TO_A_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapAtoAsize); break; case GL_PIXEL_MAP_B_TO_B_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapBtoBsize); break; case GL_PIXEL_MAP_G_TO_G_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapGtoGsize); break; case GL_PIXEL_MAP_I_TO_A_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoAsize); break; case GL_PIXEL_MAP_I_TO_B_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoBsize); break; case GL_PIXEL_MAP_I_TO_G_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoGsize); break; case GL_PIXEL_MAP_I_TO_I_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoIsize); break; case GL_PIXEL_MAP_I_TO_R_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoRsize); break; case GL_PIXEL_MAP_R_TO_R_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapRtoRsize); break; case GL_PIXEL_MAP_S_TO_S_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapStoSsize); break; case GL_POINT_SIZE: params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Size); break; case GL_POINT_SIZE_GRANULARITY: params[0] = FLOAT_TO_BOOLEAN(ctx->Const.PointSizeGranularity); break; case GL_POINT_SIZE_RANGE: params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinPointSizeAA); params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxPointSizeAA); break; case GL_ALIASED_POINT_SIZE_RANGE: params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinPointSize); params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxPointSize); break; case GL_POINT_SMOOTH: params[0] = ctx->Point.SmoothFlag; break; case GL_POINT_SMOOTH_HINT: params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PointSmooth); break; case GL_POINT_SIZE_MIN_EXT: params[0] = FLOAT_TO_BOOLEAN(ctx->Point.MinSize); break; case GL_POINT_SIZE_MAX_EXT: params[0] = FLOAT_TO_BOOLEAN(ctx->Point.MaxSize); break; case GL_POINT_FADE_THRESHOLD_SIZE_EXT: params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Threshold); break; case GL_DISTANCE_ATTENUATION_EXT: params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Params[0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Point.Params[1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Point.Params[2]); break; case GL_POLYGON_MODE: params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.FrontMode); params[1] = ENUM_TO_BOOLEAN(ctx->Polygon.BackMode); break; case GL_POLYGON_OFFSET_BIAS_EXT: params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetUnits); break; case GL_POLYGON_OFFSET_FACTOR: params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetFactor ); break; case GL_POLYGON_OFFSET_UNITS: params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetUnits ); break; case GL_POLYGON_SMOOTH: params[0] = ctx->Polygon.SmoothFlag; break; case GL_POLYGON_SMOOTH_HINT: params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PolygonSmooth); break; case GL_POLYGON_STIPPLE: params[0] = ctx->Polygon.StippleFlag; break; case GL_PROJECTION_MATRIX: { const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; params[0] = FLOAT_TO_BOOLEAN(matrix[0]); params[1] = FLOAT_TO_BOOLEAN(matrix[1]); params[2] = FLOAT_TO_BOOLEAN(matrix[2]); params[3] = FLOAT_TO_BOOLEAN(matrix[3]); params[4] = FLOAT_TO_BOOLEAN(matrix[4]); params[5] = FLOAT_TO_BOOLEAN(matrix[5]); params[6] = FLOAT_TO_BOOLEAN(matrix[6]); params[7] = FLOAT_TO_BOOLEAN(matrix[7]); params[8] = FLOAT_TO_BOOLEAN(matrix[8]); params[9] = FLOAT_TO_BOOLEAN(matrix[9]); params[10] = FLOAT_TO_BOOLEAN(matrix[10]); params[11] = FLOAT_TO_BOOLEAN(matrix[11]); params[12] = FLOAT_TO_BOOLEAN(matrix[12]); params[13] = FLOAT_TO_BOOLEAN(matrix[13]); params[14] = FLOAT_TO_BOOLEAN(matrix[14]); params[15] = FLOAT_TO_BOOLEAN(matrix[15]); } break; case GL_PROJECTION_STACK_DEPTH: params[0] = INT_TO_BOOLEAN(ctx->ProjectionMatrixStack.Depth + 1); break; case GL_READ_BUFFER: params[0] = ENUM_TO_BOOLEAN(ctx->Pixel.ReadBuffer); break; case GL_RED_BIAS: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedBias); break; case GL_RED_BITS: params[0] = INT_TO_BOOLEAN( ctx->DrawBuffer->Visual.redBits ); break; case GL_RED_SCALE: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedScale); break; case GL_RENDER_MODE: params[0] = ENUM_TO_BOOLEAN(ctx->RenderMode); break; case GL_RESCALE_NORMAL: params[0] = ctx->Transform.RescaleNormals; break; case GL_RGBA_MODE: params[0] = ctx->DrawBuffer->Visual.rgbMode; break; case GL_SCISSOR_BOX: params[0] = INT_TO_BOOLEAN(ctx->Scissor.X); params[1] = INT_TO_BOOLEAN(ctx->Scissor.Y); params[2] = INT_TO_BOOLEAN(ctx->Scissor.Width); params[3] = INT_TO_BOOLEAN(ctx->Scissor.Height); break; case GL_SCISSOR_TEST: params[0] = ctx->Scissor.Enabled; break; case GL_SELECTION_BUFFER_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Select.BufferSize); break; case GL_SHADE_MODEL: params[0] = ENUM_TO_BOOLEAN(ctx->Light.ShadeModel); break; case GL_SHARED_TEXTURE_PALETTE_EXT: params[0] = ctx->Texture.SharedPalette; break; case GL_STENCIL_BITS: params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.stencilBits); break; case GL_STENCIL_CLEAR_VALUE: params[0] = INT_TO_BOOLEAN(ctx->Stencil.Clear); break; case GL_STENCIL_FAIL: params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_FUNC: params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_PASS_DEPTH_FAIL: params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_PASS_DEPTH_PASS: params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_REF: params[0] = INT_TO_BOOLEAN(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_TEST: params[0] = ctx->Stencil.Enabled; break; case GL_STENCIL_VALUE_MASK: params[0] = INT_TO_BOOLEAN(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_WRITEMASK: params[0] = INT_TO_BOOLEAN(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]); break; case GL_STEREO: params[0] = ctx->DrawBuffer->Visual.stereoMode; break; case GL_SUBPIXEL_BITS: params[0] = INT_TO_BOOLEAN(ctx->Const.SubPixelBits); break; case GL_TEXTURE_1D: params[0] = _mesa_IsEnabled(GL_TEXTURE_1D); break; case GL_TEXTURE_2D: params[0] = _mesa_IsEnabled(GL_TEXTURE_2D); break; case GL_TEXTURE_3D: params[0] = _mesa_IsEnabled(GL_TEXTURE_3D); break; case GL_TEXTURE_BINDING_1D: params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name); break; case GL_TEXTURE_BINDING_2D: params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name); break; case GL_TEXTURE_BINDING_3D: params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name); break; case GL_TEXTURE_ENV_COLOR: { const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; params[0] = FLOAT_TO_BOOLEAN(color[0]); params[1] = FLOAT_TO_BOOLEAN(color[1]); params[2] = FLOAT_TO_BOOLEAN(color[2]); params[3] = FLOAT_TO_BOOLEAN(color[3]); } break; case GL_TEXTURE_ENV_MODE: params[0] = ENUM_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode); break; case GL_TEXTURE_GEN_S: params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0); break; case GL_TEXTURE_GEN_T: params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0); break; case GL_TEXTURE_GEN_R: params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0); break; case GL_TEXTURE_GEN_Q: params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0); break; case GL_TEXTURE_MATRIX: { const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; params[0] = FLOAT_TO_BOOLEAN(matrix[0]); params[1] = FLOAT_TO_BOOLEAN(matrix[1]); params[2] = FLOAT_TO_BOOLEAN(matrix[2]); params[3] = FLOAT_TO_BOOLEAN(matrix[3]); params[4] = FLOAT_TO_BOOLEAN(matrix[4]); params[5] = FLOAT_TO_BOOLEAN(matrix[5]); params[6] = FLOAT_TO_BOOLEAN(matrix[6]); params[7] = FLOAT_TO_BOOLEAN(matrix[7]); params[8] = FLOAT_TO_BOOLEAN(matrix[8]); params[9] = FLOAT_TO_BOOLEAN(matrix[9]); params[10] = FLOAT_TO_BOOLEAN(matrix[10]); params[11] = FLOAT_TO_BOOLEAN(matrix[11]); params[12] = FLOAT_TO_BOOLEAN(matrix[12]); params[13] = FLOAT_TO_BOOLEAN(matrix[13]); params[14] = FLOAT_TO_BOOLEAN(matrix[14]); params[15] = FLOAT_TO_BOOLEAN(matrix[15]); } break; case GL_TEXTURE_STACK_DEPTH: params[0] = INT_TO_BOOLEAN(ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1); break; case GL_UNPACK_ALIGNMENT: params[0] = INT_TO_BOOLEAN(ctx->Unpack.Alignment); break; case GL_UNPACK_LSB_FIRST: params[0] = ctx->Unpack.LsbFirst; break; case GL_UNPACK_ROW_LENGTH: params[0] = INT_TO_BOOLEAN(ctx->Unpack.RowLength); break; case GL_UNPACK_SKIP_PIXELS: params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipPixels); break; case GL_UNPACK_SKIP_ROWS: params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipRows); break; case GL_UNPACK_SWAP_BYTES: params[0] = ctx->Unpack.SwapBytes; break; case GL_UNPACK_SKIP_IMAGES_EXT: params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipImages); break; case GL_UNPACK_IMAGE_HEIGHT_EXT: params[0] = INT_TO_BOOLEAN(ctx->Unpack.ImageHeight); break; case GL_UNPACK_CLIENT_STORAGE_APPLE: params[0] = ctx->Unpack.ClientStorage; break; case GL_VIEWPORT: params[0] = INT_TO_BOOLEAN(ctx->Viewport.X); params[1] = INT_TO_BOOLEAN(ctx->Viewport.Y); params[2] = INT_TO_BOOLEAN(ctx->Viewport.Width); params[3] = INT_TO_BOOLEAN(ctx->Viewport.Height); break; case GL_ZOOM_X: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.ZoomX); break; case GL_ZOOM_Y: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.ZoomY); break; case GL_VERTEX_ARRAY: params[0] = ctx->Array.Vertex.Enabled; break; case GL_VERTEX_ARRAY_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Array.Vertex.Size); break; case GL_VERTEX_ARRAY_TYPE: params[0] = ENUM_TO_BOOLEAN(ctx->Array.Vertex.Type); break; case GL_VERTEX_ARRAY_STRIDE: params[0] = INT_TO_BOOLEAN(ctx->Array.Vertex.Stride); break; case GL_VERTEX_ARRAY_COUNT_EXT: params[0] = INT_TO_BOOLEAN(0); break; case GL_NORMAL_ARRAY: params[0] = ENUM_TO_BOOLEAN(ctx->Array.Normal.Enabled); break; case GL_NORMAL_ARRAY_TYPE: params[0] = ENUM_TO_BOOLEAN(ctx->Array.Normal.Type); break; case GL_NORMAL_ARRAY_STRIDE: params[0] = INT_TO_BOOLEAN(ctx->Array.Normal.Stride); break; case GL_NORMAL_ARRAY_COUNT_EXT: params[0] = INT_TO_BOOLEAN(0); break; case GL_COLOR_ARRAY: params[0] = ctx->Array.Color.Enabled; break; case GL_COLOR_ARRAY_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Array.Color.Size); break; case GL_COLOR_ARRAY_TYPE: params[0] = ENUM_TO_BOOLEAN(ctx->Array.Color.Type); break; case GL_COLOR_ARRAY_STRIDE: params[0] = INT_TO_BOOLEAN(ctx->Array.Color.Stride); break; case GL_COLOR_ARRAY_COUNT_EXT: params[0] = INT_TO_BOOLEAN(0); break; case GL_INDEX_ARRAY: params[0] = ctx->Array.Index.Enabled; break; case GL_INDEX_ARRAY_TYPE: params[0] = ENUM_TO_BOOLEAN(ctx->Array.Index.Type); break; case GL_INDEX_ARRAY_STRIDE: params[0] = INT_TO_BOOLEAN(ctx->Array.Index.Stride); break; case GL_INDEX_ARRAY_COUNT_EXT: params[0] = INT_TO_BOOLEAN(0); break; case GL_TEXTURE_COORD_ARRAY: params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; break; case GL_TEXTURE_COORD_ARRAY_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size); break; case GL_TEXTURE_COORD_ARRAY_TYPE: params[0] = ENUM_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type); break; case GL_TEXTURE_COORD_ARRAY_STRIDE: params[0] = INT_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride); break; case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: params[0] = INT_TO_BOOLEAN(0); break; case GL_EDGE_FLAG_ARRAY: params[0] = ctx->Array.EdgeFlag.Enabled; break; case GL_EDGE_FLAG_ARRAY_STRIDE: params[0] = INT_TO_BOOLEAN(ctx->Array.EdgeFlag.Stride); break; case GL_EDGE_FLAG_ARRAY_COUNT_EXT: params[0] = INT_TO_BOOLEAN(0); break; case GL_MAX_TEXTURE_UNITS_ARB: CHECK_EXTENSION_B(ARB_multitexture, pname); params[0] = INT_TO_BOOLEAN(MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits)); break; case GL_ACTIVE_TEXTURE_ARB: CHECK_EXTENSION_B(ARB_multitexture, pname); params[0] = INT_TO_BOOLEAN(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); break; case GL_CLIENT_ACTIVE_TEXTURE_ARB: CHECK_EXTENSION_B(ARB_multitexture, pname); params[0] = INT_TO_BOOLEAN(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); break; case GL_TEXTURE_CUBE_MAP_ARB: CHECK_EXTENSION_B(ARB_texture_cube_map, pname); params[0] = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: CHECK_EXTENSION_B(ARB_texture_cube_map, pname); params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name); break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: CHECK_EXTENSION_B(ARB_texture_cube_map, pname); params[0] = INT_TO_BOOLEAN((1 << (ctx->Const.MaxCubeTextureLevels - 1))); break; case GL_TEXTURE_COMPRESSION_HINT_ARB: CHECK_EXTENSION_B(ARB_texture_compression, pname); params[0] = INT_TO_BOOLEAN(ctx->Hint.TextureCompression); break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: CHECK_EXTENSION_B(ARB_texture_compression, pname); params[0] = INT_TO_BOOLEAN(_mesa_get_compressed_formats(ctx, NULL)); break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: CHECK_EXTENSION_B(ARB_texture_compression, pname); { GLint formats[100]; GLuint i, n = _mesa_get_compressed_formats(ctx, formats); ASSERT(n <= 100); for (i = 0; i < n; i++) params[i] = ENUM_TO_INT(formats[i]); } break; case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: CHECK_EXTENSION_B(EXT_compiled_vertex_array, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.LockFirst); break; case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: CHECK_EXTENSION_B(EXT_compiled_vertex_array, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.LockCount); break; case GL_TRANSPOSE_COLOR_MATRIX_ARB: { const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; params[0] = FLOAT_TO_BOOLEAN(matrix[0]); params[1] = FLOAT_TO_BOOLEAN(matrix[4]); params[2] = FLOAT_TO_BOOLEAN(matrix[8]); params[3] = FLOAT_TO_BOOLEAN(matrix[12]); params[4] = FLOAT_TO_BOOLEAN(matrix[1]); params[5] = FLOAT_TO_BOOLEAN(matrix[5]); params[6] = FLOAT_TO_BOOLEAN(matrix[9]); params[7] = FLOAT_TO_BOOLEAN(matrix[13]); params[8] = FLOAT_TO_BOOLEAN(matrix[2]); params[9] = FLOAT_TO_BOOLEAN(matrix[6]); params[10] = FLOAT_TO_BOOLEAN(matrix[10]); params[11] = FLOAT_TO_BOOLEAN(matrix[14]); params[12] = FLOAT_TO_BOOLEAN(matrix[3]); params[13] = FLOAT_TO_BOOLEAN(matrix[7]); params[14] = FLOAT_TO_BOOLEAN(matrix[11]); params[15] = FLOAT_TO_BOOLEAN(matrix[15]); } break; case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: { const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; params[0] = FLOAT_TO_BOOLEAN(matrix[0]); params[1] = FLOAT_TO_BOOLEAN(matrix[4]); params[2] = FLOAT_TO_BOOLEAN(matrix[8]); params[3] = FLOAT_TO_BOOLEAN(matrix[12]); params[4] = FLOAT_TO_BOOLEAN(matrix[1]); params[5] = FLOAT_TO_BOOLEAN(matrix[5]); params[6] = FLOAT_TO_BOOLEAN(matrix[9]); params[7] = FLOAT_TO_BOOLEAN(matrix[13]); params[8] = FLOAT_TO_BOOLEAN(matrix[2]); params[9] = FLOAT_TO_BOOLEAN(matrix[6]); params[10] = FLOAT_TO_BOOLEAN(matrix[10]); params[11] = FLOAT_TO_BOOLEAN(matrix[14]); params[12] = FLOAT_TO_BOOLEAN(matrix[3]); params[13] = FLOAT_TO_BOOLEAN(matrix[7]); params[14] = FLOAT_TO_BOOLEAN(matrix[11]); params[15] = FLOAT_TO_BOOLEAN(matrix[15]); } break; case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: { const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; params[0] = FLOAT_TO_BOOLEAN(matrix[0]); params[1] = FLOAT_TO_BOOLEAN(matrix[4]); params[2] = FLOAT_TO_BOOLEAN(matrix[8]); params[3] = FLOAT_TO_BOOLEAN(matrix[12]); params[4] = FLOAT_TO_BOOLEAN(matrix[1]); params[5] = FLOAT_TO_BOOLEAN(matrix[5]); params[6] = FLOAT_TO_BOOLEAN(matrix[9]); params[7] = FLOAT_TO_BOOLEAN(matrix[13]); params[8] = FLOAT_TO_BOOLEAN(matrix[2]); params[9] = FLOAT_TO_BOOLEAN(matrix[6]); params[10] = FLOAT_TO_BOOLEAN(matrix[10]); params[11] = FLOAT_TO_BOOLEAN(matrix[14]); params[12] = FLOAT_TO_BOOLEAN(matrix[3]); params[13] = FLOAT_TO_BOOLEAN(matrix[7]); params[14] = FLOAT_TO_BOOLEAN(matrix[11]); params[15] = FLOAT_TO_BOOLEAN(matrix[15]); } break; case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: { const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; params[0] = FLOAT_TO_BOOLEAN(matrix[0]); params[1] = FLOAT_TO_BOOLEAN(matrix[4]); params[2] = FLOAT_TO_BOOLEAN(matrix[8]); params[3] = FLOAT_TO_BOOLEAN(matrix[12]); params[4] = FLOAT_TO_BOOLEAN(matrix[1]); params[5] = FLOAT_TO_BOOLEAN(matrix[5]); params[6] = FLOAT_TO_BOOLEAN(matrix[9]); params[7] = FLOAT_TO_BOOLEAN(matrix[13]); params[8] = FLOAT_TO_BOOLEAN(matrix[2]); params[9] = FLOAT_TO_BOOLEAN(matrix[6]); params[10] = FLOAT_TO_BOOLEAN(matrix[10]); params[11] = FLOAT_TO_BOOLEAN(matrix[14]); params[12] = FLOAT_TO_BOOLEAN(matrix[3]); params[13] = FLOAT_TO_BOOLEAN(matrix[7]); params[14] = FLOAT_TO_BOOLEAN(matrix[11]); params[15] = FLOAT_TO_BOOLEAN(matrix[15]); } break; case GL_OCCLUSION_TEST_HP: CHECK_EXTENSION_B(HP_occlusion_test, pname); params[0] = ctx->Depth.OcclusionTest; break; case GL_OCCLUSION_TEST_RESULT_HP: CHECK_EXTENSION_B(HP_occlusion_test, pname); { FLUSH_VERTICES(ctx, _NEW_DEPTH); if (ctx->Depth.OcclusionTest) params[0] = ctx->OcclusionResult; else params[0] = ctx->OcclusionResultSaved; /* reset flag now */ ctx->OcclusionResult = GL_FALSE; ctx->OcclusionResultSaved = GL_FALSE; return; } break; case GL_PIXEL_TEXTURE_SGIS: CHECK_EXTENSION_B(SGIS_pixel_texture, pname); params[0] = ctx->Pixel.PixelTextureEnabled; break; case GL_PIXEL_TEX_GEN_SGIX: CHECK_EXTENSION_B(SGIX_pixel_texture, pname); params[0] = ctx->Pixel.PixelTextureEnabled; break; case GL_PIXEL_TEX_GEN_MODE_SGIX: CHECK_EXTENSION_B(SGIX_pixel_texture, pname); params[0] = ENUM_TO_BOOLEAN(pixel_texgen_mode(ctx)); break; case GL_COLOR_MATRIX_SGI: { const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; params[0] = FLOAT_TO_BOOLEAN(matrix[0]); params[1] = FLOAT_TO_BOOLEAN(matrix[1]); params[2] = FLOAT_TO_BOOLEAN(matrix[2]); params[3] = FLOAT_TO_BOOLEAN(matrix[3]); params[4] = FLOAT_TO_BOOLEAN(matrix[4]); params[5] = FLOAT_TO_BOOLEAN(matrix[5]); params[6] = FLOAT_TO_BOOLEAN(matrix[6]); params[7] = FLOAT_TO_BOOLEAN(matrix[7]); params[8] = FLOAT_TO_BOOLEAN(matrix[8]); params[9] = FLOAT_TO_BOOLEAN(matrix[9]); params[10] = FLOAT_TO_BOOLEAN(matrix[10]); params[11] = FLOAT_TO_BOOLEAN(matrix[11]); params[12] = FLOAT_TO_BOOLEAN(matrix[12]); params[13] = FLOAT_TO_BOOLEAN(matrix[13]); params[14] = FLOAT_TO_BOOLEAN(matrix[14]); params[15] = FLOAT_TO_BOOLEAN(matrix[15]); } break; case GL_COLOR_MATRIX_STACK_DEPTH_SGI: params[0] = INT_TO_BOOLEAN(ctx->ColorMatrixStack.Depth + 1); break; case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: params[0] = INT_TO_BOOLEAN(MAX_COLOR_STACK_DEPTH); break; case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[0]); break; case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[1]); break; case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[2]); break; case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[3]); break; case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[0]); break; case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[1]); break; case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[2]); break; case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[3]); break; case GL_CONVOLUTION_1D_EXT: CHECK_EXTENSION_B(EXT_convolution, pname); params[0] = ctx->Pixel.Convolution1DEnabled; break; case GL_CONVOLUTION_2D_EXT: CHECK_EXTENSION_B(EXT_convolution, pname); params[0] = ctx->Pixel.Convolution2DEnabled; break; case GL_SEPARABLE_2D_EXT: CHECK_EXTENSION_B(EXT_convolution, pname); params[0] = ctx->Pixel.Separable2DEnabled; break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: CHECK_EXTENSION_B(EXT_convolution, pname); params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[0]); break; case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: CHECK_EXTENSION_B(EXT_convolution, pname); params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[1]); break; case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: CHECK_EXTENSION_B(EXT_convolution, pname); params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[2]); break; case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: CHECK_EXTENSION_B(EXT_convolution, pname); params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[3]); break; case GL_POST_CONVOLUTION_RED_BIAS_EXT: CHECK_EXTENSION_B(EXT_convolution, pname); params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[0]); break; case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: CHECK_EXTENSION_B(EXT_convolution, pname); params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[1]); break; case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: CHECK_EXTENSION_B(EXT_convolution, pname); params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[2]); break; case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: CHECK_EXTENSION_B(EXT_convolution, pname); params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[3]); break; case GL_HISTOGRAM: CHECK_EXTENSION_B(EXT_histogram, pname); params[0] = ctx->Pixel.HistogramEnabled; break; case GL_MINMAX: CHECK_EXTENSION_B(EXT_histogram, pname); params[0] = ctx->Pixel.MinMaxEnabled; break; case GL_COLOR_TABLE_SGI: CHECK_EXTENSION_B(SGI_color_table, pname); params[0] = ctx->Pixel.ColorTableEnabled; break; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: CHECK_EXTENSION_B(SGI_color_table, pname); params[0] = ctx->Pixel.PostConvolutionColorTableEnabled; break; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: CHECK_EXTENSION_B(SGI_color_table, pname); params[0] = ctx->Pixel.PostColorMatrixColorTableEnabled; break; case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXTENSION_B(SGI_texture_color_table, pname); params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled; break; case GL_COLOR_SUM_EXT: CHECK_EXTENSION_B(EXT_secondary_color, pname); params[0] = ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: CHECK_EXTENSION_B(EXT_secondary_color, pname); { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]); } break; case GL_SECONDARY_COLOR_ARRAY_EXT: CHECK_EXTENSION_B(EXT_secondary_color, pname); params[0] = ctx->Array.SecondaryColor.Enabled; break; case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: CHECK_EXTENSION_B(EXT_secondary_color, pname); params[0] = ENUM_TO_BOOLEAN(ctx->Array.SecondaryColor.Type); break; case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: CHECK_EXTENSION_B(EXT_secondary_color, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.SecondaryColor.Stride); break; case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: CHECK_EXTENSION_B(EXT_secondary_color, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.SecondaryColor.Size); break; case GL_CURRENT_FOG_COORDINATE_EXT: CHECK_EXTENSION_B(EXT_fog_coord, pname); { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); } break; case GL_FOG_COORDINATE_ARRAY_EXT: CHECK_EXTENSION_B(EXT_fog_coord, pname); params[0] = ctx->Array.FogCoord.Enabled; break; case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: CHECK_EXTENSION_B(EXT_fog_coord, pname); params[0] = ENUM_TO_BOOLEAN(ctx->Array.FogCoord.Type); break; case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: CHECK_EXTENSION_B(EXT_fog_coord, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.FogCoord.Stride); break; case GL_FOG_COORDINATE_SOURCE_EXT: CHECK_EXTENSION_B(EXT_fog_coord, pname); params[0] = ENUM_TO_BOOLEAN(ctx->Fog.FogCoordinateSource); break; case GL_MAX_TEXTURE_LOD_BIAS_EXT: CHECK_EXTENSION_B(EXT_texture_lod_bias, pname); params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxTextureLodBias); break; case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: CHECK_EXTENSION_B(EXT_texture_filter_anisotropic, pname); params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxTextureMaxAnisotropy); break; case GL_MULTISAMPLE_ARB: CHECK_EXTENSION_B(ARB_multisample, pname); params[0] = ctx->Multisample.Enabled; break; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: CHECK_EXTENSION_B(ARB_multisample, pname); params[0] = ctx->Multisample.SampleAlphaToCoverage; break; case GL_SAMPLE_ALPHA_TO_ONE_ARB: CHECK_EXTENSION_B(ARB_multisample, pname); params[0] = ctx->Multisample.SampleAlphaToOne; break; case GL_SAMPLE_COVERAGE_ARB: CHECK_EXTENSION_B(ARB_multisample, pname); params[0] = ctx->Multisample.SampleCoverage; break; case GL_SAMPLE_COVERAGE_VALUE_ARB: CHECK_EXTENSION_B(ARB_multisample, pname); params[0] = FLOAT_TO_BOOLEAN(ctx->Multisample.SampleCoverageValue); break; case GL_SAMPLE_COVERAGE_INVERT_ARB: CHECK_EXTENSION_B(ARB_multisample, pname); params[0] = ctx->Multisample.SampleCoverageInvert; break; case GL_SAMPLE_BUFFERS_ARB: CHECK_EXTENSION_B(ARB_multisample, pname); params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.sampleBuffers); break; case GL_SAMPLES_ARB: CHECK_EXTENSION_B(ARB_multisample, pname); params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.samples); break; case GL_RASTER_POSITION_UNCLIPPED_IBM: CHECK_EXTENSION_B(IBM_rasterpos_clip, pname); params[0] = ctx->Transform.RasterPositionUnclipped; break; case GL_POINT_SPRITE_NV: CHECK_EXTENSION_B(NV_point_sprite, pname); params[0] = ctx->Point.PointSprite; break; case GL_POINT_SPRITE_R_MODE_NV: CHECK_EXTENSION_B(NV_point_sprite, pname); params[0] = ENUM_TO_BOOLEAN(ctx->Point.SpriteRMode); break; case GL_POINT_SPRITE_COORD_ORIGIN: CHECK_EXTENSION_B(NV_point_sprite, pname); params[0] = ENUM_TO_BOOLEAN(ctx->Point.SpriteOrigin); break; case GL_GENERATE_MIPMAP_HINT_SGIS: CHECK_EXTENSION_B(SGIS_generate_mipmap, pname); params[0] = ENUM_TO_BOOLEAN(ctx->Hint.GenerateMipmap); break; case GL_VERTEX_PROGRAM_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->VertexProgram.Enabled; break; case GL_VERTEX_PROGRAM_POINT_SIZE_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->VertexProgram.PointSizeEnabled; break; case GL_VERTEX_PROGRAM_TWO_SIDE_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->VertexProgram.TwoSideEnabled; break; case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = INT_TO_BOOLEAN(ctx->Const.MaxProgramMatrixStackDepth); break; case GL_MAX_TRACK_MATRICES_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = INT_TO_BOOLEAN(ctx->Const.MaxProgramMatrices); break; case GL_CURRENT_MATRIX_STACK_DEPTH_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->CurrentStack->Depth + 1; break; case GL_CURRENT_MATRIX_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); { const GLfloat *matrix = ctx->CurrentStack->Top->m; params[0] = FLOAT_TO_BOOLEAN(matrix[0]); params[1] = FLOAT_TO_BOOLEAN(matrix[1]); params[2] = FLOAT_TO_BOOLEAN(matrix[2]); params[3] = FLOAT_TO_BOOLEAN(matrix[3]); params[4] = FLOAT_TO_BOOLEAN(matrix[4]); params[5] = FLOAT_TO_BOOLEAN(matrix[5]); params[6] = FLOAT_TO_BOOLEAN(matrix[6]); params[7] = FLOAT_TO_BOOLEAN(matrix[7]); params[8] = FLOAT_TO_BOOLEAN(matrix[8]); params[9] = FLOAT_TO_BOOLEAN(matrix[9]); params[10] = FLOAT_TO_BOOLEAN(matrix[10]); params[11] = FLOAT_TO_BOOLEAN(matrix[11]); params[12] = FLOAT_TO_BOOLEAN(matrix[12]); params[13] = FLOAT_TO_BOOLEAN(matrix[13]); params[14] = FLOAT_TO_BOOLEAN(matrix[14]); params[15] = FLOAT_TO_BOOLEAN(matrix[15]); } break; case GL_VERTEX_PROGRAM_BINDING_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = INT_TO_BOOLEAN((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)); break; case GL_PROGRAM_ERROR_POSITION_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = INT_TO_BOOLEAN(ctx->Program.ErrorPos); break; case GL_VERTEX_ATTRIB_ARRAY0_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[0].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY1_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[1].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY2_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[2].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY3_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[3].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[4].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY5_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[5].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY6_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[6].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY7_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[7].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY8_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[8].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY9_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[9].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY10_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[10].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY11_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[11].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY12_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[12].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY13_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[13].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY14_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[14].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY15_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Array.VertexAttrib[15].Enabled; break; case GL_MAP1_VERTEX_ATTRIB0_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[0]; break; case GL_MAP1_VERTEX_ATTRIB1_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[1]; break; case GL_MAP1_VERTEX_ATTRIB2_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[2]; break; case GL_MAP1_VERTEX_ATTRIB3_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[3]; break; case GL_MAP1_VERTEX_ATTRIB4_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[4]; break; case GL_MAP1_VERTEX_ATTRIB5_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[5]; break; case GL_MAP1_VERTEX_ATTRIB6_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[6]; break; case GL_MAP1_VERTEX_ATTRIB7_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[7]; break; case GL_MAP1_VERTEX_ATTRIB8_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[8]; break; case GL_MAP1_VERTEX_ATTRIB9_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[9]; break; case GL_MAP1_VERTEX_ATTRIB10_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[10]; break; case GL_MAP1_VERTEX_ATTRIB11_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[11]; break; case GL_MAP1_VERTEX_ATTRIB12_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[12]; break; case GL_MAP1_VERTEX_ATTRIB13_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[13]; break; case GL_MAP1_VERTEX_ATTRIB14_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[14]; break; case GL_MAP1_VERTEX_ATTRIB15_4_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); params[0] = ctx->Eval.Map1Attrib[15]; break; case GL_FRAGMENT_PROGRAM_NV: CHECK_EXTENSION_B(NV_fragment_program, pname); params[0] = ctx->FragmentProgram.Enabled; break; case GL_MAX_TEXTURE_COORDS_NV: CHECK_EXTENSION_B(NV_fragment_program, pname); params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureCoordUnits); break; case GL_MAX_TEXTURE_IMAGE_UNITS_NV: CHECK_EXTENSION_B(NV_fragment_program, pname); params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureImageUnits); break; case GL_FRAGMENT_PROGRAM_BINDING_NV: CHECK_EXTENSION_B(NV_fragment_program, pname); params[0] = INT_TO_BOOLEAN(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0); break; case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: CHECK_EXTENSION_B(NV_fragment_program, pname); params[0] = INT_TO_BOOLEAN(MAX_NV_FRAGMENT_PROGRAM_PARAMS); break; case GL_TEXTURE_RECTANGLE_NV: CHECK_EXTENSION_B(NV_texture_rectangle, pname); params[0] = _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV); break; case GL_TEXTURE_BINDING_RECTANGLE_NV: CHECK_EXTENSION_B(NV_texture_rectangle, pname); params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name); break; case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: CHECK_EXTENSION_B(NV_texture_rectangle, pname); params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureRectSize); break; case GL_STENCIL_TEST_TWO_SIDE_EXT: CHECK_EXTENSION_B(EXT_stencil_two_side, pname); params[0] = ctx->Stencil.TestTwoSide; break; case GL_ACTIVE_STENCIL_FACE_EXT: CHECK_EXTENSION_B(EXT_stencil_two_side, pname); params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); break; case GL_MAX_SHININESS_NV: CHECK_EXTENSION_B(NV_light_max_exponent, pname); params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxShininess); break; case GL_MAX_SPOT_EXPONENT_NV: CHECK_EXTENSION_B(NV_light_max_exponent, pname); params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxSpotExponent); break; case GL_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayBufferObj->Name); break; case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.Vertex.BufferObj->Name); break; case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.Normal.BufferObj->Name); break; case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.Color.BufferObj->Name); break; case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.Index.BufferObj->Name); break; case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name); break; case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.EdgeFlag.BufferObj->Name); break; case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.SecondaryColor.BufferObj->Name); break; case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.FogCoord.BufferObj->Name); break; case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->Array.ElementArrayBufferObj->Name); break; case GL_PIXEL_PACK_BUFFER_BINDING_EXT: CHECK_EXTENSION_B(EXT_pixel_buffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->Pack.BufferObj->Name); break; case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: CHECK_EXTENSION_B(EXT_pixel_buffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->Unpack.BufferObj->Name); break; case GL_MAX_VERTEX_ATTRIBS_ARB: CHECK_EXTENSION_B(ARB_vertex_program, pname); params[0] = INT_TO_BOOLEAN(ctx->Const.MaxVertexProgramAttribs); break; case GL_FRAGMENT_PROGRAM_ARB: CHECK_EXTENSION_B(ARB_fragment_program, pname); params[0] = ctx->FragmentProgram.Enabled; break; case GL_TRANSPOSE_CURRENT_MATRIX_ARB: CHECK_EXTENSION_B(ARB_fragment_program, pname); { const GLfloat *matrix = ctx->CurrentStack->Top->m; params[0] = FLOAT_TO_BOOLEAN(matrix[0]); params[1] = FLOAT_TO_BOOLEAN(matrix[4]); params[2] = FLOAT_TO_BOOLEAN(matrix[8]); params[3] = FLOAT_TO_BOOLEAN(matrix[12]); params[4] = FLOAT_TO_BOOLEAN(matrix[1]); params[5] = FLOAT_TO_BOOLEAN(matrix[5]); params[6] = FLOAT_TO_BOOLEAN(matrix[9]); params[7] = FLOAT_TO_BOOLEAN(matrix[13]); params[8] = FLOAT_TO_BOOLEAN(matrix[2]); params[9] = FLOAT_TO_BOOLEAN(matrix[6]); params[10] = FLOAT_TO_BOOLEAN(matrix[10]); params[11] = FLOAT_TO_BOOLEAN(matrix[14]); params[12] = FLOAT_TO_BOOLEAN(matrix[3]); params[13] = FLOAT_TO_BOOLEAN(matrix[7]); params[14] = FLOAT_TO_BOOLEAN(matrix[11]); params[15] = FLOAT_TO_BOOLEAN(matrix[15]); } break; case GL_DEPTH_BOUNDS_TEST_EXT: CHECK_EXTENSION_B(EXT_depth_bounds_test, pname); params[0] = ctx->Depth.BoundsTest; break; case GL_DEPTH_BOUNDS_EXT: CHECK_EXTENSION_B(EXT_depth_bounds_test, pname); params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMin); params[1] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMax); break; case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: CHECK_EXTENSION_B(MESA_program_debug, pname); params[0] = ctx->FragmentProgram.CallbackEnabled; break; case GL_VERTEX_PROGRAM_CALLBACK_MESA: CHECK_EXTENSION_B(MESA_program_debug, pname); params[0] = ctx->VertexProgram.CallbackEnabled; break; case GL_FRAGMENT_PROGRAM_POSITION_MESA: CHECK_EXTENSION_B(MESA_program_debug, pname); params[0] = INT_TO_BOOLEAN(ctx->FragmentProgram.CurrentPosition); break; case GL_VERTEX_PROGRAM_POSITION_MESA: CHECK_EXTENSION_B(MESA_program_debug, pname); params[0] = INT_TO_BOOLEAN(ctx->VertexProgram.CurrentPosition); break; case GL_MAX_DRAW_BUFFERS_ARB: CHECK_EXTENSION_B(ARB_draw_buffers, pname); params[0] = INT_TO_BOOLEAN(ctx->Const.MaxDrawBuffers); break; case GL_DRAW_BUFFER0_ARB: CHECK_EXTENSION_B(ARB_draw_buffers, pname); params[0] = ENUM_TO_BOOLEAN(ctx->Color.DrawBuffer[0]); break; case GL_DRAW_BUFFER1_ARB: CHECK_EXTENSION_B(ARB_draw_buffers, pname); { GLenum buffer; if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); return; } buffer = ctx->Color.DrawBuffer[1]; params[0] = ENUM_TO_BOOLEAN(buffer); } break; case GL_DRAW_BUFFER2_ARB: CHECK_EXTENSION_B(ARB_draw_buffers, pname); { GLenum buffer; if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); return; } buffer = ctx->Color.DrawBuffer[2]; params[0] = ENUM_TO_BOOLEAN(buffer); } break; case GL_DRAW_BUFFER3_ARB: CHECK_EXTENSION_B(ARB_draw_buffers, pname); { GLenum buffer; if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); return; } buffer = ctx->Color.DrawBuffer[3]; params[0] = ENUM_TO_BOOLEAN(buffer); } break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXTENSION_B(OES_read_format, pname); params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadType); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXTENSION_B(OES_read_format, pname); params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadFormat); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: CHECK_EXTENSION_B(ATI_fragment_shader, pname); params[0] = INT_TO_BOOLEAN(6); break; case GL_NUM_FRAGMENT_CONSTANTS_ATI: CHECK_EXTENSION_B(ATI_fragment_shader, pname); params[0] = INT_TO_BOOLEAN(8); break; case GL_NUM_PASSES_ATI: CHECK_EXTENSION_B(ATI_fragment_shader, pname); params[0] = INT_TO_BOOLEAN(2); break; case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: CHECK_EXTENSION_B(ATI_fragment_shader, pname); params[0] = INT_TO_BOOLEAN(8); break; case GL_NUM_INSTRUCTIONS_TOTAL_ATI: CHECK_EXTENSION_B(ATI_fragment_shader, pname); params[0] = INT_TO_BOOLEAN(16); break; case GL_COLOR_ALPHA_PAIRING_ATI: CHECK_EXTENSION_B(ATI_fragment_shader, pname); params[0] = GL_TRUE; break; case GL_NUM_LOOPBACK_COMPONENTS_ATI: CHECK_EXTENSION_B(ATI_fragment_shader, pname); params[0] = INT_TO_BOOLEAN(3); break; case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: CHECK_EXTENSION_B(ATI_fragment_shader, pname); params[0] = INT_TO_BOOLEAN(3); break; case GL_STENCIL_BACK_FUNC: params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.Function[1]); break; case GL_STENCIL_BACK_VALUE_MASK: params[0] = INT_TO_BOOLEAN(ctx->Stencil.ValueMask[1]); break; case GL_STENCIL_BACK_REF: params[0] = INT_TO_BOOLEAN(ctx->Stencil.Ref[1]); break; case GL_STENCIL_BACK_FAIL: params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.FailFunc[1]); break; case GL_STENCIL_BACK_PASS_DEPTH_FAIL: params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZFailFunc[1]); break; case GL_STENCIL_BACK_PASS_DEPTH_PASS: params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZPassFunc[1]); break; case GL_FRAMEBUFFER_BINDING_EXT: CHECK_EXTENSION_B(EXT_framebuffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Name); break; case GL_RENDERBUFFER_BINDING_EXT: CHECK_EXTENSION_B(EXT_framebuffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0); break; case GL_MAX_COLOR_ATTACHMENTS_EXT: CHECK_EXTENSION_B(EXT_framebuffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->Const.MaxColorAttachments); break; case GL_MAX_RENDERBUFFER_SIZE_EXT: CHECK_EXTENSION_B(EXT_framebuffer_object, pname); params[0] = INT_TO_BOOLEAN(ctx->Const.MaxRenderbufferSize); break; case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: CHECK_EXTENSION_B(ARB_fragment_shader, pname); params[0] = INT_TO_BOOLEAN(MAX_FRAGMENT_UNIFORM_COMPONENTS); break; case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: CHECK_EXTENSION_B(ARB_fragment_shader, pname); params[0] = ENUM_TO_BOOLEAN(ctx->Hint.FragmentShaderDerivative); break; case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: CHECK_EXTENSION_B(ARB_vertex_shader, pname); params[0] = INT_TO_BOOLEAN(MAX_VERTEX_UNIFORM_COMPONENTS); break; case GL_MAX_VARYING_FLOATS_ARB: CHECK_EXTENSION_B(ARB_vertex_shader, pname); params[0] = INT_TO_BOOLEAN(MAX_VARYING_FLOATS); break; case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXTENSION_B(ARB_vertex_shader, pname); params[0] = INT_TO_BOOLEAN(MAX_VERTEX_TEXTURE_IMAGE_UNITS); break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXTENSION_B(ARB_vertex_shader, pname); params[0] = INT_TO_BOOLEAN(MAX_COMBINED_TEXTURE_IMAGE_UNITS); break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname); } } void GLAPIENTRY _mesa_GetFloatv( GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (!params) return; if (ctx->NewState) _mesa_update_state(ctx); if (ctx->Driver.GetFloatv && ctx->Driver.GetFloatv(ctx, pname, params)) return; switch (pname) { case GL_ACCUM_RED_BITS: params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumRedBits); break; case GL_ACCUM_GREEN_BITS: params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumGreenBits); break; case GL_ACCUM_BLUE_BITS: params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumBlueBits); break; case GL_ACCUM_ALPHA_BITS: params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumAlphaBits); break; case GL_ACCUM_CLEAR_VALUE: params[0] = ctx->Accum.ClearColor[0]; params[1] = ctx->Accum.ClearColor[1]; params[2] = ctx->Accum.ClearColor[2]; params[3] = ctx->Accum.ClearColor[3]; break; case GL_ALPHA_BIAS: params[0] = ctx->Pixel.AlphaBias; break; case GL_ALPHA_BITS: params[0] = (GLfloat)(ctx->DrawBuffer->Visual.alphaBits); break; case GL_ALPHA_SCALE: params[0] = ctx->Pixel.AlphaScale; break; case GL_ALPHA_TEST: params[0] = BOOLEAN_TO_FLOAT(ctx->Color.AlphaEnabled); break; case GL_ALPHA_TEST_FUNC: params[0] = ENUM_TO_FLOAT(ctx->Color.AlphaFunc); break; case GL_ALPHA_TEST_REF: params[0] = ctx->Color.AlphaRef; break; case GL_ATTRIB_STACK_DEPTH: params[0] = (GLfloat)(ctx->AttribStackDepth); break; case GL_AUTO_NORMAL: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.AutoNormal); break; case GL_AUX_BUFFERS: params[0] = (GLfloat)(ctx->DrawBuffer->Visual.numAuxBuffers); break; case GL_BLEND: params[0] = BOOLEAN_TO_FLOAT(ctx->Color.BlendEnabled); break; case GL_BLEND_DST: params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB); break; case GL_BLEND_SRC: params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB); break; case GL_BLEND_SRC_RGB_EXT: params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB); break; case GL_BLEND_DST_RGB_EXT: params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB); break; case GL_BLEND_SRC_ALPHA_EXT: params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcA); break; case GL_BLEND_DST_ALPHA_EXT: params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstA); break; case GL_BLEND_EQUATION: params[0] = ENUM_TO_FLOAT(ctx->Color.BlendEquationRGB ); break; case GL_BLEND_EQUATION_ALPHA_EXT: params[0] = ENUM_TO_FLOAT(ctx->Color.BlendEquationA ); break; case GL_BLEND_COLOR_EXT: params[0] = ctx->Color.BlendColor[0]; params[1] = ctx->Color.BlendColor[1]; params[2] = ctx->Color.BlendColor[2]; params[3] = ctx->Color.BlendColor[3]; break; case GL_BLUE_BIAS: params[0] = ctx->Pixel.BlueBias; break; case GL_BLUE_BITS: params[0] = (GLfloat)(ctx->DrawBuffer->Visual.blueBits); break; case GL_BLUE_SCALE: params[0] = ctx->Pixel.BlueScale; break; case GL_CLIENT_ATTRIB_STACK_DEPTH: params[0] = (GLfloat)(ctx->ClientAttribStackDepth); break; case GL_CLIP_PLANE0: params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 0) & 1); break; case GL_CLIP_PLANE1: params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 1) & 1); break; case GL_CLIP_PLANE2: params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 2) & 1); break; case GL_CLIP_PLANE3: params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 3) & 1); break; case GL_CLIP_PLANE4: params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 4) & 1); break; case GL_CLIP_PLANE5: params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 5) & 1); break; case GL_COLOR_CLEAR_VALUE: params[0] = ctx->Color.ClearColor[0]; params[1] = ctx->Color.ClearColor[1]; params[2] = ctx->Color.ClearColor[2]; params[3] = ctx->Color.ClearColor[3]; break; case GL_COLOR_MATERIAL: params[0] = BOOLEAN_TO_FLOAT(ctx->Light.ColorMaterialEnabled); break; case GL_COLOR_MATERIAL_FACE: params[0] = ENUM_TO_FLOAT(ctx->Light.ColorMaterialFace); break; case GL_COLOR_MATERIAL_PARAMETER: params[0] = ENUM_TO_FLOAT(ctx->Light.ColorMaterialMode); break; case GL_COLOR_WRITEMASK: params[0] = (GLfloat)(ctx->Color.ColorMask[RCOMP] ? 1 : 0); params[1] = (GLfloat)(ctx->Color.ColorMask[GCOMP] ? 1 : 0); params[2] = (GLfloat)(ctx->Color.ColorMask[BCOMP] ? 1 : 0); params[3] = (GLfloat)(ctx->Color.ColorMask[ACOMP] ? 1 : 0); break; case GL_CULL_FACE: params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.CullFlag); break; case GL_CULL_FACE_MODE: params[0] = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode); break; case GL_CURRENT_COLOR: { FLUSH_CURRENT(ctx, 0); params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]; params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]; params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]; params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]; } break; case GL_CURRENT_INDEX: { FLUSH_CURRENT(ctx, 0); params[0] = ctx->Current.Index; } break; case GL_CURRENT_NORMAL: { FLUSH_CURRENT(ctx, 0); params[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]; params[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]; params[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]; } break; case GL_CURRENT_RASTER_COLOR: params[0] = ctx->Current.RasterColor[0]; params[1] = ctx->Current.RasterColor[1]; params[2] = ctx->Current.RasterColor[2]; params[3] = ctx->Current.RasterColor[3]; break; case GL_CURRENT_RASTER_DISTANCE: params[0] = ctx->Current.RasterDistance; break; case GL_CURRENT_RASTER_INDEX: params[0] = ctx->Current.RasterIndex; break; case GL_CURRENT_RASTER_POSITION: params[0] = ctx->Current.RasterPos[0]; params[1] = ctx->Current.RasterPos[1]; params[2] = ctx->Current.RasterPos[2]; params[3] = ctx->Current.RasterPos[3]; break; case GL_CURRENT_RASTER_TEXTURE_COORDS: { const GLuint texUnit = ctx->Texture.CurrentUnit; params[0] = ctx->Current.RasterTexCoords[texUnit][0]; params[1] = ctx->Current.RasterTexCoords[texUnit][1]; params[2] = ctx->Current.RasterTexCoords[texUnit][2]; params[3] = ctx->Current.RasterTexCoords[texUnit][3]; } break; case GL_CURRENT_RASTER_POSITION_VALID: params[0] = BOOLEAN_TO_FLOAT(ctx->Current.RasterPosValid); break; case GL_CURRENT_TEXTURE_COORDS: { const GLuint texUnit = ctx->Texture.CurrentUnit; params[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]; params[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]; params[2] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]; params[3] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]; } break; case GL_DEPTH_BIAS: params[0] = ctx->Pixel.DepthBias; break; case GL_DEPTH_BITS: params[0] = (GLfloat)(ctx->DrawBuffer->Visual.depthBits); break; case GL_DEPTH_CLEAR_VALUE: params[0] = ctx->Depth.Clear; break; case GL_DEPTH_FUNC: params[0] = ENUM_TO_FLOAT(ctx->Depth.Func); break; case GL_DEPTH_RANGE: params[0] = ctx->Viewport.Near; params[1] = ctx->Viewport.Far; break; case GL_DEPTH_SCALE: params[0] = ctx->Pixel.DepthScale; break; case GL_DEPTH_TEST: params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.Test); break; case GL_DEPTH_WRITEMASK: params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.Mask); break; case GL_DITHER: params[0] = BOOLEAN_TO_FLOAT(ctx->Color.DitherFlag); break; case GL_DOUBLEBUFFER: params[0] = BOOLEAN_TO_FLOAT(ctx->DrawBuffer->Visual.doubleBufferMode); break; case GL_DRAW_BUFFER: params[0] = ENUM_TO_FLOAT(ctx->Color.DrawBuffer[0]); break; case GL_EDGE_FLAG: { FLUSH_CURRENT(ctx, 0); params[0] = BOOLEAN_TO_FLOAT(ctx->Current.EdgeFlag); } break; case GL_FEEDBACK_BUFFER_SIZE: params[0] = (GLfloat)(ctx->Feedback.BufferSize); break; case GL_FEEDBACK_BUFFER_TYPE: params[0] = ENUM_TO_FLOAT(ctx->Feedback.Type); break; case GL_FOG: params[0] = BOOLEAN_TO_FLOAT(ctx->Fog.Enabled); break; case GL_FOG_COLOR: params[0] = ctx->Fog.Color[0]; params[1] = ctx->Fog.Color[1]; params[2] = ctx->Fog.Color[2]; params[3] = ctx->Fog.Color[3]; break; case GL_FOG_DENSITY: params[0] = ctx->Fog.Density; break; case GL_FOG_END: params[0] = ctx->Fog.End; break; case GL_FOG_HINT: params[0] = ENUM_TO_FLOAT(ctx->Hint.Fog); break; case GL_FOG_INDEX: params[0] = ctx->Fog.Index; break; case GL_FOG_MODE: params[0] = ENUM_TO_FLOAT(ctx->Fog.Mode); break; case GL_FOG_START: params[0] = ctx->Fog.Start; break; case GL_FRONT_FACE: params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontFace); break; case GL_GREEN_BIAS: params[0] = ctx->Pixel.GreenBias; break; case GL_GREEN_BITS: params[0] = (GLfloat)(ctx->DrawBuffer->Visual.greenBits); break; case GL_GREEN_SCALE: params[0] = ctx->Pixel.GreenScale; break; case GL_INDEX_BITS: params[0] = (GLfloat)(ctx->DrawBuffer->Visual.indexBits); break; case GL_INDEX_CLEAR_VALUE: params[0] = (GLfloat)(ctx->Color.ClearIndex); break; case GL_INDEX_MODE: params[0] = BOOLEAN_TO_FLOAT(!ctx->DrawBuffer->Visual.rgbMode); break; case GL_INDEX_OFFSET: params[0] = (GLfloat)(ctx->Pixel.IndexOffset); break; case GL_INDEX_SHIFT: params[0] = (GLfloat)(ctx->Pixel.IndexShift); break; case GL_INDEX_WRITEMASK: params[0] = (GLfloat)(ctx->Color.IndexMask); break; case GL_LIGHT0: params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[0].Enabled); break; case GL_LIGHT1: params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[1].Enabled); break; case GL_LIGHT2: params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[2].Enabled); break; case GL_LIGHT3: params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[3].Enabled); break; case GL_LIGHT4: params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[4].Enabled); break; case GL_LIGHT5: params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[5].Enabled); break; case GL_LIGHT6: params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[6].Enabled); break; case GL_LIGHT7: params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[7].Enabled); break; case GL_LIGHTING: params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Enabled); break; case GL_LIGHT_MODEL_AMBIENT: params[0] = ctx->Light.Model.Ambient[0]; params[1] = ctx->Light.Model.Ambient[1]; params[2] = ctx->Light.Model.Ambient[2]; params[3] = ctx->Light.Model.Ambient[3]; break; case GL_LIGHT_MODEL_COLOR_CONTROL: params[0] = ENUM_TO_FLOAT(ctx->Light.Model.ColorControl); break; case GL_LIGHT_MODEL_LOCAL_VIEWER: params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Model.LocalViewer); break; case GL_LIGHT_MODEL_TWO_SIDE: params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Model.TwoSide); break; case GL_LINE_SMOOTH: params[0] = BOOLEAN_TO_FLOAT(ctx->Line.SmoothFlag); break; case GL_LINE_SMOOTH_HINT: params[0] = ENUM_TO_FLOAT(ctx->Hint.LineSmooth); break; case GL_LINE_STIPPLE: params[0] = BOOLEAN_TO_FLOAT(ctx->Line.StippleFlag); break; case GL_LINE_STIPPLE_PATTERN: params[0] = (GLfloat)(ctx->Line.StipplePattern); break; case GL_LINE_STIPPLE_REPEAT: params[0] = (GLfloat)(ctx->Line.StippleFactor); break; case GL_LINE_WIDTH: params[0] = ctx->Line.Width; break; case GL_LINE_WIDTH_GRANULARITY: params[0] = ctx->Const.LineWidthGranularity; break; case GL_LINE_WIDTH_RANGE: params[0] = ctx->Const.MinLineWidthAA; params[1] = ctx->Const.MaxLineWidthAA; break; case GL_ALIASED_LINE_WIDTH_RANGE: params[0] = ctx->Const.MinLineWidth; params[1] = ctx->Const.MaxLineWidth; break; case GL_LIST_BASE: params[0] = (GLfloat)(ctx->List.ListBase); break; case GL_LIST_INDEX: params[0] = (GLfloat)(ctx->ListState.CurrentListNum); break; case GL_LIST_MODE: { GLenum mode; if (!ctx->CompileFlag) mode = 0; else if (ctx->ExecuteFlag) mode = GL_COMPILE_AND_EXECUTE; else mode = GL_COMPILE; params[0] = ENUM_TO_FLOAT(mode); } break; case GL_INDEX_LOGIC_OP: params[0] = BOOLEAN_TO_FLOAT(ctx->Color.IndexLogicOpEnabled); break; case GL_COLOR_LOGIC_OP: params[0] = BOOLEAN_TO_FLOAT(ctx->Color.ColorLogicOpEnabled); break; case GL_LOGIC_OP_MODE: params[0] = ENUM_TO_FLOAT(ctx->Color.LogicOp); break; case GL_MAP1_COLOR_4: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Color4); break; case GL_MAP1_GRID_DOMAIN: params[0] = ctx->Eval.MapGrid1u1; params[1] = ctx->Eval.MapGrid1u2; break; case GL_MAP1_GRID_SEGMENTS: params[0] = (GLfloat)(ctx->Eval.MapGrid1un); break; case GL_MAP1_INDEX: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Index); break; case GL_MAP1_NORMAL: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Normal); break; case GL_MAP1_TEXTURE_COORD_1: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord1); break; case GL_MAP1_TEXTURE_COORD_2: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord2); break; case GL_MAP1_TEXTURE_COORD_3: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord3); break; case GL_MAP1_TEXTURE_COORD_4: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord4); break; case GL_MAP1_VERTEX_3: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Vertex3); break; case GL_MAP1_VERTEX_4: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Vertex4); break; case GL_MAP2_COLOR_4: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Color4); break; case GL_MAP2_GRID_DOMAIN: params[0] = ctx->Eval.MapGrid2u1; params[1] = ctx->Eval.MapGrid2u2; params[2] = ctx->Eval.MapGrid2v1; params[3] = ctx->Eval.MapGrid2v2; break; case GL_MAP2_GRID_SEGMENTS: params[0] = (GLfloat)(ctx->Eval.MapGrid2un); params[1] = (GLfloat)(ctx->Eval.MapGrid2vn); break; case GL_MAP2_INDEX: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Index); break; case GL_MAP2_NORMAL: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Normal); break; case GL_MAP2_TEXTURE_COORD_1: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord1); break; case GL_MAP2_TEXTURE_COORD_2: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord2); break; case GL_MAP2_TEXTURE_COORD_3: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord3); break; case GL_MAP2_TEXTURE_COORD_4: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord4); break; case GL_MAP2_VERTEX_3: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Vertex3); break; case GL_MAP2_VERTEX_4: params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Vertex4); break; case GL_MAP_COLOR: params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MapColorFlag); break; case GL_MAP_STENCIL: params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MapStencilFlag); break; case GL_MATRIX_MODE: params[0] = ENUM_TO_FLOAT(ctx->Transform.MatrixMode); break; case GL_MAX_ATTRIB_STACK_DEPTH: params[0] = (GLfloat)(MAX_ATTRIB_STACK_DEPTH); break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: params[0] = (GLfloat)(MAX_CLIENT_ATTRIB_STACK_DEPTH); break; case GL_MAX_CLIP_PLANES: params[0] = (GLfloat)(ctx->Const.MaxClipPlanes); break; case GL_MAX_ELEMENTS_VERTICES: params[0] = (GLfloat)(ctx->Const.MaxArrayLockSize); break; case GL_MAX_ELEMENTS_INDICES: params[0] = (GLfloat)(ctx->Const.MaxArrayLockSize); break; case GL_MAX_EVAL_ORDER: params[0] = (GLfloat)(MAX_EVAL_ORDER); break; case GL_MAX_LIGHTS: params[0] = (GLfloat)(ctx->Const.MaxLights); break; case GL_MAX_LIST_NESTING: params[0] = (GLfloat)(MAX_LIST_NESTING); break; case GL_MAX_MODELVIEW_STACK_DEPTH: params[0] = (GLfloat)(MAX_MODELVIEW_STACK_DEPTH); break; case GL_MAX_NAME_STACK_DEPTH: params[0] = (GLfloat)(MAX_NAME_STACK_DEPTH); break; case GL_MAX_PIXEL_MAP_TABLE: params[0] = (GLfloat)(MAX_PIXEL_MAP_TABLE); break; case GL_MAX_PROJECTION_STACK_DEPTH: params[0] = (GLfloat)(MAX_PROJECTION_STACK_DEPTH); break; case GL_MAX_TEXTURE_SIZE: params[0] = (GLfloat)(1 << (ctx->Const.MaxTextureLevels - 1)); break; case GL_MAX_3D_TEXTURE_SIZE: params[0] = (GLfloat)(1 << (ctx->Const.Max3DTextureLevels - 1)); break; case GL_MAX_TEXTURE_STACK_DEPTH: params[0] = (GLfloat)(MAX_TEXTURE_STACK_DEPTH); break; case GL_MAX_VIEWPORT_DIMS: params[0] = (GLfloat)(ctx->Const.MaxViewportWidth); params[1] = (GLfloat)(ctx->Const.MaxViewportHeight); break; case GL_MODELVIEW_MATRIX: { const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; params[0] = matrix[0]; params[1] = matrix[1]; params[2] = matrix[2]; params[3] = matrix[3]; params[4] = matrix[4]; params[5] = matrix[5]; params[6] = matrix[6]; params[7] = matrix[7]; params[8] = matrix[8]; params[9] = matrix[9]; params[10] = matrix[10]; params[11] = matrix[11]; params[12] = matrix[12]; params[13] = matrix[13]; params[14] = matrix[14]; params[15] = matrix[15]; } break; case GL_MODELVIEW_STACK_DEPTH: params[0] = (GLfloat)(ctx->ModelviewMatrixStack.Depth + 1); break; case GL_NAME_STACK_DEPTH: params[0] = (GLfloat)(ctx->Select.NameStackDepth); break; case GL_NORMALIZE: params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.Normalize); break; case GL_PACK_ALIGNMENT: params[0] = (GLfloat)(ctx->Pack.Alignment); break; case GL_PACK_LSB_FIRST: params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.LsbFirst); break; case GL_PACK_ROW_LENGTH: params[0] = (GLfloat)(ctx->Pack.RowLength); break; case GL_PACK_SKIP_PIXELS: params[0] = (GLfloat)(ctx->Pack.SkipPixels); break; case GL_PACK_SKIP_ROWS: params[0] = (GLfloat)(ctx->Pack.SkipRows); break; case GL_PACK_SWAP_BYTES: params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.SwapBytes); break; case GL_PACK_SKIP_IMAGES_EXT: params[0] = (GLfloat)(ctx->Pack.SkipImages); break; case GL_PACK_IMAGE_HEIGHT_EXT: params[0] = (GLfloat)(ctx->Pack.ImageHeight); break; case GL_PACK_INVERT_MESA: params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.Invert); break; case GL_PERSPECTIVE_CORRECTION_HINT: params[0] = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection); break; case GL_PIXEL_MAP_A_TO_A_SIZE: params[0] = (GLfloat)(ctx->Pixel.MapAtoAsize); break; case GL_PIXEL_MAP_B_TO_B_SIZE: params[0] = (GLfloat)(ctx->Pixel.MapBtoBsize); break; case GL_PIXEL_MAP_G_TO_G_SIZE: params[0] = (GLfloat)(ctx->Pixel.MapGtoGsize); break; case GL_PIXEL_MAP_I_TO_A_SIZE: params[0] = (GLfloat)(ctx->Pixel.MapItoAsize); break; case GL_PIXEL_MAP_I_TO_B_SIZE: params[0] = (GLfloat)(ctx->Pixel.MapItoBsize); break; case GL_PIXEL_MAP_I_TO_G_SIZE: params[0] = (GLfloat)(ctx->Pixel.MapItoGsize); break; case GL_PIXEL_MAP_I_TO_I_SIZE: params[0] = (GLfloat)(ctx->Pixel.MapItoIsize); break; case GL_PIXEL_MAP_I_TO_R_SIZE: params[0] = (GLfloat)(ctx->Pixel.MapItoRsize); break; case GL_PIXEL_MAP_R_TO_R_SIZE: params[0] = (GLfloat)(ctx->Pixel.MapRtoRsize); break; case GL_PIXEL_MAP_S_TO_S_SIZE: params[0] = (GLfloat)(ctx->Pixel.MapStoSsize); break; case GL_POINT_SIZE: params[0] = ctx->Point.Size; break; case GL_POINT_SIZE_GRANULARITY: params[0] = ctx->Const.PointSizeGranularity; break; case GL_POINT_SIZE_RANGE: params[0] = ctx->Const.MinPointSizeAA; params[1] = ctx->Const.MaxPointSizeAA; break; case GL_ALIASED_POINT_SIZE_RANGE: params[0] = ctx->Const.MinPointSize; params[1] = ctx->Const.MaxPointSize; break; case GL_POINT_SMOOTH: params[0] = BOOLEAN_TO_FLOAT(ctx->Point.SmoothFlag); break; case GL_POINT_SMOOTH_HINT: params[0] = ENUM_TO_FLOAT(ctx->Hint.PointSmooth); break; case GL_POINT_SIZE_MIN_EXT: params[0] = ctx->Point.MinSize; break; case GL_POINT_SIZE_MAX_EXT: params[0] = ctx->Point.MaxSize; break; case GL_POINT_FADE_THRESHOLD_SIZE_EXT: params[0] = ctx->Point.Threshold; break; case GL_DISTANCE_ATTENUATION_EXT: params[0] = ctx->Point.Params[0]; params[1] = ctx->Point.Params[1]; params[2] = ctx->Point.Params[2]; break; case GL_POLYGON_MODE: params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontMode); params[1] = ENUM_TO_FLOAT(ctx->Polygon.BackMode); break; case GL_POLYGON_OFFSET_BIAS_EXT: params[0] = ctx->Polygon.OffsetUnits; break; case GL_POLYGON_OFFSET_FACTOR: params[0] = ctx->Polygon.OffsetFactor ; break; case GL_POLYGON_OFFSET_UNITS: params[0] = ctx->Polygon.OffsetUnits ; break; case GL_POLYGON_SMOOTH: params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.SmoothFlag); break; case GL_POLYGON_SMOOTH_HINT: params[0] = ENUM_TO_FLOAT(ctx->Hint.PolygonSmooth); break; case GL_POLYGON_STIPPLE: params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.StippleFlag); break; case GL_PROJECTION_MATRIX: { const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; params[0] = matrix[0]; params[1] = matrix[1]; params[2] = matrix[2]; params[3] = matrix[3]; params[4] = matrix[4]; params[5] = matrix[5]; params[6] = matrix[6]; params[7] = matrix[7]; params[8] = matrix[8]; params[9] = matrix[9]; params[10] = matrix[10]; params[11] = matrix[11]; params[12] = matrix[12]; params[13] = matrix[13]; params[14] = matrix[14]; params[15] = matrix[15]; } break; case GL_PROJECTION_STACK_DEPTH: params[0] = (GLfloat)(ctx->ProjectionMatrixStack.Depth + 1); break; case GL_READ_BUFFER: params[0] = ENUM_TO_FLOAT(ctx->Pixel.ReadBuffer); break; case GL_RED_BIAS: params[0] = ctx->Pixel.RedBias; break; case GL_RED_BITS: params[0] = (GLfloat)( ctx->DrawBuffer->Visual.redBits ); break; case GL_RED_SCALE: params[0] = ctx->Pixel.RedScale; break; case GL_RENDER_MODE: params[0] = ENUM_TO_FLOAT(ctx->RenderMode); break; case GL_RESCALE_NORMAL: params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.RescaleNormals); break; case GL_RGBA_MODE: params[0] = BOOLEAN_TO_FLOAT(ctx->DrawBuffer->Visual.rgbMode); break; case GL_SCISSOR_BOX: params[0] = (GLfloat)(ctx->Scissor.X); params[1] = (GLfloat)(ctx->Scissor.Y); params[2] = (GLfloat)(ctx->Scissor.Width); params[3] = (GLfloat)(ctx->Scissor.Height); break; case GL_SCISSOR_TEST: params[0] = BOOLEAN_TO_FLOAT(ctx->Scissor.Enabled); break; case GL_SELECTION_BUFFER_SIZE: params[0] = (GLfloat)(ctx->Select.BufferSize); break; case GL_SHADE_MODEL: params[0] = ENUM_TO_FLOAT(ctx->Light.ShadeModel); break; case GL_SHARED_TEXTURE_PALETTE_EXT: params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.SharedPalette); break; case GL_STENCIL_BITS: params[0] = (GLfloat)(ctx->DrawBuffer->Visual.stencilBits); break; case GL_STENCIL_CLEAR_VALUE: params[0] = (GLfloat)(ctx->Stencil.Clear); break; case GL_STENCIL_FAIL: params[0] = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_FUNC: params[0] = ENUM_TO_FLOAT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_PASS_DEPTH_FAIL: params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_PASS_DEPTH_PASS: params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_REF: params[0] = (GLfloat)(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_TEST: params[0] = BOOLEAN_TO_FLOAT(ctx->Stencil.Enabled); break; case GL_STENCIL_VALUE_MASK: params[0] = (GLfloat)(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_WRITEMASK: params[0] = (GLfloat)(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]); break; case GL_STEREO: params[0] = BOOLEAN_TO_FLOAT(ctx->DrawBuffer->Visual.stereoMode); break; case GL_SUBPIXEL_BITS: params[0] = (GLfloat)(ctx->Const.SubPixelBits); break; case GL_TEXTURE_1D: params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_1D)); break; case GL_TEXTURE_2D: params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_2D)); break; case GL_TEXTURE_3D: params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_3D)); break; case GL_TEXTURE_BINDING_1D: params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name); break; case GL_TEXTURE_BINDING_2D: params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name); break; case GL_TEXTURE_BINDING_3D: params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name); break; case GL_TEXTURE_ENV_COLOR: { const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; params[0] = color[0]; params[1] = color[1]; params[2] = color[2]; params[3] = color[3]; } break; case GL_TEXTURE_ENV_MODE: params[0] = ENUM_TO_FLOAT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode); break; case GL_TEXTURE_GEN_S: params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); break; case GL_TEXTURE_GEN_T: params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)); break; case GL_TEXTURE_GEN_R: params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)); break; case GL_TEXTURE_GEN_Q: params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)); break; case GL_TEXTURE_MATRIX: { const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; params[0] = matrix[0]; params[1] = matrix[1]; params[2] = matrix[2]; params[3] = matrix[3]; params[4] = matrix[4]; params[5] = matrix[5]; params[6] = matrix[6]; params[7] = matrix[7]; params[8] = matrix[8]; params[9] = matrix[9]; params[10] = matrix[10]; params[11] = matrix[11]; params[12] = matrix[12]; params[13] = matrix[13]; params[14] = matrix[14]; params[15] = matrix[15]; } break; case GL_TEXTURE_STACK_DEPTH: params[0] = (GLfloat)(ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1); break; case GL_UNPACK_ALIGNMENT: params[0] = (GLfloat)(ctx->Unpack.Alignment); break; case GL_UNPACK_LSB_FIRST: params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.LsbFirst); break; case GL_UNPACK_ROW_LENGTH: params[0] = (GLfloat)(ctx->Unpack.RowLength); break; case GL_UNPACK_SKIP_PIXELS: params[0] = (GLfloat)(ctx->Unpack.SkipPixels); break; case GL_UNPACK_SKIP_ROWS: params[0] = (GLfloat)(ctx->Unpack.SkipRows); break; case GL_UNPACK_SWAP_BYTES: params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.SwapBytes); break; case GL_UNPACK_SKIP_IMAGES_EXT: params[0] = (GLfloat)(ctx->Unpack.SkipImages); break; case GL_UNPACK_IMAGE_HEIGHT_EXT: params[0] = (GLfloat)(ctx->Unpack.ImageHeight); break; case GL_UNPACK_CLIENT_STORAGE_APPLE: params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.ClientStorage); break; case GL_VIEWPORT: params[0] = (GLfloat)(ctx->Viewport.X); params[1] = (GLfloat)(ctx->Viewport.Y); params[2] = (GLfloat)(ctx->Viewport.Width); params[3] = (GLfloat)(ctx->Viewport.Height); break; case GL_ZOOM_X: params[0] = ctx->Pixel.ZoomX; break; case GL_ZOOM_Y: params[0] = ctx->Pixel.ZoomY; break; case GL_VERTEX_ARRAY: params[0] = BOOLEAN_TO_FLOAT(ctx->Array.Vertex.Enabled); break; case GL_VERTEX_ARRAY_SIZE: params[0] = (GLfloat)(ctx->Array.Vertex.Size); break; case GL_VERTEX_ARRAY_TYPE: params[0] = ENUM_TO_FLOAT(ctx->Array.Vertex.Type); break; case GL_VERTEX_ARRAY_STRIDE: params[0] = (GLfloat)(ctx->Array.Vertex.Stride); break; case GL_VERTEX_ARRAY_COUNT_EXT: params[0] = (GLfloat)(0); break; case GL_NORMAL_ARRAY: params[0] = ENUM_TO_FLOAT(ctx->Array.Normal.Enabled); break; case GL_NORMAL_ARRAY_TYPE: params[0] = ENUM_TO_FLOAT(ctx->Array.Normal.Type); break; case GL_NORMAL_ARRAY_STRIDE: params[0] = (GLfloat)(ctx->Array.Normal.Stride); break; case GL_NORMAL_ARRAY_COUNT_EXT: params[0] = (GLfloat)(0); break; case GL_COLOR_ARRAY: params[0] = BOOLEAN_TO_FLOAT(ctx->Array.Color.Enabled); break; case GL_COLOR_ARRAY_SIZE: params[0] = (GLfloat)(ctx->Array.Color.Size); break; case GL_COLOR_ARRAY_TYPE: params[0] = ENUM_TO_FLOAT(ctx->Array.Color.Type); break; case GL_COLOR_ARRAY_STRIDE: params[0] = (GLfloat)(ctx->Array.Color.Stride); break; case GL_COLOR_ARRAY_COUNT_EXT: params[0] = (GLfloat)(0); break; case GL_INDEX_ARRAY: params[0] = BOOLEAN_TO_FLOAT(ctx->Array.Index.Enabled); break; case GL_INDEX_ARRAY_TYPE: params[0] = ENUM_TO_FLOAT(ctx->Array.Index.Type); break; case GL_INDEX_ARRAY_STRIDE: params[0] = (GLfloat)(ctx->Array.Index.Stride); break; case GL_INDEX_ARRAY_COUNT_EXT: params[0] = (GLfloat)(0); break; case GL_TEXTURE_COORD_ARRAY: params[0] = BOOLEAN_TO_FLOAT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled); break; case GL_TEXTURE_COORD_ARRAY_SIZE: params[0] = (GLfloat)(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size); break; case GL_TEXTURE_COORD_ARRAY_TYPE: params[0] = ENUM_TO_FLOAT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type); break; case GL_TEXTURE_COORD_ARRAY_STRIDE: params[0] = (GLfloat)(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride); break; case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: params[0] = (GLfloat)(0); break; case GL_EDGE_FLAG_ARRAY: params[0] = BOOLEAN_TO_FLOAT(ctx->Array.EdgeFlag.Enabled); break; case GL_EDGE_FLAG_ARRAY_STRIDE: params[0] = (GLfloat)(ctx->Array.EdgeFlag.Stride); break; case GL_EDGE_FLAG_ARRAY_COUNT_EXT: params[0] = (GLfloat)(0); break; case GL_MAX_TEXTURE_UNITS_ARB: CHECK_EXTENSION_F(ARB_multitexture, pname); params[0] = (GLfloat)(MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits)); break; case GL_ACTIVE_TEXTURE_ARB: CHECK_EXTENSION_F(ARB_multitexture, pname); params[0] = (GLfloat)(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); break; case GL_CLIENT_ACTIVE_TEXTURE_ARB: CHECK_EXTENSION_F(ARB_multitexture, pname); params[0] = (GLfloat)(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); break; case GL_TEXTURE_CUBE_MAP_ARB: CHECK_EXTENSION_F(ARB_texture_cube_map, pname); params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)); break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: CHECK_EXTENSION_F(ARB_texture_cube_map, pname); params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name); break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: CHECK_EXTENSION_F(ARB_texture_cube_map, pname); params[0] = (GLfloat)((1 << (ctx->Const.MaxCubeTextureLevels - 1))); break; case GL_TEXTURE_COMPRESSION_HINT_ARB: CHECK_EXTENSION_F(ARB_texture_compression, pname); params[0] = (GLfloat)(ctx->Hint.TextureCompression); break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: CHECK_EXTENSION_F(ARB_texture_compression, pname); params[0] = (GLfloat)(_mesa_get_compressed_formats(ctx, NULL)); break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: CHECK_EXTENSION_F(ARB_texture_compression, pname); { GLint formats[100]; GLuint i, n = _mesa_get_compressed_formats(ctx, formats); ASSERT(n <= 100); for (i = 0; i < n; i++) params[i] = ENUM_TO_INT(formats[i]); } break; case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: CHECK_EXTENSION_F(EXT_compiled_vertex_array, pname); params[0] = (GLfloat)(ctx->Array.LockFirst); break; case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: CHECK_EXTENSION_F(EXT_compiled_vertex_array, pname); params[0] = (GLfloat)(ctx->Array.LockCount); break; case GL_TRANSPOSE_COLOR_MATRIX_ARB: { const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; params[0] = matrix[0]; params[1] = matrix[4]; params[2] = matrix[8]; params[3] = matrix[12]; params[4] = matrix[1]; params[5] = matrix[5]; params[6] = matrix[9]; params[7] = matrix[13]; params[8] = matrix[2]; params[9] = matrix[6]; params[10] = matrix[10]; params[11] = matrix[14]; params[12] = matrix[3]; params[13] = matrix[7]; params[14] = matrix[11]; params[15] = matrix[15]; } break; case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: { const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; params[0] = matrix[0]; params[1] = matrix[4]; params[2] = matrix[8]; params[3] = matrix[12]; params[4] = matrix[1]; params[5] = matrix[5]; params[6] = matrix[9]; params[7] = matrix[13]; params[8] = matrix[2]; params[9] = matrix[6]; params[10] = matrix[10]; params[11] = matrix[14]; params[12] = matrix[3]; params[13] = matrix[7]; params[14] = matrix[11]; params[15] = matrix[15]; } break; case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: { const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; params[0] = matrix[0]; params[1] = matrix[4]; params[2] = matrix[8]; params[3] = matrix[12]; params[4] = matrix[1]; params[5] = matrix[5]; params[6] = matrix[9]; params[7] = matrix[13]; params[8] = matrix[2]; params[9] = matrix[6]; params[10] = matrix[10]; params[11] = matrix[14]; params[12] = matrix[3]; params[13] = matrix[7]; params[14] = matrix[11]; params[15] = matrix[15]; } break; case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: { const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; params[0] = matrix[0]; params[1] = matrix[4]; params[2] = matrix[8]; params[3] = matrix[12]; params[4] = matrix[1]; params[5] = matrix[5]; params[6] = matrix[9]; params[7] = matrix[13]; params[8] = matrix[2]; params[9] = matrix[6]; params[10] = matrix[10]; params[11] = matrix[14]; params[12] = matrix[3]; params[13] = matrix[7]; params[14] = matrix[11]; params[15] = matrix[15]; } break; case GL_OCCLUSION_TEST_HP: CHECK_EXTENSION_F(HP_occlusion_test, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.OcclusionTest); break; case GL_OCCLUSION_TEST_RESULT_HP: CHECK_EXTENSION_F(HP_occlusion_test, pname); { FLUSH_VERTICES(ctx, _NEW_DEPTH); if (ctx->Depth.OcclusionTest) params[0] = ctx->OcclusionResult; else params[0] = ctx->OcclusionResultSaved; /* reset flag now */ ctx->OcclusionResult = GL_FALSE; ctx->OcclusionResultSaved = GL_FALSE; return; } break; case GL_PIXEL_TEXTURE_SGIS: CHECK_EXTENSION_F(SGIS_pixel_texture, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PixelTextureEnabled); break; case GL_PIXEL_TEX_GEN_SGIX: CHECK_EXTENSION_F(SGIX_pixel_texture, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PixelTextureEnabled); break; case GL_PIXEL_TEX_GEN_MODE_SGIX: CHECK_EXTENSION_F(SGIX_pixel_texture, pname); params[0] = ENUM_TO_FLOAT(pixel_texgen_mode(ctx)); break; case GL_COLOR_MATRIX_SGI: { const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; params[0] = matrix[0]; params[1] = matrix[1]; params[2] = matrix[2]; params[3] = matrix[3]; params[4] = matrix[4]; params[5] = matrix[5]; params[6] = matrix[6]; params[7] = matrix[7]; params[8] = matrix[8]; params[9] = matrix[9]; params[10] = matrix[10]; params[11] = matrix[11]; params[12] = matrix[12]; params[13] = matrix[13]; params[14] = matrix[14]; params[15] = matrix[15]; } break; case GL_COLOR_MATRIX_STACK_DEPTH_SGI: params[0] = (GLfloat)(ctx->ColorMatrixStack.Depth + 1); break; case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: params[0] = (GLfloat)(MAX_COLOR_STACK_DEPTH); break; case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: params[0] = ctx->Pixel.PostColorMatrixScale[0]; break; case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: params[0] = ctx->Pixel.PostColorMatrixScale[1]; break; case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: params[0] = ctx->Pixel.PostColorMatrixScale[2]; break; case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: params[0] = ctx->Pixel.PostColorMatrixScale[3]; break; case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: params[0] = ctx->Pixel.PostColorMatrixBias[0]; break; case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: params[0] = ctx->Pixel.PostColorMatrixBias[1]; break; case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: params[0] = ctx->Pixel.PostColorMatrixBias[2]; break; case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: params[0] = ctx->Pixel.PostColorMatrixBias[3]; break; case GL_CONVOLUTION_1D_EXT: CHECK_EXTENSION_F(EXT_convolution, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Convolution1DEnabled); break; case GL_CONVOLUTION_2D_EXT: CHECK_EXTENSION_F(EXT_convolution, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Convolution2DEnabled); break; case GL_SEPARABLE_2D_EXT: CHECK_EXTENSION_F(EXT_convolution, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Separable2DEnabled); break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: CHECK_EXTENSION_F(EXT_convolution, pname); params[0] = ctx->Pixel.PostConvolutionScale[0]; break; case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: CHECK_EXTENSION_F(EXT_convolution, pname); params[0] = ctx->Pixel.PostConvolutionScale[1]; break; case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: CHECK_EXTENSION_F(EXT_convolution, pname); params[0] = ctx->Pixel.PostConvolutionScale[2]; break; case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: CHECK_EXTENSION_F(EXT_convolution, pname); params[0] = ctx->Pixel.PostConvolutionScale[3]; break; case GL_POST_CONVOLUTION_RED_BIAS_EXT: CHECK_EXTENSION_F(EXT_convolution, pname); params[0] = ctx->Pixel.PostConvolutionBias[0]; break; case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: CHECK_EXTENSION_F(EXT_convolution, pname); params[0] = ctx->Pixel.PostConvolutionBias[1]; break; case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: CHECK_EXTENSION_F(EXT_convolution, pname); params[0] = ctx->Pixel.PostConvolutionBias[2]; break; case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: CHECK_EXTENSION_F(EXT_convolution, pname); params[0] = ctx->Pixel.PostConvolutionBias[3]; break; case GL_HISTOGRAM: CHECK_EXTENSION_F(EXT_histogram, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.HistogramEnabled); break; case GL_MINMAX: CHECK_EXTENSION_F(EXT_histogram, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MinMaxEnabled); break; case GL_COLOR_TABLE_SGI: CHECK_EXTENSION_F(SGI_color_table, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled); break; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: CHECK_EXTENSION_F(SGI_color_table, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PostConvolutionColorTableEnabled); break; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: CHECK_EXTENSION_F(SGI_color_table, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.PostColorMatrixColorTableEnabled); break; case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXTENSION_F(SGI_texture_color_table, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled); break; case GL_COLOR_SUM_EXT: CHECK_EXTENSION_F(EXT_secondary_color, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Fog.ColorSumEnabled); break; case GL_CURRENT_SECONDARY_COLOR_EXT: CHECK_EXTENSION_F(EXT_secondary_color, pname); { FLUSH_CURRENT(ctx, 0); params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]; params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]; params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]; params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]; } break; case GL_SECONDARY_COLOR_ARRAY_EXT: CHECK_EXTENSION_F(EXT_secondary_color, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.SecondaryColor.Enabled); break; case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: CHECK_EXTENSION_F(EXT_secondary_color, pname); params[0] = ENUM_TO_FLOAT(ctx->Array.SecondaryColor.Type); break; case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: CHECK_EXTENSION_F(EXT_secondary_color, pname); params[0] = (GLfloat)(ctx->Array.SecondaryColor.Stride); break; case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: CHECK_EXTENSION_F(EXT_secondary_color, pname); params[0] = (GLfloat)(ctx->Array.SecondaryColor.Size); break; case GL_CURRENT_FOG_COORDINATE_EXT: CHECK_EXTENSION_F(EXT_fog_coord, pname); { FLUSH_CURRENT(ctx, 0); params[0] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; } break; case GL_FOG_COORDINATE_ARRAY_EXT: CHECK_EXTENSION_F(EXT_fog_coord, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.FogCoord.Enabled); break; case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: CHECK_EXTENSION_F(EXT_fog_coord, pname); params[0] = ENUM_TO_FLOAT(ctx->Array.FogCoord.Type); break; case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: CHECK_EXTENSION_F(EXT_fog_coord, pname); params[0] = (GLfloat)(ctx->Array.FogCoord.Stride); break; case GL_FOG_COORDINATE_SOURCE_EXT: CHECK_EXTENSION_F(EXT_fog_coord, pname); params[0] = ENUM_TO_FLOAT(ctx->Fog.FogCoordinateSource); break; case GL_MAX_TEXTURE_LOD_BIAS_EXT: CHECK_EXTENSION_F(EXT_texture_lod_bias, pname); params[0] = ctx->Const.MaxTextureLodBias; break; case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: CHECK_EXTENSION_F(EXT_texture_filter_anisotropic, pname); params[0] = ctx->Const.MaxTextureMaxAnisotropy; break; case GL_MULTISAMPLE_ARB: CHECK_EXTENSION_F(ARB_multisample, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.Enabled); break; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: CHECK_EXTENSION_F(ARB_multisample, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleAlphaToCoverage); break; case GL_SAMPLE_ALPHA_TO_ONE_ARB: CHECK_EXTENSION_F(ARB_multisample, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleAlphaToOne); break; case GL_SAMPLE_COVERAGE_ARB: CHECK_EXTENSION_F(ARB_multisample, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleCoverage); break; case GL_SAMPLE_COVERAGE_VALUE_ARB: CHECK_EXTENSION_F(ARB_multisample, pname); params[0] = ctx->Multisample.SampleCoverageValue; break; case GL_SAMPLE_COVERAGE_INVERT_ARB: CHECK_EXTENSION_F(ARB_multisample, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleCoverageInvert); break; case GL_SAMPLE_BUFFERS_ARB: CHECK_EXTENSION_F(ARB_multisample, pname); params[0] = (GLfloat)(ctx->DrawBuffer->Visual.sampleBuffers); break; case GL_SAMPLES_ARB: CHECK_EXTENSION_F(ARB_multisample, pname); params[0] = (GLfloat)(ctx->DrawBuffer->Visual.samples); break; case GL_RASTER_POSITION_UNCLIPPED_IBM: CHECK_EXTENSION_F(IBM_rasterpos_clip, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.RasterPositionUnclipped); break; case GL_POINT_SPRITE_NV: CHECK_EXTENSION_F(NV_point_sprite, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Point.PointSprite); break; case GL_POINT_SPRITE_R_MODE_NV: CHECK_EXTENSION_F(NV_point_sprite, pname); params[0] = ENUM_TO_FLOAT(ctx->Point.SpriteRMode); break; case GL_POINT_SPRITE_COORD_ORIGIN: CHECK_EXTENSION_F(NV_point_sprite, pname); params[0] = ENUM_TO_FLOAT(ctx->Point.SpriteOrigin); break; case GL_GENERATE_MIPMAP_HINT_SGIS: CHECK_EXTENSION_F(SGIS_generate_mipmap, pname); params[0] = ENUM_TO_FLOAT(ctx->Hint.GenerateMipmap); break; case GL_VERTEX_PROGRAM_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.Enabled); break; case GL_VERTEX_PROGRAM_POINT_SIZE_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.PointSizeEnabled); break; case GL_VERTEX_PROGRAM_TWO_SIDE_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.TwoSideEnabled); break; case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = (GLfloat)(ctx->Const.MaxProgramMatrixStackDepth); break; case GL_MAX_TRACK_MATRICES_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = (GLfloat)(ctx->Const.MaxProgramMatrices); break; case GL_CURRENT_MATRIX_STACK_DEPTH_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->CurrentStack->Depth + 1); break; case GL_CURRENT_MATRIX_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); { const GLfloat *matrix = ctx->CurrentStack->Top->m; params[0] = matrix[0]; params[1] = matrix[1]; params[2] = matrix[2]; params[3] = matrix[3]; params[4] = matrix[4]; params[5] = matrix[5]; params[6] = matrix[6]; params[7] = matrix[7]; params[8] = matrix[8]; params[9] = matrix[9]; params[10] = matrix[10]; params[11] = matrix[11]; params[12] = matrix[12]; params[13] = matrix[13]; params[14] = matrix[14]; params[15] = matrix[15]; } break; case GL_VERTEX_PROGRAM_BINDING_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = (GLfloat)((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)); break; case GL_PROGRAM_ERROR_POSITION_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = (GLfloat)(ctx->Program.ErrorPos); break; case GL_VERTEX_ATTRIB_ARRAY0_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[0].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY1_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[1].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY2_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[2].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY3_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[3].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[4].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY5_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[5].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY6_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[6].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY7_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[7].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY8_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[8].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY9_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[9].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY10_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[10].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY11_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[11].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY12_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[12].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY13_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[13].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY14_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[14].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY15_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Array.VertexAttrib[15].Enabled); break; case GL_MAP1_VERTEX_ATTRIB0_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[0]); break; case GL_MAP1_VERTEX_ATTRIB1_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[1]); break; case GL_MAP1_VERTEX_ATTRIB2_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[2]); break; case GL_MAP1_VERTEX_ATTRIB3_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[3]); break; case GL_MAP1_VERTEX_ATTRIB4_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[4]); break; case GL_MAP1_VERTEX_ATTRIB5_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[5]); break; case GL_MAP1_VERTEX_ATTRIB6_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[6]); break; case GL_MAP1_VERTEX_ATTRIB7_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[7]); break; case GL_MAP1_VERTEX_ATTRIB8_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[8]); break; case GL_MAP1_VERTEX_ATTRIB9_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[9]); break; case GL_MAP1_VERTEX_ATTRIB10_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[10]); break; case GL_MAP1_VERTEX_ATTRIB11_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[11]); break; case GL_MAP1_VERTEX_ATTRIB12_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[12]); break; case GL_MAP1_VERTEX_ATTRIB13_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[13]); break; case GL_MAP1_VERTEX_ATTRIB14_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[14]); break; case GL_MAP1_VERTEX_ATTRIB15_4_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[15]); break; case GL_FRAGMENT_PROGRAM_NV: CHECK_EXTENSION_F(NV_fragment_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.Enabled); break; case GL_MAX_TEXTURE_COORDS_NV: CHECK_EXTENSION_F(NV_fragment_program, pname); params[0] = (GLfloat)(ctx->Const.MaxTextureCoordUnits); break; case GL_MAX_TEXTURE_IMAGE_UNITS_NV: CHECK_EXTENSION_F(NV_fragment_program, pname); params[0] = (GLfloat)(ctx->Const.MaxTextureImageUnits); break; case GL_FRAGMENT_PROGRAM_BINDING_NV: CHECK_EXTENSION_F(NV_fragment_program, pname); params[0] = (GLfloat)(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0); break; case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: CHECK_EXTENSION_F(NV_fragment_program, pname); params[0] = (GLfloat)(MAX_NV_FRAGMENT_PROGRAM_PARAMS); break; case GL_TEXTURE_RECTANGLE_NV: CHECK_EXTENSION_F(NV_texture_rectangle, pname); params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)); break; case GL_TEXTURE_BINDING_RECTANGLE_NV: CHECK_EXTENSION_F(NV_texture_rectangle, pname); params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name); break; case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: CHECK_EXTENSION_F(NV_texture_rectangle, pname); params[0] = (GLfloat)(ctx->Const.MaxTextureRectSize); break; case GL_STENCIL_TEST_TWO_SIDE_EXT: CHECK_EXTENSION_F(EXT_stencil_two_side, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Stencil.TestTwoSide); break; case GL_ACTIVE_STENCIL_FACE_EXT: CHECK_EXTENSION_F(EXT_stencil_two_side, pname); params[0] = ENUM_TO_FLOAT(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); break; case GL_MAX_SHININESS_NV: CHECK_EXTENSION_F(NV_light_max_exponent, pname); params[0] = ctx->Const.MaxShininess; break; case GL_MAX_SPOT_EXPONENT_NV: CHECK_EXTENSION_F(NV_light_max_exponent, pname); params[0] = ctx->Const.MaxSpotExponent; break; case GL_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); params[0] = (GLfloat)(ctx->Array.ArrayBufferObj->Name); break; case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); params[0] = (GLfloat)(ctx->Array.Vertex.BufferObj->Name); break; case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); params[0] = (GLfloat)(ctx->Array.Normal.BufferObj->Name); break; case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); params[0] = (GLfloat)(ctx->Array.Color.BufferObj->Name); break; case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); params[0] = (GLfloat)(ctx->Array.Index.BufferObj->Name); break; case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); params[0] = (GLfloat)(ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name); break; case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); params[0] = (GLfloat)(ctx->Array.EdgeFlag.BufferObj->Name); break; case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); params[0] = (GLfloat)(ctx->Array.SecondaryColor.BufferObj->Name); break; case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); params[0] = (GLfloat)(ctx->Array.FogCoord.BufferObj->Name); break; case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname); params[0] = (GLfloat)(ctx->Array.ElementArrayBufferObj->Name); break; case GL_PIXEL_PACK_BUFFER_BINDING_EXT: CHECK_EXTENSION_F(EXT_pixel_buffer_object, pname); params[0] = (GLfloat)(ctx->Pack.BufferObj->Name); break; case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: CHECK_EXTENSION_F(EXT_pixel_buffer_object, pname); params[0] = (GLfloat)(ctx->Unpack.BufferObj->Name); break; case GL_MAX_VERTEX_ATTRIBS_ARB: CHECK_EXTENSION_F(ARB_vertex_program, pname); params[0] = (GLfloat)(ctx->Const.MaxVertexProgramAttribs); break; case GL_FRAGMENT_PROGRAM_ARB: CHECK_EXTENSION_F(ARB_fragment_program, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.Enabled); break; case GL_TRANSPOSE_CURRENT_MATRIX_ARB: CHECK_EXTENSION_F(ARB_fragment_program, pname); { const GLfloat *matrix = ctx->CurrentStack->Top->m; params[0] = matrix[0]; params[1] = matrix[4]; params[2] = matrix[8]; params[3] = matrix[12]; params[4] = matrix[1]; params[5] = matrix[5]; params[6] = matrix[9]; params[7] = matrix[13]; params[8] = matrix[2]; params[9] = matrix[6]; params[10] = matrix[10]; params[11] = matrix[14]; params[12] = matrix[3]; params[13] = matrix[7]; params[14] = matrix[11]; params[15] = matrix[15]; } break; case GL_DEPTH_BOUNDS_TEST_EXT: CHECK_EXTENSION_F(EXT_depth_bounds_test, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.BoundsTest); break; case GL_DEPTH_BOUNDS_EXT: CHECK_EXTENSION_F(EXT_depth_bounds_test, pname); params[0] = ctx->Depth.BoundsMin; params[1] = ctx->Depth.BoundsMax; break; case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: CHECK_EXTENSION_F(MESA_program_debug, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.CallbackEnabled); break; case GL_VERTEX_PROGRAM_CALLBACK_MESA: CHECK_EXTENSION_F(MESA_program_debug, pname); params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.CallbackEnabled); break; case GL_FRAGMENT_PROGRAM_POSITION_MESA: CHECK_EXTENSION_F(MESA_program_debug, pname); params[0] = (GLfloat)(ctx->FragmentProgram.CurrentPosition); break; case GL_VERTEX_PROGRAM_POSITION_MESA: CHECK_EXTENSION_F(MESA_program_debug, pname); params[0] = (GLfloat)(ctx->VertexProgram.CurrentPosition); break; case GL_MAX_DRAW_BUFFERS_ARB: CHECK_EXTENSION_F(ARB_draw_buffers, pname); params[0] = (GLfloat)(ctx->Const.MaxDrawBuffers); break; case GL_DRAW_BUFFER0_ARB: CHECK_EXTENSION_F(ARB_draw_buffers, pname); params[0] = ENUM_TO_FLOAT(ctx->Color.DrawBuffer[0]); break; case GL_DRAW_BUFFER1_ARB: CHECK_EXTENSION_F(ARB_draw_buffers, pname); { GLenum buffer; if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); return; } buffer = ctx->Color.DrawBuffer[1]; params[0] = ENUM_TO_FLOAT(buffer); } break; case GL_DRAW_BUFFER2_ARB: CHECK_EXTENSION_F(ARB_draw_buffers, pname); { GLenum buffer; if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); return; } buffer = ctx->Color.DrawBuffer[2]; params[0] = ENUM_TO_FLOAT(buffer); } break; case GL_DRAW_BUFFER3_ARB: CHECK_EXTENSION_F(ARB_draw_buffers, pname); { GLenum buffer; if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); return; } buffer = ctx->Color.DrawBuffer[3]; params[0] = ENUM_TO_FLOAT(buffer); } break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXTENSION_F(OES_read_format, pname); params[0] = (GLfloat)(ctx->Const.ColorReadType); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXTENSION_F(OES_read_format, pname); params[0] = (GLfloat)(ctx->Const.ColorReadFormat); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: CHECK_EXTENSION_F(ATI_fragment_shader, pname); params[0] = (GLfloat)(6); break; case GL_NUM_FRAGMENT_CONSTANTS_ATI: CHECK_EXTENSION_F(ATI_fragment_shader, pname); params[0] = (GLfloat)(8); break; case GL_NUM_PASSES_ATI: CHECK_EXTENSION_F(ATI_fragment_shader, pname); params[0] = (GLfloat)(2); break; case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: CHECK_EXTENSION_F(ATI_fragment_shader, pname); params[0] = (GLfloat)(8); break; case GL_NUM_INSTRUCTIONS_TOTAL_ATI: CHECK_EXTENSION_F(ATI_fragment_shader, pname); params[0] = (GLfloat)(16); break; case GL_COLOR_ALPHA_PAIRING_ATI: CHECK_EXTENSION_F(ATI_fragment_shader, pname); params[0] = BOOLEAN_TO_FLOAT(GL_TRUE); break; case GL_NUM_LOOPBACK_COMPONENTS_ATI: CHECK_EXTENSION_F(ATI_fragment_shader, pname); params[0] = (GLfloat)(3); break; case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: CHECK_EXTENSION_F(ATI_fragment_shader, pname); params[0] = (GLfloat)(3); break; case GL_STENCIL_BACK_FUNC: params[0] = ENUM_TO_FLOAT(ctx->Stencil.Function[1]); break; case GL_STENCIL_BACK_VALUE_MASK: params[0] = (GLfloat)(ctx->Stencil.ValueMask[1]); break; case GL_STENCIL_BACK_REF: params[0] = (GLfloat)(ctx->Stencil.Ref[1]); break; case GL_STENCIL_BACK_FAIL: params[0] = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[1]); break; case GL_STENCIL_BACK_PASS_DEPTH_FAIL: params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[1]); break; case GL_STENCIL_BACK_PASS_DEPTH_PASS: params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[1]); break; case GL_FRAMEBUFFER_BINDING_EXT: CHECK_EXTENSION_F(EXT_framebuffer_object, pname); params[0] = (GLfloat)(ctx->DrawBuffer->Name); break; case GL_RENDERBUFFER_BINDING_EXT: CHECK_EXTENSION_F(EXT_framebuffer_object, pname); params[0] = (GLfloat)(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0); break; case GL_MAX_COLOR_ATTACHMENTS_EXT: CHECK_EXTENSION_F(EXT_framebuffer_object, pname); params[0] = (GLfloat)(ctx->Const.MaxColorAttachments); break; case GL_MAX_RENDERBUFFER_SIZE_EXT: CHECK_EXTENSION_F(EXT_framebuffer_object, pname); params[0] = (GLfloat)(ctx->Const.MaxRenderbufferSize); break; case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: CHECK_EXTENSION_F(ARB_fragment_shader, pname); params[0] = (GLfloat)(MAX_FRAGMENT_UNIFORM_COMPONENTS); break; case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: CHECK_EXTENSION_F(ARB_fragment_shader, pname); params[0] = ENUM_TO_FLOAT(ctx->Hint.FragmentShaderDerivative); break; case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: CHECK_EXTENSION_F(ARB_vertex_shader, pname); params[0] = (GLfloat)(MAX_VERTEX_UNIFORM_COMPONENTS); break; case GL_MAX_VARYING_FLOATS_ARB: CHECK_EXTENSION_F(ARB_vertex_shader, pname); params[0] = (GLfloat)(MAX_VARYING_FLOATS); break; case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXTENSION_F(ARB_vertex_shader, pname); params[0] = (GLfloat)(MAX_VERTEX_TEXTURE_IMAGE_UNITS); break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXTENSION_F(ARB_vertex_shader, pname); params[0] = (GLfloat)(MAX_COMBINED_TEXTURE_IMAGE_UNITS); break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(pname=0x%x)", pname); } } void GLAPIENTRY _mesa_GetIntegerv( GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (!params) return; if (ctx->NewState) _mesa_update_state(ctx); if (ctx->Driver.GetIntegerv && ctx->Driver.GetIntegerv(ctx, pname, params)) return; switch (pname) { case GL_ACCUM_RED_BITS: params[0] = ctx->DrawBuffer->Visual.accumRedBits; break; case GL_ACCUM_GREEN_BITS: params[0] = ctx->DrawBuffer->Visual.accumGreenBits; break; case GL_ACCUM_BLUE_BITS: params[0] = ctx->DrawBuffer->Visual.accumBlueBits; break; case GL_ACCUM_ALPHA_BITS: params[0] = ctx->DrawBuffer->Visual.accumAlphaBits; break; case GL_ACCUM_CLEAR_VALUE: params[0] = FLOAT_TO_INT(ctx->Accum.ClearColor[0]); params[1] = FLOAT_TO_INT(ctx->Accum.ClearColor[1]); params[2] = FLOAT_TO_INT(ctx->Accum.ClearColor[2]); params[3] = FLOAT_TO_INT(ctx->Accum.ClearColor[3]); break; case GL_ALPHA_BIAS: params[0] = IROUND(ctx->Pixel.AlphaBias); break; case GL_ALPHA_BITS: params[0] = ctx->DrawBuffer->Visual.alphaBits; break; case GL_ALPHA_SCALE: params[0] = IROUND(ctx->Pixel.AlphaScale); break; case GL_ALPHA_TEST: params[0] = BOOLEAN_TO_INT(ctx->Color.AlphaEnabled); break; case GL_ALPHA_TEST_FUNC: params[0] = ENUM_TO_INT(ctx->Color.AlphaFunc); break; case GL_ALPHA_TEST_REF: params[0] = FLOAT_TO_INT(ctx->Color.AlphaRef); break; case GL_ATTRIB_STACK_DEPTH: params[0] = ctx->AttribStackDepth; break; case GL_AUTO_NORMAL: params[0] = BOOLEAN_TO_INT(ctx->Eval.AutoNormal); break; case GL_AUX_BUFFERS: params[0] = ctx->DrawBuffer->Visual.numAuxBuffers; break; case GL_BLEND: params[0] = BOOLEAN_TO_INT(ctx->Color.BlendEnabled); break; case GL_BLEND_DST: params[0] = ENUM_TO_INT(ctx->Color.BlendDstRGB); break; case GL_BLEND_SRC: params[0] = ENUM_TO_INT(ctx->Color.BlendSrcRGB); break; case GL_BLEND_SRC_RGB_EXT: params[0] = ENUM_TO_INT(ctx->Color.BlendSrcRGB); break; case GL_BLEND_DST_RGB_EXT: params[0] = ENUM_TO_INT(ctx->Color.BlendDstRGB); break; case GL_BLEND_SRC_ALPHA_EXT: params[0] = ENUM_TO_INT(ctx->Color.BlendSrcA); break; case GL_BLEND_DST_ALPHA_EXT: params[0] = ENUM_TO_INT(ctx->Color.BlendDstA); break; case GL_BLEND_EQUATION: params[0] = ENUM_TO_INT(ctx->Color.BlendEquationRGB ); break; case GL_BLEND_EQUATION_ALPHA_EXT: params[0] = ENUM_TO_INT(ctx->Color.BlendEquationA ); break; case GL_BLEND_COLOR_EXT: params[0] = FLOAT_TO_INT(ctx->Color.BlendColor[0]); params[1] = FLOAT_TO_INT(ctx->Color.BlendColor[1]); params[2] = FLOAT_TO_INT(ctx->Color.BlendColor[2]); params[3] = FLOAT_TO_INT(ctx->Color.BlendColor[3]); break; case GL_BLUE_BIAS: params[0] = IROUND(ctx->Pixel.BlueBias); break; case GL_BLUE_BITS: params[0] = ctx->DrawBuffer->Visual.blueBits; break; case GL_BLUE_SCALE: params[0] = IROUND(ctx->Pixel.BlueScale); break; case GL_CLIENT_ATTRIB_STACK_DEPTH: params[0] = ctx->ClientAttribStackDepth; break; case GL_CLIP_PLANE0: params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 0) & 1); break; case GL_CLIP_PLANE1: params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 1) & 1); break; case GL_CLIP_PLANE2: params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 2) & 1); break; case GL_CLIP_PLANE3: params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 3) & 1); break; case GL_CLIP_PLANE4: params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 4) & 1); break; case GL_CLIP_PLANE5: params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 5) & 1); break; case GL_COLOR_CLEAR_VALUE: params[0] = FLOAT_TO_INT(ctx->Color.ClearColor[0]); params[1] = FLOAT_TO_INT(ctx->Color.ClearColor[1]); params[2] = FLOAT_TO_INT(ctx->Color.ClearColor[2]); params[3] = FLOAT_TO_INT(ctx->Color.ClearColor[3]); break; case GL_COLOR_MATERIAL: params[0] = BOOLEAN_TO_INT(ctx->Light.ColorMaterialEnabled); break; case GL_COLOR_MATERIAL_FACE: params[0] = ENUM_TO_INT(ctx->Light.ColorMaterialFace); break; case GL_COLOR_MATERIAL_PARAMETER: params[0] = ENUM_TO_INT(ctx->Light.ColorMaterialMode); break; case GL_COLOR_WRITEMASK: params[0] = ctx->Color.ColorMask[RCOMP] ? 1 : 0; params[1] = ctx->Color.ColorMask[GCOMP] ? 1 : 0; params[2] = ctx->Color.ColorMask[BCOMP] ? 1 : 0; params[3] = ctx->Color.ColorMask[ACOMP] ? 1 : 0; break; case GL_CULL_FACE: params[0] = BOOLEAN_TO_INT(ctx->Polygon.CullFlag); break; case GL_CULL_FACE_MODE: params[0] = ENUM_TO_INT(ctx->Polygon.CullFaceMode); break; case GL_CURRENT_COLOR: { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); } break; case GL_CURRENT_INDEX: { FLUSH_CURRENT(ctx, 0); params[0] = IROUND(ctx->Current.Index); } break; case GL_CURRENT_NORMAL: { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); } break; case GL_CURRENT_RASTER_COLOR: params[0] = FLOAT_TO_INT(ctx->Current.RasterColor[0]); params[1] = FLOAT_TO_INT(ctx->Current.RasterColor[1]); params[2] = FLOAT_TO_INT(ctx->Current.RasterColor[2]); params[3] = FLOAT_TO_INT(ctx->Current.RasterColor[3]); break; case GL_CURRENT_RASTER_DISTANCE: params[0] = IROUND(ctx->Current.RasterDistance); break; case GL_CURRENT_RASTER_INDEX: params[0] = IROUND(ctx->Current.RasterIndex); break; case GL_CURRENT_RASTER_POSITION: params[0] = IROUND(ctx->Current.RasterPos[0]); params[1] = IROUND(ctx->Current.RasterPos[1]); params[2] = IROUND(ctx->Current.RasterPos[2]); params[3] = IROUND(ctx->Current.RasterPos[3]); break; case GL_CURRENT_RASTER_TEXTURE_COORDS: { const GLuint texUnit = ctx->Texture.CurrentUnit; params[0] = IROUND(ctx->Current.RasterTexCoords[texUnit][0]); params[1] = IROUND(ctx->Current.RasterTexCoords[texUnit][1]); params[2] = IROUND(ctx->Current.RasterTexCoords[texUnit][2]); params[3] = IROUND(ctx->Current.RasterTexCoords[texUnit][3]); } break; case GL_CURRENT_RASTER_POSITION_VALID: params[0] = BOOLEAN_TO_INT(ctx->Current.RasterPosValid); break; case GL_CURRENT_TEXTURE_COORDS: { const GLuint texUnit = ctx->Texture.CurrentUnit; params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]); params[1] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]); params[2] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]); params[3] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]); } break; case GL_DEPTH_BIAS: params[0] = IROUND(ctx->Pixel.DepthBias); break; case GL_DEPTH_BITS: params[0] = ctx->DrawBuffer->Visual.depthBits; break; case GL_DEPTH_CLEAR_VALUE: params[0] = IROUND(ctx->Depth.Clear); break; case GL_DEPTH_FUNC: params[0] = ENUM_TO_INT(ctx->Depth.Func); break; case GL_DEPTH_RANGE: params[0] = FLOAT_TO_INT(ctx->Viewport.Near); params[1] = FLOAT_TO_INT(ctx->Viewport.Far); break; case GL_DEPTH_SCALE: params[0] = IROUND(ctx->Pixel.DepthScale); break; case GL_DEPTH_TEST: params[0] = BOOLEAN_TO_INT(ctx->Depth.Test); break; case GL_DEPTH_WRITEMASK: params[0] = BOOLEAN_TO_INT(ctx->Depth.Mask); break; case GL_DITHER: params[0] = BOOLEAN_TO_INT(ctx->Color.DitherFlag); break; case GL_DOUBLEBUFFER: params[0] = BOOLEAN_TO_INT(ctx->DrawBuffer->Visual.doubleBufferMode); break; case GL_DRAW_BUFFER: params[0] = ENUM_TO_INT(ctx->Color.DrawBuffer[0]); break; case GL_EDGE_FLAG: { FLUSH_CURRENT(ctx, 0); params[0] = BOOLEAN_TO_INT(ctx->Current.EdgeFlag); } break; case GL_FEEDBACK_BUFFER_SIZE: params[0] = ctx->Feedback.BufferSize; break; case GL_FEEDBACK_BUFFER_TYPE: params[0] = ENUM_TO_INT(ctx->Feedback.Type); break; case GL_FOG: params[0] = BOOLEAN_TO_INT(ctx->Fog.Enabled); break; case GL_FOG_COLOR: params[0] = FLOAT_TO_INT(ctx->Fog.Color[0]); params[1] = FLOAT_TO_INT(ctx->Fog.Color[1]); params[2] = FLOAT_TO_INT(ctx->Fog.Color[2]); params[3] = FLOAT_TO_INT(ctx->Fog.Color[3]); break; case GL_FOG_DENSITY: params[0] = IROUND(ctx->Fog.Density); break; case GL_FOG_END: params[0] = IROUND(ctx->Fog.End); break; case GL_FOG_HINT: params[0] = ENUM_TO_INT(ctx->Hint.Fog); break; case GL_FOG_INDEX: params[0] = IROUND(ctx->Fog.Index); break; case GL_FOG_MODE: params[0] = ENUM_TO_INT(ctx->Fog.Mode); break; case GL_FOG_START: params[0] = IROUND(ctx->Fog.Start); break; case GL_FRONT_FACE: params[0] = ENUM_TO_INT(ctx->Polygon.FrontFace); break; case GL_GREEN_BIAS: params[0] = IROUND(ctx->Pixel.GreenBias); break; case GL_GREEN_BITS: params[0] = ctx->DrawBuffer->Visual.greenBits; break; case GL_GREEN_SCALE: params[0] = IROUND(ctx->Pixel.GreenScale); break; case GL_INDEX_BITS: params[0] = ctx->DrawBuffer->Visual.indexBits; break; case GL_INDEX_CLEAR_VALUE: params[0] = ctx->Color.ClearIndex; break; case GL_INDEX_MODE: params[0] = BOOLEAN_TO_INT(!ctx->DrawBuffer->Visual.rgbMode); break; case GL_INDEX_OFFSET: params[0] = ctx->Pixel.IndexOffset; break; case GL_INDEX_SHIFT: params[0] = ctx->Pixel.IndexShift; break; case GL_INDEX_WRITEMASK: params[0] = ctx->Color.IndexMask; break; case GL_LIGHT0: params[0] = BOOLEAN_TO_INT(ctx->Light.Light[0].Enabled); break; case GL_LIGHT1: params[0] = BOOLEAN_TO_INT(ctx->Light.Light[1].Enabled); break; case GL_LIGHT2: params[0] = BOOLEAN_TO_INT(ctx->Light.Light[2].Enabled); break; case GL_LIGHT3: params[0] = BOOLEAN_TO_INT(ctx->Light.Light[3].Enabled); break; case GL_LIGHT4: params[0] = BOOLEAN_TO_INT(ctx->Light.Light[4].Enabled); break; case GL_LIGHT5: params[0] = BOOLEAN_TO_INT(ctx->Light.Light[5].Enabled); break; case GL_LIGHT6: params[0] = BOOLEAN_TO_INT(ctx->Light.Light[6].Enabled); break; case GL_LIGHT7: params[0] = BOOLEAN_TO_INT(ctx->Light.Light[7].Enabled); break; case GL_LIGHTING: params[0] = BOOLEAN_TO_INT(ctx->Light.Enabled); break; case GL_LIGHT_MODEL_AMBIENT: params[0] = FLOAT_TO_INT(ctx->Light.Model.Ambient[0]); params[1] = FLOAT_TO_INT(ctx->Light.Model.Ambient[1]); params[2] = FLOAT_TO_INT(ctx->Light.Model.Ambient[2]); params[3] = FLOAT_TO_INT(ctx->Light.Model.Ambient[3]); break; case GL_LIGHT_MODEL_COLOR_CONTROL: params[0] = ENUM_TO_INT(ctx->Light.Model.ColorControl); break; case GL_LIGHT_MODEL_LOCAL_VIEWER: params[0] = BOOLEAN_TO_INT(ctx->Light.Model.LocalViewer); break; case GL_LIGHT_MODEL_TWO_SIDE: params[0] = BOOLEAN_TO_INT(ctx->Light.Model.TwoSide); break; case GL_LINE_SMOOTH: params[0] = BOOLEAN_TO_INT(ctx->Line.SmoothFlag); break; case GL_LINE_SMOOTH_HINT: params[0] = ENUM_TO_INT(ctx->Hint.LineSmooth); break; case GL_LINE_STIPPLE: params[0] = BOOLEAN_TO_INT(ctx->Line.StippleFlag); break; case GL_LINE_STIPPLE_PATTERN: params[0] = ctx->Line.StipplePattern; break; case GL_LINE_STIPPLE_REPEAT: params[0] = ctx->Line.StippleFactor; break; case GL_LINE_WIDTH: params[0] = IROUND(ctx->Line.Width); break; case GL_LINE_WIDTH_GRANULARITY: params[0] = IROUND(ctx->Const.LineWidthGranularity); break; case GL_LINE_WIDTH_RANGE: params[0] = IROUND(ctx->Const.MinLineWidthAA); params[1] = IROUND(ctx->Const.MaxLineWidthAA); break; case GL_ALIASED_LINE_WIDTH_RANGE: params[0] = IROUND(ctx->Const.MinLineWidth); params[1] = IROUND(ctx->Const.MaxLineWidth); break; case GL_LIST_BASE: params[0] = ctx->List.ListBase; break; case GL_LIST_INDEX: params[0] = ctx->ListState.CurrentListNum; break; case GL_LIST_MODE: { GLenum mode; if (!ctx->CompileFlag) mode = 0; else if (ctx->ExecuteFlag) mode = GL_COMPILE_AND_EXECUTE; else mode = GL_COMPILE; params[0] = ENUM_TO_INT(mode); } break; case GL_INDEX_LOGIC_OP: params[0] = BOOLEAN_TO_INT(ctx->Color.IndexLogicOpEnabled); break; case GL_COLOR_LOGIC_OP: params[0] = BOOLEAN_TO_INT(ctx->Color.ColorLogicOpEnabled); break; case GL_LOGIC_OP_MODE: params[0] = ENUM_TO_INT(ctx->Color.LogicOp); break; case GL_MAP1_COLOR_4: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Color4); break; case GL_MAP1_GRID_DOMAIN: params[0] = IROUND(ctx->Eval.MapGrid1u1); params[1] = IROUND(ctx->Eval.MapGrid1u2); break; case GL_MAP1_GRID_SEGMENTS: params[0] = ctx->Eval.MapGrid1un; break; case GL_MAP1_INDEX: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Index); break; case GL_MAP1_NORMAL: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Normal); break; case GL_MAP1_TEXTURE_COORD_1: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord1); break; case GL_MAP1_TEXTURE_COORD_2: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord2); break; case GL_MAP1_TEXTURE_COORD_3: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord3); break; case GL_MAP1_TEXTURE_COORD_4: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord4); break; case GL_MAP1_VERTEX_3: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Vertex3); break; case GL_MAP1_VERTEX_4: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Vertex4); break; case GL_MAP2_COLOR_4: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Color4); break; case GL_MAP2_GRID_DOMAIN: params[0] = IROUND(ctx->Eval.MapGrid2u1); params[1] = IROUND(ctx->Eval.MapGrid2u2); params[2] = IROUND(ctx->Eval.MapGrid2v1); params[3] = IROUND(ctx->Eval.MapGrid2v2); break; case GL_MAP2_GRID_SEGMENTS: params[0] = ctx->Eval.MapGrid2un; params[1] = ctx->Eval.MapGrid2vn; break; case GL_MAP2_INDEX: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Index); break; case GL_MAP2_NORMAL: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Normal); break; case GL_MAP2_TEXTURE_COORD_1: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord1); break; case GL_MAP2_TEXTURE_COORD_2: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord2); break; case GL_MAP2_TEXTURE_COORD_3: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord3); break; case GL_MAP2_TEXTURE_COORD_4: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord4); break; case GL_MAP2_VERTEX_3: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Vertex3); break; case GL_MAP2_VERTEX_4: params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Vertex4); break; case GL_MAP_COLOR: params[0] = BOOLEAN_TO_INT(ctx->Pixel.MapColorFlag); break; case GL_MAP_STENCIL: params[0] = BOOLEAN_TO_INT(ctx->Pixel.MapStencilFlag); break; case GL_MATRIX_MODE: params[0] = ENUM_TO_INT(ctx->Transform.MatrixMode); break; case GL_MAX_ATTRIB_STACK_DEPTH: params[0] = MAX_ATTRIB_STACK_DEPTH; break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: params[0] = MAX_CLIENT_ATTRIB_STACK_DEPTH; break; case GL_MAX_CLIP_PLANES: params[0] = ctx->Const.MaxClipPlanes; break; case GL_MAX_ELEMENTS_VERTICES: params[0] = ctx->Const.MaxArrayLockSize; break; case GL_MAX_ELEMENTS_INDICES: params[0] = ctx->Const.MaxArrayLockSize; break; case GL_MAX_EVAL_ORDER: params[0] = MAX_EVAL_ORDER; break; case GL_MAX_LIGHTS: params[0] = ctx->Const.MaxLights; break; case GL_MAX_LIST_NESTING: params[0] = MAX_LIST_NESTING; break; case GL_MAX_MODELVIEW_STACK_DEPTH: params[0] = MAX_MODELVIEW_STACK_DEPTH; break; case GL_MAX_NAME_STACK_DEPTH: params[0] = MAX_NAME_STACK_DEPTH; break; case GL_MAX_PIXEL_MAP_TABLE: params[0] = MAX_PIXEL_MAP_TABLE; break; case GL_MAX_PROJECTION_STACK_DEPTH: params[0] = MAX_PROJECTION_STACK_DEPTH; break; case GL_MAX_TEXTURE_SIZE: params[0] = 1 << (ctx->Const.MaxTextureLevels - 1); break; case GL_MAX_3D_TEXTURE_SIZE: params[0] = 1 << (ctx->Const.Max3DTextureLevels - 1); break; case GL_MAX_TEXTURE_STACK_DEPTH: params[0] = MAX_TEXTURE_STACK_DEPTH; break; case GL_MAX_VIEWPORT_DIMS: params[0] = ctx->Const.MaxViewportWidth; params[1] = ctx->Const.MaxViewportHeight; break; case GL_MODELVIEW_MATRIX: { const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; params[0] = IROUND(matrix[0]); params[1] = IROUND(matrix[1]); params[2] = IROUND(matrix[2]); params[3] = IROUND(matrix[3]); params[4] = IROUND(matrix[4]); params[5] = IROUND(matrix[5]); params[6] = IROUND(matrix[6]); params[7] = IROUND(matrix[7]); params[8] = IROUND(matrix[8]); params[9] = IROUND(matrix[9]); params[10] = IROUND(matrix[10]); params[11] = IROUND(matrix[11]); params[12] = IROUND(matrix[12]); params[13] = IROUND(matrix[13]); params[14] = IROUND(matrix[14]); params[15] = IROUND(matrix[15]); } break; case GL_MODELVIEW_STACK_DEPTH: params[0] = ctx->ModelviewMatrixStack.Depth + 1; break; case GL_NAME_STACK_DEPTH: params[0] = ctx->Select.NameStackDepth; break; case GL_NORMALIZE: params[0] = BOOLEAN_TO_INT(ctx->Transform.Normalize); break; case GL_PACK_ALIGNMENT: params[0] = ctx->Pack.Alignment; break; case GL_PACK_LSB_FIRST: params[0] = BOOLEAN_TO_INT(ctx->Pack.LsbFirst); break; case GL_PACK_ROW_LENGTH: params[0] = ctx->Pack.RowLength; break; case GL_PACK_SKIP_PIXELS: params[0] = ctx->Pack.SkipPixels; break; case GL_PACK_SKIP_ROWS: params[0] = ctx->Pack.SkipRows; break; case GL_PACK_SWAP_BYTES: params[0] = BOOLEAN_TO_INT(ctx->Pack.SwapBytes); break; case GL_PACK_SKIP_IMAGES_EXT: params[0] = ctx->Pack.SkipImages; break; case GL_PACK_IMAGE_HEIGHT_EXT: params[0] = ctx->Pack.ImageHeight; break; case GL_PACK_INVERT_MESA: params[0] = BOOLEAN_TO_INT(ctx->Pack.Invert); break; case GL_PERSPECTIVE_CORRECTION_HINT: params[0] = ENUM_TO_INT(ctx->Hint.PerspectiveCorrection); break; case GL_PIXEL_MAP_A_TO_A_SIZE: params[0] = ctx->Pixel.MapAtoAsize; break; case GL_PIXEL_MAP_B_TO_B_SIZE: params[0] = ctx->Pixel.MapBtoBsize; break; case GL_PIXEL_MAP_G_TO_G_SIZE: params[0] = ctx->Pixel.MapGtoGsize; break; case GL_PIXEL_MAP_I_TO_A_SIZE: params[0] = ctx->Pixel.MapItoAsize; break; case GL_PIXEL_MAP_I_TO_B_SIZE: params[0] = ctx->Pixel.MapItoBsize; break; case GL_PIXEL_MAP_I_TO_G_SIZE: params[0] = ctx->Pixel.MapItoGsize; break; case GL_PIXEL_MAP_I_TO_I_SIZE: params[0] = ctx->Pixel.MapItoIsize; break; case GL_PIXEL_MAP_I_TO_R_SIZE: params[0] = ctx->Pixel.MapItoRsize; break; case GL_PIXEL_MAP_R_TO_R_SIZE: params[0] = ctx->Pixel.MapRtoRsize; break; case GL_PIXEL_MAP_S_TO_S_SIZE: params[0] = ctx->Pixel.MapStoSsize; break; case GL_POINT_SIZE: params[0] = IROUND(ctx->Point.Size); break; case GL_POINT_SIZE_GRANULARITY: params[0] = IROUND(ctx->Const.PointSizeGranularity); break; case GL_POINT_SIZE_RANGE: params[0] = IROUND(ctx->Const.MinPointSizeAA); params[1] = IROUND(ctx->Const.MaxPointSizeAA); break; case GL_ALIASED_POINT_SIZE_RANGE: params[0] = IROUND(ctx->Const.MinPointSize); params[1] = IROUND(ctx->Const.MaxPointSize); break; case GL_POINT_SMOOTH: params[0] = BOOLEAN_TO_INT(ctx->Point.SmoothFlag); break; case GL_POINT_SMOOTH_HINT: params[0] = ENUM_TO_INT(ctx->Hint.PointSmooth); break; case GL_POINT_SIZE_MIN_EXT: params[0] = IROUND(ctx->Point.MinSize); break; case GL_POINT_SIZE_MAX_EXT: params[0] = IROUND(ctx->Point.MaxSize); break; case GL_POINT_FADE_THRESHOLD_SIZE_EXT: params[0] = IROUND(ctx->Point.Threshold); break; case GL_DISTANCE_ATTENUATION_EXT: params[0] = IROUND(ctx->Point.Params[0]); params[1] = IROUND(ctx->Point.Params[1]); params[2] = IROUND(ctx->Point.Params[2]); break; case GL_POLYGON_MODE: params[0] = ENUM_TO_INT(ctx->Polygon.FrontMode); params[1] = ENUM_TO_INT(ctx->Polygon.BackMode); break; case GL_POLYGON_OFFSET_BIAS_EXT: params[0] = IROUND(ctx->Polygon.OffsetUnits); break; case GL_POLYGON_OFFSET_FACTOR: params[0] = IROUND(ctx->Polygon.OffsetFactor ); break; case GL_POLYGON_OFFSET_UNITS: params[0] = IROUND(ctx->Polygon.OffsetUnits ); break; case GL_POLYGON_SMOOTH: params[0] = BOOLEAN_TO_INT(ctx->Polygon.SmoothFlag); break; case GL_POLYGON_SMOOTH_HINT: params[0] = ENUM_TO_INT(ctx->Hint.PolygonSmooth); break; case GL_POLYGON_STIPPLE: params[0] = BOOLEAN_TO_INT(ctx->Polygon.StippleFlag); break; case GL_PROJECTION_MATRIX: { const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; params[0] = IROUND(matrix[0]); params[1] = IROUND(matrix[1]); params[2] = IROUND(matrix[2]); params[3] = IROUND(matrix[3]); params[4] = IROUND(matrix[4]); params[5] = IROUND(matrix[5]); params[6] = IROUND(matrix[6]); params[7] = IROUND(matrix[7]); params[8] = IROUND(matrix[8]); params[9] = IROUND(matrix[9]); params[10] = IROUND(matrix[10]); params[11] = IROUND(matrix[11]); params[12] = IROUND(matrix[12]); params[13] = IROUND(matrix[13]); params[14] = IROUND(matrix[14]); params[15] = IROUND(matrix[15]); } break; case GL_PROJECTION_STACK_DEPTH: params[0] = ctx->ProjectionMatrixStack.Depth + 1; break; case GL_READ_BUFFER: params[0] = ENUM_TO_INT(ctx->Pixel.ReadBuffer); break; case GL_RED_BIAS: params[0] = IROUND(ctx->Pixel.RedBias); break; case GL_RED_BITS: params[0] = ctx->DrawBuffer->Visual.redBits ; break; case GL_RED_SCALE: params[0] = IROUND(ctx->Pixel.RedScale); break; case GL_RENDER_MODE: params[0] = ENUM_TO_INT(ctx->RenderMode); break; case GL_RESCALE_NORMAL: params[0] = BOOLEAN_TO_INT(ctx->Transform.RescaleNormals); break; case GL_RGBA_MODE: params[0] = BOOLEAN_TO_INT(ctx->DrawBuffer->Visual.rgbMode); break; case GL_SCISSOR_BOX: params[0] = ctx->Scissor.X; params[1] = ctx->Scissor.Y; params[2] = ctx->Scissor.Width; params[3] = ctx->Scissor.Height; break; case GL_SCISSOR_TEST: params[0] = BOOLEAN_TO_INT(ctx->Scissor.Enabled); break; case GL_SELECTION_BUFFER_SIZE: params[0] = ctx->Select.BufferSize; break; case GL_SHADE_MODEL: params[0] = ENUM_TO_INT(ctx->Light.ShadeModel); break; case GL_SHARED_TEXTURE_PALETTE_EXT: params[0] = BOOLEAN_TO_INT(ctx->Texture.SharedPalette); break; case GL_STENCIL_BITS: params[0] = ctx->DrawBuffer->Visual.stencilBits; break; case GL_STENCIL_CLEAR_VALUE: params[0] = ctx->Stencil.Clear; break; case GL_STENCIL_FAIL: params[0] = ENUM_TO_INT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_FUNC: params[0] = ENUM_TO_INT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_PASS_DEPTH_FAIL: params[0] = ENUM_TO_INT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_PASS_DEPTH_PASS: params[0] = ENUM_TO_INT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_REF: params[0] = ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; break; case GL_STENCIL_TEST: params[0] = BOOLEAN_TO_INT(ctx->Stencil.Enabled); break; case GL_STENCIL_VALUE_MASK: params[0] = ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; break; case GL_STENCIL_WRITEMASK: params[0] = ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]; break; case GL_STEREO: params[0] = BOOLEAN_TO_INT(ctx->DrawBuffer->Visual.stereoMode); break; case GL_SUBPIXEL_BITS: params[0] = ctx->Const.SubPixelBits; break; case GL_TEXTURE_1D: params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_1D)); break; case GL_TEXTURE_2D: params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_2D)); break; case GL_TEXTURE_3D: params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_3D)); break; case GL_TEXTURE_BINDING_1D: params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name; break; case GL_TEXTURE_BINDING_2D: params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name; break; case GL_TEXTURE_BINDING_3D: params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name; break; case GL_TEXTURE_ENV_COLOR: { const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; params[0] = FLOAT_TO_INT(color[0]); params[1] = FLOAT_TO_INT(color[1]); params[2] = FLOAT_TO_INT(color[2]); params[3] = FLOAT_TO_INT(color[3]); } break; case GL_TEXTURE_ENV_MODE: params[0] = ENUM_TO_INT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode); break; case GL_TEXTURE_GEN_S: params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); break; case GL_TEXTURE_GEN_T: params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)); break; case GL_TEXTURE_GEN_R: params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)); break; case GL_TEXTURE_GEN_Q: params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)); break; case GL_TEXTURE_MATRIX: { const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; params[0] = IROUND(matrix[0]); params[1] = IROUND(matrix[1]); params[2] = IROUND(matrix[2]); params[3] = IROUND(matrix[3]); params[4] = IROUND(matrix[4]); params[5] = IROUND(matrix[5]); params[6] = IROUND(matrix[6]); params[7] = IROUND(matrix[7]); params[8] = IROUND(matrix[8]); params[9] = IROUND(matrix[9]); params[10] = IROUND(matrix[10]); params[11] = IROUND(matrix[11]); params[12] = IROUND(matrix[12]); params[13] = IROUND(matrix[13]); params[14] = IROUND(matrix[14]); params[15] = IROUND(matrix[15]); } break; case GL_TEXTURE_STACK_DEPTH: params[0] = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1; break; case GL_UNPACK_ALIGNMENT: params[0] = ctx->Unpack.Alignment; break; case GL_UNPACK_LSB_FIRST: params[0] = BOOLEAN_TO_INT(ctx->Unpack.LsbFirst); break; case GL_UNPACK_ROW_LENGTH: params[0] = ctx->Unpack.RowLength; break; case GL_UNPACK_SKIP_PIXELS: params[0] = ctx->Unpack.SkipPixels; break; case GL_UNPACK_SKIP_ROWS: params[0] = ctx->Unpack.SkipRows; break; case GL_UNPACK_SWAP_BYTES: params[0] = BOOLEAN_TO_INT(ctx->Unpack.SwapBytes); break; case GL_UNPACK_SKIP_IMAGES_EXT: params[0] = ctx->Unpack.SkipImages; break; case GL_UNPACK_IMAGE_HEIGHT_EXT: params[0] = ctx->Unpack.ImageHeight; break; case GL_UNPACK_CLIENT_STORAGE_APPLE: params[0] = BOOLEAN_TO_INT(ctx->Unpack.ClientStorage); break; case GL_VIEWPORT: params[0] = ctx->Viewport.X; params[1] = ctx->Viewport.Y; params[2] = ctx->Viewport.Width; params[3] = ctx->Viewport.Height; break; case GL_ZOOM_X: params[0] = IROUND(ctx->Pixel.ZoomX); break; case GL_ZOOM_Y: params[0] = IROUND(ctx->Pixel.ZoomY); break; case GL_VERTEX_ARRAY: params[0] = BOOLEAN_TO_INT(ctx->Array.Vertex.Enabled); break; case GL_VERTEX_ARRAY_SIZE: params[0] = ctx->Array.Vertex.Size; break; case GL_VERTEX_ARRAY_TYPE: params[0] = ENUM_TO_INT(ctx->Array.Vertex.Type); break; case GL_VERTEX_ARRAY_STRIDE: params[0] = ctx->Array.Vertex.Stride; break; case GL_VERTEX_ARRAY_COUNT_EXT: params[0] = 0; break; case GL_NORMAL_ARRAY: params[0] = ENUM_TO_INT(ctx->Array.Normal.Enabled); break; case GL_NORMAL_ARRAY_TYPE: params[0] = ENUM_TO_INT(ctx->Array.Normal.Type); break; case GL_NORMAL_ARRAY_STRIDE: params[0] = ctx->Array.Normal.Stride; break; case GL_NORMAL_ARRAY_COUNT_EXT: params[0] = 0; break; case GL_COLOR_ARRAY: params[0] = BOOLEAN_TO_INT(ctx->Array.Color.Enabled); break; case GL_COLOR_ARRAY_SIZE: params[0] = ctx->Array.Color.Size; break; case GL_COLOR_ARRAY_TYPE: params[0] = ENUM_TO_INT(ctx->Array.Color.Type); break; case GL_COLOR_ARRAY_STRIDE: params[0] = ctx->Array.Color.Stride; break; case GL_COLOR_ARRAY_COUNT_EXT: params[0] = 0; break; case GL_INDEX_ARRAY: params[0] = BOOLEAN_TO_INT(ctx->Array.Index.Enabled); break; case GL_INDEX_ARRAY_TYPE: params[0] = ENUM_TO_INT(ctx->Array.Index.Type); break; case GL_INDEX_ARRAY_STRIDE: params[0] = ctx->Array.Index.Stride; break; case GL_INDEX_ARRAY_COUNT_EXT: params[0] = 0; break; case GL_TEXTURE_COORD_ARRAY: params[0] = BOOLEAN_TO_INT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled); break; case GL_TEXTURE_COORD_ARRAY_SIZE: params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size; break; case GL_TEXTURE_COORD_ARRAY_TYPE: params[0] = ENUM_TO_INT(ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type); break; case GL_TEXTURE_COORD_ARRAY_STRIDE: params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride; break; case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: params[0] = 0; break; case GL_EDGE_FLAG_ARRAY: params[0] = BOOLEAN_TO_INT(ctx->Array.EdgeFlag.Enabled); break; case GL_EDGE_FLAG_ARRAY_STRIDE: params[0] = ctx->Array.EdgeFlag.Stride; break; case GL_EDGE_FLAG_ARRAY_COUNT_EXT: params[0] = 0; break; case GL_MAX_TEXTURE_UNITS_ARB: CHECK_EXTENSION_I(ARB_multitexture, pname); params[0] = MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits); break; case GL_ACTIVE_TEXTURE_ARB: CHECK_EXTENSION_I(ARB_multitexture, pname); params[0] = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit; break; case GL_CLIENT_ACTIVE_TEXTURE_ARB: CHECK_EXTENSION_I(ARB_multitexture, pname); params[0] = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture; break; case GL_TEXTURE_CUBE_MAP_ARB: CHECK_EXTENSION_I(ARB_texture_cube_map, pname); params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)); break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: CHECK_EXTENSION_I(ARB_texture_cube_map, pname); params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name; break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: CHECK_EXTENSION_I(ARB_texture_cube_map, pname); params[0] = (1 << (ctx->Const.MaxCubeTextureLevels - 1)); break; case GL_TEXTURE_COMPRESSION_HINT_ARB: CHECK_EXTENSION_I(ARB_texture_compression, pname); params[0] = ctx->Hint.TextureCompression; break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: CHECK_EXTENSION_I(ARB_texture_compression, pname); params[0] = _mesa_get_compressed_formats(ctx, NULL); break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: CHECK_EXTENSION_I(ARB_texture_compression, pname); { GLint formats[100]; GLuint i, n = _mesa_get_compressed_formats(ctx, formats); ASSERT(n <= 100); for (i = 0; i < n; i++) params[i] = ENUM_TO_INT(formats[i]); } break; case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: CHECK_EXTENSION_I(EXT_compiled_vertex_array, pname); params[0] = ctx->Array.LockFirst; break; case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: CHECK_EXTENSION_I(EXT_compiled_vertex_array, pname); params[0] = ctx->Array.LockCount; break; case GL_TRANSPOSE_COLOR_MATRIX_ARB: { const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; params[0] = IROUND(matrix[0]); params[1] = IROUND(matrix[4]); params[2] = IROUND(matrix[8]); params[3] = IROUND(matrix[12]); params[4] = IROUND(matrix[1]); params[5] = IROUND(matrix[5]); params[6] = IROUND(matrix[9]); params[7] = IROUND(matrix[13]); params[8] = IROUND(matrix[2]); params[9] = IROUND(matrix[6]); params[10] = IROUND(matrix[10]); params[11] = IROUND(matrix[14]); params[12] = IROUND(matrix[3]); params[13] = IROUND(matrix[7]); params[14] = IROUND(matrix[11]); params[15] = IROUND(matrix[15]); } break; case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: { const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; params[0] = IROUND(matrix[0]); params[1] = IROUND(matrix[4]); params[2] = IROUND(matrix[8]); params[3] = IROUND(matrix[12]); params[4] = IROUND(matrix[1]); params[5] = IROUND(matrix[5]); params[6] = IROUND(matrix[9]); params[7] = IROUND(matrix[13]); params[8] = IROUND(matrix[2]); params[9] = IROUND(matrix[6]); params[10] = IROUND(matrix[10]); params[11] = IROUND(matrix[14]); params[12] = IROUND(matrix[3]); params[13] = IROUND(matrix[7]); params[14] = IROUND(matrix[11]); params[15] = IROUND(matrix[15]); } break; case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: { const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; params[0] = IROUND(matrix[0]); params[1] = IROUND(matrix[4]); params[2] = IROUND(matrix[8]); params[3] = IROUND(matrix[12]); params[4] = IROUND(matrix[1]); params[5] = IROUND(matrix[5]); params[6] = IROUND(matrix[9]); params[7] = IROUND(matrix[13]); params[8] = IROUND(matrix[2]); params[9] = IROUND(matrix[6]); params[10] = IROUND(matrix[10]); params[11] = IROUND(matrix[14]); params[12] = IROUND(matrix[3]); params[13] = IROUND(matrix[7]); params[14] = IROUND(matrix[11]); params[15] = IROUND(matrix[15]); } break; case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: { const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; params[0] = IROUND(matrix[0]); params[1] = IROUND(matrix[4]); params[2] = IROUND(matrix[8]); params[3] = IROUND(matrix[12]); params[4] = IROUND(matrix[1]); params[5] = IROUND(matrix[5]); params[6] = IROUND(matrix[9]); params[7] = IROUND(matrix[13]); params[8] = IROUND(matrix[2]); params[9] = IROUND(matrix[6]); params[10] = IROUND(matrix[10]); params[11] = IROUND(matrix[14]); params[12] = IROUND(matrix[3]); params[13] = IROUND(matrix[7]); params[14] = IROUND(matrix[11]); params[15] = IROUND(matrix[15]); } break; case GL_OCCLUSION_TEST_HP: CHECK_EXTENSION_I(HP_occlusion_test, pname); params[0] = BOOLEAN_TO_INT(ctx->Depth.OcclusionTest); break; case GL_OCCLUSION_TEST_RESULT_HP: CHECK_EXTENSION_I(HP_occlusion_test, pname); { FLUSH_VERTICES(ctx, _NEW_DEPTH); if (ctx->Depth.OcclusionTest) params[0] = ctx->OcclusionResult; else params[0] = ctx->OcclusionResultSaved; /* reset flag now */ ctx->OcclusionResult = GL_FALSE; ctx->OcclusionResultSaved = GL_FALSE; return; } break; case GL_PIXEL_TEXTURE_SGIS: CHECK_EXTENSION_I(SGIS_pixel_texture, pname); params[0] = BOOLEAN_TO_INT(ctx->Pixel.PixelTextureEnabled); break; case GL_PIXEL_TEX_GEN_SGIX: CHECK_EXTENSION_I(SGIX_pixel_texture, pname); params[0] = BOOLEAN_TO_INT(ctx->Pixel.PixelTextureEnabled); break; case GL_PIXEL_TEX_GEN_MODE_SGIX: CHECK_EXTENSION_I(SGIX_pixel_texture, pname); params[0] = ENUM_TO_INT(pixel_texgen_mode(ctx)); break; case GL_COLOR_MATRIX_SGI: { const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; params[0] = IROUND(matrix[0]); params[1] = IROUND(matrix[1]); params[2] = IROUND(matrix[2]); params[3] = IROUND(matrix[3]); params[4] = IROUND(matrix[4]); params[5] = IROUND(matrix[5]); params[6] = IROUND(matrix[6]); params[7] = IROUND(matrix[7]); params[8] = IROUND(matrix[8]); params[9] = IROUND(matrix[9]); params[10] = IROUND(matrix[10]); params[11] = IROUND(matrix[11]); params[12] = IROUND(matrix[12]); params[13] = IROUND(matrix[13]); params[14] = IROUND(matrix[14]); params[15] = IROUND(matrix[15]); } break; case GL_COLOR_MATRIX_STACK_DEPTH_SGI: params[0] = ctx->ColorMatrixStack.Depth + 1; break; case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: params[0] = MAX_COLOR_STACK_DEPTH; break; case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[0]); break; case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[1]); break; case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[2]); break; case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[3]); break; case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[0]); break; case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[1]); break; case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[2]); break; case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[3]); break; case GL_CONVOLUTION_1D_EXT: CHECK_EXTENSION_I(EXT_convolution, pname); params[0] = BOOLEAN_TO_INT(ctx->Pixel.Convolution1DEnabled); break; case GL_CONVOLUTION_2D_EXT: CHECK_EXTENSION_I(EXT_convolution, pname); params[0] = BOOLEAN_TO_INT(ctx->Pixel.Convolution2DEnabled); break; case GL_SEPARABLE_2D_EXT: CHECK_EXTENSION_I(EXT_convolution, pname); params[0] = BOOLEAN_TO_INT(ctx->Pixel.Separable2DEnabled); break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: CHECK_EXTENSION_I(EXT_convolution, pname); params[0] = IROUND(ctx->Pixel.PostConvolutionScale[0]); break; case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: CHECK_EXTENSION_I(EXT_convolution, pname); params[0] = IROUND(ctx->Pixel.PostConvolutionScale[1]); break; case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: CHECK_EXTENSION_I(EXT_convolution, pname); params[0] = IROUND(ctx->Pixel.PostConvolutionScale[2]); break; case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: CHECK_EXTENSION_I(EXT_convolution, pname); params[0] = IROUND(ctx->Pixel.PostConvolutionScale[3]); break; case GL_POST_CONVOLUTION_RED_BIAS_EXT: CHECK_EXTENSION_I(EXT_convolution, pname); params[0] = IROUND(ctx->Pixel.PostConvolutionBias[0]); break; case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: CHECK_EXTENSION_I(EXT_convolution, pname); params[0] = IROUND(ctx->Pixel.PostConvolutionBias[1]); break; case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: CHECK_EXTENSION_I(EXT_convolution, pname); params[0] = IROUND(ctx->Pixel.PostConvolutionBias[2]); break; case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: CHECK_EXTENSION_I(EXT_convolution, pname); params[0] = IROUND(ctx->Pixel.PostConvolutionBias[3]); break; case GL_HISTOGRAM: CHECK_EXTENSION_I(EXT_histogram, pname); params[0] = BOOLEAN_TO_INT(ctx->Pixel.HistogramEnabled); break; case GL_MINMAX: CHECK_EXTENSION_I(EXT_histogram, pname); params[0] = BOOLEAN_TO_INT(ctx->Pixel.MinMaxEnabled); break; case GL_COLOR_TABLE_SGI: CHECK_EXTENSION_I(SGI_color_table, pname); params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled); break; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: CHECK_EXTENSION_I(SGI_color_table, pname); params[0] = BOOLEAN_TO_INT(ctx->Pixel.PostConvolutionColorTableEnabled); break; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: CHECK_EXTENSION_I(SGI_color_table, pname); params[0] = BOOLEAN_TO_INT(ctx->Pixel.PostColorMatrixColorTableEnabled); break; case GL_TEXTURE_COLOR_TABLE_SGI: CHECK_EXTENSION_I(SGI_texture_color_table, pname); params[0] = BOOLEAN_TO_INT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled); break; case GL_COLOR_SUM_EXT: CHECK_EXTENSION_I(EXT_secondary_color, pname); params[0] = BOOLEAN_TO_INT(ctx->Fog.ColorSumEnabled); break; case GL_CURRENT_SECONDARY_COLOR_EXT: CHECK_EXTENSION_I(EXT_secondary_color, pname); { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]); } break; case GL_SECONDARY_COLOR_ARRAY_EXT: CHECK_EXTENSION_I(EXT_secondary_color, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.SecondaryColor.Enabled); break; case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: CHECK_EXTENSION_I(EXT_secondary_color, pname); params[0] = ENUM_TO_INT(ctx->Array.SecondaryColor.Type); break; case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: CHECK_EXTENSION_I(EXT_secondary_color, pname); params[0] = ctx->Array.SecondaryColor.Stride; break; case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: CHECK_EXTENSION_I(EXT_secondary_color, pname); params[0] = ctx->Array.SecondaryColor.Size; break; case GL_CURRENT_FOG_COORDINATE_EXT: CHECK_EXTENSION_I(EXT_fog_coord, pname); { FLUSH_CURRENT(ctx, 0); params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); } break; case GL_FOG_COORDINATE_ARRAY_EXT: CHECK_EXTENSION_I(EXT_fog_coord, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.FogCoord.Enabled); break; case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: CHECK_EXTENSION_I(EXT_fog_coord, pname); params[0] = ENUM_TO_INT(ctx->Array.FogCoord.Type); break; case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: CHECK_EXTENSION_I(EXT_fog_coord, pname); params[0] = ctx->Array.FogCoord.Stride; break; case GL_FOG_COORDINATE_SOURCE_EXT: CHECK_EXTENSION_I(EXT_fog_coord, pname); params[0] = ENUM_TO_INT(ctx->Fog.FogCoordinateSource); break; case GL_MAX_TEXTURE_LOD_BIAS_EXT: CHECK_EXTENSION_I(EXT_texture_lod_bias, pname); params[0] = IROUND(ctx->Const.MaxTextureLodBias); break; case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: CHECK_EXTENSION_I(EXT_texture_filter_anisotropic, pname); params[0] = IROUND(ctx->Const.MaxTextureMaxAnisotropy); break; case GL_MULTISAMPLE_ARB: CHECK_EXTENSION_I(ARB_multisample, pname); params[0] = BOOLEAN_TO_INT(ctx->Multisample.Enabled); break; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: CHECK_EXTENSION_I(ARB_multisample, pname); params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleAlphaToCoverage); break; case GL_SAMPLE_ALPHA_TO_ONE_ARB: CHECK_EXTENSION_I(ARB_multisample, pname); params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleAlphaToOne); break; case GL_SAMPLE_COVERAGE_ARB: CHECK_EXTENSION_I(ARB_multisample, pname); params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleCoverage); break; case GL_SAMPLE_COVERAGE_VALUE_ARB: CHECK_EXTENSION_I(ARB_multisample, pname); params[0] = IROUND(ctx->Multisample.SampleCoverageValue); break; case GL_SAMPLE_COVERAGE_INVERT_ARB: CHECK_EXTENSION_I(ARB_multisample, pname); params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleCoverageInvert); break; case GL_SAMPLE_BUFFERS_ARB: CHECK_EXTENSION_I(ARB_multisample, pname); params[0] = ctx->DrawBuffer->Visual.sampleBuffers; break; case GL_SAMPLES_ARB: CHECK_EXTENSION_I(ARB_multisample, pname); params[0] = ctx->DrawBuffer->Visual.samples; break; case GL_RASTER_POSITION_UNCLIPPED_IBM: CHECK_EXTENSION_I(IBM_rasterpos_clip, pname); params[0] = BOOLEAN_TO_INT(ctx->Transform.RasterPositionUnclipped); break; case GL_POINT_SPRITE_NV: CHECK_EXTENSION_I(NV_point_sprite, pname); params[0] = BOOLEAN_TO_INT(ctx->Point.PointSprite); break; case GL_POINT_SPRITE_R_MODE_NV: CHECK_EXTENSION_I(NV_point_sprite, pname); params[0] = ENUM_TO_INT(ctx->Point.SpriteRMode); break; case GL_POINT_SPRITE_COORD_ORIGIN: CHECK_EXTENSION_I(NV_point_sprite, pname); params[0] = ENUM_TO_INT(ctx->Point.SpriteOrigin); break; case GL_GENERATE_MIPMAP_HINT_SGIS: CHECK_EXTENSION_I(SGIS_generate_mipmap, pname); params[0] = ENUM_TO_INT(ctx->Hint.GenerateMipmap); break; case GL_VERTEX_PROGRAM_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.Enabled); break; case GL_VERTEX_PROGRAM_POINT_SIZE_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.PointSizeEnabled); break; case GL_VERTEX_PROGRAM_TWO_SIDE_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.TwoSideEnabled); break; case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = ctx->Const.MaxProgramMatrixStackDepth; break; case GL_MAX_TRACK_MATRICES_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = ctx->Const.MaxProgramMatrices; break; case GL_CURRENT_MATRIX_STACK_DEPTH_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->CurrentStack->Depth + 1); break; case GL_CURRENT_MATRIX_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); { const GLfloat *matrix = ctx->CurrentStack->Top->m; params[0] = IROUND(matrix[0]); params[1] = IROUND(matrix[1]); params[2] = IROUND(matrix[2]); params[3] = IROUND(matrix[3]); params[4] = IROUND(matrix[4]); params[5] = IROUND(matrix[5]); params[6] = IROUND(matrix[6]); params[7] = IROUND(matrix[7]); params[8] = IROUND(matrix[8]); params[9] = IROUND(matrix[9]); params[10] = IROUND(matrix[10]); params[11] = IROUND(matrix[11]); params[12] = IROUND(matrix[12]); params[13] = IROUND(matrix[13]); params[14] = IROUND(matrix[14]); params[15] = IROUND(matrix[15]); } break; case GL_VERTEX_PROGRAM_BINDING_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = (ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0); break; case GL_PROGRAM_ERROR_POSITION_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = ctx->Program.ErrorPos; break; case GL_VERTEX_ATTRIB_ARRAY0_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[0].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY1_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[1].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY2_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[2].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY3_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[3].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[4].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY5_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[5].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY6_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[6].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY7_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[7].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY8_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[8].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY9_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[9].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY10_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[10].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY11_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[11].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY12_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[12].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY13_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[13].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY14_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[14].Enabled); break; case GL_VERTEX_ATTRIB_ARRAY15_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Array.VertexAttrib[15].Enabled); break; case GL_MAP1_VERTEX_ATTRIB0_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[0]); break; case GL_MAP1_VERTEX_ATTRIB1_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[1]); break; case GL_MAP1_VERTEX_ATTRIB2_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[2]); break; case GL_MAP1_VERTEX_ATTRIB3_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[3]); break; case GL_MAP1_VERTEX_ATTRIB4_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[4]); break; case GL_MAP1_VERTEX_ATTRIB5_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[5]); break; case GL_MAP1_VERTEX_ATTRIB6_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[6]); break; case GL_MAP1_VERTEX_ATTRIB7_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[7]); break; case GL_MAP1_VERTEX_ATTRIB8_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[8]); break; case GL_MAP1_VERTEX_ATTRIB9_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[9]); break; case GL_MAP1_VERTEX_ATTRIB10_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[10]); break; case GL_MAP1_VERTEX_ATTRIB11_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[11]); break; case GL_MAP1_VERTEX_ATTRIB12_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[12]); break; case GL_MAP1_VERTEX_ATTRIB13_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[13]); break; case GL_MAP1_VERTEX_ATTRIB14_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[14]); break; case GL_MAP1_VERTEX_ATTRIB15_4_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[15]); break; case GL_FRAGMENT_PROGRAM_NV: CHECK_EXTENSION_I(NV_fragment_program, pname); params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.Enabled); break; case GL_MAX_TEXTURE_COORDS_NV: CHECK_EXTENSION_I(NV_fragment_program, pname); params[0] = ctx->Const.MaxTextureCoordUnits; break; case GL_MAX_TEXTURE_IMAGE_UNITS_NV: CHECK_EXTENSION_I(NV_fragment_program, pname); params[0] = ctx->Const.MaxTextureImageUnits; break; case GL_FRAGMENT_PROGRAM_BINDING_NV: CHECK_EXTENSION_I(NV_fragment_program, pname); params[0] = ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0; break; case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: CHECK_EXTENSION_I(NV_fragment_program, pname); params[0] = MAX_NV_FRAGMENT_PROGRAM_PARAMS; break; case GL_TEXTURE_RECTANGLE_NV: CHECK_EXTENSION_I(NV_texture_rectangle, pname); params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)); break; case GL_TEXTURE_BINDING_RECTANGLE_NV: CHECK_EXTENSION_I(NV_texture_rectangle, pname); params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name; break; case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: CHECK_EXTENSION_I(NV_texture_rectangle, pname); params[0] = ctx->Const.MaxTextureRectSize; break; case GL_STENCIL_TEST_TWO_SIDE_EXT: CHECK_EXTENSION_I(EXT_stencil_two_side, pname); params[0] = BOOLEAN_TO_INT(ctx->Stencil.TestTwoSide); break; case GL_ACTIVE_STENCIL_FACE_EXT: CHECK_EXTENSION_I(EXT_stencil_two_side, pname); params[0] = ENUM_TO_INT(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); break; case GL_MAX_SHININESS_NV: CHECK_EXTENSION_I(NV_light_max_exponent, pname); params[0] = IROUND(ctx->Const.MaxShininess); break; case GL_MAX_SPOT_EXPONENT_NV: CHECK_EXTENSION_I(NV_light_max_exponent, pname); params[0] = IROUND(ctx->Const.MaxSpotExponent); break; case GL_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); params[0] = ctx->Array.ArrayBufferObj->Name; break; case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); params[0] = ctx->Array.Vertex.BufferObj->Name; break; case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); params[0] = ctx->Array.Normal.BufferObj->Name; break; case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); params[0] = ctx->Array.Color.BufferObj->Name; break; case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); params[0] = ctx->Array.Index.BufferObj->Name; break; case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); params[0] = ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name; break; case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); params[0] = ctx->Array.EdgeFlag.BufferObj->Name; break; case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); params[0] = ctx->Array.SecondaryColor.BufferObj->Name; break; case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); params[0] = ctx->Array.FogCoord.BufferObj->Name; break; case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname); params[0] = ctx->Array.ElementArrayBufferObj->Name; break; case GL_PIXEL_PACK_BUFFER_BINDING_EXT: CHECK_EXTENSION_I(EXT_pixel_buffer_object, pname); params[0] = ctx->Pack.BufferObj->Name; break; case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: CHECK_EXTENSION_I(EXT_pixel_buffer_object, pname); params[0] = ctx->Unpack.BufferObj->Name; break; case GL_MAX_VERTEX_ATTRIBS_ARB: CHECK_EXTENSION_I(ARB_vertex_program, pname); params[0] = ctx->Const.MaxVertexProgramAttribs; break; case GL_FRAGMENT_PROGRAM_ARB: CHECK_EXTENSION_I(ARB_fragment_program, pname); params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.Enabled); break; case GL_TRANSPOSE_CURRENT_MATRIX_ARB: CHECK_EXTENSION_I(ARB_fragment_program, pname); { const GLfloat *matrix = ctx->CurrentStack->Top->m; params[0] = IROUND(matrix[0]); params[1] = IROUND(matrix[4]); params[2] = IROUND(matrix[8]); params[3] = IROUND(matrix[12]); params[4] = IROUND(matrix[1]); params[5] = IROUND(matrix[5]); params[6] = IROUND(matrix[9]); params[7] = IROUND(matrix[13]); params[8] = IROUND(matrix[2]); params[9] = IROUND(matrix[6]); params[10] = IROUND(matrix[10]); params[11] = IROUND(matrix[14]); params[12] = IROUND(matrix[3]); params[13] = IROUND(matrix[7]); params[14] = IROUND(matrix[11]); params[15] = IROUND(matrix[15]); } break; case GL_DEPTH_BOUNDS_TEST_EXT: CHECK_EXTENSION_I(EXT_depth_bounds_test, pname); params[0] = BOOLEAN_TO_INT(ctx->Depth.BoundsTest); break; case GL_DEPTH_BOUNDS_EXT: CHECK_EXTENSION_I(EXT_depth_bounds_test, pname); params[0] = IROUND(ctx->Depth.BoundsMin); params[1] = IROUND(ctx->Depth.BoundsMax); break; case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: CHECK_EXTENSION_I(MESA_program_debug, pname); params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.CallbackEnabled); break; case GL_VERTEX_PROGRAM_CALLBACK_MESA: CHECK_EXTENSION_I(MESA_program_debug, pname); params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.CallbackEnabled); break; case GL_FRAGMENT_PROGRAM_POSITION_MESA: CHECK_EXTENSION_I(MESA_program_debug, pname); params[0] = ctx->FragmentProgram.CurrentPosition; break; case GL_VERTEX_PROGRAM_POSITION_MESA: CHECK_EXTENSION_I(MESA_program_debug, pname); params[0] = ctx->VertexProgram.CurrentPosition; break; case GL_MAX_DRAW_BUFFERS_ARB: CHECK_EXTENSION_I(ARB_draw_buffers, pname); params[0] = ctx->Const.MaxDrawBuffers; break; case GL_DRAW_BUFFER0_ARB: CHECK_EXTENSION_I(ARB_draw_buffers, pname); params[0] = ENUM_TO_INT(ctx->Color.DrawBuffer[0]); break; case GL_DRAW_BUFFER1_ARB: CHECK_EXTENSION_I(ARB_draw_buffers, pname); { GLenum buffer; if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); return; } buffer = ctx->Color.DrawBuffer[1]; params[0] = ENUM_TO_INT(buffer); } break; case GL_DRAW_BUFFER2_ARB: CHECK_EXTENSION_I(ARB_draw_buffers, pname); { GLenum buffer; if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); return; } buffer = ctx->Color.DrawBuffer[2]; params[0] = ENUM_TO_INT(buffer); } break; case GL_DRAW_BUFFER3_ARB: CHECK_EXTENSION_I(ARB_draw_buffers, pname); { GLenum buffer; if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); return; } buffer = ctx->Color.DrawBuffer[3]; params[0] = ENUM_TO_INT(buffer); } break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXTENSION_I(OES_read_format, pname); params[0] = ctx->Const.ColorReadType; break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXTENSION_I(OES_read_format, pname); params[0] = ctx->Const.ColorReadFormat; break; case GL_NUM_FRAGMENT_REGISTERS_ATI: CHECK_EXTENSION_I(ATI_fragment_shader, pname); params[0] = 6; break; case GL_NUM_FRAGMENT_CONSTANTS_ATI: CHECK_EXTENSION_I(ATI_fragment_shader, pname); params[0] = 8; break; case GL_NUM_PASSES_ATI: CHECK_EXTENSION_I(ATI_fragment_shader, pname); params[0] = 2; break; case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: CHECK_EXTENSION_I(ATI_fragment_shader, pname); params[0] = 8; break; case GL_NUM_INSTRUCTIONS_TOTAL_ATI: CHECK_EXTENSION_I(ATI_fragment_shader, pname); params[0] = 16; break; case GL_COLOR_ALPHA_PAIRING_ATI: CHECK_EXTENSION_I(ATI_fragment_shader, pname); params[0] = BOOLEAN_TO_INT(GL_TRUE); break; case GL_NUM_LOOPBACK_COMPONENTS_ATI: CHECK_EXTENSION_I(ATI_fragment_shader, pname); params[0] = 3; break; case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: CHECK_EXTENSION_I(ATI_fragment_shader, pname); params[0] = 3; break; case GL_STENCIL_BACK_FUNC: params[0] = ENUM_TO_INT(ctx->Stencil.Function[1]); break; case GL_STENCIL_BACK_VALUE_MASK: params[0] = ctx->Stencil.ValueMask[1]; break; case GL_STENCIL_BACK_REF: params[0] = ctx->Stencil.Ref[1]; break; case GL_STENCIL_BACK_FAIL: params[0] = ENUM_TO_INT(ctx->Stencil.FailFunc[1]); break; case GL_STENCIL_BACK_PASS_DEPTH_FAIL: params[0] = ENUM_TO_INT(ctx->Stencil.ZFailFunc[1]); break; case GL_STENCIL_BACK_PASS_DEPTH_PASS: params[0] = ENUM_TO_INT(ctx->Stencil.ZPassFunc[1]); break; case GL_FRAMEBUFFER_BINDING_EXT: CHECK_EXTENSION_I(EXT_framebuffer_object, pname); params[0] = ctx->DrawBuffer->Name; break; case GL_RENDERBUFFER_BINDING_EXT: CHECK_EXTENSION_I(EXT_framebuffer_object, pname); params[0] = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0; break; case GL_MAX_COLOR_ATTACHMENTS_EXT: CHECK_EXTENSION_I(EXT_framebuffer_object, pname); params[0] = ctx->Const.MaxColorAttachments; break; case GL_MAX_RENDERBUFFER_SIZE_EXT: CHECK_EXTENSION_I(EXT_framebuffer_object, pname); params[0] = ctx->Const.MaxRenderbufferSize; break; case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: CHECK_EXTENSION_I(ARB_fragment_shader, pname); params[0] = MAX_FRAGMENT_UNIFORM_COMPONENTS; break; case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: CHECK_EXTENSION_I(ARB_fragment_shader, pname); params[0] = ENUM_TO_INT(ctx->Hint.FragmentShaderDerivative); break; case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: CHECK_EXTENSION_I(ARB_vertex_shader, pname); params[0] = MAX_VERTEX_UNIFORM_COMPONENTS; break; case GL_MAX_VARYING_FLOATS_ARB: CHECK_EXTENSION_I(ARB_vertex_shader, pname); params[0] = MAX_VARYING_FLOATS; break; case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXTENSION_I(ARB_vertex_shader, pname); params[0] = MAX_VERTEX_TEXTURE_IMAGE_UNITS; break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXTENSION_I(ARB_vertex_shader, pname); params[0] = MAX_COMBINED_TEXTURE_IMAGE_UNITS; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname); } } void GLAPIENTRY _mesa_GetDoublev( GLenum pname, GLdouble *params ) { const GLfloat magic = -1234.5F; GLfloat values[16]; GLuint i; if (!params) return; /* Init temp array to magic numbers so we can figure out how many values * are returned by the GetFloatv() call. */ for (i = 0; i < 16; i++) values[i] = magic; _mesa_GetFloatv(pname, values); for (i = 0; i < 16 && values[i] != magic; i++) params[i] = (GLdouble) values[i]; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/get.h0000644000000000000000000000335713614532424017101 0ustar /** * \file get.h * State query functions. */ /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef GET_H #define GET_H #include "mtypes.h" extern void GLAPIENTRY _mesa_GetBooleanv( GLenum pname, GLboolean *params ); extern void GLAPIENTRY _mesa_GetDoublev( GLenum pname, GLdouble *params ); extern void GLAPIENTRY _mesa_GetFloatv( GLenum pname, GLfloat *params ); extern void GLAPIENTRY _mesa_GetIntegerv( GLenum pname, GLint *params ); extern void GLAPIENTRY _mesa_GetPointerv( GLenum pname, GLvoid **params ); extern const GLubyte * GLAPIENTRY _mesa_GetString( GLenum name ); extern GLenum GLAPIENTRY _mesa_GetError( void ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/getstring.c0000644000000000000000000002201613614532424020314 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "get.h" #include "version.h" #include "enums.h" #include "extensions.h" /** * Query string-valued state. The return value should _not_ be freed by * the caller. * * \param name the state variable to query. * * \sa glGetString(). * * Tries to get the string from dd_function_table::GetString, otherwise returns * the hardcoded strings. */ const GLubyte * GLAPIENTRY _mesa_GetString( GLenum name ) { GET_CURRENT_CONTEXT(ctx); static const char *vendor = "Brian Paul"; static const char *renderer = "Mesa"; static const char *version_1_2 = "1.2 Mesa " MESA_VERSION_STRING; static const char *version_1_3 = "1.3 Mesa " MESA_VERSION_STRING; static const char *version_1_4 = "1.4 Mesa " MESA_VERSION_STRING; static const char *version_1_5 = "1.5 Mesa " MESA_VERSION_STRING; static const char *version_2_0 = "1.5 Mesa " MESA_VERSION_STRING;/*XXX FIX*/ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL); /* this is a required driver function */ assert(ctx->Driver.GetString); { /* Give the driver the chance to handle this query */ const GLubyte *str = (*ctx->Driver.GetString)(ctx, name); if (str) return str; } switch (name) { case GL_VENDOR: return (const GLubyte *) vendor; case GL_RENDERER: return (const GLubyte *) renderer; case GL_VERSION: if (ctx->Extensions.ARB_multisample && ctx->Extensions.ARB_multitexture && ctx->Extensions.ARB_texture_border_clamp && ctx->Extensions.ARB_texture_compression && ctx->Extensions.ARB_texture_cube_map && ctx->Extensions.EXT_texture_env_add && ctx->Extensions.ARB_texture_env_combine && ctx->Extensions.ARB_texture_env_dot3) { if (ctx->Extensions.ARB_depth_texture && ctx->Extensions.ARB_shadow && ctx->Extensions.ARB_texture_env_crossbar && ctx->Extensions.ARB_texture_mirrored_repeat && ctx->Extensions.ARB_window_pos && ctx->Extensions.EXT_blend_color && ctx->Extensions.EXT_blend_func_separate && ctx->Extensions.EXT_blend_logic_op && ctx->Extensions.EXT_blend_minmax && ctx->Extensions.EXT_blend_subtract && ctx->Extensions.EXT_fog_coord && ctx->Extensions.EXT_multi_draw_arrays && ctx->Extensions.EXT_point_parameters && /*aka ARB*/ ctx->Extensions.EXT_secondary_color && ctx->Extensions.EXT_stencil_wrap && ctx->Extensions.EXT_texture_lod_bias && ctx->Extensions.SGIS_generate_mipmap) { if (ctx->Extensions.ARB_occlusion_query && ctx->Extensions.ARB_vertex_buffer_object && ctx->Extensions.EXT_shadow_funcs) { if (ctx->Extensions.ARB_draw_buffers && ctx->Extensions.ARB_point_sprite && ctx->Extensions.ARB_texture_non_power_of_two && ctx->Extensions.EXT_stencil_two_side) { return (const GLubyte *) version_2_0; } else { return (const GLubyte *) version_1_5; } } else { return (const GLubyte *) version_1_4; } } else { return (const GLubyte *) version_1_3; } } else { return (const GLubyte *) version_1_2; } case GL_EXTENSIONS: if (!ctx->Extensions.String) ctx->Extensions.String = _mesa_make_extension_string(ctx); return (const GLubyte *) ctx->Extensions.String; #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \ FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program case GL_PROGRAM_ERROR_STRING_NV: if (ctx->Extensions.NV_fragment_program || ctx->Extensions.ARB_fragment_program || ctx->Extensions.NV_vertex_program || ctx->Extensions.ARB_vertex_program) { return (const GLubyte *) ctx->Program.ErrorString; } /* FALL-THROUGH */ #endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" ); return (const GLubyte *) 0; } } /** * Return pointer-valued state, such as a vertex array pointer. * * \param pname names state to be queried * \param params returns the pointer value * * \sa glGetPointerv(). * * Tries to get the specified pointer via dd_function_table::GetPointerv, * otherwise gets the specified pointer from the current context. */ void GLAPIENTRY _mesa_GetPointerv( GLenum pname, GLvoid **params ) { GET_CURRENT_CONTEXT(ctx); const GLuint clientUnit = ctx->Array.ActiveTexture; ASSERT_OUTSIDE_BEGIN_END(ctx); if (!params) return; if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glGetPointerv %s\n", _mesa_lookup_enum_by_nr(pname)); if (ctx->Driver.GetPointerv && (*ctx->Driver.GetPointerv)(ctx, pname, params)) return; switch (pname) { case GL_VERTEX_ARRAY_POINTER: *params = (GLvoid *) ctx->Array.Vertex.Ptr; break; case GL_NORMAL_ARRAY_POINTER: *params = (GLvoid *) ctx->Array.Normal.Ptr; break; case GL_COLOR_ARRAY_POINTER: *params = (GLvoid *) ctx->Array.Color.Ptr; break; case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT: *params = (GLvoid *) ctx->Array.SecondaryColor.Ptr; break; case GL_FOG_COORDINATE_ARRAY_POINTER_EXT: *params = (GLvoid *) ctx->Array.FogCoord.Ptr; break; case GL_INDEX_ARRAY_POINTER: *params = (GLvoid *) ctx->Array.Index.Ptr; break; case GL_TEXTURE_COORD_ARRAY_POINTER: *params = (GLvoid *) ctx->Array.TexCoord[clientUnit].Ptr; break; case GL_EDGE_FLAG_ARRAY_POINTER: *params = (GLvoid *) ctx->Array.EdgeFlag.Ptr; break; case GL_FEEDBACK_BUFFER_POINTER: *params = ctx->Feedback.Buffer; break; case GL_SELECTION_BUFFER_POINTER: *params = ctx->Select.Buffer; break; #if FEATURE_MESA_program_debug case GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA: if (!ctx->Extensions.MESA_program_debug) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); return; } *params = *(GLvoid **) &ctx->FragmentProgram.Callback; break; case GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA: if (!ctx->Extensions.MESA_program_debug) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); return; } *params = ctx->FragmentProgram.CallbackData; break; case GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA: if (!ctx->Extensions.MESA_program_debug) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); return; } *params = *(GLvoid **) &ctx->VertexProgram.Callback; break; case GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA: if (!ctx->Extensions.MESA_program_debug) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv"); return; } *params = ctx->VertexProgram.CallbackData; break; #endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" ); return; } } /** * Returns the current GL error code, or GL_NO_ERROR. * \return current error code * * Returns __GLcontextRec::ErrorValue. */ GLenum GLAPIENTRY _mesa_GetError( void ) { GET_CURRENT_CONTEXT(ctx); GLenum e = ctx->ErrorValue; ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glGetError <-- %s\n", _mesa_lookup_enum_by_nr(e)); ctx->ErrorValue = (GLenum) GL_NO_ERROR; return e; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/glheader.h0000644000000000000000000002205613614532424020072 0ustar /** * \file glheader.h * Top-most include file. * * This is the top-most include file of the Mesa sources. * It includes gl.h and all system headers which are needed. * Other Mesa source files should \e not directly include any system * headers. This allows Mesa to be integrated into XFree86 and * allows system-dependent hacks/workarounds to be collected in one place. * * \note Actually, a lot of system-dependent stuff is now in imports.[ch]. * * If you touch this file, everything gets recompiled! * * This file should be included before any other header in the .c files. * * Put compiler/OS/assembly pragmas and macros here to avoid * cluttering other source files. */ /* * Mesa 3-D graphics library * Version: 6.4.1 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef GLHEADER_H #define GLHEADER_H #if defined(XFree86LOADER) && defined(IN_MODULE) #include "xf86_ansic.h" #else #include #include /* If we can use Compaq's Fast Math Library on Alpha */ #if defined(__alpha__) && defined(CCPML) #include #else #include #endif #include #include #include #include #if defined(__linux__) && defined(__i386__) #include #endif #endif #include #include /* Get typedefs for uintptr_t and friends */ #if defined(__MINGW32__) || defined(__NetBSD__) # include #elif defined(_WIN32) # include # if _MSC_VER == 1200 typedef UINT_PTR uintptr_t; # endif #else # include #endif #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP) # define __WIN32__ # define finite _finite #endif #if defined(__WATCOMC__) # define finite _finite # pragma disable_message(201) /* Disable unreachable code warnings */ #endif #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP) # if !defined(__GNUC__) /* mingw environment */ # pragma warning( disable : 4068 ) /* unknown pragma */ # pragma warning( disable : 4710 ) /* function 'foo' not inlined */ # pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */ # pragma warning( disable : 4127 ) /* conditional expression is constant */ # if defined(MESA_MINWARN) # pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ # pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ # pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ # pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */ # pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ # endif # endif # if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ # define WGLAPI __declspec(dllexport) # elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ # define WGLAPI __declspec(dllimport) # else /* for use with static link lib build of Win32 edition only */ # define WGLAPI __declspec(dllimport) # endif /* _STATIC_MESA support */ #endif /* WIN32 / CYGWIN bracket */ #ifndef __MINGW32__ /* XXX why is this here? * It should probaby be somewhere in src/mesa/drivers/windows/ */ #if defined(_WIN32) && !defined(_WINGDI_) && !defined(_WINGDI_H) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(BUILD_FOR_SNAP) # define WGL_FONT_LINES 0 # define WGL_FONT_POLYGONS 1 #ifndef _GNU_H_WINDOWS32_FUNCTIONS # ifdef UNICODE # define wglUseFontBitmaps wglUseFontBitmapsW # define wglUseFontOutlines wglUseFontOutlinesW # else # define wglUseFontBitmaps wglUseFontBitmapsA # define wglUseFontOutlines wglUseFontOutlinesA # endif /* !UNICODE */ #endif /* _GNU_H_WINDOWS32_FUNCTIONS */ typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR; #if !defined(GLX_USE_MESA) #include #endif #endif #endif /* !__MINGW32__ */ /* * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN. * Do not use them unless absolutely necessary! * Try to use a runtime test instead. * For now, only used by some DRI hardware drivers for color/texel packing. */ #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN #if defined(__linux__) #include #define CPU_TO_LE32( x ) bswap_32( x ) #else /*__linux__*/ #define CPU_TO_LE32( x ) ( x ) /* fix me for non-Linux big-endian! */ #endif /*__linux__*/ #define MESA_BIG_ENDIAN 1 #else #define CPU_TO_LE32( x ) ( x ) #define MESA_LITTLE_ENDIAN 1 #endif #define LE32_TO_CPU( x ) CPU_TO_LE32( x ) #define GL_GLEXT_PROTOTYPES #include "GL/gl.h" #include "GL/glext.h" #if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP) #define CAPI _cdecl #endif #include /* This is a macro on IRIX */ #ifdef _P #undef _P #endif /* Turn off macro checking systems used by other libraries */ #ifdef CHECK #undef CHECK #endif /* Create a macro so that asm functions can be linked into compilers other * than GNU C */ #ifndef _ASMAPI #if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/ #define _ASMAPI __cdecl #else #define _ASMAPI #endif #ifdef PTR_DECL_IN_FRONT #define _ASMAPIP * _ASMAPI #else #define _ASMAPIP _ASMAPI * #endif #endif #ifdef USE_X86_ASM #define _NORMAPI _ASMAPI #define _NORMAPIP _ASMAPIP #else #define _NORMAPI #define _NORMAPIP * #endif /* Function inlining */ #if defined(__GNUC__) # define INLINE __inline__ #elif defined(__MSC__) # define INLINE __inline #elif defined(_MSC_VER) # define INLINE __inline #elif defined(__ICL) # define INLINE __inline #elif defined(__INTEL_COMPILER) # define INLINE inline #elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) # define INLINE __inline #else # define INLINE #endif /* If we build the library with gcc's -fvisibility=hidden flag, we'll * use the PUBLIC macro to mark functions that are to be exported. * * We also need to define a USED attribute, so the optimizer doesn't * inline a static function that we later use in an alias. - ajax */ #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 # define PUBLIC __attribute__((visibility("default"))) # define USED __attribute__((used)) #else # define PUBLIC # define USED #endif /* Some compilers don't like some of Mesa's const usage */ #ifdef NO_CONST # define CONST #else # define CONST const #endif #if defined(BUILD_FOR_SNAP) && defined(CHECKED) # define ASSERT(X) _CHECK(X) #elif defined(DEBUG) # define ASSERT(X) assert(X) #else # define ASSERT(X) #endif #if !defined __GNUC__ || __GNUC__ < 3 # define __builtin_expect(x, y) x #endif /* Windows does not have the ffs() function */ #if defined(_WIN32) static int INLINE ffs(register int value) { register int bit = 0; if (value != 0) { if ((value & 0xffff) == 0) { bit += 16; value >>= 16; } if ((value & 0xff) == 0) { bit += 8; value >>= 8; } if ((value & 0xf) == 0) { bit += 4; value >>= 4; } while ((value & 1) == 0) { bit++; value >>= 1; } } return bit; } #endif /* The __FUNCTION__ gcc variable is generally only used for debugging. * If we're not using gcc, define __FUNCTION__ as a cpp symbol here. * Don't define it if using a newer Windows compiler. */ #if defined(__VMS) #define __FUNCTION__ "VMS$NL:" #elif !(defined(__GNUC__) && __GNUC__ >= 2) && !(defined(_MSC_VER) && _MSC_VER >= 1300) #define __FUNCTION__ "unknown" #endif #include "config.h" #endif /* GLHEADER_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/hash.c0000644000000000000000000002447313614532424017242 0ustar /** * \file hash.c * Generic hash table. * * Used for display lists, texture objects, vertex/fragment programs, * buffer objects, etc. The hash functions are thread-safe. * * \note key=0 is illegal. * * \author Brian Paul */ /* * Mesa 3-D graphics library * Version: 6.4 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "imports.h" #include "glthread.h" #include "hash.h" #define TABLE_SIZE 1023 /**< Size of lookup table/array */ #define HASH_FUNC(K) ((K) % TABLE_SIZE) /** * An entry in the hash table. * * This struct is private to this file. */ struct HashEntry { GLuint Key; /**< the entry's key */ void *Data; /**< the entry's data */ struct HashEntry *Next; /**< pointer to next entry */ }; /** * The hash table data structure. * * This is an opaque types (it's not defined in hash.h file). */ struct _mesa_HashTable { struct HashEntry *Table[TABLE_SIZE]; /**< the lookup table */ GLuint MaxKey; /**< highest key inserted so far */ _glthread_Mutex Mutex; /**< mutual exclusion lock */ }; /** * Create a new hash table. * * \return pointer to a new, empty hash table. */ struct _mesa_HashTable * _mesa_NewHashTable(void) { struct _mesa_HashTable *table = CALLOC_STRUCT(_mesa_HashTable); if (table) { _glthread_INIT_MUTEX(table->Mutex); } return table; } /** * Delete a hash table. * Frees each entry on the hash table and then the hash table structure itself. * Note that the caller should have already traversed the table and deleted * the objects in the table (i.e. We don't free the entries' data pointer). * * \param table the hash table to delete. */ void _mesa_DeleteHashTable(struct _mesa_HashTable *table) { GLuint i; assert(table); for (i = 0; i < TABLE_SIZE; i++) { struct HashEntry *entry = table->Table[i]; while (entry) { struct HashEntry *next = entry->Next; FREE(entry); entry = next; } } _glthread_DESTROY_MUTEX(table->Mutex); FREE(table); } /** * Lookup an entry in the hash table. * * \param table the hash table. * \param key the key. * * \return pointer to user's data or NULL if key not in table */ void * _mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key) { GLuint pos; const struct HashEntry *entry; assert(table); assert(key); pos = HASH_FUNC(key); entry = table->Table[pos]; while (entry) { if (entry->Key == key) { return entry->Data; } entry = entry->Next; } return NULL; } /** * Insert a key/pointer pair into the hash table. * If an entry with this key already exists we'll replace the existing entry. * * \param table the hash table. * \param key the key (not zero). * \param data pointer to user data. */ void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data) { /* search for existing entry with this key */ GLuint pos; struct HashEntry *entry; assert(table); assert(key); _glthread_LOCK_MUTEX(table->Mutex); if (key > table->MaxKey) table->MaxKey = key; pos = HASH_FUNC(key); entry = table->Table[pos]; while (entry) { if (entry->Key == key) { /* replace entry's data */ entry->Data = data; _glthread_UNLOCK_MUTEX(table->Mutex); return; } entry = entry->Next; } /* alloc and insert new table entry */ entry = MALLOC_STRUCT(HashEntry); entry->Key = key; entry->Data = data; entry->Next = table->Table[pos]; table->Table[pos] = entry; _glthread_UNLOCK_MUTEX(table->Mutex); } /** * Remove an entry from the hash table. * * \param table the hash table. * \param key key of entry to remove. * * While holding the hash table's lock, searches the entry with the matching * key and unlinks it. */ void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key) { GLuint pos; struct HashEntry *entry, *prev; assert(table); assert(key); _glthread_LOCK_MUTEX(table->Mutex); pos = HASH_FUNC(key); prev = NULL; entry = table->Table[pos]; while (entry) { if (entry->Key == key) { /* found it! */ if (prev) { prev->Next = entry->Next; } else { table->Table[pos] = entry->Next; } FREE(entry); _glthread_UNLOCK_MUTEX(table->Mutex); return; } prev = entry; entry = entry->Next; } _glthread_UNLOCK_MUTEX(table->Mutex); } /** * Get the key of the "first" entry in the hash table. * * This is used in the course of deleting all display lists when * a context is destroyed. * * \param table the hash table * * \return key for the "first" entry in the hash table. * * While holding the lock, walks through all table positions until finding * the first entry of the first non-empty one. */ GLuint _mesa_HashFirstEntry(struct _mesa_HashTable *table) { GLuint pos; assert(table); _glthread_LOCK_MUTEX(table->Mutex); for (pos=0; pos < TABLE_SIZE; pos++) { if (table->Table[pos]) { _glthread_UNLOCK_MUTEX(table->Mutex); return table->Table[pos]->Key; } } _glthread_UNLOCK_MUTEX(table->Mutex); return 0; } /** * Given a hash table key, return the next key. This is used to walk * over all entries in the table. Note that the keys returned during * walking won't be in any particular order. * \return next hash key or 0 if end of table. */ GLuint _mesa_HashNextEntry(const struct _mesa_HashTable *table, GLuint key) { const struct HashEntry *entry; GLuint pos; assert(table); assert(key); /* Find the entry with given key */ pos = HASH_FUNC(key); entry = table->Table[pos]; while (entry) { if (entry->Key == key) { break; } entry = entry->Next; } if (!entry) { /* the key was not found, we can't find next entry */ return 0; } if (entry->Next) { /* return next in linked list */ return entry->Next->Key; } else { /* look for next non-empty table slot */ pos++; while (pos < TABLE_SIZE) { if (table->Table[pos]) { return table->Table[pos]->Key; } pos++; } return 0; } } /** * Dump contents of hash table for debugging. * * \param table the hash table. */ void _mesa_HashPrint(const struct _mesa_HashTable *table) { GLuint i; assert(table); for (i=0;iTable[i]; while (entry) { _mesa_debug(NULL, "%u %p\n", entry->Key, entry->Data); entry = entry->Next; } } } /** * Find a block of adjacent unused hash keys. * * \param table the hash table. * \param numKeys number of keys needed. * * \return Starting key of free block or 0 if failure. * * If there are enough free keys between the maximum key existing in the table * (_mesa_HashTable::MaxKey) and the maximum key possible, then simply return * the adjacent key. Otherwise do a full search for a free key block in the * allowable key range. */ GLuint _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys) { GLuint maxKey = ~((GLuint) 0); _glthread_LOCK_MUTEX(table->Mutex); if (maxKey - numKeys > table->MaxKey) { /* the quick solution */ _glthread_UNLOCK_MUTEX(table->Mutex); return table->MaxKey + 1; } else { /* the slow solution */ GLuint freeCount = 0; GLuint freeStart = 1; GLuint key; for (key=1; key!=maxKey; key++) { if (_mesa_HashLookup(table, key)) { /* darn, this key is already in use */ freeCount = 0; freeStart = key+1; } else { /* this key not in use, check if we've found enough */ freeCount++; if (freeCount == numKeys) { _glthread_UNLOCK_MUTEX(table->Mutex); return freeStart; } } } /* cannot allocate a block of numKeys consecutive keys */ _glthread_UNLOCK_MUTEX(table->Mutex); return 0; } } #if 0 /* debug only */ /** * Test walking over all the entries in a hash table. */ static void test_hash_walking(void) { struct _mesa_HashTable *t = _mesa_NewHashTable(); const GLuint limit = 50000; GLuint i; /* create some entries */ for (i = 0; i < limit; i++) { GLuint dummy; GLuint k = (rand() % (limit * 10)) + 1; while (_mesa_HashLookup(t, k)) { /* id already in use, try another */ k = (rand() % (limit * 10)) + 1; } _mesa_HashInsert(t, k, &dummy); } /* walk over all entries */ { GLuint k = _mesa_HashFirstEntry(t); GLuint count = 0; while (k) { GLuint knext = _mesa_HashNextEntry(t, k); assert(knext != k); _mesa_HashRemove(t, k); count++; k = knext; } assert(count == limit); k = _mesa_HashFirstEntry(t); assert(k==0); } _mesa_DeleteHashTable(t); } void _mesa_test_hash_functions(void) { int a, b, c; struct _mesa_HashTable *t; t = _mesa_NewHashTable(); _mesa_HashInsert(t, 501, &a); _mesa_HashInsert(t, 10, &c); _mesa_HashInsert(t, 0xfffffff8, &b); /*_mesa_HashPrint(t);*/ assert(_mesa_HashLookup(t,501)); assert(!_mesa_HashLookup(t,1313)); assert(_mesa_HashFindFreeKeyBlock(t, 100)); _mesa_DeleteHashTable(t); test_hash_walking(); } #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/hash.h0000644000000000000000000000372613614532424017245 0ustar /** * \file hash.h * Generic hash table. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef HASH_H #define HASH_H #include "glheader.h" extern struct _mesa_HashTable *_mesa_NewHashTable(void); extern void _mesa_DeleteHashTable(struct _mesa_HashTable *table); extern void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key); extern void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data); extern void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key); extern GLuint _mesa_HashFirstEntry(struct _mesa_HashTable *table); extern GLuint _mesa_HashNextEntry(const struct _mesa_HashTable *table, GLuint key); extern void _mesa_HashPrint(const struct _mesa_HashTable *table); extern GLuint _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys); extern void _mesa_test_hash_functions(void); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/hint.c0000644000000000000000000001145213614532424017252 0ustar /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "enums.h" #include "context.h" #include "hint.h" #include "imports.h" void GLAPIENTRY _mesa_Hint( GLenum target, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glHint %s %d\n", _mesa_lookup_enum_by_nr(target), mode); if (mode != GL_NICEST && mode != GL_FASTEST && mode != GL_DONT_CARE) { _mesa_error(ctx, GL_INVALID_ENUM, "glHint(mode)"); return; } switch (target) { case GL_FOG_HINT: if (ctx->Hint.Fog == mode) return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.Fog = mode; break; case GL_LINE_SMOOTH_HINT: if (ctx->Hint.LineSmooth == mode) return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.LineSmooth = mode; break; case GL_PERSPECTIVE_CORRECTION_HINT: if (ctx->Hint.PerspectiveCorrection == mode) return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.PerspectiveCorrection = mode; break; case GL_POINT_SMOOTH_HINT: if (ctx->Hint.PointSmooth == mode) return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.PointSmooth = mode; break; case GL_POLYGON_SMOOTH_HINT: if (ctx->Hint.PolygonSmooth == mode) return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.PolygonSmooth = mode; break; /* GL_EXT_clip_volume_hint */ case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: if (ctx->Hint.ClipVolumeClipping == mode) return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.ClipVolumeClipping = mode; break; /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: if (!ctx->Extensions.ARB_texture_compression) { _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); return; } if (ctx->Hint.TextureCompression == mode) return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.TextureCompression = mode; break; /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: if (!ctx->Extensions.SGIS_generate_mipmap) { _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); return; } if (ctx->Hint.GenerateMipmap == mode) return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.GenerateMipmap = mode; break; /* GL_ARB_fragment_shader */ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: if (!ctx->Extensions.ARB_fragment_shader) { _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); return; } if (ctx->Hint.FragmentShaderDerivative == mode) return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.FragmentShaderDerivative = mode; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); return; } if (ctx->Driver.Hint) { (*ctx->Driver.Hint)( ctx, target, mode ); } } /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ void _mesa_init_hint( GLcontext * ctx ) { /* Hint group */ ctx->Hint.PerspectiveCorrection = GL_DONT_CARE; ctx->Hint.PointSmooth = GL_DONT_CARE; ctx->Hint.LineSmooth = GL_DONT_CARE; ctx->Hint.PolygonSmooth = GL_DONT_CARE; ctx->Hint.Fog = GL_DONT_CARE; ctx->Hint.ClipVolumeClipping = GL_DONT_CARE; ctx->Hint.TextureCompression = GL_DONT_CARE; ctx->Hint.GenerateMipmap = GL_DONT_CARE; ctx->Hint.FragmentShaderDerivative = GL_DONT_CARE; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/hint.h0000644000000000000000000000276313614532424017264 0ustar /** * \file hint.h * Hints operations. * * \if subset * (No-op) * * \endif */ /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef HINT_H #define HINT_H #include "mtypes.h" #if _HAVE_FULL_GL extern void GLAPIENTRY _mesa_Hint( GLenum target, GLenum mode ); extern void _mesa_init_hint( GLcontext * ctx ); #else /** No-op */ #define _mesa_init_hint( c ) ((void) 0) #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/histogram.c0000644000000000000000000011305113614532424020303 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "bufferobj.h" #include "colormac.h" #include "context.h" #include "image.h" #include "histogram.h" /********************************************************************** * Internal functions */ /* * Update the min/max values from an array of fragment colors. */ void _mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) { GLuint i; for (i = 0; i < n; i++) { /* update mins */ if (rgba[i][RCOMP] < ctx->MinMax.Min[RCOMP]) ctx->MinMax.Min[RCOMP] = rgba[i][RCOMP]; if (rgba[i][GCOMP] < ctx->MinMax.Min[GCOMP]) ctx->MinMax.Min[GCOMP] = rgba[i][GCOMP]; if (rgba[i][BCOMP] < ctx->MinMax.Min[BCOMP]) ctx->MinMax.Min[BCOMP] = rgba[i][BCOMP]; if (rgba[i][ACOMP] < ctx->MinMax.Min[ACOMP]) ctx->MinMax.Min[ACOMP] = rgba[i][ACOMP]; /* update maxs */ if (rgba[i][RCOMP] > ctx->MinMax.Max[RCOMP]) ctx->MinMax.Max[RCOMP] = rgba[i][RCOMP]; if (rgba[i][GCOMP] > ctx->MinMax.Max[GCOMP]) ctx->MinMax.Max[GCOMP] = rgba[i][GCOMP]; if (rgba[i][BCOMP] > ctx->MinMax.Max[BCOMP]) ctx->MinMax.Max[BCOMP] = rgba[i][BCOMP]; if (rgba[i][ACOMP] > ctx->MinMax.Max[ACOMP]) ctx->MinMax.Max[ACOMP] = rgba[i][ACOMP]; } } /* * Update the histogram values from an array of fragment colors. */ void _mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) { const GLint max = ctx->Histogram.Width - 1; GLfloat w = (GLfloat) max; GLuint i; if (ctx->Histogram.Width == 0) return; for (i = 0; i < n; i++) { GLint ri = IROUND(rgba[i][RCOMP] * w); GLint gi = IROUND(rgba[i][GCOMP] * w); GLint bi = IROUND(rgba[i][BCOMP] * w); GLint ai = IROUND(rgba[i][ACOMP] * w); ri = CLAMP(ri, 0, max); gi = CLAMP(gi, 0, max); bi = CLAMP(bi, 0, max); ai = CLAMP(ai, 0, max); ctx->Histogram.Count[ri][RCOMP]++; ctx->Histogram.Count[gi][GCOMP]++; ctx->Histogram.Count[bi][BCOMP]++; ctx->Histogram.Count[ai][ACOMP]++; } } /* * XXX the packed pixel formats haven't been tested. */ static void pack_histogram( GLcontext *ctx, GLuint n, CONST GLuint rgba[][4], GLenum format, GLenum type, GLvoid *destination, const struct gl_pixelstore_attrib *packing ) { const GLint comps = _mesa_components_in_format(format); GLuint luminance[MAX_WIDTH]; if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) { GLuint i; for (i = 0; i < n; i++) { luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; } } #define PACK_MACRO(TYPE) \ { \ GLuint i; \ switch (format) { \ case GL_RED: \ for (i=0;iSwapBytes) { _mesa_swap2(dst, n * comps); } } break; case GL_SHORT: { GLshort *dst = (GLshort *) destination; PACK_MACRO(GLshort); if (packing->SwapBytes) { _mesa_swap2((GLushort *) dst, n * comps); } } break; case GL_UNSIGNED_INT: { GLuint *dst = (GLuint *) destination; PACK_MACRO(GLuint); if (packing->SwapBytes) { _mesa_swap4(dst, n * comps); } } break; case GL_INT: { GLint *dst = (GLint *) destination; PACK_MACRO(GLint); if (packing->SwapBytes) { _mesa_swap4((GLuint *) dst, n * comps); } } break; case GL_FLOAT: { GLfloat *dst = (GLfloat *) destination; PACK_MACRO(GLfloat); if (packing->SwapBytes) { _mesa_swap4((GLuint *) dst, n * comps); } } break; case GL_HALF_FLOAT_ARB: { /* temporarily store as GLuints */ GLuint temp[4*HISTOGRAM_TABLE_SIZE]; GLhalfARB *dst = (GLhalfARB *) destination; GLuint i; /* get GLuint values */ PACK_MACRO(GLuint); /* convert to GLhalf */ for (i = 0; i < n * comps; i++) { dst[i] = _mesa_float_to_half((GLfloat) temp[i]); } if (packing->SwapBytes) { _mesa_swap2((GLushort *) dst, n * comps); } } break; case GL_UNSIGNED_BYTE_3_3_2: if (format == GL_RGB) { GLubyte *dst = (GLubyte *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][RCOMP] & 0x7) << 5) | ((rgba[i][GCOMP] & 0x7) << 2) | ((rgba[i][BCOMP] & 0x3) ); } } else { GLubyte *dst = (GLubyte *) destination; GLuint i; ASSERT(format == GL_BGR); for (i = 0; i < n; i++) { dst[i] = ((rgba[i][BCOMP] & 0x7) << 5) | ((rgba[i][GCOMP] & 0x7) << 2) | ((rgba[i][RCOMP] & 0x3) ); } } break; case GL_UNSIGNED_BYTE_2_3_3_REV: if (format == GL_RGB) { GLubyte *dst = (GLubyte *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][RCOMP] & 0x3) << 6) | ((rgba[i][GCOMP] & 0x7) << 3) | ((rgba[i][BCOMP] & 0x7) ); } } else { GLubyte *dst = (GLubyte *) destination; GLuint i; ASSERT(format == GL_BGR); for (i = 0; i < n; i++) { dst[i] = ((rgba[i][BCOMP] & 0x3) << 6) | ((rgba[i][GCOMP] & 0x7) << 3) | ((rgba[i][RCOMP] & 0x7) ); } } break; case GL_UNSIGNED_SHORT_5_6_5: if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) | ((rgba[i][GCOMP] & 0x3f) << 5) | ((rgba[i][BCOMP] & 0x1f) ); } } else { GLushort *dst = (GLushort *) destination; GLuint i; ASSERT(format == GL_BGR); for (i = 0; i < n; i++) { dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11) | ((rgba[i][GCOMP] & 0x3f) << 5) | ((rgba[i][RCOMP] & 0x1f) ); } } break; case GL_UNSIGNED_SHORT_5_6_5_REV: if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11) | ((rgba[i][GCOMP] & 0x3f) << 5) | ((rgba[i][RCOMP] & 0x1f) ); } } else { GLushort *dst = (GLushort *) destination; GLuint i; ASSERT(format == GL_BGR); for (i = 0; i < n; i++) { dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) | ((rgba[i][GCOMP] & 0x3f) << 5) | ((rgba[i][BCOMP] & 0x1f) ); } } break; case GL_UNSIGNED_SHORT_4_4_4_4: if (format == GL_RGBA) { GLushort *dst = (GLushort *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][RCOMP] & 0xf) << 12) | ((rgba[i][GCOMP] & 0xf) << 8) | ((rgba[i][BCOMP] & 0xf) << 4) | ((rgba[i][ACOMP] & 0xf) ); } } else if (format == GL_BGRA) { GLushort *dst = (GLushort *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][BCOMP] & 0xf) << 12) | ((rgba[i][GCOMP] & 0xf) << 8) | ((rgba[i][RCOMP] & 0xf) << 4) | ((rgba[i][ACOMP] & 0xf) ); } } else { GLushort *dst = (GLushort *) destination; GLuint i; ASSERT(format == GL_ABGR_EXT); for (i = 0; i < n; i++) { dst[i] = ((rgba[i][ACOMP] & 0xf) << 12) | ((rgba[i][BCOMP] & 0xf) << 8) | ((rgba[i][GCOMP] & 0xf) << 4) | ((rgba[i][RCOMP] & 0xf) ); } } break; case GL_UNSIGNED_SHORT_4_4_4_4_REV: if (format == GL_RGBA) { GLushort *dst = (GLushort *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][ACOMP] & 0xf) << 12) | ((rgba[i][BCOMP] & 0xf) << 8) | ((rgba[i][GCOMP] & 0xf) << 4) | ((rgba[i][RCOMP] & 0xf) ); } } else if (format == GL_BGRA) { GLushort *dst = (GLushort *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][ACOMP] & 0xf) << 12) | ((rgba[i][RCOMP] & 0xf) << 8) | ((rgba[i][GCOMP] & 0xf) << 4) | ((rgba[i][BCOMP] & 0xf) ); } } else { GLushort *dst = (GLushort *) destination; GLuint i; ASSERT(format == GL_ABGR_EXT); for (i = 0; i < n; i++) { dst[i] = ((rgba[i][RCOMP] & 0xf) << 12) | ((rgba[i][GCOMP] & 0xf) << 8) | ((rgba[i][BCOMP] & 0xf) << 4) | ((rgba[i][ACOMP] & 0xf) ); } } break; case GL_UNSIGNED_SHORT_5_5_5_1: if (format == GL_RGBA) { GLushort *dst = (GLushort *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) | ((rgba[i][GCOMP] & 0x1f) << 6) | ((rgba[i][BCOMP] & 0x1f) << 1) | ((rgba[i][ACOMP] & 0x1) ); } } else if (format == GL_BGRA) { GLushort *dst = (GLushort *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11) | ((rgba[i][GCOMP] & 0x1f) << 6) | ((rgba[i][RCOMP] & 0x1f) << 1) | ((rgba[i][ACOMP] & 0x1) ); } } else { GLushort *dst = (GLushort *) destination; GLuint i; ASSERT(format == GL_ABGR_EXT); for (i = 0; i < n; i++) { dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11) | ((rgba[i][BCOMP] & 0x1f) << 6) | ((rgba[i][GCOMP] & 0x1f) << 1) | ((rgba[i][RCOMP] & 0x1) ); } } break; case GL_UNSIGNED_SHORT_1_5_5_5_REV: if (format == GL_RGBA) { GLushort *dst = (GLushort *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11) | ((rgba[i][BCOMP] & 0x1f) << 6) | ((rgba[i][GCOMP] & 0x1f) << 1) | ((rgba[i][RCOMP] & 0x1) ); } } else if (format == GL_BGRA) { GLushort *dst = (GLushort *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11) | ((rgba[i][RCOMP] & 0x1f) << 6) | ((rgba[i][GCOMP] & 0x1f) << 1) | ((rgba[i][BCOMP] & 0x1) ); } } else { GLushort *dst = (GLushort *) destination; GLuint i; ASSERT(format == GL_ABGR_EXT); for (i = 0; i < n; i++) { dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11) | ((rgba[i][GCOMP] & 0x1f) << 6) | ((rgba[i][BCOMP] & 0x1f) << 1) | ((rgba[i][ACOMP] & 0x1) ); } } break; case GL_UNSIGNED_INT_8_8_8_8: if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][RCOMP] & 0xff) << 24) | ((rgba[i][GCOMP] & 0xff) << 16) | ((rgba[i][BCOMP] & 0xff) << 8) | ((rgba[i][ACOMP] & 0xff) ); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][BCOMP] & 0xff) << 24) | ((rgba[i][GCOMP] & 0xff) << 16) | ((rgba[i][RCOMP] & 0xff) << 8) | ((rgba[i][ACOMP] & 0xff) ); } } else { GLuint *dst = (GLuint *) destination; GLuint i; ASSERT(format == GL_ABGR_EXT); for (i = 0; i < n; i++) { dst[i] = ((rgba[i][ACOMP] & 0xff) << 24) | ((rgba[i][BCOMP] & 0xff) << 16) | ((rgba[i][GCOMP] & 0xff) << 8) | ((rgba[i][RCOMP] & 0xff) ); } } break; case GL_UNSIGNED_INT_8_8_8_8_REV: if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][ACOMP] & 0xff) << 24) | ((rgba[i][BCOMP] & 0xff) << 16) | ((rgba[i][GCOMP] & 0xff) << 8) | ((rgba[i][RCOMP] & 0xff) ); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][ACOMP] & 0xff) << 24) | ((rgba[i][RCOMP] & 0xff) << 16) | ((rgba[i][GCOMP] & 0xff) << 8) | ((rgba[i][BCOMP] & 0xff) ); } } else { GLuint *dst = (GLuint *) destination; GLuint i; ASSERT(format == GL_ABGR_EXT); for (i = 0; i < n; i++) { dst[i] = ((rgba[i][RCOMP] & 0xff) << 24) | ((rgba[i][GCOMP] & 0xff) << 16) | ((rgba[i][BCOMP] & 0xff) << 8) | ((rgba[i][ACOMP] & 0xff) ); } } break; case GL_UNSIGNED_INT_10_10_10_2: if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][RCOMP] & 0x3ff) << 22) | ((rgba[i][GCOMP] & 0x3ff) << 12) | ((rgba[i][BCOMP] & 0x3ff) << 2) | ((rgba[i][ACOMP] & 0x3) ); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][BCOMP] & 0x3ff) << 22) | ((rgba[i][GCOMP] & 0x3ff) << 12) | ((rgba[i][RCOMP] & 0x3ff) << 2) | ((rgba[i][ACOMP] & 0x3) ); } } else { GLuint *dst = (GLuint *) destination; GLuint i; ASSERT(format == GL_ABGR_EXT); for (i = 0; i < n; i++) { dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22) | ((rgba[i][BCOMP] & 0x3ff) << 12) | ((rgba[i][GCOMP] & 0x3ff) << 2) | ((rgba[i][RCOMP] & 0x3) ); } } break; case GL_UNSIGNED_INT_2_10_10_10_REV: if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22) | ((rgba[i][BCOMP] & 0x3ff) << 12) | ((rgba[i][GCOMP] & 0x3ff) << 2) | ((rgba[i][RCOMP] & 0x3) ); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; GLuint i; for (i = 0; i < n; i++) { dst[i] = ((rgba[i][ACOMP] & 0x3ff) << 22) | ((rgba[i][RCOMP] & 0x3ff) << 12) | ((rgba[i][GCOMP] & 0x3ff) << 2) | ((rgba[i][BCOMP] & 0x3) ); } } else { GLuint *dst = (GLuint *) destination; GLuint i; ASSERT(format == GL_ABGR_EXT); for (i = 0; i < n; i++) { dst[i] = ((rgba[i][RCOMP] & 0x3ff) << 22) | ((rgba[i][GCOMP] & 0x3ff) << 12) | ((rgba[i][BCOMP] & 0x3ff) << 2) | ((rgba[i][ACOMP] & 0x3) ); } } break; default: _mesa_problem(ctx, "Bad type in pack_histogram"); } #undef PACK_MACRO } /* * Given an internalFormat token passed to glHistogram or glMinMax, * return the corresponding base format. * Return -1 if invalid token. */ static GLint base_histogram_format( GLenum format ) { switch (format) { case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8: case GL_ALPHA12: case GL_ALPHA16: return GL_ALPHA; case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8: case GL_LUMINANCE12: case GL_LUMINANCE16: return GL_LUMINANCE; case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE6_ALPHA2: case GL_LUMINANCE8_ALPHA8: case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: return GL_LUMINANCE_ALPHA; case GL_RGB: case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: return GL_RGB; case GL_RGBA: case GL_RGBA2: case GL_RGBA4: case GL_RGB5_A1: case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: return GL_RGBA; default: return -1; /* error */ } } /********************************************************************** * API functions */ void GLAPIENTRY _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax"); return; } if (target != GL_MINMAX) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmax(target)"); return; } if (format != GL_RED && format != GL_GREEN && format != GL_BLUE && format != GL_ALPHA && format != GL_RGB && format != GL_BGR && format != GL_RGBA && format != GL_BGRA && format != GL_ABGR_EXT && format != GL_LUMINANCE && format != GL_LUMINANCE_ALPHA) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinMax(format)"); } if (!_mesa_is_legal_format_and_type(ctx, format, type)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax(format or type)"); return; } if (ctx->Pack.BufferObj->Name) { /* pack min/max values into a PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(1, &ctx->Pack, 2, 1, 1, format, type, values)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinMax(invalid PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION,"glGetMinMax(PBO is mapped)"); return; } values = ADD_POINTERS(buf, values); } else if (!values) { /* not an error */ return; } { GLfloat minmax[2][4]; minmax[0][RCOMP] = CLAMP(ctx->MinMax.Min[RCOMP], 0.0F, 1.0F); minmax[0][GCOMP] = CLAMP(ctx->MinMax.Min[GCOMP], 0.0F, 1.0F); minmax[0][BCOMP] = CLAMP(ctx->MinMax.Min[BCOMP], 0.0F, 1.0F); minmax[0][ACOMP] = CLAMP(ctx->MinMax.Min[ACOMP], 0.0F, 1.0F); minmax[1][RCOMP] = CLAMP(ctx->MinMax.Max[RCOMP], 0.0F, 1.0F); minmax[1][GCOMP] = CLAMP(ctx->MinMax.Max[GCOMP], 0.0F, 1.0F); minmax[1][BCOMP] = CLAMP(ctx->MinMax.Max[BCOMP], 0.0F, 1.0F); minmax[1][ACOMP] = CLAMP(ctx->MinMax.Max[ACOMP], 0.0F, 1.0F); _mesa_pack_rgba_span_float(ctx, 2, (CONST GLfloat (*)[4]) minmax, format, type, values, &ctx->Pack, 0); } if (ctx->Pack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, ctx->Pack.BufferObj); } if (reset) { _mesa_ResetMinmax(GL_MINMAX); } } void GLAPIENTRY _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram"); return; } if (target != GL_HISTOGRAM) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(target)"); return; } if (format != GL_RED && format != GL_GREEN && format != GL_BLUE && format != GL_ALPHA && format != GL_RGB && format != GL_BGR && format != GL_RGBA && format != GL_BGRA && format != GL_ABGR_EXT && format != GL_LUMINANCE && format != GL_LUMINANCE_ALPHA) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogram(format)"); } if (!_mesa_is_legal_format_and_type(ctx, format, type)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram(format or type)"); return; } if (ctx->Pack.BufferObj->Name) { /* pack min/max values into a PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(1, &ctx->Pack, ctx->Histogram.Width, 1, 1, format, type, values)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram(invalid PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx,GL_INVALID_OPERATION,"glGetHistogram(PBO is mapped)"); return; } values = ADD_POINTERS(buf, values); } else if (!values) { /* not an error */ return; } pack_histogram(ctx, ctx->Histogram.Width, (CONST GLuint (*)[4]) ctx->Histogram.Count, format, type, values, &ctx->Pack); if (ctx->Pack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, ctx->Pack.BufferObj); } if (reset) { GLuint i; for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { ctx->Histogram.Count[i][0] = 0; ctx->Histogram.Count[i][1] = 0; ctx->Histogram.Count[i][2] = 0; ctx->Histogram.Count[i][3] = 0; } } } void GLAPIENTRY _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameterfv"); return; } if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(target)"); return; } switch (pname) { case GL_HISTOGRAM_WIDTH: *params = (GLfloat) ctx->Histogram.Width; break; case GL_HISTOGRAM_FORMAT: *params = (GLfloat) ctx->Histogram.Format; break; case GL_HISTOGRAM_RED_SIZE: *params = (GLfloat) ctx->Histogram.RedSize; break; case GL_HISTOGRAM_GREEN_SIZE: *params = (GLfloat) ctx->Histogram.GreenSize; break; case GL_HISTOGRAM_BLUE_SIZE: *params = (GLfloat) ctx->Histogram.BlueSize; break; case GL_HISTOGRAM_ALPHA_SIZE: *params = (GLfloat) ctx->Histogram.AlphaSize; break; case GL_HISTOGRAM_LUMINANCE_SIZE: *params = (GLfloat) ctx->Histogram.LuminanceSize; break; case GL_HISTOGRAM_SINK: *params = (GLfloat) ctx->Histogram.Sink; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(pname)"); } } void GLAPIENTRY _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameteriv"); return; } if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(target)"); return; } switch (pname) { case GL_HISTOGRAM_WIDTH: *params = (GLint) ctx->Histogram.Width; break; case GL_HISTOGRAM_FORMAT: *params = (GLint) ctx->Histogram.Format; break; case GL_HISTOGRAM_RED_SIZE: *params = (GLint) ctx->Histogram.RedSize; break; case GL_HISTOGRAM_GREEN_SIZE: *params = (GLint) ctx->Histogram.GreenSize; break; case GL_HISTOGRAM_BLUE_SIZE: *params = (GLint) ctx->Histogram.BlueSize; break; case GL_HISTOGRAM_ALPHA_SIZE: *params = (GLint) ctx->Histogram.AlphaSize; break; case GL_HISTOGRAM_LUMINANCE_SIZE: *params = (GLint) ctx->Histogram.LuminanceSize; break; case GL_HISTOGRAM_SINK: *params = (GLint) ctx->Histogram.Sink; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(pname)"); } } void GLAPIENTRY _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameterfv"); return; } if (target != GL_MINMAX) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameterfv(target)"); return; } if (pname == GL_MINMAX_FORMAT) { *params = (GLfloat) ctx->MinMax.Format; } else if (pname == GL_MINMAX_SINK) { *params = (GLfloat) ctx->MinMax.Sink; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameterfv(pname)"); } } void GLAPIENTRY _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameteriv"); return; } if (target != GL_MINMAX) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameteriv(target)"); return; } if (pname == GL_MINMAX_FORMAT) { *params = (GLint) ctx->MinMax.Format; } else if (pname == GL_MINMAX_SINK) { *params = (GLint) ctx->MinMax.Sink; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameteriv(pname)"); } } void GLAPIENTRY _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) { GLuint i; GLboolean error = GL_FALSE; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */ if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { _mesa_error(ctx, GL_INVALID_OPERATION, "glHistogram"); return; } if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { _mesa_error(ctx, GL_INVALID_ENUM, "glHistogram(target)"); return; } if (width < 0 || width > HISTOGRAM_TABLE_SIZE) { if (target == GL_PROXY_HISTOGRAM) { error = GL_TRUE; } else { if (width < 0) _mesa_error(ctx, GL_INVALID_VALUE, "glHistogram(width)"); else _mesa_error(ctx, GL_TABLE_TOO_LARGE, "glHistogram(width)"); return; } } if (width != 0 && _mesa_bitcount(width) != 1) { if (target == GL_PROXY_HISTOGRAM) { error = GL_TRUE; } else { _mesa_error(ctx, GL_INVALID_VALUE, "glHistogram(width)"); return; } } if (base_histogram_format(internalFormat) < 0) { if (target == GL_PROXY_HISTOGRAM) { error = GL_TRUE; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glHistogram(internalFormat)"); return; } } /* reset histograms */ for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { ctx->Histogram.Count[i][0] = 0; ctx->Histogram.Count[i][1] = 0; ctx->Histogram.Count[i][2] = 0; ctx->Histogram.Count[i][3] = 0; } if (error) { ctx->Histogram.Width = 0; ctx->Histogram.Format = 0; ctx->Histogram.RedSize = 0; ctx->Histogram.GreenSize = 0; ctx->Histogram.BlueSize = 0; ctx->Histogram.AlphaSize = 0; ctx->Histogram.LuminanceSize = 0; } else { ctx->Histogram.Width = width; ctx->Histogram.Format = internalFormat; ctx->Histogram.Sink = sink; ctx->Histogram.RedSize = 8 * sizeof(GLuint); ctx->Histogram.GreenSize = 8 * sizeof(GLuint); ctx->Histogram.BlueSize = 8 * sizeof(GLuint); ctx->Histogram.AlphaSize = 8 * sizeof(GLuint); ctx->Histogram.LuminanceSize = 8 * sizeof(GLuint); } ctx->NewState |= _NEW_PIXEL; } void GLAPIENTRY _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { _mesa_error(ctx, GL_INVALID_OPERATION, "glMinmax"); return; } if (target != GL_MINMAX) { _mesa_error(ctx, GL_INVALID_ENUM, "glMinMax(target)"); return; } if (base_histogram_format(internalFormat) < 0) { _mesa_error(ctx, GL_INVALID_ENUM, "glMinMax(internalFormat)"); return; } if (ctx->MinMax.Sink == sink) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->MinMax.Sink = sink; } void GLAPIENTRY _mesa_ResetHistogram(GLenum target) { GLuint i; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */ if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { _mesa_error(ctx, GL_INVALID_OPERATION, "glResetHistogram"); return; } if (target != GL_HISTOGRAM) { _mesa_error(ctx, GL_INVALID_ENUM, "glResetHistogram(target)"); return; } for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { ctx->Histogram.Count[i][0] = 0; ctx->Histogram.Count[i][1] = 0; ctx->Histogram.Count[i][2] = 0; ctx->Histogram.Count[i][3] = 0; } ctx->NewState |= _NEW_PIXEL; } void GLAPIENTRY _mesa_ResetMinmax(GLenum target) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { _mesa_error(ctx, GL_INVALID_OPERATION, "glResetMinmax"); return; } if (target != GL_MINMAX) { _mesa_error(ctx, GL_INVALID_ENUM, "glResetMinMax(target)"); return; } ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000; ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000; ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; ctx->NewState |= _NEW_PIXEL; } /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ void _mesa_init_histogram( GLcontext * ctx ) { int i; /* Histogram group */ ctx->Histogram.Width = 0; ctx->Histogram.Format = GL_RGBA; ctx->Histogram.Sink = GL_FALSE; ctx->Histogram.RedSize = 0; ctx->Histogram.GreenSize = 0; ctx->Histogram.BlueSize = 0; ctx->Histogram.AlphaSize = 0; ctx->Histogram.LuminanceSize = 0; for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { ctx->Histogram.Count[i][0] = 0; ctx->Histogram.Count[i][1] = 0; ctx->Histogram.Count[i][2] = 0; ctx->Histogram.Count[i][3] = 0; } /* Min/Max group */ ctx->MinMax.Format = GL_RGBA; ctx->MinMax.Sink = GL_FALSE; ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000; ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000; ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/histogram.h0000644000000000000000000000510713614532424020312 0ustar /** * \file histogram.h * Histogram. * * \if subset * (No-op) * * \endif */ /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef HISTOGRAM_H #define HISTOGRAM_H #include "glheader.h" #include "mtypes.h" #if _HAVE_FULL_GL extern void GLAPIENTRY _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values); extern void GLAPIENTRY _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); extern void GLAPIENTRY _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params); extern void GLAPIENTRY _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params); extern void GLAPIENTRY _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_Histogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); extern void GLAPIENTRY _mesa_Minmax(GLenum target, GLenum internalformat, GLboolean sink); extern void GLAPIENTRY _mesa_ResetHistogram(GLenum target); extern void GLAPIENTRY _mesa_ResetMinmax(GLenum target); extern void _mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); extern void _mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); extern void _mesa_init_histogram( GLcontext * ctx ); #else /** No-op */ #define _mesa_init_histogram( c ) ((void) 0) #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/image.c0000644000000000000000000042013713614532424017376 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file image.c * Image handling. */ #include "glheader.h" #include "bufferobj.h" #include "colormac.h" #include "context.h" #include "image.h" #include "imports.h" #include "histogram.h" #include "macros.h" #include "pixel.h" #include "mtypes.h" /** Compute ceiling of integer quotient of A divided by B. */ #define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 ) /** * Flip the 8 bits in each byte of the given array. * * \param p array. * \param n number of bytes. * * \todo try this trick to flip bytes someday: * \code * v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); * v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); * v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); * \endcode */ static void flip_bytes( GLubyte *p, GLuint n ) { register GLuint i, a, b; for (i=0;i> 1) | ((b & 0x20) >> 3) | ((b & 0x40) >> 5) | ((b & 0x80) >> 7); p[i] = (GLubyte) a; } } /** * Flip the order of the 2 bytes in each word in the given array. * * \param p array. * \param n number of words. */ void _mesa_swap2( GLushort *p, GLuint n ) { register GLuint i; for (i=0;i> 8) | ((p[i] << 8) & 0xff00); } } /* * Flip the order of the 4 bytes in each word in the given array. */ void _mesa_swap4( GLuint *p, GLuint n ) { register GLuint i, a, b; for (i=0;i> 24) | ((b >> 8) & 0xff00) | ((b << 8) & 0xff0000) | ((b << 24) & 0xff000000); p[i] = a; } } /** * Get the size of a GL data type. * * \param type GL data type. * * \return the size, in bytes, of the given data type, 0 if a GL_BITMAP, or -1 * if an invalid type enum. */ GLint _mesa_sizeof_type( GLenum type ) { switch (type) { case GL_BITMAP: return 0; case GL_UNSIGNED_BYTE: return sizeof(GLubyte); case GL_BYTE: return sizeof(GLbyte); case GL_UNSIGNED_SHORT: return sizeof(GLushort); case GL_SHORT: return sizeof(GLshort); case GL_UNSIGNED_INT: return sizeof(GLuint); case GL_INT: return sizeof(GLint); case GL_FLOAT: return sizeof(GLfloat); case GL_HALF_FLOAT_ARB: return sizeof(GLhalfARB); default: return -1; } } /** * Same as _mesa_sizeof_type() but also accepting the packed pixel * format data types. */ GLint _mesa_sizeof_packed_type( GLenum type ) { switch (type) { case GL_BITMAP: return 0; case GL_UNSIGNED_BYTE: return sizeof(GLubyte); case GL_BYTE: return sizeof(GLbyte); case GL_UNSIGNED_SHORT: return sizeof(GLushort); case GL_SHORT: return sizeof(GLshort); case GL_UNSIGNED_INT: return sizeof(GLuint); case GL_INT: return sizeof(GLint); case GL_HALF_FLOAT_ARB: return sizeof(GLhalfARB); case GL_FLOAT: return sizeof(GLfloat); case GL_UNSIGNED_BYTE_3_3_2: return sizeof(GLubyte); case GL_UNSIGNED_BYTE_2_3_3_REV: return sizeof(GLubyte); case GL_UNSIGNED_SHORT_5_6_5: return sizeof(GLushort); case GL_UNSIGNED_SHORT_5_6_5_REV: return sizeof(GLushort); case GL_UNSIGNED_SHORT_4_4_4_4: return sizeof(GLushort); case GL_UNSIGNED_SHORT_4_4_4_4_REV: return sizeof(GLushort); case GL_UNSIGNED_SHORT_5_5_5_1: return sizeof(GLushort); case GL_UNSIGNED_SHORT_1_5_5_5_REV: return sizeof(GLushort); case GL_UNSIGNED_INT_8_8_8_8: return sizeof(GLuint); case GL_UNSIGNED_INT_8_8_8_8_REV: return sizeof(GLuint); case GL_UNSIGNED_INT_10_10_10_2: return sizeof(GLuint); case GL_UNSIGNED_INT_2_10_10_10_REV: return sizeof(GLuint); case GL_UNSIGNED_SHORT_8_8_MESA: case GL_UNSIGNED_SHORT_8_8_REV_MESA: return sizeof(GLushort); default: return -1; } } /** * Get the number of components in a pixel format. * * \param format pixel format. * * \return the number of components in the given format, or -1 if a bad format. */ GLint _mesa_components_in_format( GLenum format ) { switch (format) { case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: case GL_COLOR_INDEX2_EXT: case GL_COLOR_INDEX4_EXT: case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: case GL_STENCIL_INDEX: case GL_DEPTH_COMPONENT: case GL_RED: case GL_GREEN: case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: case GL_INTENSITY: return 1; case GL_LUMINANCE_ALPHA: return 2; case GL_RGB: return 3; case GL_RGBA: return 4; case GL_BGR: return 3; case GL_BGRA: return 4; case GL_ABGR_EXT: return 4; case GL_YCBCR_MESA: return 2; default: return -1; } } /** * Get the bytes per pixel of pixel format type pair. * * \param format pixel format. * \param type pixel type. * * \return bytes per pixel, or -1 if a bad format or type was given. */ GLint _mesa_bytes_per_pixel( GLenum format, GLenum type ) { GLint comps = _mesa_components_in_format( format ); if (comps < 0) return -1; switch (type) { case GL_BITMAP: return 0; /* special case */ case GL_BYTE: case GL_UNSIGNED_BYTE: return comps * sizeof(GLubyte); case GL_SHORT: case GL_UNSIGNED_SHORT: return comps * sizeof(GLshort); case GL_INT: case GL_UNSIGNED_INT: return comps * sizeof(GLint); case GL_FLOAT: return comps * sizeof(GLfloat); case GL_HALF_FLOAT_ARB: return comps * sizeof(GLhalfARB); case GL_UNSIGNED_BYTE_3_3_2: case GL_UNSIGNED_BYTE_2_3_3_REV: if (format == GL_RGB || format == GL_BGR) return sizeof(GLubyte); else return -1; /* error */ case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: if (format == GL_RGB || format == GL_BGR) return sizeof(GLushort); else return -1; /* error */ case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT) return sizeof(GLushort); else return -1; case GL_UNSIGNED_INT_8_8_8_8: case GL_UNSIGNED_INT_8_8_8_8_REV: case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT) return sizeof(GLuint); else return -1; case GL_UNSIGNED_SHORT_8_8_MESA: case GL_UNSIGNED_SHORT_8_8_REV_MESA: if (format == GL_YCBCR_MESA) return sizeof(GLushort); else return -1; default: return -1; } } /** * Test for a legal pixel format and type. * * \param format pixel format. * \param type pixel type. * * \return GL_TRUE if the given pixel format and type are legal, or GL_FALSE * otherwise. */ GLboolean _mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type ) { switch (format) { case GL_COLOR_INDEX: case GL_STENCIL_INDEX: switch (type) { case GL_BITMAP: case GL_BYTE: case GL_UNSIGNED_BYTE: case GL_SHORT: case GL_UNSIGNED_SHORT: case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: return GL_TRUE; case GL_HALF_FLOAT_ARB: return ctx->Extensions.ARB_half_float_pixel; default: return GL_FALSE; } case GL_RED: case GL_GREEN: case GL_BLUE: case GL_ALPHA: #if 0 /* not legal! see table 3.6 of the 1.5 spec */ case GL_INTENSITY: #endif case GL_LUMINANCE: case GL_LUMINANCE_ALPHA: case GL_DEPTH_COMPONENT: switch (type) { case GL_BYTE: case GL_UNSIGNED_BYTE: case GL_SHORT: case GL_UNSIGNED_SHORT: case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: return GL_TRUE; case GL_HALF_FLOAT_ARB: return ctx->Extensions.ARB_half_float_pixel; default: return GL_FALSE; } case GL_RGB: switch (type) { case GL_BYTE: case GL_UNSIGNED_BYTE: case GL_SHORT: case GL_UNSIGNED_SHORT: case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: case GL_UNSIGNED_BYTE_3_3_2: case GL_UNSIGNED_BYTE_2_3_3_REV: case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: return GL_TRUE; case GL_HALF_FLOAT_ARB: return ctx->Extensions.ARB_half_float_pixel; default: return GL_FALSE; } case GL_BGR: switch (type) { case GL_BYTE: case GL_UNSIGNED_BYTE: case GL_SHORT: case GL_UNSIGNED_SHORT: case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: return GL_TRUE; case GL_HALF_FLOAT_ARB: return ctx->Extensions.ARB_half_float_pixel; default: return GL_FALSE; } case GL_RGBA: case GL_BGRA: case GL_ABGR_EXT: switch (type) { case GL_BYTE: case GL_UNSIGNED_BYTE: case GL_SHORT: case GL_UNSIGNED_SHORT: case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL_UNSIGNED_INT_8_8_8_8: case GL_UNSIGNED_INT_8_8_8_8_REV: case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: return GL_TRUE; case GL_HALF_FLOAT_ARB: return ctx->Extensions.ARB_half_float_pixel; default: return GL_FALSE; } case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_SHORT_8_8_REV_MESA) return GL_TRUE; else return GL_FALSE; default: ; /* fall-through */ } return GL_FALSE; } /** * Return the address of a specific pixel in an image (1D, 2D or 3D). * * Pixel unpacking/packing parameters are observed according to \p packing. * * \param dimensions either 1, 2 or 3 to indicate dimensionality of image * \param image starting address of image data * \param width the image width * \param height theimage height * \param format the pixel format * \param type the pixel data type * \param packing the pixelstore attributes * \param img which image in the volume (0 for 1D or 2D images) * \param row row of pixel in the image (0 for 1D images) * \param column column of pixel in the image * * \return address of pixel on success, or NULL on error. * * \sa gl_pixelstore_attrib. */ GLvoid * _mesa_image_address( GLuint dimensions, const struct gl_pixelstore_attrib *packing, const GLvoid *image, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint img, GLint row, GLint column ) { GLint alignment; /* 1, 2 or 4 */ GLint pixels_per_row; GLint rows_per_image; GLint skiprows; GLint skippixels; GLint skipimages; /* for 3-D volume images */ GLubyte *pixel_addr; ASSERT(dimensions >= 1 && dimensions <= 3); alignment = packing->Alignment; if (packing->RowLength > 0) { pixels_per_row = packing->RowLength; } else { pixels_per_row = width; } if (packing->ImageHeight > 0) { rows_per_image = packing->ImageHeight; } else { rows_per_image = height; } skippixels = packing->SkipPixels; /* Note: SKIP_ROWS _is_ used for 1D images */ skiprows = packing->SkipRows; /* Note: SKIP_IMAGES is only used for 3D images */ skipimages = (dimensions == 3) ? packing->SkipImages : 0; if (type == GL_BITMAP) { /* BITMAP data */ GLint comp_per_pixel; /* components per pixel */ GLint bytes_per_comp; /* bytes per component */ GLint bytes_per_row; GLint bytes_per_image; /* Compute bytes per component */ bytes_per_comp = _mesa_sizeof_packed_type( type ); if (bytes_per_comp < 0) { return NULL; } /* Compute number of components per pixel */ comp_per_pixel = _mesa_components_in_format( format ); if (comp_per_pixel < 0) { return NULL; } bytes_per_row = alignment * CEILING( comp_per_pixel*pixels_per_row, 8*alignment ); bytes_per_image = bytes_per_row * rows_per_image; pixel_addr = (GLubyte *) image + (skipimages + img) * bytes_per_image + (skiprows + row) * bytes_per_row + (skippixels + column) / 8; } else { /* Non-BITMAP data */ GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image; GLint topOfImage; bytes_per_pixel = _mesa_bytes_per_pixel( format, type ); /* The pixel type and format should have been error checked earlier */ assert(bytes_per_pixel > 0); bytes_per_row = pixels_per_row * bytes_per_pixel; remainder = bytes_per_row % alignment; if (remainder > 0) bytes_per_row += (alignment - remainder); ASSERT(bytes_per_row % alignment == 0); bytes_per_image = bytes_per_row * rows_per_image; if (packing->Invert) { /* set pixel_addr to the last row */ topOfImage = bytes_per_row * (height - 1); bytes_per_row = -bytes_per_row; } else { topOfImage = 0; } /* compute final pixel address */ pixel_addr = (GLubyte *) image + (skipimages + img) * bytes_per_image + topOfImage + (skiprows + row) * bytes_per_row + (skippixels + column) * bytes_per_pixel; } return (GLvoid *) pixel_addr; } GLvoid * _mesa_image_address1d( const struct gl_pixelstore_attrib *packing, const GLvoid *image, GLsizei width, GLenum format, GLenum type, GLint column ) { return _mesa_image_address(1, packing, image, width, 1, format, type, 0, 0, column); } GLvoid * _mesa_image_address2d( const struct gl_pixelstore_attrib *packing, const GLvoid *image, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint row, GLint column ) { return _mesa_image_address(2, packing, image, width, height, format, type, 0, row, column); } GLvoid * _mesa_image_address3d( const struct gl_pixelstore_attrib *packing, const GLvoid *image, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint img, GLint row, GLint column ) { return _mesa_image_address(3, packing, image, width, height, format, type, img, row, column); } /** * Compute the stride between image rows. * * \param packing the pixelstore attributes * \param width image width. * \param format pixel format. * \param type pixel data type. * * \return the stride in bytes for the given parameters. * * Computes the number of bytes per pixel and row and compensates for alignment. * * \sa gl_pixelstore_attrib. */ GLint _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, GLint width, GLenum format, GLenum type ) { ASSERT(packing); if (type == GL_BITMAP) { /* BITMAP data */ GLint bytes; if (packing->RowLength == 0) { bytes = (width + 7) / 8; } else { bytes = (packing->RowLength + 7) / 8; } if (packing->Invert) { /* negate the bytes per row (negative row stride) */ bytes = -bytes; } return bytes; } else { /* Non-BITMAP data */ const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); GLint bytesPerRow, remainder; if (bytesPerPixel <= 0) return -1; /* error */ if (packing->RowLength == 0) { bytesPerRow = bytesPerPixel * width; } else { bytesPerRow = bytesPerPixel * packing->RowLength; } remainder = bytesPerRow % packing->Alignment; if (remainder > 0) bytesPerRow += (packing->Alignment - remainder); if (packing->Invert) bytesPerRow = -bytesPerRow; return bytesPerRow; } } #if _HAVE_FULL_GL /* * Compute the stride between images in a 3D texture (in bytes) for the given * pixel packing parameters and image width, format and type. */ GLint _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing, GLint width, GLint height, GLenum format, GLenum type ) { ASSERT(packing); ASSERT(type != GL_BITMAP); { const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); GLint bytesPerRow, bytesPerImage, remainder; if (bytesPerPixel <= 0) return -1; /* error */ if (packing->RowLength == 0) { bytesPerRow = bytesPerPixel * width; } else { bytesPerRow = bytesPerPixel * packing->RowLength; } remainder = bytesPerRow % packing->Alignment; if (remainder > 0) bytesPerRow += (packing->Alignment - remainder); if (packing->ImageHeight == 0) bytesPerImage = bytesPerRow * height; else bytesPerImage = bytesPerRow * packing->ImageHeight; return bytesPerImage; } } /* * Unpack a 32x32 pixel polygon stipple from user memory using the * current pixel unpack settings. */ void _mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32], const struct gl_pixelstore_attrib *unpacking ) { GLubyte *ptrn = (GLubyte *) _mesa_unpack_bitmap( 32, 32, pattern, unpacking ); if (ptrn) { /* Convert pattern from GLubytes to GLuints and handle big/little * endian differences */ GLubyte *p = ptrn; GLint i; for (i = 0; i < 32; i++) { dest[i] = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] ); p += 4; } FREE(ptrn); } } /* * Pack polygon stipple into user memory given current pixel packing * settings. */ void _mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, const struct gl_pixelstore_attrib *packing ) { /* Convert pattern from GLuints to GLubytes to handle big/little * endian differences. */ GLubyte ptrn[32*4]; GLint i; for (i = 0; i < 32; i++) { ptrn[i * 4 + 0] = (GLubyte) ((pattern[i] >> 24) & 0xff); ptrn[i * 4 + 1] = (GLubyte) ((pattern[i] >> 16) & 0xff); ptrn[i * 4 + 2] = (GLubyte) ((pattern[i] >> 8 ) & 0xff); ptrn[i * 4 + 3] = (GLubyte) ((pattern[i] ) & 0xff); } _mesa_pack_bitmap(32, 32, ptrn, dest, packing); } /* * Unpack bitmap data. Resulting data will be in most-significant-bit-first * order with row alignment = 1 byte. */ GLvoid * _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, const struct gl_pixelstore_attrib *packing ) { GLint bytes, row, width_in_bytes; GLubyte *buffer, *dst; if (!pixels) return NULL; /* Alloc dest storage */ bytes = ((width + 7) / 8 * height); buffer = (GLubyte *) MALLOC( bytes ); if (!buffer) return NULL; width_in_bytes = CEILING( width, 8 ); dst = buffer; for (row = 0; row < height; row++) { const GLubyte *src = (const GLubyte *) _mesa_image_address2d(packing, pixels, width, height, GL_COLOR_INDEX, GL_BITMAP, row, 0); if (!src) { FREE(buffer); return NULL; } if (packing->SkipPixels == 0) { MEMCPY( dst, src, width_in_bytes ); if (packing->LsbFirst) { flip_bytes( dst, width_in_bytes ); } } else { /* handling SkipPixels is a bit tricky (no pun intended!) */ GLint i; if (packing->LsbFirst) { GLubyte srcMask = 1 << (packing->SkipPixels & 0x7); GLubyte dstMask = 128; const GLubyte *s = src; GLubyte *d = dst; *d = 0; for (i = 0; i < width; i++) { if (*s & srcMask) { *d |= dstMask; } if (srcMask == 128) { srcMask = 1; s++; } else { srcMask = srcMask << 1; } if (dstMask == 1) { dstMask = 128; d++; *d = 0; } else { dstMask = dstMask >> 1; } } } else { GLubyte srcMask = 128 >> (packing->SkipPixels & 0x7); GLubyte dstMask = 128; const GLubyte *s = src; GLubyte *d = dst; *d = 0; for (i = 0; i < width; i++) { if (*s & srcMask) { *d |= dstMask; } if (srcMask == 1) { srcMask = 128; s++; } else { srcMask = srcMask >> 1; } if (dstMask == 1) { dstMask = 128; d++; *d = 0; } else { dstMask = dstMask >> 1; } } } } dst += width_in_bytes; } return buffer; } /* * Pack bitmap data. */ void _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source, GLubyte *dest, const struct gl_pixelstore_attrib *packing ) { GLint row, width_in_bytes; const GLubyte *src; if (!source) return; width_in_bytes = CEILING( width, 8 ); src = source; for (row = 0; row < height; row++) { GLubyte *dst = (GLubyte *) _mesa_image_address2d(packing, dest, width, height, GL_COLOR_INDEX, GL_BITMAP, row, 0); if (!dst) return; if (packing->SkipPixels == 0) { MEMCPY( dst, src, width_in_bytes ); if (packing->LsbFirst) { flip_bytes( dst, width_in_bytes ); } } else { /* handling SkipPixels is a bit tricky (no pun intended!) */ GLint i; if (packing->LsbFirst) { GLubyte srcMask = 1 << (packing->SkipPixels & 0x7); GLubyte dstMask = 128; const GLubyte *s = src; GLubyte *d = dst; *d = 0; for (i = 0; i < width; i++) { if (*s & srcMask) { *d |= dstMask; } if (srcMask == 128) { srcMask = 1; s++; } else { srcMask = srcMask << 1; } if (dstMask == 1) { dstMask = 128; d++; *d = 0; } else { dstMask = dstMask >> 1; } } } else { GLubyte srcMask = 128 >> (packing->SkipPixels & 0x7); GLubyte dstMask = 128; const GLubyte *s = src; GLubyte *d = dst; *d = 0; for (i = 0; i < width; i++) { if (*s & srcMask) { *d |= dstMask; } if (srcMask == 1) { srcMask = 128; s++; } else { srcMask = srcMask >> 1; } if (dstMask == 1) { dstMask = 128; d++; *d = 0; } else { dstMask = dstMask >> 1; } } } } src += width_in_bytes; } } /** * Apply various pixel transfer operations to an array of RGBA pixels * as indicated by the transferOps bitmask */ void _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLuint transferOps, GLuint n, GLfloat rgba[][4]) { /* scale & bias */ if (transferOps & IMAGE_SCALE_BIAS_BIT) { _mesa_scale_and_bias_rgba(n, rgba, ctx->Pixel.RedScale, ctx->Pixel.GreenScale, ctx->Pixel.BlueScale, ctx->Pixel.AlphaScale, ctx->Pixel.RedBias, ctx->Pixel.GreenBias, ctx->Pixel.BlueBias, ctx->Pixel.AlphaBias); } /* color map lookup */ if (transferOps & IMAGE_MAP_COLOR_BIT) { _mesa_map_rgba( ctx, n, rgba ); } /* GL_COLOR_TABLE lookup */ if (transferOps & IMAGE_COLOR_TABLE_BIT) { _mesa_lookup_rgba_float(&ctx->ColorTable, n, rgba); } /* convolution */ if (transferOps & IMAGE_CONVOLUTION_BIT) { /* this has to be done in the calling code */ _mesa_problem(ctx, "IMAGE_CONVOLUTION_BIT set in _mesa_apply_transfer_ops"); } /* GL_POST_CONVOLUTION_RED/GREEN/BLUE/ALPHA_SCALE/BIAS */ if (transferOps & IMAGE_POST_CONVOLUTION_SCALE_BIAS) { _mesa_scale_and_bias_rgba(n, rgba, ctx->Pixel.PostConvolutionScale[RCOMP], ctx->Pixel.PostConvolutionScale[GCOMP], ctx->Pixel.PostConvolutionScale[BCOMP], ctx->Pixel.PostConvolutionScale[ACOMP], ctx->Pixel.PostConvolutionBias[RCOMP], ctx->Pixel.PostConvolutionBias[GCOMP], ctx->Pixel.PostConvolutionBias[BCOMP], ctx->Pixel.PostConvolutionBias[ACOMP]); } /* GL_POST_CONVOLUTION_COLOR_TABLE lookup */ if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) { _mesa_lookup_rgba_float(&ctx->PostConvolutionColorTable, n, rgba); } /* color matrix transform */ if (transferOps & IMAGE_COLOR_MATRIX_BIT) { _mesa_transform_rgba(ctx, n, rgba); } /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ if (transferOps & IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT) { _mesa_lookup_rgba_float(&ctx->PostColorMatrixColorTable, n, rgba); } /* update histogram count */ if (transferOps & IMAGE_HISTOGRAM_BIT) { _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); } /* update min/max values */ if (transferOps & IMAGE_MIN_MAX_BIT) { _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); } /* clamping to [0,1] */ if (transferOps & IMAGE_CLAMP_BIT) { GLuint i; for (i = 0; i < n; i++) { rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F); rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F); rgba[i][BCOMP] = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F); rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F); } } } /** * Used to pack an array [][4] of RGBA float colors as specified * by the dstFormat, dstType and dstPacking. Used by glReadPixels, * glGetConvolutionFilter(), etc. * NOTE: it's assumed the incoming float colors are all in [0,1]. */ void _mesa_pack_rgba_span_float( GLcontext *ctx, GLuint n, CONST GLfloat rgbaIn[][4], GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, const struct gl_pixelstore_attrib *dstPacking, GLuint transferOps ) { const GLint comps = _mesa_components_in_format(dstFormat); GLfloat luminance[MAX_WIDTH]; const GLfloat (*rgba)[4]; GLuint i; if (transferOps) { /* make copy of incoming data */ DEFMARRAY(GLfloat, rgbaCopy, MAX_WIDTH, 4); /* mac 32k limitation */ CHECKARRAY(rgbaCopy, return); /* mac 32k limitation */ _mesa_memcpy(rgbaCopy, rgbaIn, n * 4 * sizeof(GLfloat)); _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgbaCopy); rgba = (const GLfloat (*)[4]) rgbaCopy; if ((transferOps & IMAGE_MIN_MAX_BIT) && ctx->MinMax.Sink) { UNDEFARRAY(rgbaCopy); /* mac 32k limitation */ return; } UNDEFARRAY(rgbaCopy); /* mac 32k limitation */ } else { /* use incoming data, not a copy */ rgba = (const GLfloat (*)[4]) rgbaIn; } if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) { /* compute luminance values */ if (ctx->Color.ClampReadColor == GL_TRUE) { for (i = 0; i < n; i++) { GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; luminance[i] = CLAMP(sum, 0.0F, 1.0F); } } else { for (i = 0; i < n; i++) { luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; } } } /* * Pack/store the pixels. Ugh! Lots of cases!!! */ switch (dstType) { case GL_UNSIGNED_BYTE: { GLubyte *dst = (GLubyte *) dstAddr; switch (dstFormat) { case GL_RED: for (i=0;iSwapBytes) { _mesa_swap2( (GLushort *) dst, n * comps); } } break; case GL_SHORT: { GLshort *dst = (GLshort *) dstAddr; switch (dstFormat) { case GL_RED: for (i=0;iSwapBytes) { _mesa_swap2( (GLushort *) dst, n * comps ); } } break; case GL_UNSIGNED_INT: { GLuint *dst = (GLuint *) dstAddr; switch (dstFormat) { case GL_RED: for (i=0;iSwapBytes) { _mesa_swap4( (GLuint *) dst, n * comps ); } } break; case GL_INT: { GLint *dst = (GLint *) dstAddr; switch (dstFormat) { case GL_RED: for (i=0;iSwapBytes) { _mesa_swap4( (GLuint *) dst, n * comps ); } } break; case GL_FLOAT: { GLfloat *dst = (GLfloat *) dstAddr; switch (dstFormat) { case GL_RED: for (i=0;iSwapBytes) { _mesa_swap4( (GLuint *) dst, n * comps ); } } break; case GL_HALF_FLOAT_ARB: { GLhalfARB *dst = (GLhalfARB *) dstAddr; switch (dstFormat) { case GL_RED: for (i=0;iSwapBytes) { _mesa_swap2( (GLushort *) dst, n * comps ); } } break; case GL_UNSIGNED_BYTE_3_3_2: if (dstFormat == GL_RGB) { GLubyte *dst = (GLubyte *) dstAddr; for (i=0;iNewState & _NEW_PIXEL) == 0 || transferOps == 0); /* Test for optimized case first */ if (transferOps == 0 && dstFormat == GL_RGBA && dstType == CHAN_TYPE) { /* common simple case */ MEMCPY(dstAddr, srcRgba, n * 4 * sizeof(GLchan)); } else if (transferOps == 0 && dstFormat == GL_RGB && dstType == CHAN_TYPE) { /* common simple case */ GLuint i; GLchan *dest = (GLchan *) dstAddr; for (i = 0; i < n; i++) { dest[0] = srcRgba[i][RCOMP]; dest[1] = srcRgba[i][GCOMP]; dest[2] = srcRgba[i][BCOMP]; dest += 3; } } else if (transferOps == 0 && dstFormat == GL_RGBA && dstType == GL_UNSIGNED_BYTE) { /* common simple case */ GLuint i; GLubyte *dest = (GLubyte *) dstAddr; for (i = 0; i < n; i++) { dest[0] = CHAN_TO_UBYTE(srcRgba[i][RCOMP]); dest[1] = CHAN_TO_UBYTE(srcRgba[i][GCOMP]); dest[2] = CHAN_TO_UBYTE(srcRgba[i][BCOMP]); dest[3] = CHAN_TO_UBYTE(srcRgba[i][ACOMP]); dest += 4; } } else { /* general solution */ GLuint i; DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ CHECKARRAY(rgba, return); /* mac 32k limitation */ assert(n <= MAX_WIDTH); /* convert color components to floating point */ for (i = 0; i < n; i++) { rgba[i][RCOMP] = CHAN_TO_FLOAT(srcRgba[i][RCOMP]); rgba[i][GCOMP] = CHAN_TO_FLOAT(srcRgba[i][GCOMP]); rgba[i][BCOMP] = CHAN_TO_FLOAT(srcRgba[i][BCOMP]); rgba[i][ACOMP] = CHAN_TO_FLOAT(srcRgba[i][ACOMP]); } _mesa_pack_rgba_span_float(ctx, n, (const GLfloat (*)[4]) rgba, dstFormat, dstType, dstAddr, dstPacking, transferOps); UNDEFARRAY(rgba); /* mac 32k limitation */ } } #define SWAP2BYTE(VALUE) \ { \ GLubyte *bytes = (GLubyte *) &(VALUE); \ GLubyte tmp = bytes[0]; \ bytes[0] = bytes[1]; \ bytes[1] = tmp; \ } #define SWAP4BYTE(VALUE) \ { \ GLubyte *bytes = (GLubyte *) &(VALUE); \ GLubyte tmp = bytes[0]; \ bytes[0] = bytes[3]; \ bytes[3] = tmp; \ tmp = bytes[1]; \ bytes[1] = bytes[2]; \ bytes[2] = tmp; \ } static void extract_uint_indexes(GLuint n, GLuint indexes[], GLenum srcFormat, GLenum srcType, const GLvoid *src, const struct gl_pixelstore_attrib *unpack ) { assert(srcFormat == GL_COLOR_INDEX); ASSERT(srcType == GL_BITMAP || srcType == GL_UNSIGNED_BYTE || srcType == GL_BYTE || srcType == GL_UNSIGNED_SHORT || srcType == GL_SHORT || srcType == GL_UNSIGNED_INT || srcType == GL_INT || srcType == GL_HALF_FLOAT_ARB || srcType == GL_FLOAT); switch (srcType) { case GL_BITMAP: { GLubyte *ubsrc = (GLubyte *) src; if (unpack->LsbFirst) { GLubyte mask = 1 << (unpack->SkipPixels & 0x7); GLuint i; for (i = 0; i < n; i++) { indexes[i] = (*ubsrc & mask) ? 1 : 0; if (mask == 128) { mask = 1; ubsrc++; } else { mask = mask << 1; } } } else { GLubyte mask = 128 >> (unpack->SkipPixels & 0x7); GLuint i; for (i = 0; i < n; i++) { indexes[i] = (*ubsrc & mask) ? 1 : 0; if (mask == 1) { mask = 128; ubsrc++; } else { mask = mask >> 1; } } } } break; case GL_UNSIGNED_BYTE: { GLuint i; const GLubyte *s = (const GLubyte *) src; for (i = 0; i < n; i++) indexes[i] = s[i]; } break; case GL_BYTE: { GLuint i; const GLbyte *s = (const GLbyte *) src; for (i = 0; i < n; i++) indexes[i] = s[i]; } break; case GL_UNSIGNED_SHORT: { GLuint i; const GLushort *s = (const GLushort *) src; if (unpack->SwapBytes) { for (i = 0; i < n; i++) { GLushort value = s[i]; SWAP2BYTE(value); indexes[i] = value; } } else { for (i = 0; i < n; i++) indexes[i] = s[i]; } } break; case GL_SHORT: { GLuint i; const GLshort *s = (const GLshort *) src; if (unpack->SwapBytes) { for (i = 0; i < n; i++) { GLshort value = s[i]; SWAP2BYTE(value); indexes[i] = value; } } else { for (i = 0; i < n; i++) indexes[i] = s[i]; } } break; case GL_UNSIGNED_INT: { GLuint i; const GLuint *s = (const GLuint *) src; if (unpack->SwapBytes) { for (i = 0; i < n; i++) { GLuint value = s[i]; SWAP4BYTE(value); indexes[i] = value; } } else { for (i = 0; i < n; i++) indexes[i] = s[i]; } } break; case GL_INT: { GLuint i; const GLint *s = (const GLint *) src; if (unpack->SwapBytes) { for (i = 0; i < n; i++) { GLint value = s[i]; SWAP4BYTE(value); indexes[i] = value; } } else { for (i = 0; i < n; i++) indexes[i] = s[i]; } } break; case GL_FLOAT: { GLuint i; const GLfloat *s = (const GLfloat *) src; if (unpack->SwapBytes) { for (i = 0; i < n; i++) { GLfloat value = s[i]; SWAP4BYTE(value); indexes[i] = (GLuint) value; } } else { for (i = 0; i < n; i++) indexes[i] = (GLuint) s[i]; } } break; case GL_HALF_FLOAT_ARB: { GLuint i; const GLhalfARB *s = (const GLhalfARB *) src; if (unpack->SwapBytes) { for (i = 0; i < n; i++) { GLhalfARB value = s[i]; SWAP2BYTE(value); indexes[i] = (GLuint) _mesa_half_to_float(value); } } else { for (i = 0; i < n; i++) indexes[i] = (GLuint) _mesa_half_to_float(s[i]); } } break; default: _mesa_problem(NULL, "bad srcType in extract_uint_indexes"); return; } } /* * This function extracts floating point RGBA values from arbitrary * image data. srcFormat and srcType are the format and type parameters * passed to glDrawPixels, glTexImage[123]D, glTexSubImage[123]D, etc. * * Refering to section 3.6.4 of the OpenGL 1.2 spec, this function * implements the "Conversion to floating point", "Conversion to RGB", * and "Final Expansion to RGBA" operations. * * Args: n - number of pixels * rgba - output colors * srcFormat - format of incoming data * srcType - data type of incoming data * src - source data pointer * swapBytes - perform byteswapping of incoming data? */ static void extract_float_rgba(GLuint n, GLfloat rgba[][4], GLenum srcFormat, GLenum srcType, const GLvoid *src, GLboolean swapBytes) { GLint redIndex, greenIndex, blueIndex, alphaIndex; GLint stride; GLint rComp, bComp, gComp, aComp; ASSERT(srcFormat == GL_RED || srcFormat == GL_GREEN || srcFormat == GL_BLUE || srcFormat == GL_ALPHA || srcFormat == GL_LUMINANCE || srcFormat == GL_LUMINANCE_ALPHA || srcFormat == GL_INTENSITY || srcFormat == GL_RGB || srcFormat == GL_BGR || srcFormat == GL_RGBA || srcFormat == GL_BGRA || srcFormat == GL_ABGR_EXT); ASSERT(srcType == GL_UNSIGNED_BYTE || srcType == GL_BYTE || srcType == GL_UNSIGNED_SHORT || srcType == GL_SHORT || srcType == GL_UNSIGNED_INT || srcType == GL_INT || srcType == GL_HALF_FLOAT_ARB || srcType == GL_FLOAT || srcType == GL_UNSIGNED_BYTE_3_3_2 || srcType == GL_UNSIGNED_BYTE_2_3_3_REV || srcType == GL_UNSIGNED_SHORT_5_6_5 || srcType == GL_UNSIGNED_SHORT_5_6_5_REV || srcType == GL_UNSIGNED_SHORT_4_4_4_4 || srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV || srcType == GL_UNSIGNED_SHORT_5_5_5_1 || srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV || srcType == GL_UNSIGNED_INT_8_8_8_8 || srcType == GL_UNSIGNED_INT_8_8_8_8_REV || srcType == GL_UNSIGNED_INT_10_10_10_2 || srcType == GL_UNSIGNED_INT_2_10_10_10_REV); rComp = gComp = bComp = aComp = -1; switch (srcFormat) { case GL_RED: redIndex = 0; greenIndex = blueIndex = alphaIndex = -1; stride = 1; break; case GL_GREEN: greenIndex = 0; redIndex = blueIndex = alphaIndex = -1; stride = 1; break; case GL_BLUE: blueIndex = 0; redIndex = greenIndex = alphaIndex = -1; stride = 1; break; case GL_ALPHA: redIndex = greenIndex = blueIndex = -1; alphaIndex = 0; stride = 1; break; case GL_LUMINANCE: redIndex = greenIndex = blueIndex = 0; alphaIndex = -1; stride = 1; break; case GL_LUMINANCE_ALPHA: redIndex = greenIndex = blueIndex = 0; alphaIndex = 1; stride = 2; break; case GL_INTENSITY: redIndex = greenIndex = blueIndex = alphaIndex = 0; stride = 1; break; case GL_RGB: redIndex = 0; greenIndex = 1; blueIndex = 2; alphaIndex = -1; rComp = 0; gComp = 1; bComp = 2; aComp = 3; stride = 3; break; case GL_BGR: redIndex = 2; greenIndex = 1; blueIndex = 0; alphaIndex = -1; rComp = 2; gComp = 1; bComp = 0; aComp = 3; stride = 3; break; case GL_RGBA: redIndex = 0; greenIndex = 1; blueIndex = 2; alphaIndex = 3; rComp = 0; gComp = 1; bComp = 2; aComp = 3; stride = 4; break; case GL_BGRA: redIndex = 2; greenIndex = 1; blueIndex = 0; alphaIndex = 3; rComp = 2; gComp = 1; bComp = 0; aComp = 3; stride = 4; break; case GL_ABGR_EXT: redIndex = 3; greenIndex = 2; blueIndex = 1; alphaIndex = 0; rComp = 3; gComp = 2; bComp = 1; aComp = 0; stride = 4; break; default: _mesa_problem(NULL, "bad srcFormat in extract float data"); return; } #define PROCESS(INDEX, CHANNEL, DEFAULT, TYPE, CONVERSION) \ if ((INDEX) < 0) { \ GLuint i; \ for (i = 0; i < n; i++) { \ rgba[i][CHANNEL] = DEFAULT; \ } \ } \ else if (swapBytes) { \ const TYPE *s = (const TYPE *) src; \ GLuint i; \ for (i = 0; i < n; i++) { \ TYPE value = s[INDEX]; \ if (sizeof(TYPE) == 2) { \ SWAP2BYTE(value); \ } \ else if (sizeof(TYPE) == 4) { \ SWAP4BYTE(value); \ } \ rgba[i][CHANNEL] = (GLfloat) CONVERSION(value); \ s += stride; \ } \ } \ else { \ const TYPE *s = (const TYPE *) src; \ GLuint i; \ for (i = 0; i < n; i++) { \ rgba[i][CHANNEL] = (GLfloat) CONVERSION(s[INDEX]); \ s += stride; \ } \ } switch (srcType) { case GL_UNSIGNED_BYTE: PROCESS(redIndex, RCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT); PROCESS(greenIndex, GCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT); PROCESS(blueIndex, BCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT); PROCESS(alphaIndex, ACOMP, 1.0F, GLubyte, UBYTE_TO_FLOAT); break; case GL_BYTE: PROCESS(redIndex, RCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT); PROCESS(greenIndex, GCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT); PROCESS(blueIndex, BCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT); PROCESS(alphaIndex, ACOMP, 1.0F, GLbyte, BYTE_TO_FLOAT); break; case GL_UNSIGNED_SHORT: PROCESS(redIndex, RCOMP, 0.0F, GLushort, USHORT_TO_FLOAT); PROCESS(greenIndex, GCOMP, 0.0F, GLushort, USHORT_TO_FLOAT); PROCESS(blueIndex, BCOMP, 0.0F, GLushort, USHORT_TO_FLOAT); PROCESS(alphaIndex, ACOMP, 1.0F, GLushort, USHORT_TO_FLOAT); break; case GL_SHORT: PROCESS(redIndex, RCOMP, 0.0F, GLshort, SHORT_TO_FLOAT); PROCESS(greenIndex, GCOMP, 0.0F, GLshort, SHORT_TO_FLOAT); PROCESS(blueIndex, BCOMP, 0.0F, GLshort, SHORT_TO_FLOAT); PROCESS(alphaIndex, ACOMP, 1.0F, GLshort, SHORT_TO_FLOAT); break; case GL_UNSIGNED_INT: PROCESS(redIndex, RCOMP, 0.0F, GLuint, UINT_TO_FLOAT); PROCESS(greenIndex, GCOMP, 0.0F, GLuint, UINT_TO_FLOAT); PROCESS(blueIndex, BCOMP, 0.0F, GLuint, UINT_TO_FLOAT); PROCESS(alphaIndex, ACOMP, 1.0F, GLuint, UINT_TO_FLOAT); break; case GL_INT: PROCESS(redIndex, RCOMP, 0.0F, GLint, INT_TO_FLOAT); PROCESS(greenIndex, GCOMP, 0.0F, GLint, INT_TO_FLOAT); PROCESS(blueIndex, BCOMP, 0.0F, GLint, INT_TO_FLOAT); PROCESS(alphaIndex, ACOMP, 1.0F, GLint, INT_TO_FLOAT); break; case GL_FLOAT: PROCESS(redIndex, RCOMP, 0.0F, GLfloat, (GLfloat)); PROCESS(greenIndex, GCOMP, 0.0F, GLfloat, (GLfloat)); PROCESS(blueIndex, BCOMP, 0.0F, GLfloat, (GLfloat)); PROCESS(alphaIndex, ACOMP, 1.0F, GLfloat, (GLfloat)); break; case GL_HALF_FLOAT_ARB: PROCESS(redIndex, RCOMP, 0.0F, GLhalfARB, _mesa_half_to_float); PROCESS(greenIndex, GCOMP, 0.0F, GLhalfARB, _mesa_half_to_float); PROCESS(blueIndex, BCOMP, 0.0F, GLhalfARB, _mesa_half_to_float); PROCESS(alphaIndex, ACOMP, 1.0F, GLhalfARB, _mesa_half_to_float); break; case GL_UNSIGNED_BYTE_3_3_2: { const GLubyte *ubsrc = (const GLubyte *) src; GLuint i; for (i = 0; i < n; i ++) { GLubyte p = ubsrc[i]; rgba[i][rComp] = ((p >> 5) ) * (1.0F / 7.0F); rgba[i][gComp] = ((p >> 2) & 0x7) * (1.0F / 7.0F); rgba[i][bComp] = ((p ) & 0x3) * (1.0F / 3.0F); rgba[i][aComp] = 1.0F; } } break; case GL_UNSIGNED_BYTE_2_3_3_REV: { const GLubyte *ubsrc = (const GLubyte *) src; GLuint i; for (i = 0; i < n; i ++) { GLubyte p = ubsrc[i]; rgba[i][rComp] = ((p ) & 0x7) * (1.0F / 7.0F); rgba[i][gComp] = ((p >> 3) & 0x7) * (1.0F / 7.0F); rgba[i][bComp] = ((p >> 6) ) * (1.0F / 3.0F); rgba[i][aComp] = 1.0F; } } break; case GL_UNSIGNED_SHORT_5_6_5: if (swapBytes) { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; SWAP2BYTE(p); rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F); rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); rgba[i][bComp] = ((p ) & 0x1f) * (1.0F / 31.0F); rgba[i][aComp] = 1.0F; } } else { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F); rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); rgba[i][bComp] = ((p ) & 0x1f) * (1.0F / 31.0F); rgba[i][aComp] = 1.0F; } } break; case GL_UNSIGNED_SHORT_5_6_5_REV: if (swapBytes) { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; SWAP2BYTE(p); rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F); rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); rgba[i][bComp] = ((p >> 11) ) * (1.0F / 31.0F); rgba[i][aComp] = 1.0F; } } else { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F); rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); rgba[i][bComp] = ((p >> 11) ) * (1.0F / 31.0F); rgba[i][aComp] = 1.0F; } } break; case GL_UNSIGNED_SHORT_4_4_4_4: if (swapBytes) { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; SWAP2BYTE(p); rgba[i][rComp] = ((p >> 12) ) * (1.0F / 15.0F); rgba[i][gComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); rgba[i][bComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); rgba[i][aComp] = ((p ) & 0xf) * (1.0F / 15.0F); } } else { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; rgba[i][rComp] = ((p >> 12) ) * (1.0F / 15.0F); rgba[i][gComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); rgba[i][bComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); rgba[i][aComp] = ((p ) & 0xf) * (1.0F / 15.0F); } } break; case GL_UNSIGNED_SHORT_4_4_4_4_REV: if (swapBytes) { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; SWAP2BYTE(p); rgba[i][rComp] = ((p ) & 0xf) * (1.0F / 15.0F); rgba[i][gComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); rgba[i][bComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); rgba[i][aComp] = ((p >> 12) ) * (1.0F / 15.0F); } } else { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; rgba[i][rComp] = ((p ) & 0xf) * (1.0F / 15.0F); rgba[i][gComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); rgba[i][bComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); rgba[i][aComp] = ((p >> 12) ) * (1.0F / 15.0F); } } break; case GL_UNSIGNED_SHORT_5_5_5_1: if (swapBytes) { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; SWAP2BYTE(p); rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F); rgba[i][gComp] = ((p >> 6) & 0x1f) * (1.0F / 31.0F); rgba[i][bComp] = ((p >> 1) & 0x1f) * (1.0F / 31.0F); rgba[i][aComp] = ((p ) & 0x1) * (1.0F / 1.0F); } } else { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F); rgba[i][gComp] = ((p >> 6) & 0x1f) * (1.0F / 31.0F); rgba[i][bComp] = ((p >> 1) & 0x1f) * (1.0F / 31.0F); rgba[i][aComp] = ((p ) & 0x1) * (1.0F / 1.0F); } } break; case GL_UNSIGNED_SHORT_1_5_5_5_REV: if (swapBytes) { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; SWAP2BYTE(p); rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F); rgba[i][gComp] = ((p >> 5) & 0x1f) * (1.0F / 31.0F); rgba[i][bComp] = ((p >> 10) & 0x1f) * (1.0F / 31.0F); rgba[i][aComp] = ((p >> 15) ) * (1.0F / 1.0F); } } else { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F); rgba[i][gComp] = ((p >> 5) & 0x1f) * (1.0F / 31.0F); rgba[i][bComp] = ((p >> 10) & 0x1f) * (1.0F / 31.0F); rgba[i][aComp] = ((p >> 15) ) * (1.0F / 1.0F); } } break; case GL_UNSIGNED_INT_8_8_8_8: if (swapBytes) { const GLuint *uisrc = (const GLuint *) src; GLuint i; for (i = 0; i < n; i ++) { GLuint p = uisrc[i]; rgba[i][rComp] = UBYTE_TO_FLOAT((p ) & 0xff); rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); rgba[i][aComp] = UBYTE_TO_FLOAT((p >> 24) ); } } else { const GLuint *uisrc = (const GLuint *) src; GLuint i; for (i = 0; i < n; i ++) { GLuint p = uisrc[i]; rgba[i][rComp] = UBYTE_TO_FLOAT((p >> 24) ); rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); rgba[i][aComp] = UBYTE_TO_FLOAT((p ) & 0xff); } } break; case GL_UNSIGNED_INT_8_8_8_8_REV: if (swapBytes) { const GLuint *uisrc = (const GLuint *) src; GLuint i; for (i = 0; i < n; i ++) { GLuint p = uisrc[i]; rgba[i][rComp] = UBYTE_TO_FLOAT((p >> 24) ); rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); rgba[i][aComp] = UBYTE_TO_FLOAT((p ) & 0xff); } } else { const GLuint *uisrc = (const GLuint *) src; GLuint i; for (i = 0; i < n; i ++) { GLuint p = uisrc[i]; rgba[i][rComp] = UBYTE_TO_FLOAT((p ) & 0xff); rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); rgba[i][aComp] = UBYTE_TO_FLOAT((p >> 24) ); } } break; case GL_UNSIGNED_INT_10_10_10_2: if (swapBytes) { const GLuint *uisrc = (const GLuint *) src; GLuint i; for (i = 0; i < n; i ++) { GLuint p = uisrc[i]; SWAP4BYTE(p); rgba[i][rComp] = ((p >> 22) ) * (1.0F / 1023.0F); rgba[i][gComp] = ((p >> 12) & 0x3ff) * (1.0F / 1023.0F); rgba[i][bComp] = ((p >> 2) & 0x3ff) * (1.0F / 1023.0F); rgba[i][aComp] = ((p ) & 0x3 ) * (1.0F / 3.0F); } } else { const GLuint *uisrc = (const GLuint *) src; GLuint i; for (i = 0; i < n; i ++) { GLuint p = uisrc[i]; rgba[i][rComp] = ((p >> 22) ) * (1.0F / 1023.0F); rgba[i][gComp] = ((p >> 12) & 0x3ff) * (1.0F / 1023.0F); rgba[i][bComp] = ((p >> 2) & 0x3ff) * (1.0F / 1023.0F); rgba[i][aComp] = ((p ) & 0x3 ) * (1.0F / 3.0F); } } break; case GL_UNSIGNED_INT_2_10_10_10_REV: if (swapBytes) { const GLuint *uisrc = (const GLuint *) src; GLuint i; for (i = 0; i < n; i ++) { GLuint p = uisrc[i]; SWAP4BYTE(p); rgba[i][rComp] = ((p ) & 0x3ff) * (1.0F / 1023.0F); rgba[i][gComp] = ((p >> 10) & 0x3ff) * (1.0F / 1023.0F); rgba[i][bComp] = ((p >> 20) & 0x3ff) * (1.0F / 1023.0F); rgba[i][aComp] = ((p >> 30) ) * (1.0F / 3.0F); } } else { const GLuint *uisrc = (const GLuint *) src; GLuint i; for (i = 0; i < n; i ++) { GLuint p = uisrc[i]; rgba[i][rComp] = ((p ) & 0x3ff) * (1.0F / 1023.0F); rgba[i][gComp] = ((p >> 10) & 0x3ff) * (1.0F / 1023.0F); rgba[i][bComp] = ((p >> 20) & 0x3ff) * (1.0F / 1023.0F); rgba[i][aComp] = ((p >> 30) ) * (1.0F / 3.0F); } } break; default: _mesa_problem(NULL, "bad srcType in extract float data"); break; } } /* * Unpack a row of color image data from a client buffer according to * the pixel unpacking parameters. * Return GLchan values in the specified dest image format. * This is used by glDrawPixels and glTexImage?D(). * \param ctx - the context * n - number of pixels in the span * dstFormat - format of destination color array * dest - the destination color array * srcFormat - source image format * srcType - source image data type * source - source image pointer * srcPacking - pixel unpacking parameters * transferOps - bitmask of IMAGE_*_BIT values of operations to apply * * XXX perhaps expand this to process whole images someday. */ void _mesa_unpack_color_span_chan( GLcontext *ctx, GLuint n, GLenum dstFormat, GLchan dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, GLuint transferOps ) { ASSERT(dstFormat == GL_ALPHA || dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA || dstFormat == GL_INTENSITY || dstFormat == GL_RGB || dstFormat == GL_RGBA || dstFormat == GL_COLOR_INDEX); ASSERT(srcFormat == GL_RED || srcFormat == GL_GREEN || srcFormat == GL_BLUE || srcFormat == GL_ALPHA || srcFormat == GL_LUMINANCE || srcFormat == GL_LUMINANCE_ALPHA || srcFormat == GL_INTENSITY || srcFormat == GL_RGB || srcFormat == GL_BGR || srcFormat == GL_RGBA || srcFormat == GL_BGRA || srcFormat == GL_ABGR_EXT || srcFormat == GL_COLOR_INDEX); ASSERT(srcType == GL_BITMAP || srcType == GL_UNSIGNED_BYTE || srcType == GL_BYTE || srcType == GL_UNSIGNED_SHORT || srcType == GL_SHORT || srcType == GL_UNSIGNED_INT || srcType == GL_INT || srcType == GL_HALF_FLOAT_ARB || srcType == GL_FLOAT || srcType == GL_UNSIGNED_BYTE_3_3_2 || srcType == GL_UNSIGNED_BYTE_2_3_3_REV || srcType == GL_UNSIGNED_SHORT_5_6_5 || srcType == GL_UNSIGNED_SHORT_5_6_5_REV || srcType == GL_UNSIGNED_SHORT_4_4_4_4 || srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV || srcType == GL_UNSIGNED_SHORT_5_5_5_1 || srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV || srcType == GL_UNSIGNED_INT_8_8_8_8 || srcType == GL_UNSIGNED_INT_8_8_8_8_REV || srcType == GL_UNSIGNED_INT_10_10_10_2 || srcType == GL_UNSIGNED_INT_2_10_10_10_REV); /* Try simple cases first */ if (transferOps == 0) { if (srcType == CHAN_TYPE) { if (dstFormat == GL_RGBA) { if (srcFormat == GL_RGBA) { MEMCPY( dest, source, n * 4 * sizeof(GLchan) ); return; } else if (srcFormat == GL_RGB) { GLuint i; const GLchan *src = (const GLchan *) source; GLchan *dst = dest; for (i = 0; i < n; i++) { dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; dst[3] = CHAN_MAX; src += 3; dst += 4; } return; } } else if (dstFormat == GL_RGB) { if (srcFormat == GL_RGB) { MEMCPY( dest, source, n * 3 * sizeof(GLchan) ); return; } else if (srcFormat == GL_RGBA) { GLuint i; const GLchan *src = (const GLchan *) source; GLchan *dst = dest; for (i = 0; i < n; i++) { dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; src += 4; dst += 3; } return; } } else if (dstFormat == srcFormat) { GLint comps = _mesa_components_in_format(srcFormat); assert(comps > 0); MEMCPY( dest, source, n * comps * sizeof(GLchan) ); return; } } /* * Common situation, loading 8bit RGBA/RGB source images * into 16/32 bit destination. (OSMesa16/32) */ else if (srcType == GL_UNSIGNED_BYTE) { if (dstFormat == GL_RGBA) { if (srcFormat == GL_RGB) { GLuint i; const GLubyte *src = (const GLubyte *) source; GLchan *dst = dest; for (i = 0; i < n; i++) { dst[0] = UBYTE_TO_CHAN(src[0]); dst[1] = UBYTE_TO_CHAN(src[1]); dst[2] = UBYTE_TO_CHAN(src[2]); dst[3] = CHAN_MAX; src += 3; dst += 4; } return; } else if (srcFormat == GL_RGBA) { GLuint i; const GLubyte *src = (const GLubyte *) source; GLchan *dst = dest; for (i = 0; i < n; i++) { dst[0] = UBYTE_TO_CHAN(src[0]); dst[1] = UBYTE_TO_CHAN(src[1]); dst[2] = UBYTE_TO_CHAN(src[2]); dst[3] = UBYTE_TO_CHAN(src[3]); src += 4; dst += 4; } return; } } else if (dstFormat == GL_RGB) { if (srcFormat == GL_RGB) { GLuint i; const GLubyte *src = (const GLubyte *) source; GLchan *dst = dest; for (i = 0; i < n; i++) { dst[0] = UBYTE_TO_CHAN(src[0]); dst[1] = UBYTE_TO_CHAN(src[1]); dst[2] = UBYTE_TO_CHAN(src[2]); src += 3; dst += 3; } return; } else if (srcFormat == GL_RGBA) { GLuint i; const GLubyte *src = (const GLubyte *) source; GLchan *dst = dest; for (i = 0; i < n; i++) { dst[0] = UBYTE_TO_CHAN(src[0]); dst[1] = UBYTE_TO_CHAN(src[1]); dst[2] = UBYTE_TO_CHAN(src[2]); src += 4; dst += 3; } return; } } } } /* general solution begins here */ { GLint dstComponents; GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; GLint dstLuminanceIndex, dstIntensityIndex; DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ CHECKARRAY(rgba, return); /* mac 32k limitation */ dstComponents = _mesa_components_in_format( dstFormat ); /* source & dest image formats should have been error checked by now */ assert(dstComponents > 0); /* * Extract image data and convert to RGBA floats */ assert(n <= MAX_WIDTH); if (srcFormat == GL_COLOR_INDEX) { GLuint indexes[MAX_WIDTH]; extract_uint_indexes(n, indexes, srcFormat, srcType, source, srcPacking); if (dstFormat == GL_COLOR_INDEX && (transferOps & IMAGE_MAP_COLOR_BIT)) { _mesa_map_ci(ctx, n, indexes); } if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { _mesa_shift_and_offset_ci(ctx, n, indexes); } if (dstFormat == GL_COLOR_INDEX) { /* convert to GLchan and return */ GLuint i; for (i = 0; i < n; i++) { dest[i] = (GLchan) (indexes[i] & 0xff); } UNDEFARRAY(rgba); /* mac 32k limitation */ return; } else { /* Convert indexes to RGBA */ _mesa_map_ci_to_rgba(ctx, n, indexes, rgba); } /* Don't do RGBA scale/bias or RGBA->RGBA mapping if starting * with color indexes. */ transferOps &= ~(IMAGE_SCALE_BIAS_BIT | IMAGE_MAP_COLOR_BIT); } else { /* non-color index data */ extract_float_rgba(n, rgba, srcFormat, srcType, source, srcPacking->SwapBytes); } /* Need to clamp if returning GLubytes or GLushorts */ #if CHAN_TYPE != GL_FLOAT transferOps |= IMAGE_CLAMP_BIT; #endif if (transferOps) { _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgba); } /* Now determine which color channels we need to produce. * And determine the dest index (offset) within each color tuple. */ switch (dstFormat) { case GL_ALPHA: dstAlphaIndex = 0; dstRedIndex = dstGreenIndex = dstBlueIndex = -1; dstLuminanceIndex = dstIntensityIndex = -1; break; case GL_LUMINANCE: dstLuminanceIndex = 0; dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; dstIntensityIndex = -1; break; case GL_LUMINANCE_ALPHA: dstLuminanceIndex = 0; dstAlphaIndex = 1; dstRedIndex = dstGreenIndex = dstBlueIndex = -1; dstIntensityIndex = -1; break; case GL_INTENSITY: dstIntensityIndex = 0; dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; dstLuminanceIndex = -1; break; case GL_RGB: dstRedIndex = 0; dstGreenIndex = 1; dstBlueIndex = 2; dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1; break; case GL_RGBA: dstRedIndex = 0; dstGreenIndex = 1; dstBlueIndex = 2; dstAlphaIndex = 3; dstLuminanceIndex = dstIntensityIndex = -1; break; default: _mesa_problem(ctx, "bad dstFormat in _mesa_unpack_chan_span()"); UNDEFARRAY(rgba); /* mac 32k limitation */ return; } /* Now return the GLchan data in the requested dstFormat */ if (dstRedIndex >= 0) { GLchan *dst = dest; GLuint i; for (i = 0; i < n; i++) { CLAMPED_FLOAT_TO_CHAN(dst[dstRedIndex], rgba[i][RCOMP]); dst += dstComponents; } } if (dstGreenIndex >= 0) { GLchan *dst = dest; GLuint i; for (i = 0; i < n; i++) { CLAMPED_FLOAT_TO_CHAN(dst[dstGreenIndex], rgba[i][GCOMP]); dst += dstComponents; } } if (dstBlueIndex >= 0) { GLchan *dst = dest; GLuint i; for (i = 0; i < n; i++) { CLAMPED_FLOAT_TO_CHAN(dst[dstBlueIndex], rgba[i][BCOMP]); dst += dstComponents; } } if (dstAlphaIndex >= 0) { GLchan *dst = dest; GLuint i; for (i = 0; i < n; i++) { CLAMPED_FLOAT_TO_CHAN(dst[dstAlphaIndex], rgba[i][ACOMP]); dst += dstComponents; } } if (dstIntensityIndex >= 0) { GLchan *dst = dest; GLuint i; assert(dstIntensityIndex == 0); assert(dstComponents == 1); for (i = 0; i < n; i++) { /* Intensity comes from red channel */ CLAMPED_FLOAT_TO_CHAN(dst[i], rgba[i][RCOMP]); } } if (dstLuminanceIndex >= 0) { GLchan *dst = dest; GLuint i; assert(dstLuminanceIndex == 0); for (i = 0; i < n; i++) { /* Luminance comes from red channel */ CLAMPED_FLOAT_TO_CHAN(dst[0], rgba[i][RCOMP]); dst += dstComponents; } } UNDEFARRAY(rgba); /* mac 32k limitation */ } } /** * Same as _mesa_unpack_color_span_chan(), but return GLfloat data * instead of GLchan. */ void _mesa_unpack_color_span_float( GLcontext *ctx, GLuint n, GLenum dstFormat, GLfloat dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, GLuint transferOps ) { ASSERT(dstFormat == GL_ALPHA || dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA || dstFormat == GL_INTENSITY || dstFormat == GL_RGB || dstFormat == GL_RGBA || dstFormat == GL_COLOR_INDEX); ASSERT(srcFormat == GL_RED || srcFormat == GL_GREEN || srcFormat == GL_BLUE || srcFormat == GL_ALPHA || srcFormat == GL_LUMINANCE || srcFormat == GL_LUMINANCE_ALPHA || srcFormat == GL_INTENSITY || srcFormat == GL_RGB || srcFormat == GL_BGR || srcFormat == GL_RGBA || srcFormat == GL_BGRA || srcFormat == GL_ABGR_EXT || srcFormat == GL_COLOR_INDEX); ASSERT(srcType == GL_BITMAP || srcType == GL_UNSIGNED_BYTE || srcType == GL_BYTE || srcType == GL_UNSIGNED_SHORT || srcType == GL_SHORT || srcType == GL_UNSIGNED_INT || srcType == GL_INT || srcType == GL_HALF_FLOAT_ARB || srcType == GL_FLOAT || srcType == GL_UNSIGNED_BYTE_3_3_2 || srcType == GL_UNSIGNED_BYTE_2_3_3_REV || srcType == GL_UNSIGNED_SHORT_5_6_5 || srcType == GL_UNSIGNED_SHORT_5_6_5_REV || srcType == GL_UNSIGNED_SHORT_4_4_4_4 || srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV || srcType == GL_UNSIGNED_SHORT_5_5_5_1 || srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV || srcType == GL_UNSIGNED_INT_8_8_8_8 || srcType == GL_UNSIGNED_INT_8_8_8_8_REV || srcType == GL_UNSIGNED_INT_10_10_10_2 || srcType == GL_UNSIGNED_INT_2_10_10_10_REV); /* general solution, no special cases, yet */ { GLint dstComponents; GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; GLint dstLuminanceIndex, dstIntensityIndex; DEFMARRAY(GLfloat, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ CHECKARRAY(rgba, return); /* mac 32k limitation */ dstComponents = _mesa_components_in_format( dstFormat ); /* source & dest image formats should have been error checked by now */ assert(dstComponents > 0); /* * Extract image data and convert to RGBA floats */ assert(n <= MAX_WIDTH); if (srcFormat == GL_COLOR_INDEX) { GLuint indexes[MAX_WIDTH]; extract_uint_indexes(n, indexes, srcFormat, srcType, source, srcPacking); if (dstFormat == GL_COLOR_INDEX && (transferOps & IMAGE_MAP_COLOR_BIT)) { _mesa_map_ci(ctx, n, indexes); } if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { _mesa_shift_and_offset_ci(ctx, n, indexes); } if (dstFormat == GL_COLOR_INDEX) { /* convert to GLchan and return */ GLuint i; for (i = 0; i < n; i++) { dest[i] = (GLchan) (indexes[i] & 0xff); } UNDEFARRAY(rgba); /* mac 32k limitation */ return; } else { /* Convert indexes to RGBA */ _mesa_map_ci_to_rgba(ctx, n, indexes, rgba); } /* Don't do RGBA scale/bias or RGBA->RGBA mapping if starting * with color indexes. */ transferOps &= ~(IMAGE_SCALE_BIAS_BIT | IMAGE_MAP_COLOR_BIT); } else { /* non-color index data */ extract_float_rgba(n, rgba, srcFormat, srcType, source, srcPacking->SwapBytes); } if (transferOps) { _mesa_apply_rgba_transfer_ops(ctx, transferOps, n, rgba); } /* Now determine which color channels we need to produce. * And determine the dest index (offset) within each color tuple. */ switch (dstFormat) { case GL_ALPHA: dstAlphaIndex = 0; dstRedIndex = dstGreenIndex = dstBlueIndex = -1; dstLuminanceIndex = dstIntensityIndex = -1; break; case GL_LUMINANCE: dstLuminanceIndex = 0; dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; dstIntensityIndex = -1; break; case GL_LUMINANCE_ALPHA: dstLuminanceIndex = 0; dstAlphaIndex = 1; dstRedIndex = dstGreenIndex = dstBlueIndex = -1; dstIntensityIndex = -1; break; case GL_INTENSITY: dstIntensityIndex = 0; dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; dstLuminanceIndex = -1; break; case GL_RGB: dstRedIndex = 0; dstGreenIndex = 1; dstBlueIndex = 2; dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1; break; case GL_RGBA: dstRedIndex = 0; dstGreenIndex = 1; dstBlueIndex = 2; dstAlphaIndex = 3; dstLuminanceIndex = dstIntensityIndex = -1; break; default: _mesa_problem(ctx, "bad dstFormat in _mesa_unpack_color_span_float()"); UNDEFARRAY(rgba); /* mac 32k limitation */ return; } /* Now pack results in the requested dstFormat */ if (dstRedIndex >= 0) { GLfloat *dst = dest; GLuint i; for (i = 0; i < n; i++) { dst[dstRedIndex] = rgba[i][RCOMP]; dst += dstComponents; } } if (dstGreenIndex >= 0) { GLfloat *dst = dest; GLuint i; for (i = 0; i < n; i++) { dst[dstGreenIndex] = rgba[i][GCOMP]; dst += dstComponents; } } if (dstBlueIndex >= 0) { GLfloat *dst = dest; GLuint i; for (i = 0; i < n; i++) { dst[dstBlueIndex] = rgba[i][BCOMP]; dst += dstComponents; } } if (dstAlphaIndex >= 0) { GLfloat *dst = dest; GLuint i; for (i = 0; i < n; i++) { dst[dstAlphaIndex] = rgba[i][ACOMP]; dst += dstComponents; } } if (dstIntensityIndex >= 0) { GLfloat *dst = dest; GLuint i; assert(dstIntensityIndex == 0); assert(dstComponents == 1); for (i = 0; i < n; i++) { /* Intensity comes from red channel */ dst[i] = rgba[i][RCOMP]; } } if (dstLuminanceIndex >= 0) { GLfloat *dst = dest; GLuint i; assert(dstLuminanceIndex == 0); for (i = 0; i < n; i++) { /* Luminance comes from red channel */ dst[0] = rgba[i][RCOMP]; dst += dstComponents; } } UNDEFARRAY(rgba); /* mac 32k limitation */ } } /* * Unpack a row of color index data from a client buffer according to * the pixel unpacking parameters. * This is (or will be) used by glDrawPixels, glTexImage[123]D, etc. * * Args: ctx - the context * n - number of pixels * dstType - destination data type * dest - destination array * srcType - source pixel type * source - source data pointer * srcPacking - pixel unpacking parameters * transferOps - the pixel transfer operations to apply */ void _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, GLuint transferOps ) { ASSERT(srcType == GL_BITMAP || srcType == GL_UNSIGNED_BYTE || srcType == GL_BYTE || srcType == GL_UNSIGNED_SHORT || srcType == GL_SHORT || srcType == GL_UNSIGNED_INT || srcType == GL_INT || srcType == GL_HALF_FLOAT_ARB || srcType == GL_FLOAT); ASSERT(dstType == GL_UNSIGNED_BYTE || dstType == GL_UNSIGNED_SHORT || dstType == GL_UNSIGNED_INT); transferOps &= (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT); /* * Try simple cases first */ if (transferOps == 0 && srcType == GL_UNSIGNED_BYTE && dstType == GL_UNSIGNED_BYTE) { MEMCPY(dest, source, n * sizeof(GLubyte)); } else if (transferOps == 0 && srcType == GL_UNSIGNED_INT && dstType == GL_UNSIGNED_INT && !srcPacking->SwapBytes) { MEMCPY(dest, source, n * sizeof(GLuint)); } else { /* * general solution */ GLuint indexes[MAX_WIDTH]; assert(n <= MAX_WIDTH); extract_uint_indexes(n, indexes, GL_COLOR_INDEX, srcType, source, srcPacking); if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { /* shift and offset indexes */ _mesa_shift_and_offset_ci(ctx, n, indexes); } if (transferOps & IMAGE_MAP_COLOR_BIT) { /* Apply lookup table */ _mesa_map_ci(ctx, n, indexes); } /* convert to dest type */ switch (dstType) { case GL_UNSIGNED_BYTE: { GLubyte *dst = (GLubyte *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = (GLubyte) (indexes[i] & 0xff); } } break; case GL_UNSIGNED_SHORT: { GLuint *dst = (GLuint *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = (GLushort) (indexes[i] & 0xffff); } } break; case GL_UNSIGNED_INT: MEMCPY(dest, indexes, n * sizeof(GLuint)); break; default: _mesa_problem(ctx, "bad dstType in _mesa_unpack_index_span"); } } } void _mesa_pack_index_span( const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, const GLuint *source, const struct gl_pixelstore_attrib *dstPacking, GLuint transferOps ) { GLuint indexes[MAX_WIDTH]; ASSERT(n <= MAX_WIDTH); transferOps &= (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT); if (transferOps & (IMAGE_MAP_COLOR_BIT | IMAGE_SHIFT_OFFSET_BIT)) { /* make a copy of input */ MEMCPY(indexes, source, n * sizeof(GLuint)); if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { _mesa_shift_and_offset_ci( ctx, n, indexes); } if (transferOps & IMAGE_MAP_COLOR_BIT) { _mesa_map_ci(ctx, n, indexes); } source = indexes; } switch (dstType) { case GL_UNSIGNED_BYTE: { GLubyte *dst = (GLubyte *) dest; GLuint i; for (i = 0; i < n; i++) { *dst++ = (GLubyte) source[i]; } } break; case GL_BYTE: { GLbyte *dst = (GLbyte *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = (GLbyte) source[i]; } } break; case GL_UNSIGNED_SHORT: { GLushort *dst = (GLushort *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = (GLushort) source[i]; } if (dstPacking->SwapBytes) { _mesa_swap2( (GLushort *) dst, n ); } } break; case GL_SHORT: { GLshort *dst = (GLshort *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = (GLshort) source[i]; } if (dstPacking->SwapBytes) { _mesa_swap2( (GLushort *) dst, n ); } } break; case GL_UNSIGNED_INT: { GLuint *dst = (GLuint *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = (GLuint) source[i]; } if (dstPacking->SwapBytes) { _mesa_swap4( (GLuint *) dst, n ); } } break; case GL_INT: { GLint *dst = (GLint *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = (GLint) source[i]; } if (dstPacking->SwapBytes) { _mesa_swap4( (GLuint *) dst, n ); } } break; case GL_FLOAT: { GLfloat *dst = (GLfloat *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = (GLfloat) source[i]; } if (dstPacking->SwapBytes) { _mesa_swap4( (GLuint *) dst, n ); } } break; case GL_HALF_FLOAT_ARB: { GLhalfARB *dst = (GLhalfARB *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = _mesa_float_to_half((GLfloat) source[i]); } if (dstPacking->SwapBytes) { _mesa_swap2( (GLushort *) dst, n ); } } break; default: _mesa_problem(ctx, "bad type in _mesa_pack_index_span"); } } /* * Unpack a row of stencil data from a client buffer according to * the pixel unpacking parameters. * This is (or will be) used by glDrawPixels * * Args: ctx - the context * n - number of pixels * dstType - destination data type * dest - destination array * srcType - source pixel type * source - source data pointer * srcPacking - pixel unpacking parameters * transferOps - apply offset/bias/lookup ops? */ void _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, GLuint transferOps ) { ASSERT(srcType == GL_BITMAP || srcType == GL_UNSIGNED_BYTE || srcType == GL_BYTE || srcType == GL_UNSIGNED_SHORT || srcType == GL_SHORT || srcType == GL_UNSIGNED_INT || srcType == GL_INT || srcType == GL_HALF_FLOAT_ARB || srcType == GL_FLOAT); ASSERT(dstType == GL_UNSIGNED_BYTE || dstType == GL_UNSIGNED_SHORT || dstType == GL_UNSIGNED_INT); /* only shift and offset apply to stencil */ transferOps &= IMAGE_SHIFT_OFFSET_BIT; /* * Try simple cases first */ if (transferOps == 0 && srcType == GL_UNSIGNED_BYTE && dstType == GL_UNSIGNED_BYTE) { MEMCPY(dest, source, n * sizeof(GLubyte)); } else if (transferOps == 0 && srcType == GL_UNSIGNED_INT && dstType == GL_UNSIGNED_INT && !srcPacking->SwapBytes) { MEMCPY(dest, source, n * sizeof(GLuint)); } else { /* * general solution */ GLuint indexes[MAX_WIDTH]; assert(n <= MAX_WIDTH); extract_uint_indexes(n, indexes, GL_COLOR_INDEX, srcType, source, srcPacking); if (transferOps) { if (transferOps & IMAGE_SHIFT_OFFSET_BIT) { /* shift and offset indexes */ _mesa_shift_and_offset_ci(ctx, n, indexes); } if (ctx->Pixel.MapStencilFlag) { /* Apply stencil lookup table */ GLuint mask = ctx->Pixel.MapStoSsize - 1; GLuint i; for (i=0;iPixel.MapStoS[ indexes[i] & mask ]; } } } /* convert to dest type */ switch (dstType) { case GL_UNSIGNED_BYTE: { GLubyte *dst = (GLubyte *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = (GLubyte) (indexes[i] & 0xff); } } break; case GL_UNSIGNED_SHORT: { GLuint *dst = (GLuint *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = (GLushort) (indexes[i] & 0xffff); } } break; case GL_UNSIGNED_INT: MEMCPY(dest, indexes, n * sizeof(GLuint)); break; default: _mesa_problem(ctx, "bad dstType in _mesa_unpack_stencil_span"); } } } void _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, const GLstencil *source, const struct gl_pixelstore_attrib *dstPacking ) { GLstencil stencil[MAX_WIDTH]; ASSERT(n <= MAX_WIDTH); if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset || ctx->Pixel.MapStencilFlag) { /* make a copy of input */ MEMCPY(stencil, source, n * sizeof(GLstencil)); if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { _mesa_shift_and_offset_stencil( ctx, n, stencil ); } if (ctx->Pixel.MapStencilFlag) { _mesa_map_stencil( ctx, n, stencil ); } source = stencil; } switch (dstType) { case GL_UNSIGNED_BYTE: if (sizeof(GLstencil) == 8) { MEMCPY( dest, source, n ); } else { GLubyte *dst = (GLubyte *) dest; GLuint i; for (i=0;iSwapBytes) { _mesa_swap2( (GLushort *) dst, n ); } } break; case GL_SHORT: { GLshort *dst = (GLshort *) dest; GLuint i; for (i=0;iSwapBytes) { _mesa_swap2( (GLushort *) dst, n ); } } break; case GL_UNSIGNED_INT: { GLuint *dst = (GLuint *) dest; GLuint i; for (i=0;iSwapBytes) { _mesa_swap4( (GLuint *) dst, n ); } } break; case GL_INT: { GLint *dst = (GLint *) dest; GLuint i; for (i=0;iSwapBytes) { _mesa_swap4( (GLuint *) dst, n ); } } break; case GL_FLOAT: { GLfloat *dst = (GLfloat *) dest; GLuint i; for (i=0;iSwapBytes) { _mesa_swap4( (GLuint *) dst, n ); } } break; case GL_HALF_FLOAT_ARB: { GLhalfARB *dst = (GLhalfARB *) dest; GLuint i; for (i=0;iSwapBytes) { _mesa_swap2( (GLushort *) dst, n ); } } break; case GL_BITMAP: if (dstPacking->LsbFirst) { GLubyte *dst = (GLubyte *) dest; GLint shift = 0; GLuint i; for (i = 0; i < n; i++) { if (shift == 0) *dst = 0; *dst |= ((source[i] != 0) << shift); shift++; if (shift == 8) { shift = 0; dst++; } } } else { GLubyte *dst = (GLubyte *) dest; GLint shift = 7; GLuint i; for (i = 0; i < n; i++) { if (shift == 7) *dst = 0; *dst |= ((source[i] != 0) << shift); shift--; if (shift < 0) { shift = 7; dst++; } } } break; default: _mesa_problem(ctx, "bad type in _mesa_pack_index_span"); } } void _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking ) { (void) srcPacking; switch (srcType) { case GL_BYTE: { GLuint i; const GLubyte *src = (const GLubyte *) source; for (i = 0; i < n; i++) { dest[i] = BYTE_TO_FLOAT(src[i]); } } break; case GL_UNSIGNED_BYTE: { GLuint i; const GLubyte *src = (const GLubyte *) source; for (i = 0; i < n; i++) { dest[i] = UBYTE_TO_FLOAT(src[i]); } } break; case GL_SHORT: { GLuint i; const GLshort *src = (const GLshort *) source; for (i = 0; i < n; i++) { dest[i] = SHORT_TO_FLOAT(src[i]); } } break; case GL_UNSIGNED_SHORT: { GLuint i; const GLushort *src = (const GLushort *) source; for (i = 0; i < n; i++) { dest[i] = USHORT_TO_FLOAT(src[i]); } } break; case GL_INT: { GLuint i; const GLint *src = (const GLint *) source; for (i = 0; i < n; i++) { dest[i] = INT_TO_FLOAT(src[i]); } } break; case GL_UNSIGNED_INT: { GLuint i; const GLuint *src = (const GLuint *) source; for (i = 0; i < n; i++) { dest[i] = UINT_TO_FLOAT(src[i]); } } break; case GL_FLOAT: MEMCPY(dest, source, n * sizeof(GLfloat)); break; case GL_HALF_FLOAT_ARB: { GLuint i; const GLhalfARB *src = (const GLhalfARB *) source; for (i = 0; i < n; i++) { dest[i] = _mesa_half_to_float(src[i]); } } break; default: _mesa_problem(NULL, "bad type in _mesa_unpack_depth_span()"); return; } /* apply depth scale and bias and clamp to [0,1] */ if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) { GLuint i; for (i = 0; i < n; i++) { GLfloat d = dest[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias; dest[i] = CLAMP(d, 0.0F, 1.0F); } } } /* * Pack an array of depth values. The values are floats in [0,1]. */ void _mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest, GLenum dstType, const GLfloat *depthSpan, const struct gl_pixelstore_attrib *dstPacking ) { GLfloat depthCopy[MAX_WIDTH]; const GLboolean bias_or_scale = ctx->Pixel.DepthBias != 0.0 || ctx->Pixel.DepthScale != 1.0; ASSERT(n <= MAX_WIDTH); if (bias_or_scale) { GLuint i; for (i = 0; i < n; i++) { GLfloat d; d = depthSpan[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias; depthCopy[i] = CLAMP(d, 0.0F, 1.0F); } depthSpan = depthCopy; } switch (dstType) { case GL_UNSIGNED_BYTE: { GLubyte *dst = (GLubyte *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = FLOAT_TO_UBYTE( depthSpan[i] ); } } break; case GL_BYTE: { GLbyte *dst = (GLbyte *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = FLOAT_TO_BYTE( depthSpan[i] ); } } break; case GL_UNSIGNED_SHORT: { GLushort *dst = (GLushort *) dest; GLuint i; for (i = 0; i < n; i++) { CLAMPED_FLOAT_TO_USHORT(dst[i], depthSpan[i]); } if (dstPacking->SwapBytes) { _mesa_swap2( (GLushort *) dst, n ); } } break; case GL_SHORT: { GLshort *dst = (GLshort *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = FLOAT_TO_SHORT( depthSpan[i] ); } if (dstPacking->SwapBytes) { _mesa_swap2( (GLushort *) dst, n ); } } break; case GL_UNSIGNED_INT: { GLuint *dst = (GLuint *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = FLOAT_TO_UINT( depthSpan[i] ); } if (dstPacking->SwapBytes) { _mesa_swap4( (GLuint *) dst, n ); } } break; case GL_INT: { GLint *dst = (GLint *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = FLOAT_TO_INT( depthSpan[i] ); } if (dstPacking->SwapBytes) { _mesa_swap4( (GLuint *) dst, n ); } } break; case GL_FLOAT: { GLfloat *dst = (GLfloat *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = depthSpan[i]; } if (dstPacking->SwapBytes) { _mesa_swap4( (GLuint *) dst, n ); } } break; case GL_HALF_FLOAT_ARB: { GLhalfARB *dst = (GLhalfARB *) dest; GLuint i; for (i = 0; i < n; i++) { dst[i] = _mesa_float_to_half(depthSpan[i]); } if (dstPacking->SwapBytes) { _mesa_swap2( (GLushort *) dst, n ); } } break; default: _mesa_problem(ctx, "bad type in _mesa_pack_depth_span"); } } /** * Unpack image data. Apply byte swapping, byte flipping (bitmap). * Return all image data in a contiguous block. This is used when we * compile glDrawPixels, glTexImage, etc into a display list. We * need a copy of the data in a standard format. */ void * _mesa_unpack_image( GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *unpack ) { GLint bytesPerRow, compsPerRow; GLboolean flipBytes, swap2, swap4; if (!pixels) return NULL; /* not necessarily an error */ if (width <= 0 || height <= 0 || depth <= 0) return NULL; /* generate error later */ if (format == GL_BITMAP) { bytesPerRow = (width + 7) >> 3; flipBytes = !unpack->LsbFirst; swap2 = swap4 = GL_FALSE; compsPerRow = 0; } else { const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); const GLint components = _mesa_components_in_format(format); GLint bytesPerComp; if (bytesPerPixel <= 0 || components <= 0) return NULL; /* bad format or type. generate error later */ bytesPerRow = bytesPerPixel * width; bytesPerComp = bytesPerPixel / components; flipBytes = GL_FALSE; swap2 = (bytesPerComp == 2) && unpack->SwapBytes; swap4 = (bytesPerComp == 4) && unpack->SwapBytes; compsPerRow = components * width; assert(compsPerRow >= width); } { GLubyte *destBuffer = (GLubyte *) MALLOC(bytesPerRow * height * depth); GLubyte *dst; GLint img, row; if (!destBuffer) return NULL; /* generate GL_OUT_OF_MEMORY later */ dst = destBuffer; for (img = 0; img < depth; img++) { for (row = 0; row < height; row++) { const GLvoid *src = _mesa_image_address(dimensions, unpack, pixels, width, height, format, type, img, row, 0); MEMCPY(dst, src, bytesPerRow); /* byte flipping/swapping */ if (flipBytes) { flip_bytes((GLubyte *) dst, bytesPerRow); } else if (swap2) { _mesa_swap2((GLushort*) dst, compsPerRow); } else if (swap4) { _mesa_swap4((GLuint*) dst, compsPerRow); } dst += bytesPerRow; } } return destBuffer; } } #endif /** * Perform clipping for glDrawPixels. The image's window position * and size, and the unpack skipPixels and skipRows are adjusted so * that the image region is entirely within the window and scissor bounds. * NOTE: this will only work when glPixelZoom is (1, 1). * * \return GL_TRUE if image is ready for drawing or * GL_FALSE if image was completely clipped away (draw nothing) */ GLboolean _mesa_clip_drawpixels(const GLcontext *ctx, GLint *destX, GLint *destY, GLsizei *width, GLsizei *height, GLint *skipPixels, GLint *skipRows) { const GLframebuffer *buffer = ctx->DrawBuffer; ASSERT(ctx->Pixel.ZoomX == 1.0F && ctx->Pixel.ZoomY == 1.0F); /* left clipping */ if (*destX < buffer->_Xmin) { *skipPixels += (buffer->_Xmin - *destX); *width -= (buffer->_Xmin - *destX); *destX = buffer->_Xmin; } /* right clipping */ if (*destX + *width > buffer->_Xmax) *width -= (*destX + *width - buffer->_Xmax); if (*width <= 0) return GL_FALSE; /* bottom clipping */ if (*destY < buffer->_Ymin) { *skipRows += (buffer->_Ymin - *destY); *height -= (buffer->_Ymin - *destY); *destY = buffer->_Ymin; } /* top clipping */ if (*destY + *height > buffer->_Ymax) *height -= (*destY + *height - buffer->_Ymax); if (*height <= 0) return GL_TRUE; return GL_TRUE; } /** * Perform clipping for glReadPixels. The image's window position * and size, and the pack skipPixels and skipRows are adjusted so * that the image region is entirely within the window bounds. * Note: this is different from _mesa_clip_drawpixels() in that the * scissor box is ignored, and we use the bounds of the current "read" * surface; * * \return GL_TRUE if image is ready for drawing or * GL_FALSE if image was completely clipped away (draw nothing) */ GLboolean _mesa_clip_readpixels(const GLcontext *ctx, GLint *srcX, GLint *srcY, GLsizei *width, GLsizei *height, GLint *skipPixels, GLint *skipRows) { const GLframebuffer *buffer = ctx->ReadBuffer; /* left clipping */ if (*srcX < 0) { *skipPixels += (0 - *srcX); *width -= (0 - *srcX); *srcX = 0; } /* right clipping */ if (*srcX + *width > (GLsizei) buffer->Width) *width -= (*srcX + *width - buffer->Width); if (*width <= 0) return GL_FALSE; /* bottom clipping */ if (*srcY < 0) { *skipRows += (0 - *srcY); *height -= (0 - *srcY); *srcY = 0; } /* top clipping */ if (*srcY + *height > (GLsizei) buffer->Height) *height -= (*srcY + *height - buffer->Height); if (*height <= 0) return GL_TRUE; return GL_TRUE; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/image.h0000644000000000000000000001674313614532424017407 0ustar /** * \file image.h * Image handling. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef IMAGE_H #define IMAGE_H #include "mtypes.h" extern void _mesa_swap2( GLushort *p, GLuint n ); extern void _mesa_swap4( GLuint *p, GLuint n ); extern GLint _mesa_sizeof_type( GLenum type ); extern GLint _mesa_sizeof_packed_type( GLenum type ); extern GLint _mesa_components_in_format( GLenum format ); extern GLint _mesa_bytes_per_pixel( GLenum format, GLenum type ); extern GLboolean _mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type ); extern GLvoid * _mesa_image_address( GLuint dimensions, const struct gl_pixelstore_attrib *packing, const GLvoid *image, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint img, GLint row, GLint column ); extern GLvoid * _mesa_image_address1d( const struct gl_pixelstore_attrib *packing, const GLvoid *image, GLsizei width, GLenum format, GLenum type, GLint column ); extern GLvoid * _mesa_image_address2d( const struct gl_pixelstore_attrib *packing, const GLvoid *image, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint row, GLint column ); extern GLvoid * _mesa_image_address3d( const struct gl_pixelstore_attrib *packing, const GLvoid *image, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint img, GLint row, GLint column ); extern GLint _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, GLint width, GLenum format, GLenum type ); extern GLint _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing, GLint width, GLint height, GLenum format, GLenum type ); extern void _mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32], const struct gl_pixelstore_attrib *unpacking ); extern void _mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, const struct gl_pixelstore_attrib *packing ); extern GLvoid * _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, const struct gl_pixelstore_attrib *packing ); extern void _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source, GLubyte *dest, const struct gl_pixelstore_attrib *packing ); extern void _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLuint transferOps, GLuint n, GLfloat rgba[][4]); extern void _mesa_pack_rgba_span_float( GLcontext *ctx, GLuint n, CONST GLfloat rgba[][4], GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, const struct gl_pixelstore_attrib *dstPacking, GLuint transferOps ); extern void _mesa_pack_rgba_span_chan( GLcontext *ctx, GLuint n, CONST GLchan rgba[][4], GLenum dstFormat, GLenum dstType, GLvoid *dstAddr, const struct gl_pixelstore_attrib *dstPacking, GLuint transferOps ); extern void _mesa_unpack_color_span_chan( GLcontext *ctx, GLuint n, GLenum dstFormat, GLchan dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, GLuint transferOps ); extern void _mesa_unpack_color_span_float( GLcontext *ctx, GLuint n, GLenum dstFormat, GLfloat dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, GLuint transferOps ); extern void _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, GLuint transferOps ); extern void _mesa_pack_index_span( const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, const GLuint *source, const struct gl_pixelstore_attrib *dstPacking, GLuint transferOps ); extern void _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking, GLuint transferOps ); extern void _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, const GLstencil *source, const struct gl_pixelstore_attrib *dstPacking ); extern void _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest, GLenum srcType, const GLvoid *source, const struct gl_pixelstore_attrib *srcPacking ); extern void _mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest, GLenum dstType, const GLfloat *depthSpan, const struct gl_pixelstore_attrib *dstPacking ); extern void * _mesa_unpack_image( GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *unpack ); extern GLboolean _mesa_clip_drawpixels(const GLcontext *ctx, GLint *destX, GLint *destY, GLsizei *width, GLsizei *height, GLint *skipPixels, GLint *skipRows); extern GLboolean _mesa_clip_readpixels(const GLcontext *ctx, GLint *destX, GLint *destY, GLsizei *width, GLsizei *height, GLint *skipPixels, GLint *skipRows); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/imports.c0000644000000000000000000007164013614532424020012 0ustar /** * \file imports.c * Standard C library function wrappers. * * Imports are services which the device driver or window system or * operating system provides to the core renderer. The core renderer (Mesa) * will call these functions in order to do memory allocation, simple I/O, * etc. * * Some drivers will want to override/replace this file with something * specialized, but that'll be rare. * * Eventually, I want to move roll the glheader.h file into this. * * The OpenGL SI's __GLimports structure allows per-context specification of * replacements for the standard C lib functions. In practice that's probably * never needed; compile-time replacements are far more likely. * * The _mesa_*() functions defined here don't in general take a context * parameter. I guess we can change that someday, if need be. * So for now, the __GLimports stuff really isn't used. * * \todo Functions still needed: * - scanf * - qsort * - bsearch * - rand and RAND_MAX * * \note When compiled into a XFree86 module these functions wrap around * XFree86 own wrappers. */ /* * Mesa 3-D graphics library * Version: 6.4.1 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "imports.h" #include "context.h" #include "version.h" #define MAXSTRING 4000 /* for vsnprintf() */ #ifdef WIN32 #define vsnprintf _vsnprintf #elif defined(__IBMC__) || defined(__IBMCPP__) || ( defined(__VMS) && __CRTL_VER < 70312000 ) extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg); #ifdef __VMS #include "vsnprintf.c" #endif #endif /**********************************************************************/ /** \name Memory */ /*@{*/ /** Wrapper around either malloc() or xf86malloc() */ void * _mesa_malloc(size_t bytes) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86malloc(bytes); #else return malloc(bytes); #endif } /** Wrapper around either calloc() or xf86calloc() */ void * _mesa_calloc(size_t bytes) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86calloc(1, bytes); #else return calloc(1, bytes); #endif } /** Wrapper around either free() or xf86free() */ void _mesa_free(void *ptr) { #if defined(XFree86LOADER) && defined(IN_MODULE) xf86free(ptr); #else free(ptr); #endif } /** * Allocate aligned memory. * * \param bytes number of bytes to allocate. * \param alignment alignment (must be greater than zero). * * Allocates extra memory to accommodate rounding up the address for * alignment and to record the real malloc address. * * \sa _mesa_align_free(). */ void * _mesa_align_malloc(size_t bytes, unsigned long alignment) { uintptr_t ptr, buf; ASSERT( alignment > 0 ); ptr = (uintptr_t) _mesa_malloc(bytes + alignment + sizeof(void *)); if (!ptr) return NULL; buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1); *(uintptr_t *)(buf - sizeof(void *)) = ptr; #ifdef DEBUG /* mark the non-aligned area */ while ( ptr < buf - sizeof(void *) ) { *(unsigned long *)ptr = 0xcdcdcdcd; ptr += sizeof(unsigned long); } #endif return (void *) buf; } /** * Same as _mesa_align_malloc(), but using _mesa_calloc() instead of * _mesa_malloc() */ void * _mesa_align_calloc(size_t bytes, unsigned long alignment) { uintptr_t ptr, buf; ASSERT( alignment > 0 ); ptr = (uintptr_t) _mesa_calloc(bytes + alignment + sizeof(void *)); if (!ptr) return NULL; buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1); *(uintptr_t *)(buf - sizeof(void *)) = ptr; #ifdef DEBUG /* mark the non-aligned area */ while ( ptr < buf - sizeof(void *) ) { *(unsigned long *)ptr = 0xcdcdcdcd; ptr += sizeof(unsigned long); } #endif return (void *)buf; } /** * Free memory which was allocated with either _mesa_align_malloc() * or _mesa_align_calloc(). * \param ptr pointer to the memory to be freed. * The actual address to free is stored in the word immediately before the * address the client sees. */ void _mesa_align_free(void *ptr) { #if 0 _mesa_free( (void *)(*(unsigned long *)((unsigned long)ptr - sizeof(void *))) ); #else void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); void *realAddr = *cubbyHole; _mesa_free(realAddr); #endif } /** Reallocate memory */ void * _mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize) { const size_t copySize = (oldSize < newSize) ? oldSize : newSize; void *newBuffer = _mesa_malloc(newSize); if (newBuffer && oldBuffer && copySize > 0) _mesa_memcpy(newBuffer, oldBuffer, copySize); if (oldBuffer) _mesa_free(oldBuffer); return newBuffer; } /** memcpy wrapper */ void * _mesa_memcpy(void *dest, const void *src, size_t n) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86memcpy(dest, src, n); #elif defined(SUNOS4) return memcpy((char *) dest, (char *) src, (int) n); #else return memcpy(dest, src, n); #endif } /** Wrapper around either memset() or xf86memset() */ void _mesa_memset( void *dst, int val, size_t n ) { #if defined(XFree86LOADER) && defined(IN_MODULE) xf86memset( dst, val, n ); #elif defined(SUNOS4) memset( (char *) dst, (int) val, (int) n ); #else memset(dst, val, n); #endif } /** * Fill memory with a constant 16bit word. * \param dst destination pointer. * \param val value. * \param n number of words. */ void _mesa_memset16( unsigned short *dst, unsigned short val, size_t n ) { while (n-- > 0) *dst++ = val; } /** Wrapper around either memcpy() or xf86memcpy() or bzero() */ void _mesa_bzero( void *dst, size_t n ) { #if defined(XFree86LOADER) && defined(IN_MODULE) xf86memset( dst, 0, n ); #elif defined(__FreeBSD__) bzero( dst, n ); #else memset( dst, 0, n ); #endif } /*@}*/ /**********************************************************************/ /** \name Math */ /*@{*/ /** Wrapper around either sin() or xf86sin() */ double _mesa_sin(double a) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86sin(a); #else return sin(a); #endif } /** Wrapper around either cos() or xf86cos() */ double _mesa_cos(double a) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86cos(a); #else return cos(a); #endif } /** Wrapper around either sqrt() or xf86sqrt() */ double _mesa_sqrtd(double x) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86sqrt(x); #else return sqrt(x); #endif } /* * A High Speed, Low Precision Square Root * by Paul Lalonde and Robert Dawson * from "Graphics Gems", Academic Press, 1990 * * SPARC implementation of a fast square root by table * lookup. * SPARC floating point format is as follows: * * BIT 31 30 23 22 0 * sign exponent mantissa */ static short sqrttab[0x100]; /* declare table of square roots */ static void init_sqrt_table(void) { #if defined(USE_IEEE) && !defined(DEBUG) unsigned short i; fi_type fi; /* to access the bits of a float in C quickly */ /* we use a union defined in glheader.h */ for(i=0; i<= 0x7f; i++) { fi.i = 0; /* * Build a float with the bit pattern i as mantissa * and an exponent of 0, stored as 127 */ fi.i = (i << 16) | (127 << 23); fi.f = _mesa_sqrtd(fi.f); /* * Take the square root then strip the first 7 bits of * the mantissa into the table */ sqrttab[i] = (fi.i & 0x7fffff) >> 16; /* * Repeat the process, this time with an exponent of * 1, stored as 128 */ fi.i = 0; fi.i = (i << 16) | (128 << 23); fi.f = sqrt(fi.f); sqrttab[i+0x80] = (fi.i & 0x7fffff) >> 16; } #else (void) sqrttab; /* silence compiler warnings */ #endif /*HAVE_FAST_MATH*/ } /** * Single precision square root. */ float _mesa_sqrtf( float x ) { #if defined(USE_IEEE) && !defined(DEBUG) fi_type num; /* to access the bits of a float in C * we use a union from glheader.h */ short e; /* the exponent */ if (x == 0.0F) return 0.0F; /* check for square root of 0 */ num.f = x; e = (num.i >> 23) - 127; /* get the exponent - on a SPARC the */ /* exponent is stored with 127 added */ num.i &= 0x7fffff; /* leave only the mantissa */ if (e & 0x01) num.i |= 0x800000; /* the exponent is odd so we have to */ /* look it up in the second half of */ /* the lookup table, so we set the */ /* high bit */ e >>= 1; /* divide the exponent by two */ /* note that in C the shift */ /* operators are sign preserving */ /* for signed operands */ /* Do the table lookup, based on the quaternary mantissa, * then reconstruct the result back into a float */ num.i = ((sqrttab[num.i >> 16]) << 16) | ((e + 127) << 23); return num.f; #else return (float) _mesa_sqrtd((double) x); #endif } /** inv_sqrt - A single precision 1/sqrt routine for IEEE format floats. written by Josh Vanderhoof, based on newsgroup posts by James Van Buskirk and Vesa Karvonen. */ float _mesa_inv_sqrtf(float n) { #if defined(USE_IEEE) && !defined(DEBUG) float r0, x0, y0; float r1, x1, y1; float r2, x2, y2; #if 0 /* not used, see below -BP */ float r3, x3, y3; #endif union { float f; unsigned int i; } u; unsigned int magic; /* Exponent part of the magic number - We want to: 1. subtract the bias from the exponent, 2. negate it 3. divide by two (rounding towards -inf) 4. add the bias back Which is the same as subtracting the exponent from 381 and dividing by 2. floor(-(x - 127) / 2) + 127 = floor((381 - x) / 2) */ magic = 381 << 23; /* Significand part of magic number - With the current magic number, "(magic - u.i) >> 1" will give you: for 1 <= u.f <= 2: 1.25 - u.f / 4 for 2 <= u.f <= 4: 1.00 - u.f / 8 This isn't a bad approximation of 1/sqrt. The maximum difference from 1/sqrt will be around .06. After three Newton-Raphson iterations, the maximum difference is less than 4.5e-8. (Which is actually close enough to make the following bias academic...) To get a better approximation you can add a bias to the magic number. For example, if you subtract 1/2 of the maximum difference in the first approximation (.03), you will get the following function: for 1 <= u.f <= 2: 1.22 - u.f / 4 for 2 <= u.f <= 3.76: 0.97 - u.f / 8 for 3.76 <= u.f <= 4: 0.72 - u.f / 16 (The 3.76 to 4 range is where the result is < .5.) This is the closest possible initial approximation, but with a maximum error of 8e-11 after three NR iterations, it is still not perfect. If you subtract 0.0332281 instead of .03, the maximum error will be 2.5e-11 after three NR iterations, which should be about as close as is possible. for 1 <= u.f <= 2: 1.2167719 - u.f / 4 for 2 <= u.f <= 3.73: 0.9667719 - u.f / 8 for 3.73 <= u.f <= 4: 0.7167719 - u.f / 16 */ magic -= (int)(0.0332281 * (1 << 25)); u.f = n; u.i = (magic - u.i) >> 1; /* Instead of Newton-Raphson, we use Goldschmidt's algorithm, which allows more parallelism. From what I understand, the parallelism comes at the cost of less precision, because it lets error accumulate across iterations. */ x0 = 1.0f; y0 = 0.5f * n; r0 = u.f; x1 = x0 * r0; y1 = y0 * r0 * r0; r1 = 1.5f - y1; x2 = x1 * r1; y2 = y1 * r1 * r1; r2 = 1.5f - y2; #if 1 return x2 * r2; /* we can stop here, and be conformant -BP */ #else x3 = x2 * r2; y3 = y2 * r2 * r2; r3 = 1.5f - y3; return x3 * r3; #endif #elif defined(XFree86LOADER) && defined(IN_MODULE) return 1.0F / xf86sqrt(n); #else return (float) (1.0 / sqrt(n)); #endif } /** * Wrapper around either pow() or xf86pow(). */ double _mesa_pow(double x, double y) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86pow(x, y); #else return pow(x, y); #endif } /** * Return number of bits set in given GLuint. */ unsigned int _mesa_bitcount(unsigned int n) { unsigned int bits; for (bits = 0; n > 0; n = n >> 1) { bits += (n & 1); } return bits; } /** * Convert a 4-byte float to a 2-byte half float. * Based on code from: * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html */ GLhalfARB _mesa_float_to_half(float val) { const int flt = *((int *) (void *) &val); const int flt_m = flt & 0x7fffff; const int flt_e = (flt >> 23) & 0xff; const int flt_s = (flt >> 31) & 0x1; int s, e, m = 0; GLhalfARB result; /* sign bit */ s = flt_s; /* handle special cases */ if ((flt_e == 0) && (flt_m == 0)) { /* zero */ /* m = 0; - already set */ e = 0; } else if ((flt_e == 0) && (flt_m != 0)) { /* denorm -- denorm float maps to 0 half */ /* m = 0; - already set */ e = 0; } else if ((flt_e == 0xff) && (flt_m == 0)) { /* infinity */ /* m = 0; - already set */ e = 31; } else if ((flt_e == 0xff) && (flt_m != 0)) { /* NaN */ m = 1; e = 31; } else { /* regular number */ const int new_exp = flt_e - 127; if (new_exp < -24) { /* this maps to 0 */ /* m = 0; - already set */ e = 0; } else if (new_exp < -14) { /* this maps to a denorm */ unsigned int exp_val = (unsigned int) (-14 - new_exp); /* 2^-exp_val*/ e = 0; switch (exp_val) { case 0: _mesa_warning(NULL, "float_to_half: logical error in denorm creation!\n"); /* m = 0; - already set */ break; case 1: m = 512 + (flt_m >> 14); break; case 2: m = 256 + (flt_m >> 15); break; case 3: m = 128 + (flt_m >> 16); break; case 4: m = 64 + (flt_m >> 17); break; case 5: m = 32 + (flt_m >> 18); break; case 6: m = 16 + (flt_m >> 19); break; case 7: m = 8 + (flt_m >> 20); break; case 8: m = 4 + (flt_m >> 21); break; case 9: m = 2 + (flt_m >> 22); break; case 10: m = 1; break; } } else if (new_exp > 15) { /* map this value to infinity */ /* m = 0; - already set */ e = 31; } else { /* regular */ e = new_exp + 15; m = flt_m >> 13; } } result = (s << 15) | (e << 10) | m; return result; } /** * Convert a 2-byte half float to a 4-byte float. * Based on code from: * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html */ float _mesa_half_to_float(GLhalfARB val) { /* XXX could also use a 64K-entry lookup table */ const int m = val & 0x3ff; const int e = (val >> 10) & 0x1f; const int s = (val >> 15) & 0x1; int flt_m, flt_e, flt_s, flt; float result; /* sign bit */ flt_s = s; /* handle special cases */ if ((e == 0) && (m == 0)) { /* zero */ flt_m = 0; flt_e = 0; } else if ((e == 0) && (m != 0)) { /* denorm -- denorm half will fit in non-denorm single */ const float half_denorm = 1.0f / 16384.0f; /* 2^-14 */ float mantissa = ((float) (m)) / 1024.0f; float sign = s ? -1.0f : 1.0f; return sign * mantissa * half_denorm; } else if ((e == 31) && (m == 0)) { /* infinity */ flt_e = 0xff; flt_m = 0; } else if ((e == 31) && (m != 0)) { /* NaN */ flt_e = 0xff; flt_m = 1; } else { /* regular */ flt_e = e + 112; flt_m = m << 13; } flt = (flt_s << 31) | (flt_e << 23) | flt_m; result = *((float *) (void *) &flt); return result; } /*@}*/ /**********************************************************************/ /** \name Environment vars */ /*@{*/ /** * Wrapper for getenv(). */ char * _mesa_getenv( const char *var ) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86getenv(var); #elif defined(_XBOX) return NULL; #else return getenv(var); #endif } /*@}*/ /**********************************************************************/ /** \name String */ /*@{*/ /** Wrapper around either strstr() or xf86strstr() */ char * _mesa_strstr( const char *haystack, const char *needle ) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86strstr(haystack, needle); #else return strstr(haystack, needle); #endif } /** Wrapper around either strncat() or xf86strncat() */ char * _mesa_strncat( char *dest, const char *src, size_t n ) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86strncat(dest, src, n); #else return strncat(dest, src, n); #endif } /** Wrapper around either strcpy() or xf86strcpy() */ char * _mesa_strcpy( char *dest, const char *src ) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86strcpy(dest, src); #else return strcpy(dest, src); #endif } /** Wrapper around either strncpy() or xf86strncpy() */ char * _mesa_strncpy( char *dest, const char *src, size_t n ) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86strncpy(dest, src, n); #else return strncpy(dest, src, n); #endif } /** Wrapper around either strlen() or xf86strlen() */ size_t _mesa_strlen( const char *s ) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86strlen(s); #else return strlen(s); #endif } /** Wrapper around either strcmp() or xf86strcmp() */ int _mesa_strcmp( const char *s1, const char *s2 ) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86strcmp(s1, s2); #else return strcmp(s1, s2); #endif } /** Wrapper around either strncmp() or xf86strncmp() */ int _mesa_strncmp( const char *s1, const char *s2, size_t n ) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86strncmp(s1, s2, n); #else return strncmp(s1, s2, n); #endif } /** Implemented using _mesa_malloc() and _mesa_strcpy */ char * _mesa_strdup( const char *s ) { size_t l = _mesa_strlen(s); char *s2 = (char *) _mesa_malloc(l + 1); if (s2) _mesa_strcpy(s2, s); return s2; } /** Wrapper around either atoi() or xf86atoi() */ int _mesa_atoi(const char *s) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86atoi(s); #else return atoi(s); #endif } /** Wrapper around either strtod() or xf86strtod() */ double _mesa_strtod( const char *s, char **end ) { #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86strtod(s, end); #else return strtod(s, end); #endif } /*@}*/ /**********************************************************************/ /** \name I/O */ /*@{*/ /** Wrapper around either vsprintf() or xf86vsprintf() */ int _mesa_sprintf( char *str, const char *fmt, ... ) { int r; va_list args; va_start( args, fmt ); #if defined(XFree86LOADER) && defined(IN_MODULE) r = xf86vsprintf( str, fmt, args ); #else r = vsprintf( str, fmt, args ); #endif va_end( args ); return r; } /** Wrapper around either printf() or xf86printf(), using vsprintf() for * the formatting. */ void _mesa_printf( const char *fmtString, ... ) { char s[MAXSTRING]; va_list args; va_start( args, fmtString ); vsnprintf(s, MAXSTRING, fmtString, args); va_end( args ); #if defined(XFree86LOADER) && defined(IN_MODULE) xf86printf("%s", s); #else fprintf(stderr,"%s", s); #endif } /*@}*/ /**********************************************************************/ /** \name Diagnostics */ /*@{*/ /** * Display a warning. * * \param ctx GL context. * \param fmtString printf() alike format string. * * If debugging is enabled (either at compile-time via the DEBUG macro, or * run-time via the MESA_DEBUG environment variable), prints the warning to * stderr, either via fprintf() or xf86printf(). */ void _mesa_warning( GLcontext *ctx, const char *fmtString, ... ) { GLboolean debug; char str[MAXSTRING]; va_list args; (void) ctx; va_start( args, fmtString ); (void) vsnprintf( str, MAXSTRING, fmtString, args ); va_end( args ); #ifdef DEBUG debug = GL_TRUE; /* always print warning */ #else debug = _mesa_getenv("MESA_DEBUG") ? GL_TRUE : GL_FALSE; #endif if (debug) { #if defined(XFree86LOADER) && defined(IN_MODULE) xf86fprintf(stderr, "Mesa warning: %s", str); #else fprintf(stderr, "Mesa warning: %s", str); #endif } } /** * This function is called when the Mesa user has stumbled into a code * path which may not be implemented fully or correctly. * * \param ctx GL context. * \param s problem description string. * * Prints the message to stderr, either via fprintf() or xf86fprintf(). */ void _mesa_problem( const GLcontext *ctx, const char *fmtString, ... ) { va_list args; char str[MAXSTRING]; (void) ctx; va_start( args, fmtString ); vsnprintf( str, MAXSTRING, fmtString, args ); va_end( args ); #if defined(XFree86LOADER) && defined(IN_MODULE) xf86fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str); xf86fprintf(stderr, "Please report at bugzilla.freedesktop.org\n"); #else fprintf(stderr, "Mesa %s implementation error: %s\n", MESA_VERSION_STRING, str); fprintf(stderr, "Please report at bugzilla.freedesktop.org\n"); #endif } /** * Display an error message. * * If in debug mode, print error message. * Also, record the error code by calling _mesa_record_error(). * * \param ctx the GL context. * \param error the error value. * \param fmtString printf() style format string, followed by optional args * * If debugging is enabled (either at compile-time via the DEBUG macro, or * run-time via the MESA_DEBUG environment variable), interperts the error code and * prints the error message via _mesa_debug(). */ void _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... ) { const char *debugEnv; GLboolean debug; debugEnv = _mesa_getenv("MESA_DEBUG"); #ifdef DEBUG if (debugEnv && _mesa_strstr(debugEnv, "silent")) debug = GL_FALSE; else debug = GL_TRUE; #else if (debugEnv) debug = GL_TRUE; else debug = GL_FALSE; #endif if (debug) { va_list args; char where[MAXSTRING]; const char *errstr; va_start( args, fmtString ); vsnprintf( where, MAXSTRING, fmtString, args ); va_end( args ); switch (error) { case GL_NO_ERROR: errstr = "GL_NO_ERROR"; break; case GL_INVALID_VALUE: errstr = "GL_INVALID_VALUE"; break; case GL_INVALID_ENUM: errstr = "GL_INVALID_ENUM"; break; case GL_INVALID_OPERATION: errstr = "GL_INVALID_OPERATION"; break; case GL_STACK_OVERFLOW: errstr = "GL_STACK_OVERFLOW"; break; case GL_STACK_UNDERFLOW: errstr = "GL_STACK_UNDERFLOW"; break; case GL_OUT_OF_MEMORY: errstr = "GL_OUT_OF_MEMORY"; break; case GL_TABLE_TOO_LARGE: errstr = "GL_TABLE_TOO_LARGE"; break; case GL_INVALID_FRAMEBUFFER_OPERATION_EXT: errstr = "GL_INVALID_FRAMEBUFFER_OPERATION"; break; default: errstr = "unknown"; break; } _mesa_debug(ctx, "User error: %s in %s\n", errstr, where); } _mesa_record_error(ctx, error); } /** * Report debug information. * * \param ctx GL context. * \param fmtString printf() alike format string. * * Prints the message to stderr, either via fprintf() or xf86printf(). */ void _mesa_debug( const GLcontext *ctx, const char *fmtString, ... ) { char s[MAXSTRING]; va_list args; (void) ctx; va_start(args, fmtString); vsnprintf(s, MAXSTRING, fmtString, args); va_end(args); #if defined(XFree86LOADER) && defined(IN_MODULE) xf86fprintf(stderr, "Mesa: %s", s); #else fprintf(stderr, "Mesa: %s", s); #endif } /*@}*/ /**********************************************************************/ /** \name Default Imports Wrapper */ /*@{*/ /** Wrapper around _mesa_malloc() */ static void * default_malloc(__GLcontext *gc, size_t size) { (void) gc; return _mesa_malloc(size); } /** Wrapper around _mesa_malloc() */ static void * default_calloc(__GLcontext *gc, size_t numElem, size_t elemSize) { (void) gc; return _mesa_calloc(numElem * elemSize); } /** Wrapper around either realloc() or xf86realloc() */ static void * default_realloc(__GLcontext *gc, void *oldAddr, size_t newSize) { (void) gc; #if defined(XFree86LOADER) && defined(IN_MODULE) return xf86realloc(oldAddr, newSize); #else return realloc(oldAddr, newSize); #endif } /** Wrapper around _mesa_free() */ static void default_free(__GLcontext *gc, void *addr) { (void) gc; _mesa_free(addr); } /** Wrapper around _mesa_getenv() */ static char * CAPI default_getenv( __GLcontext *gc, const char *var ) { (void) gc; return _mesa_getenv(var); } /** Wrapper around _mesa_warning() */ static void default_warning(__GLcontext *gc, char *str) { _mesa_warning(gc, str); } /** Wrapper around _mesa_problem() */ static void default_fatal(__GLcontext *gc, char *str) { _mesa_problem(gc, str); abort(); } /** Wrapper around atoi() */ static int CAPI default_atoi(__GLcontext *gc, const char *str) { (void) gc; return atoi(str); } /** Wrapper around vsprintf() */ static int CAPI default_sprintf(__GLcontext *gc, char *str, const char *fmt, ...) { int r; va_list args; (void) gc; va_start( args, fmt ); r = vsprintf( str, fmt, args ); va_end( args ); return r; } /** Wrapper around fopen() */ static void * CAPI default_fopen(__GLcontext *gc, const char *path, const char *mode) { (void) gc; return fopen(path, mode); } /** Wrapper around fclose() */ static int CAPI default_fclose(__GLcontext *gc, void *stream) { (void) gc; return fclose((FILE *) stream); } /** Wrapper around vfprintf() */ static int CAPI default_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...) { int r; va_list args; (void) gc; va_start( args, fmt ); r = vfprintf( (FILE *) stream, fmt, args ); va_end( args ); return r; } /** * \todo this really is driver-specific and can't be here */ static __GLdrawablePrivate * default_GetDrawablePrivate(__GLcontext *gc) { (void) gc; return NULL; } /*@}*/ /** * Initialize a __GLimports object to point to the functions in this * file. * * This is to be called from device drivers. * * Also, do some one-time initializations. * * \param imports the object to initialize. * \param driverCtx pointer to device driver-specific data. */ void _mesa_init_default_imports(__GLimports *imports, void *driverCtx) { /* XXX maybe move this one-time init stuff into context.c */ static GLboolean initialized = GL_FALSE; if (!initialized) { init_sqrt_table(); #if defined(_FPU_GETCW) && defined(_FPU_SETCW) { const char *debug = _mesa_getenv("MESA_DEBUG"); if (debug && _mesa_strcmp(debug, "FP")==0) { /* die on FP exceptions */ fpu_control_t mask; _FPU_GETCW(mask); mask &= ~(_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM | _FPU_MASK_OM | _FPU_MASK_UM); _FPU_SETCW(mask); } } #endif initialized = GL_TRUE; } imports->malloc = default_malloc; imports->calloc = default_calloc; imports->realloc = default_realloc; imports->free = default_free; imports->warning = default_warning; imports->fatal = default_fatal; imports->getenv = default_getenv; /* not used for now */ imports->atoi = default_atoi; imports->sprintf = default_sprintf; imports->fopen = default_fopen; imports->fclose = default_fclose; imports->fprintf = default_fprintf; imports->getDrawablePrivate = default_GetDrawablePrivate; imports->other = driverCtx; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/imports.h0000644000000000000000000005330513614532424020015 0ustar /* * Mesa 3-D graphics library * Version: 6.4.1 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file imports.h * Standard C library function wrappers. * * This file provides wrappers for all the standard C library functions * like malloc(), free(), printf(), getenv(), etc. */ #ifndef IMPORTS_H #define IMPORTS_H /* XXX some of the stuff in glheader.h should be moved into this file. */ #include "glheader.h" #ifdef __cplusplus extern "C" { #endif /**********************************************************************/ /** \name General macros */ /*@{*/ #ifndef NULL #define NULL 0 #endif /*@}*/ /**********************************************************************/ /** Memory macros */ /*@{*/ /** Allocate \p BYTES bytes */ #define MALLOC(BYTES) _mesa_malloc(BYTES) /** Allocate and zero \p BYTES bytes */ #define CALLOC(BYTES) _mesa_calloc(BYTES) /** Allocate a structure of type \p T */ #define MALLOC_STRUCT(T) (struct T *) _mesa_malloc(sizeof(struct T)) /** Allocate and zero a structure of type \p T */ #define CALLOC_STRUCT(T) (struct T *) _mesa_calloc(sizeof(struct T)) /** Free memory */ #define FREE(PTR) _mesa_free(PTR) /** Allocate \p BYTES aligned at \p N bytes */ #define ALIGN_MALLOC(BYTES, N) _mesa_align_malloc(BYTES, N) /** Allocate and zero \p BYTES bytes aligned at \p N bytes */ #define ALIGN_CALLOC(BYTES, N) _mesa_align_calloc(BYTES, N) /** Allocate a structure of type \p T aligned at \p N bytes */ #define ALIGN_MALLOC_STRUCT(T, N) (struct T *) _mesa_align_malloc(sizeof(struct T), N) /** Allocate and zero a structure of type \p T aligned at \p N bytes */ #define ALIGN_CALLOC_STRUCT(T, N) (struct T *) _mesa_align_calloc(sizeof(struct T), N) /** Free aligned memory */ #define ALIGN_FREE(PTR) _mesa_align_free(PTR) /** Copy \p BYTES bytes from \p SRC into \p DST */ #define MEMCPY( DST, SRC, BYTES) _mesa_memcpy(DST, SRC, BYTES) /** Set \p N bytes in \p DST to \p VAL */ #define MEMSET( DST, VAL, N ) _mesa_memset(DST, VAL, N) /*@}*/ /* * For GL_ARB_vertex_buffer_object we need to treat vertex array pointers * as offsets into buffer stores. Since the vertex array pointer and * buffer store pointer are both pointers and we need to add them, we use * this macro. * Both pointers/offsets are expressed in bytes. */ #define ADD_POINTERS(A, B) ( (GLubyte *) (A) + (uintptr_t) (B) ) /**********************************************************************/ /** \name [Pseudo] static array declaration. * * MACs and BeOS don't support static larger than 32kb, so ... */ /*@{*/ /** * \def DEFARRAY * Define a [static] unidimensional array */ /** * \def DEFMARRAY * Define a [static] bi-dimensional array */ /** * \def DEFMNARRAY * Define a [static] tri-dimensional array */ /** * \def CHECKARRAY * Verifies a [static] array was properly allocated. */ /** * \def UNDEFARRAY * Undefine (free) a [static] array. */ #if defined(macintosh) && !defined(__MRC__) /*extern char *AGLAlloc(int size);*/ /*extern void AGLFree(char* ptr);*/ # define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)_mesa_alloc(sizeof(TYPE)*(SIZE)) # define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])_mesa_alloc(sizeof(TYPE)*(SIZE1)*(SIZE2)) # define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE (*NAME)[SIZE2][SIZE3] = (TYPE(*)[SIZE2][SIZE3])_mesa_alloc(sizeof(TYPE)*(SIZE1)*(SIZE2)*(SIZE3)) # define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0) # define UNDEFARRAY(NAME) do {if ((NAME)) {_mesa_free((char*)NAME);} }while (0) #elif defined(__BEOS__) # define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)_mesa_malloc(sizeof(TYPE)*(SIZE)) # define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])_mesa_malloc(sizeof(TYPE)*(SIZE1)*(SIZE2)) # define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE (*NAME)[SIZE2][SIZE3] = (TYPE(*)[SIZE2][SIZE3])_mesa_malloc(sizeof(TYPE)*(SIZE1)*(SIZE2)*(SIZE3)) # define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0) # define UNDEFARRAY(NAME) do {if ((NAME)) {_mesa_free((char*)NAME);} }while (0) #else # define DEFARRAY(TYPE,NAME,SIZE) TYPE NAME[SIZE] # define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE NAME[SIZE1][SIZE2] # define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE NAME[SIZE1][SIZE2][SIZE3] # define CHECKARRAY(NAME,CMD) do {} while(0) # define UNDEFARRAY(NAME) #endif /*@}*/ /** * Sometimes we treat GLfloats as GLints. On x86 systems, moving a float * as a int (thereby using integer registers instead of FP registers) is * a performance win. Typically, this can be done with ordinary casts. * But with gcc's -fstrict-aliasing flag (which defaults to on in gcc 3.0) * these casts generate warnings. * The following union typedef is used to solve that. */ typedef union { GLfloat f; GLint i; } fi_type; /********************************************************************** * Math macros */ #define MAX_GLUSHORT 0xffff #define MAX_GLUINT 0xffffffff #ifndef M_PI #define M_PI (3.1415926536) #endif #ifndef M_E #define M_E (2.7182818284590452354) #endif /* XXX this is a bit of a hack needed for compilation within XFree86 */ #ifndef FLT_MIN #define FLT_MIN (1.0e-37) #endif /* Degrees to radians conversion: */ #define DEG2RAD (M_PI/180.0) /*** *** USE_IEEE: Determine if we're using IEEE floating point ***/ #if defined(__i386__) || defined(__386__) || defined(__sparc__) || \ defined(__s390x__) || defined(__powerpc__) || \ defined(__amd64__) || \ defined(ia64) || defined(__ia64__) || \ defined(__hppa__) || defined(hpux) || \ defined(__mips) || defined(_MIPS_ARCH) || \ defined(__arm__) || \ defined(__sh__) || \ (defined(__alpha__) && (defined(__IEEE_FLOAT) || !defined(VMS))) #define USE_IEEE #define IEEE_ONE 0x3f800000 #endif /*** *** SQRTF: single-precision square root ***/ #if 0 /* _mesa_sqrtf() not accurate enough - temporarily disabled */ # define SQRTF(X) _mesa_sqrtf(X) #elif defined(XFree86LOADER) && defined(IN_MODULE) # define SQRTF(X) (float) xf86sqrt((float) (X)) #else # define SQRTF(X) (float) sqrt((float) (X)) #endif /*** *** INV_SQRTF: single-precision inverse square root ***/ #if 0 #define INV_SQRTF(X) _mesa_inv_sqrt(X) #else #define INV_SQRTF(X) (1.0F / SQRTF(X)) /* this is faster on a P4 */ #endif /*** *** LOG2: Log base 2 of float ***/ #ifdef USE_IEEE #if 0 /* This is pretty fast, but not accurate enough (only 2 fractional bits). * Based on code from http://www.stereopsis.com/log2.html */ static INLINE GLfloat LOG2(GLfloat x) { const GLfloat y = x * x * x * x; const GLuint ix = *((GLuint *) &y); const GLuint exp = (ix >> 23) & 0xFF; const GLint log2 = ((GLint) exp) - 127; return (GLfloat) log2 * (1.0 / 4.0); /* 4, because of x^4 above */ } #endif /* Pretty fast, and accurate. * Based on code from http://www.flipcode.com/totd/ */ static INLINE GLfloat LOG2(GLfloat val) { fi_type num; GLint log_2; num.f = val; log_2 = ((num.i >> 23) & 255) - 128; num.i &= ~(255 << 23); num.i += 127 << 23; num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3; return num.f + log_2; } #elif defined(XFree86LOADER) && defined(IN_MODULE) #define LOG2(x) ((GLfloat) (xf86log(x) * 1.442695)) #else /* * NOTE: log_base_2(x) = log(x) / log(2) * NOTE: 1.442695 = 1/log(2). */ #define LOG2(x) ((GLfloat) (log(x) * 1.442695F)) #endif /*** *** IS_INF_OR_NAN: test if float is infinite or NaN ***/ #ifdef USE_IEEE static INLINE int IS_INF_OR_NAN( float x ) { fi_type tmp; tmp.f = x; return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31); } #elif defined(isfinite) #define IS_INF_OR_NAN(x) (!isfinite(x)) #elif defined(finite) #define IS_INF_OR_NAN(x) (!finite(x)) #elif defined(__VMS) #define IS_INF_OR_NAN(x) (!finite(x)) #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define IS_INF_OR_NAN(x) (!isfinite(x)) #else #define IS_INF_OR_NAN(x) (!finite(x)) #endif /*** *** IS_NEGATIVE: test if float is negative ***/ #if defined(USE_IEEE) static INLINE int GET_FLOAT_BITS( float x ) { fi_type fi; fi.f = x; return fi.i; } #define IS_NEGATIVE(x) (GET_FLOAT_BITS(x) < 0) #else #define IS_NEGATIVE(x) (x < 0.0F) #endif /*** *** DIFFERENT_SIGNS: test if two floats have opposite signs ***/ #if defined(USE_IEEE) #define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31)) #else /* Could just use (x*y<0) except for the flatshading requirements. * Maybe there's a better way? */ #define DIFFERENT_SIGNS(x,y) ((x) * (y) <= 0.0F && (x) - (y) != 0.0F) #endif /*** *** CEILF: ceiling of float *** FLOORF: floor of float *** FABSF: absolute value of float *** LOGF: the natural logarithm (base e) of the value *** EXPF: raise e to the value *** LDEXPF: multiply value by an integral power of two *** FREXPF: extract mantissa and exponent from value ***/ #if defined(XFree86LOADER) && defined(IN_MODULE) #define CEILF(x) ((GLfloat) xf86ceil(x)) #define FLOORF(x) ((GLfloat) xf86floor(x)) #define FABSF(x) ((GLfloat) xf86fabs(x)) #define LOGF(x) ((GLfloat) xf86log(x)) #define EXPF(x) ((GLfloat) xf86exp(x)) #define LDEXPF(x,y) ((GLfloat) xf86ldexp(x,y)) #define FREXPF(x,y) ((GLfloat) xf86frexp(x,y)) #elif defined(__gnu_linux__) /* C99 functions */ #define CEILF(x) ceilf(x) #define FLOORF(x) floorf(x) #define FABSF(x) fabsf(x) #define LOGF(x) logf(x) #define EXPF(x) expf(x) #define LDEXPF(x,y) ldexpf(x,y) #define FREXPF(x,y) frexpf(x,y) #else #define CEILF(x) ((GLfloat) ceil(x)) #define FLOORF(x) ((GLfloat) floor(x)) #define FABSF(x) ((GLfloat) fabs(x)) #define LOGF(x) ((GLfloat) log(x)) #define EXPF(x) ((GLfloat) exp(x)) #define LDEXPF(x,y) ((GLfloat) ldexp(x,y)) #define FREXPF(x,y) ((GLfloat) frexp(x,y)) #endif /*** *** IROUND: return (as an integer) float rounded to nearest integer ***/ #if defined(USE_SPARC_ASM) && defined(__GNUC__) && defined(__sparc__) static INLINE int iround(float f) { int r; __asm__ ("fstoi %1, %0" : "=f" (r) : "f" (f)); return r; } #define IROUND(x) iround(x) #elif defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) && \ (!defined(__BEOS__) || (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))) static INLINE int iround(float f) { int r; __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st"); return r; } #define IROUND(x) iround(x) #elif defined(USE_X86_ASM) && defined(__MSC__) && defined(__WIN32__) static INLINE int iround(float f) { int r; _asm { fld f fistp r } return r; } #define IROUND(x) iround(x) #elif defined(__WATCOMC__) && defined(__386__) long iround(float f); #pragma aux iround = \ "push eax" \ "fistp dword ptr [esp]" \ "pop eax" \ parm [8087] \ value [eax] \ modify exact [eax]; #define IROUND(x) iround(x) #else #define IROUND(f) ((int) (((f) >= 0.0F) ? ((f) + 0.5F) : ((f) - 0.5F))) #endif /*** *** IROUND_POS: return (as an integer) positive float rounded to nearest int ***/ #ifdef DEBUG #define IROUND_POS(f) (assert((f) >= 0.0F), IROUND(f)) #else #define IROUND_POS(f) (IROUND(f)) #endif /*** *** IFLOOR: return (as an integer) floor of float ***/ #if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) /* * IEEE floor for computers that round to nearest or even. * 'f' must be between -4194304 and 4194303. * This floor operation is done by "(iround(f + .5) + iround(f - .5)) >> 1", * but uses some IEEE specific tricks for better speed. * Contributed by Josh Vanderhoof */ static INLINE int ifloor(float f) { int ai, bi; double af, bf; af = (3 << 22) + 0.5 + (double)f; bf = (3 << 22) + 0.5 - (double)f; /* GCC generates an extra fstp/fld without this. */ __asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st"); __asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st"); return (ai - bi) >> 1; } #define IFLOOR(x) ifloor(x) #elif defined(USE_IEEE) static INLINE int ifloor(float f) { int ai, bi; double af, bf; fi_type u; af = (3 << 22) + 0.5 + (double)f; bf = (3 << 22) + 0.5 - (double)f; u.f = (float) af; ai = u.i; u.f = (float) bf; bi = u.i; return (ai - bi) >> 1; } #define IFLOOR(x) ifloor(x) #else static INLINE int ifloor(float f) { int i = IROUND(f); return (i > f) ? i - 1 : i; } #define IFLOOR(x) ifloor(x) #endif /*** *** ICEIL: return (as an integer) ceiling of float ***/ #if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) /* * IEEE ceil for computers that round to nearest or even. * 'f' must be between -4194304 and 4194303. * This ceil operation is done by "(iround(f + .5) + iround(f - .5) + 1) >> 1", * but uses some IEEE specific tricks for better speed. * Contributed by Josh Vanderhoof */ static INLINE int iceil(float f) { int ai, bi; double af, bf; af = (3 << 22) + 0.5 + (double)f; bf = (3 << 22) + 0.5 - (double)f; /* GCC generates an extra fstp/fld without this. */ __asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st"); __asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st"); return (ai - bi + 1) >> 1; } #define ICEIL(x) iceil(x) #elif defined(USE_IEEE) static INLINE int iceil(float f) { int ai, bi; double af, bf; fi_type u; af = (3 << 22) + 0.5 + (double)f; bf = (3 << 22) + 0.5 - (double)f; u.f = (float) af; ai = u.i; u.f = (float) bf; bi = u.i; return (ai - bi + 1) >> 1; } #define ICEIL(x) iceil(x) #else static INLINE int iceil(float f) { int i = IROUND(f); return (i < f) ? i + 1 : i; } #define ICEIL(x) iceil(x) #endif /*** *** UNCLAMPED_FLOAT_TO_UBYTE: clamp float to [0,1] and map to ubyte in [0,255] *** CLAMPED_FLOAT_TO_UBYTE: map float known to be in [0,1] to ubyte in [0,255] ***/ #if defined(USE_IEEE) && !defined(DEBUG) #define IEEE_0996 0x3f7f0000 /* 0.996 or so */ /* This function/macro is sensitive to precision. Test very carefully * if you change it! */ #define UNCLAMPED_FLOAT_TO_UBYTE(UB, F) \ do { \ fi_type __tmp; \ __tmp.f = (F); \ if (__tmp.i < 0) \ UB = (GLubyte) 0; \ else if (__tmp.i >= IEEE_0996) \ UB = (GLubyte) 255; \ else { \ __tmp.f = __tmp.f * (255.0F/256.0F) + 32768.0F; \ UB = (GLubyte) __tmp.i; \ } \ } while (0) #define CLAMPED_FLOAT_TO_UBYTE(UB, F) \ do { \ fi_type __tmp; \ __tmp.f = (F) * (255.0F/256.0F) + 32768.0F; \ UB = (GLubyte) __tmp.i; \ } while (0) #else #define UNCLAMPED_FLOAT_TO_UBYTE(ub, f) \ ub = ((GLubyte) IROUND(CLAMP((f), 0.0F, 1.0F) * 255.0F)) #define CLAMPED_FLOAT_TO_UBYTE(ub, f) \ ub = ((GLubyte) IROUND((f) * 255.0F)) #endif /*** *** COPY_FLOAT: copy a float from src to dest. ***/ #define COPY_FLOAT( dst, src ) (dst) = (src) /*** *** START_FAST_MATH: Set x86 FPU to faster, 32-bit precision mode (and save *** original mode to a temporary). *** END_FAST_MATH: Restore x86 FPU to original mode. ***/ #if defined(__GNUC__) && defined(__i386__) /* * Set the x86 FPU control word to guarentee only 32 bits of precision * are stored in registers. Allowing the FPU to store more introduces * differences between situations where numbers are pulled out of memory * vs. situations where the compiler is able to optimize register usage. * * In the worst case, we force the compiler to use a memory access to * truncate the float, by specifying the 'volatile' keyword. */ /* Hardware default: All exceptions masked, extended double precision, * round to nearest (IEEE compliant): */ #define DEFAULT_X86_FPU 0x037f /* All exceptions masked, single precision, round to nearest: */ #define FAST_X86_FPU 0x003f /* The fldcw instruction will cause any pending FP exceptions to be * raised prior to entering the block, and we clear any pending * exceptions before exiting the block. Hence, asm code has free * reign over the FPU while in the fast math block. */ #if defined(NO_FAST_MATH) #define START_FAST_MATH(x) \ do { \ static GLuint mask = DEFAULT_X86_FPU; \ __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \ __asm__ ( "fldcw %0" : : "m" (mask) ); \ } while (0) #else #define START_FAST_MATH(x) \ do { \ static GLuint mask = FAST_X86_FPU; \ __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \ __asm__ ( "fldcw %0" : : "m" (mask) ); \ } while (0) #endif /* Restore original FPU mode, and clear any exceptions that may have * occurred in the FAST_MATH block. */ #define END_FAST_MATH(x) \ do { \ __asm__ ( "fnclex ; fldcw %0" : : "m" (*&(x)) ); \ } while (0) #elif defined(__WATCOMC__) && defined(__386__) #define DEFAULT_X86_FPU 0x037f /* See GCC comments above */ #define FAST_X86_FPU 0x003f /* See GCC comments above */ void _watcom_start_fast_math(unsigned short *x,unsigned short *mask); #pragma aux _watcom_start_fast_math = \ "fnstcw word ptr [eax]" \ "fldcw word ptr [ecx]" \ parm [eax] [ecx] \ modify exact []; void _watcom_end_fast_math(unsigned short *x); #pragma aux _watcom_end_fast_math = \ "fnclex" \ "fldcw word ptr [eax]" \ parm [eax] \ modify exact []; #if defined(NO_FAST_MATH) #define START_FAST_MATH(x) \ do { \ static GLushort mask = DEFAULT_X86_FPU; \ _watcom_start_fast_math(&x,&mask); \ } while (0) #else #define START_FAST_MATH(x) \ do { \ static GLushort mask = FAST_X86_FPU; \ _watcom_start_fast_math(&x,&mask); \ } while (0) #endif #define END_FAST_MATH(x) _watcom_end_fast_math(&x) #else #define START_FAST_MATH(x) x = 0 #define END_FAST_MATH(x) (void)(x) #endif /********************************************************************** * Functions */ extern void * _mesa_malloc( size_t bytes ); extern void * _mesa_calloc( size_t bytes ); extern void _mesa_free( void *ptr ); extern void * _mesa_align_malloc( size_t bytes, unsigned long alignment ); extern void * _mesa_align_calloc( size_t bytes, unsigned long alignment ); extern void _mesa_align_free( void *ptr ); extern void * _mesa_exec_malloc( GLuint size ); extern void _mesa_exec_free( void *addr ); extern void * _mesa_realloc( void *oldBuffer, size_t oldSize, size_t newSize ); extern void * _mesa_memcpy( void *dest, const void *src, size_t n ); extern void _mesa_memset( void *dst, int val, size_t n ); extern void _mesa_memset16( unsigned short *dst, unsigned short val, size_t n ); extern void _mesa_bzero( void *dst, size_t n ); extern double _mesa_sin(double a); extern double _mesa_cos(double a); extern double _mesa_sqrtd(double x); extern float _mesa_sqrtf(float x); extern float _mesa_inv_sqrtf(float x); extern double _mesa_pow(double x, double y); extern float _mesa_log2(float x); extern unsigned int _mesa_bitcount(unsigned int n); extern GLhalfARB _mesa_float_to_half(float f); extern float _mesa_half_to_float(GLhalfARB h); extern char * _mesa_getenv( const char *var ); extern char * _mesa_strstr( const char *haystack, const char *needle ); extern char * _mesa_strncat( char *dest, const char *src, size_t n ); extern char * _mesa_strcpy( char *dest, const char *src ); extern char * _mesa_strncpy( char *dest, const char *src, size_t n ); extern size_t _mesa_strlen( const char *s ); extern int _mesa_strcmp( const char *s1, const char *s2 ); extern int _mesa_strncmp( const char *s1, const char *s2, size_t n ); extern char * _mesa_strdup( const char *s ); extern int _mesa_atoi( const char *s ); extern double _mesa_strtod( const char *s, char **end ); extern int _mesa_sprintf( char *str, const char *fmt, ... ); extern void _mesa_printf( const char *fmtString, ... ); extern void _mesa_warning( __GLcontext *gc, const char *fmtString, ... ); extern void _mesa_problem( const __GLcontext *ctx, const char *fmtString, ... ); extern void _mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ); extern void _mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ); extern void _mesa_init_default_imports( __GLimports *imports, void *driverCtx ); #ifdef __cplusplus } #endif #endif /* IMPORTS_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/KNOWN_BUGS0000644000000000000000000000106713614532424017604 0ustar Performance issues with EXT_point_parameters & quake2 Using glPolygonMode() where the front and back modes aren't the same causes poor performance on 3Dfx. Broken drivers: some of the Mesa device drivers (such as BeOS, D3D, etc) haven't been updated for Mesa 3.3's device driver changes. glDrawRangeElements() should use vertex array locking to improve performance but trying to do so causes a rendering error. Reported by Scott McMillan. Fixed by disabling locking in glDrawRangeElements (varray.c) but that's really just hiding a bug in array locking. nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/light.c0000644000000000000000000011170313614532424017417 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "imports.h" #include "context.h" #include "enums.h" #include "light.h" #include "macros.h" #include "simple_list.h" #include "mtypes.h" #include "math/m_matrix.h" void GLAPIENTRY _mesa_ShadeModel( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode)); if (mode != GL_FLAT && mode != GL_SMOOTH) { _mesa_error( ctx, GL_INVALID_ENUM, "glShadeModel" ); return; } if (ctx->Light.ShadeModel == mode) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); ctx->Light.ShadeModel = mode; ctx->_TriangleCaps ^= DD_FLATSHADE; if (ctx->Driver.ShadeModel) (*ctx->Driver.ShadeModel)( ctx, mode ); } void GLAPIENTRY _mesa_Lightf( GLenum light, GLenum pname, GLfloat param ) { _mesa_Lightfv( light, pname, ¶m ); } void GLAPIENTRY _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); GLint i = (GLint) (light - GL_LIGHT0); struct gl_light *l = &ctx->Light.Light[i]; if (i < 0 || i >= (GLint) ctx->Const.MaxLights) { _mesa_error( ctx, GL_INVALID_ENUM, "glLight(light=0x%x)", light ); return; } switch (pname) { case GL_AMBIENT: if (TEST_EQ_4V(l->Ambient, params)) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); COPY_4V( l->Ambient, params ); break; case GL_DIFFUSE: if (TEST_EQ_4V(l->Diffuse, params)) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); COPY_4V( l->Diffuse, params ); break; case GL_SPECULAR: if (TEST_EQ_4V(l->Specular, params)) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); COPY_4V( l->Specular, params ); break; case GL_POSITION: { GLfloat tmp[4]; /* transform position by ModelView matrix */ TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->m, params ); if (TEST_EQ_4V(l->EyePosition, tmp)) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); COPY_4V(l->EyePosition, tmp); if (l->EyePosition[3] != 0.0F) l->_Flags |= LIGHT_POSITIONAL; else l->_Flags &= ~LIGHT_POSITIONAL; break; } case GL_SPOT_DIRECTION: { GLfloat tmp[4]; /* transform direction by inverse modelview */ if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); } TRANSFORM_NORMAL( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); if (TEST_EQ_3V(l->EyeDirection, tmp)) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); COPY_3V(l->EyeDirection, tmp); break; } case GL_SPOT_EXPONENT: if (params[0]<0.0 || params[0]>ctx->Const.MaxSpotExponent) { _mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); return; } if (l->SpotExponent == params[0]) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); l->SpotExponent = params[0]; _mesa_invalidate_spot_exp_table( l ); break; case GL_SPOT_CUTOFF: if ((params[0]<0.0 || params[0]>90.0) && params[0]!=180.0) { _mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); return; } if (l->SpotCutoff == params[0]) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); l->SpotCutoff = params[0]; l->_CosCutoff = (GLfloat) _mesa_cos(params[0]*DEG2RAD); if (l->_CosCutoff < 0) l->_CosCutoff = 0; if (l->SpotCutoff != 180.0F) l->_Flags |= LIGHT_SPOT; else l->_Flags &= ~LIGHT_SPOT; break; case GL_CONSTANT_ATTENUATION: if (params[0]<0.0) { _mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); return; } if (l->ConstantAttenuation == params[0]) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); l->ConstantAttenuation = params[0]; break; case GL_LINEAR_ATTENUATION: if (params[0]<0.0) { _mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); return; } if (l->LinearAttenuation == params[0]) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); l->LinearAttenuation = params[0]; break; case GL_QUADRATIC_ATTENUATION: if (params[0]<0.0) { _mesa_error( ctx, GL_INVALID_VALUE, "glLight" ); return; } if (l->QuadraticAttenuation == params[0]) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); l->QuadraticAttenuation = params[0]; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glLight(pname=0x%x)", pname ); return; } if (ctx->Driver.Lightfv) ctx->Driver.Lightfv( ctx, light, pname, params ); } void GLAPIENTRY _mesa_Lighti( GLenum light, GLenum pname, GLint param ) { _mesa_Lightiv( light, pname, ¶m ); } void GLAPIENTRY _mesa_Lightiv( GLenum light, GLenum pname, const GLint *params ) { GLfloat fparam[4]; switch (pname) { case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: fparam[0] = INT_TO_FLOAT( params[0] ); fparam[1] = INT_TO_FLOAT( params[1] ); fparam[2] = INT_TO_FLOAT( params[2] ); fparam[3] = INT_TO_FLOAT( params[3] ); break; case GL_POSITION: fparam[0] = (GLfloat) params[0]; fparam[1] = (GLfloat) params[1]; fparam[2] = (GLfloat) params[2]; fparam[3] = (GLfloat) params[3]; break; case GL_SPOT_DIRECTION: fparam[0] = (GLfloat) params[0]; fparam[1] = (GLfloat) params[1]; fparam[2] = (GLfloat) params[2]; break; case GL_SPOT_EXPONENT: case GL_SPOT_CUTOFF: case GL_CONSTANT_ATTENUATION: case GL_LINEAR_ATTENUATION: case GL_QUADRATIC_ATTENUATION: fparam[0] = (GLfloat) params[0]; break; default: /* error will be caught later in gl_Lightfv */ ; } _mesa_Lightfv( light, pname, fparam ); } void GLAPIENTRY _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); GLint l = (GLint) (light - GL_LIGHT0); ASSERT_OUTSIDE_BEGIN_END(ctx); if (l < 0 || l >= (GLint) ctx->Const.MaxLights) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetLightfv" ); return; } switch (pname) { case GL_AMBIENT: COPY_4V( params, ctx->Light.Light[l].Ambient ); break; case GL_DIFFUSE: COPY_4V( params, ctx->Light.Light[l].Diffuse ); break; case GL_SPECULAR: COPY_4V( params, ctx->Light.Light[l].Specular ); break; case GL_POSITION: COPY_4V( params, ctx->Light.Light[l].EyePosition ); break; case GL_SPOT_DIRECTION: COPY_3V( params, ctx->Light.Light[l].EyeDirection ); break; case GL_SPOT_EXPONENT: params[0] = ctx->Light.Light[l].SpotExponent; break; case GL_SPOT_CUTOFF: params[0] = ctx->Light.Light[l].SpotCutoff; break; case GL_CONSTANT_ATTENUATION: params[0] = ctx->Light.Light[l].ConstantAttenuation; break; case GL_LINEAR_ATTENUATION: params[0] = ctx->Light.Light[l].LinearAttenuation; break; case GL_QUADRATIC_ATTENUATION: params[0] = ctx->Light.Light[l].QuadraticAttenuation; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetLightfv" ); break; } } void GLAPIENTRY _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); GLint l = (GLint) (light - GL_LIGHT0); ASSERT_OUTSIDE_BEGIN_END(ctx); if (l < 0 || l >= (GLint) ctx->Const.MaxLights) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetLightiv" ); return; } switch (pname) { case GL_AMBIENT: params[0] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[0]); params[1] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[1]); params[2] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[2]); params[3] = FLOAT_TO_INT(ctx->Light.Light[l].Ambient[3]); break; case GL_DIFFUSE: params[0] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[0]); params[1] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[1]); params[2] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[2]); params[3] = FLOAT_TO_INT(ctx->Light.Light[l].Diffuse[3]); break; case GL_SPECULAR: params[0] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[0]); params[1] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[1]); params[2] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[2]); params[3] = FLOAT_TO_INT(ctx->Light.Light[l].Specular[3]); break; case GL_POSITION: params[0] = (GLint) ctx->Light.Light[l].EyePosition[0]; params[1] = (GLint) ctx->Light.Light[l].EyePosition[1]; params[2] = (GLint) ctx->Light.Light[l].EyePosition[2]; params[3] = (GLint) ctx->Light.Light[l].EyePosition[3]; break; case GL_SPOT_DIRECTION: params[0] = (GLint) ctx->Light.Light[l].EyeDirection[0]; params[1] = (GLint) ctx->Light.Light[l].EyeDirection[1]; params[2] = (GLint) ctx->Light.Light[l].EyeDirection[2]; break; case GL_SPOT_EXPONENT: params[0] = (GLint) ctx->Light.Light[l].SpotExponent; break; case GL_SPOT_CUTOFF: params[0] = (GLint) ctx->Light.Light[l].SpotCutoff; break; case GL_CONSTANT_ATTENUATION: params[0] = (GLint) ctx->Light.Light[l].ConstantAttenuation; break; case GL_LINEAR_ATTENUATION: params[0] = (GLint) ctx->Light.Light[l].LinearAttenuation; break; case GL_QUADRATIC_ATTENUATION: params[0] = (GLint) ctx->Light.Light[l].QuadraticAttenuation; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetLightiv" ); break; } } /**********************************************************************/ /*** Light Model ***/ /**********************************************************************/ void GLAPIENTRY _mesa_LightModelfv( GLenum pname, const GLfloat *params ) { GLenum newenum; GLboolean newbool; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { case GL_LIGHT_MODEL_AMBIENT: if (TEST_EQ_4V( ctx->Light.Model.Ambient, params )) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); COPY_4V( ctx->Light.Model.Ambient, params ); break; case GL_LIGHT_MODEL_LOCAL_VIEWER: newbool = (params[0]!=0.0); if (ctx->Light.Model.LocalViewer == newbool) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); ctx->Light.Model.LocalViewer = newbool; break; case GL_LIGHT_MODEL_TWO_SIDE: newbool = (params[0]!=0.0); if (ctx->Light.Model.TwoSide == newbool) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); ctx->Light.Model.TwoSide = newbool; if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE; else ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE; break; case GL_LIGHT_MODEL_COLOR_CONTROL: if (params[0] == (GLfloat) GL_SINGLE_COLOR) newenum = GL_SINGLE_COLOR; else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR) newenum = GL_SEPARATE_SPECULAR_COLOR; else { _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(param=0x0%x)", (GLint) params[0] ); return; } if (ctx->Light.Model.ColorControl == newenum) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); ctx->Light.Model.ColorControl = newenum; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(pname=0x%x)", pname ); break; } if (ctx->Driver.LightModelfv) ctx->Driver.LightModelfv( ctx, pname, params ); } void GLAPIENTRY _mesa_LightModeliv( GLenum pname, const GLint *params ) { GLfloat fparam[4]; switch (pname) { case GL_LIGHT_MODEL_AMBIENT: fparam[0] = INT_TO_FLOAT( params[0] ); fparam[1] = INT_TO_FLOAT( params[1] ); fparam[2] = INT_TO_FLOAT( params[2] ); fparam[3] = INT_TO_FLOAT( params[3] ); break; case GL_LIGHT_MODEL_LOCAL_VIEWER: case GL_LIGHT_MODEL_TWO_SIDE: case GL_LIGHT_MODEL_COLOR_CONTROL: fparam[0] = (GLfloat) params[0]; break; default: /* Error will be caught later in gl_LightModelfv */ ; } _mesa_LightModelfv( pname, fparam ); } void GLAPIENTRY _mesa_LightModeli( GLenum pname, GLint param ) { _mesa_LightModeliv( pname, ¶m ); } void GLAPIENTRY _mesa_LightModelf( GLenum pname, GLfloat param ) { _mesa_LightModelfv( pname, ¶m ); } /********** MATERIAL **********/ /* * Given a face and pname value (ala glColorMaterial), compute a bitmask * of the targeted material values. */ GLuint _mesa_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname, GLuint legal, const char *where ) { GLuint bitmask = 0; /* Make a bitmask indicating what material attribute(s) we're updating */ switch (pname) { case GL_EMISSION: bitmask |= MAT_BIT_FRONT_EMISSION | MAT_BIT_BACK_EMISSION; break; case GL_AMBIENT: bitmask |= MAT_BIT_FRONT_AMBIENT | MAT_BIT_BACK_AMBIENT; break; case GL_DIFFUSE: bitmask |= MAT_BIT_FRONT_DIFFUSE | MAT_BIT_BACK_DIFFUSE; break; case GL_SPECULAR: bitmask |= MAT_BIT_FRONT_SPECULAR | MAT_BIT_BACK_SPECULAR; break; case GL_SHININESS: bitmask |= MAT_BIT_FRONT_SHININESS | MAT_BIT_BACK_SHININESS; break; case GL_AMBIENT_AND_DIFFUSE: bitmask |= MAT_BIT_FRONT_AMBIENT | MAT_BIT_BACK_AMBIENT; bitmask |= MAT_BIT_FRONT_DIFFUSE | MAT_BIT_BACK_DIFFUSE; break; case GL_COLOR_INDEXES: bitmask |= MAT_BIT_FRONT_INDEXES | MAT_BIT_BACK_INDEXES; break; default: _mesa_error( ctx, GL_INVALID_ENUM, where ); return 0; } if (face==GL_FRONT) { bitmask &= FRONT_MATERIAL_BITS; } else if (face==GL_BACK) { bitmask &= BACK_MATERIAL_BITS; } else if (face != GL_FRONT_AND_BACK) { _mesa_error( ctx, GL_INVALID_ENUM, where ); return 0; } if (bitmask & ~legal) { _mesa_error( ctx, GL_INVALID_ENUM, where ); return 0; } return bitmask; } /* Perform a straight copy between materials. */ void _mesa_copy_materials( struct gl_material *dst, const struct gl_material *src, GLuint bitmask ) { int i; for (i = 0 ; i < MAT_ATTRIB_MAX ; i++) if (bitmask & (1<Attrib[i], src->Attrib[i] ); } /* Update derived values following a change in ctx->Light.Material */ void _mesa_update_material( GLcontext *ctx, GLuint bitmask ) { struct gl_light *light, *list = &ctx->Light.EnabledList; GLfloat (*mat)[4] = ctx->Light.Material.Attrib; if (MESA_VERBOSE&VERBOSE_IMMEDIATE) _mesa_debug(ctx, "_mesa_update_material, mask 0x%x\n", bitmask); if (!bitmask) return; /* update material ambience */ if (bitmask & MAT_BIT_FRONT_AMBIENT) { foreach (light, list) { SCALE_3V( light->_MatAmbient[0], light->Ambient, mat[MAT_ATTRIB_FRONT_AMBIENT]); } } if (bitmask & MAT_BIT_BACK_AMBIENT) { foreach (light, list) { SCALE_3V( light->_MatAmbient[1], light->Ambient, mat[MAT_ATTRIB_BACK_AMBIENT]); } } /* update BaseColor = emission + scene's ambience * material's ambience */ if (bitmask & (MAT_BIT_FRONT_EMISSION | MAT_BIT_FRONT_AMBIENT)) { COPY_3V( ctx->Light._BaseColor[0], mat[MAT_ATTRIB_FRONT_EMISSION] ); ACC_SCALE_3V( ctx->Light._BaseColor[0], mat[MAT_ATTRIB_FRONT_AMBIENT], ctx->Light.Model.Ambient ); } if (bitmask & (MAT_BIT_BACK_EMISSION | MAT_BIT_BACK_AMBIENT)) { COPY_3V( ctx->Light._BaseColor[1], mat[MAT_ATTRIB_BACK_EMISSION] ); ACC_SCALE_3V( ctx->Light._BaseColor[1], mat[MAT_ATTRIB_BACK_AMBIENT], ctx->Light.Model.Ambient ); } /* update material diffuse values */ if (bitmask & MAT_BIT_FRONT_DIFFUSE) { foreach (light, list) { SCALE_3V( light->_MatDiffuse[0], light->Diffuse, mat[MAT_ATTRIB_FRONT_DIFFUSE] ); } } if (bitmask & MAT_BIT_BACK_DIFFUSE) { foreach (light, list) { SCALE_3V( light->_MatDiffuse[1], light->Diffuse, mat[MAT_ATTRIB_BACK_DIFFUSE] ); } } /* update material specular values */ if (bitmask & MAT_BIT_FRONT_SPECULAR) { foreach (light, list) { SCALE_3V( light->_MatSpecular[0], light->Specular, mat[MAT_ATTRIB_FRONT_SPECULAR]); } } if (bitmask & MAT_BIT_BACK_SPECULAR) { foreach (light, list) { SCALE_3V( light->_MatSpecular[1], light->Specular, mat[MAT_ATTRIB_BACK_SPECULAR]); } } if (bitmask & MAT_BIT_FRONT_SHININESS) { _mesa_invalidate_shine_table( ctx, 0 ); } if (bitmask & MAT_BIT_BACK_SHININESS) { _mesa_invalidate_shine_table( ctx, 1 ); } } /* * Update the current materials from the given rgba color * according to the bitmask in ColorMaterialBitmask, which is * set by glColorMaterial(). */ void _mesa_update_color_material( GLcontext *ctx, const GLfloat color[4] ) { GLuint bitmask = ctx->Light.ColorMaterialBitmask; struct gl_material *mat = &ctx->Light.Material; int i; for (i = 0 ; i < MAT_ATTRIB_MAX ; i++) if (bitmask & (1<Attrib[i], color ); _mesa_update_material( ctx, bitmask ); } void GLAPIENTRY _mesa_ColorMaterial( GLenum face, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); GLuint bitmask; GLuint legal = (MAT_BIT_FRONT_EMISSION | MAT_BIT_BACK_EMISSION | MAT_BIT_FRONT_SPECULAR | MAT_BIT_BACK_SPECULAR | MAT_BIT_FRONT_DIFFUSE | MAT_BIT_BACK_DIFFUSE | MAT_BIT_FRONT_AMBIENT | MAT_BIT_BACK_AMBIENT); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glColorMaterial %s %s\n", _mesa_lookup_enum_by_nr(face), _mesa_lookup_enum_by_nr(mode)); bitmask = _mesa_material_bitmask(ctx, face, mode, legal, "glColorMaterial"); if (ctx->Light.ColorMaterialBitmask == bitmask && ctx->Light.ColorMaterialFace == face && ctx->Light.ColorMaterialMode == mode) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); ctx->Light.ColorMaterialBitmask = bitmask; ctx->Light.ColorMaterialFace = face; ctx->Light.ColorMaterialMode = mode; if (ctx->Light.ColorMaterialEnabled) { FLUSH_CURRENT( ctx, 0 ); _mesa_update_color_material(ctx,ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); } if (ctx->Driver.ColorMaterial) (*ctx->Driver.ColorMaterial)( ctx, face, mode ); } void GLAPIENTRY _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); GLuint f; GLfloat (*mat)[4] = ctx->Light.Material.Attrib; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */ FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */ if (face==GL_FRONT) { f = 0; } else if (face==GL_BACK) { f = 1; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(face)" ); return; } switch (pname) { case GL_AMBIENT: COPY_4FV( params, mat[MAT_ATTRIB_AMBIENT(f)] ); break; case GL_DIFFUSE: COPY_4FV( params, mat[MAT_ATTRIB_DIFFUSE(f)] ); break; case GL_SPECULAR: COPY_4FV( params, mat[MAT_ATTRIB_SPECULAR(f)] ); break; case GL_EMISSION: COPY_4FV( params, mat[MAT_ATTRIB_EMISSION(f)] ); break; case GL_SHININESS: *params = mat[MAT_ATTRIB_SHININESS(f)][0]; break; case GL_COLOR_INDEXES: params[0] = mat[MAT_ATTRIB_INDEXES(f)][0]; params[1] = mat[MAT_ATTRIB_INDEXES(f)][1]; params[2] = mat[MAT_ATTRIB_INDEXES(f)][2]; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(pname)" ); } } void GLAPIENTRY _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); GLuint f; GLfloat (*mat)[4] = ctx->Light.Material.Attrib; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */ FLUSH_CURRENT(ctx, 0); /* update ctx->Light.Material from vertex buffer */ if (face==GL_FRONT) { f = 0; } else if (face==GL_BACK) { f = 1; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialiv(face)" ); return; } switch (pname) { case GL_AMBIENT: params[0] = FLOAT_TO_INT( mat[MAT_ATTRIB_AMBIENT(f)][0] ); params[1] = FLOAT_TO_INT( mat[MAT_ATTRIB_AMBIENT(f)][1] ); params[2] = FLOAT_TO_INT( mat[MAT_ATTRIB_AMBIENT(f)][2] ); params[3] = FLOAT_TO_INT( mat[MAT_ATTRIB_AMBIENT(f)][3] ); break; case GL_DIFFUSE: params[0] = FLOAT_TO_INT( mat[MAT_ATTRIB_DIFFUSE(f)][0] ); params[1] = FLOAT_TO_INT( mat[MAT_ATTRIB_DIFFUSE(f)][1] ); params[2] = FLOAT_TO_INT( mat[MAT_ATTRIB_DIFFUSE(f)][2] ); params[3] = FLOAT_TO_INT( mat[MAT_ATTRIB_DIFFUSE(f)][3] ); break; case GL_SPECULAR: params[0] = FLOAT_TO_INT( mat[MAT_ATTRIB_SPECULAR(f)][0] ); params[1] = FLOAT_TO_INT( mat[MAT_ATTRIB_SPECULAR(f)][1] ); params[2] = FLOAT_TO_INT( mat[MAT_ATTRIB_SPECULAR(f)][2] ); params[3] = FLOAT_TO_INT( mat[MAT_ATTRIB_SPECULAR(f)][3] ); break; case GL_EMISSION: params[0] = FLOAT_TO_INT( mat[MAT_ATTRIB_EMISSION(f)][0] ); params[1] = FLOAT_TO_INT( mat[MAT_ATTRIB_EMISSION(f)][1] ); params[2] = FLOAT_TO_INT( mat[MAT_ATTRIB_EMISSION(f)][2] ); params[3] = FLOAT_TO_INT( mat[MAT_ATTRIB_EMISSION(f)][3] ); break; case GL_SHININESS: *params = IROUND( mat[MAT_ATTRIB_SHININESS(f)][0] ); break; case GL_COLOR_INDEXES: params[0] = IROUND( mat[MAT_ATTRIB_INDEXES(f)][0] ); params[1] = IROUND( mat[MAT_ATTRIB_INDEXES(f)][1] ); params[2] = IROUND( mat[MAT_ATTRIB_INDEXES(f)][2] ); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetMaterialfv(pname)" ); } } /**********************************************************************/ /***** Lighting computation *****/ /**********************************************************************/ /* * Notes: * When two-sided lighting is enabled we compute the color (or index) * for both the front and back side of the primitive. Then, when the * orientation of the facet is later learned, we can determine which * color (or index) to use for rendering. * * KW: We now know orientation in advance and only shade for * the side or sides which are actually required. * * Variables: * n = normal vector * V = vertex position * P = light source position * Pe = (0,0,0,1) * * Precomputed: * IF P[3]==0 THEN * // light at infinity * IF local_viewer THEN * _VP_inf_norm = unit vector from V to P // Precompute * ELSE * // eye at infinity * _h_inf_norm = Normalize( VP + <0,0,1> ) // Precompute * ENDIF * ENDIF * * Functions: * Normalize( v ) = normalized vector v * Magnitude( v ) = length of vector v */ /* * Whenever the spotlight exponent for a light changes we must call * this function to recompute the exponent lookup table. */ void _mesa_invalidate_spot_exp_table( struct gl_light *l ) { l->_SpotExpTable[0][0] = -1; } static void validate_spot_exp_table( struct gl_light *l ) { GLint i; GLdouble exponent = l->SpotExponent; GLdouble tmp = 0; GLint clamp = 0; l->_SpotExpTable[0][0] = 0.0; for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) { if (clamp == 0) { tmp = _mesa_pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent); if (tmp < FLT_MIN * 100.0) { tmp = 0.0; clamp = 1; } } l->_SpotExpTable[i][0] = (GLfloat) tmp; } for (i = 0; i < EXP_TABLE_SIZE - 1; i++) { l->_SpotExpTable[i][1] = (l->_SpotExpTable[i+1][0] - l->_SpotExpTable[i][0]); } l->_SpotExpTable[EXP_TABLE_SIZE-1][1] = 0.0; } /* Calculate a new shine table. Doing this here saves a branch in * lighting, and the cost of doing it early may be partially offset * by keeping a MRU cache of shine tables for various shine values. */ void _mesa_invalidate_shine_table( GLcontext *ctx, GLuint side ) { ASSERT(side < 2); if (ctx->_ShineTable[side]) ctx->_ShineTable[side]->refcount--; ctx->_ShineTable[side] = NULL; } static void validate_shine_table( GLcontext *ctx, GLuint side, GLfloat shininess ) { struct gl_shine_tab *list = ctx->_ShineTabList; struct gl_shine_tab *s; ASSERT(side < 2); foreach(s, list) if ( s->shininess == shininess ) break; if (s == list) { GLint j; GLfloat *m; foreach(s, list) if (s->refcount == 0) break; m = s->tab; m[0] = 0.0; if (shininess == 0.0) { for (j = 1 ; j <= SHINE_TABLE_SIZE ; j++) m[j] = 1.0; } else { for (j = 1 ; j < SHINE_TABLE_SIZE ; j++) { GLdouble t, x = j / (GLfloat) (SHINE_TABLE_SIZE - 1); if (x < 0.005) /* underflow check */ x = 0.005; t = _mesa_pow(x, shininess); if (t > 1e-20) m[j] = (GLfloat) t; else m[j] = 0.0; } m[SHINE_TABLE_SIZE] = 1.0; } s->shininess = shininess; } if (ctx->_ShineTable[side]) ctx->_ShineTable[side]->refcount--; ctx->_ShineTable[side] = s; move_to_tail( list, s ); s->refcount++; } void _mesa_validate_all_lighting_tables( GLcontext *ctx ) { GLuint i; GLfloat shininess; shininess = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS][0]; if (!ctx->_ShineTable[0] || ctx->_ShineTable[0]->shininess != shininess) validate_shine_table( ctx, 0, shininess ); shininess = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_SHININESS][0]; if (!ctx->_ShineTable[1] || ctx->_ShineTable[1]->shininess != shininess) validate_shine_table( ctx, 1, shininess ); for (i = 0 ; i < MAX_LIGHTS ; i++) if (ctx->Light.Light[i]._SpotExpTable[0][0] == -1) validate_spot_exp_table( &ctx->Light.Light[i] ); } /* * Examine current lighting parameters to determine if the optimized lighting * function can be used. * Also, precompute some lighting values such as the products of light * source and material ambient, diffuse and specular coefficients. */ void _mesa_update_lighting( GLcontext *ctx ) { struct gl_light *light; ctx->Light._NeedEyeCoords = 0; ctx->Light._Flags = 0; if (!ctx->Light.Enabled) return; foreach(light, &ctx->Light.EnabledList) { ctx->Light._Flags |= light->_Flags; } ctx->Light._NeedVertices = ((ctx->Light._Flags & (LIGHT_POSITIONAL|LIGHT_SPOT)) || ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR || ctx->Light.Model.LocalViewer); ctx->Light._NeedEyeCoords = ((ctx->Light._Flags & LIGHT_POSITIONAL) || ctx->Light.Model.LocalViewer); /* XXX: This test is overkill & needs to be fixed both for software and * hardware t&l drivers. The above should be sufficient & should * be tested to verify this. */ if (ctx->Light._NeedVertices) ctx->Light._NeedEyeCoords = GL_TRUE; /* Precompute some shading values. Although we reference * Light.Material here, we can get away without flushing * FLUSH_UPDATE_CURRENT, as when any outstanding material changes * are flushed, they will update the derived state at that time. */ if (ctx->Visual.rgbMode) { if (ctx->Light.Model.TwoSide) _mesa_update_material( ctx, MAT_BIT_FRONT_EMISSION | MAT_BIT_FRONT_AMBIENT | MAT_BIT_FRONT_DIFFUSE | MAT_BIT_FRONT_SPECULAR | MAT_BIT_BACK_EMISSION | MAT_BIT_BACK_AMBIENT | MAT_BIT_BACK_DIFFUSE | MAT_BIT_BACK_SPECULAR); else _mesa_update_material( ctx, MAT_BIT_FRONT_EMISSION | MAT_BIT_FRONT_AMBIENT | MAT_BIT_FRONT_DIFFUSE | MAT_BIT_FRONT_SPECULAR); } else { static const GLfloat ci[3] = { .30F, .59F, .11F }; foreach(light, &ctx->Light.EnabledList) { light->_dli = DOT3(ci, light->Diffuse); light->_sli = DOT3(ci, light->Specular); } } } /* _NEW_MODELVIEW * _NEW_LIGHT * _TNL_NEW_NEED_EYE_COORDS * * Update on (_NEW_MODELVIEW | _NEW_LIGHT) when lighting is enabled. * Also update on lighting space changes. */ static void compute_light_positions( GLcontext *ctx ) { struct gl_light *light; static const GLfloat eye_z[3] = { 0, 0, 1 }; if (!ctx->Light.Enabled) return; if (ctx->_NeedEyeCoords) { COPY_3V( ctx->_EyeZDir, eye_z ); } else { TRANSFORM_NORMAL( ctx->_EyeZDir, eye_z, ctx->ModelviewMatrixStack.Top->m ); } foreach (light, &ctx->Light.EnabledList) { if (ctx->_NeedEyeCoords) { COPY_4FV( light->_Position, light->EyePosition ); } else { TRANSFORM_POINT( light->_Position, ctx->ModelviewMatrixStack.Top->inv, light->EyePosition ); } if (!(light->_Flags & LIGHT_POSITIONAL)) { /* VP (VP) = Normalize( Position ) */ COPY_3V( light->_VP_inf_norm, light->_Position ); NORMALIZE_3FV( light->_VP_inf_norm ); if (!ctx->Light.Model.LocalViewer) { /* _h_inf_norm = Normalize( V_to_P + <0,0,1> ) */ ADD_3V( light->_h_inf_norm, light->_VP_inf_norm, ctx->_EyeZDir); NORMALIZE_3FV( light->_h_inf_norm ); } light->_VP_inf_spot_attenuation = 1.0; } if (light->_Flags & LIGHT_SPOT) { if (ctx->_NeedEyeCoords) { COPY_3V( light->_NormDirection, light->EyeDirection ); } else { TRANSFORM_NORMAL( light->_NormDirection, light->EyeDirection, ctx->ModelviewMatrixStack.Top->m); } NORMALIZE_3FV( light->_NormDirection ); if (!(light->_Flags & LIGHT_POSITIONAL)) { GLfloat PV_dot_dir = - DOT3(light->_VP_inf_norm, light->_NormDirection); if (PV_dot_dir > light->_CosCutoff) { double x = PV_dot_dir * (EXP_TABLE_SIZE-1); int k = (int) x; light->_VP_inf_spot_attenuation = (GLfloat) (light->_SpotExpTable[k][0] + (x-k)*light->_SpotExpTable[k][1]); } else { light->_VP_inf_spot_attenuation = 0; } } } } } static void update_modelview_scale( GLcontext *ctx ) { ctx->_ModelViewInvScale = 1.0F; if (!_math_matrix_is_length_preserving(ctx->ModelviewMatrixStack.Top)) { const GLfloat *m = ctx->ModelviewMatrixStack.Top->inv; GLfloat f = m[2] * m[2] + m[6] * m[6] + m[10] * m[10]; if (f < 1e-12) f = 1.0; if (ctx->_NeedEyeCoords) ctx->_ModelViewInvScale = (GLfloat) INV_SQRTF(f); else ctx->_ModelViewInvScale = (GLfloat) SQRTF(f); } } /* Bring uptodate any state that relies on _NeedEyeCoords. */ void _mesa_update_tnl_spaces( GLcontext *ctx, GLuint new_state ) { const GLuint oldneedeyecoords = ctx->_NeedEyeCoords; (void) new_state; ctx->_NeedEyeCoords = 0; if (ctx->_ForceEyeCoords || (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) || ctx->Point._Attenuated || ctx->Light._NeedEyeCoords) ctx->_NeedEyeCoords = 1; if (ctx->Light.Enabled && !_math_matrix_is_length_preserving(ctx->ModelviewMatrixStack.Top)) ctx->_NeedEyeCoords = 1; /* Check if the truth-value interpretations of the bitfields have * changed: */ if (oldneedeyecoords != ctx->_NeedEyeCoords) { /* Recalculate all state that depends on _NeedEyeCoords. */ update_modelview_scale(ctx); compute_light_positions( ctx ); if (ctx->Driver.LightingSpaceChange) ctx->Driver.LightingSpaceChange( ctx ); } else { GLuint new_state = ctx->NewState; /* Recalculate that same state only if it has been invalidated * by other statechanges. */ if (new_state & _NEW_MODELVIEW) update_modelview_scale(ctx); if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW)) compute_light_positions( ctx ); } } /* Drivers may need this if the hardware tnl unit doesn't support the * light-in-modelspace optimization. It's also useful for debugging. */ void _mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag ) { ctx->_ForceEyeCoords = !flag; ctx->NewState |= _NEW_POINT; /* one of the bits from * _MESA_NEW_NEED_EYE_COORDS. */ } /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ /** * Initialize the n-th light data structure. * * \param l pointer to the gl_light structure to be initialized. * \param n number of the light. * \note The defaults for light 0 are different than the other lights. */ static void init_light( struct gl_light *l, GLuint n ) { make_empty_list( l ); ASSIGN_4V( l->Ambient, 0.0, 0.0, 0.0, 1.0 ); if (n==0) { ASSIGN_4V( l->Diffuse, 1.0, 1.0, 1.0, 1.0 ); ASSIGN_4V( l->Specular, 1.0, 1.0, 1.0, 1.0 ); } else { ASSIGN_4V( l->Diffuse, 0.0, 0.0, 0.0, 1.0 ); ASSIGN_4V( l->Specular, 0.0, 0.0, 0.0, 1.0 ); } ASSIGN_4V( l->EyePosition, 0.0, 0.0, 1.0, 0.0 ); ASSIGN_3V( l->EyeDirection, 0.0, 0.0, -1.0 ); l->SpotExponent = 0.0; _mesa_invalidate_spot_exp_table( l ); l->SpotCutoff = 180.0; l->_CosCutoff = 0.0; /* KW: -ve values not admitted */ l->ConstantAttenuation = 1.0; l->LinearAttenuation = 0.0; l->QuadraticAttenuation = 0.0; l->Enabled = GL_FALSE; } /** * Initialize the light model data structure. * * \param lm pointer to the gl_lightmodel structure to be initialized. */ static void init_lightmodel( struct gl_lightmodel *lm ) { ASSIGN_4V( lm->Ambient, 0.2F, 0.2F, 0.2F, 1.0F ); lm->LocalViewer = GL_FALSE; lm->TwoSide = GL_FALSE; lm->ColorControl = GL_SINGLE_COLOR; } /** * Initialize the material data structure. * * \param m pointer to the gl_material structure to be initialized. */ static void init_material( struct gl_material *m ) { ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_AMBIENT], 0.2F, 0.2F, 0.2F, 1.0F ); ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_DIFFUSE], 0.8F, 0.8F, 0.8F, 1.0F ); ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_SPECULAR], 0.0F, 0.0F, 0.0F, 1.0F ); ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_EMISSION], 0.0F, 0.0F, 0.0F, 1.0F ); ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_SHININESS], 0.0F, 0.0F, 0.0F, 0.0F ); ASSIGN_4V( m->Attrib[MAT_ATTRIB_FRONT_INDEXES], 0.0F, 1.0F, 1.0F, 0.0F ); ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_AMBIENT], 0.2F, 0.2F, 0.2F, 1.0F ); ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_DIFFUSE], 0.8F, 0.8F, 0.8F, 1.0F ); ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_SPECULAR], 0.0F, 0.0F, 0.0F, 1.0F ); ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_EMISSION], 0.0F, 0.0F, 0.0F, 1.0F ); ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_SHININESS], 0.0F, 0.0F, 0.0F, 0.0F ); ASSIGN_4V( m->Attrib[MAT_ATTRIB_BACK_INDEXES], 0.0F, 1.0F, 1.0F, 0.0F ); } void _mesa_init_lighting( GLcontext *ctx ) { GLuint i; /* Lighting group */ for (i = 0; i < MAX_LIGHTS; i++) { init_light( &ctx->Light.Light[i], i ); } make_empty_list( &ctx->Light.EnabledList ); init_lightmodel( &ctx->Light.Model ); init_material( &ctx->Light.Material ); ctx->Light.ShadeModel = GL_SMOOTH; ctx->Light.Enabled = GL_FALSE; ctx->Light.ColorMaterialFace = GL_FRONT_AND_BACK; ctx->Light.ColorMaterialMode = GL_AMBIENT_AND_DIFFUSE; ctx->Light.ColorMaterialBitmask = _mesa_material_bitmask( ctx, GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, ~0, NULL ); ctx->Light.ColorMaterialEnabled = GL_FALSE; /* Lighting miscellaneous */ ctx->_ShineTabList = MALLOC_STRUCT( gl_shine_tab ); make_empty_list( ctx->_ShineTabList ); /* Allocate 10 (arbitrary) shininess lookup tables */ for (i = 0 ; i < 10 ; i++) { struct gl_shine_tab *s = MALLOC_STRUCT( gl_shine_tab ); s->shininess = -1; s->refcount = 0; insert_at_tail( ctx->_ShineTabList, s ); } /* Miscellaneous */ ctx->Light._NeedEyeCoords = 0; ctx->_NeedEyeCoords = 0; ctx->_ModelViewInvScale = 1.0; } void _mesa_free_lighting_data( GLcontext *ctx ) { struct gl_shine_tab *s, *tmps; /* Free lighting shininess exponentiation table */ foreach_s( s, tmps, ctx->_ShineTabList ) { FREE( s ); } FREE( ctx->_ShineTabList ); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/light.h0000644000000000000000000001101113614532424017413 0ustar /** * \file light.h * Lighting. */ /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef LIGHT_H #define LIGHT_H #include "mtypes.h" extern void GLAPIENTRY _mesa_ShadeModel( GLenum mode ); #if _HAVE_FULL_GL extern void GLAPIENTRY _mesa_ColorMaterial( GLenum face, GLenum mode ); extern void GLAPIENTRY _mesa_Lightf( GLenum light, GLenum pname, GLfloat param ); extern void GLAPIENTRY _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ); extern void GLAPIENTRY _mesa_Lightiv( GLenum light, GLenum pname, const GLint *params ); extern void GLAPIENTRY _mesa_Lighti( GLenum light, GLenum pname, GLint param ); extern void GLAPIENTRY _mesa_LightModelf( GLenum pname, GLfloat param ); extern void GLAPIENTRY _mesa_LightModelfv( GLenum pname, const GLfloat *params ); extern void GLAPIENTRY _mesa_LightModeli( GLenum pname, GLint param ); extern void GLAPIENTRY _mesa_LightModeliv( GLenum pname, const GLint *params ); extern void GLAPIENTRY _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params ); extern void GLAPIENTRY _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params ); extern void GLAPIENTRY _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ); extern void GLAPIENTRY _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ); /* Lerp between adjacent values in the f(x) lookup table, giving a * continuous function, with adequeate overall accuracy. (Though * still pretty good compared to a straight lookup). * Result should be a GLfloat. */ #define GET_SHINE_TAB_ENTRY( table, dp, result ) \ do { \ struct gl_shine_tab *_tab = table; \ float f = (dp * (SHINE_TABLE_SIZE-1)); \ int k = (int) f; \ if (k > SHINE_TABLE_SIZE-2) \ result = (GLfloat) _mesa_pow( dp, _tab->shininess ); \ else \ result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]); \ } while (0) extern GLuint _mesa_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname, GLuint legal, const char * ); extern void _mesa_invalidate_spot_exp_table( struct gl_light *l ); extern void _mesa_invalidate_shine_table( GLcontext *ctx, GLuint i ); extern void _mesa_validate_all_lighting_tables( GLcontext *ctx ); extern void _mesa_update_lighting( GLcontext *ctx ); extern void _mesa_update_tnl_spaces( GLcontext *ctx, GLuint new_state ); extern void _mesa_update_material( GLcontext *ctx, GLuint bitmask ); extern void _mesa_copy_materials( struct gl_material *dst, const struct gl_material *src, GLuint bitmask ); extern void _mesa_update_color_material( GLcontext *ctx, const GLfloat rgba[4] ); extern void _mesa_init_lighting( GLcontext *ctx ); extern void _mesa_free_lighting_data( GLcontext *ctx ); extern void _mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag ); #else #define _mesa_update_color_material( c, r ) ((void)0) #define _mesa_validate_all_lighting_tables( c ) ((void)0) #define _mesa_invalidate_spot_exp_table( l ) ((void)0) #define _mesa_material_bitmask( c, f, p, l, s ) 0 #define _mesa_init_lighting( c ) ((void)0) #define _mesa_free_lighting_data( c ) ((void)0) #define _mesa_update_lighting( c ) ((void)0) #define _mesa_update_tnl_spaces( c, n ) ((void)0) #define GET_SHINE_TAB_ENTRY( table, dp, result ) ((result)=0) #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/lines.c0000644000000000000000000000711413614532424017422 0ustar /** * \file lines.c * Line operations. */ /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "context.h" #include "depth.h" #include "lines.h" #include "macros.h" #include "texstate.h" #include "mtypes.h" /** * Set the line width. * * \param width line width in pixels. * * \sa glLineWidth(). * * Verifies the parameter and updates gl_line_attrib::Width. On a change, * flushes the vertices, updates the clamped line width and marks the * DD_LINE_WIDTH flag in __GLcontextRec::_TriangleCaps for the drivers if the * width is different from one. Notifies the driver via the * dd_function_table::LineWidth callback. */ void GLAPIENTRY _mesa_LineWidth( GLfloat width ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (width<=0.0) { _mesa_error( ctx, GL_INVALID_VALUE, "glLineWidth" ); return; } if (ctx->Line.Width == width) return; FLUSH_VERTICES(ctx, _NEW_LINE); ctx->Line.Width = width; ctx->Line._Width = CLAMP(width, ctx->Const.MinLineWidth, ctx->Const.MaxLineWidth); if (width != 1.0) ctx->_TriangleCaps |= DD_LINE_WIDTH; else ctx->_TriangleCaps &= ~DD_LINE_WIDTH; if (ctx->Driver.LineWidth) (*ctx->Driver.LineWidth)(ctx, width); } /** * Set the line stipple pattern. * * \param factor pattern scale factor. * \param pattern bit pattern. * * \sa glLineStipple(). * * Updates gl_line_attrib::StippleFactor and gl_line_attrib::StipplePattern. On * change flushes the vertices and notifies the driver via * the dd_function_table::LineStipple callback. */ void GLAPIENTRY _mesa_LineStipple( GLint factor, GLushort pattern ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); factor = CLAMP( factor, 1, 256 ); if (ctx->Line.StippleFactor == factor && ctx->Line.StipplePattern == pattern) return; FLUSH_VERTICES(ctx, _NEW_LINE); ctx->Line.StippleFactor = factor; ctx->Line.StipplePattern = pattern; if (ctx->Driver.LineStipple) ctx->Driver.LineStipple( ctx, factor, pattern ); } /** * Initialize the context line state. * * \param ctx GL context. * * Initializes __GLcontextRec::Line and line related constants in * __GLcontextRec::Const. */ void GLAPIENTRY _mesa_init_line( GLcontext * ctx ) { /* Line group */ ctx->Line.SmoothFlag = GL_FALSE; ctx->Line.StippleFlag = GL_FALSE; ctx->Line.Width = 1.0; ctx->Line._Width = 1.0; ctx->Line.StipplePattern = 0xffff; ctx->Line.StippleFactor = 1; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/lines.h0000644000000000000000000000270513614532424017430 0ustar /** * \file lines.h * Line operations. */ /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef LINES_H #define LINES_H #include "mtypes.h" extern void GLAPIENTRY _mesa_LineWidth( GLfloat width ); extern void GLAPIENTRY _mesa_LineStipple( GLint factor, GLushort pattern ); extern void GLAPIENTRY _mesa_init_line( GLcontext * ctx ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/macros.h0000644000000000000000000005145013614532424017603 0ustar /** * \file macros.h * A collection of useful macros. */ /* * Mesa 3-D graphics library * Version: 6.0 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MACROS_H #define MACROS_H #include "imports.h" /** * \name Integer / float conversion for colors, normals, etc. */ /*@{*/ /** Convert GLubyte in [0,255] to GLfloat in [0.0,1.0] */ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; #define UBYTE_TO_FLOAT(u) _mesa_ubyte_to_float_color_tab[(unsigned int)(u)] /** Convert GLfloat in [0.0,1.0] to GLubyte in [0,255] */ #define FLOAT_TO_UBYTE(X) ((GLubyte) (GLint) ((X) * 255.0F)) /** Convert GLbyte in [-128,127] to GLfloat in [-1.0,1.0] */ #define BYTE_TO_FLOAT(B) ((2.0F * (B) + 1.0F) * (1.0F/255.0F)) /** Convert GLfloat in [-1.0,1.0] to GLbyte in [-128,127] */ #define FLOAT_TO_BYTE(X) ( (((GLint) (255.0F * (X))) - 1) / 2 ) /** Convert GLushort in [0,65536] to GLfloat in [0.0,1.0] */ #define USHORT_TO_FLOAT(S) ((GLfloat) (S) * (1.0F / 65535.0F)) /** Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0] */ #define SHORT_TO_FLOAT(S) ((2.0F * (S) + 1.0F) * (1.0F/65535.0F)) /** Convert GLfloat in [0.0,1.0] to GLshort in [-32768,32767] */ #define FLOAT_TO_SHORT(X) ( (((GLint) (65535.0F * (X))) - 1) / 2 ) /** Convert GLuint in [0,4294967295] to GLfloat in [0.0,1.0] */ #define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0F)) /** Convert GLfloat in [0.0,1.0] to GLuint in [0,4294967295] */ #define FLOAT_TO_UINT(X) ((GLuint) ((X) * 4294967295.0)) /** Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0] */ #define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0F)) /** Convert GLfloat in [-1.0,1.0] to GLint in [-2147483648,2147483647] */ /* causes overflow: #define FLOAT_TO_INT(X) ( (((GLint) (4294967294.0F * (X))) - 1) / 2 ) */ /* a close approximation: */ #define FLOAT_TO_INT(X) ( (GLint) (2147483647.0 * (X)) ) #define BYTE_TO_UBYTE(b) ((GLubyte) ((b) < 0 ? 0 : (GLubyte) (b))) #define SHORT_TO_UBYTE(s) ((GLubyte) ((s) < 0 ? 0 : (GLubyte) ((s) >> 7))) #define USHORT_TO_UBYTE(s) ((GLubyte) ((s) >> 8)) #define INT_TO_UBYTE(i) ((GLubyte) ((i) < 0 ? 0 : (GLubyte) ((i) >> 23))) #define UINT_TO_UBYTE(i) ((GLubyte) ((i) >> 24)) #define BYTE_TO_USHORT(b) ((b) < 0 ? 0 : ((GLushort) (((b) * 65535) / 255))) #define UBYTE_TO_USHORT(b) (((GLushort) (b) << 8) | (GLushort) (b)) #define SHORT_TO_USHORT(s) ((s) < 0 ? 0 : ((GLushort) (((s) * 65535 / 32767)))) #define INT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 15))) #define UINT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 16))) #define UNCLAMPED_FLOAT_TO_USHORT(us, f) \ us = ( (GLushort) IROUND( CLAMP((f), 0.0, 1.0) * 65535.0F) ) #define CLAMPED_FLOAT_TO_USHORT(us, f) \ us = ( (GLushort) IROUND( (f) * 65535.0F) ) /*@}*/ /** Stepping a GLfloat pointer by a byte stride */ #define STRIDE_F(p, i) (p = (GLfloat *)((GLubyte *)p + i)) /** Stepping a GLuint pointer by a byte stride */ #define STRIDE_UI(p, i) (p = (GLuint *)((GLubyte *)p + i)) /** Stepping a GLubyte[4] pointer by a byte stride */ #define STRIDE_4UB(p, i) (p = (GLubyte (*)[4])((GLubyte *)p + i)) /** Stepping a GLfloat[4] pointer by a byte stride */ #define STRIDE_4F(p, i) (p = (GLfloat (*)[4])((GLubyte *)p + i)) /** Stepping a GLchan[4] pointer by a byte stride */ #define STRIDE_4CHAN(p, i) (p = (GLchan (*)[4])((GLubyte *)p + i)) /** Stepping a GLchan pointer by a byte stride */ #define STRIDE_CHAN(p, i) (p = (GLchan *)((GLubyte *)p + i)) /** Stepping a \p t pointer by a byte stride */ #define STRIDE_T(p, t, i) (p = (t)((GLubyte *)p + i)) /**********************************************************************/ /** \name 4-element vector operations */ /*@{*/ /** Zero */ #define ZERO_4V( DST ) (DST)[0] = (DST)[1] = (DST)[2] = (DST)[3] = 0 /** Test for equality */ #define TEST_EQ_4V(a,b) ((a)[0] == (b)[0] && \ (a)[1] == (b)[1] && \ (a)[2] == (b)[2] && \ (a)[3] == (b)[3]) /** Test for equality (unsigned bytes) */ #if defined(__i386__) #define TEST_EQ_4UBV(DST, SRC) *((GLuint*)(DST)) == *((GLuint*)(SRC)) #else #define TEST_EQ_4UBV(DST, SRC) TEST_EQ_4V(DST, SRC) #endif /** Copy a 4-element vector */ #define COPY_4V( DST, SRC ) \ do { \ (DST)[0] = (SRC)[0]; \ (DST)[1] = (SRC)[1]; \ (DST)[2] = (SRC)[2]; \ (DST)[3] = (SRC)[3]; \ } while (0) /** Copy a 4-element vector with cast */ #define COPY_4V_CAST( DST, SRC, CAST ) \ do { \ (DST)[0] = (CAST)(SRC)[0]; \ (DST)[1] = (CAST)(SRC)[1]; \ (DST)[2] = (CAST)(SRC)[2]; \ (DST)[3] = (CAST)(SRC)[3]; \ } while (0) /** Copy a 4-element unsigned byte vector */ #if defined(__i386__) #define COPY_4UBV(DST, SRC) \ do { \ *((GLuint*)(DST)) = *((GLuint*)(SRC)); \ } while (0) #else /* The GLuint cast might fail if DST or SRC are not dword-aligned (RISC) */ #define COPY_4UBV(DST, SRC) \ do { \ (DST)[0] = (SRC)[0]; \ (DST)[1] = (SRC)[1]; \ (DST)[2] = (SRC)[2]; \ (DST)[3] = (SRC)[3]; \ } while (0) #endif /** Copy a 4-element float vector (Use COPY_FLOAT to avoid loading FPU) */ #define COPY_4FV( DST, SRC ) \ do { \ COPY_FLOAT((DST)[0], (SRC)[0]); \ COPY_FLOAT((DST)[1], (SRC)[1]); \ COPY_FLOAT((DST)[2], (SRC)[2]); \ COPY_FLOAT((DST)[3], (SRC)[3]); \ } while (0) /** Copy \p SZ elements into a 4-element vector */ #define COPY_SZ_4V(DST, SZ, SRC) \ do { \ switch (SZ) { \ case 4: (DST)[3] = (SRC)[3]; \ case 3: (DST)[2] = (SRC)[2]; \ case 2: (DST)[1] = (SRC)[1]; \ case 1: (DST)[0] = (SRC)[0]; \ } \ } while(0) /** Copy \p SZ elements into a homegeneous (4-element) vector, giving * default values to the remaining */ #define COPY_CLEAN_4V(DST, SZ, SRC) \ do { \ ASSIGN_4V( DST, 0, 0, 0, 1 ); \ COPY_SZ_4V( DST, SZ, SRC ); \ } while (0) /** Subtraction */ #define SUB_4V( DST, SRCA, SRCB ) \ do { \ (DST)[0] = (SRCA)[0] - (SRCB)[0]; \ (DST)[1] = (SRCA)[1] - (SRCB)[1]; \ (DST)[2] = (SRCA)[2] - (SRCB)[2]; \ (DST)[3] = (SRCA)[3] - (SRCB)[3]; \ } while (0) /** Addition */ #define ADD_4V( DST, SRCA, SRCB ) \ do { \ (DST)[0] = (SRCA)[0] + (SRCB)[0]; \ (DST)[1] = (SRCA)[1] + (SRCB)[1]; \ (DST)[2] = (SRCA)[2] + (SRCB)[2]; \ (DST)[3] = (SRCA)[3] + (SRCB)[3]; \ } while (0) /** Element-wise multiplication */ #define SCALE_4V( DST, SRCA, SRCB ) \ do { \ (DST)[0] = (SRCA)[0] * (SRCB)[0]; \ (DST)[1] = (SRCA)[1] * (SRCB)[1]; \ (DST)[2] = (SRCA)[2] * (SRCB)[2]; \ (DST)[3] = (SRCA)[3] * (SRCB)[3]; \ } while (0) /** In-place addition */ #define ACC_4V( DST, SRC ) \ do { \ (DST)[0] += (SRC)[0]; \ (DST)[1] += (SRC)[1]; \ (DST)[2] += (SRC)[2]; \ (DST)[3] += (SRC)[3]; \ } while (0) /** Element-wise multiplication and addition */ #define ACC_SCALE_4V( DST, SRCA, SRCB ) \ do { \ (DST)[0] += (SRCA)[0] * (SRCB)[0]; \ (DST)[1] += (SRCA)[1] * (SRCB)[1]; \ (DST)[2] += (SRCA)[2] * (SRCB)[2]; \ (DST)[3] += (SRCA)[3] * (SRCB)[3]; \ } while (0) /** In-place scalar multiplication and addition */ #define ACC_SCALE_SCALAR_4V( DST, S, SRCB ) \ do { \ (DST)[0] += S * (SRCB)[0]; \ (DST)[1] += S * (SRCB)[1]; \ (DST)[2] += S * (SRCB)[2]; \ (DST)[3] += S * (SRCB)[3]; \ } while (0) /** Scalar multiplication */ #define SCALE_SCALAR_4V( DST, S, SRCB ) \ do { \ (DST)[0] = S * (SRCB)[0]; \ (DST)[1] = S * (SRCB)[1]; \ (DST)[2] = S * (SRCB)[2]; \ (DST)[3] = S * (SRCB)[3]; \ } while (0) /** In-place scalar multiplication */ #define SELF_SCALE_SCALAR_4V( DST, S ) \ do { \ (DST)[0] *= S; \ (DST)[1] *= S; \ (DST)[2] *= S; \ (DST)[3] *= S; \ } while (0) /** Assignment */ #define ASSIGN_4V( V, V0, V1, V2, V3 ) \ do { \ V[0] = V0; \ V[1] = V1; \ V[2] = V2; \ V[3] = V3; \ } while(0) /*@}*/ /**********************************************************************/ /** \name 3-element vector operations*/ /*@{*/ /** Zero */ #define ZERO_3V( DST ) (DST)[0] = (DST)[1] = (DST)[2] = 0 /** Test for equality */ #define TEST_EQ_3V(a,b) \ ((a)[0] == (b)[0] && \ (a)[1] == (b)[1] && \ (a)[2] == (b)[2]) /** Copy a 3-element vector */ #define COPY_3V( DST, SRC ) \ do { \ (DST)[0] = (SRC)[0]; \ (DST)[1] = (SRC)[1]; \ (DST)[2] = (SRC)[2]; \ } while (0) /** Copy a 3-element vector with cast */ #define COPY_3V_CAST( DST, SRC, CAST ) \ do { \ (DST)[0] = (CAST)(SRC)[0]; \ (DST)[1] = (CAST)(SRC)[1]; \ (DST)[2] = (CAST)(SRC)[2]; \ } while (0) /** Copy a 3-element float vector */ #define COPY_3FV( DST, SRC ) \ do { \ const GLfloat *_tmp = (SRC); \ (DST)[0] = _tmp[0]; \ (DST)[1] = _tmp[1]; \ (DST)[2] = _tmp[2]; \ } while (0) /** Subtraction */ #define SUB_3V( DST, SRCA, SRCB ) \ do { \ (DST)[0] = (SRCA)[0] - (SRCB)[0]; \ (DST)[1] = (SRCA)[1] - (SRCB)[1]; \ (DST)[2] = (SRCA)[2] - (SRCB)[2]; \ } while (0) /** Addition */ #define ADD_3V( DST, SRCA, SRCB ) \ do { \ (DST)[0] = (SRCA)[0] + (SRCB)[0]; \ (DST)[1] = (SRCA)[1] + (SRCB)[1]; \ (DST)[2] = (SRCA)[2] + (SRCB)[2]; \ } while (0) /** In-place scalar multiplication */ #define SCALE_3V( DST, SRCA, SRCB ) \ do { \ (DST)[0] = (SRCA)[0] * (SRCB)[0]; \ (DST)[1] = (SRCA)[1] * (SRCB)[1]; \ (DST)[2] = (SRCA)[2] * (SRCB)[2]; \ } while (0) /** In-place element-wise multiplication */ #define SELF_SCALE_3V( DST, SRC ) \ do { \ (DST)[0] *= (SRC)[0]; \ (DST)[1] *= (SRC)[1]; \ (DST)[2] *= (SRC)[2]; \ } while (0) /** In-place addition */ #define ACC_3V( DST, SRC ) \ do { \ (DST)[0] += (SRC)[0]; \ (DST)[1] += (SRC)[1]; \ (DST)[2] += (SRC)[2]; \ } while (0) /** Element-wise multiplication and addition */ #define ACC_SCALE_3V( DST, SRCA, SRCB ) \ do { \ (DST)[0] += (SRCA)[0] * (SRCB)[0]; \ (DST)[1] += (SRCA)[1] * (SRCB)[1]; \ (DST)[2] += (SRCA)[2] * (SRCB)[2]; \ } while (0) /** Scalar multiplication */ #define SCALE_SCALAR_3V( DST, S, SRCB ) \ do { \ (DST)[0] = S * (SRCB)[0]; \ (DST)[1] = S * (SRCB)[1]; \ (DST)[2] = S * (SRCB)[2]; \ } while (0) /** In-place scalar multiplication and addition */ #define ACC_SCALE_SCALAR_3V( DST, S, SRCB ) \ do { \ (DST)[0] += S * (SRCB)[0]; \ (DST)[1] += S * (SRCB)[1]; \ (DST)[2] += S * (SRCB)[2]; \ } while (0) /** In-place scalar multiplication */ #define SELF_SCALE_SCALAR_3V( DST, S ) \ do { \ (DST)[0] *= S; \ (DST)[1] *= S; \ (DST)[2] *= S; \ } while (0) /** In-place scalar addition */ #define ACC_SCALAR_3V( DST, S ) \ do { \ (DST)[0] += S; \ (DST)[1] += S; \ (DST)[2] += S; \ } while (0) /** Assignment */ #define ASSIGN_3V( V, V0, V1, V2 ) \ do { \ V[0] = V0; \ V[1] = V1; \ V[2] = V2; \ } while(0) /*@}*/ /**********************************************************************/ /** \name 2-element vector operations*/ /*@{*/ /** Zero */ #define ZERO_2V( DST ) (DST)[0] = (DST)[1] = 0 /** Copy a 2-element vector */ #define COPY_2V( DST, SRC ) \ do { \ (DST)[0] = (SRC)[0]; \ (DST)[1] = (SRC)[1]; \ } while (0) /** Copy a 2-element vector with cast */ #define COPY_2V_CAST( DST, SRC, CAST ) \ do { \ (DST)[0] = (CAST)(SRC)[0]; \ (DST)[1] = (CAST)(SRC)[1]; \ } while (0) /** Copy a 2-element float vector */ #define COPY_2FV( DST, SRC ) \ do { \ const GLfloat *_tmp = (SRC); \ (DST)[0] = _tmp[0]; \ (DST)[1] = _tmp[1]; \ } while (0) /** Subtraction */ #define SUB_2V( DST, SRCA, SRCB ) \ do { \ (DST)[0] = (SRCA)[0] - (SRCB)[0]; \ (DST)[1] = (SRCA)[1] - (SRCB)[1]; \ } while (0) /** Addition */ #define ADD_2V( DST, SRCA, SRCB ) \ do { \ (DST)[0] = (SRCA)[0] + (SRCB)[0]; \ (DST)[1] = (SRCA)[1] + (SRCB)[1]; \ } while (0) /** In-place scalar multiplication */ #define SCALE_2V( DST, SRCA, SRCB ) \ do { \ (DST)[0] = (SRCA)[0] * (SRCB)[0]; \ (DST)[1] = (SRCA)[1] * (SRCB)[1]; \ } while (0) /** In-place addition */ #define ACC_2V( DST, SRC ) \ do { \ (DST)[0] += (SRC)[0]; \ (DST)[1] += (SRC)[1]; \ } while (0) /** Element-wise multiplication and addition */ #define ACC_SCALE_2V( DST, SRCA, SRCB ) \ do { \ (DST)[0] += (SRCA)[0] * (SRCB)[0]; \ (DST)[1] += (SRCA)[1] * (SRCB)[1]; \ } while (0) /** Scalar multiplication */ #define SCALE_SCALAR_2V( DST, S, SRCB ) \ do { \ (DST)[0] = S * (SRCB)[0]; \ (DST)[1] = S * (SRCB)[1]; \ } while (0) /** In-place scalar multiplication and addition */ #define ACC_SCALE_SCALAR_2V( DST, S, SRCB ) \ do { \ (DST)[0] += S * (SRCB)[0]; \ (DST)[1] += S * (SRCB)[1]; \ } while (0) /** In-place scalar multiplication */ #define SELF_SCALE_SCALAR_2V( DST, S ) \ do { \ (DST)[0] *= S; \ (DST)[1] *= S; \ } while (0) /** In-place scalar addition */ #define ACC_SCALAR_2V( DST, S ) \ do { \ (DST)[0] += S; \ (DST)[1] += S; \ } while (0) /** * Linear interpolation * * \note \p OUT argument is evaluated twice! * \note Be wary of using *coord++ as an argument to any of these macros! */ #define LINTERP(T, OUT, IN) ((OUT) + (T) * ((IN) - (OUT))) /* Can do better with integer math */ #define INTERP_UB( t, dstub, outub, inub ) \ do { \ GLfloat inf = UBYTE_TO_FLOAT( inub ); \ GLfloat outf = UBYTE_TO_FLOAT( outub ); \ GLfloat dstf = LINTERP( t, outf, inf ); \ UNCLAMPED_FLOAT_TO_UBYTE( dstub, dstf ); \ } while (0) #define INTERP_CHAN( t, dstc, outc, inc ) \ do { \ GLfloat inf = CHAN_TO_FLOAT( inc ); \ GLfloat outf = CHAN_TO_FLOAT( outc ); \ GLfloat dstf = LINTERP( t, outf, inf ); \ UNCLAMPED_FLOAT_TO_CHAN( dstc, dstf ); \ } while (0) #define INTERP_UI( t, dstui, outui, inui ) \ dstui = (GLuint) (GLint) LINTERP( (t), (GLfloat) (outui), (GLfloat) (inui) ) #define INTERP_F( t, dstf, outf, inf ) \ dstf = LINTERP( t, outf, inf ) #define INTERP_4F( t, dst, out, in ) \ do { \ dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \ dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \ dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \ dst[3] = LINTERP( (t), (out)[3], (in)[3] ); \ } while (0) #define INTERP_3F( t, dst, out, in ) \ do { \ dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \ dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \ dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \ } while (0) #define INTERP_4CHAN( t, dst, out, in ) \ do { \ INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \ INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \ INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \ INTERP_CHAN( (t), (dst)[3], (out)[3], (in)[3] ); \ } while (0) #define INTERP_3CHAN( t, dst, out, in ) \ do { \ INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \ INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \ INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \ } while (0) #define INTERP_SZ( t, vec, to, out, in, sz ) \ do { \ switch (sz) { \ case 4: vec[to][3] = LINTERP( (t), (vec)[out][3], (vec)[in][3] ); \ case 3: vec[to][2] = LINTERP( (t), (vec)[out][2], (vec)[in][2] ); \ case 2: vec[to][1] = LINTERP( (t), (vec)[out][1], (vec)[in][1] ); \ case 1: vec[to][0] = LINTERP( (t), (vec)[out][0], (vec)[in][0] ); \ } \ } while(0) /** Assign scalers to short vectors */ #define ASSIGN_2V( V, V0, V1 ) \ do { \ V[0] = V0; \ V[1] = V1; \ } while(0) /*@}*/ /** Clamp X to [MIN,MAX] */ #define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) ) /** Assign X to CLAMP(X, MIN, MAX) */ #define CLAMP_SELF(x, mn, mx) \ ( (x)<(mn) ? ((x) = (mn)) : ((x)>(mx) ? ((x)=(mx)) : (x)) ) /** Minimum of two values: */ #define MIN2( A, B ) ( (A)<(B) ? (A) : (B) ) /** Maximum of two values: */ #define MAX2( A, B ) ( (A)>(B) ? (A) : (B) ) /** Dot product of two 2-element vectors */ #define DOT2( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] ) /** Dot product of two 3-element vectors */ #define DOT3( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] + (a)[2]*(b)[2] ) /** Dot product of two 4-element vectors */ #define DOT4( a, b ) ( (a)[0]*(b)[0] + (a)[1]*(b)[1] + \ (a)[2]*(b)[2] + (a)[3]*(b)[3] ) /** Dot product of two 4-element vectors */ #define DOT4V(v,a,b,c,d) (v[0]*(a) + v[1]*(b) + v[2]*(c) + v[3]*(d)) /** Cross product of two 3-element vectors */ #define CROSS3(n, u, v) \ do { \ (n)[0] = (u)[1]*(v)[2] - (u)[2]*(v)[1]; \ (n)[1] = (u)[2]*(v)[0] - (u)[0]*(v)[2]; \ (n)[2] = (u)[0]*(v)[1] - (u)[1]*(v)[0]; \ } while (0) /* Normalize a 3-element vector to unit length. */ #define NORMALIZE_3FV( V ) \ do { \ GLfloat len = (GLfloat) LEN_SQUARED_3FV(V); \ if (len) { \ len = INV_SQRTF(len); \ (V)[0] = (GLfloat) ((V)[0] * len); \ (V)[1] = (GLfloat) ((V)[1] * len); \ (V)[2] = (GLfloat) ((V)[2] * len); \ } \ } while(0) #define LEN_3FV( V ) (SQRTF((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2])) #define LEN_2FV( V ) (SQRTF((V)[0]*(V)[0]+(V)[1]*(V)[1])) #define LEN_SQUARED_3FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2]) #define LEN_SQUARED_2FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1]) #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/matrix.c0000644000000000000000000006275413614532424017627 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file matrix.c * Matrix operations. * * \note * -# 4x4 transformation matrices are stored in memory in column major order. * -# Points/vertices are to be thought of as column vectors. * -# Transformation of a point p by a matrix M is: p' = M * p */ #include "glheader.h" #include "imports.h" #include "context.h" #include "enums.h" #include "macros.h" #include "matrix.h" #include "mtypes.h" #include "math/m_matrix.h" #include "math/m_xform.h" /** * Apply a perspective projection matrix. * * \param left left clipping plane coordinate. * \param right right clipping plane coordinate. * \param bottom bottom clipping plane coordinate. * \param top top clipping plane coordinate. * \param nearval distance to the near clipping plane. * \param farval distance to the far clipping plane. * * \sa glFrustum(). * * Flushes vertices and validates parameters. Calls _math_matrix_frustum() with * the top matrix of the current matrix stack and sets * __GLcontextRec::NewState. */ void GLAPIENTRY _mesa_Frustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (nearval <= 0.0 || farval <= 0.0 || nearval == farval || left == right || top == bottom) { _mesa_error( ctx, GL_INVALID_VALUE, "glFrustum" ); return; } _math_matrix_frustum( ctx->CurrentStack->Top, (GLfloat) left, (GLfloat) right, (GLfloat) bottom, (GLfloat) top, (GLfloat) nearval, (GLfloat) farval ); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } /** * Apply an orthographic projection matrix. * * \param left left clipping plane coordinate. * \param right right clipping plane coordinate. * \param bottom bottom clipping plane coordinate. * \param top top clipping plane coordinate. * \param nearval distance to the near clipping plane. * \param farval distance to the far clipping plane. * * \sa glOrtho(). * * Flushes vertices and validates parameters. Calls _math_matrix_ortho() with * the top matrix of the current matrix stack and sets * __GLcontextRec::NewState. */ void GLAPIENTRY _mesa_Ortho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glOrtho(%f, %f, %f, %f, %f, %f)\n", left, right, bottom, top, nearval, farval); if (left == right || bottom == top || nearval == farval) { _mesa_error( ctx, GL_INVALID_VALUE, "glOrtho" ); return; } _math_matrix_ortho( ctx->CurrentStack->Top, (GLfloat) left, (GLfloat) right, (GLfloat) bottom, (GLfloat) top, (GLfloat) nearval, (GLfloat) farval ); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } /** * Set the current matrix stack. * * \param mode matrix stack. * * \sa glMatrixMode(). * * Flushes the vertices, validates the parameter and updates * __GLcontextRec::CurrentStack and gl_transform_attrib::MatrixMode with the * specified matrix stack. */ void GLAPIENTRY _mesa_MatrixMode( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Transform.MatrixMode == mode && mode != GL_TEXTURE) return; FLUSH_VERTICES(ctx, _NEW_TRANSFORM); switch (mode) { case GL_MODELVIEW: ctx->CurrentStack = &ctx->ModelviewMatrixStack; break; case GL_PROJECTION: ctx->CurrentStack = &ctx->ProjectionMatrixStack; break; case GL_TEXTURE: ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit]; break; case GL_COLOR: ctx->CurrentStack = &ctx->ColorMatrixStack; break; case GL_MATRIX0_NV: case GL_MATRIX1_NV: case GL_MATRIX2_NV: case GL_MATRIX3_NV: case GL_MATRIX4_NV: case GL_MATRIX5_NV: case GL_MATRIX6_NV: case GL_MATRIX7_NV: if (ctx->Extensions.NV_vertex_program) { ctx->CurrentStack = &ctx->ProgramMatrixStack[mode - GL_MATRIX0_NV]; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode(mode)" ); return; } break; case GL_MATRIX0_ARB: case GL_MATRIX1_ARB: case GL_MATRIX2_ARB: case GL_MATRIX3_ARB: case GL_MATRIX4_ARB: case GL_MATRIX5_ARB: case GL_MATRIX6_ARB: case GL_MATRIX7_ARB: if (ctx->Extensions.ARB_vertex_program || ctx->Extensions.ARB_fragment_program) { const GLuint m = mode - GL_MATRIX0_ARB; if (m > ctx->Const.MaxProgramMatrices) { _mesa_error(ctx, GL_INVALID_ENUM, "glMatrixMode(GL_MATRIX%d_ARB)", m); return; } ctx->CurrentStack = &ctx->ProgramMatrixStack[m]; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode(mode)" ); return; } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode(mode)" ); return; } ctx->Transform.MatrixMode = mode; } /** * Push the current matrix stack. * * \sa glPushMatrix(). * * Verifies the current matrix stack is not full, and duplicates the top-most * matrix in the stack. Marks __GLcontextRec::NewState with the stack dirty * flag. */ void GLAPIENTRY _mesa_PushMatrix( void ) { GET_CURRENT_CONTEXT(ctx); struct matrix_stack *stack = ctx->CurrentStack; ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glPushMatrix %s\n", _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode)); if (stack->Depth + 1 >= stack->MaxDepth) { if (ctx->Transform.MatrixMode == GL_TEXTURE) { _mesa_error(ctx, GL_STACK_OVERFLOW, "glPushMatrix(mode=GL_TEXTURE, unit=%d)", ctx->Texture.CurrentUnit); } else { _mesa_error(ctx, GL_STACK_OVERFLOW, "glPushMatrix(mode=%s)", _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode)); } return; } _math_matrix_copy( &stack->Stack[stack->Depth + 1], &stack->Stack[stack->Depth] ); stack->Depth++; stack->Top = &(stack->Stack[stack->Depth]); ctx->NewState |= stack->DirtyFlag; } /** * Pop the current matrix stack. * * \sa glPopMatrix(). * * Flushes the vertices, verifies the current matrix stack is not empty, and * moves the stack head down. Marks __GLcontextRec::NewState with the dirty * stack flag. */ void GLAPIENTRY _mesa_PopMatrix( void ) { GET_CURRENT_CONTEXT(ctx); struct matrix_stack *stack = ctx->CurrentStack; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glPopMatrix %s\n", _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode)); if (stack->Depth == 0) { if (ctx->Transform.MatrixMode == GL_TEXTURE) { _mesa_error(ctx, GL_STACK_UNDERFLOW, "glPopMatrix(mode=GL_TEXTURE, unit=%d)", ctx->Texture.CurrentUnit); } else { _mesa_error(ctx, GL_STACK_UNDERFLOW, "glPopMatrix(mode=%s)", _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode)); } return; } stack->Depth--; stack->Top = &(stack->Stack[stack->Depth]); ctx->NewState |= stack->DirtyFlag; } /** * Replace the current matrix with the identity matrix. * * \sa glLoadIdentity(). * * Flushes the vertices and calls _math_matrix_set_identity() with the top-most * matrix in the current stack. Marks __GLcontextRec::NewState with the stack * dirty flag. */ void GLAPIENTRY _mesa_LoadIdentity( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glLoadIdentity()"); _math_matrix_set_identity( ctx->CurrentStack->Top ); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } /** * Replace the current matrix with a given matrix. * * \param m matrix. * * \sa glLoadMatrixf(). * * Flushes the vertices and calls _math_matrix_loadf() with the top-most matrix * in the current stack and the given matrix. Marks __GLcontextRec::NewState * with the dirty stack flag. */ void GLAPIENTRY _mesa_LoadMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); if (!m) return; if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glLoadMatrix(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n", m[0], m[4], m[8], m[12], m[1], m[5], m[9], m[13], m[2], m[6], m[10], m[14], m[3], m[7], m[11], m[15]); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); _math_matrix_loadf( ctx->CurrentStack->Top, m ); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } /** * Multiply the current matrix with a given matrix. * * \param m matrix. * * \sa glMultMatrixf(). * * Flushes the vertices and calls _math_matrix_mul_floats() with the top-most * matrix in the current stack and the given matrix. Marks * __GLcontextRec::NewState with the dirty stack flag. */ void GLAPIENTRY _mesa_MultMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); if (!m) return; if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glMultMatrix(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n", m[0], m[4], m[8], m[12], m[1], m[5], m[9], m[13], m[2], m[6], m[10], m[14], m[3], m[7], m[11], m[15]); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); _math_matrix_mul_floats( ctx->CurrentStack->Top, m ); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } /** * Multiply the current matrix with a rotation matrix. * * \param angle angle of rotation, in degrees. * \param x rotation vector x coordinate. * \param y rotation vector y coordinate. * \param z rotation vector z coordinate. * * \sa glRotatef(). * * Flushes the vertices and calls _math_matrix_rotate() with the top-most * matrix in the current stack and the given parameters. Marks * __GLcontextRec::NewState with the dirty stack flag. */ void GLAPIENTRY _mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (angle != 0.0F) { _math_matrix_rotate( ctx->CurrentStack->Top, angle, x, y, z); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } } /** * Multiply the current matrix with a general scaling matrix. * * \param x x axis scale factor. * \param y y axis scale factor. * \param z z axis scale factor. * * \sa glScalef(). * * Flushes the vertices and calls _math_matrix_scale() with the top-most * matrix in the current stack and the given parameters. Marks * __GLcontextRec::NewState with the dirty stack flag. */ void GLAPIENTRY _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); _math_matrix_scale( ctx->CurrentStack->Top, x, y, z); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } /** * Multiply the current matrix with a general scaling matrix. * * \param x translation vector x coordinate. * \param y translation vector y coordinate. * \param z translation vector z coordinate. * * \sa glTranslatef(). * * Flushes the vertices and calls _math_matrix_translate() with the top-most * matrix in the current stack and the given parameters. Marks * __GLcontextRec::NewState with the dirty stack flag. */ void GLAPIENTRY _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); _math_matrix_translate( ctx->CurrentStack->Top, x, y, z); ctx->NewState |= ctx->CurrentStack->DirtyFlag; } #if _HAVE_FULL_GL void GLAPIENTRY _mesa_LoadMatrixd( const GLdouble *m ) { GLint i; GLfloat f[16]; if (!m) return; for (i = 0; i < 16; i++) f[i] = (GLfloat) m[i]; _mesa_LoadMatrixf(f); } void GLAPIENTRY _mesa_MultMatrixd( const GLdouble *m ) { GLint i; GLfloat f[16]; if (!m) return; for (i = 0; i < 16; i++) f[i] = (GLfloat) m[i]; _mesa_MultMatrixf( f ); } void GLAPIENTRY _mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) { _mesa_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z); } void GLAPIENTRY _mesa_Scaled( GLdouble x, GLdouble y, GLdouble z ) { _mesa_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z); } void GLAPIENTRY _mesa_Translated( GLdouble x, GLdouble y, GLdouble z ) { _mesa_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z); } #endif #if _HAVE_FULL_GL void GLAPIENTRY _mesa_LoadTransposeMatrixfARB( const GLfloat *m ) { GLfloat tm[16]; if (!m) return; _math_transposef(tm, m); _mesa_LoadMatrixf(tm); } void GLAPIENTRY _mesa_LoadTransposeMatrixdARB( const GLdouble *m ) { GLfloat tm[16]; if (!m) return; _math_transposefd(tm, m); _mesa_LoadMatrixf(tm); } void GLAPIENTRY _mesa_MultTransposeMatrixfARB( const GLfloat *m ) { GLfloat tm[16]; if (!m) return; _math_transposef(tm, m); _mesa_MultMatrixf(tm); } void GLAPIENTRY _mesa_MultTransposeMatrixdARB( const GLdouble *m ) { GLfloat tm[16]; if (!m) return; _math_transposefd(tm, m); _mesa_MultMatrixf(tm); } #endif /** * Set the viewport. * * \param x, y coordinates of the lower-left corner of the viewport rectangle. * \param width width of the viewport rectangle. * \param height height of the viewport rectangle. * * \sa Called via glViewport() or display list execution. * * Flushes the vertices and calls _mesa_set_viewport() with the given * parameters. */ void GLAPIENTRY _mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); _mesa_set_viewport(ctx, x, y, width, height); } /** * Set new viewport parameters and update derived state (the _WindowMap * matrix). Usually called from _mesa_Viewport(). * * \param ctx GL context. * \param x, y coordinates of the lower left corner of the viewport rectangle. * \param width width of the viewport rectangle. * \param height height of the viewport rectangle. * * Verifies the parameters, clamps them to the implementation dependent range * and updates __GLcontextRec::Viewport. Computes the scale and bias values for * the drivers and notifies the driver via the dd_function_table::Viewport * callback. */ void _mesa_set_viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF; const GLfloat n = ctx->Viewport.Near; const GLfloat f = ctx->Viewport.Far; ASSERT(depthMax > 0); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height); if (width < 0 || height < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glViewport(%d, %d, %d, %d)", x, y, width, height ); return; } /* clamp width, and height to implementation dependent range */ width = CLAMP( width, 1, ctx->Const.MaxViewportWidth ); height = CLAMP( height, 1, ctx->Const.MaxViewportHeight ); /* Save viewport */ ctx->Viewport.X = x; ctx->Viewport.Width = width; ctx->Viewport.Y = y; ctx->Viewport.Height = height; /* XXX send transposed width/height to Driver.Viewport() below??? */ if (ctx->_RotateMode) { GLint tmp, tmps; tmp = x; x = y; y = tmp; tmps = width; width = height; height = tmps; } /* Compute scale and bias values. This is really driver-specific * and should be maintained elsewhere if at all. * NOTE: RasterPos uses this. */ _math_matrix_viewport(&ctx->Viewport._WindowMap, x, y, width, height, n, f, depthMax); ctx->NewState |= _NEW_VIEWPORT; if (ctx->Driver.Viewport) { /* Many drivers will use this call to check for window size changes * and reallocate the z/stencil/accum/etc buffers if needed. */ (*ctx->Driver.Viewport)( ctx, x, y, width, height ); } } #if _HAVE_FULL_GL void GLAPIENTRY _mesa_DepthRange( GLclampd nearval, GLclampd farval ) { /* * nearval - specifies mapping of the near clipping plane to window * coordinates, default is 0 * farval - specifies mapping of the far clipping plane to window * coordinates, default is 1 * * After clipping and div by w, z coords are in -1.0 to 1.0, * corresponding to near and far clipping planes. glDepthRange * specifies a linear mapping of the normalized z coords in * this range to window z coords. */ GLfloat depthMax; GLfloat n, f; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); depthMax = ctx->DrawBuffer->_DepthMaxF; if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval); n = (GLfloat) CLAMP( nearval, 0.0, 1.0 ); f = (GLfloat) CLAMP( farval, 0.0, 1.0 ); ctx->Viewport.Near = n; ctx->Viewport.Far = f; ctx->Viewport._WindowMap.m[MAT_SZ] = depthMax * ((f - n) / 2.0F); ctx->Viewport._WindowMap.m[MAT_TZ] = depthMax * ((f - n) / 2.0F + n); ctx->NewState |= _NEW_VIEWPORT; if (ctx->Driver.DepthRange) { (*ctx->Driver.DepthRange)( ctx, nearval, farval ); } } #endif /**********************************************************************/ /** \name State management */ /*@{*/ /** * Update the projection matrix stack. * * \param ctx GL context. * * Calls _math_matrix_analyse() with the top-matrix of the projection matrix * stack, and recomputes user clip positions if necessary. * * \note This routine references __GLcontextRec::Tranform attribute values to * compute userclip positions in clip space, but is only called on * _NEW_PROJECTION. The _mesa_ClipPlane() function keeps these values up to * date across changes to the __GLcontextRec::Transform attributes. */ static void update_projection( GLcontext *ctx ) { _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); #if FEATURE_userclip /* Recompute clip plane positions in clipspace. This is also done * in _mesa_ClipPlane(). */ if (ctx->Transform.ClipPlanesEnabled) { GLuint p; for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { _mesa_transform_vector( ctx->Transform._ClipUserPlane[p], ctx->Transform.EyeUserPlane[p], ctx->ProjectionMatrixStack.Top->inv ); } } } #endif } /** * Calculate the combined modelview-projection matrix. * * \param ctx GL context. * * Multiplies the top matrices of the projection and model view stacks into * __GLcontextRec::_ModelProjectMatrix via _math_matrix_mul_matrix() and * analyzes the resulting matrix via _math_matrix_analyse(). */ static void calculate_model_project_matrix( GLcontext *ctx ) { _math_matrix_mul_matrix( &ctx->_ModelProjectMatrix, ctx->ProjectionMatrixStack.Top, ctx->ModelviewMatrixStack.Top ); _math_matrix_analyse( &ctx->_ModelProjectMatrix ); } /** * Updates the combined modelview-projection matrix. * * \param ctx GL context. * \param new_state new state bit mask. * * If there is a new model view matrix then analyzes it. If there is a new * projection matrix, updates it. Finally calls * calculate_model_project_matrix() to recalculate the modelview-projection * matrix. */ void _mesa_update_modelview_project( GLcontext *ctx, GLuint new_state ) { if (new_state & _NEW_MODELVIEW) { _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); /* Bring cull position uptodate. */ TRANSFORM_POINT3( ctx->Transform.CullObjPos, ctx->ModelviewMatrixStack.Top->inv, ctx->Transform.CullEyePos ); } if (new_state & _NEW_PROJECTION) update_projection( ctx ); /* Keep ModelviewProject uptodate always to allow tnl * implementations that go model->clip even when eye is required. */ calculate_model_project_matrix(ctx); } /*@}*/ /**********************************************************************/ /** Matrix stack initialization */ /*@{*/ /** * Initialize a matrix stack. * * \param stack matrix stack. * \param maxDepth maximum stack depth. * \param dirtyFlag dirty flag. * * Allocates an array of \p maxDepth elements for the matrix stack and calls * _math_matrix_ctr() and _math_matrix_alloc_inv() for each element to * initialize it. */ static void init_matrix_stack( struct matrix_stack *stack, GLuint maxDepth, GLuint dirtyFlag ) { GLuint i; stack->Depth = 0; stack->MaxDepth = maxDepth; stack->DirtyFlag = dirtyFlag; /* The stack */ stack->Stack = (GLmatrix *) CALLOC(maxDepth * sizeof(GLmatrix)); for (i = 0; i < maxDepth; i++) { _math_matrix_ctr(&stack->Stack[i]); _math_matrix_alloc_inv(&stack->Stack[i]); } stack->Top = stack->Stack; } /** * Free matrix stack. * * \param stack matrix stack. * * Calls _math_matrix_dtr() for each element of the matrix stack and * frees the array. */ static void free_matrix_stack( struct matrix_stack *stack ) { GLuint i; for (i = 0; i < stack->MaxDepth; i++) { _math_matrix_dtr(&stack->Stack[i]); } FREE(stack->Stack); stack->Stack = stack->Top = NULL; } /*@}*/ /**********************************************************************/ /** \name Initialization */ /*@{*/ /** * Initialize the context matrix data. * * \param ctx GL context. * * Initializes each of the matrix stacks and the combined modelview-projection * matrix. */ void _mesa_init_matrix( GLcontext * ctx ) { GLint i; /* Initialize matrix stacks */ init_matrix_stack(&ctx->ModelviewMatrixStack, MAX_MODELVIEW_STACK_DEPTH, _NEW_MODELVIEW); init_matrix_stack(&ctx->ProjectionMatrixStack, MAX_PROJECTION_STACK_DEPTH, _NEW_PROJECTION); init_matrix_stack(&ctx->ColorMatrixStack, MAX_COLOR_STACK_DEPTH, _NEW_COLOR_MATRIX); for (i = 0; i < MAX_TEXTURE_UNITS; i++) init_matrix_stack(&ctx->TextureMatrixStack[i], MAX_TEXTURE_STACK_DEPTH, _NEW_TEXTURE_MATRIX); for (i = 0; i < MAX_PROGRAM_MATRICES; i++) init_matrix_stack(&ctx->ProgramMatrixStack[i], MAX_PROGRAM_MATRIX_STACK_DEPTH, _NEW_TRACK_MATRIX); ctx->CurrentStack = &ctx->ModelviewMatrixStack; /* Init combined Modelview*Projection matrix */ _math_matrix_ctr( &ctx->_ModelProjectMatrix ); } /** * Free the context matrix data. * * \param ctx GL context. * * Frees each of the matrix stacks and the combined modelview-projection * matrix. */ void _mesa_free_matrix_data( GLcontext *ctx ) { GLint i; free_matrix_stack(&ctx->ModelviewMatrixStack); free_matrix_stack(&ctx->ProjectionMatrixStack); free_matrix_stack(&ctx->ColorMatrixStack); for (i = 0; i < MAX_TEXTURE_UNITS; i++) free_matrix_stack(&ctx->TextureMatrixStack[i]); for (i = 0; i < MAX_PROGRAM_MATRICES; i++) free_matrix_stack(&ctx->ProgramMatrixStack[i]); /* combined Modelview*Projection matrix */ _math_matrix_dtr( &ctx->_ModelProjectMatrix ); } /** * Initialize the context transform attribute group. * * \param ctx GL context. * * \todo Move this to a new file with other 'transform' routines. */ void _mesa_init_transform( GLcontext *ctx ) { GLint i; /* Transformation group */ ctx->Transform.MatrixMode = GL_MODELVIEW; ctx->Transform.Normalize = GL_FALSE; ctx->Transform.RescaleNormals = GL_FALSE; ctx->Transform.RasterPositionUnclipped = GL_FALSE; for (i=0;iTransform.EyeUserPlane[i], 0.0, 0.0, 0.0, 0.0 ); } ctx->Transform.ClipPlanesEnabled = 0; ASSIGN_4V( ctx->Transform.CullObjPos, 0.0, 0.0, 1.0, 0.0 ); ASSIGN_4V( ctx->Transform.CullEyePos, 0.0, 0.0, 1.0, 0.0 ); } /** * Initialize the context viewport attribute group. * * \param ctx GL context. * * \todo Move this to a new file with other 'viewport' routines. */ void _mesa_init_viewport( GLcontext *ctx ) { GLfloat depthMax = 65535.0F; /* sorf of arbitrary */ /* Viewport group */ ctx->Viewport.X = 0; ctx->Viewport.Y = 0; ctx->Viewport.Width = 0; ctx->Viewport.Height = 0; ctx->Viewport.Near = 0.0; ctx->Viewport.Far = 1.0; _math_matrix_ctr(&ctx->Viewport._WindowMap); _math_matrix_viewport(&ctx->Viewport._WindowMap, 0, 0, 0, 0, 0.0F, 1.0F, depthMax); } /** * Free the context viewport attribute group data. * * \param ctx GL context. * * \todo Move this to a new file with other 'viewport' routines. */ void _mesa_free_viewport_data( GLcontext *ctx ) { _math_matrix_dtr(&ctx->Viewport._WindowMap); } /*@}*/ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/matrix.h0000644000000000000000000000664513614532424017631 0ustar /** * \file matrix.h * Matrix operations. */ /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MATRIX_H #define MATRIX_H #include "mtypes.h" extern void GLAPIENTRY _mesa_Frustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval ); extern void GLAPIENTRY _mesa_Ortho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval ); extern void GLAPIENTRY _mesa_PushMatrix( void ); extern void GLAPIENTRY _mesa_PopMatrix( void ); extern void GLAPIENTRY _mesa_LoadIdentity( void ); extern void GLAPIENTRY _mesa_LoadMatrixf( const GLfloat *m ); extern void GLAPIENTRY _mesa_LoadMatrixd( const GLdouble *m ); extern void GLAPIENTRY _mesa_MatrixMode( GLenum mode ); extern void GLAPIENTRY _mesa_MultMatrixf( const GLfloat *m ); extern void GLAPIENTRY _mesa_MultMatrixd( const GLdouble *m ); extern void GLAPIENTRY _mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ); extern void GLAPIENTRY _mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ); extern void GLAPIENTRY _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ); extern void GLAPIENTRY _mesa_Scaled( GLdouble x, GLdouble y, GLdouble z ); extern void GLAPIENTRY _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ); extern void GLAPIENTRY _mesa_Translated( GLdouble x, GLdouble y, GLdouble z ); extern void GLAPIENTRY _mesa_LoadTransposeMatrixfARB( const GLfloat *m ); extern void GLAPIENTRY _mesa_LoadTransposeMatrixdARB( const GLdouble *m ); extern void GLAPIENTRY _mesa_MultTransposeMatrixfARB( const GLfloat *m ); extern void GLAPIENTRY _mesa_MultTransposeMatrixdARB( const GLdouble *m ); extern void GLAPIENTRY _mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ); extern void _mesa_set_viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ); extern void GLAPIENTRY _mesa_DepthRange( GLclampd nearval, GLclampd farval ); extern void _mesa_init_matrix( GLcontext * ctx ); extern void _mesa_init_transform( GLcontext *ctx ); extern void _mesa_init_viewport( GLcontext *ctx ); extern void _mesa_free_matrix_data( GLcontext *ctx ); extern void _mesa_free_viewport_data( GLcontext *ctx ); extern void _mesa_update_modelview_project( GLcontext *ctx, GLuint newstate ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/mm.c0000644000000000000000000001133413614532424016720 0ustar /* * GLX Hardware Device Driver common code * Copyright (C) 1999 Wittawat Yamwong * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * WITTAWAT YAMWONG, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "mm.h" void mmDumpMemInfo(const memHeap_t *heap) { const TMemBlock *p; fprintf(stderr, "Memory heap %p:\n", (void *)heap); if (heap == 0) { fprintf(stderr, " heap == 0\n"); } else { p = (TMemBlock *)heap; while (p) { fprintf(stderr, " Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size, p->free ? '.':'U', p->reserved ? 'R':'.'); p = p->next; } } fprintf(stderr, "End of memory blocks\n"); } memHeap_t * mmInit(int ofs, int size) { PMemBlock blocks; if (size <= 0) { return NULL; } blocks = (TMemBlock *) _mesa_calloc(sizeof(TMemBlock)); if (blocks) { blocks->ofs = ofs; blocks->size = size; blocks->free = 1; return (memHeap_t *)blocks; } else { return NULL; } } static TMemBlock * SliceBlock(TMemBlock *p, int startofs, int size, int reserved, int alignment) { TMemBlock *newblock; /* break left */ if (startofs > p->ofs) { newblock = (TMemBlock*) _mesa_calloc(sizeof(TMemBlock)); if (!newblock) return NULL; newblock->ofs = startofs; newblock->size = p->size - (startofs - p->ofs); newblock->free = 1; newblock->next = p->next; p->size -= newblock->size; p->next = newblock; p = newblock; } /* break right */ if (size < p->size) { newblock = (TMemBlock*) _mesa_calloc(sizeof(TMemBlock)); if (!newblock) return NULL; newblock->ofs = startofs + size; newblock->size = p->size - size; newblock->free = 1; newblock->next = p->next; p->size = size; p->next = newblock; } /* p = middle block */ p->align = alignment; p->free = 0; p->reserved = reserved; return p; } PMemBlock mmAllocMem(memHeap_t *heap, int size, int align2, int startSearch) { int mask,startofs,endofs; TMemBlock *p; if (!heap || align2 < 0 || size <= 0) return NULL; mask = (1 << align2)-1; startofs = 0; p = (TMemBlock *)heap; while (p) { if ((p)->free) { startofs = (p->ofs + mask) & ~mask; if ( startofs < startSearch ) { startofs = startSearch; } endofs = startofs+size; if (endofs <= (p->ofs+p->size)) break; } p = p->next; } if (!p) return NULL; p = SliceBlock(p,startofs,size,0,mask+1); p->heap = heap; return p; } PMemBlock mmFindBlock(memHeap_t *heap, int start) { TMemBlock *p = (TMemBlock *)heap; while (p) { if (p->ofs == start && p->free) return p; p = p->next; } return NULL; } static INLINE int Join2Blocks(TMemBlock *p) { /* XXX there should be some assertions here */ if (p->free && p->next && p->next->free) { TMemBlock *q = p->next; p->size += q->size; p->next = q->next; _mesa_free(q); return 1; } return 0; } int mmFreeMem(PMemBlock b) { TMemBlock *p,*prev; if (!b) return 0; if (!b->heap) { fprintf(stderr, "no heap\n"); return -1; } p = b->heap; prev = NULL; while (p && p != b) { prev = p; p = p->next; } if (!p || p->free || p->reserved) { if (!p) fprintf(stderr, "block not found in heap\n"); else if (p->free) fprintf(stderr, "block already free\n"); else fprintf(stderr, "block is reserved\n"); return -1; } p->free = 1; Join2Blocks(p); if (prev) Join2Blocks(prev); return 0; } void mmDestroy(memHeap_t *heap) { TMemBlock *p; if (!heap) return; p = (TMemBlock *) heap; while (p) { TMemBlock *next = p->next; _mesa_free(p); p = next; } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/mm.h0000644000000000000000000000561313614532424016730 0ustar /* * GLX Hardware Device Driver common code * Copyright (C) 1999 Keith Whitwell * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * Memory manager code. Primarily used by device drivers to manage texture * heaps, etc. */ #ifndef MM_H #define MM_H #include "imports.h" struct mem_block_t { struct mem_block_t *next; struct mem_block_t *heap; int ofs,size; int align; unsigned int free:1; unsigned int reserved:1; }; typedef struct mem_block_t TMemBlock; typedef struct mem_block_t *PMemBlock; /* a heap is just the first block in a chain */ typedef struct mem_block_t memHeap_t; /* XXX are these needed? */ #if 0 static INLINE int mmBlockSize(PMemBlock b) { return b->size; } static INLINE int mmOffset(PMemBlock b) { return b->ofs; } #endif /** * input: total size in bytes * return: a heap pointer if OK, NULL if error */ extern memHeap_t *mmInit(int ofs, int size); /** * Allocate 'size' bytes with 2^align2 bytes alignment, * restrict the search to free memory after 'startSearch' * depth and back buffers should be in different 4mb banks * to get better page hits if possible * input: size = size of block * align2 = 2^align2 bytes alignment * startSearch = linear offset from start of heap to begin search * return: pointer to the allocated block, 0 if error */ extern PMemBlock mmAllocMem(memHeap_t *heap, int size, int align2, int startSearch); /** * Free block starts at offset * input: pointer to a block * return: 0 if OK, -1 if error */ extern int mmFreeMem(PMemBlock b); /** * Free block starts at offset * input: pointer to a heap, start offset * return: pointer to a block */ extern PMemBlock mmFindBlock(memHeap_t *heap, int start); /** * destroy MM */ extern void mmDestroy(memHeap_t *mmInit); /** * For debuging purpose. */ extern void mmDumpMemInfo(const memHeap_t *mmInit); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/mtypes.h0000644000000000000000000026241013614532424017640 0ustar /** * \file mtypes.h * Main Mesa data structures. * * Please try to mark derived values with a leading underscore ('_'). */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef TYPES_H #define TYPES_H #include "glheader.h" #include "config.h" /* Hardwired parameters */ #include "glapitable.h" #include "glthread.h" #include "math/m_matrix.h" /* GLmatrix */ /** * Color channel data type. */ #if CHAN_BITS == 8 typedef GLubyte GLchan; #define CHAN_MAX 255 #define CHAN_MAXF 255.0F #define CHAN_TYPE GL_UNSIGNED_BYTE #elif CHAN_BITS == 16 typedef GLushort GLchan; #define CHAN_MAX 65535 #define CHAN_MAXF 65535.0F #define CHAN_TYPE GL_UNSIGNED_SHORT #elif CHAN_BITS == 32 typedef GLfloat GLchan; #define CHAN_MAX 1.0 #define CHAN_MAXF 1.0F #define CHAN_TYPE GL_FLOAT #else #error "illegal number of color channel bits" #endif #if ACCUM_BITS != 16 /* Software accum done with GLshort at this time */ # error "illegal number of accumulation bits" #endif /** * Stencil buffer data type. */ #if STENCIL_BITS==8 typedef GLubyte GLstencil; # define STENCIL_MAX 0xff #elif STENCIL_BITS==16 typedef GLushort GLstencil; # define STENCIL_MAX 0xffff #else # error "illegal number of stencil bits" #endif /** * Used for storing intermediate depth buffer values. * The actual depth/Z buffer might use 16 or 32-bit values. * * \note Must be 32-bits! */ typedef GLuint GLdepth; /** * Fixed point data type. */ typedef int GLfixed; /* * Fixed point arithmetic macros */ #ifndef FIXED_FRAC_BITS #define FIXED_FRAC_BITS 11 #endif #define FIXED_SHIFT FIXED_FRAC_BITS #define FIXED_ONE (1 << FIXED_SHIFT) #define FIXED_HALF (1 << (FIXED_SHIFT-1)) #define FIXED_FRAC_MASK (FIXED_ONE - 1) #define FIXED_INT_MASK (~FIXED_FRAC_MASK) #define FIXED_EPSILON 1 #define FIXED_SCALE ((float) FIXED_ONE) #define FIXED_DBL_SCALE ((double) FIXED_ONE) #define FloatToFixed(X) (IROUND((X) * FIXED_SCALE)) #define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE)) #define IntToFixed(I) ((I) << FIXED_SHIFT) #define FixedToInt(X) ((X) >> FIXED_SHIFT) #define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT) #define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK) #define FixedFloor(X) ((X) & FIXED_INT_MASK) #define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE)) #define PosFloatToFixed(X) FloatToFixed(X) #define SignedFloatToFixed(X) FloatToFixed(X) /** * \name Some forward type declarations */ /*@{*/ struct _mesa_HashTable; struct gl_pixelstore_attrib; struct gl_texture_format; struct gl_texture_image; struct gl_texture_object; typedef struct __GLcontextRec GLcontext; typedef struct __GLcontextModesRec GLvisual; typedef struct gl_framebuffer GLframebuffer; /*@}*/ /** * Indexes for vertex program attributes. * GL_NV_vertex_program aliases generic attributes over the conventional * attributes. In GL_ARB_vertex_program shader the aliasing is optional. * In GL_ARB_vertex_shader / OpenGL 2.0 the aliasing is disallowed (the * generic attributes are distinct/separate). */ enum { VERT_ATTRIB_POS = 0, VERT_ATTRIB_WEIGHT = 1, VERT_ATTRIB_NORMAL = 2, VERT_ATTRIB_COLOR0 = 3, VERT_ATTRIB_COLOR1 = 4, VERT_ATTRIB_FOG = 5, VERT_ATTRIB_SIX = 6, VERT_ATTRIB_SEVEN = 7, VERT_ATTRIB_TEX0 = 8, VERT_ATTRIB_TEX1 = 9, VERT_ATTRIB_TEX2 = 10, VERT_ATTRIB_TEX3 = 11, VERT_ATTRIB_TEX4 = 12, VERT_ATTRIB_TEX5 = 13, VERT_ATTRIB_TEX6 = 14, VERT_ATTRIB_TEX7 = 15, VERT_ATTRIB_GENERIC0 = 16, VERT_ATTRIB_GENERIC1 = 17, VERT_ATTRIB_GENERIC2 = 18, VERT_ATTRIB_GENERIC3 = 19, VERT_ATTRIB_MAX = 16 }; /** * Bitflags for vertex attributes. * These are used in bitfields in many places. */ /*@{*/ #define VERT_BIT_POS (1 << VERT_ATTRIB_POS) #define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT) #define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL) #define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0) #define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1) #define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG) #define VERT_BIT_SIX (1 << VERT_ATTRIB_SIX) #define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN) #define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0) #define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1) #define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2) #define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3) #define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4) #define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5) #define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6) #define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7) #define VERT_BIT_GENERIC0 (1 << VERT_ATTRIB_GENERIC0) #define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1) #define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2) #define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3) #define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u))) #define VERT_BIT_GENERIC(g) (1 << (VERT_ATTRIB_GENERIC0 + (g))) /*@}*/ /** * Indexes for vertex program result attributes */ #define VERT_RESULT_HPOS 0 #define VERT_RESULT_COL0 1 #define VERT_RESULT_COL1 2 #define VERT_RESULT_BFC0 3 #define VERT_RESULT_BFC1 4 #define VERT_RESULT_FOGC 5 #define VERT_RESULT_PSIZ 6 #define VERT_RESULT_TEX0 7 #define VERT_RESULT_TEX1 8 #define VERT_RESULT_TEX2 9 #define VERT_RESULT_TEX3 10 #define VERT_RESULT_TEX4 11 #define VERT_RESULT_TEX5 12 #define VERT_RESULT_TEX6 13 #define VERT_RESULT_TEX7 14 #define VERT_RESULT_MAX 15 /** * Indexes for fragment program input attributes. */ enum { FRAG_ATTRIB_WPOS = 0, FRAG_ATTRIB_COL0 = 1, FRAG_ATTRIB_COL1 = 2, FRAG_ATTRIB_FOGC = 3, FRAG_ATTRIB_TEX0 = 4, FRAG_ATTRIB_TEX1 = 5, FRAG_ATTRIB_TEX2 = 6, FRAG_ATTRIB_TEX3 = 7, FRAG_ATTRIB_TEX4 = 8, FRAG_ATTRIB_TEX5 = 9, FRAG_ATTRIB_TEX6 = 10, FRAG_ATTRIB_TEX7 = 11 }; /* * Bitflags for fragment attributes. */ /*@{*/ #define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS) #define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0) #define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1) #define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC) #define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0) #define FRAG_BIT_TEX1 (1 << FRAG_ATTRIB_TEX1) #define FRAG_BIT_TEX2 (1 << FRAG_ATTRIB_TEX2) #define FRAG_BIT_TEX3 (1 << FRAG_ATTRIB_TEX3) #define FRAG_BIT_TEX4 (1 << FRAG_ATTRIB_TEX4) #define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5) #define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6) #define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7) #define FRAG_BITS_TEX_ANY (FRAG_BIT_TEX0| \ FRAG_BIT_TEX1| \ FRAG_BIT_TEX2| \ FRAG_BIT_TEX3| \ FRAG_BIT_TEX4| \ FRAG_BIT_TEX5| \ FRAG_BIT_TEX6| \ FRAG_BIT_TEX7) /*@}*/ /** * Indexes for all renderbuffers */ enum { BUFFER_FRONT_LEFT = 0, /* the four standard color buffers */ BUFFER_BACK_LEFT = 1, BUFFER_FRONT_RIGHT = 2, BUFFER_BACK_RIGHT = 3, BUFFER_AUX0 = 4, /* optional aux buffer */ BUFFER_AUX1 = 5, BUFFER_AUX2 = 6, BUFFER_AUX3 = 7, BUFFER_DEPTH = 8, BUFFER_STENCIL = 9, BUFFER_ACCUM = 10, BUFFER_COLOR0 = 11, /* generic renderbuffers */ BUFFER_COLOR1 = 12, BUFFER_COLOR2 = 13, BUFFER_COLOR3 = 14, BUFFER_COLOR4 = 15, BUFFER_COLOR5 = 16, BUFFER_COLOR6 = 17, BUFFER_COLOR7 = 18, BUFFER_COUNT = 19 }; /** * Bit flags for all renderbuffers */ #define BUFFER_BIT_FRONT_LEFT (1 << BUFFER_FRONT_LEFT) #define BUFFER_BIT_BACK_LEFT (1 << BUFFER_BACK_LEFT) #define BUFFER_BIT_FRONT_RIGHT (1 << BUFFER_FRONT_RIGHT) #define BUFFER_BIT_BACK_RIGHT (1 << BUFFER_BACK_RIGHT) #define BUFFER_BIT_AUX0 (1 << BUFFER_AUX0) #define BUFFER_BIT_AUX1 (1 << BUFFER_AUX1) #define BUFFER_BIT_AUX2 (1 << BUFFER_AUX2) #define BUFFER_BIT_AUX3 (1 << BUFFER_AUX3) #define BUFFER_BIT_DEPTH (1 << BUFFER_DEPTH) #define BUFFER_BIT_STENCIL (1 << BUFFER_STENCIL) #define BUFFER_BIT_ACCUM (1 << BUFFER_ACCUM) #define BUFFER_BIT_COLOR0 (1 << BUFFER_COLOR0) #define BUFFER_BIT_COLOR1 (1 << BUFFER_COLOR1) #define BUFFER_BIT_COLOR2 (1 << BUFFER_COLOR2) #define BUFFER_BIT_COLOR3 (1 << BUFFER_COLOR3) #define BUFFER_BIT_COLOR4 (1 << BUFFER_COLOR4) #define BUFFER_BIT_COLOR5 (1 << BUFFER_COLOR5) #define BUFFER_BIT_COLOR6 (1 << BUFFER_COLOR6) #define BUFFER_BIT_COLOR7 (1 << BUFFER_COLOR7) /** * Data structure for color tables */ struct gl_color_table { GLenum Format; /**< GL_ALPHA, GL_RGB, GL_RGB, etc */ GLenum IntFormat; GLuint Size; /**< number of entries (rows) in table */ GLvoid *Table; /**< points to data of */ GLenum Type; /**< GL_UNSIGNED_BYTE or GL_FLOAT */ GLubyte RedSize; GLubyte GreenSize; GLubyte BlueSize; GLubyte AlphaSize; GLubyte LuminanceSize; GLubyte IntensitySize; }; /** * \name Bit flags used for updating material values. */ /*@{*/ #define MAT_ATTRIB_FRONT_AMBIENT 0 #define MAT_ATTRIB_BACK_AMBIENT 1 #define MAT_ATTRIB_FRONT_DIFFUSE 2 #define MAT_ATTRIB_BACK_DIFFUSE 3 #define MAT_ATTRIB_FRONT_SPECULAR 4 #define MAT_ATTRIB_BACK_SPECULAR 5 #define MAT_ATTRIB_FRONT_EMISSION 6 #define MAT_ATTRIB_BACK_EMISSION 7 #define MAT_ATTRIB_FRONT_SHININESS 8 #define MAT_ATTRIB_BACK_SHININESS 9 #define MAT_ATTRIB_FRONT_INDEXES 10 #define MAT_ATTRIB_BACK_INDEXES 11 #define MAT_ATTRIB_MAX 12 #define MAT_ATTRIB_AMBIENT(f) (MAT_ATTRIB_FRONT_AMBIENT+(f)) #define MAT_ATTRIB_DIFFUSE(f) (MAT_ATTRIB_FRONT_DIFFUSE+(f)) #define MAT_ATTRIB_SPECULAR(f) (MAT_ATTRIB_FRONT_SPECULAR+(f)) #define MAT_ATTRIB_EMISSION(f) (MAT_ATTRIB_FRONT_EMISSION+(f)) #define MAT_ATTRIB_SHININESS(f)(MAT_ATTRIB_FRONT_SHININESS+(f)) #define MAT_ATTRIB_INDEXES(f) (MAT_ATTRIB_FRONT_INDEXES+(f)) #define MAT_INDEX_AMBIENT 0 #define MAT_INDEX_DIFFUSE 1 #define MAT_INDEX_SPECULAR 2 #define MAT_BIT_FRONT_AMBIENT (1< ) */ GLfloat _NormDirection[4]; /**< normalized spotlight direction */ GLfloat _VP_inf_spot_attenuation; GLfloat _SpotExpTable[EXP_TABLE_SIZE][2]; /**< to replace a pow() call */ GLfloat _MatAmbient[2][3]; /**< material ambient * light ambient */ GLfloat _MatDiffuse[2][3]; /**< material diffuse * light diffuse */ GLfloat _MatSpecular[2][3]; /**< material spec * light specular */ GLfloat _dli; /**< CI diffuse light intensity */ GLfloat _sli; /**< CI specular light intensity */ /*@}*/ }; /** * Light model state. */ struct gl_lightmodel { GLfloat Ambient[4]; /**< ambient color */ GLboolean LocalViewer; /**< Local (or infinite) view point? */ GLboolean TwoSide; /**< Two (or one) sided lighting? */ GLenum ColorControl; /**< either GL_SINGLE_COLOR * or GL_SEPARATE_SPECULAR_COLOR */ }; /** * Material state. */ struct gl_material { GLfloat Attrib[MAT_ATTRIB_MAX][4]; }; /** * Accumulation buffer attribute group (GL_ACCUM_BUFFER_BIT) */ struct gl_accum_attrib { GLfloat ClearColor[4]; /**< Accumulation buffer clear color */ }; /** * Color buffer attribute group (GL_COLOR_BUFFER_BIT). */ struct gl_colorbuffer_attrib { GLuint ClearIndex; /**< Index to use for glClear */ GLclampf ClearColor[4]; /**< Color to use for glClear */ GLuint IndexMask; /**< Color index write mask */ GLubyte ColorMask[4]; /**< Each flag is 0xff or 0x0 */ GLenum DrawBuffer[MAX_DRAW_BUFFERS]; /**< Which buffer to draw into */ /** * \name alpha testing */ /*@{*/ GLboolean AlphaEnabled; /**< Alpha test enabled flag */ GLenum AlphaFunc; /**< Alpha test function */ GLclampf AlphaRef; /**< Alpha reference value */ /*@}*/ /** * \name Blending */ /*@{*/ GLboolean BlendEnabled; /**< Blending enabled flag */ GLenum BlendSrcRGB; /**< Blending source operator */ GLenum BlendDstRGB; /**< Blending destination operator */ GLenum BlendSrcA; /**< GL_INGR_blend_func_separate */ GLenum BlendDstA; /**< GL_INGR_blend_func_separate */ GLenum BlendEquationRGB; /**< Blending equation */ GLenum BlendEquationA; /**< GL_EXT_blend_equation_separate */ GLfloat BlendColor[4]; /**< Blending color */ /*@}*/ /** * \name Logic op */ /*@{*/ GLenum LogicOp; /**< Logic operator */ GLboolean IndexLogicOpEnabled; /**< Color index logic op enabled flag */ GLboolean ColorLogicOpEnabled; /**< RGBA logic op enabled flag */ GLboolean _LogicOpEnabled; /**< RGBA logic op + EXT_blend_logic_op enabled flag */ /*@}*/ GLboolean DitherFlag; /**< Dither enable flag */ GLenum ClampFragmentColor; /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */ GLenum ClampReadColor; /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */ }; /** * Current attribute group (GL_CURRENT_BIT). */ struct gl_current_attrib { /** * \name Values valid only when FLUSH_VERTICES has been called. */ /*@{*/ GLfloat Attrib[VERT_ATTRIB_MAX][4]; /**< Current vertex attributes * indexed by VERT_ATTRIB_* */ GLfloat Index; /**< Current color index */ GLboolean EdgeFlag; /**< Current edge flag */ /*@}*/ /** * \name Values are always valid. * * \note BTW, note how similar this set of attributes is to the SWvertex * data type in the software rasterizer... */ /*@{*/ GLfloat RasterPos[4]; /**< Current raster position */ GLfloat RasterDistance; /**< Current raster distance */ GLfloat RasterColor[4]; /**< Current raster color */ GLfloat RasterSecondaryColor[4]; /**< Current raster secondary color */ GLfloat RasterIndex; /**< Current raster index */ GLfloat RasterTexCoords[MAX_TEXTURE_UNITS][4];/**< Current raster texcoords */ GLboolean RasterPosValid; /**< Raster pos valid flag */ /*@}*/ }; /** * Depth buffer attribute group (GL_DEPTH_BUFFER_BIT). */ struct gl_depthbuffer_attrib { GLenum Func; /**< Function for depth buffer compare */ GLclampd Clear; /**< Value to clear depth buffer to */ GLboolean Test; /**< Depth buffering enabled flag */ GLboolean Mask; /**< Depth buffer writable? */ GLboolean OcclusionTest; /**< GL_HP_occlusion_test */ GLboolean BoundsTest; /**< GL_EXT_depth_bounds_test */ GLfloat BoundsMin, BoundsMax;/**< GL_EXT_depth_bounds_test */ }; /** * glEnable()/glDisable() attribute group (GL_ENABLE_BIT). */ struct gl_enable_attrib { GLboolean AlphaTest; GLboolean AutoNormal; GLboolean Blend; GLuint ClipPlanes; GLboolean ColorMaterial; GLboolean ColorTable; /* SGI_color_table */ GLboolean PostColorMatrixColorTable; /* SGI_color_table */ GLboolean PostConvolutionColorTable; /* SGI_color_table */ GLboolean Convolution1D; GLboolean Convolution2D; GLboolean Separable2D; GLboolean CullFace; GLboolean DepthTest; GLboolean Dither; GLboolean Fog; GLboolean Histogram; GLboolean Light[MAX_LIGHTS]; GLboolean Lighting; GLboolean LineSmooth; GLboolean LineStipple; GLboolean IndexLogicOp; GLboolean ColorLogicOp; GLboolean Map1Color4; GLboolean Map1Index; GLboolean Map1Normal; GLboolean Map1TextureCoord1; GLboolean Map1TextureCoord2; GLboolean Map1TextureCoord3; GLboolean Map1TextureCoord4; GLboolean Map1Vertex3; GLboolean Map1Vertex4; GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */ GLboolean Map2Color4; GLboolean Map2Index; GLboolean Map2Normal; GLboolean Map2TextureCoord1; GLboolean Map2TextureCoord2; GLboolean Map2TextureCoord3; GLboolean Map2TextureCoord4; GLboolean Map2Vertex3; GLboolean Map2Vertex4; GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */ GLboolean MinMax; GLboolean Normalize; GLboolean PixelTexture; GLboolean PointSmooth; GLboolean PolygonOffsetPoint; GLboolean PolygonOffsetLine; GLboolean PolygonOffsetFill; GLboolean PolygonSmooth; GLboolean PolygonStipple; GLboolean RescaleNormals; GLboolean Scissor; GLboolean Stencil; GLboolean StencilTwoSide; /* GL_EXT_stencil_two_side */ GLboolean MultisampleEnabled; /* GL_ARB_multisample */ GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */ GLboolean SampleAlphaToOne; /* GL_ARB_multisample */ GLboolean SampleCoverage; /* GL_ARB_multisample */ GLboolean SampleCoverageInvert; /* GL_ARB_multisample */ GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */ GLuint Texture[MAX_TEXTURE_IMAGE_UNITS]; GLuint TexGen[MAX_TEXTURE_COORD_UNITS]; /* SGI_texture_color_table */ GLboolean TextureColorTable[MAX_TEXTURE_IMAGE_UNITS]; /* GL_NV_vertex_program */ GLboolean VertexProgram; GLboolean VertexProgramPointSize; GLboolean VertexProgramTwoSide; /* GL_ARB_point_sprite / GL_NV_point_sprite */ GLboolean PointSprite; GLboolean FragmentShaderATI; }; /** * Evaluator attribute group (GL_EVAL_BIT). */ struct gl_eval_attrib { /** * \name Enable bits */ /*@{*/ GLboolean Map1Color4; GLboolean Map1Index; GLboolean Map1Normal; GLboolean Map1TextureCoord1; GLboolean Map1TextureCoord2; GLboolean Map1TextureCoord3; GLboolean Map1TextureCoord4; GLboolean Map1Vertex3; GLboolean Map1Vertex4; GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */ GLboolean Map2Color4; GLboolean Map2Index; GLboolean Map2Normal; GLboolean Map2TextureCoord1; GLboolean Map2TextureCoord2; GLboolean Map2TextureCoord3; GLboolean Map2TextureCoord4; GLboolean Map2Vertex3; GLboolean Map2Vertex4; GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */ GLboolean AutoNormal; /*@}*/ /** * \name Map Grid endpoints and divisions and calculated du values */ /*@{*/ GLint MapGrid1un; GLfloat MapGrid1u1, MapGrid1u2, MapGrid1du; GLint MapGrid2un, MapGrid2vn; GLfloat MapGrid2u1, MapGrid2u2, MapGrid2du; GLfloat MapGrid2v1, MapGrid2v2, MapGrid2dv; /*@}*/ }; /** * Fog attribute group (GL_FOG_BIT). */ struct gl_fog_attrib { GLboolean Enabled; /**< Fog enabled flag */ GLfloat Color[4]; /**< Fog color */ GLfloat Density; /**< Density >= 0.0 */ GLfloat Start; /**< Start distance in eye coords */ GLfloat End; /**< End distance in eye coords */ GLfloat Index; /**< Fog index */ GLenum Mode; /**< Fog mode */ GLboolean ColorSumEnabled; GLenum FogCoordinateSource; /**< GL_EXT_fog_coord */ }; /** * Hint attribute group (GL_HINT_BIT). * * Values are always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE. */ struct gl_hint_attrib { GLenum PerspectiveCorrection; GLenum PointSmooth; GLenum LineSmooth; GLenum PolygonSmooth; GLenum Fog; GLenum ClipVolumeClipping; /**< GL_EXT_clip_volume_hint */ GLenum TextureCompression; /**< GL_ARB_texture_compression */ GLenum GenerateMipmap; /**< GL_SGIS_generate_mipmap */ GLenum FragmentShaderDerivative; /**< GL_ARB_fragment_shader */ }; /** * Histogram attributes. */ struct gl_histogram_attrib { GLuint Width; /**< number of table entries */ GLint Format; /**< GL_ALPHA, GL_RGB, etc */ GLuint Count[HISTOGRAM_TABLE_SIZE][4]; /**< the histogram */ GLboolean Sink; /**< terminate image transfer? */ GLubyte RedSize; /**< Bits per counter */ GLubyte GreenSize; GLubyte BlueSize; GLubyte AlphaSize; GLubyte LuminanceSize; }; /** * Color Min/max state. */ struct gl_minmax_attrib { GLenum Format; GLboolean Sink; GLfloat Min[4], Max[4]; /**< RGBA */ }; /** * Image convolution state. */ struct gl_convolution_attrib { GLenum Format; GLenum InternalFormat; GLuint Width; GLuint Height; GLfloat Filter[MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_HEIGHT * 4]; }; /** * Light state flags. */ /*@{*/ #define LIGHT_SPOT 0x1 #define LIGHT_LOCAL_VIEWER 0x2 #define LIGHT_POSITIONAL 0x4 #define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER) /*@}*/ /** * Lighting attribute group (GL_LIGHT_BIT). */ struct gl_light_attrib { struct gl_light Light[MAX_LIGHTS]; /**< Array of light sources */ struct gl_lightmodel Model; /**< Lighting model */ /** * Must flush FLUSH_VERTICES before referencing: */ /*@{*/ struct gl_material Material; /**< Includes front & back values */ /*@}*/ GLboolean Enabled; /**< Lighting enabled flag */ GLenum ShadeModel; /**< GL_FLAT or GL_SMOOTH */ GLenum ColorMaterialFace; /**< GL_FRONT, BACK or FRONT_AND_BACK */ GLenum ColorMaterialMode; /**< GL_AMBIENT, GL_DIFFUSE, etc */ GLuint ColorMaterialBitmask; /**< bitmask formed from Face and Mode */ GLboolean ColorMaterialEnabled; struct gl_light EnabledList; /**< List sentinel */ /** * Derived state for optimizations: */ /*@{*/ GLboolean _NeedEyeCoords; GLboolean _NeedVertices; /**< Use fast shader? */ GLuint _Flags; /**< LIGHT_* flags, see above */ GLfloat _BaseColor[2][3]; /*@}*/ }; /** * Line attribute group (GL_LINE_BIT). */ struct gl_line_attrib { GLboolean SmoothFlag; /**< GL_LINE_SMOOTH enabled? */ GLboolean StippleFlag; /**< GL_LINE_STIPPLE enabled? */ GLushort StipplePattern; /**< Stipple pattern */ GLint StippleFactor; /**< Stipple repeat factor */ GLfloat Width; /**< Line width */ GLfloat _Width; /**< Clamped Line width */ }; /** * Display list attribute group (GL_LIST_BIT). */ struct gl_list_attrib { GLuint ListBase; }; /** * Used by device drivers to hook new commands into display lists. */ struct gl_list_instruction { GLuint Size; void (*Execute)( GLcontext *ctx, void *data ); void (*Destroy)( GLcontext *ctx, void *data ); void (*Print)( GLcontext *ctx, void *data ); }; #define MAX_DLIST_EXT_OPCODES 16 /** * Used by device drivers to hook new commands into display lists. */ struct gl_list_extensions { struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES]; GLuint NumOpcodes; }; /** * Multisample attribute group (GL_MULTISAMPLE_BIT). */ struct gl_multisample_attrib { GLboolean Enabled; GLboolean SampleAlphaToCoverage; GLboolean SampleAlphaToOne; GLboolean SampleCoverage; GLfloat SampleCoverageValue; GLboolean SampleCoverageInvert; }; /** * Pixel attribute group (GL_PIXEL_MODE_BIT). */ struct gl_pixel_attrib { GLenum ReadBuffer; /**< source buffer for glRead/CopyPixels() */ GLfloat RedBias, RedScale; GLfloat GreenBias, GreenScale; GLfloat BlueBias, BlueScale; GLfloat AlphaBias, AlphaScale; GLfloat DepthBias, DepthScale; GLint IndexShift, IndexOffset; GLboolean MapColorFlag; GLboolean MapStencilFlag; GLfloat ZoomX, ZoomY; /* XXX move these out of gl_pixel_attrib */ GLint MapStoSsize; /**< Size of each pixel map */ GLint MapItoIsize; GLint MapItoRsize; GLint MapItoGsize; GLint MapItoBsize; GLint MapItoAsize; GLint MapRtoRsize; GLint MapGtoGsize; GLint MapBtoBsize; GLint MapAtoAsize; GLint MapStoS[MAX_PIXEL_MAP_TABLE]; /**< Pixel map tables */ GLfloat MapItoI[MAX_PIXEL_MAP_TABLE]; GLfloat MapItoR[MAX_PIXEL_MAP_TABLE]; GLfloat MapItoG[MAX_PIXEL_MAP_TABLE]; GLfloat MapItoB[MAX_PIXEL_MAP_TABLE]; GLfloat MapItoA[MAX_PIXEL_MAP_TABLE]; GLubyte MapItoR8[MAX_PIXEL_MAP_TABLE]; /**< converted to 8-bit color */ GLubyte MapItoG8[MAX_PIXEL_MAP_TABLE]; GLubyte MapItoB8[MAX_PIXEL_MAP_TABLE]; GLubyte MapItoA8[MAX_PIXEL_MAP_TABLE]; GLfloat MapRtoR[MAX_PIXEL_MAP_TABLE]; GLfloat MapGtoG[MAX_PIXEL_MAP_TABLE]; GLfloat MapBtoB[MAX_PIXEL_MAP_TABLE]; GLfloat MapAtoA[MAX_PIXEL_MAP_TABLE]; /** GL_EXT_histogram */ GLboolean HistogramEnabled; GLboolean MinMaxEnabled; /** GL_SGIS_pixel_texture */ GLboolean PixelTextureEnabled; GLenum FragmentRgbSource; GLenum FragmentAlphaSource; /** GL_SGI_color_matrix */ GLfloat PostColorMatrixScale[4]; /**< RGBA */ GLfloat PostColorMatrixBias[4]; /**< RGBA */ /** GL_SGI_color_table */ GLfloat ColorTableScale[4]; GLfloat ColorTableBias[4]; GLboolean ColorTableEnabled; GLfloat PCCTscale[4]; GLfloat PCCTbias[4]; GLboolean PostConvolutionColorTableEnabled; GLfloat PCMCTscale[4]; GLfloat PCMCTbias[4]; GLboolean PostColorMatrixColorTableEnabled; /** GL_SGI_texture_color_table */ GLfloat TextureColorTableScale[4]; GLfloat TextureColorTableBias[4]; /** Convolution */ GLboolean Convolution1DEnabled; GLboolean Convolution2DEnabled; GLboolean Separable2DEnabled; GLfloat ConvolutionBorderColor[3][4]; GLenum ConvolutionBorderMode[3]; GLfloat ConvolutionFilterScale[3][4]; GLfloat ConvolutionFilterBias[3][4]; GLfloat PostConvolutionScale[4]; /**< RGBA */ GLfloat PostConvolutionBias[4]; /**< RGBA */ }; /** * Point attribute group (GL_POINT_BIT). */ struct gl_point_attrib { GLboolean SmoothFlag; /**< True if GL_POINT_SMOOTH is enabled */ GLfloat Size; /**< User-specified point size */ GLfloat _Size; /**< Size clamped to Const.Min/MaxPointSize */ GLfloat Params[3]; /**< GL_EXT_point_parameters */ GLfloat MinSize, MaxSize; /**< GL_EXT_point_parameters */ GLfloat Threshold; /**< GL_EXT_point_parameters */ GLboolean _Attenuated; /**< True if Params != [1, 0, 0] */ GLboolean PointSprite; /**< GL_NV_point_sprite / GL_NV_point_sprite */ GLboolean CoordReplace[MAX_TEXTURE_UNITS]; /**< GL_NV/ARB_point_sprite */ GLenum SpriteRMode; /**< GL_NV_point_sprite (only!) */ GLenum SpriteOrigin; /**< GL_ARB_point_sprite */ }; /** * Polygon attribute group (GL_POLYGON_BIT). */ struct gl_polygon_attrib { GLenum FrontFace; /**< Either GL_CW or GL_CCW */ GLenum FrontMode; /**< Either GL_POINT, GL_LINE or GL_FILL */ GLenum BackMode; /**< Either GL_POINT, GL_LINE or GL_FILL */ GLboolean _FrontBit; /**< 0=GL_CCW, 1=GL_CW */ GLboolean CullFlag; /**< Culling on/off flag */ GLboolean SmoothFlag; /**< True if GL_POLYGON_SMOOTH is enabled */ GLboolean StippleFlag; /**< True if GL_POLYGON_STIPPLE is enabled */ GLenum CullFaceMode; /**< Culling mode GL_FRONT or GL_BACK */ GLfloat OffsetFactor; /**< Polygon offset factor, from user */ GLfloat OffsetUnits; /**< Polygon offset units, from user */ GLboolean OffsetPoint; /**< Offset in GL_POINT mode */ GLboolean OffsetLine; /**< Offset in GL_LINE mode */ GLboolean OffsetFill; /**< Offset in GL_FILL mode */ }; /** * Scissor attributes (GL_SCISSOR_BIT). */ struct gl_scissor_attrib { GLboolean Enabled; /**< Scissor test enabled? */ GLint X, Y; /**< Lower left corner of box */ GLsizei Width, Height; /**< Size of box */ }; /** * Stencil attribute group (GL_STENCIL_BUFFER_BIT). */ struct gl_stencil_attrib { GLboolean Enabled; /**< Enabled flag */ GLboolean TestTwoSide; /**< GL_EXT_stencil_two_side */ GLubyte ActiveFace; /**< GL_EXT_stencil_two_side (0 or 1) */ GLenum Function[2]; /**< Stencil function */ GLenum FailFunc[2]; /**< Fail function */ GLenum ZPassFunc[2]; /**< Depth buffer pass function */ GLenum ZFailFunc[2]; /**< Depth buffer fail function */ GLstencil Ref[2]; /**< Reference value */ GLstencil ValueMask[2]; /**< Value mask */ GLstencil WriteMask[2]; /**< Write mask */ GLstencil Clear; /**< Clear value */ }; #define NUM_TEXTURE_TARGETS 5 /* 1D, 2D, 3D, CUBE and RECT */ /** * An index for each type of texture object */ /*@{*/ #define TEXTURE_1D_INDEX 0 #define TEXTURE_2D_INDEX 1 #define TEXTURE_3D_INDEX 2 #define TEXTURE_CUBE_INDEX 3 #define TEXTURE_RECT_INDEX 4 /*@}*/ /** * Bit flags for each type of texture object * Used for Texture.Unit[]._ReallyEnabled flags. */ /*@{*/ #define TEXTURE_1D_BIT (1 << TEXTURE_1D_INDEX) #define TEXTURE_2D_BIT (1 << TEXTURE_2D_INDEX) #define TEXTURE_3D_BIT (1 << TEXTURE_3D_INDEX) #define TEXTURE_CUBE_BIT (1 << TEXTURE_CUBE_INDEX) #define TEXTURE_RECT_BIT (1 << TEXTURE_RECT_INDEX) /*@}*/ /** * TexGenEnabled flags. */ /*@{*/ #define S_BIT 1 #define T_BIT 2 #define R_BIT 4 #define Q_BIT 8 /*@}*/ /** * Bit flag versions of the corresponding GL_ constants. */ /*@{*/ #define TEXGEN_SPHERE_MAP 0x1 #define TEXGEN_OBJ_LINEAR 0x2 #define TEXGEN_EYE_LINEAR 0x4 #define TEXGEN_REFLECTION_MAP_NV 0x8 #define TEXGEN_NORMAL_MAP_NV 0x10 #define TEXGEN_NEED_NORMALS (TEXGEN_SPHERE_MAP | \ TEXGEN_REFLECTION_MAP_NV | \ TEXGEN_NORMAL_MAP_NV) #define TEXGEN_NEED_EYE_COORD (TEXGEN_SPHERE_MAP | \ TEXGEN_REFLECTION_MAP_NV | \ TEXGEN_NORMAL_MAP_NV | \ TEXGEN_EYE_LINEAR) /*@}*/ /* A selection of state flags to make driver and module's lives easier. */ #define ENABLE_TEXGEN0 0x1 #define ENABLE_TEXGEN1 0x2 #define ENABLE_TEXGEN2 0x4 #define ENABLE_TEXGEN3 0x8 #define ENABLE_TEXGEN4 0x10 #define ENABLE_TEXGEN5 0x20 #define ENABLE_TEXGEN6 0x40 #define ENABLE_TEXGEN7 0x80 #define ENABLE_TEXMAT0 0x1 /* Ie. not the identity matrix */ #define ENABLE_TEXMAT1 0x2 #define ENABLE_TEXMAT2 0x4 #define ENABLE_TEXMAT3 0x8 #define ENABLE_TEXMAT4 0x10 #define ENABLE_TEXMAT5 0x20 #define ENABLE_TEXMAT6 0x40 #define ENABLE_TEXMAT7 0x80 #define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i)) #define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i)) /** * Texel fetch function prototype. We use texel fetch functions to * extract RGBA, color indexes and depth components out of 1D, 2D and 3D * texture images. These functions help to isolate us from the gritty * details of all the various texture image encodings. * * \param texImage texture image. * \param col texel column. * \param row texel row. * \param img texel image level/layer. * \param texelOut output texel (up to 4 GLchans) */ typedef void (*FetchTexelFuncC)( const struct gl_texture_image *texImage, GLint col, GLint row, GLint img, GLchan *texelOut ); /** * As above, but returns floats. * Used for depth component images and for upcoming signed/float * texture images. */ typedef void (*FetchTexelFuncF)( const struct gl_texture_image *texImage, GLint col, GLint row, GLint img, GLfloat *texelOut ); typedef void (*StoreTexelFunc)(struct gl_texture_image *texImage, GLint col, GLint row, GLint img, const void *texel); /** * TexImage store function. This is called by the glTex[Sub]Image * functions and is responsible for converting the user-specified texture * image into a specific (hardware) image format. */ typedef GLboolean (*StoreTexImageFunc)(GLcontext *ctx, GLuint dims, GLenum baseInternalFormat, const struct gl_texture_format *dstFormat, GLvoid *dstAddr, GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, GLint dstRowStride, GLint dstImageStride, GLint srcWidth, GLint srcHeight, GLint srcDepth, GLenum srcFormat, GLenum srcType, const GLvoid *srcAddr, const struct gl_pixelstore_attrib *srcPacking); /** * Texture format record */ struct gl_texture_format { GLint MesaFormat; /**< One of the MESA_FORMAT_* values */ GLenum BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_ALPHA, * GL_LUMINANCE, GL_LUMINANCE_ALPHA, * GL_INTENSITY, GL_COLOR_INDEX or * GL_DEPTH_COMPONENT. */ GLenum DataType; /**< GL_FLOAT or GL_UNSIGNED_NORMALIZED_ARB */ GLubyte RedBits; /**< Bits per texel component */ GLubyte GreenBits; /**< These are just rough approximations for */ GLubyte BlueBits; /**< compressed texture formats. */ GLubyte AlphaBits; GLubyte LuminanceBits; GLubyte IntensityBits; GLubyte IndexBits; GLubyte DepthBits; GLuint TexelBytes; /**< Bytes per texel, 0 if compressed format */ StoreTexImageFunc StoreImage; /** * \name Texel fetch function pointers */ /*@{*/ FetchTexelFuncC FetchTexel1D; FetchTexelFuncC FetchTexel2D; FetchTexelFuncC FetchTexel3D; FetchTexelFuncF FetchTexel1Df; FetchTexelFuncF FetchTexel2Df; FetchTexelFuncF FetchTexel3Df; /*@}*/ StoreTexelFunc StoreTexel; }; /** * Texture image state. Describes the dimensions of a texture image, * the texel format and pointers to Texel Fetch functions. */ struct gl_texture_image { GLenum Format; /**< Either GL_RGB, GL_RGBA, GL_ALPHA, * GL_LUMINANCE, GL_LUMINANCE_ALPHA, * GL_INTENSITY, GL_COLOR_INDEX or * GL_DEPTH_COMPONENT only. * Used for choosing TexEnv arithmetic. */ GLint IntFormat; /**< Internal format as given by the user */ GLuint Border; /**< 0 or 1 */ GLuint Width; /**< = 2^WidthLog2 + 2*Border */ GLuint Height; /**< = 2^HeightLog2 + 2*Border */ GLuint Depth; /**< = 2^DepthLog2 + 2*Border */ GLuint RowStride; /**< == Width unless IsClientData and padded */ GLuint Width2; /**< = Width - 2*Border */ GLuint Height2; /**< = Height - 2*Border */ GLuint Depth2; /**< = Depth - 2*Border */ GLuint WidthLog2; /**< = log2(Width2) */ GLuint HeightLog2; /**< = log2(Height2) */ GLuint DepthLog2; /**< = log2(Depth2) */ GLuint MaxLog2; /**< = MAX(WidthLog2, HeightLog2) */ GLfloat WidthScale; /**< used for mipmap LOD computation */ GLfloat HeightScale; /**< used for mipmap LOD computation */ GLfloat DepthScale; /**< used for mipmap LOD computation */ GLvoid *Data; /**< Image data, accessed via FetchTexel() */ GLboolean IsClientData; /**< Data owned by client? */ GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */ const struct gl_texture_format *TexFormat; struct gl_texture_object *TexObject; /**< Pointer back to parent object */ FetchTexelFuncC FetchTexelc; /**< GLchan texel fetch function pointer */ FetchTexelFuncF FetchTexelf; /**< Float texel fetch function pointer */ GLboolean IsCompressed; /**< GL_ARB_texture_compression */ GLuint CompressedSize; /**< GL_ARB_texture_compression */ /** * \name For device driver: */ /*@{*/ void *DriverData; /**< Arbitrary device driver data */ /*@}*/ }; /** * Indexes for cube map faces. */ /*@{*/ #define FACE_POS_X 0 #define FACE_NEG_X 1 #define FACE_POS_Y 2 #define FACE_NEG_Y 3 #define FACE_POS_Z 4 #define FACE_NEG_Z 5 #define MAX_FACES 6 /*@}*/ /** * Texture object state. Contains the array of mipmap images, border color, * wrap modes, filter modes, shadow/texcompare state, and the per-texture * color palette. */ struct gl_texture_object { _glthread_Mutex Mutex; /**< for thread safety */ GLint RefCount; /**< reference count */ GLuint Name; /**< the user-visible texture object ID */ GLenum Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */ GLfloat Priority; /**< in [0,1] */ GLfloat BorderColor[4]; /**< unclamped */ GLchan _BorderChan[4]; /**< clamped, as GLchan */ GLenum WrapS; /**< S-axis texture image wrap mode */ GLenum WrapT; /**< T-axis texture image wrap mode */ GLenum WrapR; /**< R-axis texture image wrap mode */ GLenum MinFilter; /**< minification filter */ GLenum MagFilter; /**< magnification filter */ GLfloat MinLod; /**< min lambda, OpenGL 1.2 */ GLfloat MaxLod; /**< max lambda, OpenGL 1.2 */ GLfloat LodBias; /**< OpenGL 1.4 */ GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */ GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */ GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ GLboolean CompareFlag; /**< GL_SGIX_shadow */ GLenum CompareOperator; /**< GL_SGIX_shadow */ GLfloat ShadowAmbient; /**< GL_ARB_shadow_ambient */ GLenum CompareMode; /**< GL_ARB_shadow */ GLenum CompareFunc; /**< GL_ARB_shadow */ GLenum DepthMode; /**< GL_ARB_depth_texture */ GLint _MaxLevel; /**< actual max mipmap level (q in the spec) */ GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - b in spec) */ GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */ GLboolean _IsPowerOfTwo; /**< Are all image dimensions powers of two? */ GLboolean Complete; /**< Is texture object complete? */ /** Actual texture images, indexed by [cube face] and [mipmap level] */ struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS]; /** GL_EXT_paletted_texture */ struct gl_color_table Palette; /** * \name For device driver. * Note: instead of attaching driver data to this pointer, it's preferable * to instead use this struct as a base class for your own texture object * class. Driver->NewTextureObject() can be used to implement the * allocation. */ void *DriverData; /**< Arbitrary device driver data */ }; /** * Texture combine environment state. * * \todo * If GL_NV_texture_env_combine4 is ever supported, the arrays in this * structure will need to be expanded for 4 elements. */ struct gl_tex_env_combine_state { GLenum ModeRGB; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */ GLenum ModeA; /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */ GLenum SourceRGB[3]; /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */ GLenum SourceA[3]; /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */ GLenum OperandRGB[3]; /**< SRC_COLOR, ONE_MINUS_SRC_COLOR, etc */ GLenum OperandA[3]; /**< SRC_ALPHA, ONE_MINUS_SRC_ALPHA, etc */ GLuint ScaleShiftRGB; /**< 0, 1 or 2 */ GLuint ScaleShiftA; /**< 0, 1 or 2 */ GLuint _NumArgsRGB; /**< Number of inputs used for the combine mode. */ GLuint _NumArgsA; /**< Number of inputs used for the combine mode. */ }; /** * Texture unit state. Contains enable flags, texture environment/function/ * combiners, texgen state, pointers to current texture objects and * post-filter color tables. */ struct gl_texture_unit { GLuint Enabled; /**< bitmask of TEXTURE_*_BIT flags */ GLuint _ReallyEnabled; /**< 0 or exactly one of TEXTURE_*_BIT flags */ GLenum EnvMode; /**< GL_MODULATE, GL_DECAL, GL_BLEND, etc. */ GLfloat EnvColor[4]; GLuint TexGenEnabled; /**< Bitwise-OR of [STRQ]_BIT values */ /** \name Tex coord generation mode * Either GL_OBJECT_LINEAR, GL_EYE_LINEAR or GL_SPHERE_MAP. */ /*@{*/ GLenum GenModeS; GLenum GenModeT; GLenum GenModeR; GLenum GenModeQ; /*@}*/ GLuint _GenBitS; GLuint _GenBitT; GLuint _GenBitR; GLuint _GenBitQ; GLuint _GenFlags; /**< bitwise or of GenBit[STRQ] */ GLfloat ObjectPlaneS[4]; GLfloat ObjectPlaneT[4]; GLfloat ObjectPlaneR[4]; GLfloat ObjectPlaneQ[4]; GLfloat EyePlaneS[4]; GLfloat EyePlaneT[4]; GLfloat EyePlaneR[4]; GLfloat EyePlaneQ[4]; GLfloat LodBias; /**< for biasing mipmap levels */ /** * \name GL_EXT_texture_env_combine */ struct gl_tex_env_combine_state Combine; /** * Derived state based on \c EnvMode and the \c BaseFormat of the * currently enabled texture. */ struct gl_tex_env_combine_state _EnvMode; /** * Currently enabled combiner state. This will point to either * \c Combine or \c _EnvMode. */ struct gl_tex_env_combine_state *_CurrentCombine; struct gl_texture_object *Current1D; struct gl_texture_object *Current2D; struct gl_texture_object *Current3D; struct gl_texture_object *CurrentCubeMap; /**< GL_ARB_texture_cube_map */ struct gl_texture_object *CurrentRect; /**< GL_NV_texture_rectangle */ struct gl_texture_object *_Current; /**< Points to really enabled tex obj */ struct gl_texture_object Saved1D; /**< only used by glPush/PopAttrib */ struct gl_texture_object Saved2D; struct gl_texture_object Saved3D; struct gl_texture_object SavedCubeMap; struct gl_texture_object SavedRect; /* GL_SGI_texture_color_table */ struct gl_color_table ColorTable; struct gl_color_table ProxyColorTable; GLboolean ColorTableEnabled; }; struct texenvprog_cache { GLuint hash; void *key; void *data; struct texenvprog_cache *next; }; /** * Texture attribute group (GL_TEXTURE_BIT). */ struct gl_texture_attrib { /** * name multitexture */ /**@{*/ GLuint CurrentUnit; /**< Active texture unit */ GLuint _EnabledUnits; /**< one bit set for each really-enabled unit */ GLuint _EnabledCoordUnits; /**< one bit per enabled coordinate unit */ GLuint _GenFlags; /**< for texgen */ GLuint _TexGenEnabled; GLuint _TexMatEnabled; /**@}*/ struct gl_texture_unit Unit[MAX_TEXTURE_UNITS]; struct gl_texture_object *Proxy1D; struct gl_texture_object *Proxy2D; struct gl_texture_object *Proxy3D; struct gl_texture_object *ProxyCubeMap; struct gl_texture_object *ProxyRect; /** GL_EXT_shared_texture_palette */ GLboolean SharedPalette; struct gl_color_table Palette; /** Cached texenv fragment programs */ struct texenvprog_cache *env_fp_cache; }; /** * Transformation attribute group (GL_TRANSFORM_BIT). */ struct gl_transform_attrib { GLenum MatrixMode; /**< Matrix mode */ GLfloat EyeUserPlane[MAX_CLIP_PLANES][4]; /**< User clip planes */ GLfloat _ClipUserPlane[MAX_CLIP_PLANES][4]; /**< derived */ GLuint ClipPlanesEnabled; /**< on/off bitmask */ GLboolean Normalize; /**< Normalize all normals? */ GLboolean RescaleNormals; /**< GL_EXT_rescale_normal */ GLboolean RasterPositionUnclipped; /**< GL_IBM_rasterpos_clip */ GLboolean CullVertexFlag; /**< True if GL_CULL_VERTEX_EXT is enabled */ GLfloat CullEyePos[4]; GLfloat CullObjPos[4]; }; /** * Viewport attribute group (GL_VIEWPORT_BIT). */ struct gl_viewport_attrib { GLint X, Y; /**< position */ GLsizei Width, Height; /**< size */ GLfloat Near, Far; /**< Depth buffer range */ GLmatrix _WindowMap; /**< Mapping transformation as a matrix. */ }; /** * Node for the attribute stack. */ struct gl_attrib_node { GLbitfield kind; void *data; struct gl_attrib_node *next; }; /** * GL_ARB_vertex/pixel_buffer_object buffer object */ struct gl_buffer_object { GLint RefCount; GLuint Name; GLenum Usage; GLenum Access; GLvoid *Pointer; /**< Only valid while buffer is mapped */ GLsizeiptrARB Size; /**< Size of storage in bytes */ GLubyte *Data; /**< Location of storage either in RAM or VRAM. */ GLboolean OnCard; /**< Is buffer in VRAM? (hardware drivers) */ }; /** * Client pixel packing/unpacking attributes */ struct gl_pixelstore_attrib { GLint Alignment; GLint RowLength; GLint SkipPixels; GLint SkipRows; GLint ImageHeight; /**< for GL_EXT_texture3D */ GLint SkipImages; /**< for GL_EXT_texture3D */ GLboolean SwapBytes; GLboolean LsbFirst; GLboolean ClientStorage; /**< GL_APPLE_client_storage */ GLboolean Invert; /**< GL_MESA_pack_invert */ struct gl_buffer_object *BufferObj; /**< GL_ARB_pixel_buffer_object */ }; #define CA_CLIENT_DATA 0x1 /**< Data not allocated by mesa */ /** * Client vertex array attributes */ struct gl_client_array { GLint Size; /**< components per element (1,2,3,4) */ GLenum Type; /**< datatype: GL_FLOAT, GL_INT, etc */ GLsizei Stride; /**< user-specified stride */ GLsizei StrideB; /**< actual stride in bytes */ const GLubyte *Ptr; /**< Points to array data */ GLuint Enabled; /**< one of the _NEW_ARRAY_ bits */ GLboolean Normalized; /**< GL_ARB_vertex_program */ /**< GL_ARB_vertex_buffer_object */ struct gl_buffer_object *BufferObj; GLuint _MaxElement; GLuint Flags; }; /** * Vertex array state */ struct gl_array_attrib { struct gl_client_array Vertex; /**< client data descriptors */ struct gl_client_array Normal; struct gl_client_array Color; struct gl_client_array SecondaryColor; struct gl_client_array FogCoord; struct gl_client_array Index; struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS]; struct gl_client_array EdgeFlag; struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX]; /**< GL_NV_vertex_program */ GLint ActiveTexture; /**< Client Active Texture */ GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */ GLuint LockCount; /**< GL_EXT_compiled_vertex_array */ GLuint _Enabled; /**< _NEW_ARRAY_* - bit set if array enabled */ GLuint NewState; /**< _NEW_ARRAY_* */ #if FEATURE_ARB_vertex_buffer_object struct gl_buffer_object *NullBufferObj; struct gl_buffer_object *ArrayBufferObj; struct gl_buffer_object *ElementArrayBufferObj; #endif GLuint _MaxElement; /* Min of all enabled array's maxes */ }; /** * Feedback buffer state */ struct gl_feedback { GLenum Type; GLuint _Mask; /* FB_* bits */ GLfloat *Buffer; GLuint BufferSize; GLuint Count; }; /** * Selection buffer state */ struct gl_selection { GLuint *Buffer; /**< selection buffer */ GLuint BufferSize; /**< size of the selection buffer */ GLuint BufferCount; /**< number of values in the selection buffer */ GLuint Hits; /**< number of records in the selection buffer */ GLuint NameStackDepth; /**< name stack depth */ GLuint NameStack[MAX_NAME_STACK_DEPTH]; /**< name stack */ GLboolean HitFlag; /**< hit flag */ GLfloat HitMinZ; /**< minimum hit depth */ GLfloat HitMaxZ; /**< maximum hit depth */ }; /** * 1-D Evaluator control points */ struct gl_1d_map { GLuint Order; /**< Number of control points */ GLfloat u1, u2, du; /**< u1, u2, 1.0/(u2-u1) */ GLfloat *Points; /**< Points to contiguous control points */ }; /** * 2-D Evaluator control points */ struct gl_2d_map { GLuint Uorder; /**< Number of control points in U dimension */ GLuint Vorder; /**< Number of control points in V dimension */ GLfloat u1, u2, du; GLfloat v1, v2, dv; GLfloat *Points; /**< Points to contiguous control points */ }; /** * All evaluator control point state */ struct gl_evaluators { /** * \name 1-D maps */ /*@{*/ struct gl_1d_map Map1Vertex3; struct gl_1d_map Map1Vertex4; struct gl_1d_map Map1Index; struct gl_1d_map Map1Color4; struct gl_1d_map Map1Normal; struct gl_1d_map Map1Texture1; struct gl_1d_map Map1Texture2; struct gl_1d_map Map1Texture3; struct gl_1d_map Map1Texture4; struct gl_1d_map Map1Attrib[16]; /**< GL_NV_vertex_program */ /*@}*/ /** * \name 2-D maps */ /*@{*/ struct gl_2d_map Map2Vertex3; struct gl_2d_map Map2Vertex4; struct gl_2d_map Map2Index; struct gl_2d_map Map2Color4; struct gl_2d_map Map2Normal; struct gl_2d_map Map2Texture1; struct gl_2d_map Map2Texture2; struct gl_2d_map Map2Texture3; struct gl_2d_map Map2Texture4; struct gl_2d_map Map2Attrib[16]; /**< GL_NV_vertex_program */ /*@}*/ }; /** * NV_fragment_program runtime state */ struct fp_machine { GLfloat Temporaries[MAX_NV_FRAGMENT_PROGRAM_TEMPS][4]; GLfloat Inputs[MAX_NV_FRAGMENT_PROGRAM_INPUTS][4]; GLfloat Outputs[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS][4]; GLuint CondCodes[4]; }; /** * ATI_fragment_shader runtime state */ #define ATI_FS_INPUT_PRIMARY 0 #define ATI_FS_INPUT_SECONDARY 1 /* 6 register sets - 2 inputs (primary, secondary) */ struct atifs_machine { GLfloat Registers[6][4]; GLfloat PrevPassRegisters[6][4]; GLfloat Inputs[2][4]; GLuint pass; }; /** * Names of the various vertex/fragment register files */ enum register_file { PROGRAM_TEMPORARY, PROGRAM_INPUT, PROGRAM_OUTPUT, PROGRAM_LOCAL_PARAM, PROGRAM_ENV_PARAM, PROGRAM_NAMED_PARAM, PROGRAM_STATE_VAR, PROGRAM_WRITE_ONLY, PROGRAM_ADDRESS, PROGRAM_UNDEFINED /* invalid value */ }; /** Vertex and fragment instructions */ struct vp_instruction; struct fp_instruction; struct atifs_instruction; struct program_parameter_list; /** * Base class for any kind of program object */ struct program { GLuint Id; GLubyte *String; /**< Null-terminated program text */ GLint RefCount; GLenum Target; GLenum Format; /**< String encoding format */ GLboolean Resident; GLfloat LocalParams[MAX_PROGRAM_LOCAL_PARAMS][4]; GLuint NumInstructions; /* GL_ARB_vertex/fragment_program */ GLuint NumTemporaries; GLuint NumParameters; GLuint NumAttributes; GLuint NumAddressRegs; }; /** Vertex program object */ struct vertex_program { struct program Base; /* base class */ struct vp_instruction *Instructions; /* Compiled instructions */ GLboolean IsNVProgram; /* GL_NV_vertex_program ? */ GLboolean IsPositionInvariant; /* GL_NV_vertex_program1_1 */ GLuint InputsRead; /* Bitmask of which input regs are read */ GLuint OutputsWritten; /* Bitmask of which output regs are written to */ struct program_parameter_list *Parameters; /**< array [NumParameters] */ void *TnlData; /* should probably use Base.DriverData */ }; /** Fragment program object */ struct fragment_program { struct program Base; /**< base class */ struct fp_instruction *Instructions; /**< Compiled instructions */ GLuint InputsRead; /**< Bitmask of which input regs are read */ GLuint OutputsWritten; /**< Bitmask of which output regs are written to */ GLuint TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_INDEX bitmask */ GLuint NumAluInstructions; /**< GL_ARB_fragment_program */ GLuint NumTexInstructions; GLuint NumTexIndirections; GLenum FogOption; struct program_parameter_list *Parameters; /**< array [NumParameters] */ #ifdef USE_TCC char c_str[4096]; /* experimental... */ int c_strlen; #endif }; struct ati_fragment_shader { struct program Base; struct atifs_instruction *Instructions; GLfloat Constants[8][4]; GLint NumPasses; GLint cur_pass; }; /** * State common to vertex and fragment programs. */ struct gl_program_state { GLint ErrorPos; /* GL_PROGRAM_ERROR_POSITION_NV */ const char *ErrorString; /* GL_PROGRAM_ERROR_STRING_NV */ }; /** * State vars for GL_ARB/GL_NV_vertex_program */ struct gl_vertex_program_state { GLboolean Enabled; /**< GL_VERTEX_PROGRAM_NV */ GLboolean _Enabled; /**< Really enabled? */ GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_NV */ GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_NV */ struct vertex_program *Current; /**< ptr to currently bound program */ GLenum TrackMatrix[MAX_NV_VERTEX_PROGRAM_PARAMS / 4]; GLenum TrackMatrixTransform[MAX_NV_VERTEX_PROGRAM_PARAMS / 4]; GLfloat Parameters[MAX_NV_VERTEX_PROGRAM_PARAMS][4]; /* Env params */ /* Only used during program execution (may be moved someday): */ GLfloat Temporaries[MAX_NV_VERTEX_PROGRAM_TEMPS][4]; GLfloat Inputs[MAX_NV_VERTEX_PROGRAM_INPUTS][4]; GLuint InputsSize[MAX_NV_VERTEX_PROGRAM_INPUTS]; GLfloat Outputs[MAX_NV_VERTEX_PROGRAM_OUTPUTS][4]; GLint AddressReg[4]; #if FEATURE_MESA_program_debug GLprogramcallbackMESA Callback; GLvoid *CallbackData; GLboolean CallbackEnabled; GLuint CurrentPosition; #endif }; /* * State for GL_ARB/NV_fragment_program */ struct gl_fragment_program_state { GLboolean Enabled; /* GL_VERTEX_PROGRAM_NV */ GLboolean _Enabled; /* Really enabled? */ GLboolean _Active; /* Really really enabled? */ struct fragment_program *Current; /* ptr to currently bound program */ struct fragment_program *_Current; /* ptr to currently active program */ struct fp_machine Machine; /* machine state */ GLfloat Parameters[MAX_NV_FRAGMENT_PROGRAM_PARAMS][4]; /* Env params */ #if FEATURE_MESA_program_debug GLprogramcallbackMESA Callback; GLvoid *CallbackData; GLboolean CallbackEnabled; GLuint CurrentPosition; #endif }; /* * State for GL_fragment_shader */ struct gl_ati_fragment_shader_state { GLboolean Enabled; GLboolean _Enabled; GLboolean Compiling; struct atifs_machine Machine; /* machine state */ struct ati_fragment_shader *Current; }; /* * State for GL_ARB_occlusion_query */ struct gl_occlusion_state { GLboolean Active; GLuint CurrentQueryObject; GLuint PassedCounter; struct _mesa_HashTable *QueryObjects; }; /** * gl2 unique interface identifier. * Each gl2 interface has its own interface id used for object queries. */ enum gl2_uiid { UIID_UNKNOWN, /* supported by all objects */ UIID_GENERIC, /* generic object */ UIID_CONTAINER, /* contains generic objects */ UIID_SHADER, /* shader object */ UIID_FRAGMENT_SHADER, /* fragment shader */ UIID_VERTEX_SHADER, /* vertex shader */ UIID_PROGRAM, /* program object */ UIID_3DLABS_SHHANDLE /* encapsulates 3dlabs' ShHandle */ }; struct gl2_unknown_intf { GLvoid (* AddRef) (struct gl2_unknown_intf **); GLvoid (* Release) (struct gl2_unknown_intf **); struct gl2_unknown_intf **(* QueryInterface) (struct gl2_unknown_intf **, enum gl2_uiid uiid); }; struct gl2_generic_intf { struct gl2_unknown_intf _unknown; GLvoid (* Delete) (struct gl2_generic_intf **); GLenum (* GetType) (struct gl2_generic_intf **); GLhandleARB (* GetName) (struct gl2_generic_intf **); GLboolean (* GetDeleteStatus) (struct gl2_generic_intf **); const GLcharARB *(* GetInfoLog) (struct gl2_generic_intf **); }; struct gl2_container_intf { struct gl2_generic_intf _generic; GLboolean (* Attach) (struct gl2_container_intf **, struct gl2_generic_intf **); GLboolean (* Detach) (struct gl2_container_intf **, struct gl2_generic_intf **); GLsizei (* GetAttachedCount) (struct gl2_container_intf **); struct gl2_generic_intf **(* GetAttached) (struct gl2_container_intf **, GLuint); }; struct gl2_shader_intf { struct gl2_generic_intf _generic; GLenum (* GetSubType) (struct gl2_shader_intf **); GLboolean (* GetCompileStatus) (struct gl2_shader_intf **); GLvoid (* SetSource) (struct gl2_shader_intf **, GLcharARB *, GLint *, GLsizei); const GLcharARB *(* GetSource) (struct gl2_shader_intf **); GLvoid (* Compile) (struct gl2_shader_intf **); }; struct gl2_program_intf { struct gl2_container_intf _container; GLboolean (* GetLinkStatus) (struct gl2_program_intf **); GLboolean (* GetValidateStatus) (struct gl2_program_intf **); GLvoid (* Link) (struct gl2_program_intf **); GLvoid (* Validate) (struct gl2_program_intf **); }; struct gl2_fragment_shader_intf { struct gl2_shader_intf _shader; }; struct gl2_vertex_shader_intf { struct gl2_shader_intf _shader; }; struct gl2_3dlabs_shhandle_intf { struct gl2_unknown_intf _unknown; GLvoid *(* GetShHandle) (struct gl2_3dlabs_shhandle_intf **); }; struct gl_shader_objects_state { struct gl2_program_intf **current_program; }; /** * State which can be shared by multiple contexts: */ struct gl_shared_state { _glthread_Mutex Mutex; /**< for thread safety */ GLint RefCount; /**< Reference count */ struct _mesa_HashTable *DisplayList; /**< Display lists hash table */ struct _mesa_HashTable *TexObjects; /**< Texture objects hash table */ /** * \name Default texture objects (shared by all multi-texture units) */ /*@{*/ struct gl_texture_object *Default1D; struct gl_texture_object *Default2D; struct gl_texture_object *Default3D; struct gl_texture_object *DefaultCubeMap; struct gl_texture_object *DefaultRect; /*@}*/ /** * \name Vertex/fragment programs */ /*@{*/ struct _mesa_HashTable *Programs; #if FEATURE_ARB_vertex_program struct program *DefaultVertexProgram; #endif #if FEATURE_ARB_fragment_program struct program *DefaultFragmentProgram; #endif #if FEATURE_ATI_fragment_shader struct program *DefaultFragmentShader; #endif /*@}*/ #if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object struct _mesa_HashTable *BufferObjects; #endif struct _mesa_HashTable *GL2Objects; #if FEATURE_EXT_framebuffer_object struct _mesa_HashTable *RenderBuffers; struct _mesa_HashTable *FrameBuffers; #endif void *DriverData; /**< Device driver shared state */ }; /** * A renderbuffer stores colors or depth values or stencil values. * A framebuffer object will have a collection of these. * Data are read/written to the buffer with a handful of Get/Put functions. * * Instances of this object are allocated with the Driver's NewRenderbuffer * hook. Drivers will likely wrap this class inside a driver-specific * class to simulate inheritance. */ struct gl_renderbuffer { GLuint Name; GLint RefCount; GLuint Width, Height; GLenum InternalFormat; /* The user-specified value */ GLenum _BaseFormat; /* Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or */ /* GL_STENCIL_INDEX. */ GLenum DataType; /* Type of values passed to the Get/Put functions */ GLubyte ComponentSizes[4]; /* bits per component or channel */ GLvoid *Data; /* Used to wrap one renderbuffer around another: */ struct gl_renderbuffer *Wrapped; /* Delete this renderbuffer */ void (*Delete)(struct gl_renderbuffer *rb); /* Allocate new storage for this renderbuffer */ GLboolean (*AllocStorage)(GLcontext *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height); /* Lock/Unlock are called before/after calling the Get/Put functions. * Not sure this is the right place for these yet. void (*Lock)(GLcontext *ctx, struct gl_renderbuffer *rb); void (*Unlock)(GLcontext *ctx, struct gl_renderbuffer *rb); */ /* Return a pointer to the element/pixel at (x,y). * Should return NULL if the buffer memory can't be directly addressed. */ void *(*GetPointer)(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y); /* Get/Read a row of values. * The values will be of format _BaseFormat and type DataType. */ void (*GetRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values); /* Get/Read values at arbitrary locations. * The values will be of format _BaseFormat and type DataType. */ void (*GetValues)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values); /* Put/Write a row of values. * The values will be of format _BaseFormat and type DataType. */ void (*PutRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask); /* Put/Write a row of RGB values. This is a special-case routine that's * only used for RGBA renderbuffers when the source data is GL_RGB. That's * a common case for glDrawPixels and some triangle routines. * The values will be of format GL_RGB and type DataType. */ void (*PutRowRGB)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask); /* Put/Write a row of identical values. * The values will be of format _BaseFormat and type DataType. */ void (*PutMonoRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask); /* Put/Write values at arbitrary locations. * The values will be of format _BaseFormat and type DataType. */ void (*PutValues)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask); /* Put/Write identical values at arbitrary locations. * The values will be of format _BaseFormat and type DataType. */ void (*PutMonoValues)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask); }; /** * A renderbuffer attachment point points to either a texture object * (and specifies a mipmap level, cube face or 3D texture slice) or * points to a renderbuffer. */ struct gl_renderbuffer_attachment { GLenum Type; /* GL_NONE or GL_TEXTURE or GL_RENDERBUFFER_EXT */ GLboolean Complete; /* IF Type == GL_RENDERBUFFER_EXT: */ struct gl_renderbuffer *Renderbuffer; /* IF Type == GL_TEXTURE: */ struct gl_texture_object *Texture; GLuint TextureLevel; GLuint CubeMapFace; /* 0 .. 5, for cube map textures */ GLuint Zoffset; /* for 3D textures */ }; /** * A framebuffer is a collection of renderbuffers (color, depth, stencil, etc). * In C++ terms, think of this as a base class from which device drivers * will make derived classes. */ struct gl_framebuffer { GLuint Name; /* if zero, this is a window system framebuffer */ GLint RefCount; GLvisual Visual; /**< The corresponding visual */ GLboolean Initialized; GLuint Width, Height; /**< size of frame buffer in pixels */ /** \name Drawing bounds (Intersection of buffer size and scissor box) */ /*@{*/ GLint _Xmin, _Xmax; /**< inclusive */ GLint _Ymin, _Ymax; /**< exclusive */ /*@}*/ /** \name Derived Z buffer stuff */ /*@{*/ GLuint _DepthMax; /**< Max depth buffer value */ GLfloat _DepthMaxF; /**< Float max depth buffer value */ GLfloat _MRD; /**< minimum resolvable difference in Z values */ /*@}*/ GLenum _Status; /* One of the GL_FRAMEBUFFER_(IN)COMPLETE_* tokens */ /* Array of all renderbuffer attachments, indexed by BUFFER_* tokens. */ struct gl_renderbuffer_attachment Attachment[BUFFER_COUNT]; /* In unextended OpenGL these vars are part of the GL_COLOR_BUFFER * attribute group and GL_PIXEL attribute group, respectively. */ GLenum ColorDrawBuffer[MAX_DRAW_BUFFERS]; GLenum ColorReadBuffer; /* These are computed from ColorDrawBuffer and ColorReadBuffer */ GLuint _ColorDrawBufferMask[MAX_DRAW_BUFFERS]; /* Mask of BUFFER_BIT_* flags */ GLuint _ColorReadBufferMask; /* Zero or one of BUFFER_BIT_ flags */ /* These are computed from _Draw/ReadBufferMask, above. */ GLuint _NumColorDrawBuffers[MAX_DRAW_BUFFERS]; struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS][4]; struct gl_renderbuffer *_ColorReadBuffer; #if OLD_RENDERBUFFER /* XXX THIS IS TEMPORARY */ GLuint _ColorDrawBit[MAX_DRAW_BUFFERS][4]; #endif /** Delete this framebuffer */ void (*Delete)(struct gl_framebuffer *fb); }; /** * Constants which may be overridden by device driver during context creation * but are never changed after that. */ struct gl_constants { GLint MaxTextureLevels; /**< Maximum number of allowed mipmap levels. */ GLint Max3DTextureLevels; /**< Maximum number of allowed mipmap levels for 3D texture targets. */ GLint MaxCubeTextureLevels; /**< Maximum number of allowed mipmap levels for GL_ARB_texture_cube_map */ GLint MaxTextureRectSize; /* GL_NV_texture_rectangle */ GLuint MaxTextureCoordUnits; GLuint MaxTextureImageUnits; GLuint MaxTextureUnits; /* = MAX(CoordUnits, ImageUnits) */ GLfloat MaxTextureMaxAnisotropy; /* GL_EXT_texture_filter_anisotropic */ GLfloat MaxTextureLodBias; /* GL_EXT_texture_lod_bias */ GLuint MaxArrayLockSize; GLint SubPixelBits; GLfloat MinPointSize, MaxPointSize; /* aliased */ GLfloat MinPointSizeAA, MaxPointSizeAA; /* antialiased */ GLfloat PointSizeGranularity; GLfloat MinLineWidth, MaxLineWidth; /* aliased */ GLfloat MinLineWidthAA, MaxLineWidthAA; /* antialiased */ GLfloat LineWidthGranularity; GLuint MaxColorTableSize; GLuint MaxConvolutionWidth; GLuint MaxConvolutionHeight; GLuint MaxClipPlanes; GLuint MaxLights; GLfloat MaxShininess; /* GL_NV_light_max_exponent */ GLfloat MaxSpotExponent; /* GL_NV_light_max_exponent */ GLuint MaxViewportWidth, MaxViewportHeight; /* GL_ARB_vertex_program */ GLuint MaxVertexProgramInstructions; GLuint MaxVertexProgramAttribs; GLuint MaxVertexProgramTemps; GLuint MaxVertexProgramLocalParams; GLuint MaxVertexProgramEnvParams; GLuint MaxVertexProgramAddressRegs; /* GL_ARB_fragment_program */ GLuint MaxFragmentProgramInstructions; GLuint MaxFragmentProgramAttribs; GLuint MaxFragmentProgramTemps; GLuint MaxFragmentProgramLocalParams; GLuint MaxFragmentProgramEnvParams; GLuint MaxFragmentProgramAddressRegs; GLuint MaxFragmentProgramAluInstructions; GLuint MaxFragmentProgramTexInstructions; GLuint MaxFragmentProgramTexIndirections; /* vertex or fragment program */ GLuint MaxProgramMatrices; GLuint MaxProgramMatrixStackDepth; /* vertex array / buffer object bounds checking */ GLboolean CheckArrayBounds; /* GL_ARB_draw_buffers */ GLuint MaxDrawBuffers; /* GL_OES_read_format */ GLenum ColorReadFormat; GLenum ColorReadType; /* GL_EXT_framebuffer_object */ GLuint MaxColorAttachments; GLuint MaxRenderbufferSize; }; /** * Enable flag for each OpenGL extension. Different device drivers will * enable different extensions at runtime. */ struct gl_extensions { /** * \name Flags to quickly test if certain extensions are available. * * Not every extension needs to have such a flag, but it's encouraged. */ /*@{*/ GLboolean dummy; /* don't remove this! */ GLboolean ARB_depth_texture; GLboolean ARB_draw_buffers; GLboolean ARB_fragment_program; GLboolean ARB_fragment_shader; GLboolean ARB_half_float_pixel; GLboolean ARB_imaging; GLboolean ARB_multisample; GLboolean ARB_multitexture; GLboolean ARB_occlusion_query; GLboolean ARB_point_sprite; GLboolean ARB_shader_objects; GLboolean ARB_shading_language_100; GLboolean ARB_shadow; GLboolean ARB_texture_border_clamp; GLboolean ARB_texture_compression; GLboolean ARB_texture_cube_map; GLboolean ARB_texture_env_combine; GLboolean ARB_texture_env_crossbar; GLboolean ARB_texture_env_dot3; GLboolean ARB_texture_float; GLboolean ARB_texture_mirrored_repeat; GLboolean ARB_texture_non_power_of_two; GLboolean ARB_transpose_matrix; GLboolean ARB_vertex_buffer_object; GLboolean ARB_vertex_program; GLboolean ARB_vertex_shader; GLboolean ARB_window_pos; GLboolean EXT_abgr; GLboolean EXT_bgra; GLboolean EXT_blend_color; GLboolean EXT_blend_equation_separate; GLboolean EXT_blend_func_separate; GLboolean EXT_blend_logic_op; GLboolean EXT_blend_minmax; GLboolean EXT_blend_subtract; GLboolean EXT_clip_volume_hint; GLboolean EXT_cull_vertex; GLboolean EXT_convolution; GLboolean EXT_compiled_vertex_array; GLboolean EXT_copy_texture; GLboolean EXT_depth_bounds_test; GLboolean EXT_draw_range_elements; GLboolean EXT_framebuffer_object; GLboolean EXT_fog_coord; GLboolean EXT_histogram; GLboolean EXT_multi_draw_arrays; GLboolean EXT_paletted_texture; GLboolean EXT_packed_pixels; GLboolean EXT_pixel_buffer_object; GLboolean EXT_point_parameters; GLboolean EXT_polygon_offset; GLboolean EXT_rescale_normal; GLboolean EXT_shadow_funcs; GLboolean EXT_secondary_color; GLboolean EXT_separate_specular_color; GLboolean EXT_shared_texture_palette; GLboolean EXT_stencil_wrap; GLboolean EXT_stencil_two_side; GLboolean EXT_subtexture; GLboolean EXT_texture; GLboolean EXT_texture_object; GLboolean EXT_texture3D; GLboolean EXT_texture_compression_s3tc; GLboolean EXT_texture_env_add; GLboolean EXT_texture_env_combine; GLboolean EXT_texture_env_dot3; GLboolean EXT_texture_filter_anisotropic; GLboolean EXT_texture_lod_bias; GLboolean EXT_texture_mirror_clamp; GLboolean EXT_vertex_array; GLboolean EXT_vertex_array_set; /* vendor extensions */ GLboolean APPLE_client_storage; GLboolean APPLE_packed_pixels; GLboolean ATI_texture_mirror_once; GLboolean ATI_texture_env_combine3; GLboolean ATI_fragment_shader; GLboolean HP_occlusion_test; GLboolean IBM_rasterpos_clip; GLboolean IBM_multimode_draw_arrays; GLboolean MESA_pack_invert; GLboolean MESA_packed_depth_stencil; GLboolean MESA_program_debug; GLboolean MESA_resize_buffers; GLboolean MESA_ycbcr_texture; GLboolean NV_blend_square; GLboolean NV_fragment_program; GLboolean NV_light_max_exponent; GLboolean NV_point_sprite; GLboolean NV_texgen_reflection; GLboolean NV_texture_rectangle; GLboolean NV_vertex_program; GLboolean NV_vertex_program1_1; GLboolean OES_read_format; GLboolean SGI_color_matrix; GLboolean SGI_color_table; GLboolean SGI_texture_color_table; GLboolean SGIS_generate_mipmap; GLboolean SGIS_pixel_texture; GLboolean SGIS_texture_edge_clamp; GLboolean SGIS_texture_lod; GLboolean SGIX_depth_texture; GLboolean SGIX_pixel_texture; GLboolean SGIX_shadow; GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */ GLboolean TDFX_texture_compression_FXT1; GLboolean S3_s3tc; /*@}*/ /* The extension string */ const GLubyte *String; }; /** * A stack of matrices (projection, modelview, color, texture, etc). */ struct matrix_stack { GLmatrix *Top; /**< points into Stack */ GLmatrix *Stack; /**< array [MaxDepth] of GLmatrix */ GLuint Depth; /**< 0 <= Depth < MaxDepth */ GLuint MaxDepth; /**< size of Stack[] array */ GLuint DirtyFlag; /**< _NEW_MODELVIEW or _NEW_PROJECTION, for example */ }; /** * \name Bits for image transfer operations * * \sa __GLcontextRec::ImageTransferState. */ /*@{*/ #define IMAGE_SCALE_BIAS_BIT 0x1 #define IMAGE_SHIFT_OFFSET_BIT 0x2 #define IMAGE_MAP_COLOR_BIT 0x4 #define IMAGE_COLOR_TABLE_BIT 0x8 #define IMAGE_CONVOLUTION_BIT 0x10 #define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20 #define IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT 0x40 #define IMAGE_COLOR_MATRIX_BIT 0x80 #define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x100 #define IMAGE_HISTOGRAM_BIT 0x200 #define IMAGE_MIN_MAX_BIT 0x400 #define IMAGE_CLAMP_BIT 0x800 /* extra */ /** Pixel Transfer ops up to convolution */ #define IMAGE_PRE_CONVOLUTION_BITS (IMAGE_SCALE_BIAS_BIT | \ IMAGE_SHIFT_OFFSET_BIT | \ IMAGE_MAP_COLOR_BIT | \ IMAGE_COLOR_TABLE_BIT) /** Pixel transfer ops after convolution */ #define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS | \ IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT | \ IMAGE_COLOR_MATRIX_BIT | \ IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT |\ IMAGE_HISTOGRAM_BIT | \ IMAGE_MIN_MAX_BIT) /*@}*/ /** * \name Bits to indicate what state has changed. * * 4 unused flags. */ /*@{*/ #define _NEW_MODELVIEW 0x1 /**< __GLcontextRec::ModelView */ #define _NEW_PROJECTION 0x2 /**< __GLcontextRec::Projection */ #define _NEW_TEXTURE_MATRIX 0x4 /**< __GLcontextRec::TextureMatrix */ #define _NEW_COLOR_MATRIX 0x8 /**< __GLcontextRec::ColorMatrix */ #define _NEW_ACCUM 0x10 /**< __GLcontextRec::Accum */ #define _NEW_COLOR 0x20 /**< __GLcontextRec::Color */ #define _NEW_DEPTH 0x40 /**< __GLcontextRec::Depth */ #define _NEW_EVAL 0x80 /**< __GLcontextRec::Eval, __GLcontextRec::EvalMap */ #define _NEW_FOG 0x100 /**< __GLcontextRec::Fog */ #define _NEW_HINT 0x200 /**< __GLcontextRec::Hint */ #define _NEW_LIGHT 0x400 /**< __GLcontextRec::Light */ #define _NEW_LINE 0x800 /**< __GLcontextRec::Line */ #define _NEW_PIXEL 0x1000 /**< __GLcontextRec::Pixel */ #define _NEW_POINT 0x2000 /**< __GLcontextRec::Point */ #define _NEW_POLYGON 0x4000 /**< __GLcontextRec::Polygon */ #define _NEW_POLYGONSTIPPLE 0x8000 /**< __GLcontextRec::PolygonStipple */ #define _NEW_SCISSOR 0x10000 /**< __GLcontextRec::Scissor */ #define _NEW_STENCIL 0x20000 /**< __GLcontextRec::Stencil */ #define _NEW_TEXTURE 0x40000 /**< __GLcontextRec::Texture */ #define _NEW_TRANSFORM 0x80000 /**< __GLcontextRec::Transform */ #define _NEW_VIEWPORT 0x100000 /**< __GLcontextRec::Viewport */ #define _NEW_PACKUNPACK 0x200000 /**< __GLcontextRec::Pack, __GLcontextRec::Unpack */ #define _NEW_ARRAY 0x400000 /**< __GLcontextRec::Array */ #define _NEW_RENDERMODE 0x800000 /**< __GLcontextRec::RenderMode, __GLcontextRec::Feedback, __GLcontextRec::Select */ #define _NEW_BUFFERS 0x1000000 /**< __GLcontextRec::Visual, __GLcontextRec::DrawBuffer, */ #define _NEW_MULTISAMPLE 0x2000000 /**< __GLcontextRec::Multisample */ #define _NEW_TRACK_MATRIX 0x4000000 /**< __GLcontextRec::VertexProgram */ #define _NEW_PROGRAM 0x8000000 /**< __GLcontextRec::VertexProgram */ #define _NEW_ALL ~0 /*@}*/ /** * \name Bits to track array state changes * * Also used to summarize array enabled. */ /*@{*/ #define _NEW_ARRAY_VERTEX VERT_BIT_POS #define _NEW_ARRAY_WEIGHT VERT_BIT_WEIGHT #define _NEW_ARRAY_NORMAL VERT_BIT_NORMAL #define _NEW_ARRAY_COLOR0 VERT_BIT_COLOR0 #define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1 #define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG #define _NEW_ARRAY_INDEX VERT_BIT_SIX #define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN #define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0 #define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1 #define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2 #define _NEW_ARRAY_TEXCOORD_3 VERT_BIT_TEX3 #define _NEW_ARRAY_TEXCOORD_4 VERT_BIT_TEX4 #define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5 #define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6 #define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7 #define _NEW_ARRAY_ATTRIB_0 0x10000 /* start at bit 16 */ #define _NEW_ARRAY_ALL 0xffffffff #define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0 << (i)) #define _NEW_ARRAY_ATTRIB(i) (_NEW_ARRAY_ATTRIB_0 << (i)) /*@}*/ /** * \name A bunch of flags that we think might be useful to drivers. * * Set in the __GLcontextRec::_TriangleCaps bitfield. */ /*@{*/ #define DD_FLATSHADE 0x1 #define DD_SEPARATE_SPECULAR 0x2 #define DD_TRI_CULL_FRONT_BACK 0x4 /* special case on some hw */ #define DD_TRI_LIGHT_TWOSIDE 0x8 #define DD_TRI_UNFILLED 0x10 #define DD_TRI_SMOOTH 0x20 #define DD_TRI_STIPPLE 0x40 #define DD_TRI_OFFSET 0x80 #define DD_LINE_SMOOTH 0x100 #define DD_LINE_STIPPLE 0x200 #define DD_LINE_WIDTH 0x400 #define DD_POINT_SMOOTH 0x800 #define DD_POINT_SIZE 0x1000 #define DD_POINT_ATTEN 0x2000 #define DD_TRI_TWOSTENCIL 0x4000 /*@}*/ /** * \name Define the state changes under which each of these bits might change */ /*@{*/ #define _DD_NEW_FLATSHADE _NEW_LIGHT #define _DD_NEW_SEPARATE_SPECULAR (_NEW_LIGHT | _NEW_FOG | _NEW_PROGRAM) #define _DD_NEW_TRI_CULL_FRONT_BACK _NEW_POLYGON #define _DD_NEW_TRI_LIGHT_TWOSIDE _NEW_LIGHT #define _DD_NEW_TRI_UNFILLED _NEW_POLYGON #define _DD_NEW_TRI_SMOOTH _NEW_POLYGON #define _DD_NEW_TRI_STIPPLE _NEW_POLYGON #define _DD_NEW_TRI_OFFSET _NEW_POLYGON #define _DD_NEW_LINE_SMOOTH _NEW_LINE #define _DD_NEW_LINE_STIPPLE _NEW_LINE #define _DD_NEW_LINE_WIDTH _NEW_LINE #define _DD_NEW_POINT_SMOOTH _NEW_POINT #define _DD_NEW_POINT_SIZE _NEW_POINT #define _DD_NEW_POINT_ATTEN _NEW_POINT /*@}*/ #define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT | \ _NEW_TEXTURE | \ _NEW_POINT | \ _NEW_MODELVIEW) #define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT | \ _NEW_TEXTURE) #define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL | _NEW_COLOR_MATRIX) /* * Forward declaration of display list data types: */ union node; typedef union node Node; /* This has to be included here. */ #include "dd.h" #define NUM_VERTEX_FORMAT_ENTRIES (sizeof(GLvertexformat) / sizeof(void *)) /** * Core Mesa's support for tnl modules: */ struct gl_tnl_module { /** * Vertex format to be lazily swapped into current dispatch. */ const GLvertexformat *Current; /** * \name Record of functions swapped out. * On restore, only need to swap these functions back in. */ /*@{*/ struct { _glapi_proc * location; _glapi_proc function; } Swapped[NUM_VERTEX_FORMAT_ENTRIES]; GLuint SwapCount; /*@}*/ }; /* Strictly this is a tnl/ private concept, but it doesn't seem * worthwhile adding a tnl private structure just to hold this one bit * of information: */ #define MESA_DLIST_DANGLING_REFS 0x1 /* Provide a location where information about a display list can be * collected. Could be extended with driverPrivate structures, * etc. in the future. */ struct mesa_display_list { Node *node; GLuint id; GLuint flags; }; /** * State used during display list compilation and execution. */ struct mesa_list_state { struct mesa_display_list *CallStack[MAX_LIST_NESTING]; GLuint CallDepth; /**< Current recursion calling depth */ struct mesa_display_list *CurrentList; Node *CurrentListPtr; /**< Head of list being compiled */ GLuint CurrentListNum; /**< Number of the list being compiled */ Node *CurrentBlock; /**< Pointer to current block of nodes */ GLuint CurrentPos; /**< Index into current block of nodes */ GLvertexformat ListVtxfmt; GLubyte ActiveAttribSize[VERT_ATTRIB_MAX]; GLfloat CurrentAttrib[VERT_ATTRIB_MAX][4]; GLubyte ActiveMaterialSize[MAT_ATTRIB_MAX]; GLfloat CurrentMaterial[MAT_ATTRIB_MAX][4]; GLubyte ActiveIndex; GLfloat CurrentIndex; GLubyte ActiveEdgeFlag; GLboolean CurrentEdgeFlag; }; /** * Mesa rendering context. * * This is the central context data structure for Mesa. Almost all * OpenGL state is contained in this structure. * Think of this as a base class from which device drivers will derive * sub classes. * * The GLcontext typedef names this structure. */ struct __GLcontextRec { /** * \name OS related interfaces. * * These \b must be the first members of this structure, because they are * exposed to the outside world (i.e. GLX extension). */ /*@{*/ __GLimports imports; __GLexports exports; /*@}*/ /** State possibly shared with other contexts in the address space */ struct gl_shared_state *Shared; /** \name API function pointer tables */ /*@{*/ struct _glapi_table *Save; /**< Display list save functions */ struct _glapi_table *Exec; /**< Execute functions */ struct _glapi_table *CurrentDispatch; /**< == Save or Exec !! */ /*@}*/ GLvisual Visual; GLframebuffer *DrawBuffer; /**< buffer for writing */ GLframebuffer *ReadBuffer; /**< buffer for reading */ GLframebuffer *WinSysDrawBuffer; /**< set with MakeCurrent */ GLframebuffer *WinSysReadBuffer; /**< set with MakeCurrent */ /** * Device driver function pointer table */ struct dd_function_table Driver; void *DriverCtx; /**< Points to device driver context/state */ void *DriverMgrCtx; /**< Points to device driver manager (optional)*/ /** Core/Driver constants */ struct gl_constants Const; /** \name The various 4x4 matrix stacks */ /*@{*/ struct matrix_stack ModelviewMatrixStack; struct matrix_stack ProjectionMatrixStack; struct matrix_stack ColorMatrixStack; struct matrix_stack TextureMatrixStack[MAX_TEXTURE_COORD_UNITS]; struct matrix_stack ProgramMatrixStack[MAX_PROGRAM_MATRICES]; struct matrix_stack *CurrentStack; /**< Points to one of the above stacks */ /*@}*/ /** Combined modelview and projection matrix */ GLmatrix _ModelProjectMatrix; /** \name Display lists */ struct mesa_list_state ListState; GLboolean ExecuteFlag; /**< Execute GL commands? */ GLboolean CompileFlag; /**< Compile GL commands into display list? */ /** Extensions */ struct gl_extensions Extensions; /** \name Renderer attribute stack */ /*@{*/ GLuint AttribStackDepth; struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH]; /*@}*/ /** \name Renderer attribute groups * * We define a struct for each attribute group to make pushing and popping * attributes easy. Also it's a good organization. */ /*@{*/ struct gl_accum_attrib Accum; /**< Accumulation buffer attributes */ struct gl_colorbuffer_attrib Color; /**< Color buffers attributes */ struct gl_current_attrib Current; /**< Current attributes */ struct gl_depthbuffer_attrib Depth; /**< Depth buffer attributes */ struct gl_eval_attrib Eval; /**< Eval attributes */ struct gl_fog_attrib Fog; /**< Fog attributes */ struct gl_hint_attrib Hint; /**< Hint attributes */ struct gl_light_attrib Light; /**< Light attributes */ struct gl_line_attrib Line; /**< Line attributes */ struct gl_list_attrib List; /**< List attributes */ struct gl_multisample_attrib Multisample; struct gl_pixel_attrib Pixel; /**< Pixel attributes */ struct gl_point_attrib Point; /**< Point attributes */ struct gl_polygon_attrib Polygon; /**< Polygon attributes */ GLuint PolygonStipple[32]; /**< Polygon stipple */ struct gl_scissor_attrib Scissor; /**< Scissor attributes */ struct gl_stencil_attrib Stencil; /**< Stencil buffer attributes */ struct gl_texture_attrib Texture; /**< Texture attributes */ struct gl_transform_attrib Transform; /**< Transformation attributes */ struct gl_viewport_attrib Viewport; /**< Viewport attributes */ /*@}*/ /** \name Client attribute stack */ /*@{*/ GLuint ClientAttribStackDepth; struct gl_attrib_node *ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH]; /*@}*/ /** \name Client attribute groups */ /*@{*/ struct gl_array_attrib Array; /**< Vertex arrays */ struct gl_pixelstore_attrib Pack; /**< Pixel packing */ struct gl_pixelstore_attrib Unpack; /**< Pixel unpacking */ struct gl_pixelstore_attrib DefaultPacking; /**< Default params */ /*@}*/ /** \name Other assorted state (not pushed/popped on attribute stack) */ /*@{*/ struct gl_histogram_attrib Histogram; struct gl_minmax_attrib MinMax; struct gl_convolution_attrib Convolution1D; struct gl_convolution_attrib Convolution2D; struct gl_convolution_attrib Separable2D; struct gl_evaluators EvalMap; /**< All evaluators */ struct gl_feedback Feedback; /**< Feedback */ struct gl_selection Select; /**< Selection */ struct gl_color_table ColorTable; /**< Pre-convolution */ struct gl_color_table ProxyColorTable; /**< Pre-convolution */ struct gl_color_table PostConvolutionColorTable; struct gl_color_table ProxyPostConvolutionColorTable; struct gl_color_table PostColorMatrixColorTable; struct gl_color_table ProxyPostColorMatrixColorTable; struct gl_program_state Program; /**< for vertex or fragment progs */ struct gl_vertex_program_state VertexProgram; /**< GL_NV_vertex_program */ struct gl_fragment_program_state FragmentProgram; /**< GL_NV_fragment_program */ struct gl_ati_fragment_shader_state ATIFragmentShader; /**< GL_ATI_fragment_shader */ struct fragment_program *_TexEnvProgram; /**< Texture state as fragment program */ struct vertex_program *_TnlProgram; /**< Fixed func TNL state as vertex program */ GLboolean _MaintainTexEnvProgram; GLboolean _MaintainTnlProgram; struct gl_occlusion_state Occlusion; /**< GL_ARB_occlusion_query */ struct gl_shader_objects_state ShaderObjects; /* GL_ARB_shader_objects */ /*@}*/ #if FEATURE_EXT_framebuffer_object /*struct gl_framebuffer *CurrentFramebuffer;*/ struct gl_renderbuffer *CurrentRenderbuffer; #endif GLenum ErrorValue; /**< Last error code */ GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ GLuint NewState; /**< bitwise-or of _NEW_* flags */ /** \name Derived state */ /*@{*/ GLuint _TriangleCaps; /**< bitwise-or of DD_* flags */ GLuint _ImageTransferState;/**< bitwise-or of IMAGE_*_BIT flags */ GLfloat _EyeZDir[3]; GLfloat _ModelViewInvScale; GLuint _NeedEyeCoords; GLuint _ForceEyeCoords; GLboolean _RotateMode; GLenum _CurrentProgram; /* currently executing program */ struct gl_shine_tab *_ShineTable[2]; /**< Active shine tables */ struct gl_shine_tab *_ShineTabList; /**< MRU list of inactive shine tables */ /**@}*/ struct gl_list_extensions ListExt; /**< driver dlist extensions */ GLboolean OcclusionResult; /**< for GL_HP_occlusion_test */ GLboolean OcclusionResultSaved; /**< for GL_HP_occlusion_test */ GLuint _Facing; /**< This is a hack for 2-sided stencil test. * * We don't have a better way to communicate this value from * swrast_setup to swrast. */ /** \name For debugging/development only */ /*@{*/ GLboolean FirstTimeCurrent; /*@}*/ /** Dither disable via MESA_NO_DITHER env var */ GLboolean NoDither; /** software compression/decompression supported or not */ GLboolean Mesa_DXTn; /** Core tnl module support */ struct gl_tnl_module TnlModule; /** * \name Hooks for module contexts. * * These will eventually live in the driver or elsewhere. */ /*@{*/ void *swrast_context; void *swsetup_context; void *swtnl_context; void *swtnl_im; void *acache_context; void *aelt_context; /*@}*/ }; /** The string names for GL_POINT, GL_LINE_LOOP, etc */ extern const char *_mesa_prim_name[GL_POLYGON+4]; #ifdef MESA_DEBUG extern int MESA_VERBOSE; extern int MESA_DEBUG_FLAGS; # define MESA_FUNCTION __FUNCTION__ #else # define MESA_VERBOSE 0 # define MESA_DEBUG_FLAGS 0 # define MESA_FUNCTION "a function" # ifndef NDEBUG # define NDEBUG # endif #endif enum _verbose { VERBOSE_VARRAY = 0x0001, VERBOSE_TEXTURE = 0x0002, VERBOSE_IMMEDIATE = 0x0004, VERBOSE_PIPELINE = 0x0008, VERBOSE_DRIVER = 0x0010, VERBOSE_STATE = 0x0020, VERBOSE_API = 0x0040, VERBOSE_DISPLAY_LIST = 0x0100, VERBOSE_LIGHTING = 0x0200, VERBOSE_PRIMS = 0x0400, VERBOSE_VERTS = 0x0800, VERBOSE_DISASSEM = 0x1000 }; enum _debug { DEBUG_ALWAYS_FLUSH = 0x1 }; #define Elements(x) sizeof(x)/sizeof(*(x)) #endif /* TYPES_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/occlude.c0000644000000000000000000002142113614532424017723 0ustar /* * Mesa 3-D graphics library * Version: 6.0.2 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Functions to implement the GL_ARB_occlusion_query extension. */ #include "glheader.h" #include "context.h" #include "hash.h" #include "imports.h" #include "occlude.h" #include "mtypes.h" struct occlusion_query { GLenum Target; GLuint Id; GLuint PassedCounter; GLboolean Active; }; /** * Allocate a new occlusion query object. * \param target - must be GL_SAMPLES_PASSED_ARB at this time * \param id - the object's ID * \return pointer to new occlusion_query object or NULL if out of memory. */ static struct occlusion_query * new_query_object(GLenum target, GLuint id) { struct occlusion_query *q = MALLOC_STRUCT(occlusion_query); if (q) { q->Target = target; q->Id = id; q->PassedCounter = 0; q->Active = GL_FALSE; } return q; } /** * Delete an occlusion query object. */ static void delete_query_object(struct occlusion_query *q) { FREE(q); } void GLAPIENTRY _mesa_GenQueriesARB(GLsizei n, GLuint *ids) { GET_CURRENT_CONTEXT(ctx); GLuint first; ASSERT_OUTSIDE_BEGIN_END(ctx); if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glGenQueriesARB(n < 0)"); return; } if (ctx->Occlusion.Active) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGenQueriesARB"); return; } first = _mesa_HashFindFreeKeyBlock(ctx->Occlusion.QueryObjects, n); if (first) { GLsizei i; for (i = 0; i < n; i++) { struct occlusion_query *q = new_query_object(GL_SAMPLES_PASSED_ARB, first + i); if (!q) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenQueriesARB"); return; } ids[i] = first + i; _mesa_HashInsert(ctx->Occlusion.QueryObjects, first + i, q); } } } void GLAPIENTRY _mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids) { GET_CURRENT_CONTEXT(ctx); GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx); if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteQueriesARB(n < 0)"); return; } if (ctx->Occlusion.Active) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteQueriesARB"); return; } for (i = 0; i < n; i++) { if (ids[i] > 0) { struct occlusion_query *q = (struct occlusion_query *) _mesa_HashLookup(ctx->Occlusion.QueryObjects, ids[i]); if (q) { _mesa_HashRemove(ctx->Occlusion.QueryObjects, ids[i]); delete_query_object(q); } } } } GLboolean GLAPIENTRY _mesa_IsQueryARB(GLuint id) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (id && _mesa_HashLookup(ctx->Occlusion.QueryObjects, id)) return GL_TRUE; else return GL_FALSE; } void GLAPIENTRY _mesa_BeginQueryARB(GLenum target, GLuint id) { GET_CURRENT_CONTEXT(ctx); struct occlusion_query *q; ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_DEPTH); if (target != GL_SAMPLES_PASSED_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)"); return; } if (id == 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB(id==0)"); return; } if (ctx->Occlusion.CurrentQueryObject) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB(target)"); return; } q = (struct occlusion_query *) _mesa_HashLookup(ctx->Occlusion.QueryObjects, id); if (q && q->Active) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB"); return; } else if (!q) { q = new_query_object(target, id); if (!q) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQueryARB"); return; } _mesa_HashInsert(ctx->Occlusion.QueryObjects, id, q); } q->Active = GL_TRUE; q->PassedCounter = 0; ctx->Occlusion.Active = GL_TRUE; ctx->Occlusion.CurrentQueryObject = id; ctx->Occlusion.PassedCounter = 0; } void GLAPIENTRY _mesa_EndQueryARB(GLenum target) { GET_CURRENT_CONTEXT(ctx); struct occlusion_query *q = NULL; ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_DEPTH); if (target != GL_SAMPLES_PASSED_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)"); return; } if (ctx->Occlusion.CurrentQueryObject) q = (struct occlusion_query *) _mesa_HashLookup(ctx->Occlusion.QueryObjects, ctx->Occlusion.CurrentQueryObject); if (!q || !q->Active) { _mesa_error(ctx, GL_INVALID_OPERATION, "glEndQuery with no glBeginQuery"); return; } q->PassedCounter = ctx->Occlusion.PassedCounter; q->Active = GL_FALSE; ctx->Occlusion.Active = GL_FALSE; ctx->Occlusion.CurrentQueryObject = 0; } void GLAPIENTRY _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target != GL_SAMPLES_PASSED_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryivARB(target)"); return; } switch (pname) { case GL_QUERY_COUNTER_BITS_ARB: *params = 8 * sizeof(GLuint); break; case GL_CURRENT_QUERY_ARB: *params = ctx->Occlusion.CurrentQueryObject; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryivARB(pname)"); return; } } void GLAPIENTRY _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); struct occlusion_query *q = NULL; ASSERT_OUTSIDE_BEGIN_END(ctx); if (id) q = (struct occlusion_query *) _mesa_HashLookup(ctx->Occlusion.QueryObjects, id); if (!q || q->Active) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetQueryObjectivARB(id=%d)", id); return; } switch (pname) { case GL_QUERY_RESULT_ARB: *params = q->PassedCounter; break; case GL_QUERY_RESULT_AVAILABLE_ARB: /* XXX revisit when we have a hardware implementation! */ *params = GL_TRUE; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjectivARB(pname)"); return; } } void GLAPIENTRY _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params) { GET_CURRENT_CONTEXT(ctx); struct occlusion_query *q = NULL; ASSERT_OUTSIDE_BEGIN_END(ctx); if (id) q = (struct occlusion_query *) _mesa_HashLookup(ctx->Occlusion.QueryObjects, id); if (!q || q->Active) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetQueryObjectuivARB(id=%d", id); return; } switch (pname) { case GL_QUERY_RESULT_ARB: *params = q->PassedCounter; break; case GL_QUERY_RESULT_AVAILABLE_ARB: /* XXX revisit when we have a hardware implementation! */ *params = GL_TRUE; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjectuivARB(pname)"); return; } } /** * Allocate/init the context state related to occlusion query objects. */ void _mesa_init_occlude(GLcontext *ctx) { #if FEATURE_ARB_occlusion_query ctx->Occlusion.QueryObjects = _mesa_NewHashTable(); #endif ctx->OcclusionResult = GL_FALSE; ctx->OcclusionResultSaved = GL_FALSE; } /** * Free the context state related to occlusion query objects. */ void _mesa_free_occlude_data(GLcontext *ctx) { while (1) { GLuint query = _mesa_HashFirstEntry(ctx->Occlusion.QueryObjects); if (query) { struct occlusion_query *q = (struct occlusion_query *) _mesa_HashLookup(ctx->Occlusion.QueryObjects, query); ASSERT(q); delete_query_object(q); _mesa_HashRemove(ctx->Occlusion.QueryObjects, query); } else { break; } } _mesa_DeleteHashTable(ctx->Occlusion.QueryObjects); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/occlude.h0000644000000000000000000000363113614532424017733 0ustar /* * Mesa 3-D graphics library * Version: 6.0.2 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef OCCLUDE_H #define OCCLUDE_H extern void _mesa_init_occlude(GLcontext *ctx); extern void _mesa_free_occlude_data(GLcontext *ctx); extern void GLAPIENTRY _mesa_GenQueriesARB(GLsizei n, GLuint *ids); extern void GLAPIENTRY _mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids); extern GLboolean GLAPIENTRY _mesa_IsQueryARB(GLuint id); extern void GLAPIENTRY _mesa_BeginQueryARB(GLenum target, GLuint id); extern void GLAPIENTRY _mesa_EndQueryARB(GLenum target); extern void GLAPIENTRY _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params); #endif /* OCCLUDE_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/pixel.c0000644000000000000000000021145413614532424017435 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "bufferobj.h" #include "colormac.h" #include "context.h" #include "image.h" #include "macros.h" #include "pixel.h" #include "mtypes.h" /**********************************************************************/ /***** glPixelZoom *****/ /**********************************************************************/ void GLAPIENTRY _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ) { GET_CURRENT_CONTEXT(ctx); if (ctx->Pixel.ZoomX == xfactor && ctx->Pixel.ZoomY == yfactor) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.ZoomX = xfactor; ctx->Pixel.ZoomY = yfactor; } /**********************************************************************/ /***** glPixelStore *****/ /**********************************************************************/ void GLAPIENTRY _mesa_PixelStorei( GLenum pname, GLint param ) { /* NOTE: this call can't be compiled into the display list */ GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { case GL_PACK_SWAP_BYTES: if (param == (GLint)ctx->Pack.SwapBytes) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE; break; case GL_PACK_LSB_FIRST: if (param == (GLint)ctx->Pack.LsbFirst) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE; break; case GL_PACK_ROW_LENGTH: if (param<0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); return; } if (ctx->Pack.RowLength == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.RowLength = param; break; case GL_PACK_IMAGE_HEIGHT: if (param<0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); return; } if (ctx->Pack.ImageHeight == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.ImageHeight = param; break; case GL_PACK_SKIP_PIXELS: if (param<0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); return; } if (ctx->Pack.SkipPixels == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.SkipPixels = param; break; case GL_PACK_SKIP_ROWS: if (param<0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); return; } if (ctx->Pack.SkipRows == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.SkipRows = param; break; case GL_PACK_SKIP_IMAGES: if (param<0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); return; } if (ctx->Pack.SkipImages == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.SkipImages = param; break; case GL_PACK_ALIGNMENT: if (param!=1 && param!=2 && param!=4 && param!=8) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); return; } if (ctx->Pack.Alignment == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.Alignment = param; break; case GL_PACK_INVERT_MESA: if (!ctx->Extensions.MESA_pack_invert) { _mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" ); return; } if (ctx->Pack.Invert == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.Invert = param; break; case GL_UNPACK_SWAP_BYTES: if (param == (GLint)ctx->Unpack.SwapBytes) return; if ((GLint)ctx->Unpack.SwapBytes == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE; break; case GL_UNPACK_LSB_FIRST: if (param == (GLint)ctx->Unpack.LsbFirst) return; if ((GLint)ctx->Unpack.LsbFirst == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE; break; case GL_UNPACK_ROW_LENGTH: if (param<0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); return; } if (ctx->Unpack.RowLength == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.RowLength = param; break; case GL_UNPACK_IMAGE_HEIGHT: if (param<0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); return; } if (ctx->Unpack.ImageHeight == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.ImageHeight = param; break; case GL_UNPACK_SKIP_PIXELS: if (param<0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); return; } if (ctx->Unpack.SkipPixels == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.SkipPixels = param; break; case GL_UNPACK_SKIP_ROWS: if (param<0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); return; } if (ctx->Unpack.SkipRows == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.SkipRows = param; break; case GL_UNPACK_SKIP_IMAGES: if (param < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); return; } if (ctx->Unpack.SkipImages == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.SkipImages = param; break; case GL_UNPACK_ALIGNMENT: if (param!=1 && param!=2 && param!=4 && param!=8) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore" ); return; } if (ctx->Unpack.Alignment == param) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.Alignment = param; break; case GL_UNPACK_CLIENT_STORAGE_APPLE: if (param == (GLint)ctx->Unpack.ClientStorage) return; FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" ); return; } } void GLAPIENTRY _mesa_PixelStoref( GLenum pname, GLfloat param ) { _mesa_PixelStorei( pname, (GLint) param ); } /**********************************************************************/ /***** glPixelMap *****/ /**********************************************************************/ /** * Helper routine used by the other _mesa_PixelMap() functions. */ static void pixelmap(GLcontext *ctx, GLenum map, GLsizei mapsize, const GLfloat *values) { GLint i; switch (map) { case GL_PIXEL_MAP_S_TO_S: ctx->Pixel.MapStoSsize = mapsize; for (i = 0; i < mapsize; i++) { ctx->Pixel.MapStoS[i] = IROUND(values[i]); } break; case GL_PIXEL_MAP_I_TO_I: ctx->Pixel.MapItoIsize = mapsize; for (i = 0; i < mapsize; i++) { ctx->Pixel.MapItoI[i] = values[i]; } break; case GL_PIXEL_MAP_I_TO_R: ctx->Pixel.MapItoRsize = mapsize; for (i = 0; i < mapsize; i++) { GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); ctx->Pixel.MapItoR[i] = val; ctx->Pixel.MapItoR8[i] = (GLint) (val * 255.0F); } break; case GL_PIXEL_MAP_I_TO_G: ctx->Pixel.MapItoGsize = mapsize; for (i = 0; i < mapsize; i++) { GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); ctx->Pixel.MapItoG[i] = val; ctx->Pixel.MapItoG8[i] = (GLint) (val * 255.0F); } break; case GL_PIXEL_MAP_I_TO_B: ctx->Pixel.MapItoBsize = mapsize; for (i = 0; i < mapsize; i++) { GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); ctx->Pixel.MapItoB[i] = val; ctx->Pixel.MapItoB8[i] = (GLint) (val * 255.0F); } break; case GL_PIXEL_MAP_I_TO_A: ctx->Pixel.MapItoAsize = mapsize; for (i = 0; i < mapsize; i++) { GLfloat val = CLAMP( values[i], 0.0F, 1.0F ); ctx->Pixel.MapItoA[i] = val; ctx->Pixel.MapItoA8[i] = (GLint) (val * 255.0F); } break; case GL_PIXEL_MAP_R_TO_R: ctx->Pixel.MapRtoRsize = mapsize; for (i = 0; i < mapsize; i++) { ctx->Pixel.MapRtoR[i] = CLAMP( values[i], 0.0F, 1.0F ); } break; case GL_PIXEL_MAP_G_TO_G: ctx->Pixel.MapGtoGsize = mapsize; for (i = 0; i < mapsize; i++) { ctx->Pixel.MapGtoG[i] = CLAMP( values[i], 0.0F, 1.0F ); } break; case GL_PIXEL_MAP_B_TO_B: ctx->Pixel.MapBtoBsize = mapsize; for (i = 0; i < mapsize; i++) { ctx->Pixel.MapBtoB[i] = CLAMP( values[i], 0.0F, 1.0F ); } break; case GL_PIXEL_MAP_A_TO_A: ctx->Pixel.MapAtoAsize = mapsize; for (i = 0; i < mapsize; i++) { ctx->Pixel.MapAtoA[i] = CLAMP( values[i], 0.0F, 1.0F ); } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glPixelMap(map)" ); } } void GLAPIENTRY _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); /* XXX someday, test against ctx->Const.MaxPixelMapTableSize */ if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" ); return; } if (map >= GL_PIXEL_MAP_S_TO_S && map <= GL_PIXEL_MAP_I_TO_A) { /* test that mapsize is a power of two */ if (_mesa_bitcount((GLuint) mapsize) != 1) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" ); return; } } FLUSH_VERTICES(ctx, _NEW_PIXEL); if (ctx->Unpack.BufferObj->Name) { /* unpack pixelmap from PBO */ GLubyte *buf; /* Note, need to use DefaultPacking and Unpack's buffer object */ ctx->DefaultPacking.BufferObj = ctx->Unpack.BufferObj; if (!_mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1, GL_INTENSITY, GL_FLOAT, values)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glPixelMapfv(invalid PBO access)"); return; } /* restore */ ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, ctx->Unpack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glPixelMapfv(PBO is mapped)"); return; } values = (const GLfloat *) ADD_POINTERS(buf, values); } else if (!values) { return; } pixelmap(ctx, map, mapsize, values); if (ctx->Unpack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, ctx->Unpack.BufferObj); } } void GLAPIENTRY _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values ) { GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapuiv(mapsize)" ); return; } if (map >= GL_PIXEL_MAP_S_TO_S && map <= GL_PIXEL_MAP_I_TO_A) { /* test that mapsize is a power of two */ if (_mesa_bitcount((GLuint) mapsize) != 1) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapuiv(mapsize)" ); return; } } FLUSH_VERTICES(ctx, _NEW_PIXEL); if (ctx->Unpack.BufferObj->Name) { /* unpack pixelmap from PBO */ GLubyte *buf; /* Note, need to use DefaultPacking and Unpack's buffer object */ ctx->DefaultPacking.BufferObj = ctx->Unpack.BufferObj; if (!_mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1, GL_INTENSITY, GL_UNSIGNED_INT, values)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glPixelMapuiv(invalid PBO access)"); return; } /* restore */ ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, ctx->Unpack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glPixelMapuiv(PBO is mapped)"); return; } values = (const GLuint *) ADD_POINTERS(buf, values); } else if (!values) { return; } /* convert to floats */ if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) { GLint i; for (i = 0; i < mapsize; i++) { fvalues[i] = (GLfloat) values[i]; } } else { GLint i; for (i = 0; i < mapsize; i++) { fvalues[i] = UINT_TO_FLOAT( values[i] ); } } if (ctx->Unpack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, ctx->Unpack.BufferObj); } pixelmap(ctx, map, mapsize, fvalues); } void GLAPIENTRY _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ) { GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapusv(mapsize)" ); return; } if (map >= GL_PIXEL_MAP_S_TO_S && map <= GL_PIXEL_MAP_I_TO_A) { /* test that mapsize is a power of two */ if (_mesa_bitcount((GLuint) mapsize) != 1) { _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapuiv(mapsize)" ); return; } } FLUSH_VERTICES(ctx, _NEW_PIXEL); if (ctx->Unpack.BufferObj->Name) { /* unpack pixelmap from PBO */ GLubyte *buf; /* Note, need to use DefaultPacking and Unpack's buffer object */ ctx->DefaultPacking.BufferObj = ctx->Unpack.BufferObj; if (!_mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1, GL_INTENSITY, GL_UNSIGNED_SHORT, values)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glPixelMapusv(invalid PBO access)"); return; } /* restore */ ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, ctx->Unpack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glPixelMapusv(PBO is mapped)"); return; } values = (const GLushort *) ADD_POINTERS(buf, values); } else if (!values) { return; } /* convert to floats */ if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) { GLint i; for (i = 0; i < mapsize; i++) { fvalues[i] = (GLfloat) values[i]; } } else { GLint i; for (i = 0; i < mapsize; i++) { fvalues[i] = USHORT_TO_FLOAT( values[i] ); } } if (ctx->Unpack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, ctx->Unpack.BufferObj); } pixelmap(ctx, map, mapsize, fvalues); } /** * Return size of the named map. */ static GLuint get_map_size(GLcontext *ctx, GLenum map) { switch (map) { case GL_PIXEL_MAP_I_TO_I: return ctx->Pixel.MapItoIsize; case GL_PIXEL_MAP_S_TO_S: return ctx->Pixel.MapStoSsize; case GL_PIXEL_MAP_I_TO_R: return ctx->Pixel.MapItoRsize; case GL_PIXEL_MAP_I_TO_G: return ctx->Pixel.MapItoGsize; case GL_PIXEL_MAP_I_TO_B: return ctx->Pixel.MapItoBsize; case GL_PIXEL_MAP_I_TO_A: return ctx->Pixel.MapItoAsize; case GL_PIXEL_MAP_R_TO_R: return ctx->Pixel.MapRtoRsize; case GL_PIXEL_MAP_G_TO_G: return ctx->Pixel.MapGtoGsize; case GL_PIXEL_MAP_B_TO_B: return ctx->Pixel.MapBtoBsize; case GL_PIXEL_MAP_A_TO_A: return ctx->Pixel.MapAtoAsize; default: return 0; } } void GLAPIENTRY _mesa_GetPixelMapfv( GLenum map, GLfloat *values ) { GET_CURRENT_CONTEXT(ctx); GLuint mapsize, i; ASSERT_OUTSIDE_BEGIN_END(ctx); mapsize = get_map_size(ctx, map); if (ctx->Pack.BufferObj->Name) { /* pack pixelmap into PBO */ GLubyte *buf; /* Note, need to use DefaultPacking and Pack's buffer object */ ctx->DefaultPacking.BufferObj = ctx->Pack.BufferObj; if (!_mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1, GL_INTENSITY, GL_FLOAT, values)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetPixelMapfv(invalid PBO access)"); return; } /* restore */ ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetPixelMapfv(PBO is mapped)"); return; } values = (GLfloat *) ADD_POINTERS(buf, values); } else if (!values) { return; } switch (map) { case GL_PIXEL_MAP_I_TO_I: MEMCPY(values, ctx->Pixel.MapItoI, mapsize * sizeof(GLfloat)); break; case GL_PIXEL_MAP_S_TO_S: for (i = 0; i < mapsize; i++) { values[i] = (GLfloat) ctx->Pixel.MapStoS[i]; } break; case GL_PIXEL_MAP_I_TO_R: MEMCPY(values, ctx->Pixel.MapItoR, mapsize * sizeof(GLfloat)); break; case GL_PIXEL_MAP_I_TO_G: MEMCPY(values, ctx->Pixel.MapItoG, mapsize * sizeof(GLfloat)); break; case GL_PIXEL_MAP_I_TO_B: MEMCPY(values, ctx->Pixel.MapItoB, mapsize * sizeof(GLfloat)); break; case GL_PIXEL_MAP_I_TO_A: MEMCPY(values, ctx->Pixel.MapItoA, mapsize * sizeof(GLfloat)); break; case GL_PIXEL_MAP_R_TO_R: MEMCPY(values, ctx->Pixel.MapRtoR, mapsize * sizeof(GLfloat)); break; case GL_PIXEL_MAP_G_TO_G: MEMCPY(values, ctx->Pixel.MapGtoG, mapsize * sizeof(GLfloat)); break; case GL_PIXEL_MAP_B_TO_B: MEMCPY(values, ctx->Pixel.MapBtoB, mapsize * sizeof(GLfloat)); break; case GL_PIXEL_MAP_A_TO_A: MEMCPY(values, ctx->Pixel.MapAtoA, mapsize * sizeof(GLfloat)); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" ); } if (ctx->Pack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, ctx->Pack.BufferObj); } } void GLAPIENTRY _mesa_GetPixelMapuiv( GLenum map, GLuint *values ) { GET_CURRENT_CONTEXT(ctx); GLint mapsize, i; ASSERT_OUTSIDE_BEGIN_END(ctx); mapsize = get_map_size(ctx, map); if (ctx->Pack.BufferObj->Name) { /* pack pixelmap into PBO */ GLubyte *buf; /* Note, need to use DefaultPacking and Pack's buffer object */ ctx->DefaultPacking.BufferObj = ctx->Pack.BufferObj; if (!_mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1, GL_INTENSITY, GL_UNSIGNED_INT, values)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetPixelMapuiv(invalid PBO access)"); return; } /* restore */ ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetPixelMapuiv(PBO is mapped)"); return; } values = (GLuint *) ADD_POINTERS(buf, values); } else if (!values) { return; } switch (map) { case GL_PIXEL_MAP_I_TO_I: for (i = 0; i < mapsize; i++) { values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoI[i] ); } break; case GL_PIXEL_MAP_S_TO_S: MEMCPY(values, ctx->Pixel.MapStoS, mapsize * sizeof(GLint)); break; case GL_PIXEL_MAP_I_TO_R: for (i = 0; i < mapsize; i++) { values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoR[i] ); } break; case GL_PIXEL_MAP_I_TO_G: for (i = 0; i < mapsize; i++) { values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoG[i] ); } break; case GL_PIXEL_MAP_I_TO_B: for (i = 0; i < mapsize; i++) { values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoB[i] ); } break; case GL_PIXEL_MAP_I_TO_A: for (i = 0; i < mapsize; i++) { values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoA[i] ); } break; case GL_PIXEL_MAP_R_TO_R: for (i = 0; i < mapsize; i++) { values[i] = FLOAT_TO_UINT( ctx->Pixel.MapRtoR[i] ); } break; case GL_PIXEL_MAP_G_TO_G: for (i = 0; i < mapsize; i++) { values[i] = FLOAT_TO_UINT( ctx->Pixel.MapGtoG[i] ); } break; case GL_PIXEL_MAP_B_TO_B: for (i = 0; i < mapsize; i++) { values[i] = FLOAT_TO_UINT( ctx->Pixel.MapBtoB[i] ); } break; case GL_PIXEL_MAP_A_TO_A: for (i = 0; i < mapsize; i++) { values[i] = FLOAT_TO_UINT( ctx->Pixel.MapAtoA[i] ); } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" ); } if (ctx->Pack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, ctx->Pack.BufferObj); } } void GLAPIENTRY _mesa_GetPixelMapusv( GLenum map, GLushort *values ) { GET_CURRENT_CONTEXT(ctx); GLint mapsize, i; ASSERT_OUTSIDE_BEGIN_END(ctx); mapsize = get_map_size(ctx, map); if (ctx->Pack.BufferObj->Name) { /* pack pixelmap into PBO */ GLubyte *buf; /* Note, need to use DefaultPacking and Pack's buffer object */ ctx->DefaultPacking.BufferObj = ctx->Pack.BufferObj; if (!_mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1, GL_INTENSITY, GL_UNSIGNED_SHORT, values)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetPixelMapusv(invalid PBO access)"); return; } /* restore */ ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetPixelMapusv(PBO is mapped)"); return; } values = (GLushort *) ADD_POINTERS(buf, values); } else if (!values) { return; } switch (map) { case GL_PIXEL_MAP_I_TO_I: for (i = 0; i < mapsize; i++) { values[i] = (GLushort) CLAMP(ctx->Pixel.MapItoI[i], 0.0, 65535.0); } break; case GL_PIXEL_MAP_S_TO_S: for (i = 0; i < mapsize; i++) { values[i] = (GLushort) CLAMP(ctx->Pixel.MapStoS[i], 0.0, 65535.0); } break; case GL_PIXEL_MAP_I_TO_R: for (i = 0; i < mapsize; i++) { CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoR[i] ); } break; case GL_PIXEL_MAP_I_TO_G: for (i = 0; i < mapsize; i++) { CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoG[i] ); } break; case GL_PIXEL_MAP_I_TO_B: for (i = 0; i < mapsize; i++) { CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoB[i] ); } break; case GL_PIXEL_MAP_I_TO_A: for (i = 0; i < mapsize; i++) { CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoA[i] ); } break; case GL_PIXEL_MAP_R_TO_R: for (i = 0; i < mapsize; i++) { CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapRtoR[i] ); } break; case GL_PIXEL_MAP_G_TO_G: for (i = 0; i < mapsize; i++) { CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapGtoG[i] ); } break; case GL_PIXEL_MAP_B_TO_B: for (i = 0; i < mapsize; i++) { CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapBtoB[i] ); } break; case GL_PIXEL_MAP_A_TO_A: for (i = 0; i < mapsize; i++) { CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapAtoA[i] ); } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" ); } if (ctx->Pack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, ctx->Pack.BufferObj); } } /**********************************************************************/ /***** glPixelTransfer *****/ /**********************************************************************/ /* * Implements glPixelTransfer[fi] whether called immediately or from a * display list. */ void GLAPIENTRY _mesa_PixelTransferf( GLenum pname, GLfloat param ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { case GL_MAP_COLOR: if (ctx->Pixel.MapColorFlag == (param ? GL_TRUE : GL_FALSE)) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.MapColorFlag = param ? GL_TRUE : GL_FALSE; break; case GL_MAP_STENCIL: if (ctx->Pixel.MapStencilFlag == (param ? GL_TRUE : GL_FALSE)) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.MapStencilFlag = param ? GL_TRUE : GL_FALSE; break; case GL_INDEX_SHIFT: if (ctx->Pixel.IndexShift == (GLint) param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.IndexShift = (GLint) param; break; case GL_INDEX_OFFSET: if (ctx->Pixel.IndexOffset == (GLint) param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.IndexOffset = (GLint) param; break; case GL_RED_SCALE: if (ctx->Pixel.RedScale == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.RedScale = param; break; case GL_RED_BIAS: if (ctx->Pixel.RedBias == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.RedBias = param; break; case GL_GREEN_SCALE: if (ctx->Pixel.GreenScale == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.GreenScale = param; break; case GL_GREEN_BIAS: if (ctx->Pixel.GreenBias == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.GreenBias = param; break; case GL_BLUE_SCALE: if (ctx->Pixel.BlueScale == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.BlueScale = param; break; case GL_BLUE_BIAS: if (ctx->Pixel.BlueBias == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.BlueBias = param; break; case GL_ALPHA_SCALE: if (ctx->Pixel.AlphaScale == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.AlphaScale = param; break; case GL_ALPHA_BIAS: if (ctx->Pixel.AlphaBias == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.AlphaBias = param; break; case GL_DEPTH_SCALE: if (ctx->Pixel.DepthScale == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.DepthScale = param; break; case GL_DEPTH_BIAS: if (ctx->Pixel.DepthBias == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.DepthBias = param; break; case GL_POST_COLOR_MATRIX_RED_SCALE: if (ctx->Pixel.PostColorMatrixScale[0] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixScale[0] = param; break; case GL_POST_COLOR_MATRIX_RED_BIAS: if (ctx->Pixel.PostColorMatrixBias[0] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixBias[0] = param; break; case GL_POST_COLOR_MATRIX_GREEN_SCALE: if (ctx->Pixel.PostColorMatrixScale[1] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixScale[1] = param; break; case GL_POST_COLOR_MATRIX_GREEN_BIAS: if (ctx->Pixel.PostColorMatrixBias[1] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixBias[1] = param; break; case GL_POST_COLOR_MATRIX_BLUE_SCALE: if (ctx->Pixel.PostColorMatrixScale[2] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixScale[2] = param; break; case GL_POST_COLOR_MATRIX_BLUE_BIAS: if (ctx->Pixel.PostColorMatrixBias[2] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixBias[2] = param; break; case GL_POST_COLOR_MATRIX_ALPHA_SCALE: if (ctx->Pixel.PostColorMatrixScale[3] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixScale[3] = param; break; case GL_POST_COLOR_MATRIX_ALPHA_BIAS: if (ctx->Pixel.PostColorMatrixBias[3] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixBias[3] = param; break; case GL_POST_CONVOLUTION_RED_SCALE: if (ctx->Pixel.PostConvolutionScale[0] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionScale[0] = param; break; case GL_POST_CONVOLUTION_RED_BIAS: if (ctx->Pixel.PostConvolutionBias[0] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionBias[0] = param; break; case GL_POST_CONVOLUTION_GREEN_SCALE: if (ctx->Pixel.PostConvolutionScale[1] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionScale[1] = param; break; case GL_POST_CONVOLUTION_GREEN_BIAS: if (ctx->Pixel.PostConvolutionBias[1] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionBias[1] = param; break; case GL_POST_CONVOLUTION_BLUE_SCALE: if (ctx->Pixel.PostConvolutionScale[2] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionScale[2] = param; break; case GL_POST_CONVOLUTION_BLUE_BIAS: if (ctx->Pixel.PostConvolutionBias[2] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionBias[2] = param; break; case GL_POST_CONVOLUTION_ALPHA_SCALE: if (ctx->Pixel.PostConvolutionScale[2] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionScale[2] = param; break; case GL_POST_CONVOLUTION_ALPHA_BIAS: if (ctx->Pixel.PostConvolutionBias[2] == param) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionBias[2] = param; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" ); return; } } void GLAPIENTRY _mesa_PixelTransferi( GLenum pname, GLint param ) { _mesa_PixelTransferf( pname, (GLfloat) param ); } /**********************************************************************/ /***** Pixel processing functions ******/ /**********************************************************************/ /* * Apply scale and bias factors to an array of RGBA pixels. */ void _mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4], GLfloat rScale, GLfloat gScale, GLfloat bScale, GLfloat aScale, GLfloat rBias, GLfloat gBias, GLfloat bBias, GLfloat aBias) { if (rScale != 1.0 || rBias != 0.0) { GLuint i; for (i = 0; i < n; i++) { rgba[i][RCOMP] = rgba[i][RCOMP] * rScale + rBias; } } if (gScale != 1.0 || gBias != 0.0) { GLuint i; for (i = 0; i < n; i++) { rgba[i][GCOMP] = rgba[i][GCOMP] * gScale + gBias; } } if (bScale != 1.0 || bBias != 0.0) { GLuint i; for (i = 0; i < n; i++) { rgba[i][BCOMP] = rgba[i][BCOMP] * bScale + bBias; } } if (aScale != 1.0 || aBias != 0.0) { GLuint i; for (i = 0; i < n; i++) { rgba[i][ACOMP] = rgba[i][ACOMP] * aScale + aBias; } } } /* * Apply pixel mapping to an array of floating point RGBA pixels. */ void _mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) { const GLfloat rscale = (GLfloat) (ctx->Pixel.MapRtoRsize - 1); const GLfloat gscale = (GLfloat) (ctx->Pixel.MapGtoGsize - 1); const GLfloat bscale = (GLfloat) (ctx->Pixel.MapBtoBsize - 1); const GLfloat ascale = (GLfloat) (ctx->Pixel.MapAtoAsize - 1); const GLfloat *rMap = ctx->Pixel.MapRtoR; const GLfloat *gMap = ctx->Pixel.MapGtoG; const GLfloat *bMap = ctx->Pixel.MapBtoB; const GLfloat *aMap = ctx->Pixel.MapAtoA; GLuint i; for (i=0;iPixel.PostColorMatrixScale[0]; const GLfloat rb = ctx->Pixel.PostColorMatrixBias[0]; const GLfloat gs = ctx->Pixel.PostColorMatrixScale[1]; const GLfloat gb = ctx->Pixel.PostColorMatrixBias[1]; const GLfloat bs = ctx->Pixel.PostColorMatrixScale[2]; const GLfloat bb = ctx->Pixel.PostColorMatrixBias[2]; const GLfloat as = ctx->Pixel.PostColorMatrixScale[3]; const GLfloat ab = ctx->Pixel.PostColorMatrixBias[3]; const GLfloat *m = ctx->ColorMatrixStack.Top->m; GLuint i; for (i = 0; i < n; i++) { const GLfloat r = rgba[i][RCOMP]; const GLfloat g = rgba[i][GCOMP]; const GLfloat b = rgba[i][BCOMP]; const GLfloat a = rgba[i][ACOMP]; rgba[i][RCOMP] = (m[0] * r + m[4] * g + m[ 8] * b + m[12] * a) * rs + rb; rgba[i][GCOMP] = (m[1] * r + m[5] * g + m[ 9] * b + m[13] * a) * gs + gb; rgba[i][BCOMP] = (m[2] * r + m[6] * g + m[10] * b + m[14] * a) * bs + bb; rgba[i][ACOMP] = (m[3] * r + m[7] * g + m[11] * b + m[15] * a) * as + ab; } } /** * Apply a color table lookup to an array of floating point RGBA colors. */ void _mesa_lookup_rgba_float(const struct gl_color_table *table, GLuint n, GLfloat rgba[][4]) { if (!table->Table || table->Size == 0) return; switch (table->Format) { case GL_INTENSITY: /* replace RGBA with I */ if (table->Type == GL_FLOAT) { const GLint max = table->Size - 1; const GLfloat scale = (GLfloat) max; const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint j = IROUND(rgba[i][RCOMP] * scale); GLfloat c = lut[CLAMP(j, 0, max)]; rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = rgba[i][ACOMP] = c; } } else { const GLint max = table->Size - 1; const GLfloat scale = (GLfloat) max; const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint j = IROUND(rgba[i][RCOMP] * scale); GLfloat c = CHAN_TO_FLOAT(lut[CLAMP(j, 0, max)]); rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = rgba[i][ACOMP] = c; } } break; case GL_LUMINANCE: /* replace RGB with L */ if (table->Type == GL_FLOAT) { const GLint max = table->Size - 1; const GLfloat scale = (GLfloat) max; const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint j = IROUND(rgba[i][RCOMP] * scale); GLfloat c = lut[CLAMP(j, 0, max)]; rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; } } else { const GLint max = table->Size - 1; const GLfloat scale = (GLfloat) max; const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint j = IROUND(rgba[i][RCOMP] * scale); GLfloat c = CHAN_TO_FLOAT(lut[CLAMP(j, 0, max)]); rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; } } break; case GL_ALPHA: /* replace A with A */ if (table->Type == GL_FLOAT) { const GLint max = table->Size - 1; const GLfloat scale = (GLfloat) max; const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint j = IROUND(rgba[i][ACOMP] * scale); rgba[i][ACOMP] = lut[CLAMP(j, 0, max)]; } } else { const GLint max = table->Size - 1; const GLfloat scale = (GLfloat) max; const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint j = IROUND(rgba[i][ACOMP] * scale); rgba[i][ACOMP] = CHAN_TO_FLOAT(lut[CLAMP(j, 0, max)]); } } break; case GL_LUMINANCE_ALPHA: /* replace RGBA with LLLA */ if (table->Type == GL_FLOAT) { const GLint max = table->Size - 1; const GLfloat scale = (GLfloat) max; const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint jL = IROUND(rgba[i][RCOMP] * scale); GLint jA = IROUND(rgba[i][ACOMP] * scale); GLfloat luminance, alpha; jL = CLAMP(jL, 0, max); jA = CLAMP(jA, 0, max); luminance = lut[jL * 2 + 0]; alpha = lut[jA * 2 + 1]; rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; rgba[i][ACOMP] = alpha;; } } else { const GLint max = table->Size - 1; const GLfloat scale = (GLfloat) max; const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint jL = IROUND(rgba[i][RCOMP] * scale); GLint jA = IROUND(rgba[i][ACOMP] * scale); GLfloat luminance, alpha; jL = CLAMP(jL, 0, max); jA = CLAMP(jA, 0, max); luminance = CHAN_TO_FLOAT(lut[jL * 2 + 0]); alpha = CHAN_TO_FLOAT(lut[jA * 2 + 1]); rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; rgba[i][ACOMP] = alpha;; } } break; case GL_RGB: /* replace RGB with RGB */ if (table->Type == GL_FLOAT) { const GLint max = table->Size - 1; const GLfloat scale = (GLfloat) max; const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint jR = IROUND(rgba[i][RCOMP] * scale); GLint jG = IROUND(rgba[i][GCOMP] * scale); GLint jB = IROUND(rgba[i][BCOMP] * scale); jR = CLAMP(jR, 0, max); jG = CLAMP(jG, 0, max); jB = CLAMP(jB, 0, max); rgba[i][RCOMP] = lut[jR * 3 + 0]; rgba[i][GCOMP] = lut[jG * 3 + 1]; rgba[i][BCOMP] = lut[jB * 3 + 2]; } } else { const GLint max = table->Size - 1; const GLfloat scale = (GLfloat) max; const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint jR = IROUND(rgba[i][RCOMP] * scale); GLint jG = IROUND(rgba[i][GCOMP] * scale); GLint jB = IROUND(rgba[i][BCOMP] * scale); jR = CLAMP(jR, 0, max); jG = CLAMP(jG, 0, max); jB = CLAMP(jB, 0, max); rgba[i][RCOMP] = CHAN_TO_FLOAT(lut[jR * 3 + 0]); rgba[i][GCOMP] = CHAN_TO_FLOAT(lut[jG * 3 + 1]); rgba[i][BCOMP] = CHAN_TO_FLOAT(lut[jB * 3 + 2]); } } break; case GL_RGBA: /* replace RGBA with RGBA */ if (table->Type == GL_FLOAT) { const GLint max = table->Size - 1; const GLfloat scale = (GLfloat) max; const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint jR = IROUND(rgba[i][RCOMP] * scale); GLint jG = IROUND(rgba[i][GCOMP] * scale); GLint jB = IROUND(rgba[i][BCOMP] * scale); GLint jA = IROUND(rgba[i][ACOMP] * scale); jR = CLAMP(jR, 0, max); jG = CLAMP(jG, 0, max); jB = CLAMP(jB, 0, max); jA = CLAMP(jA, 0, max); rgba[i][RCOMP] = lut[jR * 4 + 0]; rgba[i][GCOMP] = lut[jG * 4 + 1]; rgba[i][BCOMP] = lut[jB * 4 + 2]; rgba[i][ACOMP] = lut[jA * 4 + 3]; } } else { const GLint max = table->Size - 1; const GLfloat scale = (GLfloat) max; const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint jR = IROUND(rgba[i][RCOMP] * scale); GLint jG = IROUND(rgba[i][GCOMP] * scale); GLint jB = IROUND(rgba[i][BCOMP] * scale); GLint jA = IROUND(rgba[i][ACOMP] * scale); jR = CLAMP(jR, 0, max); jG = CLAMP(jG, 0, max); jB = CLAMP(jB, 0, max); jA = CLAMP(jA, 0, max); rgba[i][RCOMP] = CHAN_TO_FLOAT(lut[jR * 4 + 0]); rgba[i][GCOMP] = CHAN_TO_FLOAT(lut[jG * 4 + 1]); rgba[i][BCOMP] = CHAN_TO_FLOAT(lut[jB * 4 + 2]); rgba[i][ACOMP] = CHAN_TO_FLOAT(lut[jA * 4 + 3]); } } break; default: _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba_float"); return; } } /** * Apply a color table lookup to an array of GLchan RGBA colors. */ void _mesa_lookup_rgba_chan(const struct gl_color_table *table, GLuint n, GLchan rgba[][4]) { if (!table->Table || table->Size == 0) return; switch (table->Format) { case GL_INTENSITY: /* replace RGBA with I */ if (table->Type == GL_FLOAT) { const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale); GLchan c; CLAMPED_FLOAT_TO_CHAN(c, lut[j]); rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = rgba[i][ACOMP] = c; } } else { #if CHAN_TYPE == GL_UNSIGNED_BYTE if (table->Size == 256) { /* common case */ const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { const GLchan c = lut[rgba[i][RCOMP]]; rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = rgba[i][ACOMP] = c; } } else #endif { const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale); rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = rgba[i][ACOMP] = lut[j]; } } } break; case GL_LUMINANCE: /* replace RGB with L */ if (table->Type == GL_FLOAT) { const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale); GLchan c; CLAMPED_FLOAT_TO_CHAN(c, lut[j]); rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; } } else { #if CHAN_TYPE == GL_UNSIGNED_BYTE if (table->Size == 256) { /* common case */ const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { const GLchan c = lut[rgba[i][RCOMP]]; rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; } } else #endif { const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale); rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = lut[j]; } } } break; case GL_ALPHA: /* replace A with A */ if (table->Type == GL_FLOAT) { const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint j = IROUND((GLfloat) rgba[i][ACOMP] * scale); GLchan c; CLAMPED_FLOAT_TO_CHAN(c, lut[j]); rgba[i][ACOMP] = c; } } else { #if CHAN_TYPE == GL_UNSIGNED_BYTE if (table->Size == 256) { /* common case */ const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { rgba[i][ACOMP] = lut[rgba[i][ACOMP]]; } } else #endif { const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint j = IROUND((GLfloat) rgba[i][ACOMP] * scale); rgba[i][ACOMP] = lut[j]; } } } break; case GL_LUMINANCE_ALPHA: /* replace RGBA with LLLA */ if (table->Type == GL_FLOAT) { const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint jL = IROUND((GLfloat) rgba[i][RCOMP] * scale); GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale); GLchan luminance, alpha; CLAMPED_FLOAT_TO_CHAN(luminance, lut[jL * 2 + 0]); CLAMPED_FLOAT_TO_CHAN(alpha, lut[jA * 2 + 1]); rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; rgba[i][ACOMP] = alpha;; } } else { #if CHAN_TYPE == GL_UNSIGNED_BYTE if (table->Size == 256) { /* common case */ const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLchan l = lut[rgba[i][RCOMP] * 2 + 0]; GLchan a = lut[rgba[i][ACOMP] * 2 + 1];; rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = l; rgba[i][ACOMP] = a; } } else #endif { const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint jL = IROUND((GLfloat) rgba[i][RCOMP] * scale); GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale); GLchan luminance = lut[jL * 2 + 0]; GLchan alpha = lut[jA * 2 + 1]; rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; rgba[i][ACOMP] = alpha; } } } break; case GL_RGB: /* replace RGB with RGB */ if (table->Type == GL_FLOAT) { const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale); GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale); GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale); CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 3 + 0]); CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 3 + 1]); CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 3 + 2]); } } else { #if CHAN_TYPE == GL_UNSIGNED_BYTE if (table->Size == 256) { /* common case */ const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { rgba[i][RCOMP] = lut[rgba[i][RCOMP] * 3 + 0]; rgba[i][GCOMP] = lut[rgba[i][GCOMP] * 3 + 1]; rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 3 + 2]; } } else #endif { const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale); GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale); GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale); rgba[i][RCOMP] = lut[jR * 3 + 0]; rgba[i][GCOMP] = lut[jG * 3 + 1]; rgba[i][BCOMP] = lut[jB * 3 + 2]; } } } break; case GL_RGBA: /* replace RGBA with RGBA */ if (table->Type == GL_FLOAT) { const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale); GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale); GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale); GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale); CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 4 + 0]); CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 4 + 1]); CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 4 + 2]); CLAMPED_FLOAT_TO_CHAN(rgba[i][ACOMP], lut[jA * 4 + 3]); } } else { #if CHAN_TYPE == GL_UNSIGNED_BYTE if (table->Size == 256) { /* common case */ const GLchan *lut = (const GLchan *) table->Table; GLuint i; for (i = 0; i < n; i++) { rgba[i][RCOMP] = lut[rgba[i][RCOMP] * 4 + 0]; rgba[i][GCOMP] = lut[rgba[i][GCOMP] * 4 + 1]; rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 4 + 2]; rgba[i][ACOMP] = lut[rgba[i][ACOMP] * 4 + 3]; } } else #endif { const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale); GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale); GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale); GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale); CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 4 + 0]); CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 4 + 1]); CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 4 + 2]); CLAMPED_FLOAT_TO_CHAN(rgba[i][ACOMP], lut[jA * 4 + 3]); } } } break; default: _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba_chan"); return; } } /* * Apply color index shift and offset to an array of pixels. */ void _mesa_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) { GLint shift = ctx->Pixel.IndexShift; GLint offset = ctx->Pixel.IndexOffset; GLuint i; if (shift > 0) { for (i=0;i> shift) + offset; } } else { for (i=0;iPixel.MapItoIsize - 1; GLuint i; for (i = 0; i < n; i++) { const GLuint j = index[i] & mask; index[i] = IROUND(ctx->Pixel.MapItoI[j]); } } /* * Map color indexes to rgba values. */ void _mesa_map_ci_to_rgba_chan( const GLcontext *ctx, GLuint n, const GLuint index[], GLchan rgba[][4] ) { #if CHAN_BITS == 8 GLuint rmask = ctx->Pixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; GLuint bmask = ctx->Pixel.MapItoBsize - 1; GLuint amask = ctx->Pixel.MapItoAsize - 1; const GLubyte *rMap = ctx->Pixel.MapItoR8; const GLubyte *gMap = ctx->Pixel.MapItoG8; const GLubyte *bMap = ctx->Pixel.MapItoB8; const GLubyte *aMap = ctx->Pixel.MapItoA8; GLuint i; for (i=0;iPixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; GLuint bmask = ctx->Pixel.MapItoBsize - 1; GLuint amask = ctx->Pixel.MapItoAsize - 1; const GLfloat *rMap = ctx->Pixel.MapItoR; const GLfloat *gMap = ctx->Pixel.MapItoG; const GLfloat *bMap = ctx->Pixel.MapItoB; const GLfloat *aMap = ctx->Pixel.MapItoA; GLuint i; for (i=0;iPixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; GLuint bmask = ctx->Pixel.MapItoBsize - 1; GLuint amask = ctx->Pixel.MapItoAsize - 1; const GLfloat *rMap = ctx->Pixel.MapItoR; const GLfloat *gMap = ctx->Pixel.MapItoG; const GLfloat *bMap = ctx->Pixel.MapItoB; const GLfloat *aMap = ctx->Pixel.MapItoA; GLuint i; for (i=0;iPixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; GLuint bmask = ctx->Pixel.MapItoBsize - 1; GLuint amask = ctx->Pixel.MapItoAsize - 1; const GLubyte *rMap = ctx->Pixel.MapItoR8; const GLubyte *gMap = ctx->Pixel.MapItoG8; const GLubyte *bMap = ctx->Pixel.MapItoB8; const GLubyte *aMap = ctx->Pixel.MapItoA8; GLuint i; for (i=0;iPixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; GLuint bmask = ctx->Pixel.MapItoBsize - 1; GLuint amask = ctx->Pixel.MapItoAsize - 1; const GLfloat *rMap = ctx->Pixel.MapItoR; const GLfloat *gMap = ctx->Pixel.MapItoG; const GLfloat *bMap = ctx->Pixel.MapItoB; const GLfloat *aMap = ctx->Pixel.MapItoA; GLuint i; for (i=0;iPixel.IndexShift; GLint offset = ctx->Pixel.IndexOffset; if (shift > 0) { for (i=0;i> shift) + offset; } } else { for (i=0;iPixel.MapStoSsize - 1; GLuint i; for (i=0;iPixel.MapStoS[ stencil[i] & mask ]; } } /* * This function converts an array of GLchan colors to GLfloat colors. * Most importantly, it undoes the non-uniform quantization of pixel * values introduced when we convert shallow (< 8 bit) pixel values * to GLubytes in the ctx->Driver.ReadRGBASpan() functions. * This fixes a number of OpenGL conformance failures when running on * 16bpp displays, for example. */ void _mesa_chan_to_float_span(const GLcontext *ctx, GLuint n, CONST GLchan rgba[][4], GLfloat rgbaf[][4]) { #if CHAN_TYPE == GL_FLOAT MEMCPY(rgbaf, rgba, n * 4 * sizeof(GLfloat)); #else const GLuint rShift = CHAN_BITS - ctx->Visual.redBits; const GLuint gShift = CHAN_BITS - ctx->Visual.greenBits; const GLuint bShift = CHAN_BITS - ctx->Visual.blueBits; GLuint aShift; const GLfloat rScale = 1.0F / (GLfloat) ((1 << ctx->Visual.redBits ) - 1); const GLfloat gScale = 1.0F / (GLfloat) ((1 << ctx->Visual.greenBits) - 1); const GLfloat bScale = 1.0F / (GLfloat) ((1 << ctx->Visual.blueBits ) - 1); GLfloat aScale; GLuint i; if (ctx->Visual.alphaBits > 0) { aShift = CHAN_BITS - ctx->Visual.alphaBits; aScale = 1.0F / (GLfloat) ((1 << ctx->Visual.alphaBits) - 1); } else { aShift = 0; aScale = 1.0F / CHAN_MAXF; } for (i = 0; i < n; i++) { const GLint r = rgba[i][RCOMP] >> rShift; const GLint g = rgba[i][GCOMP] >> gShift; const GLint b = rgba[i][BCOMP] >> bShift; const GLint a = rgba[i][ACOMP] >> aShift; rgbaf[i][RCOMP] = (GLfloat) r * rScale; rgbaf[i][GCOMP] = (GLfloat) g * gScale; rgbaf[i][BCOMP] = (GLfloat) b * bScale; rgbaf[i][ACOMP] = (GLfloat) a * aScale; } #endif } /**********************************************************************/ /***** State Management *****/ /**********************************************************************/ /* * Return a bitmask of IMAGE_*_BIT flags which to indicate which * pixel transfer operations are enabled. */ static void update_image_transfer_state(GLcontext *ctx) { GLuint mask = 0; if (ctx->Pixel.RedScale != 1.0F || ctx->Pixel.RedBias != 0.0F || ctx->Pixel.GreenScale != 1.0F || ctx->Pixel.GreenBias != 0.0F || ctx->Pixel.BlueScale != 1.0F || ctx->Pixel.BlueBias != 0.0F || ctx->Pixel.AlphaScale != 1.0F || ctx->Pixel.AlphaBias != 0.0F) mask |= IMAGE_SCALE_BIAS_BIT; if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) mask |= IMAGE_SHIFT_OFFSET_BIT; if (ctx->Pixel.MapColorFlag) mask |= IMAGE_MAP_COLOR_BIT; if (ctx->Pixel.ColorTableEnabled) mask |= IMAGE_COLOR_TABLE_BIT; if (ctx->Pixel.Convolution1DEnabled || ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { mask |= IMAGE_CONVOLUTION_BIT; if (ctx->Pixel.PostConvolutionScale[0] != 1.0F || ctx->Pixel.PostConvolutionScale[1] != 1.0F || ctx->Pixel.PostConvolutionScale[2] != 1.0F || ctx->Pixel.PostConvolutionScale[3] != 1.0F || ctx->Pixel.PostConvolutionBias[0] != 0.0F || ctx->Pixel.PostConvolutionBias[1] != 0.0F || ctx->Pixel.PostConvolutionBias[2] != 0.0F || ctx->Pixel.PostConvolutionBias[3] != 0.0F) { mask |= IMAGE_POST_CONVOLUTION_SCALE_BIAS; } } if (ctx->Pixel.PostConvolutionColorTableEnabled) mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT; if (ctx->ColorMatrixStack.Top->type != MATRIX_IDENTITY || ctx->Pixel.PostColorMatrixScale[0] != 1.0F || ctx->Pixel.PostColorMatrixBias[0] != 0.0F || ctx->Pixel.PostColorMatrixScale[1] != 1.0F || ctx->Pixel.PostColorMatrixBias[1] != 0.0F || ctx->Pixel.PostColorMatrixScale[2] != 1.0F || ctx->Pixel.PostColorMatrixBias[2] != 0.0F || ctx->Pixel.PostColorMatrixScale[3] != 1.0F || ctx->Pixel.PostColorMatrixBias[3] != 0.0F) mask |= IMAGE_COLOR_MATRIX_BIT; if (ctx->Pixel.PostColorMatrixColorTableEnabled) mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT; if (ctx->Pixel.HistogramEnabled) mask |= IMAGE_HISTOGRAM_BIT; if (ctx->Pixel.MinMaxEnabled) mask |= IMAGE_MIN_MAX_BIT; ctx->_ImageTransferState = mask; } void _mesa_update_pixel( GLcontext *ctx, GLuint new_state ) { if (new_state & _NEW_COLOR_MATRIX) _math_matrix_analyse( ctx->ColorMatrixStack.Top ); /* References ColorMatrix.type (derived above). */ if (new_state & _IMAGE_NEW_TRANSFER_STATE) update_image_transfer_state(ctx); } /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ /** * Initialize the context's PIXEL attribute group. */ void _mesa_init_pixel( GLcontext *ctx ) { int i; /* Pixel group */ ctx->Pixel.RedBias = 0.0; ctx->Pixel.RedScale = 1.0; ctx->Pixel.GreenBias = 0.0; ctx->Pixel.GreenScale = 1.0; ctx->Pixel.BlueBias = 0.0; ctx->Pixel.BlueScale = 1.0; ctx->Pixel.AlphaBias = 0.0; ctx->Pixel.AlphaScale = 1.0; ctx->Pixel.DepthBias = 0.0; ctx->Pixel.DepthScale = 1.0; ctx->Pixel.IndexOffset = 0; ctx->Pixel.IndexShift = 0; ctx->Pixel.ZoomX = 1.0; ctx->Pixel.ZoomY = 1.0; ctx->Pixel.MapColorFlag = GL_FALSE; ctx->Pixel.MapStencilFlag = GL_FALSE; ctx->Pixel.MapStoSsize = 1; ctx->Pixel.MapItoIsize = 1; ctx->Pixel.MapItoRsize = 1; ctx->Pixel.MapItoGsize = 1; ctx->Pixel.MapItoBsize = 1; ctx->Pixel.MapItoAsize = 1; ctx->Pixel.MapRtoRsize = 1; ctx->Pixel.MapGtoGsize = 1; ctx->Pixel.MapBtoBsize = 1; ctx->Pixel.MapAtoAsize = 1; ctx->Pixel.MapStoS[0] = 0; ctx->Pixel.MapItoI[0] = 0.0; ctx->Pixel.MapItoR[0] = 0.0; ctx->Pixel.MapItoG[0] = 0.0; ctx->Pixel.MapItoB[0] = 0.0; ctx->Pixel.MapItoA[0] = 0.0; ctx->Pixel.MapItoR8[0] = 0; ctx->Pixel.MapItoG8[0] = 0; ctx->Pixel.MapItoB8[0] = 0; ctx->Pixel.MapItoA8[0] = 0; ctx->Pixel.MapRtoR[0] = 0.0; ctx->Pixel.MapGtoG[0] = 0.0; ctx->Pixel.MapBtoB[0] = 0.0; ctx->Pixel.MapAtoA[0] = 0.0; ctx->Pixel.HistogramEnabled = GL_FALSE; ctx->Pixel.MinMaxEnabled = GL_FALSE; ctx->Pixel.PixelTextureEnabled = GL_FALSE; ctx->Pixel.FragmentRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; ctx->Pixel.FragmentAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; ASSIGN_4V(ctx->Pixel.PostColorMatrixScale, 1.0, 1.0, 1.0, 1.0); ASSIGN_4V(ctx->Pixel.PostColorMatrixBias, 0.0, 0.0, 0.0, 0.0); ASSIGN_4V(ctx->Pixel.ColorTableScale, 1.0, 1.0, 1.0, 1.0); ASSIGN_4V(ctx->Pixel.ColorTableBias, 0.0, 0.0, 0.0, 0.0); ASSIGN_4V(ctx->Pixel.PCCTscale, 1.0, 1.0, 1.0, 1.0); ASSIGN_4V(ctx->Pixel.PCCTbias, 0.0, 0.0, 0.0, 0.0); ASSIGN_4V(ctx->Pixel.PCMCTscale, 1.0, 1.0, 1.0, 1.0); ASSIGN_4V(ctx->Pixel.PCMCTbias, 0.0, 0.0, 0.0, 0.0); ctx->Pixel.ColorTableEnabled = GL_FALSE; ctx->Pixel.PostConvolutionColorTableEnabled = GL_FALSE; ctx->Pixel.PostColorMatrixColorTableEnabled = GL_FALSE; ctx->Pixel.Convolution1DEnabled = GL_FALSE; ctx->Pixel.Convolution2DEnabled = GL_FALSE; ctx->Pixel.Separable2DEnabled = GL_FALSE; for (i = 0; i < 3; i++) { ASSIGN_4V(ctx->Pixel.ConvolutionBorderColor[i], 0.0, 0.0, 0.0, 0.0); ctx->Pixel.ConvolutionBorderMode[i] = GL_REDUCE; ASSIGN_4V(ctx->Pixel.ConvolutionFilterScale[i], 1.0, 1.0, 1.0, 1.0); ASSIGN_4V(ctx->Pixel.ConvolutionFilterBias[i], 0.0, 0.0, 0.0, 0.0); } for (i = 0; i < MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_WIDTH * 4; i++) { ctx->Convolution1D.Filter[i] = 0.0; ctx->Convolution2D.Filter[i] = 0.0; ctx->Separable2D.Filter[i] = 0.0; } ASSIGN_4V(ctx->Pixel.PostConvolutionScale, 1.0, 1.0, 1.0, 1.0); ASSIGN_4V(ctx->Pixel.PostConvolutionBias, 0.0, 0.0, 0.0, 0.0); /* GL_SGI_texture_color_table */ ASSIGN_4V(ctx->Pixel.TextureColorTableScale, 1.0, 1.0, 1.0, 1.0); ASSIGN_4V(ctx->Pixel.TextureColorTableBias, 0.0, 0.0, 0.0, 0.0); /* Pixel transfer */ ctx->Pack.Alignment = 4; ctx->Pack.RowLength = 0; ctx->Pack.ImageHeight = 0; ctx->Pack.SkipPixels = 0; ctx->Pack.SkipRows = 0; ctx->Pack.SkipImages = 0; ctx->Pack.SwapBytes = GL_FALSE; ctx->Pack.LsbFirst = GL_FALSE; ctx->Pack.ClientStorage = GL_FALSE; ctx->Pack.Invert = GL_FALSE; #if FEATURE_EXT_pixel_buffer_object ctx->Pack.BufferObj = ctx->Array.NullBufferObj; #endif ctx->Unpack.Alignment = 4; ctx->Unpack.RowLength = 0; ctx->Unpack.ImageHeight = 0; ctx->Unpack.SkipPixels = 0; ctx->Unpack.SkipRows = 0; ctx->Unpack.SkipImages = 0; ctx->Unpack.SwapBytes = GL_FALSE; ctx->Unpack.LsbFirst = GL_FALSE; ctx->Unpack.ClientStorage = GL_FALSE; ctx->Unpack.Invert = GL_FALSE; #if FEATURE_EXT_pixel_buffer_object ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; #endif /* * _mesa_unpack_image() returns image data in this format. When we * execute image commands (glDrawPixels(), glTexImage(), etc) from * within display lists we have to be sure to set the current * unpacking parameters to these values! */ ctx->DefaultPacking.Alignment = 1; ctx->DefaultPacking.RowLength = 0; ctx->DefaultPacking.SkipPixels = 0; ctx->DefaultPacking.SkipRows = 0; ctx->DefaultPacking.ImageHeight = 0; ctx->DefaultPacking.SkipImages = 0; ctx->DefaultPacking.SwapBytes = GL_FALSE; ctx->DefaultPacking.LsbFirst = GL_FALSE; ctx->DefaultPacking.ClientStorage = GL_FALSE; ctx->DefaultPacking.Invert = GL_FALSE; #if FEATURE_EXT_pixel_buffer_object ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; #endif if (ctx->Visual.doubleBufferMode) { ctx->Pixel.ReadBuffer = GL_BACK; } else { ctx->Pixel.ReadBuffer = GL_FRONT; } /* Miscellaneous */ ctx->_ImageTransferState = 0; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/pixel.h0000644000000000000000000001001513614532424017430 0ustar /** * \file pixel.h * Pixel operations. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef PIXEL_H #define PIXEL_H #include "mtypes.h" /** \name API functions */ /*@{*/ extern void GLAPIENTRY _mesa_GetPixelMapfv( GLenum map, GLfloat *values ); extern void GLAPIENTRY _mesa_GetPixelMapuiv( GLenum map, GLuint *values ); extern void GLAPIENTRY _mesa_GetPixelMapusv( GLenum map, GLushort *values ); extern void GLAPIENTRY _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values ); extern void GLAPIENTRY _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values ); extern void GLAPIENTRY _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ); extern void GLAPIENTRY _mesa_PixelStoref( GLenum pname, GLfloat param ); extern void GLAPIENTRY _mesa_PixelStorei( GLenum pname, GLint param ); extern void GLAPIENTRY _mesa_PixelTransferf( GLenum pname, GLfloat param ); extern void GLAPIENTRY _mesa_PixelTransferi( GLenum pname, GLint param ); extern void GLAPIENTRY _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ); /*@}*/ /** \name Pixel processing functions */ /*@{*/ extern void _mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4], GLfloat rScale, GLfloat gScale, GLfloat bScale, GLfloat aScale, GLfloat rBias, GLfloat gBias, GLfloat bBias, GLfloat aBias); extern void _mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); extern void _mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); extern void _mesa_lookup_rgba_float(const struct gl_color_table *table, GLuint n, GLfloat rgba[][4]); extern void _mesa_lookup_rgba_chan(const struct gl_color_table *table, GLuint n, GLchan rgba[][4]); extern void _mesa_shift_and_offset_ci(const GLcontext *ctx, GLuint n, GLuint indexes[]); extern void _mesa_map_ci(const GLcontext *ctx, GLuint n, GLuint index[]); extern void _mesa_map_ci_to_rgba_chan(const GLcontext *ctx, GLuint n, const GLuint index[], GLchan rgba[][4]); extern void _mesa_map_ci_to_rgba(const GLcontext *ctx, GLuint n, const GLuint index[], GLfloat rgba[][4]); extern void _mesa_map_ci8_to_rgba(const GLcontext *ctx, GLuint n, const GLubyte index[], GLchan rgba[][4]); extern void _mesa_shift_and_offset_stencil(const GLcontext *ctx, GLuint n, GLstencil indexes[]); extern void _mesa_map_stencil(const GLcontext *ctx, GLuint n, GLstencil index[]); extern void _mesa_chan_to_float_span(const GLcontext *ctx, GLuint n, CONST GLchan rgba[][4], GLfloat rgbaf[][4]); extern void _mesa_update_pixel( GLcontext *ctx, GLuint newstate ); extern void _mesa_init_pixel( GLcontext * ctx ); /*@}*/ #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/points.c0000644000000000000000000002061413614532424017624 0ustar /** * \file points.c * Point operations. */ /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "context.h" #include "macros.h" #include "points.h" #include "texstate.h" #include "mtypes.h" /** * Set current point size. * \param size point diameter in pixels * \sa glPointSize(). */ void GLAPIENTRY _mesa_PointSize( GLfloat size ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (size <= 0.0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPointSize" ); return; } if (ctx->Point.Size == size) return; FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.Size = size; if (ctx->Driver.PointSize) ctx->Driver.PointSize(ctx, size); } #if _HAVE_FULL_GL /* * Added by GL_NV_point_sprite */ void GLAPIENTRY _mesa_PointParameteriNV( GLenum pname, GLint param ) { const GLfloat value = (GLfloat) param; _mesa_PointParameterfvEXT(pname, &value); } /* * Added by GL_NV_point_sprite */ void GLAPIENTRY _mesa_PointParameterivNV( GLenum pname, const GLint *params ) { const GLfloat value = (GLfloat) params[0]; _mesa_PointParameterfvEXT(pname, &value); } /* * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters. */ void GLAPIENTRY _mesa_PointParameterfEXT( GLenum pname, GLfloat param) { _mesa_PointParameterfvEXT(pname, ¶m); } /* * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters. */ void GLAPIENTRY _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { case GL_DISTANCE_ATTENUATION_EXT: if (ctx->Extensions.EXT_point_parameters) { if (TEST_EQ_3V(ctx->Point.Params, params)) return; FLUSH_VERTICES(ctx, _NEW_POINT); COPY_3V(ctx->Point.Params, params); } else { _mesa_error(ctx, GL_INVALID_ENUM, "glPointParameterf[v]{EXT,ARB}(pname)"); return; } break; case GL_POINT_SIZE_MIN_EXT: if (ctx->Extensions.EXT_point_parameters) { if (params[0] < 0.0F) { _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterf[v]{EXT,ARB}(param)" ); return; } if (ctx->Point.MinSize == params[0]) return; FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.MinSize = params[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glPointParameterf[v]{EXT,ARB}(pname)"); return; } break; case GL_POINT_SIZE_MAX_EXT: if (ctx->Extensions.EXT_point_parameters) { if (params[0] < 0.0F) { _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterf[v]{EXT,ARB}(param)" ); return; } if (ctx->Point.MaxSize == params[0]) return; FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.MaxSize = params[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glPointParameterf[v]{EXT,ARB}(pname)"); return; } break; case GL_POINT_FADE_THRESHOLD_SIZE_EXT: if (ctx->Extensions.EXT_point_parameters) { if (params[0] < 0.0F) { _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterf[v]{EXT,ARB}(param)" ); return; } if (ctx->Point.Threshold == params[0]) return; FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.Threshold = params[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glPointParameterf[v]{EXT,ARB}(pname)"); return; } break; case GL_POINT_SPRITE_R_MODE_NV: /* This is one area where ARB_point_sprite and NV_point_sprite * differ. In ARB_point_sprite the POINT_SPRITE_R_MODE is * always ZERO. NV_point_sprite adds the S and R modes. */ if (ctx->Extensions.NV_point_sprite) { GLenum value = (GLenum) params[0]; if (value != GL_ZERO && value != GL_S && value != GL_R) { _mesa_error(ctx, GL_INVALID_VALUE, "glPointParameterf[v]{EXT,ARB}(param)"); return; } if (ctx->Point.SpriteRMode == value) return; FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.SpriteRMode = value; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glPointParameterf[v]{EXT,ARB}(pname)"); return; } break; case GL_POINT_SPRITE_COORD_ORIGIN: if (ctx->Extensions.ARB_point_sprite) { GLenum value = (GLenum) params[0]; if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) { _mesa_error(ctx, GL_INVALID_VALUE, "glPointParameterf[v]{EXT,ARB}(param)"); return; } if (ctx->Point.SpriteOrigin == value) return; FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.SpriteOrigin = value; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glPointParameterf[v]{EXT,ARB}(pname)"); return; } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glPointParameterf[v]{EXT,ARB}(pname)" ); return; } if (ctx->Driver.PointParameterfv) (*ctx->Driver.PointParameterfv)(ctx, pname, params); } #endif /** * Update derived point-related state. */ void _mesa_update_point(GLcontext *ctx) { /* clamp to user-specified limits now, clamp to ctx->Const.Min/Max * limits during rasterization. */ ctx->Point._Size = CLAMP(ctx->Point.Size, ctx->Point.MinSize, ctx->Point.MaxSize); if (ctx->Point._Size == 1.0F) ctx->_TriangleCaps &= ~DD_POINT_SIZE; else ctx->_TriangleCaps |= DD_POINT_SIZE; ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 || ctx->Point.Params[1] != 0.0 || ctx->Point.Params[2] != 0.0); if (ctx->Point._Attenuated) ctx->_TriangleCaps |= DD_POINT_ATTEN; else ctx->_TriangleCaps &= ~DD_POINT_ATTEN; } /** * Initialize the context point state. * * \param ctx GL context. * * Initializes __GLcontextRec::Point and point related constants in * __GLcontextRec::Const. */ void _mesa_init_point(GLcontext *ctx) { GLuint i; ctx->Point.SmoothFlag = GL_FALSE; ctx->Point.Size = 1.0; ctx->Point._Size = 1.0; ctx->Point.Params[0] = 1.0; ctx->Point.Params[1] = 0.0; ctx->Point.Params[2] = 0.0; ctx->Point._Attenuated = GL_FALSE; ctx->Point.MinSize = 0.0; ctx->Point.MaxSize = MAX2(ctx->Const.MaxPointSize, ctx->Const.MaxPointSizeAA); ctx->Point.Threshold = 1.0; ctx->Point.PointSprite = GL_FALSE; /* GL_ARB/NV_point_sprite */ ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */ ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */ for (i = 0; i < MAX_TEXTURE_UNITS; i++) { ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_ARB/NV_point_sprite */ } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/points.h0000644000000000000000000000336213614532424017632 0ustar /** * \file points.h * Point operations. */ /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef POINTS_H #define POINTS_H #include "mtypes.h" extern void GLAPIENTRY _mesa_PointSize( GLfloat size ); extern void GLAPIENTRY _mesa_PointParameteriNV( GLenum pname, GLint param ); extern void GLAPIENTRY _mesa_PointParameterivNV( GLenum pname, const GLint *params ); extern void GLAPIENTRY _mesa_PointParameterfEXT( GLenum pname, GLfloat param ); extern void GLAPIENTRY _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params ); extern void _mesa_update_point(GLcontext *ctx); extern void _mesa_init_point( GLcontext * ctx ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/polygon.c0000644000000000000000000002524413614532424020003 0ustar /** * \file polygon.c * Polygon operations. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "imports.h" #include "bufferobj.h" #include "context.h" #include "image.h" #include "enums.h" #include "macros.h" #include "polygon.h" #include "mtypes.h" /** * Specify whether to cull front- or back-facing facets. * * \param mode culling mode. * * \sa glCullFace(). * * Verifies the parameter and updates gl_polygon_attrib::CullFaceMode. On * change, flushes the vertices and notifies the driver via * the dd_function_table::CullFace callback. */ void GLAPIENTRY _mesa_CullFace( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glCullFace %s\n", _mesa_lookup_enum_by_nr(mode)); if (mode!=GL_FRONT && mode!=GL_BACK && mode!=GL_FRONT_AND_BACK) { _mesa_error( ctx, GL_INVALID_ENUM, "glCullFace" ); return; } if (ctx->Polygon.CullFaceMode == mode) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.CullFaceMode = mode; if (ctx->Driver.CullFace) ctx->Driver.CullFace( ctx, mode ); } /** * Define front- and back-facing * * \param mode orientation of front-facing polygons. * * \sa glFrontFace(). * * Verifies the parameter and updates gl_polygon_attrib::FrontFace. On change * flushes the vertices and notifies the driver via * the dd_function_table::FrontFace callback. */ void GLAPIENTRY _mesa_FrontFace( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glFrontFace %s\n", _mesa_lookup_enum_by_nr(mode)); if (mode!=GL_CW && mode!=GL_CCW) { _mesa_error( ctx, GL_INVALID_ENUM, "glFrontFace" ); return; } if (ctx->Polygon.FrontFace == mode) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.FrontFace = mode; ctx->Polygon._FrontBit = (GLboolean) (mode == GL_CW); if (ctx->Driver.FrontFace) ctx->Driver.FrontFace( ctx, mode ); } /** * Set the polygon rasterization mode. * * \param face the polygons which \p mode applies to. * \param mode how polygons should be rasterized. * * \sa glPolygonMode(). * * Verifies the parameters and updates gl_polygon_attrib::FrontMode and * gl_polygon_attrib::BackMode. On change flushes the vertices and notifies the * driver via the dd_function_table::PolygonMode callback. */ void GLAPIENTRY _mesa_PolygonMode( GLenum face, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glPolygonMode %s %s\n", _mesa_lookup_enum_by_nr(face), _mesa_lookup_enum_by_nr(mode)); if (mode!=GL_POINT && mode!=GL_LINE && mode!=GL_FILL) { _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(mode)" ); return; } switch (face) { case GL_FRONT: if (ctx->Polygon.FrontMode == mode) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.FrontMode = mode; break; case GL_FRONT_AND_BACK: if (ctx->Polygon.FrontMode == mode && ctx->Polygon.BackMode == mode) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.FrontMode = mode; ctx->Polygon.BackMode = mode; break; case GL_BACK: if (ctx->Polygon.BackMode == mode) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.BackMode = mode; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" ); return; } ctx->_TriangleCaps &= ~DD_TRI_UNFILLED; if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=GL_FILL) ctx->_TriangleCaps |= DD_TRI_UNFILLED; if (ctx->Driver.PolygonMode) { (*ctx->Driver.PolygonMode)( ctx, face, mode ); } } #if _HAVE_FULL_GL /** * This routine updates the ctx->Polygon.Stipple state. * If we're getting the stipple data from a PBO, we map the buffer * in order to access the data. * In any case, we obey the current pixel unpacking parameters when fetching * the stipple data. * * In the future, this routine should be used as a fallback, called via * ctx->Driver.PolygonStipple(). We'll have to update all the DRI drivers * too. */ void _mesa_polygon_stipple(GLcontext *ctx, const GLubyte *pattern) { if (ctx->Unpack.BufferObj->Name) { /* Get/unpack the stipple pattern from a PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(2, &ctx->Unpack, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, pattern)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glPolygonStipple(bad PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, ctx->Unpack.BufferObj); if (!buf) { _mesa_error(ctx, GL_INVALID_OPERATION, "glPolygonStipple(PBO mapped)"); return; } buf = ADD_POINTERS(buf, pattern); _mesa_unpack_polygon_stipple(buf, ctx->PolygonStipple, &ctx->Unpack); ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, ctx->Unpack.BufferObj); } else { /* Get/unpack the stipple pattern from user memory */ _mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack); } } /** * Called by glPolygonStipple. */ void GLAPIENTRY _mesa_PolygonStipple( const GLubyte *pattern ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glPolygonStipple\n"); FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE); _mesa_polygon_stipple(ctx, pattern); if (ctx->Driver.PolygonStipple) ctx->Driver.PolygonStipple(ctx, pattern); } /** * Called by glPolygonStipple. */ void GLAPIENTRY _mesa_GetPolygonStipple( GLubyte *dest ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glGetPolygonStipple\n"); /* XXX someday we may put this code into a separate function and call * it with ctx->Driver.GetPolygonStipple(). */ if (ctx->Pack.BufferObj->Name) { /* Put/pack the stipple pattern into a PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(2, &ctx->Pack, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, dest)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetPolygonStipple(bad PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); if (!buf) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetPolygonStipple(PBO mapped)"); return; } buf = ADD_POINTERS(buf, dest); _mesa_pack_polygon_stipple(ctx->PolygonStipple, buf, &ctx->Pack); ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, ctx->Pack.BufferObj); } else { /* Put/pack the stipple pattern into user memory */ _mesa_pack_polygon_stipple(ctx->PolygonStipple, dest, &ctx->Pack); } } void GLAPIENTRY _mesa_PolygonOffset( GLfloat factor, GLfloat units ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glPolygonOffset %f %f\n", factor, units); if (ctx->Polygon.OffsetFactor == factor && ctx->Polygon.OffsetUnits == units) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.OffsetFactor = factor; ctx->Polygon.OffsetUnits = units; if (ctx->Driver.PolygonOffset) ctx->Driver.PolygonOffset( ctx, factor, units ); } void GLAPIENTRY _mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) { GET_CURRENT_CONTEXT(ctx); /* XXX mult by DepthMaxF here??? */ _mesa_PolygonOffset(factor, bias * ctx->DrawBuffer->_DepthMaxF ); } #endif /**********************************************************************/ /** \name State Management */ /*@{*/ /* * Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET * in ctx->_TriangleCaps if needed. */ void _mesa_update_polygon( GLcontext *ctx ) { ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET); if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK; /* Any Polygon offsets enabled? */ if (ctx->Polygon.OffsetPoint || ctx->Polygon.OffsetLine || ctx->Polygon.OffsetFill) { ctx->_TriangleCaps |= DD_TRI_OFFSET; } } /*@}*/ /**********************************************************************/ /** \name Initialization */ /*@{*/ /** * Initialize the context polygon state. * * \param ctx GL context. * * Initializes __GLcontextRec::Polygon and __GLcontextRec::PolygonStipple * attribute groups. */ void _mesa_init_polygon( GLcontext * ctx ) { /* Polygon group */ ctx->Polygon.CullFlag = GL_FALSE; ctx->Polygon.CullFaceMode = GL_BACK; ctx->Polygon.FrontFace = GL_CCW; ctx->Polygon._FrontBit = 0; ctx->Polygon.FrontMode = GL_FILL; ctx->Polygon.BackMode = GL_FILL; ctx->Polygon.SmoothFlag = GL_FALSE; ctx->Polygon.StippleFlag = GL_FALSE; ctx->Polygon.OffsetFactor = 0.0F; ctx->Polygon.OffsetUnits = 0.0F; ctx->Polygon.OffsetPoint = GL_FALSE; ctx->Polygon.OffsetLine = GL_FALSE; ctx->Polygon.OffsetFill = GL_FALSE; /* Polygon Stipple group */ MEMSET( ctx->PolygonStipple, 0xff, 32*sizeof(GLuint) ); } /*@}*/ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/polygon.h0000644000000000000000000000363513614532424020010 0ustar /** * \file polygon.h * Polygon operations. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef POLYGON_H #define POLYGON_H #include "mtypes.h" extern void _mesa_polygon_stipple(GLcontext *ctx, const GLubyte *pattern); extern void GLAPIENTRY _mesa_CullFace( GLenum mode ); extern void GLAPIENTRY _mesa_FrontFace( GLenum mode ); extern void GLAPIENTRY _mesa_PolygonMode( GLenum face, GLenum mode ); extern void GLAPIENTRY _mesa_PolygonOffset( GLfloat factor, GLfloat units ); extern void GLAPIENTRY _mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias ); extern void GLAPIENTRY _mesa_PolygonStipple( const GLubyte *mask ); extern void GLAPIENTRY _mesa_GetPolygonStipple( GLubyte *mask ); extern void _mesa_update_polygon( GLcontext *ctx ); extern void _mesa_init_polygon( GLcontext * ctx ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/rastpos.c0000644000000000000000000006471013614532424020010 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file rastpos.c * Raster position operations. */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "feedback.h" #include "light.h" #include "macros.h" #include "rastpos.h" #include "state.h" #include "simple_list.h" #include "mtypes.h" #include "math/m_matrix.h" /** * Clip a point against the view volume. * * \param v vertex vector describing the point to clip. * * \return zero if outside view volume, or one if inside. */ static GLuint viewclip_point( const GLfloat v[] ) { if ( v[0] > v[3] || v[0] < -v[3] || v[1] > v[3] || v[1] < -v[3] || v[2] > v[3] || v[2] < -v[3] ) { return 0; } else { return 1; } } /** * Clip a point against the far/near Z clipping planes. * * \param v vertex vector describing the point to clip. * * \return zero if outside view volume, or one if inside. */ static GLuint viewclip_point_z( const GLfloat v[] ) { if (v[2] > v[3] || v[2] < -v[3] ) { return 0; } else { return 1; } } /** * Clip a point against the user clipping planes. * * \param ctx GL context. * \param v vertex vector describing the point to clip. * * \return zero if the point was clipped, or one otherwise. */ static GLuint userclip_point( GLcontext *ctx, const GLfloat v[] ) { GLuint p; for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0] + v[1] * ctx->Transform._ClipUserPlane[p][1] + v[2] * ctx->Transform._ClipUserPlane[p][2] + v[3] * ctx->Transform._ClipUserPlane[p][3]; if (dot < 0.0F) { return 0; } } } return 1; } /** * This has been split off to allow the normal shade routines to * get a little closer to the vertex buffer, and to use the * GLvector objects directly. * \param ctx the context * \param vertex vertex location * \param normal normal vector * \param Rcolor returned color * \param Rspec returned specular color (if separate specular enabled) * \param Rindex returned color index */ static void shade_rastpos(GLcontext *ctx, const GLfloat vertex[4], const GLfloat normal[3], GLfloat Rcolor[4], GLfloat Rspec[4], GLfloat *Rindex) { GLfloat (*base)[3] = ctx->Light._BaseColor; struct gl_light *light; GLfloat diffuseColor[4], specularColor[4]; GLfloat diffuse = 0, specular = 0; if (!ctx->_ShineTable[0] || !ctx->_ShineTable[1]) _mesa_validate_all_lighting_tables( ctx ); COPY_3V(diffuseColor, base[0]); diffuseColor[3] = CLAMP( ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3], 0.0F, 1.0F ); ASSIGN_4V(specularColor, 0.0, 0.0, 0.0, 0.0); foreach (light, &ctx->Light.EnabledList) { GLfloat n_dot_h; GLfloat attenuation = 1.0; GLfloat VP[3]; GLfloat n_dot_VP; GLfloat *h; GLfloat diffuseContrib[3], specularContrib[3]; GLboolean normalized; if (!(light->_Flags & LIGHT_POSITIONAL)) { COPY_3V(VP, light->_VP_inf_norm); attenuation = light->_VP_inf_spot_attenuation; } else { GLfloat d; SUB_3V(VP, light->_Position, vertex); d = (GLfloat) LEN_3FV( VP ); if ( d > 1e-6) { GLfloat invd = 1.0F / d; SELF_SCALE_SCALAR_3V(VP, invd); } attenuation = 1.0F / (light->ConstantAttenuation + d * (light->LinearAttenuation + d * light->QuadraticAttenuation)); if (light->_Flags & LIGHT_SPOT) { GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); if (PV_dot_dir_CosCutoff) { continue; } else { double x = PV_dot_dir * (EXP_TABLE_SIZE-1); int k = (int) x; GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] + (x-k)*light->_SpotExpTable[k][1]); attenuation *= spot; } } } if (attenuation < 1e-3) continue; n_dot_VP = DOT3( normal, VP ); if (n_dot_VP < 0.0F) { ACC_SCALE_SCALAR_3V(diffuseColor, attenuation, light->_MatAmbient[0]); continue; } COPY_3V(diffuseContrib, light->_MatAmbient[0]); ACC_SCALE_SCALAR_3V(diffuseContrib, n_dot_VP, light->_MatDiffuse[0]); diffuse += n_dot_VP * light->_dli * attenuation; ASSIGN_3V(specularContrib, 0.0, 0.0, 0.0); { if (ctx->Light.Model.LocalViewer) { GLfloat v[3]; COPY_3V(v, vertex); NORMALIZE_3FV(v); SUB_3V(VP, VP, v); h = VP; normalized = 0; } else if (light->_Flags & LIGHT_POSITIONAL) { h = VP; ACC_3V(h, ctx->_EyeZDir); normalized = 0; } else { h = light->_h_inf_norm; normalized = 1; } n_dot_h = DOT3(normal, h); if (n_dot_h > 0.0F) { GLfloat (*mat)[4] = ctx->Light.Material.Attrib; GLfloat spec_coef; GLfloat shininess = mat[MAT_ATTRIB_FRONT_SHININESS][0]; if (!normalized) { n_dot_h *= n_dot_h; n_dot_h /= LEN_SQUARED_3FV( h ); shininess *= .5; } GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec_coef ); if (spec_coef > 1.0e-10) { if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) { ACC_SCALE_SCALAR_3V( specularContrib, spec_coef, light->_MatSpecular[0]); } else { ACC_SCALE_SCALAR_3V( diffuseContrib, spec_coef, light->_MatSpecular[0]); } specular += spec_coef * light->_sli * attenuation; } } } ACC_SCALE_SCALAR_3V( diffuseColor, attenuation, diffuseContrib ); ACC_SCALE_SCALAR_3V( specularColor, attenuation, specularContrib ); } if (ctx->Visual.rgbMode) { Rcolor[0] = CLAMP(diffuseColor[0], 0.0F, 1.0F); Rcolor[1] = CLAMP(diffuseColor[1], 0.0F, 1.0F); Rcolor[2] = CLAMP(diffuseColor[2], 0.0F, 1.0F); Rcolor[3] = CLAMP(diffuseColor[3], 0.0F, 1.0F); Rspec[0] = CLAMP(specularColor[0], 0.0F, 1.0F); Rspec[1] = CLAMP(specularColor[1], 0.0F, 1.0F); Rspec[2] = CLAMP(specularColor[2], 0.0F, 1.0F); Rspec[3] = CLAMP(specularColor[3], 0.0F, 1.0F); } else { GLfloat *ind = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_INDEXES]; GLfloat d_a = ind[MAT_INDEX_DIFFUSE] - ind[MAT_INDEX_AMBIENT]; GLfloat s_a = ind[MAT_INDEX_SPECULAR] - ind[MAT_INDEX_AMBIENT]; GLfloat i = (ind[MAT_INDEX_AMBIENT] + diffuse * (1.0F-specular) * d_a + specular * s_a); if (i > ind[MAT_INDEX_SPECULAR]) { i = ind[MAT_INDEX_SPECULAR]; } *Rindex = i; } } /** * Do texgen needed for glRasterPos. * \param ctx rendering context * \param vObj object-space vertex coordinate * \param vEye eye-space vertex coordinate * \param normal vertex normal * \param unit texture unit number * \param texcoord incoming texcoord and resulting texcoord */ static void compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4], const GLfloat normal[3], GLuint unit, GLfloat texcoord[4]) { const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; /* always compute sphere map terms, just in case */ GLfloat u[3], two_nu, rx, ry, rz, m, mInv; COPY_3V(u, vEye); NORMALIZE_3FV(u); two_nu = 2.0F * DOT3(normal, u); rx = u[0] - normal[0] * two_nu; ry = u[1] - normal[1] * two_nu; rz = u[2] - normal[2] * two_nu; m = rx * rx + ry * ry + (rz + 1.0F) * (rz + 1.0F); if (m > 0.0F) mInv = 0.5F * _mesa_inv_sqrtf(m); else mInv = 0.0F; if (texUnit->TexGenEnabled & S_BIT) { switch (texUnit->GenModeS) { case GL_OBJECT_LINEAR: texcoord[0] = DOT4(vObj, texUnit->ObjectPlaneS); break; case GL_EYE_LINEAR: texcoord[0] = DOT4(vEye, texUnit->EyePlaneS); break; case GL_SPHERE_MAP: texcoord[0] = rx * mInv + 0.5F; break; case GL_REFLECTION_MAP: texcoord[0] = rx; break; case GL_NORMAL_MAP: texcoord[0] = normal[0]; break; default: _mesa_problem(ctx, "Bad S texgen in compute_texgen()"); return; } } if (texUnit->TexGenEnabled & T_BIT) { switch (texUnit->GenModeT) { case GL_OBJECT_LINEAR: texcoord[1] = DOT4(vObj, texUnit->ObjectPlaneT); break; case GL_EYE_LINEAR: texcoord[1] = DOT4(vEye, texUnit->EyePlaneT); break; case GL_SPHERE_MAP: texcoord[1] = ry * mInv + 0.5F; break; case GL_REFLECTION_MAP: texcoord[1] = ry; break; case GL_NORMAL_MAP: texcoord[1] = normal[1]; break; default: _mesa_problem(ctx, "Bad T texgen in compute_texgen()"); return; } } if (texUnit->TexGenEnabled & R_BIT) { switch (texUnit->GenModeR) { case GL_OBJECT_LINEAR: texcoord[2] = DOT4(vObj, texUnit->ObjectPlaneR); break; case GL_EYE_LINEAR: texcoord[2] = DOT4(vEye, texUnit->EyePlaneR); break; case GL_REFLECTION_MAP: texcoord[2] = rz; break; case GL_NORMAL_MAP: texcoord[2] = normal[2]; break; default: _mesa_problem(ctx, "Bad R texgen in compute_texgen()"); return; } } if (texUnit->TexGenEnabled & Q_BIT) { switch (texUnit->GenModeQ) { case GL_OBJECT_LINEAR: texcoord[3] = DOT4(vObj, texUnit->ObjectPlaneQ); break; case GL_EYE_LINEAR: texcoord[3] = DOT4(vEye, texUnit->EyePlaneQ); break; default: _mesa_problem(ctx, "Bad Q texgen in compute_texgen()"); return; } } } /** * Set the raster position for pixel operations. * * All glRasterPos command call this function to update the current * raster position. * * \param ctx GL context. * \param x x coordinate for the raster position. * \param y y coordinate for the raster position. * \param z z coordinate for the raster position. * \param w w coordinate for the raster position. * * \sa Called by _mesa_RasterPos4f(). * * Flushes the vertices, transforms and clips the vertex coordinates, and * finally sets the current raster position and associated data in * __GLcontextRec::Current. When in selection mode calls * _mesa_update_hitflag() with the current raster position. */ static void raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); FLUSH_CURRENT(ctx, 0); if (ctx->NewState) _mesa_update_state( ctx ); if (ctx->VertexProgram._Enabled) { /* XXX implement this */ _mesa_problem(ctx, "Vertex programs not implemented for glRasterPos"); return; } else { GLfloat obj[4], eye[4], clip[4], ndc[3], d; GLfloat *norm, eyenorm[3]; GLfloat *objnorm = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; ASSIGN_4V( obj, x, y, z, w ); /* apply modelview matrix: eye = MV * obj */ TRANSFORM_POINT( eye, ctx->ModelviewMatrixStack.Top->m, obj ); /* apply projection matrix: clip = Proj * eye */ TRANSFORM_POINT( clip, ctx->ProjectionMatrixStack.Top->m, eye ); /* clip to view volume */ if (ctx->Transform.RasterPositionUnclipped) { /* GL_IBM_rasterpos_clip: only clip against Z */ if (viewclip_point_z(clip) == 0) { ctx->Current.RasterPosValid = GL_FALSE; return; } } else if (viewclip_point(clip) == 0) { /* Normal OpenGL behaviour */ ctx->Current.RasterPosValid = GL_FALSE; return; } /* clip to user clipping planes */ if (ctx->Transform.ClipPlanesEnabled && !userclip_point(ctx, clip)) { ctx->Current.RasterPosValid = GL_FALSE; return; } /* ndc = clip / W */ d = (clip[3] == 0.0F) ? 1.0F : 1.0F / clip[3]; ndc[0] = clip[0] * d; ndc[1] = clip[1] * d; ndc[2] = clip[2] * d; /* wincoord = viewport_mapping(ndc) */ ctx->Current.RasterPos[0] = (ndc[0] * ctx->Viewport._WindowMap.m[MAT_SX] + ctx->Viewport._WindowMap.m[MAT_TX]); ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport._WindowMap.m[MAT_SY] + ctx->Viewport._WindowMap.m[MAT_TY]); ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport._WindowMap.m[MAT_SZ] + ctx->Viewport._WindowMap.m[MAT_TZ]) / ctx->DrawBuffer->_DepthMaxF; ctx->Current.RasterPos[3] = clip[3]; /* compute raster distance */ if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; else ctx->Current.RasterDistance = SQRTF( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] ); /* compute transformed normal vector (for lighting or texgen) */ if (ctx->_NeedEyeCoords) { const GLfloat *inv = ctx->ModelviewMatrixStack.Top->inv; TRANSFORM_NORMAL( eyenorm, objnorm, inv ); norm = eyenorm; } else { norm = objnorm; } /* update raster color */ if (ctx->Light.Enabled) { /* lighting */ shade_rastpos( ctx, obj, norm, ctx->Current.RasterColor, ctx->Current.RasterSecondaryColor, &ctx->Current.RasterIndex ); } else { /* use current color or index */ if (ctx->Visual.rgbMode) { COPY_4FV(ctx->Current.RasterColor, ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); COPY_4FV(ctx->Current.RasterSecondaryColor, ctx->Current.Attrib[VERT_ATTRIB_COLOR1]); } else { ctx->Current.RasterIndex = ctx->Current.Index; } } /* texture coords */ { GLuint u; for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) { GLfloat tc[4]; COPY_4V(tc, ctx->Current.Attrib[VERT_ATTRIB_TEX0 + u]); if (ctx->Texture.Unit[u].TexGenEnabled) { compute_texgen(ctx, obj, eye, norm, u, tc); } TRANSFORM_POINT(ctx->Current.RasterTexCoords[u], ctx->TextureMatrixStack[u].Top->m, tc); } } ctx->Current.RasterPosValid = GL_TRUE; } if (ctx->RenderMode == GL_SELECT) { _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); } } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2d(GLdouble x, GLdouble y) { _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2f(GLfloat x, GLfloat y) { _mesa_RasterPos4f(x, y, 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2i(GLint x, GLint y) { _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2s(GLshort x, GLshort y) { _mesa_RasterPos4f(x, y, 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) { _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) { _mesa_RasterPos4f(x, y, z, 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3i(GLint x, GLint y, GLint z) { _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3s(GLshort x, GLshort y, GLshort z) { _mesa_RasterPos4f(x, y, z, 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } /** Calls raster_pos4f() */ void GLAPIENTRY _mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GET_CURRENT_CONTEXT(ctx); raster_pos4f(ctx, x, y, z, w); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w) { _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) { _mesa_RasterPos4f(x, y, z, w); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2dv(const GLdouble *v) { _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2fv(const GLfloat *v) { _mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2iv(const GLint *v) { _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2sv(const GLshort *v) { _mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3dv(const GLdouble *v) { _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3fv(const GLfloat *v) { _mesa_RasterPos4f(v[0], v[1], v[2], 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3iv(const GLint *v) { _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3sv(const GLshort *v) { _mesa_RasterPos4f(v[0], v[1], v[2], 1.0F); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos4dv(const GLdouble *v) { _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos4fv(const GLfloat *v) { _mesa_RasterPos4f(v[0], v[1], v[2], v[3]); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos4iv(const GLint *v) { _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } /** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos4sv(const GLshort *v) { _mesa_RasterPos4f(v[0], v[1], v[2], v[3]); } /**********************************************************************/ /*** GL_ARB_window_pos / GL_MESA_window_pos ***/ /**********************************************************************/ #if FEATURE_windowpos /** * All glWindowPosMESA and glWindowPosARB commands call this function to * update the current raster position. */ static void window_pos3f(GLfloat x, GLfloat y, GLfloat z) { GET_CURRENT_CONTEXT(ctx); GLfloat z2; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); FLUSH_CURRENT(ctx, 0); z2 = CLAMP(z, 0.0F, 1.0F) * (ctx->Viewport.Far - ctx->Viewport.Near) + ctx->Viewport.Near; /* set raster position */ ctx->Current.RasterPos[0] = x; ctx->Current.RasterPos[1] = y; ctx->Current.RasterPos[2] = z2; ctx->Current.RasterPos[3] = 1.0F; ctx->Current.RasterPosValid = GL_TRUE; if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; else ctx->Current.RasterDistance = 0.0; /* raster color = current color or index */ if (ctx->Visual.rgbMode) { ctx->Current.RasterColor[0] = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0], 0.0F, 1.0F); ctx->Current.RasterColor[1] = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1], 0.0F, 1.0F); ctx->Current.RasterColor[2] = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2], 0.0F, 1.0F); ctx->Current.RasterColor[3] = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3], 0.0F, 1.0F); ctx->Current.RasterSecondaryColor[0] = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0], 0.0F, 1.0F); ctx->Current.RasterSecondaryColor[1] = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1], 0.0F, 1.0F); ctx->Current.RasterSecondaryColor[2] = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2], 0.0F, 1.0F); ctx->Current.RasterSecondaryColor[3] = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F); } else { ctx->Current.RasterIndex = ctx->Current.Index; } /* raster texcoord = current texcoord */ { GLuint texSet; for (texSet = 0; texSet < ctx->Const.MaxTextureCoordUnits; texSet++) { COPY_4FV( ctx->Current.RasterTexCoords[texSet], ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] ); } } if (ctx->RenderMode==GL_SELECT) { _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); } } /* This is just to support the GL_MESA_window_pos version */ static void window_pos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GET_CURRENT_CONTEXT(ctx); window_pos3f(x, y, z); ctx->Current.RasterPos[3] = w; } void GLAPIENTRY _mesa_WindowPos2dMESA(GLdouble x, GLdouble y) { window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } void GLAPIENTRY _mesa_WindowPos2fMESA(GLfloat x, GLfloat y) { window_pos4f(x, y, 0.0F, 1.0F); } void GLAPIENTRY _mesa_WindowPos2iMESA(GLint x, GLint y) { window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } void GLAPIENTRY _mesa_WindowPos2sMESA(GLshort x, GLshort y) { window_pos4f(x, y, 0.0F, 1.0F); } void GLAPIENTRY _mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) { window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } void GLAPIENTRY _mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) { window_pos4f(x, y, z, 1.0F); } void GLAPIENTRY _mesa_WindowPos3iMESA(GLint x, GLint y, GLint z) { window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } void GLAPIENTRY _mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) { window_pos4f(x, y, z, 1.0F); } void GLAPIENTRY _mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } void GLAPIENTRY _mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { window_pos4f(x, y, z, w); } void GLAPIENTRY _mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) { window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } void GLAPIENTRY _mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) { window_pos4f(x, y, z, w); } void GLAPIENTRY _mesa_WindowPos2dvMESA(const GLdouble *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } void GLAPIENTRY _mesa_WindowPos2fvMESA(const GLfloat *v) { window_pos4f(v[0], v[1], 0.0F, 1.0F); } void GLAPIENTRY _mesa_WindowPos2ivMESA(const GLint *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } void GLAPIENTRY _mesa_WindowPos2svMESA(const GLshort *v) { window_pos4f(v[0], v[1], 0.0F, 1.0F); } void GLAPIENTRY _mesa_WindowPos3dvMESA(const GLdouble *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } void GLAPIENTRY _mesa_WindowPos3fvMESA(const GLfloat *v) { window_pos4f(v[0], v[1], v[2], 1.0); } void GLAPIENTRY _mesa_WindowPos3ivMESA(const GLint *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } void GLAPIENTRY _mesa_WindowPos3svMESA(const GLshort *v) { window_pos4f(v[0], v[1], v[2], 1.0F); } void GLAPIENTRY _mesa_WindowPos4dvMESA(const GLdouble *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } void GLAPIENTRY _mesa_WindowPos4fvMESA(const GLfloat *v) { window_pos4f(v[0], v[1], v[2], v[3]); } void GLAPIENTRY _mesa_WindowPos4ivMESA(const GLint *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } void GLAPIENTRY _mesa_WindowPos4svMESA(const GLshort *v) { window_pos4f(v[0], v[1], v[2], v[3]); } #endif #if 0 /* * OpenGL implementation of glWindowPos*MESA() */ void glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GLfloat fx, fy; /* Push current matrix mode and viewport attributes */ glPushAttrib( GL_TRANSFORM_BIT | GL_VIEWPORT_BIT ); /* Setup projection parameters */ glMatrixMode( GL_PROJECTION ); glPushMatrix(); glLoadIdentity(); glMatrixMode( GL_MODELVIEW ); glPushMatrix(); glLoadIdentity(); glDepthRange( z, z ); glViewport( (int) x - 1, (int) y - 1, 2, 2 ); /* set the raster (window) position */ fx = x - (int) x; fy = y - (int) y; glRasterPos4f( fx, fy, 0.0, w ); /* restore matrices, viewport and matrix mode */ glPopMatrix(); glMatrixMode( GL_PROJECTION ); glPopMatrix(); glPopAttrib(); } #endif /**********************************************************************/ /** \name Initialization */ /**********************************************************************/ /*@{*/ /** * Initialize the context current raster position information. * * \param ctx GL context. * * Initialize the current raster position information in * __GLcontextRec::Current, and adds the extension entry points to the * dispatcher. */ void _mesa_init_rastpos( GLcontext * ctx ) { int i; ASSIGN_4V( ctx->Current.RasterPos, 0.0, 0.0, 0.0, 1.0 ); ctx->Current.RasterDistance = 0.0; ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 ); ctx->Current.RasterIndex = 1.0; for (i=0; iCurrent.RasterTexCoords[i], 0.0, 0.0, 0.0, 1.0 ); ctx->Current.RasterPosValid = GL_TRUE; } /*@}*/ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/rastpos.h0000644000000000000000000001155413614532424020013 0ustar /** * \file rastpos.h * Raster position operations. */ /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef RASTPOS_H #define RASTPOS_H #include "glheader.h" extern void GLAPIENTRY _mesa_RasterPos2d(GLdouble x, GLdouble y); extern void GLAPIENTRY _mesa_RasterPos2f(GLfloat x, GLfloat y); extern void GLAPIENTRY _mesa_RasterPos2i(GLint x, GLint y); extern void GLAPIENTRY _mesa_RasterPos2s(GLshort x, GLshort y); extern void GLAPIENTRY _mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z); extern void GLAPIENTRY _mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z); extern void GLAPIENTRY _mesa_RasterPos3i(GLint x, GLint y, GLint z); extern void GLAPIENTRY _mesa_RasterPos3s(GLshort x, GLshort y, GLshort z); extern void GLAPIENTRY _mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w); extern void GLAPIENTRY _mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w); extern void GLAPIENTRY _mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w); extern void GLAPIENTRY _mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w); extern void GLAPIENTRY _mesa_RasterPos2dv(const GLdouble *v); extern void GLAPIENTRY _mesa_RasterPos2fv(const GLfloat *v); extern void GLAPIENTRY _mesa_RasterPos2iv(const GLint *v); extern void GLAPIENTRY _mesa_RasterPos2sv(const GLshort *v); extern void GLAPIENTRY _mesa_RasterPos3dv(const GLdouble *v); extern void GLAPIENTRY _mesa_RasterPos3fv(const GLfloat *v); extern void GLAPIENTRY _mesa_RasterPos3iv(const GLint *v); extern void GLAPIENTRY _mesa_RasterPos3sv(const GLshort *v); extern void GLAPIENTRY _mesa_RasterPos4dv(const GLdouble *v); extern void GLAPIENTRY _mesa_RasterPos4fv(const GLfloat *v); extern void GLAPIENTRY _mesa_RasterPos4iv(const GLint *v); extern void GLAPIENTRY _mesa_RasterPos4sv(const GLshort *v); /**********************************************************************/ /** \name GL_MESA_window_pos */ /**********************************************************************/ /*@{*/ extern void GLAPIENTRY _mesa_WindowPos2dMESA(GLdouble x, GLdouble y); extern void GLAPIENTRY _mesa_WindowPos2fMESA(GLfloat x, GLfloat y); extern void GLAPIENTRY _mesa_WindowPos2iMESA(GLint x, GLint y); extern void GLAPIENTRY _mesa_WindowPos2sMESA(GLshort x, GLshort y); extern void GLAPIENTRY _mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z); extern void GLAPIENTRY _mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z); extern void GLAPIENTRY _mesa_WindowPos3iMESA(GLint x, GLint y, GLint z); extern void GLAPIENTRY _mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z); extern void GLAPIENTRY _mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w); extern void GLAPIENTRY _mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w); extern void GLAPIENTRY _mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w); extern void GLAPIENTRY _mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w); extern void GLAPIENTRY _mesa_WindowPos2dvMESA(const GLdouble *v); extern void GLAPIENTRY _mesa_WindowPos2fvMESA(const GLfloat *v); extern void GLAPIENTRY _mesa_WindowPos2ivMESA(const GLint *v); extern void GLAPIENTRY _mesa_WindowPos2svMESA(const GLshort *v); extern void GLAPIENTRY _mesa_WindowPos3dvMESA(const GLdouble *v); extern void GLAPIENTRY _mesa_WindowPos3fvMESA(const GLfloat *v); extern void GLAPIENTRY _mesa_WindowPos3ivMESA(const GLint *v); extern void GLAPIENTRY _mesa_WindowPos3svMESA(const GLshort *v); extern void GLAPIENTRY _mesa_WindowPos4dvMESA(const GLdouble *v); extern void GLAPIENTRY _mesa_WindowPos4fvMESA(const GLfloat *v); extern void GLAPIENTRY _mesa_WindowPos4ivMESA(const GLint *v); extern void GLAPIENTRY _mesa_WindowPos4svMESA(const GLshort *v); extern void _mesa_init_rastpos( GLcontext * ctx ); /*@}*/ #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/renderbuffer.c0000644000000000000000000015545613614532424020776 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * Functions for allocating/managing renderbuffers. * Also, routines for reading/writing software-based renderbuffer data as * ubytes, ushorts, uints, etc. * * The 'alpha8' renderbuffer is interesting. It's used to add a software-based * alpha channel to RGB renderbuffers. This is done by wrapping the RGB * renderbuffer with the alpha renderbuffer. We can do this because of the * OO-nature of renderbuffers. * * Down the road we'll use this for run-time support of 8, 16 and 32-bit * color channels. For example, Mesa may use 32-bit/float color channels * internally (swrast) and use wrapper renderbuffers to convert 32-bit * values down to 16 or 8-bit values for whatever kind of framebuffer we have. */ #include "glheader.h" #include "imports.h" #include "context.h" #include "mtypes.h" #include "fbobject.h" #include "renderbuffer.h" #define COLOR_INDEX32 0x424243 /* * Routines for get/put values in common buffer formats follow. * Someday add support for arbitrary row stride to make them more * flexible. */ /********************************************************************** * Functions for buffers of 1 X GLushort values. * Typically stencil. */ static void * get_pointer_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { if (!rb->Data) return NULL; ASSERT(rb->DataType == GL_UNSIGNED_BYTE); return (GLubyte *) rb->Data + y * rb->Width + x; } static void get_row_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values) { const GLubyte *src = (const GLubyte *) rb->Data + y * rb->Width + x; ASSERT(rb->DataType == GL_UNSIGNED_BYTE); _mesa_memcpy(values, src, count * sizeof(GLubyte)); } static void get_values_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values) { GLubyte *dst = (GLubyte *) values; GLuint i; assert(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { const GLubyte *src = (GLubyte *) rb->Data + y[i] * rb->Width + x[i]; dst[i] = *src; } } static void put_row_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const GLubyte *src = (const GLubyte *) values; GLubyte *dst = (GLubyte *) rb->Data + y * rb->Width + x; assert(rb->DataType == GL_UNSIGNED_BYTE); if (mask) { GLuint i; for (i = 0; i < count; i++) { if (mask[i]) { dst[i] = src[i]; } } } else { _mesa_memcpy(dst, values, count * sizeof(GLubyte)); } } static void put_mono_row_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { const GLubyte val = *((const GLubyte *) value); GLubyte *dst = (GLubyte *) rb->Data + y * rb->Width + x; assert(rb->DataType == GL_UNSIGNED_BYTE); if (mask) { GLuint i; for (i = 0; i < count; i++) { if (mask[i]) { dst[i] = val; } } } else { GLuint i; for (i = 0; i < count; i++) { dst[i] = val; } } } static void put_values_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { const GLubyte *src = (const GLubyte *) values; GLuint i; assert(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLubyte *dst = (GLubyte *) rb->Data + y[i] * rb->Width + x[i]; *dst = src[i]; } } } static void put_mono_values_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { const GLubyte val = *((const GLubyte *) value); GLuint i; assert(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLubyte *dst = (GLubyte *) rb->Data + y[i] * rb->Width + x[i]; *dst = val; } } } /********************************************************************** * Functions for buffers of 1 X GLushort values. * Typically depth/Z. */ static void * get_pointer_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { if (!rb->Data) return NULL; ASSERT(rb->DataType == GL_UNSIGNED_SHORT); ASSERT(rb->Width > 0); return (GLushort *) rb->Data + y * rb->Width + x; } static void get_row_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values) { const void *src = rb->GetPointer(ctx, rb, x, y); ASSERT(rb->DataType == GL_UNSIGNED_SHORT); _mesa_memcpy(values, src, count * sizeof(GLushort)); } static void get_values_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values) { GLushort *dst = (GLushort *) values; GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_SHORT); for (i = 0; i < count; i++) { const GLushort *src = (GLushort *) rb->Data + y[i] * rb->Width + x[i]; dst[i] = *src; } } static void put_row_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const GLushort *src = (const GLushort *) values; GLushort *dst = (GLushort *) rb->Data + y * rb->Width + x; ASSERT(rb->DataType == GL_UNSIGNED_SHORT); if (mask) { GLuint i; for (i = 0; i < count; i++) { if (mask[i]) { dst[i] = src[i]; } } } else { _mesa_memcpy(dst, src, count * sizeof(GLushort)); } } static void put_mono_row_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { const GLushort val = *((const GLushort *) value); GLushort *dst = (GLushort *) rb->Data + y * rb->Width + x; ASSERT(rb->DataType == GL_UNSIGNED_SHORT); if (mask) { GLuint i; for (i = 0; i < count; i++) { if (mask[i]) { dst[i] = val; } } } else { GLuint i; for (i = 0; i < count; i++) { dst[i] = val; } } } static void put_values_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { const GLushort *src = (const GLushort *) values; GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_SHORT); for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLushort *dst = (GLushort *) rb->Data + y[i] * rb->Width + x[i]; *dst = src[i]; } } } static void put_mono_values_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { const GLushort val = *((const GLushort *) value); ASSERT(rb->DataType == GL_UNSIGNED_SHORT); if (mask) { GLuint i; for (i = 0; i < count; i++) { if (mask[i]) { GLushort *dst = (GLushort *) rb->Data + y[i] * rb->Width + x[i]; *dst = val; } } } else { GLuint i; for (i = 0; i < count; i++) { GLushort *dst = (GLushort *) rb->Data + y[i] * rb->Width + x[i]; *dst = val; } } } /********************************************************************** * Functions for buffers of 1 X GLuint values. * Typically depth/Z or color index. */ static void * get_pointer_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { if (!rb->Data) return NULL; ASSERT(rb->DataType == GL_UNSIGNED_INT); return (GLuint *) rb->Data + y * rb->Width + x; } static void get_row_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values) { const void *src = rb->GetPointer(ctx, rb, x, y); ASSERT(rb->DataType == GL_UNSIGNED_INT); _mesa_memcpy(values, src, count * sizeof(GLuint)); } static void get_values_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values) { GLuint *dst = (GLuint *) values; GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_INT); for (i = 0; i < count; i++) { const GLuint *src = (GLuint *) rb->Data + y[i] * rb->Width + x[i]; dst[i] = *src; } } static void put_row_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const GLuint *src = (const GLuint *) values; GLuint *dst = (GLuint *) rb->Data + y * rb->Width + x; ASSERT(rb->DataType == GL_UNSIGNED_INT); if (mask) { GLuint i; for (i = 0; i < count; i++) { if (mask[i]) { dst[i] = src[i]; } } } else { _mesa_memcpy(dst, src, count * sizeof(GLuint)); } } static void put_mono_row_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { const GLuint val = *((const GLuint *) value); GLuint *dst = (GLuint *) rb->Data + y * rb->Width + x; GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_INT); for (i = 0; i < count; i++) { if (!mask || mask[i]) { dst[i] = val; } } } static void put_values_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { const GLuint *src = (const GLuint *) values; GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_INT); for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLuint *dst = (GLuint *) rb->Data + y[i] * rb->Width + x[i]; *dst = src[i]; } } } static void put_mono_values_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { const GLuint val = *((const GLuint *) value); GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_INT); for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLuint *dst = (GLuint *) rb->Data + y[i] * rb->Width + x[i]; *dst = val; } } } /********************************************************************** * Functions for buffers of 3 X GLubyte (or GLbyte) values. * Typically color buffers. * NOTE: the incoming and outgoing colors are RGBA! We ignore incoming * alpha values and return 255 for outgoing alpha values. */ static void * get_pointer_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { /* No direct access since this buffer is RGB but caller will be * treating it as if it were RGBA. */ return NULL; } static void get_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values) { const GLubyte *src = (const GLubyte *) rb->Data + 3 * (y * rb->Width + x); GLubyte *dst = (GLubyte *) values; GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { dst[i * 4 + 0] = src[i * 3 + 0]; dst[i * 4 + 1] = src[i * 3 + 1]; dst[i * 4 + 2] = src[i * 3 + 2]; dst[i * 4 + 3] = 255; } } static void get_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values) { GLubyte *dst = (GLubyte *) values; GLuint i; assert(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { const GLubyte *src = (GLubyte *) rb->Data + 3 * (y[i] * rb->Width + x[i]); dst[i * 4 + 0] = src[0]; dst[i * 4 + 1] = src[1]; dst[i * 4 + 2] = src[2]; dst[i * 4 + 3] = 255; } } static void put_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { /* note: incoming values are RGB+A! */ const GLubyte *src = (const GLubyte *) values; GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x); GLuint i; assert(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { if (!mask || mask[i]) { dst[i * 3 + 0] = src[i * 4 + 0]; dst[i * 3 + 1] = src[i * 4 + 1]; dst[i * 3 + 2] = src[i * 4 + 2]; } } } static void put_row_rgb_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { /* note: incoming values are RGB+A! */ const GLubyte *src = (const GLubyte *) values; GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x); GLuint i; assert(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { if (!mask || mask[i]) { dst[i * 3 + 0] = src[i * 3 + 0]; dst[i * 3 + 1] = src[i * 3 + 1]; dst[i * 3 + 2] = src[i * 3 + 2]; } } } static void put_mono_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { /* note: incoming value is RGB+A! */ const GLubyte val0 = ((const GLubyte *) value)[0]; const GLubyte val1 = ((const GLubyte *) value)[1]; const GLubyte val2 = ((const GLubyte *) value)[2]; GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x); assert(rb->DataType == GL_UNSIGNED_BYTE); if (!mask && val0 == val1 && val1 == val2) { /* optimized case */ _mesa_memset(dst, val0, 3 * count); } else { GLuint i; for (i = 0; i < count; i++) { if (!mask || mask[i]) { dst[i * 3 + 0] = val0; dst[i * 3 + 1] = val1; dst[i * 3 + 2] = val2; } } } } static void put_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { /* note: incoming values are RGB+A! */ const GLubyte *src = (const GLubyte *) values; GLuint i; assert(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLubyte *dst = (GLubyte *) rb->Data + 3 * (y[i] * rb->Width + x[i]); dst[0] = src[i * 4 + 0]; dst[1] = src[i * 4 + 1]; dst[2] = src[i * 4 + 2]; } } } static void put_mono_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { /* note: incoming value is RGB+A! */ const GLubyte val0 = ((const GLubyte *) value)[0]; const GLubyte val1 = ((const GLubyte *) value)[1]; const GLubyte val2 = ((const GLubyte *) value)[2]; GLuint i; assert(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLubyte *dst = (GLubyte *) rb->Data + 3 * (y[i] * rb->Width + x[i]); dst[0] = val0; dst[1] = val1; dst[2] = val2; } } } /********************************************************************** * Functions for buffers of 4 X GLubyte (or GLbyte) values. * Typically color buffers. */ static void * get_pointer_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { if (!rb->Data) return NULL; ASSERT(rb->DataType == GL_UNSIGNED_BYTE); return (GLubyte *) rb->Data + 4 * (y * rb->Width + x); } static void get_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values) { const GLbyte *src = (const GLbyte *) rb->Data + 4 * (y * rb->Width + x); ASSERT(rb->DataType == GL_UNSIGNED_BYTE); _mesa_memcpy(values, src, 4 * count * sizeof(GLbyte)); } static void get_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values) { /* treat 4*GLubyte as 1*GLuint */ GLuint *dst = (GLuint *) values; GLuint i; assert(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { const GLuint *src = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]); dst[i] = *src; } } static void put_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { /* treat 4*GLubyte as 1*GLuint */ const GLuint *src = (const GLuint *) values; GLuint *dst = (GLuint *) rb->Data + (y * rb->Width + x); assert(rb->DataType == GL_UNSIGNED_BYTE); if (mask) { GLuint i; for (i = 0; i < count; i++) { if (mask[i]) { dst[i] = src[i]; } } } else { _mesa_memcpy(dst, src, 4 * count * sizeof(GLubyte)); } } static void put_row_rgb_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { /* Store RGB values in RGBA buffer */ const GLubyte *src = (const GLubyte *) values; GLubyte *dst = (GLubyte *) rb->Data + 4 * (y * rb->Width + x); GLuint i; assert(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { if (!mask || mask[i]) { dst[i * 4 + 0] = src[i * 3 + 0]; dst[i * 4 + 1] = src[i * 3 + 1]; dst[i * 4 + 2] = src[i * 3 + 2]; dst[i * 4 + 3] = 0xff; } } } static void put_mono_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { /* treat 4*GLubyte as 1*GLuint */ const GLuint val = *((const GLuint *) value); GLuint *dst = (GLuint *) rb->Data + (y * rb->Width + x); assert(rb->DataType == GL_UNSIGNED_BYTE); if (!mask && val == 0) { /* common case */ _mesa_bzero(dst, count * 4 * sizeof(GLubyte)); } else { /* general case */ if (mask) { GLuint i; for (i = 0; i < count; i++) { if (mask[i]) { dst[i] = val; } } } else { GLuint i; for (i = 0; i < count; i++) { dst[i] = val; } } } } static void put_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { /* treat 4*GLubyte as 1*GLuint */ const GLuint *src = (const GLuint *) values; GLuint i; assert(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLuint *dst = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]); *dst = src[i]; } } } static void put_mono_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { /* treat 4*GLubyte as 1*GLuint */ const GLuint val = *((const GLuint *) value); GLuint i; assert(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLuint *dst = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]); *dst = val; } } } /********************************************************************** * Functions for buffers of 4 X GLushort (or GLshort) values. * Typically accum buffer. */ static void * get_pointer_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { if (!rb->Data) return NULL; ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT); return (GLushort *) rb->Data + 4 * (y * rb->Width + x); } static void get_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values) { const GLshort *src = (const GLshort *) rb->Data + 4 * (y * rb->Width + x); ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT); _mesa_memcpy(values, src, 4 * count * sizeof(GLshort)); } static void get_values_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values) { GLushort *dst = (GLushort *) values; GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT); for (i = 0; i < count; i++) { const GLushort *src = (GLushort *) rb->Data + 4 * (y[i] * rb->Width + x[i]); dst[i] = *src; } } static void put_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const GLushort *src = (const GLushort *) values; GLushort *dst = (GLushort *) rb->Data + 4 * (y * rb->Width + x); ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT); if (mask) { GLuint i; for (i = 0; i < count; i++) { if (mask[i]) { dst[i * 4 + 0] = src[i * 4 + 0]; dst[i * 4 + 1] = src[i * 4 + 1]; dst[i * 4 + 2] = src[i * 4 + 2]; dst[i * 4 + 3] = src[i * 4 + 3]; } } } else { _mesa_memcpy(dst, src, 4 * count * sizeof(GLushort)); } } static void put_row_rgb_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { /* Put RGB values in RGBA buffer */ const GLushort *src = (const GLushort *) values; GLushort *dst = (GLushort *) rb->Data + 4 * (y * rb->Width + x); ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT); if (mask) { GLuint i; for (i = 0; i < count; i++) { if (mask[i]) { dst[i * 4 + 0] = src[i * 3 + 0]; dst[i * 4 + 1] = src[i * 3 + 1]; dst[i * 4 + 2] = src[i * 3 + 2]; dst[i * 4 + 3] = 0xffff; } } } else { _mesa_memcpy(dst, src, 4 * count * sizeof(GLushort)); } } static void put_mono_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { const GLushort val0 = ((const GLushort *) value)[0]; const GLushort val1 = ((const GLushort *) value)[1]; const GLushort val2 = ((const GLushort *) value)[2]; const GLushort val3 = ((const GLushort *) value)[3]; GLushort *dst = (GLushort *) rb->Data + 4 * (y * rb->Width + x); ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT); if (!mask && val0 == 0 && val1 == 0 && val2 == 0 && val3 == 0) { /* common case for clearing accum buffer */ _mesa_bzero(dst, count * 4 * sizeof(GLushort)); } else { GLuint i; for (i = 0; i < count; i++) { if (!mask || mask[i]) { dst[i * 4 + 0] = val0; dst[i * 4 + 1] = val1; dst[i * 4 + 2] = val2; dst[i * 4 + 3] = val3; } } } } static void put_values_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { const GLushort *src = (const GLushort *) values; GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT); for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLushort *dst = (GLushort *) rb->Data + 4 * (y[i] * rb->Width + x[i]); dst[0] = src[i * 4 + 0]; dst[1] = src[i * 4 + 1]; dst[2] = src[i * 4 + 2]; dst[3] = src[i * 4 + 3]; } } } static void put_mono_values_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { const GLushort val0 = ((const GLushort *) value)[0]; const GLushort val1 = ((const GLushort *) value)[1]; const GLushort val2 = ((const GLushort *) value)[2]; const GLushort val3 = ((const GLushort *) value)[3]; GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_SHORT || rb->DataType == GL_SHORT); for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLushort *dst = (GLushort *) rb->Data + 4 * (y[i] * rb->Width + x[i]); dst[0] = val0; dst[1] = val1; dst[2] = val2; dst[3] = val3; } } } /** * This is a software fallback for the gl_renderbuffer->AllocStorage * function. * Device drivers will typically override this function for the buffers * which it manages (typically color buffers, Z and stencil). * Other buffers (like software accumulation and aux buffers) which the driver * doesn't manage can be handled with this function. * * This one multi-purpose function can allocate stencil, depth, accum, color * or color-index buffers! * * This function also plugs in the appropriate GetPointer, Get/PutRow and * Get/PutValues functions. */ static GLboolean soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { GLuint pixelSize; switch (internalFormat) { case GL_RGB: case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: rb->_BaseFormat = GL_RGB; rb->DataType = GL_UNSIGNED_BYTE; rb->GetPointer = get_pointer_ubyte3; rb->GetRow = get_row_ubyte3; rb->GetValues = get_values_ubyte3; rb->PutRow = put_row_ubyte3; rb->PutRowRGB = put_row_rgb_ubyte3; rb->PutMonoRow = put_mono_row_ubyte3; rb->PutValues = put_values_ubyte3; rb->PutMonoValues = put_mono_values_ubyte3; rb->ComponentSizes[0] = 8 * sizeof(GLubyte); rb->ComponentSizes[1] = 8 * sizeof(GLubyte); rb->ComponentSizes[2] = 8 * sizeof(GLubyte); rb->ComponentSizes[3] = 0; pixelSize = 3 * sizeof(GLchan); break; case GL_RGBA: case GL_RGBA2: case GL_RGBA4: case GL_RGB5_A1: case GL_RGBA8: rb->_BaseFormat = GL_RGBA; rb->DataType = GL_UNSIGNED_BYTE; rb->GetPointer = get_pointer_ubyte4; rb->GetRow = get_row_ubyte4; rb->GetValues = get_values_ubyte4; rb->PutRow = put_row_ubyte4; rb->PutRowRGB = put_row_rgb_ubyte4; rb->PutMonoRow = put_mono_row_ubyte4; rb->PutValues = put_values_ubyte4; rb->PutMonoValues = put_mono_values_ubyte4; rb->ComponentSizes[0] = 8 * sizeof(GLubyte); rb->ComponentSizes[1] = 8 * sizeof(GLubyte); rb->ComponentSizes[2] = 8 * sizeof(GLubyte); rb->ComponentSizes[3] = 8 * sizeof(GLubyte); pixelSize = 4 * sizeof(GLubyte); break; case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: rb->_BaseFormat = GL_RGBA; rb->DataType = GL_UNSIGNED_SHORT; rb->GetPointer = get_pointer_ushort4; rb->GetRow = get_row_ushort4; rb->GetValues = get_values_ushort4; rb->PutRow = put_row_ushort4; rb->PutRowRGB = put_row_rgb_ushort4; rb->PutMonoRow = put_mono_row_ushort4; rb->PutValues = put_values_ushort4; rb->PutMonoValues = put_mono_values_ushort4; rb->ComponentSizes[0] = 8 * sizeof(GLushort); rb->ComponentSizes[1] = 8 * sizeof(GLushort); rb->ComponentSizes[2] = 8 * sizeof(GLushort); rb->ComponentSizes[3] = 8 * sizeof(GLushort); pixelSize = 4 * sizeof(GLushort); break; #if 00 case ALPHA8: rb->_BaseFormat = GL_RGBA; /* Yes, not GL_ALPHA! */ rb->DataType = GL_UNSIGNED_BYTE; rb->GetPointer = get_pointer_alpha8; rb->GetRow = get_row_alpha8; rb->GetValues = get_values_alpha8; rb->PutRow = put_row_alpha8; rb->PutRowRGB = NULL; rb->PutMonoRow = put_mono_row_alpha8; rb->PutValues = put_values_alpha8; rb->PutMonoValues = put_mono_values_alpha8; rb->ComponentSizes[0] = 0; /*red*/ rb->ComponentSizes[1] = 0; /*green*/ rb->ComponentSizes[2] = 0; /*blue*/ rb->ComponentSizes[3] = 8 * sizeof(GLubyte); pixelSize = sizeof(GLubyte); break; #endif case GL_STENCIL_INDEX: case GL_STENCIL_INDEX1_EXT: case GL_STENCIL_INDEX4_EXT: case GL_STENCIL_INDEX8_EXT: rb->_BaseFormat = GL_STENCIL_INDEX; rb->DataType = GL_UNSIGNED_BYTE; rb->GetPointer = get_pointer_ubyte; rb->GetRow = get_row_ubyte; rb->GetValues = get_values_ubyte; rb->PutRow = put_row_ubyte; rb->PutRowRGB = NULL; rb->PutMonoRow = put_mono_row_ubyte; rb->PutValues = put_values_ubyte; rb->PutMonoValues = put_mono_values_ubyte; rb->ComponentSizes[0] = 8 * sizeof(GLubyte); pixelSize = sizeof(GLubyte); break; case GL_STENCIL_INDEX16_EXT: rb->_BaseFormat = GL_STENCIL_INDEX; rb->DataType = GL_UNSIGNED_SHORT; rb->GetPointer = get_pointer_ushort; rb->GetRow = get_row_ushort; rb->GetValues = get_values_ushort; rb->PutRow = put_row_ushort; rb->PutRowRGB = NULL; rb->PutMonoRow = put_mono_row_ushort; rb->PutValues = put_values_ushort; rb->PutMonoValues = put_mono_values_ushort; rb->ComponentSizes[0] = 8 * sizeof(GLushort); pixelSize = sizeof(GLushort); break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16: rb->_BaseFormat = GL_DEPTH_COMPONENT; rb->DataType = GL_UNSIGNED_SHORT; rb->GetPointer = get_pointer_ushort; rb->GetRow = get_row_ushort; rb->GetValues = get_values_ushort; rb->PutRow = put_row_ushort; rb->PutRowRGB = NULL; rb->PutMonoRow = put_mono_row_ushort; rb->PutValues = put_values_ushort; rb->PutMonoValues = put_mono_values_ushort; rb->ComponentSizes[0] = 8 * sizeof(GLushort); pixelSize = sizeof(GLushort); break; case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: rb->_BaseFormat = GL_DEPTH_COMPONENT; rb->DataType = GL_UNSIGNED_INT; rb->GetPointer = get_pointer_uint; rb->GetRow = get_row_uint; rb->GetValues = get_values_uint; rb->PutRow = put_row_uint; rb->PutRowRGB = NULL; rb->PutMonoRow = put_mono_row_uint; rb->PutValues = put_values_uint; rb->PutMonoValues = put_mono_values_uint; rb->ComponentSizes[0] = 8 * sizeof(GLuint); pixelSize = sizeof(GLuint); break; case GL_COLOR_INDEX8_EXT: rb->_BaseFormat = GL_COLOR_INDEX; rb->DataType = GL_UNSIGNED_BYTE; rb->GetPointer = get_pointer_ubyte; rb->GetRow = get_row_ubyte; rb->GetValues = get_values_ubyte; rb->PutRow = put_row_ubyte; rb->PutRowRGB = NULL; rb->PutMonoRow = put_mono_row_ubyte; rb->PutValues = put_values_ubyte; rb->PutMonoValues = put_mono_values_ubyte; rb->ComponentSizes[0] = 8 * sizeof(GLubyte); pixelSize = sizeof(GLubyte); break; case GL_COLOR_INDEX16_EXT: rb->_BaseFormat = GL_COLOR_INDEX; rb->DataType = GL_UNSIGNED_SHORT; rb->GetPointer = get_pointer_ushort; rb->GetRow = get_row_ushort; rb->GetValues = get_values_ushort; rb->PutRow = put_row_ushort; rb->PutRowRGB = NULL; rb->PutMonoRow = put_mono_row_ushort; rb->PutValues = put_values_ushort; rb->PutMonoValues = put_mono_values_ushort; rb->ComponentSizes[0] = 8 * sizeof(GLushort); pixelSize = sizeof(GLushort); break; case COLOR_INDEX32: rb->_BaseFormat = GL_COLOR_INDEX; rb->DataType = GL_UNSIGNED_INT; rb->GetPointer = get_pointer_uint; rb->GetRow = get_row_uint; rb->GetValues = get_values_uint; rb->PutRow = put_row_uint; rb->PutRowRGB = NULL; rb->PutMonoRow = put_mono_row_uint; rb->PutValues = put_values_uint; rb->PutMonoValues = put_mono_values_uint; rb->ComponentSizes[0] = 8 * sizeof(GLuint); pixelSize = sizeof(GLuint); break; default: _mesa_problem(ctx, "Bad internalFormat in soft_renderbuffer_storage"); return GL_FALSE; } ASSERT(rb->DataType); ASSERT(rb->GetPointer); ASSERT(rb->GetRow); ASSERT(rb->GetValues); ASSERT(rb->PutRow); ASSERT(rb->PutMonoRow); ASSERT(rb->PutValues); ASSERT(rb->PutMonoValues); ASSERT(rb->ComponentSizes[0] > 0); /* free old buffer storage */ if (rb->Data) _mesa_free(rb->Data); /* allocate new buffer storage */ rb->Data = _mesa_malloc(width * height * pixelSize); if (rb->Data == NULL) { rb->Width = 0; rb->Height = 0; _mesa_error(ctx, GL_OUT_OF_MEMORY, "software renderbuffer allocation"); return GL_FALSE; } rb->Width = width; rb->Height = height; rb->InternalFormat = internalFormat; return GL_TRUE; } /**********************************************************************/ /**********************************************************************/ /**********************************************************************/ /** * Here we utilize the gl_renderbuffer->Wrapper field to put an alpha * buffer wrapper around an existing RGB renderbuffer (hw or sw). * * When PutRow is called (for example), we store the alpha values in * this buffer, then pass on the PutRow call to the wrapped RGB * buffer. */ static GLboolean alloc_storage_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLenum internalFormat, GLuint width, GLuint height) { ASSERT(arb != arb->Wrapped); /* first, pass the call to the wrapped RGB buffer */ if (!arb->Wrapped->AllocStorage(ctx, arb->Wrapped, internalFormat, width, height)) { return GL_FALSE; } /* next, resize my alpha buffer */ if (arb->Data) { _mesa_free(arb->Data); } arb->Data = _mesa_malloc(width * height * sizeof(GLubyte)); if (arb->Data == NULL) { arb->Width = 0; arb->Height = 0; _mesa_error(ctx, GL_OUT_OF_MEMORY, "software alpha buffer allocation"); return GL_FALSE; } arb->Width = width; arb->Height = height; arb->InternalFormat = internalFormat; return GL_TRUE; } /** * Delete an alpha_renderbuffer object, as well as the wrapped RGB buffer. */ static void delete_renderbuffer_alpha8(struct gl_renderbuffer *arb) { if (arb->Data) { _mesa_free(arb->Data); } ASSERT(arb->Wrapped); ASSERT(arb != arb->Wrapped); arb->Wrapped->Delete(arb->Wrapped); arb->Wrapped = NULL; _mesa_free(arb); } static void * get_pointer_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLint x, GLint y) { return NULL; /* don't allow direct access! */ } static void get_row_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, GLint x, GLint y, void *values) { /* NOTE: 'values' is RGBA format! */ const GLubyte *src = (const GLubyte *) arb->Data + y * arb->Width + x; GLubyte *dst = (GLubyte *) values; GLuint i; ASSERT(arb != arb->Wrapped); ASSERT(arb->DataType == GL_UNSIGNED_BYTE); /* first, pass the call to the wrapped RGB buffer */ arb->Wrapped->GetRow(ctx, arb->Wrapped, count, x, y, values); /* second, fill in alpha values from this buffer! */ for (i = 0; i < count; i++) { dst[i * 4 + 3] = src[i]; } } static void get_values_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, const GLint x[], const GLint y[], void *values) { GLubyte *dst = (GLubyte *) values; GLuint i; ASSERT(arb != arb->Wrapped); ASSERT(arb->DataType == GL_UNSIGNED_BYTE); /* first, pass the call to the wrapped RGB buffer */ arb->Wrapped->GetValues(ctx, arb->Wrapped, count, x, y, values); /* second, fill in alpha values from this buffer! */ for (i = 0; i < count; i++) { const GLubyte *src = (GLubyte *) arb->Data + y[i] * arb->Width + x[i]; dst[i * 4 + 3] = *src; } } static void put_row_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const GLubyte *src = (const GLubyte *) values; GLubyte *dst = (GLubyte *) arb->Data + y * arb->Width + x; GLuint i; ASSERT(arb != arb->Wrapped); ASSERT(arb->DataType == GL_UNSIGNED_BYTE); /* first, pass the call to the wrapped RGB buffer */ arb->Wrapped->PutRow(ctx, arb->Wrapped, count, x, y, values, mask); /* second, store alpha in our buffer */ for (i = 0; i < count; i++) { if (!mask || mask[i]) { dst[i] = src[i * 4 + 3]; } } } static void put_row_rgb_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const GLubyte *src = (const GLubyte *) values; GLubyte *dst = (GLubyte *) arb->Data + y * arb->Width + x; GLuint i; ASSERT(arb != arb->Wrapped); ASSERT(arb->DataType == GL_UNSIGNED_BYTE); /* first, pass the call to the wrapped RGB buffer */ arb->Wrapped->PutRowRGB(ctx, arb->Wrapped, count, x, y, values, mask); /* second, store alpha in our buffer */ for (i = 0; i < count; i++) { if (!mask || mask[i]) { dst[i] = src[i * 4 + 3]; } } } static void put_mono_row_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { const GLubyte val = ((const GLubyte *) value)[3]; GLubyte *dst = (GLubyte *) arb->Data + y * arb->Width + x; ASSERT(arb != arb->Wrapped); ASSERT(arb->DataType == GL_UNSIGNED_BYTE); /* first, pass the call to the wrapped RGB buffer */ arb->Wrapped->PutMonoRow(ctx, arb->Wrapped, count, x, y, value, mask); /* second, store alpha in our buffer */ if (mask) { GLuint i; for (i = 0; i < count; i++) { if (mask[i]) { dst[i] = val; } } } else { _mesa_memset(dst, val, count); } } static void put_values_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { const GLubyte *src = (const GLubyte *) values; GLuint i; ASSERT(arb != arb->Wrapped); ASSERT(arb->DataType == GL_UNSIGNED_BYTE); /* first, pass the call to the wrapped RGB buffer */ arb->Wrapped->PutValues(ctx, arb->Wrapped, count, x, y, values, mask); /* second, store alpha in our buffer */ for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLubyte *dst = (GLubyte *) arb->Data + y[i] * arb->Width + x[i]; *dst = src[i * 4 + 3]; } } } static void put_mono_values_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { const GLubyte val = ((const GLubyte *) value)[3]; GLuint i; ASSERT(arb != arb->Wrapped); ASSERT(arb->DataType == GL_UNSIGNED_BYTE); /* first, pass the call to the wrapped RGB buffer */ arb->Wrapped->PutValues(ctx, arb->Wrapped, count, x, y, value, mask); /* second, store alpha in our buffer */ for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLubyte *dst = (GLubyte *) arb->Data + y[i] * arb->Width + x[i]; *dst = val; } } } /**********************************************************************/ /**********************************************************************/ /**********************************************************************/ /** * Default GetPointer routine. Always return NULL to indicate that * direct buffer access is not supported. */ static void * nop_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { return NULL; } /** * Initialize the fields of a gl_renderbuffer to default values. */ void _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name) { rb->Name = name; rb->RefCount = 1; rb->Delete = _mesa_delete_renderbuffer; /* The rest of these should be set later by the caller of this function or * the AllocStorage method: */ rb->AllocStorage = NULL; rb->Width = 0; rb->Height = 0; rb->InternalFormat = GL_NONE; rb->_BaseFormat = GL_NONE; rb->DataType = GL_NONE; rb->ComponentSizes[0] = 0; rb->ComponentSizes[1] = 0; rb->ComponentSizes[2] = 0; rb->ComponentSizes[3] = 0; rb->Data = NULL; /* Point back to ourself so that we don't have to check for Wrapped==NULL * all over the drivers. */ rb->Wrapped = rb; rb->GetPointer = nop_get_pointer; rb->GetRow = NULL; rb->GetValues = NULL; rb->PutRow = NULL; rb->PutRowRGB = NULL; rb->PutMonoRow = NULL; rb->PutValues = NULL; rb->PutMonoValues = NULL; } /** * Allocate a new gl_renderbuffer object. This can be used for user-created * renderbuffers or window-system renderbuffers. */ struct gl_renderbuffer * _mesa_new_renderbuffer(GLcontext *ctx, GLuint name) { struct gl_renderbuffer *rb = CALLOC_STRUCT(gl_renderbuffer); if (rb) { _mesa_init_renderbuffer(rb, name); } return rb; } /** * Delete a gl_framebuffer. * This is the default function for framebuffer->Delete(). */ void _mesa_delete_renderbuffer(struct gl_renderbuffer *rb) { if (rb->Data) { _mesa_free(rb->Data); } _mesa_free(rb); } /** * Allocate a software-based renderbuffer. This is called via the * ctx->Driver.NewRenderbuffer() function when the user creates a new * renderbuffer. */ struct gl_renderbuffer * _mesa_new_soft_renderbuffer(GLcontext *ctx, GLuint name) { struct gl_renderbuffer *rb = _mesa_new_renderbuffer(ctx, name); if (rb) { rb->AllocStorage = soft_renderbuffer_storage; /* Normally, one would setup the PutRow, GetRow, etc functions here. * But we're doing that in the soft_renderbuffer_storage() function * instead. */ } return rb; } /** * Add software-based color renderbuffers to the given framebuffer. * This is a helper routine for device drivers when creating a * window system framebuffer (not a user-created render/framebuffer). * Once this function is called, you can basically forget about this * renderbuffer; core Mesa will handle all the buffer management and * rendering! */ GLboolean _mesa_add_color_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, GLuint rgbBits, GLuint alphaBits, GLboolean frontLeft, GLboolean backLeft, GLboolean frontRight, GLboolean backRight) { GLuint b; if (rgbBits > 16 || alphaBits > 16) { _mesa_problem(ctx, "Unsupported bit depth in _mesa_add_color_renderbuffers"); return GL_FALSE; } assert(MAX_COLOR_ATTACHMENTS >= 4); for (b = BUFFER_FRONT_LEFT; b <= BUFFER_BACK_RIGHT; b++) { struct gl_renderbuffer *rb; if (b == BUFFER_FRONT_LEFT && !frontLeft) continue; else if (b == BUFFER_BACK_LEFT && !backLeft) continue; else if (b == BUFFER_FRONT_RIGHT && !frontRight) continue; else if (b == BUFFER_BACK_RIGHT && !backRight) continue; assert(fb->Attachment[b].Renderbuffer == NULL); rb = _mesa_new_renderbuffer(ctx, 0); if (!rb) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating color buffer"); return GL_FALSE; } if (rgbBits <= 8) { if (alphaBits) rb->InternalFormat = GL_RGBA8; else rb->InternalFormat = GL_RGB8; } else { assert(rgbBits <= 16); if (alphaBits) rb->InternalFormat = GL_RGBA16; else rb->InternalFormat = GL_RGBA16; /* don't really have RGB16 yet */ } rb->AllocStorage = soft_renderbuffer_storage; _mesa_add_renderbuffer(fb, b, rb); } return GL_TRUE; } /** * Add software-based color index renderbuffers to the given framebuffer. * This is a helper routine for device drivers when creating a * window system framebuffer (not a user-created render/framebuffer). * Once this function is called, you can basically forget about this * renderbuffer; core Mesa will handle all the buffer management and * rendering! */ GLboolean _mesa_add_color_index_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, GLuint indexBits, GLboolean frontLeft, GLboolean backLeft, GLboolean frontRight, GLboolean backRight) { GLuint b; if (indexBits > 8) { _mesa_problem(ctx, "Unsupported bit depth in _mesa_add_color_renderbuffers"); return GL_FALSE; } assert(MAX_COLOR_ATTACHMENTS >= 4); for (b = BUFFER_FRONT_LEFT; b <= BUFFER_BACK_RIGHT; b++) { struct gl_renderbuffer *rb; if (b == BUFFER_FRONT_LEFT && !frontLeft) continue; else if (b == BUFFER_BACK_LEFT && !backLeft) continue; else if (b == BUFFER_FRONT_RIGHT && !frontRight) continue; else if (b == BUFFER_BACK_RIGHT && !backRight) continue; assert(fb->Attachment[b].Renderbuffer == NULL); rb = _mesa_new_renderbuffer(ctx, 0); if (!rb) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating color buffer"); return GL_FALSE; } if (indexBits <= 8) { /* only support GLuint for now */ /*rb->InternalFormat = GL_COLOR_INDEX8_EXT;*/ rb->InternalFormat = COLOR_INDEX32; } else { rb->InternalFormat = COLOR_INDEX32; } rb->AllocStorage = soft_renderbuffer_storage; _mesa_add_renderbuffer(fb, b, rb); } return GL_TRUE; } /** * Add software-based alpha renderbuffers to the given framebuffer. * This is a helper routine for device drivers when creating a * window system framebuffer (not a user-created render/framebuffer). * Once this function is called, you can basically forget about this * renderbuffer; core Mesa will handle all the buffer management and * rendering! */ GLboolean _mesa_add_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, GLuint alphaBits, GLboolean frontLeft, GLboolean backLeft, GLboolean frontRight, GLboolean backRight) { GLuint b; /* for window system framebuffers only! */ assert(fb->Name == 0); if (alphaBits > 8) { _mesa_problem(ctx, "Unsupported bit depth in _mesa_add_alpha_renderbuffers"); return GL_FALSE; } assert(MAX_COLOR_ATTACHMENTS >= 4); /* Wrap each of the RGB color buffers with an alpha renderbuffer. */ for (b = BUFFER_FRONT_LEFT; b <= BUFFER_BACK_RIGHT; b++) { struct gl_renderbuffer *arb; if (b == BUFFER_FRONT_LEFT && !frontLeft) continue; else if (b == BUFFER_BACK_LEFT && !backLeft) continue; else if (b == BUFFER_FRONT_RIGHT && !frontRight) continue; else if (b == BUFFER_BACK_RIGHT && !backRight) continue; /* the RGB buffer to wrap must already exist!! */ assert(fb->Attachment[b].Renderbuffer); /* only GLubyte supported for now */ assert(fb->Attachment[b].Renderbuffer->DataType == GL_UNSIGNED_BYTE); /* allocate alpha renderbuffer */ arb = _mesa_new_renderbuffer(ctx, 0); if (!arb) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating alpha buffer"); return GL_FALSE; } /* wrap the alpha renderbuffer around the RGB renderbuffer */ arb->Wrapped = fb->Attachment[b].Renderbuffer; /* Set up my alphabuffer fields and plug in my functions. * The functions will put/get the alpha values from/to RGBA arrays * and then call the wrapped buffer's functions to handle the RGB * values. */ arb->InternalFormat = arb->Wrapped->InternalFormat; arb->_BaseFormat = arb->Wrapped->_BaseFormat; arb->DataType = arb->Wrapped->DataType; arb->AllocStorage = alloc_storage_alpha8; arb->Delete = delete_renderbuffer_alpha8; arb->GetPointer = get_pointer_alpha8; arb->GetRow = get_row_alpha8; arb->GetValues = get_values_alpha8; arb->PutRow = put_row_alpha8; arb->PutRowRGB = put_row_rgb_alpha8; arb->PutMonoRow = put_mono_row_alpha8; arb->PutValues = put_values_alpha8; arb->PutMonoValues = put_mono_values_alpha8; /* clear the pointer to avoid assertion/sanity check failure later */ fb->Attachment[b].Renderbuffer = NULL; /* plug the alpha renderbuffer into the colorbuffer attachment */ _mesa_add_renderbuffer(fb, b, arb); } return GL_TRUE; } /** * Add a software-based depth renderbuffer to the given framebuffer. * This is a helper routine for device drivers when creating a * window system framebuffer (not a user-created render/framebuffer). * Once this function is called, you can basically forget about this * renderbuffer; core Mesa will handle all the buffer management and * rendering! */ GLboolean _mesa_add_depth_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, GLuint depthBits) { struct gl_renderbuffer *rb; if (depthBits > 32) { _mesa_problem(ctx, "Unsupported depthBits in _mesa_add_depth_renderbuffer"); return GL_FALSE; } assert(fb->Attachment[BUFFER_DEPTH].Renderbuffer == NULL); rb = _mesa_new_renderbuffer(ctx, 0); if (!rb) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating depth buffer"); return GL_FALSE; } if (depthBits <= 16) { rb->InternalFormat = GL_DEPTH_COMPONENT16; } else { rb->InternalFormat = GL_DEPTH_COMPONENT32; } rb->AllocStorage = soft_renderbuffer_storage; _mesa_add_renderbuffer(fb, BUFFER_DEPTH, rb); return GL_TRUE; } /** * Add a software-based stencil renderbuffer to the given framebuffer. * This is a helper routine for device drivers when creating a * window system framebuffer (not a user-created render/framebuffer). * Once this function is called, you can basically forget about this * renderbuffer; core Mesa will handle all the buffer management and * rendering! */ GLboolean _mesa_add_stencil_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, GLuint stencilBits) { struct gl_renderbuffer *rb; if (stencilBits > 16) { _mesa_problem(ctx, "Unsupported stencilBits in _mesa_add_stencil_renderbuffer"); return GL_FALSE; } assert(fb->Attachment[BUFFER_STENCIL].Renderbuffer == NULL); rb = _mesa_new_renderbuffer(ctx, 0); if (!rb) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating stencil buffer"); return GL_FALSE; } if (stencilBits <= 8) { rb->InternalFormat = GL_STENCIL_INDEX8_EXT; } else { /* not really supported (see s_stencil.c code) */ rb->InternalFormat = GL_STENCIL_INDEX16_EXT; } rb->AllocStorage = soft_renderbuffer_storage; _mesa_add_renderbuffer(fb, BUFFER_STENCIL, rb); return GL_TRUE; } /** * Add a software-based accumulation renderbuffer to the given framebuffer. * This is a helper routine for device drivers when creating a * window system framebuffer (not a user-created render/framebuffer). * Once this function is called, you can basically forget about this * renderbuffer; core Mesa will handle all the buffer management and * rendering! */ GLboolean _mesa_add_accum_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, GLuint redBits, GLuint greenBits, GLuint blueBits, GLuint alphaBits) { struct gl_renderbuffer *rb; if (redBits > 16 || greenBits > 16 || blueBits > 16 || alphaBits > 16) { _mesa_problem(ctx, "Unsupported accumBits in _mesa_add_accum_renderbuffer"); return GL_FALSE; } assert(fb->Attachment[BUFFER_ACCUM].Renderbuffer == NULL); rb = _mesa_new_renderbuffer(ctx, 0); if (!rb) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating accum buffer"); return GL_FALSE; } rb->InternalFormat = GL_RGBA16; rb->AllocStorage = soft_renderbuffer_storage; _mesa_add_renderbuffer(fb, BUFFER_ACCUM, rb); return GL_TRUE; } /** * Add a software-based accumulation renderbuffer to the given framebuffer. * This is a helper routine for device drivers when creating a * window system framebuffer (not a user-created render/framebuffer). * Once this function is called, you can basically forget about this * renderbuffer; core Mesa will handle all the buffer management and * rendering! * * NOTE: color-index aux buffers not supported. */ GLboolean _mesa_add_aux_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, GLuint colorBits, GLuint numBuffers) { GLuint i; if (colorBits > 16) { _mesa_problem(ctx, "Unsupported accumBits in _mesa_add_aux_renderbuffers"); return GL_FALSE; } assert(numBuffers < MAX_AUX_BUFFERS); for (i = 0; i < numBuffers; i++) { struct gl_renderbuffer *rb = _mesa_new_renderbuffer(ctx, 0); assert(fb->Attachment[BUFFER_AUX0 + i].Renderbuffer == NULL); if (!rb) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "Allocating accum buffer"); return GL_FALSE; } if (colorBits <= 8) { rb->InternalFormat = GL_RGBA8; } else { rb->InternalFormat = GL_RGBA16; } rb->AllocStorage = soft_renderbuffer_storage; _mesa_add_renderbuffer(fb, BUFFER_AUX0 + i, rb); } return GL_TRUE; } /** * Attach a renderbuffer to a framebuffer. */ void _mesa_add_renderbuffer(struct gl_framebuffer *fb, GLuint bufferName, struct gl_renderbuffer *rb) { assert(fb); assert(rb); /* there should be no previous renderbuffer on this attachment point! */ assert(fb->Attachment[bufferName].Renderbuffer == NULL); assert(bufferName < BUFFER_COUNT); /* winsys vs. user-created buffer cross check */ if (fb->Name) { assert(rb->Name); } else { assert(!rb->Name); } fb->Attachment[bufferName].Type = GL_RENDERBUFFER_EXT; fb->Attachment[bufferName].Complete = GL_TRUE; fb->Attachment[bufferName].Renderbuffer = rb; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/renderbuffer.h0000644000000000000000000000626213614532424020771 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef RENDERBUFFER_H #define RENDERBUFFER_H extern void _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name); extern struct gl_renderbuffer * _mesa_new_renderbuffer(GLcontext *ctx, GLuint name); extern void _mesa_delete_renderbuffer(struct gl_renderbuffer *rb); extern struct gl_renderbuffer * _mesa_new_soft_renderbuffer(GLcontext *ctx, GLuint name); extern GLboolean _mesa_add_color_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, GLuint rgbBits, GLuint alphaBits, GLboolean frontLeft, GLboolean backLeft, GLboolean frontRight, GLboolean backRight); extern GLboolean _mesa_add_color_index_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, GLuint indexBits, GLboolean frontLeft, GLboolean backLeft, GLboolean frontRight, GLboolean backRight); extern GLboolean _mesa_add_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, GLuint alphaBits, GLboolean frontLeft, GLboolean backLeft, GLboolean frontRight, GLboolean backRight); extern GLboolean _mesa_add_depth_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, GLuint depthBits); extern GLboolean _mesa_add_stencil_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, GLuint stencilBits); extern GLboolean _mesa_add_accum_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, GLuint redBits, GLuint greenBits, GLuint blueBits, GLuint alphaBits); extern GLboolean _mesa_add_aux_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, GLuint bits, GLuint numBuffers); extern void _mesa_add_renderbuffer(struct gl_framebuffer *fb, GLuint bufferName, struct gl_renderbuffer *rb); #endif /* RENDERBUFFER_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/simple_list.h0000644000000000000000000001120313614532424020633 0ustar /** * \file simple_list.h * Simple macros for type-safe, intrusive lists. * * Intended to work with a list sentinal which is created as an empty * list. Insert & delete are O(1). * * \author * (C) 1997, Keith Whitwell */ /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _SIMPLE_LIST_H #define _SIMPLE_LIST_H /** * Remove an element from list. * * \param elem element to remove. */ #define remove_from_list(elem) \ do { \ (elem)->next->prev = (elem)->prev; \ (elem)->prev->next = (elem)->next; \ } while (0) /** * Insert an element to the list head. * * \param list list. * \param elem element to insert. */ #define insert_at_head(list, elem) \ do { \ (elem)->prev = list; \ (elem)->next = (list)->next; \ (list)->next->prev = elem; \ (list)->next = elem; \ } while(0) /** * Insert an element to the list tail. * * \param list list. * \param elem element to insert. */ #define insert_at_tail(list, elem) \ do { \ (elem)->next = list; \ (elem)->prev = (list)->prev; \ (list)->prev->next = elem; \ (list)->prev = elem; \ } while(0) /** * Move an element to the list head. * * \param list list. * \param elem element to move. */ #define move_to_head(list, elem) \ do { \ remove_from_list(elem); \ insert_at_head(list, elem); \ } while (0) /** * Move an element to the list tail. * * \param list list. * \param elem element to move. */ #define move_to_tail(list, elem) \ do { \ remove_from_list(elem); \ insert_at_tail(list, elem); \ } while (0) /** * Make a empty list empty. * * \param sentinal list (sentinal element). */ #define make_empty_list(sentinal) \ do { \ (sentinal)->next = sentinal; \ (sentinal)->prev = sentinal; \ } while (0) /** * Get list first element. * * \param list list. * * \return pointer to first element. */ #define first_elem(list) ((list)->next) /** * Get list last element. * * \param list list. * * \return pointer to last element. */ #define last_elem(list) ((list)->prev) /** * Get next element. * * \param elem element. * * \return pointer to next element. */ #define next_elem(elem) ((elem)->next) /** * Get previous element. * * \param elem element. * * \return pointer to previous element. */ #define prev_elem(elem) ((elem)->prev) /** * Test whether element is at end of the list. * * \param list list. * \param elem element. * * \return non-zero if element is at end of list, or zero otherwise. */ #define at_end(list, elem) ((elem) == (list)) /** * Test if a list is empty. * * \param list list. * * \return non-zero if list empty, or zero otherwise. */ #define is_empty_list(list) ((list)->next == (list)) /** * Walk through the elements of a list. * * \param ptr pointer to the current element. * \param list list. * * \note It should be followed by a { } block or a single statement, as in a \c * for loop. */ #define foreach(ptr, list) \ for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next ) /** * Walk through the elements of a list. * * Same as #foreach but lets you unlink the current value during a list * traversal. Useful for freeing a list, element by element. * * \param ptr pointer to the current element. * \param t temporary pointer. * \param list list. * * \note It should be followed by a { } block or a single statement, as in a \c * for loop. */ #define foreach_s(ptr, t, list) \ for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next) #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/state.c0000644000000000000000000012167613614532424017442 0ustar /* * Mesa 3-D graphics library * Version: 6.4 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file state.c * State management. * * This file manages recalculation of derived values in the __GLcontextRec. * Also, this is where we initialize the API dispatch table. */ #include "glheader.h" #include "accum.h" #include "api_loopback.h" #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program #include "arbprogram.h" #endif #if FEATURE_ATI_fragment_shader #include "atifragshader.h" #endif #include "attrib.h" #include "blend.h" #if FEATURE_ARB_vertex_buffer_object #include "bufferobj.h" #endif #include "buffers.h" #include "clip.h" #include "colortab.h" #include "context.h" #include "convolve.h" #include "depth.h" #include "dlist.h" #include "drawpix.h" #include "enable.h" #include "eval.h" #include "get.h" #include "feedback.h" #include "fog.h" #if FEATURE_EXT_framebuffer_object #include "fbobject.h" #endif #include "framebuffer.h" #include "hint.h" #include "histogram.h" #include "imports.h" #include "light.h" #include "lines.h" #include "macros.h" #include "matrix.h" #if FEATURE_ARB_occlusion_query #include "occlude.h" #endif #include "pixel.h" #include "points.h" #include "polygon.h" #include "rastpos.h" #include "state.h" #include "stencil.h" #include "teximage.h" #include "texobj.h" #include "texstate.h" #include "mtypes.h" #include "varray.h" #if FEATURE_NV_vertex_program #include "nvprogram.h" #endif #if FEATURE_NV_fragment_program #include "nvfragprog.h" #include "nvprogram.h" #include "program.h" #include "texenvprogram.h" #endif #if FEATURE_ARB_shader_objects #include "shaderobjects.h" #endif #include "debug.h" #include "dispatch.h" /** * Initialize a dispatch table with pointers to Mesa's immediate-mode * commands. * * Pointers to glBegin()/glEnd() object commands and a few others * are provided via the GLvertexformat interface. * * \param ctx GL context to which \c exec belongs. * \param exec dispatch table. */ void _mesa_init_exec_table(struct _glapi_table *exec) { #if _HAVE_FULL_GL _mesa_loopback_init_api_table( exec ); #endif /* load the dispatch slots we understand */ SET_AlphaFunc(exec, _mesa_AlphaFunc); SET_BlendFunc(exec, _mesa_BlendFunc); SET_Clear(exec, _mesa_Clear); SET_ClearColor(exec, _mesa_ClearColor); SET_ClearStencil(exec, _mesa_ClearStencil); SET_ColorMask(exec, _mesa_ColorMask); SET_CullFace(exec, _mesa_CullFace); SET_Disable(exec, _mesa_Disable); SET_DrawBuffer(exec, _mesa_DrawBuffer); SET_Enable(exec, _mesa_Enable); SET_Finish(exec, _mesa_Finish); SET_Flush(exec, _mesa_Flush); SET_FrontFace(exec, _mesa_FrontFace); SET_Frustum(exec, _mesa_Frustum); SET_GetError(exec, _mesa_GetError); SET_GetFloatv(exec, _mesa_GetFloatv); SET_GetString(exec, _mesa_GetString); SET_InitNames(exec, _mesa_InitNames); SET_LineStipple(exec, _mesa_LineStipple); SET_LineWidth(exec, _mesa_LineWidth); SET_LoadIdentity(exec, _mesa_LoadIdentity); SET_LoadMatrixf(exec, _mesa_LoadMatrixf); SET_LoadName(exec, _mesa_LoadName); SET_LogicOp(exec, _mesa_LogicOp); SET_MatrixMode(exec, _mesa_MatrixMode); SET_MultMatrixf(exec, _mesa_MultMatrixf); SET_Ortho(exec, _mesa_Ortho); SET_PixelStorei(exec, _mesa_PixelStorei); SET_PopMatrix(exec, _mesa_PopMatrix); SET_PopName(exec, _mesa_PopName); SET_PushMatrix(exec, _mesa_PushMatrix); SET_PushName(exec, _mesa_PushName); SET_RasterPos2f(exec, _mesa_RasterPos2f); SET_RasterPos2fv(exec, _mesa_RasterPos2fv); SET_RasterPos2i(exec, _mesa_RasterPos2i); SET_RasterPos2iv(exec, _mesa_RasterPos2iv); SET_ReadBuffer(exec, _mesa_ReadBuffer); SET_RenderMode(exec, _mesa_RenderMode); SET_Rotatef(exec, _mesa_Rotatef); SET_Scalef(exec, _mesa_Scalef); SET_Scissor(exec, _mesa_Scissor); SET_SelectBuffer(exec, _mesa_SelectBuffer); SET_ShadeModel(exec, _mesa_ShadeModel); SET_StencilFunc(exec, _mesa_StencilFunc); SET_StencilMask(exec, _mesa_StencilMask); SET_StencilOp(exec, _mesa_StencilOp); SET_TexEnvfv(exec, _mesa_TexEnvfv); SET_TexEnvi(exec, _mesa_TexEnvi); SET_TexImage2D(exec, _mesa_TexImage2D); SET_TexParameteri(exec, _mesa_TexParameteri); SET_Translatef(exec, _mesa_Translatef); SET_Viewport(exec, _mesa_Viewport); #if _HAVE_FULL_GL SET_Accum(exec, _mesa_Accum); SET_Bitmap(exec, _mesa_Bitmap); SET_CallList(exec, _mesa_CallList); SET_CallLists(exec, _mesa_CallLists); SET_ClearAccum(exec, _mesa_ClearAccum); SET_ClearDepth(exec, _mesa_ClearDepth); SET_ClearIndex(exec, _mesa_ClearIndex); SET_ClipPlane(exec, _mesa_ClipPlane); SET_ColorMaterial(exec, _mesa_ColorMaterial); SET_CopyPixels(exec, _mesa_CopyPixels); SET_CullParameterfvEXT(exec, _mesa_CullParameterfvEXT); SET_CullParameterdvEXT(exec, _mesa_CullParameterdvEXT); SET_DeleteLists(exec, _mesa_DeleteLists); SET_DepthFunc(exec, _mesa_DepthFunc); SET_DepthMask(exec, _mesa_DepthMask); SET_DepthRange(exec, _mesa_DepthRange); SET_DrawPixels(exec, _mesa_DrawPixels); SET_EndList(exec, _mesa_EndList); SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer); SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT); SET_Fogf(exec, _mesa_Fogf); SET_Fogfv(exec, _mesa_Fogfv); SET_Fogi(exec, _mesa_Fogi); SET_Fogiv(exec, _mesa_Fogiv); SET_GenLists(exec, _mesa_GenLists); SET_GetClipPlane(exec, _mesa_GetClipPlane); SET_GetBooleanv(exec, _mesa_GetBooleanv); SET_GetDoublev(exec, _mesa_GetDoublev); SET_GetIntegerv(exec, _mesa_GetIntegerv); SET_GetLightfv(exec, _mesa_GetLightfv); SET_GetLightiv(exec, _mesa_GetLightiv); SET_GetMapdv(exec, _mesa_GetMapdv); SET_GetMapfv(exec, _mesa_GetMapfv); SET_GetMapiv(exec, _mesa_GetMapiv); SET_GetMaterialfv(exec, _mesa_GetMaterialfv); SET_GetMaterialiv(exec, _mesa_GetMaterialiv); SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv); SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv); SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv); SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple); SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv); SET_GetTexEnviv(exec, _mesa_GetTexEnviv); SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv); SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv); SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv); SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv); SET_GetTexGendv(exec, _mesa_GetTexGendv); SET_GetTexGenfv(exec, _mesa_GetTexGenfv); SET_GetTexGeniv(exec, _mesa_GetTexGeniv); SET_GetTexImage(exec, _mesa_GetTexImage); SET_Hint(exec, _mesa_Hint); SET_IndexMask(exec, _mesa_IndexMask); SET_IsEnabled(exec, _mesa_IsEnabled); SET_IsList(exec, _mesa_IsList); SET_LightModelf(exec, _mesa_LightModelf); SET_LightModelfv(exec, _mesa_LightModelfv); SET_LightModeli(exec, _mesa_LightModeli); SET_LightModeliv(exec, _mesa_LightModeliv); SET_Lightf(exec, _mesa_Lightf); SET_Lightfv(exec, _mesa_Lightfv); SET_Lighti(exec, _mesa_Lighti); SET_Lightiv(exec, _mesa_Lightiv); SET_ListBase(exec, _mesa_ListBase); SET_LoadMatrixd(exec, _mesa_LoadMatrixd); SET_Map1d(exec, _mesa_Map1d); SET_Map1f(exec, _mesa_Map1f); SET_Map2d(exec, _mesa_Map2d); SET_Map2f(exec, _mesa_Map2f); SET_MapGrid1d(exec, _mesa_MapGrid1d); SET_MapGrid1f(exec, _mesa_MapGrid1f); SET_MapGrid2d(exec, _mesa_MapGrid2d); SET_MapGrid2f(exec, _mesa_MapGrid2f); SET_MultMatrixd(exec, _mesa_MultMatrixd); SET_NewList(exec, _mesa_NewList); SET_PassThrough(exec, _mesa_PassThrough); SET_PixelMapfv(exec, _mesa_PixelMapfv); SET_PixelMapuiv(exec, _mesa_PixelMapuiv); SET_PixelMapusv(exec, _mesa_PixelMapusv); SET_PixelStoref(exec, _mesa_PixelStoref); SET_PixelTransferf(exec, _mesa_PixelTransferf); SET_PixelTransferi(exec, _mesa_PixelTransferi); SET_PixelZoom(exec, _mesa_PixelZoom); SET_PointSize(exec, _mesa_PointSize); SET_PolygonMode(exec, _mesa_PolygonMode); SET_PolygonOffset(exec, _mesa_PolygonOffset); SET_PolygonStipple(exec, _mesa_PolygonStipple); SET_PopAttrib(exec, _mesa_PopAttrib); SET_PushAttrib(exec, _mesa_PushAttrib); SET_RasterPos2d(exec, _mesa_RasterPos2d); SET_RasterPos2dv(exec, _mesa_RasterPos2dv); SET_RasterPos2s(exec, _mesa_RasterPos2s); SET_RasterPos2sv(exec, _mesa_RasterPos2sv); SET_RasterPos3d(exec, _mesa_RasterPos3d); SET_RasterPos3dv(exec, _mesa_RasterPos3dv); SET_RasterPos3f(exec, _mesa_RasterPos3f); SET_RasterPos3fv(exec, _mesa_RasterPos3fv); SET_RasterPos3i(exec, _mesa_RasterPos3i); SET_RasterPos3iv(exec, _mesa_RasterPos3iv); SET_RasterPos3s(exec, _mesa_RasterPos3s); SET_RasterPos3sv(exec, _mesa_RasterPos3sv); SET_RasterPos4d(exec, _mesa_RasterPos4d); SET_RasterPos4dv(exec, _mesa_RasterPos4dv); SET_RasterPos4f(exec, _mesa_RasterPos4f); SET_RasterPos4fv(exec, _mesa_RasterPos4fv); SET_RasterPos4i(exec, _mesa_RasterPos4i); SET_RasterPos4iv(exec, _mesa_RasterPos4iv); SET_RasterPos4s(exec, _mesa_RasterPos4s); SET_RasterPos4sv(exec, _mesa_RasterPos4sv); SET_ReadPixels(exec, _mesa_ReadPixels); SET_Rotated(exec, _mesa_Rotated); SET_Scaled(exec, _mesa_Scaled); SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT); SET_TexEnvf(exec, _mesa_TexEnvf); SET_TexEnviv(exec, _mesa_TexEnviv); SET_TexGend(exec, _mesa_TexGend); SET_TexGendv(exec, _mesa_TexGendv); SET_TexGenf(exec, _mesa_TexGenf); SET_TexGenfv(exec, _mesa_TexGenfv); SET_TexGeni(exec, _mesa_TexGeni); SET_TexGeniv(exec, _mesa_TexGeniv); SET_TexImage1D(exec, _mesa_TexImage1D); SET_TexParameterf(exec, _mesa_TexParameterf); SET_TexParameterfv(exec, _mesa_TexParameterfv); SET_TexParameteriv(exec, _mesa_TexParameteriv); SET_Translated(exec, _mesa_Translated); #endif /* 1.1 */ SET_BindTexture(exec, _mesa_BindTexture); SET_DeleteTextures(exec, _mesa_DeleteTextures); SET_GenTextures(exec, _mesa_GenTextures); #if _HAVE_FULL_GL SET_AreTexturesResident(exec, _mesa_AreTexturesResident); SET_AreTexturesResidentEXT(exec, _mesa_AreTexturesResident); SET_ColorPointer(exec, _mesa_ColorPointer); SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D); SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D); SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D); SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D); SET_DisableClientState(exec, _mesa_DisableClientState); SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer); SET_EnableClientState(exec, _mesa_EnableClientState); SET_GenTexturesEXT(exec, _mesa_GenTextures); SET_GetPointerv(exec, _mesa_GetPointerv); SET_IndexPointer(exec, _mesa_IndexPointer); SET_InterleavedArrays(exec, _mesa_InterleavedArrays); SET_IsTexture(exec, _mesa_IsTexture); SET_IsTextureEXT(exec, _mesa_IsTexture); SET_NormalPointer(exec, _mesa_NormalPointer); SET_PopClientAttrib(exec, _mesa_PopClientAttrib); SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures); SET_PushClientAttrib(exec, _mesa_PushClientAttrib); SET_TexCoordPointer(exec, _mesa_TexCoordPointer); SET_TexSubImage1D(exec, _mesa_TexSubImage1D); SET_TexSubImage2D(exec, _mesa_TexSubImage2D); SET_VertexPointer(exec, _mesa_VertexPointer); #endif /* 1.2 */ #if _HAVE_FULL_GL SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D); SET_TexImage3D(exec, _mesa_TexImage3D); SET_TexSubImage3D(exec, _mesa_TexSubImage3D); #endif /* OpenGL 1.2 GL_ARB_imaging */ #if _HAVE_FULL_GL SET_BlendColor(exec, _mesa_BlendColor); SET_BlendEquation(exec, _mesa_BlendEquation); SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT); SET_ColorSubTable(exec, _mesa_ColorSubTable); SET_ColorTable(exec, _mesa_ColorTable); SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv); SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv); SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D); SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D); SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf); SET_ConvolutionParameterfv(exec, _mesa_ConvolutionParameterfv); SET_ConvolutionParameteri(exec, _mesa_ConvolutionParameteri); SET_ConvolutionParameteriv(exec, _mesa_ConvolutionParameteriv); SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable); SET_CopyColorTable(exec, _mesa_CopyColorTable); SET_CopyConvolutionFilter1D(exec, _mesa_CopyConvolutionFilter1D); SET_CopyConvolutionFilter2D(exec, _mesa_CopyConvolutionFilter2D); SET_GetColorTable(exec, _mesa_GetColorTable); SET_GetColorTableEXT(exec, _mesa_GetColorTable); SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv); SET_GetColorTableParameterfvEXT(exec, _mesa_GetColorTableParameterfv); SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv); SET_GetColorTableParameterivEXT(exec, _mesa_GetColorTableParameteriv); SET_GetConvolutionFilter(exec, _mesa_GetConvolutionFilter); SET_GetConvolutionFilterEXT(exec, _mesa_GetConvolutionFilter); SET_GetConvolutionParameterfv(exec, _mesa_GetConvolutionParameterfv); SET_GetConvolutionParameterfvEXT(exec, _mesa_GetConvolutionParameterfv); SET_GetConvolutionParameteriv(exec, _mesa_GetConvolutionParameteriv); SET_GetConvolutionParameterivEXT(exec, _mesa_GetConvolutionParameteriv); SET_GetHistogram(exec, _mesa_GetHistogram); SET_GetHistogramEXT(exec, _mesa_GetHistogram); SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv); SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv); SET_GetHistogramParameteriv(exec, _mesa_GetHistogramParameteriv); SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv); SET_GetMinmax(exec, _mesa_GetMinmax); SET_GetMinmaxEXT(exec, _mesa_GetMinmax); SET_GetMinmaxParameterfv(exec, _mesa_GetMinmaxParameterfv); SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv); SET_GetMinmaxParameteriv(exec, _mesa_GetMinmaxParameteriv); SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv); SET_GetSeparableFilter(exec, _mesa_GetSeparableFilter); SET_GetSeparableFilterEXT(exec, _mesa_GetSeparableFilter); SET_Histogram(exec, _mesa_Histogram); SET_Minmax(exec, _mesa_Minmax); SET_ResetHistogram(exec, _mesa_ResetHistogram); SET_ResetMinmax(exec, _mesa_ResetMinmax); SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D); #endif /* OpenGL 2.0 */ SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate); SET_StencilMaskSeparate(exec, _mesa_StencilMaskSeparate); SET_StencilOpSeparate(exec, _mesa_StencilOpSeparate); /* 2. GL_EXT_blend_color */ #if 0 /* SET_BlendColorEXT(exec, _mesa_BlendColorEXT); */ #endif /* 3. GL_EXT_polygon_offset */ #if _HAVE_FULL_GL SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT); #endif /* 6. GL_EXT_texture3d */ #if 0 /* SET_CopyTexSubImage3DEXT(exec, _mesa_CopyTexSubImage3D); */ /* SET_TexImage3DEXT(exec, _mesa_TexImage3DEXT); */ /* SET_TexSubImage3DEXT(exec, _mesa_TexSubImage3D); */ #endif /* 11. GL_EXT_histogram */ #if _HAVE_FULL_GL SET_GetHistogramEXT(exec, _mesa_GetHistogram); SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv); SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv); SET_GetMinmaxEXT(exec, _mesa_GetMinmax); SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv); SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv); #endif /* ?. GL_SGIX_pixel_texture */ #if _HAVE_FULL_GL SET_PixelTexGenSGIX(exec, _mesa_PixelTexGenSGIX); #endif /* 15. GL_SGIS_pixel_texture */ #if _HAVE_FULL_GL SET_PixelTexGenParameteriSGIS(exec, _mesa_PixelTexGenParameteriSGIS); SET_PixelTexGenParameterivSGIS(exec, _mesa_PixelTexGenParameterivSGIS); SET_PixelTexGenParameterfSGIS(exec, _mesa_PixelTexGenParameterfSGIS); SET_PixelTexGenParameterfvSGIS(exec, _mesa_PixelTexGenParameterfvSGIS); SET_GetPixelTexGenParameterivSGIS(exec, _mesa_GetPixelTexGenParameterivSGIS); SET_GetPixelTexGenParameterfvSGIS(exec, _mesa_GetPixelTexGenParameterfvSGIS); #endif /* 30. GL_EXT_vertex_array */ #if _HAVE_FULL_GL SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT); SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT); SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT); SET_NormalPointerEXT(exec, _mesa_NormalPointerEXT); SET_TexCoordPointerEXT(exec, _mesa_TexCoordPointerEXT); SET_VertexPointerEXT(exec, _mesa_VertexPointerEXT); #endif /* 37. GL_EXT_blend_minmax */ #if 0 SET_BlendEquationEXT(exec, _mesa_BlendEquationEXT); #endif /* 54. GL_EXT_point_parameters */ #if _HAVE_FULL_GL SET_PointParameterfEXT(exec, _mesa_PointParameterfEXT); SET_PointParameterfvEXT(exec, _mesa_PointParameterfvEXT); #endif /* 78. GL_EXT_paletted_texture */ #if 0 SET_ColorTableEXT(exec, _mesa_ColorTableEXT); SET_ColorSubTableEXT(exec, _mesa_ColorSubTableEXT); #endif #if _HAVE_FULL_GL SET_GetColorTableEXT(exec, _mesa_GetColorTable); SET_GetColorTableParameterfvEXT(exec, _mesa_GetColorTableParameterfv); SET_GetColorTableParameterivEXT(exec, _mesa_GetColorTableParameteriv); #endif /* 97. GL_EXT_compiled_vertex_array */ #if _HAVE_FULL_GL SET_LockArraysEXT(exec, _mesa_LockArraysEXT); SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT); #endif /* 148. GL_EXT_multi_draw_arrays */ #if _HAVE_FULL_GL SET_MultiDrawArraysEXT(exec, _mesa_MultiDrawArraysEXT); SET_MultiDrawElementsEXT(exec, _mesa_MultiDrawElementsEXT); #endif /* 173. GL_INGR_blend_func_separate */ #if _HAVE_FULL_GL SET_BlendFuncSeparateEXT(exec, _mesa_BlendFuncSeparateEXT); #endif /* 196. GL_MESA_resize_buffers */ #if _HAVE_FULL_GL SET_ResizeBuffersMESA(exec, _mesa_ResizeBuffersMESA); #endif /* 197. GL_MESA_window_pos */ #if _HAVE_FULL_GL SET_WindowPos2dMESA(exec, _mesa_WindowPos2dMESA); SET_WindowPos2dvMESA(exec, _mesa_WindowPos2dvMESA); SET_WindowPos2fMESA(exec, _mesa_WindowPos2fMESA); SET_WindowPos2fvMESA(exec, _mesa_WindowPos2fvMESA); SET_WindowPos2iMESA(exec, _mesa_WindowPos2iMESA); SET_WindowPos2ivMESA(exec, _mesa_WindowPos2ivMESA); SET_WindowPos2sMESA(exec, _mesa_WindowPos2sMESA); SET_WindowPos2svMESA(exec, _mesa_WindowPos2svMESA); SET_WindowPos3dMESA(exec, _mesa_WindowPos3dMESA); SET_WindowPos3dvMESA(exec, _mesa_WindowPos3dvMESA); SET_WindowPos3fMESA(exec, _mesa_WindowPos3fMESA); SET_WindowPos3fvMESA(exec, _mesa_WindowPos3fvMESA); SET_WindowPos3iMESA(exec, _mesa_WindowPos3iMESA); SET_WindowPos3ivMESA(exec, _mesa_WindowPos3ivMESA); SET_WindowPos3sMESA(exec, _mesa_WindowPos3sMESA); SET_WindowPos3svMESA(exec, _mesa_WindowPos3svMESA); SET_WindowPos4dMESA(exec, _mesa_WindowPos4dMESA); SET_WindowPos4dvMESA(exec, _mesa_WindowPos4dvMESA); SET_WindowPos4fMESA(exec, _mesa_WindowPos4fMESA); SET_WindowPos4fvMESA(exec, _mesa_WindowPos4fvMESA); SET_WindowPos4iMESA(exec, _mesa_WindowPos4iMESA); SET_WindowPos4ivMESA(exec, _mesa_WindowPos4ivMESA); SET_WindowPos4sMESA(exec, _mesa_WindowPos4sMESA); SET_WindowPos4svMESA(exec, _mesa_WindowPos4svMESA); #endif /* 200. GL_IBM_multimode_draw_arrays */ #if _HAVE_FULL_GL SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM); SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM); #endif /* 233. GL_NV_vertex_program */ #if FEATURE_NV_vertex_program SET_BindProgramNV(exec, _mesa_BindProgram); SET_DeleteProgramsNV(exec, _mesa_DeletePrograms); SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV); SET_GenProgramsNV(exec, _mesa_GenPrograms); SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV); SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV); SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV); SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV); SET_GetProgramivNV(exec, _mesa_GetProgramivNV); SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV); SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV); SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV); SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV); SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV); SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV); SET_IsProgramNV(exec, _mesa_IsProgram); SET_LoadProgramNV(exec, _mesa_LoadProgramNV); SET_ProgramParameter4dNV(exec, _mesa_ProgramParameter4dNV); SET_ProgramParameter4dvNV(exec, _mesa_ProgramParameter4dvNV); SET_ProgramParameter4fNV(exec, _mesa_ProgramParameter4fNV); SET_ProgramParameter4fvNV(exec, _mesa_ProgramParameter4fvNV); SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV); SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV); SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV); SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV); /* glVertexAttrib*NV functions handled in api_loopback.c */ #endif /* 282. GL_NV_fragment_program */ #if FEATURE_NV_fragment_program SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV); SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV); SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV); SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV); SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV); SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV); SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB); SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB); SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB); SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB); SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB); SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB); #endif /* 262. GL_NV_point_sprite */ #if _HAVE_FULL_GL SET_PointParameteriNV(exec, _mesa_PointParameteriNV); SET_PointParameterivNV(exec, _mesa_PointParameterivNV); #endif /* 268. GL_EXT_stencil_two_side */ #if _HAVE_FULL_GL SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT); #endif /* ???. GL_EXT_depth_bounds_test */ SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT); /* ARB 1. GL_ARB_multitexture */ #if _HAVE_FULL_GL SET_ActiveTextureARB(exec, _mesa_ActiveTextureARB); SET_ClientActiveTextureARB(exec, _mesa_ClientActiveTextureARB); #endif /* ARB 3. GL_ARB_transpose_matrix */ #if _HAVE_FULL_GL SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB); SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB); SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB); SET_MultTransposeMatrixfARB(exec, _mesa_MultTransposeMatrixfARB); #endif /* ARB 5. GL_ARB_multisample */ #if _HAVE_FULL_GL SET_SampleCoverageARB(exec, _mesa_SampleCoverageARB); #endif /* ARB 12. GL_ARB_texture_compression */ #if _HAVE_FULL_GL SET_CompressedTexImage3DARB(exec, _mesa_CompressedTexImage3DARB); SET_CompressedTexImage2DARB(exec, _mesa_CompressedTexImage2DARB); SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB); SET_CompressedTexSubImage3DARB(exec, _mesa_CompressedTexSubImage3DARB); SET_CompressedTexSubImage2DARB(exec, _mesa_CompressedTexSubImage2DARB); SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB); SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB); #endif /* ARB 14. GL_ARB_point_parameters */ /* reuse EXT_point_parameters functions */ /* ARB 26. GL_ARB_vertex_program */ /* ARB 27. GL_ARB_fragment_program */ #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program /* glVertexAttrib1sARB aliases glVertexAttrib1sNV */ /* glVertexAttrib1fARB aliases glVertexAttrib1fNV */ /* glVertexAttrib1dARB aliases glVertexAttrib1dNV */ /* glVertexAttrib2sARB aliases glVertexAttrib2sNV */ /* glVertexAttrib2fARB aliases glVertexAttrib2fNV */ /* glVertexAttrib2dARB aliases glVertexAttrib2dNV */ /* glVertexAttrib3sARB aliases glVertexAttrib3sNV */ /* glVertexAttrib3fARB aliases glVertexAttrib3fNV */ /* glVertexAttrib3dARB aliases glVertexAttrib3dNV */ /* glVertexAttrib4sARB aliases glVertexAttrib4sNV */ /* glVertexAttrib4fARB aliases glVertexAttrib4fNV */ /* glVertexAttrib4dARB aliases glVertexAttrib4dNV */ /* glVertexAttrib4NubARB aliases glVertexAttrib4NubNV */ /* glVertexAttrib1svARB aliases glVertexAttrib1svNV */ /* glVertexAttrib1fvARB aliases glVertexAttrib1fvNV */ /* glVertexAttrib1dvARB aliases glVertexAttrib1dvNV */ /* glVertexAttrib2svARB aliases glVertexAttrib2svNV */ /* glVertexAttrib2fvARB aliases glVertexAttrib2fvNV */ /* glVertexAttrib2dvARB aliases glVertexAttrib2dvNV */ /* glVertexAttrib3svARB aliases glVertexAttrib3svNV */ /* glVertexAttrib3fvARB aliases glVertexAttrib3fvNV */ /* glVertexAttrib3dvARB aliases glVertexAttrib3dvNV */ /* glVertexAttrib4svARB aliases glVertexAttrib4svNV */ /* glVertexAttrib4fvARB aliases glVertexAttrib4fvNV */ /* glVertexAttrib4dvARB aliases glVertexAttrib4dvNV */ /* glVertexAttrib4NubvARB aliases glVertexAttrib4NubvNV */ /* glVertexAttrib4bvARB handled in api_loopback.c */ /* glVertexAttrib4ivARB handled in api_loopback.c */ /* glVertexAttrib4ubvARB handled in api_loopback.c */ /* glVertexAttrib4usvARB handled in api_loopback.c */ /* glVertexAttrib4uivARB handled in api_loopback.c */ /* glVertexAttrib4NbvARB handled in api_loopback.c */ /* glVertexAttrib4NsvARB handled in api_loopback.c */ /* glVertexAttrib4NivARB handled in api_loopback.c */ /* glVertexAttrib4NusvARB handled in api_loopback.c */ /* glVertexAttrib4NuivARB handled in api_loopback.c */ SET_VertexAttribPointerARB(exec, _mesa_VertexAttribPointerARB); SET_EnableVertexAttribArrayARB(exec, _mesa_EnableVertexAttribArrayARB); SET_DisableVertexAttribArrayARB(exec, _mesa_DisableVertexAttribArrayARB); SET_ProgramStringARB(exec, _mesa_ProgramStringARB); /* glBindProgramARB aliases glBindProgramNV */ /* glDeleteProgramsARB aliases glDeleteProgramsNV */ /* glGenProgramsARB aliases glGenProgramsNV */ /* glIsProgramARB aliases glIsProgramNV */ SET_GetVertexAttribdvARB(exec, _mesa_GetVertexAttribdvARB); SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB); SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB); /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */ SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB); SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB); SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB); SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB); SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB); SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB); SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB); SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB); SET_GetProgramivARB(exec, _mesa_GetProgramivARB); SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB); #endif /* ARB 28. GL_ARB_vertex_buffer_object */ #if FEATURE_ARB_vertex_buffer_object SET_BindBufferARB(exec, _mesa_BindBufferARB); SET_BufferDataARB(exec, _mesa_BufferDataARB); SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB); SET_DeleteBuffersARB(exec, _mesa_DeleteBuffersARB); SET_GenBuffersARB(exec, _mesa_GenBuffersARB); SET_GetBufferParameterivARB(exec, _mesa_GetBufferParameterivARB); SET_GetBufferPointervARB(exec, _mesa_GetBufferPointervARB); SET_GetBufferSubDataARB(exec, _mesa_GetBufferSubDataARB); SET_IsBufferARB(exec, _mesa_IsBufferARB); SET_MapBufferARB(exec, _mesa_MapBufferARB); SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB); #endif /* ARB 29. GL_ARB_occlusion_query */ #if FEATURE_ARB_occlusion_query SET_GenQueriesARB(exec, _mesa_GenQueriesARB); SET_DeleteQueriesARB(exec, _mesa_DeleteQueriesARB); SET_IsQueryARB(exec, _mesa_IsQueryARB); SET_BeginQueryARB(exec, _mesa_BeginQueryARB); SET_EndQueryARB(exec, _mesa_EndQueryARB); SET_GetQueryivARB(exec, _mesa_GetQueryivARB); SET_GetQueryObjectivARB(exec, _mesa_GetQueryObjectivARB); SET_GetQueryObjectuivARB(exec, _mesa_GetQueryObjectuivARB); #endif /* ARB 37. GL_ARB_draw_buffers */ SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB); #if FEATURE_ARB_shader_objects SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB); SET_GetHandleARB(exec, _mesa_GetHandleARB); SET_DetachObjectARB(exec, _mesa_DetachObjectARB); SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB); SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB); SET_CompileShaderARB(exec, _mesa_CompileShaderARB); SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB); SET_AttachObjectARB(exec, _mesa_AttachObjectARB); SET_LinkProgramARB(exec, _mesa_LinkProgramARB); SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB); SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB); SET_Uniform1fARB(exec, _mesa_Uniform1fARB); SET_Uniform2fARB(exec, _mesa_Uniform2fARB); SET_Uniform3fARB(exec, _mesa_Uniform3fARB); SET_Uniform4fARB(exec, _mesa_Uniform4fARB); SET_Uniform1iARB(exec, _mesa_Uniform1iARB); SET_Uniform2iARB(exec, _mesa_Uniform2iARB); SET_Uniform3iARB(exec, _mesa_Uniform3iARB); SET_Uniform4iARB(exec, _mesa_Uniform4iARB); SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB); SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB); SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB); SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB); SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB); SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB); SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB); SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB); SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB); SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB); SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB); SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB); SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB); SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB); SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB); SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB); SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB); SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB); SET_GetUniformivARB(exec, _mesa_GetUniformivARB); SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB); #endif /* FEATURE_ARB_shader_objects */ #if FEATURE_ARB_vertex_shader SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB); SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB); SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB); #endif /* FEATURE_ARB_vertex_shader */ /* GL_ATI_fragment_shader */ #if FEATURE_ATI_fragment_shader SET_GenFragmentShadersATI(exec, _mesa_GenFragmentShadersATI); SET_BindFragmentShaderATI(exec, _mesa_BindFragmentShaderATI); SET_DeleteFragmentShaderATI(exec, _mesa_DeleteFragmentShaderATI); SET_BeginFragmentShaderATI(exec, _mesa_BeginFragmentShaderATI); SET_EndFragmentShaderATI(exec, _mesa_EndFragmentShaderATI); SET_PassTexCoordATI(exec, _mesa_PassTexCoordATI); SET_SampleMapATI(exec, _mesa_SampleMapATI); SET_ColorFragmentOp1ATI(exec, _mesa_ColorFragmentOp1ATI); SET_ColorFragmentOp2ATI(exec, _mesa_ColorFragmentOp2ATI); SET_ColorFragmentOp3ATI(exec, _mesa_ColorFragmentOp3ATI); SET_AlphaFragmentOp1ATI(exec, _mesa_AlphaFragmentOp1ATI); SET_AlphaFragmentOp2ATI(exec, _mesa_AlphaFragmentOp2ATI); SET_AlphaFragmentOp3ATI(exec, _mesa_AlphaFragmentOp3ATI); SET_SetFragmentShaderConstantATI(exec, _mesa_SetFragmentShaderConstantATI); #endif #if FEATURE_EXT_framebuffer_object SET_IsRenderbufferEXT(exec, _mesa_IsRenderbufferEXT); SET_BindRenderbufferEXT(exec, _mesa_BindRenderbufferEXT); SET_DeleteRenderbuffersEXT(exec, _mesa_DeleteRenderbuffersEXT); SET_GenRenderbuffersEXT(exec, _mesa_GenRenderbuffersEXT); SET_RenderbufferStorageEXT(exec, _mesa_RenderbufferStorageEXT); SET_GetRenderbufferParameterivEXT(exec, _mesa_GetRenderbufferParameterivEXT); SET_IsFramebufferEXT(exec, _mesa_IsFramebufferEXT); SET_BindFramebufferEXT(exec, _mesa_BindFramebufferEXT); SET_DeleteFramebuffersEXT(exec, _mesa_DeleteFramebuffersEXT); SET_GenFramebuffersEXT(exec, _mesa_GenFramebuffersEXT); SET_CheckFramebufferStatusEXT(exec, _mesa_CheckFramebufferStatusEXT); SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT); SET_FramebufferTexture2DEXT(exec, _mesa_FramebufferTexture2DEXT); SET_FramebufferTexture3DEXT(exec, _mesa_FramebufferTexture3DEXT); SET_FramebufferRenderbufferEXT(exec, _mesa_FramebufferRenderbufferEXT); SET_GetFramebufferAttachmentParameterivEXT(exec, _mesa_GetFramebufferAttachmentParameterivEXT); SET_GenerateMipmapEXT(exec, _mesa_GenerateMipmapEXT); #endif } /**********************************************************************/ /** \name State update logic */ /*@{*/ static void update_separate_specular( GLcontext *ctx ) { if (NEED_SECONDARY_COLOR(ctx)) ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; else ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; } /** * Update state dependent on vertex arrays. */ static void update_arrays( GLcontext *ctx ) { GLuint i, min; /* find min of _MaxElement values for all enabled arrays */ /* 0 */ if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled) { min = ctx->Array.VertexAttrib[VERT_ATTRIB_POS]._MaxElement; } else if (ctx->Array.Vertex.Enabled) { min = ctx->Array.Vertex._MaxElement; } else { /* can't draw anything without vertex positions! */ min = 0; } /* 1 */ if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_WEIGHT].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_WEIGHT]._MaxElement); } /* no conventional vertex weight array */ /* 2 */ if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL]._MaxElement); } else if (ctx->Array.Normal.Enabled) { min = MIN2(min, ctx->Array.Normal._MaxElement); } /* 3 */ if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR0]._MaxElement); } else if (ctx->Array.Color.Enabled) { min = MIN2(min, ctx->Array.Color._MaxElement); } /* 4 */ if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR1]._MaxElement); } else if (ctx->Array.SecondaryColor.Enabled) { min = MIN2(min, ctx->Array.SecondaryColor._MaxElement); } /* 5 */ if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_FOG]._MaxElement); } else if (ctx->Array.FogCoord.Enabled) { min = MIN2(min, ctx->Array.FogCoord._MaxElement); } /* 6 */ if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_SIX].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SIX]._MaxElement); } /* 7 */ if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[VERT_ATTRIB_SEVEN].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[VERT_ATTRIB_SEVEN]._MaxElement); } /* 8..15 */ for (i = VERT_ATTRIB_TEX0; i < VERT_ATTRIB_MAX; i++) { if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[i].Enabled) { min = MIN2(min, ctx->Array.VertexAttrib[i]._MaxElement); } else if (i - VERT_ATTRIB_TEX0 < ctx->Const.MaxTextureCoordUnits && ctx->Array.TexCoord[i - VERT_ATTRIB_TEX0].Enabled) { min = MIN2(min, ctx->Array.TexCoord[i - VERT_ATTRIB_TEX0]._MaxElement); } } if (ctx->Array.Index.Enabled) { min = MIN2(min, ctx->Array.Index._MaxElement); } if (ctx->Array.EdgeFlag.Enabled) { min = MIN2(min, ctx->Array.EdgeFlag._MaxElement); } /* _MaxElement is one past the last legal array element */ ctx->Array._MaxElement = min; } /** * Update derived vertex/fragment program state. */ static void update_program(GLcontext *ctx) { /* For now, just set the _Enabled (really enabled) flags. * In the future we may have to check other state to be sure we really * have a runable program or shader. */ ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled && ctx->VertexProgram.Current->Instructions; ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current->Instructions; ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled && ctx->ATIFragmentShader.Current->Instructions; ctx->FragmentProgram._Current = ctx->FragmentProgram.Current; ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled; if (ctx->_MaintainTexEnvProgram && !ctx->FragmentProgram._Enabled) { if (!ctx->_TexEnvProgram) ctx->_TexEnvProgram = (struct fragment_program *) ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); ctx->FragmentProgram._Current = ctx->_TexEnvProgram; ctx->FragmentProgram._Active = GL_TRUE; } } /** * If __GLcontextRec::NewState is non-zero then this function \b must be called * before rendering any primitive. Basically, function pointers and * miscellaneous flags are updated to reflect the current state of the state * machine. * * Calls dd_function_table::UpdateState to perform any internal state * management necessary. * * \sa _mesa_update_modelview_project(), _mesa_update_texture(), * _mesa_update_buffer_bounds(), _mesa_update_polygon(), * _mesa_update_lighting() and _mesa_update_tnl_spaces(). */ void _mesa_update_state( GLcontext *ctx ) { GLuint new_state = ctx->NewState; if (MESA_VERBOSE & VERBOSE_STATE) _mesa_print_state("_mesa_update_state", new_state); if (new_state & _NEW_PROGRAM) update_program( ctx ); if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION)) _mesa_update_modelview_project( ctx, new_state ); if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX)) _mesa_update_texture( ctx, new_state ); if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) _mesa_update_framebuffer(ctx); if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) _mesa_update_draw_buffer_bounds( ctx ); if (new_state & _NEW_POINT) _mesa_update_point( ctx ); if (new_state & _NEW_POLYGON) _mesa_update_polygon( ctx ); if (new_state & _NEW_LIGHT) _mesa_update_lighting( ctx ); if (new_state & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_pixel( ctx, new_state ); if (new_state & _DD_NEW_SEPARATE_SPECULAR) update_separate_specular( ctx ); if (new_state & (_NEW_ARRAY | _NEW_PROGRAM)) update_arrays( ctx ); if (ctx->_MaintainTexEnvProgram) { if (new_state & (_NEW_TEXTURE | _DD_NEW_SEPARATE_SPECULAR | _NEW_FOG)) _mesa_UpdateTexEnvProgram(ctx); } /* ctx->_NeedEyeCoords is now up to date. * * If the truth value of this variable has changed, update for the * new lighting space and recompute the positions of lights and the * normal transform. * * If the lighting space hasn't changed, may still need to recompute * light positions & normal transforms for other reasons. */ if (new_state & _MESA_NEW_NEED_EYE_COORDS) _mesa_update_tnl_spaces( ctx, new_state ); /* * Give the driver a chance to act upon the new_state flags. * The driver might plug in different span functions, for example. * Also, this is where the driver can invalidate the state of any * active modules (such as swrast_setup, swrast, tnl, etc). * * Set ctx->NewState to zero to avoid recursion if * Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?) */ new_state = ctx->NewState; ctx->NewState = 0; ctx->Driver.UpdateState(ctx, new_state); ctx->Array.NewState = 0; } /*@}*/ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/state.h0000644000000000000000000000256213614532424017437 0ustar /** * \file state.h * State management. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef STATE_H #define STATE_H #include "mtypes.h" extern void _mesa_init_exec_table(struct _glapi_table *exec); extern void _mesa_update_state( GLcontext *ctx ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/stencil.c0000644000000000000000000002771413614532424017761 0ustar /** * \file stencil.c * Stencil operations. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "imports.h" #include "context.h" #include "depth.h" #include "macros.h" #include "stencil.h" #include "mtypes.h" #include "enable.h" /** * Set the clear value for the stencil buffer. * * \param s clear value. * * \sa glClearStencil(). * * Updates gl_stencil_attrib::Clear. On change * flushes the vertices and notifies the driver via * the dd_function_table::ClearStencil callback. */ void GLAPIENTRY _mesa_ClearStencil( GLint s ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Stencil.Clear == (GLstencil) s) return; FLUSH_VERTICES(ctx, _NEW_STENCIL); ctx->Stencil.Clear = (GLstencil) s; if (ctx->Driver.ClearStencil) { (*ctx->Driver.ClearStencil)( ctx, s ); } } /** * Set the function and reference value for stencil testing. * * \param func test function. * \param ref reference value. * \param mask bitmask. * * \sa glStencilFunc(). * * Verifies the parameters and updates the respective values in * __GLcontextRec::Stencil. On change flushes the vertices and notifies the * driver via the dd_function_table::StencilFunc callback. */ void GLAPIENTRY _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) { GET_CURRENT_CONTEXT(ctx); const GLint face = ctx->Stencil.ActiveFace; GLint maxref; ASSERT_OUTSIDE_BEGIN_END(ctx); switch (func) { case GL_NEVER: case GL_LESS: case GL_LEQUAL: case GL_GREATER: case GL_GEQUAL: case GL_EQUAL: case GL_NOTEQUAL: case GL_ALWAYS: break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glStencilFunc" ); return; } maxref = (1 << STENCIL_BITS) - 1; ref = (GLstencil) CLAMP( ref, 0, maxref ); if (ctx->Stencil.Function[face] == func && ctx->Stencil.ValueMask[face] == (GLstencil) mask && ctx->Stencil.Ref[face] == ref) return; FLUSH_VERTICES(ctx, _NEW_STENCIL); ctx->Stencil.Function[face] = func; ctx->Stencil.Ref[face] = ref; ctx->Stencil.ValueMask[face] = (GLstencil) mask; if (ctx->Driver.StencilFunc) { (*ctx->Driver.StencilFunc)( ctx, func, ref, mask ); } } /** * Set the stencil writing mask. * * \param mask bit-mask to enable/disable writing of individual bits in the * stencil planes. * * \sa glStencilMask(). * * Updates gl_stencil_attrib::WriteMask. On change flushes the vertices and * notifies the driver via the dd_function_table::StencilMask callback. */ void GLAPIENTRY _mesa_StencilMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); const GLint face = ctx->Stencil.ActiveFace; ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Stencil.WriteMask[face] == (GLstencil) mask) return; FLUSH_VERTICES(ctx, _NEW_STENCIL); ctx->Stencil.WriteMask[face] = (GLstencil) mask; if (ctx->Driver.StencilMask) { (*ctx->Driver.StencilMask)( ctx, mask ); } } /** * Set the stencil test actions. * * \param fail action to take when stencil test fails. * \param zfail action to take when stencil test passes, but the depth test fails. * \param zpass action to take when stencil test passes and the depth test * passes (or depth testing is not enabled). * * \sa glStencilOp(). * * Verifies the parameters and updates the respective fields in * __GLcontextRec::Stencil. On change flushes the vertices and notifies the * driver via the dd_function_table::StencilOp callback. */ void GLAPIENTRY _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) { GET_CURRENT_CONTEXT(ctx); const GLint face = ctx->Stencil.ActiveFace; ASSERT_OUTSIDE_BEGIN_END(ctx); switch (fail) { case GL_KEEP: case GL_ZERO: case GL_REPLACE: case GL_INCR: case GL_DECR: case GL_INVERT: break; case GL_INCR_WRAP_EXT: case GL_DECR_WRAP_EXT: if (ctx->Extensions.EXT_stencil_wrap) { break; } /* FALL-THROUGH */ default: _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); return; } switch (zfail) { case GL_KEEP: case GL_ZERO: case GL_REPLACE: case GL_INCR: case GL_DECR: case GL_INVERT: break; case GL_INCR_WRAP_EXT: case GL_DECR_WRAP_EXT: if (ctx->Extensions.EXT_stencil_wrap) { break; } /* FALL-THROUGH */ default: _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); return; } switch (zpass) { case GL_KEEP: case GL_ZERO: case GL_REPLACE: case GL_INCR: case GL_DECR: case GL_INVERT: break; case GL_INCR_WRAP_EXT: case GL_DECR_WRAP_EXT: if (ctx->Extensions.EXT_stencil_wrap) { break; } /* FALL-THROUGH */ default: _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); return; } if (ctx->Stencil.ZFailFunc[face] == zfail && ctx->Stencil.ZPassFunc[face] == zpass && ctx->Stencil.FailFunc[face] == fail) return; FLUSH_VERTICES(ctx, _NEW_STENCIL); ctx->Stencil.ZFailFunc[face] = zfail; ctx->Stencil.ZPassFunc[face] = zpass; ctx->Stencil.FailFunc[face] = fail; if (ctx->Driver.StencilOp) { (*ctx->Driver.StencilOp)(ctx, fail, zfail, zpass); } } #if _HAVE_FULL_GL /* GL_EXT_stencil_two_side */ void GLAPIENTRY _mesa_ActiveStencilFaceEXT(GLenum face) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (face == GL_FRONT || face == GL_BACK) { FLUSH_VERTICES(ctx, _NEW_STENCIL); ctx->Stencil.ActiveFace = (face == GL_FRONT) ? 0 : 1; } if (ctx->Driver.ActiveStencilFace) { (*ctx->Driver.ActiveStencilFace)( ctx, (GLuint) ctx->Stencil.ActiveFace ); } } #endif /** * OpenGL 2.0 function. * \todo Make StencilOp() call this function. And eventually remove the * ctx->Driver.StencilOp function and use ctx->Driver.StencilOpSeparate * instead. */ void GLAPIENTRY _mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(face)"); return; } switch (fail) { case GL_KEEP: case GL_ZERO: case GL_REPLACE: case GL_INCR: case GL_DECR: case GL_INVERT: break; case GL_INCR_WRAP_EXT: case GL_DECR_WRAP_EXT: if (ctx->Extensions.EXT_stencil_wrap) { break; } /* FALL-THROUGH */ default: _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(fail)"); return; } switch (zfail) { case GL_KEEP: case GL_ZERO: case GL_REPLACE: case GL_INCR: case GL_DECR: case GL_INVERT: break; case GL_INCR_WRAP_EXT: case GL_DECR_WRAP_EXT: if (ctx->Extensions.EXT_stencil_wrap) { break; } /* FALL-THROUGH */ default: _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zfail)"); return; } switch (zpass) { case GL_KEEP: case GL_ZERO: case GL_REPLACE: case GL_INCR: case GL_DECR: case GL_INVERT: break; case GL_INCR_WRAP_EXT: case GL_DECR_WRAP_EXT: if (ctx->Extensions.EXT_stencil_wrap) { break; } /* FALL-THROUGH */ default: _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zpass)"); return; } FLUSH_VERTICES(ctx, _NEW_STENCIL); if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { ctx->Stencil.FailFunc[0] = fail; ctx->Stencil.ZFailFunc[0] = zfail; ctx->Stencil.ZPassFunc[0] = zpass; } if (face == GL_BACK || face == GL_FRONT_AND_BACK) { ctx->Stencil.FailFunc[1] = fail; ctx->Stencil.ZFailFunc[1] = zfail; ctx->Stencil.ZPassFunc[1] = zpass; } if (ctx->Driver.StencilOpSeparate) { ctx->Driver.StencilOpSeparate(ctx, face, fail, zfail, zpass); } } /* OpenGL 2.0 */ void GLAPIENTRY _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { GET_CURRENT_CONTEXT(ctx); GLint maxref; ASSERT_OUTSIDE_BEGIN_END(ctx); if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(face)"); return; } switch (func) { case GL_NEVER: case GL_LESS: case GL_LEQUAL: case GL_GREATER: case GL_GEQUAL: case GL_EQUAL: case GL_NOTEQUAL: case GL_ALWAYS: break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(func)"); return; } maxref = (1 << STENCIL_BITS) - 1; ref = (GLstencil) CLAMP(ref, 0, maxref); FLUSH_VERTICES(ctx, _NEW_STENCIL); if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { ctx->Stencil.Function[0] = func; ctx->Stencil.Ref[0] = ref; ctx->Stencil.ValueMask[0] = (GLstencil) mask; } if (face == GL_BACK || face == GL_FRONT_AND_BACK) { ctx->Stencil.Function[1] = func; ctx->Stencil.Ref[1] = ref; ctx->Stencil.ValueMask[1] = (GLstencil) mask; } if (ctx->Driver.StencilFuncSeparate) { ctx->Driver.StencilFuncSeparate(ctx, face, func, ref, mask); } } /* OpenGL 2.0 */ void GLAPIENTRY _mesa_StencilMaskSeparate(GLenum face, GLuint mask) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { _mesa_error(ctx, GL_INVALID_ENUM, "glStencilaMaskSeparate(face)"); return; } FLUSH_VERTICES(ctx, _NEW_STENCIL); if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { ctx->Stencil.WriteMask[0] = (GLstencil) mask; } if (face == GL_BACK || face == GL_FRONT_AND_BACK) { ctx->Stencil.WriteMask[1] = (GLstencil) mask; } if (ctx->Driver.StencilMaskSeparate) { ctx->Driver.StencilMaskSeparate(ctx, face, mask); } } /** * Initialize the context stipple state. * * \param ctx GL context. * * Initializes __GLcontextRec::Stencil attribute group. */ void _mesa_init_stencil( GLcontext * ctx ) { /* Stencil group */ ctx->Stencil.Enabled = GL_FALSE; ctx->Stencil.TestTwoSide = GL_FALSE; ctx->Stencil.ActiveFace = 0; /* 0 = GL_FRONT, 1 = GL_BACK */ ctx->Stencil.Function[0] = GL_ALWAYS; ctx->Stencil.Function[1] = GL_ALWAYS; ctx->Stencil.FailFunc[0] = GL_KEEP; ctx->Stencil.FailFunc[1] = GL_KEEP; ctx->Stencil.ZPassFunc[0] = GL_KEEP; ctx->Stencil.ZPassFunc[1] = GL_KEEP; ctx->Stencil.ZFailFunc[0] = GL_KEEP; ctx->Stencil.ZFailFunc[1] = GL_KEEP; ctx->Stencil.Ref[0] = 0; ctx->Stencil.Ref[1] = 0; ctx->Stencil.ValueMask[0] = STENCIL_MAX; ctx->Stencil.ValueMask[1] = STENCIL_MAX; ctx->Stencil.WriteMask[0] = STENCIL_MAX; ctx->Stencil.WriteMask[1] = STENCIL_MAX; ctx->Stencil.Clear = 0; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/stencil.h0000644000000000000000000000366713614532424017767 0ustar /** * \file stencil.h * Stencil operations. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef STENCIL_H #define STENCIL_H #include "mtypes.h" extern void GLAPIENTRY _mesa_ClearStencil( GLint s ); extern void GLAPIENTRY _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ); extern void GLAPIENTRY _mesa_StencilMask( GLuint mask ); extern void GLAPIENTRY _mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ); extern void GLAPIENTRY _mesa_ActiveStencilFaceEXT(GLenum face); extern void GLAPIENTRY _mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); extern void GLAPIENTRY _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); extern void GLAPIENTRY _mesa_StencilMaskSeparate(GLenum face, GLuint mask); extern void _mesa_init_stencil( GLcontext * ctx ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texcompress.c0000644000000000000000000001723513614532424020671 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file texcompress.c * Helper functions for texture compression. */ #include "glheader.h" #include "imports.h" #include "colormac.h" #include "context.h" #include "image.h" #include "texcompress.h" #include "texformat.h" #include "texstore.h" /** * Get the list of supported internal compression formats. * * \param ctx GL context. * \param formats the resulting format list (may be NULL). * * \return number of formats. */ GLuint _mesa_get_compressed_formats( GLcontext *ctx, GLint *formats ) { GLuint n = 0; if (ctx->Extensions.ARB_texture_compression) { if (ctx->Extensions.TDFX_texture_compression_FXT1) { if (formats) { formats[n++] = GL_COMPRESSED_RGB_FXT1_3DFX; formats[n++] = GL_COMPRESSED_RGBA_FXT1_3DFX; } else { n += 2; } } if (ctx->Extensions.EXT_texture_compression_s3tc) { if (formats) { formats[n++] = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; /* Skip this one because it has a restriction (all transparent * pixels become black). See the texture compressions spec for * a detailed explanation. This is what NVIDIA does. formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; */ formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; } else { n += 3; } } if (ctx->Extensions.S3_s3tc) { if (formats) { formats[n++] = GL_RGB_S3TC; formats[n++] = GL_RGB4_S3TC; formats[n++] = GL_RGBA_S3TC; formats[n++] = GL_RGBA4_S3TC; } else { n += 4; } } } return n; } /** * Return number of bytes needed to store a texture of the given size * using the specified compressed format. * This is called via the ctx->Driver.CompressedTextureSize function, * unless a device driver overrides it. * * \param width texture width in texels. * \param height texture height in texels. * \param depth texture depth in texels. * \param format - one of the specific compressed texture formats * * \return size in bytes, or zero if bad format */ GLuint _mesa_compressed_texture_size( GLcontext *ctx, GLsizei width, GLsizei height, GLsizei depth, GLenum format ) { GLuint size; ASSERT(depth == 1); (void) depth; switch (format) { case GL_COMPRESSED_RGB_FXT1_3DFX: case GL_COMPRESSED_RGBA_FXT1_3DFX: /* round up width to next multiple of 8, height to next multiple of 4 */ width = (width + 7) & ~7; height = (height + 3) & ~3; /* 16 bytes per 8x4 tile of RGB[A] texels */ size = width * height / 2; /* Textures smaller than 8x4 will effectively be made into 8x4 and * take 16 bytes. */ if (size < 16) size = 16; return size; case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_RGB_S3TC: case GL_RGB4_S3TC: /* round up width, height to next multiple of 4 */ width = (width + 3) & ~3; height = (height + 3) & ~3; /* 8 bytes per 4x4 tile of RGB[A] texels */ size = width * height / 2; /* Textures smaller than 4x4 will effectively be made into 4x4 and * take 8 bytes. */ if (size < 8) size = 8; return size; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: case GL_RGBA_S3TC: case GL_RGBA4_S3TC: /* round up width, height to next multiple of 4 */ width = (width + 3) & ~3; height = (height + 3) & ~3; /* 16 bytes per 4x4 tile of RGBA texels */ size = width * height; /* simple! */ /* Textures smaller than 4x4 will effectively be made into 4x4 and * take 16 bytes. */ if (size < 16) size = 16; return size; default: _mesa_problem(ctx, "bad texformat in compressed_texture_size"); return 0; } } /* * Compute the bytes per row in a compressed texture image. * We use this for computing the destination address for sub-texture updates. * \param format one of the specific texture compression formats * \param width image width in pixels * \return stride, in bytes, between rows for compressed image */ GLint _mesa_compressed_row_stride(GLenum format, GLsizei width) { GLint stride; switch (format) { case GL_COMPRESSED_RGB_FXT1_3DFX: case GL_COMPRESSED_RGBA_FXT1_3DFX: stride = ((width + 7) / 8) * 16; /* 16 bytes per 8x4 tile */ break; case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_RGB_S3TC: case GL_RGB4_S3TC: stride = ((width + 3) / 4) * 8; /* 8 bytes per 4x4 tile */ break; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: case GL_RGBA_S3TC: case GL_RGBA4_S3TC: stride = ((width + 3) / 4) * 16; /* 16 bytes per 4x4 tile */ break; default: return 0; } return stride; } /* * Return the address of the pixel at (col, row, img) in a * compressed texture image. * \param col, row, img - image position (3D) * \param format - compressed image format * \param width - image width * \param image - the image address * \return address of pixel at (row, col) */ GLubyte * _mesa_compressed_image_address(GLint col, GLint row, GLint img, GLenum format, GLsizei width, const GLubyte *image) { GLubyte *addr; (void) img; /* We try to spot a "complete" subtexture "above" ROW, COL; * this texture is given by appropriate rounding of WIDTH x ROW. * Then we just add the amount left (usually on the left). * * Example for X*Y microtiles (Z bytes each) * offset = Z * (((width + X - 1) / X) * (row / Y) + col / X); */ switch (format) { case GL_COMPRESSED_RGB_FXT1_3DFX: case GL_COMPRESSED_RGBA_FXT1_3DFX: addr = (GLubyte *) image + 16 * (((width + 7) / 8) * (row / 4) + col / 8); break; case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_RGB_S3TC: case GL_RGB4_S3TC: addr = (GLubyte *) image + 8 * (((width + 3) / 4) * (row / 4) + col / 4); break; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: case GL_RGBA_S3TC: case GL_RGBA4_S3TC: addr = (GLubyte *) image + 16 * (((width + 3) / 4) * (row / 4) + col / 4); break; default: return NULL; } return addr; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texcompress_fxt1.c0000644000000000000000000013467213614532424021640 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file texcompress_fxt1.c * GL_EXT_texture_compression_fxt1 support. */ #include "glheader.h" #include "imports.h" #include "colormac.h" #include "context.h" #include "convolve.h" #include "image.h" #include "texcompress.h" #include "texformat.h" #include "texstore.h" static GLint fxt1_encode (GLuint width, GLuint height, GLint comps, const void *source, GLint srcRowStride, void *dest, GLint destRowStride); void fxt1_decode_1 (const void *texture, GLint stride, GLint i, GLint j, GLubyte *rgba); /** * Called during context initialization. */ void _mesa_init_texture_fxt1( GLcontext *ctx ) { (void) ctx; } /** * Called via TexFormat->StoreImage to store an RGB_FXT1 texture. */ static GLboolean texstore_rgb_fxt1(STORE_PARAMS) { const GLchan *pixels; GLint srcRowStride; GLubyte *dst; const GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; ASSERT(dstFormat == &_mesa_texformat_rgb_fxt1); ASSERT(dstXoffset % 8 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset == 0); (void) dstZoffset; (void) dstImageStride; if (srcFormat != GL_RGB || srcType != CHAN_TYPE || ctx->_ImageTransferState || srcPacking->SwapBytes) { /* convert image to RGB/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); if (!tempImage) return GL_FALSE; /* out of memory */ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); pixels = tempImage; srcRowStride = 3 * srcWidth; srcFormat = GL_RGB; } else { pixels = (const GLchan *) srcAddr; srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) / sizeof(GLchan); } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, GL_COMPRESSED_RGB_FXT1_3DFX, texWidth, (GLubyte *) dstAddr); fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride, dst, dstRowStride); if (tempImage) _mesa_free((void*) tempImage); return GL_TRUE; } /** * Called via TexFormat->StoreImage to store an RGBA_FXT1 texture. */ static GLboolean texstore_rgba_fxt1(STORE_PARAMS) { const GLchan *pixels; GLint srcRowStride; GLubyte *dst; GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; ASSERT(dstFormat == &_mesa_texformat_rgba_fxt1); ASSERT(dstXoffset % 8 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset == 0); (void) dstZoffset; (void) dstImageStride; if (srcFormat != GL_RGBA || srcType != CHAN_TYPE || ctx->_ImageTransferState || srcPacking->SwapBytes) { /* convert image to RGBA/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); if (!tempImage) return GL_FALSE; /* out of memory */ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); pixels = tempImage; srcRowStride = 4 * srcWidth; srcFormat = GL_RGBA; } else { pixels = (const GLchan *) srcAddr; srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) / sizeof(GLchan); } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, GL_COMPRESSED_RGBA_FXT1_3DFX, texWidth, (GLubyte *) dstAddr); fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride, dst, dstRowStride); if (tempImage) _mesa_free((void*) tempImage); return GL_TRUE; } static void fetch_texel_2d_rgba_fxt1( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { (void) k; fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, texel); } static void fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; (void) k; fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, rgba); texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]); texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]); texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]); texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); } static void fetch_texel_2d_rgb_fxt1( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { (void) k; fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, texel); texel[ACOMP] = 255; } static void fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; (void) k; fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, rgba); texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]); texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]); texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]); texel[ACOMP] = 1.0F; } const struct gl_texture_format _mesa_texformat_rgb_fxt1 = { MESA_FORMAT_RGB_FXT1, /* MesaFormat */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 4, /*approx*/ /* RedBits */ 4, /*approx*/ /* GreenBits */ 4, /*approx*/ /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 0, /* TexelBytes */ texstore_rgb_fxt1, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ fetch_texel_2d_rgb_fxt1, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ fetch_texel_2d_f_rgb_fxt1, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ }; const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { MESA_FORMAT_RGBA_FXT1, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 4, /*approx*/ /* RedBits */ 4, /*approx*/ /* GreenBits */ 4, /*approx*/ /* BlueBits */ 1, /*approx*/ /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 0, /* TexelBytes */ texstore_rgba_fxt1, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ fetch_texel_2d_rgba_fxt1, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ fetch_texel_2d_f_rgba_fxt1, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ }; /***************************************************************************\ * FXT1 encoder * * The encoder was built by reversing the decoder, * and is vaguely based on Texus2 by 3dfx. Note that this code * is merely a proof of concept, since it is highly UNoptimized; * moreover, it is sub-optimal due to initial conditions passed * to Lloyd's algorithm (the interpolation modes are even worse). \***************************************************************************/ #define MAX_COMP 4 /* ever needed maximum number of components in texel */ #define MAX_VECT 4 /* ever needed maximum number of base vectors to find */ #define N_TEXELS 32 /* number of texels in a block (always 32) */ #define LL_N_REP 50 /* number of iterations in lloyd's vq */ #define LL_RMS_D 10 /* fault tolerance (maximum delta) */ #define LL_RMS_E 255 /* fault tolerance (maximum error) */ #define ALPHA_TS 2 /* alpha threshold: (255 - ALPHA_TS) deemed opaque */ #define ISTBLACK(v) (*((GLuint *)(v)) == 0) /* * Define a 64-bit unsigned integer type and macros */ #if defined(__GNUC__) && !defined(__cplusplus) #define FX64_NATIVE 1 typedef unsigned long long Fx64; #define FX64_MOV32(a, b) a = b #define FX64_OR32(a, b) a |= b #define FX64_SHL(a, c) a <<= c #else /* !__GNUC__ */ #define FX64_NATIVE 0 typedef struct { GLuint lo, hi; } Fx64; #define FX64_MOV32(a, b) a.lo = b #define FX64_OR32(a, b) a.lo |= b #define FX64_SHL(a, c) \ do { \ if ((c) >= 32) { \ a.hi = a.lo << ((c) - 32); \ a.lo = 0; \ } else { \ a.hi = (a.hi << (c)) | (a.lo >> (32 - (c))); \ a.lo <<= (c); \ } \ } while (0) #endif /* !__GNUC__ */ #define F(i) (GLfloat)1 /* can be used to obtain an oblong metric: 0.30 / 0.59 / 0.11 */ #define SAFECDOT 1 /* for paranoids */ #define MAKEIVEC(NV, NC, IV, B, V0, V1) \ do { \ /* compute interpolation vector */ \ GLfloat d2 = 0.0F; \ GLfloat rd2; \ \ for (i = 0; i < NC; i++) { \ IV[i] = (V1[i] - V0[i]) * F(i); \ d2 += IV[i] * IV[i]; \ } \ rd2 = (GLfloat)NV / d2; \ B = 0; \ for (i = 0; i < NC; i++) { \ IV[i] *= F(i); \ B -= IV[i] * V0[i]; \ IV[i] *= rd2; \ } \ B = B * rd2 + 0.5f; \ } while (0) #define CALCCDOT(TEXEL, NV, NC, IV, B, V)\ do { \ GLfloat dot = 0.0F; \ for (i = 0; i < NC; i++) { \ dot += V[i] * IV[i]; \ } \ TEXEL = (GLint)(dot + B); \ if (SAFECDOT) { \ if (TEXEL < 0) { \ TEXEL = 0; \ } else if (TEXEL > NV) { \ TEXEL = NV; \ } \ } \ } while (0) static GLint fxt1_bestcol (GLfloat vec[][MAX_COMP], GLint nv, GLubyte input[MAX_COMP], GLint nc) { GLint i, j, best = -1; GLfloat err = 1e9; /* big enough */ for (j = 0; j < nv; j++) { GLfloat e = 0.0F; for (i = 0; i < nc; i++) { e += (vec[j][i] - input[i]) * (vec[j][i] - input[i]); } if (e < err) { err = e; best = j; } } return best; } static GLint fxt1_worst (GLfloat vec[MAX_COMP], GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n) { GLint i, k, worst = -1; GLfloat err = -1.0F; /* small enough */ for (k = 0; k < n; k++) { GLfloat e = 0.0F; for (i = 0; i < nc; i++) { e += (vec[i] - input[k][i]) * (vec[i] - input[k][i]); } if (e > err) { err = e; worst = k; } } return worst; } static GLint fxt1_variance (GLdouble variance[MAX_COMP], GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n) { GLint i, k, best = 0; GLint sx, sx2; GLdouble var, maxvar = -1; /* small enough */ GLdouble teenth = 1.0 / n; for (i = 0; i < nc; i++) { sx = sx2 = 0; for (k = 0; k < n; k++) { GLint t = input[k][i]; sx += t; sx2 += t * t; } var = sx2 * teenth - sx * sx * teenth * teenth; if (maxvar < var) { maxvar = var; best = i; } if (variance) { variance[i] = var; } } return best; } static GLint fxt1_choose (GLfloat vec[][MAX_COMP], GLint nv, GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n) { #if 0 /* Choose colors from a grid. */ GLint i, j; for (j = 0; j < nv; j++) { GLint m = j * (n - 1) / (nv - 1); for (i = 0; i < nc; i++) { vec[j][i] = input[m][i]; } } #else /* Our solution here is to find the darkest and brightest colors in * the 8x4 tile and use those as the two representative colors. * There are probably better algorithms to use (histogram-based). */ GLint i, j, k; GLint minSum = 2000; /* big enough */ GLint maxSum = -1; /* small enough */ GLint minCol = 0; /* phoudoin: silent compiler! */ GLint maxCol = 0; /* phoudoin: silent compiler! */ struct { GLint flag; GLint key; GLint freq; GLint idx; } hist[N_TEXELS]; GLint lenh = 0; memset(hist, 0, sizeof(hist)); for (k = 0; k < n; k++) { GLint l; GLint key = 0; GLint sum = 0; for (i = 0; i < nc; i++) { key <<= 8; key |= input[k][i]; sum += input[k][i]; } for (l = 0; l < n; l++) { if (!hist[l].flag) { /* alloc new slot */ hist[l].flag = !0; hist[l].key = key; hist[l].freq = 1; hist[l].idx = k; lenh = l + 1; break; } else if (hist[l].key == key) { hist[l].freq++; break; } } if (minSum > sum) { minSum = sum; minCol = k; } if (maxSum < sum) { maxSum = sum; maxCol = k; } } if (lenh <= nv) { for (j = 0; j < lenh; j++) { for (i = 0; i < nc; i++) { vec[j][i] = (GLfloat)input[hist[j].idx][i]; } } for (; j < nv; j++) { for (i = 0; i < nc; i++) { vec[j][i] = vec[0][i]; } } return 0; } for (j = 0; j < nv; j++) { for (i = 0; i < nc; i++) { vec[j][i] = ((nv - 1 - j) * input[minCol][i] + j * input[maxCol][i] + (nv - 1) / 2) / (GLfloat)(nv - 1); } } #endif return !0; } static GLint fxt1_lloyd (GLfloat vec[][MAX_COMP], GLint nv, GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n) { /* Use the generalized lloyd's algorithm for VQ: * find 4 color vectors. * * for each sample color * sort to nearest vector. * * replace each vector with the centroid of it's matching colors. * * repeat until RMS doesn't improve. * * if a color vector has no samples, or becomes the same as another * vector, replace it with the color which is farthest from a sample. * * vec[][MAX_COMP] initial vectors and resulting colors * nv number of resulting colors required * input[N_TEXELS][MAX_COMP] input texels * nc number of components in input / vec * n number of input samples */ GLint sum[MAX_VECT][MAX_COMP]; /* used to accumulate closest texels */ GLint cnt[MAX_VECT]; /* how many times a certain vector was chosen */ GLfloat error, lasterror = 1e9; GLint i, j, k, rep; /* the quantizer */ for (rep = 0; rep < LL_N_REP; rep++) { /* reset sums & counters */ for (j = 0; j < nv; j++) { for (i = 0; i < nc; i++) { sum[j][i] = 0; } cnt[j] = 0; } error = 0; /* scan whole block */ for (k = 0; k < n; k++) { #if 1 GLint best = -1; GLfloat err = 1e9; /* big enough */ /* determine best vector */ for (j = 0; j < nv; j++) { GLfloat e = (vec[j][0] - input[k][0]) * (vec[j][0] - input[k][0]) + (vec[j][1] - input[k][1]) * (vec[j][1] - input[k][1]) + (vec[j][2] - input[k][2]) * (vec[j][2] - input[k][2]); if (nc == 4) { e += (vec[j][3] - input[k][3]) * (vec[j][3] - input[k][3]); } if (e < err) { err = e; best = j; } } #else GLint best = fxt1_bestcol(vec, nv, input[k], nc, &err); #endif /* add in closest color */ for (i = 0; i < nc; i++) { sum[best][i] += input[k][i]; } /* mark this vector as used */ cnt[best]++; /* accumulate error */ error += err; } /* check RMS */ if ((error < LL_RMS_E) || ((error < lasterror) && ((lasterror - error) < LL_RMS_D))) { return !0; /* good match */ } lasterror = error; /* move each vector to the barycenter of its closest colors */ for (j = 0; j < nv; j++) { if (cnt[j]) { GLfloat div = 1.0F / cnt[j]; for (i = 0; i < nc; i++) { vec[j][i] = div * sum[j][i]; } } else { /* this vec has no samples or is identical with a previous vec */ GLint worst = fxt1_worst(vec[j], input, nc, n); for (i = 0; i < nc; i++) { vec[j][i] = input[worst][i]; } } } } return 0; /* could not converge fast enough */ } static void fxt1_quantize_CHROMA (GLuint *cc, GLubyte input[N_TEXELS][MAX_COMP]) { const GLint n_vect = 4; /* 4 base vectors to find */ const GLint n_comp = 3; /* 3 components: R, G, B */ GLfloat vec[MAX_VECT][MAX_COMP]; GLint i, j, k; Fx64 hi; /* high quadword */ GLuint lohi, lolo; /* low quadword: hi dword, lo dword */ if (fxt1_choose(vec, n_vect, input, n_comp, N_TEXELS) != 0) { fxt1_lloyd(vec, n_vect, input, n_comp, N_TEXELS); } FX64_MOV32(hi, 4); /* cc-chroma = "010" + unused bit */ for (j = n_vect - 1; j >= 0; j--) { for (i = 0; i < n_comp; i++) { /* add in colors */ FX64_SHL(hi, 5); FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F)); } } ((Fx64 *)cc)[1] = hi; lohi = lolo = 0; /* right microtile */ for (k = N_TEXELS - 1; k >= N_TEXELS/2; k--) { lohi <<= 2; lohi |= fxt1_bestcol(vec, n_vect, input[k], n_comp); } /* left microtile */ for (; k >= 0; k--) { lolo <<= 2; lolo |= fxt1_bestcol(vec, n_vect, input[k], n_comp); } cc[1] = lohi; cc[0] = lolo; } static void fxt1_quantize_ALPHA0 (GLuint *cc, GLubyte input[N_TEXELS][MAX_COMP], GLubyte reord[N_TEXELS][MAX_COMP], GLint n) { const GLint n_vect = 3; /* 3 base vectors to find */ const GLint n_comp = 4; /* 4 components: R, G, B, A */ GLfloat vec[MAX_VECT][MAX_COMP]; GLint i, j, k; Fx64 hi; /* high quadword */ GLuint lohi, lolo; /* low quadword: hi dword, lo dword */ /* the last vector indicates zero */ for (i = 0; i < n_comp; i++) { vec[n_vect][i] = 0; } /* the first n texels in reord are guaranteed to be non-zero */ if (fxt1_choose(vec, n_vect, reord, n_comp, n) != 0) { fxt1_lloyd(vec, n_vect, reord, n_comp, n); } FX64_MOV32(hi, 6); /* alpha = "011" + lerp = 0 */ for (j = n_vect - 1; j >= 0; j--) { /* add in alphas */ FX64_SHL(hi, 5); FX64_OR32(hi, (GLuint)(vec[j][ACOMP] / 8.0F)); } for (j = n_vect - 1; j >= 0; j--) { for (i = 0; i < n_comp - 1; i++) { /* add in colors */ FX64_SHL(hi, 5); FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F)); } } ((Fx64 *)cc)[1] = hi; lohi = lolo = 0; /* right microtile */ for (k = N_TEXELS - 1; k >= N_TEXELS/2; k--) { lohi <<= 2; lohi |= fxt1_bestcol(vec, n_vect + 1, input[k], n_comp); } /* left microtile */ for (; k >= 0; k--) { lolo <<= 2; lolo |= fxt1_bestcol(vec, n_vect + 1, input[k], n_comp); } cc[1] = lohi; cc[0] = lolo; } static void fxt1_quantize_ALPHA1 (GLuint *cc, GLubyte input[N_TEXELS][MAX_COMP]) { const GLint n_vect = 3; /* highest vector number in each microtile */ const GLint n_comp = 4; /* 4 components: R, G, B, A */ GLfloat vec[1 + 1 + 1][MAX_COMP]; /* 1.5 extrema for each sub-block */ GLfloat b, iv[MAX_COMP]; /* interpolation vector */ GLint i, j, k; Fx64 hi; /* high quadword */ GLuint lohi, lolo; /* low quadword: hi dword, lo dword */ GLint minSum; GLint maxSum; GLint minColL = 0, maxColL = 0; GLint minColR = 0, maxColR = 0; GLint sumL = 0, sumR = 0; /* Our solution here is to find the darkest and brightest colors in * the 4x4 tile and use those as the two representative colors. * There are probably better algorithms to use (histogram-based). */ minSum = 2000; /* big enough */ maxSum = -1; /* small enough */ for (k = 0; k < N_TEXELS / 2; k++) { GLint sum = 0; for (i = 0; i < n_comp; i++) { sum += input[k][i]; } if (minSum > sum) { minSum = sum; minColL = k; } if (maxSum < sum) { maxSum = sum; maxColL = k; } sumL += sum; } minSum = 2000; /* big enough */ maxSum = -1; /* small enough */ for (; k < N_TEXELS; k++) { GLint sum = 0; for (i = 0; i < n_comp; i++) { sum += input[k][i]; } if (minSum > sum) { minSum = sum; minColR = k; } if (maxSum < sum) { maxSum = sum; maxColR = k; } sumR += sum; } /* choose the common vector (yuck!) */ { GLint j1, j2; GLint v1 = 0, v2 = 0; GLfloat err = 1e9; /* big enough */ GLfloat tv[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */ for (i = 0; i < n_comp; i++) { tv[0][i] = input[minColL][i]; tv[1][i] = input[maxColL][i]; tv[2][i] = input[minColR][i]; tv[3][i] = input[maxColR][i]; } for (j1 = 0; j1 < 2; j1++) { for (j2 = 2; j2 < 4; j2++) { GLfloat e = 0.0F; for (i = 0; i < n_comp; i++) { e += (tv[j1][i] - tv[j2][i]) * (tv[j1][i] - tv[j2][i]); } if (e < err) { err = e; v1 = j1; v2 = j2; } } } for (i = 0; i < n_comp; i++) { vec[0][i] = tv[1 - v1][i]; vec[1][i] = (tv[v1][i] * sumL + tv[v2][i] * sumR) / (sumL + sumR); vec[2][i] = tv[5 - v2][i]; } } /* left microtile */ cc[0] = 0; if (minColL != maxColL) { /* compute interpolation vector */ MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]); /* add in texels */ lolo = 0; for (k = N_TEXELS / 2 - 1; k >= 0; k--) { GLint texel; /* interpolate color */ CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]); /* add in texel */ lolo <<= 2; lolo |= texel; } cc[0] = lolo; } /* right microtile */ cc[1] = 0; if (minColR != maxColR) { /* compute interpolation vector */ MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[1]); /* add in texels */ lohi = 0; for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) { GLint texel; /* interpolate color */ CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]); /* add in texel */ lohi <<= 2; lohi |= texel; } cc[1] = lohi; } FX64_MOV32(hi, 7); /* alpha = "011" + lerp = 1 */ for (j = n_vect - 1; j >= 0; j--) { /* add in alphas */ FX64_SHL(hi, 5); FX64_OR32(hi, (GLuint)(vec[j][ACOMP] / 8.0F)); } for (j = n_vect - 1; j >= 0; j--) { for (i = 0; i < n_comp - 1; i++) { /* add in colors */ FX64_SHL(hi, 5); FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F)); } } ((Fx64 *)cc)[1] = hi; } static void fxt1_quantize_HI (GLuint *cc, GLubyte input[N_TEXELS][MAX_COMP], GLubyte reord[N_TEXELS][MAX_COMP], GLint n) { const GLint n_vect = 6; /* highest vector number */ const GLint n_comp = 3; /* 3 components: R, G, B */ GLfloat b = 0.0F; /* phoudoin: silent compiler! */ GLfloat iv[MAX_COMP]; /* interpolation vector */ GLint i, k; GLuint hihi; /* high quadword: hi dword */ GLint minSum = 2000; /* big enough */ GLint maxSum = -1; /* small enough */ GLint minCol = 0; /* phoudoin: silent compiler! */ GLint maxCol = 0; /* phoudoin: silent compiler! */ /* Our solution here is to find the darkest and brightest colors in * the 8x4 tile and use those as the two representative colors. * There are probably better algorithms to use (histogram-based). */ for (k = 0; k < n; k++) { GLint sum = 0; for (i = 0; i < n_comp; i++) { sum += reord[k][i]; } if (minSum > sum) { minSum = sum; minCol = k; } if (maxSum < sum) { maxSum = sum; maxCol = k; } } hihi = 0; /* cc-hi = "00" */ for (i = 0; i < n_comp; i++) { /* add in colors */ hihi <<= 5; hihi |= reord[maxCol][i] >> 3; } for (i = 0; i < n_comp; i++) { /* add in colors */ hihi <<= 5; hihi |= reord[minCol][i] >> 3; } cc[3] = hihi; cc[0] = cc[1] = cc[2] = 0; /* compute interpolation vector */ if (minCol != maxCol) { MAKEIVEC(n_vect, n_comp, iv, b, reord[minCol], reord[maxCol]); } /* add in texels */ for (k = N_TEXELS - 1; k >= 0; k--) { GLint t = k * 3; GLuint *kk = (GLuint *)((char *)cc + t / 8); GLint texel = n_vect + 1; /* transparent black */ if (!ISTBLACK(input[k])) { if (minCol != maxCol) { /* interpolate color */ CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]); /* add in texel */ kk[0] |= texel << (t & 7); } } else { /* add in texel */ kk[0] |= texel << (t & 7); } } } static void fxt1_quantize_MIXED1 (GLuint *cc, GLubyte input[N_TEXELS][MAX_COMP]) { const GLint n_vect = 2; /* highest vector number in each microtile */ const GLint n_comp = 3; /* 3 components: R, G, B */ GLubyte vec[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */ GLfloat b, iv[MAX_COMP]; /* interpolation vector */ GLint i, j, k; Fx64 hi; /* high quadword */ GLuint lohi, lolo; /* low quadword: hi dword, lo dword */ GLint minSum; GLint maxSum; GLint minColL = 0, maxColL = -1; GLint minColR = 0, maxColR = -1; /* Our solution here is to find the darkest and brightest colors in * the 4x4 tile and use those as the two representative colors. * There are probably better algorithms to use (histogram-based). */ minSum = 2000; /* big enough */ maxSum = -1; /* small enough */ for (k = 0; k < N_TEXELS / 2; k++) { if (!ISTBLACK(input[k])) { GLint sum = 0; for (i = 0; i < n_comp; i++) { sum += input[k][i]; } if (minSum > sum) { minSum = sum; minColL = k; } if (maxSum < sum) { maxSum = sum; maxColL = k; } } } minSum = 2000; /* big enough */ maxSum = -1; /* small enough */ for (; k < N_TEXELS; k++) { if (!ISTBLACK(input[k])) { GLint sum = 0; for (i = 0; i < n_comp; i++) { sum += input[k][i]; } if (minSum > sum) { minSum = sum; minColR = k; } if (maxSum < sum) { maxSum = sum; maxColR = k; } } } /* left microtile */ if (maxColL == -1) { /* all transparent black */ cc[0] = ~0u; for (i = 0; i < n_comp; i++) { vec[0][i] = 0; vec[1][i] = 0; } } else { cc[0] = 0; for (i = 0; i < n_comp; i++) { vec[0][i] = input[minColL][i]; vec[1][i] = input[maxColL][i]; } if (minColL != maxColL) { /* compute interpolation vector */ MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]); /* add in texels */ lolo = 0; for (k = N_TEXELS / 2 - 1; k >= 0; k--) { GLint texel = n_vect + 1; /* transparent black */ if (!ISTBLACK(input[k])) { /* interpolate color */ CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]); } /* add in texel */ lolo <<= 2; lolo |= texel; } cc[0] = lolo; } } /* right microtile */ if (maxColR == -1) { /* all transparent black */ cc[1] = ~0u; for (i = 0; i < n_comp; i++) { vec[2][i] = 0; vec[3][i] = 0; } } else { cc[1] = 0; for (i = 0; i < n_comp; i++) { vec[2][i] = input[minColR][i]; vec[3][i] = input[maxColR][i]; } if (minColR != maxColR) { /* compute interpolation vector */ MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[3]); /* add in texels */ lohi = 0; for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) { GLint texel = n_vect + 1; /* transparent black */ if (!ISTBLACK(input[k])) { /* interpolate color */ CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]); } /* add in texel */ lohi <<= 2; lohi |= texel; } cc[1] = lohi; } } FX64_MOV32(hi, 9 | (vec[3][GCOMP] & 4) | ((vec[1][GCOMP] >> 1) & 2)); /* chroma = "1" */ for (j = 2 * 2 - 1; j >= 0; j--) { for (i = 0; i < n_comp; i++) { /* add in colors */ FX64_SHL(hi, 5); FX64_OR32(hi, vec[j][i] >> 3); } } ((Fx64 *)cc)[1] = hi; } static void fxt1_quantize_MIXED0 (GLuint *cc, GLubyte input[N_TEXELS][MAX_COMP]) { const GLint n_vect = 3; /* highest vector number in each microtile */ const GLint n_comp = 3; /* 3 components: R, G, B */ GLubyte vec[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */ GLfloat b, iv[MAX_COMP]; /* interpolation vector */ GLint i, j, k; Fx64 hi; /* high quadword */ GLuint lohi, lolo; /* low quadword: hi dword, lo dword */ GLint minColL = 0, maxColL = 0; GLint minColR = 0, maxColR = 0; #if 0 GLint minSum; GLint maxSum; /* Our solution here is to find the darkest and brightest colors in * the 4x4 tile and use those as the two representative colors. * There are probably better algorithms to use (histogram-based). */ minSum = 2000; /* big enough */ maxSum = -1; /* small enough */ for (k = 0; k < N_TEXELS / 2; k++) { GLint sum = 0; for (i = 0; i < n_comp; i++) { sum += input[k][i]; } if (minSum > sum) { minSum = sum; minColL = k; } if (maxSum < sum) { maxSum = sum; maxColL = k; } } minSum = 2000; /* big enough */ maxSum = -1; /* small enough */ for (; k < N_TEXELS; k++) { GLint sum = 0; for (i = 0; i < n_comp; i++) { sum += input[k][i]; } if (minSum > sum) { minSum = sum; minColR = k; } if (maxSum < sum) { maxSum = sum; maxColR = k; } } #else GLint minVal; GLint maxVal; GLint maxVarL = fxt1_variance(NULL, input, n_comp, N_TEXELS / 2); GLint maxVarR = fxt1_variance(NULL, &input[N_TEXELS / 2], n_comp, N_TEXELS / 2); /* Scan the channel with max variance for lo & hi * and use those as the two representative colors. */ minVal = 2000; /* big enough */ maxVal = -1; /* small enough */ for (k = 0; k < N_TEXELS / 2; k++) { GLint t = input[k][maxVarL]; if (minVal > t) { minVal = t; minColL = k; } if (maxVal < t) { maxVal = t; maxColL = k; } } minVal = 2000; /* big enough */ maxVal = -1; /* small enough */ for (; k < N_TEXELS; k++) { GLint t = input[k][maxVarR]; if (minVal > t) { minVal = t; minColR = k; } if (maxVal < t) { maxVal = t; maxColR = k; } } #endif /* left microtile */ cc[0] = 0; for (i = 0; i < n_comp; i++) { vec[0][i] = input[minColL][i]; vec[1][i] = input[maxColL][i]; } if (minColL != maxColL) { /* compute interpolation vector */ MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]); /* add in texels */ lolo = 0; for (k = N_TEXELS / 2 - 1; k >= 0; k--) { GLint texel; /* interpolate color */ CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]); /* add in texel */ lolo <<= 2; lolo |= texel; } /* funky encoding for LSB of green */ if ((GLint)((lolo >> 1) & 1) != (((vec[1][GCOMP] ^ vec[0][GCOMP]) >> 2) & 1)) { for (i = 0; i < n_comp; i++) { vec[1][i] = input[minColL][i]; vec[0][i] = input[maxColL][i]; } lolo = ~lolo; } cc[0] = lolo; } /* right microtile */ cc[1] = 0; for (i = 0; i < n_comp; i++) { vec[2][i] = input[minColR][i]; vec[3][i] = input[maxColR][i]; } if (minColR != maxColR) { /* compute interpolation vector */ MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[3]); /* add in texels */ lohi = 0; for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) { GLint texel; /* interpolate color */ CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]); /* add in texel */ lohi <<= 2; lohi |= texel; } /* funky encoding for LSB of green */ if ((GLint)((lohi >> 1) & 1) != (((vec[3][GCOMP] ^ vec[2][GCOMP]) >> 2) & 1)) { for (i = 0; i < n_comp; i++) { vec[3][i] = input[minColR][i]; vec[2][i] = input[maxColR][i]; } lohi = ~lohi; } cc[1] = lohi; } FX64_MOV32(hi, 8 | (vec[3][GCOMP] & 4) | ((vec[1][GCOMP] >> 1) & 2)); /* chroma = "1" */ for (j = 2 * 2 - 1; j >= 0; j--) { for (i = 0; i < n_comp; i++) { /* add in colors */ FX64_SHL(hi, 5); FX64_OR32(hi, vec[j][i] >> 3); } } ((Fx64 *)cc)[1] = hi; } static void fxt1_quantize (GLuint *cc, const GLubyte *lines[], GLint comps) { GLint trualpha; GLubyte reord[N_TEXELS][MAX_COMP]; GLubyte input[N_TEXELS][MAX_COMP]; GLint i, k, l; if (comps == 3) { /* make the whole block opaque */ memset(input, -1, sizeof(input)); } /* 8 texels each line */ for (l = 0; l < 4; l++) { for (k = 0; k < 4; k++) { for (i = 0; i < comps; i++) { input[k + l * 4][i] = *lines[l]++; } } for (; k < 8; k++) { for (i = 0; i < comps; i++) { input[k + l * 4 + 12][i] = *lines[l]++; } } } /* block layout: * 00, 01, 02, 03, 08, 09, 0a, 0b * 10, 11, 12, 13, 18, 19, 1a, 1b * 04, 05, 06, 07, 0c, 0d, 0e, 0f * 14, 15, 16, 17, 1c, 1d, 1e, 1f */ /* [dBorca] * stupidity flows forth from this */ l = N_TEXELS; trualpha = 0; if (comps == 4) { /* skip all transparent black texels */ l = 0; for (k = 0; k < N_TEXELS; k++) { /* test all components against 0 */ if (!ISTBLACK(input[k])) { /* texel is not transparent black */ COPY_4UBV(reord[l], input[k]); if (reord[l][ACOMP] < (255 - ALPHA_TS)) { /* non-opaque texel */ trualpha = !0; } l++; } } } #if 0 if (trualpha) { fxt1_quantize_ALPHA0(cc, input, reord, l); } else if (l == 0) { cc[0] = cc[1] = cc[2] = -1; cc[3] = 0; } else if (l < N_TEXELS) { fxt1_quantize_HI(cc, input, reord, l); } else { fxt1_quantize_CHROMA(cc, input); } (void)fxt1_quantize_ALPHA1; (void)fxt1_quantize_MIXED1; (void)fxt1_quantize_MIXED0; #else if (trualpha) { fxt1_quantize_ALPHA1(cc, input); } else if (l == 0) { cc[0] = cc[1] = cc[2] = ~0u; cc[3] = 0; } else if (l < N_TEXELS) { fxt1_quantize_MIXED1(cc, input); } else { fxt1_quantize_MIXED0(cc, input); } (void)fxt1_quantize_ALPHA0; (void)fxt1_quantize_HI; (void)fxt1_quantize_CHROMA; #endif } static GLint fxt1_encode (GLuint width, GLuint height, GLint comps, const void *source, GLint srcRowStride, void *dest, GLint destRowStride) { GLuint x, y; const GLubyte *data; GLuint *encoded = (GLuint *)dest; GLubyte *newSource = NULL; /* Replicate image if width is not M8 or height is not M4 */ if ((width & 7) | (height & 3)) { GLint newWidth = (width + 7) & ~7; GLint newHeight = (height + 3) & ~3; newSource = (GLubyte *) _mesa_malloc(comps * newWidth * newHeight * sizeof(GLubyte *)); _mesa_upscale_teximage2d(width, height, newWidth, newHeight, comps, (const GLchan *) source, srcRowStride, newSource); source = newSource; width = newWidth; height = newHeight; srcRowStride = comps * newWidth; } data = (const GLubyte *) source; destRowStride = (destRowStride - width * 2) / 4; for (y = 0; y < height; y += 4) { GLuint offs = 0 + (y + 0) * srcRowStride; for (x = 0; x < width; x += 8) { const GLubyte *lines[4]; lines[0] = &data[offs]; lines[1] = lines[0] + srcRowStride; lines[2] = lines[1] + srcRowStride; lines[3] = lines[2] + srcRowStride; offs += 8 * comps; fxt1_quantize(encoded, lines, comps); /* 128 bits per 8x4 block */ encoded += 4; } encoded += destRowStride; } if (newSource != NULL) { _mesa_free(newSource); } return 0; } /***************************************************************************\ * FXT1 decoder * * The decoder is based on GL_3DFX_texture_compression_FXT1 * specification and serves as a concept for the encoder. \***************************************************************************/ /* lookup table for scaling 5 bit colors up to 8 bits */ static const GLubyte _rgb_scale_5[] = { 0, 8, 16, 25, 33, 41, 49, 58, 66, 74, 82, 90, 99, 107, 115, 123, 132, 140, 148, 156, 165, 173, 181, 189, 197, 206, 214, 222, 230, 239, 247, 255 }; /* lookup table for scaling 6 bit colors up to 8 bits */ static const GLubyte _rgb_scale_6[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, 130, 134, 138, 142, 146, 150, 154, 158, 162, 166, 170, 174, 178, 182, 186, 190, 194, 198, 202, 206, 210, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255 }; #define CC_SEL(cc, which) (((GLuint *)(cc))[(which) / 32] >> ((which) & 31)) #define UP5(c) _rgb_scale_5[(c) & 31] #define UP6(c, b) _rgb_scale_6[(((c) & 31) << 1) | ((b) & 1)] #define LERP(n, t, c0, c1) (((n) - (t)) * (c0) + (t) * (c1) + (n) / 2) / (n) #define ZERO_4UBV(v) *((GLuint *)(v)) = 0 static void fxt1_decode_1HI (const GLubyte *code, GLint t, GLubyte *rgba) { const GLuint *cc; t *= 3; cc = (const GLuint *)(code + t / 8); t = (cc[0] >> (t & 7)) & 7; if (t == 7) { ZERO_4UBV(rgba); } else { cc = (const GLuint *)(code + 12); if (t == 0) { rgba[BCOMP] = UP5(CC_SEL(cc, 0)); rgba[GCOMP] = UP5(CC_SEL(cc, 5)); rgba[RCOMP] = UP5(CC_SEL(cc, 10)); } else if (t == 6) { rgba[BCOMP] = UP5(CC_SEL(cc, 15)); rgba[GCOMP] = UP5(CC_SEL(cc, 20)); rgba[RCOMP] = UP5(CC_SEL(cc, 25)); } else { rgba[BCOMP] = LERP(6, t, UP5(CC_SEL(cc, 0)), UP5(CC_SEL(cc, 15))); rgba[GCOMP] = LERP(6, t, UP5(CC_SEL(cc, 5)), UP5(CC_SEL(cc, 20))); rgba[RCOMP] = LERP(6, t, UP5(CC_SEL(cc, 10)), UP5(CC_SEL(cc, 25))); } rgba[ACOMP] = 255; } } static void fxt1_decode_1CHROMA (const GLubyte *code, GLint t, GLubyte *rgba) { const GLuint *cc; GLuint kk; cc = (const GLuint *)code; if (t & 16) { cc++; t &= 15; } t = (cc[0] >> (t * 2)) & 3; t *= 15; cc = (const GLuint *)(code + 8 + t / 8); kk = cc[0] >> (t & 7); rgba[BCOMP] = UP5(kk); rgba[GCOMP] = UP5(kk >> 5); rgba[RCOMP] = UP5(kk >> 10); rgba[ACOMP] = 255; } static void fxt1_decode_1MIXED (const GLubyte *code, GLint t, GLubyte *rgba) { const GLuint *cc; GLuint col[2][3]; GLint glsb, selb; cc = (const GLuint *)code; if (t & 16) { t &= 15; t = (cc[1] >> (t * 2)) & 3; /* col 2 */ col[0][BCOMP] = (*(const GLuint *)(code + 11)) >> 6; col[0][GCOMP] = CC_SEL(cc, 99); col[0][RCOMP] = CC_SEL(cc, 104); /* col 3 */ col[1][BCOMP] = CC_SEL(cc, 109); col[1][GCOMP] = CC_SEL(cc, 114); col[1][RCOMP] = CC_SEL(cc, 119); glsb = CC_SEL(cc, 126); selb = CC_SEL(cc, 33); } else { t = (cc[0] >> (t * 2)) & 3; /* col 0 */ col[0][BCOMP] = CC_SEL(cc, 64); col[0][GCOMP] = CC_SEL(cc, 69); col[0][RCOMP] = CC_SEL(cc, 74); /* col 1 */ col[1][BCOMP] = CC_SEL(cc, 79); col[1][GCOMP] = CC_SEL(cc, 84); col[1][RCOMP] = CC_SEL(cc, 89); glsb = CC_SEL(cc, 125); selb = CC_SEL(cc, 1); } if (CC_SEL(cc, 124) & 1) { /* alpha[0] == 1 */ if (t == 3) { ZERO_4UBV(rgba); } else { if (t == 0) { rgba[BCOMP] = UP5(col[0][BCOMP]); rgba[GCOMP] = UP5(col[0][GCOMP]); rgba[RCOMP] = UP5(col[0][RCOMP]); } else if (t == 2) { rgba[BCOMP] = UP5(col[1][BCOMP]); rgba[GCOMP] = UP6(col[1][GCOMP], glsb); rgba[RCOMP] = UP5(col[1][RCOMP]); } else { rgba[BCOMP] = (UP5(col[0][BCOMP]) + UP5(col[1][BCOMP])) / 2; rgba[GCOMP] = (UP5(col[0][GCOMP]) + UP6(col[1][GCOMP], glsb)) / 2; rgba[RCOMP] = (UP5(col[0][RCOMP]) + UP5(col[1][RCOMP])) / 2; } rgba[ACOMP] = 255; } } else { /* alpha[0] == 0 */ if (t == 0) { rgba[BCOMP] = UP5(col[0][BCOMP]); rgba[GCOMP] = UP6(col[0][GCOMP], glsb ^ selb); rgba[RCOMP] = UP5(col[0][RCOMP]); } else if (t == 3) { rgba[BCOMP] = UP5(col[1][BCOMP]); rgba[GCOMP] = UP6(col[1][GCOMP], glsb); rgba[RCOMP] = UP5(col[1][RCOMP]); } else { rgba[BCOMP] = LERP(3, t, UP5(col[0][BCOMP]), UP5(col[1][BCOMP])); rgba[GCOMP] = LERP(3, t, UP6(col[0][GCOMP], glsb ^ selb), UP6(col[1][GCOMP], glsb)); rgba[RCOMP] = LERP(3, t, UP5(col[0][RCOMP]), UP5(col[1][RCOMP])); } rgba[ACOMP] = 255; } } static void fxt1_decode_1ALPHA (const GLubyte *code, GLint t, GLubyte *rgba) { const GLuint *cc; cc = (const GLuint *)code; if (CC_SEL(cc, 124) & 1) { /* lerp == 1 */ GLuint col0[4]; if (t & 16) { t &= 15; t = (cc[1] >> (t * 2)) & 3; /* col 2 */ col0[BCOMP] = (*(const GLuint *)(code + 11)) >> 6; col0[GCOMP] = CC_SEL(cc, 99); col0[RCOMP] = CC_SEL(cc, 104); col0[ACOMP] = CC_SEL(cc, 119); } else { t = (cc[0] >> (t * 2)) & 3; /* col 0 */ col0[BCOMP] = CC_SEL(cc, 64); col0[GCOMP] = CC_SEL(cc, 69); col0[RCOMP] = CC_SEL(cc, 74); col0[ACOMP] = CC_SEL(cc, 109); } if (t == 0) { rgba[BCOMP] = UP5(col0[BCOMP]); rgba[GCOMP] = UP5(col0[GCOMP]); rgba[RCOMP] = UP5(col0[RCOMP]); rgba[ACOMP] = UP5(col0[ACOMP]); } else if (t == 3) { rgba[BCOMP] = UP5(CC_SEL(cc, 79)); rgba[GCOMP] = UP5(CC_SEL(cc, 84)); rgba[RCOMP] = UP5(CC_SEL(cc, 89)); rgba[ACOMP] = UP5(CC_SEL(cc, 114)); } else { rgba[BCOMP] = LERP(3, t, UP5(col0[BCOMP]), UP5(CC_SEL(cc, 79))); rgba[GCOMP] = LERP(3, t, UP5(col0[GCOMP]), UP5(CC_SEL(cc, 84))); rgba[RCOMP] = LERP(3, t, UP5(col0[RCOMP]), UP5(CC_SEL(cc, 89))); rgba[ACOMP] = LERP(3, t, UP5(col0[ACOMP]), UP5(CC_SEL(cc, 114))); } } else { /* lerp == 0 */ if (t & 16) { cc++; t &= 15; } t = (cc[0] >> (t * 2)) & 3; if (t == 3) { ZERO_4UBV(rgba); } else { GLuint kk; cc = (const GLuint *)code; rgba[ACOMP] = UP5(cc[3] >> (t * 5 + 13)); t *= 15; cc = (const GLuint *)(code + 8 + t / 8); kk = cc[0] >> (t & 7); rgba[BCOMP] = UP5(kk); rgba[GCOMP] = UP5(kk >> 5); rgba[RCOMP] = UP5(kk >> 10); } } } void fxt1_decode_1 (const void *texture, GLint stride, /* in pixels */ GLint i, GLint j, GLubyte *rgba) { static void (*decode_1[]) (const GLubyte *, GLint, GLubyte *) = { fxt1_decode_1HI, /* cc-high = "00?" */ fxt1_decode_1HI, /* cc-high = "00?" */ fxt1_decode_1CHROMA, /* cc-chroma = "010" */ fxt1_decode_1ALPHA, /* alpha = "011" */ fxt1_decode_1MIXED, /* mixed = "1??" */ fxt1_decode_1MIXED, /* mixed = "1??" */ fxt1_decode_1MIXED, /* mixed = "1??" */ fxt1_decode_1MIXED /* mixed = "1??" */ }; const GLubyte *code = (const GLubyte *)texture + ((j / 4) * (stride / 8) + (i / 8)) * 16; GLint mode = CC_SEL(code, 125); GLint t = i & 7; if (t & 4) { t += 12; } t += (j & 3) * 4; decode_1[mode](code, t, rgba); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texcompress.h0000644000000000000000000000427213614532424020673 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef TEXCOMPRESS_H #define TEXCOMPRESS_H #include "mtypes.h" #if _HAVE_FULL_GL extern GLuint _mesa_get_compressed_formats( GLcontext *ctx, GLint *formats ); extern GLuint _mesa_compressed_texture_size( GLcontext *ctx, GLsizei width, GLsizei height, GLsizei depth, GLenum format ); extern GLint _mesa_compressed_row_stride(GLenum format, GLsizei width); extern GLubyte * _mesa_compressed_image_address(GLint col, GLint row, GLint img, GLenum format, GLsizei width, const GLubyte *image); extern void _mesa_init_texture_s3tc( GLcontext *ctx ); extern void _mesa_init_texture_fxt1( GLcontext *ctx ); #else #define _mesa_get_compressed_formats( c, f ) 0 #define _mesa_compressed_texture_size( c, w, h, d, f ) 0 #define _mesa_compressed_row_stride( f, w) 0 #define _mesa_compressed_image_address(c, r, i, f, w, i2 ) 0 #define _mesa_compress_teximage( c, w, h, sF, s, sRS, dF, d, drs ) ((void)0) #endif #endif /* TEXCOMPRESS_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texcompress_s3tc.c0000644000000000000000000004557213614532424021632 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file texcompress_s3tc.c * GL_EXT_texture_compression_s3tc support. */ #ifndef USE_EXTERNAL_DXTN_LIB #define USE_EXTERNAL_DXTN_LIB 0 #endif #include "glheader.h" #include "imports.h" #include "colormac.h" #include "context.h" #include "convolve.h" #include "image.h" #include "texcompress.h" #include "texformat.h" #include "texstore.h" #if USE_EXTERNAL_DXTN_LIB #ifdef __MINGW32__ /* no dlopen */ #define DXTN_EXT "dxtn.dll" #define DXTN_PREFIX "" #define dlopen(name, mode) LoadLibrary(name) #define dlsym(hndl, proc) GetProcAddress(hndl, proc) #define dlclose(hndl) FreeLibrary(hndl) #elif defined(__DJGPP__) /* has dlopen, but doesn't like the names */ #include #define DXTN_EXT "dxtn.dxe" #define DXTN_PREFIX "_" #else /* happiness */ #include #define DXTN_EXT "libtxc_dxtn.so" #define DXTN_PREFIX "" #endif #endif /* USE_EXTERNAL_DXTN_LIB */ typedef void (*dxtFetchTexelFuncExt)( GLint srcRowstride, GLubyte *pixdata, GLint col, GLint row, GLvoid *texelOut ); dxtFetchTexelFuncExt fetch_ext_rgb_dxt1 = NULL; dxtFetchTexelFuncExt fetch_ext_rgba_dxt1 = NULL; dxtFetchTexelFuncExt fetch_ext_rgba_dxt3 = NULL; dxtFetchTexelFuncExt fetch_ext_rgba_dxt5 = NULL; typedef void (*dxtCompressTexFuncExt)(GLint srccomps, GLint width, GLint height, const GLubyte *srcPixData, GLenum destformat, GLubyte *dest, GLint dstRowStride); dxtCompressTexFuncExt ext_tx_compress_dxtn = NULL; void *dxtlibhandle = NULL; void _mesa_init_texture_s3tc( GLcontext *ctx ) { /* called during context initialization */ ctx->Mesa_DXTn = GL_FALSE; #if USE_EXTERNAL_DXTN_LIB if (!dxtlibhandle) { dxtlibhandle = dlopen (DXTN_EXT, RTLD_LAZY | RTLD_GLOBAL); if (!dxtlibhandle) { _mesa_warning(ctx, "couldn't open " DXTN_EXT ", software DXTn " "compression/decompression unavailable\n"); } else { /* the fetch functions are not per context! Might be problematic... */ fetch_ext_rgb_dxt1 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgb_dxt1"); if (fetch_ext_rgb_dxt1 != NULL) { fetch_ext_rgba_dxt1 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgba_dxt1"); } if (fetch_ext_rgba_dxt1 != NULL) { fetch_ext_rgba_dxt3 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgba_dxt3"); } if (fetch_ext_rgba_dxt3 != NULL) { fetch_ext_rgba_dxt5 = (dxtFetchTexelFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "fetch_2d_texel_rgba_dxt5"); } if (fetch_ext_rgba_dxt5 != NULL) { ext_tx_compress_dxtn = (dxtCompressTexFuncExt)dlsym(dxtlibhandle, DXTN_PREFIX "tx_compress_dxtn"); } if (ext_tx_compress_dxtn == NULL) { _mesa_warning(ctx, "couldn't reference all symbols in " DXTN_EXT ", software DXTn compression/decompression " "unavailable\n"); fetch_ext_rgb_dxt1 = NULL; fetch_ext_rgba_dxt1 = NULL; fetch_ext_rgba_dxt3 = NULL; fetch_ext_rgba_dxt5 = NULL; ext_tx_compress_dxtn = NULL; dlclose(dxtlibhandle); dxtlibhandle = NULL; } } } if (dxtlibhandle) { ctx->Mesa_DXTn = GL_TRUE; _mesa_warning(ctx, "software DXTn compression/decompression available\n"); } #else (void) ctx; #endif } /** * Called via TexFormat->StoreImage to store an RGB_DXT1 texture. */ static GLboolean texstore_rgb_dxt1(STORE_PARAMS) { const GLchan *pixels; GLint srcRowStride; GLubyte *dst; const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ const GLchan *tempImage = NULL; ASSERT(dstFormat == &_mesa_texformat_rgb_dxt1); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); (void) dstZoffset; (void) dstImageStride; if (srcFormat != GL_RGB || srcType != CHAN_TYPE || ctx->_ImageTransferState || srcPacking->SwapBytes) { /* convert image to RGB/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); if (!tempImage) return GL_FALSE; /* out of memory */ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); pixels = tempImage; srcRowStride = 3 * srcWidth; srcFormat = GL_RGB; } else { pixels = (const GLchan *) srcAddr; srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) / sizeof(GLchan); } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, texWidth, (GLubyte *) dstAddr); if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(3, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, dst, dstRowStride); } else { _mesa_problem(ctx, "external dxt library not available"); } if (tempImage) _mesa_free((void *) tempImage); return GL_TRUE; } /** * Called via TexFormat->StoreImage to store an RGBA_DXT1 texture. */ static GLboolean texstore_rgba_dxt1(STORE_PARAMS) { const GLchan *pixels; GLint srcRowStride; GLubyte *dst; const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ const GLchan *tempImage = NULL; ASSERT(dstFormat == &_mesa_texformat_rgba_dxt1); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); (void) dstZoffset; (void) dstImageStride; if (srcFormat != GL_RGBA || srcType != CHAN_TYPE || ctx->_ImageTransferState || srcPacking->SwapBytes) { /* convert image to RGBA/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); if (!tempImage) return GL_FALSE; /* out of memory */ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); pixels = tempImage; srcRowStride = 4 * srcWidth; srcFormat = GL_RGBA; } else { pixels = (const GLchan *) srcAddr; srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) / sizeof(GLchan); } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, texWidth, (GLubyte *) dstAddr); if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, dst, dstRowStride); } else { _mesa_problem(ctx, "external dxt library not available"); } if (tempImage) _mesa_free((void*) tempImage); return GL_TRUE; } /** * Called via TexFormat->StoreImage to store an RGBA_DXT3 texture. */ static GLboolean texstore_rgba_dxt3(STORE_PARAMS) { const GLchan *pixels; GLint srcRowStride; GLubyte *dst; const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; ASSERT(dstFormat == &_mesa_texformat_rgba_dxt3); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); (void) dstZoffset; (void) dstImageStride; if (srcFormat != GL_RGBA || srcType != CHAN_TYPE || ctx->_ImageTransferState || srcPacking->SwapBytes) { /* convert image to RGBA/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); if (!tempImage) return GL_FALSE; /* out of memory */ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); pixels = tempImage; srcRowStride = 4 * srcWidth; } else { pixels = (const GLchan *) srcAddr; srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) / sizeof(GLchan); } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, texWidth, (GLubyte *) dstAddr); if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, dst, dstRowStride); } else { _mesa_problem(ctx, "external dxt library not available"); } if (tempImage) _mesa_free((void *) tempImage); return GL_TRUE; } /** * Called via TexFormat->StoreImage to store an RGBA_DXT5 texture. */ static GLboolean texstore_rgba_dxt5(STORE_PARAMS) { const GLchan *pixels; GLint srcRowStride; GLubyte *dst; const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; ASSERT(dstFormat == &_mesa_texformat_rgba_dxt5); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); (void) dstZoffset; (void) dstImageStride; if (srcFormat != GL_RGBA || srcType != CHAN_TYPE || ctx->_ImageTransferState || srcPacking->SwapBytes) { /* convert image to RGBA/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); if (!tempImage) return GL_FALSE; /* out of memory */ _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); pixels = tempImage; srcRowStride = 4 * srcWidth; } else { pixels = (const GLchan *) srcAddr; srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) / sizeof(GLchan); } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, texWidth, (GLubyte *) dstAddr); if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, dst, dstRowStride); } else { _mesa_problem(ctx, "external dxt library not available"); } if (tempImage) _mesa_free((void *) tempImage); return GL_TRUE; } static void fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { (void) k; if (fetch_ext_rgb_dxt1) { ASSERT (sizeof(GLchan) == sizeof(GLubyte)); (*fetch_ext_rgb_dxt1)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel); } else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n"); } static void fetch_texel_2d_f_rgb_dxt1( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; fetch_texel_2d_rgb_dxt1(texImage, i, j, k, rgba); texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]); texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]); texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]); texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); } static void fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { (void) k; if (fetch_ext_rgba_dxt1) { (*fetch_ext_rgba_dxt1)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel); } else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n"); } static void fetch_texel_2d_f_rgba_dxt1( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; fetch_texel_2d_rgba_dxt1(texImage, i, j, k, rgba); texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]); texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]); texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]); texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); } static void fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { (void) k; if (fetch_ext_rgba_dxt3) { ASSERT (sizeof(GLchan) == sizeof(GLubyte)); (*fetch_ext_rgba_dxt3)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel); } else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n"); } static void fetch_texel_2d_f_rgba_dxt3( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; fetch_texel_2d_rgba_dxt3(texImage, i, j, k, rgba); texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]); texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]); texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]); texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); } static void fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { (void) k; if (fetch_ext_rgba_dxt5) { (*fetch_ext_rgba_dxt5)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel); } else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n"); } static void fetch_texel_2d_f_rgba_dxt5( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; fetch_texel_2d_rgba_dxt5(texImage, i, j, k, rgba); texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]); texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]); texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]); texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); } const struct gl_texture_format _mesa_texformat_rgb_dxt1 = { MESA_FORMAT_RGB_DXT1, /* MesaFormat */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 4, /*approx*/ /* RedBits */ 4, /*approx*/ /* GreenBits */ 4, /*approx*/ /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 0, /* TexelBytes */ texstore_rgb_dxt1, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ fetch_texel_2d_rgb_dxt1, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ }; const struct gl_texture_format _mesa_texformat_rgba_dxt1 = { MESA_FORMAT_RGBA_DXT1, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 4, /*approx*/ /* RedBits */ 4, /*approx*/ /* GreenBits */ 4, /*approx*/ /* BlueBits */ 1, /*approx*/ /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 0, /* TexelBytes */ texstore_rgba_dxt1, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ fetch_texel_2d_rgba_dxt1, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ }; const struct gl_texture_format _mesa_texformat_rgba_dxt3 = { MESA_FORMAT_RGBA_DXT3, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 4, /*approx*/ /* RedBits */ 4, /*approx*/ /* GreenBits */ 4, /*approx*/ /* BlueBits */ 4, /*approx*/ /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 0, /* TexelBytes */ texstore_rgba_dxt3, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ fetch_texel_2d_rgba_dxt3, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ }; const struct gl_texture_format _mesa_texformat_rgba_dxt5 = { MESA_FORMAT_RGBA_DXT5, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 4,/*approx*/ /* RedBits */ 4,/*approx*/ /* GreenBits */ 4,/*approx*/ /* BlueBits */ 4,/*approx*/ /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 0, /* TexelBytes */ texstore_rgba_dxt5, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ fetch_texel_2d_rgba_dxt5, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ }; nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texenvprogram.c0000644000000000000000000007445713614532424021227 0ustar /************************************************************************** * * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * **************************************************************************/ #include "glheader.h" #include "macros.h" #include "enums.h" #include "texenvprogram.h" #include "shader/program.h" #include "shader/nvfragprog.h" #include "shader/arbfragparse.h" #define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM) struct mode_opt { unsigned Source:4; unsigned Operand:3; }; struct state_key { GLuint enabled_units; unsigned separate_specular:1; unsigned fog_enabled:1; unsigned fog_mode:2; struct { unsigned enabled:1; unsigned source_index:3; unsigned ScaleShiftRGB:2; unsigned ScaleShiftA:2; unsigned NumArgsRGB:2; unsigned ModeRGB:4; struct mode_opt OptRGB[3]; unsigned NumArgsA:2; unsigned ModeA:4; struct mode_opt OptA[3]; } unit[8]; }; #define FOG_LINEAR 0 #define FOG_EXP 1 #define FOG_EXP2 2 #define FOG_UNKNOWN 3 static GLuint translate_fog_mode( GLenum mode ) { switch (mode) { case GL_LINEAR: return FOG_LINEAR; case GL_EXP: return FOG_EXP; case GL_EXP2: return FOG_EXP2; default: return FOG_UNKNOWN; } } #define OPR_SRC_COLOR 0 #define OPR_ONE_MINUS_SRC_COLOR 1 #define OPR_SRC_ALPHA 2 #define OPR_ONE_MINUS_SRC_ALPHA 3 #define OPR_ZERO 4 #define OPR_ONE 5 #define OPR_UNKNOWN 7 static GLuint translate_operand( GLenum operand ) { switch (operand) { case GL_SRC_COLOR: return OPR_SRC_COLOR; case GL_ONE_MINUS_SRC_COLOR: return OPR_ONE_MINUS_SRC_COLOR; case GL_SRC_ALPHA: return OPR_SRC_ALPHA; case GL_ONE_MINUS_SRC_ALPHA: return OPR_ONE_MINUS_SRC_ALPHA; case GL_ZERO: return OPR_ZERO; case GL_ONE: return OPR_ONE; default: return OPR_UNKNOWN; } } #define SRC_TEXTURE 0 #define SRC_TEXTURE0 1 #define SRC_TEXTURE1 2 #define SRC_TEXTURE2 3 #define SRC_TEXTURE3 4 #define SRC_TEXTURE4 5 #define SRC_TEXTURE5 6 #define SRC_TEXTURE6 7 #define SRC_TEXTURE7 8 #define SRC_CONSTANT 9 #define SRC_PRIMARY_COLOR 10 #define SRC_PREVIOUS 11 #define SRC_UNKNOWN 15 static GLuint translate_source( GLenum src ) { switch (src) { case GL_TEXTURE: return SRC_TEXTURE; case GL_TEXTURE0: case GL_TEXTURE1: case GL_TEXTURE2: case GL_TEXTURE3: case GL_TEXTURE4: case GL_TEXTURE5: case GL_TEXTURE6: case GL_TEXTURE7: return SRC_TEXTURE0 + (src - GL_TEXTURE0); case GL_CONSTANT: return SRC_CONSTANT; case GL_PRIMARY_COLOR: return SRC_PRIMARY_COLOR; case GL_PREVIOUS: return SRC_PREVIOUS; default: return SRC_UNKNOWN; } } #define MODE_REPLACE 0 #define MODE_MODULATE 1 #define MODE_ADD 2 #define MODE_ADD_SIGNED 3 #define MODE_INTERPOLATE 4 #define MODE_SUBTRACT 5 #define MODE_DOT3_RGB 6 #define MODE_DOT3_RGB_EXT 7 #define MODE_DOT3_RGBA 8 #define MODE_DOT3_RGBA_EXT 9 #define MODE_MODULATE_ADD_ATI 10 #define MODE_MODULATE_SIGNED_ADD_ATI 11 #define MODE_MODULATE_SUBTRACT_ATI 12 #define MODE_UNKNOWN 15 static GLuint translate_mode( GLenum mode ) { switch (mode) { case GL_REPLACE: return MODE_REPLACE; case GL_MODULATE: return MODE_MODULATE; case GL_ADD: return MODE_ADD; case GL_ADD_SIGNED: return MODE_ADD_SIGNED; case GL_INTERPOLATE: return MODE_INTERPOLATE; case GL_SUBTRACT: return MODE_SUBTRACT; case GL_DOT3_RGB: return MODE_DOT3_RGB; case GL_DOT3_RGB_EXT: return MODE_DOT3_RGB_EXT; case GL_DOT3_RGBA: return MODE_DOT3_RGBA; case GL_DOT3_RGBA_EXT: return MODE_DOT3_RGBA_EXT; case GL_MODULATE_ADD_ATI: return MODE_MODULATE_ADD_ATI; case GL_MODULATE_SIGNED_ADD_ATI: return MODE_MODULATE_SIGNED_ADD_ATI; case GL_MODULATE_SUBTRACT_ATI: return MODE_MODULATE_SUBTRACT_ATI; default: return MODE_UNKNOWN; } } #define TEXTURE_UNKNOWN_INDEX 7 static GLuint translate_tex_src_bit( GLuint bit ) { switch (bit) { case TEXTURE_1D_BIT: return TEXTURE_1D_INDEX; case TEXTURE_2D_BIT: return TEXTURE_2D_INDEX; case TEXTURE_RECT_BIT: return TEXTURE_RECT_INDEX; case TEXTURE_3D_BIT: return TEXTURE_3D_INDEX; case TEXTURE_CUBE_BIT: return TEXTURE_CUBE_INDEX; default: return TEXTURE_UNKNOWN_INDEX; } } static struct state_key *make_state_key( GLcontext *ctx ) { struct state_key *key = CALLOC_STRUCT(state_key); GLuint i, j; for (i=0;iTexture.Unit[i]; if (!texUnit->_ReallyEnabled) continue; key->unit[i].enabled = 1; key->enabled_units |= (1<unit[i].source_index = translate_tex_src_bit(texUnit->_ReallyEnabled); key->unit[i].NumArgsRGB = texUnit->_CurrentCombine->_NumArgsRGB; key->unit[i].NumArgsA = texUnit->_CurrentCombine->_NumArgsA; key->unit[i].ModeRGB = translate_mode(texUnit->_CurrentCombine->ModeRGB); key->unit[i].ModeA = translate_mode(texUnit->_CurrentCombine->ModeA); key->unit[i].ScaleShiftRGB = texUnit->_CurrentCombine->ScaleShiftRGB; key->unit[i].ScaleShiftA = texUnit->_CurrentCombine->ScaleShiftRGB; for (j=0;j<3;j++) { key->unit[i].OptRGB[j].Operand = translate_operand(texUnit->_CurrentCombine->OperandRGB[j]); key->unit[i].OptA[j].Operand = translate_operand(texUnit->_CurrentCombine->OperandA[j]); key->unit[i].OptRGB[j].Source = translate_source(texUnit->_CurrentCombine->SourceRGB[j]); key->unit[i].OptA[j].Source = translate_source(texUnit->_CurrentCombine->SourceA[j]); } } if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) key->separate_specular = 1; if (ctx->Fog.Enabled) { key->fog_enabled = 1; key->fog_mode = translate_fog_mode(ctx->Fog.Mode); } return key; } /* Use uregs to represent registers internally, translate to Mesa's * expected formats on emit. * * NOTE: These are passed by value extensively in this file rather * than as usual by pointer reference. If this disturbs you, try * remembering they are just 32bits in size. * * GCC is smart enough to deal with these dword-sized structures in * much the same way as if I had defined them as dwords and was using * macros to access and set the fields. This is much nicer and easier * to evolve. */ struct ureg { GLuint file:4; GLuint idx:8; GLuint negatebase:1; GLuint abs:1; GLuint negateabs:1; GLuint swz:12; GLuint pad:5; }; const static struct ureg undef = { ~0, ~0, 0, 0, 0, 0, 0 }; #define X 0 #define Y 1 #define Z 2 #define W 3 /* State used to build the fragment program: */ struct texenv_fragment_program { struct fragment_program *program; GLcontext *ctx; struct state_key *state; GLuint alu_temps; /* Track texture indirections, see spec. */ GLuint temps_output; /* Track texture indirections, see spec. */ GLuint temp_in_use; /* Tracks temporary regs which are in * use. */ GLboolean error; struct ureg src_texture[MAX_TEXTURE_UNITS]; /* Reg containing each texture unit's sampled texture color, * else undef. */ struct ureg src_previous; /* Reg containing color from previous * stage. May need to be decl'd. */ GLuint last_tex_stage; /* Number of last enabled texture unit */ struct ureg half; struct ureg one; struct ureg zero; }; static struct ureg make_ureg(GLuint file, GLuint idx) { struct ureg reg; reg.file = file; reg.idx = idx; reg.negatebase = 0; reg.abs = 0; reg.negateabs = 0; reg.swz = SWIZZLE_NOOP; reg.pad = 0; return reg; } static struct ureg swizzle( struct ureg reg, int x, int y, int z, int w ) { reg.swz = MAKE_SWIZZLE4(GET_SWZ(reg.swz, x), GET_SWZ(reg.swz, y), GET_SWZ(reg.swz, z), GET_SWZ(reg.swz, w)); return reg; } static struct ureg swizzle1( struct ureg reg, int x ) { return swizzle(reg, x, x, x, x); } static struct ureg negate( struct ureg reg ) { reg.negatebase ^= 1; return reg; } static GLboolean is_undef( struct ureg reg ) { return reg.file == 0xf; } static struct ureg get_temp( struct texenv_fragment_program *p ) { int bit; /* First try and reuse temps which have been used already: */ bit = ffs( ~p->temp_in_use & p->alu_temps ); /* Then any unused temporary: */ if (!bit) bit = ffs( ~p->temp_in_use ); if (!bit) { _mesa_problem(NULL, "%s: out of temporaries\n", __FILE__); exit(1); } p->temp_in_use |= 1<<(bit-1); return make_ureg(PROGRAM_TEMPORARY, (bit-1)); } static struct ureg get_tex_temp( struct texenv_fragment_program *p ) { int bit; /* First try to find availble temp not previously used (to avoid * starting a new texture indirection). According to the spec, the * ~p->temps_output isn't necessary, but will keep it there for * now: */ bit = ffs( ~p->temp_in_use & ~p->alu_temps & ~p->temps_output ); /* Then any unused temporary: */ if (!bit) bit = ffs( ~p->temp_in_use ); if (!bit) { _mesa_problem(NULL, "%s: out of temporaries\n", __FILE__); exit(1); } p->temp_in_use |= 1<<(bit-1); return make_ureg(PROGRAM_TEMPORARY, (bit-1)); } static void release_temps( struct texenv_fragment_program *p ) { GLuint max_temp = p->ctx->Const.MaxFragmentProgramTemps; /* KW: To support tex_env_crossbar, don't release the registers in * temps_output. */ if (max_temp >= sizeof(int) * 8) p->temp_in_use = p->temps_output; else p->temp_in_use = ~((1<temps_output; } static struct ureg register_param6( struct texenv_fragment_program *p, GLint s0, GLint s1, GLint s2, GLint s3, GLint s4, GLint s5) { GLint tokens[6]; GLuint idx; tokens[0] = s0; tokens[1] = s1; tokens[2] = s2; tokens[3] = s3; tokens[4] = s4; tokens[5] = s5; idx = _mesa_add_state_reference( p->program->Parameters, tokens ); return make_ureg(PROGRAM_STATE_VAR, idx); } #define register_param1(p,s0) register_param6(p,s0,0,0,0,0,0) #define register_param2(p,s0,s1) register_param6(p,s0,s1,0,0,0,0) #define register_param3(p,s0,s1,s2) register_param6(p,s0,s1,s2,0,0,0) #define register_param4(p,s0,s1,s2,s3) register_param6(p,s0,s1,s2,s3,0,0) static struct ureg register_input( struct texenv_fragment_program *p, GLuint input ) { p->program->InputsRead |= (1<File = ureg.file; reg->Index = ureg.idx; reg->Swizzle = ureg.swz; reg->NegateBase = ureg.negatebase; reg->Abs = ureg.abs; reg->NegateAbs = ureg.negateabs; } static void emit_dst( struct fp_dst_register *dst, struct ureg ureg, GLuint mask ) { dst->File = ureg.file; dst->Index = ureg.idx; dst->WriteMask = mask; dst->CondMask = 0; dst->CondSwizzle = 0; } static struct fp_instruction * emit_op(struct texenv_fragment_program *p, GLuint op, struct ureg dest, GLuint mask, GLuint saturate, struct ureg src0, struct ureg src1, struct ureg src2 ) { GLuint nr = p->program->Base.NumInstructions++; struct fp_instruction *inst = &p->program->Instructions[nr]; memset(inst, 0, sizeof(*inst)); inst->Opcode = op; emit_arg( &inst->SrcReg[0], src0 ); emit_arg( &inst->SrcReg[1], src1 ); emit_arg( &inst->SrcReg[2], src2 ); inst->Saturate = saturate; emit_dst( &inst->DstReg, dest, mask ); /* Accounting for indirection tracking: */ if (dest.file == PROGRAM_TEMPORARY) p->temps_output |= 1 << dest.idx; return inst; } static struct ureg emit_arith( struct texenv_fragment_program *p, GLuint op, struct ureg dest, GLuint mask, GLuint saturate, struct ureg src0, struct ureg src1, struct ureg src2 ) { emit_op(p, op, dest, mask, saturate, src0, src1, src2); /* Accounting for indirection tracking: */ if (src0.file == PROGRAM_TEMPORARY) p->alu_temps |= 1 << src0.idx; if (!is_undef(src1) && src1.file == PROGRAM_TEMPORARY) p->alu_temps |= 1 << src1.idx; if (!is_undef(src2) && src2.file == PROGRAM_TEMPORARY) p->alu_temps |= 1 << src2.idx; if (dest.file == PROGRAM_TEMPORARY) p->alu_temps |= 1 << dest.idx; p->program->NumAluInstructions++; return dest; } static struct ureg emit_texld( struct texenv_fragment_program *p, GLuint op, struct ureg dest, GLuint destmask, GLuint tex_unit, GLuint tex_idx, struct ureg coord ) { struct fp_instruction *inst = emit_op( p, op, dest, destmask, 0, /* don't saturate? */ coord, /* arg 0? */ undef, undef); inst->TexSrcIdx = tex_idx; inst->TexSrcUnit = tex_unit; p->program->NumTexInstructions++; /* Is this a texture indirection? */ if ((coord.file == PROGRAM_TEMPORARY && (p->temps_output & (1<alu_temps & (1<program->NumTexIndirections++; p->temps_output = 1<alu_temps = 0; assert(0); /* KW: texture env crossbar */ } return dest; } static struct ureg register_const4f( struct texenv_fragment_program *p, GLfloat s0, GLfloat s1, GLfloat s2, GLfloat s3) { GLfloat values[4]; GLuint idx; values[0] = s0; values[1] = s1; values[2] = s2; values[3] = s3; idx = _mesa_add_unnamed_constant( p->program->Parameters, values ); return make_ureg(PROGRAM_STATE_VAR, idx); } #define register_scalar_const(p, s0) register_const4f(p, s0, s0, s0, s0) #define register_const1f(p, s0) register_const4f(p, s0, 0, 0, 1) #define register_const2f(p, s0, s1) register_const4f(p, s0, s1, 0, 1) #define register_const3f(p, s0, s1, s2) register_const4f(p, s0, s1, s2, 1) static struct ureg get_one( struct texenv_fragment_program *p ) { if (is_undef(p->one)) p->one = register_scalar_const(p, 1.0); return p->one; } static struct ureg get_half( struct texenv_fragment_program *p ) { if (is_undef(p->half)) p->one = register_scalar_const(p, 0.5); return p->half; } static struct ureg get_zero( struct texenv_fragment_program *p ) { if (is_undef(p->zero)) p->one = register_scalar_const(p, 0.0); return p->zero; } static void program_error( struct texenv_fragment_program *p, const char *msg ) { _mesa_problem(NULL, msg); p->error = 1; } static struct ureg get_source( struct texenv_fragment_program *p, GLuint src, GLuint unit ) { switch (src) { case SRC_TEXTURE: assert(!is_undef(p->src_texture[unit])); return p->src_texture[unit]; case SRC_TEXTURE0: case SRC_TEXTURE1: case SRC_TEXTURE2: case SRC_TEXTURE3: case SRC_TEXTURE4: case SRC_TEXTURE5: case SRC_TEXTURE6: case SRC_TEXTURE7: assert(!is_undef(p->src_texture[src - SRC_TEXTURE0])); return p->src_texture[src - SRC_TEXTURE0]; case SRC_CONSTANT: return register_param2(p, STATE_TEXENV_COLOR, unit); case SRC_PRIMARY_COLOR: return register_input(p, FRAG_ATTRIB_COL0); case SRC_PREVIOUS: default: if (is_undef(p->src_previous)) return register_input(p, FRAG_ATTRIB_COL0); else return p->src_previous; } } static struct ureg emit_combine_source( struct texenv_fragment_program *p, GLuint mask, GLuint unit, GLuint source, GLuint operand ) { struct ureg arg, src, one; src = get_source(p, source, unit); switch (operand) { case OPR_ONE_MINUS_SRC_COLOR: /* Get unused tmp, * Emit tmp = 1.0 - arg.xyzw */ arg = get_temp( p ); one = get_one( p ); return emit_arith( p, FP_OPCODE_SUB, arg, mask, 0, one, src, undef); case OPR_SRC_ALPHA: if (mask == WRITEMASK_W) return src; else return swizzle1( src, W ); case OPR_ONE_MINUS_SRC_ALPHA: /* Get unused tmp, * Emit tmp = 1.0 - arg.wwww */ arg = get_temp(p); one = get_one(p); return emit_arith(p, FP_OPCODE_SUB, arg, mask, 0, one, swizzle1(src, W), undef); case OPR_ZERO: return get_zero(p); case OPR_ONE: return get_one(p); case OPR_SRC_COLOR: default: return src; } } static GLboolean args_match( struct state_key *key, GLuint unit ) { int i, nr = key->unit[unit].NumArgsRGB; for (i = 0 ; i < nr ; i++) { if (key->unit[unit].OptA[i].Source != key->unit[unit].OptRGB[i].Source) return GL_FALSE; switch(key->unit[unit].OptA[i].Operand) { case OPR_SRC_ALPHA: switch(key->unit[unit].OptRGB[i].Operand) { case OPR_SRC_COLOR: case OPR_SRC_ALPHA: break; default: return GL_FALSE; } break; case OPR_ONE_MINUS_SRC_ALPHA: switch(key->unit[unit].OptRGB[i].Operand) { case OPR_ONE_MINUS_SRC_COLOR: case OPR_ONE_MINUS_SRC_ALPHA: break; default: return GL_FALSE; } break; default: return GL_FALSE; /* impossible */ } } return GL_TRUE; } static struct ureg emit_combine( struct texenv_fragment_program *p, struct ureg dest, GLuint mask, GLuint saturate, GLuint unit, GLuint nr, GLuint mode, struct mode_opt *opt) { struct ureg src[3]; struct ureg tmp, half; int i; tmp = undef; /* silence warning (bug 5318) */ for (i = 0; i < nr; i++) src[i] = emit_combine_source( p, mask, unit, opt[i].Source, opt[i].Operand ); switch (mode) { case MODE_REPLACE: if (mask == WRITEMASK_XYZW && !saturate) return src[0]; else return emit_arith( p, FP_OPCODE_MOV, dest, mask, saturate, src[0], undef, undef ); case MODE_MODULATE: return emit_arith( p, FP_OPCODE_MUL, dest, mask, saturate, src[0], src[1], undef ); case MODE_ADD: return emit_arith( p, FP_OPCODE_ADD, dest, mask, saturate, src[0], src[1], undef ); case MODE_ADD_SIGNED: /* tmp = arg0 + arg1 * result = tmp - .5 */ half = get_half(p); emit_arith( p, FP_OPCODE_ADD, tmp, mask, 0, src[0], src[1], undef ); emit_arith( p, FP_OPCODE_SUB, dest, mask, saturate, tmp, half, undef ); return dest; case MODE_INTERPOLATE: /* Arg0 * (Arg2) + Arg1 * (1-Arg2) -- note arguments are reordered: */ return emit_arith( p, FP_OPCODE_LRP, dest, mask, saturate, src[2], src[0], src[1] ); case MODE_SUBTRACT: return emit_arith( p, FP_OPCODE_SUB, dest, mask, saturate, src[0], src[1], undef ); case MODE_DOT3_RGBA: case MODE_DOT3_RGBA_EXT: case MODE_DOT3_RGB_EXT: case MODE_DOT3_RGB: { struct ureg tmp0 = get_temp( p ); struct ureg tmp1 = get_temp( p ); struct ureg neg1 = register_scalar_const(p, -1); struct ureg two = register_scalar_const(p, 2); /* tmp0 = 2*src0 - 1 * tmp1 = 2*src1 - 1 * * dst = tmp0 dot3 tmp1 */ emit_arith( p, FP_OPCODE_MAD, tmp0, WRITEMASK_XYZW, 0, two, src[0], neg1); if (memcmp(&src[0], &src[1], sizeof(struct ureg)) == 0) tmp1 = tmp0; else emit_arith( p, FP_OPCODE_MAD, tmp1, WRITEMASK_XYZW, 0, two, src[1], neg1); emit_arith( p, FP_OPCODE_DP3, dest, mask, saturate, tmp0, tmp1, undef); return dest; } case MODE_MODULATE_ADD_ATI: /* Arg0 * Arg2 + Arg1 */ return emit_arith( p, FP_OPCODE_MAD, dest, mask, saturate, src[0], src[2], src[1] ); case MODE_MODULATE_SIGNED_ADD_ATI: { /* Arg0 * Arg2 + Arg1 - 0.5 */ struct ureg tmp0 = get_temp(p); half = get_half(p); emit_arith( p, FP_OPCODE_MAD, tmp0, mask, 0, src[0], src[2], src[1] ); emit_arith( p, FP_OPCODE_SUB, dest, mask, saturate, tmp0, half, undef ); return dest; } case MODE_MODULATE_SUBTRACT_ATI: /* Arg0 * Arg2 - Arg1 */ emit_arith( p, FP_OPCODE_MAD, dest, mask, 0, src[0], src[2], negate(src[1]) ); return dest; default: return src[0]; } } static struct ureg emit_texenv( struct texenv_fragment_program *p, int unit ) { struct state_key *key = p->state; GLuint saturate = (unit < p->last_tex_stage); GLuint rgb_shift, alpha_shift; struct ureg out, shift; struct ureg dest; if (!key->unit[unit].enabled) { return get_source(p, SRC_PREVIOUS, 0); } switch (key->unit[unit].ModeRGB) { case MODE_DOT3_RGB_EXT: alpha_shift = key->unit[unit].ScaleShiftA; rgb_shift = 0; break; case MODE_DOT3_RGBA_EXT: alpha_shift = 0; rgb_shift = 0; break; default: rgb_shift = key->unit[unit].ScaleShiftRGB; alpha_shift = key->unit[unit].ScaleShiftA; break; } /* If this is the very last calculation, emit direct to output reg: */ if (key->separate_specular || unit != p->last_tex_stage || alpha_shift || rgb_shift) dest = get_temp( p ); else dest = make_ureg(PROGRAM_OUTPUT, FRAG_OUTPUT_COLR); /* Emit the RGB and A combine ops */ if (key->unit[unit].ModeRGB == key->unit[unit].ModeA && args_match(key, unit)) { out = emit_combine( p, dest, WRITEMASK_XYZW, saturate, unit, key->unit[unit].NumArgsRGB, key->unit[unit].ModeRGB, key->unit[unit].OptRGB); } else if (key->unit[unit].ModeRGB == MODE_DOT3_RGBA_EXT || key->unit[unit].ModeA == MODE_DOT3_RGBA) { out = emit_combine( p, dest, WRITEMASK_XYZW, saturate, unit, key->unit[unit].NumArgsRGB, key->unit[unit].ModeRGB, key->unit[unit].OptRGB); } else { /* Need to do something to stop from re-emitting identical * argument calculations here: */ out = emit_combine( p, dest, WRITEMASK_XYZ, saturate, unit, key->unit[unit].NumArgsRGB, key->unit[unit].ModeRGB, key->unit[unit].OptRGB); out = emit_combine( p, dest, WRITEMASK_W, saturate, unit, key->unit[unit].NumArgsA, key->unit[unit].ModeA, key->unit[unit].OptA); } /* Deal with the final shift: */ if (alpha_shift || rgb_shift) { if (rgb_shift == alpha_shift) { shift = register_scalar_const(p, 1<src_texture[unit])) { GLuint dim = p->state->unit[unit].source_index; struct ureg texcoord = register_input(p, FRAG_ATTRIB_TEX0+unit); struct ureg tmp = get_tex_temp( p ); if (dim == TEXTURE_UNKNOWN_INDEX) program_error(p, "TexSrcBit"); /* TODO: Use D0_MASK_XY where possible. */ p->src_texture[unit] = emit_texld( p, FP_OPCODE_TXP, tmp, WRITEMASK_XYZW, unit, dim, texcoord ); } } static GLboolean load_texenv_source( struct texenv_fragment_program *p, GLuint src, GLuint unit ) { switch (src) { case SRC_TEXTURE: load_texture(p, unit); break; case SRC_TEXTURE0: case SRC_TEXTURE1: case SRC_TEXTURE2: case SRC_TEXTURE3: case SRC_TEXTURE4: case SRC_TEXTURE5: case SRC_TEXTURE6: case SRC_TEXTURE7: if (!p->state->unit[src - SRC_TEXTURE0].enabled) return GL_FALSE; load_texture(p, src - SRC_TEXTURE0); break; default: break; } return GL_TRUE; } static GLboolean load_texunit_sources( struct texenv_fragment_program *p, int unit ) { struct state_key *key = p->state; int i, nr = key->unit[unit].NumArgsRGB; for (i = 0; i < nr; i++) { if (!load_texenv_source( p, key->unit[unit].OptRGB[i].Source, unit) || !load_texenv_source( p, key->unit[unit].OptA[i].Source, unit )) return GL_FALSE; } return GL_TRUE; } static void create_new_program(struct state_key *key, GLcontext *ctx, struct fragment_program *program) { struct texenv_fragment_program p; GLuint unit; struct ureg cf, out; _mesa_memset(&p, 0, sizeof(p)); p.ctx = ctx; p.state = key; p.program = program; p.program->Instructions = MALLOC(sizeof(struct fp_instruction) * 100); p.program->Base.NumInstructions = 0; p.program->Base.Target = GL_FRAGMENT_PROGRAM_ARB; p.program->NumTexIndirections = 1; /* correct? */ p.program->NumTexInstructions = 0; p.program->NumAluInstructions = 0; p.program->Base.String = 0; p.program->Base.NumInstructions = p.program->Base.NumTemporaries = p.program->Base.NumParameters = p.program->Base.NumAttributes = p.program->Base.NumAddressRegs = 0; p.program->Parameters = _mesa_new_parameter_list(); p.program->InputsRead = 0; p.program->OutputsWritten = 1 << FRAG_OUTPUT_COLR; for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) p.src_texture[unit] = undef; p.src_previous = undef; p.last_tex_stage = 0; release_temps(&p); if (key->enabled_units) { /* First pass - to support texture_env_crossbar, first identify * all referenced texture sources and emit texld instructions * for each: */ for (unit = 0 ; unit < ctx->Const.MaxTextureUnits ; unit++) if (key->unit[unit].enabled) { if (load_texunit_sources( &p, unit )) p.last_tex_stage = unit; } /* Second pass - emit combine instructions to build final color: */ for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) if (key->enabled_units & (1<separate_specular) { /* Emit specular add. */ struct ureg s = register_input(&p, FRAG_ATTRIB_COL1); emit_arith( &p, FP_OPCODE_ADD, out, WRITEMASK_XYZ, 0, cf, s, undef ); } else if (memcmp(&cf, &out, sizeof(cf)) != 0) { /* Will wind up in here if no texture enabled or a couple of * other scenarios (GL_REPLACE for instance). */ emit_arith( &p, FP_OPCODE_MOV, out, WRITEMASK_XYZW, 0, cf, undef, undef ); } /* Finish up: */ emit_arith( &p, FP_OPCODE_END, undef, WRITEMASK_XYZW, 0, undef, undef, undef); if (key->fog_enabled) { /* Pull fog mode from GLcontext, the value in the state key is * a reduced value and not what is expected in FogOption */ p.program->FogOption = ctx->Fog.Mode; } else p.program->FogOption = GL_NONE; if (p.program->NumTexIndirections > ctx->Const.MaxFragmentProgramTexIndirections) program_error(&p, "Exceeded max nr indirect texture lookups"); if (p.program->NumTexInstructions > ctx->Const.MaxFragmentProgramTexInstructions) program_error(&p, "Exceeded max TEX instructions"); if (p.program->NumAluInstructions > ctx->Const.MaxFragmentProgramAluInstructions) program_error(&p, "Exceeded max ALU instructions"); /* Notify driver the fragment program has (actually) changed. */ if (ctx->Driver.ProgramStringNotify || DISASSEM) { if (ctx->Driver.ProgramStringNotify) ctx->Driver.ProgramStringNotify( ctx, GL_FRAGMENT_PROGRAM_ARB, &p.program->Base ); if (DISASSEM) { _mesa_debug_fp_inst(p.program->NumTexInstructions + p.program->NumAluInstructions, p.program->Instructions); _mesa_printf("\n"); } } } static void *search_cache( struct texenvprog_cache *cache, GLuint hash, const void *key, GLuint keysize) { struct texenvprog_cache *c; for (c = cache; c; c = c->next) { if (c->hash == hash && memcmp(c->key, key, keysize) == 0) return c->data; } return NULL; } static void cache_item( struct texenvprog_cache **cache, GLuint hash, void *key, void *data ) { struct texenvprog_cache *c = MALLOC(sizeof(*c)); c->hash = hash; c->key = key; c->data = data; c->next = *cache; *cache = c; } static GLuint hash_key( struct state_key *key ) { GLuint *ikey = (GLuint *)key; GLuint hash = 0, i; /* I'm sure this can be improved on, but speed is important: */ for (i = 0; i < sizeof(*key)/sizeof(GLuint); i++) hash ^= ikey[i]; return hash; } void _mesa_UpdateTexEnvProgram( GLcontext *ctx ) { struct state_key *key; GLuint hash; if (ctx->FragmentProgram._Enabled) return; key = make_state_key(ctx); hash = hash_key(key); ctx->FragmentProgram._Current = ctx->_TexEnvProgram = (struct fragment_program *) search_cache(ctx->Texture.env_fp_cache, hash, key, sizeof(*key)); if (!ctx->_TexEnvProgram) { if (0) _mesa_printf("Building new texenv proggy for key %x\n", hash); ctx->FragmentProgram._Current = ctx->_TexEnvProgram = (struct fragment_program *) ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); create_new_program(key, ctx, ctx->_TexEnvProgram); cache_item(&ctx->Texture.env_fp_cache, hash, key, ctx->_TexEnvProgram); } else { FREE(key); if (0) _mesa_printf("Found existing texenv program for key %x\n", hash); } } void _mesa_TexEnvProgramCacheDestroy( GLcontext *ctx ) { struct texenvprog_cache *a, *tmp; for (a = ctx->Texture.env_fp_cache; a; a = tmp) { tmp = a->next; FREE(a->key); FREE(a->data); FREE(a); } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texenvprogram.h0000644000000000000000000000263113614532424021215 0ustar /** * \file texenvprogram.h * Texture state management. */ /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef TEXENVPROGRAM_H #define TEXENVPROGRAM_H #include "mtypes.h" extern void _mesa_UpdateTexEnvProgram( GLcontext *ctx ); extern void _mesa_TexEnvProgramCacheDestroy( GLcontext *ctx ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texformat.c0000644000000000000000000013161513614532424020325 0ustar /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file texformat.c * Texture formats. * * \author Gareth Hughes */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "image.h" #include "imports.h" #include "mtypes.h" #include "texformat.h" #include "teximage.h" #include "texstate.h" #include "texstore.h" /* Texel fetch routines for all supported formats */ #define DIM 1 #include "texformat_tmp.h" #define DIM 2 #include "texformat_tmp.h" #define DIM 3 #include "texformat_tmp.h" /** * Null texel fetch function. * * Have to have this so the FetchTexel function pointer is never NULL. */ static void fetch_null_texel( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { (void) texImage; (void) i; (void) j; (void) k; texel[RCOMP] = 0; texel[GCOMP] = 0; texel[BCOMP] = 0; texel[ACOMP] = 0; _mesa_warning(NULL, "fetch_null_texel() called!"); } static void fetch_null_texelf( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { (void) texImage; (void) i; (void) j; (void) k; texel[RCOMP] = 0.0; texel[GCOMP] = 0.0; texel[BCOMP] = 0.0; texel[ACOMP] = 0.0; _mesa_warning(NULL, "fetch_null_texelf() called!"); } static void store_null_texel(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { /* no-op */ } /***************************************************************/ /** \name Default GLchan-based formats */ /*@{*/ const struct gl_texture_format _mesa_texformat_rgba = { MESA_FORMAT_RGBA, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ CHAN_BITS, /* RedBits */ CHAN_BITS, /* GreenBits */ CHAN_BITS, /* BlueBits */ CHAN_BITS, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 4 * sizeof(GLchan), /* TexelBytes */ _mesa_texstore_rgba, /* StoreTexImageFunc */ fetch_texel_1d_rgba, /* FetchTexel1D */ fetch_texel_2d_rgba, /* FetchTexel2D */ fetch_texel_3d_rgba, /* FetchTexel3D */ fetch_texel_1d_f_rgba, /* FetchTexel1Df */ fetch_texel_2d_f_rgba, /* FetchTexel2Df */ fetch_texel_3d_f_rgba, /* FetchTexel3Df */ store_texel_rgba /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb = { MESA_FORMAT_RGB, /* MesaFormat */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ CHAN_BITS, /* RedBits */ CHAN_BITS, /* GreenBits */ CHAN_BITS, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 3 * sizeof(GLchan), /* TexelBytes */ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_rgb, /* FetchTexel1D */ fetch_texel_2d_rgb, /* FetchTexel2D */ fetch_texel_3d_rgb, /* FetchTexel3D */ fetch_texel_1d_f_rgb, /* FetchTexel1Df */ fetch_texel_2d_f_rgb, /* FetchTexel2Df */ fetch_texel_3d_f_rgb, /* FetchTexel3Df */ store_texel_rgb /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha = { MESA_FORMAT_ALPHA, /* MesaFormat */ GL_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ CHAN_BITS, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ sizeof(GLchan), /* TexelBytes */ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_alpha, /* FetchTexel1D */ fetch_texel_2d_alpha, /* FetchTexel2D */ fetch_texel_3d_alpha, /* FetchTexel3D */ fetch_texel_1d_f_alpha, /* FetchTexel1Df */ fetch_texel_2d_f_alpha, /* FetchTexel2Df */ fetch_texel_3d_f_alpha, /* FetchTexel3Df */ store_texel_alpha /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance = { MESA_FORMAT_LUMINANCE, /* MesaFormat */ GL_LUMINANCE, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 0, /* AlphaBits */ CHAN_BITS, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ sizeof(GLchan), /* TexelBytes */ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_luminance, /* FetchTexel1D */ fetch_texel_2d_luminance, /* FetchTexel2D */ fetch_texel_3d_luminance, /* FetchTexel3D */ fetch_texel_1d_f_luminance, /* FetchTexel1Df */ fetch_texel_2d_f_luminance, /* FetchTexel2Df */ fetch_texel_3d_f_luminance, /* FetchTexel3Df */ store_texel_luminance /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha = { MESA_FORMAT_LUMINANCE_ALPHA, /* MesaFormat */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ CHAN_BITS, /* AlphaBits */ CHAN_BITS, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 2 * sizeof(GLchan), /* TexelBytes */ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_luminance_alpha, /* FetchTexel1D */ fetch_texel_2d_luminance_alpha, /* FetchTexel2D */ fetch_texel_3d_luminance_alpha, /* FetchTexel3D */ fetch_texel_1d_f_luminance_alpha, /* FetchTexel1Df */ fetch_texel_2d_f_luminance_alpha, /* FetchTexel2Df */ fetch_texel_3d_f_luminance_alpha, /* FetchTexel3Df */ store_texel_luminance_alpha /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity = { MESA_FORMAT_INTENSITY, /* MesaFormat */ GL_INTENSITY, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ CHAN_BITS, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ sizeof(GLchan), /* TexelBytes */ _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_intensity, /* FetchTexel1D */ fetch_texel_2d_intensity, /* FetchTexel2D */ fetch_texel_3d_intensity, /* FetchTexel3D */ fetch_texel_1d_f_intensity, /* FetchTexel1Df */ fetch_texel_2d_f_intensity, /* FetchTexel2Df */ fetch_texel_3d_f_intensity, /* FetchTexel3Df */ store_texel_intensity /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_depth_component_float32 = { MESA_FORMAT_DEPTH_COMPONENT_FLOAT32, /* MesaFormat */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ sizeof(GLfloat) * 8, /* DepthBits */ sizeof(GLfloat), /* TexelBytes */ _mesa_texstore_depth_component_float32,/* StoreTexImageFunc */ fetch_null_texel, /* FetchTexel1D */ fetch_null_texel, /* FetchTexel1D */ fetch_null_texel, /* FetchTexel1D */ fetch_texel_1d_f_depth_component_f32,/* FetchTexel1Df */ fetch_texel_2d_f_depth_component_f32,/* FetchTexel2Df */ fetch_texel_3d_f_depth_component_f32,/* FetchTexel3Df */ store_texel_depth_component_f32 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_depth_component16 = { MESA_FORMAT_DEPTH_COMPONENT16, /* MesaFormat */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ sizeof(GLushort) * 8, /* DepthBits */ sizeof(GLushort), /* TexelBytes */ _mesa_texstore_depth_component16, /* StoreTexImageFunc */ fetch_null_texel, /* FetchTexel1D */ fetch_null_texel, /* FetchTexel1D */ fetch_null_texel, /* FetchTexel1D */ fetch_texel_1d_f_depth_component16, /* FetchTexel1Df */ fetch_texel_2d_f_depth_component16, /* FetchTexel2Df */ fetch_texel_3d_f_depth_component16, /* FetchTexel3Df */ store_texel_depth_component16 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba_float32 = { MESA_FORMAT_RGBA_FLOAT32, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_FLOAT, /* DataType */ 8 * sizeof(GLfloat), /* RedBits */ 8 * sizeof(GLfloat), /* GreenBits */ 8 * sizeof(GLfloat), /* BlueBits */ 8 * sizeof(GLfloat), /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 4 * sizeof(GLfloat), /* TexelBytes */ _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ fetch_texel_1d_rgba_f32, /* FetchTexel1D */ fetch_texel_2d_rgba_f32, /* FetchTexel1D */ fetch_texel_3d_rgba_f32, /* FetchTexel1D */ fetch_texel_1d_f_rgba_f32, /* FetchTexel1Df */ fetch_texel_2d_f_rgba_f32, /* FetchTexel2Df */ fetch_texel_3d_f_rgba_f32, /* FetchTexel3Df */ store_texel_rgba_f32 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba_float16 = { MESA_FORMAT_RGBA_FLOAT16, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_FLOAT, /* DataType */ 8 * sizeof(GLhalfARB), /* RedBits */ 8 * sizeof(GLhalfARB), /* GreenBits */ 8 * sizeof(GLhalfARB), /* BlueBits */ 8 * sizeof(GLhalfARB), /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 4 * sizeof(GLhalfARB), /* TexelBytes */ _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ fetch_texel_1d_rgba_f16, /* FetchTexel1D */ fetch_texel_2d_rgba_f16, /* FetchTexel1D */ fetch_texel_3d_rgba_f16, /* FetchTexel1D */ fetch_texel_1d_f_rgba_f16, /* FetchTexel1Df */ fetch_texel_2d_f_rgba_f16, /* FetchTexel2Df */ fetch_texel_3d_f_rgba_f16, /* FetchTexel3Df */ store_texel_rgba_f16 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb_float32 = { MESA_FORMAT_RGB_FLOAT32, /* MesaFormat */ GL_RGB, /* BaseFormat */ GL_FLOAT, /* DataType */ 8 * sizeof(GLfloat), /* RedBits */ 8 * sizeof(GLfloat), /* GreenBits */ 8 * sizeof(GLfloat), /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 3 * sizeof(GLfloat), /* TexelBytes */ _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_rgb_f32, /* FetchTexel1D */ fetch_texel_2d_rgb_f32, /* FetchTexel1D */ fetch_texel_3d_rgb_f32, /* FetchTexel1D */ fetch_texel_1d_f_rgb_f32, /* FetchTexel1Df */ fetch_texel_2d_f_rgb_f32, /* FetchTexel2Df */ fetch_texel_3d_f_rgb_f32, /* FetchTexel3Df */ store_texel_rgb_f32 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb_float16 = { MESA_FORMAT_RGB_FLOAT16, /* MesaFormat */ GL_RGB, /* BaseFormat */ GL_FLOAT, /* DataType */ 8 * sizeof(GLhalfARB), /* RedBits */ 8 * sizeof(GLhalfARB), /* GreenBits */ 8 * sizeof(GLhalfARB), /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 3 * sizeof(GLhalfARB), /* TexelBytes */ _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_rgb_f16, /* FetchTexel1D */ fetch_texel_2d_rgb_f16, /* FetchTexel1D */ fetch_texel_3d_rgb_f16, /* FetchTexel1D */ fetch_texel_1d_f_rgb_f16, /* FetchTexel1Df */ fetch_texel_2d_f_rgb_f16, /* FetchTexel2Df */ fetch_texel_3d_f_rgb_f16, /* FetchTexel3Df */ store_texel_rgb_f16 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha_float32 = { MESA_FORMAT_ALPHA_FLOAT32, /* MesaFormat */ GL_ALPHA, /* BaseFormat */ GL_FLOAT, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 8 * sizeof(GLfloat), /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 1 * sizeof(GLfloat), /* TexelBytes */ _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_alpha_f32, /* FetchTexel1D */ fetch_texel_2d_alpha_f32, /* FetchTexel1D */ fetch_texel_3d_alpha_f32, /* FetchTexel1D */ fetch_texel_1d_f_alpha_f32, /* FetchTexel1Df */ fetch_texel_2d_f_alpha_f32, /* FetchTexel2Df */ fetch_texel_3d_f_alpha_f32, /* FetchTexel3Df */ store_texel_alpha_f32 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha_float16 = { MESA_FORMAT_ALPHA_FLOAT16, /* MesaFormat */ GL_ALPHA, /* BaseFormat */ GL_FLOAT, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 8 * sizeof(GLhalfARB), /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_alpha_f16, /* FetchTexel1D */ fetch_texel_2d_alpha_f16, /* FetchTexel1D */ fetch_texel_3d_alpha_f16, /* FetchTexel1D */ fetch_texel_1d_f_alpha_f16, /* FetchTexel1Df */ fetch_texel_2d_f_alpha_f16, /* FetchTexel2Df */ fetch_texel_3d_f_alpha_f16, /* FetchTexel3Df */ store_texel_alpha_f16 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_float32 = { MESA_FORMAT_LUMINANCE_FLOAT32, /* MesaFormat */ GL_LUMINANCE, /* BaseFormat */ GL_FLOAT, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 0, /* AlphaBits */ 8 * sizeof(GLfloat), /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 1 * sizeof(GLfloat), /* TexelBytes */ _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_luminance_f32, /* FetchTexel1D */ fetch_texel_2d_luminance_f32, /* FetchTexel2D */ fetch_texel_3d_luminance_f32, /* FetchTexel3D */ fetch_texel_1d_f_luminance_f32, /* FetchTexel1Df */ fetch_texel_2d_f_luminance_f32, /* FetchTexel2Df */ fetch_texel_3d_f_luminance_f32, /* FetchTexel3Df */ store_texel_luminance_f32 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_float16 = { MESA_FORMAT_LUMINANCE_FLOAT16, /* MesaFormat */ GL_LUMINANCE, /* BaseFormat */ GL_FLOAT, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 0, /* AlphaBits */ 8 * sizeof(GLhalfARB), /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_luminance_f16, /* FetchTexel1D */ fetch_texel_2d_luminance_f16, /* FetchTexel2D */ fetch_texel_3d_luminance_f16, /* FetchTexel3D */ fetch_texel_1d_f_luminance_f16, /* FetchTexel1Df */ fetch_texel_2d_f_luminance_f16, /* FetchTexel2Df */ fetch_texel_3d_f_luminance_f16, /* FetchTexel3Df */ store_texel_luminance_f16 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, /* MesaFormat */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_FLOAT, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 8 * sizeof(GLfloat), /* AlphaBits */ 8 * sizeof(GLfloat), /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 2 * sizeof(GLfloat), /* TexelBytes */ _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ fetch_texel_1d_luminance_alpha_f32, /* FetchTexel1D */ fetch_texel_2d_luminance_alpha_f32, /* FetchTexel2D */ fetch_texel_3d_luminance_alpha_f32, /* FetchTexel3D */ fetch_texel_1d_f_luminance_alpha_f32,/* FetchTexel1Df */ fetch_texel_2d_f_luminance_alpha_f32,/* FetchTexel2Df */ fetch_texel_3d_f_luminance_alpha_f32,/* FetchTexel3Df */ store_texel_luminance_alpha_f32 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, /* MesaFormat */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_FLOAT, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 8 * sizeof(GLhalfARB), /* AlphaBits */ 8 * sizeof(GLhalfARB), /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 2 * sizeof(GLhalfARB), /* TexelBytes */ _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ fetch_texel_1d_luminance_alpha_f16, /* FetchTexel1D */ fetch_texel_2d_luminance_alpha_f16, /* FetchTexel2D */ fetch_texel_3d_luminance_alpha_f16, /* FetchTexel3D */ fetch_texel_1d_f_luminance_alpha_f16,/* FetchTexel1Df */ fetch_texel_2d_f_luminance_alpha_f16,/* FetchTexel2Df */ fetch_texel_3d_f_luminance_alpha_f16,/* FetchTexel3Df */ store_texel_luminance_alpha_f16 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity_float32 = { MESA_FORMAT_INTENSITY_FLOAT32, /* MesaFormat */ GL_INTENSITY, /* BaseFormat */ GL_FLOAT, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 8 * sizeof(GLfloat), /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 1 * sizeof(GLfloat), /* TexelBytes */ _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_intensity_f32, /* FetchTexel1D */ fetch_texel_2d_intensity_f32, /* FetchTexel2D */ fetch_texel_3d_intensity_f32, /* FetchTexel3D */ fetch_texel_1d_f_intensity_f32, /* FetchTexel1Df */ fetch_texel_2d_f_intensity_f32, /* FetchTexel2Df */ fetch_texel_3d_f_intensity_f32, /* FetchTexel3Df */ store_texel_intensity_f32 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity_float16 = { MESA_FORMAT_INTENSITY_FLOAT16, /* MesaFormat */ GL_INTENSITY, /* BaseFormat */ GL_FLOAT, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 8 * sizeof(GLhalfARB), /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_intensity_f16, /* FetchTexel1D */ fetch_texel_2d_intensity_f16, /* FetchTexel2D */ fetch_texel_3d_intensity_f16, /* FetchTexel3D */ fetch_texel_1d_f_intensity_f16, /* FetchTexel1Df */ fetch_texel_2d_f_intensity_f16, /* FetchTexel2Df */ fetch_texel_3d_f_intensity_f16, /* FetchTexel3Df */ store_texel_intensity_f16 /* StoreTexel */ }; /*@}*/ /***************************************************************/ /** \name Hardware formats */ /*@{*/ const struct gl_texture_format _mesa_texformat_rgba8888 = { MESA_FORMAT_RGBA8888, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 8, /* RedBits */ 8, /* GreenBits */ 8, /* BlueBits */ 8, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 4, /* TexelBytes */ _mesa_texstore_rgba8888, /* StoreTexImageFunc */ fetch_texel_1d_rgba8888, /* FetchTexel1D */ fetch_texel_2d_rgba8888, /* FetchTexel2D */ fetch_texel_3d_rgba8888, /* FetchTexel3D */ fetch_texel_1d_f_rgba8888, /* FetchTexel1Df */ fetch_texel_2d_f_rgba8888, /* FetchTexel2Df */ fetch_texel_3d_f_rgba8888, /* FetchTexel3Df */ store_texel_rgba8888 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba8888_rev = { MESA_FORMAT_RGBA8888_REV, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 8, /* RedBits */ 8, /* GreenBits */ 8, /* BlueBits */ 8, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 4, /* TexelBytes */ _mesa_texstore_rgba8888, /* StoreTexImageFunc */ fetch_texel_1d_rgba8888_rev, /* FetchTexel1D */ fetch_texel_2d_rgba8888_rev, /* FetchTexel2D */ fetch_texel_3d_rgba8888_rev, /* FetchTexel3D */ fetch_texel_1d_f_rgba8888_rev, /* FetchTexel1Df */ fetch_texel_2d_f_rgba8888_rev, /* FetchTexel2Df */ fetch_texel_3d_f_rgba8888_rev, /* FetchTexel3Df */ store_texel_rgba8888_rev /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb8888 = { MESA_FORMAT_ARGB8888, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 8, /* RedBits */ 8, /* GreenBits */ 8, /* BlueBits */ 8, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 4, /* TexelBytes */ _mesa_texstore_argb8888, /* StoreTexImageFunc */ fetch_texel_1d_argb8888, /* FetchTexel1D */ fetch_texel_2d_argb8888, /* FetchTexel2D */ fetch_texel_3d_argb8888, /* FetchTexel3D */ fetch_texel_1d_f_argb8888, /* FetchTexel1Df */ fetch_texel_2d_f_argb8888, /* FetchTexel2Df */ fetch_texel_3d_f_argb8888, /* FetchTexel3Df */ store_texel_argb8888 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb8888_rev = { MESA_FORMAT_ARGB8888_REV, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 8, /* RedBits */ 8, /* GreenBits */ 8, /* BlueBits */ 8, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 4, /* TexelBytes */ _mesa_texstore_argb8888, /* StoreTexImageFunc */ fetch_texel_1d_argb8888_rev, /* FetchTexel1D */ fetch_texel_2d_argb8888_rev, /* FetchTexel2D */ fetch_texel_3d_argb8888_rev, /* FetchTexel3D */ fetch_texel_1d_f_argb8888_rev, /* FetchTexel1Df */ fetch_texel_2d_f_argb8888_rev, /* FetchTexel2Df */ fetch_texel_3d_f_argb8888_rev, /* FetchTexel3Df */ store_texel_argb8888_rev /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb888 = { MESA_FORMAT_RGB888, /* MesaFormat */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 8, /* RedBits */ 8, /* GreenBits */ 8, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 3, /* TexelBytes */ _mesa_texstore_rgb888, /* StoreTexImageFunc */ fetch_texel_1d_rgb888, /* FetchTexel1D */ fetch_texel_2d_rgb888, /* FetchTexel2D */ fetch_texel_3d_rgb888, /* FetchTexel3D */ fetch_texel_1d_f_rgb888, /* FetchTexel1Df */ fetch_texel_2d_f_rgb888, /* FetchTexel2Df */ fetch_texel_3d_f_rgb888, /* FetchTexel3Df */ store_texel_rgb888 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_bgr888 = { MESA_FORMAT_BGR888, /* MesaFormat */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 8, /* RedBits */ 8, /* GreenBits */ 8, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 3, /* TexelBytes */ _mesa_texstore_bgr888, /* StoreTexImageFunc */ fetch_texel_1d_bgr888, /* FetchTexel1D */ fetch_texel_2d_bgr888, /* FetchTexel2D */ fetch_texel_3d_bgr888, /* FetchTexel3D */ fetch_texel_1d_f_bgr888, /* FetchTexel1Df */ fetch_texel_2d_f_bgr888, /* FetchTexel2Df */ fetch_texel_3d_f_bgr888, /* FetchTexel3Df */ store_texel_bgr888 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb565 = { MESA_FORMAT_RGB565, /* MesaFormat */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 5, /* RedBits */ 6, /* GreenBits */ 5, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 2, /* TexelBytes */ _mesa_texstore_rgb565, /* StoreTexImageFunc */ fetch_texel_1d_rgb565, /* FetchTexel1D */ fetch_texel_2d_rgb565, /* FetchTexel2D */ fetch_texel_3d_rgb565, /* FetchTexel3D */ fetch_texel_1d_f_rgb565, /* FetchTexel1Df */ fetch_texel_2d_f_rgb565, /* FetchTexel2Df */ fetch_texel_3d_f_rgb565, /* FetchTexel3Df */ store_texel_rgb565 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb565_rev = { MESA_FORMAT_RGB565_REV, /* MesaFormat */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 5, /* RedBits */ 6, /* GreenBits */ 5, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 2, /* TexelBytes */ _mesa_texstore_rgb565, /* StoreTexImageFunc */ fetch_texel_1d_rgb565_rev, /* FetchTexel1D */ fetch_texel_2d_rgb565_rev, /* FetchTexel2D */ fetch_texel_3d_rgb565_rev, /* FetchTexel3D */ fetch_texel_1d_f_rgb565_rev, /* FetchTexel1Df */ fetch_texel_2d_f_rgb565_rev, /* FetchTexel2Df */ fetch_texel_3d_f_rgb565_rev, /* FetchTexel3Df */ store_texel_rgb565_rev /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb4444 = { MESA_FORMAT_ARGB4444, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 4, /* RedBits */ 4, /* GreenBits */ 4, /* BlueBits */ 4, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 2, /* TexelBytes */ _mesa_texstore_argb4444, /* StoreTexImageFunc */ fetch_texel_1d_argb4444, /* FetchTexel1D */ fetch_texel_2d_argb4444, /* FetchTexel2D */ fetch_texel_3d_argb4444, /* FetchTexel3D */ fetch_texel_1d_f_argb4444, /* FetchTexel1Df */ fetch_texel_2d_f_argb4444, /* FetchTexel2Df */ fetch_texel_3d_f_argb4444, /* FetchTexel3Df */ store_texel_argb4444 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb4444_rev = { MESA_FORMAT_ARGB4444_REV, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 4, /* RedBits */ 4, /* GreenBits */ 4, /* BlueBits */ 4, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 2, /* TexelBytes */ _mesa_texstore_argb4444, /* StoreTexImageFunc */ fetch_texel_1d_argb4444_rev, /* FetchTexel1D */ fetch_texel_2d_argb4444_rev, /* FetchTexel2D */ fetch_texel_3d_argb4444_rev, /* FetchTexel3D */ fetch_texel_1d_f_argb4444_rev, /* FetchTexel1Df */ fetch_texel_2d_f_argb4444_rev, /* FetchTexel2Df */ fetch_texel_3d_f_argb4444_rev, /* FetchTexel3Df */ store_texel_argb4444_rev /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb1555 = { MESA_FORMAT_ARGB1555, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 5, /* RedBits */ 5, /* GreenBits */ 5, /* BlueBits */ 1, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 2, /* TexelBytes */ _mesa_texstore_argb1555, /* StoreTexImageFunc */ fetch_texel_1d_argb1555, /* FetchTexel1D */ fetch_texel_2d_argb1555, /* FetchTexel2D */ fetch_texel_3d_argb1555, /* FetchTexel3D */ fetch_texel_1d_f_argb1555, /* FetchTexel1Df */ fetch_texel_2d_f_argb1555, /* FetchTexel2Df */ fetch_texel_3d_f_argb1555, /* FetchTexel3Df */ store_texel_argb1555 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb1555_rev = { MESA_FORMAT_ARGB1555_REV, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 5, /* RedBits */ 5, /* GreenBits */ 5, /* BlueBits */ 1, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 2, /* TexelBytes */ _mesa_texstore_argb1555, /* StoreTexImageFunc */ fetch_texel_1d_argb1555_rev, /* FetchTexel1D */ fetch_texel_2d_argb1555_rev, /* FetchTexel2D */ fetch_texel_3d_argb1555_rev, /* FetchTexel3D */ fetch_texel_1d_f_argb1555_rev, /* FetchTexel1Df */ fetch_texel_2d_f_argb1555_rev, /* FetchTexel2Df */ fetch_texel_3d_f_argb1555_rev, /* FetchTexel3Df */ store_texel_argb1555_rev /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_al88 = { MESA_FORMAT_AL88, /* MesaFormat */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 8, /* AlphaBits */ 8, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 2, /* TexelBytes */ _mesa_texstore_al88, /* StoreTexImageFunc */ fetch_texel_1d_al88, /* FetchTexel1D */ fetch_texel_2d_al88, /* FetchTexel2D */ fetch_texel_3d_al88, /* FetchTexel3D */ fetch_texel_1d_f_al88, /* FetchTexel1Df */ fetch_texel_2d_f_al88, /* FetchTexel2Df */ fetch_texel_3d_f_al88, /* FetchTexel3Df */ store_texel_al88 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_al88_rev = { MESA_FORMAT_AL88_REV, /* MesaFormat */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 8, /* AlphaBits */ 8, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 2, /* TexelBytes */ _mesa_texstore_al88, /* StoreTexImageFunc */ fetch_texel_1d_al88_rev, /* FetchTexel1D */ fetch_texel_2d_al88_rev, /* FetchTexel2D */ fetch_texel_3d_al88_rev, /* FetchTexel3D */ fetch_texel_1d_f_al88_rev, /* FetchTexel1Df */ fetch_texel_2d_f_al88_rev, /* FetchTexel2Df */ fetch_texel_3d_f_al88_rev, /* FetchTexel3Df */ store_texel_al88_rev /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb332 = { MESA_FORMAT_RGB332, /* MesaFormat */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 3, /* RedBits */ 3, /* GreenBits */ 2, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 1, /* TexelBytes */ _mesa_texstore_rgb332, /* StoreTexImageFunc */ fetch_texel_1d_rgb332, /* FetchTexel1D */ fetch_texel_2d_rgb332, /* FetchTexel2D */ fetch_texel_3d_rgb332, /* FetchTexel3D */ fetch_texel_1d_f_rgb332, /* FetchTexel1Df */ fetch_texel_2d_f_rgb332, /* FetchTexel2Df */ fetch_texel_3d_f_rgb332, /* FetchTexel3Df */ store_texel_rgb332 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_a8 = { MESA_FORMAT_A8, /* MesaFormat */ GL_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 8, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 1, /* TexelBytes */ _mesa_texstore_a8, /* StoreTexImageFunc */ fetch_texel_1d_a8, /* FetchTexel1D */ fetch_texel_2d_a8, /* FetchTexel2D */ fetch_texel_3d_a8, /* FetchTexel3D */ fetch_texel_1d_f_a8, /* FetchTexel1Df */ fetch_texel_2d_f_a8, /* FetchTexel2Df */ fetch_texel_3d_f_a8, /* FetchTexel3Df */ store_texel_a8 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_l8 = { MESA_FORMAT_L8, /* MesaFormat */ GL_LUMINANCE, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 0, /* AlphaBits */ 8, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 1, /* TexelBytes */ _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_l8, /* FetchTexel1D */ fetch_texel_2d_l8, /* FetchTexel2D */ fetch_texel_3d_l8, /* FetchTexel3D */ fetch_texel_1d_f_l8, /* FetchTexel1Df */ fetch_texel_2d_f_l8, /* FetchTexel2Df */ fetch_texel_3d_f_l8, /* FetchTexel3Df */ store_texel_l8 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_i8 = { MESA_FORMAT_I8, /* MesaFormat */ GL_INTENSITY, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 8, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 1, /* TexelBytes */ _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ fetch_texel_1d_i8, /* FetchTexel1D */ fetch_texel_2d_i8, /* FetchTexel2D */ fetch_texel_3d_i8, /* FetchTexel3D */ fetch_texel_1d_f_i8, /* FetchTexel1Df */ fetch_texel_2d_f_i8, /* FetchTexel2Df */ fetch_texel_3d_f_i8, /* FetchTexel3Df */ store_texel_i8 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ci8 = { MESA_FORMAT_CI8, /* MesaFormat */ GL_COLOR_INDEX, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 8, /* IndexBits */ 0, /* DepthBits */ 1, /* TexelBytes */ _mesa_texstore_ci8, /* StoreTexImageFunc */ fetch_texel_1d_ci8, /* FetchTexel1D */ fetch_texel_2d_ci8, /* FetchTexel2D */ fetch_texel_3d_ci8, /* FetchTexel3D */ fetch_texel_1d_f_ci8, /* FetchTexel1Df */ fetch_texel_2d_f_ci8, /* FetchTexel2Df */ fetch_texel_3d_f_ci8, /* FetchTexel3Df */ store_texel_ci8 /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ycbcr = { MESA_FORMAT_YCBCR, /* MesaFormat */ GL_YCBCR_MESA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 2, /* TexelBytes */ _mesa_texstore_ycbcr, /* StoreTexImageFunc */ fetch_texel_1d_ycbcr, /* FetchTexel1D */ fetch_texel_2d_ycbcr, /* FetchTexel2D */ fetch_texel_3d_ycbcr, /* FetchTexel3D */ fetch_texel_1d_f_ycbcr, /* FetchTexel1Df */ fetch_texel_2d_f_ycbcr, /* FetchTexel2Df */ fetch_texel_3d_f_ycbcr, /* FetchTexel3Df */ store_texel_ycbcr /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ycbcr_rev = { MESA_FORMAT_YCBCR_REV, /* MesaFormat */ GL_YCBCR_MESA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 2, /* TexelBytes */ _mesa_texstore_ycbcr, /* StoreTexImageFunc */ fetch_texel_1d_ycbcr_rev, /* FetchTexel1D */ fetch_texel_2d_ycbcr_rev, /* FetchTexel2D */ fetch_texel_3d_ycbcr_rev, /* FetchTexel3D */ fetch_texel_1d_f_ycbcr_rev, /* FetchTexel1Df */ fetch_texel_2d_f_ycbcr_rev, /* FetchTexel2Df */ fetch_texel_3d_f_ycbcr_rev, /* FetchTexel3Df */ store_texel_ycbcr_rev /* StoreTexel */ }; /*@}*/ /***************************************************************/ /** \name Null format (useful for proxy textures) */ /*@{*/ const struct gl_texture_format _mesa_null_texformat = { -1, /* MesaFormat */ 0, /* BaseFormat */ GL_NONE, /* DataType */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ 0, /* AlphaBits */ 0, /* LuminanceBits */ 0, /* IntensityBits */ 0, /* IndexBits */ 0, /* DepthBits */ 0, /* TexelBytes */ NULL, /* StoreTexImageFunc */ fetch_null_texel, /* FetchTexel1D */ fetch_null_texel, /* FetchTexel2D */ fetch_null_texel, /* FetchTexel3D */ fetch_null_texelf, /* FetchTexel1Df */ fetch_null_texelf, /* FetchTexel2Df */ fetch_null_texelf, /* FetchTexel3Df */ store_null_texel /* StoreTexel */ }; /*@}*/ /** * Choose an appropriate texture format given the format, type and * internalFormat parameters passed to glTexImage(). * * \param ctx the GL context. * \param internalFormat user's prefered internal texture format. * \param format incoming image pixel format. * \param type incoming image data type. * * \return a pointer to a gl_texture_format object which describes the * choosen texture format, or NULL on failure. * * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers * will typically override this function with a specialized version. */ const struct gl_texture_format * _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { (void) format; (void) type; switch (internalFormat) { /* RGBA formats */ case 4: case GL_RGBA: case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: return &_mesa_texformat_rgba; case GL_RGBA8: return &_mesa_texformat_rgba8888; case GL_RGB5_A1: return &_mesa_texformat_argb1555; case GL_RGBA2: return &_mesa_texformat_argb4444_rev; /* just to test another format*/ case GL_RGBA4: return &_mesa_texformat_argb4444; /* RGB formats */ case 3: case GL_RGB: case GL_RGB10: case GL_RGB12: case GL_RGB16: return &_mesa_texformat_rgb; case GL_RGB8: return &_mesa_texformat_rgb888; case GL_R3_G3_B2: return &_mesa_texformat_rgb332; case GL_RGB4: return &_mesa_texformat_rgb565_rev; /* just to test another format */ case GL_RGB5: return &_mesa_texformat_rgb565; /* Alpha formats */ case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA12: case GL_ALPHA16: return &_mesa_texformat_alpha; case GL_ALPHA8: return &_mesa_texformat_a8; /* Luminance formats */ case 1: case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE12: case GL_LUMINANCE16: return &_mesa_texformat_luminance; case GL_LUMINANCE8: return &_mesa_texformat_l8; /* Luminance/Alpha formats */ case 2: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE6_ALPHA2: case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: return &_mesa_texformat_luminance_alpha; case GL_LUMINANCE8_ALPHA8: return &_mesa_texformat_al88; case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY12: case GL_INTENSITY16: return &_mesa_texformat_intensity; case GL_INTENSITY8: return &_mesa_texformat_i8; case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: case GL_COLOR_INDEX2_EXT: case GL_COLOR_INDEX4_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: case GL_COLOR_INDEX8_EXT: return &_mesa_texformat_ci8; default: ; /* fallthrough */ } if (ctx->Extensions.SGIX_depth_texture || ctx->Extensions.ARB_depth_texture) { switch (internalFormat) { case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24_SGIX: case GL_DEPTH_COMPONENT32_SGIX: return &_mesa_texformat_depth_component_float32; case GL_DEPTH_COMPONENT16_SGIX: return &_mesa_texformat_depth_component16; default: ; /* fallthrough */ } } if (ctx->Extensions.ARB_texture_compression) { switch (internalFormat) { case GL_COMPRESSED_ALPHA_ARB: return &_mesa_texformat_alpha; case GL_COMPRESSED_LUMINANCE_ARB: return &_mesa_texformat_luminance; case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: return &_mesa_texformat_luminance_alpha; case GL_COMPRESSED_INTENSITY_ARB: return &_mesa_texformat_intensity; case GL_COMPRESSED_RGB_ARB: if (ctx->Extensions.TDFX_texture_compression_FXT1) return &_mesa_texformat_rgb_fxt1; else if (ctx->Extensions.EXT_texture_compression_s3tc || ctx->Extensions.S3_s3tc) return &_mesa_texformat_rgb_dxt1; else return &_mesa_texformat_rgb; case GL_COMPRESSED_RGBA_ARB: if (ctx->Extensions.TDFX_texture_compression_FXT1) return &_mesa_texformat_rgba_fxt1; else if (ctx->Extensions.EXT_texture_compression_s3tc || ctx->Extensions.S3_s3tc) return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */ else return &_mesa_texformat_rgba; default: ; /* fallthrough */ } } if (ctx->Extensions.MESA_ycbcr_texture) { if (internalFormat == GL_YCBCR_MESA) { if (type == GL_UNSIGNED_SHORT_8_8_MESA) return &_mesa_texformat_ycbcr; else return &_mesa_texformat_ycbcr_rev; } } if (ctx->Extensions.TDFX_texture_compression_FXT1) { switch (internalFormat) { case GL_COMPRESSED_RGB_FXT1_3DFX: return &_mesa_texformat_rgb_fxt1; case GL_COMPRESSED_RGBA_FXT1_3DFX: return &_mesa_texformat_rgba_fxt1; default: ; /* fallthrough */ } } if (ctx->Extensions.EXT_texture_compression_s3tc) { switch (internalFormat) { case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return &_mesa_texformat_rgb_dxt1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return &_mesa_texformat_rgba_dxt1; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: return &_mesa_texformat_rgba_dxt3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return &_mesa_texformat_rgba_dxt5; default: ; /* fallthrough */ } } if (ctx->Extensions.S3_s3tc) { switch (internalFormat) { case GL_RGB_S3TC: case GL_RGB4_S3TC: return &_mesa_texformat_rgb_dxt1; case GL_RGBA_S3TC: case GL_RGBA4_S3TC: return &_mesa_texformat_rgba_dxt3; default: ; /* fallthrough */ } } if (ctx->Extensions.ARB_texture_float) { switch (internalFormat) { case GL_ALPHA16F_ARB: return &_mesa_texformat_alpha_float16; case GL_ALPHA32F_ARB: return &_mesa_texformat_alpha_float32; case GL_LUMINANCE16F_ARB: return &_mesa_texformat_luminance_float16; case GL_LUMINANCE32F_ARB: return &_mesa_texformat_luminance_float32; case GL_LUMINANCE_ALPHA16F_ARB: return &_mesa_texformat_luminance_alpha_float16; case GL_LUMINANCE_ALPHA32F_ARB: return &_mesa_texformat_luminance_alpha_float32; case GL_INTENSITY16F_ARB: return &_mesa_texformat_intensity_float16; case GL_INTENSITY32F_ARB: return &_mesa_texformat_intensity_float32; case GL_RGB16F_ARB: return &_mesa_texformat_rgb_float16; case GL_RGB32F_ARB: return &_mesa_texformat_rgb_float32; case GL_RGBA16F_ARB: return &_mesa_texformat_rgba_float16; case GL_RGBA32F_ARB: return &_mesa_texformat_rgba_float32; default: ; /* fallthrough */ } } _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); return NULL; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texformat.h0000644000000000000000000002110213614532424020317 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file texformat.h * Texture formats definitions. * * \author Gareth Hughes */ #ifndef TEXFORMAT_H #define TEXFORMAT_H #include "mtypes.h" /** * Mesa internal texture image formats. * All texture images are stored in one of these formats. * * NOTE: when you add a new format, be sure to update the do_row() * function in texstore.c used for auto mipmap generation. */ enum _format { /** * \name Hardware-friendly formats. * * Drivers can override the default formats and convert texture images to * one of these as required. The driver's * dd_function_table::ChooseTextureFormat function will choose one of these * formats. * * \note In the default case, some of these formats will be duplicates of * the generic formats listed below. However, these formats guarantee their * internal component sizes, while GLchan may vary between GLubyte, GLushort * and GLfloat. */ /*@{*/ /* msb <------ TEXEL BITS -----------> lsb */ /* ---- ---- ---- ---- ---- ---- ---- ---- */ MESA_FORMAT_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ MESA_FORMAT_RGBA8888_REV, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ MESA_FORMAT_ARGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */ MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */ MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */ MESA_FORMAT_RGB565_REV, /* GGGB BBBB RRRR RGGG */ MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */ MESA_FORMAT_ARGB4444_REV, /* GGGG BBBB AAAA RRRR */ MESA_FORMAT_ARGB1555, /* ARRR RRGG GGGB BBBB */ MESA_FORMAT_ARGB1555_REV, /* GGGB BBBB ARRR RRGG */ MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */ MESA_FORMAT_AL88_REV, /* LLLL LLLL AAAA AAAA */ MESA_FORMAT_RGB332, /* RRRG GGBB */ MESA_FORMAT_A8, /* AAAA AAAA */ MESA_FORMAT_L8, /* LLLL LLLL */ MESA_FORMAT_I8, /* IIII IIII */ MESA_FORMAT_CI8, /* CCCC CCCC */ MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ /*@}*/ /** * \name Compressed texture formats. */ /*@{*/ MESA_FORMAT_RGB_FXT1, MESA_FORMAT_RGBA_FXT1, MESA_FORMAT_RGB_DXT1, MESA_FORMAT_RGBA_DXT1, MESA_FORMAT_RGBA_DXT3, MESA_FORMAT_RGBA_DXT5, /*@}*/ /** * \name Generic GLchan-based formats. * * Software-oriented texture formats. Texels are arrays of GLchan * values so there are no byte order issues. * * \note Because these are based on the GLchan data type, one cannot assume * 8 bits per channel with these formats. If you require GLubyte channels, * use one of the hardware formats above. */ /*@{*/ MESA_FORMAT_RGBA, MESA_FORMAT_RGB, MESA_FORMAT_ALPHA, MESA_FORMAT_LUMINANCE, MESA_FORMAT_LUMINANCE_ALPHA, MESA_FORMAT_INTENSITY, /*@}*/ /** * Depth textures */ /*@{*/ MESA_FORMAT_DEPTH_COMPONENT_FLOAT32, MESA_FORMAT_DEPTH_COMPONENT16, /*@}*/ /** * \name Floating point texture formats. */ /*@{*/ MESA_FORMAT_RGBA_FLOAT32, MESA_FORMAT_RGBA_FLOAT16, MESA_FORMAT_RGB_FLOAT32, MESA_FORMAT_RGB_FLOAT16, MESA_FORMAT_ALPHA_FLOAT32, MESA_FORMAT_ALPHA_FLOAT16, MESA_FORMAT_LUMINANCE_FLOAT32, MESA_FORMAT_LUMINANCE_FLOAT16, MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, MESA_FORMAT_INTENSITY_FLOAT32, MESA_FORMAT_INTENSITY_FLOAT16 /*@}*/ }; /** GLchan-valued formats */ /*@{*/ extern const struct gl_texture_format _mesa_texformat_rgba; extern const struct gl_texture_format _mesa_texformat_rgb; extern const struct gl_texture_format _mesa_texformat_alpha; extern const struct gl_texture_format _mesa_texformat_luminance; extern const struct gl_texture_format _mesa_texformat_luminance_alpha; extern const struct gl_texture_format _mesa_texformat_intensity; /*@}*/ /** Depth textures */ /*@{*/ extern const struct gl_texture_format _mesa_texformat_depth_component_float32; extern const struct gl_texture_format _mesa_texformat_depth_component16; /*@}*/ /** Floating point texture formats */ /*@{*/ extern const struct gl_texture_format _mesa_texformat_rgba_float32; extern const struct gl_texture_format _mesa_texformat_rgba_float16; extern const struct gl_texture_format _mesa_texformat_rgb_float32; extern const struct gl_texture_format _mesa_texformat_rgb_float16; extern const struct gl_texture_format _mesa_texformat_alpha_float32; extern const struct gl_texture_format _mesa_texformat_alpha_float16; extern const struct gl_texture_format _mesa_texformat_luminance_float32; extern const struct gl_texture_format _mesa_texformat_luminance_float16; extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float32; extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float16; extern const struct gl_texture_format _mesa_texformat_intensity_float32; extern const struct gl_texture_format _mesa_texformat_intensity_float16; /*@}*/ /** \name Assorted hardware-friendly formats */ /*@{*/ extern const struct gl_texture_format _mesa_texformat_rgba8888; extern const struct gl_texture_format _mesa_texformat_rgba8888_rev; extern const struct gl_texture_format _mesa_texformat_argb8888; extern const struct gl_texture_format _mesa_texformat_argb8888_rev; extern const struct gl_texture_format _mesa_texformat_rgb888; extern const struct gl_texture_format _mesa_texformat_bgr888; extern const struct gl_texture_format _mesa_texformat_rgb565; extern const struct gl_texture_format _mesa_texformat_rgb565_rev; extern const struct gl_texture_format _mesa_texformat_argb4444; extern const struct gl_texture_format _mesa_texformat_argb4444_rev; extern const struct gl_texture_format _mesa_texformat_argb1555; extern const struct gl_texture_format _mesa_texformat_argb1555_rev; extern const struct gl_texture_format _mesa_texformat_al88; extern const struct gl_texture_format _mesa_texformat_al88_rev; extern const struct gl_texture_format _mesa_texformat_rgb332; extern const struct gl_texture_format _mesa_texformat_a8; extern const struct gl_texture_format _mesa_texformat_l8; extern const struct gl_texture_format _mesa_texformat_i8; extern const struct gl_texture_format _mesa_texformat_ci8; /*@}*/ /** \name YCbCr formats */ /*@{*/ extern const struct gl_texture_format _mesa_texformat_ycbcr; extern const struct gl_texture_format _mesa_texformat_ycbcr_rev; /*@}*/ /** \name Compressed formats */ /*@{*/ extern const struct gl_texture_format _mesa_texformat_rgb_fxt1; extern const struct gl_texture_format _mesa_texformat_rgba_fxt1; extern const struct gl_texture_format _mesa_texformat_rgb_dxt1; extern const struct gl_texture_format _mesa_texformat_rgba_dxt1; extern const struct gl_texture_format _mesa_texformat_rgba_dxt3; extern const struct gl_texture_format _mesa_texformat_rgba_dxt5; /*@}*/ /** \name The null format */ /*@{*/ extern const struct gl_texture_format _mesa_null_texformat; /*@}*/ extern const struct gl_texture_format * _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texformat_tmp.h0000644000000000000000000017077413614532424021223 0ustar /* * Mesa 3-D graphics library * Version: 6.3.2 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file texformat_tmp.h * Texel fetch functions template. * * This template file is used by texformat.c to generate texel fetch functions * for 1-D, 2-D and 3-D texture images. * * It should be expanded by defining \p DIM as the number texture dimensions * (1, 2 or 3). According to the value of \p DIM a series of macros is defined * for the texel lookup in the gl_texture_image::Data. * * \sa texformat.c and FetchTexel. * * \author Gareth Hughes * \author Brian Paul */ #if DIM == 1 #define CHAN_ADDR( t, i, j, k, sz ) \ ((void) (j), (void) (k), \ ((GLchan *)(t)->Data + (i) * (sz))) #define UBYTE_ADDR( t, i, j, k, sz ) \ ((void) (j), (void) (k), \ ((GLubyte *)(t)->Data + (i) * (sz))) #define USHORT_ADDR( t, i, j, k ) \ ((void) (j), (void) (k), \ ((GLushort *)(t)->Data + (i))) #define UINT_ADDR( t, i, j, k ) \ ((void) (j), (void) (k), \ ((GLuint *)(t)->Data + (i))) #define FLOAT_ADDR( t, i, j, k, sz ) \ ((void) (j), (void) (k), \ ((GLfloat *)(t)->Data + (i) * (sz))) #define HALF_ADDR( t, i, j, k, sz ) \ ((void) (j), (void) (k), \ ((GLhalfARB *)(t)->Data + (i) * (sz))) #define FETCH(x) fetch_texel_1d_##x #elif DIM == 2 #define CHAN_ADDR( t, i, j, k, sz ) \ ((void) (k), \ ((GLchan *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))) #define UBYTE_ADDR( t, i, j, k, sz ) \ ((void) (k), \ ((GLubyte *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))) #define USHORT_ADDR( t, i, j, k ) \ ((void) (k), \ ((GLushort *)(t)->Data + ((t)->RowStride * (j) + (i)))) #define UINT_ADDR( t, i, j, k ) \ ((void) (k), \ ((GLuint *)(t)->Data + ((t)->RowStride * (j) + (i)))) #define FLOAT_ADDR( t, i, j, k, sz ) \ ((void) (k), \ ((GLfloat *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))) #define HALF_ADDR( t, i, j, k, sz ) \ ((void) (k), \ ((GLhalfARB *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz))) #define FETCH(x) fetch_texel_2d_##x #elif DIM == 3 #define CHAN_ADDR( t, i, j, k, sz ) \ (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \ (t)->RowStride + (i)) * (sz) #define UBYTE_ADDR( t, i, j, k, sz ) \ ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \ (t)->RowStride + (i)) * (sz)) #define USHORT_ADDR( t, i, j, k ) \ ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \ (t)->RowStride + (i))) #define UINT_ADDR( t, i, j, k ) \ ((GLuint *)(t)->Data + (((t)->Height * (k) + (j)) * \ (t)->RowStride + (i))) #define FLOAT_ADDR( t, i, j, k, sz ) \ ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \ (t)->RowStride + (i)) * (sz)) #define HALF_ADDR( t, i, j, k, sz ) \ ((GLhalfARB *)(t)->Data + (((t)->Height * (k) + (j)) * \ (t)->RowStride + (i)) * (sz)) #define FETCH(x) fetch_texel_3d_##x #else #error illegal number of texture dimensions #endif /* MESA_FORMAT_RGBA **********************************************************/ /* Fetch texel from 1D, 2D or 3D RGBA texture, returning 4 GLchans */ static void FETCH(rgba)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLchan *src = CHAN_ADDR( texImage, i, j, k, 4 ); COPY_CHAN4( texel, src ); } /* Fetch texel from 1D, 2D or 3D RGBA texture, returning 4 GLfloats */ static void FETCH(f_rgba)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLchan *src = CHAN_ADDR( texImage, i, j, k, 4 ); texel[RCOMP] = CHAN_TO_FLOAT(src[0]); texel[GCOMP] = CHAN_TO_FLOAT(src[1]); texel[BCOMP] = CHAN_TO_FLOAT(src[2]); texel[ACOMP] = CHAN_TO_FLOAT(src[3]); } #if DIM == 3 /* Store a GLchan RGBA texel */ static void store_texel_rgba(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLchan *rgba = (const GLchan *) texel; GLchan *dst = CHAN_ADDR(texImage, i, j, k, 4); dst[0] = rgba[RCOMP]; dst[1] = rgba[GCOMP]; dst[2] = rgba[BCOMP]; dst[3] = rgba[ACOMP]; } #endif /* MESA_FORMAT_RGB ***********************************************************/ /* Fetch texel from 1D, 2D or 3D RGB texture, returning 4 GLchans */ static void FETCH(rgb)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLchan *src = CHAN_ADDR( texImage, i, j, k, 3 ); texel[RCOMP] = src[0]; texel[GCOMP] = src[1]; texel[BCOMP] = src[2]; texel[ACOMP] = CHAN_MAX; } /* Fetch texel from 1D, 2D or 3D RGB texture, returning 4 GLfloats */ static void FETCH(f_rgb)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLchan *src = CHAN_ADDR( texImage, i, j, k, 3 ); texel[RCOMP] = CHAN_TO_FLOAT(src[0]); texel[GCOMP] = CHAN_TO_FLOAT(src[1]); texel[BCOMP] = CHAN_TO_FLOAT(src[2]); texel[ACOMP] = 1.0F; } #if DIM == 3 static void store_texel_rgb(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLchan *rgba = (const GLchan *) texel; GLchan *dst = CHAN_ADDR(texImage, i, j, k, 3); dst[0] = rgba[RCOMP]; dst[1] = rgba[GCOMP]; dst[2] = rgba[BCOMP]; } #endif /* MESA_FORMAT_ALPHA *********************************************************/ /* Fetch texel from 1D, 2D or 3D ALPHA texture, returning 4 GLchans */ static void FETCH(alpha)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLchan *src = CHAN_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = 0; texel[ACOMP] = src[0]; } /* Fetch texel from 1D, 2D or 3D ALPHA texture, returning 4 GLfloats */ static void FETCH(f_alpha)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLchan *src = CHAN_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = 0.0; texel[ACOMP] = CHAN_TO_FLOAT(src[0]); } #if DIM == 3 static void store_texel_alpha(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLchan *rgba = (const GLchan *) texel; GLchan *dst = CHAN_ADDR(texImage, i, j, k, 1); dst[0] = rgba[ACOMP]; } #endif /* MESA_FORMAT_LUMINANCE *****************************************************/ /* Fetch texel from 1D, 2D or 3D LUMIN texture, returning 4 GLchans */ static void FETCH(luminance)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLchan *src = CHAN_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = src[0]; texel[ACOMP] = CHAN_MAX; } /* Fetch texel from 1D, 2D or 3D LUMIN texture, returning 4 GLfloats */ static void FETCH(f_luminance)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLchan *src = CHAN_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = CHAN_TO_FLOAT(src[0]); texel[ACOMP] = 1.0F; } #if DIM == 3 static void store_texel_luminance(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLchan *rgba = (const GLchan *) texel; GLchan *dst = CHAN_ADDR(texImage, i, j, k, 1); dst[0] = rgba[RCOMP]; } #endif /* MESA_FORMAT_LUMINANCE_ALPHA ***********************************************/ /* Fetch texel from 1D, 2D or 3D L_A texture, returning 4 GLchans */ static void FETCH(luminance_alpha)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLchan *src = CHAN_ADDR( texImage, i, j, k, 2 ); texel[RCOMP] = src[0]; texel[GCOMP] = src[0]; texel[BCOMP] = src[0]; texel[ACOMP] = src[1]; } /* Fetch texel from 1D, 2D or 3D L_A texture, returning 4 GLfloats */ static void FETCH(f_luminance_alpha)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLchan *src = CHAN_ADDR( texImage, i, j, k, 2 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = CHAN_TO_FLOAT(src[0]); texel[ACOMP] = CHAN_TO_FLOAT(src[1]); } #if DIM == 3 static void store_texel_luminance_alpha(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLchan *rgba = (const GLchan *) texel; GLchan *dst = CHAN_ADDR(texImage, i, j, k, 2); dst[0] = rgba[RCOMP]; dst[1] = rgba[ACOMP]; } #endif /* MESA_FORMAT_INTENSITY *****************************************************/ /* Fetch texel from 1D, 2D or 3D INT. texture, returning 4 GLchans */ static void FETCH(intensity)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLchan *src = CHAN_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = src[0]; texel[GCOMP] = src[0]; texel[BCOMP] = src[0]; texel[ACOMP] = src[0]; } /* Fetch texel from 1D, 2D or 3D INT. texture, returning 4 GLfloats */ static void FETCH(f_intensity)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLchan *src = CHAN_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = texel[ACOMP] = CHAN_TO_FLOAT(src[0]); } #if DIM == 3 static void store_texel_intensity(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLchan *rgba = (const GLchan *) texel; GLchan *dst = CHAN_ADDR(texImage, i, j, k, 1); dst[0] = rgba[RCOMP]; } #endif /* MESA_FORMAT_DEPTH_COMPONENT_F32 *******************************************/ /* Fetch depth texel from 1D, 2D or 3D float32 DEPTH texture, * returning 1 GLfloat. * Note: no GLchan version of this function. */ static void FETCH(f_depth_component_f32)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 ); texel[0] = src[0]; } #if DIM == 3 static void store_texel_depth_component_f32(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLfloat *depth = (const GLfloat *) texel; GLfloat *dst = FLOAT_ADDR(texImage, i, j, k, 1); dst[0] = *depth; } #endif /* MESA_FORMAT_DEPTH_COMPONENT16 *********************************************/ /* Fetch depth texel from 1D, 2D or 3D float32 DEPTH texture, * returning 1 GLfloat. * Note: no GLchan version of this function. */ static void FETCH(f_depth_component16)(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src = USHORT_ADDR( texImage, i, j, k ); texel[0] = src[0] * (1.0F / 65535.0F); } #if DIM == 3 static void store_texel_depth_component16(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLushort *depth = (const GLushort *) texel; GLushort *dst = USHORT_ADDR(texImage, i, j, k); dst[0] = *depth; } #endif /* MESA_FORMAT_RGBA_F32 ******************************************************/ /* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLchans. */ static void FETCH(rgba_f32)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 4 ); UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]); UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], src[1]); UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], src[2]); UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[3]); } /* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLfloats. */ static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 4 ); texel[RCOMP] = src[0]; texel[GCOMP] = src[1]; texel[BCOMP] = src[2]; texel[ACOMP] = src[3]; } #if DIM == 3 static void store_texel_rgba_f32(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLfloat *depth = (const GLfloat *) texel; GLfloat *dst = FLOAT_ADDR(texImage, i, j, k, 1); dst[0] = depth[RCOMP]; dst[1] = depth[GCOMP]; dst[2] = depth[BCOMP]; dst[3] = depth[ACOMP]; } #endif /* MESA_FORMAT_RGBA_F16 ******************************************************/ /* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture, * returning 4 GLchans. */ static void FETCH(rgba_f16)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 4 ); UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0])); UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], _mesa_half_to_float(src[1])); UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], _mesa_half_to_float(src[2])); UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[3])); } /* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture, * returning 4 GLfloats. */ static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 4 ); texel[RCOMP] = _mesa_half_to_float(src[0]); texel[GCOMP] = _mesa_half_to_float(src[1]); texel[BCOMP] = _mesa_half_to_float(src[2]); texel[ACOMP] = _mesa_half_to_float(src[3]); } #if DIM == 3 static void store_texel_rgba_f16(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLfloat *depth = (const GLfloat *) texel; GLhalfARB *dst = HALF_ADDR(texImage, i, j, k, 1); dst[0] = _mesa_float_to_half(*depth); } #endif /* MESA_FORMAT_RGB_F32 *******************************************************/ /* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture, * returning 4 GLchans. */ static void FETCH(rgb_f32)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 3 ); UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]); UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], src[1]); UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], src[2]); texel[ACOMP] = CHAN_MAX; } /* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture, * returning 4 GLfloats. */ static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 3 ); texel[RCOMP] = src[0]; texel[GCOMP] = src[1]; texel[BCOMP] = src[2]; texel[ACOMP] = 1.0F; } #if DIM == 3 static void store_texel_rgb_f32(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLfloat *depth = (const GLfloat *) texel; GLfloat *dst = FLOAT_ADDR(texImage, i, j, k, 1); dst[0] = *depth; } #endif /* MESA_FORAMT_RGB_F16 *******************************************************/ /* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture, * returning 4 GLchans. */ static void FETCH(rgb_f16)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 3 ); UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0])); UNCLAMPED_FLOAT_TO_CHAN(texel[GCOMP], _mesa_half_to_float(src[1])); UNCLAMPED_FLOAT_TO_CHAN(texel[BCOMP], _mesa_half_to_float(src[2])); texel[ACOMP] = CHAN_MAX; } /* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture, * returning 4 GLfloats. */ static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 3 ); texel[RCOMP] = _mesa_half_to_float(src[0]); texel[GCOMP] = _mesa_half_to_float(src[1]); texel[BCOMP] = _mesa_half_to_float(src[2]); texel[ACOMP] = 1.0F; } #if DIM == 3 static void store_texel_rgb_f16(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLfloat *depth = (const GLfloat *) texel; GLhalfARB *dst = HALF_ADDR(texImage, i, j, k, 1); dst[0] = _mesa_float_to_half(*depth); } #endif /* MESA_FORMAT_ALPHA_F32 *****************************************************/ /* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture, * returning 4 GLchans. */ static void FETCH(alpha_f32)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = 0; UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[0]); } /* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture, * returning 4 GLfloats. */ static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = 0.0F; texel[ACOMP] = src[0]; } #if DIM == 3 static void store_texel_alpha_f32(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLfloat *rgba = (const GLfloat *) texel; GLfloat *dst = FLOAT_ADDR(texImage, i, j, k, 1); dst[0] = rgba[ACOMP]; } #endif /* MESA_FORMAT_ALPHA_F32 *****************************************************/ /* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture, * returning 4 GLchans. */ static void FETCH(alpha_f16)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = 0; UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[0])); } /* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture, * returning 4 GLfloats. */ static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = 0.0F; texel[ACOMP] = _mesa_half_to_float(src[0]); } #if DIM == 3 static void store_texel_alpha_f16(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLfloat *rgba = (const GLfloat *) texel; GLhalfARB *dst = HALF_ADDR(texImage, i, j, k, 1); dst[0] = _mesa_float_to_half(rgba[ACOMP]); } #endif /* MESA_FORMAT_LUMINANCE_F32 *************************************************/ /* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture, * returning 4 GLchans. */ static void FETCH(luminance_f32)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 ); UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]); texel[GCOMP] = texel[BCOMP] = texel[RCOMP]; texel[ACOMP] = CHAN_MAX; } /* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture, * returning 4 GLfloats. */ static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = src[0]; texel[ACOMP] = 1.0F; } #if DIM == 3 static void store_texel_luminance_f32(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLfloat *rgba = (const GLfloat *) texel; GLfloat *dst = FLOAT_ADDR(texImage, i, j, k, 1); dst[0] = rgba[RCOMP]; } #endif /* MESA_FORMAT_LUMINANCE_F16 *************************************************/ /* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture, * returning 4 GLchans. */ static void FETCH(luminance_f16)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 1 ); UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0])); texel[GCOMP] = texel[BCOMP] = texel[RCOMP]; texel[ACOMP] = CHAN_MAX; } /* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture, * returning 4 GLfloats. */ static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = _mesa_half_to_float(src[0]); texel[ACOMP] = 1.0F; } #if DIM == 3 static void store_texel_luminance_f16(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLfloat *rgba = (const GLfloat *) texel; GLhalfARB *dst = HALF_ADDR(texImage, i, j, k, 1); dst[0] = _mesa_float_to_half(rgba[RCOMP]); } #endif /* MESA_FORMAT_LUMINANCE_ALPHA_F32 *******************************************/ /* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture, * returning 4 GLchans. */ static void FETCH(luminance_alpha_f32)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 2 ); UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]); texel[GCOMP] = texel[BCOMP] = texel[RCOMP]; UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], src[1]); } /* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture, * returning 4 GLfloats. */ static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 2 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = src[0]; texel[ACOMP] = src[1]; } #if DIM == 3 static void store_texel_luminance_alpha_f32(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLfloat *rgba = (const GLfloat *) texel; GLfloat *dst = FLOAT_ADDR(texImage, i, j, k, 2); dst[0] = rgba[RCOMP]; dst[1] = rgba[ACOMP]; } #endif /* MESA_FORMAT_LUMINANCE_ALPHA_F16 *******************************************/ /* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture, * returning 4 GLfloats. */ static void FETCH(luminance_alpha_f16)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 2 ); UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0])); texel[GCOMP] = texel[BCOMP] = texel[RCOMP]; UNCLAMPED_FLOAT_TO_CHAN(texel[ACOMP], _mesa_half_to_float(src[1])); } /* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture, * returning 4 GLfloats. */ static void FETCH(f_luminance_alpha_f16)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 2 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = _mesa_half_to_float(src[0]); texel[ACOMP] = _mesa_half_to_float(src[1]); } #if DIM == 3 static void store_texel_luminance_alpha_f16(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLfloat *rgba = (const GLfloat *) texel; GLhalfARB *dst = HALF_ADDR(texImage, i, j, k, 2); dst[0] = _mesa_float_to_half(rgba[RCOMP]); dst[1] = _mesa_float_to_half(rgba[ACOMP]); } #endif /* MESA_FORMAT_INTENSITY_F32 *************************************************/ /* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture, * returning 4 GLchans. */ static void FETCH(intensity_f32)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 ); UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], src[0]); texel[GCOMP] = texel[BCOMP] = texel[ACOMP] = texel[RCOMP]; } /* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture, * returning 4 GLfloats. */ static void FETCH(f_intensity_f32)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLfloat *src = FLOAT_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = texel[ACOMP] = src[0]; } #if DIM == 3 static void store_texel_intensity_f32(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLfloat *rgba = (const GLfloat *) texel; GLfloat *dst = FLOAT_ADDR(texImage, i, j, k, 1); dst[0] = rgba[RCOMP]; } #endif /* MESA_FORMAT_INTENSITY_F16 *************************************************/ /* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture, * returning 4 GLchans. */ static void FETCH(intensity_f16)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 1 ); UNCLAMPED_FLOAT_TO_CHAN(texel[RCOMP], _mesa_half_to_float(src[0])); texel[GCOMP] = texel[BCOMP] = texel[ACOMP] = texel[RCOMP]; } /* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture, * returning 4 GLfloats. */ static void FETCH(f_intensity_f16)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLhalfARB *src = HALF_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = texel[ACOMP] = _mesa_half_to_float(src[0]); } #if DIM == 3 static void store_texel_intensity_f16(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLfloat *rgba = (const GLfloat *) texel; GLhalfARB *dst = HALF_ADDR(texImage, i, j, k, 1); dst[0] = _mesa_float_to_half(rgba[RCOMP]); } #endif /* * Begin Hardware formats */ /* MESA_FORMAT_RGBA8888 ******************************************************/ /* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLchans */ static void FETCH(rgba8888)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLuint s = *UINT_ADDR( texImage, i, j, k ); texel[RCOMP] = UBYTE_TO_CHAN( (s >> 24) ); texel[GCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff ); texel[BCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff ); texel[ACOMP] = UBYTE_TO_CHAN( (s ) & 0xff ); } /* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */ static void FETCH(f_rgba8888)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLuint s = *UINT_ADDR( texImage, i, j, k ); texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 24) ); texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); } #if DIM == 3 static void store_texel_rgba8888(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLuint *dst = UINT_ADDR(texImage, i, j, k); *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]); } #endif /* MESA_FORMAT_RGBA888_REV ***************************************************/ /* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */ static void FETCH(rgba8888_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLuint s = *UINT_ADDR( texImage, i, j, k ); texel[RCOMP] = UBYTE_TO_CHAN( (s ) & 0xff ); texel[GCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff ); texel[BCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff ); texel[ACOMP] = UBYTE_TO_CHAN( (s >> 24) ); } /* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLfloats */ static void FETCH(f_rgba8888_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLuint s = *UINT_ADDR( texImage, i, j, k ); texel[RCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) ); } #if DIM == 3 static void store_texel_rgba8888_rev(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLuint *dst = UINT_ADDR(texImage, i, j, k); *dst = PACK_COLOR_8888_REV(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]); } #endif /* MESA_FORMAT_ARGB8888 ******************************************************/ /* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */ static void FETCH(argb8888)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLuint s = *UINT_ADDR( texImage, i, j, k ); texel[RCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff ); texel[GCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff ); texel[BCOMP] = UBYTE_TO_CHAN( (s ) & 0xff ); texel[ACOMP] = UBYTE_TO_CHAN( (s >> 24) ); } /* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLfloats */ static void FETCH(f_argb8888)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLuint s = *UINT_ADDR( texImage, i, j, k ); texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); texel[BCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) ); } #if DIM == 3 static void store_texel_argb8888(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLuint *dst = UINT_ADDR(texImage, i, j, k); *dst = PACK_COLOR_8888(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); } #endif /* MESA_FORMAT_ARGB8888_REV **************************************************/ /* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLchans */ static void FETCH(argb8888_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLuint s = *UINT_ADDR( texImage, i, j, k ); texel[RCOMP] = UBYTE_TO_CHAN( (s >> 8) & 0xff ); texel[GCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff ); texel[BCOMP] = UBYTE_TO_CHAN( (s >> 24) ); texel[ACOMP] = UBYTE_TO_CHAN( (s ) & 0xff ); } /* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */ static void FETCH(f_argb8888_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLuint s = *UINT_ADDR( texImage, i, j, k ); texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 24) ); texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); } #if DIM == 3 static void store_texel_argb8888_rev(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLuint *dst = UINT_ADDR(texImage, i, j, k); *dst = PACK_COLOR_8888(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); } #endif /* MESA_FORMAT_RGB888 ********************************************************/ /* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */ static void FETCH(rgb888)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 3 ); texel[RCOMP] = UBYTE_TO_CHAN( src[2] ); texel[GCOMP] = UBYTE_TO_CHAN( src[1] ); texel[BCOMP] = UBYTE_TO_CHAN( src[0] ); texel[ACOMP] = CHAN_MAX; } /* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLfloats */ static void FETCH(f_rgb888)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 3 ); texel[RCOMP] = UBYTE_TO_FLOAT( src[2] ); texel[GCOMP] = UBYTE_TO_FLOAT( src[1] ); texel[BCOMP] = UBYTE_TO_FLOAT( src[0] ); texel[ACOMP] = 1.0F; } #if DIM == 3 static void store_texel_rgb888(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLubyte *dst = UBYTE_ADDR(texImage, i, j, k, 3); dst[0] = rgba[RCOMP]; dst[1] = rgba[GCOMP]; dst[2] = rgba[BCOMP]; } #endif /* MESA_FORMAT_BGR888 ********************************************************/ /* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */ static void FETCH(bgr888)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 3 ); texel[RCOMP] = UBYTE_TO_CHAN( src[0] ); texel[GCOMP] = UBYTE_TO_CHAN( src[1] ); texel[BCOMP] = UBYTE_TO_CHAN( src[2] ); texel[ACOMP] = CHAN_MAX; } /* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLfloats */ static void FETCH(f_bgr888)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 3 ); texel[RCOMP] = UBYTE_TO_FLOAT( src[0] ); texel[GCOMP] = UBYTE_TO_FLOAT( src[1] ); texel[BCOMP] = UBYTE_TO_FLOAT( src[2] ); texel[ACOMP] = 1.0F; } #if DIM == 3 static void store_texel_bgr888(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLubyte *dst = UBYTE_ADDR(texImage, i, j, k, 3); dst[0] = rgba[BCOMP]; dst[1] = rgba[GCOMP]; dst[2] = rgba[RCOMP]; } #endif /* use color expansion like (g << 2) | (g >> 4) (does somewhat random rounding) instead of slow (g << 2) * 255 / 252 (always rounds down) */ /* MESA_FORMAT_RGB565 ********************************************************/ /* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */ static void FETCH(rgb565)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLushort *src = USHORT_ADDR( texImage, i, j, k ); const GLushort s = *src; texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) ); texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) | ((s >> 9) & 0x3) ); texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); texel[ACOMP] = CHAN_MAX; } /* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLfloats */ static void FETCH(f_rgb565)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src = USHORT_ADDR( texImage, i, j, k ); const GLushort s = *src; texel[RCOMP] = ((s >> 8) & 0xf8) * (1.0F / 248.0F); texel[GCOMP] = ((s >> 3) & 0xfc) * (1.0F / 252.0F); texel[BCOMP] = ((s << 3) & 0xf8) * (1.0F / 248.0F); texel[ACOMP] = 1.0F; } #if DIM == 3 static void store_texel_rgb565(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLushort *dst = USHORT_ADDR(texImage, i, j, k); *dst = PACK_COLOR_565(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); } #endif /* MESA_FORMAT_RGB565_REV ****************************************************/ /* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */ static void FETCH(rgb565_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLushort *src = USHORT_ADDR( texImage, i, j, k ); const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */ texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) ); texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) | ((s >> 9) & 0x3) ); texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); texel[ACOMP] = CHAN_MAX; } /* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLfloats */ static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src = USHORT_ADDR( texImage, i, j, k ); const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */ texel[RCOMP] = ((s >> 8) & 0xf8) * (1.0F / 248.0F); texel[GCOMP] = ((s >> 3) & 0xfc) * (1.0F / 252.0F); texel[BCOMP] = ((s << 3) & 0xf8) * (1.0F / 248.0F); texel[ACOMP] = 1.0F; } #if DIM == 3 static void store_texel_rgb565_rev(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLushort *dst = USHORT_ADDR(texImage, i, j, k); *dst = PACK_COLOR_565(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]); } #endif /* MESA_FORMAT_ARGB4444 ******************************************************/ /* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */ static void FETCH(argb4444)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLushort *src = USHORT_ADDR( texImage, i, j, k ); const GLushort s = *src; texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) | ((s >> 4) & 0xf0) ); texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) | ((s ) & 0xf0) ); texel[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) | ((s << 4) & 0xf0) ); texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) | ((s >> 8) & 0xf0) ); } /* Fetch texel from 1D, 2D or 3D argb4444 texture, return 4 GLfloats */ static void FETCH(f_argb4444)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src = USHORT_ADDR( texImage, i, j, k ); const GLushort s = *src; texel[RCOMP] = ((s >> 8) & 0xf) * (1.0F / 15.0F); texel[GCOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F); texel[BCOMP] = ((s ) & 0xf) * (1.0F / 15.0F); texel[ACOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F); } #if DIM == 3 static void store_texel_argb4444(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLushort *dst = USHORT_ADDR(texImage, i, j, k); *dst = PACK_COLOR_4444(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]); } #endif /* MESA_FORMAT_ARGB4444_REV **************************************************/ /* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */ static void FETCH(argb4444_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLushort s = *USHORT_ADDR( texImage, i, j, k ); texel[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) | ((s << 4) & 0xf0) ); texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) | ((s >> 8) & 0xf0) ); texel[BCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) | ((s >> 4) & 0xf0) ); texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) | ((s ) & 0xf0) ); } /* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLfloats */ static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort s = *USHORT_ADDR( texImage, i, j, k ); texel[RCOMP] = ((s ) & 0xf) * (1.0F / 15.0F); texel[GCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F); texel[BCOMP] = ((s >> 8) & 0xf) * (1.0F / 15.0F); texel[ACOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F); } #if DIM == 3 static void store_texel_argb4444_rev(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLushort *dst = USHORT_ADDR(texImage, i, j, k); *dst = PACK_COLOR_4444(rgba[ACOMP], rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]); } #endif /* MESA_FORMAT_ARGB1555 ******************************************************/ /* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */ static void FETCH(argb1555)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLushort *src = USHORT_ADDR( texImage, i, j, k ); const GLushort s = *src; texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 7) & 0xf8) | ((s >> 12) & 0x7) ); texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 2) & 0xf8) | ((s >> 7) & 0x7) ); texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 ); } /* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLfloats */ static void FETCH(f_argb1555)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src = USHORT_ADDR( texImage, i, j, k ); const GLushort s = *src; texel[RCOMP] = ((s >> 10) & 0x1f) * (1.0F / 31.0F); texel[GCOMP] = ((s >> 5) & 0x1f) * (1.0F / 31.0F); texel[BCOMP] = ((s ) & 0x1f) * (1.0F / 31.0F); texel[ACOMP] = ((s >> 15) & 0x01); } #if DIM == 3 static void store_texel_argb1555(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLushort *dst = USHORT_ADDR(texImage, i, j, k); *dst = PACK_COLOR_1555(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); } #endif /* MESA_FORMAT_ARGB1555_REV **************************************************/ /* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */ static void FETCH(argb1555_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLushort *src = USHORT_ADDR( texImage, i, j, k ); const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */ texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 7) & 0xf8) | ((s >> 12) & 0x7) ); texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 2) & 0xf8) | ((s >> 7) & 0x7) ); texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >> 2) & 0x7) ); texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 ); } /* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLfloats */ static void FETCH(f_argb1555_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src = USHORT_ADDR( texImage, i, j, k ); const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */ texel[RCOMP] = ((s >> 10) & 0x1f) * (1.0F / 31.0F); texel[GCOMP] = ((s >> 5) & 0x1f) * (1.0F / 31.0F); texel[BCOMP] = ((s ) & 0x1f) * (1.0F / 31.0F); texel[ACOMP] = ((s >> 15) & 0x01); } #if DIM == 3 static void store_texel_argb1555_rev(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLushort *dst = USHORT_ADDR(texImage, i, j, k); *dst = PACK_COLOR_1555_REV(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); } #endif /* MESA_FORMAT_AL88 **********************************************************/ /* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */ static void FETCH(al88)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLushort s = *USHORT_ADDR( texImage, i, j, k ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = UBYTE_TO_CHAN( s & 0xff ); texel[ACOMP] = UBYTE_TO_CHAN( s >> 8 ); } /* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLfloats */ static void FETCH(f_al88)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort s = *USHORT_ADDR( texImage, i, j, k ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = UBYTE_TO_FLOAT( s & 0xff ); texel[ACOMP] = UBYTE_TO_FLOAT( s >> 8 ); } #if DIM == 3 static void store_texel_al88(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLushort *dst = USHORT_ADDR(texImage, i, j, k); *dst = PACK_COLOR_88(rgba[ACOMP], rgba[RCOMP]); } #endif /* MESA_FORMAT_AL88_REV ******************************************************/ /* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */ static void FETCH(al88_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLushort s = *USHORT_ADDR( texImage, i, j, k ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = UBYTE_TO_CHAN( s >> 8 ); texel[ACOMP] = UBYTE_TO_CHAN( s & 0xff ); } /* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLfloats */ static void FETCH(f_al88_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort s = *USHORT_ADDR( texImage, i, j, k ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = UBYTE_TO_FLOAT( s >> 8 ); texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff ); } #if DIM == 3 static void store_texel_al88_rev(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLushort *dst = USHORT_ADDR(texImage, i, j, k); *dst = PACK_COLOR_88(rgba[RCOMP], rgba[ACOMP]); } #endif /* MESA_FORMAT_RGB332 ********************************************************/ /* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */ static void FETCH(rgb332)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { static const GLubyte lut2to8[4] = {0, 85, 170, 255}; static const GLubyte lut3to8[8] = {0, 36, 73, 109, 146, 182, 219, 255}; const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); const GLubyte s = *src; texel[RCOMP] = UBYTE_TO_CHAN( lut3to8[(s >> 5) & 0x7] ); texel[GCOMP] = UBYTE_TO_CHAN( lut3to8[(s >> 2) & 0x7] ); texel[BCOMP] = UBYTE_TO_CHAN( lut2to8[(s ) & 0x3] ); texel[ACOMP] = CHAN_MAX; } /* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLfloats */ static void FETCH(f_rgb332)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); const GLubyte s = *src; texel[RCOMP] = ((s ) & 0xe0) * (1.0F / 224.0F); texel[GCOMP] = ((s << 3) & 0xe0) * (1.0F / 224.0F); texel[BCOMP] = ((s << 6) & 0xc0) * (1.0F / 192.0F); texel[ACOMP] = 1.0F; } #if DIM == 3 static void store_texel_rgb332(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLubyte *dst = UBYTE_ADDR(texImage, i, j, k, 1); *dst = PACK_COLOR_332(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); } #endif /* MESA_FORMAT_A8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */ static void FETCH(a8)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = 0; texel[ACOMP] = UBYTE_TO_CHAN( src[0] ); } /* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLfloats */ static void FETCH(f_a8)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = 0.0; texel[ACOMP] = UBYTE_TO_FLOAT( src[0] ); } #if DIM == 3 static void store_texel_a8(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLubyte *dst = UBYTE_ADDR(texImage, i, j, k, 1); *dst = rgba[ACOMP]; } #endif /* MESA_FORMAT_L8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */ static void FETCH(l8)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = UBYTE_TO_CHAN( src[0] ); texel[ACOMP] = CHAN_MAX; } /* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLfloats */ static void FETCH(f_l8)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = UBYTE_TO_FLOAT( src[0] ); texel[ACOMP] = 1.0F; } #if DIM == 3 static void store_texel_l8(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLubyte *dst = UBYTE_ADDR(texImage, i, j, k, 1); *dst = rgba[RCOMP]; } #endif /* MESA_FORMAT_I8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */ static void FETCH(i8)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = texel[ACOMP] = UBYTE_TO_CHAN( src[0] ); } /* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLfloats */ static void FETCH(f_i8)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = texel[ACOMP] = UBYTE_TO_FLOAT( src[0] ); } #if DIM == 3 static void store_texel_i8(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; GLubyte *dst = UBYTE_ADDR(texImage, i, j, k, 1); *dst = rgba[RCOMP]; } #endif /* MESA_FORMAT_CI8 ***********************************************************/ /* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a * color table, and return 4 GLchans. */ static void FETCH(ci8)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLubyte *src = UBYTE_ADDR( texImage, i, j, k, 1 ); const struct gl_color_table *palette; const GLchan *table; GLuint index; GET_CURRENT_CONTEXT(ctx); if (ctx->Texture.SharedPalette) { palette = &ctx->Texture.Palette; } else { palette = &texImage->TexObject->Palette; } if (palette->Size == 0) return; /* undefined results */ ASSERT(palette->Type != GL_FLOAT); table = (const GLchan *) palette->Table; /* Mask the index against size of palette to avoid going out of bounds */ index = (*src) & (palette->Size - 1); switch (palette->Format) { case GL_ALPHA: texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = 0; texel[ACOMP] = table[index]; return; case GL_LUMINANCE: texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = table[index]; texel[ACOMP] = CHAN_MAX; break; case GL_INTENSITY: texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = texel[ACOMP] = table[index]; return; case GL_LUMINANCE_ALPHA: texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = table[index * 2 + 0]; texel[ACOMP] = table[index * 2 + 1]; return; case GL_RGB: texel[RCOMP] = table[index * 3 + 0]; texel[GCOMP] = table[index * 3 + 1]; texel[BCOMP] = table[index * 3 + 2]; texel[ACOMP] = CHAN_MAX; return; case GL_RGBA: texel[RCOMP] = table[index * 4 + 0]; texel[GCOMP] = table[index * 4 + 1]; texel[BCOMP] = table[index * 4 + 2]; texel[ACOMP] = table[index * 4 + 3]; return; default: _mesa_problem(ctx, "Bad palette format in palette_sample"); } } /* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a * color table, and return 4 GLfloats. */ static void FETCH(f_ci8)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { GLchan rgba[4]; /* Sample as GLchan */ FETCH(ci8)(texImage, i, j, k, rgba); /* and return as floats */ texel[RCOMP] = CHAN_TO_FLOAT(rgba[RCOMP]); texel[GCOMP] = CHAN_TO_FLOAT(rgba[GCOMP]); texel[BCOMP] = CHAN_TO_FLOAT(rgba[BCOMP]); texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); } #if DIM == 3 static void store_texel_ci8(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *index = (const GLubyte *) texel; GLubyte *dst = UBYTE_ADDR(texImage, i, j, k, 1); *dst = *index; } #endif /* MESA_FORMAT_YCBCR *********************************************************/ /* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLchans */ /* We convert YCbCr to RGB here */ /* XXX this may break if GLchan != GLubyte */ static void FETCH(ycbcr)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLushort *src0 = USHORT_ADDR( texImage, (i & ~1), j, k ); /* even */ const GLushort *src1 = src0 + 1; /* odd */ const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */ const GLubyte cb = *src0 & 0xff; /* chroma U */ const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */ const GLubyte cr = *src1 & 0xff; /* chroma V */ GLint r, g, b; if (i & 1) { /* odd pixel: use y1,cr,cb */ r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128)); g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128)); } else { /* even pixel: use y0,cr,cb */ r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128)); g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128)); } texel[RCOMP] = CLAMP(r, 0, CHAN_MAX); texel[GCOMP] = CLAMP(g, 0, CHAN_MAX); texel[BCOMP] = CLAMP(b, 0, CHAN_MAX); texel[ACOMP] = CHAN_MAX; } /* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLfloats */ /* We convert YCbCr to RGB here */ static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src0 = USHORT_ADDR( texImage, (i & ~1), j, k ); /* even */ const GLushort *src1 = src0 + 1; /* odd */ const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */ const GLubyte cb = *src0 & 0xff; /* chroma U */ const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */ const GLubyte cr = *src1 & 0xff; /* chroma V */ GLfloat r, g, b; if (i & 1) { /* odd pixel: use y1,cr,cb */ r = (1.164 * (y1-16) + 1.596 * (cr-128)); g = (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); b = (1.164 * (y1-16) + 2.018 * (cb-128)); } else { /* even pixel: use y0,cr,cb */ r = (1.164 * (y0-16) + 1.596 * (cr-128)); g = (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); b = (1.164 * (y0-16) + 2.018 * (cb-128)); } /* XXX remove / 255 here by tweaking arithmetic above */ r /= 255.0; g /= 255.0; b /= 255.0; /* XXX should we really clamp??? */ texel[RCOMP] = CLAMP(r, 0.0, 1.0); texel[GCOMP] = CLAMP(g, 0.0, 1.0); texel[BCOMP] = CLAMP(b, 0.0, 1.0); texel[ACOMP] = 1.0F; } #if DIM == 3 static void store_texel_ycbcr(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { /* XXX to do */ } #endif /* MESA_FORMAT_YCBCR_REV *****************************************************/ /* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLchans */ /* We convert YCbCr to RGB here */ /* XXX this may break if GLchan != GLubyte */ static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texel ) { const GLushort *src0 = USHORT_ADDR( texImage, (i & ~1), j, k ); /* even */ const GLushort *src1 = src0 + 1; /* odd */ const GLubyte y0 = *src0 & 0xff; /* luminance */ const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */ const GLubyte y1 = *src1 & 0xff; /* luminance */ const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */ GLint r, g, b; if (i & 1) { /* odd pixel: use y1,cr,cb */ r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128)); g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128)); } else { /* even pixel: use y0,cr,cb */ r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128)); g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128)); } texel[RCOMP] = CLAMP(r, 0, CHAN_MAX); texel[GCOMP] = CLAMP(g, 0, CHAN_MAX); texel[BCOMP] = CLAMP(b, 0, CHAN_MAX); texel[ACOMP] = CHAN_MAX; } /* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats */ /* We convert YCbCr to RGB here */ static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { const GLushort *src0 = USHORT_ADDR( texImage, (i & ~1), j, k ); /* even */ const GLushort *src1 = src0 + 1; /* odd */ const GLubyte y0 = *src0 & 0xff; /* luminance */ const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */ const GLubyte y1 = *src1 & 0xff; /* luminance */ const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */ GLfloat r, g, b; if (i & 1) { /* odd pixel: use y1,cr,cb */ r = (1.164 * (y1-16) + 1.596 * (cr-128)); g = (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); b = (1.164 * (y1-16) + 2.018 * (cb-128)); } else { /* even pixel: use y0,cr,cb */ r = (1.164 * (y0-16) + 1.596 * (cr-128)); g = (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); b = (1.164 * (y0-16) + 2.018 * (cb-128)); } /* XXX remove / 255 here by tweaking arithmetic above */ r /= 255.0; g /= 255.0; b /= 255.0; /* XXX should we really clamp??? */ texel[RCOMP] = CLAMP(r, 0.0, 1.0); texel[GCOMP] = CLAMP(g, 0.0, 1.0); texel[BCOMP] = CLAMP(b, 0.0, 1.0); texel[ACOMP] = 1.0F; } #if DIM == 3 static void store_texel_ycbcr_rev(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { /* XXX to do */ } #endif #undef CHAN_ADDR #undef UBYTE_ADDR #undef USHORT_ADDR #undef UINT_ADDR #undef FLOAT_ADDR #undef HALF_ADDR #undef FETCH #undef DIM nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/teximage.c0000644000000000000000000033117113614532424020116 0ustar /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file teximage.c * Texture images manipulation functions. * * \note Mesa's native texture data type is GLchan. Native formats are * GL_ALPHA, GL_LUMINANCE, GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, GL_RGBA, and * GL_COLOR_INDEX. * * \note Device drivers are free to implement any internal format they want. */ #include "glheader.h" #include "bufferobj.h" #include "context.h" #include "convolve.h" #include "image.h" #include "imports.h" #include "macros.h" #include "state.h" #include "texcompress.h" #include "texformat.h" #include "teximage.h" #include "texstate.h" #include "texstore.h" #include "mtypes.h" /** * We allocate texture memory on 512-byte boundaries so we can use MMX/SSE * elsewhere. */ void * _mesa_alloc_texmemory(GLsizei bytes) { return _mesa_align_malloc(bytes, 512); } /** * Free texture memory allocated with _mesa_alloc_texmemory() */ void _mesa_free_texmemory(void *m) { _mesa_align_free(m); } #if 0 static void PrintTexture(GLcontext *ctx, const struct gl_texture_image *img) { #if CHAN_TYPE == GL_FLOAT _mesa_problem(NULL, "PrintTexture doesn't support float channels"); #else GLuint i, j, c; const GLchan *data = (const GLchan *) img->Data; if (!data) { _mesa_printf("No texture data\n"); return; } switch (img->Format) { case GL_ALPHA: case GL_LUMINANCE: case GL_INTENSITY: case GL_COLOR_INDEX: c = 1; break; case GL_LUMINANCE_ALPHA: c = 2; break; case GL_RGB: c = 3; break; case GL_RGBA: c = 4; break; default: _mesa_problem(NULL, "error in PrintTexture\n"); return; } for (i = 0; i < img->Height; i++) { for (j = 0; j < img->Width; j++) { if (c==1) _mesa_printf("%02x ", data[0]); else if (c==2) _mesa_printf("%02x%02x ", data[0], data[1]); else if (c==3) _mesa_printf("%02x%02x%02x ", data[0], data[1], data[2]); else if (c==4) _mesa_printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); data += (img->RowStride - img->Width) * c; } _mesa_printf("\n"); } #endif } #endif /* * Compute floor(log_base_2(n)). * If n < 0 return -1. */ static int logbase2( int n ) { GLint i = 1; GLint log2 = 0; if (n < 0) return -1; if (n == 0) return 0; while ( n > i ) { i *= 2; log2++; } if (i != n) { return log2 - 1; } else { return log2; } } /** * Return the simple base format for a given internal texture format. * For example, given GL_LUMINANCE12_ALPHA4, return GL_LUMINANCE_ALPHA. * * \param ctx GL context. * \param internalFormat the internal texture format token or 1, 2, 3, or 4. * * \return the corresponding \u base internal format (GL_ALPHA, GL_LUMINANCE, * GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA), or -1 if invalid enum. * * This is the format which is used during texture application (i.e. the * texture format and env mode determine the arithmetic used. */ GLint _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat ) { switch (internalFormat) { case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8: case GL_ALPHA12: case GL_ALPHA16: return GL_ALPHA; case 1: case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8: case GL_LUMINANCE12: case GL_LUMINANCE16: return GL_LUMINANCE; case 2: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE6_ALPHA2: case GL_LUMINANCE8_ALPHA8: case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: return GL_LUMINANCE_ALPHA; case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: return GL_INTENSITY; case 3: case GL_RGB: case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: return GL_RGB; case 4: case GL_RGBA: case GL_RGBA2: case GL_RGBA4: case GL_RGB5_A1: case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: return GL_RGBA; default: ; /* fallthrough */ } if (ctx->Extensions.EXT_paletted_texture) { switch (internalFormat) { case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: case GL_COLOR_INDEX2_EXT: case GL_COLOR_INDEX4_EXT: case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: return GL_COLOR_INDEX; default: ; /* fallthrough */ } } if (ctx->Extensions.SGIX_depth_texture || ctx->Extensions.ARB_depth_texture) { switch (internalFormat) { case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16_SGIX: case GL_DEPTH_COMPONENT24_SGIX: case GL_DEPTH_COMPONENT32_SGIX: return GL_DEPTH_COMPONENT; default: ; /* fallthrough */ } } if (ctx->Extensions.ARB_texture_compression) { switch (internalFormat) { case GL_COMPRESSED_ALPHA: return GL_ALPHA; case GL_COMPRESSED_LUMINANCE: return GL_LUMINANCE; case GL_COMPRESSED_LUMINANCE_ALPHA: return GL_LUMINANCE_ALPHA; case GL_COMPRESSED_INTENSITY: return GL_INTENSITY; case GL_COMPRESSED_RGB: return GL_RGB; case GL_COMPRESSED_RGBA: return GL_RGBA; default: ; /* fallthrough */ } } if (ctx->Extensions.TDFX_texture_compression_FXT1) { switch (internalFormat) { case GL_COMPRESSED_RGB_FXT1_3DFX: return GL_RGB; case GL_COMPRESSED_RGBA_FXT1_3DFX: return GL_RGBA; default: ; /* fallthrough */ } } if (ctx->Extensions.EXT_texture_compression_s3tc) { switch (internalFormat) { case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return GL_RGB; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return GL_RGBA; default: ; /* fallthrough */ } } if (ctx->Extensions.S3_s3tc) { switch (internalFormat) { case GL_RGB_S3TC: case GL_RGB4_S3TC: return GL_RGB; case GL_RGBA_S3TC: case GL_RGBA4_S3TC: return GL_RGBA; default: ; /* fallthrough */ } } if (ctx->Extensions.MESA_ycbcr_texture) { if (internalFormat == GL_YCBCR_MESA) return GL_YCBCR_MESA; } if (ctx->Extensions.ARB_texture_float) { switch (internalFormat) { case GL_ALPHA16F_ARB: case GL_ALPHA32F_ARB: return GL_ALPHA; case GL_RGBA16F_ARB: case GL_RGBA32F_ARB: return GL_RGBA; case GL_RGB16F_ARB: case GL_RGB32F_ARB: return GL_RGB; case GL_INTENSITY16F_ARB: case GL_INTENSITY32F_ARB: return GL_INTENSITY; case GL_LUMINANCE16F_ARB: case GL_LUMINANCE32F_ARB: return GL_LUMINANCE; case GL_LUMINANCE_ALPHA16F_ARB: case GL_LUMINANCE_ALPHA32F_ARB: return GL_LUMINANCE_ALPHA; default: ; /* fallthrough */ } } return -1; /* error */ } /** * Test if the given image format is a color/RGBA format (i.e., not color * index, depth, stencil, etc). * \param format the image format value (may by an internal texture format) * \return GL_TRUE if its a color/RGBA format, GL_FALSE otherwise. */ static GLboolean is_color_format(GLenum format) { switch (format) { case GL_RED: case GL_GREEN: case GL_BLUE: case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8: case GL_ALPHA12: case GL_ALPHA16: case 1: case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8: case GL_LUMINANCE12: case GL_LUMINANCE16: case 2: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE6_ALPHA2: case GL_LUMINANCE8_ALPHA8: case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: case 3: case GL_RGB: case GL_BGR: case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: case 4: case GL_ABGR_EXT: case GL_RGBA: case GL_BGRA: case GL_RGBA2: case GL_RGBA4: case GL_RGB5_A1: case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: /* float texture formats */ case GL_ALPHA16F_ARB: case GL_ALPHA32F_ARB: case GL_LUMINANCE16F_ARB: case GL_LUMINANCE32F_ARB: case GL_LUMINANCE_ALPHA16F_ARB: case GL_LUMINANCE_ALPHA32F_ARB: case GL_INTENSITY16F_ARB: case GL_INTENSITY32F_ARB: case GL_RGB16F_ARB: case GL_RGB32F_ARB: case GL_RGBA16F_ARB: case GL_RGBA32F_ARB: /* compressed formats */ case GL_COMPRESSED_ALPHA: case GL_COMPRESSED_LUMINANCE: case GL_COMPRESSED_LUMINANCE_ALPHA: case GL_COMPRESSED_INTENSITY: case GL_COMPRESSED_RGB: case GL_COMPRESSED_RGBA: case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_RGBA_S3TC: case GL_RGBA4_S3TC: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: case GL_COMPRESSED_RGB_FXT1_3DFX: case GL_COMPRESSED_RGBA_FXT1_3DFX: return GL_TRUE; case GL_YCBCR_MESA: /* not considered to be RGB */ default: return GL_FALSE; } } /** * Test if the given image format is a color index format. */ static GLboolean is_index_format(GLenum format) { switch (format) { case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: case GL_COLOR_INDEX2_EXT: case GL_COLOR_INDEX4_EXT: case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: return GL_TRUE; default: return GL_FALSE; } } /** * Test if the given image format is a depth component format. */ static GLboolean is_depth_format(GLenum format) { switch (format) { case GL_DEPTH_COMPONENT16_ARB: case GL_DEPTH_COMPONENT24_ARB: case GL_DEPTH_COMPONENT32_ARB: case GL_DEPTH_COMPONENT: return GL_TRUE; default: return GL_FALSE; } } /** * Test if the given image format is a YCbCr format. */ static GLboolean is_ycbcr_format(GLenum format) { switch (format) { case GL_YCBCR_MESA: return GL_TRUE; default: return GL_FALSE; } } /** * Test if it is a supported compressed format. * * \param internalFormat the internal format token provided by the user. * * \ret GL_TRUE if \p internalFormat is a supported compressed format, or * GL_FALSE otherwise. * * Currently only GL_COMPRESSED_RGB_FXT1_3DFX and GL_COMPRESSED_RGBA_FXT1_3DFX * are supported. */ static GLboolean is_compressed_format(GLcontext *ctx, GLenum internalFormat) { (void) ctx; switch (internalFormat) { case GL_COMPRESSED_RGB_FXT1_3DFX: case GL_COMPRESSED_RGBA_FXT1_3DFX: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_RGBA_S3TC: case GL_RGBA4_S3TC: return GL_TRUE; default: return GL_FALSE; } } /** * Store a gl_texture_image pointer in a gl_texture_object structure * according to the target and level parameters. * * \param tObj texture object. * \param target texture target. * \param level image level. * \param texImage texture image. * * This was basically prompted by the introduction of cube maps. */ void _mesa_set_tex_image(struct gl_texture_object *tObj, GLenum target, GLint level, struct gl_texture_image *texImage) { ASSERT(tObj); ASSERT(texImage); switch (target) { case GL_TEXTURE_1D: case GL_TEXTURE_2D: case GL_TEXTURE_3D: tObj->Image[0][level] = texImage; break; case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: { GLuint face = ((GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X); tObj->Image[face][level] = texImage; } break; case GL_TEXTURE_RECTANGLE_NV: ASSERT(level == 0); tObj->Image[0][level] = texImage; break; default: _mesa_problem(NULL, "bad target in _mesa_set_tex_image()"); return; } /* Set the 'back' pointer */ texImage->TexObject = tObj; } /** * Allocate a texture image structure. * * Called via ctx->Driver.NewTextureImage() unless overriden by a device * driver. * * \return a pointer to gl_texture_image struct with all fields initialized to * zero. */ struct gl_texture_image * _mesa_new_texture_image( GLcontext *ctx ) { (void) ctx; return CALLOC_STRUCT(gl_texture_image); } /** * Free texture image data. * This function is a fallback called via ctx->Driver.FreeTexImageData(). * * \param teximage texture image. * * Free the texture image data if it's not marked as client data. */ void _mesa_free_texture_image_data(GLcontext *ctx, struct gl_texture_image *texImage) { if (texImage->Data && !texImage->IsClientData) { /* free the old texture data */ _mesa_free_texmemory(texImage->Data); } texImage->Data = NULL; } /** * Free texture image. * * \param teximage texture image. * * Free the texture image structure and the associated image data. */ void _mesa_delete_texture_image( GLcontext *ctx, struct gl_texture_image *texImage ) { if (texImage->Data) { ctx->Driver.FreeTexImageData( ctx, texImage ); } ASSERT(texImage->Data == NULL); FREE( texImage ); } /** * Test if a target is a proxy target. * * \param target texture target. * * \return GL_TRUE if the target is a proxy target, GL_FALSE otherwise. */ static GLboolean is_proxy_target(GLenum target) { return (target == GL_PROXY_TEXTURE_1D || target == GL_PROXY_TEXTURE_2D || target == GL_PROXY_TEXTURE_3D || target == GL_PROXY_TEXTURE_CUBE_MAP_ARB || target == GL_PROXY_TEXTURE_RECTANGLE_NV); } /** * Get the texture object that corresponds to the target of the given texture unit. * * \param ctx GL context. * \param texUnit texture unit. * \param target texture target. * * \return pointer to the texture object on success, or NULL on failure. * * \sa gl_texture_unit. */ struct gl_texture_object * _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, GLenum target) { switch (target) { case GL_TEXTURE_1D: return texUnit->Current1D; case GL_PROXY_TEXTURE_1D: return ctx->Texture.Proxy1D; case GL_TEXTURE_2D: return texUnit->Current2D; case GL_PROXY_TEXTURE_2D: return ctx->Texture.Proxy2D; case GL_TEXTURE_3D: return texUnit->Current3D; case GL_PROXY_TEXTURE_3D: return ctx->Texture.Proxy3D; case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_ARB: return ctx->Extensions.ARB_texture_cube_map ? texUnit->CurrentCubeMap : NULL; case GL_PROXY_TEXTURE_CUBE_MAP_ARB: return ctx->Extensions.ARB_texture_cube_map ? ctx->Texture.ProxyCubeMap : NULL; case GL_TEXTURE_RECTANGLE_NV: return ctx->Extensions.NV_texture_rectangle ? texUnit->CurrentRect : NULL; case GL_PROXY_TEXTURE_RECTANGLE_NV: return ctx->Extensions.NV_texture_rectangle ? ctx->Texture.ProxyRect : NULL; default: _mesa_problem(NULL, "bad target in _mesa_select_tex_object()"); return NULL; } } /** * Get the texture image struct which corresponds to target and level * of the given texture unit. * * \param ctx GL context. * \param texUnit texture unit. * \param target texture target. * \param level image level. * * \return pointer to the texture image structure on success, or NULL on failure. * * \sa gl_texture_unit. */ struct gl_texture_image * _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, GLenum target, GLint level) { ASSERT(texUnit); ASSERT(level < MAX_TEXTURE_LEVELS); switch (target) { case GL_TEXTURE_1D: return texUnit->Current1D->Image[0][level]; case GL_PROXY_TEXTURE_1D: return ctx->Texture.Proxy1D->Image[0][level]; case GL_TEXTURE_2D: return texUnit->Current2D->Image[0][level]; case GL_PROXY_TEXTURE_2D: return ctx->Texture.Proxy2D->Image[0][level]; case GL_TEXTURE_3D: return texUnit->Current3D->Image[0][level]; case GL_PROXY_TEXTURE_3D: return ctx->Texture.Proxy3D->Image[0][level]; case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: if (ctx->Extensions.ARB_texture_cube_map) { GLuint face = ((GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X); return texUnit->CurrentCubeMap->Image[face][level]; } else return NULL; case GL_PROXY_TEXTURE_CUBE_MAP_ARB: if (ctx->Extensions.ARB_texture_cube_map) return ctx->Texture.ProxyCubeMap->Image[0][level]; else return NULL; case GL_TEXTURE_RECTANGLE_NV: if (ctx->Extensions.NV_texture_rectangle) { ASSERT(level == 0); return texUnit->CurrentRect->Image[0][level]; } else { return NULL; } case GL_PROXY_TEXTURE_RECTANGLE_NV: if (ctx->Extensions.NV_texture_rectangle) { ASSERT(level == 0); return ctx->Texture.ProxyRect->Image[0][level]; } else { return NULL; } default: _mesa_problem(ctx, "bad target in _mesa_select_tex_image()"); return NULL; } } /** * Like _mesa_select_tex_image() but if the image doesn't exist, allocate * it and install it. Only return NULL if passed a bad parameter or run * out of memory. */ struct gl_texture_image * _mesa_get_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, GLenum target, GLint level) { struct gl_texture_image *texImage; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); if (!texImage) { struct gl_texture_object *texObj; texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture image allocation"); return NULL; } texObj = _mesa_select_tex_object(ctx, texUnit, target); ASSERT(texObj); _mesa_set_tex_image(texObj, target, level, texImage); } return texImage; } /** * Return pointer to the specified proxy texture image. * Note that proxy textures are per-context, not per-texture unit. * \return pointer to texture image or NULL if invalid target, invalid * level, or out of memory. */ struct gl_texture_image * _mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level) { struct gl_texture_image *texImage; if (level < 0 ) return NULL; switch (target) { case GL_PROXY_TEXTURE_1D: if (level >= ctx->Const.MaxTextureLevels) return NULL; texImage = ctx->Texture.Proxy1D->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } ctx->Texture.Proxy1D->Image[0][level] = texImage; /* Set the 'back' pointer */ texImage->TexObject = ctx->Texture.Proxy1D; } return texImage; case GL_PROXY_TEXTURE_2D: if (level >= ctx->Const.MaxTextureLevels) return NULL; texImage = ctx->Texture.Proxy2D->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } ctx->Texture.Proxy2D->Image[0][level] = texImage; /* Set the 'back' pointer */ texImage->TexObject = ctx->Texture.Proxy2D; } return texImage; case GL_PROXY_TEXTURE_3D: if (level >= ctx->Const.Max3DTextureLevels) return NULL; texImage = ctx->Texture.Proxy3D->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } ctx->Texture.Proxy3D->Image[0][level] = texImage; /* Set the 'back' pointer */ texImage->TexObject = ctx->Texture.Proxy3D; } return texImage; case GL_PROXY_TEXTURE_CUBE_MAP: if (level >= ctx->Const.MaxCubeTextureLevels) return NULL; texImage = ctx->Texture.ProxyCubeMap->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } ctx->Texture.ProxyCubeMap->Image[0][level] = texImage; /* Set the 'back' pointer */ texImage->TexObject = ctx->Texture.ProxyCubeMap; } return texImage; case GL_PROXY_TEXTURE_RECTANGLE_NV: if (level > 0) return NULL; texImage = ctx->Texture.ProxyRect->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } ctx->Texture.ProxyRect->Image[0][level] = texImage; /* Set the 'back' pointer */ texImage->TexObject = ctx->Texture.ProxyRect; } return texImage; default: return NULL; } } /** * Get the maximum number of allowed mipmap levels. * * \param ctx GL context. * \param target texture target. * * \return the maximum number of allowed mipmap levels for the given * texture target, or zero if passed a bad target. * * \sa gl_constants. */ GLint _mesa_max_texture_levels(GLcontext *ctx, GLenum target) { switch (target) { case GL_TEXTURE_1D: case GL_PROXY_TEXTURE_1D: case GL_TEXTURE_2D: case GL_PROXY_TEXTURE_2D: return ctx->Const.MaxTextureLevels; case GL_TEXTURE_3D: case GL_PROXY_TEXTURE_3D: return ctx->Const.Max3DTextureLevels; case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_ARB: case GL_PROXY_TEXTURE_CUBE_MAP_ARB: return ctx->Const.MaxCubeTextureLevels; case GL_TEXTURE_RECTANGLE_NV: case GL_PROXY_TEXTURE_RECTANGLE_NV: return 1; default: return 0; /* bad target */ } } #if 000 /* not used anymore */ /* * glTexImage[123]D can accept a NULL image pointer. In this case we * create a texture image with unspecified image contents per the OpenGL * spec. */ static GLubyte * make_null_texture(GLint width, GLint height, GLint depth, GLenum format) { const GLint components = _mesa_components_in_format(format); const GLint numPixels = width * height * depth; GLubyte *data = (GLubyte *) MALLOC(numPixels * components * sizeof(GLubyte)); #ifdef DEBUG /* * Let's see if anyone finds this. If glTexImage2D() is called with * a NULL image pointer then load the texture image with something * interesting instead of leaving it indeterminate. */ if (data) { static const char message[8][32] = { " X X XXXXX XXX X ", " XX XX X X X X X ", " X X X X X X X ", " X X XXXX XXX XXXXX ", " X X X X X X ", " X X X X X X X ", " X X XXXXX XXX X X ", " " }; GLubyte *imgPtr = data; GLint h, i, j, k; for (h = 0; h < depth; h++) { for (i = 0; i < height; i++) { GLint srcRow = 7 - (i % 8); for (j = 0; j < width; j++) { GLint srcCol = j % 32; GLubyte texel = (message[srcRow][srcCol]=='X') ? 255 : 70; for (k = 0; k < components; k++) { *imgPtr++ = texel; } } } } } #endif return data; } #endif /** * Reset the fields of a gl_texture_image struct to zero. * * \param img texture image structure. * * This is called when a proxy texture test fails, we set all the * image members (except DriverData) to zero. * It's also used in glTexImage[123]D as a safeguard to be sure all * required fields get initialized properly by the Driver.TexImage[123]D * functions. */ static void clear_teximage_fields(struct gl_texture_image *img) { ASSERT(img); img->Format = 0; img->IntFormat = 0; img->Border = 0; img->Width = 0; img->Height = 0; img->Depth = 0; img->RowStride = 0; img->Width2 = 0; img->Height2 = 0; img->Depth2 = 0; img->WidthLog2 = 0; img->HeightLog2 = 0; img->DepthLog2 = 0; img->Data = NULL; img->TexFormat = &_mesa_null_texformat; img->FetchTexelc = NULL; img->FetchTexelf = NULL; img->IsCompressed = 0; img->CompressedSize = 0; } /** * Initialize basic fields of the gl_texture_image struct. * * \param ctx GL context. * \param target texture target. * \param img texture image structure to be initialized. * \param width image width. * \param height image height. * \param depth image depth. * \param border image border. * \param internalFormat internal format. * * Fills in the fields of \p img with the given information. * Note: width, height and depth include the border. */ void _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, struct gl_texture_image *img, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat) { ASSERT(img); img->Format = _mesa_base_tex_format( ctx, internalFormat ); ASSERT(img->Format > 0); img->IntFormat = internalFormat; img->Border = border; img->Width = width; img->Height = height; img->Depth = depth; img->RowStride = width; img->WidthLog2 = logbase2(width - 2 * border); if (height == 1) /* 1-D texture */ img->HeightLog2 = 0; else img->HeightLog2 = logbase2(height - 2 * border); if (depth == 1) /* 2-D texture */ img->DepthLog2 = 0; else img->DepthLog2 = logbase2(depth - 2 * border); img->Width2 = width - 2 * border; /*1 << img->WidthLog2;*/ img->Height2 = height - 2 * border; /*1 << img->HeightLog2;*/ img->Depth2 = depth - 2 * border; /*1 << img->DepthLog2;*/ img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2); img->IsCompressed = is_compressed_format(ctx, internalFormat); if (img->IsCompressed) img->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, width, height, depth, internalFormat); else img->CompressedSize = 0; if ((width == 1 || _mesa_bitcount(width - 2 * border) == 1) && (height == 1 || _mesa_bitcount(height - 2 * border) == 1) && (depth == 1 || _mesa_bitcount(depth - 2 * border) == 1)) img->_IsPowerOfTwo = GL_TRUE; else img->_IsPowerOfTwo = GL_FALSE; /* Compute Width/Height/DepthScale for mipmap lod computation */ if (target == GL_TEXTURE_RECTANGLE_NV) { /* scale = 1.0 since texture coords directly map to texels */ img->WidthScale = 1.0; img->HeightScale = 1.0; img->DepthScale = 1.0; } else { img->WidthScale = (GLfloat) img->Width; img->HeightScale = (GLfloat) img->Height; img->DepthScale = (GLfloat) img->Depth; } } /** * This is the fallback for Driver.TestProxyTexImage(). Test the texture * level, width, height and depth against the ctx->Const limits for textures. * * A hardware driver might override this function if, for example, the * max 3D texture size is 512x512x64 (i.e. not a cube). * * \param target one of GL_PROXY_TEXTURE_1D, GL_PROXY_TEXTURE_2D, * GL_PROXY_TEXTURE_3D, GL_PROXY_TEXTURE_RECTANGLE_NV, * GL_PROXY_TEXTURE_CUBE_MAP_ARB. * \param level as passed to glTexImage * \param internalFormat as passed to glTexImage * \param format as passed to glTexImage * \param type as passed to glTexImage * \param width as passed to glTexImage * \param height as passed to glTexImage * \param depth as passed to glTexImage * \param border as passed to glTexImage * \return GL_TRUE if the image is acceptable, GL_FALSE if not acceptable. */ GLboolean _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, GLint depth, GLint border) { GLint maxSize; (void) internalFormat; (void) format; (void) type; switch (target) { case GL_PROXY_TEXTURE_1D: maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); if (width < 2 * border || width > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(width - 2 * border) != 1) || level >= ctx->Const.MaxTextureLevels) { /* bad width or level */ return GL_FALSE; } return GL_TRUE; case GL_PROXY_TEXTURE_2D: maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); if (width < 2 * border || width > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(width - 2 * border) != 1) || height < 2 * border || height > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(height - 2 * border) != 1) || level >= ctx->Const.MaxTextureLevels) { /* bad width or height or level */ return GL_FALSE; } return GL_TRUE; case GL_PROXY_TEXTURE_3D: maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1); if (width < 2 * border || width > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(width - 2 * border) != 1) || height < 2 * border || height > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(height - 2 * border) != 1) || depth < 2 * border || depth > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(depth - 2 * border) != 1) || level >= ctx->Const.Max3DTextureLevels) { /* bad width or height or depth or level */ return GL_FALSE; } return GL_TRUE; case GL_PROXY_TEXTURE_RECTANGLE_NV: if (width < 1 || width > ctx->Const.MaxTextureRectSize || height < 1 || height > ctx->Const.MaxTextureRectSize || level != 0) { /* bad width or height or level */ return GL_FALSE; } return GL_TRUE; case GL_PROXY_TEXTURE_CUBE_MAP_ARB: maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1); if (width < 2 * border || width > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(width - 2 * border) != 1) || height < 2 * border || height > 2 + maxSize || (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(height - 2 * border) != 1) || level >= ctx->Const.MaxCubeTextureLevels) { /* bad width or height */ return GL_FALSE; } return GL_TRUE; default: _mesa_problem(ctx, "Invalid target in _mesa_test_proxy_teximage"); return GL_FALSE; } } /** * Test the glTexImage[123]D() parameters for errors. * * \param ctx GL context. * \param target texture target given by the user. * \param level image level given by the user. * \param internalFormat internal format given by the user. * \param format pixel data format given by the user. * \param type pixel data type given by the user. * \param dimensions texture image dimensions (must be 1, 2 or 3). * \param width image width given by the user. * \param height image height given by the user. * \param depth image depth given by the user. * \param border image border given by the user. * * \return GL_TRUE if an error was detected, or GL_FALSE if no errors. * * Verifies each of the parameters against the constants specified in * __GLcontextRec::Const and the supported extensions, and according to the * OpenGL specification. */ static GLboolean texture_error_check( GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLuint dimensions, GLint width, GLint height, GLint depth, GLint border ) { const GLboolean isProxy = is_proxy_target(target); GLboolean sizeOK; GLboolean colorFormat, indexFormat; /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */ if (level < 0 || level >= MAX_TEXTURE_LEVELS) { if (!isProxy) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexImage%dD(level=%d)", dimensions, level); } return GL_TRUE; } /* Check border */ if (border < 0 || border > 1 || ((target == GL_TEXTURE_RECTANGLE_NV || target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) { if (!isProxy) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexImage%dD(border=%d)", dimensions, border); } return GL_TRUE; } if (width < 0 || height < 0 || depth < 0) { if (!isProxy) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexImage%dD(width, height or depth < 0)", dimensions); } return GL_TRUE; } /* Check target and call ctx->Driver.TestProxyTexImage() to check the * level, width, height and depth. */ if (dimensions == 1) { if (target == GL_PROXY_TEXTURE_1D || target == GL_TEXTURE_1D) { sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_1D, level, internalFormat, format, type, width, 1, 1, border); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" ); return GL_TRUE; } } else if (dimensions == 2) { if (target == GL_PROXY_TEXTURE_2D || target == GL_TEXTURE_2D) { sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_2D, level, internalFormat, format, type, width, height, 1, border); } else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB || (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); return GL_TRUE; } sizeOK = (width == height) && ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_CUBE_MAP_ARB, level, internalFormat, format, type, width, height, 1, border); } else if (target == GL_PROXY_TEXTURE_RECTANGLE_NV || target == GL_TEXTURE_RECTANGLE_NV) { if (!ctx->Extensions.NV_texture_rectangle) { _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); return GL_TRUE; } sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_RECTANGLE_NV, level, internalFormat, format, type, width, height, 1, border); } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); return GL_TRUE; } } else if (dimensions == 3) { if (target == GL_PROXY_TEXTURE_3D || target == GL_TEXTURE_3D) { sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_3D, level, internalFormat, format, type, width, height, depth, border); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" ); return GL_TRUE; } } else { _mesa_problem( ctx, "bad dims in texture_error_check" ); return GL_TRUE; } if (!sizeOK) { if (!isProxy) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexImage%dD(level=%d, width=%d, height=%d, depth=%d)", dimensions, level, width, height, depth); } return GL_TRUE; } /* Check internalFormat */ if (_mesa_base_tex_format(ctx, internalFormat) < 0) { if (!isProxy) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexImage%dD(internalFormat=0x%x)", dimensions, internalFormat); } return GL_TRUE; } /* Check incoming image format and type */ if (!_mesa_is_legal_format_and_type(ctx, format, type)) { /* Yes, generate GL_INVALID_OPERATION, not GL_INVALID_ENUM, if there * is a type/format mismatch. See 1.2 spec page 94, sec 3.6.4. */ if (!isProxy) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexImage%dD(format or type)", dimensions); } return GL_TRUE; } /* make sure internal format and format basically agree */ colorFormat = is_color_format(format); indexFormat = is_index_format(format); if ((is_color_format(internalFormat) && !colorFormat && !indexFormat) || (is_index_format(internalFormat) && !indexFormat) || (is_depth_format(internalFormat) != is_depth_format(format)) || (is_ycbcr_format(internalFormat) != is_ycbcr_format(format))) { if (!isProxy) _mesa_error(ctx, GL_INVALID_OPERATION, "glTexImage(internalFormat/format)"); return GL_TRUE; } /* additional checks for ycbcr textures */ if (internalFormat == GL_YCBCR_MESA) { ASSERT(ctx->Extensions.MESA_ycbcr_texture); if (type != GL_UNSIGNED_SHORT_8_8_MESA && type != GL_UNSIGNED_SHORT_8_8_REV_MESA) { char message[100]; _mesa_sprintf(message, "glTexImage%d(format/type YCBCR mismatch", dimensions); _mesa_error(ctx, GL_INVALID_ENUM, message); return GL_TRUE; /* error */ } if (target != GL_TEXTURE_2D && target != GL_PROXY_TEXTURE_2D && target != GL_TEXTURE_RECTANGLE_NV && target != GL_PROXY_TEXTURE_RECTANGLE_NV) { if (!isProxy) _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage(target)"); return GL_TRUE; } if (border != 0) { if (!isProxy) { char message[100]; _mesa_sprintf(message, "glTexImage%d(format=GL_YCBCR_MESA and border=%d)", dimensions, border); _mesa_error(ctx, GL_INVALID_VALUE, message); } return GL_TRUE; } } /* additional checks for depth textures */ if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT) { /* Only 1D and 2D textures supported */ if (target != GL_TEXTURE_1D && target != GL_PROXY_TEXTURE_1D && target != GL_TEXTURE_2D && target != GL_PROXY_TEXTURE_2D) { if (!isProxy) _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage(target/internalFormat)"); return GL_TRUE; } } /* additional checks for compressed textures */ if (is_compressed_format(ctx, internalFormat)) { if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) { /* OK */ } else if (ctx->Extensions.ARB_texture_cube_map && (target == GL_PROXY_TEXTURE_CUBE_MAP || (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) { /* OK */ } else { if (!isProxy) { _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage%d(target)", dimensions); return GL_TRUE; } } if (border != 0) { if (!isProxy) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexImage%D(border!=0)", dimensions); } return GL_TRUE; } } /* if we get here, the parameters are OK */ return GL_FALSE; } /** * Test glTexSubImage[123]D() parameters for errors. * * \param ctx GL context. * \param dimensions texture image dimensions (must be 1, 2 or 3). * \param target texture target given by the user. * \param level image level given by the user. * \param xoffset sub-image x offset given by the user. * \param yoffset sub-image y offset given by the user. * \param zoffset sub-image z offset given by the user. * \param format pixel data format given by the user. * \param type pixel data type given by the user. * \param width image width given by the user. * \param height image height given by the user. * \param depth image depth given by the user. * * \return GL_TRUE if an error was detected, or GL_FALSE if no errors. * * Verifies each of the parameters against the constants specified in * __GLcontextRec::Const and the supported extensions, and according to the * OpenGL specification. */ static GLboolean subtexture_error_check( GLcontext *ctx, GLuint dimensions, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLenum format, GLenum type ) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_image *destTex; /* Check target */ if (dimensions == 1) { if (target != GL_TEXTURE_1D) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage1D(target)" ); return GL_TRUE; } } else if (dimensions == 2) { if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <=GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); return GL_TRUE; } } else if (ctx->Extensions.NV_texture_rectangle && target == GL_TEXTURE_RECTANGLE_NV) { if (!ctx->Extensions.NV_texture_rectangle) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); return GL_TRUE; } } else if (target != GL_TEXTURE_2D) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); return GL_TRUE; } } else if (dimensions == 3) { if (target != GL_TEXTURE_3D) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage3D(target)" ); return GL_TRUE; } } else { _mesa_problem( ctx, "invalid dims in texture_error_check" ); return GL_TRUE; } /* Basic level check */ if (level < 0 || level >= MAX_TEXTURE_LEVELS) { _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage2D(level=%d)", level); return GL_TRUE; } if (width < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(width=%d)", dimensions, width); return GL_TRUE; } if (height < 0 && dimensions > 1) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(height=%d)", dimensions, height); return GL_TRUE; } if (depth < 0 && dimensions > 2) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(depth=%d)", dimensions, depth); return GL_TRUE; } destTex = _mesa_select_tex_image(ctx, texUnit, target, level); if (!destTex) { /* undefined image level */ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage%dD", dimensions); return GL_TRUE; } if (xoffset < -((GLint)destTex->Border)) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(xoffset)", dimensions); return GL_TRUE; } if (xoffset + width > (GLint) (destTex->Width + destTex->Border)) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(xoffset+width)", dimensions); return GL_TRUE; } if (dimensions > 1) { if (yoffset < -((GLint)destTex->Border)) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(yoffset)", dimensions); return GL_TRUE; } if (yoffset + height > (GLint) (destTex->Height + destTex->Border)) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(yoffset+height)", dimensions); return GL_TRUE; } } if (dimensions > 2) { if (zoffset < -((GLint)destTex->Border)) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset)"); return GL_TRUE; } if (zoffset + depth > (GLint) (destTex->Depth + destTex->Border)) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset+depth)"); return GL_TRUE; } } if (!_mesa_is_legal_format_and_type(ctx, format, type)) { _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage%dD(format or type)", dimensions); return GL_TRUE; } if (destTex->IsCompressed) { const struct gl_texture_unit *texUnit; const struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) { /* OK */ } else if (ctx->Extensions.ARB_texture_cube_map && (target == GL_PROXY_TEXTURE_CUBE_MAP || (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) { /* OK */ } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage%D(target)", dimensions); return GL_TRUE; } /* offset must be multiple of 4 */ if ((xoffset & 3) || (yoffset & 3)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage%D(xoffset or yoffset)", dimensions); return GL_TRUE; } /* size must be multiple of 4 or equal to whole texture size */ if ((width & 3) && (GLuint) width != texImage->Width) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage%D(width)", dimensions); return GL_TRUE; } if ((height & 3) && (GLuint) height != texImage->Height) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexSubImage%D(width)", dimensions); return GL_TRUE; } } return GL_FALSE; } /** * Test glCopyTexImage[12]D() parameters for errors. * * \param ctx GL context. * \param dimensions texture image dimensions (must be 1, 2 or 3). * \param target texture target given by the user. * \param level image level given by the user. * \param internalFormat internal format given by the user. * \param width image width given by the user. * \param height image height given by the user. * \param depth image depth given by the user. * \param border texture border. * * \return GL_TRUE if an error was detected, or GL_FALSE if no errors. * * Verifies each of the parameters against the constants specified in * __GLcontextRec::Const and the supported extensions, and according to the * OpenGL specification. */ static GLboolean copytexture_error_check( GLcontext *ctx, GLuint dimensions, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border ) { GLenum format, type; GLboolean sizeOK; /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */ if (level < 0 || level >= MAX_TEXTURE_LEVELS) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexImage%dD(level=%d)", dimensions, level); return GL_TRUE; } /* Check border */ if (border < 0 || border > 1 || ((target == GL_TEXTURE_RECTANGLE_NV || target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) { return GL_TRUE; } /* The format and type aren't really significant here, but we need to pass * something to TestProxyTexImage(). */ format = _mesa_base_tex_format(ctx, internalFormat); type = GL_FLOAT; /* Check target and call ctx->Driver.TestProxyTexImage() to check the * level, width, height and depth. */ if (dimensions == 1) { if (target == GL_TEXTURE_1D) { sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_1D, level, internalFormat, format, type, width, 1, 1, border); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage1D(target)" ); return GL_TRUE; } } else if (dimensions == 2) { if (target == GL_TEXTURE_2D) { sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_2D, level, internalFormat, format, type, width, height, 1, border); } else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); return GL_TRUE; } sizeOK = (width == height) && ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_CUBE_MAP_ARB, level, internalFormat, format, type, width, height, 1, border); } else if (target == GL_TEXTURE_RECTANGLE_NV) { if (!ctx->Extensions.NV_texture_rectangle) { _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); return GL_TRUE; } sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_RECTANGLE_NV, level, internalFormat, format, type, width, height, 1, border); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); return GL_TRUE; } } else { _mesa_problem(ctx, "invalid dimensions in copytexture_error_check"); return GL_TRUE; } if (!sizeOK) { if (dimensions == 1) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexImage1D(width=%d)", width); } else { ASSERT(dimensions == 2); _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexImage2D(width=%d, height=%d)", width, height); } return GL_TRUE; } if (_mesa_base_tex_format(ctx, internalFormat) < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexImage%dD(internalFormat)", dimensions); return GL_TRUE; } if (is_compressed_format(ctx, internalFormat)) { if (target != GL_TEXTURE_2D) { _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexImage%d(target)", dimensions); return GL_TRUE; } if (border != 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexImage%D(border!=0)", dimensions); return GL_TRUE; } } /* if we get here, the parameters are OK */ return GL_FALSE; } /** * Test glCopyTexImage[12]D() parameters for errors. * * \param ctx GL context. * \param dimensions texture image dimensions (must be 1, 2 or 3). * \param target texture target given by the user. * \param level image level given by the user. * \param xoffset sub-image x offset given by the user. * \param yoffset sub-image y offset given by the user. * \param zoffset sub-image z offset given by the user. * \param width image width given by the user. * \param height image height given by the user. * * \return GL_TRUE if an error was detected, or GL_FALSE if no errors. * * Verifies each of the parameters against the constants specified in * __GLcontextRec::Const and the supported extensions, and according to the * OpenGL specification. */ static GLboolean copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height ) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_image *teximage; /* Check target */ if (dimensions == 1) { if (target != GL_TEXTURE_1D) { _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage1D(target)" ); return GL_TRUE; } } else if (dimensions == 2) { if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); return GL_TRUE; } } else if (target == GL_TEXTURE_RECTANGLE_NV) { if (!ctx->Extensions.NV_texture_rectangle) { _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); return GL_TRUE; } } else if (target != GL_TEXTURE_2D) { _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); return GL_TRUE; } } else if (dimensions == 3) { if (target != GL_TEXTURE_3D) { _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage3D(target)" ); return GL_TRUE; } } /* Check level */ if (level < 0 || level >= MAX_TEXTURE_LEVELS) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexSubImage%dD(level=%d)", dimensions, level); return GL_TRUE; } /* Check size */ if (width < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexSubImage%dD(width=%d)", dimensions, width); return GL_TRUE; } if (dimensions > 1 && height < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexSubImage%dD(height=%d)", dimensions, height); return GL_TRUE; } teximage = _mesa_select_tex_image(ctx, texUnit, target, level); if (!teximage) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage%dD(undefined texture level: %d)", dimensions, level); return GL_TRUE; } if (xoffset < -((GLint)teximage->Border)) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexSubImage%dD(xoffset=%d)", dimensions, xoffset); return GL_TRUE; } if (xoffset + width > (GLint) (teximage->Width + teximage->Border)) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexSubImage%dD(xoffset+width)", dimensions); return GL_TRUE; } if (dimensions > 1) { if (yoffset < -((GLint)teximage->Border)) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexSubImage%dD(yoffset=%d)", dimensions, yoffset); return GL_TRUE; } /* NOTE: we're adding the border here, not subtracting! */ if (yoffset + height > (GLint) (teximage->Height + teximage->Border)) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexSubImage%dD(yoffset+height)", dimensions); return GL_TRUE; } } if (dimensions > 2) { if (zoffset < -((GLint)teximage->Border)) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexSubImage%dD(zoffset)", dimensions); return GL_TRUE; } if (zoffset > (GLint) (teximage->Depth + teximage->Border)) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexSubImage%dD(zoffset+depth)", dimensions); return GL_TRUE; } } if (teximage->IsCompressed) { if (target != GL_TEXTURE_2D) { _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexSubImage%d(target)", dimensions); return GL_TRUE; } /* offset must be multiple of 4 */ if ((xoffset & 3) || (yoffset & 3)) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexSubImage%D(xoffset or yoffset)", dimensions); return GL_TRUE; } /* size must be multiple of 4 */ if ((width & 3) != 0 && (GLuint) width != teximage->Width) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexSubImage%D(width)", dimensions); return GL_TRUE; } if ((height & 3) != 0 && (GLuint) height != teximage->Height) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyTexSubImage%D(height)", dimensions); return GL_TRUE; } } if (teximage->IntFormat == GL_YCBCR_MESA) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage2D"); return GL_TRUE; } /* if we get here, the parameters are OK */ return GL_FALSE; } /** * Get texture image. Called by glGetTexImage. * * \param target texture target. * \param level image level. * \param format pixel data format for returned image. * \param type pixel data type for returned image. * \param pixels returned pixel data. */ void GLAPIENTRY _mesa_GetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ) { const struct gl_texture_unit *texUnit; const struct gl_texture_object *texObj; const struct gl_texture_image *texImage; GLint maxLevels = 0; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); texUnit = &(ctx->Texture.Unit[ctx->Texture.CurrentUnit]); texObj = _mesa_select_tex_object(ctx, texUnit, target); if (!texObj || is_proxy_target(target)) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target)"); return; } maxLevels = _mesa_max_texture_levels(ctx, target); ASSERT(maxLevels > 0); /* 0 indicates bad target, caught above */ if (level < 0 || level >= maxLevels) { _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexImage(level)" ); return; } if (_mesa_sizeof_packed_type(type) <= 0) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexImage(type)" ); return; } if (_mesa_components_in_format(format) <= 0 || format == GL_STENCIL_INDEX) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexImage(format)" ); return; } if (!ctx->Extensions.EXT_paletted_texture && is_index_format(format)) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)"); } if (!ctx->Extensions.SGIX_depth_texture && !ctx->Extensions.ARB_depth_texture && is_depth_format(format)) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)"); } if (!ctx->Extensions.MESA_ycbcr_texture && is_ycbcr_format(format)) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)"); } if (!pixels) return; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); if (!texImage) { /* invalid mipmap level, not an error */ return; } /* Make sure the requested image format is compatible with the * texture's format. We let the colorformat-indexformat go through, * because the texelfetcher will dequantize to full rgba. */ if (is_color_format(format) && !is_color_format(texImage->TexFormat->BaseFormat) && !is_index_format(texImage->TexFormat->BaseFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); return; } else if (is_index_format(format) && !is_index_format(texImage->TexFormat->BaseFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); return; } else if (is_depth_format(format) && !is_depth_format(texImage->TexFormat->BaseFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); return; } else if (is_ycbcr_format(format) && !is_ycbcr_format(texImage->TexFormat->BaseFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); return; } /* typically, this will call _mesa_get_teximage() */ ctx->Driver.GetTexImage(ctx, target, level, format, type, pixels, texObj, texImage); } /* * Called from the API. Note that width includes the border. */ void GLAPIENTRY _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { GLsizei postConvWidth = width; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (is_color_format(internalFormat)) { _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); } if (target == GL_TEXTURE_1D) { /* non-proxy target */ struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; if (texture_error_check(ctx, target, level, internalFormat, format, type, 1, postConvWidth, 1, 1, border)) { return; /* error was recorded */ } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_get_tex_image(ctx, texUnit, target, level); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); return; } else if (texImage->Data) { ctx->Driver.FreeTexImageData( ctx, texImage ); } ASSERT(texImage->Data == NULL); clear_teximage_fields(texImage); /* not really needed, but helpful */ _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, border, internalFormat); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); ASSERT(ctx->Driver.TexImage1D); /* Give the texture to the driver! may be null! */ (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat, width, border, format, type, pixels, &ctx->Unpack, texObj, texImage); ASSERT(texImage->TexFormat); /* If driver didn't explicitly set this, use the defaults */ if (!texImage->FetchTexelc) texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D; if (!texImage->FetchTexelf) texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df; ASSERT(texImage->FetchTexelc); ASSERT(texImage->FetchTexelf); /* state update */ texObj->Complete = GL_FALSE; ctx->NewState |= _NEW_TEXTURE; } else if (target == GL_PROXY_TEXTURE_1D) { /* Proxy texture: check for errors and update proxy state */ struct gl_texture_image *texImage; texImage = _mesa_get_proxy_tex_image(ctx, target, level); if (texture_error_check(ctx, target, level, internalFormat, format, type, 1, postConvWidth, 1, 1, border)) { /* when error, clear all proxy texture image parameters */ if (texImage) clear_teximage_fields(texImage); } else { /* no error, set the tex image parameters */ ASSERT(texImage); _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, border, internalFormat); texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, internalFormat, format, type); } } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" ); return; } } void GLAPIENTRY _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { GLsizei postConvWidth = width, postConvHeight = height; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (is_color_format(internalFormat)) { _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); } if (target == GL_TEXTURE_2D || (ctx->Extensions.ARB_texture_cube_map && target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) || (ctx->Extensions.NV_texture_rectangle && target == GL_TEXTURE_RECTANGLE_NV)) { /* non-proxy target */ struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; if (texture_error_check(ctx, target, level, internalFormat, format, type, 2, postConvWidth, postConvHeight, 1, border)) { return; /* error was recorded */ } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_get_tex_image(ctx, texUnit, target, level); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); return; } else if (texImage->Data) { ctx->Driver.FreeTexImageData( ctx, texImage ); } ASSERT(texImage->Data == NULL); clear_teximage_fields(texImage); /* not really needed, but helpful */ _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, postConvHeight, 1, border, internalFormat); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); ASSERT(ctx->Driver.TexImage2D); /* Give the texture to the driver! may be null! */ (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat, width, height, border, format, type, pixels, &ctx->Unpack, texObj, texImage); ASSERT(texImage->TexFormat); /* If driver didn't explicitly set these, use the defaults */ if (!texImage->FetchTexelc) texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D; if (!texImage->FetchTexelf) texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df; ASSERT(texImage->FetchTexelc); ASSERT(texImage->FetchTexelf); /* state update */ texObj->Complete = GL_FALSE; ctx->NewState |= _NEW_TEXTURE; } else if (target == GL_PROXY_TEXTURE_2D || (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB && ctx->Extensions.ARB_texture_cube_map) || (target == GL_PROXY_TEXTURE_RECTANGLE_NV && ctx->Extensions.NV_texture_rectangle)) { /* Proxy texture: check for errors and update proxy state */ struct gl_texture_image *texImage; texImage = _mesa_get_proxy_tex_image(ctx, target, level); if (texture_error_check(ctx, target, level, internalFormat, format, type, 2, postConvWidth, postConvHeight, 1, border)) { /* when error, clear all proxy texture image parameters */ if (texImage) clear_teximage_fields(ctx->Texture.Proxy2D->Image[0][level]); } else { /* no error, set the tex image parameters */ _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, postConvHeight, 1, border, internalFormat); texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, internalFormat, format, type); } } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" ); return; } } /* * Called by the API or display list executor. * Note that width and height include the border. */ void GLAPIENTRY _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target == GL_TEXTURE_3D) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; /* non-proxy target */ if (texture_error_check(ctx, target, level, (GLint) internalFormat, format, type, 3, width, height, depth, border)) { return; /* error was recorded */ } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_get_tex_image(ctx, texUnit, target, level); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); return; } else if (texImage->Data) { ctx->Driver.FreeTexImageData( ctx, texImage ); } ASSERT(texImage->Data == NULL); clear_teximage_fields(texImage); /* not really needed, but helpful */ _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, border, internalFormat); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); ASSERT(ctx->Driver.TexImage3D); /* Give the texture to the driver! may be null! */ (*ctx->Driver.TexImage3D)(ctx, target, level, internalFormat, width, height, depth, border, format, type, pixels, &ctx->Unpack, texObj, texImage); ASSERT(texImage->TexFormat); /* If driver didn't explicitly set these, use the defaults */ if (!texImage->FetchTexelc) texImage->FetchTexelc = texImage->TexFormat->FetchTexel3D; if (!texImage->FetchTexelf) texImage->FetchTexelf = texImage->TexFormat->FetchTexel3Df; ASSERT(texImage->FetchTexelc); ASSERT(texImage->FetchTexelf); /* state update */ texObj->Complete = GL_FALSE; ctx->NewState |= _NEW_TEXTURE; } else if (target == GL_PROXY_TEXTURE_3D) { /* Proxy texture: check for errors and update proxy state */ struct gl_texture_image *texImage; texImage = _mesa_get_proxy_tex_image(ctx, target, level); if (texture_error_check(ctx, target, level, internalFormat, format, type, 3, width, height, depth, border)) { /* when error, clear all proxy texture image parameters */ if (texImage) clear_teximage_fields(texImage); } else { /* no error, set the tex image parameters */ _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, border, internalFormat); texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, internalFormat, format, type); } } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" ); return; } } void GLAPIENTRY _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { _mesa_TexImage3D(target, level, (GLint) internalFormat, width, height, depth, border, format, type, pixels); } void GLAPIENTRY _mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels ) { GLsizei postConvWidth = width; struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); /* XXX should test internal format */ if (is_color_format(format)) { _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); } if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, postConvWidth, 1, 1, format, type)) { return; /* error was detected */ } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); assert(texImage); if (width == 0) return; /* no-op, not an error */ /* If we have a border, xoffset=-1 is legal. Bias by border width */ xoffset += texImage->Border; ASSERT(ctx->Driver.TexSubImage1D); (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width, format, type, pixels, &ctx->Unpack, texObj, texImage); ctx->NewState |= _NEW_TEXTURE; } void GLAPIENTRY _mesa_TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) { GLsizei postConvWidth = width, postConvHeight = height; struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); /* XXX should test internal format */ if (is_color_format(format)) { _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); } if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, postConvWidth, postConvHeight, 1, format, type)) { return; /* error was detected */ } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); assert(texImage); if (width == 0 || height == 0) return; /* no-op, not an error */ /* If we have a border, xoffset=-1 is legal. Bias by border width */ xoffset += texImage->Border; yoffset += texImage->Border; ASSERT(ctx->Driver.TexSubImage2D); (*ctx->Driver.TexSubImage2D)(ctx, target, level, xoffset, yoffset, width, height, format, type, pixels, &ctx->Unpack, texObj, texImage); ctx->NewState |= _NEW_TEXTURE; } void GLAPIENTRY _mesa_TexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels ) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type)) { return; /* error was detected */ } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); assert(texImage); if (width == 0 || height == 0 || height == 0) return; /* no-op, not an error */ /* If we have a border, xoffset=-1 is legal. Bias by border width */ xoffset += texImage->Border; yoffset += texImage->Border; zoffset += texImage->Border; ASSERT(ctx->Driver.TexSubImage3D); (*ctx->Driver.TexSubImage3D)(ctx, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &ctx->Unpack, texObj, texImage ); ctx->NewState |= _NEW_TEXTURE; } void GLAPIENTRY _mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border ) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); if (is_color_format(internalFormat)) { _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); } if (copytexture_error_check(ctx, 1, target, level, internalFormat, postConvWidth, 1, border)) return; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_get_tex_image(ctx, texUnit, target, level); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D"); return; } else if (texImage->Data) { ctx->Driver.FreeTexImageData( ctx, texImage ); } ASSERT(texImage->Data == NULL); clear_teximage_fields(texImage); /* not really needed, but helpful */ _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, border, internalFormat); ASSERT(ctx->Driver.CopyTexImage1D); (*ctx->Driver.CopyTexImage1D)(ctx, target, level, internalFormat, x, y, width, border); ASSERT(texImage->TexFormat); /* If driver didn't explicitly set these, use the defaults */ if (!texImage->FetchTexelc) texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D; if (!texImage->FetchTexelf) texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df; ASSERT(texImage->FetchTexelc); ASSERT(texImage->FetchTexelf); /* state update */ texObj->Complete = GL_FALSE; ctx->NewState |= _NEW_TEXTURE; } void GLAPIENTRY _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width, postConvHeight = height; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); if (is_color_format(internalFormat)) { _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); } if (copytexture_error_check(ctx, 2, target, level, internalFormat, postConvWidth, postConvHeight, border)) return; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_get_tex_image(ctx, texUnit, target, level); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D"); return; } else if (texImage->Data) { ctx->Driver.FreeTexImageData( ctx, texImage ); } ASSERT(texImage->Data == NULL); clear_teximage_fields(texImage); /* not really needed, but helpful */ _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, postConvHeight, 1, border, internalFormat); ASSERT(ctx->Driver.CopyTexImage2D); (*ctx->Driver.CopyTexImage2D)(ctx, target, level, internalFormat, x, y, width, height, border); ASSERT(texImage->TexFormat); /* If driver didn't explicitly set these, use the defaults */ if (!texImage->FetchTexelc) texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D; if (!texImage->FetchTexelf) texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df; ASSERT(texImage->FetchTexelc); ASSERT(texImage->FetchTexelf); /* state update */ texObj->Complete = GL_FALSE; ctx->NewState |= _NEW_TEXTURE; } void GLAPIENTRY _mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { struct gl_texture_unit *texUnit; struct gl_texture_image *texImage; GLsizei postConvWidth = width; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); /* XXX should test internal format */ _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); if (copytexsubimage_error_check(ctx, 1, target, level, xoffset, 0, 0, postConvWidth, 1)) return; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); ASSERT(texImage); /* If we have a border, xoffset=-1 is legal. Bias by border width */ xoffset += texImage->Border; ASSERT(ctx->Driver.CopyTexSubImage1D); (*ctx->Driver.CopyTexSubImage1D)(ctx, target, level, xoffset, x, y, width); ctx->NewState |= _NEW_TEXTURE; } void GLAPIENTRY _mesa_CopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) { struct gl_texture_unit *texUnit; struct gl_texture_image *texImage; GLsizei postConvWidth = width, postConvHeight = height; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); /* XXX should test internal format */ _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); if (copytexsubimage_error_check(ctx, 2, target, level, xoffset, yoffset, 0, postConvWidth, postConvHeight)) return; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); ASSERT(texImage); /* If we have a border, xoffset=-1 is legal. Bias by border width */ xoffset += texImage->Border; yoffset += texImage->Border; ASSERT(ctx->Driver.CopyTexSubImage2D); (*ctx->Driver.CopyTexSubImage2D)(ctx, target, level, xoffset, yoffset, x, y, width, height); ctx->NewState |= _NEW_TEXTURE; } void GLAPIENTRY _mesa_CopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) { struct gl_texture_unit *texUnit; struct gl_texture_image *texImage; GLsizei postConvWidth = width, postConvHeight = height; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); /* XXX should test internal format */ _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); if (copytexsubimage_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, postConvWidth, postConvHeight)) return; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); ASSERT(texImage); /* If we have a border, xoffset=-1 is legal. Bias by border width */ xoffset += texImage->Border; yoffset += texImage->Border; zoffset += texImage->Border; ASSERT(ctx->Driver.CopyTexSubImage3D); (*ctx->Driver.CopyTexSubImage3D)(ctx, target, level, xoffset, yoffset, zoffset, x, y, width, height); ctx->NewState |= _NEW_TEXTURE; } /**********************************************************************/ /****** Compressed Textures ******/ /**********************************************************************/ /** * Error checking for glCompressedTexImage[123]D(). * \return error code or GL_NO_ERROR. */ static GLenum compressed_texture_error_check(GLcontext *ctx, GLint dimensions, GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize) { GLint expectedSize, maxLevels = 0, maxTextureSize; if (dimensions == 1) { /* 1D compressed textures not allowed */ return GL_INVALID_ENUM; } else if (dimensions == 2) { if (target == GL_PROXY_TEXTURE_2D) { maxLevels = ctx->Const.MaxTextureLevels; } else if (target == GL_TEXTURE_2D) { maxLevels = ctx->Const.MaxTextureLevels; } else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) { if (!ctx->Extensions.ARB_texture_cube_map) return GL_INVALID_ENUM; /*target*/ maxLevels = ctx->Const.MaxCubeTextureLevels; } else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { if (!ctx->Extensions.ARB_texture_cube_map) return GL_INVALID_ENUM; /*target*/ maxLevels = ctx->Const.MaxCubeTextureLevels; } else { return GL_INVALID_ENUM; /*target*/ } } else if (dimensions == 3) { /* 3D compressed textures not allowed */ return GL_INVALID_ENUM; } maxTextureSize = 1 << (maxLevels - 1); if (!is_compressed_format(ctx, internalFormat)) return GL_INVALID_ENUM; if (_mesa_base_tex_format(ctx, internalFormat) < 0) return GL_INVALID_ENUM; if (border != 0) return GL_INVALID_VALUE; /* * XXX We should probably use the proxy texture error check function here. */ if (width < 1 || width > maxTextureSize || (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(width) != 1)) return GL_INVALID_VALUE; if ((height < 1 || height > maxTextureSize || (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(height) != 1)) && dimensions > 1) return GL_INVALID_VALUE; if ((depth < 1 || depth > maxTextureSize || (!ctx->Extensions.ARB_texture_non_power_of_two && _mesa_bitcount(depth) != 1)) && dimensions > 2) return GL_INVALID_VALUE; /* For cube map, width must equal height */ if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB && width != height) return GL_INVALID_VALUE; if (level < 0 || level >= maxLevels) return GL_INVALID_VALUE; expectedSize = ctx->Driver.CompressedTextureSize(ctx, width, height, depth, internalFormat); if (expectedSize != imageSize) return GL_INVALID_VALUE; return GL_NO_ERROR; } /** * Error checking for glCompressedTexSubImage[123]D(). * \warning There are some bad assumptions here about the size of compressed * texture tiles (multiple of 4) used to test the validity of the * offset and size parameters. * \return error code or GL_NO_ERROR. */ static GLenum compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize) { GLint expectedSize, maxLevels = 0, maxTextureSize; (void) zoffset; if (dimensions == 1) { /* 1D compressed textures not allowed */ return GL_INVALID_ENUM; } else if (dimensions == 2) { if (target == GL_PROXY_TEXTURE_2D) { maxLevels = ctx->Const.MaxTextureLevels; } else if (target == GL_TEXTURE_2D) { maxLevels = ctx->Const.MaxTextureLevels; } else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) { if (!ctx->Extensions.ARB_texture_cube_map) return GL_INVALID_ENUM; /*target*/ maxLevels = ctx->Const.MaxCubeTextureLevels; } else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { if (!ctx->Extensions.ARB_texture_cube_map) return GL_INVALID_ENUM; /*target*/ maxLevels = ctx->Const.MaxCubeTextureLevels; } else { return GL_INVALID_ENUM; /*target*/ } } else if (dimensions == 3) { /* 3D compressed textures not allowed */ return GL_INVALID_ENUM; } maxTextureSize = 1 << (maxLevels - 1); if (!is_compressed_format(ctx, format)) return GL_INVALID_ENUM; if (width < 1 || width > maxTextureSize) return GL_INVALID_VALUE; if ((height < 1 || height > maxTextureSize) && dimensions > 1) return GL_INVALID_VALUE; if (level < 0 || level >= maxLevels) return GL_INVALID_VALUE; /* XXX these tests are specific to the compressed format. * this code should be generalized in some way. */ if ((xoffset & 3) != 0 || (yoffset & 3) != 0) return GL_INVALID_VALUE; if ((width & 3) != 0 && width != 2 && width != 1) return GL_INVALID_VALUE; if ((height & 3) != 0 && height != 2 && height != 1) return GL_INVALID_VALUE; expectedSize = ctx->Driver.CompressedTextureSize(ctx, width, height, depth, format); if (expectedSize != imageSize) return GL_INVALID_VALUE; return GL_NO_ERROR; } void GLAPIENTRY _mesa_CompressedTexImage1DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target == GL_TEXTURE_1D) { /* non-proxy target */ struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLenum error = compressed_texture_error_check(ctx, 1, target, level, internalFormat, width, 1, 1, border, imageSize); if (error) { _mesa_error(ctx, error, "glCompressedTexImage1D"); return; } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_get_tex_image(ctx, texUnit, target, level); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1D"); return; } else if (texImage->Data) { ctx->Driver.FreeTexImageData( ctx, texImage ); } ASSERT(texImage->Data == NULL); _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, border, internalFormat); ASSERT(ctx->Driver.CompressedTexImage1D); (*ctx->Driver.CompressedTexImage1D)(ctx, target, level, internalFormat, width, border, imageSize, data, texObj, texImage); /* state update */ texObj->Complete = GL_FALSE; ctx->NewState |= _NEW_TEXTURE; } else if (target == GL_PROXY_TEXTURE_1D) { /* Proxy texture: check for errors and update proxy state */ GLenum error = compressed_texture_error_check(ctx, 1, target, level, internalFormat, width, 1, 1, border, imageSize); if (!error) { ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, internalFormat, GL_NONE, GL_NONE, width, 1, 1, border); } if (error) { /* if error, clear all proxy texture image parameters */ struct gl_texture_image *texImage; texImage = _mesa_get_proxy_tex_image(ctx, target, level); if (texImage) clear_teximage_fields(texImage); } else { /* store the teximage parameters */ struct gl_texture_unit *texUnit; struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, border, internalFormat); } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage1D(target)"); return; } } void GLAPIENTRY _mesa_CompressedTexImage2DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target == GL_TEXTURE_2D || (ctx->Extensions.ARB_texture_cube_map && target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { /* non-proxy target */ struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLenum error = compressed_texture_error_check(ctx, 2, target, level, internalFormat, width, height, 1, border, imageSize); if (error) { _mesa_error(ctx, error, "glCompressedTexImage2D"); return; } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_get_tex_image(ctx, texUnit, target, level); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); return; } else if (texImage->Data) { ctx->Driver.FreeTexImageData( ctx, texImage ); } ASSERT(texImage->Data == NULL); _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, border, internalFormat); ASSERT(ctx->Driver.CompressedTexImage2D); (*ctx->Driver.CompressedTexImage2D)(ctx, target, level, internalFormat, width, height, border, imageSize, data, texObj, texImage); /* state update */ texObj->Complete = GL_FALSE; ctx->NewState |= _NEW_TEXTURE; } else if (target == GL_PROXY_TEXTURE_2D || (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB && ctx->Extensions.ARB_texture_cube_map)) { /* Proxy texture: check for errors and update proxy state */ GLenum error = compressed_texture_error_check(ctx, 2, target, level, internalFormat, width, height, 1, border, imageSize); if (!error) { ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, internalFormat, GL_NONE, GL_NONE, width, height, 1, border); } if (error) { /* if error, clear all proxy texture image parameters */ struct gl_texture_image *texImage; texImage = _mesa_get_proxy_tex_image(ctx, target, level); if (texImage) clear_teximage_fields(texImage); } else { /* store the teximage parameters */ struct gl_texture_unit *texUnit; struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, border, internalFormat); } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage2D(target)"); return; } } void GLAPIENTRY _mesa_CompressedTexImage3DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target == GL_TEXTURE_3D) { /* non-proxy target */ struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLenum error = compressed_texture_error_check(ctx, 3, target, level, internalFormat, width, height, depth, border, imageSize); if (error) { _mesa_error(ctx, error, "glCompressedTexImage3D"); return; } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_get_tex_image(ctx, texUnit, target, level); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3D"); return; } else if (texImage->Data) { ctx->Driver.FreeTexImageData( ctx, texImage ); } ASSERT(texImage->Data == NULL); _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, border, internalFormat); ASSERT(ctx->Driver.CompressedTexImage3D); (*ctx->Driver.CompressedTexImage3D)(ctx, target, level, internalFormat, width, height, depth, border, imageSize, data, texObj, texImage); /* state update */ texObj->Complete = GL_FALSE; ctx->NewState |= _NEW_TEXTURE; } else if (target == GL_PROXY_TEXTURE_3D) { /* Proxy texture: check for errors and update proxy state */ GLenum error = compressed_texture_error_check(ctx, 3, target, level, internalFormat, width, height, depth, border, imageSize); if (!error) { ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, internalFormat, GL_NONE, GL_NONE, width, height, depth, border); } if (error) { /* if error, clear all proxy texture image parameters */ struct gl_texture_image *texImage; texImage = _mesa_get_proxy_tex_image(ctx, target, level); if (texImage) clear_teximage_fields(texImage); } else { /* store the teximage parameters */ struct gl_texture_unit *texUnit; struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texImage = _mesa_select_tex_image(ctx, texUnit, target, level); _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, border, internalFormat); } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage3D(target)"); return; } } void GLAPIENTRY _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLenum error; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); error = compressed_subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, width, 1, 1, format, imageSize); if (error) { _mesa_error(ctx, error, "glCompressedTexSubImage1D"); return; } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); assert(texImage); if ((GLint) format != texImage->IntFormat) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCompressedTexSubImage1D(format)"); return; } if ((width == 1 || width == 2) && (GLuint) width != texImage->Width) { _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage1D(width)"); return; } if (width == 0) return; /* no-op, not an error */ if (ctx->Driver.CompressedTexSubImage1D) { (*ctx->Driver.CompressedTexSubImage1D)(ctx, target, level, xoffset, width, format, imageSize, data, texObj, texImage); } ctx->NewState |= _NEW_TEXTURE; } void GLAPIENTRY _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLenum error; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); error = compressed_subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, width, height, 1, format, imageSize); if (error) { /* XXX proxy target? */ _mesa_error(ctx, error, "glCompressedTexSubImage2D"); return; } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); assert(texImage); if ((GLint) format != texImage->IntFormat) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCompressedTexSubImage2D(format)"); return; } if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) || ((height == 1 || height == 2) && (GLuint) height != texImage->Height)) { _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage2D(size)"); return; } if (width == 0 || height == 0) return; /* no-op, not an error */ if (ctx->Driver.CompressedTexSubImage2D) { (*ctx->Driver.CompressedTexSubImage2D)(ctx, target, level, xoffset, yoffset, width, height, format, imageSize, data, texObj, texImage); } ctx->NewState |= _NEW_TEXTURE; } void GLAPIENTRY _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLenum error; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); error = compressed_subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize); if (error) { _mesa_error(ctx, error, "glCompressedTexSubImage2D"); return; } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); assert(texImage); if ((GLint) format != texImage->IntFormat) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCompressedTexSubImage3D(format)"); return; } if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) || ((height == 1 || height == 2) && (GLuint) height != texImage->Height) || ((depth == 1 || depth == 2) && (GLuint) depth != texImage->Depth)) { _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage3D(size)"); return; } if (width == 0 || height == 0 || depth == 0) return; /* no-op, not an error */ if (ctx->Driver.CompressedTexSubImage3D) { (*ctx->Driver.CompressedTexSubImage3D)(ctx, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data, texObj, texImage); } ctx->NewState |= _NEW_TEXTURE; } void GLAPIENTRY _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) { const struct gl_texture_unit *texUnit; const struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLint maxLevels; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); if (!texObj) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB"); return; } maxLevels = _mesa_max_texture_levels(ctx, target); ASSERT(maxLevels > 0); /* 0 indicates bad target, caught above */ if (level < 0 || level >= maxLevels) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)"); return; } if (is_proxy_target(target)) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)"); return; } texImage = _mesa_select_tex_image(ctx, texUnit, target, level); if (!texImage) { /* probably invalid mipmap level */ _mesa_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)"); return; } if (!texImage->IsCompressed) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetCompressedTexImageARB"); return; } /* this typically calls _mesa_get_compressed_teximage() */ ctx->Driver.GetCompressedTexImage(ctx, target, level, img, texObj,texImage); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/teximage.h0000644000000000000000000001762713614532424020132 0ustar /** * \file teximage.h * Texture images manipulation functions. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef TEXIMAGE_H #define TEXIMAGE_H #include "mtypes.h" extern void * _mesa_alloc_texmemory(GLsizei bytes); extern void _mesa_free_texmemory(void *m); /** \name Internal functions */ /*@{*/ extern GLint _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat ); extern struct gl_texture_image * _mesa_new_texture_image( GLcontext *ctx ); extern void _mesa_delete_texture_image( GLcontext *ctx, struct gl_texture_image *teximage ); extern void _mesa_free_texture_image_data( GLcontext *ctx, struct gl_texture_image *texImage ); extern void _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, struct gl_texture_image *img, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat); extern void _mesa_set_tex_image(struct gl_texture_object *tObj, GLenum target, GLint level, struct gl_texture_image *texImage); extern struct gl_texture_object * _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, GLenum target); extern struct gl_texture_image * _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, GLenum target, GLint level); extern struct gl_texture_image * _mesa_get_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, GLenum target, GLint level); extern struct gl_texture_image * _mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level); extern GLint _mesa_max_texture_levels(GLcontext *ctx, GLenum target); extern GLboolean _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLenum format, GLenum type, GLint width, GLint height, GLint depth, GLint border); /*@}*/ /** \name API entry point functions */ /*@{*/ extern void GLAPIENTRY _mesa_TexImage1D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); extern void GLAPIENTRY _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); extern void GLAPIENTRY _mesa_TexImage3D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); extern void GLAPIENTRY _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); extern void GLAPIENTRY _mesa_GetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ); extern void GLAPIENTRY _mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels ); extern void GLAPIENTRY _mesa_TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); extern void GLAPIENTRY _mesa_TexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels ); extern void GLAPIENTRY _mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border ); extern void GLAPIENTRY _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ); extern void GLAPIENTRY _mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); extern void GLAPIENTRY _mesa_CopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); extern void GLAPIENTRY _mesa_CopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); extern void GLAPIENTRY _mesa_CompressedTexImage1DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); extern void GLAPIENTRY _mesa_CompressedTexImage2DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); extern void GLAPIENTRY _mesa_CompressedTexImage3DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); #ifdef VMS #define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR #define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR #define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR #endif extern void GLAPIENTRY _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); extern void GLAPIENTRY _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); extern void GLAPIENTRY _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); extern void GLAPIENTRY _mesa_GetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img); /*@}*/ #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texobj.c0000644000000000000000000007656713614532424017625 0ustar /** * \file texobj.c * Texture object management. */ /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "colortab.h" #include "context.h" #include "enums.h" #include "hash.h" #include "imports.h" #include "macros.h" #include "teximage.h" #include "texstate.h" #include "texobj.h" #include "mtypes.h" /**********************************************************************/ /** \name Internal functions */ /*@{*/ /** * Allocate and initialize a new texture object. But don't put it into the * texture object hash table. * * Called via ctx->Driver.NewTextureObject, unless overridden by a device * driver. * * \param shared the shared GL state structure to contain the texture object * \param name integer name for the texture object * \param target either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, * GL_TEXTURE_CUBE_MAP_ARB or GL_TEXTURE_RECTANGLE_NV. zero is ok for the sake * of GenTextures() * * \return pointer to new texture object. */ struct gl_texture_object * _mesa_new_texture_object( GLcontext *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; (void) ctx; obj = MALLOC_STRUCT(gl_texture_object); _mesa_initialize_texture_object(obj, name, target); return obj; } /** * Initialize a new texture object to default values. * \param obj the texture object * \param name the texture name * \param target the texture target */ void _mesa_initialize_texture_object( struct gl_texture_object *obj, GLuint name, GLenum target ) { ASSERT(target == 0 || target == GL_TEXTURE_1D || target == GL_TEXTURE_2D || target == GL_TEXTURE_3D || target == GL_TEXTURE_CUBE_MAP_ARB || target == GL_TEXTURE_RECTANGLE_NV); _mesa_bzero(obj, sizeof(*obj)); /* init the non-zero fields */ _glthread_INIT_MUTEX(obj->Mutex); obj->RefCount = 1; obj->Name = name; obj->Target = target; obj->Priority = 1.0F; if (target == GL_TEXTURE_RECTANGLE_NV) { obj->WrapS = GL_CLAMP_TO_EDGE; obj->WrapT = GL_CLAMP_TO_EDGE; obj->WrapR = GL_CLAMP_TO_EDGE; obj->MinFilter = GL_LINEAR; } else { obj->WrapS = GL_REPEAT; obj->WrapT = GL_REPEAT; obj->WrapR = GL_REPEAT; obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR; } obj->MagFilter = GL_LINEAR; obj->MinLod = -1000.0; obj->MaxLod = 1000.0; obj->LodBias = 0.0; obj->BaseLevel = 0; obj->MaxLevel = 1000; obj->MaxAnisotropy = 1.0; obj->CompareFlag = GL_FALSE; /* SGIX_shadow */ obj->CompareOperator = GL_TEXTURE_LEQUAL_R_SGIX; /* SGIX_shadow */ obj->CompareMode = GL_NONE; /* ARB_shadow */ obj->CompareFunc = GL_LEQUAL; /* ARB_shadow */ obj->DepthMode = GL_LUMINANCE; /* ARB_depth_texture */ obj->ShadowAmbient = 0.0F; /* ARB/SGIX_shadow_ambient */ _mesa_init_colortable(&obj->Palette); } /** * Deallocate a texture object struct. It should have already been * removed from the texture object pool. * * \param shared the shared GL state to which the object belongs. * \param texOjb the texture object to delete. */ void _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) { GLuint i, face; (void) ctx; _mesa_free_colortable_data(&texObj->Palette); /* free the texture images */ for (face = 0; face < 6; face++) { for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { if (texObj->Image[face][i]) { _mesa_delete_texture_image( ctx, texObj->Image[face][i] ); } } } /* destroy the mutex -- it may have allocated memory (eg on bsd) */ _glthread_DESTROY_MUTEX(texObj->Mutex); /* free this object */ _mesa_free(texObj); } /** * Copy texture object state from one texture object to another. * Use for glPush/PopAttrib. * * \param dest destination texture object. * \param src source texture object. */ void _mesa_copy_texture_object( struct gl_texture_object *dest, const struct gl_texture_object *src ) { dest->Name = src->Name; dest->Priority = src->Priority; dest->BorderColor[0] = src->BorderColor[0]; dest->BorderColor[1] = src->BorderColor[1]; dest->BorderColor[2] = src->BorderColor[2]; dest->BorderColor[3] = src->BorderColor[3]; dest->WrapS = src->WrapS; dest->WrapT = src->WrapT; dest->WrapR = src->WrapR; dest->MinFilter = src->MinFilter; dest->MagFilter = src->MagFilter; dest->MinLod = src->MinLod; dest->MaxLod = src->MaxLod; dest->LodBias = src->LodBias; dest->BaseLevel = src->BaseLevel; dest->MaxLevel = src->MaxLevel; dest->MaxAnisotropy = src->MaxAnisotropy; dest->CompareFlag = src->CompareFlag; dest->CompareOperator = src->CompareOperator; dest->ShadowAmbient = src->ShadowAmbient; dest->CompareMode = src->CompareMode; dest->CompareFunc = src->CompareFunc; dest->DepthMode = src->DepthMode; dest->_MaxLevel = src->_MaxLevel; dest->_MaxLambda = src->_MaxLambda; dest->GenerateMipmap = src->GenerateMipmap; dest->Palette = src->Palette; dest->Complete = src->Complete; dest->_IsPowerOfTwo = src->_IsPowerOfTwo; } /** * Report why a texture object is incomplete. * * \param t texture object. * \param why string describing why it's incomplete. * * \note For debug purposes only. */ #if 0 static void incomplete(const struct gl_texture_object *t, const char *why) { _mesa_printf("Texture Obj %d incomplete because: %s\n", t->Name, why); } #else #define incomplete(t, why) #endif /** * Examine a texture object to determine if it is complete. * * The gl_texture_object::Complete flag will be set to GL_TRUE or GL_FALSE * accordingly. * * \param ctx GL context. * \param t texture object. * * According to the texture target, verifies that each of the mipmaps is * present and has the expected size. */ void _mesa_test_texobj_completeness( const GLcontext *ctx, struct gl_texture_object *t ) { const GLint baseLevel = t->BaseLevel; GLint maxLog2 = 0, maxLevels = 0; t->Complete = GL_TRUE; /* be optimistic */ t->_IsPowerOfTwo = GL_TRUE; /* may be set FALSE below */ /* Always need the base level image */ if (!t->Image[0][baseLevel]) { char s[100]; sprintf(s, "obj %p (%d) Image[baseLevel=%d] == NULL", (void *) t, t->Name, baseLevel); incomplete(t, s); t->Complete = GL_FALSE; return; } /* Check width/height/depth for zero */ if (t->Image[0][baseLevel]->Width == 0 || t->Image[0][baseLevel]->Height == 0 || t->Image[0][baseLevel]->Depth == 0) { incomplete(t, "texture width = 0"); t->Complete = GL_FALSE; return; } /* Compute _MaxLevel */ if (t->Target == GL_TEXTURE_1D) { maxLog2 = t->Image[0][baseLevel]->WidthLog2; maxLevels = ctx->Const.MaxTextureLevels; } else if (t->Target == GL_TEXTURE_2D) { maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2, t->Image[0][baseLevel]->HeightLog2); maxLevels = ctx->Const.MaxTextureLevels; } else if (t->Target == GL_TEXTURE_3D) { GLint max = MAX2(t->Image[0][baseLevel]->WidthLog2, t->Image[0][baseLevel]->HeightLog2); maxLog2 = MAX2(max, (GLint)(t->Image[0][baseLevel]->DepthLog2)); maxLevels = ctx->Const.Max3DTextureLevels; } else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) { maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2, t->Image[0][baseLevel]->HeightLog2); maxLevels = ctx->Const.MaxCubeTextureLevels; } else if (t->Target == GL_TEXTURE_RECTANGLE_NV) { maxLog2 = 0; /* not applicable */ maxLevels = 1; /* no mipmapping */ } else { _mesa_problem(ctx, "Bad t->Target in _mesa_test_texobj_completeness"); return; } ASSERT(maxLevels > 0); t->_MaxLevel = baseLevel + maxLog2; t->_MaxLevel = MIN2(t->_MaxLevel, t->MaxLevel); t->_MaxLevel = MIN2(t->_MaxLevel, maxLevels - 1); /* Compute _MaxLambda = q - b (see the 1.2 spec) used during mipmapping */ t->_MaxLambda = (GLfloat) (t->_MaxLevel - t->BaseLevel); if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) { /* make sure that all six cube map level 0 images are the same size */ const GLuint w = t->Image[0][baseLevel]->Width2; const GLuint h = t->Image[0][baseLevel]->Height2; GLuint face; for (face = 1; face < 6; face++) { if (t->Image[face][baseLevel] == NULL || t->Image[face][baseLevel]->Width2 != w || t->Image[face][baseLevel]->Height2 != h) { t->Complete = GL_FALSE; incomplete(t, "Non-quare cubemap image"); return; } } } /* check for non power of two */ if (!t->Image[0][baseLevel]->_IsPowerOfTwo) { t->_IsPowerOfTwo = GL_FALSE; } /* extra checking for mipmaps */ if (t->MinFilter != GL_NEAREST && t->MinFilter != GL_LINEAR) { /* * Mipmapping: determine if we have a complete set of mipmaps */ GLint i; GLint minLevel = baseLevel; GLint maxLevel = t->_MaxLevel; if (minLevel > maxLevel) { t->Complete = GL_FALSE; incomplete(t, "minLevel > maxLevel"); return; } /* Test dimension-independent attributes */ for (i = minLevel; i <= maxLevel; i++) { if (t->Image[0][i]) { if (t->Image[0][i]->TexFormat != t->Image[0][baseLevel]->TexFormat) { t->Complete = GL_FALSE; incomplete(t, "Format[i] != Format[baseLevel]"); return; } if (t->Image[0][i]->Border != t->Image[0][baseLevel]->Border) { t->Complete = GL_FALSE; incomplete(t, "Border[i] != Border[baseLevel]"); return; } } } /* Test things which depend on number of texture image dimensions */ if (t->Target == GL_TEXTURE_1D) { /* Test 1-D mipmaps */ GLuint width = t->Image[0][baseLevel]->Width2; for (i = baseLevel + 1; i < maxLevels; i++) { if (width > 1) { width /= 2; } if (i >= minLevel && i <= maxLevel) { if (!t->Image[0][i]) { t->Complete = GL_FALSE; incomplete(t, "1D Image[0][i] == NULL"); return; } if (t->Image[0][i]->Width2 != width ) { t->Complete = GL_FALSE; incomplete(t, "1D Image[0][i] bad width"); return; } } if (width == 1) { return; /* found smallest needed mipmap, all done! */ } } } else if (t->Target == GL_TEXTURE_2D) { /* Test 2-D mipmaps */ GLuint width = t->Image[0][baseLevel]->Width2; GLuint height = t->Image[0][baseLevel]->Height2; for (i = baseLevel + 1; i < maxLevels; i++) { if (width > 1) { width /= 2; } if (height > 1) { height /= 2; } if (i >= minLevel && i <= maxLevel) { if (!t->Image[0][i]) { t->Complete = GL_FALSE; incomplete(t, "2D Image[0][i] == NULL"); return; } if (t->Image[0][i]->Width2 != width) { t->Complete = GL_FALSE; incomplete(t, "2D Image[0][i] bad width"); return; } if (t->Image[0][i]->Height2 != height) { t->Complete = GL_FALSE; incomplete(t, "2D Image[0][i] bad height"); return; } if (width==1 && height==1) { return; /* found smallest needed mipmap, all done! */ } } } } else if (t->Target == GL_TEXTURE_3D) { /* Test 3-D mipmaps */ GLuint width = t->Image[0][baseLevel]->Width2; GLuint height = t->Image[0][baseLevel]->Height2; GLuint depth = t->Image[0][baseLevel]->Depth2; for (i = baseLevel + 1; i < maxLevels; i++) { if (width > 1) { width /= 2; } if (height > 1) { height /= 2; } if (depth > 1) { depth /= 2; } if (i >= minLevel && i <= maxLevel) { if (!t->Image[0][i]) { incomplete(t, "3D Image[0][i] == NULL"); t->Complete = GL_FALSE; return; } if (t->Image[0][i]->Format == GL_DEPTH_COMPONENT) { t->Complete = GL_FALSE; incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex"); return; } if (t->Image[0][i]->Width2 != width) { t->Complete = GL_FALSE; incomplete(t, "3D Image[0][i] bad width"); return; } if (t->Image[0][i]->Height2 != height) { t->Complete = GL_FALSE; incomplete(t, "3D Image[0][i] bad height"); return; } if (t->Image[0][i]->Depth2 != depth) { t->Complete = GL_FALSE; incomplete(t, "3D Image[0][i] bad depth"); return; } } if (width == 1 && height == 1 && depth == 1) { return; /* found smallest needed mipmap, all done! */ } } } else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) { /* make sure 6 cube faces are consistant */ GLuint width = t->Image[0][baseLevel]->Width2; GLuint height = t->Image[0][baseLevel]->Height2; for (i = baseLevel + 1; i < maxLevels; i++) { if (width > 1) { width /= 2; } if (height > 1) { height /= 2; } if (i >= minLevel && i <= maxLevel) { GLuint face; for (face = 0; face < 6; face++) { /* check that we have images defined */ if (!t->Image[face][i]) { t->Complete = GL_FALSE; incomplete(t, "CubeMap Image[n][i] == NULL"); return; } /* Don't support GL_DEPTH_COMPONENT for cube maps */ if (t->Image[face][i]->Format == GL_DEPTH_COMPONENT) { t->Complete = GL_FALSE; incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex"); return; } /* check that all six images have same size */ if (t->Image[face][i]->Width2!=width || t->Image[face][i]->Height2!=height) { t->Complete = GL_FALSE; incomplete(t, "CubeMap Image[n][i] bad size"); return; } } } if (width == 1 && height == 1) { return; /* found smallest needed mipmap, all done! */ } } } else if (t->Target == GL_TEXTURE_RECTANGLE_NV) { /* XXX special checking? */ } else { /* Target = ??? */ _mesa_problem(ctx, "Bug in gl_test_texture_object_completeness\n"); } } } /*@}*/ /***********************************************************************/ /** \name API functions */ /*@{*/ /** * Texture name generation lock. * * Used by _mesa_GenTextures() to guarantee that the generation and allocation * of texture IDs is atomic. */ _glthread_DECLARE_STATIC_MUTEX(GenTexturesLock); /** * Generate texture names. * * \param n number of texture names to be generated. * \param textures an array in which will hold the generated texture names. * * \sa glGenTextures(). * * While holding the GenTexturesLock lock, calls _mesa_HashFindFreeKeyBlock() * to find a block of free texture IDs which are stored in \p textures. * Corresponding empty texture objects are also generated. */ void GLAPIENTRY _mesa_GenTextures( GLsizei n, GLuint *textures ) { GET_CURRENT_CONTEXT(ctx); GLuint first; GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx); if (n < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glGenTextures" ); return; } if (!textures) return; /* * This must be atomic (generation and allocation of texture IDs) */ _glthread_LOCK_MUTEX(GenTexturesLock); first = _mesa_HashFindFreeKeyBlock(ctx->Shared->TexObjects, n); /* Allocate new, empty texture objects */ for (i = 0; i < n; i++) { struct gl_texture_object *texObj; GLuint name = first + i; GLenum target = 0; texObj = (*ctx->Driver.NewTextureObject)( ctx, name, target); if (!texObj) { _glthread_UNLOCK_MUTEX(GenTexturesLock); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTextures"); return; } /* insert into hash table */ _glthread_LOCK_MUTEX(ctx->Shared->Mutex); _mesa_HashInsert(ctx->Shared->TexObjects, texObj->Name, texObj); _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); textures[i] = name; } _glthread_UNLOCK_MUTEX(GenTexturesLock); } /** * Delete named textures. * * \param n number of textures to be deleted. * \param textures array of texture IDs to be deleted. * * \sa glDeleteTextures(). * * If we're about to delete a texture that's currently bound to any * texture unit, unbind the texture first. Decrement the reference * count on the texture object and delete it if it's zero. * Recall that texture objects can be shared among several rendering * contexts. */ void GLAPIENTRY _mesa_DeleteTextures( GLsizei n, const GLuint *textures) { GET_CURRENT_CONTEXT(ctx); GLint i; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */ if (!textures) return; for (i = 0; i < n; i++) { if (textures[i] > 0) { struct gl_texture_object *delObj = (struct gl_texture_object *) _mesa_HashLookup(ctx->Shared->TexObjects, textures[i]); if (delObj) { /* First check if this texture is currently bound. * If so, unbind it and decrement the reference count. * XXX all RefCount accesses should be protected by a mutex. */ GLuint u; for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) { struct gl_texture_unit *unit = &ctx->Texture.Unit[u]; if (delObj == unit->Current1D) { unit->Current1D = ctx->Shared->Default1D; ctx->Shared->Default1D->RefCount++; delObj->RefCount--; if (delObj == unit->_Current) unit->_Current = unit->Current1D; } else if (delObj == unit->Current2D) { unit->Current2D = ctx->Shared->Default2D; ctx->Shared->Default2D->RefCount++; delObj->RefCount--; if (delObj == unit->_Current) unit->_Current = unit->Current2D; } else if (delObj == unit->Current3D) { unit->Current3D = ctx->Shared->Default3D; ctx->Shared->Default3D->RefCount++; delObj->RefCount--; if (delObj == unit->_Current) unit->_Current = unit->Current3D; } else if (delObj == unit->CurrentCubeMap) { unit->CurrentCubeMap = ctx->Shared->DefaultCubeMap; ctx->Shared->DefaultCubeMap->RefCount++; delObj->RefCount--; if (delObj == unit->_Current) unit->_Current = unit->CurrentCubeMap; } else if (delObj == unit->CurrentRect) { unit->CurrentRect = ctx->Shared->DefaultRect; ctx->Shared->DefaultRect->RefCount++; delObj->RefCount--; if (delObj == unit->_Current) unit->_Current = unit->CurrentRect; } } ctx->NewState |= _NEW_TEXTURE; /* The texture _name_ is now free for re-use. * Remove it from the hash table now. */ _glthread_LOCK_MUTEX(ctx->Shared->Mutex); _mesa_HashRemove(ctx->Shared->TexObjects, delObj->Name); _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); /* The actual texture object will not be freed until it's no * longer bound in any context. * XXX all RefCount accesses should be protected by a mutex. */ delObj->RefCount--; if (delObj->RefCount == 0) { ASSERT(delObj->Name != 0); /* Never delete default tex objs */ ASSERT(ctx->Driver.DeleteTexture); (*ctx->Driver.DeleteTexture)(ctx, delObj); } } } } } /** * Bind a named texture to a texturing target. * * \param target texture target. * \param texName texture name. * * \sa glBindTexture(). * * Determines the old texture object bound and returns immediately if rebinding * the same texture. Get the current texture which is either a default texture * if name is null, a named texture from the hash, or a new texture if the * given texture name is new. Increments its reference count, binds it, and * calls dd_function_table::BindTexture. Decrements the old texture reference * count and deletes it if it reaches zero. */ void GLAPIENTRY _mesa_BindTexture( GLenum target, GLuint texName ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; struct gl_texture_object *oldTexObj; struct gl_texture_object *newTexObj = NULL; ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glBindTexture %s %d\n", _mesa_lookup_enum_by_nr(target), (GLint) texName); /* * Get pointer to currently bound texture object (oldTexObj) */ switch (target) { case GL_TEXTURE_1D: oldTexObj = texUnit->Current1D; break; case GL_TEXTURE_2D: oldTexObj = texUnit->Current2D; break; case GL_TEXTURE_3D: oldTexObj = texUnit->Current3D; break; case GL_TEXTURE_CUBE_MAP_ARB: if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); return; } oldTexObj = texUnit->CurrentCubeMap; break; case GL_TEXTURE_RECTANGLE_NV: if (!ctx->Extensions.NV_texture_rectangle) { _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); return; } oldTexObj = texUnit->CurrentRect; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); return; } if (oldTexObj->Name == texName) /* XXX this might be wrong. If the texobj is in use by another * context and a texobj parameter was changed, this might be our * only chance to update this context's hardware state. */ return; /* rebinding the same texture- no change */ /* * Get pointer to new texture object (newTexObj) */ if (texName == 0) { /* newTexObj = a default texture object */ switch (target) { case GL_TEXTURE_1D: newTexObj = ctx->Shared->Default1D; break; case GL_TEXTURE_2D: newTexObj = ctx->Shared->Default2D; break; case GL_TEXTURE_3D: newTexObj = ctx->Shared->Default3D; break; case GL_TEXTURE_CUBE_MAP_ARB: newTexObj = ctx->Shared->DefaultCubeMap; break; case GL_TEXTURE_RECTANGLE_NV: newTexObj = ctx->Shared->DefaultRect; break; default: ; /* Bad targets are caught above */ } } else { /* non-default texture object */ const struct _mesa_HashTable *hash = ctx->Shared->TexObjects; newTexObj = (struct gl_texture_object *) _mesa_HashLookup(hash, texName); if (newTexObj) { /* error checking */ if (newTexObj->Target != 0 && newTexObj->Target != target) { /* the named texture object's dimensions don't match the target */ _mesa_error( ctx, GL_INVALID_OPERATION, "glBindTexture(wrong dimensionality)" ); return; } if (newTexObj->Target == 0 && target == GL_TEXTURE_RECTANGLE_NV) { /* have to init wrap and filter state here - kind of klunky */ newTexObj->WrapS = GL_CLAMP_TO_EDGE; newTexObj->WrapT = GL_CLAMP_TO_EDGE; newTexObj->WrapR = GL_CLAMP_TO_EDGE; newTexObj->MinFilter = GL_LINEAR; if (ctx->Driver.TexParameter) { static const GLfloat fparam_wrap[1] = {(GLfloat) GL_CLAMP_TO_EDGE}; static const GLfloat fparam_filter[1] = {(GLfloat) GL_LINEAR}; (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_WRAP_S, fparam_wrap ); (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_WRAP_T, fparam_wrap ); (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_WRAP_R, fparam_wrap ); (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_MIN_FILTER, fparam_filter ); } } } else { /* if this is a new texture id, allocate a texture object now */ newTexObj = (*ctx->Driver.NewTextureObject)(ctx, texName, target); if (!newTexObj) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture"); return; } /* and insert it into hash table */ _glthread_LOCK_MUTEX(ctx->Shared->Mutex); _mesa_HashInsert(ctx->Shared->TexObjects, texName, newTexObj); _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); } newTexObj->Target = target; } /* XXX all RefCount accesses should be protected by a mutex. */ newTexObj->RefCount++; /* do the actual binding, but first flush outstanding vertices: */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); switch (target) { case GL_TEXTURE_1D: texUnit->Current1D = newTexObj; break; case GL_TEXTURE_2D: texUnit->Current2D = newTexObj; break; case GL_TEXTURE_3D: texUnit->Current3D = newTexObj; break; case GL_TEXTURE_CUBE_MAP_ARB: texUnit->CurrentCubeMap = newTexObj; break; case GL_TEXTURE_RECTANGLE_NV: texUnit->CurrentRect = newTexObj; break; default: _mesa_problem(ctx, "bad target in BindTexture"); return; } /* Pass BindTexture call to device driver */ if (ctx->Driver.BindTexture) (*ctx->Driver.BindTexture)( ctx, target, newTexObj ); /* Decrement the reference count on the old texture and check if it's * time to delete it. */ /* XXX all RefCount accesses should be protected by a mutex. */ oldTexObj->RefCount--; ASSERT(oldTexObj->RefCount >= 0); if (oldTexObj->RefCount == 0) { ASSERT(oldTexObj->Name != 0); ASSERT(ctx->Driver.DeleteTexture); (*ctx->Driver.DeleteTexture)( ctx, oldTexObj ); } } /** * Set texture priorities. * * \param n number of textures. * \param texName texture names. * \param priorities corresponding texture priorities. * * \sa glPrioritizeTextures(). * * Looks up each texture in the hash, clamps the corresponding priority between * 0.0 and 1.0, and calls dd_function_table::PrioritizeTexture. */ void GLAPIENTRY _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, const GLclampf *priorities ) { GET_CURRENT_CONTEXT(ctx); GLint i; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (n < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" ); return; } if (!priorities) return; for (i = 0; i < n; i++) { if (texName[i] > 0) { struct gl_texture_object *t = (struct gl_texture_object *) _mesa_HashLookup(ctx->Shared->TexObjects, texName[i]); if (t) { t->Priority = CLAMP( priorities[i], 0.0F, 1.0F ); if (ctx->Driver.PrioritizeTexture) ctx->Driver.PrioritizeTexture( ctx, t, t->Priority ); } } } ctx->NewState |= _NEW_TEXTURE; } /** * See if textures are loaded in texture memory. * * \param n number of textures to query. * \param texName array with the texture names. * \param residences array which will hold the residence status. * * \return GL_TRUE if all textures are resident and \p residences is left unchanged, * * \sa glAreTexturesResident(). * * Looks up each texture in the hash and calls * dd_function_table::IsTextureResident. */ GLboolean GLAPIENTRY _mesa_AreTexturesResident(GLsizei n, const GLuint *texName, GLboolean *residences) { GET_CURRENT_CONTEXT(ctx); GLboolean allResident = GL_TRUE; GLint i, j; ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)"); return GL_FALSE; } if (!texName || !residences) return GL_FALSE; for (i = 0; i < n; i++) { struct gl_texture_object *t; if (texName[i] == 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident"); return GL_FALSE; } t = (struct gl_texture_object *) _mesa_HashLookup(ctx->Shared->TexObjects, texName[i]); if (!t) { _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident"); return GL_FALSE; } if (!ctx->Driver.IsTextureResident || ctx->Driver.IsTextureResident(ctx, t)) { /* The texture is resident */ if (!allResident) residences[i] = GL_TRUE; } else { /* The texture is not resident */ if (allResident) { allResident = GL_FALSE; for (j = 0; j < i; j++) residences[j] = GL_TRUE; } residences[i] = GL_FALSE; } } return allResident; } /** * See if a name corresponds to a texture. * * \param texture texture name. * * \return GL_TRUE if texture name corresponds to a texture, or GL_FALSE * otherwise. * * \sa glIsTexture(). * * Calls _mesa_HashLookup(). */ GLboolean GLAPIENTRY _mesa_IsTexture( GLuint texture ) { struct gl_texture_object *t; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (!texture) return GL_FALSE; t = (struct gl_texture_object *) _mesa_HashLookup(ctx->Shared->TexObjects, texture); /* IsTexture is true only after object has been bound once. */ return t && t->Target; } /*@}*/ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texobj.h0000644000000000000000000000503413614532424017607 0ustar /** * \file texobj.h * Texture object management. */ /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef TEXTOBJ_H #define TEXTOBJ_H #include "mtypes.h" /** * \name Internal functions */ /*@{*/ extern struct gl_texture_object * _mesa_new_texture_object( GLcontext *ctx, GLuint name, GLenum target ); extern void _mesa_initialize_texture_object( struct gl_texture_object *obj, GLuint name, GLenum target ); extern void _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *obj ); extern void _mesa_copy_texture_object( struct gl_texture_object *dest, const struct gl_texture_object *src ); extern void _mesa_test_texobj_completeness( const GLcontext *ctx, struct gl_texture_object *obj ); /*@}*/ /** * \name API functions */ /*@{*/ extern void GLAPIENTRY _mesa_GenTextures( GLsizei n, GLuint *textures ); extern void GLAPIENTRY _mesa_DeleteTextures( GLsizei n, const GLuint *textures ); extern void GLAPIENTRY _mesa_BindTexture( GLenum target, GLuint texture ); extern void GLAPIENTRY _mesa_PrioritizeTextures( GLsizei n, const GLuint *textures, const GLclampf *priorities ); extern GLboolean GLAPIENTRY _mesa_AreTexturesResident( GLsizei n, const GLuint *textures, GLboolean *residences ); extern GLboolean GLAPIENTRY _mesa_IsTexture( GLuint texture ); /*@}*/ #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texrender.c0000644000000000000000000001461013614532424020307 0ustar #include "context.h" #include "fbobject.h" #include "texrender.h" #include "renderbuffer.h" /* * Render-to-texture code for GL_EXT_framebuffer_object */ /** * Derived from gl_renderbuffer class */ struct texture_renderbuffer { struct gl_renderbuffer Base; /* Base class object */ struct gl_texture_image *TexImage; StoreTexelFunc Store; GLint Zoffset; }; static void texture_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values) { const struct texture_renderbuffer *trb = (const struct texture_renderbuffer *) rb; const GLint z = trb->Zoffset; GLchan *rgbaOut = (GLchan *) values; GLuint i; for (i = 0; i < count; i++) { trb->TexImage->FetchTexelc(trb->TexImage, x + i, y, z, rgbaOut + 4 * i); } } static void texture_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values) { const struct texture_renderbuffer *trb = (const struct texture_renderbuffer *) rb; const GLint z = trb->Zoffset; GLchan *rgbaOut = (GLchan *) values; GLuint i; for (i = 0; i < count; i++) { trb->TexImage->FetchTexelc(trb->TexImage, x[i], y[i], z, rgbaOut + 4 * i); } } static void texture_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask) { const struct texture_renderbuffer *trb = (const struct texture_renderbuffer *) rb; const GLint z = trb->Zoffset; const GLchan *rgba = (const GLchan *) values; GLuint i; for (i = 0; i < count; i++) { if (!mask || mask[i]) { trb->Store(trb->TexImage, x + i, y, z, rgba); } rgba += 4; } } static void texture_put_mono_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { const struct texture_renderbuffer *trb = (const struct texture_renderbuffer *) rb; const GLint z = trb->Zoffset; const GLchan *rgba = (const GLchan *) value; GLuint i; for (i = 0; i < count; i++) { if (!mask || mask[i]) { trb->Store(trb->TexImage, x + i, y, z, rgba); } } } static void texture_put_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask) { const struct texture_renderbuffer *trb = (const struct texture_renderbuffer *) rb; const GLint z = trb->Zoffset; const GLchan *rgba = (const GLchan *) values; GLuint i; for (i = 0; i < count; i++) { if (!mask || mask[i]) { trb->Store(trb->TexImage, x[i], y[i], z, rgba); } rgba += 4; } } static void texture_put_mono_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask) { const struct texture_renderbuffer *trb = (const struct texture_renderbuffer *) rb; const GLint z = trb->Zoffset; const GLchan *rgba = (const GLchan *) value; GLuint i; for (i = 0; i < count; i++) { if (!mask || mask[i]) { trb->Store(trb->TexImage, x[i], y[i], z, rgba); } } } static void delete_texture_wrapper(struct gl_renderbuffer *rb) { _mesa_free(rb); } /** * If a render buffer attachment specifies a texture image, we'll use * this function to make a gl_renderbuffer wrapper around the texture image. * This allows other parts of Mesa to access the texture image as if it * was a renderbuffer. */ static void wrap_texture(GLcontext *ctx, struct gl_renderbuffer_attachment *att) { struct texture_renderbuffer *trb; const GLuint name = 0; ASSERT(att->Type == GL_TEXTURE); ASSERT(att->Renderbuffer == NULL); /* ASSERT(att->Complete); */ trb = CALLOC_STRUCT(texture_renderbuffer); if (!trb) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "wrap_texture"); return; } _mesa_init_renderbuffer(&trb->Base, name); trb->TexImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; assert(trb->TexImage); trb->Store = trb->TexImage->TexFormat->StoreTexel; assert(trb->Store); trb->Zoffset = att->Zoffset; trb->Base.Width = trb->TexImage->Width; trb->Base.Height = trb->TexImage->Height; trb->Base.InternalFormat = trb->TexImage->IntFormat; /* XXX fix? */ trb->Base._BaseFormat = trb->TexImage->TexFormat->BaseFormat; #if 0 /* fix/avoid this assertion someday */ assert(trb->Base._BaseFormat == GL_RGB || trb->Base._BaseFormat == GL_RGBA || trb->Base._BaseFormat == GL_DEPTH_COMPONENT); #endif trb->Base.DataType = GL_UNSIGNED_BYTE; /* XXX fix! */ trb->Base.Data = trb->TexImage->Data; trb->Base.GetRow = texture_get_row; trb->Base.GetValues = texture_get_values; trb->Base.PutRow = texture_put_row; trb->Base.PutMonoRow = texture_put_mono_row; trb->Base.PutValues = texture_put_values; trb->Base.PutMonoValues = texture_put_mono_values; trb->Base.Delete = delete_texture_wrapper; trb->Base.AllocStorage = NULL; /* illegal! */ /* XXX fix these */ if (trb->Base._BaseFormat == GL_DEPTH_COMPONENT) { trb->Base.ComponentSizes[3] = trb->TexImage->TexFormat->DepthBits; } else { trb->Base.ComponentSizes[0] = trb->TexImage->TexFormat->RedBits; trb->Base.ComponentSizes[1] = trb->TexImage->TexFormat->GreenBits; trb->Base.ComponentSizes[2] = trb->TexImage->TexFormat->BlueBits; trb->Base.ComponentSizes[3] = trb->TexImage->TexFormat->AlphaBits; } att->Renderbuffer = &(trb->Base); } /** * Software fallback for ctx->Driver.RenderbufferTexture. * This is called via the glRenderbufferTexture1D/2D/3D() functions. * If we're unbinding a texture, texObj will be NULL. * The framebuffer of interest is ctx->DrawBuffer. * \sa _mesa_framebuffer_renderbuffer */ void _mesa_renderbuffer_texture(GLcontext *ctx, struct gl_renderbuffer_attachment *att, struct gl_texture_object *texObj, GLenum texTarget, GLuint level, GLuint zoffset) { if (texObj) { _mesa_set_texture_attachment(ctx, att, texObj, texTarget, level, zoffset); wrap_texture(ctx, att); } else { _mesa_remove_attachment(ctx, att); } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texrender.h0000644000000000000000000000051013614532424020306 0ustar #ifndef TEXRENDER_H #define TEXRENDER_H extern void _mesa_renderbuffer_texture(GLcontext *ctx, struct gl_renderbuffer_attachment *att, struct gl_texture_object *texObj, GLenum texTarget, GLuint level, GLuint zoffset); #endif /* TEXRENDER_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texstate.c0000644000000000000000000031771013614532424020157 0ustar /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file texstate.c * * Texture state handling. */ #include "glheader.h" #include "colormac.h" #include "colortab.h" #include "context.h" #include "enums.h" #include "extensions.h" #include "macros.h" #include "nvfragprog.h" #include "texobj.h" #include "teximage.h" #include "texstate.h" #include "texenvprogram.h" #include "mtypes.h" #include "math/m_xform.h" #include "math/m_matrix.h" #ifdef SPECIALCAST /* Needed for an Amiga compiler */ #define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X)) #define ENUM_TO_DOUBLE(X) ((GLdouble)(GLint)(X)) #else /* all other compilers */ #define ENUM_TO_FLOAT(X) ((GLfloat)(X)) #define ENUM_TO_DOUBLE(X) ((GLdouble)(X)) #endif /** * Default texture combine environment state. This is used to initialize * a context's texture units and as the basis for converting "classic" * texture environmnets to ARB_texture_env_combine style values. */ static const struct gl_tex_env_combine_state default_combine_state = { GL_MODULATE, GL_MODULATE, { GL_TEXTURE, GL_PREVIOUS, GL_CONSTANT }, { GL_TEXTURE, GL_PREVIOUS, GL_CONSTANT }, { GL_SRC_COLOR, GL_SRC_COLOR, GL_SRC_ALPHA }, { GL_SRC_ALPHA, GL_SRC_ALPHA, GL_SRC_ALPHA }, 0, 0, 2, 2 }; void _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) { GLuint i; ASSERT(src); ASSERT(dst); dst->Texture.CurrentUnit = src->Texture.CurrentUnit; dst->Texture._GenFlags = src->Texture._GenFlags; dst->Texture._TexGenEnabled = src->Texture._TexGenEnabled; dst->Texture._TexMatEnabled = src->Texture._TexMatEnabled; dst->Texture.SharedPalette = src->Texture.SharedPalette; /* per-unit state */ for (i = 0; i < src->Const.MaxTextureUnits; i++) { dst->Texture.Unit[i].Enabled = src->Texture.Unit[i].Enabled; dst->Texture.Unit[i].EnvMode = src->Texture.Unit[i].EnvMode; COPY_4V(dst->Texture.Unit[i].EnvColor, src->Texture.Unit[i].EnvColor); dst->Texture.Unit[i].TexGenEnabled = src->Texture.Unit[i].TexGenEnabled; dst->Texture.Unit[i].GenModeS = src->Texture.Unit[i].GenModeS; dst->Texture.Unit[i].GenModeT = src->Texture.Unit[i].GenModeT; dst->Texture.Unit[i].GenModeR = src->Texture.Unit[i].GenModeR; dst->Texture.Unit[i].GenModeQ = src->Texture.Unit[i].GenModeQ; dst->Texture.Unit[i]._GenBitS = src->Texture.Unit[i]._GenBitS; dst->Texture.Unit[i]._GenBitT = src->Texture.Unit[i]._GenBitT; dst->Texture.Unit[i]._GenBitR = src->Texture.Unit[i]._GenBitR; dst->Texture.Unit[i]._GenBitQ = src->Texture.Unit[i]._GenBitQ; dst->Texture.Unit[i]._GenFlags = src->Texture.Unit[i]._GenFlags; COPY_4V(dst->Texture.Unit[i].ObjectPlaneS, src->Texture.Unit[i].ObjectPlaneS); COPY_4V(dst->Texture.Unit[i].ObjectPlaneT, src->Texture.Unit[i].ObjectPlaneT); COPY_4V(dst->Texture.Unit[i].ObjectPlaneR, src->Texture.Unit[i].ObjectPlaneR); COPY_4V(dst->Texture.Unit[i].ObjectPlaneQ, src->Texture.Unit[i].ObjectPlaneQ); COPY_4V(dst->Texture.Unit[i].EyePlaneS, src->Texture.Unit[i].EyePlaneS); COPY_4V(dst->Texture.Unit[i].EyePlaneT, src->Texture.Unit[i].EyePlaneT); COPY_4V(dst->Texture.Unit[i].EyePlaneR, src->Texture.Unit[i].EyePlaneR); COPY_4V(dst->Texture.Unit[i].EyePlaneQ, src->Texture.Unit[i].EyePlaneQ); dst->Texture.Unit[i].LodBias = src->Texture.Unit[i].LodBias; /* GL_EXT_texture_env_combine */ dst->Texture.Unit[i].Combine.ModeRGB = src->Texture.Unit[i].Combine.ModeRGB; dst->Texture.Unit[i].Combine.ModeA = src->Texture.Unit[i].Combine.ModeA; COPY_3V(dst->Texture.Unit[i].Combine.SourceRGB, src->Texture.Unit[i].Combine.SourceRGB); COPY_3V(dst->Texture.Unit[i].Combine.SourceA, src->Texture.Unit[i].Combine.SourceA); COPY_3V(dst->Texture.Unit[i].Combine.OperandRGB, src->Texture.Unit[i].Combine.OperandRGB); COPY_3V(dst->Texture.Unit[i].Combine.OperandA, src->Texture.Unit[i].Combine.OperandA); dst->Texture.Unit[i].Combine.ScaleShiftRGB = src->Texture.Unit[i].Combine.ScaleShiftRGB; dst->Texture.Unit[i].Combine.ScaleShiftA = src->Texture.Unit[i].Combine.ScaleShiftA; /* texture object state */ _mesa_copy_texture_object(dst->Texture.Unit[i].Current1D, src->Texture.Unit[i].Current1D); _mesa_copy_texture_object(dst->Texture.Unit[i].Current2D, src->Texture.Unit[i].Current2D); _mesa_copy_texture_object(dst->Texture.Unit[i].Current3D, src->Texture.Unit[i].Current3D); _mesa_copy_texture_object(dst->Texture.Unit[i].CurrentCubeMap, src->Texture.Unit[i].CurrentCubeMap); _mesa_copy_texture_object(dst->Texture.Unit[i].CurrentRect, src->Texture.Unit[i].CurrentRect); } } /* * For debugging */ void _mesa_print_texunit_state( GLcontext *ctx, GLuint unit ) { const struct gl_texture_unit *texUnit = ctx->Texture.Unit + unit; _mesa_printf("Texture Unit %d\n", unit); _mesa_printf(" GL_TEXTURE_ENV_MODE = %s\n", _mesa_lookup_enum_by_nr(texUnit->EnvMode)); _mesa_printf(" GL_COMBINE_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.ModeRGB)); _mesa_printf(" GL_COMBINE_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.ModeA)); _mesa_printf(" GL_SOURCE0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[0])); _mesa_printf(" GL_SOURCE1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[1])); _mesa_printf(" GL_SOURCE2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceRGB[2])); _mesa_printf(" GL_SOURCE0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[0])); _mesa_printf(" GL_SOURCE1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[1])); _mesa_printf(" GL_SOURCE2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.SourceA[2])); _mesa_printf(" GL_OPERAND0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[0])); _mesa_printf(" GL_OPERAND1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[1])); _mesa_printf(" GL_OPERAND2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandRGB[2])); _mesa_printf(" GL_OPERAND0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[0])); _mesa_printf(" GL_OPERAND1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[1])); _mesa_printf(" GL_OPERAND2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->Combine.OperandA[2])); _mesa_printf(" GL_RGB_SCALE = %d\n", 1 << texUnit->Combine.ScaleShiftRGB); _mesa_printf(" GL_ALPHA_SCALE = %d\n", 1 << texUnit->Combine.ScaleShiftA); _mesa_printf(" GL_TEXTURE_ENV_COLOR = (%f, %f, %f, %f)\n", texUnit->EnvColor[0], texUnit->EnvColor[1], texUnit->EnvColor[2], texUnit->EnvColor[3]); } /**********************************************************************/ /* Texture Environment */ /**********************************************************************/ /** * Convert "classic" texture environment to ARB_texture_env_combine style * environments. * * \param state texture_env_combine state vector to be filled-in. * \param mode Classic texture environment mode (i.e., \c GL_REPLACE, * \c GL_BLEND, \c GL_DECAL, etc.). * \param texBaseFormat Base format of the texture associated with the * texture unit. */ static void calculate_derived_texenv( struct gl_tex_env_combine_state *state, GLenum mode, GLenum texBaseFormat ) { GLenum mode_rgb; GLenum mode_a; *state = default_combine_state; switch (texBaseFormat) { case GL_ALPHA: state->SourceRGB[0] = GL_PREVIOUS; break; case GL_LUMINANCE_ALPHA: case GL_INTENSITY: case GL_RGBA: break; case GL_LUMINANCE: case GL_RGB: case GL_YCBCR_MESA: state->SourceA[0] = GL_PREVIOUS; break; default: _mesa_problem(NULL, "Invalid texBaseFormat in calculate_derived_texenv"); return; } switch (mode) { case GL_REPLACE: case GL_MODULATE: mode_rgb = (texBaseFormat == GL_ALPHA) ? GL_REPLACE : mode; mode_a = mode; break; case GL_DECAL: mode_rgb = GL_INTERPOLATE; mode_a = GL_REPLACE; state->SourceA[0] = GL_PREVIOUS; /* Having alpha / luminance / intensity textures replace using the * incoming fragment color matches the definition in NV_texture_shader. * The 1.5 spec simply marks these as "undefined". */ switch (texBaseFormat) { case GL_ALPHA: case GL_LUMINANCE: case GL_LUMINANCE_ALPHA: case GL_INTENSITY: state->SourceRGB[0] = GL_PREVIOUS; break; case GL_RGB: case GL_YCBCR_MESA: mode_rgb = GL_REPLACE; break; case GL_RGBA: state->SourceRGB[2] = GL_TEXTURE; break; } break; case GL_BLEND: mode_rgb = GL_INTERPOLATE; mode_a = GL_MODULATE; switch (texBaseFormat) { case GL_ALPHA: mode_rgb = GL_REPLACE; break; case GL_INTENSITY: mode_a = GL_INTERPOLATE; state->SourceA[0] = GL_CONSTANT; state->OperandA[2] = GL_SRC_ALPHA; /* FALLTHROUGH */ case GL_LUMINANCE: case GL_RGB: case GL_LUMINANCE_ALPHA: case GL_RGBA: case GL_YCBCR_MESA: state->SourceRGB[2] = GL_TEXTURE; state->SourceA[2] = GL_TEXTURE; state->SourceRGB[0] = GL_CONSTANT; state->OperandRGB[2] = GL_SRC_COLOR; break; } break; case GL_ADD: mode_rgb = (texBaseFormat == GL_ALPHA) ? GL_REPLACE : GL_ADD; mode_a = (texBaseFormat == GL_INTENSITY) ? GL_ADD : GL_MODULATE; break; default: _mesa_problem(NULL, "Invalid texture env mode in calculate_derived_texenv"); return; } state->ModeRGB = (state->SourceRGB[0] != GL_PREVIOUS) ? mode_rgb : GL_REPLACE; state->ModeA = (state->SourceA[0] != GL_PREVIOUS) ? mode_a : GL_REPLACE; } void GLAPIENTRY _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; ASSERT_OUTSIDE_BEGIN_END(ctx); #define TE_ERROR(errCode, msg, value) \ _mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value)); if (target == GL_TEXTURE_ENV) { switch (pname) { case GL_TEXTURE_ENV_MODE: { const GLenum mode = (GLenum) (GLint) *param; if (texUnit->EnvMode == mode) return; if (mode == GL_MODULATE || mode == GL_BLEND || mode == GL_DECAL || mode == GL_REPLACE || (mode == GL_ADD && ctx->Extensions.EXT_texture_env_add) || (mode == GL_COMBINE && (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine))) { /* legal */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->EnvMode = mode; } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); return; } } break; case GL_TEXTURE_ENV_COLOR: { GLfloat tmp[4]; tmp[0] = CLAMP( param[0], 0.0F, 1.0F ); tmp[1] = CLAMP( param[1], 0.0F, 1.0F ); tmp[2] = CLAMP( param[2], 0.0F, 1.0F ); tmp[3] = CLAMP( param[3], 0.0F, 1.0F ); if (TEST_EQ_4V(tmp, texUnit->EnvColor)) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); COPY_4FV(texUnit->EnvColor, tmp); } break; case GL_COMBINE_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { const GLenum mode = (GLenum) (GLint) *param; if (texUnit->Combine.ModeRGB == mode) return; switch (mode) { case GL_REPLACE: case GL_MODULATE: case GL_ADD: case GL_ADD_SIGNED: case GL_INTERPOLATE: /* OK */ break; case GL_SUBTRACT: if (!ctx->Extensions.ARB_texture_env_combine) { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); return; } break; case GL_DOT3_RGB_EXT: case GL_DOT3_RGBA_EXT: if (!ctx->Extensions.EXT_texture_env_dot3) { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); return; } break; case GL_DOT3_RGB: case GL_DOT3_RGBA: if (!ctx->Extensions.ARB_texture_env_dot3) { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); return; } break; case GL_MODULATE_ADD_ATI: case GL_MODULATE_SIGNED_ADD_ATI: case GL_MODULATE_SUBTRACT_ATI: if (!ctx->Extensions.ATI_texture_env_combine3) { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); return; } break; default: TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); return; } FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Combine.ModeRGB = mode; } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } break; case GL_COMBINE_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { const GLenum mode = (GLenum) (GLint) *param; if (texUnit->Combine.ModeA == mode) return; switch (mode) { case GL_REPLACE: case GL_MODULATE: case GL_ADD: case GL_ADD_SIGNED: case GL_INTERPOLATE: /* OK */ break; case GL_SUBTRACT: if (!ctx->Extensions.ARB_texture_env_combine) { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); return; } break; case GL_MODULATE_ADD_ATI: case GL_MODULATE_SIGNED_ADD_ATI: case GL_MODULATE_SUBTRACT_ATI: if (!ctx->Extensions.ATI_texture_env_combine3) { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); return; } break; default: TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); return; } FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Combine.ModeA = mode; } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } break; case GL_SOURCE0_RGB: case GL_SOURCE1_RGB: case GL_SOURCE2_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { const GLenum source = (GLenum) (GLint) *param; const GLuint s = pname - GL_SOURCE0_RGB; if (texUnit->Combine.SourceRGB[s] == source) return; if (source == GL_TEXTURE || source == GL_CONSTANT || source == GL_PRIMARY_COLOR || source == GL_PREVIOUS || (ctx->Extensions.ARB_texture_env_crossbar && source >= GL_TEXTURE0 && source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) || (ctx->Extensions.ATI_texture_env_combine3 && (source == GL_ZERO || source == GL_ONE))) { /* legal */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Combine.SourceRGB[s] = source; } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source); return; } } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } break; case GL_SOURCE0_ALPHA: case GL_SOURCE1_ALPHA: case GL_SOURCE2_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { const GLenum source = (GLenum) (GLint) *param; const GLuint s = pname - GL_SOURCE0_ALPHA; if (texUnit->Combine.SourceA[s] == source) return; if (source == GL_TEXTURE || source == GL_CONSTANT || source == GL_PRIMARY_COLOR || source == GL_PREVIOUS || (ctx->Extensions.ARB_texture_env_crossbar && source >= GL_TEXTURE0 && source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) || (ctx->Extensions.ATI_texture_env_combine3 && (source == GL_ZERO || source == GL_ONE))) { /* legal */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Combine.SourceA[s] = source; } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source); return; } } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } break; case GL_OPERAND0_RGB: case GL_OPERAND1_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { const GLenum operand = (GLenum) (GLint) *param; const GLuint s = pname - GL_OPERAND0_RGB; if (texUnit->Combine.OperandRGB[s] == operand) return; switch (operand) { case GL_SRC_COLOR: case GL_ONE_MINUS_SRC_COLOR: case GL_SRC_ALPHA: case GL_ONE_MINUS_SRC_ALPHA: FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Combine.OperandRGB[s] = operand; break; default: TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); return; } } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } break; case GL_OPERAND0_ALPHA: case GL_OPERAND1_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { const GLenum operand = (GLenum) (GLint) *param; if (texUnit->Combine.OperandA[pname-GL_OPERAND0_ALPHA] == operand) return; switch (operand) { case GL_SRC_ALPHA: case GL_ONE_MINUS_SRC_ALPHA: FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Combine.OperandA[pname-GL_OPERAND0_ALPHA] = operand; break; default: TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); return; } } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } break; case GL_OPERAND2_RGB: if (ctx->Extensions.ARB_texture_env_combine) { const GLenum operand = (GLenum) (GLint) *param; if (texUnit->Combine.OperandRGB[2] == operand) return; switch (operand) { case GL_SRC_COLOR: /* ARB combine only */ case GL_ONE_MINUS_SRC_COLOR: /* ARB combine only */ case GL_SRC_ALPHA: case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Combine.OperandRGB[2] = operand; break; default: TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); return; } } else if (ctx->Extensions.EXT_texture_env_combine) { const GLenum operand = (GLenum) (GLint) *param; if (texUnit->Combine.OperandRGB[2] == operand) return; /* operand must be GL_SRC_ALPHA which is the initial value - thus don't need to actually compare the operand to the possible value */ else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); return; } } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } break; case GL_OPERAND2_ALPHA: if (ctx->Extensions.ARB_texture_env_combine) { const GLenum operand = (GLenum) (GLint) *param; if (texUnit->Combine.OperandA[2] == operand) return; switch (operand) { case GL_SRC_ALPHA: case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Combine.OperandA[2] = operand; break; default: TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); return; } } else if (ctx->Extensions.EXT_texture_env_combine) { const GLenum operand = (GLenum) (GLint) *param; if (texUnit->Combine.OperandA[2] == operand) return; /* operand must be GL_SRC_ALPHA which is the initial value - thus don't need to actually compare the operand to the possible value */ else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); return; } } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } break; case GL_RGB_SCALE: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { GLuint newshift; if (*param == 1.0) { newshift = 0; } else if (*param == 2.0) { newshift = 1; } else if (*param == 4.0) { newshift = 2; } else { _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" ); return; } if (texUnit->Combine.ScaleShiftRGB == newshift) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Combine.ScaleShiftRGB = newshift; } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } break; case GL_ALPHA_SCALE: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { GLuint newshift; if (*param == 1.0) { newshift = 0; } else if (*param == 2.0) { newshift = 1; } else if (*param == 4.0) { newshift = 2; } else { _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(GL_ALPHA_SCALE not 1, 2 or 4)" ); return; } if (texUnit->Combine.ScaleShiftA == newshift) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->Combine.ScaleShiftA = newshift; } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); return; } } else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { /* GL_EXT_texture_lod_bias */ if (!ctx->Extensions.EXT_texture_lod_bias) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target ); return; } if (pname == GL_TEXTURE_LOD_BIAS_EXT) { if (texUnit->LodBias == param[0]) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->LodBias = param[0]; } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } } else if (target == GL_POINT_SPRITE_NV) { /* GL_ARB_point_sprite / GL_NV_point_sprite */ if (!ctx->Extensions.NV_point_sprite && !ctx->Extensions.ARB_point_sprite) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target ); return; } if (pname == GL_COORD_REPLACE_NV) { const GLenum value = (GLenum) param[0]; if (value == GL_TRUE || value == GL_FALSE) { /* It's kind of weird to set point state via glTexEnv, * but that's what the spec calls for. */ const GLboolean state = (GLboolean) value; if (ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] == state) return; FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] = state; } else { _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", value); return; } } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname ); return; } } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)",target ); return; } if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glTexEnv %s %s %.1f(%s) ...\n", _mesa_lookup_enum_by_nr(target), _mesa_lookup_enum_by_nr(pname), *param, _mesa_lookup_enum_by_nr((GLenum) (GLint) *param)); /* Tell device driver about the new texture environment */ if (ctx->Driver.TexEnv) { (*ctx->Driver.TexEnv)( ctx, target, pname, param ); } } void GLAPIENTRY _mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ) { _mesa_TexEnvfv( target, pname, ¶m ); } void GLAPIENTRY _mesa_TexEnvi( GLenum target, GLenum pname, GLint param ) { GLfloat p[4]; p[0] = (GLfloat) param; p[1] = p[2] = p[3] = 0.0; _mesa_TexEnvfv( target, pname, p ); } void GLAPIENTRY _mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ) { GLfloat p[4]; if (pname == GL_TEXTURE_ENV_COLOR) { p[0] = INT_TO_FLOAT( param[0] ); p[1] = INT_TO_FLOAT( param[1] ); p[2] = INT_TO_FLOAT( param[2] ); p[3] = INT_TO_FLOAT( param[3] ); } else { p[0] = (GLfloat) param[0]; p[1] = p[2] = p[3] = 0; /* init to zero, just to be safe */ } _mesa_TexEnvfv( target, pname, p ); } void GLAPIENTRY _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_TEXTURE_ENV) { switch (pname) { case GL_TEXTURE_ENV_MODE: *params = ENUM_TO_FLOAT(texUnit->EnvMode); break; case GL_TEXTURE_ENV_COLOR: COPY_4FV( params, texUnit->EnvColor ); break; case GL_COMBINE_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->Combine.ModeRGB; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; case GL_COMBINE_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->Combine.ModeA; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; case GL_SOURCE0_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->Combine.SourceRGB[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; case GL_SOURCE1_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->Combine.SourceRGB[1]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; case GL_SOURCE2_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->Combine.SourceRGB[2]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; case GL_SOURCE0_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->Combine.SourceA[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; case GL_SOURCE1_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->Combine.SourceA[1]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; case GL_SOURCE2_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->Combine.SourceA[2]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; case GL_OPERAND0_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->Combine.OperandRGB[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; case GL_OPERAND1_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->Combine.OperandRGB[1]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; case GL_OPERAND2_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->Combine.OperandRGB[2]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; case GL_OPERAND0_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->Combine.OperandA[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; case GL_OPERAND1_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->Combine.OperandA[1]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; case GL_OPERAND2_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->Combine.OperandA[2]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; case GL_RGB_SCALE: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { if (texUnit->Combine.ScaleShiftRGB == 0) *params = 1.0; else if (texUnit->Combine.ScaleShiftRGB == 1) *params = 2.0; else *params = 4.0; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); return; } break; case GL_ALPHA_SCALE: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { if (texUnit->Combine.ScaleShiftA == 0) *params = 1.0; else if (texUnit->Combine.ScaleShiftA == 1) *params = 2.0; else *params = 4.0; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); return; } break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname=0x%x)", pname); } } else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { /* GL_EXT_texture_lod_bias */ if (!ctx->Extensions.EXT_texture_lod_bias) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); return; } if (pname == GL_TEXTURE_LOD_BIAS_EXT) { *params = texUnit->LodBias; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" ); return; } } else if (target == GL_POINT_SPRITE_NV) { /* GL_ARB_point_sprite / GL_NV_point_sprite */ if (!ctx->Extensions.NV_point_sprite && !ctx->Extensions.ARB_point_sprite) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); return; } if (pname == GL_COORD_REPLACE_NV) { *params = (GLfloat) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit]; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" ); return; } } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); return; } } void GLAPIENTRY _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_TEXTURE_ENV) { switch (pname) { case GL_TEXTURE_ENV_MODE: *params = (GLint) texUnit->EnvMode; break; case GL_TEXTURE_ENV_COLOR: params[0] = FLOAT_TO_INT( texUnit->EnvColor[0] ); params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] ); params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] ); params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] ); break; case GL_COMBINE_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->Combine.ModeRGB; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; case GL_COMBINE_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->Combine.ModeA; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; case GL_SOURCE0_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->Combine.SourceRGB[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; case GL_SOURCE1_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->Combine.SourceRGB[1]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; case GL_SOURCE2_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->Combine.SourceRGB[2]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; case GL_SOURCE0_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->Combine.SourceA[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; case GL_SOURCE1_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->Combine.SourceA[1]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; case GL_SOURCE2_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->Combine.SourceA[2]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; case GL_OPERAND0_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->Combine.OperandRGB[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; case GL_OPERAND1_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->Combine.OperandRGB[1]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; case GL_OPERAND2_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->Combine.OperandRGB[2]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; case GL_OPERAND0_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->Combine.OperandA[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; case GL_OPERAND1_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->Combine.OperandA[1]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; case GL_OPERAND2_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->Combine.OperandA[2]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; case GL_RGB_SCALE: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { if (texUnit->Combine.ScaleShiftRGB == 0) *params = 1; else if (texUnit->Combine.ScaleShiftRGB == 1) *params = 2; else *params = 4; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); return; } break; case GL_ALPHA_SCALE: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { if (texUnit->Combine.ScaleShiftA == 0) *params = 1; else if (texUnit->Combine.ScaleShiftA == 1) *params = 2; else *params = 4; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); return; } break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname=0x%x)", pname); } } else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { /* GL_EXT_texture_lod_bias */ if (!ctx->Extensions.EXT_texture_lod_bias) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); return; } if (pname == GL_TEXTURE_LOD_BIAS_EXT) { *params = (GLint) texUnit->LodBias; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" ); return; } } else if (target == GL_POINT_SPRITE_NV) { /* GL_ARB_point_sprite / GL_NV_point_sprite */ if (!ctx->Extensions.NV_point_sprite && !ctx->Extensions.ARB_point_sprite) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); return; } if (pname == GL_COORD_REPLACE_NV) { *params = (GLint) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit]; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" ); return; } } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); return; } } /**********************************************************************/ /* Texture Parameters */ /**********************************************************************/ static GLboolean _mesa_validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum eparam) { const struct gl_extensions * const e = & ctx->Extensions; if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || (eparam == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp)) { /* any texture target */ return GL_TRUE; } else if (target != GL_TEXTURE_RECTANGLE_NV && (eparam == GL_REPEAT || (eparam == GL_MIRRORED_REPEAT && e->ARB_texture_mirrored_repeat) || (eparam == GL_MIRROR_CLAMP_EXT && (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) || (eparam == GL_MIRROR_CLAMP_TO_EDGE_EXT && (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) || (eparam == GL_MIRROR_CLAMP_TO_BORDER_EXT && (e->EXT_texture_mirror_clamp)))) { /* non-rectangle texture */ return GL_TRUE; } _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); return GL_FALSE; } void GLAPIENTRY _mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param ) { _mesa_TexParameterfv(target, pname, ¶m); } void GLAPIENTRY _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; GLenum eparam = (GLenum) (GLint) params[0]; struct gl_texture_object *texObj; ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glTexParameter %s %s %.1f(%s)...\n", _mesa_lookup_enum_by_nr(target), _mesa_lookup_enum_by_nr(pname), *params, _mesa_lookup_enum_by_nr(eparam)); switch (target) { case GL_TEXTURE_1D: texObj = texUnit->Current1D; break; case GL_TEXTURE_2D: texObj = texUnit->Current2D; break; case GL_TEXTURE_3D: texObj = texUnit->Current3D; break; case GL_TEXTURE_CUBE_MAP: if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); return; } texObj = texUnit->CurrentCubeMap; break; case GL_TEXTURE_RECTANGLE_NV: if (!ctx->Extensions.NV_texture_rectangle) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); return; } texObj = texUnit->CurrentRect; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); return; } switch (pname) { case GL_TEXTURE_MIN_FILTER: /* A small optimization */ if (texObj->MinFilter == eparam) return; if (eparam==GL_NEAREST || eparam==GL_LINEAR) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->MinFilter = eparam; } else if ((eparam==GL_NEAREST_MIPMAP_NEAREST || eparam==GL_LINEAR_MIPMAP_NEAREST || eparam==GL_NEAREST_MIPMAP_LINEAR || eparam==GL_LINEAR_MIPMAP_LINEAR) && texObj->Target != GL_TEXTURE_RECTANGLE_NV) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->MinFilter = eparam; } else { _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); return; } break; case GL_TEXTURE_MAG_FILTER: /* A small optimization */ if (texObj->MagFilter == eparam) return; if (eparam==GL_NEAREST || eparam==GL_LINEAR) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->MagFilter = eparam; } else { _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); return; } break; case GL_TEXTURE_WRAP_S: if (texObj->WrapS == eparam) return; if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapS = eparam; } else { return; } break; case GL_TEXTURE_WRAP_T: if (texObj->WrapT == eparam) return; if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapT = eparam; } else { return; } break; case GL_TEXTURE_WRAP_R: if (texObj->WrapR == eparam) return; if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapR = eparam; } else { return; } break; case GL_TEXTURE_BORDER_COLOR: FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->BorderColor[RCOMP] = params[0]; texObj->BorderColor[GCOMP] = params[1]; texObj->BorderColor[BCOMP] = params[2]; texObj->BorderColor[ACOMP] = params[3]; UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[RCOMP], params[0]); UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[GCOMP], params[1]); UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[BCOMP], params[2]); UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[ACOMP], params[3]); break; case GL_TEXTURE_MIN_LOD: if (texObj->MinLod == params[0]) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->MinLod = params[0]; break; case GL_TEXTURE_MAX_LOD: if (texObj->MaxLod == params[0]) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->MaxLod = params[0]; break; case GL_TEXTURE_BASE_LEVEL: if (params[0] < 0.0) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); return; } if (target == GL_TEXTURE_RECTANGLE_NV && params[0] != 0.0) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); return; } FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->BaseLevel = (GLint) params[0]; break; case GL_TEXTURE_MAX_LEVEL: if (params[0] < 0.0) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); return; } FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->MaxLevel = (GLint) params[0]; break; case GL_TEXTURE_PRIORITY: FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->Priority = CLAMP( params[0], 0.0F, 1.0F ); break; case GL_TEXTURE_MAX_ANISOTROPY_EXT: if (ctx->Extensions.EXT_texture_filter_anisotropic) { if (params[0] < 1.0) { _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); return; } FLUSH_VERTICES(ctx, _NEW_TEXTURE); /* clamp to max, that's what NVIDIA does */ texObj->MaxAnisotropy = MIN2(params[0], ctx->Const.MaxTextureMaxAnisotropy); } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)"); return; } break; case GL_TEXTURE_COMPARE_SGIX: if (ctx->Extensions.SGIX_shadow) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->CompareFlag = params[0] ? GL_TRUE : GL_FALSE; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=GL_TEXTURE_COMPARE_SGIX)"); return; } break; case GL_TEXTURE_COMPARE_OPERATOR_SGIX: if (ctx->Extensions.SGIX_shadow) { GLenum op = (GLenum) params[0]; if (op == GL_TEXTURE_LEQUAL_R_SGIX || op == GL_TEXTURE_GEQUAL_R_SGIX) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->CompareOperator = op; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)"); } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=GL_TEXTURE_COMPARE_OPERATOR_SGIX)"); return; } break; case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ if (ctx->Extensions.SGIX_shadow_ambient) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->ShadowAmbient = CLAMP(params[0], 0.0F, 1.0F); } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=GL_SHADOW_AMBIENT_SGIX)"); return; } break; case GL_GENERATE_MIPMAP_SGIS: if (ctx->Extensions.SGIS_generate_mipmap) { texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=GL_GENERATE_MIPMAP_SGIS)"); return; } break; case GL_TEXTURE_COMPARE_MODE_ARB: if (ctx->Extensions.ARB_shadow) { const GLenum mode = (GLenum) params[0]; if (mode == GL_NONE || mode == GL_COMPARE_R_TO_TEXTURE_ARB) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->CompareMode = mode; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(bad GL_TEXTURE_COMPARE_MODE_ARB: 0x%x)", mode); return; } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=GL_TEXTURE_COMPARE_MODE_ARB)"); return; } break; case GL_TEXTURE_COMPARE_FUNC_ARB: if (ctx->Extensions.ARB_shadow) { const GLenum func = (GLenum) params[0]; if (func == GL_LEQUAL || func == GL_GEQUAL) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->CompareFunc = func; } else if (ctx->Extensions.EXT_shadow_funcs && (func == GL_EQUAL || func == GL_NOTEQUAL || func == GL_LESS || func == GL_GREATER || func == GL_ALWAYS || func == GL_NEVER)) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->CompareFunc = func; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(bad GL_TEXTURE_COMPARE_FUNC_ARB)"); return; } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=GL_TEXTURE_COMPARE_FUNC_ARB)"); return; } break; case GL_DEPTH_TEXTURE_MODE_ARB: if (ctx->Extensions.ARB_depth_texture) { const GLenum result = (GLenum) params[0]; if (result == GL_LUMINANCE || result == GL_INTENSITY || result == GL_ALPHA) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->DepthMode = result; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(bad GL_DEPTH_TEXTURE_MODE_ARB)"); return; } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=GL_DEPTH_TEXTURE_MODE_ARB)"); return; } break; case GL_TEXTURE_LOD_BIAS: /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias*/ if (ctx->Extensions.EXT_texture_lod_bias) { if (texObj->LodBias != params[0]) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->LodBias = params[0]; } } break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname); return; } texObj->Complete = GL_FALSE; if (ctx->Driver.TexParameter) { (*ctx->Driver.TexParameter)( ctx, target, texObj, pname, params ); } } void GLAPIENTRY _mesa_TexParameteri( GLenum target, GLenum pname, GLint param ) { GLfloat fparam[4]; if (pname == GL_TEXTURE_PRIORITY) fparam[0] = INT_TO_FLOAT(param); else fparam[0] = (GLfloat) param; fparam[1] = fparam[2] = fparam[3] = 0.0; _mesa_TexParameterfv(target, pname, fparam); } void GLAPIENTRY _mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ) { GLfloat fparam[4]; if (pname == GL_TEXTURE_BORDER_COLOR) { fparam[0] = INT_TO_FLOAT(params[0]); fparam[1] = INT_TO_FLOAT(params[1]); fparam[2] = INT_TO_FLOAT(params[2]); fparam[3] = INT_TO_FLOAT(params[3]); } else { if (pname == GL_TEXTURE_PRIORITY) fparam[0] = INT_TO_FLOAT(params[0]); else fparam[0] = (GLfloat) params[0]; fparam[1] = fparam[2] = fparam[3] = 0.0F; } _mesa_TexParameterfv(target, pname, fparam); } void GLAPIENTRY _mesa_GetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params ) { GLint iparam; _mesa_GetTexLevelParameteriv( target, level, pname, &iparam ); *params = (GLfloat) iparam; } static GLuint tex_image_dimensions(GLcontext *ctx, GLenum target) { switch (target) { case GL_TEXTURE_1D: case GL_PROXY_TEXTURE_1D: return 1; case GL_TEXTURE_2D: case GL_PROXY_TEXTURE_2D: return 2; case GL_TEXTURE_3D: case GL_PROXY_TEXTURE_3D: return 3; case GL_TEXTURE_CUBE_MAP: case GL_PROXY_TEXTURE_CUBE_MAP: case GL_TEXTURE_CUBE_MAP_POSITIVE_X: case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: return ctx->Extensions.ARB_texture_cube_map ? 2 : 0; case GL_TEXTURE_RECTANGLE_NV: case GL_PROXY_TEXTURE_RECTANGLE_NV: return ctx->Extensions.NV_texture_rectangle ? 2 : 0; default: _mesa_problem(ctx, "bad target in _mesa_tex_target_dimensions()"); return 0; } } void GLAPIENTRY _mesa_GetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; const struct gl_texture_image *img = NULL; GLuint dimensions; GLboolean isProxy; GLint maxLevels; ASSERT_OUTSIDE_BEGIN_END(ctx); /* this will catch bad target values */ dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */ if (dimensions == 0) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)"); return; } switch (target) { case GL_TEXTURE_1D: case GL_PROXY_TEXTURE_1D: case GL_TEXTURE_2D: case GL_PROXY_TEXTURE_2D: maxLevels = ctx->Const.MaxTextureLevels; break; case GL_TEXTURE_3D: case GL_PROXY_TEXTURE_3D: maxLevels = ctx->Const.Max3DTextureLevels; break; case GL_TEXTURE_CUBE_MAP_POSITIVE_X: case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: case GL_PROXY_TEXTURE_CUBE_MAP: maxLevels = ctx->Const.MaxCubeTextureLevels; break; case GL_TEXTURE_RECTANGLE_NV: case GL_PROXY_TEXTURE_RECTANGLE_NV: maxLevels = 1; break; default: _mesa_problem(ctx, "switch in _mesa_GetTexLevelParameter"); return; } if (level < 0 || level >= maxLevels) { _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" ); return; } img = _mesa_select_tex_image(ctx, texUnit, target, level); if (!img || !img->TexFormat) { /* undefined texture image */ if (pname == GL_TEXTURE_COMPONENTS) *params = 1; else *params = 0; return; } isProxy = (target == GL_PROXY_TEXTURE_1D) || (target == GL_PROXY_TEXTURE_2D) || (target == GL_PROXY_TEXTURE_3D) || (target == GL_PROXY_TEXTURE_CUBE_MAP) || (target == GL_PROXY_TEXTURE_RECTANGLE_NV); switch (pname) { case GL_TEXTURE_WIDTH: *params = img->Width; return; case GL_TEXTURE_HEIGHT: *params = img->Height; return; case GL_TEXTURE_DEPTH: *params = img->Depth; return; case GL_TEXTURE_INTERNAL_FORMAT: *params = img->IntFormat; return; case GL_TEXTURE_BORDER: *params = img->Border; return; case GL_TEXTURE_RED_SIZE: if (img->Format == GL_RGB || img->Format == GL_RGBA) *params = img->TexFormat->RedBits; else *params = 0; return; case GL_TEXTURE_GREEN_SIZE: if (img->Format == GL_RGB || img->Format == GL_RGBA) *params = img->TexFormat->GreenBits; else *params = 0; return; case GL_TEXTURE_BLUE_SIZE: if (img->Format == GL_RGB || img->Format == GL_RGBA) *params = img->TexFormat->BlueBits; else *params = 0; return; case GL_TEXTURE_ALPHA_SIZE: if (img->Format == GL_ALPHA || img->Format == GL_LUMINANCE_ALPHA || img->Format == GL_RGBA) *params = img->TexFormat->AlphaBits; else *params = 0; return; case GL_TEXTURE_INTENSITY_SIZE: if (img->Format != GL_INTENSITY) *params = 0; else if (img->TexFormat->IntensityBits > 0) *params = img->TexFormat->IntensityBits; else /* intensity probably stored as rgb texture */ *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); return; case GL_TEXTURE_LUMINANCE_SIZE: if (img->Format != GL_LUMINANCE && img->Format != GL_LUMINANCE_ALPHA) *params = 0; else if (img->TexFormat->LuminanceBits > 0) *params = img->TexFormat->LuminanceBits; else /* luminance probably stored as rgb texture */ *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); return; case GL_TEXTURE_INDEX_SIZE_EXT: if (img->Format == GL_COLOR_INDEX) *params = img->TexFormat->IndexBits; else *params = 0; return; case GL_TEXTURE_DEPTH_SIZE_ARB: if (ctx->Extensions.SGIX_depth_texture || ctx->Extensions.ARB_depth_texture) *params = img->TexFormat->DepthBits; else _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); return; /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: if (ctx->Extensions.ARB_texture_compression) { if (img->IsCompressed && !isProxy) *params = img->CompressedSize; else _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexLevelParameter[if]v(pname)"); } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); } return; case GL_TEXTURE_COMPRESSED: if (ctx->Extensions.ARB_texture_compression) { *params = (GLint) img->IsCompressed; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); } return; /* GL_ARB_texture_float */ case GL_TEXTURE_RED_TYPE_ARB: if (ctx->Extensions.ARB_texture_float) { *params = img->TexFormat->RedBits ? img->TexFormat->DataType : GL_NONE; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); } return; case GL_TEXTURE_GREEN_TYPE_ARB: if (ctx->Extensions.ARB_texture_float) { *params = img->TexFormat->GreenBits ? img->TexFormat->DataType : GL_NONE; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); } return; case GL_TEXTURE_BLUE_TYPE_ARB: if (ctx->Extensions.ARB_texture_float) { *params = img->TexFormat->BlueBits ? img->TexFormat->DataType : GL_NONE; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); } return; case GL_TEXTURE_ALPHA_TYPE_ARB: if (ctx->Extensions.ARB_texture_float) { *params = img->TexFormat->AlphaBits ? img->TexFormat->DataType : GL_NONE; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); } return; case GL_TEXTURE_LUMINANCE_TYPE_ARB: if (ctx->Extensions.ARB_texture_float) { *params = img->TexFormat->LuminanceBits ? img->TexFormat->DataType : GL_NONE; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); } return; case GL_TEXTURE_INTENSITY_TYPE_ARB: if (ctx->Extensions.ARB_texture_float) { *params = img->TexFormat->IntensityBits ? img->TexFormat->DataType : GL_NONE; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); } return; case GL_TEXTURE_DEPTH_TYPE_ARB: if (ctx->Extensions.ARB_texture_float) { *params = img->TexFormat->DepthBits ? img->TexFormat->DataType : GL_NONE; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); } return; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); } } void GLAPIENTRY _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_object *obj; ASSERT_OUTSIDE_BEGIN_END(ctx); obj = _mesa_select_tex_object(ctx, texUnit, target); if (!obj) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)"); return; } switch (pname) { case GL_TEXTURE_MAG_FILTER: *params = ENUM_TO_FLOAT(obj->MagFilter); return; case GL_TEXTURE_MIN_FILTER: *params = ENUM_TO_FLOAT(obj->MinFilter); return; case GL_TEXTURE_WRAP_S: *params = ENUM_TO_FLOAT(obj->WrapS); return; case GL_TEXTURE_WRAP_T: *params = ENUM_TO_FLOAT(obj->WrapT); return; case GL_TEXTURE_WRAP_R: *params = ENUM_TO_FLOAT(obj->WrapR); return; case GL_TEXTURE_BORDER_COLOR: params[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F); params[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F); params[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F); params[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F); return; case GL_TEXTURE_RESIDENT: { GLboolean resident; if (ctx->Driver.IsTextureResident) resident = ctx->Driver.IsTextureResident(ctx, obj); else resident = GL_TRUE; *params = ENUM_TO_FLOAT(resident); } return; case GL_TEXTURE_PRIORITY: *params = obj->Priority; return; case GL_TEXTURE_MIN_LOD: *params = obj->MinLod; return; case GL_TEXTURE_MAX_LOD: *params = obj->MaxLod; return; case GL_TEXTURE_BASE_LEVEL: *params = (GLfloat) obj->BaseLevel; return; case GL_TEXTURE_MAX_LEVEL: *params = (GLfloat) obj->MaxLevel; return; case GL_TEXTURE_MAX_ANISOTROPY_EXT: if (ctx->Extensions.EXT_texture_filter_anisotropic) { *params = obj->MaxAnisotropy; return; } break; case GL_TEXTURE_COMPARE_SGIX: if (ctx->Extensions.SGIX_shadow) { *params = (GLfloat) obj->CompareFlag; return; } break; case GL_TEXTURE_COMPARE_OPERATOR_SGIX: if (ctx->Extensions.SGIX_shadow) { *params = (GLfloat) obj->CompareOperator; return; } break; case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ if (ctx->Extensions.SGIX_shadow_ambient) { *params = obj->ShadowAmbient; return; } break; case GL_GENERATE_MIPMAP_SGIS: if (ctx->Extensions.SGIS_generate_mipmap) { *params = (GLfloat) obj->GenerateMipmap; return; } break; case GL_TEXTURE_COMPARE_MODE_ARB: if (ctx->Extensions.ARB_shadow) { *params = (GLfloat) obj->CompareMode; return; } break; case GL_TEXTURE_COMPARE_FUNC_ARB: if (ctx->Extensions.ARB_shadow) { *params = (GLfloat) obj->CompareFunc; return; } break; case GL_DEPTH_TEXTURE_MODE_ARB: if (ctx->Extensions.ARB_depth_texture) { *params = (GLfloat) obj->DepthMode; return; } break; case GL_TEXTURE_LOD_BIAS: if (ctx->Extensions.EXT_texture_lod_bias) { *params = obj->LodBias; return; } break; default: ; /* silence warnings */ } /* If we get here, pname was an unrecognized enum */ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname=0x%x)", pname); } void GLAPIENTRY _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_object *obj; ASSERT_OUTSIDE_BEGIN_END(ctx); obj = _mesa_select_tex_object(ctx, texUnit, target); if (!obj) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)"); return; } switch (pname) { case GL_TEXTURE_MAG_FILTER: *params = (GLint) obj->MagFilter; return; case GL_TEXTURE_MIN_FILTER: *params = (GLint) obj->MinFilter; return; case GL_TEXTURE_WRAP_S: *params = (GLint) obj->WrapS; return; case GL_TEXTURE_WRAP_T: *params = (GLint) obj->WrapT; return; case GL_TEXTURE_WRAP_R: *params = (GLint) obj->WrapR; return; case GL_TEXTURE_BORDER_COLOR: { GLfloat b[4]; b[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F); b[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F); b[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F); b[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F); params[0] = FLOAT_TO_INT(b[0]); params[1] = FLOAT_TO_INT(b[1]); params[2] = FLOAT_TO_INT(b[2]); params[3] = FLOAT_TO_INT(b[3]); } return; case GL_TEXTURE_RESIDENT: { GLboolean resident; if (ctx->Driver.IsTextureResident) resident = ctx->Driver.IsTextureResident(ctx, obj); else resident = GL_TRUE; *params = (GLint) resident; } return; case GL_TEXTURE_PRIORITY: *params = FLOAT_TO_INT(obj->Priority); return; case GL_TEXTURE_MIN_LOD: *params = (GLint) obj->MinLod; return; case GL_TEXTURE_MAX_LOD: *params = (GLint) obj->MaxLod; return; case GL_TEXTURE_BASE_LEVEL: *params = obj->BaseLevel; return; case GL_TEXTURE_MAX_LEVEL: *params = obj->MaxLevel; return; case GL_TEXTURE_MAX_ANISOTROPY_EXT: if (ctx->Extensions.EXT_texture_filter_anisotropic) { *params = (GLint) obj->MaxAnisotropy; return; } break; case GL_TEXTURE_COMPARE_SGIX: if (ctx->Extensions.SGIX_shadow) { *params = (GLint) obj->CompareFlag; return; } break; case GL_TEXTURE_COMPARE_OPERATOR_SGIX: if (ctx->Extensions.SGIX_shadow) { *params = (GLint) obj->CompareOperator; return; } break; case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ if (ctx->Extensions.SGIX_shadow_ambient) { *params = (GLint) FLOAT_TO_INT(obj->ShadowAmbient); return; } break; case GL_GENERATE_MIPMAP_SGIS: if (ctx->Extensions.SGIS_generate_mipmap) { *params = (GLint) obj->GenerateMipmap; return; } break; case GL_TEXTURE_COMPARE_MODE_ARB: if (ctx->Extensions.ARB_shadow) { *params = (GLint) obj->CompareMode; return; } break; case GL_TEXTURE_COMPARE_FUNC_ARB: if (ctx->Extensions.ARB_shadow) { *params = (GLint) obj->CompareFunc; return; } break; case GL_DEPTH_TEXTURE_MODE_ARB: if (ctx->Extensions.ARB_depth_texture) { *params = (GLint) obj->DepthMode; return; } break; case GL_TEXTURE_LOD_BIAS: if (ctx->Extensions.EXT_texture_lod_bias) { *params = (GLint) obj->LodBias; return; } break; default: ; /* silence warnings */ } /* If we get here, pname was an unrecognized enum */ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname=0x%x)", pname); } /**********************************************************************/ /* Texture Coord Generation */ /**********************************************************************/ #if FEATURE_texgen void GLAPIENTRY _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); GLuint tUnit = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n", _mesa_lookup_enum_by_nr(coord), _mesa_lookup_enum_by_nr(pname), *params, _mesa_lookup_enum_by_nr((GLenum) (GLint) *params)); switch (coord) { case GL_S: if (pname==GL_TEXTURE_GEN_MODE) { GLenum mode = (GLenum) (GLint) *params; GLuint bits; switch (mode) { case GL_OBJECT_LINEAR: bits = TEXGEN_OBJ_LINEAR; break; case GL_EYE_LINEAR: bits = TEXGEN_EYE_LINEAR; break; case GL_REFLECTION_MAP_NV: bits = TEXGEN_REFLECTION_MAP_NV; break; case GL_NORMAL_MAP_NV: bits = TEXGEN_NORMAL_MAP_NV; break; case GL_SPHERE_MAP: bits = TEXGEN_SPHERE_MAP; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); return; } if (texUnit->GenModeS == mode) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->GenModeS = mode; texUnit->_GenBitS = bits; } else if (pname==GL_OBJECT_PLANE) { if (TEST_EQ_4V(texUnit->ObjectPlaneS, params)) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->ObjectPlaneS[0] = params[0]; texUnit->ObjectPlaneS[1] = params[1]; texUnit->ObjectPlaneS[2] = params[2]; texUnit->ObjectPlaneS[3] = params[3]; } else if (pname==GL_EYE_PLANE) { GLfloat tmp[4]; /* Transform plane equation by the inverse modelview matrix */ if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); } _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); if (TEST_EQ_4V(texUnit->EyePlaneS, tmp)) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); COPY_4FV(texUnit->EyePlaneS, tmp); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); return; } break; case GL_T: if (pname==GL_TEXTURE_GEN_MODE) { GLenum mode = (GLenum) (GLint) *params; GLuint bitt; switch (mode) { case GL_OBJECT_LINEAR: bitt = TEXGEN_OBJ_LINEAR; break; case GL_EYE_LINEAR: bitt = TEXGEN_EYE_LINEAR; break; case GL_REFLECTION_MAP_NV: bitt = TEXGEN_REFLECTION_MAP_NV; break; case GL_NORMAL_MAP_NV: bitt = TEXGEN_NORMAL_MAP_NV; break; case GL_SPHERE_MAP: bitt = TEXGEN_SPHERE_MAP; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); return; } if (texUnit->GenModeT == mode) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->GenModeT = mode; texUnit->_GenBitT = bitt; } else if (pname==GL_OBJECT_PLANE) { if (TEST_EQ_4V(texUnit->ObjectPlaneT, params)) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->ObjectPlaneT[0] = params[0]; texUnit->ObjectPlaneT[1] = params[1]; texUnit->ObjectPlaneT[2] = params[2]; texUnit->ObjectPlaneT[3] = params[3]; } else if (pname==GL_EYE_PLANE) { GLfloat tmp[4]; /* Transform plane equation by the inverse modelview matrix */ if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); } _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); if (TEST_EQ_4V(texUnit->EyePlaneT, tmp)) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); COPY_4FV(texUnit->EyePlaneT, tmp); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); return; } break; case GL_R: if (pname==GL_TEXTURE_GEN_MODE) { GLenum mode = (GLenum) (GLint) *params; GLuint bitr; switch (mode) { case GL_OBJECT_LINEAR: bitr = TEXGEN_OBJ_LINEAR; break; case GL_REFLECTION_MAP_NV: bitr = TEXGEN_REFLECTION_MAP_NV; break; case GL_NORMAL_MAP_NV: bitr = TEXGEN_NORMAL_MAP_NV; break; case GL_EYE_LINEAR: bitr = TEXGEN_EYE_LINEAR; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); return; } if (texUnit->GenModeR == mode) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->GenModeR = mode; texUnit->_GenBitR = bitr; } else if (pname==GL_OBJECT_PLANE) { if (TEST_EQ_4V(texUnit->ObjectPlaneR, params)) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->ObjectPlaneR[0] = params[0]; texUnit->ObjectPlaneR[1] = params[1]; texUnit->ObjectPlaneR[2] = params[2]; texUnit->ObjectPlaneR[3] = params[3]; } else if (pname==GL_EYE_PLANE) { GLfloat tmp[4]; /* Transform plane equation by the inverse modelview matrix */ if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); } _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); if (TEST_EQ_4V(texUnit->EyePlaneR, tmp)) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); COPY_4FV(texUnit->EyePlaneR, tmp); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); return; } break; case GL_Q: if (pname==GL_TEXTURE_GEN_MODE) { GLenum mode = (GLenum) (GLint) *params; GLuint bitq; switch (mode) { case GL_OBJECT_LINEAR: bitq = TEXGEN_OBJ_LINEAR; break; case GL_EYE_LINEAR: bitq = TEXGEN_EYE_LINEAR; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); return; } if (texUnit->GenModeQ == mode) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->GenModeQ = mode; texUnit->_GenBitQ = bitq; } else if (pname==GL_OBJECT_PLANE) { if (TEST_EQ_4V(texUnit->ObjectPlaneQ, params)) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->ObjectPlaneQ[0] = params[0]; texUnit->ObjectPlaneQ[1] = params[1]; texUnit->ObjectPlaneQ[2] = params[2]; texUnit->ObjectPlaneQ[3] = params[3]; } else if (pname==GL_EYE_PLANE) { GLfloat tmp[4]; /* Transform plane equation by the inverse modelview matrix */ if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); } _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); if (TEST_EQ_4V(texUnit->EyePlaneQ, tmp)) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); COPY_4FV(texUnit->EyePlaneQ, tmp); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); return; } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(coord)" ); return; } if (ctx->Driver.TexGen) ctx->Driver.TexGen( ctx, coord, pname, params ); } void GLAPIENTRY _mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) { GLfloat p[4]; p[0] = (GLfloat) params[0]; if (pname == GL_TEXTURE_GEN_MODE) { p[1] = p[2] = p[3] = 0.0F; } else { p[1] = (GLfloat) params[1]; p[2] = (GLfloat) params[2]; p[3] = (GLfloat) params[3]; } _mesa_TexGenfv(coord, pname, p); } void GLAPIENTRY _mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) { GLfloat p = (GLfloat) param; _mesa_TexGenfv( coord, pname, &p ); } void GLAPIENTRY _mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) { GLfloat p[4]; p[0] = (GLfloat) params[0]; if (pname == GL_TEXTURE_GEN_MODE) { p[1] = p[2] = p[3] = 0.0F; } else { p[1] = (GLfloat) params[1]; p[2] = (GLfloat) params[2]; p[3] = (GLfloat) params[3]; } _mesa_TexGenfv( coord, pname, p ); } void GLAPIENTRY _mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) { _mesa_TexGenfv(coord, pname, ¶m); } void GLAPIENTRY _mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) { _mesa_TexGeniv( coord, pname, ¶m ); } void GLAPIENTRY _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) { GET_CURRENT_CONTEXT(ctx); GLuint tUnit = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; ASSERT_OUTSIDE_BEGIN_END(ctx); switch (coord) { case GL_S: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = ENUM_TO_DOUBLE(texUnit->GenModeS); } else if (pname==GL_OBJECT_PLANE) { COPY_4V( params, texUnit->ObjectPlaneS ); } else if (pname==GL_EYE_PLANE) { COPY_4V( params, texUnit->EyePlaneS ); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); return; } break; case GL_T: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = ENUM_TO_DOUBLE(texUnit->GenModeT); } else if (pname==GL_OBJECT_PLANE) { COPY_4V( params, texUnit->ObjectPlaneT ); } else if (pname==GL_EYE_PLANE) { COPY_4V( params, texUnit->EyePlaneT ); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); return; } break; case GL_R: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = ENUM_TO_DOUBLE(texUnit->GenModeR); } else if (pname==GL_OBJECT_PLANE) { COPY_4V( params, texUnit->ObjectPlaneR ); } else if (pname==GL_EYE_PLANE) { COPY_4V( params, texUnit->EyePlaneR ); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); return; } break; case GL_Q: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = ENUM_TO_DOUBLE(texUnit->GenModeQ); } else if (pname==GL_OBJECT_PLANE) { COPY_4V( params, texUnit->ObjectPlaneQ ); } else if (pname==GL_EYE_PLANE) { COPY_4V( params, texUnit->EyePlaneQ ); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); return; } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)" ); return; } } void GLAPIENTRY _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); GLuint tUnit = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; ASSERT_OUTSIDE_BEGIN_END(ctx); switch (coord) { case GL_S: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = ENUM_TO_FLOAT(texUnit->GenModeS); } else if (pname==GL_OBJECT_PLANE) { COPY_4V( params, texUnit->ObjectPlaneS ); } else if (pname==GL_EYE_PLANE) { COPY_4V( params, texUnit->EyePlaneS ); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); return; } break; case GL_T: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = ENUM_TO_FLOAT(texUnit->GenModeT); } else if (pname==GL_OBJECT_PLANE) { COPY_4V( params, texUnit->ObjectPlaneT ); } else if (pname==GL_EYE_PLANE) { COPY_4V( params, texUnit->EyePlaneT ); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); return; } break; case GL_R: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = ENUM_TO_FLOAT(texUnit->GenModeR); } else if (pname==GL_OBJECT_PLANE) { COPY_4V( params, texUnit->ObjectPlaneR ); } else if (pname==GL_EYE_PLANE) { COPY_4V( params, texUnit->EyePlaneR ); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); return; } break; case GL_Q: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = ENUM_TO_FLOAT(texUnit->GenModeQ); } else if (pname==GL_OBJECT_PLANE) { COPY_4V( params, texUnit->ObjectPlaneQ ); } else if (pname==GL_EYE_PLANE) { COPY_4V( params, texUnit->EyePlaneQ ); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); return; } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)" ); return; } } void GLAPIENTRY _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); GLuint tUnit = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; ASSERT_OUTSIDE_BEGIN_END(ctx); switch (coord) { case GL_S: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = texUnit->GenModeS; } else if (pname==GL_OBJECT_PLANE) { params[0] = (GLint) texUnit->ObjectPlaneS[0]; params[1] = (GLint) texUnit->ObjectPlaneS[1]; params[2] = (GLint) texUnit->ObjectPlaneS[2]; params[3] = (GLint) texUnit->ObjectPlaneS[3]; } else if (pname==GL_EYE_PLANE) { params[0] = (GLint) texUnit->EyePlaneS[0]; params[1] = (GLint) texUnit->EyePlaneS[1]; params[2] = (GLint) texUnit->EyePlaneS[2]; params[3] = (GLint) texUnit->EyePlaneS[3]; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); return; } break; case GL_T: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = texUnit->GenModeT; } else if (pname==GL_OBJECT_PLANE) { params[0] = (GLint) texUnit->ObjectPlaneT[0]; params[1] = (GLint) texUnit->ObjectPlaneT[1]; params[2] = (GLint) texUnit->ObjectPlaneT[2]; params[3] = (GLint) texUnit->ObjectPlaneT[3]; } else if (pname==GL_EYE_PLANE) { params[0] = (GLint) texUnit->EyePlaneT[0]; params[1] = (GLint) texUnit->EyePlaneT[1]; params[2] = (GLint) texUnit->EyePlaneT[2]; params[3] = (GLint) texUnit->EyePlaneT[3]; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); return; } break; case GL_R: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = texUnit->GenModeR; } else if (pname==GL_OBJECT_PLANE) { params[0] = (GLint) texUnit->ObjectPlaneR[0]; params[1] = (GLint) texUnit->ObjectPlaneR[1]; params[2] = (GLint) texUnit->ObjectPlaneR[2]; params[3] = (GLint) texUnit->ObjectPlaneR[3]; } else if (pname==GL_EYE_PLANE) { params[0] = (GLint) texUnit->EyePlaneR[0]; params[1] = (GLint) texUnit->EyePlaneR[1]; params[2] = (GLint) texUnit->EyePlaneR[2]; params[3] = (GLint) texUnit->EyePlaneR[3]; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); return; } break; case GL_Q: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = texUnit->GenModeQ; } else if (pname==GL_OBJECT_PLANE) { params[0] = (GLint) texUnit->ObjectPlaneQ[0]; params[1] = (GLint) texUnit->ObjectPlaneQ[1]; params[2] = (GLint) texUnit->ObjectPlaneQ[2]; params[3] = (GLint) texUnit->ObjectPlaneQ[3]; } else if (pname==GL_EYE_PLANE) { params[0] = (GLint) texUnit->EyePlaneQ[0]; params[1] = (GLint) texUnit->EyePlaneQ[1]; params[2] = (GLint) texUnit->EyePlaneQ[2]; params[3] = (GLint) texUnit->EyePlaneQ[3]; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); return; } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)" ); return; } } #endif /* GL_ARB_multitexture */ void GLAPIENTRY _mesa_ActiveTextureARB( GLenum target ) { GET_CURRENT_CONTEXT(ctx); const GLuint texUnit = target - GL_TEXTURE0; ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glActiveTexture %s\n", _mesa_lookup_enum_by_nr(target)); /* Cater for texture unit 0 is first, therefore use >= */ if (texUnit >= ctx->Const.MaxTextureUnits) { _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(target)"); return; } if (ctx->Texture.CurrentUnit == texUnit) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); ctx->Texture.CurrentUnit = texUnit; if (ctx->Transform.MatrixMode == GL_TEXTURE) { /* update current stack pointer */ ctx->CurrentStack = &ctx->TextureMatrixStack[texUnit]; } if (ctx->Driver.ActiveTexture) { (*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit ); } } /* GL_ARB_multitexture */ void GLAPIENTRY _mesa_ClientActiveTextureARB( GLenum target ) { GET_CURRENT_CONTEXT(ctx); GLuint texUnit = target - GL_TEXTURE0; ASSERT_OUTSIDE_BEGIN_END(ctx); if (texUnit >= ctx->Const.MaxTextureUnits) { _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(target)"); return; } FLUSH_VERTICES(ctx, _NEW_ARRAY); ctx->Array.ActiveTexture = texUnit; } /**********************************************************************/ /* Pixel Texgen Extensions */ /**********************************************************************/ void GLAPIENTRY _mesa_PixelTexGenSGIX(GLenum mode) { GLenum newRgbSource, newAlphaSource; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); switch (mode) { case GL_NONE: newRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; newAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; break; case GL_ALPHA: newRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; newAlphaSource = GL_CURRENT_RASTER_COLOR; break; case GL_RGB: newRgbSource = GL_CURRENT_RASTER_COLOR; newAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; break; case GL_RGBA: newRgbSource = GL_CURRENT_RASTER_COLOR; newAlphaSource = GL_CURRENT_RASTER_COLOR; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenSGIX(mode)"); return; } if (newRgbSource == ctx->Pixel.FragmentRgbSource && newAlphaSource == ctx->Pixel.FragmentAlphaSource) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.FragmentRgbSource = newRgbSource; ctx->Pixel.FragmentAlphaSource = newAlphaSource; } void GLAPIENTRY _mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value) { _mesa_PixelTexGenParameteriSGIS(target, (GLint) value); } void GLAPIENTRY _mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) { _mesa_PixelTexGenParameteriSGIS(target, (GLint) *value); } void GLAPIENTRY _mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (value != GL_CURRENT_RASTER_COLOR && value != GL_PIXEL_GROUP_COLOR_SGIS) { _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(value)"); return; } switch (target) { case GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS: if (ctx->Pixel.FragmentRgbSource == (GLenum) value) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.FragmentRgbSource = (GLenum) value; break; case GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS: if (ctx->Pixel.FragmentAlphaSource == (GLenum) value) return; FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.FragmentAlphaSource = (GLenum) value; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(target)"); return; } } void GLAPIENTRY _mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value) { _mesa_PixelTexGenParameteriSGIS(target, *value); } void GLAPIENTRY _mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) { *value = (GLfloat) ctx->Pixel.FragmentRgbSource; } else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) { *value = (GLfloat) ctx->Pixel.FragmentAlphaSource; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterfvSGIS(target)"); } } void GLAPIENTRY _mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) { *value = (GLint) ctx->Pixel.FragmentRgbSource; } else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) { *value = (GLint) ctx->Pixel.FragmentAlphaSource; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterivSGIS(target)"); } } /**********************************************************************/ /***** State management *****/ /**********************************************************************/ /** * \note This routine refers to derived texture attribute values to * compute the ENABLE_TEXMAT flags, but is only called on * _NEW_TEXTURE_MATRIX. On changes to _NEW_TEXTURE, the ENABLE_TEXMAT * flags are updated by _mesa_update_textures(), below. * * \param ctx GL context. */ static void update_texture_matrices( GLcontext *ctx ) { GLuint i; ctx->Texture._TexMatEnabled = 0; for (i=0; i < ctx->Const.MaxTextureUnits; i++) { if (_math_matrix_is_dirty(ctx->TextureMatrixStack[i].Top)) { _math_matrix_analyse( ctx->TextureMatrixStack[i].Top ); if (ctx->Texture.Unit[i]._ReallyEnabled && ctx->TextureMatrixStack[i].Top->type != MATRIX_IDENTITY) ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i); if (ctx->Driver.TextureMatrix) ctx->Driver.TextureMatrix( ctx, i, ctx->TextureMatrixStack[i].Top); } } } /** * \note This routine refers to derived texture matrix values to * compute the ENABLE_TEXMAT flags, but is only called on * _NEW_TEXTURE. On changes to _NEW_TEXTURE_MATRIX, the ENABLE_TEXMAT * flags are updated by _mesa_update_texture_matrices, above. * * \param ctx GL context. */ static void update_texture_state( GLcontext *ctx ) { GLuint unit; ctx->NewState |= _NEW_TEXTURE; /* TODO: only set this if there are * actual changes. */ ctx->Texture._EnabledUnits = 0; ctx->Texture._GenFlags = 0; ctx->Texture._TexMatEnabled = 0; ctx->Texture._TexGenEnabled = 0; /* Update texture unit state. * XXX this loop should probably be broken into separate loops for * texture coord units and texture image units. */ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; GLuint enableBits; texUnit->_Current = NULL; texUnit->_ReallyEnabled = 0; texUnit->_GenFlags = 0; /* Get the bitmask of texture enables */ if (ctx->FragmentProgram._Enabled) { enableBits = ctx->FragmentProgram.Current->TexturesUsed[unit]; } else { if (!texUnit->Enabled) continue; enableBits = texUnit->Enabled; } /* Look for the highest-priority texture target that's enabled and * complete. That's the one we'll use for texturing. If we're using * a fragment program we're guaranteed that bitcount(enabledBits) <= 1. */ if (enableBits & TEXTURE_CUBE_BIT) { struct gl_texture_object *texObj = texUnit->CurrentCubeMap; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { texUnit->_ReallyEnabled = TEXTURE_CUBE_BIT; texUnit->_Current = texObj; } } if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_3D_BIT)) { struct gl_texture_object *texObj = texUnit->Current3D; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { texUnit->_ReallyEnabled = TEXTURE_3D_BIT; texUnit->_Current = texObj; } } if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_RECT_BIT)) { struct gl_texture_object *texObj = texUnit->CurrentRect; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { texUnit->_ReallyEnabled = TEXTURE_RECT_BIT; texUnit->_Current = texObj; } } if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_2D_BIT)) { struct gl_texture_object *texObj = texUnit->Current2D; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { texUnit->_ReallyEnabled = TEXTURE_2D_BIT; texUnit->_Current = texObj; } } if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_1D_BIT)) { struct gl_texture_object *texObj = texUnit->Current1D; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { texUnit->_ReallyEnabled = TEXTURE_1D_BIT; texUnit->_Current = texObj; } } if (!texUnit->_ReallyEnabled) { continue; } if (texUnit->_ReallyEnabled) ctx->Texture._EnabledUnits |= (1 << unit); if (texUnit->EnvMode == GL_COMBINE) { texUnit->_CurrentCombine = & texUnit->Combine; } else { GLenum format = texUnit->_Current->Image[0][0]->Format; if (format == GL_COLOR_INDEX) { format = GL_RGBA; /* a bit of a hack */ } else if (format == GL_DEPTH_COMPONENT) { format = texUnit->_Current->DepthMode; } calculate_derived_texenv(&texUnit->_EnvMode, texUnit->EnvMode, format); texUnit->_CurrentCombine = & texUnit->_EnvMode; } switch (texUnit->_CurrentCombine->ModeRGB) { case GL_REPLACE: texUnit->_CurrentCombine->_NumArgsRGB = 1; break; case GL_MODULATE: case GL_ADD: case GL_ADD_SIGNED: case GL_SUBTRACT: case GL_DOT3_RGB: case GL_DOT3_RGBA: case GL_DOT3_RGB_EXT: case GL_DOT3_RGBA_EXT: texUnit->_CurrentCombine->_NumArgsRGB = 2; break; case GL_INTERPOLATE: case GL_MODULATE_ADD_ATI: case GL_MODULATE_SIGNED_ADD_ATI: case GL_MODULATE_SUBTRACT_ATI: texUnit->_CurrentCombine->_NumArgsRGB = 3; break; default: texUnit->_CurrentCombine->_NumArgsRGB = 0; _mesa_problem(ctx, "invalid RGB combine mode in update_texture_state"); return; } switch (texUnit->_CurrentCombine->ModeA) { case GL_REPLACE: texUnit->_CurrentCombine->_NumArgsA = 1; break; case GL_MODULATE: case GL_ADD: case GL_ADD_SIGNED: case GL_SUBTRACT: texUnit->_CurrentCombine->_NumArgsA = 2; break; case GL_INTERPOLATE: case GL_MODULATE_ADD_ATI: case GL_MODULATE_SIGNED_ADD_ATI: case GL_MODULATE_SUBTRACT_ATI: texUnit->_CurrentCombine->_NumArgsA = 3; break; default: texUnit->_CurrentCombine->_NumArgsA = 0; _mesa_problem(ctx, "invalid Alpha combine mode in update_texture_state"); break; } if (texUnit->TexGenEnabled) { if (texUnit->TexGenEnabled & S_BIT) { texUnit->_GenFlags |= texUnit->_GenBitS; } if (texUnit->TexGenEnabled & T_BIT) { texUnit->_GenFlags |= texUnit->_GenBitT; } if (texUnit->TexGenEnabled & Q_BIT) { texUnit->_GenFlags |= texUnit->_GenBitQ; } if (texUnit->TexGenEnabled & R_BIT) { texUnit->_GenFlags |= texUnit->_GenBitR; } ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit); ctx->Texture._GenFlags |= texUnit->_GenFlags; } if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit); } ctx->Texture._EnabledCoordUnits = ctx->Texture._EnabledUnits; /* Fragment programs may need texture coordinates but not the * corresponding texture images. */ if (ctx->FragmentProgram._Enabled) { ctx->Texture._EnabledCoordUnits |= (ctx->FragmentProgram.Current->InputsRead >> FRAG_ATTRIB_TEX0); } } void _mesa_update_texture( GLcontext *ctx, GLuint new_state ) { if (new_state & _NEW_TEXTURE_MATRIX) update_texture_matrices( ctx ); if (new_state & (_NEW_TEXTURE | _NEW_PROGRAM)) update_texture_state( ctx ); } /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ /** * Allocate the proxy textures for the given context. * * \param ctx the context to allocate proxies for. * * \return GL_TRUE on success, or GL_FALSE on failure * * If run out of memory part way through the allocations, clean up and return * GL_FALSE. */ static GLboolean alloc_proxy_textures( GLcontext *ctx ) { ctx->Texture.Proxy1D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D); if (!ctx->Texture.Proxy1D) goto cleanup; ctx->Texture.Proxy2D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_2D); if (!ctx->Texture.Proxy2D) goto cleanup; ctx->Texture.Proxy3D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_3D); if (!ctx->Texture.Proxy3D) goto cleanup; ctx->Texture.ProxyCubeMap = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_CUBE_MAP_ARB); if (!ctx->Texture.ProxyCubeMap) goto cleanup; ctx->Texture.ProxyRect = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_RECTANGLE_NV); if (!ctx->Texture.ProxyRect) goto cleanup; return GL_TRUE; cleanup: if (ctx->Texture.Proxy1D) (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1D); if (ctx->Texture.Proxy2D) (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2D); if (ctx->Texture.Proxy3D) (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy3D); if (ctx->Texture.ProxyCubeMap) (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyCubeMap); if (ctx->Texture.ProxyRect) (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyRect); return GL_FALSE; } /** * Initialize a texture unit. * * \param ctx GL context. * \param unit texture unit number to be initialized. */ static void init_texture_unit( GLcontext *ctx, GLuint unit ) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; texUnit->EnvMode = GL_MODULATE; ASSIGN_4V( texUnit->EnvColor, 0.0, 0.0, 0.0, 0.0 ); texUnit->Combine = default_combine_state; texUnit->_EnvMode = default_combine_state; texUnit->_CurrentCombine = & texUnit->_EnvMode; texUnit->TexGenEnabled = 0; texUnit->GenModeS = GL_EYE_LINEAR; texUnit->GenModeT = GL_EYE_LINEAR; texUnit->GenModeR = GL_EYE_LINEAR; texUnit->GenModeQ = GL_EYE_LINEAR; texUnit->_GenBitS = TEXGEN_EYE_LINEAR; texUnit->_GenBitT = TEXGEN_EYE_LINEAR; texUnit->_GenBitR = TEXGEN_EYE_LINEAR; texUnit->_GenBitQ = TEXGEN_EYE_LINEAR; /* Yes, these plane coefficients are correct! */ ASSIGN_4V( texUnit->ObjectPlaneS, 1.0, 0.0, 0.0, 0.0 ); ASSIGN_4V( texUnit->ObjectPlaneT, 0.0, 1.0, 0.0, 0.0 ); ASSIGN_4V( texUnit->ObjectPlaneR, 0.0, 0.0, 0.0, 0.0 ); ASSIGN_4V( texUnit->ObjectPlaneQ, 0.0, 0.0, 0.0, 0.0 ); ASSIGN_4V( texUnit->EyePlaneS, 1.0, 0.0, 0.0, 0.0 ); ASSIGN_4V( texUnit->EyePlaneT, 0.0, 1.0, 0.0, 0.0 ); ASSIGN_4V( texUnit->EyePlaneR, 0.0, 0.0, 0.0, 0.0 ); ASSIGN_4V( texUnit->EyePlaneQ, 0.0, 0.0, 0.0, 0.0 ); texUnit->Current1D = ctx->Shared->Default1D; texUnit->Current2D = ctx->Shared->Default2D; texUnit->Current3D = ctx->Shared->Default3D; texUnit->CurrentCubeMap = ctx->Shared->DefaultCubeMap; texUnit->CurrentRect = ctx->Shared->DefaultRect; } GLboolean _mesa_init_texture( GLcontext * ctx ) { int i; assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS); assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS); /* Effectively bind the default textures to all texture units */ ctx->Shared->Default1D->RefCount += MAX_TEXTURE_UNITS; ctx->Shared->Default2D->RefCount += MAX_TEXTURE_UNITS; ctx->Shared->Default3D->RefCount += MAX_TEXTURE_UNITS; ctx->Shared->DefaultCubeMap->RefCount += MAX_TEXTURE_UNITS; ctx->Shared->DefaultRect->RefCount += MAX_TEXTURE_UNITS; /* Texture group */ ctx->Texture.CurrentUnit = 0; /* multitexture */ ctx->Texture._EnabledUnits = 0; for (i=0; iTexture.SharedPalette = GL_FALSE; _mesa_init_colortable(&ctx->Texture.Palette); /* Allocate proxy textures */ if (!alloc_proxy_textures( ctx )) return GL_FALSE; return GL_TRUE; } void _mesa_free_texture_data( GLcontext *ctx ) { int i; /* Free proxy texture objects */ (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1D ); (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2D ); (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy3D ); (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyCubeMap ); (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyRect ); for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable ); _mesa_TexEnvProgramCacheDestroy( ctx ); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texstate.h0000644000000000000000000001177113614532424020162 0ustar /** * \file texstate.h * Texture state management. */ /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef TEXSTATE_H #define TEXSTATE_H #include "mtypes.h" extern void _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ); extern void _mesa_print_texunit_state( GLcontext *ctx, GLuint unit ); /** * \name Called from API */ /*@{*/ extern void GLAPIENTRY _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); extern void GLAPIENTRY _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ); extern void GLAPIENTRY _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); extern void GLAPIENTRY _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); extern void GLAPIENTRY _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ); extern void GLAPIENTRY _mesa_GetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params ); extern void GLAPIENTRY _mesa_GetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params ); extern void GLAPIENTRY _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ); extern void GLAPIENTRY _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ); extern void GLAPIENTRY _mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ); extern void GLAPIENTRY _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ); extern void GLAPIENTRY _mesa_TexEnvi( GLenum target, GLenum pname, GLint param ); extern void GLAPIENTRY _mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ); extern void GLAPIENTRY _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ); extern void GLAPIENTRY _mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param ); extern void GLAPIENTRY _mesa_TexParameteri( GLenum target, GLenum pname, GLint param ); extern void GLAPIENTRY _mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ); extern void GLAPIENTRY _mesa_TexGend( GLenum coord, GLenum pname, GLdouble param ); extern void GLAPIENTRY _mesa_TexGendv( GLenum coord, GLenum pname, const GLdouble *params ); extern void GLAPIENTRY _mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ); extern void GLAPIENTRY _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); extern void GLAPIENTRY _mesa_TexGeni( GLenum coord, GLenum pname, GLint param ); extern void GLAPIENTRY _mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params ); /* * GL_ARB_multitexture */ extern void GLAPIENTRY _mesa_ActiveTextureARB( GLenum target ); extern void GLAPIENTRY _mesa_ClientActiveTextureARB( GLenum target ); /* * Pixel Texture Extensions */ extern void GLAPIENTRY _mesa_PixelTexGenSGIX(GLenum mode); extern void GLAPIENTRY _mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value); #ifdef VMS #define _mesa_PixelTexGenParameterfvSGIS _mesa_PixelTexGenParameterfv #endif extern void GLAPIENTRY _mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value); extern void GLAPIENTRY _mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value); #ifdef VMS #define _mesa_PixelTexGenParameterivSGIS _mesa_PixelTexGenParameteriv #endif extern void GLAPIENTRY _mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value); #ifdef VMS #define _mesa_GetPixelTexGenParameterfvSGIS _mesa_GetPixelTexGenParameterfv #endif extern void GLAPIENTRY _mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value); #ifdef VMS #define _mesa_GetPixelTexGenParameterivSGIS _mesa_GetPixelTexGenParameteriv #endif extern void GLAPIENTRY _mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value); /*@}*/ /** * \name Initialization, state maintenance */ /*@{*/ extern void _mesa_update_texture( GLcontext *ctx, GLuint new_state ); extern GLboolean _mesa_init_texture( GLcontext *ctx ); extern void _mesa_free_texture_data( GLcontext *ctx ); /*@}*/ #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texstore.c0000644000000000000000000045365013614532424020177 0ustar /* * Mesa 3-D graphics library * Version: 6.4 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Authors: * Brian Paul */ /* * The GL texture image functions in teximage.c basically just do * error checking and data structure allocation. They in turn call * device driver functions which actually copy/convert/store the user's * texture image data. * * However, most device drivers will be able to use the fallback functions * in this file. That is, most drivers will have the following bit of * code: * ctx->Driver.TexImage1D = _mesa_store_teximage1d; * ctx->Driver.TexImage2D = _mesa_store_teximage2d; * ctx->Driver.TexImage3D = _mesa_store_teximage3d; * etc... * * Texture image processing is actually kind of complicated. We have to do: * Format/type conversions * pixel unpacking * pixel transfer (scale, bais, lookup, convolution!, etc) * * These functions can handle most everything, including processing full * images and sub-images. */ #include "glheader.h" #include "bufferobj.h" #include "colormac.h" #include "context.h" #include "convolve.h" #include "image.h" #include "macros.h" #include "imports.h" #include "texcompress.h" #include "texformat.h" #include "teximage.h" #include "texstore.h" static const GLint ZERO = 4, ONE = 5; static GLboolean can_swizzle(GLenum logicalBaseFormat) { switch (logicalBaseFormat) { case GL_RGBA: case GL_RGB: case GL_LUMINANCE_ALPHA: case GL_INTENSITY: case GL_ALPHA: case GL_LUMINANCE: return GL_TRUE; default: return GL_FALSE; } } /** * When promoting texture formats (see below) we need to compute the * mapping of dest components back to source components. * This function does that. * \param logicalBaseFormat the logical format of the texture * \param textureBaseFormat the final texture format * \return map[4] the four mapping values */ static void compute_component_mapping(GLenum logicalBaseFormat, GLenum textureBaseFormat, GLubyte map[6]) { map[ZERO] = ZERO; map[ONE] = ONE; /* compute mapping from dest components back to src components */ switch (textureBaseFormat) { case GL_RGB: case GL_RGBA: switch (logicalBaseFormat) { case GL_LUMINANCE: map[0] = map[1] = map[2] = 0; if (textureBaseFormat == GL_RGBA) map[3] = ONE; break; case GL_ALPHA: ASSERT(textureBaseFormat == GL_RGBA); map[0] = map[1] = map[2] = ZERO; map[3] = 0; break; case GL_INTENSITY: map[0] = map[1] = map[2] = 0; if (textureBaseFormat == GL_RGBA) map[3] = 0; break; case GL_LUMINANCE_ALPHA: ASSERT(textureBaseFormat == GL_RGBA); map[0] = map[1] = map[2] = 0; map[3] = 1; break; case GL_RGB: ASSERT(textureBaseFormat == GL_RGBA); map[0] = 0; map[1] = 1; map[2] = 2; map[3] = ONE; break; case GL_RGBA: ASSERT(textureBaseFormat == GL_RGBA); map[0] = 0; map[1] = 1; map[2] = 2; map[3] = 3; break; default: _mesa_problem(NULL, "Unexpected logicalBaseFormat"); map[0] = map[1] = map[2] = map[3] = 0; } break; case GL_LUMINANCE_ALPHA: switch (logicalBaseFormat) { case GL_LUMINANCE: map[0] = 0; map[1] = ONE; break; case GL_ALPHA: map[0] = ZERO; map[1] = 0; break; case GL_INTENSITY: map[0] = 0; map[1] = 0; break; default: _mesa_problem(NULL, "Unexpected logicalBaseFormat"); map[0] = map[1] = 0; } break; default: _mesa_problem(NULL, "Unexpected logicalBaseFormat"); map[0] = map[1] = 0; break; } } /** * Make a temporary (color) texture image with GLfloat components. * Apply all needed pixel unpacking and pixel transfer operations. * Note that there are both logicalBaseFormat and textureBaseFormat parameters. * Suppose the user specifies GL_LUMINANCE as the internal texture format * but the graphics hardware doesn't support luminance textures. So, might * use an RGB hardware format instead. * If logicalBaseFormat != textureBaseFormat we have some extra work to do. * * \param ctx the rendering context * \param dims image dimensions: 1, 2 or 3 * \param logicalBaseFormat basic texture derived from the user's * internal texture format value * \param textureBaseFormat the actual basic format of the texture * \param srcWidth source image width * \param srcHeight source image height * \param srcDepth source image depth * \param srcFormat source image format * \param srcType source image type * \param srcAddr source image address * \param srcPacking source image pixel packing * \return resulting image with format = textureBaseFormat and type = GLfloat. */ static GLfloat * make_temp_float_image(GLcontext *ctx, GLuint dims, GLenum logicalBaseFormat, GLenum textureBaseFormat, GLint srcWidth, GLint srcHeight, GLint srcDepth, GLenum srcFormat, GLenum srcType, const GLvoid *srcAddr, const struct gl_pixelstore_attrib *srcPacking) { GLuint transferOps = ctx->_ImageTransferState; GLfloat *tempImage; ASSERT(dims >= 1 && dims <= 3); ASSERT(logicalBaseFormat == GL_RGBA || logicalBaseFormat == GL_RGB || logicalBaseFormat == GL_LUMINANCE_ALPHA || logicalBaseFormat == GL_LUMINANCE || logicalBaseFormat == GL_ALPHA || logicalBaseFormat == GL_INTENSITY || logicalBaseFormat == GL_COLOR_INDEX || logicalBaseFormat == GL_DEPTH_COMPONENT); ASSERT(textureBaseFormat == GL_RGBA || textureBaseFormat == GL_RGB || textureBaseFormat == GL_LUMINANCE_ALPHA || textureBaseFormat == GL_LUMINANCE || textureBaseFormat == GL_ALPHA || textureBaseFormat == GL_INTENSITY || textureBaseFormat == GL_COLOR_INDEX || textureBaseFormat == GL_DEPTH_COMPONENT); /* conventional color image */ if ((dims == 1 && ctx->Pixel.Convolution1DEnabled) || (dims >= 2 && ctx->Pixel.Convolution2DEnabled) || (dims >= 2 && ctx->Pixel.Separable2DEnabled)) { /* need image convolution */ const GLuint preConvTransferOps = (transferOps & IMAGE_PRE_CONVOLUTION_BITS) | IMAGE_CLAMP_BIT; const GLuint postConvTransferOps = (transferOps & IMAGE_POST_CONVOLUTION_BITS) | IMAGE_CLAMP_BIT; GLint img, row; GLint convWidth, convHeight; GLfloat *convImage; /* pre-convolution image buffer (3D) */ tempImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth * 4 * sizeof(GLfloat)); if (!tempImage) return NULL; /* post-convolution image buffer (2D) */ convImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * 4 * sizeof(GLfloat)); if (!convImage) { _mesa_free(tempImage); return NULL; } /* loop over 3D image slices */ for (img = 0; img < srcDepth; img++) { GLfloat *dst = tempImage + img * (srcWidth * srcHeight * 4); /* unpack and do transfer ops up to convolution */ for (row = 0; row < srcHeight; row++) { const GLvoid *src = _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); _mesa_unpack_color_span_float(ctx, srcWidth, GL_RGBA, dst, srcFormat, srcType, src, srcPacking, preConvTransferOps); dst += srcWidth * 4; } /* do convolution */ { GLfloat *src = tempImage + img * (srcWidth * srcHeight * 4); convWidth = srcWidth; convHeight = srcHeight; if (dims == 1) { ASSERT(ctx->Pixel.Convolution1DEnabled); _mesa_convolve_1d_image(ctx, &convWidth, src, convImage); } else { if (ctx->Pixel.Convolution2DEnabled) { _mesa_convolve_2d_image(ctx, &convWidth, &convHeight, src, convImage); } else { ASSERT(ctx->Pixel.Separable2DEnabled); _mesa_convolve_sep_image(ctx, &convWidth, &convHeight, src, convImage); } } } /* do post-convolution transfer and pack into tempImage */ { const GLint logComponents = _mesa_components_in_format(logicalBaseFormat); const GLfloat *src = convImage; GLfloat *dst = tempImage + img * (convWidth * convHeight * 4); for (row = 0; row < convHeight; row++) { _mesa_pack_rgba_span_float(ctx, convWidth, (const GLfloat (*)[4]) src, logicalBaseFormat, GL_FLOAT, dst, &ctx->DefaultPacking, postConvTransferOps); src += convWidth * 4; dst += convWidth * logComponents; } } } /* loop over 3D image slices */ _mesa_free(convImage); /* might need these below */ srcWidth = convWidth; srcHeight = convHeight; } else { /* no convolution */ const GLint components = _mesa_components_in_format(logicalBaseFormat); const GLint srcStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLfloat *dst; GLint img, row; tempImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth * components * sizeof(GLfloat)); if (!tempImage) return NULL; dst = tempImage; for (img = 0; img < srcDepth; img++) { const GLubyte *src = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); for (row = 0; row < srcHeight; row++) { _mesa_unpack_color_span_float(ctx, srcWidth, logicalBaseFormat, dst, srcFormat, srcType, src, srcPacking, transferOps); dst += srcWidth * components; src += srcStride; } } } if (logicalBaseFormat != textureBaseFormat) { /* more work */ GLint texComponents = _mesa_components_in_format(textureBaseFormat); GLint logComponents = _mesa_components_in_format(logicalBaseFormat); GLfloat *newImage; GLint i, n; GLubyte map[6]; /* we only promote up to RGB, RGBA and LUMINANCE_ALPHA formats for now */ ASSERT(textureBaseFormat == GL_RGB || textureBaseFormat == GL_RGBA || textureBaseFormat == GL_LUMINANCE_ALPHA); /* The actual texture format should have at least as many components * as the logical texture format. */ ASSERT(texComponents >= logComponents); newImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth * texComponents * sizeof(GLfloat)); if (!newImage) { _mesa_free(tempImage); return NULL; } compute_component_mapping(logicalBaseFormat, textureBaseFormat, map); n = srcWidth * srcHeight * srcDepth; for (i = 0; i < n; i++) { GLint k; for (k = 0; k < texComponents; k++) { GLint j = map[k]; if (j == ZERO) newImage[i * texComponents + k] = 0.0F; else if (j == ONE) newImage[i * texComponents + k] = 1.0F; else newImage[i * texComponents + k] = tempImage[i * logComponents + j]; } } _mesa_free(tempImage); tempImage = newImage; } return tempImage; } /** * Make a temporary (color) texture image with GLchan components. * Apply all needed pixel unpacking and pixel transfer operations. * Note that there are both logicalBaseFormat and textureBaseFormat parameters. * Suppose the user specifies GL_LUMINANCE as the internal texture format * but the graphics hardware doesn't support luminance textures. So, might * use an RGB hardware format instead. * If logicalBaseFormat != textureBaseFormat we have some extra work to do. * * \param ctx the rendering context * \param dims image dimensions: 1, 2 or 3 * \param logicalBaseFormat basic texture derived from the user's * internal texture format value * \param textureBaseFormat the actual basic format of the texture * \param srcWidth source image width * \param srcHeight source image height * \param srcDepth source image depth * \param srcFormat source image format * \param srcType source image type * \param srcAddr source image address * \param srcPacking source image pixel packing * \return resulting image with format = textureBaseFormat and type = GLchan. */ GLchan * _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, GLenum logicalBaseFormat, GLenum textureBaseFormat, GLint srcWidth, GLint srcHeight, GLint srcDepth, GLenum srcFormat, GLenum srcType, const GLvoid *srcAddr, const struct gl_pixelstore_attrib *srcPacking) { GLuint transferOps = ctx->_ImageTransferState; const GLint components = _mesa_components_in_format(logicalBaseFormat); GLboolean freeSrcImage = GL_FALSE; GLint img, row; GLchan *tempImage, *dst; ASSERT(dims >= 1 && dims <= 3); ASSERT(logicalBaseFormat == GL_RGBA || logicalBaseFormat == GL_RGB || logicalBaseFormat == GL_LUMINANCE_ALPHA || logicalBaseFormat == GL_LUMINANCE || logicalBaseFormat == GL_ALPHA || logicalBaseFormat == GL_INTENSITY); ASSERT(textureBaseFormat == GL_RGBA || textureBaseFormat == GL_RGB || textureBaseFormat == GL_LUMINANCE_ALPHA || textureBaseFormat == GL_LUMINANCE || textureBaseFormat == GL_ALPHA || textureBaseFormat == GL_INTENSITY); if ((dims == 1 && ctx->Pixel.Convolution1DEnabled) || (dims >= 2 && ctx->Pixel.Convolution2DEnabled) || (dims >= 2 && ctx->Pixel.Separable2DEnabled)) { /* get convolved image */ GLfloat *convImage = make_temp_float_image(ctx, dims, logicalBaseFormat, logicalBaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); if (!convImage) return NULL; /* the convolved image is our new source image */ srcAddr = convImage; srcFormat = logicalBaseFormat; srcType = GL_FLOAT; srcPacking = &ctx->DefaultPacking; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); transferOps = 0; freeSrcImage = GL_TRUE; } /* unpack and transfer the source image */ tempImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth * components * sizeof(GLchan)); if (!tempImage) return NULL; dst = tempImage; for (img = 0; img < srcDepth; img++) { const GLint srcStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); const GLubyte *src = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); for (row = 0; row < srcHeight; row++) { _mesa_unpack_color_span_chan(ctx, srcWidth, logicalBaseFormat, dst, srcFormat, srcType, src, srcPacking, transferOps); dst += srcWidth * components; src += srcStride; } } /* If we made a temporary image for convolution, free it here */ if (freeSrcImage) { _mesa_free((void *) srcAddr); } if (logicalBaseFormat != textureBaseFormat) { /* one more conversion step */ GLint texComponents = _mesa_components_in_format(textureBaseFormat); GLint logComponents = _mesa_components_in_format(logicalBaseFormat); GLchan *newImage; GLint i, n; GLubyte map[6]; /* we only promote up to RGB, RGBA and LUMINANCE_ALPHA formats for now */ ASSERT(textureBaseFormat == GL_RGB || textureBaseFormat == GL_RGBA || textureBaseFormat == GL_LUMINANCE_ALPHA); /* The actual texture format should have at least as many components * as the logical texture format. */ ASSERT(texComponents >= logComponents); newImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth * texComponents * sizeof(GLchan)); if (!newImage) { _mesa_free(tempImage); return NULL; } compute_component_mapping(logicalBaseFormat, textureBaseFormat, map); n = srcWidth * srcHeight * srcDepth; for (i = 0; i < n; i++) { GLint k; for (k = 0; k < texComponents; k++) { GLint j = map[k]; if (j == ZERO) newImage[i * texComponents + k] = 0; else if (j == ONE) newImage[i * texComponents + k] = CHAN_MAX; else newImage[i * texComponents + k] = tempImage[i * logComponents + j]; } } _mesa_free(tempImage); tempImage = newImage; } return tempImage; } /** * Copy GLubyte pixels from to with swizzling. * \param dst destination pixels * \param dstComponents number of color components in destination pixels * \param src source pixels * \param srcComponents number of color components in source pixels * \param map the swizzle mapping * \param count number of pixels to copy/swizzle. */ static void swizzle_copy(GLubyte *dst, GLuint dstComponents, const GLubyte *src, GLuint srcComponents, const GLubyte *map, GLuint count) { GLubyte tmp[8]; GLint i; tmp[ZERO] = 0x0; tmp[ONE] = 0xff; switch (dstComponents) { case 4: for (i = 0; i < count; i++) { COPY_4UBV(tmp, src); src += srcComponents; dst[0] = tmp[map[0]]; dst[1] = tmp[map[1]]; dst[2] = tmp[map[2]]; dst[3] = tmp[map[3]]; dst += 4; } break; case 3: for (i = 0; i < count; i++) { COPY_4UBV(tmp, src); src += srcComponents; dst[0] = tmp[map[0]]; dst[1] = tmp[map[1]]; dst[2] = tmp[map[2]]; dst += 3; } break; case 2: for (i = 0; i < count; i++) { COPY_4UBV(tmp, src); src += srcComponents; dst[0] = tmp[map[0]]; dst[1] = tmp[map[1]]; dst += 2; } break; } } /** * Transfer a GLubyte texture image with component swizzling. */ static void _mesa_swizzle_ubyte_image(GLcontext *ctx, GLuint dimensions, GLenum srcFormat, const GLubyte *dstmap, GLint dstComponents, GLvoid *dstAddr, GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, GLint dstRowStride, GLint dstImageStride, GLint srcWidth, GLint srcHeight, GLint srcDepth, const GLvoid *srcAddr, const struct gl_pixelstore_attrib *srcPacking ) { GLint srcComponents = _mesa_components_in_format(srcFormat); GLubyte srcmap[6], map[4]; GLint i; const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, GL_UNSIGNED_BYTE); const GLint srcImageStride = _mesa_image_image_stride(srcPacking, srcWidth, srcHeight, srcFormat, GL_UNSIGNED_BYTE); const GLubyte *srcImage = (const GLubyte *) _mesa_image_address(dimensions, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, GL_UNSIGNED_BYTE, 0, 0, 0); GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstComponents; compute_component_mapping(srcFormat, GL_RGBA, srcmap); for (i = 0; i < 4; i++) map[i] = srcmap[dstmap[i]]; if (srcRowStride == srcWidth * srcComponents && (srcImageStride == srcWidth * srcHeight * srcComponents || srcDepth == 1)) { swizzle_copy(dstImage, dstComponents, srcImage, srcComponents, map, srcWidth * srcHeight * srcDepth); } else { GLint img, row; for (img = 0; img < srcDepth; img++) { const GLubyte *srcRow = srcImage; GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { swizzle_copy(dstRow, dstComponents, srcRow, srcComponents, map, srcWidth); dstRow += dstRowStride; srcRow += srcRowStride; } srcImage += srcImageStride; dstImage += dstImageStride; } } } /** * Teximage storage routine for when a simple memcpy will do. * No pixel transfer operations or special texel encodings allowed. * 1D, 2D and 3D images supported. */ static void memcpy_texture(GLcontext *ctx, GLuint dimensions, const struct gl_texture_format *dstFormat, GLvoid *dstAddr, GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, GLint dstRowStride, GLint dstImageStride, GLint srcWidth, GLint srcHeight, GLint srcDepth, GLenum srcFormat, GLenum srcType, const GLvoid *srcAddr, const struct gl_pixelstore_attrib *srcPacking) { const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); const GLint srcImageStride = _mesa_image_image_stride(srcPacking, srcWidth, srcHeight, srcFormat, srcType); const GLubyte *srcImage = (const GLubyte *) _mesa_image_address(dimensions, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0); const GLint bytesPerRow = srcWidth * dstFormat->TexelBytes; const GLint bytesPerImage = srcHeight * bytesPerRow; const GLint bytesPerTexture = srcDepth * bytesPerImage; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; if (dstRowStride == srcRowStride && dstRowStride == bytesPerRow && ((dstImageStride == srcImageStride && dstImageStride == bytesPerImage) || (srcDepth == 1))) { /* one big memcpy */ ctx->Driver.TextureMemCpy(dstImage, srcImage, bytesPerTexture); } else { GLint img, row; for (img = 0; img < srcDepth; img++) { const GLubyte *srcRow = srcImage; GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { ctx->Driver.TextureMemCpy(dstRow, srcRow, bytesPerRow); dstRow += dstRowStride; srcRow += srcRowStride; } srcImage += srcImageStride; dstImage += dstImageStride; } } } /** * Store an image in any of the formats: * _mesa_texformat_rgba * _mesa_texformat_rgb * _mesa_texformat_alpha * _mesa_texformat_luminance * _mesa_texformat_luminance_alpha * _mesa_texformat_intensity * * \param dims either 1 or 2 or 3 * \param baseInternalFormat user-specified base internal format * \param dstFormat destination Mesa texture format * \param dstAddr destination image address * \param dstX/Y/Zoffset destination x/y/z offset (ala TexSubImage), in texels * \param dstRowStride destination image row stride, in bytes * \param dstImageStride destination image layer stride, in bytes * \param srcWidth/Height/Depth source image size, in pixels * \param srcFormat incoming image format * \param srcType incoming image data type * \param srcAddr source image address * \param srcPacking source image packing parameters */ GLboolean _mesa_texstore_rgba(GLcontext *ctx, GLuint dims, GLenum baseInternalFormat, const struct gl_texture_format *dstFormat, GLvoid *dstAddr, GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, GLint dstRowStride, GLint dstImageStride, GLint srcWidth, GLint srcHeight, GLint srcDepth, GLenum srcFormat, GLenum srcType, const GLvoid *srcAddr, const struct gl_pixelstore_attrib *srcPacking) { const GLint components = _mesa_components_in_format(baseInternalFormat); ASSERT(dstFormat == &_mesa_texformat_rgba || dstFormat == &_mesa_texformat_rgb || dstFormat == &_mesa_texformat_alpha || dstFormat == &_mesa_texformat_luminance || dstFormat == &_mesa_texformat_luminance_alpha || dstFormat == &_mesa_texformat_intensity); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || baseInternalFormat == GL_INTENSITY); ASSERT(dstFormat->TexelBytes == components * sizeof(GLchan)); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && baseInternalFormat == srcFormat && srcType == CHAN_TYPE) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_rgb && srcFormat == GL_RGBA && srcType == CHAN_TYPE) { /* extract RGB from RGBA */ int img, row, col; GLchan *dstImage = (GLchan *) (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; for (img = 0; img < srcDepth; img++) { const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLchan *srcRow = (GLchan *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLchan *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col * 3 + RCOMP] = srcRow[col * 4 + RCOMP]; dstRow[col * 3 + GCOMP] = srcRow[col * 4 + GCOMP]; dstRow[col * 3 + BCOMP] = srcRow[col * 4 + BCOMP]; } dstRow += dstRowStride; srcRow = (GLchan *) ((GLubyte *) srcRow + srcRowStride); } dstImage += dstImageStride; } } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); const GLchan *src = tempImage; GLint bytesPerRow; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row; if (!tempImage) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); bytesPerRow = srcWidth * components * sizeof(GLchan); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { _mesa_memcpy(dstRow, src, bytesPerRow); dstRow += dstRowStride; src += srcWidth * components; } dstImage += dstImageStride; } _mesa_free((void *) tempImage); } return GL_TRUE; } /** * Store a floating point depth component texture image. */ GLboolean _mesa_texstore_depth_component_float32(STORE_PARAMS) { (void) dims; ASSERT(dstFormat == &_mesa_texformat_depth_component_float32); ASSERT(dstFormat->TexelBytes == sizeof(GLfloat)); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && baseInternalFormat == GL_DEPTH_COMPONENT && srcFormat == GL_DEPTH_COMPONENT && srcType == GL_FLOAT) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else { /* general path */ GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row; for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { const GLvoid *src = _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); _mesa_unpack_depth_span(ctx, srcWidth, (GLfloat *) dstRow, srcType, src, srcPacking); dstRow += dstRowStride; } dstImage += dstImageStride; } } return GL_TRUE; } /** * Store a 16-bit integer depth component texture image. */ GLboolean _mesa_texstore_depth_component16(STORE_PARAMS) { (void) dims; ASSERT(dstFormat == &_mesa_texformat_depth_component16); ASSERT(dstFormat->TexelBytes == sizeof(GLushort)); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && baseInternalFormat == GL_DEPTH_COMPONENT && srcFormat == GL_DEPTH_COMPONENT && srcType == GL_UNSIGNED_SHORT) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else { /* general path */ GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row, col; for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { GLfloat depthTemp[MAX_WIDTH]; const GLvoid *src = _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); GLushort *dst16 = (GLushort *) dstRow; _mesa_unpack_depth_span(ctx, srcWidth, depthTemp, srcType, src, srcPacking); for (col = 0; col < srcWidth; col++) { dst16[col] = (GLushort) (depthTemp[col] * 65535.0F); } dstRow += dstRowStride; } dstImage += dstImageStride; } } return GL_TRUE; } /** * Store an rgb565 or rgb565_rev texture image. */ GLboolean _mesa_texstore_rgb565(STORE_PARAMS) { ASSERT(dstFormat == &_mesa_texformat_rgb565 || dstFormat == &_mesa_texformat_rgb565_rev); ASSERT(dstFormat->TexelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_rgb565 && baseInternalFormat == GL_RGB && srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && baseInternalFormat == GL_RGB && srcFormat == GL_RGB && srcType == GL_UNSIGNED_BYTE && dims == 2) { /* do optimized tex store */ const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); const GLubyte *src = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0); GLubyte *dst = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint row, col; for (row = 0; row < srcHeight; row++) { const GLubyte *srcUB = (const GLubyte *) src; GLushort *dstUS = (GLushort *) dst; /* check for byteswapped format */ if (dstFormat == &_mesa_texformat_rgb565) { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_565( srcUB[0], srcUB[1], srcUB[2] ); srcUB += 3; } } else { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_565_REV( srcUB[0], srcUB[1], srcUB[2] ); srcUB += 3; } } dst += dstRowStride; src += srcRowStride; } } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); const GLchan *src = tempImage; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row, col; if (!tempImage) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; /* check for byteswapped format */ if (dstFormat == &_mesa_texformat_rgb565) { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_565( CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), CHAN_TO_UBYTE(src[BCOMP]) ); src += 3; } } else { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_565_REV( CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), CHAN_TO_UBYTE(src[BCOMP]) ); src += 3; } } dstRow += dstRowStride; } dstImage += dstImageStride; } _mesa_free((void *) tempImage); } return GL_TRUE; } GLboolean _mesa_texstore_rgba8888(STORE_PARAMS) { const GLuint ui = 1; const GLubyte littleEndian = *((const GLubyte *) &ui); (void)littleEndian; ASSERT(dstFormat == &_mesa_texformat_rgba8888 || dstFormat == &_mesa_texformat_rgba8888_rev); ASSERT(dstFormat->TexelBytes == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_rgba8888 && baseInternalFormat == GL_RGBA && ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8) || (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8_REV))) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } #if 0 else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && srcType == GL_UNSIGNED_BYTE && dstFormat == &_mesa_texformat_rgba8888 && littleEndian && /* Three texture formats involved: srcFormat, * baseInternalFormat and destFormat (GL_RGBA). Only two * may differ. _mesa_swizzle_ubyte_image can't handle two * propagations at once correctly. */ (srcFormat == baseInternalFormat || baseInternalFormat == GL_RGBA) && can_swizzle(srcFormat)) { GLubyte dstmap[4]; /* dstmap - how to swizzle from GL_RGBA to dst format: * * FIXME - add !litteEndian and _rev varients: */ dstmap[3] = 0; dstmap[2] = 1; dstmap[1] = 2; dstmap[0] = 3; _mesa_swizzle_ubyte_image(ctx, dims, srcFormat, dstmap, 4, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); } #endif else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); const GLchan *src = tempImage; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row, col; if (!tempImage) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; if (dstFormat == &_mesa_texformat_rgba8888) { for (col = 0; col < srcWidth; col++) { dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), CHAN_TO_UBYTE(src[BCOMP]), CHAN_TO_UBYTE(src[ACOMP]) ); src += 4; } } else { for (col = 0; col < srcWidth; col++) { dstUI[col] = PACK_COLOR_8888_REV( CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), CHAN_TO_UBYTE(src[BCOMP]), CHAN_TO_UBYTE(src[ACOMP]) ); src += 4; } } dstRow += dstRowStride; } dstImage += dstImageStride; } _mesa_free((void *) tempImage); } return GL_TRUE; } GLboolean _mesa_texstore_argb8888(STORE_PARAMS) { const GLuint ui = 1; const GLubyte littleEndian = *((const GLubyte *) &ui); ASSERT(dstFormat == &_mesa_texformat_argb8888 || dstFormat == &_mesa_texformat_argb8888_rev); ASSERT(dstFormat->TexelBytes == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_argb8888 && baseInternalFormat == GL_RGBA && srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && littleEndian) || srcType == GL_UNSIGNED_INT_8_8_8_8_REV)) { /* simple memcpy path (little endian) */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_argb8888_rev && baseInternalFormat == GL_RGBA && srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && !littleEndian) || srcType == GL_UNSIGNED_INT_8_8_8_8)) { /* simple memcpy path (big endian) */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_argb8888 && srcFormat == GL_RGB && srcType == GL_UNSIGNED_BYTE) { int img, row, col; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; for (img = 0; img < srcDepth; img++) { const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col * 4 + 0] = srcRow[col * 3 + BCOMP]; dstRow[col * 4 + 1] = srcRow[col * 3 + GCOMP]; dstRow[col * 4 + 2] = srcRow[col * 3 + RCOMP]; dstRow[col * 4 + 3] = 0xff; } dstRow += dstRowStride; srcRow += srcRowStride; } dstImage += dstImageStride; } } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_argb8888 && srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { int img, row, col; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; for (img = 0; img < srcDepth; img++) { const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col * 4 + 0] = srcRow[col * 4 + BCOMP]; dstRow[col * 4 + 1] = srcRow[col * 4 + GCOMP]; dstRow[col * 4 + 2] = srcRow[col * 4 + RCOMP]; dstRow[col * 4 + 3] = srcRow[col * 4 + ACOMP]; } dstRow += dstRowStride; srcRow += srcRowStride; } dstImage += dstImageStride; } } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_argb8888 && srcType == GL_UNSIGNED_BYTE && littleEndian && /* Three texture formats involved: srcFormat, * baseInternalFormat and destFormat (GL_RGBA). Only two * may differ. _mesa_swizzle_ubyte_image can't handle two * propagations at once correctly. */ (srcFormat == baseInternalFormat || baseInternalFormat == GL_RGBA) && can_swizzle(srcFormat)) { GLubyte dstmap[4]; /* dstmap - how to swizzle from GL_RGBA to dst format: */ dstmap[3] = 3; /* alpha */ dstmap[2] = 0; /* red */ dstmap[1] = 1; /* green */ dstmap[0] = 2; /* blue */ _mesa_swizzle_ubyte_image(ctx, dims, srcFormat, dstmap, 4, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcAddr, srcPacking); } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); const GLchan *src = tempImage; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row, col; if (!tempImage) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; if (dstFormat == &_mesa_texformat_argb8888) { for (col = 0; col < srcWidth; col++) { dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[ACOMP]), CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), CHAN_TO_UBYTE(src[BCOMP]) ); src += 4; } } else { for (col = 0; col < srcWidth; col++) { dstUI[col] = PACK_COLOR_8888_REV( CHAN_TO_UBYTE(src[ACOMP]), CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), CHAN_TO_UBYTE(src[BCOMP]) ); src += 4; } } dstRow += dstRowStride; } dstImage += dstImageStride; } _mesa_free((void *) tempImage); } return GL_TRUE; } GLboolean _mesa_texstore_rgb888(STORE_PARAMS) { const GLuint ui = 1; const GLubyte littleEndian = *((const GLubyte *) &ui); ASSERT(dstFormat == &_mesa_texformat_rgb888); ASSERT(dstFormat->TexelBytes == 3); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && baseInternalFormat == GL_RGB && srcFormat == GL_BGR && srcType == GL_UNSIGNED_BYTE && littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { /* extract RGB from RGBA */ int img, row, col; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; for (img = 0; img < srcDepth; img++) { const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col * 3 + 0] = srcRow[col * 4 + BCOMP]; dstRow[col * 3 + 1] = srcRow[col * 4 + GCOMP]; dstRow[col * 3 + 2] = srcRow[col * 4 + RCOMP]; } dstRow += dstRowStride; srcRow += srcRowStride; } dstImage += dstImageStride; } } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); const GLchan *src = (const GLchan *) tempImage; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row, col; if (!tempImage) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { #if 0 if (littleEndian) { for (col = 0; col < srcWidth; col++) { dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[RCOMP]); dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]); dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[BCOMP]); srcUB += 3; } } else { for (col = 0; col < srcWidth; col++) { dstRow[col * 3 + 0] = srcUB[BCOMP]; dstRow[col * 3 + 1] = srcUB[GCOMP]; dstRow[col * 3 + 2] = srcUB[RCOMP]; srcUB += 3; } } #else for (col = 0; col < srcWidth; col++) { dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[BCOMP]); dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]); dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[RCOMP]); src += 3; } #endif dstRow += dstRowStride; } dstImage += dstImageStride; } _mesa_free((void *) tempImage); } return GL_TRUE; } GLboolean _mesa_texstore_bgr888(STORE_PARAMS) { const GLuint ui = 1; const GLubyte littleEndian = *((const GLubyte *) &ui); ASSERT(dstFormat == &_mesa_texformat_bgr888); ASSERT(dstFormat->TexelBytes == 3); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && baseInternalFormat == GL_RGB && srcFormat == GL_RGB && srcType == GL_UNSIGNED_BYTE && littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { /* extract BGR from RGBA */ int img, row, col; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; for (img = 0; img < srcDepth; img++) { const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col * 3 + 0] = srcRow[col * 4 + RCOMP]; dstRow[col * 3 + 1] = srcRow[col * 4 + GCOMP]; dstRow[col * 3 + 2] = srcRow[col * 4 + BCOMP]; } dstRow += dstRowStride; srcRow += srcRowStride; } dstImage += dstImageStride; } } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); const GLchan *src = (const GLchan *) tempImage; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row, col; if (!tempImage) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[RCOMP]); dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]); dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[BCOMP]); src += 3; } dstRow += dstRowStride; } dstImage += dstImageStride; } _mesa_free((void *) tempImage); } return GL_TRUE; } GLboolean _mesa_texstore_argb4444(STORE_PARAMS) { ASSERT(dstFormat == &_mesa_texformat_argb4444 || dstFormat == &_mesa_texformat_argb4444_rev); ASSERT(dstFormat->TexelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_argb4444 && baseInternalFormat == GL_RGBA && srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); const GLchan *src = tempImage; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row, col; if (!tempImage) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; if (dstFormat == &_mesa_texformat_argb4444) { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_4444( CHAN_TO_UBYTE(src[ACOMP]), CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), CHAN_TO_UBYTE(src[BCOMP]) ); src += 4; } } else { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_4444_REV( CHAN_TO_UBYTE(src[ACOMP]), CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), CHAN_TO_UBYTE(src[BCOMP]) ); src += 4; } } dstRow += dstRowStride; } dstImage += dstImageStride; } _mesa_free((void *) tempImage); } return GL_TRUE; } GLboolean _mesa_texstore_argb1555(STORE_PARAMS) { ASSERT(dstFormat == &_mesa_texformat_argb1555 || dstFormat == &_mesa_texformat_argb1555_rev); ASSERT(dstFormat->TexelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_argb1555 && baseInternalFormat == GL_RGBA && srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); const GLchan *src =tempImage; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row, col; if (!tempImage) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; if (dstFormat == &_mesa_texformat_argb1555) { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_1555( CHAN_TO_UBYTE(src[ACOMP]), CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), CHAN_TO_UBYTE(src[BCOMP]) ); src += 4; } } else { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_1555_REV( CHAN_TO_UBYTE(src[ACOMP]), CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), CHAN_TO_UBYTE(src[BCOMP]) ); src += 4; } } dstRow += dstRowStride; } dstImage += dstImageStride; } _mesa_free((void *) tempImage); } return GL_TRUE; } GLboolean _mesa_texstore_al88(STORE_PARAMS) { const GLuint ui = 1; const GLubyte littleEndian = *((const GLubyte *) &ui); ASSERT(dstFormat == &_mesa_texformat_al88 || dstFormat == &_mesa_texformat_al88_rev); ASSERT(dstFormat->TexelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && dstFormat == &_mesa_texformat_al88 && baseInternalFormat == GL_LUMINANCE_ALPHA && srcFormat == GL_LUMINANCE_ALPHA && srcType == GL_UNSIGNED_BYTE && littleEndian) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); const GLchan *src = tempImage; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row, col; if (!tempImage) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; if (dstFormat == &_mesa_texformat_al88) { for (col = 0; col < srcWidth; col++) { /* src[0] is luminance, src[1] is alpha */ dstUS[col] = PACK_COLOR_88( CHAN_TO_UBYTE(src[1]), CHAN_TO_UBYTE(src[0]) ); src += 2; } } else { for (col = 0; col < srcWidth; col++) { /* src[0] is luminance, src[1] is alpha */ dstUS[col] = PACK_COLOR_88_REV( CHAN_TO_UBYTE(src[1]), CHAN_TO_UBYTE(src[0]) ); src += 2; } } dstRow += dstRowStride; } dstImage += dstImageStride; } _mesa_free((void *) tempImage); } return GL_TRUE; } GLboolean _mesa_texstore_rgb332(STORE_PARAMS) { ASSERT(dstFormat == &_mesa_texformat_rgb332); ASSERT(dstFormat->TexelBytes == 1); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && baseInternalFormat == GL_RGB && srcFormat == GL_RGB && srcType == GL_UNSIGNED_BYTE_3_3_2) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); const GLchan *src = tempImage; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row, col; if (!tempImage) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col] = PACK_COLOR_332( CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), CHAN_TO_UBYTE(src[BCOMP]) ); src += 3; } dstRow += dstRowStride; } dstImage += dstImageStride; } _mesa_free((void *) tempImage); } return GL_TRUE; } /** * Texstore for _mesa_texformat_a8, _mesa_texformat_l8, _mesa_texformat_i8. */ GLboolean _mesa_texstore_a8(STORE_PARAMS) { ASSERT(dstFormat == &_mesa_texformat_a8 || dstFormat == &_mesa_texformat_l8 || dstFormat == &_mesa_texformat_i8); ASSERT(dstFormat->TexelBytes == 1); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && baseInternalFormat == srcFormat && srcType == GL_UNSIGNED_BYTE) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else { /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); const GLchan *src = tempImage; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row, col; if (!tempImage) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col] = CHAN_TO_UBYTE(src[col]); } dstRow += dstRowStride; src += srcWidth; } dstImage += dstImageStride; } _mesa_free((void *) tempImage); } return GL_TRUE; } GLboolean _mesa_texstore_ci8(STORE_PARAMS) { (void) dims; (void) baseInternalFormat; ASSERT(dstFormat == &_mesa_texformat_ci8); ASSERT(dstFormat->TexelBytes == 1); ASSERT(baseInternalFormat == GL_COLOR_INDEX); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && srcFormat == GL_COLOR_INDEX && srcType == GL_UNSIGNED_BYTE) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else { /* general path */ GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row; for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { const GLvoid *src = _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); _mesa_unpack_index_span(ctx, srcWidth, GL_UNSIGNED_BYTE, dstRow, srcType, src, srcPacking, ctx->_ImageTransferState); dstRow += dstRowStride; } dstImage += dstImageStride; } } return GL_TRUE; } /** * Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_rev. */ GLboolean _mesa_texstore_ycbcr(STORE_PARAMS) { const GLuint ui = 1; const GLubyte littleEndian = *((const GLubyte *) &ui); (void) ctx; (void) dims; (void) baseInternalFormat; ASSERT((dstFormat == &_mesa_texformat_ycbcr) || (dstFormat == &_mesa_texformat_ycbcr_rev)); ASSERT(dstFormat->TexelBytes == 2); ASSERT(ctx->Extensions.MESA_ycbcr_texture); ASSERT(srcFormat == GL_YCBCR_MESA); ASSERT((srcType == GL_UNSIGNED_SHORT_8_8_MESA) || (srcType == GL_UNSIGNED_SHORT_8_8_REV_MESA)); ASSERT(baseInternalFormat == GL_YCBCR_MESA); /* always just memcpy since no pixel transfer ops apply */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); /* Check if we need byte swapping */ /* XXX the logic here _might_ be wrong */ if (srcPacking->SwapBytes ^ (srcType == GL_UNSIGNED_SHORT_8_8_REV_MESA) ^ (dstFormat == &_mesa_texformat_ycbcr_rev) ^ !littleEndian) { GLubyte *pImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row; for (img = 0; img < srcDepth; img++) { GLubyte *pRow = pImage; for (row = 0; row < srcHeight; row++) { _mesa_swap2((GLushort *) pRow, srcWidth); pRow += dstRowStride; } pImage += dstImageStride; } } return GL_TRUE; } /** * Store an image in any of the formats: * _mesa_texformat_rgba_float32 * _mesa_texformat_rgb_float32 * _mesa_texformat_alpha_float32 * _mesa_texformat_luminance_float32 * _mesa_texformat_luminance_alpha_float32 * _mesa_texformat_intensity_float32 */ GLboolean _mesa_texstore_rgba_float32(STORE_PARAMS) { const GLint components = _mesa_components_in_format(baseInternalFormat); ASSERT(dstFormat == &_mesa_texformat_rgba_float32 || dstFormat == &_mesa_texformat_rgb_float32 || dstFormat == &_mesa_texformat_alpha_float32 || dstFormat == &_mesa_texformat_luminance_float32 || dstFormat == &_mesa_texformat_luminance_alpha_float32 || dstFormat == &_mesa_texformat_intensity_float32); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || baseInternalFormat == GL_INTENSITY); ASSERT(dstFormat->TexelBytes == components * sizeof(GLfloat)); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && baseInternalFormat == srcFormat && srcType == GL_FLOAT) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else { /* general path */ const GLfloat *tempImage = make_temp_float_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); const GLfloat *src = tempImage; GLint bytesPerRow; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row; if (!tempImage) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); bytesPerRow = srcWidth * components * sizeof(GLfloat); for (img = 0; img < srcDepth; img++) { GLubyte *dst = dstImage; for (row = 0; row < srcHeight; row++) { _mesa_memcpy(dst, src, bytesPerRow); dst += dstRowStride; src += srcWidth * components; } dstImage += dstImageStride; } _mesa_free((void *) tempImage); } return GL_TRUE; } /** * As above, but store 16-bit floats. */ GLboolean _mesa_texstore_rgba_float16(STORE_PARAMS) { const GLint components = _mesa_components_in_format(baseInternalFormat); ASSERT(dstFormat == &_mesa_texformat_rgba_float16 || dstFormat == &_mesa_texformat_rgb_float16 || dstFormat == &_mesa_texformat_alpha_float16 || dstFormat == &_mesa_texformat_luminance_float16 || dstFormat == &_mesa_texformat_luminance_alpha_float16 || dstFormat == &_mesa_texformat_intensity_float16); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || baseInternalFormat == GL_INTENSITY); ASSERT(dstFormat->TexelBytes == components * sizeof(GLhalfARB)); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && baseInternalFormat == srcFormat && srcType == GL_HALF_FLOAT_ARB) { /* simple memcpy path */ memcpy_texture(ctx, dims, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageStride, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); } else { /* general path */ const GLfloat *tempImage = make_temp_float_image(ctx, dims, baseInternalFormat, dstFormat->BaseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); const GLfloat *src = tempImage; GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; GLint img, row; if (!tempImage) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { GLhalfARB *dstTexel = (GLhalfARB *) dstRow; GLint i; for (i = 0; i < srcWidth * components; i++) { dstTexel[i] = _mesa_float_to_half(src[i]); } dstRow += dstRowStride; src += srcWidth * components; } dstImage += dstImageStride; } _mesa_free((void *) tempImage); } return GL_TRUE; } /** * Check if an unpack PBO is active prior to fetching a texture image. * If so, do bounds checking and map the buffer into main memory. * Any errors detected will be recorded. * The caller _must_ call _mesa_unmap_teximage_pbo() too! */ const GLvoid * _mesa_validate_pbo_teximage(GLcontext *ctx, GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *unpack, const char *funcName) { GLubyte *buf; if (unpack->BufferObj->Name == 0) { /* no PBO */ return pixels; } if (!_mesa_validate_pbo_access(dimensions, unpack, width, height, depth, format, type, pixels)) { _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(invalid PBO access"); return NULL; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, unpack->BufferObj); if (!buf) { _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped"); return NULL; } return ADD_POINTERS(buf, pixels); } /** * Check if an unpack PBO is active prior to fetching a compressed texture * image. * If so, do bounds checking and map the buffer into main memory. * Any errors detected will be recorded. * The caller _must_ call _mesa_unmap_teximage_pbo() too! */ const GLvoid * _mesa_validate_pbo_compressed_teximage(GLcontext *ctx, GLsizei imageSize, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, const char *funcName) { GLubyte *buf; if (packing->BufferObj->Name == 0) { /* not using a PBO - return pointer unchanged */ return pixels; } if ((const GLubyte *) pixels + imageSize > (const GLubyte *)(uintptr_t) packing->BufferObj->Size) { /* out of bounds read! */ _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(invalid PBO access"); return NULL; } buf = (GLubyte*) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, packing->BufferObj); if (!buf) { _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped"); return NULL; } return ADD_POINTERS(buf, pixels); } /** * This function must be called after either of the validate_pbo_*_teximage() * functions. It unmaps the PBO buffer if it was mapped earlier. */ void _mesa_unmap_teximage_pbo(GLcontext *ctx, const struct gl_pixelstore_attrib *unpack) { if (unpack->BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, unpack->BufferObj); } } /* * This is the software fallback for Driver.TexImage1D() * and Driver.CopyTexImage1D(). * \sa _mesa_store_teximage2d() */ void _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { GLint postConvWidth = width; GLint sizeInBytes; (void) border; if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); } /* choose the texture format */ assert(ctx->Driver.ChooseTextureFormat); texImage->TexFormat = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); assert(texImage->TexFormat); texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D; texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df; /* allocate memory */ if (texImage->IsCompressed) sizeInBytes = texImage->CompressedSize; else sizeInBytes = postConvWidth * texImage->TexFormat->TexelBytes; texImage->Data = _mesa_alloc_texmemory(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); return; } pixels = _mesa_validate_pbo_teximage(ctx, 1, width, 1, 1, format, type, pixels, packing, "glTexImage1D"); if (!pixels) { /* Note: we check for a NULL image pointer here, _after_ we allocated * memory for the texture. That's what the GL spec calls for. */ return; } else { const GLint dstRowStride = 0, dstImageStride = 0; GLboolean success; ASSERT(texImage->TexFormat->StoreImage); success = texImage->TexFormat->StoreImage(ctx, 1, texImage->Format, texImage->TexFormat, texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ dstRowStride, dstImageStride, width, 1, 1, format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); } } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { _mesa_generate_mipmap(ctx, target, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } _mesa_unmap_teximage_pbo(ctx, packing); } /** * This is the software fallback for Driver.TexImage2D() * and Driver.CopyTexImage2D(). * We store the image in heap memory. We know nothing about on-board * VRAM here. But since most DRI drivers rely on keeping a copy of all * textures in main memory, this routine will typically be used by * hardware drivers too. * * Reasons why a driver might override this function: * - Special memory allocation needs (VRAM, AGP, etc) * - Unusual row/image strides or padding * - Special housekeeping * - Using VRAM-based Pixel Buffer Objects */ void _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { GLint postConvWidth = width, postConvHeight = height; GLint texelBytes, sizeInBytes; (void) border; if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); } /* choose the texture format */ assert(ctx->Driver.ChooseTextureFormat); texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, internalFormat, format, type); assert(texImage->TexFormat); texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D; texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df; texelBytes = texImage->TexFormat->TexelBytes; /* allocate memory */ if (texImage->IsCompressed) sizeInBytes = texImage->CompressedSize; else sizeInBytes = postConvWidth * postConvHeight * texelBytes; texImage->Data = _mesa_alloc_texmemory(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); return; } pixels = _mesa_validate_pbo_teximage(ctx, 2, width, height, 1, format, type, pixels, packing, "glTexImage2D"); if (!pixels) { /* Note: we check for a NULL image pointer here, _after_ we allocated * memory for the texture. That's what the GL spec calls for. */ return; } else { GLint dstRowStride, dstImageStride = 0; GLboolean success; if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,width); } else { dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes; } ASSERT(texImage->TexFormat->StoreImage); success = texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, texImage->TexFormat, texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ dstRowStride, dstImageStride, width, height, 1, format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); } } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { _mesa_generate_mipmap(ctx, target, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } _mesa_unmap_teximage_pbo(ctx, packing); } /** * This is the software fallback for Driver.TexImage3D() * and Driver.CopyTexImage3D(). * \sa _mesa_store_teximage2d() */ void _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { GLint texelBytes, sizeInBytes; (void) border; /* choose the texture format */ assert(ctx->Driver.ChooseTextureFormat); texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, internalFormat, format, type); assert(texImage->TexFormat); texImage->FetchTexelc = texImage->TexFormat->FetchTexel3D; texImage->FetchTexelf = texImage->TexFormat->FetchTexel3Df; texelBytes = texImage->TexFormat->TexelBytes; /* allocate memory */ if (texImage->IsCompressed) sizeInBytes = texImage->CompressedSize; else sizeInBytes = width * height * depth * texelBytes; texImage->Data = _mesa_alloc_texmemory(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); return; } pixels = _mesa_validate_pbo_teximage(ctx, 3, width, height, depth, format, type, pixels, packing, "glTexImage3D"); if (!pixels) { /* Note: we check for a NULL image pointer here, _after_ we allocated * memory for the texture. That's what the GL spec calls for. */ return; } else { GLint dstRowStride, dstImageStride; GLboolean success; if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat,width); dstImageStride = 0; } else { dstRowStride = width * texImage->TexFormat->TexelBytes; dstImageStride = dstRowStride * height; } ASSERT(texImage->TexFormat->StoreImage); success = texImage->TexFormat->StoreImage(ctx, 3, texImage->Format, texImage->TexFormat, texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ dstRowStride, dstImageStride, width, height, depth, format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); } } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { _mesa_generate_mipmap(ctx, target, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } _mesa_unmap_teximage_pbo(ctx, packing); } /* * This is the software fallback for Driver.TexSubImage1D() * and Driver.CopyTexSubImage1D(). */ void _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint width, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { pixels = _mesa_validate_pbo_teximage(ctx, 1, width, 1, 1, format, type, pixels, packing, "glTexSubImage1D"); if (!pixels) return; { const GLint dstRowStride = 0, dstImageStride = 0; GLboolean success; ASSERT(texImage->TexFormat->StoreImage); success = texImage->TexFormat->StoreImage(ctx, 1, texImage->Format, texImage->TexFormat, texImage->Data, xoffset, 0, 0, /* offsets */ dstRowStride, dstImageStride, width, 1, 1, format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D"); } } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { _mesa_generate_mipmap(ctx, target, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } _mesa_unmap_teximage_pbo(ctx, packing); } /** * This is the software fallback for Driver.TexSubImage2D() * and Driver.CopyTexSubImage2D(). */ void _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint width, GLint height, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { pixels = _mesa_validate_pbo_teximage(ctx, 2, width, height, 1, format, type, pixels, packing, "glTexSubImage2D"); if (!pixels) return; { GLint dstRowStride = 0, dstImageStride = 0; GLboolean success; if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, texImage->Width); } else { dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes; } ASSERT(texImage->TexFormat->StoreImage); success = texImage->TexFormat->StoreImage(ctx, 2, texImage->Format, texImage->TexFormat, texImage->Data, xoffset, yoffset, 0, dstRowStride, dstImageStride, width, height, 1, format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D"); } } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { _mesa_generate_mipmap(ctx, target, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } _mesa_unmap_teximage_pbo(ctx, packing); } /* * This is the software fallback for Driver.TexSubImage3D(). * and Driver.CopyTexSubImage3D(). */ void _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const void *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { pixels = _mesa_validate_pbo_teximage(ctx, 3, width, height, depth, format, type, pixels, packing, "glTexSubImage3D"); if (!pixels) return; { GLint dstRowStride, dstImageStride; GLboolean success; if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, texImage->Width); dstImageStride = 0; /* XXX fix */ } else { dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes; dstImageStride = dstRowStride * texImage->Height; } ASSERT(texImage->TexFormat->StoreImage); success = texImage->TexFormat->StoreImage(ctx, 3, texImage->Format, texImage->TexFormat, texImage->Data, xoffset, yoffset, zoffset, dstRowStride, dstImageStride, width, height, depth, format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage3D"); } } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { _mesa_generate_mipmap(ctx, target, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } _mesa_unmap_teximage_pbo(ctx, packing); } /* * Fallback for Driver.CompressedTexImage1D() */ void _mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { /* this space intentionally left blank */ (void) ctx; (void) target; (void) level; (void) internalFormat; (void) width; (void) border; (void) imageSize; (void) data; (void) texObj; (void) texImage; } /* * Fallback for Driver.CompressedTexImage2D() */ void _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { (void) width; (void) height; (void) border; /* This is pretty simple, basically just do a memcpy without worrying * about the usual image unpacking or image transfer operations. */ ASSERT(texObj); ASSERT(texImage); ASSERT(texImage->Width > 0); ASSERT(texImage->Height > 0); ASSERT(texImage->Depth == 1); ASSERT(texImage->Data == NULL); /* was freed in glCompressedTexImage2DARB */ /* choose the texture format */ assert(ctx->Driver.ChooseTextureFormat); texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, internalFormat, 0, 0); assert(texImage->TexFormat); texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D; texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df; /* allocate storage */ texImage->Data = _mesa_alloc_texmemory(imageSize); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); return; } data = _mesa_validate_pbo_compressed_teximage(ctx, imageSize, data, &ctx->Unpack, "glCompressedTexImage2D"); if (!data) return; /* copy the data */ ASSERT(texImage->CompressedSize == (GLuint) imageSize); MEMCPY(texImage->Data, data, imageSize); /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { _mesa_generate_mipmap(ctx, target, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack); } /* * Fallback for Driver.CompressedTexImage3D() */ void _mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { /* this space intentionally left blank */ (void) ctx; (void) target; (void) level; (void) internalFormat; (void) width; (void) height; (void) depth; (void) border; (void) imageSize; (void) data; (void) texObj; (void) texImage; } /** * Fallback for Driver.CompressedTexSubImage1D() */ void _mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { /* this space intentionally left blank */ (void) ctx; (void) target; (void) level; (void) xoffset; (void) width; (void) format; (void) imageSize; (void) data; (void) texObj; (void) texImage; } /** * Fallback for Driver.CompressedTexSubImage2D() */ void _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { GLint bytesPerRow, destRowStride, srcRowStride; GLint i, rows; GLubyte *dest; const GLubyte *src; (void) format; /* these should have been caught sooner */ ASSERT((width & 3) == 0 || width == 2 || width == 1); ASSERT((height & 3) == 0 || height == 2 || height == 1); ASSERT((xoffset & 3) == 0); ASSERT((yoffset & 3) == 0); data = _mesa_validate_pbo_compressed_teximage(ctx, imageSize, data, &ctx->Unpack, "glCompressedTexSubImage2D"); if (!data) return; srcRowStride = _mesa_compressed_row_stride(texImage->IntFormat, width); src = (const GLubyte *) data; destRowStride = _mesa_compressed_row_stride(texImage->IntFormat, texImage->Width); dest = _mesa_compressed_image_address(xoffset, yoffset, 0, texImage->IntFormat, texImage->Width, (GLubyte*) texImage->Data); bytesPerRow = srcRowStride; rows = height / 4; for (i = 0; i < rows; i++) { MEMCPY(dest, src, bytesPerRow); dest += destRowStride; src += srcRowStride; } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { _mesa_generate_mipmap(ctx, target, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack); } /** * Fallback for Driver.CompressedTexSubImage3D() */ void _mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { /* this space intentionally left blank */ (void) ctx; (void) target; (void) level; (void) xoffset; (void) yoffset; (void) zoffset; (void) width; (void) height; (void) depth; (void) format; (void) imageSize; (void) data; (void) texObj; (void) texImage; } /* * Average together two rows of a source image to produce a single new * row in the dest image. It's legal for the two source rows to point * to the same data. The source width must be equal to either the * dest width or two times the dest width. */ static void do_row(const struct gl_texture_format *format, GLint srcWidth, const GLvoid *srcRowA, const GLvoid *srcRowB, GLint dstWidth, GLvoid *dstRow) { const GLuint k0 = (srcWidth == dstWidth) ? 0 : 1; const GLuint colStride = (srcWidth == dstWidth) ? 1 : 2; /* This assertion is no longer valid with non-power-of-2 textures assert(srcWidth == dstWidth || srcWidth == 2 * dstWidth); */ switch (format->MesaFormat) { case MESA_FORMAT_RGBA: { GLuint i, j, k; const GLchan (*rowA)[4] = (const GLchan (*)[4]) srcRowA; const GLchan (*rowB)[4] = (const GLchan (*)[4]) srcRowB; GLchan (*dst)[4] = (GLchan (*)[4]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4; } } return; case MESA_FORMAT_RGB: { GLuint i, j, k; const GLchan (*rowA)[3] = (const GLchan (*)[3]) srcRowA; const GLchan (*rowB)[3] = (const GLchan (*)[3]) srcRowB; GLchan (*dst)[3] = (GLchan (*)[3]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; } } return; case MESA_FORMAT_ALPHA: case MESA_FORMAT_LUMINANCE: case MESA_FORMAT_INTENSITY: { GLuint i, j, k; const GLchan *rowA = (const GLchan *) srcRowA; const GLchan *rowB = (const GLchan *) srcRowB; GLchan *dst = (GLchan *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4; } } return; case MESA_FORMAT_LUMINANCE_ALPHA: { GLuint i, j, k; const GLchan (*rowA)[2] = (const GLchan (*)[2]) srcRowA; const GLchan (*rowB)[2] = (const GLchan (*)[2]) srcRowB; GLchan (*dst)[2] = (GLchan (*)[2]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; } } return; case MESA_FORMAT_DEPTH_COMPONENT_FLOAT32: { GLuint i, j, k; const GLfloat *rowA = (const GLfloat *) srcRowA; const GLfloat *rowB = (const GLfloat *) srcRowB; GLfloat *dst = (GLfloat *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F; } } return; case MESA_FORMAT_DEPTH_COMPONENT16: { GLuint i, j, k; const GLushort *rowA = (const GLushort *) srcRowA; const GLushort *rowB = (const GLushort *) srcRowB; GLushort *dst = (GLushort *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4; } } return; /* Begin hardware formats */ case MESA_FORMAT_RGBA8888: case MESA_FORMAT_RGBA8888_REV: case MESA_FORMAT_ARGB8888: case MESA_FORMAT_ARGB8888_REV: { GLuint i, j, k; const GLubyte (*rowA)[4] = (const GLubyte (*)[4]) srcRowA; const GLubyte (*rowB)[4] = (const GLubyte (*)[4]) srcRowB; GLubyte (*dst)[4] = (GLubyte (*)[4]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4; } } return; case MESA_FORMAT_RGB888: case MESA_FORMAT_BGR888: { GLuint i, j, k; const GLubyte (*rowA)[3] = (const GLubyte (*)[3]) srcRowA; const GLubyte (*rowB)[3] = (const GLubyte (*)[3]) srcRowB; GLubyte (*dst)[3] = (GLubyte (*)[3]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; } } return; case MESA_FORMAT_RGB565: case MESA_FORMAT_RGB565_REV: { GLuint i, j, k; const GLushort *rowA = (const GLushort *) srcRowA; const GLushort *rowB = (const GLushort *) srcRowB; GLushort *dst = (GLushort *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { const GLint rowAr0 = rowA[j] & 0x1f; const GLint rowAr1 = rowA[k] & 0x1f; const GLint rowBr0 = rowB[j] & 0x1f; const GLint rowBr1 = rowB[k] & 0x1f; const GLint rowAg0 = (rowA[j] >> 5) & 0x3f; const GLint rowAg1 = (rowA[k] >> 5) & 0x3f; const GLint rowBg0 = (rowB[j] >> 5) & 0x3f; const GLint rowBg1 = (rowB[k] >> 5) & 0x3f; const GLint rowAb0 = (rowA[j] >> 11) & 0x1f; const GLint rowAb1 = (rowA[k] >> 11) & 0x1f; const GLint rowBb0 = (rowB[j] >> 11) & 0x1f; const GLint rowBb1 = (rowB[k] >> 11) & 0x1f; const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; dst[i] = (blue << 11) | (green << 5) | red; } } return; case MESA_FORMAT_ARGB4444: case MESA_FORMAT_ARGB4444_REV: { GLuint i, j, k; const GLushort *rowA = (const GLushort *) srcRowA; const GLushort *rowB = (const GLushort *) srcRowB; GLushort *dst = (GLushort *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { const GLint rowAr0 = rowA[j] & 0xf; const GLint rowAr1 = rowA[k] & 0xf; const GLint rowBr0 = rowB[j] & 0xf; const GLint rowBr1 = rowB[k] & 0xf; const GLint rowAg0 = (rowA[j] >> 4) & 0xf; const GLint rowAg1 = (rowA[k] >> 4) & 0xf; const GLint rowBg0 = (rowB[j] >> 4) & 0xf; const GLint rowBg1 = (rowB[k] >> 4) & 0xf; const GLint rowAb0 = (rowA[j] >> 8) & 0xf; const GLint rowAb1 = (rowA[k] >> 8) & 0xf; const GLint rowBb0 = (rowB[j] >> 8) & 0xf; const GLint rowBb1 = (rowB[k] >> 8) & 0xf; const GLint rowAa0 = (rowA[j] >> 12) & 0xf; const GLint rowAa1 = (rowA[k] >> 12) & 0xf; const GLint rowBa0 = (rowB[j] >> 12) & 0xf; const GLint rowBa1 = (rowB[k] >> 12) & 0xf; const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2; dst[i] = (alpha << 12) | (blue << 8) | (green << 4) | red; } } return; case MESA_FORMAT_ARGB1555: case MESA_FORMAT_ARGB1555_REV: /* XXX broken? */ { GLuint i, j, k; const GLushort *rowA = (const GLushort *) srcRowA; const GLushort *rowB = (const GLushort *) srcRowB; GLushort *dst = (GLushort *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { const GLint rowAr0 = rowA[j] & 0x1f; const GLint rowAr1 = rowA[k] & 0x1f; const GLint rowBr0 = rowB[j] & 0x1f; const GLint rowBr1 = rowB[k] & 0xf; const GLint rowAg0 = (rowA[j] >> 5) & 0x1f; const GLint rowAg1 = (rowA[k] >> 5) & 0x1f; const GLint rowBg0 = (rowB[j] >> 5) & 0x1f; const GLint rowBg1 = (rowB[k] >> 5) & 0x1f; const GLint rowAb0 = (rowA[j] >> 10) & 0x1f; const GLint rowAb1 = (rowA[k] >> 10) & 0x1f; const GLint rowBb0 = (rowB[j] >> 10) & 0x1f; const GLint rowBb1 = (rowB[k] >> 10) & 0x1f; const GLint rowAa0 = (rowA[j] >> 15) & 0x1; const GLint rowAa1 = (rowA[k] >> 15) & 0x1; const GLint rowBa0 = (rowB[j] >> 15) & 0x1; const GLint rowBa1 = (rowB[k] >> 15) & 0x1; const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2; dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red; } } return; case MESA_FORMAT_AL88: case MESA_FORMAT_AL88_REV: { GLuint i, j, k; const GLubyte (*rowA)[2] = (const GLubyte (*)[2]) srcRowA; const GLubyte (*rowB)[2] = (const GLubyte (*)[2]) srcRowB; GLubyte (*dst)[2] = (GLubyte (*)[2]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) >> 2; dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) >> 2; } } return; case MESA_FORMAT_RGB332: { GLuint i, j, k; const GLubyte *rowA = (const GLubyte *) srcRowA; const GLubyte *rowB = (const GLubyte *) srcRowB; GLubyte *dst = (GLubyte *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { const GLint rowAr0 = rowA[j] & 0x3; const GLint rowAr1 = rowA[k] & 0x3; const GLint rowBr0 = rowB[j] & 0x3; const GLint rowBr1 = rowB[k] & 0x3; const GLint rowAg0 = (rowA[j] >> 2) & 0x7; const GLint rowAg1 = (rowA[k] >> 2) & 0x7; const GLint rowBg0 = (rowB[j] >> 2) & 0x7; const GLint rowBg1 = (rowB[k] >> 2) & 0x7; const GLint rowAb0 = (rowA[j] >> 5) & 0x7; const GLint rowAb1 = (rowA[k] >> 5) & 0x7; const GLint rowBb0 = (rowB[j] >> 5) & 0x7; const GLint rowBb1 = (rowB[k] >> 5) & 0x7; const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; dst[i] = (blue << 5) | (green << 2) | red; } } return; case MESA_FORMAT_A8: case MESA_FORMAT_L8: case MESA_FORMAT_I8: case MESA_FORMAT_CI8: { GLuint i, j, k; const GLubyte *rowA = (const GLubyte *) srcRowA; const GLubyte *rowB = (const GLubyte *) srcRowB; GLubyte *dst = (GLubyte *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) >> 2; } } return; case MESA_FORMAT_RGBA_FLOAT32: { GLuint i, j, k; const GLfloat (*rowA)[4] = (const GLfloat (*)[4]) srcRowA; const GLfloat (*rowB)[4] = (const GLfloat (*)[4]) srcRowB; GLfloat (*dst)[4] = (GLfloat (*)[4]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) * 0.25F; dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) * 0.25F; dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) * 0.25F; dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) * 0.25F; } } return; case MESA_FORMAT_RGBA_FLOAT16: { GLuint i, j, k, comp; const GLhalfARB (*rowA)[4] = (const GLhalfARB (*)[4]) srcRowA; const GLhalfARB (*rowB)[4] = (const GLhalfARB (*)[4]) srcRowB; GLhalfARB (*dst)[4] = (GLhalfARB (*)[4]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { for (comp = 0; comp < 4; comp++) { GLfloat aj, ak, bj, bk; aj = _mesa_half_to_float(rowA[j][comp]); ak = _mesa_half_to_float(rowA[k][comp]); bj = _mesa_half_to_float(rowB[j][comp]); bk = _mesa_half_to_float(rowB[k][comp]); dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); } } } return; case MESA_FORMAT_RGB_FLOAT32: { GLuint i, j, k; const GLfloat (*rowA)[3] = (const GLfloat (*)[3]) srcRowA; const GLfloat (*rowB)[3] = (const GLfloat (*)[3]) srcRowB; GLfloat (*dst)[3] = (GLfloat (*)[3]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) * 0.25F; dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) * 0.25F; dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) * 0.25F; } } return; case MESA_FORMAT_RGB_FLOAT16: { GLuint i, j, k, comp; const GLhalfARB (*rowA)[3] = (const GLhalfARB (*)[3]) srcRowA; const GLhalfARB (*rowB)[3] = (const GLhalfARB (*)[3]) srcRowB; GLhalfARB (*dst)[3] = (GLhalfARB (*)[3]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { for (comp = 0; comp < 3; comp++) { GLfloat aj, ak, bj, bk; aj = _mesa_half_to_float(rowA[j][comp]); ak = _mesa_half_to_float(rowA[k][comp]); bj = _mesa_half_to_float(rowB[j][comp]); bk = _mesa_half_to_float(rowB[k][comp]); dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); } } } return; case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: { GLuint i, j, k; const GLfloat (*rowA)[2] = (const GLfloat (*)[2]) srcRowA; const GLfloat (*rowB)[2] = (const GLfloat (*)[2]) srcRowB; GLfloat (*dst)[2] = (GLfloat (*)[2]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) * 0.25F; dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) * 0.25F; } } return; case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: { GLuint i, j, k, comp; const GLhalfARB (*rowA)[2] = (const GLhalfARB (*)[2]) srcRowA; const GLhalfARB (*rowB)[2] = (const GLhalfARB (*)[2]) srcRowB; GLhalfARB (*dst)[2] = (GLhalfARB (*)[2]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { for (comp = 0; comp < 2; comp++) { GLfloat aj, ak, bj, bk; aj = _mesa_half_to_float(rowA[j][comp]); ak = _mesa_half_to_float(rowA[k][comp]); bj = _mesa_half_to_float(rowB[j][comp]); bk = _mesa_half_to_float(rowB[k][comp]); dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); } } } return; case MESA_FORMAT_ALPHA_FLOAT32: case MESA_FORMAT_LUMINANCE_FLOAT32: case MESA_FORMAT_INTENSITY_FLOAT32: { GLuint i, j, k; const GLfloat *rowA = (const GLfloat *) srcRowA; const GLfloat *rowB = (const GLfloat *) srcRowB; GLfloat *dst = (GLfloat *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F; } } return; case MESA_FORMAT_ALPHA_FLOAT16: case MESA_FORMAT_LUMINANCE_FLOAT16: case MESA_FORMAT_INTENSITY_FLOAT16: { GLuint i, j, k; const GLhalfARB *rowA = (const GLhalfARB *) srcRowA; const GLhalfARB *rowB = (const GLhalfARB *) srcRowB; GLhalfARB *dst = (GLhalfARB *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { GLfloat aj, ak, bj, bk; aj = _mesa_half_to_float(rowA[j]); ak = _mesa_half_to_float(rowA[k]); bj = _mesa_half_to_float(rowB[j]); bk = _mesa_half_to_float(rowB[k]); dst[i] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); } } return; default: _mesa_problem(NULL, "bad format in do_row()"); } } /* * These functions generate a 1/2-size mipmap image from a source image. * Texture borders are handled by copying or averaging the source image's * border texels, depending on the scale-down factor. */ static void make_1d_mipmap(const struct gl_texture_format *format, GLint border, GLint srcWidth, const GLubyte *srcPtr, GLint dstWidth, GLubyte *dstPtr) { const GLint bpt = format->TexelBytes; const GLubyte *src; GLubyte *dst; /* skip the border pixel, if any */ src = srcPtr + border * bpt; dst = dstPtr + border * bpt; /* we just duplicate the input row, kind of hack, saves code */ do_row(format, srcWidth - 2 * border, src, src, dstWidth - 2 * border, dst); if (border) { /* copy left-most pixel from source */ MEMCPY(dstPtr, srcPtr, bpt); /* copy right-most pixel from source */ MEMCPY(dstPtr + (dstWidth - 1) * bpt, srcPtr + (srcWidth - 1) * bpt, bpt); } } static void make_2d_mipmap(const struct gl_texture_format *format, GLint border, GLint srcWidth, GLint srcHeight, const GLubyte *srcPtr, GLint dstWidth, GLint dstHeight, GLubyte *dstPtr) { const GLint bpt = format->TexelBytes; const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ const GLint dstWidthNB = dstWidth - 2 * border; const GLint dstHeightNB = dstHeight - 2 * border; const GLint srcRowStride = bpt * srcWidth; const GLint dstRowStride = bpt * dstWidth; const GLubyte *srcA, *srcB; GLubyte *dst; GLint row; /* Compute src and dst pointers, skipping any border */ srcA = srcPtr + border * ((srcWidth + 1) * bpt); if (srcHeight > 1) srcB = srcA + srcRowStride; else srcB = srcA; dst = dstPtr + border * ((dstWidth + 1) * bpt); for (row = 0; row < dstHeightNB; row++) { do_row(format, srcWidthNB, srcA, srcB, dstWidthNB, dst); srcA += 2 * srcRowStride; srcB += 2 * srcRowStride; dst += dstRowStride; } /* This is ugly but probably won't be used much */ if (border > 0) { /* fill in dest border */ /* lower-left border pixel */ MEMCPY(dstPtr, srcPtr, bpt); /* lower-right border pixel */ MEMCPY(dstPtr + (dstWidth - 1) * bpt, srcPtr + (srcWidth - 1) * bpt, bpt); /* upper-left border pixel */ MEMCPY(dstPtr + dstWidth * (dstHeight - 1) * bpt, srcPtr + srcWidth * (srcHeight - 1) * bpt, bpt); /* upper-right border pixel */ MEMCPY(dstPtr + (dstWidth * dstHeight - 1) * bpt, srcPtr + (srcWidth * srcHeight - 1) * bpt, bpt); /* lower border */ do_row(format, srcWidthNB, srcPtr + bpt, srcPtr + bpt, dstWidthNB, dstPtr + bpt); /* upper border */ do_row(format, srcWidthNB, srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt, srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt, dstWidthNB, dstPtr + (dstWidth * (dstHeight - 1) + 1) * bpt); /* left and right borders */ if (srcHeight == dstHeight) { /* copy border pixel from src to dst */ for (row = 1; row < srcHeight; row++) { MEMCPY(dstPtr + dstWidth * row * bpt, srcPtr + srcWidth * row * bpt, bpt); MEMCPY(dstPtr + (dstWidth * row + dstWidth - 1) * bpt, srcPtr + (srcWidth * row + srcWidth - 1) * bpt, bpt); } } else { /* average two src pixels each dest pixel */ for (row = 0; row < dstHeightNB; row += 2) { do_row(format, 1, srcPtr + (srcWidth * (row * 2 + 1)) * bpt, srcPtr + (srcWidth * (row * 2 + 2)) * bpt, 1, dstPtr + (dstWidth * row + 1) * bpt); do_row(format, 1, srcPtr + (srcWidth * (row * 2 + 1) + srcWidth - 1) * bpt, srcPtr + (srcWidth * (row * 2 + 2) + srcWidth - 1) * bpt, 1, dstPtr + (dstWidth * row + 1 + dstWidth - 1) * bpt); } } } } static void make_3d_mipmap(const struct gl_texture_format *format, GLint border, GLint srcWidth, GLint srcHeight, GLint srcDepth, const GLubyte *srcPtr, GLint dstWidth, GLint dstHeight, GLint dstDepth, GLubyte *dstPtr) { const GLint bpt = format->TexelBytes; const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ const GLint srcDepthNB = srcDepth - 2 * border; const GLint dstWidthNB = dstWidth - 2 * border; const GLint dstHeightNB = dstHeight - 2 * border; const GLint dstDepthNB = dstDepth - 2 * border; GLvoid *tmpRowA, *tmpRowB; GLint img, row; GLint bytesPerSrcImage, bytesPerDstImage; GLint bytesPerSrcRow, bytesPerDstRow; GLint srcImageOffset, srcRowOffset; (void) srcDepthNB; /* silence warnings */ /* Need two temporary row buffers */ tmpRowA = _mesa_malloc(srcWidth * bpt); if (!tmpRowA) return; tmpRowB = _mesa_malloc(srcWidth * bpt); if (!tmpRowB) { _mesa_free(tmpRowA); return; } bytesPerSrcImage = srcWidth * srcHeight * bpt; bytesPerDstImage = dstWidth * dstHeight * bpt; bytesPerSrcRow = srcWidth * bpt; bytesPerDstRow = dstWidth * bpt; /* Offset between adjacent src images to be averaged together */ srcImageOffset = (srcDepth == dstDepth) ? 0 : bytesPerSrcImage; /* Offset between adjacent src rows to be averaged together */ srcRowOffset = (srcHeight == dstHeight) ? 0 : srcWidth * bpt; /* * Need to average together up to 8 src pixels for each dest pixel. * Break that down into 3 operations: * 1. take two rows from source image and average them together. * 2. take two rows from next source image and average them together. * 3. take the two averaged rows and average them for the final dst row. */ /* _mesa_printf("mip3d %d x %d x %d -> %d x %d x %d\n", srcWidth, srcHeight, srcDepth, dstWidth, dstHeight, dstDepth); */ for (img = 0; img < dstDepthNB; img++) { /* first source image pointer, skipping border */ const GLubyte *imgSrcA = srcPtr + (bytesPerSrcImage + bytesPerSrcRow + border) * bpt * border + img * (bytesPerSrcImage + srcImageOffset); /* second source image pointer, skipping border */ const GLubyte *imgSrcB = imgSrcA + srcImageOffset; /* address of the dest image, skipping border */ GLubyte *imgDst = dstPtr + (bytesPerDstImage + bytesPerDstRow + border) * bpt * border + img * bytesPerDstImage; /* setup the four source row pointers and the dest row pointer */ const GLubyte *srcImgARowA = imgSrcA; const GLubyte *srcImgARowB = imgSrcA + srcRowOffset; const GLubyte *srcImgBRowA = imgSrcB; const GLubyte *srcImgBRowB = imgSrcB + srcRowOffset; GLubyte *dstImgRow = imgDst; for (row = 0; row < dstHeightNB; row++) { /* Average together two rows from first src image */ do_row(format, srcWidthNB, srcImgARowA, srcImgARowB, srcWidthNB, tmpRowA); /* Average together two rows from second src image */ do_row(format, srcWidthNB, srcImgBRowA, srcImgBRowB, srcWidthNB, tmpRowB); /* Average together the temp rows to make the final row */ do_row(format, srcWidthNB, tmpRowA, tmpRowB, dstWidthNB, dstImgRow); /* advance to next rows */ srcImgARowA += bytesPerSrcRow + srcRowOffset; srcImgARowB += bytesPerSrcRow + srcRowOffset; srcImgBRowA += bytesPerSrcRow + srcRowOffset; srcImgBRowB += bytesPerSrcRow + srcRowOffset; dstImgRow += bytesPerDstRow; } } _mesa_free(tmpRowA); _mesa_free(tmpRowB); /* Luckily we can leverage the make_2d_mipmap() function here! */ if (border > 0) { /* do front border image */ make_2d_mipmap(format, 1, srcWidth, srcHeight, srcPtr, dstWidth, dstHeight, dstPtr); /* do back border image */ make_2d_mipmap(format, 1, srcWidth, srcHeight, srcPtr + bytesPerSrcImage * (srcDepth - 1), dstWidth, dstHeight, dstPtr + bytesPerDstImage * (dstDepth - 1)); /* do four remaining border edges that span the image slices */ if (srcDepth == dstDepth) { /* just copy border pixels from src to dst */ for (img = 0; img < dstDepthNB; img++) { const GLubyte *src; GLubyte *dst; /* do border along [img][row=0][col=0] */ src = srcPtr + (img + 1) * bytesPerSrcImage; dst = dstPtr + (img + 1) * bytesPerDstImage; MEMCPY(dst, src, bpt); /* do border along [img][row=dstHeight-1][col=0] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage + (srcHeight - 1) * bytesPerSrcRow; dst = dstPtr + (img + 1) * bytesPerDstImage + (dstHeight - 1) * bytesPerDstRow; MEMCPY(dst, src, bpt); /* do border along [img][row=0][col=dstWidth-1] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage + (srcWidth - 1) * bpt; dst = dstPtr + (img + 1) * bytesPerDstImage + (dstWidth - 1) * bpt; MEMCPY(dst, src, bpt); /* do border along [img][row=dstHeight-1][col=dstWidth-1] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage + (bytesPerSrcImage - bpt); dst = dstPtr + (img + 1) * bytesPerDstImage + (bytesPerDstImage - bpt); MEMCPY(dst, src, bpt); } } else { /* average border pixels from adjacent src image pairs */ ASSERT(srcDepthNB == 2 * dstDepthNB); for (img = 0; img < dstDepthNB; img++) { const GLubyte *src; GLubyte *dst; /* do border along [img][row=0][col=0] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage; dst = dstPtr + (img + 1) * bytesPerDstImage; do_row(format, 1, src, src + srcImageOffset, 1, dst); /* do border along [img][row=dstHeight-1][col=0] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage + (srcHeight - 1) * bytesPerSrcRow; dst = dstPtr + (img + 1) * bytesPerDstImage + (dstHeight - 1) * bytesPerDstRow; do_row(format, 1, src, src + srcImageOffset, 1, dst); /* do border along [img][row=0][col=dstWidth-1] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage + (srcWidth - 1) * bpt; dst = dstPtr + (img + 1) * bytesPerDstImage + (dstWidth - 1) * bpt; do_row(format, 1, src, src + srcImageOffset, 1, dst); /* do border along [img][row=dstHeight-1][col=dstWidth-1] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage + (bytesPerSrcImage - bpt); dst = dstPtr + (img + 1) * bytesPerDstImage + (bytesPerDstImage - bpt); do_row(format, 1, src, src + srcImageOffset, 1, dst); } } } } /* * For GL_SGIX_generate_mipmap: * Generate a complete set of mipmaps from texObj's base-level image. * Stop at texObj's MaxLevel or when we get to the 1x1 texture. */ void _mesa_generate_mipmap(GLcontext *ctx, GLenum target, const struct gl_texture_unit *texUnit, struct gl_texture_object *texObj) { const struct gl_texture_image *srcImage; const struct gl_texture_format *convertFormat; const GLubyte *srcData = NULL; GLubyte *dstData = NULL; GLint level, maxLevels; ASSERT(texObj); /* XXX choose cube map face here??? */ srcImage = texObj->Image[0][texObj->BaseLevel]; ASSERT(srcImage); maxLevels = _mesa_max_texture_levels(ctx, texObj->Target); ASSERT(maxLevels > 0); /* bad target */ /* Find convertFormat - the format that do_row() will process */ if (srcImage->IsCompressed) { /* setup for compressed textures */ GLuint row; GLint components, size; GLchan *dst; assert(texObj->Target == GL_TEXTURE_2D); if (srcImage->Format == GL_RGB) { convertFormat = &_mesa_texformat_rgb; components = 3; } else if (srcImage->Format == GL_RGBA) { convertFormat = &_mesa_texformat_rgba; components = 4; } else { _mesa_problem(ctx, "bad srcImage->Format in _mesa_generate_mipmaps"); return; } /* allocate storage for uncompressed GL_RGB or GL_RGBA images */ size = _mesa_bytes_per_pixel(srcImage->Format, CHAN_TYPE) * srcImage->Width * srcImage->Height * srcImage->Depth + 20; /* 20 extra bytes, just be safe when calling last FetchTexel */ srcData = (GLubyte *) _mesa_malloc(size); if (!srcData) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); return; } dstData = (GLubyte *) _mesa_malloc(size / 2); /* 1/4 would probably be OK */ if (!dstData) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); _mesa_free((void *) srcData); return; } /* decompress base image here */ dst = (GLchan *) srcData; for (row = 0; row < srcImage->Height; row++) { GLuint col; for (col = 0; col < srcImage->Width; col++) { srcImage->FetchTexelc(srcImage, col, row, 0, dst); dst += components; } } } else { /* uncompressed */ convertFormat = srcImage->TexFormat; } for (level = texObj->BaseLevel; level < texObj->MaxLevel && level < maxLevels - 1; level++) { /* generate image[level+1] from image[level] */ const struct gl_texture_image *srcImage; struct gl_texture_image *dstImage; GLint srcWidth, srcHeight, srcDepth; GLint dstWidth, dstHeight, dstDepth; GLint border, bytesPerTexel; /* get src image parameters */ srcImage = _mesa_select_tex_image(ctx, texUnit, target, level); ASSERT(srcImage); srcWidth = srcImage->Width; srcHeight = srcImage->Height; srcDepth = srcImage->Depth; border = srcImage->Border; /* compute next (level+1) image size */ if (srcWidth - 2 * border > 1) { dstWidth = (srcWidth - 2 * border) / 2 + 2 * border; } else { dstWidth = srcWidth; /* can't go smaller */ } if (srcHeight - 2 * border > 1) { dstHeight = (srcHeight - 2 * border) / 2 + 2 * border; } else { dstHeight = srcHeight; /* can't go smaller */ } if (srcDepth - 2 * border > 1) { dstDepth = (srcDepth - 2 * border) / 2 + 2 * border; } else { dstDepth = srcDepth; /* can't go smaller */ } if (dstWidth == srcWidth && dstHeight == srcHeight && dstDepth == srcDepth) { /* all done */ if (srcImage->IsCompressed) { _mesa_free((void *) srcData); _mesa_free(dstData); } return; } /* get dest gl_texture_image */ dstImage = _mesa_get_tex_image(ctx, texUnit, target, level + 1); if (!dstImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); return; } /* Free old image data */ if (dstImage->Data) ctx->Driver.FreeTexImageData(ctx, dstImage); /* initialize new image */ _mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight, dstDepth, border, srcImage->IntFormat); dstImage->DriverData = NULL; dstImage->TexFormat = srcImage->TexFormat; dstImage->FetchTexelc = srcImage->FetchTexelc; dstImage->FetchTexelf = srcImage->FetchTexelf; ASSERT(dstImage->TexFormat); ASSERT(dstImage->FetchTexelc); ASSERT(dstImage->FetchTexelf); /* Alloc new teximage data buffer. * Setup src and dest data pointers. */ if (dstImage->IsCompressed) { ASSERT(dstImage->CompressedSize > 0); /* set by init_teximage_fields*/ dstImage->Data = _mesa_alloc_texmemory(dstImage->CompressedSize); if (!dstImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); return; } /* srcData and dstData are already set */ ASSERT(srcData); ASSERT(dstData); } else { bytesPerTexel = srcImage->TexFormat->TexelBytes; ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0); dstImage->Data = _mesa_alloc_texmemory(dstWidth * dstHeight * dstDepth * bytesPerTexel); if (!dstImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); return; } srcData = (const GLubyte *) srcImage->Data; dstData = (GLubyte *) dstImage->Data; } /* * We use simple 2x2 averaging to compute the next mipmap level. */ switch (target) { case GL_TEXTURE_1D: make_1d_mipmap(convertFormat, border, srcWidth, srcData, dstWidth, dstData); break; case GL_TEXTURE_2D: case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: make_2d_mipmap(convertFormat, border, srcWidth, srcHeight, srcData, dstWidth, dstHeight, dstData); break; case GL_TEXTURE_3D: make_3d_mipmap(convertFormat, border, srcWidth, srcHeight, srcDepth, srcData, dstWidth, dstHeight, dstDepth, dstData); break; case GL_TEXTURE_RECTANGLE_NV: /* no mipmaps, do nothing */ break; default: _mesa_problem(ctx, "bad dimensions in _mesa_generate_mipmaps"); return; } if (dstImage->IsCompressed) { GLubyte *temp; /* compress image from dstData into dstImage->Data */ const GLenum srcFormat = convertFormat->BaseFormat; GLint dstRowStride = _mesa_compressed_row_stride(srcImage->IntFormat, dstWidth); ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA); dstImage->TexFormat->StoreImage(ctx, 2, dstImage->Format, dstImage->TexFormat, dstImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ dstRowStride, 0, /* strides */ dstWidth, dstHeight, 1, /* size */ srcFormat, CHAN_TYPE, dstData, /* src data, actually */ &ctx->DefaultPacking); /* swap src and dest pointers */ temp = (GLubyte *) srcData; srcData = dstData; dstData = temp; } } /* loop over mipmap levels */ } /** * Helper function for drivers which need to rescale texture images to * certain aspect ratios. * Nearest filtering only (for broken hardware that can't support * all aspect ratios). This can be made a lot faster, but I don't * really care enough... */ void _mesa_rescale_teximage2d (GLuint bytesPerPixel, GLuint srcStrideInPixels, GLuint dstRowStride, GLint srcWidth, GLint srcHeight, GLint dstWidth, GLint dstHeight, const GLvoid *srcImage, GLvoid *dstImage) { GLint row, col; #define INNER_LOOP( TYPE, HOP, WOP ) \ for ( row = 0 ; row < dstHeight ; row++ ) { \ GLint srcRow = row HOP hScale; \ for ( col = 0 ; col < dstWidth ; col++ ) { \ GLint srcCol = col WOP wScale; \ dst[col] = src[srcRow * srcStrideInPixels + srcCol]; \ } \ dst = (TYPE *) ((GLubyte *) dst + dstRowStride); \ } \ #define RESCALE_IMAGE( TYPE ) \ do { \ const TYPE *src = (const TYPE *)srcImage; \ TYPE *dst = (TYPE *)dstImage; \ \ if ( srcHeight < dstHeight ) { \ const GLint hScale = dstHeight / srcHeight; \ if ( srcWidth < dstWidth ) { \ const GLint wScale = dstWidth / srcWidth; \ INNER_LOOP( TYPE, /, / ); \ } \ else { \ const GLint wScale = srcWidth / dstWidth; \ INNER_LOOP( TYPE, /, * ); \ } \ } \ else { \ const GLint hScale = srcHeight / dstHeight; \ if ( srcWidth < dstWidth ) { \ const GLint wScale = dstWidth / srcWidth; \ INNER_LOOP( TYPE, *, / ); \ } \ else { \ const GLint wScale = srcWidth / dstWidth; \ INNER_LOOP( TYPE, *, * ); \ } \ } \ } while (0) switch ( bytesPerPixel ) { case 4: RESCALE_IMAGE( GLuint ); break; case 2: RESCALE_IMAGE( GLushort ); break; case 1: RESCALE_IMAGE( GLubyte ); break; default: _mesa_problem(NULL,"unexpected bytes/pixel in _mesa_rescale_teximage2d"); } } /** * Upscale an image by replication, not (typical) stretching. * We use this when the image width or height is less than a * certain size (4, 8) and we need to upscale an image. */ void _mesa_upscale_teximage2d (GLsizei inWidth, GLsizei inHeight, GLsizei outWidth, GLsizei outHeight, GLint comps, const GLchan *src, GLint srcRowStride, GLchan *dest ) { GLint i, j, k; ASSERT(outWidth >= inWidth); ASSERT(outHeight >= inHeight); #if 0 ASSERT(inWidth == 1 || inWidth == 2 || inHeight == 1 || inHeight == 2); ASSERT((outWidth & 3) == 0); ASSERT((outHeight & 3) == 0); #endif for (i = 0; i < outHeight; i++) { const GLint ii = i % inHeight; for (j = 0; j < outWidth; j++) { const GLint jj = j % inWidth; for (k = 0; k < comps; k++) { dest[(i * outWidth + j) * comps + k] = src[ii * srcRowStride + jj * comps + k]; } } } } /** * This is the software fallback for Driver.GetTexImage(). * All error checking will have been done before this routine is called. */ void _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels, const struct gl_texture_object *texObj, const struct gl_texture_image *texImage) { GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2; if (ctx->Pack.BufferObj->Name) { /* pack texture image into a PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(dimensions, &ctx->Pack, texImage->Width, texImage->Height, texImage->Depth, format, type, pixels)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(invalid PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION,"glGetTexImage(PBO is mapped)"); return; } pixels = ADD_POINTERS(buf, pixels); } else if (!pixels) { /* not an error */ return; } { const GLint width = texImage->Width; const GLint height = texImage->Height; const GLint depth = texImage->Depth; GLint img, row; for (img = 0; img < depth; img++) { for (row = 0; row < height; row++) { /* compute destination address in client memory */ GLvoid *dest = _mesa_image_address( dimensions, &ctx->Pack, pixels, width, height, format, type, img, row, 0); assert(dest); if (format == GL_COLOR_INDEX) { GLuint indexRow[MAX_WIDTH]; GLint col; /* Can't use FetchTexel here because that returns RGBA */ if (texImage->TexFormat->IndexBits == 8) { const GLubyte *src = (const GLubyte *) texImage->Data; for (col = 0; col < width; col++) { indexRow[col] = src[texImage->Width * (img * texImage->Height + row) + col]; } } else if (texImage->TexFormat->IndexBits == 16) { const GLushort *src = (const GLushort *) texImage->Data; for (col = 0; col < width; col++) { indexRow[col] = src[texImage->Width * (img * texImage->Height + row) + col]; } } else { _mesa_problem(ctx, "Color index problem in _mesa_GetTexImage"); } _mesa_pack_index_span(ctx, width, type, dest, indexRow, &ctx->Pack, 0 /* no image transfer */); } else if (format == GL_DEPTH_COMPONENT) { GLfloat depthRow[MAX_WIDTH]; GLint col; for (col = 0; col < width; col++) { (*texImage->FetchTexelf)(texImage, col, row, img, depthRow + col); } _mesa_pack_depth_span(ctx, width, dest, type, depthRow, &ctx->Pack); } else if (format == GL_YCBCR_MESA) { /* No pixel transfer */ const GLint rowstride = texImage->RowStride; MEMCPY(dest, (const GLushort *) texImage->Data + row * rowstride, width * sizeof(GLushort)); /* check for byte swapping */ if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) || (texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV && type == GL_UNSIGNED_SHORT_8_8_MESA)) { if (!ctx->Pack.SwapBytes) _mesa_swap2((GLushort *) dest, width); } else if (ctx->Pack.SwapBytes) { _mesa_swap2((GLushort *) dest, width); } } else { /* general case: convert row to RGBA format */ GLfloat rgba[MAX_WIDTH][4]; GLint col; for (col = 0; col < width; col++) { (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]); } _mesa_pack_rgba_span_float(ctx, width, (const GLfloat (*)[4]) rgba, format, type, dest, &ctx->Pack, 0 /* no image transfer */); } /* format */ } /* row */ } /* img */ } if (ctx->Pack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, ctx->Pack.BufferObj); } } /** * This is the software fallback for Driver.GetCompressedTexImage(). * All error checking will have been done before this routine is called. */ void _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, GLvoid *img, const struct gl_texture_object *texObj, const struct gl_texture_image *texImage) { if (ctx->Pack.BufferObj->Name) { /* pack texture image into a PBO */ GLubyte *buf; if ((const GLubyte *) img + texImage->CompressedSize > (const GLubyte *) ctx->Pack.BufferObj->Size) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetCompressedTexImage(invalid PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetCompressedTexImage(PBO is mapped)"); return; } img = ADD_POINTERS(buf, img); } else if (!img) { /* not an error */ return; } /* just memcpy, no pixelstore or pixel transfer */ MEMCPY(img, texImage->Data, texImage->CompressedSize); if (ctx->Pack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, ctx->Pack.BufferObj); } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/texstore.h0000644000000000000000000002617313614532424020200 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file texstore.h * Texture image storage routines. * * \author Brian Paul */ #ifndef TEXSTORE_H #define TEXSTORE_H #include "mtypes.h" /* Macro just to save some typing */ #define STORE_PARAMS \ GLcontext *ctx, GLuint dims, \ GLenum baseInternalFormat, \ const struct gl_texture_format *dstFormat, \ GLvoid *dstAddr, \ GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \ GLint dstRowStride, GLint dstImageStride, \ GLint srcWidth, GLint srcHeight, GLint srcDepth, \ GLenum srcFormat, GLenum srcType, \ const GLvoid *srcAddr, \ const struct gl_pixelstore_attrib *srcPacking extern GLboolean _mesa_texstore_rgba(STORE_PARAMS); extern GLboolean _mesa_texstore_color_index(STORE_PARAMS); extern GLboolean _mesa_texstore_depth_component16(STORE_PARAMS); extern GLboolean _mesa_texstore_depth_component_float32(STORE_PARAMS); extern GLboolean _mesa_texstore_rgba8888(STORE_PARAMS); extern GLboolean _mesa_texstore_argb8888(STORE_PARAMS); extern GLboolean _mesa_texstore_rgb888(STORE_PARAMS); extern GLboolean _mesa_texstore_bgr888(STORE_PARAMS); extern GLboolean _mesa_texstore_rgb565(STORE_PARAMS); extern GLboolean _mesa_texstore_rgb565_rev(STORE_PARAMS); extern GLboolean _mesa_texstore_argb4444(STORE_PARAMS); extern GLboolean _mesa_texstore_argb4444_rev(STORE_PARAMS); extern GLboolean _mesa_texstore_argb1555(STORE_PARAMS); extern GLboolean _mesa_texstore_argb1555_rev(STORE_PARAMS); extern GLboolean _mesa_texstore_al88(STORE_PARAMS); extern GLboolean _mesa_texstore_al88_rev(STORE_PARAMS); extern GLboolean _mesa_texstore_rgb332(STORE_PARAMS); extern GLboolean _mesa_texstore_a8(STORE_PARAMS); extern GLboolean _mesa_texstore_ci8(STORE_PARAMS); extern GLboolean _mesa_texstore_ycbcr(STORE_PARAMS); extern GLboolean _mesa_texstore_rgba_float32(STORE_PARAMS); extern GLboolean _mesa_texstore_rgba_float16(STORE_PARAMS); extern GLboolean _mesa_texstore_rgb_fxt1(STORE_PARAMS); extern GLboolean _mesa_texstore_rgba_fxt1(STORE_PARAMS); extern GLboolean _mesa_texstore_rgb_dxt1(STORE_PARAMS); extern GLboolean _mesa_texstore_rgba_dxt1(STORE_PARAMS); extern GLboolean _mesa_texstore_rgba_dxt3(STORE_PARAMS); extern GLboolean _mesa_texstore_rgba_dxt5(STORE_PARAMS); extern GLchan * _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, GLenum logicalBaseFormat, GLenum textureBaseFormat, GLint srcWidth, GLint srcHeight, GLint srcDepth, GLenum srcFormat, GLenum srcType, const GLvoid *srcAddr, const struct gl_pixelstore_attrib *srcPacking); extern void _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); extern void _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); extern void _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); extern void _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); extern void _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint width, GLint height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); extern void _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage); extern void _mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage); extern void _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage); extern void _mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint depth, GLint border, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage); extern void _mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage); extern void _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage); extern void _mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data, struct gl_texture_object *texObj, struct gl_texture_image *texImage); extern void _mesa_generate_mipmap(GLcontext *ctx, GLenum target, const struct gl_texture_unit *texUnit, struct gl_texture_object *texObj); extern void _mesa_rescale_teximage2d(GLuint bytesPerPixel, GLuint srcStrideInPixels, GLuint dstRowStride, GLint srcWidth, GLint srcHeight, GLint dstWidth, GLint dstHeight, const GLvoid *srcImage, GLvoid *dstImage); extern void _mesa_upscale_teximage2d(GLsizei inWidth, GLsizei inHeight, GLsizei outWidth, GLsizei outHeight, GLint comps, const GLchan *src, GLint srcRowStride, GLchan *dest); extern void _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels, const struct gl_texture_object *texObj, const struct gl_texture_image *texImage); extern void _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, GLvoid *img, const struct gl_texture_object *texObj, const struct gl_texture_image *texImage); extern const GLvoid * _mesa_validate_pbo_teximage(GLcontext *ctx, GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *unpack, const char *funcName); extern const GLvoid * _mesa_validate_pbo_compressed_teximage(GLcontext *ctx, GLsizei imageSize, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, const char *funcName); extern void _mesa_unmap_teximage_pbo(GLcontext *ctx, const struct gl_pixelstore_attrib *unpack); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/varray.c0000644000000000000000000007031313614532424017615 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "imports.h" #include "bufferobj.h" #include "context.h" #include "enable.h" #include "enums.h" #include "dlist.h" #include "texstate.h" #include "mtypes.h" #include "varray.h" #include "dispatch.h" #ifndef GL_BOOLEAN #define GL_BOOLEAN 0x9999 #endif /** * Update the fields of a vertex array structure. * We need to do a few special things for arrays that live in * vertex buffer objects. */ static void update_array(GLcontext *ctx, struct gl_client_array *array, GLuint dirtyFlag, GLsizei elementSize, GLint size, GLenum type, GLsizei stride, GLboolean normalized, const GLvoid *ptr) { array->Size = size; array->Type = type; array->Stride = stride; array->StrideB = stride ? stride : elementSize; array->Normalized = normalized; array->Ptr = (const GLubyte *) ptr; #if FEATURE_ARB_vertex_buffer_object array->BufferObj->RefCount--; if (array->BufferObj->RefCount <= 0) { ASSERT(array->BufferObj->Name); _mesa_remove_buffer_object( ctx, array->BufferObj ); (*ctx->Driver.DeleteBuffer)( ctx, array->BufferObj ); } array->BufferObj = ctx->Array.ArrayBufferObj; array->BufferObj->RefCount++; /* Compute the index of the last array element that's inside the buffer. * Later in glDrawArrays we'll check if start + count > _MaxElement to * be sure we won't go out of bounds. */ if (ctx->Array.ArrayBufferObj->Name) array->_MaxElement = ((GLsizeiptrARB) ctx->Array.ArrayBufferObj->Size - (GLsizeiptrARB) array->Ptr) / array->StrideB; else #endif array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */ ctx->NewState |= _NEW_ARRAY; ctx->Array.NewState |= dirtyFlag; } void GLAPIENTRY _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (size < 2 || size > 4) { _mesa_error( ctx, GL_INVALID_VALUE, "glVertexPointer(size)" ); return; } if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glVertexPointer(stride)" ); return; } if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) _mesa_debug(ctx, "glVertexPointer( sz %d type %s stride %d )\n", size, _mesa_lookup_enum_by_nr( type ), stride); /* always need to check that is legal */ switch (type) { case GL_SHORT: elementSize = size * sizeof(GLshort); break; case GL_INT: elementSize = size * sizeof(GLint); break; case GL_FLOAT: elementSize = size * sizeof(GLfloat); break; case GL_DOUBLE: elementSize = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glVertexPointer(type)" ); return; } update_array(ctx, &ctx->Array.Vertex, _NEW_ARRAY_VERTEX, elementSize, size, type, stride, GL_FALSE, ptr); if (ctx->Driver.VertexPointer) ctx->Driver.VertexPointer( ctx, size, type, stride, ptr ); } void GLAPIENTRY _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) { GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glNormalPointer(stride)" ); return; } if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) _mesa_debug(ctx, "glNormalPointer( type %s stride %d )\n", _mesa_lookup_enum_by_nr( type ), stride); switch (type) { case GL_BYTE: elementSize = 3 * sizeof(GLbyte); break; case GL_SHORT: elementSize = 3 * sizeof(GLshort); break; case GL_INT: elementSize = 3 * sizeof(GLint); break; case GL_FLOAT: elementSize = 3 * sizeof(GLfloat); break; case GL_DOUBLE: elementSize = 3 * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glNormalPointer(type)" ); return; } update_array(ctx, &ctx->Array.Normal, _NEW_ARRAY_NORMAL, elementSize, 3, type, stride, GL_FALSE, ptr); if (ctx->Driver.NormalPointer) ctx->Driver.NormalPointer( ctx, type, stride, ptr ); } void GLAPIENTRY _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (size < 3 || size > 4) { _mesa_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" ); return; } if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glColorPointer(stride)" ); return; } if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) _mesa_debug(ctx, "glColorPointer( sz %d type %s stride %d )\n", size, _mesa_lookup_enum_by_nr( type ), stride); switch (type) { case GL_BYTE: elementSize = size * sizeof(GLbyte); break; case GL_UNSIGNED_BYTE: elementSize = size * sizeof(GLubyte); break; case GL_SHORT: elementSize = size * sizeof(GLshort); break; case GL_UNSIGNED_SHORT: elementSize = size * sizeof(GLushort); break; case GL_INT: elementSize = size * sizeof(GLint); break; case GL_UNSIGNED_INT: elementSize = size * sizeof(GLuint); break; case GL_FLOAT: elementSize = size * sizeof(GLfloat); break; case GL_DOUBLE: elementSize = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glColorPointer(type)" ); return; } update_array(ctx, &ctx->Array.Color, _NEW_ARRAY_COLOR0, elementSize, size, type, stride, GL_FALSE, ptr); if (ctx->Driver.ColorPointer) ctx->Driver.ColorPointer( ctx, size, type, stride, ptr ); } void GLAPIENTRY _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) { GLint elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glFogCoordPointer(stride)" ); return; } switch (type) { case GL_FLOAT: elementSize = sizeof(GLfloat); break; case GL_DOUBLE: elementSize = sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glFogCoordPointer(type)" ); return; } update_array(ctx, &ctx->Array.FogCoord, _NEW_ARRAY_FOGCOORD, elementSize, 1, type, stride, GL_FALSE, ptr); if (ctx->Driver.FogCoordPointer) ctx->Driver.FogCoordPointer( ctx, type, stride, ptr ); } void GLAPIENTRY _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) { GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glIndexPointer(stride)" ); return; } switch (type) { case GL_UNSIGNED_BYTE: elementSize = sizeof(GLubyte); break; case GL_SHORT: elementSize = sizeof(GLshort); break; case GL_INT: elementSize = sizeof(GLint); break; case GL_FLOAT: elementSize = sizeof(GLfloat); break; case GL_DOUBLE: elementSize = sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glIndexPointer(type)" ); return; } update_array(ctx, &ctx->Array.Index, _NEW_ARRAY_INDEX, elementSize, 1, type, stride, GL_FALSE, ptr); if (ctx->Driver.IndexPointer) ctx->Driver.IndexPointer( ctx, type, stride, ptr ); } void GLAPIENTRY _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (size != 3 && size != 4) { _mesa_error( ctx, GL_INVALID_VALUE, "glSecondaryColorPointer(size)" ); return; } if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glSecondaryColorPointer(stride)" ); return; } if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) _mesa_debug(ctx, "glSecondaryColorPointer( sz %d type %s stride %d )\n", size, _mesa_lookup_enum_by_nr( type ), stride); switch (type) { case GL_BYTE: elementSize = size * sizeof(GLbyte); break; case GL_UNSIGNED_BYTE: elementSize = size * sizeof(GLubyte); break; case GL_SHORT: elementSize = size * sizeof(GLshort); break; case GL_UNSIGNED_SHORT: elementSize = size * sizeof(GLushort); break; case GL_INT: elementSize = size * sizeof(GLint); break; case GL_UNSIGNED_INT: elementSize = size * sizeof(GLuint); break; case GL_FLOAT: elementSize = size * sizeof(GLfloat); break; case GL_DOUBLE: elementSize = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glSecondaryColorPointer(type)" ); return; } update_array(ctx, &ctx->Array.SecondaryColor, _NEW_ARRAY_COLOR1, elementSize, size, type, stride, GL_FALSE, ptr); if (ctx->Driver.SecondaryColorPointer) ctx->Driver.SecondaryColorPointer( ctx, size, type, stride, ptr ); } void GLAPIENTRY _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GLint elementSize; GET_CURRENT_CONTEXT(ctx); const GLuint unit = ctx->Array.ActiveTexture; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (size < 1 || size > 4) { _mesa_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(size)" ); return; } if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(stride)" ); return; } if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) _mesa_debug(ctx, "glTexCoordPointer(unit %u sz %d type %s stride %d)\n", unit, size, _mesa_lookup_enum_by_nr( type ), stride); /* always need to check that is legal */ switch (type) { case GL_SHORT: elementSize = size * sizeof(GLshort); break; case GL_INT: elementSize = size * sizeof(GLint); break; case GL_FLOAT: elementSize = size * sizeof(GLfloat); break; case GL_DOUBLE: elementSize = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexCoordPointer(type)" ); return; } update_array(ctx, &ctx->Array.TexCoord[unit], _NEW_ARRAY_TEXCOORD(unit), elementSize, size, type, stride, GL_FALSE, ptr); if (ctx->Driver.TexCoordPointer) ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr ); } void GLAPIENTRY _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glEdgeFlagPointer(stride)" ); return; } update_array(ctx, &ctx->Array.EdgeFlag, _NEW_ARRAY_EDGEFLAG, sizeof(GLboolean), 1, GL_BOOLEAN, stride, GL_FALSE, ptr); if (ctx->Driver.EdgeFlagPointer) ctx->Driver.EdgeFlagPointer( ctx, stride, ptr ); } #if FEATURE_NV_vertex_program void GLAPIENTRY _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (index >= VERT_ATTRIB_MAX) { _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(index)"); return; } if (size < 1 || size > 4) { _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(size)"); return; } if (stride < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(stride)"); return; } if (type == GL_UNSIGNED_BYTE && size != 4) { _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(size!=4)"); return; } /* check for valid 'type' and compute StrideB right away */ switch (type) { case GL_UNSIGNED_BYTE: elementSize = size * sizeof(GLubyte); break; case GL_SHORT: elementSize = size * sizeof(GLshort); break; case GL_FLOAT: elementSize = size * sizeof(GLfloat); break; case GL_DOUBLE: elementSize = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttribPointerNV(type)" ); return; } update_array(ctx, &ctx->Array.VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), elementSize, size, type, stride, GL_FALSE, ptr); if (ctx->Driver.VertexAttribPointer) ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr ); } #endif #if FEATURE_ARB_vertex_program void GLAPIENTRY _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr) { GLsizei elementSize; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (index >= ctx->Const.MaxVertexProgramAttribs) { _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(index)"); return; } if (size < 1 || size > 4) { _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(size)"); return; } if (stride < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(stride)"); return; } if (type == GL_UNSIGNED_BYTE && size != 4) { _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(size!=4)"); return; } /* check for valid 'type' and compute StrideB right away */ /* NOTE: more types are supported here than in the NV extension */ switch (type) { case GL_BYTE: elementSize = size * sizeof(GLbyte); break; case GL_UNSIGNED_BYTE: elementSize = size * sizeof(GLubyte); break; case GL_SHORT: elementSize = size * sizeof(GLshort); break; case GL_UNSIGNED_SHORT: elementSize = size * sizeof(GLushort); break; case GL_INT: elementSize = size * sizeof(GLint); break; case GL_UNSIGNED_INT: elementSize = size * sizeof(GLuint); break; case GL_FLOAT: elementSize = size * sizeof(GLfloat); break; case GL_DOUBLE: elementSize = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttribPointerARB(type)" ); return; } update_array(ctx, &ctx->Array.VertexAttrib[index], _NEW_ARRAY_ATTRIB(index), elementSize, size, type, stride, normalized, ptr); /* XXX fix if (ctx->Driver.VertexAttribPointer) ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr ); */ } #endif void GLAPIENTRY _mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { (void) count; _mesa_VertexPointer(size, type, stride, ptr); } void GLAPIENTRY _mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { (void) count; _mesa_NormalPointer(type, stride, ptr); } void GLAPIENTRY _mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { (void) count; _mesa_ColorPointer(size, type, stride, ptr); } void GLAPIENTRY _mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { (void) count; _mesa_IndexPointer(type, stride, ptr); } void GLAPIENTRY _mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { (void) count; _mesa_TexCoordPointer(size, type, stride, ptr); } void GLAPIENTRY _mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr) { (void) count; _mesa_EdgeFlagPointer(stride, ptr); } void GLAPIENTRY _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) { GET_CURRENT_CONTEXT(ctx); GLboolean tflag, cflag, nflag; /* enable/disable flags */ GLint tcomps, ccomps, vcomps; /* components per texcoord, color, vertex */ GLenum ctype = 0; /* color type */ GLint coffset = 0, noffset = 0, voffset;/* color, normal, vertex offsets */ const GLint toffset = 0; /* always zero */ GLint defstride; /* default stride */ GLint c, f; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); f = sizeof(GLfloat); c = f * ((4 * sizeof(GLubyte) + (f - 1)) / f); if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glInterleavedArrays(stride)" ); return; } switch (format) { case GL_V2F: tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_FALSE; tcomps = 0; ccomps = 0; vcomps = 2; voffset = 0; defstride = 2*f; break; case GL_V3F: tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_FALSE; tcomps = 0; ccomps = 0; vcomps = 3; voffset = 0; defstride = 3*f; break; case GL_C4UB_V2F: tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE; tcomps = 0; ccomps = 4; vcomps = 2; ctype = GL_UNSIGNED_BYTE; coffset = 0; voffset = c; defstride = c + 2*f; break; case GL_C4UB_V3F: tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE; tcomps = 0; ccomps = 4; vcomps = 3; ctype = GL_UNSIGNED_BYTE; coffset = 0; voffset = c; defstride = c + 3*f; break; case GL_C3F_V3F: tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_FALSE; tcomps = 0; ccomps = 3; vcomps = 3; ctype = GL_FLOAT; coffset = 0; voffset = 3*f; defstride = 6*f; break; case GL_N3F_V3F: tflag = GL_FALSE; cflag = GL_FALSE; nflag = GL_TRUE; tcomps = 0; ccomps = 0; vcomps = 3; noffset = 0; voffset = 3*f; defstride = 6*f; break; case GL_C4F_N3F_V3F: tflag = GL_FALSE; cflag = GL_TRUE; nflag = GL_TRUE; tcomps = 0; ccomps = 4; vcomps = 3; ctype = GL_FLOAT; coffset = 0; noffset = 4*f; voffset = 7*f; defstride = 10*f; break; case GL_T2F_V3F: tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_FALSE; tcomps = 2; ccomps = 0; vcomps = 3; voffset = 2*f; defstride = 5*f; break; case GL_T4F_V4F: tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_FALSE; tcomps = 4; ccomps = 0; vcomps = 4; voffset = 4*f; defstride = 8*f; break; case GL_T2F_C4UB_V3F: tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_FALSE; tcomps = 2; ccomps = 4; vcomps = 3; ctype = GL_UNSIGNED_BYTE; coffset = 2*f; voffset = c+2*f; defstride = c+5*f; break; case GL_T2F_C3F_V3F: tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_FALSE; tcomps = 2; ccomps = 3; vcomps = 3; ctype = GL_FLOAT; coffset = 2*f; voffset = 5*f; defstride = 8*f; break; case GL_T2F_N3F_V3F: tflag = GL_TRUE; cflag = GL_FALSE; nflag = GL_TRUE; tcomps = 2; ccomps = 0; vcomps = 3; noffset = 2*f; voffset = 5*f; defstride = 8*f; break; case GL_T2F_C4F_N3F_V3F: tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_TRUE; tcomps = 2; ccomps = 4; vcomps = 3; ctype = GL_FLOAT; coffset = 2*f; noffset = 6*f; voffset = 9*f; defstride = 12*f; break; case GL_T4F_C4F_N3F_V4F: tflag = GL_TRUE; cflag = GL_TRUE; nflag = GL_TRUE; tcomps = 4; ccomps = 4; vcomps = 4; ctype = GL_FLOAT; coffset = 4*f; noffset = 8*f; voffset = 11*f; defstride = 15*f; break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glInterleavedArrays(format)" ); return; } if (stride==0) { stride = defstride; } _mesa_DisableClientState( GL_EDGE_FLAG_ARRAY ); _mesa_DisableClientState( GL_INDEX_ARRAY ); /* Texcoords */ if (tflag) { _mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY ); _mesa_TexCoordPointer( tcomps, GL_FLOAT, stride, (GLubyte *) pointer + toffset ); } else { _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY ); } /* Color */ if (cflag) { _mesa_EnableClientState( GL_COLOR_ARRAY ); _mesa_ColorPointer( ccomps, ctype, stride, (GLubyte *) pointer + coffset ); } else { _mesa_DisableClientState( GL_COLOR_ARRAY ); } /* Normals */ if (nflag) { _mesa_EnableClientState( GL_NORMAL_ARRAY ); _mesa_NormalPointer( GL_FLOAT, stride, (GLubyte *) pointer + noffset ); } else { _mesa_DisableClientState( GL_NORMAL_ARRAY ); } /* Vertices */ _mesa_EnableClientState( GL_VERTEX_ARRAY ); _mesa_VertexPointer( vcomps, GL_FLOAT, stride, (GLubyte *) pointer + voffset ); } void GLAPIENTRY _mesa_LockArraysEXT(GLint first, GLsizei count) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glLockArrays %d %d\n", first, count); if (first == 0 && count > 0 && count <= (GLint) ctx->Const.MaxArrayLockSize) { ctx->Array.LockFirst = first; ctx->Array.LockCount = count; } else { ctx->Array.LockFirst = 0; ctx->Array.LockCount = 0; } ctx->NewState |= _NEW_ARRAY; ctx->Array.NewState |= _NEW_ARRAY_ALL; if (ctx->Driver.LockArraysEXT) ctx->Driver.LockArraysEXT( ctx, first, count ); } void GLAPIENTRY _mesa_UnlockArraysEXT( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glUnlockArrays\n"); ctx->Array.LockFirst = 0; ctx->Array.LockCount = 0; ctx->NewState |= _NEW_ARRAY; ctx->Array.NewState |= _NEW_ARRAY_ALL; if (ctx->Driver.UnlockArraysEXT) ctx->Driver.UnlockArraysEXT( ctx ); } /* GL_EXT_multi_draw_arrays */ /* Somebody forgot to spec the first and count parameters as const! */ void GLAPIENTRY _mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, GLsizei *count, GLsizei primcount ) { GET_CURRENT_CONTEXT(ctx); GLint i; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); for (i = 0; i < primcount; i++) { if (count[i] > 0) { CALL_DrawArrays(ctx->Exec, (mode, first[i], count[i])); } } } /* GL_EXT_multi_draw_arrays */ void GLAPIENTRY _mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount ) { GET_CURRENT_CONTEXT(ctx); GLint i; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); for (i = 0; i < primcount; i++) { if (count[i] > 0) { CALL_DrawElements(ctx->Exec, (mode, count[i], type, indices[i])); } } } /* GL_IBM_multimode_draw_arrays */ void GLAPIENTRY _mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride ) { GET_CURRENT_CONTEXT(ctx); GLint i; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); for ( i = 0 ; i < primcount ; i++ ) { if ( count[i] > 0 ) { GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride)); CALL_DrawArrays(ctx->Exec, ( m, first[i], count[i] )); } } } /* GL_IBM_multimode_draw_arrays */ void GLAPIENTRY _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride ) { GET_CURRENT_CONTEXT(ctx); GLint i; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* XXX not sure about ARB_vertex_buffer_object handling here */ for ( i = 0 ; i < primcount ; i++ ) { if ( count[i] > 0 ) { GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride)); CALL_DrawElements(ctx->Exec, ( m, count[i], type, indices[i] )); } } } /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ void _mesa_init_varray( GLcontext * ctx ) { GLuint i; /* Vertex arrays */ ctx->Array.Vertex.Size = 4; ctx->Array.Vertex.Type = GL_FLOAT; ctx->Array.Vertex.Stride = 0; ctx->Array.Vertex.StrideB = 0; ctx->Array.Vertex.Ptr = NULL; ctx->Array.Vertex.Enabled = GL_FALSE; ctx->Array.Vertex.Flags = CA_CLIENT_DATA; ctx->Array.Normal.Type = GL_FLOAT; ctx->Array.Normal.Stride = 0; ctx->Array.Normal.StrideB = 0; ctx->Array.Normal.Ptr = NULL; ctx->Array.Normal.Enabled = GL_FALSE; ctx->Array.Normal.Flags = CA_CLIENT_DATA; ctx->Array.Color.Size = 4; ctx->Array.Color.Type = GL_FLOAT; ctx->Array.Color.Stride = 0; ctx->Array.Color.StrideB = 0; ctx->Array.Color.Ptr = NULL; ctx->Array.Color.Enabled = GL_FALSE; ctx->Array.Color.Flags = CA_CLIENT_DATA; ctx->Array.SecondaryColor.Size = 4; ctx->Array.SecondaryColor.Type = GL_FLOAT; ctx->Array.SecondaryColor.Stride = 0; ctx->Array.SecondaryColor.StrideB = 0; ctx->Array.SecondaryColor.Ptr = NULL; ctx->Array.SecondaryColor.Enabled = GL_FALSE; ctx->Array.SecondaryColor.Flags = CA_CLIENT_DATA; ctx->Array.FogCoord.Size = 1; ctx->Array.FogCoord.Type = GL_FLOAT; ctx->Array.FogCoord.Stride = 0; ctx->Array.FogCoord.StrideB = 0; ctx->Array.FogCoord.Ptr = NULL; ctx->Array.FogCoord.Enabled = GL_FALSE; ctx->Array.FogCoord.Flags = CA_CLIENT_DATA; ctx->Array.Index.Type = GL_FLOAT; ctx->Array.Index.Stride = 0; ctx->Array.Index.StrideB = 0; ctx->Array.Index.Ptr = NULL; ctx->Array.Index.Enabled = GL_FALSE; ctx->Array.Index.Flags = CA_CLIENT_DATA; for (i = 0; i < MAX_TEXTURE_UNITS; i++) { ctx->Array.TexCoord[i].Size = 4; ctx->Array.TexCoord[i].Type = GL_FLOAT; ctx->Array.TexCoord[i].Stride = 0; ctx->Array.TexCoord[i].StrideB = 0; ctx->Array.TexCoord[i].Ptr = NULL; ctx->Array.TexCoord[i].Enabled = GL_FALSE; ctx->Array.TexCoord[i].Flags = CA_CLIENT_DATA; } ctx->Array.EdgeFlag.Stride = 0; ctx->Array.EdgeFlag.StrideB = 0; ctx->Array.EdgeFlag.Ptr = NULL; ctx->Array.EdgeFlag.Enabled = GL_FALSE; ctx->Array.EdgeFlag.Flags = CA_CLIENT_DATA; ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ for (i = 0; i < VERT_ATTRIB_MAX; i++) { ctx->Array.VertexAttrib[i].Size = 4; ctx->Array.VertexAttrib[i].Type = GL_FLOAT; ctx->Array.VertexAttrib[i].Stride = 0; ctx->Array.VertexAttrib[i].StrideB = 0; ctx->Array.VertexAttrib[i].Ptr = NULL; ctx->Array.VertexAttrib[i].Enabled = GL_FALSE; ctx->Array.VertexAttrib[i].Flags = CA_CLIENT_DATA; } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/varray.h0000644000000000000000000001050713614532424017621 0ustar /** * \file varray.h * Vertex arrays. * * \if subset * (No-op) * * \endif */ /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef VARRAY_H #define VARRAY_H #include "mtypes.h" #if _HAVE_FULL_GL extern void GLAPIENTRY _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); extern void GLAPIENTRY _mesa_UnlockArraysEXT( void ); extern void GLAPIENTRY _mesa_LockArraysEXT(GLint first, GLsizei count); extern void GLAPIENTRY _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr); extern void GLAPIENTRY _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); extern void GLAPIENTRY _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr); extern void GLAPIENTRY _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); extern void GLAPIENTRY _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr); extern void GLAPIENTRY _mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr); extern void GLAPIENTRY _mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr); extern void GLAPIENTRY _mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr); extern void GLAPIENTRY _mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr); extern void GLAPIENTRY _mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr); extern void GLAPIENTRY _mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr); extern void GLAPIENTRY _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr); extern void GLAPIENTRY _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); extern void GLAPIENTRY _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); extern void GLAPIENTRY _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); extern void GLAPIENTRY _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer); extern void GLAPIENTRY _mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, GLsizei *count, GLsizei primcount ); extern void GLAPIENTRY _mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount ); extern void GLAPIENTRY _mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride ); extern void GLAPIENTRY _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride ); extern void _mesa_init_varray( GLcontext * ctx ); #else /** No-op */ #define _mesa_init_varray( c ) ((void)0) #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/version.h0000644000000000000000000000347013614532424020003 0ustar /* * Mesa 3-D graphics library * Version: 6.4.2 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef VERSION_H #define VERSION_H /* Mesa version */ #define MESA_MAJOR 6 #define MESA_MINOR 4 #define MESA_PATCH 2 #define MESA_VERSION_STRING "6.4.2" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) #define MESA_VERSION_CODE MESA_VERSION(MESA_MAJOR, MESA_MINOR, MESA_PATCH) /* OpenGL API version */ #define OPENGL_MAJOR 1 #define OPENGL_MINOR 5 #define OPENGL_PATCH 0 #define OPENGL_VERSION_STRING "1.5" /* To make version comparison easy */ #define OPENGL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) #define OPENGL_VERSION_CODE OPENGL_VERSION(OPENGL_MAJOR, OPENGL_MINOR, OPENGL_PATCH) #endif /* VERSION_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/vtxfmt.c0000644000000000000000000001546013614532424017643 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell * Gareth Hughes */ #include "glheader.h" #include "api_loopback.h" #include "context.h" #include "imports.h" #include "mtypes.h" #include "state.h" #include "vtxfmt.h" /* The neutral vertex format. This wraps all tnl module functions, * verifying that the currently-installed module is valid and then * installing the function pointers in a lazy fashion. It records the * function pointers that have been swapped out, which allows a fast * restoration of the neutral module in almost all cases -- a typical * app might only require 4-6 functions to be modified from the neutral * baseline, and only restoring these is certainly preferable to doing * the entire module's 60 or so function pointers. */ #define PRE_LOOPBACK( FUNC ) \ { \ GET_CURRENT_CONTEXT(ctx); \ struct gl_tnl_module * const tnl = &(ctx->TnlModule); \ const int tmp_offset = _gloffset_ ## FUNC ; \ \ ASSERT( tnl->Current ); \ ASSERT( tnl->SwapCount < NUM_VERTEX_FORMAT_ENTRIES ); \ ASSERT( tmp_offset >= 0 ); \ \ /* Save the swapped function's dispatch entry so it can be */ \ /* restored later. */ \ tnl->Swapped[tnl->SwapCount].location = & (((_glapi_proc *)ctx->Exec)[tmp_offset]); \ tnl->Swapped[tnl->SwapCount].function = (_glapi_proc)TAG(FUNC); \ tnl->SwapCount++; \ \ if ( 0 ) \ _mesa_debug(ctx, " swapping gl" #FUNC"...\n" ); \ \ /* Install the tnl function pointer. */ \ SET_ ## FUNC(ctx->Exec, tnl->Current->FUNC); \ } #define TAG(x) neutral_##x #include "vtxfmt_tmp.h" static void install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) { SET_ArrayElement(tab, vfmt->ArrayElement); SET_Color3f(tab, vfmt->Color3f); SET_Color3fv(tab, vfmt->Color3fv); SET_Color4f(tab, vfmt->Color4f); SET_Color4fv(tab, vfmt->Color4fv); SET_EdgeFlag(tab, vfmt->EdgeFlag); SET_EdgeFlagv(tab, vfmt->EdgeFlagv); SET_EvalCoord1f(tab, vfmt->EvalCoord1f); SET_EvalCoord1fv(tab, vfmt->EvalCoord1fv); SET_EvalCoord2f(tab, vfmt->EvalCoord2f); SET_EvalCoord2fv(tab, vfmt->EvalCoord2fv); SET_EvalPoint1(tab, vfmt->EvalPoint1); SET_EvalPoint2(tab, vfmt->EvalPoint2); SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT); SET_FogCoordfvEXT(tab, vfmt->FogCoordfvEXT); SET_Indexf(tab, vfmt->Indexf); SET_Indexfv(tab, vfmt->Indexfv); SET_Materialfv(tab, vfmt->Materialfv); SET_MultiTexCoord1fARB(tab, vfmt->MultiTexCoord1fARB); SET_MultiTexCoord1fvARB(tab, vfmt->MultiTexCoord1fvARB); SET_MultiTexCoord2fARB(tab, vfmt->MultiTexCoord2fARB); SET_MultiTexCoord2fvARB(tab, vfmt->MultiTexCoord2fvARB); SET_MultiTexCoord3fARB(tab, vfmt->MultiTexCoord3fARB); SET_MultiTexCoord3fvARB(tab, vfmt->MultiTexCoord3fvARB); SET_MultiTexCoord4fARB(tab, vfmt->MultiTexCoord4fARB); SET_MultiTexCoord4fvARB(tab, vfmt->MultiTexCoord4fvARB); SET_Normal3f(tab, vfmt->Normal3f); SET_Normal3fv(tab, vfmt->Normal3fv); SET_SecondaryColor3fEXT(tab, vfmt->SecondaryColor3fEXT); SET_SecondaryColor3fvEXT(tab, vfmt->SecondaryColor3fvEXT); SET_TexCoord1f(tab, vfmt->TexCoord1f); SET_TexCoord1fv(tab, vfmt->TexCoord1fv); SET_TexCoord2f(tab, vfmt->TexCoord2f); SET_TexCoord2fv(tab, vfmt->TexCoord2fv); SET_TexCoord3f(tab, vfmt->TexCoord3f); SET_TexCoord3fv(tab, vfmt->TexCoord3fv); SET_TexCoord4f(tab, vfmt->TexCoord4f); SET_TexCoord4fv(tab, vfmt->TexCoord4fv); SET_Vertex2f(tab, vfmt->Vertex2f); SET_Vertex2fv(tab, vfmt->Vertex2fv); SET_Vertex3f(tab, vfmt->Vertex3f); SET_Vertex3fv(tab, vfmt->Vertex3fv); SET_Vertex4f(tab, vfmt->Vertex4f); SET_Vertex4fv(tab, vfmt->Vertex4fv); SET_CallList(tab, vfmt->CallList); SET_CallLists(tab, vfmt->CallLists); SET_Begin(tab, vfmt->Begin); SET_End(tab, vfmt->End); SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV); SET_VertexAttrib1fvNV(tab, vfmt->VertexAttrib1fvNV); SET_VertexAttrib2fNV(tab, vfmt->VertexAttrib2fNV); SET_VertexAttrib2fvNV(tab, vfmt->VertexAttrib2fvNV); SET_VertexAttrib3fNV(tab, vfmt->VertexAttrib3fNV); SET_VertexAttrib3fvNV(tab, vfmt->VertexAttrib3fvNV); SET_VertexAttrib4fNV(tab, vfmt->VertexAttrib4fNV); SET_VertexAttrib4fvNV(tab, vfmt->VertexAttrib4fvNV); SET_VertexAttrib1fARB(tab, vfmt->VertexAttrib1fARB); SET_VertexAttrib1fvARB(tab, vfmt->VertexAttrib1fvARB); SET_VertexAttrib2fARB(tab, vfmt->VertexAttrib2fARB); SET_VertexAttrib2fvARB(tab, vfmt->VertexAttrib2fvARB); SET_VertexAttrib3fARB(tab, vfmt->VertexAttrib3fARB); SET_VertexAttrib3fvARB(tab, vfmt->VertexAttrib3fvARB); SET_VertexAttrib4fARB(tab, vfmt->VertexAttrib4fARB); SET_VertexAttrib4fvARB(tab, vfmt->VertexAttrib4fvARB); SET_Rectf(tab, vfmt->Rectf); SET_DrawArrays(tab, vfmt->DrawArrays); SET_DrawElements(tab, vfmt->DrawElements); SET_DrawRangeElements(tab, vfmt->DrawRangeElements); SET_EvalMesh1(tab, vfmt->EvalMesh1); SET_EvalMesh2(tab, vfmt->EvalMesh2); ASSERT(tab->EvalMesh2); } void _mesa_init_exec_vtxfmt( GLcontext *ctx ) { install_vtxfmt( ctx->Exec, &neutral_vtxfmt ); ctx->TnlModule.SwapCount = 0; } void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ) { ctx->TnlModule.Current = vfmt; _mesa_restore_exec_vtxfmt( ctx ); } void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ) { install_vtxfmt( ctx->Save, vfmt ); } void _mesa_restore_exec_vtxfmt( GLcontext *ctx ) { struct gl_tnl_module *tnl = &(ctx->TnlModule); GLuint i; /* Restore the neutral tnl module wrapper. */ for ( i = 0 ; i < tnl->SwapCount ; i++ ) { *(tnl->Swapped[i].location) = tnl->Swapped[i].function; } tnl->SwapCount = 0; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/vtxfmt.h0000644000000000000000000000311413614532424017641 0ustar /** * \file vtxfmt.h * * \author Keith Whitwell * \author Gareth Hughes */ /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _VTXFMT_H_ #define _VTXFMT_H_ extern void _mesa_init_exec_vtxfmt( GLcontext *ctx ); extern void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ); extern void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ); extern void _mesa_restore_exec_vtxfmt( GLcontext *ctx ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/main/vtxfmt_tmp.h0000644000000000000000000003417613614532424020535 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Gareth Hughes */ #ifndef PRE_LOOPBACK #define PRE_LOOPBACK( FUNC ) #endif #include "dispatch.h" #include "glapioffsets.h" static void GLAPIENTRY TAG(ArrayElement)( GLint i ) { PRE_LOOPBACK( ArrayElement ); CALL_ArrayElement(GET_DISPATCH(), ( i )); } static void GLAPIENTRY TAG(Color3f)( GLfloat r, GLfloat g, GLfloat b ) { PRE_LOOPBACK( Color3f ); CALL_Color3f(GET_DISPATCH(), ( r, g, b )); } static void GLAPIENTRY TAG(Color3fv)( const GLfloat *v ) { PRE_LOOPBACK( Color3fv ); CALL_Color3fv(GET_DISPATCH(), ( v )); } static void GLAPIENTRY TAG(Color4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a ) { PRE_LOOPBACK( Color4f ); CALL_Color4f(GET_DISPATCH(), ( r, g, b, a )); } static void GLAPIENTRY TAG(Color4fv)( const GLfloat *v ) { PRE_LOOPBACK( Color4fv ); CALL_Color4fv(GET_DISPATCH(), ( v )); } static void GLAPIENTRY TAG(EdgeFlag)( GLboolean e ) { PRE_LOOPBACK( EdgeFlag ); CALL_EdgeFlag(GET_DISPATCH(), ( e )); } static void GLAPIENTRY TAG(EdgeFlagv)( const GLboolean *v ) { PRE_LOOPBACK( EdgeFlagv ); CALL_EdgeFlagv(GET_DISPATCH(), ( v )); } static void GLAPIENTRY TAG(EvalCoord1f)( GLfloat s ) { PRE_LOOPBACK( EvalCoord1f ); CALL_EvalCoord1f(GET_DISPATCH(), ( s )); } static void GLAPIENTRY TAG(EvalCoord1fv)( const GLfloat *v ) { PRE_LOOPBACK( EvalCoord1fv ); CALL_EvalCoord1fv(GET_DISPATCH(), ( v )); } static void GLAPIENTRY TAG(EvalCoord2f)( GLfloat s, GLfloat t ) { PRE_LOOPBACK( EvalCoord2f ); CALL_EvalCoord2f(GET_DISPATCH(), ( s, t )); } static void GLAPIENTRY TAG(EvalCoord2fv)( const GLfloat *v ) { PRE_LOOPBACK( EvalCoord2fv ); CALL_EvalCoord2fv(GET_DISPATCH(), ( v )); } static void GLAPIENTRY TAG(EvalPoint1)( GLint i ) { PRE_LOOPBACK( EvalPoint1 ); CALL_EvalPoint1(GET_DISPATCH(), ( i )); } static void GLAPIENTRY TAG(EvalPoint2)( GLint i, GLint j ) { PRE_LOOPBACK( EvalPoint2 ); CALL_EvalPoint2(GET_DISPATCH(), ( i, j )); } static void GLAPIENTRY TAG(FogCoordfEXT)( GLfloat f ) { PRE_LOOPBACK( FogCoordfEXT ); CALL_FogCoordfEXT(GET_DISPATCH(), ( f )); } static void GLAPIENTRY TAG(FogCoordfvEXT)( const GLfloat *v ) { PRE_LOOPBACK( FogCoordfvEXT ); CALL_FogCoordfvEXT(GET_DISPATCH(), ( v )); } static void GLAPIENTRY TAG(Indexf)( GLfloat f ) { PRE_LOOPBACK( Indexf ); CALL_Indexf(GET_DISPATCH(), ( f )); } static void GLAPIENTRY TAG(Indexfv)( const GLfloat *v ) { PRE_LOOPBACK( Indexfv ); CALL_Indexfv(GET_DISPATCH(), ( v )); } static void GLAPIENTRY TAG(Materialfv)( GLenum face, GLenum pname, const GLfloat *v ) { PRE_LOOPBACK( Materialfv ); CALL_Materialfv(GET_DISPATCH(), ( face, pname, v )); } static void GLAPIENTRY TAG(MultiTexCoord1fARB)( GLenum target, GLfloat a ) { PRE_LOOPBACK( MultiTexCoord1fARB ); CALL_MultiTexCoord1fARB(GET_DISPATCH(), ( target, a )); } static void GLAPIENTRY TAG(MultiTexCoord1fvARB)( GLenum target, const GLfloat *tc ) { PRE_LOOPBACK( MultiTexCoord1fvARB ); CALL_MultiTexCoord1fvARB(GET_DISPATCH(), ( target, tc )); } static void GLAPIENTRY TAG(MultiTexCoord2fARB)( GLenum target, GLfloat s, GLfloat t ) { PRE_LOOPBACK( MultiTexCoord2fARB ); CALL_MultiTexCoord2fARB(GET_DISPATCH(), ( target, s, t )); } static void GLAPIENTRY TAG(MultiTexCoord2fvARB)( GLenum target, const GLfloat *tc ) { PRE_LOOPBACK( MultiTexCoord2fvARB ); CALL_MultiTexCoord2fvARB(GET_DISPATCH(), ( target, tc )); } static void GLAPIENTRY TAG(MultiTexCoord3fARB)( GLenum target, GLfloat s, GLfloat t, GLfloat r ) { PRE_LOOPBACK( MultiTexCoord3fARB ); CALL_MultiTexCoord3fARB(GET_DISPATCH(), ( target, s, t, r )); } static void GLAPIENTRY TAG(MultiTexCoord3fvARB)( GLenum target, const GLfloat *tc ) { PRE_LOOPBACK( MultiTexCoord3fvARB ); CALL_MultiTexCoord3fvARB(GET_DISPATCH(), ( target, tc )); } static void GLAPIENTRY TAG(MultiTexCoord4fARB)( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) { PRE_LOOPBACK( MultiTexCoord4fARB ); CALL_MultiTexCoord4fARB(GET_DISPATCH(), ( target, s, t, r, q )); } static void GLAPIENTRY TAG(MultiTexCoord4fvARB)( GLenum target, const GLfloat *tc ) { PRE_LOOPBACK( MultiTexCoord4fvARB ); CALL_MultiTexCoord4fvARB(GET_DISPATCH(), ( target, tc )); } static void GLAPIENTRY TAG(Normal3f)( GLfloat x, GLfloat y, GLfloat z ) { PRE_LOOPBACK( Normal3f ); CALL_Normal3f(GET_DISPATCH(), ( x, y, z )); } static void GLAPIENTRY TAG(Normal3fv)( const GLfloat *v ) { PRE_LOOPBACK( Normal3fv ); CALL_Normal3fv(GET_DISPATCH(), ( v )); } static void GLAPIENTRY TAG(SecondaryColor3fEXT)( GLfloat r, GLfloat g, GLfloat b ) { PRE_LOOPBACK( SecondaryColor3fEXT ); CALL_SecondaryColor3fEXT(GET_DISPATCH(), ( r, g, b )); } static void GLAPIENTRY TAG(SecondaryColor3fvEXT)( const GLfloat *v ) { PRE_LOOPBACK( SecondaryColor3fvEXT ); CALL_SecondaryColor3fvEXT(GET_DISPATCH(), ( v )); } static void GLAPIENTRY TAG(TexCoord1f)( GLfloat s ) { PRE_LOOPBACK( TexCoord1f ); CALL_TexCoord1f(GET_DISPATCH(), ( s )); } static void GLAPIENTRY TAG(TexCoord1fv)( const GLfloat *tc ) { PRE_LOOPBACK( TexCoord1fv ); CALL_TexCoord1fv(GET_DISPATCH(), ( tc )); } static void GLAPIENTRY TAG(TexCoord2f)( GLfloat s, GLfloat t ) { PRE_LOOPBACK( TexCoord2f ); CALL_TexCoord2f(GET_DISPATCH(), ( s, t )); } static void GLAPIENTRY TAG(TexCoord2fv)( const GLfloat *tc ) { PRE_LOOPBACK( TexCoord2fv ); CALL_TexCoord2fv(GET_DISPATCH(), ( tc )); } static void GLAPIENTRY TAG(TexCoord3f)( GLfloat s, GLfloat t, GLfloat r ) { PRE_LOOPBACK( TexCoord3f ); CALL_TexCoord3f(GET_DISPATCH(), ( s, t, r )); } static void GLAPIENTRY TAG(TexCoord3fv)( const GLfloat *tc ) { PRE_LOOPBACK( TexCoord3fv ); CALL_TexCoord3fv(GET_DISPATCH(), ( tc )); } static void GLAPIENTRY TAG(TexCoord4f)( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) { PRE_LOOPBACK( TexCoord4f ); CALL_TexCoord4f(GET_DISPATCH(), ( s, t, r, q )); } static void GLAPIENTRY TAG(TexCoord4fv)( const GLfloat *tc ) { PRE_LOOPBACK( TexCoord4fv ); CALL_TexCoord4fv(GET_DISPATCH(), ( tc )); } static void GLAPIENTRY TAG(Vertex2f)( GLfloat x, GLfloat y ) { PRE_LOOPBACK( Vertex2f ); CALL_Vertex2f(GET_DISPATCH(), ( x, y )); } static void GLAPIENTRY TAG(Vertex2fv)( const GLfloat *v ) { PRE_LOOPBACK( Vertex2fv ); CALL_Vertex2fv(GET_DISPATCH(), ( v )); } static void GLAPIENTRY TAG(Vertex3f)( GLfloat x, GLfloat y, GLfloat z ) { PRE_LOOPBACK( Vertex3f ); CALL_Vertex3f(GET_DISPATCH(), ( x, y, z )); } static void GLAPIENTRY TAG(Vertex3fv)( const GLfloat *v ) { PRE_LOOPBACK( Vertex3fv ); CALL_Vertex3fv(GET_DISPATCH(), ( v )); } static void GLAPIENTRY TAG(Vertex4f)( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { PRE_LOOPBACK( Vertex4f ); CALL_Vertex4f(GET_DISPATCH(), ( x, y, z, w )); } static void GLAPIENTRY TAG(Vertex4fv)( const GLfloat *v ) { PRE_LOOPBACK( Vertex4fv ); CALL_Vertex4fv(GET_DISPATCH(), ( v )); } static void GLAPIENTRY TAG(CallList)( GLuint i ) { PRE_LOOPBACK( CallList ); CALL_CallList(GET_DISPATCH(), ( i )); } static void GLAPIENTRY TAG(CallLists)( GLsizei sz, GLenum type, const GLvoid *v ) { PRE_LOOPBACK( CallLists ); CALL_CallLists(GET_DISPATCH(), ( sz, type, v )); } static void GLAPIENTRY TAG(Begin)( GLenum mode ) { PRE_LOOPBACK( Begin ); CALL_Begin(GET_DISPATCH(), ( mode )); } static void GLAPIENTRY TAG(End)( void ) { PRE_LOOPBACK( End ); CALL_End(GET_DISPATCH(), ()); } static void GLAPIENTRY TAG(Rectf)( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) { PRE_LOOPBACK( Rectf ); CALL_Rectf(GET_DISPATCH(), ( x1, y1, x2, y2 )); } static void GLAPIENTRY TAG(DrawArrays)( GLenum mode, GLint start, GLsizei count ) { PRE_LOOPBACK( DrawArrays ); CALL_DrawArrays(GET_DISPATCH(), ( mode, start, count )); } static void GLAPIENTRY TAG(DrawElements)( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) { PRE_LOOPBACK( DrawElements ); CALL_DrawElements(GET_DISPATCH(), ( mode, count, type, indices )); } static void GLAPIENTRY TAG(DrawRangeElements)( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ) { PRE_LOOPBACK( DrawRangeElements ); CALL_DrawRangeElements(GET_DISPATCH(), ( mode, start, end, count, type, indices )); } static void GLAPIENTRY TAG(EvalMesh1)( GLenum mode, GLint i1, GLint i2 ) { PRE_LOOPBACK( EvalMesh1 ); CALL_EvalMesh1(GET_DISPATCH(), ( mode, i1, i2 )); } static void GLAPIENTRY TAG(EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) { PRE_LOOPBACK( EvalMesh2 ); CALL_EvalMesh2(GET_DISPATCH(), ( mode, i1, i2, j1, j2 )); } static void GLAPIENTRY TAG(VertexAttrib1fNV)( GLuint index, GLfloat x ) { PRE_LOOPBACK( VertexAttrib1fNV ); CALL_VertexAttrib1fNV(GET_DISPATCH(), ( index, x )); } static void GLAPIENTRY TAG(VertexAttrib1fvNV)( GLuint index, const GLfloat *v ) { PRE_LOOPBACK( VertexAttrib1fvNV ); CALL_VertexAttrib1fvNV(GET_DISPATCH(), ( index, v )); } static void GLAPIENTRY TAG(VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y ) { PRE_LOOPBACK( VertexAttrib2fNV ); CALL_VertexAttrib2fNV(GET_DISPATCH(), ( index, x, y )); } static void GLAPIENTRY TAG(VertexAttrib2fvNV)( GLuint index, const GLfloat *v ) { PRE_LOOPBACK( VertexAttrib2fvNV ); CALL_VertexAttrib2fvNV(GET_DISPATCH(), ( index, v )); } static void GLAPIENTRY TAG(VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { PRE_LOOPBACK( VertexAttrib3fNV ); CALL_VertexAttrib3fNV(GET_DISPATCH(), ( index, x, y, z )); } static void GLAPIENTRY TAG(VertexAttrib3fvNV)( GLuint index, const GLfloat *v ) { PRE_LOOPBACK( VertexAttrib3fvNV ); CALL_VertexAttrib3fvNV(GET_DISPATCH(), ( index, v )); } static void GLAPIENTRY TAG(VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { PRE_LOOPBACK( VertexAttrib4fNV ); CALL_VertexAttrib4fNV(GET_DISPATCH(), ( index, x, y, z, w )); } static void GLAPIENTRY TAG(VertexAttrib4fvNV)( GLuint index, const GLfloat *v ) { PRE_LOOPBACK( VertexAttrib4fvNV ); CALL_VertexAttrib4fvNV(GET_DISPATCH(), ( index, v )); } static void GLAPIENTRY TAG(VertexAttrib1fARB)( GLuint index, GLfloat x ) { PRE_LOOPBACK( VertexAttrib1fARB ); CALL_VertexAttrib1fARB(GET_DISPATCH(), ( index, x )); } static void GLAPIENTRY TAG(VertexAttrib1fvARB)( GLuint index, const GLfloat *v ) { PRE_LOOPBACK( VertexAttrib1fvARB ); CALL_VertexAttrib1fvARB(GET_DISPATCH(), ( index, v )); } static void GLAPIENTRY TAG(VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y ) { PRE_LOOPBACK( VertexAttrib2fARB ); CALL_VertexAttrib2fARB(GET_DISPATCH(), ( index, x, y )); } static void GLAPIENTRY TAG(VertexAttrib2fvARB)( GLuint index, const GLfloat *v ) { PRE_LOOPBACK( VertexAttrib2fvARB ); CALL_VertexAttrib2fvARB(GET_DISPATCH(), ( index, v )); } static void GLAPIENTRY TAG(VertexAttrib3fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { PRE_LOOPBACK( VertexAttrib3fARB ); CALL_VertexAttrib3fARB(GET_DISPATCH(), ( index, x, y, z )); } static void GLAPIENTRY TAG(VertexAttrib3fvARB)( GLuint index, const GLfloat *v ) { PRE_LOOPBACK( VertexAttrib3fvARB ); CALL_VertexAttrib3fvARB(GET_DISPATCH(), ( index, v )); } static void GLAPIENTRY TAG(VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { PRE_LOOPBACK( VertexAttrib4fARB ); CALL_VertexAttrib4fARB(GET_DISPATCH(), ( index, x, y, z, w )); } static void GLAPIENTRY TAG(VertexAttrib4fvARB)( GLuint index, const GLfloat *v ) { PRE_LOOPBACK( VertexAttrib4fvARB ); CALL_VertexAttrib4fvARB(GET_DISPATCH(), ( index, v )); } static GLvertexformat TAG(vtxfmt) = { TAG(ArrayElement), TAG(Color3f), TAG(Color3fv), TAG(Color4f), TAG(Color4fv), TAG(EdgeFlag), TAG(EdgeFlagv), TAG(EvalCoord1f), TAG(EvalCoord1fv), TAG(EvalCoord2f), TAG(EvalCoord2fv), TAG(EvalPoint1), TAG(EvalPoint2), TAG(FogCoordfEXT), TAG(FogCoordfvEXT), TAG(Indexf), TAG(Indexfv), TAG(Materialfv), TAG(MultiTexCoord1fARB), TAG(MultiTexCoord1fvARB), TAG(MultiTexCoord2fARB), TAG(MultiTexCoord2fvARB), TAG(MultiTexCoord3fARB), TAG(MultiTexCoord3fvARB), TAG(MultiTexCoord4fARB), TAG(MultiTexCoord4fvARB), TAG(Normal3f), TAG(Normal3fv), TAG(SecondaryColor3fEXT), TAG(SecondaryColor3fvEXT), TAG(TexCoord1f), TAG(TexCoord1fv), TAG(TexCoord2f), TAG(TexCoord2fv), TAG(TexCoord3f), TAG(TexCoord3fv), TAG(TexCoord4f), TAG(TexCoord4fv), TAG(Vertex2f), TAG(Vertex2fv), TAG(Vertex3f), TAG(Vertex3fv), TAG(Vertex4f), TAG(Vertex4fv), TAG(CallList), TAG(CallLists), TAG(Begin), TAG(End), TAG(VertexAttrib1fNV), TAG(VertexAttrib1fvNV), TAG(VertexAttrib2fNV), TAG(VertexAttrib2fvNV), TAG(VertexAttrib3fNV), TAG(VertexAttrib3fvNV), TAG(VertexAttrib4fNV), TAG(VertexAttrib4fvNV), TAG(VertexAttrib1fARB), TAG(VertexAttrib1fvARB), TAG(VertexAttrib2fARB), TAG(VertexAttrib2fvARB), TAG(VertexAttrib3fARB), TAG(VertexAttrib3fvARB), TAG(VertexAttrib4fARB), TAG(VertexAttrib4fvARB), TAG(Rectf), TAG(DrawArrays), TAG(DrawElements), TAG(DrawRangeElements), TAG(EvalMesh1), TAG(EvalMesh2) }; #undef TAG #undef PRE_LOOPBACK nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/mathmod.h0000644000000000000000000000271213614532424017752 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \mainpage Mesa Math Module * * This module contains math-related utility functions for transforming * vertices, translating arrays of numbers from one data type to another, * evaluating curved surfaces, etc. */ #ifndef _MESA_MATH_H_ #define _MESA_MATH_H_ extern void _math_init( void ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_clip_tmp.h0000644000000000000000000002034413614532424020445 0ustar /* * Mesa 3-D graphics library * Version: 6.2 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * New (3.1) transformation code written by Keith Whitwell. */ /* KW: a clever asm implementation would nestle integer versions * of the outcode calculation underneath the division. Gcc won't * do this, strangely enough, so I only do the divide in * the case where the cliptest passes. This isn't essential, * and an asm implementation needn't replicate that behaviour. * * \param clip_vec vector of incoming clip-space coords * \param proj_vec vector of resultant NDC-space projected coords * \param clipMask resulting array of clip flags * \param orMask bitwise-OR of clipMask values * \param andMask bitwise-AND of clipMask values * \return proj_vec pointer */ static GLvector4f * _XFORMAPI TAG(cliptest_points4)( GLvector4f *clip_vec, GLvector4f *proj_vec, GLubyte clipMask[], GLubyte *orMask, GLubyte *andMask ) { const GLuint stride = clip_vec->stride; const GLfloat *from = (GLfloat *)clip_vec->start; const GLuint count = clip_vec->count; GLuint c = 0; GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start; GLubyte tmpAndMask = *andMask; GLubyte tmpOrMask = *orMask; GLuint i; STRIDE_LOOP { const GLfloat cx = from[0]; const GLfloat cy = from[1]; const GLfloat cz = from[2]; const GLfloat cw = from[3]; #if defined(macintosh) || defined(__powerpc__) /* on powerpc cliptest is 17% faster in this way. */ GLuint mask; mask = (((cw < cx) << CLIP_RIGHT_SHIFT)); mask |= (((cw < -cx) << CLIP_LEFT_SHIFT)); mask |= (((cw < cy) << CLIP_TOP_SHIFT)); mask |= (((cw < -cy) << CLIP_BOTTOM_SHIFT)); mask |= (((cw < cz) << CLIP_FAR_SHIFT)); mask |= (((cw < -cz) << CLIP_NEAR_SHIFT)); #else /* !defined(macintosh)) */ GLubyte mask = 0; if (-cx + cw < 0) mask |= CLIP_RIGHT_BIT; if ( cx + cw < 0) mask |= CLIP_LEFT_BIT; if (-cy + cw < 0) mask |= CLIP_TOP_BIT; if ( cy + cw < 0) mask |= CLIP_BOTTOM_BIT; if (-cz + cw < 0) mask |= CLIP_FAR_BIT; if ( cz + cw < 0) mask |= CLIP_NEAR_BIT; #endif /* defined(macintosh) */ clipMask[i] = mask; if (mask) { c++; tmpAndMask &= mask; tmpOrMask |= mask; vProj[i][0] = 0; vProj[i][1] = 0; vProj[i][2] = 0; vProj[i][3] = 1; } else { GLfloat oow = 1.0F / cw; vProj[i][0] = cx * oow; vProj[i][1] = cy * oow; vProj[i][2] = cz * oow; vProj[i][3] = oow; } } *orMask = tmpOrMask; *andMask = (GLubyte) (c < count ? 0 : tmpAndMask); proj_vec->flags |= VEC_SIZE_4; proj_vec->size = 4; proj_vec->count = clip_vec->count; return proj_vec; } /* * \param clip_vec vector of incoming clip-space coords * \param proj_vec vector of resultant NDC-space projected coords * \param clipMask resulting array of clip flags * \param orMask bitwise-OR of clipMask values * \param andMask bitwise-AND of clipMask values * \return clip_vec pointer */ static GLvector4f * _XFORMAPI TAG(cliptest_np_points4)( GLvector4f *clip_vec, GLvector4f *proj_vec, GLubyte clipMask[], GLubyte *orMask, GLubyte *andMask ) { const GLuint stride = clip_vec->stride; const GLuint count = clip_vec->count; const GLfloat *from = (GLfloat *)clip_vec->start; GLuint c = 0; GLubyte tmpAndMask = *andMask; GLubyte tmpOrMask = *orMask; GLuint i; (void) proj_vec; STRIDE_LOOP { const GLfloat cx = from[0]; const GLfloat cy = from[1]; const GLfloat cz = from[2]; const GLfloat cw = from[3]; #if defined(macintosh) || defined(__powerpc__) /* on powerpc cliptest is 17% faster in this way. */ GLuint mask; mask = (((cw < cx) << CLIP_RIGHT_SHIFT)); mask |= (((cw < -cx) << CLIP_LEFT_SHIFT)); mask |= (((cw < cy) << CLIP_TOP_SHIFT)); mask |= (((cw < -cy) << CLIP_BOTTOM_SHIFT)); mask |= (((cw < cz) << CLIP_FAR_SHIFT)); mask |= (((cw < -cz) << CLIP_NEAR_SHIFT)); #else /* !defined(macintosh)) */ GLubyte mask = 0; if (-cx + cw < 0) mask |= CLIP_RIGHT_BIT; if ( cx + cw < 0) mask |= CLIP_LEFT_BIT; if (-cy + cw < 0) mask |= CLIP_TOP_BIT; if ( cy + cw < 0) mask |= CLIP_BOTTOM_BIT; if (-cz + cw < 0) mask |= CLIP_FAR_BIT; if ( cz + cw < 0) mask |= CLIP_NEAR_BIT; #endif /* defined(macintosh) */ clipMask[i] = mask; if (mask) { c++; tmpAndMask &= mask; tmpOrMask |= mask; } } *orMask = tmpOrMask; *andMask = (GLubyte) (c < count ? 0 : tmpAndMask); return clip_vec; } static GLvector4f * _XFORMAPI TAG(cliptest_points3)( GLvector4f *clip_vec, GLvector4f *proj_vec, GLubyte clipMask[], GLubyte *orMask, GLubyte *andMask ) { const GLuint stride = clip_vec->stride; const GLuint count = clip_vec->count; const GLfloat *from = (GLfloat *)clip_vec->start; GLubyte tmpOrMask = *orMask; GLubyte tmpAndMask = *andMask; GLuint i; (void) proj_vec; STRIDE_LOOP { const GLfloat cx = from[0], cy = from[1], cz = from[2]; GLubyte mask = 0; if (cx > 1.0) mask |= CLIP_RIGHT_BIT; else if (cx < -1.0) mask |= CLIP_LEFT_BIT; if (cy > 1.0) mask |= CLIP_TOP_BIT; else if (cy < -1.0) mask |= CLIP_BOTTOM_BIT; if (cz > 1.0) mask |= CLIP_FAR_BIT; else if (cz < -1.0) mask |= CLIP_NEAR_BIT; clipMask[i] = mask; tmpOrMask |= mask; tmpAndMask &= mask; } *orMask = tmpOrMask; *andMask = tmpAndMask; return clip_vec; } static GLvector4f * _XFORMAPI TAG(cliptest_points2)( GLvector4f *clip_vec, GLvector4f *proj_vec, GLubyte clipMask[], GLubyte *orMask, GLubyte *andMask ) { const GLuint stride = clip_vec->stride; const GLuint count = clip_vec->count; const GLfloat *from = (GLfloat *)clip_vec->start; GLubyte tmpOrMask = *orMask; GLubyte tmpAndMask = *andMask; GLuint i; (void) proj_vec; STRIDE_LOOP { const GLfloat cx = from[0], cy = from[1]; GLubyte mask = 0; if (cx > 1.0) mask |= CLIP_RIGHT_BIT; else if (cx < -1.0) mask |= CLIP_LEFT_BIT; if (cy > 1.0) mask |= CLIP_TOP_BIT; else if (cy < -1.0) mask |= CLIP_BOTTOM_BIT; clipMask[i] = mask; tmpOrMask |= mask; tmpAndMask &= mask; } *orMask = tmpOrMask; *andMask = tmpAndMask; return clip_vec; } static void TAG(init_c_cliptest)( void ) { _mesa_clip_tab[4] = TAG(cliptest_points4); _mesa_clip_tab[3] = TAG(cliptest_points3); _mesa_clip_tab[2] = TAG(cliptest_points2); _mesa_clip_np_tab[4] = TAG(cliptest_np_points4); _mesa_clip_np_tab[3] = TAG(cliptest_points3); _mesa_clip_np_tab[2] = TAG(cliptest_points2); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_copy_tmp.h0000644000000000000000000000537513614532424020477 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * New (3.1) transformation code written by Keith Whitwell. */ #define COPY_FUNC( BITS ) \ static void TAG2(copy, BITS)( GLvector4f *to, const GLvector4f *f ) \ { \ GLfloat (*t)[4] = (GLfloat (*)[4])to->start; \ GLfloat *from = f->start; \ GLuint stride = f->stride; \ GLuint count = to->count; \ GLuint i; \ \ if (BITS) \ STRIDE_LOOP { \ if (BITS&1) t[i][0] = from[0]; \ if (BITS&2) t[i][1] = from[1]; \ if (BITS&4) t[i][2] = from[2]; \ if (BITS&8) t[i][3] = from[3]; \ } \ } /* We got them all here: */ COPY_FUNC( 0x0 ) /* noop */ COPY_FUNC( 0x1 ) COPY_FUNC( 0x2 ) COPY_FUNC( 0x3 ) COPY_FUNC( 0x4 ) COPY_FUNC( 0x5 ) COPY_FUNC( 0x6 ) COPY_FUNC( 0x7 ) COPY_FUNC( 0x8 ) COPY_FUNC( 0x9 ) COPY_FUNC( 0xa ) COPY_FUNC( 0xb ) COPY_FUNC( 0xc ) COPY_FUNC( 0xd ) COPY_FUNC( 0xe ) COPY_FUNC( 0xf ) static void TAG2(init_copy, 0)( void ) { _mesa_copy_tab[0x0] = TAG2(copy, 0x0); _mesa_copy_tab[0x1] = TAG2(copy, 0x1); _mesa_copy_tab[0x2] = TAG2(copy, 0x2); _mesa_copy_tab[0x3] = TAG2(copy, 0x3); _mesa_copy_tab[0x4] = TAG2(copy, 0x4); _mesa_copy_tab[0x5] = TAG2(copy, 0x5); _mesa_copy_tab[0x6] = TAG2(copy, 0x6); _mesa_copy_tab[0x7] = TAG2(copy, 0x7); _mesa_copy_tab[0x8] = TAG2(copy, 0x8); _mesa_copy_tab[0x9] = TAG2(copy, 0x9); _mesa_copy_tab[0xa] = TAG2(copy, 0xa); _mesa_copy_tab[0xb] = TAG2(copy, 0xb); _mesa_copy_tab[0xc] = TAG2(copy, 0xc); _mesa_copy_tab[0xd] = TAG2(copy, 0xd); _mesa_copy_tab[0xe] = TAG2(copy, 0xe); _mesa_copy_tab[0xf] = TAG2(copy, 0xf); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_debug_clip.c0000644000000000000000000002440213614532424020725 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Gareth Hughes */ #include "glheader.h" #include "context.h" #include "macros.h" #include "imports.h" #include "m_matrix.h" #include "m_xform.h" #include "m_debug.h" #include "m_debug_util.h" #ifdef __UNIXOS2__ /* The linker doesn't like empty files */ static char dummy; #endif #ifdef DEBUG /* This code only used for debugging */ static clip_func *clip_tab[2] = { _mesa_clip_tab, _mesa_clip_np_tab }; static char *cnames[2] = { "_mesa_clip_tab", "_mesa_clip_np_tab" }; #ifdef RUN_DEBUG_BENCHMARK static char *cstrings[2] = { "clip, perspective divide", "clip, no divide" }; #endif /* ============================================================= * Reference cliptests */ static GLvector4f *ref_cliptest_points4( GLvector4f *clip_vec, GLvector4f *proj_vec, GLubyte clipMask[], GLubyte *orMask, GLubyte *andMask ) { const GLuint stride = clip_vec->stride; const GLuint count = clip_vec->count; const GLfloat *from = (GLfloat *)clip_vec->start; GLuint c = 0; GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start; GLubyte tmpAndMask = *andMask; GLubyte tmpOrMask = *orMask; GLuint i; for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { const GLfloat cx = from[0]; const GLfloat cy = from[1]; const GLfloat cz = from[2]; const GLfloat cw = from[3]; GLubyte mask = 0; if ( -cx + cw < 0 ) mask |= CLIP_RIGHT_BIT; if ( cx + cw < 0 ) mask |= CLIP_LEFT_BIT; if ( -cy + cw < 0 ) mask |= CLIP_TOP_BIT; if ( cy + cw < 0 ) mask |= CLIP_BOTTOM_BIT; if ( -cz + cw < 0 ) mask |= CLIP_FAR_BIT; if ( cz + cw < 0 ) mask |= CLIP_NEAR_BIT; clipMask[i] = mask; if ( mask ) { c++; tmpAndMask &= mask; tmpOrMask |= mask; vProj[i][0] = 0; vProj[i][1] = 0; vProj[i][2] = 0; vProj[i][3] = 1; } else { GLfloat oow = 1.0F / cw; vProj[i][0] = cx * oow; vProj[i][1] = cy * oow; vProj[i][2] = cz * oow; vProj[i][3] = oow; } } *orMask = tmpOrMask; *andMask = (GLubyte) (c < count ? 0 : tmpAndMask); proj_vec->flags |= VEC_SIZE_4; proj_vec->size = 4; proj_vec->count = clip_vec->count; return proj_vec; } /* Keep these here for now, even though we don't use them... */ static GLvector4f *ref_cliptest_points3( GLvector4f *clip_vec, GLvector4f *proj_vec, GLubyte clipMask[], GLubyte *orMask, GLubyte *andMask ) { const GLuint stride = clip_vec->stride; const GLuint count = clip_vec->count; const GLfloat *from = (GLfloat *)clip_vec->start; GLubyte tmpOrMask = *orMask; GLubyte tmpAndMask = *andMask; GLuint i; for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { const GLfloat cx = from[0], cy = from[1], cz = from[2]; GLubyte mask = 0; if ( cx > 1.0 ) mask |= CLIP_RIGHT_BIT; else if ( cx < -1.0 ) mask |= CLIP_LEFT_BIT; if ( cy > 1.0 ) mask |= CLIP_TOP_BIT; else if ( cy < -1.0 ) mask |= CLIP_BOTTOM_BIT; if ( cz > 1.0 ) mask |= CLIP_FAR_BIT; else if ( cz < -1.0 ) mask |= CLIP_NEAR_BIT; clipMask[i] = mask; tmpOrMask |= mask; tmpAndMask &= mask; } *orMask = tmpOrMask; *andMask = tmpAndMask; return clip_vec; } static GLvector4f * ref_cliptest_points2( GLvector4f *clip_vec, GLvector4f *proj_vec, GLubyte clipMask[], GLubyte *orMask, GLubyte *andMask ) { const GLuint stride = clip_vec->stride; const GLuint count = clip_vec->count; const GLfloat *from = (GLfloat *)clip_vec->start; GLubyte tmpOrMask = *orMask; GLubyte tmpAndMask = *andMask; GLuint i; for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) { const GLfloat cx = from[0], cy = from[1]; GLubyte mask = 0; if ( cx > 1.0 ) mask |= CLIP_RIGHT_BIT; else if ( cx < -1.0 ) mask |= CLIP_LEFT_BIT; if ( cy > 1.0 ) mask |= CLIP_TOP_BIT; else if ( cy < -1.0 ) mask |= CLIP_BOTTOM_BIT; clipMask[i] = mask; tmpOrMask |= mask; tmpAndMask &= mask; } *orMask = tmpOrMask; *andMask = tmpAndMask; return clip_vec; } static clip_func ref_cliptest[5] = { 0, 0, ref_cliptest_points2, ref_cliptest_points3, ref_cliptest_points4 }; /* ============================================================= * Cliptest tests */ ALIGN16(static GLfloat, s[TEST_COUNT][4]); ALIGN16(static GLfloat, d[TEST_COUNT][4]); ALIGN16(static GLfloat, r[TEST_COUNT][4]); static int test_cliptest_function( clip_func func, int np, int psize, long *cycles ) { GLvector4f source[1], dest[1], ref[1]; GLubyte dm[TEST_COUNT], dco, dca; GLubyte rm[TEST_COUNT], rco, rca; int i, j; #ifdef RUN_DEBUG_BENCHMARK int cycle_i; /* the counter for the benchmarks we run */ #endif (void) cycles; if ( psize > 4 ) { _mesa_problem( NULL, "test_cliptest_function called with psize > 4\n" ); return 0; } for ( i = 0 ; i < TEST_COUNT ; i++) { ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 ); ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 ); for ( j = 0 ; j < psize ; j++ ) s[i][j] = rnd(); } source->data = (GLfloat(*)[4])s; source->start = (GLfloat *)s; source->count = TEST_COUNT; source->stride = sizeof(s[0]); source->size = 4; source->flags = 0; dest->data = (GLfloat(*)[4])d; dest->start = (GLfloat *)d; dest->count = TEST_COUNT; dest->stride = sizeof(float[4]); dest->size = 0; dest->flags = 0; ref->data = (GLfloat(*)[4])r; ref->start = (GLfloat *)r; ref->count = TEST_COUNT; ref->stride = sizeof(float[4]); ref->size = 0; ref->flags = 0; dco = rco = 0; dca = rca = CLIP_ALL_BITS; ref_cliptest[psize]( source, ref, rm, &rco, &rca ); if ( mesa_profile ) { BEGIN_RACE( *cycles ); func( source, dest, dm, &dco, &dca ); END_RACE( *cycles ); } else { func( source, dest, dm, &dco, &dca ); } if ( dco != rco ) { _mesa_printf( "\n-----------------------------\n" ); _mesa_printf( "dco = 0x%02x rco = 0x%02x\n", dco, rco ); return 0; } if ( dca != rca ) { _mesa_printf( "\n-----------------------------\n" ); _mesa_printf( "dca = 0x%02x rca = 0x%02x\n", dca, rca ); return 0; } for ( i = 0 ; i < TEST_COUNT ; i++ ) { if ( dm[i] != rm[i] ) { _mesa_printf( "\n-----------------------------\n" ); _mesa_printf( "(i = %i)\n", i ); _mesa_printf( "dm = 0x%02x rm = 0x%02x\n", dm[i], rm[i] ); return 0; } } /* Only verify output on projected points4 case. FIXME: Do we need * to test other cases? */ if ( np || psize < 4 ) return 1; for ( i = 0 ; i < TEST_COUNT ; i++ ) { for ( j = 0 ; j < 4 ; j++ ) { if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { _mesa_printf( "\n-----------------------------\n" ); _mesa_printf( "(i = %i, j = %i) dm = 0x%02x rm = 0x%02x\n", i, j, dm[i], rm[i] ); _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][0], r[i][0], r[i][0]-d[i][0], MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][1], r[i][1], r[i][1]-d[i][1], MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][2], r[i][2], r[i][2]-d[i][2], MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][3], r[i][3], r[i][3]-d[i][3], MAX_PRECISION - significand_match( d[i][3], r[i][3] ) ); return 0; } } } return 1; } void _math_test_all_cliptest_functions( char *description ) { int np, psize; long benchmark_tab[2][4]; static int first_time = 1; if ( first_time ) { first_time = 0; mesa_profile = _mesa_getenv( "MESA_PROFILE" ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { if ( !counter_overhead ) { INIT_COUNTER(); _mesa_printf( "counter overhead: %ld cycles\n\n", counter_overhead ); } _mesa_printf( "cliptest results after hooking in %s functions:\n", description ); } #endif #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { _mesa_printf( "\n\t" ); for ( psize = 2 ; psize <= 4 ; psize++ ) { _mesa_printf( " p%d\t", psize ); } _mesa_printf( "\n--------------------------------------------------------\n\t" ); } #endif for ( np = 0 ; np < 2 ; np++ ) { for ( psize = 2 ; psize <= 4 ; psize++ ) { clip_func func = clip_tab[np][psize]; long *cycles = &(benchmark_tab[np][psize-1]); if ( test_cliptest_function( func, np, psize, cycles ) == 0 ) { char buf[100]; _mesa_sprintf( buf, "%s[%d] failed test (%s)", cnames[np], psize, description ); _mesa_problem( NULL, buf ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) _mesa_printf( " %li\t", benchmark_tab[np][psize-1] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) _mesa_printf( " | [%s]\n\t", cstrings[np] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) _mesa_printf( "\n" ); #endif } #endif /* DEBUG */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_debug.h0000644000000000000000000000306213614532424017722 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Gareth Hughes */ #ifndef __M_DEBUG_H__ #define __M_DEBUG_H__ extern void _math_test_all_transform_functions( char *description ); extern void _math_test_all_normal_transform_functions( char *description ); extern void _math_test_all_cliptest_functions( char *description ); /* Deprecated? */ extern void _math_test_all_vertex_functions( char *description ); extern char *mesa_profile; #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_debug_norm.c0000644000000000000000000002457113614532424020760 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Gareth Hughes */ #include "glheader.h" #include "context.h" #include "macros.h" #include "imports.h" #include "m_matrix.h" #include "m_xform.h" #include "m_debug.h" #include "m_debug_util.h" #ifdef __UNIXOS2__ /* The linker doesn't like empty files */ static char dummy; #endif #ifdef DEBUG /* This code only used for debugging */ static int m_norm_identity[16] = { ONE, NIL, NIL, NIL, NIL, ONE, NIL, NIL, NIL, NIL, ONE, NIL, NIL, NIL, NIL, NIL }; static int m_norm_general[16] = { VAR, VAR, VAR, NIL, VAR, VAR, VAR, NIL, VAR, VAR, VAR, NIL, NIL, NIL, NIL, NIL }; static int m_norm_no_rot[16] = { VAR, NIL, NIL, NIL, NIL, VAR, NIL, NIL, NIL, NIL, VAR, NIL, NIL, NIL, NIL, NIL }; static int *norm_templates[8] = { m_norm_no_rot, m_norm_no_rot, m_norm_no_rot, m_norm_general, m_norm_general, m_norm_general, m_norm_identity, m_norm_identity }; static int norm_types[8] = { NORM_TRANSFORM_NO_ROT, NORM_TRANSFORM_NO_ROT | NORM_RESCALE, NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE, NORM_TRANSFORM, NORM_TRANSFORM | NORM_RESCALE, NORM_TRANSFORM | NORM_NORMALIZE, NORM_RESCALE, NORM_NORMALIZE }; static int norm_scale_types[8] = { /* rescale factor */ NIL, /* NIL disables rescaling */ VAR, NIL, NIL, VAR, NIL, VAR, NIL }; static int norm_normalize_types[8] = { /* normalizing ?? (no = 0) */ 0, 0, 1, 0, 0, 1, 0, 1 }; static char *norm_strings[8] = { "NORM_TRANSFORM_NO_ROT", "NORM_TRANSFORM_NO_ROT | NORM_RESCALE", "NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE", "NORM_TRANSFORM", "NORM_TRANSFORM | NORM_RESCALE", "NORM_TRANSFORM | NORM_NORMALIZE", "NORM_RESCALE", "NORM_NORMALIZE" }; /* ============================================================= * Reference transformations */ static void ref_norm_transform_rescale( const GLmatrix *mat, GLfloat scale, const GLvector4f *in, const GLfloat *lengths, GLvector4f *dest ) { GLuint i; const GLfloat *s = in->start; const GLfloat *m = mat->inv; GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start; (void) lengths; for ( i = 0 ; i < in->count ; i++ ) { GLfloat t[3]; TRANSFORM_NORMAL( t, s, m ); SCALE_SCALAR_3V( out[i], scale, t ); s = (GLfloat *)((char *)s + in->stride); } } static void ref_norm_transform_normalize( const GLmatrix *mat, GLfloat scale, const GLvector4f *in, const GLfloat *lengths, GLvector4f *dest ) { GLuint i; const GLfloat *s = in->start; const GLfloat *m = mat->inv; GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start; for ( i = 0 ; i < in->count ; i++ ) { GLfloat t[3]; TRANSFORM_NORMAL( t, s, m ); if ( !lengths ) { GLfloat len = LEN_SQUARED_3FV( t ); if ( len > 1e-20 ) { /* Hmmm, don't know how we could test the precalculated * length case... */ scale = 1.0 / sqrt( len ); SCALE_SCALAR_3V( out[i], scale, t ); } else { out[i][0] = out[i][1] = out[i][2] = 0; } } else { scale = lengths[i];; SCALE_SCALAR_3V( out[i], scale, t ); } s = (GLfloat *)((char *)s + in->stride); } } /* ============================================================= * Normal transformation tests */ static void init_matrix( GLfloat *m ) { m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; } static int test_norm_function( normal_func func, int mtype, long *cycles ) { GLvector4f source[1], dest[1], dest2[1], ref[1], ref2[1]; GLmatrix mat[1]; GLfloat s[TEST_COUNT][5], d[TEST_COUNT][4], r[TEST_COUNT][4]; GLfloat d2[TEST_COUNT][4], r2[TEST_COUNT][4], length[TEST_COUNT]; GLfloat scale; GLfloat *m; int i, j; #ifdef RUN_DEBUG_BENCHMARK int cycle_i; /* the counter for the benchmarks we run */ #endif (void) cycles; mat->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); mat->inv = m = mat->m; init_matrix( m ); scale = 1.0F + rnd () * norm_scale_types[mtype]; for ( i = 0 ; i < 4 ; i++ ) { for ( j = 0 ; j < 4 ; j++ ) { switch ( norm_templates[mtype][i * 4 + j] ) { case NIL: m[j * 4 + i] = 0.0; break; case ONE: m[j * 4 + i] = 1.0; break; case NEG: m[j * 4 + i] = -1.0; break; case VAR: break; default: abort(); } } } for ( i = 0 ; i < TEST_COUNT ; i++ ) { ASSIGN_3V( d[i], 0.0, 0.0, 0.0 ); ASSIGN_3V( s[i], 0.0, 0.0, 0.0 ); ASSIGN_3V( d2[i], 0.0, 0.0, 0.0 ); for ( j = 0 ; j < 3 ; j++ ) s[i][j] = rnd(); length[i] = 1 / sqrt( LEN_SQUARED_3FV( s[i] ) ); } source->data = (GLfloat(*)[4]) s; source->start = (GLfloat *) s; source->count = TEST_COUNT; source->stride = sizeof(s[0]); source->flags = 0; dest->data = d; dest->start = (GLfloat *) d; dest->count = TEST_COUNT; dest->stride = sizeof(float[4]); dest->flags = 0; dest2->data = d2; dest2->start = (GLfloat *) d2; dest2->count = TEST_COUNT; dest2->stride = sizeof(float[4]); dest2->flags = 0; ref->data = r; ref->start = (GLfloat *) r; ref->count = TEST_COUNT; ref->stride = sizeof(float[4]); ref->flags = 0; ref2->data = r2; ref2->start = (GLfloat *) r2; ref2->count = TEST_COUNT; ref2->stride = sizeof(float[4]); ref2->flags = 0; if ( norm_normalize_types[mtype] == 0 ) { ref_norm_transform_rescale( mat, scale, source, NULL, ref ); } else { ref_norm_transform_normalize( mat, scale, source, NULL, ref ); ref_norm_transform_normalize( mat, scale, source, length, ref2 ); } if ( mesa_profile ) { BEGIN_RACE( *cycles ); func( mat, scale, source, NULL, dest ); END_RACE( *cycles ); func( mat, scale, source, length, dest2 ); } else { func( mat, scale, source, NULL, dest ); func( mat, scale, source, length, dest2 ); } for ( i = 0 ; i < TEST_COUNT ; i++ ) { for ( j = 0 ; j < 3 ; j++ ) { if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { _mesa_printf( "-----------------------------\n" ); _mesa_printf( "(i = %i, j = %i)\n", i, j ); _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", d[i][0], r[i][0], r[i][0]/d[i][0], MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", d[i][1], r[i][1], r[i][1]/d[i][1], MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", d[i][2], r[i][2], r[i][2]/d[i][2], MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); return 0; } if ( norm_normalize_types[mtype] != 0 ) { if ( significand_match( d2[i][j], r2[i][j] ) < REQUIRED_PRECISION ) { _mesa_printf( "------------------- precalculated length case ------\n" ); _mesa_printf( "(i = %i, j = %i)\n", i, j ); _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", d2[i][0], r2[i][0], r2[i][0]/d2[i][0], MAX_PRECISION - significand_match( d2[i][0], r2[i][0] ) ); _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", d2[i][1], r2[i][1], r2[i][1]/d2[i][1], MAX_PRECISION - significand_match( d2[i][1], r2[i][1] ) ); _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", d2[i][2], r2[i][2], r2[i][2]/d2[i][2], MAX_PRECISION - significand_match( d2[i][2], r2[i][2] ) ); return 0; } } } } ALIGN_FREE( mat->m ); return 1; } void _math_test_all_normal_transform_functions( char *description ) { int mtype; long benchmark_tab[0xf]; static int first_time = 1; if ( first_time ) { first_time = 0; mesa_profile = getenv( "MESA_PROFILE" ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { if ( !counter_overhead ) { INIT_COUNTER(); _mesa_printf( "counter overhead: %ld cycles\n\n", counter_overhead ); } _mesa_printf( "normal transform results after hooking in %s functions:\n", description ); _mesa_printf( "\n-------------------------------------------------------\n" ); } #endif for ( mtype = 0 ; mtype < 8 ; mtype++ ) { normal_func func = _mesa_normal_tab[norm_types[mtype]]; long *cycles = &benchmark_tab[mtype]; if ( test_norm_function( func, mtype, cycles ) == 0 ) { char buf[100]; _mesa_sprintf( buf, "_mesa_normal_tab[0][%s] failed test (%s)", norm_strings[mtype], description ); _mesa_problem( NULL, buf ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { _mesa_printf( " %li\t", benchmark_tab[mtype] ); _mesa_printf( " | [%s]\n", norm_strings[mtype] ); } #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { _mesa_printf( "\n" ); fflush( stdout ); } #endif } #endif /* DEBUG */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_debug_util.h0000644000000000000000000002366613614532424020773 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Gareth Hughes */ #ifndef __M_DEBUG_UTIL_H__ #define __M_DEBUG_UTIL_H__ #ifdef DEBUG /* This code only used for debugging */ /* Comment this out to deactivate the cycle counter. * NOTE: it works only on CPUs which know the 'rdtsc' command (586 or higher) * (hope, you don't try to debug Mesa on a 386 ;) */ #if defined(__GNUC__) && \ ((defined(__i386__) && defined(USE_X86_ASM)) || \ (defined(__sparc__) && defined(USE_SPARC_ASM))) #define RUN_DEBUG_BENCHMARK #endif #define TEST_COUNT 128 /* size of the tested vector array */ #define REQUIRED_PRECISION 10 /* allow 4 bits to miss */ #define MAX_PRECISION 24 /* max. precision possible */ #ifdef RUN_DEBUG_BENCHMARK /* Overhead of profiling counter in cycles. Automatically adjusted to * your machine at run time - counter initialization should give very * consistent results. */ extern long counter_overhead; /* This is the value of the environment variable MESA_PROFILE, and is * used to determine if we should benchmark the functions as well as * verify their correctness. */ extern char *mesa_profile; /* Modify the the number of tests if you like. * We take the minimum of all results, because every error should be * positive (time used by other processes, task switches etc). * It is assumed that all calculations are done in the cache. */ #if defined(__i386__) #if 1 /* PPro, PII, PIII version */ /* Profiling on the P6 architecture requires a little more work, due to * the internal out-of-order execution. We must perform a serializing * 'cpuid' instruction before and after the 'rdtsc' instructions to make * sure no other uops are executed when we sample the timestamp counter. */ #define INIT_COUNTER() \ do { \ int cycle_i; \ counter_overhead = LONG_MAX; \ for ( cycle_i = 0 ; cycle_i < 8 ; cycle_i++ ) { \ long cycle_tmp1 = 0, cycle_tmp2 = 0; \ __asm__ __volatile__ ( "push %%ebx \n" \ "xor %%eax, %%eax \n" \ "cpuid \n" \ "rdtsc \n" \ "mov %%eax, %0 \n" \ "xor %%eax, %%eax \n" \ "cpuid \n" \ "pop %%ebx \n" \ "push %%ebx \n" \ "xor %%eax, %%eax \n" \ "cpuid \n" \ "rdtsc \n" \ "mov %%eax, %1 \n" \ "xor %%eax, %%eax \n" \ "cpuid \n" \ "pop %%ebx \n" \ : "=m" (cycle_tmp1), "=m" (cycle_tmp2) \ : : "eax", "ecx", "edx" ); \ if ( counter_overhead > (cycle_tmp2 - cycle_tmp1) ) { \ counter_overhead = cycle_tmp2 - cycle_tmp1; \ } \ } \ } while (0) #define BEGIN_RACE(x) \ x = LONG_MAX; \ for ( cycle_i = 0 ; cycle_i < 10 ; cycle_i++ ) { \ long cycle_tmp1 = 0, cycle_tmp2 = 0; \ __asm__ __volatile__ ( "push %%ebx \n" \ "xor %%eax, %%eax \n" \ "cpuid \n" \ "rdtsc \n" \ "mov %%eax, %0 \n" \ "xor %%eax, %%eax \n" \ "cpuid \n" \ "pop %%ebx \n" \ : "=m" (cycle_tmp1) \ : : "eax", "ecx", "edx" ); #define END_RACE(x) \ __asm__ __volatile__ ( "push %%ebx \n" \ "xor %%eax, %%eax \n" \ "cpuid \n" \ "rdtsc \n" \ "mov %%eax, %0 \n" \ "xor %%eax, %%eax \n" \ "cpuid \n" \ "pop %%ebx \n" \ : "=m" (cycle_tmp2) \ : : "eax", "ecx", "edx" ); \ if ( x > (cycle_tmp2 - cycle_tmp1) ) { \ x = cycle_tmp2 - cycle_tmp1; \ } \ } \ x -= counter_overhead; #else /* PPlain, PMMX version */ /* To ensure accurate results, we stall the pipelines with the * non-pairable 'cdq' instruction. This ensures all the code being * profiled is complete when the 'rdtsc' instruction executes. */ #define INIT_COUNTER(x) \ do { \ int cycle_i; \ x = LONG_MAX; \ for ( cycle_i = 0 ; cycle_i < 32 ; cycle_i++ ) { \ long cycle_tmp1, cycle_tmp2, dummy; \ __asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp1) ); \ __asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp2) ); \ __asm__ ( "cdq" ); \ __asm__ ( "cdq" ); \ __asm__ ( "rdtsc" : "=a" (cycle_tmp1), "=d" (dummy) ); \ __asm__ ( "cdq" ); \ __asm__ ( "cdq" ); \ __asm__ ( "rdtsc" : "=a" (cycle_tmp2), "=d" (dummy) ); \ if ( x > (cycle_tmp2 - cycle_tmp1) ) \ x = cycle_tmp2 - cycle_tmp1; \ } \ } while (0) #define BEGIN_RACE(x) \ x = LONG_MAX; \ for ( cycle_i = 0 ; cycle_i < 16 ; cycle_i++ ) { \ long cycle_tmp1, cycle_tmp2, dummy; \ __asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp1) ); \ __asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp2) ); \ __asm__ ( "cdq" ); \ __asm__ ( "cdq" ); \ __asm__ ( "rdtsc" : "=a" (cycle_tmp1), "=d" (dummy) ); #define END_RACE(x) \ __asm__ ( "cdq" ); \ __asm__ ( "cdq" ); \ __asm__ ( "rdtsc" : "=a" (cycle_tmp2), "=d" (dummy) ); \ if ( x > (cycle_tmp2 - cycle_tmp1) ) \ x = cycle_tmp2 - cycle_tmp1; \ } \ x -= counter_overhead; #endif #elif defined(__amd64__) #define rdtscll(val) do { \ unsigned int a,d; \ __asm__ volatile("rdtsc" : "=a" (a), "=d" (d)); \ (val) = ((unsigned long)a) | (((unsigned long)d)<<32); \ } while(0) /* Copied from i386 PIII version */ #define INIT_COUNTER() \ do { \ int cycle_i; \ counter_overhead = LONG_MAX; \ for ( cycle_i = 0 ; cycle_i < 16 ; cycle_i++ ) { \ unsigned long cycle_tmp1, cycle_tmp2; \ rdtscll(cycle_tmp1); \ rdtscll(cycle_tmp2); \ if ( counter_overhead > (cycle_tmp2 - cycle_tmp1) ) { \ counter_overhead = cycle_tmp2 - cycle_tmp1; \ } \ } \ } while (0) #define BEGIN_RACE(x) \ x = LONG_MAX; \ for ( cycle_i = 0 ; cycle_i < 10 ; cycle_i++ ) { \ unsigned long cycle_tmp1, cycle_tmp2; \ rdtscll(cycle_tmp1); \ #define END_RACE(x) \ rdtscll(cycle_tmp2); \ if ( x > (cycle_tmp2 - cycle_tmp1) ) { \ x = cycle_tmp2 - cycle_tmp1; \ } \ } \ x -= counter_overhead; #elif defined(__sparc__) #define INIT_COUNTER() \ do { counter_overhead = 5; } while(0) #define BEGIN_RACE(x) \ x = LONG_MAX; \ for (cycle_i = 0; cycle_i <10; cycle_i++) { \ register long cycle_tmp1 asm("l0"); \ register long cycle_tmp2 asm("l1"); \ /* rd %tick, %l0 */ \ __asm__ __volatile__ (".word 0xa1410000" : "=r" (cycle_tmp1)); /* save timestamp */ #define END_RACE(x) \ /* rd %tick, %l1 */ \ __asm__ __volatile__ (".word 0xa3410000" : "=r" (cycle_tmp2)); \ if (x > (cycle_tmp2-cycle_tmp1)) x = cycle_tmp2 - cycle_tmp1; \ } \ x -= counter_overhead; #else #error Your processor is not supported for RUN_XFORM_BENCHMARK #endif #else #define BEGIN_RACE(x) #define END_RACE(x) #endif /* ============================================================= * Helper functions */ static GLfloat rnd( void ) { GLfloat f = (GLfloat)rand() / (GLfloat)RAND_MAX; GLfloat gran = (GLfloat)(1 << 13); f = (GLfloat)(GLint)(f * gran) / gran; return f * 2.0 - 1.0; } static int significand_match( GLfloat a, GLfloat b ) { GLfloat d = a - b; int a_ex, b_ex, d_ex; if ( d == 0.0F ) { return MAX_PRECISION; /* Exact match */ } if ( a == 0.0F || b == 0.0F ) { /* It would probably be better to check if the * non-zero number is denormalized and return * the index of the highest set bit here. */ return 0; } FREXPF( a, &a_ex ); FREXPF( b, &b_ex ); FREXPF( d, &d_ex ); if ( a_ex < b_ex ) { return a_ex - d_ex; } else { return b_ex - d_ex; } } enum { NIL = 0, ONE = 1, NEG = -1, VAR = 2 }; /* Ensure our arrays are correctly aligned. */ #if defined(__GNUC__) # define ALIGN16(type, array) type array __attribute__ ((aligned (16))) #elif defined(__MSC__) # define ALIGN16(type, array) type array __declspec(align(16)) /* GH: Does this work? */ #elif defined(__WATCOMC__) # define ALIGN16(type, array) /* Watcom does not support this */ #elif defined(__xlC__) # define ALIGN16(type, array) type __align (16) array #else # warning "ALIGN16 will not 16-byte align!\n" # define ALIGN16 #endif #endif /* DEBUG */ #endif /* __M_DEBUG_UTIL_H__ */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_debug_xform.c0000644000000000000000000002137613614532424021140 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Updated for P6 architecture by Gareth Hughes. */ #include "glheader.h" #include "context.h" #include "macros.h" #include "imports.h" #include "m_matrix.h" #include "m_xform.h" #include "m_debug.h" #include "m_debug_util.h" #ifdef __UNIXOS2__ /* The linker doesn't like empty files */ static char dummy; #endif #ifdef DEBUG /* This code only used for debugging */ /* Overhead of profiling counter in cycles. Automatically adjusted to * your machine at run time - counter initialization should give very * consistent results. */ long counter_overhead = 0; /* This is the value of the environment variable MESA_PROFILE, and is * used to determine if we should benchmark the functions as well as * verify their correctness. */ char *mesa_profile = NULL; static int m_general[16] = { VAR, VAR, VAR, VAR, VAR, VAR, VAR, VAR, VAR, VAR, VAR, VAR, VAR, VAR, VAR, VAR }; static int m_identity[16] = { ONE, NIL, NIL, NIL, NIL, ONE, NIL, NIL, NIL, NIL, ONE, NIL, NIL, NIL, NIL, ONE }; static int m_2d[16] = { VAR, VAR, NIL, VAR, VAR, VAR, NIL, VAR, NIL, NIL, ONE, NIL, NIL, NIL, NIL, ONE }; static int m_2d_no_rot[16] = { VAR, NIL, NIL, VAR, NIL, VAR, NIL, VAR, NIL, NIL, ONE, NIL, NIL, NIL, NIL, ONE }; static int m_3d[16] = { VAR, VAR, VAR, VAR, VAR, VAR, VAR, VAR, VAR, VAR, VAR, VAR, NIL, NIL, NIL, ONE }; static int m_3d_no_rot[16] = { VAR, NIL, NIL, VAR, NIL, VAR, NIL, VAR, NIL, NIL, VAR, VAR, NIL, NIL, NIL, ONE }; static int m_perspective[16] = { VAR, NIL, VAR, NIL, NIL, VAR, VAR, NIL, NIL, NIL, VAR, VAR, NIL, NIL, NEG, NIL }; static int *templates[7] = { m_general, m_identity, m_3d_no_rot, m_perspective, m_2d, m_2d_no_rot, m_3d }; static enum GLmatrixtype mtypes[7] = { MATRIX_GENERAL, MATRIX_IDENTITY, MATRIX_3D_NO_ROT, MATRIX_PERSPECTIVE, MATRIX_2D, MATRIX_2D_NO_ROT, MATRIX_3D }; static char *mstrings[7] = { "MATRIX_GENERAL", "MATRIX_IDENTITY", "MATRIX_3D_NO_ROT", "MATRIX_PERSPECTIVE", "MATRIX_2D", "MATRIX_2D_NO_ROT", "MATRIX_3D" }; /* ============================================================= * Reference transformations */ static void ref_transform( GLvector4f *dst, const GLmatrix *mat, const GLvector4f *src ) { GLuint i; GLfloat *s = (GLfloat *)src->start; GLfloat (*d)[4] = (GLfloat (*)[4])dst->start; const GLfloat *m = mat->m; for ( i = 0 ; i < src->count ; i++ ) { TRANSFORM_POINT( d[i], m, s ); s = (GLfloat *)((char *)s + src->stride); } } /* ============================================================= * Vertex transformation tests */ static void init_matrix( GLfloat *m ) { m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; } ALIGN16(static GLfloat, s[TEST_COUNT][4]); ALIGN16(static GLfloat, d[TEST_COUNT][4]); ALIGN16(static GLfloat, r[TEST_COUNT][4]); static int test_transform_function( transform_func func, int psize, int mtype, unsigned long *cycles ) { GLvector4f source[1], dest[1], ref[1]; GLmatrix mat[1]; GLfloat *m; int i, j; #ifdef RUN_DEBUG_BENCHMARK int cycle_i; /* the counter for the benchmarks we run */ #endif (void) cycles; if ( psize > 4 ) { _mesa_problem( NULL, "test_transform_function called with psize > 4\n" ); return 0; } mat->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); mat->type = mtypes[mtype]; m = mat->m; ASSERT( ((long)m & 15) == 0 ); init_matrix( m ); for ( i = 0 ; i < 4 ; i++ ) { for ( j = 0 ; j < 4 ; j++ ) { switch ( templates[mtype][i * 4 + j] ) { case NIL: m[j * 4 + i] = 0.0; break; case ONE: m[j * 4 + i] = 1.0; break; case NEG: m[j * 4 + i] = -1.0; break; case VAR: break; default: abort(); } } } for ( i = 0 ; i < TEST_COUNT ; i++) { ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 ); ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 ); for ( j = 0 ; j < psize ; j++ ) s[i][j] = rnd(); } source->data = (GLfloat(*)[4])s; source->start = (GLfloat *)s; source->count = TEST_COUNT; source->stride = sizeof(s[0]); source->size = 4; source->flags = 0; dest->data = (GLfloat(*)[4])d; dest->start = (GLfloat *)d; dest->count = TEST_COUNT; dest->stride = sizeof(float[4]); dest->size = 0; dest->flags = 0; ref->data = (GLfloat(*)[4])r; ref->start = (GLfloat *)r; ref->count = TEST_COUNT; ref->stride = sizeof(float[4]); ref->size = 0; ref->flags = 0; ref_transform( ref, mat, source ); if ( mesa_profile ) { BEGIN_RACE( *cycles ); func( dest, mat->m, source ); END_RACE( *cycles ); } else { func( dest, mat->m, source ); } for ( i = 0 ; i < TEST_COUNT ; i++ ) { for ( j = 0 ; j < 4 ; j++ ) { if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { _mesa_printf("-----------------------------\n" ); _mesa_printf("(i = %i, j = %i)\n", i, j ); _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n", d[i][0], r[i][0], r[i][0]-d[i][0], MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n", d[i][1], r[i][1], r[i][1]-d[i][1], MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n", d[i][2], r[i][2], r[i][2]-d[i][2], MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n", d[i][3], r[i][3], r[i][3]-d[i][3], MAX_PRECISION - significand_match( d[i][3], r[i][3] ) ); return 0; } } } ALIGN_FREE( mat->m ); return 1; } void _math_test_all_transform_functions( char *description ) { int psize, mtype; unsigned long benchmark_tab[4][7]; static int first_time = 1; if ( first_time ) { first_time = 0; mesa_profile = getenv( "MESA_PROFILE" ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { if ( !counter_overhead ) { INIT_COUNTER(); _mesa_printf("counter overhead: %lu cycles\n\n", counter_overhead ); } _mesa_printf("transform results after hooking in %s functions:\n", description ); } #endif #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { _mesa_printf("\n" ); for ( psize = 1 ; psize <= 4 ; psize++ ) { _mesa_printf(" p%d\t", psize ); } _mesa_printf("\n--------------------------------------------------------\n" ); } #endif for ( mtype = 0 ; mtype < 7 ; mtype++ ) { for ( psize = 1 ; psize <= 4 ; psize++ ) { transform_func func = _mesa_transform_tab[psize][mtypes[mtype]]; unsigned long *cycles = &(benchmark_tab[psize-1][mtype]); if ( test_transform_function( func, psize, mtype, cycles ) == 0 ) { char buf[100]; _mesa_sprintf(buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", psize, mstrings[mtype], description ); _mesa_problem( NULL, buf ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) _mesa_printf(" %li\t", benchmark_tab[psize-1][mtype] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) _mesa_printf(" | [%s]\n", mstrings[mtype] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) _mesa_printf( "\n" ); #endif } #endif /* DEBUG */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_dotprod_tmp.h0000644000000000000000000000610413614532424021167 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * New (3.1) transformation code written by Keith Whitwell. */ /* Note - respects the stride of the output vector. */ static void TAG(dotprod_vec2)( GLfloat *out, GLuint outstride, const GLvector4f *coord_vec, const GLfloat plane[4] ) { GLuint stride = coord_vec->stride; GLfloat *coord = coord_vec->start; GLuint count = coord_vec->count; GLuint i; const GLfloat plane0 = plane[0], plane1 = plane[1], plane3 = plane[3]; for (i=0;istride; GLfloat *coord = coord_vec->start; GLuint count = coord_vec->count; GLuint i; const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2]; const GLfloat plane3 = plane[3]; for (i=0;istride; GLfloat *coord = coord_vec->start; GLuint count = coord_vec->count; GLuint i; const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2]; const GLfloat plane3 = plane[3]; for (i=0;i= 2) { bincoeff = (GLfloat) (order - 1); s = 1.0F - t; for (k = 0; k < dim; k++) out[k] = s * cp[k] + bincoeff * t * cp[dim + k]; for (i = 2, cp += 2 * dim, powert = t * t; i < order; i++, powert *= t, cp += dim) { bincoeff *= (GLfloat) (order - i); bincoeff *= inv_tab[i]; for (k = 0; k < dim; k++) out[k] = s * out[k] + bincoeff * powert * cp[k]; } } else { /* order=1 -> constant curve */ for (k = 0; k < dim; k++) out[k] = cp[k]; } } /* * Tensor product Bezier surfaces * * Again the Horner scheme is used to compute a point on a * TP Bezier surface. First a control polygon for a curve * on the surface in one parameter direction is computed, * then the point on the curve for the other parameter * direction is evaluated. * * To store the curve control polygon additional storage * for max(uorder,vorder) points is needed in the * control net cn. */ void _math_horner_bezier_surf(GLfloat * cn, GLfloat * out, GLfloat u, GLfloat v, GLuint dim, GLuint uorder, GLuint vorder) { GLfloat *cp = cn + uorder * vorder * dim; GLuint i, uinc = vorder * dim; if (vorder > uorder) { if (uorder >= 2) { GLfloat s, poweru, bincoeff; GLuint j, k; /* Compute the control polygon for the surface-curve in u-direction */ for (j = 0; j < vorder; j++) { GLfloat *ucp = &cn[j * dim]; /* Each control point is the point for parameter u on a */ /* curve defined by the control polygons in u-direction */ bincoeff = (GLfloat) (uorder - 1); s = 1.0F - u; for (k = 0; k < dim; k++) cp[j * dim + k] = s * ucp[k] + bincoeff * u * ucp[uinc + k]; for (i = 2, ucp += 2 * uinc, poweru = u * u; i < uorder; i++, poweru *= u, ucp += uinc) { bincoeff *= (GLfloat) (uorder - i); bincoeff *= inv_tab[i]; for (k = 0; k < dim; k++) cp[j * dim + k] = s * cp[j * dim + k] + bincoeff * poweru * ucp[k]; } } /* Evaluate curve point in v */ _math_horner_bezier_curve(cp, out, v, dim, vorder); } else /* uorder=1 -> cn defines a curve in v */ _math_horner_bezier_curve(cn, out, v, dim, vorder); } else { /* vorder <= uorder */ if (vorder > 1) { GLuint i; /* Compute the control polygon for the surface-curve in u-direction */ for (i = 0; i < uorder; i++, cn += uinc) { /* For constant i all cn[i][j] (j=0..vorder) are located */ /* on consecutive memory locations, so we can use */ /* horner_bezier_curve to compute the control points */ _math_horner_bezier_curve(cn, &cp[i * dim], v, dim, vorder); } /* Evaluate curve point in u */ _math_horner_bezier_curve(cp, out, u, dim, uorder); } else /* vorder=1 -> cn defines a curve in u */ _math_horner_bezier_curve(cn, out, u, dim, uorder); } } /* * The direct de Casteljau algorithm is used when a point on the * surface and the tangent directions spanning the tangent plane * should be computed (this is needed to compute normals to the * surface). In this case the de Casteljau algorithm approach is * nicer because a point and the partial derivatives can be computed * at the same time. To get the correct tangent length du and dv * must be multiplied with the (u2-u1)/uorder-1 and (v2-v1)/vorder-1. * Since only the directions are needed, this scaling step is omitted. * * De Casteljau needs additional storage for uorder*vorder * values in the control net cn. */ void _math_de_casteljau_surf(GLfloat * cn, GLfloat * out, GLfloat * du, GLfloat * dv, GLfloat u, GLfloat v, GLuint dim, GLuint uorder, GLuint vorder) { GLfloat *dcn = cn + uorder * vorder * dim; GLfloat us = 1.0F - u, vs = 1.0F - v; GLuint h, i, j, k; GLuint minorder = uorder < vorder ? uorder : vorder; GLuint uinc = vorder * dim; GLuint dcuinc = vorder; /* Each component is evaluated separately to save buffer space */ /* This does not drasticaly decrease the performance of the */ /* algorithm. If additional storage for (uorder-1)*(vorder-1) */ /* points would be available, the components could be accessed */ /* in the innermost loop which could lead to less cache misses. */ #define CN(I,J,K) cn[(I)*uinc+(J)*dim+(K)] #define DCN(I, J) dcn[(I)*dcuinc+(J)] if (minorder < 3) { if (uorder == vorder) { for (k = 0; k < dim; k++) { /* Derivative direction in u */ du[k] = vs * (CN(1, 0, k) - CN(0, 0, k)) + v * (CN(1, 1, k) - CN(0, 1, k)); /* Derivative direction in v */ dv[k] = us * (CN(0, 1, k) - CN(0, 0, k)) + u * (CN(1, 1, k) - CN(1, 0, k)); /* bilinear de Casteljau step */ out[k] = us * (vs * CN(0, 0, k) + v * CN(0, 1, k)) + u * (vs * CN(1, 0, k) + v * CN(1, 1, k)); } } else if (minorder == uorder) { for (k = 0; k < dim; k++) { /* bilinear de Casteljau step */ DCN(1, 0) = CN(1, 0, k) - CN(0, 0, k); DCN(0, 0) = us * CN(0, 0, k) + u * CN(1, 0, k); for (j = 0; j < vorder - 1; j++) { /* for the derivative in u */ DCN(1, j + 1) = CN(1, j + 1, k) - CN(0, j + 1, k); DCN(1, j) = vs * DCN(1, j) + v * DCN(1, j + 1); /* for the `point' */ DCN(0, j + 1) = us * CN(0, j + 1, k) + u * CN(1, j + 1, k); DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1); } /* remaining linear de Casteljau steps until the second last step */ for (h = minorder; h < vorder - 1; h++) for (j = 0; j < vorder - h; j++) { /* for the derivative in u */ DCN(1, j) = vs * DCN(1, j) + v * DCN(1, j + 1); /* for the `point' */ DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1); } /* derivative direction in v */ dv[k] = DCN(0, 1) - DCN(0, 0); /* derivative direction in u */ du[k] = vs * DCN(1, 0) + v * DCN(1, 1); /* last linear de Casteljau step */ out[k] = vs * DCN(0, 0) + v * DCN(0, 1); } } else { /* minorder == vorder */ for (k = 0; k < dim; k++) { /* bilinear de Casteljau step */ DCN(0, 1) = CN(0, 1, k) - CN(0, 0, k); DCN(0, 0) = vs * CN(0, 0, k) + v * CN(0, 1, k); for (i = 0; i < uorder - 1; i++) { /* for the derivative in v */ DCN(i + 1, 1) = CN(i + 1, 1, k) - CN(i + 1, 0, k); DCN(i, 1) = us * DCN(i, 1) + u * DCN(i + 1, 1); /* for the `point' */ DCN(i + 1, 0) = vs * CN(i + 1, 0, k) + v * CN(i + 1, 1, k); DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); } /* remaining linear de Casteljau steps until the second last step */ for (h = minorder; h < uorder - 1; h++) for (i = 0; i < uorder - h; i++) { /* for the derivative in v */ DCN(i, 1) = us * DCN(i, 1) + u * DCN(i + 1, 1); /* for the `point' */ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); } /* derivative direction in u */ du[k] = DCN(1, 0) - DCN(0, 0); /* derivative direction in v */ dv[k] = us * DCN(0, 1) + u * DCN(1, 1); /* last linear de Casteljau step */ out[k] = us * DCN(0, 0) + u * DCN(1, 0); } } } else if (uorder == vorder) { for (k = 0; k < dim; k++) { /* first bilinear de Casteljau step */ for (i = 0; i < uorder - 1; i++) { DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k); for (j = 0; j < vorder - 1; j++) { DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k); DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); } } /* remaining bilinear de Casteljau steps until the second last step */ for (h = 2; h < minorder - 1; h++) for (i = 0; i < uorder - h; i++) { DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); for (j = 0; j < vorder - h; j++) { DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1); DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); } } /* derivative direction in u */ du[k] = vs * (DCN(1, 0) - DCN(0, 0)) + v * (DCN(1, 1) - DCN(0, 1)); /* derivative direction in v */ dv[k] = us * (DCN(0, 1) - DCN(0, 0)) + u * (DCN(1, 1) - DCN(1, 0)); /* last bilinear de Casteljau step */ out[k] = us * (vs * DCN(0, 0) + v * DCN(0, 1)) + u * (vs * DCN(1, 0) + v * DCN(1, 1)); } } else if (minorder == uorder) { for (k = 0; k < dim; k++) { /* first bilinear de Casteljau step */ for (i = 0; i < uorder - 1; i++) { DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k); for (j = 0; j < vorder - 1; j++) { DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k); DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); } } /* remaining bilinear de Casteljau steps until the second last step */ for (h = 2; h < minorder - 1; h++) for (i = 0; i < uorder - h; i++) { DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); for (j = 0; j < vorder - h; j++) { DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1); DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); } } /* last bilinear de Casteljau step */ DCN(2, 0) = DCN(1, 0) - DCN(0, 0); DCN(0, 0) = us * DCN(0, 0) + u * DCN(1, 0); for (j = 0; j < vorder - 1; j++) { /* for the derivative in u */ DCN(2, j + 1) = DCN(1, j + 1) - DCN(0, j + 1); DCN(2, j) = vs * DCN(2, j) + v * DCN(2, j + 1); /* for the `point' */ DCN(0, j + 1) = us * DCN(0, j + 1) + u * DCN(1, j + 1); DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1); } /* remaining linear de Casteljau steps until the second last step */ for (h = minorder; h < vorder - 1; h++) for (j = 0; j < vorder - h; j++) { /* for the derivative in u */ DCN(2, j) = vs * DCN(2, j) + v * DCN(2, j + 1); /* for the `point' */ DCN(0, j) = vs * DCN(0, j) + v * DCN(0, j + 1); } /* derivative direction in v */ dv[k] = DCN(0, 1) - DCN(0, 0); /* derivative direction in u */ du[k] = vs * DCN(2, 0) + v * DCN(2, 1); /* last linear de Casteljau step */ out[k] = vs * DCN(0, 0) + v * DCN(0, 1); } } else { /* minorder == vorder */ for (k = 0; k < dim; k++) { /* first bilinear de Casteljau step */ for (i = 0; i < uorder - 1; i++) { DCN(i, 0) = us * CN(i, 0, k) + u * CN(i + 1, 0, k); for (j = 0; j < vorder - 1; j++) { DCN(i, j + 1) = us * CN(i, j + 1, k) + u * CN(i + 1, j + 1, k); DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); } } /* remaining bilinear de Casteljau steps until the second last step */ for (h = 2; h < minorder - 1; h++) for (i = 0; i < uorder - h; i++) { DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); for (j = 0; j < vorder - h; j++) { DCN(i, j + 1) = us * DCN(i, j + 1) + u * DCN(i + 1, j + 1); DCN(i, j) = vs * DCN(i, j) + v * DCN(i, j + 1); } } /* last bilinear de Casteljau step */ DCN(0, 2) = DCN(0, 1) - DCN(0, 0); DCN(0, 0) = vs * DCN(0, 0) + v * DCN(0, 1); for (i = 0; i < uorder - 1; i++) { /* for the derivative in v */ DCN(i + 1, 2) = DCN(i + 1, 1) - DCN(i + 1, 0); DCN(i, 2) = us * DCN(i, 2) + u * DCN(i + 1, 2); /* for the `point' */ DCN(i + 1, 0) = vs * DCN(i + 1, 0) + v * DCN(i + 1, 1); DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); } /* remaining linear de Casteljau steps until the second last step */ for (h = minorder; h < uorder - 1; h++) for (i = 0; i < uorder - h; i++) { /* for the derivative in v */ DCN(i, 2) = us * DCN(i, 2) + u * DCN(i + 1, 2); /* for the `point' */ DCN(i, 0) = us * DCN(i, 0) + u * DCN(i + 1, 0); } /* derivative direction in u */ du[k] = DCN(1, 0) - DCN(0, 0); /* derivative direction in v */ dv[k] = us * DCN(0, 2) + u * DCN(1, 2); /* last linear de Casteljau step */ out[k] = us * DCN(0, 0) + u * DCN(1, 0); } } #undef DCN #undef CN } /* * Do one-time initialization for evaluators. */ void _math_init_eval(void) { GLuint i; /* KW: precompute 1/x for useful x. */ for (i = 1; i < MAX_EVAL_ORDER; i++) inv_tab[i] = 1.0F / i; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_eval.h0000644000000000000000000000676313614532424017576 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _M_EVAL_H #define _M_EVAL_H #include "glheader.h" void _math_init_eval( void ); /* * Horner scheme for Bezier curves * * Bezier curves can be computed via a Horner scheme. * Horner is numerically less stable than the de Casteljau * algorithm, but it is faster. For curves of degree n * the complexity of Horner is O(n) and de Casteljau is O(n^2). * Since stability is not important for displaying curve * points I decided to use the Horner scheme. * * A cubic Bezier curve with control points b0, b1, b2, b3 can be * written as * * (([3] [3] ) [3] ) [3] * c(t) = (([0]*s*b0 + [1]*t*b1)*s + [2]*t^2*b2)*s + [3]*t^2*b3 * * [n] * where s=1-t and the binomial coefficients [i]. These can * be computed iteratively using the identity: * * [n] [n ] [n] * [i] = (n-i+1)/i * [i-1] and [0] = 1 */ void _math_horner_bezier_curve(const GLfloat *cp, GLfloat *out, GLfloat t, GLuint dim, GLuint order); /* * Tensor product Bezier surfaces * * Again the Horner scheme is used to compute a point on a * TP Bezier surface. First a control polygon for a curve * on the surface in one parameter direction is computed, * then the point on the curve for the other parameter * direction is evaluated. * * To store the curve control polygon additional storage * for max(uorder,vorder) points is needed in the * control net cn. */ void _math_horner_bezier_surf(GLfloat *cn, GLfloat *out, GLfloat u, GLfloat v, GLuint dim, GLuint uorder, GLuint vorder); /* * The direct de Casteljau algorithm is used when a point on the * surface and the tangent directions spanning the tangent plane * should be computed (this is needed to compute normals to the * surface). In this case the de Casteljau algorithm approach is * nicer because a point and the partial derivatives can be computed * at the same time. To get the correct tangent length du and dv * must be multiplied with the (u2-u1)/uorder-1 and (v2-v1)/vorder-1. * Since only the directions are needed, this scaling step is omitted. * * De Casteljau needs additional storage for uorder*vorder * values in the control net cn. */ void _math_de_casteljau_surf(GLfloat *cn, GLfloat *out, GLfloat *du, GLfloat *dv, GLfloat u, GLfloat v, GLuint dim, GLuint uorder, GLuint vorder); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_matrix.c0000644000000000000000000013122713614532424020140 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file m_matrix.c * Matrix operations. * * \note * -# 4x4 transformation matrices are stored in memory in column major order. * -# Points/vertices are to be thought of as column vectors. * -# Transformation of a point p by a matrix M is: p' = M * p */ #include "glheader.h" #include "imports.h" #include "macros.h" #include "imports.h" #include "m_matrix.h" /** * \defgroup MatFlags MAT_FLAG_XXX-flags * * Bitmasks to indicate different kinds of 4x4 matrices in GLmatrix::flags * It would be nice to make all these flags private to m_matrix.c */ /*@{*/ #define MAT_FLAG_IDENTITY 0 /**< is an identity matrix flag. * (Not actually used - the identity * matrix is identified by the absense * of all other flags.) */ #define MAT_FLAG_GENERAL 0x1 /**< is a general matrix flag */ #define MAT_FLAG_ROTATION 0x2 /**< is a rotation matrix flag */ #define MAT_FLAG_TRANSLATION 0x4 /**< is a translation matrix flag */ #define MAT_FLAG_UNIFORM_SCALE 0x8 /**< is an uniform scaling matrix flag */ #define MAT_FLAG_GENERAL_SCALE 0x10 /**< is a general scaling matrix flag */ #define MAT_FLAG_GENERAL_3D 0x20 /**< general 3D matrix flag */ #define MAT_FLAG_PERSPECTIVE 0x40 /**< is a perspective proj matrix flag */ #define MAT_FLAG_SINGULAR 0x80 /**< is a singular matrix flag */ #define MAT_DIRTY_TYPE 0x100 /**< matrix type is dirty */ #define MAT_DIRTY_FLAGS 0x200 /**< matrix flags are dirty */ #define MAT_DIRTY_INVERSE 0x400 /**< matrix inverse is dirty */ /** angle preserving matrix flags mask */ #define MAT_FLAGS_ANGLE_PRESERVING (MAT_FLAG_ROTATION | \ MAT_FLAG_TRANSLATION | \ MAT_FLAG_UNIFORM_SCALE) /** geometry related matrix flags mask */ #define MAT_FLAGS_GEOMETRY (MAT_FLAG_GENERAL | \ MAT_FLAG_ROTATION | \ MAT_FLAG_TRANSLATION | \ MAT_FLAG_UNIFORM_SCALE | \ MAT_FLAG_GENERAL_SCALE | \ MAT_FLAG_GENERAL_3D | \ MAT_FLAG_PERSPECTIVE | \ MAT_FLAG_SINGULAR) /** length preserving matrix flags mask */ #define MAT_FLAGS_LENGTH_PRESERVING (MAT_FLAG_ROTATION | \ MAT_FLAG_TRANSLATION) /** 3D (non-perspective) matrix flags mask */ #define MAT_FLAGS_3D (MAT_FLAG_ROTATION | \ MAT_FLAG_TRANSLATION | \ MAT_FLAG_UNIFORM_SCALE | \ MAT_FLAG_GENERAL_SCALE | \ MAT_FLAG_GENERAL_3D) /** dirty matrix flags mask */ #define MAT_DIRTY (MAT_DIRTY_TYPE | \ MAT_DIRTY_FLAGS | \ MAT_DIRTY_INVERSE) /*@}*/ /** * Test geometry related matrix flags. * * \param mat a pointer to a GLmatrix structure. * \param a flags mask. * * \returns non-zero if all geometry related matrix flags are contained within * the mask, or zero otherwise. */ #define TEST_MAT_FLAGS(mat, a) \ ((MAT_FLAGS_GEOMETRY & (~(a)) & ((mat)->flags) ) == 0) /** * Names of the corresponding GLmatrixtype values. */ static const char *types[] = { "MATRIX_GENERAL", "MATRIX_IDENTITY", "MATRIX_3D_NO_ROT", "MATRIX_PERSPECTIVE", "MATRIX_2D", "MATRIX_2D_NO_ROT", "MATRIX_3D" }; /** * Identity matrix. */ static GLfloat Identity[16] = { 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 }; /**********************************************************************/ /** \name Matrix multiplication */ /*@{*/ #define A(row,col) a[(col<<2)+row] #define B(row,col) b[(col<<2)+row] #define P(row,col) product[(col<<2)+row] /** * Perform a full 4x4 matrix multiplication. * * \param a matrix. * \param b matrix. * \param product will receive the product of \p a and \p b. * * \warning Is assumed that \p product != \p b. \p product == \p a is allowed. * * \note KW: 4*16 = 64 multiplications * * \author This \c matmul was contributed by Thomas Malik */ static void matmul4( GLfloat *product, const GLfloat *a, const GLfloat *b ) { GLint i; for (i = 0; i < 4; i++) { const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3); P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0); P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1); P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2); P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3); } } /** * Multiply two matrices known to occupy only the top three rows, such * as typical model matrices, and orthogonal matrices. * * \param a matrix. * \param b matrix. * \param product will receive the product of \p a and \p b. */ static void matmul34( GLfloat *product, const GLfloat *a, const GLfloat *b ) { GLint i; for (i = 0; i < 3; i++) { const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3); P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0); P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1); P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2); P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3; } P(3,0) = 0; P(3,1) = 0; P(3,2) = 0; P(3,3) = 1; } #undef A #undef B #undef P /** * Multiply a matrix by an array of floats with known properties. * * \param mat pointer to a GLmatrix structure containing the left multiplication * matrix, and that will receive the product result. * \param m right multiplication matrix array. * \param flags flags of the matrix \p m. * * Joins both flags and marks the type and inverse as dirty. Calls matmul34() * if both matrices are 3D, or matmul4() otherwise. */ static void matrix_multf( GLmatrix *mat, const GLfloat *m, GLuint flags ) { mat->flags |= (flags | MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE); if (TEST_MAT_FLAGS(mat, MAT_FLAGS_3D)) matmul34( mat->m, mat->m, m ); else matmul4( mat->m, mat->m, m ); } /** * Matrix multiplication. * * \param dest destination matrix. * \param a left matrix. * \param b right matrix. * * Joins both flags and marks the type and inverse as dirty. Calls matmul34() * if both matrices are 3D, or matmul4() otherwise. */ void _math_matrix_mul_matrix( GLmatrix *dest, const GLmatrix *a, const GLmatrix *b ) { dest->flags = (a->flags | b->flags | MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE); if (TEST_MAT_FLAGS(dest, MAT_FLAGS_3D)) matmul34( dest->m, a->m, b->m ); else matmul4( dest->m, a->m, b->m ); } /** * Matrix multiplication. * * \param dest left and destination matrix. * \param m right matrix array. * * Marks the matrix flags with general flag, and type and inverse dirty flags. * Calls matmul4() for the multiplication. */ void _math_matrix_mul_floats( GLmatrix *dest, const GLfloat *m ) { dest->flags |= (MAT_FLAG_GENERAL | MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE | MAT_DIRTY_FLAGS); matmul4( dest->m, dest->m, m ); } /*@}*/ /**********************************************************************/ /** \name Matrix output */ /*@{*/ /** * Print a matrix array. * * \param m matrix array. * * Called by _math_matrix_print() to print a matrix or its inverse. */ static void print_matrix_floats( const GLfloat m[16] ) { int i; for (i=0;i<4;i++) { _mesa_debug(NULL,"\t%f %f %f %f\n", m[i], m[4+i], m[8+i], m[12+i] ); } } /** * Dumps the contents of a GLmatrix structure. * * \param m pointer to the GLmatrix structure. */ void _math_matrix_print( const GLmatrix *m ) { _mesa_debug(NULL, "Matrix type: %s, flags: %x\n", types[m->type], m->flags); print_matrix_floats(m->m); _mesa_debug(NULL, "Inverse: \n"); if (m->inv) { GLfloat prod[16]; print_matrix_floats(m->inv); matmul4(prod, m->m, m->inv); _mesa_debug(NULL, "Mat * Inverse:\n"); print_matrix_floats(prod); } else { _mesa_debug(NULL, " - not available\n"); } } /*@}*/ /** * References an element of 4x4 matrix. * * \param m matrix array. * \param c column of the desired element. * \param r row of the desired element. * * \return value of the desired element. * * Calculate the linear storage index of the element and references it. */ #define MAT(m,r,c) (m)[(c)*4+(r)] /**********************************************************************/ /** \name Matrix inversion */ /*@{*/ /** * Swaps the values of two floating pointer variables. * * Used by invert_matrix_general() to swap the row pointers. */ #define SWAP_ROWS(a, b) { GLfloat *_tmp = a; (a)=(b); (b)=_tmp; } /** * Compute inverse of 4x4 transformation matrix. * * \param mat pointer to a GLmatrix structure. The matrix inverse will be * stored in the GLmatrix::inv attribute. * * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). * * \author * Code contributed by Jacques Leroy jle@star.be * * Calculates the inverse matrix by performing the gaussian matrix reduction * with partial pivoting followed by back/substitution with the loops manually * unrolled. */ static GLboolean invert_matrix_general( GLmatrix *mat ) { const GLfloat *m = mat->m; GLfloat *out = mat->inv; GLfloat wtmp[4][8]; GLfloat m0, m1, m2, m3, s; GLfloat *r0, *r1, *r2, *r3; r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3]; r0[0] = MAT(m,0,0), r0[1] = MAT(m,0,1), r0[2] = MAT(m,0,2), r0[3] = MAT(m,0,3), r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0, r1[0] = MAT(m,1,0), r1[1] = MAT(m,1,1), r1[2] = MAT(m,1,2), r1[3] = MAT(m,1,3), r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0, r2[0] = MAT(m,2,0), r2[1] = MAT(m,2,1), r2[2] = MAT(m,2,2), r2[3] = MAT(m,2,3), r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0, r3[0] = MAT(m,3,0), r3[1] = MAT(m,3,1), r3[2] = MAT(m,3,2), r3[3] = MAT(m,3,3), r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0; /* choose pivot - or die */ if (fabs(r3[0])>fabs(r2[0])) SWAP_ROWS(r3, r2); if (fabs(r2[0])>fabs(r1[0])) SWAP_ROWS(r2, r1); if (fabs(r1[0])>fabs(r0[0])) SWAP_ROWS(r1, r0); if (0.0 == r0[0]) return GL_FALSE; /* eliminate first variable */ m1 = r1[0]/r0[0]; m2 = r2[0]/r0[0]; m3 = r3[0]/r0[0]; s = r0[1]; r1[1] -= m1 * s; r2[1] -= m2 * s; r3[1] -= m3 * s; s = r0[2]; r1[2] -= m1 * s; r2[2] -= m2 * s; r3[2] -= m3 * s; s = r0[3]; r1[3] -= m1 * s; r2[3] -= m2 * s; r3[3] -= m3 * s; s = r0[4]; if (s != 0.0) { r1[4] -= m1 * s; r2[4] -= m2 * s; r3[4] -= m3 * s; } s = r0[5]; if (s != 0.0) { r1[5] -= m1 * s; r2[5] -= m2 * s; r3[5] -= m3 * s; } s = r0[6]; if (s != 0.0) { r1[6] -= m1 * s; r2[6] -= m2 * s; r3[6] -= m3 * s; } s = r0[7]; if (s != 0.0) { r1[7] -= m1 * s; r2[7] -= m2 * s; r3[7] -= m3 * s; } /* choose pivot - or die */ if (fabs(r3[1])>fabs(r2[1])) SWAP_ROWS(r3, r2); if (fabs(r2[1])>fabs(r1[1])) SWAP_ROWS(r2, r1); if (0.0 == r1[1]) return GL_FALSE; /* eliminate second variable */ m2 = r2[1]/r1[1]; m3 = r3[1]/r1[1]; r2[2] -= m2 * r1[2]; r3[2] -= m3 * r1[2]; r2[3] -= m2 * r1[3]; r3[3] -= m3 * r1[3]; s = r1[4]; if (0.0 != s) { r2[4] -= m2 * s; r3[4] -= m3 * s; } s = r1[5]; if (0.0 != s) { r2[5] -= m2 * s; r3[5] -= m3 * s; } s = r1[6]; if (0.0 != s) { r2[6] -= m2 * s; r3[6] -= m3 * s; } s = r1[7]; if (0.0 != s) { r2[7] -= m2 * s; r3[7] -= m3 * s; } /* choose pivot - or die */ if (fabs(r3[2])>fabs(r2[2])) SWAP_ROWS(r3, r2); if (0.0 == r2[2]) return GL_FALSE; /* eliminate third variable */ m3 = r3[2]/r2[2]; r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4], r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6], r3[7] -= m3 * r2[7]; /* last check */ if (0.0 == r3[3]) return GL_FALSE; s = 1.0F/r3[3]; /* now back substitute row 3 */ r3[4] *= s; r3[5] *= s; r3[6] *= s; r3[7] *= s; m2 = r2[3]; /* now back substitute row 2 */ s = 1.0F/r2[2]; r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2), r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2); m1 = r1[3]; r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1, r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1; m0 = r0[3]; r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0, r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0; m1 = r1[2]; /* now back substitute row 1 */ s = 1.0F/r1[1]; r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1), r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1); m0 = r0[2]; r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0, r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0; m0 = r0[1]; /* now back substitute row 0 */ s = 1.0F/r0[0]; r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0), r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0); MAT(out,0,0) = r0[4]; MAT(out,0,1) = r0[5], MAT(out,0,2) = r0[6]; MAT(out,0,3) = r0[7], MAT(out,1,0) = r1[4]; MAT(out,1,1) = r1[5], MAT(out,1,2) = r1[6]; MAT(out,1,3) = r1[7], MAT(out,2,0) = r2[4]; MAT(out,2,1) = r2[5], MAT(out,2,2) = r2[6]; MAT(out,2,3) = r2[7], MAT(out,3,0) = r3[4]; MAT(out,3,1) = r3[5], MAT(out,3,2) = r3[6]; MAT(out,3,3) = r3[7]; return GL_TRUE; } #undef SWAP_ROWS /** * Compute inverse of a general 3d transformation matrix. * * \param mat pointer to a GLmatrix structure. The matrix inverse will be * stored in the GLmatrix::inv attribute. * * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). * * \author Adapted from graphics gems II. * * Calculates the inverse of the upper left by first calculating its * determinant and multiplying it to the symmetric adjust matrix of each * element. Finally deals with the translation part by transforming the * original translation vector using by the calculated submatrix inverse. */ static GLboolean invert_matrix_3d_general( GLmatrix *mat ) { const GLfloat *in = mat->m; GLfloat *out = mat->inv; GLfloat pos, neg, t; GLfloat det; /* Calculate the determinant of upper left 3x3 submatrix and * determine if the matrix is singular. */ pos = neg = 0.0; t = MAT(in,0,0) * MAT(in,1,1) * MAT(in,2,2); if (t >= 0.0) pos += t; else neg += t; t = MAT(in,1,0) * MAT(in,2,1) * MAT(in,0,2); if (t >= 0.0) pos += t; else neg += t; t = MAT(in,2,0) * MAT(in,0,1) * MAT(in,1,2); if (t >= 0.0) pos += t; else neg += t; t = -MAT(in,2,0) * MAT(in,1,1) * MAT(in,0,2); if (t >= 0.0) pos += t; else neg += t; t = -MAT(in,1,0) * MAT(in,0,1) * MAT(in,2,2); if (t >= 0.0) pos += t; else neg += t; t = -MAT(in,0,0) * MAT(in,2,1) * MAT(in,1,2); if (t >= 0.0) pos += t; else neg += t; det = pos + neg; if (det*det < 1e-25) return GL_FALSE; det = 1.0F / det; MAT(out,0,0) = ( (MAT(in,1,1)*MAT(in,2,2) - MAT(in,2,1)*MAT(in,1,2) )*det); MAT(out,0,1) = (- (MAT(in,0,1)*MAT(in,2,2) - MAT(in,2,1)*MAT(in,0,2) )*det); MAT(out,0,2) = ( (MAT(in,0,1)*MAT(in,1,2) - MAT(in,1,1)*MAT(in,0,2) )*det); MAT(out,1,0) = (- (MAT(in,1,0)*MAT(in,2,2) - MAT(in,2,0)*MAT(in,1,2) )*det); MAT(out,1,1) = ( (MAT(in,0,0)*MAT(in,2,2) - MAT(in,2,0)*MAT(in,0,2) )*det); MAT(out,1,2) = (- (MAT(in,0,0)*MAT(in,1,2) - MAT(in,1,0)*MAT(in,0,2) )*det); MAT(out,2,0) = ( (MAT(in,1,0)*MAT(in,2,1) - MAT(in,2,0)*MAT(in,1,1) )*det); MAT(out,2,1) = (- (MAT(in,0,0)*MAT(in,2,1) - MAT(in,2,0)*MAT(in,0,1) )*det); MAT(out,2,2) = ( (MAT(in,0,0)*MAT(in,1,1) - MAT(in,1,0)*MAT(in,0,1) )*det); /* Do the translation part */ MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0) + MAT(in,1,3) * MAT(out,0,1) + MAT(in,2,3) * MAT(out,0,2) ); MAT(out,1,3) = - (MAT(in,0,3) * MAT(out,1,0) + MAT(in,1,3) * MAT(out,1,1) + MAT(in,2,3) * MAT(out,1,2) ); MAT(out,2,3) = - (MAT(in,0,3) * MAT(out,2,0) + MAT(in,1,3) * MAT(out,2,1) + MAT(in,2,3) * MAT(out,2,2) ); return GL_TRUE; } /** * Compute inverse of a 3d transformation matrix. * * \param mat pointer to a GLmatrix structure. The matrix inverse will be * stored in the GLmatrix::inv attribute. * * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). * * If the matrix is not an angle preserving matrix then calls * invert_matrix_3d_general for the actual calculation. Otherwise calculates * the inverse matrix analyzing and inverting each of the scaling, rotation and * translation parts. */ static GLboolean invert_matrix_3d( GLmatrix *mat ) { const GLfloat *in = mat->m; GLfloat *out = mat->inv; if (!TEST_MAT_FLAGS(mat, MAT_FLAGS_ANGLE_PRESERVING)) { return invert_matrix_3d_general( mat ); } if (mat->flags & MAT_FLAG_UNIFORM_SCALE) { GLfloat scale = (MAT(in,0,0) * MAT(in,0,0) + MAT(in,0,1) * MAT(in,0,1) + MAT(in,0,2) * MAT(in,0,2)); if (scale == 0.0) return GL_FALSE; scale = 1.0F / scale; /* Transpose and scale the 3 by 3 upper-left submatrix. */ MAT(out,0,0) = scale * MAT(in,0,0); MAT(out,1,0) = scale * MAT(in,0,1); MAT(out,2,0) = scale * MAT(in,0,2); MAT(out,0,1) = scale * MAT(in,1,0); MAT(out,1,1) = scale * MAT(in,1,1); MAT(out,2,1) = scale * MAT(in,1,2); MAT(out,0,2) = scale * MAT(in,2,0); MAT(out,1,2) = scale * MAT(in,2,1); MAT(out,2,2) = scale * MAT(in,2,2); } else if (mat->flags & MAT_FLAG_ROTATION) { /* Transpose the 3 by 3 upper-left submatrix. */ MAT(out,0,0) = MAT(in,0,0); MAT(out,1,0) = MAT(in,0,1); MAT(out,2,0) = MAT(in,0,2); MAT(out,0,1) = MAT(in,1,0); MAT(out,1,1) = MAT(in,1,1); MAT(out,2,1) = MAT(in,1,2); MAT(out,0,2) = MAT(in,2,0); MAT(out,1,2) = MAT(in,2,1); MAT(out,2,2) = MAT(in,2,2); } else { /* pure translation */ MEMCPY( out, Identity, sizeof(Identity) ); MAT(out,0,3) = - MAT(in,0,3); MAT(out,1,3) = - MAT(in,1,3); MAT(out,2,3) = - MAT(in,2,3); return GL_TRUE; } if (mat->flags & MAT_FLAG_TRANSLATION) { /* Do the translation part */ MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0) + MAT(in,1,3) * MAT(out,0,1) + MAT(in,2,3) * MAT(out,0,2) ); MAT(out,1,3) = - (MAT(in,0,3) * MAT(out,1,0) + MAT(in,1,3) * MAT(out,1,1) + MAT(in,2,3) * MAT(out,1,2) ); MAT(out,2,3) = - (MAT(in,0,3) * MAT(out,2,0) + MAT(in,1,3) * MAT(out,2,1) + MAT(in,2,3) * MAT(out,2,2) ); } else { MAT(out,0,3) = MAT(out,1,3) = MAT(out,2,3) = 0.0; } return GL_TRUE; } /** * Compute inverse of an identity transformation matrix. * * \param mat pointer to a GLmatrix structure. The matrix inverse will be * stored in the GLmatrix::inv attribute. * * \return always GL_TRUE. * * Simply copies Identity into GLmatrix::inv. */ static GLboolean invert_matrix_identity( GLmatrix *mat ) { MEMCPY( mat->inv, Identity, sizeof(Identity) ); return GL_TRUE; } /** * Compute inverse of a no-rotation 3d transformation matrix. * * \param mat pointer to a GLmatrix structure. The matrix inverse will be * stored in the GLmatrix::inv attribute. * * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). * * Calculates the */ static GLboolean invert_matrix_3d_no_rot( GLmatrix *mat ) { const GLfloat *in = mat->m; GLfloat *out = mat->inv; if (MAT(in,0,0) == 0 || MAT(in,1,1) == 0 || MAT(in,2,2) == 0 ) return GL_FALSE; MEMCPY( out, Identity, 16 * sizeof(GLfloat) ); MAT(out,0,0) = 1.0F / MAT(in,0,0); MAT(out,1,1) = 1.0F / MAT(in,1,1); MAT(out,2,2) = 1.0F / MAT(in,2,2); if (mat->flags & MAT_FLAG_TRANSLATION) { MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0)); MAT(out,1,3) = - (MAT(in,1,3) * MAT(out,1,1)); MAT(out,2,3) = - (MAT(in,2,3) * MAT(out,2,2)); } return GL_TRUE; } /** * Compute inverse of a no-rotation 2d transformation matrix. * * \param mat pointer to a GLmatrix structure. The matrix inverse will be * stored in the GLmatrix::inv attribute. * * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). * * Calculates the inverse matrix by applying the inverse scaling and * translation to the identity matrix. */ static GLboolean invert_matrix_2d_no_rot( GLmatrix *mat ) { const GLfloat *in = mat->m; GLfloat *out = mat->inv; if (MAT(in,0,0) == 0 || MAT(in,1,1) == 0) return GL_FALSE; MEMCPY( out, Identity, 16 * sizeof(GLfloat) ); MAT(out,0,0) = 1.0F / MAT(in,0,0); MAT(out,1,1) = 1.0F / MAT(in,1,1); if (mat->flags & MAT_FLAG_TRANSLATION) { MAT(out,0,3) = - (MAT(in,0,3) * MAT(out,0,0)); MAT(out,1,3) = - (MAT(in,1,3) * MAT(out,1,1)); } return GL_TRUE; } #if 0 /* broken */ static GLboolean invert_matrix_perspective( GLmatrix *mat ) { const GLfloat *in = mat->m; GLfloat *out = mat->inv; if (MAT(in,2,3) == 0) return GL_FALSE; MEMCPY( out, Identity, 16 * sizeof(GLfloat) ); MAT(out,0,0) = 1.0F / MAT(in,0,0); MAT(out,1,1) = 1.0F / MAT(in,1,1); MAT(out,0,3) = MAT(in,0,2); MAT(out,1,3) = MAT(in,1,2); MAT(out,2,2) = 0; MAT(out,2,3) = -1; MAT(out,3,2) = 1.0F / MAT(in,2,3); MAT(out,3,3) = MAT(in,2,2) * MAT(out,3,2); return GL_TRUE; } #endif /** * Matrix inversion function pointer type. */ typedef GLboolean (*inv_mat_func)( GLmatrix *mat ); /** * Table of the matrix inversion functions according to the matrix type. */ static inv_mat_func inv_mat_tab[7] = { invert_matrix_general, invert_matrix_identity, invert_matrix_3d_no_rot, #if 0 /* Don't use this function for now - it fails when the projection matrix * is premultiplied by a translation (ala Chromium's tilesort SPU). */ invert_matrix_perspective, #else invert_matrix_general, #endif invert_matrix_3d, /* lazy! */ invert_matrix_2d_no_rot, invert_matrix_3d }; /** * Compute inverse of a transformation matrix. * * \param mat pointer to a GLmatrix structure. The matrix inverse will be * stored in the GLmatrix::inv attribute. * * \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix). * * Calls the matrix inversion function in inv_mat_tab corresponding to the * given matrix type. In case of failure, updates the MAT_FLAG_SINGULAR flag, * and copies the identity matrix into GLmatrix::inv. */ static GLboolean matrix_invert( GLmatrix *mat ) { if (inv_mat_tab[mat->type](mat)) { mat->flags &= ~MAT_FLAG_SINGULAR; return GL_TRUE; } else { mat->flags |= MAT_FLAG_SINGULAR; MEMCPY( mat->inv, Identity, sizeof(Identity) ); return GL_FALSE; } } /*@}*/ /**********************************************************************/ /** \name Matrix generation */ /*@{*/ /** * Generate a 4x4 transformation matrix from glRotate parameters, and * post-multiply the input matrix by it. * * \author * This function was contributed by Erich Boleyn (erich@uruk.org). * Optimizations contributed by Rudolf Opalla (rudi@khm.de). */ void _math_matrix_rotate( GLmatrix *mat, GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { GLfloat xx, yy, zz, xy, yz, zx, xs, ys, zs, one_c, s, c; GLfloat m[16]; GLboolean optimized; s = (GLfloat) sin( angle * DEG2RAD ); c = (GLfloat) cos( angle * DEG2RAD ); MEMCPY(m, Identity, sizeof(GLfloat)*16); optimized = GL_FALSE; #define M(row,col) m[col*4+row] if (x == 0.0F) { if (y == 0.0F) { if (z != 0.0F) { optimized = GL_TRUE; /* rotate only around z-axis */ M(0,0) = c; M(1,1) = c; if (z < 0.0F) { M(0,1) = s; M(1,0) = -s; } else { M(0,1) = -s; M(1,0) = s; } } } else if (z == 0.0F) { optimized = GL_TRUE; /* rotate only around y-axis */ M(0,0) = c; M(2,2) = c; if (y < 0.0F) { M(0,2) = -s; M(2,0) = s; } else { M(0,2) = s; M(2,0) = -s; } } } else if (y == 0.0F) { if (z == 0.0F) { optimized = GL_TRUE; /* rotate only around x-axis */ M(1,1) = c; M(2,2) = c; if (x < 0.0F) { M(1,2) = s; M(2,1) = -s; } else { M(1,2) = -s; M(2,1) = s; } } } if (!optimized) { const GLfloat mag = SQRTF(x * x + y * y + z * z); if (mag <= 1.0e-4) { /* no rotation, leave mat as-is */ return; } x /= mag; y /= mag; z /= mag; /* * Arbitrary axis rotation matrix. * * This is composed of 5 matrices, Rz, Ry, T, Ry', Rz', multiplied * like so: Rz * Ry * T * Ry' * Rz'. T is the final rotation * (which is about the X-axis), and the two composite transforms * Ry' * Rz' and Rz * Ry are (respectively) the rotations necessary * from the arbitrary axis to the X-axis then back. They are * all elementary rotations. * * Rz' is a rotation about the Z-axis, to bring the axis vector * into the x-z plane. Then Ry' is applied, rotating about the * Y-axis to bring the axis vector parallel with the X-axis. The * rotation about the X-axis is then performed. Ry and Rz are * simply the respective inverse transforms to bring the arbitrary * axis back to it's original orientation. The first transforms * Rz' and Ry' are considered inverses, since the data from the * arbitrary axis gives you info on how to get to it, not how * to get away from it, and an inverse must be applied. * * The basic calculation used is to recognize that the arbitrary * axis vector (x, y, z), since it is of unit length, actually * represents the sines and cosines of the angles to rotate the * X-axis to the same orientation, with theta being the angle about * Z and phi the angle about Y (in the order described above) * as follows: * * cos ( theta ) = x / sqrt ( 1 - z^2 ) * sin ( theta ) = y / sqrt ( 1 - z^2 ) * * cos ( phi ) = sqrt ( 1 - z^2 ) * sin ( phi ) = z * * Note that cos ( phi ) can further be inserted to the above * formulas: * * cos ( theta ) = x / cos ( phi ) * sin ( theta ) = y / sin ( phi ) * * ...etc. Because of those relations and the standard trigonometric * relations, it is pssible to reduce the transforms down to what * is used below. It may be that any primary axis chosen will give the * same results (modulo a sign convention) using thie method. * * Particularly nice is to notice that all divisions that might * have caused trouble when parallel to certain planes or * axis go away with care paid to reducing the expressions. * After checking, it does perform correctly under all cases, since * in all the cases of division where the denominator would have * been zero, the numerator would have been zero as well, giving * the expected result. */ xx = x * x; yy = y * y; zz = z * z; xy = x * y; yz = y * z; zx = z * x; xs = x * s; ys = y * s; zs = z * s; one_c = 1.0F - c; /* We already hold the identity-matrix so we can skip some statements */ M(0,0) = (one_c * xx) + c; M(0,1) = (one_c * xy) - zs; M(0,2) = (one_c * zx) + ys; /* M(0,3) = 0.0F; */ M(1,0) = (one_c * xy) + zs; M(1,1) = (one_c * yy) + c; M(1,2) = (one_c * yz) - xs; /* M(1,3) = 0.0F; */ M(2,0) = (one_c * zx) - ys; M(2,1) = (one_c * yz) + xs; M(2,2) = (one_c * zz) + c; /* M(2,3) = 0.0F; */ /* M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = 0.0F; M(3,3) = 1.0F; */ } #undef M matrix_multf( mat, m, MAT_FLAG_ROTATION ); } /** * Apply a perspective projection matrix. * * \param mat matrix to apply the projection. * \param left left clipping plane coordinate. * \param right right clipping plane coordinate. * \param bottom bottom clipping plane coordinate. * \param top top clipping plane coordinate. * \param nearval distance to the near clipping plane. * \param farval distance to the far clipping plane. * * Creates the projection matrix and multiplies it with \p mat, marking the * MAT_FLAG_PERSPECTIVE flag. */ void _math_matrix_frustum( GLmatrix *mat, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearval, GLfloat farval ) { GLfloat x, y, a, b, c, d; GLfloat m[16]; x = (2.0F*nearval) / (right-left); y = (2.0F*nearval) / (top-bottom); a = (right+left) / (right-left); b = (top+bottom) / (top-bottom); c = -(farval+nearval) / ( farval-nearval); d = -(2.0F*farval*nearval) / (farval-nearval); /* error? */ #define M(row,col) m[col*4+row] M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F; M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F; M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d; M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F; #undef M matrix_multf( mat, m, MAT_FLAG_PERSPECTIVE ); } /** * Apply an orthographic projection matrix. * * \param mat matrix to apply the projection. * \param left left clipping plane coordinate. * \param right right clipping plane coordinate. * \param bottom bottom clipping plane coordinate. * \param top top clipping plane coordinate. * \param nearval distance to the near clipping plane. * \param farval distance to the far clipping plane. * * Creates the projection matrix and multiplies it with \p mat, marking the * MAT_FLAG_GENERAL_SCALE and MAT_FLAG_TRANSLATION flags. */ void _math_matrix_ortho( GLmatrix *mat, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearval, GLfloat farval ) { GLfloat m[16]; #define M(row,col) m[col*4+row] M(0,0) = 2.0F / (right-left); M(0,1) = 0.0F; M(0,2) = 0.0F; M(0,3) = -(right+left) / (right-left); M(1,0) = 0.0F; M(1,1) = 2.0F / (top-bottom); M(1,2) = 0.0F; M(1,3) = -(top+bottom) / (top-bottom); M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = -2.0F / (farval-nearval); M(2,3) = -(farval+nearval) / (farval-nearval); M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = 0.0F; M(3,3) = 1.0F; #undef M matrix_multf( mat, m, (MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION)); } /** * Multiply a matrix with a general scaling matrix. * * \param mat matrix. * \param x x axis scale factor. * \param y y axis scale factor. * \param z z axis scale factor. * * Multiplies in-place the elements of \p mat by the scale factors. Checks if * the scales factors are roughly the same, marking the MAT_FLAG_UNIFORM_SCALE * flag, or MAT_FLAG_GENERAL_SCALE. Marks the MAT_DIRTY_TYPE and * MAT_DIRTY_INVERSE dirty flags. */ void _math_matrix_scale( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ) { GLfloat *m = mat->m; m[0] *= x; m[4] *= y; m[8] *= z; m[1] *= x; m[5] *= y; m[9] *= z; m[2] *= x; m[6] *= y; m[10] *= z; m[3] *= x; m[7] *= y; m[11] *= z; if (fabs(x - y) < 1e-8 && fabs(x - z) < 1e-8) mat->flags |= MAT_FLAG_UNIFORM_SCALE; else mat->flags |= MAT_FLAG_GENERAL_SCALE; mat->flags |= (MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE); } /** * Multiply a matrix with a translation matrix. * * \param mat matrix. * \param x translation vector x coordinate. * \param y translation vector y coordinate. * \param z translation vector z coordinate. * * Adds the translation coordinates to the elements of \p mat in-place. Marks * the MAT_FLAG_TRANSLATION flag, and the MAT_DIRTY_TYPE and MAT_DIRTY_INVERSE * dirty flags. */ void _math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ) { GLfloat *m = mat->m; m[12] = m[0] * x + m[4] * y + m[8] * z + m[12]; m[13] = m[1] * x + m[5] * y + m[9] * z + m[13]; m[14] = m[2] * x + m[6] * y + m[10] * z + m[14]; m[15] = m[3] * x + m[7] * y + m[11] * z + m[15]; mat->flags |= (MAT_FLAG_TRANSLATION | MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE); } /** * Set matrix to do viewport and depthrange mapping. * Transforms Normalized Device Coords to window/Z values. */ void _math_matrix_viewport(GLmatrix *m, GLint x, GLint y, GLint width, GLint height, GLfloat zNear, GLfloat zFar, GLfloat depthMax) { m->m[MAT_SX] = (GLfloat) width / 2.0F; m->m[MAT_TX] = m->m[MAT_SX] + x; m->m[MAT_SY] = (GLfloat) height / 2.0F; m->m[MAT_TY] = m->m[MAT_SY] + y; m->m[MAT_SZ] = depthMax * ((zFar - zNear) / 2.0F); m->m[MAT_TZ] = depthMax * ((zFar - zNear) / 2.0F + zNear); m->flags = MAT_FLAG_GENERAL_SCALE | MAT_FLAG_TRANSLATION; m->type = MATRIX_3D_NO_ROT; } /** * Set a matrix to the identity matrix. * * \param mat matrix. * * Copies ::Identity into \p GLmatrix::m, and into GLmatrix::inv if not NULL. * Sets the matrix type to identity, and clear the dirty flags. */ void _math_matrix_set_identity( GLmatrix *mat ) { MEMCPY( mat->m, Identity, 16*sizeof(GLfloat) ); if (mat->inv) MEMCPY( mat->inv, Identity, 16*sizeof(GLfloat) ); mat->type = MATRIX_IDENTITY; mat->flags &= ~(MAT_DIRTY_FLAGS| MAT_DIRTY_TYPE| MAT_DIRTY_INVERSE); } /*@}*/ /**********************************************************************/ /** \name Matrix analysis */ /*@{*/ #define ZERO(x) (1<m; GLuint mask = 0; GLuint i; for (i = 0 ; i < 16 ; i++) { if (m[i] == 0.0) mask |= (1<flags &= ~MAT_FLAGS_GEOMETRY; /* Check for translation - no-one really cares */ if ((mask & MASK_NO_TRX) != MASK_NO_TRX) mat->flags |= MAT_FLAG_TRANSLATION; /* Do the real work */ if (mask == (GLuint) MASK_IDENTITY) { mat->type = MATRIX_IDENTITY; } else if ((mask & MASK_2D_NO_ROT) == (GLuint) MASK_2D_NO_ROT) { mat->type = MATRIX_2D_NO_ROT; if ((mask & MASK_NO_2D_SCALE) != MASK_NO_2D_SCALE) mat->flags |= MAT_FLAG_GENERAL_SCALE; } else if ((mask & MASK_2D) == (GLuint) MASK_2D) { GLfloat mm = DOT2(m, m); GLfloat m4m4 = DOT2(m+4,m+4); GLfloat mm4 = DOT2(m,m+4); mat->type = MATRIX_2D; /* Check for scale */ if (SQ(mm-1) > SQ(1e-6) || SQ(m4m4-1) > SQ(1e-6)) mat->flags |= MAT_FLAG_GENERAL_SCALE; /* Check for rotation */ if (SQ(mm4) > SQ(1e-6)) mat->flags |= MAT_FLAG_GENERAL_3D; else mat->flags |= MAT_FLAG_ROTATION; } else if ((mask & MASK_3D_NO_ROT) == (GLuint) MASK_3D_NO_ROT) { mat->type = MATRIX_3D_NO_ROT; /* Check for scale */ if (SQ(m[0]-m[5]) < SQ(1e-6) && SQ(m[0]-m[10]) < SQ(1e-6)) { if (SQ(m[0]-1.0) > SQ(1e-6)) { mat->flags |= MAT_FLAG_UNIFORM_SCALE; } } else { mat->flags |= MAT_FLAG_GENERAL_SCALE; } } else if ((mask & MASK_3D) == (GLuint) MASK_3D) { GLfloat c1 = DOT3(m,m); GLfloat c2 = DOT3(m+4,m+4); GLfloat c3 = DOT3(m+8,m+8); GLfloat d1 = DOT3(m, m+4); GLfloat cp[3]; mat->type = MATRIX_3D; /* Check for scale */ if (SQ(c1-c2) < SQ(1e-6) && SQ(c1-c3) < SQ(1e-6)) { if (SQ(c1-1.0) > SQ(1e-6)) mat->flags |= MAT_FLAG_UNIFORM_SCALE; /* else no scale at all */ } else { mat->flags |= MAT_FLAG_GENERAL_SCALE; } /* Check for rotation */ if (SQ(d1) < SQ(1e-6)) { CROSS3( cp, m, m+4 ); SUB_3V( cp, cp, (m+8) ); if (LEN_SQUARED_3FV(cp) < SQ(1e-6)) mat->flags |= MAT_FLAG_ROTATION; else mat->flags |= MAT_FLAG_GENERAL_3D; } else { mat->flags |= MAT_FLAG_GENERAL_3D; /* shear, etc */ } } else if ((mask & MASK_PERSPECTIVE) == MASK_PERSPECTIVE && m[11]==-1.0F) { mat->type = MATRIX_PERSPECTIVE; mat->flags |= MAT_FLAG_GENERAL; } else { mat->type = MATRIX_GENERAL; mat->flags |= MAT_FLAG_GENERAL; } } /** * Analyze a matrix given that its flags are accurate. * * This is the more common operation, hopefully. */ static void analyse_from_flags( GLmatrix *mat ) { const GLfloat *m = mat->m; if (TEST_MAT_FLAGS(mat, 0)) { mat->type = MATRIX_IDENTITY; } else if (TEST_MAT_FLAGS(mat, (MAT_FLAG_TRANSLATION | MAT_FLAG_UNIFORM_SCALE | MAT_FLAG_GENERAL_SCALE))) { if ( m[10]==1.0F && m[14]==0.0F ) { mat->type = MATRIX_2D_NO_ROT; } else { mat->type = MATRIX_3D_NO_ROT; } } else if (TEST_MAT_FLAGS(mat, MAT_FLAGS_3D)) { if ( m[ 8]==0.0F && m[ 9]==0.0F && m[2]==0.0F && m[6]==0.0F && m[10]==1.0F && m[14]==0.0F) { mat->type = MATRIX_2D; } else { mat->type = MATRIX_3D; } } else if ( m[4]==0.0F && m[12]==0.0F && m[1]==0.0F && m[13]==0.0F && m[2]==0.0F && m[6]==0.0F && m[3]==0.0F && m[7]==0.0F && m[11]==-1.0F && m[15]==0.0F) { mat->type = MATRIX_PERSPECTIVE; } else { mat->type = MATRIX_GENERAL; } } /** * Analyze and update a matrix. * * \param mat matrix. * * If the matrix type is dirty then calls either analyse_from_scratch() or * analyse_from_flags() to determine its type, according to whether the flags * are dirty or not, respectively. If the matrix has an inverse and it's dirty * then calls matrix_invert(). Finally clears the dirty flags. */ void _math_matrix_analyse( GLmatrix *mat ) { if (mat->flags & MAT_DIRTY_TYPE) { if (mat->flags & MAT_DIRTY_FLAGS) analyse_from_scratch( mat ); else analyse_from_flags( mat ); } if (mat->inv && (mat->flags & MAT_DIRTY_INVERSE)) { matrix_invert( mat ); } mat->flags &= ~(MAT_DIRTY_FLAGS| MAT_DIRTY_TYPE| MAT_DIRTY_INVERSE); } /*@}*/ /** * Test if the given matrix preserves vector lengths. */ GLboolean _math_matrix_is_length_preserving( const GLmatrix *m ) { return TEST_MAT_FLAGS( m, MAT_FLAGS_LENGTH_PRESERVING); } /** * Test if the given matrix does any rotation. * (or perhaps if the upper-left 3x3 is non-identity) */ GLboolean _math_matrix_has_rotation( const GLmatrix *m ) { if (m->flags & (MAT_FLAG_GENERAL | MAT_FLAG_ROTATION | MAT_FLAG_GENERAL_3D | MAT_FLAG_PERSPECTIVE)) return GL_TRUE; else return GL_FALSE; } GLboolean _math_matrix_is_general_scale( const GLmatrix *m ) { return (m->flags & MAT_FLAG_GENERAL_SCALE) ? GL_TRUE : GL_FALSE; } GLboolean _math_matrix_is_dirty( const GLmatrix *m ) { return (m->flags & MAT_DIRTY) ? GL_TRUE : GL_FALSE; } /**********************************************************************/ /** \name Matrix setup */ /*@{*/ /** * Copy a matrix. * * \param to destination matrix. * \param from source matrix. * * Copies all fields in GLmatrix, creating an inverse array if necessary. */ void _math_matrix_copy( GLmatrix *to, const GLmatrix *from ) { MEMCPY( to->m, from->m, sizeof(Identity) ); to->flags = from->flags; to->type = from->type; if (to->inv != 0) { if (from->inv == 0) { matrix_invert( to ); } else { MEMCPY(to->inv, from->inv, sizeof(GLfloat)*16); } } } /** * Loads a matrix array into GLmatrix. * * \param m matrix array. * \param mat matrix. * * Copies \p m into GLmatrix::m and marks the MAT_FLAG_GENERAL and MAT_DIRTY * flags. */ void _math_matrix_loadf( GLmatrix *mat, const GLfloat *m ) { MEMCPY( mat->m, m, 16*sizeof(GLfloat) ); mat->flags = (MAT_FLAG_GENERAL | MAT_DIRTY); } /** * Matrix constructor. * * \param m matrix. * * Initialize the GLmatrix fields. */ void _math_matrix_ctr( GLmatrix *m ) { m->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); if (m->m) MEMCPY( m->m, Identity, sizeof(Identity) ); m->inv = NULL; m->type = MATRIX_IDENTITY; m->flags = 0; } /** * Matrix destructor. * * \param m matrix. * * Frees the data in a GLmatrix. */ void _math_matrix_dtr( GLmatrix *m ) { if (m->m) { ALIGN_FREE( m->m ); m->m = NULL; } if (m->inv) { ALIGN_FREE( m->inv ); m->inv = NULL; } } /** * Allocate a matrix inverse. * * \param m matrix. * * Allocates the matrix inverse, GLmatrix::inv, and sets it to Identity. */ void _math_matrix_alloc_inv( GLmatrix *m ) { if (!m->inv) { m->inv = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); if (m->inv) MEMCPY( m->inv, Identity, 16 * sizeof(GLfloat) ); } } /*@}*/ /**********************************************************************/ /** \name Matrix transpose */ /*@{*/ /** * Transpose a GLfloat matrix. * * \param to destination array. * \param from source array. */ void _math_transposef( GLfloat to[16], const GLfloat from[16] ) { to[0] = from[0]; to[1] = from[4]; to[2] = from[8]; to[3] = from[12]; to[4] = from[1]; to[5] = from[5]; to[6] = from[9]; to[7] = from[13]; to[8] = from[2]; to[9] = from[6]; to[10] = from[10]; to[11] = from[14]; to[12] = from[3]; to[13] = from[7]; to[14] = from[11]; to[15] = from[15]; } /** * Transpose a GLdouble matrix. * * \param to destination array. * \param from source array. */ void _math_transposed( GLdouble to[16], const GLdouble from[16] ) { to[0] = from[0]; to[1] = from[4]; to[2] = from[8]; to[3] = from[12]; to[4] = from[1]; to[5] = from[5]; to[6] = from[9]; to[7] = from[13]; to[8] = from[2]; to[9] = from[6]; to[10] = from[10]; to[11] = from[14]; to[12] = from[3]; to[13] = from[7]; to[14] = from[11]; to[15] = from[15]; } /** * Transpose a GLdouble matrix and convert to GLfloat. * * \param to destination array. * \param from source array. */ void _math_transposefd( GLfloat to[16], const GLdouble from[16] ) { to[0] = (GLfloat) from[0]; to[1] = (GLfloat) from[4]; to[2] = (GLfloat) from[8]; to[3] = (GLfloat) from[12]; to[4] = (GLfloat) from[1]; to[5] = (GLfloat) from[5]; to[6] = (GLfloat) from[9]; to[7] = (GLfloat) from[13]; to[8] = (GLfloat) from[2]; to[9] = (GLfloat) from[6]; to[10] = (GLfloat) from[10]; to[11] = (GLfloat) from[14]; to[12] = (GLfloat) from[3]; to[13] = (GLfloat) from[7]; to[14] = (GLfloat) from[11]; to[15] = (GLfloat) from[15]; } /*@}*/ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_matrix.h0000644000000000000000000001255613614532424020150 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file math/m_matrix.h * Defines basic structures for matrix-handling. */ #ifndef _M_MATRIX_H #define _M_MATRIX_H /** * \name Symbolic names to some of the entries in the matrix * * These are handy for the viewport mapping, which is expressed as a matrix. */ /*@{*/ #define MAT_SX 0 #define MAT_SY 5 #define MAT_SZ 10 #define MAT_TX 12 #define MAT_TY 13 #define MAT_TZ 14 /*@}*/ /** * Different kinds of 4x4 transformation matrices. * We use these to select specific optimized vertex transformation routines. */ enum GLmatrixtype { MATRIX_GENERAL, /**< general 4x4 matrix */ MATRIX_IDENTITY, /**< identity matrix */ MATRIX_3D_NO_ROT, /**< orthogonal projection and others... */ MATRIX_PERSPECTIVE, /**< perspective projection matrix */ MATRIX_2D, /**< 2-D transformation */ MATRIX_2D_NO_ROT, /**< 2-D scale & translate only */ MATRIX_3D /**< 3-D transformation */ } ; /** * Matrix type to represent 4x4 transformation matrices. */ typedef struct { GLfloat *m; /**< 16 matrix elements (16-byte aligned) */ GLfloat *inv; /**< optional 16-element inverse (16-byte aligned) */ GLuint flags; /**< possible values determined by (of \link * MatFlags MAT_FLAG_* flags\endlink) */ enum GLmatrixtype type; } GLmatrix; extern void _math_matrix_ctr( GLmatrix *m ); extern void _math_matrix_dtr( GLmatrix *m ); extern void _math_matrix_alloc_inv( GLmatrix *m ); extern void _math_matrix_mul_matrix( GLmatrix *dest, const GLmatrix *a, const GLmatrix *b ); extern void _math_matrix_mul_floats( GLmatrix *dest, const GLfloat *b ); extern void _math_matrix_loadf( GLmatrix *mat, const GLfloat *m ); extern void _math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ); extern void _math_matrix_rotate( GLmatrix *m, GLfloat angle, GLfloat x, GLfloat y, GLfloat z ); extern void _math_matrix_scale( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z ); extern void _math_matrix_ortho( GLmatrix *mat, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearval, GLfloat farval ); extern void _math_matrix_frustum( GLmatrix *mat, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearval, GLfloat farval ); extern void _math_matrix_viewport(GLmatrix *m, GLint x, GLint y, GLint width, GLint height, GLfloat zNear, GLfloat zFar, GLfloat depthMax); extern void _math_matrix_set_identity( GLmatrix *dest ); extern void _math_matrix_copy( GLmatrix *to, const GLmatrix *from ); extern void _math_matrix_analyse( GLmatrix *mat ); extern void _math_matrix_print( const GLmatrix *m ); extern GLboolean _math_matrix_is_length_preserving( const GLmatrix *m ); extern GLboolean _math_matrix_has_rotation( const GLmatrix *m ); extern GLboolean _math_matrix_is_general_scale( const GLmatrix *m ); extern GLboolean _math_matrix_is_dirty( const GLmatrix *m ); /** * \name Related functions that don't actually operate on GLmatrix structs */ /*@{*/ extern void _math_transposef( GLfloat to[16], const GLfloat from[16] ); extern void _math_transposed( GLdouble to[16], const GLdouble from[16] ); extern void _math_transposefd( GLfloat to[16], const GLdouble from[16] ); /* * Transform a point (column vector) by a matrix: Q = M * P */ #define TRANSFORM_POINT( Q, M, P ) \ Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12] * P[3]; \ Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13] * P[3]; \ Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14] * P[3]; \ Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15] * P[3]; #define TRANSFORM_POINT3( Q, M, P ) \ Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12]; \ Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13]; \ Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14]; \ Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15]; /* * Transform a normal (row vector) by a matrix: [NX NY NZ] = N * MAT */ #define TRANSFORM_NORMAL( TO, N, MAT ) \ do { \ TO[0] = N[0] * MAT[0] + N[1] * MAT[1] + N[2] * MAT[2]; \ TO[1] = N[0] * MAT[4] + N[1] * MAT[5] + N[2] * MAT[6]; \ TO[2] = N[0] * MAT[8] + N[1] * MAT[9] + N[2] * MAT[10]; \ } while (0) /*@}*/ #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_norm_tmp.h0000644000000000000000000002544013614532424020473 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * New (3.1) transformation code written by Keith Whitwell. */ /* Functions to tranform a vector of normals. This includes applying * the transformation matrix, rescaling and normalization. */ /* * mat - the 4x4 transformation matrix * scale - uniform scale factor of the transformation matrix (not always used) * in - the source vector of normals * lengths - length of each incoming normal (may be NULL) (a display list * optimization) * dest - the destination vector of normals */ static void _XFORMAPI TAG(transform_normalize_normals)( const GLmatrix *mat, GLfloat scale, const GLvector4f *in, const GLfloat *lengths, GLvector4f *dest ) { GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; const GLuint stride = in->stride; const GLuint count = in->count; const GLfloat *m = mat->inv; GLfloat m0 = m[0], m4 = m[4], m8 = m[8]; GLfloat m1 = m[1], m5 = m[5], m9 = m[9]; GLfloat m2 = m[2], m6 = m[6], m10 = m[10]; GLuint i; if (!lengths) { STRIDE_LOOP { GLfloat tx, ty, tz; { const GLfloat ux = from[0], uy = from[1], uz = from[2]; tx = ux * m0 + uy * m1 + uz * m2; ty = ux * m4 + uy * m5 + uz * m6; tz = ux * m8 + uy * m9 + uz * m10; } { GLdouble len = tx*tx + ty*ty + tz*tz; if (len > 1e-20) { GLfloat scale = INV_SQRTF(len); out[i][0] = tx * scale; out[i][1] = ty * scale; out[i][2] = tz * scale; } else { out[i][0] = out[i][1] = out[i][2] = 0; } } } } else { if (scale != 1.0) { m0 *= scale, m4 *= scale, m8 *= scale; m1 *= scale, m5 *= scale, m9 *= scale; m2 *= scale, m6 *= scale, m10 *= scale; } STRIDE_LOOP { GLfloat tx, ty, tz; { const GLfloat ux = from[0], uy = from[1], uz = from[2]; tx = ux * m0 + uy * m1 + uz * m2; ty = ux * m4 + uy * m5 + uz * m6; tz = ux * m8 + uy * m9 + uz * m10; } { GLfloat len = lengths[i]; out[i][0] = tx * len; out[i][1] = ty * len; out[i][2] = tz * len; } } } dest->count = in->count; } static void _XFORMAPI TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat, GLfloat scale, const GLvector4f *in, const GLfloat *lengths, GLvector4f *dest ) { GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; const GLuint stride = in->stride; const GLuint count = in->count; const GLfloat *m = mat->inv; GLfloat m0 = m[0]; GLfloat m5 = m[5]; GLfloat m10 = m[10]; GLuint i; if (!lengths) { STRIDE_LOOP { GLfloat tx, ty, tz; { const GLfloat ux = from[0], uy = from[1], uz = from[2]; tx = ux * m0 ; ty = uy * m5 ; tz = uz * m10; } { GLdouble len = tx*tx + ty*ty + tz*tz; if (len > 1e-20) { GLfloat scale = INV_SQRTF(len); out[i][0] = tx * scale; out[i][1] = ty * scale; out[i][2] = tz * scale; } else { out[i][0] = out[i][1] = out[i][2] = 0; } } } } else { m0 *= scale; m5 *= scale; m10 *= scale; STRIDE_LOOP { GLfloat tx, ty, tz; { const GLfloat ux = from[0], uy = from[1], uz = from[2]; tx = ux * m0 ; ty = uy * m5 ; tz = uz * m10; } { GLfloat len = lengths[i]; out[i][0] = tx * len; out[i][1] = ty * len; out[i][2] = tz * len; } } } dest->count = in->count; } static void _XFORMAPI TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat, GLfloat scale, const GLvector4f *in, const GLfloat *lengths, GLvector4f *dest ) { GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; const GLuint stride = in->stride; const GLuint count = in->count; const GLfloat *m = mat->inv; const GLfloat m0 = scale*m[0]; const GLfloat m5 = scale*m[5]; const GLfloat m10 = scale*m[10]; GLuint i; (void) lengths; STRIDE_LOOP { GLfloat ux = from[0], uy = from[1], uz = from[2]; out[i][0] = ux * m0; out[i][1] = uy * m5; out[i][2] = uz * m10; } dest->count = in->count; } static void _XFORMAPI TAG(transform_rescale_normals)( const GLmatrix *mat, GLfloat scale, const GLvector4f *in, const GLfloat *lengths, GLvector4f *dest ) { GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; const GLuint stride = in->stride; const GLuint count = in->count; /* Since we are unlikely to have < 3 vertices in the buffer, * it makes sense to pre-multiply by scale. */ const GLfloat *m = mat->inv; const GLfloat m0 = scale*m[0], m4 = scale*m[4], m8 = scale*m[8]; const GLfloat m1 = scale*m[1], m5 = scale*m[5], m9 = scale*m[9]; const GLfloat m2 = scale*m[2], m6 = scale*m[6], m10 = scale*m[10]; GLuint i; (void) lengths; STRIDE_LOOP { GLfloat ux = from[0], uy = from[1], uz = from[2]; out[i][0] = ux * m0 + uy * m1 + uz * m2; out[i][1] = ux * m4 + uy * m5 + uz * m6; out[i][2] = ux * m8 + uy * m9 + uz * m10; } dest->count = in->count; } static void _XFORMAPI TAG(transform_normals_no_rot)( const GLmatrix *mat, GLfloat scale, const GLvector4f *in, const GLfloat *lengths, GLvector4f *dest ) { GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; const GLuint stride = in->stride; const GLuint count = in->count; const GLfloat *m = mat->inv; const GLfloat m0 = m[0]; const GLfloat m5 = m[5]; const GLfloat m10 = m[10]; GLuint i; (void) scale; (void) lengths; STRIDE_LOOP { GLfloat ux = from[0], uy = from[1], uz = from[2]; out[i][0] = ux * m0; out[i][1] = uy * m5; out[i][2] = uz * m10; } dest->count = in->count; } static void _XFORMAPI TAG(transform_normals)( const GLmatrix *mat, GLfloat scale, const GLvector4f *in, const GLfloat *lengths, GLvector4f *dest ) { GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; const GLuint stride = in->stride; const GLuint count = in->count; const GLfloat *m = mat->inv; const GLfloat m0 = m[0], m4 = m[4], m8 = m[8]; const GLfloat m1 = m[1], m5 = m[5], m9 = m[9]; const GLfloat m2 = m[2], m6 = m[6], m10 = m[10]; GLuint i; (void) scale; (void) lengths; STRIDE_LOOP { GLfloat ux = from[0], uy = from[1], uz = from[2]; out[i][0] = ux * m0 + uy * m1 + uz * m2; out[i][1] = ux * m4 + uy * m5 + uz * m6; out[i][2] = ux * m8 + uy * m9 + uz * m10; } dest->count = in->count; } static void _XFORMAPI TAG(normalize_normals)( const GLmatrix *mat, GLfloat scale, const GLvector4f *in, const GLfloat *lengths, GLvector4f *dest ) { GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; const GLuint stride = in->stride; const GLuint count = in->count; GLuint i; (void) mat; (void) scale; if (lengths) { STRIDE_LOOP { const GLfloat x = from[0], y = from[1], z = from[2]; GLfloat invlen = lengths[i]; out[i][0] = x * invlen; out[i][1] = y * invlen; out[i][2] = z * invlen; } } else { STRIDE_LOOP { const GLfloat x = from[0], y = from[1], z = from[2]; GLdouble len = x * x + y * y + z * z; if (len > 1e-50) { len = INV_SQRTF(len); out[i][0] = (GLfloat)(x * len); out[i][1] = (GLfloat)(y * len); out[i][2] = (GLfloat)(z * len); } else { out[i][0] = x; out[i][1] = y; out[i][2] = z; } } } dest->count = in->count; } static void _XFORMAPI TAG(rescale_normals)( const GLmatrix *mat, GLfloat scale, const GLvector4f *in, const GLfloat *lengths, GLvector4f *dest ) { GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; const GLuint stride = in->stride; const GLuint count = in->count; GLuint i; (void) mat; (void) lengths; STRIDE_LOOP { SCALE_SCALAR_3V( out[i], scale, from ); } dest->count = in->count; } static void _XFORMAPI TAG(init_c_norm_transform)( void ) { _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = TAG(transform_normals_no_rot); _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = TAG(transform_rescale_normals_no_rot); _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] = TAG(transform_normalize_normals_no_rot); _mesa_normal_tab[NORM_TRANSFORM] = TAG(transform_normals); _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = TAG(transform_rescale_normals); _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] = TAG(transform_normalize_normals); _mesa_normal_tab[NORM_RESCALE] = TAG(rescale_normals); _mesa_normal_tab[NORM_NORMALIZE] = TAG(normalize_normals); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_translate.c0000644000000000000000000004433713614532424020636 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * New (3.1) transformation code written by Keith Whitwell. */ #include "glheader.h" #include "mtypes.h" /* GLchan hack */ #include "colormac.h" #include "m_translate.h" typedef void (*trans_1f_func)(GLfloat *to, CONST void *ptr, GLuint stride, GLuint start, GLuint n ); typedef void (*trans_1ui_func)(GLuint *to, CONST void *ptr, GLuint stride, GLuint start, GLuint n ); typedef void (*trans_1ub_func)(GLubyte *to, CONST void *ptr, GLuint stride, GLuint start, GLuint n ); typedef void (*trans_4ub_func)(GLubyte (*to)[4], CONST void *ptr, GLuint stride, GLuint start, GLuint n ); typedef void (*trans_4us_func)(GLushort (*to)[4], CONST void *ptr, GLuint stride, GLuint start, GLuint n ); typedef void (*trans_4f_func)(GLfloat (*to)[4], CONST void *ptr, GLuint stride, GLuint start, GLuint n ); typedef void (*trans_3f_func)(GLfloat (*to)[3], CONST void *ptr, GLuint stride, GLuint start, GLuint n ); #define TYPE_IDX(t) ((t) & 0xf) #define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */ /* This macro is used on other systems, so undefine it for this module */ #undef CHECK static trans_1f_func _math_trans_1f_tab[MAX_TYPES]; static trans_1ui_func _math_trans_1ui_tab[MAX_TYPES]; static trans_1ub_func _math_trans_1ub_tab[MAX_TYPES]; static trans_3f_func _math_trans_3f_tab[MAX_TYPES]; static trans_4ub_func _math_trans_4ub_tab[5][MAX_TYPES]; static trans_4us_func _math_trans_4us_tab[5][MAX_TYPES]; static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; static trans_4f_func _math_trans_4fc_tab[5][MAX_TYPES]; #define PTR_ELT(ptr, elt) (((SRC *)ptr)[elt]) #define TAB(x) _math_trans##x##_tab #define ARGS GLuint start, GLuint n #define SRC_START start #define DST_START 0 #define STRIDE stride #define NEXT_F f += stride #define NEXT_F2 #define CHECK /* GL_BYTE */ #define SRC GLbyte #define SRC_IDX TYPE_IDX(GL_BYTE) #define TRX_3F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4FC(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_UB(ub, f,n) ub = BYTE_TO_UBYTE( PTR_ELT(f,n) ) #define TRX_US(ch, f,n) ch = BYTE_TO_USHORT( PTR_ELT(f,n) ) #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) #define SZ 4 #define INIT init_trans_4_GLbyte_raw #define DEST_4F trans_4_GLbyte_4f_raw #define DEST_4FC trans_4_GLbyte_4fc_raw #define DEST_4UB trans_4_GLbyte_4ub_raw #define DEST_4US trans_4_GLbyte_4us_raw #include "m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLbyte_raw #define DEST_4F trans_3_GLbyte_4f_raw #define DEST_4FC trans_3_GLbyte_4fc_raw #define DEST_4UB trans_3_GLbyte_4ub_raw #define DEST_4US trans_3_GLbyte_4us_raw #define DEST_3F trans_3_GLbyte_3f_raw #include "m_trans_tmp.h" #define SZ 2 #define INIT init_trans_2_GLbyte_raw #define DEST_4F trans_2_GLbyte_4f_raw #define DEST_4FC trans_2_GLbyte_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLbyte_raw #define DEST_4F trans_1_GLbyte_4f_raw #define DEST_4FC trans_1_GLbyte_4fc_raw #define DEST_1UB trans_1_GLbyte_1ub_raw #define DEST_1UI trans_1_GLbyte_1ui_raw #include "m_trans_tmp.h" #undef SRC #undef TRX_3F #undef TRX_4F #undef TRX_4FC #undef TRX_UB #undef TRX_US #undef TRX_UI #undef SRC_IDX /* GL_UNSIGNED_BYTE */ #define SRC GLubyte #define SRC_IDX TYPE_IDX(GL_UNSIGNED_BYTE) #define TRX_3F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) #define TRX_4F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) #define TRX_4FC(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) #define TRX_UB(ub, f,n) ub = PTR_ELT(f,n) #define TRX_US(us, f,n) us = UBYTE_TO_USHORT(PTR_ELT(f,n)) #define TRX_UI(f,n) (GLuint)PTR_ELT(f,n) /* 4ub->4ub handled in special case below. */ #define SZ 4 #define INIT init_trans_4_GLubyte_raw #define DEST_4F trans_4_GLubyte_4f_raw #define DEST_4FC trans_4_GLubyte_4fc_raw #define DEST_4US trans_4_GLubyte_4us_raw #include "m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLubyte_raw #define DEST_4UB trans_3_GLubyte_4ub_raw #define DEST_4US trans_3_GLubyte_4us_raw #define DEST_3F trans_3_GLubyte_3f_raw #define DEST_4F trans_3_GLubyte_4f_raw #define DEST_4FC trans_3_GLubyte_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLubyte_raw #define DEST_1UI trans_1_GLubyte_1ui_raw #define DEST_1UB trans_1_GLubyte_1ub_raw #include "m_trans_tmp.h" #undef SRC #undef SRC_IDX #undef TRX_3F #undef TRX_4F #undef TRX_4FC #undef TRX_UB #undef TRX_US #undef TRX_UI /* GL_SHORT */ #define SRC GLshort #define SRC_IDX TYPE_IDX(GL_SHORT) #define TRX_3F(f,n) SHORT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) #define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) #define TRX_UB(ub, f,n) ub = SHORT_TO_UBYTE(PTR_ELT(f,n)) #define TRX_US(us, f,n) us = SHORT_TO_USHORT(PTR_ELT(f,n)) #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) #define SZ 4 #define INIT init_trans_4_GLshort_raw #define DEST_4F trans_4_GLshort_4f_raw #define DEST_4FC trans_4_GLshort_4fc_raw #define DEST_4UB trans_4_GLshort_4ub_raw #define DEST_4US trans_4_GLshort_4us_raw #include "m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLshort_raw #define DEST_4F trans_3_GLshort_4f_raw #define DEST_4FC trans_3_GLshort_4fc_raw #define DEST_4UB trans_3_GLshort_4ub_raw #define DEST_4US trans_3_GLshort_4us_raw #define DEST_3F trans_3_GLshort_3f_raw #include "m_trans_tmp.h" #define SZ 2 #define INIT init_trans_2_GLshort_raw #define DEST_4F trans_2_GLshort_4f_raw #define DEST_4FC trans_2_GLshort_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLshort_raw #define DEST_4F trans_1_GLshort_4f_raw #define DEST_4FC trans_1_GLshort_4fc_raw #define DEST_1UB trans_1_GLshort_1ub_raw #define DEST_1UI trans_1_GLshort_1ui_raw #include "m_trans_tmp.h" #undef SRC #undef SRC_IDX #undef TRX_3F #undef TRX_4F #undef TRX_4FC #undef TRX_UB #undef TRX_US #undef TRX_UI /* GL_UNSIGNED_SHORT */ #define SRC GLushort #define SRC_IDX TYPE_IDX(GL_UNSIGNED_SHORT) #define TRX_3F(f,n) USHORT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) #define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) #define TRX_UB(ub,f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 8) #define TRX_US(us,f,n) us = (GLushort) (PTR_ELT(f,n) >> 8) #define TRX_UI(f,n) (GLuint) PTR_ELT(f,n) #define SZ 4 #define INIT init_trans_4_GLushort_raw #define DEST_4F trans_4_GLushort_4f_raw #define DEST_4FC trans_4_GLushort_4fc_raw #define DEST_4UB trans_4_GLushort_4ub_raw #define DEST_4US trans_4_GLushort_4us_raw #include "m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLushort_raw #define DEST_4F trans_3_GLushort_4f_raw #define DEST_4FC trans_3_GLushort_4fc_raw #define DEST_4UB trans_3_GLushort_4ub_raw #define DEST_4US trans_3_GLushort_4us_raw #define DEST_3F trans_3_GLushort_3f_raw #include "m_trans_tmp.h" #define SZ 2 #define INIT init_trans_2_GLushort_raw #define DEST_4F trans_2_GLushort_4f_raw #define DEST_4FC trans_2_GLushort_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLushort_raw #define DEST_4F trans_1_GLushort_4f_raw #define DEST_4FC trans_1_GLushort_4fc_raw #define DEST_1UB trans_1_GLushort_1ub_raw #define DEST_1UI trans_1_GLushort_1ui_raw #include "m_trans_tmp.h" #undef SRC #undef SRC_IDX #undef TRX_3F #undef TRX_4F #undef TRX_4FC #undef TRX_UB #undef TRX_US #undef TRX_UI /* GL_INT */ #define SRC GLint #define SRC_IDX TYPE_IDX(GL_INT) #define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) #define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) #define TRX_UB(ub, f,n) ub = INT_TO_UBYTE(PTR_ELT(f,n)) #define TRX_US(us, f,n) us = INT_TO_USHORT(PTR_ELT(f,n)) #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) #define SZ 4 #define INIT init_trans_4_GLint_raw #define DEST_4F trans_4_GLint_4f_raw #define DEST_4FC trans_4_GLint_4fc_raw #define DEST_4UB trans_4_GLint_4ub_raw #define DEST_4US trans_4_GLint_4us_raw #include "m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLint_raw #define DEST_4F trans_3_GLint_4f_raw #define DEST_4FC trans_3_GLint_4fc_raw #define DEST_4UB trans_3_GLint_4ub_raw #define DEST_4US trans_3_GLint_4us_raw #define DEST_3F trans_3_GLint_3f_raw #include "m_trans_tmp.h" #define SZ 2 #define INIT init_trans_2_GLint_raw #define DEST_4F trans_2_GLint_4f_raw #define DEST_4FC trans_2_GLint_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLint_raw #define DEST_4F trans_1_GLint_4f_raw #define DEST_4FC trans_1_GLint_4fc_raw #define DEST_1UB trans_1_GLint_1ub_raw #define DEST_1UI trans_1_GLint_1ui_raw #include "m_trans_tmp.h" #undef SRC #undef SRC_IDX #undef TRX_3F #undef TRX_4F #undef TRX_4FC #undef TRX_UB #undef TRX_US #undef TRX_UI /* GL_UNSIGNED_INT */ #define SRC GLuint #define SRC_IDX TYPE_IDX(GL_UNSIGNED_INT) #define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) #define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) #define TRX_UB(ub, f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 24) #define TRX_US(us, f,n) us = (GLshort) (PTR_ELT(f,n) >> 16) #define TRX_UI(f,n) PTR_ELT(f,n) #define SZ 4 #define INIT init_trans_4_GLuint_raw #define DEST_4F trans_4_GLuint_4f_raw #define DEST_4FC trans_4_GLuint_4fc_raw #define DEST_4UB trans_4_GLuint_4ub_raw #define DEST_4US trans_4_GLuint_4us_raw #include "m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLuint_raw #define DEST_4F trans_3_GLuint_4f_raw #define DEST_4FC trans_3_GLuint_4fc_raw #define DEST_4UB trans_3_GLuint_4ub_raw #define DEST_4US trans_3_GLuint_4us_raw #define DEST_3F trans_3_GLuint_3f_raw #include "m_trans_tmp.h" #define SZ 2 #define INIT init_trans_2_GLuint_raw #define DEST_4F trans_2_GLuint_4f_raw #define DEST_4FC trans_2_GLuint_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLuint_raw #define DEST_4F trans_1_GLuint_4f_raw #define DEST_4FC trans_1_GLuint_4fc_raw #define DEST_1UB trans_1_GLuint_1ub_raw #define DEST_1UI trans_1_GLuint_1ui_raw #include "m_trans_tmp.h" #undef SRC #undef SRC_IDX #undef TRX_3F #undef TRX_4F #undef TRX_4FC #undef TRX_UB #undef TRX_US #undef TRX_UI /* GL_DOUBLE */ #define SRC GLdouble #define SRC_IDX TYPE_IDX(GL_DOUBLE) #define TRX_3F(f,n) (GLfloat) PTR_ELT(f,n) #define TRX_4F(f,n) (GLfloat) PTR_ELT(f,n) #define TRX_4FC(f,n) (GLfloat) PTR_ELT(f,n) #define TRX_UB(ub,f,n) UNCLAMPED_FLOAT_TO_UBYTE(ub, PTR_ELT(f,n)) #define TRX_US(us,f,n) UNCLAMPED_FLOAT_TO_USHORT(us, PTR_ELT(f,n)) #define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n) #define TRX_1F(f,n) (GLfloat) PTR_ELT(f,n) #define SZ 4 #define INIT init_trans_4_GLdouble_raw #define DEST_4F trans_4_GLdouble_4f_raw #define DEST_4FC trans_4_GLdouble_4fc_raw #define DEST_4UB trans_4_GLdouble_4ub_raw #define DEST_4US trans_4_GLdouble_4us_raw #include "m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLdouble_raw #define DEST_4F trans_3_GLdouble_4f_raw #define DEST_4FC trans_3_GLdouble_4fc_raw #define DEST_4UB trans_3_GLdouble_4ub_raw #define DEST_4US trans_3_GLdouble_4us_raw #define DEST_3F trans_3_GLdouble_3f_raw #include "m_trans_tmp.h" #define SZ 2 #define INIT init_trans_2_GLdouble_raw #define DEST_4F trans_2_GLdouble_4f_raw #define DEST_4FC trans_2_GLdouble_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLdouble_raw #define DEST_4F trans_1_GLdouble_4f_raw #define DEST_4FC trans_1_GLdouble_4fc_raw #define DEST_1UB trans_1_GLdouble_1ub_raw #define DEST_1UI trans_1_GLdouble_1ui_raw #define DEST_1F trans_1_GLdouble_1f_raw #include "m_trans_tmp.h" #undef SRC #undef SRC_IDX /* GL_FLOAT */ #define SRC GLfloat #define SRC_IDX TYPE_IDX(GL_FLOAT) #define SZ 4 #define INIT init_trans_4_GLfloat_raw #define DEST_4UB trans_4_GLfloat_4ub_raw #define DEST_4US trans_4_GLfloat_4us_raw #define DEST_4F trans_4_GLfloat_4f_raw #define DEST_4FC trans_4_GLfloat_4fc_raw #include "m_trans_tmp.h" #define SZ 3 #define INIT init_trans_3_GLfloat_raw #define DEST_4F trans_3_GLfloat_4f_raw #define DEST_4FC trans_3_GLfloat_4fc_raw #define DEST_4UB trans_3_GLfloat_4ub_raw #define DEST_4US trans_3_GLfloat_4us_raw #define DEST_3F trans_3_GLfloat_3f_raw #include "m_trans_tmp.h" #define SZ 2 #define INIT init_trans_2_GLfloat_raw #define DEST_4F trans_2_GLfloat_4f_raw #define DEST_4FC trans_2_GLfloat_4fc_raw #include "m_trans_tmp.h" #define SZ 1 #define INIT init_trans_1_GLfloat_raw #define DEST_4F trans_1_GLfloat_4f_raw #define DEST_4FC trans_1_GLfloat_4fc_raw #define DEST_1UB trans_1_GLfloat_1ub_raw #define DEST_1UI trans_1_GLfloat_1ui_raw #define DEST_1F trans_1_GLfloat_1f_raw #include "m_trans_tmp.h" #undef SRC #undef SRC_IDX #undef TRX_3F #undef TRX_4F #undef TRX_4FC #undef TRX_UB #undef TRX_US #undef TRX_UI static void trans_4_GLubyte_4ub_raw(GLubyte (*t)[4], CONST void *Ptr, GLuint stride, ARGS ) { const GLubyte *f = (GLubyte *) Ptr + SRC_START * stride; GLuint i; if (((((uintptr_t) f | (uintptr_t) stride)) & 3L) == 0L) { /* Aligned. */ for (i = DST_START ; i < n ; i++, f += stride) { COPY_4UBV( t[i], f ); } } else { for (i = DST_START ; i < n ; i++, f += stride) { t[i][0] = f[0]; t[i][1] = f[1]; t[i][2] = f[2]; t[i][3] = f[3]; } } } static void init_translate_raw(void) { MEMSET( TAB(_1ui), 0, sizeof(TAB(_1ui)) ); MEMSET( TAB(_1ub), 0, sizeof(TAB(_1ub)) ); MEMSET( TAB(_3f), 0, sizeof(TAB(_3f)) ); MEMSET( TAB(_4ub), 0, sizeof(TAB(_4ub)) ); MEMSET( TAB(_4us), 0, sizeof(TAB(_4us)) ); MEMSET( TAB(_4f), 0, sizeof(TAB(_4f)) ); MEMSET( TAB(_4fc), 0, sizeof(TAB(_4fc)) ); init_trans_4_GLbyte_raw(); init_trans_3_GLbyte_raw(); init_trans_2_GLbyte_raw(); init_trans_1_GLbyte_raw(); init_trans_1_GLubyte_raw(); init_trans_3_GLubyte_raw(); init_trans_4_GLubyte_raw(); init_trans_4_GLshort_raw(); init_trans_3_GLshort_raw(); init_trans_2_GLshort_raw(); init_trans_1_GLshort_raw(); init_trans_4_GLushort_raw(); init_trans_3_GLushort_raw(); init_trans_2_GLushort_raw(); init_trans_1_GLushort_raw(); init_trans_4_GLint_raw(); init_trans_3_GLint_raw(); init_trans_2_GLint_raw(); init_trans_1_GLint_raw(); init_trans_4_GLuint_raw(); init_trans_3_GLuint_raw(); init_trans_2_GLuint_raw(); init_trans_1_GLuint_raw(); init_trans_4_GLdouble_raw(); init_trans_3_GLdouble_raw(); init_trans_2_GLdouble_raw(); init_trans_1_GLdouble_raw(); init_trans_4_GLfloat_raw(); init_trans_3_GLfloat_raw(); init_trans_2_GLfloat_raw(); init_trans_1_GLfloat_raw(); TAB(_4ub)[4][TYPE_IDX(GL_UNSIGNED_BYTE)] = trans_4_GLubyte_4ub_raw; } #undef TAB #ifdef CLASS #undef CLASS #endif #undef ARGS #undef CHECK #undef SRC_START #undef DST_START #undef NEXT_F #undef NEXT_F2 void _math_init_translate( void ) { init_translate_raw(); } void _math_trans_1f(GLfloat *to, CONST void *ptr, GLuint stride, GLenum type, GLuint start, GLuint n ) { _math_trans_1f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); } void _math_trans_1ui(GLuint *to, CONST void *ptr, GLuint stride, GLenum type, GLuint start, GLuint n ) { _math_trans_1ui_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); } void _math_trans_1ub(GLubyte *to, CONST void *ptr, GLuint stride, GLenum type, GLuint start, GLuint n ) { _math_trans_1ub_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); } void _math_trans_4ub(GLubyte (*to)[4], CONST void *ptr, GLuint stride, GLenum type, GLuint size, GLuint start, GLuint n ) { _math_trans_4ub_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); } void _math_trans_4chan( GLchan (*to)[4], CONST void *ptr, GLuint stride, GLenum type, GLuint size, GLuint start, GLuint n ) { #if CHAN_TYPE == GL_UNSIGNED_BYTE _math_trans_4ub( to, ptr, stride, type, size, start, n ); #elif CHAN_TYPE == GL_UNSIGNED_SHORT _math_trans_4us( to, ptr, stride, type, size, start, n ); #elif CHAN_TYPE == GL_FLOAT _math_trans_4fc( to, ptr, stride, type, size, start, n ); #endif } void _math_trans_4us(GLushort (*to)[4], CONST void *ptr, GLuint stride, GLenum type, GLuint size, GLuint start, GLuint n ) { _math_trans_4us_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); } void _math_trans_4f(GLfloat (*to)[4], CONST void *ptr, GLuint stride, GLenum type, GLuint size, GLuint start, GLuint n ) { _math_trans_4f_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); } void _math_trans_4fc(GLfloat (*to)[4], CONST void *ptr, GLuint stride, GLenum type, GLuint size, GLuint start, GLuint n ) { _math_trans_4fc_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); } void _math_trans_3f(GLfloat (*to)[3], CONST void *ptr, GLuint stride, GLenum type, GLuint start, GLuint n ) { _math_trans_3f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_translate.h0000644000000000000000000000536113614532424020635 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _M_TRANSLATE_H_ #define _M_TRANSLATE_H_ #include "config.h" #include "mtypes.h" /* hack for GLchan */ extern void _math_trans_1f(GLfloat *to, CONST void *ptr, GLuint stride, GLenum type, GLuint start, GLuint n ); extern void _math_trans_1ui(GLuint *to, CONST void *ptr, GLuint stride, GLenum type, GLuint start, GLuint n ); extern void _math_trans_1ub(GLubyte *to, CONST void *ptr, GLuint stride, GLenum type, GLuint start, GLuint n ); extern void _math_trans_4ub(GLubyte (*to)[4], CONST void *ptr, GLuint stride, GLenum type, GLuint size, GLuint start, GLuint n ); extern void _math_trans_4chan( GLchan (*to)[4], CONST void *ptr, GLuint stride, GLenum type, GLuint size, GLuint start, GLuint n ); extern void _math_trans_4us(GLushort (*to)[4], CONST void *ptr, GLuint stride, GLenum type, GLuint size, GLuint start, GLuint n ); extern void _math_trans_4f(GLfloat (*to)[4], CONST void *ptr, GLuint stride, GLenum type, GLuint size, GLuint start, GLuint n ); extern void _math_trans_4fc(GLfloat (*to)[4], CONST void *ptr, GLuint stride, GLenum type, GLuint size, GLuint start, GLuint n ); extern void _math_trans_3f(GLfloat (*to)[3], CONST void *ptr, GLuint stride, GLenum type, GLuint start, GLuint n ); extern void _math_init_translate( void ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_trans_tmp.h0000644000000000000000000001400513614532424020642 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * New (3.1) transformation code written by Keith Whitwell. */ /* KW: This file also included by tnl/trans_elt.c to build code * specific to the implementation of array-elements in the * tnl module. */ #ifdef DEST_4F static void DEST_4F( GLfloat (*t)[4], CONST void *ptr, GLuint stride, ARGS ) { const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; const GLubyte *first = f; GLuint i; (void) first; (void) start; for (i = DST_START ; i < n ; i++, NEXT_F) { CHECK { NEXT_F2; if (SZ >= 1) t[i][0] = TRX_4F(f, 0); if (SZ >= 2) t[i][1] = TRX_4F(f, 1); if (SZ >= 3) t[i][2] = TRX_4F(f, 2); if (SZ == 4) t[i][3] = TRX_4F(f, 3); else t[i][3] = 1.0; } } } #endif #ifdef DEST_4FC static void DEST_4FC( GLfloat (*t)[4], CONST void *ptr, GLuint stride, ARGS ) { const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; const GLubyte *first = f; GLuint i; (void) first; (void) start; for (i = DST_START ; i < n ; i++, NEXT_F) { CHECK { NEXT_F2; if (SZ >= 1) t[i][0] = TRX_4FC(f, 0); if (SZ >= 2) t[i][1] = TRX_4FC(f, 1); if (SZ >= 3) t[i][2] = TRX_4FC(f, 2); if (SZ == 4) t[i][3] = TRX_4FC(f, 3); else t[i][3] = 1.0; } } } #endif #ifdef DEST_3F static void DEST_3F( GLfloat (*t)[3], CONST void *ptr, GLuint stride, ARGS ) { const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; const GLubyte *first = f; GLuint i; (void) first; (void) start; for (i = DST_START ; i < n ; i++, NEXT_F) { CHECK { NEXT_F2; t[i][0] = TRX_3F(f, 0); t[i][1] = TRX_3F(f, 1); t[i][2] = TRX_3F(f, 2); } } } #endif #ifdef DEST_1F static void DEST_1F( GLfloat *t, CONST void *ptr, GLuint stride, ARGS ) { const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; const GLubyte *first = f; GLuint i; (void) first; (void) start; for (i = DST_START ; i < n ; i++, NEXT_F) { CHECK { NEXT_F2; t[i] = TRX_1F(f, 0); } } } #endif #ifdef DEST_4UB static void DEST_4UB( GLubyte (*t)[4], CONST void *ptr, GLuint stride, ARGS ) { const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; const GLubyte *first = f; GLuint i; (void) start; (void) first; for (i = DST_START ; i < n ; i++, NEXT_F) { CHECK { NEXT_F2; if (SZ >= 1) TRX_UB(t[i][0], f, 0); if (SZ >= 2) TRX_UB(t[i][1], f, 1); if (SZ >= 3) TRX_UB(t[i][2], f, 2); if (SZ == 4) TRX_UB(t[i][3], f, 3); else t[i][3] = 255; } } } #endif #ifdef DEST_4US static void DEST_4US( GLushort (*t)[4], CONST void *ptr, GLuint stride, ARGS ) { const GLubyte *f = (GLubyte *) ((GLubyte *) ptr + SRC_START * stride); const GLubyte *first = f; GLuint i; (void) start; (void) first; for (i = DST_START ; i < n ; i++, NEXT_F) { CHECK { NEXT_F2; if (SZ >= 1) TRX_US(t[i][0], f, 0); if (SZ >= 2) TRX_US(t[i][1], f, 1); if (SZ >= 3) TRX_US(t[i][2], f, 2); if (SZ == 4) TRX_US(t[i][3], f, 3); else t[i][3] = 65535; } } } #endif #ifdef DEST_1UB static void DEST_1UB( GLubyte *t, CONST void *ptr, GLuint stride, ARGS ) { const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; const GLubyte *first = f; GLuint i; (void) start; (void) first; for (i = DST_START ; i < n ; i++, NEXT_F) { CHECK { NEXT_F2; TRX_UB(t[i], f, 0); } } } #endif #ifdef DEST_1UI static void DEST_1UI( GLuint *t, CONST void *ptr, GLuint stride, ARGS ) { const GLubyte *f = (GLubyte *) ptr + SRC_START * stride; const GLubyte *first = f; GLuint i; (void) start; (void) first; for (i = DST_START ; i < n ; i++, NEXT_F) { CHECK { NEXT_F2; t[i] = TRX_UI(f, 0); } } } #endif static void INIT(void) { #ifdef DEST_1UI ASSERT(SZ == 1); TAB(_1ui)[SRC_IDX] = DEST_1UI; #endif #ifdef DEST_1UB ASSERT(SZ == 1); TAB(_1ub)[SRC_IDX] = DEST_1UB; #endif #ifdef DEST_1F ASSERT(SZ == 1); TAB(_1f)[SRC_IDX] = DEST_1F; #endif #ifdef DEST_3F ASSERT(SZ == 3); TAB(_3f)[SRC_IDX] = DEST_3F; #endif #ifdef DEST_4UB TAB(_4ub)[SZ][SRC_IDX] = DEST_4UB; #endif #ifdef DEST_4US TAB(_4us)[SZ][SRC_IDX] = DEST_4US; #endif #ifdef DEST_4F TAB(_4f)[SZ][SRC_IDX] = DEST_4F; #endif #ifdef DEST_4FC TAB(_4fc)[SZ][SRC_IDX] = DEST_4FC; #endif } #ifdef INIT #undef INIT #endif #ifdef DEST_1UI #undef DEST_1UI #endif #ifdef DEST_1UB #undef DEST_1UB #endif #ifdef DEST_4UB #undef DEST_4UB #endif #ifdef DEST_4US #undef DEST_4US #endif #ifdef DEST_3F #undef DEST_3F #endif #ifdef DEST_4F #undef DEST_4F #endif #ifdef DEST_4FC #undef DEST_4FC #endif #ifdef DEST_1F #undef DEST_1F #endif #ifdef SZ #undef SZ #endif #ifdef TAG #undef TAG #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_vector.c0000644000000000000000000001142013614532424020126 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * New (3.1) transformation code written by Keith Whitwell. */ #include "glheader.h" #include "imports.h" #include "macros.h" #include "imports.h" #include "m_vector.h" /* * Given a vector [count][4] of floats, set all the [][elt] values * to 0 (if elt = 0, 1, 2) or 1.0 (if elt = 3). */ void _mesa_vector4f_clean_elem( GLvector4f *vec, GLuint count, GLuint elt ) { static const GLubyte elem_bits[4] = { VEC_DIRTY_0, VEC_DIRTY_1, VEC_DIRTY_2, VEC_DIRTY_3 }; static const GLfloat clean[4] = { 0, 0, 0, 1 }; const GLfloat v = clean[elt]; GLfloat (*data)[4] = (GLfloat (*)[4])vec->start; GLuint i; for (i = 0 ; i < count ; i++) data[i][elt] = v; vec->flags &= ~elem_bits[elt]; } static const GLubyte size_bits[5] = { 0, VEC_SIZE_1, VEC_SIZE_2, VEC_SIZE_3, VEC_SIZE_4, }; /* * Initialize GLvector objects. * Input: v - the vector object to initialize. * flags - bitwise-OR of VEC_* flags * storage - pointer to storage for the vector's data */ void _mesa_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] ) { v->stride = 4 * sizeof(GLfloat); v->size = 2; /* may change: 2-4 for vertices and 1-4 for texcoords */ v->data = storage; v->start = (GLfloat *) storage; v->count = 0; v->flags = size_bits[4] | flags ; } /* * Initialize GLvector objects and allocate storage. * Input: v - the vector object * sz - unused???? * flags - bitwise-OR of VEC_* flags * count - number of elements to allocate in vector * alignment - desired memory alignment for the data (in bytes) */ void _mesa_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count, GLuint alignment ) { v->stride = 4 * sizeof(GLfloat); v->size = 2; v->storage = ALIGN_MALLOC( count * 4 * sizeof(GLfloat), alignment ); v->start = (GLfloat *) v->storage; v->data = (GLfloat (*)[4]) v->storage; v->count = 0; v->flags = size_bits[4] | flags | VEC_MALLOC ; } /* * Vector deallocation. Free whatever memory is pointed to by the * vector's storage field if the VEC_MALLOC flag is set. * DO NOT free the GLvector object itself, though. */ void _mesa_vector4f_free( GLvector4f *v ) { if (v->flags & VEC_MALLOC) { ALIGN_FREE( v->storage ); v->data = NULL; v->start = NULL; v->storage = NULL; v->flags &= ~VEC_MALLOC; } } /* * For debugging */ void _mesa_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling ) { GLfloat c[4] = { 0, 0, 0, 1 }; const char *templates[5] = { "%d:\t0, 0, 0, 1\n", "%d:\t%f, 0, 0, 1\n", "%d:\t%f, %f, 0, 1\n", "%d:\t%f, %f, %f, 1\n", "%d:\t%f, %f, %f, %f\n" }; const char *t = templates[v->size]; GLfloat *d = (GLfloat *)v->data; GLuint j, i = 0, count; _mesa_printf("data-start\n"); for ( ; d != v->start ; STRIDE_F(d, v->stride), i++) _mesa_printf(t, i, d[0], d[1], d[2], d[3]); _mesa_printf("start-count(%u)\n", v->count); count = i + v->count; if (culling) { for ( ; i < count ; STRIDE_F(d, v->stride), i++) if (cullmask[i]) _mesa_printf(t, i, d[0], d[1], d[2], d[3]); } else { for ( ; i < count ; STRIDE_F(d, v->stride), i++) _mesa_printf(t, i, d[0], d[1], d[2], d[3]); } for (j = v->size ; j < 4; j++) { if ((v->flags & (1<data ; i < count && d[j] == c[j] ; i++, STRIDE_F(d, v->stride)) {}; if (i == count) _mesa_printf(" --> ok\n"); else _mesa_printf(" --> Failed at %u ******\n", i); } } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_vector.h0000644000000000000000000000657513614532424020152 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * New (3.1) transformation code written by Keith Whitwell. */ #ifndef _M_VECTOR_H_ #define _M_VECTOR_H_ #include "glheader.h" #include "mtypes.h" /* hack for GLchan */ #define VEC_DIRTY_0 0x1 #define VEC_DIRTY_1 0x2 #define VEC_DIRTY_2 0x4 #define VEC_DIRTY_3 0x8 #define VEC_MALLOC 0x10 /* storage field points to self-allocated mem*/ #define VEC_NOT_WRITEABLE 0x40 /* writable elements to hold clipped data */ #define VEC_BAD_STRIDE 0x100 /* matches tnl's prefered stride */ #define VEC_SIZE_1 VEC_DIRTY_0 #define VEC_SIZE_2 (VEC_DIRTY_0|VEC_DIRTY_1) #define VEC_SIZE_3 (VEC_DIRTY_0|VEC_DIRTY_1|VEC_DIRTY_2) #define VEC_SIZE_4 (VEC_DIRTY_0|VEC_DIRTY_1|VEC_DIRTY_2|VEC_DIRTY_3) /* Wrap all the information about vectors up in a struct. Has * additional fields compared to the other vectors to help us track of * different vertex sizes, and whether we need to clean columns out * because they contain non-(0,0,0,1) values. * * The start field is used to reserve data for copied vertices at the * end of _mesa_transform_vb, and avoids the need for a multiplication in * the transformation routines. */ typedef struct { GLfloat (*data)[4]; /* may be malloc'd or point to client data */ GLfloat *start; /* points somewhere inside of */ GLuint count; /* size of the vector (in elements) */ GLuint stride; /* stride from one element to the next (in bytes) */ GLuint size; /* 2-4 for vertices and 1-4 for texcoords */ GLuint flags; /* which columns are dirty */ void *storage; /* self-allocated storage */ } GLvector4f; extern void _mesa_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] ); extern void _mesa_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count, GLuint alignment ); extern void _mesa_vector4f_free( GLvector4f *v ); extern void _mesa_vector4f_print( GLvector4f *v, GLubyte *, GLboolean ); extern void _mesa_vector4f_clean_elem( GLvector4f *vec, GLuint nr, GLuint elt ); /* * Given vector , return a pointer (cast to to the -th element. * * End up doing a lot of slow imuls if not careful. */ #define VEC_ELT( v, type, i ) \ ( (type *) ( ((GLbyte *) ((v)->data)) + (i) * (v)->stride) ) #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_xform.c0000644000000000000000000001500013614532424017755 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Matrix/vertex/vector transformation stuff * * * NOTES: * 1. 4x4 transformation matrices are stored in memory in column major order. * 2. Points/vertices are to be thought of as column vectors. * 3. Transformation of a point p by a matrix M is: p' = M * p */ #include "glheader.h" #include "macros.h" #include "m_eval.h" #include "m_matrix.h" #include "m_translate.h" #include "m_xform.h" #include "mathmod.h" #ifdef DEBUG #include "m_debug.h" #endif #ifdef USE_X86_ASM #include "x86/common_x86_asm.h" #endif #ifdef USE_X86_64_ASM #include "x86-64/x86-64.h" #endif #ifdef USE_SPARC_ASM #include "sparc/sparc.h" #endif #ifdef USE_PPC_ASM #include "ppc/common_ppc_features.h" #endif clip_func _mesa_clip_tab[5]; clip_func _mesa_clip_np_tab[5]; dotprod_func _mesa_dotprod_tab[5]; vec_copy_func _mesa_copy_tab[0x10]; normal_func _mesa_normal_tab[0xf]; transform_func *_mesa_transform_tab[5]; /* Raw data format used for: * - Object-to-eye transform prior to culling, although this too * could be culled under some circumstances. * - Eye-to-clip transform (via the function above). * - Cliptesting * - And everything else too, if culling happens to be disabled. * * GH: It's used for everything now, as clipping/culling is done * elsewhere (most often by the driver itself). */ #define TAG(x) x #define TAG2(x,y) x##y #define STRIDE_LOOP for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) #define LOOP for ( i = 0 ; i < n ; i++ ) #define ARGS #include "m_xform_tmp.h" #include "m_clip_tmp.h" #include "m_norm_tmp.h" #include "m_dotprod_tmp.h" #include "m_copy_tmp.h" #undef TAG #undef TAG2 #undef LOOP #undef ARGS GLvector4f *_mesa_project_points( GLvector4f *proj_vec, const GLvector4f *clip_vec ) { const GLuint stride = clip_vec->stride; const GLfloat *from = (GLfloat *)clip_vec->start; const GLuint count = clip_vec->count; GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start; GLuint i; for (i = 0 ; i < count ; i++, STRIDE_F(from, stride)) { GLfloat oow = 1.0F / from[3]; vProj[i][3] = oow; vProj[i][0] = from[0] * oow; vProj[i][1] = from[1] * oow; vProj[i][2] = from[2] * oow; } proj_vec->flags |= VEC_SIZE_4; proj_vec->size = 3; proj_vec->count = clip_vec->count; return proj_vec; } /* * Transform a 4-element row vector (1x4 matrix) by a 4x4 matrix. This * function is used for transforming clipping plane equations and spotlight * directions. * Mathematically, u = v * m. * Input: v - input vector * m - transformation matrix * Output: u - transformed vector */ void _mesa_transform_vector( GLfloat u[4], const GLfloat v[4], const GLfloat m[16] ) { GLfloat v0=v[0], v1=v[1], v2=v[2], v3=v[3]; #define M(row,col) m[row + col*4] u[0] = v0 * M(0,0) + v1 * M(1,0) + v2 * M(2,0) + v3 * M(3,0); u[1] = v0 * M(0,1) + v1 * M(1,1) + v2 * M(2,1) + v3 * M(3,1); u[2] = v0 * M(0,2) + v1 * M(1,2) + v2 * M(2,2) + v3 * M(3,2); u[3] = v0 * M(0,3) + v1 * M(1,3) + v2 * M(2,3) + v3 * M(3,3); #undef M } /* Useful for one-off point transformations, as in clipping. * Note that because the matrix isn't analysed we do too many * multiplies, and that the result is always 4-clean. */ void _mesa_transform_point_sz( GLfloat Q[4], const GLfloat M[16], const GLfloat P[4], GLuint sz ) { if (Q == P) return; if (sz == 4) { Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12] * P[3]; Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13] * P[3]; Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14] * P[3]; Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15] * P[3]; } else if (sz == 3) { Q[0] = M[0] * P[0] + M[4] * P[1] + M[8] * P[2] + M[12]; Q[1] = M[1] * P[0] + M[5] * P[1] + M[9] * P[2] + M[13]; Q[2] = M[2] * P[0] + M[6] * P[1] + M[10] * P[2] + M[14]; Q[3] = M[3] * P[0] + M[7] * P[1] + M[11] * P[2] + M[15]; } else if (sz == 2) { Q[0] = M[0] * P[0] + M[4] * P[1] + M[12]; Q[1] = M[1] * P[0] + M[5] * P[1] + M[13]; Q[2] = M[2] * P[0] + M[6] * P[1] + M[14]; Q[3] = M[3] * P[0] + M[7] * P[1] + M[15]; } else if (sz == 1) { Q[0] = M[0] * P[0] + M[12]; Q[1] = M[1] * P[0] + M[13]; Q[2] = M[2] * P[0] + M[14]; Q[3] = M[3] * P[0] + M[15]; } } /* * This is called only once. It initializes several tables with pointers * to optimized transformation functions. This is where we can test for * AMD 3Dnow! capability, Intel SSE, etc. and hook in the right code. */ void _math_init_transformation( void ) { init_c_transformations(); init_c_norm_transform(); init_c_cliptest(); init_copy0(); init_dotprod(); #ifdef DEBUG _math_test_all_transform_functions( "default" ); _math_test_all_normal_transform_functions( "default" ); _math_test_all_cliptest_functions( "default" ); #endif #ifdef USE_X86_ASM _mesa_init_all_x86_transform_asm(); #elif defined( USE_SPARC_ASM ) _mesa_init_all_sparc_transform_asm(); #elif defined( USE_PPC_ASM ) _mesa_init_all_ppc_transform_asm(); #elif defined( USE_X86_64_ASM ) _mesa_init_all_x86_64_transform_asm(); #endif } void _math_init( void ) { _math_init_transformation(); _math_init_translate(); _math_init_eval(); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_xform.h0000644000000000000000000001371013614532424017770 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _M_XFORM_H #define _M_XFORM_H #include "glheader.h" #include "config.h" #include "math/m_vector.h" #include "math/m_matrix.h" #ifdef USE_X86_ASM #define _XFORMAPI _ASMAPI #define _XFORMAPIP _ASMAPIP #else #define _XFORMAPI #define _XFORMAPIP * #endif extern void _mesa_transform_vector(GLfloat u[4], CONST GLfloat v[4], CONST GLfloat m[16]); extern void _math_init_transformation(void); /* KW: Clip functions now do projective divide as well. The projected * coordinates are very useful to us because they let us cull * backfaces and eliminate vertices from lighting, fogging, etc * calculations. Despite the fact that this divide could be done one * day in hardware, we would still have a reason to want to do it here * as long as those other calculations remain in software. * * Clipping is a convenient place to do the divide on x86 as it should be * possible to overlap with integer outcode calculations. * * There are two cases where we wouldn't want to do the divide in cliptest: * - When we aren't clipping. We still might want to cull backfaces * so the divide should be done elsewhere. This currently never * happens. * * - When culling isn't likely to help us, such as when the GL culling * is disabled and we not lighting or are only lighting * one-sided. In this situation, backface determination provides * us with no useful information. A tricky case to detect is when * all input data is already culled, although hopefully the * application wouldn't turn on culling in such cases. * * We supply a buffer to hold the [x/w,y/w,z/w,1/w] values which * are the result of the projection. This is only used in the * 4-vector case - in other cases, we just use the clip coordinates * as the projected coordinates - they are identical. * * This is doubly convenient because it means the Win[] array is now * of the same stride as all the others, so I can now turn map_vertices * into a straight-forward matrix transformation, with asm acceleration * automatically available. */ /* Vertex buffer clipping flags */ #define CLIP_RIGHT_SHIFT 0 #define CLIP_LEFT_SHIFT 1 #define CLIP_TOP_SHIFT 2 #define CLIP_BOTTOM_SHIFT 3 #define CLIP_NEAR_SHIFT 4 #define CLIP_FAR_SHIFT 5 #define CLIP_RIGHT_BIT 0x01 #define CLIP_LEFT_BIT 0x02 #define CLIP_TOP_BIT 0x04 #define CLIP_BOTTOM_BIT 0x08 #define CLIP_NEAR_BIT 0x10 #define CLIP_FAR_BIT 0x20 #define CLIP_USER_BIT 0x40 #define CLIP_CULL_BIT 0x80 #define CLIP_ALL_BITS 0x3f typedef GLvector4f * (_XFORMAPIP clip_func)( GLvector4f *vClip, GLvector4f *vProj, GLubyte clipMask[], GLubyte *orMask, GLubyte *andMask ); typedef void (*dotprod_func)( GLfloat *out, GLuint out_stride, CONST GLvector4f *coord_vec, CONST GLfloat plane[4] ); typedef void (*vec_copy_func)( GLvector4f *to, CONST GLvector4f *from ); /* * Functions for transformation of normals in the VB. */ typedef void (_NORMAPIP normal_func)( CONST GLmatrix *mat, GLfloat scale, CONST GLvector4f *in, CONST GLfloat lengths[], GLvector4f *dest ); /* Flags for selecting a normal transformation function. */ #define NORM_RESCALE 0x1 /* apply the scale factor */ #define NORM_NORMALIZE 0x2 /* normalize */ #define NORM_TRANSFORM 0x4 /* apply the transformation matrix */ #define NORM_TRANSFORM_NO_ROT 0x8 /* apply the transformation matrix */ /* KW: New versions of the transform function allow a mask array * specifying that individual vector transform should be skipped * when the mask byte is zero. This is always present as a * parameter, to allow a unified interface. */ typedef void (_XFORMAPIP transform_func)( GLvector4f *to_vec, CONST GLfloat m[16], CONST GLvector4f *from_vec ); extern GLvector4f *_mesa_project_points( GLvector4f *to, CONST GLvector4f *from ); extern void _mesa_transform_bounds3( GLubyte *orMask, GLubyte *andMask, CONST GLfloat m[16], CONST GLfloat src[][3] ); extern void _mesa_transform_bounds2( GLubyte *orMask, GLubyte *andMask, CONST GLfloat m[16], CONST GLfloat src[][3] ); extern dotprod_func _mesa_dotprod_tab[5]; extern vec_copy_func _mesa_copy_tab[0x10]; extern vec_copy_func _mesa_copy_clean_tab[5]; extern clip_func _mesa_clip_tab[5]; extern clip_func _mesa_clip_np_tab[5]; extern normal_func _mesa_normal_tab[0xf]; /* Use of 2 layers of linked 1-dimensional arrays to reduce * cost of lookup. */ extern transform_func *_mesa_transform_tab[5]; extern void _mesa_transform_point_sz( GLfloat Q[4], CONST GLfloat M[16], CONST GLfloat P[4], GLuint sz ); #define TransformRaw( to, mat, from ) \ ( _mesa_transform_tab[(from)->size][(mat)->type]( to, (mat)->m, from ), \ (to) ) #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/math/m_xform_tmp.h0000644000000000000000000006376313614532424020665 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * New (3.1) transformation code written by Keith Whitwell. */ /*---------------------------------------------------------------------- * Begin Keith's new code * *---------------------------------------------------------------------- */ /* KW: Fixed stride, now measured in bytes as is the OpenGL array stride. */ /* KW: These are now parameterized to produce two versions, one * which transforms all incoming points, and a second which * takes notice of a cullmask array, and only transforms * unculled vertices. */ /* KW: 1-vectors can sneak into the texture pipeline via the array * interface. These functions are here because I want consistant * treatment of the vertex sizes and a lazy strategy for * cleaning unused parts of the vector, and so as not to exclude * them from the vertex array interface. * * Under our current analysis of matrices, there is no way that * the product of a matrix and a 1-vector can remain a 1-vector, * with the exception of the identity transform. */ /* KW: No longer zero-pad outgoing vectors. Now that external * vectors can get into the pipeline we cannot ever assume * that there is more to a vector than indicated by its * size. */ /* KW: Now uses clipmask and a flag to allow us to skip both/either * cliped and/or culled vertices. */ /* GH: Not any more -- it's easier (and faster) to just process the * entire vector. Clipping and culling are handled further down * the pipe, most often during or after the conversion to some * driver-specific vertex format. */ static void _XFORMAPI TAG(transform_points1_general)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m12 = m[12]; const GLfloat m1 = m[1], m13 = m[13]; const GLfloat m2 = m[2], m14 = m[14]; const GLfloat m3 = m[3], m15 = m[15]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0]; to[i][0] = m0 * ox + m12; to[i][1] = m1 * ox + m13; to[i][2] = m2 * ox + m14; to[i][3] = m3 * ox + m15; } to_vec->size = 4; to_vec->flags |= VEC_SIZE_4; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points1_identity)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLuint count = from_vec->count; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint i; (void) m; if (to_vec == from_vec) return; STRIDE_LOOP { to[i][0] = from[0]; } to_vec->size = 1; to_vec->flags |= VEC_SIZE_1; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points1_2d)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m1 = m[1]; const GLfloat m12 = m[12], m13 = m[13]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0]; to[i][0] = m0 * ox + m12; to[i][1] = m1 * ox + m13; } to_vec->size = 2; to_vec->flags |= VEC_SIZE_2; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m12 = m[12], m13 = m[13]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0]; to[i][0] = m0 * ox + m12; to[i][1] = m13; } to_vec->size = 2; to_vec->flags |= VEC_SIZE_2; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points1_3d)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m1 = m[1], m2 = m[2]; const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0]; to[i][0] = m0 * ox + m12; to[i][1] = m1 * ox + m13; to[i][2] = m2 * ox + m14; } to_vec->size = 3; to_vec->flags |= VEC_SIZE_3; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0]; const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0]; to[i][0] = m0 * ox + m12; to[i][1] = m13; to[i][2] = m14; } to_vec->size = 3; to_vec->flags |= VEC_SIZE_3; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points1_perspective)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m14 = m[14]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0]; to[i][0] = m0 * ox ; to[i][1] = 0 ; to[i][2] = m14; to[i][3] = 0; } to_vec->size = 4; to_vec->flags |= VEC_SIZE_4; to_vec->count = from_vec->count; } /* 2-vectors, which are a lot more relevant than 1-vectors, are * present early in the geometry pipeline and throughout the * texture pipeline. */ static void _XFORMAPI TAG(transform_points2_general)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m4 = m[4], m12 = m[12]; const GLfloat m1 = m[1], m5 = m[5], m13 = m[13]; const GLfloat m2 = m[2], m6 = m[6], m14 = m[14]; const GLfloat m3 = m[3], m7 = m[7], m15 = m[15]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1]; to[i][0] = m0 * ox + m4 * oy + m12; to[i][1] = m1 * ox + m5 * oy + m13; to[i][2] = m2 * ox + m6 * oy + m14; to[i][3] = m3 * ox + m7 * oy + m15; } to_vec->size = 4; to_vec->flags |= VEC_SIZE_4; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points2_identity)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; GLuint i; (void) m; if (to_vec == from_vec) return; STRIDE_LOOP { to[i][0] = from[0]; to[i][1] = from[1]; } to_vec->size = 2; to_vec->flags |= VEC_SIZE_2; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points2_2d)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5]; const GLfloat m12 = m[12], m13 = m[13]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1]; to[i][0] = m0 * ox + m4 * oy + m12; to[i][1] = m1 * ox + m5 * oy + m13; } to_vec->size = 2; to_vec->flags |= VEC_SIZE_2; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1]; to[i][0] = m0 * ox + m12; to[i][1] = m5 * oy + m13; } to_vec->size = 2; to_vec->flags |= VEC_SIZE_2; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points2_3d)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5]; const GLfloat m6 = m[6], m12 = m[12], m13 = m[13], m14 = m[14]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1]; to[i][0] = m0 * ox + m4 * oy + m12; to[i][1] = m1 * ox + m5 * oy + m13; to[i][2] = m2 * ox + m6 * oy + m14; } to_vec->size = 3; to_vec->flags |= VEC_SIZE_3; to_vec->count = from_vec->count; } /* I would actually say this was a fairly important function, from * a texture transformation point of view. */ static void _XFORMAPI TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m5 = m[5]; const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1]; to[i][0] = m0 * ox + m12; to[i][1] = m5 * oy + m13; to[i][2] = m14; } if (m14 == 0) { to_vec->size = 2; to_vec->flags |= VEC_SIZE_2; } else { to_vec->size = 3; to_vec->flags |= VEC_SIZE_3; } to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points2_perspective)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m5 = m[5], m14 = m[14]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1]; to[i][0] = m0 * ox ; to[i][1] = m5 * oy ; to[i][2] = m14; to[i][3] = 0; } to_vec->size = 4; to_vec->flags |= VEC_SIZE_4; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points3_general)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m4 = m[4], m8 = m[8], m12 = m[12]; const GLfloat m1 = m[1], m5 = m[5], m9 = m[9], m13 = m[13]; const GLfloat m2 = m[2], m6 = m[6], m10 = m[10], m14 = m[14]; const GLfloat m3 = m[3], m7 = m[7], m11 = m[11], m15 = m[15]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1], oz = from[2]; to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12; to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13; to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14; to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15; } to_vec->size = 4; to_vec->flags |= VEC_SIZE_4; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points3_identity)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; GLuint i; (void) m; if (to_vec == from_vec) return; STRIDE_LOOP { to[i][0] = from[0]; to[i][1] = from[1]; to[i][2] = from[2]; } to_vec->size = 3; to_vec->flags |= VEC_SIZE_3; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points3_2d)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5]; const GLfloat m12 = m[12], m13 = m[13]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1], oz = from[2]; to[i][0] = m0 * ox + m4 * oy + m12 ; to[i][1] = m1 * ox + m5 * oy + m13 ; to[i][2] = + oz ; } to_vec->size = 3; to_vec->flags |= VEC_SIZE_3; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1], oz = from[2]; to[i][0] = m0 * ox + m12 ; to[i][1] = m5 * oy + m13 ; to[i][2] = + oz ; } to_vec->size = 3; to_vec->flags |= VEC_SIZE_3; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points3_3d)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5]; const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10]; const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1], oz = from[2]; to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 ; to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 ; to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 ; } to_vec->size = 3; to_vec->flags |= VEC_SIZE_3; to_vec->count = from_vec->count; } /* previously known as ortho... */ static void _XFORMAPI TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m5 = m[5]; const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1], oz = from[2]; to[i][0] = m0 * ox + m12 ; to[i][1] = m5 * oy + m13 ; to[i][2] = m10 * oz + m14 ; } to_vec->size = 3; to_vec->flags |= VEC_SIZE_3; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points3_perspective)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9]; const GLfloat m10 = m[10], m14 = m[14]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1], oz = from[2]; to[i][0] = m0 * ox + m8 * oz ; to[i][1] = m5 * oy + m9 * oz ; to[i][2] = m10 * oz + m14 ; to[i][3] = -oz ; } to_vec->size = 4; to_vec->flags |= VEC_SIZE_4; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points4_general)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m4 = m[4], m8 = m[8], m12 = m[12]; const GLfloat m1 = m[1], m5 = m[5], m9 = m[9], m13 = m[13]; const GLfloat m2 = m[2], m6 = m[6], m10 = m[10], m14 = m[14]; const GLfloat m3 = m[3], m7 = m[7], m11 = m[11], m15 = m[15]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 * ow; to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 * ow; to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow; to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15 * ow; } to_vec->size = 4; to_vec->flags |= VEC_SIZE_4; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points4_identity)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; GLuint i; (void) m; if (to_vec == from_vec) return; STRIDE_LOOP { to[i][0] = from[0]; to[i][1] = from[1]; to[i][2] = from[2]; to[i][3] = from[3]; } to_vec->size = 4; to_vec->flags |= VEC_SIZE_4; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points4_2d)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5]; const GLfloat m12 = m[12], m13 = m[13]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; to[i][0] = m0 * ox + m4 * oy + m12 * ow; to[i][1] = m1 * ox + m5 * oy + m13 * ow; to[i][2] = + oz ; to[i][3] = ow; } to_vec->size = 4; to_vec->flags |= VEC_SIZE_4; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; to[i][0] = m0 * ox + m12 * ow; to[i][1] = m5 * oy + m13 * ow; to[i][2] = + oz ; to[i][3] = ow; } to_vec->size = 4; to_vec->flags |= VEC_SIZE_4; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points4_3d)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5]; const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10]; const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 * ow; to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 * ow; to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow; to[i][3] = ow; } to_vec->size = 4; to_vec->flags |= VEC_SIZE_4; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m5 = m[5]; const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; to[i][0] = m0 * ox + m12 * ow; to[i][1] = m5 * oy + m13 * ow; to[i][2] = m10 * oz + m14 * ow; to[i][3] = ow; } to_vec->size = 4; to_vec->flags |= VEC_SIZE_4; to_vec->count = from_vec->count; } static void _XFORMAPI TAG(transform_points4_perspective)( GLvector4f *to_vec, const GLfloat m[16], const GLvector4f *from_vec ) { const GLuint stride = from_vec->stride; GLfloat *from = from_vec->start; GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; GLuint count = from_vec->count; const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9]; const GLfloat m10 = m[10], m14 = m[14]; GLuint i; STRIDE_LOOP { const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; to[i][0] = m0 * ox + m8 * oz ; to[i][1] = m5 * oy + m9 * oz ; to[i][2] = m10 * oz + m14 * ow ; to[i][3] = -oz ; } to_vec->size = 4; to_vec->flags |= VEC_SIZE_4; to_vec->count = from_vec->count; } static transform_func TAG(transform_tab_1)[7]; static transform_func TAG(transform_tab_2)[7]; static transform_func TAG(transform_tab_3)[7]; static transform_func TAG(transform_tab_4)[7]; /* Similar functions could be called several times, with more highly * optimized routines overwriting the arrays. This only occurs during * startup. */ static void _XFORMAPI TAG(init_c_transformations)( void ) { #define TAG_TAB _mesa_transform_tab #define TAG_TAB_1 TAG(transform_tab_1) #define TAG_TAB_2 TAG(transform_tab_2) #define TAG_TAB_3 TAG(transform_tab_3) #define TAG_TAB_4 TAG(transform_tab_4) TAG_TAB[1] = TAG_TAB_1; TAG_TAB[2] = TAG_TAB_2; TAG_TAB[3] = TAG_TAB_3; TAG_TAB[4] = TAG_TAB_4; /* 1-D points (ie texcoords) */ TAG_TAB_1[MATRIX_GENERAL] = TAG(transform_points1_general); TAG_TAB_1[MATRIX_IDENTITY] = TAG(transform_points1_identity); TAG_TAB_1[MATRIX_3D_NO_ROT] = TAG(transform_points1_3d_no_rot); TAG_TAB_1[MATRIX_PERSPECTIVE] = TAG(transform_points1_perspective); TAG_TAB_1[MATRIX_2D] = TAG(transform_points1_2d); TAG_TAB_1[MATRIX_2D_NO_ROT] = TAG(transform_points1_2d_no_rot); TAG_TAB_1[MATRIX_3D] = TAG(transform_points1_3d); /* 2-D points */ TAG_TAB_2[MATRIX_GENERAL] = TAG(transform_points2_general); TAG_TAB_2[MATRIX_IDENTITY] = TAG(transform_points2_identity); TAG_TAB_2[MATRIX_3D_NO_ROT] = TAG(transform_points2_3d_no_rot); TAG_TAB_2[MATRIX_PERSPECTIVE] = TAG(transform_points2_perspective); TAG_TAB_2[MATRIX_2D] = TAG(transform_points2_2d); TAG_TAB_2[MATRIX_2D_NO_ROT] = TAG(transform_points2_2d_no_rot); TAG_TAB_2[MATRIX_3D] = TAG(transform_points2_3d); /* 3-D points */ TAG_TAB_3[MATRIX_GENERAL] = TAG(transform_points3_general); TAG_TAB_3[MATRIX_IDENTITY] = TAG(transform_points3_identity); TAG_TAB_3[MATRIX_3D_NO_ROT] = TAG(transform_points3_3d_no_rot); TAG_TAB_3[MATRIX_PERSPECTIVE] = TAG(transform_points3_perspective); TAG_TAB_3[MATRIX_2D] = TAG(transform_points3_2d); TAG_TAB_3[MATRIX_2D_NO_ROT] = TAG(transform_points3_2d_no_rot); TAG_TAB_3[MATRIX_3D] = TAG(transform_points3_3d); /* 4-D points */ TAG_TAB_4[MATRIX_GENERAL] = TAG(transform_points4_general); TAG_TAB_4[MATRIX_IDENTITY] = TAG(transform_points4_identity); TAG_TAB_4[MATRIX_3D_NO_ROT] = TAG(transform_points4_3d_no_rot); TAG_TAB_4[MATRIX_PERSPECTIVE] = TAG(transform_points4_perspective); TAG_TAB_4[MATRIX_2D] = TAG(transform_points4_2d); TAG_TAB_4[MATRIX_2D_NO_ROT] = TAG(transform_points4_2d_no_rot); TAG_TAB_4[MATRIX_3D] = TAG(transform_points4_3d); #undef TAG_TAB #undef TAG_TAB_1 #undef TAG_TAB_2 #undef TAG_TAB_3 #undef TAG_TAB_4 } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/arbfragparse.c0000644000000000000000000001607013614532424021272 0ustar /* * Mesa 3-D graphics library * Version: 6.2 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define DEBUG_FP 0 /** * \file arbfragparse.c * ARB_fragment_program parser. * \author Karl Rasche */ #include "glheader.h" #include "context.h" #include "imports.h" #include "macros.h" #include "mtypes.h" #include "program.h" #include "arbprogparse.h" #include "arbfragparse.h" void _mesa_debug_fp_inst(GLint num, struct fp_instruction *fp) { GLint a; static const char *opcode_string[] = { "ABS", /* ARB_f_p only */ "ADD", "CMP", /* ARB_f_p only */ "COS", "DDX", /* NV_f_p only */ "DDY", /* NV_f_p only */ "DP3", "DP4", "DPH", /* ARB_f_p only */ "DST", "END", /* private opcode */ "EX2", "FLR", "FRC", "KIL", /* ARB_f_p only */ "KIL_NV", /* NV_f_p only */ "LG2", "LIT", "LRP", "MAD", "MAX", "MIN", "MOV", "MUL", "PK2H", /* NV_f_p only */ "PK2US", /* NV_f_p only */ "PK4B", /* NV_f_p only */ "PK4UB", /* NV_f_p only */ "POW", "PRINT", /* Mesa only */ "RCP", "RFL", /* NV_f_p only */ "RSQ", "SCS", /* ARB_f_p only */ "SEQ", /* NV_f_p only */ "SFL", /* NV_f_p only */ "SGE", /* NV_f_p only */ "SGT", /* NV_f_p only */ "SIN", "SLE", /* NV_f_p only */ "SLT", "SNE", /* NV_f_p only */ "STR", /* NV_f_p only */ "SUB", "SWZ", /* ARB_f_p only */ "TEX", "TXB", /* ARB_f_p only */ "TXD", /* NV_f_p only */ "TXP", /* ARB_f_p only */ "TXP_NV", /* NV_f_p only */ "UP2H", /* NV_f_p only */ "UP2US", /* NV_f_p only */ "UP4B", /* NV_f_p only */ "UP4UB", /* NV_f_p only */ "X2D", /* NV_f_p only - 2d mat mul */ "XPD", /* ARB_f_p only - cross product */ }; static const char *file_string[] = { "TEMP", "INPUT", "OUTPUT", "LOCAL", "ENV", "NAMED", "STATE", "WRITE_ONLY", "ADDR" }; static const char swz[] = "xyzw01??"; for (a=0; aBase.String = ap.Base.String; program->Base.NumInstructions = ap.Base.NumInstructions; program->Base.NumTemporaries = ap.Base.NumTemporaries; program->Base.NumParameters = ap.Base.NumParameters; program->Base.NumAttributes = ap.Base.NumAttributes; program->Base.NumAddressRegs = ap.Base.NumAddressRegs; program->NumAluInstructions = ap.NumAluInstructions; program->NumTexInstructions = ap.NumTexInstructions; program->NumTexIndirections = ap.NumTexIndirections; program->InputsRead = ap.InputsRead; program->OutputsWritten = ap.OutputsWritten; for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) program->TexturesUsed[i] = ap.TexturesUsed[i]; if (program->Parameters) { /* free previous program's parameters */ _mesa_free_parameter_list(program->Parameters); } program->Parameters = ap.Parameters; program->FogOption = ap.FogOption; #if DEBUG_FP _mesa_debug_fp_inst(ap.Base.NumInstructions, ap.FPInstructions); #endif program->Instructions = ap.FPInstructions; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/arbfragparse.h0000644000000000000000000000277313614532424021304 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ARBFRAGPARSE_H #define ARBFRAGPARSE_H #include "mtypes.h" extern void _mesa_parse_arb_fragment_program(GLcontext * ctx, GLenum target, const GLubyte * str, GLsizei len, struct fragment_program *program); extern void _mesa_debug_fp_inst(GLint num, struct fp_instruction *fp); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/arbprogparse.c0000644000000000000000000037223113614532424021326 0ustar /* * Mesa 3-D graphics library * Version: 6.4 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define DEBUG_PARSING 0 /** * \file arbprogparse.c * ARB_*_program parser core * \author Karl Rasche */ #include "mtypes.h" #include "glheader.h" #include "context.h" #include "hash.h" #include "imports.h" #include "macros.h" #include "program.h" #include "nvvertprog.h" #include "nvfragprog.h" #include "arbprogparse.h" #include "grammar_mesa.h" #include "dispatch.h" #ifndef __extension__ #if !defined(__GNUC__) || (__GNUC__ < 2) || \ ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 7)) # define __extension__ #endif #endif /* TODO: * Fragment Program Stuff: * ----------------------------------------------------- * * - things from Michal's email * + overflow on atoi * + not-overflowing floats (don't use parse_integer..) * + can remove range checking in arbparse.c * * - check all limits of number of various variables * + parameters * * - test! test! test! * * Vertex Program Stuff: * ----------------------------------------------------- * - Optimize param array usage and count limits correctly, see spec, * section 2.14.3.7 * + Record if an array is reference absolutly or relatively (or both) * + For absolute arrays, store a bitmap of accesses * + For single parameters, store an access flag * + After parsing, make a parameter cleanup and merging pass, where * relative arrays are layed out first, followed by abs arrays, and * finally single state. * + Remap offsets for param src and dst registers * + Now we can properly count parameter usage * * - Multiple state binding errors in param arrays (see spec, just before * section 2.14.3.3) * - grep for XXX * * Mesa Stuff * ----------------------------------------------------- * - User clipping planes vs. PositionInvariant * - Is it sufficient to just multiply by the mvp to transform in the * PositionInvariant case? Or do we need something more involved? * * - vp_src swizzle is GLubyte, fp_src swizzle is GLuint * - fetch state listed in program_parameters list * + WTF should this go??? * + currently in nvvertexec.c and s_nvfragprog.c * * - allow for multiple address registers (and fetch address regs properly) * * Cosmetic Stuff * ----------------------------------------------------- * - remove any leftover unused grammer.c stuff (dict_ ?) * - fix grammer.c error handling so its not static * - #ifdef around stuff pertaining to extentions * * Outstanding Questions: * ----------------------------------------------------- * - ARB_matrix_palette / ARB_vertex_blend -- not supported * what gets hacked off because of this: * + VERTEX_ATTRIB_MATRIXINDEX * + VERTEX_ATTRIB_WEIGHT * + MATRIX_MODELVIEW * + MATRIX_PALETTE * * - When can we fetch env/local params from their own register files, and * when to we have to fetch them into the main state register file? * (think arrays) * * Grammar Changes: * ----------------------------------------------------- */ /* Changes since moving the file to shader directory 2004-III-4 ------------------------------------------------------------ - added #include "grammar_mesa.h" - removed grammar specific code part (it resides now in grammar.c) - added GL_ARB_fragment_program_shadow tokens - modified #include "arbparse_syn.h" - major changes inside _mesa_parse_arb_program() - check the program string for '\0' characters - copy the program string to a one-byte-longer location to have it null-terminated - position invariance test (not writing to result.position) moved to syntax part */ typedef GLubyte *production; /** * This is the text describing the rules to parse the grammar */ __extension__ static char arb_grammar_text[] = #include "arbprogram_syn.h" ; /** * These should match up with the values defined in arbprogram.syn */ /* Changes: - changed and merged V_* and F_* opcode values to OP_*. - added GL_ARB_fragment_program_shadow specific tokens (michal) */ #define REVISION 0x09 /* program type */ #define FRAGMENT_PROGRAM 0x01 #define VERTEX_PROGRAM 0x02 /* program section */ #define OPTION 0x01 #define INSTRUCTION 0x02 #define DECLARATION 0x03 #define END 0x04 /* GL_ARB_fragment_program option */ #define ARB_PRECISION_HINT_FASTEST 0x00 #define ARB_PRECISION_HINT_NICEST 0x01 #define ARB_FOG_EXP 0x02 #define ARB_FOG_EXP2 0x03 #define ARB_FOG_LINEAR 0x04 /* GL_ARB_vertex_program option */ #define ARB_POSITION_INVARIANT 0x05 /* GL_ARB_fragment_program_shadow option */ #define ARB_FRAGMENT_PROGRAM_SHADOW 0x06 /* GL_ARB_draw_buffers option */ #define ARB_DRAW_BUFFERS 0x07 /* GL_ARB_fragment_program instruction class */ #define OP_ALU_INST 0x00 #define OP_TEX_INST 0x01 /* GL_ARB_vertex_program instruction class */ /* OP_ALU_INST */ /* GL_ARB_fragment_program instruction type */ #define OP_ALU_VECTOR 0x00 #define OP_ALU_SCALAR 0x01 #define OP_ALU_BINSC 0x02 #define OP_ALU_BIN 0x03 #define OP_ALU_TRI 0x04 #define OP_ALU_SWZ 0x05 #define OP_TEX_SAMPLE 0x06 #define OP_TEX_KIL 0x07 /* GL_ARB_vertex_program instruction type */ #define OP_ALU_ARL 0x08 /* OP_ALU_VECTOR */ /* OP_ALU_SCALAR */ /* OP_ALU_BINSC */ /* OP_ALU_BIN */ /* OP_ALU_TRI */ /* OP_ALU_SWZ */ /* GL_ARB_fragment_program instruction code */ #define OP_ABS 0x00 #define OP_ABS_SAT 0x1B #define OP_FLR 0x09 #define OP_FLR_SAT 0x26 #define OP_FRC 0x0A #define OP_FRC_SAT 0x27 #define OP_LIT 0x0C #define OP_LIT_SAT 0x2A #define OP_MOV 0x11 #define OP_MOV_SAT 0x30 #define OP_COS 0x1F #define OP_COS_SAT 0x20 #define OP_EX2 0x07 #define OP_EX2_SAT 0x25 #define OP_LG2 0x0B #define OP_LG2_SAT 0x29 #define OP_RCP 0x14 #define OP_RCP_SAT 0x33 #define OP_RSQ 0x15 #define OP_RSQ_SAT 0x34 #define OP_SIN 0x38 #define OP_SIN_SAT 0x39 #define OP_SCS 0x35 #define OP_SCS_SAT 0x36 #define OP_POW 0x13 #define OP_POW_SAT 0x32 #define OP_ADD 0x01 #define OP_ADD_SAT 0x1C #define OP_DP3 0x03 #define OP_DP3_SAT 0x21 #define OP_DP4 0x04 #define OP_DP4_SAT 0x22 #define OP_DPH 0x05 #define OP_DPH_SAT 0x23 #define OP_DST 0x06 #define OP_DST_SAT 0x24 #define OP_MAX 0x0F #define OP_MAX_SAT 0x2E #define OP_MIN 0x10 #define OP_MIN_SAT 0x2F #define OP_MUL 0x12 #define OP_MUL_SAT 0x31 #define OP_SGE 0x16 #define OP_SGE_SAT 0x37 #define OP_SLT 0x17 #define OP_SLT_SAT 0x3A #define OP_SUB 0x18 #define OP_SUB_SAT 0x3B #define OP_XPD 0x1A #define OP_XPD_SAT 0x43 #define OP_CMP 0x1D #define OP_CMP_SAT 0x1E #define OP_LRP 0x2B #define OP_LRP_SAT 0x2C #define OP_MAD 0x0E #define OP_MAD_SAT 0x2D #define OP_SWZ 0x19 #define OP_SWZ_SAT 0x3C #define OP_TEX 0x3D #define OP_TEX_SAT 0x3E #define OP_TXB 0x3F #define OP_TXB_SAT 0x40 #define OP_TXP 0x41 #define OP_TXP_SAT 0x42 #define OP_KIL 0x28 /* GL_ARB_vertex_program instruction code */ #define OP_ARL 0x02 /* OP_ABS */ /* OP_FLR */ /* OP_FRC */ /* OP_LIT */ /* OP_MOV */ /* OP_EX2 */ #define OP_EXP 0x08 /* OP_LG2 */ #define OP_LOG 0x0D /* OP_RCP */ /* OP_RSQ */ /* OP_POW */ /* OP_ADD */ /* OP_DP3 */ /* OP_DP4 */ /* OP_DPH */ /* OP_DST */ /* OP_MAX */ /* OP_MIN */ /* OP_MUL */ /* OP_SGE */ /* OP_SLT */ /* OP_SUB */ /* OP_XPD */ /* OP_MAD */ /* OP_SWZ */ /* fragment attribute binding */ #define FRAGMENT_ATTRIB_COLOR 0x01 #define FRAGMENT_ATTRIB_TEXCOORD 0x02 #define FRAGMENT_ATTRIB_FOGCOORD 0x03 #define FRAGMENT_ATTRIB_POSITION 0x04 /* vertex attribute binding */ #define VERTEX_ATTRIB_POSITION 0x01 #define VERTEX_ATTRIB_WEIGHT 0x02 #define VERTEX_ATTRIB_NORMAL 0x03 #define VERTEX_ATTRIB_COLOR 0x04 #define VERTEX_ATTRIB_FOGCOORD 0x05 #define VERTEX_ATTRIB_TEXCOORD 0x06 #define VERTEX_ATTRIB_MATRIXINDEX 0x07 #define VERTEX_ATTRIB_GENERIC 0x08 /* fragment result binding */ #define FRAGMENT_RESULT_COLOR 0x01 #define FRAGMENT_RESULT_DEPTH 0x02 /* vertex result binding */ #define VERTEX_RESULT_POSITION 0x01 #define VERTEX_RESULT_COLOR 0x02 #define VERTEX_RESULT_FOGCOORD 0x03 #define VERTEX_RESULT_POINTSIZE 0x04 #define VERTEX_RESULT_TEXCOORD 0x05 /* texture target */ #define TEXTARGET_1D 0x01 #define TEXTARGET_2D 0x02 #define TEXTARGET_3D 0x03 #define TEXTARGET_RECT 0x04 #define TEXTARGET_CUBE 0x05 /* GL_ARB_fragment_program_shadow */ #define TEXTARGET_SHADOW1D 0x06 #define TEXTARGET_SHADOW2D 0x07 #define TEXTARGET_SHADOWRECT 0x08 /* face type */ #define FACE_FRONT 0x00 #define FACE_BACK 0x01 /* color type */ #define COLOR_PRIMARY 0x00 #define COLOR_SECONDARY 0x01 /* component */ #define COMPONENT_X 0x00 #define COMPONENT_Y 0x01 #define COMPONENT_Z 0x02 #define COMPONENT_W 0x03 #define COMPONENT_0 0x04 #define COMPONENT_1 0x05 /* array index type */ #define ARRAY_INDEX_ABSOLUTE 0x00 #define ARRAY_INDEX_RELATIVE 0x01 /* matrix name */ #define MATRIX_MODELVIEW 0x01 #define MATRIX_PROJECTION 0x02 #define MATRIX_MVP 0x03 #define MATRIX_TEXTURE 0x04 #define MATRIX_PALETTE 0x05 #define MATRIX_PROGRAM 0x06 /* matrix modifier */ #define MATRIX_MODIFIER_IDENTITY 0x00 #define MATRIX_MODIFIER_INVERSE 0x01 #define MATRIX_MODIFIER_TRANSPOSE 0x02 #define MATRIX_MODIFIER_INVTRANS 0x03 /* constant type */ #define CONSTANT_SCALAR 0x01 #define CONSTANT_VECTOR 0x02 /* program param type */ #define PROGRAM_PARAM_ENV 0x01 #define PROGRAM_PARAM_LOCAL 0x02 /* register type */ #define REGISTER_ATTRIB 0x01 #define REGISTER_PARAM 0x02 #define REGISTER_RESULT 0x03 #define REGISTER_ESTABLISHED_NAME 0x04 /* param binding */ #define PARAM_NULL 0x00 #define PARAM_ARRAY_ELEMENT 0x01 #define PARAM_STATE_ELEMENT 0x02 #define PARAM_PROGRAM_ELEMENT 0x03 #define PARAM_PROGRAM_ELEMENTS 0x04 #define PARAM_CONSTANT 0x05 /* param state property */ #define STATE_MATERIAL_PARSER 0x01 #define STATE_LIGHT_PARSER 0x02 #define STATE_LIGHT_MODEL 0x03 #define STATE_LIGHT_PROD 0x04 #define STATE_FOG 0x05 #define STATE_MATRIX_ROWS 0x06 /* GL_ARB_fragment_program */ #define STATE_TEX_ENV 0x07 #define STATE_DEPTH 0x08 /* GL_ARB_vertex_program */ #define STATE_TEX_GEN 0x09 #define STATE_CLIP_PLANE 0x0A #define STATE_POINT 0x0B /* state material property */ #define MATERIAL_AMBIENT 0x01 #define MATERIAL_DIFFUSE 0x02 #define MATERIAL_SPECULAR 0x03 #define MATERIAL_EMISSION 0x04 #define MATERIAL_SHININESS 0x05 /* state light property */ #define LIGHT_AMBIENT 0x01 #define LIGHT_DIFFUSE 0x02 #define LIGHT_SPECULAR 0x03 #define LIGHT_POSITION 0x04 #define LIGHT_ATTENUATION 0x05 #define LIGHT_HALF 0x06 #define LIGHT_SPOT_DIRECTION 0x07 /* state light model property */ #define LIGHT_MODEL_AMBIENT 0x01 #define LIGHT_MODEL_SCENECOLOR 0x02 /* state light product property */ #define LIGHT_PROD_AMBIENT 0x01 #define LIGHT_PROD_DIFFUSE 0x02 #define LIGHT_PROD_SPECULAR 0x03 /* state texture environment property */ #define TEX_ENV_COLOR 0x01 /* state texture generation coord property */ #define TEX_GEN_EYE 0x01 #define TEX_GEN_OBJECT 0x02 /* state fog property */ #define FOG_COLOR 0x01 #define FOG_PARAMS 0x02 /* state depth property */ #define DEPTH_RANGE 0x01 /* state point parameters property */ #define POINT_SIZE 0x01 #define POINT_ATTENUATION 0x02 /* declaration */ #define ATTRIB 0x01 #define PARAM 0x02 #define TEMP 0x03 #define OUTPUT 0x04 #define ALIAS 0x05 /* GL_ARB_vertex_program */ #define ADDRESS 0x06 /*----------------------------------------------------------------------- * From here on down is the semantic checking portion * */ /** * Variable Table Handling functions */ typedef enum { vt_none, vt_address, vt_attrib, vt_param, vt_temp, vt_output, vt_alias } var_type; /* * Setting an explicit field for each of the binding properties is a bit wasteful * of space, but it should be much more clear when reading later on.. */ struct var_cache { GLubyte *name; var_type type; GLuint address_binding; /* The index of the address register we should * be using */ GLuint attrib_binding; /* For type vt_attrib, see nvfragprog.h for values */ GLuint attrib_binding_idx; /* The index into the attrib register file corresponding * to the state in attrib_binding */ GLuint attrib_is_generic; /* If the attrib was specified through a generic * vertex attrib */ GLuint temp_binding; /* The index of the temp register we are to use */ GLuint output_binding; /* For type vt_output, see nvfragprog.h for values */ GLuint output_binding_idx; /* This is the index into the result register file * corresponding to the bound result state */ struct var_cache *alias_binding; /* For type vt_alias, points to the var_cache entry * that this is aliased to */ GLuint param_binding_type; /* {PROGRAM_STATE_VAR, PROGRAM_LOCAL_PARAM, * PROGRAM_ENV_PARAM} */ GLuint param_binding_begin; /* This is the offset into the program_parameter_list where * the tokens representing our bound state (or constants) * start */ GLuint param_binding_length; /* This is how many entries in the the program_parameter_list * we take up with our state tokens or constants. Note that * this is _not_ the same as the number of param registers * we eventually use */ struct var_cache *next; }; static GLvoid var_cache_create (struct var_cache **va) { *va = (struct var_cache *) _mesa_malloc (sizeof (struct var_cache)); if (*va) { (**va).name = NULL; (**va).type = vt_none; (**va).attrib_binding = ~0; (**va).attrib_is_generic = 0; (**va).temp_binding = ~0; (**va).output_binding = ~0; (**va).output_binding_idx = ~0; (**va).param_binding_type = ~0; (**va).param_binding_begin = ~0; (**va).param_binding_length = ~0; (**va).alias_binding = NULL; (**va).next = NULL; } } static GLvoid var_cache_destroy (struct var_cache **va) { if (*va) { var_cache_destroy (&(**va).next); _mesa_free (*va); *va = NULL; } } static GLvoid var_cache_append (struct var_cache **va, struct var_cache *nv) { if (*va) var_cache_append (&(**va).next, nv); else *va = nv; } static struct var_cache * var_cache_find (struct var_cache *va, GLubyte * name) { /*struct var_cache *first = va;*/ while (va) { if (!strcmp ( (const char*) name, (const char*) va->name)) { if (va->type == vt_alias) return va->alias_binding; return va; } va = va->next; } return NULL; } /** * constructs an integer from 4 GLubytes in LE format */ static GLuint parse_position (GLubyte ** inst) { GLuint value; value = (GLuint) (*(*inst)++); value += (GLuint) (*(*inst)++) * 0x100; value += (GLuint) (*(*inst)++) * 0x10000; value += (GLuint) (*(*inst)++) * 0x1000000; return value; } /** * This will, given a string, lookup the string as a variable name in the * var cache. If the name is found, the var cache node corresponding to the * var name is returned. If it is not found, a new entry is allocated * * \param I Points into the binary array where the string identifier begins * \param found 1 if the string was found in the var_cache, 0 if it was allocated * \return The location on the var_cache corresponding the the string starting at I */ static struct var_cache * parse_string (GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, GLuint * found) { GLubyte *i = *inst; struct var_cache *va = NULL; (void) Program; *inst += _mesa_strlen ((char *) i) + 1; va = var_cache_find (*vc_head, i); if (va) { *found = 1; return va; } *found = 0; var_cache_create (&va); va->name = i; var_cache_append (vc_head, va); return va; } static char * parse_string_without_adding (GLubyte ** inst, struct arb_program *Program) { GLubyte *i = *inst; (void) Program; *inst += _mesa_strlen ((char *) i) + 1; return (char *) i; } /** * \return -1 if we parse '-', return 1 otherwise */ static GLint parse_sign (GLubyte ** inst) { /*return *(*inst)++ != '+'; */ if (**inst == '-') { (*inst)++; return -1; } else if (**inst == '+') { (*inst)++; return 1; } return 1; } /** * parses and returns signed integer */ static GLint parse_integer (GLubyte ** inst, struct arb_program *Program) { GLint sign; GLint value; /* check if *inst points to '+' or '-' * if yes, grab the sign and increment *inst */ sign = parse_sign (inst); /* now check if *inst points to 0 * if yes, increment the *inst and return the default value */ if (**inst == 0) { (*inst)++; return 0; } /* parse the integer as you normally would do it */ value = _mesa_atoi (parse_string_without_adding (inst, Program)); /* now, after terminating 0 there is a position * to parse it - parse_position() */ Program->Position = parse_position (inst); return value * sign; } /** Accumulate this string of digits, and return them as a large integer represented in floating point (for range). If scale is not NULL, also accumulates a power-of-ten integer scale factor that represents the number of digits in the string. */ static GLdouble parse_float_string(GLubyte ** inst, struct arb_program *Program, GLdouble *scale) { GLdouble value = 0.0; GLdouble oscale = 1.0; if (**inst == 0) { /* this string of digits is empty-- do nothing */ (*inst)++; } else { /* nonempty string-- parse out the digits */ while (**inst >= '0' && **inst <= '9') { GLubyte digit = *((*inst)++); value = value * 10.0 + (GLint) (digit - '0'); oscale *= 10.0; } assert(**inst == 0); /* integer string should end with 0 */ (*inst)++; /* skip over terminating 0 */ Program->Position = parse_position(inst); /* skip position (from integer) */ } if (scale) *scale = oscale; return value; } /** Parse an unsigned floating-point number from this stream of tokenized characters. Example floating-point formats supported: 12.34 12 0.34 .34 12.34e-4 */ static GLfloat parse_float (GLubyte ** inst, struct arb_program *Program) { GLint exponent; GLdouble whole, fraction, fracScale = 1.0; whole = parse_float_string(inst, Program, 0); fraction = parse_float_string(inst, Program, &fracScale); /* Parse signed exponent */ exponent = parse_integer(inst, Program); /* This is the exponent */ /* Assemble parts of floating-point number: */ return (GLfloat) ((whole + fraction / fracScale) * _mesa_pow(10.0, (GLfloat) exponent)); } /** */ static GLfloat parse_signed_float (GLubyte ** inst, struct arb_program *Program) { GLint sign = parse_sign (inst); GLfloat value = parse_float (inst, Program); return value * sign; } /** * This picks out a constant value from the parsed array. The constant vector is r * returned in the *values array, which should be of length 4. * * \param values - The 4 component vector with the constant value in it */ static GLvoid parse_constant (GLubyte ** inst, GLfloat *values, struct arb_program *Program, GLboolean use) { GLuint components, i; switch (*(*inst)++) { case CONSTANT_SCALAR: if (use == GL_TRUE) { values[0] = values[1] = values[2] = values[3] = parse_float (inst, Program); } else { values[0] = values[1] = values[2] = values[3] = parse_signed_float (inst, Program); } break; case CONSTANT_VECTOR: values[0] = values[1] = values[2] = 0; values[3] = 1; components = *(*inst)++; for (i = 0; i < components; i++) { values[i] = parse_signed_float (inst, Program); } break; } } /** * \param offset The offset from the address register that we should * address * * \return 0 on sucess, 1 on error */ static GLuint parse_relative_offset (GLcontext *ctx, GLubyte **inst, struct arb_program *Program, GLint *offset) { *offset = parse_integer(inst, Program); return 0; } /** * \param color 0 if color type is primary, 1 if color type is secondary * \return 0 on sucess, 1 on error */ static GLuint parse_color_type (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program, GLint * color) { (void) ctx; (void) Program; *color = *(*inst)++ != COLOR_PRIMARY; return 0; } /** * Get an integer corresponding to a generic vertex attribute. * * \return 0 on sucess, 1 on error */ static GLuint parse_generic_attrib_num(GLcontext *ctx, GLubyte ** inst, struct arb_program *Program, GLuint *attrib) { GLint i = parse_integer(inst, Program); if ((i < 0) || (i > MAX_VERTEX_PROGRAM_ATTRIBS)) { _mesa_set_program_error (ctx, Program->Position, "Invalid generic vertex attribute index"); _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid generic vertex attribute index"); return 1; } *attrib = (GLuint) i; return 0; } /** * \param color The index of the color buffer to write into * \return 0 on sucess, 1 on error */ static GLuint parse_output_color_num (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program, GLuint * color) { GLint i = parse_integer (inst, Program); if ((i < 0) || (i >= (int)ctx->Const.MaxDrawBuffers)) { _mesa_set_program_error (ctx, Program->Position, "Invalid draw buffer index"); _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid draw buffer index"); return 1; } *color = (GLuint) i; return 0; } /** * \param coord The texture unit index * \return 0 on sucess, 1 on error */ static GLuint parse_texcoord_num (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program, GLuint * coord) { GLint i = parse_integer (inst, Program); if ((i < 0) || (i >= (int)ctx->Const.MaxTextureUnits)) { _mesa_set_program_error (ctx, Program->Position, "Invalid texture unit index"); _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid texture unit index"); return 1; } *coord = (GLuint) i; return 0; } /** * \param coord The weight index * \return 0 on sucess, 1 on error */ static GLuint parse_weight_num (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program, GLint * coord) { *coord = parse_integer (inst, Program); if ((*coord < 0) || (*coord >= 1)) { _mesa_set_program_error (ctx, Program->Position, "Invalid weight index"); _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid weight index"); return 1; } return 0; } /** * \param coord The clip plane index * \return 0 on sucess, 1 on error */ static GLuint parse_clipplane_num (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program, GLint * coord) { *coord = parse_integer (inst, Program); if ((*coord < 0) || (*coord >= (GLint) ctx->Const.MaxClipPlanes)) { _mesa_set_program_error (ctx, Program->Position, "Invalid clip plane index"); _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid clip plane index"); return 1; } return 0; } /** * \return 0 on front face, 1 on back face */ static GLuint parse_face_type (GLubyte ** inst) { switch (*(*inst)++) { case FACE_FRONT: return 0; case FACE_BACK: return 1; } return 0; } /** * Given a matrix and a modifier token on the binary array, return tokens * that _mesa_fetch_state() [program.c] can understand. * * \param matrix - the matrix we are talking about * \param matrix_idx - the index of the matrix we have (for texture & program matricies) * \param matrix_modifier - the matrix modifier (trans, inv, etc) * \return 0 on sucess, 1 on failure */ static GLuint parse_matrix (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program, GLint * matrix, GLint * matrix_idx, GLint * matrix_modifier) { GLubyte mat = *(*inst)++; *matrix_idx = 0; switch (mat) { case MATRIX_MODELVIEW: *matrix = STATE_MODELVIEW; *matrix_idx = parse_integer (inst, Program); if (*matrix_idx > 0) { _mesa_set_program_error (ctx, Program->Position, "ARB_vertex_blend not supported\n"); _mesa_error (ctx, GL_INVALID_OPERATION, "ARB_vertex_blend not supported\n"); return 1; } break; case MATRIX_PROJECTION: *matrix = STATE_PROJECTION; break; case MATRIX_MVP: *matrix = STATE_MVP; break; case MATRIX_TEXTURE: *matrix = STATE_TEXTURE; *matrix_idx = parse_integer (inst, Program); if (*matrix_idx >= (GLint) ctx->Const.MaxTextureUnits) { _mesa_set_program_error (ctx, Program->Position, "Invalid Texture Unit"); _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid Texture Unit: %d", *matrix_idx); return 1; } break; /* This is not currently supported (ARB_matrix_palette) */ case MATRIX_PALETTE: *matrix_idx = parse_integer (inst, Program); _mesa_set_program_error (ctx, Program->Position, "ARB_matrix_palette not supported\n"); _mesa_error (ctx, GL_INVALID_OPERATION, "ARB_matrix_palette not supported\n"); return 1; break; case MATRIX_PROGRAM: *matrix = STATE_PROGRAM; *matrix_idx = parse_integer (inst, Program); if (*matrix_idx >= (GLint) ctx->Const.MaxProgramMatrices) { _mesa_set_program_error (ctx, Program->Position, "Invalid Program Matrix"); _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid Program Matrix: %d", *matrix_idx); return 1; } break; } switch (*(*inst)++) { case MATRIX_MODIFIER_IDENTITY: *matrix_modifier = 0; break; case MATRIX_MODIFIER_INVERSE: *matrix_modifier = STATE_MATRIX_INVERSE; break; case MATRIX_MODIFIER_TRANSPOSE: *matrix_modifier = STATE_MATRIX_TRANSPOSE; break; case MATRIX_MODIFIER_INVTRANS: *matrix_modifier = STATE_MATRIX_INVTRANS; break; } return 0; } /** * This parses a state string (rather, the binary version of it) into * a 6-token sequence as described in _mesa_fetch_state() [program.c] * * \param inst - the start in the binary arry to start working from * \param state_tokens - the storage for the 6-token state description * \return - 0 on sucess, 1 on error */ static GLuint parse_state_single_item (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program, GLint * state_tokens) { switch (*(*inst)++) { case STATE_MATERIAL_PARSER: state_tokens[0] = STATE_MATERIAL; state_tokens[1] = parse_face_type (inst); switch (*(*inst)++) { case MATERIAL_AMBIENT: state_tokens[2] = STATE_AMBIENT; break; case MATERIAL_DIFFUSE: state_tokens[2] = STATE_DIFFUSE; break; case MATERIAL_SPECULAR: state_tokens[2] = STATE_SPECULAR; break; case MATERIAL_EMISSION: state_tokens[2] = STATE_EMISSION; break; case MATERIAL_SHININESS: state_tokens[2] = STATE_SHININESS; break; } break; case STATE_LIGHT_PARSER: state_tokens[0] = STATE_LIGHT; state_tokens[1] = parse_integer (inst, Program); /* Check the value of state_tokens[1] against the # of lights */ if (state_tokens[1] >= (GLint) ctx->Const.MaxLights) { _mesa_set_program_error (ctx, Program->Position, "Invalid Light Number"); _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid Light Number: %d", state_tokens[1]); return 1; } switch (*(*inst)++) { case LIGHT_AMBIENT: state_tokens[2] = STATE_AMBIENT; break; case LIGHT_DIFFUSE: state_tokens[2] = STATE_DIFFUSE; break; case LIGHT_SPECULAR: state_tokens[2] = STATE_SPECULAR; break; case LIGHT_POSITION: state_tokens[2] = STATE_POSITION; break; case LIGHT_ATTENUATION: state_tokens[2] = STATE_ATTENUATION; break; case LIGHT_HALF: state_tokens[2] = STATE_HALF; break; case LIGHT_SPOT_DIRECTION: state_tokens[2] = STATE_SPOT_DIRECTION; break; } break; case STATE_LIGHT_MODEL: switch (*(*inst)++) { case LIGHT_MODEL_AMBIENT: state_tokens[0] = STATE_LIGHTMODEL_AMBIENT; break; case LIGHT_MODEL_SCENECOLOR: state_tokens[0] = STATE_LIGHTMODEL_SCENECOLOR; state_tokens[1] = parse_face_type (inst); break; } break; case STATE_LIGHT_PROD: state_tokens[0] = STATE_LIGHTPROD; state_tokens[1] = parse_integer (inst, Program); /* Check the value of state_tokens[1] against the # of lights */ if (state_tokens[1] >= (GLint) ctx->Const.MaxLights) { _mesa_set_program_error (ctx, Program->Position, "Invalid Light Number"); _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid Light Number: %d", state_tokens[1]); return 1; } state_tokens[2] = parse_face_type (inst); switch (*(*inst)++) { case LIGHT_PROD_AMBIENT: state_tokens[3] = STATE_AMBIENT; break; case LIGHT_PROD_DIFFUSE: state_tokens[3] = STATE_DIFFUSE; break; case LIGHT_PROD_SPECULAR: state_tokens[3] = STATE_SPECULAR; break; } break; case STATE_FOG: switch (*(*inst)++) { case FOG_COLOR: state_tokens[0] = STATE_FOG_COLOR; break; case FOG_PARAMS: state_tokens[0] = STATE_FOG_PARAMS; break; } break; case STATE_TEX_ENV: state_tokens[1] = parse_integer (inst, Program); switch (*(*inst)++) { case TEX_ENV_COLOR: state_tokens[0] = STATE_TEXENV_COLOR; break; } break; case STATE_TEX_GEN: { GLuint type, coord; state_tokens[0] = STATE_TEXGEN; /*state_tokens[1] = parse_integer (inst, Program);*/ /* Texture Unit */ if (parse_texcoord_num (ctx, inst, Program, &coord)) return 1; state_tokens[1] = coord; /* EYE or OBJECT */ type = *(*inst++); /* 0 - s, 1 - t, 2 - r, 3 - q */ coord = *(*inst++); if (type == TEX_GEN_EYE) { switch (coord) { case COMPONENT_X: state_tokens[2] = STATE_TEXGEN_EYE_S; break; case COMPONENT_Y: state_tokens[2] = STATE_TEXGEN_EYE_T; break; case COMPONENT_Z: state_tokens[2] = STATE_TEXGEN_EYE_R; break; case COMPONENT_W: state_tokens[2] = STATE_TEXGEN_EYE_Q; break; } } else { switch (coord) { case COMPONENT_X: state_tokens[2] = STATE_TEXGEN_OBJECT_S; break; case COMPONENT_Y: state_tokens[2] = STATE_TEXGEN_OBJECT_T; break; case COMPONENT_Z: state_tokens[2] = STATE_TEXGEN_OBJECT_R; break; case COMPONENT_W: state_tokens[2] = STATE_TEXGEN_OBJECT_Q; break; } } } break; case STATE_DEPTH: switch (*(*inst)++) { case DEPTH_RANGE: state_tokens[0] = STATE_DEPTH_RANGE; break; } break; case STATE_CLIP_PLANE: state_tokens[0] = STATE_CLIPPLANE; state_tokens[1] = parse_integer (inst, Program); if (parse_clipplane_num (ctx, inst, Program, &state_tokens[1])) return 1; break; case STATE_POINT: switch (*(*inst++)) { case POINT_SIZE: state_tokens[0] = STATE_POINT_SIZE; break; case POINT_ATTENUATION: state_tokens[0] = STATE_POINT_ATTENUATION; break; } break; /* XXX: I think this is the correct format for a matrix row */ case STATE_MATRIX_ROWS: state_tokens[0] = STATE_MATRIX; if (parse_matrix (ctx, inst, Program, &state_tokens[1], &state_tokens[2], &state_tokens[5])) return 1; state_tokens[3] = parse_integer (inst, Program); /* The first row to grab */ if ((**inst) != 0) { /* Either the last row, 0 */ state_tokens[4] = parse_integer (inst, Program); if (state_tokens[4] < state_tokens[3]) { _mesa_set_program_error (ctx, Program->Position, "Second matrix index less than the first"); _mesa_error (ctx, GL_INVALID_OPERATION, "Second matrix index (%d) less than the first (%d)", state_tokens[4], state_tokens[3]); return 1; } } else { state_tokens[4] = state_tokens[3]; (*inst)++; } break; } return 0; } /** * This parses a state string (rather, the binary version of it) into * a 6-token similar for the state fetching code in program.c * * One might ask, why fetch these parameters into just like you fetch * state when they are already stored in other places? * * Because of array offsets -> We can stick env/local parameters in the * middle of a parameter array and then index someplace into the array * when we execute. * * One optimization might be to only do this for the cases where the * env/local parameters end up inside of an array, and leave the * single parameters (or arrays of pure env/local pareameters) in their * respective register files. * * For ENV parameters, the format is: * state_tokens[0] = STATE_FRAGMENT_PROGRAM / STATE_VERTEX_PROGRAM * state_tokens[1] = STATE_ENV * state_tokens[2] = the parameter index * * for LOCAL parameters, the format is: * state_tokens[0] = STATE_FRAGMENT_PROGRAM / STATE_VERTEX_PROGRAM * state_tokens[1] = STATE_LOCAL * state_tokens[2] = the parameter index * * \param inst - the start in the binary arry to start working from * \param state_tokens - the storage for the 6-token state description * \return - 0 on sucess, 1 on failure */ static GLuint parse_program_single_item (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program, GLint * state_tokens) { if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) state_tokens[0] = STATE_FRAGMENT_PROGRAM; else state_tokens[0] = STATE_VERTEX_PROGRAM; switch (*(*inst)++) { case PROGRAM_PARAM_ENV: state_tokens[1] = STATE_ENV; state_tokens[2] = parse_integer (inst, Program); /* Check state_tokens[2] against the number of ENV parameters available */ if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) && (state_tokens[2] >= (GLint) ctx->Const.MaxFragmentProgramEnvParams)) || ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) && (state_tokens[2] >= (GLint) ctx->Const.MaxVertexProgramEnvParams))) { _mesa_set_program_error (ctx, Program->Position, "Invalid Program Env Parameter"); _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid Program Env Parameter: %d", state_tokens[2]); return 1; } break; case PROGRAM_PARAM_LOCAL: state_tokens[1] = STATE_LOCAL; state_tokens[2] = parse_integer (inst, Program); /* Check state_tokens[2] against the number of LOCAL parameters available */ if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) && (state_tokens[2] >= (GLint) ctx->Const.MaxFragmentProgramLocalParams)) || ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) && (state_tokens[2] >= (GLint) ctx->Const.MaxVertexProgramLocalParams))) { _mesa_set_program_error (ctx, Program->Position, "Invalid Program Local Parameter"); _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid Program Local Parameter: %d", state_tokens[2]); return 1; } break; } return 0; } /** * For ARB_vertex_program, programs are not allowed to use both an explicit * vertex attribute and a generic vertex attribute corresponding to the same * state. See section 2.14.3.1 of the GL_ARB_vertex_program spec. * * This will walk our var_cache and make sure that nobody does anything fishy. * * \return 0 on sucess, 1 on error */ static GLuint generic_attrib_check(struct var_cache *vc_head) { int a; struct var_cache *curr; GLboolean explicitAttrib[MAX_VERTEX_PROGRAM_ATTRIBS], genericAttrib[MAX_VERTEX_PROGRAM_ATTRIBS]; for (a=0; atype == vt_attrib) { if (curr->attrib_is_generic) genericAttrib[ curr->attrib_binding_idx ] = GL_TRUE; else explicitAttrib[ curr->attrib_binding_idx ] = GL_TRUE; } curr = curr->next; } for (a=0; aBase.Target == GL_FRAGMENT_PROGRAM_ARB) { switch (*(*inst)++) { case FRAGMENT_ATTRIB_COLOR: err = parse_color_type (ctx, inst, Program, &coord); *binding = FRAG_ATTRIB_COL0 + coord; *binding_idx = 1 + coord; break; case FRAGMENT_ATTRIB_TEXCOORD: err = parse_texcoord_num (ctx, inst, Program, &texcoord); *binding = FRAG_ATTRIB_TEX0 + texcoord; *binding_idx = 4 + texcoord; break; case FRAGMENT_ATTRIB_FOGCOORD: *binding = FRAG_ATTRIB_FOGC; *binding_idx = 3; break; case FRAGMENT_ATTRIB_POSITION: *binding = FRAG_ATTRIB_WPOS; *binding_idx = 0; break; default: err = 1; break; } } else { switch (*(*inst)++) { case VERTEX_ATTRIB_POSITION: *binding = VERT_ATTRIB_POS; *binding_idx = 0; break; case VERTEX_ATTRIB_WEIGHT: { GLint weight; err = parse_weight_num (ctx, inst, Program, &weight); *binding = VERT_ATTRIB_WEIGHT; *binding_idx = 1; } _mesa_set_program_error (ctx, Program->Position, "ARB_vertex_blend not supported\n"); _mesa_error (ctx, GL_INVALID_OPERATION, "ARB_vertex_blend not supported\n"); return 1; break; case VERTEX_ATTRIB_NORMAL: *binding = VERT_ATTRIB_NORMAL; *binding_idx = 2; break; case VERTEX_ATTRIB_COLOR: { GLint color; err = parse_color_type (ctx, inst, Program, &color); if (color) { *binding = VERT_ATTRIB_COLOR1; *binding_idx = 4; } else { *binding = VERT_ATTRIB_COLOR0; *binding_idx = 3; } } break; case VERTEX_ATTRIB_FOGCOORD: *binding = VERT_ATTRIB_FOG; *binding_idx = 5; break; case VERTEX_ATTRIB_TEXCOORD: { GLuint unit; err = parse_texcoord_num (ctx, inst, Program, &unit); *binding = VERT_ATTRIB_TEX0 + unit; *binding_idx = 8 + unit; } break; /* It looks like we don't support this at all, atm */ case VERTEX_ATTRIB_MATRIXINDEX: parse_integer (inst, Program); _mesa_set_program_error (ctx, Program->Position, "ARB_palette_matrix not supported"); _mesa_error (ctx, GL_INVALID_OPERATION, "ARB_palette_matrix not supported"); return 1; break; case VERTEX_ATTRIB_GENERIC: { GLuint attrib; if (!parse_generic_attrib_num(ctx, inst, Program, &attrib)) { *is_generic = 1; switch (attrib) { case 0: *binding = VERT_ATTRIB_POS; break; case 1: *binding = VERT_ATTRIB_WEIGHT; break; case 2: *binding = VERT_ATTRIB_NORMAL; break; case 3: *binding = VERT_ATTRIB_COLOR0; break; case 4: *binding = VERT_ATTRIB_COLOR1; break; case 5: *binding = VERT_ATTRIB_FOG; break; case 6: break; case 7: break; default: *binding = VERT_ATTRIB_TEX0 + (attrib-8); break; } *binding_idx = attrib; } } break; default: err = 1; break; } } /* Can this even happen? */ if (err) { _mesa_set_program_error (ctx, Program->Position, "Bad attribute binding"); _mesa_error (ctx, GL_INVALID_OPERATION, "Bad attribute binding"); } Program->InputsRead |= (1 << *binding_idx); return err; } /** * This translates between a binary token for an output variable type * and the mesa token for the same thing. * * * XXX: What is the 'name' for vertex program state? -> do we need it? * I don't think we do; * * See nvfragprog.h for definitions * * \param inst - The parsed tokens * \param binding - The name of the state we are binding too * \param binding_idx - The index into the result register file that this is bound too * * See nvfragparse.c for the register file layout for fragment programs * See nvvertparse.c for the register file layout for vertex programs */ static GLuint parse_result_binding (GLcontext * ctx, GLubyte ** inst, GLuint * binding, GLuint * binding_idx, struct arb_program *Program) { GLuint b, out_color; switch (*(*inst)++) { case FRAGMENT_RESULT_COLOR: /* for frag programs, this is FRAGMENT_RESULT_COLOR */ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { /* This gets result of the color buffer we're supposed to * draw into */ parse_output_color_num(ctx, inst, Program, &out_color); *binding = FRAG_OUTPUT_COLR; /* XXX: We're ignoring the color buffer for now. */ *binding_idx = 0; } /* for vtx programs, this is VERTEX_RESULT_POSITION */ else { *binding_idx = 0; } break; case FRAGMENT_RESULT_DEPTH: /* for frag programs, this is FRAGMENT_RESULT_DEPTH */ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { *binding = FRAG_OUTPUT_DEPR; *binding_idx = 2; } /* for vtx programs, this is VERTEX_RESULT_COLOR */ else { GLint color_type; GLuint face_type = parse_face_type(inst); GLint color_type_ret = parse_color_type(ctx, inst, Program, &color_type); /* back face */ if (face_type) { if (color_type_ret) return 1; /* secondary color */ if (color_type) { *binding_idx = 4; } /* primary color */ else { *binding_idx = 3; } } /* front face */ else { /* secondary color */ if (color_type) { *binding_idx = 2; } /* primary color */ else { *binding_idx = 1; } } } break; case VERTEX_RESULT_FOGCOORD: *binding_idx = 5; break; case VERTEX_RESULT_POINTSIZE: *binding_idx = 6; break; case VERTEX_RESULT_TEXCOORD: if (parse_texcoord_num (ctx, inst, Program, &b)) return 1; *binding_idx = 7 + b; break; } Program->OutputsWritten |= (1 << *binding_idx); return 0; } /** * This handles the declaration of ATTRIB variables * * XXX: Still needs * parse_vert_attrib_binding(), or something like that * * \return 0 on sucess, 1 on error */ static GLint parse_attrib (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program) { GLuint found; char *error_msg; struct var_cache *attrib_var; attrib_var = parse_string (inst, vc_head, Program, &found); Program->Position = parse_position (inst); if (found) { error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) attrib_var->name) + 40); _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", attrib_var->name); _mesa_set_program_error (ctx, Program->Position, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); _mesa_free (error_msg); return 1; } attrib_var->type = vt_attrib; /* I think this is ok now - karl */ /* XXX: */ /*if (Program->type == GL_FRAGMENT_PROGRAM_ARB) */ { if (parse_attrib_binding (ctx, inst, Program, &attrib_var->attrib_binding, &attrib_var->attrib_binding_idx, &attrib_var->attrib_is_generic)) return 1; if (generic_attrib_check(*vc_head)) { _mesa_set_program_error (ctx, Program->Position, "Cannot use both a generic vertex attribute and a specific attribute of the same type"); _mesa_error (ctx, GL_INVALID_OPERATION, "Cannot use both a generic vertex attribute and a specific attribute of the same type"); return 1; } } Program->Base.NumAttributes++; return 0; } /** * \param use -- TRUE if we're called when declaring implicit parameters, * FALSE if we're declaraing variables. This has to do with * if we get a signed or unsigned float for scalar constants */ static GLuint parse_param_elements (GLcontext * ctx, GLubyte ** inst, struct var_cache *param_var, struct arb_program *Program, GLboolean use) { GLint idx; GLuint err; GLint state_tokens[6]; GLfloat const_values[4]; err = 0; switch (*(*inst)++) { case PARAM_STATE_ELEMENT: if (parse_state_single_item (ctx, inst, Program, state_tokens)) return 1; /* If we adding STATE_MATRIX that has multiple rows, we need to * unroll it and call _mesa_add_state_reference() for each row */ if ((state_tokens[0] == STATE_MATRIX) && (state_tokens[3] != state_tokens[4])) { GLint row; GLint first_row = state_tokens[3]; GLint last_row = state_tokens[4]; for (row = first_row; row <= last_row; row++) { state_tokens[3] = state_tokens[4] = row; idx = _mesa_add_state_reference (Program->Parameters, state_tokens); if (param_var->param_binding_begin == ~0U) param_var->param_binding_begin = idx; param_var->param_binding_length++; Program->Base.NumParameters++; } } else { idx = _mesa_add_state_reference (Program->Parameters, state_tokens); if (param_var->param_binding_begin == ~0U) param_var->param_binding_begin = idx; param_var->param_binding_length++; Program->Base.NumParameters++; } break; case PARAM_PROGRAM_ELEMENT: if (parse_program_single_item (ctx, inst, Program, state_tokens)) return 1; idx = _mesa_add_state_reference (Program->Parameters, state_tokens); if (param_var->param_binding_begin == ~0U) param_var->param_binding_begin = idx; param_var->param_binding_length++; Program->Base.NumParameters++; /* Check if there is more: 0 -> we're done, else its an integer */ if (**inst) { GLuint out_of_range, new_idx; GLuint start_idx = state_tokens[2] + 1; GLuint end_idx = parse_integer (inst, Program); out_of_range = 0; if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { if (((state_tokens[1] == STATE_ENV) && (end_idx >= ctx->Const.MaxFragmentProgramEnvParams)) || ((state_tokens[1] == STATE_LOCAL) && (end_idx >= ctx->Const.MaxFragmentProgramLocalParams))) out_of_range = 1; } else { if (((state_tokens[1] == STATE_ENV) && (end_idx >= ctx->Const.MaxVertexProgramEnvParams)) || ((state_tokens[1] == STATE_LOCAL) && (end_idx >= ctx->Const.MaxVertexProgramLocalParams))) out_of_range = 1; } if (out_of_range) { _mesa_set_program_error (ctx, Program->Position, "Invalid Program Parameter"); _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid Program Parameter: %d", end_idx); return 1; } for (new_idx = start_idx; new_idx <= end_idx; new_idx++) { state_tokens[2] = new_idx; idx = _mesa_add_state_reference (Program->Parameters, state_tokens); param_var->param_binding_length++; Program->Base.NumParameters++; } } else { (*inst)++; } break; case PARAM_CONSTANT: parse_constant (inst, const_values, Program, use); idx = _mesa_add_named_constant (Program->Parameters, (char *) param_var->name, const_values); if (param_var->param_binding_begin == ~0U) param_var->param_binding_begin = idx; param_var->param_binding_length++; Program->Base.NumParameters++; break; default: _mesa_set_program_error (ctx, Program->Position, "Unexpected token in parse_param_elements()"); _mesa_error (ctx, GL_INVALID_OPERATION, "Unexpected token in parse_param_elements()"); return 1; } /* Make sure we haven't blown past our parameter limits */ if (((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) && (Program->Base.NumParameters >= ctx->Const.MaxVertexProgramLocalParams)) || ((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) && (Program->Base.NumParameters >= ctx->Const.MaxFragmentProgramLocalParams))) { _mesa_set_program_error (ctx, Program->Position, "Too many parameter variables"); _mesa_error (ctx, GL_INVALID_OPERATION, "Too many parameter variables"); return 1; } return err; } /** * This picks out PARAM program parameter bindings. * * XXX: This needs to be stressed & tested * * \return 0 on sucess, 1 on error */ static GLuint parse_param (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program) { GLuint found, err; GLint specified_length; char *error_msg; struct var_cache *param_var; err = 0; param_var = parse_string (inst, vc_head, Program, &found); Program->Position = parse_position (inst); if (found) { error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) param_var->name) + 40); _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", param_var->name); _mesa_set_program_error (ctx, Program->Position, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); _mesa_free (error_msg); return 1; } specified_length = parse_integer (inst, Program); if (specified_length < 0) { _mesa_set_program_error (ctx, Program->Position, "Negative parameter array length"); _mesa_error (ctx, GL_INVALID_OPERATION, "Negative parameter array length: %d", specified_length); return 1; } param_var->type = vt_param; param_var->param_binding_length = 0; /* Right now, everything is shoved into the main state register file. * * In the future, it would be nice to leave things ENV/LOCAL params * in their respective register files, if possible */ param_var->param_binding_type = PROGRAM_STATE_VAR; /* Remember to: * * - add each guy to the parameter list * * - increment the param_var->param_binding_len * * - store the param_var->param_binding_begin for the first one * * - compare the actual len to the specified len at the end */ while (**inst != PARAM_NULL) { if (parse_param_elements (ctx, inst, param_var, Program, GL_FALSE)) return 1; } /* Test array length here! */ if (specified_length) { if (specified_length != (int)param_var->param_binding_length) { _mesa_set_program_error (ctx, Program->Position, "Declared parameter array length does not match parameter list"); _mesa_error (ctx, GL_INVALID_OPERATION, "Declared parameter array length does not match parameter list"); } } (*inst)++; return 0; } /** * */ static GLuint parse_param_use (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, struct var_cache **new_var) { struct var_cache *param_var; /* First, insert a dummy entry into the var_cache */ var_cache_create (¶m_var); param_var->name = (GLubyte *) _mesa_strdup (" "); param_var->type = vt_param; param_var->param_binding_length = 0; /* Don't fill in binding_begin; We use the default value of -1 * to tell if its already initialized, elsewhere. * * param_var->param_binding_begin = 0; */ param_var->param_binding_type = PROGRAM_STATE_VAR; var_cache_append (vc_head, param_var); /* Then fill it with juicy parameter goodness */ if (parse_param_elements (ctx, inst, param_var, Program, GL_TRUE)) return 1; *new_var = param_var; return 0; } /** * This handles the declaration of TEMP variables * * \return 0 on sucess, 1 on error */ static GLuint parse_temp (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program) { GLuint found; struct var_cache *temp_var; char *error_msg; while (**inst != 0) { temp_var = parse_string (inst, vc_head, Program, &found); Program->Position = parse_position (inst); if (found) { error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", temp_var->name); _mesa_set_program_error (ctx, Program->Position, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); _mesa_free (error_msg); return 1; } temp_var->type = vt_temp; if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) && (Program->Base.NumTemporaries >= ctx->Const.MaxFragmentProgramTemps)) || ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) && (Program->Base.NumTemporaries >= ctx->Const.MaxVertexProgramTemps))) { _mesa_set_program_error (ctx, Program->Position, "Too many TEMP variables declared"); _mesa_error (ctx, GL_INVALID_OPERATION, "Too many TEMP variables declared"); return 1; } temp_var->temp_binding = Program->Base.NumTemporaries; Program->Base.NumTemporaries++; } (*inst)++; return 0; } /** * This handles variables of the OUTPUT variety * * \return 0 on sucess, 1 on error */ static GLuint parse_output (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program) { GLuint found; struct var_cache *output_var; output_var = parse_string (inst, vc_head, Program, &found); Program->Position = parse_position (inst); if (found) { char *error_msg; error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) output_var->name) + 40); _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", output_var->name); _mesa_set_program_error (ctx, Program->Position, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); _mesa_free (error_msg); return 1; } output_var->type = vt_output; return parse_result_binding (ctx, inst, &output_var->output_binding, &output_var->output_binding_idx, Program); } /** * This handles variables of the ALIAS kind * * \return 0 on sucess, 1 on error */ static GLuint parse_alias (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program) { GLuint found; struct var_cache *temp_var; char *error_msg; temp_var = parse_string (inst, vc_head, Program, &found); Program->Position = parse_position (inst); if (found) { error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", temp_var->name); _mesa_set_program_error (ctx, Program->Position, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); _mesa_free (error_msg); return 1; } temp_var->type = vt_alias; temp_var->alias_binding = parse_string (inst, vc_head, Program, &found); Program->Position = parse_position (inst); if (!found) { error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); _mesa_sprintf (error_msg, "Alias value %s is not defined", temp_var->alias_binding->name); _mesa_set_program_error (ctx, Program->Position, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); _mesa_free (error_msg); return 1; } return 0; } /** * This handles variables of the ADDRESS kind * * \return 0 on sucess, 1 on error */ static GLuint parse_address (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program) { GLuint found; struct var_cache *temp_var; char *error_msg; while (**inst != 0) { temp_var = parse_string (inst, vc_head, Program, &found); Program->Position = parse_position (inst); if (found) { error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", temp_var->name); _mesa_set_program_error (ctx, Program->Position, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, error_msg); _mesa_free (error_msg); return 1; } temp_var->type = vt_address; if (Program->Base.NumAddressRegs >= ctx->Const.MaxVertexProgramAddressRegs) { _mesa_set_program_error (ctx, Program->Position, "Too many ADDRESS variables declared"); _mesa_error (ctx, GL_INVALID_OPERATION, "Too many ADDRESS variables declared"); return 1; } temp_var->address_binding = Program->Base.NumAddressRegs; Program->Base.NumAddressRegs++; } (*inst)++; return 0; } /** * Parse a program declaration * * \return 0 on sucess, 1 on error */ static GLint parse_declaration (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program) { GLint err = 0; switch (*(*inst)++) { case ADDRESS: err = parse_address (ctx, inst, vc_head, Program); break; case ALIAS: err = parse_alias (ctx, inst, vc_head, Program); break; case ATTRIB: err = parse_attrib (ctx, inst, vc_head, Program); break; case OUTPUT: err = parse_output (ctx, inst, vc_head, Program); break; case PARAM: err = parse_param (ctx, inst, vc_head, Program); break; case TEMP: err = parse_temp (ctx, inst, vc_head, Program); break; } return err; } /** * Handle the parsing out of a masked destination register * * If we are a vertex program, make sure we don't write to * result.position of we have specified that the program is * position invariant * * \param File - The register file we write to * \param Index - The register index we write to * \param WriteMask - The mask controlling which components we write (1->write) * * \return 0 on sucess, 1 on error */ static GLuint parse_masked_dst_reg (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, GLint * File, GLint * Index, GLint *WriteMask) { GLuint result, tmp; struct var_cache *dst; /* We either have a result register specified, or a * variable that may or may not be writable */ switch (*(*inst)++) { case REGISTER_RESULT: if (parse_result_binding (ctx, inst, &result, (GLuint *) Index, Program)) return 1; *File = PROGRAM_OUTPUT; break; case REGISTER_ESTABLISHED_NAME: dst = parse_string (inst, vc_head, Program, &result); Program->Position = parse_position (inst); /* If the name has never been added to our symbol table, we're hosed */ if (!result) { _mesa_set_program_error (ctx, Program->Position, "0: Undefined variable"); _mesa_error (ctx, GL_INVALID_OPERATION, "0: Undefined variable: %s", dst->name); return 1; } switch (dst->type) { case vt_output: *File = PROGRAM_OUTPUT; *Index = dst->output_binding_idx; break; case vt_temp: *File = PROGRAM_TEMPORARY; *Index = dst->temp_binding; break; /* If the var type is not vt_output or vt_temp, no go */ default: _mesa_set_program_error (ctx, Program->Position, "Destination register is read only"); _mesa_error (ctx, GL_INVALID_OPERATION, "Destination register is read only: %s", dst->name); return 1; } break; default: _mesa_set_program_error (ctx, Program->Position, "Unexpected opcode in parse_masked_dst_reg()"); _mesa_error (ctx, GL_INVALID_OPERATION, "Unexpected opcode in parse_masked_dst_reg()"); return 1; } /* Position invariance test */ /* This test is done now in syntax portion - when position invariance OPTION is specified, "result.position" rule is disabled so there is no way to write the position */ /*if ((Program->HintPositionInvariant) && (*File == PROGRAM_OUTPUT) && (*Index == 0)) { _mesa_set_program_error (ctx, Program->Position, "Vertex program specified position invariance and wrote vertex position"); _mesa_error (ctx, GL_INVALID_OPERATION, "Vertex program specified position invariance and wrote vertex position"); }*/ /* And then the mask. * w,a -> bit 0 * z,b -> bit 1 * y,g -> bit 2 * x,r -> bit 3 * * ==> Need to reverse the order of bits for this! */ tmp = (GLint) *(*inst)++; *WriteMask = (((tmp>>3) & 0x1) | ((tmp>>1) & 0x2) | ((tmp<<1) & 0x4) | ((tmp<<3) & 0x8)); return 0; } /** * Handle the parsing of a address register * * \param Index - The register index we write to * * \return 0 on sucess, 1 on error */ static GLuint parse_address_reg (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, GLint * Index) { struct var_cache *dst; GLuint result; (void) Index; dst = parse_string (inst, vc_head, Program, &result); Program->Position = parse_position (inst); /* If the name has never been added to our symbol table, we're hosed */ if (!result) { _mesa_set_program_error (ctx, Program->Position, "Undefined variable"); _mesa_error (ctx, GL_INVALID_OPERATION, "Undefined variable: %s", dst->name); return 1; } if (dst->type != vt_address) { _mesa_set_program_error (ctx, Program->Position, "Variable is not of type ADDRESS"); _mesa_error (ctx, GL_INVALID_OPERATION, "Variable: %s is not of type ADDRESS", dst->name); return 1; } return 0; } #if 0 /* unused */ /** * Handle the parsing out of a masked address register * * \param Index - The register index we write to * \param WriteMask - The mask controlling which components we write (1->write) * * \return 0 on sucess, 1 on error */ static GLuint parse_masked_address_reg (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, GLint * Index, GLboolean * WriteMask) { if (parse_address_reg (ctx, inst, vc_head, Program, Index)) return 1; /* This should be 0x8 */ (*inst)++; /* Writemask of .x is implied */ WriteMask[0] = 1; WriteMask[1] = WriteMask[2] = WriteMask[3] = 0; return 0; } #endif /** * Parse out a swizzle mask. * * The values in the input stream are: * COMPONENT_X -> x/r * COMPONENT_Y -> y/g * COMPONENT_Z-> z/b * COMPONENT_W-> w/a * * The values in the output mask are: * 0 -> x/r * 1 -> y/g * 2 -> z/b * 3 -> w/a * * The len parameter allows us to grab 4 components for a vector * swizzle, or just 1 component for a scalar src register selection */ static GLuint parse_swizzle_mask (GLubyte ** inst, GLubyte * mask, GLint len) { GLint a; for (a = 0; a < 4; a++) mask[a] = a; for (a = 0; a < len; a++) { switch (*(*inst)++) { case COMPONENT_X: mask[a] = 0; break; case COMPONENT_Y: mask[a] = 1; break; case COMPONENT_Z: mask[a] = 2; break; case COMPONENT_W: mask[a] = 3; break; } } return 0; } /** */ static GLuint parse_extended_swizzle_mask(GLubyte **inst, GLubyte *mask, GLubyte *negate) { GLint a; GLubyte swz; *negate = 0x0; for (a = 0; a < 4; a++) { if (parse_sign (inst) == -1) *negate |= (1 << a); swz = *(*inst)++; switch (swz) { case COMPONENT_0: mask[a] = SWIZZLE_ZERO; break; case COMPONENT_1: mask[a] = SWIZZLE_ONE; break; case COMPONENT_X: mask[a] = SWIZZLE_X; break; case COMPONENT_Y: mask[a] = SWIZZLE_Y; break; case COMPONENT_Z: mask[a] = SWIZZLE_Z; break; case COMPONENT_W: mask[a] = SWIZZLE_W; break; } #if 0 if (swz == 0) mask[a] = SWIZZLE_ZERO; else if (swz == 1) mask[a] = SWIZZLE_ONE; else mask[a] = swz - 2; #endif } return 0; } static GLuint parse_src_reg (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, GLint * File, GLint * Index, GLboolean *IsRelOffset ) { struct var_cache *src; GLuint binding_state, binding_idx, is_generic, found; GLint offset; *IsRelOffset = 0; /* And the binding for the src */ switch (*(*inst)++) { case REGISTER_ATTRIB: if (parse_attrib_binding (ctx, inst, Program, &binding_state, &binding_idx, &is_generic)) return 1; *File = PROGRAM_INPUT; *Index = binding_idx; /* We need to insert a dummy variable into the var_cache so we can * catch generic vertex attrib aliasing errors */ var_cache_create(&src); src->type = vt_attrib; src->name = (GLubyte *)_mesa_strdup("Dummy Attrib Variable"); src->attrib_binding = binding_state; src->attrib_binding_idx = binding_idx; src->attrib_is_generic = is_generic; var_cache_append(vc_head, src); if (generic_attrib_check(*vc_head)) { _mesa_set_program_error (ctx, Program->Position, "Cannot use both a generic vertex attribute and a specific attribute of the same type"); _mesa_error (ctx, GL_INVALID_OPERATION, "Cannot use both a generic vertex attribute and a specific attribute of the same type"); return 1; } break; case REGISTER_PARAM: switch (**inst) { case PARAM_ARRAY_ELEMENT: (*inst)++; src = parse_string (inst, vc_head, Program, &found); Program->Position = parse_position (inst); if (!found) { _mesa_set_program_error (ctx, Program->Position, "2: Undefined variable"); _mesa_error (ctx, GL_INVALID_OPERATION, "2: Undefined variable: %s", src->name); return 1; } *File = src->param_binding_type; switch (*(*inst)++) { case ARRAY_INDEX_ABSOLUTE: offset = parse_integer (inst, Program); if ((offset < 0) || (offset >= (int)src->param_binding_length)) { _mesa_set_program_error (ctx, Program->Position, "Index out of range"); _mesa_error (ctx, GL_INVALID_OPERATION, "Index %d out of range for %s", offset, src->name); return 1; } *Index = src->param_binding_begin + offset; break; case ARRAY_INDEX_RELATIVE: { GLint addr_reg_idx, rel_off; /* First, grab the address regiseter */ if (parse_address_reg (ctx, inst, vc_head, Program, &addr_reg_idx)) return 1; /* And the .x */ ((*inst)++); ((*inst)++); ((*inst)++); ((*inst)++); /* Then the relative offset */ if (parse_relative_offset(ctx, inst, Program, &rel_off)) return 1; /* And store it properly */ *Index = src->param_binding_begin + rel_off; *IsRelOffset = 1; } break; } break; default: if (parse_param_use (ctx, inst, vc_head, Program, &src)) return 1; *File = src->param_binding_type; *Index = src->param_binding_begin; break; } break; case REGISTER_ESTABLISHED_NAME: src = parse_string (inst, vc_head, Program, &found); Program->Position = parse_position (inst); /* If the name has never been added to our symbol table, we're hosed */ if (!found) { _mesa_set_program_error (ctx, Program->Position, "3: Undefined variable"); _mesa_error (ctx, GL_INVALID_OPERATION, "3: Undefined variable: %s", src->name); return 1; } switch (src->type) { case vt_attrib: *File = PROGRAM_INPUT; *Index = src->attrib_binding_idx; break; /* XXX: We have to handle offsets someplace in here! -- or are those above? */ case vt_param: *File = src->param_binding_type; *Index = src->param_binding_begin; break; case vt_temp: *File = PROGRAM_TEMPORARY; *Index = src->temp_binding; break; /* If the var type is vt_output no go */ default: _mesa_set_program_error (ctx, Program->Position, "destination register is read only"); _mesa_error (ctx, GL_INVALID_OPERATION, "destination register is read only: %s", src->name); return 1; } break; default: _mesa_set_program_error (ctx, Program->Position, "Unknown token in parse_src_reg"); _mesa_error (ctx, GL_INVALID_OPERATION, "Unknown token in parse_src_reg"); return 1; } return 0; } /** */ static GLuint parse_fp_vector_src_reg (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, struct fp_src_register *reg ) { GLint File; GLint Index; GLboolean Negate; GLubyte Swizzle[4]; GLboolean IsRelOffset; /* Grab the sign */ Negate = (parse_sign (inst) == -1) ? 0xf : 0x0; /* And the src reg */ if (parse_src_reg (ctx, inst, vc_head, Program, &File, &Index, &IsRelOffset)) return 1; /* finally, the swizzle */ parse_swizzle_mask (inst, Swizzle, 4); reg->File = File; reg->Index = Index; reg->Abs = 0; /* NV only */ reg->NegateAbs = 0; /* NV only */ reg->NegateBase = Negate; reg->Swizzle = (Swizzle[0] << 0 | Swizzle[1] << 3 | Swizzle[2] << 6 | Swizzle[3] << 9); return 0; } static GLuint parse_fp_dst_reg(GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, struct fp_dst_register *reg ) { GLint file, idx, mask; if (parse_masked_dst_reg (ctx, inst, vc_head, Program, &file, &idx, &mask)) return 1; reg->CondMask = 0; /* NV only */ reg->CondSwizzle = 0; /* NV only */ reg->File = file; reg->Index = idx; reg->WriteMask = mask; return 0; } static GLuint parse_fp_scalar_src_reg (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, struct fp_src_register *reg ) { GLint File; GLint Index; GLboolean Negate; GLubyte Swizzle[4]; GLboolean IsRelOffset; /* Grab the sign */ Negate = (parse_sign (inst) == -1) ? 0x1 : 0x0; /* And the src reg */ if (parse_src_reg (ctx, inst, vc_head, Program, &File, &Index, &IsRelOffset)) return 1; /* finally, the swizzle */ parse_swizzle_mask (inst, Swizzle, 1); reg->File = File; reg->Index = Index; reg->Abs = 0; /* NV only */ reg->NegateAbs = 0; /* NV only */ reg->NegateBase = Negate; reg->Swizzle = (Swizzle[0] << 0); return 0; } /** * This is a big mother that handles getting opcodes into the instruction * and handling the src & dst registers for fragment program instructions */ static GLuint parse_fp_instruction (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, struct fp_instruction *fp) { GLint a; GLuint texcoord; GLubyte instClass, type, code; GLboolean rel; /* No condition codes in ARB_fp */ fp->UpdateCondRegister = 0; /* Record the position in the program string for debugging */ fp->StringPos = Program->Position; fp->Data = NULL; fp->DstReg.File = 0xf; /* mark as undef */ fp->SrcReg[0].File = 0xf; /* mark as undef */ fp->SrcReg[1].File = 0xf; /* mark as undef */ fp->SrcReg[2].File = 0xf; /* mark as undef */ /* OP_ALU_INST or OP_TEX_INST */ instClass = *(*inst)++; /* OP_ALU_{VECTOR, SCALAR, BINSC, BIN, TRI, SWZ}, * OP_TEX_{SAMPLE, KIL} */ type = *(*inst)++; /* The actual opcode name */ code = *(*inst)++; /* Increment the correct count */ switch (instClass) { case OP_ALU_INST: Program->NumAluInstructions++; break; case OP_TEX_INST: Program->NumTexInstructions++; break; } fp->Saturate = 0; fp->Precision = FLOAT32; fp->DstReg.CondMask = COND_TR; switch (type) { case OP_ALU_VECTOR: switch (code) { case OP_ABS_SAT: fp->Saturate = 1; case OP_ABS: fp->Opcode = FP_OPCODE_ABS; break; case OP_FLR_SAT: fp->Saturate = 1; case OP_FLR: fp->Opcode = FP_OPCODE_FLR; break; case OP_FRC_SAT: fp->Saturate = 1; case OP_FRC: fp->Opcode = FP_OPCODE_FRC; break; case OP_LIT_SAT: fp->Saturate = 1; case OP_LIT: fp->Opcode = FP_OPCODE_LIT; break; case OP_MOV_SAT: fp->Saturate = 1; case OP_MOV: fp->Opcode = FP_OPCODE_MOV; break; } if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) return 1; if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) return 1; break; case OP_ALU_SCALAR: switch (code) { case OP_COS_SAT: fp->Saturate = 1; case OP_COS: fp->Opcode = FP_OPCODE_COS; break; case OP_EX2_SAT: fp->Saturate = 1; case OP_EX2: fp->Opcode = FP_OPCODE_EX2; break; case OP_LG2_SAT: fp->Saturate = 1; case OP_LG2: fp->Opcode = FP_OPCODE_LG2; break; case OP_RCP_SAT: fp->Saturate = 1; case OP_RCP: fp->Opcode = FP_OPCODE_RCP; break; case OP_RSQ_SAT: fp->Saturate = 1; case OP_RSQ: fp->Opcode = FP_OPCODE_RSQ; break; case OP_SIN_SAT: fp->Saturate = 1; case OP_SIN: fp->Opcode = FP_OPCODE_SIN; break; case OP_SCS_SAT: fp->Saturate = 1; case OP_SCS: fp->Opcode = FP_OPCODE_SCS; break; } if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) return 1; if (parse_fp_scalar_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) return 1; break; case OP_ALU_BINSC: switch (code) { case OP_POW_SAT: fp->Saturate = 1; case OP_POW: fp->Opcode = FP_OPCODE_POW; break; } if (parse_fp_dst_reg(ctx, inst, vc_head, Program, &fp->DstReg)) return 1; for (a = 0; a < 2; a++) { if (parse_fp_scalar_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) return 1; } break; case OP_ALU_BIN: switch (code) { case OP_ADD_SAT: fp->Saturate = 1; case OP_ADD: fp->Opcode = FP_OPCODE_ADD; break; case OP_DP3_SAT: fp->Saturate = 1; case OP_DP3: fp->Opcode = FP_OPCODE_DP3; break; case OP_DP4_SAT: fp->Saturate = 1; case OP_DP4: fp->Opcode = FP_OPCODE_DP4; break; case OP_DPH_SAT: fp->Saturate = 1; case OP_DPH: fp->Opcode = FP_OPCODE_DPH; break; case OP_DST_SAT: fp->Saturate = 1; case OP_DST: fp->Opcode = FP_OPCODE_DST; break; case OP_MAX_SAT: fp->Saturate = 1; case OP_MAX: fp->Opcode = FP_OPCODE_MAX; break; case OP_MIN_SAT: fp->Saturate = 1; case OP_MIN: fp->Opcode = FP_OPCODE_MIN; break; case OP_MUL_SAT: fp->Saturate = 1; case OP_MUL: fp->Opcode = FP_OPCODE_MUL; break; case OP_SGE_SAT: fp->Saturate = 1; case OP_SGE: fp->Opcode = FP_OPCODE_SGE; break; case OP_SLT_SAT: fp->Saturate = 1; case OP_SLT: fp->Opcode = FP_OPCODE_SLT; break; case OP_SUB_SAT: fp->Saturate = 1; case OP_SUB: fp->Opcode = FP_OPCODE_SUB; break; case OP_XPD_SAT: fp->Saturate = 1; case OP_XPD: fp->Opcode = FP_OPCODE_XPD; break; } if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) return 1; for (a = 0; a < 2; a++) { if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) return 1; } break; case OP_ALU_TRI: switch (code) { case OP_CMP_SAT: fp->Saturate = 1; case OP_CMP: fp->Opcode = FP_OPCODE_CMP; break; case OP_LRP_SAT: fp->Saturate = 1; case OP_LRP: fp->Opcode = FP_OPCODE_LRP; break; case OP_MAD_SAT: fp->Saturate = 1; case OP_MAD: fp->Opcode = FP_OPCODE_MAD; break; } if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) return 1; for (a = 0; a < 3; a++) { if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) return 1; } break; case OP_ALU_SWZ: switch (code) { case OP_SWZ_SAT: fp->Saturate = 1; case OP_SWZ: fp->Opcode = FP_OPCODE_SWZ; break; } if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) return 1; { GLubyte Swizzle[4]; /* FP's swizzle mask is a GLubyte, while VP's is GLuint */ GLubyte negateMask; GLint File, Index; if (parse_src_reg(ctx, inst, vc_head, Program, &File, &Index, &rel)) return 1; parse_extended_swizzle_mask (inst, Swizzle, &negateMask); fp->SrcReg[0].File = File; fp->SrcReg[0].Index = Index; fp->SrcReg[0].NegateBase = negateMask; fp->SrcReg[0].Swizzle = (Swizzle[0] << 0 | Swizzle[1] << 3 | Swizzle[2] << 6 | Swizzle[3] << 9); } break; case OP_TEX_SAMPLE: switch (code) { case OP_TEX_SAT: fp->Saturate = 1; case OP_TEX: fp->Opcode = FP_OPCODE_TEX; break; case OP_TXP_SAT: fp->Saturate = 1; case OP_TXP: fp->Opcode = FP_OPCODE_TXP; break; case OP_TXB_SAT: fp->Saturate = 1; case OP_TXB: fp->Opcode = FP_OPCODE_TXB; break; } if (parse_fp_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) return 1; if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) return 1; /* texImageUnit */ if (parse_texcoord_num (ctx, inst, Program, &texcoord)) return 1; fp->TexSrcUnit = texcoord; /* texTarget */ switch (*(*inst)++) { case TEXTARGET_1D: fp->TexSrcIdx = TEXTURE_1D_INDEX; break; case TEXTARGET_2D: fp->TexSrcIdx = TEXTURE_2D_INDEX; break; case TEXTARGET_3D: fp->TexSrcIdx = TEXTURE_3D_INDEX; break; case TEXTARGET_RECT: fp->TexSrcIdx = TEXTURE_RECT_INDEX; break; case TEXTARGET_CUBE: fp->TexSrcIdx = TEXTURE_CUBE_INDEX; break; case TEXTARGET_SHADOW1D: case TEXTARGET_SHADOW2D: case TEXTARGET_SHADOWRECT: /* TODO ARB_fragment_program_shadow code */ break; } Program->TexturesUsed[texcoord] |= (1<TexSrcIdx); break; case OP_TEX_KIL: if (parse_fp_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) return 1; fp->Opcode = FP_OPCODE_KIL; break; } return 0; } static GLuint parse_vp_dst_reg(GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, struct vp_dst_register *reg ) { GLint file, idx, mask; if (parse_masked_dst_reg(ctx, inst, vc_head, Program, &file, &idx, &mask)) return 1; reg->File = file; reg->Index = idx; reg->WriteMask = mask; return 0; } /** * Handle the parsing out of a masked address register * * \param Index - The register index we write to * \param WriteMask - The mask controlling which components we write (1->write) * * \return 0 on sucess, 1 on error */ static GLuint parse_vp_address_reg (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, struct vp_dst_register *reg) { GLint idx; if (parse_address_reg (ctx, inst, vc_head, Program, &idx)) return 1; /* This should be 0x8 */ (*inst)++; reg->File = PROGRAM_ADDRESS; reg->Index = idx; /* Writemask of .x is implied */ reg->WriteMask = 0x1; return 0; } /** */ static GLuint parse_vp_vector_src_reg (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, struct vp_src_register *reg ) { GLint File; GLint Index; GLboolean Negate; GLubyte Swizzle[4]; GLboolean IsRelOffset; /* Grab the sign */ Negate = (parse_sign (inst) == -1) ? 0xf : 0x0; /* And the src reg */ if (parse_src_reg (ctx, inst, vc_head, Program, &File, &Index, &IsRelOffset)) return 1; /* finally, the swizzle */ parse_swizzle_mask (inst, Swizzle, 4); reg->File = File; reg->Index = Index; reg->Swizzle = ((Swizzle[0] << 0) | (Swizzle[1] << 3) | (Swizzle[2] << 6) | (Swizzle[3] << 9)); reg->Negate = Negate; reg->RelAddr = IsRelOffset; return 0; } static GLuint parse_vp_scalar_src_reg (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, struct vp_src_register *reg ) { GLint File; GLint Index; GLboolean Negate; GLubyte Swizzle[4]; GLboolean IsRelOffset; /* Grab the sign */ Negate = (parse_sign (inst) == -1) ? 0x1 : 0x0; /* And the src reg */ if (parse_src_reg (ctx, inst, vc_head, Program, &File, &Index, &IsRelOffset)) return 1; /* finally, the swizzle */ parse_swizzle_mask (inst, Swizzle, 1); reg->File = File; reg->Index = Index; reg->Swizzle = (Swizzle[0] << 0); reg->Negate = Negate; reg->RelAddr = IsRelOffset; return 0; } /** * This is a big mother that handles getting opcodes into the instruction * and handling the src & dst registers for vertex program instructions */ static GLuint parse_vp_instruction (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program, struct vp_instruction *vp) { GLint a; GLubyte type, code; /* OP_ALU_{ARL, VECTOR, SCALAR, BINSC, BIN, TRI, SWZ} */ type = *(*inst)++; /* The actual opcode name */ code = *(*inst)++; /* Record the position in the program string for debugging */ vp->StringPos = Program->Position; vp->Data = NULL; vp->SrcReg[0].RelAddr = vp->SrcReg[1].RelAddr = vp->SrcReg[2].RelAddr = 0; vp->SrcReg[0].Swizzle = SWIZZLE_NOOP; vp->SrcReg[1].Swizzle = SWIZZLE_NOOP; vp->SrcReg[2].Swizzle = SWIZZLE_NOOP; vp->SrcReg[3].Swizzle = SWIZZLE_NOOP; vp->DstReg.WriteMask = 0xf; switch (type) { /* XXX: */ case OP_ALU_ARL: vp->Opcode = VP_OPCODE_ARL; /* Remember to set SrcReg.RelAddr; */ /* Get the masked address register [dst] */ if (parse_vp_address_reg(ctx, inst, vc_head, Program, &vp->DstReg)) return 1; vp->DstReg.File = PROGRAM_ADDRESS; /* Get a scalar src register */ if (parse_vp_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) return 1; break; case OP_ALU_VECTOR: switch (code) { case OP_ABS: vp->Opcode = VP_OPCODE_ABS; break; case OP_FLR: vp->Opcode = VP_OPCODE_FLR; break; case OP_FRC: vp->Opcode = VP_OPCODE_FRC; break; case OP_LIT: vp->Opcode = VP_OPCODE_LIT; break; case OP_MOV: vp->Opcode = VP_OPCODE_MOV; break; } if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) return 1; if (parse_vp_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) return 1; break; case OP_ALU_SCALAR: switch (code) { case OP_EX2: vp->Opcode = VP_OPCODE_EX2; break; case OP_EXP: vp->Opcode = VP_OPCODE_EXP; break; case OP_LG2: vp->Opcode = VP_OPCODE_LG2; break; case OP_LOG: vp->Opcode = VP_OPCODE_LOG; break; case OP_RCP: vp->Opcode = VP_OPCODE_RCP; break; case OP_RSQ: vp->Opcode = VP_OPCODE_RSQ; break; } if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) return 1; if (parse_vp_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) return 1; break; case OP_ALU_BINSC: switch (code) { case OP_POW: vp->Opcode = VP_OPCODE_POW; break; } if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) return 1; for (a = 0; a < 2; a++) { if (parse_vp_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) return 1; } break; case OP_ALU_BIN: switch (code) { case OP_ADD: vp->Opcode = VP_OPCODE_ADD; break; case OP_DP3: vp->Opcode = VP_OPCODE_DP3; break; case OP_DP4: vp->Opcode = VP_OPCODE_DP4; break; case OP_DPH: vp->Opcode = VP_OPCODE_DPH; break; case OP_DST: vp->Opcode = VP_OPCODE_DST; break; case OP_MAX: vp->Opcode = VP_OPCODE_MAX; break; case OP_MIN: vp->Opcode = VP_OPCODE_MIN; break; case OP_MUL: vp->Opcode = VP_OPCODE_MUL; break; case OP_SGE: vp->Opcode = VP_OPCODE_SGE; break; case OP_SLT: vp->Opcode = VP_OPCODE_SLT; break; case OP_SUB: vp->Opcode = VP_OPCODE_SUB; break; case OP_XPD: vp->Opcode = VP_OPCODE_XPD; break; } if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) return 1; for (a = 0; a < 2; a++) { if (parse_vp_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) return 1; } break; case OP_ALU_TRI: switch (code) { case OP_MAD: vp->Opcode = VP_OPCODE_MAD; break; } if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) return 1; for (a = 0; a < 3; a++) { if (parse_vp_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) return 1; } break; case OP_ALU_SWZ: switch (code) { case OP_SWZ: vp->Opcode = VP_OPCODE_SWZ; break; } { GLubyte Swizzle[4]; /* FP's swizzle mask is a GLubyte, while VP's is GLuint */ GLubyte Negate[4]; GLboolean RelAddr; GLint File, Index; if (parse_vp_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) return 1; if (parse_src_reg(ctx, inst, vc_head, Program, &File, &Index, &RelAddr)) return 1; parse_extended_swizzle_mask (inst, Swizzle, Negate); vp->SrcReg[0].File = File; vp->SrcReg[0].Index = Index; vp->SrcReg[0].Negate = (Negate[0] << 0 | Negate[1] << 1 | Negate[2] << 2 | Negate[3] << 3); vp->SrcReg[0].Swizzle = (Swizzle[0] << 0 | Swizzle[1] << 3 | Swizzle[2] << 6 | Swizzle[3] << 9); vp->SrcReg[0].RelAddr = RelAddr; } break; } return 0; } #if DEBUG_PARSING static GLvoid print_state_token (GLint token) { switch (token) { case STATE_MATERIAL: fprintf (stderr, "STATE_MATERIAL "); break; case STATE_LIGHT: fprintf (stderr, "STATE_LIGHT "); break; case STATE_LIGHTMODEL_AMBIENT: fprintf (stderr, "STATE_AMBIENT "); break; case STATE_LIGHTMODEL_SCENECOLOR: fprintf (stderr, "STATE_SCENECOLOR "); break; case STATE_LIGHTPROD: fprintf (stderr, "STATE_LIGHTPROD "); break; case STATE_TEXGEN: fprintf (stderr, "STATE_TEXGEN "); break; case STATE_FOG_COLOR: fprintf (stderr, "STATE_FOG_COLOR "); break; case STATE_FOG_PARAMS: fprintf (stderr, "STATE_FOG_PARAMS "); break; case STATE_CLIPPLANE: fprintf (stderr, "STATE_CLIPPLANE "); break; case STATE_POINT_SIZE: fprintf (stderr, "STATE_POINT_SIZE "); break; case STATE_POINT_ATTENUATION: fprintf (stderr, "STATE_ATTENUATION "); break; case STATE_MATRIX: fprintf (stderr, "STATE_MATRIX "); break; case STATE_MODELVIEW: fprintf (stderr, "STATE_MODELVIEW "); break; case STATE_PROJECTION: fprintf (stderr, "STATE_PROJECTION "); break; case STATE_MVP: fprintf (stderr, "STATE_MVP "); break; case STATE_TEXTURE: fprintf (stderr, "STATE_TEXTURE "); break; case STATE_PROGRAM: fprintf (stderr, "STATE_PROGRAM "); break; case STATE_MATRIX_INVERSE: fprintf (stderr, "STATE_INVERSE "); break; case STATE_MATRIX_TRANSPOSE: fprintf (stderr, "STATE_TRANSPOSE "); break; case STATE_MATRIX_INVTRANS: fprintf (stderr, "STATE_INVTRANS "); break; case STATE_AMBIENT: fprintf (stderr, "STATE_AMBIENT "); break; case STATE_DIFFUSE: fprintf (stderr, "STATE_DIFFUSE "); break; case STATE_SPECULAR: fprintf (stderr, "STATE_SPECULAR "); break; case STATE_EMISSION: fprintf (stderr, "STATE_EMISSION "); break; case STATE_SHININESS: fprintf (stderr, "STATE_SHININESS "); break; case STATE_HALF: fprintf (stderr, "STATE_HALF "); break; case STATE_POSITION: fprintf (stderr, "STATE_POSITION "); break; case STATE_ATTENUATION: fprintf (stderr, "STATE_ATTENUATION "); break; case STATE_SPOT_DIRECTION: fprintf (stderr, "STATE_DIRECTION "); break; case STATE_TEXGEN_EYE_S: fprintf (stderr, "STATE_TEXGEN_EYE_S "); break; case STATE_TEXGEN_EYE_T: fprintf (stderr, "STATE_TEXGEN_EYE_T "); break; case STATE_TEXGEN_EYE_R: fprintf (stderr, "STATE_TEXGEN_EYE_R "); break; case STATE_TEXGEN_EYE_Q: fprintf (stderr, "STATE_TEXGEN_EYE_Q "); break; case STATE_TEXGEN_OBJECT_S: fprintf (stderr, "STATE_TEXGEN_EYE_S "); break; case STATE_TEXGEN_OBJECT_T: fprintf (stderr, "STATE_TEXGEN_OBJECT_T "); break; case STATE_TEXGEN_OBJECT_R: fprintf (stderr, "STATE_TEXGEN_OBJECT_R "); break; case STATE_TEXGEN_OBJECT_Q: fprintf (stderr, "STATE_TEXGEN_OBJECT_Q "); break; case STATE_TEXENV_COLOR: fprintf (stderr, "STATE_TEXENV_COLOR "); break; case STATE_DEPTH_RANGE: fprintf (stderr, "STATE_DEPTH_RANGE "); break; case STATE_VERTEX_PROGRAM: fprintf (stderr, "STATE_VERTEX_PROGRAM "); break; case STATE_FRAGMENT_PROGRAM: fprintf (stderr, "STATE_FRAGMENT_PROGRAM "); break; case STATE_ENV: fprintf (stderr, "STATE_ENV "); break; case STATE_LOCAL: fprintf (stderr, "STATE_LOCAL "); break; } fprintf (stderr, "[%d] ", token); } static GLvoid debug_variables (GLcontext * ctx, struct var_cache *vc_head, struct arb_program *Program) { struct var_cache *vc; GLint a, b; fprintf (stderr, "debug_variables, vc_head: %x\n", vc_head); /* First of all, print out the contents of the var_cache */ vc = vc_head; while (vc) { fprintf (stderr, "[%x]\n", vc); switch (vc->type) { case vt_none: fprintf (stderr, "UNDEFINED %s\n", vc->name); break; case vt_attrib: fprintf (stderr, "ATTRIB %s\n", vc->name); fprintf (stderr, " binding: 0x%x\n", vc->attrib_binding); break; case vt_param: fprintf (stderr, "PARAM %s begin: %d len: %d\n", vc->name, vc->param_binding_begin, vc->param_binding_length); b = vc->param_binding_begin; for (a = 0; a < vc->param_binding_length; a++) { fprintf (stderr, "%s\n", Program->Parameters->Parameters[a + b].Name); if (Program->Parameters->Parameters[a + b].Type == STATE) { print_state_token (Program->Parameters->Parameters[a + b]. StateIndexes[0]); print_state_token (Program->Parameters->Parameters[a + b]. StateIndexes[1]); print_state_token (Program->Parameters->Parameters[a + b]. StateIndexes[2]); print_state_token (Program->Parameters->Parameters[a + b]. StateIndexes[3]); print_state_token (Program->Parameters->Parameters[a + b]. StateIndexes[4]); print_state_token (Program->Parameters->Parameters[a + b]. StateIndexes[5]); } else fprintf (stderr, "%f %f %f %f\n", Program->Parameters->Parameters[a + b].Values[0], Program->Parameters->Parameters[a + b].Values[1], Program->Parameters->Parameters[a + b].Values[2], Program->Parameters->Parameters[a + b].Values[3]); } break; case vt_temp: fprintf (stderr, "TEMP %s\n", vc->name); fprintf (stderr, " binding: 0x%x\n", vc->temp_binding); break; case vt_output: fprintf (stderr, "OUTPUT %s\n", vc->name); fprintf (stderr, " binding: 0x%x\n", vc->output_binding); break; case vt_alias: fprintf (stderr, "ALIAS %s\n", vc->name); fprintf (stderr, " binding: 0x%x (%s)\n", vc->alias_binding, vc->alias_binding->name); break; } vc = vc->next; } } #endif /** * The main loop for parsing a fragment or vertex program * * \return GL_TRUE on success, GL_FALSE on error. */ static GLboolean parse_arb_program(GLcontext * ctx, GLubyte * inst, struct var_cache **vc_head, struct arb_program *Program) { GLint err = 0; Program->MajorVersion = (GLuint) * inst++; Program->MinorVersion = (GLuint) * inst++; while (*inst != END) { switch (*inst++) { case OPTION: switch (*inst++) { case ARB_PRECISION_HINT_FASTEST: Program->PrecisionOption = GL_FASTEST; break; case ARB_PRECISION_HINT_NICEST: Program->PrecisionOption = GL_NICEST; break; case ARB_FOG_EXP: Program->FogOption = GL_EXP; break; case ARB_FOG_EXP2: Program->FogOption = GL_EXP2; break; case ARB_FOG_LINEAR: Program->FogOption = GL_LINEAR; break; case ARB_POSITION_INVARIANT: if (Program->Base.Target == GL_VERTEX_PROGRAM_ARB) Program->HintPositionInvariant = 1; break; case ARB_FRAGMENT_PROGRAM_SHADOW: if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { /* TODO ARB_fragment_program_shadow code */ } break; case ARB_DRAW_BUFFERS: if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { /* do nothing for now */ } break; } break; case INSTRUCTION: Program->Position = parse_position (&inst); if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { /* Check the instruction count * XXX: Does END count as an instruction? */ if (Program->Base.NumInstructions+1 == MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS) { _mesa_set_program_error (ctx, Program->Position, "Max instruction count exceeded!"); _mesa_error (ctx, GL_INVALID_OPERATION, "Max instruction count exceeded!"); } /* Realloc Program->FPInstructions */ Program->FPInstructions = (struct fp_instruction *) _mesa_realloc (Program->FPInstructions, Program->Base.NumInstructions*sizeof(struct fp_instruction), (Program->Base.NumInstructions+1)*sizeof (struct fp_instruction)); /* parse the current instruction */ err = parse_fp_instruction (ctx, &inst, vc_head, Program, &Program->FPInstructions[Program->Base.NumInstructions]); } else { /* Check the instruction count * XXX: Does END count as an instruction? */ if (Program->Base.NumInstructions+1 == MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS) { _mesa_set_program_error (ctx, Program->Position, "Max instruction count exceeded!"); _mesa_error (ctx, GL_INVALID_OPERATION, "Max instruction count exceeded!"); } /* Realloc Program->VPInstructions */ Program->VPInstructions = (struct vp_instruction *) _mesa_realloc (Program->VPInstructions, Program->Base.NumInstructions*sizeof(struct vp_instruction), (Program->Base.NumInstructions +1)*sizeof(struct vp_instruction)); /* parse the current instruction */ err = parse_vp_instruction (ctx, &inst, vc_head, Program, &Program->VPInstructions[Program->Base.NumInstructions]); } /* increment Program->Base.NumInstructions */ Program->Base.NumInstructions++; break; case DECLARATION: err = parse_declaration (ctx, &inst, vc_head, Program); break; default: break; } if (err) break; } /* Finally, tag on an OPCODE_END instruction */ if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { Program->FPInstructions = (struct fp_instruction *) _mesa_realloc (Program->FPInstructions, Program->Base.NumInstructions*sizeof(struct fp_instruction), (Program->Base.NumInstructions+1)*sizeof(struct fp_instruction)); Program->FPInstructions[Program->Base.NumInstructions].Opcode = FP_OPCODE_END; Program->FPInstructions[Program->Base.NumInstructions].Saturate = 0; Program->FPInstructions[Program->Base.NumInstructions].DstReg.File = 0xf; Program->FPInstructions[Program->Base.NumInstructions].SrcReg[0].File = 0xf; Program->FPInstructions[Program->Base.NumInstructions].SrcReg[1].File = 0xf; Program->FPInstructions[Program->Base.NumInstructions].SrcReg[2].File = 0xf; /* YYY Wrong Position in program, whatever, at least not random -> crash Program->Position = parse_position (&inst); */ Program->FPInstructions[Program->Base.NumInstructions].StringPos = Program->Position; Program->FPInstructions[Program->Base.NumInstructions].Data = NULL; } else { Program->VPInstructions = (struct vp_instruction *) _mesa_realloc (Program->VPInstructions, Program->Base.NumInstructions*sizeof(struct vp_instruction), (Program->Base.NumInstructions+1)*sizeof(struct vp_instruction)); Program->VPInstructions[Program->Base.NumInstructions].Opcode = VP_OPCODE_END; /* YYY Wrong Position in program, whatever, at least not random -> crash Program->Position = parse_position (&inst); */ Program->VPInstructions[Program->Base.NumInstructions].StringPos = Program->Position; Program->VPInstructions[Program->Base.NumInstructions].Data = NULL; } /* increment Program->Base.NumInstructions */ Program->Base.NumInstructions++; return err; } /* XXX temporary */ __extension__ static char core_grammar_text[] = #include "grammar_syn.h" ; static int set_reg8 (GLcontext *ctx, grammar id, const byte *name, byte value) { char error_msg[300]; GLint error_pos; if (grammar_set_reg8 (id, name, value)) return 0; grammar_get_last_error ((byte *) error_msg, 300, &error_pos); _mesa_set_program_error (ctx, error_pos, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, "Grammar Register Error"); return 1; } static int extension_is_supported (const GLubyte *ext) { const GLubyte *extensions = CALL_GetString(GET_DISPATCH(), (GL_EXTENSIONS)); const GLubyte *end = extensions + _mesa_strlen ((const char *) extensions); const GLint ext_len = (GLint)_mesa_strlen ((const char *) ext); while (extensions < end) { const GLubyte *name_end = (const GLubyte *) strchr ((const char *) extensions, ' '); if (name_end == NULL) name_end = end; if (name_end - extensions == ext_len && _mesa_strncmp ((const char *) ext, (const char *) extensions, ext_len) == 0) return 1; extensions = name_end + 1; } return 0; } static int enable_ext (GLcontext *ctx, grammar id, const byte *name, const byte *extname) { if (extension_is_supported (extname)) if (set_reg8 (ctx, id, name, 0x01)) return 1; return 0; } /** * This kicks everything off. * * \param ctx - The GL Context * \param str - The program string * \param len - The program string length * \param program - The arb_program struct to return all the parsed info in * \return GL_TRUE on sucess, GL_FALSE on error */ GLboolean _mesa_parse_arb_program (GLcontext * ctx, const GLubyte * str, GLsizei len, struct arb_program * program) { GLint a, err, error_pos; char error_msg[300]; GLuint parsed_len; struct var_cache *vc_head; grammar arbprogram_syn_id; GLubyte *parsed, *inst; GLubyte *strz = NULL; static int arbprogram_syn_is_ok = 0; /* XXX temporary */ /* Reset error state */ _mesa_set_program_error(ctx, -1, NULL); #if DEBUG_PARSING fprintf (stderr, "Loading grammar text!\n"); #endif /* check if the arb_grammar_text (arbprogram.syn) is syntactically correct */ if (!arbprogram_syn_is_ok) { grammar grammar_syn_id; GLint err; GLuint parsed_len; byte *parsed; grammar_syn_id = grammar_load_from_text ((byte *) core_grammar_text); if (grammar_syn_id == 0) { grammar_get_last_error ((byte *) error_msg, 300, &error_pos); _mesa_set_program_error (ctx, error_pos, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, "Error loading grammar rule set"); return GL_FALSE; } err = grammar_check (grammar_syn_id, (byte *) arb_grammar_text, &parsed, &parsed_len); /* NOTE: we can't destroy grammar_syn_id right here because * grammar_destroy() can reset the last error */ if (err == 0) { grammar_get_last_error ((byte *) error_msg, 300, &error_pos); _mesa_set_program_error (ctx, error_pos, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, "Error loading grammar rule set"); grammar_destroy (grammar_syn_id); return GL_FALSE; } grammar_destroy (grammar_syn_id); arbprogram_syn_is_ok = 1; } /* create the grammar object */ arbprogram_syn_id = grammar_load_from_text ((byte *) arb_grammar_text); if (arbprogram_syn_id == 0) { grammar_get_last_error ((GLubyte *) error_msg, 300, &error_pos); _mesa_set_program_error (ctx, error_pos, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, "Error loading grammer rule set"); return GL_FALSE; } /* Set program_target register value */ if (set_reg8 (ctx, arbprogram_syn_id, (byte *) "program_target", program->Base.Target == GL_FRAGMENT_PROGRAM_ARB ? 0x10 : 0x20)) { grammar_destroy (arbprogram_syn_id); return GL_FALSE; } /* Enable all active extensions */ if (enable_ext (ctx, arbprogram_syn_id, (byte *) "vertex_blend", (byte *) "GL_ARB_vertex_blend") || enable_ext (ctx, arbprogram_syn_id, (byte *) "vertex_blend", (byte *) "GL_EXT_vertex_weighting") || enable_ext (ctx, arbprogram_syn_id, (byte *) "matrix_palette", (byte *) "GL_ARB_matrix_palette") || enable_ext (ctx, arbprogram_syn_id, (byte *) "point_parameters", (byte *) "GL_ARB_point_parameters") || enable_ext (ctx, arbprogram_syn_id, (byte *) "point_parameters", (byte *) "GL_EXT_point_parameters") || enable_ext (ctx, arbprogram_syn_id, (byte *) "secondary_color", (byte *) "GL_EXT_secondary_color") || enable_ext (ctx, arbprogram_syn_id, (byte *) "fog_coord", (byte *) "GL_EXT_fog_coord") || enable_ext (ctx, arbprogram_syn_id, (byte *) "texture_rectangle", (byte *) "GL_ARB_texture_rectangle") || enable_ext (ctx, arbprogram_syn_id, (byte *) "texture_rectangle", (byte *) "GL_EXT_texture_rectangle") || enable_ext (ctx, arbprogram_syn_id, (byte *) "texture_rectangle", (byte *) "GL_NV_texture_rectangle") || enable_ext (ctx, arbprogram_syn_id, (byte *) "fragment_program_shadow", (byte *) "GL_ARB_fragment_program_shadow") || enable_ext (ctx, arbprogram_syn_id, (byte *) "draw_buffers", (byte *) "GL_ARB_draw_buffers")) { grammar_destroy (arbprogram_syn_id); return GL_FALSE; } /* check for NULL character occurences */ { int i; for (i = 0; i < len; i++) if (str[i] == '\0') { _mesa_set_program_error (ctx, i, "invalid character"); _mesa_error (ctx, GL_INVALID_OPERATION, "Lexical Error"); grammar_destroy (arbprogram_syn_id); return GL_FALSE; } } /* copy the program string to a null-terminated string */ strz = (GLubyte *) _mesa_malloc (len + 1); if (!strz) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glprogramStringARB"); return GL_FALSE; } _mesa_memcpy (strz, str, len); strz[len] = '\0'; #if DEBUG_PARSING printf ("Checking Grammar!\n"); #endif /* do a fast check on program string - initial production buffer is 4K */ err = grammar_fast_check (arbprogram_syn_id, strz, &parsed, &parsed_len, 0x1000); /* Syntax parse error */ if (err == 0) { _mesa_free (strz); grammar_get_last_error ((GLubyte *) error_msg, 300, &error_pos); _mesa_set_program_error (ctx, error_pos, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, "glProgramStringARB(syntax error)"); /* useful for debugging */ if (0) { int line, col; char *s; printf("Program: %s\n", (char *) strz); printf("Error Pos: %d\n", ctx->Program.ErrorPos); s = (char *) _mesa_find_line_column(strz, strz+ctx->Program.ErrorPos, &line, &col); printf("line %d col %d: %s\n", line, col, s); } grammar_destroy (arbprogram_syn_id); return 1; } #if DEBUG_PARSING printf ("Destroying grammer dict [parse retval: %d]\n", err); #endif grammar_destroy (arbprogram_syn_id); /* Initialize the arb_program struct */ program->Base.String = strz; program->Base.NumInstructions = program->Base.NumTemporaries = program->Base.NumParameters = program->Base.NumAttributes = program->Base.NumAddressRegs = 0; program->Parameters = _mesa_new_parameter_list (); program->InputsRead = 0; program->OutputsWritten = 0; program->Position = 0; program->MajorVersion = program->MinorVersion = 0; program->PrecisionOption = GL_DONT_CARE; program->FogOption = GL_NONE; program->HintPositionInvariant = GL_FALSE; for (a = 0; a < MAX_TEXTURE_IMAGE_UNITS; a++) program->TexturesUsed[a] = 0; program->NumAluInstructions = program->NumTexInstructions = program->NumTexIndirections = 0; program->FPInstructions = NULL; program->VPInstructions = NULL; vc_head = NULL; err = GL_FALSE; /* Start examining the tokens in the array */ inst = parsed; /* Check the grammer rev */ if (*inst++ != REVISION) { _mesa_set_program_error (ctx, 0, "Grammar version mismatch"); _mesa_error(ctx, GL_INVALID_OPERATION, "glProgramStringARB(Grammar verison mismatch)"); err = GL_TRUE; } else { /* ignore program target */ inst++; err = parse_arb_program (ctx, inst, &vc_head, program); #if DEBUG_PARSING fprintf (stderr, "Symantic analysis returns %d [1 is bad!]\n", err); #endif } /*debug_variables(ctx, vc_head, program); */ /* We're done with the parsed binary array */ var_cache_destroy (&vc_head); _mesa_free (parsed); #if DEBUG_PARSING printf ("_mesa_parse_arb_program() done\n"); #endif return !err; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/arbprogparse.h0000644000000000000000000000466413614532424021335 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ARBPROGPARSE_H #define ARBPROGPARSE_H #include "context.h" #include "mtypes.h" #include "nvvertprog.h" #include "nvfragprog.h" /** * This is basically a union of the vertex_program and fragment_program * structs that we can use to parse the program into * * XXX: this should go into mtypes.h? */ struct arb_program { struct program Base; struct program_parameter_list *Parameters; GLuint InputsRead; GLuint OutputsWritten; GLuint Position; /* Just used for error reporting while parsing */ GLuint MajorVersion; GLuint MinorVersion; /* ARB_vertex_program specifics */ struct vp_instruction *VPInstructions; /* Options currently recognized by the parser */ /* ARB_fp */ GLenum PrecisionOption; /* GL_DONT_CARE, GL_NICEST or GL_FASTEST */ GLenum FogOption; /* GL_NONE, GL_LINEAR, GL_EXP or GL_EXP2 */ /* ARB_fp & _vp */ GLboolean HintPositionInvariant; /* ARB_fragment_program specifics */ struct fp_instruction *FPInstructions; GLuint TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; GLuint NumAluInstructions; GLuint NumTexInstructions; GLuint NumTexIndirections; }; extern GLboolean _mesa_parse_arb_program( GLcontext *ctx, const GLubyte *str, GLsizei len, struct arb_program *program ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/arbprogram.c0000644000000000000000000005544513614532424021000 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file arbprogram.c * ARB_vertex/fragment_program state management functions. * \author Brian Paul */ #include "glheader.h" #include "arbprogram.h" #include "arbfragparse.h" #include "arbvertparse.h" #include "context.h" #include "imports.h" #include "macros.h" #include "mtypes.h" #include "nvprogram.h" #include "nvfragparse.h" #include "nvfragprog.h" #include "nvvertparse.h" #include "nvvertprog.h" void GLAPIENTRY _mesa_EnableVertexAttribArrayARB(GLuint index) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (index >= ctx->Const.MaxVertexProgramAttribs) { _mesa_error(ctx, GL_INVALID_VALUE, "glEnableVertexAttribArrayARB(index)"); return; } FLUSH_VERTICES(ctx, _NEW_ARRAY); ctx->Array.VertexAttrib[index].Enabled = GL_TRUE; ctx->Array._Enabled |= _NEW_ARRAY_ATTRIB(index); ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index); } void GLAPIENTRY _mesa_DisableVertexAttribArrayARB(GLuint index) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (index >= ctx->Const.MaxVertexProgramAttribs) { _mesa_error(ctx, GL_INVALID_VALUE, "glEnableVertexAttribArrayARB(index)"); return; } FLUSH_VERTICES(ctx, _NEW_ARRAY); ctx->Array.VertexAttrib[index].Enabled = GL_FALSE; ctx->Array._Enabled &= ~_NEW_ARRAY_ATTRIB(index); ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index); } void GLAPIENTRY _mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params) { GLfloat fparams[4]; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); _mesa_GetVertexAttribfvARB(index, pname, fparams); if (ctx->ErrorValue == GL_NO_ERROR) { if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { COPY_4V(params, fparams); } else { params[0] = fparams[0]; } } } void GLAPIENTRY _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (index == 0 || index >= MAX_VERTEX_PROGRAM_ATTRIBS) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribfvARB(index)"); return; } switch (pname) { case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB: params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Enabled; break; case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB: params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Size; break; case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB: params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Stride; break; case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB: params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Type; break; case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB: params[0] = ctx->Array.VertexAttrib[index].Normalized; break; case GL_CURRENT_VERTEX_ATTRIB_ARB: FLUSH_CURRENT(ctx, 0); /* XXX should read: COPY_4V(params, ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]); */ COPY_4V(params, ctx->Current.Attrib[index]); break; case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB: if (!ctx->Extensions.ARB_vertex_buffer_object) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribfvARB(pname)"); return; } params[0] = (GLfloat) ctx->Array.VertexAttrib[index].BufferObj->Name; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribfvARB(pname)"); return; } } void GLAPIENTRY _mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params) { GLfloat fparams[4]; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); _mesa_GetVertexAttribfvARB(index, pname, fparams); if (ctx->ErrorValue == GL_NO_ERROR) { if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { COPY_4V_CAST(params, fparams, GLint); /* float to int */ } else { params[0] = (GLint) fparams[0]; } } } void GLAPIENTRY _mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (index >= ctx->Const.MaxVertexProgramAttribs) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribPointerARB(index)"); return; } if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribPointerARB(pname)"); return; } *pointer = (GLvoid *) ctx->Array.VertexAttrib[index].Ptr;; } void GLAPIENTRY _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, const GLvoid *string) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM); if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) { struct vertex_program *prog = ctx->VertexProgram.Current; if (format != GL_PROGRAM_FORMAT_ASCII_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(format)"); return; } _mesa_parse_arb_vertex_program(ctx, target, (const GLubyte *) string, len, prog); if (ctx->Driver.ProgramStringNotify) ctx->Driver.ProgramStringNotify( ctx, target, &prog->Base ); } else if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { struct fragment_program *prog = ctx->FragmentProgram.Current; if (format != GL_PROGRAM_FORMAT_ASCII_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(format)"); return; } _mesa_parse_arb_fragment_program(ctx, target, (const GLubyte *) string, len, prog); if (ctx->Driver.ProgramStringNotify) ctx->Driver.ProgramStringNotify( ctx, target, &prog->Base ); } else { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(target)"); return; } } void GLAPIENTRY _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { _mesa_ProgramEnvParameter4fARB(target, index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } void GLAPIENTRY _mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index, const GLdouble *params) { _mesa_ProgramEnvParameter4fARB(target, index, (GLfloat) params[0], (GLfloat) params[1], (GLfloat) params[2], (GLfloat) params[3]); } void GLAPIENTRY _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM); if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { if (index >= ctx->Const.MaxFragmentProgramEnvParams) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter(index)"); return; } ASSIGN_4V(ctx->FragmentProgram.Parameters[index], x, y, z, w); } else if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) { if (index >= ctx->Const.MaxVertexProgramEnvParams) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter(index)"); return; } ASSIGN_4V(ctx->VertexProgram.Parameters[index], x, y, z, w); } else { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramEnvParameter(target)"); return; } } void GLAPIENTRY _mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index, const GLfloat *params) { _mesa_ProgramEnvParameter4fARB(target, index, params[0], params[1], params[2], params[3]); } void GLAPIENTRY _mesa_GetProgramEnvParameterdvARB(GLenum target, GLuint index, GLdouble *params) { GET_CURRENT_CONTEXT(ctx); GLfloat fparams[4]; _mesa_GetProgramEnvParameterfvARB(target, index, fparams); if (ctx->ErrorValue == GL_NO_ERROR) { params[0] = fparams[0]; params[1] = fparams[1]; params[2] = fparams[2]; params[3] = fparams[3]; } } void GLAPIENTRY _mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM); if (!ctx->_CurrentProgram) ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { if (index >= ctx->Const.MaxFragmentProgramEnvParams) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramEnvParameter(index)"); return; } COPY_4V(params, ctx->FragmentProgram.Parameters[index]); } else if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) { if (index >= ctx->Const.MaxVertexProgramEnvParams) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramEnvParameter(index)"); return; } COPY_4V(params, ctx->VertexProgram.Parameters[index]); } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramEnvParameter(target)"); return; } } /** * Note, this function is also used by the GL_NV_fragment_program extension. */ void GLAPIENTRY _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GET_CURRENT_CONTEXT(ctx); struct program *prog; ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM); if ((target == GL_FRAGMENT_PROGRAM_NV && ctx->Extensions.NV_fragment_program) || (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program)) { if (index >= ctx->Const.MaxFragmentProgramLocalParams) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameterARB"); return; } prog = &(ctx->FragmentProgram.Current->Base); } else if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) { if (index >= ctx->Const.MaxVertexProgramLocalParams) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameterARB"); return; } prog = &(ctx->VertexProgram.Current->Base); } else { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramLocalParameterARB"); return; } ASSERT(index < MAX_PROGRAM_LOCAL_PARAMS); prog->LocalParams[index][0] = x; prog->LocalParams[index][1] = y; prog->LocalParams[index][2] = z; prog->LocalParams[index][3] = w; } /** * Note, this function is also used by the GL_NV_fragment_program extension. */ void GLAPIENTRY _mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index, const GLfloat *params) { _mesa_ProgramLocalParameter4fARB(target, index, params[0], params[1], params[2], params[3]); } /** * Note, this function is also used by the GL_NV_fragment_program extension. */ void GLAPIENTRY _mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { _mesa_ProgramLocalParameter4fARB(target, index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } /** * Note, this function is also used by the GL_NV_fragment_program extension. */ void GLAPIENTRY _mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index, const GLdouble *params) { _mesa_ProgramLocalParameter4fARB(target, index, (GLfloat) params[0], (GLfloat) params[1], (GLfloat) params[2], (GLfloat) params[3]); } /** * Note, this function is also used by the GL_NV_fragment_program extension. */ void GLAPIENTRY _mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index, GLfloat *params) { const struct program *prog; GLuint maxParams; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) { prog = &(ctx->VertexProgram.Current->Base); maxParams = ctx->Const.MaxVertexProgramLocalParams; } else if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { prog = &(ctx->FragmentProgram.Current->Base); maxParams = ctx->Const.MaxFragmentProgramLocalParams; } else if (target == GL_FRAGMENT_PROGRAM_NV && ctx->Extensions.NV_fragment_program) { prog = &(ctx->FragmentProgram.Current->Base); maxParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramLocalParameterARB(target)"); return; } if (index >= maxParams) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramLocalParameterARB(index)"); return; } ASSERT(prog); ASSERT(index < MAX_PROGRAM_LOCAL_PARAMS); COPY_4V(params, prog->LocalParams[index]); } /** * Note, this function is also used by the GL_NV_fragment_program extension. */ void GLAPIENTRY _mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index, GLdouble *params) { GET_CURRENT_CONTEXT(ctx); GLfloat floatParams[4]; _mesa_GetProgramLocalParameterfvARB(target, index, floatParams); if (ctx->ErrorValue == GL_NO_ERROR) { COPY_4V(params, floatParams); } } void GLAPIENTRY _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) { struct program *prog; GET_CURRENT_CONTEXT(ctx); if (!ctx->_CurrentProgram) ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) { prog = &(ctx->VertexProgram.Current->Base); } else if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { prog = &(ctx->FragmentProgram.Current->Base); } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); return; } ASSERT(prog); switch (pname) { case GL_PROGRAM_LENGTH_ARB: *params = prog->String ? (GLint)_mesa_strlen((char *) prog->String) : 0; break; case GL_PROGRAM_FORMAT_ARB: *params = prog->Format; break; case GL_PROGRAM_BINDING_ARB: *params = prog->Id; break; case GL_PROGRAM_INSTRUCTIONS_ARB: *params = prog->NumInstructions; break; case GL_MAX_PROGRAM_INSTRUCTIONS_ARB: if (target == GL_VERTEX_PROGRAM_ARB) *params = ctx->Const.MaxVertexProgramInstructions; else *params = ctx->Const.MaxFragmentProgramInstructions; break; case GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB: *params = prog->NumInstructions; break; case GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB: if (target == GL_VERTEX_PROGRAM_ARB) *params = ctx->Const.MaxVertexProgramInstructions; else *params = ctx->Const.MaxFragmentProgramInstructions; break; case GL_PROGRAM_TEMPORARIES_ARB: *params = prog->NumTemporaries; break; case GL_MAX_PROGRAM_TEMPORARIES_ARB: if (target == GL_VERTEX_PROGRAM_ARB) *params = ctx->Const.MaxVertexProgramTemps; else *params = ctx->Const.MaxFragmentProgramTemps; break; case GL_PROGRAM_NATIVE_TEMPORARIES_ARB: /* XXX same as GL_PROGRAM_TEMPORARIES_ARB? */ *params = prog->NumTemporaries; break; case GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB: /* XXX same as GL_MAX_PROGRAM_TEMPORARIES_ARB? */ if (target == GL_VERTEX_PROGRAM_ARB) *params = ctx->Const.MaxVertexProgramTemps; else *params = ctx->Const.MaxFragmentProgramTemps; break; case GL_PROGRAM_PARAMETERS_ARB: *params = prog->NumParameters; break; case GL_MAX_PROGRAM_PARAMETERS_ARB: if (target == GL_VERTEX_PROGRAM_ARB) *params = ctx->Const.MaxVertexProgramLocalParams; else *params = ctx->Const.MaxFragmentProgramLocalParams; break; case GL_PROGRAM_NATIVE_PARAMETERS_ARB: /* XXX same as GL_MAX_PROGRAM_PARAMETERS_ARB? */ *params = prog->NumParameters; break; case GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB: /* XXX same as GL_MAX_PROGRAM_PARAMETERS_ARB? */ if (target == GL_VERTEX_PROGRAM_ARB) *params = ctx->Const.MaxVertexProgramLocalParams; else *params = ctx->Const.MaxFragmentProgramLocalParams; break; case GL_PROGRAM_ATTRIBS_ARB: *params = prog->NumAttributes; break; case GL_MAX_PROGRAM_ATTRIBS_ARB: if (target == GL_VERTEX_PROGRAM_ARB) *params = ctx->Const.MaxVertexProgramAttribs; else *params = ctx->Const.MaxFragmentProgramAttribs; break; case GL_PROGRAM_NATIVE_ATTRIBS_ARB: /* XXX same as GL_PROGRAM_ATTRIBS_ARB? */ *params = prog->NumAttributes; break; case GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB: /* XXX same as GL_MAX_PROGRAM_ATTRIBS_ARB? */ if (target == GL_VERTEX_PROGRAM_ARB) *params = ctx->Const.MaxVertexProgramAttribs; else *params = ctx->Const.MaxFragmentProgramAttribs; break; case GL_PROGRAM_ADDRESS_REGISTERS_ARB: *params = prog->NumAddressRegs; break; case GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB: if (target == GL_VERTEX_PROGRAM_ARB) *params = ctx->Const.MaxVertexProgramAddressRegs; else *params = ctx->Const.MaxFragmentProgramAddressRegs; break; case GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: /* XXX same as GL_PROGRAM_ADDRESS_REGISTERS_ARB? */ *params = prog->NumAddressRegs; break; case GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: /* XXX same as GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB? */ if (target == GL_VERTEX_PROGRAM_ARB) *params = ctx->Const.MaxVertexProgramAddressRegs; else *params = ctx->Const.MaxFragmentProgramAddressRegs; break; case GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB: if (target == GL_VERTEX_PROGRAM_ARB) *params = ctx->Const.MaxVertexProgramLocalParams; else *params = ctx->Const.MaxFragmentProgramLocalParams; break; case GL_MAX_PROGRAM_ENV_PARAMETERS_ARB: if (target == GL_VERTEX_PROGRAM_ARB) *params = ctx->Const.MaxVertexProgramEnvParams; else *params = ctx->Const.MaxFragmentProgramEnvParams; break; case GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB: if (ctx->Driver.IsProgramNative) *params = ctx->Driver.IsProgramNative( ctx, target, prog ); else *params = GL_TRUE; break; /* * The following apply to fragment programs only. */ case GL_PROGRAM_ALU_INSTRUCTIONS_ARB: case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: if (target != GL_FRAGMENT_PROGRAM_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); return; } *params = ctx->FragmentProgram.Current->NumAluInstructions; break; case GL_PROGRAM_TEX_INSTRUCTIONS_ARB: case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: if (target != GL_FRAGMENT_PROGRAM_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); return; } *params = ctx->FragmentProgram.Current->NumTexInstructions; break; case GL_PROGRAM_TEX_INDIRECTIONS_ARB: case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: if (target != GL_FRAGMENT_PROGRAM_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); return; } *params = ctx->FragmentProgram.Current->NumTexIndirections; break; case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB: case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: if (target != GL_FRAGMENT_PROGRAM_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); return; } *params = ctx->Const.MaxFragmentProgramAluInstructions; break; case GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB: case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: if (target != GL_FRAGMENT_PROGRAM_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); return; } *params = ctx->Const.MaxFragmentProgramTexInstructions; break; case GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB: case GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: if (target != GL_FRAGMENT_PROGRAM_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(target)"); return; } *params = ctx->Const.MaxFragmentProgramTexIndirections; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(pname)"); return; } } void GLAPIENTRY _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string) { struct program *prog; GET_CURRENT_CONTEXT(ctx); if (!ctx->_CurrentProgram) ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_VERTEX_PROGRAM_ARB) { prog = &(ctx->VertexProgram.Current->Base); } else if (target == GL_FRAGMENT_PROGRAM_ARB) { prog = &(ctx->FragmentProgram.Current->Base); } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringARB(target)"); return; } ASSERT(prog); if (pname != GL_PROGRAM_STRING_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringARB(pname)"); return; } MEMCPY(string, prog->String, _mesa_strlen((char *) prog->String)); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/arbprogram.h0000644000000000000000000000754013614532424020776 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ARBPROGRAM_H #define ARBPROGRAM_H extern void GLAPIENTRY _mesa_EnableVertexAttribArrayARB(GLuint index); extern void GLAPIENTRY _mesa_DisableVertexAttribArrayARB(GLuint index); extern void GLAPIENTRY _mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params); extern void GLAPIENTRY _mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params); extern void GLAPIENTRY _mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer); extern void GLAPIENTRY _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, const GLvoid *string); extern void GLAPIENTRY _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); extern void GLAPIENTRY _mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index, const GLdouble *params); extern void GLAPIENTRY _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); extern void GLAPIENTRY _mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index, const GLfloat *params); extern void GLAPIENTRY _mesa_ProgramLocalParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); extern void GLAPIENTRY _mesa_ProgramLocalParameter4dvARB(GLenum target, GLuint index, const GLdouble *params); extern void GLAPIENTRY _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); extern void GLAPIENTRY _mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index, const GLfloat *params); extern void GLAPIENTRY _mesa_GetProgramEnvParameterdvARB(GLenum target, GLuint index, GLdouble *params); extern void GLAPIENTRY _mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index, GLfloat *params); extern void GLAPIENTRY _mesa_GetProgramLocalParameterdvARB(GLenum target, GLuint index, GLdouble *params); extern void GLAPIENTRY _mesa_GetProgramLocalParameterfvARB(GLenum target, GLuint index, GLfloat *params); extern void GLAPIENTRY _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/arbprogram_syn.h0000644000000000000000000015624013614532424021671 0ustar ".syntax program;\n" ".emtcode REVISION 0x09\n" ".emtcode FRAGMENT_PROGRAM 0x01\n" ".emtcode VERTEX_PROGRAM 0x02\n" ".emtcode OPTION 0x01\n" ".emtcode INSTRUCTION 0x02\n" ".emtcode DECLARATION 0x03\n" ".emtcode END 0x04\n" ".emtcode ARB_PRECISION_HINT_FASTEST 0x00\n" ".emtcode ARB_PRECISION_HINT_NICEST 0x01\n" ".emtcode ARB_FOG_EXP 0x02\n" ".emtcode ARB_FOG_EXP2 0x03\n" ".emtcode ARB_FOG_LINEAR 0x04\n" ".emtcode ARB_POSITION_INVARIANT 0x05\n" ".emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x06\n" ".emtcode ARB_DRAW_BUFFERS 0x07\n" ".emtcode OP_ALU_INST 0x00\n" ".emtcode OP_TEX_INST 0x01\n" ".emtcode OP_ALU_VECTOR 0x00\n" ".emtcode OP_ALU_SCALAR 0x01\n" ".emtcode OP_ALU_BINSC 0x02\n" ".emtcode OP_ALU_BIN 0x03\n" ".emtcode OP_ALU_TRI 0x04\n" ".emtcode OP_ALU_SWZ 0x05\n" ".emtcode OP_TEX_SAMPLE 0x06\n" ".emtcode OP_TEX_KIL 0x07\n" ".emtcode OP_ALU_ARL 0x08\n" ".emtcode OP_ABS 0x00\n" ".emtcode OP_ABS_SAT 0x1B\n" ".emtcode OP_FLR 0x09\n" ".emtcode OP_FLR_SAT 0x26\n" ".emtcode OP_FRC 0x0A\n" ".emtcode OP_FRC_SAT 0x27\n" ".emtcode OP_LIT 0x0C\n" ".emtcode OP_LIT_SAT 0x2A\n" ".emtcode OP_MOV 0x11\n" ".emtcode OP_MOV_SAT 0x30\n" ".emtcode OP_COS 0x1F\n" ".emtcode OP_COS_SAT 0x20\n" ".emtcode OP_EX2 0x07\n" ".emtcode OP_EX2_SAT 0x25\n" ".emtcode OP_LG2 0x0B\n" ".emtcode OP_LG2_SAT 0x29\n" ".emtcode OP_RCP 0x14\n" ".emtcode OP_RCP_SAT 0x33\n" ".emtcode OP_RSQ 0x15\n" ".emtcode OP_RSQ_SAT 0x34\n" ".emtcode OP_SIN 0x38\n" ".emtcode OP_SIN_SAT 0x39\n" ".emtcode OP_SCS 0x35\n" ".emtcode OP_SCS_SAT 0x36\n" ".emtcode OP_POW 0x13\n" ".emtcode OP_POW_SAT 0x32\n" ".emtcode OP_ADD 0x01\n" ".emtcode OP_ADD_SAT 0x1C\n" ".emtcode OP_DP3 0x03\n" ".emtcode OP_DP3_SAT 0x21\n" ".emtcode OP_DP4 0x04\n" ".emtcode OP_DP4_SAT 0x22\n" ".emtcode OP_DPH 0x05\n" ".emtcode OP_DPH_SAT 0x23\n" ".emtcode OP_DST 0x06\n" ".emtcode OP_DST_SAT 0x24\n" ".emtcode OP_MAX 0x0F\n" ".emtcode OP_MAX_SAT 0x2E\n" ".emtcode OP_MIN 0x10\n" ".emtcode OP_MIN_SAT 0x2F\n" ".emtcode OP_MUL 0x12\n" ".emtcode OP_MUL_SAT 0x31\n" ".emtcode OP_SGE 0x16\n" ".emtcode OP_SGE_SAT 0x37\n" ".emtcode OP_SLT 0x17\n" ".emtcode OP_SLT_SAT 0x3A\n" ".emtcode OP_SUB 0x18\n" ".emtcode OP_SUB_SAT 0x3B\n" ".emtcode OP_XPD 0x1A\n" ".emtcode OP_XPD_SAT 0x43\n" ".emtcode OP_CMP 0x1D\n" ".emtcode OP_CMP_SAT 0x1E\n" ".emtcode OP_LRP 0x2B\n" ".emtcode OP_LRP_SAT 0x2C\n" ".emtcode OP_MAD 0x0E\n" ".emtcode OP_MAD_SAT 0x2D\n" ".emtcode OP_SWZ 0x19\n" ".emtcode OP_SWZ_SAT 0x3C\n" ".emtcode OP_TEX 0x3D\n" ".emtcode OP_TEX_SAT 0x3E\n" ".emtcode OP_TXB 0x3F\n" ".emtcode OP_TXB_SAT 0x40\n" ".emtcode OP_TXP 0x41\n" ".emtcode OP_TXP_SAT 0x42\n" ".emtcode OP_KIL 0x28\n" ".emtcode OP_ARL 0x02\n" ".emtcode OP_EXP 0x08\n" ".emtcode OP_LOG 0x0D\n" ".emtcode FRAGMENT_ATTRIB_COLOR 0x01\n" ".emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02\n" ".emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03\n" ".emtcode FRAGMENT_ATTRIB_POSITION 0x04\n" ".emtcode VERTEX_ATTRIB_POSITION 0x01\n" ".emtcode VERTEX_ATTRIB_WEIGHT 0x02\n" ".emtcode VERTEX_ATTRIB_NORMAL 0x03\n" ".emtcode VERTEX_ATTRIB_COLOR 0x04\n" ".emtcode VERTEX_ATTRIB_FOGCOORD 0x05\n" ".emtcode VERTEX_ATTRIB_TEXCOORD 0x06\n" ".emtcode VERTEX_ATTRIB_MATRIXINDEX 0x07\n" ".emtcode VERTEX_ATTRIB_GENERIC 0x08\n" ".emtcode FRAGMENT_RESULT_COLOR 0x01\n" ".emtcode FRAGMENT_RESULT_DEPTH 0x02\n" ".emtcode VERTEX_RESULT_POSITION 0x01\n" ".emtcode VERTEX_RESULT_COLOR 0x02\n" ".emtcode VERTEX_RESULT_FOGCOORD 0x03\n" ".emtcode VERTEX_RESULT_POINTSIZE 0x04\n" ".emtcode VERTEX_RESULT_TEXCOORD 0x05\n" ".emtcode TEXTARGET_1D 0x01\n" ".emtcode TEXTARGET_2D 0x02\n" ".emtcode TEXTARGET_3D 0x03\n" ".emtcode TEXTARGET_RECT 0x04\n" ".emtcode TEXTARGET_CUBE 0x05\n" ".emtcode TEXTARGET_SHADOW1D 0x06\n" ".emtcode TEXTARGET_SHADOW2D 0x07\n" ".emtcode TEXTARGET_SHADOWRECT 0x08\n" ".emtcode FACE_FRONT 0x00\n" ".emtcode FACE_BACK 0x01\n" ".emtcode COLOR_PRIMARY 0x00\n" ".emtcode COLOR_SECONDARY 0x01\n" ".emtcode COMPONENT_X 0x00\n" ".emtcode COMPONENT_Y 0x01\n" ".emtcode COMPONENT_Z 0x02\n" ".emtcode COMPONENT_W 0x03\n" ".emtcode COMPONENT_0 0x04\n" ".emtcode COMPONENT_1 0x05\n" ".emtcode ARRAY_INDEX_ABSOLUTE 0x00\n" ".emtcode ARRAY_INDEX_RELATIVE 0x01\n" ".emtcode MATRIX_MODELVIEW 0x01\n" ".emtcode MATRIX_PROJECTION 0x02\n" ".emtcode MATRIX_MVP 0x03\n" ".emtcode MATRIX_TEXTURE 0x04\n" ".emtcode MATRIX_PALETTE 0x05\n" ".emtcode MATRIX_PROGRAM 0x06\n" ".emtcode MATRIX_MODIFIER_IDENTITY 0x00\n" ".emtcode MATRIX_MODIFIER_INVERSE 0x01\n" ".emtcode MATRIX_MODIFIER_TRANSPOSE 0x02\n" ".emtcode MATRIX_MODIFIER_INVTRANS 0x03\n" ".emtcode CONSTANT_SCALAR 0x01\n" ".emtcode CONSTANT_VECTOR 0x02\n" ".emtcode PROGRAM_PARAM_ENV 0x01\n" ".emtcode PROGRAM_PARAM_LOCAL 0x02\n" ".emtcode REGISTER_ATTRIB 0x01\n" ".emtcode REGISTER_PARAM 0x02\n" ".emtcode REGISTER_RESULT 0x03\n" ".emtcode REGISTER_ESTABLISHED_NAME 0x04\n" ".emtcode PARAM_NULL 0x00\n" ".emtcode PARAM_ARRAY_ELEMENT 0x01\n" ".emtcode PARAM_STATE_ELEMENT 0x02\n" ".emtcode PARAM_PROGRAM_ELEMENT 0x03\n" ".emtcode PARAM_PROGRAM_ELEMENTS 0x04\n" ".emtcode PARAM_CONSTANT 0x05\n" ".emtcode STATE_MATERIAL 0x01\n" ".emtcode STATE_LIGHT 0x02\n" ".emtcode STATE_LIGHT_MODEL 0x03\n" ".emtcode STATE_LIGHT_PROD 0x04\n" ".emtcode STATE_FOG 0x05\n" ".emtcode STATE_MATRIX_ROWS 0x06\n" ".emtcode STATE_TEX_ENV 0x07\n" ".emtcode STATE_DEPTH 0x08\n" ".emtcode STATE_TEX_GEN 0x09\n" ".emtcode STATE_CLIP_PLANE 0x0A\n" ".emtcode STATE_POINT 0x0B\n" ".emtcode MATERIAL_AMBIENT 0x01\n" ".emtcode MATERIAL_DIFFUSE 0x02\n" ".emtcode MATERIAL_SPECULAR 0x03\n" ".emtcode MATERIAL_EMISSION 0x04\n" ".emtcode MATERIAL_SHININESS 0x05\n" ".emtcode LIGHT_AMBIENT 0x01\n" ".emtcode LIGHT_DIFFUSE 0x02\n" ".emtcode LIGHT_SPECULAR 0x03\n" ".emtcode LIGHT_POSITION 0x04\n" ".emtcode LIGHT_ATTENUATION 0x05\n" ".emtcode LIGHT_HALF 0x06\n" ".emtcode LIGHT_SPOT_DIRECTION 0x07\n" ".emtcode LIGHT_MODEL_AMBIENT 0x01\n" ".emtcode LIGHT_MODEL_SCENECOLOR 0x02\n" ".emtcode LIGHT_PROD_AMBIENT 0x01\n" ".emtcode LIGHT_PROD_DIFFUSE 0x02\n" ".emtcode LIGHT_PROD_SPECULAR 0x03\n" ".emtcode TEX_ENV_COLOR 0x01\n" ".emtcode TEX_GEN_EYE 0x01\n" ".emtcode TEX_GEN_OBJECT 0x02\n" ".emtcode FOG_COLOR 0x01\n" ".emtcode FOG_PARAMS 0x02\n" ".emtcode DEPTH_RANGE 0x01\n" ".emtcode POINT_SIZE 0x01\n" ".emtcode POINT_ATTENUATION 0x02\n" ".emtcode ATTRIB 0x01\n" ".emtcode PARAM 0x02\n" ".emtcode TEMP 0x03\n" ".emtcode OUTPUT 0x04\n" ".emtcode ALIAS 0x05\n" ".emtcode ADDRESS 0x06\n" ".errtext UNKNOWN_PROGRAM_SIGNATURE \"1001: '$e_signature$': unknown program signature\"\n" ".errtext MISSING_END_OR_INVALID_STATEMENT \"1002: '$e_statement$': invalid statement\"\n" ".errtext CODE_AFTER_END \"1003: '$e_statement$': code after 'END' keyword\"\n" ".errtext INVALID_PROGRAM_OPTION \"1004: '$e_identifier$': invalid program option\"\n" ".errtext EXT_SWIZ_COMP_EXPECTED \"1005: extended swizzle component expected but '$e_token$' found\"\n" ".errtext TEX_TARGET_EXPECTED \"1006: texture target expected but '$e_token$' found\"\n" ".errtext TEXTURE_EXPECTED \"1007: 'texture' expected but '$e_identifier$' found\"\n" ".errtext SOURCE_REGISTER_EXPECTED \"1008: source register expected but '$e_token$' found\"\n" ".errtext DESTINATION_REGISTER_EXPECTED \"1009: destination register expected but '$e_token$' found\"\n" ".errtext INVALID_ADDRESS_COMPONENT \"1010: '$e_identifier$': invalid address component\"\n" ".errtext INVALID_ADDRESS_WRITEMASK \"1011: '$e_identifier$': invalid address writemask\"\n" ".errtext INVALID_COMPONENT \"1012: '$e_charordigit$': invalid component\"\n" ".errtext INVALID_SUFFIX \"1013: '$e_identifier$': invalid suffix\"\n" ".errtext INVALID_WRITEMASK \"1014: '$e_identifier$': invalid writemask\"\n" ".errtext FRAGMENT_EXPECTED \"1015: 'fragment' expected but '$e_identifier$' found\"\n" ".errtext VERTEX_EXPECTED \"1016: 'vertex' expected but '$e_identifier$' found\"\n" ".errtext INVALID_FRAGMENT_PROPERTY \"1017: '$e_identifier$': invalid fragment property\"\n" ".errtext INVALID_VERTEX_PROPERTY \"1018: '$e_identifier$': invalid vertex property\"\n" ".errtext INVALID_STATE_PROPERTY \"1019: '$e_identifier$': invalid state property\"\n" ".errtext INVALID_MATERIAL_PROPERTY \"1020: '$e_identifier$': invalid material property\"\n" ".errtext INVALID_LIGHT_PROPERTY \"1021: '$e_identifier$': invalid light property\"\n" ".errtext INVALID_SPOT_PROPERTY \"1022: '$e_identifier$': invalid spot property\"\n" ".errtext INVALID_LIGHTMODEL_PROPERTY \"1023: '$e_identifier$': invalid light model property\"\n" ".errtext INVALID_LIGHTPROD_PROPERTY \"1024: '$e_identifier$': invalid light product property\"\n" ".errtext INVALID_TEXENV_PROPERTY \"1025: '$e_identifier$': invalid texture environment property\"\n" ".errtext INVALID_TEXGEN_PROPERTY \"1026: '$e_identifier$': invalid texture generating property\"\n" ".errtext INVALID_TEXGEN_COORD \"1027: '$e_identifier$': invalid texture generating coord\"\n" ".errtext INVALID_FOG_PROPERTY \"1028: '$e_identifier$': invalid fog property\"\n" ".errtext INVALID_DEPTH_PROPERTY \"1029: '$e_identifier$': invalid depth property\"\n" ".errtext INVALID_CLIPPLANE_PROPERTY \"1030: '$e_identifier$': invalid clip plane property\"\n" ".errtext INVALID_POINT_PROPERTY \"1031: '$e_identifier$': invalid point property\"\n" ".errtext MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED \"1032: matrix row selector or modifier expected but '$e_token$' found\"\n" ".errtext INVALID_MATRIX_NAME \"1033: '$e_identifier$': invalid matrix name\"\n" ".errtext INVALID_PROGRAM_PROPERTY \"1034: '$e_identifier$': invalid program property\"\n" ".errtext RESULT_EXPECTED \"1035: 'result' expected but '$e_token$' found\"\n" ".errtext INVALID_RESULT_PROPERTY \"1036: '$e_identifier$': invalid result property\"\n" ".errtext INVALID_FACE_PROPERTY \"1037: '$e_identifier$': invalid face property\"\n" ".errtext INVALID_COLOR_PROPERTY \"1038: '$e_identifier$': invalid color property\"\n" ".errtext IDENTIFIER_EXPECTED \"1039: identifier expected but '$e_token$' found\"\n" ".errtext RESERVED_KEYWORD \"1040: use of reserved keyword as an identifier\"\n" ".errtext INTEGER_EXPECTED \"1041: integer value expected but '$e_token$' found\"\n" ".errtext MISSING_SEMICOLON \"1042: ';' expected but '$e_token$' found\"\n" ".errtext MISSING_COMMA \"1043: ',' expected but '$e_token$' found\"\n" ".errtext MISSING_LBRACKET \"1044: '[' expected but '$e_token$' found\"\n" ".errtext MISSING_RBRACKET \"1045: ']' expected but '$e_token$' found\"\n" ".errtext MISSING_DOT \"1046: '.' expected but '$e_token$' found\"\n" ".errtext MISSING_EQUAL \"1047: '=' expected but '$e_token$' found\"\n" ".errtext MISSING_LBRACE \"1048: '{' expected but '$e_token$' found\"\n" ".errtext MISSING_RBRACE \"1049: '}' expected but '$e_token$' found\"\n" ".errtext MISSING_DOTDOT \"1050: '..' expected but '$e_token$' found\"\n" ".errtext MISSING_FRACTION_OR_EXPONENT \"1051: missing fraction part or exponent\"\n" ".errtext MISSING_DOT_OR_EXPONENT \"1052: missing '.' or exponent\"\n" ".errtext EXPONENT_VALUE_EXPECTED \"1053: exponent value expected\"\n" ".errtext INTEGER_OUT_OF_RANGE \"1054: integer value out of range\"\n" ".errtext OPERATION_NEEDS_DESTINATION_VARIABLE \"1055: operation needs destination variable\"\n" ".errtext OPERATION_NEEDS_SOURCE_VARIABLE \"1056: operation needs source variable\"\n" ".errtext ADDRESS_REGISTER_EXPECTED \"1057: address register expected but '$e_token$' found\"\n" ".errtext ADDRESS_REGISTER_OR_INTEGER_EXPECTED \"1058: address register or integer literal expected but '$e_token$' found\"\n" ".regbyte vertex_blend 0x00\n" ".regbyte matrix_palette 0x00\n" ".regbyte point_parameters 0x00\n" ".regbyte secondary_color 0x00\n" ".regbyte fog_coord 0x00\n" ".regbyte texture_rectangle 0x00\n" ".regbyte fragment_program_shadow 0x00\n" ".regbyte draw_buffers 0x00\n" ".regbyte ARB_precision_hint_fastest 0x00\n" ".regbyte ARB_precision_hint_nicest 0x00\n" ".regbyte ARB_fog_exp 0x00\n" ".regbyte ARB_fog_exp2 0x00\n" ".regbyte ARB_fog_linear 0x00\n" ".regbyte ARB_position_invariant 0x00\n" ".regbyte ARB_fragment_program_shadow 0x00\n" ".regbyte ARB_draw_buffers 0x00\n" ".regbyte program_target 0x00\n" "program\n" " programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;\n" "programs\n" " .if (program_target == 0x10) frag_program_1_0 .emit FRAGMENT_PROGRAM .emit 0x01 .emit 0x00 .or\n" " .if (program_target == 0x20) vert_program_1_0 .emit VERTEX_PROGRAM .emit 0x01 .emit 0x00;\n" "frag_program_1_0\n" " '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'f' .and 'p' .and '1' .and '.' .and '0' .and\n" " optional_space .and fp_optionSequence .and fp_statementSequence .and\n" " \"END\" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and\n" " '\\0' .error CODE_AFTER_END;\n" "vert_program_1_0\n" " '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'v' .and 'p' .and '1' .and '.' .and '0' .and\n" " optional_space .and vp_optionSequence .and vp_statementSequence .and\n" " \"END\" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and\n" " '\\0' .error CODE_AFTER_END;\n" "fp_optionSequence\n" " .loop fp_option;\n" "vp_optionSequence\n" " .loop vp_option;\n" "fp_option\n" " \"OPTION\" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and\n" " fp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;\n" "vp_option\n" " \"OPTION\" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and\n" " vp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;\n" "fp_optionString\n" " .if (ARB_precision_hint_nicest == 0x00) \"ARB_precision_hint_fastest\"\n" " .emit ARB_PRECISION_HINT_FASTEST .load ARB_precision_hint_fastest 0x01 .or\n" " .if (ARB_precision_hint_fastest == 0x00) \"ARB_precision_hint_nicest\"\n" " .emit ARB_PRECISION_HINT_NICEST .load ARB_precision_hint_nicest 0x01 .or\n" " fp_ARB_fog_exp .emit ARB_FOG_EXP .load ARB_fog_exp 0x01 .or\n" " fp_ARB_fog_exp2 .emit ARB_FOG_EXP2 .load ARB_fog_exp2 0x01 .or\n" " fp_ARB_fog_linear .emit ARB_FOG_LINEAR .load ARB_fog_linear 0x01 .or\n" " .if (fragment_program_shadow != 0x00) \"ARB_fragment_program_shadow\"\n" " .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01 .or\n" " .if (draw_buffers != 0x00) \"ARB_draw_buffers\" .emit ARB_DRAW_BUFFERS\n" " .load ARB_draw_buffers 0x01;\n" "vp_optionString\n" " \"ARB_position_invariant\" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;\n" "fp_ARB_fog_exp\n" " .if (ARB_fog_exp2 == 0x00) .true .and .if (ARB_fog_linear == 0x00) \"ARB_fog_exp\";\n" "fp_ARB_fog_exp2\n" " .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_linear == 0x00) \"ARB_fog_exp2\";\n" "fp_ARB_fog_linear\n" " .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_exp2 == 0x00) \"ARB_fog_linear\";\n" "fp_statementSequence\n" " .loop fp_statement;\n" "vp_statementSequence\n" " .loop vp_statement;\n" "fp_statement\n" " fp_statement_1 .or fp_statement_2;\n" "vp_statement\n" " vp_statement_1 .or vp_statement_2;\n" "fp_statement_1\n" " fp_instruction .emit INSTRUCTION .emit $ .and semicolon;\n" "fp_statement_2\n" " fp_namingStatement .emit DECLARATION .and semicolon;\n" "vp_statement_1\n" " vp_instruction .emit INSTRUCTION .emit $ .and semicolon;\n" "vp_statement_2\n" " vp_namingStatement .emit DECLARATION .and semicolon;\n" "fp_instruction\n" " ALUInstruction .emit OP_ALU_INST .or\n" " TexInstruction .emit OP_TEX_INST;\n" "vp_instruction\n" " ARL_instruction .emit OP_ALU_ARL .or\n" " vp_VECTORop_instruction .emit OP_ALU_VECTOR .or\n" " vp_SCALARop_instruction .emit OP_ALU_SCALAR .or\n" " vp_BINSCop_instruction .emit OP_ALU_BINSC .or\n" " vp_BINop_instruction .emit OP_ALU_BIN .or\n" " vp_TRIop_instruction .emit OP_ALU_TRI .or\n" " vp_SWZ_instruction .emit OP_ALU_SWZ;\n" "ALUInstruction\n" " fp_VECTORop_instruction .emit OP_ALU_VECTOR .or\n" " fp_SCALARop_instruction .emit OP_ALU_SCALAR .or\n" " fp_BINSCop_instruction .emit OP_ALU_BINSC .or\n" " fp_BINop_instruction .emit OP_ALU_BIN .or\n" " fp_TRIop_instruction .emit OP_ALU_TRI .or\n" " fp_SWZ_instruction .emit OP_ALU_SWZ;\n" "TexInstruction\n" " SAMPLE_instruction .emit OP_TEX_SAMPLE .or\n" " KIL_instruction .emit OP_TEX_KIL;\n" "ARL_instruction\n" " \"ARL\" .emit OP_ARL .and space_dst .and maskedAddrReg .and comma .and vp_scalarSrcReg;\n" "fp_VECTORop_instruction\n" " fp_VECTORop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg;\n" "vp_VECTORop_instruction\n" " vp_VECTORop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg;\n" "fp_VECTORop\n" " \"ABS\" .emit OP_ABS .or \"ABS_SAT\" .emit OP_ABS_SAT .or\n" " \"FLR\" .emit OP_FLR .or \"FLR_SAT\" .emit OP_FLR_SAT .or\n" " \"FRC\" .emit OP_FRC .or \"FRC_SAT\" .emit OP_FRC_SAT .or\n" " \"LIT\" .emit OP_LIT .or \"LIT_SAT\" .emit OP_LIT_SAT .or\n" " \"MOV\" .emit OP_MOV .or \"MOV_SAT\" .emit OP_MOV_SAT;\n" "vp_VECTORop\n" " \"ABS\" .emit OP_ABS .or\n" " \"FLR\" .emit OP_FLR .or\n" " \"FRC\" .emit OP_FRC .or\n" " \"LIT\" .emit OP_LIT .or\n" " \"MOV\" .emit OP_MOV;\n" "fp_SCALARop_instruction\n" " fp_SCALARop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg;\n" "vp_SCALARop_instruction\n" " vp_SCALARop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg;\n" "fp_SCALARop\n" " \"COS\" .emit OP_COS .or \"COS_SAT\" .emit OP_COS_SAT .or\n" " \"EX2\" .emit OP_EX2 .or \"EX2_SAT\" .emit OP_EX2_SAT .or\n" " \"LG2\" .emit OP_LG2 .or \"LG2_SAT\" .emit OP_LG2_SAT .or\n" " \"RCP\" .emit OP_RCP .or \"RCP_SAT\" .emit OP_RCP_SAT .or\n" " \"RSQ\" .emit OP_RSQ .or \"RSQ_SAT\" .emit OP_RSQ_SAT .or\n" " \"SIN\" .emit OP_SIN .or \"SIN_SAT\" .emit OP_SIN_SAT .or\n" " \"SCS\" .emit OP_SCS .or \"SCS_SAT\" .emit OP_SCS_SAT;\n" "vp_SCALARop\n" " \"EX2\" .emit OP_EX2 .or\n" " \"EXP\" .emit OP_EXP .or\n" " \"LG2\" .emit OP_LG2 .or\n" " \"LOG\" .emit OP_LOG .or\n" " \"RCP\" .emit OP_RCP .or\n" " \"RSQ\" .emit OP_RSQ;\n" "fp_BINSCop_instruction\n" " fp_BINSCop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg .and comma .and\n" " fp_scalarSrcReg;\n" "vp_BINSCop_instruction\n" " vp_BINSCop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg .and comma .and\n" " vp_scalarSrcReg;\n" "fp_BINSCop\n" " \"POW\" .emit OP_POW .or \"POW_SAT\" .emit OP_POW_SAT;\n" "vp_BINSCop\n" " \"POW\" .emit OP_POW;\n" "fp_BINop_instruction\n" " fp_BINop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n" " vectorSrcReg;\n" "vp_BINop_instruction\n" " vp_BINop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and\n" " swizzleSrcReg;\n" "fp_BINop\n" " \"ADD\" .emit OP_ADD .or \"ADD_SAT\" .emit OP_ADD_SAT .or\n" " \"DP3\" .emit OP_DP3 .or \"DP3_SAT\" .emit OP_DP3_SAT .or\n" " \"DP4\" .emit OP_DP4 .or \"DP4_SAT\" .emit OP_DP4_SAT .or\n" " \"DPH\" .emit OP_DPH .or \"DPH_SAT\" .emit OP_DPH_SAT .or\n" " \"DST\" .emit OP_DST .or \"DST_SAT\" .emit OP_DST_SAT .or\n" " \"MAX\" .emit OP_MAX .or \"MAX_SAT\" .emit OP_MAX_SAT .or\n" " \"MIN\" .emit OP_MIN .or \"MIN_SAT\" .emit OP_MIN_SAT .or\n" " \"MUL\" .emit OP_MUL .or \"MUL_SAT\" .emit OP_MUL_SAT .or\n" " \"SGE\" .emit OP_SGE .or \"SGE_SAT\" .emit OP_SGE_SAT .or\n" " \"SLT\" .emit OP_SLT .or \"SLT_SAT\" .emit OP_SLT_SAT .or\n" " \"SUB\" .emit OP_SUB .or \"SUB_SAT\" .emit OP_SUB_SAT .or\n" " \"XPD\" .emit OP_XPD .or \"XPD_SAT\" .emit OP_XPD_SAT;\n" "vp_BINop\n" " \"ADD\" .emit OP_ADD .or\n" " \"DP3\" .emit OP_DP3 .or\n" " \"DP4\" .emit OP_DP4 .or\n" " \"DPH\" .emit OP_DPH .or\n" " \"DST\" .emit OP_DST .or\n" " \"MAX\" .emit OP_MAX .or\n" " \"MIN\" .emit OP_MIN .or\n" " \"MUL\" .emit OP_MUL .or\n" " \"SGE\" .emit OP_SGE .or\n" " \"SLT\" .emit OP_SLT .or\n" " \"SUB\" .emit OP_SUB .or\n" " \"XPD\" .emit OP_XPD;\n" "fp_TRIop_instruction\n" " fp_TRIop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n" " vectorSrcReg .and comma .and vectorSrcReg;\n" "vp_TRIop_instruction\n" " vp_TRIop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and\n" " swizzleSrcReg .and comma .and swizzleSrcReg;\n" "fp_TRIop\n" " \"CMP\" .emit OP_CMP .or \"CMP_SAT\" .emit OP_CMP_SAT .or\n" " \"LRP\" .emit OP_LRP .or \"LRP_SAT\" .emit OP_LRP_SAT .or\n" " \"MAD\" .emit OP_MAD .or \"MAD_SAT\" .emit OP_MAD_SAT;\n" "vp_TRIop\n" " \"MAD\" .emit OP_MAD;\n" "fp_SWZ_instruction\n" " SWZop .and space_dst .and fp_maskedDstReg .and comma .and fp_srcReg .and comma .and\n" " fp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;\n" "vp_SWZ_instruction\n" " \"SWZ\" .emit OP_SWZ .and space_dst .and vp_maskedDstReg .and comma .and vp_srcReg .and comma .and\n" " vp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;\n" "SWZop\n" " \"SWZ\" .emit OP_SWZ .or \"SWZ_SAT\" .emit OP_SWZ_SAT;\n" "SAMPLE_instruction\n" " SAMPLEop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n" " texImageUnit .and comma .and texTarget .error TEX_TARGET_EXPECTED;\n" "SAMPLEop\n" " \"TEX\" .emit OP_TEX .or \"TEX_SAT\" .emit OP_TEX_SAT .or\n" " \"TXB\" .emit OP_TXB .or \"TXB_SAT\" .emit OP_TXB_SAT .or\n" " \"TXP\" .emit OP_TXP .or \"TXP_SAT\" .emit OP_TXP_SAT;\n" "KIL_instruction\n" " \"KIL\" .emit OP_KIL .and space_src .and vectorSrcReg;\n" "texImageUnit\n" " \"texture\" .error TEXTURE_EXPECTED .and optTexImageUnitNum;\n" "texTarget\n" " \"1D\" .emit TEXTARGET_1D .or\n" " \"2D\" .emit TEXTARGET_2D .or\n" " \"3D\" .emit TEXTARGET_3D .or\n" " .if (texture_rectangle != 0x00) \"RECT\" .emit TEXTARGET_RECT .or\n" " \"CUBE\" .emit TEXTARGET_CUBE .or\n" " .if (ARB_fragment_program_shadow != 0x00) shadowTarget;\n" "shadowTarget\n" " \"SHADOW1D\" .emit TEXTARGET_SHADOW1D .or\n" " \"SHADOW2D\" .emit TEXTARGET_SHADOW2D .or\n" " .if (texture_rectangle != 0x00) \"SHADOWRECT\" .emit TEXTARGET_SHADOWRECT;\n" "optTexImageUnitNum\n" " optTexImageUnitNum_1 .or .true .emit 0x00;\n" "optTexImageUnitNum_1\n" " lbracket_ne .and texImageUnitNum .and rbracket;\n" "texImageUnitNum\n" " integer;\n" "fp_scalarSrcReg\n" " optionalSign .and fp_srcReg .and fp_scalarSuffix;\n" "vp_scalarSrcReg\n" " optionalSign .and vp_srcReg .and vp_scalarSuffix;\n" "swizzleSrcReg\n" " optionalSign .and vp_srcReg .and swizzleSuffix;\n" "vectorSrcReg\n" " optionalSign .and fp_srcReg .and optionalSuffix;\n" "fp_maskedDstReg\n" " fp_dstReg .and fp_optionalMask;\n" "vp_maskedDstReg\n" " vp_dstReg .and vp_optionalMask;\n" "maskedAddrReg\n" " addrReg .error ADDRESS_REGISTER_EXPECTED .and addrWriteMask;\n" "fp_extendedSwizzle\n" " rgbaExtendedSwizzle .or xyzwExtendedSwizzle;\n" "vp_extendedSwizzle\n" " extSwizComp .and comma .and\n" " extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" " extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" " extSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" "xyzwExtendedSwizzle\n" " xyzwExtSwizComp .and comma .and\n" " xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" " xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" " xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" "rgbaExtendedSwizzle\n" " rgbaExtendedSwizzle_1 .or rgbaExtendedSwizzle_2 .or rgbaExtendedSwizzle_3 .or\n" " rgbaExtendedSwizzle_4;\n" "rgbaExtendedSwizzle_1\n" " rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and\n" " rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp;\n" "rgbaExtendedSwizzle_2\n" " rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and\n" " rgbaExtSwizComp_alpha .and comma .and rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" "rgbaExtendedSwizzle_3\n" " rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_alpha .and comma .and\n" " rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" " rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" "rgbaExtendedSwizzle_4\n" " rgbaExtSwizComp_alpha .and comma .and \n" "rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" " rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" " rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" "xyzwExtSwizComp\n" " optionalSign .and xyzwExtSwizSel;\n" "rgbaExtSwizComp\n" " optionalSign .and rgbaExtSwizSel;\n" "rgbaExtSwizComp_digit\n" " optionalSign .and rgbaExtSwizSel_digit;\n" "rgbaExtSwizComp_alpha\n" " optionalSign .and rgbaExtSwizSel_alpha;\n" "extSwizComp\n" " optionalSign .and extSwizSel;\n" "xyzwExtSwizSel\n" " \"0\" .emit COMPONENT_0 .or \"1\" .emit COMPONENT_1 .or xyzwComponent_single;\n" "rgbaExtSwizSel\n" " rgbaExtSwizSel_digit .or rgbaExtSwizSel_alpha;\n" "rgbaExtSwizSel_digit\n" " \"0\" .emit COMPONENT_0 .or \"1\" .emit COMPONENT_1;\n" "rgbaExtSwizSel_alpha\n" " rgbaComponent_single;\n" "extSwizSel\n" " \"0\" .emit COMPONENT_0 .or \"1\" .emit COMPONENT_1 .or vp_component_single;\n" "fp_srcReg\n" " fp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;\n" "vp_srcReg\n" " vp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;\n" "fp_srcReg_1\n" " fragmentAttribReg .emit REGISTER_ATTRIB .or\n" " fp_progParamReg .emit REGISTER_PARAM .or\n" " fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" "vp_srcReg_1\n" " vertexAttribReg .emit REGISTER_ATTRIB .or\n" " vp_progParamReg .emit REGISTER_PARAM .or\n" " vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" "fp_dstReg\n" " fp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;\n" "vp_dstReg\n" " vp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;\n" "fp_dstReg_1\n" " fragmentResultReg .emit REGISTER_RESULT .or\n" " fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" "vp_dstReg_1\n" " vertexResultReg .emit REGISTER_RESULT .or\n" " vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" "fragmentAttribReg\n" " fragAttribBinding;\n" "vertexAttribReg\n" " vtxAttribBinding;\n" "fp_temporaryReg\n" " fp_establishedName_no_error_on_identifier;\n" "vp_temporaryReg\n" " vp_establishedName_no_error_on_identifier;\n" "fp_progParamReg\n" " fp_paramSingleItemUse .or fp_progParamReg_1 .or fp_progParamSingle;\n" "vp_progParamReg\n" " vp_paramSingleItemUse .or vp_progParamReg_1 .or vp_progParamSingle;\n" "fp_progParamReg_1\n" " fp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayAbs .and\n" " rbracket;\n" "vp_progParamReg_1\n" " vp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayMem .and\n" " rbracket;\n" "fp_progParamSingle\n" " .false;\n" "vp_progParamSingle\n" " .false;\n" "fp_progParamArray\n" " fp_establishedName_no_error_on_identifier;\n" "vp_progParamArray\n" " vp_establishedName_no_error_on_identifier;\n" "progParamArrayMem\n" " progParamArrayAbs .or progParamArrayRel;\n" "progParamArrayAbs\n" " integer_ne .emit ARRAY_INDEX_ABSOLUTE;\n" "progParamArrayRel\n" " addrReg .error ADDRESS_REGISTER_OR_INTEGER_EXPECTED .emit ARRAY_INDEX_RELATIVE .and\n" " addrComponent .and addrRegRelOffset;\n" "addrRegRelOffset\n" " addrRegRelOffset_1 .or addrRegRelOffset_2 .or .true .emit 0x00;\n" "addrRegRelOffset_1\n" " plus_ne .and addrRegPosOffset;\n" "addrRegRelOffset_2\n" " minus_ne .and addrRegNegOffset;\n" "addrRegPosOffset\n" " integer_0_63;\n" "addrRegNegOffset\n" " integer_0_64;\n" "fragmentResultReg\n" " fp_resultBinding;\n" "vertexResultReg\n" " vp_resultBinding;\n" "addrReg\n" " vp_establishedName_no_error_on_identifier;\n" "addrComponent\n" " dot .and \"x\" .error INVALID_ADDRESS_COMPONENT .emit COMPONENT_X .emit COMPONENT_X\n" " .emit COMPONENT_X .emit COMPONENT_X;\n" "addrWriteMask\n" " dot .and \"x\" .error INVALID_ADDRESS_WRITEMASK .emit 0x08;\n" "fp_scalarSuffix\n" " dot .and fp_component_single .error INVALID_COMPONENT;\n" "vp_scalarSuffix\n" " dot .and vp_component_single .error INVALID_COMPONENT;\n" "swizzleSuffix\n" " swizzleSuffix_1 .or\n" " .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;\n" "swizzleSuffix_1\n" " dot_ne .and swizzleSuffix_2 .error INVALID_SUFFIX;\n" "swizzleSuffix_2\n" " swizzleSuffix_3 .or swizzleSuffix_4;\n" "swizzleSuffix_3\n" " vp_component_multi .and vp_component_multi .and vp_component_multi .error INVALID_COMPONENT .and\n" " vp_component_multi .error INVALID_COMPONENT;\n" "swizzleSuffix_4\n" " \"x\" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or\n" " \"y\" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or\n" " \"z\" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or\n" " \"w\" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;\n" "optionalSuffix\n" " optionalSuffix_1 .or\n" " .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;\n" "optionalSuffix_1\n" " dot_ne .and optionalSuffix_2 .error INVALID_SUFFIX;\n" "optionalSuffix_2\n" " optionalSuffix_3 .or optionalSuffix_4 .or optionalSuffix_5;\n" "optionalSuffix_3\n" " xyzwComponent_multi .and xyzwComponent_multi .and\n" " xyzwComponent_multi .error INVALID_COMPONENT .and xyzwComponent_multi .error INVALID_COMPONENT;\n" "optionalSuffix_4\n" " rgbaComponent_multi .and rgbaComponent_multi .and\n" " rgbaComponent_multi .error INVALID_COMPONENT .and rgbaComponent_multi .error INVALID_COMPONENT;\n" "optionalSuffix_5\n" " \"x\" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or\n" " \"y\" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or\n" " \"z\" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or\n" " \"w\" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .or\n" " \"r\" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or\n" " \"g\" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or\n" " \"b\" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or\n" " \"a\" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;\n" "fp_component_single\n" " xyzwComponent_single .or rgbaComponent_single;\n" "vp_component_multi\n" " 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or\n" " 'w' .emit COMPONENT_W;\n" "vp_component_single\n" " \"x\" .emit COMPONENT_X .or \"y\" .emit COMPONENT_Y .or \"z\" .emit COMPONENT_Z .or\n" " \"w\" .emit COMPONENT_W;\n" "xyzwComponent_multi\n" " 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or\n" " 'w' .emit COMPONENT_W;\n" "xyzwComponent_single\n" " \"x\" .emit COMPONENT_X .or \"y\" .emit COMPONENT_Y .or \"z\" .emit COMPONENT_Z .or\n" " \"w\" .emit COMPONENT_W;\n" "rgbaComponent_multi\n" " 'r' .emit COMPONENT_X .or 'g' .emit COMPONENT_Y .or 'b' .emit COMPONENT_Z .or\n" " 'a' .emit COMPONENT_W;\n" "rgbaComponent_single\n" " \"r\" .emit COMPONENT_X .or \"g\" .emit COMPONENT_Y .or \"b\" .emit COMPONENT_Z .or\n" " \"a\" .emit COMPONENT_W;\n" "fp_optionalMask\n" " rgbaMask .or xyzwMask .or .true .emit 0x0F;\n" "vp_optionalMask\n" " xyzwMask .or .true .emit 0x0F;\n" "xyzwMask\n" " dot_ne .and xyzwMask_1 .error INVALID_WRITEMASK;\n" "xyzwMask_1\n" " \"xyzw\" .emit 0x0F .or \"xyz\" .emit 0x0E .or \"xyw\" .emit 0x0D .or \"xy\" .emit 0x0C .or\n" " \"xzw\" .emit 0x0B .or \"xz\" .emit 0x0A .or \"xw\" .emit 0x09 .or \"x\" .emit 0x08 .or\n" " \"yzw\" .emit 0x07 .or \"yz\" .emit 0x06 .or \"yw\" .emit 0x05 .or \"y\" .emit 0x04 .or\n" " \"zw\" .emit 0x03 .or \"z\" .emit 0x02 .or \"w\" .emit 0x01;\n" "rgbaMask\n" " dot_ne .and rgbaMask_1;\n" "rgbaMask_1\n" " \"rgba\" .emit 0x0F .or \"rgb\" .emit 0x0E .or \"rga\" .emit 0x0D .or \"rg\" .emit 0x0C .or\n" " \"rba\" .emit 0x0B .or \"rb\" .emit 0x0A .or \"ra\" .emit 0x09 .or \"r\" .emit 0x08 .or\n" " \"gba\" .emit 0x07 .or \"gb\" .emit 0x06 .or \"ga\" .emit 0x05 .or \"g\" .emit 0x04 .or\n" " \"ba\" .emit 0x03 .or \"b\" .emit 0x02 .or \"a\" .emit 0x01;\n" "fp_namingStatement\n" " fp_ATTRIB_statement .emit ATTRIB .or\n" " fp_PARAM_statement .emit PARAM .or\n" " fp_TEMP_statement .emit TEMP .or\n" " fp_OUTPUT_statement .emit OUTPUT .or\n" " fp_ALIAS_statement .emit ALIAS;\n" "vp_namingStatement\n" " vp_ATTRIB_statement .emit ATTRIB .or\n" " vp_PARAM_statement .emit PARAM .or\n" " vp_TEMP_statement .emit TEMP .or\n" " ADDRESS_statement .emit ADDRESS .or\n" " vp_OUTPUT_statement .emit OUTPUT .or\n" " vp_ALIAS_statement .emit ALIAS;\n" "fp_ATTRIB_statement\n" " \"ATTRIB\" .and space .and fp_establishName .and equal .and\n" " fragAttribBinding .error FRAGMENT_EXPECTED;\n" "vp_ATTRIB_statement\n" " \"ATTRIB\" .and space .and vp_establishName .and equal .and\n" " vtxAttribBinding .error VERTEX_EXPECTED;\n" "fragAttribBinding\n" " \"fragment\" .and dot .and fragAttribItem .error INVALID_FRAGMENT_PROPERTY;\n" "vtxAttribBinding\n" " \"vertex\" .and dot .and vtxAttribItem .error INVALID_VERTEX_PROPERTY;\n" "fragAttribItem\n" " fragAttribItem_1 .emit FRAGMENT_ATTRIB_COLOR .or\n" " fragAttribItem_2 .emit FRAGMENT_ATTRIB_TEXCOORD .or\n" " .if (fog_coord != 0x00) \"fogcoord\" .emit FRAGMENT_ATTRIB_FOGCOORD .or\n" " \"position\" .emit FRAGMENT_ATTRIB_POSITION;\n" "fragAttribItem_1\n" " \"color\" .and optColorType;\n" "fragAttribItem_2\n" " \"texcoord\" .and optTexCoordNum;\n" "vtxAttribItem\n" " \"position\" .emit VERTEX_ATTRIB_POSITION .or\n" " .if (vertex_blend != 0x00) vtxAttribItem_1 .emit VERTEX_ATTRIB_WEIGHT .or\n" " \"normal\" .emit VERTEX_ATTRIB_NORMAL .or\n" " vtxAttribItem_2 .emit VERTEX_ATTRIB_COLOR .or\n" " \"fogcoord\" .emit VERTEX_ATTRIB_FOGCOORD .or\n" " vtxAttribItem_3 .emit VERTEX_ATTRIB_TEXCOORD .or\n" " .if (matrix_palette != 0x00) vtxAttribItem_4 .emit VERTEX_ATTRIB_MATRIXINDEX .or\n" " vtxAttribItem_5 .emit VERTEX_ATTRIB_GENERIC;\n" "vtxAttribItem_1\n" " \"weight\" .and vtxOptWeightNum;\n" "vtxAttribItem_2\n" " \"color\" .and optColorType;\n" "vtxAttribItem_3\n" " \"texcoord\" .and optTexCoordNum;\n" "vtxAttribItem_4\n" " \"matrixindex\" .and lbracket .and vtxWeightNum .and rbracket;\n" "vtxAttribItem_5\n" " \"attrib\" .and lbracket .and vtxAttribNum .and rbracket;\n" "vtxAttribNum\n" " integer;\n" "vtxOptWeightNum\n" " vtxOptWeightNum_1 .or .true .emit 0x00;\n" "vtxOptWeightNum_1\n" " lbracket_ne .and vtxWeightNum .and rbracket;\n" "vtxWeightNum\n" " integer;\n" "fp_PARAM_statement\n" " fp_PARAM_multipleStmt .or fp_PARAM_singleStmt;\n" "vp_PARAM_statement\n" " vp_PARAM_multipleStmt .or vp_PARAM_singleStmt;\n" "fp_PARAM_singleStmt\n" " \"PARAM\" .and space .and fp_establishName .and .true .emit 0x00 .and fp_paramSingleInit .and\n" " .true .emit PARAM_NULL;\n" "vp_PARAM_singleStmt\n" " \"PARAM\" .and space .and vp_establishName .and .true .emit 0x00 .and vp_paramSingleInit .and\n" " .true .emit PARAM_NULL;\n" "fp_PARAM_multipleStmt\n" " \"PARAM\" .and space .and fp_establishName .and lbracket_ne .and optArraySize .and rbracket .and\n" " fp_paramMultipleInit .and .true .emit PARAM_NULL;\n" "vp_PARAM_multipleStmt\n" " \"PARAM\" .and space .and vp_establishName .and lbracket_ne .and optArraySize .and rbracket .and\n" " vp_paramMultipleInit .and .true .emit PARAM_NULL;\n" "optArraySize\n" " optional_integer;\n" "fp_paramSingleInit\n" " equal .and fp_paramSingleItemDecl;\n" "vp_paramSingleInit\n" " equal .and vp_paramSingleItemDecl;\n" "fp_paramMultipleInit\n" " equal .and lbrace .and fp_paramMultInitList .and rbrace;\n" "vp_paramMultipleInit\n" " equal .and lbrace .and vp_paramMultInitList .and rbrace;\n" "fp_paramMultInitList\n" " fp_paramMultInitList_1 .or fp_paramMultipleItem;\n" "vp_paramMultInitList\n" " vp_paramMultInitList_1 .or vp_paramMultipleItem;\n" "fp_paramMultInitList_1\n" " fp_paramMultipleItem .and comma_ne .and fp_paramMultInitList;\n" "vp_paramMultInitList_1\n" " vp_paramMultipleItem .and comma_ne .and vp_paramMultInitList;\n" "fp_paramSingleItemDecl\n" " fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" " programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" " paramConstDecl .emit PARAM_CONSTANT;\n" "vp_paramSingleItemDecl\n" " vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" " programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" " paramConstDecl .emit PARAM_CONSTANT;\n" "fp_paramSingleItemUse\n" " fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" " programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" " paramConstUse .emit PARAM_CONSTANT;\n" "vp_paramSingleItemUse\n" " vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" " programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" " paramConstUse .emit PARAM_CONSTANT;\n" "fp_paramMultipleItem\n" " fp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or\n" " programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or\n" " paramConstDecl .emit PARAM_CONSTANT;\n" "vp_paramMultipleItem\n" " vp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or\n" " programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or\n" " paramConstDecl .emit PARAM_CONSTANT;\n" "fp_stateMultipleItem\n" " stateMultipleItem_1 .or fp_stateSingleItem;\n" "vp_stateMultipleItem\n" " stateMultipleItem_1 .or vp_stateSingleItem;\n" "stateMultipleItem_1\n" " \"state\" .and dot .and stateMatrixRows .emit STATE_MATRIX_ROWS;\n" "fp_stateSingleItem\n" " \"state\" .and dot .and fp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;\n" "vp_stateSingleItem\n" " \"state\" .and dot .and vp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;\n" "fp_stateSingleItem_1\n" " stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or\n" " stateSingleItem_5 .or stateSingleItem_7 .or stateSingleItem_8 .or stateSingleItem_11;\n" "vp_stateSingleItem_1\n" " stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or\n" " stateSingleItem_6 .or stateSingleItem_7 .or stateSingleItem_9 .or stateSingleItem_10 .or\n" " stateSingleItem_11;\n" "stateSingleItem_1\n" " stateMaterialItem .emit STATE_MATERIAL;\n" "stateSingleItem_2\n" " stateLightItem .emit STATE_LIGHT;\n" "stateSingleItem_3\n" " stateLightModelItem .emit STATE_LIGHT_MODEL;\n" "stateSingleItem_4\n" " stateLightProdItem .emit STATE_LIGHT_PROD;\n" "stateSingleItem_5\n" " stateTexEnvItem .emit STATE_TEX_ENV;\n" "stateSingleItem_6\n" " stateTexGenItem .emit STATE_TEX_GEN;\n" "stateSingleItem_7\n" " stateFogItem .emit STATE_FOG;\n" "stateSingleItem_8\n" " stateDepthItem .emit STATE_DEPTH;\n" "stateSingleItem_9\n" " stateClipPlaneItem .emit STATE_CLIP_PLANE;\n" "stateSingleItem_10\n" " statePointItem .emit STATE_POINT;\n" "stateSingleItem_11\n" " stateMatrixRow .emit STATE_MATRIX_ROWS;\n" "stateMaterialItem\n" " \"material\" .and optFaceType .and dot .and stateMatProperty .error INVALID_MATERIAL_PROPERTY;\n" "stateMatProperty\n" " \"ambient\" .emit MATERIAL_AMBIENT .or\n" " \"diffuse\" .emit MATERIAL_DIFFUSE .or\n" " \"specular\" .emit MATERIAL_SPECULAR .or\n" " \"emission\" .emit MATERIAL_EMISSION .or\n" " \"shininess\" .emit MATERIAL_SHININESS;\n" "stateLightItem\n" " \"light\" .and lbracket .and stateLightNumber .and rbracket .and dot .and\n" " stateLightProperty .error INVALID_LIGHT_PROPERTY;\n" "stateLightProperty\n" " \"ambient\" .emit LIGHT_AMBIENT .or\n" " \"diffuse\" .emit LIGHT_DIFFUSE .or\n" " \"specular\" .emit LIGHT_SPECULAR .or\n" " \"position\" .emit LIGHT_POSITION .or\n" " \"attenuation\" .emit LIGHT_ATTENUATION .or\n" " stateLightProperty_1 .emit LIGHT_SPOT_DIRECTION .or\n" " \"half\" .emit LIGHT_HALF;\n" "stateLightProperty_1\n" " \"spot\" .and dot .and stateSpotProperty .error INVALID_SPOT_PROPERTY;\n" "stateSpotProperty\n" " \"direction\";\n" "stateLightModelItem\n" " \"lightmodel\" .and stateLModProperty .error INVALID_LIGHTMODEL_PROPERTY;\n" "stateLModProperty\n" " stateLModProperty_1 .or stateLModProperty_2;\n" "stateLModProperty_1\n" " dot .and \"ambient\" .emit LIGHT_MODEL_AMBIENT;\n" "stateLModProperty_2\n" " stateLModProperty_3 .emit LIGHT_MODEL_SCENECOLOR;\n" "stateLModProperty_3\n" " optFaceType .and dot .and \"scenecolor\";\n" "stateLightProdItem\n" " \"lightprod\" .and lbracket .and stateLightNumber .and rbracket .and optFaceType .and dot .and\n" " stateLProdProperty .error INVALID_LIGHTPROD_PROPERTY;\n" "stateLProdProperty\n" " \"ambient\" .emit LIGHT_PROD_AMBIENT .or\n" " \"diffuse\" .emit LIGHT_PROD_DIFFUSE .or\n" " \"specular\" .emit LIGHT_PROD_SPECULAR;\n" "stateLightNumber\n" " integer;\n" "stateTexEnvItem\n" " \"texenv\" .and optLegacyTexUnitNum .and dot .and\n" " stateTexEnvProperty .error INVALID_TEXENV_PROPERTY;\n" "stateTexEnvProperty\n" " \"color\" .emit TEX_ENV_COLOR;\n" "optLegacyTexUnitNum\n" " lbracket_ne .and legacyTexUnitNum .and rbracket;\n" "legacyTexUnitNum\n" " integer;\n" "stateTexGenItem\n" " \"texgen\" .and optTexCoordNum .and dot .and stateTexGenType .error INVALID_TEXGEN_PROPERTY .and\n" " dot .and stateTexGenCoord .error INVALID_TEXGEN_COORD;\n" "stateTexGenType\n" " \"eye\" .emit TEX_GEN_EYE .or\n" " \"object\" .emit TEX_GEN_OBJECT;\n" "stateTexGenCoord\n" " \"s\" .emit COMPONENT_X .or\n" " \"t\" .emit COMPONENT_Y .or\n" " \"r\" .emit COMPONENT_Z .or\n" " \"q\" .emit COMPONENT_W;\n" "stateFogItem\n" " \"fog\" .and dot .and stateFogProperty .error INVALID_FOG_PROPERTY;\n" "stateFogProperty\n" " \"color\" .emit FOG_COLOR .or\n" " \"params\" .emit FOG_PARAMS;\n" "stateDepthItem\n" " \"depth\" .and dot .and stateDepthProperty .error INVALID_DEPTH_PROPERTY;\n" "stateDepthProperty\n" " \"range\" .emit DEPTH_RANGE;\n" "stateClipPlaneItem\n" " \"clip\" .and lbracket .and stateClipPlaneNum .and rbracket .and dot .and\n" " \"plane\" .error INVALID_CLIPPLANE_PROPERTY;\n" "stateClipPlaneNum\n" " integer;\n" "statePointItem\n" " \"point\" .and dot .and statePointProperty .error INVALID_POINT_PROPERTY;\n" "statePointProperty\n" " \"size\" .emit POINT_SIZE .or\n" " .if (point_parameters != 0x00) \"attenuation\" .emit POINT_ATTENUATION;\n" "stateMatrixRow\n" " stateMatrixItem .and dot .and \"row\" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and\n" " lbracket .and stateMatrixRowNum .and rbracket .emit 0x0;\n" "stateMatrixRows\n" " stateMatrixItem .and optMatrixRows;\n" "optMatrixRows\n" " optMatrixRows_1 .or .true .emit 0x0 .emit '3' .emit 0x0 .emit $;\n" "optMatrixRows_1\n" " dot_ne .and \"row\" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and lbracket .and\n" " stateMatrixRowNum .and dotdot .and stateMatrixRowNum .and rbracket;\n" "stateMatrixItem\n" " \"matrix\" .and dot .and stateMatrixName .error INVALID_MATRIX_NAME .and stateOptMatModifier;\n" "stateOptMatModifier\n" " stateOptMatModifier_1 .or .true .emit MATRIX_MODIFIER_IDENTITY;\n" "stateOptMatModifier_1\n" " dot_ne .and stateMatModifier;\n" "stateMatModifier\n" " \"inverse\" .emit MATRIX_MODIFIER_INVERSE .or\n" " \"transpose\" .emit MATRIX_MODIFIER_TRANSPOSE .or\n" " \"invtrans\" .emit MATRIX_MODIFIER_INVTRANS;\n" "stateMatrixRowNum\n" " integer_0_3;\n" "stateMatrixName\n" " stateMatrixName_1_1 .emit MATRIX_MODELVIEW .or\n" " \"projection\" .emit MATRIX_PROJECTION .or\n" " \"mvp\" .emit MATRIX_MVP .or\n" " stateMatrixName_1_2 .emit MATRIX_TEXTURE .or\n" " .if (matrix_palette != 0x00) stateMatrixName_1_3 .emit MATRIX_PALETTE .or\n" " stateMatrixName_1_4 .emit MATRIX_PROGRAM;\n" "stateMatrixName_1_1\n" " \"modelview\" .and stateOptModMatNum;\n" "stateMatrixName_1_2\n" " \"texture\" .and optTexCoordNum;\n" "stateMatrixName_1_3\n" " \"palette\" .and lbracket .and statePaletteMatNum .and rbracket;\n" "stateMatrixName_1_4\n" " \"program\" .and lbracket .and stateProgramMatNum .and rbracket;\n" "stateOptModMatNum\n" " .if (vertex_blend != 0x00) stateOptModMatNum_1 .or\n" " .true .emit 0x00;\n" "stateOptModMatNum_1\n" " lbracket_ne .and stateModMatNum .and rbracket;\n" "stateModMatNum\n" " integer;\n" "optTexCoordNum\n" " optTexCoordNum_1 .or .true .emit 0x00;\n" "optTexCoordNum_1\n" " lbracket_ne .and texCoordNum .and rbracket;\n" "texCoordNum\n" " integer;\n" "statePaletteMatNum\n" " integer;\n" "stateProgramMatNum\n" " integer;\n" "programSingleItem\n" " \"program\" .and dot .and programSingleItem_1 .error INVALID_PROGRAM_PROPERTY;\n" "programSingleItem_1\n" " progEnvParam .or progLocalParam;\n" "programMultipleItem\n" " \"program\" .and dot .and programMultipleItem_1 .error INVALID_PROGRAM_PROPERTY;\n" "programMultipleItem_1\n" " progEnvParams .or progLocalParams;\n" "progEnvParams\n" " \"env\" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNums .and rbracket;\n" "progEnvParamNums\n" " progEnvParamNums_1 .or progEnvParamNums_2;\n" "progEnvParamNums_1\n" " progEnvParamNum .and dotdot_ne .and progEnvParamNum;\n" "progEnvParamNums_2\n" " progEnvParamNum .and .true .emit 0x00;\n" "progEnvParam\n" " \"env\" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNum .and rbracket .emit 0x00;\n" "progLocalParams\n" " \"local\" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNums .and rbracket;\n" "progLocalParamNums\n" " progLocalParamNums_1 .or progLocalParamNums_2;\n" "progLocalParamNums_1\n" " progLocalParamNum .and dotdot_ne .and progLocalParamNum;\n" "progLocalParamNums_2\n" " progLocalParamNum .and .true .emit 0x00;\n" "progLocalParam\n" " \"local\" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNum .and rbracket .emit 0x00;\n" "progEnvParamNum\n" " integer;\n" "progLocalParamNum\n" " integer;\n" "paramConstDecl\n" " paramConstScalarDecl .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;\n" "paramConstUse\n" " paramConstScalarUse .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;\n" "paramConstScalarDecl\n" " signedFloatConstant;\n" "paramConstScalarUse\n" " floatConstant;\n" "paramConstVector\n" " paramConstVector_4 .emit 0x04 .or paramConstVector_3 .emit 0x03 .or\n" " paramConstVector_2 .emit 0x02 .or paramConstVector_1 .emit 0x01;\n" "paramConstVector_1\n" " lbrace_ne .and signedFloatConstant .and rbrace;\n" "paramConstVector_2\n" " lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;\n" "paramConstVector_3\n" " lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and\n" " signedFloatConstant .and rbrace;\n" "paramConstVector_4\n" " lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and\n" " signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;\n" "signedFloatConstant\n" " optionalSign .and floatConstant;\n" "floatConstant\n" " float;\n" "optionalSign\n" " optional_sign_ne;\n" "fp_TEMP_statement\n" " \"TEMP\" .and space .and fp_varNameList .and .true .emit 0x00;\n" "vp_TEMP_statement\n" " \"TEMP\" .and space .and vp_varNameList .and .true .emit 0x00;\n" "ADDRESS_statement\n" " \"ADDRESS\" .and space .and vp_varNameList .and .true .emit 0x00;\n" "fp_varNameList\n" " fp_varNameList_1 .or fp_establishName;\n" "vp_varNameList\n" " vp_varNameList_1 .or vp_establishName;\n" "fp_varNameList_1\n" " fp_establishName .and comma_ne .and fp_varNameList;\n" "vp_varNameList_1\n" " vp_establishName .and comma_ne .and vp_varNameList;\n" "fp_OUTPUT_statement\n" " \"OUTPUT\" .and space .and fp_establishName .and equal .and\n" " fp_resultBinding .error RESULT_EXPECTED;\n" "vp_OUTPUT_statement\n" " \"OUTPUT\" .and space .and vp_establishName .and equal .and\n" " vp_resultBinding .error RESULT_EXPECTED;\n" "fp_resultBinding\n" " \"result\" .and dot .and fp_resultBinding_1 .error INVALID_RESULT_PROPERTY;\n" "vp_resultBinding\n" " \"result\" .and dot .and vp_resultBinding_1 .error INVALID_RESULT_PROPERTY;\n" "fp_resultBinding_1\n" " fp_resultBinding_2 .emit FRAGMENT_RESULT_COLOR .or\n" " \"depth\" .emit FRAGMENT_RESULT_DEPTH;\n" "fp_resultBinding_2\n" " \"color\" .and optOutputColorNum;\n" "vp_resultBinding_1\n" " .if (ARB_position_invariant == 0x00) \"position\" .emit VERTEX_RESULT_POSITION .or\n" " resultColBinding .emit VERTEX_RESULT_COLOR .or\n" " \"fogcoord\" .emit VERTEX_RESULT_FOGCOORD .or\n" " \"pointsize\" .emit VERTEX_RESULT_POINTSIZE .or\n" " vp_resultBinding_2 .emit VERTEX_RESULT_TEXCOORD;\n" "vp_resultBinding_2\n" " \"texcoord\" .and optTexCoordNum;\n" "optOutputColorNum\n" " .if (ARB_draw_buffers != 0x00) optOutputColorNum_1 .or .true .emit 0x00;\n" "optOutputColorNum_1\n" " lbracket_ne .and outputColorNum .and rbracket;\n" "outputColorNum\n" " integer;\n" "resultColBinding\n" " \"color\" .and optFaceType .and optColorType;\n" "optFaceType\n" " FaceType .or .true .emit FACE_FRONT;\n" "FaceType\n" " dot_ne .and FaceProperty;\n" "FaceProperty\n" " \"front\" .emit FACE_FRONT .or \"back\" .emit FACE_BACK;\n" "optColorType\n" " ColorType .or .true .emit COLOR_PRIMARY;\n" "ColorType\n" " dot_ne .and ColorProperty;\n" "ColorProperty\n" " \"primary\" .emit COLOR_PRIMARY .or\n" " .if (secondary_color != 0x00) \"secondary\" .emit COLOR_SECONDARY;\n" "fp_ALIAS_statement\n" " \"ALIAS\" .and fp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and fp_establishedName;\n" "vp_ALIAS_statement\n" " \"ALIAS\" .and vp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and vp_establishedName;\n" "fp_ALIAS_statement_1\n" " space .and fp_establishName;\n" "vp_ALIAS_statement_1\n" " space .and vp_establishName;\n" "fp_establishName\n" " fp_identifier;\n" "vp_establishName\n" " vp_identifier;\n" "fp_establishedName\n" " fp_identifier;\n" "vp_establishedName\n" " vp_identifier;\n" "fp_establishedName_no_error_on_identifier\n" " fp_identifier_ne;\n" "vp_establishedName_no_error_on_identifier\n" " vp_identifier_ne;\n" "fp_identifier\n" " fp_identifier_ne .error IDENTIFIER_EXPECTED;\n" "vp_identifier\n" " vp_identifier_ne .error IDENTIFIER_EXPECTED;\n" "fp_identifier_ne\n" " fp_not_reserved_identifier .and identifier_ne;\n" "vp_identifier_ne\n" " vp_not_reserved_identifier .and identifier_ne;\n" "fp_not_reserved_identifier\n" " fp_not_reserved_identifier_1 .or .true;\n" "fp_not_reserved_identifier_1\n" " fp_reserved_identifier .and .false .error RESERVED_KEYWORD;\n" "vp_not_reserved_identifier\n" " vp_not_reserved_identifier_1 .or .true;\n" "vp_not_reserved_identifier_1\n" " vp_reserved_identifier .and .false .error RESERVED_KEYWORD;\n" "fp_reserved_identifier\n" " \"ABS\" .or \"ABS_SAT\" .or \"ADD\" .or \"ADD_SAT\" .or \"ALIAS\" .or \"ATTRIB\" .or \"CMP\" .or \"CMP_SAT\" .or\n" " \"COS\" .or \"COS_SAT\" .or \"DP3\" .or \"DP3_SAT\" .or \"DP4\" .or \"DP4_SAT\" .or \"DPH\" .or \"DPH_SAT\" .or\n" " \"DST\" .or \"DST_SAT\" .or \"END\" .or \"EX2\" .or \"EX2_SAT\" .or \"FLR\" .or \"FLR_SAT\" .or \"FRC\" .or\n" " \"FRC_SAT\" .or \"KIL\" .or \"LG2\" .or \"LG2_SAT\" .or \"LIT\" .or \"LIT_SAT\" .or \"LRP\" .or \"LRP_SAT\" .or\n" " \"MAD\" .or \"MAD_SAT\" .or \"MAX\" .or \"MAX_SAT\" .or \"MIN\" .or \"MIN_SAT\" .or \"MOV\" .or \"MOV_SAT\" .or\n" " \"MUL\" .or \"MUL_SAT\" .or \"OPTION\" .or \"OUTPUT\" .or \"PARAM\" .or \"POW\" .or \"POW_SAT\" .or \"RCP\" .or\n" " \"RCP_SAT\" .or \"RSQ\" .or \"RSQ_SAT\" .or \"SIN\" .or \"SIN_SAT\" .or \"SCS\" .or \"SCS_SAT\" .or \"SGE\" .or\n" " \"SGE_SAT\" .or \"SLT\" .or \"SLT_SAT\" .or \"SUB\" .or \"SUB_SAT\" .or \"SWZ\" .or \"SWZ_SAT\" .or \"TEMP\" .or\n" " \"TEX\" .or \"TEX_SAT\" .or \"TXB\" .or \"TXB_SAT\" .or \"TXP\" .or \"TXP_SAT\" .or \"XPD\" .or \"XPD_SAT\" .or\n" " \"fragment\" .or \"program\" .or \"result\" .or \"state\" .or \"texture\";\n" "vp_reserved_identifier\n" " \"ABS\" .or \"ADD\" .or \"ADDRESS\" .or \"ALIAS\" .or \"ARL\" .or \"ATTRIB\" .or \"DP3\" .or \"DP4\" .or\n" " \"DPH\" .or \"DST\" .or \"END\" .or \"EX2\" .or \"EXP\" .or \"FLR\" .or \"FRC\" .or \"LG2\" .or \"LIT\" .or\n" " \"LOG\" .or \"MAD\" .or \"MAX\" .or \"MIN\" .or \"MOV\" .or \"MUL\" .or \"OPTION\" .or \"OUTPUT\" .or\n" " \"PARAM\" .or \"POW\" .or \"RCP\" .or \"RSQ\" .or \"SGE\" .or \"SLT\" .or \"SUB\" .or \"SWZ\" .or \"TEMP\" .or\n" " \"XPD\" .or \"program\" .or \"result\" .or \"state\" .or \"vertex\";\n" "integer\n" " integer_ne .error INTEGER_EXPECTED;\n" "zero\n" " '0';\n" "leading_zeroes\n" " .loop zero;\n" "no_digit\n" " no_digit_1 .or .true;\n" "no_digit_1\n" " digit10 .and .false .error INTEGER_OUT_OF_RANGE;\n" "all_zeroes\n" " all_zeroes_1 .or no_digit_1;\n" "all_zeroes_1\n" " '0' .and .loop zero .and no_digit;\n" "integer_0_3\n" " integer_0_3_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;\n" "integer_0_3_1\n" " integer_0_3_2 .or all_zeroes .emit '0';\n" "integer_0_3_2 \n" " leading_zeroes .and '1'-'3' .emit * .and no_digit;\n" "integer_0_63\n" " integer_0_63_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;\n" "integer_0_63_1\n" " integer_0_63_2 .or integer_0_63_3 .or integer_0_63_4 .or integer_0_63_5 .or\n" " all_zeroes .emit '0';\n" "integer_0_63_2 \n" " leading_zeroes .and '7'-'9' .emit * .and no_digit;\n" "integer_0_63_3 \n" " leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;\n" "integer_0_63_4 \n" " leading_zeroes .and '6' .emit * .and '0'-'3' .emit * .and no_digit;\n" "integer_0_63_5 \n" " leading_zeroes .and '1'-'6' .emit * .and no_digit;\n" "integer_0_64\n" " integer_0_64_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;\n" "integer_0_64_1\n" " integer_0_64_2 .or integer_0_64_3 .or integer_0_64_4 .or integer_0_64_5 .or\n" " all_zeroes .emit '0';\n" "integer_0_64_2 \n" " leading_zeroes .and '7'-'9' .emit * .and no_digit;\n" "integer_0_64_3 \n" " leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;\n" "integer_0_64_4 \n" " leading_zeroes .and '6' .emit * .and '0'-'4' .emit * .and no_digit;\n" "integer_0_64_5 \n" " leading_zeroes .and '1'-'6' .emit * .and no_digit;\n" "optional_space\n" " space .or .true;\n" "space_dst\n" " space .error OPERATION_NEEDS_DESTINATION_VARIABLE;\n" "space_src\n" " space .error OPERATION_NEEDS_SOURCE_VARIABLE;\n" "space\n" " single_space .and .loop single_space;\n" "single_space\n" " white_char .or comment_block;\n" "white_char\n" " ' ' .or '\\t' .or '\\n' .or '\\r';\n" "comment_block\n" " '#' .and .loop comment_char .and new_line;\n" "comment_char\n" " '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" "new_line\n" " '\\n' .or crlf .or '\\0';\n" "crlf\n" " '\\r' .and '\\n';\n" "semicolon\n" " optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;\n" "comma\n" " optional_space .and ',' .error MISSING_COMMA .and optional_space;\n" "comma_ne\n" " optional_space .and ',' .and optional_space;\n" "lbracket\n" " optional_space .and '[' .error MISSING_LBRACKET .and optional_space;\n" "lbracket_ne\n" " optional_space .and '[' .and optional_space;\n" "rbracket\n" " optional_space .and ']' .error MISSING_RBRACKET .and optional_space;\n" "dot\n" " optional_space .and '.' .error MISSING_DOT .and optional_space;\n" "dot_ne\n" " optional_space .and '.' .and optional_space;\n" "equal\n" " optional_space .and '=' .error MISSING_EQUAL .and optional_space;\n" "lbrace\n" " optional_space .and '{' .error MISSING_LBRACE .and optional_space;\n" "lbrace_ne\n" " optional_space .and '{' .and optional_space;\n" "rbrace\n" " optional_space .and '}' .error MISSING_RBRACE .and optional_space;\n" "dotdot\n" " optional_space .and '.' .and '.' .error MISSING_DOTDOT .and optional_space;\n" "dotdot_ne\n" " optional_space .and '.' .and '.' .and optional_space;\n" "float\n" " float_1 .or float_2 .or float_legacy;\n" "float_1\n" " '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;\n" "float_2\n" " integer_ne .and float_3;\n" "float_3\n" " float_4 .or float_5;\n" "float_4\n" " '.' .and optional_integer .and optional_exponent;\n" "float_5\n" " exponent .emit 0x00;\n" "float_legacy\n" " integer_ne .and .true .emit 0x00 .emit 0x00;\n" "integer_ne\n" " integer_ne_1 .and .true .emit 0x00 .emit $;\n" "integer_ne_1\n" " digit10 .emit * .and .loop digit10 .emit *;\n" "optional_integer\n" " integer_ne .or .true .emit 0x00;\n" "optional_exponent\n" " exponent .or .true .emit 0x00;\n" "exponent\n" " exponent_1 .and optional_sign_ne .and integer_ne .error EXPONENT_VALUE_EXPECTED;\n" "exponent_1\n" " 'e' .or 'E';\n" "optional_sign_ne\n" " minus_ne .or plus_ne .or .true;\n" "plus_ne\n" " optional_space .and '+' .and optional_space;\n" "minus_ne\n" " optional_space .and '-' .emit '-' .and optional_space;\n" "identifier_ne\n" " first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit 0x00 .emit $;\n" "follow_idchar\n" " first_idchar .or digit10;\n" "first_idchar\n" " 'a'-'z' .or 'A'-'Z' .or '_' .or '$';\n" "digit10\n" " '0'-'9';\n" ".string __string_filter;\n" "__string_filter\n" " .loop __identifier_char;\n" "__identifier_char\n" " 'a'-'z' .or 'A'-'Z' .or '_' .or '$' .or '0'-'9';\n" "e_signature\n" " e_signature_char .and .loop e_signature_char;\n" "e_signature_char\n" " '!' .or '.' .or 'A'-'Z' .or 'a'-'z' .or '0'-'9';\n" "e_statement\n" " .loop e_statement_not_term;\n" "e_statement_not_term\n" " '\\x3C'-'\\xFF' .or '\\x0E'-'\\x3A' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" "e_identifier\n" " e_identifier_first .and .loop e_identifier_next;\n" "e_identifier_first\n" " 'a'-'z' .or 'A'-'Z' .or '_' .or '$';\n" "e_identifier_next\n" " e_identifier_first .or '0'-'9';\n" "e_token\n" " e_identifier .or e_token_number .or '[' .or ']' .or '.' .or '{' .or '}' .or '=' .or '+' .or\n" " '-' .or ',' .or ';';\n" "e_token_number\n" " e_token_digit .and .loop e_token_digit;\n" "e_token_digit\n" " '0'-'9';\n" "e_charordigit\n" " 'A'-'Z' .or 'a'-'z' .or '0'-'9';\n" "" nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/arbvertparse.c0000644000000000000000000001423413614532424021333 0ustar /* * Mesa 3-D graphics library * Version: 6.2 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define DEBUG_VP 0 /** * \file arbvertparse.c * ARB_vertex_program parser. * \author Karl Rasche */ #include "glheader.h" #include "context.h" #include "arbvertparse.h" #include "hash.h" #include "imports.h" #include "macros.h" #include "mtypes.h" #include "program.h" #include "nvprogram.h" #include "nvvertparse.h" #include "nvvertprog.h" #include "arbprogparse.h" /** * XXX this is probably redundant. We've already got code like this * in the nvvertparse.c file. Combine/clean-up someday. */ void _mesa_debug_vp_inst(GLint num, struct vp_instruction *vp) { GLint a; static const char *opcode_string[] = { "ABS", "ADD", "ARL", "DP3", "DP4", "DPH", "DST", "END", /* Placeholder */ "EX2", /* ARB only */ "EXP", "FLR", /* ARB */ "FRC", /* ARB */ "LG2", /* ARB only */ "LIT", "LOG", "MAD", "MAX", "MIN", "MOV", "MUL", "POW", /* ARB only */ "PRINT", /* Mesa only */ "RCC", "RCP", "RSQ", "SGE", "SLT", "SUB", "SWZ", /* ARB only */ "XPD" /* ARB only */ }; static const char *file_string[] = { "TEMP", "INPUT", "OUTPUT", "LOCAL", "ENV", "NAMED", "STATE", "WRITE_ONLY", "ADDR" }; static const char swz[] = "xyzw01??"; for (a=0; aBase.String = ap.Base.String; program->Base.NumInstructions = ap.Base.NumInstructions; program->Base.NumTemporaries = ap.Base.NumTemporaries; program->Base.NumParameters = ap.Base.NumParameters; program->Base.NumAttributes = ap.Base.NumAttributes; program->Base.NumAddressRegs = ap.Base.NumAddressRegs; program->IsPositionInvariant = ap.HintPositionInvariant; program->InputsRead = ap.InputsRead; program->OutputsWritten = ap.OutputsWritten; if (program->Parameters) { /* free previous program's parameters */ _mesa_free_parameter_list(program->Parameters); } program->Parameters = ap.Parameters; program->Instructions = ap.VPInstructions; #if DEBUG_VP _mesa_debug_vp_inst(ap.Base.NumInstructions, ap.VPInstructions); #endif } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/arbvertparse.h0000644000000000000000000000266413614532424021344 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef ARBVERTPARSE_H #define ARBVERTPARSE_H extern void _mesa_parse_arb_vertex_program(GLcontext * ctx, GLenum target, const GLubyte * str, GLsizei len, struct vertex_program *program); extern void _mesa_debug_vp_inst(GLint num, struct vp_instruction *vp); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/atifragshader.c0000644000000000000000000003145713614532424021445 0ustar /** * \file atifragshader.c * \author David Airlie * Copyright (C) 2004 David Airlie All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * DAVID AIRLIE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "context.h" #include "hash.h" #include "imports.h" #include "macros.h" #include "enums.h" #include "mtypes.h" #include "atifragshader.h" #define MESA_DEBUG_ATI_FS 0 extern struct program _mesa_DummyProgram; static void new_inst(struct ati_fragment_shader *prog) { prog->Base.NumInstructions++; } #if MESA_DEBUG_ATI_FS static char * create_dst_mod_str(GLuint mod) { static char ret_str[1024]; _mesa_memset(ret_str, 0, 1024); if (mod & GL_2X_BIT_ATI) _mesa_strncat(ret_str, "|2X", 1024); if (mod & GL_4X_BIT_ATI) _mesa_strncat(ret_str, "|4X", 1024); if (mod & GL_8X_BIT_ATI) _mesa_strncat(ret_str, "|8X", 1024); if (mod & GL_HALF_BIT_ATI) _mesa_strncat(ret_str, "|HA", 1024); if (mod & GL_QUARTER_BIT_ATI) _mesa_strncat(ret_str, "|QU", 1024); if (mod & GL_EIGHTH_BIT_ATI) _mesa_strncat(ret_str, "|EI", 1024); if (mod & GL_SATURATE_BIT_ATI) _mesa_strncat(ret_str, "|SAT", 1024); if (_mesa_strlen(ret_str) == 0) _mesa_strncat(ret_str, "NONE", 1024); return ret_str; } static char *atifs_ops[] = {"ColorFragmentOp1ATI", "ColorFragmentOp2ATI", "ColorFragmentOp3ATI", "AlphaFragmentOp1ATI", "AlphaFragmentOp2ATI", "AlphaFragmentOp3ATI" }; static void debug_op(GLint optype, GLuint arg_count, GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod) { char *op_name; op_name = atifs_ops[(arg_count-1)+(optype?3:0)]; fprintf(stderr, "%s(%s, %s", op_name, _mesa_lookup_enum_by_nr(op), _mesa_lookup_enum_by_nr(dst)); if (!optype) fprintf(stderr, ", %d", dstMask); fprintf(stderr, ", %s", create_dst_mod_str(dstMod)); fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg1), _mesa_lookup_enum_by_nr(arg1Rep), arg1Mod); if (arg_count>1) fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg2), _mesa_lookup_enum_by_nr(arg2Rep), arg2Mod); if (arg_count>2) fprintf(stderr, ", %s, %s, %d", _mesa_lookup_enum_by_nr(arg3), _mesa_lookup_enum_by_nr(arg3Rep), arg3Mod); fprintf(stderr,")\n"); } #endif GLuint GLAPIENTRY _mesa_GenFragmentShadersATI(GLuint range) { GLuint first; GLuint i; GET_CURRENT_CONTEXT(ctx); first = _mesa_HashFindFreeKeyBlock(ctx->Shared->Programs, range); for (i = 0; i < range; i++) { _mesa_HashInsert(ctx->Shared->Programs, first + i, &_mesa_DummyProgram); } return first; } void GLAPIENTRY _mesa_BindFragmentShaderATI(GLuint id) { struct program *prog; GET_CURRENT_CONTEXT(ctx); struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; FLUSH_VERTICES(ctx, _NEW_PROGRAM); if (curProg->Base.Id == id) { return; } if (curProg->Base.Id != 0) { curProg->Base.RefCount--; if (curProg->Base.RefCount <= 0) { _mesa_HashRemove(ctx->Shared->Programs, id); } } /* Go bind */ if (id == 0) { prog = ctx->Shared->DefaultFragmentShader; } else { prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (!prog || prog == &_mesa_DummyProgram) { /* allocate a new program now */ prog = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_SHADER_ATI, id); if (!prog) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindFragmentShaderATI"); return; } _mesa_HashInsert(ctx->Shared->Programs, id, prog); } } /* do actual bind */ ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) prog; ASSERT(ctx->ATIFragmentShader.Current); if (prog) prog->RefCount++; /*if (ctx->Driver.BindProgram) ctx->Driver.BindProgram(ctx, target, prog); */ } void GLAPIENTRY _mesa_DeleteFragmentShaderATI(GLuint id) { GET_CURRENT_CONTEXT(ctx); if (id != 0) { struct program *prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (prog == &_mesa_DummyProgram) { _mesa_HashRemove(ctx->Shared->Programs, id); } else if (prog) { if (ctx->ATIFragmentShader.Current && ctx->ATIFragmentShader.Current->Base.Id == id) { _mesa_BindFragmentShaderATI(0); } } #if 0 if (!prog->DeletePending) { prog->DeletePending = GL_TRUE; prog->RefCount--; } if (prog->RefCount <= 0) { _mesa_HashRemove(ctx->Shared->Programs, id); ctx->Driver.DeleteProgram(ctx, prog); } #else /* The ID is immediately available for re-use now */ _mesa_HashRemove(ctx->Shared->Programs, id); prog->RefCount--; if (prog->RefCount <= 0) { ctx->Driver.DeleteProgram(ctx, prog); } #endif } } void GLAPIENTRY _mesa_BeginFragmentShaderATI(void) { GET_CURRENT_CONTEXT(ctx); /* malloc the instructions here - not sure if the best place but its a start */ ctx->ATIFragmentShader.Current->Instructions = (struct atifs_instruction *) _mesa_calloc(sizeof(struct atifs_instruction) * MAX_NUM_PASSES_ATI * MAX_NUM_INSTRUCTIONS_PER_PASS_ATI * 2); ctx->ATIFragmentShader.Current->cur_pass = 0; ctx->ATIFragmentShader.Compiling = 1; } void GLAPIENTRY _mesa_EndFragmentShaderATI(void) { GET_CURRENT_CONTEXT(ctx); #if MESA_DEBUG_ATI_FS struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; GLint i; #endif ctx->ATIFragmentShader.Compiling = 0; ctx->ATIFragmentShader.Current->NumPasses = ctx->ATIFragmentShader.Current->cur_pass; ctx->ATIFragmentShader.Current->cur_pass=0; #if MESA_DEBUG_ATI_FS for (i = 0; i < curProg->Base.NumInstructions; i++) { GLuint op0 = curProg->Instructions[i].Opcode[0]; GLuint op1 = curProg->Instructions[i].Opcode[1]; const char *op0_enum = op0 > 5 ? _mesa_lookup_enum_by_nr(op0) : "0"; const char *op1_enum = op1 > 5 ? _mesa_lookup_enum_by_nr(op1) : "0"; GLuint count0 = curProg->Instructions[i].ArgCount[0]; GLuint count1 = curProg->Instructions[i].ArgCount[1]; fprintf(stderr, "%2d %04X %s %d %04X %s %d\n", i, op0, op0_enum, count0, op1, op1_enum, count1); } #endif } void GLAPIENTRY _mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle) { GET_CURRENT_CONTEXT(ctx); struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; GLint ci; struct atifs_instruction *curI; if (ctx->ATIFragmentShader.Current->cur_pass==1) ctx->ATIFragmentShader.Current->cur_pass=2; new_inst(curProg); ci = curProg->Base.NumInstructions - 1; /* some validation if ((swizzle != GL_SWIZZLE_STR_ATI) || (swizzle != GL_SWIZZLE_STQ_ATI) || (swizzle != GL_SWIZZLE_STR_DR_ATI) || (swizzle != GL_SWIZZLE_STQ_DQ_ATI)) */ /* add the instructions */ curI = &curProg->Instructions[ci]; curI->Opcode[0] = ATI_FRAGMENT_SHADER_PASS_OP; curI->DstReg[0].Index = dst; curI->SrcReg[0][0].Index = coord; curI->DstReg[0].Swizzle = swizzle; #if MESA_DEBUG_ATI_FS _mesa_debug(ctx, "%s(%s, %s, %s)\n", __FUNCTION__, _mesa_lookup_enum_by_nr(dst), _mesa_lookup_enum_by_nr(coord), _mesa_lookup_enum_by_nr(swizzle)); #endif } void GLAPIENTRY _mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle) { GET_CURRENT_CONTEXT(ctx); struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; GLint ci; struct atifs_instruction *curI; if (ctx->ATIFragmentShader.Current->cur_pass==1) ctx->ATIFragmentShader.Current->cur_pass=2; new_inst(curProg); ci = curProg->Base.NumInstructions - 1; /* add the instructions */ curI = &curProg->Instructions[ci]; curI->Opcode[0] = ATI_FRAGMENT_SHADER_SAMPLE_OP; curI->DstReg[0].Index = dst; curI->DstReg[0].Swizzle = swizzle; curI->SrcReg[0][0].Index = interp; #if MESA_DEBUG_ATI_FS _mesa_debug(ctx, "%s(%s, %s, %s)\n", __FUNCTION__, _mesa_lookup_enum_by_nr(dst), _mesa_lookup_enum_by_nr(interp), _mesa_lookup_enum_by_nr(swizzle)); #endif } static void _mesa_FragmentOpXATI(GLint optype, GLuint arg_count, GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod) { GET_CURRENT_CONTEXT(ctx); struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; GLint ci; struct atifs_instruction *curI; if (ctx->ATIFragmentShader.Current->cur_pass==0) ctx->ATIFragmentShader.Current->cur_pass=1; /* decide whether this is a new instruction or not ... all color instructions are new */ if (optype == 0) new_inst(curProg); ci = curProg->Base.NumInstructions - 1; /* add the instructions */ curI = &curProg->Instructions[ci]; curI->Opcode[optype] = op; curI->SrcReg[optype][0].Index = arg1; curI->SrcReg[optype][0].argRep = arg1Rep; curI->SrcReg[optype][0].argMod = arg1Mod; curI->ArgCount[optype] = arg_count; if (arg2) { curI->SrcReg[optype][1].Index = arg2; curI->SrcReg[optype][1].argRep = arg2Rep; curI->SrcReg[optype][1].argMod = arg2Mod; } if (arg3) { curI->SrcReg[optype][2].Index = arg3; curI->SrcReg[optype][2].argRep = arg3Rep; curI->SrcReg[optype][2].argMod = arg3Mod; } curI->DstReg[optype].Index = dst; curI->DstReg[optype].dstMod = dstMod; curI->DstReg[optype].dstMask = dstMask; #if MESA_DEBUG_ATI_FS debug_op(optype, arg_count, op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod); #endif } void GLAPIENTRY _mesa_ColorFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod) { _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 1, op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, 0, 0, 0, 0, 0, 0); } void GLAPIENTRY _mesa_ColorFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod) { _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 2, op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, 0, 0, 0); } void GLAPIENTRY _mesa_ColorFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod) { _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_COLOR_OP, 3, op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod); } void GLAPIENTRY _mesa_AlphaFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod) { _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 1, op, dst, 0, dstMod, arg1, arg1Rep, arg1Mod, 0, 0, 0, 0, 0, 0); } void GLAPIENTRY _mesa_AlphaFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod) { _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 2, op, dst, 0, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, 0, 0, 0); } void GLAPIENTRY _mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod) { _mesa_FragmentOpXATI(ATI_FRAGMENT_SHADER_ALPHA_OP, 3, op, dst, 0, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod); } void GLAPIENTRY _mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); GLuint dstindex = dst - GL_CON_0_ATI; struct ati_fragment_shader *curProg = ctx->ATIFragmentShader.Current; COPY_4V(curProg->Constants[dstindex], value); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/atifragshader.h0000644000000000000000000000546613614532424021453 0ustar /* * Mesa 3-D graphics library ATI Fragment Shader * * Copyright (C) 2004 David Airlie All Rights Reserved. * */ #ifndef ATIFRAGSHADER_H #define ATIFRAGSHADER_H #define MAX_NUM_INSTRUCTIONS_PER_PASS_ATI 8 #define MAX_NUM_PASSES_ATI 2 #define MAX_NUM_FRAGMENT_REGISTERS_ATI 6 struct ati_fs_opcode_st { GLenum opcode; GLint num_src_args; }; extern struct ati_fs_opcode_st ati_fs_opcodes[]; struct atifragshader_src_register { GLuint Index; GLuint argRep; GLuint argMod; }; struct atifragshader_dst_register { GLuint Index; GLuint dstMod; GLuint dstMask; GLuint Swizzle; }; #define ATI_FRAGMENT_SHADER_COLOR_OP 0 #define ATI_FRAGMENT_SHADER_ALPHA_OP 1 #define ATI_FRAGMENT_SHADER_PASS_OP 2 #define ATI_FRAGMENT_SHADER_SAMPLE_OP 3 /* two opcodes - one for color/one for alpha - also pass/sample */ /* up to three source registers for most ops */ struct atifs_instruction { GLenum Opcode[2]; GLuint ArgCount[2]; struct atifragshader_src_register SrcReg[2][3]; struct atifragshader_dst_register DstReg[2]; }; extern GLuint GLAPIENTRY _mesa_GenFragmentShadersATI(GLuint range); extern void GLAPIENTRY _mesa_BindFragmentShaderATI(GLuint id); extern void GLAPIENTRY _mesa_DeleteFragmentShaderATI(GLuint id); extern void GLAPIENTRY _mesa_BeginFragmentShaderATI(void); extern void GLAPIENTRY _mesa_EndFragmentShaderATI(void); extern void GLAPIENTRY _mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle); extern void GLAPIENTRY _mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle); extern void GLAPIENTRY _mesa_ColorFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); extern void GLAPIENTRY _mesa_ColorFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); extern void GLAPIENTRY _mesa_ColorFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); extern void GLAPIENTRY _mesa_AlphaFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); extern void GLAPIENTRY _mesa_AlphaFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); extern void GLAPIENTRY _mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); extern void GLAPIENTRY _mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/grammar/grammar.c0000644000000000000000000023672213614532424021717 0ustar /* * Mesa 3-D graphics library * Version: 6.2 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file grammar.c * syntax parsing engine * \author Michal Krol */ #ifndef GRAMMAR_PORT_BUILD #error Do not build this file directly, build your grammar_XXX.c instead, which includes this file #endif /* */ /* INTRODUCTION ------------ The task is to check the syntax of an input string. Input string is a stream of ASCII characters terminated with a null-character ('\0'). Checking it using C language is difficult and hard to implement without bugs. It is hard to maintain and make changes when the syntax changes. This is because of a high redundancy of the C code. Large blocks of code are duplicated with only small changes. Even use of macros does not solve the problem because macros cannot erase the complexity of the problem. The resolution is to create a new language that will be highly oriented to our task. Once we describe a particular syntax, we are done. We can then focus on the code that implements the language. The size and complexity of it is relatively small than the code that directly checks the syntax. First, we must implement our new language. Here, the language is implemented in C, but it could also be implemented in any other language. The code is listed below. We must take a good care that it is bug free. This is simple because the code is simple and clean. Next, we must describe the syntax of our new language in itself. Once created and checked manually that it is correct, we can use it to check another scripts. Note that our new language loading code does not have to check the syntax. It is because we assume that the script describing itself is correct, and other scripts can be syntactically checked by the former script. The loading code must only do semantic checking which leads us to simple resolving references. THE LANGUAGE ------------ Here I will describe the syntax of the new language (further called "Synek"). It is mainly a sequence of declarations terminated by a semicolon. The declaration consists of a symbol, which is an identifier, and its definition. A definition is in turn a sequence of specifiers connected with ".and" or ".or" operator. These operators cannot be mixed together in a one definition. Specifier can be a symbol, string, character, character range or a special keyword ".true" or ".false". On the very beginning of the script there is a declaration of a root symbol and is in the form: .syntax ; The must be on of the symbols in declaration sequence. The syntax is correct if the root symbol evaluates to true. A symbol evaluates to true if the definition associated with the symbol evaluates to true. Definition evaluation depends on the operator used to connect specifiers in the definition. If ".and" operator is used, definition evaluates to true if and only if all the specifiers evaluate to true. If ".or" operator is used, definition evalutes to true if any of the specifiers evaluates to true. If definition contains only one specifier, it is evaluated as if it was connected with ".true" keyword by ".and" operator. If specifier is a ".true" keyword, it always evaluates to true. If specifier is a ".false" keyword, it always evaluates to false. Specifier evaluates to false when it does not evaluate to true. Character range specifier is in the form: '' - '' If specifier is a character range, it evaluates to true if character in the stream is greater or equal to and less or equal to . In that situation the stream pointer is advanced to point to next character in the stream. All C-style escape sequences are supported although trigraph sequences are not. The comparisions are performed on 8-bit unsigned integers. Character specifier is in the form: '' It evaluates to true if the following character range specifier evaluates to true: '' - '' String specifier is in the form: "" Let N be the number of characters in . Let [i] designate i-th character in . Then the string specifier evaluates to true if and only if for i in the range [0, N) the following character specifier evaluates to true: '[i]' If [i] is a quotation mark, '[i]' is replaced with '\[i]'. Symbol specifier can be optionally preceded by a ".loop" keyword in the form: .loop (1) where is defined as follows: ; (2) Construction (1) is replaced by the following code: and declaration (2) is replaced by the following: .or .true; .and ; ; Synek supports also a register mechanizm. User can, in its SYN file, declare a number of registers that can be accessed in the syn body. Each reg has its name and a default value. The register is one byte wide. The C code can change the default value by calling grammar_set_reg8() with grammar id, register name and a new value. As we know, each rule is a sequence of specifiers joined with .and or .or operator. And now each specifier can be prefixed with a condition expression in a form ".if ( )" where can be == or !=. If the condition evaluates to false, the specifier evaluates to .false. Otherwise it evalutes to the specifier. ESCAPE SEQUENCES ---------------- Synek supports all escape sequences in character specifiers. The mapping table is listed below. All occurences of the characters in the first column are replaced with the corresponding character in the second column. Escape sequence Represents ------------------------------------------------------------------------------------------------ \a Bell (alert) \b Backspace \f Formfeed \n New line \r Carriage return \t Horizontal tab \v Vertical tab \' Single quotation mark \" Double quotation mark \\ Backslash \? Literal question mark \ooo ASCII character in octal notation \xhhh ASCII character in hexadecimal notation ------------------------------------------------------------------------------------------------ RAISING ERRORS -------------- Any specifier can be followed by a special construction that is executed when the specifier evaluates to false. The construction is in the form: .error is an identifier declared earlier by error text declaration. The declaration is in the form: .errtext "" When specifier evaluates to false and this construction is present, parsing is stopped immediately and is returned as a result of parsing. The error position is also returned and it is meant as an offset from the beggining of the stream to the character that was valid so far. Example: (**** syntax script ****) .syntax program; .errtext MISSING_SEMICOLON "missing ';'" program declaration .and .loop space .and ';' .error MISSING_SEMICOLON .and .loop space .and '\0'; declaration "declare" .and .loop space .and identifier; space ' '; (**** sample code ****) declare foo , In the example above checking the sample code will result in error message "missing ';'" and error position 12. The sample code is not correct. Note the presence of '\0' specifier to assure that there is no code after semicolon - only spaces. can optionally contain identifier surrounded by dollar signs $. In such a case, the identifier and dollar signs are replaced by a string retrieved by invoking symbol with the identifier name. The starting position is the error position. The lenght of the resulting string is the position after invoking the symbol. PRODUCTION ---------- Synek not only checks the syntax but it can also produce (emit) bytes associated with specifiers that evaluate to true. That is, every specifier and optional error construction can be followed by a number of emit constructions that are in the form: .emit can be a HEX number, identifier, a star * or a dollar $. HEX number is preceded by 0x or 0X. If is an identifier, it must be earlier declared by emit code declaration in the form: .emtcode When given specifier evaluates to true, all emits associated with the specifier are output in order they were declared. A star means that last-read character should be output instead of constant value. Example: (**** syntax script ****) .syntax foobar; .emtcode WORD_FOO 0x01 .emtcode WORD_BAR 0x02 foobar FOO .emit WORD_FOO .or BAR .emit WORD_BAR .or .true .emit 0x00; FOO "foo" .and SPACE; BAR "bar" .and SPACE; SPACE ' ' .or '\0'; (**** sample text 1 ****) foo (**** sample text 2 ****) foobar For both samples the result will be one-element array. For first sample text it will be value 1, for second - 0. Note that every text will be accepted because of presence of .true as an alternative. Another example: (**** syntax script ****) .syntax declaration; .emtcode VARIABLE 0x01 declaration "declare" .and .loop space .and identifier .emit VARIABLE .and (1) .true .emit 0x00 .and (2) .loop space .and ';'; space ' ' .or '\t'; identifier .loop id_char .emit *; (3) id_char 'a'-'z' .or 'A'-'Z' .or '_'; (**** sample code ****) declare fubar; In specifier (1) symbol is followed by .emit VARIABLE. If it evaluates to true, VARIABLE constant and then production of the symbol is output. Specifier (2) is used to terminate the string with null to signal when the string ends. Specifier (3) outputs all characters that make declared identifier. The result of sample code will be the following array: { 1, 'f', 'u', 'b', 'a', 'r', 0 } If .emit is followed by dollar $, it means that current position should be output. Current position is a 32-bit unsigned integer distance from the very beginning of the parsed string to first character consumed by the specifier associated with the .emit instruction. Current position is stored in the output buffer in Little-Endian convention (the lowest byte comes first). */ static void mem_free (void **); /* internal error messages */ static const byte *OUT_OF_MEMORY = (byte *) "internal error 1001: out of physical memory"; static const byte *UNRESOLVED_REFERENCE = (byte *) "internal error 1002: unresolved reference '$'"; static const byte *INVALID_GRAMMAR_ID = (byte *) "internal error 1003: invalid grammar object"; static const byte *INVALID_REGISTER_NAME = (byte *) "internal error 1004: invalid register name: '$'"; /*static const byte *DUPLICATE_IDENTIFIER = (byte *) "internal error 1005: identifier '$' already defined";*/ static const byte *UNREFERENCED_IDENTIFIER =(byte *) "internal error 1006: unreferenced identifier '$'"; static const byte *error_message = NULL; /* points to one of the error messages above */ static byte *error_param = NULL; /* this is inserted into error_message in place of $ */ static int error_position = -1; static byte *unknown = (byte *) "???"; static void clear_last_error (void) { /* reset error message */ error_message = NULL; /* free error parameter - if error_param is a "???" don't free it - it's static */ if (error_param != unknown) mem_free ((void **) (void *) &error_param); else error_param = NULL; /* reset error position */ error_position = -1; } static void set_last_error (const byte *msg, byte *param, int pos) { /* error message can be set only once */ if (error_message != NULL) { mem_free ((void **) (void *) ¶m); return; } error_message = msg; /* if param is NULL, set error_param to unknown ("???") */ /* note: do not try to strdup the "???" - it may be that we are here because of */ /* out of memory error so strdup can fail */ if (param != NULL) error_param = param; else error_param = unknown; error_position = pos; } /* memory management routines */ static void *mem_alloc (size_t size) { void *ptr = grammar_alloc_malloc (size); if (ptr == NULL) set_last_error (OUT_OF_MEMORY, NULL, -1); return ptr; } static void *mem_copy (void *dst, const void *src, size_t size) { return grammar_memory_copy (dst, src, size); } static void mem_free (void **ptr) { grammar_alloc_free (*ptr); *ptr = NULL; } static void *mem_realloc (void *ptr, size_t old_size, size_t new_size) { void *ptr2 = grammar_alloc_realloc (ptr, old_size, new_size); if (ptr2 == NULL) set_last_error (OUT_OF_MEMORY, NULL, -1); return ptr2; } static byte *str_copy_n (byte *dst, const byte *src, size_t max_len) { return grammar_string_copy_n (dst, src, max_len); } static byte *str_duplicate (const byte *str) { byte *new_str = grammar_string_duplicate (str); if (new_str == NULL) set_last_error (OUT_OF_MEMORY, NULL, -1); return new_str; } static int str_equal (const byte *str1, const byte *str2) { return grammar_string_compare (str1, str2) == 0; } static int str_equal_n (const byte *str1, const byte *str2, unsigned int n) { return grammar_string_compare_n (str1, str2, n) == 0; } static unsigned int str_length (const byte *str) { return grammar_string_length (str); } /* useful macros */ #define GRAMMAR_IMPLEMENT_LIST_APPEND(_Ty)\ static void _Ty##_append (_Ty **x, _Ty *nx) {\ while (*x) x = &(**x).next;\ *x = nx;\ } /* string to byte map typedef */ typedef struct map_byte_ { byte *key; byte data; struct map_byte_ *next; } map_byte; static void map_byte_create (map_byte **ma) { *ma = (map_byte *) mem_alloc (sizeof (map_byte)); if (*ma) { (**ma).key = NULL; (**ma).data = '\0'; (**ma).next = NULL; } } static void map_byte_destroy (map_byte **ma) { if (*ma) { map_byte_destroy (&(**ma).next); mem_free ((void **) &(**ma).key); mem_free ((void **) ma); } } GRAMMAR_IMPLEMENT_LIST_APPEND(map_byte) /* searches the map for the specified key, returns pointer to the element with the specified key if it exists returns NULL otherwise */ static map_byte *map_byte_locate (map_byte **ma, const byte *key) { while (*ma) { if (str_equal ((**ma).key, key)) return *ma; ma = &(**ma).next; } set_last_error (UNRESOLVED_REFERENCE, str_duplicate (key), -1); return NULL; } /* searches the map for specified key, if the key is matched, *data is filled with data associated with the key, returns 0 if the key is matched, returns 1 otherwise */ static int map_byte_find (map_byte **ma, const byte *key, byte *data) { map_byte *found = map_byte_locate (ma, key); if (found != NULL) { *data = found->data; return 0; } return 1; } /* regbyte context typedef Each regbyte consists of its name and a default value. These are static and created at grammar script compile-time, for example the following line: .regbyte vertex_blend 0x00 adds a new regbyte named "vertex_blend" to the static list and initializes it to 0. When the script is executed, this regbyte can be accessed by name for read and write. When a particular regbyte is written, a new regbyte_ctx entry is added to the top of the regbyte_ctx stack. The new entry contains information abot which regbyte it references and its new value. When a given regbyte is accessed for read, the stack is searched top-down to find an entry that references the regbyte. The first matching entry is used to return the current value it holds. If no entry is found, the default value is returned. */ typedef struct regbyte_ctx_ { map_byte *m_regbyte; byte m_current_value; struct regbyte_ctx_ *m_prev; } regbyte_ctx; static void regbyte_ctx_create (regbyte_ctx **re) { *re = (regbyte_ctx *) mem_alloc (sizeof (regbyte_ctx)); if (*re) { (**re).m_regbyte = NULL; (**re).m_prev = NULL; } } static void regbyte_ctx_destroy (regbyte_ctx **re) { if (*re) { mem_free ((void **) re); } } static byte regbyte_ctx_extract (regbyte_ctx **re, map_byte *reg) { /* first lookup in the register stack */ while (*re != NULL) { if ((**re).m_regbyte == reg) return (**re).m_current_value; re = &(**re).m_prev; } /* if not found - return the default value */ return reg->data; } /* emit type typedef */ typedef enum emit_type_ { et_byte, /* explicit number */ et_stream, /* eaten character */ et_position /* current position */ } emit_type; /* emit destination typedef */ typedef enum emit_dest_ { ed_output, /* write to the output buffer */ ed_regbyte /* write a particular regbyte */ } emit_dest; /* emit typedef */ typedef struct emit_ { emit_dest m_emit_dest; emit_type m_emit_type; /* ed_output */ byte m_byte; /* et_byte */ map_byte *m_regbyte; /* ed_regbyte */ byte *m_regname; /* ed_regbyte - temporary */ struct emit_ *m_next; } emit; static void emit_create (emit **em) { *em = (emit *) mem_alloc (sizeof (emit)); if (*em) { (**em).m_emit_dest = ed_output; (**em).m_emit_type = et_byte; (**em).m_byte = '\0'; (**em).m_regbyte = NULL; (**em).m_regname = NULL; (**em).m_next = NULL; } } static void emit_destroy (emit **em) { if (*em) { emit_destroy (&(**em).m_next); mem_free ((void **) &(**em).m_regname); mem_free ((void **) em); } } static unsigned int emit_size (emit *_E) { unsigned int n = 0; while (_E != NULL) { if (_E->m_emit_dest == ed_output) { if (_E->m_emit_type == et_position) n += 4; /* position is a 32-bit unsigned integer */ else n++; } _E = _E->m_next; } return n; } static int emit_push (emit *_E, byte *_P, byte c, unsigned int _Pos, regbyte_ctx **_Ctx) { while (_E != NULL) { if (_E->m_emit_dest == ed_output) { if (_E->m_emit_type == et_byte) *_P++ = _E->m_byte; else if (_E->m_emit_type == et_stream) *_P++ = c; else /* _Em->type == et_position */ { *_P++ = (byte) (_Pos); *_P++ = (byte) (_Pos >> 8); *_P++ = (byte) (_Pos >> 16); *_P++ = (byte) (_Pos >> 24); } } else { regbyte_ctx *new_rbc; regbyte_ctx_create (&new_rbc); if (new_rbc == NULL) return 1; new_rbc->m_prev = *_Ctx; new_rbc->m_regbyte = _E->m_regbyte; *_Ctx = new_rbc; if (_E->m_emit_type == et_byte) new_rbc->m_current_value = _E->m_byte; else if (_E->m_emit_type == et_stream) new_rbc->m_current_value = c; } _E = _E->m_next; } return 0; } /* error typedef */ typedef struct error_ { byte *m_text; byte *m_token_name; struct rule_ *m_token; } error; static void error_create (error **er) { *er = (error *) mem_alloc (sizeof (error)); if (*er) { (**er).m_text = NULL; (**er).m_token_name = NULL; (**er).m_token = NULL; } } static void error_destroy (error **er) { if (*er) { mem_free ((void **) &(**er).m_text); mem_free ((void **) &(**er).m_token_name); mem_free ((void **) er); } } struct dict_; static byte *error_get_token (error *, struct dict_ *, const byte *, unsigned int); /* condition operand type typedef */ typedef enum cond_oper_type_ { cot_byte, /* constant 8-bit unsigned integer */ cot_regbyte /* pointer to byte register containing the current value */ } cond_oper_type; /* condition operand typedef */ typedef struct cond_oper_ { cond_oper_type m_type; byte m_byte; /* cot_byte */ map_byte *m_regbyte; /* cot_regbyte */ byte *m_regname; /* cot_regbyte - temporary */ } cond_oper; /* condition type typedef */ typedef enum cond_type_ { ct_equal, ct_not_equal } cond_type; /* condition typedef */ typedef struct cond_ { cond_type m_type; cond_oper m_operands[2]; } cond; static void cond_create (cond **co) { *co = (cond *) mem_alloc (sizeof (cond)); if (*co) { (**co).m_operands[0].m_regname = NULL; (**co).m_operands[1].m_regname = NULL; } } static void cond_destroy (cond **co) { if (*co) { mem_free ((void **) &(**co).m_operands[0].m_regname); mem_free ((void **) &(**co).m_operands[1].m_regname); mem_free ((void **) co); } } /* specifier type typedef */ typedef enum spec_type_ { st_false, st_true, st_byte, st_byte_range, st_string, st_identifier, st_identifier_loop, st_debug } spec_type; /* specifier typedef */ typedef struct spec_ { spec_type m_spec_type; byte m_byte[2]; /* st_byte, st_byte_range */ byte *m_string; /* st_string */ struct rule_ *m_rule; /* st_identifier, st_identifier_loop */ emit *m_emits; error *m_errtext; cond *m_cond; struct spec_ *next; } spec; static void spec_create (spec **sp) { *sp = (spec *) mem_alloc (sizeof (spec)); if (*sp) { (**sp).m_spec_type = st_false; (**sp).m_byte[0] = '\0'; (**sp).m_byte[1] = '\0'; (**sp).m_string = NULL; (**sp).m_rule = NULL; (**sp).m_emits = NULL; (**sp).m_errtext = NULL; (**sp).m_cond = NULL; (**sp).next = NULL; } } static void spec_destroy (spec **sp) { if (*sp) { spec_destroy (&(**sp).next); emit_destroy (&(**sp).m_emits); error_destroy (&(**sp).m_errtext); mem_free ((void **) &(**sp).m_string); cond_destroy (&(**sp).m_cond); mem_free ((void **) sp); } } GRAMMAR_IMPLEMENT_LIST_APPEND(spec) /* operator typedef */ typedef enum oper_ { op_none, op_and, op_or } oper; /* rule typedef */ typedef struct rule_ { oper m_oper; spec *m_specs; struct rule_ *next; int m_referenced; } rule; static void rule_create (rule **ru) { *ru = (rule *) mem_alloc (sizeof (rule)); if (*ru) { (**ru).m_oper = op_none; (**ru).m_specs = NULL; (**ru).next = NULL; (**ru).m_referenced = 0; } } static void rule_destroy (rule **ru) { if (*ru) { rule_destroy (&(**ru).next); spec_destroy (&(**ru).m_specs); mem_free ((void **) ru); } } GRAMMAR_IMPLEMENT_LIST_APPEND(rule) /* returns unique grammar id */ static grammar next_valid_grammar_id (void) { static grammar id = 0; return ++id; } /* dictionary typedef */ typedef struct dict_ { rule *m_rulez; rule *m_syntax; rule *m_string; map_byte *m_regbytes; grammar m_id; struct dict_ *next; } dict; static void dict_create (dict **di) { *di = (dict *) mem_alloc (sizeof (dict)); if (*di) { (**di).m_rulez = NULL; (**di).m_syntax = NULL; (**di).m_string = NULL; (**di).m_regbytes = NULL; (**di).m_id = next_valid_grammar_id (); (**di).next = NULL; } } static void dict_destroy (dict **di) { if (*di) { rule_destroy (&(**di).m_rulez); map_byte_destroy (&(**di).m_regbytes); mem_free ((void **) di); } } GRAMMAR_IMPLEMENT_LIST_APPEND(dict) static void dict_find (dict **di, grammar key, dict **data) { while (*di) { if ((**di).m_id == key) { *data = *di; return; } di = &(**di).next; } *data = NULL; } static dict *g_dicts = NULL; /* byte array typedef */ typedef struct barray_ { byte *data; unsigned int len; } barray; static void barray_create (barray **ba) { *ba = (barray *) mem_alloc (sizeof (barray)); if (*ba) { (**ba).data = NULL; (**ba).len = 0; } } static void barray_destroy (barray **ba) { if (*ba) { mem_free ((void **) &(**ba).data); mem_free ((void **) ba); } } /* reallocates byte array to requested size, returns 0 on success, returns 1 otherwise */ static int barray_resize (barray **ba, unsigned int nlen) { byte *new_pointer; if (nlen == 0) { mem_free ((void **) &(**ba).data); (**ba).data = NULL; (**ba).len = 0; return 0; } else { new_pointer = (byte *) mem_realloc ((**ba).data, (**ba).len * sizeof (byte), nlen * sizeof (byte)); if (new_pointer) { (**ba).data = new_pointer; (**ba).len = nlen; return 0; } } return 1; } /* adds byte array pointed by *nb to the end of array pointed by *ba, returns 0 on success, returns 1 otherwise */ static int barray_append (barray **ba, barray **nb) { const unsigned int len = (**ba).len; if (barray_resize (ba, (**ba).len + (**nb).len)) return 1; mem_copy ((**ba).data + len, (**nb).data, (**nb).len); return 0; } /* adds emit chain pointed by em to the end of array pointed by *ba, returns 0 on success, returns 1 otherwise */ static int barray_push (barray **ba, emit *em, byte c, unsigned int pos, regbyte_ctx **rbc) { unsigned int count = emit_size (em); if (barray_resize (ba, (**ba).len + count)) return 1; return emit_push (em, (**ba).data + ((**ba).len - count), c, pos, rbc); } /* byte pool typedef */ typedef struct bytepool_ { byte *_F; unsigned int _Siz; } bytepool; static void bytepool_destroy (bytepool **by) { if (*by != NULL) { mem_free ((void **) &(**by)._F); mem_free ((void **) by); } } static void bytepool_create (bytepool **by, int len) { *by = (bytepool *) (mem_alloc (sizeof (bytepool))); if (*by != NULL) { (**by)._F = (byte *) (mem_alloc (sizeof (byte) * len)); (**by)._Siz = len; if ((**by)._F == NULL) bytepool_destroy (by); } } static int bytepool_reserve (bytepool *by, unsigned int n) { byte *_P; if (n <= by->_Siz) return 0; /* byte pool can only grow and at least by doubling its size */ n = n >= by->_Siz * 2 ? n : by->_Siz * 2; /* reallocate the memory and adjust pointers to the new memory location */ _P = (byte *) (mem_realloc (by->_F, sizeof (byte) * by->_Siz, sizeof (byte) * n)); if (_P != NULL) { by->_F = _P; by->_Siz = n; return 0; } return 1; } /* string to string map typedef */ typedef struct map_str_ { byte *key; byte *data; struct map_str_ *next; } map_str; static void map_str_create (map_str **ma) { *ma = (map_str *) mem_alloc (sizeof (map_str)); if (*ma) { (**ma).key = NULL; (**ma).data = NULL; (**ma).next = NULL; } } static void map_str_destroy (map_str **ma) { if (*ma) { map_str_destroy (&(**ma).next); mem_free ((void **) &(**ma).key); mem_free ((void **) &(**ma).data); mem_free ((void **) ma); } } GRAMMAR_IMPLEMENT_LIST_APPEND(map_str) /* searches the map for specified key, if the key is matched, *data is filled with data associated with the key, returns 0 if the key is matched, returns 1 otherwise */ static int map_str_find (map_str **ma, const byte *key, byte **data) { while (*ma) { if (str_equal ((**ma).key, key)) { *data = str_duplicate ((**ma).data); if (*data == NULL) return 1; return 0; } ma = &(**ma).next; } set_last_error (UNRESOLVED_REFERENCE, str_duplicate (key), -1); return 1; } /* string to rule map typedef */ typedef struct map_rule_ { byte *key; rule *data; struct map_rule_ *next; } map_rule; static void map_rule_create (map_rule **ma) { *ma = (map_rule *) mem_alloc (sizeof (map_rule)); if (*ma) { (**ma).key = NULL; (**ma).data = NULL; (**ma).next = NULL; } } static void map_rule_destroy (map_rule **ma) { if (*ma) { map_rule_destroy (&(**ma).next); mem_free ((void **) &(**ma).key); mem_free ((void **) ma); } } GRAMMAR_IMPLEMENT_LIST_APPEND(map_rule) /* searches the map for specified key, if the key is matched, *data is filled with data associated with the key, returns 0 if the is matched, returns 1 otherwise */ static int map_rule_find (map_rule **ma, const byte *key, rule **data) { while (*ma) { if (str_equal ((**ma).key, key)) { *data = (**ma).data; return 0; } ma = &(**ma).next; } set_last_error (UNRESOLVED_REFERENCE, str_duplicate (key), -1); return 1; } /* returns 1 if given character is a white space, returns 0 otherwise */ static int is_space (byte c) { return c == ' ' || c == '\t' || c == '\n' || c == '\r'; } /* advances text pointer by 1 if character pointed by *text is a space, returns 1 if a space has been eaten, returns 0 otherwise */ static int eat_space (const byte **text) { if (is_space (**text)) { (*text)++; return 1; } return 0; } /* returns 1 if text points to C-style comment start string, returns 0 otherwise */ static int is_comment_start (const byte *text) { return text[0] == '/' && text[1] == '*'; } /* advances text pointer to first character after C-style comment block - if any, returns 1 if C-style comment block has been encountered and eaten, returns 0 otherwise */ static int eat_comment (const byte **text) { if (is_comment_start (*text)) { /* *text points to comment block - skip two characters to enter comment body */ *text += 2; /* skip any character except consecutive '*' and '/' */ while (!((*text)[0] == '*' && (*text)[1] == '/')) (*text)++; /* skip those two terminating characters */ *text += 2; return 1; } return 0; } /* advances text pointer to first character that is neither space nor C-style comment block */ static void eat_spaces (const byte **text) { while (eat_space (text) || eat_comment (text)) ; } /* resizes string pointed by *ptr to successfully add character c to the end of the string, returns 0 on success, returns 1 otherwise */ static int string_grow (byte **ptr, unsigned int *len, byte c) { /* reallocate the string in 16-byte increments */ if ((*len & 0x0F) == 0x0F || *ptr == NULL) { byte *tmp = (byte *) mem_realloc (*ptr, ((*len + 1) & ~0x0F) * sizeof (byte), ((*len + 1 + 0x10) & ~0x0F) * sizeof (byte)); if (tmp == NULL) return 1; *ptr = tmp; } if (c) { /* append given character */ (*ptr)[*len] = c; (*len)++; } (*ptr)[*len] = '\0'; return 0; } /* returns 1 if given character is a valid identifier character a-z, A-Z, 0-9 or _ returns 0 otherwise */ static int is_identifier (byte c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_'; } /* copies characters from *text to *id until non-identifier character is encountered, assumes that *id points to NULL object - caller is responsible for later freeing the string, text pointer is advanced to point past the copied identifier, returns 0 if identifier was successfully copied, returns 1 otherwise */ static int get_identifier (const byte **text, byte **id) { const byte *t = *text; byte *p = NULL; unsigned int len = 0; if (string_grow (&p, &len, '\0')) return 1; /* loop while next character in buffer is valid for identifiers */ while (is_identifier (*t)) { if (string_grow (&p, &len, *t++)) { mem_free ((void **) (void *) &p); return 1; } } *text = t; *id = p; return 0; } /* converts sequence of DEC digits pointed by *text until non-DEC digit is encountered, advances text pointer past the converted sequence, returns the converted value */ static unsigned int dec_convert (const byte **text) { unsigned int value = 0; while (**text >= '0' && **text <= '9') { value = value * 10 + **text - '0'; (*text)++; } return value; } /* returns 1 if given character is HEX digit 0-9, A-F or a-f, returns 0 otherwise */ static int is_hex (byte c) { return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'); } /* returns value of passed character as if it was HEX digit */ static unsigned int hex2dec (byte c) { if (c >= '0' && c <= '9') return c - '0'; if (c >= 'A' && c <= 'F') return c - 'A' + 10; return c - 'a' + 10; } /* converts sequence of HEX digits pointed by *text until non-HEX digit is encountered, advances text pointer past the converted sequence, returns the converted value */ static unsigned int hex_convert (const byte **text) { unsigned int value = 0; while (is_hex (**text)) { value = value * 0x10 + hex2dec (**text); (*text)++; } return value; } /* returns 1 if given character is OCT digit 0-7, returns 0 otherwise */ static int is_oct (byte c) { return c >= '0' && c <= '7'; } /* returns value of passed character as if it was OCT digit */ static int oct2dec (byte c) { return c - '0'; } static byte get_escape_sequence (const byte **text) { int value = 0; /* skip '\' character */ (*text)++; switch (*(*text)++) { case '\'': return '\''; case '"': return '\"'; case '?': return '\?'; case '\\': return '\\'; case 'a': return '\a'; case 'b': return '\b'; case 'f': return '\f'; case 'n': return '\n'; case 'r': return '\r'; case 't': return '\t'; case 'v': return '\v'; case 'x': return (byte) hex_convert (text); } (*text)--; if (is_oct (**text)) { value = oct2dec (*(*text)++); if (is_oct (**text)) { value = value * 010 + oct2dec (*(*text)++); if (is_oct (**text)) value = value * 010 + oct2dec (*(*text)++); } } return (byte) value; } /* copies characters from *text to *str until " or ' character is encountered, assumes that *str points to NULL object - caller is responsible for later freeing the string, assumes that *text points to " or ' character that starts the string, text pointer is advanced to point past the " or ' character, returns 0 if string was successfully copied, returns 1 otherwise */ static int get_string (const byte **text, byte **str) { const byte *t = *text; byte *p = NULL; unsigned int len = 0; byte term_char; if (string_grow (&p, &len, '\0')) return 1; /* read " or ' character that starts the string */ term_char = *t++; /* while next character is not the terminating character */ while (*t && *t != term_char) { byte c; if (*t == '\\') c = get_escape_sequence (&t); else c = *t++; if (string_grow (&p, &len, c)) { mem_free ((void **) (void *) &p); return 1; } } /* skip " or ' character that ends the string */ t++; *text = t; *str = p; return 0; } /* gets emit code, the syntax is: ".emtcode" " " " " (("0x" | "0X") ) | | assumes that *text already points to , returns 0 if emit code is successfully read, returns 1 otherwise */ static int get_emtcode (const byte **text, map_byte **ma) { const byte *t = *text; map_byte *m = NULL; map_byte_create (&m); if (m == NULL) return 1; if (get_identifier (&t, &m->key)) { map_byte_destroy (&m); return 1; } eat_spaces (&t); if (*t == '\'') { byte *c; if (get_string (&t, &c)) { map_byte_destroy (&m); return 1; } m->data = (byte) c[0]; mem_free ((void **) (void *) &c); } else if (t[0] == '0' && (t[1] == 'x' || t[1] == 'X')) { /* skip HEX "0x" or "0X" prefix */ t += 2; m->data = (byte) hex_convert (&t); } else { m->data = (byte) dec_convert (&t); } eat_spaces (&t); *text = t; *ma = m; return 0; } /* gets regbyte declaration, the syntax is: ".regbyte" " " " " (("0x" | "0X") ) | | assumes that *text already points to , returns 0 if regbyte is successfully read, returns 1 otherwise */ static int get_regbyte (const byte **text, map_byte **ma) { /* pass it to the emtcode parser as it has the same syntax starting at */ return get_emtcode (text, ma); } /* returns 0 on success, returns 1 otherwise */ static int get_errtext (const byte **text, map_str **ma) { const byte *t = *text; map_str *m = NULL; map_str_create (&m); if (m == NULL) return 1; if (get_identifier (&t, &m->key)) { map_str_destroy (&m); return 1; } eat_spaces (&t); if (get_string (&t, &m->data)) { map_str_destroy (&m); return 1; } eat_spaces (&t); *text = t; *ma = m; return 0; } /* returns 0 on success, returns 1 otherwise, */ static int get_error (const byte **text, error **er, map_str *maps) { const byte *t = *text; byte *temp = NULL; if (*t != '.') return 0; t++; if (get_identifier (&t, &temp)) return 1; eat_spaces (&t); if (!str_equal ((byte *) "error", temp)) { mem_free ((void **) (void *) &temp); return 0; } mem_free ((void **) (void *) &temp); error_create (er); if (*er == NULL) return 1; if (*t == '\"') { if (get_string (&t, &(**er).m_text)) { error_destroy (er); return 1; } eat_spaces (&t); } else { if (get_identifier (&t, &temp)) { error_destroy (er); return 1; } eat_spaces (&t); if (map_str_find (&maps, temp, &(**er).m_text)) { mem_free ((void **) (void *) &temp); error_destroy (er); return 1; } mem_free ((void **) (void *) &temp); } /* try to extract "token" from "...$token$..." */ { byte *processed = NULL; unsigned int len = 0, i = 0; if (string_grow (&processed, &len, '\0')) { error_destroy (er); return 1; } while (i < str_length ((**er).m_text)) { /* check if the dollar sign is repeated - if so skip it */ if ((**er).m_text[i] == '$' && (**er).m_text[i + 1] == '$') { if (string_grow (&processed, &len, '$')) { mem_free ((void **) (void *) &processed); error_destroy (er); return 1; } i += 2; } else if ((**er).m_text[i] != '$') { if (string_grow (&processed, &len, (**er).m_text[i])) { mem_free ((void **) (void *) &processed); error_destroy (er); return 1; } i++; } else { if (string_grow (&processed, &len, '$')) { mem_free ((void **) (void *) &processed); error_destroy (er); return 1; } { /* length of token being extracted */ unsigned int tlen = 0; if (string_grow (&(**er).m_token_name, &tlen, '\0')) { mem_free ((void **) (void *) &processed); error_destroy (er); return 1; } /* skip the dollar sign */ i++; while ((**er).m_text[i] != '$') { if (string_grow (&(**er).m_token_name, &tlen, (**er).m_text[i])) { mem_free ((void **) (void *) &processed); error_destroy (er); return 1; } i++; } /* skip the dollar sign */ i++; } } } mem_free ((void **) &(**er).m_text); (**er).m_text = processed; } *text = t; return 0; } /* returns 0 on success, returns 1 otherwise, */ static int get_emits (const byte **text, emit **em, map_byte *mapb) { const byte *t = *text; byte *temp = NULL; emit *e = NULL; emit_dest dest; if (*t != '.') return 0; t++; if (get_identifier (&t, &temp)) return 1; eat_spaces (&t); /* .emit */ if (str_equal ((byte *) "emit", temp)) dest = ed_output; /* .load */ else if (str_equal ((byte *) "load", temp)) dest = ed_regbyte; else { mem_free ((void **) (void *) &temp); return 0; } mem_free ((void **) (void *) &temp); emit_create (&e); if (e == NULL) return 1; e->m_emit_dest = dest; if (dest == ed_regbyte) { if (get_identifier (&t, &e->m_regname)) { emit_destroy (&e); return 1; } eat_spaces (&t); } /* 0xNN */ if (*t == '0' && (t[1] == 'x' || t[1] == 'X')) { t += 2; e->m_byte = (byte) hex_convert (&t); e->m_emit_type = et_byte; } /* NNN */ else if (*t >= '0' && *t <= '9') { e->m_byte = (byte) dec_convert (&t); e->m_emit_type = et_byte; } /* * */ else if (*t == '*') { t++; e->m_emit_type = et_stream; } /* $ */ else if (*t == '$') { t++; e->m_emit_type = et_position; } /* 'c' */ else if (*t == '\'') { if (get_string (&t, &temp)) { emit_destroy (&e); return 1; } e->m_byte = (byte) temp[0]; mem_free ((void **) (void *) &temp); e->m_emit_type = et_byte; } else { if (get_identifier (&t, &temp)) { emit_destroy (&e); return 1; } if (map_byte_find (&mapb, temp, &e->m_byte)) { mem_free ((void **) (void *) &temp); emit_destroy (&e); return 1; } mem_free ((void **) (void *) &temp); e->m_emit_type = et_byte; } eat_spaces (&t); if (get_emits (&t, &e->m_next, mapb)) { emit_destroy (&e); return 1; } *text = t; *em = e; return 0; } /* returns 0 on success, returns 1 otherwise, */ static int get_spec (const byte **text, spec **sp, map_str *maps, map_byte *mapb) { const byte *t = *text; spec *s = NULL; spec_create (&s); if (s == NULL) return 1; /* first - read optional .if statement */ if (*t == '.') { const byte *u = t; byte *keyword = NULL; /* skip the dot */ u++; if (get_identifier (&u, &keyword)) { spec_destroy (&s); return 1; } /* .if */ if (str_equal ((byte *) "if", keyword)) { cond_create (&s->m_cond); if (s->m_cond == NULL) { spec_destroy (&s); return 1; } /* skip the left paren */ eat_spaces (&u); u++; /* get the left operand */ eat_spaces (&u); if (get_identifier (&u, &s->m_cond->m_operands[0].m_regname)) { spec_destroy (&s); return 1; } s->m_cond->m_operands[0].m_type = cot_regbyte; /* get the operator (!= or ==) */ eat_spaces (&u); if (*u == '!') s->m_cond->m_type = ct_not_equal; else s->m_cond->m_type = ct_equal; u += 2; eat_spaces (&u); if (u[0] == '0' && (u[1] == 'x' || u[1] == 'X')) { /* skip the 0x prefix */ u += 2; /* get the right operand */ s->m_cond->m_operands[1].m_byte = hex_convert (&u); s->m_cond->m_operands[1].m_type = cot_byte; } else /*if (*u >= '0' && *u <= '9')*/ { /* get the right operand */ s->m_cond->m_operands[1].m_byte = dec_convert (&u); s->m_cond->m_operands[1].m_type = cot_byte; } /* skip the right paren */ eat_spaces (&u); u++; eat_spaces (&u); t = u; } mem_free ((void **) (void *) &keyword); } if (*t == '\'') { byte *temp = NULL; if (get_string (&t, &temp)) { spec_destroy (&s); return 1; } eat_spaces (&t); if (*t == '-') { byte *temp2 = NULL; /* skip the '-' character */ t++; eat_spaces (&t); if (get_string (&t, &temp2)) { mem_free ((void **) (void *) &temp); spec_destroy (&s); return 1; } eat_spaces (&t); s->m_spec_type = st_byte_range; s->m_byte[0] = *temp; s->m_byte[1] = *temp2; mem_free ((void **) (void *) &temp2); } else { s->m_spec_type = st_byte; *s->m_byte = *temp; } mem_free ((void **) (void *) &temp); } else if (*t == '"') { if (get_string (&t, &s->m_string)) { spec_destroy (&s); return 1; } eat_spaces (&t); s->m_spec_type = st_string; } else if (*t == '.') { byte *keyword = NULL; /* skip the dot */ t++; if (get_identifier (&t, &keyword)) { spec_destroy (&s); return 1; } eat_spaces (&t); /* .true */ if (str_equal ((byte *) "true", keyword)) { s->m_spec_type = st_true; } /* .false */ else if (str_equal ((byte *) "false", keyword)) { s->m_spec_type = st_false; } /* .debug */ else if (str_equal ((byte *) "debug", keyword)) { s->m_spec_type = st_debug; } /* .loop */ else if (str_equal ((byte *) "loop", keyword)) { if (get_identifier (&t, &s->m_string)) { mem_free ((void **) (void *) &keyword); spec_destroy (&s); return 1; } eat_spaces (&t); s->m_spec_type = st_identifier_loop; } mem_free ((void **) (void *) &keyword); } else { if (get_identifier (&t, &s->m_string)) { spec_destroy (&s); return 1; } eat_spaces (&t); s->m_spec_type = st_identifier; } if (get_error (&t, &s->m_errtext, maps)) { spec_destroy (&s); return 1; } if (get_emits (&t, &s->m_emits, mapb)) { spec_destroy (&s); return 1; } *text = t; *sp = s; return 0; } /* returns 0 on success, returns 1 otherwise, */ static int get_rule (const byte **text, rule **ru, map_str *maps, map_byte *mapb) { const byte *t = *text; rule *r = NULL; rule_create (&r); if (r == NULL) return 1; if (get_spec (&t, &r->m_specs, maps, mapb)) { rule_destroy (&r); return 1; } while (*t != ';') { byte *op = NULL; spec *sp = NULL; /* skip the dot that precedes "and" or "or" */ t++; /* read "and" or "or" keyword */ if (get_identifier (&t, &op)) { rule_destroy (&r); return 1; } eat_spaces (&t); if (r->m_oper == op_none) { /* .and */ if (str_equal ((byte *) "and", op)) r->m_oper = op_and; /* .or */ else r->m_oper = op_or; } mem_free ((void **) (void *) &op); if (get_spec (&t, &sp, maps, mapb)) { rule_destroy (&r); return 1; } spec_append (&r->m_specs, sp); } /* skip the semicolon */ t++; eat_spaces (&t); *text = t; *ru = r; return 0; } /* returns 0 on success, returns 1 otherwise, */ static int update_dependency (map_rule *mapr, byte *symbol, rule **ru) { if (map_rule_find (&mapr, symbol, ru)) return 1; (**ru).m_referenced = 1; return 0; } /* returns 0 on success, returns 1 otherwise, */ static int update_dependencies (dict *di, map_rule *mapr, byte **syntax_symbol, byte **string_symbol, map_byte *regbytes) { rule *rulez = di->m_rulez; /* update dependecies for the root and lexer symbols */ if (update_dependency (mapr, *syntax_symbol, &di->m_syntax) || (*string_symbol != NULL && update_dependency (mapr, *string_symbol, &di->m_string))) return 1; mem_free ((void **) syntax_symbol); mem_free ((void **) string_symbol); /* update dependecies for the rest of the rules */ while (rulez) { spec *sp = rulez->m_specs; /* iterate through all the specifiers */ while (sp) { /* update dependency for identifier */ if (sp->m_spec_type == st_identifier || sp->m_spec_type == st_identifier_loop) { if (update_dependency (mapr, sp->m_string, &sp->m_rule)) return 1; mem_free ((void **) &sp->m_string); } /* some errtexts reference to a rule */ if (sp->m_errtext && sp->m_errtext->m_token_name) { if (update_dependency (mapr, sp->m_errtext->m_token_name, &sp->m_errtext->m_token)) return 1; mem_free ((void **) &sp->m_errtext->m_token_name); } /* update dependency for condition */ if (sp->m_cond) { int i; for (i = 0; i < 2; i++) if (sp->m_cond->m_operands[i].m_type == cot_regbyte) { sp->m_cond->m_operands[i].m_regbyte = map_byte_locate (®bytes, sp->m_cond->m_operands[i].m_regname); if (sp->m_cond->m_operands[i].m_regbyte == NULL) return 1; mem_free ((void **) &sp->m_cond->m_operands[i].m_regname); } } /* update dependency for all .load instructions */ if (sp->m_emits) { emit *em = sp->m_emits; while (em != NULL) { if (em->m_emit_dest == ed_regbyte) { em->m_regbyte = map_byte_locate (®bytes, em->m_regname); if (em->m_regbyte == NULL) return 1; mem_free ((void **) &em->m_regname); } em = em->m_next; } } sp = sp->next; } rulez = rulez->next; } /* check for unreferenced symbols */ rulez = di->m_rulez; while (rulez != NULL) { if (!rulez->m_referenced) { map_rule *ma = mapr; while (ma) { if (ma->data == rulez) { set_last_error (UNREFERENCED_IDENTIFIER, str_duplicate (ma->key), -1); return 1; } ma = ma->next; } } rulez = rulez->next; } return 0; } static int satisfies_condition (cond *co, regbyte_ctx *ctx) { byte values[2]; int i; if (co == NULL) return 1; for (i = 0; i < 2; i++) switch (co->m_operands[i].m_type) { case cot_byte: values[i] = co->m_operands[i].m_byte; break; case cot_regbyte: values[i] = regbyte_ctx_extract (&ctx, co->m_operands[i].m_regbyte); break; } switch (co->m_type) { case ct_equal: return values[0] == values[1]; case ct_not_equal: return values[0] != values[1]; } return 0; } static void free_regbyte_ctx_stack (regbyte_ctx *top, regbyte_ctx *limit) { while (top != limit) { regbyte_ctx *rbc = top->m_prev; regbyte_ctx_destroy (&top); top = rbc; } } typedef enum match_result_ { mr_not_matched, /* the examined string does not match */ mr_matched, /* the examined string matches */ mr_error_raised, /* mr_not_matched + error has been raised */ mr_dont_emit, /* used by identifier loops only */ mr_internal_error /* an internal error has occured such as out of memory */ } match_result; /* This function does the main job. It parses the text and generates output data. */ static match_result match (dict *di, const byte *text, unsigned int *index, rule *ru, barray **ba, int filtering_string, regbyte_ctx **rbc) { unsigned int ind = *index; match_result status = mr_not_matched; spec *sp = ru->m_specs; regbyte_ctx *ctx = *rbc; /* for every specifier in the rule */ while (sp) { unsigned int i, len, save_ind = ind; barray *array = NULL; if (satisfies_condition (sp->m_cond, ctx)) { switch (sp->m_spec_type) { case st_identifier: barray_create (&array); if (array == NULL) { free_regbyte_ctx_stack (ctx, *rbc); return mr_internal_error; } status = match (di, text, &ind, sp->m_rule, &array, filtering_string, &ctx); if (status == mr_internal_error) { free_regbyte_ctx_stack (ctx, *rbc); barray_destroy (&array); return mr_internal_error; } break; case st_string: len = str_length (sp->m_string); /* prefilter the stream */ if (!filtering_string && di->m_string) { barray *ba; unsigned int filter_index = 0; match_result result; regbyte_ctx *null_ctx = NULL; barray_create (&ba); if (ba == NULL) { free_regbyte_ctx_stack (ctx, *rbc); return mr_internal_error; } result = match (di, text + ind, &filter_index, di->m_string, &ba, 1, &null_ctx); if (result == mr_internal_error) { free_regbyte_ctx_stack (ctx, *rbc); barray_destroy (&ba); return mr_internal_error; } if (result != mr_matched) { barray_destroy (&ba); status = mr_not_matched; break; } barray_destroy (&ba); if (filter_index != len || !str_equal_n (sp->m_string, text + ind, len)) { status = mr_not_matched; break; } status = mr_matched; ind += len; } else { status = mr_matched; for (i = 0; status == mr_matched && i < len; i++) if (text[ind + i] != sp->m_string[i]) status = mr_not_matched; if (status == mr_matched) ind += len; } break; case st_byte: status = text[ind] == *sp->m_byte ? mr_matched : mr_not_matched; if (status == mr_matched) ind++; break; case st_byte_range: status = (text[ind] >= sp->m_byte[0] && text[ind] <= sp->m_byte[1]) ? mr_matched : mr_not_matched; if (status == mr_matched) ind++; break; case st_true: status = mr_matched; break; case st_false: status = mr_not_matched; break; case st_debug: status = ru->m_oper == op_and ? mr_matched : mr_not_matched; break; case st_identifier_loop: barray_create (&array); if (array == NULL) { free_regbyte_ctx_stack (ctx, *rbc); return mr_internal_error; } status = mr_dont_emit; for (;;) { match_result result; save_ind = ind; result = match (di, text, &ind, sp->m_rule, &array, filtering_string, &ctx); if (result == mr_error_raised) { status = result; break; } else if (result == mr_matched) { if (barray_push (ba, sp->m_emits, text[ind - 1], save_ind, &ctx) || barray_append (ba, &array)) { free_regbyte_ctx_stack (ctx, *rbc); barray_destroy (&array); return mr_internal_error; } barray_destroy (&array); barray_create (&array); if (array == NULL) { free_regbyte_ctx_stack (ctx, *rbc); return mr_internal_error; } } else if (result == mr_internal_error) { free_regbyte_ctx_stack (ctx, *rbc); barray_destroy (&array); return mr_internal_error; } else break; } break; } } else { status = mr_not_matched; } if (status == mr_error_raised) { free_regbyte_ctx_stack (ctx, *rbc); barray_destroy (&array); return mr_error_raised; } if (ru->m_oper == op_and && status != mr_matched && status != mr_dont_emit) { free_regbyte_ctx_stack (ctx, *rbc); barray_destroy (&array); if (sp->m_errtext) { set_last_error (sp->m_errtext->m_text, error_get_token (sp->m_errtext, di, text, ind), ind); return mr_error_raised; } return mr_not_matched; } if (status == mr_matched) { if (sp->m_emits) if (barray_push (ba, sp->m_emits, text[ind - 1], save_ind, &ctx)) { free_regbyte_ctx_stack (ctx, *rbc); barray_destroy (&array); return mr_internal_error; } if (array) if (barray_append (ba, &array)) { free_regbyte_ctx_stack (ctx, *rbc); barray_destroy (&array); return mr_internal_error; } } barray_destroy (&array); /* if the rule operator is a logical or, we pick up the first matching specifier */ if (ru->m_oper == op_or && (status == mr_matched || status == mr_dont_emit)) { *index = ind; *rbc = ctx; return mr_matched; } sp = sp->next; } /* everything went fine - all specifiers match up */ if (ru->m_oper == op_and && (status == mr_matched || status == mr_dont_emit)) { *index = ind; *rbc = ctx; return mr_matched; } free_regbyte_ctx_stack (ctx, *rbc); return mr_not_matched; } static match_result fast_match (dict *di, const byte *text, unsigned int *index, rule *ru, int *_PP, bytepool *_BP, int filtering_string, regbyte_ctx **rbc) { unsigned int ind = *index; int _P = filtering_string ? 0 : *_PP; int _P2; match_result status = mr_not_matched; spec *sp = ru->m_specs; regbyte_ctx *ctx = *rbc; /* for every specifier in the rule */ while (sp) { unsigned int i, len, save_ind = ind; _P2 = _P + (sp->m_emits ? emit_size (sp->m_emits) : 0); if (bytepool_reserve (_BP, _P2)) { free_regbyte_ctx_stack (ctx, *rbc); return mr_internal_error; } if (satisfies_condition (sp->m_cond, ctx)) { switch (sp->m_spec_type) { case st_identifier: status = fast_match (di, text, &ind, sp->m_rule, &_P2, _BP, filtering_string, &ctx); if (status == mr_internal_error) { free_regbyte_ctx_stack (ctx, *rbc); return mr_internal_error; } break; case st_string: len = str_length (sp->m_string); /* prefilter the stream */ if (!filtering_string && di->m_string) { unsigned int filter_index = 0; match_result result; regbyte_ctx *null_ctx = NULL; result = fast_match (di, text + ind, &filter_index, di->m_string, NULL, _BP, 1, &null_ctx); if (result == mr_internal_error) { free_regbyte_ctx_stack (ctx, *rbc); return mr_internal_error; } if (result != mr_matched) { status = mr_not_matched; break; } if (filter_index != len || !str_equal_n (sp->m_string, text + ind, len)) { status = mr_not_matched; break; } status = mr_matched; ind += len; } else { status = mr_matched; for (i = 0; status == mr_matched && i < len; i++) if (text[ind + i] != sp->m_string[i]) status = mr_not_matched; if (status == mr_matched) ind += len; } break; case st_byte: status = text[ind] == *sp->m_byte ? mr_matched : mr_not_matched; if (status == mr_matched) ind++; break; case st_byte_range: status = (text[ind] >= sp->m_byte[0] && text[ind] <= sp->m_byte[1]) ? mr_matched : mr_not_matched; if (status == mr_matched) ind++; break; case st_true: status = mr_matched; break; case st_false: status = mr_not_matched; break; case st_debug: status = ru->m_oper == op_and ? mr_matched : mr_not_matched; break; case st_identifier_loop: status = mr_dont_emit; for (;;) { match_result result; save_ind = ind; result = fast_match (di, text, &ind, sp->m_rule, &_P2, _BP, filtering_string, &ctx); if (result == mr_error_raised) { status = result; break; } else if (result == mr_matched) { if (!filtering_string) { if (sp->m_emits != NULL) { if (emit_push (sp->m_emits, _BP->_F + _P, text[ind - 1], save_ind, &ctx)) { free_regbyte_ctx_stack (ctx, *rbc); return mr_internal_error; } } _P = _P2; _P2 += sp->m_emits ? emit_size (sp->m_emits) : 0; if (bytepool_reserve (_BP, _P2)) { free_regbyte_ctx_stack (ctx, *rbc); return mr_internal_error; } } } else if (result == mr_internal_error) { free_regbyte_ctx_stack (ctx, *rbc); return mr_internal_error; } else break; } break; } } else { status = mr_not_matched; } if (status == mr_error_raised) { free_regbyte_ctx_stack (ctx, *rbc); return mr_error_raised; } if (ru->m_oper == op_and && status != mr_matched && status != mr_dont_emit) { free_regbyte_ctx_stack (ctx, *rbc); if (sp->m_errtext) { set_last_error (sp->m_errtext->m_text, error_get_token (sp->m_errtext, di, text, ind), ind); return mr_error_raised; } return mr_not_matched; } if (status == mr_matched) { if (sp->m_emits != NULL) if (emit_push (sp->m_emits, _BP->_F + _P, text[ind - 1], save_ind, &ctx)) { free_regbyte_ctx_stack (ctx, *rbc); return mr_internal_error; } _P = _P2; } /* if the rule operator is a logical or, we pick up the first matching specifier */ if (ru->m_oper == op_or && (status == mr_matched || status == mr_dont_emit)) { *index = ind; *rbc = ctx; if (!filtering_string) *_PP = _P; return mr_matched; } sp = sp->next; } /* everything went fine - all specifiers match up */ if (ru->m_oper == op_and && (status == mr_matched || status == mr_dont_emit)) { *index = ind; *rbc = ctx; if (!filtering_string) *_PP = _P; return mr_matched; } free_regbyte_ctx_stack (ctx, *rbc); return mr_not_matched; } static byte *error_get_token (error *er, dict *di, const byte *text, unsigned int ind) { byte *str = NULL; if (er->m_token) { barray *ba; unsigned int filter_index = 0; regbyte_ctx *ctx = NULL; barray_create (&ba); if (ba != NULL) { if (match (di, text + ind, &filter_index, er->m_token, &ba, 0, &ctx) == mr_matched && filter_index) { str = (byte *) mem_alloc (filter_index + 1); if (str != NULL) { str_copy_n (str, text + ind, filter_index); str[filter_index] = '\0'; } } barray_destroy (&ba); } } return str; } typedef struct grammar_load_state_ { dict *di; byte *syntax_symbol; byte *string_symbol; map_str *maps; map_byte *mapb; map_rule *mapr; } grammar_load_state; static void grammar_load_state_create (grammar_load_state **gr) { *gr = (grammar_load_state *) mem_alloc (sizeof (grammar_load_state)); if (*gr) { (**gr).di = NULL; (**gr).syntax_symbol = NULL; (**gr).string_symbol = NULL; (**gr).maps = NULL; (**gr).mapb = NULL; (**gr).mapr = NULL; } } static void grammar_load_state_destroy (grammar_load_state **gr) { if (*gr) { dict_destroy (&(**gr).di); mem_free ((void **) &(**gr).syntax_symbol); mem_free ((void **) &(**gr).string_symbol); map_str_destroy (&(**gr).maps); map_byte_destroy (&(**gr).mapb); map_rule_destroy (&(**gr).mapr); mem_free ((void **) gr); } } /* the API */ grammar grammar_load_from_text (const byte *text) { grammar_load_state *g = NULL; grammar id = 0; clear_last_error (); grammar_load_state_create (&g); if (g == NULL) return 0; dict_create (&g->di); if (g->di == NULL) { grammar_load_state_destroy (&g); return 0; } eat_spaces (&text); /* skip ".syntax" keyword */ text += 7; eat_spaces (&text); /* retrieve root symbol */ if (get_identifier (&text, &g->syntax_symbol)) { grammar_load_state_destroy (&g); return 0; } eat_spaces (&text); /* skip semicolon */ text++; eat_spaces (&text); while (*text) { byte *symbol = NULL; int is_dot = *text == '.'; if (is_dot) text++; if (get_identifier (&text, &symbol)) { grammar_load_state_destroy (&g); return 0; } eat_spaces (&text); /* .emtcode */ if (is_dot && str_equal (symbol, (byte *) "emtcode")) { map_byte *ma = NULL; mem_free ((void **) (void *) &symbol); if (get_emtcode (&text, &ma)) { grammar_load_state_destroy (&g); return 0; } map_byte_append (&g->mapb, ma); } /* .regbyte */ else if (is_dot && str_equal (symbol, (byte *) "regbyte")) { map_byte *ma = NULL; mem_free ((void **) (void *) &symbol); if (get_regbyte (&text, &ma)) { grammar_load_state_destroy (&g); return 0; } map_byte_append (&g->di->m_regbytes, ma); } /* .errtext */ else if (is_dot && str_equal (symbol, (byte *) "errtext")) { map_str *ma = NULL; mem_free ((void **) (void *) &symbol); if (get_errtext (&text, &ma)) { grammar_load_state_destroy (&g); return 0; } map_str_append (&g->maps, ma); } /* .string */ else if (is_dot && str_equal (symbol, (byte *) "string")) { mem_free ((void **) (void *) &symbol); if (g->di->m_string != NULL) { grammar_load_state_destroy (&g); return 0; } if (get_identifier (&text, &g->string_symbol)) { grammar_load_state_destroy (&g); return 0; } /* skip semicolon */ eat_spaces (&text); text++; eat_spaces (&text); } else { rule *ru = NULL; map_rule *ma = NULL; if (get_rule (&text, &ru, g->maps, g->mapb)) { grammar_load_state_destroy (&g); return 0; } rule_append (&g->di->m_rulez, ru); /* if a rule consist of only one specifier, give it an ".and" operator */ if (ru->m_oper == op_none) ru->m_oper = op_and; map_rule_create (&ma); if (ma == NULL) { grammar_load_state_destroy (&g); return 0; } ma->key = symbol; ma->data = ru; map_rule_append (&g->mapr, ma); } } if (update_dependencies (g->di, g->mapr, &g->syntax_symbol, &g->string_symbol, g->di->m_regbytes)) { grammar_load_state_destroy (&g); return 0; } dict_append (&g_dicts, g->di); id = g->di->m_id; g->di = NULL; grammar_load_state_destroy (&g); return id; } int grammar_set_reg8 (grammar id, const byte *name, byte value) { dict *di = NULL; map_byte *reg = NULL; clear_last_error (); dict_find (&g_dicts, id, &di); if (di == NULL) { set_last_error (INVALID_GRAMMAR_ID, NULL, -1); return 0; } reg = map_byte_locate (&di->m_regbytes, name); if (reg == NULL) { set_last_error (INVALID_REGISTER_NAME, str_duplicate (name), -1); return 0; } reg->data = value; return 1; } /* internal checking function used by both grammar_check and grammar_fast_check functions */ static int _grammar_check (grammar id, const byte *text, byte **prod, unsigned int *size, unsigned int estimate_prod_size, int use_fast_path) { dict *di = NULL; unsigned int index = 0; clear_last_error (); dict_find (&g_dicts, id, &di); if (di == NULL) { set_last_error (INVALID_GRAMMAR_ID, NULL, -1); return 0; } *prod = NULL; *size = 0; if (use_fast_path) { regbyte_ctx *rbc = NULL; bytepool *bp = NULL; int _P = 0; bytepool_create (&bp, estimate_prod_size); if (bp == NULL) return 0; if (fast_match (di, text, &index, di->m_syntax, &_P, bp, 0, &rbc) != mr_matched) { bytepool_destroy (&bp); free_regbyte_ctx_stack (rbc, NULL); return 0; } free_regbyte_ctx_stack (rbc, NULL); *prod = bp->_F; *size = _P; bp->_F = NULL; bytepool_destroy (&bp); } else { regbyte_ctx *rbc = NULL; barray *ba = NULL; barray_create (&ba); if (ba == NULL) return 0; if (match (di, text, &index, di->m_syntax, &ba, 0, &rbc) != mr_matched) { barray_destroy (&ba); free_regbyte_ctx_stack (rbc, NULL); return 0; } free_regbyte_ctx_stack (rbc, NULL); *prod = (byte *) mem_alloc (ba->len * sizeof (byte)); if (*prod == NULL) { barray_destroy (&ba); return 0; } mem_copy (*prod, ba->data, ba->len * sizeof (byte)); *size = ba->len; barray_destroy (&ba); } return 1; } int grammar_check (grammar id, const byte *text, byte **prod, unsigned int *size) { return _grammar_check (id, text, prod, size, 0, 0); } int grammar_fast_check (grammar id, const byte *text, byte **prod, unsigned int *size, unsigned int estimate_prod_size) { return _grammar_check (id, text, prod, size, estimate_prod_size, 1); } int grammar_destroy (grammar id) { dict **di = &g_dicts; clear_last_error (); while (*di != NULL) { if ((**di).m_id == id) { dict *tmp = *di; *di = (**di).next; dict_destroy (&tmp); return 1; } di = &(**di).next; } set_last_error (INVALID_GRAMMAR_ID, NULL, -1); return 0; } static void append_character (const char x, byte *text, int *dots_made, int *len, int size) { if (*dots_made == 0) { if (*len < size - 1) { text[(*len)++] = x; text[*len] = '\0'; } else { int i; for (i = 0; i < 3; i++) if (--(*len) >= 0) text[*len] = '.'; *dots_made = 1; } } } void grammar_get_last_error (byte *text, unsigned int size, int *pos) { int len = 0, dots_made = 0; const byte *p = error_message; *text = '\0'; if (p) { while (*p) { if (*p == '$') { const byte *r = error_param; while (*r) { append_character (*r++, text, &dots_made, &len, (int) size); } p++; } else { append_character (*p++, text, &dots_made, &len, size); } } } *pos = error_position; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/grammar/grammar.h0000644000000000000000000000752113614532424021715 0ustar /* * Mesa 3-D graphics library * Version: 6.2 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef GRAMMAR_H #define GRAMMAR_H #ifndef GRAMMAR_PORT_INCLUDE #error Do not include this file directly, include your grammar_XXX.h instead #endif #ifdef __cplusplus extern "C" { #endif void grammar_alloc_free (void *); void *grammar_alloc_malloc (size_t); void *grammar_alloc_realloc (void *, size_t, size_t); void *grammar_memory_copy (void *, const void *, size_t); int grammar_string_compare (const byte *, const byte *); int grammar_string_compare_n (const byte *, const byte *, size_t); byte *grammar_string_copy (byte *, const byte *); byte *grammar_string_copy_n (byte *, const byte *, size_t); byte *grammar_string_duplicate (const byte *); unsigned int grammar_string_length (const byte *); /* loads grammar script from null-terminated ASCII returns unique grammar id to grammar object returns 0 if an error occurs (call grammar_get_last_error to retrieve the error text) */ grammar grammar_load_from_text (const byte *text); /* sets a new to a register for grammar returns 0 on error (call grammar_get_last_error to retrieve the error text) returns 1 on success */ int grammar_set_reg8 (grammar id, const byte *name, byte value); /* this function is obsolete, use only for debugging purposes checks if a null-terminated matches given grammar returns 0 on error (call grammar_get_last_error to retrieve the error text) returns 1 on success, the points to newly allocated buffer with production and is filled with the production size call grammar_alloc_free to free the memory block pointed by */ int grammar_check (grammar id, const byte *text, byte **prod, unsigned int *size); /* does the same what grammar_check does but much more (approx. 4 times) faster use this function instead of grammar_check is a hint - the initial production buffer size will be of this size, but if more room is needed it will be safely resized; set it to 0x1000 or so */ int grammar_fast_check (grammar id, const byte *text, byte **prod, unsigned int *size, unsigned int estimate_prod_size); /* destroys grammar object identified by returns 0 on error (call grammar_get_last_error to retrieve the error text) returns 1 on success */ int grammar_destroy (grammar id); /* retrieves last grammar error reported either by grammar_load_from_text, grammar_check or grammar_destroy the user allocated buffer receives error description, points to error position, is the size of the text buffer to fill in - it must be at least 4 bytes long, */ void grammar_get_last_error (byte *text, unsigned int size, int *pos); #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/grammar/grammar_mesa.c0000644000000000000000000000475613614532424022724 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file grammar_mesa.c * mesa3d port to syntax parsing engine * \author Michal Krol */ #include "grammar_mesa.h" #define GRAMMAR_PORT_BUILD 1 #include "grammar.c" #undef GRAMMAR_PORT_BUILD void grammar_alloc_free (void *ptr) { _mesa_free (ptr); } void *grammar_alloc_malloc (size_t size) { return _mesa_malloc (size); } void *grammar_alloc_realloc (void *ptr, size_t old_size, size_t size) { return _mesa_realloc (ptr, old_size, size); } void *grammar_memory_copy (void *dst, const void * src, size_t size) { return _mesa_memcpy (dst, src, size); } int grammar_string_compare (const byte *str1, const byte *str2) { return _mesa_strcmp ((const char *) str1, (const char *) str2); } int grammar_string_compare_n (const byte *str1, const byte *str2, size_t n) { return _mesa_strncmp ((const char *) str1, (const char *) str2, n); } byte *grammar_string_copy (byte *dst, const byte *src) { return (byte *) _mesa_strcpy ((char *) dst, (const char *) src); } byte *grammar_string_copy_n (byte *dst, const byte *src, size_t n) { return (byte *) _mesa_strncpy ((char *) dst, (const char *) src, n); } byte *grammar_string_duplicate (const byte *src) { return (byte *) _mesa_strdup ((const char *) src); } unsigned int grammar_string_length (const byte *str) { return (unsigned int)_mesa_strlen ((const char *) str); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/grammar/grammar_mesa.h0000644000000000000000000000262613614532424022723 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef GRAMMAR_MESA_H #define GRAMMAR_MESA_H #include "imports.h" /* NOTE: include Mesa 3-D specific headers here */ typedef GLuint grammar; typedef GLubyte byte; #define GRAMMAR_PORT_INCLUDE 1 #include "grammar.h" #undef GRAMMAR_PORT_INCLUDE #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/grammar/grammar_syn.h0000644000000000000000000001654613614532424022615 0ustar ".syntax grammar;\n" ".emtcode DECLARATION_END 0\n" ".emtcode DECLARATION_EMITCODE 1\n" ".emtcode DECLARATION_ERRORTEXT 2\n" ".emtcode DECLARATION_REGBYTE 3\n" ".emtcode DECLARATION_LEXER 4\n" ".emtcode DECLARATION_RULE 5\n" ".emtcode SPECIFIER_END 0\n" ".emtcode SPECIFIER_AND_TAG 1\n" ".emtcode SPECIFIER_OR_TAG 2\n" ".emtcode SPECIFIER_CHARACTER_RANGE 3\n" ".emtcode SPECIFIER_CHARACTER 4\n" ".emtcode SPECIFIER_STRING 5\n" ".emtcode SPECIFIER_IDENTIFIER 6\n" ".emtcode SPECIFIER_TRUE 7\n" ".emtcode SPECIFIER_FALSE 8\n" ".emtcode SPECIFIER_DEBUG 9\n" ".emtcode IDENTIFIER_SIMPLE 0\n" ".emtcode IDENTIFIER_LOOP 1\n" ".emtcode ERROR_NOT_PRESENT 0\n" ".emtcode ERROR_PRESENT 1\n" ".emtcode EMIT_NULL 0\n" ".emtcode EMIT_INTEGER 1\n" ".emtcode EMIT_IDENTIFIER 2\n" ".emtcode EMIT_CHARACTER 3\n" ".emtcode EMIT_LAST_CHARACTER 4\n" ".emtcode EMIT_CURRENT_POSITION 5\n" ".errtext INVALID_GRAMMAR \"internal error 2001: invalid grammar script\"\n" ".errtext SYNTAX_EXPECTED \"internal error 2002: '.syntax' keyword expected\"\n" ".errtext IDENTIFIER_EXPECTED \"internal error 2003: identifier expected\"\n" ".errtext MISSING_SEMICOLON \"internal error 2004: missing ';'\"\n" ".errtext INTEGER_EXPECTED \"internal error 2005: integer value expected\"\n" ".errtext STRING_EXPECTED \"internal error 2006: string expected\"\n" "grammar\n" " grammar_1 .error INVALID_GRAMMAR;\n" "grammar_1\n" " optional_space .and \".syntax\" .error SYNTAX_EXPECTED .and space .and identifier .and\n" " semicolon .and declaration_list .and optional_space .and '\\0' .emit DECLARATION_END;\n" "optional_space\n" " space .or .true;\n" "space\n" " single_space .and .loop single_space;\n" "single_space\n" " white_char .or comment_block;\n" "white_char\n" " ' ' .or '\\t' .or '\\n' .or '\\r';\n" "comment_block\n" " '/' .and '*' .and comment_rest;\n" "comment_rest\n" " .loop comment_char_no_star .and comment_rest_1;\n" "comment_rest_1\n" " comment_end .or comment_rest_2;\n" "comment_rest_2\n" " '*' .and comment_rest;\n" "comment_char_no_star\n" " '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n" "comment_end\n" " '*' .and '/';\n" "identifier\n" " identifier_ne .error IDENTIFIER_EXPECTED;\n" "identifier_ne\n" " first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit '\\0';\n" "first_idchar\n" " 'a'-'z' .or 'A'-'Z' .or '_';\n" "follow_idchar\n" " first_idchar .or digit_dec;\n" "digit_dec\n" " '0'-'9';\n" "semicolon\n" " optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;\n" "declaration_list\n" " declaration .and .loop declaration;\n" "declaration\n" " emitcode_definition .emit DECLARATION_EMITCODE .or\n" " errortext_definition .emit DECLARATION_ERRORTEXT .or\n" " regbyte_definition .emit DECLARATION_REGBYTE .or\n" " lexer_definition .emit DECLARATION_LEXER .or\n" " rule_definition .emit DECLARATION_RULE;\n" "emitcode_definition\n" " \".emtcode\" .and space .and identifier .and space .and integer .and space_or_null;\n" "integer\n" " integer_ne .error INTEGER_EXPECTED;\n" "integer_ne\n" " hex_integer .emit 0x10 .or dec_integer .emit 10;\n" "hex_integer\n" " hex_prefix .and digit_hex .emit * .and .loop digit_hex .emit * .and .true .emit '\\0';\n" "hex_prefix\n" " '0' .and hex_prefix_1;\n" "hex_prefix_1\n" " 'x' .or 'X';\n" "digit_hex\n" " '0'-'9' .or 'a'-'f' .or 'A'-'F';\n" "dec_integer\n" " digit_dec .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n" "space_or_null\n" " space .or '\\0';\n" "errortext_definition\n" " \".errtext\" .and space .and identifier .and space .and string .and space_or_null;\n" "string\n" " string_ne .error STRING_EXPECTED;\n" "string_ne\n" " '\"' .and .loop string_char_double_quotes .and '\"' .emit '\\0';\n" "string_char_double_quotes\n" " escape_sequence .or string_char .emit * .or '\\'' .emit *;\n" "string_char\n" " '\\x5D'-'\\xFF' .or '\\x28'-'\\x5B' .or '\\x23'-'\\x26' .or '\\x0E'-'\\x21' .or '\\x0B'-'\\x0C' .or\n" " '\\x01'-'\\x09';\n" "escape_sequence\n" " '\\\\' .emit * .and escape_code;\n" "escape_code\n" " simple_escape_code .emit * .or hex_escape_code .or oct_escape_code;\n" "simple_escape_code\n" " '\\'' .or '\"' .or '?' .or '\\\\' .or 'a' .or 'b' .or 'f' .or 'n' .or 'r' .or 't' .or 'v';\n" "hex_escape_code\n" " 'x' .emit * .and digit_hex .emit * .and .loop digit_hex .emit *;\n" "oct_escape_code\n" " digit_oct .emit * .and optional_digit_oct .and optional_digit_oct;\n" "digit_oct\n" " '0'-'7';\n" "optional_digit_oct\n" " digit_oct .emit * .or .true;\n" "regbyte_definition\n" " \".regbyte\" .and space .and identifier .and space .and integer .and space_or_null;\n" "lexer_definition\n" " \".string\" .and space .and identifier .and semicolon;\n" "rule_definition\n" " identifier_ne .and space .and definition;\n" "definition\n" " specifier .and optional_specifiers_and_or .and semicolon .emit SPECIFIER_END;\n" "optional_specifiers_and_or\n" " and_specifiers .emit SPECIFIER_AND_TAG .or or_specifiers .emit SPECIFIER_OR_TAG .or .true;\n" "specifier\n" " specifier_condition .and optional_space .and specifier_rule;\n" "specifier_condition\n" " specifier_condition_1 .or .true;\n" "specifier_condition_1\n" " \".if\" .and optional_space .and '(' .and optional_space .and left_operand .and operator .and\n" " right_operand .and optional_space .and ')';\n" "left_operand\n" " identifier;\n" "operator\n" " operator_1 .or operator_2;\n" "operator_1\n" " optional_space .and '!' .and '=' .and optional_space;\n" "operator_2\n" " optional_space .and '=' .and '=' .and optional_space;\n" "right_operand\n" " integer;\n" "specifier_rule\n" " specifier_rule_1 .and optional_error .and .loop emit .and .true .emit EMIT_NULL;\n" "specifier_rule_1\n" " character_range .emit SPECIFIER_CHARACTER_RANGE .or\n" " character .emit SPECIFIER_CHARACTER .or\n" " string_ne .emit SPECIFIER_STRING .or\n" " \".true\" .emit SPECIFIER_TRUE .or\n" " \".false\" .emit SPECIFIER_FALSE .or\n" " \".debug\" .emit SPECIFIER_DEBUG .or\n" " advanced_identifier .emit SPECIFIER_IDENTIFIER;\n" "character\n" " '\\'' .and string_char_single_quotes .and '\\'' .emit '\\0';\n" "string_char_single_quotes\n" " escape_sequence .or string_char .emit * .or '\"' .emit *;\n" "character_range\n" " character .and optional_space .and '-' .and optional_space .and character;\n" "advanced_identifier\n" " optional_loop .and identifier;\n" "optional_loop\n" " optional_loop_1 .emit IDENTIFIER_LOOP .or .true .emit IDENTIFIER_SIMPLE;\n" "optional_loop_1\n" " \".loop\" .and space;\n" "optional_error\n" " error .emit ERROR_PRESENT .or .true .emit ERROR_NOT_PRESENT;\n" "error\n" " space .and \".error\" .and space .and identifier;\n" "emit\n" " emit_output .or emit_regbyte;\n" "emit_output\n" " space .and \".emit\" .and space .and emit_param;\n" "emit_param\n" " integer_ne .emit EMIT_INTEGER .or\n" " identifier_ne .emit EMIT_IDENTIFIER .or\n" " character .emit EMIT_CHARACTER .or\n" " '*' .emit EMIT_LAST_CHARACTER .or\n" " '$' .emit EMIT_CURRENT_POSITION;\n" "emit_regbyte\n" " space .and \".load\" .and space .and identifier .and space .and emit_param;\n" "and_specifiers\n" " and_specifier .and .loop and_specifier;\n" "or_specifiers\n" " or_specifier .and .loop or_specifier;\n" "and_specifier\n" " space .and \".and\" .and space .and specifier;\n" "or_specifier\n" " space .and \".or\" .and space .and specifier;\n" ".string __string_filter;\n" "__string_filter\n" " __first_identifier_char .and .loop __next_identifier_char;\n" "__first_identifier_char\n" " 'a'-'z' .or 'A'-'Z' .or '_' .or '.';\n" "__next_identifier_char\n" " 'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';\n" "" nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/nvfragparse.c0000644000000000000000000015231413614532424021153 0ustar /* * Mesa 3-D graphics library * Version: 6.4 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file nvfragparse.c * NVIDIA fragment program parser. * \author Brian Paul */ /* * Regarding GL_NV_fragment_program: * * Portions of this software may use or implement intellectual * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims * any and all warranties with respect to such intellectual property, * including any use thereof or modifications thereto. */ #include "glheader.h" #include "context.h" #include "hash.h" #include "imports.h" #include "macros.h" #include "mtypes.h" #include "nvfragprog.h" #include "nvfragparse.h" #include "nvprogram.h" #include "program.h" #define INPUT_1V 1 #define INPUT_2V 2 #define INPUT_3V 3 #define INPUT_1S 4 #define INPUT_2S 5 #define INPUT_CC 6 #define INPUT_1V_T 7 /* one source vector, plus textureId */ #define INPUT_3V_T 8 /* one source vector, plus textureId */ #define INPUT_NONE 9 #define INPUT_1V_S 10 /* a string and a vector register */ #define OUTPUT_V 20 #define OUTPUT_S 21 #define OUTPUT_NONE 22 /* IRIX defines some of these */ #undef _R #undef _H #undef _X #undef _C #undef _S /* Optional suffixes */ #define _R FLOAT32 /* float */ #define _H FLOAT16 /* half-float */ #define _X FIXED12 /* fixed */ #define _C 0x08 /* set cond codes */ #define _S 0x10 /* saturate, clamp result to [0,1] */ struct instruction_pattern { const char *name; enum fp_opcode opcode; GLuint inputs; GLuint outputs; GLuint suffixes; }; static const struct instruction_pattern Instructions[] = { { "ADD", FP_OPCODE_ADD, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, { "COS", FP_OPCODE_COS, INPUT_1S, OUTPUT_S, _R | _H | _C | _S }, { "DDX", FP_OPCODE_DDX, INPUT_1V, OUTPUT_V, _R | _H | _C | _S }, { "DDY", FP_OPCODE_DDY, INPUT_1V, OUTPUT_V, _R | _H | _C | _S }, { "DP3", FP_OPCODE_DP3, INPUT_2V, OUTPUT_S, _R | _H | _X | _C | _S }, { "DP4", FP_OPCODE_DP4, INPUT_2V, OUTPUT_S, _R | _H | _X | _C | _S }, { "DST", FP_OPCODE_DP4, INPUT_2V, OUTPUT_V, _R | _H | _C | _S }, { "EX2", FP_OPCODE_DP4, INPUT_1S, OUTPUT_S, _R | _H | _C | _S }, { "FLR", FP_OPCODE_FLR, INPUT_1V, OUTPUT_V, _R | _H | _X | _C | _S }, { "FRC", FP_OPCODE_FRC, INPUT_1V, OUTPUT_V, _R | _H | _X | _C | _S }, { "KIL", FP_OPCODE_KIL_NV, INPUT_CC, OUTPUT_NONE, 0 }, { "LG2", FP_OPCODE_LG2, INPUT_1S, OUTPUT_S, _R | _H | _C | _S }, { "LIT", FP_OPCODE_LIT, INPUT_1V, OUTPUT_V, _R | _H | _C | _S }, { "LRP", FP_OPCODE_LRP, INPUT_3V, OUTPUT_V, _R | _H | _X | _C | _S }, { "MAD", FP_OPCODE_MAD, INPUT_3V, OUTPUT_V, _R | _H | _X | _C | _S }, { "MAX", FP_OPCODE_MAX, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, { "MIN", FP_OPCODE_MIN, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, { "MOV", FP_OPCODE_MOV, INPUT_1V, OUTPUT_V, _R | _H | _X | _C | _S }, { "MUL", FP_OPCODE_MUL, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, { "PK2H", FP_OPCODE_PK2H, INPUT_1V, OUTPUT_S, 0 }, { "PK2US", FP_OPCODE_PK2US, INPUT_1V, OUTPUT_S, 0 }, { "PK4B", FP_OPCODE_PK4B, INPUT_1V, OUTPUT_S, 0 }, { "PK4UB", FP_OPCODE_PK4UB, INPUT_1V, OUTPUT_S, 0 }, { "POW", FP_OPCODE_POW, INPUT_2S, OUTPUT_S, _R | _H | _C | _S }, { "RCP", FP_OPCODE_RCP, INPUT_1S, OUTPUT_S, _R | _H | _C | _S }, { "RFL", FP_OPCODE_RFL, INPUT_2V, OUTPUT_V, _R | _H | _C | _S }, { "RSQ", FP_OPCODE_RSQ, INPUT_1S, OUTPUT_S, _R | _H | _C | _S }, { "SEQ", FP_OPCODE_SEQ, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, { "SFL", FP_OPCODE_SFL, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, { "SGE", FP_OPCODE_SGE, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, { "SGT", FP_OPCODE_SGT, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, { "SIN", FP_OPCODE_SIN, INPUT_1S, OUTPUT_S, _R | _H | _C | _S }, { "SLE", FP_OPCODE_SLE, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, { "SLT", FP_OPCODE_SLT, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, { "SNE", FP_OPCODE_SNE, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, { "STR", FP_OPCODE_STR, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, { "SUB", FP_OPCODE_SUB, INPUT_2V, OUTPUT_V, _R | _H | _X | _C | _S }, { "TEX", FP_OPCODE_TEX, INPUT_1V_T, OUTPUT_V, _C | _S }, { "TXD", FP_OPCODE_TXD, INPUT_3V_T, OUTPUT_V, _C | _S }, { "TXP", FP_OPCODE_TXP_NV, INPUT_1V_T, OUTPUT_V, _C | _S }, { "UP2H", FP_OPCODE_UP2H, INPUT_1S, OUTPUT_V, _C | _S }, { "UP2US", FP_OPCODE_UP2US, INPUT_1S, OUTPUT_V, _C | _S }, { "UP4B", FP_OPCODE_UP4B, INPUT_1S, OUTPUT_V, _C | _S }, { "UP4UB", FP_OPCODE_UP4UB, INPUT_1S, OUTPUT_V, _C | _S }, { "X2D", FP_OPCODE_X2D, INPUT_3V, OUTPUT_V, _R | _H | _C | _S }, { "PRINT", FP_OPCODE_PRINT, INPUT_1V_S, OUTPUT_NONE, 0 }, { NULL, (enum fp_opcode) -1, 0, 0, 0 } }; /* * Information needed or computed during parsing. * Remember, we can't modify the target program object until we've * _successfully_ parsed the program text. */ struct parse_state { GLcontext *ctx; const GLubyte *start; /* start of program string */ const GLubyte *pos; /* current position */ const GLubyte *curLine; struct fragment_program *program; /* current program */ struct program_parameter_list *parameters; GLuint numInst; /* number of instructions parsed */ GLuint inputsRead; /* bitmask of input registers used */ GLuint outputsWritten; /* bitmask of 1 << FRAG_OUTPUT_* bits */ GLuint texturesUsed[MAX_TEXTURE_IMAGE_UNITS]; }; /* * Called whenever we find an error during parsing. */ static void record_error(struct parse_state *parseState, const char *msg, int lineNo) { #ifdef DEBUG GLint line, column; const GLubyte *lineStr; lineStr = _mesa_find_line_column(parseState->start, parseState->pos, &line, &column); _mesa_debug(parseState->ctx, "nvfragparse.c(%d): line %d, column %d:%s (%s)\n", lineNo, line, column, (char *) lineStr, msg); _mesa_free((void *) lineStr); #else (void) lineNo; #endif /* Check that no error was already recorded. Only record the first one. */ if (parseState->ctx->Program.ErrorString[0] == 0) { _mesa_set_program_error(parseState->ctx, parseState->pos - parseState->start, msg); } } #define RETURN_ERROR \ do { \ record_error(parseState, "Unexpected end of input.", __LINE__); \ return GL_FALSE; \ } while(0) #define RETURN_ERROR1(msg) \ do { \ record_error(parseState, msg, __LINE__); \ return GL_FALSE; \ } while(0) #define RETURN_ERROR2(msg1, msg2) \ do { \ char err[1000]; \ _mesa_sprintf(err, "%s %s", msg1, msg2); \ record_error(parseState, err, __LINE__); \ return GL_FALSE; \ } while(0) /* * Search a list of instruction structures for a match. */ static struct instruction_pattern MatchInstruction(const GLubyte *token) { const struct instruction_pattern *inst; struct instruction_pattern result; for (inst = Instructions; inst->name; inst++) { if (_mesa_strncmp((const char *) token, inst->name, 3) == 0) { /* matched! */ int i = 3; result = *inst; result.suffixes = 0; /* look at suffix */ if (token[i] == 'R') { result.suffixes |= _R; i++; } else if (token[i] == 'H') { result.suffixes |= _H; i++; } else if (token[i] == 'X') { result.suffixes |= _X; i++; } if (token[i] == 'C') { result.suffixes |= _C; i++; } if (token[i] == '_' && token[i+1] == 'S' && token[i+2] == 'A' && token[i+3] == 'T') { result.suffixes |= _S; } return result; } } result.opcode = (enum fp_opcode) -1; return result; } /**********************************************************************/ static GLboolean IsLetter(GLubyte b) { return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || (b == '_') || (b == '$'); } static GLboolean IsDigit(GLubyte b) { return b >= '0' && b <= '9'; } static GLboolean IsWhitespace(GLubyte b) { return b == ' ' || b == '\t' || b == '\n' || b == '\r'; } /** * Starting at 'str' find the next token. A token can be an integer, * an identifier or punctuation symbol. * \return <= 0 we found an error, else, return number of characters parsed. */ static GLint GetToken(struct parse_state *parseState, GLubyte *token) { const GLubyte *str = parseState->pos; GLint i = 0, j = 0; token[0] = 0; /* skip whitespace and comments */ while (str[i] && (IsWhitespace(str[i]) || str[i] == '#')) { if (str[i] == '#') { /* skip comment */ while (str[i] && (str[i] != '\n' && str[i] != '\r')) { i++; } if (str[i] == '\n' || str[i] == '\r') parseState->curLine = str + i + 1; } else { /* skip whitespace */ if (str[i] == '\n' || str[i] == '\r') parseState->curLine = str + i + 1; i++; } } if (str[i] == 0) return -i; /* try matching an integer */ while (str[i] && IsDigit(str[i])) { token[j++] = str[i++]; } if (j > 0 || !str[i]) { token[j] = 0; return i; } /* try matching an identifier */ if (IsLetter(str[i])) { while (str[i] && (IsLetter(str[i]) || IsDigit(str[i]))) { token[j++] = str[i++]; } token[j] = 0; return i; } /* punctuation character */ if (str[i]) { token[0] = str[i++]; token[1] = 0; return i; } /* end of input */ token[0] = 0; return i; } /** * Get next token from input stream and increment stream pointer past token. */ static GLboolean Parse_Token(struct parse_state *parseState, GLubyte *token) { GLint i; i = GetToken(parseState, token); if (i <= 0) { parseState->pos += (-i); return GL_FALSE; } parseState->pos += i; return GL_TRUE; } /** * Get next token from input stream but don't increment stream pointer. */ static GLboolean Peek_Token(struct parse_state *parseState, GLubyte *token) { GLint i, len; i = GetToken(parseState, token); if (i <= 0) { parseState->pos += (-i); return GL_FALSE; } len = (GLint)_mesa_strlen((const char *) token); parseState->pos += (i - len); return GL_TRUE; } /**********************************************************************/ static const char *InputRegisters[MAX_NV_FRAGMENT_PROGRAM_INPUTS + 1] = { "WPOS", "COL0", "COL1", "FOGC", "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL }; static const char *OutputRegisters[MAX_NV_FRAGMENT_PROGRAM_OUTPUTS + 1] = { "COLR", "COLH", /* These are only allows for register combiners */ /* "TEX0", "TEX1", "TEX2", "TEX3", */ "DEPR", NULL }; /**********************************************************************/ /** * Try to match 'pattern' as the next token after any whitespace/comments. */ static GLboolean Parse_String(struct parse_state *parseState, const char *pattern) { const GLubyte *m; GLint i; /* skip whitespace and comments */ while (IsWhitespace(*parseState->pos) || *parseState->pos == '#') { if (*parseState->pos == '#') { while (*parseState->pos && (*parseState->pos != '\n' && *parseState->pos != '\r')) { parseState->pos += 1; } if (*parseState->pos == '\n' || *parseState->pos == '\r') parseState->curLine = parseState->pos + 1; } else { /* skip whitespace */ if (*parseState->pos == '\n' || *parseState->pos == '\r') parseState->curLine = parseState->pos + 1; parseState->pos += 1; } } /* Try to match the pattern */ m = parseState->pos; for (i = 0; pattern[i]; i++) { if (*m != (GLubyte) pattern[i]) return GL_FALSE; m += 1; } parseState->pos = m; return GL_TRUE; /* success */ } static GLboolean Parse_Identifier(struct parse_state *parseState, GLubyte *ident) { if (!Parse_Token(parseState, ident)) RETURN_ERROR; if (IsLetter(ident[0])) return GL_TRUE; else RETURN_ERROR1("Expected an identfier"); } /** * Parse a floating point constant, or a defined symbol name. * [+/-]N[.N[eN]] * Output: number[0 .. 3] will get the value. */ static GLboolean Parse_ScalarConstant(struct parse_state *parseState, GLfloat *number) { char *end = NULL; *number = (GLfloat) _mesa_strtod((const char *) parseState->pos, &end); if (end && end > (char *) parseState->pos) { /* got a number */ parseState->pos = (GLubyte *) end; number[1] = *number; number[2] = *number; number[3] = *number; return GL_TRUE; } else { /* should be an identifier */ GLubyte ident[100]; const GLfloat *constant; if (!Parse_Identifier(parseState, ident)) RETURN_ERROR1("Expected an identifier"); constant = _mesa_lookup_parameter_value(parseState->parameters, -1, (const char *) ident); /* XXX Check that it's a constant and not a parameter */ if (!constant) { RETURN_ERROR1("Undefined symbol"); } else { COPY_4V(number, constant); return GL_TRUE; } } } /** * Parse a vector constant, one of: * { float } * { float, float } * { float, float, float } * { float, float, float, float } */ static GLboolean Parse_VectorConstant(struct parse_state *parseState, GLfloat *vec) { /* "{" was already consumed */ ASSIGN_4V(vec, 0.0, 0.0, 0.0, 1.0); if (!Parse_ScalarConstant(parseState, vec+0)) /* X */ return GL_FALSE; if (Parse_String(parseState, "}")) { return GL_TRUE; } if (!Parse_String(parseState, ",")) RETURN_ERROR1("Expected comma in vector constant"); if (!Parse_ScalarConstant(parseState, vec+1)) /* Y */ return GL_FALSE; if (Parse_String(parseState, "}")) { return GL_TRUE; } if (!Parse_String(parseState, ",")) RETURN_ERROR1("Expected comma in vector constant"); if (!Parse_ScalarConstant(parseState, vec+2)) /* Z */ return GL_FALSE; if (Parse_String(parseState, "}")) { return GL_TRUE; } if (!Parse_String(parseState, ",")) RETURN_ERROR1("Expected comma in vector constant"); if (!Parse_ScalarConstant(parseState, vec+3)) /* W */ return GL_FALSE; if (!Parse_String(parseState, "}")) RETURN_ERROR1("Expected closing brace in vector constant"); return GL_TRUE; } /** * Parse , or {a, b, c, d}. * Return number of values in the vector or scalar, or zero if parse error. */ static GLuint Parse_VectorOrScalarConstant(struct parse_state *parseState, GLfloat *vec) { if (Parse_String(parseState, "{")) { return Parse_VectorConstant(parseState, vec); } else { GLboolean b = Parse_ScalarConstant(parseState, vec); if (b) { vec[1] = vec[2] = vec[3] = vec[0]; } return b; } } /** * Parse a texture image source: * [TEX0 | TEX1 | .. | TEX15] , [1D | 2D | 3D | CUBE | RECT] */ static GLboolean Parse_TextureImageId(struct parse_state *parseState, GLubyte *texUnit, GLubyte *texTargetBit) { GLubyte imageSrc[100]; GLint unit; if (!Parse_Token(parseState, imageSrc)) RETURN_ERROR; if (imageSrc[0] != 'T' || imageSrc[1] != 'E' || imageSrc[2] != 'X') { RETURN_ERROR1("Expected TEX# source"); } unit = _mesa_atoi((const char *) imageSrc + 3); if ((unit < 0 || unit > MAX_TEXTURE_IMAGE_UNITS) || (unit == 0 && (imageSrc[3] != '0' || imageSrc[4] != 0))) { RETURN_ERROR1("Invalied TEX# source index"); } *texUnit = unit; if (!Parse_String(parseState, ",")) RETURN_ERROR1("Expected ,"); if (Parse_String(parseState, "1D")) { *texTargetBit = TEXTURE_1D_BIT; } else if (Parse_String(parseState, "2D")) { *texTargetBit = TEXTURE_2D_BIT; } else if (Parse_String(parseState, "3D")) { *texTargetBit = TEXTURE_3D_BIT; } else if (Parse_String(parseState, "CUBE")) { *texTargetBit = TEXTURE_CUBE_BIT; } else if (Parse_String(parseState, "RECT")) { *texTargetBit = TEXTURE_RECT_BIT; } else { RETURN_ERROR1("Invalid texture target token"); } /* update record of referenced texture units */ parseState->texturesUsed[*texUnit] |= *texTargetBit; if (_mesa_bitcount(parseState->texturesUsed[*texUnit]) > 1) { RETURN_ERROR1("Only one texture target can be used per texture unit."); } return GL_TRUE; } /** * Parse a scalar suffix like .x, .y, .z or .w or parse a swizzle suffix * like .wxyz, .xxyy, etc and return the swizzle indexes. */ static GLboolean Parse_SwizzleSuffix(const GLubyte *token, GLuint swizzle[4]) { if (token[1] == 0) { /* single letter swizzle (scalar) */ if (token[0] == 'x') ASSIGN_4V(swizzle, 0, 0, 0, 0); else if (token[0] == 'y') ASSIGN_4V(swizzle, 1, 1, 1, 1); else if (token[0] == 'z') ASSIGN_4V(swizzle, 2, 2, 2, 2); else if (token[0] == 'w') ASSIGN_4V(swizzle, 3, 3, 3, 3); else return GL_FALSE; } else { /* 4-component swizzle (vector) */ GLint k; for (k = 0; token[k] && k < 4; k++) { if (token[k] == 'x') swizzle[k] = 0; else if (token[k] == 'y') swizzle[k] = 1; else if (token[k] == 'z') swizzle[k] = 2; else if (token[k] == 'w') swizzle[k] = 3; else return GL_FALSE; } if (k != 4) return GL_FALSE; } return GL_TRUE; } static GLboolean Parse_CondCodeMask(struct parse_state *parseState, struct fp_dst_register *dstReg) { if (Parse_String(parseState, "EQ")) dstReg->CondMask = COND_EQ; else if (Parse_String(parseState, "GE")) dstReg->CondMask = COND_GE; else if (Parse_String(parseState, "GT")) dstReg->CondMask = COND_GT; else if (Parse_String(parseState, "LE")) dstReg->CondMask = COND_LE; else if (Parse_String(parseState, "LT")) dstReg->CondMask = COND_LT; else if (Parse_String(parseState, "NE")) dstReg->CondMask = COND_NE; else if (Parse_String(parseState, "TR")) dstReg->CondMask = COND_TR; else if (Parse_String(parseState, "FL")) dstReg->CondMask = COND_FL; else RETURN_ERROR1("Invalid condition code mask"); /* look for optional .xyzw swizzle */ if (Parse_String(parseState, ".")) { GLubyte token[100]; GLuint swz[4]; if (!Parse_Token(parseState, token)) /* get xyzw suffix */ RETURN_ERROR; if (!Parse_SwizzleSuffix(token, swz)) RETURN_ERROR1("Invalid swizzle suffix"); dstReg->CondSwizzle = MAKE_SWIZZLE(swz); } return GL_TRUE; } /** * Parse a temporary register: Rnn or Hnn */ static GLboolean Parse_TempReg(struct parse_state *parseState, GLint *tempRegNum) { GLubyte token[100]; /* Should be 'R##' or 'H##' */ if (!Parse_Token(parseState, token)) RETURN_ERROR; if (token[0] != 'R' && token[0] != 'H') RETURN_ERROR1("Expected R## or H##"); if (IsDigit(token[1])) { GLint reg = _mesa_atoi((const char *) (token + 1)); if (token[0] == 'H') reg += 32; if (reg >= MAX_NV_FRAGMENT_PROGRAM_TEMPS) RETURN_ERROR1("Invalid temporary register name"); *tempRegNum = reg; } else { RETURN_ERROR1("Invalid temporary register name"); } return GL_TRUE; } /** * Parse a write-only dummy register: RC or HC. */ static GLboolean Parse_DummyReg(struct parse_state *parseState, GLint *regNum) { if (Parse_String(parseState, "RC")) { *regNum = 0; } else if (Parse_String(parseState, "HC")) { *regNum = 1; } else { RETURN_ERROR1("Invalid write-only register name"); } return GL_TRUE; } /** * Parse a program local parameter register "p[##]" */ static GLboolean Parse_ProgramParamReg(struct parse_state *parseState, GLint *regNum) { GLubyte token[100]; if (!Parse_String(parseState, "p[")) RETURN_ERROR1("Expected p["); if (!Parse_Token(parseState, token)) RETURN_ERROR; if (IsDigit(token[0])) { /* a numbered program parameter register */ GLint reg = _mesa_atoi((const char *) token); if (reg >= MAX_NV_FRAGMENT_PROGRAM_PARAMS) RETURN_ERROR1("Invalid constant program number"); *regNum = reg; } else { RETURN_ERROR; } if (!Parse_String(parseState, "]")) RETURN_ERROR1("Expected ]"); return GL_TRUE; } /** * Parse f[name] - fragment input register */ static GLboolean Parse_FragReg(struct parse_state *parseState, GLint *tempRegNum) { GLubyte token[100]; GLint j; /* Match 'f[' */ if (!Parse_String(parseState, "f[")) RETURN_ERROR1("Expected f["); /* get and look for match */ if (!Parse_Token(parseState, token)) { RETURN_ERROR; } for (j = 0; InputRegisters[j]; j++) { if (_mesa_strcmp((const char *) token, InputRegisters[j]) == 0) { *tempRegNum = j; parseState->inputsRead |= (1 << j); break; } } if (!InputRegisters[j]) { /* unknown input register label */ RETURN_ERROR2("Invalid register name", token); } /* Match '[' */ if (!Parse_String(parseState, "]")) RETURN_ERROR1("Expected ]"); return GL_TRUE; } static GLboolean Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum) { GLubyte token[100]; GLint j; /* Match "o[" */ if (!Parse_String(parseState, "o[")) RETURN_ERROR1("Expected o["); /* Get output reg name */ if (!Parse_Token(parseState, token)) RETURN_ERROR; /* try to match an output register name */ for (j = 0; OutputRegisters[j]; j++) { if (_mesa_strcmp((const char *) token, OutputRegisters[j]) == 0) { static GLuint bothColors = (1 << FRAG_OUTPUT_COLR) | (1 << FRAG_OUTPUT_COLH); *outputRegNum = j; parseState->outputsWritten |= (1 << j); if ((parseState->outputsWritten & bothColors) == bothColors) { RETURN_ERROR1("Illegal to write to both o[COLR] and o[COLH]"); } break; } } if (!OutputRegisters[j]) RETURN_ERROR1("Invalid output register name"); /* Match ']' */ if (!Parse_String(parseState, "]")) RETURN_ERROR1("Expected ]"); return GL_TRUE; } static GLboolean Parse_MaskedDstReg(struct parse_state *parseState, struct fp_dst_register *dstReg) { GLubyte token[100]; GLint idx; /* Dst reg can be R, H, o[n], RC or HC */ if (!Peek_Token(parseState, token)) RETURN_ERROR; if (_mesa_strcmp((const char *) token, "RC") == 0 || _mesa_strcmp((const char *) token, "HC") == 0) { /* a write-only register */ dstReg->File = PROGRAM_WRITE_ONLY; if (!Parse_DummyReg(parseState, &idx)) RETURN_ERROR; dstReg->Index = idx; } else if (token[0] == 'R' || token[0] == 'H') { /* a temporary register */ dstReg->File = PROGRAM_TEMPORARY; if (!Parse_TempReg(parseState, &idx)) RETURN_ERROR; dstReg->Index = idx; } else if (token[0] == 'o') { /* an output register */ dstReg->File = PROGRAM_OUTPUT; if (!Parse_OutputReg(parseState, &idx)) RETURN_ERROR; dstReg->Index = idx; } else { RETURN_ERROR1("Invalid destination register name"); } /* Parse optional write mask */ if (Parse_String(parseState, ".")) { /* got a mask */ GLint k = 0; if (!Parse_Token(parseState, token)) /* get xyzw writemask */ RETURN_ERROR; dstReg->WriteMask = 0; if (token[k] == 'x') { dstReg->WriteMask |= WRITEMASK_X; k++; } if (token[k] == 'y') { dstReg->WriteMask |= WRITEMASK_Y; k++; } if (token[k] == 'z') { dstReg->WriteMask |= WRITEMASK_Z; k++; } if (token[k] == 'w') { dstReg->WriteMask |= WRITEMASK_W; k++; } if (k == 0) { RETURN_ERROR1("Invalid writemask character"); } } else { dstReg->WriteMask = WRITEMASK_XYZW; } /* optional condition code mask */ if (Parse_String(parseState, "(")) { /* ("EQ" | "GE" | "GT" | "LE" | "LT" | "NE" | "TR" | "FL".x|y|z|w) */ /* ("EQ" | "GE" | "GT" | "LE" | "LT" | "NE" | "TR" | "FL".[xyzw]) */ if (!Parse_CondCodeMask(parseState, dstReg)) RETURN_ERROR; if (!Parse_String(parseState, ")")) /* consume ")" */ RETURN_ERROR1("Expected )"); return GL_TRUE; } else { /* no cond code mask */ dstReg->CondMask = COND_TR; dstReg->CondSwizzle = SWIZZLE_NOOP; return GL_TRUE; } } /** * Parse a vector source (register, constant, etc): * ::= * | * ::= "|" "|" */ static GLboolean Parse_VectorSrc(struct parse_state *parseState, struct fp_src_register *srcReg) { GLfloat sign = 1.0F; GLubyte token[100]; GLint idx; /* * First, take care of +/- and absolute value stuff. */ if (Parse_String(parseState, "-")) sign = -1.0F; else if (Parse_String(parseState, "+")) sign = +1.0F; if (Parse_String(parseState, "|")) { srcReg->Abs = GL_TRUE; srcReg->NegateAbs = (sign < 0.0F) ? GL_TRUE : GL_FALSE; if (Parse_String(parseState, "-")) srcReg->NegateBase = GL_TRUE; else if (Parse_String(parseState, "+")) srcReg->NegateBase = GL_FALSE; else srcReg->NegateBase = GL_FALSE; } else { srcReg->Abs = GL_FALSE; srcReg->NegateAbs = GL_FALSE; srcReg->NegateBase = (sign < 0.0F) ? GL_TRUE : GL_FALSE; } /* This should be the real src vector/register name */ if (!Peek_Token(parseState, token)) RETURN_ERROR; /* Src reg can be Rn, Hn, f[n], p[n], a named parameter, a scalar * literal or vector literal. */ if (token[0] == 'R' || token[0] == 'H') { srcReg->File = PROGRAM_TEMPORARY; if (!Parse_TempReg(parseState, &idx)) RETURN_ERROR; srcReg->Index = idx; } else if (token[0] == 'f') { /* XXX this might be an identier! */ srcReg->File = PROGRAM_INPUT; if (!Parse_FragReg(parseState, &idx)) RETURN_ERROR; srcReg->Index = idx; } else if (token[0] == 'p') { /* XXX this might be an identier! */ srcReg->File = PROGRAM_LOCAL_PARAM; if (!Parse_ProgramParamReg(parseState, &idx)) RETURN_ERROR; srcReg->Index = idx; } else if (IsLetter(token[0])){ GLubyte ident[100]; GLint paramIndex; if (!Parse_Identifier(parseState, ident)) RETURN_ERROR; paramIndex = _mesa_lookup_parameter_index(parseState->parameters, -1, (const char *) ident); if (paramIndex < 0) { RETURN_ERROR2("Undefined constant or parameter: ", ident); } srcReg->File = PROGRAM_NAMED_PARAM; srcReg->Index = paramIndex; } else if (IsDigit(token[0]) || token[0] == '-' || token[0] == '+' || token[0] == '.'){ /* literal scalar constant */ GLfloat values[4]; GLuint paramIndex; if (!Parse_ScalarConstant(parseState, values)) RETURN_ERROR; paramIndex = _mesa_add_unnamed_constant(parseState->parameters, values); srcReg->File = PROGRAM_NAMED_PARAM; srcReg->Index = paramIndex; } else if (token[0] == '{'){ /* literal vector constant */ GLfloat values[4]; GLuint paramIndex; (void) Parse_String(parseState, "{"); if (!Parse_VectorConstant(parseState, values)) RETURN_ERROR; paramIndex = _mesa_add_unnamed_constant(parseState->parameters, values); srcReg->File = PROGRAM_NAMED_PARAM; srcReg->Index = paramIndex; } else { RETURN_ERROR2("Invalid source register name", token); } /* init swizzle fields */ srcReg->Swizzle = SWIZZLE_NOOP; /* Look for optional swizzle suffix */ if (Parse_String(parseState, ".")) { GLuint swz[4]; if (!Parse_Token(parseState, token)) RETURN_ERROR; if (!Parse_SwizzleSuffix(token, swz)) RETURN_ERROR1("Invalid swizzle suffix"); srcReg->Swizzle = MAKE_SWIZZLE(swz); } /* Finish absolute value */ if (srcReg->Abs && !Parse_String(parseState, "|")) { RETURN_ERROR1("Expected |"); } return GL_TRUE; } static GLboolean Parse_ScalarSrcReg(struct parse_state *parseState, struct fp_src_register *srcReg) { GLubyte token[100]; GLfloat sign = 1.0F; GLboolean needSuffix = GL_TRUE; GLint idx; /* * First, take care of +/- and absolute value stuff. */ if (Parse_String(parseState, "-")) sign = -1.0F; else if (Parse_String(parseState, "+")) sign = +1.0F; if (Parse_String(parseState, "|")) { srcReg->Abs = GL_TRUE; srcReg->NegateAbs = (sign < 0.0F) ? GL_TRUE : GL_FALSE; if (Parse_String(parseState, "-")) srcReg->NegateBase = GL_TRUE; else if (Parse_String(parseState, "+")) srcReg->NegateBase = GL_FALSE; else srcReg->NegateBase = GL_FALSE; } else { srcReg->Abs = GL_FALSE; srcReg->NegateAbs = GL_FALSE; srcReg->NegateBase = (sign < 0.0F) ? GL_TRUE : GL_FALSE; } if (!Peek_Token(parseState, token)) RETURN_ERROR; /* Src reg can be R, H or a named fragment attrib */ if (token[0] == 'R' || token[0] == 'H') { srcReg->File = PROGRAM_TEMPORARY; if (!Parse_TempReg(parseState, &idx)) RETURN_ERROR; srcReg->Index = idx; } else if (token[0] == 'f') { srcReg->File = PROGRAM_INPUT; if (!Parse_FragReg(parseState, &idx)) RETURN_ERROR; srcReg->Index = idx; } else if (token[0] == '{') { /* vector literal */ GLfloat values[4]; GLuint paramIndex; (void) Parse_String(parseState, "{"); if (!Parse_VectorConstant(parseState, values)) RETURN_ERROR; paramIndex = _mesa_add_unnamed_constant(parseState->parameters, values); srcReg->File = PROGRAM_NAMED_PARAM; srcReg->Index = paramIndex; } else if (IsDigit(token[0])) { /* scalar literal */ GLfloat values[4]; GLuint paramIndex; if (!Parse_ScalarConstant(parseState, values)) RETURN_ERROR; paramIndex = _mesa_add_unnamed_constant(parseState->parameters, values); srcReg->Index = paramIndex; srcReg->File = PROGRAM_NAMED_PARAM; needSuffix = GL_FALSE; } else { RETURN_ERROR2("Invalid scalar source argument", token); } srcReg->Swizzle = 0; if (needSuffix) { /* parse .[xyzw] suffix */ if (!Parse_String(parseState, ".")) RETURN_ERROR1("Expected ."); if (!Parse_Token(parseState, token)) RETURN_ERROR; if (token[0] == 'x' && token[1] == 0) { srcReg->Swizzle = 0; } else if (token[0] == 'y' && token[1] == 0) { srcReg->Swizzle = 1; } else if (token[0] == 'z' && token[1] == 0) { srcReg->Swizzle = 2; } else if (token[0] == 'w' && token[1] == 0) { srcReg->Swizzle = 3; } else { RETURN_ERROR1("Invalid scalar source suffix"); } } /* Finish absolute value */ if (srcReg->Abs && !Parse_String(parseState, "|")) { RETURN_ERROR1("Expected |"); } return GL_TRUE; } static GLboolean Parse_PrintInstruction(struct parse_state *parseState, struct fp_instruction *inst) { const GLubyte *str; GLubyte *msg; GLuint len; GLint idx; /* The first argument is a literal string 'just like this' */ if (!Parse_String(parseState, "'")) RETURN_ERROR1("Expected '"); str = parseState->pos; for (len = 0; str[len] != '\''; len++) /* find closing quote */ ; parseState->pos += len + 1; msg = _mesa_malloc(len + 1); _mesa_memcpy(msg, str, len); msg[len] = 0; inst->Data = msg; if (Parse_String(parseState, ",")) { /* got an optional register to print */ GLubyte token[100]; GetToken(parseState, token); if (token[0] == 'o') { /* dst reg */ if (!Parse_OutputReg(parseState, &idx)) RETURN_ERROR; inst->SrcReg[0].Index = idx; inst->SrcReg[0].File = PROGRAM_OUTPUT; } else { /* src reg */ if (!Parse_VectorSrc(parseState, &inst->SrcReg[0])) RETURN_ERROR; } } else { /* File = 0 indicates no register to print */ inst->SrcReg[0].File = PROGRAM_UNDEFINED; } inst->SrcReg[0].Swizzle = SWIZZLE_NOOP; inst->SrcReg[0].NegateBase = GL_FALSE; inst->SrcReg[0].Abs = GL_FALSE; inst->SrcReg[0].NegateAbs = GL_FALSE; return GL_TRUE; } static GLboolean Parse_InstructionSequence(struct parse_state *parseState, struct fp_instruction program[]) { while (1) { struct fp_instruction *inst = program + parseState->numInst; struct instruction_pattern instMatch; GLubyte token[100]; /* Initialize the instruction */ inst->SrcReg[0].File = PROGRAM_UNDEFINED; inst->SrcReg[1].File = PROGRAM_UNDEFINED; inst->SrcReg[2].File = PROGRAM_UNDEFINED; inst->DstReg.File = PROGRAM_UNDEFINED; inst->DstReg.CondSwizzle = SWIZZLE_NOOP; inst->Data = NULL; /* special instructions */ if (Parse_String(parseState, "DEFINE")) { GLubyte id[100]; GLfloat value[7]; /* yes, 7 to be safe */ if (!Parse_Identifier(parseState, id)) RETURN_ERROR; /* XXX make sure id is not a reserved identifer, like R9 */ if (!Parse_String(parseState, "=")) RETURN_ERROR1("Expected ="); if (!Parse_VectorOrScalarConstant(parseState, value)) RETURN_ERROR; if (!Parse_String(parseState, ";")) RETURN_ERROR1("Expected ;"); if (_mesa_lookup_parameter_index(parseState->parameters, -1, (const char *) id) >= 0) { RETURN_ERROR2(id, "already defined"); } _mesa_add_named_parameter(parseState->parameters, (const char *) id, value); } else if (Parse_String(parseState, "DECLARE")) { GLubyte id[100]; GLfloat value[7] = {0, 0, 0, 0, 0, 0, 0}; /* yes, to be safe */ if (!Parse_Identifier(parseState, id)) RETURN_ERROR; /* XXX make sure id is not a reserved identifer, like R9 */ if (Parse_String(parseState, "=")) { if (!Parse_VectorOrScalarConstant(parseState, value)) RETURN_ERROR; } if (!Parse_String(parseState, ";")) RETURN_ERROR1("Expected ;"); if (_mesa_lookup_parameter_index(parseState->parameters, -1, (const char *) id) >= 0) { RETURN_ERROR2(id, "already declared"); } _mesa_add_named_parameter(parseState->parameters, (const char *) id, value); } else if (Parse_String(parseState, "END")) { inst->Opcode = FP_OPCODE_END; inst->StringPos = parseState->curLine - parseState->start; assert(inst->StringPos >= 0); parseState->numInst++; if (Parse_Token(parseState, token)) { RETURN_ERROR1("Code after END opcode."); } break; } else { /* general/arithmetic instruction */ /* get token */ if (!Parse_Token(parseState, token)) { RETURN_ERROR1("Missing END instruction."); } /* try to find matching instuction */ instMatch = MatchInstruction(token); if (instMatch.opcode < 0) { /* bad instruction name */ RETURN_ERROR2("Unexpected token: ", token); } inst->Opcode = instMatch.opcode; inst->Precision = instMatch.suffixes & (_R | _H | _X); inst->Saturate = (instMatch.suffixes & (_S)) ? GL_TRUE : GL_FALSE; inst->UpdateCondRegister = (instMatch.suffixes & (_C)) ? GL_TRUE : GL_FALSE; inst->StringPos = parseState->curLine - parseState->start; assert(inst->StringPos >= 0); /* * parse the input and output operands */ if (instMatch.outputs == OUTPUT_S || instMatch.outputs == OUTPUT_V) { if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) RETURN_ERROR; if (!Parse_String(parseState, ",")) RETURN_ERROR1("Expected ,"); } else if (instMatch.outputs == OUTPUT_NONE) { if (instMatch.opcode == FP_OPCODE_KIL_NV) { /* This is a little weird, the cond code info is in * the dest register. */ if (!Parse_CondCodeMask(parseState, &inst->DstReg)) RETURN_ERROR; } else { ASSERT(instMatch.opcode == FP_OPCODE_PRINT); } } if (instMatch.inputs == INPUT_1V) { if (!Parse_VectorSrc(parseState, &inst->SrcReg[0])) RETURN_ERROR; } else if (instMatch.inputs == INPUT_2V) { if (!Parse_VectorSrc(parseState, &inst->SrcReg[0])) RETURN_ERROR; if (!Parse_String(parseState, ",")) RETURN_ERROR1("Expected ,"); if (!Parse_VectorSrc(parseState, &inst->SrcReg[1])) RETURN_ERROR; } else if (instMatch.inputs == INPUT_3V) { if (!Parse_VectorSrc(parseState, &inst->SrcReg[0])) RETURN_ERROR; if (!Parse_String(parseState, ",")) RETURN_ERROR1("Expected ,"); if (!Parse_VectorSrc(parseState, &inst->SrcReg[1])) RETURN_ERROR; if (!Parse_String(parseState, ",")) RETURN_ERROR1("Expected ,"); if (!Parse_VectorSrc(parseState, &inst->SrcReg[2])) RETURN_ERROR; } else if (instMatch.inputs == INPUT_1S) { if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0])) RETURN_ERROR; } else if (instMatch.inputs == INPUT_2S) { if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0])) RETURN_ERROR; if (!Parse_String(parseState, ",")) RETURN_ERROR1("Expected ,"); if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[1])) RETURN_ERROR; } else if (instMatch.inputs == INPUT_CC) { /* XXX to-do */ } else if (instMatch.inputs == INPUT_1V_T) { GLubyte unit, idx; if (!Parse_VectorSrc(parseState, &inst->SrcReg[0])) RETURN_ERROR; if (!Parse_String(parseState, ",")) RETURN_ERROR1("Expected ,"); if (!Parse_TextureImageId(parseState, &unit, &idx)) RETURN_ERROR; inst->TexSrcUnit = unit; inst->TexSrcIdx = idx; } else if (instMatch.inputs == INPUT_3V_T) { GLubyte unit, idx; if (!Parse_VectorSrc(parseState, &inst->SrcReg[0])) RETURN_ERROR; if (!Parse_String(parseState, ",")) RETURN_ERROR1("Expected ,"); if (!Parse_VectorSrc(parseState, &inst->SrcReg[1])) RETURN_ERROR; if (!Parse_String(parseState, ",")) RETURN_ERROR1("Expected ,"); if (!Parse_VectorSrc(parseState, &inst->SrcReg[2])) RETURN_ERROR; if (!Parse_String(parseState, ",")) RETURN_ERROR1("Expected ,"); if (!Parse_TextureImageId(parseState, &unit, &idx)) RETURN_ERROR; inst->TexSrcUnit = unit; inst->TexSrcIdx = idx; } else if (instMatch.inputs == INPUT_1V_S) { if (!Parse_PrintInstruction(parseState, inst)) RETURN_ERROR; } /* end of statement semicolon */ if (!Parse_String(parseState, ";")) RETURN_ERROR1("Expected ;"); parseState->numInst++; if (parseState->numInst >= MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS) RETURN_ERROR1("Program too long"); } } return GL_TRUE; } /** * Parse/compile the 'str' returning the compiled 'program'. * ctx->Program.ErrorPos will be -1 if successful. Otherwise, ErrorPos * indicates the position of the error in 'str'. */ void _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget, const GLubyte *str, GLsizei len, struct fragment_program *program) { struct parse_state parseState; struct fp_instruction instBuffer[MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS]; struct fp_instruction *newInst; GLenum target; GLubyte *programString; /* Make a null-terminated copy of the program string */ programString = (GLubyte *) MALLOC(len + 1); if (!programString) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); return; } MEMCPY(programString, str, len); programString[len] = 0; /* Get ready to parse */ _mesa_bzero(&parseState, sizeof(struct parse_state)); parseState.ctx = ctx; parseState.start = programString; parseState.program = program; parseState.numInst = 0; parseState.curLine = programString; parseState.parameters = _mesa_new_parameter_list(); /* Reset error state */ _mesa_set_program_error(ctx, -1, NULL); /* check the program header */ if (_mesa_strncmp((const char *) programString, "!!FP1.0", 7) == 0) { target = GL_FRAGMENT_PROGRAM_NV; parseState.pos = programString + 7; } else if (_mesa_strncmp((const char *) programString, "!!FCP1.0", 8) == 0) { /* fragment / register combiner program - not supported */ _mesa_set_program_error(ctx, 0, "Invalid fragment program header"); _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(bad header)"); return; } else { /* invalid header */ _mesa_set_program_error(ctx, 0, "Invalid fragment program header"); _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(bad header)"); return; } /* make sure target and header match */ if (target != dstTarget) { _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(target mismatch 0x%x != 0x%x)", target, dstTarget); return; } if (Parse_InstructionSequence(&parseState, instBuffer)) { GLuint u; /* successful parse! */ if (parseState.outputsWritten == 0) { /* must write at least one output! */ _mesa_error(ctx, GL_INVALID_OPERATION, "Invalid fragment program - no outputs written."); return; } /* copy the compiled instructions */ assert(parseState.numInst <= MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS); newInst = (struct fp_instruction *) MALLOC(parseState.numInst * sizeof(struct fp_instruction)); if (!newInst) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); return; /* out of memory */ } MEMCPY(newInst, instBuffer, parseState.numInst * sizeof(struct fp_instruction)); /* install the program */ program->Base.Target = target; if (program->Base.String) { FREE(program->Base.String); } program->Base.String = programString; program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB; if (program->Instructions) { FREE(program->Instructions); } program->Instructions = newInst; program->InputsRead = parseState.inputsRead; program->OutputsWritten = parseState.outputsWritten; for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) program->TexturesUsed[u] = parseState.texturesUsed[u]; /* save program parameters */ program->Parameters = parseState.parameters; /* allocate registers for declared program parameters */ #if 00 _mesa_assign_program_registers(&(program->SymbolTable)); #endif #ifdef DEBUG_foo _mesa_printf("--- glLoadProgramNV(%d) result ---\n", program->Base.Id); _mesa_print_nv_fragment_program(program); _mesa_printf("----------------------------------\n"); #endif } else { /* Error! */ _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV"); /* NOTE: _mesa_set_program_error would have been called already */ } } static void PrintSrcReg(const struct fragment_program *program, const struct fp_src_register *src) { static const char comps[5] = "xyzw"; if (src->NegateAbs) { _mesa_printf("-"); } if (src->Abs) { _mesa_printf("|"); } if (src->NegateBase) { _mesa_printf("-"); } if (src->File == PROGRAM_NAMED_PARAM) { if (program->Parameters->Parameters[src->Index].Type == CONSTANT) { _mesa_printf("{%g, %g, %g, %g}", program->Parameters->ParameterValues[src->Index][0], program->Parameters->ParameterValues[src->Index][1], program->Parameters->ParameterValues[src->Index][2], program->Parameters->ParameterValues[src->Index][3]); } else { ASSERT(program->Parameters->Parameters[src->Index].Type == NAMED_PARAMETER); _mesa_printf("%s", program->Parameters->Parameters[src->Index].Name); } } else if (src->File == PROGRAM_OUTPUT) { _mesa_printf("o[%s]", OutputRegisters[src->Index]); } else if (src->File == PROGRAM_INPUT) { _mesa_printf("f[%s]", InputRegisters[src->Index]); } else if (src->File == PROGRAM_LOCAL_PARAM) { _mesa_printf("p[%d]", src->Index); } else if (src->File == PROGRAM_TEMPORARY) { if (src->Index >= 32) _mesa_printf("H%d", src->Index); else _mesa_printf("R%d", src->Index); } else if (src->File == PROGRAM_WRITE_ONLY) { _mesa_printf("%cC", "HR"[src->Index]); } else { _mesa_problem(NULL, "Invalid fragment register %d", src->Index); return; } if (GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 1) && GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 2) && GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 3)) { _mesa_printf(".%c", comps[GET_SWZ(src->Swizzle, 0)]); } else if (src->Swizzle != SWIZZLE_NOOP) { _mesa_printf(".%c%c%c%c", comps[GET_SWZ(src->Swizzle, 0)], comps[GET_SWZ(src->Swizzle, 1)], comps[GET_SWZ(src->Swizzle, 2)], comps[GET_SWZ(src->Swizzle, 3)]); } if (src->Abs) { _mesa_printf("|"); } } static void PrintTextureSrc(const struct fp_instruction *inst) { _mesa_printf("TEX%d, ", inst->TexSrcUnit); switch (inst->TexSrcIdx) { case TEXTURE_1D_INDEX: _mesa_printf("1D"); break; case TEXTURE_2D_INDEX: _mesa_printf("2D"); break; case TEXTURE_3D_INDEX: _mesa_printf("3D"); break; case TEXTURE_RECT_INDEX: _mesa_printf("RECT"); break; case TEXTURE_CUBE_INDEX: _mesa_printf("CUBE"); break; default: _mesa_problem(NULL, "Invalid textue target in PrintTextureSrc"); } } static void PrintCondCode(const struct fp_dst_register *dst) { static const char *comps = "xyzw"; static const char *ccString[] = { "??", "GT", "EQ", "LT", "UN", "GE", "LE", "NE", "TR", "FL", "??" }; _mesa_printf("%s", ccString[dst->CondMask]); if (GET_SWZ(dst->CondSwizzle, 0) == GET_SWZ(dst->CondSwizzle, 1) && GET_SWZ(dst->CondSwizzle, 0) == GET_SWZ(dst->CondSwizzle, 2) && GET_SWZ(dst->CondSwizzle, 0) == GET_SWZ(dst->CondSwizzle, 3)) { _mesa_printf(".%c", comps[GET_SWZ(dst->CondSwizzle, 0)]); } else if (dst->CondSwizzle != SWIZZLE_NOOP) { _mesa_printf(".%c%c%c%c", comps[GET_SWZ(dst->CondSwizzle, 0)], comps[GET_SWZ(dst->CondSwizzle, 1)], comps[GET_SWZ(dst->CondSwizzle, 2)], comps[GET_SWZ(dst->CondSwizzle, 3)]); } } static void PrintDstReg(const struct fp_dst_register *dst) { if (dst->File == PROGRAM_OUTPUT) { _mesa_printf("o[%s]", OutputRegisters[dst->Index]); } else if (dst->File == PROGRAM_TEMPORARY) { if (dst->Index >= 32) _mesa_printf("H%d", dst->Index); else _mesa_printf("R%d", dst->Index); } else if (dst->File == PROGRAM_LOCAL_PARAM) { _mesa_printf("p[%d]", dst->Index); } else if (dst->File == PROGRAM_WRITE_ONLY) { _mesa_printf("%cC", "HR"[dst->Index]); } else { _mesa_printf("???"); } if (dst->WriteMask != 0 && dst->WriteMask != 0xf) { _mesa_printf("."); if (dst->WriteMask & 0x1) _mesa_printf("x"); if (dst->WriteMask & 0x2) _mesa_printf("y"); if (dst->WriteMask & 0x4) _mesa_printf("z"); if (dst->WriteMask & 0x8) _mesa_printf("w"); } if (dst->CondMask != COND_TR || dst->CondSwizzle != SWIZZLE_NOOP) { _mesa_printf(" ("); PrintCondCode(dst); _mesa_printf(")"); } } /** * Print (unparse) the given vertex program. Just for debugging. */ void _mesa_print_nv_fragment_program(const struct fragment_program *program) { const struct fp_instruction *inst; for (inst = program->Instructions; inst->Opcode != FP_OPCODE_END; inst++) { int i; for (i = 0; Instructions[i].name; i++) { if (inst->Opcode == Instructions[i].opcode) { /* print instruction name */ _mesa_printf("%s", Instructions[i].name); if (inst->Precision == FLOAT16) _mesa_printf("H"); else if (inst->Precision == FIXED12) _mesa_printf("X"); if (inst->UpdateCondRegister) _mesa_printf("C"); if (inst->Saturate) _mesa_printf("_SAT"); _mesa_printf(" "); if (Instructions[i].inputs == INPUT_CC) { PrintCondCode(&inst->DstReg); } else if (Instructions[i].outputs == OUTPUT_V || Instructions[i].outputs == OUTPUT_S) { /* print dest register */ PrintDstReg(&inst->DstReg); _mesa_printf(", "); } /* print source register(s) */ if (Instructions[i].inputs == INPUT_1V || Instructions[i].inputs == INPUT_1S) { PrintSrcReg(program, &inst->SrcReg[0]); } else if (Instructions[i].inputs == INPUT_2V || Instructions[i].inputs == INPUT_2S) { PrintSrcReg(program, &inst->SrcReg[0]); _mesa_printf(", "); PrintSrcReg(program, &inst->SrcReg[1]); } else if (Instructions[i].inputs == INPUT_3V) { PrintSrcReg(program, &inst->SrcReg[0]); _mesa_printf(", "); PrintSrcReg(program, &inst->SrcReg[1]); _mesa_printf(", "); PrintSrcReg(program, &inst->SrcReg[2]); } else if (Instructions[i].inputs == INPUT_1V_T) { PrintSrcReg(program, &inst->SrcReg[0]); _mesa_printf(", "); PrintTextureSrc(inst); } else if (Instructions[i].inputs == INPUT_3V_T) { PrintSrcReg(program, &inst->SrcReg[0]); _mesa_printf(", "); PrintSrcReg(program, &inst->SrcReg[1]); _mesa_printf(", "); PrintSrcReg(program, &inst->SrcReg[2]); _mesa_printf(", "); PrintTextureSrc(inst); } _mesa_printf(";\n"); break; } } if (!Instructions[i].name) { _mesa_printf("Invalid opcode %d\n", inst->Opcode); } } _mesa_printf("END\n"); } const char * _mesa_nv_fragment_input_register_name(GLuint i) { ASSERT(i < MAX_NV_FRAGMENT_PROGRAM_INPUTS); return InputRegisters[i]; } const char * _mesa_nv_fragment_output_register_name(GLuint i) { ASSERT(i < MAX_NV_FRAGMENT_PROGRAM_OUTPUTS); return OutputRegisters[i]; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/nvfragparse.h0000644000000000000000000000324013614532424021151 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Brian Paul */ #ifndef NVFRAGPARSE_H #define NVFRAGPARSE_H extern void _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum target, const GLubyte *str, GLsizei len, struct fragment_program *program); extern void _mesa_print_nv_fragment_program(const struct fragment_program *program); extern const char * _mesa_nv_fragment_input_register_name(GLuint i); extern const char * _mesa_nv_fragment_output_register_name(GLuint i); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/nvfragprog.h0000644000000000000000000001156113614532424021013 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Private fragment program types and constants only used by files * related to fragment programs. * * XXX TO-DO: Rename this file "fragprog.h" since it's not NV-specific. */ #ifndef NVFRAGPROG_H #define NVFRAGPROG_H #include "config.h" #include "mtypes.h" /* output registers */ #define FRAG_OUTPUT_COLR 0 #define FRAG_OUTPUT_COLH 1 #define FRAG_OUTPUT_DEPR 2 /* condition codes */ #define COND_GT 1 /* greater than zero */ #define COND_EQ 2 /* equal to zero */ #define COND_LT 3 /* less than zero */ #define COND_UN 4 /* unordered (NaN) */ #define COND_GE 5 /* greater then or equal to zero */ #define COND_LE 6 /* less then or equal to zero */ #define COND_NE 7 /* not equal to zero */ #define COND_TR 8 /* always true */ #define COND_FL 9 /* always false */ /* instruction precision */ #define FLOAT32 0x1 #define FLOAT16 0x2 #define FIXED12 0x4 /* Fragment program instruction opcodes */ enum fp_opcode { FP_OPCODE_ABS, /* ARB_f_p only */ FP_OPCODE_ADD, FP_OPCODE_CMP, /* ARB_f_p only */ FP_OPCODE_COS, FP_OPCODE_DDX, /* NV_f_p only */ FP_OPCODE_DDY, /* NV_f_p only */ FP_OPCODE_DP3, FP_OPCODE_DP4, FP_OPCODE_DPH, /* ARB_f_p only */ FP_OPCODE_DST, FP_OPCODE_END, /* private opcode */ FP_OPCODE_EX2, FP_OPCODE_FLR, FP_OPCODE_FRC, FP_OPCODE_KIL, /* ARB_f_p only */ FP_OPCODE_KIL_NV, /* NV_f_p only */ FP_OPCODE_LG2, FP_OPCODE_LIT, FP_OPCODE_LRP, FP_OPCODE_MAD, FP_OPCODE_MAX, FP_OPCODE_MIN, FP_OPCODE_MOV, FP_OPCODE_MUL, FP_OPCODE_PK2H, /* NV_f_p only */ FP_OPCODE_PK2US, /* NV_f_p only */ FP_OPCODE_PK4B, /* NV_f_p only */ FP_OPCODE_PK4UB, /* NV_f_p only */ FP_OPCODE_POW, FP_OPCODE_PRINT, /* Mesa only */ FP_OPCODE_RCP, FP_OPCODE_RFL, /* NV_f_p only */ FP_OPCODE_RSQ, FP_OPCODE_SCS, /* ARB_f_p only */ FP_OPCODE_SEQ, /* NV_f_p only */ FP_OPCODE_SFL, /* NV_f_p only */ FP_OPCODE_SGE, /* NV_f_p only */ FP_OPCODE_SGT, /* NV_f_p only */ FP_OPCODE_SIN, FP_OPCODE_SLE, /* NV_f_p only */ FP_OPCODE_SLT, FP_OPCODE_SNE, /* NV_f_p only */ FP_OPCODE_STR, /* NV_f_p only */ FP_OPCODE_SUB, FP_OPCODE_SWZ, /* ARB_f_p only */ FP_OPCODE_TEX, FP_OPCODE_TXB, /* ARB_f_p only */ FP_OPCODE_TXD, /* NV_f_p only */ FP_OPCODE_TXP, /* ARB_f_p only */ FP_OPCODE_TXP_NV, /* NV_f_p only */ FP_OPCODE_UP2H, /* NV_f_p only */ FP_OPCODE_UP2US, /* NV_f_p only */ FP_OPCODE_UP4B, /* NV_f_p only */ FP_OPCODE_UP4UB, /* NV_f_p only */ FP_OPCODE_X2D, /* NV_f_p only - 2d mat mul */ FP_OPCODE_XPD /* ARB_f_p only - cross product */ }; /* Instruction source register */ struct fp_src_register { GLuint File:4; GLuint Index:8; GLuint Swizzle:12; GLuint NegateBase:4; /* ARB: negate/extended negate. NV: negate before absolute value? */ GLuint Abs:1; /* NV: take absolute value? */ GLuint NegateAbs:1; /* NV: negate after absolute value? */ }; /* Instruction destination register */ struct fp_dst_register { GLuint File:4; GLuint Index:8; GLuint WriteMask:4; GLuint CondMask:4; /* NV: enough bits? */ GLuint CondSwizzle:12; /* NV: enough bits? */ }; /* Fragment program instruction */ struct fp_instruction { GLuint Opcode:6; GLuint Saturate:1; GLuint UpdateCondRegister:1; /* NV */ GLuint Precision:2; /* NV: unused/unneeded? */ GLuint TexSrcUnit:4; /* texture unit for TEX, TXD, TXP instructions */ GLuint TexSrcIdx:3; /* TEXTURE_1D,2D,3D,CUBE,RECT_INDEX source target */ #if FEATURE_MESA_program_debug GLint StringPos:15; /* enough bits? */ #endif void *Data; /* some arbitrary data, only used for PRINT instruction now */ struct fp_src_register SrcReg[3]; struct fp_dst_register DstReg; }; #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/nvprogram.c0000644000000000000000000005776313614532424020664 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file nvprogram.c * NVIDIA vertex/fragment program state management functions. * \author Brian Paul */ /* * Regarding GL_NV_fragment/vertex_program, GL_NV_vertex_program1_1, etc: * * Portions of this software may use or implement intellectual * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims * any and all warranties with respect to such intellectual property, * including any use thereof or modifications thereto. */ #include "glheader.h" #include "context.h" #include "hash.h" #include "imports.h" #include "macros.h" #include "mtypes.h" #include "nvfragparse.h" #include "nvfragprog.h" #include "nvvertexec.h" #include "nvvertparse.h" #include "nvvertprog.h" #include "nvprogram.h" #include "program.h" /** * Execute a vertex state program. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) { struct vertex_program *vprog; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target != GL_VERTEX_STATE_PROGRAM_NV) { _mesa_error(ctx, GL_INVALID_ENUM, "glExecuteProgramNV"); return; } FLUSH_VERTICES(ctx, _NEW_PROGRAM); vprog = (struct vertex_program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (!vprog || vprog->Base.Target != GL_VERTEX_STATE_PROGRAM_NV) { _mesa_error(ctx, GL_INVALID_OPERATION, "glExecuteProgramNV"); return; } _mesa_init_vp_per_vertex_registers(ctx); _mesa_init_vp_per_primitive_registers(ctx); COPY_4V(ctx->VertexProgram.Inputs[VERT_ATTRIB_POS], params); _mesa_exec_vertex_program(ctx, vprog); } /** * Determine if a set of programs is resident in hardware. * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ GLboolean GLAPIENTRY _mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids, GLboolean *residences) { GLint i, j; GLboolean allResident = GL_TRUE; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV(n)"); return GL_FALSE; } for (i = 0; i < n; i++) { const struct program *prog; if (ids[i] == 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV"); return GL_FALSE; } prog = (const struct program *) _mesa_HashLookup(ctx->Shared->Programs, ids[i]); if (!prog) { _mesa_error(ctx, GL_INVALID_VALUE, "glAreProgramsResidentNV"); return GL_FALSE; } if (prog->Resident) { if (!allResident) residences[i] = GL_TRUE; } else { if (allResident) { allResident = GL_FALSE; for (j = 0; j < i; j++) residences[j] = GL_TRUE; } residences[i] = GL_FALSE; } } return allResident; } /** * Request that a set of programs be resident in hardware. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_RequestResidentProgramsNV(GLsizei n, const GLuint *ids) { GLint i; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(n)"); return; } /* just error checking for now */ for (i = 0; i < n; i++) { struct program *prog; if (ids[i] == 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(id)"); return; } prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, ids[i]); if (!prog) { _mesa_error(ctx, GL_INVALID_VALUE, "glRequestResidentProgramsNV(id)"); return; } /* XXX this is really a hardware thing we should hook out */ prog->Resident = GL_TRUE; } } /** * Get a program parameter register. * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_GetProgramParameterfvNV(GLenum target, GLuint index, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_VERTEX_PROGRAM_NV) { if (pname == GL_PROGRAM_PARAMETER_NV) { if (index < MAX_NV_VERTEX_PROGRAM_PARAMS) { COPY_4V(params, ctx->VertexProgram.Parameters[index]); } else { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramParameterfvNV(index)"); return; } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterfvNV(pname)"); return; } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterfvNV(target)"); return; } } /** * Get a program parameter register. * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_GetProgramParameterdvNV(GLenum target, GLuint index, GLenum pname, GLdouble *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_VERTEX_PROGRAM_NV) { if (pname == GL_PROGRAM_PARAMETER_NV) { if (index < MAX_NV_VERTEX_PROGRAM_PARAMS) { COPY_4V(params, ctx->VertexProgram.Parameters[index]); } else { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramParameterdvNV(index)"); return; } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterdvNV(pname)"); return; } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramParameterdvNV(target)"); return; } } /** * Get a program attribute. * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params) { struct program *prog; GET_CURRENT_CONTEXT(ctx); if (!ctx->_CurrentProgram) ASSERT_OUTSIDE_BEGIN_END(ctx); prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (!prog) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramivNV"); return; } switch (pname) { case GL_PROGRAM_TARGET_NV: *params = prog->Target; return; case GL_PROGRAM_LENGTH_NV: *params = prog->String ?(GLint)_mesa_strlen((char *) prog->String) : 0; return; case GL_PROGRAM_RESIDENT_NV: *params = prog->Resident; return; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivNV(pname)"); return; } } /** * Get the program source code. * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program) { struct program *prog; GET_CURRENT_CONTEXT(ctx); if (!ctx->_CurrentProgram) ASSERT_OUTSIDE_BEGIN_END(ctx); if (pname != GL_PROGRAM_STRING_NV) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramStringNV(pname)"); return; } prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (!prog) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramStringNV"); return; } if (prog->String) { MEMCPY(program, prog->String, _mesa_strlen((char *) prog->String)); } else { program[0] = 0; } } /** * Get matrix tracking information. * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_GetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) { GLuint i; if ((address & 0x3) || address >= MAX_NV_VERTEX_PROGRAM_PARAMS) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetTrackMatrixivNV(address)"); return; } i = address / 4; switch (pname) { case GL_TRACK_MATRIX_NV: params[0] = (GLint) ctx->VertexProgram.TrackMatrix[i]; return; case GL_TRACK_MATRIX_TRANSFORM_NV: params[0] = (GLint) ctx->VertexProgram.TrackMatrixTransform[i]; return; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetTrackMatrixivNV"); return; } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTrackMatrixivNV"); return; } } /** * Get a vertex (or vertex array) attribute. * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (index == 0 || index >= MAX_NV_VERTEX_PROGRAM_INPUTS) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)"); return; } switch (pname) { case GL_ATTRIB_ARRAY_SIZE_NV: params[0] = ctx->Array.VertexAttrib[index].Size; break; case GL_ATTRIB_ARRAY_STRIDE_NV: params[0] = ctx->Array.VertexAttrib[index].Stride; break; case GL_ATTRIB_ARRAY_TYPE_NV: params[0] = ctx->Array.VertexAttrib[index].Type; break; case GL_CURRENT_ATTRIB_NV: FLUSH_CURRENT(ctx, 0); COPY_4V(params, ctx->Current.Attrib[index]); break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV"); return; } } /** * Get a vertex (or vertex array) attribute. * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_GetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (index == 0 || index >= MAX_NV_VERTEX_PROGRAM_INPUTS) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)"); return; } switch (pname) { case GL_ATTRIB_ARRAY_SIZE_NV: params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Size; break; case GL_ATTRIB_ARRAY_STRIDE_NV: params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Stride; break; case GL_ATTRIB_ARRAY_TYPE_NV: params[0] = (GLfloat) ctx->Array.VertexAttrib[index].Type; break; case GL_CURRENT_ATTRIB_NV: FLUSH_CURRENT(ctx, 0); COPY_4V(params, ctx->Current.Attrib[index]); break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV"); return; } } /** * Get a vertex (or vertex array) attribute. * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (index == 0 || index >= MAX_NV_VERTEX_PROGRAM_INPUTS) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribdvNV(index)"); return; } switch (pname) { case GL_ATTRIB_ARRAY_SIZE_NV: params[0] = ctx->Array.VertexAttrib[index].Size; break; case GL_ATTRIB_ARRAY_STRIDE_NV: params[0] = ctx->Array.VertexAttrib[index].Stride; break; case GL_ATTRIB_ARRAY_TYPE_NV: params[0] = ctx->Array.VertexAttrib[index].Type; break; case GL_CURRENT_ATTRIB_NV: FLUSH_CURRENT(ctx, 0); params[0] = (GLint) ctx->Current.Attrib[index][0]; params[1] = (GLint) ctx->Current.Attrib[index][1]; params[2] = (GLint) ctx->Current.Attrib[index][2]; params[3] = (GLint) ctx->Current.Attrib[index][3]; break; case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB: if (!ctx->Extensions.ARB_vertex_buffer_object) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV"); return; } params[0] = ctx->Array.VertexAttrib[index].BufferObj->Name; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribdvNV"); return; } } /** * Get a vertex array attribute pointer. * \note Not compiled into display lists. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (index >= MAX_NV_VERTEX_PROGRAM_INPUTS) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribPointerNV(index)"); return; } if (pname != GL_ATTRIB_ARRAY_POINTER_NV) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribPointerNV(pname)"); return; } *pointer = (GLvoid *) ctx->Array.VertexAttrib[index].Ptr;; } /** * Load/parse/compile a program. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte *program) { struct program *prog; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (id == 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glLoadProgramNV(id)"); return; } FLUSH_VERTICES(ctx, _NEW_PROGRAM); prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (prog && prog->Target != 0 && prog->Target != target) { _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(target)"); return; } if ((target == GL_VERTEX_PROGRAM_NV || target == GL_VERTEX_STATE_PROGRAM_NV) && ctx->Extensions.NV_vertex_program) { struct vertex_program *vprog = (struct vertex_program *) prog; if (!vprog || prog == &_mesa_DummyProgram) { vprog = (struct vertex_program *) ctx->Driver.NewProgram(ctx, target, id); if (!vprog) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); return; } _mesa_HashInsert(ctx->Shared->Programs, id, vprog); } _mesa_parse_nv_vertex_program(ctx, target, program, len, vprog); } else if (target == GL_FRAGMENT_PROGRAM_NV && ctx->Extensions.NV_fragment_program) { struct fragment_program *fprog = (struct fragment_program *) prog; if (!fprog || prog == &_mesa_DummyProgram) { fprog = (struct fragment_program *) ctx->Driver.NewProgram(ctx, target, id); if (!fprog) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); return; } _mesa_HashInsert(ctx->Shared->Programs, id, fprog); } _mesa_parse_nv_fragment_program(ctx, target, program, len, fprog); } else { _mesa_error(ctx, GL_INVALID_ENUM, "glLoadProgramNV(target)"); } } /** * Set a program parameter register. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_ProgramParameter4dNV(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { _mesa_ProgramParameter4fNV(target, index, (GLfloat)x, (GLfloat)y, (GLfloat)z, (GLfloat)w); } /** * Set a program parameter register. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_ProgramParameter4dvNV(GLenum target, GLuint index, const GLdouble *params) { _mesa_ProgramParameter4fNV(target, index, (GLfloat)params[0], (GLfloat)params[1], (GLfloat)params[2], (GLfloat)params[3]); } /** * Set a program parameter register. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_ProgramParameter4fNV(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) { if (index < MAX_NV_VERTEX_PROGRAM_PARAMS) { FLUSH_VERTICES(ctx, _NEW_PROGRAM); ASSIGN_4V(ctx->VertexProgram.Parameters[index], x, y, z, w); } else { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameterNV(index)"); return; } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameterNV"); return; } } /** * Set a program parameter register. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params) { _mesa_ProgramParameter4fNV(target, index, params[0], params[1], params[2], params[3]); } /** * Set a sequence of program parameter registers. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_ProgramParameters4dvNV(GLenum target, GLuint index, GLuint num, const GLdouble *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) { GLuint i; if (index + num > MAX_NV_VERTEX_PROGRAM_PARAMS) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameters4dvNV"); return; } for (i = 0; i < num; i++) { ctx->VertexProgram.Parameters[index + i][0] = (GLfloat) params[0]; ctx->VertexProgram.Parameters[index + i][1] = (GLfloat) params[1]; ctx->VertexProgram.Parameters[index + i][2] = (GLfloat) params[2]; ctx->VertexProgram.Parameters[index + i][3] = (GLfloat) params[3]; params += 4; }; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameters4dvNV"); return; } } /** * Set a sequence of program parameter registers. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_ProgramParameters4fvNV(GLenum target, GLuint index, GLuint num, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) { GLuint i; if (index + num > MAX_NV_VERTEX_PROGRAM_PARAMS) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameters4fvNV"); return; } for (i = 0; i < num; i++) { COPY_4V(ctx->VertexProgram.Parameters[index + i], params); params += 4; }; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameters4fvNV"); return; } } /** * Setup tracking of matrices into program parameter registers. * \note Called from the GL API dispatcher. */ void GLAPIENTRY _mesa_TrackMatrixNV(GLenum target, GLuint address, GLenum matrix, GLenum transform) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM); if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) { if (address & 0x3) { /* addr must be multiple of four */ _mesa_error(ctx, GL_INVALID_VALUE, "glTrackMatrixNV(address)"); return; } switch (matrix) { case GL_NONE: case GL_MODELVIEW: case GL_PROJECTION: case GL_TEXTURE: case GL_COLOR: case GL_MODELVIEW_PROJECTION_NV: case GL_MATRIX0_NV: case GL_MATRIX1_NV: case GL_MATRIX2_NV: case GL_MATRIX3_NV: case GL_MATRIX4_NV: case GL_MATRIX5_NV: case GL_MATRIX6_NV: case GL_MATRIX7_NV: /* OK, fallthrough */ break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(matrix)"); return; } switch (transform) { case GL_IDENTITY_NV: case GL_INVERSE_NV: case GL_TRANSPOSE_NV: case GL_INVERSE_TRANSPOSE_NV: /* OK, fallthrough */ break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(transform)"); return; } ctx->VertexProgram.TrackMatrix[address / 4] = matrix; ctx->VertexProgram.TrackMatrixTransform[address / 4] = transform; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTrackMatrixNV(target)"); return; } } void GLAPIENTRY _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { struct program *prog; struct fragment_program *fragProg; GLfloat *v; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM); prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (!prog || prog->Target != GL_FRAGMENT_PROGRAM_NV) { _mesa_error(ctx, GL_INVALID_OPERATION, "glProgramNamedParameterNV"); return; } if (len <= 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramNamedParameterNV(len)"); return; } fragProg = (struct fragment_program *) prog; v = _mesa_lookup_parameter_value(fragProg->Parameters, len, (char *) name); if (v) { v[0] = x; v[1] = y; v[2] = z; v[3] = w; return; } _mesa_error(ctx, GL_INVALID_VALUE, "glProgramNamedParameterNV(name)"); } void GLAPIENTRY _mesa_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name, const float v[]) { _mesa_ProgramNamedParameter4fNV(id, len, name, v[0], v[1], v[2], v[3]); } void GLAPIENTRY _mesa_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { _mesa_ProgramNamedParameter4fNV(id, len, name, (GLfloat)x, (GLfloat)y, (GLfloat)z, (GLfloat)w); } void GLAPIENTRY _mesa_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name, const double v[]) { _mesa_ProgramNamedParameter4fNV(id, len, name, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]); } void GLAPIENTRY _mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name, GLfloat *params) { struct program *prog; struct fragment_program *fragProg; const GLfloat *v; GET_CURRENT_CONTEXT(ctx); if (!ctx->_CurrentProgram) ASSERT_OUTSIDE_BEGIN_END(ctx); prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (!prog || prog->Target != GL_FRAGMENT_PROGRAM_NV) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramNamedParameterNV"); return; } if (len <= 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramNamedParameterNV"); return; } fragProg = (struct fragment_program *) prog; v = _mesa_lookup_parameter_value(fragProg->Parameters, len, (char *) name); if (v) { params[0] = v[0]; params[1] = v[1]; params[2] = v[2]; params[3] = v[3]; return; } _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramNamedParameterNV"); } void GLAPIENTRY _mesa_GetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte *name, GLdouble *params) { GLfloat floatParams[4]; _mesa_GetProgramNamedParameterfvNV(id, len, name, floatParams); COPY_4V(params, floatParams); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/nvprogram.h0000644000000000000000000001041113614532424020644 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Brian Paul */ #ifndef NVPROGRAM_H #define NVPROGRAM_H extern void GLAPIENTRY _mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params); extern GLboolean GLAPIENTRY _mesa_AreProgramsResidentNV(GLsizei n, const GLuint *ids, GLboolean *residences); extern void GLAPIENTRY _mesa_RequestResidentProgramsNV(GLsizei n, const GLuint *ids); extern void GLAPIENTRY _mesa_GetProgramParameterfvNV(GLenum target, GLuint index, GLenum pname, GLfloat *params); extern void GLAPIENTRY _mesa_GetProgramParameterdvNV(GLenum target, GLuint index, GLenum pname, GLdouble *params); extern void GLAPIENTRY _mesa_GetProgramivNV(GLuint id, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GetProgramStringNV(GLuint id, GLenum pname, GLubyte *program); extern void GLAPIENTRY _mesa_GetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble *params); extern void GLAPIENTRY _mesa_GetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat *params); extern void GLAPIENTRY _mesa_GetVertexAttribivNV(GLuint index, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer); extern void GLAPIENTRY _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte *program); extern void GLAPIENTRY _mesa_ProgramParameter4dNV(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); extern void GLAPIENTRY _mesa_ProgramParameter4dvNV(GLenum target, GLuint index, const GLdouble *params); extern void GLAPIENTRY _mesa_ProgramParameter4fNV(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); extern void GLAPIENTRY _mesa_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params); extern void GLAPIENTRY _mesa_ProgramParameters4dvNV(GLenum target, GLuint index, GLuint num, const GLdouble *params); extern void GLAPIENTRY _mesa_ProgramParameters4fvNV(GLenum target, GLuint index, GLuint num, const GLfloat *params); extern void GLAPIENTRY _mesa_TrackMatrixNV(GLenum target, GLuint address, GLenum matrix, GLenum transform); extern void GLAPIENTRY _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); extern void GLAPIENTRY _mesa_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name, const float v[]); extern void GLAPIENTRY _mesa_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); extern void GLAPIENTRY _mesa_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name, const double v[]); extern void GLAPIENTRY _mesa_GetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); extern void GLAPIENTRY _mesa_GetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/nvvertexec.c0000644000000000000000000007250513614532424021031 0ustar /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file nvvertexec.c * Code to execute vertex programs. * \author Brian Paul */ #include "glheader.h" #include "context.h" #include "imports.h" #include "macros.h" #include "mtypes.h" #include "nvvertexec.h" #include "nvvertprog.h" #include "program.h" #include "math/m_matrix.h" static const GLfloat ZeroVec[4] = { 0.0F, 0.0F, 0.0F, 0.0F }; /** * Load/initialize the vertex program registers which need to be set * per-vertex. */ void _mesa_init_vp_per_vertex_registers(GLcontext *ctx) { /* Input registers get initialized from the current vertex attribs */ MEMCPY(ctx->VertexProgram.Inputs, ctx->Current.Attrib, VERT_ATTRIB_MAX * 4 * sizeof(GLfloat)); if (ctx->VertexProgram.Current->IsNVProgram) { GLuint i; /* Output/result regs are initialized to [0,0,0,1] */ for (i = 0; i < MAX_NV_VERTEX_PROGRAM_OUTPUTS; i++) { ASSIGN_4V(ctx->VertexProgram.Outputs[i], 0.0F, 0.0F, 0.0F, 1.0F); } /* Temp regs are initialized to [0,0,0,0] */ for (i = 0; i < MAX_NV_VERTEX_PROGRAM_TEMPS; i++) { ASSIGN_4V(ctx->VertexProgram.Temporaries[i], 0.0F, 0.0F, 0.0F, 0.0F); } ASSIGN_4V(ctx->VertexProgram.AddressReg, 0, 0, 0, 0); } } /** * Copy the 16 elements of a matrix into four consecutive program * registers starting at 'pos'. */ static void load_matrix(GLfloat registers[][4], GLuint pos, const GLfloat mat[16]) { GLuint i; for (i = 0; i < 4; i++) { registers[pos + i][0] = mat[0 + i]; registers[pos + i][1] = mat[4 + i]; registers[pos + i][2] = mat[8 + i]; registers[pos + i][3] = mat[12 + i]; } } /** * As above, but transpose the matrix. */ static void load_transpose_matrix(GLfloat registers[][4], GLuint pos, const GLfloat mat[16]) { MEMCPY(registers[pos], mat, 16 * sizeof(GLfloat)); } /** * Load program parameter registers with tracked matrices (if NV program) * or GL state values (if ARB program). * This needs to be done per glBegin/glEnd, not per-vertex. */ void _mesa_init_vp_per_primitive_registers(GLcontext *ctx) { if (ctx->VertexProgram.Current->IsNVProgram) { GLuint i; for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) { /* point 'mat' at source matrix */ GLmatrix *mat; if (ctx->VertexProgram.TrackMatrix[i] == GL_MODELVIEW) { mat = ctx->ModelviewMatrixStack.Top; } else if (ctx->VertexProgram.TrackMatrix[i] == GL_PROJECTION) { mat = ctx->ProjectionMatrixStack.Top; } else if (ctx->VertexProgram.TrackMatrix[i] == GL_TEXTURE) { mat = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top; } else if (ctx->VertexProgram.TrackMatrix[i] == GL_COLOR) { mat = ctx->ColorMatrixStack.Top; } else if (ctx->VertexProgram.TrackMatrix[i]==GL_MODELVIEW_PROJECTION_NV) { /* XXX verify the combined matrix is up to date */ mat = &ctx->_ModelProjectMatrix; } else if (ctx->VertexProgram.TrackMatrix[i] >= GL_MATRIX0_NV && ctx->VertexProgram.TrackMatrix[i] <= GL_MATRIX7_NV) { GLuint n = ctx->VertexProgram.TrackMatrix[i] - GL_MATRIX0_NV; ASSERT(n < MAX_PROGRAM_MATRICES); mat = ctx->ProgramMatrixStack[n].Top; } else { /* no matrix is tracked, but we leave the register values as-is */ assert(ctx->VertexProgram.TrackMatrix[i] == GL_NONE); continue; } /* load the matrix */ if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_IDENTITY_NV) { load_matrix(ctx->VertexProgram.Parameters, i*4, mat->m); } else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_INVERSE_NV) { _math_matrix_analyse(mat); /* update the inverse */ ASSERT(!_math_matrix_is_dirty(mat)); load_matrix(ctx->VertexProgram.Parameters, i*4, mat->inv); } else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_TRANSPOSE_NV) { load_transpose_matrix(ctx->VertexProgram.Parameters, i*4, mat->m); } else { assert(ctx->VertexProgram.TrackMatrixTransform[i] == GL_INVERSE_TRANSPOSE_NV); _math_matrix_analyse(mat); /* update the inverse */ ASSERT(!_math_matrix_is_dirty(mat)); load_transpose_matrix(ctx->VertexProgram.Parameters, i*4, mat->inv); } } } else { /* Using and ARB vertex program */ if (ctx->VertexProgram.Current->Parameters) { /* Grab the state GL state and put into registers */ _mesa_load_state_parameters(ctx, ctx->VertexProgram.Current->Parameters); } } } /** * For debugging. Dump the current vertex program machine registers. */ void _mesa_dump_vp_state( const struct gl_vertex_program_state *state ) { int i; _mesa_printf("VertexIn:\n"); for (i = 0; i < MAX_NV_VERTEX_PROGRAM_INPUTS; i++) { _mesa_printf("%d: %f %f %f %f ", i, state->Inputs[i][0], state->Inputs[i][1], state->Inputs[i][2], state->Inputs[i][3]); } _mesa_printf("\n"); _mesa_printf("VertexOut:\n"); for (i = 0; i < MAX_NV_VERTEX_PROGRAM_OUTPUTS; i++) { _mesa_printf("%d: %f %f %f %f ", i, state->Outputs[i][0], state->Outputs[i][1], state->Outputs[i][2], state->Outputs[i][3]); } _mesa_printf("\n"); _mesa_printf("Registers:\n"); for (i = 0; i < MAX_NV_VERTEX_PROGRAM_TEMPS; i++) { _mesa_printf("%d: %f %f %f %f ", i, state->Temporaries[i][0], state->Temporaries[i][1], state->Temporaries[i][2], state->Temporaries[i][3]); } _mesa_printf("\n"); _mesa_printf("Parameters:\n"); for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS; i++) { _mesa_printf("%d: %f %f %f %f ", i, state->Parameters[i][0], state->Parameters[i][1], state->Parameters[i][2], state->Parameters[i][3]); } _mesa_printf("\n"); } /** * Return a pointer to the 4-element float vector specified by the given * source register. */ static INLINE const GLfloat * get_register_pointer( const struct vp_src_register *source, const struct gl_vertex_program_state *state ) { if (source->RelAddr) { const GLint reg = source->Index + state->AddressReg[0]; ASSERT( (source->File == PROGRAM_ENV_PARAM) || (source->File == PROGRAM_STATE_VAR) ); if (reg < 0 || reg > MAX_NV_VERTEX_PROGRAM_PARAMS) return ZeroVec; else if (source->File == PROGRAM_ENV_PARAM) return state->Parameters[reg]; else return state->Current->Parameters->ParameterValues[reg]; } else { switch (source->File) { case PROGRAM_TEMPORARY: ASSERT(source->Index < MAX_NV_VERTEX_PROGRAM_TEMPS); return state->Temporaries[source->Index]; case PROGRAM_INPUT: ASSERT(source->Index < MAX_NV_VERTEX_PROGRAM_INPUTS); return state->Inputs[source->Index]; case PROGRAM_OUTPUT: /* This is only needed for the PRINT instruction */ ASSERT(source->Index < MAX_NV_VERTEX_PROGRAM_OUTPUTS); return state->Outputs[source->Index]; case PROGRAM_LOCAL_PARAM: ASSERT(source->Index < MAX_PROGRAM_LOCAL_PARAMS); return state->Current->Base.LocalParams[source->Index]; case PROGRAM_ENV_PARAM: ASSERT(source->Index < MAX_NV_VERTEX_PROGRAM_PARAMS); return state->Parameters[source->Index]; case PROGRAM_STATE_VAR: ASSERT(source->Index < state->Current->Parameters->NumParameters); return state->Current->Parameters->ParameterValues[source->Index]; default: _mesa_problem(NULL, "Bad source register file in get_register_pointer"); return NULL; } } return NULL; } /** * Fetch a 4-element float vector from the given source register. * Apply swizzling and negating as needed. */ static INLINE void fetch_vector4( const struct vp_src_register *source, const struct gl_vertex_program_state *state, GLfloat result[4] ) { const GLfloat *src = get_register_pointer(source, state); if (source->Negate) { result[0] = -src[GET_SWZ(source->Swizzle, 0)]; result[1] = -src[GET_SWZ(source->Swizzle, 1)]; result[2] = -src[GET_SWZ(source->Swizzle, 2)]; result[3] = -src[GET_SWZ(source->Swizzle, 3)]; } else { result[0] = src[GET_SWZ(source->Swizzle, 0)]; result[1] = src[GET_SWZ(source->Swizzle, 1)]; result[2] = src[GET_SWZ(source->Swizzle, 2)]; result[3] = src[GET_SWZ(source->Swizzle, 3)]; } } /** * As above, but only return result[0] element. */ static INLINE void fetch_vector1( const struct vp_src_register *source, const struct gl_vertex_program_state *state, GLfloat result[4] ) { const GLfloat *src = get_register_pointer(source, state); if (source->Negate) { result[0] = -src[GET_SWZ(source->Swizzle, 0)]; } else { result[0] = src[GET_SWZ(source->Swizzle, 0)]; } } /** * Store 4 floats into a register. */ static void store_vector4( const struct vp_dst_register *dest, struct gl_vertex_program_state *state, const GLfloat value[4] ) { GLfloat *dst; switch (dest->File) { case PROGRAM_TEMPORARY: dst = state->Temporaries[dest->Index]; break; case PROGRAM_OUTPUT: dst = state->Outputs[dest->Index]; break; case PROGRAM_ENV_PARAM: { /* a slight hack */ GET_CURRENT_CONTEXT(ctx); dst = ctx->VertexProgram.Parameters[dest->Index]; } break; default: _mesa_problem(NULL, "Invalid register file in store_vector4(file=%d)", dest->File); return; } if (dest->WriteMask & WRITEMASK_X) dst[0] = value[0]; if (dest->WriteMask & WRITEMASK_Y) dst[1] = value[1]; if (dest->WriteMask & WRITEMASK_Z) dst[2] = value[2]; if (dest->WriteMask & WRITEMASK_W) dst[3] = value[3]; } /** * Set x to positive or negative infinity. */ #if defined(USE_IEEE) || defined(_WIN32) #define SET_POS_INFINITY(x) ( *((GLuint *) (void *)&x) = 0x7F800000 ) #define SET_NEG_INFINITY(x) ( *((GLuint *) (void *)&x) = 0xFF800000 ) #elif defined(VMS) #define SET_POS_INFINITY(x) x = __MAXFLOAT #define SET_NEG_INFINITY(x) x = -__MAXFLOAT #else #define SET_POS_INFINITY(x) x = (GLfloat) HUGE_VAL #define SET_NEG_INFINITY(x) x = (GLfloat) -HUGE_VAL #endif #define SET_FLOAT_BITS(x, bits) ((fi_type *) (void *) &(x))->i = bits /** * Execute the given vertex program */ void _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program) { struct gl_vertex_program_state *state = &ctx->VertexProgram; const struct vp_instruction *inst; ctx->_CurrentProgram = GL_VERTEX_PROGRAM_ARB; /* or NV, doesn't matter */ /* If the program is position invariant, multiply the input * position and the MVP matrix and stick it into the output pos slot */ if (ctx->VertexProgram.Current->IsPositionInvariant) { TRANSFORM_POINT( ctx->VertexProgram.Outputs[0], ctx->_ModelProjectMatrix.m, ctx->VertexProgram.Inputs[0]); /* XXX: This could go elsewhere */ ctx->VertexProgram.Current->OutputsWritten |= 0x1; } for (inst = program->Instructions; ; inst++) { if (ctx->VertexProgram.CallbackEnabled && ctx->VertexProgram.Callback) { ctx->VertexProgram.CurrentPosition = inst->StringPos; ctx->VertexProgram.Callback(program->Base.Target, ctx->VertexProgram.CallbackData); } switch (inst->Opcode) { case VP_OPCODE_MOV: { GLfloat t[4]; fetch_vector4( &inst->SrcReg[0], state, t ); store_vector4( &inst->DstReg, state, t ); } break; case VP_OPCODE_LIT: { const GLfloat epsilon = 1.0F / 256.0F; /* per NV spec */ GLfloat t[4], lit[4]; fetch_vector4( &inst->SrcReg[0], state, t ); t[0] = MAX2(t[0], 0.0F); t[1] = MAX2(t[1], 0.0F); t[3] = CLAMP(t[3], -(128.0F - epsilon), (128.0F - epsilon)); lit[0] = 1.0; lit[1] = t[0]; lit[2] = (t[0] > 0.0) ? (GLfloat) _mesa_pow(t[1], t[3]) : 0.0F; lit[3] = 1.0; store_vector4( &inst->DstReg, state, lit ); } break; case VP_OPCODE_RCP: { GLfloat t[4]; fetch_vector1( &inst->SrcReg[0], state, t ); if (t[0] != 1.0F) t[0] = 1.0F / t[0]; /* div by zero is infinity! */ t[1] = t[2] = t[3] = t[0]; store_vector4( &inst->DstReg, state, t ); } break; case VP_OPCODE_RSQ: { GLfloat t[4]; fetch_vector1( &inst->SrcReg[0], state, t ); t[0] = INV_SQRTF(FABSF(t[0])); t[1] = t[2] = t[3] = t[0]; store_vector4( &inst->DstReg, state, t ); } break; case VP_OPCODE_EXP: { GLfloat t[4], q[4], floor_t0; fetch_vector1( &inst->SrcReg[0], state, t ); floor_t0 = (float) floor(t[0]); if (floor_t0 > FLT_MAX_EXP) { SET_POS_INFINITY(q[0]); SET_POS_INFINITY(q[2]); } else if (floor_t0 < FLT_MIN_EXP) { q[0] = 0.0F; q[2] = 0.0F; } else { #ifdef USE_IEEE GLint ii = (GLint) floor_t0; ii = (ii < 23) + 0x3f800000; SET_FLOAT_BITS(q[0], ii); q[0] = *((GLfloat *) (void *)&ii); #else q[0] = (GLfloat) pow(2.0, floor_t0); #endif q[2] = (GLfloat) (q[0] * LOG2(q[1])); } q[1] = t[0] - floor_t0; q[3] = 1.0F; store_vector4( &inst->DstReg, state, q ); } break; case VP_OPCODE_LOG: { GLfloat t[4], q[4], abs_t0; fetch_vector1( &inst->SrcReg[0], state, t ); abs_t0 = (GLfloat) fabs(t[0]); if (abs_t0 != 0.0F) { /* Since we really can't handle infinite values on VMS * like other OSes we'll use __MAXFLOAT to represent * infinity. This may need some tweaking. */ #ifdef VMS if (abs_t0 == __MAXFLOAT) #else if (IS_INF_OR_NAN(abs_t0)) #endif { SET_POS_INFINITY(q[0]); q[1] = 1.0F; SET_POS_INFINITY(q[2]); } else { int exponent; double mantissa = frexp(t[0], &exponent); q[0] = (GLfloat) (exponent - 1); q[1] = (GLfloat) (2.0 * mantissa); /* map [.5, 1) -> [1, 2) */ q[2] = (GLfloat) (q[0] + LOG2(q[1])); } } else { SET_NEG_INFINITY(q[0]); q[1] = 1.0F; SET_NEG_INFINITY(q[2]); } q[3] = 1.0; store_vector4( &inst->DstReg, state, q ); } break; case VP_OPCODE_MUL: { GLfloat t[4], u[4], prod[4]; fetch_vector4( &inst->SrcReg[0], state, t ); fetch_vector4( &inst->SrcReg[1], state, u ); prod[0] = t[0] * u[0]; prod[1] = t[1] * u[1]; prod[2] = t[2] * u[2]; prod[3] = t[3] * u[3]; store_vector4( &inst->DstReg, state, prod ); } break; case VP_OPCODE_ADD: { GLfloat t[4], u[4], sum[4]; fetch_vector4( &inst->SrcReg[0], state, t ); fetch_vector4( &inst->SrcReg[1], state, u ); sum[0] = t[0] + u[0]; sum[1] = t[1] + u[1]; sum[2] = t[2] + u[2]; sum[3] = t[3] + u[3]; store_vector4( &inst->DstReg, state, sum ); } break; case VP_OPCODE_DP3: { GLfloat t[4], u[4], dot[4]; fetch_vector4( &inst->SrcReg[0], state, t ); fetch_vector4( &inst->SrcReg[1], state, u ); dot[0] = t[0] * u[0] + t[1] * u[1] + t[2] * u[2]; dot[1] = dot[2] = dot[3] = dot[0]; store_vector4( &inst->DstReg, state, dot ); } break; case VP_OPCODE_DP4: { GLfloat t[4], u[4], dot[4]; fetch_vector4( &inst->SrcReg[0], state, t ); fetch_vector4( &inst->SrcReg[1], state, u ); dot[0] = t[0] * u[0] + t[1] * u[1] + t[2] * u[2] + t[3] * u[3]; dot[1] = dot[2] = dot[3] = dot[0]; store_vector4( &inst->DstReg, state, dot ); } break; case VP_OPCODE_DST: { GLfloat t[4], u[4], dst[4]; fetch_vector4( &inst->SrcReg[0], state, t ); fetch_vector4( &inst->SrcReg[1], state, u ); dst[0] = 1.0F; dst[1] = t[1] * u[1]; dst[2] = t[2]; dst[3] = u[3]; store_vector4( &inst->DstReg, state, dst ); } break; case VP_OPCODE_MIN: { GLfloat t[4], u[4], min[4]; fetch_vector4( &inst->SrcReg[0], state, t ); fetch_vector4( &inst->SrcReg[1], state, u ); min[0] = (t[0] < u[0]) ? t[0] : u[0]; min[1] = (t[1] < u[1]) ? t[1] : u[1]; min[2] = (t[2] < u[2]) ? t[2] : u[2]; min[3] = (t[3] < u[3]) ? t[3] : u[3]; store_vector4( &inst->DstReg, state, min ); } break; case VP_OPCODE_MAX: { GLfloat t[4], u[4], max[4]; fetch_vector4( &inst->SrcReg[0], state, t ); fetch_vector4( &inst->SrcReg[1], state, u ); max[0] = (t[0] > u[0]) ? t[0] : u[0]; max[1] = (t[1] > u[1]) ? t[1] : u[1]; max[2] = (t[2] > u[2]) ? t[2] : u[2]; max[3] = (t[3] > u[3]) ? t[3] : u[3]; store_vector4( &inst->DstReg, state, max ); } break; case VP_OPCODE_SLT: { GLfloat t[4], u[4], slt[4]; fetch_vector4( &inst->SrcReg[0], state, t ); fetch_vector4( &inst->SrcReg[1], state, u ); slt[0] = (t[0] < u[0]) ? 1.0F : 0.0F; slt[1] = (t[1] < u[1]) ? 1.0F : 0.0F; slt[2] = (t[2] < u[2]) ? 1.0F : 0.0F; slt[3] = (t[3] < u[3]) ? 1.0F : 0.0F; store_vector4( &inst->DstReg, state, slt ); } break; case VP_OPCODE_SGE: { GLfloat t[4], u[4], sge[4]; fetch_vector4( &inst->SrcReg[0], state, t ); fetch_vector4( &inst->SrcReg[1], state, u ); sge[0] = (t[0] >= u[0]) ? 1.0F : 0.0F; sge[1] = (t[1] >= u[1]) ? 1.0F : 0.0F; sge[2] = (t[2] >= u[2]) ? 1.0F : 0.0F; sge[3] = (t[3] >= u[3]) ? 1.0F : 0.0F; store_vector4( &inst->DstReg, state, sge ); } break; case VP_OPCODE_MAD: { GLfloat t[4], u[4], v[4], sum[4]; fetch_vector4( &inst->SrcReg[0], state, t ); fetch_vector4( &inst->SrcReg[1], state, u ); fetch_vector4( &inst->SrcReg[2], state, v ); sum[0] = t[0] * u[0] + v[0]; sum[1] = t[1] * u[1] + v[1]; sum[2] = t[2] * u[2] + v[2]; sum[3] = t[3] * u[3] + v[3]; store_vector4( &inst->DstReg, state, sum ); } break; case VP_OPCODE_ARL: { GLfloat t[4]; fetch_vector4( &inst->SrcReg[0], state, t ); state->AddressReg[0] = (GLint) floor(t[0]); } break; case VP_OPCODE_DPH: { GLfloat t[4], u[4], dot[4]; fetch_vector4( &inst->SrcReg[0], state, t ); fetch_vector4( &inst->SrcReg[1], state, u ); dot[0] = t[0] * u[0] + t[1] * u[1] + t[2] * u[2] + u[3]; dot[1] = dot[2] = dot[3] = dot[0]; store_vector4( &inst->DstReg, state, dot ); } break; case VP_OPCODE_RCC: { GLfloat t[4], u; fetch_vector1( &inst->SrcReg[0], state, t ); if (t[0] == 1.0F) u = 1.0F; else u = 1.0F / t[0]; if (u > 0.0F) { if (u > 1.884467e+019F) { u = 1.884467e+019F; /* IEEE 32-bit binary value 0x5F800000 */ } else if (u < 5.42101e-020F) { u = 5.42101e-020F; /* IEEE 32-bit binary value 0x1F800000 */ } } else { if (u < -1.884467e+019F) { u = -1.884467e+019F; /* IEEE 32-bit binary value 0xDF800000 */ } else if (u > -5.42101e-020F) { u = -5.42101e-020F; /* IEEE 32-bit binary value 0x9F800000 */ } } t[0] = t[1] = t[2] = t[3] = u; store_vector4( &inst->DstReg, state, t ); } break; case VP_OPCODE_SUB: /* GL_NV_vertex_program1_1 */ { GLfloat t[4], u[4], sum[4]; fetch_vector4( &inst->SrcReg[0], state, t ); fetch_vector4( &inst->SrcReg[1], state, u ); sum[0] = t[0] - u[0]; sum[1] = t[1] - u[1]; sum[2] = t[2] - u[2]; sum[3] = t[3] - u[3]; store_vector4( &inst->DstReg, state, sum ); } break; case VP_OPCODE_ABS: /* GL_NV_vertex_program1_1 */ { GLfloat t[4]; fetch_vector4( &inst->SrcReg[0], state, t ); if (t[0] < 0.0) t[0] = -t[0]; if (t[1] < 0.0) t[1] = -t[1]; if (t[2] < 0.0) t[2] = -t[2]; if (t[3] < 0.0) t[3] = -t[3]; store_vector4( &inst->DstReg, state, t ); } break; case VP_OPCODE_FLR: /* GL_ARB_vertex_program */ { GLfloat t[4]; fetch_vector4( &inst->SrcReg[0], state, t ); t[0] = FLOORF(t[0]); t[1] = FLOORF(t[1]); t[2] = FLOORF(t[2]); t[3] = FLOORF(t[3]); store_vector4( &inst->DstReg, state, t ); } break; case VP_OPCODE_FRC: /* GL_ARB_vertex_program */ { GLfloat t[4]; fetch_vector4( &inst->SrcReg[0], state, t ); t[0] = t[0] - FLOORF(t[0]); t[1] = t[1] - FLOORF(t[1]); t[2] = t[2] - FLOORF(t[2]); t[3] = t[3] - FLOORF(t[3]); store_vector4( &inst->DstReg, state, t ); } break; case VP_OPCODE_EX2: /* GL_ARB_vertex_program */ { GLfloat t[4]; fetch_vector1( &inst->SrcReg[0], state, t ); t[0] = t[1] = t[2] = t[3] = (GLfloat)_mesa_pow(2.0, t[0]); store_vector4( &inst->DstReg, state, t ); } break; case VP_OPCODE_LG2: /* GL_ARB_vertex_program */ { GLfloat t[4]; fetch_vector1( &inst->SrcReg[0], state, t ); t[0] = t[1] = t[2] = t[3] = LOG2(t[0]); store_vector4( &inst->DstReg, state, t ); } break; case VP_OPCODE_POW: /* GL_ARB_vertex_program */ { GLfloat t[4], u[4]; fetch_vector1( &inst->SrcReg[0], state, t ); fetch_vector1( &inst->SrcReg[1], state, u ); t[0] = t[1] = t[2] = t[3] = (GLfloat)_mesa_pow(t[0], u[0]); store_vector4( &inst->DstReg, state, t ); } break; case VP_OPCODE_XPD: /* GL_ARB_vertex_program */ { GLfloat t[4], u[4], cross[4]; fetch_vector4( &inst->SrcReg[0], state, t ); fetch_vector4( &inst->SrcReg[1], state, u ); cross[0] = t[1] * u[2] - t[2] * u[1]; cross[1] = t[2] * u[0] - t[0] * u[2]; cross[2] = t[0] * u[1] - t[1] * u[0]; store_vector4( &inst->DstReg, state, cross ); } break; case VP_OPCODE_SWZ: /* GL_ARB_vertex_program */ { const struct vp_src_register *source = &inst->SrcReg[0]; const GLfloat *src = get_register_pointer(source, state); GLfloat result[4]; GLuint i; /* do extended swizzling here */ for (i = 0; i < 4; i++) { if (GET_SWZ(source->Swizzle, i) == SWIZZLE_ZERO) result[i] = 0.0; else if (GET_SWZ(source->Swizzle, i) == SWIZZLE_ONE) result[i] = 1.0; else result[i] = src[GET_SWZ(source->Swizzle, i)]; if (source->Negate & (1 << i)) result[i] = -result[i]; } store_vector4( &inst->DstReg, state, result ); } break; case VP_OPCODE_PRINT: if (inst->SrcReg[0].File) { GLfloat t[4]; fetch_vector4( &inst->SrcReg[0], state, t ); _mesa_printf("%s%g, %g, %g, %g\n", (char *) inst->Data, t[0], t[1], t[2], t[3]); } else { _mesa_printf("%s\n", (char *) inst->Data); } break; case VP_OPCODE_END: ctx->_CurrentProgram = 0; return; default: /* bad instruction opcode */ _mesa_problem(ctx, "Bad VP Opcode in _mesa_exec_vertex_program"); ctx->_CurrentProgram = 0; return; } /* switch */ } /* for */ ctx->_CurrentProgram = 0; } /** Thoughts on vertex program optimization: The obvious thing to do is to compile the vertex program into X86/SSE/3DNow! assembly code. That will probably be a lot of work. Another approach might be to replace the vp_instruction->Opcode field with a pointer to a specialized C function which executes the instruction. In particular we can write functions which skip swizzling, negating, masking, relative addressing, etc. when they're not needed. For example: void simple_add( struct vp_instruction *inst ) { GLfloat *sum = machine->Registers[inst->DstReg.Register]; GLfloat *a = machine->Registers[inst->SrcReg[0].Register]; GLfloat *b = machine->Registers[inst->SrcReg[1].Register]; sum[0] = a[0] + b[0]; sum[1] = a[1] + b[1]; sum[2] = a[2] + b[2]; sum[3] = a[3] + b[3]; } */ /* KW: A first step would be to 'vectorize' the programs in the same way as the normal transformation code in the tnl module. Thus each opcode takes zero or more input vectors (registers) and produces one or more output vectors. These operations would intially be coded in C, with machine-specific assembly following, as is currently the case for matrix transformations in the math/ directory. The preprocessing scheme for selecting simpler operations Brian describes above would also work here. This should give reasonable performance without excessive effort. */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/nvvertexec.h0000644000000000000000000000303013614532424021021 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Brian Paul */ #ifndef NVVERTEXEC_H #define NVVERTEXEC_H extern void _mesa_init_vp_per_vertex_registers(GLcontext *ctx); extern void _mesa_init_vp_per_primitive_registers(GLcontext *ctx); extern void _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program); extern void _mesa_dump_vp_state( const struct gl_vertex_program_state *state ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/nvvertparse.c0000644000000000000000000012605613614532424021220 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file nvvertparse.c * NVIDIA vertex program parser. * \author Brian Paul */ /* * Regarding GL_NV_vertex_program, GL_NV_vertex_program1_1: * * Portions of this software may use or implement intellectual * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims * any and all warranties with respect to such intellectual property, * including any use thereof or modifications thereto. */ #include "glheader.h" #include "context.h" #include "hash.h" #include "imports.h" #include "macros.h" #include "mtypes.h" #include "nvprogram.h" #include "nvvertparse.h" #include "nvvertprog.h" #include "program.h" /** * Current parsing state. This structure is passed among the parsing * functions and keeps track of the current parser position and various * program attributes. */ struct parse_state { GLcontext *ctx; const GLubyte *start; const GLubyte *pos; const GLubyte *curLine; GLboolean isStateProgram; GLboolean isPositionInvariant; GLboolean isVersion1_1; GLuint inputsRead; GLuint outputsWritten; GLboolean anyProgRegsWritten; GLuint numInst; /* number of instructions parsed */ }; /* * Called whenever we find an error during parsing. */ static void record_error(struct parse_state *parseState, const char *msg, int lineNo) { #ifdef DEBUG GLint line, column; const GLubyte *lineStr; lineStr = _mesa_find_line_column(parseState->start, parseState->pos, &line, &column); _mesa_debug(parseState->ctx, "nvfragparse.c(%d): line %d, column %d:%s (%s)\n", lineNo, line, column, (char *) lineStr, msg); _mesa_free((void *) lineStr); #else (void) lineNo; #endif /* Check that no error was already recorded. Only record the first one. */ if (parseState->ctx->Program.ErrorString[0] == 0) { _mesa_set_program_error(parseState->ctx, parseState->pos - parseState->start, msg); } } #define RETURN_ERROR \ do { \ record_error(parseState, "Unexpected end of input.", __LINE__); \ return GL_FALSE; \ } while(0) #define RETURN_ERROR1(msg) \ do { \ record_error(parseState, msg, __LINE__); \ return GL_FALSE; \ } while(0) #define RETURN_ERROR2(msg1, msg2) \ do { \ char err[1000]; \ _mesa_sprintf(err, "%s %s", msg1, msg2); \ record_error(parseState, err, __LINE__); \ return GL_FALSE; \ } while(0) static GLboolean IsLetter(GLubyte b) { return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z'); } static GLboolean IsDigit(GLubyte b) { return b >= '0' && b <= '9'; } static GLboolean IsWhitespace(GLubyte b) { return b == ' ' || b == '\t' || b == '\n' || b == '\r'; } /** * Starting at 'str' find the next token. A token can be an integer, * an identifier or punctuation symbol. * \return <= 0 we found an error, else, return number of characters parsed. */ static GLint GetToken(struct parse_state *parseState, GLubyte *token) { const GLubyte *str = parseState->pos; GLint i = 0, j = 0; token[0] = 0; /* skip whitespace and comments */ while (str[i] && (IsWhitespace(str[i]) || str[i] == '#')) { if (str[i] == '#') { /* skip comment */ while (str[i] && (str[i] != '\n' && str[i] != '\r')) { i++; } if (str[i] == '\n' || str[i] == '\r') parseState->curLine = str + i + 1; } else { /* skip whitespace */ if (str[i] == '\n' || str[i] == '\r') parseState->curLine = str + i + 1; i++; } } if (str[i] == 0) return -i; /* try matching an integer */ while (str[i] && IsDigit(str[i])) { token[j++] = str[i++]; } if (j > 0 || !str[i]) { token[j] = 0; return i; } /* try matching an identifier */ if (IsLetter(str[i])) { while (str[i] && (IsLetter(str[i]) || IsDigit(str[i]))) { token[j++] = str[i++]; } token[j] = 0; return i; } /* punctuation character */ if (str[i]) { token[0] = str[i++]; token[1] = 0; return i; } /* end of input */ token[0] = 0; return i; } /** * Get next token from input stream and increment stream pointer past token. */ static GLboolean Parse_Token(struct parse_state *parseState, GLubyte *token) { GLint i; i = GetToken(parseState, token); if (i <= 0) { parseState->pos += (-i); return GL_FALSE; } parseState->pos += i; return GL_TRUE; } /** * Get next token from input stream but don't increment stream pointer. */ static GLboolean Peek_Token(struct parse_state *parseState, GLubyte *token) { GLint i, len; i = GetToken(parseState, token); if (i <= 0) { parseState->pos += (-i); return GL_FALSE; } len = (GLint)_mesa_strlen((const char *) token); parseState->pos += (i - len); return GL_TRUE; } /** * Try to match 'pattern' as the next token after any whitespace/comments. * Advance the current parsing position only if we match the pattern. * \return GL_TRUE if pattern is matched, GL_FALSE otherwise. */ static GLboolean Parse_String(struct parse_state *parseState, const char *pattern) { const GLubyte *m; GLint i; /* skip whitespace and comments */ while (IsWhitespace(*parseState->pos) || *parseState->pos == '#') { if (*parseState->pos == '#') { while (*parseState->pos && (*parseState->pos != '\n' && *parseState->pos != '\r')) { parseState->pos += 1; } if (*parseState->pos == '\n' || *parseState->pos == '\r') parseState->curLine = parseState->pos + 1; } else { /* skip whitespace */ if (*parseState->pos == '\n' || *parseState->pos == '\r') parseState->curLine = parseState->pos + 1; parseState->pos += 1; } } /* Try to match the pattern */ m = parseState->pos; for (i = 0; pattern[i]; i++) { if (*m != (GLubyte) pattern[i]) return GL_FALSE; m += 1; } parseState->pos = m; return GL_TRUE; /* success */ } /**********************************************************************/ static const char *InputRegisters[MAX_NV_VERTEX_PROGRAM_INPUTS + 1] = { "OPOS", "WGHT", "NRML", "COL0", "COL1", "FOGC", "6", "7", "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL }; static const char *OutputRegisters[MAX_NV_VERTEX_PROGRAM_OUTPUTS + 1] = { "HPOS", "COL0", "COL1", "BFC0", "BFC1", "FOGC", "PSIZ", "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL }; /* NOTE: the order here must match opcodes in nvvertprog.h */ static const char *Opcodes[] = { "MOV", "LIT", "RCP", "RSQ", "EXP", "LOG", "MUL", "ADD", "DP3", "DP4", "DST", "MIN", "MAX", "SLT", "SGE", "MAD", "ARL", "DPH", "RCC", "SUB", "ABS", "END", /* GL_ARB_vertex_program */ "FLR", "FRC", "EX2", "LG2", "POW", "XPD", "SWZ", /* Mesa-specific */ "PRINT", NULL }; /** * Parse a temporary register: Rnn */ static GLboolean Parse_TempReg(struct parse_state *parseState, GLint *tempRegNum) { GLubyte token[100]; /* Should be 'R##' */ if (!Parse_Token(parseState, token)) RETURN_ERROR; if (token[0] != 'R') RETURN_ERROR1("Expected R##"); if (IsDigit(token[1])) { GLint reg = _mesa_atoi((char *) (token + 1)); if (reg >= MAX_NV_VERTEX_PROGRAM_TEMPS) RETURN_ERROR1("Bad temporary register name"); *tempRegNum = reg; } else { RETURN_ERROR1("Bad temporary register name"); } return GL_TRUE; } /** * Parse address register "A0.x" */ static GLboolean Parse_AddrReg(struct parse_state *parseState) { /* match 'A0' */ if (!Parse_String(parseState, "A0")) RETURN_ERROR; /* match '.' */ if (!Parse_String(parseState, ".")) RETURN_ERROR; /* match 'x' */ if (!Parse_String(parseState, "x")) RETURN_ERROR; return GL_TRUE; } /** * Parse absolute program parameter register "c[##]" */ static GLboolean Parse_AbsParamReg(struct parse_state *parseState, GLint *regNum) { GLubyte token[100]; if (!Parse_String(parseState, "c")) RETURN_ERROR; if (!Parse_String(parseState, "[")) RETURN_ERROR; if (!Parse_Token(parseState, token)) RETURN_ERROR; if (IsDigit(token[0])) { /* a numbered program parameter register */ GLint reg = _mesa_atoi((char *) token); if (reg >= MAX_NV_VERTEX_PROGRAM_PARAMS) RETURN_ERROR1("Bad program parameter number"); *regNum = reg; } else { RETURN_ERROR; } if (!Parse_String(parseState, "]")) RETURN_ERROR; return GL_TRUE; } static GLboolean Parse_ParamReg(struct parse_state *parseState, struct vp_src_register *srcReg) { GLubyte token[100]; if (!Parse_String(parseState, "c")) RETURN_ERROR; if (!Parse_String(parseState, "[")) RETURN_ERROR; if (!Peek_Token(parseState, token)) RETURN_ERROR; if (IsDigit(token[0])) { /* a numbered program parameter register */ GLint reg; (void) Parse_Token(parseState, token); reg = _mesa_atoi((char *) token); if (reg >= MAX_NV_VERTEX_PROGRAM_PARAMS) RETURN_ERROR1("Bad program parameter number"); srcReg->File = PROGRAM_ENV_PARAM; srcReg->Index = reg; } else if (_mesa_strcmp((const char *) token, "A0") == 0) { /* address register "A0.x" */ if (!Parse_AddrReg(parseState)) RETURN_ERROR; srcReg->RelAddr = GL_TRUE; srcReg->File = PROGRAM_ENV_PARAM; /* Look for +/-N offset */ if (!Peek_Token(parseState, token)) RETURN_ERROR; if (token[0] == '-' || token[0] == '+') { const GLubyte sign = token[0]; (void) Parse_Token(parseState, token); /* consume +/- */ /* an integer should be next */ if (!Parse_Token(parseState, token)) RETURN_ERROR; if (IsDigit(token[0])) { const GLint k = _mesa_atoi((char *) token); if (sign == '-') { if (k > 64) RETURN_ERROR1("Bad address offset"); srcReg->Index = -k; } else { if (k > 63) RETURN_ERROR1("Bad address offset"); srcReg->Index = k; } } else { RETURN_ERROR; } } else { /* probably got a ']', catch it below */ } } else { RETURN_ERROR; } /* Match closing ']' */ if (!Parse_String(parseState, "]")) RETURN_ERROR; return GL_TRUE; } /** * Parse v[#] or v[] */ static GLboolean Parse_AttribReg(struct parse_state *parseState, GLint *tempRegNum) { GLubyte token[100]; GLint j; /* Match 'v' */ if (!Parse_String(parseState, "v")) RETURN_ERROR; /* Match '[' */ if (!Parse_String(parseState, "[")) RETURN_ERROR; /* match number or named register */ if (!Parse_Token(parseState, token)) RETURN_ERROR; if (parseState->isStateProgram && token[0] != '0') RETURN_ERROR1("Only v[0] accessible in vertex state programs"); if (IsDigit(token[0])) { GLint reg = _mesa_atoi((char *) token); if (reg >= MAX_NV_VERTEX_PROGRAM_INPUTS) RETURN_ERROR1("Bad vertex attribute register name"); *tempRegNum = reg; } else { for (j = 0; InputRegisters[j]; j++) { if (_mesa_strcmp((const char *) token, InputRegisters[j]) == 0) { *tempRegNum = j; break; } } if (!InputRegisters[j]) { /* unknown input register label */ RETURN_ERROR2("Bad register name", token); } } /* Match '[' */ if (!Parse_String(parseState, "]")) RETURN_ERROR; return GL_TRUE; } static GLboolean Parse_OutputReg(struct parse_state *parseState, GLint *outputRegNum) { GLubyte token[100]; GLint start, j; /* Match 'o' */ if (!Parse_String(parseState, "o")) RETURN_ERROR; /* Match '[' */ if (!Parse_String(parseState, "[")) RETURN_ERROR; /* Get output reg name */ if (!Parse_Token(parseState, token)) RETURN_ERROR; if (parseState->isPositionInvariant) start = 1; /* skip HPOS register name */ else start = 0; /* try to match an output register name */ for (j = start; OutputRegisters[j]; j++) { if (_mesa_strcmp((const char *) token, OutputRegisters[j]) == 0) { *outputRegNum = j; break; } } if (!OutputRegisters[j]) RETURN_ERROR1("Unrecognized output register name"); /* Match ']' */ if (!Parse_String(parseState, "]")) RETURN_ERROR1("Expected ]"); return GL_TRUE; } static GLboolean Parse_MaskedDstReg(struct parse_state *parseState, struct vp_dst_register *dstReg) { GLubyte token[100]; GLint idx; /* Dst reg can be R or o[n] */ if (!Peek_Token(parseState, token)) RETURN_ERROR; if (token[0] == 'R') { /* a temporary register */ dstReg->File = PROGRAM_TEMPORARY; if (!Parse_TempReg(parseState, &idx)) RETURN_ERROR; dstReg->Index = idx; } else if (!parseState->isStateProgram && token[0] == 'o') { /* an output register */ dstReg->File = PROGRAM_OUTPUT; if (!Parse_OutputReg(parseState, &idx)) RETURN_ERROR; dstReg->Index = idx; } else if (parseState->isStateProgram && token[0] == 'c' && parseState->isStateProgram) { /* absolute program parameter register */ /* Only valid for vertex state programs */ dstReg->File = PROGRAM_ENV_PARAM; if (!Parse_AbsParamReg(parseState, &idx)) RETURN_ERROR; dstReg->Index = idx; } else { RETURN_ERROR1("Bad destination register name"); } /* Parse optional write mask */ if (!Peek_Token(parseState, token)) RETURN_ERROR; if (token[0] == '.') { /* got a mask */ GLint k = 0; if (!Parse_String(parseState, ".")) RETURN_ERROR; if (!Parse_Token(parseState, token)) RETURN_ERROR; dstReg->WriteMask = 0; if (token[k] == 'x') { dstReg->WriteMask |= WRITEMASK_X; k++; } if (token[k] == 'y') { dstReg->WriteMask |= WRITEMASK_Y; k++; } if (token[k] == 'z') { dstReg->WriteMask |= WRITEMASK_Z; k++; } if (token[k] == 'w') { dstReg->WriteMask |= WRITEMASK_W; k++; } if (k == 0) { RETURN_ERROR1("Bad writemask character"); } return GL_TRUE; } else { dstReg->WriteMask = WRITEMASK_XYZW; return GL_TRUE; } } static GLboolean Parse_SwizzleSrcReg(struct parse_state *parseState, struct vp_src_register *srcReg) { GLubyte token[100]; GLint idx; srcReg->RelAddr = GL_FALSE; /* check for '-' */ if (!Peek_Token(parseState, token)) RETURN_ERROR; if (token[0] == '-') { (void) Parse_String(parseState, "-"); srcReg->Negate = GL_TRUE; if (!Peek_Token(parseState, token)) RETURN_ERROR; } else { srcReg->Negate = GL_FALSE; } /* Src reg can be R, c[n], c[n +/- offset], or a named vertex attrib */ if (token[0] == 'R') { srcReg->File = PROGRAM_TEMPORARY; if (!Parse_TempReg(parseState, &idx)) RETURN_ERROR; srcReg->Index = idx; } else if (token[0] == 'c') { if (!Parse_ParamReg(parseState, srcReg)) RETURN_ERROR; } else if (token[0] == 'v') { srcReg->File = PROGRAM_INPUT; if (!Parse_AttribReg(parseState, &idx)) RETURN_ERROR; srcReg->Index = idx; } else { RETURN_ERROR2("Bad source register name", token); } /* init swizzle fields */ srcReg->Swizzle = SWIZZLE_NOOP; /* Look for optional swizzle suffix */ if (!Peek_Token(parseState, token)) RETURN_ERROR; if (token[0] == '.') { (void) Parse_String(parseState, "."); /* consume . */ if (!Parse_Token(parseState, token)) RETURN_ERROR; if (token[1] == 0) { /* single letter swizzle */ if (token[0] == 'x') srcReg->Swizzle = MAKE_SWIZZLE4(0, 0, 0, 0); else if (token[0] == 'y') srcReg->Swizzle = MAKE_SWIZZLE4(1, 1, 1, 1); else if (token[0] == 'z') srcReg->Swizzle = MAKE_SWIZZLE4(2, 2, 2, 2); else if (token[0] == 'w') srcReg->Swizzle = MAKE_SWIZZLE4(3, 3, 3, 3); else RETURN_ERROR1("Expected x, y, z, or w"); } else { /* 2, 3 or 4-component swizzle */ GLint k; for (k = 0; token[k] && k < 5; k++) { if (token[k] == 'x') srcReg->Swizzle |= 0 << (k*3); else if (token[k] == 'y') srcReg->Swizzle |= 1 << (k*3); else if (token[k] == 'z') srcReg->Swizzle |= 2 << (k*3); else if (token[k] == 'w') srcReg->Swizzle |= 3 << (k*3); else RETURN_ERROR; } if (k >= 5) RETURN_ERROR; } } return GL_TRUE; } static GLboolean Parse_ScalarSrcReg(struct parse_state *parseState, struct vp_src_register *srcReg) { GLubyte token[100]; GLint idx; srcReg->RelAddr = GL_FALSE; /* check for '-' */ if (!Peek_Token(parseState, token)) RETURN_ERROR; if (token[0] == '-') { srcReg->Negate = GL_TRUE; (void) Parse_String(parseState, "-"); /* consume '-' */ if (!Peek_Token(parseState, token)) RETURN_ERROR; } else { srcReg->Negate = GL_FALSE; } /* Src reg can be R, c[n], c[n +/- offset], or a named vertex attrib */ if (token[0] == 'R') { srcReg->File = PROGRAM_TEMPORARY; if (!Parse_TempReg(parseState, &idx)) RETURN_ERROR; srcReg->Index = idx; } else if (token[0] == 'c') { if (!Parse_ParamReg(parseState, srcReg)) RETURN_ERROR; } else if (token[0] == 'v') { srcReg->File = PROGRAM_INPUT; if (!Parse_AttribReg(parseState, &idx)) RETURN_ERROR; srcReg->Index = idx; } else { RETURN_ERROR2("Bad source register name", token); } /* Look for .[xyzw] suffix */ if (!Parse_String(parseState, ".")) RETURN_ERROR; if (!Parse_Token(parseState, token)) RETURN_ERROR; if (token[0] == 'x' && token[1] == 0) { srcReg->Swizzle = 0; } else if (token[0] == 'y' && token[1] == 0) { srcReg->Swizzle = 1; } else if (token[0] == 'z' && token[1] == 0) { srcReg->Swizzle = 2; } else if (token[0] == 'w' && token[1] == 0) { srcReg->Swizzle = 3; } else { RETURN_ERROR1("Bad scalar source suffix"); } return GL_TRUE; } static GLint Parse_UnaryOpInstruction(struct parse_state *parseState, struct vp_instruction *inst, enum vp_opcode opcode) { if (opcode == VP_OPCODE_ABS && !parseState->isVersion1_1) RETURN_ERROR1("ABS illegal for vertex program 1.0"); inst->Opcode = opcode; inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) RETURN_ERROR; /* comma */ if (!Parse_String(parseState, ",")) RETURN_ERROR; /* src arg */ if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0])) RETURN_ERROR; /* semicolon */ if (!Parse_String(parseState, ";")) RETURN_ERROR; return GL_TRUE; } static GLboolean Parse_BiOpInstruction(struct parse_state *parseState, struct vp_instruction *inst, enum vp_opcode opcode) { if (opcode == VP_OPCODE_DPH && !parseState->isVersion1_1) RETURN_ERROR1("DPH illegal for vertex program 1.0"); if (opcode == VP_OPCODE_SUB && !parseState->isVersion1_1) RETURN_ERROR1("SUB illegal for vertex program 1.0"); inst->Opcode = opcode; inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) RETURN_ERROR; /* comma */ if (!Parse_String(parseState, ",")) RETURN_ERROR; /* first src arg */ if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0])) RETURN_ERROR; /* comma */ if (!Parse_String(parseState, ",")) RETURN_ERROR; /* second src arg */ if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[1])) RETURN_ERROR; /* semicolon */ if (!Parse_String(parseState, ";")) RETURN_ERROR; /* make sure we don't reference more than one program parameter register */ if (inst->SrcReg[0].File == PROGRAM_ENV_PARAM && inst->SrcReg[1].File == PROGRAM_ENV_PARAM && inst->SrcReg[0].Index != inst->SrcReg[1].Index) RETURN_ERROR1("Can't reference two program parameter registers"); /* make sure we don't reference more than one vertex attribute register */ if (inst->SrcReg[0].File == PROGRAM_INPUT && inst->SrcReg[1].File == PROGRAM_INPUT && inst->SrcReg[0].Index != inst->SrcReg[1].Index) RETURN_ERROR1("Can't reference two vertex attribute registers"); return GL_TRUE; } static GLboolean Parse_TriOpInstruction(struct parse_state *parseState, struct vp_instruction *inst, enum vp_opcode opcode) { inst->Opcode = opcode; inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) RETURN_ERROR; /* comma */ if (!Parse_String(parseState, ",")) RETURN_ERROR; /* first src arg */ if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[0])) RETURN_ERROR; /* comma */ if (!Parse_String(parseState, ",")) RETURN_ERROR; /* second src arg */ if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[1])) RETURN_ERROR; /* comma */ if (!Parse_String(parseState, ",")) RETURN_ERROR; /* third src arg */ if (!Parse_SwizzleSrcReg(parseState, &inst->SrcReg[2])) RETURN_ERROR; /* semicolon */ if (!Parse_String(parseState, ";")) RETURN_ERROR; /* make sure we don't reference more than one program parameter register */ if ((inst->SrcReg[0].File == PROGRAM_ENV_PARAM && inst->SrcReg[1].File == PROGRAM_ENV_PARAM && inst->SrcReg[0].Index != inst->SrcReg[1].Index) || (inst->SrcReg[0].File == PROGRAM_ENV_PARAM && inst->SrcReg[2].File == PROGRAM_ENV_PARAM && inst->SrcReg[0].Index != inst->SrcReg[2].Index) || (inst->SrcReg[1].File == PROGRAM_ENV_PARAM && inst->SrcReg[2].File == PROGRAM_ENV_PARAM && inst->SrcReg[1].Index != inst->SrcReg[2].Index)) RETURN_ERROR1("Can only reference one program register"); /* make sure we don't reference more than one vertex attribute register */ if ((inst->SrcReg[0].File == PROGRAM_INPUT && inst->SrcReg[1].File == PROGRAM_INPUT && inst->SrcReg[0].Index != inst->SrcReg[1].Index) || (inst->SrcReg[0].File == PROGRAM_INPUT && inst->SrcReg[2].File == PROGRAM_INPUT && inst->SrcReg[0].Index != inst->SrcReg[2].Index) || (inst->SrcReg[1].File == PROGRAM_INPUT && inst->SrcReg[2].File == PROGRAM_INPUT && inst->SrcReg[1].Index != inst->SrcReg[2].Index)) RETURN_ERROR1("Can only reference one input register"); return GL_TRUE; } static GLboolean Parse_ScalarInstruction(struct parse_state *parseState, struct vp_instruction *inst, enum vp_opcode opcode) { if (opcode == VP_OPCODE_RCC && !parseState->isVersion1_1) RETURN_ERROR1("RCC illegal for vertex program 1.0"); inst->Opcode = opcode; inst->StringPos = parseState->curLine - parseState->start; /* dest reg */ if (!Parse_MaskedDstReg(parseState, &inst->DstReg)) RETURN_ERROR; /* comma */ if (!Parse_String(parseState, ",")) RETURN_ERROR; /* first src arg */ if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0])) RETURN_ERROR; /* semicolon */ if (!Parse_String(parseState, ";")) RETURN_ERROR; return GL_TRUE; } static GLboolean Parse_AddressInstruction(struct parse_state *parseState, struct vp_instruction *inst) { inst->Opcode = VP_OPCODE_ARL; inst->StringPos = parseState->curLine - parseState->start; /* dest A0 reg */ if (!Parse_AddrReg(parseState)) RETURN_ERROR; /* comma */ if (!Parse_String(parseState, ",")) RETURN_ERROR; /* parse src reg */ if (!Parse_ScalarSrcReg(parseState, &inst->SrcReg[0])) RETURN_ERROR; /* semicolon */ if (!Parse_String(parseState, ";")) RETURN_ERROR; return GL_TRUE; } static GLboolean Parse_EndInstruction(struct parse_state *parseState, struct vp_instruction *inst) { GLubyte token[100]; inst->Opcode = VP_OPCODE_END; inst->StringPos = parseState->curLine - parseState->start; /* this should fail! */ if (Parse_Token(parseState, token)) RETURN_ERROR2("Unexpected token after END:", token); else return GL_TRUE; } /** * The PRINT instruction is Mesa-specific and is meant as a debugging aid for * the vertex program developer. * The NV_vertex_program extension grammar is modified as follows: * * ::= * | ... * | * * ::= "PRINT" * | "PRINT" "," * | "PRINT" "," */ static GLboolean Parse_PrintInstruction(struct parse_state *parseState, struct vp_instruction *inst) { const GLubyte *str; GLubyte *msg; GLuint len; GLubyte token[100]; struct vp_src_register *srcReg = &inst->SrcReg[0]; GLint idx; inst->Opcode = VP_OPCODE_PRINT; inst->StringPos = parseState->curLine - parseState->start; /* The first argument is a literal string 'just like this' */ if (!Parse_String(parseState, "'")) RETURN_ERROR; str = parseState->pos; for (len = 0; str[len] != '\''; len++) /* find closing quote */ ; parseState->pos += len + 1; msg = _mesa_malloc(len + 1); _mesa_memcpy(msg, str, len); msg[len] = 0; inst->Data = msg; /* comma */ if (Parse_String(parseState, ",")) { /* The second argument is a register name */ if (!Peek_Token(parseState, token)) RETURN_ERROR; srcReg->RelAddr = GL_FALSE; srcReg->Negate = GL_FALSE; srcReg->Swizzle = SWIZZLE_NOOP; /* Register can be R, c[n], c[n +/- offset], a named vertex attrib, * or an o[n] output register. */ if (token[0] == 'R') { srcReg->File = PROGRAM_TEMPORARY; if (!Parse_TempReg(parseState, &idx)) RETURN_ERROR; srcReg->Index = idx; } else if (token[0] == 'c') { srcReg->File = PROGRAM_ENV_PARAM; if (!Parse_ParamReg(parseState, srcReg)) RETURN_ERROR; } else if (token[0] == 'v') { srcReg->File = PROGRAM_INPUT; if (!Parse_AttribReg(parseState, &idx)) RETURN_ERROR; srcReg->Index = idx; } else if (token[0] == 'o') { srcReg->File = PROGRAM_OUTPUT; if (!Parse_OutputReg(parseState, &idx)) RETURN_ERROR; srcReg->Index = idx; } else { RETURN_ERROR2("Bad source register name", token); } } else { srcReg->File = 0; } /* semicolon */ if (!Parse_String(parseState, ";")) RETURN_ERROR; return GL_TRUE; } static GLboolean Parse_OptionSequence(struct parse_state *parseState, struct vp_instruction program[]) { (void) program; while (1) { if (!Parse_String(parseState, "OPTION")) return GL_TRUE; /* ok, not an OPTION statement */ if (Parse_String(parseState, "NV_position_invariant")) { parseState->isPositionInvariant = GL_TRUE; } else { RETURN_ERROR1("unexpected OPTION statement"); } if (!Parse_String(parseState, ";")) return GL_FALSE; } } static GLboolean Parse_InstructionSequence(struct parse_state *parseState, struct vp_instruction program[]) { while (1) { struct vp_instruction *inst = program + parseState->numInst; /* Initialize the instruction */ inst->SrcReg[0].File = PROGRAM_UNDEFINED; inst->SrcReg[1].File = PROGRAM_UNDEFINED; inst->SrcReg[2].File = PROGRAM_UNDEFINED; inst->DstReg.File = PROGRAM_UNDEFINED; inst->Data = NULL; if (Parse_String(parseState, "MOV")) { if (!Parse_UnaryOpInstruction(parseState, inst, VP_OPCODE_MOV)) RETURN_ERROR; } else if (Parse_String(parseState, "LIT")) { if (!Parse_UnaryOpInstruction(parseState, inst, VP_OPCODE_LIT)) RETURN_ERROR; } else if (Parse_String(parseState, "ABS")) { if (!Parse_UnaryOpInstruction(parseState, inst, VP_OPCODE_ABS)) RETURN_ERROR; } else if (Parse_String(parseState, "MUL")) { if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_MUL)) RETURN_ERROR; } else if (Parse_String(parseState, "ADD")) { if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_ADD)) RETURN_ERROR; } else if (Parse_String(parseState, "DP3")) { if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_DP3)) RETURN_ERROR; } else if (Parse_String(parseState, "DP4")) { if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_DP4)) RETURN_ERROR; } else if (Parse_String(parseState, "DST")) { if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_DST)) RETURN_ERROR; } else if (Parse_String(parseState, "MIN")) { if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_MIN)) RETURN_ERROR; } else if (Parse_String(parseState, "MAX")) { if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_MAX)) RETURN_ERROR; } else if (Parse_String(parseState, "SLT")) { if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_SLT)) RETURN_ERROR; } else if (Parse_String(parseState, "SGE")) { if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_SGE)) RETURN_ERROR; } else if (Parse_String(parseState, "DPH")) { if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_DPH)) RETURN_ERROR; } else if (Parse_String(parseState, "SUB")) { if (!Parse_BiOpInstruction(parseState, inst, VP_OPCODE_SUB)) RETURN_ERROR; } else if (Parse_String(parseState, "MAD")) { if (!Parse_TriOpInstruction(parseState, inst, VP_OPCODE_MAD)) RETURN_ERROR; } else if (Parse_String(parseState, "RCP")) { if (!Parse_ScalarInstruction(parseState, inst, VP_OPCODE_RCP)) RETURN_ERROR; } else if (Parse_String(parseState, "RSQ")) { if (!Parse_ScalarInstruction(parseState, inst, VP_OPCODE_RSQ)) RETURN_ERROR; } else if (Parse_String(parseState, "EXP")) { if (!Parse_ScalarInstruction(parseState, inst, VP_OPCODE_EXP)) RETURN_ERROR; } else if (Parse_String(parseState, "LOG")) { if (!Parse_ScalarInstruction(parseState, inst, VP_OPCODE_LOG)) RETURN_ERROR; } else if (Parse_String(parseState, "RCC")) { if (!Parse_ScalarInstruction(parseState, inst, VP_OPCODE_RCC)) RETURN_ERROR; } else if (Parse_String(parseState, "ARL")) { if (!Parse_AddressInstruction(parseState, inst)) RETURN_ERROR; } else if (Parse_String(parseState, "PRINT")) { if (!Parse_PrintInstruction(parseState, inst)) RETURN_ERROR; } else if (Parse_String(parseState, "END")) { if (!Parse_EndInstruction(parseState, inst)) RETURN_ERROR; else { parseState->numInst++; return GL_TRUE; /* all done */ } } else { /* bad instruction name */ RETURN_ERROR1("Unexpected token"); } /* examine input/output registers */ if (inst->DstReg.File == PROGRAM_OUTPUT) parseState->outputsWritten |= (1 << inst->DstReg.Index); else if (inst->DstReg.File == PROGRAM_ENV_PARAM) parseState->anyProgRegsWritten = GL_TRUE; if (inst->SrcReg[0].File == PROGRAM_INPUT) parseState->inputsRead |= (1 << inst->SrcReg[0].Index); if (inst->SrcReg[1].File == PROGRAM_INPUT) parseState->inputsRead |= (1 << inst->SrcReg[1].Index); if (inst->SrcReg[2].File == PROGRAM_INPUT) parseState->inputsRead |= (1 << inst->SrcReg[2].Index); parseState->numInst++; if (parseState->numInst >= MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS) RETURN_ERROR1("Program too long"); } RETURN_ERROR; } static GLboolean Parse_Program(struct parse_state *parseState, struct vp_instruction instBuffer[]) { if (parseState->isVersion1_1) { if (!Parse_OptionSequence(parseState, instBuffer)) { return GL_FALSE; } } return Parse_InstructionSequence(parseState, instBuffer); } /** * Parse/compile the 'str' returning the compiled 'program'. * ctx->Program.ErrorPos will be -1 if successful. Otherwise, ErrorPos * indicates the position of the error in 'str'. */ void _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, const GLubyte *str, GLsizei len, struct vertex_program *program) { struct parse_state parseState; struct vp_instruction instBuffer[MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS]; struct vp_instruction *newInst; GLenum target; GLubyte *programString; /* Make a null-terminated copy of the program string */ programString = (GLubyte *) MALLOC(len + 1); if (!programString) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); return; } MEMCPY(programString, str, len); programString[len] = 0; /* Get ready to parse */ parseState.ctx = ctx; parseState.start = programString; parseState.isPositionInvariant = GL_FALSE; parseState.isVersion1_1 = GL_FALSE; parseState.numInst = 0; parseState.inputsRead = 0; parseState.outputsWritten = 0; parseState.anyProgRegsWritten = GL_FALSE; /* Reset error state */ _mesa_set_program_error(ctx, -1, NULL); /* check the program header */ if (_mesa_strncmp((const char *) programString, "!!VP1.0", 7) == 0) { target = GL_VERTEX_PROGRAM_NV; parseState.pos = programString + 7; parseState.isStateProgram = GL_FALSE; } else if (_mesa_strncmp((const char *) programString, "!!VP1.1", 7) == 0) { target = GL_VERTEX_PROGRAM_NV; parseState.pos = programString + 7; parseState.isStateProgram = GL_FALSE; parseState.isVersion1_1 = GL_TRUE; } else if (_mesa_strncmp((const char *) programString, "!!VSP1.0", 8) == 0) { target = GL_VERTEX_STATE_PROGRAM_NV; parseState.pos = programString + 8; parseState.isStateProgram = GL_TRUE; } else { /* invalid header */ ctx->Program.ErrorPos = 0; _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(bad header)"); return; } /* make sure target and header match */ if (target != dstTarget) { _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(target mismatch)"); return; } if (Parse_Program(&parseState, instBuffer)) { /* successful parse! */ if (parseState.isStateProgram) { if (!parseState.anyProgRegsWritten) { _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(c[#] not written)"); return; } } else { if (!parseState.isPositionInvariant && !(parseState.outputsWritten & 1)) { /* bit 1 = HPOS register */ _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(HPOS not written)"); return; } } /* copy the compiled instructions */ assert(parseState.numInst <= MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS); newInst = (struct vp_instruction *) MALLOC(parseState.numInst * sizeof(struct vp_instruction)); if (!newInst) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); FREE(programString); return; /* out of memory */ } MEMCPY(newInst, instBuffer, parseState.numInst * sizeof(struct vp_instruction)); /* install the program */ program->Base.Target = target; if (program->Base.String) { FREE(program->Base.String); } program->Base.String = programString; program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB; if (program->Instructions) { FREE(program->Instructions); } program->Instructions = newInst; program->InputsRead = parseState.inputsRead; program->OutputsWritten = parseState.outputsWritten; program->IsPositionInvariant = parseState.isPositionInvariant; program->IsNVProgram = GL_TRUE; #ifdef DEBUG_foo _mesa_printf("--- glLoadProgramNV result ---\n"); _mesa_print_nv_vertex_program(program); _mesa_printf("------------------------------\n"); #endif } else { /* Error! */ _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV"); /* NOTE: _mesa_set_program_error would have been called already */ /* GL_NV_vertex_program isn't supposed to set the error string * so we reset it here. */ _mesa_set_program_error(ctx, ctx->Program.ErrorPos, NULL); } } static void PrintSrcReg(const struct vp_src_register *src) { static const char comps[5] = "xyzw"; if (src->Negate) _mesa_printf("-"); if (src->RelAddr) { if (src->Index > 0) _mesa_printf("c[A0.x + %d]", src->Index); else if (src->Index < 0) _mesa_printf("c[A0.x - %d]", -src->Index); else _mesa_printf("c[A0.x]"); } else if (src->File == PROGRAM_OUTPUT) { _mesa_printf("o[%s]", OutputRegisters[src->Index]); } else if (src->File == PROGRAM_INPUT) { _mesa_printf("v[%s]", InputRegisters[src->Index]); } else if (src->File == PROGRAM_ENV_PARAM) { _mesa_printf("c[%d]", src->Index); } else { ASSERT(src->File == PROGRAM_TEMPORARY); _mesa_printf("R%d", src->Index); } if (GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 1) && GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 2) && GET_SWZ(src->Swizzle, 0) == GET_SWZ(src->Swizzle, 3)) { _mesa_printf(".%c", comps[GET_SWZ(src->Swizzle, 0)]); } else if (src->Swizzle != SWIZZLE_NOOP) { _mesa_printf(".%c%c%c%c", comps[GET_SWZ(src->Swizzle, 0)], comps[GET_SWZ(src->Swizzle, 1)], comps[GET_SWZ(src->Swizzle, 2)], comps[GET_SWZ(src->Swizzle, 3)]); } } static void PrintDstReg(const struct vp_dst_register *dst) { if (dst->File == PROGRAM_OUTPUT) { _mesa_printf("o[%s]", OutputRegisters[dst->Index]); } else if (dst->File == PROGRAM_INPUT) { _mesa_printf("v[%s]", InputRegisters[dst->Index]); } else if (dst->File == PROGRAM_ENV_PARAM) { _mesa_printf("c[%d]", dst->Index); } else { ASSERT(dst->File == PROGRAM_TEMPORARY); _mesa_printf("R%d", dst->Index); } if (dst->WriteMask != 0 && dst->WriteMask != 0xf) { _mesa_printf("."); if (dst->WriteMask & 0x1) _mesa_printf("x"); if (dst->WriteMask & 0x2) _mesa_printf("y"); if (dst->WriteMask & 0x4) _mesa_printf("z"); if (dst->WriteMask & 0x8) _mesa_printf("w"); } } /** * Print a single NVIDIA vertex program instruction. */ void _mesa_print_nv_vertex_instruction(const struct vp_instruction *inst) { switch (inst->Opcode) { case VP_OPCODE_MOV: case VP_OPCODE_LIT: case VP_OPCODE_RCP: case VP_OPCODE_RSQ: case VP_OPCODE_EXP: case VP_OPCODE_LOG: case VP_OPCODE_RCC: case VP_OPCODE_ABS: _mesa_printf("%s ", Opcodes[(int) inst->Opcode]); PrintDstReg(&inst->DstReg); _mesa_printf(", "); PrintSrcReg(&inst->SrcReg[0]); _mesa_printf(";\n"); break; case VP_OPCODE_MUL: case VP_OPCODE_ADD: case VP_OPCODE_DP3: case VP_OPCODE_DP4: case VP_OPCODE_DST: case VP_OPCODE_MIN: case VP_OPCODE_MAX: case VP_OPCODE_SLT: case VP_OPCODE_SGE: case VP_OPCODE_DPH: case VP_OPCODE_SUB: _mesa_printf("%s ", Opcodes[(int) inst->Opcode]); PrintDstReg(&inst->DstReg); _mesa_printf(", "); PrintSrcReg(&inst->SrcReg[0]); _mesa_printf(", "); PrintSrcReg(&inst->SrcReg[1]); _mesa_printf(";\n"); break; case VP_OPCODE_MAD: _mesa_printf("MAD "); PrintDstReg(&inst->DstReg); _mesa_printf(", "); PrintSrcReg(&inst->SrcReg[0]); _mesa_printf(", "); PrintSrcReg(&inst->SrcReg[1]); _mesa_printf(", "); PrintSrcReg(&inst->SrcReg[2]); _mesa_printf(";\n"); break; case VP_OPCODE_ARL: _mesa_printf("ARL A0.x, "); PrintSrcReg(&inst->SrcReg[0]); _mesa_printf(";\n"); break; case VP_OPCODE_PRINT: _mesa_printf("PRINT '%s'", inst->Data); if (inst->SrcReg[0].File) { _mesa_printf(", "); PrintSrcReg(&inst->SrcReg[0]); _mesa_printf(";\n"); } else { _mesa_printf("\n"); } break; case VP_OPCODE_END: _mesa_printf("END\n"); break; default: _mesa_printf("BAD INSTRUCTION\n"); } } /** * Print (unparse) the given vertex program. Just for debugging. */ void _mesa_print_nv_vertex_program(const struct vertex_program *program) { const struct vp_instruction *inst; for (inst = program->Instructions; ; inst++) { _mesa_print_nv_vertex_instruction(inst); if (inst->Opcode == VP_OPCODE_END) return; } } const char * _mesa_nv_vertex_input_register_name(GLuint i) { ASSERT(i < MAX_NV_VERTEX_PROGRAM_INPUTS); return InputRegisters[i]; } const char * _mesa_nv_vertex_output_register_name(GLuint i) { ASSERT(i < MAX_NV_VERTEX_PROGRAM_OUTPUTS); return OutputRegisters[i]; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/nvvertparse.h0000644000000000000000000000333613614532424021220 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Brian Paul */ #ifndef NVVERTPARSE_H #define NVVERTPARSE_H extern void _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum target, const GLubyte *str, GLsizei len, struct vertex_program *program); extern void _mesa_print_nv_vertex_instruction(const struct vp_instruction *inst); extern void _mesa_print_nv_vertex_program(const struct vertex_program *program); extern const char * _mesa_nv_vertex_input_register_name(GLuint i); extern const char * _mesa_nv_vertex_output_register_name(GLuint i); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/nvvertprog.h0000644000000000000000000000564013614532424021055 0ustar /* * Mesa 3-D graphics library * Version: 6.3.1 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Private vertex program types and constants only used by files * related to vertex programs. * * XXX TO-DO: Rename this file "vertprog.h" since it's not NV-specific. */ #ifndef NVVERTPROG_H #define NVVERTPROG_H /* Vertex program opcodes */ enum vp_opcode { VP_OPCODE_ABS, VP_OPCODE_ADD, VP_OPCODE_ARL, VP_OPCODE_DP3, VP_OPCODE_DP4, VP_OPCODE_DPH, VP_OPCODE_DST, VP_OPCODE_END, /* Placeholder */ VP_OPCODE_EX2, /* ARB only */ VP_OPCODE_EXP, VP_OPCODE_FLR, /* ARB */ VP_OPCODE_FRC, /* ARB */ VP_OPCODE_LG2, /* ARB only */ VP_OPCODE_LIT, VP_OPCODE_LOG, VP_OPCODE_MAD, VP_OPCODE_MAX, VP_OPCODE_MIN, VP_OPCODE_MOV, VP_OPCODE_MUL, VP_OPCODE_POW, /* ARB only */ VP_OPCODE_PRINT, /* Mesa only */ VP_OPCODE_RCC, VP_OPCODE_RCP, VP_OPCODE_RSQ, VP_OPCODE_SGE, VP_OPCODE_SLT, VP_OPCODE_SUB, VP_OPCODE_SWZ, /* ARB only */ VP_OPCODE_XPD, /* ARB only */ VP_MAX_OPCODE }; /* Instruction source register */ struct vp_src_register { GLuint File:4; /* one of the PROGRAM_* register file values */ GLint Index:9; /* may be negative for relative addressing */ GLuint Swizzle:12; GLuint Negate:4; /* ARB requires component-wise negation. */ GLuint RelAddr:1; GLuint pad:2; }; /* Instruction destination register */ struct vp_dst_register { GLuint File:4; /* one of the PROGRAM_* register file values */ GLuint Index:8; GLuint WriteMask:4; GLuint pad:16; }; /* Vertex program instruction */ struct vp_instruction { GLshort Opcode; #if FEATURE_MESA_program_debug GLshort StringPos; #endif void *Data; /* some arbitrary data, only used for PRINT instruction now */ struct vp_src_register SrcReg[3]; struct vp_dst_register DstReg; }; #endif /* VERTPROG_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/program.c0000644000000000000000000012703213614532424020303 0ustar /* * Mesa 3-D graphics library * Version: 6.2 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file program.c * Vertex and fragment program support functions. * \author Brian Paul */ #include "glheader.h" #include "context.h" #include "hash.h" #include "imports.h" #include "macros.h" #include "mtypes.h" #include "program.h" #include "nvfragparse.h" #include "nvfragprog.h" #include "nvvertparse.h" #include "nvvertprog.h" /**********************************************************************/ /* Utility functions */ /**********************************************************************/ /* A pointer to this dummy program is put into the hash table when * glGenPrograms is called. */ struct program _mesa_DummyProgram; /** * Init context's vertex/fragment program state */ void _mesa_init_program(GLcontext *ctx) { GLuint i; ctx->Program.ErrorPos = -1; ctx->Program.ErrorString = _mesa_strdup(""); #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program ctx->VertexProgram.Enabled = GL_FALSE; ctx->VertexProgram.PointSizeEnabled = GL_FALSE; ctx->VertexProgram.TwoSideEnabled = GL_FALSE; ctx->VertexProgram.Current = (struct vertex_program *) ctx->Shared->DefaultVertexProgram; assert(ctx->VertexProgram.Current); ctx->VertexProgram.Current->Base.RefCount++; for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) { ctx->VertexProgram.TrackMatrix[i] = GL_NONE; ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV; } #endif #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program ctx->FragmentProgram.Enabled = GL_FALSE; ctx->FragmentProgram.Current = (struct fragment_program *) ctx->Shared->DefaultFragmentProgram; assert(ctx->FragmentProgram.Current); ctx->FragmentProgram.Current->Base.RefCount++; #endif #if FEATURE_ATI_fragment_shader ctx->ATIFragmentShader.Enabled = GL_FALSE; ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) ctx->Shared->DefaultFragmentShader; assert(ctx->ATIFragmentShader.Current); ctx->ATIFragmentShader.Current->Base.RefCount++; #endif } /** * Free a context's vertex/fragment program state */ void _mesa_free_program_data(GLcontext *ctx) { #if FEATURE_NV_vertex_program if (ctx->VertexProgram.Current) { ctx->VertexProgram.Current->Base.RefCount--; if (ctx->VertexProgram.Current->Base.RefCount <= 0) ctx->Driver.DeleteProgram(ctx, &(ctx->VertexProgram.Current->Base)); } #endif #if FEATURE_NV_fragment_program if (ctx->FragmentProgram.Current) { ctx->FragmentProgram.Current->Base.RefCount--; if (ctx->FragmentProgram.Current->Base.RefCount <= 0) ctx->Driver.DeleteProgram(ctx, &(ctx->FragmentProgram.Current->Base)); } #endif #if FEATURE_ATI_fragment_shader if (ctx->ATIFragmentShader.Current) { ctx->ATIFragmentShader.Current->Base.RefCount--; if (ctx->ATIFragmentShader.Current->Base.RefCount <= 0) ctx->Driver.DeleteProgram(ctx, &(ctx->ATIFragmentShader.Current->Base)); } #endif _mesa_free((void *) ctx->Program.ErrorString); } /** * Set the vertex/fragment program error state (position and error string). * This is generally called from within the parsers. */ void _mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string) { ctx->Program.ErrorPos = pos; _mesa_free((void *) ctx->Program.ErrorString); if (!string) string = ""; ctx->Program.ErrorString = _mesa_strdup(string); } /** * Find the line number and column for 'pos' within 'string'. * Return a copy of the line which contains 'pos'. Free the line with * _mesa_free(). * \param string the program string * \param pos the position within the string * \param line returns the line number corresponding to 'pos'. * \param col returns the column number corresponding to 'pos'. * \return copy of the line containing 'pos'. */ const GLubyte * _mesa_find_line_column(const GLubyte *string, const GLubyte *pos, GLint *line, GLint *col) { const GLubyte *lineStart = string; const GLubyte *p = string; GLubyte *s; int len; *line = 1; while (p != pos) { if (*p == (GLubyte) '\n') { (*line)++; lineStart = p + 1; } p++; } *col = (pos - lineStart) + 1; /* return copy of this line */ while (*p != 0 && *p != '\n') p++; len = p - lineStart; s = (GLubyte *) _mesa_malloc(len + 1); _mesa_memcpy(s, lineStart, len); s[len] = 0; return s; } /** * Initialize a new vertex/fragment program object. */ static struct program * _mesa_init_program_struct( GLcontext *ctx, struct program *prog, GLenum target, GLuint id) { (void) ctx; if (prog) { prog->Id = id; prog->Target = target; prog->Resident = GL_TRUE; prog->RefCount = 1; } return prog; } /** * Initialize a new fragment program object. */ struct program * _mesa_init_fragment_program( GLcontext *ctx, struct fragment_program *prog, GLenum target, GLuint id) { if (prog) return _mesa_init_program_struct( ctx, &prog->Base, target, id ); else return NULL; } /** * Initialize a new vertex program object. */ struct program * _mesa_init_vertex_program( GLcontext *ctx, struct vertex_program *prog, GLenum target, GLuint id) { if (prog) return _mesa_init_program_struct( ctx, &prog->Base, target, id ); else return NULL; } /** * Initialize a new ATI fragment shader object. */ struct program * _mesa_init_ati_fragment_shader( GLcontext *ctx, struct ati_fragment_shader *prog, GLenum target, GLuint id ) { if (prog) return _mesa_init_program_struct( ctx, &prog->Base, target, id ); else return NULL; } /** * Allocate and initialize a new fragment/vertex program object but * don't put it into the program hash table. Called via * ctx->Driver.NewProgram. May be overridden (ie. replaced) by a * device driver function to implement OO deriviation with additional * types not understood by this function. * * \param ctx context * \param id program id/number * \param target program target/type * \return pointer to new program object */ struct program * _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id) { switch (target) { case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ return _mesa_init_vertex_program( ctx, CALLOC_STRUCT(vertex_program), target, id ); case GL_FRAGMENT_PROGRAM_NV: case GL_FRAGMENT_PROGRAM_ARB: return _mesa_init_fragment_program( ctx, CALLOC_STRUCT(fragment_program), target, id ); case GL_FRAGMENT_SHADER_ATI: return _mesa_init_ati_fragment_shader( ctx, CALLOC_STRUCT(ati_fragment_shader), target, id ); default: _mesa_problem(ctx, "bad target in _mesa_new_program"); return NULL; } } /** * Delete a program and remove it from the hash table, ignoring the * reference count. * Called via ctx->Driver.DeleteProgram. May be wrapped (OO deriviation) * by a device driver function. */ void _mesa_delete_program(GLcontext *ctx, struct program *prog) { (void) ctx; ASSERT(prog); if (prog->String) _mesa_free(prog->String); if (prog->Target == GL_VERTEX_PROGRAM_NV || prog->Target == GL_VERTEX_STATE_PROGRAM_NV) { struct vertex_program *vprog = (struct vertex_program *) prog; if (vprog->Instructions) { GLuint i; for (i = 0; i < vprog->Base.NumInstructions; i++) { if (vprog->Instructions[i].Data) _mesa_free(vprog->Instructions[i].Data); } _mesa_free(vprog->Instructions); } if (vprog->Parameters) _mesa_free_parameter_list(vprog->Parameters); } else if (prog->Target == GL_FRAGMENT_PROGRAM_NV || prog->Target == GL_FRAGMENT_PROGRAM_ARB) { struct fragment_program *fprog = (struct fragment_program *) prog; if (fprog->Instructions) { GLuint i; for (i = 0; i < fprog->Base.NumInstructions; i++) { if (fprog->Instructions[i].Data) _mesa_free(fprog->Instructions[i].Data); } _mesa_free(fprog->Instructions); } if (fprog->Parameters) _mesa_free_parameter_list(fprog->Parameters); } else if (prog->Target == GL_FRAGMENT_SHADER_ATI) { struct ati_fragment_shader *atifs = (struct ati_fragment_shader *)prog; if (atifs->Instructions) _mesa_free(atifs->Instructions); } _mesa_free(prog); } /**********************************************************************/ /* Program parameter functions */ /**********************************************************************/ struct program_parameter_list * _mesa_new_parameter_list(void) { return (struct program_parameter_list *) _mesa_calloc(sizeof(struct program_parameter_list)); } /** * Free a parameter list and all its parameters */ void _mesa_free_parameter_list(struct program_parameter_list *paramList) { _mesa_free_parameters(paramList); _mesa_free(paramList->Parameters); if (paramList->ParameterValues) ALIGN_FREE(paramList->ParameterValues); _mesa_free(paramList); } /** * Free all the parameters in the given list, but don't free the * paramList structure itself. */ void _mesa_free_parameters(struct program_parameter_list *paramList) { GLuint i; for (i = 0; i < paramList->NumParameters; i++) { if (paramList->Parameters[i].Name) _mesa_free((void *) paramList->Parameters[i].Name); } paramList->NumParameters = 0; } /** * Helper function used by the functions below. */ static GLint add_parameter(struct program_parameter_list *paramList, const char *name, const GLfloat values[4], enum parameter_type type) { const GLuint n = paramList->NumParameters; if (n == paramList->Size) { GLfloat (*tmp)[4]; paramList->Size *= 2; if (!paramList->Size) paramList->Size = 8; paramList->Parameters = (struct program_parameter *) _mesa_realloc(paramList->Parameters, n * sizeof(struct program_parameter), paramList->Size * sizeof(struct program_parameter)); tmp = paramList->ParameterValues; paramList->ParameterValues = ALIGN_MALLOC(paramList->Size * 4 * sizeof(GLfloat), 16); if (tmp) { _mesa_memcpy(paramList->ParameterValues, tmp, n * 4 * sizeof(GLfloat)); ALIGN_FREE(tmp); } } if (!paramList->Parameters || !paramList->ParameterValues) { /* out of memory */ paramList->NumParameters = 0; paramList->Size = 0; return -1; } else { paramList->NumParameters = n + 1; _mesa_memset(¶mList->Parameters[n], 0, sizeof(struct program_parameter)); paramList->Parameters[n].Name = name ? _mesa_strdup(name) : NULL; paramList->Parameters[n].Type = type; if (values) COPY_4V(paramList->ParameterValues[n], values); return (GLint) n; } } /** * Add a new named program parameter (Ex: NV_fragment_program DEFINE statement) * \return index of the new entry in the parameter list */ GLint _mesa_add_named_parameter(struct program_parameter_list *paramList, const char *name, const GLfloat values[4]) { return add_parameter(paramList, name, values, NAMED_PARAMETER); } /** * Add a new unnamed constant to the parameter list. * \param paramList - the parameter list * \param values - four float values * \return index of the new parameter. */ GLint _mesa_add_named_constant(struct program_parameter_list *paramList, const char *name, const GLfloat values[4]) { return add_parameter(paramList, name, values, CONSTANT); } /** * Add a new unnamed constant to the parameter list. * \param paramList - the parameter list * \param values - four float values * \return index of the new parameter. */ GLint _mesa_add_unnamed_constant(struct program_parameter_list *paramList, const GLfloat values[4]) { return add_parameter(paramList, NULL, values, CONSTANT); } /** * Add a new state reference to the parameter list. * \param paramList - the parameter list * \param state - an array of 6 state tokens * * \return index of the new parameter. */ GLint _mesa_add_state_reference(struct program_parameter_list *paramList, GLint *stateTokens) { /* XXX Should we parse here and produce the parameter's * list of STATE_* tokens here, or in the parser? */ GLint a, idx; idx = add_parameter(paramList, NULL, NULL, STATE); for (a=0; a<6; a++) paramList->Parameters[idx].StateIndexes[a] = (enum state_index) stateTokens[a]; return idx; } /** * Lookup a parameter value by name in the given parameter list. * \return pointer to the float[4] values. */ GLfloat * _mesa_lookup_parameter_value(struct program_parameter_list *paramList, GLsizei nameLen, const char *name) { GLuint i; if (!paramList) return NULL; if (nameLen == -1) { /* name is null-terminated */ for (i = 0; i < paramList->NumParameters; i++) { if (paramList->Parameters[i].Name && _mesa_strcmp(paramList->Parameters[i].Name, name) == 0) return paramList->ParameterValues[i]; } } else { /* name is not null-terminated, use nameLen */ for (i = 0; i < paramList->NumParameters; i++) { if (paramList->Parameters[i].Name && _mesa_strncmp(paramList->Parameters[i].Name, name, nameLen) == 0 && _mesa_strlen(paramList->Parameters[i].Name) == (size_t)nameLen) return paramList->ParameterValues[i]; } } return NULL; } /** * Lookup a parameter index by name in the given parameter list. * \return index of parameter in the list. */ GLint _mesa_lookup_parameter_index(struct program_parameter_list *paramList, GLsizei nameLen, const char *name) { GLint i; if (!paramList) return -1; if (nameLen == -1) { /* name is null-terminated */ for (i = 0; i < (GLint) paramList->NumParameters; i++) { if (paramList->Parameters[i].Name && _mesa_strcmp(paramList->Parameters[i].Name, name) == 0) return i; } } else { /* name is not null-terminated, use nameLen */ for (i = 0; i < (GLint) paramList->NumParameters; i++) { if (paramList->Parameters[i].Name && _mesa_strncmp(paramList->Parameters[i].Name, name, nameLen) == 0 && _mesa_strlen(paramList->Parameters[i].Name) == (size_t)nameLen) return i; } } return -1; } /** * Use the list of tokens in the state[] array to find global GL state * and return it in . Usually, four values are returned in * but matrix queries may return as many as 16 values. * This function is used for ARB vertex/fragment programs. * The program parser will produce the state[] values. */ static void _mesa_fetch_state(GLcontext *ctx, const enum state_index state[], GLfloat *value) { switch (state[0]) { case STATE_MATERIAL: { /* state[1] is either 0=front or 1=back side */ const GLuint face = (GLuint) state[1]; /* state[2] is the material attribute */ switch (state[2]) { case STATE_AMBIENT: if (face == 0) COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT]); else COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_AMBIENT]); return; case STATE_DIFFUSE: if (face == 0) COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE]); else COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE]); return; case STATE_SPECULAR: if (face == 0) COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SPECULAR]); else COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_SPECULAR]); return; case STATE_EMISSION: if (face == 0) COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_EMISSION]); else COPY_4V(value, ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_EMISSION]); return; case STATE_SHININESS: if (face == 0) value[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS][0]; else value[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_SHININESS][0]; value[1] = 0.0F; value[2] = 0.0F; value[3] = 1.0F; return; default: _mesa_problem(ctx, "Invalid material state in fetch_state"); return; } } case STATE_LIGHT: { /* state[1] is the light number */ const GLuint ln = (GLuint) state[1]; /* state[2] is the light attribute */ switch (state[2]) { case STATE_AMBIENT: COPY_4V(value, ctx->Light.Light[ln].Ambient); return; case STATE_DIFFUSE: COPY_4V(value, ctx->Light.Light[ln].Diffuse); return; case STATE_SPECULAR: COPY_4V(value, ctx->Light.Light[ln].Specular); return; case STATE_POSITION: COPY_4V(value, ctx->Light.Light[ln].EyePosition); return; case STATE_ATTENUATION: value[0] = ctx->Light.Light[ln].ConstantAttenuation; value[1] = ctx->Light.Light[ln].LinearAttenuation; value[2] = ctx->Light.Light[ln].QuadraticAttenuation; value[3] = ctx->Light.Light[ln].SpotExponent; return; case STATE_SPOT_DIRECTION: COPY_3V(value, ctx->Light.Light[ln].EyeDirection); value[3] = ctx->Light.Light[ln]._CosCutoff; return; case STATE_HALF: { GLfloat eye_z[] = {0, 0, 1}; /* Compute infinite half angle vector: * half-vector = light_position + (0, 0, 1) * and then normalize. w = 0 * * light.EyePosition.w should be 0 for infinite lights. */ ADD_3V(value, eye_z, ctx->Light.Light[ln].EyePosition); NORMALIZE_3FV(value); value[3] = 0; } return; case STATE_POSITION_NORMALIZED: COPY_4V(value, ctx->Light.Light[ln].EyePosition); NORMALIZE_3FV( value ); return; default: _mesa_problem(ctx, "Invalid light state in fetch_state"); return; } } case STATE_LIGHTMODEL_AMBIENT: COPY_4V(value, ctx->Light.Model.Ambient); return; case STATE_LIGHTMODEL_SCENECOLOR: if (state[1] == 0) { /* front */ GLint i; for (i = 0; i < 3; i++) { value[i] = ctx->Light.Model.Ambient[i] * ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT][i] + ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_EMISSION][i]; } value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; } else { /* back */ GLint i; for (i = 0; i < 3; i++) { value[i] = ctx->Light.Model.Ambient[i] * ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_AMBIENT][i] + ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_EMISSION][i]; } value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; } return; case STATE_LIGHTPROD: { const GLuint ln = (GLuint) state[1]; const GLuint face = (GLuint) state[2]; GLint i; ASSERT(face == 0 || face == 1); switch (state[3]) { case STATE_AMBIENT: for (i = 0; i < 3; i++) { value[i] = ctx->Light.Light[ln].Ambient[i] * ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_AMBIENT+face][i]; } /* [3] = material alpha */ value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE+face][3]; return; case STATE_DIFFUSE: for (i = 0; i < 3; i++) { value[i] = ctx->Light.Light[ln].Diffuse[i] * ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE+face][i]; } /* [3] = material alpha */ value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE+face][3]; return; case STATE_SPECULAR: for (i = 0; i < 3; i++) { value[i] = ctx->Light.Light[ln].Specular[i] * ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SPECULAR+face][i]; } /* [3] = material alpha */ value[3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE+face][3]; return; default: _mesa_problem(ctx, "Invalid lightprod state in fetch_state"); return; } } case STATE_TEXGEN: { /* state[1] is the texture unit */ const GLuint unit = (GLuint) state[1]; /* state[2] is the texgen attribute */ switch (state[2]) { case STATE_TEXGEN_EYE_S: COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneS); return; case STATE_TEXGEN_EYE_T: COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneT); return; case STATE_TEXGEN_EYE_R: COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneR); return; case STATE_TEXGEN_EYE_Q: COPY_4V(value, ctx->Texture.Unit[unit].EyePlaneQ); return; case STATE_TEXGEN_OBJECT_S: COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneS); return; case STATE_TEXGEN_OBJECT_T: COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneT); return; case STATE_TEXGEN_OBJECT_R: COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneR); return; case STATE_TEXGEN_OBJECT_Q: COPY_4V(value, ctx->Texture.Unit[unit].ObjectPlaneQ); return; default: _mesa_problem(ctx, "Invalid texgen state in fetch_state"); return; } } case STATE_TEXENV_COLOR: { /* state[1] is the texture unit */ const GLuint unit = (GLuint) state[1]; COPY_4V(value, ctx->Texture.Unit[unit].EnvColor); } return; case STATE_FOG_COLOR: COPY_4V(value, ctx->Fog.Color); return; case STATE_FOG_PARAMS: value[0] = ctx->Fog.Density; value[1] = ctx->Fog.Start; value[2] = ctx->Fog.End; value[3] = 1.0F / (ctx->Fog.End - ctx->Fog.Start); return; case STATE_CLIPPLANE: { const GLuint plane = (GLuint) state[1]; COPY_4V(value, ctx->Transform.EyeUserPlane[plane]); } return; case STATE_POINT_SIZE: value[0] = ctx->Point.Size; value[1] = ctx->Point.MinSize; value[2] = ctx->Point.MaxSize; value[3] = ctx->Point.Threshold; return; case STATE_POINT_ATTENUATION: value[0] = ctx->Point.Params[0]; value[1] = ctx->Point.Params[1]; value[2] = ctx->Point.Params[2]; value[3] = 1.0F; return; case STATE_MATRIX: { /* state[1] = modelview, projection, texture, etc. */ /* state[2] = which texture matrix or program matrix */ /* state[3] = first column to fetch */ /* state[4] = last column to fetch */ /* state[5] = transpose, inverse or invtrans */ const GLmatrix *matrix; const enum state_index mat = state[1]; const GLuint index = (GLuint) state[2]; const GLuint first = (GLuint) state[3]; const GLuint last = (GLuint) state[4]; const enum state_index modifier = state[5]; const GLfloat *m; GLuint row, i; if (mat == STATE_MODELVIEW) { matrix = ctx->ModelviewMatrixStack.Top; } else if (mat == STATE_PROJECTION) { matrix = ctx->ProjectionMatrixStack.Top; } else if (mat == STATE_MVP) { matrix = &ctx->_ModelProjectMatrix; } else if (mat == STATE_TEXTURE) { matrix = ctx->TextureMatrixStack[index].Top; } else if (mat == STATE_PROGRAM) { matrix = ctx->ProgramMatrixStack[index].Top; } else { _mesa_problem(ctx, "Bad matrix name in _mesa_fetch_state()"); return; } if (modifier == STATE_MATRIX_INVERSE || modifier == STATE_MATRIX_INVTRANS) { /* Be sure inverse is up to date: */ _math_matrix_analyse( (GLmatrix*) matrix ); m = matrix->inv; } else { m = matrix->m; } if (modifier == STATE_MATRIX_TRANSPOSE || modifier == STATE_MATRIX_INVTRANS) { for (i = 0, row = first; row <= last; row++) { value[i++] = m[row * 4 + 0]; value[i++] = m[row * 4 + 1]; value[i++] = m[row * 4 + 2]; value[i++] = m[row * 4 + 3]; } } else { for (i = 0, row = first; row <= last; row++) { value[i++] = m[row + 0]; value[i++] = m[row + 4]; value[i++] = m[row + 8]; value[i++] = m[row + 12]; } } } return; case STATE_DEPTH_RANGE: value[0] = ctx->Viewport.Near; /* near */ value[1] = ctx->Viewport.Far; /* far */ value[2] = ctx->Viewport.Far - ctx->Viewport.Near; /* far - near */ value[3] = 0; return; case STATE_FRAGMENT_PROGRAM: { /* state[1] = {STATE_ENV, STATE_LOCAL} */ /* state[2] = parameter index */ const int idx = (int) state[2]; switch (state[1]) { case STATE_ENV: COPY_4V(value, ctx->FragmentProgram.Parameters[idx]); break; case STATE_LOCAL: COPY_4V(value, ctx->FragmentProgram.Current->Base.LocalParams[idx]); break; default: _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()"); return; } } return; case STATE_VERTEX_PROGRAM: { /* state[1] = {STATE_ENV, STATE_LOCAL} */ /* state[2] = parameter index */ const int idx = (int) state[2]; switch (state[1]) { case STATE_ENV: COPY_4V(value, ctx->VertexProgram.Parameters[idx]); break; case STATE_LOCAL: COPY_4V(value, ctx->VertexProgram.Current->Base.LocalParams[idx]); break; default: _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()"); return; } } return; case STATE_INTERNAL: { switch (state[1]) { case STATE_NORMAL_SCALE: ASSIGN_4V(value, ctx->_ModelViewInvScale, 0, 0, 1); break; default: _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()"); return; } } return; default: _mesa_problem(ctx, "Invalid state in _mesa_fetch_state"); return; } } /** * Loop over all the parameters in a parameter list. If the parameter * is a GL state reference, look up the current value of that state * variable and put it into the parameter's Value[4] array. * This would be called at glBegin time when using a fragment program. */ void _mesa_load_state_parameters(GLcontext *ctx, struct program_parameter_list *paramList) { GLuint i; if (!paramList) return; for (i = 0; i < paramList->NumParameters; i++) { if (paramList->Parameters[i].Type == STATE) { _mesa_fetch_state(ctx, paramList->Parameters[i].StateIndexes, paramList->ParameterValues[i]); } } } /**********************************************************************/ /* API functions */ /**********************************************************************/ /** * Bind a program (make it current) * \note Called from the GL API dispatcher by both glBindProgramNV * and glBindProgramARB. */ void GLAPIENTRY _mesa_BindProgram(GLenum target, GLuint id) { struct program *prog; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM); if ((target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) || (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program)) { /*** Vertex program binding ***/ struct vertex_program *curProg = ctx->VertexProgram.Current; if (curProg->Base.Id == id) { /* binding same program - no change */ return; } if (curProg->Base.Id != 0) { /* decrement refcount on previously bound vertex program */ curProg->Base.RefCount--; /* and delete if refcount goes below one */ if (curProg->Base.RefCount <= 0) { /* the program ID was already removed from the hash table */ ctx->Driver.DeleteProgram(ctx, &(curProg->Base)); } } } else if ((target == GL_FRAGMENT_PROGRAM_NV && ctx->Extensions.NV_fragment_program) || (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program)) { /*** Fragment program binding ***/ struct fragment_program *curProg = ctx->FragmentProgram.Current; if (curProg->Base.Id == id) { /* binding same program - no change */ return; } if (curProg->Base.Id != 0) { /* decrement refcount on previously bound fragment program */ curProg->Base.RefCount--; /* and delete if refcount goes below one */ if (curProg->Base.RefCount <= 0) { /* the program ID was already removed from the hash table */ ctx->Driver.DeleteProgram(ctx, &(curProg->Base)); } } } else { _mesa_error(ctx, GL_INVALID_ENUM, "glBindProgramNV/ARB(target)"); return; } /* NOTE: binding to a non-existant program is not an error. * That's supposed to be caught in glBegin. */ if (id == 0) { /* Bind default program */ prog = NULL; if (target == GL_VERTEX_PROGRAM_NV || target == GL_VERTEX_PROGRAM_ARB) prog = ctx->Shared->DefaultVertexProgram; else prog = ctx->Shared->DefaultFragmentProgram; } else { /* Bind user program */ prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id); if (!prog || prog == &_mesa_DummyProgram) { /* allocate a new program now */ prog = ctx->Driver.NewProgram(ctx, target, id); if (!prog) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV/ARB"); return; } _mesa_HashInsert(ctx->Shared->Programs, id, prog); } else if (prog->Target != target) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindProgramNV/ARB(target mismatch)"); return; } } /* bind now */ if (target == GL_VERTEX_PROGRAM_NV || target == GL_VERTEX_PROGRAM_ARB) { ctx->VertexProgram.Current = (struct vertex_program *) prog; } else if (target == GL_FRAGMENT_PROGRAM_NV || target == GL_FRAGMENT_PROGRAM_ARB) { ctx->FragmentProgram.Current = (struct fragment_program *) prog; } /* Never null pointers */ ASSERT(ctx->VertexProgram.Current); ASSERT(ctx->FragmentProgram.Current); if (prog) prog->RefCount++; if (ctx->Driver.BindProgram) ctx->Driver.BindProgram(ctx, target, prog); } /** * Delete a list of programs. * \note Not compiled into display lists. * \note Called by both glDeleteProgramsNV and glDeleteProgramsARB. */ void GLAPIENTRY _mesa_DeletePrograms(GLsizei n, const GLuint *ids) { GLint i; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (n < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glDeleteProgramsNV" ); return; } for (i = 0; i < n; i++) { if (ids[i] != 0) { struct program *prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, ids[i]); if (prog == &_mesa_DummyProgram) { _mesa_HashRemove(ctx->Shared->Programs, ids[i]); } else if (prog) { /* Unbind program if necessary */ if (prog->Target == GL_VERTEX_PROGRAM_NV || prog->Target == GL_VERTEX_STATE_PROGRAM_NV) { if (ctx->VertexProgram.Current && ctx->VertexProgram.Current->Base.Id == ids[i]) { /* unbind this currently bound program */ _mesa_BindProgram(prog->Target, 0); } } else if (prog->Target == GL_FRAGMENT_PROGRAM_NV || prog->Target == GL_FRAGMENT_PROGRAM_ARB) { if (ctx->FragmentProgram.Current && ctx->FragmentProgram.Current->Base.Id == ids[i]) { /* unbind this currently bound program */ _mesa_BindProgram(prog->Target, 0); } } else { _mesa_problem(ctx, "bad target in glDeleteProgramsNV"); return; } /* The ID is immediately available for re-use now */ _mesa_HashRemove(ctx->Shared->Programs, ids[i]); prog->RefCount--; if (prog->RefCount <= 0) { ctx->Driver.DeleteProgram(ctx, prog); } } } } } /** * Generate a list of new program identifiers. * \note Not compiled into display lists. * \note Called by both glGenProgramsNV and glGenProgramsARB. */ void GLAPIENTRY _mesa_GenPrograms(GLsizei n, GLuint *ids) { GLuint first; GLuint i; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glGenPrograms"); return; } if (!ids) return; first = _mesa_HashFindFreeKeyBlock(ctx->Shared->Programs, n); /* Insert pointer to dummy program as placeholder */ for (i = 0; i < (GLuint) n; i++) { _mesa_HashInsert(ctx->Shared->Programs, first + i, &_mesa_DummyProgram); } /* Return the program names */ for (i = 0; i < (GLuint) n; i++) { ids[i] = first + i; } } /** * Determine if id names a vertex or fragment program. * \note Not compiled into display lists. * \note Called from both glIsProgramNV and glIsProgramARB. * \param id is the program identifier * \return GL_TRUE if id is a program, else GL_FALSE. */ GLboolean GLAPIENTRY _mesa_IsProgram(GLuint id) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (id == 0) return GL_FALSE; if (_mesa_HashLookup(ctx->Shared->Programs, id)) return GL_TRUE; else return GL_FALSE; } /**********************************************************************/ /* GL_MESA_program_debug extension */ /**********************************************************************/ /* XXX temporary */ GLAPI void GLAPIENTRY glProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, GLvoid *data) { _mesa_ProgramCallbackMESA(target, callback, data); } void _mesa_ProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, GLvoid *data) { GET_CURRENT_CONTEXT(ctx); switch (target) { case GL_FRAGMENT_PROGRAM_ARB: if (!ctx->Extensions.ARB_fragment_program) { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); return; } ctx->FragmentProgram.Callback = callback; ctx->FragmentProgram.CallbackData = data; break; case GL_FRAGMENT_PROGRAM_NV: if (!ctx->Extensions.NV_fragment_program) { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); return; } ctx->FragmentProgram.Callback = callback; ctx->FragmentProgram.CallbackData = data; break; case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ if (!ctx->Extensions.ARB_vertex_program && !ctx->Extensions.NV_vertex_program) { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); return; } ctx->VertexProgram.Callback = callback; ctx->VertexProgram.CallbackData = data; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glProgramCallbackMESA(target)"); return; } } /* XXX temporary */ GLAPI void GLAPIENTRY glGetProgramRegisterfvMESA(GLenum target, GLsizei len, const GLubyte *registerName, GLfloat *v) { _mesa_GetProgramRegisterfvMESA(target, len, registerName, v); } void _mesa_GetProgramRegisterfvMESA(GLenum target, GLsizei len, const GLubyte *registerName, GLfloat *v) { char reg[1000]; GET_CURRENT_CONTEXT(ctx); /* We _should_ be inside glBegin/glEnd */ #if 0 if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramRegisterfvMESA"); return; } #endif /* make null-terminated copy of registerName */ len = MIN2((unsigned int) len, sizeof(reg) - 1); _mesa_memcpy(reg, registerName, len); reg[len] = 0; switch (target) { case GL_VERTEX_PROGRAM_NV: if (!ctx->Extensions.ARB_vertex_program && !ctx->Extensions.NV_vertex_program) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramRegisterfvMESA(target)"); return; } if (!ctx->VertexProgram._Enabled) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramRegisterfvMESA"); return; } /* GL_NV_vertex_program */ if (reg[0] == 'R') { /* Temp register */ GLint i = _mesa_atoi(reg + 1); if (i >= (GLint)ctx->Const.MaxVertexProgramTemps) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramRegisterfvMESA(registerName)"); return; } COPY_4V(v, ctx->VertexProgram.Temporaries[i]); } else if (reg[0] == 'v' && reg[1] == '[') { /* Vertex Input attribute */ GLuint i; for (i = 0; i < ctx->Const.MaxVertexProgramAttribs; i++) { const char *name = _mesa_nv_vertex_input_register_name(i); char number[10]; sprintf(number, "%d", i); if (_mesa_strncmp(reg + 2, name, 4) == 0 || _mesa_strncmp(reg + 2, number, _mesa_strlen(number)) == 0) { COPY_4V(v, ctx->VertexProgram.Inputs[i]); return; } } _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramRegisterfvMESA(registerName)"); return; } else if (reg[0] == 'o' && reg[1] == '[') { /* Vertex output attribute */ } /* GL_ARB_vertex_program */ else if (_mesa_strncmp(reg, "vertex.", 7) == 0) { } else { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramRegisterfvMESA(registerName)"); return; } break; case GL_FRAGMENT_PROGRAM_ARB: if (!ctx->Extensions.ARB_fragment_program) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramRegisterfvMESA(target)"); return; } if (!ctx->FragmentProgram._Enabled) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramRegisterfvMESA"); return; } /* XXX to do */ break; case GL_FRAGMENT_PROGRAM_NV: if (!ctx->Extensions.NV_fragment_program) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramRegisterfvMESA(target)"); return; } if (!ctx->FragmentProgram._Enabled) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramRegisterfvMESA"); return; } if (reg[0] == 'R') { /* Temp register */ GLint i = _mesa_atoi(reg + 1); if (i >= (GLint)ctx->Const.MaxFragmentProgramTemps) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramRegisterfvMESA(registerName)"); return; } COPY_4V(v, ctx->FragmentProgram.Machine.Temporaries[i]); } else if (reg[0] == 'f' && reg[1] == '[') { /* Fragment input attribute */ GLuint i; for (i = 0; i < ctx->Const.MaxFragmentProgramAttribs; i++) { const char *name = _mesa_nv_fragment_input_register_name(i); if (_mesa_strncmp(reg + 2, name, 4) == 0) { COPY_4V(v, ctx->FragmentProgram.Machine.Inputs[i]); return; } } _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramRegisterfvMESA(registerName)"); return; } else if (_mesa_strcmp(reg, "o[COLR]") == 0) { /* Fragment output color */ COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_COLR]); } else if (_mesa_strcmp(reg, "o[COLH]") == 0) { /* Fragment output color */ COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_COLH]); } else if (_mesa_strcmp(reg, "o[DEPR]") == 0) { /* Fragment output depth */ COPY_4V(v, ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_DEPR]); } else { /* try user-defined identifiers */ const GLfloat *value = _mesa_lookup_parameter_value( ctx->FragmentProgram.Current->Parameters, -1, reg); if (value) { COPY_4V(v, value); } else { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramRegisterfvMESA(registerName)"); return; } } break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramRegisterfvMESA(target)"); return; } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/program.h0000644000000000000000000001661713614532424020316 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file program.c * Vertex and fragment program support functions. * \author Brian Paul */ /** * \mainpage Mesa vertex and fragment program module * * This module or directory contains most of the code for vertex and * fragment programs and shaders, including state management, parsers, * and (some) software routines for executing programs */ #ifndef PROGRAM_H #define PROGRAM_H #include "mtypes.h" /* for GL_ARB_v_p and GL_ARB_f_p SWZ instruction */ #define SWIZZLE_X 0 #define SWIZZLE_Y 1 #define SWIZZLE_Z 2 #define SWIZZLE_W 3 #define SWIZZLE_ZERO 4 /* keep these values together: KW */ #define SWIZZLE_ONE 5 /* keep these values together: KW */ #define MAKE_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<3) | ((c)<<6) | ((d)<<9)) #define MAKE_SWIZZLE(x) MAKE_SWIZZLE4((x)[0], (x)[1], (x)[2], (x)[3]) #define SWIZZLE_NOOP MAKE_SWIZZLE4(0,1,2,3) #define GET_SWZ(swz, idx) (((swz) >> ((idx)*3)) & 0x7) #define GET_BIT(msk, idx) (((msk) >> (idx)) & 0x1) #define WRITEMASK_X 0x1 #define WRITEMASK_Y 0x2 #define WRITEMASK_XY 0x3 #define WRITEMASK_Z 0x4 #define WRITEMASK_XZ 0x5 #define WRITEMASK_YZ 0x6 #define WRITEMASK_XYZ 0x7 #define WRITEMASK_W 0x8 #define WRITEMASK_XW 0x9 #define WRITEMASK_YW 0xa #define WRITEMASK_XYW 0xb #define WRITEMASK_ZW 0xc #define WRITEMASK_XZW 0xd #define WRITEMASK_YZW 0xe #define WRITEMASK_XYZW 0xf extern struct program _mesa_DummyProgram; /* * Internal functions */ extern void _mesa_init_program(GLcontext *ctx); extern void _mesa_free_program_data(GLcontext *ctx); extern void _mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string); extern const GLubyte * _mesa_find_line_column(const GLubyte *string, const GLubyte *pos, GLint *line, GLint *col); extern struct program * _mesa_init_vertex_program(GLcontext *ctx, struct vertex_program *prog, GLenum target, GLuint id); extern struct program * _mesa_init_fragment_program(GLcontext *ctx, struct fragment_program *prog, GLenum target, GLuint id); extern struct program * _mesa_init_ati_fragment_shader(GLcontext *ctx, struct ati_fragment_shader *prog, GLenum target, GLuint id ); extern struct program * _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id); extern void _mesa_delete_program(GLcontext *ctx, struct program *prog); /* * Used for describing GL state referenced from inside ARB vertex and * fragment programs. * A string such as "state.light[0].ambient" gets translated into a * sequence of tokens such as [ STATE_LIGHT, 0, STATE_AMBIENT ]. */ enum state_index { STATE_MATERIAL, STATE_LIGHT, STATE_LIGHTMODEL_AMBIENT, STATE_LIGHTMODEL_SCENECOLOR, STATE_LIGHTPROD, STATE_TEXGEN, STATE_FOG_COLOR, STATE_FOG_PARAMS, STATE_CLIPPLANE, STATE_POINT_SIZE, STATE_POINT_ATTENUATION, STATE_MATRIX, STATE_MODELVIEW, STATE_PROJECTION, STATE_MVP, STATE_TEXTURE, STATE_PROGRAM, STATE_MATRIX_INVERSE, STATE_MATRIX_TRANSPOSE, STATE_MATRIX_INVTRANS, STATE_AMBIENT, STATE_DIFFUSE, STATE_SPECULAR, STATE_EMISSION, STATE_SHININESS, STATE_HALF, STATE_POSITION, STATE_ATTENUATION, STATE_SPOT_DIRECTION, STATE_TEXGEN_EYE_S, STATE_TEXGEN_EYE_T, STATE_TEXGEN_EYE_R, STATE_TEXGEN_EYE_Q, STATE_TEXGEN_OBJECT_S, STATE_TEXGEN_OBJECT_T, STATE_TEXGEN_OBJECT_R, STATE_TEXGEN_OBJECT_Q, STATE_TEXENV_COLOR, STATE_DEPTH_RANGE, STATE_VERTEX_PROGRAM, STATE_FRAGMENT_PROGRAM, STATE_ENV, STATE_LOCAL, STATE_INTERNAL, /* Mesa additions */ STATE_NORMAL_SCALE, STATE_POSITION_NORMALIZED }; /* * Named program parameters * Used for NV_fragment_program "DEFINE"d constants and "DECLARE"d parameters, * and ARB_fragment_program global state references. For the later, Name * might be "state.light[0].diffuse", for example. */ enum parameter_type { NAMED_PARAMETER, CONSTANT, STATE }; struct program_parameter { const char *Name; /* Null-terminated */ enum parameter_type Type; enum state_index StateIndexes[6]; /* Global state reference */ }; struct program_parameter_list { GLuint Size; GLuint NumParameters; struct program_parameter *Parameters; GLfloat (*ParameterValues)[4]; }; /* * Program parameter functions */ extern struct program_parameter_list * _mesa_new_parameter_list(void); extern void _mesa_free_parameter_list(struct program_parameter_list *paramList); extern void _mesa_free_parameters(struct program_parameter_list *paramList); extern GLint _mesa_add_named_parameter(struct program_parameter_list *paramList, const char *name, const GLfloat values[4]); extern GLint _mesa_add_named_constant(struct program_parameter_list *paramList, const char *name, const GLfloat values[4]); extern GLint _mesa_add_unnamed_constant(struct program_parameter_list *paramList, const GLfloat values[4]); extern GLint _mesa_add_state_reference(struct program_parameter_list *paramList, GLint *stateTokens); extern GLfloat * _mesa_lookup_parameter_value(struct program_parameter_list *paramList, GLsizei nameLen, const char *name); extern GLint _mesa_lookup_parameter_index(struct program_parameter_list *paramList, GLsizei nameLen, const char *name); extern void _mesa_load_state_parameters(GLcontext *ctx, struct program_parameter_list *paramList); /* * API functions */ extern void GLAPIENTRY _mesa_BindProgram(GLenum target, GLuint id); extern void GLAPIENTRY _mesa_DeletePrograms(GLsizei n, const GLuint *ids); extern void GLAPIENTRY _mesa_GenPrograms(GLsizei n, GLuint *ids); extern GLboolean GLAPIENTRY _mesa_IsProgram(GLuint id); /* * GL_MESA_program_debug */ extern void _mesa_ProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, GLvoid *data); extern void _mesa_GetProgramRegisterfvMESA(GLenum target, GLsizei len, const GLubyte *registerName, GLfloat *v); #endif /* PROGRAM_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects_3dlabs.c0000755000000000000000000006317213614532424022713 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file shaderobjects_3dlabs.c * shader objects definitions for 3dlabs compiler * \author Michal Krol */ /* Set this to 1 when we are ready to use 3dlabs' front-end */ #define USE_3DLABS_FRONTEND 0 #include "glheader.h" #include "shaderobjects.h" #include "shaderobjects_3dlabs.h" #include "context.h" #include "macros.h" #include "hash.h" #if USE_3DLABS_FRONTEND #include "slang_mesa.h" #include "Public/ShaderLang.h" #else #include "slang_compile.h" #endif struct gl2_unknown_obj { GLuint reference_count; void (* _destructor) (struct gl2_unknown_intf **); }; struct gl2_unknown_impl { struct gl2_unknown_intf *_vftbl; struct gl2_unknown_obj _obj; }; static void _unknown_destructor (struct gl2_unknown_intf **intf) { } static void _unknown_AddRef (struct gl2_unknown_intf **intf) { struct gl2_unknown_impl *impl = (struct gl2_unknown_impl *) intf; impl->_obj.reference_count++; } static void _unknown_Release (struct gl2_unknown_intf **intf) { struct gl2_unknown_impl *impl = (struct gl2_unknown_impl *) intf; impl->_obj.reference_count--; if (impl->_obj.reference_count == 0) { impl->_obj._destructor (intf); _mesa_free ((void *) intf); } } static struct gl2_unknown_intf ** _unknown_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) { if (uiid == UIID_UNKNOWN) { (**intf).AddRef (intf); return intf; } return NULL; } static struct gl2_unknown_intf _unknown_vftbl = { _unknown_AddRef, _unknown_Release, _unknown_QueryInterface }; static void _unknown_constructor (struct gl2_unknown_impl *impl) { impl->_vftbl = &_unknown_vftbl; impl->_obj.reference_count = 1; impl->_obj._destructor = _unknown_destructor; } struct gl2_unkinner_obj { struct gl2_unknown_intf **unkouter; }; struct gl2_unkinner_impl { struct gl2_unknown_intf *_vftbl; struct gl2_unkinner_obj _obj; }; static void _unkinner_destructor (struct gl2_unknown_intf **intf) { } static void _unkinner_AddRef (struct gl2_unknown_intf **intf) { struct gl2_unkinner_impl *impl = (struct gl2_unkinner_impl *) intf; (**impl->_obj.unkouter).AddRef (impl->_obj.unkouter); } static void _unkinner_Release (struct gl2_unknown_intf **intf) { struct gl2_unkinner_impl *impl = (struct gl2_unkinner_impl *) intf; (**impl->_obj.unkouter).Release (impl->_obj.unkouter); } static struct gl2_unknown_intf ** _unkinner_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) { struct gl2_unkinner_impl *impl = (struct gl2_unkinner_impl *) intf; return (**impl->_obj.unkouter).QueryInterface (impl->_obj.unkouter, uiid); } static struct gl2_unknown_intf _unkinner_vftbl = { _unkinner_AddRef, _unkinner_Release, _unkinner_QueryInterface }; static void _unkinner_constructor (struct gl2_unkinner_impl *impl, struct gl2_unknown_intf **outer) { impl->_vftbl = &_unkinner_vftbl; impl->_obj.unkouter = outer; } struct gl2_generic_obj { struct gl2_unknown_obj _unknown; GLhandleARB name; GLboolean delete_status; GLcharARB *info_log; }; struct gl2_generic_impl { struct gl2_generic_intf *_vftbl; struct gl2_generic_obj _obj; }; static void _generic_destructor (struct gl2_unknown_intf **intf) { GET_CURRENT_CONTEXT(ctx); struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf; _mesa_free ((void *) impl->_obj.info_log); _glthread_LOCK_MUTEX (ctx->Shared->Mutex); _mesa_HashRemove (ctx->Shared->GL2Objects, impl->_obj.name); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); _unknown_destructor (intf); } static struct gl2_unknown_intf ** _generic_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) { if (uiid == UIID_GENERIC) { (**intf).AddRef (intf); return intf; } return _unknown_QueryInterface (intf, uiid); } static void _generic_Delete (struct gl2_generic_intf **intf) { struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf; if (impl->_obj.delete_status == GL_FALSE) { impl->_obj.delete_status = GL_TRUE; (**intf)._unknown.Release ((struct gl2_unknown_intf **) intf); } } static GLhandleARB _generic_GetName (struct gl2_generic_intf **intf) { struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf; return impl->_obj.name; } static GLboolean _generic_GetDeleteStatus (struct gl2_generic_intf **intf) { struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf; return impl->_obj.delete_status; } static const GLcharARB * _generic_GetInfoLog (struct gl2_generic_intf **intf) { struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf; return impl->_obj.info_log; } static struct gl2_generic_intf _generic_vftbl = { { _unknown_AddRef, _unknown_Release, _generic_QueryInterface }, _generic_Delete, NULL, /* abstract GetType */ _generic_GetName, _generic_GetDeleteStatus, _generic_GetInfoLog }; static void _generic_constructor (struct gl2_generic_impl *impl) { GET_CURRENT_CONTEXT(ctx); _unknown_constructor ((struct gl2_unknown_impl *) impl); impl->_vftbl = &_generic_vftbl; impl->_obj._unknown._destructor = _generic_destructor; impl->_obj.delete_status = GL_FALSE; impl->_obj.info_log = NULL; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); impl->_obj.name = _mesa_HashFindFreeKeyBlock (ctx->Shared->GL2Objects, 1); _mesa_HashInsert (ctx->Shared->GL2Objects, impl->_obj.name, (void *) impl); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); } struct gl2_container_obj { struct gl2_generic_obj _generic; struct gl2_generic_intf ***attached; GLuint attached_count; }; struct gl2_container_impl { struct gl2_container_intf *_vftbl; struct gl2_container_obj _obj; }; static void _container_destructor (struct gl2_unknown_intf **intf) { struct gl2_container_impl *impl = (struct gl2_container_impl *) intf; GLuint i; for (i = 0; i < impl->_obj.attached_count; i++) { struct gl2_generic_intf **x = impl->_obj.attached[i]; (**x)._unknown.Release ((struct gl2_unknown_intf **) x); } _generic_destructor (intf); } static struct gl2_unknown_intf ** _container_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) { if (uiid == UIID_CONTAINER) { (**intf).AddRef (intf); return intf; } return _generic_QueryInterface (intf, uiid); } static GLboolean _container_Attach (struct gl2_container_intf **intf, struct gl2_generic_intf **att) { GET_CURRENT_CONTEXT(ctx); struct gl2_container_impl *impl = (struct gl2_container_impl *) intf; GLuint i; for (i = 0; i < impl->_obj.attached_count; i++) if (impl->_obj.attached[i] == att) { _mesa_error (ctx, GL_INVALID_OPERATION, "_container_Attach"); return GL_FALSE; } impl->_obj.attached = (struct gl2_generic_intf ***) _mesa_realloc (impl->_obj.attached, impl->_obj.attached_count * sizeof (*impl->_obj.attached), (impl->_obj.attached_count + 1) * sizeof (*impl->_obj.attached)); if (impl->_obj.attached == NULL) return GL_FALSE; impl->_obj.attached[impl->_obj.attached_count] = att; impl->_obj.attached_count++; (**att)._unknown.AddRef ((struct gl2_unknown_intf **) att); return GL_TRUE; } static GLboolean _container_Detach (struct gl2_container_intf **intf, struct gl2_generic_intf **att) { GET_CURRENT_CONTEXT(ctx); struct gl2_container_impl *impl = (struct gl2_container_impl *) intf; GLuint i, j; for (i = 0; i < impl->_obj.attached_count; i++) if (impl->_obj.attached[i] == att) { for (j = i; j < impl->_obj.attached_count - 1; j++) impl->_obj.attached[j] = impl->_obj.attached[j + 1]; impl->_obj.attached = (struct gl2_generic_intf ***) _mesa_realloc (impl->_obj.attached, impl->_obj.attached_count * sizeof (*impl->_obj.attached), (impl->_obj.attached_count - 1) * sizeof (*impl->_obj.attached)); impl->_obj.attached_count--; (**att)._unknown.Release ((struct gl2_unknown_intf **) att); return GL_TRUE; } _mesa_error (ctx, GL_INVALID_OPERATION, "_container_Detach"); return GL_FALSE; } static GLsizei _container_GetAttachedCount (struct gl2_container_intf **intf) { struct gl2_container_impl *impl = (struct gl2_container_impl *) intf; return impl->_obj.attached_count; } static struct gl2_generic_intf ** _container_GetAttached (struct gl2_container_intf **intf, GLuint index) { struct gl2_container_impl *impl = (struct gl2_container_impl *) intf; (**impl->_obj.attached[index])._unknown.AddRef ( (struct gl2_unknown_intf **)impl->_obj.attached[index]); return impl->_obj.attached[index]; } static struct gl2_container_intf _container_vftbl = { { { _unknown_AddRef, _unknown_Release, _container_QueryInterface }, _generic_Delete, NULL, /* abstract GetType */ _generic_GetName, _generic_GetDeleteStatus, _generic_GetInfoLog }, _container_Attach, _container_Detach, _container_GetAttachedCount, _container_GetAttached }; static void _container_constructor (struct gl2_container_impl *impl) { _generic_constructor ((struct gl2_generic_impl *) impl); impl->_vftbl = &_container_vftbl; impl->_obj._generic._unknown._destructor = _container_destructor; impl->_obj.attached = NULL; impl->_obj.attached_count = 0; } struct gl2_3dlabs_shhandle_obj { struct gl2_unkinner_obj _unknown; #if USE_3DLABS_FRONTEND ShHandle handle; #endif }; struct gl2_3dlabs_shhandle_impl { struct gl2_3dlabs_shhandle_intf *_vftbl; struct gl2_3dlabs_shhandle_obj _obj; }; static void _3dlabs_shhandle_destructor (struct gl2_unknown_intf **intf) { #if USE_3DLABS_FRONTEND struct gl2_3dlabs_shhandle_impl *impl = (struct gl2_3dlabs_shhandle_impl *) intf; ShDestruct (impl->_obj.handle); #endif _unkinner_destructor (intf); } static GLvoid * _3dlabs_shhandle_GetShHandle (struct gl2_3dlabs_shhandle_intf **intf) { #if USE_3DLABS_FRONTEND struct gl2_3dlabs_shhandle_impl *impl = (struct gl2_3dlabs_shhandle_impl *) intf; return impl->_obj.handle; #else return NULL; #endif } static struct gl2_3dlabs_shhandle_intf _3dlabs_shhandle_vftbl = { { _unkinner_AddRef, _unkinner_Release, _unkinner_QueryInterface }, _3dlabs_shhandle_GetShHandle }; static void _3dlabs_shhandle_constructor (struct gl2_3dlabs_shhandle_impl *impl, struct gl2_unknown_intf **outer) { _unkinner_constructor ((struct gl2_unkinner_impl *) impl, outer); impl->_vftbl = &_3dlabs_shhandle_vftbl; #if USE_3DLABS_FRONTEND impl->_obj.handle = NULL; #endif } struct gl2_shader_obj { struct gl2_generic_obj _generic; struct gl2_3dlabs_shhandle_impl _3dlabs_shhandle; GLboolean compile_status; GLcharARB *source; GLint *offsets; GLsizei offset_count; }; struct gl2_shader_impl { struct gl2_shader_intf *_vftbl; struct gl2_shader_obj _obj; }; static void _shader_destructor (struct gl2_unknown_intf **intf) { struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf; _mesa_free ((void *) impl->_obj.source); _mesa_free ((void *) impl->_obj.offsets); _3dlabs_shhandle_destructor ((struct gl2_unknown_intf **) &impl->_obj._3dlabs_shhandle._vftbl); _generic_destructor (intf); } static struct gl2_unknown_intf ** _shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) { #if USE_3DLABS_FRONTEND struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf; #endif if (uiid == UIID_SHADER) { (**intf).AddRef (intf); return intf; } #if USE_3DLABS_FRONTEND if (uiid == UIID_3DLABS_SHHANDLE) { (**intf).AddRef (intf); return (struct gl2_unknown_intf **) &impl->_obj._3dlabs_shhandle._vftbl; } #endif return _generic_QueryInterface (intf, uiid); } static GLenum _shader_GetType (struct gl2_generic_intf **intf) { return GL_SHADER_OBJECT_ARB; } static GLboolean _shader_GetCompileStatus (struct gl2_shader_intf **intf) { struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf; return impl->_obj.compile_status; } static GLvoid _shader_SetSource (struct gl2_shader_intf **intf, GLcharARB *src, GLint *off, GLsizei cnt) { struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf; _mesa_free ((void *) impl->_obj.source); impl->_obj.source = src; _mesa_free ((void *) impl->_obj.offsets); impl->_obj.offsets = off; impl->_obj.offset_count = cnt; } static const GLcharARB * _shader_GetSource (struct gl2_shader_intf **intf) { struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf; return impl->_obj.source; } static GLvoid _shader_Compile (struct gl2_shader_intf **intf) { struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf; #if USE_3DLABS_FRONTEND char **strings; TBuiltInResource res; #else slang_translation_unit unit; slang_unit_type type; slang_info_log info_log; #endif impl->_obj.compile_status = GL_FALSE; _mesa_free ((void *) impl->_obj._generic.info_log); impl->_obj._generic.info_log = NULL; #if USE_3DLABS_FRONTEND /* 3dlabs compiler expects us to feed it with null-terminated string array, we've got only one big string with offsets, so we must split it; but when there's only one string to deal with, we pass its address directly */ if (impl->_obj.offset_count <= 1) strings = &impl->_obj.source; else { GLsizei i, offset = 0; strings = (char **) _mesa_malloc (impl->_obj.offset_count * sizeof (char *)); if (strings == NULL) return; for (i = 0; i < impl->_obj.offset_count; i++) { GLsizei size = impl->_obj.offsets[i] - offset; strings[i] = (char *) _mesa_malloc ((size + 1) * sizeof (char)); if (strings[i] == NULL) { GLsizei j; for (j = 0; j < i; j++) _mesa_free (strings[j]); _mesa_free (strings); return; } _mesa_memcpy (strings[i], impl->_obj.source + offset, size * sizeof (char)); strings[i][size] = '\0'; offset = impl->_obj.offsets[i]; } } /* TODO set these fields to some REAL numbers */ res.maxLights = 8; res.maxClipPlanes = 6; res.maxTextureUnits = 2; res.maxTextureCoords = 2; res.maxVertexAttribs = 8; res.maxVertexUniformComponents = 64; res.maxVaryingFloats = 8; res.maxVertexTextureImageUnits = 2; res.maxCombinedTextureImageUnits = 2; res.maxTextureImageUnits = 2; res.maxFragmentUniformComponents = 64; res.maxDrawBuffers = 1; if (ShCompile (impl->_obj._3dlabs_shhandle._obj.handle, strings, impl->_obj.offset_count, EShOptFull, &res, 0)) impl->_obj.compile_status = GL_TRUE; if (impl->_obj.offset_count > 1) { GLsizei i; for (i = 0; i < impl->_obj.offset_count; i++) _mesa_free (strings[i]); _mesa_free (strings); } impl->_obj._generic.info_log = _mesa_strdup (ShGetInfoLog ( impl->_obj._3dlabs_shhandle._obj.handle)); #else if (impl->_vftbl->GetSubType (intf) == GL_FRAGMENT_SHADER) type = slang_unit_fragment_shader; else type = slang_unit_vertex_shader; slang_info_log_construct (&info_log); if (_slang_compile (impl->_obj.source, &unit, type, &info_log)) { impl->_obj.compile_status = GL_TRUE; } if (info_log.text != NULL) impl->_obj._generic.info_log = _mesa_strdup (info_log.text); else impl->_obj._generic.info_log = _mesa_strdup (""); slang_info_log_destruct (&info_log); #endif } static struct gl2_shader_intf _shader_vftbl = { { { _unknown_AddRef, _unknown_Release, _shader_QueryInterface }, _generic_Delete, _shader_GetType, _generic_GetName, _generic_GetDeleteStatus, _generic_GetInfoLog }, NULL, /* abstract GetSubType */ _shader_GetCompileStatus, _shader_SetSource, _shader_GetSource, _shader_Compile }; static void _shader_constructor (struct gl2_shader_impl *impl) { _generic_constructor ((struct gl2_generic_impl *) impl); _3dlabs_shhandle_constructor (&impl->_obj._3dlabs_shhandle, (struct gl2_unknown_intf **) &impl->_vftbl); impl->_vftbl = &_shader_vftbl; impl->_obj._generic._unknown._destructor = _shader_destructor; impl->_obj.compile_status = GL_FALSE; impl->_obj.source = NULL; impl->_obj.offsets = NULL; impl->_obj.offset_count = 0; } struct gl2_program_obj { struct gl2_container_obj _container; GLboolean link_status; GLboolean validate_status; #if USE_3DLABS_FRONTEND ShHandle linker; ShHandle uniforms; #endif }; struct gl2_program_impl { struct gl2_program_intf *_vftbl; struct gl2_program_obj _obj; }; static void _program_destructor (struct gl2_unknown_intf **intf) { #if USE_3DLABS_FRONTEND struct gl2_program_impl *impl = (struct gl2_program_impl *) intf; ShDestruct (impl->_obj.linker); ShDestruct (impl->_obj.uniforms); #endif _container_destructor (intf); } static struct gl2_unknown_intf ** _program_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) { if (uiid == UIID_PROGRAM) { (**intf).AddRef (intf); return intf; } return _container_QueryInterface (intf, uiid); } static GLenum _program_GetType (struct gl2_generic_intf **intf) { return GL_PROGRAM_OBJECT_ARB; } static GLboolean _program_Attach (struct gl2_container_intf **intf, struct gl2_generic_intf **att) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **sha; sha = (**att)._unknown.QueryInterface ((struct gl2_unknown_intf **) att, UIID_SHADER); if (sha == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "_program_Attach"); return GL_FALSE; } (**sha).Release (sha); return _container_Attach (intf, att); } static GLboolean _program_GetLinkStatus (struct gl2_program_intf **intf) { struct gl2_program_impl *impl = (struct gl2_program_impl *) intf; return impl->_obj.link_status; } static GLboolean _program_GetValidateStatus (struct gl2_program_intf **intf) { struct gl2_program_impl *impl = (struct gl2_program_impl *) intf; return impl->_obj.validate_status; } static GLvoid _program_Link (struct gl2_program_intf **intf) { struct gl2_program_impl *impl = (struct gl2_program_impl *) intf; #if USE_3DLABS_FRONTEND ShHandle *handles; GLuint i; #endif impl->_obj.link_status = GL_FALSE; _mesa_free ((void *) impl->_obj._container._generic.info_log); impl->_obj._container._generic.info_log = NULL; #if USE_3DLABS_FRONTEND handles = (ShHandle *) _mesa_malloc (impl->_obj._container.attached_count * sizeof (ShHandle)); if (handles == NULL) return; for (i = 0; i < impl->_obj._container.attached_count; i++) { struct gl2_generic_intf **gen = impl->_obj._container.attached[i]; struct gl2_3dlabs_shhandle_intf **sh; sh = (struct gl2_3dlabs_shhandle_intf **) (**gen)._unknown.QueryInterface ( (struct gl2_unknown_intf **) gen, UIID_3DLABS_SHHANDLE); if (sh != NULL) { handles[i] = (**sh).GetShHandle (sh); (**sh)._unknown.Release ((struct gl2_unknown_intf **) sh); } else { _mesa_free (handles); return; } } if (ShLink (impl->_obj.linker, handles, impl->_obj._container.attached_count, impl->_obj.uniforms, NULL, NULL)) impl->_obj.link_status = GL_TRUE; impl->_obj._container._generic.info_log = _mesa_strdup (ShGetInfoLog (impl->_obj.linker)); #endif } static GLvoid _program_Validate (struct gl2_program_intf **intf) { struct gl2_program_impl *impl = (struct gl2_program_impl *) intf; impl->_obj.validate_status = GL_FALSE; _mesa_free ((void *) impl->_obj._container._generic.info_log); impl->_obj._container._generic.info_log = NULL; /* TODO validate */ } static struct gl2_program_intf _program_vftbl = { { { { _unknown_AddRef, _unknown_Release, _program_QueryInterface }, _generic_Delete, _program_GetType, _generic_GetName, _generic_GetDeleteStatus, _generic_GetInfoLog }, _program_Attach, _container_Detach, _container_GetAttachedCount, _container_GetAttached }, _program_GetLinkStatus, _program_GetValidateStatus, _program_Link, _program_Validate }; static void _program_constructor (struct gl2_program_impl *impl) { _container_constructor ((struct gl2_container_impl *) impl); impl->_vftbl = &_program_vftbl; impl->_obj._container._generic._unknown._destructor = _program_destructor; impl->_obj.link_status = GL_FALSE; impl->_obj.validate_status = GL_FALSE; #if USE_3DLABS_FRONTEND impl->_obj.linker = ShConstructLinker (EShExVertexFragment, 0); impl->_obj.uniforms = ShConstructUniformMap (); #endif } struct gl2_fragment_shader_obj { struct gl2_shader_obj _shader; }; struct gl2_fragment_shader_impl { struct gl2_fragment_shader_intf *_vftbl; struct gl2_fragment_shader_obj _obj; }; static void _fragment_shader_destructor (struct gl2_unknown_intf **intf) { struct gl2_fragment_shader_impl *impl = (struct gl2_fragment_shader_impl *) intf; (void) impl; /* TODO free fragment shader data */ _shader_destructor (intf); } static struct gl2_unknown_intf ** _fragment_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) { if (uiid == UIID_FRAGMENT_SHADER) { (**intf).AddRef (intf); return intf; } return _shader_QueryInterface (intf, uiid); } static GLenum _fragment_shader_GetSubType (struct gl2_shader_intf **intf) { return GL_FRAGMENT_SHADER_ARB; } static struct gl2_fragment_shader_intf _fragment_shader_vftbl = { { { { _unknown_AddRef, _unknown_Release, _fragment_shader_QueryInterface }, _generic_Delete, _shader_GetType, _generic_GetName, _generic_GetDeleteStatus, _generic_GetInfoLog }, _fragment_shader_GetSubType, _shader_GetCompileStatus, _shader_SetSource, _shader_GetSource, _shader_Compile } }; static void _fragment_shader_constructor (struct gl2_fragment_shader_impl *impl) { _shader_constructor ((struct gl2_shader_impl *) impl); impl->_vftbl = &_fragment_shader_vftbl; impl->_obj._shader._generic._unknown._destructor = _fragment_shader_destructor; #if USE_3DLABS_FRONTEND impl->_obj._shader._3dlabs_shhandle._obj.handle = ShConstructCompiler (EShLangFragment, 0); #endif } struct gl2_vertex_shader_obj { struct gl2_shader_obj _shader; }; struct gl2_vertex_shader_impl { struct gl2_vertex_shader_intf *_vftbl; struct gl2_vertex_shader_obj _obj; }; static void _vertex_shader_destructor (struct gl2_unknown_intf **intf) { struct gl2_vertex_shader_impl *impl = (struct gl2_vertex_shader_impl *) intf; (void) impl; /* TODO free vertex shader data */ _shader_destructor (intf); } static struct gl2_unknown_intf ** _vertex_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid) { if (uiid == UIID_VERTEX_SHADER) { (**intf).AddRef (intf); return intf; } return _shader_QueryInterface (intf, uiid); } static GLenum _vertex_shader_GetSubType (struct gl2_shader_intf **intf) { return GL_VERTEX_SHADER_ARB; } static struct gl2_vertex_shader_intf _vertex_shader_vftbl = { { { { _unknown_AddRef, _unknown_Release, _vertex_shader_QueryInterface }, _generic_Delete, _shader_GetType, _generic_GetName, _generic_GetDeleteStatus, _generic_GetInfoLog }, _vertex_shader_GetSubType, _shader_GetCompileStatus, _shader_SetSource, _shader_GetSource, _shader_Compile } }; static void _vertex_shader_constructor (struct gl2_vertex_shader_impl *impl) { _shader_constructor ((struct gl2_shader_impl *) impl); impl->_vftbl = &_vertex_shader_vftbl; impl->_obj._shader._generic._unknown._destructor = _vertex_shader_destructor; #if USE_3DLABS_FRONTEND impl->_obj._shader._3dlabs_shhandle._obj.handle = ShConstructCompiler (EShLangVertex, 0); #endif } GLhandleARB _mesa_3dlabs_create_shader_object (GLenum shaderType) { switch (shaderType) { case GL_FRAGMENT_SHADER_ARB: { struct gl2_fragment_shader_impl *x = (struct gl2_fragment_shader_impl *) _mesa_malloc (sizeof (struct gl2_fragment_shader_impl)); if (x != NULL) { _fragment_shader_constructor (x); return x->_obj._shader._generic.name; } } break; case GL_VERTEX_SHADER_ARB: { struct gl2_vertex_shader_impl *x = (struct gl2_vertex_shader_impl *) _mesa_malloc (sizeof (struct gl2_vertex_shader_impl)); if (x != NULL) { _vertex_shader_constructor (x); return x->_obj._shader._generic.name; } } break; } return 0; } GLhandleARB _mesa_3dlabs_create_program_object (void) { struct gl2_program_impl *x = (struct gl2_program_impl *) _mesa_malloc (sizeof (struct gl2_program_impl)); if (x != NULL) { _program_constructor (x); return x->_obj._container._generic.name; } return 0; } void _mesa_init_shaderobjects_3dlabs (GLcontext *ctx) { #if USE_3DLABS_FRONTEND _glslang_3dlabs_InitProcess (); _glslang_3dlabs_ShInitialize (); #endif } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects_3dlabs.h0000755000000000000000000000271713614532424022716 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef SHADEROBJECTS_3DLABS_H #define SHADEROBJECTS_3DLABS_H #include "mtypes.h" extern GLhandleARB _mesa_3dlabs_create_shader_object (GLenum); extern GLhandleARB _mesa_3dlabs_create_program_object (void); extern void _mesa_init_shaderobjects_3dlabs (GLcontext *ctx); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects.c0000644000000000000000000007357213614532424021465 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2004-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file shaderobjects.c * ARB_shader_objects state management functions * \author Michal Krol */ #include "glheader.h" #include "shaderobjects.h" #include "shaderobjects_3dlabs.h" #include "context.h" #include "macros.h" #include "hash.h" void GLAPIENTRY _mesa_DeleteObjectARB (GLhandleARB obj) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_generic_intf **gen; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glDeleteObjectARB"); return; } gen = (struct gl2_generic_intf **) (**unk).QueryInterface (unk, UIID_GENERIC); if (gen == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glDeleteObjectARB"); return; } (**gen).Delete (gen); (**gen)._unknown.Release ((struct gl2_unknown_intf **) gen); } GLhandleARB GLAPIENTRY _mesa_GetHandleARB (GLenum pname) { GET_CURRENT_CONTEXT(ctx); switch (pname) { case GL_PROGRAM_OBJECT_ARB: if (ctx->ShaderObjects.current_program != NULL) return (**ctx->ShaderObjects.current_program)._container._generic.GetName ( (struct gl2_generic_intf **) ctx->ShaderObjects.current_program); break; } return 0; } void GLAPIENTRY _mesa_DetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unkc, **unka; struct gl2_container_intf **con; struct gl2_generic_intf **att; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unkc = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, containerObj); unka = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, attachedObj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unkc == NULL || unka == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glDetachObjectARB"); return; } con = (struct gl2_container_intf **) (**unkc).QueryInterface (unkc, UIID_CONTAINER); if (con == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glDetachObjectARB"); return; } att = (struct gl2_generic_intf **) (**unka).QueryInterface (unka, UIID_GENERIC); if (att == NULL) { (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con); _mesa_error (ctx, GL_INVALID_VALUE, "glDetachObjectARB"); return; } if ((**con).Detach (con, att) == GL_FALSE) { (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con); (**att)._unknown.Release ((struct gl2_unknown_intf **) att); return; } (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con); (**att)._unknown.Release ((struct gl2_unknown_intf **) att); } GLhandleARB GLAPIENTRY _mesa_CreateShaderObjectARB (GLenum shaderType) { return _mesa_3dlabs_create_shader_object (shaderType); } void GLAPIENTRY _mesa_ShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_shader_intf **sha; GLint *offsets; GLsizei i; GLcharARB *source; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, shaderObj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glShaderSourceARB"); return; } sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER); if (sha == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glShaderSourceARB"); return; } /* this array holds offsets of where the appropriate string ends, thus the last element will be set to the total length of the source code */ offsets = (GLint *) _mesa_malloc (count * sizeof (GLint)); if (offsets == NULL) { (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha); _mesa_error (ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB"); return; } for (i = 0; i < count; i++) { if (length == NULL || length[i] < 0) offsets[i] = _mesa_strlen (string[i]); else offsets[i] = length[i]; /* accumulate string lengths */ if (i > 0) offsets[i] += offsets[i - 1]; } source = (GLcharARB *) _mesa_malloc ((offsets[count - 1] + 1) * sizeof (GLcharARB)); if (source == NULL) { _mesa_free ((void *) offsets); (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha); _mesa_error (ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB"); return; } for (i = 0; i < count; i++) { GLint start = (i > 0) ? offsets[i - 1] : 0; _mesa_memcpy (source + start, string[i], (offsets[i] - start) * sizeof (GLcharARB)); } source[offsets[count - 1]] = '\0'; (**sha).SetSource (sha, source, offsets, count); (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha); } void GLAPIENTRY _mesa_CompileShaderARB (GLhandleARB shaderObj) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_shader_intf **sha; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, shaderObj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glCompileShaderARB"); return; } sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER); if (sha == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glCompileShaderARB"); return; } (**sha).Compile (sha); (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha); } GLhandleARB GLAPIENTRY _mesa_CreateProgramObjectARB (void) { return _mesa_3dlabs_create_program_object (); } void GLAPIENTRY _mesa_AttachObjectARB (GLhandleARB containerObj, GLhandleARB obj) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unkc, **unka; struct gl2_container_intf **con; struct gl2_generic_intf **att; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unkc = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, containerObj); unka = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unkc == NULL || unka == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glAttachObjectARB"); return; } con = (struct gl2_container_intf **) (**unkc).QueryInterface (unkc, UIID_CONTAINER); if (con == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glAttachObjectARB"); return; } att = (struct gl2_generic_intf **) (**unka).QueryInterface (unka, UIID_GENERIC); if (att == NULL) { (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con); _mesa_error (ctx, GL_INVALID_VALUE, "glAttachObjectARB"); return; } if (!(**con).Attach (con, att)) { (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con); (**att)._unknown.Release ((struct gl2_unknown_intf **) att); return; } (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con); (**att)._unknown.Release ((struct gl2_unknown_intf **) att); } void GLAPIENTRY _mesa_LinkProgramARB (GLhandleARB programObj) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_program_intf **pro; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glLinkProgramARB"); return; } pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); if (pro == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glLinkProgramARB"); return; } if (pro == ctx->ShaderObjects.current_program) { /* TODO re-install executable program */ } (**pro).Link (pro); (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); } void GLAPIENTRY _mesa_UseProgramObjectARB (GLhandleARB programObj) { GET_CURRENT_CONTEXT(ctx); struct gl2_program_intf **pro; if (programObj == 0) { pro = NULL; } else { struct gl2_unknown_intf **unk; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glUseProgramObjectARB"); return; } pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); if (pro == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUseProgramObjectARB"); return; } if ((**pro).GetLinkStatus (pro) == GL_FALSE) { (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); _mesa_error (ctx, GL_INVALID_OPERATION, "glUseProgramObjectARB"); return; } } if (ctx->ShaderObjects.current_program != NULL) { (**ctx->ShaderObjects.current_program)._container._generic._unknown.Release ( (struct gl2_unknown_intf **) ctx->ShaderObjects.current_program); } ctx->ShaderObjects.current_program = pro; } void GLAPIENTRY _mesa_ValidateProgramARB (GLhandleARB programObj) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_program_intf **pro; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glValidateProgramARB"); return; } pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); if (pro == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glValidateProgramARB"); return; } (**pro).Validate (pro); (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); } /* Errors TODO The error INVALID_OPERATION is generated by the Uniform*ARB if the number of values loaded results in exceeding the declared extent of a uniform. The error INVALID_OPERATION is generated by the Uniform*ARB commands if the size does not match the size of the uniform declared in the shader. The error INVALID_OPERATION is generated by the Uniform*ARB commands if the type does not match the type of the uniform declared in the shader, if the uniform is not of type Boolean. The error INVALID_OPERATION is generated by the Uniform*ARB commands if does not exist for the program object currently in use. The error INVALID_OPERATION is generated if a uniform command other than Uniform1i{v}ARB is used to load a sampler value. */ void GLAPIENTRY _mesa_Uniform1fARB (GLint location, GLfloat v0) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1fARB"); return; } } void GLAPIENTRY _mesa_Uniform2fARB (GLint location, GLfloat v0, GLfloat v1) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2fARB"); return; } } void GLAPIENTRY _mesa_Uniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3fARB"); return; } } void GLAPIENTRY _mesa_Uniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4fARB"); return; } } void GLAPIENTRY _mesa_Uniform1iARB (GLint location, GLint v0) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1iARB"); return; } } void GLAPIENTRY _mesa_Uniform2iARB (GLint location, GLint v0, GLint v1) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2iARB"); return; } } void GLAPIENTRY _mesa_Uniform3iARB (GLint location, GLint v0, GLint v1, GLint v2) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3iARB"); return; } } void GLAPIENTRY _mesa_Uniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4iARB"); return; } } void GLAPIENTRY _mesa_Uniform1fvARB (GLint location, GLsizei count, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1fvARB"); return; } } void GLAPIENTRY _mesa_Uniform2fvARB (GLint location, GLsizei count, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2fvARB"); return; } } void GLAPIENTRY _mesa_Uniform3fvARB (GLint location, GLsizei count, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3fvARB"); return; } } void GLAPIENTRY _mesa_Uniform4fvARB (GLint location, GLsizei count, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4fvARB"); return; } } void GLAPIENTRY _mesa_Uniform1ivARB (GLint location, GLsizei count, const GLint *value) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1ivARB"); return; } } void GLAPIENTRY _mesa_Uniform2ivARB (GLint location, GLsizei count, const GLint *value) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2ivARB"); return; } } void GLAPIENTRY _mesa_Uniform3ivARB (GLint location, GLsizei count, const GLint *value) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3ivARB"); return; } } void GLAPIENTRY _mesa_Uniform4ivARB (GLint location, GLsizei count, const GLint *value) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4ivARB"); return; } } void GLAPIENTRY _mesa_UniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniformMatrix2fvARB"); return; } } void GLAPIENTRY _mesa_UniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniformMatrix3fvARB"); return; } } void GLAPIENTRY _mesa_UniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GET_CURRENT_CONTEXT(ctx); if (ctx->ShaderObjects.current_program == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glUniformMatrix4fvARB"); return; } } static GLboolean _mesa_get_object_parameter (GLhandleARB obj, GLenum pname, GLvoid *params, GLboolean *integral, GLint *size) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_generic_intf **gen; struct gl2_shader_intf **sha; struct gl2_program_intf **pro; GLint *ipar = (GLint *) params; /*GLfloat *fpar = (GLfloat *) params;*/ GLboolean success = GL_TRUE; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glGetObjectParameterivARB"); return GL_FALSE; } gen = (struct gl2_generic_intf **) (**unk).QueryInterface (unk, UIID_GENERIC); if (gen == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); return GL_FALSE; } sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER); pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); /* set default values */ *integral = GL_TRUE; /* indicates param type, TRUE: GLint, FALSE: GLfloat */ *size = 1; /* param array size */ switch (pname) { case GL_OBJECT_TYPE_ARB: *ipar = (**gen).GetType (gen); break; case GL_OBJECT_SUBTYPE_ARB: if (sha != NULL) *ipar = (**sha).GetSubType (sha); else { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); success = GL_FALSE; } break; case GL_OBJECT_DELETE_STATUS_ARB: *ipar = (**gen).GetDeleteStatus (gen); break; case GL_OBJECT_COMPILE_STATUS_ARB: if (sha != NULL) *ipar = (**sha).GetCompileStatus (sha); else { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); success = GL_FALSE; } break; case GL_OBJECT_LINK_STATUS_ARB: if (pro != NULL) *ipar = (**pro).GetLinkStatus (pro); else { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); success = GL_FALSE; } break; case GL_OBJECT_VALIDATE_STATUS_ARB: if (pro != NULL) *ipar = (**pro).GetValidateStatus (pro); else { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); success = GL_FALSE; } break; case GL_OBJECT_INFO_LOG_LENGTH_ARB: { const GLcharARB *info = (**gen).GetInfoLog (gen); if (info == NULL) *ipar = 0; else *ipar = _mesa_strlen (info) + 1; } break; case GL_OBJECT_ATTACHED_OBJECTS_ARB: if (pro != NULL) *ipar = (**pro)._container.GetAttachedCount ((struct gl2_container_intf **) pro); else { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); success = GL_FALSE; } break; case GL_OBJECT_ACTIVE_UNIFORMS_ARB: if (pro != NULL) *ipar = 0; /* TODO */ else { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); success = GL_FALSE; } break; case GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB: if (pro != NULL) *ipar = 0; /* TODO */ else { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); success = GL_FALSE; } break; case GL_OBJECT_SHADER_SOURCE_LENGTH_ARB: if (sha != NULL) { const GLcharARB *src = (**sha).GetSource (sha); if (src == NULL) *ipar = 0; else *ipar = _mesa_strlen (src) + 1; } else { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB"); success = GL_FALSE; } break; default: _mesa_error (ctx, GL_INVALID_ENUM, "glGetObjectParameterivARB"); success = GL_FALSE; break; } (**gen)._unknown.Release ((struct gl2_unknown_intf **) gen); if (sha != NULL) (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha); if (pro != NULL) (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); return success; } void GLAPIENTRY _mesa_GetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params) { GLboolean integral; GLint size, i; assert (sizeof (GLfloat) == sizeof (GLint)); if (_mesa_get_object_parameter (obj, pname, (GLvoid *) params, &integral, &size) != GL_FALSE) if (integral != GL_FALSE) for (i = 0; i < size; i++) params[i] = (GLfloat) ((GLint *) params)[i]; } void GLAPIENTRY _mesa_GetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params) { GLboolean integral; GLint size, i; assert (sizeof (GLfloat) == sizeof (GLint)); if (_mesa_get_object_parameter (obj, pname, (GLvoid *) params, &integral, &size) != GL_FALSE) if (integral == GL_FALSE) for (i = 0; i < size; i++) params[i] = (GLint) ((GLfloat *) params)[i]; } static void _mesa_get_string (const GLcharARB *src, GLsizei maxLength, GLsizei *length, GLcharARB *str) { GLsizei len; if (src == NULL) src = ""; len = _mesa_strlen (src); if (len > maxLength) { len = maxLength; /* allocate space for null termination */ if (len > 0) len--; } _mesa_memcpy (str, src, len * sizeof (GLcharARB)); if (maxLength > 0) str[len] = '\0'; if (length != NULL) *length = len; } void GLAPIENTRY _mesa_GetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_generic_intf **gen; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glGetInfoLogARB"); return; } gen = (struct gl2_generic_intf **) (**unk).QueryInterface (unk, UIID_GENERIC); if (gen == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetInfoLogARB"); return; } _mesa_get_string ((**gen).GetInfoLog (gen), maxLength, length, infoLog); (**gen)._unknown.Release ((struct gl2_unknown_intf **) gen); } void GLAPIENTRY _mesa_GetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_container_intf **con; GLsizei cnt, i; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, containerObj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glGetAttachedObjectsARB"); return; } con = (struct gl2_container_intf **) (**unk).QueryInterface (unk, UIID_CONTAINER); if (con == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetAttachedObjectsARB"); return; } cnt = (**con).GetAttachedCount (con); if (cnt > maxCount) cnt = maxCount; for (i = 0; i < cnt; i++) { struct gl2_generic_intf **x = (**con).GetAttached (con, i); obj[i] = (**x).GetName (x); (**x)._unknown.Release ((struct gl2_unknown_intf **) x); } (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con); if (count != NULL) *count = cnt; } GLint GLAPIENTRY _mesa_GetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_program_intf **pro; GLint loc = -1; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glGetUniformLocationARB"); return -1; } pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); if (pro == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformLocationARB"); return -1; } if ((**pro).GetLinkStatus (pro) == GL_FALSE) { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformLocationARB"); (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); return -1; } /* TODO */ (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); return loc; } void GLAPIENTRY _mesa_GetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_program_intf **pro; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveUniformARB"); return; } pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); if (pro == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetActiveUniformARB"); return; } /* if (index >= val (OBJECT_ACTIVE_ATTRIBUTES_ARB)) { _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveUniformARB"); (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); return; }*/ /* TODO */ (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); } void GLAPIENTRY _mesa_GetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_program_intf **pro; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glGetUniformfvARB"); return; } pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); if (pro == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformfvARB"); return; } if ((**pro).GetLinkStatus (pro) == GL_FALSE) { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformfvARB"); (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); return; } /* TODO validate location (OPERATION) */ /* TODO */ (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); } void GLAPIENTRY _mesa_GetUniformivARB (GLhandleARB programObj, GLint location, GLint *params) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_program_intf **pro; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glGetUniformivARB"); return; } pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); if (pro == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformivARB"); return; } if ((**pro).GetLinkStatus (pro) == GL_FALSE) { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformivARB"); (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); return; } /* TODO validate location (GL_INVALID_OPERATION) */ /* TODO */ (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); } void GLAPIENTRY _mesa_GetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_shader_intf **sha; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glGetShaderSourceARB"); return; } sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER); if (sha == NULL) { _mesa_error (ctx, GL_INVALID_OPERATION, "glGetShaderSourceARB"); return; } _mesa_get_string ((**sha).GetSource (sha), maxLength, length, source); (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha); } /* GL_ARB_vertex_shader */ void GLAPIENTRY _mesa_BindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_program_intf **pro; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glBindAttribLocationARB"); return; } pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); if (pro == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glBindAttribLocationARB"); return; } /* TODO */ (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); } void GLAPIENTRY _mesa_GetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_program_intf **pro; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveAttribARB"); return; } pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); if (pro == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveAttribARB"); return; } /* TODO */ (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); } GLint GLAPIENTRY _mesa_GetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name) { GET_CURRENT_CONTEXT(ctx); struct gl2_unknown_intf **unk; struct gl2_program_intf **pro; GLint loc = 0; _glthread_LOCK_MUTEX (ctx->Shared->Mutex); unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj); _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex); if (unk == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glGetAttribLocationARB"); return 0; } pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM); if (pro == NULL) { _mesa_error (ctx, GL_INVALID_VALUE, "glGetAttribLocationARB"); return 0; } /* TODO */ (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro); return loc; } void _mesa_init_shaderobjects (GLcontext *ctx) { ctx->ShaderObjects.current_program = NULL; _mesa_init_shaderobjects_3dlabs (ctx); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/shaderobjects.h0000644000000000000000000001125713614532424021462 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2004-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef SHADEROBJECTS_H #define SHADEROBJECTS_H #include "mtypes.h" #if FEATURE_ARB_shader_objects extern void GLAPIENTRY _mesa_DeleteObjectARB(GLhandleARB obj); extern GLhandleARB GLAPIENTRY _mesa_GetHandleARB(GLenum pname); extern void GLAPIENTRY _mesa_DetachObjectARB (GLhandleARB, GLhandleARB); extern GLhandleARB GLAPIENTRY _mesa_CreateShaderObjectARB (GLenum); extern void GLAPIENTRY _mesa_ShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); extern void GLAPIENTRY _mesa_CompileShaderARB (GLhandleARB); extern GLhandleARB GLAPIENTRY _mesa_CreateProgramObjectARB (void); extern void GLAPIENTRY _mesa_AttachObjectARB (GLhandleARB, GLhandleARB); extern void GLAPIENTRY _mesa_LinkProgramARB (GLhandleARB); extern void GLAPIENTRY _mesa_UseProgramObjectARB (GLhandleARB); extern void GLAPIENTRY _mesa_ValidateProgramARB (GLhandleARB); extern void GLAPIENTRY _mesa_Uniform1fARB (GLint, GLfloat); extern void GLAPIENTRY _mesa_Uniform2fARB (GLint, GLfloat, GLfloat); extern void GLAPIENTRY _mesa_Uniform3fARB (GLint, GLfloat, GLfloat, GLfloat); extern void GLAPIENTRY _mesa_Uniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat); extern void GLAPIENTRY _mesa_Uniform1iARB (GLint, GLint); extern void GLAPIENTRY _mesa_Uniform2iARB (GLint, GLint, GLint); extern void GLAPIENTRY _mesa_Uniform3iARB (GLint, GLint, GLint, GLint); extern void GLAPIENTRY _mesa_Uniform4iARB (GLint, GLint, GLint, GLint, GLint); extern void GLAPIENTRY _mesa_Uniform1fvARB (GLint, GLsizei, const GLfloat *); extern void GLAPIENTRY _mesa_Uniform2fvARB (GLint, GLsizei, const GLfloat *); extern void GLAPIENTRY _mesa_Uniform3fvARB (GLint, GLsizei, const GLfloat *); extern void GLAPIENTRY _mesa_Uniform4fvARB (GLint, GLsizei, const GLfloat *); extern void GLAPIENTRY _mesa_Uniform1ivARB (GLint, GLsizei, const GLint *); extern void GLAPIENTRY _mesa_Uniform2ivARB (GLint, GLsizei, const GLint *); extern void GLAPIENTRY _mesa_Uniform3ivARB (GLint, GLsizei, const GLint *); extern void GLAPIENTRY _mesa_Uniform4ivARB (GLint, GLsizei, const GLint *); extern void GLAPIENTRY _mesa_UniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *); extern void GLAPIENTRY _mesa_UniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *); extern void GLAPIENTRY _mesa_UniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *); extern void GLAPIENTRY _mesa_GetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *); extern void GLAPIENTRY _mesa_GetObjectParameterivARB (GLhandleARB, GLenum, GLint *); extern void GLAPIENTRY _mesa_GetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); extern void GLAPIENTRY _mesa_GetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); extern GLint GLAPIENTRY _mesa_GetUniformLocationARB (GLhandleARB, const GLcharARB *); extern void GLAPIENTRY _mesa_GetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); extern void GLAPIENTRY _mesa_GetUniformfvARB (GLhandleARB, GLint, GLfloat *); extern void GLAPIENTRY _mesa_GetUniformivARB (GLhandleARB, GLint, GLint *); extern void GLAPIENTRY _mesa_GetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); #if FEATURE_ARB_vertex_shader extern void GLAPIENTRY _mesa_BindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *); extern void GLAPIENTRY _mesa_GetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); extern GLint GLAPIENTRY _mesa_GetAttribLocationARB (GLhandleARB, const GLcharARB *); #endif extern void _mesa_init_shaderobjects (GLcontext *ctx); #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_common_builtin_gc_bin.h0000755000000000000000000020234113614532424027114 0ustar 2,2,2,1,5,1,103,108,95,77,97,120,76,105,103,104,116,115,0,2,16,10,56,0, 0,0,2,2,1,5,1,103,108,95,77,97,120,67,108,105,112,80,108,97,110,101,115,0, 2,16,10,54,0,0,0,2,2,1,5,1,103,108,95,77,97,120,84,101,120,116,117,114, 101,85,110,105,116,115,0,2,16,10,50,0,0,0,2,2,1,5,1,103,108,95,77,97, 120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,2,16,10,50,0,0,0,2,2, 1,5,1,103,108,95,77,97,120,86,101,114,116,101,120,65,116,116,114,105,98,115,0,2, 16,10,49,54,0,0,0,2,2,1,5,1,103,108,95,77,97,120,86,101,114,116,101,120, 85,110,105,102,111,114,109,67,111,109,112,111,110,101,110,116,115,0,2,16,10,53,49,50, 0,0,0,2,2,1,5,1,103,108,95,77,97,120,86,97,114,121,105,110,103,70,108,111, 97,116,115,0,2,16,10,51,50,0,0,0,2,2,1,5,1,103,108,95,77,97,120,86, 101,114,116,101,120,84,101,120,116,117,114,101,73,109,97,103,101,85,110,105,116,115,0,2, 16,8,48,0,0,0,2,2,1,5,1,103,108,95,77,97,120,67,111,109,98,105,110,101, 100,84,101,120,116,117,114,101,73,109,97,103,101,85,110,105,116,115,0,2,16,10,50,0, 0,0,2,2,1,5,1,103,108,95,77,97,120,84,101,120,116,117,114,101,73,109,97,103, 101,85,110,105,116,115,0,2,16,10,50,0,0,0,2,2,1,5,1,103,108,95,77,97, 120,70,114,97,103,109,101,110,116,85,110,105,102,111,114,109,67,111,109,112,111,110,101,110, 116,115,0,2,16,10,54,52,0,0,0,2,2,1,5,1,103,108,95,77,97,120,68,114, 97,119,66,117,102,102,101,114,115,0,2,16,10,49,0,0,0,2,2,4,15,1,103,108, 95,77,111,100,101,108,86,105,101,119,77,97,116,114,105,120,0,0,0,2,2,4,15,1, 103,108,95,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,0,0,0,2,2, 4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101,99,116,105,111, 110,77,97,116,114,105,120,0,0,0,2,2,4,15,1,103,108,95,84,101,120,116,117,114, 101,77,97,116,114,105,120,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67, 111,111,114,100,115,0,0,0,2,2,4,14,1,103,108,95,78,111,114,109,97,108,77,97, 116,114,105,120,0,0,0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119, 77,97,116,114,105,120,73,110,118,101,114,115,101,0,0,0,2,2,4,15,1,103,108,95, 80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,73,110,118,101,114,115,101,0, 0,0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101, 99,116,105,111,110,77,97,116,114,105,120,73,110,118,101,114,115,101,0,0,0,2,2,4, 15,1,103,108,95,84,101,120,116,117,114,101,77,97,116,114,105,120,73,110,118,101,114,115, 101,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0, 0,0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,77,97,116,114,105, 120,84,114,97,110,115,112,111,115,101,0,0,0,2,2,4,15,1,103,108,95,80,114,111, 106,101,99,116,105,111,110,77,97,116,114,105,120,84,114,97,110,115,112,111,115,101,0,0, 0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101,99, 116,105,111,110,77,97,116,114,105,120,84,114,97,110,115,112,111,115,101,0,0,0,2,2, 4,15,1,103,108,95,84,101,120,116,117,114,101,77,97,116,114,105,120,84,114,97,110,115, 112,111,115,101,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114, 100,115,0,0,0,2,2,4,15,1,103,108,95,77,111,100,101,108,86,105,101,119,77,97, 116,114,105,120,73,110,118,101,114,115,101,84,114,97,110,115,112,111,115,101,0,0,0,2, 2,4,15,1,103,108,95,80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,73, 110,118,101,114,115,101,84,114,97,110,115,112,111,115,101,0,0,0,2,2,4,15,1,103, 108,95,77,111,100,101,108,86,105,101,119,80,114,111,106,101,99,116,105,111,110,77,97,116, 114,105,120,73,110,118,101,114,115,101,84,114,97,110,115,112,111,115,101,0,0,0,2,2, 4,15,1,103,108,95,84,101,120,116,117,114,101,77,97,116,114,105,120,73,110,118,101,114, 115,101,84,114,97,110,115,112,111,115,101,0,3,18,103,108,95,77,97,120,84,101,120,116, 117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,9,1,103,108,95,78,111,114,109, 97,108,83,99,97,108,101,0,0,0,2,2,0,22,103,108,95,68,101,112,116,104,82,97, 110,103,101,80,97,114,97,109,101,116,101,114,115,0,9,110,101,97,114,0,0,0,1,9, 102,97,114,0,0,0,1,9,100,105,102,102,0,0,0,0,0,0,2,2,4,23,103,108, 95,68,101,112,116,104,82,97,110,103,101,80,97,114,97,109,101,116,101,114,115,0,1,103, 108,95,68,101,112,116,104,82,97,110,103,101,0,0,0,2,2,4,12,1,103,108,95,67, 108,105,112,80,108,97,110,101,0,3,18,103,108,95,77,97,120,67,108,105,112,80,108,97, 110,101,115,0,0,0,2,2,0,22,103,108,95,80,111,105,110,116,80,97,114,97,109,101, 116,101,114,115,0,9,115,105,122,101,0,0,0,1,9,115,105,122,101,77,105,110,0,0, 0,1,9,115,105,122,101,77,97,120,0,0,0,1,9,102,97,100,101,84,104,114,101,115, 104,111,108,100,83,105,122,101,0,0,0,1,9,100,105,115,116,97,110,99,101,67,111,110, 115,116,97,110,116,65,116,116,101,110,117,97,116,105,111,110,0,0,0,1,9,100,105,115, 116,97,110,99,101,76,105,110,101,97,114,65,116,116,101,110,117,97,116,105,111,110,0,0, 0,1,9,100,105,115,116,97,110,99,101,81,117,97,100,114,97,116,105,99,65,116,116,101, 110,117,97,116,105,111,110,0,0,0,0,0,0,2,2,4,23,103,108,95,80,111,105,110, 116,80,97,114,97,109,101,116,101,114,115,0,1,103,108,95,80,111,105,110,116,0,0,0, 2,2,0,22,103,108,95,77,97,116,101,114,105,97,108,80,97,114,97,109,101,116,101,114, 115,0,12,101,109,105,115,115,105,111,110,0,0,0,1,12,97,109,98,105,101,110,116,0, 0,0,1,12,100,105,102,102,117,115,101,0,0,0,1,12,115,112,101,99,117,108,97,114, 0,0,0,1,9,115,104,105,110,105,110,101,115,115,0,0,0,0,0,0,2,2,4,23, 103,108,95,77,97,116,101,114,105,97,108,80,97,114,97,109,101,116,101,114,115,0,1,103, 108,95,70,114,111,110,116,77,97,116,101,114,105,97,108,0,0,0,2,2,4,23,103,108, 95,77,97,116,101,114,105,97,108,80,97,114,97,109,101,116,101,114,115,0,1,103,108,95, 66,97,99,107,77,97,116,101,114,105,97,108,0,0,0,2,2,0,22,103,108,95,76,105, 103,104,116,83,111,117,114,99,101,80,97,114,97,109,101,116,101,114,115,0,12,97,109,98, 105,101,110,116,0,0,0,1,12,100,105,102,102,117,115,101,0,0,0,1,12,115,112,101, 99,117,108,97,114,0,0,0,1,12,112,111,115,105,116,105,111,110,0,0,0,1,12,104, 97,108,102,86,101,99,116,111,114,0,0,0,1,11,115,112,111,116,68,105,114,101,99,116, 105,111,110,0,0,0,1,9,115,112,111,116,69,120,112,111,110,101,110,116,0,0,0,1, 9,115,112,111,116,67,117,116,111,102,102,0,0,0,1,9,115,112,111,116,67,111,115,67, 117,116,111,102,102,0,0,0,1,9,99,111,110,115,116,97,110,116,65,116,116,101,110,117, 97,116,105,111,110,0,0,0,1,9,108,105,110,101,97,114,65,116,116,101,110,117,97,116, 105,111,110,0,0,0,1,9,113,117,97,100,114,97,116,105,99,65,116,116,101,110,117,97, 116,105,111,110,0,0,0,0,0,0,2,2,4,23,103,108,95,76,105,103,104,116,83,111, 117,114,99,101,80,97,114,97,109,101,116,101,114,115,0,1,103,108,95,76,105,103,104,116, 83,111,117,114,99,101,0,3,18,103,108,95,77,97,120,76,105,103,104,116,115,0,0,0, 2,2,0,22,103,108,95,76,105,103,104,116,77,111,100,101,108,80,97,114,97,109,101,116, 101,114,115,0,12,97,109,98,105,101,110,116,0,0,0,0,0,0,2,2,4,23,103,108, 95,76,105,103,104,116,77,111,100,101,108,80,97,114,97,109,101,116,101,114,115,0,1,103, 108,95,76,105,103,104,116,77,111,100,101,108,0,0,0,2,2,0,22,103,108,95,76,105, 103,104,116,77,111,100,101,108,80,114,111,100,117,99,116,115,0,12,115,99,101,110,101,67, 111,108,111,114,0,0,0,0,0,0,2,2,4,23,103,108,95,76,105,103,104,116,77,111, 100,101,108,80,114,111,100,117,99,116,115,0,1,103,108,95,70,114,111,110,116,76,105,103, 104,116,77,111,100,101,108,80,114,111,100,117,99,116,0,0,0,2,2,4,23,103,108,95, 76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99,116,115,0,1,103,108,95,66, 97,99,107,76,105,103,104,116,77,111,100,101,108,80,114,111,100,117,99,116,0,0,0,2, 2,0,22,103,108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,12,97,109,98, 105,101,110,116,0,0,0,1,12,100,105,102,102,117,115,101,0,0,0,1,12,115,112,101, 99,117,108,97,114,0,0,0,0,0,0,2,2,4,23,103,108,95,76,105,103,104,116,80, 114,111,100,117,99,116,115,0,1,103,108,95,70,114,111,110,116,76,105,103,104,116,80,114, 111,100,117,99,116,0,3,18,103,108,95,77,97,120,76,105,103,104,116,115,0,0,0,2, 2,4,23,103,108,95,76,105,103,104,116,80,114,111,100,117,99,116,115,0,1,103,108,95, 66,97,99,107,76,105,103,104,116,80,114,111,100,117,99,116,0,3,18,103,108,95,77,97, 120,76,105,103,104,116,115,0,0,0,2,2,4,12,1,103,108,95,84,101,120,116,117,114, 101,69,110,118,67,111,108,111,114,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114, 101,73,109,97,103,101,85,110,105,116,115,0,0,0,2,2,4,12,1,103,108,95,69,121, 101,80,108,97,110,101,83,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67, 111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,69,121,101,80,108,97,110,101, 84,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0, 0,0,2,2,4,12,1,103,108,95,69,121,101,80,108,97,110,101,82,0,3,18,103,108, 95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,12, 1,103,108,95,69,121,101,80,108,97,110,101,81,0,3,18,103,108,95,77,97,120,84,101, 120,116,117,114,101,67,111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,79,98, 106,101,99,116,80,108,97,110,101,83,0,3,18,103,108,95,77,97,120,84,101,120,116,117, 114,101,67,111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,79,98,106,101,99, 116,80,108,97,110,101,84,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67, 111,111,114,100,115,0,0,0,2,2,4,12,1,103,108,95,79,98,106,101,99,116,80,108, 97,110,101,82,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114, 100,115,0,0,0,2,2,4,12,1,103,108,95,79,98,106,101,99,116,80,108,97,110,101, 81,0,3,18,103,108,95,77,97,120,84,101,120,116,117,114,101,67,111,111,114,100,115,0, 0,0,2,2,0,22,103,108,95,70,111,103,80,97,114,97,109,101,116,101,114,115,0,12, 99,111,108,111,114,0,0,0,1,9,100,101,110,115,105,116,121,0,0,0,1,9,115,116, 97,114,116,0,0,0,1,9,101,110,100,0,0,0,1,9,115,99,97,108,101,0,0,0, 0,0,0,2,2,4,23,103,108,95,70,111,103,80,97,114,97,109,101,116,101,114,115,0, 1,103,108,95,70,111,103,0,0,0,1,0,9,0,114,97,100,105,97,110,115,0,1,0, 0,9,100,101,103,0,0,0,1,8,17,51,0,49,52,49,53,57,51,0,0,18,100,101, 103,0,48,17,49,56,48,0,48,0,0,49,0,0,1,0,10,0,114,97,100,105,97,110, 115,0,1,0,0,10,100,101,103,0,0,0,1,8,58,118,101,99,50,0,58,114,97,100, 105,97,110,115,0,18,100,101,103,0,59,120,0,0,0,0,58,114,97,100,105,97,110,115, 0,18,100,101,103,0,59,121,0,0,0,0,0,0,0,1,0,11,0,114,97,100,105,97, 110,115,0,1,0,0,11,100,101,103,0,0,0,1,8,58,118,101,99,51,0,58,114,97, 100,105,97,110,115,0,18,100,101,103,0,59,120,0,0,0,0,58,114,97,100,105,97,110, 115,0,18,100,101,103,0,59,121,0,0,0,0,58,114,97,100,105,97,110,115,0,18,100, 101,103,0,59,122,0,0,0,0,0,0,0,1,0,12,0,114,97,100,105,97,110,115,0, 1,0,0,12,100,101,103,0,0,0,1,8,58,118,101,99,52,0,58,114,97,100,105,97, 110,115,0,18,100,101,103,0,59,120,0,0,0,0,58,114,97,100,105,97,110,115,0,18, 100,101,103,0,59,121,0,0,0,0,58,114,97,100,105,97,110,115,0,18,100,101,103,0, 59,122,0,0,0,0,58,114,97,100,105,97,110,115,0,18,100,101,103,0,59,119,0,0, 0,0,0,0,0,1,0,9,0,100,101,103,114,101,101,115,0,1,0,0,9,114,97,100, 0,0,0,1,8,17,49,56,48,0,48,0,0,18,114,97,100,0,48,17,51,0,49,52, 49,53,57,51,0,0,49,0,0,1,0,10,0,100,101,103,114,101,101,115,0,1,0,0, 10,114,97,100,0,0,0,1,8,58,118,101,99,50,0,58,100,101,103,114,101,101,115,0, 18,114,97,100,0,59,120,0,0,0,0,58,100,101,103,114,101,101,115,0,18,114,97,100, 0,59,121,0,0,0,0,0,0,0,1,0,11,0,100,101,103,114,101,101,115,0,1,0, 0,11,114,97,100,0,0,0,1,8,58,118,101,99,51,0,58,100,101,103,114,101,101,115, 0,18,114,97,100,0,59,120,0,0,0,0,58,100,101,103,114,101,101,115,0,18,114,97, 100,0,59,121,0,0,0,0,58,100,101,103,114,101,101,115,0,18,114,97,100,0,59,122, 0,0,0,0,0,0,0,1,0,12,0,100,101,103,114,101,101,115,0,1,0,0,12,114, 97,100,0,0,0,1,8,58,118,101,99,52,0,58,100,101,103,114,101,101,115,0,18,114, 97,100,0,59,120,0,0,0,0,58,100,101,103,114,101,101,115,0,18,114,97,100,0,59, 121,0,0,0,0,58,100,101,103,114,101,101,115,0,18,114,97,100,0,59,122,0,0,0, 0,58,100,101,103,114,101,101,115,0,18,114,97,100,0,59,119,0,0,0,0,0,0,0, 1,0,9,0,115,105,110,0,1,0,0,9,97,110,103,108,101,0,0,0,1,8,17,48, 0,48,0,0,0,0,1,0,10,0,115,105,110,0,1,0,0,10,97,110,103,108,101,0, 0,0,1,8,58,118,101,99,50,0,58,115,105,110,0,18,97,110,103,108,101,0,59,120, 0,0,0,0,58,115,105,110,0,18,97,110,103,108,101,0,59,121,0,0,0,0,0,0, 0,1,0,11,0,115,105,110,0,1,0,0,11,97,110,103,108,101,0,0,0,1,8,58, 118,101,99,51,0,58,115,105,110,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58, 115,105,110,0,18,97,110,103,108,101,0,59,121,0,0,0,0,58,115,105,110,0,18,97, 110,103,108,101,0,59,122,0,0,0,0,0,0,0,1,0,12,0,115,105,110,0,1,0, 0,12,97,110,103,108,101,0,0,0,1,8,58,118,101,99,52,0,58,115,105,110,0,18, 97,110,103,108,101,0,59,120,0,0,0,0,58,115,105,110,0,18,97,110,103,108,101,0, 59,121,0,0,0,0,58,115,105,110,0,18,97,110,103,108,101,0,59,122,0,0,0,0, 58,115,105,110,0,18,97,110,103,108,101,0,59,119,0,0,0,0,0,0,0,1,0,9, 0,99,111,115,0,1,0,0,9,97,110,103,108,101,0,0,0,1,8,58,115,105,110,0, 18,97,110,103,108,101,0,17,49,0,53,55,48,56,0,0,46,0,0,0,0,1,0,10, 0,99,111,115,0,1,0,0,10,97,110,103,108,101,0,0,0,1,8,58,118,101,99,50, 0,58,99,111,115,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58,99,111,115,0, 18,97,110,103,108,101,0,59,121,0,0,0,0,0,0,0,1,0,11,0,99,111,115,0, 1,0,0,11,97,110,103,108,101,0,0,0,1,8,58,118,101,99,51,0,58,99,111,115, 0,18,97,110,103,108,101,0,59,120,0,0,0,0,58,99,111,115,0,18,97,110,103,108, 101,0,59,121,0,0,0,0,58,99,111,115,0,18,97,110,103,108,101,0,59,122,0,0, 0,0,0,0,0,1,0,12,0,99,111,115,0,1,0,0,12,97,110,103,108,101,0,0, 0,1,8,58,118,101,99,52,0,58,99,111,115,0,18,97,110,103,108,101,0,59,120,0, 0,0,0,58,99,111,115,0,18,97,110,103,108,101,0,59,121,0,0,0,0,58,99,111, 115,0,18,97,110,103,108,101,0,59,122,0,0,0,0,58,99,111,115,0,18,97,110,103, 108,101,0,59,119,0,0,0,0,0,0,0,1,0,9,0,116,97,110,0,1,0,0,9, 97,110,103,108,101,0,0,0,1,8,58,115,105,110,0,18,97,110,103,108,101,0,0,0, 58,99,111,115,0,18,97,110,103,108,101,0,0,0,49,0,0,1,0,10,0,116,97,110, 0,1,0,0,10,97,110,103,108,101,0,0,0,1,8,58,118,101,99,50,0,58,116,97, 110,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58,116,97,110,0,18,97,110,103, 108,101,0,59,121,0,0,0,0,0,0,0,1,0,11,0,116,97,110,0,1,0,0,11, 97,110,103,108,101,0,0,0,1,8,58,118,101,99,51,0,58,116,97,110,0,18,97,110, 103,108,101,0,59,120,0,0,0,0,58,116,97,110,0,18,97,110,103,108,101,0,59,121, 0,0,0,0,58,116,97,110,0,18,97,110,103,108,101,0,59,122,0,0,0,0,0,0, 0,1,0,12,0,116,97,110,0,1,0,0,12,97,110,103,108,101,0,0,0,1,8,58, 118,101,99,52,0,58,116,97,110,0,18,97,110,103,108,101,0,59,120,0,0,0,0,58, 116,97,110,0,18,97,110,103,108,101,0,59,121,0,0,0,0,58,116,97,110,0,18,97, 110,103,108,101,0,59,122,0,0,0,0,58,116,97,110,0,18,97,110,103,108,101,0,59, 119,0,0,0,0,0,0,0,1,0,9,0,97,115,105,110,0,1,0,0,9,120,0,0, 0,1,8,17,48,0,48,0,0,0,0,1,0,10,0,97,115,105,110,0,1,0,0,10, 120,0,0,0,1,8,58,118,101,99,50,0,58,97,115,105,110,0,18,120,0,59,120,0, 0,0,0,58,97,115,105,110,0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11, 0,97,115,105,110,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,97, 115,105,110,0,18,120,0,59,120,0,0,0,0,58,97,115,105,110,0,18,120,0,59,121, 0,0,0,0,58,97,115,105,110,0,18,120,0,59,122,0,0,0,0,0,0,0,1,0, 12,0,97,115,105,110,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,58, 97,115,105,110,0,18,120,0,59,120,0,0,0,0,58,97,115,105,110,0,18,120,0,59, 121,0,0,0,0,58,97,115,105,110,0,18,120,0,59,122,0,0,0,0,58,97,115,105, 110,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0,97,99,111,115,0,1, 0,0,9,120,0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,10,0,97,99,111, 115,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,97,99,111,115,0, 18,120,0,59,120,0,0,0,0,58,97,99,111,115,0,18,120,0,59,121,0,0,0,0, 0,0,0,1,0,11,0,97,99,111,115,0,1,0,0,11,120,0,0,0,1,8,58,118, 101,99,51,0,58,97,99,111,115,0,18,120,0,59,120,0,0,0,0,58,97,99,111,115, 0,18,120,0,59,121,0,0,0,0,58,97,99,111,115,0,18,120,0,59,122,0,0,0, 0,0,0,0,1,0,12,0,97,99,111,115,0,1,0,0,12,120,0,0,0,1,8,58, 118,101,99,52,0,58,97,99,111,115,0,18,120,0,59,120,0,0,0,0,58,97,99,111, 115,0,18,120,0,59,121,0,0,0,0,58,97,99,111,115,0,18,120,0,59,122,0,0, 0,0,58,97,99,111,115,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0, 97,116,97,110,0,1,0,0,9,120,0,0,1,0,0,9,121,0,0,0,1,8,17,48, 0,48,0,0,0,0,1,0,10,0,97,116,97,110,0,1,0,0,10,120,0,0,1,0, 0,10,121,0,0,0,1,8,58,118,101,99,50,0,58,97,116,97,110,0,18,120,0,59, 120,0,0,18,121,0,59,120,0,0,0,0,58,97,116,97,110,0,18,120,0,59,121,0, 0,18,121,0,59,121,0,0,0,0,0,0,0,1,0,11,0,97,116,97,110,0,1,0, 0,11,120,0,0,1,0,0,11,121,0,0,0,1,8,58,118,101,99,51,0,58,97,116, 97,110,0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,0,0,58,97,116,97,110, 0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,0,0,58,97,116,97,110,0,18, 120,0,59,122,0,0,18,121,0,59,122,0,0,0,0,0,0,0,1,0,12,0,97,116, 97,110,0,1,0,0,12,120,0,0,1,0,0,12,121,0,0,0,1,8,58,118,101,99, 52,0,58,97,116,97,110,0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,0,0, 58,97,116,97,110,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,0,0,58,97, 116,97,110,0,18,120,0,59,122,0,0,18,121,0,59,122,0,0,0,0,58,97,116,97, 110,0,18,120,0,59,119,0,0,18,121,0,59,119,0,0,0,0,0,0,0,1,0,9, 0,97,116,97,110,0,1,0,0,9,121,95,111,118,101,114,95,120,0,0,0,1,8,17, 48,0,48,0,0,0,0,1,0,10,0,97,116,97,110,0,1,0,0,10,121,95,111,118, 101,114,95,120,0,0,0,1,8,58,118,101,99,50,0,58,97,116,97,110,0,18,121,95, 111,118,101,114,95,120,0,59,120,0,0,0,0,58,97,116,97,110,0,18,121,95,111,118, 101,114,95,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,97,116,97,110,0,1, 0,0,11,121,95,111,118,101,114,95,120,0,0,0,1,8,58,118,101,99,51,0,58,97, 116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,120,0,0,0,0,58,97,116,97, 110,0,18,121,95,111,118,101,114,95,120,0,59,121,0,0,0,0,58,97,116,97,110,0, 18,121,95,111,118,101,114,95,120,0,59,122,0,0,0,0,0,0,0,1,0,12,0,97, 116,97,110,0,1,0,0,12,121,95,111,118,101,114,95,120,0,0,0,1,8,58,118,101, 99,52,0,58,97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,120,0,0,0, 0,58,97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,121,0,0,0,0,58, 97,116,97,110,0,18,121,95,111,118,101,114,95,120,0,59,122,0,0,0,0,58,97,116, 97,110,0,18,121,95,111,118,101,114,95,120,0,59,119,0,0,0,0,0,0,0,1,0, 9,0,112,111,119,0,1,0,0,9,120,0,0,1,0,0,9,121,0,0,0,1,8,17, 48,0,48,0,0,0,0,1,0,10,0,112,111,119,0,1,0,0,10,120,0,0,1,0, 0,10,121,0,0,0,1,8,58,118,101,99,50,0,58,112,111,119,0,18,120,0,59,120, 0,0,18,121,0,59,120,0,0,0,0,58,112,111,119,0,18,120,0,59,121,0,0,18, 121,0,59,121,0,0,0,0,0,0,0,1,0,11,0,112,111,119,0,1,0,0,11,120, 0,0,1,0,0,11,121,0,0,0,1,8,58,118,101,99,51,0,58,112,111,119,0,18, 120,0,59,120,0,0,18,121,0,59,120,0,0,0,0,58,112,111,119,0,18,120,0,59, 121,0,0,18,121,0,59,121,0,0,0,0,58,112,111,119,0,18,120,0,59,122,0,0, 18,121,0,59,122,0,0,0,0,0,0,0,1,0,12,0,112,111,119,0,1,0,0,12, 120,0,0,1,0,0,12,121,0,0,0,1,8,58,118,101,99,52,0,58,112,111,119,0, 18,120,0,59,120,0,0,18,121,0,59,120,0,0,0,0,58,112,111,119,0,18,120,0, 59,121,0,0,18,121,0,59,121,0,0,0,0,58,112,111,119,0,18,120,0,59,122,0, 0,18,121,0,59,122,0,0,0,0,58,112,111,119,0,18,120,0,59,119,0,0,18,121, 0,59,119,0,0,0,0,0,0,0,1,0,9,0,101,120,112,0,1,0,0,9,120,0, 0,0,1,8,58,112,111,119,0,17,50,0,55,49,56,50,56,49,56,51,0,0,0,18, 120,0,0,0,0,0,1,0,10,0,101,120,112,0,1,0,0,10,120,0,0,0,1,8, 58,118,101,99,50,0,58,101,120,112,0,18,120,0,59,120,0,0,0,0,58,101,120,112, 0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,101,120,112,0,1,0,0, 11,120,0,0,0,1,8,58,118,101,99,51,0,58,101,120,112,0,18,120,0,59,120,0, 0,0,0,58,101,120,112,0,18,120,0,59,121,0,0,0,0,58,101,120,112,0,18,120, 0,59,122,0,0,0,0,0,0,0,1,0,12,0,101,120,112,0,1,0,0,12,120,0, 0,0,1,8,58,118,101,99,52,0,58,101,120,112,0,18,120,0,59,120,0,0,0,0, 58,101,120,112,0,18,120,0,59,121,0,0,0,0,58,101,120,112,0,18,120,0,59,122, 0,0,0,0,58,101,120,112,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9, 0,108,111,103,0,1,0,0,9,120,0,0,0,1,8,58,108,111,103,50,0,18,120,0, 0,0,58,108,111,103,50,0,17,50,0,55,49,56,50,56,49,56,51,0,0,0,0,49, 0,0,1,0,10,0,108,111,103,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99, 50,0,58,108,111,103,0,18,120,0,59,120,0,0,0,0,58,108,111,103,0,18,120,0, 59,121,0,0,0,0,0,0,0,1,0,11,0,108,111,103,0,1,0,0,11,120,0,0, 0,1,8,58,118,101,99,51,0,58,108,111,103,0,18,120,0,59,120,0,0,0,0,58, 108,111,103,0,18,120,0,59,121,0,0,0,0,58,108,111,103,0,18,120,0,59,122,0, 0,0,0,0,0,0,1,0,12,0,108,111,103,0,1,0,0,12,120,0,0,0,1,8, 58,118,101,99,52,0,58,108,111,103,0,18,120,0,59,120,0,0,0,0,58,108,111,103, 0,18,120,0,59,121,0,0,0,0,58,108,111,103,0,18,120,0,59,122,0,0,0,0, 58,108,111,103,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0,101,120,112, 50,0,1,0,0,9,120,0,0,0,1,8,58,112,111,119,0,17,50,0,48,0,0,0, 18,120,0,0,0,0,0,1,0,10,0,101,120,112,50,0,1,0,0,10,120,0,0,0, 1,8,58,118,101,99,50,0,58,101,120,112,50,0,18,120,0,59,120,0,0,0,0,58, 101,120,112,50,0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,101,120,112, 50,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,101,120,112,50,0, 18,120,0,59,120,0,0,0,0,58,101,120,112,50,0,18,120,0,59,121,0,0,0,0, 58,101,120,112,50,0,18,120,0,59,122,0,0,0,0,0,0,0,1,0,12,0,101,120, 112,50,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,58,101,120,112,50, 0,18,120,0,59,120,0,0,0,0,58,101,120,112,50,0,18,120,0,59,121,0,0,0, 0,58,101,120,112,50,0,18,120,0,59,122,0,0,0,0,58,101,120,112,50,0,18,120, 0,59,119,0,0,0,0,0,0,0,1,0,9,0,108,111,103,50,0,1,0,0,9,120, 0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,10,0,108,111,103,50,0,1,0, 0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,108,111,103,50,0,18,120,0,59, 120,0,0,0,0,58,108,111,103,50,0,18,120,0,59,121,0,0,0,0,0,0,0,1, 0,11,0,108,111,103,50,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0, 58,108,111,103,50,0,18,120,0,59,120,0,0,0,0,58,108,111,103,50,0,18,120,0, 59,121,0,0,0,0,58,108,111,103,50,0,18,120,0,59,122,0,0,0,0,0,0,0, 1,0,12,0,108,111,103,50,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52, 0,58,108,111,103,50,0,18,120,0,59,120,0,0,0,0,58,108,111,103,50,0,18,120, 0,59,121,0,0,0,0,58,108,111,103,50,0,18,120,0,59,122,0,0,0,0,58,108, 111,103,50,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0,115,113,114,116, 0,1,0,0,9,120,0,0,0,1,8,58,112,111,119,0,18,120,0,0,17,48,0,53, 0,0,0,0,0,0,1,0,10,0,115,113,114,116,0,1,0,0,10,120,0,0,0,1, 8,58,118,101,99,50,0,58,115,113,114,116,0,18,120,0,59,120,0,0,0,0,58,115, 113,114,116,0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,115,113,114,116, 0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,115,113,114,116,0,18, 120,0,59,120,0,0,0,0,58,115,113,114,116,0,18,120,0,59,121,0,0,0,0,58, 115,113,114,116,0,18,120,0,59,122,0,0,0,0,0,0,0,1,0,12,0,115,113,114, 116,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,58,115,113,114,116,0, 18,120,0,59,120,0,0,0,0,58,115,113,114,116,0,18,120,0,59,121,0,0,0,0, 58,115,113,114,116,0,18,120,0,59,122,0,0,0,0,58,115,113,114,116,0,18,120,0, 59,119,0,0,0,0,0,0,0,1,0,9,0,105,110,118,101,114,115,101,115,113,114,116, 0,1,0,0,9,120,0,0,0,1,8,17,49,0,48,0,0,58,115,113,114,116,0,18, 120,0,0,0,49,0,0,1,0,10,0,105,110,118,101,114,115,101,115,113,114,116,0,1, 0,0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,105,110,118,101,114,115,101,115, 113,114,116,0,18,120,0,59,120,0,0,0,0,58,105,110,118,101,114,115,101,115,113,114, 116,0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,105,110,118,101,114,115, 101,115,113,114,116,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,105, 110,118,101,114,115,101,115,113,114,116,0,18,120,0,59,120,0,0,0,0,58,105,110,118, 101,114,115,101,115,113,114,116,0,18,120,0,59,121,0,0,0,0,58,105,110,118,101,114, 115,101,115,113,114,116,0,18,120,0,59,122,0,0,0,0,0,0,0,1,0,12,0,105, 110,118,101,114,115,101,115,113,114,116,0,1,0,0,12,120,0,0,0,1,8,58,118,101, 99,52,0,58,105,110,118,101,114,115,101,115,113,114,116,0,18,120,0,59,120,0,0,0, 0,58,105,110,118,101,114,115,101,115,113,114,116,0,18,120,0,59,121,0,0,0,0,58, 105,110,118,101,114,115,101,115,113,114,116,0,18,120,0,59,122,0,0,0,0,58,105,110, 118,101,114,115,101,115,113,114,116,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0, 9,0,97,98,115,0,1,0,0,9,120,0,0,0,1,8,18,120,0,17,48,0,48,0, 0,43,18,120,0,18,120,0,54,31,0,0,1,0,10,0,97,98,115,0,1,0,0,10, 120,0,0,0,1,8,58,118,101,99,50,0,58,97,98,115,0,18,120,0,59,120,0,0, 0,0,58,97,98,115,0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,97, 98,115,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,97,98,115,0, 18,120,0,59,120,0,0,0,0,58,97,98,115,0,18,120,0,59,121,0,0,0,0,58, 97,98,115,0,18,120,0,59,122,0,0,0,0,0,0,0,1,0,12,0,97,98,115,0, 1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,58,97,98,115,0,18,120,0, 59,120,0,0,0,0,58,97,98,115,0,18,120,0,59,121,0,0,0,0,58,97,98,115, 0,18,120,0,59,122,0,0,0,0,58,97,98,115,0,18,120,0,59,119,0,0,0,0, 0,0,0,1,0,9,0,115,105,103,110,0,1,0,0,9,120,0,0,0,1,8,18,120, 0,17,48,0,48,0,0,41,17,49,0,48,0,0,18,120,0,17,48,0,48,0,0,40, 17,49,0,48,0,0,54,17,48,0,48,0,0,31,31,0,0,1,0,10,0,115,105,103, 110,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,115,105,103,110,0, 18,120,0,59,120,0,0,0,0,58,115,105,103,110,0,18,120,0,59,121,0,0,0,0, 0,0,0,1,0,11,0,115,105,103,110,0,1,0,0,11,120,0,0,0,1,8,58,118, 101,99,51,0,58,115,105,103,110,0,18,120,0,59,120,0,0,0,0,58,115,105,103,110, 0,18,120,0,59,121,0,0,0,0,58,115,105,103,110,0,18,120,0,59,122,0,0,0, 0,0,0,0,1,0,12,0,115,105,103,110,0,1,0,0,12,120,0,0,0,1,8,58, 118,101,99,52,0,58,115,105,103,110,0,18,120,0,59,120,0,0,0,0,58,115,105,103, 110,0,18,120,0,59,121,0,0,0,0,58,115,105,103,110,0,18,120,0,59,122,0,0, 0,0,58,115,105,103,110,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0, 102,108,111,111,114,0,1,0,0,9,120,0,0,0,1,8,17,48,0,48,0,0,0,0, 1,0,10,0,102,108,111,111,114,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99, 50,0,58,102,108,111,111,114,0,18,120,0,59,120,0,0,0,0,58,102,108,111,111,114, 0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,102,108,111,111,114,0,1, 0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,102,108,111,111,114,0,18,120, 0,59,120,0,0,0,0,58,102,108,111,111,114,0,18,120,0,59,121,0,0,0,0,58, 102,108,111,111,114,0,18,120,0,59,122,0,0,0,0,0,0,0,1,0,12,0,102,108, 111,111,114,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,58,102,108,111, 111,114,0,18,120,0,59,120,0,0,0,0,58,102,108,111,111,114,0,18,120,0,59,121, 0,0,0,0,58,102,108,111,111,114,0,18,120,0,59,122,0,0,0,0,58,102,108,111, 111,114,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0,99,101,105,108,0, 1,0,0,9,120,0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,10,0,99,101, 105,108,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,99,101,105,108, 0,18,120,0,59,120,0,0,0,0,58,99,101,105,108,0,18,120,0,59,121,0,0,0, 0,0,0,0,1,0,11,0,99,101,105,108,0,1,0,0,11,120,0,0,0,1,8,58, 118,101,99,51,0,58,99,101,105,108,0,18,120,0,59,120,0,0,0,0,58,99,101,105, 108,0,18,120,0,59,121,0,0,0,0,58,99,101,105,108,0,18,120,0,59,122,0,0, 0,0,0,0,0,1,0,12,0,99,101,105,108,0,1,0,0,12,120,0,0,0,1,8, 58,118,101,99,52,0,58,99,101,105,108,0,18,120,0,59,120,0,0,0,0,58,99,101, 105,108,0,18,120,0,59,121,0,0,0,0,58,99,101,105,108,0,18,120,0,59,122,0, 0,0,0,58,99,101,105,108,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9, 0,102,114,97,99,116,0,1,0,0,9,120,0,0,0,1,8,18,120,0,58,102,108,111, 111,114,0,18,120,0,0,0,47,0,0,1,0,10,0,102,114,97,99,116,0,1,0,0, 10,120,0,0,0,1,8,58,118,101,99,50,0,58,102,114,97,99,116,0,18,120,0,59, 120,0,0,0,0,58,102,114,97,99,116,0,18,120,0,59,121,0,0,0,0,0,0,0, 1,0,11,0,102,114,97,99,116,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99, 51,0,58,102,114,97,99,116,0,18,120,0,59,120,0,0,0,0,58,102,114,97,99,116, 0,18,120,0,59,121,0,0,0,0,58,102,114,97,99,116,0,18,120,0,59,122,0,0, 0,0,0,0,0,1,0,12,0,102,114,97,99,116,0,1,0,0,12,120,0,0,0,1, 8,58,118,101,99,52,0,58,102,114,97,99,116,0,18,120,0,59,120,0,0,0,0,58, 102,114,97,99,116,0,18,120,0,59,121,0,0,0,0,58,102,114,97,99,116,0,18,120, 0,59,122,0,0,0,0,58,102,114,97,99,116,0,18,120,0,59,119,0,0,0,0,0, 0,0,1,0,9,0,109,111,100,0,1,0,0,9,120,0,0,1,0,0,9,121,0,0, 0,1,8,18,120,0,18,121,0,58,102,108,111,111,114,0,18,120,0,18,121,0,49,0, 0,48,47,0,0,1,0,10,0,109,111,100,0,1,0,0,10,120,0,0,1,0,0,9, 121,0,0,0,1,8,58,118,101,99,50,0,58,109,111,100,0,18,120,0,59,120,0,0, 18,121,0,0,0,0,58,109,111,100,0,18,120,0,59,121,0,0,18,121,0,0,0,0, 0,0,0,1,0,11,0,109,111,100,0,1,0,0,11,120,0,0,1,0,0,9,121,0, 0,0,1,8,58,118,101,99,51,0,58,109,111,100,0,18,120,0,59,120,0,0,18,121, 0,0,0,0,58,109,111,100,0,18,120,0,59,121,0,0,18,121,0,0,0,0,58,109, 111,100,0,18,120,0,59,122,0,0,18,121,0,0,0,0,0,0,0,1,0,12,0,109, 111,100,0,1,0,0,12,120,0,0,1,0,0,9,121,0,0,0,1,8,58,118,101,99, 52,0,58,109,111,100,0,18,120,0,59,120,0,0,18,121,0,0,0,0,58,109,111,100, 0,18,120,0,59,121,0,0,18,121,0,0,0,0,58,109,111,100,0,18,120,0,59,122, 0,0,18,121,0,0,0,0,58,109,111,100,0,18,120,0,59,119,0,0,18,121,0,0, 0,0,0,0,0,1,0,10,0,109,111,100,0,1,0,0,10,120,0,0,1,0,0,10, 121,0,0,0,1,8,58,118,101,99,50,0,58,109,111,100,0,18,120,0,59,120,0,0, 18,121,0,59,120,0,0,0,0,58,109,111,100,0,18,120,0,59,121,0,0,18,121,0, 59,121,0,0,0,0,0,0,0,1,0,11,0,109,111,100,0,1,0,0,11,120,0,0, 1,0,0,11,121,0,0,0,1,8,58,118,101,99,51,0,58,109,111,100,0,18,120,0, 59,120,0,0,18,121,0,59,120,0,0,0,0,58,109,111,100,0,18,120,0,59,121,0, 0,18,121,0,59,121,0,0,0,0,58,109,111,100,0,18,120,0,59,122,0,0,18,121, 0,59,122,0,0,0,0,0,0,0,1,0,12,0,109,111,100,0,1,0,0,12,120,0, 0,1,0,0,12,121,0,0,0,1,8,58,118,101,99,52,0,58,109,111,100,0,18,120, 0,59,120,0,0,18,121,0,59,120,0,0,0,0,58,109,111,100,0,18,120,0,59,121, 0,0,18,121,0,59,121,0,0,0,0,58,109,111,100,0,18,120,0,59,122,0,0,18, 121,0,59,122,0,0,0,0,58,109,111,100,0,18,120,0,59,119,0,0,18,121,0,59, 119,0,0,0,0,0,0,0,1,0,9,0,109,105,110,0,1,0,0,9,120,0,0,1, 0,0,9,121,0,0,0,1,8,18,121,0,18,120,0,40,18,121,0,18,120,0,31,0, 0,1,0,10,0,109,105,110,0,1,0,0,10,120,0,0,1,0,0,9,121,0,0,0, 1,8,58,118,101,99,50,0,58,109,105,110,0,18,120,0,59,120,0,0,18,121,0,0, 0,0,58,109,105,110,0,18,120,0,59,121,0,0,18,121,0,0,0,0,0,0,0,1, 0,11,0,109,105,110,0,1,0,0,11,120,0,0,1,0,0,9,121,0,0,0,1,8, 58,118,101,99,51,0,58,109,105,110,0,18,120,0,59,120,0,0,18,121,0,0,0,0, 58,109,105,110,0,18,120,0,59,121,0,0,18,121,0,0,0,0,58,109,105,110,0,18, 120,0,59,122,0,0,18,121,0,0,0,0,0,0,0,1,0,12,0,109,105,110,0,1, 0,0,12,120,0,0,1,0,0,9,121,0,0,0,1,8,58,118,101,99,52,0,58,109, 105,110,0,18,120,0,59,120,0,0,18,121,0,0,0,0,58,109,105,110,0,18,120,0, 59,121,0,0,18,121,0,0,0,0,58,109,105,110,0,18,120,0,59,122,0,0,18,121, 0,0,0,0,58,109,105,110,0,18,120,0,59,119,0,0,18,121,0,0,0,0,0,0, 0,1,0,10,0,109,105,110,0,1,0,0,10,120,0,0,1,0,0,10,121,0,0,0, 1,8,58,118,101,99,50,0,58,109,105,110,0,18,120,0,59,120,0,0,18,121,0,59, 120,0,0,0,0,58,109,105,110,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0, 0,0,0,0,0,1,0,11,0,109,105,110,0,1,0,0,11,120,0,0,1,0,0,11, 121,0,0,0,1,8,58,118,101,99,51,0,58,109,105,110,0,18,120,0,59,120,0,0, 18,121,0,59,120,0,0,0,0,58,109,105,110,0,18,120,0,59,121,0,0,18,121,0, 59,121,0,0,0,0,58,109,105,110,0,18,120,0,59,122,0,0,18,121,0,59,122,0, 0,0,0,0,0,0,1,0,12,0,109,105,110,0,1,0,0,12,120,0,0,1,0,0, 12,121,0,0,0,1,8,58,118,101,99,52,0,58,109,105,110,0,18,120,0,59,120,0, 0,18,121,0,59,120,0,0,0,0,58,109,105,110,0,18,120,0,59,121,0,0,18,121, 0,59,121,0,0,0,0,58,109,105,110,0,18,120,0,59,122,0,0,18,121,0,59,122, 0,0,0,0,58,109,105,110,0,18,120,0,59,119,0,0,18,121,0,59,119,0,0,0, 0,0,0,0,1,0,9,0,109,97,120,0,1,0,0,9,120,0,0,1,0,0,9,121, 0,0,0,1,8,58,109,105,110,0,18,121,0,0,18,120,0,0,0,0,0,1,0,10, 0,109,97,120,0,1,0,0,10,120,0,0,1,0,0,9,121,0,0,0,1,8,58,118, 101,99,50,0,58,109,97,120,0,18,120,0,59,120,0,0,18,121,0,0,0,0,58,109, 97,120,0,18,120,0,59,121,0,0,18,121,0,0,0,0,0,0,0,1,0,11,0,109, 97,120,0,1,0,0,11,120,0,0,1,0,0,9,121,0,0,0,1,8,58,118,101,99, 51,0,58,109,97,120,0,18,120,0,59,120,0,0,18,121,0,0,0,0,58,109,97,120, 0,18,120,0,59,121,0,0,18,121,0,0,0,0,58,109,97,120,0,18,120,0,59,122, 0,0,18,121,0,0,0,0,0,0,0,1,0,12,0,109,97,120,0,1,0,0,12,120, 0,0,1,0,0,9,121,0,0,0,1,8,58,118,101,99,52,0,58,109,97,120,0,18, 120,0,59,120,0,0,18,121,0,0,0,0,58,109,97,120,0,18,120,0,59,121,0,0, 18,121,0,0,0,0,58,109,97,120,0,18,120,0,59,122,0,0,18,121,0,0,0,0, 58,109,97,120,0,18,120,0,59,119,0,0,18,121,0,0,0,0,0,0,0,1,0,10, 0,109,97,120,0,1,0,0,10,120,0,0,1,0,0,10,121,0,0,0,1,8,58,118, 101,99,50,0,58,109,97,120,0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,0, 0,58,109,97,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,0,0,0,0, 0,1,0,11,0,109,97,120,0,1,0,0,11,120,0,0,1,0,0,11,121,0,0,0, 1,8,58,118,101,99,51,0,58,109,97,120,0,18,120,0,59,120,0,0,18,121,0,59, 120,0,0,0,0,58,109,97,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0, 0,0,58,109,97,120,0,18,120,0,59,122,0,0,18,121,0,59,122,0,0,0,0,0, 0,0,1,0,12,0,109,97,120,0,1,0,0,12,120,0,0,1,0,0,12,121,0,0, 0,1,8,58,118,101,99,52,0,58,109,97,120,0,18,120,0,59,120,0,0,18,121,0, 59,120,0,0,0,0,58,109,97,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0, 0,0,0,58,109,97,120,0,18,120,0,59,122,0,0,18,121,0,59,122,0,0,0,0, 58,109,97,120,0,18,120,0,59,119,0,0,18,121,0,59,119,0,0,0,0,0,0,0, 1,0,9,0,99,108,97,109,112,0,1,0,0,9,120,0,0,1,0,0,9,109,105,110, 86,97,108,0,0,1,0,0,9,109,97,120,86,97,108,0,0,0,1,8,58,109,105,110, 0,58,109,97,120,0,18,120,0,0,18,109,105,110,86,97,108,0,0,0,0,18,109,97, 120,86,97,108,0,0,0,0,0,1,0,10,0,99,108,97,109,112,0,1,0,0,10,120, 0,0,1,0,0,9,109,105,110,86,97,108,0,0,1,0,0,9,109,97,120,86,97,108, 0,0,0,1,8,58,118,101,99,50,0,58,99,108,97,109,112,0,18,120,0,59,120,0, 0,18,109,105,110,86,97,108,0,0,18,109,97,120,86,97,108,0,0,0,0,58,99,108, 97,109,112,0,18,120,0,59,121,0,0,18,109,105,110,86,97,108,0,0,18,109,97,120, 86,97,108,0,0,0,0,0,0,0,1,0,11,0,99,108,97,109,112,0,1,0,0,11, 120,0,0,1,0,0,9,109,105,110,86,97,108,0,0,1,0,0,9,109,97,120,86,97, 108,0,0,0,1,8,58,118,101,99,51,0,58,99,108,97,109,112,0,18,120,0,59,120, 0,0,18,109,105,110,86,97,108,0,0,18,109,97,120,86,97,108,0,0,0,0,58,99, 108,97,109,112,0,18,120,0,59,121,0,0,18,109,105,110,86,97,108,0,0,18,109,97, 120,86,97,108,0,0,0,0,58,99,108,97,109,112,0,18,120,0,59,122,0,0,18,109, 105,110,86,97,108,0,0,18,109,97,120,86,97,108,0,0,0,0,0,0,0,1,0,12, 0,99,108,97,109,112,0,1,0,0,12,120,0,0,1,0,0,9,109,105,110,86,97,108, 0,0,1,0,0,9,109,97,120,86,97,108,0,0,0,1,8,58,118,101,99,52,0,58, 99,108,97,109,112,0,18,120,0,59,120,0,0,18,109,105,110,86,97,108,0,0,18,109, 97,120,86,97,108,0,0,0,0,58,99,108,97,109,112,0,18,120,0,59,121,0,0,18, 109,105,110,86,97,108,0,0,18,109,97,120,86,97,108,0,0,0,0,58,99,108,97,109, 112,0,18,120,0,59,122,0,0,18,109,105,110,86,97,108,0,0,18,109,97,120,86,97, 108,0,0,0,0,58,99,108,97,109,112,0,18,120,0,59,119,0,0,18,109,105,110,86, 97,108,0,0,18,109,97,120,86,97,108,0,0,0,0,0,0,0,1,0,10,0,99,108, 97,109,112,0,1,0,0,10,120,0,0,1,0,0,10,109,105,110,86,97,108,0,0,1, 0,0,10,109,97,120,86,97,108,0,0,0,1,8,58,118,101,99,50,0,58,99,108,97, 109,112,0,18,120,0,59,120,0,0,18,109,105,110,86,97,108,0,59,120,0,0,18,109, 97,120,86,97,108,0,59,120,0,0,0,0,58,99,108,97,109,112,0,18,120,0,59,121, 0,0,18,109,105,110,86,97,108,0,59,121,0,0,18,109,97,120,86,97,108,0,59,121, 0,0,0,0,0,0,0,1,0,11,0,99,108,97,109,112,0,1,0,0,11,120,0,0, 1,0,0,11,109,105,110,86,97,108,0,0,1,0,0,11,109,97,120,86,97,108,0,0, 0,1,8,58,118,101,99,51,0,58,99,108,97,109,112,0,18,120,0,59,120,0,0,18, 109,105,110,86,97,108,0,59,120,0,0,18,109,97,120,86,97,108,0,59,120,0,0,0, 0,58,99,108,97,109,112,0,18,120,0,59,121,0,0,18,109,105,110,86,97,108,0,59, 121,0,0,18,109,97,120,86,97,108,0,59,121,0,0,0,0,58,99,108,97,109,112,0, 18,120,0,59,122,0,0,18,109,105,110,86,97,108,0,59,122,0,0,18,109,97,120,86, 97,108,0,59,122,0,0,0,0,0,0,0,1,0,12,0,99,108,97,109,112,0,1,0, 0,12,120,0,0,1,0,0,12,109,105,110,86,97,108,0,0,1,0,0,12,109,97,120, 86,97,108,0,0,0,1,8,58,118,101,99,52,0,58,99,108,97,109,112,0,18,120,0, 59,120,0,0,18,109,105,110,86,97,108,0,59,120,0,0,18,109,97,120,86,97,108,0, 59,121,0,0,0,0,58,99,108,97,109,112,0,18,120,0,59,121,0,0,18,109,105,110, 86,97,108,0,59,121,0,0,18,109,97,120,86,97,108,0,59,121,0,0,0,0,58,99, 108,97,109,112,0,18,120,0,59,122,0,0,18,109,105,110,86,97,108,0,59,122,0,0, 18,109,97,120,86,97,108,0,59,122,0,0,0,0,58,99,108,97,109,112,0,18,120,0, 59,119,0,0,18,109,105,110,86,97,108,0,59,119,0,0,18,109,97,120,86,97,108,0, 59,119,0,0,0,0,0,0,0,1,0,9,0,109,105,120,0,1,0,0,9,120,0,0, 1,0,0,9,121,0,0,1,0,0,9,97,0,0,0,1,8,18,120,0,17,49,0,48, 0,0,18,97,0,47,48,18,121,0,18,97,0,48,46,0,0,1,0,10,0,109,105,120, 0,1,0,0,10,120,0,0,1,0,0,10,121,0,0,1,0,0,9,97,0,0,0,1, 8,58,118,101,99,50,0,58,109,105,120,0,18,120,0,59,120,0,0,18,121,0,59,120, 0,0,18,97,0,0,0,0,58,109,105,120,0,18,120,0,59,121,0,0,18,121,0,59, 121,0,0,18,97,0,0,0,0,0,0,0,1,0,11,0,109,105,120,0,1,0,0,11, 120,0,0,1,0,0,11,121,0,0,1,0,0,9,97,0,0,0,1,8,58,118,101,99, 51,0,58,109,105,120,0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,18,97,0, 0,0,0,58,109,105,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,18,97, 0,0,0,0,58,109,105,120,0,18,120,0,59,122,0,0,18,121,0,59,122,0,0,18, 97,0,0,0,0,0,0,0,1,0,12,0,109,105,120,0,1,0,0,12,120,0,0,1, 0,0,12,121,0,0,1,0,0,9,97,0,0,0,1,8,58,118,101,99,52,0,58,109, 105,120,0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,18,97,0,0,0,0,58, 109,105,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,18,97,0,0,0,0, 58,109,105,120,0,18,120,0,59,122,0,0,18,121,0,59,122,0,0,18,97,0,0,0, 0,58,109,105,120,0,18,120,0,59,119,0,0,18,121,0,59,119,0,0,18,97,0,0, 0,0,0,0,0,1,0,10,0,109,105,120,0,1,0,0,10,120,0,0,1,0,0,10, 121,0,0,1,0,0,10,97,0,0,0,1,8,58,118,101,99,50,0,58,109,105,120,0, 18,120,0,59,120,0,0,18,121,0,59,120,0,0,18,97,0,59,120,0,0,0,0,58, 109,105,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,18,97,0,59,121,0, 0,0,0,0,0,0,1,0,11,0,109,105,120,0,1,0,0,11,120,0,0,1,0,0, 11,121,0,0,1,0,0,11,97,0,0,0,1,8,58,118,101,99,51,0,58,109,105,120, 0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,18,97,0,59,120,0,0,0,0, 58,109,105,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,18,97,0,59,121, 0,0,0,0,58,109,105,120,0,18,120,0,59,122,0,0,18,121,0,59,122,0,0,18, 97,0,59,122,0,0,0,0,0,0,0,1,0,12,0,109,105,120,0,1,0,0,12,120, 0,0,1,0,0,12,121,0,0,1,0,0,12,97,0,0,0,1,8,58,118,101,99,52, 0,58,109,105,120,0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,18,97,0,59, 120,0,0,0,0,58,109,105,120,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0, 18,97,0,59,121,0,0,0,0,58,109,105,120,0,18,120,0,59,122,0,0,18,121,0, 59,122,0,0,18,97,0,59,122,0,0,0,0,58,109,105,120,0,18,120,0,59,119,0, 0,18,121,0,59,119,0,0,18,97,0,59,119,0,0,0,0,0,0,0,1,0,9,0, 115,116,101,112,0,1,0,0,9,101,100,103,101,0,0,1,0,0,9,120,0,0,0,1, 8,18,120,0,18,101,100,103,101,0,40,17,48,0,48,0,0,17,49,0,48,0,0,31, 0,0,1,0,10,0,115,116,101,112,0,1,0,0,9,101,100,103,101,0,0,1,0,0, 10,120,0,0,0,1,8,58,118,101,99,50,0,58,115,116,101,112,0,18,101,100,103,101, 0,0,18,120,0,59,120,0,0,0,0,58,115,116,101,112,0,18,101,100,103,101,0,0, 18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,115,116,101,112,0,1,0,0, 9,101,100,103,101,0,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58, 115,116,101,112,0,18,101,100,103,101,0,0,18,120,0,59,120,0,0,0,0,58,115,116, 101,112,0,18,101,100,103,101,0,0,18,120,0,59,121,0,0,0,0,58,115,116,101,112, 0,18,101,100,103,101,0,0,18,120,0,59,122,0,0,0,0,0,0,0,1,0,12,0, 115,116,101,112,0,1,0,0,9,101,100,103,101,0,0,1,0,0,12,120,0,0,0,1, 8,58,118,101,99,52,0,58,115,116,101,112,0,18,101,100,103,101,0,0,18,120,0,59, 120,0,0,0,0,58,115,116,101,112,0,18,101,100,103,101,0,0,18,120,0,59,121,0, 0,0,0,58,115,116,101,112,0,18,101,100,103,101,0,0,18,120,0,59,122,0,0,0, 0,58,115,116,101,112,0,18,101,100,103,101,0,0,18,120,0,59,119,0,0,0,0,0, 0,0,1,0,10,0,115,116,101,112,0,1,0,0,10,101,100,103,101,0,0,1,0,0, 10,120,0,0,0,1,8,58,118,101,99,50,0,58,115,116,101,112,0,18,101,100,103,101, 0,59,120,0,0,18,120,0,59,120,0,0,0,0,58,115,116,101,112,0,18,101,100,103, 101,0,59,121,0,0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,115,116, 101,112,0,1,0,0,11,101,100,103,101,0,0,1,0,0,11,120,0,0,0,1,8,58, 118,101,99,51,0,58,115,116,101,112,0,18,101,100,103,101,0,59,120,0,0,18,120,0, 59,120,0,0,0,0,58,115,116,101,112,0,18,101,100,103,101,0,59,121,0,0,18,120, 0,59,121,0,0,0,0,58,115,116,101,112,0,18,101,100,103,101,0,59,122,0,0,18, 120,0,59,122,0,0,0,0,0,0,0,1,0,12,0,115,116,101,112,0,1,0,0,12, 101,100,103,101,0,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,58,115, 116,101,112,0,18,101,100,103,101,0,59,120,0,0,18,120,0,59,120,0,0,0,0,58, 115,116,101,112,0,18,101,100,103,101,0,59,121,0,0,18,120,0,59,121,0,0,0,0, 58,115,116,101,112,0,18,101,100,103,101,0,59,122,0,0,18,120,0,59,122,0,0,0, 0,58,115,116,101,112,0,18,101,100,103,101,0,59,119,0,0,18,120,0,59,119,0,0, 0,0,0,0,0,1,0,9,0,115,109,111,111,116,104,115,116,101,112,0,1,0,0,9, 101,100,103,101,48,0,0,1,0,0,9,101,100,103,101,49,0,0,1,0,0,9,120,0, 0,0,1,3,2,1,9,1,116,0,2,58,99,108,97,109,112,0,18,120,0,18,101,100, 103,101,48,0,47,18,101,100,103,101,49,0,18,101,100,103,101,48,0,47,49,0,17,48, 0,48,0,0,0,17,49,0,48,0,0,0,0,0,0,8,18,116,0,18,116,0,48,17, 51,0,48,0,0,17,50,0,48,0,0,18,116,0,48,47,48,0,0,1,0,10,0,115, 109,111,111,116,104,115,116,101,112,0,1,0,0,9,101,100,103,101,48,0,0,1,0,0, 9,101,100,103,101,49,0,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,50,0, 58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,0,18,101,100,103, 101,49,0,0,18,120,0,59,120,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112, 0,18,101,100,103,101,48,0,0,18,101,100,103,101,49,0,0,18,120,0,59,121,0,0, 0,0,0,0,0,1,0,11,0,115,109,111,111,116,104,115,116,101,112,0,1,0,0,9, 101,100,103,101,48,0,0,1,0,0,9,101,100,103,101,49,0,0,1,0,0,11,120,0, 0,0,1,8,58,118,101,99,51,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101, 100,103,101,48,0,0,18,101,100,103,101,49,0,0,18,120,0,59,120,0,0,0,0,58, 115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,0,18,101,100,103,101, 49,0,0,18,120,0,59,121,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112,0, 18,101,100,103,101,48,0,0,18,101,100,103,101,49,0,0,18,120,0,59,122,0,0,0, 0,0,0,0,1,0,12,0,115,109,111,111,116,104,115,116,101,112,0,1,0,0,9,101, 100,103,101,48,0,0,1,0,0,9,101,100,103,101,49,0,0,1,0,0,12,120,0,0, 0,1,8,58,118,101,99,52,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100, 103,101,48,0,0,18,101,100,103,101,49,0,0,18,120,0,59,120,0,0,0,0,58,115, 109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,0,18,101,100,103,101,49, 0,0,18,120,0,59,121,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112,0,18, 101,100,103,101,48,0,0,18,101,100,103,101,49,0,0,18,120,0,59,122,0,0,0,0, 58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,0,18,101,100,103, 101,49,0,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,10,0,115,109,111,111, 116,104,115,116,101,112,0,1,0,0,10,101,100,103,101,48,0,0,1,0,0,10,101,100, 103,101,49,0,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,115,109, 111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,59,120,0,0,18,101,100,103, 101,49,0,59,120,0,0,18,120,0,59,120,0,0,0,0,58,115,109,111,111,116,104,115, 116,101,112,0,18,101,100,103,101,48,0,59,121,0,0,18,101,100,103,101,49,0,59,121, 0,0,18,120,0,59,121,0,0,0,0,0,0,0,1,0,11,0,115,109,111,111,116,104, 115,116,101,112,0,1,0,0,11,101,100,103,101,48,0,0,1,0,0,11,101,100,103,101, 49,0,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,115,109,111,111, 116,104,115,116,101,112,0,18,101,100,103,101,48,0,59,120,0,0,18,101,100,103,101,49, 0,59,120,0,0,18,120,0,59,120,0,0,0,0,58,115,109,111,111,116,104,115,116,101, 112,0,18,101,100,103,101,48,0,59,121,0,0,18,101,100,103,101,49,0,59,121,0,0, 18,120,0,59,121,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100, 103,101,48,0,59,122,0,0,18,101,100,103,101,49,0,59,122,0,0,18,120,0,59,122, 0,0,0,0,0,0,0,1,0,12,0,115,109,111,111,116,104,115,116,101,112,0,1,0, 0,12,101,100,103,101,48,0,0,1,0,0,12,101,100,103,101,49,0,0,1,0,0,12, 120,0,0,0,1,8,58,118,101,99,52,0,58,115,109,111,111,116,104,115,116,101,112,0, 18,101,100,103,101,48,0,59,120,0,0,18,101,100,103,101,49,0,59,120,0,0,18,120, 0,59,120,0,0,0,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101, 48,0,59,121,0,0,18,101,100,103,101,49,0,59,121,0,0,18,120,0,59,121,0,0, 0,0,58,115,109,111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,59,122,0, 0,18,101,100,103,101,49,0,59,122,0,0,18,120,0,59,122,0,0,0,0,58,115,109, 111,111,116,104,115,116,101,112,0,18,101,100,103,101,48,0,59,119,0,0,18,101,100,103, 101,49,0,59,119,0,0,18,120,0,59,119,0,0,0,0,0,0,0,1,0,9,0,100, 111,116,0,1,0,0,9,120,0,0,1,0,0,9,121,0,0,0,1,8,18,120,0,18, 121,0,48,0,0,1,0,9,0,100,111,116,0,1,0,0,10,120,0,0,1,0,0,10, 121,0,0,0,1,8,58,100,111,116,0,18,120,0,59,120,0,0,18,121,0,59,120,0, 0,0,58,100,111,116,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,0,46,0, 0,1,0,9,0,100,111,116,0,1,0,0,11,120,0,0,1,0,0,11,121,0,0,0, 1,8,58,100,111,116,0,18,120,0,59,120,0,0,18,121,0,59,120,0,0,0,58,100, 111,116,0,18,120,0,59,121,0,0,18,121,0,59,121,0,0,0,46,58,100,111,116,0, 18,120,0,59,122,0,0,18,121,0,59,122,0,0,0,46,0,0,1,0,9,0,100,111, 116,0,1,0,0,12,120,0,0,1,0,0,12,121,0,0,0,1,8,58,100,111,116,0, 18,120,0,59,120,0,0,18,121,0,59,120,0,0,0,58,100,111,116,0,18,120,0,59, 121,0,0,18,121,0,59,121,0,0,0,46,58,100,111,116,0,18,120,0,59,122,0,0, 18,121,0,59,122,0,0,0,46,58,100,111,116,0,18,120,0,59,119,0,0,18,121,0, 59,119,0,0,0,46,0,0,1,0,9,0,108,101,110,103,116,104,0,1,0,0,9,120, 0,0,0,1,8,58,115,113,114,116,0,58,100,111,116,0,18,120,0,0,18,120,0,0, 0,0,0,0,0,1,0,9,0,108,101,110,103,116,104,0,1,0,0,10,120,0,0,0, 1,8,58,115,113,114,116,0,58,100,111,116,0,18,120,0,0,18,120,0,0,0,0,0, 0,0,1,0,9,0,108,101,110,103,116,104,0,1,0,0,11,120,0,0,0,1,8,58, 115,113,114,116,0,58,100,111,116,0,18,120,0,0,18,120,0,0,0,0,0,0,0,1, 0,9,0,108,101,110,103,116,104,0,1,0,0,12,120,0,0,0,1,8,58,115,113,114, 116,0,58,100,111,116,0,18,120,0,0,18,120,0,0,0,0,0,0,0,1,0,9,0, 100,105,115,116,97,110,99,101,0,1,0,0,9,120,0,0,1,0,0,9,121,0,0,0, 1,8,58,108,101,110,103,116,104,0,18,120,0,18,121,0,47,0,0,0,0,1,0,9, 0,100,105,115,116,97,110,99,101,0,1,0,0,10,120,0,0,1,0,0,10,121,0,0, 0,1,8,58,108,101,110,103,116,104,0,18,120,0,18,121,0,47,0,0,0,0,1,0, 9,0,100,105,115,116,97,110,99,101,0,1,0,0,11,120,0,0,1,0,0,11,121,0, 0,0,1,8,58,108,101,110,103,116,104,0,18,120,0,18,121,0,47,0,0,0,0,1, 0,9,0,100,105,115,116,97,110,99,101,0,1,0,0,12,120,0,0,1,0,0,12,121, 0,0,0,1,8,58,108,101,110,103,116,104,0,18,120,0,18,121,0,47,0,0,0,0, 1,0,11,0,99,114,111,115,115,0,1,0,0,11,120,0,0,1,0,0,11,121,0,0, 0,1,8,58,118,101,99,51,0,18,120,0,59,121,0,18,121,0,59,122,0,48,18,121, 0,59,121,0,18,120,0,59,122,0,48,47,0,18,120,0,59,122,0,18,121,0,59,120, 0,48,18,121,0,59,122,0,18,120,0,59,120,0,48,47,0,18,120,0,59,120,0,18, 121,0,59,121,0,48,18,121,0,59,120,0,18,120,0,59,121,0,48,47,0,0,0,0, 1,0,9,0,110,111,114,109,97,108,105,122,101,0,1,0,0,9,120,0,0,0,1,8, 17,49,0,48,0,0,0,0,1,0,10,0,110,111,114,109,97,108,105,122,101,0,1,0, 0,10,120,0,0,0,1,8,18,120,0,58,108,101,110,103,116,104,0,18,120,0,0,0, 49,0,0,1,0,11,0,110,111,114,109,97,108,105,122,101,0,1,0,0,11,120,0,0, 0,1,8,18,120,0,58,108,101,110,103,116,104,0,18,120,0,0,0,49,0,0,1,0, 12,0,110,111,114,109,97,108,105,122,101,0,1,0,0,12,120,0,0,0,1,8,18,120, 0,58,108,101,110,103,116,104,0,18,120,0,0,0,49,0,0,1,0,9,0,102,97,99, 101,102,111,114,119,97,114,100,0,1,0,0,9,78,0,0,1,0,0,9,73,0,0,1, 0,0,9,78,114,101,102,0,0,0,1,8,58,100,111,116,0,18,78,114,101,102,0,0, 18,73,0,0,0,17,48,0,48,0,0,40,18,78,0,18,78,0,54,31,0,0,1,0, 10,0,102,97,99,101,102,111,114,119,97,114,100,0,1,0,0,10,78,0,0,1,0,0, 10,73,0,0,1,0,0,10,78,114,101,102,0,0,0,1,8,58,100,111,116,0,18,78, 114,101,102,0,0,18,73,0,0,0,17,48,0,48,0,0,40,18,78,0,18,78,0,54, 31,0,0,1,0,11,0,102,97,99,101,102,111,114,119,97,114,100,0,1,0,0,11,78, 0,0,1,0,0,11,73,0,0,1,0,0,11,78,114,101,102,0,0,0,1,8,58,100, 111,116,0,18,78,114,101,102,0,0,18,73,0,0,0,17,48,0,48,0,0,40,18,78, 0,18,78,0,54,31,0,0,1,0,12,0,102,97,99,101,102,111,114,119,97,114,100,0, 1,0,0,12,78,0,0,1,0,0,12,73,0,0,1,0,0,12,78,114,101,102,0,0, 0,1,8,58,100,111,116,0,18,78,114,101,102,0,0,18,73,0,0,0,17,48,0,48, 0,0,40,18,78,0,18,78,0,54,31,0,0,1,0,9,0,114,101,102,108,101,99,116, 0,1,0,0,9,73,0,0,1,0,0,9,78,0,0,0,1,8,18,73,0,17,50,0, 48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,18,78,0,48,47,0, 0,1,0,10,0,114,101,102,108,101,99,116,0,1,0,0,10,73,0,0,1,0,0,10, 78,0,0,0,1,8,18,73,0,17,50,0,48,0,0,58,100,111,116,0,18,78,0,0, 18,73,0,0,0,48,18,78,0,48,47,0,0,1,0,11,0,114,101,102,108,101,99,116, 0,1,0,0,11,73,0,0,1,0,0,11,78,0,0,0,1,8,18,73,0,17,50,0, 48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,18,78,0,48,47,0, 0,1,0,12,0,114,101,102,108,101,99,116,0,1,0,0,12,73,0,0,1,0,0,12, 78,0,0,0,1,8,18,73,0,17,50,0,48,0,0,58,100,111,116,0,18,78,0,0, 18,73,0,0,0,48,18,78,0,48,47,0,0,1,0,9,0,114,101,102,114,97,99,116, 0,1,0,0,9,73,0,0,1,0,0,9,78,0,0,1,0,0,9,101,116,97,0,0, 0,1,3,2,1,9,1,107,0,2,17,49,0,48,0,0,18,101,116,97,0,18,101,116, 97,0,48,17,49,0,48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,58, 100,111,116,0,18,78,0,0,18,73,0,0,0,48,47,48,47,0,0,10,18,107,0,17, 48,0,48,0,0,40,0,8,17,48,0,48,0,0,0,9,14,0,8,18,101,116,97,0, 18,73,0,48,18,101,116,97,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48, 58,115,113,114,116,0,18,107,0,0,0,46,18,78,0,48,47,0,0,1,0,10,0,114, 101,102,114,97,99,116,0,1,0,0,10,73,0,0,1,0,0,10,78,0,0,1,0,0, 9,101,116,97,0,0,0,1,3,2,1,9,1,107,0,2,17,49,0,48,0,0,18,101, 116,97,0,18,101,116,97,0,48,17,49,0,48,0,0,58,100,111,116,0,18,78,0,0, 18,73,0,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,47,48,47,0, 0,10,18,107,0,17,48,0,48,0,0,40,0,8,58,118,101,99,50,0,17,48,0,48, 0,0,0,0,0,9,14,0,8,18,101,116,97,0,18,73,0,48,18,101,116,97,0,58, 100,111,116,0,18,78,0,0,18,73,0,0,0,48,58,115,113,114,116,0,18,107,0,0, 0,46,18,78,0,48,47,0,0,1,0,11,0,114,101,102,114,97,99,116,0,1,0,0, 11,73,0,0,1,0,0,11,78,0,0,1,0,0,9,101,116,97,0,0,0,1,3,2, 1,9,1,107,0,2,17,49,0,48,0,0,18,101,116,97,0,18,101,116,97,0,48,17, 49,0,48,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,58,100,111,116,0, 18,78,0,0,18,73,0,0,0,48,47,48,47,0,0,10,18,107,0,17,48,0,48,0, 0,40,0,8,58,118,101,99,51,0,17,48,0,48,0,0,0,0,0,9,14,0,8,18, 101,116,97,0,18,73,0,48,18,101,116,97,0,58,100,111,116,0,18,78,0,0,18,73, 0,0,0,48,58,115,113,114,116,0,18,107,0,0,0,46,18,78,0,48,47,0,0,1, 0,12,0,114,101,102,114,97,99,116,0,1,0,0,12,73,0,0,1,0,0,12,78,0, 0,1,0,0,9,101,116,97,0,0,0,1,3,2,1,9,1,107,0,2,17,49,0,48, 0,0,18,101,116,97,0,18,101,116,97,0,48,17,49,0,48,0,0,58,100,111,116,0, 18,78,0,0,18,73,0,0,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48, 47,48,47,0,0,10,18,107,0,17,48,0,48,0,0,40,0,8,58,118,101,99,52,0, 17,48,0,48,0,0,0,0,0,9,14,0,8,18,101,116,97,0,18,73,0,48,18,101, 116,97,0,58,100,111,116,0,18,78,0,0,18,73,0,0,0,48,58,115,113,114,116,0, 18,107,0,0,0,46,18,78,0,48,47,0,0,1,0,13,0,109,97,116,114,105,120,67, 111,109,112,77,117,108,116,0,1,0,0,13,120,0,0,1,0,0,13,121,0,0,0,1, 8,58,109,97,116,50,0,18,120,0,16,8,48,0,57,59,120,0,18,121,0,16,8,48, 0,57,59,120,0,48,0,18,120,0,16,8,48,0,57,59,121,0,18,121,0,16,8,48, 0,57,59,121,0,48,0,18,120,0,16,10,49,0,57,59,120,0,18,121,0,16,10,49, 0,57,59,120,0,48,0,18,120,0,16,10,49,0,57,59,121,0,18,121,0,16,10,49, 0,57,59,121,0,48,0,0,0,0,1,0,14,0,109,97,116,114,105,120,67,111,109,112, 77,117,108,116,0,1,0,0,14,120,0,0,1,0,0,14,121,0,0,0,1,8,58,109, 97,116,52,0,18,120,0,16,8,48,0,57,59,120,0,18,121,0,16,8,48,0,57,59, 120,0,48,0,18,120,0,16,8,48,0,57,59,121,0,18,121,0,16,8,48,0,57,59, 121,0,48,0,18,120,0,16,8,48,0,57,59,122,0,18,121,0,16,8,48,0,57,59, 122,0,48,0,18,120,0,16,10,49,0,57,59,120,0,18,121,0,16,10,49,0,57,59, 120,0,48,0,18,120,0,16,10,49,0,57,59,121,0,18,121,0,16,10,49,0,57,59, 121,0,48,0,18,120,0,16,10,49,0,57,59,122,0,18,121,0,16,10,49,0,57,59, 122,0,48,0,18,120,0,16,10,50,0,57,59,120,0,18,121,0,16,10,50,0,57,59, 120,0,48,0,18,120,0,16,10,50,0,57,59,121,0,18,121,0,16,10,50,0,57,59, 121,0,48,0,18,120,0,16,10,50,0,57,59,122,0,18,121,0,16,10,50,0,57,59, 122,0,48,0,0,0,0,1,0,15,0,109,97,116,114,105,120,67,111,109,112,77,117,108, 116,0,1,0,0,15,120,0,0,1,0,0,15,121,0,0,0,1,8,58,109,97,116,52, 0,18,120,0,16,8,48,0,57,59,120,0,18,121,0,16,8,48,0,57,59,120,0,48, 0,18,120,0,16,8,48,0,57,59,121,0,18,121,0,16,8,48,0,57,59,121,0,48, 0,18,120,0,16,8,48,0,57,59,122,0,18,121,0,16,8,48,0,57,59,122,0,48, 18,120,0,16,8,48,0,57,59,119,0,18,121,0,16,8,48,0,57,59,119,0,48,46, 0,18,120,0,16,10,49,0,57,59,120,0,18,121,0,16,10,49,0,57,59,120,0,48, 0,18,120,0,16,10,49,0,57,59,121,0,18,121,0,16,10,49,0,57,59,121,0,48, 0,18,120,0,16,10,49,0,57,59,122,0,18,121,0,16,10,49,0,57,59,122,0,48, 18,120,0,16,10,49,0,57,59,119,0,18,121,0,16,10,49,0,57,59,119,0,48,46, 0,18,120,0,16,10,50,0,57,59,120,0,18,121,0,16,10,50,0,57,59,120,0,48, 0,18,120,0,16,10,50,0,57,59,121,0,18,121,0,16,10,50,0,57,59,121,0,48, 0,18,120,0,16,10,50,0,57,59,122,0,18,121,0,16,10,50,0,57,59,122,0,48, 18,120,0,16,10,50,0,57,59,119,0,18,121,0,16,10,50,0,57,59,119,0,48,46, 0,18,120,0,16,10,51,0,57,59,120,0,18,121,0,16,10,51,0,57,59,120,0,48, 0,18,120,0,16,10,51,0,57,59,121,0,18,121,0,16,10,51,0,57,59,121,0,48, 0,18,120,0,16,10,51,0,57,59,122,0,18,121,0,16,10,51,0,57,59,122,0,48, 18,120,0,16,10,51,0,57,59,119,0,18,121,0,16,10,51,0,57,59,119,0,48,46, 0,0,0,0,1,0,2,0,108,101,115,115,84,104,97,110,0,1,0,0,10,120,0,0, 1,0,0,10,121,0,0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18, 121,0,59,120,0,40,0,18,120,0,59,121,0,18,121,0,59,121,0,40,0,0,0,0, 1,0,3,0,108,101,115,115,84,104,97,110,0,1,0,0,11,120,0,0,1,0,0,11, 121,0,0,0,1,8,58,98,118,101,99,51,0,18,120,0,59,120,0,18,121,0,59,120, 0,40,0,18,120,0,59,121,0,18,121,0,59,121,0,40,0,18,120,0,59,122,0,18, 121,0,59,122,0,40,0,0,0,0,1,0,4,0,108,101,115,115,84,104,97,110,0,1, 0,0,12,120,0,0,1,0,0,12,121,0,0,0,1,8,58,98,118,101,99,52,0,18, 120,0,59,120,0,18,121,0,59,120,0,40,0,18,120,0,59,121,0,18,121,0,59,121, 0,40,0,18,120,0,59,122,0,18,121,0,59,122,0,40,0,18,120,0,59,119,0,18, 121,0,59,119,0,40,0,0,0,0,1,0,2,0,108,101,115,115,84,104,97,110,0,1, 0,0,6,120,0,0,1,0,0,6,121,0,0,0,1,8,58,98,118,101,99,50,0,18, 120,0,59,120,0,18,121,0,59,120,0,40,0,18,120,0,59,121,0,18,121,0,59,121, 0,40,0,0,0,0,1,0,3,0,108,101,115,115,84,104,97,110,0,1,0,0,7,120, 0,0,1,0,0,7,121,0,0,0,1,8,58,98,118,101,99,51,0,18,120,0,59,120, 0,18,121,0,59,120,0,40,0,18,120,0,59,121,0,18,121,0,59,121,0,40,0,18, 120,0,59,122,0,18,121,0,59,122,0,40,0,0,0,0,1,0,4,0,108,101,115,115, 84,104,97,110,0,1,0,0,8,120,0,0,1,0,0,8,121,0,0,0,1,8,58,98, 118,101,99,52,0,18,120,0,59,120,0,18,121,0,59,120,0,40,0,18,120,0,59,121, 0,18,121,0,59,121,0,40,0,18,120,0,59,122,0,18,121,0,59,122,0,40,0,18, 120,0,59,119,0,18,121,0,59,119,0,40,0,0,0,0,1,0,2,0,108,101,115,115, 84,104,97,110,69,113,117,97,108,0,1,0,0,10,120,0,0,1,0,0,10,121,0,0, 0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18,121,0,59,120,0,42,0, 18,120,0,59,121,0,18,121,0,59,121,0,42,0,0,0,0,1,0,3,0,108,101,115, 115,84,104,97,110,69,113,117,97,108,0,1,0,0,11,120,0,0,1,0,0,11,121,0, 0,0,1,8,58,98,118,101,99,51,0,18,120,0,59,120,0,18,121,0,59,120,0,42, 0,18,120,0,59,121,0,18,121,0,59,121,0,42,0,18,120,0,59,122,0,18,121,0, 59,122,0,42,0,0,0,0,1,0,4,0,108,101,115,115,84,104,97,110,69,113,117,97, 108,0,1,0,0,12,120,0,0,1,0,0,12,121,0,0,0,1,8,58,98,118,101,99, 52,0,18,120,0,59,120,0,18,121,0,59,120,0,42,0,18,120,0,59,121,0,18,121, 0,59,121,0,42,0,18,120,0,59,122,0,18,121,0,59,122,0,42,0,18,120,0,59, 119,0,18,121,0,59,119,0,42,0,0,0,0,1,0,2,0,108,101,115,115,84,104,97, 110,69,113,117,97,108,0,1,0,0,6,120,0,0,1,0,0,6,121,0,0,0,1,8, 58,98,118,101,99,50,0,18,120,0,59,120,0,18,121,0,59,120,0,42,0,18,120,0, 59,121,0,18,121,0,59,121,0,42,0,0,0,0,1,0,3,0,108,101,115,115,84,104, 97,110,69,113,117,97,108,0,1,0,0,7,120,0,0,1,0,0,7,121,0,0,0,1, 8,58,98,118,101,99,51,0,18,120,0,59,120,0,18,121,0,59,120,0,42,0,18,120, 0,59,121,0,18,121,0,59,121,0,42,0,18,120,0,59,122,0,18,121,0,59,122,0, 42,0,0,0,0,1,0,4,0,108,101,115,115,84,104,97,110,69,113,117,97,108,0,1, 0,0,8,120,0,0,1,0,0,8,121,0,0,0,1,8,58,98,118,101,99,52,0,18, 120,0,59,120,0,18,121,0,59,120,0,42,0,18,120,0,59,121,0,18,121,0,59,121, 0,42,0,18,120,0,59,122,0,18,121,0,59,122,0,42,0,18,120,0,59,119,0,18, 121,0,59,119,0,42,0,0,0,0,1,0,2,0,103,114,101,97,116,101,114,84,104,97, 110,0,1,0,0,10,120,0,0,1,0,0,10,121,0,0,0,1,8,58,98,118,101,99, 50,0,18,120,0,59,120,0,18,121,0,59,120,0,41,0,18,120,0,59,121,0,18,121, 0,59,121,0,41,0,0,0,0,1,0,3,0,103,114,101,97,116,101,114,84,104,97,110, 0,1,0,0,11,120,0,0,1,0,0,11,121,0,0,0,1,8,58,98,118,101,99,51, 0,18,120,0,59,120,0,18,121,0,59,120,0,41,0,18,120,0,59,121,0,18,121,0, 59,121,0,41,0,18,120,0,59,122,0,18,121,0,59,122,0,41,0,0,0,0,1,0, 4,0,103,114,101,97,116,101,114,84,104,97,110,0,1,0,0,12,120,0,0,1,0,0, 12,121,0,0,0,1,8,58,98,118,101,99,52,0,18,120,0,59,120,0,18,121,0,59, 120,0,41,0,18,120,0,59,121,0,18,121,0,59,121,0,41,0,18,120,0,59,122,0, 18,121,0,59,122,0,41,0,18,120,0,59,119,0,18,121,0,59,119,0,41,0,0,0, 0,1,0,2,0,103,114,101,97,116,101,114,84,104,97,110,0,1,0,0,6,120,0,0, 1,0,0,6,121,0,0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18, 121,0,59,120,0,41,0,18,120,0,59,121,0,18,121,0,59,121,0,41,0,0,0,0, 1,0,3,0,103,114,101,97,116,101,114,84,104,97,110,0,1,0,0,7,120,0,0,1, 0,0,7,121,0,0,0,1,8,58,98,118,101,99,51,0,18,120,0,59,120,0,18,121, 0,59,120,0,41,0,18,120,0,59,121,0,18,121,0,59,121,0,41,0,18,120,0,59, 122,0,18,121,0,59,122,0,41,0,0,0,0,1,0,4,0,103,114,101,97,116,101,114, 84,104,97,110,0,1,0,0,8,120,0,0,1,0,0,8,121,0,0,0,1,8,58,98, 118,101,99,52,0,18,120,0,59,120,0,18,121,0,59,120,0,41,0,18,120,0,59,121, 0,18,121,0,59,121,0,41,0,18,120,0,59,122,0,18,121,0,59,122,0,41,0,18, 120,0,59,119,0,18,121,0,59,119,0,41,0,0,0,0,1,0,2,0,103,114,101,97, 116,101,114,84,104,97,110,69,113,117,97,108,0,1,0,0,10,120,0,0,1,0,0,10, 121,0,0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18,121,0,59,120, 0,43,0,18,120,0,59,121,0,18,121,0,59,121,0,43,0,0,0,0,1,0,3,0, 103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,0,1,0,0,11,120,0,0, 1,0,0,11,121,0,0,0,1,8,58,98,118,101,99,51,0,18,120,0,59,120,0,18, 121,0,59,120,0,43,0,18,120,0,59,121,0,18,121,0,59,121,0,43,0,18,120,0, 59,122,0,18,121,0,59,122,0,43,0,0,0,0,1,0,4,0,103,114,101,97,116,101, 114,84,104,97,110,69,113,117,97,108,0,1,0,0,12,120,0,0,1,0,0,12,121,0, 0,0,1,8,58,98,118,101,99,52,0,18,120,0,59,120,0,18,121,0,59,120,0,43, 0,18,120,0,59,121,0,18,121,0,59,121,0,43,0,18,120,0,59,122,0,18,121,0, 59,122,0,43,0,18,120,0,59,119,0,18,121,0,59,119,0,43,0,0,0,0,1,0, 2,0,103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,0,1,0,0,6,120, 0,0,1,0,0,6,121,0,0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120, 0,18,121,0,59,120,0,43,0,18,120,0,59,121,0,18,121,0,59,121,0,43,0,0, 0,0,1,0,3,0,103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,0,1, 0,0,7,120,0,0,1,0,0,7,121,0,0,0,1,8,58,98,118,101,99,51,0,18, 120,0,59,120,0,18,121,0,59,120,0,43,0,18,120,0,59,121,0,18,121,0,59,121, 0,43,0,18,120,0,59,122,0,18,121,0,59,122,0,43,0,0,0,0,1,0,4,0, 103,114,101,97,116,101,114,84,104,97,110,69,113,117,97,108,0,1,0,0,8,120,0,0, 1,0,0,8,121,0,0,0,1,8,58,98,118,101,99,52,0,18,120,0,59,120,0,18, 121,0,59,120,0,43,0,18,120,0,59,121,0,18,121,0,59,121,0,43,0,18,120,0, 59,122,0,18,121,0,59,122,0,43,0,18,120,0,59,119,0,18,121,0,59,119,0,43, 0,0,0,0,1,0,2,0,101,113,117,97,108,0,1,0,0,10,120,0,0,1,0,0, 10,121,0,0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18,121,0,59, 120,0,38,0,18,120,0,59,121,0,18,121,0,59,121,0,38,0,0,0,0,1,0,3, 0,101,113,117,97,108,0,1,0,0,11,120,0,0,1,0,0,11,121,0,0,0,1,8, 58,98,118,101,99,51,0,18,120,0,59,120,0,18,121,0,59,120,0,38,0,18,120,0, 59,121,0,18,121,0,59,121,0,38,0,18,120,0,59,122,0,18,121,0,59,122,0,38, 0,0,0,0,1,0,4,0,101,113,117,97,108,0,1,0,0,12,120,0,0,1,0,0, 12,121,0,0,0,1,8,58,98,118,101,99,52,0,18,120,0,59,120,0,18,121,0,59, 120,0,38,0,18,120,0,59,121,0,18,121,0,59,121,0,38,0,18,120,0,59,122,0, 18,121,0,59,122,0,38,0,18,120,0,59,119,0,18,121,0,59,119,0,38,0,0,0, 0,1,0,2,0,101,113,117,97,108,0,1,0,0,6,120,0,0,1,0,0,6,121,0, 0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18,121,0,59,120,0,38, 0,18,120,0,59,121,0,18,121,0,59,121,0,38,0,0,0,0,1,0,3,0,101,113, 117,97,108,0,1,0,0,7,120,0,0,1,0,0,7,121,0,0,0,1,8,58,98,118, 101,99,51,0,18,120,0,59,120,0,18,121,0,59,120,0,38,0,18,120,0,59,121,0, 18,121,0,59,121,0,38,0,18,120,0,59,122,0,18,121,0,59,122,0,38,0,0,0, 0,1,0,4,0,101,113,117,97,108,0,1,0,0,8,120,0,0,1,0,0,8,121,0, 0,0,1,8,58,98,118,101,99,52,0,18,120,0,59,120,0,18,121,0,59,120,0,38, 0,18,120,0,59,121,0,18,121,0,59,121,0,38,0,18,120,0,59,122,0,18,121,0, 59,122,0,38,0,18,120,0,59,119,0,18,121,0,59,119,0,38,0,0,0,0,1,0, 2,0,110,111,116,69,113,117,97,108,0,1,0,0,10,120,0,0,1,0,0,10,121,0, 0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18,121,0,59,120,0,39, 0,18,120,0,59,121,0,18,121,0,59,121,0,39,0,0,0,0,1,0,3,0,110,111, 116,69,113,117,97,108,0,1,0,0,11,120,0,0,1,0,0,11,121,0,0,0,1,8, 58,98,118,101,99,51,0,18,120,0,59,120,0,18,121,0,59,120,0,39,0,18,120,0, 59,121,0,18,121,0,59,121,0,39,0,18,120,0,59,122,0,18,121,0,59,122,0,39, 0,0,0,0,1,0,4,0,110,111,116,69,113,117,97,108,0,1,0,0,12,120,0,0, 1,0,0,12,121,0,0,0,1,8,58,98,118,101,99,52,0,18,120,0,59,120,0,18, 121,0,59,120,0,39,0,18,120,0,59,121,0,18,121,0,59,121,0,39,0,18,120,0, 59,122,0,18,121,0,59,122,0,39,0,18,120,0,59,119,0,18,121,0,59,119,0,39, 0,0,0,0,1,0,2,0,110,111,116,69,113,117,97,108,0,1,0,0,6,120,0,0, 1,0,0,6,121,0,0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,18, 121,0,59,120,0,39,0,18,120,0,59,121,0,18,121,0,59,121,0,39,0,0,0,0, 1,0,3,0,110,111,116,69,113,117,97,108,0,1,0,0,7,120,0,0,1,0,0,7, 121,0,0,0,1,8,58,98,118,101,99,51,0,18,120,0,59,120,0,18,121,0,59,120, 0,39,0,18,120,0,59,121,0,18,121,0,59,121,0,39,0,18,120,0,59,122,0,18, 121,0,59,122,0,39,0,0,0,0,1,0,4,0,110,111,116,69,113,117,97,108,0,1, 0,0,8,120,0,0,1,0,0,8,121,0,0,0,1,8,58,98,118,101,99,52,0,18, 120,0,59,120,0,18,121,0,59,120,0,39,0,18,120,0,59,121,0,18,121,0,59,121, 0,39,0,18,120,0,59,122,0,18,121,0,59,122,0,39,0,18,120,0,59,119,0,18, 121,0,59,119,0,39,0,0,0,0,1,0,1,0,97,110,121,0,1,0,0,2,120,0, 0,0,1,8,18,120,0,59,120,0,18,120,0,59,121,0,32,0,0,1,0,1,0,97, 110,121,0,1,0,0,3,120,0,0,0,1,8,18,120,0,59,120,0,18,120,0,59,121, 0,32,18,120,0,59,122,0,32,0,0,1,0,1,0,97,110,121,0,1,0,0,4,120, 0,0,0,1,8,18,120,0,59,120,0,18,120,0,59,121,0,32,18,120,0,59,122,0, 32,18,120,0,59,119,0,32,0,0,1,0,1,0,97,108,108,0,1,0,0,2,120,0, 0,0,1,8,18,120,0,59,120,0,18,120,0,59,121,0,34,0,0,1,0,1,0,97, 108,108,0,1,0,0,3,120,0,0,0,1,8,18,120,0,59,120,0,18,120,0,59,121, 0,34,18,120,0,59,122,0,34,0,0,1,0,1,0,97,108,108,0,1,0,0,4,120, 0,0,0,1,8,18,120,0,59,120,0,18,120,0,59,121,0,34,18,120,0,59,122,0, 34,18,120,0,59,119,0,34,0,0,1,0,2,0,110,111,116,0,1,0,0,2,120,0, 0,0,1,8,58,98,118,101,99,50,0,18,120,0,59,120,0,56,0,18,120,0,59,121, 0,56,0,0,0,0,1,0,3,0,110,111,116,0,1,0,0,3,120,0,0,0,1,8, 58,98,118,101,99,51,0,18,120,0,59,120,0,56,0,18,120,0,59,121,0,56,0,18, 120,0,59,122,0,56,0,0,0,0,1,0,4,0,110,111,116,0,1,0,0,4,120,0, 0,0,1,8,58,98,118,101,99,52,0,18,120,0,59,120,0,56,0,18,120,0,59,121, 0,56,0,18,120,0,59,122,0,56,0,18,120,0,59,119,0,56,0,0,0,0,1,0, 12,0,116,101,120,116,117,114,101,49,68,0,1,0,0,16,115,97,109,112,108,101,114,0, 0,1,0,0,9,99,111,111,114,100,0,0,0,1,8,58,118,101,99,52,0,17,48,0, 48,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,80,114,111,106, 0,1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,10,99,111,111,114,100,0, 0,0,1,8,58,116,101,120,116,117,114,101,49,68,0,18,115,97,109,112,108,101,114,0, 0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,116,0,49,0,0, 0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,0,0,16, 115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58, 116,101,120,116,117,114,101,49,68,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111, 114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,0,1,0,12, 0,116,101,120,116,117,114,101,50,68,0,1,0,0,17,115,97,109,112,108,101,114,0,0, 1,0,0,10,99,111,111,114,100,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48, 0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114,111,106,0, 1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0, 0,1,8,58,116,101,120,116,117,114,101,50,68,0,18,115,97,109,112,108,101,114,0,0, 58,118,101,99,50,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59, 112,0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,112,0, 49,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114,111,106, 0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0, 0,0,1,8,58,116,101,120,116,117,114,101,50,68,0,18,115,97,109,112,108,101,114,0, 0,58,118,101,99,50,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0, 59,113,0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,113, 0,49,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,0,1,0, 0,18,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1, 8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,116,101,120, 116,117,114,101,51,68,80,114,111,106,0,1,0,0,18,115,97,109,112,108,101,114,0,0, 1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,116,101,120,116,117,114,101,51,68, 0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114,100,0, 59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,116, 0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,112,0,18, 99,111,111,114,100,0,59,113,0,49,0,0,0,0,0,0,1,0,12,0,116,101,120,116, 117,114,101,67,117,98,101,0,1,0,0,19,115,97,109,112,108,101,114,0,0,1,0,0, 11,99,111,111,114,100,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0,0, 0,0,0,1,0,12,0,115,104,97,100,111,119,49,68,0,1,0,0,20,115,97,109,112, 108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,0,1,8,58,118,101,99,52, 0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,115,104,97,100,111,119,50,68,0, 1,0,0,21,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0, 0,1,8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,115, 104,97,100,111,119,49,68,80,114,111,106,0,1,0,0,20,115,97,109,112,108,101,114,0, 0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,115,104,97,100,111,119,49,68, 0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114,100,0, 59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,17,48,0,48,0,0,0,18,99, 111,111,114,100,0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,0,0, 0,1,0,12,0,115,104,97,100,111,119,50,68,80,114,111,106,0,1,0,0,21,115,97, 109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,0,1,8,58,115,104, 97,100,111,119,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18, 99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111, 111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114, 100,0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,0,0,0,1,0, 9,0,110,111,105,115,101,49,0,1,0,0,9,120,0,0,0,1,8,17,48,0,48,0, 0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,10,120,0,0,0,1,8, 17,48,0,48,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,11,120, 0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0, 1,0,0,12,120,0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,10,0,110,111, 105,115,101,50,0,1,0,0,9,120,0,0,0,1,8,58,118,101,99,50,0,17,48,0, 48,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,10,120,0, 0,0,1,8,58,118,101,99,50,0,17,48,0,48,0,0,0,0,0,0,1,0,10,0, 110,111,105,115,101,50,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,50,0,17, 48,0,48,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,12, 120,0,0,0,1,8,58,118,101,99,50,0,17,48,0,48,0,0,0,0,0,0,1,0, 11,0,110,111,105,115,101,51,0,1,0,0,9,120,0,0,0,1,8,58,118,101,99,51, 0,17,48,0,48,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0, 0,10,120,0,0,0,1,8,58,118,101,99,51,0,17,48,0,48,0,0,0,0,0,0, 1,0,11,0,110,111,105,115,101,51,0,1,0,0,11,120,0,0,0,1,8,58,118,101, 99,51,0,17,48,0,48,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0, 1,0,0,12,120,0,0,0,1,8,58,118,101,99,51,0,17,48,0,48,0,0,0,0, 0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,9,120,0,0,0,1,8,58, 118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,110,111,105,115,101, 52,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0, 0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,11,120,0,0,0,1, 8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,110,111,105, 115,101,52,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48, 0,0,0,0,0,0,0nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_common_builtin_gc.h0000644000000000000000000007473513614532424026277 0ustar "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "const int gl_MaxLights = 8;\n" "const int gl_MaxClipPlanes = 6;\n" "const int gl_MaxTextureUnits = 2;\n" "const int gl_MaxTextureCoords = 2;\n" "const int gl_MaxVertexAttribs = 16;\n" "const int gl_MaxVertexUniformComponents = 512;\n" "const int gl_MaxVaryingFloats = 32;\n" "const int gl_MaxVertexTextureImageUnits = 0;\n" "const int gl_MaxCombinedTextureImageUnits = 2;\n" "const int gl_MaxTextureImageUnits = 2;\n" "const int gl_MaxFragmentUniformComponents = 64;\n" "const int gl_MaxDrawBuffers = 1;\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "uniform mat4 gl_ModelViewMatrix;\n" "uniform mat4 gl_ProjectionMatrix;\n" "uniform mat4 gl_ModelViewProjectionMatrix;\n" "uniform mat4 gl_TextureMatrix[gl_MaxTextureCoords];\n" "\n" "\n" "\n" "\n" "\n" "\n" "uniform mat3 gl_NormalMatrix;\n" "\n" "\n" "uniform mat4 gl_ModelViewMatrixInverse;\n" "uniform mat4 gl_ProjectionMatrixInverse;\n" "uniform mat4 gl_ModelViewProjectionMatrixInverse;\n" "uniform mat4 gl_TextureMatrixInverse[gl_MaxTextureCoords];\n" "\n" "uniform mat4 gl_ModelViewMatrixTranspose;\n" "uniform mat4 gl_ProjectionMatrixTranspose;\n" "uniform mat4 gl_ModelViewProjectionMatrixTranspose;\n" "uniform mat4 gl_TextureMatrixTranspose[gl_MaxTextureCoords];\n" "\n" "uniform mat4 gl_ModelViewMatrixInverseTranspose;\n" "uniform mat4 gl_ProjectionMatrixInverseTranspose;\n" "uniform mat4 gl_ModelViewProjectionMatrixInverseTranspose;\n" "uniform mat4 gl_TextureMatrixInverseTranspose[gl_MaxTextureCoords];\n" "\n" "\n" "\n" "\n" "\n" "uniform float gl_NormalScale;\n" "\n" "\n" "\n" "\n" "\n" "struct gl_DepthRangeParameters {\n" " float near;\n" " float far;\n" " float diff;\n" "};\n" "\n" "uniform gl_DepthRangeParameters gl_DepthRange;\n" "\n" "\n" "\n" "\n" "\n" "uniform vec4 gl_ClipPlane[gl_MaxClipPlanes];\n" "\n" "\n" "\n" "\n" "\n" "struct gl_PointParameters {\n" " float size;\n" " float sizeMin;\n" " float sizeMax;\n" " float fadeThresholdSize;\n" " float distanceConstantAttenuation;\n" " float distanceLinearAttenuation;\n" " float distanceQuadraticAttenuation;\n" "};\n" "\n" "uniform gl_PointParameters gl_Point;\n" "\n" "\n" "\n" "\n" "\n" "struct gl_MaterialParameters {\n" " vec4 emission;\n" " vec4 ambient;\n" " vec4 diffuse;\n" " vec4 specular;\n" " float shininess;\n" "};\n" "\n" "uniform gl_MaterialParameters gl_FrontMaterial;\n" "uniform gl_MaterialParameters gl_BackMaterial;\n" "\n" "\n" "\n" "\n" "\n" "struct gl_LightSourceParameters {\n" " vec4 ambient;\n" " vec4 diffuse;\n" " vec4 specular;\n" " vec4 position;\n" " vec4 halfVector;\n" " vec3 spotDirection;\n" " float spotExponent;\n" " float spotCutoff;\n" "\n" " float spotCosCutoff;\n" "\n" " float constantAttenuation;\n" " float linearAttenuation;\n" " float quadraticAttenuation;\n" "};\n" "\n" "uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights];\n" "\n" "struct gl_LightModelParameters {\n" " vec4 ambient;\n" "};\n" "\n" "uniform gl_LightModelParameters gl_LightModel;\n" "\n" "\n" "\n" "\n" "\n" "struct gl_LightModelProducts {\n" " vec4 sceneColor;\n" "};\n" "\n" "uniform gl_LightModelProducts gl_FrontLightModelProduct;\n" "uniform gl_LightModelProducts gl_BackLightModelProduct;\n" "\n" "struct gl_LightProducts {\n" " vec4 ambient;\n" " vec4 diffuse;\n" " vec4 specular;\n" "};\n" "\n" "uniform gl_LightProducts gl_FrontLightProduct[gl_MaxLights];\n" "uniform gl_LightProducts gl_BackLightProduct[gl_MaxLights];\n" "\n" "\n" "\n" "\n" "\n" "uniform vec4 gl_TextureEnvColor[gl_MaxTextureImageUnits];\n" "uniform vec4 gl_EyePlaneS[gl_MaxTextureCoords];\n" "uniform vec4 gl_EyePlaneT[gl_MaxTextureCoords];\n" "uniform vec4 gl_EyePlaneR[gl_MaxTextureCoords];\n" "uniform vec4 gl_EyePlaneQ[gl_MaxTextureCoords];\n" "uniform vec4 gl_ObjectPlaneS[gl_MaxTextureCoords];\n" "uniform vec4 gl_ObjectPlaneT[gl_MaxTextureCoords];\n" "uniform vec4 gl_ObjectPlaneR[gl_MaxTextureCoords];\n" "uniform vec4 gl_ObjectPlaneQ[gl_MaxTextureCoords];\n" "\n" "\n" "\n" "\n" "\n" "struct gl_FogParameters {\n" " vec4 color;\n" " float density;\n" " float start;\n" " float end;\n" " float scale;\n" "};\n" "\n" "uniform gl_FogParameters gl_Fog;\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float radians (float deg) {\n" " return 3.141593 * deg / 180.0;\n" "}\n" "vec2 radians (vec2 deg) {\n" " return vec2 (radians (deg.x), radians (deg.y));\n" "}\n" "vec3 radians (vec3 deg) {\n" " return vec3 (radians (deg.x), radians (deg.y), radians (deg.z));\n" "}\n" "vec4 radians (vec4 deg) {\n" " return vec4 (radians (deg.x), radians (deg.y), radians (deg.z), radians (deg.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float degrees (float rad) {\n" " return 180.0 * rad / 3.141593;\n" "}\n" "vec2 degrees (vec2 rad) {\n" " return vec2 (degrees (rad.x), degrees (rad.y));\n" "}\n" "vec3 degrees (vec3 rad) {\n" " return vec3 (degrees (rad.x), degrees (rad.y), degrees (rad.z));\n" "}\n" "vec4 degrees (vec4 rad) {\n" " return vec4 (degrees (rad.x), degrees (rad.y), degrees (rad.z), degrees (rad.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float sin (float angle) {\n" " return 0.0;\n" "}\n" "vec2 sin (vec2 angle) {\n" " return vec2 (sin (angle.x), sin (angle.y));\n" "}\n" "vec3 sin (vec3 angle) {\n" " return vec3 (sin (angle.x), sin (angle.y), sin (angle.z));\n" "}\n" "vec4 sin (vec4 angle) {\n" " return vec4 (sin (angle.x), sin (angle.y), sin (angle.z), sin (angle.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float cos (float angle) {\n" " return sin (angle + 1.5708);\n" "}\n" "vec2 cos (vec2 angle) {\n" " return vec2 (cos (angle.x), cos (angle.y));\n" "}\n" "vec3 cos (vec3 angle) {\n" " return vec3 (cos (angle.x), cos (angle.y), cos (angle.z));\n" "}\n" "vec4 cos (vec4 angle) {\n" " return vec4 (cos (angle.x), cos (angle.y), cos (angle.z), cos (angle.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float tan (float angle) {\n" " return sin (angle) / cos (angle);\n" "}\n" "vec2 tan (vec2 angle) {\n" " return vec2 (tan (angle.x), tan (angle.y));\n" "}\n" "vec3 tan (vec3 angle) {\n" " return vec3 (tan (angle.x), tan (angle.y), tan (angle.z));\n" "}\n" "vec4 tan (vec4 angle) {\n" " return vec4 (tan (angle.x), tan (angle.y), tan (angle.z), tan (angle.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "float asin (float x) {\n" " return 0.0;\n" "}\n" "vec2 asin (vec2 x) {\n" " return vec2 (asin (x.x), asin (x.y));\n" "}\n" "vec3 asin (vec3 x) {\n" " return vec3 (asin (x.x), asin (x.y), asin (x.z));\n" "}\n" "vec4 asin (vec4 x) {\n" " return vec4 (asin (x.x), asin (x.y), asin (x.z), asin (x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "float acos (float x) {\n" " return 0.0;\n" "}\n" "vec2 acos (vec2 x) {\n" " return vec2 (acos (x.x), acos (x.y));\n" "}\n" "vec3 acos (vec3 x) {\n" " return vec3 (acos (x.x), acos (x.y), acos (x.z));\n" "}\n" "vec4 acos (vec4 x) {\n" " return vec4 (acos (x.x), acos (x.y), acos (x.z), acos (x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float atan (float x, float y) {\n" " return 0.0;\n" "}\n" "vec2 atan (vec2 x, vec2 y) {\n" " return vec2 (atan (x.x, y.x), atan (x.y, y.y));\n" "}\n" "vec3 atan (vec3 x, vec3 y) {\n" " return vec3 (atan (x.x, y.x), atan (x.y, y.y), atan (x.z, y.z));\n" "}\n" "vec4 atan (vec4 x, vec4 y) {\n" " return vec4 (atan (x.x, y.x), atan (x.y, y.y), atan (x.z, y.z), atan (x.w, y.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "float atan (float y_over_x) {\n" " return 0.0;\n" "}\n" "vec2 atan (vec2 y_over_x) {\n" " return vec2 (atan (y_over_x.x), atan (y_over_x.y));\n" "}\n" "vec3 atan (vec3 y_over_x) {\n" " return vec3 (atan (y_over_x.x), atan (y_over_x.y), atan (y_over_x.z));\n" "}\n" "vec4 atan (vec4 y_over_x) {\n" " return vec4 (atan (y_over_x.x), atan (y_over_x.y), atan (y_over_x.z), atan (y_over_x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float pow (float x, float y) {\n" " return 0.0;\n" "}\n" "vec2 pow (vec2 x, vec2 y) {\n" " return vec2 (pow (x.x, y.x), pow (x.y, y.y));\n" "}\n" "vec3 pow (vec3 x, vec3 y) {\n" " return vec3 (pow (x.x, y.x), pow (x.y, y.y), pow (x.z, y.z));\n" "}\n" "vec4 pow (vec4 x, vec4 y) {\n" " return vec4 (pow (x.x, y.x), pow (x.y, y.y), pow (x.z, y.z), pow (x.w, y.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float exp (float x) {\n" " return pow (2.71828183, x);\n" "}\n" "vec2 exp (vec2 x) {\n" " return vec2 (exp (x.x), exp (x.y));\n" "}\n" "vec3 exp (vec3 x) {\n" " return vec3 (exp (x.x), exp (x.y), exp (x.z));\n" "}\n" "vec4 exp (vec4 x) {\n" " return vec4 (exp (x.x), exp (x.y), exp (x.z), exp (x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float log (float x) {\n" " return log2 (x) / log2 (2.71828183);\n" "}\n" "vec2 log (vec2 x) {\n" " return vec2 (log (x.x), log (x.y));\n" "}\n" "vec3 log (vec3 x) {\n" " return vec3 (log (x.x), log (x.y), log (x.z));\n" "}\n" "vec4 log (vec4 x) {\n" " return vec4 (log (x.x), log (x.y), log (x.z), log (x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float exp2 (float x) {\n" " return pow (2.0, x);\n" "}\n" "vec2 exp2 (vec2 x) {\n" " return vec2 (exp2 (x.x), exp2 (x.y));\n" "}\n" "vec3 exp2 (vec3 x) {\n" " return vec3 (exp2 (x.x), exp2 (x.y), exp2 (x.z));\n" "}\n" "vec4 exp2 (vec4 x) {\n" " return vec4 (exp2 (x.x), exp2 (x.y), exp2 (x.z), exp2 (x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float log2 (float x) {\n" " return 0.0;\n" "}\n" "vec2 log2 (vec2 x) {\n" " return vec2 (log2 (x.x), log2 (x.y));\n" "}\n" "vec3 log2 (vec3 x) {\n" " return vec3 (log2 (x.x), log2 (x.y), log2 (x.z));\n" "}\n" "vec4 log2 (vec4 x) {\n" " return vec4 (log2 (x.x), log2 (x.y), log2 (x.z), log2 (x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "float sqrt (float x) {\n" " return pow (x, 0.5);\n" "}\n" "vec2 sqrt (vec2 x) {\n" " return vec2 (sqrt (x.x), sqrt (x.y));\n" "}\n" "vec3 sqrt (vec3 x) {\n" " return vec3 (sqrt (x.x), sqrt (x.y), sqrt (x.z));\n" "}\n" "vec4 sqrt (vec4 x) {\n" " return vec4 (sqrt (x.x), sqrt (x.y), sqrt (x.z), sqrt (x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "float inversesqrt (float x) {\n" " return 1.0 / sqrt (x);\n" "}\n" "vec2 inversesqrt (vec2 x) {\n" " return vec2 (inversesqrt (x.x), inversesqrt (x.y));\n" "}\n" "vec3 inversesqrt (vec3 x) {\n" " return vec3 (inversesqrt (x.x), inversesqrt (x.y), inversesqrt (x.z));\n" "}\n" "vec4 inversesqrt (vec4 x) {\n" " return vec4 (inversesqrt (x.x), inversesqrt (x.y), inversesqrt (x.z), inversesqrt (x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float abs (float x) {\n" " return x >= 0.0 ? x : -x;\n" "}\n" "vec2 abs (vec2 x) {\n" " return vec2 (abs (x.x), abs (x.y));\n" "}\n" "vec3 abs (vec3 x) {\n" " return vec3 (abs (x.x), abs (x.y), abs (x.z));\n" "}\n" "vec4 abs (vec4 x) {\n" " return vec4 (abs (x.x), abs (x.y), abs (x.z), abs (x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float sign (float x) {\n" " return x > 0.0 ? 1.0 : x < 0.0 ? -1.0 : 0.0;\n" "}\n" "vec2 sign (vec2 x) {\n" " return vec2 (sign (x.x), sign (x.y));\n" "}\n" "vec3 sign (vec3 x) {\n" " return vec3 (sign (x.x), sign (x.y), sign (x.z));\n" "}\n" "vec4 sign (vec4 x) {\n" " return vec4 (sign (x.x), sign (x.y), sign (x.z), sign (x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float floor (float x) {\n" " return 0.0;\n" "}\n" "vec2 floor (vec2 x) {\n" " return vec2 (floor (x.x), floor (x.y));\n" "}\n" "vec3 floor (vec3 x) {\n" " return vec3 (floor (x.x), floor (x.y), floor (x.z));\n" "}\n" "vec4 floor (vec4 x) {\n" " return vec4 (floor (x.x), floor (x.y), floor (x.z), floor (x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float ceil (float x) {\n" " return 0.0;\n" "}\n" "vec2 ceil (vec2 x) {\n" " return vec2 (ceil (x.x), ceil (x.y));\n" "}\n" "vec3 ceil (vec3 x) {\n" " return vec3 (ceil (x.x), ceil (x.y), ceil (x.z));\n" "}\n" "vec4 ceil (vec4 x) {\n" " return vec4 (ceil (x.x), ceil (x.y), ceil (x.z), ceil (x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float fract (float x) {\n" " return x - floor (x);\n" "}\n" "vec2 fract (vec2 x) {\n" " return vec2 (fract (x.x), fract (x.y));\n" "}\n" "vec3 fract (vec3 x) {\n" " return vec3 (fract (x.x), fract (x.y), fract (x.z));\n" "}\n" "vec4 fract (vec4 x) {\n" " return vec4 (fract (x.x), fract (x.y), fract (x.z), fract (x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float mod (float x, float y) {\n" " return x - y * floor (x / y);\n" "}\n" "vec2 mod (vec2 x, float y) {\n" " return vec2 (mod (x.x, y), mod (x.y, y));\n" "}\n" "vec3 mod (vec3 x, float y) {\n" " return vec3 (mod (x.x, y), mod (x.y, y), mod (x.z, y));\n" "}\n" "vec4 mod (vec4 x, float y) {\n" " return vec4 (mod (x.x, y), mod (x.y, y), mod (x.z, y), mod (x.w, y));\n" "}\n" "vec2 mod (vec2 x, vec2 y) {\n" " return vec2 (mod (x.x, y.x), mod (x.y, y.y));\n" "}\n" "vec3 mod (vec3 x, vec3 y) {\n" " return vec3 (mod (x.x, y.x), mod (x.y, y.y), mod (x.z, y.z));\n" "}\n" "vec4 mod (vec4 x, vec4 y) {\n" " return vec4 (mod (x.x, y.x), mod (x.y, y.y), mod (x.z, y.z), mod (x.w, y.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float min (float x, float y) {\n" " return y < x ? y : x;\n" "}\n" "vec2 min (vec2 x, float y) {\n" " return vec2 (min (x.x, y), min (x.y, y));\n" "}\n" "vec3 min (vec3 x, float y) {\n" " return vec3 (min (x.x, y), min (x.y, y), min (x.z, y));\n" "}\n" "vec4 min (vec4 x, float y) {\n" " return vec4 (min (x.x, y), min (x.y, y), min (x.z, y), min (x.w, y));\n" "}\n" "vec2 min (vec2 x, vec2 y) {\n" " return vec2 (min (x.x, y.x), min (x.y, y.y));\n" "}\n" "vec3 min (vec3 x, vec3 y) {\n" " return vec3 (min (x.x, y.x), min (x.y, y.y), min (x.z, y.z));\n" "}\n" "vec4 min (vec4 x, vec4 y) {\n" " return vec4 (min (x.x, y.x), min (x.y, y.y), min (x.z, y.z), min (x.w, y.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float max (float x, float y) {\n" " return min (y, x);\n" "}\n" "vec2 max (vec2 x, float y) {\n" " return vec2 (max (x.x, y), max (x.y, y));\n" "}\n" "vec3 max (vec3 x, float y) {\n" " return vec3 (max (x.x, y), max (x.y, y), max (x.z, y));\n" "}\n" "vec4 max (vec4 x, float y) {\n" " return vec4 (max (x.x, y), max (x.y, y), max (x.z, y), max (x.w, y));\n" "}\n" "vec2 max (vec2 x, vec2 y) {\n" " return vec2 (max (x.x, y.x), max (x.y, y.y));\n" "}\n" "vec3 max (vec3 x, vec3 y) {\n" " return vec3 (max (x.x, y.x), max (x.y, y.y), max (x.z, y.z));\n" "}\n" "vec4 max (vec4 x, vec4 y) {\n" " return vec4 (max (x.x, y.x), max (x.y, y.y), max (x.z, y.z), max (x.w, y.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float clamp (float x, float minVal, float maxVal) {\n" " return min (max (x, minVal), maxVal);\n" "}\n" "vec2 clamp (vec2 x, float minVal, float maxVal) {\n" " return vec2 (clamp (x.x, minVal, maxVal), clamp (x.y, minVal, maxVal));\n" "}\n" "vec3 clamp (vec3 x, float minVal, float maxVal) {\n" " return vec3 (clamp (x.x, minVal, maxVal), clamp (x.y, minVal, maxVal),\n" " clamp (x.z, minVal, maxVal));\n" "}\n" "vec4 clamp (vec4 x, float minVal, float maxVal) {\n" " return vec4 (clamp (x.x, minVal, maxVal), clamp (x.y, minVal, maxVal),\n" " clamp (x.z, minVal, maxVal), clamp (x.w, minVal, maxVal));\n" "}\n" "vec2 clamp (vec2 x, vec2 minVal, vec2 maxVal) {\n" " return vec2 (clamp (x.x, minVal.x, maxVal.x), clamp (x.y, minVal.y, maxVal.y));\n" "}\n" "vec3 clamp (vec3 x, vec3 minVal, vec3 maxVal) {\n" " return vec3 (clamp (x.x, minVal.x, maxVal.x), clamp (x.y, minVal.y, maxVal.y),\n" " clamp (x.z, minVal.z, maxVal.z));\n" "}\n" "vec4 clamp (vec4 x, vec4 minVal, vec4 maxVal) {\n" " return vec4 (clamp (x.x, minVal.x, maxVal.y), clamp (x.y, minVal.y, maxVal.y),\n" " clamp (x.z, minVal.z, maxVal.z), clamp (x.w, minVal.w, maxVal.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float mix (float x, float y, float a) {\n" " return x * (1.0 - a) + y * a;\n" "}\n" "vec2 mix (vec2 x, vec2 y, float a) {\n" " return vec2 (mix (x.x, y.x, a), mix (x.y, y.y, a));\n" "}\n" "vec3 mix (vec3 x, vec3 y, float a) {\n" " return vec3 (mix (x.x, y.x, a), mix (x.y, y.y, a), mix (x.z, y.z, a));\n" "}\n" "vec4 mix (vec4 x, vec4 y, float a) {\n" " return vec4 (mix (x.x, y.x, a), mix (x.y, y.y, a), mix (x.z, y.z, a), mix (x.w, y.w, a));\n" "}\n" "vec2 mix (vec2 x, vec2 y, vec2 a) {\n" " return vec2 (mix (x.x, y.x, a.x), mix (x.y, y.y, a.y));\n" "}\n" "vec3 mix (vec3 x, vec3 y, vec3 a) {\n" " return vec3 (mix (x.x, y.x, a.x), mix (x.y, y.y, a.y), mix (x.z, y.z, a.z));\n" "}\n" "vec4 mix (vec4 x, vec4 y, vec4 a) {\n" " return vec4 (mix (x.x, y.x, a.x), mix (x.y, y.y, a.y), mix (x.z, y.z, a.z),\n" " mix (x.w, y.w, a.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float step (float edge, float x) {\n" " return x < edge ? 0.0 : 1.0;\n" "}\n" "vec2 step (float edge, vec2 x) {\n" " return vec2 (step (edge, x.x), step (edge, x.y));\n" "}\n" "vec3 step (float edge, vec3 x) {\n" " return vec3 (step (edge, x.x), step (edge, x.y), step (edge, x.z));\n" "}\n" "vec4 step (float edge, vec4 x) {\n" " return vec4 (step (edge, x.x), step (edge, x.y), step (edge, x.z), step (edge, x.w));\n" "}\n" "vec2 step (vec2 edge, vec2 x) {\n" " return vec2 (step (edge.x, x.x), step (edge.y, x.y));\n" "}\n" "vec3 step (vec3 edge, vec3 x) {\n" " return vec3 (step (edge.x, x.x), step (edge.y, x.y), step (edge.z, x.z));\n" "}\n" "vec4 step (vec4 edge, vec4 x) {\n" " return vec4 (step (edge.x, x.x), step (edge.y, x.y), step (edge.z, x.z), step (edge.w, x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float smoothstep (float edge0, float edge1, float x) {\n" " const float t = clamp ((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n" " return t * t * (3.0 - 2.0 * t);\n" "}\n" "vec2 smoothstep (float edge0, float edge1, vec2 x) {\n" " return vec2 (smoothstep (edge0, edge1, x.x), smoothstep (edge0, edge1, x.y));\n" "}\n" "vec3 smoothstep (float edge0, float edge1, vec3 x) {\n" " return vec3 (smoothstep (edge0, edge1, x.x), smoothstep (edge0, edge1, x.y),\n" " smoothstep (edge0, edge1, x.z));\n" "}\n" "vec4 smoothstep (float edge0, float edge1, vec4 x) {\n" " return vec4 (smoothstep (edge0, edge1, x.x), smoothstep (edge0, edge1, x.y),\n" " smoothstep (edge0, edge1, x.z), smoothstep (edge0, edge1, x.w));\n" "}\n" "vec2 smoothstep (vec2 edge0, vec2 edge1, vec2 x) {\n" " return vec2 (smoothstep (edge0.x, edge1.x, x.x), smoothstep (edge0.y, edge1.y, x.y));\n" "}\n" "vec3 smoothstep (vec3 edge0, vec3 edge1, vec3 x) {\n" " return vec3 (smoothstep (edge0.x, edge1.x, x.x), smoothstep (edge0.y, edge1.y, x.y),\n" " smoothstep (edge0.z, edge1.z, x.z));\n" "}\n" "vec4 smoothstep (vec4 edge0, vec4 edge1, vec4 x) {\n" " return vec4 (smoothstep (edge0.x, edge1.x, x.x), smoothstep (edge0.y, edge1.y, x.y),\n" " smoothstep (edge0.z, edge1.z, x.z), smoothstep (edge0.w, edge1.w, x.w));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float dot (float x, float y) {\n" " return x * y;\n" "}\n" "float dot (vec2 x, vec2 y) {\n" " return dot (x.x, y.x) + dot (x.y, y.y);\n" "}\n" "float dot (vec3 x, vec3 y) {\n" " return dot (x.x, y.x) + dot (x.y, y.y) + dot (x.z, y.z);\n" "}\n" "float dot (vec4 x, vec4 y) {\n" " return dot (x.x, y.x) + dot (x.y, y.y) + dot (x.z, y.z) + dot (x.w, y.w);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float length (float x) {\n" " return sqrt (dot (x, x));\n" "}\n" "float length (vec2 x) {\n" " return sqrt (dot (x, x));\n" "}\n" "float length (vec3 x) {\n" " return sqrt (dot (x, x));\n" "}\n" "float length (vec4 x) {\n" " return sqrt (dot (x, x));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float distance (float x, float y) {\n" " return length (x - y);\n" "}\n" "float distance (vec2 x, vec2 y) {\n" " return length (x - y);\n" "}\n" "float distance (vec3 x, vec3 y) {\n" " return length (x - y);\n" "}\n" "float distance (vec4 x, vec4 y) {\n" " return length (x - y);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec3 cross (vec3 x, vec3 y) {\n" " return vec3 (x.y * y.z - y.y * x.z, x.z * y.x - y.z * x.x, x.x * y.y - y.x * x.y);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float normalize (float x) {\n" " return 1.0;\n" "}\n" "vec2 normalize (vec2 x) {\n" " return x / length (x);\n" "}\n" "vec3 normalize (vec3 x) {\n" " return x / length (x);\n" "}\n" "vec4 normalize (vec4 x) {\n" " return x / length (x);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "float faceforward (float N, float I, float Nref) {\n" " return dot (Nref, I) < 0.0 ? N : -N;\n" "}\n" "vec2 faceforward (vec2 N, vec2 I, vec2 Nref) {\n" " return dot (Nref, I) < 0.0 ? N : -N;\n" "}\n" "vec3 faceforward (vec3 N, vec3 I, vec3 Nref) {\n" " return dot (Nref, I) < 0.0 ? N : -N;\n" "}\n" "vec4 faceforward (vec4 N, vec4 I, vec4 Nref) {\n" " return dot (Nref, I) < 0.0 ? N : -N;\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float reflect (float I, float N) {\n" " return I - 2.0 * dot (N, I) * N;\n" "}\n" "vec2 reflect (vec2 I, vec2 N) {\n" " return I - 2.0 * dot (N, I) * N;\n" "}\n" "vec3 reflect (vec3 I, vec3 N) {\n" " return I - 2.0 * dot (N, I) * N;\n" "}\n" "vec4 reflect (vec4 I, vec4 N) {\n" " return I - 2.0 * dot (N, I) * N;\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float refract (float I, float N, float eta) {\n" " const float k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));\n" " if (k < 0.0)\n" " return 0.0;\n" " return eta * I - (eta * dot (N, I) + sqrt (k)) * N;\n" "}\n" "vec2 refract (vec2 I, vec2 N, float eta) {\n" " const float k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));\n" " if (k < 0.0)\n" " return vec2 (0.0);\n" " return eta * I - (eta * dot (N, I) + sqrt (k)) * N;\n" "}\n" "vec3 refract (vec3 I, vec3 N, float eta) {\n" " const float k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));\n" " if (k < 0.0)\n" " return vec3 (0.0);\n" " return eta * I - (eta * dot (N, I) + sqrt (k)) * N;\n" "}\n" "vec4 refract (vec4 I, vec4 N, float eta) {\n" " const float k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));\n" " if (k < 0.0)\n" " return vec4 (0.0);\n" " return eta * I - (eta * dot (N, I) + sqrt (k)) * N;\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "mat2 matrixCompMult (mat2 x, mat2 y) {\n" " return mat2 (\n" " x[0].x * y[0].x, x[0].y * y[0].y,\n" " x[1].x * y[1].x, x[1].y * y[1].y\n" " );\n" "}\n" "mat3 matrixCompMult (mat3 x, mat3 y) {\n" " return mat4 (\n" " x[0].x * y[0].x, x[0].y * y[0].y, x[0].z * y[0].z,\n" " x[1].x * y[1].x, x[1].y * y[1].y, x[1].z * y[1].z,\n" " x[2].x * y[2].x, x[2].y * y[2].y, x[2].z * y[2].z\n" " );\n" "}\n" "mat4 matrixCompMult (mat4 x, mat4 y) {\n" " return mat4 (\n" " x[0].x * y[0].x, x[0].y * y[0].y, x[0].z * y[0].z + x[0].w * y[0].w,\n" " x[1].x * y[1].x, x[1].y * y[1].y, x[1].z * y[1].z + x[1].w * y[1].w,\n" " x[2].x * y[2].x, x[2].y * y[2].y, x[2].z * y[2].z + x[2].w * y[2].w,\n" " x[3].x * y[3].x, x[3].y * y[3].y, x[3].z * y[3].z + x[3].w * y[3].w\n" " );\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "bvec2 lessThan (vec2 x, vec2 y) {\n" " return bvec2 (x.x < y.x, x.y < y.y);\n" "}\n" "bvec3 lessThan (vec3 x, vec3 y) {\n" " return bvec3 (x.x < y.x, x.y < y.y, x.z < y.z);\n" "}\n" "bvec4 lessThan (vec4 x, vec4 y) {\n" " return bvec4 (x.x < y.x, x.y < y.y, x.z < y.z, x.w < y.w);\n" "}\n" "bvec2 lessThan (ivec2 x, ivec2 y) {\n" " return bvec2 (x.x < y.x, x.y < y.y);\n" "}\n" "bvec3 lessThan (ivec3 x, ivec3 y) {\n" " return bvec3 (x.x < y.x, x.y < y.y, x.z < y.z);\n" "}\n" "bvec4 lessThan (ivec4 x, ivec4 y) {\n" " return bvec4 (x.x < y.x, x.y < y.y, x.z < y.z, x.w < y.w);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "bvec2 lessThanEqual (vec2 x, vec2 y) {\n" " return bvec2 (x.x <= y.x, x.y <= y.y);\n" "}\n" "bvec3 lessThanEqual (vec3 x, vec3 y) {\n" " return bvec3 (x.x <= y.x, x.y <= y.y, x.z <= y.z);\n" "}\n" "bvec4 lessThanEqual (vec4 x, vec4 y) {\n" " return bvec4 (x.x <= y.x, x.y <= y.y, x.z <= y.z, x.w <= y.w);\n" "}\n" "bvec2 lessThanEqual (ivec2 x, ivec2 y) {\n" " return bvec2 (x.x <= y.x, x.y <= y.y);\n" "}\n" "bvec3 lessThanEqual (ivec3 x, ivec3 y) {\n" " return bvec3 (x.x <= y.x, x.y <= y.y, x.z <= y.z);\n" "}\n" "bvec4 lessThanEqual (ivec4 x, ivec4 y) {\n" " return bvec4 (x.x <= y.x, x.y <= y.y, x.z <= y.z, x.w <= y.w);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "bvec2 greaterThan (vec2 x, vec2 y) {\n" " return bvec2 (x.x > y.x, x.y > y.y);\n" "}\n" "bvec3 greaterThan (vec3 x, vec3 y) {\n" " return bvec3 (x.x > y.x, x.y > y.y, x.z > y.z);\n" "}\n" "bvec4 greaterThan (vec4 x, vec4 y) {\n" " return bvec4 (x.x > y.x, x.y > y.y, x.z > y.z, x.w > y.w);\n" "}\n" "bvec2 greaterThan (ivec2 x, ivec2 y) {\n" " return bvec2 (x.x > y.x, x.y > y.y);\n" "}\n" "bvec3 greaterThan (ivec3 x, ivec3 y) {\n" " return bvec3 (x.x > y.x, x.y > y.y, x.z > y.z);\n" "}\n" "bvec4 greaterThan (ivec4 x, ivec4 y) {\n" " return bvec4 (x.x > y.x, x.y > y.y, x.z > y.z, x.w > y.w);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "bvec2 greaterThanEqual (vec2 x, vec2 y) {\n" " return bvec2 (x.x >= y.x, x.y >= y.y);\n" "}\n" "bvec3 greaterThanEqual (vec3 x, vec3 y) {\n" " return bvec3 (x.x >= y.x, x.y >= y.y, x.z >= y.z);\n" "}\n" "bvec4 greaterThanEqual (vec4 x, vec4 y) {\n" " return bvec4 (x.x >= y.x, x.y >= y.y, x.z >= y.z, x.w >= y.w);\n" "}\n" "bvec2 greaterThanEqual (ivec2 x, ivec2 y) {\n" " return bvec2 (x.x >= y.x, x.y >= y.y);\n" "}\n" "bvec3 greaterThanEqual (ivec3 x, ivec3 y) {\n" " return bvec3 (x.x >= y.x, x.y >= y.y, x.z >= y.z);\n" "}\n" "bvec4 greaterThanEqual (ivec4 x, ivec4 y) {\n" " return bvec4 (x.x >= y.x, x.y >= y.y, x.z >= y.z, x.w >= y.w);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "bvec2 equal (vec2 x, vec2 y) {\n" " return bvec2 (x.x == y.x, x.y == y.y);\n" "}\n" "bvec3 equal (vec3 x, vec3 y) {\n" " return bvec3 (x.x == y.x, x.y == y.y, x.z == y.z);\n" "}\n" "bvec4 equal (vec4 x, vec4 y) {\n" " return bvec4 (x.x == y.x, x.y == y.y, x.z == y.z, x.w == y.w);\n" "}\n" "bvec2 equal (ivec2 x, ivec2 y) {\n" " return bvec2 (x.x == y.x, x.y == y.y);\n" "}\n" "bvec3 equal (ivec3 x, ivec3 y) {\n" " return bvec3 (x.x == y.x, x.y == y.y, x.z == y.z);\n" "}\n" "bvec4 equal (ivec4 x, ivec4 y) {\n" " return bvec4 (x.x == y.x, x.y == y.y, x.z == y.z, x.w == y.w);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "bvec2 notEqual (vec2 x, vec2 y) {\n" " return bvec2 (x.x != y.x, x.y != y.y);\n" "}\n" "bvec3 notEqual (vec3 x, vec3 y) {\n" " return bvec3 (x.x != y.x, x.y != y.y, x.z != y.z);\n" "}\n" "bvec4 notEqual (vec4 x, vec4 y) {\n" " return bvec4 (x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);\n" "}\n" "bvec2 notEqual (ivec2 x, ivec2 y) {\n" " return bvec2 (x.x != y.x, x.y != y.y);\n" "}\n" "bvec3 notEqual (ivec3 x, ivec3 y) {\n" " return bvec3 (x.x != y.x, x.y != y.y, x.z != y.z);\n" "}\n" "bvec4 notEqual (ivec4 x, ivec4 y) {\n" " return bvec4 (x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "bool any (bvec2 x) {\n" " return x.x || x.y;\n" "}\n" "bool any (bvec3 x) {\n" " return x.x || x.y || x.z;\n" "}\n" "bool any (bvec4 x) {\n" " return x.x || x.y || x.z || x.w;\n" "}\n" "\n" "\n" "\n" "\n" "\n" "bool all (bvec2 x) {\n" " return x.x && x.y;\n" "}\n" "bool all (bvec3 x) {\n" " return x.x && x.y && x.z;\n" "}\n" "bool all (bvec4 x) {\n" " return x.x && x.y && x.z && x.w;\n" "}\n" "\n" "\n" "\n" "\n" "\n" "bvec2 not (bvec2 x) {\n" " return bvec2 (!x.x, !x.y);\n" "}\n" "bvec3 not (bvec3 x) {\n" " return bvec3 (!x.x, !x.y, !x.z);\n" "}\n" "bvec4 not (bvec4 x) {\n" " return bvec4 (!x.x, !x.y, !x.z, !x.w);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 texture1D (sampler1D sampler, float coord) {\n" " return vec4 (0.0);\n" "}\n" "vec4 texture1DProj (sampler1D sampler, vec2 coord) {\n" " return texture1D (sampler, coord.s / coord.t);\n" "}\n" "vec4 texture1DProj (sampler1D sampler, vec4 coord) {\n" " return texture1D (sampler, coord.s / coord.q);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 texture2D (sampler2D sampler, vec2 coord) {\n" " return vec4 (0.0);\n" "}\n" "vec4 texture2DProj (sampler2D sampler, vec3 coord) {\n" " return texture2D (sampler, vec2 (coord.s / coord.p, coord.t / coord.p));\n" "}\n" "vec4 texture2DProj (sampler2D sampler, vec4 coord) {\n" " return texture2D (sampler, vec2 (coord.s / coord.q, coord.t / coord.q));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 texture3D (sampler3D sampler, vec3 coord) {\n" " return vec4 (0.0);\n" "}\n" "vec4 texture3DProj (sampler3D sampler, vec4 coord) {\n" " return texture3D (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 textureCube (samplerCube sampler, vec3 coord) {\n" " return vec4 (0.0);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 shadow1D (sampler1DShadow sampler, vec3 coord) {\n" " return vec4 (0.0);\n" "}\n" "\n" "vec4 shadow2D (sampler2DShadow sampler, vec3 coord) {\n" " return vec4 (0.0);\n" "}\n" "vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord) {\n" " return shadow1D (sampler, vec3 (coord.s / coord.q, 0.0, coord.p / coord.q));\n" "}\n" "vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord) {\n" " return shadow2D (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q));\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float noise1 (float x) {\n" " return 0.0;\n" "}\n" "\n" "float noise1 (vec2 x) {\n" " return 0.0;\n" "}\n" "\n" "float noise1 (vec3 x) {\n" " return 0.0;\n" "}\n" "\n" "float noise1 (vec4 x) {\n" " return 0.0;\n" "}\n" "\n" "\n" "\n" "\n" "\n" "vec2 noise2 (float x) {\n" " return vec2 (0.0);\n" "}\n" "\n" "vec2 noise2 (vec2 x) {\n" " return vec2 (0.0);\n" "}\n" "\n" "vec2 noise2 (vec3 x) {\n" " return vec2 (0.0);\n" "}\n" "\n" "vec2 noise2 (vec4 x) {\n" " return vec2 (0.0);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "vec3 noise3 (float x) {\n" " return vec3 (0.0);\n" "}\n" "\n" "vec3 noise3 (vec2 x) {\n" " return vec3 (0.0);\n" "}\n" "\n" "vec3 noise3 (vec3 x) {\n" " return vec3 (0.0);\n" "}\n" "\n" "vec3 noise3 (vec4 x) {\n" " return vec3 (0.0);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "vec4 noise4 (float x) {\n" " return vec4 (0.0);\n" "}\n" "\n" "vec4 noise4 (vec2 x) {\n" " return vec4 (0.0);\n" "}\n" "\n" "vec4 noise4 (vec3 x) {\n" " return vec4 (0.0);\n" "}\n" "\n" "vec4 noise4 (vec4 x) {\n" " return vec4 (0.0);\n" "}\n" "\n" nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_core_gc_bin.h0000755000000000000000000013752413614532424025040 0ustar 2,1,0,5,1,1,1,0,9,95,102,0,0,0,1,3,2,0,5,1,95,105,0,0,0,4,102,108,111,97,116,95,116,111,95,105,110, 116,0,18,95,105,0,0,18,95,102,0,0,0,8,18,95,105,0,0,0,1,0,1,1,1,1,0,5,95,105,0,0,0,1,8,18,95,105,0, 16,8,48,0,39,0,0,1,0,1,1,1,1,0,9,95,102,0,0,0,1,8,18,95,102,0,17,48,0,48,0,0,39,0,0,1,0,5,1,1,1,0,1, 95,98,0,0,0,1,8,18,95,98,0,16,10,49,0,16,8,48,0,31,0,0,1,0,9,1,1,1,0,1,95,98,0,0,0,1,8,18,95,98,0, 17,49,0,48,0,0,17,48,0,48,0,0,31,0,0,1,0,9,1,1,1,0,5,95,105,0,0,0,1,3,2,0,9,1,95,102,0,0,0,4,105, 110,116,95,116,111,95,102,108,111,97,116,0,18,95,102,0,0,18,95,105,0,0,0,8,18,95,102,0,0,0,1,0,1,1, 1,1,0,1,95,98,0,0,0,1,8,18,95,98,0,0,0,1,0,5,1,1,1,0,5,95,105,0,0,0,1,8,18,95,105,0,0,0,1,0,9,1,1,1, 0,9,95,102,0,0,0,1,8,18,95,102,0,0,0,1,0,10,1,1,1,0,9,95,102,0,0,0,1,8,58,118,101,99,50,0,18,95,102, 0,0,18,95,102,0,0,0,0,0,1,0,10,1,1,1,0,5,95,105,0,0,0,1,8,58,118,101,99,50,0,18,95,105,0,0,18,95, 105,0,0,0,0,0,1,0,10,1,1,1,0,1,95,98,0,0,0,1,8,58,118,101,99,50,0,18,95,98,0,0,18,95,98,0,0,0,0,0,1, 0,11,1,1,1,0,9,95,102,0,0,0,1,8,58,118,101,99,51,0,18,95,102,0,0,18,95,102,0,0,18,95,102,0,0,0,0,0, 1,0,11,1,1,1,0,5,95,105,0,0,0,1,8,58,118,101,99,51,0,18,95,105,0,0,18,95,105,0,0,18,95,105,0,0,0,0, 0,1,0,11,1,1,1,0,1,95,98,0,0,0,1,8,58,118,101,99,51,0,18,95,98,0,0,18,95,98,0,0,18,95,98,0,0,0,0,0, 1,0,12,1,1,1,0,9,95,102,0,0,0,1,8,58,118,101,99,52,0,18,95,102,0,0,18,95,102,0,0,18,95,102,0,0,18, 95,102,0,0,0,0,0,1,0,12,1,1,1,0,5,95,105,0,0,0,1,8,58,118,101,99,52,0,18,95,105,0,0,18,95,105,0,0, 18,95,105,0,0,18,95,105,0,0,0,0,0,1,0,12,1,1,1,0,1,95,98,0,0,0,1,8,58,118,101,99,52,0,18,95,98,0,0, 18,95,98,0,0,18,95,98,0,0,18,95,98,0,0,0,0,0,1,0,6,1,1,1,0,5,95,105,0,0,0,1,8,58,105,118,101,99,50, 0,18,95,105,0,0,18,95,105,0,0,0,0,0,1,0,6,1,1,1,0,9,95,102,0,0,0,1,8,58,105,118,101,99,50,0,18,95, 102,0,0,18,95,102,0,0,0,0,0,1,0,6,1,1,1,0,1,95,98,0,0,0,1,8,58,105,118,101,99,50,0,18,95,98,0,0,18, 95,98,0,0,0,0,0,1,0,7,1,1,1,0,5,95,105,0,0,0,1,8,58,105,118,101,99,51,0,18,95,105,0,0,18,95,105,0,0, 18,95,105,0,0,0,0,0,1,0,7,1,1,1,0,9,95,102,0,0,0,1,8,58,105,118,101,99,51,0,18,95,102,0,0,18,95,102, 0,0,18,95,102,0,0,0,0,0,1,0,7,1,1,1,0,1,95,98,0,0,0,1,8,58,105,118,101,99,51,0,18,95,98,0,0,18,95, 98,0,0,18,95,98,0,0,0,0,0,1,0,8,1,1,1,0,5,95,105,0,0,0,1,8,58,105,118,101,99,52,0,18,95,105,0,0,18, 95,105,0,0,18,95,105,0,0,18,95,105,0,0,0,0,0,1,0,8,1,1,1,0,9,95,102,0,0,0,1,8,58,105,118,101,99,52, 0,18,95,102,0,0,18,95,102,0,0,18,95,102,0,0,18,95,102,0,0,0,0,0,1,0,8,1,1,1,0,1,95,98,0,0,0,1,8,58, 105,118,101,99,52,0,18,95,98,0,0,18,95,98,0,0,18,95,98,0,0,18,95,98,0,0,0,0,0,1,0,2,1,1,1,0,1,95,98, 0,0,0,1,8,58,98,118,101,99,50,0,18,95,98,0,0,18,95,98,0,0,0,0,0,1,0,2,1,1,1,0,9,95,102,0,0,0,1,8,58, 98,118,101,99,50,0,18,95,102,0,0,18,95,102,0,0,0,0,0,1,0,2,1,1,1,0,5,95,105,0,0,0,1,8,58,98,118,101, 99,50,0,18,95,105,0,0,18,95,105,0,0,0,0,0,1,0,3,1,1,1,0,1,95,98,0,0,0,1,8,58,98,118,101,99,51,0,18, 95,98,0,0,18,95,98,0,0,18,95,98,0,0,0,0,0,1,0,3,1,1,1,0,9,95,102,0,0,0,1,8,58,98,118,101,99,51,0,18, 95,102,0,0,18,95,102,0,0,18,95,102,0,0,0,0,0,1,0,3,1,1,1,0,5,95,105,0,0,0,1,8,58,98,118,101,99,51,0, 18,95,105,0,0,18,95,105,0,0,18,95,105,0,0,0,0,0,1,0,4,1,1,1,0,1,95,98,0,0,0,1,8,58,98,118,101,99,52, 0,18,95,98,0,0,18,95,98,0,0,18,95,98,0,0,18,95,98,0,0,0,0,0,1,0,4,1,1,1,0,9,95,102,0,0,0,1,8,58,98, 118,101,99,52,0,18,95,102,0,0,18,95,102,0,0,18,95,102,0,0,18,95,102,0,0,0,0,0,1,0,4,1,1,1,0,5,95, 105,0,0,0,1,8,58,98,118,101,99,52,0,18,95,105,0,0,18,95,105,0,0,18,95,105,0,0,18,95,105,0,0,0,0,0,1, 0,13,1,1,1,0,9,95,102,0,0,0,1,8,58,109,97,116,50,0,18,95,102,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95, 102,0,0,0,0,0,1,0,13,1,1,1,0,5,95,105,0,0,0,1,8,58,109,97,116,50,0,18,95,105,0,0,17,0,48,0,0,0,17,0, 48,0,0,0,18,95,105,0,0,0,0,0,1,0,13,1,1,1,0,1,95,98,0,0,0,1,8,58,109,97,116,50,0,18,95,98,0,0,17,0, 48,0,0,0,17,0,48,0,0,0,18,95,98,0,0,0,0,0,1,0,14,1,1,1,0,9,95,102,0,0,0,1,8,58,109,97,116,51,0,18, 95,102,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,102,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0, 48,0,0,0,18,95,102,0,0,0,0,0,1,0,14,1,1,1,0,5,95,105,0,0,0,1,8,58,109,97,116,51,0,18,95,105,0,0,17, 0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,105,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18, 95,105,0,0,0,0,0,1,0,14,1,1,1,0,1,95,98,0,0,0,1,8,58,109,97,116,51,0,18,95,98,0,0,17,0,48,0,0,0,17, 0,48,0,0,0,17,0,48,0,0,0,18,95,98,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,98,0,0,0,0,0, 1,0,15,1,1,1,0,9,95,102,0,0,0,1,8,58,109,97,116,52,0,18,95,102,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0, 48,0,0,0,17,0,48,0,0,0,18,95,102,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95, 102,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,102,0,0,0,0,0,1,0,15,1,1,1,0, 5,95,105,0,0,0,1,8,58,109,97,116,52,0,18,95,105,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0, 48,0,0,0,18,95,105,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,105,0,0,17,0, 48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,105,0,0,0,0,0,1,0,15,1,1,1,0,1,95,98,0,0,0, 1,8,58,109,97,116,52,0,18,95,98,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95, 98,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,98,0,0,17,0,48,0,0,0,17,0,48,0, 0,0,17,0,48,0,0,0,17,0,48,0,0,0,18,95,98,0,0,0,0,0,1,0,0,2,2,1,0,2,9,97,0,0,1,1,0,9,98,0,0,0,1,4, 102,108,111,97,116,95,97,100,100,0,18,97,0,0,18,97,0,0,18,98,0,0,0,0,1,0,9,2,30,1,1,0,9,97,0,0,0,1, 3,2,0,9,1,99,0,0,0,4,102,108,111,97,116,95,110,101,103,97,116,101,0,18,99,0,0,18,97,0,0,0,8,18,99,0, 0,0,1,0,0,2,3,1,0,2,9,97,0,0,1,1,0,9,98,0,0,0,1,9,18,97,0,18,98,0,54,21,0,0,1,0,0,2,4,1,0,2,9,97,0, 0,1,1,0,9,98,0,0,0,1,4,102,108,111,97,116,95,109,117,108,116,105,112,108,121,0,18,97,0,0,18,97,0,0, 18,98,0,0,0,0,1,0,0,2,5,1,0,2,9,97,0,0,1,1,0,9,98,0,0,0,1,4,102,108,111,97,116,95,100,105,118,105, 100,101,0,18,97,0,0,18,97,0,0,18,98,0,0,0,0,1,0,9,2,29,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,9,1, 99,0,0,0,9,18,99,0,18,97,0,20,0,8,18,99,0,18,98,0,21,0,0,1,0,0,2,2,1,0,2,5,97,0,0,1,1,0,5,98,0,0,0, 1,9,18,97,0,58,105,110,116,0,58,102,108,111,97,116,0,18,97,0,0,0,58,102,108,111,97,116,0,18,98,0,0, 0,46,0,0,20,0,0,1,0,5,2,30,1,1,0,5,97,0,0,0,1,8,58,105,110,116,0,58,102,108,111,97,116,0,18,97,0,0, 0,54,0,0,0,0,1,0,0,2,3,1,0,2,5,97,0,0,1,1,0,5,98,0,0,0,1,9,18,97,0,18,98,0,54,21,0,0,1,0,9,2,24,1,1, 0,9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,9,1,99,0,0,0,9,18,99,0,18,97,0,20,0,8,18,99,0,18,98,0,23,0,0,1, 0,0,2,4,1,0,2,5,97,0,0,1,1,0,5,98,0,0,0,1,9,18,97,0,58,105,110,116,0,58,102,108,111,97,116,0,18,97, 0,0,0,58,102,108,111,97,116,0,18,98,0,0,0,48,0,0,20,0,0,1,0,9,2,25,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0, 1,3,2,0,9,1,99,0,0,0,9,18,99,0,18,97,0,20,0,8,18,99,0,18,98,0,24,0,0,1,0,0,2,5,1,0,2,5,97,0,0,1,1,0, 5,98,0,0,0,1,9,18,97,0,58,105,110,116,0,58,102,108,111,97,116,0,18,97,0,0,0,58,102,108,111,97,116,0, 18,98,0,0,0,49,0,0,20,0,0,1,0,0,2,2,1,0,2,10,118,0,0,1,1,0,10,117,0,0,0,1,9,18,118,0,59,120,0,18, 117,0,59,120,0,21,18,118,0,59,121,0,18,117,0,59,121,0,21,19,0,0,1,0,0,2,3,1,0,2,10,118,0,0,1,1,0,10, 117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,22,18,118,0,59,121,0,18,117,0,59,121,0,22,19,0,0, 1,0,0,2,4,1,0,2,10,118,0,0,1,1,0,10,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,23,18,118,0, 59,121,0,18,117,0,59,121,0,23,19,0,0,1,0,0,2,5,1,0,2,10,118,0,0,1,1,0,10,117,0,0,0,1,9,18,118,0,59, 120,0,18,117,0,59,120,0,24,18,118,0,59,121,0,18,117,0,59,121,0,24,19,0,0,1,0,0,2,2,1,0,2,11,118,0,0, 1,1,0,11,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,21,18,118,0,59,121,0,18,117,0,59,121,0, 21,19,18,118,0,59,122,0,18,117,0,59,122,0,21,19,0,0,1,0,0,2,3,1,0,2,11,118,0,0,1,1,0,11,117,0,0,0,1, 9,18,118,0,59,120,0,18,117,0,59,120,0,22,18,118,0,59,121,0,18,117,0,59,121,0,22,19,18,118,0,59,122, 0,18,117,0,59,122,0,22,19,0,0,1,0,0,2,4,1,0,2,11,118,0,0,1,1,0,11,117,0,0,0,1,9,18,118,0,59,120,0, 18,117,0,59,120,0,23,18,118,0,59,121,0,18,117,0,59,121,0,23,19,18,118,0,59,122,0,18,117,0,59,122,0, 23,19,0,0,1,0,0,2,5,1,0,2,11,118,0,0,1,1,0,11,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,24, 18,118,0,59,121,0,18,117,0,59,121,0,24,19,18,118,0,59,122,0,18,117,0,59,122,0,24,19,0,0,1,0,0,2,2,1, 0,2,12,118,0,0,1,1,0,12,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,21,18,118,0,59,121,0,18, 117,0,59,121,0,21,19,18,118,0,59,122,0,18,117,0,59,122,0,21,19,18,118,0,59,119,0,18,117,0,59,119,0, 21,19,0,0,1,0,0,2,3,1,0,2,12,118,0,0,1,1,0,12,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,22, 18,118,0,59,121,0,18,117,0,59,121,0,22,19,18,118,0,59,122,0,18,117,0,59,122,0,22,19,18,118,0,59,119, 0,18,117,0,59,119,0,22,19,0,0,1,0,0,2,4,1,0,2,12,118,0,0,1,1,0,12,117,0,0,0,1,9,18,118,0,59,120,0, 18,117,0,59,120,0,23,18,118,0,59,121,0,18,117,0,59,121,0,23,19,18,118,0,59,122,0,18,117,0,59,122,0, 23,19,18,118,0,59,119,0,18,117,0,59,119,0,23,19,0,0,1,0,0,2,5,1,0,2,12,118,0,0,1,1,0,12,117,0,0,0,1, 9,18,118,0,59,120,0,18,117,0,59,120,0,24,18,118,0,59,121,0,18,117,0,59,121,0,24,19,18,118,0,59,122, 0,18,117,0,59,122,0,24,19,18,118,0,59,119,0,18,117,0,59,119,0,24,19,0,0,1,0,0,2,2,1,0,2,6,118,0,0,1, 1,0,6,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,21,18,118,0,59,121,0,18,117,0,59,121,0,21, 19,0,0,1,0,0,2,3,1,0,2,6,118,0,0,1,1,0,6,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,22,18, 118,0,59,121,0,18,117,0,59,121,0,22,19,0,0,1,0,0,2,4,1,0,2,6,118,0,0,1,1,0,6,117,0,0,0,1,9,18,118,0, 59,120,0,18,117,0,59,120,0,23,18,118,0,59,121,0,18,117,0,59,121,0,23,19,0,0,1,0,0,2,5,1,0,2,6,118,0, 0,1,1,0,6,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,24,18,118,0,59,121,0,18,117,0,59,121,0, 24,19,0,0,1,0,0,2,2,1,0,2,7,118,0,0,1,1,0,7,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,21,18, 118,0,59,121,0,18,117,0,59,121,0,21,19,18,118,0,59,122,0,18,117,0,59,122,0,21,19,0,0,1,0,0,2,3,1,0, 2,7,118,0,0,1,1,0,7,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,22,18,118,0,59,121,0,18,117,0, 59,121,0,22,19,18,118,0,59,122,0,18,117,0,59,122,0,22,19,0,0,1,0,0,2,4,1,0,2,7,118,0,0,1,1,0,7,117, 0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,23,18,118,0,59,121,0,18,117,0,59,121,0,23,19,18,118,0, 59,122,0,18,117,0,59,122,0,23,19,0,0,1,0,0,2,5,1,0,2,7,118,0,0,1,1,0,7,117,0,0,0,1,9,18,118,0,59, 120,0,18,117,0,59,120,0,24,18,118,0,59,121,0,18,117,0,59,121,0,24,19,18,118,0,59,122,0,18,117,0,59, 122,0,24,19,0,0,1,0,0,2,2,1,0,2,8,118,0,0,1,1,0,8,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0, 21,18,118,0,59,121,0,18,117,0,59,121,0,21,19,18,118,0,59,122,0,18,117,0,59,122,0,21,19,18,118,0,59, 119,0,18,117,0,59,119,0,21,19,0,0,1,0,0,2,3,1,0,2,8,118,0,0,1,1,0,8,117,0,0,0,1,9,18,118,0,59,120,0, 18,117,0,59,120,0,22,18,118,0,59,121,0,18,117,0,59,121,0,22,19,18,118,0,59,122,0,18,117,0,59,122,0, 22,19,18,118,0,59,119,0,18,117,0,59,119,0,22,19,0,0,1,0,0,2,4,1,0,2,8,118,0,0,1,1,0,8,117,0,0,0,1,9, 18,118,0,59,120,0,18,117,0,59,120,0,23,18,118,0,59,121,0,18,117,0,59,121,0,23,19,18,118,0,59,122,0, 18,117,0,59,122,0,23,19,18,118,0,59,119,0,18,117,0,59,119,0,23,19,0,0,1,0,0,2,5,1,0,2,8,118,0,0,1,1, 0,8,117,0,0,0,1,9,18,118,0,59,120,0,18,117,0,59,120,0,24,18,118,0,59,121,0,18,117,0,59,121,0,24,19, 18,118,0,59,122,0,18,117,0,59,122,0,24,19,18,118,0,59,119,0,18,117,0,59,119,0,24,19,0,0,1,0,0,2,2,1, 0,2,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,21,18,109,0,16,10, 49,0,57,18,110,0,16,10,49,0,57,21,19,0,0,1,0,0,2,3,1,0,2,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,109,0, 16,8,48,0,57,18,110,0,16,8,48,0,57,22,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,22,19,0,0,1,0, 10,2,24,1,1,0,13,109,0,0,1,1,0,10,118,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,18,109,0,16,8, 48,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,120,0,48,46,0,18,118,0,59,120,0,18, 109,0,16,8,48,0,57,59,121,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,121,0,48,46,0,0,0,0,1,0, 13,2,24,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,8,58,109,97,116,50,0,18,109,0,18,110,0,16,8,48,0,57, 48,0,18,109,0,18,110,0,16,10,49,0,57,48,0,0,0,0,1,0,0,2,4,1,0,2,13,109,0,0,1,1,0,13,110,0,0,0,1,9, 18,109,0,18,109,0,18,110,0,48,20,0,0,1,0,0,2,5,1,0,2,13,109,0,0,1,1,0,13,110,0,0,0,1,9,18,109,0,16, 8,48,0,57,18,110,0,16,8,48,0,57,24,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,24,19,0,0,1,0,0,2, 2,1,0,2,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,21,18,109,0, 16,10,49,0,57,18,110,0,16,10,49,0,57,21,19,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,21,19,0,0, 1,0,0,2,3,1,0,2,14,109,0,0,1,1,0,14,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,22,18, 109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,22,19,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,22, 19,0,0,1,0,11,2,24,1,1,0,14,109,0,0,1,1,0,11,118,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,18, 109,0,16,8,48,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,120,0,48,46,18,118,0,59, 122,0,18,109,0,16,10,50,0,57,59,120,0,48,46,0,18,118,0,59,120,0,18,109,0,16,8,48,0,57,59,121,0,48, 18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,121,0,48,46,18,118,0,59,122,0,18,109,0,16,10,50,0,57,59, 121,0,48,46,0,18,118,0,59,120,0,18,109,0,16,8,48,0,57,59,122,0,48,18,118,0,59,121,0,18,109,0,16,10, 49,0,57,59,122,0,48,46,18,118,0,59,122,0,18,109,0,16,10,50,0,57,59,122,0,48,46,0,0,0,0,1,0,14,2,24, 1,1,0,14,109,0,0,1,1,0,14,110,0,0,0,1,8,58,109,97,116,51,0,18,109,0,18,110,0,16,8,48,0,57,48,0,18, 109,0,18,110,0,16,10,49,0,57,48,0,18,109,0,18,110,0,16,10,50,0,57,48,0,0,0,0,1,0,0,2,4,1,0,2,14,109, 0,0,1,1,0,14,110,0,0,0,1,9,18,109,0,18,109,0,18,110,0,48,20,0,0,1,0,0,2,5,1,0,2,14,109,0,0,1,1,0,14, 110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,24,18,109,0,16,10,49,0,57,18,110,0,16,10, 49,0,57,24,19,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,24,19,0,0,1,0,0,2,2,1,0,2,15,109,0,0,1, 1,0,15,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,21,18,109,0,16,10,49,0,57,18,110,0, 16,10,49,0,57,21,19,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,21,19,18,109,0,16,10,51,0,57,18, 110,0,16,10,51,0,57,21,19,0,0,1,0,0,2,3,1,0,2,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18,109,0,16,8,48,0, 57,18,110,0,16,8,48,0,57,22,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,22,19,18,109,0,16,10,50,0, 57,18,110,0,16,10,50,0,57,22,19,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,22,19,0,0,1,0,12,2,24, 1,1,0,15,109,0,0,1,1,0,12,118,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,109,0,16,8,48,0,57, 59,120,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,120,0,48,46,18,118,0,59,122,0,18,109,0,16, 10,50,0,57,59,120,0,48,46,18,118,0,59,119,0,18,109,0,16,10,51,0,57,59,120,0,48,46,0,18,118,0,59,120, 0,18,109,0,16,8,48,0,57,59,121,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,121,0,48,46,18,118, 0,59,122,0,18,109,0,16,10,50,0,57,59,121,0,48,46,18,118,0,59,119,0,18,109,0,16,10,51,0,57,59,121,0, 48,46,0,18,118,0,59,120,0,18,109,0,16,8,48,0,57,59,122,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0, 57,59,122,0,48,46,18,118,0,59,122,0,18,109,0,16,10,50,0,57,59,122,0,48,46,18,118,0,59,119,0,18,109, 0,16,10,51,0,57,59,122,0,48,46,0,18,118,0,59,120,0,18,109,0,16,8,48,0,57,59,119,0,48,18,118,0,59, 121,0,18,109,0,16,10,49,0,57,59,119,0,48,46,18,118,0,59,122,0,18,109,0,16,10,50,0,57,59,119,0,48,46, 18,118,0,59,119,0,18,109,0,16,10,51,0,57,59,119,0,48,46,0,0,0,0,1,0,15,2,24,1,1,0,15,109,0,0,1,1,0, 15,110,0,0,0,1,8,58,109,97,116,52,0,18,109,0,18,110,0,16,8,48,0,57,48,0,18,109,0,18,110,0,16,10,49, 0,57,48,0,18,109,0,18,110,0,16,10,50,0,57,48,0,18,109,0,18,110,0,16,10,51,0,57,48,0,0,0,0,1,0,0,2,4, 1,0,2,15,109,0,0,1,1,0,15,110,0,0,0,1,9,18,109,0,18,109,0,18,110,0,48,20,0,0,1,0,0,2,5,1,0,2,15,109, 0,0,1,1,0,15,110,0,0,0,1,9,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,24,18,109,0,16,10,49,0,57,18, 110,0,16,10,49,0,57,24,19,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,24,19,18,109,0,16,10,51,0, 57,18,110,0,16,10,51,0,57,24,19,0,0,1,0,0,2,2,1,0,2,10,118,0,0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120, 0,18,97,0,21,18,118,0,59,121,0,18,97,0,21,19,0,0,1,0,0,2,3,1,0,2,10,118,0,0,1,1,0,9,97,0,0,0,1,9,18, 118,0,59,120,0,18,97,0,22,18,118,0,59,121,0,18,97,0,22,19,0,0,1,0,0,2,4,1,0,2,10,118,0,0,1,1,0,9,97, 0,0,0,1,9,18,118,0,59,120,0,18,97,0,23,18,118,0,59,121,0,18,97,0,23,19,0,0,1,0,0,2,5,1,0,2,10,118,0, 0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0,18,97,0,24,18,118,0,59,121,0,18,97,0,24,19,0,0,1,0,0,2,2,1, 0,2,11,118,0,0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0,18,97,0,21,18,118,0,59,121,0,18,97,0,21,19,18, 118,0,59,122,0,18,97,0,21,19,0,0,1,0,0,2,3,1,0,2,11,118,0,0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0, 18,97,0,22,18,118,0,59,121,0,18,97,0,22,19,18,118,0,59,122,0,18,97,0,22,19,0,0,1,0,0,2,4,1,0,2,11, 118,0,0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0,18,97,0,23,18,118,0,59,121,0,18,97,0,23,19,18,118,0, 59,122,0,18,97,0,23,19,0,0,1,0,0,2,5,1,0,2,11,118,0,0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0,18,97, 0,24,18,118,0,59,121,0,18,97,0,24,19,18,118,0,59,122,0,18,97,0,24,19,0,0,1,0,0,2,2,1,0,2,12,118,0,0, 1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0,18,97,0,21,18,118,0,59,121,0,18,97,0,21,19,18,118,0,59,122,0, 18,97,0,21,19,18,118,0,59,119,0,18,97,0,21,19,0,0,1,0,0,2,3,1,0,2,12,118,0,0,1,1,0,9,97,0,0,0,1,9, 18,118,0,59,120,0,18,97,0,22,18,118,0,59,121,0,18,97,0,22,19,18,118,0,59,122,0,18,97,0,22,19,18,118, 0,59,119,0,18,97,0,22,19,0,0,1,0,0,2,4,1,0,2,12,118,0,0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0,18, 97,0,23,18,118,0,59,121,0,18,97,0,23,19,18,118,0,59,122,0,18,97,0,23,19,18,118,0,59,119,0,18,97,0, 23,19,0,0,1,0,0,2,5,1,0,2,12,118,0,0,1,1,0,9,97,0,0,0,1,9,18,118,0,59,120,0,18,97,0,24,18,118,0,59, 121,0,18,97,0,24,19,18,118,0,59,122,0,18,97,0,24,19,18,118,0,59,119,0,18,97,0,24,19,0,0,1,0,0,2,2,1, 0,2,13,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,21,18,109,0,16,10,49,0,57,18,97,0, 21,19,0,0,1,0,0,2,3,1,0,2,13,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,22,18,109,0, 16,10,49,0,57,18,97,0,22,19,0,0,1,0,0,2,4,1,0,2,13,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0, 57,18,97,0,23,18,109,0,16,10,49,0,57,18,97,0,23,19,0,0,1,0,0,2,5,1,0,2,13,109,0,0,1,1,0,9,97,0,0,0, 1,9,18,109,0,16,8,48,0,57,18,97,0,24,18,109,0,16,10,49,0,57,18,97,0,24,19,0,0,1,0,0,2,2,1,0,2,14, 109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,21,18,109,0,16,10,49,0,57,18,97,0,21,19, 18,109,0,16,10,50,0,57,18,97,0,21,19,0,0,1,0,0,2,3,1,0,2,14,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0, 16,8,48,0,57,18,97,0,22,18,109,0,16,10,49,0,57,18,97,0,22,19,18,109,0,16,10,50,0,57,18,97,0,22,19,0, 0,1,0,0,2,4,1,0,2,14,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,23,18,109,0,16,10, 49,0,57,18,97,0,23,19,18,109,0,16,10,50,0,57,18,97,0,23,19,0,0,1,0,0,2,5,1,0,2,14,109,0,0,1,1,0,9, 97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,24,18,109,0,16,10,49,0,57,18,97,0,24,19,18,109,0,16,10, 50,0,57,18,97,0,24,19,0,0,1,0,0,2,2,1,0,2,15,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18, 97,0,21,18,109,0,16,10,49,0,57,18,97,0,21,19,18,109,0,16,10,50,0,57,18,97,0,21,19,18,109,0,16,10,51, 0,57,18,97,0,21,19,0,0,1,0,0,2,3,1,0,2,15,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97, 0,22,18,109,0,16,10,49,0,57,18,97,0,22,19,18,109,0,16,10,50,0,57,18,97,0,22,19,18,109,0,16,10,51,0, 57,18,97,0,22,19,0,0,1,0,0,2,4,1,0,2,15,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0, 23,18,109,0,16,10,49,0,57,18,97,0,23,19,18,109,0,16,10,50,0,57,18,97,0,23,19,18,109,0,16,10,51,0,57, 18,97,0,23,19,0,0,1,0,0,2,5,1,0,2,15,109,0,0,1,1,0,9,97,0,0,0,1,9,18,109,0,16,8,48,0,57,18,97,0,24, 18,109,0,16,10,49,0,57,18,97,0,24,19,18,109,0,16,10,50,0,57,18,97,0,24,19,18,109,0,16,10,51,0,57,18, 97,0,24,19,0,0,1,0,10,2,24,1,1,0,10,118,0,0,1,1,0,13,109,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59, 120,0,18,109,0,16,8,48,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,8,48,0,57,59,121,0,48,46,0,18, 118,0,59,120,0,18,109,0,16,10,49,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,121,0, 48,46,0,0,0,0,1,0,0,2,4,1,0,2,10,118,0,0,1,1,0,13,109,0,0,0,1,9,18,118,0,18,118,0,18,109,0,48,20,0, 0,1,0,11,2,24,1,1,0,11,118,0,0,1,1,0,14,109,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,18,109,0, 16,8,48,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,8,48,0,57,59,121,0,48,46,18,118,0,59,122,0, 18,109,0,16,8,48,0,57,59,122,0,48,46,0,18,118,0,59,120,0,18,109,0,16,10,49,0,57,59,120,0,48,18,118, 0,59,121,0,18,109,0,16,10,49,0,57,59,121,0,48,46,18,118,0,59,122,0,18,109,0,16,10,49,0,57,59,122,0, 48,46,0,18,118,0,59,120,0,18,109,0,16,10,50,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,10,50,0, 57,59,121,0,48,46,18,118,0,59,122,0,18,109,0,16,10,50,0,57,59,122,0,48,46,0,0,0,0,1,0,0,2,4,1,0,2, 11,118,0,0,1,1,0,14,109,0,0,0,1,9,18,118,0,18,118,0,18,109,0,48,20,0,0,1,0,12,2,24,1,1,0,12,118,0,0, 1,1,0,15,109,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,109,0,16,8,48,0,57,59,120,0,48,18, 118,0,59,121,0,18,109,0,16,8,48,0,57,59,121,0,48,46,18,118,0,59,122,0,18,109,0,16,8,48,0,57,59,122, 0,48,46,18,118,0,59,119,0,18,109,0,16,8,48,0,57,59,119,0,48,46,0,18,118,0,59,120,0,18,109,0,16,10, 49,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,10,49,0,57,59,121,0,48,46,18,118,0,59,122,0,18, 109,0,16,10,49,0,57,59,122,0,48,46,18,118,0,59,119,0,18,109,0,16,10,49,0,57,59,119,0,48,46,0,18,118, 0,59,120,0,18,109,0,16,10,50,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16,10,50,0,57,59,121,0,48, 46,18,118,0,59,122,0,18,109,0,16,10,50,0,57,59,122,0,48,46,18,118,0,59,119,0,18,109,0,16,10,50,0,57, 59,119,0,48,46,0,18,118,0,59,120,0,18,109,0,16,10,51,0,57,59,120,0,48,18,118,0,59,121,0,18,109,0,16, 10,51,0,57,59,121,0,48,46,18,118,0,59,122,0,18,109,0,16,10,51,0,57,59,122,0,48,46,18,118,0,59,119,0, 18,109,0,16,10,51,0,57,59,119,0,48,46,0,0,0,0,1,0,0,2,4,1,0,2,12,118,0,0,1,1,0,15,109,0,0,0,1,9,18, 118,0,18,118,0,18,109,0,48,20,0,0,1,0,9,2,30,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,8,18,97,0,18,98,0,54, 46,0,0,1,0,5,2,29,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,3,2,0,5,1,99,0,0,0,9,18,99,0,18,97,0,20,0,8,18, 99,0,18,98,0,21,0,0,1,0,5,2,30,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,8,18,97,0,18,98,0,54,46,0,0,1,0,5, 2,24,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,3,2,0,5,1,99,0,0,0,8,18,99,0,18,97,0,20,18,98,0,23,0,0,1,0,5, 2,25,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,3,2,0,5,1,99,0,0,0,8,18,99,0,18,97,0,20,18,98,0,24,0,0,1,0, 10,2,29,1,1,0,10,118,0,0,1,1,0,10,117,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59, 120,0,46,0,18,118,0,59,121,0,18,117,0,59,121,0,46,0,0,0,0,1,0,10,2,30,1,1,0,10,118,0,0,1,1,0,10,117, 0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59,120,0,47,0,18,118,0,59,121,0,18,117,0,59, 121,0,47,0,0,0,0,1,0,11,2,29,1,1,0,11,118,0,0,1,1,0,11,117,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59, 120,0,18,117,0,59,120,0,46,0,18,118,0,59,121,0,18,117,0,59,121,0,46,0,18,118,0,59,122,0,18,117,0,59, 122,0,46,0,0,0,0,1,0,11,2,30,1,1,0,11,118,0,0,1,1,0,11,117,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59, 120,0,18,117,0,59,120,0,47,0,18,118,0,59,121,0,18,117,0,59,121,0,47,0,18,118,0,59,122,0,18,117,0,59, 122,0,47,0,0,0,0,1,0,12,2,29,1,1,0,12,118,0,0,1,1,0,12,117,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59, 120,0,18,117,0,59,120,0,46,0,18,118,0,59,121,0,18,117,0,59,121,0,46,0,18,118,0,59,122,0,18,117,0,59, 122,0,46,0,18,118,0,59,119,0,18,117,0,59,119,0,46,0,0,0,0,1,0,12,2,30,1,1,0,12,118,0,0,1,1,0,12,117, 0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,47,0,18,118,0,59,121,0,18,117,0,59, 121,0,47,0,18,118,0,59,122,0,18,117,0,59,122,0,47,0,18,118,0,59,119,0,18,117,0,59,119,0,47,0,0,0,0, 1,0,6,2,29,1,1,0,6,118,0,0,1,1,0,6,117,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0,18,117,0, 59,120,0,46,0,18,118,0,59,121,0,18,117,0,59,121,0,46,0,0,0,0,1,0,6,2,30,1,1,0,6,118,0,0,1,1,0,6,117, 0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59,120,0,47,0,18,118,0,59,121,0,18,117, 0,59,121,0,47,0,0,0,0,1,0,7,2,29,1,1,0,7,118,0,0,1,1,0,7,117,0,0,0,1,8,58,105,118,101,99,51,0,18, 118,0,59,120,0,18,117,0,59,120,0,46,0,18,118,0,59,121,0,18,117,0,59,121,0,46,0,18,118,0,59,122,0,18, 117,0,59,122,0,46,0,0,0,0,1,0,7,2,30,1,1,0,7,118,0,0,1,1,0,7,117,0,0,0,1,8,58,105,118,101,99,51,0, 18,118,0,59,120,0,18,117,0,59,120,0,47,0,18,118,0,59,121,0,18,117,0,59,121,0,47,0,18,118,0,59,122,0, 18,117,0,59,122,0,47,0,0,0,0,1,0,8,2,29,1,1,0,8,118,0,0,1,1,0,8,117,0,0,0,1,8,58,105,118,101,99,52, 0,18,118,0,59,120,0,18,117,0,59,120,0,46,0,18,118,0,59,121,0,18,117,0,59,121,0,46,0,18,118,0,59,122, 0,18,117,0,59,122,0,46,0,18,118,0,59,119,0,18,117,0,59,119,0,46,0,0,0,0,1,0,8,2,30,1,1,0,8,118,0,0, 1,1,0,8,117,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,47,0,18,118,0,59, 121,0,18,117,0,59,121,0,47,0,18,118,0,59,122,0,18,117,0,59,122,0,47,0,18,118,0,59,119,0,18,117,0,59, 119,0,47,0,0,0,0,1,0,13,2,29,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16, 8,48,0,57,18,110,0,16,8,48,0,57,46,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,46,0,0,0,0,1,0, 13,2,30,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8,48,0,57,18,110,0, 16,8,48,0,57,47,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,47,0,0,0,0,1,0,14,2,29,1,1,0,14,109, 0,0,1,1,0,14,110,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,46,0,18, 109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,46,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,46,0, 0,0,0,1,0,14,2,30,1,1,0,14,109,0,0,1,1,0,14,110,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57, 18,110,0,16,8,48,0,57,47,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,47,0,18,109,0,16,10,50,0, 57,18,110,0,16,10,50,0,57,47,0,0,0,0,1,0,15,2,29,1,1,0,15,109,0,0,1,1,0,15,110,0,0,0,1,8,58,109,97, 116,52,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,46,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49, 0,57,46,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,46,0,18,109,0,16,10,51,0,57,18,110,0,16,10, 51,0,57,46,0,0,0,0,1,0,15,2,30,1,1,0,15,109,0,0,1,1,0,15,110,0,0,0,1,8,58,109,97,116,52,0,18,109,0, 16,8,48,0,57,18,110,0,16,8,48,0,57,47,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,47,0,18,109,0, 16,10,50,0,57,18,110,0,16,10,50,0,57,47,0,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,47,0,0,0,0, 1,0,10,2,29,1,1,0,9,97,0,0,1,1,0,10,117,0,0,0,1,8,58,118,101,99,50,0,18,97,0,18,117,0,59,120,0,46,0, 18,97,0,18,117,0,59,121,0,46,0,0,0,0,1,0,10,2,29,1,1,0,10,118,0,0,1,1,0,9,98,0,0,0,1,8,58,118,101, 99,50,0,18,118,0,59,120,0,18,98,0,46,0,18,118,0,59,121,0,18,98,0,46,0,0,0,0,1,0,10,2,30,1,1,0,9,97, 0,0,1,1,0,10,117,0,0,0,1,8,58,118,101,99,50,0,18,97,0,18,117,0,59,120,0,47,0,18,97,0,18,117,0,59, 121,0,47,0,0,0,0,1,0,10,2,30,1,1,0,10,118,0,0,1,1,0,9,98,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59, 120,0,18,98,0,47,0,18,118,0,59,121,0,18,98,0,47,0,0,0,0,1,0,10,2,24,1,1,0,9,97,0,0,1,1,0,10,117,0,0, 0,1,8,58,118,101,99,50,0,18,97,0,18,117,0,59,120,0,48,0,18,97,0,18,117,0,59,121,0,48,0,0,0,0,1,0,10, 2,24,1,1,0,10,118,0,0,1,1,0,9,98,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,18,98,0,48,0,18,118, 0,59,121,0,18,98,0,48,0,0,0,0,1,0,10,2,25,1,1,0,9,97,0,0,1,1,0,10,117,0,0,0,1,8,58,118,101,99,50,0, 18,97,0,18,117,0,59,120,0,49,0,18,97,0,18,117,0,59,121,0,49,0,0,0,0,1,0,10,2,25,1,1,0,10,118,0,0,1, 1,0,9,98,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,18,98,0,49,0,18,118,0,59,121,0,18,98,0,49,0, 0,0,0,1,0,11,2,29,1,1,0,9,97,0,0,1,1,0,11,117,0,0,0,1,8,58,118,101,99,51,0,18,97,0,18,117,0,59,120, 0,46,0,18,97,0,18,117,0,59,121,0,46,0,18,97,0,18,117,0,59,122,0,46,0,0,0,0,1,0,11,2,29,1,1,0,11,118, 0,0,1,1,0,9,98,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,18,98,0,46,0,18,118,0,59,121,0,18,98, 0,46,0,18,118,0,59,122,0,18,98,0,46,0,0,0,0,1,0,11,2,30,1,1,0,9,97,0,0,1,1,0,11,117,0,0,0,1,8,58, 118,101,99,51,0,18,97,0,18,117,0,59,120,0,47,0,18,97,0,18,117,0,59,121,0,47,0,18,97,0,18,117,0,59, 122,0,47,0,0,0,0,1,0,11,2,30,1,1,0,11,118,0,0,1,1,0,9,98,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59, 120,0,18,98,0,47,0,18,118,0,59,121,0,18,98,0,47,0,18,118,0,59,122,0,18,98,0,47,0,0,0,0,1,0,11,2,24, 1,1,0,9,97,0,0,1,1,0,11,117,0,0,0,1,8,58,118,101,99,51,0,18,97,0,18,117,0,59,120,0,48,0,18,97,0,18, 117,0,59,121,0,48,0,18,97,0,18,117,0,59,122,0,48,0,0,0,0,1,0,11,2,24,1,1,0,11,118,0,0,1,1,0,9,98,0, 0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,18,98,0,48,0,18,118,0,59,121,0,18,98,0,48,0,18,118,0, 59,122,0,18,98,0,48,0,0,0,0,1,0,11,2,25,1,1,0,9,97,0,0,1,1,0,11,117,0,0,0,1,8,58,118,101,99,51,0,18, 97,0,18,117,0,59,120,0,49,0,18,97,0,18,117,0,59,121,0,49,0,18,97,0,18,117,0,59,122,0,49,0,0,0,0,1,0, 11,2,25,1,1,0,11,118,0,0,1,1,0,9,98,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,18,98,0,49,0,18, 118,0,59,121,0,18,98,0,49,0,18,118,0,59,122,0,18,98,0,49,0,0,0,0,1,0,12,2,29,1,1,0,9,97,0,0,1,1,0, 12,117,0,0,0,1,8,58,118,101,99,52,0,18,97,0,18,117,0,59,120,0,46,0,18,97,0,18,117,0,59,121,0,46,0, 18,97,0,18,117,0,59,122,0,46,0,18,97,0,18,117,0,59,119,0,46,0,0,0,0,1,0,12,2,29,1,1,0,12,118,0,0,1, 1,0,9,98,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,98,0,46,0,18,118,0,59,121,0,18,98,0,46,0, 18,118,0,59,122,0,18,98,0,46,0,18,118,0,59,119,0,18,98,0,46,0,0,0,0,1,0,12,2,30,1,1,0,9,97,0,0,1,1, 0,12,117,0,0,0,1,8,58,118,101,99,52,0,18,97,0,18,117,0,59,120,0,47,0,18,97,0,18,117,0,59,121,0,47,0, 18,97,0,18,117,0,59,122,0,47,0,18,97,0,18,117,0,59,119,0,47,0,0,0,0,1,0,12,2,30,1,1,0,12,118,0,0,1, 1,0,9,98,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,98,0,47,0,18,118,0,59,121,0,18,98,0,47,0, 18,118,0,59,122,0,18,98,0,47,0,18,118,0,59,119,0,18,98,0,47,0,0,0,0,1,0,12,2,24,1,1,0,9,97,0,0,1,1, 0,12,117,0,0,0,1,8,58,118,101,99,52,0,18,97,0,18,117,0,59,120,0,48,0,18,97,0,18,117,0,59,121,0,48,0, 18,97,0,18,117,0,59,122,0,48,0,18,97,0,18,117,0,59,119,0,48,0,0,0,0,1,0,12,2,24,1,1,0,12,118,0,0,1, 1,0,9,98,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,98,0,48,0,18,118,0,59,121,0,18,98,0,48,0, 18,118,0,59,122,0,18,98,0,48,0,18,118,0,59,119,0,18,98,0,48,0,0,0,0,1,0,12,2,25,1,1,0,9,97,0,0,1,1, 0,12,117,0,0,0,1,8,58,118,101,99,52,0,18,97,0,18,117,0,59,120,0,49,0,18,97,0,18,117,0,59,121,0,49,0, 18,97,0,18,117,0,59,122,0,49,0,18,97,0,18,117,0,59,119,0,49,0,0,0,0,1,0,12,2,25,1,1,0,12,118,0,0,1, 1,0,9,98,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,98,0,49,0,18,118,0,59,121,0,18,98,0,49,0, 18,118,0,59,122,0,18,98,0,49,0,18,118,0,59,119,0,18,98,0,49,0,0,0,0,1,0,13,2,29,1,1,0,9,97,0,0,1,1, 0,13,110,0,0,0,1,8,58,109,97,116,50,0,18,97,0,18,110,0,16,8,48,0,57,46,0,18,97,0,18,110,0,16,10,49, 0,57,46,0,0,0,0,1,0,13,2,29,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8, 48,0,57,18,98,0,46,0,18,109,0,16,10,49,0,57,18,98,0,46,0,0,0,0,1,0,13,2,30,1,1,0,9,97,0,0,1,1,0,13, 110,0,0,0,1,8,58,109,97,116,50,0,18,97,0,18,110,0,16,8,48,0,57,47,0,18,97,0,18,110,0,16,10,49,0,57, 47,0,0,0,0,1,0,13,2,30,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8,48,0, 57,18,98,0,47,0,18,109,0,16,10,49,0,57,18,98,0,47,0,0,0,0,1,0,13,2,24,1,1,0,9,97,0,0,1,1,0,13,110,0, 0,0,1,8,58,109,97,116,50,0,18,97,0,18,110,0,16,8,48,0,57,48,0,18,97,0,18,110,0,16,10,49,0,57,48,0,0, 0,0,1,0,13,2,24,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8,48,0,57,18, 98,0,48,0,18,109,0,16,10,49,0,57,18,98,0,48,0,0,0,0,1,0,13,2,25,1,1,0,9,97,0,0,1,1,0,13,110,0,0,0,1, 8,58,109,97,116,50,0,18,97,0,18,110,0,16,8,48,0,57,49,0,18,97,0,18,110,0,16,10,49,0,57,49,0,0,0,0,1, 0,13,2,25,1,1,0,13,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8,48,0,57,18,98,0,49, 0,18,109,0,16,10,49,0,57,18,98,0,49,0,0,0,0,1,0,14,2,29,1,1,0,9,97,0,0,1,1,0,14,110,0,0,0,1,8,58, 109,97,116,51,0,18,97,0,18,110,0,16,8,48,0,57,46,0,18,97,0,18,110,0,16,10,49,0,57,46,0,18,97,0,18, 110,0,16,10,50,0,57,46,0,0,0,0,1,0,14,2,29,1,1,0,14,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,51,0, 18,109,0,16,8,48,0,57,18,98,0,46,0,18,109,0,16,10,49,0,57,18,98,0,46,0,18,109,0,16,10,50,0,57,18,98, 0,46,0,0,0,0,1,0,14,2,30,1,1,0,9,97,0,0,1,1,0,14,110,0,0,0,1,8,58,109,97,116,51,0,18,97,0,18,110,0, 16,8,48,0,57,47,0,18,97,0,18,110,0,16,10,49,0,57,47,0,18,97,0,18,110,0,16,10,50,0,57,47,0,0,0,0,1,0, 14,2,30,1,1,0,14,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,18,98,0,47,0, 18,109,0,16,10,49,0,57,18,98,0,47,0,18,109,0,16,10,50,0,57,18,98,0,47,0,0,0,0,1,0,14,2,24,1,1,0,9, 97,0,0,1,1,0,14,110,0,0,0,1,8,58,109,97,116,51,0,18,97,0,18,110,0,16,8,48,0,57,48,0,18,97,0,18,110, 0,16,10,49,0,57,48,0,18,97,0,18,110,0,16,10,50,0,57,48,0,0,0,0,1,0,14,2,24,1,1,0,14,109,0,0,1,1,0,9, 98,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,18,98,0,48,0,18,109,0,16,10,49,0,57,18,98,0, 48,0,18,109,0,16,10,50,0,57,18,98,0,48,0,0,0,0,1,0,14,2,25,1,1,0,9,97,0,0,1,1,0,14,110,0,0,0,1,8,58, 109,97,116,51,0,18,97,0,18,110,0,16,8,48,0,57,49,0,18,97,0,18,110,0,16,10,49,0,57,49,0,18,97,0,18, 110,0,16,10,50,0,57,49,0,0,0,0,1,0,14,2,25,1,1,0,14,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,51,0, 18,109,0,16,8,48,0,57,18,98,0,49,0,18,109,0,16,10,49,0,57,18,98,0,49,0,18,109,0,16,10,50,0,57,18,98, 0,49,0,0,0,0,1,0,15,2,29,1,1,0,9,97,0,0,1,1,0,15,110,0,0,0,1,8,58,109,97,116,52,0,18,97,0,18,110,0, 16,8,48,0,57,46,0,18,97,0,18,110,0,16,10,49,0,57,46,0,18,97,0,18,110,0,16,10,50,0,57,46,0,18,97,0, 18,110,0,16,10,51,0,57,46,0,0,0,0,1,0,15,2,29,1,1,0,15,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116, 52,0,18,109,0,16,8,48,0,57,18,98,0,46,0,18,109,0,16,10,49,0,57,18,98,0,46,0,18,109,0,16,10,50,0,57, 18,98,0,46,0,18,109,0,16,10,51,0,57,18,98,0,46,0,0,0,0,1,0,15,2,30,1,1,0,9,97,0,0,1,1,0,15,110,0,0, 0,1,8,58,109,97,116,52,0,18,97,0,18,110,0,16,8,48,0,57,47,0,18,97,0,18,110,0,16,10,49,0,57,47,0,18, 97,0,18,110,0,16,10,50,0,57,47,0,18,97,0,18,110,0,16,10,51,0,57,47,0,0,0,0,1,0,15,2,30,1,1,0,15,109, 0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,52,0,18,109,0,16,8,48,0,57,18,98,0,47,0,18,109,0,16,10,49,0, 57,18,98,0,47,0,18,109,0,16,10,50,0,57,18,98,0,47,0,18,109,0,16,10,51,0,57,18,98,0,47,0,0,0,0,1,0, 15,2,24,1,1,0,9,97,0,0,1,1,0,15,110,0,0,0,1,8,58,109,97,116,52,0,18,97,0,18,110,0,16,8,48,0,57,48,0, 18,97,0,18,110,0,16,10,49,0,57,48,0,18,97,0,18,110,0,16,10,50,0,57,48,0,18,97,0,18,110,0,16,10,51,0, 57,48,0,0,0,0,1,0,15,2,24,1,1,0,15,109,0,0,1,1,0,9,98,0,0,0,1,8,58,109,97,116,52,0,18,109,0,16,8,48, 0,57,18,98,0,48,0,18,109,0,16,10,49,0,57,18,98,0,48,0,18,109,0,16,10,50,0,57,18,98,0,48,0,18,109,0, 16,10,51,0,57,18,98,0,48,0,0,0,0,1,0,15,2,25,1,1,0,9,97,0,0,1,1,0,15,110,0,0,0,1,8,58,109,97,116,52, 0,18,97,0,18,110,0,16,8,48,0,57,49,0,18,97,0,18,110,0,16,10,49,0,57,49,0,18,97,0,18,110,0,16,10,50, 0,57,49,0,18,97,0,18,110,0,16,10,51,0,57,49,0,0,0,0,1,0,15,2,25,1,1,0,15,109,0,0,1,1,0,9,98,0,0,0,1, 8,58,109,97,116,52,0,18,109,0,16,8,48,0,57,18,98,0,49,0,18,109,0,16,10,49,0,57,18,98,0,49,0,18,109, 0,16,10,50,0,57,18,98,0,49,0,18,109,0,16,10,51,0,57,18,98,0,49,0,0,0,0,1,0,6,2,29,1,1,0,5,97,0,0,1, 1,0,6,117,0,0,0,1,8,58,105,118,101,99,50,0,18,97,0,18,117,0,59,120,0,46,0,18,97,0,18,117,0,59,121,0, 46,0,0,0,0,1,0,6,2,29,1,1,0,6,118,0,0,1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0, 18,98,0,46,0,18,118,0,59,121,0,18,98,0,46,0,0,0,0,1,0,6,2,30,1,1,0,5,97,0,0,1,1,0,6,117,0,0,0,1,8, 58,105,118,101,99,50,0,18,97,0,18,117,0,59,120,0,47,0,18,97,0,18,117,0,59,121,0,47,0,0,0,0,1,0,6,2, 30,1,1,0,6,118,0,0,1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0,18,98,0,47,0,18, 118,0,59,121,0,18,98,0,47,0,0,0,0,1,0,6,2,24,1,1,0,5,97,0,0,1,1,0,6,117,0,0,0,1,8,58,105,118,101,99, 50,0,18,97,0,18,117,0,59,120,0,48,0,18,97,0,18,117,0,59,121,0,48,0,0,0,0,1,0,6,2,24,1,1,0,6,118,0,0, 1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0,18,98,0,48,0,18,118,0,59,121,0,18,98, 0,48,0,0,0,0,1,0,6,2,25,1,1,0,5,97,0,0,1,1,0,6,117,0,0,0,1,8,58,105,118,101,99,50,0,18,97,0,18,117, 0,59,120,0,49,0,18,97,0,18,117,0,59,121,0,49,0,0,0,0,1,0,6,2,25,1,1,0,6,118,0,0,1,1,0,5,98,0,0,0,1, 8,58,105,118,101,99,50,0,18,118,0,59,120,0,18,98,0,49,0,18,118,0,59,121,0,18,98,0,49,0,0,0,0,1,0,7, 2,29,1,1,0,5,97,0,0,1,1,0,7,117,0,0,0,1,8,58,105,118,101,99,51,0,18,97,0,18,117,0,59,120,0,46,0,18, 97,0,18,117,0,59,121,0,46,0,18,97,0,18,117,0,59,122,0,46,0,0,0,0,1,0,7,2,29,1,1,0,7,118,0,0,1,1,0,5, 98,0,0,0,1,8,58,105,118,101,99,51,0,18,118,0,59,120,0,18,98,0,46,0,18,118,0,59,121,0,18,98,0,46,0, 18,118,0,59,122,0,18,98,0,46,0,0,0,0,1,0,7,2,30,1,1,0,5,97,0,0,1,1,0,7,117,0,0,0,1,8,58,105,118,101, 99,51,0,18,97,0,18,117,0,59,120,0,47,0,18,97,0,18,117,0,59,121,0,47,0,18,97,0,18,117,0,59,122,0,47, 0,0,0,0,1,0,7,2,30,1,1,0,7,118,0,0,1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,51,0,18,118,0,59,120,0,18, 98,0,47,0,18,118,0,59,121,0,18,98,0,47,0,18,118,0,59,122,0,18,98,0,47,0,0,0,0,1,0,7,2,24,1,1,0,5,97, 0,0,1,1,0,7,117,0,0,0,1,8,58,105,118,101,99,51,0,18,97,0,18,117,0,59,120,0,48,0,18,97,0,18,117,0,59, 121,0,48,0,18,97,0,18,117,0,59,122,0,48,0,0,0,0,1,0,7,2,24,1,1,0,7,118,0,0,1,1,0,5,98,0,0,0,1,8,58, 105,118,101,99,51,0,18,118,0,59,120,0,18,98,0,48,0,18,118,0,59,121,0,18,98,0,48,0,18,118,0,59,122,0, 18,98,0,48,0,0,0,0,1,0,7,2,25,1,1,0,5,97,0,0,1,1,0,7,117,0,0,0,1,8,58,105,118,101,99,51,0,18,97,0, 18,117,0,59,120,0,49,0,18,97,0,18,117,0,59,121,0,49,0,18,97,0,18,117,0,59,122,0,49,0,0,0,0,1,0,7,2, 25,1,1,0,7,118,0,0,1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,51,0,18,118,0,59,120,0,18,98,0,49,0,18, 118,0,59,121,0,18,98,0,49,0,18,118,0,59,122,0,18,98,0,49,0,0,0,0,1,0,8,2,29,1,1,0,5,97,0,0,1,1,0,8, 117,0,0,0,1,8,58,105,118,101,99,52,0,18,97,0,18,117,0,59,120,0,46,0,18,97,0,18,117,0,59,121,0,46,0, 18,97,0,18,117,0,59,122,0,46,0,18,97,0,18,117,0,59,119,0,46,0,0,0,0,1,0,8,2,29,1,1,0,8,118,0,0,1,1, 0,5,98,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,18,98,0,46,0,18,118,0,59,121,0,18,98,0,46, 0,18,118,0,59,122,0,18,98,0,46,0,18,118,0,59,119,0,18,98,0,46,0,0,0,0,1,0,8,2,30,1,1,0,5,97,0,0,1,1, 0,8,117,0,0,0,1,8,58,105,118,101,99,52,0,18,97,0,18,117,0,59,120,0,47,0,18,97,0,18,117,0,59,121,0, 47,0,18,97,0,18,117,0,59,122,0,47,0,18,97,0,18,117,0,59,119,0,47,0,0,0,0,1,0,8,2,30,1,1,0,8,118,0,0, 1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,18,98,0,47,0,18,118,0,59,121,0,18,98, 0,47,0,18,118,0,59,122,0,18,98,0,47,0,18,118,0,59,119,0,18,98,0,47,0,0,0,0,1,0,8,2,24,1,1,0,5,97,0, 0,1,1,0,8,117,0,0,0,1,8,58,105,118,101,99,52,0,18,97,0,18,117,0,59,120,0,48,0,18,97,0,18,117,0,59, 121,0,48,0,18,97,0,18,117,0,59,122,0,48,0,18,97,0,18,117,0,59,119,0,48,0,0,0,0,1,0,8,2,24,1,1,0,8, 118,0,0,1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,18,98,0,48,0,18,118,0,59,121, 0,18,98,0,48,0,18,118,0,59,122,0,18,98,0,48,0,18,118,0,59,119,0,18,98,0,48,0,0,0,0,1,0,8,2,25,1,1,0, 5,97,0,0,1,1,0,8,117,0,0,0,1,8,58,105,118,101,99,52,0,18,97,0,18,117,0,59,120,0,49,0,18,97,0,18,117, 0,59,121,0,49,0,18,97,0,18,117,0,59,122,0,49,0,18,97,0,18,117,0,59,119,0,49,0,0,0,0,1,0,8,2,25,1,1, 0,8,118,0,0,1,1,0,5,98,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,18,98,0,49,0,18,118,0,59, 121,0,18,98,0,49,0,18,118,0,59,122,0,18,98,0,49,0,18,118,0,59,119,0,18,98,0,49,0,0,0,0,1,0,10,2,24, 1,1,0,10,118,0,0,1,1,0,10,117,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59,120,0,48,0, 18,118,0,59,121,0,18,117,0,59,121,0,48,0,0,0,0,1,0,11,2,24,1,1,0,11,118,0,0,1,1,0,11,117,0,0,0,1,8, 58,118,101,99,51,0,18,118,0,59,120,0,18,117,0,59,120,0,48,0,18,118,0,59,121,0,18,117,0,59,121,0,48, 0,18,118,0,59,122,0,18,117,0,59,122,0,48,0,0,0,0,1,0,12,2,24,1,1,0,12,118,0,0,1,1,0,12,117,0,0,0,1, 8,58,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,48,0,18,118,0,59,121,0,18,117,0,59,121,0, 48,0,18,118,0,59,122,0,18,117,0,59,122,0,48,0,18,118,0,59,119,0,18,117,0,59,119,0,48,0,0,0,0,1,0,6, 2,24,1,1,0,6,118,0,0,1,1,0,6,117,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0,18,117,0,59,120, 0,48,0,18,118,0,59,121,0,18,117,0,59,121,0,48,0,0,0,0,1,0,7,2,24,1,1,0,7,118,0,0,1,1,0,7,117,0,0,0, 1,8,58,105,118,101,99,51,0,18,118,0,59,120,0,18,117,0,59,120,0,48,0,18,118,0,59,121,0,18,117,0,59, 121,0,48,0,18,118,0,59,122,0,18,117,0,59,122,0,48,0,0,0,0,1,0,8,2,24,1,1,0,8,118,0,0,1,1,0,8,117,0, 0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,48,0,18,118,0,59,121,0,18,117,0, 59,121,0,48,0,18,118,0,59,122,0,18,117,0,59,122,0,48,0,18,118,0,59,119,0,18,117,0,59,119,0,48,0,0,0, 0,1,0,10,2,25,1,1,0,10,118,0,0,1,1,0,10,117,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,18,117,0, 59,120,0,49,0,18,118,0,59,121,0,18,117,0,59,121,0,49,0,0,0,0,1,0,11,2,25,1,1,0,11,118,0,0,1,1,0,11, 117,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,18,117,0,59,120,0,49,0,18,118,0,59,121,0,18,117, 0,59,121,0,49,0,18,118,0,59,122,0,18,117,0,59,122,0,49,0,0,0,0,1,0,12,2,25,1,1,0,12,118,0,0,1,1,0, 12,117,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,49,0,18,118,0,59,121,0,18, 117,0,59,121,0,49,0,18,118,0,59,122,0,18,117,0,59,122,0,49,0,18,118,0,59,119,0,18,117,0,59,119,0,49, 0,0,0,0,1,0,6,2,25,1,1,0,6,118,0,0,1,1,0,6,117,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0, 18,117,0,59,120,0,49,0,18,118,0,59,121,0,18,117,0,59,121,0,49,0,0,0,0,1,0,7,2,25,1,1,0,7,118,0,0,1, 1,0,7,117,0,0,0,1,8,58,105,118,101,99,51,0,18,118,0,59,120,0,18,117,0,59,120,0,49,0,18,118,0,59,121, 0,18,117,0,59,121,0,49,0,18,118,0,59,122,0,18,117,0,59,122,0,49,0,0,0,0,1,0,8,2,25,1,1,0,8,118,0,0, 1,1,0,8,117,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,18,117,0,59,120,0,49,0,18,118,0,59, 121,0,18,117,0,59,121,0,49,0,18,118,0,59,122,0,18,117,0,59,122,0,49,0,18,118,0,59,119,0,18,117,0,59, 119,0,49,0,0,0,0,1,0,13,2,25,1,1,0,13,109,0,0,1,1,0,13,110,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16, 8,48,0,57,18,110,0,16,8,48,0,57,49,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,49,0,0,0,0,1,0, 14,2,25,1,1,0,14,109,0,0,1,1,0,14,110,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,18,110,0, 16,8,48,0,57,49,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,49,0,18,109,0,16,10,50,0,57,18,110, 0,16,10,50,0,57,49,0,0,0,0,1,0,15,2,25,1,1,0,15,109,0,0,1,1,0,15,110,0,0,0,1,8,58,109,97,116,52,0, 18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,49,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,49,0, 18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,49,0,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,49, 0,0,0,0,1,0,10,2,30,1,1,0,10,118,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,54,0,18,118,0,59, 121,0,54,0,0,0,0,1,0,11,2,30,1,1,0,11,118,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,54,0,18, 118,0,59,121,0,54,0,18,118,0,59,122,0,54,0,0,0,0,1,0,12,2,30,1,1,0,12,118,0,0,0,1,8,58,118,101,99, 52,0,18,118,0,59,120,0,54,0,18,118,0,59,121,0,54,0,18,118,0,59,122,0,54,0,18,118,0,59,119,0,54,0,0, 0,0,1,0,6,2,30,1,1,0,6,118,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0,54,0,18,118,0,59,121, 0,54,0,0,0,0,1,0,7,2,30,1,1,0,7,118,0,0,0,1,8,58,105,118,101,99,51,0,18,118,0,59,120,0,54,0,18,118, 0,59,121,0,54,0,18,118,0,59,122,0,54,0,0,0,0,1,0,8,2,30,1,1,0,8,118,0,0,0,1,8,58,105,118,101,99,52, 0,18,118,0,59,120,0,54,0,18,118,0,59,121,0,54,0,18,118,0,59,122,0,54,0,18,118,0,59,119,0,54,0,0,0,0, 1,0,13,2,30,1,1,0,13,109,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8,48,0,57,54,0,18,109,0,16,10,49, 0,57,54,0,0,0,0,1,0,14,2,30,1,1,0,14,109,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,54,0,18, 109,0,16,10,49,0,57,54,0,18,109,0,16,10,50,0,57,54,0,0,0,0,1,0,15,2,30,1,1,0,15,109,0,0,0,1,8,58, 109,97,116,52,0,18,109,0,16,8,48,0,57,54,0,18,109,0,16,10,49,0,57,54,0,18,109,0,16,10,50,0,57,54,0, 18,109,0,16,10,51,0,57,54,0,0,0,0,1,0,0,2,28,1,0,2,9,97,0,0,0,1,9,18,97,0,17,49,0,48,0,0,22,0,0,1,0, 0,2,28,1,0,2,5,97,0,0,0,1,9,18,97,0,16,10,49,0,22,0,0,1,0,0,2,28,1,0,2,10,118,0,0,0,1,9,18,118,0,59, 120,0,52,18,118,0,59,121,0,52,19,0,0,1,0,0,2,28,1,0,2,11,118,0,0,0,1,9,18,118,0,59,120,0,52,18,118, 0,59,121,0,52,19,18,118,0,59,122,0,52,19,0,0,1,0,0,2,28,1,0,2,12,118,0,0,0,1,9,18,118,0,59,120,0,52, 18,118,0,59,121,0,52,19,18,118,0,59,122,0,52,19,18,118,0,59,119,0,52,19,0,0,1,0,0,2,28,1,0,2,6,118, 0,0,0,1,9,18,118,0,59,120,0,52,18,118,0,59,121,0,52,19,0,0,1,0,0,2,28,1,0,2,7,118,0,0,0,1,9,18,118, 0,59,120,0,52,18,118,0,59,121,0,52,19,18,118,0,59,122,0,52,19,0,0,1,0,0,2,28,1,0,2,8,118,0,0,0,1,9, 18,118,0,59,120,0,52,18,118,0,59,121,0,52,19,18,118,0,59,122,0,52,19,18,118,0,59,119,0,52,19,0,0,1, 0,0,2,28,1,0,2,13,109,0,0,0,1,9,18,109,0,16,8,48,0,57,52,18,109,0,16,10,49,0,57,52,19,0,0,1,0,0,2, 28,1,0,2,14,109,0,0,0,1,9,18,109,0,16,8,48,0,57,52,18,109,0,16,10,49,0,57,52,19,18,109,0,16,10,50,0, 57,52,19,0,0,1,0,0,2,28,1,0,2,15,109,0,0,0,1,9,18,109,0,16,8,48,0,57,52,18,109,0,16,10,49,0,57,52, 19,18,109,0,16,10,50,0,57,52,19,18,109,0,16,10,51,0,57,52,19,0,0,1,0,0,2,27,1,0,2,9,97,0,0,0,1,9,18, 97,0,17,49,0,48,0,0,21,0,0,1,0,0,2,27,1,0,2,5,97,0,0,0,1,9,18,97,0,16,10,49,0,21,0,0,1,0,0,2,27,1,0, 2,10,118,0,0,0,1,9,18,118,0,59,120,0,51,18,118,0,59,121,0,51,19,0,0,1,0,0,2,27,1,0,2,11,118,0,0,0,1, 9,18,118,0,59,120,0,51,18,118,0,59,121,0,51,19,18,118,0,59,122,0,51,19,0,0,1,0,0,2,27,1,0,2,12,118, 0,0,0,1,9,18,118,0,59,120,0,51,18,118,0,59,121,0,51,19,18,118,0,59,122,0,51,19,18,118,0,59,119,0,51, 19,0,0,1,0,0,2,27,1,0,2,6,118,0,0,0,1,9,18,118,0,59,120,0,51,18,118,0,59,121,0,51,19,0,0,1,0,0,2,27, 1,0,2,7,118,0,0,0,1,9,18,118,0,59,120,0,51,18,118,0,59,121,0,51,19,18,118,0,59,122,0,51,19,0,0,1,0, 0,2,27,1,0,2,8,118,0,0,0,1,9,18,118,0,59,120,0,51,18,118,0,59,121,0,51,19,18,118,0,59,122,0,51,19, 18,118,0,59,119,0,51,19,0,0,1,0,0,2,27,1,0,2,13,109,0,0,0,1,9,18,109,0,16,8,48,0,57,51,18,109,0,16, 10,49,0,57,51,19,0,0,1,0,0,2,27,1,0,2,14,109,0,0,0,1,9,18,109,0,16,8,48,0,57,51,18,109,0,16,10,49,0, 57,51,19,18,109,0,16,10,50,0,57,51,19,0,0,1,0,0,2,27,1,0,2,15,109,0,0,0,1,9,18,109,0,16,8,48,0,57, 51,18,109,0,16,10,49,0,57,51,19,18,109,0,16,10,50,0,57,51,19,18,109,0,16,10,51,0,57,51,19,0,0,1,0,9, 2,28,1,0,2,9,97,0,0,1,1,0,5,0,0,0,1,3,2,0,9,1,99,0,0,0,9,18,99,0,18,97,0,20,0,9,18,97,0,52,0,8,18, 99,0,0,0,1,0,5,2,28,1,0,2,5,97,0,0,1,1,0,5,0,0,0,1,3,2,0,5,1,99,0,0,0,9,18,99,0,18,97,0,20,0,9,18, 97,0,52,0,8,18,99,0,0,0,1,0,10,2,28,1,0,2,10,118,0,0,1,1,0,5,0,0,0,1,8,58,118,101,99,50,0,18,118,0, 59,120,0,61,0,18,118,0,59,121,0,61,0,0,0,0,1,0,11,2,28,1,0,2,11,118,0,0,1,1,0,5,0,0,0,1,8,58,118, 101,99,51,0,18,118,0,59,120,0,61,0,18,118,0,59,121,0,61,0,18,118,0,59,122,0,61,0,0,0,0,1,0,12,2,28, 1,0,2,12,118,0,0,1,1,0,5,0,0,0,1,8,58,118,101,99,52,0,18,118,0,59,120,0,61,0,18,118,0,59,121,0,61,0, 18,118,0,59,122,0,61,0,18,118,0,59,119,0,61,0,0,0,0,1,0,6,2,28,1,0,2,6,118,0,0,1,1,0,5,0,0,0,1,8,58, 105,118,101,99,50,0,18,118,0,59,120,0,61,0,18,118,0,59,121,0,61,0,0,0,0,1,0,7,2,28,1,0,2,7,118,0,0, 1,1,0,5,0,0,0,1,8,58,105,118,101,99,51,0,18,118,0,59,120,0,61,0,18,118,0,59,121,0,61,0,18,118,0,59, 122,0,61,0,0,0,0,1,0,8,2,28,1,0,2,8,118,0,0,1,1,0,5,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59, 120,0,61,0,18,118,0,59,121,0,61,0,18,118,0,59,122,0,61,0,18,118,0,59,119,0,61,0,0,0,0,1,0,13,2,28,1, 0,2,13,109,0,0,1,1,0,5,0,0,0,1,8,58,109,97,116,50,0,18,109,0,16,8,48,0,57,61,0,18,109,0,16,10,49,0, 57,61,0,0,0,0,1,0,14,2,28,1,0,2,14,109,0,0,1,1,0,5,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0, 57,61,0,18,109,0,16,10,49,0,57,61,0,18,109,0,16,10,50,0,57,61,0,0,0,0,1,0,15,2,28,1,0,2,15,109,0,0, 1,1,0,5,0,0,0,1,8,58,109,97,116,52,0,18,109,0,16,8,48,0,57,61,0,18,109,0,16,10,49,0,57,61,0,18,109, 0,16,10,50,0,57,61,0,18,109,0,16,10,51,0,57,61,0,0,0,0,1,0,9,2,27,1,0,2,9,97,0,0,1,1,0,5,0,0,0,1,3, 2,0,9,1,99,0,0,0,9,18,99,0,18,97,0,20,0,9,18,97,0,51,0,8,18,99,0,0,0,1,0,5,2,27,1,0,2,5,97,0,0,1,1, 0,5,0,0,0,1,3,2,0,5,1,99,0,0,0,9,18,99,0,18,97,0,20,0,9,18,97,0,51,0,8,18,99,0,0,0,1,0,10,2,27,1,0, 2,10,118,0,0,1,1,0,5,0,0,0,1,8,58,118,101,99,50,0,18,118,0,59,120,0,60,0,18,118,0,59,121,0,60,0,0,0, 0,1,0,11,2,27,1,0,2,11,118,0,0,1,1,0,5,0,0,0,1,8,58,118,101,99,51,0,18,118,0,59,120,0,60,0,18,118,0, 59,121,0,60,0,18,118,0,59,122,0,60,0,0,0,0,1,0,12,2,27,1,0,2,12,118,0,0,1,1,0,5,0,0,0,1,8,58,118, 101,99,52,0,18,118,0,59,120,0,60,0,18,118,0,59,121,0,60,0,18,118,0,59,122,0,60,0,18,118,0,59,119,0, 60,0,0,0,0,1,0,6,2,27,1,0,2,6,118,0,0,1,1,0,5,0,0,0,1,8,58,105,118,101,99,50,0,18,118,0,59,120,0,60, 0,18,118,0,59,121,0,60,0,0,0,0,1,0,7,2,27,1,0,2,7,118,0,0,1,1,0,5,0,0,0,1,8,58,105,118,101,99,51,0, 18,118,0,59,120,0,60,0,18,118,0,59,121,0,60,0,18,118,0,59,122,0,60,0,0,0,0,1,0,8,2,27,1,0,2,8,118,0, 0,1,1,0,5,0,0,0,1,8,58,105,118,101,99,52,0,18,118,0,59,120,0,60,0,18,118,0,59,121,0,60,0,18,118,0, 59,122,0,60,0,18,118,0,59,119,0,60,0,0,0,0,1,0,13,2,27,1,0,2,13,109,0,0,1,1,0,5,0,0,0,1,8,58,109,97, 116,50,0,18,109,0,16,8,48,0,57,60,0,18,109,0,16,10,49,0,57,60,0,0,0,0,1,0,14,2,27,1,0,2,14,109,0,0, 1,1,0,5,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,60,0,18,109,0,16,10,49,0,57,60,0,18,109, 0,16,10,50,0,57,60,0,0,0,0,1,0,15,2,27,1,0,2,15,109,0,0,1,1,0,5,0,0,0,1,8,58,109,97,116,52,0,18,109, 0,16,8,48,0,57,60,0,18,109,0,16,10,49,0,57,60,0,18,109,0,16,10,50,0,57,60,0,18,109,0,16,10,51,0,57, 60,0,0,0,0,1,0,1,2,18,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,3,2,0,1,1,99,0,0,0,4,102,108,111,97,116,95, 108,101,115,115,0,18,99,0,0,18,97,0,0,18,98,0,0,0,8,18,99,0,0,0,1,0,1,2,18,1,1,0,5,97,0,0,1,1,0,5, 98,0,0,0,1,8,58,102,108,111,97,116,0,18,97,0,0,0,58,102,108,111,97,116,0,18,98,0,0,0,40,0,0,1,0,1,2, 19,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,8,18,98,0,18,97,0,40,0,0,1,0,1,2,19,1,1,0,5,97,0,0,1,1,0,5,98, 0,0,0,1,8,18,98,0,18,97,0,40,0,0,1,0,1,2,21,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,8,18,97,0,18,98,0,41, 18,97,0,18,98,0,38,32,0,0,1,0,1,2,21,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,8,18,97,0,18,98,0,41,18,97,0, 18,98,0,38,32,0,0,1,0,1,2,20,1,1,0,9,97,0,0,1,1,0,9,98,0,0,0,1,8,18,97,0,18,98,0,40,18,97,0,18,98,0, 38,32,0,0,1,0,1,2,20,1,1,0,5,97,0,0,1,1,0,5,98,0,0,0,1,8,18,97,0,18,98,0,40,18,97,0,18,98,0,38,32,0, 0,1,0,1,2,12,1,1,0,1,97,0,0,1,1,0,1,98,0,0,0,1,8,18,97,0,18,98,0,39,0,0,1,0,1,2,32,1,1,0,1,97,0,0,0, 1,8,18,97,0,15,2,48,0,38,0,0,0nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_core_gc.h0000644000000000000000000010665113614532424024202 0ustar "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "int __constructor (const float _f) {\n" " int _i;\n" " __asm float_to_int _i, _f;\n" " return _i;\n" "}\n" "\n" "bool __constructor (const int _i) {\n" " return _i != 0;\n" "}\n" "\n" "bool __constructor (const float _f) {\n" " return _f != 0.0;\n" "}\n" "\n" "int __constructor (const bool _b) {\n" " return _b ? 1 : 0;\n" "}\n" "\n" "float __constructor (const bool _b) {\n" " return _b ? 1.0 : 0.0;\n" "}\n" "\n" "float __constructor (const int _i) {\n" " float _f;\n" " __asm int_to_float _f, _i;\n" " return _f;\n" "}\n" "\n" "bool __constructor (const bool _b) {\n" " return _b;\n" "}\n" "\n" "int __constructor (const int _i) {\n" " return _i;\n" "}\n" "\n" "float __constructor (const float _f) {\n" " return _f;\n" "}\n" "\n" "vec2 __constructor (const float _f) {\n" " return vec2 (_f, _f);\n" "}\n" "\n" "vec2 __constructor (const int _i) {\n" " return vec2 (_i, _i);\n" "}\n" "\n" "vec2 __constructor (const bool _b) {\n" " return vec2 (_b, _b);\n" "}\n" "\n" "vec3 __constructor (const float _f) {\n" " return vec3 (_f, _f, _f);\n" "}\n" "\n" "vec3 __constructor (const int _i) {\n" " return vec3 (_i, _i, _i);\n" "}\n" "\n" "vec3 __constructor (const bool _b) {\n" " return vec3 (_b, _b, _b);\n" "}\n" "\n" "vec4 __constructor (const float _f) {\n" " return vec4 (_f, _f, _f, _f);\n" "}\n" "\n" "vec4 __constructor (const int _i) {\n" " return vec4 (_i, _i, _i, _i);\n" "}\n" "\n" "vec4 __constructor (const bool _b) {\n" " return vec4 (_b, _b, _b, _b);\n" "}\n" "\n" "ivec2 __constructor (const int _i) {\n" " return ivec2 (_i, _i);\n" "}\n" "\n" "ivec2 __constructor (const float _f) {\n" " return ivec2 (_f, _f);\n" "}\n" "\n" "ivec2 __constructor (const bool _b) {\n" " return ivec2 (_b, _b);\n" "}\n" "\n" "ivec3 __constructor (const int _i) {\n" " return ivec3 (_i, _i, _i);\n" "}\n" "\n" "ivec3 __constructor (const float _f) {\n" " return ivec3 (_f, _f, _f);\n" "}\n" "\n" "ivec3 __constructor (const bool _b) {\n" " return ivec3 (_b, _b, _b);\n" "}\n" "\n" "ivec4 __constructor (const int _i) {\n" " return ivec4 (_i, _i, _i, _i);\n" "}\n" "\n" "ivec4 __constructor (const float _f) {\n" " return ivec4 (_f, _f, _f, _f);\n" "}\n" "\n" "ivec4 __constructor (const bool _b) {\n" " return ivec4 (_b, _b, _b, _b);\n" "}\n" "\n" "bvec2 __constructor (const bool _b) {\n" " return bvec2 (_b, _b);\n" "}\n" "\n" "bvec2 __constructor (const float _f) {\n" " return bvec2 (_f, _f);\n" "}\n" "\n" "bvec2 __constructor (const int _i) {\n" " return bvec2 (_i, _i);\n" "}\n" "\n" "bvec3 __constructor (const bool _b) {\n" " return bvec3 (_b, _b, _b);\n" "}\n" "\n" "bvec3 __constructor (const float _f) {\n" " return bvec3 (_f, _f, _f);\n" "}\n" "\n" "bvec3 __constructor (const int _i) {\n" " return bvec3 (_i, _i, _i);\n" "}\n" "\n" "bvec4 __constructor (const bool _b) {\n" " return bvec4 (_b, _b, _b, _b);\n" "}\n" "\n" "bvec4 __constructor (const float _f) {\n" " return bvec4 (_f, _f, _f, _f);\n" "}\n" "\n" "bvec4 __constructor (const int _i) {\n" " return bvec4 (_i, _i, _i, _i);\n" "}\n" "\n" "mat2 __constructor (const float _f) {\n" " return mat2 (\n" " _f, .0,\n" " .0, _f\n" " );\n" "}\n" "\n" "mat2 __constructor (const int _i) {\n" " return mat2 (\n" " _i, .0,\n" " .0, _i\n" " );\n" "}\n" "\n" "mat2 __constructor (const bool _b) {\n" " return mat2 (\n" " _b, .0,\n" " .0, _b\n" " );\n" "}\n" "\n" "mat3 __constructor (const float _f) {\n" " return mat3 (\n" " _f, .0, .0,\n" " .0, _f, .0,\n" " .0, .0, _f\n" " );\n" "}\n" "\n" "mat3 __constructor (const int _i) {\n" " return mat3 (\n" " _i, .0, .0,\n" " .0, _i, .0,\n" " .0, .0, _i\n" " );\n" "}\n" "\n" "mat3 __constructor (const bool _b) {\n" " return mat3 (\n" " _b, .0, .0,\n" " .0, _b, .0,\n" " .0, .0, _b\n" " );\n" "}\n" "\n" "mat4 __constructor (const float _f) {\n" " return mat4 (\n" " _f, .0, .0, .0,\n" " .0, _f, .0, .0,\n" " .0, .0, _f, .0,\n" " .0, .0, .0, _f\n" " );\n" "}\n" "\n" "mat4 __constructor (const int _i) {\n" " return mat4 (\n" " _i, .0, .0, .0,\n" " .0, _i, .0, .0,\n" " .0, .0, _i, .0,\n" " .0, .0, .0, _i\n" " );\n" "}\n" "\n" "mat4 __constructor (const bool _b) {\n" " return mat4 (\n" " _b, .0, .0, .0,\n" " .0, _b, .0, .0,\n" " .0, .0, _b, .0,\n" " .0, .0, .0, _b\n" " );\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "void __operator += (inout float a, const float b) {\n" " __asm float_add a, a, b;\n" "}\n" "\n" "float __operator - (const float a) {\n" " float c;\n" " __asm float_negate c, a;\n" " return c;\n" "}\n" "\n" "void __operator -= (inout float a, const float b) {\n" " a += -b;\n" "}\n" "\n" "void __operator *= (inout float a, const float b) {\n" " __asm float_multiply a, a, b;\n" "}\n" "\n" "void __operator /= (inout float a, const float b) {\n" " __asm float_divide a, a, b;\n" "}\n" "\n" "float __operator + (const float a, const float b) {\n" " float c;\n" " c = a;\n" " return c += b;\n" "}\n" "\n" "void __operator += (inout int a, const int b) {\n" " a = int (float (a) + float (b));\n" "}\n" "\n" "int __operator - (const int a) {\n" " return int (-float (a));\n" "}\n" "\n" "void __operator -= (inout int a, const int b) {\n" " a += -b;\n" "}\n" "\n" "float __operator * (const float a, const float b) {\n" " float c;\n" " c = a;\n" " return c *= b;\n" "}\n" "\n" "void __operator *= (inout int a, const int b) {\n" " a = int (float (a) * float (b));\n" "}\n" "\n" "float __operator / (const float a, const float b) {\n" " float c;\n" " c = a;\n" " return c /= b;\n" "}\n" "\n" "void __operator /= (inout int a, const int b) {\n" " a = int (float (a) / float (b));\n" "}\n" "\n" "void __operator += (inout vec2 v, const vec2 u) {\n" " v.x += u.x, v.y += u.y;\n" "}\n" "\n" "void __operator -= (inout vec2 v, const vec2 u) {\n" " v.x -= u.x, v.y -= u.y;\n" "}\n" "\n" "void __operator *= (inout vec2 v, const vec2 u) {\n" " v.x *= u.x, v.y *= u.y;\n" "}\n" "\n" "void __operator /= (inout vec2 v, const vec2 u) {\n" " v.x /= u.x, v.y /= u.y;\n" "}\n" "\n" "void __operator += (inout vec3 v, const vec3 u) {\n" " v.x += u.x, v.y += u.y, v.z += u.z;\n" "}\n" "\n" "void __operator -= (inout vec3 v, const vec3 u) {\n" " v.x -= u.x, v.y -= u.y, v.z -= u.z;\n" "}\n" "\n" "void __operator *= (inout vec3 v, const vec3 u) {\n" " v.x *= u.x, v.y *= u.y, v.z *= u.z;\n" "}\n" "\n" "void __operator /= (inout vec3 v, const vec3 u) {\n" " v.x /= u.x, v.y /= u.y, v.z /= u.z;\n" "}\n" "\n" "void __operator += (inout vec4 v, const vec4 u) {\n" " v.x += u.x, v.y += u.y, v.z += u.z, v.w += u.w;\n" "}\n" "\n" "void __operator -= (inout vec4 v, const vec4 u) {\n" " v.x -= u.x, v.y -= u.y, v.z -= u.z, v.w -= u.w;\n" "}\n" "\n" "void __operator *= (inout vec4 v, const vec4 u) {\n" " v.x *= u.x, v.y *= u.y, v.z *= u.z, v.w *= u.w;\n" "}\n" "\n" "void __operator /= (inout vec4 v, const vec4 u) {\n" " v.x /= u.x, v.y /= u.y, v.z /= u.z, v.w /= u.w;\n" "}\n" "\n" "void __operator += (inout ivec2 v, const ivec2 u) {\n" " v.x += u.x, v.y += u.y;\n" "}\n" "\n" "void __operator -= (inout ivec2 v, const ivec2 u) {\n" " v.x -= u.x, v.y -= u.y;\n" "}\n" "\n" "void __operator *= (inout ivec2 v, const ivec2 u) {\n" " v.x *= u.x, v.y *= u.y;\n" "}\n" "\n" "void __operator /= (inout ivec2 v, const ivec2 u) {\n" " v.x /= u.x, v.y /= u.y;\n" "}\n" "\n" "void __operator += (inout ivec3 v, const ivec3 u) {\n" " v.x += u.x, v.y += u.y, v.z += u.z;\n" "}\n" "\n" "void __operator -= (inout ivec3 v, const ivec3 u) {\n" " v.x -= u.x, v.y -= u.y, v.z -= u.z;\n" "}\n" "\n" "void __operator *= (inout ivec3 v, const ivec3 u) {\n" " v.x *= u.x, v.y *= u.y, v.z *= u.z;\n" "}\n" "\n" "void __operator /= (inout ivec3 v, const ivec3 u) {\n" " v.x /= u.x, v.y /= u.y, v.z /= u.z;\n" "}\n" "\n" "void __operator += (inout ivec4 v, const ivec4 u) {\n" " v.x += u.x, v.y += u.y, v.z += u.z, v.w += u.w;\n" "}\n" "\n" "void __operator -= (inout ivec4 v, const ivec4 u) {\n" " v.x -= u.x, v.y -= u.y, v.z -= u.z, v.w -= u.w;\n" "}\n" "\n" "void __operator *= (inout ivec4 v, const ivec4 u) {\n" " v.x *= u.x, v.y *= u.y, v.z *= u.z, v.w *= u.w;\n" "}\n" "\n" "void __operator /= (inout ivec4 v, const ivec4 u) {\n" " v.x /= u.x, v.y /= u.y, v.z /= u.z, v.w /= u.w;\n" "}\n" "\n" "void __operator += (inout mat2 m, const mat2 n) {\n" " m[0] += n[0], m[1] += n[1];\n" "}\n" "\n" "void __operator -= (inout mat2 m, const mat2 n) {\n" " m[0] -= n[0], m[1] -= n[1];\n" "}\n" "\n" "vec2 __operator * (const mat2 m, const vec2 v) {\n" " return vec2 (\n" " v.x * m[0].x + v.y * m[1].x,\n" " v.x * m[0].y + v.y * m[1].y\n" " );\n" "}\n" "\n" "mat2 __operator * (const mat2 m, const mat2 n) {\n" " return mat2 (m * n[0], m * n[1]);\n" "}\n" "\n" "void __operator *= (inout mat2 m, const mat2 n) {\n" " m = m * n;\n" "}\n" "\n" "void __operator /= (inout mat2 m, const mat2 n) {\n" " m[0] /= n[0], m[1] /= n[1];\n" "}\n" "\n" "void __operator += (inout mat3 m, const mat3 n) {\n" " m[0] += n[0], m[1] += n[1], m[2] += n[2];\n" "}\n" "\n" "void __operator -= (inout mat3 m, const mat3 n) {\n" " m[0] -= n[0], m[1] -= n[1], m[2] -= n[2];\n" "}\n" "\n" "vec3 __operator * (const mat3 m, const vec3 v) {\n" " return vec3 (\n" " v.x * m[0].x + v.y * m[1].x + v.z * m[2].x,\n" " v.x * m[0].y + v.y * m[1].y + v.z * m[2].y,\n" " v.x * m[0].z + v.y * m[1].z + v.z * m[2].z\n" " );\n" "}\n" "\n" "mat3 __operator * (const mat3 m, const mat3 n) {\n" " return mat3 (m * n[0], m * n[1], m * n[2]);\n" "}\n" "\n" "void __operator *= (inout mat3 m, const mat3 n) {\n" " m = m * n;\n" "}\n" "\n" "void __operator /= (inout mat3 m, const mat3 n) {\n" " m[0] /= n[0], m[1] /= n[1], m[2] /= n[2];\n" "}\n" "\n" "void __operator += (inout mat4 m, const mat4 n) {\n" " m[0] += n[0], m[1] += n[1], m[2] += n[2], m[3] += n[3];\n" "}\n" "\n" "void __operator -= (inout mat4 m, const mat4 n) {\n" " m[0] -= n[0], m[1] -= n[1], m[2] -= n[2], m[3] -= n[3];\n" "}\n" "\n" "vec4 __operator * (const mat4 m, const vec4 v) {\n" " return vec4 (\n" " v.x * m[0].x + v.y * m[1].x + v.z * m[2].x + v.w * m[3].x,\n" " v.x * m[0].y + v.y * m[1].y + v.z * m[2].y + v.w * m[3].y,\n" " v.x * m[0].z + v.y * m[1].z + v.z * m[2].z + v.w * m[3].z,\n" " v.x * m[0].w + v.y * m[1].w + v.z * m[2].w + v.w * m[3].w\n" " );\n" "}\n" "\n" "mat4 __operator * (const mat4 m, const mat4 n) {\n" " return mat4 (m * n[0], m * n[1], m * n[2], m * n[3]);\n" "}\n" "\n" "void __operator *= (inout mat4 m, const mat4 n) {\n" " m = m * n;\n" "}\n" "\n" "void __operator /= (inout mat4 m, const mat4 n) {\n" " m[0] /= n[0], m[1] /= n[1], m[2] /= n[2], m[3] /= n[3];\n" "}\n" "\n" "void __operator += (inout vec2 v, const float a) {\n" " v.x += a, v.y += a;\n" "}\n" "\n" "void __operator -= (inout vec2 v, const float a) {\n" " v.x -= a, v.y -= a;\n" "}\n" "\n" "void __operator *= (inout vec2 v, const float a) {\n" " v.x *= a, v.y *= a;\n" "}\n" "\n" "void __operator /= (inout vec2 v, const float a) {\n" " v.x /= a, v.y /= a;\n" "}\n" "\n" "void __operator += (inout vec3 v, const float a) {\n" " v.x += a, v.y += a, v.z += a;\n" "}\n" "\n" "void __operator -= (inout vec3 v, const float a) {\n" " v.x -= a, v.y -= a, v.z -= a;\n" "}\n" "\n" "void __operator *= (inout vec3 v, const float a) {\n" " v.x *= a, v.y *= a, v.z *= a;\n" "}\n" "\n" "void __operator /= (inout vec3 v, const float a) {\n" " v.x /= a, v.y /= a, v.z /= a;\n" "}\n" "\n" "void __operator += (inout vec4 v, const float a) {\n" " v.x += a, v.y += a, v.z += a, v.w += a;\n" "}\n" "\n" "void __operator -= (inout vec4 v, const float a) {\n" " v.x -= a, v.y -= a, v.z -= a, v.w -= a;\n" "}\n" "\n" "void __operator *= (inout vec4 v, const float a) {\n" " v.x *= a, v.y *= a, v.z *= a, v.w *= a;\n" "}\n" "\n" "void __operator /= (inout vec4 v, const float a) {\n" " v.x /= a, v.y /= a, v.z /= a, v.w /= a;\n" "}\n" "\n" "void __operator += (inout mat2 m, const float a) {\n" " m[0] += a, m[1] += a;\n" "}\n" "\n" "void __operator -= (inout mat2 m, const float a) {\n" " m[0] -= a, m[1] -= a;\n" "}\n" "\n" "void __operator *= (inout mat2 m, const float a) {\n" " m[0] *= a, m[1] *= a;\n" "}\n" "\n" "void __operator /= (inout mat2 m, const float a) {\n" " m[0] /= a, m[1] /= a;\n" "}\n" "\n" "void __operator += (inout mat3 m, const float a) {\n" " m[0] += a, m[1] += a, m[2] += a;\n" "}\n" "\n" "void __operator -= (inout mat3 m, const float a) {\n" " m[0] -= a, m[1] -= a, m[2] -= a;\n" "}\n" "\n" "void __operator *= (inout mat3 m, const float a) {\n" " m[0] *= a, m[1] *= a, m[2] *= a;\n" "}\n" "\n" "void __operator /= (inout mat3 m, const float a) {\n" " m[0] /= a, m[1] /= a, m[2] /= a;\n" "}\n" "\n" "void __operator += (inout mat4 m, const float a) {\n" " m[0] += a, m[1] += a, m[2] += a, m[3] += a;\n" "}\n" "\n" "void __operator -= (inout mat4 m, const float a) {\n" " m[0] -= a, m[1] -= a, m[2] -= a, m[3] -= a;\n" "}\n" "\n" "void __operator *= (inout mat4 m, const float a) {\n" " m[0] *= a, m[1] *= a, m[2] *= a, m[3] *= a;\n" "}\n" "\n" "void __operator /= (inout mat4 m, const float a) {\n" " m[0] /= a, m[1] /= a, m[2] /= a, m[3] /= a;\n" "}\n" "\n" "vec2 __operator * (const vec2 v, const mat2 m) {\n" " return vec2 (\n" " v.x * m[0].x + v.y * m[0].y,\n" " v.x * m[1].x + v.y * m[1].y\n" " );\n" "}\n" "\n" "void __operator *= (inout vec2 v, const mat2 m) {\n" " v = v * m;\n" "}\n" "\n" "vec3 __operator * (const vec3 v, const mat3 m) {\n" " return vec3 (\n" " v.x * m[0].x + v.y * m[0].y + v.z * m[0].z,\n" " v.x * m[1].x + v.y * m[1].y + v.z * m[1].z,\n" " v.x * m[2].x + v.y * m[2].y + v.z * m[2].z\n" " );\n" "}\n" "\n" "void __operator *= (inout vec3 v, const mat3 m) {\n" " v = v * m;\n" "}\n" "\n" "vec4 __operator * (const vec4 v, const mat4 m) {\n" " return vec4 (\n" " v.x * m[0].x + v.y * m[0].y + v.z * m[0].z + v.w * m[0].w,\n" " v.x * m[1].x + v.y * m[1].y + v.z * m[1].z + v.w * m[1].w,\n" " v.x * m[2].x + v.y * m[2].y + v.z * m[2].z + v.w * m[2].w,\n" " v.x * m[3].x + v.y * m[3].y + v.z * m[3].z + v.w * m[3].w\n" " );\n" "}\n" "\n" "void __operator *= (inout vec4 v, const mat4 m) {\n" " v = v * m;\n" "}\n" "\n" "float __operator - (const float a, const float b) {\n" " return a + -b;\n" "}\n" "\n" "int __operator + (const int a, const int b) {\n" " int c;\n" " c = a;\n" " return c += b;\n" "}\n" "\n" "int __operator - (const int a, const int b) {\n" " return a + -b;\n" "}\n" "\n" "int __operator * (const int a, const int b) {\n" " int c;\n" " return (c = a) *= b;\n" "}\n" "\n" "int __operator / (const int a, const int b) {\n" " int c;\n" " return (c = a) /= b;\n" "}\n" "\n" "vec2 __operator + (const vec2 v, const vec2 u) {\n" " return vec2 (v.x + u.x, v.y + u.y);\n" "}\n" "\n" "vec2 __operator - (const vec2 v, const vec2 u) {\n" " return vec2 (v.x - u.x, v.y - u.y);\n" "}\n" "\n" "vec3 __operator + (const vec3 v, const vec3 u) {\n" " return vec3 (v.x + u.x, v.y + u.y, v.z + u.z);\n" "}\n" "\n" "vec3 __operator - (const vec3 v, const vec3 u) {\n" " return vec3 (v.x - u.x, v.y - u.y, v.z - u.z);\n" "}\n" "\n" "vec4 __operator + (const vec4 v, const vec4 u) {\n" " return vec4 (v.x + u.x, v.y + u.y, v.z + u.z, v.w + u.w);\n" "}\n" "\n" "vec4 __operator - (const vec4 v, const vec4 u) {\n" " return vec4 (v.x - u.x, v.y - u.y, v.z - u.z, v.w - u.w);\n" "}\n" "\n" "ivec2 __operator + (const ivec2 v, const ivec2 u) {\n" " return ivec2 (v.x + u.x, v.y + u.y);\n" "}\n" "\n" "ivec2 __operator - (const ivec2 v, const ivec2 u) {\n" " return ivec2 (v.x - u.x, v.y - u.y);\n" "}\n" "\n" "ivec3 __operator + (const ivec3 v, const ivec3 u) {\n" " return ivec3 (v.x + u.x, v.y + u.y, v.z + u.z);\n" "}\n" "\n" "ivec3 __operator - (const ivec3 v, const ivec3 u) {\n" " return ivec3 (v.x - u.x, v.y - u.y, v.z - u.z);\n" "}\n" "\n" "ivec4 __operator + (const ivec4 v, const ivec4 u) {\n" " return ivec4 (v.x + u.x, v.y + u.y, v.z + u.z, v.w + u.w);\n" "}\n" "\n" "ivec4 __operator - (const ivec4 v, const ivec4 u) {\n" " return ivec4 (v.x - u.x, v.y - u.y, v.z - u.z, v.w - u.w);\n" "}\n" "\n" "mat2 __operator + (const mat2 m, const mat2 n) {\n" " return mat2 (m[0] + n[0], m[1] + n[1]);\n" "}\n" "\n" "mat2 __operator - (const mat2 m, const mat2 n) {\n" " return mat2 (m[0] - n[0], m[1] - n[1]);\n" "}\n" "\n" "mat3 __operator + (const mat3 m, const mat3 n) {\n" " return mat3 (m[0] + n[0], m[1] + n[1], m[2] + n[2]);\n" "}\n" "\n" "mat3 __operator - (const mat3 m, const mat3 n) {\n" " return mat3 (m[0] - n[0], m[1] - n[1], m[2] - n[2]);\n" "}\n" "\n" "mat4 __operator + (const mat4 m, const mat4 n) {\n" " return mat4 (m[0] + n[0], m[1] + n[1], m[2] + n[2], m[3] + n[3]);\n" "}\n" "\n" "mat4 __operator - (const mat4 m, const mat4 n) {\n" " return mat4 (m[0] - n[0], m[1] - n[1], m[2] - n[2], m[3] - n[3]);\n" "}\n" "\n" "vec2 __operator + (const float a, const vec2 u) {\n" " return vec2 (a + u.x, a + u.y);\n" "}\n" "\n" "vec2 __operator + (const vec2 v, const float b) {\n" " return vec2 (v.x + b, v.y + b);\n" "}\n" "\n" "vec2 __operator - (const float a, const vec2 u) {\n" " return vec2 (a - u.x, a - u.y);\n" "}\n" "\n" "vec2 __operator - (const vec2 v, const float b) {\n" " return vec2 (v.x - b, v.y - b);\n" "}\n" "\n" "vec2 __operator * (const float a, const vec2 u) {\n" " return vec2 (a * u.x, a * u.y);\n" "}\n" "\n" "vec2 __operator * (const vec2 v, const float b) {\n" " return vec2 (v.x * b, v.y * b);\n" "}\n" "\n" "vec2 __operator / (const float a, const vec2 u) {\n" " return vec2 (a / u.x, a / u.y);\n" "}\n" "\n" "vec2 __operator / (const vec2 v, const float b) {\n" " return vec2 (v.x / b, v.y / b);\n" "}\n" "\n" "vec3 __operator + (const float a, const vec3 u) {\n" " return vec3 (a + u.x, a + u.y, a + u.z);\n" "}\n" "\n" "vec3 __operator + (const vec3 v, const float b) {\n" " return vec3 (v.x + b, v.y + b, v.z + b);\n" "}\n" "\n" "vec3 __operator - (const float a, const vec3 u) {\n" " return vec3 (a - u.x, a - u.y, a - u.z);\n" "}\n" "\n" "vec3 __operator - (const vec3 v, const float b) {\n" " return vec3 (v.x - b, v.y - b, v.z - b);\n" "}\n" "\n" "vec3 __operator * (const float a, const vec3 u) {\n" " return vec3 (a * u.x, a * u.y, a * u.z);\n" "}\n" "\n" "vec3 __operator * (const vec3 v, const float b) {\n" " return vec3 (v.x * b, v.y * b, v.z * b);\n" "}\n" "\n" "vec3 __operator / (const float a, const vec3 u) {\n" " return vec3 (a / u.x, a / u.y, a / u.z);\n" "}\n" "\n" "vec3 __operator / (const vec3 v, const float b) {\n" " return vec3 (v.x / b, v.y / b, v.z / b);\n" "}\n" "\n" "vec4 __operator + (const float a, const vec4 u) {\n" " return vec4 (a + u.x, a + u.y, a + u.z, a + u.w);\n" "}\n" "\n" "vec4 __operator + (const vec4 v, const float b) {\n" " return vec4 (v.x + b, v.y + b, v.z + b, v.w + b);\n" "}\n" "\n" "vec4 __operator - (const float a, const vec4 u) {\n" " return vec4 (a - u.x, a - u.y, a - u.z, a - u.w);\n" "}\n" "\n" "vec4 __operator - (const vec4 v, const float b) {\n" " return vec4 (v.x - b, v.y - b, v.z - b, v.w - b);\n" "}\n" "\n" "vec4 __operator * (const float a, const vec4 u) {\n" " return vec4 (a * u.x, a * u.y, a * u.z, a * u.w);\n" "}\n" "\n" "vec4 __operator * (const vec4 v, const float b) {\n" " return vec4 (v.x * b, v.y * b, v.z * b, v.w * b);\n" "}\n" "\n" "vec4 __operator / (const float a, const vec4 u) {\n" " return vec4 (a / u.x, a / u.y, a / u.z, a / u.w);\n" "}\n" "\n" "vec4 __operator / (const vec4 v, const float b) {\n" " return vec4 (v.x / b, v.y / b, v.z / b, v.w / b);\n" "}\n" "\n" "mat2 __operator + (const float a, const mat2 n) {\n" " return mat2 (a + n[0], a + n[1]);\n" "}\n" "\n" "mat2 __operator + (const mat2 m, const float b) {\n" " return mat2 (m[0] + b, m[1] + b);\n" "}\n" "\n" "mat2 __operator - (const float a, const mat2 n) {\n" " return mat2 (a - n[0], a - n[1]);\n" "}\n" "\n" "mat2 __operator - (const mat2 m, const float b) {\n" " return mat2 (m[0] - b, m[1] - b);\n" "}\n" "\n" "mat2 __operator * (const float a, const mat2 n) {\n" " return mat2 (a * n[0], a * n[1]);\n" "}\n" "\n" "mat2 __operator * (const mat2 m, const float b) {\n" " return mat2 (m[0] * b, m[1] * b);\n" "}\n" "\n" "mat2 __operator / (const float a, const mat2 n) {\n" " return mat2 (a / n[0], a / n[1]);\n" "}\n" "\n" "mat2 __operator / (const mat2 m, const float b) {\n" " return mat2 (m[0] / b, m[1] / b);\n" "}\n" "\n" "mat3 __operator + (const float a, const mat3 n) {\n" " return mat3 (a + n[0], a + n[1], a + n[2]);\n" "}\n" "\n" "mat3 __operator + (const mat3 m, const float b) {\n" " return mat3 (m[0] + b, m[1] + b, m[2] + b);\n" "}\n" "\n" "mat3 __operator - (const float a, const mat3 n) {\n" " return mat3 (a - n[0], a - n[1], a - n[2]);\n" "}\n" "\n" "mat3 __operator - (const mat3 m, const float b) {\n" " return mat3 (m[0] - b, m[1] - b, m[2] - b);\n" "}\n" "\n" "mat3 __operator * (const float a, const mat3 n) {\n" " return mat3 (a * n[0], a * n[1], a * n[2]);\n" "}\n" "\n" "mat3 __operator * (const mat3 m, const float b) {\n" " return mat3 (m[0] * b, m[1] * b, m[2] * b);\n" "}\n" "\n" "mat3 __operator / (const float a, const mat3 n) {\n" " return mat3 (a / n[0], a / n[1], a / n[2]);\n" "}\n" "\n" "mat3 __operator / (const mat3 m, const float b) {\n" " return mat3 (m[0] / b, m[1] / b, m[2] / b);\n" "}\n" "\n" "mat4 __operator + (const float a, const mat4 n) {\n" " return mat4 (a + n[0], a + n[1], a + n[2], a + n[3]);\n" "}\n" "\n" "mat4 __operator + (const mat4 m, const float b) {\n" " return mat4 (m[0] + b, m[1] + b, m[2] + b, m[3] + b);\n" "}\n" "\n" "mat4 __operator - (const float a, const mat4 n) {\n" " return mat4 (a - n[0], a - n[1], a - n[2], a - n[3]);\n" "}\n" "\n" "mat4 __operator - (const mat4 m, const float b) {\n" " return mat4 (m[0] - b, m[1] - b, m[2] - b, m[3] - b);\n" "}\n" "\n" "mat4 __operator * (const float a, const mat4 n) {\n" " return mat4 (a * n[0], a * n[1], a * n[2], a * n[3]);\n" "}\n" "\n" "mat4 __operator * (const mat4 m, const float b) {\n" " return mat4 (m[0] * b, m[1] * b, m[2] * b, m[3] * b);\n" "}\n" "\n" "mat4 __operator / (const float a, const mat4 n) {\n" " return mat4 (a / n[0], a / n[1], a / n[2], a / n[3]);\n" "}\n" "\n" "mat4 __operator / (const mat4 m, const float b) {\n" " return mat4 (m[0] / b, m[1] / b, m[2] / b, m[3] / b);\n" "}\n" "\n" "ivec2 __operator + (const int a, const ivec2 u) {\n" " return ivec2 (a + u.x, a + u.y);\n" "}\n" "\n" "ivec2 __operator + (const ivec2 v, const int b) {\n" " return ivec2 (v.x + b, v.y + b);\n" "}\n" "\n" "ivec2 __operator - (const int a, const ivec2 u) {\n" " return ivec2 (a - u.x, a - u.y);\n" "}\n" "\n" "ivec2 __operator - (const ivec2 v, const int b) {\n" " return ivec2 (v.x - b, v.y - b);\n" "}\n" "\n" "ivec2 __operator * (const int a, const ivec2 u) {\n" " return ivec2 (a * u.x, a * u.y);\n" "}\n" "\n" "ivec2 __operator * (const ivec2 v, const int b) {\n" " return ivec2 (v.x * b, v.y * b);\n" "}\n" "\n" "ivec2 __operator / (const int a, const ivec2 u) {\n" " return ivec2 (a / u.x, a / u.y);\n" "}\n" "\n" "ivec2 __operator / (const ivec2 v, const int b) {\n" " return ivec2 (v.x / b, v.y / b);\n" "}\n" "\n" "ivec3 __operator + (const int a, const ivec3 u) {\n" " return ivec3 (a + u.x, a + u.y, a + u.z);\n" "}\n" "\n" "ivec3 __operator + (const ivec3 v, const int b) {\n" " return ivec3 (v.x + b, v.y + b, v.z + b);\n" "}\n" "\n" "ivec3 __operator - (const int a, const ivec3 u) {\n" " return ivec3 (a - u.x, a - u.y, a - u.z);\n" "}\n" "\n" "ivec3 __operator - (const ivec3 v, const int b) {\n" " return ivec3 (v.x - b, v.y - b, v.z - b);\n" "}\n" "\n" "ivec3 __operator * (const int a, const ivec3 u) {\n" " return ivec3 (a * u.x, a * u.y, a * u.z);\n" "}\n" "\n" "ivec3 __operator * (const ivec3 v, const int b) {\n" " return ivec3 (v.x * b, v.y * b, v.z * b);\n" "}\n" "\n" "ivec3 __operator / (const int a, const ivec3 u) {\n" " return ivec3 (a / u.x, a / u.y, a / u.z);\n" "}\n" "\n" "ivec3 __operator / (const ivec3 v, const int b) {\n" " return ivec3 (v.x / b, v.y / b, v.z / b);\n" "}\n" "\n" "ivec4 __operator + (const int a, const ivec4 u) {\n" " return ivec4 (a + u.x, a + u.y, a + u.z, a + u.w);\n" "}\n" "\n" "ivec4 __operator + (const ivec4 v, const int b) {\n" " return ivec4 (v.x + b, v.y + b, v.z + b, v.w + b);\n" "}\n" "\n" "ivec4 __operator - (const int a, const ivec4 u) {\n" " return ivec4 (a - u.x, a - u.y, a - u.z, a - u.w);\n" "}\n" "\n" "ivec4 __operator - (const ivec4 v, const int b) {\n" " return ivec4 (v.x - b, v.y - b, v.z - b, v.w - b);\n" "}\n" "\n" "ivec4 __operator * (const int a, const ivec4 u) {\n" " return ivec4 (a * u.x, a * u.y, a * u.z, a * u.w);\n" "}\n" "\n" "ivec4 __operator * (const ivec4 v, const int b) {\n" " return ivec4 (v.x * b, v.y * b, v.z * b, v.w * b);\n" "}\n" "\n" "ivec4 __operator / (const int a, const ivec4 u) {\n" " return ivec4 (a / u.x, a / u.y, a / u.z, a / u.w);\n" "}\n" "\n" "ivec4 __operator / (const ivec4 v, const int b) {\n" " return ivec4 (v.x / b, v.y / b, v.z / b, v.w / b);\n" "}\n" "\n" "vec2 __operator * (const vec2 v, const vec2 u) {\n" " return vec2 (v.x * u.x, v.y * u.y);\n" "}\n" "\n" "vec3 __operator * (const vec3 v, const vec3 u) {\n" " return vec3 (v.x * u.x, v.y * u.y, v.z * u.z);\n" "}\n" "\n" "vec4 __operator * (const vec4 v, const vec4 u) {\n" " return vec4 (v.x * u.x, v.y * u.y, v.z * u.z, v.w * u.w);\n" "}\n" "\n" "ivec2 __operator * (const ivec2 v, const ivec2 u) {\n" " return ivec2 (v.x * u.x, v.y * u.y);\n" "}\n" "\n" "ivec3 __operator * (const ivec3 v, const ivec3 u) {\n" " return ivec3 (v.x * u.x, v.y * u.y, v.z * u.z);\n" "}\n" "\n" "ivec4 __operator * (const ivec4 v, const ivec4 u) {\n" " return ivec4 (v.x * u.x, v.y * u.y, v.z * u.z, v.w * u.w);\n" "}\n" "\n" "vec2 __operator / (const vec2 v, const vec2 u) {\n" " return vec2 (v.x / u.x, v.y / u.y);\n" "}\n" "\n" "vec3 __operator / (const vec3 v, const vec3 u) {\n" " return vec3 (v.x / u.x, v.y / u.y, v.z / u.z);\n" "}\n" "\n" "vec4 __operator / (const vec4 v, const vec4 u) {\n" " return vec4 (v.x / u.x, v.y / u.y, v.z / u.z, v.w / u.w);\n" "}\n" "\n" "ivec2 __operator / (const ivec2 v, const ivec2 u) {\n" " return ivec2 (v.x / u.x, v.y / u.y);\n" "}\n" "\n" "ivec3 __operator / (const ivec3 v, const ivec3 u) {\n" " return ivec3 (v.x / u.x, v.y / u.y, v.z / u.z);\n" "}\n" "\n" "ivec4 __operator / (const ivec4 v, const ivec4 u) {\n" " return ivec4 (v.x / u.x, v.y / u.y, v.z / u.z, v.w / u.w);\n" "}\n" "\n" "mat2 __operator / (const mat2 m, const mat2 n) {\n" " return mat2 (m[0] / n[0], m[1] / n[1]);\n" "}\n" "\n" "mat3 __operator / (const mat3 m, const mat3 n) {\n" " return mat3 (m[0] / n[0], m[1] / n[1], m[2] / n[2]);\n" "}\n" "\n" "mat4 __operator / (const mat4 m, const mat4 n) {\n" " return mat4 (m[0] / n[0], m[1] / n[1], m[2] / n[2], m[3] / n[3]);\n" "}\n" "\n" "vec2 __operator - (const vec2 v) {\n" " return vec2 (-v.x, -v.y);\n" "}\n" "\n" "vec3 __operator - (const vec3 v) {\n" " return vec3 (-v.x, -v.y, -v.z);\n" "}\n" "\n" "vec4 __operator - (const vec4 v) {\n" " return vec4 (-v.x, -v.y, -v.z, -v.w);\n" "}\n" "\n" "ivec2 __operator - (const ivec2 v) {\n" " return ivec2 (-v.x, -v.y);\n" "}\n" "\n" "ivec3 __operator - (const ivec3 v) {\n" " return ivec3 (-v.x, -v.y, -v.z);\n" "}\n" "\n" "ivec4 __operator - (const ivec4 v) {\n" " return ivec4 (-v.x, -v.y, -v.z, -v.w);\n" "}\n" "\n" "mat2 __operator - (const mat2 m) {\n" " return mat2 (-m[0], -m[1]);\n" "}\n" "\n" "mat3 __operator - (const mat3 m) {\n" " return mat3 (-m[0], -m[1], -m[2]);\n" "}\n" "\n" "mat4 __operator - (const mat4 m) {\n" " return mat4 (-m[0], -m[1], -m[2], -m[3]);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "void __operator -- (inout float a) {\n" " a -= 1.0;\n" "}\n" "\n" "void __operator -- (inout int a) {\n" " a -= 1;\n" "}\n" "\n" "void __operator -- (inout vec2 v) {\n" " --v.x, --v.y;\n" "}\n" "\n" "void __operator -- (inout vec3 v) {\n" " --v.x, --v.y, --v.z;\n" "}\n" "\n" "void __operator -- (inout vec4 v) {\n" " --v.x, --v.y, --v.z, --v.w;\n" "}\n" "\n" "void __operator -- (inout ivec2 v) {\n" " --v.x, --v.y;\n" "}\n" "\n" "void __operator -- (inout ivec3 v) {\n" " --v.x, --v.y, --v.z;\n" "}\n" "\n" "void __operator -- (inout ivec4 v) {\n" " --v.x, --v.y, --v.z, --v.w;\n" "}\n" "\n" "void __operator -- (inout mat2 m) {\n" " --m[0], --m[1];\n" "}\n" "\n" "void __operator -- (inout mat3 m) {\n" " --m[0], --m[1], --m[2];\n" "}\n" "\n" "void __operator -- (inout mat4 m) {\n" " --m[0], --m[1], --m[2], --m[3];\n" "}\n" "\n" "void __operator ++ (inout float a) {\n" " a += 1.0;\n" "}\n" "\n" "void __operator ++ (inout int a) {\n" " a += 1;\n" "}\n" "\n" "void __operator ++ (inout vec2 v) {\n" " ++v.x, ++v.y;\n" "}\n" "\n" "void __operator ++ (inout vec3 v) {\n" " ++v.x, ++v.y, ++v.z;\n" "}\n" "\n" "void __operator ++ (inout vec4 v) {\n" " ++v.x, ++v.y, ++v.z, ++v.w;\n" "}\n" "\n" "void __operator ++ (inout ivec2 v) {\n" " ++v.x, ++v.y;\n" "}\n" "\n" "void __operator ++ (inout ivec3 v) {\n" " ++v.x, ++v.y, ++v.z;\n" "}\n" "\n" "void __operator ++ (inout ivec4 v) {\n" " ++v.x, ++v.y, ++v.z, ++v.w;\n" "}\n" "\n" "void __operator ++ (inout mat2 m) {\n" " ++m[0], ++m[1];\n" "}\n" "\n" "void __operator ++ (inout mat3 m) {\n" " ++m[0], ++m[1], ++m[2];\n" "}\n" "\n" "void __operator ++ (inout mat4 m) {\n" " ++m[0], ++m[1], ++m[2], ++m[3];\n" "}\n" "\n" "float __operator -- (inout float a, const int) {\n" " float c;\n" " c = a;\n" " --a;\n" " return c;\n" "}\n" "\n" "int __operator -- (inout int a, const int) {\n" " int c;\n" " c = a;\n" " --a;\n" " return c;\n" "}\n" "\n" "vec2 __operator -- (inout vec2 v, const int) {\n" " return vec2 (v.x--, v.y--);\n" "}\n" "\n" "vec3 __operator -- (inout vec3 v, const int) {\n" " return vec3 (v.x--, v.y--, v.z--);\n" "}\n" "\n" "vec4 __operator -- (inout vec4 v, const int) {\n" " return vec4 (v.x--, v.y--, v.z--, v.w--);\n" "}\n" "\n" "ivec2 __operator -- (inout ivec2 v, const int) {\n" " return ivec2 (v.x--, v.y--);\n" "}\n" "\n" "ivec3 __operator -- (inout ivec3 v, const int) {\n" " return ivec3 (v.x--, v.y--, v.z--);\n" "}\n" "\n" "ivec4 __operator -- (inout ivec4 v, const int) {\n" " return ivec4 (v.x--, v.y--, v.z--, v.w--);\n" "}\n" "\n" "mat2 __operator -- (inout mat2 m, const int) {\n" " return mat2 (m[0]--, m[1]--);\n" "}\n" "\n" "mat3 __operator -- (inout mat3 m, const int) {\n" " return mat3 (m[0]--, m[1]--, m[2]--);\n" "}\n" "\n" "mat4 __operator -- (inout mat4 m, const int) {\n" " return mat4 (m[0]--, m[1]--, m[2]--, m[3]--);\n" "}\n" "\n" "float __operator ++ (inout float a, const int) {\n" " float c;\n" " c = a;\n" " ++a;\n" " return c;\n" "}\n" "\n" "int __operator ++ (inout int a, const int) {\n" " int c;\n" " c = a;\n" " ++a;\n" " return c;\n" "}\n" "\n" "vec2 __operator ++ (inout vec2 v, const int) {\n" " return vec2 (v.x++, v.y++);\n" "}\n" "\n" "vec3 __operator ++ (inout vec3 v, const int) {\n" " return vec3 (v.x++, v.y++, v.z++);\n" "}\n" "\n" "vec4 __operator ++ (inout vec4 v, const int) {\n" " return vec4 (v.x++, v.y++, v.z++, v.w++);\n" "}\n" "\n" "ivec2 __operator ++ (inout ivec2 v, const int) {\n" " return ivec2 (v.x++, v.y++);\n" "}\n" "\n" "ivec3 __operator ++ (inout ivec3 v, const int) {\n" " return ivec3 (v.x++, v.y++, v.z++);\n" "}\n" "\n" "ivec4 __operator ++ (inout ivec4 v, const int) {\n" " return ivec4 (v.x++, v.y++, v.z++, v.w++);\n" "}\n" "\n" "mat2 __operator ++ (inout mat2 m, const int) {\n" " return mat2 (m[0]++, m[1]++);\n" "}\n" "\n" "mat3 __operator ++ (inout mat3 m, const int) {\n" " return mat3 (m[0]++, m[1]++, m[2]++);\n" "}\n" "\n" "mat4 __operator ++ (inout mat4 m, const int) {\n" " return mat4 (m[0]++, m[1]++, m[2]++, m[3]++);\n" "}\n" "\n" "bool __operator < (const float a, const float b) {\n" " bool c;\n" " __asm float_less c, a, b;\n" " return c;\n" "}\n" "\n" "bool __operator < (const int a, const int b) {\n" " return float (a) < float (b);\n" "}\n" "\n" "bool __operator > (const float a, const float b) {\n" " return b < a;\n" "}\n" "\n" "bool __operator > (const int a, const int b) {\n" " return b < a;\n" "}\n" "\n" "bool __operator >= (const float a, const float b) {\n" " return a > b || a == b;\n" "}\n" "\n" "bool __operator >= (const int a, const int b) {\n" " return a > b || a == b;\n" "}\n" "\n" "bool __operator <= (const float a, const float b) {\n" " return a < b || a == b;\n" "}\n" "\n" "bool __operator <= (const int a, const int b) {\n" " return a < b || a == b;\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "bool __operator ^^ (const bool a, const bool b) {\n" " return a != b;\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "bool __operator ! (const bool a) {\n" " return a == false;\n" "}\n" "\n" nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_fragment_builtin_gc_bin.h0000755000000000000000000001404613614532424027432 0ustar 2,2,2,6,12,1,103,108,95,70,114,97,103,67,111,111,114,100,0,0,0,2,2,6, 1,1,103,108,95,70,114,111,110,116,70,97,99,105,110,103,0,0,0,2,2,5,12,1, 103,108,95,70,114,97,103,67,111,108,111,114,0,0,0,2,2,5,12,1,103,108,95,70, 114,97,103,68,97,116,97,0,3,18,103,108,95,77,97,120,68,114,97,119,66,117,102,102, 101,114,115,0,0,0,2,2,5,9,1,103,108,95,70,114,97,103,68,101,112,116,104,0, 0,0,2,2,3,12,1,103,108,95,67,111,108,111,114,0,0,0,2,2,3,12,1,103, 108,95,83,101,99,111,110,100,97,114,121,67,111,108,111,114,0,0,0,2,2,3,12,1, 103,108,95,84,101,120,67,111,111,114,100,0,4,0,2,2,3,9,1,103,108,95,70,111, 103,70,114,97,103,67,111,111,114,100,0,0,0,1,0,12,0,116,101,120,116,117,114,101, 49,68,0,1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,9,99,111,111,114, 100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,118,101,99,52,0,17,48, 0,48,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,80,114,111, 106,0,1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,10,99,111,111,114,100, 0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,116,101,120,116,117,114,101,49, 68,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,59,115,0,18,99, 111,111,114,100,0,59,116,0,49,0,18,98,105,97,115,0,0,0,0,0,1,0,12,0, 116,101,120,116,117,114,101,49,68,80,114,111,106,0,1,0,0,16,115,97,109,112,108,101, 114,0,0,1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0, 0,1,8,58,116,101,120,116,117,114,101,49,68,0,18,115,97,109,112,108,101,114,0,0, 18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,98, 105,97,115,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,0,1,0, 0,17,115,97,109,112,108,101,114,0,0,1,0,0,10,99,111,111,114,100,0,0,1,0, 0,9,98,105,97,115,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0,0, 0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114,111,106,0,1,0,0, 17,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0, 9,98,105,97,115,0,0,0,1,8,58,116,101,120,116,117,114,101,50,68,0,18,115,97, 109,112,108,101,114,0,0,58,118,101,99,50,0,18,99,111,111,114,100,0,59,115,0,18, 99,111,111,114,100,0,59,112,0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111, 111,114,100,0,59,112,0,49,0,0,0,18,98,105,97,115,0,0,0,0,0,1,0,12, 0,116,101,120,116,117,114,101,50,68,80,114,111,106,0,1,0,0,17,115,97,109,112,108, 101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0, 0,0,1,8,58,116,101,120,116,117,114,101,50,68,0,18,115,97,109,112,108,101,114,0, 0,58,118,101,99,50,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0, 59,113,0,49,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113, 0,49,0,0,0,18,98,105,97,115,0,0,0,0,0,1,0,12,0,116,101,120,116,117, 114,101,51,68,0,1,0,0,18,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111, 111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,118,101,99,52,0, 17,48,0,48,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,80, 114,111,106,0,1,0,0,18,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111, 114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,116,101,120,116,117,114, 101,51,68,80,114,111,106,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0, 18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99, 111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111, 114,100,0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,18,98,105,97, 115,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,67,117,98,101,0,1,0, 0,19,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0, 0,9,98,105,97,115,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0,0, 0,0,0,1,0,12,0,115,104,97,100,111,119,49,68,0,1,0,0,20,115,97,109,112, 108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115, 0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12, 0,115,104,97,100,111,119,50,68,0,1,0,0,21,115,97,109,112,108,101,114,0,0,1, 0,0,11,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58, 118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,115,104,97,100,111, 119,49,68,80,114,111,106,0,1,0,0,20,115,97,109,112,108,101,114,0,0,1,0,0, 12,99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,115,104, 97,100,111,119,49,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18, 99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,17,48,0, 48,0,0,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100,0,59,113,0, 49,0,0,0,18,98,105,97,115,0,0,0,0,0,1,0,12,0,115,104,97,100,111,119, 50,68,80,114,111,106,0,1,0,0,21,115,97,109,112,108,101,114,0,0,1,0,0,12, 99,111,111,114,100,0,0,1,0,0,9,98,105,97,115,0,0,0,1,8,58,115,104,97, 100,111,119,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99, 111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111, 114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100, 0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,18,98,105,97,115,0, 0,0,0,0,1,0,9,0,100,70,100,120,0,1,0,0,9,112,0,0,0,1,8,17, 48,0,48,0,0,0,0,1,0,10,0,100,70,100,120,0,1,0,0,10,112,0,0,0, 1,8,58,118,101,99,50,0,17,48,0,48,0,0,0,0,0,0,1,0,11,0,100,70, 100,120,0,1,0,0,11,112,0,0,0,1,8,58,118,101,99,51,0,17,48,0,48,0, 0,0,0,0,0,1,0,12,0,100,70,100,120,0,1,0,0,12,112,0,0,0,1,8, 58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,9,0,100,70,100,121, 0,1,0,0,9,112,0,0,0,1,8,17,48,0,48,0,0,0,0,1,0,10,0,100, 70,100,121,0,1,0,0,10,112,0,0,0,1,8,58,118,101,99,50,0,17,48,0,48, 0,0,0,0,0,0,1,0,11,0,100,70,100,121,0,1,0,0,11,112,0,0,0,1, 8,58,118,101,99,51,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,100,70,100, 121,0,1,0,0,12,112,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0, 0,0,0,0,1,0,9,0,102,119,105,100,116,104,0,1,0,0,9,112,0,0,0,1, 8,58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0, 58,100,70,100,121,0,18,112,0,0,0,0,0,46,0,0,1,0,10,0,102,119,105,100, 116,104,0,1,0,0,10,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120,0, 18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0, 0,46,0,0,1,0,11,0,102,119,105,100,116,104,0,1,0,0,11,112,0,0,0,1, 8,58,97,98,115,0,58,100,70,100,120,0,18,112,0,0,0,0,0,58,97,98,115,0, 58,100,70,100,121,0,18,112,0,0,0,0,0,46,0,0,1,0,12,0,102,119,105,100, 116,104,0,1,0,0,12,112,0,0,0,1,8,58,97,98,115,0,58,100,70,100,120,0, 18,112,0,0,0,0,0,58,97,98,115,0,58,100,70,100,121,0,18,112,0,0,0,0, 0,46,0,0,0nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_fragment_builtin_gc.h0000644000000000000000000001026413614532424026575 0ustar "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "__fixed_input vec4 gl_FragCoord;\n" "__fixed_input bool gl_FrontFacing;\n" "__fixed_output vec4 gl_FragColor;\n" "__fixed_output vec4 gl_FragData[gl_MaxDrawBuffers];\n" "__fixed_output float gl_FragDepth;\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "varying vec4 gl_Color;\n" "varying vec4 gl_SecondaryColor;\n" "varying vec4 gl_TexCoord[];\n" "varying float gl_FogFragCoord;\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 texture1D (sampler1D sampler, float coord, float bias) {\n" " return vec4 (0.0);\n" "}\n" "vec4 texture1DProj (sampler1D sampler, vec2 coord, float bias) {\n" " return texture1D (sampler, coord.s / coord.t, bias);\n" "}\n" "vec4 texture1DProj (sampler1D sampler, vec4 coord, float bias) {\n" " return texture1D (sampler, coord.s / coord.q, bias);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 texture2D (sampler2D sampler, vec2 coord, float bias) {\n" " return vec4 (0.0);\n" "}\n" "vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias) {\n" " return texture2D (sampler, vec2 (coord.s / coord.p, coord.t / coord.p), bias);\n" "}\n" "vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias) {\n" " return texture2D (sampler, vec2 (coord.s / coord.q, coord.s / coord.q), bias);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 texture3D (sampler3D sampler, vec3 coord, float bias) {\n" " return vec4 (0.0);\n" "}\n" "vec4 texture3DProj (sampler3D sampler, vec4 coord, float bias) {\n" " return texture3DProj (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q),\n" " bias);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 textureCube (samplerCube sampler, vec3 coord, float bias) {\n" " return vec4 (0.0);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 shadow1D (sampler1DShadow sampler, vec3 coord, float bias) {\n" " return vec4 (0.0);\n" "}\n" "\n" "vec4 shadow2D (sampler2DShadow sampler, vec3 coord, float bias) {\n" " return vec4 (0.0);\n" "}\n" "vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord, float bias) {\n" " return shadow1D (sampler, vec3 (coord.s / coord.q, 0.0, coord.p / coord.q), bias);\n" "}\n" "vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord, float bias) {\n" " return shadow2D (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q), bias);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float dFdx (float p) {\n" " return 0.0;\n" "}\n" "\n" "vec2 dFdx (vec2 p) {\n" " return vec2 (0.0);\n" "}\n" "\n" "vec3 dFdx (vec3 p) {\n" " return vec3 (0.0);\n" "}\n" "\n" "vec4 dFdx (vec4 p) {\n" " return vec4 (0.0);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float dFdy (float p) {\n" " return 0.0;\n" "}\n" "\n" "vec2 dFdy (vec2 p) {\n" " return vec2 (0.0);\n" "}\n" "\n" "vec3 dFdy (vec3 p) {\n" " return vec3 (0.0);\n" "}\n" "\n" "vec4 dFdy (vec4 p) {\n" " return vec4 (0.0);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "float fwidth (float p) {\n" " return abs (dFdx (p)) + abs (dFdy (p));\n" "}\n" "vec2 fwidth (vec2 p) {\n" " return abs (dFdx (p)) + abs (dFdy (p));\n" "}\n" "vec3 fwidth (vec3 p) {\n" " return abs (dFdx (p)) + abs (dFdy (p));\n" "}\n" "vec4 fwidth (vec4 p) {\n" " return abs (dFdx (p)) + abs (dFdy (p));\n" "}\n" "\n" nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_shader_syn.h0000644000000000000000000007532413614532424024742 0ustar ".syntax translation_unit;\n" ".emtcode REVISION 2\n" ".emtcode EXTERNAL_NULL 0\n" ".emtcode EXTERNAL_FUNCTION_DEFINITION 1\n" ".emtcode EXTERNAL_DECLARATION 2\n" ".emtcode DECLARATION_FUNCTION_PROTOTYPE 1\n" ".emtcode DECLARATION_INIT_DECLARATOR_LIST 2\n" ".emtcode FUNCTION_ORDINARY 0\n" ".emtcode FUNCTION_CONSTRUCTOR 1\n" ".emtcode FUNCTION_OPERATOR 2\n" ".emtcode OPERATOR_ASSIGN 1\n" ".emtcode OPERATOR_ADDASSIGN 2\n" ".emtcode OPERATOR_SUBASSIGN 3\n" ".emtcode OPERATOR_MULASSIGN 4\n" ".emtcode OPERATOR_DIVASSIGN 5\n" ".emtcode OPERATOR_LOGICALXOR 12\n" ".emtcode OPERATOR_EQUAL 16\n" ".emtcode OPERATOR_NOTEQUAL 17\n" ".emtcode OPERATOR_LESS 18\n" ".emtcode OPERATOR_GREATER 19\n" ".emtcode OPERATOR_LESSEQUAL 20\n" ".emtcode OPERATOR_GREATEREQUAL 21\n" ".emtcode OPERATOR_MULTIPLY 24\n" ".emtcode OPERATOR_DIVIDE 25\n" ".emtcode OPERATOR_INCREMENT 27\n" ".emtcode OPERATOR_DECREMENT 28\n" ".emtcode OPERATOR_PLUS 29\n" ".emtcode OPERATOR_MINUS 30\n" ".emtcode OPERATOR_NOT 32\n" ".emtcode DECLARATOR_NONE 0\n" ".emtcode DECLARATOR_NEXT 1\n" ".emtcode VARIABLE_NONE 0\n" ".emtcode VARIABLE_IDENTIFIER 1\n" ".emtcode VARIABLE_INITIALIZER 2\n" ".emtcode VARIABLE_ARRAY_EXPLICIT 3\n" ".emtcode VARIABLE_ARRAY_UNKNOWN 4\n" ".emtcode TYPE_QUALIFIER_NONE 0\n" ".emtcode TYPE_QUALIFIER_CONST 1\n" ".emtcode TYPE_QUALIFIER_ATTRIBUTE 2\n" ".emtcode TYPE_QUALIFIER_VARYING 3\n" ".emtcode TYPE_QUALIFIER_UNIFORM 4\n" ".emtcode TYPE_QUALIFIER_FIXEDOUTPUT 5\n" ".emtcode TYPE_QUALIFIER_FIXEDINPUT 6\n" ".emtcode TYPE_SPECIFIER_VOID 0\n" ".emtcode TYPE_SPECIFIER_BOOL 1\n" ".emtcode TYPE_SPECIFIER_BVEC2 2\n" ".emtcode TYPE_SPECIFIER_BVEC3 3\n" ".emtcode TYPE_SPECIFIER_BVEC4 4\n" ".emtcode TYPE_SPECIFIER_INT 5\n" ".emtcode TYPE_SPECIFIER_IVEC2 6\n" ".emtcode TYPE_SPECIFIER_IVEC3 7\n" ".emtcode TYPE_SPECIFIER_IVEC4 8\n" ".emtcode TYPE_SPECIFIER_FLOAT 9\n" ".emtcode TYPE_SPECIFIER_VEC2 10\n" ".emtcode TYPE_SPECIFIER_VEC3 11\n" ".emtcode TYPE_SPECIFIER_VEC4 12\n" ".emtcode TYPE_SPECIFIER_MAT2 13\n" ".emtcode TYPE_SPECIFIER_MAT3 14\n" ".emtcode TYPE_SPECIFIER_MAT4 15\n" ".emtcode TYPE_SPECIFIER_SAMPLER1D 16\n" ".emtcode TYPE_SPECIFIER_SAMPLER2D 17\n" ".emtcode TYPE_SPECIFIER_SAMPLER3D 18\n" ".emtcode TYPE_SPECIFIER_SAMPLERCUBE 19\n" ".emtcode TYPE_SPECIFIER_SAMPLER1DSHADOW 20\n" ".emtcode TYPE_SPECIFIER_SAMPLER2DSHADOW 21\n" ".emtcode TYPE_SPECIFIER_STRUCT 22\n" ".emtcode TYPE_SPECIFIER_TYPENAME 23\n" ".emtcode FIELD_NONE 0\n" ".emtcode FIELD_NEXT 1\n" ".emtcode FIELD_ARRAY 2\n" ".emtcode OP_END 0\n" ".emtcode OP_BLOCK_BEGIN_NO_NEW_SCOPE 1\n" ".emtcode OP_BLOCK_BEGIN_NEW_SCOPE 2\n" ".emtcode OP_DECLARE 3\n" ".emtcode OP_ASM 4\n" ".emtcode OP_BREAK 5\n" ".emtcode OP_CONTINUE 6\n" ".emtcode OP_DISCARD 7\n" ".emtcode OP_RETURN 8\n" ".emtcode OP_EXPRESSION 9\n" ".emtcode OP_IF 10\n" ".emtcode OP_WHILE 11\n" ".emtcode OP_DO 12\n" ".emtcode OP_FOR 13\n" ".emtcode OP_PUSH_VOID 14\n" ".emtcode OP_PUSH_BOOL 15\n" ".emtcode OP_PUSH_INT 16\n" ".emtcode OP_PUSH_FLOAT 17\n" ".emtcode OP_PUSH_IDENTIFIER 18\n" ".emtcode OP_SEQUENCE 19\n" ".emtcode OP_ASSIGN 20\n" ".emtcode OP_ADDASSIGN 21\n" ".emtcode OP_SUBASSIGN 22\n" ".emtcode OP_MULASSIGN 23\n" ".emtcode OP_DIVASSIGN 24\n" ".emtcode OP_SELECT 31\n" ".emtcode OP_LOGICALOR 32\n" ".emtcode OP_LOGICALXOR 33\n" ".emtcode OP_LOGICALAND 34\n" ".emtcode OP_EQUAL 38\n" ".emtcode OP_NOTEQUAL 39\n" ".emtcode OP_LESS 40\n" ".emtcode OP_GREATER 41\n" ".emtcode OP_LESSEQUAL 42\n" ".emtcode OP_GREATEREQUAL 43\n" ".emtcode OP_ADD 46\n" ".emtcode OP_SUBTRACT 47\n" ".emtcode OP_MULTIPLY 48\n" ".emtcode OP_DIVIDE 49\n" ".emtcode OP_PREINCREMENT 51\n" ".emtcode OP_PREDECREMENT 52\n" ".emtcode OP_PLUS 53\n" ".emtcode OP_MINUS 54\n" ".emtcode OP_NOT 56\n" ".emtcode OP_SUBSCRIPT 57\n" ".emtcode OP_CALL 58\n" ".emtcode OP_FIELD 59\n" ".emtcode OP_POSTINCREMENT 60\n" ".emtcode OP_POSTDECREMENT 61\n" ".emtcode PARAM_QUALIFIER_IN 0\n" ".emtcode PARAM_QUALIFIER_OUT 1\n" ".emtcode PARAM_QUALIFIER_INOUT 2\n" ".emtcode PARAMETER_NONE 0\n" ".emtcode PARAMETER_NEXT 1\n" ".emtcode PARAMETER_ARRAY_NOT_PRESENT 0\n" ".emtcode PARAMETER_ARRAY_PRESENT 1\n" ".errtext INVALID_EXTERNAL_DECLARATION \"error 2001: invalid external declaration\"\n" ".errtext INVALID_OPERATOR_OVERRIDE \"error 2002: invalid operator override\"\n" ".errtext LBRACE_EXPECTED \"error 2003: '{' expected but '$err_token$' found\"\n" ".errtext LPAREN_EXPECTED \"error 2004: '(' expected but '$err_token$' found\"\n" ".errtext RPAREN_EXPECTED \"error 2005: ')' expected but '$err_token$' found\"\n" ".regbyte parsing_builtin 0\n" ".regbyte shader_type 0\n" "variable_identifier\n" " identifier .emit OP_PUSH_IDENTIFIER;\n" "primary_expression\n" " floatconstant .or boolconstant .or intconstant .or variable_identifier .or primary_expression_1;\n" "primary_expression_1\n" " lparen .and expression .and rparen;\n" "postfix_expression\n" " postfix_expression_1 .and .loop postfix_expression_2;\n" "postfix_expression_1\n" " function_call .or primary_expression;\n" "postfix_expression_2\n" " postfix_expression_3 .or postfix_expression_4 .or\n" " plusplus .emit OP_POSTINCREMENT .or\n" " minusminus .emit OP_POSTDECREMENT;\n" "postfix_expression_3\n" " lbracket .and integer_expression .and rbracket .emit OP_SUBSCRIPT;\n" "postfix_expression_4\n" " dot .and field_selection .emit OP_FIELD;\n" "integer_expression\n" " expression;\n" "function_call\n" " function_call_generic .emit OP_CALL .and .true .emit OP_END;\n" "function_call_generic\n" " function_call_generic_1 .or function_call_generic_2;\n" "function_call_generic_1\n" " function_call_header_with_parameters .and rparen .error RPAREN_EXPECTED;\n" "function_call_generic_2\n" " function_call_header_no_parameters .and rparen .error RPAREN_EXPECTED;\n" "function_call_header_no_parameters\n" " function_call_header .and function_call_header_no_parameters_1;\n" "function_call_header_no_parameters_1\n" " \"void\" .or .true;\n" "function_call_header_with_parameters\n" " function_call_header .and assignment_expression .and .true .emit OP_END .and\n" " .loop function_call_header_with_parameters_1;\n" "function_call_header_with_parameters_1\n" " comma .and assignment_expression .and .true .emit OP_END;\n" "function_call_header\n" " function_identifier .and lparen;\n" "function_identifier\n" " identifier;\n" "unary_expression\n" " postfix_expression .or unary_expression_1 .or unary_expression_2 .or unary_expression_3 .or\n" " unary_expression_4 .or unary_expression_5;\n" "unary_expression_1\n" " plusplus .and unary_expression .and .true .emit OP_PREINCREMENT;\n" "unary_expression_2\n" " minusminus .and unary_expression .and .true .emit OP_PREDECREMENT;\n" "unary_expression_3\n" " plus .and unary_expression .and .true .emit OP_PLUS;\n" "unary_expression_4\n" " minus .and unary_expression .and .true .emit OP_MINUS;\n" "unary_expression_5\n" " bang .and unary_expression .and .true .emit OP_NOT;\n" "multiplicative_expression\n" " unary_expression .and .loop multiplicative_expression_1;\n" "multiplicative_expression_1\n" " multiplicative_expression_2 .or multiplicative_expression_3;\n" "multiplicative_expression_2\n" " star .and unary_expression .and .true .emit OP_MULTIPLY;\n" "multiplicative_expression_3\n" " slash .and unary_expression .and .true .emit OP_DIVIDE;\n" "additive_expression\n" " multiplicative_expression .and .loop additive_expression_1;\n" "additive_expression_1\n" " additive_expression_2 .or additive_expression_3;\n" "additive_expression_2\n" " plus .and multiplicative_expression .and .true .emit OP_ADD;\n" "additive_expression_3\n" " minus .and multiplicative_expression .and .true .emit OP_SUBTRACT;\n" "shift_expression\n" " additive_expression;\n" "relational_expression\n" " shift_expression .and .loop relational_expression_1;\n" "relational_expression_1\n" " relational_expression_2 .or relational_expression_3 .or relational_expression_4 .or\n" " relational_expression_5;\n" "relational_expression_2\n" " lessequals .and shift_expression .and .true .emit OP_LESSEQUAL;\n" "relational_expression_3\n" " greaterequals .and shift_expression .and .true .emit OP_GREATEREQUAL;\n" "relational_expression_4\n" " less .and shift_expression .and .true .emit OP_LESS;\n" "relational_expression_5\n" " greater .and shift_expression .and .true .emit OP_GREATER;\n" "equality_expression\n" " relational_expression .and .loop equality_expression_1;\n" "equality_expression_1\n" " equality_expression_2 .or equality_expression_3;\n" "equality_expression_2\n" " equalsequals .and relational_expression .and .true .emit OP_EQUAL;\n" "equality_expression_3\n" " bangequals .and relational_expression .and .true .emit OP_NOTEQUAL;\n" "and_expression\n" " equality_expression;\n" "exclusive_or_expression\n" " and_expression;\n" "inclusive_or_expression\n" " exclusive_or_expression;\n" "logical_and_expression\n" " inclusive_or_expression .and .loop logical_and_expression_1;\n" "logical_and_expression_1\n" " ampersandampersand .and inclusive_or_expression .and .true .emit OP_LOGICALAND;\n" "logical_xor_expression\n" " logical_and_expression .and .loop logical_xor_expression_1;\n" "logical_xor_expression_1\n" " caretcaret .and logical_and_expression .and .true .emit OP_LOGICALXOR;\n" "logical_or_expression\n" " logical_xor_expression .and .loop logical_or_expression_1;\n" "logical_or_expression_1\n" " barbar .and logical_xor_expression .and .true .emit OP_LOGICALOR;\n" "conditional_expression\n" " logical_or_expression .and .loop conditional_expression_1;\n" "conditional_expression_1\n" " question .and expression .and colon .and conditional_expression .and .true .emit OP_SELECT;\n" "assignment_expression\n" " assignment_expression_1 .or assignment_expression_2 .or assignment_expression_3 .or\n" " assignment_expression_4 .or assignment_expression_5 .or conditional_expression;\n" "assignment_expression_1\n" " unary_expression .and equals .and assignment_expression .and .true .emit OP_ASSIGN;\n" "assignment_expression_2\n" " unary_expression .and starequals .and assignment_expression .and .true .emit OP_MULASSIGN;\n" "assignment_expression_3\n" " unary_expression .and slashequals .and assignment_expression .and .true .emit OP_DIVASSIGN;\n" "assignment_expression_4\n" " unary_expression .and plusequals .and assignment_expression .and .true .emit OP_ADDASSIGN;\n" "assignment_expression_5\n" " unary_expression .and minusequals .and assignment_expression .and .true .emit OP_SUBASSIGN;\n" "expression\n" " assignment_expression .and .loop expression_1;\n" "expression_1\n" " comma .and assignment_expression .and .true .emit OP_SEQUENCE;\n" "constant_expression\n" " conditional_expression .and .true .emit OP_END;\n" "declaration\n" " declaration_1 .or declaration_2;\n" "declaration_1\n" " function_prototype .emit DECLARATION_FUNCTION_PROTOTYPE .and semicolon;\n" "declaration_2\n" " init_declarator_list .emit DECLARATION_INIT_DECLARATOR_LIST .and semicolon;\n" "function_prototype\n" " function_declarator .and rparen .error RPAREN_EXPECTED .emit PARAMETER_NONE;\n" "function_declarator\n" " function_header_with_parameters .or function_header;\n" "function_header_with_parameters\n" " function_header .and parameter_declaration .and .loop function_header_with_parameters_1;\n" "function_header_with_parameters_1\n" " comma .and parameter_declaration;\n" "function_header\n" " function_header_nospace .or function_header_space;\n" "function_header_space\n" " fully_specified_type_space .and space .and function_decl_identifier .and lparen;\n" "function_header_nospace\n" " fully_specified_type_nospace .and function_decl_identifier .and lparen;\n" "function_decl_identifier\n" " .if (parsing_builtin != 0) __operator .emit FUNCTION_OPERATOR .or\n" " .if (parsing_builtin != 0) \"__constructor\" .emit FUNCTION_CONSTRUCTOR .or\n" " identifier .emit FUNCTION_ORDINARY;\n" "__operator\n" " \"__operator\" .and overriden_operator .error INVALID_OPERATOR_OVERRIDE;\n" "overriden_operator\n" " plusplus .emit OPERATOR_INCREMENT .or\n" " plusequals .emit OPERATOR_ADDASSIGN .or\n" " plus .emit OPERATOR_PLUS .or\n" " minusminus .emit OPERATOR_DECREMENT .or\n" " minusequals .emit OPERATOR_SUBASSIGN .or\n" " minus .emit OPERATOR_MINUS .or\n" " bangequals .emit OPERATOR_NOTEQUAL .or\n" " bang .emit OPERATOR_NOT .or\n" " starequals .emit OPERATOR_MULASSIGN .or\n" " star .emit OPERATOR_MULTIPLY .or\n" " slashequals .emit OPERATOR_DIVASSIGN .or\n" " slash .emit OPERATOR_DIVIDE .or\n" " lessequals .emit OPERATOR_LESSEQUAL .or\n" " \n" " \n" " less .emit OPERATOR_LESS .or\n" " greaterequals .emit OPERATOR_GREATEREQUAL .or\n" " \n" " \n" " greater .emit OPERATOR_GREATER .or\n" " equalsequals .emit OPERATOR_EQUAL .or\n" " equals .emit OPERATOR_ASSIGN .or\n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " caretcaret .emit OPERATOR_LOGICALXOR ;\n" "parameter_declarator\n" " parameter_declarator_nospace .or parameter_declarator_space;\n" "parameter_declarator_nospace\n" " type_specifier_nospace .and identifier .and parameter_declarator_1;\n" "parameter_declarator_space\n" " type_specifier_space .and space .and identifier .and parameter_declarator_1;\n" "parameter_declarator_1\n" " parameter_declarator_2 .emit PARAMETER_ARRAY_PRESENT .or\n" " .true .emit PARAMETER_ARRAY_NOT_PRESENT;\n" "parameter_declarator_2\n" " lbracket .and constant_expression .and rbracket;\n" "parameter_declaration\n" " parameter_declaration_1 .emit PARAMETER_NEXT;\n" "parameter_declaration_1\n" " parameter_declaration_2 .or parameter_declaration_3;\n" "parameter_declaration_2\n" " type_qualifier .and space .and parameter_qualifier .and parameter_declaration_4;\n" "parameter_declaration_3\n" " parameter_qualifier .emit TYPE_QUALIFIER_NONE .and parameter_declaration_4;\n" "parameter_declaration_4\n" " parameter_declarator .or parameter_type_specifier;\n" "parameter_qualifier\n" " parameter_qualifier_1 .or .true .emit PARAM_QUALIFIER_IN;\n" "parameter_qualifier_1\n" " parameter_qualifier_2 .and space;\n" "parameter_qualifier_2\n" " \"in\" .emit PARAM_QUALIFIER_IN .or\n" " \"out\" .emit PARAM_QUALIFIER_OUT .or\n" " \"inout\" .emit PARAM_QUALIFIER_INOUT;\n" "parameter_type_specifier\n" " parameter_type_specifier_1 .and .true .emit '\\0' .and parameter_type_specifier_2;\n" "parameter_type_specifier_1\n" " type_specifier_nospace .or type_specifier_space;\n" "parameter_type_specifier_2\n" " parameter_type_specifier_3 .emit PARAMETER_ARRAY_PRESENT .or\n" " .true .emit PARAMETER_ARRAY_NOT_PRESENT;\n" "parameter_type_specifier_3\n" " lbracket .and constant_expression .and rbracket;\n" "init_declarator_list\n" " single_declaration .and .loop init_declarator_list_1 .emit DECLARATOR_NEXT .and\n" " .true .emit DECLARATOR_NONE;\n" "init_declarator_list_1\n" " comma .and identifier .emit VARIABLE_IDENTIFIER .and init_declarator_list_2;\n" "init_declarator_list_2\n" " init_declarator_list_3 .or init_declarator_list_4 .or .true .emit VARIABLE_NONE;\n" "init_declarator_list_3\n" " equals .and initializer .emit VARIABLE_INITIALIZER;\n" "init_declarator_list_4\n" " lbracket .and init_declarator_list_5 .and rbracket;\n" "init_declarator_list_5\n" " constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;\n" "single_declaration\n" " single_declaration_nospace .or single_declaration_space;\n" "single_declaration_space\n" " fully_specified_type_space .and single_declaration_space_1;\n" "single_declaration_nospace\n" " fully_specified_type_nospace .and single_declaration_nospace_1;\n" "single_declaration_space_1\n" " single_declaration_space_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;\n" "single_declaration_nospace_1\n" " single_declaration_nospace_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;\n" "single_declaration_space_2\n" " space .and identifier .and single_declaration_3;\n" "single_declaration_nospace_2\n" " identifier .and single_declaration_3;\n" "single_declaration_3\n" " single_declaration_4 .or single_declaration_5 .or .true .emit VARIABLE_NONE;\n" "single_declaration_4\n" " equals .and initializer .emit VARIABLE_INITIALIZER;\n" "single_declaration_5\n" " lbracket .and single_declaration_6 .and rbracket;\n" "single_declaration_6\n" " constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;\n" "fully_specified_type_space\n" " fully_specified_type_1 .and type_specifier_space;\n" "fully_specified_type_nospace\n" " fully_specified_type_1 .and type_specifier_nospace;\n" "fully_specified_type_1\n" " fully_specified_type_2 .or .true .emit TYPE_QUALIFIER_NONE;\n" "fully_specified_type_2\n" " type_qualifier .and space;\n" "type_qualifier\n" " \"const\" .emit TYPE_QUALIFIER_CONST .or\n" " .if (shader_type == 2) \"attribute\" .emit TYPE_QUALIFIER_ATTRIBUTE .or\n" " \"varying\" .emit TYPE_QUALIFIER_VARYING .or\n" " \"uniform\" .emit TYPE_QUALIFIER_UNIFORM .or\n" " .if (parsing_builtin != 0) \"__fixed_output\" .emit TYPE_QUALIFIER_FIXEDOUTPUT .or\n" " .if (parsing_builtin != 0) \"__fixed_input\" .emit TYPE_QUALIFIER_FIXEDINPUT;\n" "type_specifier_space\n" " \"void\" .emit TYPE_SPECIFIER_VOID .or\n" " \"float\" .emit TYPE_SPECIFIER_FLOAT .or\n" " \"int\" .emit TYPE_SPECIFIER_INT .or\n" " \"bool\" .emit TYPE_SPECIFIER_BOOL .or\n" " \"vec2\" .emit TYPE_SPECIFIER_VEC2 .or\n" " \"vec3\" .emit TYPE_SPECIFIER_VEC3 .or\n" " \"vec4\" .emit TYPE_SPECIFIER_VEC4 .or\n" " \"bvec2\" .emit TYPE_SPECIFIER_BVEC2 .or\n" " \"bvec3\" .emit TYPE_SPECIFIER_BVEC3 .or\n" " \"bvec4\" .emit TYPE_SPECIFIER_BVEC4 .or\n" " \"ivec2\" .emit TYPE_SPECIFIER_IVEC2 .or\n" " \"ivec3\" .emit TYPE_SPECIFIER_IVEC3 .or\n" " \"ivec4\" .emit TYPE_SPECIFIER_IVEC4 .or\n" " \"mat2\" .emit TYPE_SPECIFIER_MAT2 .or\n" " \"mat3\" .emit TYPE_SPECIFIER_MAT3 .or\n" " \"mat4\" .emit TYPE_SPECIFIER_MAT4 .or\n" " \"sampler1D\" .emit TYPE_SPECIFIER_SAMPLER1D .or\n" " \"sampler2D\" .emit TYPE_SPECIFIER_SAMPLER2D .or\n" " \"sampler3D\" .emit TYPE_SPECIFIER_SAMPLER3D .or\n" " \"samplerCube\" .emit TYPE_SPECIFIER_SAMPLERCUBE .or\n" " \"sampler1DShadow\" .emit TYPE_SPECIFIER_SAMPLER1DSHADOW .or\n" " \"sampler2DShadow\" .emit TYPE_SPECIFIER_SAMPLER2DSHADOW .or\n" " type_name .emit TYPE_SPECIFIER_TYPENAME;\n" "type_specifier_nospace\n" " struct_specifier .emit TYPE_SPECIFIER_STRUCT;\n" "struct_specifier\n" " \"struct\" .and struct_specifier_1 .and optional_space .and lbrace .error LBRACE_EXPECTED .and\n" " struct_declaration_list .and rbrace .emit FIELD_NONE;\n" "struct_specifier_1\n" " struct_specifier_2 .or .true .emit '\\0';\n" "struct_specifier_2\n" " space .and identifier;\n" "struct_declaration_list\n" " struct_declaration .and .loop struct_declaration .emit FIELD_NEXT;\n" "struct_declaration\n" " struct_declaration_nospace .or struct_declaration_space;\n" "struct_declaration_space\n" " type_specifier_space .and space .and struct_declarator_list .and semicolon .emit FIELD_NONE;\n" "struct_declaration_nospace\n" " type_specifier_nospace .and struct_declarator_list .and semicolon .emit FIELD_NONE;\n" "struct_declarator_list\n" " struct_declarator .and .loop struct_declarator_list_1 .emit FIELD_NEXT;\n" "struct_declarator_list_1\n" " comma .and struct_declarator;\n" "struct_declarator\n" " identifier .and struct_declarator_1;\n" "struct_declarator_1\n" " struct_declarator_2 .emit FIELD_ARRAY .or .true .emit FIELD_NONE;\n" "struct_declarator_2\n" " lbracket .and constant_expression .and rbracket;\n" "initializer\n" " assignment_expression .and .true .emit OP_END;\n" "declaration_statement\n" " declaration;\n" "statement\n" " compound_statement .or simple_statement;\n" "statement_space\n" " compound_statement .or statement_space_1;\n" "statement_space_1\n" " space .and simple_statement;\n" "simple_statement\n" " .if (parsing_builtin != 0) __asm_statement .emit OP_ASM .or\n" " selection_statement .or\n" " iteration_statement .or\n" " jump_statement .or\n" " expression_statement .emit OP_EXPRESSION .or\n" " declaration_statement .emit OP_DECLARE;\n" "compound_statement\n" " compound_statement_1 .emit OP_BLOCK_BEGIN_NEW_SCOPE .and .true .emit OP_END;\n" "compound_statement_1\n" " compound_statement_2 .or compound_statement_3;\n" "compound_statement_2\n" " lbrace .and rbrace;\n" "compound_statement_3\n" " lbrace .and statement_list .and rbrace;\n" "statement_no_new_scope\n" " compound_statement_no_new_scope .or simple_statement;\n" "compound_statement_no_new_scope\n" " compound_statement_no_new_scope_1 .emit OP_BLOCK_BEGIN_NO_NEW_SCOPE .and .true .emit OP_END;\n" "compound_statement_no_new_scope_1\n" " compound_statement_no_new_scope_2 .or compound_statement_no_new_scope_3;\n" "compound_statement_no_new_scope_2\n" " lbrace .and rbrace;\n" "compound_statement_no_new_scope_3\n" " lbrace .and statement_list .and rbrace;\n" "statement_list\n" " statement .and .loop statement;\n" "expression_statement\n" " expression_statement_1 .or expression_statement_2;\n" "expression_statement_1\n" " semicolon .emit OP_PUSH_VOID .emit OP_END;\n" "expression_statement_2\n" " expression .and semicolon .emit OP_END;\n" "selection_statement\n" " \"if\" .emit OP_IF .and lparen .error LPAREN_EXPECTED .and expression .and\n" " rparen .error RPAREN_EXPECTED .emit OP_END .and selection_rest_statement;\n" "selection_rest_statement\n" " statement .and selection_rest_statement_1;\n" "selection_rest_statement_1\n" " selection_rest_statement_2 .or .true .emit OP_EXPRESSION .emit OP_PUSH_VOID .emit OP_END;\n" "selection_rest_statement_2\n" " \"else\" .and optional_space .and statement;\n" "condition\n" " condition_1 .emit OP_DECLARE .emit DECLARATION_INIT_DECLARATOR_LIST .or\n" " condition_3 .emit OP_EXPRESSION;\n" "condition_1\n" " condition_1_nospace .or condition_1_space;\n" "condition_1_nospace\n" " fully_specified_type_nospace .and condition_2;\n" "condition_1_space\n" " fully_specified_type_space .and space .and condition_2;\n" "condition_2\n" " identifier .emit VARIABLE_IDENTIFIER .and equals .emit VARIABLE_INITIALIZER .and\n" " initializer .and .true .emit DECLARATOR_NONE;\n" "condition_3\n" " expression .and .true .emit OP_END;\n" "iteration_statement\n" " iteration_statement_1 .or iteration_statement_2 .or iteration_statement_3;\n" "iteration_statement_1\n" " \"while\" .emit OP_WHILE .and lparen .error LPAREN_EXPECTED .and condition .and\n" " rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n" "iteration_statement_2\n" " \"do\" .emit OP_DO .and statement_space .and \"while\" .and lparen .error LPAREN_EXPECTED .and\n" " expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon;\n" "iteration_statement_3\n" " \"for\" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and\n" " for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n" "for_init_statement\n" " expression_statement .emit OP_EXPRESSION .or declaration_statement .emit OP_DECLARE;\n" "conditionopt\n" " condition .or\n" " .true .emit OP_EXPRESSION .emit OP_PUSH_BOOL .emit 2 .emit '1' .emit '\\0' .emit OP_END;\n" "for_rest_statement\n" " conditionopt .and semicolon .and for_rest_statement_1;\n" "for_rest_statement_1\n" " for_rest_statement_2 .or .true .emit OP_PUSH_VOID .emit OP_END;\n" "for_rest_statement_2\n" " expression .and .true .emit OP_END;\n" "jump_statement\n" " jump_statement_1 .or jump_statement_2 .or jump_statement_3 .or jump_statement_4 .or\n" " .if (shader_type == 1) jump_statement_5;\n" "jump_statement_1\n" " \"continue\" .and semicolon .emit OP_CONTINUE;\n" "jump_statement_2\n" " \"break\" .and semicolon .emit OP_BREAK;\n" "jump_statement_3\n" " \"return\" .emit OP_RETURN .and optional_space .and expression .and semicolon .emit OP_END;\n" "jump_statement_4\n" " \"return\" .emit OP_RETURN .and semicolon .emit OP_PUSH_VOID .emit OP_END;\n" "jump_statement_5\n" " \"discard\" .and semicolon .emit OP_DISCARD;\n" "__asm_statement\n" " \"__asm\" .and space .and identifier .and space .and asm_arguments .and semicolon .emit OP_END;\n" "asm_arguments\n" " variable_identifier .and .true .emit OP_END .and .loop asm_arguments_1;\n" "asm_arguments_1\n" " comma .and variable_identifier .and .true .emit OP_END;\n" "translation_unit\n" " optional_space .emit REVISION .and external_declaration .error INVALID_EXTERNAL_DECLARATION .and\n" " .loop external_declaration .and optional_space .and\n" " '\\0' .error INVALID_EXTERNAL_DECLARATION .emit EXTERNAL_NULL;\n" "external_declaration\n" " function_definition .emit EXTERNAL_FUNCTION_DEFINITION .or\n" " declaration .emit EXTERNAL_DECLARATION;\n" "function_definition\n" " function_prototype .and compound_statement_no_new_scope;\n" "digit_oct\n" " '0'-'7';\n" "digit_dec\n" " '0'-'9';\n" "digit_hex\n" " '0'-'9' .or 'A'-'F' .or 'a'-'f';\n" "id_character_first\n" " 'a'-'z' .or 'A'-'Z' .or '_';\n" "id_character_next\n" " id_character_first .or digit_dec;\n" "identifier\n" " id_character_first .emit * .and .loop id_character_next .emit * .and .true .emit '\\0';\n" "float\n" " float_1 .or float_2;\n" "float_1\n" " float_fractional_constant .and float_optional_exponent_part;\n" "float_2\n" " float_digit_sequence .and .true .emit '\\0' .and float_exponent_part;\n" "float_fractional_constant\n" " float_fractional_constant_1 .or float_fractional_constant_2 .or float_fractional_constant_3;\n" "float_fractional_constant_1\n" " float_digit_sequence .and '.' .and float_digit_sequence;\n" "float_fractional_constant_2\n" " float_digit_sequence .and '.' .and .true .emit '\\0';\n" "float_fractional_constant_3\n" " '.' .emit '\\0' .and float_digit_sequence;\n" "float_optional_exponent_part\n" " float_exponent_part .or .true .emit '\\0';\n" "float_digit_sequence\n" " digit_dec .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n" "float_exponent_part\n" " float_exponent_part_1 .or float_exponent_part_2;\n" "float_exponent_part_1\n" " 'e' .and float_optional_sign .and float_digit_sequence;\n" "float_exponent_part_2\n" " 'E' .and float_optional_sign .and float_digit_sequence;\n" "float_optional_sign\n" " float_sign .or .true;\n" "float_sign\n" " '+' .or '-' .emit '-';\n" "integer\n" " integer_hex .or integer_oct .or integer_dec;\n" "integer_hex\n" " '0' .and integer_hex_1 .emit 0x10 .and digit_hex .emit * .and .loop digit_hex .emit * .and\n" " .true .emit '\\0';\n" "integer_hex_1\n" " 'x' .or 'X';\n" "integer_oct\n" " '0' .emit 8 .emit * .and .loop digit_oct .emit * .and .true .emit '\\0';\n" "integer_dec\n" " digit_dec .emit 10 .emit * .and .loop digit_dec .emit * .and .true .emit '\\0';\n" "boolean\n" " \"true\" .emit 2 .emit '1' .emit '\\0' .or\n" " \"false\" .emit 2 .emit '0' .emit '\\0';\n" "type_name\n" " identifier;\n" "field_selection\n" " identifier;\n" "floatconstant\n" " float .emit OP_PUSH_FLOAT;\n" "intconstant\n" " integer .emit OP_PUSH_INT;\n" "boolconstant\n" " boolean .emit OP_PUSH_BOOL;\n" "optional_space\n" " .loop single_space;\n" "space\n" " single_space .and .loop single_space;\n" "single_space\n" " white_char .or c_style_comment_block .or cpp_style_comment_block;\n" "white_char\n" " ' ' .or '\\t' .or new_line .or '\\v' .or '\\f';\n" "new_line\n" " cr_lf .or lf_cr .or '\\n' .or '\\r';\n" "cr_lf\n" " '\\r' .and '\\n';\n" "lf_cr\n" " '\\n' .and '\\r';\n" "c_style_comment_block\n" " '/' .and '*' .and c_style_comment_rest;\n" "c_style_comment_rest\n" " .loop c_style_comment_char_no_star .and c_style_comment_rest_1;\n" "c_style_comment_rest_1\n" " c_style_comment_end .or c_style_comment_rest_2;\n" "c_style_comment_rest_2\n" " '*' .and c_style_comment_rest;\n" "c_style_comment_char_no_star\n" " '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n" "c_style_comment_end\n" " '*' .and '/';\n" "cpp_style_comment_block\n" " '/' .and '/' .and cpp_style_comment_block_1;\n" "cpp_style_comment_block_1\n" " cpp_style_comment_block_2 .or cpp_style_comment_block_3;\n" "cpp_style_comment_block_2\n" " .loop cpp_style_comment_char .and new_line;\n" "cpp_style_comment_block_3\n" " .loop cpp_style_comment_char;\n" "cpp_style_comment_char\n" " '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" "ampersandampersand\n" " optional_space .and '&' .and '&' .and optional_space;\n" "barbar\n" " optional_space .and '|' .and '|' .and optional_space;\n" "bang\n" " optional_space .and '!' .and optional_space;\n" "bangequals\n" " optional_space .and '!' .and '=' .and optional_space;\n" "caretcaret\n" " optional_space .and '^' .and '^' .and optional_space;\n" "colon\n" " optional_space .and ':' .and optional_space;\n" "comma\n" " optional_space .and ',' .and optional_space;\n" "dot\n" " optional_space .and '.' .and optional_space;\n" "equals\n" " optional_space .and '=' .and optional_space;\n" "equalsequals\n" " optional_space .and '=' .and '=' .and optional_space;\n" "greater\n" " optional_space .and '>' .and optional_space;\n" "greaterequals\n" " optional_space .and '>' .and '=' .and optional_space;\n" "lbrace\n" " optional_space .and '{' .and optional_space;\n" "lbracket\n" " optional_space .and '[' .and optional_space;\n" "less\n" " optional_space .and '<' .and optional_space;\n" "lessequals\n" " optional_space .and '<' .and '=' .and optional_space;\n" "lparen\n" " optional_space .and '(' .and optional_space;\n" "minus\n" " optional_space .and '-' .and optional_space;\n" "minusequals\n" " optional_space .and '-' .and '=' .and optional_space;\n" "minusminus\n" " optional_space .and '-' .and '-' .and optional_space;\n" "plus\n" " optional_space .and '+' .and optional_space;\n" "plusequals\n" " optional_space .and '+' .and '=' .and optional_space;\n" "plusplus\n" " optional_space .and '+' .and '+' .and optional_space;\n" "question\n" " optional_space .and '?' .and optional_space;\n" "rbrace\n" " optional_space .and '}' .and optional_space;\n" "rbracket\n" " optional_space .and ']' .and optional_space;\n" "rparen\n" " optional_space .and ')' .and optional_space;\n" "semicolon\n" " optional_space .and ';' .and optional_space;\n" "slash\n" " optional_space .and '/' .and optional_space;\n" "slashequals\n" " optional_space .and '/' .and '=' .and optional_space;\n" "star\n" " optional_space .and '*' .and optional_space;\n" "starequals\n" " optional_space .and '*' .and '=' .and optional_space;\n" ".string string_lexer;\n" "string_lexer\n" " lex_first_identifier_character .and .loop lex_next_identifier_character;\n" "lex_first_identifier_character\n" " 'a'-'z' .or 'A'-'Z' .or '_';\n" "lex_next_identifier_character\n" " 'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';\n" "err_token\n" " '~' .or '`' .or '!' .or '@' .or '#' .or '$' .or '%' .or '^' .or '&' .or '*' .or '(' .or ')' .or\n" " '-' .or '+' .or '=' .or '|' .or '\\\\' .or '[' .or ']' .or '{' .or '}' .or ':' .or ';' .or '\"' .or\n" " '\\'' .or '<' .or ',' .or '>' .or '.' .or '/' .or '?' .or err_identifier;\n" "err_identifier\n" " id_character_first .and .loop id_character_next;\n" "" nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_version_syn.h0000755000000000000000000000415713614532424025160 0ustar ".syntax version_directive;\n" "version_directive\n" " version_directive_1 .and .loop version_directive_2;\n" "version_directive_1\n" " prior_optional_spaces .and optional_version_directive .and .true .emit $;\n" "version_directive_2\n" " prior_optional_spaces .and version_directive_body .and .true .emit $;\n" "optional_version_directive\n" " version_directive_body .or .true .emit 10 .emit 1;\n" "version_directive_body\n" " '#' .and optional_space .and \"version\" .and space .and version_number .and optional_space .and\n" " new_line;\n" "version_number\n" " version_number_110;\n" "version_number_110\n" " leading_zeroes .and \"110\" .emit 10 .emit 1;\n" "leading_zeroes\n" " .loop zero;\n" "zero\n" " '0';\n" "space\n" " single_space .and .loop single_space;\n" "optional_space\n" " .loop single_space;\n" "single_space\n" " ' ' .or '\\t';\n" "prior_optional_spaces\n" " .loop prior_space;\n" "prior_space\n" " c_style_comment_block .or cpp_style_comment_block .or space .or new_line;\n" "c_style_comment_block\n" " '/' .and '*' .and c_style_comment_rest;\n" "c_style_comment_rest\n" " .loop c_style_comment_char_no_star .and c_style_comment_rest_1;\n" "c_style_comment_rest_1\n" " c_style_comment_end .or c_style_comment_rest_2;\n" "c_style_comment_rest_2\n" " '*' .and c_style_comment_rest;\n" "c_style_comment_char_no_star\n" " '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n" "c_style_comment_end\n" " '*' .and '/';\n" "cpp_style_comment_block\n" " '/' .and '/' .and cpp_style_comment_block_1;\n" "cpp_style_comment_block_1\n" " cpp_style_comment_block_2 .or cpp_style_comment_block_3;\n" "cpp_style_comment_block_2\n" " .loop cpp_style_comment_char .and new_line;\n" "cpp_style_comment_block_3\n" " .loop cpp_style_comment_char;\n" "cpp_style_comment_char\n" " '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" "new_line\n" " cr_lf .or lf_cr .or '\\n' .or '\\r';\n" "cr_lf\n" " '\\r' .and '\\n';\n" "lf_cr\n" " '\\n' .and '\\r';\n" ".string __string_filter;\n" "__string_filter\n" " .loop __identifier_char;\n" "__identifier_char\n" " 'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';\n" "" nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_vertex_builtin_gc_bin.h0000755000000000000000000001376313614532424027151 0ustar 2,2,2,5,12,1,103,108,95,80,111,115,105,116,105,111,110,0,0,0,2,2,5,9, 1,103,108,95,80,111,105,110,116,83,105,122,101,0,0,0,2,2,5,12,1,103,108,95, 67,108,105,112,86,101,114,116,101,120,0,0,0,2,2,2,12,1,103,108,95,67,111,108, 111,114,0,0,0,2,2,2,12,1,103,108,95,83,101,99,111,110,100,97,114,121,67,111, 108,111,114,0,0,0,2,2,2,11,1,103,108,95,78,111,114,109,97,108,0,0,0,2, 2,2,12,1,103,108,95,86,101,114,116,101,120,0,0,0,2,2,2,12,1,103,108,95, 77,117,108,116,105,84,101,120,67,111,111,114,100,48,0,0,0,2,2,2,12,1,103,108, 95,77,117,108,116,105,84,101,120,67,111,111,114,100,49,0,0,0,2,2,2,12,1,103, 108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,50,0,0,0,2,2,2,12,1, 103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,51,0,0,0,2,2,2,12, 1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,52,0,0,0,2,2,2, 12,1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,53,0,0,0,2,2, 2,12,1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,54,0,0,0,2, 2,2,12,1,103,108,95,77,117,108,116,105,84,101,120,67,111,111,114,100,55,0,0,0, 2,2,2,9,1,103,108,95,70,111,103,67,111,111,114,100,0,0,0,2,2,3,12,1, 103,108,95,70,114,111,110,116,67,111,108,111,114,0,0,0,2,2,3,12,1,103,108,95, 66,97,99,107,67,111,108,111,114,0,0,0,2,2,3,12,1,103,108,95,70,114,111,110, 116,83,101,99,111,110,100,97,114,121,67,111,108,111,114,0,0,0,2,2,3,12,1,103, 108,95,66,97,99,107,83,101,99,111,110,100,97,114,121,67,111,108,111,114,0,0,0,2, 2,3,12,1,103,108,95,84,101,120,67,111,111,114,100,0,4,0,2,2,3,9,1,103, 108,95,70,111,103,70,114,97,103,67,111,111,114,100,0,0,0,1,0,12,0,102,116,114, 97,110,115,102,111,114,109,0,0,1,8,18,103,108,95,77,111,100,101,108,86,105,101,119, 80,114,111,106,101,99,116,105,111,110,77,97,116,114,105,120,0,18,103,108,95,86,101,114, 116,101,120,0,48,0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,76,111,100,0, 1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,9,99,111,111,114,100,0,0, 1,0,0,9,108,111,100,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0, 0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,49,68,80,114,111,106,76,111,100, 0,1,0,0,16,115,97,109,112,108,101,114,0,0,1,0,0,10,99,111,111,114,100,0, 0,1,0,0,9,108,111,100,0,0,0,1,8,58,116,101,120,116,117,114,101,49,68,76, 111,100,0,18,115,97,109,112,108,101,114,0,0,18,99,111,111,114,100,0,59,115,0,18, 99,111,111,114,100,0,59,116,0,49,0,18,108,111,100,0,0,0,0,0,1,0,12,0, 116,101,120,116,117,114,101,49,68,80,114,111,106,76,111,100,0,1,0,0,16,115,97,109, 112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,108,111,100, 0,0,0,1,8,58,116,101,120,116,117,114,101,49,68,76,111,100,0,18,115,97,109,112, 108,101,114,0,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113, 0,49,0,18,108,111,100,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50, 68,76,111,100,0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,10,99,111, 111,114,100,0,0,1,0,0,9,108,111,100,0,0,0,1,8,58,118,101,99,52,0,17, 48,0,48,0,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114, 111,106,76,111,100,0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,11,99, 111,111,114,100,0,0,1,0,0,9,108,111,100,0,0,0,1,8,58,116,101,120,116,117, 114,101,50,68,76,111,100,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,50,0, 18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,112,0,49,0,18,99, 111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,112,0,49,0,0,0,18,108, 111,100,0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,50,68,80,114,111,106, 76,111,100,0,1,0,0,17,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111, 114,100,0,0,1,0,0,9,108,111,100,0,0,0,1,8,58,116,101,120,116,117,114,101, 50,68,76,111,100,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,50,0,18,99, 111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111, 114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49,0,0,0,18,108,111,100, 0,0,0,0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,76,111,100,0,1,0, 0,18,115,97,109,112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0, 0,9,108,111,100,0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0,0,0, 0,0,1,0,12,0,116,101,120,116,117,114,101,51,68,80,114,111,106,76,111,100,0,1, 0,0,18,115,97,109,112,108,101,114,0,0,1,0,0,12,99,111,111,114,100,0,0,1, 0,0,9,108,111,100,0,0,0,1,8,58,116,101,120,116,117,114,101,51,68,76,111,100, 0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,0,18,99,111,111,114,100,0, 59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,116, 0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,115,0,18, 99,111,111,114,100,0,59,113,0,49,0,0,0,18,108,111,100,0,0,0,0,0,1,0, 12,0,116,101,120,116,117,114,101,67,117,98,101,76,111,100,0,1,0,0,19,115,97,109, 112,108,101,114,0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0,9,108,111,100, 0,0,0,1,8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12, 0,115,104,97,100,111,119,49,68,76,111,100,0,1,0,0,20,115,97,109,112,108,101,114, 0,0,1,0,0,11,99,111,111,114,100,0,0,1,0,0,9,108,111,100,0,0,0,1, 8,58,118,101,99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,115,104,97, 100,111,119,50,68,76,111,100,0,1,0,0,21,115,97,109,112,108,101,114,0,0,1,0, 0,11,99,111,111,114,100,0,0,1,0,0,9,108,111,100,0,0,0,1,8,58,118,101, 99,52,0,17,48,0,48,0,0,0,0,0,0,1,0,12,0,115,104,97,100,111,119,49, 68,80,114,111,106,76,111,100,0,1,0,0,20,115,97,109,112,108,101,114,0,0,1,0, 0,12,99,111,111,114,100,0,0,1,0,0,9,108,111,100,0,0,0,1,8,58,115,104, 97,100,111,119,49,68,76,111,100,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99, 51,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0, 17,48,0,48,0,0,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100,0, 59,113,0,49,0,0,0,18,108,111,100,0,0,0,0,0,1,0,12,0,115,104,97,100, 111,119,50,68,80,114,111,106,76,111,100,0,1,0,0,21,115,97,109,112,108,101,114,0, 0,1,0,0,12,99,111,111,114,100,0,0,1,0,0,9,108,111,100,0,0,0,1,8, 58,115,104,97,100,111,119,50,68,76,111,100,0,18,115,97,109,112,108,101,114,0,0,58, 118,101,99,51,0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113, 0,49,0,18,99,111,111,114,100,0,59,116,0,18,99,111,111,114,100,0,59,113,0,49, 0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,100,0,59,113,0,49,0,0, 0,18,108,111,100,0,0,0,0,0,0nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/library/slang_vertex_builtin_gc.h0000644000000000000000000000711213614532424026305 0ustar "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "__fixed_output vec4 gl_Position;\n" "__fixed_output float gl_PointSize;\n" "__fixed_output vec4 gl_ClipVertex;\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "attribute vec4 gl_Color;\n" "attribute vec4 gl_SecondaryColor;\n" "attribute vec3 gl_Normal;\n" "attribute vec4 gl_Vertex;\n" "attribute vec4 gl_MultiTexCoord0;\n" "attribute vec4 gl_MultiTexCoord1;\n" "attribute vec4 gl_MultiTexCoord2;\n" "attribute vec4 gl_MultiTexCoord3;\n" "attribute vec4 gl_MultiTexCoord4;\n" "attribute vec4 gl_MultiTexCoord5;\n" "attribute vec4 gl_MultiTexCoord6;\n" "attribute vec4 gl_MultiTexCoord7;\n" "attribute float gl_FogCoord;\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "varying vec4 gl_FrontColor;\n" "varying vec4 gl_BackColor;\n" "varying vec4 gl_FrontSecondaryColor;\n" "varying vec4 gl_BackSecondaryColor;\n" "varying vec4 gl_TexCoord[];\n" "varying float gl_FogFragCoord;\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 ftransform () {\n" " return gl_ModelViewProjectionMatrix * gl_Vertex;\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 texture1DLod (sampler1D sampler, float coord, float lod) {\n" " return vec4 (0.0);\n" "}\n" "vec4 texture1DProjLod (sampler1D sampler, vec2 coord, float lod) {\n" " return texture1DLod (sampler, coord.s / coord.t, lod);\n" "}\n" "vec4 texture1DProjLod (sampler1D sampler, vec4 coord, float lod) {\n" " return texture1DLod (sampler, coord.s / coord.q, lod);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 texture2DLod (sampler2D sampler, vec2 coord, float lod) {\n" " return vec4 (0.0);\n" "}\n" "vec4 texture2DProjLod (sampler2D sampler, vec3 coord, float lod) {\n" " return texture2DLod (sampler, vec2 (coord.s / coord.p, coord.t / coord.p), lod);\n" "}\n" "vec4 texture2DProjLod (sampler2D sampler, vec4 coord, float lod) {\n" " return texture2DLod (sampler, vec2 (coord.s / coord.q, coord.t / coord.q), lod);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 texture3DLod (sampler3D sampler, vec3 coord, float lod) {\n" " return vec4 (0.0);\n" "}\n" "vec4 texture3DProjLod (sampler3D sampler, vec4 coord, float lod) {\n" " return texture3DLod (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.s / coord.q),\n" " lod);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 textureCubeLod (samplerCube sampler, vec3 coord, float lod) {\n" " return vec4 (0.0);\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" "vec4 shadow1DLod (sampler1DShadow sampler, vec3 coord, float lod) {\n" " return vec4 (0.0);\n" "}\n" "\n" "vec4 shadow2DLod (sampler2DShadow sampler, vec3 coord, float lod) {\n" " return vec4 (0.0);\n" "}\n" "vec4 shadow1DProjLod (sampler1DShadow sampler, vec4 coord, float lod) {\n" " return shadow1DLod (sampler, vec3 (coord.s / coord.q, 0.0, coord.p / coord.q), lod);\n" "}\n" "vec4 shadow2DProjLod (sampler2DShadow sampler, vec4 coord, float lod) {\n" " return shadow2DLod (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q),\n" " lod);\n" "}\n" "\n" nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_assignment.c0000644000000000000000000001235213614532424025145 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file slang_assemble_assignment.c * slang assignment expressions assembler * \author Michal Krol */ #include "imports.h" #include "slang_assemble_assignment.h" #include "slang_assemble_typeinfo.h" #include "slang_storage.h" #include "slang_utility.h" /* _slang_assemble_assignment() copies values on the stack ( to ) to a memory location pointed by ; in: +------------------+ | addr of variable | +------------------+ | component N-1 | | ... | | component 0 | +------------------+ out: +------------------+ | addr of variable | +------------------+ */ /* TODO: add support for swizzle mask */ static int assign_aggregate (slang_assembly_file *file, const slang_storage_aggregate *agg, unsigned int *index, unsigned int size, slang_assembly_local_info *info) { unsigned int i; for (i = 0; i < agg->count; i++) { const slang_storage_array *arr = agg->arrays + i; unsigned int j; for (j = 0; j < arr->length; j++) { if (arr->type == slang_stor_aggregate) { if (!assign_aggregate (file, arr->aggregate, index, size, info)) return 0; } else { slang_assembly_type ty; switch (arr->type) { case slang_stor_bool: ty = slang_asm_bool_copy; break; case slang_stor_int: ty = slang_asm_int_copy; break; case slang_stor_float: ty = slang_asm_float_copy; break; default: break; } if (!slang_assembly_file_push_label2 (file, ty, size - *index, *index)) return 0; *index += 4; } } } return 1; } int _slang_assemble_assignment (slang_assembly_file *file, slang_operation *op, slang_assembly_name_space *space, slang_assembly_local_info *info) { slang_assembly_typeinfo ti; int result; slang_storage_aggregate agg; unsigned int index, size; slang_assembly_typeinfo_construct (&ti); if (!_slang_typeof_operation (op, space, &ti)) { slang_assembly_typeinfo_destruct (&ti); return 0; } slang_storage_aggregate_construct (&agg); if (!_slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)) { slang_storage_aggregate_destruct (&agg); slang_assembly_typeinfo_destruct (&ti); return 0; } index = 0; size = _slang_sizeof_aggregate (&agg); result = assign_aggregate (file, &agg, &index, size, info); slang_storage_aggregate_destruct (&agg); slang_assembly_typeinfo_destruct (&ti); return result; } /* _slang_assemble_assign() performs unary (pre ++ and --) or binary (=, +=, -=, *=, /=) assignment on the operation's children */ int dereference (slang_assembly_file *file, slang_operation *op, slang_assembly_name_space *space, slang_assembly_local_info *info); int call_function_name (slang_assembly_file *file, const char *name, slang_operation *params, unsigned int param_count, int assignment, slang_assembly_name_space *space, slang_assembly_local_info *info); int _slang_assemble_assign (slang_assembly_file *file, slang_operation *op, const char *oper, int ref, slang_assembly_name_space *space, slang_assembly_local_info *info) { slang_assembly_stack_info stk; slang_assembly_flow_control flow; if (!ref) { if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp, 4)) return 0; } if (slang_string_compare ("=", oper) == 0) { if (!_slang_assemble_operation (file, op->children, 1, &flow, space, info, &stk)) return 0; if (!_slang_assemble_operation (file, op->children + 1, 0, &flow, space, info, &stk)) return 0; if (!_slang_assemble_assignment (file, op->children, space, info)) return 0; } else { if (!call_function_name (file, oper, op->children, op->num_children, 1, space, info)) return 0; } if (!ref) { if (!slang_assembly_file_push (file, slang_asm_addr_copy)) return 0; if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4)) return 0; if (!dereference (file, op->children, space, info)) return 0; } return 1; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_assignment.h0000644000000000000000000000323013614532424025145 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if !defined SLANG_ASSEMBLE_ASSIGNMENT_H #define SLANG_ASSEMBLE_ASSIGNMENT_H #include "slang_assemble.h" #if defined __cplusplus extern "C" { #endif int _slang_assemble_assignment (slang_assembly_file *, slang_operation *, slang_assembly_name_space *, slang_assembly_local_info *); int _slang_assemble_assign (slang_assembly_file *, slang_operation *, const char *, int ref, slang_assembly_name_space *, slang_assembly_local_info *); #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble.c0000644000000000000000000010622613614532424022721 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file slang_assemble.c * slang intermediate code assembler * \author Michal Krol */ #include "imports.h" #include "slang_utility.h" #include "slang_assemble.h" #include "slang_compile.h" #include "slang_storage.h" #include "slang_assemble_constructor.h" #include "slang_assemble_typeinfo.h" #include "slang_assemble_conditional.h" #include "slang_assemble_assignment.h" /* slang_assembly */ static void slang_assembly_construct (slang_assembly *assem) { assem->type = slang_asm_none; } static void slang_assembly_destruct (slang_assembly *assem) { } /* slang_assembly_file */ void slang_assembly_file_construct (slang_assembly_file *file) { file->code = NULL; file->count = 0; } void slang_assembly_file_destruct (slang_assembly_file *file) { unsigned int i; for (i = 0; i < file->count; i++) slang_assembly_destruct (file->code + i); slang_alloc_free (file->code); } static int slang_assembly_file_push_new (slang_assembly_file *file) { file->code = (slang_assembly *) slang_alloc_realloc (file->code, file->count * sizeof ( slang_assembly), (file->count + 1) * sizeof (slang_assembly)); if (file->code != NULL) { slang_assembly_construct (file->code + file->count); file->count++; return 1; } return 0; } static int slang_assembly_file_push_general (slang_assembly_file *file, slang_assembly_type type, GLfloat literal, GLuint label, GLuint size) { slang_assembly *assem; if (!slang_assembly_file_push_new (file)) return 0; assem = file->code + file->count - 1; assem->type = type; assem->literal = literal; assem->param[0] = label; assem->param[1] = size; return 1; } int slang_assembly_file_push (slang_assembly_file *file, slang_assembly_type type) { return slang_assembly_file_push_general (file, type, (GLfloat) 0, 0, 0); } int slang_assembly_file_push_label (slang_assembly_file *file, slang_assembly_type type, GLuint label) { return slang_assembly_file_push_general (file, type, (GLfloat) 0, label, 0); } int slang_assembly_file_push_label2 (slang_assembly_file *file, slang_assembly_type type, GLuint label1, GLuint label2) { return slang_assembly_file_push_general (file, type, (GLfloat) 0, label1, label2); } int slang_assembly_file_push_literal (slang_assembly_file *file, slang_assembly_type type, GLfloat literal) { return slang_assembly_file_push_general (file, type, literal, 0, 0); } /* utility functions */ static int sizeof_variable (slang_type_specifier *spec, slang_type_qualifier qual, slang_operation *array_size, slang_assembly_name_space *space, unsigned int *size) { slang_storage_aggregate agg; slang_storage_aggregate_construct (&agg); if (!_slang_aggregate_variable (&agg, spec, array_size, space->funcs, space->structs)) { slang_storage_aggregate_destruct (&agg); return 0; } *size += _slang_sizeof_aggregate (&agg); if (qual == slang_qual_out || qual == slang_qual_inout) *size += 4; slang_storage_aggregate_destruct (&agg); return 1; } static int sizeof_variable2 (slang_variable *var, slang_assembly_name_space *space, unsigned int *size) { var->address = *size; if (var->type.qualifier == slang_qual_out || var->type.qualifier == slang_qual_inout) var->address += 4; return sizeof_variable (&var->type.specifier, var->type.qualifier, var->array_size, space, size); } static int sizeof_variables (slang_variable_scope *vars, unsigned int start, unsigned int stop, slang_assembly_name_space *space, unsigned int *size) { unsigned int i; for (i = start; i < stop; i++) if (!sizeof_variable2 (vars->variables + i, space, size)) return 0; return 1; } static int collect_locals (slang_operation *op, slang_assembly_name_space *space, unsigned int *size) { unsigned int i; if (!sizeof_variables (op->locals, 0, op->locals->num_variables, space, size)) return 0; for (i = 0; i < op->num_children; i++) if (!collect_locals (op->children + i, space, size)) return 0; return 1; } /* _slang_locate_function() */ slang_function *_slang_locate_function (const char *name, slang_operation *params, unsigned int num_params, slang_assembly_name_space *space) { unsigned int i; for (i = 0; i < space->funcs->num_functions; i++) { unsigned int j; slang_function *f = space->funcs->functions + i; if (slang_string_compare (name, f->header.name) != 0) continue; if (f->param_count != num_params) continue; for (j = 0; j < num_params; j++) { slang_assembly_typeinfo ti; slang_assembly_typeinfo_construct (&ti); if (!_slang_typeof_operation (params + j, space, &ti)) { slang_assembly_typeinfo_destruct (&ti); return 0; } if (!slang_type_specifier_equal (&ti.spec, &f->parameters->variables[j].type.specifier)) { slang_assembly_typeinfo_destruct (&ti); break; } slang_assembly_typeinfo_destruct (&ti); /* "out" and "inout" formal parameter requires the actual parameter to be l-value */ if (!ti.can_be_referenced && (f->parameters->variables[j].type.qualifier == slang_qual_out || f->parameters->variables[j].type.qualifier == slang_qual_inout)) break; } if (j == num_params) return f; } if (space->funcs->outer_scope != NULL) { slang_assembly_name_space my_space = *space; my_space.funcs = space->funcs->outer_scope; return _slang_locate_function (name, params, num_params, &my_space); } return NULL; } /* _slang_assemble_function() */ int _slang_assemble_function (slang_assembly_file *file, slang_function *fun, slang_assembly_name_space *space) { unsigned int param_size, local_size; unsigned int skip, cleanup; slang_assembly_flow_control flow; slang_assembly_local_info info; slang_assembly_stack_info stk; fun->address = file->count; if (fun->body == NULL) { /* TODO: jump to the actual function body */ return 1; } /* calculate return value and parameters size */ param_size = 0; if (fun->header.type.specifier.type != slang_spec_void) if (!sizeof_variable (&fun->header.type.specifier, slang_qual_none, NULL, space, ¶m_size)) return 0; info.ret_size = param_size; if (!sizeof_variables (fun->parameters, 0, fun->param_count, space, ¶m_size)) return 0; /* calculate local variables size, take into account the four-byte return address and temporaries for various tasks */ info.addr_tmp = param_size + 4; info.swizzle_tmp = param_size + 4 + 4; local_size = param_size + 4 + 4 + 16; if (!sizeof_variables (fun->parameters, fun->param_count, fun->parameters->num_variables, space, &local_size)) return 0; if (!collect_locals (fun->body, space, &local_size)) return 0; /* allocate local variable storage */ if (!slang_assembly_file_push_label (file, slang_asm_local_alloc, local_size - param_size - 4)) return 0; /* mark a new frame for function variable storage */ if (!slang_assembly_file_push_label (file, slang_asm_enter, local_size)) return 0; /* skip the cleanup jump */ skip = file->count; if (!slang_assembly_file_push_new (file)) return 0; file->code[skip].type = slang_asm_jump; /* all "return" statements will be directed here */ flow.function_end = file->count; cleanup = file->count; if (!slang_assembly_file_push_new (file)) return 0; file->code[cleanup].type = slang_asm_jump; /* execute the function body */ file->code[skip].param[0] = file->count; if (!_slang_assemble_operation (file, fun->body, 0, &flow, space, &info, &stk)) return 0; /* this is the end of the function - restore the old function frame */ file->code[cleanup].param[0] = file->count; if (!slang_assembly_file_push (file, slang_asm_leave)) return 0; /* free local variable storage */ if (!slang_assembly_file_push_label (file, slang_asm_local_free, local_size - param_size - 4)) return 0; /* jump out of the function */ if (!slang_assembly_file_push (file, slang_asm_return)) return 0; return 1; } int _slang_cleanup_stack (slang_assembly_file *file, slang_operation *op, int ref, slang_assembly_name_space *space) { slang_assembly_typeinfo ti; unsigned int size; slang_assembly_typeinfo_construct (&ti); if (!_slang_typeof_operation (op, space, &ti)) { slang_assembly_typeinfo_destruct (&ti); return 0; } if (ti.spec.type == slang_spec_void) size = 0; else if (ref) size = 4; else { size = 0; if (!sizeof_variable (&ti.spec, slang_qual_none, NULL, space, &size)) { slang_assembly_typeinfo_destruct (&ti); return 0; } } slang_assembly_typeinfo_destruct (&ti); if (size != 0) { if (!slang_assembly_file_push_label (file, slang_asm_local_free, size)) return 0; } return 1; } /* _slang_assemble_operation() */ /* XXX: general swizzle! */ static int dereference_aggregate (slang_assembly_file *file, const slang_storage_aggregate *agg, unsigned int index, unsigned int *size, slang_assembly_local_info *info) { unsigned int i; for (i = agg->count; i > 0; i--) { const slang_storage_array *arr = agg->arrays + i - 1; unsigned int j; for (j = arr->length; j > 0; j--) { if (arr->type == slang_stor_aggregate) { if (!dereference_aggregate (file, arr->aggregate, index, size, info)) return 0; } else { *size -= 4; if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp, 4)) return 0; if (!slang_assembly_file_push (file, slang_asm_addr_deref)) return 0; if (!slang_assembly_file_push_label (file, slang_asm_addr_push, *size)) return 0; if (!slang_assembly_file_push (file, slang_asm_addr_add)) return 0; switch (arr->type) { case slang_stor_bool: if (!slang_assembly_file_push (file, slang_asm_bool_deref)) return 0; break; case slang_stor_int: if (!slang_assembly_file_push (file, slang_asm_int_deref)) return 0; break; case slang_stor_float: if (!slang_assembly_file_push (file, slang_asm_float_deref)) return 0; break; } index += 4; } } } return 1; } /* XXX: general swizzle! */ int dereference (slang_assembly_file *file, slang_operation *op, slang_assembly_name_space *space, slang_assembly_local_info *info) { slang_assembly_typeinfo ti; int result; slang_storage_aggregate agg; unsigned int size; slang_assembly_typeinfo_construct (&ti); if (!_slang_typeof_operation (op, space, &ti)) { slang_assembly_typeinfo_destruct (&ti); return 0; } slang_storage_aggregate_construct (&agg); if (!_slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)) { slang_storage_aggregate_destruct (&agg); slang_assembly_typeinfo_destruct (&ti); return 0; } size = _slang_sizeof_aggregate (&agg); result = dereference_aggregate (file, &agg, 0, &size, info); slang_storage_aggregate_destruct (&agg); slang_assembly_typeinfo_destruct (&ti); return result; } static int call_function (slang_assembly_file *file, slang_function *fun, slang_operation *params, unsigned int param_count, int assignment, slang_assembly_name_space *space, slang_assembly_local_info *info) { unsigned int i; slang_assembly_stack_info stk; /* make room for the return value, if any */ if (fun->header.type.specifier.type != slang_spec_void) { unsigned int ret_size = 0; if (!sizeof_variable (&fun->header.type.specifier, slang_qual_none, NULL, space, &ret_size)) return 0; if (!slang_assembly_file_push_label (file, slang_asm_local_alloc, ret_size)) return 0; } /* push the actual parameters on the stack */ for (i = 0; i < param_count; i++) { slang_assembly_flow_control flow; if (fun->parameters->variables[i].type.qualifier == slang_qual_inout || fun->parameters->variables[i].type.qualifier == slang_qual_out) { if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp, 4)) return 0; /* TODO: optimize the "out" parameter case */ /* TODO: inspect stk */ if (!_slang_assemble_operation (file, params + i, 1, &flow, space, info, &stk)) return 0; if (!slang_assembly_file_push (file, slang_asm_addr_copy)) return 0; if (!slang_assembly_file_push (file, slang_asm_addr_deref)) return 0; if (i == 0 && assignment) { if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp, 4)) return 0; if (!slang_assembly_file_push (file, slang_asm_addr_deref)) return 0; } if (!dereference (file, params, space, info)) return 0; } else { /* TODO: for "out" and "inout" parameters also push the address (first) */ /* TODO: optimize the "out" parameter case */ /* TODO: inspect stk */ if (!_slang_assemble_operation (file, params + i, 0, &flow, space, info, &stk)) return 0; } } /* call the function */ if (!slang_assembly_file_push_label (file, slang_asm_call, fun->address)) return 0; /* pop the parameters from the stack */ for (i = param_count; i > 0; i--) { unsigned int j = i - 1; if (fun->parameters->variables[j].type.qualifier == slang_qual_inout || fun->parameters->variables[j].type.qualifier == slang_qual_out) { if (!_slang_assemble_assignment (file, params + j, space, info)) return 0; if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4)) return 0; } else { if (!_slang_cleanup_stack (file, params + j, 0, space)) return 0; } } return 1; } int call_function_name (slang_assembly_file *file, const char *name, slang_operation *params, unsigned int param_count, int assignment, slang_assembly_name_space *space, slang_assembly_local_info *info) { slang_function *fun = _slang_locate_function (name, params, param_count, space); if (fun == NULL) return 0; return call_function (file, fun, params, param_count, assignment, space, info); } static int call_function_name_dummyint (slang_assembly_file *file, const char *name, slang_operation *params, slang_assembly_name_space *space, slang_assembly_local_info *info) { slang_operation p2[2]; int result; p2[0] = *params; if (!slang_operation_construct_a (p2 + 1)) return 0; p2[1].type = slang_oper_literal_int; result = call_function_name (file, name, p2, 2, 0, space, info); slang_operation_destruct (p2 + 1); return result; } static int call_asm_instruction (slang_assembly_file *file, const char *name) { const struct { const char *name; slang_assembly_type code1, code2; } inst[] = { { "float_to_int", slang_asm_float_to_int, slang_asm_int_copy }, { "int_to_float", slang_asm_int_to_float, slang_asm_float_copy }, { "float_copy", slang_asm_float_copy, slang_asm_none }, { "int_copy", slang_asm_int_copy, slang_asm_none }, { "bool_copy", slang_asm_bool_copy, slang_asm_none }, { "float_add", slang_asm_float_add, slang_asm_float_copy }, { "float_multiply", slang_asm_float_multiply, slang_asm_float_copy }, { "float_divide", slang_asm_float_divide, slang_asm_float_copy }, { "float_negate", slang_asm_float_negate, slang_asm_float_copy }, { "float_less", slang_asm_float_less, slang_asm_bool_copy }, { "float_equal", slang_asm_float_equal, slang_asm_bool_copy }, { NULL, slang_asm_none, slang_asm_none } }; unsigned int i; for (i = 0; inst[i].name != NULL; i++) if (slang_string_compare (name, inst[i].name) == 0) break; if (inst[i].name == NULL) return 0; if (!slang_assembly_file_push_label2 (file, inst[i].code1, 4, 0)) return 0; if (inst[i].code2 != slang_asm_none) if (!slang_assembly_file_push_label2 (file, inst[i].code2, 4, 0)) return 0; /* clean-up the stack from the remaining dst address */ if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4)) return 0; return 1; } /* XXX: general swizzle! */ static int equality_aggregate (slang_assembly_file *file, const slang_storage_aggregate *agg, unsigned int *index, unsigned int size, slang_assembly_local_info *info, unsigned int z_label) { unsigned int i; for (i = 0; i < agg->count; i++) { const slang_storage_array *arr = agg->arrays + i; unsigned int j; for (j = 0; j < arr->length; j++) { if (arr->type == slang_stor_aggregate) { if (!equality_aggregate (file, arr->aggregate, index, size, info, z_label)) return 0; } else { if (!slang_assembly_file_push_label2 (file, slang_asm_float_equal, size + *index, *index)) return 0; *index += 4; if (!slang_assembly_file_push_label (file, slang_asm_jump_if_zero, z_label)) return 0; } } } return 1; } /* XXX: general swizzle! */ static int equality (slang_assembly_file *file, slang_operation *op, slang_assembly_name_space *space, slang_assembly_local_info *info, int equal) { slang_assembly_typeinfo ti; int result; slang_storage_aggregate agg; unsigned int index, size; unsigned int skip_jump, true_label, true_jump, false_label, false_jump; /* get type of operation */ slang_assembly_typeinfo_construct (&ti); if (!_slang_typeof_operation (op, space, &ti)) { slang_assembly_typeinfo_destruct (&ti); return 0; } /* convert it to an aggregate */ slang_storage_aggregate_construct (&agg); if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs))) goto end; /* compute the size of the agregate - there are two such aggregates on the stack */ size = _slang_sizeof_aggregate (&agg); /* jump to the actual data-comparison code */ skip_jump = file->count; if (!(result = slang_assembly_file_push (file, slang_asm_jump))) goto end; /* pop off the stack the compared data and push 1 */ true_label = file->count; if (!(result = slang_assembly_file_push_label (file, slang_asm_local_free, size * 2))) goto end; if (!(result = slang_assembly_file_push_literal (file, slang_asm_bool_push, 1.0f))) goto end; true_jump = file->count; if (!(result = slang_assembly_file_push (file, slang_asm_jump))) goto end; false_label = file->count; if (!(result = slang_assembly_file_push_label (file, slang_asm_local_free, size * 2))) goto end; if (!(result = slang_assembly_file_push_literal (file, slang_asm_bool_push, 0.0f))) goto end; false_jump = file->count; if (!(result = slang_assembly_file_push (file, slang_asm_jump))) goto end; file->code[skip_jump].param[0] = file->count; /* compare the data on stack, it will eventually jump either to true or false label */ index = 0; if (!(result = equality_aggregate (file, &agg, &index, size, info, equal ? false_label : true_label))) goto end; if (!(result = slang_assembly_file_push_label (file, slang_asm_jump, equal ? true_label : false_label))) goto end; file->code[true_jump].param[0] = file->count; file->code[false_jump].param[0] = file->count; result = 1; end: slang_storage_aggregate_destruct (&agg); slang_assembly_typeinfo_destruct (&ti); return result; } int _slang_assemble_operation (slang_assembly_file *file, slang_operation *op, int reference, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info, slang_assembly_stack_info *stk) { unsigned int assem; stk->swizzle_mask = 0; assem = file->count; if (!slang_assembly_file_push_new (file)) return 0; switch (op->type) { case slang_oper_block_no_new_scope: case slang_oper_block_new_scope: { unsigned int i; for (i = 0; i < op->num_children; i++) { slang_assembly_stack_info stk; if (!_slang_assemble_operation (file, op->children + i, 0, flow, space, info, &stk)) return 0; /* TODO: pass-in stk to cleanup */ if (!_slang_cleanup_stack (file, op->children + i, 0, space)) return 0; } } break; case slang_oper_variable_decl: { unsigned int i; for (i = 0; i < op->num_children; i++) { /* TODO: perform initialization of op->children[i] */ /* TODO: clean-up stack */ } } break; case slang_oper_asm: { unsigned int i; for (i = 0; i < op->num_children; i++) { slang_assembly_stack_info stk; if (!_slang_assemble_operation (file, op->children + i, i == 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ } if (!call_asm_instruction (file, op->identifier)) return 0; } break; case slang_oper_break: file->code[assem].type = slang_asm_jump; file->code[assem].param[0] = flow->loop_end; break; case slang_oper_continue: file->code[assem].type = slang_asm_jump; file->code[assem].param[0] = flow->loop_start; break; case slang_oper_discard: file->code[assem].type = slang_asm_discard; if (!slang_assembly_file_push (file, slang_asm_exit)) return 0; break; case slang_oper_return: if (info->ret_size != 0) { slang_assembly_stack_info stk; if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, 0, info->ret_size)) return 0; if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ if (!_slang_assemble_assignment (file, op->children, space, info)) return 0; if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4)) return 0; } if (!slang_assembly_file_push_label (file, slang_asm_jump, flow->function_end)) return 0; break; case slang_oper_expression: { slang_assembly_stack_info stk; if (!_slang_assemble_operation (file, op->children, reference, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ } break; case slang_oper_if: if (!_slang_assemble_if (file, op, flow, space, info)) return 0; break; case slang_oper_while: if (!_slang_assemble_while (file, op, flow, space, info)) return 0; break; case slang_oper_do: if (!_slang_assemble_do (file, op, flow, space, info)) return 0; break; case slang_oper_for: if (!_slang_assemble_for (file, op, flow, space, info)) return 0; break; case slang_oper_void: break; case slang_oper_literal_bool: file->code[assem].type = slang_asm_bool_push; file->code[assem].literal = op->literal; break; case slang_oper_literal_int: file->code[assem].type = slang_asm_int_push; file->code[assem].literal = op->literal; break; case slang_oper_literal_float: file->code[assem].type = slang_asm_float_push; file->code[assem].literal = op->literal; break; case slang_oper_identifier: { slang_variable *var; unsigned int size; var = _slang_locate_variable (op->locals, op->identifier, 1); if (var == NULL) return 0; size = 0; if (!sizeof_variable (&var->type.specifier, slang_qual_none, var->array_size, space, &size)) return 0; if (var->initializer != NULL) { assert (!"var->initializer, oper_identifier"); } else { if (!reference) { if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp, 4)) return 0; } /* XXX: globals! */ if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, var->address, size)) return 0; if (!reference) { if (!slang_assembly_file_push (file, slang_asm_addr_copy)) return 0; if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4)) return 0; if (!dereference (file, op, space, info)) return 0; } } } break; case slang_oper_sequence: { slang_assembly_stack_info stk; if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) return 0; /* TODO: pass-in stk to cleanup */ if (!_slang_cleanup_stack (file, op->children, 0, space)) return 0; if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ } break; case slang_oper_assign: if (!_slang_assemble_assign (file, op, "=", reference, space, info)) return 0; break; case slang_oper_addassign: if (!_slang_assemble_assign (file, op, "+=", reference, space, info)) return 0; break; case slang_oper_subassign: if (!_slang_assemble_assign (file, op, "-=", reference, space, info)) return 0; break; case slang_oper_mulassign: if (!_slang_assemble_assign (file, op, "*=", reference, space, info)) return 0; break; /*case slang_oper_modassign:*/ /*case slang_oper_lshassign:*/ /*case slang_oper_rshassign:*/ /*case slang_oper_orassign:*/ /*case slang_oper_xorassign:*/ /*case slang_oper_andassign:*/ case slang_oper_divassign: if (!_slang_assemble_assign (file, op, "/=", reference, space, info)) return 0; break; case slang_oper_select: if (!_slang_assemble_select (file, op, flow, space, info)) return 0; break; case slang_oper_logicalor: if (!_slang_assemble_logicalor (file, op, flow, space, info)) return 0; break; case slang_oper_logicaland: if (!_slang_assemble_logicaland (file, op, flow, space, info)) return 0; break; case slang_oper_logicalxor: if (!call_function_name (file, "^^", op->children, 2, 0, space, info)) return 0; break; /*case slang_oper_bitor:*/ /*case slang_oper_bitxor:*/ /*case slang_oper_bitand:*/ case slang_oper_less: if (!call_function_name (file, "<", op->children, 2, 0, space, info)) return 0; break; case slang_oper_greater: if (!call_function_name (file, ">", op->children, 2, 0, space, info)) return 0; break; case slang_oper_lessequal: if (!call_function_name (file, "<=", op->children, 2, 0, space, info)) return 0; break; case slang_oper_greaterequal: if (!call_function_name (file, ">=", op->children, 2, 0, space, info)) return 0; break; /*case slang_oper_lshift:*/ /*case slang_oper_rshift:*/ case slang_oper_add: if (!call_function_name (file, "+", op->children, 2, 0, space, info)) return 0; break; case slang_oper_subtract: if (!call_function_name (file, "-", op->children, 2, 0, space, info)) return 0; break; case slang_oper_multiply: if (!call_function_name (file, "*", op->children, 2, 0, space, info)) return 0; break; /*case slang_oper_modulus:*/ case slang_oper_divide: if (!call_function_name (file, "/", op->children, 2, 0, space, info)) return 0; break; case slang_oper_equal: { slang_assembly_stack_info stk; if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ if (!equality (file, op->children, space, info, 1)) return 0; } break; case slang_oper_notequal: { slang_assembly_stack_info stk; if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ if (!equality (file, op->children, space, info, 0)) return 0; } break; case slang_oper_preincrement: if (!_slang_assemble_assign (file, op, "++", reference, space, info)) return 0; break; case slang_oper_predecrement: if (!_slang_assemble_assign (file, op, "--", reference, space, info)) return 0; break; case slang_oper_plus: if (!call_function_name (file, "+", op->children, 1, 0, space, info)) return 0; break; case slang_oper_minus: if (!call_function_name (file, "-", op->children, 1, 0, space, info)) return 0; break; /*case slang_oper_complement:*/ case slang_oper_not: if (!call_function_name (file, "!", op->children, 1, 0, space, info)) return 0; break; case slang_oper_subscript: { slang_assembly_stack_info _stk; slang_assembly_typeinfo ti_arr, ti_elem; unsigned int arr_size = 0, elem_size = 0; if (!_slang_assemble_operation (file, op->children, reference, flow, space, info, &_stk)) return 0; if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &_stk)) return 0; slang_assembly_typeinfo_construct (&ti_arr); if (!_slang_typeof_operation (op->children, space, &ti_arr)) { slang_assembly_typeinfo_destruct (&ti_arr); return 0; } if (!sizeof_variable (&ti_arr.spec, slang_qual_none, NULL, space, &arr_size)) { slang_assembly_typeinfo_destruct (&ti_arr); return 0; } slang_assembly_typeinfo_construct (&ti_elem); if (!_slang_typeof_operation (op, space, &ti_elem)) { slang_assembly_typeinfo_destruct (&ti_arr); slang_assembly_typeinfo_destruct (&ti_elem); return 0; } if (!sizeof_variable (&ti_elem.spec, slang_qual_none, NULL, space, &elem_size)) { slang_assembly_typeinfo_destruct (&ti_arr); slang_assembly_typeinfo_destruct (&ti_elem); return 0; } if (!slang_assembly_file_push (file, slang_asm_int_to_addr)) { slang_assembly_typeinfo_destruct (&ti_arr); slang_assembly_typeinfo_destruct (&ti_elem); return 0; } if (!slang_assembly_file_push_label (file, slang_asm_addr_push, elem_size)) { slang_assembly_typeinfo_destruct (&ti_arr); slang_assembly_typeinfo_destruct (&ti_elem); return 0; } if (!slang_assembly_file_push (file, slang_asm_addr_multiply)) { slang_assembly_typeinfo_destruct (&ti_arr); slang_assembly_typeinfo_destruct (&ti_elem); return 0; } if (reference) { if (!slang_assembly_file_push (file, slang_asm_addr_add)) { slang_assembly_typeinfo_destruct (&ti_arr); slang_assembly_typeinfo_destruct (&ti_elem); return 0; } } else { unsigned int i; for (i = 0; i < elem_size; i += 4) { if (!slang_assembly_file_push_label2 (file, slang_asm_float_move, arr_size - elem_size + i + 4, i + 4)) { slang_assembly_typeinfo_destruct (&ti_arr); slang_assembly_typeinfo_destruct (&ti_elem); return 0; } } if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4)) { slang_assembly_typeinfo_destruct (&ti_arr); slang_assembly_typeinfo_destruct (&ti_elem); return 0; } if (!slang_assembly_file_push_label (file, slang_asm_local_free, arr_size - elem_size)) { slang_assembly_typeinfo_destruct (&ti_arr); slang_assembly_typeinfo_destruct (&ti_elem); return 0; } } slang_assembly_typeinfo_destruct (&ti_arr); slang_assembly_typeinfo_destruct (&ti_elem); } break; case slang_oper_call: { slang_function *fun = _slang_locate_function (op->identifier, op->children, op->num_children, space); if (fun == NULL) { if (!_slang_assemble_constructor (file, op, flow, space, info)) return 0; } else { if (!call_function (file, fun, op->children, op->num_children, 0, space, info)) return 0; } } break; case slang_oper_field: { slang_assembly_typeinfo ti_after, ti_before; slang_assembly_stack_info _stk; slang_assembly_typeinfo_construct (&ti_after); if (!_slang_typeof_operation (op, space, &ti_after)) { slang_assembly_typeinfo_destruct (&ti_after); return 0; } slang_assembly_typeinfo_construct (&ti_before); if (!_slang_typeof_operation (op->children, space, &ti_before)) { slang_assembly_typeinfo_destruct (&ti_after); slang_assembly_typeinfo_destruct (&ti_before); return 0; } if (!reference && ti_after.is_swizzled) { if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->swizzle_tmp, 16)) { slang_assembly_typeinfo_destruct (&ti_after); slang_assembly_typeinfo_destruct (&ti_before); return 0; } } if (!_slang_assemble_operation (file, op->children, reference, flow, space, info, &_stk)) { slang_assembly_typeinfo_destruct (&ti_after); slang_assembly_typeinfo_destruct (&ti_before); return 0; } /* TODO: inspect stk */ if (ti_after.is_swizzled) { if (reference) { if (ti_after.swz.num_components == 1) { if (!slang_assembly_file_push_label (file, slang_asm_addr_push, ti_after.swz.swizzle[0] * 4)) { slang_assembly_typeinfo_destruct (&ti_after); slang_assembly_typeinfo_destruct (&ti_before); return 0; } if (!slang_assembly_file_push (file, slang_asm_addr_add)) { slang_assembly_typeinfo_destruct (&ti_after); slang_assembly_typeinfo_destruct (&ti_before); return 0; } } else { unsigned int i; for (i = 0; i < ti_after.swz.num_components; i++) stk->swizzle_mask |= 1 << ti_after.swz.swizzle[i]; } } else { if (!_slang_assemble_constructor_from_swizzle (file, &ti_after.swz, &ti_after.spec, &ti_before.spec, info)) { slang_assembly_typeinfo_destruct (&ti_after); slang_assembly_typeinfo_destruct (&ti_before); return 0; } } } else { if (reference) { /* TODO: struct field address */ } else { /* TODO: struct field value */ } } slang_assembly_typeinfo_destruct (&ti_after); slang_assembly_typeinfo_destruct (&ti_before); } break; case slang_oper_postincrement: if (!call_function_name_dummyint (file, "++", op->children, space, info)) return 0; if (!dereference (file, op, space, info)) return 0; break; case slang_oper_postdecrement: if (!call_function_name_dummyint (file, "--", op->children, space, info)) return 0; if (!dereference (file, op, space, info)) return 0; break; default: return 0; } return 1; } void xxx_first (slang_assembly_file *file) { slang_assembly_file_push (file, slang_asm_jump); } void xxx_prolog (slang_assembly_file *file, unsigned int addr) { file->code[0].param[0] = file->count; slang_assembly_file_push_label (file, slang_asm_call, addr); slang_assembly_file_push (file, slang_asm_exit); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_conditional.c0000644000000000000000000003274313614532424025306 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file slang_assemble_conditional.c * slang condtional expressions assembler * \author Michal Krol */ #include "imports.h" #include "slang_utility.h" #include "slang_assemble_conditional.h" #include "slang_assemble.h" /* _slang_assemble_logicaland() */ int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info) { /* and: jumpz zero jump end zero: push 0 end: */ unsigned int zero_jump, end_jump; slang_assembly_stack_info stk; /* evaluate left expression */ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ /* jump to pushing 0 if not true */ zero_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump_if_zero)) return 0; /* evaluate right expression */ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ /* jump to the end of the expression */ end_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump)) return 0; /* push 0 on stack */ file->code[zero_jump].param[0] = file->count; if (!slang_assembly_file_push (file, slang_asm_bool_push)) return 0; /* the end of the expression */ file->code[end_jump].param[0] = file->count; return 1; } /* _slang_assemble_logicalor() */ int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info) { /* or: jumpz right push 1 jump end right: end: */ unsigned int right_jump, end_jump; slang_assembly_stack_info stk; /* evaluate left expression */ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ /* jump to evaluation of right expression if not true */ right_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump_if_zero)) return 0; /* push 1 on stack */ if (!slang_assembly_file_push_literal (file, slang_asm_bool_push, 1.0f)) return 0; /* jump to the end of the expression */ end_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump)) return 0; /* evaluate right expression */ file->code[right_jump].param[0] = file->count; if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ /* the end of the expression */ file->code[end_jump].param[0] = file->count; return 1; } /* _slang_assemble_select() */ int _slang_assemble_select (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info) { /* select: jumpz false jump end false: end: */ unsigned int cond_jump, end_jump; slang_assembly_stack_info stk; /* execute condition expression */ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ /* jump to false expression if not true */ cond_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump_if_zero)) return 0; /* execute true expression */ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ /* jump to the end of the expression */ end_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump)) return 0; /* resolve false point */ file->code[cond_jump].param[0] = file->count; /* execute false expression */ if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ /* resolve the end of the expression */ file->code[end_jump].param[0] = file->count; return 1; } /* _slang_assemble_for() */ int _slang_assemble_for (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info) { /* for: jump start break: jump end continue: start: jumpz end jump continue end: */ unsigned int start_jump, end_jump, cond_jump; unsigned int break_label, cont_label; slang_assembly_flow_control loop_flow = *flow; slang_assembly_stack_info stk; /* execute initialization statement */ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) return 0; /* TODO: pass-in stk to cleanup */ if (!_slang_cleanup_stack (file, op->children, 0, space)) return 0; /* skip the "go to the end of the loop" and loop-increment statements */ start_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump)) return 0; /* go to the end of the loop - break statements are directed here */ break_label = file->count; end_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump)) return 0; /* resolve the beginning of the loop - continue statements are directed here */ cont_label = file->count; /* execute loop-increment statement */ if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk)) return 0; /* TODO: pass-in stk to cleanup */ if (!_slang_cleanup_stack (file, op->children + 2, 0, space)) return 0; /* resolve the condition point */ file->code[start_jump].param[0] = file->count; /* execute condition statement */ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) return 0; /* TODO: inspect stk */ /* jump to the end of the loop if not true */ cond_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump_if_zero)) return 0; /* execute loop body */ loop_flow.loop_start = cont_label; loop_flow.loop_end = break_label; if (!_slang_assemble_operation (file, op->children + 3, 0, &loop_flow, space, info, &stk)) return 0; /* TODO: pass-in stk to cleanup */ if (!_slang_cleanup_stack (file, op->children + 3, 0, space)) return 0; /* go to the beginning of the loop */ if (!slang_assembly_file_push_label (file, slang_asm_jump, cont_label)) return 0; /* resolve the end of the loop */ file->code[end_jump].param[0] = file->count; file->code[cond_jump].param[0] = file->count; return 1; } /* _slang_assemble_do() */ int _slang_assemble_do (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info) { /* do: jump start break: jump end continue: jump condition start: condition: jumpz end jump start end: */ unsigned int skip_jump, end_jump, cont_jump, cond_jump; unsigned int break_label, cont_label; slang_assembly_flow_control loop_flow = *flow; slang_assembly_stack_info stk; /* skip the "go to the end of the loop" and "go to condition" statements */ skip_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump)) return 0; /* go to the end of the loop - break statements are directed here */ break_label = file->count; end_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump)) return 0; /* go to condition - continue statements are directed here */ cont_label = file->count; cont_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump)) return 0; /* resolve the beginning of the loop */ file->code[skip_jump].param[0] = file->count; /* execute loop body */ loop_flow.loop_start = cont_label; loop_flow.loop_end = break_label; if (!_slang_assemble_operation (file, op->children, 0, &loop_flow, space, info, &stk)) return 0; /* TODO: pass-in stk to cleanup */ if (!_slang_cleanup_stack (file, op->children, 0, space)) return 0; /* resolve condition point */ file->code[cont_jump].param[0] = file->count; /* execute condition statement */ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) return 0; /* TODO: pass-in stk to cleanup */ /* jump to the end of the loop if not true */ cond_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump_if_zero)) return 0; /* jump to the beginning of the loop */ if (!slang_assembly_file_push_label (file, slang_asm_jump, file->code[skip_jump].param[0])) return 0; /* resolve the end of the loop */ file->code[end_jump].param[0] = file->count; file->code[cond_jump].param[0] = file->count; return 1; } /* _slang_assemble_while() */ int _slang_assemble_while (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info) { /* while: jump continue break: jump end continue: jumpz end jump continue end: */ unsigned int skip_jump, end_jump, cond_jump; unsigned int break_label; slang_assembly_flow_control loop_flow = *flow; slang_assembly_stack_info stk; /* skip the "go to the end of the loop" statement */ skip_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump)) return 0; /* go to the end of the loop - break statements are directed here */ break_label = file->count; end_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump)) return 0; /* resolve the beginning of the loop - continue statements are directed here */ file->code[skip_jump].param[0] = file->count; /* execute condition statement */ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) return 0; /* TODO: pass-in stk to cleanup */ /* jump to the end of the loop if not true */ cond_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump_if_zero)) return 0; /* execute loop body */ loop_flow.loop_start = file->code[skip_jump].param[0]; loop_flow.loop_end = break_label; if (!_slang_assemble_operation (file, op->children + 1, 0, &loop_flow, space, info, &stk)) return 0; /* TODO: pass-in stk to cleanup */ if (!_slang_cleanup_stack (file, op->children + 1, 0, space)) return 0; /* jump to the beginning of the loop */ if (!slang_assembly_file_push_label (file, slang_asm_jump, file->code[skip_jump].param[0])) return 0; /* resolve the end of the loop */ file->code[end_jump].param[0] = file->count; file->code[cond_jump].param[0] = file->count; return 1; } /* _slang_assemble_if() */ int _slang_assemble_if (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info) { /* if: jumpz else jump end else: end: */ unsigned int cond_jump, else_jump; slang_assembly_stack_info stk; /* execute condition statement */ if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk)) return 0; /* TODO: pass-in stk to cleanup */ /* jump to false-statement if not true */ cond_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump_if_zero)) return 0; /* execute true-statement */ if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk)) return 0; /* TODO: pass-in stk to cleanup */ if (!_slang_cleanup_stack (file, op->children + 1, 0, space)) return 0; /* skip if-false statement */ else_jump = file->count; if (!slang_assembly_file_push (file, slang_asm_jump)) return 0; /* resolve start of false-statement */ file->code[cond_jump].param[0] = file->count; /* execute false-statement */ if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk)) return 0; /* TODO: pass-in stk to cleanup */ if (!_slang_cleanup_stack (file, op->children + 2, 0, space)) return 0; /* resolve end of if-false statement */ file->code[else_jump].param[0] = file->count; return 1; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_conditional.h0000644000000000000000000000520413614532424025303 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if !defined SLANG_ASSEMBLE_CONDITIONAL_H #define SLANG_ASSEMBLE_CONDITIONAL_H #include "slang_assemble.h" #if defined __cplusplus extern "C" { #endif int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info); int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info); int _slang_assemble_select (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info); int _slang_assemble_for (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info); int _slang_assemble_do (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info); int _slang_assemble_while (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info); int _slang_assemble_if (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info); #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_constructor.c0000644000000000000000000002122413614532424025360 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file slang_assemble_constructor.c * slang constructor and vector swizzle assembler * \author Michal Krol */ #include "imports.h" #include "slang_utility.h" #include "slang_assemble_constructor.h" #include "slang_assemble_typeinfo.h" #include "slang_storage.h" /* _slang_is_swizzle() */ int _slang_is_swizzle (const char *field, unsigned int rows, slang_swizzle *swz) { unsigned int i; int xyzw = 0, rgba = 0, stpq = 0; /* the swizzle can be at most 4-component long */ swz->num_components = slang_string_length (field); if (swz->num_components > 4) return 0; for (i = 0; i < swz->num_components; i++) { /* mark which swizzle group is used */ switch (field[i]) { case 'x': case 'y': case 'z': case 'w': xyzw = 1; break; case 'r': case 'g': case 'b': case 'a': rgba = 1; break; case 's': case 't': case 'p': case 'q': stpq = 1; break; default: return 0; } /* collect swizzle component */ switch (field[i]) { case 'x': case 'r': case 's': swz->swizzle[i] = 0; break; case 'y': case 'g': case 't': if (rows < 2) return 0; swz->swizzle[i] = 1; break; case 'z': case 'b': case 'p': if (rows < 3) return 0; swz->swizzle[i] = 2; break; case 'w': case 'a': case 'q': if (rows < 4) return 0; swz->swizzle[i] = 3; break; } } /* only one swizzle group can be used */ if ((xyzw && rgba) || (xyzw && stpq) || (rgba && stpq)) return 0; return 1; } /* _slang_is_swizzle_mask() */ int _slang_is_swizzle_mask (const slang_swizzle *swz, unsigned int rows) { unsigned int c, i; if (swz->num_components > rows) return 0; c = swz->swizzle[0]; for (i = 1; i < swz->num_components; i++) { if (swz->swizzle[i] <= c) return 0; c = swz->swizzle[i]; } return 1; } /* _slang_multiply_swizzles() */ void _slang_multiply_swizzles (slang_swizzle *dst, const slang_swizzle *left, const slang_swizzle *right) { unsigned int i; dst->num_components = right->num_components; for (i = 0; i < right->num_components; i++) dst->swizzle[i] = left->swizzle[right->swizzle[i]]; } /* _slang_assemble_constructor() */ static int constructor_aggregate (slang_assembly_file *file, const slang_storage_aggregate *flat, unsigned int *index, slang_operation *op, unsigned int size, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info) { slang_assembly_typeinfo ti; int result; slang_storage_aggregate agg, flat_agg; slang_assembly_stack_info stk; unsigned int i; slang_assembly_typeinfo_construct (&ti); if (!(result = _slang_typeof_operation (op, space, &ti))) goto end1; slang_storage_aggregate_construct (&agg); if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs))) goto end2; slang_storage_aggregate_construct (&flat_agg); if (!(result = _slang_flatten_aggregate (&flat_agg, &agg))) goto end; if (!(result = _slang_assemble_operation (file, op, 0, flow, space, info, &stk))) goto end; for (i = 0; i < flat_agg.count; i++) { const slang_storage_array *arr1 = flat_agg.arrays + i; const slang_storage_array *arr2 = flat->arrays + *index; if (arr1->type != arr2->type) { /* TODO: convert (generic) from arr1 to arr2 */ } (*index)++; /* TODO: watch the index, if it reaches the size, pop off the stack subsequent values */ } result = 1; end: slang_storage_aggregate_destruct (&flat_agg); end2: slang_storage_aggregate_destruct (&agg); end1: slang_assembly_typeinfo_destruct (&ti); return result; } /* XXX: general swizzle! */ int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info) { slang_assembly_typeinfo ti; int result; slang_storage_aggregate agg, flat; unsigned int size, index, i; slang_assembly_typeinfo_construct (&ti); if (!(result = _slang_typeof_operation (op, space, &ti))) goto end1; slang_storage_aggregate_construct (&agg); if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs))) goto end2; size = _slang_sizeof_aggregate (&agg); slang_storage_aggregate_construct (&flat); if (!(result = _slang_flatten_aggregate (&flat, &agg))) goto end; index = 0; for (i = 0; i < op->num_children; i++) { if (!(result = constructor_aggregate (file, &flat, &index, op->children + i, size, flow, space, info))) goto end; /* TODO: watch the index, if it reaches the size, raise an error */ } result = 1; end: slang_storage_aggregate_destruct (&flat); end2: slang_storage_aggregate_destruct (&agg); end1: slang_assembly_typeinfo_destruct (&ti); return result; } /* _slang_assemble_constructor_from_swizzle() */ /* XXX: wrong */ int _slang_assemble_constructor_from_swizzle (slang_assembly_file *file, const slang_swizzle *swz, slang_type_specifier *spec, slang_type_specifier *master_spec, slang_assembly_local_info *info) { unsigned int master_rows, i; switch (master_spec->type) { case slang_spec_bool: case slang_spec_int: case slang_spec_float: master_rows = 1; break; case slang_spec_bvec2: case slang_spec_ivec2: case slang_spec_vec2: master_rows = 2; break; case slang_spec_bvec3: case slang_spec_ivec3: case slang_spec_vec3: master_rows = 3; break; case slang_spec_bvec4: case slang_spec_ivec4: case slang_spec_vec4: master_rows = 4; break; default: break; } for (i = 0; i < master_rows; i++) { switch (master_spec->type) { case slang_spec_bool: case slang_spec_bvec2: case slang_spec_bvec3: case slang_spec_bvec4: if (!slang_assembly_file_push_label2 (file, slang_asm_bool_copy, (master_rows - i) * 4, i * 4)) return 0; break; case slang_spec_int: case slang_spec_ivec2: case slang_spec_ivec3: case slang_spec_ivec4: if (!slang_assembly_file_push_label2 (file, slang_asm_int_copy, (master_rows - i) * 4, i * 4)) return 0; break; case slang_spec_float: case slang_spec_vec2: case slang_spec_vec3: case slang_spec_vec4: if (!slang_assembly_file_push_label2 (file, slang_asm_float_copy, (master_rows - i) * 4, i * 4)) return 0; break; default: break; } } if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4)) return 0; for (i = swz->num_components; i > 0; i--) { unsigned int n = i - 1; if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->swizzle_tmp, 16)) return 0; if (!slang_assembly_file_push_label (file, slang_asm_addr_push, swz->swizzle[n] * 4)) return 0; if (!slang_assembly_file_push (file, slang_asm_addr_add)) return 0; switch (master_spec->type) { case slang_spec_bool: case slang_spec_bvec2: case slang_spec_bvec3: case slang_spec_bvec4: if (!slang_assembly_file_push (file, slang_asm_bool_deref)) return 0; break; case slang_spec_int: case slang_spec_ivec2: case slang_spec_ivec3: case slang_spec_ivec4: if (!slang_assembly_file_push (file, slang_asm_int_deref)) return 0; break; case slang_spec_float: case slang_spec_vec2: case slang_spec_vec3: case slang_spec_vec4: if (!slang_assembly_file_push (file, slang_asm_float_deref)) return 0; break; default: break; } } return 1; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_constructor.h0000644000000000000000000000554713614532424025377 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if !defined SLANG_ASSEMBLE_CONSTRUCTOR_H #define SLANG_ASSEMBLE_CONSTRUCTOR_H #include "slang_assemble.h" #include "slang_compile.h" #if defined __cplusplus extern "C" { #endif /* holds a complete information about vector swizzle - the array contains vector component sources indices, where 0 is "x", 1 is "y", ... example: "xwz" --> { 3, { 0, 3, 2, n/u } } */ typedef struct slang_swizzle_ { unsigned int num_components; unsigned int swizzle[4]; } slang_swizzle; /* checks if a field selector is a general swizzle (an r-value swizzle with replicated components or an l-value swizzle mask) for a vector returns 1 if this is the case, is filled with swizzle information returns 0 otherwise */ int _slang_is_swizzle (const char *field, unsigned int rows, slang_swizzle *swz); /* checks if a general swizzle is an l-value swizzle - these swizzles do not have duplicated fields and they are specified in order returns 1 if this is a swizzle mask returns 0 otherwise */ int _slang_is_swizzle_mask (const slang_swizzle *swz, unsigned int rows); /* combines two swizzles to form single swizzle example: "wzyx.yx" --> "zw" */ void _slang_multiply_swizzles (slang_swizzle *, const slang_swizzle *, const slang_swizzle *); int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info); int _slang_assemble_constructor_from_swizzle (slang_assembly_file *file, const slang_swizzle *swz, slang_type_specifier *spec, slang_type_specifier *master_spec, slang_assembly_local_info *info); #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble.h0000644000000000000000000001056313614532424022724 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if !defined SLANG_ASSEMBLE_H #define SLANG_ASSEMBLE_H #include "slang_compile.h" #if defined __cplusplus extern "C" { #endif typedef enum slang_assembly_type_ { /* core */ slang_asm_none, slang_asm_float_copy, slang_asm_float_move, slang_asm_float_push, slang_asm_float_deref, slang_asm_float_add, slang_asm_float_multiply, slang_asm_float_divide, slang_asm_float_negate, slang_asm_float_less, slang_asm_float_equal, slang_asm_float_to_int, slang_asm_int_copy, slang_asm_int_move, slang_asm_int_push, slang_asm_int_deref, slang_asm_int_to_float, slang_asm_int_to_addr, slang_asm_bool_copy, slang_asm_bool_move, slang_asm_bool_push, slang_asm_bool_deref, slang_asm_addr_copy, slang_asm_addr_push, slang_asm_addr_deref, slang_asm_addr_add, slang_asm_addr_multiply, slang_asm_jump, slang_asm_jump_if_zero, slang_asm_enter, slang_asm_leave, slang_asm_local_alloc, slang_asm_local_free, slang_asm_local_addr, slang_asm_call, slang_asm_return, slang_asm_discard, slang_asm_exit, slang_asm__last } slang_assembly_type; typedef struct slang_assembly_ { slang_assembly_type type; GLfloat literal; GLuint param[2]; } slang_assembly; typedef struct slang_assembly_file_ { slang_assembly *code; unsigned int count; } slang_assembly_file; void slang_assembly_file_construct (slang_assembly_file *); void slang_assembly_file_destruct (slang_assembly_file *); int slang_assembly_file_push (slang_assembly_file *, slang_assembly_type); int slang_assembly_file_push_label (slang_assembly_file *, slang_assembly_type, GLuint); int slang_assembly_file_push_label2 (slang_assembly_file *, slang_assembly_type, GLuint, GLuint); int slang_assembly_file_push_literal (slang_assembly_file *, slang_assembly_type, GLfloat); typedef struct slang_assembly_flow_control_ { unsigned int loop_start; /* for "continue" statement */ unsigned int loop_end; /* for "break" statement */ unsigned int function_end; /* for "return" statement */ } slang_assembly_flow_control; typedef struct slang_assembly_name_space_ { struct slang_function_scope_ *funcs; struct slang_struct_scope_ *structs; struct slang_variable_scope_ *vars; } slang_assembly_name_space; slang_function *_slang_locate_function (const char *name, slang_operation *params, unsigned int num_params, slang_assembly_name_space *space); int _slang_assemble_function (slang_assembly_file *, struct slang_function_ *, slang_assembly_name_space *); typedef struct slang_assembly_stack_info_ { unsigned int swizzle_mask; } slang_assembly_stack_info; int _slang_cleanup_stack (slang_assembly_file *, slang_operation *, int ref, slang_assembly_name_space *); typedef struct slang_assembly_local_info_ { unsigned int ret_size; unsigned int addr_tmp; unsigned int swizzle_tmp; } slang_assembly_local_info; int _slang_assemble_operation (slang_assembly_file *, struct slang_operation_ *, int reference, slang_assembly_flow_control *, slang_assembly_name_space *, slang_assembly_local_info *, slang_assembly_stack_info *); void xxx_first (slang_assembly_file *); void xxx_prolog (slang_assembly_file *, unsigned int); #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_typeinfo.c0000644000000000000000000002572613614532424024643 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file slang_assemble_typeinfo.c * slang type info * \author Michal Krol */ #include "imports.h" #include "slang_utility.h" #include "slang_assemble_typeinfo.h" /* slang_assembly_typeinfo */ void slang_assembly_typeinfo_construct (slang_assembly_typeinfo *ti) { slang_type_specifier_construct (&ti->spec); } void slang_assembly_typeinfo_destruct (slang_assembly_typeinfo *ti) { slang_type_specifier_destruct (&ti->spec); } /* _slang_typeof_operation() */ int _slang_typeof_operation (slang_operation *op, slang_assembly_name_space *space, slang_assembly_typeinfo *ti) { ti->can_be_referenced = 0; ti->is_swizzled = 0; switch (op->type) { case slang_oper_block_no_new_scope: case slang_oper_block_new_scope: case slang_oper_variable_decl: case slang_oper_asm: case slang_oper_break: case slang_oper_continue: case slang_oper_discard: case slang_oper_return: case slang_oper_if: case slang_oper_while: case slang_oper_do: case slang_oper_for: case slang_oper_void: ti->spec.type = slang_spec_void; break; case slang_oper_expression: case slang_oper_assign: case slang_oper_addassign: case slang_oper_subassign: case slang_oper_mulassign: case slang_oper_divassign: case slang_oper_preincrement: case slang_oper_predecrement: if (!_slang_typeof_operation (op->children, space, ti)) return 0; break; case slang_oper_literal_bool: case slang_oper_logicalor: case slang_oper_logicalxor: case slang_oper_logicaland: case slang_oper_equal: case slang_oper_notequal: case slang_oper_less: case slang_oper_greater: case slang_oper_lessequal: case slang_oper_greaterequal: case slang_oper_not: ti->spec.type = slang_spec_bool; break; case slang_oper_literal_int: ti->spec.type = slang_spec_int; break; case slang_oper_literal_float: ti->spec.type = slang_spec_float; break; case slang_oper_identifier: { slang_variable *var; var = _slang_locate_variable (op->locals, op->identifier, 1); if (var == NULL) return 0; if (!slang_type_specifier_copy (&ti->spec, &var->type.specifier)) return 0; ti->can_be_referenced = 1; } break; case slang_oper_sequence: /* TODO: check [0] and [1] if they match */ if (!_slang_typeof_operation (op->children + 1, space, ti)) return 0; ti->can_be_referenced = 0; ti->is_swizzled = 0; break; /*case slang_oper_modassign:*/ /*case slang_oper_lshassign:*/ /*case slang_oper_rshassign:*/ /*case slang_oper_orassign:*/ /*case slang_oper_xorassign:*/ /*case slang_oper_andassign:*/ case slang_oper_select: /* TODO: check [1] and [2] if they match */ if (!_slang_typeof_operation (op->children + 1, space, ti)) return 0; ti->can_be_referenced = 0; ti->is_swizzled = 0; break; /*case slang_oper_bitor:*/ /*case slang_oper_bitxor:*/ /*case slang_oper_bitand:*/ /*case slang_oper_lshift:*/ /*case slang_oper_rshift:*/ case slang_oper_add: { int exists; if (!_slang_typeof_function ("+", op->children, 2, space, &ti->spec, &exists)) return 0; if (!exists) return 0; } break; case slang_oper_subtract: { int exists; if (!_slang_typeof_function ("-", op->children, 2, space, &ti->spec, &exists)) return 0; if (!exists) return 0; } break; case slang_oper_multiply: { int exists; if (!_slang_typeof_function ("*", op->children, 2, space, &ti->spec, &exists)) return 0; if (!exists) return 0; } break; case slang_oper_divide: { int exists; if (!_slang_typeof_function ("/", op->children, 2, space, &ti->spec, &exists)) return 0; if (!exists) return 0; } break; /*case slang_oper_modulus:*/ case slang_oper_plus: { int exists; if (!_slang_typeof_function ("+", op->children, 1, space, &ti->spec, &exists)) return 0; if (!exists) return 0; } break; case slang_oper_minus: { int exists; if (!_slang_typeof_function ("-", op->children, 1, space, &ti->spec, &exists)) return 0; if (!exists) return 0; } break; /*case slang_oper_complement:*/ case slang_oper_subscript: { slang_assembly_typeinfo _ti; slang_assembly_typeinfo_construct (&_ti); if (!_slang_typeof_operation (op->children, space, &_ti)) { slang_assembly_typeinfo_destruct (&_ti); return 0; } ti->can_be_referenced = _ti.can_be_referenced; switch (_ti.spec.type) { case slang_spec_bvec2: case slang_spec_bvec3: case slang_spec_bvec4: ti->spec.type = slang_spec_bool; break; case slang_spec_ivec2: case slang_spec_ivec3: case slang_spec_ivec4: ti->spec.type = slang_spec_int; break; case slang_spec_vec2: case slang_spec_vec3: case slang_spec_vec4: ti->spec.type = slang_spec_float; break; case slang_spec_mat2: ti->spec.type = slang_spec_vec2; break; case slang_spec_mat3: ti->spec.type = slang_spec_vec3; break; case slang_spec_mat4: ti->spec.type = slang_spec_vec4; break; case slang_spec_array: if (!slang_type_specifier_copy (&ti->spec, _ti.spec._array)) { slang_assembly_typeinfo_destruct (&_ti); return 0; } break; default: slang_assembly_typeinfo_destruct (&_ti); return 0; } slang_assembly_typeinfo_destruct (&_ti); } break; case slang_oper_call: { int exists; if (!_slang_typeof_function (op->identifier, op->children, op->num_children, space, &ti->spec, &exists)) return 0; if (!exists) { slang_struct *s = slang_struct_scope_find (space->structs, op->identifier, 1); if (s != NULL) { ti->spec.type = slang_spec_struct; ti->spec._struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct)); if (ti->spec._struct == NULL) return 0; if (!slang_struct_construct_a (ti->spec._struct)) { slang_alloc_free (ti->spec._struct); ti->spec._struct = NULL; return 0; } if (!slang_struct_copy (ti->spec._struct, s)) return 0; } else { slang_type_specifier_type type = slang_type_specifier_type_from_string ( op->identifier); if (type == slang_spec_void) return 0; ti->spec.type = type; } } } break; case slang_oper_field: { slang_assembly_typeinfo _ti; slang_assembly_typeinfo_construct (&_ti); if (!_slang_typeof_operation (op->children, space, &_ti)) { slang_assembly_typeinfo_destruct (&_ti); return 0; } if (_ti.spec.type == slang_spec_struct) { slang_variable *field = _slang_locate_variable (_ti.spec._struct->fields, op->identifier, 0); if (field == NULL) { slang_assembly_typeinfo_destruct (&_ti); return 0; } if (!slang_type_specifier_copy (&ti->spec, &field->type.specifier)) { slang_assembly_typeinfo_destruct (&_ti); return 0; } } else { unsigned int rows; switch (_ti.spec.type) { case slang_spec_vec2: case slang_spec_ivec2: case slang_spec_bvec2: rows = 2; break; case slang_spec_vec3: case slang_spec_ivec3: case slang_spec_bvec3: rows = 3; break; case slang_spec_vec4: case slang_spec_ivec4: case slang_spec_bvec4: rows = 4; break; default: slang_assembly_typeinfo_destruct (&_ti); return 0; } if (!_slang_is_swizzle (op->identifier, rows, &ti->swz)) return 0; ti->is_swizzled = 1; ti->can_be_referenced = _ti.can_be_referenced && _slang_is_swizzle_mask (&ti->swz, rows); if (_ti.is_swizzled) { slang_swizzle swz; _slang_multiply_swizzles (&swz, &_ti.swz, &ti->swz); ti->swz = swz; } switch (_ti.spec.type) { case slang_spec_vec2: case slang_spec_vec3: case slang_spec_vec4: switch (ti->swz.num_components) { case 1: ti->spec.type = slang_spec_float; break; case 2: ti->spec.type = slang_spec_vec2; break; case 3: ti->spec.type = slang_spec_vec3; break; case 4: ti->spec.type = slang_spec_vec4; break; } break; case slang_spec_ivec2: case slang_spec_ivec3: case slang_spec_ivec4: switch (ti->swz.num_components) { case 1: ti->spec.type = slang_spec_int; break; case 2: ti->spec.type = slang_spec_ivec2; break; case 3: ti->spec.type = slang_spec_ivec3; break; case 4: ti->spec.type = slang_spec_ivec4; break; } break; case slang_spec_bvec2: case slang_spec_bvec3: case slang_spec_bvec4: switch (ti->swz.num_components) { case 1: ti->spec.type = slang_spec_bool; break; case 2: ti->spec.type = slang_spec_bvec2; break; case 3: ti->spec.type = slang_spec_bvec3; break; case 4: ti->spec.type = slang_spec_bvec4; break; } break; default: break; } } slang_assembly_typeinfo_destruct (&_ti); return 1; } break; case slang_oper_postincrement: case slang_oper_postdecrement: if (!_slang_typeof_operation (op->children, space, ti)) return 0; ti->can_be_referenced = 0; ti->is_swizzled = 0; break; default: return 0; } return 1; } /* _slang_typeof_function() */ int _slang_typeof_function (const char *name, slang_operation *params, unsigned int num_params, slang_assembly_name_space *space, slang_type_specifier *spec, int *exists) { slang_function *fun = _slang_locate_function (name, params, num_params, space); *exists = fun != NULL; if (fun == NULL) return 1; return slang_type_specifier_copy (spec, &fun->header.type.specifier); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_assemble_typeinfo.h0000644000000000000000000000433513614532424024641 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if !defined SLANG_ASSEMBLE_TYPEINFO_H #define SLANG_ASSEMBLE_TYPEINFO_H #include "slang_assemble_constructor.h" #include "slang_compile.h" #if defined __cplusplus extern "C" { #endif typedef struct slang_assembly_typeinfo_ { int can_be_referenced; int is_swizzled; slang_swizzle swz; slang_type_specifier spec; } slang_assembly_typeinfo; void slang_assembly_typeinfo_construct (slang_assembly_typeinfo *); void slang_assembly_typeinfo_destruct (slang_assembly_typeinfo *); /* retrieves type information about an operation returns 1 on success returns 0 otherwise */ int _slang_typeof_operation (slang_operation *, slang_assembly_name_space *, slang_assembly_typeinfo *); /* retrieves type of a function prototype, if one exists returns 1 on success, even if the function was not found returns 0 otherwise */ int _slang_typeof_function (const char *name, slang_operation *params, unsigned int num_params, slang_assembly_name_space *space, slang_type_specifier *spec, int *exists); #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_compile.c0000644000000000000000000017433313614532424022562 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file slang_compile.c * slang front-end compiler * \author Michal Krol */ #include "imports.h" #include "grammar_mesa.h" #include "slang_utility.h" #include "slang_compile.h" #include "slang_preprocess.h" #include "slang_storage.h" #include "slang_assemble.h" #include "slang_execute.h" /* This is a straightforward implementation of the slang front-end compiler. Lots of error-checking functionality is missing but every well-formed shader source should compile successfully and execute as expected. However, some semantically ill-formed shaders may be accepted resulting in undefined behaviour. */ static void slang_variable_construct (slang_variable *); static int slang_variable_copy (slang_variable *, const slang_variable *); static void slang_struct_destruct (slang_struct *); static int slang_struct_equal (const slang_struct *, const slang_struct *); static void slang_variable_destruct (slang_variable *); /* slang_type_specifier_type */ /* these must match with slang_type_specifier_type enum */ static const char *type_specifier_type_names[] = { "void", "bool", "bvec2", "bvec3", "bvec4", "int", "ivec2", "ivec3", "ivec4", "float", "vec2", "vec3", "vec4", "mat2", "mat3", "mat4", "sampler1D", "sampler2D", "sampler3D", "samplerCube", "sampler1DShadow", "sampler2DShadow", NULL }; slang_type_specifier_type slang_type_specifier_type_from_string (const char *name) { const char **p = type_specifier_type_names; while (*p != NULL) { if (slang_string_compare (*p, name) == 0) return (slang_type_specifier_type) (p - type_specifier_type_names); p++; } return slang_spec_void; } /* slang_type_specifier */ void slang_type_specifier_construct (slang_type_specifier *spec) { spec->type = slang_spec_void; spec->_struct = NULL; spec->_array = NULL; } void slang_type_specifier_destruct (slang_type_specifier *spec) { if (spec->_struct != NULL) { slang_struct_destruct (spec->_struct); slang_alloc_free (spec->_struct); } if (spec->_array != NULL) { slang_type_specifier_destruct (spec->_array); slang_alloc_free (spec->_array); } } int slang_type_specifier_copy (slang_type_specifier *x, const slang_type_specifier *y) { slang_type_specifier_destruct (x); slang_type_specifier_construct (x); x->type = y->type; if (x->type == slang_spec_struct) { x->_struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct)); if (x->_struct == NULL) return 0; if (!slang_struct_construct_a (x->_struct)) { slang_alloc_free (x->_struct); x->_struct = NULL; return 0; } return slang_struct_copy (x->_struct, y->_struct); } if (x->type == slang_spec_array) { x->_array = (slang_type_specifier *) slang_alloc_malloc (sizeof (slang_type_specifier)); if (x->_array == NULL) return 0; slang_type_specifier_construct (x->_array); return slang_type_specifier_copy (x->_array, y->_array); } return 1; } int slang_type_specifier_equal (const slang_type_specifier *x, const slang_type_specifier *y) { if (x->type != y->type) return 0; if (x->type == slang_spec_struct) return slang_struct_equal (x->_struct, y->_struct); if (x->type == slang_spec_array) return slang_type_specifier_equal (x->_array, y->_array); return 1; } /* slang_fully_specified_type */ static void slang_fully_specified_type_construct (slang_fully_specified_type *type) { type->qualifier = slang_qual_none; slang_type_specifier_construct (&type->specifier); } static void slang_fully_specified_type_destruct (slang_fully_specified_type *type) { slang_type_specifier_destruct (&type->specifier); } static int slang_fully_specified_type_copy (slang_fully_specified_type *x, const slang_fully_specified_type *y) { slang_fully_specified_type_construct (x); slang_fully_specified_type_destruct (x); x->qualifier = y->qualifier; return slang_type_specifier_copy (&x->specifier, &y->specifier); } /* slang_variable_scope */ static void slang_variable_scope_construct (slang_variable_scope *scope) { scope->variables = NULL; scope->num_variables = 0; scope->outer_scope = NULL; } static void slang_variable_scope_destruct (slang_variable_scope *scope) { unsigned int i; for (i = 0; i < scope->num_variables; i++) slang_variable_destruct (scope->variables + i); slang_alloc_free (scope->variables); } static int slang_variable_scope_copy (slang_variable_scope *x, const slang_variable_scope *y) { unsigned int i; slang_variable_scope_destruct (x); slang_variable_scope_construct (x); x->variables = (slang_variable *) slang_alloc_malloc (y->num_variables * sizeof ( slang_variable)); if (x->variables == NULL) return 0; x->num_variables = y->num_variables; for (i = 0; i < x->num_variables; i++) slang_variable_construct (x->variables + i); for (i = 0; i < x->num_variables; i++) if (!slang_variable_copy (x->variables + i, y->variables + i)) return 0; x->outer_scope = y->outer_scope; return 1; } /* slang_operation */ int slang_operation_construct_a (slang_operation *oper) { oper->type = slang_oper_none; oper->children = NULL; oper->num_children = 0; oper->literal = (float) 0; oper->identifier = NULL; oper->locals = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope)); if (oper->locals == NULL) return 0; slang_variable_scope_construct (oper->locals); return 1; } void slang_operation_destruct (slang_operation *oper) { unsigned int i; for (i = 0; i < oper->num_children; i++) slang_operation_destruct (oper->children + i); slang_alloc_free (oper->children); slang_alloc_free (oper->identifier); slang_variable_scope_destruct (oper->locals); slang_alloc_free (oper->locals); } static int slang_operation_copy (slang_operation *x, const slang_operation *y) { unsigned int i; for (i = 0; i < x->num_children; i++) slang_operation_destruct (x->children + i); slang_alloc_free (x->children); x->num_children = 0; slang_alloc_free (x->identifier); x->identifier = NULL; slang_variable_scope_destruct (x->locals); slang_variable_scope_construct (x->locals); x->type = y->type; x->children = (slang_operation *) slang_alloc_malloc (y->num_children * sizeof ( slang_operation)); if (x->children == NULL) return 0; for (i = 0; i < y->num_children; i++) if (!slang_operation_construct_a (x->children + i)) { unsigned int j; for (j = 0; j < i; j++) slang_operation_destruct (x->children + j); slang_alloc_free (x->children); x->children = NULL; return 0; } x->num_children = y->num_children; for (i = 0; i < x->num_children; i++) if (!slang_operation_copy (x->children + i, y->children + i)) return 0; x->literal = y->literal; if (y->identifier != NULL) { x->identifier = slang_string_duplicate (y->identifier); if (x->identifier == NULL) return 0; } if (!slang_variable_scope_copy (x->locals, y->locals)) return 0; return 1; } /* slang_variable */ static void slang_variable_construct (slang_variable *var) { slang_fully_specified_type_construct (&var->type); var->name = NULL; var->array_size = NULL; var->initializer = NULL; var->address = ~0; } static void slang_variable_destruct (slang_variable *var) { slang_fully_specified_type_destruct (&var->type); slang_alloc_free (var->name); if (var->array_size != NULL) { slang_operation_destruct (var->array_size); slang_alloc_free (var->array_size); } if (var->initializer != NULL) { slang_operation_destruct (var->initializer); slang_alloc_free (var->initializer); } } static int slang_variable_copy (slang_variable *x, const slang_variable *y) { slang_variable_destruct (x); slang_variable_construct (x); if (!slang_fully_specified_type_copy (&x->type, &y->type)) return 0; if (y->name != NULL) { x->name = slang_string_duplicate (y->name); if (x->name == NULL) return 0; } if (y->array_size != NULL) { x->array_size = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation)); if (x->array_size == NULL) return 0; if (!slang_operation_construct_a (x->array_size)) { slang_alloc_free (x->array_size); x->array_size = NULL; return 0; } if (!slang_operation_copy (x->array_size, y->array_size)) return 0; } if (y->initializer != NULL) { x->initializer = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation)); if (x->initializer == NULL) return 0; if (!slang_operation_construct_a (x->initializer)) { slang_alloc_free (x->initializer); x->initializer = NULL; return 0; } if (!slang_operation_copy (x->initializer, y->initializer)) return 0; } return 1; } slang_variable *_slang_locate_variable (slang_variable_scope *scope, const char *name, int all) { unsigned int i; for (i = 0; i < scope->num_variables; i++) if (slang_string_compare (name, scope->variables[i].name) == 0) return scope->variables + i; if (all && scope->outer_scope != NULL) return _slang_locate_variable (scope->outer_scope, name, 1); return NULL; } /* slang_struct_scope */ static void slang_struct_scope_construct (slang_struct_scope *scope) { scope->structs = NULL; scope->num_structs = 0; scope->outer_scope = NULL; } static void slang_struct_scope_destruct (slang_struct_scope *scope) { unsigned int i; for (i = 0; i < scope->num_structs; i++) slang_struct_destruct (scope->structs + i); slang_alloc_free (scope->structs); } static int slang_struct_scope_copy (slang_struct_scope *x, const slang_struct_scope *y) { unsigned int i; slang_struct_scope_destruct (x); slang_struct_scope_construct (x); x->structs = (slang_struct *) slang_alloc_malloc (y->num_structs * sizeof (slang_struct)); if (x->structs == NULL) return 0; x->num_structs = y->num_structs; for (i = 0; i < x->num_structs; i++) { unsigned int j; if (!slang_struct_construct_a (x->structs + i)) { for (j = 0; j < i; j++) slang_struct_destruct (x->structs + j); slang_alloc_free (x->structs); x->structs = NULL; return 0; } } for (i = 0; i < x->num_structs; i++) if (!slang_struct_copy (x->structs + i, y->structs + i)) return 0; x->outer_scope = y->outer_scope; return 1; } slang_struct *slang_struct_scope_find (slang_struct_scope *stru, const char *name, int all_scopes) { unsigned int i; for (i = 0; i < stru->num_structs; i++) if (slang_string_compare (name, stru->structs[i].name) == 0) return stru->structs + i; if (all_scopes && stru->outer_scope != NULL) return slang_struct_scope_find (stru->outer_scope, name, 1); return NULL; } /* slang_struct */ int slang_struct_construct_a (slang_struct *stru) { stru->name = NULL; stru->fields = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope)); if (stru->fields == NULL) return 0; slang_variable_scope_construct (stru->fields); stru->structs = (slang_struct_scope *) slang_alloc_malloc (sizeof (slang_struct_scope)); if (stru->structs == NULL) { slang_variable_scope_destruct (stru->fields); slang_alloc_free (stru->fields); return 0; } slang_struct_scope_construct (stru->structs); return 1; } static void slang_struct_destruct (slang_struct *stru) { slang_alloc_free (stru->name); slang_variable_scope_destruct (stru->fields); slang_alloc_free (stru->fields); slang_struct_scope_destruct (stru->structs); slang_alloc_free (stru->structs); } int slang_struct_copy (slang_struct *x, const slang_struct *y) { slang_alloc_free (x->name); x->name = NULL; slang_variable_scope_destruct (x->fields); slang_variable_scope_construct (x->fields); slang_struct_scope_destruct (x->structs); slang_struct_scope_construct (x->structs); if (y->name != NULL) { x->name = slang_string_duplicate (y->name); if (x->name == NULL) return 0; } if (!slang_variable_scope_copy (x->fields, y->fields)) return 0; if (!slang_struct_scope_copy (x->structs, y->structs)) return 0; return 1; } static int slang_struct_equal (const slang_struct *x, const slang_struct *y) { unsigned int i; if (x->fields->num_variables != y->fields->num_variables) return 0; for (i = 0; i < x->fields->num_variables; i++) { slang_variable *varx = x->fields->variables + i; slang_variable *vary = y->fields->variables + i; if (slang_string_compare (varx->name, vary->name) != 0) return 0; if (!slang_type_specifier_equal (&varx->type.specifier, &vary->type.specifier)) return 0; if (varx->type.specifier.type == slang_spec_array) { /* TODO compare array sizes */ } } return 1; } /* slang_function */ /* XXX mem! */ static void slang_function_construct (slang_function *func) { func->kind = slang_func_ordinary; slang_variable_construct (&func->header); func->parameters = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope)); slang_variable_scope_construct (func->parameters); func->body = NULL; func->address = ~0; } static void slang_function_destruct (slang_function *func) { slang_variable_destruct (&func->header); slang_variable_scope_destruct (func->parameters); slang_alloc_free (func->parameters); if (func->body != NULL) { slang_operation_destruct (func->body); slang_alloc_free (func->body); } } /* slang_function_scope */ static void slang_function_scope_construct (slang_function_scope *scope) { scope->functions = NULL; scope->num_functions = 0; scope->outer_scope = NULL; } static void slang_function_scope_destruct (slang_function_scope *scope) { unsigned int i; for (i = 0; i < scope->num_functions; i++) slang_function_destruct (scope->functions + i); slang_alloc_free (scope->functions); } static int slang_function_scope_find_by_name (slang_function_scope *funcs, const char *name, int all_scopes) { unsigned int i; for (i = 0; i < funcs->num_functions; i++) if (slang_string_compare (name, funcs->functions[i].header.name) == 0) return 1; if (all_scopes && funcs->outer_scope != NULL) return slang_function_scope_find_by_name (funcs->outer_scope, name, 1); return 0; } static slang_function *slang_function_scope_find (slang_function_scope *funcs, slang_function *fun, int all_scopes) { unsigned int i; for (i = 0; i < funcs->num_functions; i++) { slang_function *f = funcs->functions + i; unsigned int j; if (slang_string_compare (fun->header.name, f->header.name) != 0) continue; if (fun->param_count != f->param_count) continue; for (j = 0; j < fun->param_count; j++) { if (!slang_type_specifier_equal (&fun->parameters->variables[j].type.specifier, &f->parameters->variables[j].type.specifier)) { break; } } if (j == fun->param_count) return f; } if (all_scopes && funcs->outer_scope != NULL) return slang_function_scope_find (funcs->outer_scope, fun, 1); return NULL; } /* slang_translation_unit */ void slang_translation_unit_construct (slang_translation_unit *unit) { slang_variable_scope_construct (&unit->globals); slang_function_scope_construct (&unit->functions); slang_struct_scope_construct (&unit->structs); } void slang_translation_unit_destruct (slang_translation_unit *unit) { slang_variable_scope_destruct (&unit->globals); slang_function_scope_destruct (&unit->functions); slang_struct_scope_destruct (&unit->structs); } /* slang_info_log */ static char *out_of_memory = "error: out of memory\n"; void slang_info_log_construct (slang_info_log *log) { log->text = NULL; log->dont_free_text = 0; } void slang_info_log_destruct (slang_info_log *log) { if (!log->dont_free_text) slang_alloc_free (log->text); } static int slang_info_log_message (slang_info_log *log, const char *prefix, const char *msg) { unsigned int new_size; if (log->dont_free_text) return 0; new_size = slang_string_length (prefix) + 3 + slang_string_length (msg); if (log->text != NULL) { log->text = (char *) slang_alloc_realloc (log->text, slang_string_length (log->text) + 1, new_size + slang_string_length (log->text) + 1); } else { log->text = (char *) slang_alloc_malloc (new_size + 1); if (log->text != NULL) *log->text = '\0'; } if (log->text == NULL) return 0; slang_string_concat (log->text, prefix); slang_string_concat (log->text, ": "); slang_string_concat (log->text, msg); slang_string_concat (log->text, "\n"); return 1; } int slang_info_log_error (slang_info_log *log, const char *msg, ...) { va_list va; char buf[1024]; va_start (va, msg); vsprintf (buf, msg, va); if (slang_info_log_message (log, "error", buf)) return 1; slang_info_log_memory (log); va_end (va); return 0; } int slang_info_log_warning (slang_info_log *log, const char *msg, ...) { va_list va; char buf[1024]; va_start (va, msg); vsprintf (buf, msg, va); if (slang_info_log_message (log, "warning", buf)) return 1; slang_info_log_memory (log); va_end (va); return 0; } void slang_info_log_memory (slang_info_log *log) { if (!slang_info_log_message (log, "error", "out of memory")) { log->dont_free_text = 1; log->text = out_of_memory; } } /* slang_parse_ctx */ typedef struct slang_parse_ctx_ { const byte *I; slang_info_log *L; int parsing_builtin; } slang_parse_ctx; /* _slang_compile() */ static int parse_identifier (slang_parse_ctx *C, char **id) { *id = slang_string_duplicate ((const char *) C->I); if (*id == NULL) { slang_info_log_memory (C->L); return 0; } C->I += strlen ((const char *) C->I) + 1; return 1; } static int parse_number (slang_parse_ctx *C, int *number) { const int radix = (int) (*C->I++); *number = 0; while (*C->I != '\0') { int digit; if (*C->I >= '0' && *C->I <= '9') digit = (int) (*C->I - '0'); else if (*C->I >= 'A' && *C->I <= 'Z') digit = (int) (*C->I - 'A') + 10; else digit = (int) (*C->I - 'a') + 10; *number = *number * radix + digit; C->I++; } C->I++; if (*number > 65535) slang_info_log_warning (C->L, "%d: literal integer overflow", *number); return 1; } static int parse_float (slang_parse_ctx *C, float *number) { char *integral = NULL; char *fractional = NULL; char *exponent = NULL; char *whole = NULL; if (!parse_identifier (C, &integral)) return 0; if (!parse_identifier (C, &fractional)) { slang_alloc_free (integral); return 0; } if (!parse_identifier (C, &exponent)) { slang_alloc_free (fractional); slang_alloc_free (integral); return 0; } whole = (char *) (slang_alloc_malloc ((strlen (integral) + strlen (fractional) + strlen ( exponent) + 3) * sizeof (char))); if (whole == NULL) { slang_alloc_free (exponent); slang_alloc_free (fractional); slang_alloc_free (integral); slang_info_log_memory (C->L); return 0; } slang_string_copy (whole, integral); slang_string_concat (whole, "."); slang_string_concat (whole, fractional); slang_string_concat (whole, "E"); slang_string_concat (whole, exponent); *number = (float) (atof (whole)); slang_alloc_free (whole); slang_alloc_free (exponent); slang_alloc_free (fractional); slang_alloc_free (integral); return 1; } /* revision number - increment after each change affecting emitted output */ #define REVISION 2 static int check_revision (slang_parse_ctx *C) { if (*C->I != REVISION) { slang_info_log_error (C->L, "internal compiler error"); return 0; } C->I++; return 1; } static int parse_statement (slang_parse_ctx *, slang_operation *, slang_variable_scope *, slang_struct_scope *, slang_function_scope *); static int parse_expression (slang_parse_ctx *, slang_operation *, slang_variable_scope *, slang_struct_scope *, slang_function_scope *); /* type qualifier */ #define TYPE_QUALIFIER_NONE 0 #define TYPE_QUALIFIER_CONST 1 #define TYPE_QUALIFIER_ATTRIBUTE 2 #define TYPE_QUALIFIER_VARYING 3 #define TYPE_QUALIFIER_UNIFORM 4 #define TYPE_QUALIFIER_FIXEDOUTPUT 5 #define TYPE_QUALIFIER_FIXEDINPUT 6 static int parse_type_qualifier (slang_parse_ctx *C, slang_type_qualifier *qual) { switch (*C->I++) { case TYPE_QUALIFIER_NONE: *qual = slang_qual_none; break; case TYPE_QUALIFIER_CONST: *qual = slang_qual_const; break; case TYPE_QUALIFIER_ATTRIBUTE: *qual = slang_qual_attribute; break; case TYPE_QUALIFIER_VARYING: *qual = slang_qual_varying; break; case TYPE_QUALIFIER_UNIFORM: *qual = slang_qual_uniform; break; case TYPE_QUALIFIER_FIXEDOUTPUT: *qual = slang_qual_fixedoutput; break; case TYPE_QUALIFIER_FIXEDINPUT: *qual = slang_qual_fixedinput; break; default: return 0; } return 1; } /* type specifier */ #define TYPE_SPECIFIER_VOID 0 #define TYPE_SPECIFIER_BOOL 1 #define TYPE_SPECIFIER_BVEC2 2 #define TYPE_SPECIFIER_BVEC3 3 #define TYPE_SPECIFIER_BVEC4 4 #define TYPE_SPECIFIER_INT 5 #define TYPE_SPECIFIER_IVEC2 6 #define TYPE_SPECIFIER_IVEC3 7 #define TYPE_SPECIFIER_IVEC4 8 #define TYPE_SPECIFIER_FLOAT 9 #define TYPE_SPECIFIER_VEC2 10 #define TYPE_SPECIFIER_VEC3 11 #define TYPE_SPECIFIER_VEC4 12 #define TYPE_SPECIFIER_MAT2 13 #define TYPE_SPECIFIER_MAT3 14 #define TYPE_SPECIFIER_MAT4 15 #define TYPE_SPECIFIER_SAMPLER1D 16 #define TYPE_SPECIFIER_SAMPLER2D 17 #define TYPE_SPECIFIER_SAMPLER3D 18 #define TYPE_SPECIFIER_SAMPLERCUBE 19 #define TYPE_SPECIFIER_SAMPLER1DSHADOW 20 #define TYPE_SPECIFIER_SAMPLER2DSHADOW 21 #define TYPE_SPECIFIER_STRUCT 22 #define TYPE_SPECIFIER_TYPENAME 23 /* structure field */ #define FIELD_NONE 0 #define FIELD_NEXT 1 #define FIELD_ARRAY 2 static int parse_type_specifier (slang_parse_ctx *C, slang_type_specifier *spec, slang_struct_scope *structs, slang_variable_scope *scope, slang_function_scope *funcs) { switch (*C->I++) { case TYPE_SPECIFIER_VOID: spec->type = slang_spec_void; break; case TYPE_SPECIFIER_BOOL: spec->type = slang_spec_bool; break; case TYPE_SPECIFIER_BVEC2: spec->type = slang_spec_bvec2; break; case TYPE_SPECIFIER_BVEC3: spec->type = slang_spec_bvec3; break; case TYPE_SPECIFIER_BVEC4: spec->type = slang_spec_bvec4; break; case TYPE_SPECIFIER_INT: spec->type = slang_spec_int; break; case TYPE_SPECIFIER_IVEC2: spec->type = slang_spec_ivec2; break; case TYPE_SPECIFIER_IVEC3: spec->type = slang_spec_ivec3; break; case TYPE_SPECIFIER_IVEC4: spec->type = slang_spec_ivec4; break; case TYPE_SPECIFIER_FLOAT: spec->type = slang_spec_float; break; case TYPE_SPECIFIER_VEC2: spec->type = slang_spec_vec2; break; case TYPE_SPECIFIER_VEC3: spec->type = slang_spec_vec3; break; case TYPE_SPECIFIER_VEC4: spec->type = slang_spec_vec4; break; case TYPE_SPECIFIER_MAT2: spec->type = slang_spec_mat2; break; case TYPE_SPECIFIER_MAT3: spec->type = slang_spec_mat3; break; case TYPE_SPECIFIER_MAT4: spec->type = slang_spec_mat4; break; case TYPE_SPECIFIER_SAMPLER1D: spec->type = slang_spec_sampler1D; break; case TYPE_SPECIFIER_SAMPLER2D: spec->type = slang_spec_sampler2D; break; case TYPE_SPECIFIER_SAMPLER3D: spec->type = slang_spec_sampler3D; break; case TYPE_SPECIFIER_SAMPLERCUBE: spec->type = slang_spec_samplerCube; break; case TYPE_SPECIFIER_SAMPLER1DSHADOW: spec->type = slang_spec_sampler1DShadow; break; case TYPE_SPECIFIER_SAMPLER2DSHADOW: spec->type = slang_spec_sampler2DShadow; break; case TYPE_SPECIFIER_STRUCT: spec->type = slang_spec_struct; { char *name; if (!parse_identifier (C, &name)) return 0; if (*name != '\0' && slang_struct_scope_find (structs, name, 0) != NULL) { slang_info_log_error (C->L, "%s: duplicate type name", name); slang_alloc_free (name); return 0; } spec->_struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct)); if (spec->_struct == NULL) { slang_alloc_free (name); slang_info_log_memory (C->L); return 0; } if (!slang_struct_construct_a (spec->_struct)) { slang_alloc_free (spec->_struct); spec->_struct = NULL; slang_alloc_free (name); slang_info_log_memory (C->L); return 0; } spec->_struct->name = name; spec->_struct->structs->outer_scope = structs; } do { slang_type_specifier sp; slang_type_specifier_construct (&sp); if (!parse_type_specifier (C, &sp, spec->_struct->structs, scope, funcs)) { slang_type_specifier_destruct (&sp); return 0; } do { slang_variable *var; spec->_struct->fields->variables = (slang_variable *) slang_alloc_realloc ( spec->_struct->fields->variables, spec->_struct->fields->num_variables * sizeof (slang_variable), (spec->_struct->fields->num_variables + 1) * sizeof (slang_variable)); if (spec->_struct->fields->variables == NULL) { slang_type_specifier_destruct (&sp); slang_info_log_memory (C->L); return 0; } var = spec->_struct->fields->variables + spec->_struct->fields->num_variables; spec->_struct->fields->num_variables++; slang_variable_construct (var); if (!slang_type_specifier_copy (&var->type.specifier, &sp)) { slang_type_specifier_destruct (&sp); return 0; } if (!parse_identifier (C, &var->name)) { slang_type_specifier_destruct (&sp); return 0; } switch (*C->I++) { case FIELD_NONE: break; case FIELD_ARRAY: var->array_size = (slang_operation *) slang_alloc_malloc (sizeof ( slang_operation)); if (var->array_size == NULL) { slang_type_specifier_destruct (&sp); slang_info_log_memory (C->L); return 0; } if (!slang_operation_construct_a (var->array_size)) { slang_alloc_free (var->array_size); var->array_size = NULL; slang_type_specifier_destruct (&sp); slang_info_log_memory (C->L); return 0; } if (!parse_expression (C, var->array_size, scope, structs, funcs)) { slang_type_specifier_destruct (&sp); return 0; } break; default: return 0; } } while (*C->I++ != FIELD_NONE); } while (*C->I++ != FIELD_NONE); if (*spec->_struct->name != '\0') { slang_struct *s; structs->structs = (slang_struct *) slang_alloc_realloc (structs->structs, structs->num_structs * sizeof (slang_struct), (structs->num_structs + 1) * sizeof (slang_struct)); if (structs->structs == NULL) { slang_info_log_memory (C->L); return 0; } s = structs->structs + structs->num_structs; if (!slang_struct_construct_a (s)) return 0; structs->num_structs++; if (!slang_struct_copy (s, spec->_struct)) return 0; } break; case TYPE_SPECIFIER_TYPENAME: spec->type = slang_spec_struct; { char *name; slang_struct *stru; if (!parse_identifier (C, &name)) return 0; stru = slang_struct_scope_find (structs, name, 1); if (stru == NULL) { slang_info_log_error (C->L, "%s: undeclared type name", name); slang_alloc_free (name); return 0; } slang_alloc_free (name); spec->_struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct)); if (spec->_struct == NULL) { slang_info_log_memory (C->L); return 0; } if (!slang_struct_construct_a (spec->_struct)) { slang_alloc_free (spec->_struct); spec->_struct = NULL; return 0; } if (!slang_struct_copy (spec->_struct, stru)) return 0; } break; default: return 0; } return 1; } static int parse_fully_specified_type (slang_parse_ctx *C, slang_fully_specified_type *type, slang_struct_scope *structs, slang_variable_scope *scope, slang_function_scope *funcs) { if (!parse_type_qualifier (C, &type->qualifier)) return 0; return parse_type_specifier (C, &type->specifier, structs, scope, funcs); } /* operation */ #define OP_END 0 #define OP_BLOCK_BEGIN_NO_NEW_SCOPE 1 #define OP_BLOCK_BEGIN_NEW_SCOPE 2 #define OP_DECLARE 3 #define OP_ASM 4 #define OP_BREAK 5 #define OP_CONTINUE 6 #define OP_DISCARD 7 #define OP_RETURN 8 #define OP_EXPRESSION 9 #define OP_IF 10 #define OP_WHILE 11 #define OP_DO 12 #define OP_FOR 13 #define OP_PUSH_VOID 14 #define OP_PUSH_BOOL 15 #define OP_PUSH_INT 16 #define OP_PUSH_FLOAT 17 #define OP_PUSH_IDENTIFIER 18 #define OP_SEQUENCE 19 #define OP_ASSIGN 20 #define OP_ADDASSIGN 21 #define OP_SUBASSIGN 22 #define OP_MULASSIGN 23 #define OP_DIVASSIGN 24 /*#define OP_MODASSIGN 25*/ /*#define OP_LSHASSIGN 26*/ /*#define OP_RSHASSIGN 27*/ /*#define OP_ORASSIGN 28*/ /*#define OP_XORASSIGN 29*/ /*#define OP_ANDASSIGN 30*/ #define OP_SELECT 31 #define OP_LOGICALOR 32 #define OP_LOGICALXOR 33 #define OP_LOGICALAND 34 /*#define OP_BITOR 35*/ /*#define OP_BITXOR 36*/ /*#define OP_BITAND 37*/ #define OP_EQUAL 38 #define OP_NOTEQUAL 39 #define OP_LESS 40 #define OP_GREATER 41 #define OP_LESSEQUAL 42 #define OP_GREATEREQUAL 43 /*#define OP_LSHIFT 44*/ /*#define OP_RSHIFT 45*/ #define OP_ADD 46 #define OP_SUBTRACT 47 #define OP_MULTIPLY 48 #define OP_DIVIDE 49 /*#define OP_MODULUS 50*/ #define OP_PREINCREMENT 51 #define OP_PREDECREMENT 52 #define OP_PLUS 53 #define OP_MINUS 54 /*#define OP_COMPLEMENT 55*/ #define OP_NOT 56 #define OP_SUBSCRIPT 57 #define OP_CALL 58 #define OP_FIELD 59 #define OP_POSTINCREMENT 60 #define OP_POSTDECREMENT 61 static int parse_child_operation (slang_parse_ctx *C, slang_operation *oper, int statement, slang_variable_scope *scope, slang_struct_scope *structs, slang_function_scope *funcs) { oper->children = (slang_operation *) slang_alloc_realloc (oper->children, oper->num_children * sizeof (slang_operation), (oper->num_children + 1) * sizeof (slang_operation)); if (oper->children == NULL) { slang_info_log_memory (C->L); return 0; } if (!slang_operation_construct_a (oper->children + oper->num_children)) { slang_info_log_memory (C->L); return 0; } oper->num_children++; if (statement) return parse_statement (C, oper->children + oper->num_children - 1, scope, structs, funcs); return parse_expression (C, oper->children + oper->num_children - 1, scope, structs, funcs); } static int parse_declaration (slang_parse_ctx *C, slang_variable_scope *, slang_struct_scope *, slang_function_scope *); static int parse_statement (slang_parse_ctx *C, slang_operation *oper, slang_variable_scope *scope, slang_struct_scope *structs, slang_function_scope *funcs) { oper->locals->outer_scope = scope; switch (*C->I++) { case OP_BLOCK_BEGIN_NO_NEW_SCOPE: oper->type = slang_oper_block_no_new_scope; while (*C->I != OP_END) if (!parse_child_operation (C, oper, 1, scope, structs, funcs)) return 0; C->I++; break; case OP_BLOCK_BEGIN_NEW_SCOPE: oper->type = slang_oper_block_new_scope; while (*C->I != OP_END) if (!parse_child_operation (C, oper, 1, oper->locals, structs, funcs)) return 0; C->I++; break; case OP_DECLARE: oper->type = slang_oper_variable_decl; { const unsigned int first_var = scope->num_variables; if (!parse_declaration (C, scope, structs, funcs)) return 0; if (first_var < scope->num_variables) { const unsigned int num_vars = scope->num_variables - first_var; unsigned int i; oper->children = (slang_operation *) slang_alloc_malloc (num_vars * sizeof ( slang_operation)); if (oper->children == NULL) { slang_info_log_memory (C->L); return 0; } for (i = 0; i < num_vars; i++) if (!slang_operation_construct_a (oper->children + i)) { unsigned int j; for (j = 0; j < i; j++) slang_operation_destruct (oper->children + j); slang_alloc_free (oper->children); oper->children = NULL; slang_info_log_memory (C->L); return 0; } oper->num_children = num_vars; for (i = first_var; i < scope->num_variables; i++) { slang_operation *o = oper->children + i - first_var; o->type = slang_oper_identifier; o->locals->outer_scope = scope; o->identifier = slang_string_duplicate (scope->variables[i].name); if (o->identifier == NULL) { slang_info_log_memory (C->L); return 0; } } } } break; case OP_ASM: oper->type = slang_oper_asm; if (!parse_identifier (C, &oper->identifier)) return 0; while (*C->I != OP_END) if (!parse_child_operation (C, oper, 0, scope, structs, funcs)) return 0; C->I++; break; case OP_BREAK: oper->type = slang_oper_break; break; case OP_CONTINUE: oper->type = slang_oper_continue; break; case OP_DISCARD: oper->type = slang_oper_discard; break; case OP_RETURN: oper->type = slang_oper_return; if (!parse_child_operation (C, oper, 0, scope, structs, funcs)) return 0; break; case OP_EXPRESSION: oper->type = slang_oper_expression; if (!parse_child_operation (C, oper, 0, scope, structs, funcs)) return 0; break; case OP_IF: oper->type = slang_oper_if; if (!parse_child_operation (C, oper, 0, scope, structs, funcs)) return 0; if (!parse_child_operation (C, oper, 1, scope, structs, funcs)) return 0; if (!parse_child_operation (C, oper, 1, scope, structs, funcs)) return 0; break; case OP_WHILE: oper->type = slang_oper_while; if (!parse_child_operation (C, oper, 1, oper->locals, structs, funcs)) return 0; if (!parse_child_operation (C, oper, 1, oper->locals, structs, funcs)) return 0; break; case OP_DO: oper->type = slang_oper_do; if (!parse_child_operation (C, oper, 1, scope, structs, funcs)) return 0; if (!parse_child_operation (C, oper, 0, scope, structs, funcs)) return 0; break; case OP_FOR: oper->type = slang_oper_for; if (!parse_child_operation (C, oper, 1, oper->locals, structs, funcs)) return 0; if (!parse_child_operation (C, oper, 1, oper->locals, structs, funcs)) return 0; if (!parse_child_operation (C, oper, 0, oper->locals, structs, funcs)) return 0; if (!parse_child_operation (C, oper, 1, oper->locals, structs, funcs)) return 0; break; default: return 0; } return 1; } static int handle_trinary_expression (slang_parse_ctx *C, slang_operation *op, slang_operation **ops, unsigned int *num_ops) { op->num_children = 3; op->children = (slang_operation *) slang_alloc_malloc (3 * sizeof (slang_operation)); if (op->children == NULL) { slang_info_log_memory (C->L); return 0; } op->children[0] = (*ops)[*num_ops - 4]; op->children[1] = (*ops)[*num_ops - 3]; op->children[2] = (*ops)[*num_ops - 2]; (*ops)[*num_ops - 4] = (*ops)[*num_ops - 1]; *num_ops -= 3; *ops = (slang_operation *) slang_alloc_realloc (*ops, (*num_ops + 3) * sizeof (slang_operation), *num_ops * sizeof (slang_operation)); if (*ops == NULL) { slang_info_log_memory (C->L); return 0; } return 1; } static int handle_binary_expression (slang_parse_ctx *C, slang_operation *op, slang_operation **ops, unsigned int *num_ops) { op->num_children = 2; op->children = (slang_operation *) slang_alloc_malloc (2 * sizeof (slang_operation)); if (op->children == NULL) { slang_info_log_memory (C->L); return 0; } op->children[0] = (*ops)[*num_ops - 3]; op->children[1] = (*ops)[*num_ops - 2]; (*ops)[*num_ops - 3] = (*ops)[*num_ops - 1]; *num_ops -= 2; *ops = (slang_operation *) slang_alloc_realloc (*ops, (*num_ops + 2) * sizeof (slang_operation), *num_ops * sizeof (slang_operation)); if (*ops == NULL) { slang_info_log_memory (C->L); return 0; } return 1; } static int handle_unary_expression (slang_parse_ctx *C, slang_operation *op, slang_operation **ops, unsigned int *num_ops) { op->num_children = 1; op->children = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation)); if (op->children == NULL) { slang_info_log_memory (C->L); return 0; } op->children[0] = (*ops)[*num_ops - 2]; (*ops)[*num_ops - 2] = (*ops)[*num_ops - 1]; (*num_ops)--; *ops = (slang_operation *) slang_alloc_realloc (*ops, (*num_ops + 1) * sizeof (slang_operation), *num_ops * sizeof (slang_operation)); if (*ops == NULL) { slang_info_log_memory (C->L); return 0; } return 1; } static int is_constructor_name (const char *name, slang_struct_scope *structs) { if (slang_type_specifier_type_from_string (name) != slang_spec_void) return 1; return slang_struct_scope_find (structs, name, 1) != NULL; } static int parse_expression (slang_parse_ctx *C, slang_operation *oper, slang_variable_scope *scope, slang_struct_scope *structs, slang_function_scope *funcs) { slang_operation *ops = NULL; unsigned int num_ops = 0; int number; while (*C->I != OP_END) { slang_operation *op; const unsigned int op_code = *C->I++; ops = (slang_operation *) slang_alloc_realloc (ops, num_ops * sizeof (slang_operation), (num_ops + 1) * sizeof (slang_operation)); if (ops == NULL) { slang_info_log_memory (C->L); return 0; } op = ops + num_ops; if (!slang_operation_construct_a (op)) { slang_info_log_memory (C->L); return 0; } num_ops++; op->locals->outer_scope = scope; switch (op_code) { case OP_PUSH_VOID: op->type = slang_oper_void; break; case OP_PUSH_BOOL: op->type = slang_oper_literal_bool; if (!parse_number (C, &number)) return 0; op->literal = (float) number; break; case OP_PUSH_INT: op->type = slang_oper_literal_int; if (!parse_number (C, &number)) return 0; op->literal = (float) number; break; case OP_PUSH_FLOAT: op->type = slang_oper_literal_float; if (!parse_float (C, &op->literal)) return 0; break; case OP_PUSH_IDENTIFIER: op->type = slang_oper_identifier; if (!parse_identifier (C, &op->identifier)) return 0; break; case OP_SEQUENCE: op->type = slang_oper_sequence; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_ASSIGN: op->type = slang_oper_assign; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_ADDASSIGN: op->type = slang_oper_addassign; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_SUBASSIGN: op->type = slang_oper_subassign; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_MULASSIGN: op->type = slang_oper_mulassign; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_DIVASSIGN: op->type = slang_oper_divassign; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; /*case OP_MODASSIGN:*/ /*case OP_LSHASSIGN:*/ /*case OP_RSHASSIGN:*/ /*case OP_ORASSIGN:*/ /*case OP_XORASSIGN:*/ /*case OP_ANDASSIGN:*/ case OP_SELECT: op->type = slang_oper_select; if (!handle_trinary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_LOGICALOR: op->type = slang_oper_logicalor; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_LOGICALXOR: op->type = slang_oper_logicalxor; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_LOGICALAND: op->type = slang_oper_logicaland; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; /*case OP_BITOR:*/ /*case OP_BITXOR:*/ /*case OP_BITAND:*/ case OP_EQUAL: op->type = slang_oper_equal; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_NOTEQUAL: op->type = slang_oper_notequal; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_LESS: op->type = slang_oper_less; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_GREATER: op->type = slang_oper_greater; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_LESSEQUAL: op->type = slang_oper_lessequal; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_GREATEREQUAL: op->type = slang_oper_greaterequal; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; /*case OP_LSHIFT:*/ /*case OP_RSHIFT:*/ case OP_ADD: op->type = slang_oper_add; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_SUBTRACT: op->type = slang_oper_subtract; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_MULTIPLY: op->type = slang_oper_multiply; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_DIVIDE: op->type = slang_oper_divide; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; /*case OP_MODULUS:*/ case OP_PREINCREMENT: op->type = slang_oper_preincrement; if (!handle_unary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_PREDECREMENT: op->type = slang_oper_predecrement; if (!handle_unary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_PLUS: op->type = slang_oper_plus; if (!handle_unary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_MINUS: op->type = slang_oper_minus; if (!handle_unary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_NOT: op->type = slang_oper_not; if (!handle_unary_expression (C, op, &ops, &num_ops)) return 0; break; /*case OP_COMPLEMENT:*/ case OP_SUBSCRIPT: op->type = slang_oper_subscript; if (!handle_binary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_CALL: op->type = slang_oper_call; if (!parse_identifier (C, &op->identifier)) return 0; while (*C->I != OP_END) if (!parse_child_operation (C, op, 0, scope, structs, funcs)) return 0; C->I++; if (!C->parsing_builtin && !slang_function_scope_find_by_name (funcs, op->identifier, 1) && !is_constructor_name (op->identifier, structs)) { slang_info_log_error (C->L, "%s: undeclared function name", op->identifier); return 0; } break; case OP_FIELD: op->type = slang_oper_field; if (!parse_identifier (C, &op->identifier)) return 0; if (!handle_unary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_POSTINCREMENT: op->type = slang_oper_postincrement; if (!handle_unary_expression (C, op, &ops, &num_ops)) return 0; break; case OP_POSTDECREMENT: op->type = slang_oper_postdecrement; if (!handle_unary_expression (C, op, &ops, &num_ops)) return 0; break; default: return 0; } } C->I++; *oper = *ops; slang_alloc_free (ops); return 1; } /* parameter qualifier */ #define PARAM_QUALIFIER_IN 0 #define PARAM_QUALIFIER_OUT 1 #define PARAM_QUALIFIER_INOUT 2 /* function parameter array presence */ #define PARAMETER_ARRAY_NOT_PRESENT 0 #define PARAMETER_ARRAY_PRESENT 1 static int parse_parameter_declaration (slang_parse_ctx *C, slang_variable *param, slang_struct_scope *structs, slang_variable_scope *scope, slang_function_scope *funcs) { slang_storage_aggregate agg; if (!parse_type_qualifier (C, ¶m->type.qualifier)) return 0; switch (*C->I++) { case PARAM_QUALIFIER_IN: if (param->type.qualifier != slang_qual_const && param->type.qualifier != slang_qual_none) { slang_info_log_error (C->L, "invalid type qualifier"); return 0; } break; case PARAM_QUALIFIER_OUT: if (param->type.qualifier == slang_qual_none) param->type.qualifier = slang_qual_out; else { slang_info_log_error (C->L, "invalid type qualifier"); return 0; } break; case PARAM_QUALIFIER_INOUT: if (param->type.qualifier == slang_qual_none) param->type.qualifier = slang_qual_inout; else { slang_info_log_error (C->L, "invalid type qualifier"); return 0; } break; default: return 0; } if (!parse_type_specifier (C, ¶m->type.specifier, structs, scope, funcs)) return 0; if (!parse_identifier (C, ¶m->name)) return 0; if (*C->I++ == PARAMETER_ARRAY_PRESENT) { param->array_size = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation)); if (param->array_size == NULL) { slang_info_log_memory (C->L); return 0; } if (!slang_operation_construct_a (param->array_size)) { slang_alloc_free (param->array_size); param->array_size = NULL; slang_info_log_memory (C->L); return 0; } if (!parse_expression (C, param->array_size, scope, structs, funcs)) return 0; } slang_storage_aggregate_construct (&agg); if (!_slang_aggregate_variable (&agg, ¶m->type.specifier, param->array_size, funcs, structs)) { slang_storage_aggregate_destruct (&agg); return 0; } slang_storage_aggregate_destruct (&agg); return 1; } /* function type */ #define FUNCTION_ORDINARY 0 #define FUNCTION_CONSTRUCTOR 1 #define FUNCTION_OPERATOR 2 /* function parameter */ #define PARAMETER_NONE 0 #define PARAMETER_NEXT 1 /* operator type */ #define OPERATOR_ASSIGN 1 #define OPERATOR_ADDASSIGN 2 #define OPERATOR_SUBASSIGN 3 #define OPERATOR_MULASSIGN 4 #define OPERATOR_DIVASSIGN 5 /*#define OPERATOR_MODASSIGN 6*/ /*#define OPERATOR_LSHASSIGN 7*/ /*#define OPERATOR_RSHASSIGN 8*/ /*#define OPERATOR_ANDASSIGN 9*/ /*#define OPERATOR_XORASSIGN 10*/ /*#define OPERATOR_ORASSIGN 11*/ #define OPERATOR_LOGICALXOR 12 /*#define OPERATOR_BITOR 13*/ /*#define OPERATOR_BITXOR 14*/ /*#define OPERATOR_BITAND 15*/ #define OPERATOR_EQUAL 16 #define OPERATOR_NOTEQUAL 17 #define OPERATOR_LESS 18 #define OPERATOR_GREATER 19 #define OPERATOR_LESSEQUAL 20 #define OPERATOR_GREATEREQUAL 21 /*#define OPERATOR_LSHIFT 22*/ /*#define OPERATOR_RSHIFT 23*/ #define OPERATOR_MULTIPLY 24 #define OPERATOR_DIVIDE 25 /*#define OPERATOR_MODULUS 26*/ #define OPERATOR_INCREMENT 27 #define OPERATOR_DECREMENT 28 #define OPERATOR_PLUS 29 #define OPERATOR_MINUS 30 /*#define OPERATOR_COMPLEMENT 31*/ #define OPERATOR_NOT 32 static const struct { unsigned int o_code; const char *o_name; } operator_names[] = { { OPERATOR_INCREMENT, "++" }, { OPERATOR_ADDASSIGN, "+=" }, { OPERATOR_PLUS, "+" }, { OPERATOR_DECREMENT, "--" }, { OPERATOR_SUBASSIGN, "-=" }, { OPERATOR_MINUS, "-" }, { OPERATOR_NOTEQUAL, "!=" }, { OPERATOR_NOT, "!" }, { OPERATOR_MULASSIGN, "*=" }, { OPERATOR_MULTIPLY, "*" }, { OPERATOR_DIVASSIGN, "/=" }, { OPERATOR_DIVIDE, "/" }, { OPERATOR_LESSEQUAL, "<=" }, /*{ OPERATOR_LSHASSIGN, "<<=" },*/ /*{ OPERATOR_LSHIFT, "<<" },*/ { OPERATOR_LESS, "<" }, { OPERATOR_GREATEREQUAL, ">=" }, /*{ OPERATOR_RSHASSIGN, ">>=" },*/ /*{ OPERATOR_RSHIFT, ">>" },*/ { OPERATOR_GREATER, ">" }, { OPERATOR_EQUAL, "==" }, { OPERATOR_ASSIGN, "=" }, /*{ OPERATOR_MODASSIGN, "%=" },*/ /*{ OPERATOR_MODULUS, "%" },*/ /*{ OPERATOR_ANDASSIGN, "&=" },*/ /*{ OPERATOR_BITAND, "&" },*/ /*{ OPERATOR_ORASSIGN, "|=" },*/ /*{ OPERATOR_BITOR, "|" },*/ /*{ OPERATOR_COMPLEMENT, "~" },*/ /*{ OPERATOR_XORASSIGN, "^=" },*/ { OPERATOR_LOGICALXOR, "^^" }/*,*/ /*{ OPERATOR_BITXOR, "^" }*/ }; static int parse_operator_name (slang_parse_ctx *C, char **pname) { unsigned int i; for (i = 0; i < sizeof (operator_names) / sizeof (*operator_names); i++) if (operator_names[i].o_code == (unsigned int) (*C->I)) { *pname = slang_string_duplicate (operator_names[i].o_name); if (*pname == NULL) { slang_info_log_memory (C->L); return 0; } C->I++; return 1; } return 0; } static int parse_function_prototype (slang_parse_ctx *C, slang_function *func, slang_struct_scope *structs, slang_variable_scope *scope, slang_function_scope *funcs) { if (!parse_fully_specified_type (C, &func->header.type, structs, scope, funcs)) return 0; switch (*C->I++) { case FUNCTION_ORDINARY: func->kind = slang_func_ordinary; if (!parse_identifier (C, &func->header.name)) return 0; break; case FUNCTION_CONSTRUCTOR: func->kind = slang_func_constructor; if (func->header.type.specifier.type == slang_spec_struct) return 0; func->header.name = slang_string_duplicate ( type_specifier_type_names[func->header.type.specifier.type]); if (func->header.name == NULL) { slang_info_log_memory (C->L); return 0; } break; case FUNCTION_OPERATOR: func->kind = slang_func_operator; if (!parse_operator_name (C, &func->header.name)) return 0; break; default: return 0; } func->parameters->outer_scope = scope; while (*C->I++ == PARAMETER_NEXT) { func->parameters->variables = (slang_variable *) slang_alloc_realloc ( func->parameters->variables, func->parameters->num_variables * sizeof (slang_variable), (func->parameters->num_variables + 1) * sizeof (slang_variable)); if (func->parameters->variables == NULL) { slang_info_log_memory (C->L); return 0; } slang_variable_construct (func->parameters->variables + func->parameters->num_variables); func->parameters->num_variables++; if (!parse_parameter_declaration (C, func->parameters->variables + func->parameters->num_variables - 1, structs, scope, funcs)) return 0; } func->param_count = func->parameters->num_variables; return 1; } static int parse_function_definition (slang_parse_ctx *C, slang_function *func, slang_struct_scope *structs, slang_variable_scope *scope, slang_function_scope *funcs) { if (!parse_function_prototype (C, func, structs, scope, funcs)) return 0; func->body = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation)); if (func->body == NULL) { slang_info_log_memory (C->L); return 0; } if (!slang_operation_construct_a (func->body)) { slang_alloc_free (func->body); func->body = NULL; slang_info_log_memory (C->L); return 0; } if (!parse_statement (C, func->body, func->parameters, structs, funcs)) return 0; return 1; } /* init declarator list */ #define DECLARATOR_NONE 0 #define DECLARATOR_NEXT 1 /* variable declaration */ #define VARIABLE_NONE 0 #define VARIABLE_IDENTIFIER 1 #define VARIABLE_INITIALIZER 2 #define VARIABLE_ARRAY_EXPLICIT 3 #define VARIABLE_ARRAY_UNKNOWN 4 static int parse_init_declarator (slang_parse_ctx *C, const slang_fully_specified_type *type, slang_variable_scope *vars, slang_struct_scope *structs, slang_function_scope *funcs) { slang_variable *var; if (*C->I++ == VARIABLE_NONE) return 1; vars->variables = (slang_variable *) slang_alloc_realloc (vars->variables, vars->num_variables * sizeof (slang_variable), (vars->num_variables + 1) * sizeof (slang_variable)); if (vars->variables == NULL) { slang_info_log_memory (C->L); return 0; } var = vars->variables + vars->num_variables; vars->num_variables++; slang_variable_construct (var); var->type.qualifier = type->qualifier; if (!parse_identifier (C, &var->name)) return 0; switch (*C->I++) { case VARIABLE_NONE: if (!slang_type_specifier_copy (&var->type.specifier, &type->specifier)) return 0; break; case VARIABLE_INITIALIZER: if (!slang_type_specifier_copy (&var->type.specifier, &type->specifier)) return 0; var->initializer = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation)); if (var->initializer == NULL) { slang_info_log_memory (C->L); return 0; } if (!slang_operation_construct_a (var->initializer)) { slang_alloc_free (var->initializer); var->initializer = NULL; slang_info_log_memory (C->L); return 0; } if (!parse_expression (C, var->initializer, vars, structs, funcs)) return 0; break; case VARIABLE_ARRAY_UNKNOWN: var->type.specifier.type = slang_spec_array; var->type.specifier._array = (slang_type_specifier *) slang_alloc_malloc (sizeof ( slang_type_specifier)); if (var->type.specifier._array == NULL) { slang_info_log_memory (C->L); return 0; } slang_type_specifier_construct (var->type.specifier._array); if (!slang_type_specifier_copy (var->type.specifier._array, &type->specifier)) return 0; break; case VARIABLE_ARRAY_EXPLICIT: var->type.specifier.type = slang_spec_array; var->type.specifier._array = (slang_type_specifier *) slang_alloc_malloc (sizeof ( slang_type_specifier)); if (var->type.specifier._array == NULL) { slang_info_log_memory (C->L); return 0; } slang_type_specifier_construct (var->type.specifier._array); if (!slang_type_specifier_copy (var->type.specifier._array, &type->specifier)) return 0; var->array_size = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation)); if (var->array_size == NULL) { slang_info_log_memory (C->L); return 0; } if (!slang_operation_construct_a (var->array_size)) { slang_alloc_free (var->array_size); var->array_size = NULL; slang_info_log_memory (C->L); return 0; } if (!parse_expression (C, var->array_size, vars, structs, funcs)) return 0; break; default: return 0; } if (!(var->type.specifier.type == slang_spec_array && var->array_size == NULL)) { slang_storage_aggregate agg; slang_storage_aggregate_construct (&agg); if (!_slang_aggregate_variable (&agg, &var->type.specifier, var->array_size, funcs, structs)) { slang_storage_aggregate_destruct (&agg); return 0; } slang_storage_aggregate_destruct (&agg); } return 1; } static int parse_init_declarator_list (slang_parse_ctx *C, slang_variable_scope *vars, slang_struct_scope *structs, slang_function_scope *funcs) { slang_fully_specified_type type; slang_fully_specified_type_construct (&type); if (!parse_fully_specified_type (C, &type, structs, vars, funcs)) { slang_fully_specified_type_destruct (&type); return 0; } do { if (!parse_init_declarator (C, &type, vars, structs, funcs)) { slang_fully_specified_type_destruct (&type); return 0; } } while (*C->I++ == DECLARATOR_NEXT); slang_fully_specified_type_destruct (&type); return 1; } static int parse_function (slang_parse_ctx *C, int definition, slang_struct_scope *structs, slang_function_scope *funcs, slang_variable_scope *scope, slang_function **parsed_func_ret) { slang_function parsed_func, *found_func; /* parse function definition/declaration */ slang_function_construct (&parsed_func); if (definition) { if (!parse_function_definition (C, &parsed_func, structs, scope, funcs)) { slang_function_destruct (&parsed_func); return 0; } } else { if (!parse_function_prototype (C, &parsed_func, structs, scope, funcs)) { slang_function_destruct (&parsed_func); return 0; } } /* find a function with a prototype matching the parsed one - only the current scope is being searched to allow built-in function overriding */ found_func = slang_function_scope_find (funcs, &parsed_func, 0); if (found_func == NULL) { /* add the parsed function to the function list */ funcs->functions = (slang_function *) slang_alloc_realloc (funcs->functions, funcs->num_functions * sizeof (slang_function), (funcs->num_functions + 1) * sizeof ( slang_function)); if (funcs->functions == NULL) { slang_info_log_memory (C->L); slang_function_destruct (&parsed_func); return 0; } funcs->functions[funcs->num_functions] = parsed_func; funcs->num_functions++; /* return the newly parsed function */ *parsed_func_ret = funcs->functions + funcs->num_functions - 1; } else { /* TODO: check function return type qualifiers and specifiers */ if (definition) { /* destroy the existing function declaration and replace it with the new one */ if (found_func->body != NULL) { slang_info_log_error (C->L, "%s: function already has a body", parsed_func.header.name); slang_function_destruct (&parsed_func); return 0; } slang_function_destruct (found_func); *found_func = parsed_func; } else { /* another declaration of the same function prototype - ignore it */ slang_function_destruct (&parsed_func); } /* return the found function */ *parsed_func_ret = found_func; } /* assemble the parsed function */ if (definition) { static int x = 0; static slang_assembly_file file; slang_assembly_name_space space; x++; if (x == 1) slang_assembly_file_construct (&file); space.funcs = funcs; space.structs = structs; space.vars = scope; if (x == 1) xxx_first (&file); (**parsed_func_ret).address = file.count; if (!_slang_assemble_function (&file, *parsed_func_ret, &space)) { slang_assembly_file_destruct (&file); return 0; } if (slang_string_compare ("main", (**parsed_func_ret).header.name) == 0) { xxx_prolog (&file, (**parsed_func_ret).address); _slang_execute (&file); slang_assembly_file_destruct (&file); exit (0); } } return 1; } /* declaration */ #define DECLARATION_FUNCTION_PROTOTYPE 1 #define DECLARATION_INIT_DECLARATOR_LIST 2 static int parse_declaration (slang_parse_ctx *C, slang_variable_scope *scope, slang_struct_scope *structs, slang_function_scope *funcs) { slang_function *dummy_func; switch (*C->I++) { case DECLARATION_INIT_DECLARATOR_LIST: if (!parse_init_declarator_list (C, scope, structs, funcs)) return 0; break; case DECLARATION_FUNCTION_PROTOTYPE: if (!parse_function (C, 0, structs, funcs, scope, &dummy_func)) return 0; break; default: return 0; } return 1; } /* external declaration */ #define EXTERNAL_NULL 0 #define EXTERNAL_FUNCTION_DEFINITION 1 #define EXTERNAL_DECLARATION 2 static int parse_translation_unit (slang_parse_ctx *C, slang_translation_unit *unit) { while (*C->I != EXTERNAL_NULL) { slang_function *func; switch (*C->I++) { case EXTERNAL_FUNCTION_DEFINITION: if (!parse_function (C, 1, &unit->structs, &unit->functions, &unit->globals, &func)) return 0; break; case EXTERNAL_DECLARATION: if (!parse_declaration (C, &unit->globals, &unit->structs, &unit->functions)) return 0; break; default: return 0; } } C->I++; return 1; } static int compile_binary (const byte *prod, slang_translation_unit *unit, slang_unit_type type, slang_info_log *log, slang_translation_unit *builtins) { slang_parse_ctx C; /* set-up parse context */ C.I = prod; C.L = log; C.parsing_builtin = builtins == NULL; if (!check_revision (&C)) return 0; /* create translation unit object */ slang_translation_unit_construct (unit); unit->type = type; if (builtins != NULL) { /* link to built-in functions */ builtins[1].functions.outer_scope = &builtins[0].functions; builtins[2].functions.outer_scope = &builtins[1].functions; unit->functions.outer_scope = &builtins[2].functions; /* link to built-in variables - core unit does not define any */ builtins[2].globals.outer_scope = &builtins[1].globals; unit->globals.outer_scope = &builtins[2].globals; /* link to built-in structure typedefs - only in common unit */ unit->structs.outer_scope = &builtins[1].structs; } /* parse translation unit */ if (!parse_translation_unit (&C, unit)) { slang_translation_unit_destruct (unit); return 0; } return 1; } static int compile_with_grammar (grammar id, const char *source, slang_translation_unit *unit, slang_unit_type type, slang_info_log *log, slang_translation_unit *builtins) { byte *prod; unsigned int size, start, version; /* retrieve version */ if (!_slang_preprocess_version (source, &version, &start, log)) return 0; /* check the syntax */ if (!grammar_fast_check (id, (const byte *) source + start, &prod, &size, 65536)) { char buf[1024]; unsigned int pos; grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos); slang_info_log_error (log, buf); return 0; } if (!compile_binary (prod, unit, type, log, builtins)) { grammar_alloc_free (prod); return 0; } grammar_alloc_free (prod); return 1; } static const char *slang_shader_syn = #include "library/slang_shader_syn.h" ; /* static const byte slang_core_gc_bin[] = { #include "library/slang_core_gc_bin.h" };*/ static const byte slang_core_gc[] = { #include "library/slang_core_gc.h" }; static const byte slang_common_builtin_gc_bin[] = { #include "library/slang_common_builtin_gc_bin.h" }; static const byte slang_fragment_builtin_gc_bin[] = { #include "library/slang_fragment_builtin_gc_bin.h" }; static const byte slang_vertex_builtin_gc_bin[] = { #include "library/slang_vertex_builtin_gc_bin.h" }; int _slang_compile (const char *source, slang_translation_unit *unit, slang_unit_type type, slang_info_log *log) { grammar id; slang_translation_unit builtin_units[3]; slang_translation_unit *builtins = NULL; /* load slang grammar */ id = grammar_load_from_text ((const byte *) slang_shader_syn); if (id == 0) { char buf[1024]; unsigned int pos; grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos); slang_info_log_error (log, buf); return 0; } /* set shader type - the syntax is slightly different for different shaders */ if (type == slang_unit_fragment_shader || type == slang_unit_fragment_builtin) grammar_set_reg8 (id, (const byte *) "shader_type", 1); else grammar_set_reg8 (id, (const byte *) "shader_type", 2); /* enable language extensions */ grammar_set_reg8 (id, (const byte *) "parsing_builtin", 1); /* if parsing user-specified shader, load built-in library */ if (type == slang_unit_fragment_shader || type == slang_unit_vertex_shader) { /*if (!compile_binary (slang_core_gc_bin, builtin_units, slang_unit_fragment_builtin, log, NULL))*/ if (!compile_with_grammar (id, (const char*) slang_core_gc, builtin_units, slang_unit_fragment_builtin, log, NULL)) { grammar_destroy (id); return 0; } if (!compile_binary (slang_common_builtin_gc_bin, builtin_units + 1, slang_unit_fragment_builtin, log, NULL)) { slang_translation_unit_destruct (builtin_units); grammar_destroy (id); return 0; } if (type == slang_unit_fragment_shader) { if (!compile_binary (slang_fragment_builtin_gc_bin, builtin_units + 2, slang_unit_fragment_builtin, log, NULL)) { slang_translation_unit_destruct (builtin_units); slang_translation_unit_destruct (builtin_units + 1); grammar_destroy (id); return 0; } } else if (type == slang_unit_vertex_shader) { if (!compile_binary (slang_vertex_builtin_gc_bin, builtin_units + 2, slang_unit_vertex_builtin, log, NULL)) { slang_translation_unit_destruct (builtin_units); slang_translation_unit_destruct (builtin_units + 1); grammar_destroy (id); return 0; } } /* disable language extensions */ grammar_set_reg8 (id, (const byte *) "parsing_builtin", 0); builtins = builtin_units; } /* compile the actual shader - pass-in built-in library for external shader */ if (!compile_with_grammar (id, source, unit, type, log, builtins)) { if (type == slang_unit_fragment_shader || type == slang_unit_vertex_shader) { slang_translation_unit_destruct (builtin_units); slang_translation_unit_destruct (builtin_units + 1); slang_translation_unit_destruct (builtin_units + 2); } grammar_destroy (id); return 0; } /* destroy built-in library */ if (type == slang_unit_fragment_shader || type == slang_unit_vertex_shader) { slang_translation_unit_destruct (builtin_units); slang_translation_unit_destruct (builtin_units + 1); slang_translation_unit_destruct (builtin_units + 2); } grammar_destroy (id); return 1; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_compile.h0000644000000000000000000001575413614532424022570 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if !defined SLANG_COMPILE_H #define SLANG_COMPILE_H #if defined __cplusplus extern "C" { #endif typedef enum slang_type_qualifier_ { slang_qual_none, slang_qual_const, slang_qual_attribute, slang_qual_varying, slang_qual_uniform, slang_qual_out, slang_qual_inout, slang_qual_fixedoutput, /* internal */ slang_qual_fixedinput /* internal */ } slang_type_qualifier; typedef enum slang_type_specifier_type_ { slang_spec_void, slang_spec_bool, slang_spec_bvec2, slang_spec_bvec3, slang_spec_bvec4, slang_spec_int, slang_spec_ivec2, slang_spec_ivec3, slang_spec_ivec4, slang_spec_float, slang_spec_vec2, slang_spec_vec3, slang_spec_vec4, slang_spec_mat2, slang_spec_mat3, slang_spec_mat4, slang_spec_sampler1D, slang_spec_sampler2D, slang_spec_sampler3D, slang_spec_samplerCube, slang_spec_sampler1DShadow, slang_spec_sampler2DShadow, slang_spec_struct, slang_spec_array } slang_type_specifier_type; slang_type_specifier_type slang_type_specifier_type_from_string (const char *); typedef struct slang_type_specifier_ { slang_type_specifier_type type; struct slang_struct_ *_struct; /* spec_struct */ struct slang_type_specifier_ *_array; /* spec_array */ } slang_type_specifier; void slang_type_specifier_construct (slang_type_specifier *); void slang_type_specifier_destruct (slang_type_specifier *); int slang_type_specifier_copy (slang_type_specifier *, const slang_type_specifier *); int slang_type_specifier_equal (const slang_type_specifier *, const slang_type_specifier *); typedef struct slang_fully_specified_type_ { slang_type_qualifier qualifier; slang_type_specifier specifier; } slang_fully_specified_type; typedef struct slang_variable_scope_ { struct slang_variable_ *variables; unsigned int num_variables; struct slang_variable_scope_ *outer_scope; } slang_variable_scope; typedef enum slang_operation_type_ { slang_oper_none, slang_oper_block_no_new_scope, slang_oper_block_new_scope, slang_oper_variable_decl, slang_oper_asm, slang_oper_break, slang_oper_continue, slang_oper_discard, slang_oper_return, slang_oper_expression, slang_oper_if, slang_oper_while, slang_oper_do, slang_oper_for, slang_oper_void, slang_oper_literal_bool, slang_oper_literal_int, slang_oper_literal_float, slang_oper_identifier, slang_oper_sequence, slang_oper_assign, slang_oper_addassign, slang_oper_subassign, slang_oper_mulassign, slang_oper_divassign, /*slang_oper_modassign,*/ /*slang_oper_lshassign,*/ /*slang_oper_rshassign,*/ /*slang_oper_orassign,*/ /*slang_oper_xorassign,*/ /*slang_oper_andassign,*/ slang_oper_select, slang_oper_logicalor, slang_oper_logicalxor, slang_oper_logicaland, /*slang_oper_bitor,*/ /*slang_oper_bitxor,*/ /*slang_oper_bitand,*/ slang_oper_equal, slang_oper_notequal, slang_oper_less, slang_oper_greater, slang_oper_lessequal, slang_oper_greaterequal, /*slang_oper_lshift,*/ /*slang_oper_rshift,*/ slang_oper_add, slang_oper_subtract, slang_oper_multiply, slang_oper_divide, /*slang_oper_modulus,*/ slang_oper_preincrement, slang_oper_predecrement, slang_oper_plus, slang_oper_minus, /*slang_oper_complement,*/ slang_oper_not, slang_oper_subscript, slang_oper_call, slang_oper_field, slang_oper_postincrement, slang_oper_postdecrement } slang_operation_type; typedef struct slang_operation_ { slang_operation_type type; struct slang_operation_ *children; unsigned int num_children; float literal; /* bool, literal_int, literal_float */ char *identifier; /* asm, identifier, call, field */ slang_variable_scope *locals; } slang_operation; int slang_operation_construct_a (slang_operation *); void slang_operation_destruct (slang_operation *); typedef struct slang_variable_ { slang_fully_specified_type type; char *name; slang_operation *array_size; /* spec_array */ slang_operation *initializer; unsigned int address; } slang_variable; slang_variable *_slang_locate_variable (slang_variable_scope *scope, const char *name, int all); typedef struct slang_struct_scope_ { struct slang_struct_ *structs; unsigned int num_structs; struct slang_struct_scope_ *outer_scope; } slang_struct_scope; struct slang_struct_ *slang_struct_scope_find (slang_struct_scope *, const char *, int); typedef struct slang_struct_ { char *name; slang_variable_scope *fields; slang_struct_scope *structs; } slang_struct; int slang_struct_construct_a (slang_struct *); int slang_struct_copy (slang_struct *, const slang_struct *); typedef enum slang_function_kind_ { slang_func_ordinary, slang_func_constructor, slang_func_operator } slang_function_kind; typedef struct slang_function_ { slang_function_kind kind; slang_variable header; slang_variable_scope *parameters; unsigned int param_count; slang_operation *body; unsigned int address; } slang_function; typedef struct slang_function_scope_ { slang_function *functions; unsigned int num_functions; struct slang_function_scope_ *outer_scope; } slang_function_scope; typedef enum slang_unit_type_ { slang_unit_fragment_shader, slang_unit_vertex_shader, slang_unit_fragment_builtin, slang_unit_vertex_builtin } slang_unit_type; typedef struct slang_translation_unit_ { slang_variable_scope globals; slang_function_scope functions; slang_struct_scope structs; slang_unit_type type; } slang_translation_unit; void slang_translation_unit_construct (slang_translation_unit *); void slang_translation_unit_destruct (slang_translation_unit *); typedef struct slang_info_log_ { char *text; int dont_free_text; } slang_info_log; void slang_info_log_construct (slang_info_log *); void slang_info_log_destruct (slang_info_log *); int slang_info_log_error (slang_info_log *, const char *, ...); int slang_info_log_warning (slang_info_log *, const char *, ...); void slang_info_log_memory (slang_info_log *); int _slang_compile (const char *, slang_translation_unit *, slang_unit_type type, slang_info_log *); #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_execute.c0000644000000000000000000002260013614532424022561 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file slang_execute.c * intermediate code interpreter * \author Michal Krol */ #include "imports.h" #include "slang_utility.h" #include "slang_assemble.h" #include "slang_storage.h" #include "slang_execute.h" static void dump_instruction (FILE *f, slang_assembly *a, unsigned int i) { fprintf (f, "%.5u:\t", i); switch (a->type) { case slang_asm_none: fprintf (f, "none"); break; case slang_asm_float_copy: fprintf (f, "float_copy\t%d, %d", a->param[0], a->param[1]); break; case slang_asm_float_move: fprintf (f, "float_move\t%d, %d", a->param[0], a->param[1]); break; case slang_asm_float_push: fprintf (f, "float_push\t%f", a->literal); break; case slang_asm_float_deref: fprintf (f, "float_deref"); break; case slang_asm_float_add: fprintf (f, "float_add"); break; case slang_asm_float_multiply: fprintf (f, "float_multiply"); break; case slang_asm_float_divide: fprintf (f, "float_divide"); break; case slang_asm_float_negate: fprintf (f, "float_negate"); break; case slang_asm_float_less: fprintf (f, "float_less"); break; case slang_asm_float_equal: fprintf (f, "float_equal\t%d, %d", a->param[0], a->param[1]); break; case slang_asm_float_to_int: fprintf (f, "float_to_int"); break; case slang_asm_int_copy: fprintf (f, "int_copy\t%d, %d", a->param[0], a->param[1]); break; case slang_asm_int_move: fprintf (f, "int_move\t%d, %d", a->param[0], a->param[1]); break; case slang_asm_int_push: fprintf (f, "int_push\t%d", (GLint) a->literal); break; case slang_asm_int_deref: fprintf (f, "int_deref"); break; case slang_asm_int_to_float: fprintf (f, "int_to_float"); break; case slang_asm_int_to_addr: fprintf (f, "int_to_addr"); break; case slang_asm_bool_copy: fprintf (f, "bool_copy\t%d, %d", a->param[0], a->param[1]); break; case slang_asm_bool_move: fprintf (f, "bool_move\t%d, %d", a->param[0], a->param[1]); break; case slang_asm_bool_push: fprintf (f, "bool_push\t%d", a->literal != 0.0f); break; case slang_asm_bool_deref: fprintf (f, "bool_deref"); break; case slang_asm_addr_copy: fprintf (f, "addr_copy"); break; case slang_asm_addr_push: fprintf (f, "addr_push\t%u", a->param[0]); break; case slang_asm_addr_deref: fprintf (f, "addr_deref"); break; case slang_asm_addr_add: fprintf (f, "addr_add"); break; case slang_asm_addr_multiply: fprintf (f, "addr_multiply"); break; case slang_asm_jump: fprintf (f, "jump\t%u", a->param[0]); break; case slang_asm_jump_if_zero: fprintf (f, "jump_if_zero\t%u", a->param[0]); break; case slang_asm_enter: fprintf (f, "enter\t%u", a->param[0]); break; case slang_asm_leave: fprintf (f, "leave"); break; case slang_asm_local_alloc: fprintf (f, "local_alloc\t%u", a->param[0]); break; case slang_asm_local_free: fprintf (f, "local_free\t%u", a->param[0]); break; case slang_asm_local_addr: fprintf (f, "local_addr\t%u, %u", a->param[0], a->param[1]); break; case slang_asm_call: fprintf (f, "call\t%u", a->param[0]); break; case slang_asm_return: fprintf (f, "return"); break; case slang_asm_discard: fprintf (f, "discard"); break; case slang_asm_exit: fprintf (f, "exit"); break; default: break; } fprintf (f, "\n"); } static void dump (const slang_assembly_file *file) { unsigned int i; static unsigned int counter = 0; FILE *f; char filename[256]; counter++; sprintf (filename, "~mesa-slang-assembly-dump-(%u).txt", counter); f = fopen (filename, "w"); if (f == NULL) return; for (i = 0; i < file->count; i++) dump_instruction (f, file->code + i, i); fclose (f); } int _slang_execute (const slang_assembly_file *file) { slang_machine mach; FILE *f; mach.ip = 0; mach.sp = SLANG_MACHINE_STACK_SIZE; mach.bp = 0; mach.kill = 0; mach.exit = 0; /* assume 32-bit machine */ /* XXX why???, disabling the pointer size assertions here. * See bug 4021. */ static_assert(sizeof (GLfloat) == 4); /*static_assert(sizeof (GLfloat *) == 4);*/ static_assert(sizeof (GLuint) == 4); /*static_assert(sizeof (GLuint *) == 4);*/ dump (file); f = fopen ("~mesa-slang-assembly-execution.txt", "w"); while (!mach.exit) { slang_assembly *a = file->code + mach.ip; if (f != NULL) { unsigned int i; dump_instruction (f, a, mach.ip); fprintf (f, "\t\tsp=%u bp=%u\n", mach.sp, mach.bp); for (i = mach.sp; i < SLANG_MACHINE_STACK_SIZE; i++) fprintf (f, "\t%.5u\t%6f\t%u\n", i, mach.stack._float[i], mach.stack._addr[i]); fflush (f); } mach.ip++; switch (a->type) { case slang_asm_none: break; case slang_asm_float_copy: case slang_asm_int_copy: case slang_asm_bool_copy: *(mach.stack._floatp[mach.sp + a->param[0] / 4] + a->param[1] / 4) = mach.stack._float[mach.sp]; mach.sp++; break; case slang_asm_float_move: case slang_asm_int_move: case slang_asm_bool_move: mach.stack._float[mach.sp + a->param[0] / 4] = mach.stack._float[mach.sp + (mach.stack._addr[mach.sp] + a->param[1]) / 4]; break; case slang_asm_float_push: case slang_asm_int_push: case slang_asm_bool_push: mach.sp--; mach.stack._float[mach.sp] = a->literal; break; case slang_asm_float_deref: case slang_asm_int_deref: case slang_asm_bool_deref: mach.stack._float[mach.sp] = *mach.stack._floatp[mach.sp]; break; case slang_asm_float_add: mach.stack._float[mach.sp + 1] += mach.stack._float[mach.sp]; mach.sp++; break; case slang_asm_float_multiply: mach.stack._float[mach.sp + 1] *= mach.stack._float[mach.sp]; mach.sp++; break; case slang_asm_float_divide: mach.stack._float[mach.sp + 1] /= mach.stack._float[mach.sp]; mach.sp++; break; case slang_asm_float_negate: mach.stack._float[mach.sp] = -mach.stack._float[mach.sp]; break; case slang_asm_float_less: mach.stack._float[mach.sp + 1] = mach.stack._float[mach.sp + 1] < mach.stack._float[mach.sp] ? 1.0f : 0.0f; mach.sp++; break; case slang_asm_float_equal: mach.sp--; mach.stack._float[mach.sp] = mach.stack._float[mach.sp + 1 + a->param[0] / 4] == mach.stack._float[mach.sp + 1 + a->param[1] / 4] ? 1.0f : 0.0f; break; case slang_asm_float_to_int: mach.stack._float[mach.sp] = (GLfloat) (GLint) mach.stack._float[mach.sp]; break; case slang_asm_int_to_float: break; case slang_asm_int_to_addr: mach.stack._addr[mach.sp] = (GLuint) (GLint) mach.stack._float[mach.sp]; break; case slang_asm_addr_copy: *mach.stack._addrp[mach.sp + 1] = mach.stack._addr[mach.sp]; mach.sp++; break; case slang_asm_addr_push: mach.sp--; mach.stack._addr[mach.sp] = a->param[0]; break; case slang_asm_addr_deref: mach.stack._addr[mach.sp] = *mach.stack._addrp[mach.sp]; break; case slang_asm_addr_add: mach.stack._addr[mach.sp + 1] += mach.stack._addr[mach.sp]; mach.sp++; break; case slang_asm_addr_multiply: mach.stack._addr[mach.sp + 1] *= mach.stack._addr[mach.sp]; mach.sp++; break; case slang_asm_jump: mach.ip = a->param[0]; break; case slang_asm_jump_if_zero: if (mach.stack._float[mach.sp] == 0.0f) mach.ip = a->param[0]; mach.sp++; break; case slang_asm_enter: mach.sp--; mach.stack._addr[mach.sp] = mach.bp; mach.bp = mach.sp + a->param[0] / 4; break; case slang_asm_leave: mach.bp = mach.stack._addr[mach.sp]; mach.sp++; break; case slang_asm_local_alloc: mach.sp -= a->param[0] / 4; break; case slang_asm_local_free: mach.sp += a->param[0] / 4; break; case slang_asm_local_addr: mach.sp--; mach.stack._addr[mach.sp] = (GLuint) mach.stack._addr + mach.bp * 4 - (a->param[0] + a->param[1]) + 4; break; case slang_asm_call: mach.sp--; mach.stack._addr[mach.sp] = mach.ip; mach.ip = a->param[0]; break; case slang_asm_return: mach.ip = mach.stack._addr[mach.sp]; mach.sp++; break; case slang_asm_discard: mach.kill = 1; break; case slang_asm_exit: mach.exit = 1; break; } } if (f != NULL) fclose (f); return 0; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_execute.h0000644000000000000000000000365513614532424022577 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if !defined SLANG_EXECUTE_H #define SLANG_EXECUTE_H #if defined __cplusplus extern "C" { #endif #define SLANG_MACHINE_STACK_SIZE 1024 typedef struct slang_machine_ { GLuint ip; /* instruction pointer, for flow control */ GLuint sp; /* stack pointer, for stack access */ GLuint bp; /* base pointer, for local variable access */ GLuint kill; /* discard the fragment */ GLuint exit; /* terminate the shader */ union stack_ { GLfloat _float[SLANG_MACHINE_STACK_SIZE]; GLfloat *_floatp[SLANG_MACHINE_STACK_SIZE]; GLuint _addr[SLANG_MACHINE_STACK_SIZE]; GLuint *_addrp[SLANG_MACHINE_STACK_SIZE]; } stack; } slang_machine; int _slang_execute (const slang_assembly_file *); #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_preprocess.c0000644000000000000000000000501513614532424023305 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file slang_preprocess.c * slang preprocessor * \author Michal Krol */ #include "imports.h" #include "grammar_mesa.h" #include "slang_compile.h" #include "slang_preprocess.h" static const char *slang_version_syn = #include "library/slang_version_syn.h" ; int _slang_preprocess_version (const char *text, unsigned int *version, unsigned int *eaten, slang_info_log *log) { grammar id; byte *prod, *I; unsigned int size; id = grammar_load_from_text ((const byte *) slang_version_syn); if (id == 0) { char buf[1024]; unsigned int pos; grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos); slang_info_log_error (log, buf); return 0; } if (!grammar_fast_check (id, (const byte *) text, &prod, &size, 8)) { char buf[1024]; unsigned int pos; grammar_get_last_error ( (unsigned char*) buf, 1024, (int*) &pos); slang_info_log_error (log, buf); grammar_destroy (id); return 0; } grammar_destroy (id); /* there can be multiple #version directives - grab the last one */ I = prod; while (I < prod + size) { *version = (unsigned int) I[0] + (unsigned int) I[1] * 100; *eaten = ((unsigned int) I[2]) + ((unsigned int) I[3] << 8) + ((unsigned int) I[4] << 16) + ((unsigned int) I[5] << 24); I += 6; } grammar_alloc_free (prod); return 1; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_preprocess.h0000644000000000000000000000264313614532424023316 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if !defined SLANG_PREPROCESS_H #define SLANG_PREPROCESS_H #if defined __cplusplus extern "C" { #endif int _slang_preprocess_version (const char *, unsigned int *, unsigned int *, slang_info_log *); #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_storage.c0000644000000000000000000001662513614532424022575 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file slang_storage.c * slang variable storage * \author Michal Krol */ #include "imports.h" #include "slang_utility.h" #include "slang_storage.h" #include "slang_assemble.h" /* slang_storage_array */ void slang_storage_array_construct (slang_storage_array *arr) { arr->type = slang_stor_aggregate; arr->aggregate = NULL; arr->length = 0; } void slang_storage_array_destruct (slang_storage_array *arr) { if (arr->aggregate != NULL) { slang_storage_aggregate_destruct (arr->aggregate); slang_alloc_free (arr->aggregate); } } /* slang_storage_aggregate */ void slang_storage_aggregate_construct (slang_storage_aggregate *agg) { agg->arrays = NULL; agg->count = 0; } void slang_storage_aggregate_destruct (slang_storage_aggregate *agg) { unsigned int i; for (i = 0; i < agg->count; i++) slang_storage_array_destruct (agg->arrays + i); slang_alloc_free (agg->arrays); } static slang_storage_array *slang_storage_aggregate_push_new (slang_storage_aggregate *agg) { slang_storage_array *arr = NULL; agg->arrays = (slang_storage_array *) slang_alloc_realloc (agg->arrays, agg->count * sizeof ( slang_storage_array), (agg->count + 1) * sizeof (slang_storage_array)); if (agg->arrays != NULL) { arr = agg->arrays + agg->count; slang_storage_array_construct (arr); agg->count++; } return arr; } /* _slang_aggregate_variable() */ static int aggregate_vector (slang_storage_aggregate *agg, slang_storage_type basic_type, unsigned int row_count) { slang_storage_array *arr = slang_storage_aggregate_push_new (agg); if (arr == NULL) return 0; arr->type = basic_type; arr->length = row_count; return 1; } static int aggregate_matrix (slang_storage_aggregate *agg, slang_storage_type basic_type, unsigned int dimension) { slang_storage_array *arr = slang_storage_aggregate_push_new (agg); if (arr == NULL) return 0; arr->type = slang_stor_aggregate; arr->length = dimension; arr->aggregate = (slang_storage_aggregate *) slang_alloc_malloc (sizeof ( slang_storage_aggregate)); if (arr->aggregate == NULL) return 0; slang_storage_aggregate_construct (arr->aggregate); if (!aggregate_vector (arr->aggregate, basic_type, dimension)) return 0; return 1; } static int aggregate_variables (slang_storage_aggregate *agg, const slang_variable_scope *vars, slang_function_scope *funcs, slang_struct_scope *structs) { unsigned int i; for (i = 0; i < vars->num_variables; i++) if (!_slang_aggregate_variable (agg, &vars->variables[i].type.specifier, vars->variables[i].array_size, funcs, structs)) return 0; return 1; } int _slang_aggregate_variable (slang_storage_aggregate *agg, slang_type_specifier *spec, slang_operation *array_size, slang_function_scope *funcs, slang_struct_scope *structs) { switch (spec->type) { case slang_spec_bool: return aggregate_vector (agg, slang_stor_bool, 1); case slang_spec_bvec2: return aggregate_vector (agg, slang_stor_bool, 2); case slang_spec_bvec3: return aggregate_vector (agg, slang_stor_bool, 3); case slang_spec_bvec4: return aggregate_vector (agg, slang_stor_bool, 4); case slang_spec_int: return aggregate_vector (agg, slang_stor_int, 1); case slang_spec_ivec2: return aggregate_vector (agg, slang_stor_int, 2); case slang_spec_ivec3: return aggregate_vector (agg, slang_stor_int, 3); case slang_spec_ivec4: return aggregate_vector (agg, slang_stor_int, 4); case slang_spec_float: return aggregate_vector (agg, slang_stor_float, 1); case slang_spec_vec2: return aggregate_vector (agg, slang_stor_float, 2); case slang_spec_vec3: return aggregate_vector (agg, slang_stor_float, 3); case slang_spec_vec4: return aggregate_vector (agg, slang_stor_float, 4); case slang_spec_mat2: return aggregate_matrix (agg, slang_stor_float, 2); case slang_spec_mat3: return aggregate_matrix (agg, slang_stor_float, 3); case slang_spec_mat4: return aggregate_matrix (agg, slang_stor_float, 4); case slang_spec_sampler1D: case slang_spec_sampler2D: case slang_spec_sampler3D: case slang_spec_samplerCube: case slang_spec_sampler1DShadow: case slang_spec_sampler2DShadow: return aggregate_vector (agg, slang_stor_int, 1); case slang_spec_struct: return aggregate_variables (agg, spec->_struct->fields, funcs, structs); case slang_spec_array: { slang_storage_array *arr; slang_assembly_file file; slang_assembly_flow_control flow; slang_assembly_name_space space; slang_assembly_local_info info; slang_assembly_stack_info stk; arr = slang_storage_aggregate_push_new (agg); if (arr == NULL) return 0; arr->type = slang_stor_aggregate; arr->aggregate = (slang_storage_aggregate *) slang_alloc_malloc (sizeof ( slang_storage_aggregate)); if (arr->aggregate == NULL) return 0; slang_storage_aggregate_construct (arr->aggregate); if (!_slang_aggregate_variable (arr->aggregate, spec->_array, NULL, funcs, structs)) return 0; slang_assembly_file_construct (&file); space.funcs = funcs; space.structs = structs; /* XXX: vars! */ space.vars = NULL; if (!_slang_assemble_operation (&file, array_size, 0, &flow, &space, &info, &stk)) { slang_assembly_file_destruct (&file); return 0; } /* TODO: evaluate array size */ slang_assembly_file_destruct (&file); arr->length = 256; } return 1; default: return 0; } } /* _slang_sizeof_aggregate() */ unsigned int _slang_sizeof_aggregate (const slang_storage_aggregate *agg) { unsigned int i, size = 0; for (i = 0; i < agg->count; i++) { unsigned int element_size; if (agg->arrays[i].type == slang_stor_aggregate) element_size = _slang_sizeof_aggregate (agg->arrays[i].aggregate); else element_size = sizeof (GLfloat); size += element_size * agg->arrays[i].length; } return size; } /* _slang_flatten_aggregate () */ int _slang_flatten_aggregate (slang_storage_aggregate *flat, const slang_storage_aggregate *agg) { unsigned int i; for (i = 0; i < agg->count; i++) { unsigned int j; for (j = 0; j < agg->arrays[i].length; j++) { if (agg->arrays[i].type == slang_stor_aggregate) { if (!_slang_flatten_aggregate (flat, agg->arrays[i].aggregate)) return 0; } else { slang_storage_array *arr; arr = slang_storage_aggregate_push_new (flat); if (arr == NULL) return 0; arr->type = agg->arrays[i].type; arr->length = 1; } } } return 1; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_storage.h0000644000000000000000000001012313614532424022565 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if !defined SLANG_STORAGE_H #define SLANG_STORAGE_H #include "slang_compile.h" #if defined __cplusplus extern "C" { #endif /* Program variable data storage is kept completely transparent to the front-end compiler. It is up to the back-end how the data is actually allocated. The slang_storage_type enum provides the basic information about how the memory is interpreted. This abstract piece of memory is called a data slot. A data slot of a particular type has a fixed size. For now, only the three basic types are supported, that is bool, int and float. Other built-in types like vector or matrix can easily be decomposed into a series of basic types. */ typedef enum slang_storage_type_ { slang_stor_aggregate, slang_stor_bool, slang_stor_int, slang_stor_float } slang_storage_type; /* The slang_storage_array structure groups data slots of the same type into an array. This array has a fixed length. Arrays are required to have a size equal to the sum of sizes of its elements. They are also required to support indirect addressing. That is, if B references first data slot in the array, S is the size of the data slot and I is the integral index that is not known at compile time, B+I*S references I-th data slot. This structure is also used to break down built-in data types that are not supported directly. Vectors, like vec3, are constructed from arrays of their basic types. Matrices are formed of an array of column vectors, which are in turn processed as other vectors. */ typedef struct slang_storage_array_ { slang_storage_type type; struct slang_storage_aggregate_ *aggregate; /* slang_stor_aggregate */ unsigned int length; } slang_storage_array; void slang_storage_array_construct (slang_storage_array *); void slang_storage_array_destruct (slang_storage_array *); /* The slang_storage_aggregate structure relaxes the indirect addressing requirement for slang_storage_array structure. Aggregates are always accessed statically - its member addresses are well-known at compile time. For example, user-defined types are implemented as aggregates. Aggregates can collect data of a different type. */ typedef struct slang_storage_aggregate_ { slang_storage_array *arrays; unsigned int count; } slang_storage_aggregate; void slang_storage_aggregate_construct (slang_storage_aggregate *); void slang_storage_aggregate_destruct (slang_storage_aggregate *); int _slang_aggregate_variable (slang_storage_aggregate *, struct slang_type_specifier_ *, struct slang_operation_ *, struct slang_function_scope_ *, slang_struct_scope *); /* returns total size (in machine units) of the given aggregate returns 0 on error */ unsigned int _slang_sizeof_aggregate (const slang_storage_aggregate *); /* converts structured aggregate to a flat one, with arrays of generic type being one-element long returns 1 on success returns 0 otherwise */ int _slang_flatten_aggregate (slang_storage_aggregate *, const slang_storage_aggregate *); #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_utility.c0000644000000000000000000000406513614532424022627 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file slang_utility.c * slang utilities * \author Michal Krol */ #include "imports.h" #include "slang_utility.h" void slang_alloc_free (void *ptr) { _mesa_free (ptr); } void *slang_alloc_malloc (unsigned int size) { return _mesa_malloc (size); } void *slang_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size) { return _mesa_realloc (ptr, old_size, size); } int slang_string_compare (const char *str1, const char *str2) { return _mesa_strcmp (str1, str2); } char *slang_string_copy (char *dst, const char *src) { return _mesa_strcpy (dst, src); } char *slang_string_concat (char *dst, const char *src) { return _mesa_strcpy (dst + _mesa_strlen (dst), src); } char *slang_string_duplicate (const char *src) { return _mesa_strdup (src); } unsigned int slang_string_length (const char *str) { return _mesa_strlen (str); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/slang_utility.h0000644000000000000000000000363713614532424022640 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if !defined SLANG_UTILITY_H #define SLANG_UTILITY_H #if defined __cplusplus extern "C" { #endif /* Compile-time assertions. If the expression is zero, try to declare an * array of size [-1] to cause compilation error. */ #define static_assert(expr) do { int _array[(expr) ? 1 : -1]; _array[0]; } while (0) void slang_alloc_free (void *); void *slang_alloc_malloc (unsigned int); void *slang_alloc_realloc (void *, unsigned int, unsigned int); int slang_string_compare (const char *, const char *); char *slang_string_copy (char *, const char *); char *slang_string_concat (char *, const char *); char *slang_string_duplicate (const char *); unsigned int slang_string_length (const char *); #ifdef __cplusplus } #endif #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/shader/slang/traverse_wrap.h0000644000000000000000000001007213614532424022624 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file traverse_wrap.h * Handy TIntermTraverser class wrapper * \author Michal Krol */ #ifndef __TRAVERSE_WRAP_H__ #define __TRAVERSE_WRAP_H__ #include "Include/intermediate.h" /* The original TIntermTraverser class that is used to walk the intermediate tree, is not very elegant in its design. One must define static functions with appropriate prototypes, construct TIntermTraverser object, and set its member function pointers to one's static functions. If traversal-specific data is needed, a new class must be derived, and one must up-cast the object passed as a parameter to the static function. The class below eliminates this burden by providing virtual methods that are to be overridden in the derived class. */ class traverse_wrap: private TIntermTraverser { private: static void _visitSymbol (TIntermSymbol *S, TIntermTraverser *T) { static_cast (T)->Symbol (*S); } static void _visitConstantUnion (TIntermConstantUnion *U, TIntermTraverser *T) { static_cast (T)->ConstantUnion (*U); } static bool _visitBinary (bool preVisit, TIntermBinary *B, TIntermTraverser *T) { return static_cast (T)->Binary (preVisit, *B); } static bool _visitUnary (bool preVisit, TIntermUnary *U, TIntermTraverser *T) { return static_cast (T)->Unary (preVisit, *U); } static bool _visitSelection (bool preVisit, TIntermSelection *S, TIntermTraverser *T) { return static_cast (T)->Selection (preVisit, *S); } static bool _visitAggregate (bool preVisit, TIntermAggregate *A, TIntermTraverser *T) { return static_cast (T)->Aggregate (preVisit, *A); } static bool _visitLoop (bool preVisit, TIntermLoop *L, TIntermTraverser *T) { return static_cast (T)->Loop (preVisit, *L); } static bool _visitBranch (bool preVisit, TIntermBranch *B, TIntermTraverser *T) { return static_cast (T)->Branch (preVisit, *B); } public: traverse_wrap () { visitSymbol = _visitSymbol; visitConstantUnion = _visitConstantUnion; visitBinary = _visitBinary; visitUnary = _visitUnary; visitSelection = _visitSelection; visitAggregate = _visitAggregate; visitLoop = _visitLoop; visitBranch = _visitBranch; } protected: virtual void Symbol (const TIntermSymbol &) { } virtual void ConstantUnion (const TIntermConstantUnion &) { } virtual bool Binary (bool, const TIntermBinary &) { return true; } virtual bool Unary (bool, const TIntermUnary &) { return true; } virtual bool Selection (bool, const TIntermSelection &) { return true; } virtual bool Aggregate (bool, const TIntermAggregate &) { return true; } virtual bool Loop (bool, const TIntermLoop &) { return true; } virtual bool Branch (bool, const TIntermBranch &) { return true; } }; #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_aaline.c0000644000000000000000000003603713614532424020470 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "imports.h" #include "macros.h" #include "swrast/s_aaline.h" #include "swrast/s_context.h" #include "swrast/s_span.h" #include "swrast/swrast.h" #include "mtypes.h" #define SUB_PIXEL 4 /* * Info about the AA line we're rendering */ struct LineInfo { GLfloat x0, y0; /* start */ GLfloat x1, y1; /* end */ GLfloat dx, dy; /* direction vector */ GLfloat len; /* length */ GLfloat halfWidth; /* half of line width */ GLfloat xAdj, yAdj; /* X and Y adjustment for quad corners around line */ /* for coverage computation */ GLfloat qx0, qy0; /* quad vertices */ GLfloat qx1, qy1; GLfloat qx2, qy2; GLfloat qx3, qy3; GLfloat ex0, ey0; /* quad edge vectors */ GLfloat ex1, ey1; GLfloat ex2, ey2; GLfloat ex3, ey3; /* DO_Z */ GLfloat zPlane[4]; /* DO_FOG */ GLfloat fPlane[4]; /* DO_RGBA */ GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; /* DO_INDEX */ GLfloat iPlane[4]; /* DO_SPEC */ GLfloat srPlane[4], sgPlane[4], sbPlane[4]; /* DO_TEX or DO_MULTITEX */ GLfloat sPlane[MAX_TEXTURE_COORD_UNITS][4]; GLfloat tPlane[MAX_TEXTURE_COORD_UNITS][4]; GLfloat uPlane[MAX_TEXTURE_COORD_UNITS][4]; GLfloat vPlane[MAX_TEXTURE_COORD_UNITS][4]; GLfloat lambda[MAX_TEXTURE_COORD_UNITS]; GLfloat texWidth[MAX_TEXTURE_COORD_UNITS]; GLfloat texHeight[MAX_TEXTURE_COORD_UNITS]; struct sw_span span; }; /* * Compute the equation of a plane used to interpolate line fragment data * such as color, Z, texture coords, etc. * Input: (x0, y0) and (x1,y1) are the endpoints of the line. * z0, and z1 are the end point values to interpolate. * Output: plane - the plane equation. * * Note: we don't really have enough parameters to specify a plane. * We take the endpoints of the line and compute a plane such that * the cross product of the line vector and the plane normal is * parallel to the projection plane. */ static void compute_plane(GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z0, GLfloat z1, GLfloat plane[4]) { #if 0 /* original */ const GLfloat px = x1 - x0; const GLfloat py = y1 - y0; const GLfloat pz = z1 - z0; const GLfloat qx = -py; const GLfloat qy = px; const GLfloat qz = 0; const GLfloat a = py * qz - pz * qy; const GLfloat b = pz * qx - px * qz; const GLfloat c = px * qy - py * qx; const GLfloat d = -(a * x0 + b * y0 + c * z0); plane[0] = a; plane[1] = b; plane[2] = c; plane[3] = d; #else /* simplified */ const GLfloat px = x1 - x0; const GLfloat py = y1 - y0; const GLfloat pz = z0 - z1; const GLfloat a = pz * px; const GLfloat b = pz * py; const GLfloat c = px * px + py * py; const GLfloat d = -(a * x0 + b * y0 + c * z0); if (a == 0.0 && b == 0.0 && c == 0.0 && d == 0.0) { plane[0] = 0.0; plane[1] = 0.0; plane[2] = 1.0; plane[3] = 0.0; } else { plane[0] = a; plane[1] = b; plane[2] = c; plane[3] = d; } #endif } static INLINE void constant_plane(GLfloat value, GLfloat plane[4]) { plane[0] = 0.0; plane[1] = 0.0; plane[2] = -1.0; plane[3] = value; } static INLINE GLfloat solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4]) { const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; return z; } #define SOLVE_PLANE(X, Y, PLANE) \ ((PLANE[3] + PLANE[0] * (X) + PLANE[1] * (Y)) / -PLANE[2]) /* * Return 1 / solve_plane(). */ static INLINE GLfloat solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4]) { const GLfloat denom = plane[3] + plane[0] * x + plane[1] * y; if (denom == 0.0) return 0.0; else return -plane[2] / denom; } /* * Solve plane and return clamped GLchan value. */ static INLINE GLchan solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4]) { const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; #if CHAN_TYPE == GL_FLOAT return CLAMP(z, 0.0F, CHAN_MAXF); #else if (z < 0) return 0; else if (z > CHAN_MAX) return CHAN_MAX; return (GLchan) IROUND_POS(z); #endif } /* * Compute mipmap level of detail. */ static INLINE GLfloat compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4], GLfloat invQ, GLfloat width, GLfloat height) { GLfloat dudx = sPlane[0] / sPlane[2] * invQ * width; GLfloat dudy = sPlane[1] / sPlane[2] * invQ * width; GLfloat dvdx = tPlane[0] / tPlane[2] * invQ * height; GLfloat dvdy = tPlane[1] / tPlane[2] * invQ * height; GLfloat r1 = dudx * dudx + dudy * dudy; GLfloat r2 = dvdx * dvdx + dvdy * dvdy; GLfloat rho2 = r1 + r2; /* return log base 2 of rho */ if (rho2 == 0.0F) return 0.0; else return (GLfloat) (log(rho2) * 1.442695 * 0.5);/* 1.442695 = 1/log(2) */ } /* * Fill in the samples[] array with the (x,y) subpixel positions of * xSamples * ySamples sample positions. * Note that the four corner samples are put into the first four * positions of the array. This allows us to optimize for the common * case of all samples being inside the polygon. */ static void make_sample_table(GLint xSamples, GLint ySamples, GLfloat samples[][2]) { const GLfloat dx = 1.0F / (GLfloat) xSamples; const GLfloat dy = 1.0F / (GLfloat) ySamples; GLint x, y; GLint i; i = 4; for (x = 0; x < xSamples; x++) { for (y = 0; y < ySamples; y++) { GLint j; if (x == 0 && y == 0) { /* lower left */ j = 0; } else if (x == xSamples - 1 && y == 0) { /* lower right */ j = 1; } else if (x == 0 && y == ySamples - 1) { /* upper left */ j = 2; } else if (x == xSamples - 1 && y == ySamples - 1) { /* upper right */ j = 3; } else { j = i++; } samples[j][0] = x * dx + 0.5F * dx; samples[j][1] = y * dy + 0.5F * dy; } } } /* * Compute how much of the given pixel's area is inside the rectangle * defined by vertices v0, v1, v2, v3. * Vertices MUST be specified in counter-clockwise order. * Return: coverage in [0, 1]. */ static GLfloat compute_coveragef(const struct LineInfo *info, GLint winx, GLint winy) { static GLfloat samples[SUB_PIXEL * SUB_PIXEL][2]; static GLboolean haveSamples = GL_FALSE; const GLfloat x = (GLfloat) winx; const GLfloat y = (GLfloat) winy; GLint stop = 4, i; GLfloat insideCount = SUB_PIXEL * SUB_PIXEL; if (!haveSamples) { make_sample_table(SUB_PIXEL, SUB_PIXEL, samples); haveSamples = GL_TRUE; } #if 0 /*DEBUG*/ { const GLfloat area = dx0 * dy1 - dx1 * dy0; assert(area >= 0.0); } #endif for (i = 0; i < stop; i++) { const GLfloat sx = x + samples[i][0]; const GLfloat sy = y + samples[i][1]; const GLfloat fx0 = sx - info->qx0; const GLfloat fy0 = sy - info->qy0; const GLfloat fx1 = sx - info->qx1; const GLfloat fy1 = sy - info->qy1; const GLfloat fx2 = sx - info->qx2; const GLfloat fy2 = sy - info->qy2; const GLfloat fx3 = sx - info->qx3; const GLfloat fy3 = sy - info->qy3; /* cross product determines if sample is inside or outside each edge */ GLfloat cross0 = (info->ex0 * fy0 - info->ey0 * fx0); GLfloat cross1 = (info->ex1 * fy1 - info->ey1 * fx1); GLfloat cross2 = (info->ex2 * fy2 - info->ey2 * fx2); GLfloat cross3 = (info->ex3 * fy3 - info->ey3 * fx3); /* Check if the sample is exactly on an edge. If so, let cross be a * positive or negative value depending on the direction of the edge. */ if (cross0 == 0.0F) cross0 = info->ex0 + info->ey0; if (cross1 == 0.0F) cross1 = info->ex1 + info->ey1; if (cross2 == 0.0F) cross2 = info->ex2 + info->ey2; if (cross3 == 0.0F) cross3 = info->ex3 + info->ey3; if (cross0 < 0.0F || cross1 < 0.0F || cross2 < 0.0F || cross3 < 0.0F) { /* point is outside quadrilateral */ insideCount -= 1.0F; stop = SUB_PIXEL * SUB_PIXEL; } } if (stop == 4) return 1.0F; else return insideCount * (1.0F / (SUB_PIXEL * SUB_PIXEL)); } /** * Compute coverage value for color index mode. * XXX this may not be quite correct. * \return coverage in [0,15]. */ static GLfloat compute_coveragei(const struct LineInfo *info, GLint winx, GLint winy) { return compute_coveragef(info, winx, winy) * 15.0F; } typedef void (*plot_func)(GLcontext *ctx, struct LineInfo *line, int ix, int iy); /* * Draw an AA line segment (called many times per line when stippling) */ static void segment(GLcontext *ctx, struct LineInfo *line, plot_func plot, GLfloat t0, GLfloat t1) { const GLfloat absDx = (line->dx < 0.0F) ? -line->dx : line->dx; const GLfloat absDy = (line->dy < 0.0F) ? -line->dy : line->dy; /* compute the actual segment's endpoints */ const GLfloat x0 = line->x0 + t0 * line->dx; const GLfloat y0 = line->y0 + t0 * line->dy; const GLfloat x1 = line->x0 + t1 * line->dx; const GLfloat y1 = line->y0 + t1 * line->dy; /* compute vertices of the line-aligned quadrilateral */ line->qx0 = x0 - line->yAdj; line->qy0 = y0 + line->xAdj; line->qx1 = x0 + line->yAdj; line->qy1 = y0 - line->xAdj; line->qx2 = x1 + line->yAdj; line->qy2 = y1 - line->xAdj; line->qx3 = x1 - line->yAdj; line->qy3 = y1 + line->xAdj; /* compute the quad's edge vectors (for coverage calc) */ line->ex0 = line->qx1 - line->qx0; line->ey0 = line->qy1 - line->qy0; line->ex1 = line->qx2 - line->qx1; line->ey1 = line->qy2 - line->qy1; line->ex2 = line->qx3 - line->qx2; line->ey2 = line->qy3 - line->qy2; line->ex3 = line->qx0 - line->qx3; line->ey3 = line->qy0 - line->qy3; if (absDx > absDy) { /* X-major line */ GLfloat dydx = line->dy / line->dx; GLfloat xLeft, xRight, yBot, yTop; GLint ix, ixRight; if (x0 < x1) { xLeft = x0 - line->halfWidth; xRight = x1 + line->halfWidth; if (line->dy >= 0.0) { yBot = y0 - 3.0F * line->halfWidth; yTop = y0 + line->halfWidth; } else { yBot = y0 - line->halfWidth; yTop = y0 + 3.0F * line->halfWidth; } } else { xLeft = x1 - line->halfWidth; xRight = x0 + line->halfWidth; if (line->dy <= 0.0) { yBot = y1 - 3.0F * line->halfWidth; yTop = y1 + line->halfWidth; } else { yBot = y1 - line->halfWidth; yTop = y1 + 3.0F * line->halfWidth; } } /* scan along the line, left-to-right */ ixRight = (GLint) (xRight + 1.0F); /*printf("avg span height: %g\n", yTop - yBot);*/ for (ix = (GLint) xLeft; ix < ixRight; ix++) { const GLint iyBot = (GLint) yBot; const GLint iyTop = (GLint) (yTop + 1.0F); GLint iy; /* scan across the line, bottom-to-top */ for (iy = iyBot; iy < iyTop; iy++) { (*plot)(ctx, line, ix, iy); } yBot += dydx; yTop += dydx; } } else { /* Y-major line */ GLfloat dxdy = line->dx / line->dy; GLfloat yBot, yTop, xLeft, xRight; GLint iy, iyTop; if (y0 < y1) { yBot = y0 - line->halfWidth; yTop = y1 + line->halfWidth; if (line->dx >= 0.0) { xLeft = x0 - 3.0F * line->halfWidth; xRight = x0 + line->halfWidth; } else { xLeft = x0 - line->halfWidth; xRight = x0 + 3.0F * line->halfWidth; } } else { yBot = y1 - line->halfWidth; yTop = y0 + line->halfWidth; if (line->dx <= 0.0) { xLeft = x1 - 3.0F * line->halfWidth; xRight = x1 + line->halfWidth; } else { xLeft = x1 - line->halfWidth; xRight = x1 + 3.0F * line->halfWidth; } } /* scan along the line, bottom-to-top */ iyTop = (GLint) (yTop + 1.0F); /*printf("avg span width: %g\n", xRight - xLeft);*/ for (iy = (GLint) yBot; iy < iyTop; iy++) { const GLint ixLeft = (GLint) xLeft; const GLint ixRight = (GLint) (xRight + 1.0F); GLint ix; /* scan across the line, left-to-right */ for (ix = ixLeft; ix < ixRight; ix++) { (*plot)(ctx, line, ix, iy); } xLeft += dxdy; xRight += dxdy; } } } #define NAME(x) aa_ci_##x #define DO_Z #define DO_FOG #define DO_INDEX #include "s_aalinetemp.h" #define NAME(x) aa_rgba_##x #define DO_Z #define DO_FOG #define DO_RGBA #include "s_aalinetemp.h" #define NAME(x) aa_tex_rgba_##x #define DO_Z #define DO_FOG #define DO_RGBA #define DO_TEX #include "s_aalinetemp.h" #define NAME(x) aa_multitex_rgba_##x #define DO_Z #define DO_FOG #define DO_RGBA #define DO_MULTITEX #include "s_aalinetemp.h" #define NAME(x) aa_multitex_spec_##x #define DO_Z #define DO_FOG #define DO_RGBA #define DO_MULTITEX #define DO_SPEC #include "s_aalinetemp.h" void _swrast_choose_aa_line_function(GLcontext *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); ASSERT(ctx->Line.SmoothFlag); if (ctx->Visual.rgbMode) { /* RGBA */ if (ctx->Texture._EnabledCoordUnits != 0) { if (ctx->Texture._EnabledCoordUnits > 1) { /* Multitextured! */ if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR || ctx->Fog.ColorSumEnabled) swrast->Line = aa_multitex_spec_line; else swrast->Line = aa_multitex_rgba_line; } else { swrast->Line = aa_tex_rgba_line; } } else { swrast->Line = aa_rgba_line; } } else { /* Color Index */ swrast->Line = aa_ci_line; } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_aaline.h0000644000000000000000000000245413614532424020471 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_AALINE_H #define S_AALINE_H #include "mtypes.h" #include "swrast.h" extern void _swrast_choose_aa_line_function(GLcontext *ctx); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_aalinetemp.h0000644000000000000000000002734013614532424021360 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Antialiased line template. */ /* * Function to render each fragment in the AA line. * \param ix - integer fragment window X coordiante * \param iy - integer fragment window Y coordiante */ static void NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) { const GLfloat fx = (GLfloat) ix; const GLfloat fy = (GLfloat) iy; #ifdef DO_INDEX const GLfloat coverage = compute_coveragei(line, ix, iy); #else const GLfloat coverage = compute_coveragef(line, ix, iy); #endif const GLuint i = line->span.end; if (coverage == 0.0) return; line->span.end++; line->span.array->coverage[i] = coverage; line->span.array->x[i] = ix; line->span.array->y[i] = iy; /* * Compute Z, color, texture coords, fog for the fragment by * solving the plane equations at (ix,iy). */ #ifdef DO_Z line->span.array->z[i] = (GLdepth) IROUND(solve_plane(fx, fy, line->zPlane)); #endif #ifdef DO_FOG line->span.array->fog[i] = solve_plane(fx, fy, line->fPlane); #endif #ifdef DO_RGBA line->span.array->rgba[i][RCOMP] = solve_plane_chan(fx, fy, line->rPlane); line->span.array->rgba[i][GCOMP] = solve_plane_chan(fx, fy, line->gPlane); line->span.array->rgba[i][BCOMP] = solve_plane_chan(fx, fy, line->bPlane); line->span.array->rgba[i][ACOMP] = solve_plane_chan(fx, fy, line->aPlane); #endif #ifdef DO_INDEX line->span.array->index[i] = (GLint) solve_plane(fx, fy, line->iPlane); #endif #ifdef DO_SPEC line->span.array->spec[i][RCOMP] = solve_plane_chan(fx, fy, line->srPlane); line->span.array->spec[i][GCOMP] = solve_plane_chan(fx, fy, line->sgPlane); line->span.array->spec[i][BCOMP] = solve_plane_chan(fx, fy, line->sbPlane); #endif #ifdef DO_TEX { GLfloat invQ; if (ctx->FragmentProgram._Active) { invQ = 1.0F; } else { invQ = solve_plane_recip(fx, fy, line->vPlane[0]); } line->span.array->texcoords[0][i][0] = solve_plane(fx, fy, line->sPlane[0]) * invQ; line->span.array->texcoords[0][i][1] = solve_plane(fx, fy, line->tPlane[0]) * invQ; line->span.array->texcoords[0][i][2] = solve_plane(fx, fy, line->uPlane[0]) * invQ; line->span.array->lambda[0][i] = compute_lambda(line->sPlane[0], line->tPlane[0], invQ, line->texWidth[0], line->texHeight[0]); } #elif defined(DO_MULTITEX) { GLuint unit; for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled) { GLfloat invQ; if (ctx->FragmentProgram._Active) { invQ = 1.0F; } else { invQ = solve_plane_recip(fx, fy, line->vPlane[unit]); } line->span.array->texcoords[unit][i][0] = solve_plane(fx, fy, line->sPlane[unit]) * invQ; line->span.array->texcoords[unit][i][1] = solve_plane(fx, fy, line->tPlane[unit]) * invQ; line->span.array->texcoords[unit][i][2] = solve_plane(fx, fy, line->uPlane[unit]) * invQ; line->span.array->lambda[unit][i] = compute_lambda(line->sPlane[unit], line->tPlane[unit], invQ, line->texWidth[unit], line->texHeight[unit]); } } } #endif if (line->span.end == MAX_WIDTH) { #if defined(DO_RGBA) _swrast_write_rgba_span(ctx, &(line->span)); #else _swrast_write_index_span(ctx, &(line->span)); #endif line->span.end = 0; /* reset counter */ } } /* * Line setup */ static void NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLfloat tStart, tEnd; /* segment start, end along line length */ GLboolean inSegment; GLint iLen, i; /* Init the LineInfo struct */ struct LineInfo line; line.x0 = v0->win[0]; line.y0 = v0->win[1]; line.x1 = v1->win[0]; line.y1 = v1->win[1]; line.dx = line.x1 - line.x0; line.dy = line.y1 - line.y0; line.len = SQRTF(line.dx * line.dx + line.dy * line.dy); line.halfWidth = 0.5F * ctx->Line._Width; if (line.len == 0.0 || IS_INF_OR_NAN(line.len)) return; INIT_SPAN(line.span, GL_LINE, 0, 0, SPAN_XY | SPAN_COVERAGE); line.xAdj = line.dx / line.len * line.halfWidth; line.yAdj = line.dy / line.len * line.halfWidth; #ifdef DO_Z line.span.arrayMask |= SPAN_Z; compute_plane(line.x0, line.y0, line.x1, line.y1, v0->win[2], v1->win[2], line.zPlane); #endif #ifdef DO_FOG line.span.arrayMask |= SPAN_FOG; compute_plane(line.x0, line.y0, line.x1, line.y1, v0->fog, v1->fog, line.fPlane); #endif #ifdef DO_RGBA line.span.arrayMask |= SPAN_RGBA; if (ctx->Light.ShadeModel == GL_SMOOTH) { compute_plane(line.x0, line.y0, line.x1, line.y1, v0->color[RCOMP], v1->color[RCOMP], line.rPlane); compute_plane(line.x0, line.y0, line.x1, line.y1, v0->color[GCOMP], v1->color[GCOMP], line.gPlane); compute_plane(line.x0, line.y0, line.x1, line.y1, v0->color[BCOMP], v1->color[BCOMP], line.bPlane); compute_plane(line.x0, line.y0, line.x1, line.y1, v0->color[ACOMP], v1->color[ACOMP], line.aPlane); } else { constant_plane(v1->color[RCOMP], line.rPlane); constant_plane(v1->color[GCOMP], line.gPlane); constant_plane(v1->color[BCOMP], line.bPlane); constant_plane(v1->color[ACOMP], line.aPlane); } #endif #ifdef DO_SPEC line.span.arrayMask |= SPAN_SPEC; if (ctx->Light.ShadeModel == GL_SMOOTH) { compute_plane(line.x0, line.y0, line.x1, line.y1, v0->specular[RCOMP], v1->specular[RCOMP], line.srPlane); compute_plane(line.x0, line.y0, line.x1, line.y1, v0->specular[GCOMP], v1->specular[GCOMP], line.sgPlane); compute_plane(line.x0, line.y0, line.x1, line.y1, v0->specular[BCOMP], v1->specular[BCOMP], line.sbPlane); } else { constant_plane(v1->specular[RCOMP], line.srPlane); constant_plane(v1->specular[GCOMP], line.sgPlane); constant_plane(v1->specular[BCOMP], line.sbPlane); } #endif #ifdef DO_INDEX line.span.arrayMask |= SPAN_INDEX; if (ctx->Light.ShadeModel == GL_SMOOTH) { compute_plane(line.x0, line.y0, line.x1, line.y1, v0->index, v1->index, line.iPlane); } else { constant_plane(v1->index, line.iPlane); } #endif #ifdef DO_TEX { const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; const GLfloat invW0 = v0->win[3]; const GLfloat invW1 = v1->win[3]; const GLfloat s0 = v0->texcoord[0][0] * invW0; const GLfloat s1 = v1->texcoord[0][0] * invW1; const GLfloat t0 = v0->texcoord[0][1] * invW0; const GLfloat t1 = v1->texcoord[0][1] * invW1; const GLfloat r0 = v0->texcoord[0][2] * invW0; const GLfloat r1 = v1->texcoord[0][2] * invW1; const GLfloat q0 = v0->texcoord[0][3] * invW0; const GLfloat q1 = v1->texcoord[0][3] * invW1; line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); compute_plane(line.x0, line.y0, line.x1, line.y1, s0, s1, line.sPlane[0]); compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[0]); compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[0]); compute_plane(line.x0, line.y0, line.x1, line.y1, q0, q1, line.vPlane[0]); line.texWidth[0] = (GLfloat) texImage->Width; line.texHeight[0] = (GLfloat) texImage->Height; } #elif defined(DO_MULTITEX) { GLuint u; line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture.Unit[u]._ReallyEnabled) { const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; const GLfloat invW0 = v0->win[3]; const GLfloat invW1 = v1->win[3]; const GLfloat s0 = v0->texcoord[u][0] * invW0; const GLfloat s1 = v1->texcoord[u][0] * invW1; const GLfloat t0 = v0->texcoord[u][1] * invW0; const GLfloat t1 = v1->texcoord[u][1] * invW1; const GLfloat r0 = v0->texcoord[u][2] * invW0; const GLfloat r1 = v1->texcoord[u][2] * invW1; const GLfloat q0 = v0->texcoord[u][3] * invW0; const GLfloat q1 = v1->texcoord[u][3] * invW1; compute_plane(line.x0, line.y0, line.x1, line.y1, s0, s1, line.sPlane[u]); compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[u]); compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[u]); compute_plane(line.x0, line.y0, line.x1, line.y1, q0, q1, line.vPlane[u]); line.texWidth[u] = (GLfloat) texImage->Width; line.texHeight[u] = (GLfloat) texImage->Height; } } } #endif tStart = tEnd = 0.0; inSegment = GL_FALSE; iLen = (GLint) line.len; if (ctx->Line.StippleFlag) { for (i = 0; i < iLen; i++) { const GLuint bit = (swrast->StippleCounter / ctx->Line.StippleFactor) & 0xf; if ((1 << bit) & ctx->Line.StipplePattern) { /* stipple bit is on */ const GLfloat t = (GLfloat) i / (GLfloat) line.len; if (!inSegment) { /* start new segment */ inSegment = GL_TRUE; tStart = t; } else { /* still in the segment, extend it */ tEnd = t; } } else { /* stipple bit is off */ if (inSegment && (tEnd > tStart)) { /* draw the segment */ segment(ctx, &line, NAME(plot), tStart, tEnd); inSegment = GL_FALSE; } else { /* still between segments, do nothing */ } } swrast->StippleCounter++; } if (inSegment) { /* draw the final segment of the line */ segment(ctx, &line, NAME(plot), tStart, 1.0F); } } else { /* non-stippled */ segment(ctx, &line, NAME(plot), 0.0, 1.0); } #if defined(DO_RGBA) _swrast_write_rgba_span(ctx, &(line.span)); #else _swrast_write_index_span(ctx, &(line.span)); #endif } #undef DO_Z #undef DO_FOG #undef DO_RGBA #undef DO_INDEX #undef DO_SPEC #undef DO_TEX #undef DO_MULTITEX #undef NAME nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_aatriangle.c0000644000000000000000000003234413614532424021343 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Antialiased Triangle rasterizers */ #include "glheader.h" #include "context.h" #include "colormac.h" #include "context.h" #include "macros.h" #include "imports.h" #include "nvfragprog.h" #include "s_aatriangle.h" #include "s_context.h" #include "s_span.h" /* * Compute coefficients of a plane using the X,Y coords of the v0, v1, v2 * vertices and the given Z values. * A point (x,y,z) lies on plane iff a*x+b*y+c*z+d = 0. */ static INLINE void compute_plane(const GLfloat v0[], const GLfloat v1[], const GLfloat v2[], GLfloat z0, GLfloat z1, GLfloat z2, GLfloat plane[4]) { const GLfloat px = v1[0] - v0[0]; const GLfloat py = v1[1] - v0[1]; const GLfloat pz = z1 - z0; const GLfloat qx = v2[0] - v0[0]; const GLfloat qy = v2[1] - v0[1]; const GLfloat qz = z2 - z0; /* Crossproduct "(a,b,c):= dv1 x dv2" is orthogonal to plane. */ const GLfloat a = py * qz - pz * qy; const GLfloat b = pz * qx - px * qz; const GLfloat c = px * qy - py * qx; /* Point on the plane = "r*(a,b,c) + w", with fixed "r" depending on the distance of plane from origin and arbitrary "w" parallel to the plane. */ /* The scalar product "(r*(a,b,c)+w)*(a,b,c)" is "r*(a^2+b^2+c^2)", which is equal to "-d" below. */ const GLfloat d = -(a * v0[0] + b * v0[1] + c * z0); plane[0] = a; plane[1] = b; plane[2] = c; plane[3] = d; } /* * Compute coefficients of a plane with a constant Z value. */ static INLINE void constant_plane(GLfloat value, GLfloat plane[4]) { plane[0] = 0.0; plane[1] = 0.0; plane[2] = -1.0; plane[3] = value; } #define CONSTANT_PLANE(VALUE, PLANE) \ do { \ PLANE[0] = 0.0F; \ PLANE[1] = 0.0F; \ PLANE[2] = -1.0F; \ PLANE[3] = VALUE; \ } while (0) /* * Solve plane equation for Z at (X,Y). */ static INLINE GLfloat solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4]) { ASSERT(plane[2] != 0.0F); return (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; } #define SOLVE_PLANE(X, Y, PLANE) \ ((PLANE[3] + PLANE[0] * (X) + PLANE[1] * (Y)) / -PLANE[2]) /* * Return 1 / solve_plane(). */ static INLINE GLfloat solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4]) { const GLfloat denom = plane[3] + plane[0] * x + plane[1] * y; if (denom == 0.0F) return 0.0F; else return -plane[2] / denom; } /* * Solve plane and return clamped GLchan value. */ static INLINE GLchan solve_plane_chan(GLfloat x, GLfloat y, const GLfloat plane[4]) { const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; #if CHAN_TYPE == GL_FLOAT return CLAMP(z, 0.0F, CHAN_MAXF); #else if (z < 0) return 0; else if (z > CHAN_MAX) return CHAN_MAX; return (GLchan) IROUND_POS(z); #endif } /* * Compute how much (area) of the given pixel is inside the triangle. * Vertices MUST be specified in counter-clockwise order. * Return: coverage in [0, 1]. */ static GLfloat compute_coveragef(const GLfloat v0[3], const GLfloat v1[3], const GLfloat v2[3], GLint winx, GLint winy) { /* Given a position [0,3]x[0,3] return the sub-pixel sample position. * Contributed by Ray Tice. * * Jitter sample positions - * - average should be .5 in x & y for each column * - each of the 16 rows and columns should be used once * - the rectangle formed by the first four points * should contain the other points * - the distrubition should be fairly even in any given direction * * The pattern drawn below isn't optimal, but it's better than a regular * grid. In the drawing, the center of each subpixel is surrounded by * four dots. The "x" marks the jittered position relative to the * subpixel center. */ #define POS(a, b) (0.5+a*4+b)/16 static const GLfloat samples[16][2] = { /* start with the four corners */ { POS(0, 2), POS(0, 0) }, { POS(3, 3), POS(0, 2) }, { POS(0, 0), POS(3, 1) }, { POS(3, 1), POS(3, 3) }, /* continue with interior samples */ { POS(1, 1), POS(0, 1) }, { POS(2, 0), POS(0, 3) }, { POS(0, 3), POS(1, 3) }, { POS(1, 2), POS(1, 0) }, { POS(2, 3), POS(1, 2) }, { POS(3, 2), POS(1, 1) }, { POS(0, 1), POS(2, 2) }, { POS(1, 0), POS(2, 1) }, { POS(2, 1), POS(2, 3) }, { POS(3, 0), POS(2, 0) }, { POS(1, 3), POS(3, 0) }, { POS(2, 2), POS(3, 2) } }; const GLfloat x = (GLfloat) winx; const GLfloat y = (GLfloat) winy; const GLfloat dx0 = v1[0] - v0[0]; const GLfloat dy0 = v1[1] - v0[1]; const GLfloat dx1 = v2[0] - v1[0]; const GLfloat dy1 = v2[1] - v1[1]; const GLfloat dx2 = v0[0] - v2[0]; const GLfloat dy2 = v0[1] - v2[1]; GLint stop = 4, i; GLfloat insideCount = 16.0F; #ifdef DEBUG { const GLfloat area = dx0 * dy1 - dx1 * dy0; ASSERT(area >= 0.0); } #endif for (i = 0; i < stop; i++) { const GLfloat sx = x + samples[i][0]; const GLfloat sy = y + samples[i][1]; /* cross product determines if sample is inside or outside each edge */ GLfloat cross = (dx0 * (sy - v0[1]) - dy0 * (sx - v0[0])); /* Check if the sample is exactly on an edge. If so, let cross be a * positive or negative value depending on the direction of the edge. */ if (cross == 0.0F) cross = dx0 + dy0; if (cross < 0.0F) { /* sample point is outside first edge */ insideCount -= 1.0F; stop = 16; } else { /* sample point is inside first edge */ cross = (dx1 * (sy - v1[1]) - dy1 * (sx - v1[0])); if (cross == 0.0F) cross = dx1 + dy1; if (cross < 0.0F) { /* sample point is outside second edge */ insideCount -= 1.0F; stop = 16; } else { /* sample point is inside first and second edges */ cross = (dx2 * (sy - v2[1]) - dy2 * (sx - v2[0])); if (cross == 0.0F) cross = dx2 + dy2; if (cross < 0.0F) { /* sample point is outside third edge */ insideCount -= 1.0F; stop = 16; } } } } if (stop == 4) return 1.0F; else return insideCount * (1.0F / 16.0F); } /* * Compute how much (area) of the given pixel is inside the triangle. * Vertices MUST be specified in counter-clockwise order. * Return: coverage in [0, 15]. */ static GLint compute_coveragei(const GLfloat v0[3], const GLfloat v1[3], const GLfloat v2[3], GLint winx, GLint winy) { /* NOTE: 15 samples instead of 16. */ static const GLfloat samples[15][2] = { /* start with the four corners */ { POS(0, 2), POS(0, 0) }, { POS(3, 3), POS(0, 2) }, { POS(0, 0), POS(3, 1) }, { POS(3, 1), POS(3, 3) }, /* continue with interior samples */ { POS(1, 1), POS(0, 1) }, { POS(2, 0), POS(0, 3) }, { POS(0, 3), POS(1, 3) }, { POS(1, 2), POS(1, 0) }, { POS(2, 3), POS(1, 2) }, { POS(3, 2), POS(1, 1) }, { POS(0, 1), POS(2, 2) }, { POS(1, 0), POS(2, 1) }, { POS(2, 1), POS(2, 3) }, { POS(3, 0), POS(2, 0) }, { POS(1, 3), POS(3, 0) } }; const GLfloat x = (GLfloat) winx; const GLfloat y = (GLfloat) winy; const GLfloat dx0 = v1[0] - v0[0]; const GLfloat dy0 = v1[1] - v0[1]; const GLfloat dx1 = v2[0] - v1[0]; const GLfloat dy1 = v2[1] - v1[1]; const GLfloat dx2 = v0[0] - v2[0]; const GLfloat dy2 = v0[1] - v2[1]; GLint stop = 4, i; GLint insideCount = 15; #ifdef DEBUG { const GLfloat area = dx0 * dy1 - dx1 * dy0; ASSERT(area >= 0.0); } #endif for (i = 0; i < stop; i++) { const GLfloat sx = x + samples[i][0]; const GLfloat sy = y + samples[i][1]; const GLfloat fx0 = sx - v0[0]; const GLfloat fy0 = sy - v0[1]; const GLfloat fx1 = sx - v1[0]; const GLfloat fy1 = sy - v1[1]; const GLfloat fx2 = sx - v2[0]; const GLfloat fy2 = sy - v2[1]; /* cross product determines if sample is inside or outside each edge */ GLfloat cross0 = (dx0 * fy0 - dy0 * fx0); GLfloat cross1 = (dx1 * fy1 - dy1 * fx1); GLfloat cross2 = (dx2 * fy2 - dy2 * fx2); /* Check if the sample is exactly on an edge. If so, let cross be a * positive or negative value depending on the direction of the edge. */ if (cross0 == 0.0F) cross0 = dx0 + dy0; if (cross1 == 0.0F) cross1 = dx1 + dy1; if (cross2 == 0.0F) cross2 = dx2 + dy2; if (cross0 < 0.0F || cross1 < 0.0F || cross2 < 0.0F) { /* point is outside triangle */ insideCount--; stop = 15; } } if (stop == 4) return 15; else return insideCount; } static void rgba_aa_tri(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { #define DO_Z #define DO_FOG #define DO_RGBA #include "s_aatritemp.h" } static void index_aa_tri(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { #define DO_Z #define DO_FOG #define DO_INDEX #include "s_aatritemp.h" } /* * Compute mipmap level of detail. * XXX we should really include the R coordinate in this computation * in order to do 3-D texture mipmapping. */ static INLINE GLfloat compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4], const GLfloat qPlane[4], GLfloat cx, GLfloat cy, GLfloat invQ, GLfloat texWidth, GLfloat texHeight) { const GLfloat s = solve_plane(cx, cy, sPlane); const GLfloat t = solve_plane(cx, cy, tPlane); const GLfloat invQ_x1 = solve_plane_recip(cx+1.0F, cy, qPlane); const GLfloat invQ_y1 = solve_plane_recip(cx, cy+1.0F, qPlane); const GLfloat s_x1 = s - sPlane[0] / sPlane[2]; const GLfloat s_y1 = s - sPlane[1] / sPlane[2]; const GLfloat t_x1 = t - tPlane[0] / tPlane[2]; const GLfloat t_y1 = t - tPlane[1] / tPlane[2]; GLfloat dsdx = s_x1 * invQ_x1 - s * invQ; GLfloat dsdy = s_y1 * invQ_y1 - s * invQ; GLfloat dtdx = t_x1 * invQ_x1 - t * invQ; GLfloat dtdy = t_y1 * invQ_y1 - t * invQ; GLfloat maxU, maxV, rho, lambda; dsdx = FABSF(dsdx); dsdy = FABSF(dsdy); dtdx = FABSF(dtdx); dtdy = FABSF(dtdy); maxU = MAX2(dsdx, dsdy) * texWidth; maxV = MAX2(dtdx, dtdy) * texHeight; rho = MAX2(maxU, maxV); lambda = LOG2(rho); return lambda; } static void tex_aa_tri(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { #define DO_Z #define DO_FOG #define DO_RGBA #define DO_TEX #include "s_aatritemp.h" } static void spec_tex_aa_tri(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { #define DO_Z #define DO_FOG #define DO_RGBA #define DO_TEX #define DO_SPEC #include "s_aatritemp.h" } static void multitex_aa_tri(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { #define DO_Z #define DO_FOG #define DO_RGBA #define DO_MULTITEX #include "s_aatritemp.h" } static void spec_multitex_aa_tri(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { #define DO_Z #define DO_FOG #define DO_RGBA #define DO_MULTITEX #define DO_SPEC #include "s_aatritemp.h" } /* * Examine GL state and set swrast->Triangle to an * appropriate antialiased triangle rasterizer function. */ void _swrast_set_aa_triangle_function(GLcontext *ctx) { ASSERT(ctx->Polygon.SmoothFlag); if (ctx->Texture._EnabledCoordUnits != 0) { if (NEED_SECONDARY_COLOR(ctx)) { if (ctx->Texture._EnabledCoordUnits > 1) { SWRAST_CONTEXT(ctx)->Triangle = spec_multitex_aa_tri; } else { SWRAST_CONTEXT(ctx)->Triangle = spec_tex_aa_tri; } } else { if (ctx->Texture._EnabledCoordUnits > 1) { SWRAST_CONTEXT(ctx)->Triangle = multitex_aa_tri; } else { SWRAST_CONTEXT(ctx)->Triangle = tex_aa_tri; } } } else if (ctx->Visual.rgbMode) { SWRAST_CONTEXT(ctx)->Triangle = rgba_aa_tri; } else { SWRAST_CONTEXT(ctx)->Triangle = index_aa_tri; } ASSERT(SWRAST_CONTEXT(ctx)->Triangle); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_aatriangle.h0000644000000000000000000000246513614532424021351 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_AATRIANGLE_H #define S_AATRIANGLE_H #include "mtypes.h" #include "swrast.h" extern void _swrast_set_aa_triangle_function(GLcontext *ctx); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_aatritemp.h0000644000000000000000000004660513614532424021234 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Antialiased Triangle Rasterizer Template * * This file is #include'd to generate custom AA triangle rasterizers. * NOTE: this code hasn't been optimized yet. That'll come after it * works correctly. * * The following macros may be defined to indicate what auxillary information * must be copmuted across the triangle: * DO_Z - if defined, compute Z values * DO_RGBA - if defined, compute RGBA values * DO_INDEX - if defined, compute color index values * DO_SPEC - if defined, compute specular RGB values * DO_TEX - if defined, compute unit 0 STRQ texcoords * DO_MULTITEX - if defined, compute all unit's STRQ texcoords */ /*void triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv )*/ { const GLfloat *p0 = v0->win; const GLfloat *p1 = v1->win; const GLfloat *p2 = v2->win; const SWvertex *vMin, *vMid, *vMax; GLint iyMin, iyMax; GLfloat yMin, yMax; GLboolean ltor; GLfloat majDx, majDy; /* major (i.e. long) edge dx and dy */ struct sw_span span; #ifdef DO_Z GLfloat zPlane[4]; #endif #ifdef DO_FOG GLfloat fogPlane[4]; #else GLfloat *fog = NULL; #endif #ifdef DO_RGBA GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; #endif #ifdef DO_INDEX GLfloat iPlane[4]; #endif #ifdef DO_SPEC GLfloat srPlane[4], sgPlane[4], sbPlane[4]; #endif #ifdef DO_TEX GLfloat sPlane[4], tPlane[4], uPlane[4], vPlane[4]; GLfloat texWidth, texHeight; #elif defined(DO_MULTITEX) GLfloat sPlane[MAX_TEXTURE_COORD_UNITS][4]; /* texture S */ GLfloat tPlane[MAX_TEXTURE_COORD_UNITS][4]; /* texture T */ GLfloat uPlane[MAX_TEXTURE_COORD_UNITS][4]; /* texture R */ GLfloat vPlane[MAX_TEXTURE_COORD_UNITS][4]; /* texture Q */ GLfloat texWidth[MAX_TEXTURE_COORD_UNITS]; GLfloat texHeight[MAX_TEXTURE_COORD_UNITS]; #endif GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceSign; INIT_SPAN(span, GL_POLYGON, 0, 0, SPAN_COVERAGE); /* determine bottom to top order of vertices */ { GLfloat y0 = v0->win[1]; GLfloat y1 = v1->win[1]; GLfloat y2 = v2->win[1]; if (y0 <= y1) { if (y1 <= y2) { vMin = v0; vMid = v1; vMax = v2; /* y0<=y1<=y2 */ } else if (y2 <= y0) { vMin = v2; vMid = v0; vMax = v1; /* y2<=y0<=y1 */ } else { vMin = v0; vMid = v2; vMax = v1; bf = -bf; /* y0<=y2<=y1 */ } } else { if (y0 <= y2) { vMin = v1; vMid = v0; vMax = v2; bf = -bf; /* y1<=y0<=y2 */ } else if (y2 <= y1) { vMin = v2; vMid = v1; vMax = v0; bf = -bf; /* y2<=y1<=y0 */ } else { vMin = v1; vMid = v2; vMax = v0; /* y1<=y2<=y0 */ } } } majDx = vMax->win[0] - vMin->win[0]; majDy = vMax->win[1] - vMin->win[1]; { const GLfloat botDx = vMid->win[0] - vMin->win[0]; const GLfloat botDy = vMid->win[1] - vMin->win[1]; const GLfloat area = majDx * botDy - botDx * majDy; /* Do backface culling */ if (area * bf < 0 || area == 0 || IS_INF_OR_NAN(area)) return; ltor = (GLboolean) (area < 0.0F); } #ifndef DO_OCCLUSION_TEST ctx->OcclusionResult = GL_TRUE; #endif /* Plane equation setup: * We evaluate plane equations at window (x,y) coordinates in order * to compute color, Z, fog, texcoords, etc. This isn't terribly * efficient but it's easy and reliable. */ #ifdef DO_Z compute_plane(p0, p1, p2, p0[2], p1[2], p2[2], zPlane); span.arrayMask |= SPAN_Z; #endif #ifdef DO_FOG compute_plane(p0, p1, p2, v0->fog, v1->fog, v2->fog, fogPlane); span.arrayMask |= SPAN_FOG; #endif #ifdef DO_RGBA if (ctx->Light.ShadeModel == GL_SMOOTH) { compute_plane(p0, p1, p2, v0->color[RCOMP], v1->color[RCOMP], v2->color[RCOMP], rPlane); compute_plane(p0, p1, p2, v0->color[GCOMP], v1->color[GCOMP], v2->color[GCOMP], gPlane); compute_plane(p0, p1, p2, v0->color[BCOMP], v1->color[BCOMP], v2->color[BCOMP], bPlane); compute_plane(p0, p1, p2, v0->color[ACOMP], v1->color[ACOMP], v2->color[ACOMP], aPlane); } else { constant_plane(v2->color[RCOMP], rPlane); constant_plane(v2->color[GCOMP], gPlane); constant_plane(v2->color[BCOMP], bPlane); constant_plane(v2->color[ACOMP], aPlane); } span.arrayMask |= SPAN_RGBA; #endif #ifdef DO_INDEX if (ctx->Light.ShadeModel == GL_SMOOTH) { compute_plane(p0, p1, p2, (GLfloat) v0->index, v1->index, v2->index, iPlane); } else { constant_plane(v2->index, iPlane); } span.arrayMask |= SPAN_INDEX; #endif #ifdef DO_SPEC if (ctx->Light.ShadeModel == GL_SMOOTH) { compute_plane(p0, p1, p2, v0->specular[RCOMP], v1->specular[RCOMP], v2->specular[RCOMP], srPlane); compute_plane(p0, p1, p2, v0->specular[GCOMP], v1->specular[GCOMP], v2->specular[GCOMP], sgPlane); compute_plane(p0, p1, p2, v0->specular[BCOMP], v1->specular[BCOMP], v2->specular[BCOMP], sbPlane); } else { constant_plane(v2->specular[RCOMP], srPlane); constant_plane(v2->specular[GCOMP], sgPlane); constant_plane(v2->specular[BCOMP], sbPlane); } span.arrayMask |= SPAN_SPEC; #endif #ifdef DO_TEX { const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; const GLfloat invW0 = v0->win[3]; const GLfloat invW1 = v1->win[3]; const GLfloat invW2 = v2->win[3]; const GLfloat s0 = v0->texcoord[0][0] * invW0; const GLfloat s1 = v1->texcoord[0][0] * invW1; const GLfloat s2 = v2->texcoord[0][0] * invW2; const GLfloat t0 = v0->texcoord[0][1] * invW0; const GLfloat t1 = v1->texcoord[0][1] * invW1; const GLfloat t2 = v2->texcoord[0][1] * invW2; const GLfloat r0 = v0->texcoord[0][2] * invW0; const GLfloat r1 = v1->texcoord[0][2] * invW1; const GLfloat r2 = v2->texcoord[0][2] * invW2; const GLfloat q0 = v0->texcoord[0][3] * invW0; const GLfloat q1 = v1->texcoord[0][3] * invW1; const GLfloat q2 = v2->texcoord[0][3] * invW2; compute_plane(p0, p1, p2, s0, s1, s2, sPlane); compute_plane(p0, p1, p2, t0, t1, t2, tPlane); compute_plane(p0, p1, p2, r0, r1, r2, uPlane); compute_plane(p0, p1, p2, q0, q1, q2, vPlane); texWidth = (GLfloat) texImage->Width; texHeight = (GLfloat) texImage->Height; } span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); #elif defined(DO_MULTITEX) { GLuint u; for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture.Unit[u]._ReallyEnabled) { const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; const GLfloat invW0 = v0->win[3]; const GLfloat invW1 = v1->win[3]; const GLfloat invW2 = v2->win[3]; const GLfloat s0 = v0->texcoord[u][0] * invW0; const GLfloat s1 = v1->texcoord[u][0] * invW1; const GLfloat s2 = v2->texcoord[u][0] * invW2; const GLfloat t0 = v0->texcoord[u][1] * invW0; const GLfloat t1 = v1->texcoord[u][1] * invW1; const GLfloat t2 = v2->texcoord[u][1] * invW2; const GLfloat r0 = v0->texcoord[u][2] * invW0; const GLfloat r1 = v1->texcoord[u][2] * invW1; const GLfloat r2 = v2->texcoord[u][2] * invW2; const GLfloat q0 = v0->texcoord[u][3] * invW0; const GLfloat q1 = v1->texcoord[u][3] * invW1; const GLfloat q2 = v2->texcoord[u][3] * invW2; compute_plane(p0, p1, p2, s0, s1, s2, sPlane[u]); compute_plane(p0, p1, p2, t0, t1, t2, tPlane[u]); compute_plane(p0, p1, p2, r0, r1, r2, uPlane[u]); compute_plane(p0, p1, p2, q0, q1, q2, vPlane[u]); texWidth[u] = (GLfloat) texImage->Width; texHeight[u] = (GLfloat) texImage->Height; } } } span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); #endif /* Begin bottom-to-top scan over the triangle. * The long edge will either be on the left or right side of the * triangle. We always scan from the long edge toward the shorter * edges, stopping when we find that coverage = 0. If the long edge * is on the left we scan left-to-right. Else, we scan right-to-left. */ yMin = vMin->win[1]; yMax = vMax->win[1]; iyMin = (GLint) yMin; iyMax = (GLint) yMax + 1; if (ltor) { /* scan left to right */ const GLfloat *pMin = vMin->win; const GLfloat *pMid = vMid->win; const GLfloat *pMax = vMax->win; const GLfloat dxdy = majDx / majDy; const GLfloat xAdj = dxdy < 0.0F ? -dxdy : 0.0F; GLfloat x = pMin[0] - (yMin - iyMin) * dxdy; GLint iy; for (iy = iyMin; iy < iyMax; iy++, x += dxdy) { GLint ix, startX = (GLint) (x - xAdj); GLuint count; GLfloat coverage = 0.0F; /* skip over fragments with zero coverage */ while (startX < MAX_WIDTH) { coverage = compute_coveragef(pMin, pMid, pMax, startX, iy); if (coverage > 0.0F) break; startX++; } /* enter interior of triangle */ ix = startX; count = 0; while (coverage > 0.0F) { /* (cx,cy) = center of fragment */ const GLfloat cx = ix + 0.5F, cy = iy + 0.5F; struct span_arrays *array = span.array; #ifdef DO_INDEX array->coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy); #else array->coverage[count] = coverage; #endif #ifdef DO_Z array->z[count] = (GLdepth) IROUND(solve_plane(cx, cy, zPlane)); #endif #ifdef DO_FOG array->fog[count] = solve_plane(cx, cy, fogPlane); #endif #ifdef DO_RGBA array->rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane); array->rgba[count][GCOMP] = solve_plane_chan(cx, cy, gPlane); array->rgba[count][BCOMP] = solve_plane_chan(cx, cy, bPlane); array->rgba[count][ACOMP] = solve_plane_chan(cx, cy, aPlane); #endif #ifdef DO_INDEX array->index[count] = (GLint) solve_plane(cx, cy, iPlane); #endif #ifdef DO_SPEC array->spec[count][RCOMP] = solve_plane_chan(cx, cy, srPlane); array->spec[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane); array->spec[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane); #endif #ifdef DO_TEX { const GLfloat invQ = solve_plane_recip(cx, cy, vPlane); array->texcoords[0][count][0] = solve_plane(cx, cy, sPlane) * invQ; array->texcoords[0][count][1] = solve_plane(cx, cy, tPlane) * invQ; array->texcoords[0][count][2] = solve_plane(cx, cy, uPlane) * invQ; array->lambda[0][count] = compute_lambda(sPlane, tPlane, vPlane, cx, cy, invQ, texWidth, texHeight); } #elif defined(DO_MULTITEX) { GLuint unit; for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled) { GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]); array->texcoords[unit][count][0] = solve_plane(cx, cy, sPlane[unit]) * invQ; array->texcoords[unit][count][1] = solve_plane(cx, cy, tPlane[unit]) * invQ; array->texcoords[unit][count][2] = solve_plane(cx, cy, uPlane[unit]) * invQ; array->lambda[unit][count] = compute_lambda(sPlane[unit], tPlane[unit], vPlane[unit], cx, cy, invQ, texWidth[unit], texHeight[unit]); } } } #endif ix++; count++; coverage = compute_coveragef(pMin, pMid, pMax, ix, iy); } if (ix <= startX) continue; span.x = startX; span.y = iy; span.end = (GLuint) ix - (GLuint) startX; ASSERT(span.interpMask == 0); #if defined(DO_RGBA) _swrast_write_rgba_span(ctx, &span); #else _swrast_write_index_span(ctx, &span); #endif } } else { /* scan right to left */ const GLfloat *pMin = vMin->win; const GLfloat *pMid = vMid->win; const GLfloat *pMax = vMax->win; const GLfloat dxdy = majDx / majDy; const GLfloat xAdj = dxdy > 0 ? dxdy : 0.0F; GLfloat x = pMin[0] - (yMin - iyMin) * dxdy; GLint iy; for (iy = iyMin; iy < iyMax; iy++, x += dxdy) { GLint ix, left, startX = (GLint) (x + xAdj); GLuint count, n; GLfloat coverage = 0.0F; /* make sure we're not past the window edge */ if (startX >= ctx->DrawBuffer->_Xmax) { startX = ctx->DrawBuffer->_Xmax - 1; } /* skip fragments with zero coverage */ while (startX >= 0) { coverage = compute_coveragef(pMin, pMax, pMid, startX, iy); if (coverage > 0.0F) break; startX--; } /* enter interior of triangle */ ix = startX; count = 0; while (coverage > 0.0F) { /* (cx,cy) = center of fragment */ const GLfloat cx = ix + 0.5F, cy = iy + 0.5F; struct span_arrays *array = span.array; #ifdef DO_INDEX array->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy); #else array->coverage[ix] = coverage; #endif #ifdef DO_Z array->z[ix] = (GLdepth) IROUND(solve_plane(cx, cy, zPlane)); #endif #ifdef DO_FOG array->fog[ix] = solve_plane(cx, cy, fogPlane); #endif #ifdef DO_RGBA array->rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane); array->rgba[ix][GCOMP] = solve_plane_chan(cx, cy, gPlane); array->rgba[ix][BCOMP] = solve_plane_chan(cx, cy, bPlane); array->rgba[ix][ACOMP] = solve_plane_chan(cx, cy, aPlane); #endif #ifdef DO_INDEX array->index[ix] = (GLint) solve_plane(cx, cy, iPlane); #endif #ifdef DO_SPEC array->spec[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane); array->spec[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane); array->spec[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane); #endif #ifdef DO_TEX { const GLfloat invQ = solve_plane_recip(cx, cy, vPlane); array->texcoords[0][ix][0] = solve_plane(cx, cy, sPlane) * invQ; array->texcoords[0][ix][1] = solve_plane(cx, cy, tPlane) * invQ; array->texcoords[0][ix][2] = solve_plane(cx, cy, uPlane) * invQ; array->lambda[0][ix] = compute_lambda(sPlane, tPlane, vPlane, cx, cy, invQ, texWidth, texHeight); } #elif defined(DO_MULTITEX) { GLuint unit; for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled) { GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]); array->texcoords[unit][ix][0] = solve_plane(cx, cy, sPlane[unit]) * invQ; array->texcoords[unit][ix][1] = solve_plane(cx, cy, tPlane[unit]) * invQ; array->texcoords[unit][ix][2] = solve_plane(cx, cy, uPlane[unit]) * invQ; array->lambda[unit][ix] = compute_lambda(sPlane[unit], tPlane[unit], vPlane[unit], cx, cy, invQ, texWidth[unit], texHeight[unit]); } } } #endif ix--; count++; coverage = compute_coveragef(pMin, pMax, pMid, ix, iy); } if (startX <= ix) continue; n = (GLuint) startX - (GLuint) ix; left = ix + 1; /* shift all values to the left */ /* XXX this is temporary */ { struct span_arrays *array = span.array; GLint j; for (j = 0; j < (GLint) n; j++) { #ifdef DO_RGBA COPY_CHAN4(array->rgba[j], array->rgba[j + left]); #endif #ifdef DO_SPEC COPY_CHAN4(array->spec[j], array->spec[j + left]); #endif #ifdef DO_INDEX array->index[j] = array->index[j + left]; #endif #ifdef DO_Z array->z[j] = array->z[j + left]; #endif #ifdef DO_FOG array->fog[j] = array->fog[j + left]; #endif #ifdef DO_TEX COPY_4V(array->texcoords[0][j], array->texcoords[0][j + left]); #endif #if defined(DO_MULTITEX) || defined(DO_TEX) array->lambda[0][j] = array->lambda[0][j + left]; #endif array->coverage[j] = array->coverage[j + left]; } } #ifdef DO_MULTITEX /* shift texcoords */ { struct span_arrays *array = span.array; GLuint unit; for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled) { GLint j; for (j = 0; j < (GLint) n; j++) { array->texcoords[unit][j][0] = array->texcoords[unit][j + left][0]; array->texcoords[unit][j][1] = array->texcoords[unit][j + left][1]; array->texcoords[unit][j][2] = array->texcoords[unit][j + left][2]; array->lambda[unit][j] = array->lambda[unit][j + left]; } } } } #endif span.x = left; span.y = iy; span.end = n; ASSERT(span.interpMask == 0); #if defined(DO_RGBA) _swrast_write_rgba_span(ctx, &span); #else _swrast_write_index_span(ctx, &span); #endif } } } #ifdef DO_Z #undef DO_Z #endif #ifdef DO_FOG #undef DO_FOG #endif #ifdef DO_RGBA #undef DO_RGBA #endif #ifdef DO_INDEX #undef DO_INDEX #endif #ifdef DO_SPEC #undef DO_SPEC #endif #ifdef DO_TEX #undef DO_TEX #endif #ifdef DO_MULTITEX #undef DO_MULTITEX #endif #ifdef DO_OCCLUSION_TEST #undef DO_OCCLUSION_TEST #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_accum.c0000644000000000000000000004346613614532424020333 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "context.h" #include "macros.h" #include "imports.h" #include "fbobject.h" #include "s_accum.h" #include "s_context.h" #include "s_masking.h" #include "s_span.h" #define ACCUM_SCALE16 32767.0 /* * Accumulation buffer notes * * Normally, accumulation buffer values are GLshorts with values in * [-32767, 32767] which represent floating point colors in [-1, 1], * as defined by the OpenGL specification. * * We optimize for the common case used for full-scene antialiasing: * // start with accum buffer cleared to zero * glAccum(GL_LOAD, w); // or GL_ACCUM the first image * glAccum(GL_ACCUM, w); * ... * glAccum(GL_ACCUM, w); * glAccum(GL_RETURN, 1.0); * That is, we start with an empty accumulation buffer and accumulate * n images, each with weight w = 1/n. * In this scenario, we can simply store unscaled integer values in * the accum buffer instead of scaled integers. We'll also keep track * of the w value so when we do GL_RETURN we simply divide the accumulated * values by n (n=1/w). * This lets us avoid _many_ int->float->int conversions. */ #if CHAN_BITS == 8 && ACCUM_BITS <= 32 /* enable the optimization */ #define USE_OPTIMIZED_ACCUM 1 #else #define USE_OPTIMIZED_ACCUM 0 #endif /** * This is called when we fall out of optimized/unscaled accum buffer mode. * That is, we convert each unscaled accum buffer value into a scaled value * representing the range[-1, 1]. */ static void rescale_accum( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_renderbuffer *rb = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer; const GLfloat s = swrast->_IntegerAccumScaler * (32767.0F / CHAN_MAXF); assert(rb); assert(rb->_BaseFormat == GL_RGBA); /* add other types in future? */ assert(rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT); assert(swrast->_IntegerAccumMode); if (rb->GetPointer(ctx, rb, 0, 0)) { /* directly-addressable memory */ GLuint y; for (y = 0; y < rb->Height; y++) { GLuint i; GLshort *acc = (GLshort *) rb->GetPointer(ctx, rb, 0, y); for (i = 0; i < 4 * rb->Width; i++) { acc[i] = (GLshort) (acc[i] * s); } } } else { /* use get/put row funcs */ GLuint y; for (y = 0; y < rb->Height; y++) { GLshort accRow[MAX_WIDTH * 4]; GLuint i; rb->GetRow(ctx, rb, rb->Width, 0, y, accRow); for (i = 0; i < 4 * rb->Width; i++) { accRow[i] = (GLshort) (accRow[i] * s); } rb->PutRow(ctx, rb, rb->Width, 0, y, accRow, NULL); } } swrast->_IntegerAccumMode = GL_FALSE; } /** * Clear the accumulation Buffer. */ void _swrast_clear_accum_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint x, y, width, height; if (ctx->Visual.accumRedBits == 0) { /* No accumulation buffer! Not an error. */ return; } assert(rb); assert(rb->_BaseFormat == GL_RGBA); /* add other types in future? */ assert(rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT); /* bounds, with scissor */ x = ctx->DrawBuffer->_Xmin; y = ctx->DrawBuffer->_Ymin; width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) { const GLfloat accScale = 32767.0; GLshort clearVal[4]; GLuint i; clearVal[0] = (GLshort) (ctx->Accum.ClearColor[0] * accScale); clearVal[1] = (GLshort) (ctx->Accum.ClearColor[1] * accScale); clearVal[2] = (GLshort) (ctx->Accum.ClearColor[2] * accScale); clearVal[3] = (GLshort) (ctx->Accum.ClearColor[3] * accScale); for (i = 0; i < height; i++) { rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL); } } else { /* someday support other sizes */ } /* update optimized accum state vars */ if (ctx->Accum.ClearColor[0] == 0.0 && ctx->Accum.ClearColor[1] == 0.0 && ctx->Accum.ClearColor[2] == 0.0 && ctx->Accum.ClearColor[3] == 0.0) { #if USE_OPTIMIZED_ACCUM swrast->_IntegerAccumMode = GL_TRUE; #else swrast->_IntegerAccumMode = GL_FALSE; #endif swrast->_IntegerAccumScaler = 0.0; /* denotes empty accum buffer */ } else { swrast->_IntegerAccumMode = GL_FALSE; } } static void accum_add(GLcontext *ctx, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_renderbuffer *rb = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer; assert(rb); /* Leave optimized accum buffer mode */ if (swrast->_IntegerAccumMode) rescale_accum(ctx); if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) { const GLshort incr = (GLshort) (value * ACCUM_SCALE16); if (rb->GetPointer(ctx, rb, 0, 0)) { GLint i, j; for (i = 0; i < height; i++) { GLshort *acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i); for (j = 0; j < 4 * width; j++) { acc[j] += incr; } } } else { GLint i, j; for (i = 0; i < height; i++) { GLshort accRow[4 * MAX_WIDTH]; rb->GetRow(ctx, rb, width, xpos, ypos + i, accRow); for (j = 0; j < 4 * width; j++) { accRow[j] += incr; } rb->PutRow(ctx, rb, width, xpos, ypos + i, accRow, NULL); } } } else { /* other types someday */ } } static void accum_mult(GLcontext *ctx, GLfloat mult, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_renderbuffer *rb = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer; assert(rb); /* Leave optimized accum buffer mode */ if (swrast->_IntegerAccumMode) rescale_accum(ctx); if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) { if (rb->GetPointer(ctx, rb, 0, 0)) { GLint i, j; for (i = 0; i < height; i++) { GLshort *acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i); for (j = 0; j < 4 * width; j++) { acc[j] = (GLshort) (acc[j] * mult); } } } else { GLint i, j; for (i = 0; i < height; i++) { GLshort accRow[4 * MAX_WIDTH]; rb->GetRow(ctx, rb, width, xpos, ypos + i, accRow); for (j = 0; j < 4 * width; j++) { accRow[j] = (GLshort) (accRow[j] * mult); } rb->PutRow(ctx, rb, width, xpos, ypos + i, accRow, NULL); } } } else { /* other types someday */ } } static void accum_accum(GLcontext *ctx, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_renderbuffer *rb = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer; const GLboolean directAccess = (rb->GetPointer(ctx, rb, 0, 0) != NULL); assert(rb); if (!ctx->ReadBuffer->_ColorReadBuffer) { /* no read buffer - OK */ return; } /* May have to leave optimized accum buffer mode */ if (swrast->_IntegerAccumScaler == 0.0 && value > 0.0 && value <= 1.0) swrast->_IntegerAccumScaler = value; if (swrast->_IntegerAccumMode && value != swrast->_IntegerAccumScaler) rescale_accum(ctx); _swrast_use_read_buffer(ctx); if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) { const GLfloat scale = value * ACCUM_SCALE16 / CHAN_MAXF; GLshort accumRow[4 * MAX_WIDTH]; GLchan rgba[MAX_WIDTH][4]; GLint i; for (i = 0; i < height; i++) { GLshort *acc; if (directAccess) { acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i); } else { rb->GetRow(ctx, rb, width, xpos, ypos + i, accumRow); acc = accumRow; } /* read colors from color buffer */ _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer, width, xpos, ypos + i, rgba); /* do accumulation */ if (swrast->_IntegerAccumMode) { /* simply add integer color values into accum buffer */ GLint j; for (j = 0; j < width; j++) { acc[j * 4 + 0] += rgba[j][RCOMP]; acc[j * 4 + 1] += rgba[j][GCOMP]; acc[j * 4 + 2] += rgba[j][BCOMP]; acc[j * 4 + 3] += rgba[j][ACOMP]; } } else { /* scaled integer (or float) accum buffer */ GLint j; for (j = 0; j < width; j++) { acc[j * 4 + 0] += (GLshort) ((GLfloat) rgba[j][RCOMP] * scale); acc[j * 4 + 1] += (GLshort) ((GLfloat) rgba[j][GCOMP] * scale); acc[j * 4 + 2] += (GLshort) ((GLfloat) rgba[j][BCOMP] * scale); acc[j * 4 + 3] += (GLshort) ((GLfloat) rgba[j][ACOMP] * scale); } } if (!directAccess) { rb->PutRow(ctx, rb, width, xpos, ypos + i, accumRow, NULL); } } } else { /* other types someday */ } _swrast_use_draw_buffer(ctx); } static void accum_load(GLcontext *ctx, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_renderbuffer *rb = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer; const GLboolean directAccess = (rb->GetPointer(ctx, rb, 0, 0) != NULL); assert(rb); if (!ctx->ReadBuffer->_ColorReadBuffer) { /* no read buffer - OK */ return; } /* This is a change to go into optimized accum buffer mode */ if (value > 0.0 && value <= 1.0) { #if USE_OPTIMIZED_ACCUM swrast->_IntegerAccumMode = GL_TRUE; #else swrast->_IntegerAccumMode = GL_FALSE; #endif swrast->_IntegerAccumScaler = value; } else { swrast->_IntegerAccumMode = GL_FALSE; swrast->_IntegerAccumScaler = 0.0; } _swrast_use_read_buffer(ctx); if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) { const GLfloat scale = value * ACCUM_SCALE16 / CHAN_MAXF; GLshort accumRow[4 * MAX_WIDTH]; GLchan rgba[MAX_WIDTH][4]; GLint i; for (i = 0; i < height; i++) { GLshort *acc; if (directAccess) { acc = (GLshort *) rb->GetPointer(ctx, rb, xpos, ypos + i); } else { rb->GetRow(ctx, rb, width, xpos, ypos + i, accumRow); acc = accumRow; } /* read colors from color buffer */ _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer, width, xpos, ypos + i, rgba); /* do load */ if (swrast->_IntegerAccumMode) { /* just copy values in */ GLint j; assert(swrast->_IntegerAccumScaler > 0.0); assert(swrast->_IntegerAccumScaler <= 1.0); for (j = 0; j < width; j++) { acc[j * 4 + 0] = rgba[j][RCOMP]; acc[j * 4 + 1] = rgba[j][GCOMP]; acc[j * 4 + 2] = rgba[j][BCOMP]; acc[j * 4 + 3] = rgba[j][ACOMP]; } } else { /* scaled integer (or float) accum buffer */ GLint j; for (j = 0; j < width; j++) { acc[j * 4 + 0] = (GLshort) ((GLfloat) rgba[j][RCOMP] * scale); acc[j * 4 + 1] = (GLshort) ((GLfloat) rgba[j][GCOMP] * scale); acc[j * 4 + 2] = (GLshort) ((GLfloat) rgba[j][BCOMP] * scale); acc[j * 4 + 3] = (GLshort) ((GLfloat) rgba[j][ACOMP] * scale); } } if (!directAccess) { rb->PutRow(ctx, rb, width, xpos, ypos + i, accumRow, NULL); } } } else { /* other types someday */ } _swrast_use_draw_buffer(ctx); } static void accum_return(GLcontext *ctx, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_framebuffer *fb = ctx->DrawBuffer; struct gl_renderbuffer *accumRb = fb->Attachment[BUFFER_ACCUM].Renderbuffer; const GLboolean directAccess = (accumRb->GetPointer(ctx, accumRb, 0, 0) != NULL); const GLboolean masking = (!ctx->Color.ColorMask[RCOMP] || !ctx->Color.ColorMask[GCOMP] || !ctx->Color.ColorMask[BCOMP] || !ctx->Color.ColorMask[ACOMP]); static GLchan multTable[32768]; static GLfloat prevMult = 0.0; const GLfloat mult = swrast->_IntegerAccumScaler; const GLint max = MIN2((GLint) (256 / mult), 32767); /* May have to leave optimized accum buffer mode */ if (swrast->_IntegerAccumMode && value != 1.0) rescale_accum(ctx); if (swrast->_IntegerAccumMode && swrast->_IntegerAccumScaler > 0) { /* build lookup table to avoid many floating point multiplies */ GLint j; assert(swrast->_IntegerAccumScaler <= 1.0); if (mult != prevMult) { for (j = 0; j < max; j++) multTable[j] = IROUND((GLfloat) j * mult); prevMult = mult; } } if (accumRb->DataType == GL_SHORT || accumRb->DataType == GL_UNSIGNED_SHORT) { const GLfloat scale = value * CHAN_MAXF / ACCUM_SCALE16; GLuint buffer, i; /* XXX maybe transpose the 'i' and 'buffer' loops??? */ for (i = 0; i < height; i++) { GLchan rgba[MAX_WIDTH][4]; GLshort accumRow[4 * MAX_WIDTH]; GLshort *acc; if (directAccess) { acc = (GLshort *) accumRb->GetPointer(ctx, accumRb, xpos, ypos +i); } else { accumRb->GetRow(ctx, accumRb, width, xpos, ypos + i, accumRow); acc = accumRow; } /* get the colors to return */ if (swrast->_IntegerAccumMode) { GLint j; for (j = 0; j < width; j++) { ASSERT(acc[j * 4 + 0] < max); ASSERT(acc[j * 4 + 1] < max); ASSERT(acc[j * 4 + 2] < max); ASSERT(acc[j * 4 + 3] < max); rgba[j][RCOMP] = multTable[acc[j * 4 + 0]]; rgba[j][GCOMP] = multTable[acc[j * 4 + 1]]; rgba[j][BCOMP] = multTable[acc[j * 4 + 2]]; rgba[j][ACOMP] = multTable[acc[j * 4 + 3]]; } } else { /* scaled integer (or float) accum buffer */ GLint j; for (j = 0; j < width; j++) { GLint r = IROUND( (GLfloat) (acc[j * 4 + 0]) * scale ); GLint g = IROUND( (GLfloat) (acc[j * 4 + 1]) * scale ); GLint b = IROUND( (GLfloat) (acc[j * 4 + 2]) * scale ); GLint a = IROUND( (GLfloat) (acc[j * 4 + 3]) * scale ); rgba[j][RCOMP] = CLAMP( r, 0, CHAN_MAX ); rgba[j][GCOMP] = CLAMP( g, 0, CHAN_MAX ); rgba[j][BCOMP] = CLAMP( b, 0, CHAN_MAX ); rgba[j][ACOMP] = CLAMP( a, 0, CHAN_MAX ); } } /* store colors */ for (buffer = 0; buffer < fb->_NumColorDrawBuffers[0]; buffer++) { struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[0][buffer]; if (masking) { _swrast_mask_rgba_array(ctx, rb, width, xpos, ypos + i, rgba); } rb->PutRow(ctx, rb, width, xpos, ypos + i, rgba, NULL); } } } else { /* other types someday */ } } /** * Software fallback for glAccum. */ void _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (SWRAST_CONTEXT(ctx)->NewState) _swrast_validate_derived( ctx ); if (!ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer) { _mesa_warning(ctx, "Calling glAccum() without an accumulation buffer"); return; } RENDER_START(swrast, ctx); switch (op) { case GL_ADD: if (value != 0.0F) { accum_add(ctx, value, xpos, ypos, width, height); } break; case GL_MULT: if (value != 1.0F) { accum_mult(ctx, value, xpos, ypos, width, height); } break; case GL_ACCUM: if (value != 0.0F) { accum_accum(ctx, value, xpos, ypos, width, height); } break; case GL_LOAD: accum_load(ctx, value, xpos, ypos, width, height); break; case GL_RETURN: accum_return(ctx, value, xpos, ypos, width, height); break; default: _mesa_problem(ctx, "invalid mode in _swrast_Accum()"); break; } RENDER_FINISH(swrast, ctx); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_accum.h0000644000000000000000000000245413614532424020330 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_ACCUM_H #define S_ACCUM_H #include "mtypes.h" extern void _swrast_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_alpha.c0000644000000000000000000001526513614532424020324 0ustar /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file swrast/s_alpha.c * \brief Functions to apply alpha test. */ #include "glheader.h" #include "context.h" #include "colormac.h" #include "macros.h" #include "s_alpha.h" #include "s_context.h" /** * \fn GLint _swrast_alpha_test( const GLcontext *ctx, struct sw_span *span ) * \brief Apply the alpha test to a span of pixels. * \return * - "0" = all pixels in the span failed the alpha test. * - "1" = one or more pixels passed the alpha test. */ GLint _swrast_alpha_test( const GLcontext *ctx, struct sw_span *span ) { const GLchan (*rgba)[4] = (const GLchan (*)[4]) span->array->rgba; GLchan ref; const GLuint n = span->end; GLubyte *mask = span->array->mask; GLuint i; CLAMPED_FLOAT_TO_CHAN(ref, ctx->Color.AlphaRef); if (span->arrayMask & SPAN_RGBA) { /* Use the array values */ switch (ctx->Color.AlphaFunc) { case GL_LESS: for (i = 0; i < n; i++) mask[i] &= (rgba[i][ACOMP] < ref); break; case GL_LEQUAL: for (i = 0; i < n; i++) mask[i] &= (rgba[i][ACOMP] <= ref); break; case GL_GEQUAL: for (i = 0; i < n; i++) mask[i] &= (rgba[i][ACOMP] >= ref); break; case GL_GREATER: for (i = 0; i < n; i++) mask[i] &= (rgba[i][ACOMP] > ref); break; case GL_NOTEQUAL: for (i = 0; i < n; i++) mask[i] &= (rgba[i][ACOMP] != ref); break; case GL_EQUAL: for (i = 0; i < n; i++) mask[i] &= (rgba[i][ACOMP] == ref); break; case GL_ALWAYS: /* do nothing */ return 1; case GL_NEVER: /* caller should check for zero! */ span->writeAll = GL_FALSE; return 0; default: _mesa_problem( ctx, "Invalid alpha test in _swrast_alpha_test" ); return 0; } } else { /* Use the interpolation values */ #if CHAN_TYPE == GL_FLOAT const GLfloat alphaStep = span->alphaStep; GLfloat alpha = span->alpha; ASSERT(span->interpMask & SPAN_RGBA); switch (ctx->Color.AlphaFunc) { case GL_LESS: for (i = 0; i < n; i++) { mask[i] &= (alpha < ref); alpha += alphaStep; } break; case GL_LEQUAL: for (i = 0; i < n; i++) { mask[i] &= (alpha <= ref); alpha += alphaStep; } break; case GL_GEQUAL: for (i = 0; i < n; i++) { mask[i] &= (alpha >= ref); alpha += alphaStep; } break; case GL_GREATER: for (i = 0; i < n; i++) { mask[i] &= (alpha > ref); alpha += alphaStep; } break; case GL_NOTEQUAL: for (i = 0; i < n; i++) { mask[i] &= (alpha != ref); alpha += alphaStep; } break; case GL_EQUAL: for (i = 0; i < n; i++) { mask[i] &= (alpha == ref); alpha += alphaStep; } break; case GL_ALWAYS: /* do nothing */ return 1; case GL_NEVER: /* caller should check for zero! */ span->writeAll = GL_FALSE; return 0; default: _mesa_problem( ctx, "Invalid alpha test in gl_alpha_test" ); return 0; } #else /* 8 or 16-bit channel interpolation */ const GLfixed alphaStep = span->alphaStep; GLfixed alpha = span->alpha; ASSERT(span->interpMask & SPAN_RGBA); switch (ctx->Color.AlphaFunc) { case GL_LESS: for (i = 0; i < n; i++) { mask[i] &= (FixedToChan(alpha) < ref); alpha += alphaStep; } break; case GL_LEQUAL: for (i = 0; i < n; i++) { mask[i] &= (FixedToChan(alpha) <= ref); alpha += alphaStep; } break; case GL_GEQUAL: for (i = 0; i < n; i++) { mask[i] &= (FixedToChan(alpha) >= ref); alpha += alphaStep; } break; case GL_GREATER: for (i = 0; i < n; i++) { mask[i] &= (FixedToChan(alpha) > ref); alpha += alphaStep; } break; case GL_NOTEQUAL: for (i = 0; i < n; i++) { mask[i] &= (FixedToChan(alpha) != ref); alpha += alphaStep; } break; case GL_EQUAL: for (i = 0; i < n; i++) { mask[i] &= (FixedToChan(alpha) == ref); alpha += alphaStep; } break; case GL_ALWAYS: /* do nothing */ return 1; case GL_NEVER: /* caller should check for zero! */ span->writeAll = GL_FALSE; return 0; default: _mesa_problem( ctx, "Invalid alpha test in gl_alpha_test" ); return 0; } #endif /* CHAN_TYPE */ } #if 0 /* XXXX This causes conformance failures!!!! */ while ((span->start <= span->end) && (mask[span->start] == 0)) span->start ++; while ((span->end >= span->start) && (mask[span->end] == 0)) span->end --; #endif span->writeAll = GL_FALSE; if (span->start >= span->end) return 0; else return 1; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_alpha.h0000644000000000000000000000247713614532424020332 0ustar /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_ALPHA_H #define S_ALPHA_H #include "mtypes.h" #include "s_context.h" extern GLint _swrast_alpha_test( const GLcontext *ctx, struct sw_span *span ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_atifragshader.c0000644000000000000000000004010313614532424022030 0ustar /* * * Copyright (C) 2004 David Airlie All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * DAVID AIRLIE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "atifragshader.h" #include "macros.h" #include "program.h" #include "s_atifragshader.h" #include "s_nvfragprog.h" #include "s_span.h" #include "s_texture.h" /** * Fetch a texel. */ static void fetch_texel(GLcontext * ctx, const GLfloat texcoord[4], GLfloat lambda, GLuint unit, GLfloat color[4]) { GLchan rgba[4]; SWcontext *swrast = SWRAST_CONTEXT(ctx); /* XXX use a float-valued TextureSample routine here!!! */ swrast->TextureSample[unit] (ctx, unit, ctx->Texture.Unit[unit]._Current, 1, (const GLfloat(*)[4]) texcoord, &lambda, &rgba); color[0] = CHAN_TO_FLOAT(rgba[0]); color[1] = CHAN_TO_FLOAT(rgba[1]); color[2] = CHAN_TO_FLOAT(rgba[2]); color[3] = CHAN_TO_FLOAT(rgba[3]); } static void apply_swizzle(struct atifs_machine *machine, GLuint reg, GLuint swizzle) { GLfloat s, t, r, q; s = machine->Registers[reg][0]; t = machine->Registers[reg][1]; r = machine->Registers[reg][2]; q = machine->Registers[reg][3]; switch (swizzle) { case GL_SWIZZLE_STR_ATI: machine->Registers[reg][0] = s; machine->Registers[reg][1] = t; machine->Registers[reg][2] = r; break; case GL_SWIZZLE_STQ_ATI: machine->Registers[reg][0] = s; machine->Registers[reg][1] = t; machine->Registers[reg][2] = q; break; case GL_SWIZZLE_STR_DR_ATI: machine->Registers[reg][0] = s / r; machine->Registers[reg][1] = t / r; machine->Registers[reg][2] = 1 / r; break; case GL_SWIZZLE_STQ_DQ_ATI: machine->Registers[reg][0] = s / q; machine->Registers[reg][1] = t / q; machine->Registers[reg][2] = 1 / q; break; } machine->Registers[reg][3] = 0.0; } static void apply_src_rep(GLint optype, GLuint rep, GLfloat * val) { GLint i; GLint start, end; if (!rep) return; start = optype ? 3 : 0; end = optype ? 4 : 3; for (i = start; i < end; i++) { switch (rep) { case GL_RED: val[i] = val[0]; break; case GL_GREEN: val[i] = val[1]; break; case GL_BLUE: val[i] = val[2]; break; case GL_ALPHA: val[i] = val[3]; break; } } } static void apply_src_mod(GLint optype, GLuint mod, GLfloat * val) { GLint i; GLint start, end; if (!mod) return; start = optype ? 3 : 0; end = optype ? 4 : 3; for (i = start; i < end; i++) { if (mod & GL_COMP_BIT_ATI) val[i] = 1 - val[i]; if (mod & GL_BIAS_BIT_ATI) val[i] = val[i] - 0.5; if (mod & GL_2X_BIT_ATI) val[i] = 2 * val[i]; if (mod & GL_NEGATE_BIT_ATI) val[i] = -val[i]; } } static void apply_dst_mod(GLuint optype, GLuint mod, GLfloat * val) { GLint i; GLint has_sat = mod & GL_SATURATE_BIT_ATI; GLint start, end; mod &= ~GL_SATURATE_BIT_ATI; start = optype ? 3 : 0; end = optype ? 4 : 3; for (i = start; i < end; i++) { switch (mod) { case GL_2X_BIT_ATI: val[i] = 2 * val[i]; break; case GL_4X_BIT_ATI: val[i] = 4 * val[i]; break; case GL_8X_BIT_ATI: val[i] = 8 * val[i]; break; case GL_HALF_BIT_ATI: val[i] = val[i] * 0.5; break; case GL_QUARTER_BIT_ATI: val[i] = val[i] * 0.25; break; case GL_EIGHTH_BIT_ATI: val[i] = val[i] * 0.125; break; } if (has_sat) { if (val[i] < 0.0) val[i] = 0; else if (val[i] > 1.0) val[i] = 1.0; } else { if (val[i] < -8.0) val[i] = -8.0; else if (val[i] > 8.0) val[i] = 8.0; } } } static void write_dst_addr(GLuint optype, GLuint mod, GLuint mask, GLfloat * src, GLfloat * dst) { GLint i; apply_dst_mod(optype, mod, src); if (optype == ATI_FRAGMENT_SHADER_COLOR_OP) { if (mask) { if (mask & GL_RED_BIT_ATI) dst[0] = src[0]; if (mask & GL_GREEN_BIT_ATI) dst[1] = src[1]; if (mask & GL_BLUE_BIT_ATI) dst[2] = src[2]; } else { for (i = 0; i < 3; i++) dst[i] = src[i]; } } else dst[3] = src[3]; } static void finish_pass(struct atifs_machine *machine) { GLint i; for (i = 0; i < 6; i++) { COPY_4V(machine->PrevPassRegisters[i], machine->Registers[i]); } } /** * Execute the given fragment shader * NOTE: we do everything in single-precision floating point; we don't * currently observe the single/half/fixed-precision qualifiers. * \param ctx - rendering context * \param program - the fragment program to execute * \param machine - machine state (register file) * \param maxInst - max number of instructions to execute * \return GL_TRUE if program completed or GL_FALSE if program executed KIL. */ struct ati_fs_opcode_st ati_fs_opcodes[] = { {GL_ADD_ATI, 2}, {GL_SUB_ATI, 2}, {GL_MUL_ATI, 2}, {GL_MAD_ATI, 3}, {GL_LERP_ATI, 3}, {GL_MOV_ATI, 1}, {GL_CND_ATI, 3}, {GL_CND0_ATI, 3}, {GL_DOT2_ADD_ATI, 3}, {GL_DOT3_ATI, 2}, {GL_DOT4_ATI, 2} }; static void handle_pass_op(struct atifs_machine *machine, struct atifs_instruction *inst, const struct sw_span *span, GLuint column) { GLuint idx = inst->DstReg[0].Index - GL_REG_0_ATI; GLuint swizzle = inst->DstReg[0].Swizzle; GLuint pass_tex = inst->SrcReg[0][0].Index; /* if we get here after passing pass one then we are starting pass two - backup the registers */ if (machine->pass == 1) { finish_pass(machine); machine->pass = 2; } if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) { pass_tex -= GL_TEXTURE0_ARB; COPY_4V(machine->Registers[idx], span->array->texcoords[pass_tex][column]); } else if (pass_tex >= GL_REG_0_ATI && pass_tex <= GL_REG_5_ATI && machine->pass == 2) { pass_tex -= GL_REG_0_ATI; COPY_4V(machine->Registers[idx], machine->PrevPassRegisters[pass_tex]); } apply_swizzle(machine, idx, swizzle); } static void handle_sample_op(GLcontext * ctx, struct atifs_machine *machine, struct atifs_instruction *inst, const struct sw_span *span, GLuint column) { GLuint idx = inst->DstReg[0].Index - GL_REG_0_ATI; GLuint swizzle = inst->DstReg[0].Swizzle; GLuint sample_tex = inst->SrcReg[0][0].Index; /* if we get here after passing pass one then we are starting pass two - backup the registers */ if (machine->pass == 1) { finish_pass(machine); machine->pass = 2; } if (sample_tex >= GL_TEXTURE0_ARB && sample_tex <= GL_TEXTURE7_ARB) { sample_tex -= GL_TEXTURE0_ARB; fetch_texel(ctx, span->array->texcoords[sample_tex][column], 0.0F, sample_tex, machine->Registers[idx]); } else if (sample_tex >= GL_REG_0_ATI && sample_tex <= GL_REG_5_ATI) { /* this is wrong... */ sample_tex -= GL_REG_0_ATI; fetch_texel(ctx, machine->Registers[sample_tex], 0, sample_tex, machine->Registers[idx]); } apply_swizzle(machine, idx, swizzle); } #define SETUP_SRC_REG(optype, i, x) do { \ if (optype) \ src[optype][i][3] = x[3]; \ else \ COPY_3V(src[optype][i], x); \ } while (0) static GLboolean execute_shader(GLcontext * ctx, const struct ati_fragment_shader *shader, GLuint maxInst, struct atifs_machine *machine, const struct sw_span *span, GLuint column) { GLuint pc; struct atifs_instruction *inst; GLint optype; GLint i; GLint dstreg; GLfloat src[2][3][4]; GLfloat zeros[4] = { 0.0, 0.0, 0.0, 0.0 }; GLfloat ones[4] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat dst[2][4], *dstp; for (pc = 0; pc < shader->Base.NumInstructions; pc++) { inst = &shader->Instructions[pc]; if (inst->Opcode[0] == ATI_FRAGMENT_SHADER_PASS_OP) handle_pass_op(machine, inst, span, column); else if (inst->Opcode[0] == ATI_FRAGMENT_SHADER_SAMPLE_OP) handle_sample_op(ctx, machine, inst, span, column); else { if (machine->pass == 0) machine->pass = 1; /* setup the source registers for color and alpha ops */ for (optype = 0; optype < 2; optype++) { for (i = 0; i < inst->ArgCount[optype]; i++) { GLint index = inst->SrcReg[optype][i].Index; if (index >= GL_REG_0_ATI && index <= GL_REG_5_ATI) SETUP_SRC_REG(optype, i, machine->Registers[index - GL_REG_0_ATI]); else if (index >= GL_CON_0_ATI && index <= GL_CON_7_ATI) SETUP_SRC_REG(optype, i, shader->Constants[index - GL_CON_0_ATI]); else if (index == GL_ONE) SETUP_SRC_REG(optype, i, ones); else if (index == GL_ZERO) SETUP_SRC_REG(optype, i, zeros); else if (index == GL_PRIMARY_COLOR_EXT) SETUP_SRC_REG(optype, i, machine->Inputs[ATI_FS_INPUT_PRIMARY]); else if (index == GL_SECONDARY_INTERPOLATOR_ATI) SETUP_SRC_REG(optype, i, machine->Inputs[ATI_FS_INPUT_SECONDARY]); apply_src_rep(optype, inst->SrcReg[optype][i].argRep, src[optype][i]); apply_src_mod(optype, inst->SrcReg[optype][i].argMod, src[optype][i]); } } /* Execute the operations - color then alpha */ for (optype = 0; optype < 2; optype++) { if (inst->Opcode[optype]) { switch (inst->Opcode[optype]) { case GL_ADD_ATI: if (!optype) for (i = 0; i < 3; i++) { dst[optype][i] = src[optype][0][i] + src[optype][1][i]; } else dst[optype][3] = src[optype][0][3] + src[optype][1][3]; break; case GL_SUB_ATI: if (!optype) for (i = 0; i < 3; i++) { dst[optype][i] = src[optype][0][i] - src[optype][1][i]; } else dst[optype][3] = src[optype][0][3] - src[optype][1][3]; break; case GL_MUL_ATI: if (!optype) for (i = 0; i < 3; i++) { dst[optype][i] = src[optype][0][i] * src[optype][1][i]; } else dst[optype][3] = src[optype][0][3] * src[optype][1][3]; break; case GL_MAD_ATI: if (!optype) for (i = 0; i < 3; i++) { dst[optype][i] = src[optype][0][i] * src[optype][1][i] + src[optype][2][i]; } else dst[optype][3] = src[optype][0][3] * src[optype][1][3] + src[optype][2][3]; break; case GL_LERP_ATI: if (!optype) for (i = 0; i < 3; i++) { dst[optype][i] = src[optype][0][i] * src[optype][1][i] + (1 - src [optype] [0][i]) * src[optype][2][i]; } else dst[optype][3] = src[optype][0][3] * src[optype][1][3] + (1 - src[optype] [0][3]) * src[optype][2][3]; break; case GL_MOV_ATI: if (!optype) for (i = 0; i < 3; i++) { dst[optype][i] = src[optype][0][i]; } else dst[optype][3] = src[optype][0][3]; break; case GL_CND_ATI: if (!optype) { for (i = 0; i < 3; i++) { dst[optype][i] = (src[optype][2][i] > 0.5) ? src[optype][0][i] : src[optype][1][i]; } } else { dst[optype][3] = (src[optype][2][3] > 0.5) ? src[optype][0][3] : src[optype][1][3]; } break; case GL_CND0_ATI: if (!optype) for (i = 0; i < 3; i++) { dst[optype][i] = (src[optype][2][i] >= 0) ? src[optype][0][i] : src[optype][1][i]; } else { dst[optype][3] = (src[optype][2][3] >= 0) ? src[optype][0][3] : src[optype][1][3]; } break; case GL_DOT2_ADD_ATI: { GLfloat result; /* DOT 2 always uses the source from the color op */ result = src[0][0][0] * src[0][1][0] + src[0][0][1] * src[0][1][1] + src[0][2][2]; if (!optype) { for (i = 0; i < 3; i++) { dst[optype][i] = result; } } else dst[optype][3] = result; } break; case GL_DOT3_ATI: { GLfloat result; /* DOT 3 always uses the source from the color op */ result = src[0][0][0] * src[0][1][0] + src[0][0][1] * src[0][1][1] + src[0][0][2] * src[0][1][2]; if (!optype) { for (i = 0; i < 3; i++) { dst[optype][i] = result; } } else dst[optype][3] = result; } break; case GL_DOT4_ATI: { GLfloat result; /* DOT 4 always uses the source from the color op */ result = src[optype][0][0] * src[0][1][0] + src[0][0][1] * src[0][1][1] + src[0][0][2] * src[0][1][2] + src[0][0][3] * src[0][1][3]; if (!optype) { for (i = 0; i < 3; i++) { dst[optype][i] = result; } } else dst[optype][3] = result; } break; } } } /* write out the destination registers */ for (optype = 0; optype < 2; optype++) { if (inst->Opcode[optype]) { dstreg = inst->DstReg[optype].Index; dstp = machine->Registers[dstreg - GL_REG_0_ATI]; write_dst_addr(optype, inst->DstReg[optype].dstMod, inst->DstReg[optype].dstMask, dst[optype], dstp); } } } } return GL_TRUE; } static void init_machine(GLcontext * ctx, struct atifs_machine *machine, const struct ati_fragment_shader *shader, const struct sw_span *span, GLuint col) { GLint i, j; for (i = 0; i < 6; i++) { for (j = 0; j < 4; j++) ctx->ATIFragmentShader.Machine.Registers[i][j] = 0.0; } ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_PRIMARY][0] = CHAN_TO_FLOAT(span->array->rgba[col][0]); ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_PRIMARY][1] = CHAN_TO_FLOAT(span->array->rgba[col][1]); ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_PRIMARY][2] = CHAN_TO_FLOAT(span->array->rgba[col][2]); ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_PRIMARY][3] = CHAN_TO_FLOAT(span->array->rgba[col][3]); ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_SECONDARY][0] = CHAN_TO_FLOAT(span->array->spec[col][0]); ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_SECONDARY][1] = CHAN_TO_FLOAT(span->array->spec[col][1]); ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_SECONDARY][2] = CHAN_TO_FLOAT(span->array->spec[col][2]); ctx->ATIFragmentShader.Machine.Inputs[ATI_FS_INPUT_SECONDARY][3] = CHAN_TO_FLOAT(span->array->spec[col][3]); ctx->ATIFragmentShader.Machine.pass = 0; } /** * Execute the current fragment program, operating on the given span. */ void _swrast_exec_fragment_shader(GLcontext * ctx, struct sw_span *span) { const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current; GLuint i; ctx->_CurrentProgram = GL_FRAGMENT_SHADER_ATI; for (i = 0; i < span->end; i++) { if (span->array->mask[i]) { init_machine(ctx, &ctx->ATIFragmentShader.Machine, ctx->ATIFragmentShader.Current, span, i); if (execute_shader(ctx, shader, ~0, &ctx->ATIFragmentShader.Machine, span, i)) { span->array->mask[i] = GL_FALSE; } { const GLfloat *colOut = ctx->ATIFragmentShader.Machine.Registers[0]; /*fprintf(stderr,"outputs %f %f %f %f\n", colOut[0], colOut[1], colOut[2], colOut[3]); */ UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][RCOMP], colOut[0]); UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][GCOMP], colOut[1]); UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][BCOMP], colOut[2]); UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][ACOMP], colOut[3]); } } } ctx->_CurrentProgram = 0; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_atifragshader.h0000644000000000000000000000250113614532424022035 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2003 David Airlie All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * DAVID AIRLIE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_ATIFRAGSHADER_H #define S_ATIFRAGSHADER_H #include "s_context.h" extern void _swrast_exec_fragment_shader( GLcontext *ctx, struct sw_span *span ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_bitmap.c0000644000000000000000000002046013614532424020504 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file swrast/s_bitmap.c * \brief glBitmap rendering. * \author Brian Paul */ #include "glheader.h" #include "bufferobj.h" #include "image.h" #include "macros.h" #include "pixel.h" #include "s_context.h" #include "s_span.h" /* * Render a bitmap. */ void _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLint row, col; GLuint count = 0; struct sw_span span; ASSERT(ctx->RenderMode == GL_RENDER); if (unpack->BufferObj->Name) { /* unpack from PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, GL_COLOR_INDEX, GL_BITMAP, (GLvoid *) bitmap)) { _mesa_error(ctx, GL_INVALID_OPERATION,"glBitmap(invalid PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, unpack->BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); return; } bitmap = ADD_POINTERS(buf, bitmap); } RENDER_START(swrast,ctx); if (SWRAST_CONTEXT(ctx)->NewState) _swrast_validate_derived( ctx ); INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_XY); if (ctx->Visual.rgbMode) { span.interpMask |= SPAN_RGBA; span.red = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF); span.green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF); span.blue = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF); span.alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF); span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0; } else { span.interpMask |= SPAN_INDEX; span.index = FloatToFixed(ctx->Current.RasterIndex); span.indexStep = 0; } if (ctx->Depth.Test) _swrast_span_default_z(ctx, &span); if (swrast->_FogEnabled) _swrast_span_default_fog(ctx, &span); if (ctx->Texture._EnabledCoordUnits) _swrast_span_default_texcoords(ctx, &span); for (row = 0; row < height; row++) { const GLubyte *src = (const GLubyte *) _mesa_image_address2d(unpack, bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, row, 0); if (unpack->LsbFirst) { /* Lsb first */ GLubyte mask = 1U << (unpack->SkipPixels & 0x7); for (col = 0; col < width; col++) { if (*src & mask) { span.array->x[count] = px + col; span.array->y[count] = py + row; count++; } if (mask == 128U) { src++; mask = 1U; } else { mask = mask << 1; } } /* get ready for next row */ if (mask != 1) src++; } else { /* Msb first */ GLubyte mask = 128U >> (unpack->SkipPixels & 0x7); for (col = 0; col < width; col++) { if (*src & mask) { span.array->x[count] = px + col; span.array->y[count] = py + row; count++; } if (mask == 1U) { src++; mask = 128U; } else { mask = mask >> 1; } } /* get ready for next row */ if (mask != 128) src++; } if (count + width >= MAX_WIDTH || row + 1 == height) { /* flush the span */ span.end = count; if (ctx->Visual.rgbMode) _swrast_write_rgba_span(ctx, &span); else _swrast_write_index_span(ctx, &span); span.end = 0; count = 0; } } RENDER_FINISH(swrast,ctx); if (unpack->BufferObj->Name) { /* done with PBO so unmap it now */ ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, unpack->BufferObj); } } #if 0 /* * XXX this is another way to implement Bitmap. Use horizontal runs of * fragments, initializing the mask array to indicate which fragmens to * draw or skip. */ void _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLint row, col; struct sw_span span; ASSERT(ctx->RenderMode == GL_RENDER); ASSERT(bitmap); RENDER_START(swrast,ctx); if (SWRAST_CONTEXT(ctx)->NewState) _swrast_validate_derived( ctx ); INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_MASK); /*span.arrayMask |= SPAN_MASK;*/ /* we'll init span.mask[] */ span.x = px; span.y = py; /*span.end = width;*/ if (ctx->Visual.rgbMode) { span.interpMask |= SPAN_RGBA; span.red = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF); span.green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF); span.blue = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF); span.alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF); span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0; } else { span.interpMask |= SPAN_INDEX; span.index = FloatToFixed(ctx->Current.RasterIndex); span.indexStep = 0; } if (ctx->Depth.Test) _swrast_span_default_z(ctx, &span); if (swrast->_FogEnabled) _swrast_span_default_fog(ctx, &span); if (ctx->Texture._EnabledCoordUnits) _swrast_span_default_texcoords(ctx, &span); for (row=0; rowLsbFirst) { /* Lsb first */ GLubyte mask = 1U << (unpack->SkipPixels & 0x7); for (col=0; colmask[col] = (*src & mask) ? GL_TRUE : GL_FALSE; if (mask == 128U) { src++; mask = 1U; } else { mask = mask << 1; } } if (ctx->Visual.rgbMode) _swrast_write_rgba_span(ctx, &span); else _swrast_write_index_span(ctx, &span); /* get ready for next row */ if (mask != 1) src++; } else { /* Msb first */ GLubyte mask = 128U >> (unpack->SkipPixels & 0x7); for (col=0; colmask[col] = (*src & mask) ? GL_TRUE : GL_FALSE; if (mask == 1U) { src++; mask = 128U; } else { mask = mask >> 1; } } if (ctx->Visual.rgbMode) _swrast_write_rgba_span(ctx, &span); else _swrast_write_index_span(ctx, &span); /* get ready for next row */ if (mask != 128) src++; } } RENDER_FINISH(swrast,ctx); } #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_blend.c0000644000000000000000000007205713614532424020325 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Regarding GL_NV_blend_square: * * Portions of this software may use or implement intellectual * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims * any and all warranties with respect to such intellectual property, * including any use thereof or modifications thereto. */ #include "glheader.h" #include "context.h" #include "colormac.h" #include "macros.h" #include "s_blend.h" #include "s_context.h" #include "s_span.h" #if defined(USE_MMX_ASM) #include "x86/mmx.h" #include "x86/common_x86_asm.h" #define _BLENDAPI _ASMAPI #else #define _BLENDAPI #endif /* * Special case for glBlendFunc(GL_ZERO, GL_ONE) */ static void _BLENDAPI blend_noop( GLcontext *ctx, GLuint n, const GLubyte mask[], GLchan rgba[][4], CONST GLchan dest[][4] ) { GLuint i; ASSERT(ctx->Color.BlendEquationRGB==GL_FUNC_ADD); ASSERT(ctx->Color.BlendEquationA==GL_FUNC_ADD); ASSERT(ctx->Color.BlendSrcRGB==GL_ZERO); ASSERT(ctx->Color.BlendDstRGB==GL_ONE); (void) ctx; for (i = 0; i < n; i++) { if (mask[i]) { COPY_CHAN4( rgba[i], dest[i] ); } } } /* * Special case for glBlendFunc(GL_ONE, GL_ZERO) */ static void _BLENDAPI blend_replace( GLcontext *ctx, GLuint n, const GLubyte mask[], GLchan rgba[][4], CONST GLchan dest[][4] ) { ASSERT(ctx->Color.BlendEquationRGB==GL_FUNC_ADD); ASSERT(ctx->Color.BlendEquationA==GL_FUNC_ADD); ASSERT(ctx->Color.BlendSrcRGB==GL_ONE); ASSERT(ctx->Color.BlendDstRGB==GL_ZERO); (void) ctx; (void) n; (void) mask; (void) rgba; (void) dest; } /* * Common transparency blending mode. */ static void _BLENDAPI blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[], GLchan rgba[][4], CONST GLchan dest[][4] ) { GLuint i; ASSERT(ctx->Color.BlendEquationRGB==GL_FUNC_ADD); ASSERT(ctx->Color.BlendEquationA==GL_FUNC_ADD); ASSERT(ctx->Color.BlendSrcRGB==GL_SRC_ALPHA); ASSERT(ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA); (void) ctx; for (i=0;i> 8; const GLint g = (rgba[i][GCOMP] * t + dest[i][GCOMP] * s + 1) >> 8; const GLint b = (rgba[i][BCOMP] * t + dest[i][BCOMP] * s + 1) >> 8; const GLint a = (rgba[i][ACOMP] * t + dest[i][ACOMP] * s + 1) >> 8; #elif 0 /* This is slower but satisfies Glean */ const GLint s = CHAN_MAX - t; const GLint r = (rgba[i][RCOMP] * t + dest[i][RCOMP] * s) / 255; const GLint g = (rgba[i][GCOMP] * t + dest[i][GCOMP] * s) / 255; const GLint b = (rgba[i][BCOMP] * t + dest[i][BCOMP] * s) / 255; const GLint a = (rgba[i][ACOMP] * t + dest[i][ACOMP] * s) / 255; #else #if CHAN_BITS == 8 /* This satisfies Glean and should be reasonably fast */ /* Contributed by Nathan Hand */ #if 0 #define DIV255(X) (((X) << 8) + (X) + 256) >> 16 #else GLint temp; #define DIV255(X) (temp = (X), ((temp << 8) + temp + 256) >> 16) #endif const GLint r = DIV255((rgba[i][RCOMP] - dest[i][RCOMP]) * t) + dest[i][RCOMP]; const GLint g = DIV255((rgba[i][GCOMP] - dest[i][GCOMP]) * t) + dest[i][GCOMP]; const GLint b = DIV255((rgba[i][BCOMP] - dest[i][BCOMP]) * t) + dest[i][BCOMP]; const GLint a = DIV255((rgba[i][ACOMP] - dest[i][ACOMP]) * t) + dest[i][ACOMP]; #undef DIV255 #elif CHAN_BITS == 16 const GLfloat tt = (GLfloat) t / CHAN_MAXF; const GLint r = (GLint) ((rgba[i][RCOMP] - dest[i][RCOMP]) * tt + dest[i][RCOMP]); const GLint g = (GLint) ((rgba[i][GCOMP] - dest[i][GCOMP]) * tt + dest[i][GCOMP]); const GLint b = (GLint) ((rgba[i][BCOMP] - dest[i][BCOMP]) * tt + dest[i][BCOMP]); const GLint a = (GLint) ((rgba[i][ACOMP] - dest[i][ACOMP]) * tt + dest[i][ACOMP]); #else /* CHAN_BITS == 32 */ const GLfloat tt = (GLfloat) t / CHAN_MAXF; const GLfloat r = (rgba[i][RCOMP] - dest[i][RCOMP]) * tt + dest[i][RCOMP]; const GLfloat g = (rgba[i][GCOMP] - dest[i][GCOMP]) * tt + dest[i][GCOMP]; const GLfloat b = (rgba[i][BCOMP] - dest[i][BCOMP]) * tt + dest[i][BCOMP]; const GLfloat a = CLAMP( rgba[i][ACOMP], 0.0F, CHAN_MAXF ) * t + CLAMP( dest[i][ACOMP], 0.0F, CHAN_MAXF ) * (1.0F - t); #endif #endif ASSERT(r <= CHAN_MAX); ASSERT(g <= CHAN_MAX); ASSERT(b <= CHAN_MAX); ASSERT(a <= CHAN_MAX); rgba[i][RCOMP] = (GLchan) r; rgba[i][GCOMP] = (GLchan) g; rgba[i][BCOMP] = (GLchan) b; rgba[i][ACOMP] = (GLchan) a; } } } } /* * Add src and dest. */ static void _BLENDAPI blend_add( GLcontext *ctx, GLuint n, const GLubyte mask[], GLchan rgba[][4], CONST GLchan dest[][4] ) { GLuint i; ASSERT(ctx->Color.BlendEquationRGB==GL_FUNC_ADD); ASSERT(ctx->Color.BlendEquationA==GL_FUNC_ADD); ASSERT(ctx->Color.BlendSrcRGB==GL_ONE); ASSERT(ctx->Color.BlendDstRGB==GL_ONE); (void) ctx; for (i=0;iColor.BlendEquationRGB==GL_MIN); ASSERT(ctx->Color.BlendEquationA==GL_MIN); (void) ctx; for (i=0;iColor.BlendEquationRGB==GL_MAX); ASSERT(ctx->Color.BlendEquationA==GL_MAX); (void) ctx; for (i=0;i> 16; GLint g = (rgba[i][GCOMP] * dest[i][GCOMP] + 65535) >> 16; GLint b = (rgba[i][BCOMP] * dest[i][BCOMP] + 65535) >> 16; GLint a = (rgba[i][ACOMP] * dest[i][ACOMP] + 65535) >> 16; rgba[i][RCOMP] = (GLchan) r; rgba[i][GCOMP] = (GLchan) g; rgba[i][BCOMP] = (GLchan) b; rgba[i][ACOMP] = (GLchan) a; #else GLint r = (rgba[i][RCOMP] * dest[i][RCOMP] + 255) >> 8; GLint g = (rgba[i][GCOMP] * dest[i][GCOMP] + 255) >> 8; GLint b = (rgba[i][BCOMP] * dest[i][BCOMP] + 255) >> 8; GLint a = (rgba[i][ACOMP] * dest[i][ACOMP] + 255) >> 8; rgba[i][RCOMP] = (GLchan) r; rgba[i][GCOMP] = (GLchan) g; rgba[i][BCOMP] = (GLchan) b; rgba[i][ACOMP] = (GLchan) a; #endif } } } /* * General case blend pixels. * Input: n - number of pixels * mask - the usual write mask * In/Out: rgba - the incoming and modified pixels * Input: dest - the pixels from the dest color buffer */ static void _BLENDAPI blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[], GLchan rgba[][4], CONST GLchan dest[][4] ) { const GLfloat rscale = 1.0F / CHAN_MAXF; const GLfloat gscale = 1.0F / CHAN_MAXF; const GLfloat bscale = 1.0F / CHAN_MAXF; const GLfloat ascale = 1.0F / CHAN_MAXF; GLuint i; for (i=0;iColor.BlendSrcRGB) { case GL_ZERO: sR = sG = sB = 0.0F; break; case GL_ONE: sR = sG = sB = 1.0F; break; case GL_DST_COLOR: sR = (GLfloat) Rd * rscale; sG = (GLfloat) Gd * gscale; sB = (GLfloat) Bd * bscale; break; case GL_ONE_MINUS_DST_COLOR: sR = 1.0F - (GLfloat) Rd * rscale; sG = 1.0F - (GLfloat) Gd * gscale; sB = 1.0F - (GLfloat) Bd * bscale; break; case GL_SRC_ALPHA: sR = sG = sB = (GLfloat) As * ascale; break; case GL_ONE_MINUS_SRC_ALPHA: sR = sG = sB = 1.0F - (GLfloat) As * ascale; break; case GL_DST_ALPHA: sR = sG = sB = (GLfloat) Ad * ascale; break; case GL_ONE_MINUS_DST_ALPHA: sR = sG = sB = 1.0F - (GLfloat) Ad * ascale; break; case GL_SRC_ALPHA_SATURATE: if (As < CHAN_MAX - Ad) { sR = sG = sB = (GLfloat) As * ascale; } else { sR = sG = sB = 1.0F - (GLfloat) Ad * ascale; } break; case GL_CONSTANT_COLOR: sR = ctx->Color.BlendColor[0]; sG = ctx->Color.BlendColor[1]; sB = ctx->Color.BlendColor[2]; break; case GL_ONE_MINUS_CONSTANT_COLOR: sR = 1.0F - ctx->Color.BlendColor[0]; sG = 1.0F - ctx->Color.BlendColor[1]; sB = 1.0F - ctx->Color.BlendColor[2]; break; case GL_CONSTANT_ALPHA: sR = sG = sB = ctx->Color.BlendColor[3]; break; case GL_ONE_MINUS_CONSTANT_ALPHA: sR = sG = sB = 1.0F - ctx->Color.BlendColor[3]; break; case GL_SRC_COLOR: /* GL_NV_blend_square */ sR = (GLfloat) Rs * rscale; sG = (GLfloat) Gs * gscale; sB = (GLfloat) Bs * bscale; break; case GL_ONE_MINUS_SRC_COLOR: /* GL_NV_blend_square */ sR = 1.0F - (GLfloat) Rs * rscale; sG = 1.0F - (GLfloat) Gs * gscale; sB = 1.0F - (GLfloat) Bs * bscale; break; default: /* this should never happen */ _mesa_problem(ctx, "Bad blend source RGB factor in do_blend"); return; } /* Source Alpha factor */ switch (ctx->Color.BlendSrcA) { case GL_ZERO: sA = 0.0F; break; case GL_ONE: sA = 1.0F; break; case GL_DST_COLOR: sA = (GLfloat) Ad * ascale; break; case GL_ONE_MINUS_DST_COLOR: sA = 1.0F - (GLfloat) Ad * ascale; break; case GL_SRC_ALPHA: sA = (GLfloat) As * ascale; break; case GL_ONE_MINUS_SRC_ALPHA: sA = 1.0F - (GLfloat) As * ascale; break; case GL_DST_ALPHA: sA =(GLfloat) Ad * ascale; break; case GL_ONE_MINUS_DST_ALPHA: sA = 1.0F - (GLfloat) Ad * ascale; break; case GL_SRC_ALPHA_SATURATE: sA = 1.0; break; case GL_CONSTANT_COLOR: sA = ctx->Color.BlendColor[3]; break; case GL_ONE_MINUS_CONSTANT_COLOR: sA = 1.0F - ctx->Color.BlendColor[3]; break; case GL_CONSTANT_ALPHA: sA = ctx->Color.BlendColor[3]; break; case GL_ONE_MINUS_CONSTANT_ALPHA: sA = 1.0F - ctx->Color.BlendColor[3]; break; case GL_SRC_COLOR: /* GL_NV_blend_square */ sA = (GLfloat) As * ascale; break; case GL_ONE_MINUS_SRC_COLOR: /* GL_NV_blend_square */ sA = 1.0F - (GLfloat) As * ascale; break; default: /* this should never happen */ sA = 0.0F; _mesa_problem(ctx, "Bad blend source A factor in do_blend"); } /* Dest RGB factor */ switch (ctx->Color.BlendDstRGB) { case GL_ZERO: dR = dG = dB = 0.0F; break; case GL_ONE: dR = dG = dB = 1.0F; break; case GL_SRC_COLOR: dR = (GLfloat) Rs * rscale; dG = (GLfloat) Gs * gscale; dB = (GLfloat) Bs * bscale; break; case GL_ONE_MINUS_SRC_COLOR: dR = 1.0F - (GLfloat) Rs * rscale; dG = 1.0F - (GLfloat) Gs * gscale; dB = 1.0F - (GLfloat) Bs * bscale; break; case GL_SRC_ALPHA: dR = dG = dB = (GLfloat) As * ascale; break; case GL_ONE_MINUS_SRC_ALPHA: dR = dG = dB = 1.0F - (GLfloat) As * ascale; break; case GL_DST_ALPHA: dR = dG = dB = (GLfloat) Ad * ascale; break; case GL_ONE_MINUS_DST_ALPHA: dR = dG = dB = 1.0F - (GLfloat) Ad * ascale; break; case GL_CONSTANT_COLOR: dR = ctx->Color.BlendColor[0]; dG = ctx->Color.BlendColor[1]; dB = ctx->Color.BlendColor[2]; break; case GL_ONE_MINUS_CONSTANT_COLOR: dR = 1.0F - ctx->Color.BlendColor[0]; dG = 1.0F - ctx->Color.BlendColor[1]; dB = 1.0F - ctx->Color.BlendColor[2]; break; case GL_CONSTANT_ALPHA: dR = dG = dB = ctx->Color.BlendColor[3]; break; case GL_ONE_MINUS_CONSTANT_ALPHA: dR = dG = dB = 1.0F - ctx->Color.BlendColor[3]; break; case GL_DST_COLOR: /* GL_NV_blend_square */ dR = (GLfloat) Rd * rscale; dG = (GLfloat) Gd * gscale; dB = (GLfloat) Bd * bscale; break; case GL_ONE_MINUS_DST_COLOR: /* GL_NV_blend_square */ dR = 1.0F - (GLfloat) Rd * rscale; dG = 1.0F - (GLfloat) Gd * gscale; dB = 1.0F - (GLfloat) Bd * bscale; break; default: /* this should never happen */ dR = dG = dB = 0.0F; _mesa_problem(ctx, "Bad blend dest RGB factor in do_blend"); } /* Dest Alpha factor */ switch (ctx->Color.BlendDstA) { case GL_ZERO: dA = 0.0F; break; case GL_ONE: dA = 1.0F; break; case GL_SRC_COLOR: dA = (GLfloat) As * ascale; break; case GL_ONE_MINUS_SRC_COLOR: dA = 1.0F - (GLfloat) As * ascale; break; case GL_SRC_ALPHA: dA = (GLfloat) As * ascale; break; case GL_ONE_MINUS_SRC_ALPHA: dA = 1.0F - (GLfloat) As * ascale; break; case GL_DST_ALPHA: dA = (GLfloat) Ad * ascale; break; case GL_ONE_MINUS_DST_ALPHA: dA = 1.0F - (GLfloat) Ad * ascale; break; case GL_CONSTANT_COLOR: dA = ctx->Color.BlendColor[3]; break; case GL_ONE_MINUS_CONSTANT_COLOR: dA = 1.0F - ctx->Color.BlendColor[3]; break; case GL_CONSTANT_ALPHA: dA = ctx->Color.BlendColor[3]; break; case GL_ONE_MINUS_CONSTANT_ALPHA: dA = 1.0F - ctx->Color.BlendColor[3]; break; case GL_DST_COLOR: /* GL_NV_blend_square */ dA = (GLfloat) Ad * ascale; break; case GL_ONE_MINUS_DST_COLOR: /* GL_NV_blend_square */ dA = 1.0F - (GLfloat) Ad * ascale; break; default: /* this should never happen */ dA = 0.0F; _mesa_problem(ctx, "Bad blend dest A factor in do_blend"); return; } /* Due to round-off problems we have to clamp against zero. */ /* Optimization: we don't have to do this for all src & dst factors */ if (dA < 0.0F) dA = 0.0F; if (dR < 0.0F) dR = 0.0F; if (dG < 0.0F) dG = 0.0F; if (dB < 0.0F) dB = 0.0F; if (sA < 0.0F) sA = 0.0F; if (sR < 0.0F) sR = 0.0F; if (sG < 0.0F) sG = 0.0F; if (sB < 0.0F) sB = 0.0F; ASSERT( sR <= 1.0 ); ASSERT( sG <= 1.0 ); ASSERT( sB <= 1.0 ); ASSERT( sA <= 1.0 ); ASSERT( dR <= 1.0 ); ASSERT( dG <= 1.0 ); ASSERT( dB <= 1.0 ); ASSERT( dA <= 1.0 ); /* compute blended color */ #if CHAN_TYPE == GL_FLOAT if (ctx->Color.BlendEquationRGB==GL_FUNC_ADD) { r = Rs * sR + Rd * dR; g = Gs * sG + Gd * dG; b = Bs * sB + Bd * dB; a = As * sA + Ad * dA; } else if (ctx->Color.BlendEquationRGB==GL_FUNC_SUBTRACT) { r = Rs * sR - Rd * dR; g = Gs * sG - Gd * dG; b = Bs * sB - Bd * dB; a = As * sA - Ad * dA; } else if (ctx->Color.BlendEquationRGB==GL_FUNC_REVERSE_SUBTRACT) { r = Rd * dR - Rs * sR; g = Gd * dG - Gs * sG; b = Bd * dB - Bs * sB; a = Ad * dA - As * sA; } else if (ctx->Color.BlendEquationRGB==GL_MIN) { r = MIN2( Rd, Rs ); g = MIN2( Gd, Gs ); b = MIN2( Bd, Bs ); } else if (ctx->Color.BlendEquationRGB==GL_MAX) { r = MAX2( Rd, Rs ); g = MAX2( Gd, Gs ); b = MAX2( Bd, Bs ); } else { /* should never get here */ r = g = b = 0.0F; /* silence uninitialized var warning */ _mesa_problem(ctx, "unexpected BlendEquation in blend_general()"); } if (ctx->Color.BlendEquationA==GL_FUNC_ADD) { a = As * sA + Ad * dA; } else if (ctx->Color.BlendEquationA==GL_FUNC_SUBTRACT) { a = As * sA - Ad * dA; } else if (ctx->Color.BlendEquationA==GL_FUNC_REVERSE_SUBTRACT) { a = Ad * dA - As * sA; } else if (ctx->Color.BlendEquationA==GL_MIN) { a = MIN2( Ad, As ); } else if (ctx->Color.BlendEquationA==GL_MAX) { a = MAX2( Ad, As ); } else { /* should never get here */ a = 0.0F; /* silence uninitialized var warning */ _mesa_problem(ctx, "unexpected BlendEquation in blend_general()"); } /* final clamping */ rgba[i][RCOMP] = MAX2( r, 0.0F ); rgba[i][GCOMP] = MAX2( g, 0.0F ); rgba[i][BCOMP] = MAX2( b, 0.0F ); rgba[i][ACOMP] = CLAMP( a, 0.0F, CHAN_MAXF ); #else if (ctx->Color.BlendEquationRGB==GL_FUNC_ADD) { r = Rs * sR + Rd * dR + 0.5F; g = Gs * sG + Gd * dG + 0.5F; b = Bs * sB + Bd * dB + 0.5F; } else if (ctx->Color.BlendEquationRGB==GL_FUNC_SUBTRACT) { r = Rs * sR - Rd * dR + 0.5F; g = Gs * sG - Gd * dG + 0.5F; b = Bs * sB - Bd * dB + 0.5F; } else if (ctx->Color.BlendEquationRGB==GL_FUNC_REVERSE_SUBTRACT) { r = Rd * dR - Rs * sR + 0.5F; g = Gd * dG - Gs * sG + 0.5F; b = Bd * dB - Bs * sB + 0.5F; } else if (ctx->Color.BlendEquationRGB==GL_MIN) { r = MIN2( Rd, Rs ); g = MIN2( Gd, Gs ); b = MIN2( Bd, Bs ); } else if (ctx->Color.BlendEquationRGB==GL_MAX) { r = MAX2( Rd, Rs ); g = MAX2( Gd, Gs ); b = MAX2( Bd, Bs ); } else { /* should never get here */ r = g = b = 0.0F; /* silence uninitialized var warning */ _mesa_problem(ctx, "unexpected BlendEquation in blend_general()"); } if (ctx->Color.BlendEquationA==GL_FUNC_ADD) { a = As * sA + Ad * dA + 0.5F; } else if (ctx->Color.BlendEquationA==GL_FUNC_SUBTRACT) { a = As * sA - Ad * dA + 0.5F; } else if (ctx->Color.BlendEquationA==GL_FUNC_REVERSE_SUBTRACT) { a = Ad * dA - As * sA + 0.5F; } else if (ctx->Color.BlendEquationA==GL_MIN) { a = MIN2( Ad, As ); } else if (ctx->Color.BlendEquationA==GL_MAX) { a = MAX2( Ad, As ); } else { /* should never get here */ a = 0.0F; /* silence uninitialized var warning */ _mesa_problem(ctx, "unexpected BlendEquation in blend_general()"); } /* final clamping */ rgba[i][RCOMP] = (GLchan) (GLint) CLAMP( r, 0.0F, CHAN_MAXF ); rgba[i][GCOMP] = (GLchan) (GLint) CLAMP( g, 0.0F, CHAN_MAXF ); rgba[i][BCOMP] = (GLchan) (GLint) CLAMP( b, 0.0F, CHAN_MAXF ); rgba[i][ACOMP] = (GLchan) (GLint) CLAMP( a, 0.0F, CHAN_MAXF ); #endif } } } /* * Analyze current blending parameters to pick fastest blending function. * Result: the ctx->Color.BlendFunc pointer is updated. */ void _swrast_choose_blend_func( GLcontext *ctx ) { const GLenum eq = ctx->Color.BlendEquationRGB; const GLenum srcRGB = ctx->Color.BlendSrcRGB; const GLenum dstRGB = ctx->Color.BlendDstRGB; const GLenum srcA = ctx->Color.BlendSrcA; const GLenum dstA = ctx->Color.BlendDstA; if (ctx->Color.BlendEquationRGB != ctx->Color.BlendEquationA) { SWRAST_CONTEXT(ctx)->BlendFunc = blend_general; } else if (eq==GL_MIN) { /* Note: GL_MIN ignores the blending weight factors */ #if defined(USE_MMX_ASM) if ( cpu_has_mmx ) { SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_min; } else #endif SWRAST_CONTEXT(ctx)->BlendFunc = blend_min; } else if (eq==GL_MAX) { /* Note: GL_MAX ignores the blending weight factors */ #if defined(USE_MMX_ASM) if ( cpu_has_mmx ) { SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_max; } else #endif SWRAST_CONTEXT(ctx)->BlendFunc = blend_max; } else if (srcRGB != srcA || dstRGB != dstA) { SWRAST_CONTEXT(ctx)->BlendFunc = blend_general; } else if (eq==GL_FUNC_ADD && srcRGB==GL_SRC_ALPHA && dstRGB==GL_ONE_MINUS_SRC_ALPHA) { #if defined(USE_MMX_ASM) if ( cpu_has_mmx ) { SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_transparency; } else #endif SWRAST_CONTEXT(ctx)->BlendFunc = blend_transparency; } else if (eq==GL_FUNC_ADD && srcRGB==GL_ONE && dstRGB==GL_ONE) { #if defined(USE_MMX_ASM) if ( cpu_has_mmx ) { SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_add; } else #endif SWRAST_CONTEXT(ctx)->BlendFunc = blend_add; } else if (((eq==GL_FUNC_ADD || eq==GL_FUNC_REVERSE_SUBTRACT) && (srcRGB==GL_ZERO && dstRGB==GL_SRC_COLOR)) || ((eq==GL_FUNC_ADD || eq==GL_FUNC_SUBTRACT) && (srcRGB==GL_DST_COLOR && dstRGB==GL_ZERO))) { #if defined(USE_MMX_ASM) if ( cpu_has_mmx ) { SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_modulate; } else #endif SWRAST_CONTEXT(ctx)->BlendFunc = blend_modulate; } else if (eq==GL_FUNC_ADD && srcRGB == GL_ZERO && dstRGB == GL_ONE) { SWRAST_CONTEXT(ctx)->BlendFunc = blend_noop; } else if (eq==GL_FUNC_ADD && srcRGB == GL_ONE && dstRGB == GL_ZERO) { SWRAST_CONTEXT(ctx)->BlendFunc = blend_replace; } else { SWRAST_CONTEXT(ctx)->BlendFunc = blend_general; } } /* * Apply the blending operator to a span of pixels. * We can handle horizontal runs of pixels (spans) or arrays of x/y * pixel coordinates. */ void _swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb, const struct sw_span *span, GLchan rgba[][4]) { GLchan framebuffer[MAX_WIDTH][4]; ASSERT(span->end <= MAX_WIDTH); ASSERT(span->arrayMask & SPAN_RGBA); ASSERT(!ctx->Color._LogicOpEnabled); /* Read span of current frame buffer pixels */ if (span->arrayMask & SPAN_XY) { /* array of x/y pixel coords */ _swrast_get_values(ctx, rb, span->end, span->array->x, span->array->y, framebuffer, 4 * sizeof(GLchan)); } else { /* horizontal run of pixels */ _swrast_read_rgba_span(ctx, rb, span->end, span->x, span->y, framebuffer); } SWRAST_CONTEXT(ctx)->BlendFunc( ctx, span->end, span->array->mask, rgba, (const GLchan (*)[4]) framebuffer ); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_blend.h0000644000000000000000000000266513614532424020330 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_BLEND_H #define S_BLEND_H #include "mtypes.h" #include "s_context.h" extern void _swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb, const struct sw_span *span, GLchan rgba[][4]); extern void _swrast_choose_blend_func(GLcontext *ctx); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_buffers.c0000644000000000000000000003060413614532424020665 0ustar /* * Mesa 3-D graphics library * Version: 6.4.1 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "colormac.h" #include "macros.h" #include "imports.h" #include "mtypes.h" #include "fbobject.h" #include "s_accum.h" #include "s_context.h" #include "s_depth.h" #include "s_masking.h" #include "s_stencil.h" /** * Clear the color buffer when glColorMask is in effect. */ static void clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb) { const GLint x = ctx->DrawBuffer->_Xmin; const GLint y = ctx->DrawBuffer->_Ymin; const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; GLchan clearColor[4]; GLint i; ASSERT(ctx->Visual.rgbMode); ASSERT(rb->PutRow); CLAMPED_FLOAT_TO_CHAN(clearColor[RCOMP], ctx->Color.ClearColor[0]); CLAMPED_FLOAT_TO_CHAN(clearColor[GCOMP], ctx->Color.ClearColor[1]); CLAMPED_FLOAT_TO_CHAN(clearColor[BCOMP], ctx->Color.ClearColor[2]); CLAMPED_FLOAT_TO_CHAN(clearColor[ACOMP], ctx->Color.ClearColor[3]); for (i = 0; i < height; i++) { GLchan rgba[MAX_WIDTH][4]; GLint j; for (j = 0; j < width; j++) { COPY_CHAN4(rgba[j], clearColor); } _swrast_mask_rgba_array( ctx, rb, width, x, y + i, rgba ); rb->PutRow(ctx, rb, width, x, y + i, rgba, NULL); } } /** * Clear color index buffer with masking. */ static void clear_ci_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb) { const GLint x = ctx->DrawBuffer->_Xmin; const GLint y = ctx->DrawBuffer->_Ymin; const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; GLuint span[MAX_WIDTH]; GLubyte mask[MAX_WIDTH]; GLint i, j; ASSERT(!ctx->Visual.rgbMode); MEMSET( mask, 1, width ); for (i = 0; i < height;i++) { for (j = 0; j < width;j++) { span[j] = ctx->Color.ClearIndex; } _swrast_mask_ci_array(ctx, rb, width, x, y + i, span); ASSERT(rb->PutRow); ASSERT(rb->DataType == GL_UNSIGNED_INT); rb->PutRow(ctx, rb, width, x, y + i, span, mask); } } /** * Clear an rgba color buffer without channel masking. */ static void clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { const GLint x = ctx->DrawBuffer->_Xmin; const GLint y = ctx->DrawBuffer->_Ymin; const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; GLubyte clear8[4]; GLushort clear16[4]; GLvoid *clearVal; GLint i; ASSERT(ctx->Visual.rgbMode); ASSERT(ctx->Color.ColorMask[0] && ctx->Color.ColorMask[1] && ctx->Color.ColorMask[2] && ctx->Color.ColorMask[3]); ASSERT(rb->PutMonoRow); switch (rb->DataType) { case GL_UNSIGNED_BYTE: UNCLAMPED_FLOAT_TO_UBYTE(clear8[0], ctx->Color.ClearColor[0]); UNCLAMPED_FLOAT_TO_UBYTE(clear8[1], ctx->Color.ClearColor[1]); UNCLAMPED_FLOAT_TO_UBYTE(clear8[2], ctx->Color.ClearColor[2]); UNCLAMPED_FLOAT_TO_UBYTE(clear8[3], ctx->Color.ClearColor[3]); clearVal = clear8; break; case GL_UNSIGNED_SHORT: UNCLAMPED_FLOAT_TO_USHORT(clear16[0], ctx->Color.ClearColor[0]); UNCLAMPED_FLOAT_TO_USHORT(clear16[1], ctx->Color.ClearColor[1]); UNCLAMPED_FLOAT_TO_USHORT(clear16[2], ctx->Color.ClearColor[2]); UNCLAMPED_FLOAT_TO_USHORT(clear16[3], ctx->Color.ClearColor[3]); clearVal = clear16; break; case GL_FLOAT: clearVal = ctx->Color.ClearColor; break; default: _mesa_problem(ctx, "Bad rb DataType in clear_color_buffer"); return; } for (i = 0; i < height; i++) { rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL); } } /** * Clear color index buffer without masking. */ static void clear_ci_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { const GLint x = ctx->DrawBuffer->_Xmin; const GLint y = ctx->DrawBuffer->_Ymin; const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; GLubyte clear8; GLushort clear16; GLuint clear32; GLvoid *clearVal; GLint i; ASSERT(!ctx->Visual.rgbMode); ASSERT((ctx->Color.IndexMask & ((1 << ctx->Visual.indexBits) - 1)) == (GLuint) ((1 << ctx->Visual.indexBits) - 1)); ASSERT(rb->PutMonoRow); /* setup clear value */ switch (rb->DataType) { case GL_UNSIGNED_BYTE: clear8 = (GLubyte) ctx->Color.ClearIndex; clearVal = &clear8; break; case GL_UNSIGNED_SHORT: clear16 = (GLushort) ctx->Color.ClearIndex; clearVal = &clear16; break; case GL_UNSIGNED_INT: clear32 = ctx->Color.ClearIndex; clearVal = &clear32; break; default: _mesa_problem(ctx, "Bad rb DataType in clear_color_buffer"); return; } for (i = 0; i < height; i++) rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL); } /** * Clear the front/back/left/right/aux color buffers. * This function is usually only called if the device driver can't * clear its own color buffers for some reason (such as with masking). */ static void clear_color_buffers(GLcontext *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLboolean masking; GLuint i; if (ctx->Visual.rgbMode) { if (ctx->Color.ColorMask[0] && ctx->Color.ColorMask[1] && ctx->Color.ColorMask[2] && ctx->Color.ColorMask[3]) { masking = GL_FALSE; } else { masking = GL_TRUE; } } else { const GLuint indexBits = (1 << ctx->Visual.indexBits) - 1; if ((ctx->Color.IndexMask & indexBits) == indexBits) { masking = GL_FALSE; } else { masking = GL_TRUE; } } for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers[0]; i++) { struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][i]; #if OLD_RENDERBUFFER /* SetBuffer will go away */ if (swrast->Driver.SetBuffer) swrast->Driver.SetBuffer(ctx, ctx->DrawBuffer, ctx->DrawBuffer->_ColorDrawBit[0][i]); #endif if (ctx->Visual.rgbMode) { if (masking) { clear_rgba_buffer_with_masking(ctx, rb); } else { clear_rgba_buffer(ctx, rb); } } else { if (masking) { clear_ci_buffer_with_masking(ctx, rb); } else { clear_ci_buffer(ctx, rb); } } } /* restore default read/draw buffer */ _swrast_use_draw_buffer(ctx); } /** * Called via the device driver's ctx->Driver.Clear() function if the * device driver can't clear one or more of the buffers itself. * \param mask bitwise-OR of DD_*_BIT flags. * \param all if GL_TRUE, clear whole buffer, else clear specified region. */ void _swrast_Clear(GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height) { SWcontext *swrast = SWRAST_CONTEXT(ctx); (void) all; (void) x; (void) y; (void) width; (void) height; #ifdef DEBUG_FOO { const GLbitfield legalBits = BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT | BUFFER_BIT_BACK_LEFT | BUFFER_BIT_BACK_RIGHT | BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL | BUFFER_BIT_ACCUM | BUFFER_BIT_AUX0 | BUFFER_BIT_AUX1 | BUFFER_BIT_AUX2 | BUFFER_BIT_AUX3; assert((mask & (~legalBits)) == 0); } #endif RENDER_START(swrast,ctx); /* do software clearing here */ if (mask) { if (mask & ctx->DrawBuffer->_ColorDrawBufferMask[0]) { clear_color_buffers(ctx); } if (mask & BUFFER_BIT_DEPTH) { struct gl_renderbuffer *rb = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; _swrast_clear_depth_buffer(ctx, rb); } if (mask & BUFFER_BIT_ACCUM) { struct gl_renderbuffer *rb = ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer; _swrast_clear_accum_buffer(ctx, rb); } if (mask & BUFFER_BIT_STENCIL) { struct gl_renderbuffer *rb = ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer; _swrast_clear_stencil_buffer(ctx, rb); } } RENDER_FINISH(swrast,ctx); } /* * Fallback for ctx->Driver.DrawBuffer() */ void _swrast_DrawBuffer( GLcontext *ctx, GLenum mode ) { (void) mode; _swrast_use_draw_buffer(ctx); } /* * Fallback for ctx->Driver.DrawBuffers() */ void _swrast_DrawBuffers( GLcontext *ctx, GLsizei n, const GLenum *buffers ) { _swrast_use_draw_buffer(ctx); } /* * Setup things so that we read/write spans from the user-designated * read buffer (set via glReadPixels). We usually just have to call * this for glReadPixels, glCopyPixels, etc. */ void _swrast_use_read_buffer( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); /* Do this so the software-emulated alpha plane span functions work! */ swrast->CurrentBufferBit = ctx->ReadBuffer->_ColorReadBufferMask; /* Tell the device driver where to read/write spans */ if (swrast->Driver.SetBuffer) swrast->Driver.SetBuffer(ctx, ctx->ReadBuffer, swrast->CurrentBufferBit); } /* * Setup things so that we read/write spans from the default draw buffer. * This is the usual mode that Mesa's software rasterizer operates in. */ void _swrast_use_draw_buffer( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); /* The user can specify rendering to zero, one, two, or four color * buffers simultaneously with glDrawBuffer()! * We don't expect the span/point/line/triangle functions to deal with * that mess so we'll iterate over the multiple buffers as needed. * But usually we only render to one color buffer at a time. * We set ctx->Color._DriverDrawBuffer to that buffer and tell the * device driver to use that buffer. * Look in s_span.c's multi_write_rgba_span() function to see how * we loop over multiple color buffers when needed. */ if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_LEFT) swrast->CurrentBufferBit = BUFFER_BIT_FRONT_LEFT; else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_BACK_LEFT) swrast->CurrentBufferBit = BUFFER_BIT_BACK_LEFT; else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_RIGHT) swrast->CurrentBufferBit = BUFFER_BIT_FRONT_RIGHT; else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_BACK_RIGHT) swrast->CurrentBufferBit = BUFFER_BIT_BACK_RIGHT; else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX0) swrast->CurrentBufferBit = BUFFER_BIT_AUX0; else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX1) swrast->CurrentBufferBit = BUFFER_BIT_AUX1; else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX2) swrast->CurrentBufferBit = BUFFER_BIT_AUX2; else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX3) swrast->CurrentBufferBit = BUFFER_BIT_AUX3; else /* glDrawBuffer(GL_NONE) */ swrast->CurrentBufferBit = BUFFER_BIT_FRONT_LEFT; /* we always have this buffer */ if (swrast->Driver.SetBuffer) swrast->Driver.SetBuffer(ctx, ctx->DrawBuffer, swrast->CurrentBufferBit); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_context.c0000644000000000000000000005146713614532424020727 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell * Brian Paul */ #include "imports.h" #include "bufferobj.h" #include "context.h" #include "colormac.h" #include "mtypes.h" #include "program.h" #include "texobj.h" #include "nvfragprog.h" #include "swrast.h" #include "s_blend.h" #include "s_context.h" #include "s_lines.h" #include "s_points.h" #include "s_span.h" #include "s_triangle.h" #include "s_texture.h" /** * Recompute the value of swrast->_RasterMask, etc. according to * the current context. The _RasterMask field can be easily tested by * drivers to determine certain basic GL state (does the primitive need * stenciling, logic-op, fog, etc?). */ static void _swrast_update_rasterflags( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint rasterMask = 0; if (ctx->Color.AlphaEnabled) rasterMask |= ALPHATEST_BIT; if (ctx->Color.BlendEnabled) rasterMask |= BLEND_BIT; if (ctx->Depth.Test) rasterMask |= DEPTH_BIT; if (swrast->_FogEnabled) rasterMask |= FOG_BIT; if (ctx->Scissor.Enabled) rasterMask |= CLIP_BIT; if (ctx->Stencil.Enabled) rasterMask |= STENCIL_BIT; if (ctx->Visual.rgbMode) { const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); if (colorMask != 0xffffffff) rasterMask |= MASKING_BIT; if (ctx->Color._LogicOpEnabled) rasterMask |= LOGIC_OP_BIT; if (ctx->Texture._EnabledUnits) rasterMask |= TEXTURE_BIT; } else { if (ctx->Color.IndexMask != 0xffffffff) rasterMask |= MASKING_BIT; if (ctx->Color.IndexLogicOpEnabled) rasterMask |= LOGIC_OP_BIT; } if ( ctx->Viewport.X < 0 || ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width || ctx->Viewport.Y < 0 || ctx->Viewport.Y + ctx->Viewport.Height > (GLint) ctx->DrawBuffer->Height) { rasterMask |= CLIP_BIT; } if (ctx->Depth.OcclusionTest || ctx->Occlusion.Active) rasterMask |= OCCLUSION_BIT; /* If we're not drawing to exactly one color buffer set the * MULTI_DRAW_BIT flag. Also set it if we're drawing to no * buffers or the RGBA or CI mask disables all writes. */ if (ctx->DrawBuffer->_NumColorDrawBuffers[0] != 1) { /* more than one color buffer designated for writing (or zero buffers) */ rasterMask |= MULTI_DRAW_BIT; } else if (ctx->Visual.rgbMode && *((GLuint *) ctx->Color.ColorMask) == 0) { rasterMask |= MULTI_DRAW_BIT; /* all RGBA channels disabled */ } else if (!ctx->Visual.rgbMode && ctx->Color.IndexMask==0) { rasterMask |= MULTI_DRAW_BIT; /* all color index bits disabled */ } if (ctx->FragmentProgram._Active) { rasterMask |= FRAGPROG_BIT; } if (ctx->ATIFragmentShader._Enabled) { rasterMask |= ATIFRAGSHADER_BIT; } #if CHAN_TYPE == GL_FLOAT if (ctx->Color.ClampFragmentColor == GL_TRUE) { rasterMask |= CLAMPING_BIT; } #endif SWRAST_CONTEXT(ctx)->_RasterMask = rasterMask; } /** * Examine polycon culls tate to compute the _BackfaceSign field. * _BackfaceSign will be 0 if no culling, -1 if culling back-faces, * and 1 if culling front-faces. The Polygon FrontFace state also * factors in. */ static void _swrast_update_polygon( GLcontext *ctx ) { GLfloat backface_sign = 1; if (ctx->Polygon.CullFlag) { backface_sign = 1; switch(ctx->Polygon.CullFaceMode) { case GL_BACK: if(ctx->Polygon.FrontFace==GL_CCW) backface_sign = -1; break; case GL_FRONT: if(ctx->Polygon.FrontFace!=GL_CCW) backface_sign = -1; break; default: case GL_FRONT_AND_BACK: backface_sign = 0; break; } } else { backface_sign = 0; } SWRAST_CONTEXT(ctx)->_BackfaceSign = backface_sign; } /** * Update the _PreferPixelFog field to indicate if we need to compute * fog factors per-fragment. */ static void _swrast_update_fog_hint( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); swrast->_PreferPixelFog = (!swrast->AllowVertexFog || ctx->FragmentProgram._Enabled || /* not _Active! */ (ctx->Hint.Fog == GL_NICEST && swrast->AllowPixelFog)); } /** * Update the swrast->_AnyTextureCombine flag. */ static void _swrast_update_texture_env( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint i; swrast->_AnyTextureCombine = GL_FALSE; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (ctx->Texture.Unit[i].EnvMode == GL_COMBINE_EXT || ctx->Texture.Unit[i].EnvMode == GL_COMBINE4_NV) { swrast->_AnyTextureCombine = GL_TRUE; return; } } } /** * Update swrast->_FogColor and swrast->_FogEnable values. */ static void _swrast_update_fog_state( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); /* convert fog color to GLchan values */ CLAMPED_FLOAT_TO_CHAN(swrast->_FogColor[RCOMP], ctx->Fog.Color[RCOMP]); CLAMPED_FLOAT_TO_CHAN(swrast->_FogColor[GCOMP], ctx->Fog.Color[GCOMP]); CLAMPED_FLOAT_TO_CHAN(swrast->_FogColor[BCOMP], ctx->Fog.Color[BCOMP]); /* determine if fog is needed, and if so, which fog mode */ swrast->_FogEnabled = GL_FALSE; if (ctx->FragmentProgram._Active) { if (ctx->FragmentProgram._Current->Base.Target==GL_FRAGMENT_PROGRAM_ARB) { const struct fragment_program *p = (struct fragment_program *) ctx->FragmentProgram._Current; if (p->FogOption != GL_NONE) { swrast->_FogEnabled = GL_TRUE; swrast->_FogMode = p->FogOption; } } } else if (ctx->Fog.Enabled) { swrast->_FogEnabled = GL_TRUE; swrast->_FogMode = ctx->Fog.Mode; } } /** * Update state for running fragment programs. Basically, load the * program parameters with current state values. */ static void _swrast_update_fragment_program( GLcontext *ctx ) { if (ctx->FragmentProgram._Active) { struct fragment_program *program = ctx->FragmentProgram._Current; _mesa_load_state_parameters(ctx, program->Parameters); } } #define _SWRAST_NEW_DERIVED (_SWRAST_NEW_RASTERMASK | \ _NEW_TEXTURE | \ _NEW_HINT | \ _NEW_POLYGON ) /* State referenced by _swrast_choose_triangle, _swrast_choose_line. */ #define _SWRAST_NEW_TRIANGLE (_SWRAST_NEW_DERIVED | \ _NEW_RENDERMODE| \ _NEW_POLYGON| \ _NEW_DEPTH| \ _NEW_STENCIL| \ _NEW_COLOR| \ _NEW_TEXTURE| \ _SWRAST_NEW_RASTERMASK| \ _NEW_LIGHT| \ _NEW_FOG | \ _DD_NEW_SEPARATE_SPECULAR) #define _SWRAST_NEW_LINE (_SWRAST_NEW_DERIVED | \ _NEW_RENDERMODE| \ _NEW_LINE| \ _NEW_TEXTURE| \ _NEW_LIGHT| \ _NEW_FOG| \ _NEW_DEPTH | \ _DD_NEW_SEPARATE_SPECULAR) #define _SWRAST_NEW_POINT (_SWRAST_NEW_DERIVED | \ _NEW_RENDERMODE | \ _NEW_POINT | \ _NEW_TEXTURE | \ _NEW_LIGHT | \ _NEW_FOG | \ _DD_NEW_SEPARATE_SPECULAR) #define _SWRAST_NEW_TEXTURE_SAMPLE_FUNC _NEW_TEXTURE #define _SWRAST_NEW_TEXTURE_ENV_MODE _NEW_TEXTURE #define _SWRAST_NEW_BLEND_FUNC _NEW_COLOR /** * Stub for swrast->Triangle to select a true triangle function * after a state change. */ static void _swrast_validate_triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); _swrast_validate_derived( ctx ); swrast->choose_triangle( ctx ); if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx) && !ctx->FragmentProgram._Active) { /* separate specular color, but no texture */ swrast->SpecTriangle = swrast->Triangle; swrast->Triangle = _swrast_add_spec_terms_triangle; } swrast->Triangle( ctx, v0, v1, v2 ); } /** * Called via swrast->Line. Examine current GL state and choose a software * line routine. Then call it. */ static void _swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); _swrast_validate_derived( ctx ); swrast->choose_line( ctx ); if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx) && !ctx->FragmentProgram._Active) { swrast->SpecLine = swrast->Line; swrast->Line = _swrast_add_spec_terms_line; } swrast->Line( ctx, v0, v1 ); } /** * Called via swrast->Point. Examine current GL state and choose a software * point routine. Then call it. */ static void _swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); _swrast_validate_derived( ctx ); swrast->choose_point( ctx ); if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx) && !ctx->FragmentProgram._Active) { swrast->SpecPoint = swrast->Point; swrast->Point = _swrast_add_spec_terms_point; } swrast->Point( ctx, v0 ); } /** * Called via swrast->BlendFunc. Examine GL state to choose a blending * function, then call it. */ static void _ASMAPI _swrast_validate_blend_func( GLcontext *ctx, GLuint n, const GLubyte mask[], GLchan src[][4], CONST GLchan dst[][4] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); _swrast_validate_derived( ctx ); _swrast_choose_blend_func( ctx ); swrast->BlendFunc( ctx, n, mask, src, dst ); } /** * Called via the swrast->TextureSample[i] function pointer. * Basically, given a texture object, an array of texture coords * and an array of level-of-detail values, return an array of colors. * In this case, determine the correct texture sampling routine * (depending on filter mode, texture dimensions, etc) then call the * sampler routine. */ static void _swrast_validate_texture_sample( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); _swrast_validate_derived( ctx ); /* Compute min/mag filter threshold */ if (tObj && tObj->MinFilter != tObj->MagFilter) { if (tObj->MagFilter == GL_LINEAR && (tObj->MinFilter == GL_NEAREST_MIPMAP_NEAREST || tObj->MinFilter == GL_NEAREST_MIPMAP_LINEAR)) { swrast->_MinMagThresh[texUnit] = 0.5F; } else { swrast->_MinMagThresh[texUnit] = 0.0F; } } swrast->TextureSample[texUnit] = _swrast_choose_texture_sample_func( ctx, tObj ); swrast->TextureSample[texUnit]( ctx, texUnit, tObj, n, texcoords, lambda, rgba ); } static void _swrast_sleep( GLcontext *ctx, GLuint new_state ) { (void) ctx; (void) new_state; } static void _swrast_invalidate_state( GLcontext *ctx, GLuint new_state ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint i; swrast->NewState |= new_state; /* After 10 statechanges without any swrast functions being called, * put the module to sleep. */ if (++swrast->StateChanges > 10) { swrast->InvalidateState = _swrast_sleep; swrast->NewState = ~0; new_state = ~0; } if (new_state & swrast->invalidate_triangle) swrast->Triangle = _swrast_validate_triangle; if (new_state & swrast->invalidate_line) swrast->Line = _swrast_validate_line; if (new_state & swrast->invalidate_point) swrast->Point = _swrast_validate_point; if (new_state & _SWRAST_NEW_BLEND_FUNC) swrast->BlendFunc = _swrast_validate_blend_func; if (new_state & _SWRAST_NEW_TEXTURE_SAMPLE_FUNC) for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) swrast->TextureSample[i] = _swrast_validate_texture_sample; } void _swrast_validate_derived( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (swrast->NewState) { if (swrast->NewState & _SWRAST_NEW_RASTERMASK) _swrast_update_rasterflags( ctx ); if (swrast->NewState & _NEW_POLYGON) _swrast_update_polygon( ctx ); if (swrast->NewState & (_NEW_HINT | _NEW_PROGRAM)) _swrast_update_fog_hint( ctx ); if (swrast->NewState & _SWRAST_NEW_TEXTURE_ENV_MODE) _swrast_update_texture_env( ctx ); if (swrast->NewState & (_NEW_FOG | _NEW_PROGRAM)) _swrast_update_fog_state( ctx ); if (swrast->NewState & _NEW_PROGRAM) _swrast_update_fragment_program( ctx ); swrast->NewState = 0; swrast->StateChanges = 0; swrast->InvalidateState = _swrast_invalidate_state; } } #define SWRAST_DEBUG 0 /* Public entrypoints: See also s_accum.c, s_bitmap.c, etc. */ void _swrast_Quad( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2, const SWvertex *v3 ) { if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_Quad\n"); _swrast_print_vertex( ctx, v0 ); _swrast_print_vertex( ctx, v1 ); _swrast_print_vertex( ctx, v2 ); _swrast_print_vertex( ctx, v3 ); } SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v3 ); SWRAST_CONTEXT(ctx)->Triangle( ctx, v1, v2, v3 ); } void _swrast_Triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ) { if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_Triangle\n"); _swrast_print_vertex( ctx, v0 ); _swrast_print_vertex( ctx, v1 ); _swrast_print_vertex( ctx, v2 ); } SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 ); } void _swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) { if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_Line\n"); _swrast_print_vertex( ctx, v0 ); _swrast_print_vertex( ctx, v1 ); } SWRAST_CONTEXT(ctx)->Line( ctx, v0, v1 ); } void _swrast_Point( GLcontext *ctx, const SWvertex *v0 ) { if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_Point\n"); _swrast_print_vertex( ctx, v0 ); } SWRAST_CONTEXT(ctx)->Point( ctx, v0 ); } void _swrast_InvalidateState( GLcontext *ctx, GLuint new_state ) { if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_InvalidateState\n"); } SWRAST_CONTEXT(ctx)->InvalidateState( ctx, new_state ); } void _swrast_ResetLineStipple( GLcontext *ctx ) { if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_ResetLineStipple\n"); } SWRAST_CONTEXT(ctx)->StippleCounter = 0; } void _swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ) { if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_allow_vertex_fog %d\n", value); } SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT ); SWRAST_CONTEXT(ctx)->AllowVertexFog = value; } void _swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value ) { if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_allow_pixel_fog %d\n", value); } SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT ); SWRAST_CONTEXT(ctx)->AllowPixelFog = value; } GLboolean _swrast_CreateContext( GLcontext *ctx ) { GLuint i; SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext)); if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_CreateContext\n"); } if (!swrast) return GL_FALSE; swrast->NewState = ~0; swrast->choose_point = _swrast_choose_point; swrast->choose_line = _swrast_choose_line; swrast->choose_triangle = _swrast_choose_triangle; swrast->invalidate_point = _SWRAST_NEW_POINT; swrast->invalidate_line = _SWRAST_NEW_LINE; swrast->invalidate_triangle = _SWRAST_NEW_TRIANGLE; swrast->Point = _swrast_validate_point; swrast->Line = _swrast_validate_line; swrast->Triangle = _swrast_validate_triangle; swrast->InvalidateState = _swrast_sleep; swrast->BlendFunc = _swrast_validate_blend_func; swrast->AllowVertexFog = GL_TRUE; swrast->AllowPixelFog = GL_TRUE; if (ctx->Visual.doubleBufferMode) swrast->CurrentBufferBit = BUFFER_BIT_BACK_LEFT; else swrast->CurrentBufferBit = BUFFER_FRONT_LEFT; /* Optimized Accum buffer */ swrast->_IntegerAccumMode = GL_FALSE; swrast->_IntegerAccumScaler = 0.0; for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) swrast->TextureSample[i] = _swrast_validate_texture_sample; swrast->SpanArrays = MALLOC_STRUCT(span_arrays); if (!swrast->SpanArrays) { FREE(swrast); return GL_FALSE; } /* init point span buffer */ swrast->PointSpan.primitive = GL_POINT; swrast->PointSpan.start = 0; swrast->PointSpan.end = 0; swrast->PointSpan.facing = 0; swrast->PointSpan.array = swrast->SpanArrays; assert(ctx->Const.MaxTextureUnits > 0); assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_UNITS); swrast->TexelBuffer = (GLchan *) MALLOC(ctx->Const.MaxTextureUnits * MAX_WIDTH * 4 * sizeof(GLchan)); if (!swrast->TexelBuffer) { FREE(swrast->SpanArrays); FREE(swrast); return GL_FALSE; } ctx->swrast_context = swrast; return GL_TRUE; } void _swrast_DestroyContext( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (SWRAST_DEBUG) { _mesa_debug(ctx, "_swrast_DestroyContext\n"); } FREE( swrast->SpanArrays ); FREE( swrast->TexelBuffer ); FREE( swrast ); ctx->swrast_context = 0; } struct swrast_device_driver * _swrast_GetDeviceDriverReference( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); return &swrast->Driver; } void _swrast_flush( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); /* flush any pending fragments from rendering points */ if (swrast->PointSpan.end > 0) { if (ctx->Visual.rgbMode) { _swrast_write_rgba_span(ctx, &(swrast->PointSpan)); } else { _swrast_write_index_span(ctx, &(swrast->PointSpan)); } swrast->PointSpan.end = 0; } } void _swrast_render_primitive( GLcontext *ctx, GLenum prim ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (swrast->Primitive == GL_POINTS && prim != GL_POINTS) { _swrast_flush(ctx); } swrast->Primitive = prim; } void _swrast_render_start( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (swrast->Driver.SpanRenderStart) swrast->Driver.SpanRenderStart( ctx ); swrast->PointSpan.end = 0; } void _swrast_render_finish( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (swrast->Driver.SpanRenderFinish) swrast->Driver.SpanRenderFinish( ctx ); _swrast_flush(ctx); } #define SWRAST_DEBUG_VERTICES 0 void _swrast_print_vertex( GLcontext *ctx, const SWvertex *v ) { GLuint i; if (SWRAST_DEBUG_VERTICES) { _mesa_debug(ctx, "win %f %f %f %f\n", v->win[0], v->win[1], v->win[2], v->win[3]); for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) if (ctx->Texture.Unit[i]._ReallyEnabled) _mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i, v->texcoord[i][0], v->texcoord[i][1], v->texcoord[i][2], v->texcoord[i][3]); #if CHAN_TYPE == GL_FLOAT _mesa_debug(ctx, "color %f %f %f %f\n", v->color[0], v->color[1], v->color[2], v->color[3]); _mesa_debug(ctx, "spec %f %f %f %f\n", v->specular[0], v->specular[1], v->specular[2], v->specular[3]); #else _mesa_debug(ctx, "color %d %d %d %d\n", v->color[0], v->color[1], v->color[2], v->color[3]); _mesa_debug(ctx, "spec %d %d %d %d\n", v->specular[0], v->specular[1], v->specular[2], v->specular[3]); #endif _mesa_debug(ctx, "fog %f\n", v->fog); _mesa_debug(ctx, "index %d\n", v->index); _mesa_debug(ctx, "pointsize %f\n", v->pointSize); _mesa_debug(ctx, "\n"); } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_context.h0000644000000000000000000003143313614532424020723 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file swrast/s_context.h * \brief Software rasterization context and private types. * \author Keith Whitwell */ /** * \mainpage swrast module * * This module, software rasterization, contains the software fallback * routines for drawing points, lines, triangles, bitmaps and images. * All rendering boils down to writing spans (arrays) of pixels with * particular colors. The span-writing routines must be implemented * by the device driver. */ #ifndef S_CONTEXT_H #define S_CONTEXT_H #include "mtypes.h" #include "swrast.h" /** * \defgroup SpanFlags SPAN_XXX-flags * Bitmasks to indicate which span_arrays need to be computed * (sw_span::interpMask) or have already been filled * (sw_span::arrayMask) */ /*@{*/ #define SPAN_RGBA 0x001 #define SPAN_SPEC 0x002 #define SPAN_INDEX 0x004 #define SPAN_Z 0x008 #define SPAN_W 0x010 #define SPAN_FOG 0x020 #define SPAN_TEXTURE 0x040 #define SPAN_INT_TEXTURE 0x080 #define SPAN_LAMBDA 0x100 #define SPAN_COVERAGE 0x200 #define SPAN_FLAT 0x400 /**< flat shading? */ /** sw_span::arrayMask only - for span_arrays::x, span_arrays::y */ #define SPAN_XY 0x800 #define SPAN_MASK 0x1000 /**< sw_span::arrayMask only */ /*@}*/ /** * \struct span_arrays * \brief Arrays of fragment values. * * These will either be computed from the x/xStep values above or * filled in by glDraw/CopyPixels, etc. * These arrays are separated out of sw_span to conserve memory. */ struct span_arrays { GLchan rgb[MAX_WIDTH][3]; GLchan rgba[MAX_WIDTH][4]; GLuint index[MAX_WIDTH]; GLchan spec[MAX_WIDTH][4]; /* specular color */ GLint x[MAX_WIDTH]; /**< X/Y used for point/line rendering only */ GLint y[MAX_WIDTH]; /**< X/Y used for point/line rendering only */ GLdepth z[MAX_WIDTH]; GLfloat fog[MAX_WIDTH]; GLfloat texcoords[MAX_TEXTURE_COORD_UNITS][MAX_WIDTH][4]; GLfloat lambda[MAX_TEXTURE_COORD_UNITS][MAX_WIDTH]; GLfloat coverage[MAX_WIDTH]; /** This mask indicates if fragment is alive or culled */ GLubyte mask[MAX_WIDTH]; }; /** * \struct sw_span * \brief Contains data for either a horizontal line or a set of * pixels that are passed through a pipeline of functions before being * drawn. * * The sw_span structure describes the colors, Z, fogcoord, texcoords, * etc for either a horizontal run or an array of independent pixels. * We can either specify a base/step to indicate interpolated values, or * fill in arrays of values. The interpMask and arrayMask bitfields * indicate which are active. * * With this structure it's easy to hand-off span rasterization to * subroutines instead of doing it all inline in the triangle functions * like we used to do. * It also cleans up the local variable namespace a great deal. * * It would be interesting to experiment with multiprocessor rasterization * with this structure. The triangle rasterizer could simply emit a * stream of these structures which would be consumed by one or more * span-processing threads which could run in parallel. */ struct sw_span { GLint x, y; /** Only need to process pixels between start <= i < end */ /** At this time, start is always zero. */ GLuint start, end; /** This flag indicates that mask[] array is effectively filled with ones */ GLboolean writeAll; /** either GL_POLYGON, GL_LINE, GL_POLYGON, GL_BITMAP */ GLenum primitive; /** 0 = front-facing span, 1 = back-facing span (for two-sided stencil) */ GLuint facing; /** * This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates * which of the x/xStep variables are relevant. */ GLuint interpMask; /* For horizontal spans, step is the partial derivative wrt X. * For lines, step is the delta from one fragment to the next. */ #if CHAN_TYPE == GL_FLOAT GLfloat red, redStep; GLfloat green, greenStep; GLfloat blue, blueStep; GLfloat alpha, alphaStep; GLfloat specRed, specRedStep; GLfloat specGreen, specGreenStep; GLfloat specBlue, specBlueStep; #else /* CHAN_TYPE == GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT */ GLfixed red, redStep; GLfixed green, greenStep; GLfixed blue, blueStep; GLfixed alpha, alphaStep; GLfixed specRed, specRedStep; GLfixed specGreen, specGreenStep; GLfixed specBlue, specBlueStep; #endif GLfixed index, indexStep; GLfixed z, zStep; GLfloat fog, fogStep; GLfloat tex[MAX_TEXTURE_COORD_UNITS][4]; /* s, t, r, q */ GLfloat texStepX[MAX_TEXTURE_COORD_UNITS][4]; GLfloat texStepY[MAX_TEXTURE_COORD_UNITS][4]; GLfixed intTex[2], intTexStep[2]; /* s, t only */ /* partial derivatives wrt X and Y. */ GLfloat dzdx, dzdy; GLfloat w, dwdx, dwdy; GLfloat drdx, drdy; GLfloat dgdx, dgdy; GLfloat dbdx, dbdy; GLfloat dadx, dady; GLfloat dsrdx, dsrdy; GLfloat dsgdx, dsgdy; GLfloat dsbdx, dsbdy; GLfloat dfogdx, dfogdy; /** * This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates * which of the fragment arrays in the span_arrays struct are relevant. */ GLuint arrayMask; /** * We store the arrays of fragment values in a separate struct so * that we can allocate sw_span structs on the stack without using * a lot of memory. The span_arrays struct is about 400KB while the * sw_span struct is only about 512 bytes. */ struct span_arrays *array; }; #define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK) \ do { \ (S).primitive = (PRIMITIVE); \ (S).interpMask = (INTERP_MASK); \ (S).arrayMask = (ARRAY_MASK); \ (S).start = 0; \ (S).end = (END); \ (S).facing = 0; \ (S).array = SWRAST_CONTEXT(ctx)->SpanArrays; \ } while (0) typedef void (*texture_sample_func)(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]); typedef void (_ASMAPIP blend_func)( GLcontext *ctx, GLuint n, const GLubyte mask[], GLchan src[][4], CONST GLchan dst[][4] ); typedef void (*swrast_point_func)( GLcontext *ctx, const SWvertex *); typedef void (*swrast_line_func)( GLcontext *ctx, const SWvertex *, const SWvertex *); typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *, const SWvertex *, const SWvertex *); /** \defgroup Bitmasks * Bitmasks to indicate which rasterization options are enabled * (RasterMask) */ /*@{*/ #define ALPHATEST_BIT 0x001 /**< Alpha-test pixels */ #define BLEND_BIT 0x002 /**< Blend pixels */ #define DEPTH_BIT 0x004 /**< Depth-test pixels */ #define FOG_BIT 0x008 /**< Fog pixels */ #define LOGIC_OP_BIT 0x010 /**< Apply logic op in software */ #define CLIP_BIT 0x020 /**< Scissor or window clip pixels */ #define STENCIL_BIT 0x040 /**< Stencil pixels */ #define MASKING_BIT 0x080 /**< Do glColorMask or glIndexMask */ #define MULTI_DRAW_BIT 0x400 /**< Write to more than one color- */ /**< buffer or no buffers. */ #define OCCLUSION_BIT 0x800 /**< GL_HP_occlusion_test enabled */ #define TEXTURE_BIT 0x1000 /**< Texturing really enabled */ #define FRAGPROG_BIT 0x2000 /**< Fragment program enabled */ #define ATIFRAGSHADER_BIT 0x4000 /**< ATI Fragment shader enabled */ #define CLAMPING_BIT 0x8000 /**< Clamp colors to [0,1] */ /*@}*/ #define _SWRAST_NEW_RASTERMASK (_NEW_BUFFERS| \ _NEW_SCISSOR| \ _NEW_COLOR| \ _NEW_DEPTH| \ _NEW_FOG| \ _NEW_PROGRAM| \ _NEW_STENCIL| \ _NEW_TEXTURE| \ _NEW_VIEWPORT| \ _NEW_DEPTH) /** * \struct SWcontext * \brief SWContext? */ typedef struct { /** Driver interface: */ struct swrast_device_driver Driver; /** Configuration mechanisms to make software rasterizer match * characteristics of the hardware rasterizer (if present): */ GLboolean AllowVertexFog; GLboolean AllowPixelFog; /** Derived values, invalidated on statechanges, updated from * _swrast_validate_derived(): */ GLuint _RasterMask; GLfloat _MinMagThresh[MAX_TEXTURE_IMAGE_UNITS]; GLfloat _BackfaceSign; GLboolean _PreferPixelFog; /* Compute fog blend factor per fragment? */ GLboolean _AnyTextureCombine; GLchan _FogColor[3]; GLboolean _FogEnabled; GLenum _FogMode; /* either GL_FOG_MODE or fragment program's fog mode */ /* Accum buffer temporaries. */ GLboolean _IntegerAccumMode; /**< Storing unscaled integers? */ GLfloat _IntegerAccumScaler; /**< Implicit scale factor */ /* Working values: */ GLuint StippleCounter; /**< Line stipple counter */ GLuint NewState; GLuint StateChanges; GLenum Primitive; /* current primitive being drawn (ala glBegin) */ GLbitfield CurrentBufferBit; /* exactly one the of DD_*_BIT buffer bits */ /** Mechanism to allow driver (like X11) to register further * software rasterization routines. */ /*@{*/ void (*choose_point)( GLcontext * ); void (*choose_line)( GLcontext * ); void (*choose_triangle)( GLcontext * ); GLuint invalidate_point; GLuint invalidate_line; GLuint invalidate_triangle; /*@}*/ /** Function pointers for dispatch behind public entrypoints. */ /*@{*/ void (*InvalidateState)( GLcontext *ctx, GLuint new_state ); swrast_point_func Point; swrast_line_func Line; swrast_tri_func Triangle; /*@}*/ /** * Placeholders for when separate specular (or secondary color) is * enabled but texturing is not. */ /*@{*/ swrast_point_func SpecPoint; swrast_line_func SpecLine; swrast_tri_func SpecTriangle; /*@}*/ /** * Typically, we'll allocate a sw_span structure as a local variable * and set its 'array' pointer to point to this object. The reason is * this object is big and causes problems when allocated on the stack * on some systems. */ struct span_arrays *SpanArrays; /** * Used to buffer N GL_POINTS, instead of rendering one by one. */ struct sw_span PointSpan; /** Internal hooks, kept uptodate by the same mechanism as above. */ blend_func BlendFunc; texture_sample_func TextureSample[MAX_TEXTURE_IMAGE_UNITS]; /** Buffer for saving the sampled texture colors. * Needed for GL_ARB_texture_env_crossbar implementation. */ GLchan *TexelBuffer; } SWcontext; extern void _swrast_validate_derived( GLcontext *ctx ); #define SWRAST_CONTEXT(ctx) ((SWcontext *)ctx->swrast_context) #define RENDER_START(SWctx, GLctx) \ do { \ if ((SWctx)->Driver.SpanRenderStart) { \ (*(SWctx)->Driver.SpanRenderStart)(GLctx); \ } \ } while (0) #define RENDER_FINISH(SWctx, GLctx) \ do { \ if ((SWctx)->Driver.SpanRenderFinish) { \ (*(SWctx)->Driver.SpanRenderFinish)(GLctx); \ } \ } while (0) /* * XXX these macros are just bandages for now in order to make * CHAN_BITS==32 compile cleanly. * These should probably go elsewhere at some point. */ #if CHAN_TYPE == GL_FLOAT #define ChanToFixed(X) (X) #define FixedToChan(X) (X) #else #define ChanToFixed(X) IntToFixed(X) #define FixedToChan(X) FixedToInt(X) #endif extern void _swrast_translate_program( GLcontext *ctx ); extern GLboolean _swrast_execute_codegen_program(GLcontext *ctx, const struct fragment_program *program, GLuint maxInst, struct fp_machine *machine, const struct sw_span *span, GLuint column ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_copypix.c0000644000000000000000000005506613614532424020735 0ustar /* * Mesa 3-D graphics library * Version: 6.4 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "context.h" #include "colormac.h" #include "convolve.h" #include "histogram.h" #include "image.h" #include "macros.h" #include "imports.h" #include "pixel.h" #include "s_context.h" #include "s_depth.h" #include "s_pixeltex.h" #include "s_span.h" #include "s_stencil.h" #include "s_texture.h" #include "s_zoom.h" /* * Determine if there's overlap in an image copy. * This test also compensates for the fact that copies are done from * bottom to top and overlaps can sometimes be handled correctly * without making a temporary image copy. */ static GLboolean regions_overlap(GLint srcx, GLint srcy, GLint dstx, GLint dsty, GLint width, GLint height, GLfloat zoomX, GLfloat zoomY) { if (zoomX == 1.0 && zoomY == 1.0) { /* no zoom */ if (srcx >= dstx + width || (srcx + width <= dstx)) { return GL_FALSE; } else if (srcy < dsty) { /* this is OK */ return GL_FALSE; } else if (srcy > dsty + height) { return GL_FALSE; } else { return GL_TRUE; } } else { /* add one pixel of slop when zooming, just to be safe */ if ((srcx > dstx + (width * zoomX) + 1) || (srcx + width + 1 < dstx)) { return GL_FALSE; } else if ((srcy < dsty) && (srcy + height < dsty + (height * zoomY))) { return GL_FALSE; } else if ((srcy > dsty) && (srcy + height > dsty + (height * zoomY))) { return GL_FALSE; } else { return GL_TRUE; } } } /** * Convert GLfloat[n][4] colors to GLchan[n][4]. * XXX maybe move into image.c */ static void float_span_to_chan(GLuint n, CONST GLfloat in[][4], GLchan out[][4]) { GLuint i; for (i = 0; i < n; i++) { UNCLAMPED_FLOAT_TO_CHAN(out[i][RCOMP], in[i][RCOMP]); UNCLAMPED_FLOAT_TO_CHAN(out[i][GCOMP], in[i][GCOMP]); UNCLAMPED_FLOAT_TO_CHAN(out[i][BCOMP], in[i][BCOMP]); UNCLAMPED_FLOAT_TO_CHAN(out[i][ACOMP], in[i][ACOMP]); } } /** * Convert GLchan[n][4] colors to GLfloat[n][4]. * XXX maybe move into image.c */ static void chan_span_to_float(GLuint n, CONST GLchan in[][4], GLfloat out[][4]) { GLuint i; for (i = 0; i < n; i++) { out[i][RCOMP] = CHAN_TO_FLOAT(in[i][RCOMP]); out[i][GCOMP] = CHAN_TO_FLOAT(in[i][GCOMP]); out[i][BCOMP] = CHAN_TO_FLOAT(in[i][BCOMP]); out[i][ACOMP] = CHAN_TO_FLOAT(in[i][ACOMP]); } } /* * RGBA copypixels with convolution. */ static void copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty) { SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_renderbuffer *drawRb = NULL; GLboolean quick_draw; GLint row; GLboolean changeBuffer; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; const GLuint transferOps = ctx->_ImageTransferState; GLfloat *dest, *tmpImage, *convImage; struct sw_span span; INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); if (ctx->Depth.Test) _swrast_span_default_z(ctx, &span); if (swrast->_FogEnabled) _swrast_span_default_fog(ctx, &span); if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && destx >= 0 && destx + width <= (GLint) ctx->DrawBuffer->Width) { quick_draw = GL_TRUE; drawRb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; } else { quick_draw = GL_FALSE; } /* If read and draw buffer are different we must do buffer switching */ changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer[0] || ctx->DrawBuffer != ctx->ReadBuffer; /* allocate space for GLfloat image */ tmpImage = (GLfloat *) MALLOC(width * height * 4 * sizeof(GLfloat)); if (!tmpImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels"); return; } convImage = (GLfloat *) MALLOC(width * height * 4 * sizeof(GLfloat)); if (!convImage) { FREE(tmpImage); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels"); return; } if (changeBuffer) { /* choose the read buffer */ _swrast_use_read_buffer(ctx); } /* read source image */ dest = tmpImage; for (row = 0; row < height; row++) { GLchan rgba[MAX_WIDTH][4]; /* Read GLchan and convert to GLfloat */ _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer, width, srcx, srcy + row, rgba); chan_span_to_float(width, (CONST GLchan (*)[4]) rgba, (GLfloat (*)[4]) dest); dest += 4 * width; } if (changeBuffer) { /* restore default src/dst buffer */ _swrast_use_draw_buffer(ctx); } /* do the image transfer ops which preceed convolution */ for (row = 0; row < height; row++) { GLfloat (*rgba)[4] = (GLfloat (*)[4]) (tmpImage + row * width * 4); _mesa_apply_rgba_transfer_ops(ctx, transferOps & IMAGE_PRE_CONVOLUTION_BITS, width, rgba); } /* do convolution */ if (ctx->Pixel.Convolution2DEnabled) { _mesa_convolve_2d_image(ctx, &width, &height, tmpImage, convImage); } else { ASSERT(ctx->Pixel.Separable2DEnabled); _mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage); } FREE(tmpImage); /* do remaining post-convolution image transfer ops */ for (row = 0; row < height; row++) { GLfloat (*rgba)[4] = (GLfloat (*)[4]) (convImage + row * width * 4); _mesa_apply_rgba_transfer_ops(ctx, transferOps & IMAGE_POST_CONVOLUTION_BITS, width, rgba); } /* write the new image */ for (row = 0; row < height; row++) { const GLfloat *src = convImage + row * width * 4; GLint dy; /* convert floats back to chan */ float_span_to_chan(width, (const GLfloat (*)[4]) src, span.array->rgba); if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) { span.end = width; _swrast_pixel_texture(ctx, &span); } /* write row to framebuffer */ dy = desty + row; if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) { drawRb->PutRow(ctx, drawRb, width, destx, dy, span.array->rgba, NULL); } else if (zoom) { span.x = destx; span.y = dy; span.end = width; _swrast_write_zoomed_rgba_span(ctx, &span, (CONST GLchan (*)[4])span.array->rgba, desty, 0); } else { span.x = destx; span.y = dy; span.end = width; _swrast_write_rgba_span(ctx, &span); } } FREE(convImage); } /* * RGBA copypixels */ static void copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty) { SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_renderbuffer *drawRb; GLchan *tmpImage,*p; GLboolean quick_draw; GLint sy, dy, stepy, j; GLboolean changeBuffer; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; GLint overlapping; const GLuint transferOps = ctx->_ImageTransferState; struct sw_span span; if (!ctx->ReadBuffer->_ColorReadBuffer) { /* no readbuffer - OK */ return; } INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { copy_conv_rgba_pixels(ctx, srcx, srcy, width, height, destx, desty); return; } /* Determine if copy should be done bottom-to-top or top-to-bottom */ if (srcy < desty) { /* top-down max-to-min */ sy = srcy + height - 1; dy = desty + height - 1; stepy = -1; } else { /* bottom-up min-to-max */ sy = srcy; dy = desty; stepy = 1; } if (ctx->DrawBuffer == ctx->ReadBuffer) { overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); } else { overlapping = GL_FALSE; } if (ctx->Depth.Test) _swrast_span_default_z(ctx, &span); if (swrast->_FogEnabled) _swrast_span_default_fog(ctx, &span); if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && destx >= 0 && destx + width <= (GLint) ctx->DrawBuffer->Width) { quick_draw = GL_TRUE; drawRb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; } else { quick_draw = GL_FALSE; drawRb = NULL; } /* If read and draw buffer are different we must do buffer switching */ changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer[0] || ctx->DrawBuffer != ctx->ReadBuffer; if (overlapping) { GLint ssy = sy; tmpImage = (GLchan *) MALLOC(width * height * sizeof(GLchan) * 4); if (!tmpImage) { _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); return; } /* setup source */ if (changeBuffer) _swrast_use_read_buffer(ctx); /* read the source image */ p = tmpImage; for (j = 0; j < height; j++, ssy += stepy) { _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, width, srcx, ssy, (GLchan (*)[4]) p ); p += width * 4; } p = tmpImage; /* restore dest */ if (changeBuffer) { _swrast_use_draw_buffer(ctx); changeBuffer = GL_FALSE; } } else { tmpImage = NULL; /* silence compiler warnings */ p = NULL; } for (j = 0; j < height; j++, sy += stepy, dy += stepy) { /* Get source pixels */ if (overlapping) { /* get from buffered image */ ASSERT(width < MAX_WIDTH); MEMCPY(span.array->rgba, p, width * sizeof(GLchan) * 4); p += width * 4; } else { /* get from framebuffer */ if (changeBuffer) _swrast_use_read_buffer(ctx); ASSERT(width < MAX_WIDTH); _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, width, srcx, sy, span.array->rgba ); if (changeBuffer) _swrast_use_draw_buffer(ctx); } if (transferOps) { DEFMARRAY(GLfloat, rgbaFloat, MAX_WIDTH, 4); /* mac 32k limitation */ CHECKARRAY(rgbaFloat, return); /* convert to float, transfer, convert back to chan */ chan_span_to_float(width, (CONST GLchan (*)[4]) span.array->rgba, rgbaFloat); _mesa_apply_rgba_transfer_ops(ctx, transferOps, width, rgbaFloat); float_span_to_chan(width, (CONST GLfloat (*)[4]) rgbaFloat, span.array->rgba); UNDEFARRAY(rgbaFloat); /* mac 32k limitation */ } if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) { span.end = width; _swrast_pixel_texture(ctx, &span); } /* Write color span */ if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) { drawRb->PutRow(ctx, drawRb, width, destx, dy, span.array->rgba, NULL); } else if (zoom) { span.x = destx; span.y = dy; span.end = width; _swrast_write_zoomed_rgba_span(ctx, &span, (CONST GLchan (*)[4]) span.array->rgba, desty, 0); } else { span.x = destx; span.y = dy; span.end = width; _swrast_write_rgba_span(ctx, &span); } } if (overlapping) FREE(tmpImage); } static void copy_ci_pixels( GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint *tmpImage,*p; GLint sy, dy, stepy; GLint j; GLboolean changeBuffer; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset; GLint overlapping; struct sw_span span; if (!ctx->ReadBuffer->_ColorReadBuffer) { /* no readbuffer - OK */ return; } INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX); /* Determine if copy should be bottom-to-top or top-to-bottom */ if (srcyDrawBuffer == ctx->ReadBuffer) { overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); } else { overlapping = GL_FALSE; } if (ctx->Depth.Test) _swrast_span_default_z(ctx, &span); if (swrast->_FogEnabled) _swrast_span_default_fog(ctx, &span); /* If read and draw buffer are different we must do buffer switching */ changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer[0] || ctx->DrawBuffer != ctx->ReadBuffer; if (overlapping) { GLint ssy = sy; tmpImage = (GLuint *) MALLOC(width * height * sizeof(GLuint)); if (!tmpImage) { _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); return; } /* setup source */ if (changeBuffer) _swrast_use_read_buffer(ctx); /* read the image */ p = tmpImage; for (j = 0; j < height; j++, ssy += stepy) { _swrast_read_index_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, width, srcx, ssy, p ); p += width; } p = tmpImage; /* restore to draw buffer */ if (changeBuffer) { _swrast_use_draw_buffer(ctx); changeBuffer = GL_FALSE; } } else { tmpImage = NULL; /* silence compiler warning */ p = NULL; } for (j = 0; j < height; j++, sy += stepy, dy += stepy) { /* Get color indexes */ if (overlapping) { MEMCPY(span.array->index, p, width * sizeof(GLuint)); p += width; } else { if (changeBuffer) _swrast_use_read_buffer(ctx); _swrast_read_index_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, width, srcx, sy, span.array->index ); if (changeBuffer) _swrast_use_draw_buffer(ctx); } /* Apply shift, offset, look-up table */ if (shift_or_offset) { _mesa_shift_and_offset_ci( ctx, width, span.array->index ); } if (ctx->Pixel.MapColorFlag) { _mesa_map_ci( ctx, width, span.array->index ); } /* write color indexes */ span.x = destx; span.y = dy; span.end = width; if (zoom) _swrast_write_zoomed_index_span(ctx, &span, desty, 0); else _swrast_write_index_span(ctx, &span); } if (overlapping) FREE(tmpImage); } /* * TODO: Optimize!!!! */ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF; struct gl_renderbuffer *readRb = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; GLfloat *p, *tmpImage; GLint sy, dy, stepy; GLint i, j; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; GLint overlapping; struct sw_span span; if (!readRb) { /* no readbuffer - OK */ return; } INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z); if (!ctx->Visual.depthBits) { _mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); return; } /* Determine if copy should be bottom-to-top or top-to-bottom */ if (srcyDrawBuffer == ctx->ReadBuffer) { overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); } else { overlapping = GL_FALSE; } _swrast_span_default_color(ctx, &span); if (swrast->_FogEnabled) _swrast_span_default_fog(ctx, &span); if (overlapping) { GLint ssy = sy; tmpImage = (GLfloat *) MALLOC(width * height * sizeof(GLfloat)); if (!tmpImage) { _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); return; } p = tmpImage; for (j = 0; j < height; j++, ssy += stepy) { _swrast_read_depth_span_float(ctx, readRb, width, srcx, ssy, p); p += width; } p = tmpImage; } else { tmpImage = NULL; /* silence compiler warning */ p = NULL; } for (j = 0; j < height; j++, sy += stepy, dy += stepy) { GLfloat depth[MAX_WIDTH]; /* get depth values */ if (overlapping) { MEMCPY(depth, p, width * sizeof(GLfloat)); p += width; } else { _swrast_read_depth_span_float(ctx, readRb, width, srcx, sy, depth); } /* apply scale and bias */ for (i = 0; i < width; i++) { GLfloat d = depth[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias; span.array->z[i] = (GLdepth) (CLAMP(d, 0.0F, 1.0F) * depthMax); } /* write depth values */ span.x = destx; span.y = dy; span.end = width; if (ctx->Visual.rgbMode) { if (zoom) _swrast_write_zoomed_rgba_span( ctx, &span, (const GLchan (*)[4])span.array->rgba, desty, 0 ); else _swrast_write_rgba_span(ctx, &span); } else { if (zoom) _swrast_write_zoomed_index_span( ctx, &span, desty, 0 ); else _swrast_write_index_span(ctx, &span); } } if (overlapping) FREE(tmpImage); } static void copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty ) { struct gl_renderbuffer *rb = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer; GLint sy, dy, stepy; GLint j; GLstencil *p, *tmpImage; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset; GLint overlapping; if (!ctx->Visual.stencilBits) { _mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); return; } if (!rb) { /* no readbuffer - OK */ return; } /* Determine if copy should be bottom-to-top or top-to-bottom */ if (srcy < desty) { /* top-down max-to-min */ sy = srcy + height - 1; dy = desty + height - 1; stepy = -1; } else { /* bottom-up min-to-max */ sy = srcy; dy = desty; stepy = 1; } if (ctx->DrawBuffer == ctx->ReadBuffer) { overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); } else { overlapping = GL_FALSE; } if (overlapping) { GLint ssy = sy; tmpImage = (GLstencil *) MALLOC(width * height * sizeof(GLstencil)); if (!tmpImage) { _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); return; } p = tmpImage; for (j = 0; j < height; j++, ssy += stepy) { _swrast_read_stencil_span( ctx, rb, width, srcx, ssy, p ); p += width; } p = tmpImage; } else { tmpImage = NULL; /* silence compiler warning */ p = NULL; } for (j = 0; j < height; j++, sy += stepy, dy += stepy) { GLstencil stencil[MAX_WIDTH]; /* Get stencil values */ if (overlapping) { MEMCPY(stencil, p, width * sizeof(GLstencil)); p += width; } else { _swrast_read_stencil_span( ctx, rb, width, srcx, sy, stencil ); } /* Apply shift, offset, look-up table */ if (shift_or_offset) { _mesa_shift_and_offset_stencil( ctx, width, stencil ); } if (ctx->Pixel.MapStencilFlag) { _mesa_map_stencil( ctx, width, stencil ); } /* Write stencil values */ if (zoom) { _swrast_write_zoomed_stencil_span( ctx, width, destx, dy, stencil, desty, 0 ); } else { _swrast_write_stencil_span( ctx, width, destx, dy, stencil ); } } if (overlapping) FREE(tmpImage); } void _swrast_CopyPixels( GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); RENDER_START(swrast,ctx); if (swrast->NewState) _swrast_validate_derived( ctx ); if (type == GL_COLOR && ctx->Visual.rgbMode) { copy_rgba_pixels( ctx, srcx, srcy, width, height, destx, desty ); } else if (type == GL_COLOR && !ctx->Visual.rgbMode) { copy_ci_pixels( ctx, srcx, srcy, width, height, destx, desty ); } else if (type == GL_DEPTH) { copy_depth_pixels( ctx, srcx, srcy, width, height, destx, desty ); } else if (type == GL_STENCIL) { copy_stencil_pixels( ctx, srcx, srcy, width, height, destx, desty ); } else { _mesa_error( ctx, GL_INVALID_ENUM, "glCopyPixels" ); } RENDER_FINISH(swrast,ctx); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_depth.c0000644000000000000000000007230613614532424020342 0ustar /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "context.h" #include "macros.h" #include "imports.h" #include "fbobject.h" #include "s_depth.h" #include "s_context.h" #include "s_span.h" /** * Do depth test for a horizontal span of fragments. * Input: zbuffer - array of z values in the zbuffer * z - array of fragment z values * Return: number of fragments which pass the test. */ static GLuint depth_test_span16( GLcontext *ctx, GLuint n, GLushort zbuffer[], const GLuint z[], GLubyte mask[] ) { GLuint passed = 0; /* switch cases ordered from most frequent to less frequent */ switch (ctx->Depth.Func) { case GL_LESS: if (ctx->Depth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0;iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0;i= zbuffer[i]) { zbuffer[i] = z[i]; passed++; } else { mask[i] = 0; } } } } else { /* Don't update Z buffer */ GLuint i; for (i=0;i= zbuffer[i]) { /* pass */ passed++; } else { mask[i] = 0; } } } } break; case GL_GREATER: if (ctx->Depth.Mask) { /* Update Z buffer */ GLuint i; for (i=0;i zbuffer[i]) { zbuffer[i] = z[i]; passed++; } else { mask[i] = 0; } } } } else { /* Don't update Z buffer */ GLuint i; for (i=0;i zbuffer[i]) { /* pass */ passed++; } else { mask[i] = 0; } } } } break; case GL_NOTEQUAL: if (ctx->Depth.Mask) { /* Update Z buffer */ GLuint i; for (i=0;iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0;iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0;iDepth.Func) { case GL_LESS: if (ctx->Depth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0;iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0;i= zbuffer[i]) { zbuffer[i] = z[i]; passed++; } else { mask[i] = 0; } } } } else { /* Don't update Z buffer */ GLuint i; for (i=0;i= zbuffer[i]) { /* pass */ passed++; } else { mask[i] = 0; } } } } break; case GL_GREATER: if (ctx->Depth.Mask) { /* Update Z buffer */ GLuint i; for (i=0;i zbuffer[i]) { zbuffer[i] = z[i]; passed++; } else { mask[i] = 0; } } } } else { /* Don't update Z buffer */ GLuint i; for (i=0;i zbuffer[i]) { /* pass */ passed++; } else { mask[i] = 0; } } } } break; case GL_NOTEQUAL: if (ctx->Depth.Mask) { /* Update Z buffer */ GLuint i; for (i=0;iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0;iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0;iDrawBuffer; struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer; const GLint x = span->x; const GLint y = span->y; const GLuint count = span->end; const GLuint *zValues = span->array->z; GLubyte *mask = span->array->mask; GLuint passed; ASSERT((span->arrayMask & SPAN_XY) == 0); ASSERT(span->arrayMask & SPAN_Z); if (rb->GetPointer(ctx, rb, 0, 0)) { /* Directly access buffer */ if (ctx->DrawBuffer->Visual.depthBits <= 16) { GLushort *zbuffer = (GLushort *) rb->GetPointer(ctx, rb, x, y); passed = depth_test_span16(ctx, count, zbuffer, zValues, mask); } else { GLuint *zbuffer = (GLuint *) rb->GetPointer(ctx, rb, x, y); passed = depth_test_span32(ctx, count, zbuffer, zValues, mask); } } else { /* read depth values from buffer, test, write back */ if (rb->DataType == GL_UNSIGNED_SHORT) { GLushort zbuffer[MAX_WIDTH]; rb->GetRow(ctx, rb, count, x, y, zbuffer); passed = depth_test_span16(ctx, count, zbuffer, zValues, mask ); rb->PutRow(ctx, rb, count, x, y, zbuffer, NULL); } else { GLuint zbuffer[MAX_WIDTH]; ASSERT(rb->DataType == GL_UNSIGNED_INT); rb->GetRow(ctx, rb, count, x, y, zbuffer); passed = depth_test_span32(ctx, count, zbuffer, zValues, mask ); rb->PutRow(ctx, rb, count, x, y, zbuffer, NULL); } } if (passed < count) { span->writeAll = GL_FALSE; } return passed; } #define Z_ADDRESS(X, Y) (zStart + (Y) * stride + (X)) /* * Do depth testing for an array of fragments at assorted locations. */ static void direct_depth_test_pixels16(GLcontext *ctx, GLushort *zStart, GLuint stride, GLuint n, const GLint x[], const GLint y[], const GLuint z[], GLubyte mask[] ) { /* switch cases ordered from most frequent to less frequent */ switch (ctx->Depth.Func) { case GL_LESS: if (ctx->Depth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; i= *zptr) { /* pass */ *zptr = z[i]; } else { /* fail */ mask[i] = 0; } } } } else { /* Don't update Z buffer */ GLuint i; for (i=0; i= *zptr) { /* pass */ } else { /* fail */ mask[i] = 0; } } } } break; case GL_GREATER: if (ctx->Depth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; i *zptr) { /* pass */ *zptr = z[i]; } else { /* fail */ mask[i] = 0; } } } } else { /* Don't update Z buffer */ GLuint i; for (i=0; i *zptr) { /* pass */ } else { /* fail */ mask[i] = 0; } } } } break; case GL_NOTEQUAL: if (ctx->Depth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; iDepth.Func) { case GL_LESS: if (ctx->Depth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; i= *zptr) { /* pass */ *zptr = z[i]; } else { /* fail */ mask[i] = 0; } } } } else { /* Don't update Z buffer */ GLuint i; for (i=0; i= *zptr) { /* pass */ } else { /* fail */ mask[i] = 0; } } } } break; case GL_GREATER: if (ctx->Depth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; i *zptr) { /* pass */ *zptr = z[i]; } else { /* fail */ mask[i] = 0; } } } } else { /* Don't update Z buffer */ GLuint i; for (i=0; i *zptr) { /* pass */ } else { /* fail */ mask[i] = 0; } } } } break; case GL_NOTEQUAL: if (ctx->Depth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; iDepth.Mask) { /* Update Z buffer */ GLuint i; for (i=0; iDrawBuffer; struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer; const GLuint count = span->end; const GLint *x = span->array->x; const GLint *y = span->array->y; const GLuint *z = span->array->z; GLubyte *mask = span->array->mask; if (rb->GetPointer(ctx, rb, 0, 0)) { /* Directly access values */ if (rb->DataType == GL_UNSIGNED_SHORT) { GLushort *zStart = (GLushort *) rb->Data; GLuint stride = rb->Width; direct_depth_test_pixels16(ctx, zStart, stride, count, x, y, z, mask); } else { GLuint *zStart = (GLuint *) rb->Data; GLuint stride = rb->Width; direct_depth_test_pixels32(ctx, zStart, stride, count, x, y, z, mask); } } else { /* read depth values from buffer, test, write back */ if (rb->DataType == GL_UNSIGNED_SHORT) { GLushort zbuffer[MAX_WIDTH]; _swrast_get_values(ctx, rb, count, x, y, zbuffer, sizeof(GLushort)); depth_test_span16(ctx, count, zbuffer, z, mask ); rb->PutValues(ctx, rb, count, x, y, zbuffer, NULL); } else { GLuint zbuffer[MAX_WIDTH]; ASSERT(rb->DataType == GL_UNSIGNED_INT); _swrast_get_values(ctx, rb, count, x, y, zbuffer, sizeof(GLuint)); depth_test_span32(ctx, count, zbuffer, z, mask ); rb->PutValues(ctx, rb, count, x, y, zbuffer, NULL); } } return count; /* not really correct, but OK */ } /** * Apply depth (Z) buffer testing to the span. * \return approx number of pixels that passed (only zero is reliable) */ GLuint _swrast_depth_test_span( GLcontext *ctx, struct sw_span *span) { if (span->arrayMask & SPAN_XY) return depth_test_pixels(ctx, span); else return depth_test_span(ctx, span); } /** * GL_EXT_depth_bounds_test extension. * Discard fragments depending on whether the corresponding Z-buffer * values are outside the depth bounds test range. * Note: we test the Z buffer values, not the fragment Z values! * \return GL_TRUE if any fragments pass, GL_FALSE if no fragments pass */ GLboolean _swrast_depth_bounds_test( GLcontext *ctx, struct sw_span *span ) { struct gl_framebuffer *fb = ctx->DrawBuffer; struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer; GLuint zMin = (GLuint) (ctx->Depth.BoundsMin * fb->_DepthMaxF + 0.5F); GLuint zMax = (GLuint) (ctx->Depth.BoundsMax * fb->_DepthMaxF + 0.5F); GLubyte *mask = span->array->mask; const GLuint count = span->end; GLuint i; GLboolean anyPass = GL_FALSE; if (rb->DataType == GL_UNSIGNED_SHORT) { /* get 16-bit values */ GLushort zbuffer16[MAX_WIDTH], *zbuffer; if (span->arrayMask & SPAN_XY) { _swrast_get_values(ctx, rb, count, span->array->x, span->array->y, zbuffer16, sizeof(GLushort)); zbuffer = zbuffer16; } else { zbuffer = rb->GetPointer(ctx, rb, span->x, span->y); if (!zbuffer) { rb->GetRow(ctx, rb, count, span->x, span->y, zbuffer16); zbuffer = zbuffer16; } } assert(zbuffer); /* Now do the tests */ for (i = 0; i < count; i++) { if (mask[i]) { if (zbuffer[i] < zMin || zbuffer[i] > zMax) mask[i] = GL_FALSE; else anyPass = GL_TRUE; } } } else { /* get 32-bit values */ GLuint zbuffer32[MAX_WIDTH], *zbuffer; if (span->arrayMask & SPAN_XY) { _swrast_get_values(ctx, rb, count, span->array->x, span->array->y, zbuffer32, sizeof(GLuint)); zbuffer = zbuffer32; } else { zbuffer = rb->GetPointer(ctx, rb, span->x, span->y); if (!zbuffer) { rb->GetRow(ctx, rb, count, span->x, span->y, zbuffer32); zbuffer = zbuffer32; } } assert(zbuffer); /* Now do the tests */ for (i = 0; i < count; i++) { if (mask[i]) { if (zbuffer[i] < zMin || zbuffer[i] > zMax) mask[i] = GL_FALSE; else anyPass = GL_TRUE; } } } return anyPass; } /**********************************************************************/ /***** Read Depth Buffer *****/ /**********************************************************************/ /** * Read a span of depth values from the depth buffer. * This function does clipping before calling the device driver function. * * XXXX this is no longer a swrast function!!! * */ void _swrast_read_depth_span( GLcontext *ctx, struct gl_renderbuffer *rb, GLint n, GLint x, GLint y, GLuint depth[] ) { if (y < 0 || y >= (GLint) rb->Height || x + (GLint) n <= 0 || x >= (GLint) rb->Width) { /* span is completely outside framebuffer */ GLint i; for (i = 0; i < n; i++) depth[i] = 0; return; } if (x < 0) { GLint dx = -x; GLint i; for (i = 0; i < dx; i++) depth[i] = 0; x = 0; n -= dx; depth += dx; } if (x + n > (GLint) rb->Width) { GLint dx = x + n - (GLint) rb->Width; GLint i; for (i = 0; i < dx; i++) depth[n - i - 1] = 0; n -= dx; } if (n <= 0) { return; } /* we'll always return 32-bit values to our caller */ if (!rb) { _mesa_bzero(depth, n * sizeof(GLuint)); } else if (rb->DataType == GL_UNSIGNED_INT) { rb->GetRow(ctx, rb, n, x, y, depth); } else { GLushort temp[MAX_WIDTH]; GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_SHORT); rb->GetRow(ctx, rb, n, x, y, temp); for (i = 0; i < n; i++) { depth[i] = temp[i]; } } } /** * Return a span of depth values from the depth buffer as floats in [0,1]. * Input: n - how many pixels * x,y - location of first pixel * Output: depth - the array of depth values */ void _swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb, GLint n, GLint x, GLint y, GLfloat depth[] ) { const GLfloat scale = 1.0F / ctx->DrawBuffer->_DepthMaxF; GLuint temp[MAX_WIDTH]; GLint i; assert(n <= MAX_WIDTH); _swrast_read_depth_span(ctx, rb, n, x, y, temp); for (i = 0; i < n; i++) { depth[i] = temp[i] * scale; } } /** * Clear the depth buffer. */ void _swrast_clear_depth_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) { GLuint clearValue; GLint x, y, width, height; if (!rb || !ctx->Depth.Mask) { /* no depth buffer, or writing to it is disabled */ return; } /* compute integer clearing value */ if (ctx->Depth.Clear == 1.0) { clearValue = ctx->DrawBuffer->_DepthMax; } else { clearValue = (GLuint) (ctx->Depth.Clear * ctx->DrawBuffer->_DepthMaxF); } assert(rb->_BaseFormat == GL_DEPTH_COMPONENT); /* compute region to clear */ x = ctx->DrawBuffer->_Xmin; y = ctx->DrawBuffer->_Ymin; width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; if (rb->GetPointer(ctx, rb, 0, 0)) { /* Direct buffer access is possible. Either this is just malloc'd * memory, or perhaps the driver mmap'd the zbuffer memory. */ if (rb->DataType == GL_UNSIGNED_SHORT) { if (width == rb->Width && (clearValue & 0xff) == ((clearValue >> 8) & 0xff)) { /* optimized case */ GLushort *dst = (GLushort *) rb->GetPointer(ctx, rb, x, y); GLuint len = width * height * sizeof(GLushort); _mesa_memset(dst, (clearValue & 0xff), len); } else { /* general case */ GLint i, j; for (i = 0; i < height; i++) { GLushort *dst = (GLushort *) rb->GetPointer(ctx, rb, x, y + i); for (j = 0; j < width; j++) { dst[j] = clearValue; } } } } else { GLint i, j; ASSERT(rb->DataType == GL_UNSIGNED_INT); for (i = 0; i < height; i++) { GLuint *dst = (GLuint *) rb->GetPointer(ctx, rb, x, y + i); for (j = 0; j < width; j++) { dst[j] = clearValue; } } } } else { /* Direct access not possible. Use PutRow to write new values. */ if (rb->DataType == GL_UNSIGNED_SHORT) { GLushort clearRow[MAX_WIDTH]; GLint i, j; for (j = 0; j < width; j++) { clearRow[j] = clearValue; } for (i = 0; i < height; i++) { rb->PutRow(ctx, rb, width, x, y + i, clearRow, NULL); } } else { GLuint clearRow[MAX_WIDTH]; GLint i, j; assert(rb->DataType == GL_UNSIGNED_INT); for (j = 0; j < width; j++) { clearRow[j] = clearValue; } for (i = 0; i < height; i++) { rb->PutRow(ctx, rb, width, x, y + i, clearRow, NULL); } } } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_depth.h0000644000000000000000000000345213614532424020343 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_DEPTH_H #define S_DEPTH_H #include "mtypes.h" #include "s_context.h" extern GLuint _swrast_depth_test_span( GLcontext *ctx, struct sw_span *span); extern GLboolean _swrast_depth_bounds_test( GLcontext *ctx, struct sw_span *span ); extern void _swrast_read_depth_span( GLcontext *ctx, struct gl_renderbuffer *rb, GLint n, GLint x, GLint y, GLuint depth[] ); extern void _swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb, GLint n, GLint x, GLint y, GLfloat depth[] ); extern void _swrast_clear_depth_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_drawpix.c0000644000000000000000000010427013614532424020710 0ustar /* * Mesa 3-D graphics library * Version: 6.4 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "bufferobj.h" #include "context.h" #include "convolve.h" #include "image.h" #include "macros.h" #include "imports.h" #include "pixel.h" #include "s_context.h" #include "s_drawpix.h" #include "s_pixeltex.h" #include "s_span.h" #include "s_stencil.h" #include "s_zoom.h" /* * Try to do a fast and simple RGB(a) glDrawPixels. * Return: GL_TRUE if success, GL_FALSE if slow path must be used instead */ static GLboolean fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels) { SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; struct sw_span span; INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); if (!ctx->Current.RasterPosValid) { return GL_TRUE; /* no-op */ } if (swrast->_RasterMask & MULTI_DRAW_BIT) return GL_FALSE; if (ctx->Depth.Test) _swrast_span_default_z(ctx, &span); if (swrast->_FogEnabled) _swrast_span_default_fog(ctx, &span); if (ctx->Texture._EnabledCoordUnits) _swrast_span_default_texcoords(ctx, &span); if ((SWRAST_CONTEXT(ctx)->_RasterMask & ~CLIP_BIT) == 0 && ctx->Texture._EnabledCoordUnits == 0 && unpack->Alignment == 1 && !unpack->SwapBytes && !unpack->LsbFirst) { GLint destX = x; GLint destY = y; GLint drawWidth = width; /* actual width drawn */ GLint drawHeight = height; /* actual height drawn */ GLint skipPixels = unpack->SkipPixels; GLint skipRows = unpack->SkipRows; GLint rowLength; GLint zoomY0 = 0; if (unpack->RowLength > 0) rowLength = unpack->RowLength; else rowLength = width; /* If we're not using pixel zoom then do all clipping calculations * now. Otherwise, we'll let the _swrast_write_zoomed_*_span() functions * handle the clipping. */ if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { /* horizontal clipping */ if (destX < ctx->DrawBuffer->_Xmin) { skipPixels += (ctx->DrawBuffer->_Xmin - destX); drawWidth -= (ctx->DrawBuffer->_Xmin - destX); destX = ctx->DrawBuffer->_Xmin; } if (destX + drawWidth > ctx->DrawBuffer->_Xmax) drawWidth -= (destX + drawWidth - ctx->DrawBuffer->_Xmax); if (drawWidth <= 0) return GL_TRUE; /* vertical clipping */ if (destY < ctx->DrawBuffer->_Ymin) { skipRows += (ctx->DrawBuffer->_Ymin - destY); drawHeight -= (ctx->DrawBuffer->_Ymin - destY); destY = ctx->DrawBuffer->_Ymin; } if (destY + drawHeight > ctx->DrawBuffer->_Ymax) drawHeight -= (destY + drawHeight - ctx->DrawBuffer->_Ymax); if (drawHeight <= 0) return GL_TRUE; } else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { /* upside-down image */ /* horizontal clipping */ if (destX < ctx->DrawBuffer->_Xmin) { skipPixels += (ctx->DrawBuffer->_Xmin - destX); drawWidth -= (ctx->DrawBuffer->_Xmin - destX); destX = ctx->DrawBuffer->_Xmin; } if (destX + drawWidth > ctx->DrawBuffer->_Xmax) drawWidth -= (destX + drawWidth - ctx->DrawBuffer->_Xmax); if (drawWidth <= 0) return GL_TRUE; /* vertical clipping */ if (destY > ctx->DrawBuffer->_Ymax) { skipRows += (destY - ctx->DrawBuffer->_Ymax); drawHeight -= (destY - ctx->DrawBuffer->_Ymax); destY = ctx->DrawBuffer->_Ymax; } if (destY - drawHeight < ctx->DrawBuffer->_Ymin) drawHeight -= (ctx->DrawBuffer->_Ymin - (destY - drawHeight)); if (drawHeight <= 0) return GL_TRUE; } else { if (drawWidth > MAX_WIDTH) return GL_FALSE; /* fall back to general case path */ /* save Y value of first row */ zoomY0 = IROUND(ctx->Current.RasterPos[1]); } /* * Ready to draw! * The window region at (destX, destY) of size (drawWidth, drawHeight) * will be written to. * We'll take pixel data from buffer pointed to by "pixels" but we'll * skip "skipRows" rows and skip "skipPixels" pixels/row. */ if (format == GL_RGBA && type == CHAN_TYPE && ctx->_ImageTransferState==0) { if (ctx->Visual.rgbMode) { GLchan *src = (GLchan *) pixels + (skipRows * rowLength + skipPixels) * 4; if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { /* no zooming */ GLint row; for (row=0; rowPutRow(ctx, rb, drawWidth, destX, destY, src, NULL); src += rowLength * 4; destY++; } } else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { /* upside-down */ GLint row; for (row=0; rowPutRow(ctx, rb, drawWidth, destX, destY, src, NULL); src += rowLength * 4; } } else { /* with zooming */ GLint row; for (row=0; row_ImageTransferState == 0) { if (ctx->Visual.rgbMode) { GLchan *src = (GLchan *) pixels + (skipRows * rowLength + skipPixels) * 3; if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { GLint row; for (row=0; rowPutRowRGB(ctx, rb, drawWidth, destX, destY, src, NULL); src += rowLength * 3; destY++; } } else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { /* upside-down */ GLint row; for (row=0; rowPutRowRGB(ctx, rb, drawWidth, destX, destY, src, NULL); src += rowLength * 3; } } else { /* with zooming */ GLint row; for (row=0; row_ImageTransferState==0) { if (ctx->Visual.rgbMode) { GLchan *src = (GLchan *) pixels + (skipRows * rowLength + skipPixels); if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { /* no zooming */ GLint row; ASSERT(drawWidth <= MAX_WIDTH); for (row=0; rowrgb[i][0] = src[i]; span.array->rgb[i][1] = src[i]; span.array->rgb[i][2] = src[i]; } rb->PutRowRGB(ctx, rb, drawWidth, destX, destY, span.array->rgb, NULL); src += rowLength; destY++; } } else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { /* upside-down */ GLint row; ASSERT(drawWidth <= MAX_WIDTH); for (row=0; rowrgb[i][0] = src[i]; span.array->rgb[i][1] = src[i]; span.array->rgb[i][2] = src[i]; } destY--; rb->PutRow(ctx, rb, drawWidth, destX, destY, span.array->rgb, NULL); src += rowLength; } } else { /* with zooming */ GLint row; ASSERT(drawWidth <= MAX_WIDTH); for (row=0; rowrgb[i][0] = src[i]; span.array->rgb[i][1] = src[i]; span.array->rgb[i][2] = src[i]; } span.x = destX; span.y = destY; span.end = drawWidth; _swrast_write_zoomed_rgb_span(ctx, &span, (CONST GLchan (*)[3]) span.array->rgb, zoomY0, 0); src += rowLength; destY++; } } } return GL_TRUE; } else if (format == GL_LUMINANCE_ALPHA && type == CHAN_TYPE && ctx->_ImageTransferState == 0) { if (ctx->Visual.rgbMode) { GLchan *src = (GLchan *) pixels + (skipRows * rowLength + skipPixels)*2; if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { /* no zooming */ GLint row; ASSERT(drawWidth <= MAX_WIDTH); for (row=0; rowrgba[i][0] = *ptr; span.array->rgba[i][1] = *ptr; span.array->rgba[i][2] = *ptr++; span.array->rgba[i][3] = *ptr++; } rb->PutRow(ctx, rb, drawWidth, destX, destY, span.array->rgba, NULL); src += rowLength*2; destY++; } } else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { /* upside-down */ GLint row; ASSERT(drawWidth <= MAX_WIDTH); for (row=0; rowrgba[i][0] = *ptr; span.array->rgba[i][1] = *ptr; span.array->rgba[i][2] = *ptr++; span.array->rgba[i][3] = *ptr++; } destY--; rb->PutRow(ctx, rb, drawWidth, destX, destY, span.array->rgba, NULL); src += rowLength*2; } } else { /* with zooming */ GLint row; ASSERT(drawWidth <= MAX_WIDTH); for (row=0; rowrgba[i][0] = *ptr; span.array->rgba[i][1] = *ptr; span.array->rgba[i][2] = *ptr++; span.array->rgba[i][3] = *ptr++; } span.x = destX; span.y = destY; span.end = drawWidth; _swrast_write_zoomed_rgba_span(ctx, &span, (CONST GLchan (*)[4]) span.array->rgba, zoomY0, 0); src += rowLength*2; destY++; } } } return GL_TRUE; } else if (format==GL_COLOR_INDEX && type==GL_UNSIGNED_BYTE) { GLubyte *src = (GLubyte *) pixels + skipRows * rowLength + skipPixels; if (ctx->Visual.rgbMode) { /* convert CI data to RGBA */ if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { /* no zooming */ GLint row; for (row=0; rowrgba); rb->PutRow(ctx, rb, drawWidth, destX, destY, span.array->rgba, NULL); src += rowLength; destY++; } return GL_TRUE; } else if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==-1.0F) { /* upside-down */ GLint row; for (row=0; rowrgba); destY--; rb->PutRow(ctx, rb, drawWidth, destX, destY, span.array->rgba, NULL); src += rowLength; } return GL_TRUE; } else { /* with zooming */ GLint row; for (row=0; rowrgba); span.x = destX; span.y = destY; span.end = drawWidth; _swrast_write_zoomed_rgba_span(ctx, &span, (CONST GLchan (*)[4]) span.array->rgba, zoomY0, 0); src += rowLength; destY++; } return GL_TRUE; } } else if (ctx->_ImageTransferState==0) { /* write CI data to CI frame buffer */ GLint row; if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) { /* no zooming */ for (row=0; rowPutRow(ctx, rb, drawWidth, destX, destY, index32, NULL); src += rowLength; destY++; } return GL_TRUE; } else { /* with zooming */ return GL_FALSE; } } } else { /* can't handle this pixel format and/or data type here */ return GL_FALSE; } } /* can't do a simple draw, have to use slow path */ return GL_FALSE; } /* * Draw color index image. */ static void draw_index_pixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; GLint row, skipPixels; struct sw_span span; INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX); if (ctx->Depth.Test) _swrast_span_default_z(ctx, &span); if (swrast->_FogEnabled) _swrast_span_default_fog(ctx, &span); /* * General solution */ skipPixels = 0; while (skipPixels < width) { const GLint spanX = x + (zoom ? 0 : skipPixels); GLint spanY = y; const GLint spanEnd = (width - skipPixels > MAX_WIDTH) ? MAX_WIDTH : (width - skipPixels); ASSERT(spanEnd <= MAX_WIDTH); for (row = 0; row < height; row++, spanY++) { const GLvoid *source = _mesa_image_address2d(unpack, pixels, width, height, GL_COLOR_INDEX, type, row, skipPixels); _mesa_unpack_index_span(ctx, spanEnd, GL_UNSIGNED_INT, span.array->index, type, source, unpack, ctx->_ImageTransferState); /* These may get changed during writing/clipping */ span.x = spanX; span.y = spanY; span.end = spanEnd; if (zoom) _swrast_write_zoomed_index_span(ctx, &span, y, skipPixels); else _swrast_write_index_span(ctx, &span); } skipPixels += spanEnd; } } /* * Draw stencil image. */ static void draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ) { const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; const GLint desty = y; GLint row, skipPixels; if (type != GL_BYTE && type != GL_UNSIGNED_BYTE && type != GL_SHORT && type != GL_UNSIGNED_SHORT && type != GL_INT && type != GL_UNSIGNED_INT && type != GL_FLOAT && type != GL_BITMAP) { _mesa_error( ctx, GL_INVALID_ENUM, "glDrawPixels(stencil type)"); return; } if (ctx->Visual.stencilBits == 0) { _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawPixels(no stencil buffer)"); return; } /* if width > MAX_WIDTH, have to process image in chunks */ skipPixels = 0; while (skipPixels < width) { const GLint spanX = x; GLint spanY = y; const GLint spanWidth = (width - skipPixels > MAX_WIDTH) ? MAX_WIDTH : (width - skipPixels); for (row = 0; row < height; row++, spanY++) { GLstencil values[MAX_WIDTH]; GLenum destType = (sizeof(GLstencil) == sizeof(GLubyte)) ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT; const GLvoid *source = _mesa_image_address2d(unpack, pixels, width, height, GL_COLOR_INDEX, type, row, skipPixels); _mesa_unpack_index_span(ctx, spanWidth, destType, values, type, source, unpack, ctx->_ImageTransferState); if (ctx->_ImageTransferState & IMAGE_SHIFT_OFFSET_BIT) { _mesa_shift_and_offset_stencil(ctx, spanWidth, values); } if (ctx->Pixel.MapStencilFlag) { _mesa_map_stencil(ctx, spanWidth, values); } if (zoom) { _swrast_write_zoomed_stencil_span(ctx, (GLuint) spanWidth, spanX, spanY, values, desty, 0); } else { _swrast_write_stencil_span(ctx, spanWidth, spanX, spanY, values); } } skipPixels += spanWidth; } } /* * Draw depth image. */ static void draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLboolean bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0; const GLint desty = y; struct sw_span span; INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z); if (type != GL_BYTE && type != GL_UNSIGNED_BYTE && type != GL_SHORT && type != GL_UNSIGNED_SHORT && type != GL_INT && type != GL_UNSIGNED_INT && type != GL_FLOAT) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawPixels(type)"); return; } _swrast_span_default_color(ctx, &span); if (swrast->_FogEnabled) _swrast_span_default_fog(ctx, &span); if (ctx->Texture._EnabledCoordUnits) _swrast_span_default_texcoords(ctx, &span); if (type == GL_UNSIGNED_SHORT && ctx->Visual.depthBits == 16 && !bias_or_scale && !zoom && ctx->Visual.rgbMode && width <= MAX_WIDTH) { /* Special case: directly write 16-bit depth values */ GLint row, spanY = y; for (row = 0; row < height; row++, spanY++) { const GLushort *zSrc = (const GLushort *) _mesa_image_address2d(unpack, pixels, width, height, GL_DEPTH_COMPONENT, type, row, 0); GLint i; for (i = 0; i < width; i++) span.array->z[i] = zSrc[i]; span.x = x; span.y = spanY; span.end = width; _swrast_write_rgba_span(ctx, &span); } } else if (type == GL_UNSIGNED_INT && sizeof(GLdepth) == 4 && !bias_or_scale && !zoom && ctx->Visual.rgbMode && width <= MAX_WIDTH) { /* Special case: shift 32-bit values down to ctx->Visual.depthBits */ const GLint shift = 32 - ctx->Visual.depthBits; GLint row, spanY = y; for (row = 0; row < height; row++, spanY++) { const GLuint *zSrc = (const GLuint *) _mesa_image_address2d(unpack, pixels, width, height, GL_DEPTH_COMPONENT, type, row, 0); if (shift == 0) { MEMCPY(span.array->z, zSrc, width * sizeof(GLdepth)); } else { GLint col; for (col = 0; col < width; col++) span.array->z[col] = zSrc[col] >> shift; } span.x = x; span.y = spanY; span.end = width; _swrast_write_rgba_span(ctx, &span); } } else { /* General case */ const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF; GLint row, skipPixels = 0; /* in case width > MAX_WIDTH do the copy in chunks */ while (skipPixels < width) { const GLint spanX = x + (zoom ? 0 : skipPixels); GLint spanY = y; const GLint spanEnd = (width - skipPixels > MAX_WIDTH) ? MAX_WIDTH : (width - skipPixels); ASSERT(span.end <= MAX_WIDTH); for (row = 0; row < height; row++, spanY++) { GLfloat floatSpan[MAX_WIDTH]; const GLvoid *zSrc = _mesa_image_address2d(unpack, pixels, width, height, GL_DEPTH_COMPONENT, type, row, skipPixels); /* Set these for each row since the _swrast_write_* function may * change them while clipping. */ span.x = spanX; span.y = spanY; span.end = spanEnd; _mesa_unpack_depth_span(ctx, span.end, floatSpan, type, zSrc, unpack); /* clamp depth values to [0,1] and convert from floats to ints */ { GLuint i; for (i = 0; i < span.end; i++) { span.array->z[i] = (GLdepth) (floatSpan[i] * depthMax); } } if (zoom) { _swrast_write_zoomed_depth_span(ctx, &span, desty, skipPixels); } else if (ctx->Visual.rgbMode) { _swrast_write_rgba_span(ctx, &span); } else { _swrast_write_index_span(ctx, &span); } } skipPixels += spanEnd; } } } /* * Draw RGBA image. */ static void draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_renderbuffer *rb = NULL; /* only used for quickDraw path */ const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; const GLint desty = y; GLboolean quickDraw; GLfloat *convImage = NULL; GLuint transferOps = ctx->_ImageTransferState; struct sw_span span; INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); if (!_mesa_is_legal_format_and_type(ctx, format, type)) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawPixels(format or type)"); return; } /* Try an optimized glDrawPixels first */ if (fast_draw_pixels(ctx, x, y, width, height, format, type, unpack, pixels)) return; if (ctx->Depth.Test) _swrast_span_default_z(ctx, &span); if (swrast->_FogEnabled) _swrast_span_default_fog(ctx, &span); if (ctx->Texture._EnabledCoordUnits) _swrast_span_default_texcoords(ctx, &span); if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0 && x + width <= (GLint) ctx->DrawBuffer->Width && y + height <= (GLint) ctx->DrawBuffer->Height && ctx->DrawBuffer->_NumColorDrawBuffers[0] == 1) { quickDraw = GL_TRUE; rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; } else { quickDraw = GL_FALSE; rb = NULL; } if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { /* Convolution has to be handled specially. We'll create an * intermediate image, applying all pixel transfer operations * up to convolution. Then we'll convolve the image. Then * we'll proceed with the rest of the transfer operations and * rasterize the image. */ GLint row; GLfloat *dest, *tmpImage; tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); if (!tmpImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels"); return; } convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); if (!convImage) { _mesa_free(tmpImage); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels"); return; } /* Unpack the image and apply transfer ops up to convolution */ dest = tmpImage; for (row = 0; row < height; row++) { const GLvoid *source = _mesa_image_address2d(unpack, pixels, width, height, format, type, row, 0); _mesa_unpack_color_span_float(ctx, width, GL_RGBA, (GLfloat *) dest, format, type, source, unpack, transferOps & IMAGE_PRE_CONVOLUTION_BITS); dest += width * 4; } /* do convolution */ if (ctx->Pixel.Convolution2DEnabled) { _mesa_convolve_2d_image(ctx, &width, &height, tmpImage, convImage); } else { ASSERT(ctx->Pixel.Separable2DEnabled); _mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage); } _mesa_free(tmpImage); /* continue transfer ops and draw the convolved image */ unpack = &ctx->DefaultPacking; pixels = convImage; format = GL_RGBA; type = GL_FLOAT; transferOps &= IMAGE_POST_CONVOLUTION_BITS; } /* * General solution */ { const GLuint interpMask = span.interpMask; const GLuint arrayMask = span.arrayMask; GLint row, skipPixels = 0; /* if the span is wider than MAX_WIDTH we have to do it in chunks */ while (skipPixels < width) { const GLint spanX = x + (zoom ? 0 : skipPixels); GLint spanY = y; const GLint spanEnd = (width - skipPixels > MAX_WIDTH) ? MAX_WIDTH : (width - skipPixels); ASSERT(span.end <= MAX_WIDTH); for (row = 0; row < height; row++, spanY++) { const GLvoid *source = _mesa_image_address2d(unpack, pixels, width, height, format, type, row, skipPixels); /* Set these for each row since the _swrast_write_* function may * change them while clipping. */ span.x = spanX; span.y = spanY; span.end = spanEnd; span.arrayMask = arrayMask; span.interpMask = interpMask; _mesa_unpack_color_span_chan(ctx, span.end, GL_RGBA, (GLchan *) span.array->rgba, format, type, source, unpack, transferOps); if ((ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink) || (ctx->Pixel.HistogramEnabled && ctx->Histogram.Sink)) continue; if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) { _swrast_pixel_texture(ctx, &span); } /* draw the span */ if (quickDraw) { rb->PutRow(ctx, rb, span.end, span.x, span.y, span.array->rgba, NULL); } else if (zoom) { _swrast_write_zoomed_rgba_span(ctx, &span, (CONST GLchan (*)[4]) span.array->rgba, desty, skipPixels); } else { _swrast_write_rgba_span(ctx, &span); } } skipPixels += spanEnd; } } if (convImage) { _mesa_free(convImage); } } /* * Execute glDrawPixels */ void _swrast_DrawPixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (swrast->NewState) _swrast_validate_derived( ctx ); if (unpack->BufferObj->Name) { /* unpack from PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, format, type, pixels)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(invalid PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, unpack->BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)"); return; } pixels = ADD_POINTERS(buf, pixels); } RENDER_START(swrast,ctx); switch (format) { case GL_STENCIL_INDEX: draw_stencil_pixels( ctx, x, y, width, height, type, unpack, pixels ); break; case GL_DEPTH_COMPONENT: draw_depth_pixels( ctx, x, y, width, height, type, unpack, pixels ); break; case GL_COLOR_INDEX: if (ctx->Visual.rgbMode) draw_rgba_pixels(ctx, x,y, width, height, format, type, unpack, pixels); else draw_index_pixels(ctx, x, y, width, height, type, unpack, pixels); break; case GL_RED: case GL_GREEN: case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: case GL_LUMINANCE_ALPHA: case GL_RGB: case GL_BGR: case GL_RGBA: case GL_BGRA: case GL_ABGR_EXT: draw_rgba_pixels(ctx, x, y, width, height, format, type, unpack, pixels); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glDrawPixels(format)" ); /* don't return yet, clean-up */ } RENDER_FINISH(swrast,ctx); if (unpack->BufferObj->Name) { /* done with PBO so unmap it now */ ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, unpack->BufferObj); } } #if 0 /* experimental */ /* * Execute glDrawDepthPixelsMESA(). */ void _swrast_DrawDepthPixelsMESA( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum colorFormat, GLenum colorType, const GLvoid *colors, GLenum depthType, const GLvoid *depths, const struct gl_pixelstore_attrib *unpack ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); if (swrast->NewState) _swrast_validate_derived( ctx ); RENDER_START(swrast,ctx); switch (colorFormat) { case GL_COLOR_INDEX: if (ctx->Visual.rgbMode) draw_rgba_pixels(ctx, x,y, width, height, colorFormat, colorType, unpack, colors); else draw_index_pixels(ctx, x, y, width, height, colorType, unpack, colors); break; case GL_RED: case GL_GREEN: case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: case GL_LUMINANCE_ALPHA: case GL_RGB: case GL_BGR: case GL_RGBA: case GL_BGRA: case GL_ABGR_EXT: draw_rgba_pixels(ctx, x, y, width, height, colorFormat, colorType, unpack, colors); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glDrawDepthPixelsMESA(colorFormat)" ); } RENDER_FINISH(swrast,ctx); } #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_drawpix.h0000644000000000000000000000242113614532424020710 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_DRAWPIXELS_H #define S_DRAWPIXELS_H #include "mtypes.h" #include "swrast.h" /* XXX kill this header? */ #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast_setup/ss_context.c0000644000000000000000000001535713614532424022330 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "imports.h" #include "colormac.h" #include "ss_context.h" #include "ss_triangle.h" #include "swrast_setup.h" #include "tnl/tnl.h" #include "tnl/t_context.h" #include "tnl/t_pipeline.h" #include "tnl/t_vertex.h" /* Need to check lighting state and vertex program state to know * if two-sided lighting is in effect. */ #define _SWSETUP_NEW_RENDERINDEX (_NEW_POLYGON|_NEW_LIGHT|_NEW_PROGRAM) GLboolean _swsetup_CreateContext( GLcontext *ctx ) { SScontext *swsetup = (SScontext *)CALLOC(sizeof(SScontext)); if (!swsetup) return GL_FALSE; ctx->swsetup_context = swsetup; swsetup->NewState = ~0; _swsetup_trifuncs_init( ctx ); _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12, sizeof(SWvertex) ); return GL_TRUE; } void _swsetup_DestroyContext( GLcontext *ctx ) { SScontext *swsetup = SWSETUP_CONTEXT(ctx); if (swsetup) { FREE(swsetup); ctx->swsetup_context = 0; } _tnl_free_vertices( ctx ); } static void _swsetup_RenderPrimitive( GLcontext *ctx, GLenum mode ) { SWSETUP_CONTEXT(ctx)->render_prim = mode; _swrast_render_primitive( ctx, mode ); } #define SWZ ((SWvertex *)0) #define SWOffset(MEMBER) (((char *)&(SWZ->MEMBER)) - ((char *)SWZ)) #define EMIT_ATTR( ATTR, STYLE, MEMBER ) \ do { \ map[e].attrib = (ATTR); \ map[e].format = (STYLE); \ map[e].offset = SWOffset(MEMBER); \ e++; \ } while (0) /* * We patch this function into tnl->Driver.Render.Start. * It's called when we start rendering a vertex buffer. */ static void _swsetup_RenderStart( GLcontext *ctx ) { SScontext *swsetup = SWSETUP_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; GLuint new_state = swsetup->NewState; if (new_state & _SWSETUP_NEW_RENDERINDEX) { _swsetup_choose_trifuncs( ctx ); } swsetup->NewState = 0; _swrast_render_start( ctx ); /* Important: */ VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr; if (tnl->render_inputs != swsetup->last_index) { GLuint index = tnl->render_inputs; struct tnl_attr_map map[_TNL_ATTRIB_MAX]; int i, e = 0; EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, win ); if (index & _TNL_BIT_COLOR0) EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4CHAN_4F_RGBA, color ); if (index & _TNL_BIT_COLOR1) EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4CHAN_4F_RGBA, specular); if (index & _TNL_BIT_FOG) EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F, fog); if (index & _TNL_BITS_TEX_ANY) { for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { if (index & _TNL_BIT_TEX(i)) { EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_4F, texcoord[i] ); } } } if (index & _TNL_BIT_INDEX) EMIT_ATTR( _TNL_ATTRIB_INDEX, EMIT_1F, index ); if (index & _TNL_BIT_POINTSIZE) EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, pointSize ); _tnl_install_attrs( ctx, map, e, ctx->Viewport._WindowMap.m, sizeof(SWvertex) ); swsetup->last_index = index; } } /* * We patch this function into tnl->Driver.Render.Finish. * It's called when we finish rendering a vertex buffer. */ static void _swsetup_RenderFinish( GLcontext *ctx ) { _swrast_render_finish( ctx ); } void _swsetup_InvalidateState( GLcontext *ctx, GLuint new_state ) { SScontext *swsetup = SWSETUP_CONTEXT(ctx); swsetup->NewState |= new_state; _tnl_invalidate_vertex_state( ctx, new_state ); } void _swsetup_Wakeup( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); SScontext *swsetup = SWSETUP_CONTEXT(ctx); tnl->Driver.Render.Start = _swsetup_RenderStart; tnl->Driver.Render.Finish = _swsetup_RenderFinish; tnl->Driver.Render.PrimitiveNotify = _swsetup_RenderPrimitive; tnl->Driver.Render.Interp = _tnl_interp; tnl->Driver.Render.CopyPV = _tnl_copy_pv; tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon; /* new */ tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine; /* new */ /* points */ /* line */ /* triangle */ /* quad */ tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts; tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts; tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple; tnl->Driver.Render.BuildVertices = _tnl_build_vertices; tnl->Driver.Render.Multipass = 0; _tnl_invalidate_vertices( ctx, ~0 ); _tnl_need_projected_coords( ctx, GL_TRUE ); _swsetup_InvalidateState( ctx, ~0 ); swsetup->verts = (SWvertex *)tnl->clipspace.vertex_buf; swsetup->last_index = 0; } /* Populate a swrast SWvertex from an attrib-style vertex. */ void _swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest ) { const GLfloat *m = ctx->Viewport._WindowMap.m; GLfloat tmp[4]; GLuint i; _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POS, tmp ); dest->win[0] = m[0] * tmp[0] + m[12]; dest->win[1] = m[5] * tmp[1] + m[13]; dest->win[2] = m[10] * tmp[2] + m[14]; dest->win[3] = tmp[3]; for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0+i, dest->texcoord[i] ); _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR0, tmp ); UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->color, tmp ); _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR1, tmp ); UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->specular, tmp ); _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_FOG, tmp ); dest->fog = tmp[0]; _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_INDEX, tmp ); dest->index = (GLuint) tmp[0]; _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POINTSIZE, tmp ); dest->pointSize = tmp[0]; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast_setup/ss_context.h0000644000000000000000000000300613614532424022321 0ustar /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #ifndef SS_CONTEXT_H #define SS_CONTEXT_H #include "mtypes.h" #include "swrast/swrast.h" #include "swrast_setup.h" typedef struct { GLuint NewState; GLenum render_prim; GLuint last_index; SWvertex *verts; } SScontext; #define SWSETUP_CONTEXT(ctx) ((SScontext *)ctx->swsetup_context) #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast_setup/ss_triangle.c0000644000000000000000000002132013614532424022434 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "colormac.h" #include "macros.h" #include "mtypes.h" #include "tnl/t_context.h" #include "ss_triangle.h" #include "ss_context.h" #define SS_RGBA_BIT 0x1 #define SS_OFFSET_BIT 0x2 #define SS_TWOSIDE_BIT 0x4 #define SS_UNFILLED_BIT 0x8 #define SS_MAX_TRIFUNC 0x10 static tnl_triangle_func tri_tab[SS_MAX_TRIFUNC]; static tnl_quad_func quad_tab[SS_MAX_TRIFUNC]; static void _swsetup_render_line_tri( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2, GLuint facing ) { SScontext *swsetup = SWSETUP_CONTEXT(ctx); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLubyte *ef = VB->EdgeFlag; SWvertex *verts = swsetup->verts; SWvertex *v0 = &verts[e0]; SWvertex *v1 = &verts[e1]; SWvertex *v2 = &verts[e2]; GLchan c[2][4]; GLchan s[2][4]; GLfloat i[2]; /* cull testing */ if (ctx->Polygon.CullFlag) { if (facing == 1 && ctx->Polygon.CullFaceMode != GL_FRONT) return; if (facing == 0 && ctx->Polygon.CullFaceMode != GL_BACK) return; } if (ctx->Light.ShadeModel == GL_FLAT) { COPY_CHAN4(c[0], v0->color); COPY_CHAN4(c[1], v1->color); COPY_CHAN4(s[0], v0->specular); COPY_CHAN4(s[1], v1->specular); i[0] = v0->index; i[1] = v1->index; COPY_CHAN4(v0->color, v2->color); COPY_CHAN4(v1->color, v2->color); COPY_CHAN4(v0->specular, v2->specular); COPY_CHAN4(v1->specular, v2->specular); v0->index = v2->index; v1->index = v2->index; } if (swsetup->render_prim == GL_POLYGON) { if (ef[e2]) _swrast_Line( ctx, v2, v0 ); if (ef[e0]) _swrast_Line( ctx, v0, v1 ); if (ef[e1]) _swrast_Line( ctx, v1, v2 ); } else { if (ef[e0]) _swrast_Line( ctx, v0, v1 ); if (ef[e1]) _swrast_Line( ctx, v1, v2 ); if (ef[e2]) _swrast_Line( ctx, v2, v0 ); } if (ctx->Light.ShadeModel == GL_FLAT) { COPY_CHAN4(v0->color, c[0]); COPY_CHAN4(v1->color, c[1]); COPY_CHAN4(v0->specular, s[0]); COPY_CHAN4(v1->specular, s[1]); v0->index = i[0]; v1->index = i[1]; } } static void _swsetup_render_point_tri( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2, GLuint facing ) { SScontext *swsetup = SWSETUP_CONTEXT(ctx); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLubyte *ef = VB->EdgeFlag; SWvertex *verts = swsetup->verts; SWvertex *v0 = &verts[e0]; SWvertex *v1 = &verts[e1]; SWvertex *v2 = &verts[e2]; GLchan c[2][4]; GLchan s[2][4]; GLfloat i[2]; /* cull testing */ if (ctx->Polygon.CullFlag) { if (facing == 1 && ctx->Polygon.CullFaceMode != GL_FRONT) return; if (facing == 0 && ctx->Polygon.CullFaceMode != GL_BACK) return; } if (ctx->Light.ShadeModel == GL_FLAT) { /* save colors/indexes for v0, v1 vertices */ COPY_CHAN4(c[0], v0->color); COPY_CHAN4(c[1], v1->color); COPY_CHAN4(s[0], v0->specular); COPY_CHAN4(s[1], v1->specular); i[0] = v0->index; i[1] = v1->index; /* copy v2 color/indexes to v0, v1 indexes */ COPY_CHAN4(v0->color, v2->color); COPY_CHAN4(v1->color, v2->color); COPY_CHAN4(v0->specular, v2->specular); COPY_CHAN4(v1->specular, v2->specular); v0->index = v2->index; v1->index = v2->index; } if (ef[e0]) _swrast_Point( ctx, v0 ); if (ef[e1]) _swrast_Point( ctx, v1 ); if (ef[e2]) _swrast_Point( ctx, v2 ); if (ctx->Light.ShadeModel == GL_FLAT) { /* restore v0, v1 colores/indexes */ COPY_CHAN4(v0->color, c[0]); COPY_CHAN4(v1->color, c[1]); COPY_CHAN4(v0->specular, s[0]); COPY_CHAN4(v1->specular, s[1]); v0->index = i[0]; v1->index = i[1]; } _swrast_flush(ctx); } #define SS_COLOR(a,b) UNCLAMPED_FLOAT_TO_RGBA_CHAN(a,b) #define SS_SPEC(a,b) UNCLAMPED_FLOAT_TO_RGB_CHAN(a,b) #define SS_IND(a,b) (a = b) #define IND (0) #define TAG(x) x #include "ss_tritmp.h" #define IND (SS_OFFSET_BIT) #define TAG(x) x##_offset #include "ss_tritmp.h" #define IND (SS_TWOSIDE_BIT) #define TAG(x) x##_twoside #include "ss_tritmp.h" #define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT) #define TAG(x) x##_offset_twoside #include "ss_tritmp.h" #define IND (SS_UNFILLED_BIT) #define TAG(x) x##_unfilled #include "ss_tritmp.h" #define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT) #define TAG(x) x##_offset_unfilled #include "ss_tritmp.h" #define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT) #define TAG(x) x##_twoside_unfilled #include "ss_tritmp.h" #define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT) #define TAG(x) x##_offset_twoside_unfilled #include "ss_tritmp.h" #define IND (0|SS_RGBA_BIT) #define TAG(x) x##_rgba #include "ss_tritmp.h" #define IND (SS_OFFSET_BIT|SS_RGBA_BIT) #define TAG(x) x##_offset_rgba #include "ss_tritmp.h" #define IND (SS_TWOSIDE_BIT|SS_RGBA_BIT) #define TAG(x) x##_twoside_rgba #include "ss_tritmp.h" #define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_RGBA_BIT) #define TAG(x) x##_offset_twoside_rgba #include "ss_tritmp.h" #define IND (SS_UNFILLED_BIT|SS_RGBA_BIT) #define TAG(x) x##_unfilled_rgba #include "ss_tritmp.h" #define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) #define TAG(x) x##_offset_unfilled_rgba #include "ss_tritmp.h" #define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) #define TAG(x) x##_twoside_unfilled_rgba #include "ss_tritmp.h" #define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) #define TAG(x) x##_offset_twoside_unfilled_rgba #include "ss_tritmp.h" void _swsetup_trifuncs_init( GLcontext *ctx ) { (void) ctx; init(); init_offset(); init_twoside(); init_offset_twoside(); init_unfilled(); init_offset_unfilled(); init_twoside_unfilled(); init_offset_twoside_unfilled(); init_rgba(); init_offset_rgba(); init_twoside_rgba(); init_offset_twoside_rgba(); init_unfilled_rgba(); init_offset_unfilled_rgba(); init_twoside_unfilled_rgba(); init_offset_twoside_unfilled_rgba(); } static void swsetup_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; GLuint i; if (VB->Elts) { for (i = first; i < last; i++) if (VB->ClipMask[VB->Elts[i]] == 0) _swrast_Point( ctx, &verts[VB->Elts[i]] ); } else { for (i = first; i < last; i++) if (VB->ClipMask[i] == 0) _swrast_Point( ctx, &verts[i] ); } } static void swsetup_line( GLcontext *ctx, GLuint v0, GLuint v1 ) { SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; _swrast_Line( ctx, &verts[v0], &verts[v1] ); } void _swsetup_choose_trifuncs( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint ind = 0; if (ctx->Polygon.OffsetPoint || ctx->Polygon.OffsetLine || ctx->Polygon.OffsetFill) ind |= SS_OFFSET_BIT; if ((ctx->Light.Enabled && ctx->Light.Model.TwoSide) || (ctx->VertexProgram._Enabled && ctx->VertexProgram.TwoSideEnabled)) ind |= SS_TWOSIDE_BIT; /* We piggyback the two-sided stencil front/back determination on the * unfilled triangle path. */ if (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL || (ctx->Stencil.Enabled && ctx->Stencil.TestTwoSide)) ind |= SS_UNFILLED_BIT; if (ctx->Visual.rgbMode) ind |= SS_RGBA_BIT; tnl->Driver.Render.Triangle = tri_tab[ind]; tnl->Driver.Render.Quad = quad_tab[ind]; tnl->Driver.Render.Line = swsetup_line; tnl->Driver.Render.Points = swsetup_points; ctx->_Facing = 0; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast_setup/ss_triangle.h0000644000000000000000000000262713614532424022452 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #ifndef SS_TRIANGLE_H #define SS_TRIANGLE_H #include "mtypes.h" #include "ss_context.h" void _swsetup_trifuncs_init( GLcontext *ctx ); void _swsetup_choose_trifuncs( GLcontext *ctx ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast_setup/ss_tritmp.h0000644000000000000000000001513413614532424022161 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; SWvertex *v[3]; GLfloat z[3]; GLfloat offset; GLenum mode = GL_FILL; GLuint facing = 0; GLchan saved_color[3][4]; GLchan saved_spec[3][4]; GLfloat saved_index[3]; v[0] = &verts[e0]; v[1] = &verts[e1]; v[2] = &verts[e2]; if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT)) { GLfloat ex = v[0]->win[0] - v[2]->win[0]; GLfloat ey = v[0]->win[1] - v[2]->win[1]; GLfloat fx = v[1]->win[0] - v[2]->win[0]; GLfloat fy = v[1]->win[1] - v[2]->win[1]; GLfloat cc = ex*fy - ey*fx; if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT)) { facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; if (ctx->Stencil.TestTwoSide) ctx->_Facing = facing; /* for 2-sided stencil test */ if (IND & SS_UNFILLED_BIT) mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode; if (facing == 1) { if (IND & SS_TWOSIDE_BIT) { if (IND & SS_RGBA_BIT) { GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->data; COPY_CHAN4(saved_color[0], v[0]->color); COPY_CHAN4(saved_color[1], v[1]->color); COPY_CHAN4(saved_color[2], v[2]->color); if (VB->ColorPtr[1]->stride) { SS_COLOR(v[0]->color, vbcolor[e0]); SS_COLOR(v[1]->color, vbcolor[e1]); SS_COLOR(v[2]->color, vbcolor[e2]); } else { SS_COLOR(v[0]->color, vbcolor[0]); SS_COLOR(v[1]->color, vbcolor[0]); SS_COLOR(v[2]->color, vbcolor[0]); } if (VB->SecondaryColorPtr[1]) { GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->data; COPY_CHAN4(saved_spec[0], v[0]->specular); COPY_CHAN4(saved_spec[1], v[1]->specular); COPY_CHAN4(saved_spec[2], v[2]->specular); if (VB->SecondaryColorPtr[1]->stride) { SS_SPEC(v[0]->specular, vbspec[e0]); SS_SPEC(v[1]->specular, vbspec[e1]); SS_SPEC(v[2]->specular, vbspec[e2]); } else { SS_SPEC(v[0]->specular, vbspec[0]); SS_SPEC(v[1]->specular, vbspec[0]); SS_SPEC(v[2]->specular, vbspec[0]); } } } else { GLfloat *vbindex = (GLfloat *)VB->IndexPtr[1]->data; saved_index[0] = v[0]->index; saved_index[1] = v[1]->index; saved_index[2] = v[2]->index; SS_IND(v[0]->index, (GLuint) vbindex[e0]); SS_IND(v[1]->index, (GLuint) vbindex[e1]); SS_IND(v[2]->index, (GLuint) vbindex[e2]); } } } } if (IND & SS_OFFSET_BIT) { offset = ctx->Polygon.OffsetUnits * ctx->DrawBuffer->_MRD; z[0] = v[0]->win[2]; z[1] = v[1]->win[2]; z[2] = v[2]->win[2]; if (cc * cc > 1e-16) { const GLfloat ez = z[0] - z[2]; const GLfloat fz = z[1] - z[2]; const GLfloat oneOverArea = 1.0F / cc; const GLfloat dzdx = FABSF((ey * fz - ez * fy) * oneOverArea); const GLfloat dzdy = FABSF((ez * fx - ex * fz) * oneOverArea); offset += MAX2(dzdx, dzdy) * ctx->Polygon.OffsetFactor; /* Unfortunately, we need to clamp to prevent negative Zs below. * Technically, we should do the clamping per-fragment. */ offset = MAX2(offset, -v[0]->win[2]); offset = MAX2(offset, -v[1]->win[2]); offset = MAX2(offset, -v[2]->win[2]); } } } if (mode == GL_POINT) { if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetPoint) { v[0]->win[2] += offset; v[1]->win[2] += offset; v[2]->win[2] += offset; } _swsetup_render_point_tri( ctx, e0, e1, e2, facing ); } else if (mode == GL_LINE) { if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) { v[0]->win[2] += offset; v[1]->win[2] += offset; v[2]->win[2] += offset; } _swsetup_render_line_tri( ctx, e0, e1, e2, facing ); } else { if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetFill) { v[0]->win[2] += offset; v[1]->win[2] += offset; v[2]->win[2] += offset; } _swrast_Triangle( ctx, v[0], v[1], v[2] ); } if (IND & SS_OFFSET_BIT) { v[0]->win[2] = z[0]; v[1]->win[2] = z[1]; v[2]->win[2] = z[2]; } if (IND & SS_TWOSIDE_BIT) { if (facing == 1) { if (IND & SS_RGBA_BIT) { COPY_CHAN4(v[0]->color, saved_color[0]); COPY_CHAN4(v[1]->color, saved_color[1]); COPY_CHAN4(v[2]->color, saved_color[2]); if (VB->SecondaryColorPtr[1]) { COPY_CHAN4(v[0]->specular, saved_spec[0]); COPY_CHAN4(v[1]->specular, saved_spec[1]); COPY_CHAN4(v[2]->specular, saved_spec[2]); } } else { v[0]->index = saved_index[0]; v[1]->index = saved_index[1]; v[2]->index = saved_index[2]; } } } } /* Need to fixup edgeflags when decomposing to triangles: */ static void TAG(quadfunc)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3 ) { if (IND & SS_UNFILLED_BIT) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLubyte ef1 = VB->EdgeFlag[v1]; GLubyte ef3 = VB->EdgeFlag[v3]; VB->EdgeFlag[v1] = 0; TAG(triangle)( ctx, v0, v1, v3 ); VB->EdgeFlag[v1] = ef1; VB->EdgeFlag[v3] = 0; TAG(triangle)( ctx, v1, v2, v3 ); VB->EdgeFlag[v3] = ef3; } else { TAG(triangle)( ctx, v0, v1, v3 ); TAG(triangle)( ctx, v1, v2, v3 ); } } static void TAG(init)( void ) { tri_tab[IND] = TAG(triangle); quad_tab[IND] = TAG(quadfunc); } #undef IND #undef TAG nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast_setup/swrast_setup.h0000644000000000000000000000414713614532424022702 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ /* Public interface to the swrast_setup module. This module provides * an implementation of the driver interface to t_vb_render.c, and uses * the software rasterizer (swrast) to perform actual rasterization. * * The internals of the implementation are private, but can be hooked * into tnl at any time (except between RenderStart/RenderEnd) by * calling _swsetup_Wakeup(). */ #ifndef SWRAST_SETUP_H #define SWRAST_SETUP_H #include "swrast/swrast.h" extern GLboolean _swsetup_CreateContext( GLcontext *ctx ); extern void _swsetup_DestroyContext( GLcontext *ctx ); extern void _swsetup_InvalidateState( GLcontext *ctx, GLuint new_state ); extern void _swsetup_Wakeup( GLcontext *ctx ); /* Helper function to translate a hardware vertex (as understood by * the tnl/t_vertex.c code) to a swrast vertex. */ extern void _swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_feedback.c0000644000000000000000000001115013614532424020750 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "enums.h" #include "feedback.h" #include "macros.h" #include "s_context.h" #include "s_feedback.h" #include "s_triangle.h" #define FB_3D 0x01 #define FB_4D 0x02 #define FB_INDEX 0x04 #define FB_COLOR 0x08 #define FB_TEXTURE 0X10 static void feedback_vertex( GLcontext *ctx, const SWvertex *v, const SWvertex *pv ) { const GLuint texUnit = 0; /* See section 5.3 of 1.2.1 spec */ GLfloat win[4]; GLfloat color[4]; GLfloat tc[4]; win[0] = v->win[0]; win[1] = v->win[1]; win[2] = v->win[2] / ctx->DrawBuffer->_DepthMaxF; win[3] = 1.0F / v->win[3]; color[0] = CHAN_TO_FLOAT(pv->color[0]); color[1] = CHAN_TO_FLOAT(pv->color[1]); color[2] = CHAN_TO_FLOAT(pv->color[2]); color[3] = CHAN_TO_FLOAT(pv->color[3]); if (v->texcoord[texUnit][3] != 1.0 && v->texcoord[texUnit][3] != 0.0) { GLfloat invq = 1.0F / v->texcoord[texUnit][3]; tc[0] = v->texcoord[texUnit][0] * invq; tc[1] = v->texcoord[texUnit][1] * invq; tc[2] = v->texcoord[texUnit][2] * invq; tc[3] = v->texcoord[texUnit][3]; } else { COPY_4V(tc, v->texcoord[texUnit]); } _mesa_feedback_vertex( ctx, win, color, (GLfloat) v->index, tc ); } /* * Put triangle in feedback buffer. */ void _swrast_feedback_triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { if (_swrast_culltriangle( ctx, v0, v1, v2 )) { FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN ); FEEDBACK_TOKEN( ctx, (GLfloat) 3 ); /* three vertices */ if (ctx->Light.ShadeModel == GL_SMOOTH) { feedback_vertex( ctx, v0, v0 ); feedback_vertex( ctx, v1, v1 ); feedback_vertex( ctx, v2, v2 ); } else { feedback_vertex( ctx, v0, v2 ); feedback_vertex( ctx, v1, v2 ); feedback_vertex( ctx, v2, v2 ); } } } void _swrast_feedback_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) { GLenum token = GL_LINE_TOKEN; SWcontext *swrast = SWRAST_CONTEXT(ctx); if (swrast->StippleCounter==0) token = GL_LINE_RESET_TOKEN; FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) token ); if (ctx->Light.ShadeModel == GL_SMOOTH) { feedback_vertex( ctx, v0, v0 ); feedback_vertex( ctx, v1, v1 ); } else { feedback_vertex( ctx, v0, v1 ); feedback_vertex( ctx, v1, v1 ); } swrast->StippleCounter++; } void _swrast_feedback_point( GLcontext *ctx, const SWvertex *v ) { FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POINT_TOKEN ); feedback_vertex( ctx, v, v ); } void _swrast_select_triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { if (_swrast_culltriangle( ctx, v0, v1, v2 )) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; _mesa_update_hitflag( ctx, v0->win[2] * zs ); _mesa_update_hitflag( ctx, v1->win[2] * zs ); _mesa_update_hitflag( ctx, v2->win[2] * zs ); } } void _swrast_select_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; _mesa_update_hitflag( ctx, v0->win[2] * zs ); _mesa_update_hitflag( ctx, v1->win[2] * zs ); } void _swrast_select_point( GLcontext *ctx, const SWvertex *v ) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; _mesa_update_hitflag( ctx, v->win[2] * zs ); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_feedback.h0000644000000000000000000000364313614532424020765 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_FEEDBACK_H #define S_FEEDBACK_H #include "mtypes.h" #include "swrast.h" extern void _swrast_feedback_point( GLcontext *ctx, const SWvertex *v ); extern void _swrast_feedback_line( GLcontext *ctx, const SWvertex *v1, const SWvertex *v2 ); extern void _swrast_feedback_triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ); extern void _swrast_select_point( GLcontext *ctx, const SWvertex *v ); extern void _swrast_select_line( GLcontext *ctx, const SWvertex *v1, const SWvertex *v2 ); extern void _swrast_select_triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_fog.c0000644000000000000000000002736613614532424020017 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "macros.h" #include "s_context.h" #include "s_fog.h" #include "s_span.h" /** * Used to convert current raster distance to a fog factor in [0,1]. */ GLfloat _swrast_z_to_fogfactor(GLcontext *ctx, GLfloat z) { GLfloat d, f; switch (ctx->Fog.Mode) { case GL_LINEAR: if (ctx->Fog.Start == ctx->Fog.End) d = 1.0F; else d = 1.0F / (ctx->Fog.End - ctx->Fog.Start); f = (ctx->Fog.End - z) * d; return CLAMP(f, 0.0F, 1.0F); case GL_EXP: d = ctx->Fog.Density; f = (GLfloat) exp(-d * z); f = CLAMP(f, 0.0F, 1.0F); return f; case GL_EXP2: d = ctx->Fog.Density; f = (GLfloat) exp(-(d * d * z * z)); f = CLAMP(f, 0.0F, 1.0F); return f; default: _mesa_problem(ctx, "Bad fog mode in _swrast_z_to_fogfactor"); return 0.0; } } /** * Apply fog to a span of RGBA pixels. * The fog value are either in the span->array->fog array or interpolated from * the fog/fogStep values. * They fog values are either fog coordinates (Z) or fog blend factors. * _PreferPixelFog should be in sync with that state! */ void _swrast_fog_rgba_span( const GLcontext *ctx, struct sw_span *span ) { const SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLchan rFog = swrast->_FogColor[RCOMP]; const GLchan gFog = swrast->_FogColor[GCOMP]; const GLchan bFog = swrast->_FogColor[BCOMP]; const GLuint haveW = (span->interpMask & SPAN_W); GLchan (*rgba)[4] = (GLchan (*)[4]) span->array->rgba; ASSERT(swrast->_FogEnabled); ASSERT((span->interpMask | span->arrayMask) & SPAN_FOG); ASSERT(span->arrayMask & SPAN_RGBA); /* NOTE: if haveW is true, that means the fog start/step values are * perspective-corrected and we have to divide each fog coord by W. */ /* we need to compute fog blend factors */ if (swrast->_PreferPixelFog) { /* The span's fog values are fog coordinates, now compute blend factors * and blend the fragment colors with the fog color. */ switch (swrast->_FogMode) { case GL_LINEAR: { const GLfloat fogEnd = ctx->Fog.End; const GLfloat fogScale = (ctx->Fog.Start == ctx->Fog.End) ? 1.0F : 1.0F / (ctx->Fog.End - ctx->Fog.Start); const GLfloat fogStep = span->fogStep; GLfloat fogCoord = span->fog; const GLfloat wStep = haveW ? span->dwdx : 0.0F; GLfloat w = haveW ? span->w : 1.0F; GLuint i; for (i = 0; i < span->end; i++) { GLfloat f, oneMinusF; f = (fogEnd - FABSF(fogCoord) / w) * fogScale; f = CLAMP(f, 0.0F, 1.0F); oneMinusF = 1.0F - f; rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + oneMinusF * rFog); rgba[i][GCOMP] = (GLchan) (f * rgba[i][GCOMP] + oneMinusF * gFog); rgba[i][BCOMP] = (GLchan) (f * rgba[i][BCOMP] + oneMinusF * bFog); fogCoord += fogStep; w += wStep; } } break; case GL_EXP: { const GLfloat density = -ctx->Fog.Density; const GLfloat fogStep = span->fogStep; GLfloat fogCoord = span->fog; const GLfloat wStep = haveW ? span->dwdx : 0.0F; GLfloat w = haveW ? span->w : 1.0F; GLuint i; for (i = 0; i < span->end; i++) { GLfloat f, oneMinusF; f = (GLfloat) exp(density * FABSF(fogCoord) / w); f = CLAMP(f, 0.0F, 1.0F); oneMinusF = 1.0F - f; rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + oneMinusF * rFog); rgba[i][GCOMP] = (GLchan) (f * rgba[i][GCOMP] + oneMinusF * gFog); rgba[i][BCOMP] = (GLchan) (f * rgba[i][BCOMP] + oneMinusF * bFog); fogCoord += fogStep; w += wStep; } } break; case GL_EXP2: { const GLfloat negDensitySquared = -ctx->Fog.Density * ctx->Fog.Density; const GLfloat fogStep = span->fogStep; GLfloat fogCoord = span->fog; const GLfloat wStep = haveW ? span->dwdx : 0.0F; GLfloat w = haveW ? span->w : 1.0F; GLuint i; for (i = 0; i < span->end; i++) { const GLfloat coord = fogCoord / w; GLfloat tmp = negDensitySquared * coord * coord; GLfloat f, oneMinusF; #if defined(__alpha__) || defined(__alpha) /* XXX this underflow check may be needed for other systems*/ if (tmp < FLT_MIN_10_EXP) tmp = FLT_MIN_10_EXP; #endif f = (GLfloat) exp(tmp); f = CLAMP(f, 0.0F, 1.0F); oneMinusF = 1.0F - f; rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + oneMinusF * rFog); rgba[i][GCOMP] = (GLchan) (f * rgba[i][GCOMP] + oneMinusF * gFog); rgba[i][BCOMP] = (GLchan) (f * rgba[i][BCOMP] + oneMinusF * bFog); fogCoord += fogStep; w += wStep; } } break; default: _mesa_problem(ctx, "Bad fog mode in _swrast_fog_rgba_span"); return; } } else if (span->arrayMask & SPAN_FOG) { /* The span's fog array values are blend factors. * They were previously computed per-vertex. */ GLuint i; for (i = 0; i < span->end; i++) { const GLfloat f = span->array->fog[i]; const GLfloat oneMinusF = 1.0F - f; rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + oneMinusF * rFog); rgba[i][GCOMP] = (GLchan) (f * rgba[i][GCOMP] + oneMinusF * gFog); rgba[i][BCOMP] = (GLchan) (f * rgba[i][BCOMP] + oneMinusF * bFog); } } else { /* The span's fog start/step values are blend factors. * They were previously computed per-vertex. */ const GLfloat fogStep = span->fogStep; GLfloat fog = span->fog; const GLfloat wStep = haveW ? span->dwdx : 0.0F; GLfloat w = haveW ? span->w : 1.0F; GLuint i; ASSERT(span->interpMask & SPAN_FOG); for (i = 0; i < span->end; i++) { const GLfloat fact = fog / w; const GLfloat oneMinusF = 1.0F - fact; rgba[i][RCOMP] = (GLchan) (fact * rgba[i][RCOMP] + oneMinusF * rFog); rgba[i][GCOMP] = (GLchan) (fact * rgba[i][GCOMP] + oneMinusF * gFog); rgba[i][BCOMP] = (GLchan) (fact * rgba[i][BCOMP] + oneMinusF * bFog); fog += fogStep; w += wStep; } } } /** * As above, but color index mode. */ void _swrast_fog_ci_span( const GLcontext *ctx, struct sw_span *span ) { const SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLuint haveW = (span->interpMask & SPAN_W); const GLuint fogIndex = (GLuint) ctx->Fog.Index; GLuint *index = span->array->index; ASSERT(swrast->_FogEnabled); ASSERT(span->arrayMask & SPAN_INDEX); ASSERT((span->interpMask | span->arrayMask) & SPAN_FOG); /* we need to compute fog blend factors */ if (swrast->_PreferPixelFog) { /* The span's fog values are fog coordinates, now compute blend factors * and blend the fragment colors with the fog color. */ switch (ctx->Fog.Mode) { case GL_LINEAR: { const GLfloat fogEnd = ctx->Fog.End; const GLfloat fogScale = (ctx->Fog.Start == ctx->Fog.End) ? 1.0F : 1.0F / (ctx->Fog.End - ctx->Fog.Start); const GLfloat fogStep = span->fogStep; GLfloat fogCoord = span->fog; const GLfloat wStep = haveW ? span->dwdx : 0.0F; GLfloat w = haveW ? span->w : 1.0F; GLuint i; for (i = 0; i < span->end; i++) { GLfloat f = (fogEnd - fogCoord / w) * fogScale; f = CLAMP(f, 0.0F, 1.0F); index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex); fogCoord += fogStep; w += wStep; } } break; case GL_EXP: { const GLfloat density = -ctx->Fog.Density; const GLfloat fogStep = span->fogStep; GLfloat fogCoord = span->fog; const GLfloat wStep = haveW ? span->dwdx : 0.0F; GLfloat w = haveW ? span->w : 1.0F; GLuint i; for (i = 0; i < span->end; i++) { GLfloat f = (GLfloat) exp(density * fogCoord / w); f = CLAMP(f, 0.0F, 1.0F); index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex); fogCoord += fogStep; w += wStep; } } break; case GL_EXP2: { const GLfloat negDensitySquared = -ctx->Fog.Density * ctx->Fog.Density; const GLfloat fogStep = span->fogStep; GLfloat fogCoord = span->fog; const GLfloat wStep = haveW ? span->dwdx : 0.0F; GLfloat w = haveW ? span->w : 1.0F; GLuint i; for (i = 0; i < span->end; i++) { const GLfloat coord = fogCoord / w; GLfloat tmp = negDensitySquared * coord * coord; GLfloat f; #if defined(__alpha__) || defined(__alpha) /* XXX this underflow check may be needed for other systems*/ if (tmp < FLT_MIN_10_EXP) tmp = FLT_MIN_10_EXP; #endif f = (GLfloat) exp(tmp); f = CLAMP(f, 0.0F, 1.0F); index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex); fogCoord += fogStep; w += wStep; } } break; default: _mesa_problem(ctx, "Bad fog mode in _swrast_fog_ci_span"); return; } } else if (span->arrayMask & SPAN_FOG) { /* The span's fog array values are blend factors. * They were previously computed per-vertex. */ GLuint i; for (i = 0; i < span->end; i++) { const GLfloat f = span->array->fog[i]; index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex); } } else { /* The span's fog start/step values are blend factors. * They were previously computed per-vertex. */ const GLfloat fogStep = span->fogStep; GLfloat fog = span->fog; const GLfloat wStep = haveW ? span->dwdx : 0.0F; GLfloat w = haveW ? span->w : 1.0F; GLuint i; ASSERT(span->interpMask & SPAN_FOG); for (i = 0; i < span->end; i++) { const GLfloat f = fog / w; index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex); fog += fogStep; w += wStep; } } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_fog.h0000644000000000000000000000271513614532424020013 0ustar /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_FOG_H #define S_FOG_H #include "mtypes.h" #include "swrast.h" extern GLfloat _swrast_z_to_fogfactor(GLcontext *ctx, GLfloat z); extern void _swrast_fog_rgba_span( const GLcontext *ctx, struct sw_span *span ); extern void _swrast_fog_ci_span( const GLcontext *ctx, struct sw_span *span ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_imaging.c0000644000000000000000000001431313614532424020643 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* KW: Moved these here to remove knowledge of swrast from core mesa. * Should probably pull the entire software implementation of these * extensions into either swrast or a sister module. */ #include "s_context.h" #include "s_span.h" #include "colortab.h" #include "convolve.h" void _swrast_CopyColorTable( GLcontext *ctx, GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { GLchan data[MAX_WIDTH][4]; struct gl_buffer_object *bufferSave; if (!ctx->ReadBuffer->_ColorReadBuffer) { /* no readbuffer - OK */ return; } /* Select buffer to read from */ _swrast_use_read_buffer(ctx); if (width > MAX_WIDTH) width = MAX_WIDTH; /* read the data from framebuffer */ _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, width, x, y, data ); /* Restore reading from draw buffer (the default) */ _swrast_use_draw_buffer(ctx); /* save PBO binding */ bufferSave = ctx->Unpack.BufferObj; ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; _mesa_ColorTable(target, internalformat, width, GL_RGBA, CHAN_TYPE, data); /* restore PBO binding */ ctx->Unpack.BufferObj = bufferSave; } void _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { GLchan data[MAX_WIDTH][4]; struct gl_buffer_object *bufferSave; if (!ctx->ReadBuffer->_ColorReadBuffer) { /* no readbuffer - OK */ return; } /* Select buffer to read from */ _swrast_use_read_buffer(ctx); if (width > MAX_WIDTH) width = MAX_WIDTH; /* read the data from framebuffer */ _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, width, x, y, data ); /* Restore reading from draw buffer (the default) */ _swrast_use_draw_buffer(ctx); /* save PBO binding */ bufferSave = ctx->Unpack.BufferObj; ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; _mesa_ColorSubTable(target, start, width, GL_RGBA, CHAN_TYPE, data); /* restore PBO binding */ ctx->Unpack.BufferObj = bufferSave; } void _swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLchan rgba[MAX_CONVOLUTION_WIDTH][4]; struct gl_buffer_object *bufferSave; if (!ctx->ReadBuffer->_ColorReadBuffer) { /* no readbuffer - OK */ return; } /* Select buffer to read from */ _swrast_use_read_buffer(ctx); RENDER_START( swrast, ctx ); /* read the data from framebuffer */ _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, width, x, y, (GLchan (*)[4]) rgba ); RENDER_FINISH( swrast, ctx ); /* Restore reading from draw buffer (the default) */ _swrast_use_draw_buffer(ctx); /* save PBO binding */ bufferSave = ctx->Unpack.BufferObj; ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; /* store as convolution filter */ _mesa_ConvolutionFilter1D(target, internalFormat, width, GL_RGBA, CHAN_TYPE, rgba); /* restore PBO binding */ ctx->Unpack.BufferObj = bufferSave; } void _swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height) { SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_pixelstore_attrib packSave; GLchan rgba[MAX_CONVOLUTION_HEIGHT][MAX_CONVOLUTION_WIDTH][4]; GLint i; struct gl_buffer_object *bufferSave; if (!ctx->ReadBuffer->_ColorReadBuffer) { /* no readbuffer - OK */ return; } /* Select buffer to read from */ _swrast_use_read_buffer(ctx); RENDER_START(swrast,ctx); /* read pixels from framebuffer */ for (i = 0; i < height; i++) { _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, width, x, y + i, (GLchan (*)[4]) rgba[i] ); } RENDER_FINISH(swrast,ctx); /* Restore reading from draw buffer (the default) */ _swrast_use_draw_buffer(ctx); /* * HACK: save & restore context state so we can store this as a * convolution filter via the GL api. Doesn't call any callbacks * hanging off ctx->Unpack statechanges. */ packSave = ctx->Unpack; /* save pixel packing params */ ctx->Unpack.Alignment = 1; ctx->Unpack.RowLength = MAX_CONVOLUTION_WIDTH; ctx->Unpack.SkipPixels = 0; ctx->Unpack.SkipRows = 0; ctx->Unpack.ImageHeight = 0; ctx->Unpack.SkipImages = 0; ctx->Unpack.SwapBytes = GL_FALSE; ctx->Unpack.LsbFirst = GL_FALSE; ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; ctx->NewState |= _NEW_PACKUNPACK; /* save PBO binding */ bufferSave = ctx->Unpack.BufferObj; ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; _mesa_ConvolutionFilter2D(target, internalFormat, width, height, GL_RGBA, CHAN_TYPE, rgba); /* restore PBO binding */ ctx->Unpack.BufferObj = bufferSave; ctx->Unpack = packSave; /* restore pixel packing params */ ctx->NewState |= _NEW_PACKUNPACK; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_lines.c0000644000000000000000000002226013614532424020342 0ustar /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "context.h" #include "colormac.h" #include "macros.h" #include "nvfragprog.h" #include "s_aaline.h" #include "s_context.h" #include "s_depth.h" #include "s_feedback.h" #include "s_lines.h" #include "s_span.h" /* * Init the mask[] array to implement a line stipple. */ static void compute_stipple_mask( GLcontext *ctx, GLuint len, GLubyte mask[] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint i; for (i = 0; i < len; i++) { GLuint bit = (swrast->StippleCounter / ctx->Line.StippleFactor) & 0xf; if ((1 << bit) & ctx->Line.StipplePattern) { mask[i] = GL_TRUE; } else { mask[i] = GL_FALSE; } swrast->StippleCounter++; } } /* * To draw a wide line we can simply redraw the span N times, side by side. */ static void draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor ) { GLint width, start; ASSERT(span->end < MAX_WIDTH); width = (GLint) CLAMP( ctx->Line._Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH ); if (width & 1) start = width / 2; else start = width / 2 - 1; if (xMajor) { GLint *y = span->array->y; GLuint i; GLint w; for (w = 0; w < width; w++) { if (w == 0) { for (i = 0; i < span->end; i++) y[i] -= start; } else { for (i = 0; i < span->end; i++) y[i]++; } if (ctx->Visual.rgbMode) _swrast_write_rgba_span(ctx, span); else _swrast_write_index_span(ctx, span); } } else { GLint *x = span->array->x; GLuint i; GLint w; for (w = 0; w < width; w++) { if (w == 0) { for (i = 0; i < span->end; i++) x[i] -= start; } else { for (i = 0; i < span->end; i++) x[i]++; } if (ctx->Visual.rgbMode) _swrast_write_rgba_span(ctx, span); else _swrast_write_index_span(ctx, span); } } } /**********************************************************************/ /***** Rasterization *****/ /**********************************************************************/ /* Simple color index line (no stipple, width=1, no Z, no fog, no tex)*/ #define NAME simple_ci_line #define INTERP_INDEX #define RENDER_SPAN(span) _swrast_write_index_span(ctx, &span) #include "s_linetemp.h" /* Simple RGBA index line (no stipple, width=1, no Z, no fog, no tex)*/ #define NAME simple_rgba_line #define INTERP_RGBA #define RENDER_SPAN(span) _swrast_write_rgba_span(ctx, &span); #include "s_linetemp.h" /* Z, fog, wide, stipple color index line */ #define NAME general_ci_line #define INTERP_INDEX #define INTERP_Z #define INTERP_FOG #define RENDER_SPAN(span) \ if (ctx->Line.StippleFlag) { \ span.arrayMask |= SPAN_MASK; \ compute_stipple_mask(ctx, span.end, span.array->mask); \ } \ if (ctx->Line._Width > 1.0) { \ draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ } \ else { \ _swrast_write_index_span(ctx, &span); \ } #include "s_linetemp.h" /* Z, fog, wide, stipple RGBA line */ #define NAME general_rgba_line #define INTERP_RGBA #define INTERP_Z #define INTERP_FOG #define RENDER_SPAN(span) \ if (ctx->Line.StippleFlag) { \ span.arrayMask |= SPAN_MASK; \ compute_stipple_mask(ctx, span.end, span.array->mask); \ } \ if (ctx->Line._Width > 1.0) { \ draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ } \ else { \ _swrast_write_rgba_span(ctx, &span); \ } #include "s_linetemp.h" /* Single-texture line, w/ fog, Z, specular, etc. */ #define NAME textured_line #define INTERP_RGBA #define INTERP_Z #define INTERP_FOG #define INTERP_TEX #define RENDER_SPAN(span) \ if (ctx->Line.StippleFlag) { \ span.arrayMask |= SPAN_MASK; \ compute_stipple_mask(ctx, span.end, span.array->mask); \ } \ if (ctx->Line._Width > 1.0) { \ draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ } \ else { \ _swrast_write_rgba_span(ctx, &span); \ } #include "s_linetemp.h" /* Multi-texture or separate specular line, w/ fog, Z, specular, etc. */ #define NAME multitextured_line #define INTERP_RGBA #define INTERP_SPEC #define INTERP_Z #define INTERP_FOG #define INTERP_MULTITEX #define RENDER_SPAN(span) \ if (ctx->Line.StippleFlag) { \ span.arrayMask |= SPAN_MASK; \ compute_stipple_mask(ctx, span.end, span.array->mask); \ } \ if (ctx->Line._Width > 1.0) { \ draw_wide_line(ctx, &span, (GLboolean)(dx > dy)); \ } \ else { \ _swrast_write_rgba_span(ctx, &span); \ } #include "s_linetemp.h" void _swrast_add_spec_terms_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) { SWvertex *ncv0 = (SWvertex *)v0; SWvertex *ncv1 = (SWvertex *)v1; GLchan c[2][4]; COPY_CHAN4( c[0], ncv0->color ); COPY_CHAN4( c[1], ncv1->color ); ACC_3V( ncv0->color, ncv0->specular ); ACC_3V( ncv1->color, ncv1->specular ); SWRAST_CONTEXT(ctx)->SpecLine( ctx, ncv0, ncv1 ); COPY_CHAN4( ncv0->color, c[0] ); COPY_CHAN4( ncv1->color, c[1] ); } #ifdef DEBUG extern void _mesa_print_line_function(GLcontext *ctx); /* silence compiler warning */ void _mesa_print_line_function(GLcontext *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); _mesa_printf("Line Func == "); if (swrast->Line == simple_ci_line) _mesa_printf("simple_ci_line\n"); else if (swrast->Line == simple_rgba_line) _mesa_printf("simple_rgba_line\n"); else if (swrast->Line == general_ci_line) _mesa_printf("general_ci_line\n"); else if (swrast->Line == general_rgba_line) _mesa_printf("general_rgba_line\n"); else if (swrast->Line == textured_line) _mesa_printf("textured_line\n"); else if (swrast->Line == multitextured_line) _mesa_printf("multitextured_line\n"); else _mesa_printf("Driver func %p\n", (void *(*)()) swrast->Line); } #endif #ifdef DEBUG /* record the current line function name */ static const char *lineFuncName = NULL; #define USE(lineFunc) \ do { \ lineFuncName = #lineFunc; \ /*_mesa_printf("%s\n", lineFuncName);*/ \ swrast->Line = lineFunc; \ } while (0) #else #define USE(lineFunc) swrast->Line = lineFunc #endif /* * Determine which line drawing function to use given the current * rendering context. * * Please update the summary flag _SWRAST_NEW_LINE if you add or remove * tests to this code. */ void _swrast_choose_line( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLboolean rgbmode = ctx->Visual.rgbMode; if (ctx->RenderMode == GL_RENDER) { if (ctx->Line.SmoothFlag) { /* antialiased lines */ _swrast_choose_aa_line_function(ctx); ASSERT(swrast->Line); } else if (ctx->Texture._EnabledCoordUnits) { /* textured lines */ if (ctx->Texture._EnabledCoordUnits > 0x1 || NEED_SECONDARY_COLOR(ctx)) { /* multi-texture and/or separate specular color */ USE(multitextured_line); } else { USE(textured_line); } } else if (ctx->Depth.Test || swrast->_FogEnabled || ctx->Line._Width != 1.0 || ctx->Line.StippleFlag) { /* no texture, but Z, fog, width>1, stipple, etc. */ if (rgbmode) USE(general_rgba_line); else USE(general_ci_line); } else { /* simplest lines */ if (rgbmode) USE(simple_rgba_line); else USE(simple_ci_line); } } else if (ctx->RenderMode == GL_FEEDBACK) { USE(_swrast_feedback_line); } else { ASSERT(ctx->RenderMode == GL_SELECT); USE(_swrast_select_line); } /*_mesa_print_line_function(ctx);*/ } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_lines.h0000644000000000000000000000256013614532424020350 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_LINES_H #define S_LINES_H #include "mtypes.h" void _swrast_choose_line( GLcontext *ctx ); void _swrast_add_spec_terms_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_linetemp.h0000644000000000000000000003336213614532424021057 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Line Rasterizer Template * * This file is #include'd to generate custom line rasterizers. * * The following macros may be defined to indicate what auxillary information * must be interplated along the line: * INTERP_Z - if defined, interpolate Z values * INTERP_FOG - if defined, interpolate FOG values * INTERP_RGBA - if defined, interpolate RGBA values * INTERP_SPEC - if defined, interpolate specular RGB values * INTERP_INDEX - if defined, interpolate color index values * INTERP_TEX - if defined, interpolate unit 0 texcoords * INTERP_MULTITEX - if defined, interpolate multi-texcoords * * When one can directly address pixels in the color buffer the following * macros can be defined and used to directly compute pixel addresses during * rasterization (see pixelPtr): * PIXEL_TYPE - the datatype of a pixel (GLubyte, GLushort, GLuint) * BYTES_PER_ROW - number of bytes per row in the color buffer * PIXEL_ADDRESS(X,Y) - returns the address of pixel at (X,Y) where * Y==0 at bottom of screen and increases upward. * * Similarly, for direct depth buffer access, this type is used for depth * buffer addressing: * DEPTH_TYPE - either GLushort or GLuint * * Optionally, one may provide one-time setup code * SETUP_CODE - code which is to be executed once per line * * To actually "plot" each pixel the PLOT macro must be defined... * PLOT(X,Y) - code to plot a pixel. Example: * if (Z < *zPtr) { * *zPtr = Z; * color = pack_rgb( FixedToInt(r0), FixedToInt(g0), * FixedToInt(b0) ); * put_pixel( X, Y, color ); * } * * This code was designed for the origin to be in the lower-left corner. * */ static void NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { struct sw_span span; GLuint interpFlags = 0; GLint x0 = (GLint) vert0->win[0]; GLint x1 = (GLint) vert1->win[0]; GLint y0 = (GLint) vert0->win[1]; GLint y1 = (GLint) vert1->win[1]; GLint dx, dy; GLint numPixels; GLint xstep, ystep; #if defined(DEPTH_TYPE) const GLint depthBits = ctx->Visual.depthBits; const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0; struct gl_renderbuffer *zrb = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; #define FixedToDepth(F) ((F) >> fixedToDepthShift) GLint zPtrXstep, zPtrYstep; DEPTH_TYPE *zPtr; #elif defined(INTERP_Z) const GLint depthBits = ctx->Visual.depthBits; #endif #ifdef PIXEL_ADDRESS PIXEL_TYPE *pixelPtr; GLint pixelXstep, pixelYstep; #endif #ifdef SETUP_CODE SETUP_CODE #endif /* Cull primitives with malformed coordinates. */ { GLfloat tmp = vert0->win[0] + vert0->win[1] + vert1->win[0] + vert1->win[1]; if (IS_INF_OR_NAN(tmp)) return; } /* printf("%s():\n", __FUNCTION__); printf(" (%f, %f, %f) -> (%f, %f, %f)\n", vert0->win[0], vert0->win[1], vert0->win[2], vert1->win[0], vert1->win[1], vert1->win[2]); printf(" (%d, %d, %d) -> (%d, %d, %d)\n", vert0->color[0], vert0->color[1], vert0->color[2], vert1->color[0], vert1->color[1], vert1->color[2]); printf(" (%d, %d, %d) -> (%d, %d, %d)\n", vert0->specular[0], vert0->specular[1], vert0->specular[2], vert1->specular[0], vert1->specular[1], vert1->specular[2]); */ /* * Despite being clipped to the view volume, the line's window coordinates * may just lie outside the window bounds. That is, if the legal window * coordinates are [0,W-1][0,H-1], it's possible for x==W and/or y==H. * This quick and dirty code nudges the endpoints inside the window if * necessary. */ #ifdef CLIP_HACK { GLint w = ctx->DrawBuffer->Width; GLint h = ctx->DrawBuffer->Height; if ((x0==w) | (x1==w)) { if ((x0==w) & (x1==w)) return; x0 -= x0==w; x1 -= x1==w; } if ((y0==h) | (y1==h)) { if ((y0==h) & (y1==h)) return; y0 -= y0==h; y1 -= y1==h; } } #endif dx = x1 - x0; dy = y1 - y0; if (dx == 0 && dy == 0) return; #ifdef DEPTH_TYPE zPtr = (DEPTH_TYPE *) zrb->GetPointer(ctx, zrb, x0, y0); #endif #ifdef PIXEL_ADDRESS pixelPtr = (PIXEL_TYPE *) PIXEL_ADDRESS(x0,y0); #endif if (dx<0) { dx = -dx; /* make positive */ xstep = -1; #ifdef DEPTH_TYPE zPtrXstep = -((GLint)sizeof(DEPTH_TYPE)); #endif #ifdef PIXEL_ADDRESS pixelXstep = -((GLint)sizeof(PIXEL_TYPE)); #endif } else { xstep = 1; #ifdef DEPTH_TYPE zPtrXstep = ((GLint)sizeof(DEPTH_TYPE)); #endif #ifdef PIXEL_ADDRESS pixelXstep = ((GLint)sizeof(PIXEL_TYPE)); #endif } if (dy<0) { dy = -dy; /* make positive */ ystep = -1; #ifdef DEPTH_TYPE zPtrYstep = -((GLint) (ctx->DrawBuffer->Width * sizeof(DEPTH_TYPE))); #endif #ifdef PIXEL_ADDRESS pixelYstep = BYTES_PER_ROW; #endif } else { ystep = 1; #ifdef DEPTH_TYPE zPtrYstep = (GLint) (ctx->DrawBuffer->Width * sizeof(DEPTH_TYPE)); #endif #ifdef PIXEL_ADDRESS pixelYstep = -(BYTES_PER_ROW); #endif } ASSERT(dx >= 0); ASSERT(dy >= 0); numPixels = MAX2(dx, dy); /* * Span setup: compute start and step values for all interpolated values. */ #ifdef INTERP_RGBA interpFlags |= SPAN_RGBA; if (ctx->Light.ShadeModel == GL_SMOOTH) { span.red = ChanToFixed(vert0->color[0]); span.green = ChanToFixed(vert0->color[1]); span.blue = ChanToFixed(vert0->color[2]); span.alpha = ChanToFixed(vert0->color[3]); span.redStep = (ChanToFixed(vert1->color[0]) - span.red ) / numPixels; span.greenStep = (ChanToFixed(vert1->color[1]) - span.green) / numPixels; span.blueStep = (ChanToFixed(vert1->color[2]) - span.blue ) / numPixels; span.alphaStep = (ChanToFixed(vert1->color[3]) - span.alpha) / numPixels; } else { span.red = ChanToFixed(vert1->color[0]); span.green = ChanToFixed(vert1->color[1]); span.blue = ChanToFixed(vert1->color[2]); span.alpha = ChanToFixed(vert1->color[3]); span.redStep = 0; span.greenStep = 0; span.blueStep = 0; span.alphaStep = 0; } #endif #ifdef INTERP_SPEC interpFlags |= SPAN_SPEC; if (ctx->Light.ShadeModel == GL_SMOOTH) { span.specRed = ChanToFixed(vert0->specular[0]); span.specGreen = ChanToFixed(vert0->specular[1]); span.specBlue = ChanToFixed(vert0->specular[2]); span.specRedStep = (ChanToFixed(vert1->specular[0]) - span.specRed) / numPixels; span.specGreenStep = (ChanToFixed(vert1->specular[1]) - span.specBlue) / numPixels; span.specBlueStep = (ChanToFixed(vert1->specular[2]) - span.specGreen) / numPixels; } else { span.specRed = ChanToFixed(vert1->specular[0]); span.specGreen = ChanToFixed(vert1->specular[1]); span.specBlue = ChanToFixed(vert1->specular[2]); span.specRedStep = 0; span.specGreenStep = 0; span.specBlueStep = 0; } #endif #ifdef INTERP_INDEX interpFlags |= SPAN_INDEX; if (ctx->Light.ShadeModel == GL_SMOOTH) { span.index = FloatToFixed(vert0->index); span.indexStep = FloatToFixed(vert1->index - vert0->index) / numPixels; } else { span.index = FloatToFixed(vert1->index); span.indexStep = 0; } #endif #if defined(INTERP_Z) || defined(DEPTH_TYPE) interpFlags |= SPAN_Z; { if (depthBits <= 16) { span.z = FloatToFixed(vert0->win[2]) + FIXED_HALF; span.zStep = FloatToFixed(vert1->win[2] - vert0->win[2]) / numPixels; } else { /* don't use fixed point */ span.z = (GLint) vert0->win[2]; span.zStep = (GLint) ((vert1->win[2] - vert0->win[2]) / numPixels); } } #endif #ifdef INTERP_FOG interpFlags |= SPAN_FOG; span.fog = vert0->fog; span.fogStep = (vert1->fog - vert0->fog) / numPixels; #endif #ifdef INTERP_TEX interpFlags |= SPAN_TEXTURE; { const GLfloat invw0 = vert0->win[3]; const GLfloat invw1 = vert1->win[3]; const GLfloat invLen = 1.0F / numPixels; GLfloat ds, dt, dr, dq; span.tex[0][0] = invw0 * vert0->texcoord[0][0]; span.tex[0][1] = invw0 * vert0->texcoord[0][1]; span.tex[0][2] = invw0 * vert0->texcoord[0][2]; span.tex[0][3] = invw0 * vert0->texcoord[0][3]; ds = (invw1 * vert1->texcoord[0][0]) - span.tex[0][0]; dt = (invw1 * vert1->texcoord[0][1]) - span.tex[0][1]; dr = (invw1 * vert1->texcoord[0][2]) - span.tex[0][2]; dq = (invw1 * vert1->texcoord[0][3]) - span.tex[0][3]; span.texStepX[0][0] = ds * invLen; span.texStepX[0][1] = dt * invLen; span.texStepX[0][2] = dr * invLen; span.texStepX[0][3] = dq * invLen; span.texStepY[0][0] = 0.0F; span.texStepY[0][1] = 0.0F; span.texStepY[0][2] = 0.0F; span.texStepY[0][3] = 0.0F; } #endif #ifdef INTERP_MULTITEX interpFlags |= SPAN_TEXTURE; { const GLfloat invLen = 1.0F / numPixels; GLuint u; for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture.Unit[u]._ReallyEnabled) { const GLfloat invw0 = vert0->win[3]; const GLfloat invw1 = vert1->win[3]; GLfloat ds, dt, dr, dq; span.tex[u][0] = invw0 * vert0->texcoord[u][0]; span.tex[u][1] = invw0 * vert0->texcoord[u][1]; span.tex[u][2] = invw0 * vert0->texcoord[u][2]; span.tex[u][3] = invw0 * vert0->texcoord[u][3]; ds = (invw1 * vert1->texcoord[u][0]) - span.tex[u][0]; dt = (invw1 * vert1->texcoord[u][1]) - span.tex[u][1]; dr = (invw1 * vert1->texcoord[u][2]) - span.tex[u][2]; dq = (invw1 * vert1->texcoord[u][3]) - span.tex[u][3]; span.texStepX[u][0] = ds * invLen; span.texStepX[u][1] = dt * invLen; span.texStepX[u][2] = dr * invLen; span.texStepX[u][3] = dq * invLen; span.texStepY[u][0] = 0.0F; span.texStepY[u][1] = 0.0F; span.texStepY[u][2] = 0.0F; span.texStepY[u][3] = 0.0F; } } } #endif INIT_SPAN(span, GL_LINE, numPixels, interpFlags, SPAN_XY); /* Need these for fragment prog texcoord interpolation */ span.w = 1.0F; span.dwdx = 0.0F; span.dwdy = 0.0F; /* * Draw */ if (dx > dy) { /*** X-major line ***/ GLint i; GLint errorInc = dy+dy; GLint error = errorInc-dx; GLint errorDec = error-dx; for (i = 0; i < dx; i++) { #ifdef DEPTH_TYPE GLdepth Z = FixedToDepth(span.z); #endif #ifdef PLOT PLOT( x0, y0 ); #else span.array->x[i] = x0; span.array->y[i] = y0; #endif x0 += xstep; #ifdef DEPTH_TYPE zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep); span.z += span.zStep; #endif #ifdef PIXEL_ADDRESS pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelXstep); #endif if (error<0) { error += errorInc; } else { error += errorDec; y0 += ystep; #ifdef DEPTH_TYPE zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep); #endif #ifdef PIXEL_ADDRESS pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelYstep); #endif } } } else { /*** Y-major line ***/ GLint i; GLint errorInc = dx+dx; GLint error = errorInc-dy; GLint errorDec = error-dy; for (i=0;ix[i] = x0; span.array->y[i] = y0; #endif y0 += ystep; #ifdef DEPTH_TYPE zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep); span.z += span.zStep; #endif #ifdef PIXEL_ADDRESS pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelYstep); #endif if (error<0) { error += errorInc; } else { error += errorDec; x0 += xstep; #ifdef DEPTH_TYPE zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep); #endif #ifdef PIXEL_ADDRESS pixelPtr = (PIXEL_TYPE*) ((GLubyte*) pixelPtr + pixelXstep); #endif } } } #ifdef RENDER_SPAN RENDER_SPAN( span ); #endif (void)span; } #undef NAME #undef INTERP_Z #undef INTERP_FOG #undef INTERP_RGBA #undef INTERP_SPEC #undef INTERP_TEX #undef INTERP_MULTITEX #undef INTERP_INDEX #undef PIXEL_ADDRESS #undef PIXEL_TYPE #undef DEPTH_TYPE #undef BYTES_PER_ROW #undef SETUP_CODE #undef PLOT #undef CLIP_HACK #undef FixedToDepth #undef RENDER_SPAN nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_logic.c0000644000000000000000000001460013614532424020324 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "context.h" #include "imports.h" #include "macros.h" #include "s_context.h" #include "s_logic.h" #include "s_span.h" #define LOGIC_OP_LOOP(MODE) \ do { \ GLuint i; \ switch (MODE) { \ case GL_CLEAR: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] = 0; \ } \ } \ break; \ case GL_SET: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] = ~0; \ } \ } \ break; \ case GL_COPY: \ /* do nothing */ \ break; \ case GL_COPY_INVERTED: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] = ~src[i]; \ } \ } \ break; \ case GL_NOOP: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] = dest[i]; \ } \ } \ break; \ case GL_INVERT: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] = ~dest[i]; \ } \ } \ break; \ case GL_AND: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] &= dest[i]; \ } \ } \ break; \ case GL_NAND: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] = ~(src[i] & dest[i]); \ } \ } \ break; \ case GL_OR: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] |= dest[i]; \ } \ } \ break; \ case GL_NOR: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] = ~(src[i] | dest[i]); \ } \ } \ break; \ case GL_XOR: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] ^= dest[i]; \ } \ } \ break; \ case GL_EQUIV: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] = ~(src[i] ^ dest[i]); \ } \ } \ break; \ case GL_AND_REVERSE: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] = src[i] & ~dest[i]; \ } \ } \ break; \ case GL_AND_INVERTED: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] = ~src[i] & dest[i]; \ } \ } \ break; \ case GL_OR_REVERSE: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] = src[i] | ~dest[i]; \ } \ } \ break; \ case GL_OR_INVERTED: \ for (i = 0; i < n; i++) { \ if (mask[i]) { \ src[i] = ~src[i] | dest[i]; \ } \ } \ break; \ default: \ _mesa_problem(ctx, "bad logicop mode");\ } \ } while (0) static void logicop_ubyte(GLcontext *ctx, GLuint n, GLubyte src[], const GLubyte dest[], const GLubyte mask[]) { LOGIC_OP_LOOP(ctx->Color.LogicOp); } static void logicop_ushort(GLcontext *ctx, GLuint n, GLushort src[], const GLushort dest[], const GLubyte mask[]) { LOGIC_OP_LOOP(ctx->Color.LogicOp); } static void logicop_uint(GLcontext *ctx, GLuint n, GLuint src[], const GLuint dest[], const GLubyte mask[]) { LOGIC_OP_LOOP(ctx->Color.LogicOp); } /* * Apply the current logic operator to a span of CI pixels. This is only * used if the device driver can't do logic ops. */ void _swrast_logicop_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb, const struct sw_span *span, GLuint index[]) { GLuint dest[MAX_WIDTH]; ASSERT(span->end < MAX_WIDTH); ASSERT(rb->DataType == GL_UNSIGNED_INT); /* Read dest values from frame buffer */ if (span->arrayMask & SPAN_XY) { _swrast_get_values(ctx, rb, span->end, span->array->x, span->array->y, dest, sizeof(GLuint)); } else { rb->GetRow(ctx, rb, span->end, span->x, span->y, dest); } logicop_uint(ctx, span->end, index, dest, span->array->mask); } /** * Apply the current logic operator to a span of RGBA pixels. * We can handle horizontal runs of pixels (spans) or arrays of x/y * pixel coordinates. */ void _swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, const struct sw_span *span, GLchan rgba[][4]) { GLchan dest[MAX_WIDTH][4]; ASSERT(span->end < MAX_WIDTH); ASSERT(span->arrayMask & SPAN_RGBA); ASSERT(rb->DataType == GL_UNSIGNED_BYTE); if (span->arrayMask & SPAN_XY) { _swrast_get_values(ctx, rb, span->end, span->array->x, span->array->y, dest, 4 * sizeof(GLchan)); } else { _swrast_read_rgba_span(ctx, rb, span->end, span->x, span->y, dest); } /* XXX make this a runtime test */ #if CHAN_TYPE == GL_UNSIGNED_BYTE /* treat 4*GLubyte as GLuint */ logicop_uint(ctx, span->end, (GLuint *) rgba, (const GLuint *) dest, span->array->mask); #elif CHAN_TYPE == GL_UNSIGNED_SHORT logicop_ushort(ctx, 4 * span->end, (GLushort *) rgba, (const GLushort *) dest, span->array->mask); #elif CHAN_TYPE == GL_FLOAT logicop_uint(ctx, 4 * span->end, (GLuint *) rgba, (const GLuint *) dest, span->array->mask); #endif (void) logicop_ubyte; (void) logicop_ushort; (void) logicop_uint; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_logic.h0000644000000000000000000000303613614532424020332 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_LOGIC_H #define S_LOGIC_H #include "mtypes.h" #include "swrast.h" extern void _swrast_logicop_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb, const struct sw_span *span, GLuint index[]); extern void _swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, const struct sw_span *span, GLchan rgba[][4]); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_masking.c0000644000000000000000000001161713614532424020665 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Implement the effect of glColorMask and glIndexMask in software. */ #include "glheader.h" #include "enums.h" #include "macros.h" #include "s_context.h" #include "s_masking.h" #include "s_span.h" void _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, const struct sw_span *span, GLchan rgba[][4]) { GLchan dest[MAX_WIDTH][4]; #if CHAN_BITS == 8 GLuint srcMask = *((GLuint*)ctx->Color.ColorMask); GLuint dstMask = ~srcMask; GLuint *rgba32 = (GLuint *) rgba; GLuint *dest32 = (GLuint *) dest; #else const GLboolean rMask = ctx->Color.ColorMask[RCOMP]; const GLboolean gMask = ctx->Color.ColorMask[GCOMP]; const GLboolean bMask = ctx->Color.ColorMask[BCOMP]; const GLboolean aMask = ctx->Color.ColorMask[ACOMP]; #endif const GLuint n = span->end; GLuint i; ASSERT(n < MAX_WIDTH); ASSERT(span->arrayMask & SPAN_RGBA); if (span->arrayMask & SPAN_XY) { _swrast_get_values(ctx, rb, n, span->array->x, span->array->y, dest, 4 * sizeof(GLchan)); } else { _swrast_read_rgba_span(ctx, rb, n, span->x, span->y, dest); } #if CHAN_BITS == 8 for (i = 0; i < n; i++) { rgba32[i] = (rgba32[i] & srcMask) | (dest32[i] & dstMask); } #else for (i = 0; i < n; i++) { if (!rMask) rgba[i][RCOMP] = dest[i][RCOMP]; if (!gMask) rgba[i][GCOMP] = dest[i][GCOMP]; if (!bMask) rgba[i][BCOMP] = dest[i][BCOMP]; if (!aMask) rgba[i][ACOMP] = dest[i][ACOMP]; } #endif } /* * Apply glColorMask to a span of RGBA pixels. */ void _swrast_mask_rgba_array(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLchan rgba[][4]) { GLchan dest[MAX_WIDTH][4]; GLuint i; #if CHAN_BITS == 8 GLuint srcMask = *((GLuint*)ctx->Color.ColorMask); GLuint dstMask = ~srcMask; GLuint *rgba32 = (GLuint *) rgba; GLuint *dest32 = (GLuint *) dest; _swrast_read_rgba_span( ctx, rb, n, x, y, dest ); for (i = 0; i < n; i++) { rgba32[i] = (rgba32[i] & srcMask) | (dest32[i] & dstMask); } #else const GLint rMask = ctx->Color.ColorMask[RCOMP]; const GLint gMask = ctx->Color.ColorMask[GCOMP]; const GLint bMask = ctx->Color.ColorMask[BCOMP]; const GLint aMask = ctx->Color.ColorMask[ACOMP]; _swrast_read_rgba_span( ctx, rb, n, x, y, dest ); for (i = 0; i < n; i++) { if (!rMask) rgba[i][RCOMP] = dest[i][RCOMP]; if (!gMask) rgba[i][GCOMP] = dest[i][GCOMP]; if (!bMask) rgba[i][BCOMP] = dest[i][BCOMP]; if (!aMask) rgba[i][ACOMP] = dest[i][ACOMP]; } #endif } void _swrast_mask_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb, const struct sw_span *span, GLuint index[]) { const GLuint srcMask = ctx->Color.IndexMask; const GLuint dstMask = ~srcMask; GLuint dest[MAX_WIDTH]; GLuint i; ASSERT(span->arrayMask & SPAN_INDEX); ASSERT(span->end <= MAX_WIDTH); ASSERT(rb->DataType == GL_UNSIGNED_INT); if (span->arrayMask & SPAN_XY) { _swrast_get_values(ctx, rb, span->end, span->array->x, span->array->y, dest, sizeof(GLuint)); } else { _swrast_read_index_span(ctx, rb, span->end, span->x, span->y, dest); } for (i = 0; i < span->end; i++) { index[i] = (index[i] & srcMask) | (dest[i] & dstMask); } } /* * Apply glIndexMask to an array of CI pixels. */ void _swrast_mask_ci_array(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLuint index[]) { const GLuint srcMask = ctx->Color.IndexMask; const GLuint dstMask = ~srcMask; GLuint dest[MAX_WIDTH]; GLuint i; _swrast_read_index_span(ctx, rb, n, x, y, dest); for (i=0;iTextureSample[unit](ctx, unit, ctx->Texture.Unit[unit]._Current, 1, (const GLfloat (*)[4]) texcoord, &lambda, &rgba); color[0] = CHAN_TO_FLOAT(rgba[0]); color[1] = CHAN_TO_FLOAT(rgba[1]); color[2] = CHAN_TO_FLOAT(rgba[2]); color[3] = CHAN_TO_FLOAT(rgba[3]); } /** * Fetch a texel with the given partial derivatives to compute a level * of detail in the mipmap. */ static void fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], const GLfloat texdx[4], const GLfloat texdy[4], GLuint unit, GLfloat color[4] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; const struct gl_texture_image *texImg = texObj->Image[0][texObj->BaseLevel]; const GLfloat texW = (GLfloat) texImg->WidthScale; const GLfloat texH = (GLfloat) texImg->HeightScale; GLchan rgba[4]; GLfloat lambda = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */ texdx[1], texdy[1], /* dt/dx, dt/dy */ texdx[3], texdy[2], /* dq/dx, dq/dy */ texW, texH, texcoord[0], texcoord[1], texcoord[3], 1.0F / texcoord[3]); swrast->TextureSample[unit](ctx, unit, ctx->Texture.Unit[unit]._Current, 1, (const GLfloat (*)[4]) texcoord, &lambda, &rgba); color[0] = CHAN_TO_FLOAT(rgba[0]); color[1] = CHAN_TO_FLOAT(rgba[1]); color[2] = CHAN_TO_FLOAT(rgba[2]); color[3] = CHAN_TO_FLOAT(rgba[3]); } /** * Return a pointer to the 4-element float vector specified by the given * source register. */ static INLINE const GLfloat * get_register_pointer( GLcontext *ctx, const struct fp_src_register *source, const struct fp_machine *machine, const struct fragment_program *program ) { const GLfloat *src; switch (source->File) { case PROGRAM_TEMPORARY: ASSERT(source->Index < MAX_NV_FRAGMENT_PROGRAM_TEMPS); src = machine->Temporaries[source->Index]; break; case PROGRAM_INPUT: ASSERT(source->Index < MAX_NV_FRAGMENT_PROGRAM_INPUTS); src = machine->Inputs[source->Index]; break; case PROGRAM_OUTPUT: /* This is only for PRINT */ ASSERT(source->Index < MAX_NV_FRAGMENT_PROGRAM_OUTPUTS); src = machine->Outputs[source->Index]; break; case PROGRAM_LOCAL_PARAM: ASSERT(source->Index < MAX_PROGRAM_LOCAL_PARAMS); src = program->Base.LocalParams[source->Index]; break; case PROGRAM_ENV_PARAM: ASSERT(source->Index < MAX_NV_FRAGMENT_PROGRAM_PARAMS); src = ctx->FragmentProgram.Parameters[source->Index]; break; case PROGRAM_STATE_VAR: /* Fallthrough */ case PROGRAM_NAMED_PARAM: ASSERT(source->Index < (GLint) program->Parameters->NumParameters); src = program->Parameters->ParameterValues[source->Index]; break; default: _mesa_problem(ctx, "Invalid input register file %d in fetch_vector4", source->File); src = NULL; } return src; } /** * Fetch a 4-element float vector from the given source register. * Apply swizzling and negating as needed. */ static void fetch_vector4( GLcontext *ctx, const struct fp_src_register *source, const struct fp_machine *machine, const struct fragment_program *program, GLfloat result[4] ) { const GLfloat *src = get_register_pointer(ctx, source, machine, program); ASSERT(src); result[0] = src[GET_SWZ(source->Swizzle, 0)]; result[1] = src[GET_SWZ(source->Swizzle, 1)]; result[2] = src[GET_SWZ(source->Swizzle, 2)]; result[3] = src[GET_SWZ(source->Swizzle, 3)]; if (source->NegateBase) { result[0] = -result[0]; result[1] = -result[1]; result[2] = -result[2]; result[3] = -result[3]; } if (source->Abs) { result[0] = FABSF(result[0]); result[1] = FABSF(result[1]); result[2] = FABSF(result[2]); result[3] = FABSF(result[3]); } if (source->NegateAbs) { result[0] = -result[0]; result[1] = -result[1]; result[2] = -result[2]; result[3] = -result[3]; } } /** * Fetch the derivative with respect to X for the given register. * \return GL_TRUE if it was easily computed or GL_FALSE if we * need to execute another instance of the program (ugh)! */ static GLboolean fetch_vector4_deriv( GLcontext *ctx, const struct fp_src_register *source, const struct sw_span *span, char xOrY, GLint column, GLfloat result[4] ) { GLfloat src[4]; ASSERT(xOrY == 'X' || xOrY == 'Y'); switch (source->Index) { case FRAG_ATTRIB_WPOS: if (xOrY == 'X') { src[0] = 1.0; src[1] = 0.0; src[2] = span->dzdx / ctx->DrawBuffer->_DepthMaxF; src[3] = span->dwdx; } else { src[0] = 0.0; src[1] = 1.0; src[2] = span->dzdy / ctx->DrawBuffer->_DepthMaxF; src[3] = span->dwdy; } break; case FRAG_ATTRIB_COL0: if (xOrY == 'X') { src[0] = span->drdx * (1.0F / CHAN_MAXF); src[1] = span->dgdx * (1.0F / CHAN_MAXF); src[2] = span->dbdx * (1.0F / CHAN_MAXF); src[3] = span->dadx * (1.0F / CHAN_MAXF); } else { src[0] = span->drdy * (1.0F / CHAN_MAXF); src[1] = span->dgdy * (1.0F / CHAN_MAXF); src[2] = span->dbdy * (1.0F / CHAN_MAXF); src[3] = span->dady * (1.0F / CHAN_MAXF); } break; case FRAG_ATTRIB_COL1: if (xOrY == 'X') { src[0] = span->dsrdx * (1.0F / CHAN_MAXF); src[1] = span->dsgdx * (1.0F / CHAN_MAXF); src[2] = span->dsbdx * (1.0F / CHAN_MAXF); src[3] = 0.0; /* XXX need this */ } else { src[0] = span->dsrdy * (1.0F / CHAN_MAXF); src[1] = span->dsgdy * (1.0F / CHAN_MAXF); src[2] = span->dsbdy * (1.0F / CHAN_MAXF); src[3] = 0.0; /* XXX need this */ } break; case FRAG_ATTRIB_FOGC: if (xOrY == 'X') { src[0] = span->dfogdx; src[1] = 0.0; src[2] = 0.0; src[3] = 0.0; } else { src[0] = span->dfogdy; src[1] = 0.0; src[2] = 0.0; src[3] = 0.0; } break; case FRAG_ATTRIB_TEX0: case FRAG_ATTRIB_TEX1: case FRAG_ATTRIB_TEX2: case FRAG_ATTRIB_TEX3: case FRAG_ATTRIB_TEX4: case FRAG_ATTRIB_TEX5: case FRAG_ATTRIB_TEX6: case FRAG_ATTRIB_TEX7: if (xOrY == 'X') { const GLuint u = source->Index - FRAG_ATTRIB_TEX0; /* this is a little tricky - I think I've got it right */ const GLfloat invQ = 1.0f / (span->tex[u][3] + span->texStepX[u][3] * column); src[0] = span->texStepX[u][0] * invQ; src[1] = span->texStepX[u][1] * invQ; src[2] = span->texStepX[u][2] * invQ; src[3] = span->texStepX[u][3] * invQ; } else { const GLuint u = source->Index - FRAG_ATTRIB_TEX0; /* Tricky, as above, but in Y direction */ const GLfloat invQ = 1.0f / (span->tex[u][3] + span->texStepY[u][3]); src[0] = span->texStepY[u][0] * invQ; src[1] = span->texStepY[u][1] * invQ; src[2] = span->texStepY[u][2] * invQ; src[3] = span->texStepY[u][3] * invQ; } break; default: return GL_FALSE; } result[0] = src[GET_SWZ(source->Swizzle, 0)]; result[1] = src[GET_SWZ(source->Swizzle, 1)]; result[2] = src[GET_SWZ(source->Swizzle, 2)]; result[3] = src[GET_SWZ(source->Swizzle, 3)]; if (source->NegateBase) { result[0] = -result[0]; result[1] = -result[1]; result[2] = -result[2]; result[3] = -result[3]; } if (source->Abs) { result[0] = FABSF(result[0]); result[1] = FABSF(result[1]); result[2] = FABSF(result[2]); result[3] = FABSF(result[3]); } if (source->NegateAbs) { result[0] = -result[0]; result[1] = -result[1]; result[2] = -result[2]; result[3] = -result[3]; } return GL_TRUE; } /** * As above, but only return result[0] element. */ static void fetch_vector1( GLcontext *ctx, const struct fp_src_register *source, const struct fp_machine *machine, const struct fragment_program *program, GLfloat result[4] ) { const GLfloat *src = get_register_pointer(ctx, source, machine, program); ASSERT(src); result[0] = src[GET_SWZ(source->Swizzle, 0)]; if (source->NegateBase) { result[0] = -result[0]; } if (source->Abs) { result[0] = FABSF(result[0]); } if (source->NegateAbs) { result[0] = -result[0]; } } /** * Test value against zero and return GT, LT, EQ or UN if NaN. */ static INLINE GLuint generate_cc( float value ) { if (value != value) return COND_UN; /* NaN */ if (value > 0.0F) return COND_GT; if (value < 0.0F) return COND_LT; return COND_EQ; } /** * Test if the ccMaskRule is satisfied by the given condition code. * Used to mask destination writes according to the current condition codee. */ static INLINE GLboolean test_cc(GLuint condCode, GLuint ccMaskRule) { switch (ccMaskRule) { case COND_EQ: return (condCode == COND_EQ); case COND_NE: return (condCode != COND_EQ); case COND_LT: return (condCode == COND_LT); case COND_GE: return (condCode == COND_GT || condCode == COND_EQ); case COND_LE: return (condCode == COND_LT || condCode == COND_EQ); case COND_GT: return (condCode == COND_GT); case COND_TR: return GL_TRUE; case COND_FL: return GL_FALSE; default: return GL_TRUE; } } /** * Store 4 floats into a register. Observe the instructions saturate and * set-condition-code flags. */ static void store_vector4( const struct fp_instruction *inst, struct fp_machine *machine, const GLfloat value[4] ) { const struct fp_dst_register *dest = &(inst->DstReg); const GLboolean clamp = inst->Saturate; const GLboolean updateCC = inst->UpdateCondRegister; GLfloat *dstReg; GLfloat dummyReg[4]; GLfloat clampedValue[4]; GLboolean condWriteMask[4]; GLuint writeMask = dest->WriteMask; switch (dest->File) { case PROGRAM_OUTPUT: dstReg = machine->Outputs[dest->Index]; break; case PROGRAM_TEMPORARY: dstReg = machine->Temporaries[dest->Index]; break; case PROGRAM_WRITE_ONLY: dstReg = dummyReg; return; default: _mesa_problem(NULL, "bad register file in store_vector4(fp)"); return; } #if DEBUG_FRAG if (value[0] > 1.0e10 || IS_INF_OR_NAN(value[0]) || IS_INF_OR_NAN(value[1]) || IS_INF_OR_NAN(value[2]) || IS_INF_OR_NAN(value[3]) ) printf("store %g %g %g %g\n", value[0], value[1], value[2], value[3]); #endif if (clamp) { clampedValue[0] = CLAMP(value[0], 0.0F, 1.0F); clampedValue[1] = CLAMP(value[1], 0.0F, 1.0F); clampedValue[2] = CLAMP(value[2], 0.0F, 1.0F); clampedValue[3] = CLAMP(value[3], 0.0F, 1.0F); value = clampedValue; } if (dest->CondMask != COND_TR) { condWriteMask[0] = GET_BIT(writeMask, 0) && test_cc(machine->CondCodes[GET_SWZ(dest->CondSwizzle, 0)], dest->CondMask); condWriteMask[1] = GET_BIT(writeMask, 1) && test_cc(machine->CondCodes[GET_SWZ(dest->CondSwizzle, 1)], dest->CondMask); condWriteMask[2] = GET_BIT(writeMask, 2) && test_cc(machine->CondCodes[GET_SWZ(dest->CondSwizzle, 2)], dest->CondMask); condWriteMask[3] = GET_BIT(writeMask, 3) && test_cc(machine->CondCodes[GET_SWZ(dest->CondSwizzle, 3)], dest->CondMask); writeMask = ((condWriteMask[0] << 0) | (condWriteMask[1] << 1) | (condWriteMask[2] << 2) | (condWriteMask[3] << 3)); } if (GET_BIT(writeMask, 0)) { dstReg[0] = value[0]; if (updateCC) machine->CondCodes[0] = generate_cc(value[0]); } if (GET_BIT(writeMask, 1)) { dstReg[1] = value[1]; if (updateCC) machine->CondCodes[1] = generate_cc(value[1]); } if (GET_BIT(writeMask, 2)) { dstReg[2] = value[2]; if (updateCC) machine->CondCodes[2] = generate_cc(value[2]); } if (GET_BIT(writeMask, 3)) { dstReg[3] = value[3]; if (updateCC) machine->CondCodes[3] = generate_cc(value[3]); } } /** * Initialize a new machine state instance from an existing one, adding * the partial derivatives onto the input registers. * Used to implement DDX and DDY instructions in non-trivial cases. */ static void init_machine_deriv( GLcontext *ctx, const struct fp_machine *machine, const struct fragment_program *program, const struct sw_span *span, char xOrY, struct fp_machine *dMachine ) { GLuint u; ASSERT(xOrY == 'X' || xOrY == 'Y'); /* copy existing machine */ _mesa_memcpy(dMachine, machine, sizeof(struct fp_machine)); if (program->Base.Target == GL_FRAGMENT_PROGRAM_NV) { /* Clear temporary registers (undefined for ARB_f_p) */ _mesa_bzero( (void*) machine->Temporaries, MAX_NV_FRAGMENT_PROGRAM_TEMPS * 4 * sizeof(GLfloat)); } /* Add derivatives */ if (program->InputsRead & (1 << FRAG_ATTRIB_WPOS)) { GLfloat *wpos = (GLfloat*) machine->Inputs[FRAG_ATTRIB_WPOS]; if (xOrY == 'X') { wpos[0] += 1.0F; wpos[1] += 0.0F; wpos[2] += span->dzdx; wpos[3] += span->dwdx; } else { wpos[0] += 0.0F; wpos[1] += 1.0F; wpos[2] += span->dzdy; wpos[3] += span->dwdy; } } if (program->InputsRead & (1 << FRAG_ATTRIB_COL0)) { GLfloat *col0 = (GLfloat*) machine->Inputs[FRAG_ATTRIB_COL0]; if (xOrY == 'X') { col0[0] += span->drdx * (1.0F / CHAN_MAXF); col0[1] += span->dgdx * (1.0F / CHAN_MAXF); col0[2] += span->dbdx * (1.0F / CHAN_MAXF); col0[3] += span->dadx * (1.0F / CHAN_MAXF); } else { col0[0] += span->drdy * (1.0F / CHAN_MAXF); col0[1] += span->dgdy * (1.0F / CHAN_MAXF); col0[2] += span->dbdy * (1.0F / CHAN_MAXF); col0[3] += span->dady * (1.0F / CHAN_MAXF); } } if (program->InputsRead & (1 << FRAG_ATTRIB_COL1)) { GLfloat *col1 = (GLfloat*) machine->Inputs[FRAG_ATTRIB_COL1]; if (xOrY == 'X') { col1[0] += span->dsrdx * (1.0F / CHAN_MAXF); col1[1] += span->dsgdx * (1.0F / CHAN_MAXF); col1[2] += span->dsbdx * (1.0F / CHAN_MAXF); col1[3] += 0.0; /*XXX fix */ } else { col1[0] += span->dsrdy * (1.0F / CHAN_MAXF); col1[1] += span->dsgdy * (1.0F / CHAN_MAXF); col1[2] += span->dsbdy * (1.0F / CHAN_MAXF); col1[3] += 0.0; /*XXX fix */ } } if (program->InputsRead & (1 << FRAG_ATTRIB_FOGC)) { GLfloat *fogc = (GLfloat*) machine->Inputs[FRAG_ATTRIB_FOGC]; if (xOrY == 'X') { fogc[0] += span->dfogdx; } else { fogc[0] += span->dfogdy; } } for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) { if (program->InputsRead & (1 << (FRAG_ATTRIB_TEX0 + u))) { GLfloat *tex = (GLfloat*) machine->Inputs[FRAG_ATTRIB_TEX0 + u]; /* XXX perspective-correct interpolation */ if (xOrY == 'X') { tex[0] += span->texStepX[u][0]; tex[1] += span->texStepX[u][1]; tex[2] += span->texStepX[u][2]; tex[3] += span->texStepX[u][3]; } else { tex[0] += span->texStepY[u][0]; tex[1] += span->texStepY[u][1]; tex[2] += span->texStepY[u][2]; tex[3] += span->texStepY[u][3]; } } } /* init condition codes */ dMachine->CondCodes[0] = COND_EQ; dMachine->CondCodes[1] = COND_EQ; dMachine->CondCodes[2] = COND_EQ; dMachine->CondCodes[3] = COND_EQ; } /** * Execute the given vertex program. * NOTE: we do everything in single-precision floating point; we don't * currently observe the single/half/fixed-precision qualifiers. * \param ctx - rendering context * \param program - the fragment program to execute * \param machine - machine state (register file) * \param maxInst - max number of instructions to execute * \return GL_TRUE if program completed or GL_FALSE if program executed KIL. */ static GLboolean execute_program( GLcontext *ctx, const struct fragment_program *program, GLuint maxInst, struct fp_machine *machine, const struct sw_span *span, GLuint column ) { GLuint pc; #if DEBUG_FRAG printf("execute fragment program --------------------\n"); #endif for (pc = 0; pc < maxInst; pc++) { const struct fp_instruction *inst = program->Instructions + pc; if (ctx->FragmentProgram.CallbackEnabled && ctx->FragmentProgram.Callback) { ctx->FragmentProgram.CurrentPosition = inst->StringPos; ctx->FragmentProgram.Callback(program->Base.Target, ctx->FragmentProgram.CallbackData); } switch (inst->Opcode) { case FP_OPCODE_ABS: { GLfloat a[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); result[0] = FABSF(a[0]); result[1] = FABSF(a[1]); result[2] = FABSF(a[2]); result[3] = FABSF(a[3]); store_vector4( inst, machine, result ); } break; case FP_OPCODE_ADD: { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = a[0] + b[0]; result[1] = a[1] + b[1]; result[2] = a[2] + b[2]; result[3] = a[3] + b[3]; store_vector4( inst, machine, result ); } break; case FP_OPCODE_CMP: { GLfloat a[4], b[4], c[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); fetch_vector4( ctx, &inst->SrcReg[2], machine, program, c ); result[0] = a[0] < 0.0F ? b[0] : c[0]; result[1] = a[1] < 0.0F ? b[1] : c[1]; result[2] = a[2] < 0.0F ? b[2] : c[2]; result[3] = a[3] < 0.0F ? b[3] : c[3]; store_vector4( inst, machine, result ); } break; case FP_OPCODE_COS: { GLfloat a[4], result[4]; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); result[0] = result[1] = result[2] = result[3] = (GLfloat)_mesa_cos(a[0]); store_vector4( inst, machine, result ); } break; case FP_OPCODE_DDX: /* Partial derivative with respect to X */ { GLfloat a[4], aNext[4], result[4]; struct fp_machine dMachine; if (!fetch_vector4_deriv(ctx, &inst->SrcReg[0], span, 'X', column, result)) { /* This is tricky. Make a copy of the current machine state, * increment the input registers by the dx or dy partial * derivatives, then re-execute the program up to the * preceeding instruction, then fetch the source register. * Finally, find the difference in the register values for * the original and derivative runs. */ fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a); init_machine_deriv(ctx, machine, program, span, 'X', &dMachine); execute_program(ctx, program, pc, &dMachine, span, column); fetch_vector4( ctx, &inst->SrcReg[0], &dMachine, program, aNext ); result[0] = aNext[0] - a[0]; result[1] = aNext[1] - a[1]; result[2] = aNext[2] - a[2]; result[3] = aNext[3] - a[3]; } store_vector4( inst, machine, result ); } break; case FP_OPCODE_DDY: /* Partial derivative with respect to Y */ { GLfloat a[4], aNext[4], result[4]; struct fp_machine dMachine; if (!fetch_vector4_deriv(ctx, &inst->SrcReg[0], span, 'Y', column, result)) { init_machine_deriv(ctx, machine, program, span, 'Y', &dMachine); fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a); execute_program(ctx, program, pc, &dMachine, span, column); fetch_vector4( ctx, &inst->SrcReg[0], &dMachine, program, aNext ); result[0] = aNext[0] - a[0]; result[1] = aNext[1] - a[1]; result[2] = aNext[2] - a[2]; result[3] = aNext[3] - a[3]; } store_vector4( inst, machine, result ); } break; case FP_OPCODE_DP3: { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = result[1] = result[2] = result[3] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; store_vector4( inst, machine, result ); #if DEBUG_FRAG printf("DP3 %g = (%g %g %g) . (%g %g %g)\n", result[0], a[0], a[1], a[2], b[0], b[1], b[2]); #endif } break; case FP_OPCODE_DP4: { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = result[1] = result[2] = result[3] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; store_vector4( inst, machine, result ); #if DEBUG_FRAG printf("DP4 %g = (%g, %g %g %g) . (%g, %g %g %g)\n", result[0], a[0], a[1], a[2], a[3], b[0], b[1], b[2], b[3]); #endif } break; case FP_OPCODE_DPH: { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = result[1] = result[2] = result[3] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + b[3]; store_vector4( inst, machine, result ); } break; case FP_OPCODE_DST: /* Distance vector */ { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = 1.0F; result[1] = a[1] * b[1]; result[2] = a[2]; result[3] = b[3]; store_vector4( inst, machine, result ); } break; case FP_OPCODE_EX2: /* Exponential base 2 */ { GLfloat a[4], result[4]; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); result[0] = result[1] = result[2] = result[3] = (GLfloat) _mesa_pow(2.0, a[0]); store_vector4( inst, machine, result ); } break; case FP_OPCODE_FLR: { GLfloat a[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); result[0] = FLOORF(a[0]); result[1] = FLOORF(a[1]); result[2] = FLOORF(a[2]); result[3] = FLOORF(a[3]); store_vector4( inst, machine, result ); } break; case FP_OPCODE_FRC: { GLfloat a[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); result[0] = a[0] - FLOORF(a[0]); result[1] = a[1] - FLOORF(a[1]); result[2] = a[2] - FLOORF(a[2]); result[3] = a[3] - FLOORF(a[3]); store_vector4( inst, machine, result ); } break; case FP_OPCODE_KIL_NV: /* NV_f_p only */ { const GLuint swizzle = inst->DstReg.CondSwizzle; const GLuint condMask = inst->DstReg.CondMask; if (test_cc(machine->CondCodes[GET_SWZ(swizzle, 0)], condMask) || test_cc(machine->CondCodes[GET_SWZ(swizzle, 1)], condMask) || test_cc(machine->CondCodes[GET_SWZ(swizzle, 2)], condMask) || test_cc(machine->CondCodes[GET_SWZ(swizzle, 3)], condMask)) { return GL_FALSE; } } break; case FP_OPCODE_KIL: /* ARB_f_p only */ { GLfloat a[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); if (a[0] < 0.0F || a[1] < 0.0F || a[2] < 0.0F || a[3] < 0.0F) { return GL_FALSE; } } break; case FP_OPCODE_LG2: /* log base 2 */ { GLfloat a[4], result[4]; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); result[0] = result[1] = result[2] = result[3] = LOG2(a[0]); store_vector4( inst, machine, result ); } break; case FP_OPCODE_LIT: { const GLfloat epsilon = 1.0F / 256.0F; /* from NV VP spec */ GLfloat a[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); a[0] = MAX2(a[0], 0.0F); a[1] = MAX2(a[1], 0.0F); /* XXX ARB version clamps a[3], NV version doesn't */ a[3] = CLAMP(a[3], -(128.0F - epsilon), (128.0F - epsilon)); result[0] = 1.0F; result[1] = a[0]; /* XXX we could probably just use pow() here */ if (a[0] > 0.0F) { if (a[1] == 0.0 && a[3] == 0.0) result[2] = 1.0; else result[2] = EXPF(a[3] * LOGF(a[1])); } else { result[2] = 0.0; } result[3] = 1.0F; store_vector4( inst, machine, result ); } break; case FP_OPCODE_LRP: { GLfloat a[4], b[4], c[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); fetch_vector4( ctx, &inst->SrcReg[2], machine, program, c ); result[0] = a[0] * b[0] + (1.0F - a[0]) * c[0]; result[1] = a[1] * b[1] + (1.0F - a[1]) * c[1]; result[2] = a[2] * b[2] + (1.0F - a[2]) * c[2]; result[3] = a[3] * b[3] + (1.0F - a[3]) * c[3]; store_vector4( inst, machine, result ); } break; case FP_OPCODE_MAD: { GLfloat a[4], b[4], c[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); fetch_vector4( ctx, &inst->SrcReg[2], machine, program, c ); result[0] = a[0] * b[0] + c[0]; result[1] = a[1] * b[1] + c[1]; result[2] = a[2] * b[2] + c[2]; result[3] = a[3] * b[3] + c[3]; store_vector4( inst, machine, result ); } break; case FP_OPCODE_MAX: { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = MAX2(a[0], b[0]); result[1] = MAX2(a[1], b[1]); result[2] = MAX2(a[2], b[2]); result[3] = MAX2(a[3], b[3]); store_vector4( inst, machine, result ); #if DEBUG_FRAG printf("MAX (%g %g %g %g) = (%g %g %g %g), (%g %g %g %g)\n", result[0], result[1], result[2], result[3], a[0], a[1], a[2], a[3], b[0], b[1], b[2], b[3]); #endif } break; case FP_OPCODE_MIN: { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = MIN2(a[0], b[0]); result[1] = MIN2(a[1], b[1]); result[2] = MIN2(a[2], b[2]); result[3] = MIN2(a[3], b[3]); store_vector4( inst, machine, result ); } break; case FP_OPCODE_MOV: { GLfloat result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, result ); store_vector4( inst, machine, result ); #if DEBUG_FRAG printf("MOV (%g %g %g %g)\n", result[0], result[1], result[2], result[3]); #endif } break; case FP_OPCODE_MUL: { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = a[0] * b[0]; result[1] = a[1] * b[1]; result[2] = a[2] * b[2]; result[3] = a[3] * b[3]; store_vector4( inst, machine, result ); #if DEBUG_FRAG printf("MUL (%g %g %g %g) = (%g %g %g %g) * (%g %g %g %g)\n", result[0], result[1], result[2], result[3], a[0], a[1], a[2], a[3], b[0], b[1], b[2], b[3]); #endif } break; case FP_OPCODE_PK2H: /* pack two 16-bit floats in one 32-bit float */ { GLfloat a[4], result[4]; GLhalfNV hx, hy; GLuint *rawResult = (GLuint *) result; GLuint twoHalves; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); hx = _mesa_float_to_half(a[0]); hy = _mesa_float_to_half(a[1]); twoHalves = hx | (hy << 16); rawResult[0] = rawResult[1] = rawResult[2] = rawResult[3] = twoHalves; store_vector4( inst, machine, result ); } break; case FP_OPCODE_PK2US: /* pack two GLushorts into one 32-bit float */ { GLfloat a[4], result[4]; GLuint usx, usy, *rawResult = (GLuint *) result; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); a[0] = CLAMP(a[0], 0.0F, 1.0F); a[1] = CLAMP(a[1], 0.0F, 1.0F); usx = IROUND(a[0] * 65535.0F); usy = IROUND(a[1] * 65535.0F); rawResult[0] = rawResult[1] = rawResult[2] = rawResult[3] = usx | (usy << 16); store_vector4( inst, machine, result ); } break; case FP_OPCODE_PK4B: /* pack four GLbytes into one 32-bit float */ { GLfloat a[4], result[4]; GLuint ubx, uby, ubz, ubw, *rawResult = (GLuint *) result; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); a[0] = CLAMP(a[0], -128.0F / 127.0F, 1.0F); a[1] = CLAMP(a[1], -128.0F / 127.0F, 1.0F); a[2] = CLAMP(a[2], -128.0F / 127.0F, 1.0F); a[3] = CLAMP(a[3], -128.0F / 127.0F, 1.0F); ubx = IROUND(127.0F * a[0] + 128.0F); uby = IROUND(127.0F * a[1] + 128.0F); ubz = IROUND(127.0F * a[2] + 128.0F); ubw = IROUND(127.0F * a[3] + 128.0F); rawResult[0] = rawResult[1] = rawResult[2] = rawResult[3] = ubx | (uby << 8) | (ubz << 16) | (ubw << 24); store_vector4( inst, machine, result ); } break; case FP_OPCODE_PK4UB: /* pack four GLubytes into one 32-bit float */ { GLfloat a[4], result[4]; GLuint ubx, uby, ubz, ubw, *rawResult = (GLuint *) result; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); a[0] = CLAMP(a[0], 0.0F, 1.0F); a[1] = CLAMP(a[1], 0.0F, 1.0F); a[2] = CLAMP(a[2], 0.0F, 1.0F); a[3] = CLAMP(a[3], 0.0F, 1.0F); ubx = IROUND(255.0F * a[0]); uby = IROUND(255.0F * a[1]); ubz = IROUND(255.0F * a[2]); ubw = IROUND(255.0F * a[3]); rawResult[0] = rawResult[1] = rawResult[2] = rawResult[3] = ubx | (uby << 8) | (ubz << 16) | (ubw << 24); store_vector4( inst, machine, result ); } break; case FP_OPCODE_POW: { GLfloat a[4], b[4], result[4]; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector1( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = result[1] = result[2] = result[3] = (GLfloat)_mesa_pow(a[0], b[0]); store_vector4( inst, machine, result ); } break; case FP_OPCODE_RCP: { GLfloat a[4], result[4]; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); #if DEBUG_FRAG if (a[0] == 0) printf("RCP(0)\n"); else if (IS_INF_OR_NAN(a[0])) printf("RCP(inf)\n"); #endif result[0] = result[1] = result[2] = result[3] = 1.0F / a[0]; store_vector4( inst, machine, result ); } break; case FP_OPCODE_RFL: { GLfloat axis[4], dir[4], result[4], tmp[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, axis ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, dir ); tmp[3] = axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]; tmp[0] = (2.0F * (axis[0] * dir[0] + axis[1] * dir[1] + axis[2] * dir[2])) / tmp[3]; result[0] = tmp[0] * axis[0] - dir[0]; result[1] = tmp[0] * axis[1] - dir[1]; result[2] = tmp[0] * axis[2] - dir[2]; /* result[3] is never written! XXX enforce in parser! */ store_vector4( inst, machine, result ); } break; case FP_OPCODE_RSQ: /* 1 / sqrt() */ { GLfloat a[4], result[4]; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); a[0] = FABSF(a[0]); result[0] = result[1] = result[2] = result[3] = INV_SQRTF(a[0]); store_vector4( inst, machine, result ); #if DEBUG_FRAG printf("RSQ %g = 1/sqrt(|%g|)\n", result[0], a[0]); #endif } break; case FP_OPCODE_SCS: /* sine and cos */ { GLfloat a[4], result[4]; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); result[0] = (GLfloat)cos(a[0]); result[1] = (GLfloat)sin(a[0]); result[2] = 0.0; /* undefined! */ result[3] = 0.0; /* undefined! */ store_vector4( inst, machine, result ); } break; case FP_OPCODE_SEQ: /* set on equal */ { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = (a[0] == b[0]) ? 1.0F : 0.0F; result[1] = (a[1] == b[1]) ? 1.0F : 0.0F; result[2] = (a[2] == b[2]) ? 1.0F : 0.0F; result[3] = (a[3] == b[3]) ? 1.0F : 0.0F; store_vector4( inst, machine, result ); } break; case FP_OPCODE_SFL: /* set false, operands ignored */ { static const GLfloat result[4] = { 0.0F, 0.0F, 0.0F, 0.0F }; store_vector4( inst, machine, result ); } break; case FP_OPCODE_SGE: /* set on greater or equal */ { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = (a[0] >= b[0]) ? 1.0F : 0.0F; result[1] = (a[1] >= b[1]) ? 1.0F : 0.0F; result[2] = (a[2] >= b[2]) ? 1.0F : 0.0F; result[3] = (a[3] >= b[3]) ? 1.0F : 0.0F; store_vector4( inst, machine, result ); } break; case FP_OPCODE_SGT: /* set on greater */ { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = (a[0] > b[0]) ? 1.0F : 0.0F; result[1] = (a[1] > b[1]) ? 1.0F : 0.0F; result[2] = (a[2] > b[2]) ? 1.0F : 0.0F; result[3] = (a[3] > b[3]) ? 1.0F : 0.0F; store_vector4( inst, machine, result ); } break; case FP_OPCODE_SIN: { GLfloat a[4], result[4]; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); result[0] = result[1] = result[2] = result[3] = (GLfloat)_mesa_sin(a[0]); store_vector4( inst, machine, result ); } break; case FP_OPCODE_SLE: /* set on less or equal */ { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = (a[0] <= b[0]) ? 1.0F : 0.0F; result[1] = (a[1] <= b[1]) ? 1.0F : 0.0F; result[2] = (a[2] <= b[2]) ? 1.0F : 0.0F; result[3] = (a[3] <= b[3]) ? 1.0F : 0.0F; store_vector4( inst, machine, result ); } break; case FP_OPCODE_SLT: /* set on less */ { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = (a[0] < b[0]) ? 1.0F : 0.0F; result[1] = (a[1] < b[1]) ? 1.0F : 0.0F; result[2] = (a[2] < b[2]) ? 1.0F : 0.0F; result[3] = (a[3] < b[3]) ? 1.0F : 0.0F; store_vector4( inst, machine, result ); } break; case FP_OPCODE_SNE: /* set on not equal */ { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = (a[0] != b[0]) ? 1.0F : 0.0F; result[1] = (a[1] != b[1]) ? 1.0F : 0.0F; result[2] = (a[2] != b[2]) ? 1.0F : 0.0F; result[3] = (a[3] != b[3]) ? 1.0F : 0.0F; store_vector4( inst, machine, result ); } break; case FP_OPCODE_STR: /* set true, operands ignored */ { static const GLfloat result[4] = { 1.0F, 1.0F, 1.0F, 1.0F }; store_vector4( inst, machine, result ); } break; case FP_OPCODE_SUB: { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = a[0] - b[0]; result[1] = a[1] - b[1]; result[2] = a[2] - b[2]; result[3] = a[3] - b[3]; store_vector4( inst, machine, result ); } break; case FP_OPCODE_SWZ: { const struct fp_src_register *source = &inst->SrcReg[0]; const GLfloat *src = get_register_pointer(ctx, source, machine, program); GLfloat result[4]; GLuint i; /* do extended swizzling here */ for (i = 0; i < 4; i++) { if (GET_SWZ(source->Swizzle, i) == SWIZZLE_ZERO) result[i] = 0.0; else if (GET_SWZ(source->Swizzle, i) == SWIZZLE_ONE) result[i] = 1.0; else result[i] = src[GET_SWZ(source->Swizzle, i)]; if (source->NegateBase & (1 << i)) result[i] = -result[i]; } store_vector4( inst, machine, result ); } break; case FP_OPCODE_TEX: /* Both ARB and NV frag prog */ /* Texel lookup */ { GLfloat texcoord[4], color[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, texcoord ); /* Note: we pass 0 for LOD. The ARB extension requires it * while the NV extension says it's implementation dependant. */ /* KW: Previously lambda was passed as zero, but I * believe this is incorrect, the spec seems to * indicate rather that lambda should not be * changed/biased, unlike TXB where texcoord[3] is * added to the lambda calculations. The lambda should * still be calculated normally for TEX & TXP though, * not set to zero. Otherwise it's very difficult to * implement normal GL semantics through the fragment * shader. */ fetch_texel( ctx, texcoord, span->array->lambda[inst->TexSrcUnit][column], inst->TexSrcUnit, color ); store_vector4( inst, machine, color ); } break; case FP_OPCODE_TXB: /* GL_ARB_fragment_program only */ /* Texel lookup with LOD bias */ { GLfloat texcoord[4], color[4], bias, lambda; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, texcoord ); /* texcoord[3] is the bias to add to lambda */ bias = ctx->Texture.Unit[inst->TexSrcUnit].LodBias + ctx->Texture.Unit[inst->TexSrcUnit]._Current->LodBias + texcoord[3]; lambda = span->array->lambda[inst->TexSrcUnit][column] + bias; fetch_texel( ctx, texcoord, lambda, inst->TexSrcUnit, color ); store_vector4( inst, machine, color ); } break; case FP_OPCODE_TXD: /* GL_NV_fragment_program only */ /* Texture lookup w/ partial derivatives for LOD */ { GLfloat texcoord[4], dtdx[4], dtdy[4], color[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, texcoord ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, dtdx ); fetch_vector4( ctx, &inst->SrcReg[2], machine, program, dtdy ); fetch_texel_deriv( ctx, texcoord, dtdx, dtdy, inst->TexSrcUnit, color ); store_vector4( inst, machine, color ); } break; case FP_OPCODE_TXP: /* GL_ARB_fragment_program only */ /* Texture lookup w/ projective divide */ { GLfloat texcoord[4], color[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, texcoord ); /* Not so sure about this test - if texcoord[3] is * zero, we'd probably be fine except for an ASSERT in * IROUND_POS() which gets triggered by the inf values created. */ if (texcoord[3] != 0.0) { texcoord[0] /= texcoord[3]; texcoord[1] /= texcoord[3]; texcoord[2] /= texcoord[3]; } /* KW: Previously lambda was passed as zero, but I * believe this is incorrect, the spec seems to * indicate rather that lambda should not be * changed/biased, unlike TXB where texcoord[3] is * added to the lambda calculations. The lambda should * still be calculated normally for TEX & TXP though, * not set to zero. */ fetch_texel( ctx, texcoord, span->array->lambda[inst->TexSrcUnit][column], inst->TexSrcUnit, color ); store_vector4( inst, machine, color ); } break; case FP_OPCODE_TXP_NV: /* GL_NV_fragment_program only */ /* Texture lookup w/ projective divide */ { GLfloat texcoord[4], color[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, texcoord ); if (inst->TexSrcIdx != TEXTURE_CUBE_INDEX && texcoord[3] != 0.0) { texcoord[0] /= texcoord[3]; texcoord[1] /= texcoord[3]; texcoord[2] /= texcoord[3]; } fetch_texel( ctx, texcoord, span->array->lambda[inst->TexSrcUnit][column], inst->TexSrcUnit, color ); store_vector4( inst, machine, color ); } break; case FP_OPCODE_UP2H: /* unpack two 16-bit floats */ { GLfloat a[4], result[4]; const GLuint *rawBits = (const GLuint *) a; GLhalfNV hx, hy; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); hx = rawBits[0] & 0xffff; hy = rawBits[0] >> 16; result[0] = result[2] = _mesa_half_to_float(hx); result[1] = result[3] = _mesa_half_to_float(hy); store_vector4( inst, machine, result ); } break; case FP_OPCODE_UP2US: /* unpack two GLushorts */ { GLfloat a[4], result[4]; const GLuint *rawBits = (const GLuint *) a; GLushort usx, usy; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); usx = rawBits[0] & 0xffff; usy = rawBits[0] >> 16; result[0] = result[2] = usx * (1.0f / 65535.0f); result[1] = result[3] = usy * (1.0f / 65535.0f); store_vector4( inst, machine, result ); } break; case FP_OPCODE_UP4B: /* unpack four GLbytes */ { GLfloat a[4], result[4]; const GLuint *rawBits = (const GLuint *) a; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); result[0] = (((rawBits[0] >> 0) & 0xff) - 128) / 127.0F; result[1] = (((rawBits[0] >> 8) & 0xff) - 128) / 127.0F; result[2] = (((rawBits[0] >> 16) & 0xff) - 128) / 127.0F; result[3] = (((rawBits[0] >> 24) & 0xff) - 128) / 127.0F; store_vector4( inst, machine, result ); } break; case FP_OPCODE_UP4UB: /* unpack four GLubytes */ { GLfloat a[4], result[4]; const GLuint *rawBits = (const GLuint *) a; fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a ); result[0] = ((rawBits[0] >> 0) & 0xff) / 255.0F; result[1] = ((rawBits[0] >> 8) & 0xff) / 255.0F; result[2] = ((rawBits[0] >> 16) & 0xff) / 255.0F; result[3] = ((rawBits[0] >> 24) & 0xff) / 255.0F; store_vector4( inst, machine, result ); } break; case FP_OPCODE_XPD: /* cross product */ { GLfloat a[4], b[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); result[0] = a[1] * b[2] - a[2] * b[1]; result[1] = a[2] * b[0] - a[0] * b[2]; result[2] = a[0] * b[1] - a[1] * b[0]; result[3] = 1.0; store_vector4( inst, machine, result ); } break; case FP_OPCODE_X2D: /* 2-D matrix transform */ { GLfloat a[4], b[4], c[4], result[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a ); fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b ); fetch_vector4( ctx, &inst->SrcReg[2], machine, program, c ); result[0] = a[0] + b[0] * c[0] + b[1] * c[1]; result[1] = a[1] + b[0] * c[2] + b[1] * c[3]; result[2] = a[2] + b[0] * c[0] + b[1] * c[1]; result[3] = a[3] + b[0] * c[2] + b[1] * c[3]; store_vector4( inst, machine, result ); } break; case FP_OPCODE_PRINT: { if (inst->SrcReg[0].File != -1) { GLfloat a[4]; fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a); _mesa_printf("%s%g, %g, %g, %g\n", (const char *) inst->Data, a[0], a[1], a[2], a[3]); } else { _mesa_printf("%s\n", (const char *) inst->Data); } } break; case FP_OPCODE_END: return GL_TRUE; default: _mesa_problem(ctx, "Bad opcode %d in _mesa_exec_fragment_program", inst->Opcode); return GL_TRUE; /* return value doesn't matter */ } } return GL_TRUE; } static void init_machine( GLcontext *ctx, struct fp_machine *machine, const struct fragment_program *program, const struct sw_span *span, GLuint col ) { GLuint inputsRead = program->InputsRead; GLuint u; if (ctx->FragmentProgram.CallbackEnabled) inputsRead = ~0; if (program->Base.Target == GL_FRAGMENT_PROGRAM_NV) { /* Clear temporary registers (undefined for ARB_f_p) */ _mesa_bzero(machine->Temporaries, MAX_NV_FRAGMENT_PROGRAM_TEMPS * 4 * sizeof(GLfloat)); } /* Load input registers */ if (inputsRead & (1 << FRAG_ATTRIB_WPOS)) { GLfloat *wpos = machine->Inputs[FRAG_ATTRIB_WPOS]; ASSERT(span->arrayMask & SPAN_Z); wpos[0] = (GLfloat) span->x + col; wpos[1] = (GLfloat) span->y; wpos[2] = (GLfloat) span->array->z[col] / ctx->DrawBuffer->_DepthMaxF; wpos[3] = span->w + col * span->dwdx; } if (inputsRead & (1 << FRAG_ATTRIB_COL0)) { GLfloat *col0 = machine->Inputs[FRAG_ATTRIB_COL0]; ASSERT(span->arrayMask & SPAN_RGBA); col0[0] = CHAN_TO_FLOAT(span->array->rgba[col][RCOMP]); col0[1] = CHAN_TO_FLOAT(span->array->rgba[col][GCOMP]); col0[2] = CHAN_TO_FLOAT(span->array->rgba[col][BCOMP]); col0[3] = CHAN_TO_FLOAT(span->array->rgba[col][ACOMP]); } if (inputsRead & (1 << FRAG_ATTRIB_COL1)) { GLfloat *col1 = machine->Inputs[FRAG_ATTRIB_COL1]; col1[0] = CHAN_TO_FLOAT(span->array->spec[col][RCOMP]); col1[1] = CHAN_TO_FLOAT(span->array->spec[col][GCOMP]); col1[2] = CHAN_TO_FLOAT(span->array->spec[col][BCOMP]); col1[3] = CHAN_TO_FLOAT(span->array->spec[col][ACOMP]); } if (inputsRead & (1 << FRAG_ATTRIB_FOGC)) { GLfloat *fogc = machine->Inputs[FRAG_ATTRIB_FOGC]; ASSERT(span->arrayMask & SPAN_FOG); fogc[0] = span->array->fog[col]; fogc[1] = 0.0F; fogc[2] = 0.0F; fogc[3] = 0.0F; } for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) { if (inputsRead & (1 << (FRAG_ATTRIB_TEX0 + u))) { GLfloat *tex = machine->Inputs[FRAG_ATTRIB_TEX0 + u]; /*ASSERT(ctx->Texture._EnabledCoordUnits & (1 << u));*/ COPY_4V(tex, span->array->texcoords[u][col]); /*ASSERT(tex[0] != 0 || tex[1] != 0 || tex[2] != 0);*/ } } /* init condition codes */ machine->CondCodes[0] = COND_EQ; machine->CondCodes[1] = COND_EQ; machine->CondCodes[2] = COND_EQ; machine->CondCodes[3] = COND_EQ; } /** * Execute the current fragment program, operating on the given span. */ void _swrast_exec_fragment_program( GLcontext *ctx, struct sw_span *span ) { const struct fragment_program *program = ctx->FragmentProgram._Current; GLuint i; ctx->_CurrentProgram = GL_FRAGMENT_PROGRAM_ARB; /* or NV, doesn't matter */ if (program->Parameters) { _mesa_load_state_parameters(ctx, program->Parameters); } for (i = 0; i < span->end; i++) { if (span->array->mask[i]) { init_machine(ctx, &ctx->FragmentProgram.Machine, ctx->FragmentProgram._Current, span, i); #ifdef USE_TCC if (!_swrast_execute_codegen_program(ctx, program, ~0, &ctx->FragmentProgram.Machine, span, i)) { span->array->mask[i] = GL_FALSE; /* killed fragment */ span->writeAll = GL_FALSE; } #else if (!execute_program(ctx, program, ~0, &ctx->FragmentProgram.Machine, span, i)) { span->array->mask[i] = GL_FALSE; /* killed fragment */ span->writeAll = GL_FALSE; } #endif /* Store output registers */ { const GLfloat *colOut = ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_COLR]; UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][RCOMP], colOut[0]); UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][GCOMP], colOut[1]); UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][BCOMP], colOut[2]); UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][ACOMP], colOut[3]); } /* depth value */ if (program->OutputsWritten & (1 << FRAG_OUTPUT_DEPR)) { const GLfloat depth = ctx->FragmentProgram.Machine.Outputs[FRAG_OUTPUT_DEPR][2]; span->array->z[i] = IROUND(depth * ctx->DrawBuffer->_DepthMaxF); } } } if (program->OutputsWritten & (1 << FRAG_OUTPUT_DEPR)) { span->interpMask &= ~SPAN_Z; span->arrayMask |= SPAN_Z; } ctx->_CurrentProgram = 0; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_nvfragprog.h0000644000000000000000000000247013614532424021411 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_NVFRAGPROG_H #define S_NVFRAGPROG_H #include "s_context.h" extern void _swrast_exec_fragment_program( GLcontext *ctx, struct sw_span *span ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_pixeltex.c0000644000000000000000000000705613614532424021100 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * This file implements both the GL_SGIX_pixel_texture and * GL_SIGS_pixel_texture extensions. Luckily, they pretty much * overlap in functionality so we use the same state variables * and execution code for both. */ #include "glheader.h" #include "colormac.h" #include "imports.h" #include "s_context.h" #include "s_pixeltex.h" #include "s_texture.h" /* * Convert RGBA values into strq texture coordinates. */ static void pixeltexgen(GLcontext *ctx, GLuint n, const GLchan rgba[][4], GLfloat texcoord[][4]) { if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_COLOR) { GLuint i; for (i = 0; i < n; i++) { texcoord[i][0] = ctx->Current.RasterColor[RCOMP]; texcoord[i][1] = ctx->Current.RasterColor[GCOMP]; texcoord[i][2] = ctx->Current.RasterColor[BCOMP]; } } else { GLuint i; ASSERT(ctx->Pixel.FragmentRgbSource == GL_PIXEL_GROUP_COLOR_SGIS); for (i = 0; i < n; i++) { texcoord[i][0] = CHAN_TO_FLOAT(rgba[i][RCOMP]); texcoord[i][1] = CHAN_TO_FLOAT(rgba[i][GCOMP]); texcoord[i][2] = CHAN_TO_FLOAT(rgba[i][BCOMP]); } } if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_COLOR) { GLuint i; for (i = 0; i < n; i++) { texcoord[i][3] = ctx->Current.RasterColor[ACOMP]; } } else { GLuint i; ASSERT(ctx->Pixel.FragmentAlphaSource == GL_PIXEL_GROUP_COLOR_SGIS); for (i = 0; i < n; i++) { texcoord[i][3] = CHAN_TO_FLOAT(rgba[i][ACOMP]); } } } /* * Used by glDraw/CopyPixels: the incoming image colors are treated * as texture coordinates. Use those coords to texture the image. * This is for GL_SGIS_pixel_texture / GL_SGIX_pixel_texture. */ void _swrast_pixel_texture(GLcontext *ctx, struct sw_span *span) { GLuint unit; ASSERT(!(span->arrayMask & SPAN_TEXTURE)); span->arrayMask |= SPAN_TEXTURE; span->interpMask &= ~SPAN_TEXTURE; /* convert colors into texture coordinates */ pixeltexgen( ctx, span->end, (const GLchan (*)[4]) span->array->rgba, span->array->texcoords[0] ); /* copy the new texture units for all enabled units */ for (unit = 1; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled) { MEMCPY( span->array->texcoords[unit], span->array->texcoords[0], span->end * 4 * sizeof(GLfloat) ); } } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_pixeltex.h0000644000000000000000000000247313614532424021103 0ustar /* * Mesa 3-D graphics library * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_PIXELTEX_H #define S_PIXELTEX_H #include "mtypes.h" #include "swrast.h" extern void _swrast_pixel_texture(GLcontext *ctx, struct sw_span *span); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_points.c0000644000000000000000000001454313614532424020551 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "macros.h" #include "texstate.h" #include "s_context.h" #include "s_feedback.h" #include "s_points.h" #include "s_span.h" #define RGBA 0x1 #define INDEX 0x2 #define SMOOTH 0x4 #define TEXTURE 0x8 #define SPECULAR 0x10 #define LARGE 0x20 #define ATTENUATE 0x40 #define SPRITE 0x80 /* * CI points with size == 1.0 */ #define FLAGS (INDEX) #define NAME size1_ci_point #include "s_pointtemp.h" /* * General CI points. */ #define FLAGS (INDEX | LARGE) #define NAME general_ci_point #include "s_pointtemp.h" /* * Antialiased CI points. */ #define FLAGS (INDEX | SMOOTH) #define NAME antialiased_ci_point #include "s_pointtemp.h" /* * Distance attenuated, general CI points. */ #define FLAGS (INDEX | ATTENUATE) #define NAME atten_general_ci_point #include "s_pointtemp.h" /* * RGBA points with size == 1.0 */ #define FLAGS (RGBA) #define NAME size1_rgba_point #include "s_pointtemp.h" /* * General RGBA points. */ #define FLAGS (RGBA | LARGE) #define NAME general_rgba_point #include "s_pointtemp.h" /* * Antialiased RGBA points. */ #define FLAGS (RGBA | SMOOTH) #define NAME antialiased_rgba_point #include "s_pointtemp.h" /* * Textured RGBA points. */ #define FLAGS (RGBA | LARGE | TEXTURE | SPECULAR) #define NAME textured_rgba_point #include "s_pointtemp.h" /* * Antialiased points with texture mapping. */ #define FLAGS (RGBA | SMOOTH | TEXTURE | SPECULAR) #define NAME antialiased_tex_rgba_point #include "s_pointtemp.h" /* * Distance attenuated, general RGBA points. */ #define FLAGS (RGBA | ATTENUATE) #define NAME atten_general_rgba_point #include "s_pointtemp.h" /* * Distance attenuated, textured RGBA points. */ #define FLAGS (RGBA | ATTENUATE | TEXTURE | SPECULAR) #define NAME atten_textured_rgba_point #include "s_pointtemp.h" /* * Distance attenuated, antialiased points with or without texture mapping. */ #define FLAGS (RGBA | ATTENUATE | TEXTURE | SMOOTH) #define NAME atten_antialiased_rgba_point #include "s_pointtemp.h" /* * Sprite (textured point) */ #define FLAGS (RGBA | SPRITE | SPECULAR) #define NAME sprite_point #include "s_pointtemp.h" #define FLAGS (RGBA | SPRITE | SPECULAR | ATTENUATE) #define NAME atten_sprite_point #include "s_pointtemp.h" void _swrast_add_spec_terms_point( GLcontext *ctx, const SWvertex *v0 ) { SWvertex *ncv0 = (SWvertex *)v0; GLchan c[1][4]; COPY_CHAN4( c[0], ncv0->color ); ACC_3V( ncv0->color, ncv0->specular ); SWRAST_CONTEXT(ctx)->SpecPoint( ctx, ncv0 ); COPY_CHAN4( ncv0->color, c[0] ); } /* record the current point function name */ #ifdef DEBUG static const char *pntFuncName = NULL; #define USE(pntFunc) \ do { \ pntFuncName = #pntFunc; \ /*printf("%s\n", pntFuncName);*/ \ swrast->Point = pntFunc; \ } while (0) #else #define USE(pntFunc) swrast->Point = pntFunc #endif /* * Examine the current context to determine which point drawing function * should be used. */ void _swrast_choose_point( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLboolean rgbMode = ctx->Visual.rgbMode; if (ctx->RenderMode==GL_RENDER) { if (ctx->Point.PointSprite) { /* GL_ARB_point_sprite / GL_NV_point_sprite */ /* XXX this might not be good enough */ if (ctx->Point._Attenuated) USE(atten_sprite_point); else USE(sprite_point); } else if (ctx->Point.SmoothFlag) { /* Smooth points */ if (rgbMode) { if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) { USE(atten_antialiased_rgba_point); } else if (ctx->Texture._EnabledCoordUnits) { USE(antialiased_tex_rgba_point); } else { USE(antialiased_rgba_point); } } else { USE(antialiased_ci_point); } } else if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) { if (rgbMode) { if (ctx->Texture._EnabledCoordUnits) { if (ctx->Point.SmoothFlag) { USE(atten_antialiased_rgba_point); } else { USE(atten_textured_rgba_point); } } else { USE(atten_general_rgba_point); } } else { /* ci, atten */ USE(atten_general_ci_point); } } else if (ctx->Texture._EnabledCoordUnits && rgbMode) { /* textured */ USE(textured_rgba_point); } else if (ctx->Point._Size != 1.0) { /* large points */ if (rgbMode) { USE(general_rgba_point); } else { USE(general_ci_point); } } else { /* single pixel points */ if (rgbMode) { USE(size1_rgba_point); } else { USE(size1_ci_point); } } } else if (ctx->RenderMode==GL_FEEDBACK) { USE(_swrast_feedback_point); } else { /* GL_SELECT mode */ USE(_swrast_select_point); } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_points.h0000644000000000000000000000254613614532424020556 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_POINTS_H #define S_POINTS_H #include "mtypes.h" extern void _swrast_choose_point( GLcontext *ctx ); extern void _swrast_add_spec_terms_point( GLcontext *ctx, const SWvertex *v0 ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_pointtemp.h0000644000000000000000000003124713614532424021261 0ustar /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Regarding GL_NV_point_sprite: * * Portions of this software may use or implement intellectual * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims * any and all warranties with respect to such intellectual property, * including any use thereof or modifications thereto. */ /* * Point rendering template code. * * Set FLAGS = bitwise-OR of the following tokens: * * RGBA = do rgba instead of color index * SMOOTH = do antialiasing * TEXTURE = do texture coords * SPECULAR = do separate specular color * LARGE = do points with diameter > 1 pixel * ATTENUATE = compute point size attenuation * SPRITE = GL_ARB_point_sprite / GL_NV_point_sprite * * Notes: LARGE and ATTENUATE are exclusive of each other. * TEXTURE requires RGBA */ /* * NOTES on antialiased point rasterization: * * Let d = distance of fragment center from vertex. * if d < rmin2 then * fragment has 100% coverage * else if d > rmax2 then * fragment has 0% coverage * else * fragment has % coverage = (d - rmin2) / (rmax2 - rmin2) */ static void NAME ( GLcontext *ctx, const SWvertex *vert ) { #if FLAGS & (ATTENUATE | LARGE | SMOOTH | SPRITE) GLfloat size; #endif #if FLAGS & RGBA #if (FLAGS & ATTENUATE) && (FLAGS & SMOOTH) GLfloat alphaAtten; #endif const GLchan red = vert->color[0]; const GLchan green = vert->color[1]; const GLchan blue = vert->color[2]; const GLchan alpha = vert->color[3]; #endif #if FLAGS & SPECULAR const GLchan specRed = vert->specular[0]; const GLchan specGreen = vert->specular[1]; const GLchan specBlue = vert->specular[2]; #endif #if FLAGS & INDEX const GLuint colorIndex = (GLuint) vert->index; /* XXX round? */ #endif #if FLAGS & TEXTURE GLfloat texcoord[MAX_TEXTURE_COORD_UNITS][4]; GLuint u; #endif SWcontext *swrast = SWRAST_CONTEXT(ctx); struct sw_span *span = &(swrast->PointSpan); /* Cull primitives with malformed coordinates. */ { float tmp = vert->win[0] + vert->win[1]; if (IS_INF_OR_NAN(tmp)) return; } /* * Span init */ span->interpMask = SPAN_FOG; span->arrayMask = SPAN_XY | SPAN_Z; span->fog = vert->fog; span->fogStep = 0.0; #if FLAGS & RGBA span->arrayMask |= SPAN_RGBA; #endif #if FLAGS & SPECULAR span->arrayMask |= SPAN_SPEC; #endif #if FLAGS & INDEX span->arrayMask |= SPAN_INDEX; #endif #if FLAGS & TEXTURE span->arrayMask |= SPAN_TEXTURE; if (ctx->FragmentProgram._Active) { /* Don't divide texture s,t,r by q (use TXP to do that) */ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture._EnabledCoordUnits & (1 << u)) { COPY_4V(texcoord[u], vert->texcoord[u]); } } } else { /* Divide texture s,t,r by q here */ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture._EnabledCoordUnits & (1 << u)) { const GLfloat q = vert->texcoord[u][3]; const GLfloat invQ = (q == 0.0F || q == 1.0F) ? 1.0F : (1.0F / q); texcoord[u][0] = vert->texcoord[u][0] * invQ; texcoord[u][1] = vert->texcoord[u][1] * invQ; texcoord[u][2] = vert->texcoord[u][2] * invQ; texcoord[u][3] = q; } } } /* need these for fragment programs */ span->w = 1.0F; span->dwdx = 0.0F; span->dwdy = 0.0F; #endif #if FLAGS & SMOOTH span->arrayMask |= SPAN_COVERAGE; #endif #if FLAGS & SPRITE span->arrayMask |= SPAN_TEXTURE; #endif /* Compute point size if not known to be one */ #if FLAGS & ATTENUATE /* first, clamp attenuated size to the user-specifed range */ size = CLAMP(vert->pointSize, ctx->Point.MinSize, ctx->Point.MaxSize); #if (FLAGS & RGBA) && (FLAGS & SMOOTH) /* only if multisampling, compute the fade factor */ if (ctx->Multisample.Enabled) { if (vert->pointSize >= ctx->Point.Threshold) { alphaAtten = 1.0F; } else { GLfloat dsize = vert->pointSize / ctx->Point.Threshold; alphaAtten = dsize * dsize; } } else { alphaAtten = 1.0; } #endif #elif FLAGS & (LARGE | SMOOTH | SPRITE) /* constant, non-attenuated size */ size = ctx->Point._Size; /* this is already clamped */ #endif #if FLAGS & (ATTENUATE | LARGE | SMOOTH | SPRITE) /*** *** Multi-pixel points ***/ /* do final clamping now */ if (ctx->Point.SmoothFlag) { size = CLAMP(size, ctx->Const.MinPointSizeAA, ctx->Const.MaxPointSizeAA); } else { size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); } {{ GLint x, y; const GLfloat radius = 0.5F * size; const GLint z = (GLint) (vert->win[2] + 0.5F); GLuint count; #if FLAGS & SMOOTH const GLfloat rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ const GLfloat rmax = radius + 0.7071F; const GLfloat rmin2 = MAX2(0.0F, rmin * rmin); const GLfloat rmax2 = rmax * rmax; const GLfloat cscale = 1.0F / (rmax2 - rmin2); const GLint xmin = (GLint) (vert->win[0] - radius); const GLint xmax = (GLint) (vert->win[0] + radius); const GLint ymin = (GLint) (vert->win[1] - radius); const GLint ymax = (GLint) (vert->win[1] + radius); #else /* non-smooth */ GLint xmin, xmax, ymin, ymax; GLint iSize = (GLint) (size + 0.5F); GLint iRadius; iSize = MAX2(1, iSize); iRadius = iSize / 2; if (iSize & 1) { /* odd size */ xmin = (GLint) (vert->win[0] - iRadius); xmax = (GLint) (vert->win[0] + iRadius); ymin = (GLint) (vert->win[1] - iRadius); ymax = (GLint) (vert->win[1] + iRadius); } else { /* even size */ xmin = (GLint) vert->win[0] - iRadius + 1; xmax = xmin + iSize - 1; ymin = (GLint) vert->win[1] - iRadius + 1; ymax = ymin + iSize - 1; } #endif /*SMOOTH*/ /* check if we need to flush */ if (span->end + (xmax-xmin+1) * (ymax-ymin+1) >= MAX_WIDTH || (swrast->_RasterMask & (BLEND_BIT | LOGIC_OP_BIT | MASKING_BIT))) { #if FLAGS & RGBA _swrast_write_rgba_span(ctx, span); #else _swrast_write_index_span(ctx, span); #endif span->end = 0; } /* * OK, generate fragments */ count = span->end; (void) radius; for (y = ymin; y <= ymax; y++) { /* check if we need to flush */ if (count + (xmax-xmin+1) >= MAX_WIDTH) { span->end = count; #if FLAGS & RGBA _swrast_write_rgba_span(ctx, span); #else _swrast_write_index_span(ctx, span); #endif count = span->end = 0; } for (x = xmin; x <= xmax; x++) { #if FLAGS & (SPRITE | TEXTURE) GLuint u; #endif #if FLAGS & RGBA span->array->rgba[count][RCOMP] = red; span->array->rgba[count][GCOMP] = green; span->array->rgba[count][BCOMP] = blue; span->array->rgba[count][ACOMP] = alpha; #endif #if FLAGS & SPECULAR span->array->spec[count][RCOMP] = specRed; span->array->spec[count][GCOMP] = specGreen; span->array->spec[count][BCOMP] = specBlue; #endif #if FLAGS & INDEX span->array->index[count] = colorIndex; #endif #if FLAGS & TEXTURE for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture._EnabledCoordUnits & (1 << u)) { COPY_4V(span->array->texcoords[u][count], texcoord[u]); } } #endif #if FLAGS & SMOOTH /* compute coverage */ { const GLfloat dx = x - vert->win[0] + 0.5F; const GLfloat dy = y - vert->win[1] + 0.5F; const GLfloat dist2 = dx * dx + dy * dy; if (dist2 < rmax2) { if (dist2 >= rmin2) { /* compute partial coverage */ span->array->coverage[count] = 1.0F - (dist2 - rmin2) * cscale; #if FLAGS & INDEX /* coverage in [0,15] */ span->array->coverage[count] *= 15.0; #endif } else { /* full coverage */ span->array->coverage[count] = 1.0F; } span->array->x[count] = x; span->array->y[count] = y; span->array->z[count] = z; #if (FLAGS & ATTENUATE) && (FLAGS & RGBA) span->array->rgba[count][ACOMP] = (GLchan) (alpha * alphaAtten); #elif FLAGS & RGBA span->array->rgba[count][ACOMP] = alpha; #endif /*ATTENUATE*/ count++; } /*if*/ } #else /*SMOOTH*/ /* not smooth (square points) */ span->array->x[count] = x; span->array->y[count] = y; span->array->z[count] = z; #if FLAGS & SPRITE for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture.Unit[u]._ReallyEnabled) { if (ctx->Point.CoordReplace[u]) { GLfloat s = 0.5F + (x + 0.5F - vert->win[0]) / size; GLfloat t, r; if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT) t = 0.5F + (y + 0.5F - vert->win[1]) / size; else /* GL_UPPER_LEFT */ t = 0.5F - (y + 0.5F - vert->win[1]) / size; if (ctx->Point.SpriteRMode == GL_ZERO) r = 0.0F; else if (ctx->Point.SpriteRMode == GL_S) r = vert->texcoord[u][0]; else /* GL_R */ r = vert->texcoord[u][2]; span->array->texcoords[u][count][0] = s; span->array->texcoords[u][count][1] = t; span->array->texcoords[u][count][2] = r; span->array->texcoords[u][count][3] = 1.0F; } else { COPY_4V(span->array->texcoords[u][count], vert->texcoord[u]); } } } #endif /*SPRITE*/ count++; /* square point */ #endif /*SMOOTH*/ } /*for x*/ } /*for y*/ span->end = count; }} #else /* LARGE | ATTENUATE | SMOOTH | SPRITE */ /*** *** Single-pixel points ***/ {{ GLuint count; /* check if we need to flush */ if (span->end >= MAX_WIDTH || (swrast->_RasterMask & (BLEND_BIT | LOGIC_OP_BIT | MASKING_BIT))) { #if FLAGS & RGBA _swrast_write_rgba_span(ctx, span); #else _swrast_write_index_span(ctx, span); #endif span->end = 0; } count = span->end; #if FLAGS & RGBA span->array->rgba[count][RCOMP] = red; span->array->rgba[count][GCOMP] = green; span->array->rgba[count][BCOMP] = blue; span->array->rgba[count][ACOMP] = alpha; #endif #if FLAGS & SPECULAR span->array->spec[count][RCOMP] = specRed; span->array->spec[count][GCOMP] = specGreen; span->array->spec[count][BCOMP] = specBlue; #endif #if FLAGS & INDEX span->array->index[count] = colorIndex; #endif #if FLAGS & TEXTURE for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture.Unit[u]._ReallyEnabled) { COPY_4V(span->array->texcoords[u][count], texcoord[u]); } } #endif span->array->x[count] = (GLint) vert->win[0]; span->array->y[count] = (GLint) vert->win[1]; span->array->z[count] = (GLint) (vert->win[2] + 0.5F); span->end = count + 1; }} #endif /* LARGE || ATTENUATE || SMOOTH */ ASSERT(span->end <= MAX_WIDTH); } #undef FLAGS #undef NAME nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_readpix.c0000644000000000000000000004545113614532424020673 0ustar /* * Mesa 3-D graphics library * Version: 6.4.1 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "bufferobj.h" #include "colormac.h" #include "convolve.h" #include "context.h" #include "feedback.h" #include "image.h" #include "macros.h" #include "imports.h" #include "pixel.h" #include "s_context.h" #include "s_depth.h" #include "s_span.h" #include "s_stencil.h" /* * Read a block of color index pixels. */ static void read_index_pixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum type, GLvoid *pixels, const struct gl_pixelstore_attrib *packing ) { struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; /* SWcontext *swrast = SWRAST_CONTEXT(ctx); */ GLint i, readWidth; /* error checking */ if (ctx->Visual.rgbMode) { _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels" ); return; } if (type != GL_BYTE && type != GL_UNSIGNED_BYTE && type != GL_SHORT && type != GL_UNSIGNED_SHORT && type != GL_INT && type != GL_UNSIGNED_INT && type != GL_FLOAT) { _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels(index type)"); return; } _swrast_use_read_buffer(ctx); /* XXX: width should never be > MAX_WIDTH since we did clipping earlier */ readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; /* process image row by row */ for (i = 0; i < height; i++) { GLuint index[MAX_WIDTH]; GLvoid *dest; ASSERT(rb->DataType == GL_UNSIGNED_INT); rb->GetRow(ctx, rb, readWidth, x, y + i, index); dest = _mesa_image_address2d(packing, pixels, width, height, GL_COLOR_INDEX, type, i, 0); _mesa_pack_index_span(ctx, readWidth, type, dest, index, &ctx->Pack, ctx->_ImageTransferState); } _swrast_use_draw_buffer(ctx); } /** * Read pixels for format=GL_DEPTH_COMPONENT. */ static void read_depth_pixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum type, GLvoid *pixels, const struct gl_pixelstore_attrib *packing ) { struct gl_renderbuffer *rb = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; GLint readWidth; GLboolean bias_or_scale; /* Error checking */ if (ctx->ReadBuffer->Visual.depthBits <= 0 || !rb) { /* No depth buffer */ _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels" ); return; } if (type != GL_BYTE && type != GL_UNSIGNED_BYTE && type != GL_SHORT && type != GL_UNSIGNED_SHORT && type != GL_INT && type != GL_UNSIGNED_INT && type != GL_FLOAT) { _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels(depth type)"); return; } /* XXX: width should never be > MAX_WIDTH since we did clipping earlier */ readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0; if (type==GL_UNSIGNED_SHORT && ctx->ReadBuffer->Visual.depthBits == 16 && !bias_or_scale && !packing->SwapBytes) { /* Special case: directly read 16-bit unsigned depth values. */ GLint j; for (j=0;jReadBuffer->Visual.depthBits == 32 && !bias_or_scale && !packing->SwapBytes) { /* Special case: directly read 32-bit unsigned depth values. */ GLint j; for (j=0;jReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer; GLint j, readWidth; if (type != GL_BYTE && type != GL_UNSIGNED_BYTE && type != GL_SHORT && type != GL_UNSIGNED_SHORT && type != GL_INT && type != GL_UNSIGNED_INT && type != GL_FLOAT && type != GL_BITMAP) { _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels(stencil type)"); return; } if (ctx->ReadBuffer->Visual.stencilBits <= 0 || !rb) { /* No stencil buffer */ _mesa_error( ctx, GL_INVALID_OPERATION, "glReadPixels" ); return; } /* XXX: width should never be > MAX_WIDTH since we did clipping earlier */ readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; /* process image row by row */ for (j=0;jReadBuffer->_ColorReadBuffer; /* can't do scale, bias, mapping, etc */ if (ctx->_ImageTransferState) return GL_FALSE; /* can't do fancy pixel packing */ if (packing->Alignment != 1 || packing->SwapBytes || packing->LsbFirst) return GL_FALSE; { GLint srcX = x; GLint srcY = y; GLint readWidth = width; /* actual width read */ GLint readHeight = height; /* actual height read */ GLint skipPixels = packing->SkipPixels; GLint skipRows = packing->SkipRows; GLint rowLength; if (packing->RowLength > 0) rowLength = packing->RowLength; else rowLength = width; /* * Ready to read! * The window region at (destX, destY) of size (readWidth, readHeight) * will be read back. * We'll write pixel data to buffer pointed to by "pixels" but we'll * skip "skipRows" rows and skip "skipPixels" pixels/row. */ #if CHAN_BITS == 8 if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) { #elif CHAN_BITS == 16 if (format == GL_RGBA && type == GL_UNSIGNED_SHORT) { #else if (0) { #endif GLchan *dest = (GLchan *) pixels + (skipRows * rowLength + skipPixels) * 4; GLint row; if (packing->Invert) { /* start at top and go down */ dest += (readHeight - 1) * rowLength * 4; rowLength = -rowLength; } ASSERT(rb->GetRow); for (row=0; rowGetRow(ctx, rb, readWidth, srcX, srcY, dest); dest += rowLength * 4; srcY++; } return GL_TRUE; } else { /* can't do this format/type combination */ return GL_FALSE; } } } /* * Read R, G, B, A, RGB, L, or LA pixels. */ static void read_rgba_pixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels, const struct gl_pixelstore_attrib *packing ) { struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; GLint readWidth; if (!rb) { /* No readbuffer is OK with GL_EXT_framebuffer_object */ return; } /* do error checking on pixel type, format was already checked by caller */ switch (type) { case GL_UNSIGNED_BYTE: case GL_BYTE: case GL_UNSIGNED_SHORT: case GL_SHORT: case GL_UNSIGNED_INT: case GL_INT: case GL_FLOAT: case GL_UNSIGNED_BYTE_3_3_2: case GL_UNSIGNED_BYTE_2_3_3_REV: case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL_UNSIGNED_INT_8_8_8_8: case GL_UNSIGNED_INT_8_8_8_8_REV: case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: /* valid pixel type */ break; case GL_HALF_FLOAT_ARB: if (!ctx->Extensions.ARB_half_float_pixel) { _mesa_error( ctx, GL_INVALID_ENUM, "glReadPixels(type)" ); return; } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glReadPixels(type)" ); return; } if (!_mesa_is_legal_format_and_type(ctx, format, type) || format == GL_INTENSITY) { _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(format or type)"); return; } _swrast_use_read_buffer(ctx); /* Try optimized path first */ if (read_fast_rgba_pixels( ctx, x, y, width, height, format, type, pixels, packing )) { _swrast_use_draw_buffer(ctx); return; /* done! */ } /* XXX: width should never be > MAX_WIDTH since we did clipping earlier */ readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { const GLuint transferOps = ctx->_ImageTransferState; GLfloat *dest, *src, *tmpImage, *convImage; GLint row; tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); if (!tmpImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels"); return; } convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); if (!convImage) { _mesa_free(tmpImage); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels"); return; } /* read full RGBA, FLOAT image */ dest = tmpImage; for (row = 0; row < height; row++, y++) { GLchan rgba[MAX_WIDTH][4]; if (ctx->Visual.rgbMode) { _swrast_read_rgba_span(ctx, rb, readWidth, x, y, rgba); } else { GLuint index[MAX_WIDTH]; ASSERT(rb->DataType == GL_UNSIGNED_INT); rb->GetRow(ctx, rb, readWidth, x, y, index); if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset !=0 ) { _mesa_map_ci(ctx, readWidth, index); } _mesa_map_ci_to_rgba_chan(ctx, readWidth, index, rgba); } _mesa_pack_rgba_span_chan(ctx, readWidth, (const GLchan (*)[4]) rgba, GL_RGBA, GL_FLOAT, dest, &ctx->DefaultPacking, transferOps & IMAGE_PRE_CONVOLUTION_BITS); dest += width * 4; } /* do convolution */ if (ctx->Pixel.Convolution2DEnabled) { _mesa_convolve_2d_image(ctx, &readWidth, &height, tmpImage, convImage); } else { ASSERT(ctx->Pixel.Separable2DEnabled); _mesa_convolve_sep_image(ctx, &readWidth, &height, tmpImage, convImage); } _mesa_free(tmpImage); /* finish transfer ops and pack the resulting image */ src = convImage; for (row = 0; row < height; row++) { GLvoid *dest; dest = _mesa_image_address2d(packing, pixels, readWidth, height, format, type, row, 0); _mesa_pack_rgba_span_float(ctx, readWidth, (const GLfloat (*)[4]) src, format, type, dest, packing, transferOps & IMAGE_POST_CONVOLUTION_BITS); src += readWidth * 4; } } else { /* no convolution */ GLint row; for (row = 0; row < height; row++, y++) { GLchan rgba[MAX_WIDTH][4]; GLvoid *dst; if (ctx->Visual.rgbMode) { _swrast_read_rgba_span(ctx, rb, readWidth, x, y, rgba); } else { GLuint index[MAX_WIDTH]; ASSERT(rb->DataType == GL_UNSIGNED_INT); rb->GetRow(ctx, rb, readWidth, x, y, index); if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset != 0) { _mesa_map_ci(ctx, readWidth, index); } _mesa_map_ci_to_rgba_chan(ctx, readWidth, index, rgba); } dst = _mesa_image_address2d(packing, pixels, width, height, format, type, row, 0); if (ctx->Visual.redBits < CHAN_BITS || ctx->Visual.greenBits < CHAN_BITS || ctx->Visual.blueBits < CHAN_BITS) { /* Requantize the color values into floating point and go from * there. This fixes conformance failures with 16-bit color * buffers, for example. */ DEFMARRAY(GLfloat, rgbaf, MAX_WIDTH, 4); /* mac 32k limitation */ CHECKARRAY(rgbaf, return); /* mac 32k limitation */ _mesa_chan_to_float_span(ctx, readWidth, (CONST GLchan (*)[4]) rgba, rgbaf); _mesa_pack_rgba_span_float(ctx, readWidth, (CONST GLfloat (*)[4]) rgbaf, format, type, dst, packing, ctx->_ImageTransferState); UNDEFARRAY(rgbaf); /* mac 32k limitation */ } else { /* GLubytes are fine */ _mesa_pack_rgba_span_chan(ctx, readWidth, (CONST GLchan (*)[4]) rgba, format, type, dst, packing, ctx->_ImageTransferState); } } } _swrast_use_draw_buffer(ctx); } /** * Software fallback routine for ctx->Driver.ReadPixels(). * We wind up using the swrast->ReadSpan() routines to do the job. */ void _swrast_ReadPixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *packing, GLvoid *pixels ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_pixelstore_attrib clippedPacking; if (swrast->NewState) _swrast_validate_derived( ctx ); /* Do all needed clipping here, so that we can forget about it later */ clippedPacking = *packing; if (clippedPacking.RowLength == 0) { clippedPacking.RowLength = width; } if (!_mesa_clip_readpixels(ctx, &x, &y, &width, &height, &clippedPacking.SkipPixels, &clippedPacking.SkipRows)) { /* The ReadPixels region is totally outside the window bounds */ return; } if (clippedPacking.BufferObj->Name) { /* pack into PBO */ GLubyte *buf; if (!_mesa_validate_pbo_access(2, &clippedPacking, width, height, 1, format, type, pixels)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(invalid PBO access)"); return; } buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, clippedPacking.BufferObj); if (!buf) { /* buffer is already mapped - that's an error */ _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); return; } pixels = ADD_POINTERS(buf, pixels); } RENDER_START(swrast, ctx); switch (format) { case GL_COLOR_INDEX: read_index_pixels(ctx, x, y, width, height, type, pixels, &clippedPacking); break; case GL_STENCIL_INDEX: read_stencil_pixels(ctx, x,y, width,height, type, pixels, &clippedPacking); break; case GL_DEPTH_COMPONENT: read_depth_pixels(ctx, x, y, width, height, type, pixels, &clippedPacking); break; case GL_RED: case GL_GREEN: case GL_BLUE: case GL_ALPHA: case GL_RGB: case GL_LUMINANCE: case GL_LUMINANCE_ALPHA: case GL_RGBA: case GL_BGR: case GL_BGRA: case GL_ABGR_EXT: read_rgba_pixels(ctx, x, y, width, height, format, type, pixels, &clippedPacking); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glReadPixels(format)" ); /* don't return yet, clean-up */ } RENDER_FINISH(swrast, ctx); if (clippedPacking.BufferObj->Name) { /* done with PBO so unmap it now */ ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, clippedPacking.BufferObj); } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_span.c0000644000000000000000000013727413614532424020205 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file swrast/s_span.c * \brief Span processing functions used by all rasterization functions. * This is where all the per-fragment tests are performed * \author Brian Paul */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "macros.h" #include "imports.h" #include "s_atifragshader.h" #include "s_alpha.h" #include "s_blend.h" #include "s_context.h" #include "s_depth.h" #include "s_fog.h" #include "s_logic.h" #include "s_masking.h" #include "s_nvfragprog.h" #include "s_span.h" #include "s_stencil.h" #include "s_texture.h" /** * Init span's Z interpolation values to the RasterPos Z. * Used during setup for glDraw/CopyPixels. */ void _swrast_span_default_z( GLcontext *ctx, struct sw_span *span ) { const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF; if (ctx->DrawBuffer->Visual.depthBits <= 16) span->z = FloatToFixed(ctx->Current.RasterPos[2] * depthMax + 0.5F); else span->z = (GLint) (ctx->Current.RasterPos[2] * depthMax + 0.5F); span->zStep = 0; span->interpMask |= SPAN_Z; } /** * Init span's fog interpolation values to the RasterPos fog. * Used during setup for glDraw/CopyPixels. */ void _swrast_span_default_fog( GLcontext *ctx, struct sw_span *span ) { span->fog = _swrast_z_to_fogfactor(ctx, ctx->Current.RasterDistance); span->fogStep = span->dfogdx = span->dfogdy = 0.0F; span->interpMask |= SPAN_FOG; } /** * Init span's rgba or index interpolation values to the RasterPos color. * Used during setup for glDraw/CopyPixels. */ void _swrast_span_default_color( GLcontext *ctx, struct sw_span *span ) { if (ctx->Visual.rgbMode) { GLchan r, g, b, a; UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterColor[0]); UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.RasterColor[1]); UNCLAMPED_FLOAT_TO_CHAN(b, ctx->Current.RasterColor[2]); UNCLAMPED_FLOAT_TO_CHAN(a, ctx->Current.RasterColor[3]); #if CHAN_TYPE == GL_FLOAT span->red = r; span->green = g; span->blue = b; span->alpha = a; #else span->red = IntToFixed(r); span->green = IntToFixed(g); span->blue = IntToFixed(b); span->alpha = IntToFixed(a); #endif span->redStep = 0; span->greenStep = 0; span->blueStep = 0; span->alphaStep = 0; span->interpMask |= SPAN_RGBA; } else { span->index = FloatToFixed(ctx->Current.RasterIndex); span->indexStep = 0; span->interpMask |= SPAN_INDEX; } } /** * Init span's texcoord interpolation values to the RasterPos texcoords. * Used during setup for glDraw/CopyPixels. */ void _swrast_span_default_texcoords( GLcontext *ctx, struct sw_span *span ) { GLuint i; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { const GLfloat *tc = ctx->Current.RasterTexCoords[i]; if (ctx->FragmentProgram._Active || ctx->ATIFragmentShader._Enabled) { COPY_4V(span->tex[i], tc); } else if (tc[3] > 0.0F) { /* use (s/q, t/q, r/q, 1) */ span->tex[i][0] = tc[0] / tc[3]; span->tex[i][1] = tc[1] / tc[3]; span->tex[i][2] = tc[2] / tc[3]; span->tex[i][3] = 1.0; } else { ASSIGN_4V(span->tex[i], 0.0F, 0.0F, 0.0F, 1.0F); } ASSIGN_4V(span->texStepX[i], 0.0F, 0.0F, 0.0F, 0.0F); ASSIGN_4V(span->texStepY[i], 0.0F, 0.0F, 0.0F, 0.0F); } span->interpMask |= SPAN_TEXTURE; } /* Fill in the span.color.rgba array from the interpolation values */ static void interpolate_colors(GLcontext *ctx, struct sw_span *span) { const GLuint n = span->end; GLchan (*rgba)[4] = span->array->rgba; GLuint i; (void) ctx; ASSERT((span->interpMask & SPAN_RGBA) && !(span->arrayMask & SPAN_RGBA)); if (span->interpMask & SPAN_FLAT) { /* constant color */ GLchan color[4]; color[RCOMP] = FixedToChan(span->red); color[GCOMP] = FixedToChan(span->green); color[BCOMP] = FixedToChan(span->blue); color[ACOMP] = FixedToChan(span->alpha); for (i = 0; i < n; i++) { COPY_CHAN4(span->array->rgba[i], color); } } else { /* interpolate */ #if CHAN_TYPE == GL_FLOAT GLfloat r = span->red; GLfloat g = span->green; GLfloat b = span->blue; GLfloat a = span->alpha; const GLfloat dr = span->redStep; const GLfloat dg = span->greenStep; const GLfloat db = span->blueStep; const GLfloat da = span->alphaStep; #else GLfixed r = span->red; GLfixed g = span->green; GLfixed b = span->blue; GLfixed a = span->alpha; const GLint dr = span->redStep; const GLint dg = span->greenStep; const GLint db = span->blueStep; const GLint da = span->alphaStep; #endif for (i = 0; i < n; i++) { rgba[i][RCOMP] = FixedToChan(r); rgba[i][GCOMP] = FixedToChan(g); rgba[i][BCOMP] = FixedToChan(b); rgba[i][ACOMP] = FixedToChan(a); r += dr; g += dg; b += db; a += da; } } span->arrayMask |= SPAN_RGBA; } /* Fill in the span.color.index array from the interpolation values */ static void interpolate_indexes(GLcontext *ctx, struct sw_span *span) { GLfixed index = span->index; const GLint indexStep = span->indexStep; const GLuint n = span->end; GLuint *indexes = span->array->index; GLuint i; (void) ctx; ASSERT((span->interpMask & SPAN_INDEX) && !(span->arrayMask & SPAN_INDEX)); if ((span->interpMask & SPAN_FLAT) || (indexStep == 0)) { /* constant color */ index = FixedToInt(index); for (i = 0; i < n; i++) { indexes[i] = index; } } else { /* interpolate */ for (i = 0; i < n; i++) { indexes[i] = FixedToInt(index); index += indexStep; } } span->arrayMask |= SPAN_INDEX; span->interpMask &= ~SPAN_INDEX; } /* Fill in the span.->array->spec array from the interpolation values */ static void interpolate_specular(GLcontext *ctx, struct sw_span *span) { (void) ctx; if (span->interpMask & SPAN_FLAT) { /* constant color */ const GLchan r = FixedToChan(span->specRed); const GLchan g = FixedToChan(span->specGreen); const GLchan b = FixedToChan(span->specBlue); GLuint i; for (i = 0; i < span->end; i++) { span->array->spec[i][RCOMP] = r; span->array->spec[i][GCOMP] = g; span->array->spec[i][BCOMP] = b; } } else { /* interpolate */ #if CHAN_TYPE == GL_FLOAT GLfloat r = span->specRed; GLfloat g = span->specGreen; GLfloat b = span->specBlue; #else GLfixed r = span->specRed; GLfixed g = span->specGreen; GLfixed b = span->specBlue; #endif GLuint i; for (i = 0; i < span->end; i++) { span->array->spec[i][RCOMP] = FixedToChan(r); span->array->spec[i][GCOMP] = FixedToChan(g); span->array->spec[i][BCOMP] = FixedToChan(b); r += span->specRedStep; g += span->specGreenStep; b += span->specBlueStep; } } span->arrayMask |= SPAN_SPEC; } /* Fill in the span.array.fog values from the interpolation values */ static void interpolate_fog(const GLcontext *ctx, struct sw_span *span) { GLfloat *fog = span->array->fog; const GLfloat fogStep = span->fogStep; GLfloat fogCoord = span->fog; const GLuint haveW = (span->interpMask & SPAN_W); const GLfloat wStep = haveW ? span->dwdx : 0.0F; GLfloat w = haveW ? span->w : 1.0F; GLuint i; for (i = 0; i < span->end; i++) { fog[i] = fogCoord / w; fogCoord += fogStep; w += wStep; } span->arrayMask |= SPAN_FOG; } /* Fill in the span.zArray array from the interpolation values */ void _swrast_span_interpolate_z( const GLcontext *ctx, struct sw_span *span ) { const GLuint n = span->end; GLuint i; ASSERT((span->interpMask & SPAN_Z) && !(span->arrayMask & SPAN_Z)); if (ctx->DrawBuffer->Visual.depthBits <= 16) { GLfixed zval = span->z; GLdepth *z = span->array->z; for (i = 0; i < n; i++) { z[i] = FixedToInt(zval); zval += span->zStep; } } else { /* Deep Z buffer, no fixed->int shift */ GLfixed zval = span->z; GLdepth *z = span->array->z; for (i = 0; i < n; i++) { z[i] = zval; zval += span->zStep; } } span->interpMask &= ~SPAN_Z; span->arrayMask |= SPAN_Z; } /* * This the ideal solution, as given in the OpenGL spec. */ #if 0 static GLfloat compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH, GLfloat s, GLfloat t, GLfloat q, GLfloat invQ) { GLfloat dudx = texW * ((s + dsdx) / (q + dqdx) - s * invQ); GLfloat dvdx = texH * ((t + dtdx) / (q + dqdx) - t * invQ); GLfloat dudy = texW * ((s + dsdy) / (q + dqdy) - s * invQ); GLfloat dvdy = texH * ((t + dtdy) / (q + dqdy) - t * invQ); GLfloat x = SQRTF(dudx * dudx + dvdx * dvdx); GLfloat y = SQRTF(dudy * dudy + dvdy * dvdy); GLfloat rho = MAX2(x, y); GLfloat lambda = LOG2(rho); return lambda; } #endif /* * This is a faster approximation */ GLfloat _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH, GLfloat s, GLfloat t, GLfloat q, GLfloat invQ) { GLfloat dsdx2 = (s + dsdx) / (q + dqdx) - s * invQ; GLfloat dtdx2 = (t + dtdx) / (q + dqdx) - t * invQ; GLfloat dsdy2 = (s + dsdy) / (q + dqdy) - s * invQ; GLfloat dtdy2 = (t + dtdy) / (q + dqdy) - t * invQ; GLfloat maxU, maxV, rho, lambda; dsdx2 = FABSF(dsdx2); dsdy2 = FABSF(dsdy2); dtdx2 = FABSF(dtdx2); dtdy2 = FABSF(dtdy2); maxU = MAX2(dsdx2, dsdy2) * texW; maxV = MAX2(dtdx2, dtdy2) * texH; rho = MAX2(maxU, maxV); lambda = LOG2(rho); return lambda; } /** * Fill in the span.texcoords array from the interpolation values. * Note: in the places where we divide by Q (or mult by invQ) we're * really doing two things: perspective correction and texcoord * projection. Remember, for texcoord (s,t,r,q) we need to index * texels with (s/q, t/q, r/q). * If we're using a fragment program, we never do the division * for texcoord projection. That's done by the TXP instruction * or user-written code. */ static void interpolate_texcoords(GLcontext *ctx, struct sw_span *span) { ASSERT(span->interpMask & SPAN_TEXTURE); ASSERT(!(span->arrayMask & SPAN_TEXTURE)); if (ctx->Texture._EnabledCoordUnits > 1) { /* multitexture */ GLuint u; span->arrayMask |= SPAN_TEXTURE; for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture._EnabledCoordUnits & (1 << u)) { const struct gl_texture_object *obj =ctx->Texture.Unit[u]._Current; GLfloat texW, texH; GLboolean needLambda; if (obj) { const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; needLambda = (obj->MinFilter != obj->MagFilter) || ctx->FragmentProgram._Active; texW = img->WidthScale; texH = img->HeightScale; } else { /* using a fragment program */ texW = 1.0; texH = 1.0; needLambda = GL_FALSE; } if (needLambda) { GLfloat (*texcoord)[4] = span->array->texcoords[u]; GLfloat *lambda = span->array->lambda[u]; const GLfloat dsdx = span->texStepX[u][0]; const GLfloat dsdy = span->texStepY[u][0]; const GLfloat dtdx = span->texStepX[u][1]; const GLfloat dtdy = span->texStepY[u][1]; const GLfloat drdx = span->texStepX[u][2]; const GLfloat dqdx = span->texStepX[u][3]; const GLfloat dqdy = span->texStepY[u][3]; GLfloat s = span->tex[u][0]; GLfloat t = span->tex[u][1]; GLfloat r = span->tex[u][2]; GLfloat q = span->tex[u][3]; GLuint i; if (ctx->FragmentProgram._Active) { /* do perspective correction but don't divide s, t, r by q */ const GLfloat dwdx = span->dwdx; GLfloat w = span->w; for (i = 0; i < span->end; i++) { const GLfloat invW = 1.0F / w; texcoord[i][0] = s * invW; texcoord[i][1] = t * invW; texcoord[i][2] = r * invW; texcoord[i][3] = q * invW; lambda[i] = _swrast_compute_lambda(dsdx, dsdy, dtdx, dtdy, dqdx, dqdy, texW, texH, s, t, q, invW); s += dsdx; t += dtdx; r += drdx; q += dqdx; w += dwdx; } } else { for (i = 0; i < span->end; i++) { const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); texcoord[i][0] = s * invQ; texcoord[i][1] = t * invQ; texcoord[i][2] = r * invQ; texcoord[i][3] = q; lambda[i] = _swrast_compute_lambda(dsdx, dsdy, dtdx, dtdy, dqdx, dqdy, texW, texH, s, t, q, invQ); s += dsdx; t += dtdx; r += drdx; q += dqdx; } } span->arrayMask |= SPAN_LAMBDA; } else { GLfloat (*texcoord)[4] = span->array->texcoords[u]; GLfloat *lambda = span->array->lambda[u]; const GLfloat dsdx = span->texStepX[u][0]; const GLfloat dtdx = span->texStepX[u][1]; const GLfloat drdx = span->texStepX[u][2]; const GLfloat dqdx = span->texStepX[u][3]; GLfloat s = span->tex[u][0]; GLfloat t = span->tex[u][1]; GLfloat r = span->tex[u][2]; GLfloat q = span->tex[u][3]; GLuint i; if (ctx->FragmentProgram._Active) { /* do perspective correction but don't divide s, t, r by q */ const GLfloat dwdx = span->dwdx; GLfloat w = span->w; for (i = 0; i < span->end; i++) { const GLfloat invW = 1.0F / w; texcoord[i][0] = s * invW; texcoord[i][1] = t * invW; texcoord[i][2] = r * invW; texcoord[i][3] = q * invW; lambda[i] = 0.0; s += dsdx; t += dtdx; r += drdx; q += dqdx; w += dwdx; } } else if (dqdx == 0.0F) { /* Ortho projection or polygon's parallel to window X axis */ const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); for (i = 0; i < span->end; i++) { texcoord[i][0] = s * invQ; texcoord[i][1] = t * invQ; texcoord[i][2] = r * invQ; texcoord[i][3] = q; lambda[i] = 0.0; s += dsdx; t += dtdx; r += drdx; } } else { for (i = 0; i < span->end; i++) { const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); texcoord[i][0] = s * invQ; texcoord[i][1] = t * invQ; texcoord[i][2] = r * invQ; texcoord[i][3] = q; lambda[i] = 0.0; s += dsdx; t += dtdx; r += drdx; q += dqdx; } } } /* lambda */ } /* if */ } /* for */ } else { /* single texture */ const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; GLfloat texW, texH; GLboolean needLambda; if (obj) { const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; needLambda = (obj->MinFilter != obj->MagFilter) || ctx->FragmentProgram._Active; texW = (GLfloat) img->WidthScale; texH = (GLfloat) img->HeightScale; } else { needLambda = GL_FALSE; texW = texH = 1.0; } span->arrayMask |= SPAN_TEXTURE; if (needLambda) { /* just texture unit 0, with lambda */ GLfloat (*texcoord)[4] = span->array->texcoords[0]; GLfloat *lambda = span->array->lambda[0]; const GLfloat dsdx = span->texStepX[0][0]; const GLfloat dsdy = span->texStepY[0][0]; const GLfloat dtdx = span->texStepX[0][1]; const GLfloat dtdy = span->texStepY[0][1]; const GLfloat drdx = span->texStepX[0][2]; const GLfloat dqdx = span->texStepX[0][3]; const GLfloat dqdy = span->texStepY[0][3]; GLfloat s = span->tex[0][0]; GLfloat t = span->tex[0][1]; GLfloat r = span->tex[0][2]; GLfloat q = span->tex[0][3]; GLuint i; if (ctx->FragmentProgram._Active) { /* do perspective correction but don't divide s, t, r by q */ const GLfloat dwdx = span->dwdx; GLfloat w = span->w; for (i = 0; i < span->end; i++) { const GLfloat invW = 1.0F / w; texcoord[i][0] = s * invW; texcoord[i][1] = t * invW; texcoord[i][2] = r * invW; texcoord[i][3] = q * invW; lambda[i] = _swrast_compute_lambda(dsdx, dsdy, dtdx, dtdy, dqdx, dqdy, texW, texH, s, t, q, invW); s += dsdx; t += dtdx; r += drdx; q += dqdx; w += dwdx; } } else { /* tex.c */ for (i = 0; i < span->end; i++) { const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); lambda[i] = _swrast_compute_lambda(dsdx, dsdy, dtdx, dtdy, dqdx, dqdy, texW, texH, s, t, q, invQ); texcoord[i][0] = s * invQ; texcoord[i][1] = t * invQ; texcoord[i][2] = r * invQ; texcoord[i][3] = q; s += dsdx; t += dtdx; r += drdx; q += dqdx; } } span->arrayMask |= SPAN_LAMBDA; } else { /* just texture 0, without lambda */ GLfloat (*texcoord)[4] = span->array->texcoords[0]; const GLfloat dsdx = span->texStepX[0][0]; const GLfloat dtdx = span->texStepX[0][1]; const GLfloat drdx = span->texStepX[0][2]; const GLfloat dqdx = span->texStepX[0][3]; GLfloat s = span->tex[0][0]; GLfloat t = span->tex[0][1]; GLfloat r = span->tex[0][2]; GLfloat q = span->tex[0][3]; GLuint i; if (ctx->FragmentProgram._Active) { /* do perspective correction but don't divide s, t, r by q */ const GLfloat dwdx = span->dwdx; GLfloat w = span->w; for (i = 0; i < span->end; i++) { const GLfloat invW = 1.0F / w; texcoord[i][0] = s * invW; texcoord[i][1] = t * invW; texcoord[i][2] = r * invW; texcoord[i][3] = q * invW; s += dsdx; t += dtdx; r += drdx; q += dqdx; w += dwdx; } } else if (dqdx == 0.0F) { /* Ortho projection or polygon's parallel to window X axis */ const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); for (i = 0; i < span->end; i++) { texcoord[i][0] = s * invQ; texcoord[i][1] = t * invQ; texcoord[i][2] = r * invQ; texcoord[i][3] = q; s += dsdx; t += dtdx; r += drdx; } } else { for (i = 0; i < span->end; i++) { const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); texcoord[i][0] = s * invQ; texcoord[i][1] = t * invQ; texcoord[i][2] = r * invQ; texcoord[i][3] = q; s += dsdx; t += dtdx; r += drdx; q += dqdx; } } } } } /** * Apply the current polygon stipple pattern to a span of pixels. */ static void stipple_polygon_span( GLcontext *ctx, struct sw_span *span ) { const GLuint highbit = 0x80000000; const GLuint stipple = ctx->PolygonStipple[span->y % 32]; GLubyte *mask = span->array->mask; GLuint i, m; ASSERT(ctx->Polygon.StippleFlag); ASSERT((span->arrayMask & SPAN_XY) == 0); m = highbit >> (GLuint) (span->x % 32); for (i = 0; i < span->end; i++) { if ((m & stipple) == 0) { mask[i] = 0; } m = m >> 1; if (m == 0) { m = highbit; } } span->writeAll = GL_FALSE; } /** * Clip a pixel span to the current buffer/window boundaries: * DrawBuffer->_Xmin, _Xmax, _Ymin, _Ymax. This will accomplish * window clipping and scissoring. * Return: GL_TRUE some pixels still visible * GL_FALSE nothing visible */ static GLuint clip_span( GLcontext *ctx, struct sw_span *span ) { const GLint xmin = ctx->DrawBuffer->_Xmin; const GLint xmax = ctx->DrawBuffer->_Xmax; const GLint ymin = ctx->DrawBuffer->_Ymin; const GLint ymax = ctx->DrawBuffer->_Ymax; if (span->arrayMask & SPAN_XY) { /* arrays of x/y pixel coords */ const GLint *x = span->array->x; const GLint *y = span->array->y; const GLint n = span->end; GLubyte *mask = span->array->mask; GLint i; if (span->arrayMask & SPAN_MASK) { /* note: using & intead of && to reduce branches */ for (i = 0; i < n; i++) { mask[i] &= (x[i] >= xmin) & (x[i] < xmax) & (y[i] >= ymin) & (y[i] < ymax); } } else { /* note: using & intead of && to reduce branches */ for (i = 0; i < n; i++) { mask[i] = (x[i] >= xmin) & (x[i] < xmax) & (y[i] >= ymin) & (y[i] < ymax); } } return GL_TRUE; /* some pixels visible */ } else { /* horizontal span of pixels */ const GLint x = span->x; const GLint y = span->y; const GLint n = span->end; /* Trivial rejection tests */ if (y < ymin || y >= ymax || x + n <= xmin || x >= xmax) { span->end = 0; return GL_FALSE; /* all pixels clipped */ } /* Clip to the left */ if (x < xmin) { ASSERT(x + n > xmin); span->writeAll = GL_FALSE; _mesa_bzero(span->array->mask, (xmin - x) * sizeof(GLubyte)); } /* Clip to right */ if (x + n > xmax) { ASSERT(x < xmax); span->end = xmax - x; } return GL_TRUE; /* some pixels visible */ } } /** * Apply all the per-fragment opertions to a span of color index fragments * and write them to the enabled color drawbuffers. * The 'span' parameter can be considered to be const. Note that * span->interpMask and span->arrayMask may be changed but will be restored * to their original values before returning. */ void _swrast_write_index_span( GLcontext *ctx, struct sw_span *span) { const SWcontext *swrast = SWRAST_CONTEXT(ctx); const struct gl_framebuffer *fb = ctx->DrawBuffer; const GLuint output = 0; const GLuint origInterpMask = span->interpMask; const GLuint origArrayMask = span->arrayMask; GLuint buf; ASSERT(span->end <= MAX_WIDTH); ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE || span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); ASSERT((span->interpMask | span->arrayMask) & SPAN_INDEX); ASSERT((span->interpMask & span->arrayMask) == 0); if (span->arrayMask & SPAN_MASK) { /* mask was initialized by caller, probably glBitmap */ span->writeAll = GL_FALSE; } else { _mesa_memset(span->array->mask, 1, span->end); span->writeAll = GL_TRUE; } /* Clipping */ if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) { if (!clip_span(ctx, span)) { return; } } /* Depth bounds test */ if (ctx->Depth.BoundsTest && ctx->DrawBuffer->Visual.depthBits > 0) { if (!_swrast_depth_bounds_test(ctx, span)) { return; } } #ifdef DEBUG /* Make sure all fragments are within window bounds */ if (span->arrayMask & SPAN_XY) { GLuint i; for (i = 0; i < span->end; i++) { if (span->array->mask[i]) { assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin); assert(span->array->x[i] < ctx->DrawBuffer->_Xmax); assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin); assert(span->array->y[i] < ctx->DrawBuffer->_Ymax); } } } #endif /* Polygon Stippling */ if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) { stipple_polygon_span(ctx, span); } /* Stencil and Z testing */ if (ctx->Depth.Test || ctx->Stencil.Enabled) { if (span->interpMask & SPAN_Z) _swrast_span_interpolate_z(ctx, span); if (ctx->Stencil.Enabled) { if (!_swrast_stencil_and_ztest_span(ctx, span)) { span->arrayMask = origArrayMask; return; } } else { ASSERT(ctx->Depth.Test); if (!_swrast_depth_test_span(ctx, span)) { span->interpMask = origInterpMask; span->arrayMask = origArrayMask; return; } } } /* if we get here, something passed the depth test */ if (ctx->Depth.OcclusionTest) { ctx->OcclusionResult = GL_TRUE; } #if FEATURE_ARB_occlusion_query if (ctx->Occlusion.Active) { /* update count of 'passed' fragments */ GLuint i; for (i = 0; i < span->end; i++) ctx->Occlusion.PassedCounter += span->array->mask[i]; } #endif /* we have to wait until after occlusion to do this test */ if (ctx->Color.DrawBuffer == GL_NONE || ctx->Color.IndexMask == 0) { /* write no pixels */ span->arrayMask = origArrayMask; return; } /* Interpolate the color indexes if needed */ if (swrast->_FogEnabled || ctx->Color.IndexLogicOpEnabled || ctx->Color.IndexMask != 0xffffffff || (span->arrayMask & SPAN_COVERAGE)) { if (span->interpMask & SPAN_INDEX) { interpolate_indexes(ctx, span); } } /* Fog */ if (swrast->_FogEnabled) { _swrast_fog_ci_span(ctx, span); } /* Antialias coverage application */ if (span->arrayMask & SPAN_COVERAGE) { const GLfloat *coverage = span->array->coverage; GLuint *index = span->array->index; GLuint i; for (i = 0; i < span->end; i++) { ASSERT(coverage[i] < 16); index[i] = (index[i] & ~0xf) | ((GLuint) coverage[i]); } } /* Loop over drawing buffers */ for (buf = 0; buf < fb->_NumColorDrawBuffers[output]; buf++) { struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[output][buf]; GLuint indexTemp[MAX_WIDTH], *index32; ASSERT(rb->_BaseFormat == GL_COLOR_INDEX); if (ctx->Color.IndexLogicOpEnabled || ctx->Color.IndexMask != 0xffffffff) { /* make copy of incoming indexes */ MEMCPY(indexTemp, span->array->index, span->end * sizeof(GLuint)); if (ctx->Color.IndexLogicOpEnabled) { _swrast_logicop_ci_span(ctx, rb, span, indexTemp); } if (ctx->Color.IndexMask != 0xffffffff) { _swrast_mask_ci_span(ctx, rb, span, indexTemp); } index32 = indexTemp; } else { index32 = span->array->index; } if ((span->interpMask & SPAN_INDEX) && span->indexStep == 0) { /* all fragments have same color index */ GLubyte index8; GLushort index16; GLuint index32; void *value; if (rb->DataType == GL_UNSIGNED_BYTE) { index8 = FixedToInt(span->index); value = &index8; } else if (rb->DataType == GL_UNSIGNED_SHORT) { index16 = FixedToInt(span->index); value = &index16; } else { ASSERT(rb->DataType == GL_UNSIGNED_INT); index32 = FixedToInt(span->index); value = &index32; } if (span->arrayMask & SPAN_XY) { rb->PutMonoValues(ctx, rb, span->end, span->array->x, span->array->y, value, span->array->mask); } else { rb->PutMonoRow(ctx, rb, span->end, span->x, span->y, value, span->array->mask); } } else { /* each fragment is a different color */ GLubyte index8[MAX_WIDTH]; GLushort index16[MAX_WIDTH]; void *values; if (rb->DataType == GL_UNSIGNED_BYTE) { GLuint k; for (k = 0; k < span->end; k++) { index8[k] = (GLubyte) index32[k]; } values = index8; } else if (rb->DataType == GL_UNSIGNED_SHORT) { GLuint k; for (k = 0; k < span->end; k++) { index16[k] = (GLushort) index32[k]; } values = index16; } else { ASSERT(rb->DataType == GL_UNSIGNED_INT); values = index32; } if (span->arrayMask & SPAN_XY) { rb->PutValues(ctx, rb, span->end, span->array->x, span->array->y, values, span->array->mask); } else { rb->PutRow(ctx, rb, span->end, span->x, span->y, values, span->array->mask); } } } #if OLD_RENDERBUFFER /* restore default dest buffer */ _swrast_use_draw_buffer(ctx); #endif span->interpMask = origInterpMask; span->arrayMask = origArrayMask; } /** * Add specular color to base color. This is used only when * GL_LIGHT_MODEL_COLOR_CONTROL = GL_SEPARATE_SPECULAR_COLOR. */ static void add_colors(GLuint n, GLchan rgba[][4], GLchan specular[][4] ) { GLuint i; for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT /* no clamping */ rgba[i][RCOMP] += specular[i][RCOMP]; rgba[i][GCOMP] += specular[i][GCOMP]; rgba[i][BCOMP] += specular[i][BCOMP]; #else GLint r = rgba[i][RCOMP] + specular[i][RCOMP]; GLint g = rgba[i][GCOMP] + specular[i][GCOMP]; GLint b = rgba[i][BCOMP] + specular[i][BCOMP]; rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); #endif } } /** * XXX merge this code into the _swrast_write_rgba_span() routine! * * Draw to more than one RGBA color buffer (or none). * All fragment operations, up to (but not) blending/logicop should * have been done first. */ static void multi_write_rgba_span( GLcontext *ctx, struct sw_span *span ) { #if OLD_RENDERBUFFER SWcontext *swrast = SWRAST_CONTEXT(ctx); #endif const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); struct gl_framebuffer *fb = ctx->DrawBuffer; const GLuint output = 0; GLuint i; ASSERT(span->end < MAX_WIDTH); ASSERT(colorMask != 0x0); for (i = 0; i < fb->_NumColorDrawBuffers[output]; i++) { struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[output][i]; GLchan rgbaTmp[MAX_WIDTH][4]; #if OLD_RENDERBUFFER /* obsolete code */ GLuint bufferBit = fb->_ColorDrawBit[output][i]; /* Set the current read/draw buffer */ swrast->CurrentBufferBit = bufferBit; if (swrast->Driver.SetBuffer) (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit); #endif /* make copy of incoming colors */ MEMCPY( rgbaTmp, span->array->rgba, 4 * span->end * sizeof(GLchan) ); if (ctx->Color._LogicOpEnabled) { _swrast_logicop_rgba_span(ctx, rb, span, rgbaTmp); } else if (ctx->Color.BlendEnabled) { _swrast_blend_span(ctx, rb, span, rgbaTmp); } if (colorMask != 0xffffffff) { _swrast_mask_rgba_span(ctx, rb, span, rgbaTmp); } if (span->arrayMask & SPAN_XY) { /* array of pixel coords */ ASSERT(rb->PutValues); rb->PutValues(ctx, rb, span->end, span->array->x, span->array->y, rgbaTmp, span->array->mask); } else { /* horizontal run of pixels */ ASSERT(rb->PutRow); rb->PutRow(ctx, rb, span->end, span->x, span->y, rgbaTmp, span->array->mask); } } #if OLD_RENDERBUFFER /* restore default dest buffer */ _swrast_use_draw_buffer(ctx); #endif } /** * Apply all the per-fragment operations to a span. * This now includes texturing (_swrast_write_texture_span() is history). * This function may modify any of the array values in the span. * span->interpMask and span->arrayMask may be changed but will be restored * to their original values before returning. */ void _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span) { const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLuint origInterpMask = span->interpMask; const GLuint origArrayMask = span->arrayMask; const GLboolean deferredTexture = !(ctx->Color.AlphaEnabled || ctx->FragmentProgram._Active || ctx->ATIFragmentShader._Enabled); ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE || span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); ASSERT(span->end <= MAX_WIDTH); ASSERT((span->interpMask & span->arrayMask) == 0); /* printf("%s() interp 0x%x array 0x%x\n", __FUNCTION__, span->interpMask, span->arrayMask); */ if (span->arrayMask & SPAN_MASK) { /* mask was initialized by caller, probably glBitmap */ span->writeAll = GL_FALSE; } else { _mesa_memset(span->array->mask, 1, span->end); span->writeAll = GL_TRUE; } /* Clip to window/scissor box */ if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) { if (!clip_span(ctx, span)) { return; } } #ifdef DEBUG /* Make sure all fragments are within window bounds */ if (span->arrayMask & SPAN_XY) { GLuint i; for (i = 0; i < span->end; i++) { if (span->array->mask[i]) { assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin); assert(span->array->x[i] < ctx->DrawBuffer->_Xmax); assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin); assert(span->array->y[i] < ctx->DrawBuffer->_Ymax); } } } #endif /* Polygon Stippling */ if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) { stipple_polygon_span(ctx, span); } /* Interpolate texcoords? */ if (ctx->Texture._EnabledCoordUnits && (span->interpMask & SPAN_TEXTURE) && (span->arrayMask & SPAN_TEXTURE) == 0) { interpolate_texcoords(ctx, span); } /* This is the normal place to compute the resulting fragment color/Z. * As an optimization, we try to defer this until after Z/stencil * testing in order to try to avoid computing colors that we won't * actually need. */ if (!deferredTexture) { /* Now we need the rgba array, fill it in if needed */ if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0) interpolate_colors(ctx, span); if (span->interpMask & SPAN_SPEC) interpolate_specular(ctx, span); if (span->interpMask & SPAN_FOG) interpolate_fog(ctx, span); /* Compute fragment colors with fragment program or texture lookups */ if (ctx->FragmentProgram._Active) { /* frag prog may need Z values */ if (span->interpMask & SPAN_Z) _swrast_span_interpolate_z(ctx, span); _swrast_exec_fragment_program( ctx, span ); } else if (ctx->ATIFragmentShader._Enabled) _swrast_exec_fragment_shader( ctx, span ); else if (ctx->Texture._EnabledUnits && (span->arrayMask & SPAN_TEXTURE)) _swrast_texture_span( ctx, span ); /* Do the alpha test */ if (!_swrast_alpha_test(ctx, span)) { span->arrayMask = origArrayMask; return; } } /* Stencil and Z testing */ if (ctx->Stencil.Enabled || ctx->Depth.Test) { if (span->interpMask & SPAN_Z) _swrast_span_interpolate_z(ctx, span); if (ctx->Stencil.Enabled && ctx->DrawBuffer->Visual.stencilBits > 0) { /* Combined Z/stencil tests */ if (!_swrast_stencil_and_ztest_span(ctx, span)) { span->interpMask = origInterpMask; span->arrayMask = origArrayMask; return; } } else if (ctx->DrawBuffer->Visual.depthBits > 0) { /* Just regular depth testing */ ASSERT(ctx->Depth.Test); ASSERT(span->arrayMask & SPAN_Z); if (!_swrast_depth_test_span(ctx, span)) { span->interpMask = origInterpMask; span->arrayMask = origArrayMask; return; } } } /* if we get here, some fragments passed the depth test */ if (ctx->Depth.OcclusionTest) { ctx->OcclusionResult = GL_TRUE; } #if FEATURE_ARB_occlusion_query if (ctx->Occlusion.Active) { /* update count of 'passed' fragments */ GLuint i; for (i = 0; i < span->end; i++) ctx->Occlusion.PassedCounter += span->array->mask[i]; } #endif /* We had to wait until now to check for glColorMask(0,0,0,0) because of * the occlusion test. */ if (colorMask == 0x0) { span->interpMask = origInterpMask; span->arrayMask = origArrayMask; return; } /* If we were able to defer fragment color computation to now, there's * a good chance that many fragments will have already been killed by * Z/stencil testing. */ if (deferredTexture) { /* Now we need the rgba array, fill it in if needed */ if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0) interpolate_colors(ctx, span); if (span->interpMask & SPAN_SPEC) interpolate_specular(ctx, span); if (span->interpMask & SPAN_FOG) interpolate_fog(ctx, span); if (ctx->FragmentProgram._Active) _swrast_exec_fragment_program( ctx, span ); else if (ctx->ATIFragmentShader._Enabled) _swrast_exec_fragment_shader( ctx, span ); else if (ctx->Texture._EnabledUnits && (span->arrayMask & SPAN_TEXTURE)) _swrast_texture_span( ctx, span ); } ASSERT(span->arrayMask & SPAN_RGBA); if (!ctx->FragmentProgram._Enabled) { /* Add base and specular colors */ if (ctx->Fog.ColorSumEnabled || (ctx->Light.Enabled && ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) { if (span->interpMask & SPAN_SPEC) { interpolate_specular(ctx, span); } if (span->arrayMask & SPAN_SPEC) { add_colors( span->end, span->array->rgba, span->array->spec ); } else { /* We probably added the base/specular colors during the * vertex stage! */ } } } /* Fog */ if (swrast->_FogEnabled) { _swrast_fog_rgba_span(ctx, span); } /* Antialias coverage application */ if (span->arrayMask & SPAN_COVERAGE) { GLchan (*rgba)[4] = span->array->rgba; GLfloat *coverage = span->array->coverage; GLuint i; for (i = 0; i < span->end; i++) { rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]); } } /* Clamp color/alpha values over the range [0.0, 1.0] before storage */ #if CHAN_TYPE == GL_FLOAT if (ctx->Color.ClampFragmentColor) { GLchan (*rgba)[4] = span->array->rgba; GLuint i; for (i = 0; i < span->end; i++) { rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0, CHAN_MAXF); rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0, CHAN_MAXF); rgba[i][BCOMP] = CLAMP(rgba[i][BCOMP], 0.0, CHAN_MAXF); rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0, CHAN_MAXF); } } #endif if (swrast->_RasterMask & MULTI_DRAW_BIT) { /* need to do blend/logicop separately for each color buffer */ multi_write_rgba_span(ctx, span); } else { /* normal: write to exactly one buffer */ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; if (ctx->Color._LogicOpEnabled) { _swrast_logicop_rgba_span(ctx, rb, span, span->array->rgba); } else if (ctx->Color.BlendEnabled) { _swrast_blend_span(ctx, rb, span, span->array->rgba); } /* Color component masking */ if (colorMask != 0xffffffff) { _swrast_mask_rgba_span(ctx, rb, span, span->array->rgba); } /* Finally, write the pixels to a color buffer */ if (span->arrayMask & SPAN_XY) { /* array of pixel coords */ ASSERT(rb->PutValues); ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA); /* XXX check datatype */ rb->PutValues(ctx, rb, span->end, span->array->x, span->array->y, span->array->rgba, span->array->mask); } else { /* horizontal run of pixels */ ASSERT(rb->PutRow); ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA); /* XXX check datatype */ rb->PutRow(ctx, rb, span->end, span->x, span->y, span->array->rgba, span->writeAll ? NULL : span->array->mask); } } span->interpMask = origInterpMask; span->arrayMask = origArrayMask; } /** * Read RGBA pixels from frame buffer. Clipping will be done to prevent * reading ouside the buffer's boundaries. */ void _swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLchan rgba[][4] ) { const GLint bufWidth = (GLint) rb->Width; const GLint bufHeight = (GLint) rb->Height; if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) { /* completely above, below, or right */ /* XXX maybe leave rgba values undefined? */ _mesa_bzero(rgba, 4 * n * sizeof(GLchan)); } else { GLint skip, length; if (x < 0) { /* left edge clipping */ skip = -x; length = (GLint) n - skip; if (length < 0) { /* completely left of window */ return; } if (length > bufWidth) { length = bufWidth; } } else if ((GLint) (x + n) > bufWidth) { /* right edge clipping */ skip = 0; length = bufWidth - x; if (length < 0) { /* completely to right of window */ return; } } else { /* no clipping */ skip = 0; length = (GLint) n; } ASSERT(rb); ASSERT(rb->GetRow); ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA); ASSERT(rb->DataType == GL_UNSIGNED_BYTE); rb->GetRow(ctx, rb, length, x + skip, y, rgba + skip); } } /** * Read CI pixels from frame buffer. Clipping will be done to prevent * reading ouside the buffer's boundaries. */ void _swrast_read_index_span( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLuint index[] ) { const GLint bufWidth = (GLint) rb->Width; const GLint bufHeight = (GLint) rb->Height; if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) { /* completely above, below, or right */ _mesa_bzero(index, n * sizeof(GLuint)); } else { GLint skip, length; if (x < 0) { /* left edge clipping */ skip = -x; length = (GLint) n - skip; if (length < 0) { /* completely left of window */ return; } if (length > bufWidth) { length = bufWidth; } } else if ((GLint) (x + n) > bufWidth) { /* right edge clipping */ skip = 0; length = bufWidth - x; if (length < 0) { /* completely to right of window */ return; } } else { /* no clipping */ skip = 0; length = (GLint) n; } ASSERT(rb->GetRow); ASSERT(rb->_BaseFormat == GL_COLOR_INDEX); if (rb->DataType == GL_UNSIGNED_BYTE) { GLubyte index8[MAX_WIDTH]; GLint i; rb->GetRow(ctx, rb, length, x + skip, y, index8); for (i = 0; i < length; i++) index[skip + i] = index8[i]; } else if (rb->DataType == GL_UNSIGNED_SHORT) { GLushort index16[MAX_WIDTH]; GLint i; rb->GetRow(ctx, rb, length, x + skip, y, index16); for (i = 0; i < length; i++) index[skip + i] = index16[i]; } else if (rb->DataType == GL_UNSIGNED_INT) { rb->GetRow(ctx, rb, length, x + skip, y, index + skip); } } } /** * Wrapper for gl_renderbuffer::GetValues() which does clipping to avoid * reading values outside the buffer bounds. * We can use this for reading any format/type of renderbuffer. * \param valueSize is the size in bytes of each value put into the * values array. */ void _swrast_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values, GLuint valueSize) { GLuint i, inCount = 0, inStart = 0; for (i = 0; i < count; i++) { if (x[i] >= 0 && y[i] >= 0 && x[i] < rb->Width && y[i] < rb->Height) { /* inside */ if (inCount == 0) inStart = i; inCount++; } else { if (inCount > 0) { /* read [inStart, inStart + inCount) */ rb->GetValues(ctx, rb, inCount, x + inStart, y + inStart, (GLubyte *) values + inStart * valueSize); inCount = 0; } } } if (inCount > 0) { /* read last values */ rb->GetValues(ctx, rb, inCount, x + inStart, y + inStart, (GLubyte *) values + inStart * valueSize); } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_span.h0000644000000000000000000000500713614532424020176 0ustar /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_SPAN_H #define S_SPAN_H #include "mtypes.h" #include "swrast.h" extern void _swrast_span_default_z( GLcontext *ctx, struct sw_span *span ); extern void _swrast_span_interpolate_z( const GLcontext *ctx, struct sw_span *span ); extern void _swrast_span_default_fog( GLcontext *ctx, struct sw_span *span ); extern void _swrast_span_default_color( GLcontext *ctx, struct sw_span *span ); extern void _swrast_span_default_texcoords( GLcontext *ctx, struct sw_span *span ); extern GLfloat _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH, GLfloat s, GLfloat t, GLfloat q, GLfloat invQ); extern void _swrast_write_index_span( GLcontext *ctx, struct sw_span *span); extern void _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span); extern void _swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLchan rgba[][4] ); extern void _swrast_read_index_span( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, GLuint indx[] ); extern void _swrast_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values, GLuint valueSize); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_spantemp.h0000644000000000000000000001574413614532424021075 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Templates for the span/pixel-array write/read functions called via * the gl_renderbuffer's GetRow, GetValues, PutRow, PutMonoRow, PutValues * and PutMonoValues functions. * * Define the following macros before including this file: * NAME(PREFIX) to generate the function name * FORMAT must be either GL_RGBA, GL_RGBA8 or GL_COLOR_INDEX8_EXT * SPAN_VARS to declare any local variables * INIT_PIXEL_PTR(P, X, Y) to initialize a pointer to a pixel * INC_PIXEL_PTR(P) to increment a pixel pointer by one pixel * STORE_PIXEL(DST, X, Y, VALUE) to store pixel values in buffer * FETCH_PIXEL(DST, SRC) to fetch pixel values from buffer * * Note that in the STORE_PIXEL macros, we also pass in the (X,Y) coordinates * for the pixels to be stored. This is useful when dithering and probably * ignored otherwise. */ #include "macros.h" static void NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values ) { #ifdef SPAN_VARS SPAN_VARS #endif #if FORMAT == GL_RGBA GLchan (*dest)[4] = (GLchan (*)[4]) values; #elif FORMAT == GL_RGBA8 GLubyte (*dest)[4] = (GLubyte (*)[4]) values; #elif FORMAT == GL_COLOR_INDEX8_EXT GLubyte *dest = (GLubyte *) values; #else #error FORMAT must be set!!!! #endif GLuint i; INIT_PIXEL_PTR(pixel, x, y); for (i = 0; i < count; i++) { FETCH_PIXEL(dest[i], pixel); INC_PIXEL_PTR(pixel); } } static void NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values ) { #ifdef SPAN_VARS SPAN_VARS #endif #if FORMAT == GL_RGBA GLchan (*dest)[4] = (GLchan (*)[4]) values; #elif FORMAT == GL_RGBA8 GLubyte (*dest)[4] = (GLubyte (*)[4]) values; #elif FORMAT == GL_COLOR_INDEX8_EXT GLubyte *dest = (GLubyte *) values; #endif GLuint i; for (i = 0; i < count; i++) { INIT_PIXEL_PTR(pixel, x[i], y[i]); FETCH_PIXEL(dest[i], pixel); } } static void NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte mask[] ) { #ifdef SPAN_VARS SPAN_VARS #endif #if FORMAT == GL_RGBA const GLchan (*src)[4] = (const GLchan (*)[4]) values; #elif FORMAT == GL_RGBA8 const GLubyte (*src)[4] = (const GLubyte (*)[4]) values; #elif FORMAT == GL_COLOR_INDEX8_EXT const GLubyte (*src)[1] = (const GLubyte (*)[1]) values; #endif GLuint i; INIT_PIXEL_PTR(pixel, x, y); if (mask) { for (i = 0; i < count; i++) { if (mask[i]) { STORE_PIXEL(pixel, x + i, y, src[i]); } INC_PIXEL_PTR(pixel); } } else { for (i = 0; i < count; i++) { STORE_PIXEL(pixel, x + i, y, src[i]); INC_PIXEL_PTR(pixel); } } } #if (FORMAT == GL_RGBA) || (FORMAT == GL_RGBA8) static void NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte mask[] ) { #ifdef SPAN_VARS SPAN_VARS #endif #if FORMAT == GL_RGBA const GLchan (*src)[3] = (const GLchan (*)[3]) values; #elif FORMAT == GL_RGBA8 const GLubyte (*src)[3] = (const GLubyte (*)[3]) values; #else #error bad format #endif GLuint i; INIT_PIXEL_PTR(pixel, x, y); for (i = 0; i < count; i++) { if (!mask || mask[i]) { #ifdef STORE_PIXEL_RGB STORE_PIXEL_RGB(pixel, x + i, y, src[i]); #else STORE_PIXEL(pixel, x + i, y, src[i]); #endif } INC_PIXEL_PTR(pixel); } } #endif static void NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte mask[] ) { #ifdef SPAN_VARS SPAN_VARS #endif #if FORMAT == GL_RGBA const GLchan *src = (const GLchan *) value; #elif FORMAT == GL_RGBA8 const GLubyte *src = (const GLubyte *) value; #elif FORMAT == GL_COLOR_INDEX8_EXT const GLubyte *src = (const GLubyte *) value; #endif GLuint i; INIT_PIXEL_PTR(pixel, x, y); if (mask) { for (i = 0; i < count; i++) { if (mask[i]) { STORE_PIXEL(pixel, x + i, y, src); } INC_PIXEL_PTR(pixel); } } else { for (i = 0; i < count; i++) { STORE_PIXEL(pixel, x + i, y, src); INC_PIXEL_PTR(pixel); } } } static void NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte mask[] ) { #ifdef SPAN_VARS SPAN_VARS #endif #if FORMAT == GL_RGBA const GLchan (*src)[4] = (const GLchan (*)[4]) values; #elif FORMAT == GL_RGBA8 const GLubyte (*src)[4] = (const GLubyte (*)[4]) values; #elif FORMAT == GL_COLOR_INDEX8_EXT const GLubyte (*src)[1] = (const GLubyte (*)[1]) values; #endif GLuint i; ASSERT(mask); for (i = 0; i < count; i++) { if (mask[i]) { INIT_PIXEL_PTR(pixel, x[i], y[i]); STORE_PIXEL(pixel, x[i], y[i], src[i]); } } } static void NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte mask[] ) { #ifdef SPAN_VARS SPAN_VARS #endif #if FORMAT == GL_RGBA const GLchan *src = (const GLchan *) value; #elif FORMAT == GL_RGBA8 const GLubyte *src = (const GLubyte *) value; #elif FORMAT == GL_COLOR_INDEX8_EXT const GLubyte *src = (const GLubyte *) value; #endif GLuint i; ASSERT(mask); for (i = 0; i < count; i++) { if (mask[i]) { INIT_PIXEL_PTR(pixel, x[i], y[i]); STORE_PIXEL(pixel, x[i], y[i], src); } } } #undef NAME #undef SPAN_VARS #undef INIT_PIXEL_PTR #undef INC_PIXEL_PTR #undef STORE_PIXEL #undef STORE_PIXEL_RGB #undef FETCH_PIXEL #undef FORMAT nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_stencil.c0000644000000000000000000007626013614532424020702 0ustar /* * Mesa 3-D graphics library * Version: 6.4.1 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "context.h" #include "macros.h" #include "imports.h" #include "fbobject.h" #include "s_context.h" #include "s_depth.h" #include "s_stencil.h" #include "s_span.h" /* Stencil Logic: IF stencil test fails THEN Apply fail-op to stencil value Don't write the pixel (RGBA,Z) ELSE IF doing depth test && depth test fails THEN Apply zfail-op to stencil value Write RGBA and Z to appropriate buffers ELSE Apply zpass-op to stencil value ENDIF */ /** * Apply the given stencil operator to the array of stencil values. * Don't touch stencil[i] if mask[i] is zero. * Input: n - size of stencil array * oper - the stencil buffer operator * face - 0 or 1 for front or back face operation * stencil - array of stencil values * mask - array [n] of flag: 1=apply operator, 0=don't apply operator * Output: stencil - modified values */ static void apply_stencil_op( const GLcontext *ctx, GLenum oper, GLuint face, GLuint n, GLstencil stencil[], const GLubyte mask[] ) { const GLstencil ref = ctx->Stencil.Ref[face]; const GLstencil wrtmask = ctx->Stencil.WriteMask[face]; const GLstencil invmask = (GLstencil) (~wrtmask); GLuint i; switch (oper) { case GL_KEEP: /* do nothing */ break; case GL_ZERO: if (invmask==0) { for (i=0;i0) { stencil[i] = (GLstencil) (s-1); } } } } else { for (i=0;i0) { stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s-1))); } } } } break; case GL_INCR_WRAP_EXT: if (invmask==0) { for (i=0;iStencil.ValueMask[face]; ASSERT(n <= MAX_WIDTH); /* * Perform stencil test. The results of this operation are stored * in the fail[] array: * IF fail[i] is non-zero THEN * the stencil fail operator is to be applied * ELSE * the stencil fail operator is not to be applied * ENDIF */ switch (ctx->Stencil.Function[face]) { case GL_NEVER: /* never pass; always fail */ for (i=0;iStencil.Ref[face] & valueMask); for (i=0;iStencil.Ref[face] & valueMask); for (i=0;iStencil.Ref[face] & valueMask); for (i=0;i s) { /* passed */ fail[i] = 0; } else { fail[i] = 1; mask[i] = 0; } } else { fail[i] = 0; } } break; case GL_GEQUAL: r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i= s) { /* passed */ fail[i] = 0; } else { fail[i] = 1; mask[i] = 0; } } else { fail[i] = 0; } } break; case GL_EQUAL: r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;iStencil.Ref[face] & valueMask); for (i=0;iStencil.FailFunc[face] != GL_KEEP) { apply_stencil_op( ctx, ctx->Stencil.FailFunc[face], face, n, stencil, fail ); } return !allfail; } /** * Apply stencil and depth testing to the span of pixels. * Both software and hardware stencil buffers are acceptable. * Input: n - number of pixels in the span * x, y - location of leftmost pixel in span * z - array [n] of z values * mask - array [n] of flags (1=test this pixel, 0=skip the pixel) * Output: mask - array [n] of flags (1=stencil and depth test passed) * Return: GL_FALSE - all fragments failed the testing * GL_TRUE - one or more fragments passed the testing * */ static GLboolean stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span, GLuint face) { struct gl_framebuffer *fb = ctx->DrawBuffer; struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer; GLstencil stencilRow[MAX_WIDTH]; GLstencil *stencil; const GLuint n = span->end; const GLint x = span->x; const GLint y = span->y; GLubyte *mask = span->array->mask; ASSERT((span->arrayMask & SPAN_XY) == 0); ASSERT(ctx->Stencil.Enabled); ASSERT(n <= MAX_WIDTH); #ifdef DEBUG if (ctx->Depth.Test) { ASSERT(span->arrayMask & SPAN_Z); } #endif stencil = rb->GetPointer(ctx, rb, x, y); if (!stencil) { rb->GetRow(ctx, rb, n, x, y, stencilRow); stencil = stencilRow; } /* * Apply the stencil test to the fragments. * failMask[i] is 1 if the stencil test failed. */ if (do_stencil_test( ctx, face, n, stencil, mask ) == GL_FALSE) { /* all fragments failed the stencil test, we're done. */ span->writeAll = GL_FALSE; if (!rb->GetPointer(ctx, rb, 0, 0)) { /* put updated stencil values into buffer */ rb->PutRow(ctx, rb, n, x, y, stencil, NULL); } return GL_FALSE; } /* * Some fragments passed the stencil test, apply depth test to them * and apply Zpass and Zfail stencil ops. */ if (ctx->Depth.Test == GL_FALSE) { /* * No depth buffer, just apply zpass stencil function to active pixels. */ apply_stencil_op( ctx, ctx->Stencil.ZPassFunc[face], face, n, stencil, mask ); } else { /* * Perform depth buffering, then apply zpass or zfail stencil function. */ GLubyte passmask[MAX_WIDTH], failmask[MAX_WIDTH], oldmask[MAX_WIDTH]; GLuint i; /* save the current mask bits */ _mesa_memcpy(oldmask, mask, n * sizeof(GLubyte)); /* apply the depth test */ _swrast_depth_test_span(ctx, span); /* Set the stencil pass/fail flags according to result of depth testing. * if oldmask[i] == 0 then * Don't touch the stencil value * else if oldmask[i] and newmask[i] then * Depth test passed * else * assert(oldmask[i] && !newmask[i]) * Depth test failed * endif */ for (i=0;iStencil.ZFailFunc[face] != GL_KEEP) { apply_stencil_op( ctx, ctx->Stencil.ZFailFunc[face], face, n, stencil, failmask ); } if (ctx->Stencil.ZPassFunc[face] != GL_KEEP) { apply_stencil_op( ctx, ctx->Stencil.ZPassFunc[face], face, n, stencil, passmask ); } } /* * Write updated stencil values back into hardware stencil buffer. */ if (!rb->GetPointer(ctx, rb, 0, 0)) { rb->PutRow(ctx, rb, n, x, y, stencil, NULL); } span->writeAll = GL_FALSE; return GL_TRUE; /* one or more fragments passed both tests */ } /* * Return the address of a stencil buffer value given the window coords: */ #define STENCIL_ADDRESS(X, Y) (stencilStart + (Y) * stride + (X)) /** * Apply the given stencil operator for each pixel in the array whose * mask flag is set. * \note This is for software stencil buffers only. * Input: n - number of pixels in the span * x, y - array of [n] pixels * operator - the stencil buffer operator * mask - array [n] of flag: 1=apply operator, 0=don't apply operator */ static void apply_stencil_op_to_pixels( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLenum oper, GLuint face, const GLubyte mask[] ) { struct gl_framebuffer *fb = ctx->DrawBuffer; struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer; const GLstencil ref = ctx->Stencil.Ref[face]; const GLstencil wrtmask = ctx->Stencil.WriteMask[face]; const GLstencil invmask = (GLstencil) (~wrtmask); GLuint i; GLstencil *stencilStart = (GLubyte *) rb->Data; const GLuint stride = rb->Width; ASSERT(rb->GetPointer(ctx, rb, 0, 0)); ASSERT(sizeof(GLstencil) == 1); switch (oper) { case GL_KEEP: /* do nothing */ break; case GL_ZERO: if (invmask==0) { for (i=0;i0) { *sptr = (GLstencil) (*sptr - 1); } } } } else { for (i=0;i0) { *sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr-1))); } } } } break; case GL_INCR_WRAP_EXT: if (invmask==0) { for (i=0;iDrawBuffer; struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer; GLubyte fail[MAX_WIDTH]; GLstencil r, s; GLuint i; GLboolean allfail = GL_FALSE; const GLuint valueMask = ctx->Stencil.ValueMask[face]; const GLstencil *stencilStart = (GLstencil *) rb->Data; const GLuint stride = rb->Width; ASSERT(rb->GetPointer(ctx, rb, 0, 0)); ASSERT(sizeof(GLstencil) == 1); /* * Perform stencil test. The results of this operation are stored * in the fail[] array: * IF fail[i] is non-zero THEN * the stencil fail operator is to be applied * ELSE * the stencil fail operator is not to be applied * ENDIF */ switch (ctx->Stencil.Function[face]) { case GL_NEVER: /* always fail */ for (i=0;iStencil.Ref[face] & valueMask); for (i=0;iStencil.Ref[face] & valueMask); for (i=0;iStencil.Ref[face] & valueMask); for (i=0;i s) { /* passed */ fail[i] = 0; } else { fail[i] = 1; mask[i] = 0; } } else { fail[i] = 0; } } break; case GL_GEQUAL: r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i= s) { /* passed */ fail[i] = 0; } else { fail[i] = 1; mask[i] = 0; } } else { fail[i] = 0; } } break; case GL_EQUAL: r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;iStencil.Ref[face] & valueMask); for (i=0;iStencil.FailFunc[face] != GL_KEEP) { apply_stencil_op_to_pixels( ctx, n, x, y, ctx->Stencil.FailFunc[face], face, fail ); } return !allfail; } /** * Apply stencil and depth testing to an array of pixels. * This is used both for software and hardware stencil buffers. * * The comments in this function are a bit sparse but the code is * almost identical to stencil_and_ztest_span(), which is well * commented. * * Input: n - number of pixels in the array * x, y - array of [n] pixel positions * z - array [n] of z values * mask - array [n] of flags (1=test this pixel, 0=skip the pixel) * Output: mask - array [n] of flags (1=stencil and depth test passed) * Return: GL_FALSE - all fragments failed the testing * GL_TRUE - one or more fragments passed the testing */ static GLboolean stencil_and_ztest_pixels( GLcontext *ctx, struct sw_span *span, GLuint face ) { struct gl_framebuffer *fb = ctx->DrawBuffer; struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer; const GLuint n = span->end; const GLint *x = span->array->x; const GLint *y = span->array->y; GLubyte *mask = span->array->mask; ASSERT(span->arrayMask & SPAN_XY); ASSERT(ctx->Stencil.Enabled); ASSERT(n <= MAX_WIDTH); if (!rb->GetPointer(ctx, rb, 0, 0)) { /* No direct access */ GLstencil stencil[MAX_WIDTH]; GLubyte origMask[MAX_WIDTH]; ASSERT(rb->DataType == GL_UNSIGNED_BYTE); _swrast_get_values(ctx, rb, n, x, y, stencil, sizeof(GLubyte)); _mesa_memcpy(origMask, mask, n * sizeof(GLubyte)); (void) do_stencil_test(ctx, face, n, stencil, mask); if (ctx->Depth.Test == GL_FALSE) { apply_stencil_op(ctx, ctx->Stencil.ZPassFunc[face], face, n, stencil, mask); } else { _swrast_depth_test_span(ctx, span); if (ctx->Stencil.ZFailFunc[face] != GL_KEEP) { GLubyte failmask[MAX_WIDTH]; GLuint i; for (i = 0; i < n; i++) { ASSERT(mask[i] == 0 || mask[i] == 1); failmask[i] = origMask[i] & (mask[i] ^ 1); } apply_stencil_op(ctx, ctx->Stencil.ZFailFunc[face], face, n, stencil, failmask); } if (ctx->Stencil.ZPassFunc[face] != GL_KEEP) { GLubyte passmask[MAX_WIDTH]; GLuint i; for (i = 0; i < n; i++) { ASSERT(mask[i] == 0 || mask[i] == 1); passmask[i] = origMask[i] & mask[i]; } apply_stencil_op(ctx, ctx->Stencil.ZPassFunc[face], face, n, stencil, passmask); } } /* Write updated stencil values into hardware stencil buffer */ rb->PutValues(ctx, rb, n, x, y, stencil, origMask); return GL_TRUE; } else { /* Direct access to stencil buffer */ if (stencil_test_pixels(ctx, face, n, x, y, mask) == GL_FALSE) { /* all fragments failed the stencil test, we're done. */ return GL_FALSE; } if (ctx->Depth.Test==GL_FALSE) { apply_stencil_op_to_pixels(ctx, n, x, y, ctx->Stencil.ZPassFunc[face], face, mask); } else { GLubyte passmask[MAX_WIDTH], failmask[MAX_WIDTH], oldmask[MAX_WIDTH]; GLuint i; _mesa_memcpy(oldmask, mask, n * sizeof(GLubyte)); _swrast_depth_test_span(ctx, span); for (i=0;iStencil.ZFailFunc[face] != GL_KEEP) { apply_stencil_op_to_pixels(ctx, n, x, y, ctx->Stencil.ZFailFunc[face], face, failmask); } if (ctx->Stencil.ZPassFunc[face] != GL_KEEP) { apply_stencil_op_to_pixels(ctx, n, x, y, ctx->Stencil.ZPassFunc[face], face, passmask); } } return GL_TRUE; /* one or more fragments passed both tests */ } } /** * /return GL_TRUE = one or more fragments passed, * GL_FALSE = all fragments failed. */ GLboolean _swrast_stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span) { /* span->facing can only be non-zero if using two-sided stencil */ ASSERT(ctx->Stencil.TestTwoSide || span->facing == 0); if (span->arrayMask & SPAN_XY) return stencil_and_ztest_pixels(ctx, span, span->facing); else return stencil_and_ztest_span(ctx, span, span->facing); } #if 0 GLuint clip_span(GLuint bufferWidth, GLuint bufferHeight, GLint x, GLint y, GLuint *count) { GLuint n = *count; GLuint skipPixels = 0; if (y < 0 || y >= bufferHeight || x + n <= 0 || x >= bufferWidth) { /* totally out of bounds */ n = 0; } else { /* left clip */ if (x < 0) { skipPixels = -x; x = 0; n -= skipPixels; } /* right clip */ if (x + n > bufferWidth) { GLint dx = x + n - bufferWidth; n -= dx; } } *count = n; return skipPixels; } #endif /** * Return a span of stencil values from the stencil buffer. * Used for glRead/CopyPixels * Input: n - how many pixels * x,y - location of first pixel * Output: stencil - the array of stencil values */ void _swrast_read_stencil_span(GLcontext *ctx, struct gl_renderbuffer *rb, GLint n, GLint x, GLint y, GLstencil stencil[]) { if (y < 0 || y >= rb->Height || x + n <= 0 || x >= rb->Width) { /* span is completely outside framebuffer */ return; /* undefined values OK */ } if (x < 0) { GLint dx = -x; x = 0; n -= dx; stencil += dx; } if (x + n > rb->Width) { GLint dx = x + n - rb->Width; n -= dx; } if (n <= 0) { return; } rb->GetRow(ctx, rb, n, x, y, stencil); } /** * Write a span of stencil values to the stencil buffer. * Used for glDraw/CopyPixels * Input: n - how many pixels * x, y - location of first pixel * stencil - the array of stencil values */ void _swrast_write_stencil_span(GLcontext *ctx, GLint n, GLint x, GLint y, const GLstencil stencil[] ) { struct gl_framebuffer *fb = ctx->DrawBuffer; struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer; const GLuint stencilMax = (1 << fb->Visual.stencilBits) - 1; const GLuint stencilMask = ctx->Stencil.WriteMask[0]; if (y < 0 || y >= rb->Height || x + n <= 0 || x >= rb->Width) { /* span is completely outside framebuffer */ return; /* undefined values OK */ } if (x < 0) { GLint dx = -x; x = 0; n -= dx; stencil += dx; } if (x + n > rb->Width) { GLint dx = x + n - rb->Width; n -= dx; } if (n <= 0) { return; } if ((stencilMask & stencilMax) != stencilMax) { /* need to apply writemask */ GLstencil destVals[MAX_WIDTH], newVals[MAX_WIDTH]; GLint i; rb->GetRow(ctx, rb, n, x, y, destVals); for (i = 0; i < n; i++) { newVals[i] = (stencil[i] & stencilMask) | (destVals[i] & ~stencilMask); } rb->PutRow(ctx, rb, n, x, y, newVals, NULL); } else { rb->PutRow(ctx, rb, n, x, y, stencil, NULL); } } /** * Clear the stencil buffer. */ void _swrast_clear_stencil_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) { const GLstencil mask = ctx->Stencil.WriteMask[0]; const GLstencil invMask = ~mask; const GLstencil clearVal = (ctx->Stencil.Clear & mask); GLint x, y, width, height; if (!rb || mask == 0) return; ASSERT(rb->DataType == GL_UNSIGNED_BYTE); ASSERT(rb->_BaseFormat == GL_STENCIL_INDEX); /* compute region to clear */ x = ctx->DrawBuffer->_Xmin; y = ctx->DrawBuffer->_Ymin; width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; if (rb->GetPointer(ctx, rb, 0, 0)) { /* Direct buffer access */ if (ctx->Stencil.WriteMask[0] != STENCIL_MAX) { /* need to mask the clear */ GLint i, j; for (i = 0; i < height; i++) { GLubyte *stencil = rb->GetPointer(ctx, rb, x, y + i); for (j = 0; j < width; j++) { stencil[j] = (stencil[j] & invMask) | clearVal; } } } else { /* no bit masking */ if (width == rb->Width && rb->InternalFormat == GL_STENCIL_INDEX8_EXT) { /* optimized case */ GLubyte *stencil = rb->GetPointer(ctx, rb, x, y); GLuint len = width * height * sizeof(GLubyte); _mesa_memset(stencil, clearVal, len); } else { /* general case */ GLint i, j; for (i = 0; i < height; i++) { GLubyte *stencil = rb->GetPointer(ctx, rb, x, y + i); for (j = 0; j < width; j++) { stencil[j] = clearVal; } } } } } else { /* no direct access */ if (ctx->Stencil.WriteMask[0] != STENCIL_MAX) { /* need to mask the clear */ GLint i, j; for (i = 0; i < height; i++) { GLubyte stencil[MAX_WIDTH]; rb->GetRow(ctx, rb, width, x, y + i, stencil); for (j = 0; j < width; j++) { stencil[j] = (stencil[j] & invMask) | clearVal; } rb->PutRow(ctx, rb, width, x, y + i, stencil, NULL); } } else { /* no bit masking */ const GLubyte clear8 = clearVal; GLint i; for (i = 0; i < height; i++) { rb->PutMonoRow(ctx, rb, width, x, y + i, &clear8, NULL); } } } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_stencil.h0000644000000000000000000000331513614532424020676 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_STENCIL_H #define S_STENCIL_H #include "mtypes.h" #include "swrast.h" extern GLboolean _swrast_stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span); extern void _swrast_read_stencil_span(GLcontext *ctx, struct gl_renderbuffer *rb, GLint n, GLint x, GLint y, GLstencil stencil[]); extern void _swrast_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, const GLstencil stencil[] ); extern void _swrast_clear_stencil_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_texstore.c0000644000000000000000000003254313614532424021112 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Authors: * Brian Paul */ /* * The functions in this file are mostly related to software texture fallbacks. * This includes texture image transfer/packing and texel fetching. * Hardware drivers will likely override most of this. */ #include "glheader.h" #include "imports.h" #include "colormac.h" #include "context.h" #include "convolve.h" #include "image.h" #include "macros.h" #include "texformat.h" #include "teximage.h" #include "texstore.h" #include "s_context.h" #include "s_depth.h" #include "s_span.h" /* * Read an RGBA image from the frame buffer. * This is used by glCopyTex[Sub]Image[12]D(). * Input: ctx - the context * x, y - lower left corner * width, height - size of region to read * Return: pointer to block of GL_RGBA, GLchan data. */ static GLchan * read_color_image( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLint stride, i; GLchan *image, *dst; image = (GLchan *) _mesa_malloc(width * height * 4 * sizeof(GLchan)); if (!image) return NULL; /* Select buffer to read from */ _swrast_use_read_buffer(ctx); RENDER_START(swrast,ctx); dst = image; stride = width * 4; for (i = 0; i < height; i++) { _swrast_read_rgba_span(ctx, ctx->ReadBuffer->_ColorReadBuffer, width, x, y + i, (GLchan (*)[4]) dst); dst += stride; } RENDER_FINISH(swrast,ctx); /* Read from draw buffer (the default) */ _swrast_use_draw_buffer(ctx); return image; } /* * As above, but read data from depth buffer. */ static GLfloat * read_depth_image( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { struct gl_renderbuffer *rb = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; SWcontext *swrast = SWRAST_CONTEXT(ctx); GLfloat *image, *dst; GLint i; image = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat)); if (!image) return NULL; RENDER_START(swrast,ctx); dst = image; for (i = 0; i < height; i++) { _swrast_read_depth_span_float(ctx, rb, width, x, y + i, dst); dst += width; } RENDER_FINISH(swrast,ctx); return image; } static GLboolean is_depth_format(GLenum format) { switch (format) { case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16_SGIX: case GL_DEPTH_COMPONENT24_SGIX: case GL_DEPTH_COMPONENT32_SGIX: return GL_TRUE; default: return GL_FALSE; } } /* * Fallback for Driver.CopyTexImage1D(). */ void _swrast_copy_teximage1d( GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border ) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); ASSERT(texObj); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); ASSERT(texImage); ASSERT(ctx->Driver.TexImage1D); if (is_depth_format(internalFormat)) { /* read depth image from framebuffer */ GLfloat *image = read_depth_image(ctx, x, y, width, 1); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D"); return; } /* call glTexImage1D to redefine the texture */ (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat, width, border, GL_DEPTH_COMPONENT, GL_FLOAT, image, &ctx->DefaultPacking, texObj, texImage); _mesa_free(image); } else { /* read RGBA image from framebuffer */ GLchan *image = read_color_image(ctx, x, y, width, 1); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D"); return; } /* call glTexImage1D to redefine the texture */ (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat, width, border, GL_RGBA, CHAN_TYPE, image, &ctx->DefaultPacking, texObj, texImage); _mesa_free(image); } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } /* * Fallback for Driver.CopyTexImage2D(). */ void _swrast_copy_teximage2d( GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); ASSERT(texObj); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); ASSERT(texImage); ASSERT(ctx->Driver.TexImage2D); if (is_depth_format(internalFormat)) { /* read depth image from framebuffer */ GLfloat *image = read_depth_image(ctx, x, y, width, height); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D"); return; } /* call glTexImage2D to redefine the texture */ (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat, width, height, border, GL_DEPTH_COMPONENT, GL_FLOAT, image, &ctx->DefaultPacking, texObj, texImage); _mesa_free(image); } else { /* read RGBA image from framebuffer */ GLchan *image = read_color_image(ctx, x, y, width, height); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D"); return; } /* call glTexImage2D to redefine the texture */ (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat, width, height, border, GL_RGBA, CHAN_TYPE, image, &ctx->DefaultPacking, texObj, texImage); _mesa_free(image); } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } /* * Fallback for Driver.CopyTexSubImage1D(). */ void _swrast_copy_texsubimage1d( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); ASSERT(texObj); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); ASSERT(texImage); ASSERT(ctx->Driver.TexImage1D); if (texImage->Format == GL_DEPTH_COMPONENT) { /* read depth image from framebuffer */ GLfloat *image = read_depth_image(ctx, x, y, width, 1); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D"); return; } /* call glTexSubImage1D to redefine the texture */ (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width, GL_DEPTH_COMPONENT, GL_FLOAT, image, &ctx->DefaultPacking, texObj, texImage); _mesa_free(image); } else { /* read RGBA image from framebuffer */ GLchan *image = read_color_image(ctx, x, y, width, 1); if (!image) { _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D" ); return; } /* now call glTexSubImage1D to do the real work */ (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width, GL_RGBA, CHAN_TYPE, image, &ctx->DefaultPacking, texObj, texImage); _mesa_free(image); } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } /* * Fallback for Driver.CopyTexSubImage2D(). */ void _swrast_copy_texsubimage2d( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); ASSERT(texObj); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); ASSERT(texImage); ASSERT(ctx->Driver.TexImage2D); if (texImage->Format == GL_DEPTH_COMPONENT) { /* read depth image from framebuffer */ GLfloat *image = read_depth_image(ctx, x, y, width, height); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D"); return; } /* call glTexImage1D to redefine the texture */ (*ctx->Driver.TexSubImage2D)(ctx, target, level, xoffset, yoffset, width, height, GL_DEPTH_COMPONENT, GL_FLOAT, image, &ctx->DefaultPacking, texObj, texImage); _mesa_free(image); } else { /* read RGBA image from framebuffer */ GLchan *image = read_color_image(ctx, x, y, width, height); if (!image) { _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D" ); return; } /* now call glTexSubImage2D to do the real work */ (*ctx->Driver.TexSubImage2D)(ctx, target, level, xoffset, yoffset, width, height, GL_RGBA, CHAN_TYPE, image, &ctx->DefaultPacking, texObj, texImage); _mesa_free(image); } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } /* * Fallback for Driver.CopyTexSubImage3D(). */ void _swrast_copy_texsubimage3d( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; texObj = _mesa_select_tex_object(ctx, texUnit, target); ASSERT(texObj); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); ASSERT(texImage); ASSERT(ctx->Driver.TexImage3D); if (texImage->Format == GL_DEPTH_COMPONENT) { /* read depth image from framebuffer */ GLfloat *image = read_depth_image(ctx, x, y, width, height); if (!image) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D"); return; } /* call glTexImage1D to redefine the texture */ (*ctx->Driver.TexSubImage3D)(ctx, target, level, xoffset, yoffset, zoffset, width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT, image, &ctx->DefaultPacking, texObj, texImage); _mesa_free(image); } else { /* read RGBA image from framebuffer */ GLchan *image = read_color_image(ctx, x, y, width, height); if (!image) { _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D" ); return; } /* now call glTexSubImage3D to do the real work */ (*ctx->Driver.TexSubImage3D)(ctx, target, level, xoffset, yoffset, zoffset, width, height, 1, GL_RGBA, CHAN_TYPE, image, &ctx->DefaultPacking, texObj, texImage); _mesa_free(image); } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_texture.c0000644000000000000000000041552213614532424020737 0ustar /* * Mesa 3-D graphics library * Version: 6.4 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "context.h" #include "colormac.h" #include "macros.h" #include "imports.h" #include "pixel.h" #include "texformat.h" #include "teximage.h" #include "s_context.h" #include "s_texture.h" /** * Constants for integer linear interpolation. */ #define ILERP_SCALE 65536.0F #define ILERP_SHIFT 16 /** * Linear interpolation macros */ #define LERP(T, A, B) ( (A) + (T) * ((B) - (A)) ) #define ILERP(IT, A, B) ( (A) + (((IT) * ((B) - (A))) >> ILERP_SHIFT) ) /** * Do 2D/biliner interpolation of float values. * v00, v10, v01 and v11 are typically four texture samples in a square/box. * a and b are the horizontal and vertical interpolants. * It's important that this function is inlined when compiled with * optimization! If we find that's not true on some systems, convert * to a macro. */ static INLINE GLfloat lerp_2d(GLfloat a, GLfloat b, GLfloat v00, GLfloat v10, GLfloat v01, GLfloat v11) { const GLfloat temp0 = LERP(a, v00, v10); const GLfloat temp1 = LERP(a, v01, v11); return LERP(b, temp0, temp1); } /** * Do 2D/biliner interpolation of integer values. * \sa lerp_2d */ static INLINE GLint ilerp_2d(GLint ia, GLint ib, GLint v00, GLint v10, GLint v01, GLint v11) { /* fixed point interpolants in [0, ILERP_SCALE] */ const GLint temp0 = ILERP(ia, v00, v10); const GLint temp1 = ILERP(ia, v01, v11); return ILERP(ib, temp0, temp1); } /** * Do 3D/trilinear interpolation of float values. * \sa lerp_2d */ static INLINE GLfloat lerp_3d(GLfloat a, GLfloat b, GLfloat c, GLfloat v000, GLfloat v100, GLfloat v010, GLfloat v110, GLfloat v001, GLfloat v101, GLfloat v011, GLfloat v111) { const GLfloat temp00 = LERP(a, v000, v100); const GLfloat temp10 = LERP(a, v010, v110); const GLfloat temp01 = LERP(a, v001, v101); const GLfloat temp11 = LERP(a, v011, v111); const GLfloat temp0 = LERP(b, temp00, temp10); const GLfloat temp1 = LERP(b, temp01, temp11); return LERP(c, temp0, temp1); } /** * Do 3D/trilinear interpolation of integer values. * \sa lerp_2d */ static INLINE GLint ilerp_3d(GLint ia, GLint ib, GLint ic, GLint v000, GLint v100, GLint v010, GLint v110, GLint v001, GLint v101, GLint v011, GLint v111) { /* fixed point interpolants in [0, ILERP_SCALE] */ const GLint temp00 = ILERP(ia, v000, v100); const GLint temp10 = ILERP(ia, v010, v110); const GLint temp01 = ILERP(ia, v001, v101); const GLint temp11 = ILERP(ia, v011, v111); const GLint temp0 = ILERP(ib, temp00, temp10); const GLint temp1 = ILERP(ib, temp01, temp11); return ILERP(ic, temp0, temp1); } /** * Compute the remainder of a divided by b, but be careful with * negative values so that GL_REPEAT mode works right. */ static INLINE GLint repeat_remainder(GLint a, GLint b) { if (a >= 0) return a % b; else return (a + 1) % b + b - 1; } /** * Used to compute texel locations for linear sampling. * Input: * wrapMode = GL_REPEAT, GL_CLAMP, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER * S = texcoord in [0,1] * SIZE = width (or height or depth) of texture * Output: * U = texcoord in [0, width] * I0, I1 = two nearest texel indexes */ #define COMPUTE_LINEAR_TEXEL_LOCATIONS(wrapMode, S, U, SIZE, I0, I1) \ { \ if (wrapMode == GL_REPEAT) { \ U = S * SIZE - 0.5F; \ if (tObj->_IsPowerOfTwo) { \ I0 = IFLOOR(U) & (SIZE - 1); \ I1 = (I0 + 1) & (SIZE - 1); \ } \ else { \ I0 = repeat_remainder(IFLOOR(U), SIZE); \ I1 = repeat_remainder(I0 + 1, SIZE); \ } \ } \ else if (wrapMode == GL_CLAMP_TO_EDGE) { \ if (S <= 0.0F) \ U = 0.0F; \ else if (S >= 1.0F) \ U = (GLfloat) SIZE; \ else \ U = S * SIZE; \ U -= 0.5F; \ I0 = IFLOOR(U); \ I1 = I0 + 1; \ if (I0 < 0) \ I0 = 0; \ if (I1 >= (GLint) SIZE) \ I1 = SIZE - 1; \ } \ else if (wrapMode == GL_CLAMP_TO_BORDER) { \ const GLfloat min = -1.0F / (2.0F * SIZE); \ const GLfloat max = 1.0F - min; \ if (S <= min) \ U = min * SIZE; \ else if (S >= max) \ U = max * SIZE; \ else \ U = S * SIZE; \ U -= 0.5F; \ I0 = IFLOOR(U); \ I1 = I0 + 1; \ } \ else if (wrapMode == GL_MIRRORED_REPEAT) { \ const GLint flr = IFLOOR(S); \ if (flr & 1) \ U = 1.0F - (S - (GLfloat) flr); /* flr is odd */ \ else \ U = S - (GLfloat) flr; /* flr is even */ \ U = (U * SIZE) - 0.5F; \ I0 = IFLOOR(U); \ I1 = I0 + 1; \ if (I0 < 0) \ I0 = 0; \ if (I1 >= (GLint) SIZE) \ I1 = SIZE - 1; \ } \ else if (wrapMode == GL_MIRROR_CLAMP_EXT) { \ U = (GLfloat) fabs(S); \ if (U >= 1.0F) \ U = (GLfloat) SIZE; \ else \ U *= SIZE; \ U -= 0.5F; \ I0 = IFLOOR(U); \ I1 = I0 + 1; \ } \ else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_EXT) { \ U = (GLfloat) fabs(S); \ if (U >= 1.0F) \ U = (GLfloat) SIZE; \ else \ U *= SIZE; \ U -= 0.5F; \ I0 = IFLOOR(U); \ I1 = I0 + 1; \ if (I0 < 0) \ I0 = 0; \ if (I1 >= (GLint) SIZE) \ I1 = SIZE - 1; \ } \ else if (wrapMode == GL_MIRROR_CLAMP_TO_BORDER_EXT) { \ const GLfloat min = -1.0F / (2.0F * SIZE); \ const GLfloat max = 1.0F - min; \ U = (GLfloat) fabs(S); \ if (U <= min) \ U = min * SIZE; \ else if (U >= max) \ U = max * SIZE; \ else \ U *= SIZE; \ U -= 0.5F; \ I0 = IFLOOR(U); \ I1 = I0 + 1; \ } \ else { \ ASSERT(wrapMode == GL_CLAMP); \ if (S <= 0.0F) \ U = 0.0F; \ else if (S >= 1.0F) \ U = (GLfloat) SIZE; \ else \ U = S * SIZE; \ U -= 0.5F; \ I0 = IFLOOR(U); \ I1 = I0 + 1; \ } \ } /** * Used to compute texel location for nearest sampling. */ #define COMPUTE_NEAREST_TEXEL_LOCATION(wrapMode, S, SIZE, I) \ { \ if (wrapMode == GL_REPEAT) { \ /* s limited to [0,1) */ \ /* i limited to [0,size-1] */ \ I = IFLOOR(S * SIZE); \ if (tObj->_IsPowerOfTwo) \ I &= (SIZE - 1); \ else \ I = repeat_remainder(I, SIZE); \ } \ else if (wrapMode == GL_CLAMP_TO_EDGE) { \ /* s limited to [min,max] */ \ /* i limited to [0, size-1] */ \ const GLfloat min = 1.0F / (2.0F * SIZE); \ const GLfloat max = 1.0F - min; \ if (S < min) \ I = 0; \ else if (S > max) \ I = SIZE - 1; \ else \ I = IFLOOR(S * SIZE); \ } \ else if (wrapMode == GL_CLAMP_TO_BORDER) { \ /* s limited to [min,max] */ \ /* i limited to [-1, size] */ \ const GLfloat min = -1.0F / (2.0F * SIZE); \ const GLfloat max = 1.0F - min; \ if (S <= min) \ I = -1; \ else if (S >= max) \ I = SIZE; \ else \ I = IFLOOR(S * SIZE); \ } \ else if (wrapMode == GL_MIRRORED_REPEAT) { \ const GLfloat min = 1.0F / (2.0F * SIZE); \ const GLfloat max = 1.0F - min; \ const GLint flr = IFLOOR(S); \ GLfloat u; \ if (flr & 1) \ u = 1.0F - (S - (GLfloat) flr); /* flr is odd */ \ else \ u = S - (GLfloat) flr; /* flr is even */ \ if (u < min) \ I = 0; \ else if (u > max) \ I = SIZE - 1; \ else \ I = IFLOOR(u * SIZE); \ } \ else if (wrapMode == GL_MIRROR_CLAMP_EXT) { \ /* s limited to [0,1] */ \ /* i limited to [0,size-1] */ \ const GLfloat u = (GLfloat) fabs(S); \ if (u <= 0.0F) \ I = 0; \ else if (u >= 1.0F) \ I = SIZE - 1; \ else \ I = IFLOOR(u * SIZE); \ } \ else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_EXT) { \ /* s limited to [min,max] */ \ /* i limited to [0, size-1] */ \ const GLfloat min = 1.0F / (2.0F * SIZE); \ const GLfloat max = 1.0F - min; \ const GLfloat u = (GLfloat) fabs(S); \ if (u < min) \ I = 0; \ else if (u > max) \ I = SIZE - 1; \ else \ I = IFLOOR(u * SIZE); \ } \ else if (wrapMode == GL_MIRROR_CLAMP_TO_BORDER_EXT) { \ /* s limited to [min,max] */ \ /* i limited to [0, size-1] */ \ const GLfloat min = -1.0F / (2.0F * SIZE); \ const GLfloat max = 1.0F - min; \ const GLfloat u = (GLfloat) fabs(S); \ if (u < min) \ I = -1; \ else if (u > max) \ I = SIZE; \ else \ I = IFLOOR(u * SIZE); \ } \ else { \ ASSERT(wrapMode == GL_CLAMP); \ /* s limited to [0,1] */ \ /* i limited to [0,size-1] */ \ if (S <= 0.0F) \ I = 0; \ else if (S >= 1.0F) \ I = SIZE - 1; \ else \ I = IFLOOR(S * SIZE); \ } \ } /* Power of two image sizes only */ #define COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(S, U, SIZE, I0, I1) \ { \ U = S * SIZE - 0.5F; \ I0 = IFLOOR(U) & (SIZE - 1); \ I1 = (I0 + 1) & (SIZE - 1); \ } /* * Compute linear mipmap levels for given lambda. */ #define COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level) \ { \ if (lambda < 0.0F) \ level = tObj->BaseLevel; \ else if (lambda > tObj->_MaxLambda) \ level = (GLint) (tObj->BaseLevel + tObj->_MaxLambda); \ else \ level = (GLint) (tObj->BaseLevel + lambda); \ } /* * Compute nearest mipmap level for given lambda. */ #define COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level) \ { \ GLfloat l; \ if (lambda <= 0.5F) \ l = 0.0F; \ else if (lambda > tObj->_MaxLambda + 0.4999F) \ l = tObj->_MaxLambda + 0.4999F; \ else \ l = lambda; \ level = (GLint) (tObj->BaseLevel + l + 0.5F); \ if (level > tObj->_MaxLevel) \ level = tObj->_MaxLevel; \ } /* * Note, the FRAC macro has to work perfectly. Otherwise you'll sometimes * see 1-pixel bands of improperly weighted linear-sampled texels. The * tests/texwrap.c demo is a good test. * Also note, FRAC(x) doesn't truly return the fractional part of x for x < 0. * Instead, if x < 0 then FRAC(x) = 1 - true_frac(x). */ #define FRAC(f) ((f) - IFLOOR(f)) /* * Bitflags for texture border color sampling. */ #define I0BIT 1 #define I1BIT 2 #define J0BIT 4 #define J1BIT 8 #define K0BIT 16 #define K1BIT 32 /* * The lambda[] array values are always monotonic. Either the whole span * will be minified, magnified, or split between the two. This function * determines the subranges in [0, n-1] that are to be minified or magnified. */ static INLINE void compute_min_mag_ranges( GLfloat minMagThresh, GLuint n, const GLfloat lambda[], GLuint *minStart, GLuint *minEnd, GLuint *magStart, GLuint *magEnd ) { ASSERT(lambda != NULL); #if 0 /* Verify that lambda[] is monotonous. * We can't really use this because the inaccuracy in the LOG2 function * causes this test to fail, yet the resulting texturing is correct. */ if (n > 1) { GLuint i; printf("lambda delta = %g\n", lambda[0] - lambda[n-1]); if (lambda[0] >= lambda[n-1]) { /* decreasing */ for (i = 0; i < n - 1; i++) { ASSERT((GLint) (lambda[i] * 10) >= (GLint) (lambda[i+1] * 10)); } } else { /* increasing */ for (i = 0; i < n - 1; i++) { ASSERT((GLint) (lambda[i] * 10) <= (GLint) (lambda[i+1] * 10)); } } } #endif /* DEBUG */ /* since lambda is monotonous-array use this check first */ if (lambda[0] <= minMagThresh && lambda[n-1] <= minMagThresh) { /* magnification for whole span */ *magStart = 0; *magEnd = n; *minStart = *minEnd = 0; } else if (lambda[0] > minMagThresh && lambda[n-1] > minMagThresh) { /* minification for whole span */ *minStart = 0; *minEnd = n; *magStart = *magEnd = 0; } else { /* a mix of minification and magnification */ GLuint i; if (lambda[0] > minMagThresh) { /* start with minification */ for (i = 1; i < n; i++) { if (lambda[i] <= minMagThresh) break; } *minStart = 0; *minEnd = i; *magStart = i; *magEnd = n; } else { /* start with magnification */ for (i = 1; i < n; i++) { if (lambda[i] > minMagThresh) break; } *magStart = 0; *magEnd = i; *minStart = i; *minEnd = n; } } #if 0 /* Verify the min/mag Start/End values * We don't use this either (see above) */ { GLint i; for (i = 0; i < n; i++) { if (lambda[i] > minMagThresh) { /* minification */ ASSERT(i >= *minStart); ASSERT(i < *minEnd); } else { /* magnification */ ASSERT(i >= *magStart); ASSERT(i < *magEnd); } } } #endif } /**********************************************************************/ /* 1-D Texture Sampling Functions */ /**********************************************************************/ /* * Return the texture sample for coordinate (s) using GL_NEAREST filter. */ static void sample_1d_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLchan rgba[4]) { const GLint width = img->Width2; /* without border, power of two */ GLint i; (void) ctx; COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i); /* skip over the border, if any */ i += img->Border; if (i < 0 || i >= (GLint) img->Width) { /* Need this test for GL_CLAMP_TO_BORDER mode */ COPY_CHAN4(rgba, tObj->_BorderChan); } else { img->FetchTexelc(img, i, 0, 0, rgba); } } /* * Return the texture sample for coordinate (s) using GL_LINEAR filter. */ static void sample_1d_linear(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLchan rgba[4]) { const GLint width = img->Width2; GLint i0, i1; GLfloat u; GLuint useBorderColor; (void) ctx; COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1); useBorderColor = 0; if (img->Border) { i0 += img->Border; i1 += img->Border; } else { if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT; if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT; } { const GLfloat a = FRAC(u); GLchan t0[4], t1[4]; /* texels */ /* fetch texel colors */ if (useBorderColor & I0BIT) { COPY_CHAN4(t0, tObj->_BorderChan); } else { img->FetchTexelc(img, i0, 0, 0, t0); } if (useBorderColor & I1BIT) { COPY_CHAN4(t1, tObj->_BorderChan); } else { img->FetchTexelc(img, i1, 0, 0, t1); } /* do linear interpolation of texel colors */ #if CHAN_TYPE == GL_FLOAT rgba[0] = LERP(a, t0[0], t1[0]); rgba[1] = LERP(a, t0[1], t1[1]); rgba[2] = LERP(a, t0[2], t1[2]); rgba[3] = LERP(a, t0[3], t1[3]); #elif CHAN_TYPE == GL_UNSIGNED_SHORT rgba[0] = (GLchan) (LERP(a, t0[0], t1[0]) + 0.5); rgba[1] = (GLchan) (LERP(a, t0[1], t1[1]) + 0.5); rgba[2] = (GLchan) (LERP(a, t0[2], t1[2]) + 0.5); rgba[3] = (GLchan) (LERP(a, t0[3], t1[3]) + 0.5); #else ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE); { /* fixed point interpolants in [0, ILERP_SCALE] */ const GLint ia = IROUND_POS(a * ILERP_SCALE); rgba[0] = ILERP(ia, t0[0], t1[0]); rgba[1] = ILERP(ia, t0[1], t1[1]); rgba[2] = ILERP(ia, t0[2], t1[2]); rgba[3] = ILERP(ia, t0[3], t1[3]); } #endif } } static void sample_1d_nearest_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; ASSERT(lambda != NULL); for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); sample_1d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } static void sample_1d_linear_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; ASSERT(lambda != NULL); for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); sample_1d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } /* * This is really just needed in order to prevent warnings with some compilers. */ #if CHAN_TYPE == GL_FLOAT #define CHAN_CAST #else #define CHAN_CAST (GLchan) (GLint) #endif static void sample_1d_nearest_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; ASSERT(lambda != NULL); for (i = 0; i < n; i++) { GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; const GLfloat f = FRAC(lambda[i]); sample_1d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_1d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); } } } static void sample_1d_linear_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; ASSERT(lambda != NULL); for (i = 0; i < n; i++) { GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; const GLfloat f = FRAC(lambda[i]); sample_1d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_1d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); } } } static void sample_nearest_1d( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) texUnit; (void) lambda; for (i=0;iImage[0][tObj->BaseLevel]; (void) texUnit; (void) lambda; for (i=0;i_MinMagThresh[texUnit], n, lambda, &minStart, &minEnd, &magStart, &magEnd); if (minStart < minEnd) { /* do the minified texels */ const GLuint m = minEnd - minStart; switch (tObj->MinFilter) { case GL_NEAREST: for (i = minStart; i < minEnd; i++) sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_LINEAR: for (i = minStart; i < minEnd; i++) sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_NEAREST_MIPMAP_NEAREST: sample_1d_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; case GL_LINEAR_MIPMAP_NEAREST: sample_1d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; case GL_NEAREST_MIPMAP_LINEAR: sample_1d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; case GL_LINEAR_MIPMAP_LINEAR: sample_1d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; default: _mesa_problem(ctx, "Bad min filter in sample_1d_texture"); return; } } if (magStart < magEnd) { /* do the magnified texels */ switch (tObj->MagFilter) { case GL_NEAREST: for (i = magStart; i < magEnd; i++) sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_LINEAR: for (i = magStart; i < magEnd; i++) sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; default: _mesa_problem(ctx, "Bad mag filter in sample_1d_texture"); return; } } } /**********************************************************************/ /* 2-D Texture Sampling Functions */ /**********************************************************************/ /* * Return the texture sample for coordinate (s,t) using GL_NEAREST filter. */ static INLINE void sample_2d_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLchan rgba[]) { const GLint width = img->Width2; /* without border, power of two */ const GLint height = img->Height2; /* without border, power of two */ GLint i, j; (void) ctx; COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i); COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoord[1], height, j); /* skip over the border, if any */ i += img->Border; j += img->Border; if (i < 0 || i >= (GLint) img->Width || j < 0 || j >= (GLint) img->Height) { /* Need this test for GL_CLAMP_TO_BORDER mode */ COPY_CHAN4(rgba, tObj->_BorderChan); } else { img->FetchTexelc(img, i, j, 0, rgba); } } /** * Return the texture sample for coordinate (s,t) using GL_LINEAR filter. * New sampling code contributed by Lynn Quam . */ static INLINE void sample_2d_linear(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLchan rgba[]) { const GLint width = img->Width2; const GLint height = img->Height2; GLint i0, j0, i1, j1; GLuint useBorderColor; GLfloat u, v; (void) ctx; COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1); COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoord[1], v, height, j0, j1); useBorderColor = 0; if (img->Border) { i0 += img->Border; i1 += img->Border; j0 += img->Border; j1 += img->Border; } else { if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT; if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT; if (j0 < 0 || j0 >= height) useBorderColor |= J0BIT; if (j1 < 0 || j1 >= height) useBorderColor |= J1BIT; } { const GLfloat a = FRAC(u); const GLfloat b = FRAC(v); #if CHAN_TYPE == GL_UNSIGNED_BYTE const GLint ia = IROUND_POS(a * ILERP_SCALE); const GLint ib = IROUND_POS(b * ILERP_SCALE); #endif GLchan t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */ /* fetch four texel colors */ if (useBorderColor & (I0BIT | J0BIT)) { COPY_CHAN4(t00, tObj->_BorderChan); } else { img->FetchTexelc(img, i0, j0, 0, t00); } if (useBorderColor & (I1BIT | J0BIT)) { COPY_CHAN4(t10, tObj->_BorderChan); } else { img->FetchTexelc(img, i1, j0, 0, t10); } if (useBorderColor & (I0BIT | J1BIT)) { COPY_CHAN4(t01, tObj->_BorderChan); } else { img->FetchTexelc(img, i0, j1, 0, t01); } if (useBorderColor & (I1BIT | J1BIT)) { COPY_CHAN4(t11, tObj->_BorderChan); } else { img->FetchTexelc(img, i1, j1, 0, t11); } /* do bilinear interpolation of texel colors */ #if CHAN_TYPE == GL_FLOAT rgba[0] = lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]); rgba[1] = lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]); rgba[2] = lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]); rgba[3] = lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]); #elif CHAN_TYPE == GL_UNSIGNED_SHORT rgba[0] = (GLchan) (lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]) + 0.5); rgba[1] = (GLchan) (lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]) + 0.5); rgba[2] = (GLchan) (lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]) + 0.5); rgba[3] = (GLchan) (lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]) + 0.5); #else ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE); rgba[0] = ilerp_2d(ia, ib, t00[0], t10[0], t01[0], t11[0]); rgba[1] = ilerp_2d(ia, ib, t00[1], t10[1], t01[1], t11[1]); rgba[2] = ilerp_2d(ia, ib, t00[2], t10[2], t01[2], t11[2]); rgba[3] = ilerp_2d(ia, ib, t00[3], t10[3], t01[3], t11[3]); #endif } } /* * As above, but we know WRAP_S == REPEAT and WRAP_T == REPEAT. */ static INLINE void sample_2d_linear_repeat(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLchan rgba[]) { const GLint width = img->Width2; const GLint height = img->Height2; GLint i0, j0, i1, j1; GLfloat u, v; (void) ctx; (void) tObj; ASSERT(tObj->WrapS == GL_REPEAT); ASSERT(tObj->WrapT == GL_REPEAT); ASSERT(img->Border == 0); ASSERT(img->Format != GL_COLOR_INDEX); ASSERT(img->_IsPowerOfTwo); COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[0], u, width, i0, i1); COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[1], v, height, j0, j1); { const GLfloat a = FRAC(u); const GLfloat b = FRAC(v); #if CHAN_TYPE == GL_UNSIGNED_BYTE const GLint ia = IROUND_POS(a * ILERP_SCALE); const GLint ib = IROUND_POS(b * ILERP_SCALE); #endif GLchan t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */ img->FetchTexelc(img, i0, j0, 0, t00); img->FetchTexelc(img, i1, j0, 0, t10); img->FetchTexelc(img, i0, j1, 0, t01); img->FetchTexelc(img, i1, j1, 0, t11); /* do bilinear interpolation of texel colors */ #if CHAN_TYPE == GL_FLOAT rgba[0] = lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]); rgba[1] = lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]); rgba[2] = lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]); rgba[3] = lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]); #elif CHAN_TYPE == GL_UNSIGNED_SHORT rgba[0] = (GLchan) (lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]) + 0.5); rgba[1] = (GLchan) (lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]) + 0.5); rgba[2] = (GLchan) (lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]) + 0.5); rgba[3] = (GLchan) (lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]) + 0.5); #else ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE); rgba[0] = ilerp_2d(ia, ib, t00[0], t10[0], t01[0], t11[0]); rgba[1] = ilerp_2d(ia, ib, t00[1], t10[1], t01[1], t11[1]); rgba[2] = ilerp_2d(ia, ib, t00[2], t10[2], t01[2], t11[2]); rgba[3] = ilerp_2d(ia, ib, t00[3], t10[3], t01[3], t11[3]); #endif } } static void sample_2d_nearest_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); sample_2d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } static void sample_2d_linear_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; ASSERT(lambda != NULL); for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); sample_2d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } static void sample_2d_nearest_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; ASSERT(lambda != NULL); for (i = 0; i < n; i++) { GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { sample_2d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_2d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_2d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); } } } /* Trilinear filtering */ static void sample_2d_linear_mipmap_linear( GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4] ) { GLuint i; ASSERT(lambda != NULL); for (i = 0; i < n; i++) { GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { sample_2d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_2d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_2d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); } } } static void sample_2d_linear_mipmap_linear_repeat( GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4] ) { GLuint i; ASSERT(lambda != NULL); ASSERT(tObj->WrapS == GL_REPEAT); ASSERT(tObj->WrapT == GL_REPEAT); ASSERT(tObj->_IsPowerOfTwo); for (i = 0; i < n; i++) { GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); } } } static void sample_nearest_2d( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) texUnit; (void) lambda; for (i=0;iImage[0][tObj->BaseLevel]; (void) texUnit; (void) lambda; if (tObj->WrapS == GL_REPEAT && tObj->WrapT == GL_REPEAT && image->Border == 0) { for (i=0;iImage[0][tObj->BaseLevel]; const GLfloat width = (GLfloat) img->Width; const GLfloat height = (GLfloat) img->Height; const GLint colMask = img->Width - 1; const GLint rowMask = img->Height - 1; const GLint shift = img->WidthLog2; GLuint k; (void) ctx; (void) texUnit; (void) lambda; ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); ASSERT(img->Format==GL_RGB); ASSERT(img->_IsPowerOfTwo); for (k=0; kData) + 3*pos; rgba[k][RCOMP] = texel[0]; rgba[k][GCOMP] = texel[1]; rgba[k][BCOMP] = texel[2]; } } /* * Optimized 2-D texture sampling: * S and T wrap mode == GL_REPEAT * GL_NEAREST min/mag filter * No border * RowStride == Width, * Format = GL_RGBA */ static void opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4] ) { const struct gl_texture_image *img = tObj->Image[0][tObj->BaseLevel]; const GLfloat width = (GLfloat) img->Width; const GLfloat height = (GLfloat) img->Height; const GLint colMask = img->Width - 1; const GLint rowMask = img->Height - 1; const GLint shift = img->WidthLog2; GLuint i; (void) ctx; (void) texUnit; (void) lambda; ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); ASSERT(img->Format==GL_RGBA); ASSERT(img->_IsPowerOfTwo); for (i = 0; i < n; i++) { const GLint col = IFLOOR(texcoords[i][0] * width) & colMask; const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask; const GLint pos = (row << shift) | col; const GLchan *texel = ((GLchan *) img->Data) + (pos << 2); /* pos*4 */ COPY_CHAN4(rgba[i], texel); } } /* * Given an array of texture coordinate and lambda (level of detail) * values, return an array of texture sample. */ static void sample_lambda_2d( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4] ) { const struct gl_texture_image *tImg = tObj->Image[0][tObj->BaseLevel]; GLuint minStart, minEnd; /* texels with minification */ GLuint magStart, magEnd; /* texels with magnification */ const GLboolean repeatNoBorderPOT = (tObj->WrapS == GL_REPEAT) && (tObj->WrapT == GL_REPEAT) && (tImg->Border == 0 && (tImg->Width == tImg->RowStride)) && (tImg->Format != GL_COLOR_INDEX) && tImg->_IsPowerOfTwo; ASSERT(lambda != NULL); compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], n, lambda, &minStart, &minEnd, &magStart, &magEnd); if (minStart < minEnd) { /* do the minified texels */ const GLuint m = minEnd - minStart; switch (tObj->MinFilter) { case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat->MesaFormat) { case MESA_FORMAT_RGB: case MESA_FORMAT_RGB888: /*case MESA_FORMAT_BGR888:*/ opt_sample_rgb_2d(ctx, texUnit, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; case MESA_FORMAT_RGBA: case MESA_FORMAT_RGBA8888: case MESA_FORMAT_ARGB8888: /*case MESA_FORMAT_ABGR8888:*/ /*case MESA_FORMAT_BGRA8888:*/ opt_sample_rgba_2d(ctx, texUnit, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; default: sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + minStart, NULL, rgba + minStart ); } } else { sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + minStart, NULL, rgba + minStart); } break; case GL_LINEAR: sample_linear_2d(ctx, texUnit, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; case GL_NEAREST_MIPMAP_NEAREST: sample_2d_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; case GL_LINEAR_MIPMAP_NEAREST: sample_2d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; case GL_NEAREST_MIPMAP_LINEAR: sample_2d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; case GL_LINEAR_MIPMAP_LINEAR: if (repeatNoBorderPOT) sample_2d_linear_mipmap_linear_repeat(ctx, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); else sample_2d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; default: _mesa_problem(ctx, "Bad min filter in sample_2d_texture"); return; } } if (magStart < magEnd) { /* do the magnified texels */ const GLuint m = magEnd - magStart; switch (tObj->MagFilter) { case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat->MesaFormat) { case MESA_FORMAT_RGB: case MESA_FORMAT_RGB888: /*case MESA_FORMAT_BGR888:*/ opt_sample_rgb_2d(ctx, texUnit, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; case MESA_FORMAT_RGBA: case MESA_FORMAT_RGBA8888: case MESA_FORMAT_ARGB8888: /*case MESA_FORMAT_ABGR8888:*/ /*case MESA_FORMAT_BGRA8888:*/ opt_sample_rgba_2d(ctx, texUnit, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; default: sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + magStart, NULL, rgba + magStart ); } } else { sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + magStart, NULL, rgba + magStart); } break; case GL_LINEAR: sample_linear_2d(ctx, texUnit, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; default: _mesa_problem(ctx, "Bad mag filter in sample_lambda_2d"); } } } /**********************************************************************/ /* 3-D Texture Sampling Functions */ /**********************************************************************/ /* * Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter. */ static void sample_3d_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLchan rgba[4]) { const GLint width = img->Width2; /* without border, power of two */ const GLint height = img->Height2; /* without border, power of two */ const GLint depth = img->Depth2; /* without border, power of two */ GLint i, j, k; (void) ctx; COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i); COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoord[1], height, j); COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapR, texcoord[2], depth, k); if (i < 0 || i >= (GLint) img->Width || j < 0 || j >= (GLint) img->Height || k < 0 || k >= (GLint) img->Depth) { /* Need this test for GL_CLAMP_TO_BORDER mode */ COPY_CHAN4(rgba, tObj->_BorderChan); } else { img->FetchTexelc(img, i, j, k, rgba); } } /* * Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter. */ static void sample_3d_linear(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, const GLfloat texcoord[4], GLchan rgba[4]) { const GLint width = img->Width2; const GLint height = img->Height2; const GLint depth = img->Depth2; GLint i0, j0, k0, i1, j1, k1; GLuint useBorderColor; GLfloat u, v, w; (void) ctx; COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1); COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoord[1], v, height, j0, j1); COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapR, texcoord[2], w, depth, k0, k1); useBorderColor = 0; if (img->Border) { i0 += img->Border; i1 += img->Border; j0 += img->Border; j1 += img->Border; k0 += img->Border; k1 += img->Border; } else { /* check if sampling texture border color */ if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT; if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT; if (j0 < 0 || j0 >= height) useBorderColor |= J0BIT; if (j1 < 0 || j1 >= height) useBorderColor |= J1BIT; if (k0 < 0 || k0 >= depth) useBorderColor |= K0BIT; if (k1 < 0 || k1 >= depth) useBorderColor |= K1BIT; } { const GLfloat a = FRAC(u); const GLfloat b = FRAC(v); const GLfloat c = FRAC(w); #if CHAN_TYPE == GL_UNSIGNED_BYTE const GLint ia = IROUND_POS(a * ILERP_SCALE); const GLint ib = IROUND_POS(b * ILERP_SCALE); const GLint ic = IROUND_POS(c * ILERP_SCALE); #endif GLchan t000[4], t010[4], t001[4], t011[4]; GLchan t100[4], t110[4], t101[4], t111[4]; /* Fetch texels */ if (useBorderColor & (I0BIT | J0BIT | K0BIT)) { COPY_CHAN4(t000, tObj->_BorderChan); } else { img->FetchTexelc(img, i0, j0, k0, t000); } if (useBorderColor & (I1BIT | J0BIT | K0BIT)) { COPY_CHAN4(t100, tObj->_BorderChan); } else { img->FetchTexelc(img, i1, j0, k0, t100); } if (useBorderColor & (I0BIT | J1BIT | K0BIT)) { COPY_CHAN4(t010, tObj->_BorderChan); } else { img->FetchTexelc(img, i0, j1, k0, t010); } if (useBorderColor & (I1BIT | J1BIT | K0BIT)) { COPY_CHAN4(t110, tObj->_BorderChan); } else { img->FetchTexelc(img, i1, j1, k0, t110); } if (useBorderColor & (I0BIT | J0BIT | K1BIT)) { COPY_CHAN4(t001, tObj->_BorderChan); } else { img->FetchTexelc(img, i0, j0, k1, t001); } if (useBorderColor & (I1BIT | J0BIT | K1BIT)) { COPY_CHAN4(t101, tObj->_BorderChan); } else { img->FetchTexelc(img, i1, j0, k1, t101); } if (useBorderColor & (I0BIT | J1BIT | K1BIT)) { COPY_CHAN4(t011, tObj->_BorderChan); } else { img->FetchTexelc(img, i0, j1, k1, t011); } if (useBorderColor & (I1BIT | J1BIT | K1BIT)) { COPY_CHAN4(t111, tObj->_BorderChan); } else { img->FetchTexelc(img, i1, j1, k1, t111); } /* trilinear interpolation of samples */ #if CHAN_TYPE == GL_FLOAT rgba[0] = lerp_3d(a, b, c, t000[0], t100[0], t010[0], t110[0], t001[0], t101[0], t011[0], t111[0]); rgba[1] = lerp_3d(a, b, c, t000[1], t100[1], t010[1], t110[1], t001[1], t101[1], t011[1], t111[1]); rgba[2] = lerp_3d(a, b, c, t000[2], t100[2], t010[2], t110[2], t001[2], t101[2], t011[2], t111[2]); rgba[3] = lerp_3d(a, b, c, t000[3], t100[3], t010[3], t110[3], t001[3], t101[3], t011[3], t111[3]); #elif CHAN_TYPE == GL_UNSIGNED_SHORT rgba[0] = (GLchan) (lerp_3d(a, b, c, t000[0], t100[0], t010[0], t110[0], t001[0], t101[0], t011[0], t111[0]) + 0.5F); rgba[1] = (GLchan) (lerp_3d(a, b, c, t000[1], t100[1], t010[1], t110[1], t001[1], t101[1], t011[1], t111[1]) + 0.5F); rgba[2] = (GLchan) (lerp_3d(a, b, c, t000[2], t100[2], t010[2], t110[2], t001[2], t101[2], t011[2], t111[2]) + 0.5F); rgba[3] = (GLchan) (lerp_3d(a, b, c, t000[3], t100[3], t010[3], t110[3], t001[3], t101[3], t011[3], t111[3]) + 0.5F); #else ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE); rgba[0] = ilerp_3d(ia, ib, ic, t000[0], t100[0], t010[0], t110[0], t001[0], t101[0], t011[0], t111[0]); rgba[1] = ilerp_3d(ia, ib, ic, t000[1], t100[1], t010[1], t110[1], t001[1], t101[1], t011[1], t111[1]); rgba[2] = ilerp_3d(ia, ib, ic, t000[2], t100[2], t010[2], t110[2], t001[2], t101[2], t011[2], t111[2]); rgba[3] = ilerp_3d(ia, ib, ic, t000[3], t100[3], t010[3], t110[3], t001[3], t101[3], t011[3], t111[3]); #endif } } static void sample_3d_nearest_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4] ) { GLuint i; for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); sample_3d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } static void sample_3d_linear_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; ASSERT(lambda != NULL); for (i = 0; i < n; i++) { GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); sample_3d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]); } } static void sample_3d_nearest_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; ASSERT(lambda != NULL); for (i = 0; i < n; i++) { GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_3d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_3d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); } } } static void sample_3d_linear_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; ASSERT(lambda != NULL); for (i = 0; i < n; i++) { GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); if (level >= tObj->_MaxLevel) { sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel], texcoord[i], rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_3d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0); sample_3d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); } } } static void sample_nearest_3d(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel]; (void) texUnit; (void) lambda; for (i=0;iImage[0][tObj->BaseLevel]; (void) texUnit; (void) lambda; for (i=0;i_MinMagThresh[texUnit], n, lambda, &minStart, &minEnd, &magStart, &magEnd); if (minStart < minEnd) { /* do the minified texels */ GLuint m = minEnd - minStart; switch (tObj->MinFilter) { case GL_NEAREST: for (i = minStart; i < minEnd; i++) sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_LINEAR: for (i = minStart; i < minEnd; i++) sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_NEAREST_MIPMAP_NEAREST: sample_3d_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; case GL_LINEAR_MIPMAP_NEAREST: sample_3d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; case GL_NEAREST_MIPMAP_LINEAR: sample_3d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; case GL_LINEAR_MIPMAP_LINEAR: sample_3d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; default: _mesa_problem(ctx, "Bad min filter in sample_3d_texture"); return; } } if (magStart < magEnd) { /* do the magnified texels */ switch (tObj->MagFilter) { case GL_NEAREST: for (i = magStart; i < magEnd; i++) sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; case GL_LINEAR: for (i = magStart; i < magEnd; i++) sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel], texcoords[i], rgba[i]); break; default: _mesa_problem(ctx, "Bad mag filter in sample_3d_texture"); return; } } } /**********************************************************************/ /* Texture Cube Map Sampling Functions */ /**********************************************************************/ /* * Choose one of six sides of a texture cube map given the texture * coord (rx,ry,rz). Return pointer to corresponding array of texture * images. */ static const struct gl_texture_image ** choose_cube_face(const struct gl_texture_object *texObj, const GLfloat texcoord[4], GLfloat newCoord[4]) { /* major axis direction target sc tc ma ---------- ------------------------------- --- --- --- +rx TEXTURE_CUBE_MAP_POSITIVE_X_EXT -rz -ry rx -rx TEXTURE_CUBE_MAP_NEGATIVE_X_EXT +rz -ry rx +ry TEXTURE_CUBE_MAP_POSITIVE_Y_EXT +rx +rz ry -ry TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT +rx -rz ry +rz TEXTURE_CUBE_MAP_POSITIVE_Z_EXT +rx -ry rz -rz TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT -rx -ry rz */ const GLfloat rx = texcoord[0]; const GLfloat ry = texcoord[1]; const GLfloat rz = texcoord[2]; const struct gl_texture_image **imgArray; const GLfloat arx = FABSF(rx), ary = FABSF(ry), arz = FABSF(rz); GLfloat sc, tc, ma; if (arx > ary && arx > arz) { if (rx >= 0.0F) { imgArray = (const struct gl_texture_image **) texObj->Image[FACE_POS_X]; sc = -rz; tc = -ry; ma = arx; } else { imgArray = (const struct gl_texture_image **) texObj->Image[FACE_NEG_X]; sc = rz; tc = -ry; ma = arx; } } else if (ary > arx && ary > arz) { if (ry >= 0.0F) { imgArray = (const struct gl_texture_image **) texObj->Image[FACE_POS_Y]; sc = rx; tc = rz; ma = ary; } else { imgArray = (const struct gl_texture_image **) texObj->Image[FACE_NEG_Y]; sc = rx; tc = -rz; ma = ary; } } else { if (rz > 0.0F) { imgArray = (const struct gl_texture_image **) texObj->Image[FACE_POS_Z]; sc = rx; tc = -ry; ma = arz; } else { imgArray = (const struct gl_texture_image **) texObj->Image[FACE_NEG_Z]; sc = -rx; tc = -ry; ma = arz; } } newCoord[0] = ( sc / ma + 1.0F ) * 0.5F; newCoord[1] = ( tc / ma + 1.0F ) * 0.5F; return imgArray; } static void sample_nearest_cube(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; (void) texUnit; (void) lambda; for (i = 0; i < n; i++) { const struct gl_texture_image **images; GLfloat newCoord[4]; images = choose_cube_face(tObj, texcoords[i], newCoord); sample_2d_nearest(ctx, tObj, images[tObj->BaseLevel], newCoord, rgba[i]); } } static void sample_linear_cube(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; (void) texUnit; (void) lambda; for (i = 0; i < n; i++) { const struct gl_texture_image **images; GLfloat newCoord[4]; images = choose_cube_face(tObj, texcoords[i], newCoord); sample_2d_linear(ctx, tObj, images[tObj->BaseLevel], newCoord, rgba[i]); } } static void sample_cube_nearest_mipmap_nearest(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; (void) texUnit; ASSERT(lambda != NULL); for (i = 0; i < n; i++) { const struct gl_texture_image **images; GLfloat newCoord[4]; GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); images = choose_cube_face(tObj, texcoord[i], newCoord); sample_2d_nearest(ctx, tObj, images[level], newCoord, rgba[i]); } } static void sample_cube_linear_mipmap_nearest(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; (void) texUnit; ASSERT(lambda != NULL); for (i = 0; i < n; i++) { const struct gl_texture_image **images; GLfloat newCoord[4]; GLint level; COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); images = choose_cube_face(tObj, texcoord[i], newCoord); sample_2d_linear(ctx, tObj, images[level], newCoord, rgba[i]); } } static void sample_cube_nearest_mipmap_linear(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; (void) texUnit; ASSERT(lambda != NULL); for (i = 0; i < n; i++) { const struct gl_texture_image **images; GLfloat newCoord[4]; GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); images = choose_cube_face(tObj, texcoord[i], newCoord); if (level >= tObj->_MaxLevel) { sample_2d_nearest(ctx, tObj, images[tObj->_MaxLevel], newCoord, rgba[i]); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = FRAC(lambda[i]); sample_2d_nearest(ctx, tObj, images[level ], newCoord, t0); sample_2d_nearest(ctx, tObj, images[level+1], newCoord, t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); } } } static void sample_cube_linear_mipmap_linear(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoord[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; (void) texUnit; ASSERT(lambda != NULL); for (i = 0; i < n; i++) { const struct gl_texture_image **images; GLfloat newCoord[4]; GLint level; COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); images = choose_cube_face(tObj, texcoord[i], newCoord); if (level >= tObj->_MaxLevel) { sample_2d_linear(ctx, tObj, images[tObj->_MaxLevel], newCoord, rgba[i]); } else { GLchan t0[4], t1[4]; const GLfloat f = FRAC(lambda[i]); sample_2d_linear(ctx, tObj, images[level ], newCoord, t0); sample_2d_linear(ctx, tObj, images[level+1], newCoord, t1); rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); } } } static void sample_lambda_cube( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint minStart, minEnd; /* texels with minification */ GLuint magStart, magEnd; /* texels with magnification */ ASSERT(lambda != NULL); compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], n, lambda, &minStart, &minEnd, &magStart, &magEnd); if (minStart < minEnd) { /* do the minified texels */ const GLuint m = minEnd - minStart; switch (tObj->MinFilter) { case GL_NEAREST: sample_nearest_cube(ctx, texUnit, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; case GL_LINEAR: sample_linear_cube(ctx, texUnit, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; case GL_NEAREST_MIPMAP_NEAREST: sample_cube_nearest_mipmap_nearest(ctx, texUnit, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; case GL_LINEAR_MIPMAP_NEAREST: sample_cube_linear_mipmap_nearest(ctx, texUnit, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; case GL_NEAREST_MIPMAP_LINEAR: sample_cube_nearest_mipmap_linear(ctx, texUnit, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; case GL_LINEAR_MIPMAP_LINEAR: sample_cube_linear_mipmap_linear(ctx, texUnit, tObj, m, texcoords + minStart, lambda + minStart, rgba + minStart); break; default: _mesa_problem(ctx, "Bad min filter in sample_lambda_cube"); } } if (magStart < magEnd) { /* do the magnified texels */ const GLuint m = magEnd - magStart; switch (tObj->MagFilter) { case GL_NEAREST: sample_nearest_cube(ctx, texUnit, tObj, m, texcoords + magStart, lambda + magStart, rgba + magStart); break; case GL_LINEAR: sample_linear_cube(ctx, texUnit, tObj, m, texcoords + magStart, lambda + magStart, rgba + magStart); break; default: _mesa_problem(ctx, "Bad mag filter in sample_lambda_cube"); } } } /**********************************************************************/ /* Texture Rectangle Sampling Functions */ /**********************************************************************/ static void sample_nearest_rect(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { const struct gl_texture_image *img = tObj->Image[0][0]; const GLfloat width = (GLfloat) img->Width; const GLfloat height = (GLfloat) img->Height; const GLint width_minus_1 = img->Width - 1; const GLint height_minus_1 = img->Height - 1; GLuint i; (void) ctx; (void) texUnit; (void) lambda; ASSERT(tObj->WrapS == GL_CLAMP || tObj->WrapS == GL_CLAMP_TO_EDGE || tObj->WrapS == GL_CLAMP_TO_BORDER); ASSERT(tObj->WrapT == GL_CLAMP || tObj->WrapT == GL_CLAMP_TO_EDGE || tObj->WrapT == GL_CLAMP_TO_BORDER); ASSERT(img->Format != GL_COLOR_INDEX); /* XXX move Wrap mode tests outside of loops for common cases */ for (i = 0; i < n; i++) { GLint row, col; /* NOTE: we DO NOT use [0, 1] texture coordinates! */ if (tObj->WrapS == GL_CLAMP) { col = IFLOOR( CLAMP(texcoords[i][0], 0.0F, width - 1) ); } else if (tObj->WrapS == GL_CLAMP_TO_EDGE) { col = IFLOOR( CLAMP(texcoords[i][0], 0.5F, width - 0.5F) ); } else { col = IFLOOR( CLAMP(texcoords[i][0], -0.5F, width + 0.5F) ); } if (tObj->WrapT == GL_CLAMP) { row = IFLOOR( CLAMP(texcoords[i][1], 0.0F, height - 1) ); } else if (tObj->WrapT == GL_CLAMP_TO_EDGE) { row = IFLOOR( CLAMP(texcoords[i][1], 0.5F, height - 0.5F) ); } else { row = IFLOOR( CLAMP(texcoords[i][1], -0.5F, height + 0.5F) ); } if (col < 0 || col > width_minus_1 || row < 0 || row > height_minus_1) COPY_CHAN4(rgba[i], tObj->_BorderChan); else img->FetchTexelc(img, col, row, 0, rgba[i]); } } static void sample_linear_rect(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { const struct gl_texture_image *img = tObj->Image[0][0]; const GLfloat width = (GLfloat) img->Width; const GLfloat height = (GLfloat) img->Height; const GLint width_minus_1 = img->Width - 1; const GLint height_minus_1 = img->Height - 1; GLuint i; (void) ctx; (void) texUnit; (void) lambda; ASSERT(tObj->WrapS == GL_CLAMP || tObj->WrapS == GL_CLAMP_TO_EDGE || tObj->WrapS == GL_CLAMP_TO_BORDER); ASSERT(tObj->WrapT == GL_CLAMP || tObj->WrapT == GL_CLAMP_TO_EDGE || tObj->WrapT == GL_CLAMP_TO_BORDER); ASSERT(img->Format != GL_COLOR_INDEX); /* XXX lots of opportunity for optimization in this loop */ for (i = 0; i < n; i++) { GLfloat frow, fcol; GLint i0, j0, i1, j1; GLchan t00[4], t01[4], t10[4], t11[4]; GLfloat a, b; GLuint useBorderColor = 0; #if CHAN_TYPE == GL_UNSIGNED_BYTE GLint ia, ib; #endif /* NOTE: we DO NOT use [0, 1] texture coordinates! */ if (tObj->WrapS == GL_CLAMP) { /* Not exactly what the spec says, but it matches NVIDIA output */ fcol = CLAMP(texcoords[i][0] - 0.5F, 0.0, width_minus_1); i0 = IFLOOR(fcol); i1 = i0 + 1; } else if (tObj->WrapS == GL_CLAMP_TO_EDGE) { fcol = CLAMP(texcoords[i][0], 0.5F, width - 0.5F); fcol -= 0.5F; i0 = IFLOOR(fcol); i1 = i0 + 1; if (i1 > width_minus_1) i1 = width_minus_1; } else { ASSERT(tObj->WrapS == GL_CLAMP_TO_BORDER); fcol = CLAMP(texcoords[i][0], -0.5F, width + 0.5F); fcol -= 0.5F; i0 = IFLOOR(fcol); i1 = i0 + 1; } if (tObj->WrapT == GL_CLAMP) { /* Not exactly what the spec says, but it matches NVIDIA output */ frow = CLAMP(texcoords[i][1] - 0.5F, 0.0, width_minus_1); j0 = IFLOOR(frow); j1 = j0 + 1; } else if (tObj->WrapT == GL_CLAMP_TO_EDGE) { frow = CLAMP(texcoords[i][1], 0.5F, height - 0.5F); frow -= 0.5F; j0 = IFLOOR(frow); j1 = j0 + 1; if (j1 > height_minus_1) j1 = height_minus_1; } else { ASSERT(tObj->WrapT == GL_CLAMP_TO_BORDER); frow = CLAMP(texcoords[i][1], -0.5F, height + 0.5F); frow -= 0.5F; j0 = IFLOOR(frow); j1 = j0 + 1; } /* compute integer rows/columns */ if (i0 < 0 || i0 > width_minus_1) useBorderColor |= I0BIT; if (i1 < 0 || i1 > width_minus_1) useBorderColor |= I1BIT; if (j0 < 0 || j0 > height_minus_1) useBorderColor |= J0BIT; if (j1 < 0 || j1 > height_minus_1) useBorderColor |= J1BIT; /* get four texel samples */ if (useBorderColor & (I0BIT | J0BIT)) COPY_CHAN4(t00, tObj->_BorderChan); else img->FetchTexelc(img, i0, j0, 0, t00); if (useBorderColor & (I1BIT | J0BIT)) COPY_CHAN4(t10, tObj->_BorderChan); else img->FetchTexelc(img, i1, j0, 0, t10); if (useBorderColor & (I0BIT | J1BIT)) COPY_CHAN4(t01, tObj->_BorderChan); else img->FetchTexelc(img, i0, j1, 0, t01); if (useBorderColor & (I1BIT | J1BIT)) COPY_CHAN4(t11, tObj->_BorderChan); else img->FetchTexelc(img, i1, j1, 0, t11); /* compute interpolants */ a = FRAC(fcol); b = FRAC(frow); #if CHAN_TYPE == GL_UNSIGNED_BYTE ia = IROUND_POS(a * ILERP_SCALE); ib = IROUND_POS(b * ILERP_SCALE); #endif /* do bilinear interpolation of texel colors */ #if CHAN_TYPE == GL_FLOAT rgba[i][0] = lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]); rgba[i][1] = lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]); rgba[i][2] = lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]); rgba[i][3] = lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]); #elif CHAN_TYPE == GL_UNSIGNED_SHORT rgba[i][0] = (GLchan) (lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]) + 0.5); rgba[i][1] = (GLchan) (lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]) + 0.5); rgba[i][2] = (GLchan) (lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]) + 0.5); rgba[i][3] = (GLchan) (lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]) + 0.5); #else ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE); rgba[i][0] = ilerp_2d(ia, ib, t00[0], t10[0], t01[0], t11[0]); rgba[i][1] = ilerp_2d(ia, ib, t00[1], t10[1], t01[1], t11[1]); rgba[i][2] = ilerp_2d(ia, ib, t00[2], t10[2], t01[2], t11[2]); rgba[i][3] = ilerp_2d(ia, ib, t00[3], t10[3], t01[3], t11[3]); #endif } } static void sample_lambda_rect( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint minStart, minEnd, magStart, magEnd; /* We only need lambda to decide between minification and magnification. * There is no mipmapping with rectangular textures. */ compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], n, lambda, &minStart, &minEnd, &magStart, &magEnd); if (minStart < minEnd) { if (tObj->MinFilter == GL_NEAREST) { sample_nearest_rect( ctx, texUnit, tObj, minEnd - minStart, texcoords + minStart, NULL, rgba + minStart); } else { sample_linear_rect( ctx, texUnit, tObj, minEnd - minStart, texcoords + minStart, NULL, rgba + minStart); } } if (magStart < magEnd) { if (tObj->MagFilter == GL_NEAREST) { sample_nearest_rect( ctx, texUnit, tObj, magEnd - magStart, texcoords + magStart, NULL, rgba + magStart); } else { sample_linear_rect( ctx, texUnit, tObj, magEnd - magStart, texcoords + magStart, NULL, rgba + magStart); } } } /* * Sample a shadow/depth texture. */ static void sample_depth_texture( GLcontext *ctx, GLuint unit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan texel[][4] ) { const GLint baseLevel = tObj->BaseLevel; const struct gl_texture_image *texImage = tObj->Image[0][baseLevel]; const GLuint width = texImage->Width; const GLuint height = texImage->Height; GLchan ambient; GLenum function; GLchan result; (void) lambda; (void) unit; ASSERT(tObj->Image[0][tObj->BaseLevel]->Format == GL_DEPTH_COMPONENT); ASSERT(tObj->Target == GL_TEXTURE_1D || tObj->Target == GL_TEXTURE_2D || tObj->Target == GL_TEXTURE_RECTANGLE_NV); UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->ShadowAmbient); /* XXXX if tObj->MinFilter != tObj->MagFilter, we're ignoring lambda */ /* XXX this could be precomputed and saved in the texture object */ if (tObj->CompareFlag) { /* GL_SGIX_shadow */ if (tObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { function = GL_LEQUAL; } else { ASSERT(tObj->CompareOperator == GL_TEXTURE_GEQUAL_R_SGIX); function = GL_GEQUAL; } } else if (tObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) { /* GL_ARB_shadow */ function = tObj->CompareFunc; } else { function = GL_NONE; /* pass depth through as grayscale */ } if (tObj->MagFilter == GL_NEAREST) { GLuint i; for (i = 0; i < n; i++) { GLfloat depthSample; GLint col, row; /* XXX fix for texture rectangle! */ COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoords[i][0], width, col); COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoords[i][1], height, row); texImage->FetchTexelf(texImage, col, row, 0, &depthSample); switch (function) { case GL_LEQUAL: result = (texcoords[i][2] <= depthSample) ? CHAN_MAX : ambient; break; case GL_GEQUAL: result = (texcoords[i][2] >= depthSample) ? CHAN_MAX : ambient; break; case GL_LESS: result = (texcoords[i][2] < depthSample) ? CHAN_MAX : ambient; break; case GL_GREATER: result = (texcoords[i][2] > depthSample) ? CHAN_MAX : ambient; break; case GL_EQUAL: result = (texcoords[i][2] == depthSample) ? CHAN_MAX : ambient; break; case GL_NOTEQUAL: result = (texcoords[i][2] != depthSample) ? CHAN_MAX : ambient; break; case GL_ALWAYS: result = CHAN_MAX; break; case GL_NEVER: result = ambient; break; case GL_NONE: CLAMPED_FLOAT_TO_CHAN(result, depthSample); break; default: _mesa_problem(ctx, "Bad compare func in sample_depth_texture"); return; } switch (tObj->DepthMode) { case GL_LUMINANCE: texel[i][RCOMP] = result; texel[i][GCOMP] = result; texel[i][BCOMP] = result; texel[i][ACOMP] = CHAN_MAX; break; case GL_INTENSITY: texel[i][RCOMP] = result; texel[i][GCOMP] = result; texel[i][BCOMP] = result; texel[i][ACOMP] = result; break; case GL_ALPHA: texel[i][RCOMP] = 0; texel[i][GCOMP] = 0; texel[i][BCOMP] = 0; texel[i][ACOMP] = result; break; default: _mesa_problem(ctx, "Bad depth texture mode"); } } } else { GLuint i; ASSERT(tObj->MagFilter == GL_LINEAR); for (i = 0; i < n; i++) { GLfloat depth00, depth01, depth10, depth11; GLint i0, i1, j0, j1; GLfloat u, v; GLuint useBorderTexel; /* XXX fix for texture rectangle! */ COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoords[i][0], u, width, i0, i1); COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoords[i][1], v, height,j0, j1); useBorderTexel = 0; if (texImage->Border) { i0 += texImage->Border; i1 += texImage->Border; j0 += texImage->Border; j1 += texImage->Border; } else { if (i0 < 0 || i0 >= (GLint) width) useBorderTexel |= I0BIT; if (i1 < 0 || i1 >= (GLint) width) useBorderTexel |= I1BIT; if (j0 < 0 || j0 >= (GLint) height) useBorderTexel |= J0BIT; if (j1 < 0 || j1 >= (GLint) height) useBorderTexel |= J1BIT; } /* get four depth samples from the texture */ if (useBorderTexel & (I0BIT | J0BIT)) { depth00 = 1.0; } else { texImage->FetchTexelf(texImage, i0, j0, 0, &depth00); } if (useBorderTexel & (I1BIT | J0BIT)) { depth10 = 1.0; } else { texImage->FetchTexelf(texImage, i1, j0, 0, &depth10); } if (useBorderTexel & (I0BIT | J1BIT)) { depth01 = 1.0; } else { texImage->FetchTexelf(texImage, i0, j1, 0, &depth01); } if (useBorderTexel & (I1BIT | J1BIT)) { depth11 = 1.0; } else { texImage->FetchTexelf(texImage, i1, j1, 0, &depth11); } if (0) { /* compute a single weighted depth sample and do one comparison */ const GLfloat a = FRAC(u + 1.0F); const GLfloat b = FRAC(v + 1.0F); const GLfloat depthSample = lerp_2d(a, b, depth00, depth10, depth01, depth11); if ((depthSample <= texcoords[i][2] && function == GL_LEQUAL) || (depthSample >= texcoords[i][2] && function == GL_GEQUAL)) { result = ambient; } else { result = CHAN_MAX; } } else { /* Do four depth/R comparisons and compute a weighted result. * If this touches on somebody's I.P., I'll remove this code * upon request. */ const GLfloat d = (CHAN_MAXF - (GLfloat) ambient) * 0.25F; GLfloat luminance = CHAN_MAXF; switch (function) { case GL_LEQUAL: if (depth00 <= texcoords[i][2]) luminance -= d; if (depth01 <= texcoords[i][2]) luminance -= d; if (depth10 <= texcoords[i][2]) luminance -= d; if (depth11 <= texcoords[i][2]) luminance -= d; result = (GLchan) luminance; break; case GL_GEQUAL: if (depth00 >= texcoords[i][2]) luminance -= d; if (depth01 >= texcoords[i][2]) luminance -= d; if (depth10 >= texcoords[i][2]) luminance -= d; if (depth11 >= texcoords[i][2]) luminance -= d; result = (GLchan) luminance; break; case GL_LESS: if (depth00 < texcoords[i][2]) luminance -= d; if (depth01 < texcoords[i][2]) luminance -= d; if (depth10 < texcoords[i][2]) luminance -= d; if (depth11 < texcoords[i][2]) luminance -= d; result = (GLchan) luminance; break; case GL_GREATER: if (depth00 > texcoords[i][2]) luminance -= d; if (depth01 > texcoords[i][2]) luminance -= d; if (depth10 > texcoords[i][2]) luminance -= d; if (depth11 > texcoords[i][2]) luminance -= d; result = (GLchan) luminance; break; case GL_EQUAL: if (depth00 == texcoords[i][2]) luminance -= d; if (depth01 == texcoords[i][2]) luminance -= d; if (depth10 == texcoords[i][2]) luminance -= d; if (depth11 == texcoords[i][2]) luminance -= d; result = (GLchan) luminance; break; case GL_NOTEQUAL: if (depth00 != texcoords[i][2]) luminance -= d; if (depth01 != texcoords[i][2]) luminance -= d; if (depth10 != texcoords[i][2]) luminance -= d; if (depth11 != texcoords[i][2]) luminance -= d; result = (GLchan) luminance; break; case GL_ALWAYS: result = 0; break; case GL_NEVER: result = CHAN_MAX; break; case GL_NONE: /* ordinary bilinear filtering */ { const GLfloat a = FRAC(u + 1.0F); const GLfloat b = FRAC(v + 1.0F); const GLfloat depthSample = lerp_2d(a, b, depth00, depth10, depth01, depth11); CLAMPED_FLOAT_TO_CHAN(result, depthSample); } break; default: _mesa_problem(ctx, "Bad compare func in sample_depth_texture"); return; } } switch (tObj->DepthMode) { case GL_LUMINANCE: texel[i][RCOMP] = result; texel[i][GCOMP] = result; texel[i][BCOMP] = result; texel[i][ACOMP] = CHAN_MAX; break; case GL_INTENSITY: texel[i][RCOMP] = result; texel[i][GCOMP] = result; texel[i][BCOMP] = result; texel[i][ACOMP] = result; break; case GL_ALPHA: texel[i][RCOMP] = 0; texel[i][GCOMP] = 0; texel[i][BCOMP] = 0; texel[i][ACOMP] = result; break; default: _mesa_problem(ctx, "Bad depth texture mode"); } } /* for */ } /* if filter */ } #if 0 /* * Experimental depth texture sampling function. */ static void sample_depth_texture2(const GLcontext *ctx, const struct gl_texture_unit *texUnit, GLuint n, const GLfloat texcoords[][4], GLchan texel[][4]) { const struct gl_texture_object *texObj = texUnit->_Current; const GLint baseLevel = texObj->BaseLevel; const struct gl_texture_image *texImage = texObj->Image[0][baseLevel]; const GLuint width = texImage->Width; const GLuint height = texImage->Height; GLchan ambient; GLboolean lequal, gequal; if (texObj->Target != GL_TEXTURE_2D) { _mesa_problem(ctx, "only 2-D depth textures supported at this time"); return; } if (texObj->MinFilter != texObj->MagFilter) { _mesa_problem(ctx, "mipmapped depth textures not supported at this time"); return; } /* XXX the GL_SGIX_shadow extension spec doesn't say what to do if * GL_TEXTURE_COMPARE_SGIX == GL_TRUE but the current texture object * isn't a depth texture. */ if (texImage->Format != GL_DEPTH_COMPONENT) { _mesa_problem(ctx,"GL_TEXTURE_COMPARE_SGIX enabled with non-depth texture"); return; } UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->ShadowAmbient); if (texObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { lequal = GL_TRUE; gequal = GL_FALSE; } else { lequal = GL_FALSE; gequal = GL_TRUE; } { GLuint i; for (i = 0; i < n; i++) { const GLint K = 3; GLint col, row, ii, jj, imin, imax, jmin, jmax, samples, count; GLfloat w; GLchan lum; COMPUTE_NEAREST_TEXEL_LOCATION(texObj->WrapS, texcoords[i][0], width, col); COMPUTE_NEAREST_TEXEL_LOCATION(texObj->WrapT, texcoords[i][1], height, row); imin = col - K; imax = col + K; jmin = row - K; jmax = row + K; if (imin < 0) imin = 0; if (imax >= width) imax = width - 1; if (jmin < 0) jmin = 0; if (jmax >= height) jmax = height - 1; samples = (imax - imin + 1) * (jmax - jmin + 1); count = 0; for (jj = jmin; jj <= jmax; jj++) { for (ii = imin; ii <= imax; ii++) { GLfloat depthSample; texImage->FetchTexelf(texImage, ii, jj, 0, &depthSample); if ((depthSample <= r[i] && lequal) || (depthSample >= r[i] && gequal)) { count++; } } } w = (GLfloat) count / (GLfloat) samples; w = CHAN_MAXF - w * (CHAN_MAXF - (GLfloat) ambient); lum = (GLint) w; texel[i][RCOMP] = lum; texel[i][GCOMP] = lum; texel[i][BCOMP] = lum; texel[i][ACOMP] = CHAN_MAX; } } } #endif /** * We use this function when a texture object is in an "incomplete" state. * When a fragment program attempts to sample an incomplete texture we * return black (see issue 23 in GL_ARB_fragment_program spec). * Note: fragment programss don't observe the texture enable/disable flags. */ static void null_sample_func( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, const GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; (void) ctx; (void) texUnit; (void) tObj; (void) texcoords; (void) lambda; for (i = 0; i < n; i++) { rgba[i][RCOMP] = 0; rgba[i][GCOMP] = 0; rgba[i][BCOMP] = 0; rgba[i][ACOMP] = CHAN_MAX; } } /** * Setup the texture sampling function for this texture object. */ texture_sample_func _swrast_choose_texture_sample_func( GLcontext *ctx, const struct gl_texture_object *t ) { if (!t || !t->Complete) { return &null_sample_func; } else { const GLboolean needLambda = (GLboolean) (t->MinFilter != t->MagFilter); const GLenum format = t->Image[0][t->BaseLevel]->Format; switch (t->Target) { case GL_TEXTURE_1D: if (format == GL_DEPTH_COMPONENT) { return &sample_depth_texture; } else if (needLambda) { return &sample_lambda_1d; } else if (t->MinFilter == GL_LINEAR) { return &sample_linear_1d; } else { ASSERT(t->MinFilter == GL_NEAREST); return &sample_nearest_1d; } case GL_TEXTURE_2D: if (format == GL_DEPTH_COMPONENT) { return &sample_depth_texture; } else if (needLambda) { return &sample_lambda_2d; } else if (t->MinFilter == GL_LINEAR) { return &sample_linear_2d; } else { GLint baseLevel = t->BaseLevel; ASSERT(t->MinFilter == GL_NEAREST); if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && t->_IsPowerOfTwo && t->Image[0][baseLevel]->Border == 0 && t->Image[0][baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGB) { return &opt_sample_rgb_2d; } else if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && t->_IsPowerOfTwo && t->Image[0][baseLevel]->Border == 0 && t->Image[0][baseLevel]->TexFormat->MesaFormat == MESA_FORMAT_RGBA) { return &opt_sample_rgba_2d; } else { return &sample_nearest_2d; } } case GL_TEXTURE_3D: if (needLambda) { return &sample_lambda_3d; } else if (t->MinFilter == GL_LINEAR) { return &sample_linear_3d; } else { ASSERT(t->MinFilter == GL_NEAREST); return &sample_nearest_3d; } case GL_TEXTURE_CUBE_MAP: if (needLambda) { return &sample_lambda_cube; } else if (t->MinFilter == GL_LINEAR) { return &sample_linear_cube; } else { ASSERT(t->MinFilter == GL_NEAREST); return &sample_nearest_cube; } case GL_TEXTURE_RECTANGLE_NV: if (needLambda) { return &sample_lambda_rect; } else if (t->MinFilter == GL_LINEAR) { return &sample_linear_rect; } else { ASSERT(t->MinFilter == GL_NEAREST); return &sample_nearest_rect; } default: _mesa_problem(ctx, "invalid target in _swrast_choose_texture_sample_func"); return &null_sample_func; } } } #define PROD(A,B) ( (GLuint)(A) * ((GLuint)(B)+1) ) #define S_PROD(A,B) ( (GLint)(A) * ((GLint)(B)+1) ) /** * Do texture application for GL_ARB/EXT_texture_env_combine. * This function also supports GL_{EXT,ARB}_texture_env_dot3 and * GL_ATI_texture_env_combine3. Since "classic" texture environments are * implemented using GL_ARB_texture_env_combine-like state, this same function * is used for classic texture environment application as well. * * \param ctx rendering context * \param textureUnit the texture unit to apply * \param n number of fragments to process (span width) * \param primary_rgba incoming fragment color array * \param texelBuffer pointer to texel colors for all texture units * * \param rgba incoming colors, which get modified here */ static INLINE void texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, CONST GLchan (*primary_rgba)[4], CONST GLchan *texelBuffer, GLchan (*rgba)[4] ) { const struct gl_texture_unit *textureUnit = &(ctx->Texture.Unit[unit]); const GLchan (*argRGB [3])[4]; const GLchan (*argA [3])[4]; const GLuint RGBshift = textureUnit->_CurrentCombine->ScaleShiftRGB; const GLuint Ashift = textureUnit->_CurrentCombine->ScaleShiftA; #if CHAN_TYPE == GL_FLOAT const GLchan RGBmult = (GLfloat) (1 << RGBshift); const GLchan Amult = (GLfloat) (1 << Ashift); static const GLchan one[4] = { 1.0, 1.0, 1.0, 1.0 }; static const GLchan zero[4] = { 0.0, 0.0, 0.0, 0.0 }; #else const GLint half = (CHAN_MAX + 1) / 2; static const GLchan one[4] = { CHAN_MAX, CHAN_MAX, CHAN_MAX, CHAN_MAX }; static const GLchan zero[4] = { 0, 0, 0, 0 }; #endif GLuint i, j; GLuint numColorArgs; GLuint numAlphaArgs; /* GLchan ccolor[3][4]; */ DEFMNARRAY(GLchan, ccolor, 3, 3 * MAX_WIDTH, 4); /* mac 32k limitation */ CHECKARRAY(ccolor, return); /* mac 32k limitation */ ASSERT(ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine); ASSERT(SWRAST_CONTEXT(ctx)->_AnyTextureCombine); /* printf("modeRGB 0x%x modeA 0x%x srcRGB1 0x%x srcA1 0x%x srcRGB2 0x%x srcA2 0x%x\n", textureUnit->_CurrentCombine->ModeRGB, textureUnit->_CurrentCombine->ModeA, textureUnit->_CurrentCombine->SourceRGB[0], textureUnit->_CurrentCombine->SourceA[0], textureUnit->_CurrentCombine->SourceRGB[1], textureUnit->_CurrentCombine->SourceA[1]); */ /* * Do operand setup for up to 3 operands. Loop over the terms. */ numColorArgs = textureUnit->_CurrentCombine->_NumArgsRGB; numAlphaArgs = textureUnit->_CurrentCombine->_NumArgsA; for (j = 0; j < numColorArgs; j++) { const GLenum srcRGB = textureUnit->_CurrentCombine->SourceRGB[j]; switch (srcRGB) { case GL_TEXTURE: argRGB[j] = (const GLchan (*)[4]) (texelBuffer + unit * (n * 4 * sizeof(GLchan))); break; case GL_PRIMARY_COLOR: argRGB[j] = primary_rgba; break; case GL_PREVIOUS: argRGB[j] = (const GLchan (*)[4]) rgba; break; case GL_CONSTANT: { GLchan (*c)[4] = ccolor[j]; GLchan red, green, blue, alpha; UNCLAMPED_FLOAT_TO_CHAN(red, textureUnit->EnvColor[0]); UNCLAMPED_FLOAT_TO_CHAN(green, textureUnit->EnvColor[1]); UNCLAMPED_FLOAT_TO_CHAN(blue, textureUnit->EnvColor[2]); UNCLAMPED_FLOAT_TO_CHAN(alpha, textureUnit->EnvColor[3]); for (i = 0; i < n; i++) { c[i][RCOMP] = red; c[i][GCOMP] = green; c[i][BCOMP] = blue; c[i][ACOMP] = alpha; } argRGB[j] = (const GLchan (*)[4]) ccolor[j]; } break; /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources. */ case GL_ZERO: argRGB[j] = & zero; break; case GL_ONE: argRGB[j] = & one; break; default: /* ARB_texture_env_crossbar source */ { const GLuint srcUnit = srcRGB - GL_TEXTURE0; ASSERT(srcUnit < ctx->Const.MaxTextureUnits); if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) return; argRGB[j] = (const GLchan (*)[4]) (texelBuffer + srcUnit * (n * 4 * sizeof(GLchan))); } } if (textureUnit->_CurrentCombine->OperandRGB[j] != GL_SRC_COLOR) { const GLchan (*src)[4] = argRGB[j]; GLchan (*dst)[4] = ccolor[j]; /* point to new arg[j] storage */ argRGB[j] = (const GLchan (*)[4]) ccolor[j]; if (textureUnit->_CurrentCombine->OperandRGB[j] == GL_ONE_MINUS_SRC_COLOR) { for (i = 0; i < n; i++) { dst[i][RCOMP] = CHAN_MAX - src[i][RCOMP]; dst[i][GCOMP] = CHAN_MAX - src[i][GCOMP]; dst[i][BCOMP] = CHAN_MAX - src[i][BCOMP]; } } else if (textureUnit->_CurrentCombine->OperandRGB[j] == GL_SRC_ALPHA) { for (i = 0; i < n; i++) { dst[i][RCOMP] = src[i][ACOMP]; dst[i][GCOMP] = src[i][ACOMP]; dst[i][BCOMP] = src[i][ACOMP]; } } else { ASSERT(textureUnit->_CurrentCombine->OperandRGB[j] ==GL_ONE_MINUS_SRC_ALPHA); for (i = 0; i < n; i++) { dst[i][RCOMP] = CHAN_MAX - src[i][ACOMP]; dst[i][GCOMP] = CHAN_MAX - src[i][ACOMP]; dst[i][BCOMP] = CHAN_MAX - src[i][ACOMP]; } } } } for (j = 0; j < numAlphaArgs; j++) { const GLenum srcA = textureUnit->_CurrentCombine->SourceA[j]; switch (srcA) { case GL_TEXTURE: argA[j] = (const GLchan (*)[4]) (texelBuffer + unit * (n * 4 * sizeof(GLchan))); break; case GL_PRIMARY_COLOR: argA[j] = primary_rgba; break; case GL_PREVIOUS: argA[j] = (const GLchan (*)[4]) rgba; break; case GL_CONSTANT: { GLchan alpha, (*c)[4] = ccolor[j]; UNCLAMPED_FLOAT_TO_CHAN(alpha, textureUnit->EnvColor[3]); for (i = 0; i < n; i++) c[i][ACOMP] = alpha; argA[j] = (const GLchan (*)[4]) ccolor[j]; } break; /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources. */ case GL_ZERO: argA[j] = & zero; break; case GL_ONE: argA[j] = & one; break; default: /* ARB_texture_env_crossbar source */ { const GLuint srcUnit = srcA - GL_TEXTURE0; ASSERT(srcUnit < ctx->Const.MaxTextureUnits); if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) return; argA[j] = (const GLchan (*)[4]) (texelBuffer + srcUnit * (n * 4 * sizeof(GLchan))); } } if (textureUnit->_CurrentCombine->OperandA[j] == GL_ONE_MINUS_SRC_ALPHA) { const GLchan (*src)[4] = argA[j]; GLchan (*dst)[4] = ccolor[j]; argA[j] = (const GLchan (*)[4]) ccolor[j]; for (i = 0; i < n; i++) { dst[i][ACOMP] = CHAN_MAX - src[i][ACOMP]; } } } /* * Do the texture combine. */ switch (textureUnit->_CurrentCombine->ModeRGB) { case GL_REPLACE: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; if (RGBshift) { for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = arg0[i][RCOMP] * RGBmult; rgba[i][GCOMP] = arg0[i][GCOMP] * RGBmult; rgba[i][BCOMP] = arg0[i][BCOMP] * RGBmult; #else GLuint r = (GLuint) arg0[i][RCOMP] << RGBshift; GLuint g = (GLuint) arg0[i][GCOMP] << RGBshift; GLuint b = (GLuint) arg0[i][BCOMP] << RGBshift; rgba[i][RCOMP] = MIN2(r, CHAN_MAX); rgba[i][GCOMP] = MIN2(g, CHAN_MAX); rgba[i][BCOMP] = MIN2(b, CHAN_MAX); #endif } } else { for (i = 0; i < n; i++) { rgba[i][RCOMP] = arg0[i][RCOMP]; rgba[i][GCOMP] = arg0[i][GCOMP]; rgba[i][BCOMP] = arg0[i][BCOMP]; } } } break; case GL_MODULATE: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; #if CHAN_TYPE != GL_FLOAT const GLint shift = CHAN_BITS - RGBshift; #endif for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = arg0[i][RCOMP] * arg1[i][RCOMP] * RGBmult; rgba[i][GCOMP] = arg0[i][GCOMP] * arg1[i][GCOMP] * RGBmult; rgba[i][BCOMP] = arg0[i][BCOMP] * arg1[i][BCOMP] * RGBmult; #else GLuint r = PROD(arg0[i][RCOMP], arg1[i][RCOMP]) >> shift; GLuint g = PROD(arg0[i][GCOMP], arg1[i][GCOMP]) >> shift; GLuint b = PROD(arg0[i][BCOMP], arg1[i][BCOMP]) >> shift; rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); #endif } } break; case GL_ADD: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP]) * RGBmult; rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP]) * RGBmult; rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP]) * RGBmult; #else GLint r = ((GLint) arg0[i][RCOMP] + (GLint) arg1[i][RCOMP]) << RGBshift; GLint g = ((GLint) arg0[i][GCOMP] + (GLint) arg1[i][GCOMP]) << RGBshift; GLint b = ((GLint) arg0[i][BCOMP] + (GLint) arg1[i][BCOMP]) << RGBshift; rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); #endif } } break; case GL_ADD_SIGNED: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * RGBmult; rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * RGBmult; rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * RGBmult; #else GLint r = (GLint) arg0[i][RCOMP] + (GLint) arg1[i][RCOMP] -half; GLint g = (GLint) arg0[i][GCOMP] + (GLint) arg1[i][GCOMP] -half; GLint b = (GLint) arg0[i][BCOMP] + (GLint) arg1[i][BCOMP] -half; r = (r < 0) ? 0 : r << RGBshift; g = (g < 0) ? 0 : g << RGBshift; b = (b < 0) ? 0 : b << RGBshift; rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); #endif } } break; case GL_INTERPOLATE: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; #if CHAN_TYPE != GL_FLOAT const GLint shift = CHAN_BITS - RGBshift; #endif for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = (arg0[i][RCOMP] * arg2[i][RCOMP] + arg1[i][RCOMP] * (CHAN_MAXF - arg2[i][RCOMP])) * RGBmult; rgba[i][GCOMP] = (arg0[i][GCOMP] * arg2[i][GCOMP] + arg1[i][GCOMP] * (CHAN_MAXF - arg2[i][GCOMP])) * RGBmult; rgba[i][BCOMP] = (arg0[i][BCOMP] * arg2[i][BCOMP] + arg1[i][BCOMP] * (CHAN_MAXF - arg2[i][BCOMP])) * RGBmult; #else GLuint r = (PROD(arg0[i][RCOMP], arg2[i][RCOMP]) + PROD(arg1[i][RCOMP], CHAN_MAX - arg2[i][RCOMP])) >> shift; GLuint g = (PROD(arg0[i][GCOMP], arg2[i][GCOMP]) + PROD(arg1[i][GCOMP], CHAN_MAX - arg2[i][GCOMP])) >> shift; GLuint b = (PROD(arg0[i][BCOMP], arg2[i][BCOMP]) + PROD(arg1[i][BCOMP], CHAN_MAX - arg2[i][BCOMP])) >> shift; rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); #endif } } break; case GL_SUBTRACT: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = (arg0[i][RCOMP] - arg1[i][RCOMP]) * RGBmult; rgba[i][GCOMP] = (arg0[i][GCOMP] - arg1[i][GCOMP]) * RGBmult; rgba[i][BCOMP] = (arg0[i][BCOMP] - arg1[i][BCOMP]) * RGBmult; #else GLint r = ((GLint) arg0[i][RCOMP] - (GLint) arg1[i][RCOMP]) << RGBshift; GLint g = ((GLint) arg0[i][GCOMP] - (GLint) arg1[i][GCOMP]) << RGBshift; GLint b = ((GLint) arg0[i][BCOMP] - (GLint) arg1[i][BCOMP]) << RGBshift; rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); #endif } } break; case GL_DOT3_RGB_EXT: case GL_DOT3_RGBA_EXT: { /* Do not scale the result by 1 2 or 4 */ const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT GLchan dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) * 4.0F; dot = CLAMP(dot, 0.0F, CHAN_MAXF); #else GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - half, (GLint)arg1[i][RCOMP] - half) + S_PROD((GLint)arg0[i][GCOMP] - half, (GLint)arg1[i][GCOMP] - half) + S_PROD((GLint)arg0[i][BCOMP] - half, (GLint)arg1[i][BCOMP] - half)) >> 6; dot = CLAMP(dot, 0, CHAN_MAX); #endif rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLchan) dot; } } break; case GL_DOT3_RGB: case GL_DOT3_RGBA: { /* DO scale the result by 1 2 or 4 */ const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT GLchan dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) * 4.0F * RGBmult; dot = CLAMP(dot, 0.0, CHAN_MAXF); #else GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - half, (GLint)arg1[i][RCOMP] - half) + S_PROD((GLint)arg0[i][GCOMP] - half, (GLint)arg1[i][GCOMP] - half) + S_PROD((GLint)arg0[i][BCOMP] - half, (GLint)arg1[i][BCOMP] - half)) >> 6; dot <<= RGBshift; dot = CLAMP(dot, 0, CHAN_MAX); #endif rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLchan) dot; } } break; case GL_MODULATE_ADD_ATI: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; #if CHAN_TYPE != GL_FLOAT const GLint shift = CHAN_BITS - RGBshift; #endif for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + arg1[i][RCOMP]) * RGBmult; rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + arg1[i][GCOMP]) * RGBmult; rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + arg1[i][BCOMP]) * RGBmult; #else GLuint r = (PROD(arg0[i][RCOMP], arg2[i][RCOMP]) + ((GLuint) arg1[i][RCOMP] << CHAN_BITS)) >> shift; GLuint g = (PROD(arg0[i][GCOMP], arg2[i][GCOMP]) + ((GLuint) arg1[i][GCOMP] << CHAN_BITS)) >> shift; GLuint b = (PROD(arg0[i][BCOMP], arg2[i][BCOMP]) + ((GLuint) arg1[i][BCOMP] << CHAN_BITS)) >> shift; rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); #endif } } break; case GL_MODULATE_SIGNED_ADD_ATI: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; #if CHAN_TYPE != GL_FLOAT const GLint shift = CHAN_BITS - RGBshift; #endif for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + arg1[i][RCOMP] - 0.5) * RGBmult; rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + arg1[i][GCOMP] - 0.5) * RGBmult; rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + arg1[i][BCOMP] - 0.5) * RGBmult; #else GLint r = (S_PROD(arg0[i][RCOMP], arg2[i][RCOMP]) + (((GLint) arg1[i][RCOMP] - half) << CHAN_BITS)) >> shift; GLint g = (S_PROD(arg0[i][GCOMP], arg2[i][GCOMP]) + (((GLint) arg1[i][GCOMP] - half) << CHAN_BITS)) >> shift; GLint b = (S_PROD(arg0[i][BCOMP], arg2[i][BCOMP]) + (((GLint) arg1[i][BCOMP] - half) << CHAN_BITS)) >> shift; rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); #endif } } break; case GL_MODULATE_SUBTRACT_ATI: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; #if CHAN_TYPE != GL_FLOAT const GLint shift = CHAN_BITS - RGBshift; #endif for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) - arg1[i][RCOMP]) * RGBmult; rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) - arg1[i][GCOMP]) * RGBmult; rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) - arg1[i][BCOMP]) * RGBmult; #else GLint r = (S_PROD(arg0[i][RCOMP], arg2[i][RCOMP]) - ((GLint) arg1[i][RCOMP] << CHAN_BITS)) >> shift; GLint g = (S_PROD(arg0[i][GCOMP], arg2[i][GCOMP]) - ((GLint) arg1[i][GCOMP] << CHAN_BITS)) >> shift; GLint b = (S_PROD(arg0[i][BCOMP], arg2[i][BCOMP]) - ((GLint) arg1[i][BCOMP] << CHAN_BITS)) >> shift; rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); #endif } } break; default: _mesa_problem(ctx, "invalid combine mode"); } switch (textureUnit->_CurrentCombine->ModeA) { case GL_REPLACE: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; if (Ashift) { for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT GLchan a = arg0[i][ACOMP] * Amult; #else GLuint a = (GLuint) arg0[i][ACOMP] << Ashift; #endif rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); } } else { for (i = 0; i < n; i++) { rgba[i][ACOMP] = arg0[i][ACOMP]; } } } break; case GL_MODULATE: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; #if CHAN_TYPE != GL_FLOAT const GLint shift = CHAN_BITS - Ashift; #endif for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][ACOMP] = arg0[i][ACOMP] * arg1[i][ACOMP] * Amult; #else GLuint a = (PROD(arg0[i][ACOMP], arg1[i][ACOMP]) >> shift); rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); #endif } } break; case GL_ADD: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP]) * Amult; #else GLint a = ((GLint) arg0[i][ACOMP] + arg1[i][ACOMP]) << Ashift; rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); #endif } } break; case GL_ADD_SIGNED: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP] - 0.5F) * Amult; #else GLint a = (GLint) arg0[i][ACOMP] + (GLint) arg1[i][ACOMP] -half; a = (a < 0) ? 0 : a << Ashift; rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); #endif } } break; case GL_INTERPOLATE: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; #if CHAN_TYPE != GL_FLOAT const GLint shift = CHAN_BITS - Ashift; #endif for (i=0; i> shift; rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX); #endif } } break; case GL_SUBTRACT: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][ACOMP] = (arg0[i][ACOMP] - arg1[i][ACOMP]) * Amult; #else GLint a = ((GLint) arg0[i][ACOMP] - (GLint) arg1[i][ACOMP]) << Ashift; rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); #endif } } break; case GL_MODULATE_ADD_ATI: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; #if CHAN_TYPE != GL_FLOAT const GLint shift = CHAN_BITS - Ashift; #endif for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + arg1[i][ACOMP]) * Amult; #else GLint a = (PROD(arg0[i][ACOMP], arg2[i][ACOMP]) + ((GLuint) arg1[i][ACOMP] << CHAN_BITS)) >> shift; rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); #endif } } break; case GL_MODULATE_SIGNED_ADD_ATI: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; #if CHAN_TYPE != GL_FLOAT const GLint shift = CHAN_BITS - Ashift; #endif for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + arg1[i][ACOMP] - 0.5F) * Amult; #else GLint a = (S_PROD(arg0[i][ACOMP], arg2[i][ACOMP]) + (((GLint) arg1[i][ACOMP] - half) << CHAN_BITS)) >> shift; rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); #endif } } break; case GL_MODULATE_SUBTRACT_ATI: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; #if CHAN_TYPE != GL_FLOAT const GLint shift = CHAN_BITS - Ashift; #endif for (i = 0; i < n; i++) { #if CHAN_TYPE == GL_FLOAT rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) - arg1[i][ACOMP]) * Amult; #else GLint a = (S_PROD(arg0[i][ACOMP], arg2[i][ACOMP]) - ((GLint) arg1[i][ACOMP] << CHAN_BITS)) >> shift; rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); #endif } } break; default: _mesa_problem(ctx, "invalid combine mode"); } /* Fix the alpha component for GL_DOT3_RGBA_EXT/ARB combining. * This is kind of a kludge. It would have been better if the spec * were written such that the GL_COMBINE_ALPHA value could be set to * GL_DOT3. */ if (textureUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA_EXT || textureUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA) { for (i = 0; i < n; i++) { rgba[i][ACOMP] = rgba[i][RCOMP]; } } UNDEFARRAY(ccolor); /* mac 32k limitation */ } #undef PROD /** * Apply a conventional OpenGL texture env mode (REPLACE, ADD, BLEND, * MODULATE, or DECAL) to an array of fragments. * Input: textureUnit - pointer to texture unit to apply * format - base internal texture format * n - number of fragments * primary_rgba - primary colors (may alias rgba for single texture) * texels - array of texel colors * InOut: rgba - incoming fragment colors modified by texel colors * according to the texture environment mode. */ static void texture_apply( const GLcontext *ctx, const struct gl_texture_unit *texUnit, GLuint n, CONST GLchan primary_rgba[][4], CONST GLchan texel[][4], GLchan rgba[][4] ) { GLint baseLevel; GLuint i; GLint Rc, Gc, Bc, Ac; GLenum format; (void) primary_rgba; ASSERT(texUnit); ASSERT(texUnit->_Current); baseLevel = texUnit->_Current->BaseLevel; ASSERT(texUnit->_Current->Image[0][baseLevel]); format = texUnit->_Current->Image[0][baseLevel]->Format; if (format == GL_COLOR_INDEX || format == GL_YCBCR_MESA) { format = GL_RGBA; /* a bit of a hack */ } else if (format == GL_DEPTH_COMPONENT) { format = texUnit->_Current->DepthMode; } switch (texUnit->EnvMode) { case GL_REPLACE: switch (format) { case GL_ALPHA: for (i=0;iEnvColor[0] * CHAN_MAXF); Gc = (GLint) (texUnit->EnvColor[1] * CHAN_MAXF); Bc = (GLint) (texUnit->EnvColor[2] * CHAN_MAXF); Ac = (GLint) (texUnit->EnvColor[3] * CHAN_MAXF); switch (format) { case GL_ALPHA: for (i=0;iend < MAX_WIDTH); ASSERT(span->arrayMask & SPAN_TEXTURE); /* * Save copy of the incoming fragment colors (the GL_PRIMARY_COLOR) */ if (swrast->_AnyTextureCombine) MEMCPY(primary_rgba, span->array->rgba, 4 * span->end * sizeof(GLchan)); /* * Must do all texture sampling before combining in order to * accomodate GL_ARB_texture_env_crossbar. */ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled) { const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const struct gl_texture_object *curObj = texUnit->_Current; GLfloat *lambda = span->array->lambda[unit]; GLchan (*texels)[4] = (GLchan (*)[4]) (swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLchan))); /* adjust texture lod (lambda) */ if (span->arrayMask & SPAN_LAMBDA) { if (texUnit->LodBias + curObj->LodBias != 0.0F) { /* apply LOD bias, but don't clamp yet */ const GLfloat bias = CLAMP(texUnit->LodBias + curObj->LodBias, -ctx->Const.MaxTextureLodBias, ctx->Const.MaxTextureLodBias); GLuint i; for (i = 0; i < span->end; i++) { lambda[i] += bias; } } if (curObj->MinLod != -1000.0 || curObj->MaxLod != 1000.0) { /* apply LOD clamping to lambda */ const GLfloat min = curObj->MinLod; const GLfloat max = curObj->MaxLod; GLuint i; for (i = 0; i < span->end; i++) { GLfloat l = lambda[i]; lambda[i] = CLAMP(l, min, max); } } } /* Sample the texture (span->end fragments) */ swrast->TextureSample[unit]( ctx, unit, texUnit->_Current, span->end, (const GLfloat (*)[4]) span->array->texcoords[unit], lambda, texels ); /* GL_SGI_texture_color_table */ if (texUnit->ColorTableEnabled) { _mesa_lookup_rgba_chan(&texUnit->ColorTable, span->end, texels); } } } /* * OK, now apply the texture (aka texture combine/blend). * We modify the span->color.rgba values. */ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled) { const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; if (texUnit->_CurrentCombine != &texUnit->_EnvMode ) { texture_combine( ctx, unit, span->end, (CONST GLchan (*)[4]) primary_rgba, swrast->TexelBuffer, span->array->rgba ); } else { /* conventional texture blend */ const GLchan (*texels)[4] = (const GLchan (*)[4]) (swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLchan))); texture_apply( ctx, texUnit, span->end, (CONST GLchan (*)[4]) primary_rgba, texels, span->array->rgba ); } } } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_texture.h0000644000000000000000000000267213614532424020742 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_TEXTURE_H #define S_TEXTURE_H #include "mtypes.h" #include "swrast.h" extern texture_sample_func _swrast_choose_texture_sample_func( GLcontext *ctx, const struct gl_texture_object *tObj ); extern void _swrast_texture_span( GLcontext *ctx, struct sw_span *span ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_triangle.c0000644000000000000000000011127113614532424021036 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * When the device driver doesn't implement triangle rasterization it * can hook in _swrast_Triangle, which eventually calls one of these * functions to draw triangles. */ #include "glheader.h" #include "context.h" #include "colormac.h" #include "imports.h" #include "macros.h" #include "texformat.h" #include "s_aatriangle.h" #include "s_context.h" #include "s_depth.h" #include "s_feedback.h" #include "s_span.h" #include "s_triangle.h" /* * Just used for feedback mode. */ GLboolean _swrast_culltriangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ) { GLfloat ex = v1->win[0] - v0->win[0]; GLfloat ey = v1->win[1] - v0->win[1]; GLfloat fx = v2->win[0] - v0->win[0]; GLfloat fy = v2->win[1] - v0->win[1]; GLfloat c = ex*fy-ey*fx; if (c * SWRAST_CONTEXT(ctx)->_BackfaceSign > 0) return 0; return 1; } /* * Render a flat-shaded color index triangle. */ #define NAME flat_ci_triangle #define INTERP_Z 1 #define INTERP_FOG 1 #define SETUP_CODE \ span.interpMask |= SPAN_INDEX; \ span.index = FloatToFixed(v2->index);\ span.indexStep = 0; #define RENDER_SPAN( span ) _swrast_write_index_span(ctx, &span); #include "s_tritemp.h" /* * Render a smooth-shaded color index triangle. */ #define NAME smooth_ci_triangle #define INTERP_Z 1 #define INTERP_FOG 1 #define INTERP_INDEX 1 #define RENDER_SPAN( span ) _swrast_write_index_span(ctx, &span); #include "s_tritemp.h" /* * Render a flat-shaded RGBA triangle. */ #define NAME flat_rgba_triangle #define INTERP_Z 1 #define INTERP_FOG 1 #define SETUP_CODE \ ASSERT(ctx->Texture._EnabledCoordUnits == 0);\ ASSERT(ctx->Light.ShadeModel==GL_FLAT); \ span.interpMask |= SPAN_RGBA; \ span.red = ChanToFixed(v2->color[0]); \ span.green = ChanToFixed(v2->color[1]); \ span.blue = ChanToFixed(v2->color[2]); \ span.alpha = ChanToFixed(v2->color[3]); \ span.redStep = 0; \ span.greenStep = 0; \ span.blueStep = 0; \ span.alphaStep = 0; #define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span); #include "s_tritemp.h" /* * Render a smooth-shaded RGBA triangle. */ #define NAME smooth_rgba_triangle #define INTERP_Z 1 #define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 #define SETUP_CODE \ { \ /* texturing must be off */ \ ASSERT(ctx->Texture._EnabledCoordUnits == 0); \ ASSERT(ctx->Light.ShadeModel==GL_SMOOTH); \ } #define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span); #include "s_tritemp.h" /* * Render an RGB, GL_DECAL, textured triangle. * Interpolate S,T only w/out mipmapping or perspective correction. * * No fog. */ #define NAME simple_textured_triangle #define INTERP_INT_TEX 1 #define S_SCALE twidth #define T_SCALE theight #define SETUP_CODE \ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0];\ struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ const GLint b = obj->BaseLevel; \ const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \ const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \ const GLint smask = obj->Image[0][b]->Width - 1; \ const GLint tmask = obj->Image[0][b]->Height - 1; \ if (!texture) { \ /* this shouldn't happen */ \ return; \ } #define RENDER_SPAN( span ) { \ GLuint i; \ span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \ span.intTex[1] -= FIXED_HALF; \ for (i = 0; i < span.end; i++) { \ GLint s = FixedToInt(span.intTex[0]) & smask; \ GLint t = FixedToInt(span.intTex[1]) & tmask; \ GLint pos = (t << twidth_log2) + s; \ pos = pos + pos + pos; /* multiply by 3 */ \ span.array->rgb[i][RCOMP] = texture[pos]; \ span.array->rgb[i][GCOMP] = texture[pos+1]; \ span.array->rgb[i][BCOMP] = texture[pos+2]; \ span.intTex[0] += span.intTexStep[0]; \ span.intTex[1] += span.intTexStep[1]; \ } \ rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, span.array->rgb, NULL); } #include "s_tritemp.h" /* * Render an RGB, GL_DECAL, textured triangle. * Interpolate S,T, GL_LESS depth test, w/out mipmapping or * perspective correction. * Depth buffer bits must be <= sizeof(DEFAULT_SOFTWARE_DEPTH_TYPE) * * No fog. */ #define NAME simple_z_textured_triangle #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_INT_TEX 1 #define S_SCALE twidth #define T_SCALE theight #define SETUP_CODE \ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0];\ struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ const GLint b = obj->BaseLevel; \ const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \ const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \ const GLint smask = obj->Image[0][b]->Width - 1; \ const GLint tmask = obj->Image[0][b]->Height - 1; \ if (!texture) { \ /* this shouldn't happen */ \ return; \ } #define RENDER_SPAN( span ) { \ GLuint i; \ span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \ span.intTex[1] -= FIXED_HALF; \ for (i = 0; i < span.end; i++) { \ const GLdepth z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ GLint s = FixedToInt(span.intTex[0]) & smask; \ GLint t = FixedToInt(span.intTex[1]) & tmask; \ GLint pos = (t << twidth_log2) + s; \ pos = pos + pos + pos; /* multiply by 3 */ \ span.array->rgb[i][RCOMP] = texture[pos]; \ span.array->rgb[i][GCOMP] = texture[pos+1]; \ span.array->rgb[i][BCOMP] = texture[pos+2]; \ zRow[i] = z; \ span.array->mask[i] = 1; \ } \ else { \ span.array->mask[i] = 0; \ } \ span.intTex[0] += span.intTexStep[0]; \ span.intTex[1] += span.intTexStep[1]; \ span.z += span.zStep; \ } \ rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, \ span.array->rgb, span.array->mask); } #include "s_tritemp.h" #if CHAN_TYPE != GL_FLOAT struct affine_info { GLenum filter; GLenum format; GLenum envmode; GLint smask, tmask; GLint twidth_log2; const GLchan *texture; GLfixed er, eg, eb, ea; GLint tbytesline, tsize; }; static INLINE GLint ilerp(GLint t, GLint a, GLint b) { return a + ((t * (b - a)) >> FIXED_SHIFT); } static INLINE GLint ilerp_2d(GLint ia, GLint ib, GLint v00, GLint v10, GLint v01, GLint v11) { const GLint temp0 = ilerp(ia, v00, v10); const GLint temp1 = ilerp(ia, v01, v11); return ilerp(ib, temp0, temp1); } /* This function can handle GL_NEAREST or GL_LINEAR sampling of 2D RGB or RGBA * textures with GL_REPLACE, GL_MODULATE, GL_BLEND, GL_DECAL or GL_ADD * texture env modes. */ static INLINE void affine_span(GLcontext *ctx, struct sw_span *span, struct affine_info *info) { GLchan sample[4]; /* the filtered texture sample */ /* Instead of defining a function for each mode, a test is done * between the outer and inner loops. This is to reduce code size * and complexity. Observe that an optimizing compiler kills * unused variables (for instance tf,sf,ti,si in case of GL_NEAREST). */ #define NEAREST_RGB \ sample[RCOMP] = tex00[RCOMP]; \ sample[GCOMP] = tex00[GCOMP]; \ sample[BCOMP] = tex00[BCOMP]; \ sample[ACOMP] = CHAN_MAX #define LINEAR_RGB \ sample[RCOMP] = ilerp_2d(sf, tf, tex00[0], tex01[0], tex10[0], tex11[0]);\ sample[GCOMP] = ilerp_2d(sf, tf, tex00[1], tex01[1], tex10[1], tex11[1]);\ sample[BCOMP] = ilerp_2d(sf, tf, tex00[2], tex01[2], tex10[2], tex11[2]);\ sample[ACOMP] = CHAN_MAX; #define NEAREST_RGBA COPY_CHAN4(sample, tex00) #define LINEAR_RGBA \ sample[RCOMP] = ilerp_2d(sf, tf, tex00[0], tex01[0], tex10[0], tex11[0]);\ sample[GCOMP] = ilerp_2d(sf, tf, tex00[1], tex01[1], tex10[1], tex11[1]);\ sample[BCOMP] = ilerp_2d(sf, tf, tex00[2], tex01[2], tex10[2], tex11[2]);\ sample[ACOMP] = ilerp_2d(sf, tf, tex00[3], tex01[3], tex10[3], tex11[3]) #define MODULATE \ dest[RCOMP] = span->red * (sample[RCOMP] + 1u) >> (FIXED_SHIFT + 8); \ dest[GCOMP] = span->green * (sample[GCOMP] + 1u) >> (FIXED_SHIFT + 8); \ dest[BCOMP] = span->blue * (sample[BCOMP] + 1u) >> (FIXED_SHIFT + 8); \ dest[ACOMP] = span->alpha * (sample[ACOMP] + 1u) >> (FIXED_SHIFT + 8) #define DECAL \ dest[RCOMP] = ((CHAN_MAX - sample[ACOMP]) * span->red + \ ((sample[ACOMP] + 1) * sample[RCOMP] << FIXED_SHIFT)) \ >> (FIXED_SHIFT + 8); \ dest[GCOMP] = ((CHAN_MAX - sample[ACOMP]) * span->green + \ ((sample[ACOMP] + 1) * sample[GCOMP] << FIXED_SHIFT)) \ >> (FIXED_SHIFT + 8); \ dest[BCOMP] = ((CHAN_MAX - sample[ACOMP]) * span->blue + \ ((sample[ACOMP] + 1) * sample[BCOMP] << FIXED_SHIFT)) \ >> (FIXED_SHIFT + 8); \ dest[ACOMP] = FixedToInt(span->alpha) #define BLEND \ dest[RCOMP] = ((CHAN_MAX - sample[RCOMP]) * span->red \ + (sample[RCOMP] + 1) * info->er) >> (FIXED_SHIFT + 8); \ dest[GCOMP] = ((CHAN_MAX - sample[GCOMP]) * span->green \ + (sample[GCOMP] + 1) * info->eg) >> (FIXED_SHIFT + 8); \ dest[BCOMP] = ((CHAN_MAX - sample[BCOMP]) * span->blue \ + (sample[BCOMP] + 1) * info->eb) >> (FIXED_SHIFT + 8); \ dest[ACOMP] = span->alpha * (sample[ACOMP] + 1) >> (FIXED_SHIFT + 8) #define REPLACE COPY_CHAN4(dest, sample) #define ADD \ { \ GLint rSum = FixedToInt(span->red) + (GLint) sample[RCOMP]; \ GLint gSum = FixedToInt(span->green) + (GLint) sample[GCOMP]; \ GLint bSum = FixedToInt(span->blue) + (GLint) sample[BCOMP]; \ dest[RCOMP] = MIN2(rSum, CHAN_MAX); \ dest[GCOMP] = MIN2(gSum, CHAN_MAX); \ dest[BCOMP] = MIN2(bSum, CHAN_MAX); \ dest[ACOMP] = span->alpha * (sample[ACOMP] + 1) >> (FIXED_SHIFT + 8); \ } /* shortcuts */ #define NEAREST_RGB_REPLACE \ NEAREST_RGB; \ dest[0] = sample[0]; \ dest[1] = sample[1]; \ dest[2] = sample[2]; \ dest[3] = FixedToInt(span->alpha); #define NEAREST_RGBA_REPLACE COPY_CHAN4(dest, tex00) #define SPAN_NEAREST(DO_TEX, COMPS) \ for (i = 0; i < span->end; i++) { \ /* Isn't it necessary to use FixedFloor below?? */ \ GLint s = FixedToInt(span->intTex[0]) & info->smask; \ GLint t = FixedToInt(span->intTex[1]) & info->tmask; \ GLint pos = (t << info->twidth_log2) + s; \ const GLchan *tex00 = info->texture + COMPS * pos; \ DO_TEX; \ span->red += span->redStep; \ span->green += span->greenStep; \ span->blue += span->blueStep; \ span->alpha += span->alphaStep; \ span->intTex[0] += span->intTexStep[0]; \ span->intTex[1] += span->intTexStep[1]; \ dest += 4; \ } #define SPAN_LINEAR(DO_TEX, COMPS) \ for (i = 0; i < span->end; i++) { \ /* Isn't it necessary to use FixedFloor below?? */ \ const GLint s = FixedToInt(span->intTex[0]) & info->smask; \ const GLint t = FixedToInt(span->intTex[1]) & info->tmask; \ const GLfixed sf = span->intTex[0] & FIXED_FRAC_MASK; \ const GLfixed tf = span->intTex[1] & FIXED_FRAC_MASK; \ const GLint pos = (t << info->twidth_log2) + s; \ const GLchan *tex00 = info->texture + COMPS * pos; \ const GLchan *tex10 = tex00 + info->tbytesline; \ const GLchan *tex01 = tex00 + COMPS; \ const GLchan *tex11 = tex10 + COMPS; \ if (t == info->tmask) { \ tex10 -= info->tsize; \ tex11 -= info->tsize; \ } \ if (s == info->smask) { \ tex01 -= info->tbytesline; \ tex11 -= info->tbytesline; \ } \ DO_TEX; \ span->red += span->redStep; \ span->green += span->greenStep; \ span->blue += span->blueStep; \ span->alpha += span->alphaStep; \ span->intTex[0] += span->intTexStep[0]; \ span->intTex[1] += span->intTexStep[1]; \ dest += 4; \ } GLuint i; GLchan *dest = span->array->rgba[0]; span->intTex[0] -= FIXED_HALF; span->intTex[1] -= FIXED_HALF; switch (info->filter) { case GL_NEAREST: switch (info->format) { case GL_RGB: switch (info->envmode) { case GL_MODULATE: SPAN_NEAREST(NEAREST_RGB;MODULATE,3); break; case GL_DECAL: case GL_REPLACE: SPAN_NEAREST(NEAREST_RGB_REPLACE,3); break; case GL_BLEND: SPAN_NEAREST(NEAREST_RGB;BLEND,3); break; case GL_ADD: SPAN_NEAREST(NEAREST_RGB;ADD,3); break; default: _mesa_problem(ctx, "bad tex env mode in SPAN_LINEAR"); return; } break; case GL_RGBA: switch(info->envmode) { case GL_MODULATE: SPAN_NEAREST(NEAREST_RGBA;MODULATE,4); break; case GL_DECAL: SPAN_NEAREST(NEAREST_RGBA;DECAL,4); break; case GL_BLEND: SPAN_NEAREST(NEAREST_RGBA;BLEND,4); break; case GL_ADD: SPAN_NEAREST(NEAREST_RGBA;ADD,4); break; case GL_REPLACE: SPAN_NEAREST(NEAREST_RGBA_REPLACE,4); break; default: _mesa_problem(ctx, "bad tex env mode (2) in SPAN_LINEAR"); return; } break; } break; case GL_LINEAR: span->intTex[0] -= FIXED_HALF; span->intTex[1] -= FIXED_HALF; switch (info->format) { case GL_RGB: switch (info->envmode) { case GL_MODULATE: SPAN_LINEAR(LINEAR_RGB;MODULATE,3); break; case GL_DECAL: case GL_REPLACE: SPAN_LINEAR(LINEAR_RGB;REPLACE,3); break; case GL_BLEND: SPAN_LINEAR(LINEAR_RGB;BLEND,3); break; case GL_ADD: SPAN_LINEAR(LINEAR_RGB;ADD,3); break; default: _mesa_problem(ctx, "bad tex env mode (3) in SPAN_LINEAR"); return; } break; case GL_RGBA: switch (info->envmode) { case GL_MODULATE: SPAN_LINEAR(LINEAR_RGBA;MODULATE,4); break; case GL_DECAL: SPAN_LINEAR(LINEAR_RGBA;DECAL,4); break; case GL_BLEND: SPAN_LINEAR(LINEAR_RGBA;BLEND,4); break; case GL_ADD: SPAN_LINEAR(LINEAR_RGBA;ADD,4); break; case GL_REPLACE: SPAN_LINEAR(LINEAR_RGBA;REPLACE,4); break; default: _mesa_problem(ctx, "bad tex env mode (4) in SPAN_LINEAR"); return; } break; } break; } span->interpMask &= ~SPAN_RGBA; ASSERT(span->arrayMask & SPAN_RGBA); _swrast_write_rgba_span(ctx, span); #undef SPAN_NEAREST #undef SPAN_LINEAR } /* * Render an RGB/RGBA textured triangle without perspective correction. */ #define NAME affine_textured_triangle #define INTERP_Z 1 #define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 #define INTERP_INT_TEX 1 #define S_SCALE twidth #define T_SCALE theight #define SETUP_CODE \ struct affine_info info; \ struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ struct gl_texture_object *obj = unit->Current2D; \ const GLint b = obj->BaseLevel; \ const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ info.texture = (const GLchan *) obj->Image[0][b]->Data; \ info.twidth_log2 = obj->Image[0][b]->WidthLog2; \ info.smask = obj->Image[0][b]->Width - 1; \ info.tmask = obj->Image[0][b]->Height - 1; \ info.format = obj->Image[0][b]->Format; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ span.arrayMask |= SPAN_RGBA; \ \ if (info.envmode == GL_BLEND) { \ /* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \ info.er = FloatToFixed(unit->EnvColor[RCOMP] * CHAN_MAXF); \ info.eg = FloatToFixed(unit->EnvColor[GCOMP] * CHAN_MAXF); \ info.eb = FloatToFixed(unit->EnvColor[BCOMP] * CHAN_MAXF); \ info.ea = FloatToFixed(unit->EnvColor[ACOMP] * CHAN_MAXF); \ } \ if (!info.texture) { \ /* this shouldn't happen */ \ return; \ } \ \ switch (info.format) { \ case GL_ALPHA: \ case GL_LUMINANCE: \ case GL_INTENSITY: \ info.tbytesline = obj->Image[0][b]->Width; \ break; \ case GL_LUMINANCE_ALPHA: \ info.tbytesline = obj->Image[0][b]->Width * 2; \ break; \ case GL_RGB: \ info.tbytesline = obj->Image[0][b]->Width * 3; \ break; \ case GL_RGBA: \ info.tbytesline = obj->Image[0][b]->Width * 4; \ break; \ default: \ _mesa_problem(NULL, "Bad texture format in affine_texture_triangle");\ return; \ } \ info.tsize = obj->Image[0][b]->Height * info.tbytesline; #define RENDER_SPAN( span ) affine_span(ctx, &span, &info); #include "s_tritemp.h" struct persp_info { GLenum filter; GLenum format; GLenum envmode; GLint smask, tmask; GLint twidth_log2; const GLchan *texture; GLfixed er, eg, eb, ea; /* texture env color */ GLint tbytesline, tsize; }; static INLINE void fast_persp_span(GLcontext *ctx, struct sw_span *span, struct persp_info *info) { GLchan sample[4]; /* the filtered texture sample */ /* Instead of defining a function for each mode, a test is done * between the outer and inner loops. This is to reduce code size * and complexity. Observe that an optimizing compiler kills * unused variables (for instance tf,sf,ti,si in case of GL_NEAREST). */ #define SPAN_NEAREST(DO_TEX,COMP) \ for (i = 0; i < span->end; i++) { \ GLdouble invQ = tex_coord[2] ? \ (1.0 / tex_coord[2]) : 1.0; \ GLfloat s_tmp = (GLfloat) (tex_coord[0] * invQ); \ GLfloat t_tmp = (GLfloat) (tex_coord[1] * invQ); \ GLint s = IFLOOR(s_tmp) & info->smask; \ GLint t = IFLOOR(t_tmp) & info->tmask; \ GLint pos = (t << info->twidth_log2) + s; \ const GLchan *tex00 = info->texture + COMP * pos; \ DO_TEX; \ span->red += span->redStep; \ span->green += span->greenStep; \ span->blue += span->blueStep; \ span->alpha += span->alphaStep; \ tex_coord[0] += tex_step[0]; \ tex_coord[1] += tex_step[1]; \ tex_coord[2] += tex_step[2]; \ dest += 4; \ } #define SPAN_LINEAR(DO_TEX,COMP) \ for (i = 0; i < span->end; i++) { \ GLdouble invQ = tex_coord[2] ? \ (1.0 / tex_coord[2]) : 1.0; \ const GLfloat s_tmp = (GLfloat) (tex_coord[0] * invQ); \ const GLfloat t_tmp = (GLfloat) (tex_coord[1] * invQ); \ const GLfixed s_fix = FloatToFixed(s_tmp) - FIXED_HALF; \ const GLfixed t_fix = FloatToFixed(t_tmp) - FIXED_HALF; \ const GLint s = FixedToInt(FixedFloor(s_fix)) & info->smask; \ const GLint t = FixedToInt(FixedFloor(t_fix)) & info->tmask; \ const GLfixed sf = s_fix & FIXED_FRAC_MASK; \ const GLfixed tf = t_fix & FIXED_FRAC_MASK; \ const GLint pos = (t << info->twidth_log2) + s; \ const GLchan *tex00 = info->texture + COMP * pos; \ const GLchan *tex10 = tex00 + info->tbytesline; \ const GLchan *tex01 = tex00 + COMP; \ const GLchan *tex11 = tex10 + COMP; \ if (t == info->tmask) { \ tex10 -= info->tsize; \ tex11 -= info->tsize; \ } \ if (s == info->smask) { \ tex01 -= info->tbytesline; \ tex11 -= info->tbytesline; \ } \ DO_TEX; \ span->red += span->redStep; \ span->green += span->greenStep; \ span->blue += span->blueStep; \ span->alpha += span->alphaStep; \ tex_coord[0] += tex_step[0]; \ tex_coord[1] += tex_step[1]; \ tex_coord[2] += tex_step[2]; \ dest += 4; \ } GLuint i; GLfloat tex_coord[3], tex_step[3]; GLchan *dest = span->array->rgba[0]; const GLuint savedTexEnable = ctx->Texture._EnabledUnits; ctx->Texture._EnabledUnits = 0; tex_coord[0] = span->tex[0][0] * (info->smask + 1); tex_step[0] = span->texStepX[0][0] * (info->smask + 1); tex_coord[1] = span->tex[0][1] * (info->tmask + 1); tex_step[1] = span->texStepX[0][1] * (info->tmask + 1); /* span->tex[0][2] only if 3D-texturing, here only 2D */ tex_coord[2] = span->tex[0][3]; tex_step[2] = span->texStepX[0][3]; switch (info->filter) { case GL_NEAREST: switch (info->format) { case GL_RGB: switch (info->envmode) { case GL_MODULATE: SPAN_NEAREST(NEAREST_RGB;MODULATE,3); break; case GL_DECAL: case GL_REPLACE: SPAN_NEAREST(NEAREST_RGB_REPLACE,3); break; case GL_BLEND: SPAN_NEAREST(NEAREST_RGB;BLEND,3); break; case GL_ADD: SPAN_NEAREST(NEAREST_RGB;ADD,3); break; default: _mesa_problem(ctx, "bad tex env mode (5) in SPAN_LINEAR"); return; } break; case GL_RGBA: switch(info->envmode) { case GL_MODULATE: SPAN_NEAREST(NEAREST_RGBA;MODULATE,4); break; case GL_DECAL: SPAN_NEAREST(NEAREST_RGBA;DECAL,4); break; case GL_BLEND: SPAN_NEAREST(NEAREST_RGBA;BLEND,4); break; case GL_ADD: SPAN_NEAREST(NEAREST_RGBA;ADD,4); break; case GL_REPLACE: SPAN_NEAREST(NEAREST_RGBA_REPLACE,4); break; default: _mesa_problem(ctx, "bad tex env mode (6) in SPAN_LINEAR"); return; } break; } break; case GL_LINEAR: switch (info->format) { case GL_RGB: switch (info->envmode) { case GL_MODULATE: SPAN_LINEAR(LINEAR_RGB;MODULATE,3); break; case GL_DECAL: case GL_REPLACE: SPAN_LINEAR(LINEAR_RGB;REPLACE,3); break; case GL_BLEND: SPAN_LINEAR(LINEAR_RGB;BLEND,3); break; case GL_ADD: SPAN_LINEAR(LINEAR_RGB;ADD,3); break; default: _mesa_problem(ctx, "bad tex env mode (7) in SPAN_LINEAR"); return; } break; case GL_RGBA: switch (info->envmode) { case GL_MODULATE: SPAN_LINEAR(LINEAR_RGBA;MODULATE,4); break; case GL_DECAL: SPAN_LINEAR(LINEAR_RGBA;DECAL,4); break; case GL_BLEND: SPAN_LINEAR(LINEAR_RGBA;BLEND,4); break; case GL_ADD: SPAN_LINEAR(LINEAR_RGBA;ADD,4); break; case GL_REPLACE: SPAN_LINEAR(LINEAR_RGBA;REPLACE,4); break; default: _mesa_problem(ctx, "bad tex env mode (8) in SPAN_LINEAR"); return; } break; } break; } ASSERT(span->arrayMask & SPAN_RGBA); _swrast_write_rgba_span(ctx, span); #undef SPAN_NEAREST #undef SPAN_LINEAR /* restore state */ ctx->Texture._EnabledUnits = savedTexEnable; } /* * Render an perspective corrected RGB/RGBA textured triangle. * The Q (aka V in Mesa) coordinate must be zero such that the divide * by interpolated Q/W comes out right. * */ #define NAME persp_textured_triangle #define INTERP_Z 1 #define INTERP_W 1 #define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 #define INTERP_TEX 1 #define SETUP_CODE \ struct persp_info info; \ const struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ const struct gl_texture_object *obj = unit->Current2D; \ const GLint b = obj->BaseLevel; \ info.texture = (const GLchan *) obj->Image[0][b]->Data; \ info.twidth_log2 = obj->Image[0][b]->WidthLog2; \ info.smask = obj->Image[0][b]->Width - 1; \ info.tmask = obj->Image[0][b]->Height - 1; \ info.format = obj->Image[0][b]->Format; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ \ if (info.envmode == GL_BLEND) { \ /* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \ info.er = FloatToFixed(unit->EnvColor[RCOMP] * CHAN_MAXF); \ info.eg = FloatToFixed(unit->EnvColor[GCOMP] * CHAN_MAXF); \ info.eb = FloatToFixed(unit->EnvColor[BCOMP] * CHAN_MAXF); \ info.ea = FloatToFixed(unit->EnvColor[ACOMP] * CHAN_MAXF); \ } \ if (!info.texture) { \ /* this shouldn't happen */ \ return; \ } \ \ switch (info.format) { \ case GL_ALPHA: \ case GL_LUMINANCE: \ case GL_INTENSITY: \ info.tbytesline = obj->Image[0][b]->Width; \ break; \ case GL_LUMINANCE_ALPHA: \ info.tbytesline = obj->Image[0][b]->Width * 2; \ break; \ case GL_RGB: \ info.tbytesline = obj->Image[0][b]->Width * 3; \ break; \ case GL_RGBA: \ info.tbytesline = obj->Image[0][b]->Width * 4; \ break; \ default: \ _mesa_problem(NULL, "Bad texture format in persp_textured_triangle");\ return; \ } \ info.tsize = obj->Image[0][b]->Height * info.tbytesline; #define RENDER_SPAN( span ) \ span.interpMask &= ~SPAN_RGBA; \ span.arrayMask |= SPAN_RGBA; \ fast_persp_span(ctx, &span, &info); #include "s_tritemp.h" #endif /* CHAN_BITS != GL_FLOAT */ /* * Render a smooth-shaded, textured, RGBA triangle. * Interpolate S,T,R with perspective correction, w/out mipmapping. */ #define NAME general_textured_triangle #define INTERP_Z 1 #define INTERP_W 1 #define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_SPEC 1 #define INTERP_ALPHA 1 #define INTERP_TEX 1 #define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span); #include "s_tritemp.h" /* * This is the big one! * Interpolate Z, RGB, Alpha, specular, fog, and N sets of texture coordinates. * Yup, it's slow. */ #define NAME multitextured_triangle #define INTERP_Z 1 #define INTERP_W 1 #define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 #define INTERP_SPEC 1 #define INTERP_MULTITEX 1 #define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span); #include "s_tritemp.h" /* * Special tri function for occlusion testing */ #define NAME occlusion_zless_triangle #define INTERP_Z 1 #define SETUP_CODE \ struct gl_renderbuffer *rb \ = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; \ ASSERT(ctx->Depth.Test); \ ASSERT(!ctx->Depth.Mask); \ ASSERT(ctx->Depth.Func == GL_LESS); \ if (ctx->OcclusionResult && !ctx->Occlusion.Active) { \ return; \ } #define RENDER_SPAN( span ) \ if (ctx->Visual.depthBits <= 16) { \ GLuint i; \ const GLushort *zRow = (const GLushort *) \ rb->GetPointer(ctx, rb, span.x, span.y); \ for (i = 0; i < span.end; i++) { \ GLdepth z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ ctx->OcclusionResult = GL_TRUE; \ ctx->Occlusion.PassedCounter++; \ } \ span.z += span.zStep; \ } \ } \ else { \ GLuint i; \ const GLuint *zRow = (const GLuint *) \ rb->GetPointer(ctx, rb, span.x, span.y); \ for (i = 0; i < span.end; i++) { \ if ((GLuint)span.z < zRow[i]) { \ ctx->OcclusionResult = GL_TRUE; \ ctx->Occlusion.PassedCounter++; \ } \ span.z += span.zStep; \ } \ } #include "s_tritemp.h" static void nodraw_triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ) { (void) (ctx && v0 && v1 && v2); } /* * This is used when separate specular color is enabled, but not * texturing. We add the specular color to the primary color, * draw the triangle, then restore the original primary color. * Inefficient, but seldom needed. */ void _swrast_add_spec_terms_triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ) { SWvertex *ncv0 = (SWvertex *)v0; /* drop const qualifier */ SWvertex *ncv1 = (SWvertex *)v1; SWvertex *ncv2 = (SWvertex *)v2; #if CHAN_TYPE == GL_FLOAT GLfloat rSum, gSum, bSum; #else GLint rSum, gSum, bSum; #endif GLchan c[3][4]; /* save original colors */ COPY_CHAN4( c[0], ncv0->color ); COPY_CHAN4( c[1], ncv1->color ); COPY_CHAN4( c[2], ncv2->color ); /* sum v0 */ rSum = ncv0->color[0] + ncv0->specular[0]; gSum = ncv0->color[1] + ncv0->specular[1]; bSum = ncv0->color[2] + ncv0->specular[2]; ncv0->color[0] = MIN2(rSum, CHAN_MAX); ncv0->color[1] = MIN2(gSum, CHAN_MAX); ncv0->color[2] = MIN2(bSum, CHAN_MAX); /* sum v1 */ rSum = ncv1->color[0] + ncv1->specular[0]; gSum = ncv1->color[1] + ncv1->specular[1]; bSum = ncv1->color[2] + ncv1->specular[2]; ncv1->color[0] = MIN2(rSum, CHAN_MAX); ncv1->color[1] = MIN2(gSum, CHAN_MAX); ncv1->color[2] = MIN2(bSum, CHAN_MAX); /* sum v2 */ rSum = ncv2->color[0] + ncv2->specular[0]; gSum = ncv2->color[1] + ncv2->specular[1]; bSum = ncv2->color[2] + ncv2->specular[2]; ncv2->color[0] = MIN2(rSum, CHAN_MAX); ncv2->color[1] = MIN2(gSum, CHAN_MAX); ncv2->color[2] = MIN2(bSum, CHAN_MAX); /* draw */ SWRAST_CONTEXT(ctx)->SpecTriangle( ctx, ncv0, ncv1, ncv2 ); /* restore original colors */ COPY_CHAN4( ncv0->color, c[0] ); COPY_CHAN4( ncv1->color, c[1] ); COPY_CHAN4( ncv2->color, c[2] ); } #ifdef DEBUG /* record the current triangle function name */ const char *_mesa_triFuncName = NULL; #define USE(triFunc) \ do { \ _mesa_triFuncName = #triFunc; \ /*printf("%s\n", _mesa_triFuncName);*/ \ swrast->Triangle = triFunc; \ } while (0) #else #define USE(triFunc) swrast->Triangle = triFunc; #endif /* * Determine which triangle rendering function to use given the current * rendering context. * * Please update the summary flag _SWRAST_NEW_TRIANGLE if you add or * remove tests to this code. */ void _swrast_choose_triangle( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLboolean rgbmode = ctx->Visual.rgbMode; if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) { USE(nodraw_triangle); return; } if (ctx->RenderMode==GL_RENDER) { if (ctx->Polygon.SmoothFlag) { _swrast_set_aa_triangle_function(ctx); ASSERT(swrast->Triangle); return; } /* special case for occlusion testing */ if ((ctx->Depth.OcclusionTest || ctx->Occlusion.Active) && ctx->Depth.Test && ctx->Depth.Mask == GL_FALSE && ctx->Depth.Func == GL_LESS && !ctx->Stencil.Enabled) { if ((rgbmode && ctx->Color.ColorMask[0] == 0 && ctx->Color.ColorMask[1] == 0 && ctx->Color.ColorMask[2] == 0 && ctx->Color.ColorMask[3] == 0) || (!rgbmode && ctx->Color.IndexMask == 0)) { USE(occlusion_zless_triangle); return; } } if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram._Active) { /* Ugh, we do a _lot_ of tests to pick the best textured tri func */ const struct gl_texture_object *texObj2D; const struct gl_texture_image *texImg; GLenum minFilter, magFilter, envMode; GLint format; texObj2D = ctx->Texture.Unit[0].Current2D; texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL; format = texImg ? texImg->TexFormat->MesaFormat : -1; minFilter = texObj2D ? texObj2D->MinFilter : (GLenum) 0; magFilter = texObj2D ? texObj2D->MagFilter : (GLenum) 0; envMode = ctx->Texture.Unit[0].EnvMode; /* First see if we can use an optimized 2-D texture function */ if (ctx->Texture._EnabledCoordUnits == 0x1 && !ctx->FragmentProgram._Active && ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT && texObj2D->WrapS == GL_REPEAT && texObj2D->WrapT == GL_REPEAT && texObj2D->_IsPowerOfTwo && texImg->Border == 0 && texImg->Width == texImg->RowStride && (format == MESA_FORMAT_RGB || format == MESA_FORMAT_RGBA) && minFilter == magFilter && ctx->Light.Model.ColorControl == GL_SINGLE_COLOR && ctx->Texture.Unit[0].EnvMode != GL_COMBINE_EXT) { if (ctx->Hint.PerspectiveCorrection==GL_FASTEST) { if (minFilter == GL_NEAREST && format == MESA_FORMAT_RGB && (envMode == GL_REPLACE || envMode == GL_DECAL) && ((swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT) && ctx->Depth.Func == GL_LESS && ctx->Depth.Mask == GL_TRUE) || swrast->_RasterMask == TEXTURE_BIT) && ctx->Polygon.StippleFlag == GL_FALSE && ctx->Visual.depthBits <= 16) { if (swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT)) { USE(simple_z_textured_triangle); } else { USE(simple_textured_triangle); } } else { #if (CHAN_BITS == 16 || CHAN_BITS == 32) USE(general_textured_triangle); #else USE(affine_textured_triangle); #endif } } else { #if (CHAN_BITS == 16 || CHAN_BITS == 32) USE(general_textured_triangle); #else USE(persp_textured_triangle); #endif } } else { /* general case textured triangles */ if (ctx->Texture._EnabledCoordUnits > 1) { USE(multitextured_triangle); } else { USE(general_textured_triangle); } } } else { ASSERT(!ctx->Texture._EnabledCoordUnits); if (ctx->Light.ShadeModel==GL_SMOOTH) { /* smooth shaded, no texturing, stippled or some raster ops */ if (rgbmode) { USE(smooth_rgba_triangle); } else { USE(smooth_ci_triangle); } } else { /* flat shaded, no texturing, stippled or some raster ops */ if (rgbmode) { USE(flat_rgba_triangle); } else { USE(flat_ci_triangle); } } } } else if (ctx->RenderMode==GL_FEEDBACK) { USE(_swrast_feedback_triangle); } else { /* GL_SELECT mode */ USE(_swrast_select_triangle); } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_triangle.h0000644000000000000000000000315313614532424021042 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_TRIANGLES_H #define S_TRIANGLES_H #include "mtypes.h" #include "swrast.h" extern GLboolean _swrast_culltriangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2); extern void _swrast_choose_triangle( GLcontext *ctx ); extern void _swrast_add_spec_terms_triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_trispan.h0000644000000000000000000000232713614532424020717 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef S_TRISPAN_H #define S_TRISPAN_H #endif /* S_TRISPAN_H */ nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_tritemp.h0000644000000000000000000014146713614532424020734 0ustar /* * Mesa 3-D graphics library * Version: 6.4.1 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Triangle Rasterizer Template * * This file is #include'd to generate custom triangle rasterizers. * * The following macros may be defined to indicate what auxillary information * must be interplated across the triangle: * INTERP_Z - if defined, interpolate vertex Z values * INTERP_W - if defined, interpolate vertex W values * INTERP_FOG - if defined, interpolate fog values * INTERP_RGB - if defined, interpolate RGB values * INTERP_ALPHA - if defined, interpolate Alpha values (req's INTERP_RGB) * INTERP_SPEC - if defined, interpolate specular RGB values * INTERP_INDEX - if defined, interpolate color index values * INTERP_INT_TEX - if defined, interpolate integer ST texcoords * (fast, simple 2-D texture mapping) * INTERP_TEX - if defined, interpolate set 0 float STRQ texcoords * NOTE: OpenGL STRQ = Mesa STUV (R was taken for red) * INTERP_MULTITEX - if defined, interpolate N units of STRQ texcoords * * When one can directly address pixels in the color buffer the following * macros can be defined and used to compute pixel addresses during * rasterization (see pRow): * PIXEL_TYPE - the datatype of a pixel (GLubyte, GLushort, GLuint) * BYTES_PER_ROW - number of bytes per row in the color buffer * PIXEL_ADDRESS(X,Y) - returns the address of pixel at (X,Y) where * Y==0 at bottom of screen and increases upward. * * Similarly, for direct depth buffer access, this type is used for depth * buffer addressing: * DEPTH_TYPE - either GLushort or GLuint * * Optionally, one may provide one-time setup code per triangle: * SETUP_CODE - code which is to be executed once per triangle * CLEANUP_CODE - code to execute at end of triangle * * The following macro MUST be defined: * RENDER_SPAN(span) - code to write a span of pixels. * * This code was designed for the origin to be in the lower-left corner. * * Inspired by triangle rasterizer code written by Allen Akin. Thanks Allen! * * * Some notes on rasterization accuracy: * * This code uses fixed point arithmetic (the GLfixed type) to iterate * over the triangle edges and interpolate ancillary data (such as Z, * color, secondary color, etc). The number of fractional bits in * GLfixed and the value of SUB_PIXEL_BITS has a direct bearing on the * accuracy of rasterization. * * If SUB_PIXEL_BITS=4 then we'll snap the vertices to the nearest * 1/16 of a pixel. If we're walking up a long, nearly vertical edge * (dx=1/16, dy=1024) we'll need 4 + 10 = 14 fractional bits in * GLfixed to walk the edge without error. If the maximum viewport * height is 4K pixels, then we'll need 4 + 12 = 16 fractional bits. * * Historically, Mesa has used 11 fractional bits in GLfixed, snaps * vertices to 1/16 pixel and allowed a maximum viewport height of 2K * pixels. 11 fractional bits is actually insufficient for accurately * rasterizing some triangles. More recently, the maximum viewport * height was increased to 4K pixels. Thus, Mesa should be using 16 * fractional bits in GLfixed. Unfortunately, there may be some issues * with setting FIXED_FRAC_BITS=16, such as multiplication overflow. * This will have to be examined in some detail... * * For now, if you find rasterization errors, particularly with tall, * sliver triangles, try increasing FIXED_FRAC_BITS and/or decreasing * SUB_PIXEL_BITS. */ /* * ColorTemp is used for intermediate color values. */ #if CHAN_TYPE == GL_FLOAT #define ColorTemp GLfloat #else #define ColorTemp GLint /* same as GLfixed */ #endif /* * Walk triangle edges with GLfixed or GLdouble */ #if TRIANGLE_WALK_DOUBLE #define GLinterp GLdouble #define InterpToInt(X) ((GLint) (X)) #define INTERP_ONE 1.0 #else #define GLinterp GLfixed #define InterpToInt(X) FixedToInt(X) #define INTERP_ONE FIXED_ONE #endif /* * Either loop over all texture units, or just use unit zero. */ #ifdef INTERP_MULTITEX #define TEX_UNIT_LOOP(CODE) \ { \ GLuint u; \ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \ if (ctx->Texture._EnabledCoordUnits & (1 << u)) { \ CODE \ } \ } \ } #define INTERP_TEX #elif defined(INTERP_TEX) #define TEX_UNIT_LOOP(CODE) \ { \ const GLuint u = 0; \ CODE \ } #endif /* * Some code we unfortunately need to prevent negative interpolated colors. */ #ifndef CLAMP_INTERPOLANT #define CLAMP_INTERPOLANT(CHANNEL, CHANNELSTEP, LEN) \ do { \ GLfixed endVal = span.CHANNEL + (LEN) * span.CHANNELSTEP; \ if (endVal < 0) { \ span.CHANNEL -= endVal; \ } \ if (span.CHANNEL < 0) { \ span.CHANNEL = 0; \ } \ } while (0) #endif static void NAME(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ) { typedef struct { const SWvertex *v0, *v1; /* Y(v0) < Y(v1) */ #if TRIANGLE_WALK_DOUBLE GLdouble dx; /* X(v1) - X(v0) */ GLdouble dy; /* Y(v1) - Y(v0) */ GLdouble dxdy; /* dx/dy */ GLdouble adjy; /* adjust from v[0]->fy to fsy, scaled */ GLdouble fsx; /* first sample point x coord */ GLdouble fsy; GLdouble fx0; /*X of lower endpoint */ #else GLfloat dx; /* X(v1) - X(v0) */ GLfloat dy; /* Y(v1) - Y(v0) */ GLfloat dxdy; /* dx/dy */ GLfixed fdxdy; /* dx/dy in fixed-point */ GLfloat adjy; /* adjust from v[0]->fy to fsy, scaled */ GLfixed fsx; /* first sample point x coord */ GLfixed fsy; GLfixed fx0; /* fixed pt X of lower endpoint */ #endif GLint lines; /* number of lines to be sampled on this edge */ } EdgeT; #ifdef INTERP_Z const GLint depthBits = ctx->DrawBuffer->Visual.depthBits; const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0; const GLfloat maxDepth = ctx->DrawBuffer->_DepthMaxF; #define FixedToDepth(F) ((F) >> fixedToDepthShift) #endif EdgeT eMaj, eTop, eBot; GLfloat oneOverArea; const SWvertex *vMin, *vMid, *vMax; /* Y(vMin)<=Y(vMid)<=Y(vMax) */ GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceSign; #if !TRIANGLE_WALK_DOUBLE const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1); /* for x/y coord snapping */ #endif GLinterp vMin_fx, vMin_fy, vMid_fx, vMid_fy, vMax_fx, vMax_fy; struct sw_span span; INIT_SPAN(span, GL_POLYGON, 0, 0, 0); #ifdef INTERP_Z (void) fixedToDepthShift; #endif /* printf("%s()\n", __FUNCTION__); printf(" %g, %g, %g\n", v0->win[0], v0->win[1], v0->win[2]); printf(" %g, %g, %g\n", v1->win[0], v1->win[1], v1->win[2]); printf(" %g, %g, %g\n", v2->win[0], v2->win[1], v2->win[2]); */ /* ASSERT(v0->win[2] >= 0.0); ASSERT(v1->win[2] >= 0.0); ASSERT(v2->win[2] >= 0.0); */ /* Compute fixed point x,y coords w/ half-pixel offsets and snapping. * And find the order of the 3 vertices along the Y axis. */ { #if TRIANGLE_WALK_DOUBLE const GLdouble fy0 = v0->win[1] - 0.5; const GLdouble fy1 = v1->win[1] - 0.5; const GLdouble fy2 = v2->win[1] - 0.5; #else const GLfixed fy0 = FloatToFixed(v0->win[1] - 0.5F) & snapMask; const GLfixed fy1 = FloatToFixed(v1->win[1] - 0.5F) & snapMask; const GLfixed fy2 = FloatToFixed(v2->win[1] - 0.5F) & snapMask; #endif if (fy0 <= fy1) { if (fy1 <= fy2) { /* y0 <= y1 <= y2 */ vMin = v0; vMid = v1; vMax = v2; vMin_fy = fy0; vMid_fy = fy1; vMax_fy = fy2; } else if (fy2 <= fy0) { /* y2 <= y0 <= y1 */ vMin = v2; vMid = v0; vMax = v1; vMin_fy = fy2; vMid_fy = fy0; vMax_fy = fy1; } else { /* y0 <= y2 <= y1 */ vMin = v0; vMid = v2; vMax = v1; vMin_fy = fy0; vMid_fy = fy2; vMax_fy = fy1; bf = -bf; } } else { if (fy0 <= fy2) { /* y1 <= y0 <= y2 */ vMin = v1; vMid = v0; vMax = v2; vMin_fy = fy1; vMid_fy = fy0; vMax_fy = fy2; bf = -bf; } else if (fy2 <= fy1) { /* y2 <= y1 <= y0 */ vMin = v2; vMid = v1; vMax = v0; vMin_fy = fy2; vMid_fy = fy1; vMax_fy = fy0; bf = -bf; } else { /* y1 <= y2 <= y0 */ vMin = v1; vMid = v2; vMax = v0; vMin_fy = fy1; vMid_fy = fy2; vMax_fy = fy0; } } /* fixed point X coords */ #if TRIANGLE_WALK_DOUBLE vMin_fx = vMin->win[0] + 0.5; vMid_fx = vMid->win[0] + 0.5; vMax_fx = vMax->win[0] + 0.5; #else vMin_fx = FloatToFixed(vMin->win[0] + 0.5F) & snapMask; vMid_fx = FloatToFixed(vMid->win[0] + 0.5F) & snapMask; vMax_fx = FloatToFixed(vMax->win[0] + 0.5F) & snapMask; #endif } /* vertex/edge relationship */ eMaj.v0 = vMin; eMaj.v1 = vMax; /*TODO: .v1's not needed */ eTop.v0 = vMid; eTop.v1 = vMax; eBot.v0 = vMin; eBot.v1 = vMid; /* compute deltas for each edge: vertex[upper] - vertex[lower] */ #if TRIANGLE_WALK_DOUBLE eMaj.dx = vMax_fx - vMin_fx; eMaj.dy = vMax_fy - vMin_fy; eTop.dx = vMax_fx - vMid_fx; eTop.dy = vMax_fy - vMid_fy; eBot.dx = vMid_fx - vMin_fx; eBot.dy = vMid_fy - vMin_fy; #else eMaj.dx = FixedToFloat(vMax_fx - vMin_fx); eMaj.dy = FixedToFloat(vMax_fy - vMin_fy); eTop.dx = FixedToFloat(vMax_fx - vMid_fx); eTop.dy = FixedToFloat(vMax_fy - vMid_fy); eBot.dx = FixedToFloat(vMid_fx - vMin_fx); eBot.dy = FixedToFloat(vMid_fy - vMin_fy); #endif /* compute area, oneOverArea and perform backface culling */ { #if TRIANGLE_WALK_DOUBLE const GLdouble area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy; #else const GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy; #endif /* Do backface culling */ if (area * bf < 0.0) return; if (IS_INF_OR_NAN(area) || area == 0.0F) return; oneOverArea = 1.0F / area; } span.facing = ctx->_Facing; /* for 2-sided stencil test */ /* Edge setup. For a triangle strip these could be reused... */ { #if TRIANGLE_WALK_DOUBLE eMaj.fsy = CEILF(vMin_fy); eMaj.lines = (GLint) CEILF(vMax_fy - eMaj.fsy); #else eMaj.fsy = FixedCeil(vMin_fy); eMaj.lines = FixedToInt(FixedCeil(vMax_fy - eMaj.fsy)); #endif if (eMaj.lines > 0) { eMaj.dxdy = eMaj.dx / eMaj.dy; #if TRIANGLE_WALK_DOUBLE eMaj.adjy = (eMaj.fsy - vMin_fy) * FIXED_SCALE; /* SCALED! */ eMaj.fx0 = vMin_fx; eMaj.fsx = eMaj.fx0 + (eMaj.adjy * eMaj.dxdy) / (GLdouble) FIXED_SCALE; #else eMaj.fdxdy = SignedFloatToFixed(eMaj.dxdy); eMaj.adjy = (GLfloat) (eMaj.fsy - vMin_fy); /* SCALED! */ eMaj.fx0 = vMin_fx; eMaj.fsx = eMaj.fx0 + (GLfixed) (eMaj.adjy * eMaj.dxdy); #endif } else { return; /*CULLED*/ } #if TRIANGLE_WALK_DOUBLE eTop.fsy = CEILF(vMid_fy); eTop.lines = (GLint) CEILF(vMax_fy - eTop.fsy); #else eTop.fsy = FixedCeil(vMid_fy); eTop.lines = FixedToInt(FixedCeil(vMax_fy - eTop.fsy)); #endif if (eTop.lines > 0) { eTop.dxdy = eTop.dx / eTop.dy; #if TRIANGLE_WALK_DOUBLE eTop.adjy = (eTop.fsy - vMid_fy) * FIXED_SCALE; /* SCALED! */ eTop.fx0 = vMid_fx; eTop.fsx = eTop.fx0 + (eTop.adjy * eTop.dxdy) / (GLdouble) FIXED_SCALE; #else eTop.fdxdy = SignedFloatToFixed(eTop.dxdy); eTop.adjy = (GLfloat) (eTop.fsy - vMid_fy); /* SCALED! */ eTop.fx0 = vMid_fx; eTop.fsx = eTop.fx0 + (GLfixed) (eTop.adjy * eTop.dxdy); #endif } #if TRIANGLE_WALK_DOUBLE eBot.fsy = CEILF(vMin_fy); eBot.lines = (GLint) CEILF(vMid_fy - eBot.fsy); #else eBot.fsy = FixedCeil(vMin_fy); eBot.lines = FixedToInt(FixedCeil(vMid_fy - eBot.fsy)); #endif if (eBot.lines > 0) { eBot.dxdy = eBot.dx / eBot.dy; #if TRIANGLE_WALK_DOUBLE eBot.adjy = (eBot.fsy - vMin_fy) * FIXED_SCALE; /* SCALED! */ eBot.fx0 = vMin_fx; eBot.fsx = eBot.fx0 + (eBot.adjy * eBot.dxdy) / (GLdouble) FIXED_SCALE; #else eBot.fdxdy = SignedFloatToFixed(eBot.dxdy); eBot.adjy = (GLfloat) (eBot.fsy - vMin_fy); /* SCALED! */ eBot.fx0 = vMin_fx; eBot.fsx = eBot.fx0 + (GLfixed) (eBot.adjy * eBot.dxdy); #endif } } /* * Conceptually, we view a triangle as two subtriangles * separated by a perfectly horizontal line. The edge that is * intersected by this line is one with maximal absolute dy; we * call it a ``major'' edge. The other two edges are the * ``top'' edge (for the upper subtriangle) and the ``bottom'' * edge (for the lower subtriangle). If either of these two * edges is horizontal or very close to horizontal, the * corresponding subtriangle might cover zero sample points; * we take care to handle such cases, for performance as well * as correctness. * * By stepping rasterization parameters along the major edge, * we can avoid recomputing them at the discontinuity where * the top and bottom edges meet. However, this forces us to * be able to scan both left-to-right and right-to-left. * Also, we must determine whether the major edge is at the * left or right side of the triangle. We do this by * computing the magnitude of the cross-product of the major * and top edges. Since this magnitude depends on the sine of * the angle between the two edges, its sign tells us whether * we turn to the left or to the right when travelling along * the major edge to the top edge, and from this we infer * whether the major edge is on the left or the right. * * Serendipitously, this cross-product magnitude is also a * value we need to compute the iteration parameter * derivatives for the triangle, and it can be used to perform * backface culling because its sign tells us whether the * triangle is clockwise or counterclockwise. In this code we * refer to it as ``area'' because it's also proportional to * the pixel area of the triangle. */ { GLint scan_from_left_to_right; /* true if scanning left-to-right */ #ifdef INTERP_INDEX GLfloat didx, didy; #endif /* * Execute user-supplied setup code */ #ifdef SETUP_CODE SETUP_CODE #endif scan_from_left_to_right = (oneOverArea < 0.0F); /* compute d?/dx and d?/dy derivatives */ #ifdef INTERP_Z span.interpMask |= SPAN_Z; { GLfloat eMaj_dz = vMax->win[2] - vMin->win[2]; GLfloat eBot_dz = vMid->win[2] - vMin->win[2]; span.dzdx = oneOverArea * (eMaj_dz * eBot.dy - eMaj.dy * eBot_dz); if (span.dzdx > maxDepth || span.dzdx < -maxDepth) { /* probably a sliver triangle */ span.dzdx = 0.0; span.dzdy = 0.0; } else { span.dzdy = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx); } if (depthBits <= 16) span.zStep = SignedFloatToFixed(span.dzdx); else span.zStep = (GLint) span.dzdx; } #endif #ifdef INTERP_W span.interpMask |= SPAN_W; { const GLfloat eMaj_dw = vMax->win[3] - vMin->win[3]; const GLfloat eBot_dw = vMid->win[3] - vMin->win[3]; span.dwdx = oneOverArea * (eMaj_dw * eBot.dy - eMaj.dy * eBot_dw); span.dwdy = oneOverArea * (eMaj.dx * eBot_dw - eMaj_dw * eBot.dx); } #endif #ifdef INTERP_FOG span.interpMask |= SPAN_FOG; { # ifdef INTERP_W const GLfloat wMax = vMax->win[3], wMin = vMin->win[3], wMid = vMid->win[3]; const GLfloat eMaj_dfog = vMax->fog * wMax - vMin->fog * wMin; const GLfloat eBot_dfog = vMid->fog * wMid - vMin->fog * wMin; # else const GLfloat eMaj_dfog = vMax->fog - vMin->fog; const GLfloat eBot_dfog = vMid->fog - vMin->fog; # endif span.dfogdx = oneOverArea * (eMaj_dfog * eBot.dy - eMaj.dy * eBot_dfog); span.dfogdy = oneOverArea * (eMaj.dx * eBot_dfog - eMaj_dfog * eBot.dx); span.fogStep = span.dfogdx; } #endif #ifdef INTERP_RGB span.interpMask |= SPAN_RGBA; if (ctx->Light.ShadeModel == GL_SMOOTH) { GLfloat eMaj_dr = (GLfloat) ((ColorTemp) vMax->color[RCOMP] - (ColorTemp) vMin->color[RCOMP]); GLfloat eBot_dr = (GLfloat) ((ColorTemp) vMid->color[RCOMP] - (ColorTemp) vMin->color[RCOMP]); GLfloat eMaj_dg = (GLfloat) ((ColorTemp) vMax->color[GCOMP] - (ColorTemp) vMin->color[GCOMP]); GLfloat eBot_dg = (GLfloat) ((ColorTemp) vMid->color[GCOMP] - (ColorTemp) vMin->color[GCOMP]); GLfloat eMaj_db = (GLfloat) ((ColorTemp) vMax->color[BCOMP] - (ColorTemp) vMin->color[BCOMP]); GLfloat eBot_db = (GLfloat) ((ColorTemp) vMid->color[BCOMP] - (ColorTemp) vMin->color[BCOMP]); # ifdef INTERP_ALPHA GLfloat eMaj_da = (GLfloat) ((ColorTemp) vMax->color[ACOMP] - (ColorTemp) vMin->color[ACOMP]); GLfloat eBot_da = (GLfloat) ((ColorTemp) vMid->color[ACOMP] - (ColorTemp) vMin->color[ACOMP]); # endif span.drdx = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr); span.drdy = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx); span.dgdx = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg); span.dgdy = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx); span.dbdx = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db); span.dbdy = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx); # if CHAN_TYPE == GL_FLOAT span.redStep = span.drdx; span.greenStep = span.dgdx; span.blueStep = span.dbdx; # else span.redStep = SignedFloatToFixed(span.drdx); span.greenStep = SignedFloatToFixed(span.dgdx); span.blueStep = SignedFloatToFixed(span.dbdx); # endif /* GL_FLOAT */ # ifdef INTERP_ALPHA span.dadx = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da); span.dady = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx); # if CHAN_TYPE == GL_FLOAT span.alphaStep = span.dadx; # else span.alphaStep = SignedFloatToFixed(span.dadx); # endif /* GL_FLOAT */ # endif /* INTERP_ALPHA */ } else { ASSERT(ctx->Light.ShadeModel == GL_FLAT); span.interpMask |= SPAN_FLAT; span.drdx = span.drdy = 0.0F; span.dgdx = span.dgdy = 0.0F; span.dbdx = span.dbdy = 0.0F; # if CHAN_TYPE == GL_FLOAT span.redStep = 0.0F; span.greenStep = 0.0F; span.blueStep = 0.0F; # else span.redStep = 0; span.greenStep = 0; span.blueStep = 0; # endif /* GL_FLOAT */ # ifdef INTERP_ALPHA span.dadx = span.dady = 0.0F; # if CHAN_TYPE == GL_FLOAT span.alphaStep = 0.0F; # else span.alphaStep = 0; # endif /* GL_FLOAT */ # endif } #endif /* INTERP_RGB */ #ifdef INTERP_SPEC span.interpMask |= SPAN_SPEC; if (ctx->Light.ShadeModel == GL_SMOOTH) { GLfloat eMaj_dsr = (GLfloat) ((ColorTemp) vMax->specular[RCOMP] - (ColorTemp) vMin->specular[RCOMP]); GLfloat eBot_dsr = (GLfloat) ((ColorTemp) vMid->specular[RCOMP] - (ColorTemp) vMin->specular[RCOMP]); GLfloat eMaj_dsg = (GLfloat) ((ColorTemp) vMax->specular[GCOMP] - (ColorTemp) vMin->specular[GCOMP]); GLfloat eBot_dsg = (GLfloat) ((ColorTemp) vMid->specular[GCOMP] - (ColorTemp) vMin->specular[GCOMP]); GLfloat eMaj_dsb = (GLfloat) ((ColorTemp) vMax->specular[BCOMP] - (ColorTemp) vMin->specular[BCOMP]); GLfloat eBot_dsb = (GLfloat) ((ColorTemp) vMid->specular[BCOMP] - (ColorTemp) vMin->specular[BCOMP]); span.dsrdx = oneOverArea * (eMaj_dsr * eBot.dy - eMaj.dy * eBot_dsr); span.dsrdy = oneOverArea * (eMaj.dx * eBot_dsr - eMaj_dsr * eBot.dx); span.dsgdx = oneOverArea * (eMaj_dsg * eBot.dy - eMaj.dy * eBot_dsg); span.dsgdy = oneOverArea * (eMaj.dx * eBot_dsg - eMaj_dsg * eBot.dx); span.dsbdx = oneOverArea * (eMaj_dsb * eBot.dy - eMaj.dy * eBot_dsb); span.dsbdy = oneOverArea * (eMaj.dx * eBot_dsb - eMaj_dsb * eBot.dx); # if CHAN_TYPE == GL_FLOAT span.specRedStep = span.dsrdx; span.specGreenStep = span.dsgdx; span.specBlueStep = span.dsbdx; # else span.specRedStep = SignedFloatToFixed(span.dsrdx); span.specGreenStep = SignedFloatToFixed(span.dsgdx); span.specBlueStep = SignedFloatToFixed(span.dsbdx); # endif } else { span.dsrdx = span.dsrdy = 0.0F; span.dsgdx = span.dsgdy = 0.0F; span.dsbdx = span.dsbdy = 0.0F; # if CHAN_TYPE == GL_FLOAT span.specRedStep = 0.0F; span.specGreenStep = 0.0F; span.specBlueStep = 0.0F; # else span.specRedStep = 0; span.specGreenStep = 0; span.specBlueStep = 0; # endif } #endif /* INTERP_SPEC */ #ifdef INTERP_INDEX span.interpMask |= SPAN_INDEX; if (ctx->Light.ShadeModel == GL_SMOOTH) { GLfloat eMaj_di = vMax->index - vMin->index; GLfloat eBot_di = vMid->index - vMin->index; didx = oneOverArea * (eMaj_di * eBot.dy - eMaj.dy * eBot_di); didy = oneOverArea * (eMaj.dx * eBot_di - eMaj_di * eBot.dx); span.indexStep = SignedFloatToFixed(didx); } else { span.interpMask |= SPAN_FLAT; didx = didy = 0.0F; span.indexStep = 0; } #endif #ifdef INTERP_INT_TEX span.interpMask |= SPAN_INT_TEXTURE; { GLfloat eMaj_ds = (vMax->texcoord[0][0] - vMin->texcoord[0][0]) * S_SCALE; GLfloat eBot_ds = (vMid->texcoord[0][0] - vMin->texcoord[0][0]) * S_SCALE; GLfloat eMaj_dt = (vMax->texcoord[0][1] - vMin->texcoord[0][1]) * T_SCALE; GLfloat eBot_dt = (vMid->texcoord[0][1] - vMin->texcoord[0][1]) * T_SCALE; span.texStepX[0][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); span.texStepY[0][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); span.texStepX[0][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); span.texStepY[0][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); span.intTexStep[0] = SignedFloatToFixed(span.texStepX[0][0]); span.intTexStep[1] = SignedFloatToFixed(span.texStepX[0][1]); } #endif #ifdef INTERP_TEX span.interpMask |= SPAN_TEXTURE; { /* win[3] is 1/W */ const GLfloat wMax = vMax->win[3], wMin = vMin->win[3], wMid = vMid->win[3]; TEX_UNIT_LOOP( GLfloat eMaj_ds = vMax->texcoord[u][0] * wMax - vMin->texcoord[u][0] * wMin; GLfloat eBot_ds = vMid->texcoord[u][0] * wMid - vMin->texcoord[u][0] * wMin; GLfloat eMaj_dt = vMax->texcoord[u][1] * wMax - vMin->texcoord[u][1] * wMin; GLfloat eBot_dt = vMid->texcoord[u][1] * wMid - vMin->texcoord[u][1] * wMin; GLfloat eMaj_du = vMax->texcoord[u][2] * wMax - vMin->texcoord[u][2] * wMin; GLfloat eBot_du = vMid->texcoord[u][2] * wMid - vMin->texcoord[u][2] * wMin; GLfloat eMaj_dv = vMax->texcoord[u][3] * wMax - vMin->texcoord[u][3] * wMin; GLfloat eBot_dv = vMid->texcoord[u][3] * wMid - vMin->texcoord[u][3] * wMin; span.texStepX[u][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); span.texStepY[u][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); span.texStepX[u][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); span.texStepY[u][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); span.texStepX[u][2] = oneOverArea * (eMaj_du * eBot.dy - eMaj.dy * eBot_du); span.texStepY[u][2] = oneOverArea * (eMaj.dx * eBot_du - eMaj_du * eBot.dx); span.texStepX[u][3] = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv); span.texStepY[u][3] = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx); ) } #endif /* * We always sample at pixel centers. However, we avoid * explicit half-pixel offsets in this code by incorporating * the proper offset in each of x and y during the * transformation to window coordinates. * * We also apply the usual rasterization rules to prevent * cracks and overlaps. A pixel is considered inside a * subtriangle if it meets all of four conditions: it is on or * to the right of the left edge, strictly to the left of the * right edge, on or below the top edge, and strictly above * the bottom edge. (Some edges may be degenerate.) * * The following discussion assumes left-to-right scanning * (that is, the major edge is on the left); the right-to-left * case is a straightforward variation. * * We start by finding the half-integral y coordinate that is * at or below the top of the triangle. This gives us the * first scan line that could possibly contain pixels that are * inside the triangle. * * Next we creep down the major edge until we reach that y, * and compute the corresponding x coordinate on the edge. * Then we find the half-integral x that lies on or just * inside the edge. This is the first pixel that might lie in * the interior of the triangle. (We won't know for sure * until we check the other edges.) * * As we rasterize the triangle, we'll step down the major * edge. For each step in y, we'll move an integer number * of steps in x. There are two possible x step sizes, which * we'll call the ``inner'' step (guaranteed to land on the * edge or inside it) and the ``outer'' step (guaranteed to * land on the edge or outside it). The inner and outer steps * differ by one. During rasterization we maintain an error * term that indicates our distance from the true edge, and * select either the inner step or the outer step, whichever * gets us to the first pixel that falls inside the triangle. * * All parameters (z, red, etc.) as well as the buffer * addresses for color and z have inner and outer step values, * so that we can increment them appropriately. This method * eliminates the need to adjust parameters by creeping a * sub-pixel amount into the triangle at each scanline. */ { GLint subTriangle; GLinterp fxLeftEdge = 0, fxRightEdge = 0; GLinterp fdxLeftEdge = 0, fdxRightEdge = 0; GLinterp fError = 0, fdError = 0; #ifdef PIXEL_ADDRESS PIXEL_TYPE *pRow = NULL; GLint dPRowOuter = 0, dPRowInner; /* offset in bytes */ #endif #ifdef INTERP_Z # ifdef DEPTH_TYPE struct gl_renderbuffer *zrb = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer; DEPTH_TYPE *zRow = NULL; GLint dZRowOuter = 0, dZRowInner; /* offset in bytes */ # endif GLfixed zLeft = 0, fdzOuter = 0, fdzInner; #endif #ifdef INTERP_W GLfloat wLeft = 0, dwOuter = 0, dwInner; #endif #ifdef INTERP_FOG GLfloat fogLeft = 0, dfogOuter = 0, dfogInner; #endif #ifdef INTERP_RGB ColorTemp rLeft = 0, fdrOuter = 0, fdrInner; ColorTemp gLeft = 0, fdgOuter = 0, fdgInner; ColorTemp bLeft = 0, fdbOuter = 0, fdbInner; #endif #ifdef INTERP_ALPHA ColorTemp aLeft = 0, fdaOuter = 0, fdaInner; #endif #ifdef INTERP_SPEC ColorTemp srLeft=0, dsrOuter=0, dsrInner; ColorTemp sgLeft=0, dsgOuter=0, dsgInner; ColorTemp sbLeft=0, dsbOuter=0, dsbInner; #endif #ifdef INTERP_INDEX GLfixed iLeft=0, diOuter=0, diInner; #endif #ifdef INTERP_INT_TEX GLfixed sLeft=0, dsOuter=0, dsInner; GLfixed tLeft=0, dtOuter=0, dtInner; #endif #ifdef INTERP_TEX GLfloat sLeft[MAX_TEXTURE_COORD_UNITS]; GLfloat tLeft[MAX_TEXTURE_COORD_UNITS]; GLfloat uLeft[MAX_TEXTURE_COORD_UNITS]; GLfloat vLeft[MAX_TEXTURE_COORD_UNITS]; GLfloat dsOuter[MAX_TEXTURE_COORD_UNITS], dsInner[MAX_TEXTURE_COORD_UNITS]; GLfloat dtOuter[MAX_TEXTURE_COORD_UNITS], dtInner[MAX_TEXTURE_COORD_UNITS]; GLfloat duOuter[MAX_TEXTURE_COORD_UNITS], duInner[MAX_TEXTURE_COORD_UNITS]; GLfloat dvOuter[MAX_TEXTURE_COORD_UNITS], dvInner[MAX_TEXTURE_COORD_UNITS]; #endif for (subTriangle=0; subTriangle<=1; subTriangle++) { EdgeT *eLeft, *eRight; int setupLeft, setupRight; int lines; if (subTriangle==0) { /* bottom half */ if (scan_from_left_to_right) { eLeft = &eMaj; eRight = &eBot; lines = eRight->lines; setupLeft = 1; setupRight = 1; } else { eLeft = &eBot; eRight = &eMaj; lines = eLeft->lines; setupLeft = 1; setupRight = 1; } } else { /* top half */ if (scan_from_left_to_right) { eLeft = &eMaj; eRight = &eTop; lines = eRight->lines; setupLeft = 0; setupRight = 1; } else { eLeft = &eTop; eRight = &eMaj; lines = eLeft->lines; setupLeft = 1; setupRight = 0; } if (lines == 0) return; } if (setupLeft && eLeft->lines > 0) { const SWvertex *vLower = eLeft->v0; #if TRIANGLE_WALK_DOUBLE const GLdouble fsy = eLeft->fsy; const GLdouble fsx = eLeft->fsx; const GLdouble fx = CEILF(fsx); const GLdouble adjx = (fx - eLeft->fx0) * FIXED_SCALE; /* SCALED! */ #else const GLfixed fsy = eLeft->fsy; const GLfixed fsx = eLeft->fsx; /* no fractional part */ const GLfixed fx = FixedCeil(fsx); /* no fractional part */ const GLfixed adjx = (GLinterp) (fx - eLeft->fx0); /* SCALED! */ #endif const GLinterp adjy = (GLinterp) eLeft->adjy; /* SCALED! */ GLint idxOuter; #if TRIANGLE_WALK_DOUBLE GLdouble dxOuter; fError = fx - fsx - 1.0; fxLeftEdge = fsx; fdxLeftEdge = eLeft->dxdy; dxOuter = FLOORF(fdxLeftEdge); fdError = dxOuter - fdxLeftEdge + 1.0; idxOuter = (GLint) dxOuter; span.y = (GLint) fsy; #else GLfloat dxOuter; GLfixed fdxOuter; fError = fx - fsx - FIXED_ONE; fxLeftEdge = fsx - FIXED_EPSILON; fdxLeftEdge = eLeft->fdxdy; fdxOuter = FixedFloor(fdxLeftEdge - FIXED_EPSILON); fdError = fdxOuter - fdxLeftEdge + FIXED_ONE; idxOuter = FixedToInt(fdxOuter); dxOuter = (GLfloat) idxOuter; span.y = FixedToInt(fsy); #endif /* silence warnings on some compilers */ (void) dxOuter; (void) adjx; (void) adjy; (void) vLower; #ifdef PIXEL_ADDRESS { pRow = (PIXEL_TYPE *) PIXEL_ADDRESS(InterpToInt(fxLeftEdge), span.y); dPRowOuter = -((int)BYTES_PER_ROW) + idxOuter * sizeof(PIXEL_TYPE); /* negative because Y=0 at bottom and increases upward */ } #endif /* * Now we need the set of parameter (z, color, etc.) values at * the point (fx, fsy). This gives us properly-sampled parameter * values that we can step from pixel to pixel. Furthermore, * although we might have intermediate results that overflow * the normal parameter range when we step temporarily outside * the triangle, we shouldn't overflow or underflow for any * pixel that's actually inside the triangle. */ #ifdef INTERP_Z { GLfloat z0 = vLower->win[2]; if (depthBits <= 16) { /* interpolate fixed-pt values */ GLfloat tmp = (z0 * FIXED_SCALE + span.dzdx * adjx + span.dzdy * adjy) + FIXED_HALF; if (tmp < MAX_GLUINT / 2) zLeft = (GLfixed) tmp; else zLeft = MAX_GLUINT / 2; fdzOuter = SignedFloatToFixed(span.dzdy + dxOuter * span.dzdx); } else { /* interpolate depth values exactly */ zLeft = (GLint) (z0 + span.dzdx * FixedToFloat(adjx) + span.dzdy * FixedToFloat(adjy)); fdzOuter = (GLint) (span.dzdy + dxOuter * span.dzdx); } # ifdef DEPTH_TYPE zRow = (DEPTH_TYPE *) zrb->GetPointer(ctx, zrb, InterpToInt(fxLeftEdge), span.y); dZRowOuter = (ctx->DrawBuffer->Width + idxOuter) * sizeof(DEPTH_TYPE); # endif } #endif #ifdef INTERP_W wLeft = vLower->win[3] + (span.dwdx * adjx + span.dwdy * adjy) * (1.0F/FIXED_SCALE); dwOuter = span.dwdy + dxOuter * span.dwdx; #endif #ifdef INTERP_FOG # ifdef INTERP_W fogLeft = vLower->fog * vLower->win[3] + (span.dfogdx * adjx + span.dfogdy * adjy) * (1.0F/FIXED_SCALE); # else fogLeft = vLower->fog + (span.dfogdx * adjx + span.dfogdy * adjy) * (1.0F/FIXED_SCALE); # endif dfogOuter = span.dfogdy + dxOuter * span.dfogdx; #endif #ifdef INTERP_RGB if (ctx->Light.ShadeModel == GL_SMOOTH) { # if CHAN_TYPE == GL_FLOAT rLeft = vLower->color[RCOMP] + (span.drdx * adjx + span.drdy * adjy) * (1.0F / FIXED_SCALE); gLeft = vLower->color[GCOMP] + (span.dgdx * adjx + span.dgdy * adjy) * (1.0F / FIXED_SCALE); bLeft = vLower->color[BCOMP] + (span.dbdx * adjx + span.dbdy * adjy) * (1.0F / FIXED_SCALE); fdrOuter = span.drdy + dxOuter * span.drdx; fdgOuter = span.dgdy + dxOuter * span.dgdx; fdbOuter = span.dbdy + dxOuter * span.dbdx; # else rLeft = (GLint)(ChanToFixed(vLower->color[RCOMP]) + span.drdx * adjx + span.drdy * adjy) + FIXED_HALF; gLeft = (GLint)(ChanToFixed(vLower->color[GCOMP]) + span.dgdx * adjx + span.dgdy * adjy) + FIXED_HALF; bLeft = (GLint)(ChanToFixed(vLower->color[BCOMP]) + span.dbdx * adjx + span.dbdy * adjy) + FIXED_HALF; fdrOuter = SignedFloatToFixed(span.drdy + dxOuter * span.drdx); fdgOuter = SignedFloatToFixed(span.dgdy + dxOuter * span.dgdx); fdbOuter = SignedFloatToFixed(span.dbdy + dxOuter * span.dbdx); # endif # ifdef INTERP_ALPHA # if CHAN_TYPE == GL_FLOAT aLeft = vLower->color[ACOMP] + (span.dadx * adjx + span.dady * adjy) * (1.0F / FIXED_SCALE); fdaOuter = span.dady + dxOuter * span.dadx; # else aLeft = (GLint)(ChanToFixed(vLower->color[ACOMP]) + span.dadx * adjx + span.dady * adjy) + FIXED_HALF; fdaOuter = SignedFloatToFixed(span.dady + dxOuter * span.dadx); # endif # endif } else { ASSERT(ctx->Light.ShadeModel == GL_FLAT); # if CHAN_TYPE == GL_FLOAT rLeft = v2->color[RCOMP]; gLeft = v2->color[GCOMP]; bLeft = v2->color[BCOMP]; fdrOuter = fdgOuter = fdbOuter = 0.0F; # else rLeft = ChanToFixed(v2->color[RCOMP]); gLeft = ChanToFixed(v2->color[GCOMP]); bLeft = ChanToFixed(v2->color[BCOMP]); fdrOuter = fdgOuter = fdbOuter = 0; # endif # ifdef INTERP_ALPHA # if CHAN_TYPE == GL_FLOAT aLeft = v2->color[ACOMP]; fdaOuter = 0.0F; # else aLeft = ChanToFixed(v2->color[ACOMP]); fdaOuter = 0; # endif # endif } #endif /* INTERP_RGB */ #ifdef INTERP_SPEC if (ctx->Light.ShadeModel == GL_SMOOTH) { # if CHAN_TYPE == GL_FLOAT srLeft = vLower->specular[RCOMP] + (span.dsrdx * adjx + span.dsrdy * adjy) * (1.0F / FIXED_SCALE); sgLeft = vLower->specular[GCOMP] + (span.dsgdx * adjx + span.dsgdy * adjy) * (1.0F / FIXED_SCALE); sbLeft = vLower->specular[BCOMP] + (span.dsbdx * adjx + span.dsbdy * adjy) * (1.0F / FIXED_SCALE); dsrOuter = span.dsrdy + dxOuter * span.dsrdx; dsgOuter = span.dsgdy + dxOuter * span.dsgdx; dsbOuter = span.dsbdy + dxOuter * span.dsbdx; # else srLeft = (GLfixed) (ChanToFixed(vLower->specular[RCOMP]) + span.dsrdx * adjx + span.dsrdy * adjy) + FIXED_HALF; sgLeft = (GLfixed) (ChanToFixed(vLower->specular[GCOMP]) + span.dsgdx * adjx + span.dsgdy * adjy) + FIXED_HALF; sbLeft = (GLfixed) (ChanToFixed(vLower->specular[BCOMP]) + span.dsbdx * adjx + span.dsbdy * adjy) + FIXED_HALF; dsrOuter = SignedFloatToFixed(span.dsrdy + dxOuter * span.dsrdx); dsgOuter = SignedFloatToFixed(span.dsgdy + dxOuter * span.dsgdx); dsbOuter = SignedFloatToFixed(span.dsbdy + dxOuter * span.dsbdx); # endif } else { ASSERT(ctx->Light.ShadeModel == GL_FLAT); #if CHAN_TYPE == GL_FLOAT srLeft = v2->specular[RCOMP]; sgLeft = v2->specular[GCOMP]; sbLeft = v2->specular[BCOMP]; dsrOuter = dsgOuter = dsbOuter = 0.0F; # else srLeft = ChanToFixed(v2->specular[RCOMP]); sgLeft = ChanToFixed(v2->specular[GCOMP]); sbLeft = ChanToFixed(v2->specular[BCOMP]); dsrOuter = dsgOuter = dsbOuter = 0; # endif } #endif #ifdef INTERP_INDEX if (ctx->Light.ShadeModel == GL_SMOOTH) { iLeft = (GLfixed)(vLower->index * FIXED_SCALE + didx * adjx + didy * adjy) + FIXED_HALF; diOuter = SignedFloatToFixed(didy + dxOuter * didx); } else { ASSERT(ctx->Light.ShadeModel == GL_FLAT); iLeft = FloatToFixed(v2->index); diOuter = 0; } #endif #ifdef INTERP_INT_TEX { GLfloat s0, t0; s0 = vLower->texcoord[0][0] * S_SCALE; sLeft = (GLfixed)(s0 * FIXED_SCALE + span.texStepX[0][0] * adjx + span.texStepY[0][0] * adjy) + FIXED_HALF; dsOuter = SignedFloatToFixed(span.texStepY[0][0] + dxOuter * span.texStepX[0][0]); t0 = vLower->texcoord[0][1] * T_SCALE; tLeft = (GLfixed)(t0 * FIXED_SCALE + span.texStepX[0][1] * adjx + span.texStepY[0][1] * adjy) + FIXED_HALF; dtOuter = SignedFloatToFixed(span.texStepY[0][1] + dxOuter * span.texStepX[0][1]); } #endif #ifdef INTERP_TEX TEX_UNIT_LOOP( const GLfloat invW = vLower->win[3]; const GLfloat s0 = vLower->texcoord[u][0] * invW; const GLfloat t0 = vLower->texcoord[u][1] * invW; const GLfloat u0 = vLower->texcoord[u][2] * invW; const GLfloat v0 = vLower->texcoord[u][3] * invW; sLeft[u] = s0 + (span.texStepX[u][0] * adjx + span.texStepY[u][0] * adjy) * (1.0F/FIXED_SCALE); tLeft[u] = t0 + (span.texStepX[u][1] * adjx + span.texStepY[u][1] * adjy) * (1.0F/FIXED_SCALE); uLeft[u] = u0 + (span.texStepX[u][2] * adjx + span.texStepY[u][2] * adjy) * (1.0F/FIXED_SCALE); vLeft[u] = v0 + (span.texStepX[u][3] * adjx + span.texStepY[u][3] * adjy) * (1.0F/FIXED_SCALE); dsOuter[u] = span.texStepY[u][0] + dxOuter * span.texStepX[u][0]; dtOuter[u] = span.texStepY[u][1] + dxOuter * span.texStepX[u][1]; duOuter[u] = span.texStepY[u][2] + dxOuter * span.texStepX[u][2]; dvOuter[u] = span.texStepY[u][3] + dxOuter * span.texStepX[u][3]; ) #endif } /*if setupLeft*/ if (setupRight && eRight->lines>0) { #if TRIANGLE_WALK_DOUBLE fxRightEdge = eRight->fsx; fdxRightEdge = eRight->dxdy; #else fxRightEdge = eRight->fsx - FIXED_EPSILON; fdxRightEdge = eRight->fdxdy; #endif } if (lines==0) { continue; } /* Rasterize setup */ #ifdef PIXEL_ADDRESS dPRowInner = dPRowOuter + sizeof(PIXEL_TYPE); #endif #ifdef INTERP_Z # ifdef DEPTH_TYPE dZRowInner = dZRowOuter + sizeof(DEPTH_TYPE); # endif fdzInner = fdzOuter + span.zStep; #endif #ifdef INTERP_W dwInner = dwOuter + span.dwdx; #endif #ifdef INTERP_FOG dfogInner = dfogOuter + span.dfogdx; #endif #ifdef INTERP_RGB fdrInner = fdrOuter + span.redStep; fdgInner = fdgOuter + span.greenStep; fdbInner = fdbOuter + span.blueStep; #endif #ifdef INTERP_ALPHA fdaInner = fdaOuter + span.alphaStep; #endif #ifdef INTERP_SPEC dsrInner = dsrOuter + span.specRedStep; dsgInner = dsgOuter + span.specGreenStep; dsbInner = dsbOuter + span.specBlueStep; #endif #ifdef INTERP_INDEX diInner = diOuter + span.indexStep; #endif #ifdef INTERP_INT_TEX dsInner = dsOuter + span.intTexStep[0]; dtInner = dtOuter + span.intTexStep[1]; #endif #ifdef INTERP_TEX TEX_UNIT_LOOP( dsInner[u] = dsOuter[u] + span.texStepX[u][0]; dtInner[u] = dtOuter[u] + span.texStepX[u][1]; duInner[u] = duOuter[u] + span.texStepX[u][2]; dvInner[u] = dvOuter[u] + span.texStepX[u][3]; ) #endif while (lines > 0) { /* initialize the span interpolants to the leftmost value */ /* ff = fixed-pt fragment */ const GLint right = InterpToInt(fxRightEdge); span.x = InterpToInt(fxLeftEdge); if (right <= span.x) span.end = 0; else span.end = right - span.x; #ifdef INTERP_Z span.z = zLeft; #endif #ifdef INTERP_W span.w = wLeft; #endif #ifdef INTERP_FOG span.fog = fogLeft; #endif #ifdef INTERP_RGB span.red = rLeft; span.green = gLeft; span.blue = bLeft; #endif #ifdef INTERP_ALPHA span.alpha = aLeft; #endif #ifdef INTERP_SPEC span.specRed = srLeft; span.specGreen = sgLeft; span.specBlue = sbLeft; #endif #ifdef INTERP_INDEX span.index = iLeft; #endif #ifdef INTERP_INT_TEX span.intTex[0] = sLeft; span.intTex[1] = tLeft; #endif #ifdef INTERP_TEX TEX_UNIT_LOOP( span.tex[u][0] = sLeft[u]; span.tex[u][1] = tLeft[u]; span.tex[u][2] = uLeft[u]; span.tex[u][3] = vLeft[u]; ) #endif /* This is where we actually generate fragments */ /* XXX the test for span.y > 0 _shouldn't_ be needed but * it fixes a problem on 64-bit Opterons (bug 4842). */ if (span.end > 0 && span.y >= 0) { const GLint len = span.end - 1; (void) len; #ifdef INTERP_RGB CLAMP_INTERPOLANT(red, redStep, len); CLAMP_INTERPOLANT(green, greenStep, len); CLAMP_INTERPOLANT(blue, blueStep, len); #endif #ifdef INTERP_ALPHA CLAMP_INTERPOLANT(alpha, alphaStep, len); #endif #ifdef INTERP_SPEC CLAMP_INTERPOLANT(specRed, specRedStep, len); CLAMP_INTERPOLANT(specGreen, specGreenStep, len); CLAMP_INTERPOLANT(specBlue, specBlueStep, len); #endif #ifdef INTERP_INDEX CLAMP_INTERPOLANT(index, indexStep, len); #endif RENDER_SPAN( span ); } /* * Advance to the next scan line. Compute the * new edge coordinates, and adjust the * pixel-center x coordinate so that it stays * on or inside the major edge. */ span.y++; lines--; fxLeftEdge += fdxLeftEdge; fxRightEdge += fdxRightEdge; fError += fdError; if (fError >= 0) { fError -= INTERP_ONE; #ifdef PIXEL_ADDRESS pRow = (PIXEL_TYPE *) ((GLubyte *) pRow + dPRowOuter); #endif #ifdef INTERP_Z # ifdef DEPTH_TYPE zRow = (DEPTH_TYPE *) ((GLubyte *) zRow + dZRowOuter); # endif zLeft += fdzOuter; #endif #ifdef INTERP_W wLeft += dwOuter; #endif #ifdef INTERP_FOG fogLeft += dfogOuter; #endif #ifdef INTERP_RGB rLeft += fdrOuter; gLeft += fdgOuter; bLeft += fdbOuter; #endif #ifdef INTERP_ALPHA aLeft += fdaOuter; #endif #ifdef INTERP_SPEC srLeft += dsrOuter; sgLeft += dsgOuter; sbLeft += dsbOuter; #endif #ifdef INTERP_INDEX iLeft += diOuter; #endif #ifdef INTERP_INT_TEX sLeft += dsOuter; tLeft += dtOuter; #endif #ifdef INTERP_TEX TEX_UNIT_LOOP( sLeft[u] += dsOuter[u]; tLeft[u] += dtOuter[u]; uLeft[u] += duOuter[u]; vLeft[u] += dvOuter[u]; ) #endif } else { #ifdef PIXEL_ADDRESS pRow = (PIXEL_TYPE *) ((GLubyte *) pRow + dPRowInner); #endif #ifdef INTERP_Z # ifdef DEPTH_TYPE zRow = (DEPTH_TYPE *) ((GLubyte *) zRow + dZRowInner); # endif zLeft += fdzInner; #endif #ifdef INTERP_W wLeft += dwInner; #endif #ifdef INTERP_FOG fogLeft += dfogInner; #endif #ifdef INTERP_RGB rLeft += fdrInner; gLeft += fdgInner; bLeft += fdbInner; #endif #ifdef INTERP_ALPHA aLeft += fdaInner; #endif #ifdef INTERP_SPEC srLeft += dsrInner; sgLeft += dsgInner; sbLeft += dsbInner; #endif #ifdef INTERP_INDEX iLeft += diInner; #endif #ifdef INTERP_INT_TEX sLeft += dsInner; tLeft += dtInner; #endif #ifdef INTERP_TEX TEX_UNIT_LOOP( sLeft[u] += dsInner[u]; tLeft[u] += dtInner[u]; uLeft[u] += duInner[u]; vLeft[u] += dvInner[u]; ) #endif } } /*while lines>0*/ } /* for subTriangle */ } #ifdef CLEANUP_CODE CLEANUP_CODE #endif } } #undef SETUP_CODE #undef CLEANUP_CODE #undef RENDER_SPAN #undef PIXEL_TYPE #undef BYTES_PER_ROW #undef PIXEL_ADDRESS #undef DEPTH_TYPE #undef INTERP_Z #undef INTERP_W #undef INTERP_FOG #undef INTERP_RGB #undef INTERP_ALPHA #undef INTERP_SPEC #undef INTERP_INDEX #undef INTERP_INT_TEX #undef INTERP_TEX #undef INTERP_MULTITEX #undef TEX_UNIT_LOOP #undef S_SCALE #undef T_SCALE #undef FixedToDepth #undef ColorTemp #undef GLinterp #undef InterpToInt #undef INTERP_ONE #undef NAME nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/swrast.h0000644000000000000000000002235413614532424020242 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ /** * \file swrast/swrast.h * \brief Public interface to the software rasterization functions. * \author Keith Whitwell */ #ifndef SWRAST_H #define SWRAST_H #include "mtypes.h" /** * \struct SWvertex * \brief Data-structure to handle vertices in the software rasterizer. * * The software rasterizer now uses this format for vertices. Thus a * 'RasterSetup' stage or other translation is required between the * tnl module and the swrast rasterization functions. This serves to * isolate the swrast module from the internals of the tnl module, and * improve its usefulness as a fallback mechanism for hardware * drivers. * * Full software drivers: * - Register the rastersetup and triangle functions from * utils/software_helper. * - On statechange, update the rasterization pointers in that module. * * Rasterization hardware drivers: * - Keep native rastersetup. * - Implement native twoside,offset and unfilled triangle setup. * - Implement a translator from native vertices to swrast vertices. * - On partial fallback (mix of accelerated and unaccelerated * prims), call a pass-through function which translates native * vertices to SWvertices and calls the appropriate swrast function. * - On total fallback (vertex format insufficient for state or all * primitives unaccelerated), hook in swrast_setup instead. */ typedef struct { /** win[0], win[1] are the screen-coords of SWvertex. * win[2] is the z-buffer coord (if 16-bit Z buffer, in range [0,65535]). * win[3] is 1/w where w is the clip-space W coord. This is the value * that clip{XYZ} were multiplied by to get ndc{XYZ}. */ GLfloat win[4]; GLfloat texcoord[MAX_TEXTURE_COORD_UNITS][4]; GLchan color[4]; GLchan specular[4]; GLfloat fog; GLfloat index; GLfloat pointSize; } SWvertex; struct swrast_device_driver; /* These are the public-access functions exported from swrast. */ extern void _swrast_use_read_buffer( GLcontext *ctx ); extern void _swrast_use_draw_buffer( GLcontext *ctx ); extern GLboolean _swrast_CreateContext( GLcontext *ctx ); extern void _swrast_DestroyContext( GLcontext *ctx ); /* Get a (non-const) reference to the device driver struct for swrast. */ extern struct swrast_device_driver * _swrast_GetDeviceDriverReference( GLcontext *ctx ); extern void _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ); extern void _swrast_CopyPixels( GLcontext *ctx, GLint srcx, GLint srcy, GLint destx, GLint desty, GLsizei width, GLsizei height, GLenum type ); extern void _swrast_DrawPixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ); extern void _swrast_ReadPixels( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *pixels ); extern void _swrast_Clear( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); extern void _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height ); extern void _swrast_DrawBuffer( GLcontext *ctx, GLenum mode ); extern void _swrast_DrawBuffers( GLcontext *ctx, GLsizei n, const GLenum *buffers ); /* Reset the stipple counter */ extern void _swrast_ResetLineStipple( GLcontext *ctx ); /* These will always render the correct point/line/triangle for the * current state. * * For flatshaded primitives, the provoking vertex is the final one. */ extern void _swrast_Point( GLcontext *ctx, const SWvertex *v ); extern void _swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ); extern void _swrast_Triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ); extern void _swrast_Quad( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2, const SWvertex *v3); extern void _swrast_flush( GLcontext *ctx ); extern void _swrast_render_primitive( GLcontext *ctx, GLenum mode ); extern void _swrast_render_start( GLcontext *ctx ); extern void _swrast_render_finish( GLcontext *ctx ); /* Tell the software rasterizer about core state changes. */ extern void _swrast_InvalidateState( GLcontext *ctx, GLuint new_state ); /* Configure software rasterizer to match hardware rasterizer characteristics: */ extern void _swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ); extern void _swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value ); /* Debug: */ extern void _swrast_print_vertex( GLcontext *ctx, const SWvertex *v ); /* * Imaging fallbacks (a better solution should be found, perhaps * moving all the imaging fallback code to a new module) */ extern void _swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height); extern void _swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width); extern void _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); extern void _swrast_CopyColorTable( GLcontext *ctx, GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* * Texture fallbacks. Could also live in a new module * with the rest of the texture store fallbacks? */ extern void _swrast_copy_teximage1d(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); extern void _swrast_copy_teximage2d(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); extern void _swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); extern void _swrast_copy_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); extern void _swrast_copy_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* The driver interface for the software rasterizer. * Unless otherwise noted, all functions are mandatory. */ struct swrast_device_driver { #if OLD_RENDERBUFFER void (*SetBuffer)(GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit); /* * Specifies the current color buffer for span/pixel writing/reading. * buffer indicates which window to write to / read from. Normally, * this'll be the buffer currently bound to the context, but it doesn't * have to be! * bufferBit indicates which color buffer, exactly one of: * DD_FRONT_LEFT_BIT - this buffer always exists * DD_BACK_LEFT_BIT - when double buffering * DD_FRONT_RIGHT_BIT - when using stereo * DD_BACK_RIGHT_BIT - when using stereo and double buffering * DD_AUXn_BIT - if aux buffers are implemented */ #endif /*** *** Functions for synchronizing access to the framebuffer: ***/ void (*SpanRenderStart)(GLcontext *ctx); void (*SpanRenderFinish)(GLcontext *ctx); /* OPTIONAL. * * Called before and after all rendering operations, including DrawPixels, * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands. * These are a suitable place for grabbing/releasing hardware locks. * * NOTE: The swrast triangle/line/point routines *DO NOT* call * these functions. Locking in that case must be organized by the * driver by other mechanisms. */ }; #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/swrast/s_zoom.c0000644000000000000000000003113613614532424020216 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "macros.h" #include "imports.h" #include "colormac.h" #include "s_context.h" #include "s_span.h" #include "s_stencil.h" #include "s_zoom.h" /* * Helper function called from _swrast_write_zoomed_rgba/rgb/index_span(). */ static void zoom_span( GLcontext *ctx, const struct sw_span *span, const GLvoid *src, GLint y0, GLenum format, GLint skipPixels ) { GLint r0, r1, row; GLint c0, c1, skipCol; GLint i, j; const GLuint maxWidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH ); struct sw_span zoomed; struct span_arrays zoomed_arrays; /* this is big! */ /* no pixel arrays! must be horizontal spans. */ ASSERT((span->arrayMask & SPAN_XY) == 0); ASSERT(span->primitive == GL_BITMAP); INIT_SPAN(zoomed, GL_BITMAP, 0, 0, 0); zoomed.array = &zoomed_arrays; /* copy fog interp info */ zoomed.fog = span->fog; zoomed.fogStep = span->fogStep; /* XXX copy texcoord info? */ if (format == GL_RGBA || format == GL_RGB) { /* copy Z info */ zoomed.z = span->z; zoomed.zStep = span->zStep; /* we'll generate an array of colorss */ zoomed.interpMask = span->interpMask & ~SPAN_RGBA; zoomed.arrayMask |= SPAN_RGBA; } else if (format == GL_COLOR_INDEX) { /* copy Z info */ zoomed.z = span->z; zoomed.zStep = span->zStep; /* we'll generate an array of color indexes */ zoomed.interpMask = span->interpMask & ~SPAN_INDEX; zoomed.arrayMask |= SPAN_INDEX; } else { assert(format == GL_DEPTH_COMPONENT); /* Copy color info */ zoomed.red = span->red; zoomed.green = span->green; zoomed.blue = span->blue; zoomed.alpha = span->alpha; zoomed.redStep = span->redStep; zoomed.greenStep = span->greenStep; zoomed.blueStep = span->blueStep; zoomed.alphaStep = span->alphaStep; /* we'll generate an array of depth values */ zoomed.interpMask = span->interpMask & ~SPAN_Z; zoomed.arrayMask |= SPAN_Z; } /* * Compute which columns to draw: [c0, c1) */ c0 = (GLint) (span->x + skipPixels * ctx->Pixel.ZoomX); c1 = (GLint) (span->x + (skipPixels + span->end) * ctx->Pixel.ZoomX); if (c0 == c1) { return; } else if (c1 < c0) { /* swap */ GLint ctmp = c1; c1 = c0; c0 = ctmp; } if (c0 < 0) { zoomed.x = 0; zoomed.start = 0; zoomed.end = c1; skipCol = -c0; } else { zoomed.x = c0; zoomed.start = 0; zoomed.end = c1 - c0; skipCol = 0; } if (zoomed.end > maxWidth) zoomed.end = maxWidth; /* * Compute which rows to draw: [r0, r1) */ row = span->y - y0; r0 = y0 + (GLint) (row * ctx->Pixel.ZoomY); r1 = y0 + (GLint) ((row+1) * ctx->Pixel.ZoomY); if (r0 == r1) { return; } else if (r1 < r0) { /* swap */ GLint rtmp = r1; r1 = r0; r0 = rtmp; } ASSERT(r0 < r1); ASSERT(c0 < c1); /* * Trivial clip rejection testing. */ if (r1 < 0) /* below window */ return; if (r0 >= (GLint) ctx->DrawBuffer->Height) /* above window */ return; if (c1 < 0) /* left of window */ return; if (c0 >= (GLint) ctx->DrawBuffer->Width) /* right of window */ return; /* zoom the span horizontally */ if (format == GL_RGBA) { const GLchan (*rgba)[4] = (const GLchan (*)[4]) src; if (ctx->Pixel.ZoomX == -1.0F) { /* common case */ for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { i = span->end - (j + skipCol) - 1; COPY_CHAN4(zoomed.array->rgba[j], rgba[i]); } } else { /* general solution */ const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { i = (GLint) ((j + skipCol) * xscale); if (ctx->Pixel.ZoomX < 0.0) { ASSERT(i <= 0); i = span->end + i - 1; } ASSERT(i >= 0); ASSERT(i < (GLint) span->end); COPY_CHAN4(zoomed.array->rgba[j], rgba[i]); } } } else if (format == GL_RGB) { const GLchan (*rgb)[3] = (const GLchan (*)[3]) src; if (ctx->Pixel.ZoomX == -1.0F) { /* common case */ for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { i = span->end - (j + skipCol) - 1; zoomed.array->rgba[j][0] = rgb[i][0]; zoomed.array->rgba[j][1] = rgb[i][1]; zoomed.array->rgba[j][2] = rgb[i][2]; zoomed.array->rgba[j][3] = CHAN_MAX; } } else { /* general solution */ const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { i = (GLint) ((j + skipCol) * xscale); if (ctx->Pixel.ZoomX < 0.0) { ASSERT(i <= 0); i = span->end + i - 1; } ASSERT(i >= 0); ASSERT(i < (GLint) span->end); zoomed.array->rgba[j][0] = rgb[i][0]; zoomed.array->rgba[j][1] = rgb[i][1]; zoomed.array->rgba[j][2] = rgb[i][2]; zoomed.array->rgba[j][3] = CHAN_MAX; } } } else if (format == GL_COLOR_INDEX) { const GLuint *indexes = (const GLuint *) src; if (ctx->Pixel.ZoomX == -1.0F) { /* common case */ for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { i = span->end - (j + skipCol) - 1; zoomed.array->index[j] = indexes[i]; } } else { /* general solution */ const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { i = (GLint) ((j + skipCol) * xscale); if (ctx->Pixel.ZoomX < 0.0) { ASSERT(i <= 0); i = span->end + i - 1; } ASSERT(i >= 0); ASSERT(i < (GLint) span->end); zoomed.array->index[j] = indexes[i]; } } } else { const GLdepth *zValues = (const GLuint *) src; assert(format == GL_DEPTH_COMPONENT); if (ctx->Pixel.ZoomX == -1.0F) { /* common case */ for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { i = span->end - (j + skipCol) - 1; zoomed.array->z[j] = zValues[i]; } } else { /* general solution */ const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { i = (GLint) ((j + skipCol) * xscale); if (ctx->Pixel.ZoomX < 0.0) { ASSERT(i <= 0); i = span->end + i - 1; } ASSERT(i >= 0); ASSERT(i < (GLint) span->end); zoomed.array->z[j] = zValues[i]; } } /* Now, fall into either the RGB or COLOR_INDEX path below */ if (ctx->Visual.rgbMode) format = GL_RGBA; else format = GL_COLOR_INDEX; } /* write the span in rows [r0, r1) */ if (format == GL_RGBA || format == GL_RGB) { /* Writing the span may modify the colors, so make a backup now if we're * going to call _swrast_write_zoomed_span() more than once. * Also, clipping may change the span end value, so store it as well. */ GLchan rgbaSave[MAX_WIDTH][4]; const GLint end = zoomed.end; /* save */ if (r1 - r0 > 1) { MEMCPY(rgbaSave, zoomed.array->rgba, zoomed.end * 4 * sizeof(GLchan)); } for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) { _swrast_write_rgba_span(ctx, &zoomed); zoomed.end = end; /* restore */ if (r1 - r0 > 1) { /* restore the colors */ MEMCPY(zoomed.array->rgba, rgbaSave, zoomed.end*4 * sizeof(GLchan)); } } } else if (format == GL_COLOR_INDEX) { GLuint indexSave[MAX_WIDTH]; const GLint end = zoomed.end; /* save */ if (r1 - r0 > 1) { MEMCPY(indexSave, zoomed.array->index, zoomed.end * sizeof(GLuint)); } for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) { _swrast_write_index_span(ctx, &zoomed); zoomed.end = end; /* restore */ if (r1 - r0 > 1) { /* restore the colors */ MEMCPY(zoomed.array->index, indexSave, zoomed.end * sizeof(GLuint)); } } } } void _swrast_write_zoomed_rgba_span( GLcontext *ctx, const struct sw_span *span, CONST GLchan rgba[][4], GLint y0, GLint skipPixels ) { zoom_span(ctx, span, (const GLvoid *) rgba, y0, GL_RGBA, skipPixels); } void _swrast_write_zoomed_rgb_span( GLcontext *ctx, const struct sw_span *span, CONST GLchan rgb[][3], GLint y0, GLint skipPixels ) { zoom_span(ctx, span, (const GLvoid *) rgb, y0, GL_RGB, skipPixels); } void _swrast_write_zoomed_index_span( GLcontext *ctx, const struct sw_span *span, GLint y0, GLint skipPixels ) { zoom_span(ctx, span, (const GLvoid *) span->array->index, y0, GL_COLOR_INDEX, skipPixels); } void _swrast_write_zoomed_depth_span( GLcontext *ctx, const struct sw_span *span, GLint y0, GLint skipPixels ) { zoom_span(ctx, span, (const GLvoid *) span->array->z, y0, GL_DEPTH_COMPONENT, skipPixels); } /* * As above, but write stencil values. */ void _swrast_write_zoomed_stencil_span( GLcontext *ctx, GLuint n, GLint x, GLint y, const GLstencil stencil[], GLint y0, GLint skipPixels ) { GLint m; GLint r0, r1, row, r; GLint i, j, skipcol; GLstencil zstencil[MAX_WIDTH]; /* zoomed stencil values */ GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH ); (void) skipPixels; /* XXX this shouldn't be ignored */ /* compute width of output row */ m = (GLint) FABSF( n * ctx->Pixel.ZoomX ); if (m==0) { return; } if (ctx->Pixel.ZoomX<0.0) { /* adjust x coordinate for left/right mirroring */ x = x - m; } /* compute which rows to draw */ row = y - y0; r0 = y0 + (GLint) (row * ctx->Pixel.ZoomY); r1 = y0 + (GLint) ((row+1) * ctx->Pixel.ZoomY); if (r0==r1) { return; } else if (r1= (GLint) ctx->DrawBuffer->Height && r1 >= (GLint) ctx->DrawBuffer->Height) { /* above window */ return; } /* check if left edge is outside window */ skipcol = 0; if (x<0) { skipcol = -x; m += x; } /* make sure span isn't too long or short */ if (m>maxwidth) { m = maxwidth; } else if (m<=0) { return; } ASSERT( m <= MAX_WIDTH ); /* zoom the span horizontally */ if (ctx->Pixel.ZoomX==-1.0F) { /* n==m */ for (j=0;jPixel.ZoomX; for (j=0;jCompileFlag); assert(ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1); CALL_Begin(GET_DISPATCH(), (mode)); for (i = 0; i < count; i++) CALL_ArrayElement(GET_DISPATCH(), ( start + i )); CALL_End(GET_DISPATCH(), ()); } static void fallback_drawelements( GLcontext *ctx, GLenum mode, GLsizei count, const GLuint *indices) { GLint i; assert(!ctx->CompileFlag); assert(ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1); /* Here, indices will already reflect the buffer object if active */ CALL_Begin(GET_DISPATCH(), (mode)); for (i = 0 ; i < count ; i++) { CALL_ArrayElement(GET_DISPATCH(), ( indices[i] )); } CALL_End(GET_DISPATCH(), ()); } /* Note this function no longer takes a 'start' value, the range is * assumed to start at zero. The old trick of subtracting 'start' * from each index won't work if the indices are not in writeable * memory. */ static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode, GLuint max_index, GLsizei index_count, GLuint *indices ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct tnl_prim prim; FLUSH_CURRENT( ctx, 0 ); _tnl_vb_bind_arrays( ctx, 0, max_index ); tnl->vb.Primitive = &prim; tnl->vb.Primitive[0].mode = mode | PRIM_BEGIN | PRIM_END; tnl->vb.Primitive[0].start = 0; tnl->vb.Primitive[0].count = index_count; tnl->vb.PrimitiveCount = 1; tnl->vb.Elts = (GLuint *)indices; tnl->Driver.RunPipeline( ctx ); } /** * Called via the GL API dispatcher. */ void GLAPIENTRY _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) { GET_CURRENT_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint thresh = (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) ? 30 : 10; if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(NULL, "_tnl_DrawArrays %d %d\n", start, count); /* Check arguments, etc. */ if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) return; assert(!ctx->CompileFlag); if (!ctx->Array.LockCount && (GLuint) count < thresh) { /* Small primitives: attempt to share a vb (at the expense of * using the immediate interface). */ fallback_drawarrays( ctx, mode, start, count ); } else if (start >= (GLint) ctx->Array.LockFirst && start + count <= (GLint)(ctx->Array.LockFirst + ctx->Array.LockCount)) { struct tnl_prim prim; /* Locked primitives which can fit in a single vertex buffer: */ FLUSH_CURRENT( ctx, 0 ); /* Locked drawarrays. Reuse any previously transformed data. */ _tnl_vb_bind_arrays( ctx, ctx->Array.LockFirst, ctx->Array.LockFirst + ctx->Array.LockCount ); tnl->vb.Primitive = &prim; tnl->vb.Primitive[0].mode = mode | PRIM_BEGIN | PRIM_END; tnl->vb.Primitive[0].start = start; tnl->vb.Primitive[0].count = count; tnl->vb.PrimitiveCount = 1; tnl->Driver.RunPipeline( ctx ); } else { int bufsz = 256; /* Use a small buffer for cache goodness */ int j, nr; int minimum, modulo, skip; /* Large primitives requiring decomposition to multiple vertex * buffers: */ switch (mode) { case GL_POINTS: minimum = 0; modulo = 1; skip = 0; break; case GL_LINES: minimum = 1; modulo = 2; skip = 1; break; case GL_LINE_STRIP: minimum = 1; modulo = 1; skip = 0; break; case GL_TRIANGLES: minimum = 2; modulo = 3; skip = 2; break; case GL_TRIANGLE_STRIP: minimum = 2; modulo = 1; skip = 0; break; case GL_QUADS: minimum = 3; modulo = 4; skip = 3; break; case GL_QUAD_STRIP: minimum = 3; modulo = 2; skip = 0; break; case GL_LINE_LOOP: case GL_TRIANGLE_FAN: case GL_POLYGON: default: /* Primitives requiring a copied vertex (fan-like primitives) * must use the slow path if they cannot fit in a single * vertex buffer. */ if (count <= (GLint) ctx->Const.MaxArrayLockSize) { bufsz = ctx->Const.MaxArrayLockSize; minimum = 0; modulo = 1; skip = 0; } else { fallback_drawarrays( ctx, mode, start, count ); return; } } FLUSH_CURRENT( ctx, 0 ); bufsz -= bufsz % modulo; bufsz -= minimum; count += start; for (j = start + minimum ; j < count ; j += nr + skip ) { struct tnl_prim prim; nr = MIN2( bufsz, count - j ); /* XXX is the last parameter a count or index into the array??? */ _tnl_vb_bind_arrays( ctx, j - minimum, j + nr ); tnl->vb.Primitive = &prim; tnl->vb.Primitive[0].mode = mode; if (j == start + minimum) tnl->vb.Primitive[0].mode |= PRIM_BEGIN; if (j + nr + skip >= count) tnl->vb.Primitive[0].mode |= PRIM_END; tnl->vb.Primitive[0].start = 0; tnl->vb.Primitive[0].count = nr + minimum; tnl->vb.PrimitiveCount = 1; tnl->Driver.RunPipeline( ctx ); } } } /** * Called via the GL API dispatcher. */ void GLAPIENTRY _tnl_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); GLuint *ui_indices; if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(NULL, "_tnl_DrawRangeElements %d %d %d\n", start, end, count); if (ctx->Array.ElementArrayBufferObj->Name) { /* use indices in the buffer object */ if (!ctx->Array.ElementArrayBufferObj->Data) { _mesa_warning(ctx, "DrawRangeElements with empty vertex elements buffer!"); return; } /* actual address is the sum of pointers */ indices = (const GLvoid *) ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data, (const GLubyte *) indices); } /* Check arguments, etc. */ if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, type, indices )) return; ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT, count, type, indices ); assert(!ctx->CompileFlag); if (ctx->Array.LockCount) { /* Are the arrays already locked? If so we currently have to look * at the whole locked range. */ if (start == 0 && ctx->Array.LockFirst == 0 && end < (ctx->Array.LockFirst + ctx->Array.LockCount)) _tnl_draw_range_elements( ctx, mode, ctx->Array.LockCount, count, ui_indices ); else { fallback_drawelements( ctx, mode, count, ui_indices ); } } else if (start == 0 && end < ctx->Const.MaxArrayLockSize) { /* The arrays aren't locked but we can still fit them inside a * single vertexbuffer. */ _tnl_draw_range_elements( ctx, mode, end + 1, count, ui_indices ); } else { /* Range is too big to optimize: */ fallback_drawelements( ctx, mode, count, ui_indices ); } } /** * Called via the GL API dispatcher. */ void GLAPIENTRY _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); GLuint *ui_indices; if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(NULL, "_tnl_DrawElements %d\n", count); /* Check arguments, etc. */ if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) return; if (ctx->Array.ElementArrayBufferObj->Name) { /* actual address is the sum of pointers */ indices = (const GLvoid *) ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data, (const GLubyte *) indices); } ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT, count, type, indices ); assert(!ctx->CompileFlag); if (ctx->Array.LockCount) { if (ctx->Array.LockFirst == 0) _tnl_draw_range_elements( ctx, mode, ctx->Array.LockCount, count, ui_indices ); else fallback_drawelements( ctx, mode, count, ui_indices ); } else { /* Scan the index list and see if we can use the locked path anyway. */ GLuint max_elt = 0; GLint i; for (i = 0 ; i < count ; i++) if (ui_indices[i] > max_elt) max_elt = ui_indices[i]; if (max_elt < ctx->Const.MaxArrayLockSize && /* can we use it? */ max_elt < (GLuint) count) /* do we want to use it? */ _tnl_draw_range_elements( ctx, mode, max_elt+1, count, ui_indices ); else fallback_drawelements( ctx, mode, count, ui_indices ); } } /** * Initialize context's vertex array fields. Called during T 'n L context * creation. */ void _tnl_array_init( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct tnl_vertex_arrays *tmp = &tnl->array_inputs; GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->exec_vtxfmt); GLuint i; vfmt->DrawArrays = _tnl_DrawArrays; vfmt->DrawElements = _tnl_DrawElements; vfmt->DrawRangeElements = _tnl_DrawRangeElements; /* Setup vector pointers that will be used to bind arrays to VB's. */ _mesa_vector4f_init( &tmp->Obj, 0, NULL); _mesa_vector4f_init( &tmp->Normal, 0, NULL); _mesa_vector4f_init( &tmp->FogCoord, 0, NULL); _mesa_vector4f_init( &tmp->Index, 0, NULL); for (i = 0; i < ctx->Const.MaxTextureUnits; i++) _mesa_vector4f_init( &tmp->TexCoord[i], 0, NULL); } /** * Destroy the context's vertex array stuff. * Called during T 'n L context destruction. */ void _tnl_array_destroy( GLcontext *ctx ) { (void) ctx; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_array_api.h0000644000000000000000000000326113614532424020457 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _T_VARRAY_H #define _T_VARRAY_H #include "mtypes.h" #include "t_context.h" extern void GLAPIENTRY _tnl_DrawArrays(GLenum mode, GLint first, GLsizei count); extern void GLAPIENTRY _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); extern void GLAPIENTRY _tnl_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); extern void _tnl_array_init( GLcontext *ctx ); extern void _tnl_array_destroy( GLcontext *ctx ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_array_import.c0000644000000000000000000002441113614532424021213 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "context.h" #include "macros.h" #include "imports.h" #include "state.h" #include "mtypes.h" #include "array_cache/acache.h" #include "math/m_translate.h" #include "t_array_import.h" #include "t_context.h" static void _tnl_import_vertex( GLcontext *ctx, GLboolean writeable, GLboolean stride ) { struct gl_client_array *tmp; GLboolean is_writeable = 0; struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; const GLubyte *data; tmp = _ac_import_vertex(ctx, GL_FLOAT, stride ? 4*sizeof(GLfloat) : 0, 0, writeable, &is_writeable); data = tmp->Ptr; inputs->Obj.data = (GLfloat (*)[4]) data; inputs->Obj.start = (GLfloat *) data; inputs->Obj.stride = tmp->StrideB; inputs->Obj.size = tmp->Size; } static void _tnl_import_normal( GLcontext *ctx, GLboolean writeable, GLboolean stride ) { struct gl_client_array *tmp; GLboolean is_writeable = 0; struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; const GLubyte *data; tmp = _ac_import_normal(ctx, GL_FLOAT, stride ? 3*sizeof(GLfloat) : 0, writeable, &is_writeable); data = tmp->Ptr; inputs->Normal.data = (GLfloat (*)[4]) data; inputs->Normal.start = (GLfloat *) data; inputs->Normal.stride = tmp->StrideB; inputs->Normal.size = 3; } static void _tnl_import_color( GLcontext *ctx, GLboolean writeable, GLboolean stride ) { struct gl_client_array *tmp; GLboolean is_writeable = 0; struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; const GLubyte *data; tmp = _ac_import_color(ctx, GL_FLOAT, stride ? 4*sizeof(GLfloat) : 0, 4, writeable, &is_writeable); data = tmp->Ptr; inputs->Color.data = (GLfloat (*)[4]) data; inputs->Color.start = (GLfloat *) data; inputs->Color.stride = tmp->StrideB; inputs->Color.size = tmp->Size; } static void _tnl_import_secondarycolor( GLcontext *ctx, GLboolean writeable, GLboolean stride ) { struct gl_client_array *tmp; GLboolean is_writeable = 0; struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; const GLubyte *data; tmp = _ac_import_secondarycolor(ctx, GL_FLOAT, stride ? 4*sizeof(GLfloat) : 0, 4, writeable, &is_writeable); data = tmp->Ptr; inputs->SecondaryColor.data = (GLfloat (*)[4]) data; inputs->SecondaryColor.start = (GLfloat *) data; inputs->SecondaryColor.stride = tmp->StrideB; inputs->SecondaryColor.size = tmp->Size; } static void _tnl_import_fogcoord( GLcontext *ctx, GLboolean writeable, GLboolean stride ) { struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; struct gl_client_array *tmp; GLboolean is_writeable = 0; const GLubyte *data; tmp = _ac_import_fogcoord(ctx, GL_FLOAT, stride ? sizeof(GLfloat) : 0, writeable, &is_writeable); data = tmp->Ptr; inputs->FogCoord.data = (GLfloat (*)[4]) data; inputs->FogCoord.start = (GLfloat *) data; inputs->FogCoord.stride = tmp->StrideB; } static void _tnl_import_index( GLcontext *ctx, GLboolean writeable, GLboolean stride ) { struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; struct gl_client_array *tmp; GLboolean is_writeable = 0; const GLubyte *data; tmp = _ac_import_index(ctx, GL_FLOAT, stride ? sizeof(GLfloat) : 0, writeable, &is_writeable); data = tmp->Ptr; inputs->Index.data = (GLfloat (*)[4]) data; inputs->Index.start = (GLfloat *) data; inputs->Index.stride = tmp->StrideB; } static void _tnl_import_texcoord( GLcontext *ctx, GLuint unit, GLboolean writeable, GLboolean stride ) { struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; struct gl_client_array *tmp; GLboolean is_writeable = 0; const GLubyte *data; tmp = _ac_import_texcoord(ctx, unit, GL_FLOAT, stride ? 4 * sizeof(GLfloat) : 0, 0, writeable, &is_writeable); data = tmp->Ptr; inputs->TexCoord[unit].data = (GLfloat (*)[4]) data; inputs->TexCoord[unit].start = (GLfloat *) data; inputs->TexCoord[unit].stride = tmp->StrideB; inputs->TexCoord[unit].size = tmp->Size; } static void _tnl_import_edgeflag( GLcontext *ctx, GLboolean writeable, GLboolean stride ) { struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; struct gl_client_array *tmp; GLboolean is_writeable = 0; const GLubyte *data; (void) writeable; (void) stride; tmp = _ac_import_edgeflag(ctx, GL_UNSIGNED_BYTE, sizeof(GLubyte), 0, &is_writeable); data = tmp->Ptr; inputs->EdgeFlag = (GLubyte *) data; } static void _tnl_import_attrib( GLcontext *ctx, GLuint index, GLboolean writeable, GLboolean stride ) { struct tnl_vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; struct gl_client_array *tmp; GLboolean is_writeable = 0; const GLubyte *data; tmp = _ac_import_attrib(ctx, index, GL_FLOAT, stride ? 4 * sizeof(GLfloat) : 0, 4, /* want GLfloat[4] */ writeable, &is_writeable); data = tmp->Ptr; inputs->Attribs[index].data = (GLfloat (*)[4]) data; inputs->Attribs[index].start = (GLfloat *) data; inputs->Attribs[index].stride = tmp->StrideB; inputs->Attribs[index].size = tmp->Size; } static void _tnl_constant_attrib( TNLcontext *tnl, struct tnl_vertex_arrays *tmp, GLuint i ) { tmp->Attribs[i].count = 1; tmp->Attribs[i].data = (GLfloat (*)[4]) tnl->vtx.current[i]; tmp->Attribs[i].start = tnl->vtx.current[i]; tmp->Attribs[i].size = 4; tmp->Attribs[i].stride = 0; tnl->vb.AttribPtr[i] = &tmp->Attribs[i]; } void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; struct tnl_vertex_arrays *tmp = &tnl->array_inputs; GLuint i, index; VB->Count = end - start; VB->Elts = NULL; _ac_import_range( ctx, start, end ); /* When vertex program mode is enabled, the generic vertex program * attribute arrays have priority over the conventional attributes. * Try to use them now. */ for (index = 0; index < VERT_ATTRIB_MAX; index++) { /* When vertex program mode is enabled, the generic vertex attribute * arrays have priority over the conventional vertex arrays. */ if (ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[index].Enabled) { /* Use generic attribute array */ _tnl_import_attrib( ctx, index, GL_FALSE, GL_TRUE ); VB->AttribPtr[index] = &tmp->Attribs[index]; } /* use conventional arrays... */ else if (index == VERT_ATTRIB_POS) { _tnl_import_vertex( ctx, 0, 0 ); tmp->Obj.count = VB->Count; VB->AttribPtr[_TNL_ATTRIB_POS] = &tmp->Obj; } else if (index == VERT_ATTRIB_NORMAL) { _tnl_import_normal( ctx, 0, 0 ); tmp->Normal.count = VB->Count; VB->AttribPtr[_TNL_ATTRIB_NORMAL] = &tmp->Normal; } else if (index == VERT_ATTRIB_COLOR0) { _tnl_import_color( ctx, 0, 0 ); tmp->Color.count = VB->Count; VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &tmp->Color; } else if (index == VERT_ATTRIB_COLOR1) { _tnl_import_secondarycolor( ctx, 0, 0 ); tmp->SecondaryColor.count = VB->Count; VB->AttribPtr[_TNL_ATTRIB_COLOR1] = &tmp->SecondaryColor; } else if (index == VERT_ATTRIB_FOG) { _tnl_import_fogcoord( ctx, 0, 0 ); tmp->FogCoord.count = VB->Count; VB->AttribPtr[_TNL_ATTRIB_FOG] = &tmp->FogCoord; } else if (index >= VERT_ATTRIB_TEX0 && index <= VERT_ATTRIB_TEX7) { i = index - VERT_ATTRIB_TEX0; _tnl_import_texcoord( ctx, i, GL_FALSE, GL_FALSE ); tmp->TexCoord[i].count = VB->Count; VB->AttribPtr[_TNL_ATTRIB_TEX0 + i] = &tmp->TexCoord[i]; } else { _tnl_constant_attrib(tnl, tmp, index); } } /* odd-ball vertex attributes */ { _tnl_import_index( ctx, 0, 0 ); tmp->Index.count = VB->Count; VB->AttribPtr[_TNL_ATTRIB_INDEX] = &tmp->Index; } { _tnl_import_edgeflag( ctx, GL_TRUE, sizeof(GLboolean) ); VB->EdgeFlag = (GLboolean *) tmp->EdgeFlag; } /* These are constant & could be precalculated: */ for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT; i < _TNL_ATTRIB_INDEX; i++) { _tnl_constant_attrib(tnl, tmp, i); } /* Legacy pointers -- remove one day. */ VB->ObjPtr = VB->AttribPtr[_TNL_ATTRIB_POS]; VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0]; VB->ColorPtr[1] = NULL; VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX]; VB->IndexPtr[1] = NULL; VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1]; VB->SecondaryColorPtr[1] = NULL; VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG]; for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { VB->TexCoordPtr[i] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]; } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_array_import.h0000644000000000000000000000257613614532424021230 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _T_ARRAY_IMPORT_H #define _T_ARRAY_IMPORT_H #include "mtypes.h" #include "t_context.h" extern void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLint end ); extern void _tnl_array_import_init( GLcontext *ctx ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_context.c0000644000000000000000000001671213614532424020174 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "api_arrayelt.h" #include "glheader.h" #include "imports.h" #include "context.h" #include "macros.h" #include "mtypes.h" #include "dlist.h" #include "light.h" #include "vtxfmt.h" #include "nvfragprog.h" #include "tnl.h" #include "t_array_api.h" #include "t_context.h" #include "t_pipeline.h" #include "t_save_api.h" #include "t_vp_build.h" #include "t_vtx_api.h" void _tnl_MakeCurrent( GLcontext *ctx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ) { (void) ctx; (void) drawBuffer; (void) readBuffer; } static void install_driver_callbacks( GLcontext *ctx ) { ctx->Driver.NewList = _tnl_NewList; ctx->Driver.EndList = _tnl_EndList; ctx->Driver.FlushVertices = _tnl_FlushVertices; ctx->Driver.SaveFlushVertices = _tnl_SaveFlushVertices; ctx->Driver.MakeCurrent = _tnl_MakeCurrent; ctx->Driver.BeginCallList = _tnl_BeginCallList; ctx->Driver.EndCallList = _tnl_EndCallList; } GLboolean _tnl_CreateContext( GLcontext *ctx ) { TNLcontext *tnl; /* Create the TNLcontext structure */ ctx->swtnl_context = tnl = (TNLcontext *) CALLOC( sizeof(TNLcontext) ); if (!tnl) { return GL_FALSE; } if (getenv("MESA_CODEGEN")) tnl->AllowCodegen = GL_TRUE; /* Initialize the VB. */ tnl->vb.Size = ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES; /* Initialize tnl state and tnl->vtxfmt. */ _tnl_save_init( ctx ); _tnl_array_init( ctx ); _tnl_vtx_init( ctx ); if (ctx->_MaintainTnlProgram) _tnl_install_pipeline( ctx, _tnl_vp_pipeline ); else _tnl_install_pipeline( ctx, _tnl_default_pipeline ); /* Initialize the arrayelt helper */ if (!_ae_create_context( ctx )) return GL_FALSE; tnl->NeedNdcCoords = GL_TRUE; tnl->LoopbackDListCassettes = GL_FALSE; tnl->CalcDListNormalLengths = GL_TRUE; tnl->AllowVertexFog = GL_TRUE; tnl->AllowPixelFog = GL_TRUE; /* Hook our functions into exec and compile dispatch tables. */ _mesa_install_exec_vtxfmt( ctx, &tnl->exec_vtxfmt ); /* Set a few default values in the driver struct. */ install_driver_callbacks(ctx); ctx->Driver.NeedFlush = 0; ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts; tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts; tnl->Driver.NotifyMaterialChange = _mesa_validate_all_lighting_tables; return GL_TRUE; } void _tnl_DestroyContext( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); _tnl_array_destroy( ctx ); _tnl_vtx_destroy( ctx ); _tnl_save_destroy( ctx ); _tnl_destroy_pipeline( ctx ); _ae_destroy_context( ctx ); _tnl_ProgramCacheDestroy( ctx ); FREE(tnl); ctx->swtnl_context = NULL; } void _tnl_InvalidateState( GLcontext *ctx, GLuint new_state ) { TNLcontext *tnl = TNL_CONTEXT(ctx); if (new_state & (_NEW_HINT)) { ASSERT(tnl->AllowVertexFog || tnl->AllowPixelFog); tnl->_DoVertexFog = (tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST)) || !tnl->AllowPixelFog; } _ae_invalidate_state(ctx, new_state); tnl->pipeline.new_state |= new_state; tnl->vtx.eval.new_state |= new_state; /* Calculate tnl->render_inputs: */ if (ctx->Visual.rgbMode) { tnl->render_inputs = (_TNL_BIT_POS| _TNL_BIT_COLOR0| (ctx->Texture._EnabledCoordUnits << _TNL_ATTRIB_TEX0)); if (NEED_SECONDARY_COLOR(ctx)) tnl->render_inputs |= _TNL_BIT_COLOR1; } else { tnl->render_inputs |= (_TNL_BIT_POS|_TNL_BIT_INDEX); } if (ctx->Fog.Enabled || (ctx->FragmentProgram._Active && ctx->FragmentProgram._Current->FogOption != GL_NONE)) tnl->render_inputs |= _TNL_BIT_FOG; if (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) tnl->render_inputs |= _TNL_BIT_EDGEFLAG; if (ctx->RenderMode == GL_FEEDBACK) tnl->render_inputs |= _TNL_BIT_TEX0; if (ctx->Point._Attenuated || (ctx->VertexProgram._Enabled && ctx->VertexProgram.PointSizeEnabled)) tnl->render_inputs |= _TNL_BIT_POINTSIZE; } void _tnl_wakeup_exec( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); install_driver_callbacks(ctx); ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; /* Hook our functions into exec and compile dispatch tables. */ _mesa_install_exec_vtxfmt( ctx, &tnl->exec_vtxfmt ); /* Call all appropriate driver callbacks to revive state. */ _tnl_MakeCurrent( ctx, ctx->DrawBuffer, ctx->ReadBuffer ); /* Assume we haven't been getting state updates either: */ _tnl_InvalidateState( ctx, ~0 ); if (ctx->Light.ColorMaterialEnabled) { _mesa_update_color_material( ctx, ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); } } void _tnl_wakeup_save_exec( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); _tnl_wakeup_exec( ctx ); _mesa_install_save_vtxfmt( ctx, &tnl->save_vtxfmt ); } /** * Drivers call this function to tell the TCL module whether or not * it wants Normalized Device Coords (NDC) computed. I.e. whether * we should "Divide-by-W". Software renders will want that. */ void _tnl_need_projected_coords( GLcontext *ctx, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); if (tnl->NeedNdcCoords != mode) { tnl->NeedNdcCoords = mode; _tnl_InvalidateState( ctx, _NEW_PROJECTION ); } } void _tnl_need_dlist_loopback( GLcontext *ctx, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->LoopbackDListCassettes = mode; } void _tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->CalcDListNormalLengths = mode; } void _tnl_isolate_materials( GLcontext *ctx, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->IsolateMaterials = mode; } void _tnl_allow_vertex_fog( GLcontext *ctx, GLboolean value ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->AllowVertexFog = value; tnl->_DoVertexFog = (tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST)) || !tnl->AllowPixelFog; } void _tnl_allow_pixel_fog( GLcontext *ctx, GLboolean value ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->AllowPixelFog = value; tnl->_DoVertexFog = (tnl->AllowVertexFog && (ctx->Hint.Fog != GL_NICEST)) || !tnl->AllowPixelFog; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_context.h0000644000000000000000000005711413614532424020202 0ustar /* * mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file t_context.h * \brief TnL module datatypes and definitions. * \author Keith Whitwell */ /** * \mainpage The TNL-module * * TNL stands for "transform and lighting", i.e. this module implements * a pipeline that receives as input a buffer of vertices and does all * necessary transformations (rotations, clipping, vertex shader etc.) * and passes then the output to the rasterizer. * * The tnl_pipeline contains the array of all stages, which should be * applied. Each stage is a black-box, which is described by an * tnl_pipeline_stage. The function ::_tnl_run_pipeline applies all the * stages to the vertex_buffer TNLcontext::vb, where the vertex data * is stored. The last stage in the pipeline is the rasterizer. * * The initial vertex_buffer data may either come from an ::immediate * structure or client vertex_arrays or display lists: * * * - The ::immediate structure records all the GL commands issued between * glBegin and glEnd. \n * The structure accumulates data, until it is either full or it is * flushed (usually by a state change). Before starting then the pipeline, * the collected vertex data in ::immediate has to be pushed into * TNLcontext::vb. * This happens in ::_tnl_vb_bind_immediate. The pipeline is then run by * calling tnl_device_driver::RunPipeline = ::_tnl_run_pipeline, which * is stored in TNLcontext::Driver. \n * An ::immediate does (for performance reasons) usually not finish with a * glEnd, and hence it also does not need to start with a glBegin. * This means that the last vertices of one ::immediate may need to be * saved for the next one. * * * - NOT SURE ABOUT THIS: The vertex_arrays structure is used to handle * glDrawArrays etc. \n * Here, the data of the vertex_arrays is copied by ::_tnl_vb_bind_arrays * into TNLcontext::vb, so that the pipeline can be started. */ #ifndef _T_CONTEXT_H #define _T_CONTEXT_H #include "glheader.h" #include "mtypes.h" #include "math/m_matrix.h" #include "math/m_vector.h" #include "math/m_xform.h" #define MAX_PIPELINE_STAGES 30 /* * Note: The first attributes match the VERT_ATTRIB_* definitions * in mtypes.h. However, the tnl module has additional attributes * for materials, color indexes, edge flags, etc. */ /* Although it's nice to use these as bit indexes in a DWORD flag, we * could manage without if necessary. Another limit currently is the * number of bits allocated for these numbers in places like vertex * program instruction formats and register layouts. */ enum { _TNL_ATTRIB_POS = 0, _TNL_ATTRIB_WEIGHT = 1, _TNL_ATTRIB_NORMAL = 2, _TNL_ATTRIB_COLOR0 = 3, _TNL_ATTRIB_COLOR1 = 4, _TNL_ATTRIB_FOG = 5, _TNL_ATTRIB_SIX = 6, _TNL_ATTRIB_SEVEN = 7, _TNL_ATTRIB_TEX0 = 8, _TNL_ATTRIB_TEX1 = 9, _TNL_ATTRIB_TEX2 = 10, _TNL_ATTRIB_TEX3 = 11, _TNL_ATTRIB_TEX4 = 12, _TNL_ATTRIB_TEX5 = 13, _TNL_ATTRIB_TEX6 = 14, _TNL_ATTRIB_TEX7 = 15, _TNL_ATTRIB_MAT_FRONT_AMBIENT = 16, _TNL_ATTRIB_MAT_BACK_AMBIENT = 17, _TNL_ATTRIB_MAT_FRONT_DIFFUSE = 18, _TNL_ATTRIB_MAT_BACK_DIFFUSE = 19, _TNL_ATTRIB_MAT_FRONT_SPECULAR = 20, _TNL_ATTRIB_MAT_BACK_SPECULAR = 21, _TNL_ATTRIB_MAT_FRONT_EMISSION = 22, _TNL_ATTRIB_MAT_BACK_EMISSION = 23, _TNL_ATTRIB_MAT_FRONT_SHININESS = 24, _TNL_ATTRIB_MAT_BACK_SHININESS = 25, _TNL_ATTRIB_MAT_FRONT_INDEXES = 26, _TNL_ATTRIB_MAT_BACK_INDEXES = 27, _TNL_ATTRIB_INDEX = 28, _TNL_ATTRIB_EDGEFLAG = 29, _TNL_ATTRIB_POINTSIZE = 30, _TNL_ATTRIB_MAX = 31 } ; /* Will probably have to revise this scheme fairly shortly, eg. by * compacting all the MAT flags down to one bit, or by using two * dwords to store the flags. */ #define _TNL_BIT_POS (1<<0) #define _TNL_BIT_WEIGHT (1<<1) #define _TNL_BIT_NORMAL (1<<2) #define _TNL_BIT_COLOR0 (1<<3) #define _TNL_BIT_COLOR1 (1<<4) #define _TNL_BIT_FOG (1<<5) #define _TNL_BIT_SIX (1<<6) #define _TNL_BIT_SEVEN (1<<7) #define _TNL_BIT_TEX0 (1<<8) #define _TNL_BIT_TEX1 (1<<9) #define _TNL_BIT_TEX2 (1<<10) #define _TNL_BIT_TEX3 (1<<11) #define _TNL_BIT_TEX4 (1<<12) #define _TNL_BIT_TEX5 (1<<13) #define _TNL_BIT_TEX6 (1<<14) #define _TNL_BIT_TEX7 (1<<15) #define _TNL_BIT_MAT_FRONT_AMBIENT (1<<16) #define _TNL_BIT_MAT_BACK_AMBIENT (1<<17) #define _TNL_BIT_MAT_FRONT_DIFFUSE (1<<18) #define _TNL_BIT_MAT_BACK_DIFFUSE (1<<19) #define _TNL_BIT_MAT_FRONT_SPECULAR (1<<20) #define _TNL_BIT_MAT_BACK_SPECULAR (1<<21) #define _TNL_BIT_MAT_FRONT_EMISSION (1<<22) #define _TNL_BIT_MAT_BACK_EMISSION (1<<23) #define _TNL_BIT_MAT_FRONT_SHININESS (1<<24) #define _TNL_BIT_MAT_BACK_SHININESS (1<<25) #define _TNL_BIT_MAT_FRONT_INDEXES (1<<26) #define _TNL_BIT_MAT_BACK_INDEXES (1<<27) #define _TNL_BIT_INDEX (1<<28) #define _TNL_BIT_EDGEFLAG (1<<29) #define _TNL_BIT_POINTSIZE (1<<30) #define _TNL_BIT_TEX(u) (1 << (_TNL_ATTRIB_TEX0 + (u))) #define _TNL_BITS_MAT_ANY (_TNL_BIT_MAT_FRONT_AMBIENT | \ _TNL_BIT_MAT_BACK_AMBIENT | \ _TNL_BIT_MAT_FRONT_DIFFUSE | \ _TNL_BIT_MAT_BACK_DIFFUSE | \ _TNL_BIT_MAT_FRONT_SPECULAR | \ _TNL_BIT_MAT_BACK_SPECULAR | \ _TNL_BIT_MAT_FRONT_EMISSION | \ _TNL_BIT_MAT_BACK_EMISSION | \ _TNL_BIT_MAT_FRONT_SHININESS | \ _TNL_BIT_MAT_BACK_SHININESS | \ _TNL_BIT_MAT_FRONT_INDEXES | \ _TNL_BIT_MAT_BACK_INDEXES) #define _TNL_BITS_TEX_ANY (_TNL_BIT_TEX0 | \ _TNL_BIT_TEX1 | \ _TNL_BIT_TEX2 | \ _TNL_BIT_TEX3 | \ _TNL_BIT_TEX4 | \ _TNL_BIT_TEX5 | \ _TNL_BIT_TEX6 | \ _TNL_BIT_TEX7) #define _TNL_BITS_PROG_ANY (_TNL_BIT_POS | \ _TNL_BIT_WEIGHT | \ _TNL_BIT_NORMAL | \ _TNL_BIT_COLOR0 | \ _TNL_BIT_COLOR1 | \ _TNL_BIT_FOG | \ _TNL_BIT_SIX | \ _TNL_BIT_SEVEN | \ _TNL_BITS_TEX_ANY) #define PRIM_BEGIN 0x10 #define PRIM_END 0x20 #define PRIM_WEAK 0x40 #define PRIM_MODE_MASK 0x0f /* */ struct tnl_prim { GLuint mode; GLuint start; GLuint count; }; struct tnl_eval1_map { struct gl_1d_map *map; GLuint sz; }; struct tnl_eval2_map { struct gl_2d_map *map; GLuint sz; }; struct tnl_eval { GLuint new_state; struct tnl_eval1_map map1[_TNL_ATTRIB_INDEX + 1]; struct tnl_eval2_map map2[_TNL_ATTRIB_INDEX + 1]; }; #define TNL_MAX_PRIM 16 #define TNL_MAX_COPIED_VERTS 3 struct tnl_copied_vtx { GLfloat buffer[_TNL_ATTRIB_MAX * 4 * TNL_MAX_COPIED_VERTS]; GLuint nr; }; #define VERT_BUFFER_SIZE 2048 /* 8kbytes */ typedef void (*tnl_attrfv_func)( const GLfloat * ); struct _tnl_dynfn { struct _tnl_dynfn *next, *prev; GLuint key; char *code; }; struct _tnl_dynfn_lists { struct _tnl_dynfn Vertex[4]; struct _tnl_dynfn Attribute[4]; }; struct _tnl_dynfn_generators { struct _tnl_dynfn *(*Vertex[4])( GLcontext *ctx, int key ); struct _tnl_dynfn *(*Attribute[4])( GLcontext *ctx, int key ); }; #define _TNL_MAX_ATTR_CODEGEN 16 /* The assembly of vertices in immediate mode is separated from * display list compilation. This allows a simpler immediate mode * treatment and a display list compiler better suited to * hardware-acceleration. */ struct tnl_vtx { GLfloat buffer[VERT_BUFFER_SIZE]; GLubyte attrsz[_TNL_ATTRIB_MAX]; GLuint vertex_size; struct tnl_prim prim[TNL_MAX_PRIM]; GLuint prim_count; GLfloat *vbptr; /* cursor, points into buffer */ GLfloat vertex[_TNL_ATTRIB_MAX*4]; /* current vertex */ GLfloat *attrptr[_TNL_ATTRIB_MAX]; /* points into vertex */ GLfloat *current[_TNL_ATTRIB_MAX]; /* points into ctx->Current, etc */ GLfloat CurrentFloatEdgeFlag; GLuint counter, initial_counter; struct tnl_copied_vtx copied; tnl_attrfv_func tabfv[_TNL_MAX_ATTR_CODEGEN+1][4]; /* plus 1 for ERROR_ATTRIB */ struct _tnl_dynfn_lists cache; struct _tnl_dynfn_generators gen; struct tnl_eval eval; GLboolean *edgeflag_tmp; GLboolean have_materials; }; /* For display lists, this structure holds a run of vertices of the * same format, and a strictly well-formed set of begin/end pairs, * starting on the first vertex and ending at the last. Vertex * copying on buffer breaks is precomputed according to these * primitives, though there are situations where the copying will need * correction at execute-time, perhaps by replaying the list as * immediate mode commands. * * On executing this list, the 'current' values may be updated with * the values of the final vertex, and often no fixup of the start of * the vertex list is required. * * Eval and other commands that don't fit into these vertex lists are * compiled using the fallback opcode mechanism provided by dlist.c. */ struct tnl_vertex_list { GLubyte attrsz[_TNL_ATTRIB_MAX]; GLuint vertex_size; GLfloat *buffer; GLuint count; GLuint wrap_count; /* number of copied vertices at start */ GLboolean have_materials; /* bit of a hack - quick check for materials */ GLboolean dangling_attr_ref; /* current attr implicitly referenced outside the list */ GLfloat *normal_lengths; struct tnl_prim *prim; GLuint prim_count; struct tnl_vertex_store *vertex_store; struct tnl_primitive_store *prim_store; }; /* These buffers should be a reasonable size to support upload to * hardware? Maybe drivers should stitch them back together, or * specify a desired size? */ #define SAVE_BUFFER_SIZE (16*1024) #define SAVE_PRIM_SIZE 128 /* Storage to be shared among several vertex_lists. */ struct tnl_vertex_store { GLfloat buffer[SAVE_BUFFER_SIZE]; GLuint used; GLuint refcount; }; struct tnl_primitive_store { struct tnl_prim buffer[SAVE_PRIM_SIZE]; GLuint used; GLuint refcount; }; struct tnl_save { GLubyte attrsz[_TNL_ATTRIB_MAX]; GLuint vertex_size; GLfloat *buffer; GLuint count; GLuint wrap_count; GLuint replay_flags; struct tnl_prim *prim; GLuint prim_count, prim_max; struct tnl_vertex_store *vertex_store; struct tnl_primitive_store *prim_store; GLfloat *vbptr; /* cursor, points into buffer */ GLfloat vertex[_TNL_ATTRIB_MAX*4]; /* current values */ GLfloat *attrptr[_TNL_ATTRIB_MAX]; GLuint counter, initial_counter; GLboolean dangling_attr_ref; GLboolean have_materials; GLuint opcode_vertex_list; struct tnl_copied_vtx copied; GLfloat CurrentFloatEdgeFlag; GLfloat *current[_TNL_ATTRIB_MAX]; /* points into ctx->ListState */ GLubyte *currentsz[_TNL_ATTRIB_MAX]; void (*tabfv[_TNL_ATTRIB_MAX][4])( const GLfloat * ); }; struct tnl_vertex_arrays { /* Conventional vertex attribute arrays */ GLvector4f Obj; GLvector4f Normal; GLvector4f Color; GLvector4f SecondaryColor; GLvector4f FogCoord; GLvector4f TexCoord[MAX_TEXTURE_COORD_UNITS]; GLvector4f Index; GLubyte *EdgeFlag; GLuint *Elt; /* These attributes don't alias with the conventional attributes. * The GL_NV_vertex_program extension defines 16 extra sets of vertex * arrays which have precedent over the conventional arrays when enabled. */ GLvector4f Attribs[_TNL_ATTRIB_MAX]; }; /** * Contains the current state of a running pipeline. */ struct vertex_buffer { /* Constant over life of the vertex_buffer. */ GLuint Size; /* Constant over the pipeline. */ GLuint Count; /* for everything except Elts */ /* Pointers to current data. */ GLuint *Elts; GLvector4f *ObjPtr; /* _TNL_BIT_POS */ GLvector4f *EyePtr; /* _TNL_BIT_POS */ GLvector4f *ClipPtr; /* _TNL_BIT_POS */ GLvector4f *NdcPtr; /* _TNL_BIT_POS */ GLubyte ClipOrMask; /* _TNL_BIT_POS */ GLubyte ClipAndMask; /* _TNL_BIT_POS */ GLubyte *ClipMask; /* _TNL_BIT_POS */ GLvector4f *NormalPtr; /* _TNL_BIT_NORMAL */ GLfloat *NormalLengthPtr; /* _TNL_BIT_NORMAL */ GLboolean *EdgeFlag; /* _TNL_BIT_EDGEFLAG */ GLvector4f *TexCoordPtr[MAX_TEXTURE_COORD_UNITS]; /* VERT_TEX_0..n */ GLvector4f *IndexPtr[2]; /* _TNL_BIT_INDEX */ GLvector4f *ColorPtr[2]; /* _TNL_BIT_COLOR0 */ GLvector4f *SecondaryColorPtr[2]; /* _TNL_BIT_COLOR1 */ GLvector4f *PointSizePtr; /* _TNL_BIT_POS */ GLvector4f *FogCoordPtr; /* _TNL_BIT_FOG */ struct tnl_prim *Primitive; GLuint PrimitiveCount; /* Inputs to the vertex program stage */ GLvector4f *AttribPtr[_TNL_ATTRIB_MAX]; /* GL_NV_vertex_program */ GLuint LastClipped; /* Private data from _tnl_render_stage that has no business being * in this struct. */ }; /** Describes an individual operation on the pipeline. */ struct tnl_pipeline_stage { const char *name; /* Private data for the pipeline stage: */ void *privatePtr; /* Allocate private data */ GLboolean (*create)( GLcontext *ctx, struct tnl_pipeline_stage * ); /* Free private data. */ void (*destroy)( struct tnl_pipeline_stage * ); /* Called on any statechange or input array size change or * input array change to/from zero stride. */ void (*validate)( GLcontext *ctx, struct tnl_pipeline_stage * ); /* Called from _tnl_run_pipeline(). The stage.changed_inputs value * encodes all inputs to thee struct which have changed. If * non-zero, recompute all affected outputs of the stage, otherwise * execute any 'sideeffects' of the stage. * * Return value: GL_TRUE - keep going * GL_FALSE - finished pipeline */ GLboolean (*run)( GLcontext *ctx, struct tnl_pipeline_stage * ); }; /** Contains the array of all pipeline stages. * The default values are defined at the end of t_pipeline.c */ struct tnl_pipeline { GLuint last_attrib_stride[_TNL_ATTRIB_MAX]; GLuint last_attrib_size[_TNL_ATTRIB_MAX]; GLuint input_changes; GLuint new_state; struct tnl_pipeline_stage stages[MAX_PIPELINE_STAGES+1]; GLuint nr_stages; }; struct tnl_clipspace; struct tnl_clipspace_attr; typedef void (*tnl_extract_func)( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ); typedef void (*tnl_insert_func)( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ); typedef void (*tnl_emit_func)( GLcontext *ctx, GLuint count, GLubyte *dest ); /** * Describes how to convert/move a vertex attribute from a vertex array * to a vertex structure. */ struct tnl_clipspace_attr { GLuint attrib; /* which vertex attrib (0=position, etc) */ GLuint format; GLuint vertoffset; /* position of the attrib in the vertex struct */ GLuint vertattrsize; /* size of the attribute in bytes */ GLubyte *inputptr; GLuint inputstride; GLuint inputsize; const tnl_insert_func *insert; tnl_insert_func emit; tnl_extract_func extract; const GLfloat *vp; /* NDC->Viewport mapping matrix */ }; typedef void (*tnl_points_func)( GLcontext *ctx, GLuint first, GLuint last ); typedef void (*tnl_line_func)( GLcontext *ctx, GLuint v1, GLuint v2 ); typedef void (*tnl_triangle_func)( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3 ); typedef void (*tnl_quad_func)( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4 ); typedef void (*tnl_render_func)( GLcontext *ctx, GLuint start, GLuint count, GLuint flags ); typedef void (*tnl_interp_func)( GLcontext *ctx, GLfloat t, GLuint dst, GLuint out, GLuint in, GLboolean force_boundary ); typedef void (*tnl_copy_pv_func)( GLcontext *ctx, GLuint dst, GLuint src ); typedef void (*tnl_setup_func)( GLcontext *ctx, GLuint start, GLuint end, GLuint new_inputs); struct tnl_clipspace_fastpath { GLuint vertex_size; GLuint attr_count; GLboolean match_strides; struct { GLuint format; GLuint size; GLuint stride; GLuint offset; } *attr; tnl_emit_func func; struct tnl_clipspace_fastpath *next; }; /** * Used to describe conversion of vertex arrays to vertex structures. * I.e. Structure of arrays to arrays of structs. */ struct tnl_clipspace { GLboolean need_extras; GLuint new_inputs; GLubyte *vertex_buf; GLuint vertex_size; GLuint max_vertex_size; struct tnl_clipspace_attr attr[_TNL_ATTRIB_MAX]; GLuint attr_count; tnl_emit_func emit; tnl_interp_func interp; tnl_copy_pv_func copy_pv; /* Parameters and constants for codegen: */ GLboolean need_viewport; GLfloat vp_scale[4]; GLfloat vp_xlate[4]; GLfloat chan_scale[4]; GLfloat identity[4]; struct tnl_clipspace_fastpath *fastpath; void (*codegen_emit)( GLcontext *ctx ); }; struct tnl_cache { GLuint hash; void *key; void *data; struct tnl_cache *next; }; struct tnl_device_driver { /*** *** TNL Pipeline ***/ void (*RunPipeline)(GLcontext *ctx); /* Replaces PipelineStart/PipelineFinish -- intended to allow * drivers to wrap _tnl_run_pipeline() with code to validate state * and grab/release hardware locks. */ void (*NotifyMaterialChange)(GLcontext *ctx); /* Alert tnl-aware drivers of changes to material. */ GLboolean (*NotifyBegin)(GLcontext *ctx, GLenum p); /* Allow drivers to hook in optimized begin/end engines. * Return value: GL_TRUE - driver handled the begin * GL_FALSE - driver didn't handle the begin */ /*** *** Rendering -- These functions called only from t_vb_render.c ***/ struct { void (*Start)(GLcontext *ctx); void (*Finish)(GLcontext *ctx); /* Called before and after all rendering operations, including DrawPixels, * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands. * These are a suitable place for grabbing/releasing hardware locks. */ void (*PrimitiveNotify)(GLcontext *ctx, GLenum mode); /* Called between RenderStart() and RenderFinish() to indicate the * type of primitive we're about to draw. Mode will be one of the * modes accepted by glBegin(). */ tnl_interp_func Interp; /* The interp function is called by the clipping routines when we need * to generate an interpolated vertex. All pertinant vertex ancilliary * data should be computed by interpolating between the 'in' and 'out' * vertices. */ tnl_copy_pv_func CopyPV; /* The copy function is used to make a copy of a vertex. All pertinant * vertex attributes should be copied. */ void (*ClippedPolygon)( GLcontext *ctx, const GLuint *elts, GLuint n ); /* Render a polygon with vertices whose indexes are in the * array. */ void (*ClippedLine)( GLcontext *ctx, GLuint v0, GLuint v1 ); /* Render a line between the two vertices given by indexes v0 and v1. */ tnl_points_func Points; /* must now respect vb->elts */ tnl_line_func Line; tnl_triangle_func Triangle; tnl_quad_func Quad; /* These functions are called in order to render points, lines, * triangles and quads. These are only called via the T&L module. */ tnl_render_func *PrimTabVerts; tnl_render_func *PrimTabElts; /* Render whole unclipped primitives (points, lines, linestrips, * lineloops, etc). The tables are indexed by the GL enum of the * primitive to be rendered. RenderTabVerts is used for non-indexed * arrays of vertices. RenderTabElts is used for indexed arrays of * vertices. */ void (*ResetLineStipple)( GLcontext *ctx ); /* Reset the hardware's line stipple counter. */ tnl_setup_func BuildVertices; /* This function is called whenever new vertices are required for * rendering. The vertices in question are those n such that start * <= n < end. The new_inputs parameter indicates those fields of * the vertex which need to be updated, if only a partial repair of * the vertex is required. * * This function is called only from _tnl_render_stage in tnl/t_render.c. */ GLboolean (*Multipass)( GLcontext *ctx, GLuint passno ); /* Driver may request additional render passes by returning GL_TRUE * when this function is called. This function will be called * after the first pass, and passes will be made until the function * returns GL_FALSE. If no function is registered, only one pass * is made. * * This function will be first invoked with passno == 1. */ } Render; }; /** * Context state for T&L context. */ typedef struct { /* Driver interface. */ struct tnl_device_driver Driver; /* Execute: */ struct tnl_vtx vtx; /* Compile: */ struct tnl_save save; /* Pipeline */ struct tnl_pipeline pipeline; struct vertex_buffer vb; /* GLvectors for binding to vb: */ struct tnl_vertex_arrays vtx_inputs; struct tnl_vertex_arrays save_inputs; struct tnl_vertex_arrays current; struct tnl_vertex_arrays array_inputs; /* Clipspace/ndc/window vertex managment: */ struct tnl_clipspace clipspace; /* Probably need a better configuration mechanism: */ GLboolean NeedNdcCoords; GLboolean LoopbackDListCassettes; GLboolean CalcDListNormalLengths; GLboolean IsolateMaterials; GLboolean AllowVertexFog; GLboolean AllowPixelFog; GLboolean AllowCodegen; GLboolean _DoVertexFog; /* eval fog function at each vertex? */ /* If True, it means we started a glBegin/End primtive with an invalid * vertex/fragment program or incomplete framebuffer. In that case, * discard any buffered vertex data. */ GLboolean DiscardPrimitive; GLuint render_inputs; GLvertexformat exec_vtxfmt; GLvertexformat save_vtxfmt; struct tnl_cache *vp_cache; } TNLcontext; #define TNL_CONTEXT(ctx) ((TNLcontext *)((ctx)->swtnl_context)) #define TYPE_IDX(t) ((t) & 0xf) #define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */ extern void _tnl_MakeCurrent( GLcontext *ctx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/tnl.h0000644000000000000000000000474513614532424016772 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #ifndef _TNL_H #define _TNL_H #include "mtypes.h" /* These are the public-access functions exported from tnl. (A few * more are currently hooked into dispatch directly by the module * itself.) */ extern GLboolean _tnl_CreateContext( GLcontext *ctx ); extern void _tnl_DestroyContext( GLcontext *ctx ); extern void _tnl_InvalidateState( GLcontext *ctx, GLuint new_state ); /* Functions to revive the tnl module after being unhooked from * dispatch and/or driver callbacks. */ /* Restore just the ctx->Exec table: */ extern void _tnl_wakeup_exec( GLcontext *ctx ); /* Restore both ctx->Exec and ctx->Save: */ extern void _tnl_wakeup_save_exec( GLcontext *ctx ); /* Driver configuration options: */ extern void _tnl_need_projected_coords( GLcontext *ctx, GLboolean flag ); extern void _tnl_need_dlist_loopback( GLcontext *ctx, GLboolean flag ); extern void _tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean flag ); extern void _tnl_isolate_materials( GLcontext *ctx, GLboolean flag ); /* Control whether T&L does per-vertex fog */ extern void _tnl_allow_vertex_fog( GLcontext *ctx, GLboolean value ); extern void _tnl_allow_pixel_fog( GLcontext *ctx, GLboolean value ); extern void _tnl_program_string(GLcontext *ctx, GLenum target, struct program *program); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_pipeline.c0000644000000000000000000001515513614532424020315 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "context.h" #include "imports.h" #include "state.h" #include "mtypes.h" #include "math/m_translate.h" #include "math/m_xform.h" #include "t_context.h" #include "t_pipeline.h" #include "t_vp_build.h" #include "t_vertex.h" void _tnl_install_pipeline( GLcontext *ctx, const struct tnl_pipeline_stage **stages ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; tnl->pipeline.new_state = ~0; /* Create a writeable copy of each stage. */ for (i = 0 ; i < MAX_PIPELINE_STAGES && stages[i] ; i++) { struct tnl_pipeline_stage *s = &tnl->pipeline.stages[i]; MEMCPY(s, stages[i], sizeof(*s)); if (s->create) s->create(ctx, s); } tnl->pipeline.nr_stages = i; } void _tnl_destroy_pipeline( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; for (i = 0 ; i < tnl->pipeline.nr_stages ; i++) { struct tnl_pipeline_stage *s = &tnl->pipeline.stages[i]; if (s->destroy) s->destroy(s); } tnl->pipeline.nr_stages = 0; } static GLuint check_input_changes( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; for (i = 0; i < _TNL_ATTRIB_EDGEFLAG; i++) { if (tnl->vb.AttribPtr[i]->size != tnl->pipeline.last_attrib_size[i] || tnl->vb.AttribPtr[i]->stride != tnl->pipeline.last_attrib_stride[i]) { tnl->pipeline.last_attrib_size[i] = tnl->vb.AttribPtr[i]->size; tnl->pipeline.last_attrib_stride[i] = tnl->vb.AttribPtr[i]->stride; tnl->pipeline.input_changes |= 1<pipeline.input_changes; } static GLuint check_output_changes( GLcontext *ctx ) { #if 0 TNLcontext *tnl = TNL_CONTEXT(ctx); for (i = 0; i < VERT_RESULT_MAX; i++) { if (tnl->vb.ResultPtr[i]->size != tnl->last_result_size[i] || tnl->vb.ResultPtr[i]->stride != tnl->last_result_stride[i]) { tnl->last_result_size[i] = tnl->vb.ResultPtr[i]->size; tnl->last_result_stride[i] = tnl->vb.ResultPtr[i]->stride; tnl->pipeline.output_changes |= 1<pipeline.output_changes) tnl->Driver.NotifyOutputChanges( ctx, tnl->pipeline.output_changes ); return tnl->pipeline.output_changes; #else return ~0; #endif } void _tnl_run_pipeline( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); unsigned short __tmp; GLuint i; if (!tnl->vb.Count) return; /* Check for changed input sizes or change in stride to/from zero * (ie const or non-const). */ if (check_input_changes( ctx ) || tnl->pipeline.new_state) { if (ctx->_MaintainTnlProgram) _tnl_UpdateFixedFunctionProgram( ctx ); for (i = 0; i < tnl->pipeline.nr_stages ; i++) { struct tnl_pipeline_stage *s = &tnl->pipeline.stages[i]; if (s->validate) s->validate( ctx, s ); } tnl->pipeline.new_state = 0; tnl->pipeline.input_changes = 0; /* Pipeline can only change its output in response to either a * statechange or an input size/stride change. No other changes * are allowed. */ if (check_output_changes( ctx )) _tnl_notify_pipeline_output_change( ctx ); } START_FAST_MATH(__tmp); for (i = 0; i < tnl->pipeline.nr_stages ; i++) { struct tnl_pipeline_stage *s = &tnl->pipeline.stages[i]; if (!s->run( ctx, s )) break; } END_FAST_MATH(__tmp); } /* The default pipeline. This is useful for software rasterizers, and * simple hardware rasterizers. For customization, I don't recommend * tampering with the internals of these stages in the way that * drivers did in Mesa 3.4. These stages are basically black boxes, * and should be left intact. * * To customize the pipeline, consider: * * - removing redundant stages (making sure that the software rasterizer * can cope with this on fallback paths). An example is fog * coordinate generation, which is not required in the FX driver. * * - replacing general-purpose machine-independent stages with * general-purpose machine-specific stages. There is no example of * this to date, though it must be borne in mind that all subsequent * stages that reference the output of the new stage must cope with * any machine-specific data introduced. This may not be easy * unless there are no such stages (ie the new stage is the last in * the pipe). * * - inserting optimized (but specialized) stages ahead of the * general-purpose fallback implementation. For example, the old * fastpath mechanism, which only works when the VB->Elts input is * available, can be duplicated by placing the fastpath stage at the * head of this pipeline. Such specialized stages are currently * constrained to have no outputs (ie. they must either finish the * * pipeline by returning GL_FALSE from run(), or do nothing). * * Some work can be done to lift some of the restrictions in the final * case, if it becomes necessary to do so. */ const struct tnl_pipeline_stage *_tnl_default_pipeline[] = { &_tnl_vertex_transform_stage, &_tnl_normal_transform_stage, &_tnl_lighting_stage, &_tnl_fog_coordinate_stage, &_tnl_texgen_stage, &_tnl_texture_transform_stage, &_tnl_point_attenuation_stage, #if defined(FEATURE_NV_vertex_program) || defined(FEATURE_ARB_vertex_program) &_tnl_arb_vertex_program_stage, &_tnl_vertex_program_stage, #endif &_tnl_render_stage, NULL }; const struct tnl_pipeline_stage *_tnl_vp_pipeline[] = { &_tnl_arb_vertex_program_stage, &_tnl_render_stage, NULL }; nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_pipeline.h0000644000000000000000000000540213614532424020314 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #ifndef _T_PIPELINE_H_ #define _T_PIPELINE_H_ #include "mtypes.h" #include "t_context.h" extern void _tnl_run_pipeline( GLcontext *ctx ); extern void _tnl_destroy_pipeline( GLcontext *ctx ); extern void _tnl_install_pipeline( GLcontext *ctx, const struct tnl_pipeline_stage **stages ); /* These are implemented in the t_vb_*.c files: */ extern const struct tnl_pipeline_stage _tnl_vertex_transform_stage; extern const struct tnl_pipeline_stage _tnl_vertex_cull_stage; extern const struct tnl_pipeline_stage _tnl_normal_transform_stage; extern const struct tnl_pipeline_stage _tnl_lighting_stage; extern const struct tnl_pipeline_stage _tnl_fog_coordinate_stage; extern const struct tnl_pipeline_stage _tnl_texgen_stage; extern const struct tnl_pipeline_stage _tnl_texture_transform_stage; extern const struct tnl_pipeline_stage _tnl_point_attenuation_stage; extern const struct tnl_pipeline_stage _tnl_arb_vertex_program_stage; extern const struct tnl_pipeline_stage _tnl_vertex_program_stage; extern const struct tnl_pipeline_stage _tnl_render_stage; /* Shorthand to plug in the default pipeline: */ extern const struct tnl_pipeline_stage *_tnl_default_pipeline[]; extern const struct tnl_pipeline_stage *_tnl_vp_pipeline[]; /* Convenience routines provided by t_vb_render.c: */ extern tnl_render_func _tnl_render_tab_elts[]; extern tnl_render_func _tnl_render_tab_verts[]; extern void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ); extern void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_save_api.c0000644000000000000000000013610013614532424020271 0ustar /* $XFree86$ */ /************************************************************************** Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation on the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Keith Whitwell */ /* Display list compiler attempts to store lists of vertices with the * same vertex layout. Additionally it attempts to minimize the need * for execute-time fixup of these vertex lists, allowing them to be * cached on hardware. * * There are still some circumstances where this can be thwarted, for * example by building a list that consists of one very long primitive * (eg Begin(Triangles), 1000 vertices, End), and calling that list * from inside a different begin/end object (Begin(Lines), CallList, * End). * * In that case the code will have to replay the list as individual * commands through the Exec dispatch table, or fix up the copied * vertices at execute-time. * * The other case where fixup is required is when a vertex attribute * is introduced in the middle of a primitive. Eg: * Begin(Lines) * TexCoord1f() Vertex2f() * TexCoord1f() Color3f() Vertex2f() * End() * * If the current value of Color isn't known at compile-time, this * primitive will require fixup. * * * The list compiler currently doesn't attempt to compile lists * containing EvalCoord or EvalPoint commands. On encountering one of * these, compilation falls back to opcodes. * * This could be improved to fallback only when a mix of EvalCoord and * Vertex commands are issued within a single primitive. */ #include "glheader.h" #include "context.h" #include "dlist.h" #include "enums.h" #include "macros.h" #include "api_validate.h" #include "api_arrayelt.h" #include "vtxfmt.h" #include "t_save_api.h" #include "dispatch.h" /* * NOTE: Old 'parity' issue is gone, but copying can still be * wrong-footed on replay. */ static GLuint _save_copy_vertices( GLcontext *ctx, const struct tnl_vertex_list *node ) { TNLcontext *tnl = TNL_CONTEXT( ctx ); const struct tnl_prim *prim = &node->prim[node->prim_count-1]; GLuint nr = prim->count; GLuint sz = tnl->save.vertex_size; const GLfloat *src = node->buffer + prim->start * sz; GLfloat *dst = tnl->save.copied.buffer; GLuint ovf, i; if (prim->mode & PRIM_END) return 0; switch( prim->mode & PRIM_MODE_MASK ) { case GL_POINTS: return 0; case GL_LINES: ovf = nr&1; for (i = 0 ; i < ovf ; i++) _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); return i; case GL_TRIANGLES: ovf = nr%3; for (i = 0 ; i < ovf ; i++) _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); return i; case GL_QUADS: ovf = nr&3; for (i = 0 ; i < ovf ; i++) _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); return i; case GL_LINE_STRIP: if (nr == 0) return 0; else { _mesa_memcpy( dst, src+(nr-1)*sz, sz*sizeof(GLfloat) ); return 1; } case GL_LINE_LOOP: case GL_TRIANGLE_FAN: case GL_POLYGON: if (nr == 0) return 0; else if (nr == 1) { _mesa_memcpy( dst, src+0, sz*sizeof(GLfloat) ); return 1; } else { _mesa_memcpy( dst, src+0, sz*sizeof(GLfloat) ); _mesa_memcpy( dst+sz, src+(nr-1)*sz, sz*sizeof(GLfloat) ); return 2; } case GL_TRIANGLE_STRIP: case GL_QUAD_STRIP: switch (nr) { case 0: ovf = 0; break; case 1: ovf = 1; break; default: ovf = 2 + (nr&1); break; } for (i = 0 ; i < ovf ; i++) _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); return i; default: assert(0); return 0; } } static void build_normal_lengths( struct tnl_vertex_list *node ) { GLuint i; GLfloat *len; GLfloat *n = node->buffer; GLuint stride = node->vertex_size; GLuint count = node->count; len = node->normal_lengths = (GLfloat *) MALLOC( count * sizeof(GLfloat) ); if (!len) return; /* Find the normal of the first vertex: */ for (i = 0 ; i < _TNL_ATTRIB_NORMAL ; i++) n += node->attrsz[i]; for (i = 0 ; i < count ; i++, n += stride) { len[i] = LEN_3FV( n ); if (len[i] > 0.0F) len[i] = 1.0F / len[i]; } } static struct tnl_vertex_store *alloc_vertex_store( GLcontext *ctx ) { struct tnl_vertex_store *store = MALLOC_STRUCT(tnl_vertex_store); (void) ctx; store->used = 0; store->refcount = 1; return store; } static struct tnl_primitive_store *alloc_prim_store( GLcontext *ctx ) { struct tnl_primitive_store *store = MALLOC_STRUCT(tnl_primitive_store); (void) ctx; store->used = 0; store->refcount = 1; return store; } static void _save_reset_counters( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->save.prim = tnl->save.prim_store->buffer + tnl->save.prim_store->used; tnl->save.buffer = (tnl->save.vertex_store->buffer + tnl->save.vertex_store->used); if (tnl->save.vertex_size) tnl->save.initial_counter = ((SAVE_BUFFER_SIZE - tnl->save.vertex_store->used) / tnl->save.vertex_size); else tnl->save.initial_counter = 0; if (tnl->save.initial_counter > ctx->Const.MaxArrayLockSize ) tnl->save.initial_counter = ctx->Const.MaxArrayLockSize; tnl->save.counter = tnl->save.initial_counter; tnl->save.prim_count = 0; tnl->save.prim_max = SAVE_PRIM_SIZE - tnl->save.prim_store->used; tnl->save.copied.nr = 0; tnl->save.dangling_attr_ref = 0; } /* Insert the active immediate struct onto the display list currently * being built. */ static void _save_compile_vertex_list( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct tnl_vertex_list *node; /* Allocate space for this structure in the display list currently * being compiled. */ node = (struct tnl_vertex_list *) _mesa_alloc_instruction(ctx, tnl->save.opcode_vertex_list, sizeof(*node)); if (!node) return; /* Duplicate our template, increment refcounts to the storage structs: */ _mesa_memcpy(node->attrsz, tnl->save.attrsz, sizeof(node->attrsz)); node->vertex_size = tnl->save.vertex_size; node->buffer = tnl->save.buffer; node->count = tnl->save.initial_counter - tnl->save.counter; node->wrap_count = tnl->save.copied.nr; node->have_materials = tnl->save.have_materials; node->dangling_attr_ref = tnl->save.dangling_attr_ref; node->normal_lengths = NULL; node->prim = tnl->save.prim; node->prim_count = tnl->save.prim_count; node->vertex_store = tnl->save.vertex_store; node->prim_store = tnl->save.prim_store; node->vertex_store->refcount++; node->prim_store->refcount++; assert(node->attrsz[_TNL_ATTRIB_POS] != 0 || node->count == 0); if (tnl->save.dangling_attr_ref) ctx->ListState.CurrentList->flags |= MESA_DLIST_DANGLING_REFS; /* Maybe calculate normal lengths: */ if (tnl->CalcDListNormalLengths && node->attrsz[_TNL_ATTRIB_NORMAL] == 3 && !(ctx->ListState.CurrentList->flags & MESA_DLIST_DANGLING_REFS)) build_normal_lengths( node ); tnl->save.vertex_store->used += tnl->save.vertex_size * node->count; tnl->save.prim_store->used += node->prim_count; /* Decide whether the storage structs are full, or can be used for * the next vertex lists as well. */ if (tnl->save.vertex_store->used > SAVE_BUFFER_SIZE - 16 * (tnl->save.vertex_size + 4)) { tnl->save.vertex_store->refcount--; assert(tnl->save.vertex_store->refcount != 0); tnl->save.vertex_store = alloc_vertex_store( ctx ); tnl->save.vbptr = tnl->save.vertex_store->buffer; } if (tnl->save.prim_store->used > SAVE_PRIM_SIZE - 6) { tnl->save.prim_store->refcount--; assert(tnl->save.prim_store->refcount != 0); tnl->save.prim_store = alloc_prim_store( ctx ); } /* Reset our structures for the next run of vertices: */ _save_reset_counters( ctx ); /* Copy duplicated vertices */ tnl->save.copied.nr = _save_copy_vertices( ctx, node ); /* Deal with GL_COMPILE_AND_EXECUTE: */ if (ctx->ExecuteFlag) { _tnl_playback_vertex_list( ctx, (void *) node ); } } /* TODO -- If no new vertices have been stored, don't bother saving * it. */ static void _save_wrap_buffers( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLint i = tnl->save.prim_count - 1; GLenum mode; assert(i < (GLint) tnl->save.prim_max); assert(i >= 0); /* Close off in-progress primitive. */ tnl->save.prim[i].count = ((tnl->save.initial_counter - tnl->save.counter) - tnl->save.prim[i].start); mode = tnl->save.prim[i].mode & ~(PRIM_BEGIN|PRIM_END); /* store the copied vertices, and allocate a new list. */ _save_compile_vertex_list( ctx ); /* Restart interrupted primitive */ tnl->save.prim[0].mode = mode; tnl->save.prim[0].start = 0; tnl->save.prim[0].count = 0; tnl->save.prim_count = 1; } /* Called only when buffers are wrapped as the result of filling the * vertex_store struct. */ static void _save_wrap_filled_vertex( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLfloat *data = tnl->save.copied.buffer; GLuint i; /* Emit a glEnd to close off the last vertex list. */ _save_wrap_buffers( ctx ); /* Copy stored stored vertices to start of new list. */ assert(tnl->save.counter > tnl->save.copied.nr); for (i = 0 ; i < tnl->save.copied.nr ; i++) { _mesa_memcpy( tnl->save.vbptr, data, tnl->save.vertex_size * sizeof(GLfloat)); data += tnl->save.vertex_size; tnl->save.vbptr += tnl->save.vertex_size; tnl->save.counter--; } } static void _save_copy_to_current( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_INDEX ; i++) { if (tnl->save.attrsz[i]) { tnl->save.currentsz[i][0] = tnl->save.attrsz[i]; COPY_CLEAN_4V(tnl->save.current[i], tnl->save.attrsz[i], tnl->save.attrptr[i]); } } /* Edgeflag requires special treatment: * * TODO: change edgeflag to GLfloat in Mesa. */ if (tnl->save.attrsz[_TNL_ATTRIB_EDGEFLAG]) { ctx->ListState.ActiveEdgeFlag = 1; tnl->save.CurrentFloatEdgeFlag = tnl->save.attrptr[_TNL_ATTRIB_EDGEFLAG][0]; ctx->ListState.CurrentEdgeFlag = (tnl->save.CurrentFloatEdgeFlag == 1.0); } } static void _save_copy_from_current( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLint i; for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_INDEX ; i++) switch (tnl->save.attrsz[i]) { case 4: tnl->save.attrptr[i][3] = tnl->save.current[i][3]; case 3: tnl->save.attrptr[i][2] = tnl->save.current[i][2]; case 2: tnl->save.attrptr[i][1] = tnl->save.current[i][1]; case 1: tnl->save.attrptr[i][0] = tnl->save.current[i][0]; case 0: break; } /* Edgeflag requires special treatment: */ if (tnl->save.attrsz[_TNL_ATTRIB_EDGEFLAG]) { tnl->save.CurrentFloatEdgeFlag = (GLfloat)ctx->ListState.CurrentEdgeFlag; tnl->save.attrptr[_TNL_ATTRIB_EDGEFLAG][0] = tnl->save.CurrentFloatEdgeFlag; } } /* Flush existing data, set new attrib size, replay copied vertices. */ static void _save_upgrade_vertex( GLcontext *ctx, GLuint attr, GLuint newsz ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint oldsz; GLuint i; GLfloat *tmp; /* Store the current run of vertices, and emit a GL_END. Emit a * BEGIN in the new buffer. */ if (tnl->save.initial_counter != tnl->save.counter) _save_wrap_buffers( ctx ); else assert( tnl->save.copied.nr == 0 ); /* Do a COPY_TO_CURRENT to ensure back-copying works for the case * when the attribute already exists in the vertex and is having * its size increased. */ _save_copy_to_current( ctx ); /* Fix up sizes: */ oldsz = tnl->save.attrsz[attr]; tnl->save.attrsz[attr] = newsz; tnl->save.vertex_size += newsz - oldsz; tnl->save.counter = ((SAVE_BUFFER_SIZE - tnl->save.vertex_store->used) / tnl->save.vertex_size); if (tnl->save.counter > ctx->Const.MaxArrayLockSize ) tnl->save.counter = ctx->Const.MaxArrayLockSize; tnl->save.initial_counter = tnl->save.counter; /* Recalculate all the attrptr[] values: */ for (i = 0, tmp = tnl->save.vertex ; i < _TNL_ATTRIB_MAX ; i++) { if (tnl->save.attrsz[i]) { tnl->save.attrptr[i] = tmp; tmp += tnl->save.attrsz[i]; } else tnl->save.attrptr[i] = NULL; /* will not be dereferenced. */ } /* Copy from current to repopulate the vertex with correct values. */ _save_copy_from_current( ctx ); /* Replay stored vertices to translate them to new format here. * * If there are copied vertices and the new (upgraded) attribute * has not been defined before, this list is somewhat degenerate, * and will need fixup at runtime. */ if (tnl->save.copied.nr) { GLfloat *data = tnl->save.copied.buffer; GLfloat *dest = tnl->save.buffer; GLuint j; /* Need to note this and fix up at runtime (or loopback): */ if (tnl->save.currentsz[attr][0] == 0) { assert(oldsz == 0); tnl->save.dangling_attr_ref = GL_TRUE; /* _mesa_debug(NULL, "_save_upgrade_vertex: dangling reference attr %d\n", */ /* attr); */ #if 0 /* The current strategy is to punt these degenerate cases * through _tnl_loopback_vertex_list(), a lower-performance * option. To minimize the impact of this, artificially * reduce the size of this vertex_list. */ if (t->save.counter > 10) { t->save.initial_counter = 10; t->save.counter = 10; } #endif } for (i = 0 ; i < tnl->save.copied.nr ; i++) { for (j = 0 ; j < _TNL_ATTRIB_MAX ; j++) { if (tnl->save.attrsz[j]) { if (j == attr) { if (oldsz) { COPY_CLEAN_4V( dest, oldsz, data ); data += oldsz; dest += newsz; } else { COPY_SZ_4V( dest, newsz, tnl->save.current[attr] ); dest += newsz; } } else { GLint sz = tnl->save.attrsz[j]; COPY_SZ_4V( dest, sz, data ); data += sz; dest += sz; } } } } tnl->save.vbptr = dest; tnl->save.counter -= tnl->save.copied.nr; } } /* Helper function for 'CHOOSE' macro. Do what's necessary when an * entrypoint is called for the first time. */ static void do_choose( GLuint attr, GLuint sz, void (*attr_func)( const GLfloat *), void (*choose1)( const GLfloat *), void (*choose2)( const GLfloat *), void (*choose3)( const GLfloat *), void (*choose4)( const GLfloat *), const GLfloat *v ) { GET_CURRENT_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); static GLfloat id[4] = { 0, 0, 0, 1 }; int i; if (tnl->save.attrsz[attr] < sz) { /* New size is larger. Need to flush existing vertices and get * an enlarged vertex format. */ _save_upgrade_vertex( ctx, attr, sz ); } else { /* New size is equal or smaller - just need to fill in some * zeros. */ for (i = sz ; i <= tnl->save.attrsz[attr] ; i++) tnl->save.attrptr[attr][i-1] = id[i-1]; } /* Reset any active pointers for this attribute */ tnl->save.tabfv[attr][0] = choose1; tnl->save.tabfv[attr][1] = choose2; tnl->save.tabfv[attr][2] = choose3; tnl->save.tabfv[attr][3] = choose4; /* Update the secondary dispatch table with the new function */ tnl->save.tabfv[attr][sz-1] = attr_func; (*attr_func)(v); } /* Only one size for each attribute may be active at once. Eg. if * Color3f is installed/active, then Color4f may not be, even if the * vertex actually contains 4 color coordinates. This is because the * 3f version won't otherwise set color[3] to 1.0 -- this is the job * of the chooser function when switching between Color4f and Color3f. */ #define ATTRFV( ATTR, N ) \ static void save_choose_##ATTR##_##N( const GLfloat *v ); \ \ static void save_attrib_##ATTR##_##N( const GLfloat *v ) \ { \ GET_CURRENT_CONTEXT( ctx ); \ TNLcontext *tnl = TNL_CONTEXT(ctx); \ \ if ((ATTR) == 0) { \ GLuint i; \ \ if (N>0) tnl->save.vbptr[0] = v[0]; \ if (N>1) tnl->save.vbptr[1] = v[1]; \ if (N>2) tnl->save.vbptr[2] = v[2]; \ if (N>3) tnl->save.vbptr[3] = v[3]; \ \ for (i = N; i < tnl->save.vertex_size; i++) \ tnl->save.vbptr[i] = tnl->save.vertex[i]; \ \ tnl->save.vbptr += tnl->save.vertex_size; \ \ if (--tnl->save.counter == 0) \ _save_wrap_filled_vertex( ctx ); \ } \ else { \ GLfloat *dest = tnl->save.attrptr[ATTR]; \ if (N>0) dest[0] = v[0]; \ if (N>1) dest[1] = v[1]; \ if (N>2) dest[2] = v[2]; \ if (N>3) dest[3] = v[3]; \ } \ } #define CHOOSE( ATTR, N ) \ static void save_choose_##ATTR##_##N( const GLfloat *v ) \ { \ do_choose(ATTR, N, \ save_attrib_##ATTR##_##N, \ save_choose_##ATTR##_1, \ save_choose_##ATTR##_2, \ save_choose_##ATTR##_3, \ save_choose_##ATTR##_4, \ v ); \ } #define INIT(ATTR) \ static void save_init_##ATTR( TNLcontext *tnl ) \ { \ tnl->save.tabfv[ATTR][0] = save_choose_##ATTR##_1; \ tnl->save.tabfv[ATTR][1] = save_choose_##ATTR##_2; \ tnl->save.tabfv[ATTR][2] = save_choose_##ATTR##_3; \ tnl->save.tabfv[ATTR][3] = save_choose_##ATTR##_4; \ } #define ATTRS( ATTRIB ) \ ATTRFV( ATTRIB, 1 ) \ ATTRFV( ATTRIB, 2 ) \ ATTRFV( ATTRIB, 3 ) \ ATTRFV( ATTRIB, 4 ) \ CHOOSE( ATTRIB, 1 ) \ CHOOSE( ATTRIB, 2 ) \ CHOOSE( ATTRIB, 3 ) \ CHOOSE( ATTRIB, 4 ) \ INIT( ATTRIB ) \ /* Generate a lot of functions. These are the actual worker * functions, which are equivalent to those generated via codegen * elsewhere. */ ATTRS( 0 ) ATTRS( 1 ) ATTRS( 2 ) ATTRS( 3 ) ATTRS( 4 ) ATTRS( 5 ) ATTRS( 6 ) ATTRS( 7 ) ATTRS( 8 ) ATTRS( 9 ) ATTRS( 10 ) ATTRS( 11 ) ATTRS( 12 ) ATTRS( 13 ) ATTRS( 14 ) ATTRS( 15 ) static void _save_reset_vertex( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; save_init_0( tnl ); save_init_1( tnl ); save_init_2( tnl ); save_init_3( tnl ); save_init_4( tnl ); save_init_5( tnl ); save_init_6( tnl ); save_init_7( tnl ); save_init_8( tnl ); save_init_9( tnl ); save_init_10( tnl ); save_init_11( tnl ); save_init_12( tnl ); save_init_13( tnl ); save_init_14( tnl ); save_init_15( tnl ); for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) tnl->save.attrsz[i] = 0; tnl->save.vertex_size = 0; tnl->save.have_materials = 0; _save_reset_counters( ctx ); } /* Cope with aliasing of classic Vertex, Normal, etc. and the fan-out * of glMultTexCoord and glProgramParamterNV by routing all these * through a second level dispatch table. */ #define DISPATCH_ATTRFV( ATTR, COUNT, P ) \ do { \ GET_CURRENT_CONTEXT( ctx ); \ TNLcontext *tnl = TNL_CONTEXT(ctx); \ tnl->save.tabfv[ATTR][COUNT-1]( P ); \ } while (0) #define DISPATCH_ATTR1FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 1, V ) #define DISPATCH_ATTR2FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 2, V ) #define DISPATCH_ATTR3FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 3, V ) #define DISPATCH_ATTR4FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 4, V ) #define DISPATCH_ATTR1F( ATTR, S ) DISPATCH_ATTRFV( ATTR, 1, &(S) ) #if defined(USE_X86_ASM) && 0 /* will break register calling convention */ /* Naughty cheat: */ #define DISPATCH_ATTR2F( ATTR, S,T ) DISPATCH_ATTRFV( ATTR, 2, &(S) ) #define DISPATCH_ATTR3F( ATTR, S,T,R ) DISPATCH_ATTRFV( ATTR, 3, &(S) ) #define DISPATCH_ATTR4F( ATTR, S,T,R,Q ) DISPATCH_ATTRFV( ATTR, 4, &(S) ) #else /* Safe: */ #define DISPATCH_ATTR2F( ATTR, S,T ) \ do { \ GLfloat v[2]; \ v[0] = S; v[1] = T; \ DISPATCH_ATTR2FV( ATTR, v ); \ } while (0) #define DISPATCH_ATTR3F( ATTR, S,T,R ) \ do { \ GLfloat v[3]; \ v[0] = S; v[1] = T; v[2] = R; \ DISPATCH_ATTR3FV( ATTR, v ); \ } while (0) #define DISPATCH_ATTR4F( ATTR, S,T,R,Q ) \ do { \ GLfloat v[4]; \ v[0] = S; v[1] = T; v[2] = R; v[3] = Q; \ DISPATCH_ATTR4FV( ATTR, v ); \ } while (0) #endif static void enum_error( void ) { GET_CURRENT_CONTEXT( ctx ); _mesa_compile_error( ctx, GL_INVALID_ENUM, "glVertexAttrib" ); } static void GLAPIENTRY _save_Vertex2f( GLfloat x, GLfloat y ) { DISPATCH_ATTR2F( _TNL_ATTRIB_POS, x, y ); } static void GLAPIENTRY _save_Vertex2fv( const GLfloat *v ) { DISPATCH_ATTR2FV( _TNL_ATTRIB_POS, v ); } static void GLAPIENTRY _save_Vertex3f( GLfloat x, GLfloat y, GLfloat z ) { DISPATCH_ATTR3F( _TNL_ATTRIB_POS, x, y, z ); } static void GLAPIENTRY _save_Vertex3fv( const GLfloat *v ) { DISPATCH_ATTR3FV( _TNL_ATTRIB_POS, v ); } static void GLAPIENTRY _save_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { DISPATCH_ATTR4F( _TNL_ATTRIB_POS, x, y, z, w ); } static void GLAPIENTRY _save_Vertex4fv( const GLfloat *v ) { DISPATCH_ATTR4FV( _TNL_ATTRIB_POS, v ); } static void GLAPIENTRY _save_TexCoord1f( GLfloat x ) { DISPATCH_ATTR1F( _TNL_ATTRIB_TEX0, x ); } static void GLAPIENTRY _save_TexCoord1fv( const GLfloat *v ) { DISPATCH_ATTR1FV( _TNL_ATTRIB_TEX0, v ); } static void GLAPIENTRY _save_TexCoord2f( GLfloat x, GLfloat y ) { DISPATCH_ATTR2F( _TNL_ATTRIB_TEX0, x, y ); } static void GLAPIENTRY _save_TexCoord2fv( const GLfloat *v ) { DISPATCH_ATTR2FV( _TNL_ATTRIB_TEX0, v ); } static void GLAPIENTRY _save_TexCoord3f( GLfloat x, GLfloat y, GLfloat z ) { DISPATCH_ATTR3F( _TNL_ATTRIB_TEX0, x, y, z ); } static void GLAPIENTRY _save_TexCoord3fv( const GLfloat *v ) { DISPATCH_ATTR3FV( _TNL_ATTRIB_TEX0, v ); } static void GLAPIENTRY _save_TexCoord4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { DISPATCH_ATTR4F( _TNL_ATTRIB_TEX0, x, y, z, w ); } static void GLAPIENTRY _save_TexCoord4fv( const GLfloat *v ) { DISPATCH_ATTR4FV( _TNL_ATTRIB_TEX0, v ); } static void GLAPIENTRY _save_Normal3f( GLfloat x, GLfloat y, GLfloat z ) { DISPATCH_ATTR3F( _TNL_ATTRIB_NORMAL, x, y, z ); } static void GLAPIENTRY _save_Normal3fv( const GLfloat *v ) { DISPATCH_ATTR3FV( _TNL_ATTRIB_NORMAL, v ); } static void GLAPIENTRY _save_FogCoordfEXT( GLfloat x ) { DISPATCH_ATTR1F( _TNL_ATTRIB_FOG, x ); } static void GLAPIENTRY _save_FogCoordfvEXT( const GLfloat *v ) { DISPATCH_ATTR1FV( _TNL_ATTRIB_FOG, v ); } static void GLAPIENTRY _save_Color3f( GLfloat x, GLfloat y, GLfloat z ) { DISPATCH_ATTR3F( _TNL_ATTRIB_COLOR0, x, y, z ); } static void GLAPIENTRY _save_Color3fv( const GLfloat *v ) { DISPATCH_ATTR3FV( _TNL_ATTRIB_COLOR0, v ); } static void GLAPIENTRY _save_Color4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { DISPATCH_ATTR4F( _TNL_ATTRIB_COLOR0, x, y, z, w ); } static void GLAPIENTRY _save_Color4fv( const GLfloat *v ) { DISPATCH_ATTR4FV( _TNL_ATTRIB_COLOR0, v ); } static void GLAPIENTRY _save_SecondaryColor3fEXT( GLfloat x, GLfloat y, GLfloat z ) { DISPATCH_ATTR3F( _TNL_ATTRIB_COLOR1, x, y, z ); } static void GLAPIENTRY _save_SecondaryColor3fvEXT( const GLfloat *v ) { DISPATCH_ATTR3FV( _TNL_ATTRIB_COLOR1, v ); } static void GLAPIENTRY _save_MultiTexCoord1f( GLenum target, GLfloat x ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR1F( attr, x ); } static void GLAPIENTRY _save_MultiTexCoord1fv( GLenum target, const GLfloat *v ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR1FV( attr, v ); } static void GLAPIENTRY _save_MultiTexCoord2f( GLenum target, GLfloat x, GLfloat y ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR2F( attr, x, y ); } static void GLAPIENTRY _save_MultiTexCoord2fv( GLenum target, const GLfloat *v ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR2FV( attr, v ); } static void GLAPIENTRY _save_MultiTexCoord3f( GLenum target, GLfloat x, GLfloat y, GLfloat z) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR3F( attr, x, y, z ); } static void GLAPIENTRY _save_MultiTexCoord3fv( GLenum target, const GLfloat *v ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR3FV( attr, v ); } static void GLAPIENTRY _save_MultiTexCoord4f( GLenum target, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR4F( attr, x, y, z, w ); } static void GLAPIENTRY _save_MultiTexCoord4fv( GLenum target, const GLfloat *v ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR4FV( attr, v ); } static void GLAPIENTRY _save_VertexAttrib1fNV( GLuint index, GLfloat x ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR1F( index, x ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR1FV( index, v ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR2F( index, x, y ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR2FV( index, v ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR3F( index, x, y, z ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR3FV( index, v ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR4F( index, x, y, z, w ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR4FV( index, v ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib1fARB( GLuint index, GLfloat x ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR1F( index, x ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib1fvARB( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR1FV( index, v ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR2F( index, x, y ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib2fvARB( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR2FV( index, v ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR3F( index, x, y, z ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib3fvARB( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR3FV( index, v ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR4F( index, x, y, z, w ); else enum_error(); } static void GLAPIENTRY _save_VertexAttrib4fvARB( GLuint index, const GLfloat *v ) { if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR4FV( index, v ); else enum_error(); } /* Materials: * * These are treated as per-vertex attributes, at indices above where * the NV_vertex_program leaves off. There are a lot of good things * about treating materials this way. * * However: I don't want to double the number of generated functions * just to cope with this, so I unroll the 'C' varients of CHOOSE and * ATTRF into this function, and dispense with codegen and * second-level dispatch. * * There is no aliasing of material attributes with other entrypoints. */ #define MAT_ATTR( A, N, params ) \ do { \ if (tnl->save.attrsz[A] < N) { \ _save_upgrade_vertex( ctx, A, N ); \ tnl->save.have_materials = GL_TRUE; \ } \ \ { \ GLfloat *dest = tnl->save.attrptr[A]; \ if (N>0) dest[0] = params[0]; \ if (N>1) dest[1] = params[1]; \ if (N>2) dest[2] = params[2]; \ if (N>3) dest[3] = params[3]; \ } \ } while (0) #define MAT( ATTR, N, face, params ) \ do { \ if (face != GL_BACK) \ MAT_ATTR( ATTR, N, params ); /* front */ \ if (face != GL_FRONT) \ MAT_ATTR( ATTR + 1, N, params ); /* back */ \ } while (0) /* NOTE: Have to remove/deal-with colormaterial crossovers, probably * later on - in the meantime just store everything. */ static void GLAPIENTRY _save_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); switch (pname) { case GL_EMISSION: MAT( _TNL_ATTRIB_MAT_FRONT_EMISSION, 4, face, params ); break; case GL_AMBIENT: MAT( _TNL_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params ); break; case GL_DIFFUSE: MAT( _TNL_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params ); break; case GL_SPECULAR: MAT( _TNL_ATTRIB_MAT_FRONT_SPECULAR, 4, face, params ); break; case GL_SHININESS: MAT( _TNL_ATTRIB_MAT_FRONT_SHININESS, 1, face, params ); break; case GL_COLOR_INDEXES: MAT( _TNL_ATTRIB_MAT_FRONT_INDEXES, 3, face, params ); break; case GL_AMBIENT_AND_DIFFUSE: MAT( _TNL_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params ); MAT( _TNL_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params ); break; default: _mesa_compile_error( ctx, GL_INVALID_ENUM, "glMaterialfv" ); return; } } #define IDX_ATTR( A, IDX ) \ do { \ GET_CURRENT_CONTEXT( ctx ); \ TNLcontext *tnl = TNL_CONTEXT(ctx); \ \ if (tnl->save.attrsz[A] < 1) { \ _save_upgrade_vertex( ctx, A, 1 ); \ } \ \ { \ GLfloat *dest = tnl->save.attrptr[A]; \ dest[0] = IDX; \ } \ } while (0) static void GLAPIENTRY _save_EdgeFlag( GLboolean b ) { IDX_ATTR( _TNL_ATTRIB_EDGEFLAG, (GLfloat)b ); } static void GLAPIENTRY _save_EdgeFlagv( const GLboolean *v ) { IDX_ATTR( _TNL_ATTRIB_EDGEFLAG, (GLfloat)(v[0]) ); } static void GLAPIENTRY _save_Indexf( GLfloat f ) { IDX_ATTR( _TNL_ATTRIB_INDEX, f ); } static void GLAPIENTRY _save_Indexfv( const GLfloat *f ) { IDX_ATTR( _TNL_ATTRIB_INDEX, f[0] ); } /* Cope with EvalCoord/CallList called within a begin/end object: * -- Flush current buffer * -- Fallback to opcodes for the rest of the begin/end object. */ #define FALLBACK(ctx) \ do { \ TNLcontext *tnl = TNL_CONTEXT(ctx); \ \ if (tnl->save.initial_counter != tnl->save.counter || \ tnl->save.prim_count) \ _save_compile_vertex_list( ctx ); \ \ _save_copy_to_current( ctx ); \ _save_reset_vertex( ctx ); \ _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); \ ctx->Driver.SaveNeedFlush = 0; \ } while (0) static void GLAPIENTRY _save_EvalCoord1f( GLfloat u ) { GET_CURRENT_CONTEXT(ctx); FALLBACK(ctx); CALL_EvalCoord1f(ctx->Save, ( u )); } static void GLAPIENTRY _save_EvalCoord1fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); FALLBACK(ctx); CALL_EvalCoord1fv(ctx->Save, ( v )); } static void GLAPIENTRY _save_EvalCoord2f( GLfloat u, GLfloat v ) { GET_CURRENT_CONTEXT(ctx); FALLBACK(ctx); CALL_EvalCoord2f(ctx->Save, ( u, v )); } static void GLAPIENTRY _save_EvalCoord2fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); FALLBACK(ctx); CALL_EvalCoord2fv(ctx->Save, ( v )); } static void GLAPIENTRY _save_EvalPoint1( GLint i ) { GET_CURRENT_CONTEXT(ctx); FALLBACK(ctx); CALL_EvalPoint1(ctx->Save, ( i )); } static void GLAPIENTRY _save_EvalPoint2( GLint i, GLint j ) { GET_CURRENT_CONTEXT(ctx); FALLBACK(ctx); CALL_EvalPoint2(ctx->Save, ( i, j )); } static void GLAPIENTRY _save_CallList( GLuint l ) { GET_CURRENT_CONTEXT(ctx); FALLBACK(ctx); CALL_CallList(ctx->Save, ( l )); } static void GLAPIENTRY _save_CallLists( GLsizei n, GLenum type, const GLvoid *v ) { GET_CURRENT_CONTEXT(ctx); FALLBACK(ctx); CALL_CallLists(ctx->Save, ( n, type, v )); } /* This begin is hooked into ... Updating of * ctx->Driver.CurrentSavePrimitive is already taken care of. */ static GLboolean _save_NotifyBegin( GLcontext *ctx, GLenum mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); if (1) { GLuint i = tnl->save.prim_count++; assert(i < tnl->save.prim_max); tnl->save.prim[i].mode = mode | PRIM_BEGIN; tnl->save.prim[i].start = tnl->save.initial_counter - tnl->save.counter; tnl->save.prim[i].count = 0; _mesa_install_save_vtxfmt( ctx, &tnl->save_vtxfmt ); ctx->Driver.SaveNeedFlush = 1; return GL_TRUE; } else return GL_FALSE; } static void GLAPIENTRY _save_End( void ) { GET_CURRENT_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); GLint i = tnl->save.prim_count - 1; ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; tnl->save.prim[i].mode |= PRIM_END; tnl->save.prim[i].count = ((tnl->save.initial_counter - tnl->save.counter) - tnl->save.prim[i].start); if (i == (GLint) tnl->save.prim_max - 1) { _save_compile_vertex_list( ctx ); assert(tnl->save.copied.nr == 0); } /* Swap out this vertex format while outside begin/end. Any color, * etc. received between here and the next begin will be compiled * as opcodes. */ _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); } /* These are all errors as this vtxfmt is only installed inside * begin/end pairs. */ static void GLAPIENTRY _save_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); (void) mode; (void) count; (void) type; (void) indices; _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glDrawElements" ); } static void GLAPIENTRY _save_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); (void) mode; (void) start; (void) end; (void) count; (void) type; (void) indices; _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glDrawRangeElements" ); } static void GLAPIENTRY _save_DrawArrays(GLenum mode, GLint start, GLsizei count) { GET_CURRENT_CONTEXT(ctx); (void) mode; (void) start; (void) count; _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glDrawArrays" ); } static void GLAPIENTRY _save_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) { GET_CURRENT_CONTEXT(ctx); (void) x1; (void) y1; (void) x2; (void) y2; _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glRectf" ); } static void GLAPIENTRY _save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) { GET_CURRENT_CONTEXT(ctx); (void) mode; (void) i1; (void) i2; _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glEvalMesh1" ); } static void GLAPIENTRY _save_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) { GET_CURRENT_CONTEXT(ctx); (void) mode; (void) i1; (void) i2; (void) j1; (void) j2; _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glEvalMesh2" ); } static void GLAPIENTRY _save_Begin( GLenum mode ) { GET_CURRENT_CONTEXT( ctx ); (void) mode; _mesa_compile_error( ctx, GL_INVALID_OPERATION, "Recursive glBegin" ); } /* Unlike the functions above, these are to be hooked into the vtxfmt * maintained in ctx->ListState, active when the list is known or * suspected to be outside any begin/end primitive. */ static void GLAPIENTRY _save_OBE_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) { GET_CURRENT_CONTEXT(ctx); _save_NotifyBegin( ctx, GL_QUADS | PRIM_WEAK ); CALL_Vertex2f(GET_DISPATCH(), ( x1, y1 )); CALL_Vertex2f(GET_DISPATCH(), ( x2, y1 )); CALL_Vertex2f(GET_DISPATCH(), ( x2, y2 )); CALL_Vertex2f(GET_DISPATCH(), ( x1, y2 )); CALL_End(GET_DISPATCH(), ()); } static void GLAPIENTRY _save_OBE_DrawArrays(GLenum mode, GLint start, GLsizei count) { GET_CURRENT_CONTEXT(ctx); GLint i; if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) return; _save_NotifyBegin( ctx, mode | PRIM_WEAK ); for (i = 0; i < count; i++) CALL_ArrayElement(GET_DISPATCH(), (start + i)); CALL_End(GET_DISPATCH(), ()); } static void GLAPIENTRY _save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); GLint i; if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) return; _save_NotifyBegin( ctx, mode | PRIM_WEAK ); switch (type) { case GL_UNSIGNED_BYTE: for (i = 0 ; i < count ; i++) CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte *)indices)[i] )); break; case GL_UNSIGNED_SHORT: for (i = 0 ; i < count ; i++) CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort *)indices)[i] )); break; case GL_UNSIGNED_INT: for (i = 0 ; i < count ; i++) CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint *)indices)[i] )); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); break; } CALL_End(GET_DISPATCH(), ()); } static void GLAPIENTRY _save_OBE_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); if (_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, type, indices )) _save_OBE_DrawElements( mode, count, type, indices ); } static void _save_vtxfmt_init( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLvertexformat *vfmt = &tnl->save_vtxfmt; vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ vfmt->Begin = _save_Begin; vfmt->Color3f = _save_Color3f; vfmt->Color3fv = _save_Color3fv; vfmt->Color4f = _save_Color4f; vfmt->Color4fv = _save_Color4fv; vfmt->EdgeFlag = _save_EdgeFlag; vfmt->EdgeFlagv = _save_EdgeFlagv; vfmt->End = _save_End; vfmt->FogCoordfEXT = _save_FogCoordfEXT; vfmt->FogCoordfvEXT = _save_FogCoordfvEXT; vfmt->Indexf = _save_Indexf; vfmt->Indexfv = _save_Indexfv; vfmt->Materialfv = _save_Materialfv; vfmt->MultiTexCoord1fARB = _save_MultiTexCoord1f; vfmt->MultiTexCoord1fvARB = _save_MultiTexCoord1fv; vfmt->MultiTexCoord2fARB = _save_MultiTexCoord2f; vfmt->MultiTexCoord2fvARB = _save_MultiTexCoord2fv; vfmt->MultiTexCoord3fARB = _save_MultiTexCoord3f; vfmt->MultiTexCoord3fvARB = _save_MultiTexCoord3fv; vfmt->MultiTexCoord4fARB = _save_MultiTexCoord4f; vfmt->MultiTexCoord4fvARB = _save_MultiTexCoord4fv; vfmt->Normal3f = _save_Normal3f; vfmt->Normal3fv = _save_Normal3fv; vfmt->SecondaryColor3fEXT = _save_SecondaryColor3fEXT; vfmt->SecondaryColor3fvEXT = _save_SecondaryColor3fvEXT; vfmt->TexCoord1f = _save_TexCoord1f; vfmt->TexCoord1fv = _save_TexCoord1fv; vfmt->TexCoord2f = _save_TexCoord2f; vfmt->TexCoord2fv = _save_TexCoord2fv; vfmt->TexCoord3f = _save_TexCoord3f; vfmt->TexCoord3fv = _save_TexCoord3fv; vfmt->TexCoord4f = _save_TexCoord4f; vfmt->TexCoord4fv = _save_TexCoord4fv; vfmt->Vertex2f = _save_Vertex2f; vfmt->Vertex2fv = _save_Vertex2fv; vfmt->Vertex3f = _save_Vertex3f; vfmt->Vertex3fv = _save_Vertex3fv; vfmt->Vertex4f = _save_Vertex4f; vfmt->Vertex4fv = _save_Vertex4fv; vfmt->VertexAttrib1fNV = _save_VertexAttrib1fNV; vfmt->VertexAttrib1fvNV = _save_VertexAttrib1fvNV; vfmt->VertexAttrib2fNV = _save_VertexAttrib2fNV; vfmt->VertexAttrib2fvNV = _save_VertexAttrib2fvNV; vfmt->VertexAttrib3fNV = _save_VertexAttrib3fNV; vfmt->VertexAttrib3fvNV = _save_VertexAttrib3fvNV; vfmt->VertexAttrib4fNV = _save_VertexAttrib4fNV; vfmt->VertexAttrib4fvNV = _save_VertexAttrib4fvNV; vfmt->VertexAttrib1fARB = _save_VertexAttrib1fARB; vfmt->VertexAttrib1fvARB = _save_VertexAttrib1fvARB; vfmt->VertexAttrib2fARB = _save_VertexAttrib2fARB; vfmt->VertexAttrib2fvARB = _save_VertexAttrib2fvARB; vfmt->VertexAttrib3fARB = _save_VertexAttrib3fARB; vfmt->VertexAttrib3fvARB = _save_VertexAttrib3fvARB; vfmt->VertexAttrib4fARB = _save_VertexAttrib4fARB; vfmt->VertexAttrib4fvARB = _save_VertexAttrib4fvARB; /* This will all require us to fallback to saving the list as opcodes: */ vfmt->CallList = _save_CallList; /* inside begin/end */ vfmt->CallLists = _save_CallLists; /* inside begin/end */ vfmt->EvalCoord1f = _save_EvalCoord1f; vfmt->EvalCoord1fv = _save_EvalCoord1fv; vfmt->EvalCoord2f = _save_EvalCoord2f; vfmt->EvalCoord2fv = _save_EvalCoord2fv; vfmt->EvalPoint1 = _save_EvalPoint1; vfmt->EvalPoint2 = _save_EvalPoint2; /* These are all errors as we at least know we are in some sort of * begin/end pair: */ vfmt->EvalMesh1 = _save_EvalMesh1; vfmt->EvalMesh2 = _save_EvalMesh2; vfmt->Begin = _save_Begin; vfmt->Rectf = _save_Rectf; vfmt->DrawArrays = _save_DrawArrays; vfmt->DrawElements = _save_DrawElements; vfmt->DrawRangeElements = _save_DrawRangeElements; } void _tnl_SaveFlushVertices( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); /* Noop when we are actually active: */ if (ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM || ctx->Driver.CurrentSavePrimitive <= GL_POLYGON) return; if (tnl->save.initial_counter != tnl->save.counter || tnl->save.prim_count) _save_compile_vertex_list( ctx ); _save_copy_to_current( ctx ); _save_reset_vertex( ctx ); ctx->Driver.SaveNeedFlush = 0; } void _tnl_NewList( GLcontext *ctx, GLuint list, GLenum mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); (void) list; (void) mode; if (!tnl->save.prim_store) tnl->save.prim_store = alloc_prim_store( ctx ); if (!tnl->save.vertex_store) { tnl->save.vertex_store = alloc_vertex_store( ctx ); tnl->save.vbptr = tnl->save.vertex_store->buffer; } _save_reset_vertex( ctx ); ctx->Driver.SaveNeedFlush = 0; } void _tnl_EndList( GLcontext *ctx ) { (void) ctx; assert(TNL_CONTEXT(ctx)->save.vertex_size == 0); } void _tnl_BeginCallList( GLcontext *ctx, struct mesa_display_list *dlist ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->save.replay_flags |= dlist->flags; tnl->save.replay_flags |= tnl->LoopbackDListCassettes; } void _tnl_EndCallList( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); if (ctx->ListState.CallDepth == 1) tnl->save.replay_flags = 0; } static void _tnl_destroy_vertex_list( GLcontext *ctx, void *data ) { struct tnl_vertex_list *node = (struct tnl_vertex_list *)data; (void) ctx; if ( --node->vertex_store->refcount == 0 ) FREE( node->vertex_store ); if ( --node->prim_store->refcount == 0 ) FREE( node->prim_store ); if ( node->normal_lengths ) FREE( node->normal_lengths ); } static void _tnl_print_vertex_list( GLcontext *ctx, void *data ) { struct tnl_vertex_list *node = (struct tnl_vertex_list *)data; GLuint i; (void) ctx; _mesa_debug(NULL, "TNL-VERTEX-LIST, %u vertices %d primitives, %d vertsize\n", node->count, node->prim_count, node->vertex_size); for (i = 0 ; i < node->prim_count ; i++) { struct tnl_prim *prim = &node->prim[i]; _mesa_debug(NULL, " prim %d: %s %d..%d %s %s\n", i, _mesa_lookup_enum_by_nr(prim->mode & PRIM_MODE_MASK), prim->start, prim->start + prim->count, (prim->mode & PRIM_BEGIN) ? "BEGIN" : "(wrap)", (prim->mode & PRIM_END) ? "END" : "(wrap)"); } } static void _save_current_init( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLint i; for (i = 0; i < _TNL_ATTRIB_MAT_FRONT_AMBIENT; i++) { ASSERT(i < VERT_ATTRIB_MAX); tnl->save.currentsz[i] = &ctx->ListState.ActiveAttribSize[i]; tnl->save.current[i] = ctx->ListState.CurrentAttrib[i]; } for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT; i < _TNL_ATTRIB_INDEX; i++) { const GLuint j = i - _TNL_ATTRIB_MAT_FRONT_AMBIENT; ASSERT(j < MAT_ATTRIB_MAX); tnl->save.currentsz[i] = &ctx->ListState.ActiveMaterialSize[j]; tnl->save.current[i] = ctx->ListState.CurrentMaterial[j]; } tnl->save.currentsz[_TNL_ATTRIB_INDEX] = &ctx->ListState.ActiveIndex; tnl->save.current[_TNL_ATTRIB_INDEX] = &ctx->ListState.CurrentIndex; tnl->save.currentsz[_TNL_ATTRIB_EDGEFLAG] = &ctx->ListState.ActiveEdgeFlag; tnl->save.current[_TNL_ATTRIB_EDGEFLAG] = &tnl->save.CurrentFloatEdgeFlag; } /** * Initialize the display list compiler */ void _tnl_save_init( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct tnl_vertex_arrays *tmp = &tnl->save_inputs; GLuint i; for (i = 0; i < _TNL_ATTRIB_MAX; i++) _mesa_vector4f_init( &tmp->Attribs[i], 0, NULL); tnl->save.opcode_vertex_list = _mesa_alloc_opcode( ctx, sizeof(struct tnl_vertex_list), _tnl_playback_vertex_list, _tnl_destroy_vertex_list, _tnl_print_vertex_list ); ctx->Driver.NotifySaveBegin = _save_NotifyBegin; _save_vtxfmt_init( ctx ); _save_current_init( ctx ); /* Hook our array functions into the outside-begin-end vtxfmt in * ctx->ListState. */ ctx->ListState.ListVtxfmt.Rectf = _save_OBE_Rectf; ctx->ListState.ListVtxfmt.DrawArrays = _save_OBE_DrawArrays; ctx->ListState.ListVtxfmt.DrawElements = _save_OBE_DrawElements; ctx->ListState.ListVtxfmt.DrawRangeElements = _save_OBE_DrawRangeElements; _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); } /** * Deallocate the immediate-mode buffer for the given context, if * its reference count goes to zero. */ void _tnl_save_destroy( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); /* Decrement the refcounts. References may still be held by * display lists yet to be destroyed, so it may not yet be time to * free these items. */ if (tnl->save.prim_store && --tnl->save.prim_store->refcount == 0 ) FREE( tnl->save.prim_store ); if (tnl->save.vertex_store && --tnl->save.vertex_store->refcount == 0 ) FREE( tnl->save.vertex_store ); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_save_api.h0000644000000000000000000000407713614532424020305 0ustar /* $XFree86$ */ /************************************************************************** Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation on the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Keith Whitwell * */ #ifndef __T_SAVE_API_H__ #define __T_SAVE_API_H__ #include "t_context.h" extern GLboolean _tnl_weak_begin( GLcontext *ctx, GLenum mode ); extern void _tnl_EndList( GLcontext *ctx ); extern void _tnl_NewList( GLcontext *ctx, GLuint list, GLenum mode ); extern void _tnl_EndCallList( GLcontext *ctx ); extern void _tnl_BeginCallList( GLcontext *ctx, struct mesa_display_list *list ); extern void _tnl_SaveFlushVertices( GLcontext *ctx ); extern void _tnl_save_init( GLcontext *ctx ); extern void _tnl_save_destroy( GLcontext *ctx ); extern void _tnl_loopback_vertex_list( GLcontext *ctx, const struct tnl_vertex_list *list ); extern void _tnl_playback_vertex_list( GLcontext *ctx, void *data ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_save_loopback.c0000644000000000000000000002220413614532424021311 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Author: * Keith Whitwell */ #include "glheader.h" #include "context.h" #include "enums.h" #include "glapi.h" #include "imports.h" #include "macros.h" #include "mtypes.h" #include "t_context.h" #include "t_save_api.h" #include "dispatch.h" /* If someone compiles a display list like: * glBegin(Triangles) * glVertex() * ... lots of vertices ... * glEnd() * * or: * glDrawArrays(...) * * and then tries to execute it like this: * * glBegin(Lines) * glCallList() * glEnd() * * it will wind up in here, as the vertex copying used when wrapping * buffers in list compilation (Triangles) won't be right for how the * list is being executed (as Lines). * * This could be avoided by not compiling as vertex_lists until after * the first glEnd() has been seen. However, that would miss an * important category of display lists, for the sake of a degenerate * usage. * * Further, replaying degenerately-called lists in this fashion is * probably still faster than the replay using opcodes. */ typedef void (*attr_func)( GLcontext *ctx, GLint target, const GLfloat * ); /* Wrapper functions in case glVertexAttrib*fvNV doesn't exist */ static void VertexAttrib1fvNV(GLcontext *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib1fvNV(ctx->Exec, (target, v)); } static void VertexAttrib2fvNV(GLcontext *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib2fvNV(ctx->Exec, (target, v)); } static void VertexAttrib3fvNV(GLcontext *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib3fvNV(ctx->Exec, (target, v)); } static void VertexAttrib4fvNV(GLcontext *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib4fvNV(ctx->Exec, (target, v)); } static attr_func vert_attrfunc[4] = { VertexAttrib1fvNV, VertexAttrib2fvNV, VertexAttrib3fvNV, VertexAttrib4fvNV }; static void VertexAttrib1fvARB(GLcontext *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib1fvARB(ctx->Exec, (target, v)); } static void VertexAttrib2fvARB(GLcontext *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib2fvARB(ctx->Exec, (target, v)); } static void VertexAttrib3fvARB(GLcontext *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib3fvARB(ctx->Exec, (target, v)); } static void VertexAttrib4fvARB(GLcontext *ctx, GLint target, const GLfloat *v) { CALL_VertexAttrib4fvARB(ctx->Exec, (target, v)); } static attr_func vert_attrfunc_arb[4] = { VertexAttrib1fvARB, VertexAttrib2fvARB, VertexAttrib3fvARB, VertexAttrib4fvARB }; static void mat_attr1fv( GLcontext *ctx, GLint target, const GLfloat *v ) { switch (target) { case _TNL_ATTRIB_MAT_FRONT_SHININESS: CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_SHININESS, v )); break; case _TNL_ATTRIB_MAT_BACK_SHININESS: CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_SHININESS, v )); break; } } static void mat_attr3fv( GLcontext *ctx, GLint target, const GLfloat *v ) { switch (target) { case _TNL_ATTRIB_MAT_FRONT_INDEXES: CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_COLOR_INDEXES, v )); break; case _TNL_ATTRIB_MAT_BACK_INDEXES: CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_COLOR_INDEXES, v )); break; } } static void mat_attr4fv( GLcontext *ctx, GLint target, const GLfloat *v ) { switch (target) { case _TNL_ATTRIB_MAT_FRONT_EMISSION: CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_EMISSION, v )); break; case _TNL_ATTRIB_MAT_BACK_EMISSION: CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_EMISSION, v )); break; case _TNL_ATTRIB_MAT_FRONT_AMBIENT: CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_AMBIENT, v )); break; case _TNL_ATTRIB_MAT_BACK_AMBIENT: CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_AMBIENT, v )); break; case _TNL_ATTRIB_MAT_FRONT_DIFFUSE: CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_DIFFUSE, v )); break; case _TNL_ATTRIB_MAT_BACK_DIFFUSE: CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_DIFFUSE, v )); break; case _TNL_ATTRIB_MAT_FRONT_SPECULAR: CALL_Materialfv(ctx->Exec, ( GL_FRONT, GL_SPECULAR, v )); break; case _TNL_ATTRIB_MAT_BACK_SPECULAR: CALL_Materialfv(ctx->Exec, ( GL_BACK, GL_SPECULAR, v )); break; } } static attr_func mat_attrfunc[4] = { mat_attr1fv, NULL, mat_attr3fv, mat_attr4fv }; static void index_attr1fv(GLcontext *ctx, GLint target, const GLfloat *v) { (void) target; CALL_Indexf(ctx->Exec, (v[0])); } static void edgeflag_attr1fv(GLcontext *ctx, GLint target, const GLfloat *v) { (void) target; CALL_EdgeFlag(ctx->Exec, ((GLboolean)(v[0] == 1.0))); } struct loopback_attr { GLint target; GLint sz; attr_func func; }; /* Don't emit ends and begins on wrapped primitives. Don't replay * wrapped vertices. If we get here, it's probably because the the * precalculated wrapping is wrong. */ static void loopback_prim( GLcontext *ctx, const struct tnl_vertex_list *list, GLuint i, const struct loopback_attr *la, GLuint nr ) { struct tnl_prim *prim = &list->prim[i]; GLint begin = prim->start; GLint end = begin + prim->count; GLfloat *data; GLint j; GLuint k; if (prim->mode & PRIM_BEGIN) { CALL_Begin(GET_DISPATCH(), ( prim->mode & PRIM_MODE_MASK )); } else { assert(i == 0); assert(begin == 0); begin += list->wrap_count; } data = list->buffer + begin * list->vertex_size; for (j = begin ; j < end ; j++) { GLfloat *tmp = data + la[0].sz; for (k = 1 ; k < nr ; k++) { la[k].func( ctx, la[k].target, tmp ); tmp += la[k].sz; } /* Fire the vertex */ la[0].func( ctx, VERT_ATTRIB_POS, data ); data = tmp; } if (prim->mode & PRIM_END) { CALL_End(GET_DISPATCH(), ()); } else { assert (i == list->prim_count-1); } } /* Primitives generated by DrawArrays/DrawElements/Rectf may be * caught here. If there is no primitive in progress, execute them * normally, otherwise need to track and discard the generated * primitives. */ static void loopback_weak_prim( GLcontext *ctx, const struct tnl_vertex_list *list, GLuint i, const struct loopback_attr *la, GLuint nr ) { if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) loopback_prim( ctx, list, i, la, nr ); else { struct tnl_prim *prim = &list->prim[i]; /* Use the prim_weak flag to ensure that if this primitive * wraps, we don't mistake future vertex_lists for part of the * surrounding primitive. * * While this flag is set, we are simply disposing of data * generated by an operation now known to be a noop. */ if (prim->mode & PRIM_BEGIN) ctx->Driver.CurrentExecPrimitive |= PRIM_WEAK; if (prim->mode & PRIM_END) ctx->Driver.CurrentExecPrimitive &= ~PRIM_WEAK; } } void _tnl_loopback_vertex_list( GLcontext *ctx, const struct tnl_vertex_list *list ) { struct loopback_attr la[_TNL_ATTRIB_MAX]; GLuint i, nr = 0; for (i = 0 ; i <= _TNL_ATTRIB_TEX7 ; i++) { if (list->attrsz[i]) { la[nr].target = i; la[nr].sz = list->attrsz[i]; la[nr].func = vert_attrfunc[list->attrsz[i]-1]; nr++; } } for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT ; i <= _TNL_ATTRIB_MAT_BACK_INDEXES ; i++) { if (list->attrsz[i]) { la[nr].target = i; la[nr].sz = list->attrsz[i]; la[nr].func = mat_attrfunc[list->attrsz[i]-1]; nr++; } } if (list->attrsz[_TNL_ATTRIB_EDGEFLAG]) { la[nr].target = _TNL_ATTRIB_EDGEFLAG; la[nr].sz = list->attrsz[_TNL_ATTRIB_EDGEFLAG]; la[nr].func = edgeflag_attr1fv; nr++; } if (list->attrsz[_TNL_ATTRIB_INDEX]) { la[nr].target = _TNL_ATTRIB_INDEX; la[nr].sz = list->attrsz[_TNL_ATTRIB_INDEX]; la[nr].func = index_attr1fv; nr++; } /* XXX ARB vertex attribs */ for (i = 0 ; i < list->prim_count ; i++) { if (list->prim[i].mode & PRIM_WEAK) loopback_weak_prim( ctx, list, i, la, nr ); else loopback_prim( ctx, list, i, la, nr ); } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_save_playback.c0000644000000000000000000001464213614532424021314 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Author: * Keith Whitwell */ #include "glheader.h" #include "context.h" #include "imports.h" #include "mtypes.h" #include "macros.h" #include "light.h" #include "state.h" #include "t_pipeline.h" #include "t_save_api.h" #include "t_vtx_api.h" static INLINE GLint get_size( const GLfloat *f ) { if (f[3] != 1.0) return 4; if (f[2] != 0.0) return 3; return 2; } /* Some nasty stuff still hanging on here. * * TODO - remove VB->ColorPtr, etc and just use the AttrPtr's. */ static void _tnl_bind_vertex_list( GLcontext *ctx, const struct tnl_vertex_list *node ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; struct tnl_vertex_arrays *tmp = &tnl->save_inputs; GLfloat *data = node->buffer; GLuint attr, i; /* Setup constant data in the VB. */ VB->Count = node->count; VB->Primitive = node->prim; VB->PrimitiveCount = node->prim_count; VB->Elts = NULL; VB->NormalLengthPtr = node->normal_lengths; for (attr = 0; attr <= _TNL_ATTRIB_INDEX; attr++) { if (node->attrsz[attr]) { tmp->Attribs[attr].count = node->count; tmp->Attribs[attr].data = (GLfloat (*)[4]) data; tmp->Attribs[attr].start = data; tmp->Attribs[attr].size = node->attrsz[attr]; tmp->Attribs[attr].stride = node->vertex_size * sizeof(GLfloat); VB->AttribPtr[attr] = &tmp->Attribs[attr]; data += node->attrsz[attr]; } else { tmp->Attribs[attr].count = 1; tmp->Attribs[attr].data = (GLfloat (*)[4]) tnl->vtx.current[attr]; tmp->Attribs[attr].start = tnl->vtx.current[attr]; tmp->Attribs[attr].size = get_size( tnl->vtx.current[attr] ); tmp->Attribs[attr].stride = 0; VB->AttribPtr[attr] = &tmp->Attribs[attr]; } } /* Copy edgeflag to a contiguous array */ if (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) { if (node->attrsz[_TNL_ATTRIB_EDGEFLAG]) { VB->EdgeFlag = _tnl_translate_edgeflag( ctx, data, node->count, node->vertex_size ); data++; } else VB->EdgeFlag = _tnl_import_current_edgeflag( ctx, node->count ); } /* Legacy pointers -- remove one day. */ VB->ObjPtr = VB->AttribPtr[_TNL_ATTRIB_POS]; VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0]; VB->ColorPtr[1] = NULL; VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX]; VB->IndexPtr[1] = NULL; VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1]; VB->SecondaryColorPtr[1] = NULL; VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG]; for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { VB->TexCoordPtr[i] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]; } } static void _playback_copy_to_current( GLcontext *ctx, const struct tnl_vertex_list *node ) { TNLcontext *tnl = TNL_CONTEXT(ctx); const GLfloat *data; GLuint i; if (node->count) data = node->buffer + (node->count-1) * node->vertex_size; else data = node->buffer; for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_INDEX ; i++) { if (node->attrsz[i]) { COPY_CLEAN_4V(tnl->vtx.current[i], node->attrsz[i], data); data += node->attrsz[i]; } } /* Edgeflag requires special treatment: */ if (node->attrsz[_TNL_ATTRIB_EDGEFLAG]) { ctx->Current.EdgeFlag = (data[0] == 1.0); } /* Colormaterial -- this kindof sucks. */ if (ctx->Light.ColorMaterialEnabled) { _mesa_update_color_material(ctx, ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); } if (node->have_materials) { tnl->Driver.NotifyMaterialChange( ctx ); } /* CurrentExecPrimitive */ if (node->prim_count) { GLenum mode = node->prim[node->prim_count - 1].mode; if (mode & PRIM_END) ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; else ctx->Driver.CurrentExecPrimitive = (mode & PRIM_MODE_MASK); } } /** * Execute the buffer and save copied verts. */ void _tnl_playback_vertex_list( GLcontext *ctx, void *data ) { const struct tnl_vertex_list *node = (const struct tnl_vertex_list *) data; TNLcontext *tnl = TNL_CONTEXT(ctx); FLUSH_CURRENT(ctx, 0); if (node->prim_count > 0 && node->count > 0) { if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END && (node->prim[0].mode & PRIM_BEGIN)) { /* Degenerate case: list is called inside begin/end pair and * includes operations such as glBegin or glDrawArrays. */ _mesa_error( ctx, GL_INVALID_OPERATION, "displaylist recursive begin"); _tnl_loopback_vertex_list( ctx, node ); return; } else if (tnl->save.replay_flags) { /* Various degnerate cases: translate into immediate mode * calls rather than trying to execute in place. */ _tnl_loopback_vertex_list( ctx, node ); return; } if (ctx->NewState) _mesa_update_state( ctx ); if ((ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) || (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBegin (invalid vertex/fragment program)"); return; } _tnl_bind_vertex_list( ctx, node ); tnl->Driver.RunPipeline( ctx ); } /* Copy to current? */ _playback_copy_to_current( ctx, node ); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_arbprogram.c0000644000000000000000000011452513614532424021334 0ustar /* * Mesa 3-D graphics library * Version: 6.4.2 * * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file t_arb_program.c * Compile vertex programs to an intermediate representation. * Execute vertex programs over a buffer of vertices. * \author Keith Whitwell, Brian Paul */ #include "glheader.h" #include "context.h" #include "imports.h" #include "macros.h" #include "mtypes.h" #include "arbprogparse.h" #include "light.h" #include "program.h" #include "math/m_matrix.h" #include "math/m_translate.h" #include "t_context.h" #include "t_pipeline.h" #include "t_vb_arbprogram.h" #include "tnl.h" #define DISASSEM 0 /*--------------------------------------------------------------------------- */ struct opcode_info { GLuint nr_args; const char *string; void (*print)( union instruction , const struct opcode_info * ); }; struct compilation { GLuint reg_active; union instruction *csr; }; #define ARB_VP_MACHINE(stage) ((struct arb_vp_machine *)(stage->privatePtr)) #define PUFF(x) ((x)[1] = (x)[2] = (x)[3] = (x)[0]) /* Lower precision functions for the EXP, LOG and LIT opcodes. The * LOG2() implementation is probably not accurate enough, and the * attempted optimization for Exp2 is definitely not accurate * enough - it discards all of t's fractional bits! */ static GLfloat RoughApproxLog2(GLfloat t) { return LOG2(t); } static GLfloat RoughApproxExp2(GLfloat t) { #if 0 fi_type fi; fi.i = (GLint) t; fi.i = (fi.i << 23) + 0x3f800000; return fi.f; #else return (GLfloat) _mesa_pow(2.0, t); #endif } static GLfloat RoughApproxPower(GLfloat x, GLfloat y) { if (x == 0.0 && y == 0.0) return 1.0; /* spec requires this */ else return RoughApproxExp2(y * RoughApproxLog2(x)); } /* Higher precision functions for the EX2, LG2 and POW opcodes: */ static GLfloat ApproxLog2(GLfloat t) { return (GLfloat) (log(t) * 1.442695F); } static GLfloat ApproxExp2(GLfloat t) { return (GLfloat) _mesa_pow(2.0, t); } static GLfloat ApproxPower(GLfloat x, GLfloat y) { return (GLfloat) _mesa_pow(x, y); } static GLfloat rough_approx_log2_0_1(GLfloat x) { return LOG2(x); } /** * Perform a reduced swizzle: */ static void do_RSW( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.rsw.dst]; const GLfloat *arg0 = m->File[op.rsw.file0][op.rsw.idx0]; GLuint swz = op.rsw.swz; GLuint neg = op.rsw.neg; GLfloat tmp[4]; /* Need a temporary to be correct in the case where result == arg0. */ COPY_4V(tmp, arg0); result[0] = tmp[GET_RSW(swz, 0)]; result[1] = tmp[GET_RSW(swz, 1)]; result[2] = tmp[GET_RSW(swz, 2)]; result[3] = tmp[GET_RSW(swz, 3)]; if (neg) { if (neg & 0x1) result[0] = -result[0]; if (neg & 0x2) result[1] = -result[1]; if (neg & 0x4) result[2] = -result[2]; if (neg & 0x8) result[3] = -result[3]; } } /* Used to implement write masking. To make things easier for the sse * generator I've gone back to a 1 argument version of this function * (dst.msk = arg), rather than the semantically cleaner (dst = SEL * arg0, arg1, msk) * * That means this is the only instruction which doesn't write a full * 4 dwords out. This would make such a program harder to analyse, * but it looks like analysis is going to take place on a higher level * anyway. */ static void do_MSK( struct arb_vp_machine *m, union instruction op ) { GLfloat *dst = m->File[0][op.msk.dst]; const GLfloat *arg = m->File[op.msk.file][op.msk.idx]; if (op.msk.mask & 0x1) dst[0] = arg[0]; if (op.msk.mask & 0x2) dst[1] = arg[1]; if (op.msk.mask & 0x4) dst[2] = arg[2]; if (op.msk.mask & 0x8) dst[3] = arg[3]; } static void do_PRT( struct arb_vp_machine *m, union instruction op ) { const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; _mesa_printf("%d: %f %f %f %f\n", m->vtx_nr, arg0[0], arg0[1], arg0[2], arg0[3]); } /** * The traditional ALU and texturing instructions. All operate on * internal registers and ignore write masks and swizzling issues. */ static void do_ABS( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; result[0] = (arg0[0] < 0.0) ? -arg0[0] : arg0[0]; result[1] = (arg0[1] < 0.0) ? -arg0[1] : arg0[1]; result[2] = (arg0[2] < 0.0) ? -arg0[2] : arg0[2]; result[3] = (arg0[3] < 0.0) ? -arg0[3] : arg0[3]; } static void do_ADD( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; result[0] = arg0[0] + arg1[0]; result[1] = arg0[1] + arg1[1]; result[2] = arg0[2] + arg1[2]; result[3] = arg0[3] + arg1[3]; } static void do_DP3( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; result[0] = (arg0[0] * arg1[0] + arg0[1] * arg1[1] + arg0[2] * arg1[2]); PUFF(result); } static void do_DP4( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; result[0] = (arg0[0] * arg1[0] + arg0[1] * arg1[1] + arg0[2] * arg1[2] + arg0[3] * arg1[3]); PUFF(result); } static void do_DPH( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; result[0] = (arg0[0] * arg1[0] + arg0[1] * arg1[1] + arg0[2] * arg1[2] + 1.0 * arg1[3]); PUFF(result); } static void do_DST( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; /* This should be ok even if result == arg0 or result == arg1. */ result[0] = 1.0F; result[1] = arg0[1] * arg1[1]; result[2] = arg0[2]; result[3] = arg1[3]; } /* Intended to be high precision: */ static void do_EX2( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; result[0] = (GLfloat)ApproxExp2(arg0[0]); PUFF(result); } /* Allowed to be lower precision: */ static void do_EXP( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; GLfloat tmp = arg0[0]; GLfloat flr_tmp = FLOORF(tmp); GLfloat frac_tmp = tmp - flr_tmp; result[0] = LDEXPF(1.0, (int)flr_tmp); result[1] = frac_tmp; result[2] = LDEXPF(rough_approx_log2_0_1(frac_tmp), (int)flr_tmp); result[3] = 1.0F; } static void do_FLR( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; result[0] = FLOORF(arg0[0]); result[1] = FLOORF(arg0[1]); result[2] = FLOORF(arg0[2]); result[3] = FLOORF(arg0[3]); } static void do_FRC( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; result[0] = arg0[0] - FLOORF(arg0[0]); result[1] = arg0[1] - FLOORF(arg0[1]); result[2] = arg0[2] - FLOORF(arg0[2]); result[3] = arg0[3] - FLOORF(arg0[3]); } /* High precision log base 2: */ static void do_LG2( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; result[0] = ApproxLog2(arg0[0]); PUFF(result); } static void do_LIT( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; GLfloat tmp[4]; tmp[0] = 1.0; tmp[1] = arg0[0]; if (arg0[0] > 0.0) { tmp[2] = RoughApproxPower(arg0[1], arg0[3]); } else { tmp[2] = 0.0; } tmp[3] = 1.0; COPY_4V(result, tmp); } /* Intended to allow a lower precision than required for LG2 above. */ static void do_LOG( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; GLfloat tmp = FABSF(arg0[0]); int exponent; GLfloat mantissa = FREXPF(tmp, &exponent); result[0] = (GLfloat) (exponent - 1); result[1] = 2.0 * mantissa; /* map [.5, 1) -> [1, 2) */ result[2] = exponent + LOG2(mantissa); result[3] = 1.0; } static void do_MAX( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; result[0] = (arg0[0] > arg1[0]) ? arg0[0] : arg1[0]; result[1] = (arg0[1] > arg1[1]) ? arg0[1] : arg1[1]; result[2] = (arg0[2] > arg1[2]) ? arg0[2] : arg1[2]; result[3] = (arg0[3] > arg1[3]) ? arg0[3] : arg1[3]; } static void do_MIN( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; result[0] = (arg0[0] < arg1[0]) ? arg0[0] : arg1[0]; result[1] = (arg0[1] < arg1[1]) ? arg0[1] : arg1[1]; result[2] = (arg0[2] < arg1[2]) ? arg0[2] : arg1[2]; result[3] = (arg0[3] < arg1[3]) ? arg0[3] : arg1[3]; } static void do_MOV( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; result[0] = arg0[0]; result[1] = arg0[1]; result[2] = arg0[2]; result[3] = arg0[3]; } static void do_MUL( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; result[0] = arg0[0] * arg1[0]; result[1] = arg0[1] * arg1[1]; result[2] = arg0[2] * arg1[2]; result[3] = arg0[3] * arg1[3]; } /* Intended to be "high" precision */ static void do_POW( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; result[0] = (GLfloat)ApproxPower(arg0[0], arg1[0]); PUFF(result); } static void do_REL( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; GLuint idx = (op.alu.idx0 + (GLint)m->File[0][REG_ADDR][0]) & (MAX_NV_VERTEX_PROGRAM_PARAMS-1); const GLfloat *arg0 = m->File[op.alu.file0][idx]; result[0] = arg0[0]; result[1] = arg0[1]; result[2] = arg0[2]; result[3] = arg0[3]; } static void do_RCP( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; result[0] = 1.0F / arg0[0]; PUFF(result); } static void do_RSQ( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; result[0] = INV_SQRTF(FABSF(arg0[0])); PUFF(result); } static void do_SGE( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; result[0] = (arg0[0] >= arg1[0]) ? 1.0F : 0.0F; result[1] = (arg0[1] >= arg1[1]) ? 1.0F : 0.0F; result[2] = (arg0[2] >= arg1[2]) ? 1.0F : 0.0F; result[3] = (arg0[3] >= arg1[3]) ? 1.0F : 0.0F; } static void do_SLT( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; result[0] = (arg0[0] < arg1[0]) ? 1.0F : 0.0F; result[1] = (arg0[1] < arg1[1]) ? 1.0F : 0.0F; result[2] = (arg0[2] < arg1[2]) ? 1.0F : 0.0F; result[3] = (arg0[3] < arg1[3]) ? 1.0F : 0.0F; } static void do_SUB( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; result[0] = arg0[0] - arg1[0]; result[1] = arg0[1] - arg1[1]; result[2] = arg0[2] - arg1[2]; result[3] = arg0[3] - arg1[3]; } static void do_XPD( struct arb_vp_machine *m, union instruction op ) { GLfloat *result = m->File[0][op.alu.dst]; const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0]; const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1]; GLfloat tmp[3]; tmp[0] = arg0[1] * arg1[2] - arg0[2] * arg1[1]; tmp[1] = arg0[2] * arg1[0] - arg0[0] * arg1[2]; tmp[2] = arg0[0] * arg1[1] - arg0[1] * arg1[0]; /* Need a temporary to be correct in the case where result == arg0 * or result == arg1. */ result[0] = tmp[0]; result[1] = tmp[1]; result[2] = tmp[2]; } static void do_NOP( struct arb_vp_machine *m, union instruction op ) { } /* Some useful debugging functions: */ static void print_mask( GLuint mask ) { _mesa_printf("."); if (mask&0x1) _mesa_printf("x"); if (mask&0x2) _mesa_printf("y"); if (mask&0x4) _mesa_printf("z"); if (mask&0x8) _mesa_printf("w"); } static void print_reg( GLuint file, GLuint reg ) { static const char *reg_file[] = { "REG", "LOCAL_PARAM", "ENV_PARAM", "STATE_VAR", }; if (file == 0) { if (reg == REG_RES) _mesa_printf("RES"); else if (reg >= REG_ARG0 && reg <= REG_ARG1) _mesa_printf("ARG%d", reg - REG_ARG0); else if (reg >= REG_TMP0 && reg <= REG_TMP11) _mesa_printf("TMP%d", reg - REG_TMP0); else if (reg >= REG_IN0 && reg <= REG_IN31) _mesa_printf("IN%d", reg - REG_IN0); else if (reg >= REG_OUT0 && reg <= REG_OUT14) _mesa_printf("OUT%d", reg - REG_OUT0); else if (reg == REG_ADDR) _mesa_printf("ADDR"); else if (reg == REG_ID) _mesa_printf("ID"); else _mesa_printf("REG%d", reg); } else _mesa_printf("%s:%d", reg_file[file], reg); } static void print_RSW( union instruction op, const struct opcode_info *info ) { GLuint swz = op.rsw.swz; GLuint neg = op.rsw.neg; GLuint i; _mesa_printf("%s ", info->string); print_reg(0, op.rsw.dst); _mesa_printf(", "); print_reg(op.rsw.file0, op.rsw.idx0); _mesa_printf("."); for (i = 0; i < 4; i++, swz >>= 2) { const char *cswz = "xyzw"; if (neg & (1<string); print_reg(0, op.alu.dst); _mesa_printf(", "); print_reg(op.alu.file0, op.alu.idx0); if (info->nr_args > 1) { _mesa_printf(", "); print_reg(op.alu.file1, op.alu.idx1); } _mesa_printf("\n"); } static void print_MSK( union instruction op, const struct opcode_info *info ) { _mesa_printf("%s ", info->string); print_reg(0, op.msk.dst); print_mask(op.msk.mask); _mesa_printf(", "); print_reg(op.msk.file, op.msk.idx); _mesa_printf("\n"); } static void print_NOP( union instruction op, const struct opcode_info *info ) { } #define NOP 0 #define ALU 1 #define SWZ 2 static const struct opcode_info opcode_info[] = { { 1, "ABS", print_ALU }, { 2, "ADD", print_ALU }, { 1, "ARL", print_NOP }, { 2, "DP3", print_ALU }, { 2, "DP4", print_ALU }, { 2, "DPH", print_ALU }, { 2, "DST", print_ALU }, { 0, "END", print_NOP }, { 1, "EX2", print_ALU }, { 1, "EXP", print_ALU }, { 1, "FLR", print_ALU }, { 1, "FRC", print_ALU }, { 1, "LG2", print_ALU }, { 1, "LIT", print_ALU }, { 1, "LOG", print_ALU }, { 3, "MAD", print_NOP }, { 2, "MAX", print_ALU }, { 2, "MIN", print_ALU }, { 1, "MOV", print_ALU }, { 2, "MUL", print_ALU }, { 2, "POW", print_ALU }, { 1, "PRT", print_ALU }, /* PRINT */ { 1, "RCC", print_NOP }, { 1, "RCP", print_ALU }, { 1, "RSQ", print_ALU }, { 2, "SGE", print_ALU }, { 2, "SLT", print_ALU }, { 2, "SUB", print_ALU }, { 1, "SWZ", print_NOP }, { 2, "XPD", print_ALU }, { 1, "RSW", print_RSW }, { 2, "MSK", print_MSK }, { 1, "REL", print_ALU }, }; void _tnl_disassem_vba_insn( union instruction op ) { const struct opcode_info *info = &opcode_info[op.alu.opcode]; info->print( op, info ); } static void (* const opcode_func[])(struct arb_vp_machine *, union instruction) = { do_ABS, do_ADD, do_NOP, do_DP3, do_DP4, do_DPH, do_DST, do_NOP, do_EX2, do_EXP, do_FLR, do_FRC, do_LG2, do_LIT, do_LOG, do_NOP, do_MAX, do_MIN, do_MOV, do_MUL, do_POW, do_PRT, do_NOP, do_RCP, do_RSQ, do_SGE, do_SLT, do_SUB, do_RSW, do_XPD, do_RSW, do_MSK, do_REL, }; static union instruction *cvp_next_instruction( struct compilation *cp ) { union instruction *op = cp->csr++; op->dword = 0; return op; } static struct reg cvp_make_reg( GLuint file, GLuint idx ) { struct reg reg; reg.file = file; reg.idx = idx; return reg; } static struct reg cvp_emit_rel( struct compilation *cp, struct reg reg, struct reg tmpreg ) { union instruction *op = cvp_next_instruction(cp); op->alu.opcode = REL; op->alu.file0 = reg.file; op->alu.idx0 = reg.idx; op->alu.dst = tmpreg.idx; return tmpreg; } static struct reg cvp_load_reg( struct compilation *cp, GLuint file, GLuint index, GLuint rel, GLuint tmpidx ) { struct reg tmpreg = cvp_make_reg(FILE_REG, tmpidx); struct reg reg; switch (file) { case PROGRAM_TEMPORARY: return cvp_make_reg(FILE_REG, REG_TMP0 + index); case PROGRAM_INPUT: return cvp_make_reg(FILE_REG, REG_IN0 + index); case PROGRAM_OUTPUT: return cvp_make_reg(FILE_REG, REG_OUT0 + index); /* These two aren't populated by the parser? */ case PROGRAM_LOCAL_PARAM: reg = cvp_make_reg(FILE_LOCAL_PARAM, index); if (rel) return cvp_emit_rel(cp, reg, tmpreg); else return reg; case PROGRAM_ENV_PARAM: reg = cvp_make_reg(FILE_ENV_PARAM, index); if (rel) return cvp_emit_rel(cp, reg, tmpreg); else return reg; case PROGRAM_STATE_VAR: reg = cvp_make_reg(FILE_STATE_PARAM, index); if (rel) return cvp_emit_rel(cp, reg, tmpreg); else return reg; /* Invalid values: */ case PROGRAM_WRITE_ONLY: case PROGRAM_ADDRESS: default: assert(0); return tmpreg; /* can't happen */ } } static struct reg cvp_emit_arg( struct compilation *cp, const struct vp_src_register *src, GLuint arg ) { struct reg reg = cvp_load_reg( cp, src->File, src->Index, src->RelAddr, arg ); union instruction rsw, noop; /* Emit any necessary swizzling. */ rsw.dword = 0; rsw.rsw.neg = src->Negate ? WRITEMASK_XYZW : 0; rsw.rsw.swz = ((GET_SWZ(src->Swizzle, 0) << 0) | (GET_SWZ(src->Swizzle, 1) << 2) | (GET_SWZ(src->Swizzle, 2) << 4) | (GET_SWZ(src->Swizzle, 3) << 6)); noop.dword = 0; noop.rsw.neg = 0; noop.rsw.swz = RSW_NOOP; if (rsw.dword != noop.dword) { union instruction *op = cvp_next_instruction(cp); struct reg rsw_reg = cvp_make_reg(FILE_REG, REG_ARG0 + arg); op->dword = rsw.dword; op->rsw.opcode = RSW; op->rsw.file0 = reg.file; op->rsw.idx0 = reg.idx; op->rsw.dst = rsw_reg.idx; return rsw_reg; } else return reg; } static GLuint cvp_choose_result( struct compilation *cp, const struct vp_dst_register *dst, union instruction *fixup ) { GLuint mask = dst->WriteMask; GLuint idx; switch (dst->File) { case PROGRAM_TEMPORARY: idx = REG_TMP0 + dst->Index; break; case PROGRAM_OUTPUT: idx = REG_OUT0 + dst->Index; break; default: assert(0); return REG_RES; /* can't happen */ } /* Optimization: When writing (with a writemask) to an undefined * value for the first time, the writemask may be ignored. */ if (mask != WRITEMASK_XYZW && (cp->reg_active & (1 << idx))) { fixup->msk.opcode = MSK; fixup->msk.dst = idx; fixup->msk.file = FILE_REG; fixup->msk.idx = REG_RES; fixup->msk.mask = mask; cp->reg_active |= 1 << idx; return REG_RES; } else { fixup->dword = 0; cp->reg_active |= 1 << idx; return idx; } } static struct reg cvp_emit_rsw( struct compilation *cp, GLuint dst, struct reg src, GLuint neg, GLuint swz, GLboolean force) { struct reg retval; if (swz != RSW_NOOP || neg != 0) { union instruction *op = cvp_next_instruction(cp); op->rsw.opcode = RSW; op->rsw.dst = dst; op->rsw.file0 = src.file; op->rsw.idx0 = src.idx; op->rsw.neg = neg; op->rsw.swz = swz; retval.file = FILE_REG; retval.idx = dst; return retval; } else if (force) { /* Oops. Degenerate case: */ union instruction *op = cvp_next_instruction(cp); op->alu.opcode = VP_OPCODE_MOV; op->alu.dst = dst; op->alu.file0 = src.file; op->alu.idx0 = src.idx; retval.file = FILE_REG; retval.idx = dst; return retval; } else { return src; } } static void cvp_emit_inst( struct compilation *cp, const struct vp_instruction *inst ) { const struct opcode_info *info = &opcode_info[inst->Opcode]; union instruction *op; union instruction fixup; struct reg reg[3]; GLuint result, i; assert(sizeof(*op) == sizeof(GLuint)); /* Need to handle SWZ, ARL specially. */ switch (inst->Opcode) { /* Split into mul and add: */ case VP_OPCODE_MAD: result = cvp_choose_result( cp, &inst->DstReg, &fixup ); for (i = 0; i < 3; i++) reg[i] = cvp_emit_arg( cp, &inst->SrcReg[i], REG_ARG0+i ); op = cvp_next_instruction(cp); op->alu.opcode = VP_OPCODE_MUL; op->alu.file0 = reg[0].file; op->alu.idx0 = reg[0].idx; op->alu.file1 = reg[1].file; op->alu.idx1 = reg[1].idx; op->alu.dst = REG_ARG0; op = cvp_next_instruction(cp); op->alu.opcode = VP_OPCODE_ADD; op->alu.file0 = FILE_REG; op->alu.idx0 = REG_ARG0; op->alu.file1 = reg[2].file; op->alu.idx1 = reg[2].idx; op->alu.dst = result; if (result == REG_RES) { op = cvp_next_instruction(cp); op->dword = fixup.dword; } break; case VP_OPCODE_ARL: reg[0] = cvp_emit_arg( cp, &inst->SrcReg[0], REG_ARG0 ); op = cvp_next_instruction(cp); op->alu.opcode = VP_OPCODE_FLR; op->alu.dst = REG_ADDR; op->alu.file0 = reg[0].file; op->alu.idx0 = reg[0].idx; break; case VP_OPCODE_SWZ: { GLuint swz0 = 0, swz1 = 0; GLuint neg0 = 0, neg1 = 0; GLuint mask = 0; /* Translate 3-bit-per-element swizzle into two 2-bit swizzles, * one from the source register the other from a constant * {0,0,0,1}. */ for (i = 0; i < 4; i++) { GLuint swzelt = GET_SWZ(inst->SrcReg[0].Swizzle, i); if (swzelt >= SWIZZLE_ZERO) { neg0 |= inst->SrcReg[0].Negate & (1<SrcReg[0].Negate & (1<DstReg, &fixup ); reg[0].file = FILE_REG; reg[0].idx = REG_ID; reg[1] = cvp_emit_arg( cp, &inst->SrcReg[0], REG_ARG0 ); if (mask == WRITEMASK_XYZW) { cvp_emit_rsw(cp, result, reg[0], neg0, swz0, GL_TRUE); } else if (mask == 0) { cvp_emit_rsw(cp, result, reg[1], neg1, swz1, GL_TRUE); } else { cvp_emit_rsw(cp, result, reg[0], neg0, swz0, GL_TRUE); reg[1] = cvp_emit_rsw(cp, REG_ARG0, reg[1], neg1, swz1, GL_FALSE); op = cvp_next_instruction(cp); op->msk.opcode = MSK; op->msk.dst = result; op->msk.file = reg[1].file; op->msk.idx = reg[1].idx; op->msk.mask = mask; } if (result == REG_RES) { op = cvp_next_instruction(cp); op->dword = fixup.dword; } break; } case VP_OPCODE_END: break; default: result = cvp_choose_result( cp, &inst->DstReg, &fixup ); for (i = 0; i < info->nr_args; i++) reg[i] = cvp_emit_arg( cp, &inst->SrcReg[i], REG_ARG0 + i ); op = cvp_next_instruction(cp); op->alu.opcode = inst->Opcode; op->alu.file0 = reg[0].file; op->alu.idx0 = reg[0].idx; op->alu.file1 = reg[1].file; op->alu.idx1 = reg[1].idx; op->alu.dst = result; if (result == REG_RES) { op = cvp_next_instruction(cp); op->dword = fixup.dword; } break; } } static void free_tnl_data( struct vertex_program *program ) { struct tnl_compiled_program *p = program->TnlData; if (p->compiled_func) _mesa_free((void *)p->compiled_func); _mesa_free(p); program->TnlData = NULL; } static void compile_vertex_program( struct vertex_program *program, GLboolean try_codegen ) { struct compilation cp; struct tnl_compiled_program *p = CALLOC_STRUCT(tnl_compiled_program); GLuint i; if (program->TnlData) free_tnl_data( program ); program->TnlData = p; /* Initialize cp. Note that ctx and VB aren't used in compilation * so we don't have to worry about statechanges: */ _mesa_memset(&cp, 0, sizeof(cp)); cp.csr = p->instructions; /* Compile instructions: */ for (i = 0; i < program->Base.NumInstructions; i++) { cvp_emit_inst(&cp, &program->Instructions[i]); } /* Finish up: */ p->nr_instructions = cp.csr - p->instructions; /* Print/disassemble: */ if (DISASSEM) { for (i = 0; i < p->nr_instructions; i++) { _tnl_disassem_vba_insn(p->instructions[i]); } _mesa_printf("\n\n"); } #ifdef USE_SSE_ASM if (try_codegen) _tnl_sse_codegen_vertex_program(p); #endif } /* ---------------------------------------------------------------------- * Execution */ static void userclip( GLcontext *ctx, GLvector4f *clip, GLubyte *clipmask, GLubyte *clipormask, GLubyte *clipandmask ) { GLuint p; for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { GLuint nr, i; const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; GLfloat *coord = (GLfloat *)clip->data; GLuint stride = clip->stride; GLuint count = clip->count; for (nr = 0, i = 0 ; i < count ; i++) { GLfloat dp = (coord[0] * a + coord[1] * b + coord[2] * c + coord[3] * d); if (dp < 0) { nr++; clipmask[i] |= CLIP_USER_BIT; } STRIDE_F(coord, stride); } if (nr > 0) { *clipormask |= CLIP_USER_BIT; if (nr == count) { *clipandmask |= CLIP_USER_BIT; return; } } } } } static GLboolean do_ndc_cliptest( struct arb_vp_machine *m ) { GLcontext *ctx = m->ctx; TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = m->VB; /* Cliptest and perspective divide. Clip functions must clear * the clipmask. */ m->ormask = 0; m->andmask = CLIP_ALL_BITS; if (tnl->NeedNdcCoords) { VB->NdcPtr = _mesa_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, &m->ndcCoords, m->clipmask, &m->ormask, &m->andmask ); } else { VB->NdcPtr = NULL; _mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr, NULL, m->clipmask, &m->ormask, &m->andmask ); } if (m->andmask) { /* All vertices are outside the frustum */ return GL_FALSE; } /* Test userclip planes. This contributes to VB->ClipMask. */ if (ctx->Transform.ClipPlanesEnabled && !ctx->VertexProgram._Enabled) { userclip( ctx, VB->ClipPtr, m->clipmask, &m->ormask, &m->andmask ); if (m->andmask) { return GL_FALSE; } } VB->ClipAndMask = m->andmask; VB->ClipOrMask = m->ormask; VB->ClipMask = m->clipmask; return GL_TRUE; } static INLINE void call_func( struct tnl_compiled_program *p, struct arb_vp_machine *m ) { p->compiled_func(m); } /** * Execute the given vertex program. * * TODO: Integrate the t_vertex.c code here, to build machine vertices * directly at this point. * * TODO: Eliminate the VB struct entirely and just use * struct arb_vertex_machine. */ static GLboolean run_arb_vertex_program(GLcontext *ctx, struct tnl_pipeline_stage *stage) { struct vertex_program *program = (ctx->VertexProgram._Enabled ? ctx->VertexProgram.Current : ctx->_TnlProgram); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct arb_vp_machine *m = ARB_VP_MACHINE(stage); struct tnl_compiled_program *p; GLuint i, j, outputs; if (!program || program->IsNVProgram) return GL_TRUE; if (program->Parameters) { _mesa_load_state_parameters(ctx, program->Parameters); } p = (struct tnl_compiled_program *)program->TnlData; assert(p); m->nr_inputs = m->nr_outputs = 0; for (i = 0; i < _TNL_ATTRIB_MAX; i++) { if (program->InputsRead & (1<nr_inputs++; m->input[j].idx = i; m->input[j].data = (GLfloat *)m->VB->AttribPtr[i]->data; m->input[j].stride = m->VB->AttribPtr[i]->stride; m->input[j].size = m->VB->AttribPtr[i]->size; ASSIGN_4V(m->File[0][REG_IN0 + i], 0, 0, 0, 1); } } for (i = 0; i < 15; i++) { if (program->OutputsWritten & (1<nr_outputs++; m->output[j].idx = i; m->output[j].data = (GLfloat *)m->attribs[i].data; } } /* Run the actual program: */ for (m->vtx_nr = 0; m->vtx_nr < VB->Count; m->vtx_nr++) { for (j = 0; j < m->nr_inputs; j++) { GLuint idx = REG_IN0 + m->input[j].idx; switch (m->input[j].size) { case 4: m->File[0][idx][3] = m->input[j].data[3]; case 3: m->File[0][idx][2] = m->input[j].data[2]; case 2: m->File[0][idx][1] = m->input[j].data[1]; case 1: m->File[0][idx][0] = m->input[j].data[0]; } STRIDE_F(m->input[j].data, m->input[j].stride); } if (p->compiled_func) { call_func( p, m ); } else { for (j = 0; j < p->nr_instructions; j++) { union instruction inst = p->instructions[j]; opcode_func[inst.alu.opcode]( m, inst ); } } for (j = 0; j < m->nr_outputs; j++) { GLuint idx = REG_OUT0 + m->output[j].idx; m->output[j].data[0] = m->File[0][idx][0]; m->output[j].data[1] = m->File[0][idx][1]; m->output[j].data[2] = m->File[0][idx][2]; m->output[j].data[3] = m->File[0][idx][3]; m->output[j].data += 4; } } /* Setup the VB pointers so that the next pipeline stages get * their data from the right place (the program output arrays). * * TODO: 1) Have tnl use these RESULT values for outputs rather * than trying to shoe-horn inputs and outputs into one set of * values. * * TODO: 2) Integrate t_vertex.c so that we just go straight ahead * and build machine vertices here. */ VB->ClipPtr = &m->attribs[VERT_RESULT_HPOS]; VB->ClipPtr->count = VB->Count; outputs = program->OutputsWritten; if (outputs & (1<ColorPtr[0] = &m->attribs[VERT_RESULT_COL0]; VB->AttribPtr[VERT_ATTRIB_COLOR0] = VB->ColorPtr[0]; } if (outputs & (1<ColorPtr[1] = &m->attribs[VERT_RESULT_BFC0]; } if (outputs & (1<SecondaryColorPtr[0] = &m->attribs[VERT_RESULT_COL1]; VB->AttribPtr[VERT_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0]; } if (outputs & (1<SecondaryColorPtr[1] = &m->attribs[VERT_RESULT_BFC1]; } if (outputs & (1<FogCoordPtr = &m->attribs[VERT_RESULT_FOGC]; VB->AttribPtr[VERT_ATTRIB_FOG] = VB->FogCoordPtr; } if (outputs & (1<PointSizePtr = &m->attribs[VERT_RESULT_PSIZ]; VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &m->attribs[VERT_RESULT_PSIZ]; } for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (outputs & (1<<(VERT_RESULT_TEX0+i))) { VB->TexCoordPtr[i] = &m->attribs[VERT_RESULT_TEX0 + i]; VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i]; } } #if 0 for (i = 0; i < VB->Count; i++) { printf("Out %d: %f %f %f %f %f %f %f %f\n", i, VEC_ELT(VB->ClipPtr, GLfloat, i)[0], VEC_ELT(VB->ClipPtr, GLfloat, i)[1], VEC_ELT(VB->ClipPtr, GLfloat, i)[2], VEC_ELT(VB->ClipPtr, GLfloat, i)[3], VEC_ELT(VB->TexCoordPtr[0], GLfloat, i)[0], VEC_ELT(VB->TexCoordPtr[0], GLfloat, i)[1], VEC_ELT(VB->TexCoordPtr[0], GLfloat, i)[2], VEC_ELT(VB->TexCoordPtr[0], GLfloat, i)[3]); } #endif /* Perform NDC and cliptest operations: */ return do_ndc_cliptest(m); } static void validate_vertex_program( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { struct arb_vp_machine *m = ARB_VP_MACHINE(stage); struct vertex_program *program = (ctx->VertexProgram._Enabled ? ctx->VertexProgram.Current : 0); if (!program && ctx->_MaintainTnlProgram) { program = ctx->_TnlProgram; } if (program) { if (!program->TnlData) compile_vertex_program( program, m->try_codegen ); /* Grab the state GL state and put into registers: */ m->File[FILE_LOCAL_PARAM] = program->Base.LocalParams; m->File[FILE_ENV_PARAM] = ctx->VertexProgram.Parameters; /* GL_NV_vertex_programs can't reference GL state */ if (program->Parameters) m->File[FILE_STATE_PARAM] = program->Parameters->ParameterValues; else m->File[FILE_STATE_PARAM] = NULL; } } /** * Called the first time stage->run is called. In effect, don't * allocate data until the first time the stage is run. */ static GLboolean init_vertex_program( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &(tnl->vb); struct arb_vp_machine *m; const GLuint size = VB->Size; GLuint i; stage->privatePtr = _mesa_calloc(sizeof(*m)); m = ARB_VP_MACHINE(stage); if (!m) return GL_FALSE; /* arb_vertex_machine struct should subsume the VB: */ m->VB = VB; m->ctx = ctx; m->File[0] = ALIGN_MALLOC(REG_MAX * sizeof(GLfloat) * 4, 16); /* Initialize regs where necessary: */ ASSIGN_4V(m->File[0][REG_ID], 0, 0, 0, 1); ASSIGN_4V(m->File[0][REG_ONES], 1, 1, 1, 1); ASSIGN_4V(m->File[0][REG_SWZ], -1, 1, 0, 0); ASSIGN_4V(m->File[0][REG_NEG], -1, -1, -1, -1); ASSIGN_4V(m->File[0][REG_LIT], 1, 0, 0, 1); ASSIGN_4V(m->File[0][REG_LIT2], 1, .5, .2, 1); /* debug value */ if (_mesa_getenv("MESA_EXPERIMENTAL")) m->try_codegen = GL_TRUE; /* Allocate arrays of vertex output values */ for (i = 0; i < VERT_RESULT_MAX; i++) { _mesa_vector4f_alloc( &m->attribs[i], 0, size, 32 ); m->attribs[i].size = 4; } /* a few other misc allocations */ _mesa_vector4f_alloc( &m->ndcCoords, 0, size, 32 ); m->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); if (ctx->_MaintainTnlProgram) _mesa_allow_light_in_model( ctx, GL_FALSE ); m->fpucntl_rnd_neg = RND_NEG_FPU; /* const value */ m->fpucntl_restore = RESTORE_FPU; /* const value */ return GL_TRUE; } /** * Destructor for this pipeline stage. */ static void dtr( struct tnl_pipeline_stage *stage ) { struct arb_vp_machine *m = ARB_VP_MACHINE(stage); if (m) { GLuint i; /* free the vertex program result arrays */ for (i = 0; i < VERT_RESULT_MAX; i++) _mesa_vector4f_free( &m->attribs[i] ); /* free misc arrays */ _mesa_vector4f_free( &m->ndcCoords ); ALIGN_FREE( m->clipmask ); ALIGN_FREE( m->File[0] ); _mesa_free( m ); stage->privatePtr = NULL; } } /** * Public description of this pipeline stage. */ const struct tnl_pipeline_stage _tnl_arb_vertex_program_stage = { "vertex-program", NULL, /* private_data */ init_vertex_program, /* create */ dtr, /* destroy */ validate_vertex_program, /* validate */ run_arb_vertex_program /* run */ }; /** * Called via ctx->Driver.ProgramStringNotify() after a new vertex program * string has been parsed. */ void _tnl_program_string(GLcontext *ctx, GLenum target, struct program *program) { if (program->Target == GL_VERTEX_PROGRAM_ARB) { /* free any existing tnl data hanging off the program */ struct vertex_program *vprog = (struct vertex_program *) program; if (vprog->TnlData) { free_tnl_data(vprog); } } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_arbprogram.h0000644000000000000000000001156313614532424021337 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file t_arb_program.c * Compile vertex programs to an intermediate representation. * Execute vertex programs over a buffer of vertices. * \author Keith Whitwell, Brian Paul */ #ifndef _T_VB_ARBPROGRAM_H_ #define _T_VB_ARBPROGRAM_H_ /* New, internal instructions: */ #define RSW (VP_MAX_OPCODE) #define MSK (VP_MAX_OPCODE+1) #define REL (VP_MAX_OPCODE+2) /** * Register files for vertex programs */ #define FILE_REG 0 /* temporaries */ #define FILE_LOCAL_PARAM 1 /* local parameters */ #define FILE_ENV_PARAM 2 /* global parameters */ #define FILE_STATE_PARAM 3 /* GL state references */ #define REG_ARG0 0 #define REG_ARG1 1 #define REG_ARG2 2 #define REG_RES 3 #define REG_ADDR 4 #define REG_TMP0 5 #define REG_TMP11 16 #define REG_OUT0 17 #define REG_OUT14 31 #define REG_IN0 32 #define REG_IN31 63 #define REG_ID 64 /* 0,0,0,1 */ #define REG_ONES 65 /* 1,1,1,1 */ #define REG_SWZ 66 /* -1,1,0,0 */ #define REG_NEG 67 /* -1,-1,-1,-1 */ #define REG_LIT 68 /* 1,0,0,1 */ #define REG_LIT2 69 /* 1,0,0,1 */ #define REG_SCRATCH 70 /* internal temporary */ #define REG_UNDEF 127 /* special case - never used */ #define REG_MAX 128 #define REG_INVALID ~0 /* ARB_vp instructions are broken down into one or more of the * following micro-instructions, each representable in a 32 bit packed * structure. */ struct reg { GLuint file:2; GLuint idx:7; }; union instruction { struct { GLuint opcode:6; GLuint dst:5; GLuint file0:2; GLuint idx0:7; GLuint file1:2; GLuint idx1:7; GLuint pad:3; } alu; struct { GLuint opcode:6; GLuint dst:5; GLuint file0:2; GLuint idx0:7; GLuint neg:4; GLuint swz:8; /* xyzw only */ } rsw; struct { GLuint opcode:6; GLuint dst:5; GLuint file:2; GLuint idx:7; GLuint mask:4; GLuint pad:1; } msk; GLuint dword; }; #define RSW_NOOP ((0<<0) | (1<<2) | (2<<4) | (3<<6)) #define GET_RSW(swz, idx) (((swz) >> ((idx)*2)) & 0x3) struct input { GLuint idx; GLfloat *data; GLuint stride; GLuint size; }; struct output { GLuint idx; GLfloat *data; }; /*--------------------------------------------------------------------------- */ #if defined(USE_SSE_ASM) #ifdef NO_FAST_MATH #define RESTORE_FPU (DEFAULT_X86_FPU) #define RND_NEG_FPU (DEFAULT_X86_FPU | 0x400) #else #define RESTORE_FPU (FAST_X86_FPU) #define RND_NEG_FPU (FAST_X86_FPU | 0x400) #endif #else #define RESTORE_FPU 0 #define RND_NEG_FPU 0 #endif /*! * Private storage for the vertex program pipeline stage. */ struct arb_vp_machine { GLfloat (*File[4])[4]; /* All values referencable from the program. */ struct input input[_TNL_ATTRIB_MAX]; GLuint nr_inputs; struct output output[15]; GLuint nr_outputs; GLvector4f attribs[VERT_RESULT_MAX]; /**< result vectors. */ GLvector4f ndcCoords; /**< normalized device coords */ GLubyte *clipmask; /**< clip flags */ GLubyte ormask, andmask; /**< for clipping */ GLuint vtx_nr; /**< loop counter */ struct vertex_buffer *VB; GLcontext *ctx; GLshort fpucntl_rnd_neg; /* constant value */ GLshort fpucntl_restore; /* constant value */ GLboolean try_codegen; }; struct tnl_compiled_program { union instruction instructions[1024]; GLint nr_instructions; void (*compiled_func)( struct arb_vp_machine * ); /**< codegen'd program */ }; void _tnl_program_string_change( struct vertex_program * ); void _tnl_program_destroy( struct vertex_program * ); void _tnl_disassem_vba_insn( union instruction op ); GLboolean _tnl_sse_codegen_vertex_program(struct tnl_compiled_program *p); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_arbprogram_sse.c0000644000000000000000000010347213614532424022205 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file t_vb_arb_program_sse.c * * Translate simplified vertex_program representation to * x86/x87/SSE/SSE2 machine code using mesa's rtasm runtime assembler. * * This is very much a first attempt - build something that works. * There are probably better approaches for applying SSE to vertex * programs, and the whole thing is crying out for static analysis of * the programs to avoid redundant operations. * * \author Keith Whitwell */ #include "glheader.h" #include "context.h" #include "imports.h" #include "macros.h" #include "mtypes.h" #include "arbprogparse.h" #include "program.h" #include "math/m_matrix.h" #include "math/m_translate.h" #include "t_context.h" #include "t_vb_arbprogram.h" #if defined(USE_SSE_ASM) #include "x86/rtasm/x86sse.h" #include "x86/common_x86_asm.h" #define X 0 #define Y 1 #define Z 2 #define W 3 /* Reg usage: * * EAX - temp * EBX - point to 'm->File[0]' * ECX - point to 'm->File[3]' * EDX - holds 'm' * EBP, * ESI, * EDI */ #define DISASSEM 0 #define FAIL \ do { \ _mesa_printf("x86 translation failed in %s\n", __FUNCTION__); \ return GL_FALSE; \ } while (0) struct compilation { struct x86_function func; struct tnl_compiled_program *p; GLuint insn_counter; struct { GLuint file:2; GLuint idx:7; GLuint dirty:1; GLuint last_used:10; } xmm[8]; struct { struct x86_reg base; } file[4]; GLboolean have_sse2; GLshort fpucntl; }; static INLINE GLboolean eq( struct x86_reg a, struct x86_reg b ) { return (a.file == b.file && a.idx == b.idx && a.mod == b.mod && a.disp == b.disp); } static GLint get_offset( const void *a, const void *b ) { return (const char *)b - (const char *)a; } static struct x86_reg get_reg_ptr(GLuint file, GLuint idx ) { struct x86_reg reg; switch (file) { case FILE_REG: reg = x86_make_reg(file_REG32, reg_BX); assert(idx != REG_UNDEF); break; case FILE_STATE_PARAM: reg = x86_make_reg(file_REG32, reg_CX); break; default: assert(0); } return x86_make_disp(reg, 16 * idx); } static void spill( struct compilation *cp, GLuint idx ) { struct x86_reg oldval = get_reg_ptr(cp->xmm[idx].file, cp->xmm[idx].idx); assert(cp->xmm[idx].dirty); sse_movups(&cp->func, oldval, x86_make_reg(file_XMM, idx)); cp->xmm[idx].dirty = 0; } static struct x86_reg get_xmm_reg( struct compilation *cp ) { GLuint i; GLuint oldest = 0; for (i = 0; i < 8; i++) if (cp->xmm[i].last_used < cp->xmm[oldest].last_used) oldest = i; /* Need to write out the old value? */ if (cp->xmm[oldest].dirty) spill(cp, oldest); assert(cp->xmm[oldest].last_used != cp->insn_counter); cp->xmm[oldest].file = FILE_REG; cp->xmm[oldest].idx = REG_UNDEF; cp->xmm[oldest].last_used = cp->insn_counter; return x86_make_reg(file_XMM, oldest); } static void invalidate_xmm( struct compilation *cp, GLuint file, GLuint idx ) { GLuint i; /* Invalidate any old copy of this register in XMM0-7. */ for (i = 0; i < 8; i++) { if (cp->xmm[i].file == file && cp->xmm[i].idx == idx) { cp->xmm[i].file = FILE_REG; cp->xmm[i].idx = REG_UNDEF; cp->xmm[i].dirty = 0; break; } } } /* Return an XMM reg to receive the results of an operation. */ static struct x86_reg get_dst_xmm_reg( struct compilation *cp, GLuint file, GLuint idx ) { struct x86_reg reg; /* Invalidate any old copy of this register in XMM0-7. Don't reuse * as this may be one of the arguments. */ invalidate_xmm( cp, file, idx ); reg = get_xmm_reg( cp ); cp->xmm[reg.idx].file = file; cp->xmm[reg.idx].idx = idx; cp->xmm[reg.idx].dirty = 1; return reg; } /* As above, but return a pointer. Note - this pointer may alias * those returned by get_arg_ptr(). */ static struct x86_reg get_dst_ptr( struct compilation *cp, GLuint file, GLuint idx ) { /* Invalidate any old copy of this register in XMM0-7. Don't reuse * as this may be one of the arguments. */ invalidate_xmm( cp, file, idx ); return get_reg_ptr(file, idx); } /* Return an XMM reg if the argument is resident, otherwise return a * base+offset pointer to the saved value. */ static struct x86_reg get_arg( struct compilation *cp, GLuint file, GLuint idx ) { GLuint i; for (i = 0; i < 8; i++) { if (cp->xmm[i].file == file && cp->xmm[i].idx == idx) { cp->xmm[i].last_used = cp->insn_counter; return x86_make_reg(file_XMM, i); } } return get_reg_ptr(file, idx); } /* As above, but always return a pointer: */ static struct x86_reg get_arg_ptr( struct compilation *cp, GLuint file, GLuint idx ) { GLuint i; /* If there is a modified version of this register in one of the * XMM regs, write it out to memory. */ for (i = 0; i < 8; i++) { if (cp->xmm[i].file == file && cp->xmm[i].idx == idx && cp->xmm[i].dirty) spill(cp, i); } return get_reg_ptr(file, idx); } /* Emulate pshufd insn in regular SSE, if necessary: */ static void emit_pshufd( struct compilation *cp, struct x86_reg dst, struct x86_reg arg0, GLubyte shuf ) { if (cp->have_sse2) { sse2_pshufd(&cp->func, dst, arg0, shuf); cp->func.fn = 0; } else { if (!eq(dst, arg0)) sse_movups(&cp->func, dst, arg0); sse_shufps(&cp->func, dst, dst, shuf); } } static void set_fpu_round_neg_inf( struct compilation *cp ) { if (cp->fpucntl != RND_NEG_FPU) { struct x86_reg regEDX = x86_make_reg(file_REG32, reg_DX); struct arb_vp_machine *m = NULL; cp->fpucntl = RND_NEG_FPU; x87_fnclex(&cp->func); x87_fldcw(&cp->func, x86_make_disp(regEDX, get_offset(m, &m->fpucntl_rnd_neg))); } } /* Perform a reduced swizzle. */ static GLboolean emit_RSW( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.rsw.file0, op.rsw.idx0); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.rsw.dst); GLuint swz = op.rsw.swz; GLuint neg = op.rsw.neg; emit_pshufd(cp, dst, arg0, swz); if (neg) { struct x86_reg negs = get_arg(cp, FILE_REG, REG_SWZ); struct x86_reg tmp = get_xmm_reg(cp); /* Load 1,-1,0,0 * Use neg as arg to pshufd * Multiply */ emit_pshufd(cp, tmp, negs, SHUF((neg & 1) ? 1 : 0, (neg & 2) ? 1 : 0, (neg & 4) ? 1 : 0, (neg & 8) ? 1 : 0)); sse_mulps(&cp->func, dst, tmp); } return GL_TRUE; } /* Helper for writemask: */ static GLboolean emit_shuf_copy1( struct compilation *cp, struct x86_reg dst, struct x86_reg arg0, struct x86_reg arg1, GLubyte shuf ) { struct x86_reg tmp = get_xmm_reg(cp); sse_movups(&cp->func, dst, arg1); emit_pshufd(cp, dst, dst, shuf); emit_pshufd(cp, tmp, arg0, shuf); sse_movss(&cp->func, dst, tmp); emit_pshufd(cp, dst, dst, shuf); return GL_TRUE; } /* Helper for writemask: */ static GLboolean emit_shuf_copy2( struct compilation *cp, struct x86_reg dst, struct x86_reg arg0, struct x86_reg arg1, GLubyte shuf ) { struct x86_reg tmp = get_xmm_reg(cp); emit_pshufd(cp, dst, arg1, shuf); emit_pshufd(cp, tmp, arg0, shuf); sse_shufps(&cp->func, dst, tmp, SHUF(X, Y, Z, W)); emit_pshufd(cp, dst, dst, shuf); return GL_TRUE; } static void emit_x87_ex2( struct compilation *cp ) { struct x86_reg st0 = x86_make_reg(file_x87, 0); struct x86_reg st1 = x86_make_reg(file_x87, 1); struct x86_reg st3 = x86_make_reg(file_x87, 3); set_fpu_round_neg_inf( cp ); x87_fld(&cp->func, st0); /* a a */ x87_fprndint( &cp->func ); /* int(a) a */ x87_fld(&cp->func, st0); /* int(a) int(a) a */ x87_fstp(&cp->func, st3); /* int(a) a int(a)*/ x87_fsubp(&cp->func, st1); /* frac(a) int(a) */ x87_f2xm1(&cp->func); /* (2^frac(a))-1 int(a)*/ x87_fld1(&cp->func); /* 1 (2^frac(a))-1 int(a)*/ x87_faddp(&cp->func, st1); /* 2^frac(a) int(a) */ x87_fscale(&cp->func); /* 2^a */ } #if 0 static GLboolean emit_MSK2( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.msk.file, op.msk.arg); struct x86_reg arg1 = get_arg(cp, FILE_REG, op.msk.dst); /* NOTE! */ struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.msk.dst); /* make full width bitmask in tmp * dst = ~tmp * tmp &= arg0 * dst &= arg1 * dst |= tmp */ emit_pshufd(cp, tmp, get_arg(cp, FILE_REG, REG_NEGS), SHUF((op.msk.mask & 1) ? 2 : 0, (op.msk.mask & 2) ? 2 : 0, (op.msk.mask & 4) ? 2 : 0, (op.msk.mask & 8) ? 2 : 0)); sse2_pnot(&cp->func, dst, tmp); sse2_pand(&cp->func, arg0, tmp); sse2_pand(&cp->func, arg1, dst); sse2_por(&cp->func, tmp, dst); return GL_TRUE; } #endif /* Used to implement write masking. This and most of the other instructions * here would be easier to implement if there had been a translation * to a 2 argument format (dst/arg0, arg1) at the shader level before * attempting to translate to x86/sse code. */ static GLboolean emit_MSK( struct compilation *cp, union instruction op ) { struct x86_reg arg = get_arg(cp, op.msk.file, op.msk.idx); struct x86_reg dst0 = get_arg(cp, FILE_REG, op.msk.dst); /* NOTE! */ struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.msk.dst); /* Note that dst and dst0 refer to the same program variable, but * will definitely be different XMM registers. We're effectively * treating this as a 2 argument SEL now, just one of which happens * always to be the same register as the destination. */ switch (op.msk.mask) { case 0: sse_movups(&cp->func, dst, dst0); return GL_TRUE; case WRITEMASK_X: if (arg.file == file_XMM) { sse_movups(&cp->func, dst, dst0); sse_movss(&cp->func, dst, arg); } else { struct x86_reg tmp = get_xmm_reg(cp); sse_movups(&cp->func, dst, dst0); sse_movss(&cp->func, tmp, arg); sse_movss(&cp->func, dst, tmp); } return GL_TRUE; case WRITEMASK_XY: sse_movups(&cp->func, dst, dst0); sse_shufps(&cp->func, dst, arg, SHUF(X, Y, Z, W)); return GL_TRUE; case WRITEMASK_ZW: sse_movups(&cp->func, dst, arg); sse_shufps(&cp->func, dst, dst0, SHUF(X, Y, Z, W)); return GL_TRUE; case WRITEMASK_YZW: if (dst0.file == file_XMM) { sse_movups(&cp->func, dst, arg); sse_movss(&cp->func, dst, dst0); } else { struct x86_reg tmp = get_xmm_reg(cp); sse_movups(&cp->func, dst, arg); sse_movss(&cp->func, tmp, dst0); sse_movss(&cp->func, dst, tmp); } return GL_TRUE; case WRITEMASK_Y: emit_shuf_copy1(cp, dst, arg, dst0, SHUF(Y,X,Z,W)); return GL_TRUE; case WRITEMASK_Z: emit_shuf_copy1(cp, dst, arg, dst0, SHUF(Z,Y,X,W)); return GL_TRUE; case WRITEMASK_W: emit_shuf_copy1(cp, dst, arg, dst0, SHUF(W,Y,Z,X)); return GL_TRUE; case WRITEMASK_XZ: emit_shuf_copy2(cp, dst, arg, dst0, SHUF(X,Z,Y,W)); return GL_TRUE; case WRITEMASK_XW: emit_shuf_copy2(cp, dst, arg, dst0, SHUF(X,W,Z,Y)); case WRITEMASK_YZ: emit_shuf_copy2(cp, dst, arg, dst0, SHUF(Z,Y,X,W)); return GL_TRUE; case WRITEMASK_YW: emit_shuf_copy2(cp, dst, arg, dst0, SHUF(W,Y,Z,X)); return GL_TRUE; case WRITEMASK_XZW: emit_shuf_copy1(cp, dst, dst0, arg, SHUF(Y,X,Z,W)); return GL_TRUE; case WRITEMASK_XYW: emit_shuf_copy1(cp, dst, dst0, arg, SHUF(Z,Y,X,W)); return GL_TRUE; case WRITEMASK_XYZ: emit_shuf_copy1(cp, dst, dst0, arg, SHUF(W,Y,Z,X)); return GL_TRUE; case WRITEMASK_XYZW: sse_movups(&cp->func, dst, arg); return GL_TRUE; default: assert(0); break; } } static GLboolean emit_PRT( struct compilation *cp, union instruction op ) { FAIL; } /** * The traditional instructions. All operate on internal registers * and ignore write masks and swizzling issues. */ static GLboolean emit_ABS( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); struct x86_reg neg = get_reg_ptr(FILE_REG, REG_NEG); sse_movups(&cp->func, dst, arg0); sse_mulps(&cp->func, dst, neg); sse_maxps(&cp->func, dst, arg0); return GL_TRUE; } static GLboolean emit_ADD( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); sse_movups(&cp->func, dst, arg0); sse_addps(&cp->func, dst, arg1); return GL_TRUE; } /* The dotproduct instructions don't really do that well in sse: */ static GLboolean emit_DP3( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); struct x86_reg tmp = get_xmm_reg(cp); sse_movups(&cp->func, dst, arg0); sse_mulps(&cp->func, dst, arg1); /* Now the hard bit: sum the first 3 values: */ sse_movhlps(&cp->func, tmp, dst); sse_addss(&cp->func, dst, tmp); /* a*x+c*z, b*y, ?, ? */ emit_pshufd(cp, tmp, dst, SHUF(Y,X,W,Z)); sse_addss(&cp->func, dst, tmp); sse_shufps(&cp->func, dst, dst, SHUF(X, X, X, X)); return GL_TRUE; } static GLboolean emit_DP4( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); struct x86_reg tmp = get_xmm_reg(cp); sse_movups(&cp->func, dst, arg0); sse_mulps(&cp->func, dst, arg1); /* Now the hard bit: sum the values: */ sse_movhlps(&cp->func, tmp, dst); sse_addps(&cp->func, dst, tmp); /* a*x+c*z, b*y+d*w, a*x+c*z, b*y+d*w */ emit_pshufd(cp, tmp, dst, SHUF(Y,X,W,Z)); sse_addss(&cp->func, dst, tmp); sse_shufps(&cp->func, dst, dst, SHUF(X, X, X, X)); return GL_TRUE; } static GLboolean emit_DPH( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); struct x86_reg ones = get_reg_ptr(FILE_REG, REG_ONES); struct x86_reg tmp = get_xmm_reg(cp); emit_pshufd(cp, dst, arg0, SHUF(W,X,Y,Z)); sse_movss(&cp->func, dst, ones); emit_pshufd(cp, dst, dst, SHUF(W,X,Y,Z)); sse_mulps(&cp->func, dst, arg1); /* Now the hard bit: sum the values (from DP4): */ sse_movhlps(&cp->func, tmp, dst); sse_addps(&cp->func, dst, tmp); /* a*x+c*z, b*y+d*w, a*x+c*z, b*y+d*w */ emit_pshufd(cp, tmp, dst, SHUF(Y,X,W,Z)); sse_addss(&cp->func, dst, tmp); sse_shufps(&cp->func, dst, dst, SHUF(X, X, X, X)); return GL_TRUE; } #if 0 static GLboolean emit_DST( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); struct x86_reg arg1 = get_arg_ptr(cp, op.alu.file1, op.alu.idx1); struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); /* dst[0] = 1.0 * 1.0F; */ /* dst[1] = arg0[1] * arg1[1]; */ /* dst[2] = arg0[2] * 1.0; */ /* dst[3] = 1.0 * arg1[3]; */ /* Would rather do some of this with integer regs, but: * 1) No proper support for immediate values yet * 2) I'd need to push/pop somewhere to get a free reg. */ x87_fld1(&cp->func); x87_fstp(&cp->func, dst); /* would rather do an immediate store... */ x87_fld(&cp->func, x86_make_disp(arg0, 4)); x87_fmul(&cp->func, x86_make_disp(arg1, 4)); x87_fstp(&cp->func, x86_make_disp(dst, 4)); if (!eq(arg0, dst)) { x86_fld(&cp->func, x86_make_disp(arg0, 8)); x86_stp(&cp->func, x86_make_disp(dst, 8)); } if (!eq(arg1, dst)) { x86_fld(&cp->func, x86_make_disp(arg0, 12)); x86_stp(&cp->func, x86_make_disp(dst, 12)); } return GL_TRUE; } #else static GLboolean emit_DST( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); struct x86_reg tmp = get_xmm_reg(cp); struct x86_reg ones = get_reg_ptr(FILE_REG, REG_ONES); emit_shuf_copy2(cp, dst, arg0, ones, SHUF(X,W,Z,Y)); emit_shuf_copy2(cp, tmp, arg1, ones, SHUF(X,Z,Y,W)); sse_mulps(&cp->func, dst, tmp); /* dst[0] = 1.0 * 1.0F; */ /* dst[1] = arg0[1] * arg1[1]; */ /* dst[2] = arg0[2] * 1.0; */ /* dst[3] = 1.0 * arg1[3]; */ return GL_TRUE; } #endif static GLboolean emit_LG2( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); x87_fld1(&cp->func); /* 1 */ x87_fld(&cp->func, arg0); /* a0 1 */ x87_fyl2x(&cp->func); /* log2(a0) */ x87_fst(&cp->func, x86_make_disp(dst, 0)); x87_fst(&cp->func, x86_make_disp(dst, 4)); x87_fst(&cp->func, x86_make_disp(dst, 8)); x87_fstp(&cp->func, x86_make_disp(dst, 12)); return GL_TRUE; } static GLboolean emit_EX2( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); /* CAUTION: dst may alias arg0! */ x87_fld(&cp->func, arg0); emit_x87_ex2(cp); x87_fst(&cp->func, x86_make_disp(dst, 0)); x87_fst(&cp->func, x86_make_disp(dst, 4)); x87_fst(&cp->func, x86_make_disp(dst, 8)); x87_fst(&cp->func, x86_make_disp(dst, 12)); return GL_TRUE; } static GLboolean emit_EXP( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); struct x86_reg st0 = x86_make_reg(file_x87, 0); struct x86_reg st1 = x86_make_reg(file_x87, 1); struct x86_reg st3 = x86_make_reg(file_x87, 3); /* CAUTION: dst may alias arg0! */ x87_fld(&cp->func, arg0); /* arg0.x */ x87_fld(&cp->func, st0); /* arg arg */ /* by default, fpu is setup to round-to-nearest. We want to * change this now, and track the state through to the end of the * generated function so that it isn't repeated unnecessarily. * Alternately, could subtract .5 to get round to -inf behaviour. */ set_fpu_round_neg_inf( cp ); x87_fprndint( &cp->func ); /* flr(a) a */ x87_fld(&cp->func, st0); /* flr(a) flr(a) a */ x87_fld1(&cp->func); /* 1 floor(a) floor(a) a */ x87_fst(&cp->func, x86_make_disp(dst, 12)); /* stack unchanged */ x87_fscale(&cp->func); /* 2^floor(a) floor(a) a */ x87_fst(&cp->func, st3); /* 2^floor(a) floor(a) a 2^floor(a)*/ x87_fstp(&cp->func, x86_make_disp(dst, 0)); /* flr(a) a 2^flr(a) */ x87_fsubrp(&cp->func, st1); /* frac(a) 2^flr(a) */ x87_fst(&cp->func, x86_make_disp(dst, 4)); /* frac(a) 2^flr(a) */ x87_f2xm1(&cp->func); /* (2^frac(a))-1 2^flr(a)*/ x87_fld1(&cp->func); /* 1 (2^frac(a))-1 2^flr(a)*/ x87_faddp(&cp->func, st1); /* 2^frac(a) 2^flr(a) */ x87_fmulp(&cp->func, st1); /* 2^a */ x87_fst(&cp->func, x86_make_disp(dst, 8)); /* dst[0] = 2^floor(tmp); */ /* dst[1] = frac(tmp); */ /* dst[2] = 2^floor(tmp) * 2^frac(tmp); */ /* dst[3] = 1.0F; */ return GL_TRUE; } static GLboolean emit_LOG( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); struct x86_reg st0 = x86_make_reg(file_x87, 0); struct x86_reg st1 = x86_make_reg(file_x87, 1); struct x86_reg st2 = x86_make_reg(file_x87, 2); /* CAUTION: dst may alias arg0! */ x87_fld(&cp->func, arg0); /* arg0.x */ x87_fabs(&cp->func); /* |arg0.x| */ x87_fxtract(&cp->func); /* mantissa(arg0.x), exponent(arg0.x) */ x87_fst(&cp->func, st2); /* mantissa, exponent, mantissa */ x87_fld1(&cp->func); /* 1, mantissa, exponent, mantissa */ x87_fyl2x(&cp->func); /* log2(mantissa), exponent, mantissa */ x87_fadd(&cp->func, st0, st1); /* e+l2(m), e, m */ x87_fstp(&cp->func, x86_make_disp(dst, 8)); /* e, m */ x87_fld1(&cp->func); /* 1, e, m */ x87_fsub(&cp->func, st1, st0); /* 1, e-1, m */ x87_fstp(&cp->func, x86_make_disp(dst, 12)); /* e-1,m */ x87_fstp(&cp->func, dst); /* m */ x87_fadd(&cp->func, st0, st0); /* 2m */ x87_fstp(&cp->func, x86_make_disp(dst, 4)); return GL_TRUE; } static GLboolean emit_FLR( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); int i; set_fpu_round_neg_inf( cp ); for (i = 0; i < 4; i++) { x87_fld(&cp->func, x86_make_disp(arg0, i*4)); x87_fprndint( &cp->func ); x87_fstp(&cp->func, x86_make_disp(dst, i*4)); } return GL_TRUE; } static GLboolean emit_FRC( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); struct x86_reg st0 = x86_make_reg(file_x87, 0); struct x86_reg st1 = x86_make_reg(file_x87, 1); int i; set_fpu_round_neg_inf( cp ); /* Knowing liveness info or even just writemask would be useful * here: */ for (i = 0; i < 4; i++) { x87_fld(&cp->func, x86_make_disp(arg0, i*4)); x87_fld(&cp->func, st0); /* a a */ x87_fprndint( &cp->func ); /* flr(a) a */ x87_fsubrp(&cp->func, st1); /* frc(a) */ x87_fstp(&cp->func, x86_make_disp(dst, i*4)); } return GL_TRUE; } static GLboolean emit_LIT( struct compilation *cp, union instruction op ) { #if 1 struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); struct x86_reg lit = get_arg(cp, FILE_REG, REG_LIT); struct x86_reg tmp = get_xmm_reg(cp); struct x86_reg st1 = x86_make_reg(file_x87, 1); struct x86_reg regEAX = x86_make_reg(file_REG32, reg_AX); GLubyte *fixup1, *fixup2; /* Load the interesting parts of arg0: */ x87_fld(&cp->func, x86_make_disp(arg0, 12)); /* a3 */ x87_fld(&cp->func, x86_make_disp(arg0, 4)); /* a1 a3 */ x87_fld(&cp->func, x86_make_disp(arg0, 0)); /* a0 a1 a3 */ /* Intialize dst: */ sse_movaps(&cp->func, tmp, lit); sse_movaps(&cp->func, dst, tmp); /* Check arg0[0]: */ x87_fldz(&cp->func); /* 0 a0 a1 a3 */ x87_fucomp(&cp->func, st1); /* a0 a1 a3 */ x87_fnstsw(&cp->func, regEAX); x86_sahf(&cp->func); fixup1 = x86_jcc_forward(&cp->func, cc_AE); x87_fstp(&cp->func, x86_make_disp(dst, 4)); /* a1 a3 */ /* Check arg0[1]: */ x87_fldz(&cp->func); /* 0 a1 a3 */ x87_fucomp(&cp->func, st1); /* a1 a3 */ x87_fnstsw(&cp->func, regEAX); x86_sahf(&cp->func); fixup2 = x86_jcc_forward(&cp->func, cc_AE); /* Compute pow(a1, a3) */ x87_fyl2x(&cp->func); /* a3*log2(a1) */ emit_x87_ex2( cp ); /* 2^(a3*log2(a1)) */ x87_fstp(&cp->func, x86_make_disp(dst, 8)); /* Land jumps: */ x86_fixup_fwd_jump(&cp->func, fixup1); x86_fixup_fwd_jump(&cp->func, fixup2); #else struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); struct x86_reg ones = get_reg_ptr(FILE_REG, REG_LIT); sse_movups(&cp->func, dst, ones); #endif return GL_TRUE; } static GLboolean emit_MAX( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); sse_movups(&cp->func, dst, arg0); sse_maxps(&cp->func, dst, arg1); return GL_TRUE; } static GLboolean emit_MIN( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); sse_movups(&cp->func, dst, arg0); sse_minps(&cp->func, dst, arg1); return GL_TRUE; } static GLboolean emit_MOV( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); sse_movups(&cp->func, dst, arg0); return GL_TRUE; } static GLboolean emit_MUL( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); sse_movups(&cp->func, dst, arg0); sse_mulps(&cp->func, dst, arg1); return GL_TRUE; } static GLboolean emit_POW( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg_ptr(cp, op.alu.file0, op.alu.idx0); struct x86_reg arg1 = get_arg_ptr(cp, op.alu.file1, op.alu.idx1); struct x86_reg dst = get_dst_ptr(cp, FILE_REG, op.alu.dst); x87_fld(&cp->func, arg1); /* a1 */ x87_fld(&cp->func, arg0); /* a0 a1 */ x87_fyl2x(&cp->func); /* a1*log2(a0) */ emit_x87_ex2( cp ); /* 2^(a1*log2(a0)) */ x87_fst(&cp->func, x86_make_disp(dst, 0)); x87_fst(&cp->func, x86_make_disp(dst, 4)); x87_fst(&cp->func, x86_make_disp(dst, 8)); x87_fstp(&cp->func, x86_make_disp(dst, 12)); return GL_TRUE; } static GLboolean emit_REL( struct compilation *cp, union instruction op ) { /* GLuint idx = (op.alu.idx0 + (GLint)cp->File[0][REG_ADDR][0]) & (MAX_NV_VERTEX_PROGRAM_PARAMS-1); */ /* GLuint idx = 0; */ /* struct x86_reg arg0 = get_arg(cp, op.alu.file0, idx); */ /* struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); */ /* dst[0] = arg0[0]; */ /* dst[1] = arg0[1]; */ /* dst[2] = arg0[2]; */ /* dst[3] = arg0[3]; */ FAIL; } static GLboolean emit_RCP( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); if (cp->have_sse2) { sse2_rcpss(&cp->func, dst, arg0); } else { struct x86_reg ones = get_reg_ptr(FILE_REG, REG_ONES); sse_movss(&cp->func, dst, ones); sse_divss(&cp->func, dst, arg0); } sse_shufps(&cp->func, dst, dst, SHUF(X, X, X, X)); return GL_TRUE; } static GLboolean emit_RSQ( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); /* TODO: Calculate absolute value */ #if 0 sse_movss(&cp->func, dst, arg0); sse_mulss(&cp->func, dst, neg); sse_maxss(&cp->func, dst, arg0); #endif sse_rsqrtss(&cp->func, dst, arg0); sse_shufps(&cp->func, dst, dst, SHUF(X, X, X, X)); return GL_TRUE; } static GLboolean emit_SGE( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); struct x86_reg ones = get_reg_ptr(FILE_REG, REG_ONES); sse_movups(&cp->func, dst, arg0); sse_cmpps(&cp->func, dst, arg1, cc_NotLessThan); sse_andps(&cp->func, dst, ones); return GL_TRUE; } static GLboolean emit_SLT( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); struct x86_reg ones = get_reg_ptr(FILE_REG, REG_ONES); sse_movups(&cp->func, dst, arg0); sse_cmpps(&cp->func, dst, arg1, cc_LessThan); sse_andps(&cp->func, dst, ones); return GL_TRUE; } static GLboolean emit_SUB( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); sse_movups(&cp->func, dst, arg0); sse_subps(&cp->func, dst, arg1); return GL_TRUE; } static GLboolean emit_XPD( struct compilation *cp, union instruction op ) { struct x86_reg arg0 = get_arg(cp, op.alu.file0, op.alu.idx0); struct x86_reg arg1 = get_arg(cp, op.alu.file1, op.alu.idx1); struct x86_reg dst = get_dst_xmm_reg(cp, FILE_REG, op.alu.dst); struct x86_reg tmp0 = get_xmm_reg(cp); struct x86_reg tmp1 = get_xmm_reg(cp); /* Could avoid tmp0, tmp1 if we overwrote arg0, arg1. Need a way * to invalidate registers. This will come with better analysis * (liveness analysis) of the incoming program. */ emit_pshufd(cp, dst, arg0, SHUF(Y, Z, X, W)); emit_pshufd(cp, tmp1, arg1, SHUF(Z, X, Y, W)); sse_mulps(&cp->func, dst, tmp1); emit_pshufd(cp, tmp0, arg0, SHUF(Z, X, Y, W)); emit_pshufd(cp, tmp1, arg1, SHUF(Y, Z, X, W)); sse_mulps(&cp->func, tmp0, tmp1); sse_subps(&cp->func, dst, tmp0); /* dst[0] = arg0[1] * arg1[2] - arg0[2] * arg1[1]; */ /* dst[1] = arg0[2] * arg1[0] - arg0[0] * arg1[2]; */ /* dst[2] = arg0[0] * arg1[1] - arg0[1] * arg1[0]; */ /* dst[3] is undef */ return GL_TRUE; } static GLboolean emit_NOP( struct compilation *cp, union instruction op ) { return GL_TRUE; } static GLboolean (* const emit_func[])(struct compilation *, union instruction) = { emit_ABS, emit_ADD, emit_NOP, emit_DP3, emit_DP4, emit_DPH, emit_DST, emit_NOP, emit_EX2, emit_EXP, emit_FLR, emit_FRC, emit_LG2, emit_LIT, emit_LOG, emit_NOP, emit_MAX, emit_MIN, emit_MOV, emit_MUL, emit_POW, emit_PRT, emit_NOP, emit_RCP, emit_RSQ, emit_SGE, emit_SLT, emit_SUB, emit_RSW, emit_XPD, emit_RSW, emit_MSK, emit_REL, }; static GLboolean build_vertex_program( struct compilation *cp ) { struct arb_vp_machine *m = NULL; GLuint j; struct x86_reg regEBX = x86_make_reg(file_REG32, reg_BX); struct x86_reg regECX = x86_make_reg(file_REG32, reg_CX); struct x86_reg regEDX = x86_make_reg(file_REG32, reg_DX); x86_push(&cp->func, regEBX); x86_mov(&cp->func, regEDX, x86_fn_arg(&cp->func, 1)); x86_mov(&cp->func, regEBX, x86_make_disp(regEDX, get_offset(m, m->File + FILE_REG))); x86_mov(&cp->func, regECX, x86_make_disp(regEDX, get_offset(m, m->File + FILE_STATE_PARAM))); for (j = 0; j < cp->p->nr_instructions; j++) { union instruction inst = cp->p->instructions[j]; cp->insn_counter = j+1; /* avoid zero */ if (DISASSEM) { _mesa_printf("%p: ", cp->func.csr); _tnl_disassem_vba_insn( inst ); } cp->func.fn = NULL; if (!emit_func[inst.alu.opcode]( cp, inst )) { return GL_FALSE; } } /* TODO: only for outputs: */ for (j = 0; j < 8; j++) { if (cp->xmm[j].dirty) spill(cp, j); } /* Exit mmx state? */ if (cp->func.need_emms) mmx_emms(&cp->func); /* Restore FPU control word? */ if (cp->fpucntl != RESTORE_FPU) { x87_fnclex(&cp->func); x87_fldcw(&cp->func, x86_make_disp(regEDX, get_offset(m, &m->fpucntl_restore))); } x86_pop(&cp->func, regEBX); x86_ret(&cp->func); return GL_TRUE; } /** * Execute the given vertex program. * * TODO: Integrate the t_vertex.c code here, to build machine vertices * directly at this point. * * TODO: Eliminate the VB struct entirely and just use * struct arb_vertex_machine. */ GLboolean _tnl_sse_codegen_vertex_program(struct tnl_compiled_program *p) { struct compilation cp; /* sanity checks */ assert(emit_func[VP_OPCODE_ABS] == emit_ABS); assert(emit_func[VP_OPCODE_MUL] == emit_MUL); assert(emit_func[VP_OPCODE_XPD] == emit_XPD); memset(&cp, 0, sizeof(cp)); cp.p = p; cp.have_sse2 = 1; if (p->compiled_func) { _mesa_free((void *)p->compiled_func); p->compiled_func = NULL; } x86_init_func(&cp.func); cp.fpucntl = RESTORE_FPU; /* Note ctx state is not referenced in building the function, so it * depends only on the list of instructions: */ if (!build_vertex_program(&cp)) { x86_release_func( &cp.func ); return GL_FALSE; } p->compiled_func = (void (*)(struct arb_vp_machine *))x86_get_func( &cp.func ); return GL_TRUE; } #else GLboolean _tnl_sse_codegen_vertex_program(struct tnl_compiled_program *p) { /* Dummy version for when USE_SSE_ASM not defined */ return GL_FALSE; } #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_cliptmp.h0000644000000000000000000002124313614532424020647 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #define CLIP_DOTPROD(K, A, B, C, D) X(K)*A + Y(K)*B + Z(K)*C + W(K)*D #define POLY_CLIP( PLANE, A, B, C, D ) \ do { \ if (mask & PLANE) { \ GLuint idxPrev = inlist[0]; \ GLfloat dpPrev = CLIP_DOTPROD(idxPrev, A, B, C, D ); \ GLuint outcount = 0; \ GLuint i; \ \ inlist[n] = inlist[0]; /* prevent rotation of vertices */ \ for (i = 1; i <= n; i++) { \ GLuint idx = inlist[i]; \ GLfloat dp = CLIP_DOTPROD(idx, A, B, C, D ); \ \ clipmask[idxPrev] |= PLANE; \ if (!IS_NEGATIVE(dpPrev)) { \ outlist[outcount++] = idxPrev; \ clipmask[idxPrev] &= ~PLANE; \ } \ \ if (DIFFERENT_SIGNS(dp, dpPrev)) { \ GLuint newvert = VB->LastClipped++; \ VB->ClipMask[newvert] = 0; \ outlist[outcount++] = newvert; \ if (IS_NEGATIVE(dp)) { \ /* Going out of bounds. Avoid division by zero as we \ * know dp != dpPrev from DIFFERENT_SIGNS, above. \ */ \ GLfloat t = dp / (dp - dpPrev); \ INTERP_4F( t, coord[newvert], coord[idx], coord[idxPrev]); \ interp( ctx, t, newvert, idx, idxPrev, GL_TRUE ); \ } else { \ /* Coming back in. \ */ \ GLfloat t = dpPrev / (dpPrev - dp); \ INTERP_4F( t, coord[newvert], coord[idxPrev], coord[idx]); \ interp( ctx, t, newvert, idxPrev, idx, GL_FALSE ); \ } \ } \ \ idxPrev = idx; \ dpPrev = dp; \ } \ \ if (outcount < 3) \ return; \ \ { \ GLuint *tmp = inlist; \ inlist = outlist; \ outlist = tmp; \ n = outcount; \ } \ } \ } while (0) #define LINE_CLIP(PLANE, A, B, C, D ) \ do { \ if (mask & PLANE) { \ GLfloat dpI = CLIP_DOTPROD( ii, A, B, C, D ); \ GLfloat dpJ = CLIP_DOTPROD( jj, A, B, C, D ); \ \ if (DIFFERENT_SIGNS(dpI, dpJ)) { \ GLuint newvert = VB->LastClipped++; \ VB->ClipMask[newvert] = 0; \ if (IS_NEGATIVE(dpJ)) { \ GLfloat t = dpI / (dpI - dpJ); \ VB->ClipMask[jj] |= PLANE; \ INTERP_4F( t, coord[newvert], coord[ii], coord[jj] ); \ interp( ctx, t, newvert, ii, jj, GL_FALSE ); \ jj = newvert; \ } else { \ GLfloat t = dpJ / (dpJ - dpI); \ VB->ClipMask[ii] |= PLANE; \ INTERP_4F( t, coord[newvert], coord[jj], coord[ii] ); \ interp( ctx, t, newvert, jj, ii, GL_FALSE ); \ ii = newvert; \ } \ } \ else if (IS_NEGATIVE(dpI)) \ return; \ } \ } while (0) /* Clip a line against the viewport and user clip planes. */ static INLINE void TAG(clip_line)( GLcontext *ctx, GLuint i, GLuint j, GLubyte mask ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; tnl_interp_func interp = tnl->Driver.Render.Interp; GLfloat (*coord)[4] = VB->ClipPtr->data; GLuint ii = i, jj = j, p; VB->LastClipped = VB->Count; if (mask & 0x3f) { LINE_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); LINE_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); LINE_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 ); LINE_CLIP( CLIP_BOTTOM_BIT, 0, 1, 0, 1 ); LINE_CLIP( CLIP_FAR_BIT, 0, 0, -1, 1 ); LINE_CLIP( CLIP_NEAR_BIT, 0, 0, 1, 1 ); } if (mask & CLIP_USER_BIT) { for (p=0;pTransform.ClipPlanesEnabled & (1 << p)) { const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; LINE_CLIP( CLIP_USER_BIT, a, b, c, d ); } } } if ((ctx->_TriangleCaps & DD_FLATSHADE) && j != jj) tnl->Driver.Render.CopyPV( ctx, jj, j ); tnl->Driver.Render.ClippedLine( ctx, ii, jj ); } /* Clip a triangle against the viewport and user clip planes. */ static INLINE void TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; tnl_interp_func interp = tnl->Driver.Render.Interp; GLfloat (*coord)[4] = VB->ClipPtr->data; GLuint pv = v2; GLuint vlist[2][MAX_CLIPPED_VERTICES]; GLuint *inlist = vlist[0], *outlist = vlist[1]; GLuint p; GLubyte *clipmask = VB->ClipMask; GLuint n = 3; ASSIGN_3V(inlist, v2, v0, v1 ); /* pv rotated to slot zero */ VB->LastClipped = VB->Count; if (mask & 0x3f) { POLY_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); POLY_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); POLY_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 ); POLY_CLIP( CLIP_BOTTOM_BIT, 0, 1, 0, 1 ); POLY_CLIP( CLIP_FAR_BIT, 0, 0, -1, 1 ); POLY_CLIP( CLIP_NEAR_BIT, 0, 0, 1, 1 ); } if (mask & CLIP_USER_BIT) { for (p=0;pTransform.ClipPlanesEnabled & (1 << p)) { const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; POLY_CLIP( CLIP_USER_BIT, a, b, c, d ); } } } if (ctx->_TriangleCaps & DD_FLATSHADE) { if (pv != inlist[0]) { ASSERT( inlist[0] >= VB->Count ); tnl->Driver.Render.CopyPV( ctx, inlist[0], pv ); } } tnl->Driver.Render.ClippedPolygon( ctx, inlist, n ); } /* Clip a quad against the viewport and user clip planes. */ static INLINE void TAG(clip_quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLubyte mask ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; tnl_interp_func interp = tnl->Driver.Render.Interp; GLfloat (*coord)[4] = VB->ClipPtr->data; GLuint pv = v3; GLuint vlist[2][MAX_CLIPPED_VERTICES]; GLuint *inlist = vlist[0], *outlist = vlist[1]; GLuint p; GLubyte *clipmask = VB->ClipMask; GLuint n = 4; ASSIGN_4V(inlist, v3, v0, v1, v2 ); /* pv rotated to slot zero */ VB->LastClipped = VB->Count; if (mask & 0x3f) { POLY_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 ); POLY_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 ); POLY_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 ); POLY_CLIP( CLIP_BOTTOM_BIT, 0, 1, 0, 1 ); POLY_CLIP( CLIP_FAR_BIT, 0, 0, -1, 1 ); POLY_CLIP( CLIP_NEAR_BIT, 0, 0, 1, 1 ); } if (mask & CLIP_USER_BIT) { for (p=0;pTransform.ClipPlanesEnabled & (1 << p)) { const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; POLY_CLIP( CLIP_USER_BIT, a, b, c, d ); } } } if (ctx->_TriangleCaps & DD_FLATSHADE) { if (pv != inlist[0]) { ASSERT( inlist[0] >= VB->Count ); tnl->Driver.Render.CopyPV( ctx, inlist[0], pv ); } } tnl->Driver.Render.ClippedPolygon( ctx, inlist, n ); } #undef W #undef Z #undef Y #undef X #undef SIZE #undef TAG #undef POLY_CLIP #undef LINE_CLIP nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_cull.c0000644000000000000000000000542713614532424020137 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "macros.h" #include "imports.h" #include "mtypes.h" #include "math/m_xform.h" #include "t_context.h" #include "t_pipeline.h" /* EXT_vertex_cull. Not really a big win, but probably depends on * your application. This stage not included in the default pipeline. */ static GLboolean run_cull_stage( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; const GLfloat a = ctx->Transform.CullObjPos[0]; const GLfloat b = ctx->Transform.CullObjPos[1]; const GLfloat c = ctx->Transform.CullObjPos[2]; GLfloat *norm = (GLfloat *)VB->NormalPtr->data; GLuint stride = VB->NormalPtr->stride; GLuint count = VB->Count; GLuint i; if (ctx->VertexProgram._Enabled || !ctx->Transform.CullVertexFlag) return GL_TRUE; VB->ClipOrMask &= ~CLIP_CULL_BIT; VB->ClipAndMask |= CLIP_CULL_BIT; for (i = 0 ; i < count ; i++) { GLfloat dp = (norm[0] * a + norm[1] * b + norm[2] * c); if (dp < 0) { VB->ClipMask[i] |= CLIP_CULL_BIT; VB->ClipOrMask |= CLIP_CULL_BIT; } else { VB->ClipMask[i] &= ~CLIP_CULL_BIT; VB->ClipAndMask &= ~CLIP_CULL_BIT; } STRIDE_F(norm, stride); } return !(VB->ClipAndMask & CLIP_CULL_BIT); } const struct tnl_pipeline_stage _tnl_vertex_cull_stage = { "EXT_cull_vertex", NULL, /* private data */ NULL, /* ctr */ NULL, /* destructor */ NULL, run_cull_stage /* run -- initially set to init */ }; nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_fog.c0000644000000000000000000001646313614532424017755 0ustar /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "macros.h" #include "imports.h" #include "mtypes.h" #include "math/m_xform.h" #include "t_context.h" #include "t_pipeline.h" struct fog_stage_data { GLvector4f fogcoord; /* has actual storage allocated */ GLvector4f input; /* points into VB->EyePtr Z values */ }; #define FOG_STAGE_DATA(stage) ((struct fog_stage_data *)stage->privatePtr) #define FOG_EXP_TABLE_SIZE 256 #define FOG_MAX (10.0) #define EXP_FOG_MAX .0006595 #define FOG_INCR (FOG_MAX/FOG_EXP_TABLE_SIZE) static GLfloat exp_table[FOG_EXP_TABLE_SIZE]; static GLfloat inited = 0; #if 1 #define NEG_EXP( result, narg ) \ do { \ GLfloat f = (GLfloat) (narg * (1.0/FOG_INCR)); \ GLint k = (GLint) f; \ if (k > FOG_EXP_TABLE_SIZE-2) \ result = (GLfloat) EXP_FOG_MAX; \ else \ result = exp_table[k] + (f-k)*(exp_table[k+1]-exp_table[k]); \ } while (0) #else #define NEG_EXP( result, narg ) \ do { \ result = exp(-narg); \ } while (0) #endif /** * Initialize the exp_table[] lookup table for approximating exp(). */ static void init_static_data( void ) { GLfloat f = 0.0F; GLint i = 0; for ( ; i < FOG_EXP_TABLE_SIZE ; i++, f += FOG_INCR) { exp_table[i] = EXPF(-f); } inited = 1; } /** * Compute per-vertex fog blend factors from fog coordinates by * evaluating the GL_LINEAR, GL_EXP or GL_EXP2 fog function. * Fog coordinates are distances from the eye (typically between the * near and far clip plane distances). * Note the fog (eye Z) coords may be negative so we use ABS(z) below. * Fog blend factors are in the range [0,1]. */ static void compute_fog_blend_factors(GLcontext *ctx, GLvector4f *out, const GLvector4f *in) { GLfloat end = ctx->Fog.End; GLfloat *v = in->start; GLuint stride = in->stride; GLuint n = in->count; GLfloat (*data)[4] = out->data; GLfloat d; GLuint i; out->count = in->count; switch (ctx->Fog.Mode) { case GL_LINEAR: if (ctx->Fog.Start == ctx->Fog.End) d = 1.0F; else d = 1.0F / (ctx->Fog.End - ctx->Fog.Start); for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { const GLfloat z = FABSF(*v); GLfloat f = (end - z) * d; data[i][0] = CLAMP(f, 0.0F, 1.0F); } break; case GL_EXP: d = ctx->Fog.Density; for ( i = 0 ; i < n ; i++, STRIDE_F(v,stride)) { const GLfloat z = FABSF(*v); NEG_EXP( data[i][0], d * z ); } break; case GL_EXP2: d = ctx->Fog.Density*ctx->Fog.Density; for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { const GLfloat z = FABSF(*v); NEG_EXP( data[i][0], d * z * z ); } break; default: _mesa_problem(ctx, "Bad fog mode in make_fog_coord"); return; } } static GLboolean run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; struct fog_stage_data *store = FOG_STAGE_DATA(stage); GLvector4f *input; if (!ctx->Fog.Enabled || ctx->VertexProgram._Enabled) return GL_TRUE; if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) { /* Fog is computed from vertex or fragment Z values */ /* source = VB->ObjPtr or VB->EyePtr coords */ /* dest = VB->FogCoordPtr = fog stage private storage */ VB->FogCoordPtr = &store->fogcoord; if (!ctx->_NeedEyeCoords) { /* compute fog coords from object coords */ const GLfloat *m = ctx->ModelviewMatrixStack.Top->m; GLfloat plane[4]; /* Use this to store calculated eye z values: */ input = &store->fogcoord; /* NOTE: negate plane here so we get positive fog coords! */ plane[0] = -m[2]; plane[1] = -m[6]; plane[2] = -m[10]; plane[3] = -m[14]; /* Full eye coords weren't required, just calculate the * eye Z values. */ _mesa_dotprod_tab[VB->ObjPtr->size]( (GLfloat *) input->data, 4 * sizeof(GLfloat), VB->ObjPtr, plane ); input->count = VB->ObjPtr->count; } else { /* fog coordinates = eye Z coordinates (use ABS later) */ input = &store->input; if (VB->EyePtr->size < 2) _mesa_vector4f_clean_elem( VB->EyePtr, VB->Count, 2 ); input->data = (GLfloat (*)[4]) &(VB->EyePtr->data[0][2]); input->start = VB->EyePtr->start+2; input->stride = VB->EyePtr->stride; input->count = VB->EyePtr->count; } } else { /* use glFogCoord() coordinates */ input = VB->FogCoordPtr; /* source data */ /* input->count may be one if glFogCoord was only called once * before glBegin. But we need to compute fog for all vertices. */ input->count = VB->ObjPtr->count; VB->FogCoordPtr = &store->fogcoord; /* dest data */ } if (tnl->_DoVertexFog) { /* compute blend factors from fog coordinates */ compute_fog_blend_factors( ctx, VB->FogCoordPtr, input ); } else { /* results = incoming fog coords (compute fog per-fragment later) */ VB->FogCoordPtr = input; } VB->AttribPtr[_TNL_ATTRIB_FOG] = VB->FogCoordPtr; return GL_TRUE; } /* Called the first time stage->run() is invoked. */ static GLboolean alloc_fog_data(GLcontext *ctx, struct tnl_pipeline_stage *stage) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct fog_stage_data *store; stage->privatePtr = MALLOC(sizeof(*store)); store = FOG_STAGE_DATA(stage); if (!store) return GL_FALSE; _mesa_vector4f_alloc( &store->fogcoord, 0, tnl->vb.Size, 32 ); _mesa_vector4f_init( &store->input, 0, NULL ); if (!inited) init_static_data(); return GL_TRUE; } static void free_fog_data(struct tnl_pipeline_stage *stage) { struct fog_stage_data *store = FOG_STAGE_DATA(stage); if (store) { _mesa_vector4f_free( &store->fogcoord ); FREE( store ); stage->privatePtr = NULL; } } const struct tnl_pipeline_stage _tnl_fog_coordinate_stage = { "build fog coordinates", /* name */ NULL, /* private_data */ alloc_fog_data, /* dtr */ free_fog_data, /* dtr */ NULL, /* check */ run_fog_stage /* run -- initially set to init. */ }; nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_light.c0000644000000000000000000002416713614532424020311 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "glheader.h" #include "colormac.h" #include "light.h" #include "macros.h" #include "imports.h" #include "simple_list.h" #include "mtypes.h" #include "math/m_translate.h" #include "t_context.h" #include "t_pipeline.h" #define LIGHT_TWOSIDE 0x1 #define LIGHT_MATERIAL 0x2 #define MAX_LIGHT_FUNC 0x4 typedef void (*light_func)( GLcontext *ctx, struct vertex_buffer *VB, struct tnl_pipeline_stage *stage, GLvector4f *input ); /** * Information for updating current material attributes from vertex color, * for GL_COLOR_MATERIAL. */ struct material_cursor { const GLfloat *ptr; /* points to src vertex color (in VB array) */ GLuint stride; /* stride to next vertex color (bytes) */ GLfloat *current; /* points to material attribute to update */ GLuint size; /* vertex/color size: 1, 2, 3 or 4 */ }; /** * Data private to this pipeline stage. */ struct light_stage_data { GLvector4f Input; GLvector4f LitColor[2]; GLvector4f LitSecondary[2]; GLvector4f LitIndex[2]; light_func *light_func_tab; struct material_cursor mat[MAT_ATTRIB_MAX]; GLuint mat_count; GLuint mat_bitmask; }; #define LIGHT_STAGE_DATA(stage) ((struct light_stage_data *)(stage->privatePtr)) /** * In the case of colormaterial, the effected material attributes * should already have been bound to point to the incoming color data, * prior to running the pipeline. * This function copies the vertex's color to the material attributes * which are tracking glColor. * It's called per-vertex in the lighting loop. */ static void update_materials(GLcontext *ctx, struct light_stage_data *store) { GLuint i; for (i = 0 ; i < store->mat_count ; i++) { /* update the material */ COPY_CLEAN_4V(store->mat[i].current, store->mat[i].size, store->mat[i].ptr); /* increment src vertex color pointer */ STRIDE_F(store->mat[i].ptr, store->mat[i].stride); } /* recompute derived light/material values */ _mesa_update_material( ctx, store->mat_bitmask ); /* XXX we should only call this if we're tracking/changing the specular * exponent. */ _mesa_validate_all_lighting_tables( ctx ); } /** * Prepare things prior to running the lighting stage. * Return number of material attributes which will track vertex color. */ static GLuint prepare_materials(GLcontext *ctx, struct vertex_buffer *VB, struct light_stage_data *store) { GLuint i; store->mat_count = 0; store->mat_bitmask = 0; /* Examine the ColorMaterialBitmask to determine which materials * track vertex color. Override the material attribute's pointer * with the color pointer for each one. */ if (ctx->Light.ColorMaterialEnabled) { const GLuint bitmask = ctx->Light.ColorMaterialBitmask; for (i = 0 ; i < MAT_ATTRIB_MAX ; i++) if (bitmask & (1<AttribPtr[_TNL_ATTRIB_MAT_FRONT_AMBIENT + i] = VB->ColorPtr[0]; } /* Now, for each material attribute that's tracking vertex color, save * some values (ptr, stride, size, current) that we'll need in * update_materials(), above, that'll actually copy the vertex color to * the material attribute(s). */ for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT ; i < _TNL_ATTRIB_INDEX ; i++) { if (VB->AttribPtr[i]->stride) { const GLuint j = store->mat_count++; const GLuint attr = i - _TNL_ATTRIB_MAT_FRONT_AMBIENT; store->mat[j].ptr = VB->AttribPtr[i]->start; store->mat[j].stride = VB->AttribPtr[i]->stride; store->mat[j].size = VB->AttribPtr[i]->size; store->mat[j].current = ctx->Light.Material.Attrib[attr]; store->mat_bitmask |= (1<mat_count; } /* Tables for all the shading functions. */ static light_func _tnl_light_tab[MAX_LIGHT_FUNC]; static light_func _tnl_light_fast_tab[MAX_LIGHT_FUNC]; static light_func _tnl_light_fast_single_tab[MAX_LIGHT_FUNC]; static light_func _tnl_light_spec_tab[MAX_LIGHT_FUNC]; static light_func _tnl_light_ci_tab[MAX_LIGHT_FUNC]; #define TAG(x) x #define IDX (0) #include "t_vb_lighttmp.h" #define TAG(x) x##_twoside #define IDX (LIGHT_TWOSIDE) #include "t_vb_lighttmp.h" #define TAG(x) x##_material #define IDX (LIGHT_MATERIAL) #include "t_vb_lighttmp.h" #define TAG(x) x##_twoside_material #define IDX (LIGHT_TWOSIDE|LIGHT_MATERIAL) #include "t_vb_lighttmp.h" static void init_lighting_tables( void ) { static int done; if (!done) { init_light_tab(); init_light_tab_twoside(); init_light_tab_material(); init_light_tab_twoside_material(); done = 1; } } static GLboolean run_lighting( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { struct light_stage_data *store = LIGHT_STAGE_DATA(stage); TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; GLvector4f *input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->ObjPtr; GLuint idx; if (!ctx->Light.Enabled || ctx->VertexProgram._Enabled) return GL_TRUE; /* Make sure we can talk about position x,y and z: */ if (input->size <= 2 && input == VB->ObjPtr) { _math_trans_4f( store->Input.data, VB->ObjPtr->data, VB->ObjPtr->stride, GL_FLOAT, VB->ObjPtr->size, 0, VB->Count ); if (input->size <= 2) { /* Clean z. */ _mesa_vector4f_clean_elem(&store->Input, VB->Count, 2); } if (input->size <= 1) { /* Clean y. */ _mesa_vector4f_clean_elem(&store->Input, VB->Count, 1); } input = &store->Input; } idx = 0; if (prepare_materials( ctx, VB, store )) idx |= LIGHT_MATERIAL; if (ctx->Light.Model.TwoSide) idx |= LIGHT_TWOSIDE; /* The individual functions know about replaying side-effects * vs. full re-execution. */ store->light_func_tab[idx]( ctx, VB, stage, input ); VB->AttribPtr[_TNL_ATTRIB_COLOR0] = VB->ColorPtr[0]; VB->AttribPtr[_TNL_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0]; VB->AttribPtr[_TNL_ATTRIB_INDEX] = VB->IndexPtr[0]; return GL_TRUE; } /* Called in place of do_lighting when the light table may have changed. */ static void validate_lighting( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { light_func *tab; if (!ctx->Light.Enabled || ctx->VertexProgram._Enabled) return; if (ctx->Visual.rgbMode) { if (ctx->Light._NeedVertices) { if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) tab = _tnl_light_spec_tab; else tab = _tnl_light_tab; } else { if (ctx->Light.EnabledList.next == ctx->Light.EnabledList.prev) tab = _tnl_light_fast_single_tab; else tab = _tnl_light_fast_tab; } } else tab = _tnl_light_ci_tab; LIGHT_STAGE_DATA(stage)->light_func_tab = tab; /* This and the above should only be done on _NEW_LIGHT: */ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx ); } /* Called the first time stage->run is called. In effect, don't * allocate data until the first time the stage is run. */ static GLboolean init_lighting( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct light_stage_data *store; GLuint size = tnl->vb.Size; stage->privatePtr = MALLOC(sizeof(*store)); store = LIGHT_STAGE_DATA(stage); if (!store) return GL_FALSE; /* Do onetime init. */ init_lighting_tables(); _mesa_vector4f_alloc( &store->Input, 0, size, 32 ); _mesa_vector4f_alloc( &store->LitColor[0], 0, size, 32 ); _mesa_vector4f_alloc( &store->LitColor[1], 0, size, 32 ); _mesa_vector4f_alloc( &store->LitSecondary[0], 0, size, 32 ); _mesa_vector4f_alloc( &store->LitSecondary[1], 0, size, 32 ); _mesa_vector4f_alloc( &store->LitIndex[0], 0, size, 32 ); _mesa_vector4f_alloc( &store->LitIndex[1], 0, size, 32 ); store->LitColor[0].size = 4; store->LitColor[1].size = 4; store->LitSecondary[0].size = 3; store->LitSecondary[1].size = 3; store->LitIndex[0].size = 1; store->LitIndex[0].stride = sizeof(GLfloat); store->LitIndex[1].size = 1; store->LitIndex[1].stride = sizeof(GLfloat); return GL_TRUE; } static void dtr( struct tnl_pipeline_stage *stage ) { struct light_stage_data *store = LIGHT_STAGE_DATA(stage); if (store) { _mesa_vector4f_free( &store->Input ); _mesa_vector4f_free( &store->LitColor[0] ); _mesa_vector4f_free( &store->LitColor[1] ); _mesa_vector4f_free( &store->LitSecondary[0] ); _mesa_vector4f_free( &store->LitSecondary[1] ); _mesa_vector4f_free( &store->LitIndex[0] ); _mesa_vector4f_free( &store->LitIndex[1] ); FREE( store ); stage->privatePtr = NULL; } } const struct tnl_pipeline_stage _tnl_lighting_stage = { "lighting", /* name */ NULL, /* private_data */ init_lighting, dtr, /* destroy */ validate_lighting, run_lighting }; nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_lighttmp.h0000644000000000000000000005376313614532424021043 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * Authors: * Brian Paul * Keith Whitwell */ #if IDX & LIGHT_TWOSIDE # define NR_SIDES 2 #else # define NR_SIDES 1 #endif /* define TRACE to trace lighting code */ /* #define TRACE 1 */ /* * ctx is the current context * VB is the vertex buffer * stage is the lighting stage-private data * input is the vector of eye or object-space vertex coordinates */ static void TAG(light_rgba_spec)( GLcontext *ctx, struct vertex_buffer *VB, struct tnl_pipeline_stage *stage, GLvector4f *input ) { struct light_stage_data *store = LIGHT_STAGE_DATA(stage); GLfloat (*base)[3] = ctx->Light._BaseColor; GLfloat sumA[2]; GLuint j; const GLuint vstride = input->stride; const GLfloat *vertex = (GLfloat *)input->data; const GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data; GLfloat (*Fspec)[4] = (GLfloat (*)[4]) store->LitSecondary[0].data; #if IDX & LIGHT_TWOSIDE GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data; GLfloat (*Bspec)[4] = (GLfloat (*)[4]) store->LitSecondary[1].data; #endif const GLuint nr = VB->Count; #ifdef TRACE fprintf(stderr, "%s\n", __FUNCTION__ ); #endif VB->ColorPtr[0] = &store->LitColor[0]; VB->SecondaryColorPtr[0] = &store->LitSecondary[0]; sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; #if IDX & LIGHT_TWOSIDE VB->ColorPtr[1] = &store->LitColor[1]; VB->SecondaryColorPtr[1] = &store->LitSecondary[1]; sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; #endif store->LitColor[0].stride = 16; store->LitColor[1].stride = 16; for (j = 0; j < nr; j++,STRIDE_F(vertex,vstride),STRIDE_F(normal,nstride)) { GLfloat sum[2][3], spec[2][3]; struct gl_light *light; #if IDX & LIGHT_MATERIAL update_materials( ctx, store ); sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; #if IDX & LIGHT_TWOSIDE sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; #endif #endif COPY_3V(sum[0], base[0]); ZERO_3V(spec[0]); #if IDX & LIGHT_TWOSIDE COPY_3V(sum[1], base[1]); ZERO_3V(spec[1]); #endif /* Add contribution from each enabled light source */ foreach (light, &ctx->Light.EnabledList) { GLfloat n_dot_h; GLfloat correction; GLint side; GLfloat contrib[3]; GLfloat attenuation; GLfloat VP[3]; /* unit vector from vertex to light */ GLfloat n_dot_VP; /* n dot VP */ GLfloat *h; /* compute VP and attenuation */ if (!(light->_Flags & LIGHT_POSITIONAL)) { /* directional light */ COPY_3V(VP, light->_VP_inf_norm); attenuation = light->_VP_inf_spot_attenuation; } else { GLfloat d; /* distance from vertex to light */ SUB_3V(VP, light->_Position, vertex); d = (GLfloat) LEN_3FV( VP ); if (d > 1e-6) { GLfloat invd = 1.0F / d; SELF_SCALE_SCALAR_3V(VP, invd); } attenuation = 1.0F / (light->ConstantAttenuation + d * (light->LinearAttenuation + d * light->QuadraticAttenuation)); /* spotlight attenuation */ if (light->_Flags & LIGHT_SPOT) { GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); if (PV_dot_dir_CosCutoff) { continue; /* this light makes no contribution */ } else { GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1); GLint k = (GLint) x; GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] + (x-k)*light->_SpotExpTable[k][1]); attenuation *= spot; } } } if (attenuation < 1e-3) continue; /* this light makes no contribution */ /* Compute dot product or normal and vector from V to light pos */ n_dot_VP = DOT3( normal, VP ); /* Which side gets the diffuse & specular terms? */ if (n_dot_VP < 0.0F) { ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]); #if IDX & LIGHT_TWOSIDE side = 1; correction = -1; n_dot_VP = -n_dot_VP; #else continue; #endif } else { #if IDX & LIGHT_TWOSIDE ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]); #endif side = 0; correction = 1; } /* diffuse term */ COPY_3V(contrib, light->_MatAmbient[side]); ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]); ACC_SCALE_SCALAR_3V(sum[side], attenuation, contrib ); /* specular term - cannibalize VP... */ if (ctx->Light.Model.LocalViewer) { GLfloat v[3]; COPY_3V(v, vertex); NORMALIZE_3FV(v); SUB_3V(VP, VP, v); /* h = VP + VPe */ h = VP; NORMALIZE_3FV(h); } else if (light->_Flags & LIGHT_POSITIONAL) { h = VP; ACC_3V(h, ctx->_EyeZDir); NORMALIZE_3FV(h); } else { h = light->_h_inf_norm; } n_dot_h = correction * DOT3(normal, h); if (n_dot_h > 0.0F) { GLfloat spec_coef; struct gl_shine_tab *tab = ctx->_ShineTable[side]; GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef ); if (spec_coef > 1.0e-10) { spec_coef *= attenuation; ACC_SCALE_SCALAR_3V( spec[side], spec_coef, light->_MatSpecular[side]); } } } /*loop over lights*/ COPY_3V( Fcolor[j], sum[0] ); COPY_3V( Fspec[j], spec[0] ); Fcolor[j][3] = sumA[0]; #if IDX & LIGHT_TWOSIDE COPY_3V( Bcolor[j], sum[1] ); COPY_3V( Bspec[j], spec[1] ); Bcolor[j][3] = sumA[1]; #endif } } static void TAG(light_rgba)( GLcontext *ctx, struct vertex_buffer *VB, struct tnl_pipeline_stage *stage, GLvector4f *input ) { struct light_stage_data *store = LIGHT_STAGE_DATA(stage); GLuint j; GLfloat (*base)[3] = ctx->Light._BaseColor; GLfloat sumA[2]; const GLuint vstride = input->stride; const GLfloat *vertex = (GLfloat *) input->data; const GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data; #if IDX & LIGHT_TWOSIDE GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data; #endif const GLuint nr = VB->Count; #ifdef TRACE fprintf(stderr, "%s\n", __FUNCTION__ ); #endif VB->ColorPtr[0] = &store->LitColor[0]; sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; #if IDX & LIGHT_TWOSIDE VB->ColorPtr[1] = &store->LitColor[1]; sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; #endif store->LitColor[0].stride = 16; store->LitColor[1].stride = 16; for (j = 0; j < nr; j++,STRIDE_F(vertex,vstride),STRIDE_F(normal,nstride)) { GLfloat sum[2][3]; struct gl_light *light; #if IDX & LIGHT_MATERIAL update_materials( ctx, store ); sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; #if IDX & LIGHT_TWOSIDE sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; #endif #endif COPY_3V(sum[0], base[0]); #if IDX & LIGHT_TWOSIDE COPY_3V(sum[1], base[1]); #endif /* Add contribution from each enabled light source */ foreach (light, &ctx->Light.EnabledList) { GLfloat n_dot_h; GLfloat correction; GLint side; GLfloat contrib[3]; GLfloat attenuation = 1.0; GLfloat VP[3]; /* unit vector from vertex to light */ GLfloat n_dot_VP; /* n dot VP */ GLfloat *h; /* compute VP and attenuation */ if (!(light->_Flags & LIGHT_POSITIONAL)) { /* directional light */ COPY_3V(VP, light->_VP_inf_norm); attenuation = light->_VP_inf_spot_attenuation; } else { GLfloat d; /* distance from vertex to light */ SUB_3V(VP, light->_Position, vertex); d = (GLfloat) LEN_3FV( VP ); if ( d > 1e-6) { GLfloat invd = 1.0F / d; SELF_SCALE_SCALAR_3V(VP, invd); } attenuation = 1.0F / (light->ConstantAttenuation + d * (light->LinearAttenuation + d * light->QuadraticAttenuation)); /* spotlight attenuation */ if (light->_Flags & LIGHT_SPOT) { GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); if (PV_dot_dir_CosCutoff) { continue; /* this light makes no contribution */ } else { GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1); GLint k = (GLint) x; GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] + (x-k)*light->_SpotExpTable[k][1]); attenuation *= spot; } } } if (attenuation < 1e-3) continue; /* this light makes no contribution */ /* Compute dot product or normal and vector from V to light pos */ n_dot_VP = DOT3( normal, VP ); /* which side are we lighting? */ if (n_dot_VP < 0.0F) { ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]); #if IDX & LIGHT_TWOSIDE side = 1; correction = -1; n_dot_VP = -n_dot_VP; #else continue; #endif } else { #if IDX & LIGHT_TWOSIDE ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]); #endif side = 0; correction = 1; } COPY_3V(contrib, light->_MatAmbient[side]); /* diffuse term */ ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]); /* specular term - cannibalize VP... */ { if (ctx->Light.Model.LocalViewer) { GLfloat v[3]; COPY_3V(v, vertex); NORMALIZE_3FV(v); SUB_3V(VP, VP, v); /* h = VP + VPe */ h = VP; NORMALIZE_3FV(h); } else if (light->_Flags & LIGHT_POSITIONAL) { h = VP; ACC_3V(h, ctx->_EyeZDir); NORMALIZE_3FV(h); } else { h = light->_h_inf_norm; } n_dot_h = correction * DOT3(normal, h); if (n_dot_h > 0.0F) { GLfloat spec_coef; struct gl_shine_tab *tab = ctx->_ShineTable[side]; GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef ); ACC_SCALE_SCALAR_3V( contrib, spec_coef, light->_MatSpecular[side]); } } ACC_SCALE_SCALAR_3V( sum[side], attenuation, contrib ); } COPY_3V( Fcolor[j], sum[0] ); Fcolor[j][3] = sumA[0]; #if IDX & LIGHT_TWOSIDE COPY_3V( Bcolor[j], sum[1] ); Bcolor[j][3] = sumA[1]; #endif } } /* As below, but with just a single light. */ static void TAG(light_fast_rgba_single)( GLcontext *ctx, struct vertex_buffer *VB, struct tnl_pipeline_stage *stage, GLvector4f *input ) { struct light_stage_data *store = LIGHT_STAGE_DATA(stage); const GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data; #if IDX & LIGHT_TWOSIDE GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data; #endif const struct gl_light *light = ctx->Light.EnabledList.next; GLuint j = 0; GLfloat base[2][4]; #if IDX & LIGHT_MATERIAL const GLuint nr = VB->Count; #else const GLuint nr = VB->NormalPtr->count; #endif #ifdef TRACE fprintf(stderr, "%s\n", __FUNCTION__ ); #endif (void) input; /* doesn't refer to Eye or Obj */ VB->ColorPtr[0] = &store->LitColor[0]; #if IDX & LIGHT_TWOSIDE VB->ColorPtr[1] = &store->LitColor[1]; #endif if (nr > 1) { store->LitColor[0].stride = 16; store->LitColor[1].stride = 16; } else { store->LitColor[0].stride = 0; store->LitColor[1].stride = 0; } for (j = 0; j < nr; j++, STRIDE_F(normal,nstride)) { GLfloat n_dot_VP; #if IDX & LIGHT_MATERIAL update_materials( ctx, store ); #endif /* No attenuation, so incoporate _MatAmbient into base color. */ #if !(IDX & LIGHT_MATERIAL) if ( j == 0 ) #endif { COPY_3V(base[0], light->_MatAmbient[0]); ACC_3V(base[0], ctx->Light._BaseColor[0] ); base[0][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; #if IDX & LIGHT_TWOSIDE COPY_3V(base[1], light->_MatAmbient[1]); ACC_3V(base[1], ctx->Light._BaseColor[1]); base[1][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; #endif } n_dot_VP = DOT3(normal, light->_VP_inf_norm); if (n_dot_VP < 0.0F) { #if IDX & LIGHT_TWOSIDE GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm); GLfloat sum[3]; COPY_3V(sum, base[1]); ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->_MatDiffuse[1]); if (n_dot_h > 0.0F) { GLfloat spec; GET_SHINE_TAB_ENTRY( ctx->_ShineTable[1], n_dot_h, spec ); ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[1]); } COPY_3V(Bcolor[j], sum ); Bcolor[j][3] = base[1][3]; #endif COPY_4FV(Fcolor[j], base[0]); } else { GLfloat n_dot_h = DOT3(normal, light->_h_inf_norm); GLfloat sum[3]; COPY_3V(sum, base[0]); ACC_SCALE_SCALAR_3V(sum, n_dot_VP, light->_MatDiffuse[0]); if (n_dot_h > 0.0F) { GLfloat spec; GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec ); ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[0]); } COPY_3V(Fcolor[j], sum ); Fcolor[j][3] = base[0][3]; #if IDX & LIGHT_TWOSIDE COPY_4FV(Bcolor[j], base[1]); #endif } } } /* Light infinite lights */ static void TAG(light_fast_rgba)( GLcontext *ctx, struct vertex_buffer *VB, struct tnl_pipeline_stage *stage, GLvector4f *input ) { struct light_stage_data *store = LIGHT_STAGE_DATA(stage); GLfloat sumA[2]; const GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data; #if IDX & LIGHT_TWOSIDE GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data; #endif GLuint j = 0; #if IDX & LIGHT_MATERIAL const GLuint nr = VB->Count; #else const GLuint nr = VB->NormalPtr->count; #endif const struct gl_light *light; #ifdef TRACE fprintf(stderr, "%s %d\n", __FUNCTION__, nr ); #endif (void) input; sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; VB->ColorPtr[0] = &store->LitColor[0]; #if IDX & LIGHT_TWOSIDE VB->ColorPtr[1] = &store->LitColor[1]; #endif if (nr > 1) { store->LitColor[0].stride = 16; store->LitColor[1].stride = 16; } else { store->LitColor[0].stride = 0; store->LitColor[1].stride = 0; } for (j = 0; j < nr; j++, STRIDE_F(normal,nstride)) { GLfloat sum[2][3]; #if IDX & LIGHT_MATERIAL update_materials( ctx, store ); sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; #if IDX & LIGHT_TWOSIDE sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; #endif #endif COPY_3V(sum[0], ctx->Light._BaseColor[0]); #if IDX & LIGHT_TWOSIDE COPY_3V(sum[1], ctx->Light._BaseColor[1]); #endif foreach (light, &ctx->Light.EnabledList) { GLfloat n_dot_h, n_dot_VP, spec; ACC_3V(sum[0], light->_MatAmbient[0]); #if IDX & LIGHT_TWOSIDE ACC_3V(sum[1], light->_MatAmbient[1]); #endif n_dot_VP = DOT3(normal, light->_VP_inf_norm); if (n_dot_VP > 0.0F) { ACC_SCALE_SCALAR_3V(sum[0], n_dot_VP, light->_MatDiffuse[0]); n_dot_h = DOT3(normal, light->_h_inf_norm); if (n_dot_h > 0.0F) { struct gl_shine_tab *tab = ctx->_ShineTable[0]; GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec ); ACC_SCALE_SCALAR_3V( sum[0], spec, light->_MatSpecular[0]); } } #if IDX & LIGHT_TWOSIDE else { ACC_SCALE_SCALAR_3V(sum[1], -n_dot_VP, light->_MatDiffuse[1]); n_dot_h = -DOT3(normal, light->_h_inf_norm); if (n_dot_h > 0.0F) { struct gl_shine_tab *tab = ctx->_ShineTable[1]; GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec ); ACC_SCALE_SCALAR_3V( sum[1], spec, light->_MatSpecular[1]); } } #endif } COPY_3V( Fcolor[j], sum[0] ); Fcolor[j][3] = sumA[0]; #if IDX & LIGHT_TWOSIDE COPY_3V( Bcolor[j], sum[1] ); Bcolor[j][3] = sumA[1]; #endif } } /* * Use current lighting/material settings to compute the color indexes * for an array of vertices. * Input: n - number of vertices to light * side - 0=use front material, 1=use back material * vertex - array of [n] vertex position in eye coordinates * normal - array of [n] surface normal vector * Output: indexResult - resulting array of [n] color indexes */ static void TAG(light_ci)( GLcontext *ctx, struct vertex_buffer *VB, struct tnl_pipeline_stage *stage, GLvector4f *input ) { struct light_stage_data *store = LIGHT_STAGE_DATA(stage); GLuint j; const GLuint vstride = input->stride; const GLfloat *vertex = (GLfloat *) input->data; const GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLfloat *indexResult[2]; const GLuint nr = VB->Count; #ifdef TRACE fprintf(stderr, "%s\n", __FUNCTION__ ); #endif VB->IndexPtr[0] = &store->LitIndex[0]; #if IDX & LIGHT_TWOSIDE VB->IndexPtr[1] = &store->LitIndex[1]; #endif indexResult[0] = (GLfloat *)VB->IndexPtr[0]->data; #if IDX & LIGHT_TWOSIDE indexResult[1] = (GLfloat *)VB->IndexPtr[1]->data; #endif /* loop over vertices */ for (j=0; jLight.EnabledList) { GLfloat attenuation = 1.0F; GLfloat VP[3]; /* unit vector from vertex to light */ GLfloat n_dot_VP; /* dot product of l and n */ GLfloat *h, n_dot_h, correction = 1.0; /* compute l and attenuation */ if (!(light->_Flags & LIGHT_POSITIONAL)) { /* directional light */ COPY_3V(VP, light->_VP_inf_norm); } else { GLfloat d; /* distance from vertex to light */ SUB_3V(VP, light->_Position, vertex); d = (GLfloat) LEN_3FV( VP ); if ( d > 1e-6) { GLfloat invd = 1.0F / d; SELF_SCALE_SCALAR_3V(VP, invd); } attenuation = 1.0F / (light->ConstantAttenuation + d * (light->LinearAttenuation + d * light->QuadraticAttenuation)); /* spotlight attenuation */ if (light->_Flags & LIGHT_SPOT) { GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); if (PV_dot_dir < light->_CosCutoff) { continue; /* this light makes no contribution */ } else { GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1); GLint k = (GLint) x; GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] + (x-k)*light->_SpotExpTable[k][1]); attenuation *= spot; } } } if (attenuation < 1e-3) continue; /* this light makes no contribution */ n_dot_VP = DOT3( normal, VP ); /* which side are we lighting? */ if (n_dot_VP < 0.0F) { #if IDX & LIGHT_TWOSIDE side = 1; correction = -1; n_dot_VP = -n_dot_VP; #else continue; #endif } /* accumulate diffuse term */ diffuse[side] += n_dot_VP * light->_dli * attenuation; /* specular term */ if (ctx->Light.Model.LocalViewer) { GLfloat v[3]; COPY_3V(v, vertex); NORMALIZE_3FV(v); SUB_3V(VP, VP, v); /* h = VP + VPe */ h = VP; NORMALIZE_3FV(h); } else if (light->_Flags & LIGHT_POSITIONAL) { h = VP; /* Strangely, disabling this addition fixes a conformance * problem. If this code is enabled, l_sed.c fails. */ /*ACC_3V(h, ctx->_EyeZDir);*/ NORMALIZE_3FV(h); } else { h = light->_h_inf_norm; } n_dot_h = correction * DOT3(normal, h); if (n_dot_h > 0.0F) { GLfloat spec_coef; struct gl_shine_tab *tab = ctx->_ShineTable[side]; GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef); specular[side] += spec_coef * light->_sli * attenuation; } } /*loop over lights*/ /* Now compute final color index */ for (side = 0 ; side < NR_SIDES ; side++) { const GLfloat *ind = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_INDEXES + side]; GLfloat index; if (specular[side] > 1.0F) { index = ind[MAT_INDEX_SPECULAR]; } else { GLfloat d_a = ind[MAT_INDEX_DIFFUSE] - ind[MAT_INDEX_AMBIENT]; GLfloat s_a = ind[MAT_INDEX_SPECULAR] - ind[MAT_INDEX_AMBIENT]; index = (ind[MAT_INDEX_AMBIENT] + diffuse[side] * (1.0F-specular[side]) * d_a + specular[side] * s_a); if (index > ind[MAT_INDEX_SPECULAR]) { index = ind[MAT_INDEX_SPECULAR]; } } indexResult[side][j] = index; } } /*for vertex*/ } static void TAG(init_light_tab)( void ) { _tnl_light_tab[IDX] = TAG(light_rgba); _tnl_light_fast_tab[IDX] = TAG(light_fast_rgba); _tnl_light_fast_single_tab[IDX] = TAG(light_fast_rgba_single); _tnl_light_spec_tab[IDX] = TAG(light_rgba_spec); _tnl_light_ci_tab[IDX] = TAG(light_ci); } #undef TAG #undef IDX #undef NR_SIDES nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_normals.c0000644000000000000000000001262213614532424020646 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "macros.h" #include "imports.h" #include "mtypes.h" #include "math/m_xform.h" #include "t_context.h" #include "t_pipeline.h" struct normal_stage_data { normal_func NormalTransform; GLvector4f normal; }; #define NORMAL_STAGE_DATA(stage) ((struct normal_stage_data *)stage->privatePtr) static GLboolean run_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) { struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; const GLfloat *lengths; if (!store->NormalTransform) return GL_TRUE; /* We can only use the display list's saved normal lengths if we've * got a transformation matrix with uniform scaling. */ if (_math_matrix_is_general_scale(ctx->ModelviewMatrixStack.Top)) lengths = NULL; else lengths = VB->NormalLengthPtr; store->NormalTransform( ctx->ModelviewMatrixStack.Top, ctx->_ModelViewInvScale, VB->NormalPtr, /* input normals */ lengths, &store->normal ); /* resulting normals */ if (VB->NormalPtr->count > 1) { store->normal.stride = 4 * sizeof(GLfloat); } else { store->normal.stride = 0; } VB->NormalPtr = &store->normal; VB->AttribPtr[_TNL_ATTRIB_NORMAL] = VB->NormalPtr; VB->NormalLengthPtr = NULL; /* no longer valid */ return GL_TRUE; } /** * Examine current GL state and set the store->NormalTransform pointer * to point to the appropriate normal transformation routine. */ static void validate_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) { struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); if (ctx->VertexProgram._Enabled || (!ctx->Light.Enabled && !(ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS))) { store->NormalTransform = NULL; return; } if (ctx->_NeedEyeCoords) { /* Eye coordinates are needed, for whatever reasons. * Do lighting in eye coordinates, as the GL spec says. */ GLuint transform = NORM_TRANSFORM_NO_ROT; if (_math_matrix_has_rotation(ctx->ModelviewMatrixStack.Top)) { /* need to do full (3x3) matrix transform */ transform = NORM_TRANSFORM; } if (ctx->Transform.Normalize) { store->NormalTransform = _mesa_normal_tab[transform | NORM_NORMALIZE]; } else if (ctx->Transform.RescaleNormals && ctx->_ModelViewInvScale != 1.0) { store->NormalTransform = _mesa_normal_tab[transform | NORM_RESCALE]; } else { store->NormalTransform = _mesa_normal_tab[transform]; } } else { /* We don't need eye coordinates. * Do lighting in object coordinates. Thus, we don't need to fully * transform normal vectors (just leave them in object coordinates) * but we still need to do normalization/rescaling if enabled. */ if (ctx->Transform.Normalize) { store->NormalTransform = _mesa_normal_tab[NORM_NORMALIZE]; } else if (!ctx->Transform.RescaleNormals && ctx->_ModelViewInvScale != 1.0) { store->NormalTransform = _mesa_normal_tab[NORM_RESCALE]; } else { store->NormalTransform = NULL; } } } /** * Allocate stage's private data (storage for transformed normals). */ static GLboolean alloc_normal_data(GLcontext *ctx, struct tnl_pipeline_stage *stage) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct normal_stage_data *store; stage->privatePtr = _mesa_malloc(sizeof(*store)); store = NORMAL_STAGE_DATA(stage); if (!store) return GL_FALSE; _mesa_vector4f_alloc( &store->normal, 0, tnl->vb.Size, 32 ); return GL_TRUE; } /** * Free stage's private data. */ static void free_normal_data(struct tnl_pipeline_stage *stage) { struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); if (store) { _mesa_vector4f_free( &store->normal ); _mesa_free( store ); stage->privatePtr = NULL; } } const struct tnl_pipeline_stage _tnl_normal_transform_stage = { "normal transform", /* name */ NULL, /* privatePtr */ alloc_normal_data, /* create */ free_normal_data, /* destroy */ validate_normal_stage, /* validate */ run_normal_stage /* run */ }; nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_points.c0000644000000000000000000000677713614532424020525 0ustar /* * Mesa 3-D graphics library * Version: 6.5 * * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Brian Paul */ #include "mtypes.h" #include "imports.h" #include "t_context.h" #include "t_pipeline.h" struct point_stage_data { GLvector4f PointSize; }; #define POINT_STAGE_DATA(stage) ((struct point_stage_data *)stage->privatePtr) /** * Compute point size for each vertex from the vertex eye-space Z * coordinate and the point size attenuation factors. * Only done when point size attenuation is enabled and vertex program is * disabled. */ static GLboolean run_point_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) { if (ctx->Point._Attenuated && !ctx->VertexProgram._Enabled) { struct point_stage_data *store = POINT_STAGE_DATA(stage); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; const GLfloat (*eye)[4] = (const GLfloat (*)[4]) VB->EyePtr->data; const GLfloat p0 = ctx->Point.Params[0]; const GLfloat p1 = ctx->Point.Params[1]; const GLfloat p2 = ctx->Point.Params[2]; const GLfloat pointSize = ctx->Point.Size; GLfloat (*size)[4] = store->PointSize.data; GLuint i; for (i = 0; i < VB->Count; i++) { const GLfloat dist = FABSF(eye[i][2]); const GLfloat q = p0 + dist * (p1 + dist * p2); const GLfloat atten = (q != 0.0) ? SQRTF(1.0 / q) : 1.0; size[i][0] = pointSize * atten; /* clamping done in rasterization */ } VB->PointSizePtr = &store->PointSize; VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->PointSize; } return GL_TRUE; } static GLboolean alloc_point_data(GLcontext *ctx, struct tnl_pipeline_stage *stage) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct point_stage_data *store; stage->privatePtr = _mesa_malloc(sizeof(*store)); store = POINT_STAGE_DATA(stage); if (!store) return GL_FALSE; _mesa_vector4f_alloc( &store->PointSize, 0, VB->Size, 32 ); return GL_TRUE; } static void free_point_data(struct tnl_pipeline_stage *stage) { struct point_stage_data *store = POINT_STAGE_DATA(stage); if (store) { _mesa_vector4f_free( &store->PointSize ); _mesa_free( store ); stage->privatePtr = NULL; } } const struct tnl_pipeline_stage _tnl_point_attenuation_stage = { "point size attenuation", /* name */ NULL, /* stage private data */ alloc_point_data, /* alloc data */ free_point_data, /* destructor */ NULL, run_point_stage /* run */ }; nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_program.c0000644000000000000000000002066113614532424020644 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file tnl/t_vb_program.c * \brief Pipeline stage for executing NVIDIA vertex programs. * \author Brian Paul, Keith Whitwell */ #include "glheader.h" #include "api_noop.h" #include "colormac.h" #include "context.h" #include "dlist.h" #include "hash.h" #include "light.h" #include "macros.h" #include "imports.h" #include "simple_list.h" #include "mtypes.h" #include "nvvertprog.h" #include "nvvertexec.h" #include "nvprogram.h" #include "math/m_translate.h" #include "t_context.h" #include "t_pipeline.h" /*! * Private storage for the vertex program pipeline stage. */ struct vp_stage_data { /** The results of running the vertex program go into these arrays. */ GLvector4f attribs[15]; GLvector4f ndcCoords; /**< normalized device coords */ GLubyte *clipmask; /**< clip flags */ GLubyte ormask, andmask; /**< for clipping */ }; #define VP_STAGE_DATA(stage) ((struct vp_stage_data *)(stage->privatePtr)) /** * This function executes vertex programs */ static GLboolean run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vp_stage_data *store = VP_STAGE_DATA(stage); struct vertex_buffer *VB = &tnl->vb; struct vertex_program *program = ctx->VertexProgram.Current; GLuint i; if (!ctx->VertexProgram._Enabled || !program->IsNVProgram) return GL_TRUE; /* load program parameter registers (they're read-only) */ _mesa_init_vp_per_primitive_registers(ctx); for (i = 0; i < VB->Count; i++) { GLuint attr; _mesa_init_vp_per_vertex_registers(ctx); #if 0 printf("Input %d: %f, %f, %f, %f\n", i, VB->AttribPtr[0]->data[i][0], VB->AttribPtr[0]->data[i][1], VB->AttribPtr[0]->data[i][2], VB->AttribPtr[0]->data[i][3]); printf(" color: %f, %f, %f, %f\n", VB->AttribPtr[3]->data[i][0], VB->AttribPtr[3]->data[i][1], VB->AttribPtr[3]->data[i][2], VB->AttribPtr[3]->data[i][3]); printf(" normal: %f, %f, %f, %f\n", VB->AttribPtr[2]->data[i][0], VB->AttribPtr[2]->data[i][1], VB->AttribPtr[2]->data[i][2], VB->AttribPtr[2]->data[i][3]); #endif /* the vertex array case */ for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { if (program->InputsRead & (1 << attr)) { const GLubyte *ptr = (const GLubyte*) VB->AttribPtr[attr]->data; const GLuint size = VB->AttribPtr[attr]->size; const GLuint stride = VB->AttribPtr[attr]->stride; const GLfloat *data = (GLfloat *) (ptr + stride * i); COPY_CLEAN_4V(ctx->VertexProgram.Inputs[attr], size, data); } } /* execute the program */ ASSERT(program); _mesa_exec_vertex_program(ctx, program); /* Fixup fog an point size results if needed */ if (ctx->Fog.Enabled && (program->OutputsWritten & (1 << VERT_RESULT_FOGC)) == 0) { ctx->VertexProgram.Outputs[VERT_RESULT_FOGC][0] = 1.0; } if (ctx->VertexProgram.PointSizeEnabled && (program->OutputsWritten & (1 << VERT_RESULT_PSIZ)) == 0) { ctx->VertexProgram.Outputs[VERT_RESULT_PSIZ][0] = ctx->Point.Size; } /* copy the output registers into the VB->attribs arrays */ /* XXX (optimize) could use a conditional and smaller loop limit here */ for (attr = 0; attr < 15; attr++) { COPY_4V(store->attribs[attr].data[i], ctx->VertexProgram.Outputs[attr]); } } /* Setup the VB pointers so that the next pipeline stages get * their data from the right place (the program output arrays). */ VB->ClipPtr = &store->attribs[VERT_RESULT_HPOS]; VB->ClipPtr->size = 4; VB->ClipPtr->count = VB->Count; VB->ColorPtr[0] = &store->attribs[VERT_RESULT_COL0]; VB->ColorPtr[1] = &store->attribs[VERT_RESULT_BFC0]; VB->SecondaryColorPtr[0] = &store->attribs[VERT_RESULT_COL1]; VB->SecondaryColorPtr[1] = &store->attribs[VERT_RESULT_BFC1]; VB->FogCoordPtr = &store->attribs[VERT_RESULT_FOGC]; VB->PointSizePtr = &store->attribs[VERT_RESULT_PSIZ]; VB->AttribPtr[VERT_ATTRIB_COLOR0] = VB->ColorPtr[0]; VB->AttribPtr[VERT_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0]; VB->AttribPtr[VERT_ATTRIB_FOG] = VB->FogCoordPtr; VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->attribs[VERT_RESULT_PSIZ]; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] = &store->attribs[VERT_RESULT_TEX0 + i]; } /* Cliptest and perspective divide. Clip functions must clear * the clipmask. */ store->ormask = 0; store->andmask = CLIP_ALL_BITS; if (tnl->NeedNdcCoords) { VB->NdcPtr = _mesa_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, &store->ndcCoords, store->clipmask, &store->ormask, &store->andmask ); } else { VB->NdcPtr = NULL; _mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr, NULL, store->clipmask, &store->ormask, &store->andmask ); } if (store->andmask) /* All vertices are outside the frustum */ return GL_FALSE; /* This is where we'd do clip testing against the user-defined * clipping planes, but they're not supported by vertex programs. */ VB->ClipOrMask = store->ormask; VB->ClipMask = store->clipmask; return GL_TRUE; } /** * Called the first time stage->run is called. In effect, don't * allocate data until the first time the stage is run. */ static GLboolean init_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &(tnl->vb); struct vp_stage_data *store; const GLuint size = VB->Size; GLuint i; stage->privatePtr = MALLOC(sizeof(*store)); store = VP_STAGE_DATA(stage); if (!store) return GL_FALSE; /* Allocate arrays of vertex output values */ for (i = 0; i < 15; i++) { _mesa_vector4f_alloc( &store->attribs[i], 0, size, 32 ); store->attribs[i].size = 4; } /* a few other misc allocations */ _mesa_vector4f_alloc( &store->ndcCoords, 0, size, 32 ); store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); return GL_TRUE; } /** * Destructor for this pipeline stage. */ static void dtr( struct tnl_pipeline_stage *stage ) { struct vp_stage_data *store = VP_STAGE_DATA(stage); if (store) { GLuint i; /* free the vertex program result arrays */ for (i = 0; i < VERT_RESULT_MAX; i++) _mesa_vector4f_free( &store->attribs[i] ); /* free misc arrays */ _mesa_vector4f_free( &store->ndcCoords ); ALIGN_FREE( store->clipmask ); FREE( store ); stage->privatePtr = NULL; } } /** * Public description of this pipeline stage. */ const struct tnl_pipeline_stage _tnl_vertex_program_stage = { "vertex-program", NULL, /* private_data */ init_vp, /* create */ dtr, /* destroy */ NULL, /* validate */ run_vp /* run -- initially set to ctr */ }; nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_render.c0000644000000000000000000002470213614532424020454 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ /* * Render whole vertex buffers, including projection of vertices from * clip space and clipping of primitives. * * This file makes calls to project vertices and to the point, line * and triangle rasterizers via the function pointers: * * context->Driver.Render.* * */ #include "glheader.h" #include "context.h" #include "enums.h" #include "macros.h" #include "imports.h" #include "mtypes.h" #include "nvfragprog.h" #include "math/m_matrix.h" #include "math/m_xform.h" #include "t_pipeline.h" /**********************************************************************/ /* Clip single primitives */ /**********************************************************************/ #define W(i) coord[i][3] #define Z(i) coord[i][2] #define Y(i) coord[i][1] #define X(i) coord[i][0] #define SIZE 4 #define TAG(x) x##_4 #include "t_vb_cliptmp.h" /**********************************************************************/ /* Clip and render whole begin/end objects */ /**********************************************************************/ #define NEED_EDGEFLAG_SETUP (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) #define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] #define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val #define CLIPMASK (CLIP_ALL_BITS|CLIP_CULL_BIT) /* Vertices, with the possibility of clipping. */ #define RENDER_POINTS( start, count ) \ tnl->Driver.Render.Points( ctx, start, count ) #define RENDER_LINE( v1, v2 ) \ do { \ GLubyte c1 = mask[v1], c2 = mask[v2]; \ GLubyte ormask = c1|c2; \ if (!ormask) \ LineFunc( ctx, v1, v2 ); \ else if (!(c1 & c2 & CLIPMASK)) \ clip_line_4( ctx, v1, v2, ormask ); \ } while (0) #define RENDER_TRI( v1, v2, v3 ) \ do { \ GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \ GLubyte ormask = c1|c2|c3; \ if (!ormask) \ TriangleFunc( ctx, v1, v2, v3 ); \ else if (!(c1 & c2 & c3 & CLIPMASK)) \ clip_tri_4( ctx, v1, v2, v3, ormask ); \ } while (0) #define RENDER_QUAD( v1, v2, v3, v4 ) \ do { \ GLubyte c1 = mask[v1], c2 = mask[v2]; \ GLubyte c3 = mask[v3], c4 = mask[v4]; \ GLubyte ormask = c1|c2|c3|c4; \ if (!ormask) \ QuadFunc( ctx, v1, v2, v3, v4 ); \ else if (!(c1 & c2 & c3 & c4 & CLIPMASK)) \ clip_quad_4( ctx, v1, v2, v3, v4, ormask ); \ } while (0) #define LOCAL_VARS \ TNLcontext *tnl = TNL_CONTEXT(ctx); \ struct vertex_buffer *VB = &tnl->vb; \ const GLuint * const elt = VB->Elts; \ const GLubyte *mask = VB->ClipMask; \ const GLuint sz = VB->ClipPtr->size; \ const tnl_line_func LineFunc = tnl->Driver.Render.Line; \ const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \ const GLboolean stipple = ctx->Line.StippleFlag; \ (void) (LineFunc && TriangleFunc && QuadFunc); \ (void) elt; (void) mask; (void) sz; (void) stipple; #define TAG(x) clip_##x##_verts #define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) #define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) #define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE #define PRESERVE_VB_DEFS #include "t_vb_rendertmp.h" /* Elts, with the possibility of clipping. */ #undef ELT #undef TAG #define ELT(x) elt[x] #define TAG(x) clip_##x##_elts #include "t_vb_rendertmp.h" /* TODO: do this for all primitives, verts and elts: */ static void clip_elt_triangles( GLcontext *ctx, GLuint start, GLuint count, GLuint flags ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl_render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES]; struct vertex_buffer *VB = &tnl->vb; const GLuint * const elt = VB->Elts; GLubyte *mask = VB->ClipMask; GLuint last = count-2; GLuint j; (void) flags; tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES ); for (j=start; j < last; j+=3 ) { GLubyte c1 = mask[elt[j]]; GLubyte c2 = mask[elt[j+1]]; GLubyte c3 = mask[elt[j+2]]; GLubyte ormask = c1|c2|c3; if (ormask) { if (start < j) render_tris( ctx, start, j, 0 ); if (!(c1&c2&c3&CLIPMASK)) clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask ); start = j+3; } } if (start < j) render_tris( ctx, start, j, 0 ); } /**********************************************************************/ /* Render whole begin/end objects */ /**********************************************************************/ #define NEED_EDGEFLAG_SETUP (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) #define EDGEFLAG_GET(idx) VB->EdgeFlag[idx] #define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val /* Vertices, no clipping. */ #define RENDER_POINTS( start, count ) \ tnl->Driver.Render.Points( ctx, start, count ) #define RENDER_LINE( v1, v2 ) \ LineFunc( ctx, v1, v2 ) #define RENDER_TRI( v1, v2, v3 ) \ TriangleFunc( ctx, v1, v2, v3 ) #define RENDER_QUAD( v1, v2, v3, v4 ) \ QuadFunc( ctx, v1, v2, v3, v4 ) #define TAG(x) _tnl_##x##_verts #define LOCAL_VARS \ TNLcontext *tnl = TNL_CONTEXT(ctx); \ struct vertex_buffer *VB = &tnl->vb; \ const GLuint * const elt = VB->Elts; \ const tnl_line_func LineFunc = tnl->Driver.Render.Line; \ const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \ const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \ const GLboolean stipple = ctx->Line.StippleFlag; \ (void) (LineFunc && TriangleFunc && QuadFunc); \ (void) elt; (void) stipple #define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) #define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE #define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) #define RENDER_TAB_QUALIFIER #define PRESERVE_VB_DEFS #include "t_vb_rendertmp.h" /* Elts, no clipping. */ #undef ELT #define TAG(x) _tnl_##x##_elts #define ELT(x) elt[x] #include "t_vb_rendertmp.h" /**********************************************************************/ /* Helper functions for drivers */ /**********************************************************************/ void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; GLuint *tmp = VB->Elts; VB->Elts = (GLuint *)elts; tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END ); VB->Elts = tmp; } void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); } /**********************************************************************/ /* Clip and render whole vertex buffers */ /**********************************************************************/ static GLboolean run_render( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; tnl_render_func *tab; GLint pass = 0; /* Allow the drivers to lock before projected verts are built so * that window coordinates are guarenteed not to change before * rendering. */ ASSERT(tnl->Driver.Render.Start); tnl->Driver.Render.Start( ctx ); ASSERT(tnl->Driver.Render.BuildVertices); ASSERT(tnl->Driver.Render.PrimitiveNotify); ASSERT(tnl->Driver.Render.Points); ASSERT(tnl->Driver.Render.Line); ASSERT(tnl->Driver.Render.Triangle); ASSERT(tnl->Driver.Render.Quad); ASSERT(tnl->Driver.Render.ResetLineStipple); ASSERT(tnl->Driver.Render.Interp); ASSERT(tnl->Driver.Render.CopyPV); ASSERT(tnl->Driver.Render.ClippedLine); ASSERT(tnl->Driver.Render.ClippedPolygon); ASSERT(tnl->Driver.Render.Finish); tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 ); if (VB->ClipOrMask) { tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts; clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles; } else { tab = (VB->Elts ? tnl->Driver.Render.PrimTabElts : tnl->Driver.Render.PrimTabVerts); } do { GLuint i; for (i = 0 ; i < VB->PrimitiveCount ; i++) { GLuint prim = VB->Primitive[i].mode; GLuint start = VB->Primitive[i].start; GLuint length = VB->Primitive[i].count; assert((prim & PRIM_MODE_MASK) < GL_POLYGON+1); if (MESA_VERBOSE & VERBOSE_PRIMS) _mesa_debug(NULL, "MESA prim %s %d..%d\n", _mesa_lookup_enum_by_nr(prim & PRIM_MODE_MASK), start, start+length); if (length) tab[prim & PRIM_MODE_MASK]( ctx, start, start + length, prim ); } } while (tnl->Driver.Render.Multipass && tnl->Driver.Render.Multipass( ctx, ++pass )); tnl->Driver.Render.Finish( ctx ); return GL_FALSE; /* finished the pipe */ } /**********************************************************************/ /* Render pipeline stage */ /**********************************************************************/ const struct tnl_pipeline_stage _tnl_render_stage = { "render", /* name */ NULL, /* private data */ NULL, /* creator */ NULL, /* destructor */ NULL, /* validate */ run_render /* run */ }; nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_rendertmp.h0000644000000000000000000002263513614532424021205 0ustar /* * Mesa 3-D graphics library * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #ifndef POSTFIX #define POSTFIX #endif #ifndef INIT #define INIT(x) #endif #ifndef NEED_EDGEFLAG_SETUP #define NEED_EDGEFLAG_SETUP 0 #define EDGEFLAG_GET(a) 0 #define EDGEFLAG_SET(a,b) (void)b #endif #ifndef RESET_STIPPLE #define RESET_STIPPLE #endif #ifndef RESET_OCCLUSION #define RESET_OCCLUSION #endif #ifndef TEST_PRIM_END #define TEST_PRIM_END(flags) (flags & PRIM_END) #define TEST_PRIM_BEGIN(flags) (flags & PRIM_BEGIN) #endif #ifndef ELT #define ELT(x) x #endif #ifndef RENDER_TAB_QUALIFIER #define RENDER_TAB_QUALIFIER static #endif static void TAG(render_points)( GLcontext *ctx, GLuint start, GLuint count, GLuint flags ) { LOCAL_VARS; (void) flags; RESET_OCCLUSION; INIT(GL_POINTS); RENDER_POINTS( start, count ); POSTFIX; } static void TAG(render_lines)( GLcontext *ctx, GLuint start, GLuint count, GLuint flags ) { GLuint j; LOCAL_VARS; (void) flags; RESET_OCCLUSION; INIT(GL_LINES); for (j=start+1; j */ /* * Regarding GL_NV_texgen_reflection: * * Portions of this software may use or implement intellectual * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims * any and all warranties with respect to such intellectual property, * including any use thereof or modifications thereto. */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "macros.h" #include "imports.h" #include "mtypes.h" #include "math/m_xform.h" #include "t_context.h" #include "t_pipeline.h" /*********************************************************************** * Automatic texture coordinate generation (texgen) code. */ struct texgen_stage_data; typedef void (*texgen_func)( GLcontext *ctx, struct texgen_stage_data *store, GLuint unit); struct texgen_stage_data { /* Per-texunit derived state. */ GLuint TexgenSize[MAX_TEXTURE_COORD_UNITS]; texgen_func TexgenFunc[MAX_TEXTURE_COORD_UNITS]; /* Temporary values used in texgen. */ GLfloat (*tmp_f)[3]; GLfloat *tmp_m; /* Buffered outputs of the stage. */ GLvector4f texcoord[MAX_TEXTURE_COORD_UNITS]; }; #define TEXGEN_STAGE_DATA(stage) ((struct texgen_stage_data *)stage->privatePtr) static GLuint all_bits[5] = { 0, VEC_SIZE_1, VEC_SIZE_2, VEC_SIZE_3, VEC_SIZE_4, }; #define VEC_SIZE_FLAGS (VEC_SIZE_1|VEC_SIZE_2|VEC_SIZE_3|VEC_SIZE_4) #define TEXGEN_NEED_M (TEXGEN_SPHERE_MAP) #define TEXGEN_NEED_F (TEXGEN_SPHERE_MAP | \ TEXGEN_REFLECTION_MAP_NV) static void build_m3( GLfloat f[][3], GLfloat m[], const GLvector4f *normal, const GLvector4f *eye ) { GLuint stride = eye->stride; GLfloat *coord = (GLfloat *)eye->start; GLuint count = eye->count; const GLfloat *norm = normal->start; GLuint i; for (i=0;istride)) { GLfloat u[3], two_nu, fx, fy, fz; COPY_3V( u, coord ); NORMALIZE_3FV( u ); two_nu = 2.0F * DOT3(norm,u); fx = f[i][0] = u[0] - norm[0] * two_nu; fy = f[i][1] = u[1] - norm[1] * two_nu; fz = f[i][2] = u[2] - norm[2] * two_nu; m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); if (m[i] != 0.0F) { m[i] = 0.5F * _mesa_inv_sqrtf(m[i]); } } } static void build_m2( GLfloat f[][3], GLfloat m[], const GLvector4f *normal, const GLvector4f *eye ) { GLuint stride = eye->stride; GLfloat *coord = eye->start; GLuint count = eye->count; GLfloat *norm = normal->start; GLuint i; for (i=0;istride)) { GLfloat u[3], two_nu, fx, fy, fz; COPY_2V( u, coord ); u[2] = 0; NORMALIZE_3FV( u ); two_nu = 2.0F * DOT3(norm,u); fx = f[i][0] = u[0] - norm[0] * two_nu; fy = f[i][1] = u[1] - norm[1] * two_nu; fz = f[i][2] = u[2] - norm[2] * two_nu; m[i] = fx * fx + fy * fy + (fz + 1.0F) * (fz + 1.0F); if (m[i] != 0.0F) { m[i] = 0.5F * _mesa_inv_sqrtf(m[i]); } } } typedef void (*build_m_func)( GLfloat f[][3], GLfloat m[], const GLvector4f *normal, const GLvector4f *eye ); static build_m_func build_m_tab[5] = { NULL, NULL, build_m2, build_m3, build_m3 }; /* This is unusual in that we respect the stride of the output vector * (f). This allows us to pass in either a texcoord vector4f, or a * temporary vector3f. */ static void build_f3( GLfloat *f, GLuint fstride, const GLvector4f *normal, const GLvector4f *eye ) { GLuint stride = eye->stride; GLfloat *coord = eye->start; GLuint count = eye->count; GLfloat *norm = normal->start; GLuint i; for (i=0;istride); } } static void build_f2( GLfloat *f, GLuint fstride, const GLvector4f *normal, const GLvector4f *eye ) { GLuint stride = eye->stride; GLfloat *coord = eye->start; GLuint count = eye->count; GLfloat *norm = normal->start; GLuint i; for (i=0;istride); } } typedef void (*build_f_func)( GLfloat *f, GLuint fstride, const GLvector4f *normal_vec, const GLvector4f *eye ); /* Just treat 4-vectors as 3-vectors. */ static build_f_func build_f_tab[5] = { NULL, NULL, build_f2, build_f3, build_f3 }; /* Special case texgen functions. */ static void texgen_reflection_map_nv( GLcontext *ctx, struct texgen_stage_data *store, GLuint unit ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLvector4f *in = VB->TexCoordPtr[unit]; GLvector4f *out = &store->texcoord[unit]; build_f_tab[VB->EyePtr->size]( out->start, out->stride, VB->NormalPtr, VB->EyePtr ); out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3; out->count = VB->Count; out->size = MAX2(in->size, 3); if (in->size == 4) _mesa_copy_tab[0x8]( out, in ); } static void texgen_normal_map_nv( GLcontext *ctx, struct texgen_stage_data *store, GLuint unit ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLvector4f *in = VB->TexCoordPtr[unit]; GLvector4f *out = &store->texcoord[unit]; GLvector4f *normal = VB->NormalPtr; GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->start; GLuint count = VB->Count; GLuint i; const GLfloat *norm = normal->start; for (i=0;istride)) { texcoord[i][0] = norm[0]; texcoord[i][1] = norm[1]; texcoord[i][2] = norm[2]; } out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3; out->count = count; out->size = MAX2(in->size, 3); if (in->size == 4) _mesa_copy_tab[0x8]( out, in ); } static void texgen_sphere_map( GLcontext *ctx, struct texgen_stage_data *store, GLuint unit ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLvector4f *in = VB->TexCoordPtr[unit]; GLvector4f *out = &store->texcoord[unit]; GLfloat (*texcoord)[4] = (GLfloat (*)[4]) out->start; GLuint count = VB->Count; GLuint i; GLfloat (*f)[3] = store->tmp_f; GLfloat *m = store->tmp_m; (build_m_tab[VB->EyePtr->size])( store->tmp_f, store->tmp_m, VB->NormalPtr, VB->EyePtr ); out->size = MAX2(in->size,2); for (i=0;icount = count; out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_2; if (in->size > 2) _mesa_copy_tab[all_bits[in->size] & ~0x3]( out, in ); } static void texgen( GLcontext *ctx, struct texgen_stage_data *store, GLuint unit ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; GLvector4f *in = VB->TexCoordPtr[unit]; GLvector4f *out = &store->texcoord[unit]; const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const GLvector4f *obj = VB->ObjPtr; const GLvector4f *eye = VB->EyePtr; const GLvector4f *normal = VB->NormalPtr; const GLfloat *m = store->tmp_m; const GLuint count = VB->Count; GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data; GLfloat (*f)[3] = store->tmp_f; GLuint copy; if (texUnit->_GenFlags & TEXGEN_NEED_M) { build_m_tab[eye->size]( store->tmp_f, store->tmp_m, normal, eye ); } else if (texUnit->_GenFlags & TEXGEN_NEED_F) { build_f_tab[eye->size]( (GLfloat *)store->tmp_f, 3, normal, eye ); } out->size = MAX2(in->size, store->TexgenSize[unit]); out->flags |= (in->flags & VEC_SIZE_FLAGS) | texUnit->TexGenEnabled; out->count = count; copy = (all_bits[in->size] & ~texUnit->TexGenEnabled); if (copy) _mesa_copy_tab[copy]( out, in ); if (texUnit->TexGenEnabled & S_BIT) { GLuint i; switch (texUnit->GenModeS) { case GL_OBJECT_LINEAR: _mesa_dotprod_tab[obj->size]( (GLfloat *)out->data, sizeof(out->data[0]), obj, texUnit->ObjectPlaneS ); break; case GL_EYE_LINEAR: _mesa_dotprod_tab[eye->size]( (GLfloat *)out->data, sizeof(out->data[0]), eye, texUnit->EyePlaneS ); break; case GL_SPHERE_MAP: for (i = 0; i < count; i++) texcoord[i][0] = f[i][0] * m[i] + 0.5F; break; case GL_REFLECTION_MAP_NV: for (i=0;istart; for (i=0;istride)) { texcoord[i][0] = norm[0]; } break; } default: _mesa_problem(ctx, "Bad S texgen"); } } if (texUnit->TexGenEnabled & T_BIT) { GLuint i; switch (texUnit->GenModeT) { case GL_OBJECT_LINEAR: _mesa_dotprod_tab[obj->size]( &(out->data[0][1]), sizeof(out->data[0]), obj, texUnit->ObjectPlaneT ); break; case GL_EYE_LINEAR: _mesa_dotprod_tab[eye->size]( &(out->data[0][1]), sizeof(out->data[0]), eye, texUnit->EyePlaneT ); break; case GL_SPHERE_MAP: for (i = 0; i < count; i++) texcoord[i][1] = f[i][1] * m[i] + 0.5F; break; case GL_REFLECTION_MAP_NV: for (i=0;istart; for (i=0;istride)) { texcoord[i][1] = norm[1]; } break; } default: _mesa_problem(ctx, "Bad T texgen"); } } if (texUnit->TexGenEnabled & R_BIT) { GLuint i; switch (texUnit->GenModeR) { case GL_OBJECT_LINEAR: _mesa_dotprod_tab[obj->size]( &(out->data[0][2]), sizeof(out->data[0]), obj, texUnit->ObjectPlaneR ); break; case GL_EYE_LINEAR: _mesa_dotprod_tab[eye->size]( &(out->data[0][2]), sizeof(out->data[0]), eye, texUnit->EyePlaneR ); break; case GL_REFLECTION_MAP_NV: for (i=0;istart; for (i=0;istride)) { texcoord[i][2] = norm[2]; } break; } default: _mesa_problem(ctx, "Bad R texgen"); } } if (texUnit->TexGenEnabled & Q_BIT) { switch (texUnit->GenModeQ) { case GL_OBJECT_LINEAR: _mesa_dotprod_tab[obj->size]( &(out->data[0][3]), sizeof(out->data[0]), obj, texUnit->ObjectPlaneQ ); break; case GL_EYE_LINEAR: _mesa_dotprod_tab[eye->size]( &(out->data[0][3]), sizeof(out->data[0]), eye, texUnit->EyePlaneQ ); break; default: _mesa_problem(ctx, "Bad Q texgen"); } } } static GLboolean run_texgen_stage( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); GLuint i; if (!ctx->Texture._TexGenEnabled || ctx->VertexProgram._Enabled) return GL_TRUE; for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; if (texUnit->TexGenEnabled) { store->TexgenFunc[i]( ctx, store, i ); VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] = &store->texcoord[i]; } } return GL_TRUE; } static void validate_texgen_stage( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); GLuint i; if (!ctx->Texture._TexGenEnabled || ctx->VertexProgram._Enabled) return; for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; if (texUnit->TexGenEnabled) { GLuint sz; if (texUnit->TexGenEnabled & Q_BIT) sz = 4; else if (texUnit->TexGenEnabled & R_BIT) sz = 3; else if (texUnit->TexGenEnabled & T_BIT) sz = 2; else sz = 1; store->TexgenSize[i] = sz; store->TexgenFunc[i] = texgen; /* general solution */ /* look for special texgen cases */ if (texUnit->TexGenEnabled == (S_BIT|T_BIT|R_BIT)) { if (texUnit->_GenFlags == TEXGEN_REFLECTION_MAP_NV) { store->TexgenFunc[i] = texgen_reflection_map_nv; } else if (texUnit->_GenFlags == TEXGEN_NORMAL_MAP_NV) { store->TexgenFunc[i] = texgen_normal_map_nv; } } else if (texUnit->TexGenEnabled == (S_BIT|T_BIT) && texUnit->_GenFlags == TEXGEN_SPHERE_MAP) { store->TexgenFunc[i] = texgen_sphere_map; } } } } /* Called the first time stage->run() is invoked. */ static GLboolean alloc_texgen_data( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct texgen_stage_data *store; GLuint i; stage->privatePtr = CALLOC(sizeof(*store)); store = TEXGEN_STAGE_DATA(stage); if (!store) return GL_FALSE; for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) _mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 ); store->tmp_f = (GLfloat (*)[3]) MALLOC(VB->Size * sizeof(GLfloat) * 3); store->tmp_m = (GLfloat *) MALLOC(VB->Size * sizeof(GLfloat)); return GL_TRUE; } static void free_texgen_data( struct tnl_pipeline_stage *stage ) { struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); GLuint i; if (store) { for (i = 0 ; i < MAX_TEXTURE_COORD_UNITS ; i++) if (store->texcoord[i].data) _mesa_vector4f_free( &store->texcoord[i] ); if (store->tmp_f) FREE( store->tmp_f ); if (store->tmp_m) FREE( store->tmp_m ); FREE( store ); stage->privatePtr = NULL; } } const struct tnl_pipeline_stage _tnl_texgen_stage = { "texgen", /* name */ NULL, /* private data */ alloc_texgen_data, /* destructor */ free_texgen_data, /* destructor */ validate_texgen_stage, /* check */ run_texgen_stage /* run -- initially set to alloc data */ }; nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_texmat.c0000644000000000000000000000745313614532424020503 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "macros.h" #include "imports.h" #include "mtypes.h" #include "math/m_xform.h" #include "t_context.h" #include "t_pipeline.h" /* Is there any real benefit seperating texmat from texgen? It means * we need two lots of intermediate storage. Any changes to * _NEW_TEXTURE will invalidate both sets -- it's only on changes to * *only* _NEW_TEXTURE_MATRIX that texgen survives but texmat doesn't. * * However, the seperation of this code from the complex texgen stuff * is very appealing. */ struct texmat_stage_data { GLvector4f texcoord[MAX_TEXTURE_COORD_UNITS]; }; #define TEXMAT_STAGE_DATA(stage) ((struct texmat_stage_data *)stage->privatePtr) static GLboolean run_texmat_stage( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLuint i; if (!ctx->Texture._TexMatEnabled || ctx->VertexProgram._Enabled) return GL_TRUE; /* ENABLE_TEXMAT implies that the texture matrix is not the * identity, so we don't have to check that here. */ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) { if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) { (void) TransformRaw( &store->texcoord[i], ctx->TextureMatrixStack[i].Top, VB->TexCoordPtr[i]); VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] = &store->texcoord[i]; } } return GL_TRUE; } /* Called the first time stage->run() is invoked. */ static GLboolean alloc_texmat_data( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct texmat_stage_data *store; GLuint i; stage->privatePtr = CALLOC(sizeof(*store)); store = TEXMAT_STAGE_DATA(stage); if (!store) return GL_FALSE; for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) _mesa_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 ); return GL_TRUE; } static void free_texmat_data( struct tnl_pipeline_stage *stage ) { struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); GLuint i; if (store) { for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) if (store->texcoord[i].data) _mesa_vector4f_free( &store->texcoord[i] ); FREE( store ); stage->privatePtr = NULL; } } const struct tnl_pipeline_stage _tnl_texture_transform_stage = { "texture transform", /* name */ NULL, /* private data */ alloc_texmat_data, free_texmat_data, /* destructor */ NULL, run_texmat_stage, }; nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vb_vertex.c0000644000000000000000000001557413614532424020521 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "colormac.h" #include "context.h" #include "macros.h" #include "imports.h" #include "mtypes.h" #include "math/m_xform.h" #include "t_context.h" #include "t_pipeline.h" struct vertex_stage_data { GLvector4f eye; GLvector4f clip; GLvector4f proj; GLubyte *clipmask; GLubyte ormask; GLubyte andmask; }; #define VERTEX_STAGE_DATA(stage) ((struct vertex_stage_data *)stage->privatePtr) /* This function implements cliptesting for user-defined clip planes. * The clipping of primitives to these planes is implemented in * t_render_clip.h. */ #define USER_CLIPTEST(NAME, SZ) \ static void NAME( GLcontext *ctx, \ GLvector4f *clip, \ GLubyte *clipmask, \ GLubyte *clipormask, \ GLubyte *clipandmask ) \ { \ GLuint p; \ \ for (p = 0; p < ctx->Const.MaxClipPlanes; p++) \ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { \ GLuint nr, i; \ const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; \ const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; \ const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; \ const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; \ GLfloat *coord = (GLfloat *)clip->data; \ GLuint stride = clip->stride; \ GLuint count = clip->count; \ \ for (nr = 0, i = 0 ; i < count ; i++) { \ GLfloat dp = coord[0] * a + coord[1] * b; \ if (SZ > 2) dp += coord[2] * c; \ if (SZ > 3) dp += coord[3] * d; else dp += d; \ \ if (dp < 0) { \ nr++; \ clipmask[i] |= CLIP_USER_BIT; \ } \ \ STRIDE_F(coord, stride); \ } \ \ if (nr > 0) { \ *clipormask |= CLIP_USER_BIT; \ if (nr == count) { \ *clipandmask |= CLIP_USER_BIT; \ return; \ } \ } \ } \ } USER_CLIPTEST(userclip2, 2) USER_CLIPTEST(userclip3, 3) USER_CLIPTEST(userclip4, 4) static void (*(usercliptab[5]))( GLcontext *, GLvector4f *, GLubyte *, GLubyte *, GLubyte * ) = { NULL, NULL, userclip2, userclip3, userclip4 }; static GLboolean run_vertex_stage( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { struct vertex_stage_data *store = (struct vertex_stage_data *)stage->privatePtr; TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; if (ctx->VertexProgram._Enabled) return GL_TRUE; if (ctx->_NeedEyeCoords) { /* Separate modelview transformation: * Use combined ModelProject to avoid some depth artifacts */ if (ctx->ModelviewMatrixStack.Top->type == MATRIX_IDENTITY) VB->EyePtr = VB->ObjPtr; else VB->EyePtr = TransformRaw( &store->eye, ctx->ModelviewMatrixStack.Top, VB->ObjPtr); } VB->ClipPtr = TransformRaw( &store->clip, &ctx->_ModelProjectMatrix, VB->ObjPtr ); /* Drivers expect this to be clean to element 4... */ switch (VB->ClipPtr->size) { case 1: /* impossible */ case 2: _mesa_vector4f_clean_elem( VB->ClipPtr, VB->Count, 2 ); /* fall-through */ case 3: _mesa_vector4f_clean_elem( VB->ClipPtr, VB->Count, 3 ); /* fall-through */ case 4: break; } /* Cliptest and perspective divide. Clip functions must clear * the clipmask. */ store->ormask = 0; store->andmask = CLIP_ALL_BITS; if (tnl->NeedNdcCoords) { VB->NdcPtr = _mesa_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, &store->proj, store->clipmask, &store->ormask, &store->andmask ); } else { VB->NdcPtr = NULL; _mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr, NULL, store->clipmask, &store->ormask, &store->andmask ); } if (store->andmask) return GL_FALSE; /* Test userclip planes. This contributes to VB->ClipMask, so * is essentially required to be in this stage. */ if (ctx->Transform.ClipPlanesEnabled) { usercliptab[VB->ClipPtr->size]( ctx, VB->ClipPtr, store->clipmask, &store->ormask, &store->andmask ); if (store->andmask) return GL_FALSE; } VB->ClipAndMask = store->andmask; VB->ClipOrMask = store->ormask; VB->ClipMask = store->clipmask; return GL_TRUE; } static GLboolean init_vertex_stage( GLcontext *ctx, struct tnl_pipeline_stage *stage ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct vertex_stage_data *store; GLuint size = VB->Size; stage->privatePtr = CALLOC(sizeof(*store)); store = VERTEX_STAGE_DATA(stage); if (!store) return GL_FALSE; _mesa_vector4f_alloc( &store->eye, 0, size, 32 ); _mesa_vector4f_alloc( &store->clip, 0, size, 32 ); _mesa_vector4f_alloc( &store->proj, 0, size, 32 ); store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); if (!store->clipmask || !store->eye.data || !store->clip.data || !store->proj.data) return GL_FALSE; return GL_TRUE; } static void dtr( struct tnl_pipeline_stage *stage ) { struct vertex_stage_data *store = VERTEX_STAGE_DATA(stage); if (store) { _mesa_vector4f_free( &store->eye ); _mesa_vector4f_free( &store->clip ); _mesa_vector4f_free( &store->proj ); ALIGN_FREE( store->clipmask ); FREE(store); stage->privatePtr = NULL; stage->run = init_vertex_stage; } } const struct tnl_pipeline_stage _tnl_vertex_transform_stage = { "modelview/project/cliptest/divide", NULL, /* private data */ init_vertex_stage, dtr, /* destructor */ NULL, run_vertex_stage /* run -- initially set to init */ }; nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vertex.c0000644000000000000000000003262013614532424020021 0ustar /* * Copyright 2003 Tungsten Graphics, inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * on the rights to use, copy, modify, merge, publish, distribute, sub * license, and/or sell copies of the Software, and to permit persons to whom * the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "context.h" #include "colormac.h" #include "t_context.h" #include "t_vertex.h" #define DBG 0 /* Build and manage clipspace/ndc/window vertices. */ static GLboolean match_fastpath( struct tnl_clipspace *vtx, const struct tnl_clipspace_fastpath *fp) { GLuint j; if (vtx->attr_count != fp->attr_count) return GL_FALSE; for (j = 0; j < vtx->attr_count; j++) if (vtx->attr[j].format != fp->attr[j].format || vtx->attr[j].inputsize != fp->attr[j].size || vtx->attr[j].vertoffset != fp->attr[j].offset) return GL_FALSE; if (fp->match_strides) { if (vtx->vertex_size != fp->vertex_size) return GL_FALSE; for (j = 0; j < vtx->attr_count; j++) if (vtx->attr[j].inputstride != fp->attr[j].stride) return GL_FALSE; } return GL_TRUE; } static GLboolean search_fastpath_emit( struct tnl_clipspace *vtx ) { struct tnl_clipspace_fastpath *fp = vtx->fastpath; for ( ; fp ; fp = fp->next) { if (match_fastpath(vtx, fp)) { vtx->emit = fp->func; return GL_TRUE; } } return GL_FALSE; } void _tnl_register_fastpath( struct tnl_clipspace *vtx, GLboolean match_strides ) { struct tnl_clipspace_fastpath *fastpath = CALLOC_STRUCT(tnl_clipspace_fastpath); GLuint i; fastpath->vertex_size = vtx->vertex_size; fastpath->attr_count = vtx->attr_count; fastpath->match_strides = match_strides; fastpath->func = vtx->emit; fastpath->attr = MALLOC(vtx->attr_count * sizeof(fastpath->attr[0])); for (i = 0; i < vtx->attr_count; i++) { fastpath->attr[i].format = vtx->attr[i].format; fastpath->attr[i].stride = vtx->attr[i].inputstride; fastpath->attr[i].size = vtx->attr[i].inputsize; fastpath->attr[i].offset = vtx->attr[i].vertoffset; } fastpath->next = vtx->fastpath; vtx->fastpath = fastpath; } /*********************************************************************** * Build codegen functions or return generic ones: */ static void choose_emit_func( GLcontext *ctx, GLuint count, GLubyte *dest) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); struct tnl_clipspace_attr *a = vtx->attr; const GLuint attr_count = vtx->attr_count; GLuint j; for (j = 0; j < attr_count; j++) { GLvector4f *vptr = VB->AttribPtr[a[j].attrib]; a[j].inputstride = vptr->stride; a[j].inputsize = vptr->size; a[j].emit = a[j].insert[vptr->size - 1]; /* not always used */ } vtx->emit = NULL; /* Does this match an existing (hardwired, codegen or known-bad) * fastpath? */ if (search_fastpath_emit(vtx)) { /* Use this result. If it is null, then it is already known * that the current state will fail for codegen and there is no * point trying again. */ } else if (vtx->codegen_emit) { vtx->codegen_emit(ctx); } if (!vtx->emit) { _tnl_generate_hardwired_emit(ctx); } /* Otherwise use the generic version: */ if (!vtx->emit) vtx->emit = _tnl_generic_emit; vtx->emit( ctx, count, dest ); } static void choose_interp_func( GLcontext *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); if (vtx->need_extras && (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) { vtx->interp = _tnl_generic_interp_extras; } else { vtx->interp = _tnl_generic_interp; } vtx->interp( ctx, t, edst, eout, ein, force_boundary ); } static void choose_copy_pv_func( GLcontext *ctx, GLuint edst, GLuint esrc ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); if (vtx->need_extras && (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) { vtx->copy_pv = _tnl_generic_copy_pv_extras; } else { vtx->copy_pv = _tnl_generic_copy_pv; } vtx->copy_pv( ctx, edst, esrc ); } /*********************************************************************** * Public entrypoints, mostly dispatch to the above: */ /* Interpolate between two vertices to produce a third: */ void _tnl_interp( GLcontext *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); vtx->interp( ctx, t, edst, eout, ein, force_boundary ); } /* Copy colors from one vertex to another: */ void _tnl_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); vtx->copy_pv( ctx, edst, esrc ); } /* Extract a named attribute from a hardware vertex. Will have to * reverse any viewport transformation, swizzling or other conversions * which may have been applied: */ void _tnl_get_attr( GLcontext *ctx, const void *vin, GLenum attr, GLfloat *dest ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); const struct tnl_clipspace_attr *a = vtx->attr; const GLuint attr_count = vtx->attr_count; GLuint j; for (j = 0; j < attr_count; j++) { if (a[j].attrib == attr) { a[j].extract( &a[j], dest, (GLubyte *)vin + a[j].vertoffset ); return; } } /* Else return the value from ctx->Current. */ _mesa_memcpy( dest, ctx->Current.Attrib[attr], 4*sizeof(GLfloat)); } /* Complementary operation to the above. */ void _tnl_set_attr( GLcontext *ctx, void *vout, GLenum attr, const GLfloat *src ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); const struct tnl_clipspace_attr *a = vtx->attr; const GLuint attr_count = vtx->attr_count; GLuint j; for (j = 0; j < attr_count; j++) { if (a[j].attrib == attr) { a[j].insert[4-1]( &a[j], (GLubyte *)vout + a[j].vertoffset, src ); return; } } } void *_tnl_get_vertex( GLcontext *ctx, GLuint nr ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); return vtx->vertex_buf + nr * vtx->vertex_size; } void _tnl_invalidate_vertex_state( GLcontext *ctx, GLuint new_state ) { if (new_state & (_DD_NEW_TRI_LIGHT_TWOSIDE|_DD_NEW_TRI_UNFILLED) ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); vtx->new_inputs = ~0; vtx->interp = choose_interp_func; vtx->copy_pv = choose_copy_pv_func; } } static void invalidate_funcs( struct tnl_clipspace *vtx ) { vtx->emit = choose_emit_func; vtx->interp = choose_interp_func; vtx->copy_pv = choose_copy_pv_func; vtx->new_inputs = ~0; } GLuint _tnl_install_attrs( GLcontext *ctx, const struct tnl_attr_map *map, GLuint nr, const GLfloat *vp, GLuint unpacked_size ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); GLuint offset = 0; GLuint i, j; assert(nr < _TNL_ATTRIB_MAX); assert(nr == 0 || map[0].attrib == VERT_ATTRIB_POS); vtx->new_inputs = ~0; vtx->need_viewport = GL_FALSE; if (vp) { vtx->need_viewport = GL_TRUE; } for (j = 0, i = 0; i < nr; i++) { const GLuint format = map[i].format; if (format == EMIT_PAD) { if (DBG) _mesa_printf("%d: pad %d, offset %d\n", i, map[i].offset, offset); offset += map[i].offset; } else { GLuint tmpoffset; if (unpacked_size) tmpoffset = map[i].offset; else tmpoffset = offset; if (vtx->attr_count != j || vtx->attr[j].attrib != map[i].attrib || vtx->attr[j].format != format || vtx->attr[j].vertoffset != tmpoffset) { invalidate_funcs(vtx); vtx->attr[j].attrib = map[i].attrib; vtx->attr[j].format = format; vtx->attr[j].vp = vp; vtx->attr[j].insert = _tnl_format_info[format].insert; vtx->attr[j].extract = _tnl_format_info[format].extract; vtx->attr[j].vertattrsize = _tnl_format_info[format].attrsize; vtx->attr[j].vertoffset = tmpoffset; } if (DBG) _mesa_printf("%d: %s, vp %p, offset %d\n", i, _tnl_format_info[format].name, (void *)vp, vtx->attr[j].vertoffset); offset += _tnl_format_info[format].attrsize; j++; } } vtx->attr_count = j; if (unpacked_size) vtx->vertex_size = unpacked_size; else vtx->vertex_size = offset; assert(vtx->vertex_size <= vtx->max_vertex_size); return vtx->vertex_size; } void _tnl_invalidate_vertices( GLcontext *ctx, GLuint newinputs ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); vtx->new_inputs |= newinputs; } /* This event has broader use beyond this file - will move elsewhere * and probably invoke a driver callback. */ void _tnl_notify_pipeline_output_change( GLcontext *ctx ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); invalidate_funcs(vtx); } static void update_input_ptrs( GLcontext *ctx, GLuint start ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); struct tnl_clipspace_attr *a = vtx->attr; const GLuint count = vtx->attr_count; GLuint j; for (j = 0; j < count; j++) { GLvector4f *vptr = VB->AttribPtr[a[j].attrib]; if (vtx->emit != choose_emit_func) { assert(a[j].inputstride == vptr->stride); assert(a[j].inputsize == vptr->size); } a[j].inputptr = ((GLubyte *)vptr->data) + start * vptr->stride; } if (a->vp) { vtx->vp_scale[0] = a->vp[MAT_SX]; vtx->vp_scale[1] = a->vp[MAT_SY]; vtx->vp_scale[2] = a->vp[MAT_SZ]; vtx->vp_scale[3] = 1.0; vtx->vp_xlate[0] = a->vp[MAT_TX]; vtx->vp_xlate[1] = a->vp[MAT_TY]; vtx->vp_xlate[2] = a->vp[MAT_TZ]; vtx->vp_xlate[3] = 0.0; } } void _tnl_build_vertices( GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); update_input_ptrs( ctx, start ); vtx->emit( ctx, end - start, (GLubyte *)(vtx->vertex_buf + start * vtx->vertex_size)); } /* Emit VB vertices start..end to dest. Note that VB vertex at * postion start will be emitted to dest at position zero. */ void *_tnl_emit_vertices_to_buffer( GLcontext *ctx, GLuint start, GLuint end, void *dest ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); update_input_ptrs(ctx, start); /* Note: dest should not be adjusted for non-zero 'start' values: */ vtx->emit( ctx, end - start, dest ); return (void *)((GLubyte *)dest + vtx->vertex_size * (end - start)); } void _tnl_init_vertices( GLcontext *ctx, GLuint vb_size, GLuint max_vertex_size ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); _tnl_install_attrs( ctx, NULL, 0, NULL, 0 ); vtx->need_extras = GL_TRUE; if (max_vertex_size > vtx->max_vertex_size) { _tnl_free_vertices( ctx ); vtx->max_vertex_size = max_vertex_size; vtx->vertex_buf = (GLubyte *)ALIGN_CALLOC(vb_size * max_vertex_size, 32 ); invalidate_funcs(vtx); } switch(CHAN_TYPE) { case GL_UNSIGNED_BYTE: vtx->chan_scale[0] = 255.0; vtx->chan_scale[1] = 255.0; vtx->chan_scale[2] = 255.0; vtx->chan_scale[3] = 255.0; break; case GL_UNSIGNED_SHORT: vtx->chan_scale[0] = 65535.0; vtx->chan_scale[1] = 65535.0; vtx->chan_scale[2] = 65535.0; vtx->chan_scale[3] = 65535.0; break; default: vtx->chan_scale[0] = 1.0; vtx->chan_scale[1] = 1.0; vtx->chan_scale[2] = 1.0; vtx->chan_scale[3] = 1.0; break; } vtx->identity[0] = 0.0; vtx->identity[1] = 0.0; vtx->identity[2] = 0.0; vtx->identity[3] = 1.0; vtx->codegen_emit = NULL; #ifdef USE_SSE_ASM if (!_mesa_getenv("MESA_NO_CODEGEN")) vtx->codegen_emit = _tnl_generate_sse_emit; #endif } void _tnl_free_vertices( GLcontext *ctx ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); struct tnl_clipspace_fastpath *fp, *tmp; if (vtx->vertex_buf) { ALIGN_FREE(vtx->vertex_buf); vtx->vertex_buf = NULL; } for (fp = vtx->fastpath ; fp ; fp = tmp) { tmp = fp->next; FREE(fp->attr); /* KW: At the moment, fp->func is constrained to be allocated by * _mesa_exec_alloc(), as the hardwired fastpaths in * t_vertex_generic.c are handled specially. It would be nice * to unify them, but this probably won't change until this * module gets another overhaul. */ _mesa_exec_free((void *) fp->func); FREE(fp); } vtx->fastpath = NULL; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vertex_generic.c0000644000000000000000000007235613614532424021527 0ustar /* * Copyright 2003 Tungsten Graphics, inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * on the rights to use, copy, modify, merge, publish, distribute, sub * license, and/or sell copies of the Software, and to permit persons to whom * the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "context.h" #include "colormac.h" #include "t_context.h" #include "t_vertex.h" #include "simple_list.h" /* * These functions take the NDC coordinates pointed to by 'in', apply the * NDC->Viewport mapping and store the results at 'v'. */ static INLINE void insert_4f_viewport_4( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)v; const GLfloat * const vp = a->vp; out[0] = vp[0] * in[0] + vp[12]; out[1] = vp[5] * in[1] + vp[13]; out[2] = vp[10] * in[2] + vp[14]; out[3] = in[3]; } static INLINE void insert_4f_viewport_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)v; const GLfloat * const vp = a->vp; out[0] = vp[0] * in[0] + vp[12]; out[1] = vp[5] * in[1] + vp[13]; out[2] = vp[10] * in[2] + vp[14]; out[3] = 1; } static INLINE void insert_4f_viewport_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)v; const GLfloat * const vp = a->vp; out[0] = vp[0] * in[0] + vp[12]; out[1] = vp[5] * in[1] + vp[13]; out[2] = vp[14]; out[3] = 1; } static INLINE void insert_4f_viewport_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)v; const GLfloat * const vp = a->vp; out[0] = vp[0] * in[0] + vp[12]; out[1] = vp[13]; out[2] = vp[14]; out[3] = 1; } static INLINE void insert_3f_viewport_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)v; const GLfloat * const vp = a->vp; out[0] = vp[0] * in[0] + vp[12]; out[1] = vp[5] * in[1] + vp[13]; out[2] = vp[10] * in[2] + vp[14]; } static INLINE void insert_3f_viewport_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)v; const GLfloat * const vp = a->vp; out[0] = vp[0] * in[0] + vp[12]; out[1] = vp[5] * in[1] + vp[13]; out[2] = vp[10] * in[2] + vp[14]; } static INLINE void insert_3f_viewport_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)v; const GLfloat * const vp = a->vp; out[0] = vp[0] * in[0] + vp[12]; out[1] = vp[13]; out[2] = vp[14]; } static INLINE void insert_2f_viewport_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)v; const GLfloat * const vp = a->vp; out[0] = vp[0] * in[0] + vp[12]; out[1] = vp[5] * in[1] + vp[13]; } static INLINE void insert_2f_viewport_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)v; const GLfloat * const vp = a->vp; out[0] = vp[0] * in[0] + vp[12]; out[1] = vp[13]; } /* * These functions do the same as above, except for the viewport mapping. */ static INLINE void insert_4f_4( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)(v); (void) a; out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; out[3] = in[3]; } static INLINE void insert_4f_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)(v); (void) a; out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; out[3] = 1; } static INLINE void insert_4f_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)(v); (void) a; out[0] = in[0]; out[1] = in[1]; out[2] = 0; out[3] = 1; } static INLINE void insert_4f_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)(v); (void) a; out[0] = in[0]; out[1] = 0; out[2] = 0; out[3] = 1; } static INLINE void insert_3f_xyw_4( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)(v); (void) a; out[0] = in[0]; out[1] = in[1]; out[2] = in[3]; } static INLINE void insert_3f_xyw_err( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; (void) v; (void) in; abort(); } static INLINE void insert_3f_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)(v); (void) a; out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; } static INLINE void insert_3f_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)(v); (void) a; out[0] = in[0]; out[1] = in[1]; out[2] = 0; } static INLINE void insert_3f_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)(v); (void) a; out[0] = in[0]; out[1] = 0; out[2] = 0; } static INLINE void insert_2f_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)(v); (void) a; out[0] = in[0]; out[1] = in[1]; } static INLINE void insert_2f_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)(v); (void) a; out[0] = in[0]; out[1] = 0; } static INLINE void insert_1f_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLfloat *out = (GLfloat *)(v); (void) a; out[0] = in[0]; } static INLINE void insert_null( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; (void) v; (void) in; } static INLINE void insert_4chan_4f_rgba_4( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLchan *c = (GLchan *)v; (void) a; UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]); UNCLAMPED_FLOAT_TO_CHAN(c[1], in[1]); UNCLAMPED_FLOAT_TO_CHAN(c[2], in[2]); UNCLAMPED_FLOAT_TO_CHAN(c[3], in[3]); } static INLINE void insert_4chan_4f_rgba_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLchan *c = (GLchan *)v; (void) a; UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]); UNCLAMPED_FLOAT_TO_CHAN(c[1], in[1]); UNCLAMPED_FLOAT_TO_CHAN(c[2], in[2]); c[3] = CHAN_MAX; } static INLINE void insert_4chan_4f_rgba_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLchan *c = (GLchan *)v; (void) a; UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]); UNCLAMPED_FLOAT_TO_CHAN(c[1], in[1]); c[2] = 0; c[3] = CHAN_MAX; } static INLINE void insert_4chan_4f_rgba_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { GLchan *c = (GLchan *)v; (void) a; UNCLAMPED_FLOAT_TO_CHAN(c[0], in[0]); c[1] = 0; c[2] = 0; c[3] = CHAN_MAX; } static INLINE void insert_4ub_4f_rgba_4( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[2]); UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[3]); } static INLINE void insert_4ub_4f_rgba_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[2]); v[3] = 0xff; } static INLINE void insert_4ub_4f_rgba_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); v[2] = 0; v[3] = 0xff; } static INLINE void insert_4ub_4f_rgba_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); v[1] = 0; v[2] = 0; v[3] = 0xff; } static INLINE void insert_4ub_4f_bgra_4( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[2]); UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[3]); } static INLINE void insert_4ub_4f_bgra_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[2]); v[3] = 0xff; } static INLINE void insert_4ub_4f_bgra_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); v[0] = 0; v[3] = 0xff; } static INLINE void insert_4ub_4f_bgra_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]); v[1] = 0; v[0] = 0; v[3] = 0xff; } static INLINE void insert_4ub_4f_argb_4( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]); UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[2]); UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[3]); } static INLINE void insert_4ub_4f_argb_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]); UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[2]); v[0] = 0xff; } static INLINE void insert_4ub_4f_argb_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]); v[3] = 0x00; v[0] = 0xff; } static INLINE void insert_4ub_4f_argb_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[0]); v[2] = 0x00; v[3] = 0x00; v[0] = 0xff; } static INLINE void insert_4ub_4f_abgr_4( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]); UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[2]); UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[3]); } static INLINE void insert_4ub_4f_abgr_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]); UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[2]); v[0] = 0xff; } static INLINE void insert_4ub_4f_abgr_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[1]); v[1] = 0x00; v[0] = 0xff; } static INLINE void insert_4ub_4f_abgr_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[3], in[0]); v[2] = 0x00; v[1] = 0x00; v[0] = 0xff; } static INLINE void insert_3ub_3f_rgb_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[2]); } static INLINE void insert_3ub_3f_rgb_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); v[2] = 0; } static INLINE void insert_3ub_3f_rgb_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); v[1] = 0; v[2] = 0; } static INLINE void insert_3ub_3f_bgr_3( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[2]); } static INLINE void insert_3ub_3f_bgr_2( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]); UNCLAMPED_FLOAT_TO_UBYTE(v[1], in[1]); v[0] = 0; } static INLINE void insert_3ub_3f_bgr_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[2], in[0]); v[1] = 0; v[0] = 0; } static INLINE void insert_1ub_1f_1( const struct tnl_clipspace_attr *a, GLubyte *v, const GLfloat *in ) { (void) a; UNCLAMPED_FLOAT_TO_UBYTE(v[0], in[0]); } /*********************************************************************** * Functions to perform the reverse operations to the above, for * swrast translation and clip-interpolation. * * Currently always extracts a full 4 floats. */ static void extract_4f_viewport( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { const GLfloat *in = (const GLfloat *)v; const GLfloat * const vp = a->vp; /* Although included for completeness, the position coordinate is * usually handled differently during clipping. */ out[0] = (in[0] - vp[12]) / vp[0]; out[1] = (in[1] - vp[13]) / vp[5]; out[2] = (in[2] - vp[14]) / vp[10]; out[3] = in[3]; } static void extract_3f_viewport( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { const GLfloat *in = (const GLfloat *)v; const GLfloat * const vp = a->vp; out[0] = (in[0] - vp[12]) / vp[0]; out[1] = (in[1] - vp[13]) / vp[5]; out[2] = (in[2] - vp[14]) / vp[10]; out[3] = 1; } static void extract_2f_viewport( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { const GLfloat *in = (const GLfloat *)v; const GLfloat * const vp = a->vp; out[0] = (in[0] - vp[12]) / vp[0]; out[1] = (in[1] - vp[13]) / vp[5]; out[2] = 0; out[3] = 1; } static void extract_4f( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { const GLfloat *in = (const GLfloat *)v; (void) a; out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; out[3] = in[3]; } static void extract_3f_xyw( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { const GLfloat *in = (const GLfloat *)v; (void) a; out[0] = in[0]; out[1] = in[1]; out[2] = 0; out[3] = in[2]; } static void extract_3f( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { const GLfloat *in = (const GLfloat *)v; (void) a; out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; out[3] = 1; } static void extract_2f( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { const GLfloat *in = (const GLfloat *)v; (void) a; out[0] = in[0]; out[1] = in[1]; out[2] = 0; out[3] = 1; } static void extract_1f( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { const GLfloat *in = (const GLfloat *)v; (void) a; out[0] = in[0]; out[1] = 0; out[2] = 0; out[3] = 1; } static void extract_4chan_4f_rgba( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { GLchan *c = (GLchan *)v; (void) a; out[0] = CHAN_TO_FLOAT(c[0]); out[1] = CHAN_TO_FLOAT(c[1]); out[2] = CHAN_TO_FLOAT(c[2]); out[3] = CHAN_TO_FLOAT(c[3]); } static void extract_4ub_4f_rgba( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { (void) a; out[0] = UBYTE_TO_FLOAT(v[0]); out[1] = UBYTE_TO_FLOAT(v[1]); out[2] = UBYTE_TO_FLOAT(v[2]); out[3] = UBYTE_TO_FLOAT(v[3]); } static void extract_4ub_4f_bgra( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { (void) a; out[2] = UBYTE_TO_FLOAT(v[0]); out[1] = UBYTE_TO_FLOAT(v[1]); out[0] = UBYTE_TO_FLOAT(v[2]); out[3] = UBYTE_TO_FLOAT(v[3]); } static void extract_4ub_4f_argb( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { (void) a; out[3] = UBYTE_TO_FLOAT(v[0]); out[0] = UBYTE_TO_FLOAT(v[1]); out[1] = UBYTE_TO_FLOAT(v[2]); out[2] = UBYTE_TO_FLOAT(v[3]); } static void extract_4ub_4f_abgr( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { (void) a; out[3] = UBYTE_TO_FLOAT(v[0]); out[2] = UBYTE_TO_FLOAT(v[1]); out[1] = UBYTE_TO_FLOAT(v[2]); out[0] = UBYTE_TO_FLOAT(v[3]); } static void extract_3ub_3f_rgb( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { (void) a; out[0] = UBYTE_TO_FLOAT(v[0]); out[1] = UBYTE_TO_FLOAT(v[1]); out[2] = UBYTE_TO_FLOAT(v[2]); out[3] = 1; } static void extract_3ub_3f_bgr( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { (void) a; out[2] = UBYTE_TO_FLOAT(v[0]); out[1] = UBYTE_TO_FLOAT(v[1]); out[0] = UBYTE_TO_FLOAT(v[2]); out[3] = 1; } static void extract_1ub_1f( const struct tnl_clipspace_attr *a, GLfloat *out, const GLubyte *v ) { (void) a; out[0] = UBYTE_TO_FLOAT(v[0]); out[1] = 0; out[2] = 0; out[3] = 1; } const struct tnl_format_info _tnl_format_info[EMIT_MAX] = { { "1f", extract_1f, { insert_1f_1, insert_1f_1, insert_1f_1, insert_1f_1 }, sizeof(GLfloat) }, { "2f", extract_2f, { insert_2f_1, insert_2f_2, insert_2f_2, insert_2f_2 }, 2 * sizeof(GLfloat) }, { "3f", extract_3f, { insert_3f_1, insert_3f_2, insert_3f_3, insert_3f_3 }, 3 * sizeof(GLfloat) }, { "4f", extract_4f, { insert_4f_1, insert_4f_2, insert_4f_3, insert_4f_4 }, 4 * sizeof(GLfloat) }, { "2f_viewport", extract_2f_viewport, { insert_2f_viewport_1, insert_2f_viewport_2, insert_2f_viewport_2, insert_2f_viewport_2 }, 2 * sizeof(GLfloat) }, { "3f_viewport", extract_3f_viewport, { insert_3f_viewport_1, insert_3f_viewport_2, insert_3f_viewport_3, insert_3f_viewport_3 }, 3 * sizeof(GLfloat) }, { "4f_viewport", extract_4f_viewport, { insert_4f_viewport_1, insert_4f_viewport_2, insert_4f_viewport_3, insert_4f_viewport_4 }, 4 * sizeof(GLfloat) }, { "3f_xyw", extract_3f_xyw, { insert_3f_xyw_err, insert_3f_xyw_err, insert_3f_xyw_err, insert_3f_xyw_4 }, 3 * sizeof(GLfloat) }, { "1ub_1f", extract_1ub_1f, { insert_1ub_1f_1, insert_1ub_1f_1, insert_1ub_1f_1, insert_1ub_1f_1 }, sizeof(GLubyte) }, { "3ub_3f_rgb", extract_3ub_3f_rgb, { insert_3ub_3f_rgb_1, insert_3ub_3f_rgb_2, insert_3ub_3f_rgb_3, insert_3ub_3f_rgb_3 }, 3 * sizeof(GLubyte) }, { "3ub_3f_bgr", extract_3ub_3f_bgr, { insert_3ub_3f_bgr_1, insert_3ub_3f_bgr_2, insert_3ub_3f_bgr_3, insert_3ub_3f_bgr_3 }, 3 * sizeof(GLubyte) }, { "4ub_4f_rgba", extract_4ub_4f_rgba, { insert_4ub_4f_rgba_1, insert_4ub_4f_rgba_2, insert_4ub_4f_rgba_3, insert_4ub_4f_rgba_4 }, 4 * sizeof(GLubyte) }, { "4ub_4f_bgra", extract_4ub_4f_bgra, { insert_4ub_4f_bgra_1, insert_4ub_4f_bgra_2, insert_4ub_4f_bgra_3, insert_4ub_4f_bgra_4 }, 4 * sizeof(GLubyte) }, { "4ub_4f_argb", extract_4ub_4f_argb, { insert_4ub_4f_argb_1, insert_4ub_4f_argb_2, insert_4ub_4f_argb_3, insert_4ub_4f_argb_4 }, 4 * sizeof(GLubyte) }, { "4ub_4f_abgr", extract_4ub_4f_abgr, { insert_4ub_4f_abgr_1, insert_4ub_4f_abgr_2, insert_4ub_4f_abgr_3, insert_4ub_4f_abgr_4 }, 4 * sizeof(GLubyte) }, { "4chan_4f_rgba", extract_4chan_4f_rgba, { insert_4chan_4f_rgba_1, insert_4chan_4f_rgba_2, insert_4chan_4f_rgba_3, insert_4chan_4f_rgba_4 }, 4 * sizeof(GLchan) }, { "pad", NULL, { NULL, NULL, NULL, NULL }, 0 } }; /*********************************************************************** * Hardwired fastpaths for emitting whole vertices or groups of * vertices */ #define EMIT5(NR, F0, F1, F2, F3, F4, NAME) \ static void NAME( GLcontext *ctx, \ GLuint count, \ GLubyte *v ) \ { \ struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); \ struct tnl_clipspace_attr *a = vtx->attr; \ GLuint i; \ \ for (i = 0 ; i < count ; i++, v += vtx->vertex_size) { \ if (NR > 0) { \ F0( &a[0], v + a[0].vertoffset, (GLfloat *)a[0].inputptr ); \ a[0].inputptr += a[0].inputstride; \ } \ \ if (NR > 1) { \ F1( &a[1], v + a[1].vertoffset, (GLfloat *)a[1].inputptr ); \ a[1].inputptr += a[1].inputstride; \ } \ \ if (NR > 2) { \ F2( &a[2], v + a[2].vertoffset, (GLfloat *)a[2].inputptr ); \ a[2].inputptr += a[2].inputstride; \ } \ \ if (NR > 3) { \ F3( &a[3], v + a[3].vertoffset, (GLfloat *)a[3].inputptr ); \ a[3].inputptr += a[3].inputstride; \ } \ \ if (NR > 4) { \ F4( &a[4], v + a[4].vertoffset, (GLfloat *)a[4].inputptr ); \ a[4].inputptr += a[4].inputstride; \ } \ } \ } #define EMIT2(F0, F1, NAME) EMIT5(2, F0, F1, insert_null, \ insert_null, insert_null, NAME) #define EMIT3(F0, F1, F2, NAME) EMIT5(3, F0, F1, F2, insert_null, \ insert_null, NAME) #define EMIT4(F0, F1, F2, F3, NAME) EMIT5(4, F0, F1, F2, F3, \ insert_null, NAME) EMIT2(insert_3f_viewport_3, insert_4ub_4f_rgba_4, emit_viewport3_rgba4) EMIT2(insert_3f_viewport_3, insert_4ub_4f_bgra_4, emit_viewport3_bgra4) EMIT2(insert_3f_3, insert_4ub_4f_rgba_4, emit_xyz3_rgba4) EMIT3(insert_4f_viewport_4, insert_4ub_4f_rgba_4, insert_2f_2, emit_viewport4_rgba4_st2) EMIT3(insert_4f_viewport_4, insert_4ub_4f_bgra_4, insert_2f_2, emit_viewport4_bgra4_st2) EMIT3(insert_4f_4, insert_4ub_4f_rgba_4, insert_2f_2, emit_xyzw4_rgba4_st2) EMIT4(insert_4f_viewport_4, insert_4ub_4f_rgba_4, insert_2f_2, insert_2f_2, emit_viewport4_rgba4_st2_st2) EMIT4(insert_4f_viewport_4, insert_4ub_4f_bgra_4, insert_2f_2, insert_2f_2, emit_viewport4_bgra4_st2_st2) EMIT4(insert_4f_4, insert_4ub_4f_rgba_4, insert_2f_2, insert_2f_2, emit_xyzw4_rgba4_st2_st2) /* Use the codegen paths to select one of a number of hardwired * fastpaths. */ void _tnl_generate_hardwired_emit( GLcontext *ctx ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); tnl_emit_func func = NULL; /* Does it fit a hardwired fastpath? Help! this is growing out of * control! */ switch (vtx->attr_count) { case 2: if (vtx->attr[0].emit == insert_3f_viewport_3) { if (vtx->attr[1].emit == insert_4ub_4f_bgra_4) func = emit_viewport3_bgra4; else if (vtx->attr[1].emit == insert_4ub_4f_rgba_4) func = emit_viewport3_rgba4; } else if (vtx->attr[0].emit == insert_3f_3 && vtx->attr[1].emit == insert_4ub_4f_rgba_4) { func = emit_xyz3_rgba4; } break; case 3: if (vtx->attr[2].emit == insert_2f_2) { if (vtx->attr[1].emit == insert_4ub_4f_rgba_4) { if (vtx->attr[0].emit == insert_4f_viewport_4) func = emit_viewport4_rgba4_st2; else if (vtx->attr[0].emit == insert_4f_4) func = emit_xyzw4_rgba4_st2; } else if (vtx->attr[1].emit == insert_4ub_4f_bgra_4 && vtx->attr[0].emit == insert_4f_viewport_4) func = emit_viewport4_bgra4_st2; } break; case 4: if (vtx->attr[2].emit == insert_2f_2 && vtx->attr[3].emit == insert_2f_2) { if (vtx->attr[1].emit == insert_4ub_4f_rgba_4) { if (vtx->attr[0].emit == insert_4f_viewport_4) func = emit_viewport4_rgba4_st2_st2; else if (vtx->attr[0].emit == insert_4f_4) func = emit_xyzw4_rgba4_st2_st2; } else if (vtx->attr[1].emit == insert_4ub_4f_bgra_4 && vtx->attr[0].emit == insert_4f_viewport_4) func = emit_viewport4_bgra4_st2_st2; } break; } vtx->emit = func; } /*********************************************************************** * Generic (non-codegen) functions for whole vertices or groups of * vertices */ void _tnl_generic_emit( GLcontext *ctx, GLuint count, GLubyte *v ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); struct tnl_clipspace_attr *a = vtx->attr; const GLuint attr_count = vtx->attr_count; const GLuint stride = vtx->vertex_size; GLuint i, j; for (i = 0 ; i < count ; i++, v += stride) { for (j = 0; j < attr_count; j++) { GLfloat *in = (GLfloat *)a[j].inputptr; a[j].inputptr += a[j].inputstride; a[j].emit( &a[j], v + a[j].vertoffset, in ); } } } void _tnl_generic_interp( GLcontext *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); const GLubyte *vin = vtx->vertex_buf + ein * vtx->vertex_size; const GLubyte *vout = vtx->vertex_buf + eout * vtx->vertex_size; GLubyte *vdst = vtx->vertex_buf + edst * vtx->vertex_size; const struct tnl_clipspace_attr *a = vtx->attr; const GLuint attr_count = vtx->attr_count; GLuint j; (void) force_boundary; if (tnl->NeedNdcCoords) { const GLfloat *dstclip = VB->ClipPtr->data[edst]; if (dstclip[3] != 0.0) { const GLfloat w = 1.0f / dstclip[3]; GLfloat pos[4]; pos[0] = dstclip[0] * w; pos[1] = dstclip[1] * w; pos[2] = dstclip[2] * w; pos[3] = w; a[0].insert[4-1]( &a[0], vdst, pos ); } } else { a[0].insert[4-1]( &a[0], vdst, VB->ClipPtr->data[edst] ); } for (j = 1; j < attr_count; j++) { GLfloat fin[4], fout[4], fdst[4]; a[j].extract( &a[j], fin, vin + a[j].vertoffset ); a[j].extract( &a[j], fout, vout + a[j].vertoffset ); INTERP_F( t, fdst[3], fout[3], fin[3] ); INTERP_F( t, fdst[2], fout[2], fin[2] ); INTERP_F( t, fdst[1], fout[1], fin[1] ); INTERP_F( t, fdst[0], fout[0], fin[0] ); a[j].insert[4-1]( &a[j], vdst + a[j].vertoffset, fdst ); } } /* Extract color attributes from one vertex and insert them into * another. (Shortcircuit extract/insert with memcpy). */ void _tnl_generic_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); GLubyte *vsrc = vtx->vertex_buf + esrc * vtx->vertex_size; GLubyte *vdst = vtx->vertex_buf + edst * vtx->vertex_size; const struct tnl_clipspace_attr *a = vtx->attr; const GLuint attr_count = vtx->attr_count; GLuint j; for (j = 0; j < attr_count; j++) { if (a[j].attrib == VERT_ATTRIB_COLOR0 || a[j].attrib == VERT_ATTRIB_COLOR1) { _mesa_memcpy( vdst + a[j].vertoffset, vsrc + a[j].vertoffset, a[j].vertattrsize ); } } } /* Helper functions for hardware which doesn't put back colors and/or * edgeflags into vertices. */ void _tnl_generic_interp_extras( GLcontext *ctx, GLfloat t, GLuint dst, GLuint out, GLuint in, GLboolean force_boundary ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; /* If stride is zero, ColorPtr[1] is constant across the VB, so * there is no point interpolating between two values as they will * be identical. In all other cases, this value is generated by * t_vb_lighttmp.h and has a stride of 4 dwords. */ if (VB->ColorPtr[1] && VB->ColorPtr[1]->stride) { assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat)); INTERP_4F( t, VB->ColorPtr[1]->data[dst], VB->ColorPtr[1]->data[out], VB->ColorPtr[1]->data[in] ); } if (VB->SecondaryColorPtr[1]) { assert(VB->SecondaryColorPtr[1]->stride == 4 * sizeof(GLfloat)); INTERP_3F( t, VB->SecondaryColorPtr[1]->data[dst], VB->SecondaryColorPtr[1]->data[out], VB->SecondaryColorPtr[1]->data[in] ); } if (VB->IndexPtr[1]) { VB->IndexPtr[1]->data[dst][0] = LINTERP( t, VB->IndexPtr[1]->data[out][0], VB->IndexPtr[1]->data[in][0] ); } if (VB->EdgeFlag) { VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary; } _tnl_generic_interp(ctx, t, dst, out, in, force_boundary); } void _tnl_generic_copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; /* See above comment: */ if (VB->ColorPtr[1] && VB->ColorPtr[1]->stride) { COPY_4FV( VB->ColorPtr[1]->data[dst], VB->ColorPtr[1]->data[src] ); } if (VB->SecondaryColorPtr[1]) { COPY_4FV( VB->SecondaryColorPtr[1]->data[dst], VB->SecondaryColorPtr[1]->data[src] ); } if (VB->IndexPtr[1]) { VB->IndexPtr[1]->data[dst][0] = VB->IndexPtr[1]->data[src][0]; } _tnl_generic_copy_pv(ctx, dst, src); } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vertex.h0000644000000000000000000001172613614532424020032 0ustar /* * Copyright 2003 Tungsten Graphics, inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * on the rights to use, copy, modify, merge, publish, distribute, sub * license, and/or sell copies of the Software, and to permit persons to whom * the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #ifndef _TNL_VERTEX_H #define _TNL_VERTEX_H #include "mtypes.h" #include "t_context.h" /* New mechanism to specify hardware vertices so that tnl can build * and manipulate them directly. */ /* It will probably be necessary to allow drivers to specify new * emit-styles to cover all the wierd and wacky things out there. */ enum tnl_attr_format { EMIT_1F, EMIT_2F, EMIT_3F, EMIT_4F, EMIT_2F_VIEWPORT, /* do viewport transform and emit */ EMIT_3F_VIEWPORT, /* do viewport transform and emit */ EMIT_4F_VIEWPORT, /* do viewport transform and emit */ EMIT_3F_XYW, /* for projective texture */ EMIT_1UB_1F, /* for fog coordinate */ EMIT_3UB_3F_RGB, /* for specular color */ EMIT_3UB_3F_BGR, /* for specular color */ EMIT_4UB_4F_RGBA, /* for color */ EMIT_4UB_4F_BGRA, /* for color */ EMIT_4UB_4F_ARGB, /* for color */ EMIT_4UB_4F_ABGR, /* for color */ EMIT_4CHAN_4F_RGBA, /* for swrast color */ EMIT_PAD, /* leave a hole of 'offset' bytes */ EMIT_MAX }; struct tnl_attr_map { GLuint attrib; /* _TNL_ATTRIB_ enum */ enum tnl_attr_format format; GLuint offset; }; struct tnl_format_info { const char *name; tnl_extract_func extract; tnl_insert_func insert[4]; const GLuint attrsize; }; extern const struct tnl_format_info _tnl_format_info[EMIT_MAX]; /* Interpolate between two vertices to produce a third: */ extern void _tnl_interp( GLcontext *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ); /* Copy colors from one vertex to another: */ extern void _tnl_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ); /* Extract a named attribute from a hardware vertex. Will have to * reverse any viewport transformation, swizzling or other conversions * which may have been applied: */ extern void _tnl_get_attr( GLcontext *ctx, const void *vertex, GLenum attrib, GLfloat *dest ); /* Complementary to the above. */ extern void _tnl_set_attr( GLcontext *ctx, void *vout, GLenum attrib, const GLfloat *src ); extern void *_tnl_get_vertex( GLcontext *ctx, GLuint nr ); extern GLuint _tnl_install_attrs( GLcontext *ctx, const struct tnl_attr_map *map, GLuint nr, const GLfloat *vp, GLuint unpacked_size ); extern void _tnl_free_vertices( GLcontext *ctx ); extern void _tnl_init_vertices( GLcontext *ctx, GLuint vb_size, GLuint max_vertex_size ); extern void *_tnl_emit_vertices_to_buffer( GLcontext *ctx, GLuint start, GLuint end, void *dest ); extern void _tnl_build_vertices( GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs ); extern void _tnl_invalidate_vertices( GLcontext *ctx, GLuint newinputs ); extern void _tnl_invalidate_vertex_state( GLcontext *ctx, GLuint new_state ); extern void _tnl_notify_pipeline_output_change( GLcontext *ctx ); #define GET_VERTEX_STATE(ctx) &(TNL_CONTEXT(ctx)->clipspace) /* Internal function: */ void _tnl_register_fastpath( struct tnl_clipspace *vtx, GLboolean match_strides ); /* t_vertex_generic.c -- Internal functions for t_vertex.c */ void _tnl_generic_copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ); void _tnl_generic_interp_extras( GLcontext *ctx, GLfloat t, GLuint dst, GLuint out, GLuint in, GLboolean force_boundary ); void _tnl_generic_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ); void _tnl_generic_interp( GLcontext *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ); void _tnl_generic_emit( GLcontext *ctx, GLuint count, GLubyte *v ); void _tnl_generate_hardwired_emit( GLcontext *ctx ); /* t_vertex_sse.c -- Internal functions for t_vertex.c */ void _tnl_generate_sse_emit( GLcontext *ctx ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vertex_sse.c0000644000000000000000000004427513614532424020704 0ustar /* * Copyright 2003 Tungsten Graphics, inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * on the rights to use, copy, modify, merge, publish, distribute, sub * license, and/or sell copies of the Software, and to permit persons to whom * the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "context.h" #include "colormac.h" #include "t_context.h" #include "t_vertex.h" #include "simple_list.h" #include "enums.h" #if defined(USE_SSE_ASM) #include "x86/rtasm/x86sse.h" #include "x86/common_x86_asm.h" #define X 0 #define Y 1 #define Z 2 #define W 3 struct x86_program { struct x86_function func; GLcontext *ctx; GLboolean inputs_safe; GLboolean outputs_safe; GLboolean have_sse2; struct x86_reg identity; struct x86_reg chan0; }; static struct x86_reg get_identity( struct x86_program *p ) { return p->identity; } static void emit_load4f_4( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) { sse_movups(&p->func, dest, arg0); } static void emit_load4f_3( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) { /* Have to jump through some hoops: * * c 0 0 0 * c 0 0 1 * 0 0 c 1 * a b c 1 */ sse_movss(&p->func, dest, x86_make_disp(arg0, 8)); sse_shufps(&p->func, dest, get_identity(p), SHUF(X,Y,Z,W) ); sse_shufps(&p->func, dest, dest, SHUF(Y,Z,X,W) ); sse_movlps(&p->func, dest, arg0); } static void emit_load4f_2( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) { /* Initialize from identity, then pull in low two words: */ sse_movups(&p->func, dest, get_identity(p)); sse_movlps(&p->func, dest, arg0); } static void emit_load4f_1( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) { /* Pull in low word, then swizzle in identity */ sse_movss(&p->func, dest, arg0); sse_shufps(&p->func, dest, get_identity(p), SHUF(X,Y,Z,W) ); } static void emit_load3f_3( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) { /* Over-reads by 1 dword - potential SEGV if input is a vertex * array. */ if (p->inputs_safe) { sse_movups(&p->func, dest, arg0); } else { /* c 0 0 0 * c c c c * a b c c */ sse_movss(&p->func, dest, x86_make_disp(arg0, 8)); sse_shufps(&p->func, dest, dest, SHUF(X,X,X,X)); sse_movlps(&p->func, dest, arg0); } } static void emit_load3f_2( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) { emit_load4f_2(p, dest, arg0); } static void emit_load3f_1( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) { emit_load4f_1(p, dest, arg0); } static void emit_load2f_2( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) { sse_movlps(&p->func, dest, arg0); } static void emit_load2f_1( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) { emit_load4f_1(p, dest, arg0); } static void emit_load1f_1( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) { sse_movss(&p->func, dest, arg0); } static void (*load[4][4])( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) = { { emit_load1f_1, emit_load1f_1, emit_load1f_1, emit_load1f_1 }, { emit_load2f_1, emit_load2f_2, emit_load2f_2, emit_load2f_2 }, { emit_load3f_1, emit_load3f_2, emit_load3f_3, emit_load3f_3 }, { emit_load4f_1, emit_load4f_2, emit_load4f_3, emit_load4f_4 } }; static void emit_load( struct x86_program *p, struct x86_reg dest, GLuint sz, struct x86_reg src, GLuint src_sz) { load[sz-1][src_sz-1](p, dest, src); } static void emit_store4f( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) { sse_movups(&p->func, dest, arg0); } static void emit_store3f( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) { if (p->outputs_safe) { /* Emit the extra dword anyway. This may hurt writecombining, * may cause other problems. */ sse_movups(&p->func, dest, arg0); } else { /* Alternate strategy - emit two, shuffle, emit one. */ sse_movlps(&p->func, dest, arg0); sse_shufps(&p->func, arg0, arg0, SHUF(Z,Z,Z,Z) ); /* NOTE! destructive */ sse_movss(&p->func, x86_make_disp(dest,8), arg0); } } static void emit_store2f( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) { sse_movlps(&p->func, dest, arg0); } static void emit_store1f( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) { sse_movss(&p->func, dest, arg0); } static void (*store[4])( struct x86_program *p, struct x86_reg dest, struct x86_reg arg0 ) = { emit_store1f, emit_store2f, emit_store3f, emit_store4f }; static void emit_store( struct x86_program *p, struct x86_reg dest, GLuint sz, struct x86_reg temp ) { store[sz-1](p, dest, temp); } static void emit_pack_store_4ub( struct x86_program *p, struct x86_reg dest, struct x86_reg temp ) { /* Scale by 255.0 */ sse_mulps(&p->func, temp, p->chan0); if (p->have_sse2) { sse2_cvtps2dq(&p->func, temp, temp); sse2_packssdw(&p->func, temp, temp); sse2_packuswb(&p->func, temp, temp); sse_movss(&p->func, dest, temp); } else { struct x86_reg mmx0 = x86_make_reg(file_MMX, 0); struct x86_reg mmx1 = x86_make_reg(file_MMX, 1); sse_cvtps2pi(&p->func, mmx0, temp); sse_movhlps(&p->func, temp, temp); sse_cvtps2pi(&p->func, mmx1, temp); mmx_packssdw(&p->func, mmx0, mmx1); mmx_packuswb(&p->func, mmx0, mmx0); mmx_movd(&p->func, dest, mmx0); } } static GLint get_offset( const void *a, const void *b ) { return (const char *)b - (const char *)a; } /* Not much happens here. Eventually use this function to try and * avoid saving/reloading the source pointers each vertex (if some of * them can fit in registers). */ static void get_src_ptr( struct x86_program *p, struct x86_reg srcREG, struct x86_reg vtxREG, struct tnl_clipspace_attr *a ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(p->ctx); struct x86_reg ptr_to_src = x86_make_disp(vtxREG, get_offset(vtx, &a->inputptr)); /* Load current a[j].inputptr */ x86_mov(&p->func, srcREG, ptr_to_src); } static void update_src_ptr( struct x86_program *p, struct x86_reg srcREG, struct x86_reg vtxREG, struct tnl_clipspace_attr *a ) { if (a->inputstride) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(p->ctx); struct x86_reg ptr_to_src = x86_make_disp(vtxREG, get_offset(vtx, &a->inputptr)); /* add a[j].inputstride (hardcoded value - could just as easily * pull the stride value from memory each time). */ x86_lea(&p->func, srcREG, x86_make_disp(srcREG, a->inputstride)); /* save new value of a[j].inputptr */ x86_mov(&p->func, ptr_to_src, srcREG); } } /* Lots of hardcoding * * EAX -- pointer to current output vertex * ECX -- pointer to current attribute * */ static GLboolean build_vertex_emit( struct x86_program *p ) { GLcontext *ctx = p->ctx; TNLcontext *tnl = TNL_CONTEXT(ctx); struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); GLuint j = 0; struct x86_reg vertexEAX = x86_make_reg(file_REG32, reg_AX); struct x86_reg srcECX = x86_make_reg(file_REG32, reg_CX); struct x86_reg countEBP = x86_make_reg(file_REG32, reg_BP); struct x86_reg vtxESI = x86_make_reg(file_REG32, reg_SI); struct x86_reg temp = x86_make_reg(file_XMM, 0); struct x86_reg vp0 = x86_make_reg(file_XMM, 1); struct x86_reg vp1 = x86_make_reg(file_XMM, 2); GLubyte *fixup, *label; x86_init_func(&p->func); /* Push a few regs? */ x86_push(&p->func, countEBP); x86_push(&p->func, vtxESI); /* Get vertex count, compare to zero */ x86_xor(&p->func, srcECX, srcECX); x86_mov(&p->func, countEBP, x86_fn_arg(&p->func, 2)); x86_cmp(&p->func, countEBP, srcECX); fixup = x86_jcc_forward(&p->func, cc_E); /* Initialize destination register. */ x86_mov(&p->func, vertexEAX, x86_fn_arg(&p->func, 3)); /* Dereference ctx to get tnl, then vtx: */ x86_mov(&p->func, vtxESI, x86_fn_arg(&p->func, 1)); x86_mov(&p->func, vtxESI, x86_make_disp(vtxESI, get_offset(ctx, &ctx->swtnl_context))); vtxESI = x86_make_disp(vtxESI, get_offset(tnl, &tnl->clipspace)); /* Possibly load vp0, vp1 for viewport calcs: */ if (vtx->need_viewport) { sse_movups(&p->func, vp0, x86_make_disp(vtxESI, get_offset(vtx, &vtx->vp_scale[0]))); sse_movups(&p->func, vp1, x86_make_disp(vtxESI, get_offset(vtx, &vtx->vp_xlate[0]))); } /* always load, needed or not: */ sse_movups(&p->func, p->chan0, x86_make_disp(vtxESI, get_offset(vtx, &vtx->chan_scale[0]))); sse_movups(&p->func, p->identity, x86_make_disp(vtxESI, get_offset(vtx, &vtx->identity[0]))); /* Note address for loop jump */ label = x86_get_label(&p->func); /* Emit code for each of the attributes. Currently routes * everything through SSE registers, even when it might be more * efficient to stick with regular old x86. No optimization or * other tricks - enough new ground to cover here just getting * things working. */ while (j < vtx->attr_count) { struct tnl_clipspace_attr *a = &vtx->attr[j]; struct x86_reg dest = x86_make_disp(vertexEAX, a->vertoffset); /* Now, load an XMM reg from src, perhaps transform, then save. * Could be shortcircuited in specific cases: */ switch (a->format) { case EMIT_1F: get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 1, x86_deref(srcECX), a->inputsize); emit_store(p, dest, 1, temp); update_src_ptr(p, srcECX, vtxESI, a); break; case EMIT_2F: get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 2, x86_deref(srcECX), a->inputsize); emit_store(p, dest, 2, temp); update_src_ptr(p, srcECX, vtxESI, a); break; case EMIT_3F: /* Potentially the worst case - hardcode 2+1 copying: */ if (0) { get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 3, x86_deref(srcECX), a->inputsize); emit_store(p, dest, 3, temp); update_src_ptr(p, srcECX, vtxESI, a); } else { get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 2, x86_deref(srcECX), a->inputsize); emit_store(p, dest, 2, temp); if (a->inputsize > 2) { emit_load(p, temp, 1, x86_make_disp(srcECX, 8), 1); emit_store(p, x86_make_disp(dest,8), 1, temp); } else { sse_movss(&p->func, x86_make_disp(dest,8), get_identity(p)); } update_src_ptr(p, srcECX, vtxESI, a); } break; case EMIT_4F: get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); emit_store(p, dest, 4, temp); update_src_ptr(p, srcECX, vtxESI, a); break; case EMIT_2F_VIEWPORT: get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 2, x86_deref(srcECX), a->inputsize); sse_mulps(&p->func, temp, vp0); sse_addps(&p->func, temp, vp1); emit_store(p, dest, 2, temp); update_src_ptr(p, srcECX, vtxESI, a); break; case EMIT_3F_VIEWPORT: get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 3, x86_deref(srcECX), a->inputsize); sse_mulps(&p->func, temp, vp0); sse_addps(&p->func, temp, vp1); emit_store(p, dest, 3, temp); update_src_ptr(p, srcECX, vtxESI, a); break; case EMIT_4F_VIEWPORT: get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); sse_mulps(&p->func, temp, vp0); sse_addps(&p->func, temp, vp1); emit_store(p, dest, 4, temp); update_src_ptr(p, srcECX, vtxESI, a); break; case EMIT_3F_XYW: get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); sse_shufps(&p->func, temp, temp, SHUF(X,Y,W,Z)); emit_store(p, dest, 3, temp); update_src_ptr(p, srcECX, vtxESI, a); break; case EMIT_1UB_1F: /* Test for PAD3 + 1UB: */ if (j > 0 && a[-1].vertoffset + a[-1].vertattrsize <= a->vertoffset - 3) { get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 1, x86_deref(srcECX), a->inputsize); sse_shufps(&p->func, temp, temp, SHUF(X,X,X,X)); emit_pack_store_4ub(p, x86_make_disp(dest, -3), temp); /* overkill! */ update_src_ptr(p, srcECX, vtxESI, a); } else { _mesa_printf("Can't emit 1ub %x %x %d\n", a->vertoffset, a[-1].vertoffset, a[-1].vertattrsize ); return GL_FALSE; } break; case EMIT_3UB_3F_RGB: case EMIT_3UB_3F_BGR: /* Test for 3UB + PAD1: */ if (j == vtx->attr_count - 1 || a[1].vertoffset >= a->vertoffset + 4) { get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 3, x86_deref(srcECX), a->inputsize); if (a->format == EMIT_3UB_3F_BGR) sse_shufps(&p->func, temp, temp, SHUF(Z,Y,X,W)); emit_pack_store_4ub(p, dest, temp); update_src_ptr(p, srcECX, vtxESI, a); } /* Test for 3UB + 1UB: */ else if (j < vtx->attr_count - 1 && a[1].format == EMIT_1UB_1F && a[1].vertoffset == a->vertoffset + 3) { get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 3, x86_deref(srcECX), a->inputsize); update_src_ptr(p, srcECX, vtxESI, a); /* Make room for incoming value: */ sse_shufps(&p->func, temp, temp, SHUF(W,X,Y,Z)); get_src_ptr(p, srcECX, vtxESI, &a[1]); emit_load(p, temp, 1, x86_deref(srcECX), a[1].inputsize); update_src_ptr(p, srcECX, vtxESI, &a[1]); /* Rearrange and possibly do BGR conversion: */ if (a->format == EMIT_3UB_3F_BGR) sse_shufps(&p->func, temp, temp, SHUF(W,Z,Y,X)); else sse_shufps(&p->func, temp, temp, SHUF(Y,Z,W,X)); emit_pack_store_4ub(p, dest, temp); j++; /* NOTE: two attrs consumed */ } else { _mesa_printf("Can't emit 3ub\n"); } return GL_FALSE; /* add this later */ break; case EMIT_4UB_4F_RGBA: get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); emit_pack_store_4ub(p, dest, temp); update_src_ptr(p, srcECX, vtxESI, a); break; case EMIT_4UB_4F_BGRA: get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); sse_shufps(&p->func, temp, temp, SHUF(Z,Y,X,W)); emit_pack_store_4ub(p, dest, temp); update_src_ptr(p, srcECX, vtxESI, a); break; case EMIT_4UB_4F_ARGB: get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); sse_shufps(&p->func, temp, temp, SHUF(W,X,Y,Z)); emit_pack_store_4ub(p, dest, temp); update_src_ptr(p, srcECX, vtxESI, a); break; case EMIT_4UB_4F_ABGR: get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); sse_shufps(&p->func, temp, temp, SHUF(W,Z,Y,X)); emit_pack_store_4ub(p, dest, temp); update_src_ptr(p, srcECX, vtxESI, a); break; case EMIT_4CHAN_4F_RGBA: switch (CHAN_TYPE) { case GL_UNSIGNED_BYTE: get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); emit_pack_store_4ub(p, dest, temp); update_src_ptr(p, srcECX, vtxESI, a); break; case GL_FLOAT: get_src_ptr(p, srcECX, vtxESI, a); emit_load(p, temp, 4, x86_deref(srcECX), a->inputsize); emit_store(p, dest, 4, temp); update_src_ptr(p, srcECX, vtxESI, a); break; case GL_UNSIGNED_SHORT: default: _mesa_printf("unknown CHAN_TYPE %s\n", _mesa_lookup_enum_by_nr(CHAN_TYPE)); return GL_FALSE; } break; default: _mesa_printf("unknown a[%d].format %d\n", j, a->format); return GL_FALSE; /* catch any new opcodes */ } /* Increment j by at least 1 - may have been incremented above also: */ j++; } /* Next vertex: */ x86_lea(&p->func, vertexEAX, x86_make_disp(vertexEAX, vtx->vertex_size)); /* decr count, loop if not zero */ x86_dec(&p->func, countEBP); x86_test(&p->func, countEBP, countEBP); x86_jcc(&p->func, cc_NZ, label); /* Exit mmx state? */ if (p->func.need_emms) mmx_emms(&p->func); /* Land forward jump here: */ x86_fixup_fwd_jump(&p->func, fixup); /* Pop regs and return */ x86_pop(&p->func, x86_get_base_reg(vtxESI)); x86_pop(&p->func, countEBP); x86_ret(&p->func); vtx->emit = (tnl_emit_func)x86_get_func(&p->func); return GL_TRUE; } void _tnl_generate_sse_emit( GLcontext *ctx ) { struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx); struct x86_program p; if (!cpu_has_xmm) { vtx->codegen_emit = NULL; return; } memset(&p, 0, sizeof(p)); p.ctx = ctx; p.inputs_safe = 0; /* for now */ p.outputs_safe = 1; /* for now */ p.have_sse2 = cpu_has_xmm2; p.identity = x86_make_reg(file_XMM, 6); p.chan0 = x86_make_reg(file_XMM, 7); x86_init_func(&p.func); if (build_vertex_emit(&p)) { _tnl_register_fastpath( vtx, GL_TRUE ); } else { /* Note the failure so that we don't keep trying to codegen an * impossible state: */ _tnl_register_fastpath( vtx, GL_FALSE ); x86_release_func(&p.func); } } #else void _tnl_generate_sse_emit( GLcontext *ctx ) { /* Dummy version for when USE_SSE_ASM not defined */ } #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vp_build.c0000644000000000000000000011765113614532424020320 0ustar /* * Mesa 3-D graphics library * Version: 6.3.1 * * Copyright (C) 2005 Tungsten Graphics All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * TUNGSTEN GRAPHICS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * \file t_vp_build.c * Create a vertex program to execute the current fixed function T&L pipeline. * \author Keith Whitwell */ #include "glheader.h" #include "macros.h" #include "enums.h" #include "t_context.h" #include "t_vp_build.h" #include "shader/program.h" #include "shader/nvvertprog.h" #include "shader/arbvertparse.h" struct state_key { unsigned light_global_enabled:1; unsigned light_local_viewer:1; unsigned light_twoside:1; unsigned light_color_material:1; unsigned light_color_material_mask:12; unsigned light_material_mask:12; unsigned normalize:1; unsigned rescale_normals:1; unsigned fog_source_is_depth:1; unsigned tnl_do_vertex_fog:1; unsigned separate_specular:1; unsigned fog_enabled:1; unsigned fog_mode:2; unsigned point_attenuated:1; unsigned texture_enabled_global:1; struct { unsigned light_enabled:1; unsigned light_eyepos3_is_zero:1; unsigned light_spotcutoff_is_180:1; unsigned light_attenuated:1; unsigned texunit_really_enabled:1; unsigned texmat_enabled:1; unsigned texgen_enabled:4; unsigned texgen_mode0:4; unsigned texgen_mode1:4; unsigned texgen_mode2:4; unsigned texgen_mode3:4; } unit[8]; }; #define FOG_LINEAR 0 #define FOG_EXP 1 #define FOG_EXP2 2 #define FOG_UNKNOWN 3 static GLuint translate_fog_mode( GLenum mode ) { switch (mode) { case GL_LINEAR: return FOG_LINEAR; case GL_EXP: return FOG_EXP; case GL_EXP2: return FOG_EXP2; default: return FOG_UNKNOWN; } } #define TXG_NONE 0 #define TXG_OBJ_LINEAR 1 #define TXG_EYE_LINEAR 2 #define TXG_SPHERE_MAP 3 #define TXG_REFLECTION_MAP 4 #define TXG_NORMAL_MAP 5 static GLuint translate_texgen( GLboolean enabled, GLenum mode ) { if (!enabled) return TXG_NONE; switch (mode) { case GL_OBJECT_LINEAR: return TXG_OBJ_LINEAR; case GL_EYE_LINEAR: return TXG_EYE_LINEAR; case GL_SPHERE_MAP: return TXG_SPHERE_MAP; case GL_REFLECTION_MAP_NV: return TXG_REFLECTION_MAP; case GL_NORMAL_MAP_NV: return TXG_NORMAL_MAP; default: return TXG_NONE; } } static struct state_key *make_state_key( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; struct state_key *key = CALLOC_STRUCT(state_key); GLuint i; key->separate_specular = (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR); if (ctx->Light.Enabled) { key->light_global_enabled = 1; if (ctx->Light.Model.LocalViewer) key->light_local_viewer = 1; if (ctx->Light.Model.TwoSide) key->light_twoside = 1; if (ctx->Light.ColorMaterialEnabled) { key->light_color_material = 1; key->light_color_material_mask = ctx->Light.ColorMaterialBitmask; } for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT ; i < _TNL_ATTRIB_INDEX ; i++) if (VB->AttribPtr[i]->stride) key->light_material_mask |= 1<<(i-_TNL_ATTRIB_MAT_FRONT_AMBIENT); for (i = 0; i < MAX_LIGHTS; i++) { struct gl_light *light = &ctx->Light.Light[i]; if (light->Enabled) { key->unit[i].light_enabled = 1; if (light->EyePosition[3] == 0.0) key->unit[i].light_eyepos3_is_zero = 1; if (light->SpotCutoff == 180.0) key->unit[i].light_spotcutoff_is_180 = 1; if (light->ConstantAttenuation != 1.0 || light->LinearAttenuation != 0.0 || light->QuadraticAttenuation != 0.0) key->unit[i].light_attenuated = 1; } } } if (ctx->Transform.Normalize) key->normalize = 1; if (ctx->Transform.RescaleNormals) key->rescale_normals = 1; if (ctx->Fog.Enabled) key->fog_enabled = 1; if (key->fog_enabled) { if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) key->fog_source_is_depth = 1; if (tnl->_DoVertexFog) key->tnl_do_vertex_fog = 1; key->fog_mode = translate_fog_mode(ctx->Fog.Mode); } if (ctx->Point._Attenuated) key->point_attenuated = 1; if (ctx->Texture._TexGenEnabled || ctx->Texture._TexMatEnabled || ctx->Texture._EnabledUnits) key->texture_enabled_global = 1; for (i = 0; i < MAX_TEXTURE_UNITS; i++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; if (texUnit->_ReallyEnabled) key->unit[i].texunit_really_enabled = 1; if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) key->unit[i].texmat_enabled = 1; if (texUnit->TexGenEnabled) { key->unit[i].texgen_enabled = 1; key->unit[i].texgen_mode0 = translate_texgen( texUnit->TexGenEnabled & (1<<0), texUnit->GenModeS ); key->unit[i].texgen_mode1 = translate_texgen( texUnit->TexGenEnabled & (1<<1), texUnit->GenModeT ); key->unit[i].texgen_mode2 = translate_texgen( texUnit->TexGenEnabled & (1<<2), texUnit->GenModeR ); key->unit[i].texgen_mode3 = translate_texgen( texUnit->TexGenEnabled & (1<<3), texUnit->GenModeQ ); } } return key; } /* Very useful debugging tool - produces annotated listing of * generated program with line/function references for each * instruction back into this file: */ #define DISASSEM (MESA_VERBOSE&VERBOSE_DISASSEM) /* Should be tunable by the driver - do we want to do matrix * multiplications with DP4's or with MUL/MAD's? SSE works better * with the latter, drivers may differ. */ #define PREFER_DP4 0 #define MAX_INSN 200 /* Use uregs to represent registers internally, translate to Mesa's * expected formats on emit. * * NOTE: These are passed by value extensively in this file rather * than as usual by pointer reference. If this disturbs you, try * remembering they are just 32bits in size. * * GCC is smart enough to deal with these dword-sized structures in * much the same way as if I had defined them as dwords and was using * macros to access and set the fields. This is much nicer and easier * to evolve. */ struct ureg { GLuint file:4; GLint idx:8; /* relative addressing may be negative */ GLuint negate:1; GLuint swz:12; GLuint pad:7; }; struct tnl_program { const struct state_key *state; struct vertex_program *program; GLuint temp_in_use; GLuint temp_reserved; struct ureg eye_position; struct ureg eye_position_normalized; struct ureg eye_normal; struct ureg identity; GLuint materials; GLuint color_materials; }; const static struct ureg undef = { ~0, ~0, 0, 0, 0 }; /* Local shorthand: */ #define X SWIZZLE_X #define Y SWIZZLE_Y #define Z SWIZZLE_Z #define W SWIZZLE_W /* Construct a ureg: */ static struct ureg make_ureg(GLuint file, GLint idx) { struct ureg reg; reg.file = file; reg.idx = idx; reg.negate = 0; reg.swz = SWIZZLE_NOOP; reg.pad = 0; return reg; } static struct ureg negate( struct ureg reg ) { reg.negate ^= 1; return reg; } static struct ureg swizzle( struct ureg reg, int x, int y, int z, int w ) { reg.swz = MAKE_SWIZZLE4(GET_SWZ(reg.swz, x), GET_SWZ(reg.swz, y), GET_SWZ(reg.swz, z), GET_SWZ(reg.swz, w)); return reg; } static struct ureg swizzle1( struct ureg reg, int x ) { return swizzle(reg, x, x, x, x); } static struct ureg get_temp( struct tnl_program *p ) { int bit = ffs( ~p->temp_in_use ); if (!bit) { fprintf(stderr, "%s: out of temporaries\n", __FILE__); exit(1); } p->temp_in_use |= 1<<(bit-1); return make_ureg(PROGRAM_TEMPORARY, bit-1); } static struct ureg reserve_temp( struct tnl_program *p ) { struct ureg temp = get_temp( p ); p->temp_reserved |= 1<temp_in_use &= ~(1<temp_in_use |= p->temp_reserved; /* can't release reserved temps */ } } static void release_temps( struct tnl_program *p ) { p->temp_in_use = p->temp_reserved; } static struct ureg register_input( struct tnl_program *p, GLuint input ) { p->program->InputsRead |= (1<program->OutputsWritten |= (1<program->Parameters, values ); return make_ureg(PROGRAM_STATE_VAR, idx); } #define register_const1f(p, s0) register_const4f(p, s0, 0, 0, 1) #define register_scalar_const(p, s0) register_const4f(p, s0, s0, s0, s0) #define register_const2f(p, s0, s1) register_const4f(p, s0, s1, 0, 1) #define register_const3f(p, s0, s1, s2) register_const4f(p, s0, s1, s2, 1) static GLboolean is_undef( struct ureg reg ) { return reg.file == 0xf; } static struct ureg get_identity_param( struct tnl_program *p ) { if (is_undef(p->identity)) p->identity = register_const4f(p, 0,0,0,1); return p->identity; } static struct ureg register_param6( struct tnl_program *p, GLint s0, GLint s1, GLint s2, GLint s3, GLint s4, GLint s5) { GLint tokens[6]; GLint idx; tokens[0] = s0; tokens[1] = s1; tokens[2] = s2; tokens[3] = s3; tokens[4] = s4; tokens[5] = s5; idx = _mesa_add_state_reference( p->program->Parameters, tokens ); return make_ureg(PROGRAM_STATE_VAR, idx); } #define register_param1(p,s0) register_param6(p,s0,0,0,0,0,0) #define register_param2(p,s0,s1) register_param6(p,s0,s1,0,0,0,0) #define register_param3(p,s0,s1,s2) register_param6(p,s0,s1,s2,0,0,0) #define register_param4(p,s0,s1,s2,s3) register_param6(p,s0,s1,s2,s3,0,0) static void register_matrix_param6( struct tnl_program *p, GLint s0, GLint s1, GLint s2, GLint s3, GLint s4, GLint s5, struct ureg *matrix ) { GLuint i; /* This is a bit sad as the support is there to pull the whole * matrix out in one go: */ for (i = 0; i <= s4 - s3; i++) matrix[i] = register_param6( p, s0, s1, s2, i, i, s5 ); } static void emit_arg( struct vp_src_register *src, struct ureg reg ) { src->File = reg.file; src->Index = reg.idx; src->Swizzle = reg.swz; src->Negate = reg.negate; src->RelAddr = 0; src->pad = 0; } static void emit_dst( struct vp_dst_register *dst, struct ureg reg, GLuint mask ) { dst->File = reg.file; dst->Index = reg.idx; /* allow zero as a shorthand for xyzw */ dst->WriteMask = mask ? mask : WRITEMASK_XYZW; dst->pad = 0; } static void debug_insn( struct vp_instruction *inst, const char *fn, GLuint line ) { if (DISASSEM) { static const char *last_fn; if (fn != last_fn) { last_fn = fn; _mesa_printf("%s:\n", fn); } _mesa_printf("%d:\t", line); _mesa_debug_vp_inst(1, inst); } } static void emit_op3fn(struct tnl_program *p, GLuint op, struct ureg dest, GLuint mask, struct ureg src0, struct ureg src1, struct ureg src2, const char *fn, GLuint line) { GLuint nr = p->program->Base.NumInstructions++; struct vp_instruction *inst = &p->program->Instructions[nr]; if (p->program->Base.NumInstructions > MAX_INSN) { _mesa_problem(0, "Out of instructions in emit_op3fn\n"); return; } inst->Opcode = op; inst->StringPos = 0; inst->Data = 0; emit_arg( &inst->SrcReg[0], src0 ); emit_arg( &inst->SrcReg[1], src1 ); emit_arg( &inst->SrcReg[2], src2 ); emit_dst( &inst->DstReg, dest, mask ); debug_insn(inst, fn, line); } #define emit_op3(p, op, dst, mask, src0, src1, src2) \ emit_op3fn(p, op, dst, mask, src0, src1, src2, __FUNCTION__, __LINE__) #define emit_op2(p, op, dst, mask, src0, src1) \ emit_op3fn(p, op, dst, mask, src0, src1, undef, __FUNCTION__, __LINE__) #define emit_op1(p, op, dst, mask, src0) \ emit_op3fn(p, op, dst, mask, src0, undef, undef, __FUNCTION__, __LINE__) static struct ureg make_temp( struct tnl_program *p, struct ureg reg ) { if (reg.file == PROGRAM_TEMPORARY && !(p->temp_reserved & (1<eye_position)) { struct ureg pos = register_input( p, VERT_ATTRIB_POS ); struct ureg modelview[4]; p->eye_position = reserve_temp(p); if (PREFER_DP4) { register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 3, STATE_MATRIX, modelview ); emit_matrix_transform_vec4(p, p->eye_position, modelview, pos); } else { register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 3, STATE_MATRIX_TRANSPOSE, modelview ); emit_transpose_matrix_transform_vec4(p, p->eye_position, modelview, pos); } } return p->eye_position; } static struct ureg get_eye_position_normalized( struct tnl_program *p ) { if (is_undef(p->eye_position_normalized)) { struct ureg eye = get_eye_position(p); p->eye_position_normalized = reserve_temp(p); emit_normalize_vec3(p, p->eye_position_normalized, eye); } return p->eye_position_normalized; } static struct ureg get_eye_normal( struct tnl_program *p ) { if (is_undef(p->eye_normal)) { struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL ); struct ureg mvinv[3]; register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 2, STATE_MATRIX_INVTRANS, mvinv ); p->eye_normal = reserve_temp(p); /* Transform to eye space: */ emit_matrix_transform_vec3( p, p->eye_normal, mvinv, normal ); /* Normalize/Rescale: */ if (p->state->normalize) { emit_normalize_vec3( p, p->eye_normal, p->eye_normal ); } else if (p->state->rescale_normals) { struct ureg rescale = register_param2(p, STATE_INTERNAL, STATE_NORMAL_SCALE); emit_op2( p, VP_OPCODE_MUL, p->eye_normal, 0, normal, swizzle1(rescale, X)); } } return p->eye_normal; } static void build_hpos( struct tnl_program *p ) { struct ureg pos = register_input( p, VERT_ATTRIB_POS ); struct ureg hpos = register_output( p, VERT_RESULT_HPOS ); struct ureg mvp[4]; if (PREFER_DP4) { register_matrix_param6( p, STATE_MATRIX, STATE_MVP, 0, 0, 3, STATE_MATRIX, mvp ); emit_matrix_transform_vec4( p, hpos, mvp, pos ); } else { register_matrix_param6( p, STATE_MATRIX, STATE_MVP, 0, 0, 3, STATE_MATRIX_TRANSPOSE, mvp ); emit_transpose_matrix_transform_vec4( p, hpos, mvp, pos ); } } static GLuint material_attrib( GLuint side, GLuint property ) { return ((property - STATE_AMBIENT) * 2 + side); } static void set_material_flags( struct tnl_program *p ) { p->color_materials = 0; p->materials = 0; if (p->state->light_color_material) { p->materials = p->color_materials = p->state->light_color_material_mask; } p->materials |= p->state->light_material_mask; } static struct ureg get_material( struct tnl_program *p, GLuint side, GLuint property ) { GLuint attrib = material_attrib(side, property); if (p->color_materials & (1<materials & (1<materials & SCENE_COLOR_BITS(side)) { struct ureg lm_ambient = register_param1(p, STATE_LIGHTMODEL_AMBIENT); struct ureg material_emission = get_material(p, side, STATE_EMISSION); struct ureg material_ambient = get_material(p, side, STATE_AMBIENT); struct ureg material_diffuse = get_material(p, side, STATE_DIFFUSE); struct ureg tmp = make_temp(p, material_diffuse); emit_op3(p, VP_OPCODE_MAD, tmp, WRITEMASK_XYZ, lm_ambient, material_ambient, material_emission); return tmp; } else return register_param2( p, STATE_LIGHTMODEL_SCENECOLOR, side ); } static struct ureg get_lightprod( struct tnl_program *p, GLuint light, GLuint side, GLuint property ) { GLuint attrib = material_attrib(side, property); if (p->materials & (1<state->unit[i].light_spotcutoff_is_180) { struct ureg spot_dir = register_param3(p, STATE_LIGHT, i, STATE_SPOT_DIRECTION); struct ureg spot = get_temp(p); struct ureg slt = get_temp(p); emit_normalize_vec3( p, spot, spot_dir ); /* XXX: precompute! */ emit_op2(p, VP_OPCODE_DP3, spot, 0, negate(VPpli), spot); emit_op2(p, VP_OPCODE_SLT, slt, 0, swizzle1(spot_dir,W), spot); emit_op2(p, VP_OPCODE_POW, spot, 0, spot, swizzle1(attenuation, W)); emit_op2(p, VP_OPCODE_MUL, att, 0, slt, spot); release_temp(p, spot); release_temp(p, slt); } /* Calculate distance attenuation: */ if (p->state->unit[i].light_attenuated) { /* 1/d,d,d,1/d */ emit_op1(p, VP_OPCODE_RCP, dist, WRITEMASK_YZ, dist); /* 1,d,d*d,1/d */ emit_op2(p, VP_OPCODE_MUL, dist, WRITEMASK_XZ, dist, swizzle1(dist,Y)); /* 1/dist-atten */ emit_op2(p, VP_OPCODE_DP3, dist, 0, attenuation, dist); if (!p->state->unit[i].light_spotcutoff_is_180) { /* dist-atten */ emit_op1(p, VP_OPCODE_RCP, dist, 0, dist); /* spot-atten * dist-atten */ emit_op2(p, VP_OPCODE_MUL, att, 0, dist, att); } else { /* dist-atten */ emit_op1(p, VP_OPCODE_RCP, att, 0, dist); } } return att; } /* Need to add some addtional parameters to allow lighting in object * space - STATE_SPOT_DIRECTION and STATE_HALF implicitly assume eye * space lighting. */ static void build_lighting( struct tnl_program *p ) { const GLboolean twoside = p->state->light_twoside; const GLboolean separate = p->state->separate_specular; GLuint nr_lights = 0, count = 0; struct ureg normal = get_eye_normal(p); struct ureg lit = get_temp(p); struct ureg dots = get_temp(p); struct ureg _col0 = undef, _col1 = undef; struct ureg _bfc0 = undef, _bfc1 = undef; GLuint i; for (i = 0; i < MAX_LIGHTS; i++) if (p->state->unit[i].light_enabled) nr_lights++; set_material_flags(p); { struct ureg shininess = get_material(p, 0, STATE_SHININESS); emit_op1(p, VP_OPCODE_MOV, dots, WRITEMASK_W, swizzle1(shininess,X)); release_temp(p, shininess); _col0 = make_temp(p, get_scenecolor(p, 0)); if (separate) _col1 = make_temp(p, get_identity_param(p)); else _col1 = _col0; } if (twoside) { struct ureg shininess = get_material(p, 1, STATE_SHININESS); emit_op1(p, VP_OPCODE_MOV, dots, WRITEMASK_Z, negate(swizzle1(shininess,X))); release_temp(p, shininess); _bfc0 = make_temp(p, get_scenecolor(p, 1)); if (separate) _bfc1 = make_temp(p, get_identity_param(p)); else _bfc1 = _bfc0; } /* If no lights, still need to emit the scenecolor. */ { struct ureg res0 = register_output( p, VERT_RESULT_COL0 ); emit_op1(p, VP_OPCODE_MOV, res0, 0, _col0); } if (separate) { struct ureg res1 = register_output( p, VERT_RESULT_COL1 ); emit_op1(p, VP_OPCODE_MOV, res1, 0, _col1); } if (twoside) { struct ureg res0 = register_output( p, VERT_RESULT_BFC0 ); emit_op1(p, VP_OPCODE_MOV, res0, 0, _bfc0); } if (twoside && separate) { struct ureg res1 = register_output( p, VERT_RESULT_BFC1 ); emit_op1(p, VP_OPCODE_MOV, res1, 0, _bfc1); } if (nr_lights == 0) { release_temps(p); return; } for (i = 0; i < MAX_LIGHTS; i++) { if (p->state->unit[i].light_enabled) { struct ureg half = undef; struct ureg att = undef, VPpli = undef; count++; if (p->state->unit[i].light_eyepos3_is_zero) { /* Can used precomputed constants in this case. * Attenuation never applies to infinite lights. */ VPpli = register_param3(p, STATE_LIGHT, i, STATE_POSITION_NORMALIZED); half = register_param3(p, STATE_LIGHT, i, STATE_HALF); } else { struct ureg Ppli = register_param3(p, STATE_LIGHT, i, STATE_POSITION); struct ureg V = get_eye_position(p); struct ureg dist = get_temp(p); VPpli = get_temp(p); half = get_temp(p); /* Calulate VPpli vector */ emit_op2(p, VP_OPCODE_SUB, VPpli, 0, Ppli, V); /* Normalize VPpli. The dist value also used in * attenuation below. */ emit_op2(p, VP_OPCODE_DP3, dist, 0, VPpli, VPpli); emit_op1(p, VP_OPCODE_RSQ, dist, 0, dist); emit_op2(p, VP_OPCODE_MUL, VPpli, 0, VPpli, dist); /* Calculate attenuation: */ if (!p->state->unit[i].light_spotcutoff_is_180 || p->state->unit[i].light_attenuated) { att = calculate_light_attenuation(p, i, VPpli, dist); } /* Calculate viewer direction, or use infinite viewer: */ if (p->state->light_local_viewer) { struct ureg eye_hat = get_eye_position_normalized(p); emit_op2(p, VP_OPCODE_SUB, half, 0, VPpli, eye_hat); } else { struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z); emit_op2(p, VP_OPCODE_ADD, half, 0, VPpli, z_dir); } emit_normalize_vec3(p, half, half); release_temp(p, dist); } /* Calculate dot products: */ emit_op2(p, VP_OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli); emit_op2(p, VP_OPCODE_DP3, dots, WRITEMASK_Y, normal, half); /* Front face lighting: */ { struct ureg ambient = get_lightprod(p, i, 0, STATE_AMBIENT); struct ureg diffuse = get_lightprod(p, i, 0, STATE_DIFFUSE); struct ureg specular = get_lightprod(p, i, 0, STATE_SPECULAR); struct ureg res0, res1; GLuint mask0, mask1; emit_op1(p, VP_OPCODE_LIT, lit, 0, dots); if (!is_undef(att)) emit_op2(p, VP_OPCODE_MUL, lit, 0, lit, att); if (count == nr_lights) { if (separate) { mask0 = WRITEMASK_XYZ; mask1 = WRITEMASK_XYZ; res0 = register_output( p, VERT_RESULT_COL0 ); res1 = register_output( p, VERT_RESULT_COL1 ); } else { mask0 = 0; mask1 = WRITEMASK_XYZ; res0 = _col0; res1 = register_output( p, VERT_RESULT_COL0 ); } } else { mask0 = 0; mask1 = 0; res0 = _col0; res1 = _col1; } emit_op3(p, VP_OPCODE_MAD, _col0, 0, swizzle1(lit,X), ambient, _col0); emit_op3(p, VP_OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _col0); emit_op3(p, VP_OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _col1); release_temp(p, ambient); release_temp(p, diffuse); release_temp(p, specular); } /* Back face lighting: */ if (twoside) { struct ureg ambient = get_lightprod(p, i, 1, STATE_AMBIENT); struct ureg diffuse = get_lightprod(p, i, 1, STATE_DIFFUSE); struct ureg specular = get_lightprod(p, i, 1, STATE_SPECULAR); struct ureg res0, res1; GLuint mask0, mask1; emit_op1(p, VP_OPCODE_LIT, lit, 0, negate(swizzle(dots,X,Y,W,Z))); if (!is_undef(att)) emit_op2(p, VP_OPCODE_MUL, lit, 0, lit, att); if (count == nr_lights) { if (separate) { mask0 = WRITEMASK_XYZ; mask1 = WRITEMASK_XYZ; res0 = register_output( p, VERT_RESULT_BFC0 ); res1 = register_output( p, VERT_RESULT_BFC1 ); } else { mask0 = 0; mask1 = WRITEMASK_XYZ; res0 = _bfc0; res1 = register_output( p, VERT_RESULT_BFC0 ); } } else { res0 = _bfc0; res1 = _bfc1; mask0 = 0; mask1 = 0; } emit_op3(p, VP_OPCODE_MAD, _bfc0, 0, swizzle1(lit,X), ambient, _bfc0); emit_op3(p, VP_OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _bfc0); emit_op3(p, VP_OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _bfc1); release_temp(p, ambient); release_temp(p, diffuse); release_temp(p, specular); } release_temp(p, half); release_temp(p, VPpli); release_temp(p, att); } } release_temps( p ); } static void build_fog( struct tnl_program *p ) { struct ureg fog = register_output(p, VERT_RESULT_FOGC); struct ureg input; if (p->state->fog_source_is_depth) { input = swizzle1(get_eye_position(p), Z); } else { input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X); } if (p->state->tnl_do_vertex_fog) { struct ureg params = register_param1(p, STATE_FOG_PARAMS); struct ureg tmp = get_temp(p); switch (p->state->fog_mode) { case FOG_LINEAR: { struct ureg id = get_identity_param(p); emit_op2(p, VP_OPCODE_SUB, tmp, 0, swizzle1(params,Z), input); emit_op2(p, VP_OPCODE_MUL, tmp, 0, tmp, swizzle1(params,W)); emit_op2(p, VP_OPCODE_MAX, tmp, 0, tmp, swizzle1(id,X)); /* saturate */ emit_op2(p, VP_OPCODE_MIN, fog, WRITEMASK_X, tmp, swizzle1(id,W)); break; } case FOG_EXP: emit_op1(p, VP_OPCODE_ABS, tmp, 0, input); emit_op2(p, VP_OPCODE_MUL, tmp, 0, tmp, swizzle1(params,X)); emit_op2(p, VP_OPCODE_POW, fog, WRITEMASK_X, register_const1f(p, M_E), negate(tmp)); break; case FOG_EXP2: emit_op2(p, VP_OPCODE_MUL, tmp, 0, input, swizzle1(params,X)); emit_op2(p, VP_OPCODE_MUL, tmp, 0, tmp, tmp); emit_op2(p, VP_OPCODE_POW, fog, WRITEMASK_X, register_const1f(p, M_E), negate(tmp)); break; } release_temp(p, tmp); } else { /* results = incoming fog coords (compute fog per-fragment later) * * KW: Is it really necessary to do anything in this case? */ emit_op1(p, VP_OPCODE_MOV, fog, WRITEMASK_X, input); } } static void build_reflect_texgen( struct tnl_program *p, struct ureg dest, GLuint writemask ) { struct ureg normal = get_eye_normal(p); struct ureg eye_hat = get_eye_position_normalized(p); struct ureg tmp = get_temp(p); /* n.u */ emit_op2(p, VP_OPCODE_DP3, tmp, 0, normal, eye_hat); /* 2n.u */ emit_op2(p, VP_OPCODE_ADD, tmp, 0, tmp, tmp); /* (-2n.u)n + u */ emit_op3(p, VP_OPCODE_MAD, dest, writemask, negate(tmp), normal, eye_hat); } static void build_sphere_texgen( struct tnl_program *p, struct ureg dest, GLuint writemask ) { struct ureg normal = get_eye_normal(p); struct ureg eye_hat = get_eye_position_normalized(p); struct ureg tmp = get_temp(p); struct ureg half = register_scalar_const(p, .5); struct ureg r = get_temp(p); struct ureg inv_m = get_temp(p); struct ureg id = get_identity_param(p); /* Could share the above calculations, but it would be * a fairly odd state for someone to set (both sphere and * reflection active for different texture coordinate * components. Of course - if two texture units enable * reflect and/or sphere, things start to tilt in favour * of seperating this out: */ /* n.u */ emit_op2(p, VP_OPCODE_DP3, tmp, 0, normal, eye_hat); /* 2n.u */ emit_op2(p, VP_OPCODE_ADD, tmp, 0, tmp, tmp); /* (-2n.u)n + u */ emit_op3(p, VP_OPCODE_MAD, r, 0, negate(tmp), normal, eye_hat); /* r + 0,0,1 */ emit_op2(p, VP_OPCODE_ADD, tmp, 0, r, swizzle(id,X,Y,W,Z)); /* rx^2 + ry^2 + (rz+1)^2 */ emit_op2(p, VP_OPCODE_DP3, tmp, 0, tmp, tmp); /* 2/m */ emit_op1(p, VP_OPCODE_RSQ, tmp, 0, tmp); /* 1/m */ emit_op2(p, VP_OPCODE_MUL, inv_m, 0, tmp, half); /* r/m + 1/2 */ emit_op3(p, VP_OPCODE_MAD, dest, writemask, r, inv_m, half); release_temp(p, tmp); release_temp(p, r); release_temp(p, inv_m); } static void build_texture_transform( struct tnl_program *p ) { GLuint i, j; for (i = 0; i < MAX_TEXTURE_UNITS; i++) { GLuint texmat_enabled = p->state->unit[i].texmat_enabled; if (p->state->unit[i].texgen_enabled || texmat_enabled) { struct ureg out = register_output(p, VERT_RESULT_TEX0 + i); struct ureg out_texgen = undef; if (p->state->unit[i].texgen_enabled) { GLuint copy_mask = 0; GLuint sphere_mask = 0; GLuint reflect_mask = 0; GLuint normal_mask = 0; GLuint modes[4]; if (texmat_enabled) out_texgen = get_temp(p); else out_texgen = out; modes[0] = p->state->unit[i].texgen_mode0; modes[1] = p->state->unit[i].texgen_mode1; modes[2] = p->state->unit[i].texgen_mode2; modes[3] = p->state->unit[i].texgen_mode3; for (j = 0; j < 4; j++) { switch (modes[j]) { case TXG_OBJ_LINEAR: { struct ureg obj = register_input(p, VERT_ATTRIB_POS); struct ureg plane = register_param3(p, STATE_TEXGEN, i, STATE_TEXGEN_OBJECT_S + j); emit_op2(p, VP_OPCODE_DP4, out_texgen, WRITEMASK_X << j, obj, plane ); break; } case TXG_EYE_LINEAR: { struct ureg eye = get_eye_position(p); struct ureg plane = register_param3(p, STATE_TEXGEN, i, STATE_TEXGEN_EYE_S + j); emit_op2(p, VP_OPCODE_DP4, out_texgen, WRITEMASK_X << j, eye, plane ); break; } case TXG_SPHERE_MAP: sphere_mask |= WRITEMASK_X << j; break; case TXG_REFLECTION_MAP: reflect_mask |= WRITEMASK_X << j; break; case TXG_NORMAL_MAP: normal_mask |= WRITEMASK_X << j; break; case TXG_NONE: copy_mask |= WRITEMASK_X << j; } } if (sphere_mask) { build_sphere_texgen(p, out_texgen, sphere_mask); } if (reflect_mask) { build_reflect_texgen(p, out_texgen, reflect_mask); } if (normal_mask) { struct ureg normal = get_eye_normal(p); emit_op1(p, VP_OPCODE_MOV, out_texgen, normal_mask, normal ); } if (copy_mask) { struct ureg in = register_input(p, VERT_ATTRIB_TEX0+i); emit_op1(p, VP_OPCODE_MOV, out_texgen, copy_mask, in ); } } if (texmat_enabled) { struct ureg texmat[4]; struct ureg in = (!is_undef(out_texgen) ? out_texgen : register_input(p, VERT_ATTRIB_TEX0+i)); if (PREFER_DP4) { register_matrix_param6( p, STATE_MATRIX, STATE_TEXTURE, i, 0, 3, STATE_MATRIX, texmat ); emit_matrix_transform_vec4( p, out, texmat, in ); } else { register_matrix_param6( p, STATE_MATRIX, STATE_TEXTURE, i, 0, 3, STATE_MATRIX_TRANSPOSE, texmat ); emit_transpose_matrix_transform_vec4( p, out, texmat, in ); } } release_temps(p); } else if (p->state->unit[i].texunit_really_enabled) { /* KW: _ReallyEnabled isn't sufficient? Need to know whether * this texture unit is referenced by the fragment shader. */ emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i); } } } /* Seems like it could be tighter: */ static void build_pointsize( struct tnl_program *p ) { struct ureg eye = get_eye_position(p); struct ureg state_size = register_param1(p, STATE_POINT_SIZE); struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION); struct ureg out = register_output(p, VERT_RESULT_PSIZ); struct ureg ut = get_temp(p); /* 1, -Z, Z * Z, 1 */ emit_op1(p, VP_OPCODE_MOV, ut, 0, swizzle1(get_identity_param(p), W)); emit_op2(p, VP_OPCODE_MUL, ut, WRITEMASK_YZ, ut, negate(swizzle1(eye, Z))); emit_op2(p, VP_OPCODE_MUL, ut, WRITEMASK_Z, ut, negate(swizzle1(eye, Z))); /* p1 + p2 * dist + p3 * dist * dist, 0 */ emit_op2(p, VP_OPCODE_DP3, ut, 0, ut, state_attenuation); /* 1 / factor */ emit_op1(p, VP_OPCODE_RCP, ut, 0, ut ); /* out = pointSize / factor */ emit_op2(p, VP_OPCODE_MUL, out, WRITEMASK_X, ut, state_size); release_temp(p, ut); } static void build_tnl_program( struct tnl_program *p ) { /* Emit the program, starting with modelviewproject: */ build_hpos(p); /* Lighting calculations: */ if (p->state->light_global_enabled) build_lighting(p); else emit_passthrough(p, VERT_ATTRIB_COLOR0, VERT_RESULT_COL0); if (p->state->fog_enabled) build_fog(p); if (p->state->texture_enabled_global) build_texture_transform(p); if (p->state->point_attenuated) build_pointsize(p); /* Finish up: */ emit_op1(p, VP_OPCODE_END, undef, 0, undef); /* Disassemble: */ if (DISASSEM) { _mesa_printf ("\n"); } } static void create_new_program( const struct state_key *key, struct vertex_program *program, GLuint max_temps) { struct tnl_program p; _mesa_memset(&p, 0, sizeof(p)); p.state = key; p.program = program; p.eye_position = undef; p.eye_position_normalized = undef; p.eye_normal = undef; p.identity = undef; p.temp_in_use = 0; if (max_temps >= sizeof(int) * 8) p.temp_reserved = 0; else p.temp_reserved = ~((1<Instructions = MALLOC(sizeof(struct vp_instruction) * MAX_INSN); p.program->Base.String = 0; p.program->Base.NumInstructions = p.program->Base.NumTemporaries = p.program->Base.NumParameters = p.program->Base.NumAttributes = p.program->Base.NumAddressRegs = 0; p.program->Parameters = _mesa_new_parameter_list(); p.program->InputsRead = 0; p.program->OutputsWritten = 0; build_tnl_program( &p ); } static void *search_cache( struct tnl_cache *cache, GLuint hash, const void *key, GLuint keysize) { struct tnl_cache *c; for (c = cache; c; c = c->next) { if (c->hash == hash && memcmp(c->key, key, keysize) == 0) return c->data; } return NULL; } static void cache_item( struct tnl_cache **cache, GLuint hash, void *key, void *data ) { struct tnl_cache *c = MALLOC(sizeof(*c)); c->hash = hash; c->key = key; c->data = data; c->next = *cache; *cache = c; } static GLuint hash_key( struct state_key *key ) { GLuint *ikey = (GLuint *)key; GLuint hash = 0, i; /* I'm sure this can be improved on, but speed is important: */ for (i = 0; i < sizeof(*key)/sizeof(GLuint); i++) hash ^= ikey[i]; return hash; } void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct state_key *key; GLuint hash; if (ctx->VertexProgram._Enabled) return; /* Grab all the relevent state and put it in a single structure: */ key = make_state_key(ctx); hash = hash_key(key); /* Look for an already-prepared program for this state: */ ctx->_TnlProgram = (struct vertex_program *) search_cache( tnl->vp_cache, hash, key, sizeof(*key) ); /* OK, we'll have to build a new one: */ if (!ctx->_TnlProgram) { if (0) _mesa_printf("Build new TNL program\n"); ctx->_TnlProgram = (struct vertex_program *) ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); create_new_program( key, ctx->_TnlProgram, ctx->Const.MaxVertexProgramTemps ); cache_item(&tnl->vp_cache, hash, key, ctx->_TnlProgram ); } else { FREE(key); if (0) _mesa_printf("Found existing TNL program for key %x\n", hash); } /* Need a BindProgram callback for the driver? */ } void _tnl_ProgramCacheDestroy( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct tnl_cache *a, *tmp; for (a = tnl->vp_cache ; a; a = tmp) { tmp = a->next; FREE(a->key); FREE(a->data); FREE(a); } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vp_build.h0000644000000000000000000000254013614532424020313 0ustar /* * Mesa 3-D graphics library * Version: 6.3 * * Copyright (C) 2005 Tungsten Graphics All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * TUNGSTEN GRAPHICS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _T_ARB_BUILD_H #define _T_ARB_BUILD_H #include "mtypes.h" extern void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ); extern void _tnl_ProgramCacheDestroy( GLcontext *ctx ); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vtx_api.c0000644000000000000000000006257713614532424020174 0ustar /* $XFree86$ */ /************************************************************************** Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation on the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Keith Whitwell */ #include "glheader.h" #include "context.h" #include "macros.h" #include "vtxfmt.h" #include "dlist.h" #include "state.h" #include "light.h" #include "api_arrayelt.h" #include "api_noop.h" #include "t_vtx_api.h" #include "simple_list.h" #include "dispatch.h" static void reset_attrfv( TNLcontext *tnl ); static tnl_attrfv_func choose[_TNL_MAX_ATTR_CODEGEN+1][4]; /* +1 for ERROR_ATTRIB */ static tnl_attrfv_func generic_attr_func[_TNL_MAX_ATTR_CODEGEN][4]; /* Close off the last primitive, execute the buffer, restart the * primitive. */ static void _tnl_wrap_buffers( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); if (tnl->vtx.prim_count == 0) { tnl->vtx.copied.nr = 0; tnl->vtx.counter = tnl->vtx.initial_counter; tnl->vtx.vbptr = tnl->vtx.buffer; } else { GLuint last_prim = tnl->vtx.prim[tnl->vtx.prim_count-1].mode; GLuint last_count; if (ctx->Driver.CurrentExecPrimitive != GL_POLYGON+1) { GLint i = tnl->vtx.prim_count - 1; assert(i >= 0); tnl->vtx.prim[i].count = ((tnl->vtx.initial_counter - tnl->vtx.counter) - tnl->vtx.prim[i].start); } last_count = tnl->vtx.prim[tnl->vtx.prim_count-1].count; /* Execute the buffer and save copied vertices. */ if (tnl->vtx.counter != tnl->vtx.initial_counter) _tnl_flush_vtx( ctx ); else { tnl->vtx.prim_count = 0; tnl->vtx.copied.nr = 0; } /* Emit a glBegin to start the new list. */ assert(tnl->vtx.prim_count == 0); if (ctx->Driver.CurrentExecPrimitive != GL_POLYGON+1) { tnl->vtx.prim[0].mode = ctx->Driver.CurrentExecPrimitive; tnl->vtx.prim[0].start = 0; tnl->vtx.prim[0].count = 0; tnl->vtx.prim_count++; if (tnl->vtx.copied.nr == last_count) tnl->vtx.prim[0].mode |= last_prim & PRIM_BEGIN; } } } /* Deal with buffer wrapping where provoked by the vertex buffer * filling up, as opposed to upgrade_vertex(). * * Make it GLAPIENTRY, so we can tail from the codegen'ed Vertex*fv */ void GLAPIENTRY _tnl_wrap_filled_vertex( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLfloat *data = tnl->vtx.copied.buffer; GLuint i; /* Run pipeline on current vertices, copy wrapped vertices * to tnl->copied. */ _tnl_wrap_buffers( ctx ); /* Copy stored stored vertices to start of new list. */ assert(tnl->vtx.counter > tnl->vtx.copied.nr); for (i = 0 ; i < tnl->vtx.copied.nr ; i++) { _mesa_memcpy( tnl->vtx.vbptr, data, tnl->vtx.vertex_size * sizeof(GLfloat)); tnl->vtx.vbptr += tnl->vtx.vertex_size; data += tnl->vtx.vertex_size; tnl->vtx.counter--; } tnl->vtx.copied.nr = 0; } /* * Copy the active vertex's values to the ctx->Current fields. */ static void _tnl_copy_to_current( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; for (i = _TNL_ATTRIB_POS+1 ; i < _TNL_ATTRIB_INDEX ; i++) { if (tnl->vtx.attrsz[i]) { /* Note: the tnl->vtx.current[i] pointers points to * the ctx->Current fields. The first 16 or so, anyway. */ COPY_CLEAN_4V(tnl->vtx.current[i], tnl->vtx.attrsz[i], tnl->vtx.attrptr[i]); } } /* color index is special (it's not a float[4] so COPY_CLEAN_4V above * will trash adjacent memory!) */ if (tnl->vtx.attrsz[_TNL_ATTRIB_INDEX]) { ctx->Current.Index = tnl->vtx.attrptr[_TNL_ATTRIB_INDEX][0]; } /* Edgeflag requires additional treatment: */ if (tnl->vtx.attrsz[_TNL_ATTRIB_EDGEFLAG]) { ctx->Current.EdgeFlag = (tnl->vtx.CurrentFloatEdgeFlag == 1.0); } /* Colormaterial -- this kindof sucks. */ if (ctx->Light.ColorMaterialEnabled) { _mesa_update_color_material(ctx, ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); } if (tnl->vtx.have_materials) { tnl->Driver.NotifyMaterialChange( ctx ); } ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT; } static void _tnl_copy_from_current( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLint i; /* Edgeflag requires additional treatment: */ tnl->vtx.CurrentFloatEdgeFlag = (GLfloat)ctx->Current.EdgeFlag; for (i = _TNL_ATTRIB_POS+1 ; i <= _TNL_ATTRIB_MAX ; i++) switch (tnl->vtx.attrsz[i]) { case 4: tnl->vtx.attrptr[i][3] = tnl->vtx.current[i][3]; case 3: tnl->vtx.attrptr[i][2] = tnl->vtx.current[i][2]; case 2: tnl->vtx.attrptr[i][1] = tnl->vtx.current[i][1]; case 1: tnl->vtx.attrptr[i][0] = tnl->vtx.current[i][0]; break; } ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; } /* Flush existing data, set new attrib size, replay copied vertices. */ static void _tnl_wrap_upgrade_vertex( GLcontext *ctx, GLuint attr, GLuint newsz ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint oldsz; GLuint i; GLfloat *tmp; GLint lastcount = tnl->vtx.initial_counter - tnl->vtx.counter; /* Run pipeline on current vertices, copy wrapped vertices * to tnl->vtx.copied. */ _tnl_wrap_buffers( ctx ); /* Do a COPY_TO_CURRENT to ensure back-copying works for the case * when the attribute already exists in the vertex and is having * its size increased. */ _tnl_copy_to_current( ctx ); /* Heuristic: Attempt to isolate attributes received outside * begin/end so that they don't bloat the vertices. */ if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END && tnl->vtx.attrsz[attr] == 0 && lastcount > 8 && tnl->vtx.vertex_size) { reset_attrfv( tnl ); } /* Fix up sizes: */ oldsz = tnl->vtx.attrsz[attr]; tnl->vtx.attrsz[attr] = newsz; tnl->vtx.vertex_size += newsz - oldsz; tnl->vtx.counter = MIN2( VERT_BUFFER_SIZE / tnl->vtx.vertex_size, ctx->Const.MaxArrayLockSize ); tnl->vtx.initial_counter = tnl->vtx.counter; tnl->vtx.vbptr = tnl->vtx.buffer; /* Recalculate all the attrptr[] values */ for (i = 0, tmp = tnl->vtx.vertex ; i < _TNL_ATTRIB_MAX ; i++) { if (tnl->vtx.attrsz[i]) { tnl->vtx.attrptr[i] = tmp; tmp += tnl->vtx.attrsz[i]; } else tnl->vtx.attrptr[i] = NULL; /* will not be dereferenced */ } /* Copy from current to repopulate the vertex with correct values. */ _tnl_copy_from_current( ctx ); /* Replay stored vertices to translate them * to new format here. * * -- No need to replay - just copy piecewise */ if (tnl->vtx.copied.nr) { GLfloat *data = tnl->vtx.copied.buffer; GLfloat *dest = tnl->vtx.buffer; GLuint j; for (i = 0 ; i < tnl->vtx.copied.nr ; i++) { for (j = 0 ; j < _TNL_ATTRIB_MAX ; j++) { if (tnl->vtx.attrsz[j]) { if (j == attr) { if (oldsz) { COPY_CLEAN_4V( dest, oldsz, data ); data += oldsz; dest += newsz; } else { COPY_SZ_4V( dest, newsz, tnl->vtx.current[j] ); dest += newsz; } } else { GLuint sz = tnl->vtx.attrsz[j]; COPY_SZ_4V( dest, sz, data ); dest += sz; data += sz; } } } } tnl->vtx.vbptr = dest; tnl->vtx.counter -= tnl->vtx.copied.nr; tnl->vtx.copied.nr = 0; } /* For codegen - attrptr's may have changed, so need to redo * codegen. Might be a reasonable place to try & detect attributes * in the vertex which aren't being submitted any more. */ for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) if (tnl->vtx.attrsz[i]) { GLuint j = tnl->vtx.attrsz[i] - 1; if (i < _TNL_MAX_ATTR_CODEGEN) tnl->vtx.tabfv[i][j] = choose[i][j]; } } static void _tnl_fixup_vertex( GLcontext *ctx, GLuint attr, GLuint sz ) { TNLcontext *tnl = TNL_CONTEXT(ctx); static const GLfloat id[4] = { 0, 0, 0, 1 }; int i; if (tnl->vtx.attrsz[attr] < sz) { /* New size is larger. Need to flush existing vertices and get * an enlarged vertex format. */ _tnl_wrap_upgrade_vertex( ctx, attr, sz ); } else if (tnl->vtx.attrsz[attr] > sz) { /* New size is smaller - just need to fill in some * zeros. Don't need to flush or wrap. */ for (i = sz ; i <= tnl->vtx.attrsz[attr] ; i++) tnl->vtx.attrptr[attr][i-1] = id[i-1]; } /* Does setting NeedFlush belong here? Necessitates resetting * vtxfmt on each flush (otherwise flags won't get reset * afterwards). */ if (attr == 0) ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; else ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; } #ifdef USE_X86_ASM static struct _tnl_dynfn *lookup( struct _tnl_dynfn *l, GLuint key ) { struct _tnl_dynfn *f; foreach( f, l ) { if (f->key == key) return f; } return NULL; } static tnl_attrfv_func do_codegen( GLcontext *ctx, GLuint attr, GLuint sz ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct _tnl_dynfn *dfn = NULL; if (attr == 0) { GLuint key = tnl->vtx.vertex_size; dfn = lookup( &tnl->vtx.cache.Vertex[sz-1], key ); if (!dfn) dfn = tnl->vtx.gen.Vertex[sz-1]( ctx, key ); } else { GLuint key = (GLuint) tnl->vtx.attrptr[attr]; dfn = lookup( &tnl->vtx.cache.Attribute[sz-1], key ); if (!dfn) dfn = tnl->vtx.gen.Attribute[sz-1]( ctx, key ); } if (dfn) return *(tnl_attrfv_func *) &dfn->code; else return NULL; } #endif /* USE_X86_ASM */ /* Helper function for 'CHOOSE' macro. Do what's necessary when an * entrypoint is called for the first time. */ static tnl_attrfv_func do_choose( GLuint attr, GLuint sz ) { GET_CURRENT_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint oldsz = tnl->vtx.attrsz[attr]; assert(attr < _TNL_MAX_ATTR_CODEGEN); if (oldsz != sz) { /* Reset any active pointers for this attribute */ if (oldsz) tnl->vtx.tabfv[attr][oldsz-1] = choose[attr][oldsz-1]; _tnl_fixup_vertex( ctx, attr, sz ); } /* Try to use codegen: */ #ifdef USE_X86_ASM if (tnl->AllowCodegen) tnl->vtx.tabfv[attr][sz-1] = do_codegen( ctx, attr, sz ); else #endif tnl->vtx.tabfv[attr][sz-1] = NULL; /* Else use generic version: */ if (!tnl->vtx.tabfv[attr][sz-1]) tnl->vtx.tabfv[attr][sz-1] = generic_attr_func[attr][sz-1]; return tnl->vtx.tabfv[attr][sz-1]; } #define CHOOSE( ATTR, N ) \ static void choose_##ATTR##_##N( const GLfloat *v ) \ { \ tnl_attrfv_func f = do_choose(ATTR, N); \ f( v ); \ } #define CHOOSERS( ATTRIB ) \ CHOOSE( ATTRIB, 1 ) \ CHOOSE( ATTRIB, 2 ) \ CHOOSE( ATTRIB, 3 ) \ CHOOSE( ATTRIB, 4 ) \ #define INIT_CHOOSERS(ATTR) \ choose[ATTR][0] = choose_##ATTR##_1; \ choose[ATTR][1] = choose_##ATTR##_2; \ choose[ATTR][2] = choose_##ATTR##_3; \ choose[ATTR][3] = choose_##ATTR##_4; CHOOSERS( 0 ) CHOOSERS( 1 ) CHOOSERS( 2 ) CHOOSERS( 3 ) CHOOSERS( 4 ) CHOOSERS( 5 ) CHOOSERS( 6 ) CHOOSERS( 7 ) CHOOSERS( 8 ) CHOOSERS( 9 ) CHOOSERS( 10 ) CHOOSERS( 11 ) CHOOSERS( 12 ) CHOOSERS( 13 ) CHOOSERS( 14 ) CHOOSERS( 15 ) static void error_attrib( const GLfloat *unused ) { GET_CURRENT_CONTEXT( ctx ); (void) unused; _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib" ); } static void reset_attrfv( TNLcontext *tnl ) { GLuint i; for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) if (tnl->vtx.attrsz[i]) { GLint j = tnl->vtx.attrsz[i] - 1; tnl->vtx.attrsz[i] = 0; if (i < _TNL_MAX_ATTR_CODEGEN) { while (j >= 0) { tnl->vtx.tabfv[i][j] = choose[i][j]; j--; } } } tnl->vtx.vertex_size = 0; tnl->vtx.have_materials = 0; } /* Materials: * * These are treated as per-vertex attributes, at indices above where * the NV_vertex_program leaves off. There are a lot of good things * about treating materials this way. * * However: I don't want to double the number of generated functions * just to cope with this, so I unroll the 'C' varients of CHOOSE and * ATTRF into this function, and dispense with codegen and * second-level dispatch. * * There is no aliasing of material attributes with other entrypoints. */ #define OTHER_ATTR( A, N, params ) \ do { \ if (tnl->vtx.attrsz[A] != N) { \ _tnl_fixup_vertex( ctx, A, N ); \ } \ \ { \ GLfloat *dest = tnl->vtx.attrptr[A]; \ if (N>0) dest[0] = (params)[0]; \ if (N>1) dest[1] = (params)[1]; \ if (N>2) dest[2] = (params)[2]; \ if (N>3) dest[3] = (params)[3]; \ } \ } while (0) #define MAT( ATTR, N, face, params ) \ do { \ if (face != GL_BACK) \ OTHER_ATTR( ATTR, N, params ); /* front */ \ if (face != GL_FRONT) \ OTHER_ATTR( ATTR + 1, N, params ); /* back */ \ } while (0) /* Colormaterial is dealt with later on. */ static void GLAPIENTRY _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); switch (face) { case GL_FRONT: case GL_BACK: case GL_FRONT_AND_BACK: break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glMaterialfv" ); return; } switch (pname) { case GL_EMISSION: MAT( _TNL_ATTRIB_MAT_FRONT_EMISSION, 4, face, params ); break; case GL_AMBIENT: MAT( _TNL_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params ); break; case GL_DIFFUSE: MAT( _TNL_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params ); break; case GL_SPECULAR: MAT( _TNL_ATTRIB_MAT_FRONT_SPECULAR, 4, face, params ); break; case GL_SHININESS: MAT( _TNL_ATTRIB_MAT_FRONT_SHININESS, 1, face, params ); break; case GL_COLOR_INDEXES: MAT( _TNL_ATTRIB_MAT_FRONT_INDEXES, 3, face, params ); break; case GL_AMBIENT_AND_DIFFUSE: MAT( _TNL_ATTRIB_MAT_FRONT_AMBIENT, 4, face, params ); MAT( _TNL_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params ); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glMaterialfv" ); return; } tnl->vtx.have_materials = GL_TRUE; } static void GLAPIENTRY _tnl_EdgeFlag( GLboolean b ) { GET_CURRENT_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); GLfloat f = (GLfloat)b; OTHER_ATTR( _TNL_ATTRIB_EDGEFLAG, 1, &f ); } static void GLAPIENTRY _tnl_EdgeFlagv( const GLboolean *v ) { GET_CURRENT_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); GLfloat f = (GLfloat)v[0]; OTHER_ATTR( _TNL_ATTRIB_EDGEFLAG, 1, &f ); } static void GLAPIENTRY _tnl_Indexf( GLfloat f ) { GET_CURRENT_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); OTHER_ATTR( _TNL_ATTRIB_INDEX, 1, &f ); } static void GLAPIENTRY _tnl_Indexfv( const GLfloat *v ) { GET_CURRENT_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); OTHER_ATTR( _TNL_ATTRIB_INDEX, 1, v ); } /* Eval */ static void GLAPIENTRY _tnl_EvalCoord1f( GLfloat u ) { GET_CURRENT_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); /* TODO: use a CHOOSE() function for this: */ { GLint i; if (tnl->vtx.eval.new_state) _tnl_update_eval( ctx ); for (i = 0 ; i <= _TNL_ATTRIB_INDEX ; i++) { if (tnl->vtx.eval.map1[i].map) if (tnl->vtx.attrsz[i] != tnl->vtx.eval.map1[i].sz) _tnl_fixup_vertex( ctx, i, tnl->vtx.eval.map1[i].sz ); } } _mesa_memcpy( tnl->vtx.copied.buffer, tnl->vtx.vertex, tnl->vtx.vertex_size * sizeof(GLfloat)); _tnl_do_EvalCoord1f( ctx, u ); _mesa_memcpy( tnl->vtx.vertex, tnl->vtx.copied.buffer, tnl->vtx.vertex_size * sizeof(GLfloat)); } static void GLAPIENTRY _tnl_EvalCoord2f( GLfloat u, GLfloat v ) { GET_CURRENT_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); /* TODO: use a CHOOSE() function for this: */ { GLint i; if (tnl->vtx.eval.new_state) _tnl_update_eval( ctx ); for (i = 0 ; i <= _TNL_ATTRIB_INDEX ; i++) { if (tnl->vtx.eval.map2[i].map) if (tnl->vtx.attrsz[i] != tnl->vtx.eval.map2[i].sz) _tnl_fixup_vertex( ctx, i, tnl->vtx.eval.map2[i].sz ); } if (ctx->Eval.AutoNormal) if (tnl->vtx.attrsz[_TNL_ATTRIB_NORMAL] != 3) _tnl_fixup_vertex( ctx, _TNL_ATTRIB_NORMAL, 3 ); } _mesa_memcpy( tnl->vtx.copied.buffer, tnl->vtx.vertex, tnl->vtx.vertex_size * sizeof(GLfloat)); _tnl_do_EvalCoord2f( ctx, u, v ); _mesa_memcpy( tnl->vtx.vertex, tnl->vtx.copied.buffer, tnl->vtx.vertex_size * sizeof(GLfloat)); } static void GLAPIENTRY _tnl_EvalCoord1fv( const GLfloat *u ) { _tnl_EvalCoord1f( u[0] ); } static void GLAPIENTRY _tnl_EvalCoord2fv( const GLfloat *u ) { _tnl_EvalCoord2f( u[0], u[1] ); } static void GLAPIENTRY _tnl_EvalPoint1( GLint i ) { GET_CURRENT_CONTEXT( ctx ); GLfloat du = ((ctx->Eval.MapGrid1u2 - ctx->Eval.MapGrid1u1) / (GLfloat) ctx->Eval.MapGrid1un); GLfloat u = i * du + ctx->Eval.MapGrid1u1; _tnl_EvalCoord1f( u ); } static void GLAPIENTRY _tnl_EvalPoint2( GLint i, GLint j ) { GET_CURRENT_CONTEXT( ctx ); GLfloat du = ((ctx->Eval.MapGrid2u2 - ctx->Eval.MapGrid2u1) / (GLfloat) ctx->Eval.MapGrid2un); GLfloat dv = ((ctx->Eval.MapGrid2v2 - ctx->Eval.MapGrid2v1) / (GLfloat) ctx->Eval.MapGrid2vn); GLfloat u = i * du + ctx->Eval.MapGrid2u1; GLfloat v = j * dv + ctx->Eval.MapGrid2v1; _tnl_EvalCoord2f( u, v ); } /* Build a list of primitives on the fly. Keep * ctx->Driver.CurrentExecPrimitive uptodate as well. */ static void GLAPIENTRY _tnl_Begin( GLenum mode ) { GET_CURRENT_CONTEXT( ctx ); if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; if (ctx->NewState) { _mesa_update_state( ctx ); if ((ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) || (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBegin (invalid vertex/fragment program)"); tnl->DiscardPrimitive = GL_TRUE; return; } if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "glBegin(incomplete framebuffer)"); tnl->DiscardPrimitive = GL_TRUE; return; } tnl->DiscardPrimitive = GL_FALSE; if (!(tnl->Driver.NotifyBegin && tnl->Driver.NotifyBegin( ctx, mode ))) CALL_Begin(ctx->Exec, (mode)); return; } /* Heuristic: attempt to isolate attributes occuring outside * begin/end pairs. */ if (tnl->vtx.vertex_size && !tnl->vtx.attrsz[0]) _tnl_FlushVertices( ctx, ~0 ); i = tnl->vtx.prim_count++; tnl->vtx.prim[i].mode = mode | PRIM_BEGIN; tnl->vtx.prim[i].start = tnl->vtx.initial_counter - tnl->vtx.counter; tnl->vtx.prim[i].count = 0; ctx->Driver.CurrentExecPrimitive = mode; } else _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin" ); } static void GLAPIENTRY _tnl_End( void ) { GET_CURRENT_CONTEXT( ctx ); if (ctx->Driver.CurrentExecPrimitive != GL_POLYGON+1) { TNLcontext *tnl = TNL_CONTEXT(ctx); int idx = tnl->vtx.initial_counter - tnl->vtx.counter; int i = tnl->vtx.prim_count - 1; tnl->vtx.prim[i].mode |= PRIM_END; tnl->vtx.prim[i].count = idx - tnl->vtx.prim[i].start; ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1; /* Two choices which effect the way vertex attributes are * carried over (or not) between adjacent primitives. */ #if 0 if (tnl->vtx.prim_count == TNL_MAX_PRIM) _tnl_FlushVertices( ctx, ~0 ); #else if (tnl->vtx.prim_count == TNL_MAX_PRIM) _tnl_flush_vtx( ctx ); #endif } else _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" ); } static void _tnl_exec_vtxfmt_init( GLcontext *ctx ) { GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->exec_vtxfmt); vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ vfmt->Begin = _tnl_Begin; vfmt->CallList = _mesa_CallList; vfmt->CallLists = _mesa_CallLists; vfmt->EdgeFlag = _tnl_EdgeFlag; vfmt->EdgeFlagv = _tnl_EdgeFlagv; vfmt->End = _tnl_End; vfmt->EvalCoord1f = _tnl_EvalCoord1f; vfmt->EvalCoord1fv = _tnl_EvalCoord1fv; vfmt->EvalCoord2f = _tnl_EvalCoord2f; vfmt->EvalCoord2fv = _tnl_EvalCoord2fv; vfmt->EvalPoint1 = _tnl_EvalPoint1; vfmt->EvalPoint2 = _tnl_EvalPoint2; vfmt->Indexf = _tnl_Indexf; vfmt->Indexfv = _tnl_Indexfv; vfmt->Materialfv = _tnl_Materialfv; vfmt->Rectf = _mesa_noop_Rectf; vfmt->EvalMesh1 = _mesa_noop_EvalMesh1; vfmt->EvalMesh2 = _mesa_noop_EvalMesh2; } void _tnl_FlushVertices( GLcontext *ctx, GLuint flags ) { TNLcontext *tnl = TNL_CONTEXT(ctx); (void) flags; if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { /* still inside a glBegin/End pair. How'd we get here??? */ return; } if (tnl->DiscardPrimitive) { /* discard any primitives */ tnl->vtx.prim_count = 0; tnl->vtx.counter = tnl->vtx.initial_counter; tnl->vtx.vbptr = tnl->vtx.buffer; } if (tnl->vtx.counter != tnl->vtx.initial_counter) { _tnl_flush_vtx( ctx ); } if (tnl->vtx.vertex_size) { _tnl_copy_to_current( ctx ); reset_attrfv( tnl ); } ctx->Driver.NeedFlush = 0; } static void _tnl_current_init( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLint i; /* setup the pointers for the typical 16 vertex attributes */ for (i = 0; i < VERT_ATTRIB_MAX; i++) tnl->vtx.current[i] = ctx->Current.Attrib[i]; /* setup pointers for the 12 material attributes */ for (i = 0; i < MAT_ATTRIB_MAX; i++) tnl->vtx.current[_TNL_ATTRIB_MAT_FRONT_AMBIENT + i] = ctx->Light.Material.Attrib[i]; tnl->vtx.current[_TNL_ATTRIB_INDEX] = &ctx->Current.Index; tnl->vtx.current[_TNL_ATTRIB_EDGEFLAG] = &tnl->vtx.CurrentFloatEdgeFlag; } static struct _tnl_dynfn *no_codegen( GLcontext *ctx, int key ) { (void) ctx; (void) key; return NULL; } void _tnl_vtx_init( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct tnl_vertex_arrays *tmp = &tnl->vtx_inputs; GLuint i; static int firsttime = 1; if (firsttime) { firsttime = 0; INIT_CHOOSERS( 0 ); INIT_CHOOSERS( 1 ); INIT_CHOOSERS( 2 ); INIT_CHOOSERS( 3 ); INIT_CHOOSERS( 4 ); INIT_CHOOSERS( 5 ); INIT_CHOOSERS( 6 ); INIT_CHOOSERS( 7 ); INIT_CHOOSERS( 8 ); INIT_CHOOSERS( 9 ); INIT_CHOOSERS( 10 ); INIT_CHOOSERS( 11 ); INIT_CHOOSERS( 12 ); INIT_CHOOSERS( 13 ); INIT_CHOOSERS( 14 ); INIT_CHOOSERS( 15 ); choose[ERROR_ATTRIB][0] = error_attrib; choose[ERROR_ATTRIB][1] = error_attrib; choose[ERROR_ATTRIB][2] = error_attrib; choose[ERROR_ATTRIB][3] = error_attrib; #ifdef USE_X86_ASM if (tnl->AllowCodegen) { _tnl_x86choosers(choose, do_choose); /* x86 INIT_CHOOSERS */ } #endif _tnl_generic_attr_table_init( generic_attr_func ); } for (i = 0; i < _TNL_ATTRIB_INDEX; i++) _mesa_vector4f_init( &tmp->Attribs[i], 0, NULL); for (i = 0; i < 4; i++) { make_empty_list( &tnl->vtx.cache.Vertex[i] ); make_empty_list( &tnl->vtx.cache.Attribute[i] ); tnl->vtx.gen.Vertex[i] = no_codegen; tnl->vtx.gen.Attribute[i] = no_codegen; } #ifdef USE_X86_ASM _tnl_InitX86Codegen( &tnl->vtx.gen ); #endif _tnl_current_init( ctx ); _tnl_exec_vtxfmt_init( ctx ); _tnl_generic_exec_vtxfmt_init( ctx ); #ifdef USE_X86_ASM if (tnl->AllowCodegen) { _tnl_x86_exec_vtxfmt_init( ctx ); /* x86 DISPATCH_ATTRFV */ } #endif _mesa_install_exec_vtxfmt( ctx, &tnl->exec_vtxfmt ); memcpy( tnl->vtx.tabfv, choose, sizeof(choose) ); for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) tnl->vtx.attrsz[i] = 0; tnl->vtx.vertex_size = 0; tnl->vtx.have_materials = 0; } static void free_funcs( struct _tnl_dynfn *l ) { struct _tnl_dynfn *f, *tmp; foreach_s (f, tmp, l) { remove_from_list( f ); ALIGN_FREE( f->code ); FREE( f ); } } void _tnl_vtx_destroy( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint i; for (i = 0; i < 4; i++) { free_funcs( &tnl->vtx.cache.Vertex[i] ); free_funcs( &tnl->vtx.cache.Attribute[i] ); } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vtx_api.h0000644000000000000000000000515113614532424020162 0ustar /* $XFree86$ */ /************************************************************************** Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation on the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Keith Whitwell * */ #ifndef __T_VTX_API_H__ #define __T_VTX_API_H__ #include "t_context.h" #define ERROR_ATTRIB 16 /* t_vtx_api.c: */ extern void _tnl_vtx_init( GLcontext *ctx ); extern void _tnl_vtx_destroy( GLcontext *ctx ); extern void _tnl_FlushVertices( GLcontext *ctx, GLuint flags ); extern void _tnl_flush_vtx( GLcontext *ctx ); extern void GLAPIENTRY _tnl_wrap_filled_vertex( GLcontext *ctx ); /* t_vtx_exec.c: */ extern void _tnl_do_EvalCoord2f( GLcontext* ctx, GLfloat u, GLfloat v ); extern void _tnl_do_EvalCoord1f(GLcontext* ctx, GLfloat u); extern void _tnl_update_eval( GLcontext *ctx ); extern GLboolean *_tnl_translate_edgeflag( GLcontext *ctx, const GLfloat *data, GLuint count, GLuint stride ); extern GLboolean *_tnl_import_current_edgeflag( GLcontext *ctx, GLuint count ); /* t_vtx_generic.c: */ extern void _tnl_generic_exec_vtxfmt_init( GLcontext *ctx ); extern void _tnl_generic_attr_table_init( tnl_attrfv_func (*tab)[4] ); /* t_vtx_x86.c: */ extern void _tnl_InitX86Codegen( struct _tnl_dynfn_generators *gen ); extern void _tnl_x86_exec_vtxfmt_init( GLcontext *ctx ); extern void _tnl_x86choosers( tnl_attrfv_func (*choose)[4], tnl_attrfv_func (*do_choose)( GLuint attr, GLuint sz )); #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vtx_eval.c0000644000000000000000000001702613614532424020337 0ustar /* * Mesa 3-D graphics library * Version: 6.1 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "api_eval.h" #include "context.h" #include "macros.h" #include "math/m_eval.h" #include "t_vtx_api.h" #include "dispatch.h" static void clear_active_eval1( TNLcontext *tnl, GLuint attr ) { tnl->vtx.eval.map1[attr].map = NULL; } static void clear_active_eval2( TNLcontext *tnl, GLuint attr ) { tnl->vtx.eval.map2[attr].map = NULL; } static void set_active_eval1( TNLcontext *tnl, GLuint attr, GLuint dim, struct gl_1d_map *map ) { if (!tnl->vtx.eval.map1[attr].map) { tnl->vtx.eval.map1[attr].map = map; tnl->vtx.eval.map1[attr].sz = dim; } } static void set_active_eval2( TNLcontext *tnl, GLuint attr, GLuint dim, struct gl_2d_map *map ) { if (!tnl->vtx.eval.map2[attr].map) { tnl->vtx.eval.map2[attr].map = map; tnl->vtx.eval.map2[attr].sz = dim; } } void _tnl_update_eval( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint attr; /* Vertex program maps have priority over conventional attribs */ for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { clear_active_eval1( tnl, attr ); clear_active_eval2( tnl, attr ); } if (ctx->VertexProgram._Enabled) { for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { if (ctx->Eval.Map1Attrib[attr]) set_active_eval1( tnl, attr, 4, &ctx->EvalMap.Map1Attrib[attr] ); if (ctx->Eval.Map2Attrib[attr]) set_active_eval2( tnl, attr, 4, &ctx->EvalMap.Map2Attrib[attr] ); } } if (ctx->Eval.Map1Color4) set_active_eval1( tnl, VERT_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map1Color4 ); if (ctx->Eval.Map2Color4) set_active_eval2( tnl, VERT_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map2Color4 ); if (ctx->Eval.Map1TextureCoord4) set_active_eval1( tnl, VERT_ATTRIB_TEX0, 4, &ctx->EvalMap.Map1Texture4 ); else if (ctx->Eval.Map1TextureCoord3) set_active_eval1( tnl, VERT_ATTRIB_TEX0, 3, &ctx->EvalMap.Map1Texture3 ); else if (ctx->Eval.Map1TextureCoord2) set_active_eval1( tnl, VERT_ATTRIB_TEX0, 2, &ctx->EvalMap.Map1Texture2 ); else if (ctx->Eval.Map1TextureCoord1) set_active_eval1( tnl, VERT_ATTRIB_TEX0, 1, &ctx->EvalMap.Map1Texture1 ); if (ctx->Eval.Map2TextureCoord4) set_active_eval2( tnl, VERT_ATTRIB_TEX0, 4, &ctx->EvalMap.Map2Texture4 ); else if (ctx->Eval.Map2TextureCoord3) set_active_eval2( tnl, VERT_ATTRIB_TEX0, 3, &ctx->EvalMap.Map2Texture3 ); else if (ctx->Eval.Map2TextureCoord2) set_active_eval2( tnl, VERT_ATTRIB_TEX0, 2, &ctx->EvalMap.Map2Texture2 ); else if (ctx->Eval.Map2TextureCoord1) set_active_eval2( tnl, VERT_ATTRIB_TEX0, 1, &ctx->EvalMap.Map2Texture1 ); if (ctx->Eval.Map1Normal) set_active_eval1( tnl, VERT_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map1Normal ); if (ctx->Eval.Map2Normal) set_active_eval2( tnl, VERT_ATTRIB_NORMAL, 3, &ctx->EvalMap.Map2Normal ); if (ctx->Eval.Map1Vertex4) set_active_eval1( tnl, VERT_ATTRIB_POS, 4, &ctx->EvalMap.Map1Vertex4 ); else if (ctx->Eval.Map1Vertex3) set_active_eval1( tnl, VERT_ATTRIB_POS, 3, &ctx->EvalMap.Map1Vertex3 ); if (ctx->Eval.Map2Vertex4) set_active_eval2( tnl, VERT_ATTRIB_POS, 4, &ctx->EvalMap.Map2Vertex4 ); else if (ctx->Eval.Map2Vertex3) set_active_eval2( tnl, VERT_ATTRIB_POS, 3, &ctx->EvalMap.Map2Vertex3 ); tnl->vtx.eval.new_state = 0; } void _tnl_do_EvalCoord1f(GLcontext* ctx, GLfloat u) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint attr; for (attr = 1; attr <= _TNL_ATTRIB_INDEX; attr++) { struct gl_1d_map *map = tnl->vtx.eval.map1[attr].map; if (map) { GLfloat uu = (u - map->u1) * map->du; GLfloat data[4]; ASSIGN_4V(data, 0, 0, 0, 1); _math_horner_bezier_curve(map->Points, data, uu, tnl->vtx.eval.map1[attr].sz, map->Order); COPY_SZ_4V( tnl->vtx.attrptr[attr], tnl->vtx.attrsz[attr], data ); } } /** Vertex -- EvalCoord1f is a noop if this map not enabled: **/ if (tnl->vtx.eval.map1[0].map) { struct gl_1d_map *map = tnl->vtx.eval.map1[0].map; GLfloat uu = (u - map->u1) * map->du; GLfloat vertex[4]; ASSIGN_4V(vertex, 0, 0, 0, 1); _math_horner_bezier_curve(map->Points, vertex, uu, tnl->vtx.eval.map1[0].sz, map->Order); if (tnl->vtx.eval.map1[0].sz == 4) CALL_Vertex4fv(GET_DISPATCH(), ( vertex )); else CALL_Vertex3fv(GET_DISPATCH(), ( vertex )); } } void _tnl_do_EvalCoord2f( GLcontext* ctx, GLfloat u, GLfloat v ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint attr; for (attr = 1; attr <= _TNL_ATTRIB_INDEX; attr++) { struct gl_2d_map *map = tnl->vtx.eval.map2[attr].map; if (map) { GLfloat uu = (u - map->u1) * map->du; GLfloat vv = (v - map->v1) * map->dv; GLfloat data[4]; ASSIGN_4V(data, 0, 0, 0, 1); _math_horner_bezier_surf(map->Points, data, uu, vv, tnl->vtx.eval.map2[attr].sz, map->Uorder, map->Vorder); COPY_SZ_4V( tnl->vtx.attrptr[attr], tnl->vtx.attrsz[attr], data ); } } /** Vertex -- EvalCoord2f is a noop if this map not enabled: **/ if (tnl->vtx.eval.map2[0].map) { struct gl_2d_map *map = tnl->vtx.eval.map2[0].map; GLfloat uu = (u - map->u1) * map->du; GLfloat vv = (v - map->v1) * map->dv; GLfloat vertex[4]; ASSIGN_4V(vertex, 0, 0, 0, 1); if (ctx->Eval.AutoNormal) { GLfloat normal[4]; GLfloat du[4], dv[4]; _math_de_casteljau_surf(map->Points, vertex, du, dv, uu, vv, tnl->vtx.eval.map2[0].sz, map->Uorder, map->Vorder); if (tnl->vtx.eval.map2[0].sz == 4) { du[0] = du[0]*vertex[3] - du[3]*vertex[0]; du[1] = du[1]*vertex[3] - du[3]*vertex[1]; du[2] = du[2]*vertex[3] - du[3]*vertex[2]; dv[0] = dv[0]*vertex[3] - dv[3]*vertex[0]; dv[1] = dv[1]*vertex[3] - dv[3]*vertex[1]; dv[2] = dv[2]*vertex[3] - dv[3]*vertex[2]; } CROSS3(normal, du, dv); NORMALIZE_3FV(normal); normal[3] = 1.0; COPY_SZ_4V( tnl->vtx.attrptr[_TNL_ATTRIB_NORMAL], tnl->vtx.attrsz[_TNL_ATTRIB_NORMAL], normal ); } else { _math_horner_bezier_surf(map->Points, vertex, uu, vv, tnl->vtx.eval.map2[0].sz, map->Uorder, map->Vorder); } if (tnl->vtx.attrsz[0] == 4) CALL_Vertex4fv(GET_DISPATCH(), ( vertex )); else CALL_Vertex3fv(GET_DISPATCH(), ( vertex )); } } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vtx_exec.c0000644000000000000000000001770313614532424020336 0ustar /* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Keith Whitwell */ #include "glheader.h" #include "api_eval.h" #include "context.h" #include "enums.h" #include "state.h" #include "macros.h" #include "math/m_eval.h" #include "t_vtx_api.h" #include "t_pipeline.h" static void _tnl_print_vtx( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint count = tnl->vtx.initial_counter - tnl->vtx.counter; GLuint i; _mesa_debug(ctx, "_tnl_print_vtx: %u vertices %d primitives, %d vertsize\n", count, tnl->vtx.prim_count, tnl->vtx.vertex_size); for (i = 0 ; i < tnl->vtx.prim_count ; i++) { struct tnl_prim *prim = &tnl->vtx.prim[i]; _mesa_debug(NULL, " prim %d: %s %d..%d %s %s\n", i, _mesa_lookup_enum_by_nr(prim->mode & PRIM_MODE_MASK), prim->start, prim->start + prim->count, (prim->mode & PRIM_BEGIN) ? "BEGIN" : "(wrap)", (prim->mode & PRIM_END) ? "END" : "(wrap)"); } } GLboolean *_tnl_translate_edgeflag( GLcontext *ctx, const GLfloat *data, GLuint count, GLuint stride ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLboolean *ef = tnl->vtx.edgeflag_tmp; GLuint i; if (!ef) ef = tnl->vtx.edgeflag_tmp = (GLboolean *) MALLOC( tnl->vb.Size ); for (i = 0 ; i < count ; i++, data += stride) ef[i] = (data[0] == 1.0); return ef; } GLboolean *_tnl_import_current_edgeflag( GLcontext *ctx, GLuint count ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLboolean *ef = tnl->vtx.edgeflag_tmp; GLboolean tmp = ctx->Current.EdgeFlag; GLuint i; if (!ef) ef = tnl->vtx.edgeflag_tmp = (GLboolean *) MALLOC( tnl->vb.Size ); for (i = 0 ; i < count ; i++) ef[i] = tmp; return ef; } static INLINE GLint get_size( const GLfloat *f ) { if (f[3] != 1.0) return 4; if (f[2] != 0.0) return 3; return 2; } /* Some nasty stuff still hanging on here. * * TODO - remove VB->NormalPtr, etc and just use the AttrPtr's. */ static void _tnl_vb_bind_vtx( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; struct tnl_vertex_arrays *tmp = &tnl->vtx_inputs; GLfloat *data = tnl->vtx.buffer; GLuint count = tnl->vtx.initial_counter - tnl->vtx.counter; GLuint attr, i; if (0) fprintf(stderr, "_tnl_vb_bind_vtx(): %d verts %d vertsize\n", count, tnl->vtx.vertex_size); /* Setup constant data in the VB. */ VB->Count = count; VB->Primitive = tnl->vtx.prim; VB->PrimitiveCount = tnl->vtx.prim_count; VB->Elts = NULL; VB->NormalLengthPtr = NULL; for (attr = 0; attr <= _TNL_ATTRIB_INDEX ; attr++) { if (tnl->vtx.attrsz[attr]) { tmp->Attribs[attr].count = count; tmp->Attribs[attr].data = (GLfloat (*)[4]) data; tmp->Attribs[attr].start = data; tmp->Attribs[attr].size = tnl->vtx.attrsz[attr]; tmp->Attribs[attr].stride = tnl->vtx.vertex_size * sizeof(GLfloat); VB->AttribPtr[attr] = &tmp->Attribs[attr]; data += tnl->vtx.attrsz[attr]; } else { /* VB->AttribPtr[attr] = &tnl->current.Attribs[attr]; */ tmp->Attribs[attr].count = 1; tmp->Attribs[attr].data = (GLfloat (*)[4]) tnl->vtx.current[attr]; tmp->Attribs[attr].start = tnl->vtx.current[attr]; tmp->Attribs[attr].size = get_size( tnl->vtx.current[attr] ); tmp->Attribs[attr].stride = 0; VB->AttribPtr[attr] = &tmp->Attribs[attr]; } } /* Copy and translate EdgeFlag to a contiguous array of GLbooleans */ if (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL) { if (tnl->vtx.attrsz[_TNL_ATTRIB_EDGEFLAG]) { VB->EdgeFlag = _tnl_translate_edgeflag( ctx, data, count, tnl->vtx.vertex_size ); data++; } else VB->EdgeFlag = _tnl_import_current_edgeflag( ctx, count ); } /* Legacy pointers -- remove one day. */ VB->ObjPtr = VB->AttribPtr[_TNL_ATTRIB_POS]; VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0]; VB->ColorPtr[1] = NULL; VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_INDEX]; VB->IndexPtr[1] = NULL; VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1]; VB->SecondaryColorPtr[1] = NULL; VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG]; for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { VB->TexCoordPtr[i] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]; } } /* * NOTE: Need to have calculated primitives by this point -- do it on the fly. * NOTE: Old 'parity' issue is gone. */ static GLuint _tnl_copy_vertices( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT( ctx ); GLuint nr = tnl->vtx.prim[tnl->vtx.prim_count-1].count; GLuint ovf, i; GLuint sz = tnl->vtx.vertex_size; GLfloat *dst = tnl->vtx.copied.buffer; GLfloat *src = (tnl->vtx.buffer + tnl->vtx.prim[tnl->vtx.prim_count-1].start * tnl->vtx.vertex_size); switch( ctx->Driver.CurrentExecPrimitive ) { case GL_POINTS: return 0; case GL_LINES: ovf = nr&1; for (i = 0 ; i < ovf ; i++) _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) ); return i; case GL_TRIANGLES: ovf = nr%3; for (i = 0 ; i < ovf ; i++) _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) ); return i; case GL_QUADS: ovf = nr&3; for (i = 0 ; i < ovf ; i++) _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) ); return i; case GL_LINE_STRIP: if (nr == 0) return 0; else { _mesa_memcpy( dst, src+(nr-1)*sz, sz * sizeof(GLfloat) ); return 1; } case GL_LINE_LOOP: case GL_TRIANGLE_FAN: case GL_POLYGON: if (nr == 0) return 0; else if (nr == 1) { _mesa_memcpy( dst, src+0, sz * sizeof(GLfloat) ); return 1; } else { _mesa_memcpy( dst, src+0, sz * sizeof(GLfloat) ); _mesa_memcpy( dst+sz, src+(nr-1)*sz, sz * sizeof(GLfloat) ); return 2; } case GL_TRIANGLE_STRIP: case GL_QUAD_STRIP: switch (nr) { case 0: ovf = 0; break; case 1: ovf = 1; break; default: ovf = 2 + (nr&1); break; } for (i = 0 ; i < ovf ; i++) _mesa_memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz * sizeof(GLfloat) ); return i; case GL_POLYGON+1: return 0; default: assert(0); return 0; } } /** * Execute the buffer and save copied verts. */ void _tnl_flush_vtx( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint vertex_count = tnl->vtx.initial_counter - tnl->vtx.counter; if (0) _tnl_print_vtx( ctx ); if (tnl->vtx.prim_count && vertex_count) { tnl->vtx.copied.nr = _tnl_copy_vertices( ctx ); if (tnl->vtx.copied.nr != vertex_count) { if (ctx->NewState) _mesa_update_state( ctx ); _tnl_vb_bind_vtx( ctx ); tnl->Driver.RunPipeline( ctx ); } } tnl->vtx.prim_count = 0; tnl->vtx.counter = tnl->vtx.initial_counter; tnl->vtx.vbptr = tnl->vtx.buffer; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vtx_generic.c0000644000000000000000000003562113614532424021025 0ustar /************************************************************************** Copyright 2004 Tungsten Graphics Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation on the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL ATI, TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Keith Whitwell */ #include "glheader.h" #include "context.h" #include "macros.h" #include "vtxfmt.h" #include "dlist.h" #include "state.h" #include "light.h" #include "api_arrayelt.h" #include "api_noop.h" #include "t_vtx_api.h" /* Versions of all the entrypoints for situations where codegen isn't * available. * * Note: Only one size for each attribute may be active at once. * Eg. if Color3f is installed/active, then Color4f may not be, even * if the vertex actually contains 4 color coordinates. This is * because the 3f version won't otherwise set color[3] to 1.0 -- this * is the job of the chooser function when switching between Color4f * and Color3f. */ #define ATTRFV( ATTR, N ) \ static void attrib_##ATTR##_##N( const GLfloat *v ) \ { \ GET_CURRENT_CONTEXT( ctx ); \ TNLcontext *tnl = TNL_CONTEXT(ctx); \ \ if ((ATTR) == 0) { \ GLuint i; \ \ if (N>0) tnl->vtx.vbptr[0] = v[0]; \ if (N>1) tnl->vtx.vbptr[1] = v[1]; \ if (N>2) tnl->vtx.vbptr[2] = v[2]; \ if (N>3) tnl->vtx.vbptr[3] = v[3]; \ \ for (i = N; i < tnl->vtx.vertex_size; i++) \ tnl->vtx.vbptr[i] = tnl->vtx.vertex[i]; \ \ tnl->vtx.vbptr += tnl->vtx.vertex_size; \ \ if (--tnl->vtx.counter == 0) \ _tnl_wrap_filled_vertex( ctx ); \ } \ else { \ GLfloat *dest = tnl->vtx.attrptr[ATTR]; \ if (N>0) dest[0] = v[0]; \ if (N>1) dest[1] = v[1]; \ if (N>2) dest[2] = v[2]; \ if (N>3) dest[3] = v[3]; \ } \ } #define INIT(TAB, ATTR) \ TAB[ATTR][0] = attrib_##ATTR##_1; \ TAB[ATTR][1] = attrib_##ATTR##_2; \ TAB[ATTR][2] = attrib_##ATTR##_3; \ TAB[ATTR][3] = attrib_##ATTR##_4; #define ATTRS( ATTRIB ) \ ATTRFV( ATTRIB, 1 ) \ ATTRFV( ATTRIB, 2 ) \ ATTRFV( ATTRIB, 3 ) \ ATTRFV( ATTRIB, 4 ) ATTRS( 0 ) ATTRS( 1 ) ATTRS( 2 ) ATTRS( 3 ) ATTRS( 4 ) ATTRS( 5 ) ATTRS( 6 ) ATTRS( 7 ) ATTRS( 8 ) ATTRS( 9 ) ATTRS( 10 ) ATTRS( 11 ) ATTRS( 12 ) ATTRS( 13 ) ATTRS( 14 ) ATTRS( 15 ) void _tnl_generic_attr_table_init( tnl_attrfv_func (*tab)[4] ) { INIT( tab, 0 ); INIT( tab, 1 ); INIT( tab, 2 ); INIT( tab, 3 ); INIT( tab, 4 ); INIT( tab, 5 ); INIT( tab, 6 ); INIT( tab, 7 ); INIT( tab, 8 ); INIT( tab, 9 ); INIT( tab, 10 ); INIT( tab, 11 ); INIT( tab, 12 ); INIT( tab, 13 ); INIT( tab, 14 ); INIT( tab, 15 ); } /* These can be made efficient with codegen. Further, by adding more * logic to do_choose(), the double-dispatch for legacy entrypoints * like glVertex3f() can be removed. */ #define DISPATCH_ATTRFV( ATTR, COUNT, P ) \ do { \ GET_CURRENT_CONTEXT( ctx ); \ TNLcontext *tnl = TNL_CONTEXT(ctx); \ tnl->vtx.tabfv[ATTR][COUNT-1]( P ); \ } while (0) #define DISPATCH_ATTR1FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 1, V ) #define DISPATCH_ATTR2FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 2, V ) #define DISPATCH_ATTR3FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 3, V ) #define DISPATCH_ATTR4FV( ATTR, V ) DISPATCH_ATTRFV( ATTR, 4, V ) #define DISPATCH_ATTR1F( ATTR, S ) DISPATCH_ATTRFV( ATTR, 1, &(S) ) #if defined(USE_X86_ASM) && 0 /* will break register calling convention */ /* Naughty cheat: */ #define DISPATCH_ATTR2F( ATTR, S,T ) DISPATCH_ATTRFV( ATTR, 2, &(S) ) #define DISPATCH_ATTR3F( ATTR, S,T,R ) DISPATCH_ATTRFV( ATTR, 3, &(S) ) #define DISPATCH_ATTR4F( ATTR, S,T,R,Q ) DISPATCH_ATTRFV( ATTR, 4, &(S) ) #else /* Safe: */ #define DISPATCH_ATTR2F( ATTR, S,T ) \ do { \ GLfloat v[2]; \ v[0] = S; v[1] = T; \ DISPATCH_ATTR2FV( ATTR, v ); \ } while (0) #define DISPATCH_ATTR3F( ATTR, S,T,R ) \ do { \ GLfloat v[3]; \ v[0] = S; v[1] = T; v[2] = R; \ DISPATCH_ATTR3FV( ATTR, v ); \ } while (0) #define DISPATCH_ATTR4F( ATTR, S,T,R,Q ) \ do { \ GLfloat v[4]; \ v[0] = S; v[1] = T; v[2] = R; v[3] = Q; \ DISPATCH_ATTR4FV( ATTR, v ); \ } while (0) #endif static void GLAPIENTRY _tnl_Vertex2f( GLfloat x, GLfloat y ) { DISPATCH_ATTR2F( _TNL_ATTRIB_POS, x, y ); } static void GLAPIENTRY _tnl_Vertex2fv( const GLfloat *v ) { DISPATCH_ATTR2FV( _TNL_ATTRIB_POS, v ); } static void GLAPIENTRY _tnl_Vertex3f( GLfloat x, GLfloat y, GLfloat z ) { DISPATCH_ATTR3F( _TNL_ATTRIB_POS, x, y, z ); } static void GLAPIENTRY _tnl_Vertex3fv( const GLfloat *v ) { DISPATCH_ATTR3FV( _TNL_ATTRIB_POS, v ); } static void GLAPIENTRY _tnl_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { DISPATCH_ATTR4F( _TNL_ATTRIB_POS, x, y, z, w ); } static void GLAPIENTRY _tnl_Vertex4fv( const GLfloat *v ) { DISPATCH_ATTR4FV( _TNL_ATTRIB_POS, v ); } static void GLAPIENTRY _tnl_TexCoord1f( GLfloat x ) { DISPATCH_ATTR1F( _TNL_ATTRIB_TEX0, x ); } static void GLAPIENTRY _tnl_TexCoord1fv( const GLfloat *v ) { DISPATCH_ATTR1FV( _TNL_ATTRIB_TEX0, v ); } static void GLAPIENTRY _tnl_TexCoord2f( GLfloat x, GLfloat y ) { DISPATCH_ATTR2F( _TNL_ATTRIB_TEX0, x, y ); } static void GLAPIENTRY _tnl_TexCoord2fv( const GLfloat *v ) { DISPATCH_ATTR2FV( _TNL_ATTRIB_TEX0, v ); } static void GLAPIENTRY _tnl_TexCoord3f( GLfloat x, GLfloat y, GLfloat z ) { DISPATCH_ATTR3F( _TNL_ATTRIB_TEX0, x, y, z ); } static void GLAPIENTRY _tnl_TexCoord3fv( const GLfloat *v ) { DISPATCH_ATTR3FV( _TNL_ATTRIB_TEX0, v ); } static void GLAPIENTRY _tnl_TexCoord4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { DISPATCH_ATTR4F( _TNL_ATTRIB_TEX0, x, y, z, w ); } static void GLAPIENTRY _tnl_TexCoord4fv( const GLfloat *v ) { DISPATCH_ATTR4FV( _TNL_ATTRIB_TEX0, v ); } static void GLAPIENTRY _tnl_Normal3f( GLfloat x, GLfloat y, GLfloat z ) { DISPATCH_ATTR3F( _TNL_ATTRIB_NORMAL, x, y, z ); } static void GLAPIENTRY _tnl_Normal3fv( const GLfloat *v ) { DISPATCH_ATTR3FV( _TNL_ATTRIB_NORMAL, v ); } static void GLAPIENTRY _tnl_FogCoordfEXT( GLfloat x ) { DISPATCH_ATTR1F( _TNL_ATTRIB_FOG, x ); } static void GLAPIENTRY _tnl_FogCoordfvEXT( const GLfloat *v ) { DISPATCH_ATTR1FV( _TNL_ATTRIB_FOG, v ); } static void GLAPIENTRY _tnl_Color3f( GLfloat x, GLfloat y, GLfloat z ) { DISPATCH_ATTR3F( _TNL_ATTRIB_COLOR0, x, y, z ); } static void GLAPIENTRY _tnl_Color3fv( const GLfloat *v ) { DISPATCH_ATTR3FV( _TNL_ATTRIB_COLOR0, v ); } static void GLAPIENTRY _tnl_Color4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { DISPATCH_ATTR4F( _TNL_ATTRIB_COLOR0, x, y, z, w ); } static void GLAPIENTRY _tnl_Color4fv( const GLfloat *v ) { DISPATCH_ATTR4FV( _TNL_ATTRIB_COLOR0, v ); } static void GLAPIENTRY _tnl_SecondaryColor3fEXT( GLfloat x, GLfloat y, GLfloat z ) { DISPATCH_ATTR3F( _TNL_ATTRIB_COLOR1, x, y, z ); } static void GLAPIENTRY _tnl_SecondaryColor3fvEXT( const GLfloat *v ) { DISPATCH_ATTR3FV( _TNL_ATTRIB_COLOR1, v ); } static void GLAPIENTRY _tnl_MultiTexCoord1f( GLenum target, GLfloat x ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR1F( attr, x ); } static void GLAPIENTRY _tnl_MultiTexCoord1fv( GLenum target, const GLfloat *v ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR1FV( attr, v ); } static void GLAPIENTRY _tnl_MultiTexCoord2f( GLenum target, GLfloat x, GLfloat y ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR2F( attr, x, y ); } static void GLAPIENTRY _tnl_MultiTexCoord2fv( GLenum target, const GLfloat *v ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR2FV( attr, v ); } static void GLAPIENTRY _tnl_MultiTexCoord3f( GLenum target, GLfloat x, GLfloat y, GLfloat z) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR3F( attr, x, y, z ); } static void GLAPIENTRY _tnl_MultiTexCoord3fv( GLenum target, const GLfloat *v ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR3FV( attr, v ); } static void GLAPIENTRY _tnl_MultiTexCoord4f( GLenum target, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR4F( attr, x, y, z, w ); } static void GLAPIENTRY _tnl_MultiTexCoord4fv( GLenum target, const GLfloat *v ) { GLuint attr = (target & 0x7) + _TNL_ATTRIB_TEX0; DISPATCH_ATTR4FV( attr, v ); } static void GLAPIENTRY _tnl_VertexAttrib1fNV( GLuint index, GLfloat x ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR1F( index, x ); } static void GLAPIENTRY _tnl_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR1FV( index, v ); } static void GLAPIENTRY _tnl_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR2F( index, x, y ); } static void GLAPIENTRY _tnl_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR2FV( index, v ); } static void GLAPIENTRY _tnl_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR3F( index, x, y, z ); } static void GLAPIENTRY _tnl_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR3FV( index, v ); } static void GLAPIENTRY _tnl_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR4F( index, x, y, z, w ); } static void GLAPIENTRY _tnl_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR4FV( index, v ); } /* * XXX adjust index */ static void GLAPIENTRY _tnl_VertexAttrib1fARB( GLuint index, GLfloat x ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR1F( index, x ); } static void GLAPIENTRY _tnl_VertexAttrib1fvARB( GLuint index, const GLfloat *v ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR1FV( index, v ); } static void GLAPIENTRY _tnl_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR2F( index, x, y ); } static void GLAPIENTRY _tnl_VertexAttrib2fvARB( GLuint index, const GLfloat *v ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR2FV( index, v ); } static void GLAPIENTRY _tnl_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR3F( index, x, y, z ); } static void GLAPIENTRY _tnl_VertexAttrib3fvARB( GLuint index, const GLfloat *v ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR3FV( index, v ); } static void GLAPIENTRY _tnl_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR4F( index, x, y, z, w ); } static void GLAPIENTRY _tnl_VertexAttrib4fvARB( GLuint index, const GLfloat *v ) { if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB; DISPATCH_ATTR4FV( index, v ); } /* Install the generic versions of the 2nd level dispatch * functions. Some of these have a codegen alternative. */ void _tnl_generic_exec_vtxfmt_init( GLcontext *ctx ) { GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->exec_vtxfmt); vfmt->Color3f = _tnl_Color3f; vfmt->Color3fv = _tnl_Color3fv; vfmt->Color4f = _tnl_Color4f; vfmt->Color4fv = _tnl_Color4fv; vfmt->FogCoordfEXT = _tnl_FogCoordfEXT; vfmt->FogCoordfvEXT = _tnl_FogCoordfvEXT; vfmt->MultiTexCoord1fARB = _tnl_MultiTexCoord1f; vfmt->MultiTexCoord1fvARB = _tnl_MultiTexCoord1fv; vfmt->MultiTexCoord2fARB = _tnl_MultiTexCoord2f; vfmt->MultiTexCoord2fvARB = _tnl_MultiTexCoord2fv; vfmt->MultiTexCoord3fARB = _tnl_MultiTexCoord3f; vfmt->MultiTexCoord3fvARB = _tnl_MultiTexCoord3fv; vfmt->MultiTexCoord4fARB = _tnl_MultiTexCoord4f; vfmt->MultiTexCoord4fvARB = _tnl_MultiTexCoord4fv; vfmt->Normal3f = _tnl_Normal3f; vfmt->Normal3fv = _tnl_Normal3fv; vfmt->SecondaryColor3fEXT = _tnl_SecondaryColor3fEXT; vfmt->SecondaryColor3fvEXT = _tnl_SecondaryColor3fvEXT; vfmt->TexCoord1f = _tnl_TexCoord1f; vfmt->TexCoord1fv = _tnl_TexCoord1fv; vfmt->TexCoord2f = _tnl_TexCoord2f; vfmt->TexCoord2fv = _tnl_TexCoord2fv; vfmt->TexCoord3f = _tnl_TexCoord3f; vfmt->TexCoord3fv = _tnl_TexCoord3fv; vfmt->TexCoord4f = _tnl_TexCoord4f; vfmt->TexCoord4fv = _tnl_TexCoord4fv; vfmt->Vertex2f = _tnl_Vertex2f; vfmt->Vertex2fv = _tnl_Vertex2fv; vfmt->Vertex3f = _tnl_Vertex3f; vfmt->Vertex3fv = _tnl_Vertex3fv; vfmt->Vertex4f = _tnl_Vertex4f; vfmt->Vertex4fv = _tnl_Vertex4fv; vfmt->VertexAttrib1fNV = _tnl_VertexAttrib1fNV; vfmt->VertexAttrib1fvNV = _tnl_VertexAttrib1fvNV; vfmt->VertexAttrib2fNV = _tnl_VertexAttrib2fNV; vfmt->VertexAttrib2fvNV = _tnl_VertexAttrib2fvNV; vfmt->VertexAttrib3fNV = _tnl_VertexAttrib3fNV; vfmt->VertexAttrib3fvNV = _tnl_VertexAttrib3fvNV; vfmt->VertexAttrib4fNV = _tnl_VertexAttrib4fNV; vfmt->VertexAttrib4fvNV = _tnl_VertexAttrib4fvNV; vfmt->VertexAttrib1fARB = _tnl_VertexAttrib1fARB; vfmt->VertexAttrib1fvARB = _tnl_VertexAttrib1fvARB; vfmt->VertexAttrib2fARB = _tnl_VertexAttrib2fARB; vfmt->VertexAttrib2fvARB = _tnl_VertexAttrib2fvARB; vfmt->VertexAttrib3fARB = _tnl_VertexAttrib3fARB; vfmt->VertexAttrib3fvARB = _tnl_VertexAttrib3fvARB; vfmt->VertexAttrib4fARB = _tnl_VertexAttrib4fARB; vfmt->VertexAttrib4fvARB = _tnl_VertexAttrib4fvARB; } nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vtx_x86.c0000644000000000000000000003257713614532424020045 0ustar /************************************************************************** Copyright 2004 Tungsten Graphics Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation on the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL ATI, TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Keith Whitwell * Daniel Borca */ #include "glheader.h" #include "context.h" #include "macros.h" #include "vtxfmt.h" #include "dlist.h" #include "state.h" #include "light.h" #include "api_arrayelt.h" #include "api_noop.h" #include "t_vtx_api.h" #include "simple_list.h" #if defined(USE_X86_ASM) && !defined(HAVE_NONSTANDARD_GLAPIENTRY) #define EXTERN( FUNC ) \ extern const char FUNC[]; \ extern const char FUNC##_end[] EXTERN( _tnl_x86_Attribute1fv ); EXTERN( _tnl_x86_Attribute2fv ); EXTERN( _tnl_x86_Attribute3fv ); EXTERN( _tnl_x86_Attribute4fv ); EXTERN( _tnl_x86_Vertex1fv ); EXTERN( _tnl_x86_Vertex2fv ); EXTERN( _tnl_x86_Vertex3fv ); EXTERN( _tnl_x86_Vertex4fv ); EXTERN( _tnl_x86_dispatch_attrf1 ); EXTERN( _tnl_x86_dispatch_attrf2 ); EXTERN( _tnl_x86_dispatch_attrf3 ); EXTERN( _tnl_x86_dispatch_attrf4 ); EXTERN( _tnl_x86_dispatch_attrfv ); EXTERN( _tnl_x86_dispatch_multitexcoordf1 ); EXTERN( _tnl_x86_dispatch_multitexcoordf2 ); EXTERN( _tnl_x86_dispatch_multitexcoordf3 ); EXTERN( _tnl_x86_dispatch_multitexcoordf4 ); EXTERN( _tnl_x86_dispatch_multitexcoordfv ); EXTERN( _tnl_x86_dispatch_vertexattribf1 ); EXTERN( _tnl_x86_dispatch_vertexattribf2 ); EXTERN( _tnl_x86_dispatch_vertexattribf3 ); EXTERN( _tnl_x86_dispatch_vertexattribf4 ); EXTERN( _tnl_x86_dispatch_vertexattribfv ); EXTERN( _tnl_x86_choose_fv ); #define DONT_KNOW_OFFSETS 1 #define DFN( FUNC, CACHE, KEY ) \ struct _tnl_dynfn *dfn = MALLOC_STRUCT( _tnl_dynfn );\ const char *start = FUNC; \ const char *end = FUNC##_end; \ int offset = 0; \ insert_at_head( &CACHE, dfn ); \ dfn->key = KEY; \ dfn->code = ALIGN_MALLOC( end - start, 16 ); \ memcpy (dfn->code, start, end - start) #define FIXUP( CODE, KNOWN_OFFSET, CHECKVAL, NEWVAL ) \ do { \ GLint subst = 0x10101010 + CHECKVAL; \ \ if (DONT_KNOW_OFFSETS) { \ while (*(int *)(CODE+offset) != subst) offset++; \ *(int *)(CODE+offset) = (int)(NEWVAL); \ if (0) fprintf(stderr, "%s/%d: offset %d, new value: 0x%x\n", __FILE__, __LINE__, offset, (int)(NEWVAL)); \ offset += 4; \ } \ else { \ int *icode = (int *)(CODE+KNOWN_OFFSET); \ assert (*icode == subst); \ *icode = (int)NEWVAL; \ } \ } while (0) #define FIXUPREL( CODE, KNOWN_OFFSET, CHECKVAL, NEWVAL )\ do { \ GLint subst = 0x10101010 + CHECKVAL; \ \ if (DONT_KNOW_OFFSETS) { \ while (*(int *)(CODE+offset) != subst) offset++; \ *(int *)(CODE+offset) = (int)(NEWVAL) - ((int)(CODE)+offset) - 4; \ if (0) fprintf(stderr, "%s/%d: offset %d, new value: 0x%x\n", __FILE__, __LINE__, offset, (int)(NEWVAL) - ((int)(CODE)+offset) - 4); \ offset += 4; \ } \ else { \ int *icode = (int *)(CODE+KNOWN_OFFSET); \ assert (*icode == subst); \ *icode = (int)(NEWVAL) - (int)(icode) - 4; \ } \ } while (0) /* Build specialized versions of the immediate calls on the fly for * the current state. Generic x86 versions. */ static struct _tnl_dynfn *makeX86Vertex1fv( GLcontext *ctx, int vertex_size ) { TNLcontext *tnl = TNL_CONTEXT(ctx); DFN ( _tnl_x86_Vertex1fv, tnl->vtx.cache.Vertex[1-1], vertex_size ); FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); FIXUP(dfn->code, 0, 1, vertex_size - 1); FIXUP(dfn->code, 0, 2, (int)&tnl->vtx.vertex[1]); FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); FIXUP(dfn->code, 0, 4, (int)ctx); FIXUPREL(dfn->code, 0, 5, (int)&_tnl_wrap_filled_vertex); return dfn; } static struct _tnl_dynfn *makeX86Vertex2fv( GLcontext *ctx, int vertex_size ) { TNLcontext *tnl = TNL_CONTEXT(ctx); DFN ( _tnl_x86_Vertex2fv, tnl->vtx.cache.Vertex[2-1], vertex_size ); FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); FIXUP(dfn->code, 0, 1, vertex_size - 2); FIXUP(dfn->code, 0, 2, (int)&tnl->vtx.vertex[2]); FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); FIXUP(dfn->code, 0, 4, (int)ctx); FIXUPREL(dfn->code, 0, 5, (int)&_tnl_wrap_filled_vertex); return dfn; } static struct _tnl_dynfn *makeX86Vertex3fv( GLcontext *ctx, int vertex_size ) { TNLcontext *tnl = TNL_CONTEXT(ctx); switch (vertex_size) { default: { DFN ( _tnl_x86_Vertex3fv, tnl->vtx.cache.Vertex[3-1], vertex_size ); FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); FIXUP(dfn->code, 0, 1, vertex_size - 3); FIXUP(dfn->code, 0, 2, (int)&tnl->vtx.vertex[3]); FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); FIXUP(dfn->code, 0, 4, (int)ctx); FIXUPREL(dfn->code, 0, 5, (int)&_tnl_wrap_filled_vertex); return dfn; } } } static struct _tnl_dynfn *makeX86Vertex4fv( GLcontext *ctx, int vertex_size ) { TNLcontext *tnl = TNL_CONTEXT(ctx); DFN ( _tnl_x86_Vertex4fv, tnl->vtx.cache.Vertex[4-1], vertex_size ); FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); FIXUP(dfn->code, 0, 1, vertex_size - 4); FIXUP(dfn->code, 0, 2, (int)&tnl->vtx.vertex[4]); FIXUP(dfn->code, 0, 0, (int)&tnl->vtx.vbptr); FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); FIXUP(dfn->code, 0, 3, (int)&tnl->vtx.counter); FIXUP(dfn->code, 0, 4, (int)ctx); FIXUPREL(dfn->code, 0, 5, (int)&_tnl_wrap_filled_vertex); return dfn; } static struct _tnl_dynfn *makeX86Attribute1fv( GLcontext *ctx, int dest ) { TNLcontext *tnl = TNL_CONTEXT(ctx); DFN ( _tnl_x86_Attribute1fv, tnl->vtx.cache.Attribute[1-1], dest ); FIXUP(dfn->code, 0, 0, dest); return dfn; } static struct _tnl_dynfn *makeX86Attribute2fv( GLcontext *ctx, int dest ) { TNLcontext *tnl = TNL_CONTEXT(ctx); DFN ( _tnl_x86_Attribute2fv, tnl->vtx.cache.Attribute[2-1], dest ); FIXUP(dfn->code, 0, 0, dest); FIXUP(dfn->code, 0, 1, 4+dest); return dfn; } static struct _tnl_dynfn *makeX86Attribute3fv( GLcontext *ctx, int dest ) { TNLcontext *tnl = TNL_CONTEXT(ctx); DFN ( _tnl_x86_Attribute3fv, tnl->vtx.cache.Attribute[3-1], dest ); FIXUP(dfn->code, 0, 0, dest); FIXUP(dfn->code, 0, 1, 4+dest); FIXUP(dfn->code, 0, 2, 8+dest); return dfn; } static struct _tnl_dynfn *makeX86Attribute4fv( GLcontext *ctx, int dest ) { TNLcontext *tnl = TNL_CONTEXT(ctx); DFN ( _tnl_x86_Attribute4fv, tnl->vtx.cache.Attribute[4-1], dest ); FIXUP(dfn->code, 0, 0, dest); FIXUP(dfn->code, 0, 1, 4+dest); FIXUP(dfn->code, 0, 2, 8+dest); FIXUP(dfn->code, 0, 3, 12+dest); return dfn; } void _tnl_InitX86Codegen( struct _tnl_dynfn_generators *gen ) { gen->Vertex[0] = makeX86Vertex1fv; gen->Vertex[1] = makeX86Vertex2fv; gen->Vertex[2] = makeX86Vertex3fv; gen->Vertex[3] = makeX86Vertex4fv; gen->Attribute[0] = makeX86Attribute1fv; gen->Attribute[1] = makeX86Attribute2fv; gen->Attribute[2] = makeX86Attribute3fv; gen->Attribute[3] = makeX86Attribute4fv; } #define MKDISP(FUNC, SIZE, ATTR, WARP) \ do { \ char *code; \ const char *start = WARP; \ const char *end = WARP##_end; \ int offset = 0; \ code = ALIGN_MALLOC( end - start, 16 ); \ memcpy (code, start, end - start); \ FIXUP(code, 0, 0, (int)&(TNL_CONTEXT(ctx)->vtx.tabfv[ATTR][SIZE-1]));\ *(void **)&vfmt->FUNC = code; \ } while (0) /* Install the codegen'ed versions of the 2nd level dispatch * functions. We should keep a list and free them in the end... */ void _tnl_x86_exec_vtxfmt_init( GLcontext *ctx ) { GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->exec_vtxfmt); MKDISP(Color3f, 3, _TNL_ATTRIB_COLOR0, _tnl_x86_dispatch_attrf3); MKDISP(Color3fv, 3, _TNL_ATTRIB_COLOR0, _tnl_x86_dispatch_attrfv); MKDISP(Color4f, 4, _TNL_ATTRIB_COLOR0, _tnl_x86_dispatch_attrf4); MKDISP(Color4fv, 4, _TNL_ATTRIB_COLOR0, _tnl_x86_dispatch_attrfv); MKDISP(FogCoordfEXT, 1, _TNL_ATTRIB_FOG, _tnl_x86_dispatch_attrf1); MKDISP(FogCoordfvEXT, 1, _TNL_ATTRIB_FOG, _tnl_x86_dispatch_attrfv); MKDISP(Normal3f, 3, _TNL_ATTRIB_NORMAL, _tnl_x86_dispatch_attrf3); MKDISP(Normal3fv, 3, _TNL_ATTRIB_NORMAL, _tnl_x86_dispatch_attrfv); MKDISP(SecondaryColor3fEXT, 3, _TNL_ATTRIB_COLOR1, _tnl_x86_dispatch_attrf3); MKDISP(SecondaryColor3fvEXT,3, _TNL_ATTRIB_COLOR1, _tnl_x86_dispatch_attrfv); MKDISP(TexCoord1f, 1, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrf1); MKDISP(TexCoord1fv, 1, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrfv); MKDISP(TexCoord2f, 2, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrf2); MKDISP(TexCoord2fv, 2, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrfv); MKDISP(TexCoord3f, 3, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrf3); MKDISP(TexCoord3fv, 3, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrfv); MKDISP(TexCoord4f, 4, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrf4); MKDISP(TexCoord4fv, 4, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_attrfv); MKDISP(Vertex2f, 2, _TNL_ATTRIB_POS, _tnl_x86_dispatch_attrf2); MKDISP(Vertex2fv, 2, _TNL_ATTRIB_POS, _tnl_x86_dispatch_attrfv); MKDISP(Vertex3f, 3, _TNL_ATTRIB_POS, _tnl_x86_dispatch_attrf3); MKDISP(Vertex3fv, 3, _TNL_ATTRIB_POS, _tnl_x86_dispatch_attrfv); MKDISP(Vertex4f, 4, _TNL_ATTRIB_POS, _tnl_x86_dispatch_attrf4); MKDISP(Vertex4fv, 4, _TNL_ATTRIB_POS, _tnl_x86_dispatch_attrfv); MKDISP(MultiTexCoord1fARB, 1, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordf1); MKDISP(MultiTexCoord1fvARB, 1, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordfv); MKDISP(MultiTexCoord2fARB, 2, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordf2); MKDISP(MultiTexCoord2fvARB, 2, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordfv); MKDISP(MultiTexCoord3fARB, 3, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordf3); MKDISP(MultiTexCoord3fvARB, 3, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordfv); MKDISP(MultiTexCoord4fARB, 4, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordf4); MKDISP(MultiTexCoord4fvARB, 4, _TNL_ATTRIB_TEX0, _tnl_x86_dispatch_multitexcoordfv); MKDISP(VertexAttrib1fNV, 1, 0, _tnl_x86_dispatch_vertexattribf1); MKDISP(VertexAttrib1fvNV, 1, 0, _tnl_x86_dispatch_vertexattribfv); MKDISP(VertexAttrib2fNV, 2, 0, _tnl_x86_dispatch_vertexattribf2); MKDISP(VertexAttrib2fvNV, 2, 0, _tnl_x86_dispatch_vertexattribfv); MKDISP(VertexAttrib3fNV, 3, 0, _tnl_x86_dispatch_vertexattribf3); MKDISP(VertexAttrib3fvNV, 3, 0, _tnl_x86_dispatch_vertexattribfv); MKDISP(VertexAttrib4fNV, 4, 0, _tnl_x86_dispatch_vertexattribf4); MKDISP(VertexAttrib4fvNV, 4, 0, _tnl_x86_dispatch_vertexattribfv); } /* Install the codegen'ed choosers. * We should keep a list and free them in the end... */ void _tnl_x86choosers( tnl_attrfv_func (*choose)[4], tnl_attrfv_func (*do_choose)( GLuint attr, GLuint sz )) { int attr, size; for (attr = 0; attr < _TNL_MAX_ATTR_CODEGEN; attr++) { for (size = 0; size < 4; size++) { char *code; const char *start = _tnl_x86_choose_fv; const char *end = _tnl_x86_choose_fv_end; int offset = 0; code = ALIGN_MALLOC( end - start, 16 ); memcpy (code, start, end - start); FIXUP(code, 0, 0, attr); FIXUP(code, 0, 1, size + 1); FIXUPREL(code, 0, 2, do_choose); choose[attr][size] = (tnl_attrfv_func)code; } } } #else void _tnl_InitX86Codegen( struct _tnl_dynfn_generators *gen ) { (void) gen; } void _tnl_x86_exec_vtxfmt_init( GLcontext *ctx ) { (void) ctx; } void _tnl_x86choosers( tnl_attrfv_func (*choose)[4], tnl_attrfv_func (*do_choose)( GLuint attr, GLuint sz )) { (void) choose; (void) do_choose; } #endif nx-libs-3.5.99.23/nx-X11/extras/Mesa/src/mesa/tnl/t_vtx_x86_gcc.S0000644000000000000000000004300213614532424020622 0ustar /************************************************************************** Copyright 2004 Tungsten Graphics Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation on the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL ATI, TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Keith Whitwell * Daniel Borca */ #if defined (__DJGPP__) || defined (__MINGW32__) || defined (__CYGWIN__) #define GLOBL( x ) \ .globl _##x; \ _##x: #else /* !defined (__DJGPP__) && !defined (__MINGW32__) && !defined (__CYGWIN__) */ #define GLOBL( x ) \ .globl x; \ x: #endif /* !defined (__DJGPP__) && !defined (__MINGW32__) && !defined (__CYGWIN__) */ #if !defined (STDCALL_API) #define RETCLEAN( x ) ret #else #define RETCLEAN( x ) ret $x #endif #define _JMP(x) \ .byte 0xe9; \ .long x #define _CALL(x) \ .byte 0xe8; \ .long x /* Someone who knew a lot about this sort of thing would use this * macro to note current offsets, etc in a special region of the * object file & just make everything work out neat. I don't know * enough to do that... */ #define SUBST( x ) (0x10101010 + x) .data /* [dBorca] TODO * Unfold functions for each vertex size? * Build super-specialized SSE versions? * * There is a trick in Vertex*fv: under certain conditions, * we tail to _tnl_wrap_filled_vertex(ctx). This means that * if Vertex*fv is STDCALL, then _tnl_wrap_filled_vertex must * be STDCALL as well, because (GLcontext *) and (GLfloat *) * have the same size. */ .align 4 GLOBL ( _tnl_x86_Vertex1fv ) movl 4(%esp), %ecx push %edi push %esi movl SUBST(0), %edi /* 0x0 --> tnl->vtx.vbptr */ movl (%ecx), %edx /* load v[0] */ movl %edx, (%edi) /* tnl->vtx.vbptr[0] = v[0] */ addl $4, %edi /* tnl->vtx.vbptr += 1 */ movl $SUBST(1), %ecx /* 0x1 --> (tnl->vtx.vertex_size - 1) */ movl $SUBST(2), %esi /* 0x2 --> (tnl->vtx.vertex + 1) */ repz movsl %ds:(%esi), %es:(%edi) movl %edi, SUBST(0) /* 0x0 --> tnl->vtx.vbptr */ movl SUBST(3), %edx /* 0x3 --> counter */ pop %esi pop %edi dec %edx /* counter-- */ movl %edx, SUBST(3) /* 0x3 --> counter */ je .0 /* if (counter == 0) goto .0 */ RETCLEAN(4) /* return */ .balign 16 .0: movl $SUBST(4), %eax /* load ctx */ movl %eax, 4(%esp) /* push ctx */ _JMP (SUBST(5)) /* jmp _tnl_wrap_filled_vertex */ GLOBL ( _tnl_x86_Vertex1fv_end ) .align 4 GLOBL ( _tnl_x86_Vertex2fv ) movl 4(%esp), %ecx push %edi push %esi movl SUBST(0), %edi /* load tnl->vtx.vbptr */ movl (%ecx), %edx /* load v[0] */ movl 4(%ecx), %eax /* load v[1] */ movl %edx, (%edi) /* tnl->vtx.vbptr[0] = v[0] */ movl %eax, 4(%edi) /* tnl->vtx.vbptr[1] = v[1] */ addl $8, %edi /* tnl->vtx.vbptr += 2 */ movl $SUBST(1), %ecx /* vertex_size - 2 */ movl $SUBST(2), %esi /* tnl->vtx.vertex + 2 */ repz movsl %ds:(%esi), %es:(%edi) movl %edi, SUBST(0) /* save tnl->vtx.vbptr */ movl SUBST(3), %edx /* load counter */ pop %esi pop %edi dec %edx /* counter-- */ movl %edx, SUBST(3) /* save counter */ je .1 /* if (counter == 0) goto .1 */ RETCLEAN(4) /* return */ .balign 16 .1: movl $SUBST(4), %eax /* load ctx */ movl %eax, 4(%esp) /* push ctx */ _JMP (SUBST(5)) /* jmp _tnl_wrap_filled_vertex */ GLOBL ( _tnl_x86_Vertex2fv_end ) .align 4 GLOBL ( _tnl_x86_Vertex3fv ) movl 4(%esp), %ecx push %edi push %esi movl SUBST(0), %edi /* load tnl->vtx.vbptr */ movl (%ecx), %edx /* load v[0] */ movl 4(%ecx), %eax /* load v[1] */ movl 8(%ecx), %esi /* load v[2] */ movl %edx, (%edi) /* tnl->vtx.vbptr[0] = v[0] */ movl %eax, 4(%edi) /* tnl->vtx.vbptr[1] = v[1] */ movl %esi, 8(%edi) /* tnl->vtx.vbptr[2] = v[2] */ addl $12, %edi /* tnl->vtx.vbptr += 3 */ movl $SUBST(1), %ecx /* vertex_size - 3 */ movl $SUBST(2), %esi /* tnl->vtx.vertex + 3 */ repz movsl %ds:(%esi), %es:(%edi) movl %edi, SUBST(0) /* save tnl->vtx.vbptr */ movl SUBST(3), %edx /* load counter */ pop %esi pop %edi dec %edx /* counter-- */ movl %edx, SUBST(3) /* save counter */ je .2 /* if (counter == 0) goto .2 */ RETCLEAN(4) /* return */ .balign 16 .2: movl $SUBST(4), %eax /* load ctx */ movl %eax, 4(%esp) /* push ctx */ _JMP (SUBST(5)) /* jmp _tnl_wrap_filled_vertex */ GLOBL ( _tnl_x86_Vertex3fv_end ) .align 4 GLOBL ( _tnl_x86_Vertex4fv ) movl 4(%esp), %ecx push %edi push %esi movl SUBST(0), %edi /* load tnl->vtx.vbptr */ movl (%ecx), %edx /* load v[0] */ movl 4(%ecx), %eax /* load v[1] */ movl 8(%ecx), %esi /* load v[2] */ movl 12(%ecx), %ecx /* load v[3] */ movl %edx, (%edi) /* tnl->vtx.vbptr[0] = v[0] */ movl %eax, 4(%edi) /* tnl->vtx.vbptr[1] = v[1] */ movl %esi, 8(%edi) /* tnl->vtx.vbptr[2] = v[2] */ movl %ecx, 12(%edi) /* tnl->vtx.vbptr[3] = v[3] */ addl $16, %edi /* tnl->vtx.vbptr += 4 */ movl $SUBST(1), %ecx /* vertex_size - 4 */ movl $SUBST(2), %esi /* tnl->vtx.vertex + 4 */ repz movsl %ds:(%esi), %es:(%edi) movl %edi, SUBST(0) /* save tnl->vtx.vbptr */ movl SUBST(3), %edx /* load counter */ pop %esi pop %edi dec %edx /* counter-- */ movl %edx, SUBST(3) /* save counter */ je .3 /* if (counter == 0) goto .3 */ RETCLEAN(4) /* return */ .balign 16 .3: movl $SUBST(4), %eax /* load ctx */ movl %eax, 4(%esp) /* push ctx */ _JMP (SUBST(5)) /* jmp _tnl_wrap_filled_vertex */ GLOBL ( _tnl_x86_Vertex4fv_end ) /** * Generic handlers for vector format data. */ GLOBL( _tnl_x86_Attribute1fv ) movl 4(%esp), %ecx movl (%ecx), %eax /* load v[0] */ movl %eax, SUBST(0) /* store v[0] to current vertex */ RETCLEAN(4) GLOBL ( _tnl_x86_Attribute1fv_end ) GLOBL( _tnl_x86_Attribute2fv ) movl 4(%esp), %ecx movl (%ecx), %eax /* load v[0] */ movl 4(%ecx), %edx /* load v[1] */ movl %eax, SUBST(0) /* store v[0] to current vertex */ movl %edx, SUBST(1) /* store v[1] to current vertex */ RETCLEAN(4) GLOBL ( _tnl_x86_Attribute2fv_end ) GLOBL( _tnl_x86_Attribute3fv ) movl 4(%esp), %ecx movl (%ecx), %eax /* load v[0] */ movl 4(%ecx), %edx /* load v[1] */ movl 8(%ecx), %ecx /* load v[2] */ movl %eax, SUBST(0) /* store v[0] to current vertex */ movl %edx, SUBST(1) /* store v[1] to current vertex */ movl %ecx, SUBST(2) /* store v[2] to current vertex */ RETCLEAN(4) GLOBL ( _tnl_x86_Attribute3fv_end ) GLOBL( _tnl_x86_Attribute4fv ) movl 4(%esp), %ecx movl (%ecx), %eax /* load v[0] */ movl 4(%ecx), %edx /* load v[1] */ movl %eax, SUBST(0) /* store v[0] to current vertex */ movl %edx, SUBST(1) /* store v[1] to current vertex */ movl 8(%ecx), %eax /* load v[2] */ movl 12(%ecx), %edx /* load v[3] */ movl %eax, SUBST(2) /* store v[2] to current vertex */ movl %edx, SUBST(3) /* store v[3] to current vertex */ RETCLEAN(4) GLOBL ( _tnl_x86_Attribute4fv_end ) /* Choosers: * * Must generate all of these ahead of first usage. Generate at * compile-time? */ GLOBL( _tnl_x86_choose_fv ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ movl $SUBST(0), (%esp) /* arg 0 - attrib */ movl $SUBST(1), 4(%esp) /* arg 1 - N */ _CALL (SUBST(2)) /* call do_choose */ add $12, %esp /* tear down stack frame */ jmp *%eax /* jump to new func */ GLOBL ( _tnl_x86_choose_fv_end ) /* FIRST LEVEL FUNCTIONS -- these are plugged directly into GL dispatch. * * In the 1st level dispatch functions, switch to a different * calling convention -- (const GLfloat *v) in %ecx. * * As with regular (x86) dispatch, don't create a new stack frame - * just let the 'ret' in the dispatched function return straight * back to the original caller. * * Vertex/Normal/Color, etc: the address of the function pointer * is known at codegen time. */ /* Unfortunately, have to play with the stack in the non-fv case: */ #if !defined (STDCALL_API) GLOBL( _tnl_x86_dispatch_attrf1 ) GLOBL( _tnl_x86_dispatch_attrf2 ) GLOBL( _tnl_x86_dispatch_attrf3 ) GLOBL( _tnl_x86_dispatch_attrf4 ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ leal 16(%esp), %edx /* address of first float on stack */ movl %edx, (%esp) /* save as 'v' */ call *SUBST(0) /* 0x0 --> tabfv[attr][n] */ addl $12, %esp /* tear down frame */ ret /* return */ GLOBL( _tnl_x86_dispatch_attrf4_end ) GLOBL( _tnl_x86_dispatch_attrf3_end ) GLOBL( _tnl_x86_dispatch_attrf2_end ) GLOBL( _tnl_x86_dispatch_attrf1_end ) #else /* defined(STDCALL_API) */ GLOBL( _tnl_x86_dispatch_attrf1 ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ leal 16(%esp), %edx /* address of first float on stack */ movl %edx, (%esp) /* save as 'v' */ call *SUBST(0) /* 0x0 --> tabfv[attr][n] */ addl $8, %esp /* tear down frame (4 shaved off by the callee) */ ret $4 /* return */ GLOBL( _tnl_x86_dispatch_attrf1_end ) GLOBL( _tnl_x86_dispatch_attrf2 ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ leal 16(%esp), %edx /* address of first float on stack */ movl %edx, (%esp) /* save as 'v' */ call *SUBST(0) /* 0x0 --> tabfv[attr][n] */ addl $8, %esp /* tear down frame (4 shaved off by the callee) */ ret $8 /* return */ GLOBL( _tnl_x86_dispatch_attrf2_end ) GLOBL( _tnl_x86_dispatch_attrf3 ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ leal 16(%esp), %edx /* address of first float on stack */ movl %edx, (%esp) /* save as 'v' */ call *SUBST(0) /* 0x0 --> tabfv[attr][n] */ addl $8, %esp /* tear down frame (4 shaved off by the callee) */ ret $12 /* return */ GLOBL( _tnl_x86_dispatch_attrf3_end ) GLOBL( _tnl_x86_dispatch_attrf4 ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ leal 16(%esp), %edx /* address of first float on stack */ movl %edx, (%esp) /* save as 'v' */ call *SUBST(0) /* 0x0 --> tabfv[attr][n] */ addl $8, %esp /* tear down frame (4 shaved off by the callee) */ ret $16 /* return */ GLOBL( _tnl_x86_dispatch_attrf4_end ) #endif /* defined(STDCALL_API) */ /* The fv case is simpler: */ GLOBL( _tnl_x86_dispatch_attrfv ) jmp *SUBST(0) /* 0x0 --> tabfv[attr][n] */ GLOBL( _tnl_x86_dispatch_attrfv_end ) /* MultiTexcoord: the address of the function pointer must be * calculated, but can use the index argument slot to hold 'v', and * avoid setting up a new stack frame. * * [dBorca] * right, this would be the preferred approach, but gcc does not * clean up the stack after each function call when optimizing (-fdefer-pop); * can it make assumptions about what's already on the stack? I dunno, * but in this case, we can't mess with the caller's stack frame, and * we must use a model like `_x86_dispatch_attrfv' above. Caveat emptor! */ /* Also, will only need a maximum of four of each of these per context: */ #if !defined (STDCALL_API) GLOBL( _tnl_x86_dispatch_multitexcoordf1 ) GLOBL( _tnl_x86_dispatch_multitexcoordf2 ) GLOBL( _tnl_x86_dispatch_multitexcoordf3 ) GLOBL( _tnl_x86_dispatch_multitexcoordf4 ) movl 4(%esp), %ecx leal 8(%esp), %edx andl $7, %ecx movl %edx, 4(%esp) sall $4, %ecx jmp *SUBST(0)(%ecx) /* 0x0 - tabfv[tex0][n] */ GLOBL( _tnl_x86_dispatch_multitexcoordf4_end ) GLOBL( _tnl_x86_dispatch_multitexcoordf3_end ) GLOBL( _tnl_x86_dispatch_multitexcoordf2_end ) GLOBL( _tnl_x86_dispatch_multitexcoordf1_end ) GLOBL( _tnl_x86_dispatch_multitexcoordfv ) movl 4(%esp), %ecx movl 8(%esp), %edx andl $7, %ecx movl %edx, 4(%esp) sall $4, %ecx jmp *SUBST(0)(%ecx) /* 0x0 - tabfv[tex0][n] */ GLOBL( _tnl_x86_dispatch_multitexcoordfv_end ) #else /* defined (STDCALL_API) */ GLOBL( _tnl_x86_dispatch_multitexcoordf1 ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ movl 16(%esp), %ecx leal 20(%esp), %edx andl $7, %ecx movl %edx, (%esp) sall $4, %ecx call *SUBST(0)(%ecx) /* 0x0 - tabfv[tex0][n] */ addl $8, %esp /* tear down frame (4 shaved off by the callee) */ ret $8 /* return */ GLOBL( _tnl_x86_dispatch_multitexcoordf1_end ) GLOBL( _tnl_x86_dispatch_multitexcoordf2 ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ movl 16(%esp), %ecx leal 20(%esp), %edx andl $7, %ecx movl %edx, (%esp) sall $4, %ecx call *SUBST(0)(%ecx) /* 0x0 - tabfv[tex0][n] */ addl $8, %esp /* tear down frame (4 shaved off by the callee) */ ret $12 /* return */ GLOBL( _tnl_x86_dispatch_multitexcoordf2_end ) GLOBL( _tnl_x86_dispatch_multitexcoordf3 ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ movl 16(%esp), %ecx leal 20(%esp), %edx andl $7, %ecx movl %edx, (%esp) sall $4, %ecx call *SUBST(0)(%ecx) /* 0x0 - tabfv[tex0][n] */ addl $8, %esp /* tear down frame (4 shaved off by the callee) */ ret $16 /* return */ GLOBL( _tnl_x86_dispatch_multitexcoordf3_end ) GLOBL( _tnl_x86_dispatch_multitexcoordf4 ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ movl 16(%esp), %ecx leal 20(%esp), %edx andl $7, %ecx movl %edx, (%esp) sall $4, %ecx call *SUBST(0)(%ecx) /* 0x0 - tabfv[tex0][n] */ addl $8, %esp /* tear down frame (4 shaved off by the callee) */ ret $20 /* return */ GLOBL( _tnl_x86_dispatch_multitexcoordf4_end ) GLOBL( _tnl_x86_dispatch_multitexcoordfv ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ movl 16(%esp), %ecx movl 20(%esp), %edx andl $7, %ecx movl %edx, (%esp) sall $4, %ecx call *SUBST(0)(%ecx) /* 0x0 - tabfv[tex0][n] */ addl $8, %esp /* tear down frame (4 shaved off by the callee) */ ret $8 /* return */ GLOBL( _tnl_x86_dispatch_multitexcoordfv_end ) #endif /* defined (STDCALL_API) */ /* VertexAttrib: the address of the function pointer must be * calculated. */ #if !defined (STDCALL_API) GLOBL( _tnl_x86_dispatch_vertexattribf1 ) GLOBL( _tnl_x86_dispatch_vertexattribf2 ) GLOBL( _tnl_x86_dispatch_vertexattribf3 ) GLOBL( _tnl_x86_dispatch_vertexattribf4 ) movl 4(%esp), %eax cmpl $16, %eax jb .8 /* "cmovge" is not supported on all CPUs */ movl $16, %eax .8: leal 8(%esp), %ecx /* calculate 'v' */ movl %ecx, 4(%esp) /* save in 1st arg slot */ sall $4, %eax jmp *SUBST(0)(%eax) /* 0x0 - tabfv[0][n] */ GLOBL( _tnl_x86_dispatch_vertexattribf4_end ) GLOBL( _tnl_x86_dispatch_vertexattribf3_end ) GLOBL( _tnl_x86_dispatch_vertexattribf2_end ) GLOBL( _tnl_x86_dispatch_vertexattribf1_end ) GLOBL( _tnl_x86_dispatch_vertexattribfv ) movl 4(%esp), %eax cmpl $16, %eax jb .9 /* "cmovge" is not supported on all CPUs */ movl $16, %eax .9: movl 8(%esp), %ecx /* load 'v' */ movl %ecx, 4(%esp) /* save in 1st arg slot */ sall $4, %eax jmp *SUBST(0)(%eax) /* 0x0 - tabfv[0][n] */ GLOBL( _tnl_x86_dispatch_vertexattribfv_end ) #else /* defined (STDCALL_API) */ GLOBL( _tnl_x86_dispatch_vertexattribf1 ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ movl 16(%esp), %eax cmpl $16, %eax jb .81 /* "cmovge" is not supported on all CPUs */ movl $16, %eax .81: leal 20(%esp), %ecx /* load 'v' */ movl %ecx, (%esp) /* save in 1st arg slot */ sall $4, %eax call *SUBST(0)(%eax) /* 0x0 - tabfv[0][n] */ addl $8, %esp /* tear down frame (4 shaved off by the callee) */ ret $8 /* return */ GLOBL( _tnl_x86_dispatch_vertexattribf1_end ) GLOBL( _tnl_x86_dispatch_vertexattribf2 ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ movl 16(%esp), %eax cmpl $16, %eax jb .82 /* "cmovge" is not supported on all CPUs */ movl $16, %eax .82: leal 20(%esp), %ecx /* load 'v' */ movl %ecx, (%esp) /* save in 1st arg slot */ sall $4, %eax call *SUBST(0)(%eax) /* 0x0 - tabfv[0][n] */ addl $8, %esp /* tear down frame (4 shaved off by the callee) */ ret $12 /* return */ GLOBL( _tnl_x86_dispatch_vertexattribf2_end ) GLOBL( _tnl_x86_dispatch_vertexattribf3 ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ movl 16(%esp), %eax cmpl $16, %eax jb .83 /* "cmovge" is not supported on all CPUs */ movl $16, %eax .83: leal 20(%esp), %ecx /* load 'v' */ movl %ecx, (%esp) /* save in 1st arg slot */ sall $4, %eax call *SUBST(0)(%eax) /* 0x0 - tabfv[0][n] */ addl $8, %esp /* tear down frame (4 shaved off by the callee) */ ret $16 /* return */ GLOBL( _tnl_x86_dispatch_vertexattribf3_end ) GLOBL( _tnl_x86_dispatch_vertexattribf4 ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ movl 16(%esp), %eax cmpl $16, %eax jb .84 /* "cmovge" is not supported on all CPUs */ movl $16, %eax .84: leal 20(%esp), %ecx /* load 'v' */ movl %ecx, (%esp) /* save in 1st arg slot */ sall $4, %eax call *SUBST(0)(%eax) /* 0x0 - tabfv[0][n] */ addl $8, %esp /* tear down frame (4 shaved off by the callee) */ ret $20 /* return */ GLOBL( _tnl_x86_dispatch_vertexattribf4_end ) GLOBL( _tnl_x86_dispatch_vertexattribfv ) subl $12, %esp /* gcc does 16 byte alignment of stack frames? */ movl 16(%esp), %eax cmpl $16, %eax jb .9 /* "cmovge" is not supported on all CPUs */ movl $16, %eax .9: movl 20(%esp), %ecx /* load 'v' */ movl %ecx, (%esp) /* save in 1st arg slot */ sall $4, %eax call *SUBST(0)(%eax) /* 0x0 - tabfv[0][n] */ addl $8, %esp /* tear down frame (4 shaved off by the callee) */ ret $8 /* return */ GLOBL( _tnl_x86_dispatch_vertexattribfv_end ) #endif /* defined (STDCALL_API) */ nx-libs-3.5.99.23/nx-X11/Imakefile0000644000000000000000000001106213614532331013114 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /**************************************************************************/ #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" RELEASE = XOrgReleaseString #ifndef OSName #define OSName Unknown Operating System! #endif SUBDIRS = include config programs #if HasParallelMake #ifdef ParallelDefines TOPPARALLELMFLAGS = TopParallelDefines #endif #endif MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #define IHaveSpecialMakefileTarget #if !defined(Win32Architecture) || defined(mingwArchitecture) VerifyOS:: @echo "" @echo Building on OSName "("OSMajorVersion"."OSMinorVersion"."OSTeenyVersion")." @echo "" #ifdef LinuxArchitecture VerifyOS:: @echo Linux Distribution: LinuxDistName @echo libc version: LinuxCLibMajorVersion"."LinuxCLibMinorVersion"."LinuxCLibTeenyVersion @echo binutils version: `expr LinuxBinUtilsMajorVersion / 10`.`expr LinuxBinUtilsMajorVersion % 10` @echo "" #endif #if defined(GccMajorVersion) && defined(GccMinorVersion) VerifyOS:: @echo GCC version: GccMajorVersion"."GccMinorVersion @echo "" #endif includes:: MakeDir($(BUILDINCDIR)) MakeDir($(BUILDBINDIR)) XCOMM XCOMM Watch out!!! Make sure you do make includes after removing X11.... XCOMM clean:: $(RM) -r $(BUILDINCDIR) $(RM) -r $(BUILDLIBDIR) $(RM) -r $(BUILDBINDIR) MAKE_OPTS = -f xmakefile World:: $(MAKE) $(MFLAGS) $(MAKE_OPTS) $(TOPPARALLELMFLAGS) all Everything:: @echo "" @echo Rebuilding $(RELEASE) of the X Window System. @echo "" @date @echo "" -$(RM) xmakefile.bak; $(MV) xmakefile xmakefile.bak $(MAKE) $(MFLAGS) xmakefile $(MAKE) $(MFLAGS) $(MAKE_OPTS) Makefiles $(MAKE) $(MFLAGS) $(MAKE_OPTS) includes $(MAKE) $(MFLAGS) $(MAKE_OPTS) depend $(MAKE) $(MFLAGS) $(MAKE_OPTS) $(WORLDOPTS) @echo "" @date @echo "" @echo Rebuild of $(RELEASE) of the X Window System complete. @echo "" XCOMM clean out link tree looking for stuff that should get checked in dangerous_strip_clean:: $(MAKE) -k distclean find . -type l -exec rm {} \; find . \( \! -type d \) -print #else /* not Win32Architecture else */ VerifyOS:: @echo : @echo Building on OSName. @echo : includes:: MakeDir($(BUILDINCDIR:/=\)) XCOMM XCOMM Watch out!!! Make sure you do make includes after removing X11.... XCOMM clean:: RmTreeCmd $(BUILDINCDIR:/=\) RmTreeCmd $(BUILDLIBDIR:/=\) Everything:: @echo : @echo Rebuilding $(RELEASE) of the X Window System. @echo : @echo : RMoveToBakFile(xmakefile) $(MAKE) $(MFLAGS) xmakefile $(MAKE) $(MFLAGS) $(MAKE_OPTS) Makefiles $(MAKE) $(MFLAGS) $(MAKE_OPTS) includes $(MAKE) $(MFLAGS) $(MAKE_OPTS) depend $(MAKE) $(MFLAGS) $(MAKE_OPTS) $(WORLDOPTS) @echo : @echo : @echo Rebuild of $(RELEASE) of the X Window System complete. @echo : #ifdef ProjectRoot install:: MakeDir($(PROJECTROOT:/=\)) #endif install:: MakeDir($(INCROOT:/=\)) MakeDir($(USRLIBDIR:/=\)) MakeDir($(LIBDIR:/=\)) #endif /* not Win32Architecture else */ XCOMM special target to determine if the xmakefile exists. XCOMM Works on both Unix and NMAKE.EXE xmakefile-exists:: #ifndef MakeManKeywords #define MakeManKeywords YES /* install.man rebuilds "man -k" database? */ #endif #ifndef MakeHtmlManIndex #define MakeHtmlManIndex YES /* install.man generates HTML man page index */ #endif nx-libs-3.5.99.23/nx-X11/include/DECkeysym.h0000644000000000000000000000540413614532331014737 0ustar /*********************************************************** Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* * DEC private keysyms * (29th bit set) */ /* two-key compose sequence initiators, chosen to map to Latin1 characters */ #define DXK_ring_accent 0x1000FEB0 #define DXK_circumflex_accent 0x1000FE5E #define DXK_cedilla_accent 0x1000FE2C #define DXK_acute_accent 0x1000FE27 #define DXK_grave_accent 0x1000FE60 #define DXK_tilde 0x1000FE7E #define DXK_diaeresis 0x1000FE22 /* special keysym for LK2** "Remove" key on editing keypad */ #define DXK_Remove 0x1000FF00 /* Remove */ nx-libs-3.5.99.23/nx-X11/include/extensions/bigreqstr.h0000644000000000000000000000365713614532331017313 0ustar /* Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* $XFree86$ */ #ifndef _BIGREQSTR_H_ #define _BIGREQSTR_H_ #define X_BigReqEnable 0 #define XBigReqNumberEvents 0 #define XBigReqNumberErrors 0 #define XBigReqExtensionName "BIG-REQUESTS" typedef struct { CARD8 reqType; /* always XBigReqCode */ CARD8 brReqType; /* always X_BigReqEnable */ CARD16 length B16; } xBigReqEnableReq; #define sz_xBigReqEnableReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 max_request_size B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xBigReqEnableReply; #define sz_xBigReqEnableReply 32 typedef struct { CARD8 reqType; CARD8 data; CARD16 zero B16; CARD32 length B32; } xBigReq; #endif /* _BIGREQSTR_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/composite.h0000644000000000000000000000372413614532331017306 0ustar /* * $Id: composite.h,v 1.2 2004/07/31 06:16:50 anholt Exp $ * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _COMPOSITE_H_ #define _COMPOSITE_H_ #include #define COMPOSITE_NAME "Composite" #define COMPOSITE_MAJOR 0 #define COMPOSITE_MINOR 4 #define CompositeRedirectAutomatic 0 #define CompositeRedirectManual 1 #define X_CompositeQueryVersion 0 #define X_CompositeRedirectWindow 1 #define X_CompositeRedirectSubwindows 2 #define X_CompositeUnredirectWindow 3 #define X_CompositeUnredirectSubwindows 4 #define X_CompositeCreateRegionFromBorderClip 5 #define X_CompositeNameWindowPixmap 6 #define X_CompositeGetOverlayWindow 7 #define X_CompositeReleaseOverlayWindow 8 #define CompositeNumberRequests (X_CompositeReleaseOverlayWindow + 1) #define CompositeNumberEvents 0 #endif /* _COMPOSITE_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/compositeproto.h0000644000000000000000000001063113614532331020365 0ustar /* * $Id: compositeproto.h,v 1.2 2004/07/31 06:16:50 anholt Exp $ * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _COMPOSITEPROTO_H_ #define _COMPOSITEPROTO_H_ #include #include #define Window CARD32 #define Region CARD32 #define Pixmap CARD32 /* * requests and replies */ typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xCompositeQueryVersionReq; #define sz_xCompositeQueryVersionReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xCompositeQueryVersionReply; #define sz_xCompositeQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; Window window B32; CARD8 update; CARD8 pad1; CARD16 pad2 B16; } xCompositeRedirectWindowReq; #define sz_xCompositeRedirectWindowReq 12 typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; Window window B32; CARD8 update; CARD8 pad1; CARD16 pad2 B16; } xCompositeRedirectSubwindowsReq; #define sz_xCompositeRedirectSubwindowsReq 12 typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; Window window B32; CARD8 update; CARD8 pad1; CARD16 pad2 B16; } xCompositeUnredirectWindowReq; #define sz_xCompositeUnredirectWindowReq 12 typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; Window window B32; CARD8 update; CARD8 pad1; CARD16 pad2 B16; } xCompositeUnredirectSubwindowsReq; #define sz_xCompositeUnredirectSubwindowsReq 12 typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; Region region B32; Window window B32; } xCompositeCreateRegionFromBorderClipReq; #define sz_xCompositeCreateRegionFromBorderClipReq 12 /* Version 0.2 additions */ typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length; Window window B32; Pixmap pixmap B32; } xCompositeNameWindowPixmapReq; #define sz_xCompositeNameWindowPixmapReq 12 /* Version 0.3 additions */ typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; Window window B32; } xCompositeGetOverlayWindowReq; #define sz_xCompositeGetOverlayWindowReq sizeof(xCompositeGetOverlayWindowReq) typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; Window overlayWin B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xCompositeGetOverlayWindowReply; #define sz_xCompositeGetOverlayWindowReply sizeof(xCompositeGetOverlayWindowReply) typedef struct { CARD8 reqType; CARD8 compositeReqType; CARD16 length B16; Window window B32; } xCompositeReleaseOverlayWindowReq; #define sz_xCompositeReleaseOverlayWindowReq sizeof(xCompositeReleaseOverlayWindowReq) #undef Window #undef Region #undef Pixmap #endif /* _COMPOSITEPROTO_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/damageproto.h0000644000000000000000000000700513614532331017602 0ustar /* * $Id: damageproto.h,v 1.2 2004/07/29 19:29:55 stukreit Exp $ * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _DAMAGEPROTO_H_ #define _DAMAGEPROTO_H_ #include #include #include #define Window CARD32 #define Drawable CARD32 #define Font CARD32 #define Pixmap CARD32 #define Cursor CARD32 #define Colormap CARD32 #define GContext CARD32 #define Atom CARD32 #define VisualID CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define Picture CARD32 #define Region CARD32 #define Damage CARD32 /************** Version 0 ******************/ typedef struct { CARD8 reqType; CARD8 damageReqType; CARD16 length B16; } xDamageReq; /* * requests and replies */ typedef struct { CARD8 reqType; CARD8 damageReqType; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xDamageQueryVersionReq; #define sz_xDamageQueryVersionReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDamageQueryVersionReply; #define sz_xDamageQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 damageReqType; CARD16 length B16; Damage damage B32; Drawable drawable B32; CARD8 level; CARD8 pad1; CARD16 pad2 B16; } xDamageCreateReq; #define sz_xDamageCreateReq 16 typedef struct { CARD8 reqType; CARD8 damageReqType; CARD16 length B16; Damage damage B32; } xDamageDestroyReq; #define sz_xDamageDestroyReq 8 typedef struct { CARD8 reqType; CARD8 damageReqType; CARD16 length B16; Damage damage B32; Region repair B32; Region parts B32; } xDamageSubtractReq; #define sz_xDamageSubtractReq 16 /* Events */ #define DamageNotifyMore 0x80 typedef struct { CARD8 type; CARD8 level; CARD16 sequenceNumber B16; Drawable drawable B32; Damage damage B32; Time timestamp B32; xRectangle area; xRectangle geometry; } xDamageNotifyEvent; #undef Damage #undef Region #undef Picture #undef Window #undef Drawable #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef Atom #undef VisualID #undef Time #undef KeyCode #undef KeySym #endif /* _DAMAGEPROTO_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/damagewire.h0000644000000000000000000000362313614532331017407 0ustar /* * $Id: damagewire.h,v 1.2 2004/07/29 19:29:55 stukreit Exp $ * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _DAMAGEWIRE_H_ #define _DAMAGEWIRE_H_ #define DAMAGE_NAME "DAMAGE" #define DAMAGE_MAJOR 1 #define DAMAGE_MINOR 0 /************* Version 1 ****************/ /* Constants */ #define XDamageReportRawRectangles 0 #define XDamageReportDeltaRectangles 1 #define XDamageReportBoundingBox 2 #define XDamageReportNonEmpty 3 /* Requests */ #define X_DamageQueryVersion 0 #define X_DamageCreate 1 #define X_DamageDestroy 2 #define X_DamageSubtract 3 #define XDamageNumberRequests (X_DamageSubtract + 1) /* Events */ #define XDamageNotify 0 #define XDamageNumberEvents (XDamageNotify + 1) /* Errors */ #define BadDamage 0 #define XDamageNumberErrors (BadDamage + 1) #endif /* _DAMAGEWIRE_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/dpms.h0000644000000000000000000000446013614532331016245 0ustar /***************************************************************** Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #ifndef _X11_EXTENSIONS_DPMS_H #define _X11_EXTENSIONS_DPMS_H 1 /* * HISTORY */ /* * @(#)RCSfile: dpms.h,v Revision: 1.1.4.2 (DEC) Date: 1995/11/21 19:34:17 */ #define DPMSModeOn 0 #define DPMSModeStandby 1 #define DPMSModeSuspend 2 #define DPMSModeOff 3 #ifndef DPMS_SERVER #include #include _XFUNCPROTOBEGIN extern Bool DPMSQueryExtension(Display *, int *, int *); extern Status DPMSGetVersion(Display *, int *, int *); extern Bool DPMSCapable(Display *); extern Status DPMSSetTimeouts(Display *, CARD16, CARD16, CARD16); extern Bool DPMSGetTimeouts(Display *, CARD16 *, CARD16 *, CARD16 *); extern Status DPMSEnable(Display *); extern Status DPMSDisable(Display *); extern Status DPMSForceLevel(Display *, CARD16); extern Status DPMSInfo(Display *, CARD16 *, BOOL *); _XFUNCPROTOEND #endif /* !DPMS_SERVER */ #endif /* !_X11_EXTENSIONS_DPMS_H */ nx-libs-3.5.99.23/nx-X11/include/extensions/dpmsstr.h0000644000000000000000000001170313614532331016774 0ustar /***************************************************************** Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* $XFree86$ */ /* * HISTORY */ /* * @(#)RCSfile: dpmsstr.h,v Revision: 1.1.4.2 (DEC) Date: 1995/11/21 19:34:19 */ #ifndef _DPMSSTR_H_ #define _DPMSSTR_H_ #define X_DPMSGetVersion 0 #define X_DPMSCapable 1 #define X_DPMSGetTimeouts 2 #define X_DPMSSetTimeouts 3 #define X_DPMSEnable 4 #define X_DPMSDisable 5 #define X_DPMSForceLevel 6 #define X_DPMSInfo 7 #define DPMSNumberEvents 0 #define DPMSNumberErrors 0 #define DPMSMajorVersion 1 #define DPMSMinorVersion 1 #define DPMSExtensionName "DPMS" typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSGetVersion */ CARD16 length B16; CARD16 majorVersion B16; CARD16 minorVersion B16; } xDPMSGetVersionReq; #define sz_xDPMSGetVersionReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDPMSGetVersionReply; #define sz_xDPMSGetVersionReply 32 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSCapable */ CARD16 length B16; } xDPMSCapableReq; #define sz_xDPMSCapableReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; BOOL capable; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xDPMSCapableReply; #define sz_xDPMSCapableReply 32 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSGetTimeouts */ CARD16 length B16; } xDPMSGetTimeoutsReq; #define sz_xDPMSGetTimeoutsReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 standby B16; CARD16 suspend B16; CARD16 off B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDPMSGetTimeoutsReply; #define sz_xDPMSGetTimeoutsReply 32 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSSetTimeouts */ CARD16 length B16; CARD16 standby B16; CARD16 suspend B16; CARD16 off B16; CARD16 pad0 B16; } xDPMSSetTimeoutsReq; #define sz_xDPMSSetTimeoutsReq 12 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSEnable */ CARD16 length B16; } xDPMSEnableReq; #define sz_xDPMSEnableReq 4 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSDisable */ CARD16 length B16; } xDPMSDisableReq; #define sz_xDPMSDisableReq 4 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSForceLevel */ CARD16 length B16; CARD16 level B16; /* power level requested */ CARD16 pad0 B16; } xDPMSForceLevelReq; #define sz_xDPMSForceLevelReq 8 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSInfo */ CARD16 length B16; } xDPMSInfoReq; #define sz_xDPMSInfoReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 power_level B16; BOOL state; CARD8 pad1; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xDPMSInfoReply; #define sz_xDPMSInfoReply 32 #endif /* _DPMSSTR_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/Imakefile0000644000000000000000000000405613614532331016743 0ustar NULL = #if BuildScreenSaverExt SCREENSAVERHEADERS = saver.h saverproto.h scrnsaver.h #endif #if BuildXF86BigfontExt XF86BIGFONTHEADERS = xf86bigfont.h xf86bigfproto.h #endif #if BuildXvExt XVHEADERS = Xv.h Xvproto.h XVMCHEADERS = XvMC.h XvMCproto.h #endif #if BuildXinerama XINERAMAHEADERS = panoramiXext.h panoramiXproto.h #endif #if BuildRandR RANDRHEADERS = randr.h randrproto.h #endif #if BuildRender RENDERHEADERS = render.h renderproto.h #endif #if BuildXfixes XFIXESHEADERS = xfixeswire.h xfixesproto.h #endif #if BuildComposite COMPOSITEHEADERS = composite.h compositeproto.h #endif #if BuildDamage DAMAGEHEADERS = damagewire.h damageproto.h #endif #if BuildXResExt XRESHEADERS = XResproto.h #endif XKBFILEHEADERS = XKMformat.h XKM.h XKBconfig.h XKBfile.h XKBrules.h EXTRAHEADERS = \ $(SCREENSAVERHEADERS) \ $(XINERAMAHEADERS) \ $(XF86BIGFONTHEADERS) \ $(XVHEADERS) \ $(XVMCHEADERS) \ $(RANDRHEADERS) \ $(RENDERHEADERS) \ $(XFIXESHEADERS) \ $(COMPOSITEHEADERS) \ $(DAMAGEHEADERS) \ $(XRESHEADERS) \ $(XKBFILEHEADERS) \ $(NULL) HEADERS = \ xcmiscstr.h \ bigreqstr.h \ XI.h XIproto.h \ xtestconst.h xteststr.h \ XKB.h XKBgeom.h XKBproto.h XKBstr.h XKBsrv.h \ Xdbeproto.h \ $(EXTRAHEADERS) \ record.h recordstr.h \ security.h securstr.h \ sync.h syncstr.h \ dpms.h dpmsstr.h \ shapeconst.h \ $(NULL) all:: BuildIncludes($(HEADERS),nx-X11/extensions,../..) #if BuildLibraries InstallMultipleFlags($(HEADERS),$(INCDIR)/nx-X11/extensions,$(INSTINCFLAGS)) #endif InstallDriverSDKNonExecFile(XI.h,$(DRIVERSDKINCLUDEDIR)/extensions) InstallDriverSDKNonExecFile(XIproto.h,$(DRIVERSDKINCLUDEDIR)/extensions) InstallDriverSDKNonExecFile(Xv.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xvproto.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(dpms.h,$(DRIVERSDKINCLUDEDIR)/extensions) InstallDriverSDKNonExecFile(renderproto.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xv.h,$(DRIVERSDKINCLUDEDIR)/extensions) InstallDriverSDKNonExecFile(XvMC.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xv.h,$(DRIVERSDKINCLUDEDIR)/X11/extensions) nx-libs-3.5.99.23/nx-X11/include/extensions/panoramiXext.h0000644000000000000000000000414613614532331017762 0ustar /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* * PanoramiX definitions */ /* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ #define PANORAMIX_MAJOR_VERSION 1 /* current version number */ #define PANORAMIX_MINOR_VERSION 1 typedef struct { Window window; /* PanoramiX window - may not exist */ int screen; int State; /* PanroamiXOff, PanoramiXOn */ int width; /* width of this screen */ int height; /* height of this screen */ int ScreenCount; /* real physical number of screens */ XID eventMask; /* selected events for this client */ } XPanoramiXInfo; extern XPanoramiXInfo *XPanoramiXAllocInfo ( void ); nx-libs-3.5.99.23/nx-X11/include/extensions/panoramiXproto.h0000644000000000000000000001275413614532331020331 0ustar /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ #ifndef _PANORAMIXPROTO_H_ #define _PANORAMIXPROTO_H_ #define PANORAMIX_PROTOCOL_NAME "XINERAMA" #define X_PanoramiXQueryVersion 0 #define X_PanoramiXGetState 1 #define X_PanoramiXGetScreenCount 2 #define X_PanoramiXGetScreenSize 3 #define X_XineramaIsActive 4 #define X_XineramaQueryScreens 5 typedef struct _PanoramiXQueryVersion { CARD8 reqType; /* always PanoramiXReqCode */ CARD8 panoramiXReqType; /* always X_PanoramiXQueryVersion */ CARD16 length B16; CARD8 clientMajor; CARD8 clientMinor; CARD16 unused B16; } xPanoramiXQueryVersionReq; #define sz_xPanoramiXQueryVersionReq 8 typedef struct { CARD8 type; /* must be X_Reply */ CARD8 pad1; /* unused */ CARD16 sequenceNumber B16; /* last sequence number */ CARD32 length B32; /* 0 */ CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad2 B32; /* unused */ CARD32 pad3 B32; /* unused */ CARD32 pad4 B32; /* unused */ CARD32 pad5 B32; /* unused */ CARD32 pad6 B32; /* unused */ } xPanoramiXQueryVersionReply; #define sz_xPanoramiXQueryVersionReply 32 typedef struct _PanoramiXGetState { CARD8 reqType; /* always PanoramiXReqCode */ CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ CARD16 length B16; CARD32 window B32; } xPanoramiXGetStateReq; #define sz_xPanoramiXGetStateReq 8 typedef struct { BYTE type; BYTE state; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 window B32; CARD32 pad1 B32; /* unused */ CARD32 pad2 B32; /* unused */ CARD32 pad3 B32; /* unused */ CARD32 pad4 B32; /* unused */ CARD32 pad5 B32; /* unused */ } xPanoramiXGetStateReply; #define sz_panoramiXGetStateReply 32 typedef struct _PanoramiXGetScreenCount { CARD8 reqType; /* always PanoramiXReqCode */ CARD8 panoramiXReqType; /* always X_PanoramiXGetScreenCount */ CARD16 length B16; CARD32 window B32; } xPanoramiXGetScreenCountReq; #define sz_xPanoramiXGetScreenCountReq 8 typedef struct { BYTE type; BYTE ScreenCount; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 window B32; CARD32 pad1 B32; /* unused */ CARD32 pad2 B32; /* unused */ CARD32 pad3 B32; /* unused */ CARD32 pad4 B32; /* unused */ CARD32 pad5 B32; /* unused */ } xPanoramiXGetScreenCountReply; #define sz_panoramiXGetScreenCountReply 32 typedef struct _PanoramiXGetScreenSize { CARD8 reqType; /* always PanoramiXReqCode */ CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ CARD16 length B16; CARD32 window B32; CARD32 screen B32; } xPanoramiXGetScreenSizeReq; #define sz_xPanoramiXGetScreenSizeReq 12 typedef struct { BYTE type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 width B32; CARD32 height B32; CARD32 window B32; CARD32 screen B32; CARD32 pad2 B32; /* unused */ CARD32 pad3 B32; /* unused */ } xPanoramiXGetScreenSizeReply; #define sz_panoramiXGetScreenSizeReply 32 /************ Alternate protocol ******************/ typedef struct { CARD8 reqType; CARD8 panoramiXReqType; CARD16 length B16; } xXineramaIsActiveReq; #define sz_xXineramaIsActiveReq 4 typedef struct { BYTE type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 state B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXineramaIsActiveReply; #define sz_XineramaIsActiveReply 32 typedef struct { CARD8 reqType; CARD8 panoramiXReqType; CARD16 length B16; } xXineramaQueryScreensReq; #define sz_xXineramaQueryScreensReq 4 typedef struct { BYTE type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 number B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXineramaQueryScreensReply; #define sz_XineramaQueryScreensReply 32 typedef struct { INT16 x_org B16; INT16 y_org B16; CARD16 width B16; CARD16 height B16; } xXineramaScreenInfo; #define sz_XineramaScreenInfo 8 #endif nx-libs-3.5.99.23/nx-X11/include/extensions/randr.h0000644000000000000000000001500413614532331016404 0ustar /* * Copyright © 2000 Compaq Computer Corporation * Copyright © 2002 Hewlett Packard Company * Copyright © 2006 Intel Corporation * Copyright © 2008 Red Hat, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc. * Keith Packard, Intel Corporation */ #ifndef _RANDR_H_ #define _RANDR_H_ typedef unsigned short Rotation; typedef unsigned short SizeID; typedef unsigned short SubpixelOrder; typedef unsigned short Connection; typedef unsigned short XRandrRotation; typedef unsigned short XRandrSizeID; typedef unsigned short XRandrSubpixelOrder; typedef unsigned long XRandrModeFlags; #define RANDR_NAME "RANDR" #define RANDR_MAJOR 1 #define RANDR_MINOR 5 #define RRNumberErrors 4 #define RRNumberEvents 2 #define RRNumberRequests 45 #define X_RRQueryVersion 0 /* we skip 1 to make old clients fail pretty immediately */ #define X_RROldGetScreenInfo 1 #define X_RR1_0SetScreenConfig 2 /* V1.0 apps share the same set screen config request id */ #define X_RRSetScreenConfig 2 #define X_RROldScreenChangeSelectInput 3 /* 3 used to be ScreenChangeSelectInput; deprecated */ #define X_RRSelectInput 4 #define X_RRGetScreenInfo 5 /* V1.2 additions */ #define X_RRGetScreenSizeRange 6 #define X_RRSetScreenSize 7 #define X_RRGetScreenResources 8 #define X_RRGetOutputInfo 9 #define X_RRListOutputProperties 10 #define X_RRQueryOutputProperty 11 #define X_RRConfigureOutputProperty 12 #define X_RRChangeOutputProperty 13 #define X_RRDeleteOutputProperty 14 #define X_RRGetOutputProperty 15 #define X_RRCreateMode 16 #define X_RRDestroyMode 17 #define X_RRAddOutputMode 18 #define X_RRDeleteOutputMode 19 #define X_RRGetCrtcInfo 20 #define X_RRSetCrtcConfig 21 #define X_RRGetCrtcGammaSize 22 #define X_RRGetCrtcGamma 23 #define X_RRSetCrtcGamma 24 /* V1.3 additions */ #define X_RRGetScreenResourcesCurrent 25 #define X_RRSetCrtcTransform 26 #define X_RRGetCrtcTransform 27 #define X_RRGetPanning 28 #define X_RRSetPanning 29 #define X_RRSetOutputPrimary 30 #define X_RRGetOutputPrimary 31 #define RRTransformUnit (1L << 0) #define RRTransformScaleUp (1L << 1) #define RRTransformScaleDown (1L << 2) #define RRTransformProjective (1L << 3) /* v1.4 */ #define X_RRGetProviders 32 #define X_RRGetProviderInfo 33 #define X_RRSetProviderOffloadSink 34 #define X_RRSetProviderOutputSource 35 #define X_RRListProviderProperties 36 #define X_RRQueryProviderProperty 37 #define X_RRConfigureProviderProperty 38 #define X_RRChangeProviderProperty 39 #define X_RRDeleteProviderProperty 40 #define X_RRGetProviderProperty 41 /* v1.5 */ #define X_RRGetMonitors 42 #define X_RRSetMonitor 43 #define X_RRDeleteMonitor 44 /* Event selection bits */ #define RRScreenChangeNotifyMask (1L << 0) /* V1.2 additions */ #define RRCrtcChangeNotifyMask (1L << 1) #define RROutputChangeNotifyMask (1L << 2) #define RROutputPropertyNotifyMask (1L << 3) /* V1.4 additions */ #define RRProviderChangeNotifyMask (1L << 4) #define RRProviderPropertyNotifyMask (1L << 5) #define RRResourceChangeNotifyMask (1L << 6) /* Event codes */ #define RRScreenChangeNotify 0 /* V1.2 additions */ #define RRNotify 1 /* RRNotify Subcodes */ #define RRNotify_CrtcChange 0 #define RRNotify_OutputChange 1 #define RRNotify_OutputProperty 2 #define RRNotify_ProviderChange 3 #define RRNotify_ProviderProperty 4 #define RRNotify_ResourceChange 5 /* used in the rotation field; rotation and reflection in 0.1 proto. */ #define RR_Rotate_0 1 #define RR_Rotate_90 2 #define RR_Rotate_180 4 #define RR_Rotate_270 8 /* new in 1.0 protocol, to allow reflection of screen */ #define RR_Reflect_X 16 #define RR_Reflect_Y 32 #define RRSetConfigSuccess 0 #define RRSetConfigInvalidConfigTime 1 #define RRSetConfigInvalidTime 2 #define RRSetConfigFailed 3 /* new in 1.2 protocol */ #define RR_HSyncPositive 0x00000001 #define RR_HSyncNegative 0x00000002 #define RR_VSyncPositive 0x00000004 #define RR_VSyncNegative 0x00000008 #define RR_Interlace 0x00000010 #define RR_DoubleScan 0x00000020 #define RR_CSync 0x00000040 #define RR_CSyncPositive 0x00000080 #define RR_CSyncNegative 0x00000100 #define RR_HSkewPresent 0x00000200 #define RR_BCast 0x00000400 #define RR_PixelMultiplex 0x00000800 #define RR_DoubleClock 0x00001000 #define RR_ClockDivideBy2 0x00002000 #define RR_Connected 0 #define RR_Disconnected 1 #define RR_UnknownConnection 2 #define BadRROutput 0 #define BadRRCrtc 1 #define BadRRMode 2 #define BadRRProvider 3 /* Conventional RandR output properties */ #define RR_PROPERTY_BACKLIGHT "Backlight" #define RR_PROPERTY_RANDR_EDID "EDID" #define RR_PROPERTY_SIGNAL_FORMAT "SignalFormat" #define RR_PROPERTY_SIGNAL_PROPERTIES "SignalProperties" #define RR_PROPERTY_CONNECTOR_TYPE "ConnectorType" #define RR_PROPERTY_CONNECTOR_NUMBER "ConnectorNumber" #define RR_PROPERTY_COMPATIBILITY_LIST "CompatibilityList" #define RR_PROPERTY_CLONE_LIST "CloneList" #define RR_PROPERTY_BORDER "Border" #define RR_PROPERTY_BORDER_DIMENSIONS "BorderDimensions" #define RR_PROPERTY_GUID "GUID" #define RR_PROPERTY_RANDR_TILE "TILE" /* roles this device can carry out */ #define RR_Capability_None 0 #define RR_Capability_SourceOutput 1 #define RR_Capability_SinkOutput 2 #define RR_Capability_SourceOffload 4 #define RR_Capability_SinkOffload 8 #endif /* _RANDR_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/randrproto.h0000644000000000000000000006436413614532331017505 0ustar /* * Copyright © 2000 Compaq Computer Corporation * Copyright © 2002 Hewlett-Packard Company * Copyright © 2006 Intel Corporation * Copyright © 2008 Red Hat, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Jim Gettys, Hewlett-Packard Company, Inc. * Keith Packard, Intel Corporation */ /* note that RANDR 1.0 is incompatible with version 0.0, or 0.1 */ /* V1.0 removes depth switching from the protocol */ #ifndef _XRANDRP_H_ #define _XRANDRP_H_ #include #include #define Window CARD32 #define Drawable CARD32 #define Font CARD32 #define Pixmap CARD32 #define Cursor CARD32 #define Colormap CARD32 #define GContext CARD32 #define Atom CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define RROutput CARD32 #define RRMode CARD32 #define RRCrtc CARD32 #define RRProvider CARD32 #define RRModeFlags CARD32 #define Atom CARD32 #define Rotation CARD16 #define SizeID CARD16 #define SubpixelOrder CARD16 /* * data structures */ typedef struct { CARD16 widthInPixels B16; CARD16 heightInPixels B16; CARD16 widthInMillimeters B16; CARD16 heightInMillimeters B16; } xScreenSizes; #define sz_xScreenSizes 8 /* * requests and replies */ typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xRRQueryVersionReq; #define sz_xRRQueryVersionReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRRQueryVersionReply; #define sz_xRRQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; } xRRGetScreenInfoReq; #define sz_xRRGetScreenInfoReq 8 /* * the xRRScreenInfoReply structure is followed by: * * the size information */ typedef struct { BYTE type; /* X_Reply */ BYTE setOfRotations; CARD16 sequenceNumber B16; CARD32 length B32; Window root B32; Time timestamp B32; Time configTimestamp B32; CARD16 nSizes B16; SizeID sizeID B16; Rotation rotation B16; CARD16 rate B16; CARD16 nrateEnts B16; CARD16 pad B16; } xRRGetScreenInfoReply; #define sz_xRRGetScreenInfoReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Drawable drawable B32; Time timestamp B32; Time configTimestamp B32; SizeID sizeID B16; Rotation rotation B16; } xRR1_0SetScreenConfigReq; #define sz_xRR1_0SetScreenConfigReq 20 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Drawable drawable B32; Time timestamp B32; Time configTimestamp B32; SizeID sizeID B16; Rotation rotation B16; CARD16 rate B16; CARD16 pad B16; } xRRSetScreenConfigReq; #define sz_xRRSetScreenConfigReq 24 typedef struct { BYTE type; /* X_Reply */ CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time newTimestamp B32; Time newConfigTimestamp B32; Window root; CARD16 subpixelOrder B16; CARD16 pad4 B16; CARD32 pad5 B32; CARD32 pad6 B32; } xRRSetScreenConfigReply; #define sz_xRRSetScreenConfigReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; CARD16 enable B16; CARD16 pad2 B16; } xRRSelectInputReq; #define sz_xRRSelectInputReq 12 /* * Additions for version 1.2 */ typedef struct _xRRModeInfo { RRMode id B32; CARD16 width B16; CARD16 height B16; CARD32 dotClock B32; CARD16 hSyncStart B16; CARD16 hSyncEnd B16; CARD16 hTotal B16; CARD16 hSkew B16; CARD16 vSyncStart B16; CARD16 vSyncEnd B16; CARD16 vTotal B16; CARD16 nameLength B16; RRModeFlags modeFlags B32; } xRRModeInfo; #define sz_xRRModeInfo 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; } xRRGetScreenSizeRangeReq; #define sz_xRRGetScreenSizeRangeReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 pad; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 minWidth B16; CARD16 minHeight B16; CARD16 maxWidth B16; CARD16 maxHeight B16; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xRRGetScreenSizeRangeReply; #define sz_xRRGetScreenSizeRangeReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; CARD16 width B16; CARD16 height B16; CARD32 widthInMillimeters B32; CARD32 heightInMillimeters B32; } xRRSetScreenSizeReq; #define sz_xRRSetScreenSizeReq 20 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; } xRRGetScreenResourcesReq; #define sz_xRRGetScreenResourcesReq 8 typedef struct { BYTE type; CARD8 pad; CARD16 sequenceNumber B16; CARD32 length B32; Time timestamp B32; Time configTimestamp B32; CARD16 nCrtcs B16; CARD16 nOutputs B16; CARD16 nModes B16; CARD16 nbytesNames B16; CARD32 pad1 B32; CARD32 pad2 B32; } xRRGetScreenResourcesReply; #define sz_xRRGetScreenResourcesReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; Time configTimestamp B32; } xRRGetOutputInfoReq; #define sz_xRRGetOutputInfoReq 12 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time timestamp B32; RRCrtc crtc B32; CARD32 mmWidth B32; CARD32 mmHeight B32; CARD8 connection; CARD8 subpixelOrder; CARD16 nCrtcs B16; CARD16 nModes B16; CARD16 nPreferred B16; CARD16 nClones B16; CARD16 nameLength B16; } xRRGetOutputInfoReply; #define sz_xRRGetOutputInfoReply 36 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; } xRRListOutputPropertiesReq; #define sz_xRRListOutputPropertiesReq 8 typedef struct { BYTE type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nAtoms B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xRRListOutputPropertiesReply; #define sz_xRRListOutputPropertiesReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; Atom property B32; } xRRQueryOutputPropertyReq; #define sz_xRRQueryOutputPropertyReq 12 typedef struct { BYTE type; BYTE pad0; CARD16 sequenceNumber B16; CARD32 length B32; BOOL pending; BOOL range; BOOL immutable; BYTE pad1; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xRRQueryOutputPropertyReply; #define sz_xRRQueryOutputPropertyReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; Atom property B32; BOOL pending; BOOL range; CARD16 pad B16; } xRRConfigureOutputPropertyReq; #define sz_xRRConfigureOutputPropertyReq 16 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; Atom property B32; Atom type B32; CARD8 format; CARD8 mode; CARD16 pad; CARD32 nUnits B32; } xRRChangeOutputPropertyReq; #define sz_xRRChangeOutputPropertyReq 24 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; Atom property B32; } xRRDeleteOutputPropertyReq; #define sz_xRRDeleteOutputPropertyReq 12 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; Atom property B32; Atom type B32; CARD32 longOffset B32; CARD32 longLength B32; #ifdef __cplusplus BOOL _delete; #else BOOL delete; #endif BOOL pending; CARD16 pad1 B16; } xRRGetOutputPropertyReq; #define sz_xRRGetOutputPropertyReq 28 typedef struct { BYTE type; CARD8 format; CARD16 sequenceNumber B16; CARD32 length B32; Atom propertyType B32; CARD32 bytesAfter B32; CARD32 nItems B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xRRGetOutputPropertyReply; #define sz_xRRGetOutputPropertyReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; xRRModeInfo modeInfo; } xRRCreateModeReq; #define sz_xRRCreateModeReq 40 typedef struct { BYTE type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; RRMode mode B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRRCreateModeReply; #define sz_xRRCreateModeReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRMode mode B32; } xRRDestroyModeReq; #define sz_xRRDestroyModeReq 8 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; RRMode mode B32; } xRRAddOutputModeReq; #define sz_xRRAddOutputModeReq 12 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RROutput output B32; RRMode mode B32; } xRRDeleteOutputModeReq; #define sz_xRRDeleteOutputModeReq 12 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; Time configTimestamp B32; } xRRGetCrtcInfoReq; #define sz_xRRGetCrtcInfoReq 12 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time timestamp B32; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; RRMode mode B32; Rotation rotation B16; Rotation rotations B16; CARD16 nOutput B16; CARD16 nPossibleOutput B16; } xRRGetCrtcInfoReply; #define sz_xRRGetCrtcInfoReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; Time timestamp B32; Time configTimestamp B32; INT16 x B16; INT16 y B16; RRMode mode B32; Rotation rotation B16; CARD16 pad B16; } xRRSetCrtcConfigReq; #define sz_xRRSetCrtcConfigReq 28 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time newTimestamp B32; CARD32 pad1 B32; CARD32 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRRSetCrtcConfigReply; #define sz_xRRSetCrtcConfigReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; } xRRGetCrtcGammaSizeReq; #define sz_xRRGetCrtcGammaSizeReq 8 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 size B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xRRGetCrtcGammaSizeReply; #define sz_xRRGetCrtcGammaSizeReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; } xRRGetCrtcGammaReq; #define sz_xRRGetCrtcGammaReq 8 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 size B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xRRGetCrtcGammaReply; #define sz_xRRGetCrtcGammaReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; CARD16 size B16; CARD16 pad1 B16; } xRRSetCrtcGammaReq; #define sz_xRRSetCrtcGammaReq 12 /* * Additions for V1.3 */ typedef xRRGetScreenResourcesReq xRRGetScreenResourcesCurrentReq; #define sz_xRRGetScreenResourcesCurrentReq sz_xRRGetScreenResourcesReq typedef xRRGetScreenResourcesReply xRRGetScreenResourcesCurrentReply; #define sz_xRRGetScreenResourcesCurrentReply sz_xRRGetScreenResourcesReply typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; xRenderTransform transform; CARD16 nbytesFilter; /* number of bytes in filter name */ CARD16 pad B16; } xRRSetCrtcTransformReq; #define sz_xRRSetCrtcTransformReq 48 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; } xRRGetCrtcTransformReq; #define sz_xRRGetCrtcTransformReq 8 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; xRenderTransform pendingTransform; BYTE hasTransforms; CARD8 pad0; CARD16 pad1 B16; xRenderTransform currentTransform; CARD32 pad2 B32; CARD16 pendingNbytesFilter B16; /* number of bytes in filter name */ CARD16 pendingNparamsFilter B16; /* number of filter params */ CARD16 currentNbytesFilter B16; /* number of bytes in filter name */ CARD16 currentNparamsFilter B16; /* number of filter params */ } xRRGetCrtcTransformReply; #define sz_xRRGetCrtcTransformReply 96 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; RROutput output B32; } xRRSetOutputPrimaryReq; #define sz_xRRSetOutputPrimaryReq 12 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; } xRRGetOutputPrimaryReq; #define sz_xRRGetOutputPrimaryReq 8 typedef struct { BYTE type; CARD8 pad; CARD16 sequenceNumber B16; CARD32 length B32; RROutput output B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRRGetOutputPrimaryReply; #define sz_xRRGetOutputPrimaryReply 32 /* * Additions for V1.4 */ typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; } xRRGetProvidersReq; #define sz_xRRGetProvidersReq 8 typedef struct { BYTE type; CARD8 pad; CARD16 sequenceNumber B16; CARD32 length B32; Time timestamp B32; CARD16 nProviders; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRRGetProvidersReply; #define sz_xRRGetProvidersReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; Time configTimestamp B32; } xRRGetProviderInfoReq; #define sz_xRRGetProviderInfoReq 12 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time timestamp B32; CARD32 capabilities B32; CARD16 nCrtcs B16; CARD16 nOutputs B16; CARD16 nAssociatedProviders B16; CARD16 nameLength B16; CARD32 pad1 B32; CARD32 pad2 B32; } xRRGetProviderInfoReply; #define sz_xRRGetProviderInfoReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; RRProvider source_provider B32; Time configTimestamp B32; } xRRSetProviderOutputSourceReq; #define sz_xRRSetProviderOutputSourceReq 16 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; RRProvider sink_provider B32; Time configTimestamp B32; } xRRSetProviderOffloadSinkReq; #define sz_xRRSetProviderOffloadSinkReq 16 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; } xRRListProviderPropertiesReq; #define sz_xRRListProviderPropertiesReq 8 typedef struct { BYTE type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nAtoms B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xRRListProviderPropertiesReply; #define sz_xRRListProviderPropertiesReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; Atom property B32; } xRRQueryProviderPropertyReq; #define sz_xRRQueryProviderPropertyReq 12 typedef struct { BYTE type; BYTE pad0; CARD16 sequenceNumber B16; CARD32 length B32; BOOL pending; BOOL range; BOOL immutable; BYTE pad1; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xRRQueryProviderPropertyReply; #define sz_xRRQueryProviderPropertyReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; Atom property B32; BOOL pending; BOOL range; CARD16 pad B16; } xRRConfigureProviderPropertyReq; #define sz_xRRConfigureProviderPropertyReq 16 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; Atom property B32; Atom type B32; CARD8 format; CARD8 mode; CARD16 pad; CARD32 nUnits B32; } xRRChangeProviderPropertyReq; #define sz_xRRChangeProviderPropertyReq 24 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; Atom property B32; } xRRDeleteProviderPropertyReq; #define sz_xRRDeleteProviderPropertyReq 12 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRProvider provider B32; Atom property B32; Atom type B32; CARD32 longOffset B32; CARD32 longLength B32; #ifdef __cplusplus BOOL _delete; #else BOOL delete; #endif BOOL pending; CARD16 pad1 B16; } xRRGetProviderPropertyReq; #define sz_xRRGetProviderPropertyReq 28 typedef struct { BYTE type; CARD8 format; CARD16 sequenceNumber B16; CARD32 length B32; Atom propertyType B32; CARD32 bytesAfter B32; CARD32 nItems B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xRRGetProviderPropertyReply; #define sz_xRRGetProviderPropertyReply 32 /* * event */ typedef struct { CARD8 type; /* always evBase + ScreenChangeNotify */ CARD8 rotation; /* new rotation */ CARD16 sequenceNumber B16; Time timestamp B32; /* time screen was changed */ Time configTimestamp B32; /* time config data was changed */ Window root B32; /* root window */ Window window B32; /* window requesting notification */ SizeID sizeID B16; /* new size ID */ CARD16 subpixelOrder B16; /* subpixel order */ CARD16 widthInPixels B16; /* new size */ CARD16 heightInPixels B16; CARD16 widthInMillimeters B16; CARD16 heightInMillimeters B16; } xRRScreenChangeNotifyEvent; #define sz_xRRScreenChangeNotifyEvent 32 typedef struct { CARD8 type; /* always evBase + RRNotify */ CARD8 subCode; /* RRNotify_CrtcChange */ CARD16 sequenceNumber B16; Time timestamp B32; /* time crtc was changed */ Window window B32; /* window requesting notification */ RRCrtc crtc B32; /* affected CRTC */ RRMode mode B32; /* current mode */ CARD16 rotation B16; /* rotation and reflection */ CARD16 pad1 B16; /* unused */ INT16 x B16; /* new location */ INT16 y B16; CARD16 width B16; /* new size */ CARD16 height B16; } xRRCrtcChangeNotifyEvent; #define sz_xRRCrtcChangeNotifyEvent 32 typedef struct { CARD8 type; /* always evBase + RRNotify */ CARD8 subCode; /* RRNotify_OutputChange */ CARD16 sequenceNumber B16; Time timestamp B32; /* time output was changed */ Time configTimestamp B32; /* time config was changed */ Window window B32; /* window requesting notification */ RROutput output B32; /* affected output */ RRCrtc crtc B32; /* current crtc */ RRMode mode B32; /* current mode */ CARD16 rotation B16; /* rotation and reflection */ CARD8 connection; /* connection status */ CARD8 subpixelOrder; /* subpixel order */ } xRROutputChangeNotifyEvent; #define sz_xRROutputChangeNotifyEvent 32 typedef struct { CARD8 type; /* always evBase + RRNotify */ CARD8 subCode; /* RRNotify_OutputProperty */ CARD16 sequenceNumber B16; Window window B32; /* window requesting notification */ RROutput output B32; /* affected output */ Atom atom B32; /* property name */ Time timestamp B32; /* time crtc was changed */ CARD8 state; /* NewValue or Deleted */ CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; } xRROutputPropertyNotifyEvent; #define sz_xRROutputPropertyNotifyEvent 32 typedef struct { CARD8 type; /* always evBase + RRNotify */ CARD8 subCode; /* RRNotify_ProviderChange */ CARD16 sequenceNumber B16; Time timestamp B32; /* time provider was changed */ Window window B32; /* window requesting notification */ RRProvider provider B32; /* affected provider */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xRRProviderChangeNotifyEvent; #define sz_xRRProviderChangeNotifyEvent 32 typedef struct { CARD8 type; /* always evBase + RRNotify */ CARD8 subCode; /* RRNotify_ProviderProperty */ CARD16 sequenceNumber B16; Window window B32; /* window requesting notification */ RRProvider provider B32; /* affected provider */ Atom atom B32; /* property name */ Time timestamp B32; /* time provider was changed */ CARD8 state; /* NewValue or Deleted */ CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; } xRRProviderPropertyNotifyEvent; #define sz_xRRProviderPropertyNotifyEvent 32 typedef struct { CARD8 type; /* always evBase + RRNotify */ CARD8 subCode; /* RRNotify_ResourceChange */ CARD16 sequenceNumber B16; Time timestamp B32; /* time resource was changed */ Window window B32; /* window requesting notification */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRRResourceChangeNotifyEvent; #define sz_xRRResourceChangeNotifyEvent 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; } xRRGetPanningReq; #define sz_xRRGetPanningReq 8 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time timestamp B32; CARD16 left B16; CARD16 top B16; CARD16 width B16; CARD16 height B16; CARD16 track_left B16; CARD16 track_top B16; CARD16 track_width B16; CARD16 track_height B16; INT16 border_left B16; INT16 border_top B16; INT16 border_right B16; INT16 border_bottom B16; } xRRGetPanningReply; #define sz_xRRGetPanningReply 36 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; RRCrtc crtc B32; Time timestamp B32; CARD16 left B16; CARD16 top B16; CARD16 width B16; CARD16 height B16; CARD16 track_left B16; CARD16 track_top B16; CARD16 track_width B16; CARD16 track_height B16; INT16 border_left B16; INT16 border_top B16; INT16 border_right B16; INT16 border_bottom B16; } xRRSetPanningReq; #define sz_xRRSetPanningReq 36 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time newTimestamp B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRRSetPanningReply; #define sz_xRRSetPanningReply 32 typedef struct { Atom name B32; BOOL primary; BOOL automatic; CARD16 noutput B16; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; CARD32 widthInMillimeters B32; CARD32 heightInMillimeters B32; } xRRMonitorInfo; #define sz_xRRMonitorInfo 24 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; BOOL get_active; CARD8 pad; CARD16 pad2; } xRRGetMonitorsReq; #define sz_xRRGetMonitorsReq 12 typedef struct { BYTE type; CARD8 status; CARD16 sequenceNumber B16; CARD32 length B32; Time timestamp B32; CARD32 nmonitors B32; CARD32 noutputs B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xRRGetMonitorsReply; #define sz_xRRGetMonitorsReply 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; xRRMonitorInfo monitor; } xRRSetMonitorReq; #define sz_xRRSetMonitorReq 32 typedef struct { CARD8 reqType; CARD8 randrReqType; CARD16 length B16; Window window B32; Atom name B32; } xRRDeleteMonitorReq; #define sz_xRRDeleteMonitorReq 12 #undef RRModeFlags #undef RRCrtc #undef RRMode #undef RROutput #undef RRMode #undef RRCrtc #undef RRProvider #undef Drawable #undef Window #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef Atom #undef Time #undef KeyCode #undef KeySym #undef Rotation #undef SizeID #undef SubpixelOrder #undef Atom #endif /* _XRANDRP_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/record.h0000644000000000000000000001254413614532331016562 0ustar /* $Xorg: record.h,v 1.3 2000/08/18 04:05:46 coskrey Exp $ */ /*************************************************************************** * Copyright 1995 Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Network Computing Devices * not be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. * * NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **************************************************************************/ /* $XFree86$ */ #ifndef _RECORD_H_ #define _RECORD_H_ #define XRecordBadContext 0 /* Not a valid RC */ /* * Constants for arguments of various requests */ #define XRecordFromServerTime 0x01 #define XRecordFromClientTime 0x02 #define XRecordFromClientSequence 0x04 #define XRecordCurrentClients 1 #define XRecordFutureClients 2 #define XRecordAllClients 3 #define XRecordFromServer 0 #define XRecordFromClient 1 #define XRecordClientStarted 2 #define XRecordClientDied 3 #define XRecordStartOfData 4 #define XRecordEndOfData 5 typedef unsigned long XRecordClientSpec; #ifndef _XRECORD_SERVER_ typedef unsigned long XRecordContext; typedef struct { unsigned char first; unsigned char last; } XRecordRange8; typedef struct { unsigned short first; unsigned short last; } XRecordRange16; typedef struct { XRecordRange8 ext_major; XRecordRange16 ext_minor; } XRecordExtRange; typedef struct { XRecordRange8 core_requests; /* core X requests */ XRecordRange8 core_replies; /* core X replies */ XRecordExtRange ext_requests; /* extension requests */ XRecordExtRange ext_replies; /* extension replies */ XRecordRange8 delivered_events; /* delivered core and ext events */ XRecordRange8 device_events; /* all core and ext device events */ XRecordRange8 errors; /* core X and ext errors */ Bool client_started; /* connection setup reply */ Bool client_died; /* notice of client disconnect */ } XRecordRange; typedef struct { XRecordClientSpec client; unsigned long nranges; XRecordRange **ranges; } XRecordClientInfo; typedef struct { Bool enabled; int datum_flags; unsigned long nclients; XRecordClientInfo **client_info; } XRecordState; typedef struct { XID id_base; Time server_time; unsigned long client_seq; int category; Bool client_swapped; unsigned char *data; unsigned long data_len; /* in 4-byte units */ } XRecordInterceptData; _XFUNCPROTOBEGIN /********************************************************* * * Prototypes * */ XID XRecordIdBaseMask( Display *dpy ); extern Status XRecordQueryVersion( Display* /* dpy */, int* /* cmajor_return */, int* /* cminor_return */ ); extern XRecordContext XRecordCreateContext( Display* /* dpy */, int /* datum_flags */, XRecordClientSpec* /* clients */, int /* nclients */, XRecordRange** /* ranges */, int /* nranges */ ); extern XRecordRange *XRecordAllocRange( void ); extern Status XRecordRegisterClients( Display* /* dpy */, XRecordContext /* context */, int /* datum_flags */, XRecordClientSpec* /* clients */, int /* nclients */, XRecordRange** /* ranges */, int /* nranges */ ); extern Status XRecordUnregisterClients( Display* /* dpy */, XRecordContext /* context */, XRecordClientSpec* /* clients */, int /* nclients */ ); extern Status XRecordGetContext( Display* /* dpy */, XRecordContext /* context */, XRecordState** /* state_return */ ); extern void XRecordFreeState( XRecordState* /* state */ ); typedef void (*XRecordInterceptProc) ( XPointer /* closure */, XRecordInterceptData* /* recorded_data */ ); extern Status XRecordEnableContext( Display* /* dpy */, XRecordContext /* context */, XRecordInterceptProc /* callback */, XPointer /* closure */ ); extern Status XRecordEnableContextAsync( Display* /* dpy */, XRecordContext /* context */, XRecordInterceptProc /* callback */, XPointer /* closure */ ); extern void XRecordProcessReplies( Display* /* dpy */ ); extern void XRecordFreeData( XRecordInterceptData* /* data */ ); extern Status XRecordDisableContext( Display* /* dpy */, XRecordContext /* context */ ); extern Status XRecordFreeContext( Display* /* dpy */, XRecordContext /* context */ ); _XFUNCPROTOEND #endif /* _XRECORD_SERVER_ */ #endif /* _RECORD_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/recordstr.h0000644000000000000000000002017513614532331017312 0ustar /* #ifndef lint $Xorg: recordstr.h,v 1.3 2000/08/18 04:05:46 coskrey Exp $ static char sccsid[ ] = "@(#) recordstr.h 1.5 6/5/95 12:37:44"; #endif */ /*************************************************************************** * Copyright 1995 Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Network Computing Devices * not be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. * * NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **************************************************************************/ /* $XFree86$ */ #ifndef _RECORDSTR_H_ #define _RECORDSTR_H_ #include #define RECORD_NAME "RECORD" #define RECORD_MAJOR_VERSION 1 #define RECORD_MINOR_VERSION 13 #define RECORD_LOWEST_MAJOR_VERSION 1 #define RECORD_LOWEST_MINOR_VERSION 12 /* only difference between 1.12 and 1.13 is byte order of device events, which the library doesn't deal with. */ /********************************************************* * * Protocol request constants * */ #define X_RecordQueryVersion 0 /* First request from client */ #define X_RecordCreateContext 1 /* Create client RC */ #define X_RecordRegisterClients 2 /* Add to client RC */ #define X_RecordUnregisterClients 3 /* Delete from client RC */ #define X_RecordGetContext 4 /* Query client RC */ #define X_RecordEnableContext 5 /* Enable interception and reporting */ #define X_RecordDisableContext 6 /* Disable interception and reporting */ #define X_RecordFreeContext 7 /* Free client RC */ #define RecordNumErrors (XRecordBadContext + 1) #define RecordNumEvents 0L #define sz_XRecordRange 32 #define sz_XRecordClientInfo 12 #define sz_XRecordState 16 #define sz_XRecordDatum 32 #define XRecordGlobaldef #define XRecordGlobalref extern #define RecordMaxEvent (128L-1L) #define RecordMinDeviceEvent (2L) #define RecordMaxDeviceEvent (6L) #define RecordMaxError (256L-1L) #define RecordMaxCoreRequest (128L-1L) #define RecordMaxExtRequest (256L-1L) #define RecordMinExtRequest (129L-1L) #define RECORD_RC CARD32 #define RECORD_XIDBASE CARD32 #define RECORD_CLIENTSPEC CARD32 #define RECORD_ELEMENT_HEADER CARD8 typedef RECORD_CLIENTSPEC RecordClientSpec, *RecordClientSpecPtr; typedef struct { CARD8 first; CARD8 last; } RECORD_RANGE8; typedef struct { CARD16 first B16; CARD16 last B16; } RECORD_RANGE16; typedef struct { RECORD_RANGE8 majorCode; RECORD_RANGE16 minorCode; } RECORD_EXTRANGE; typedef struct { RECORD_RANGE8 coreRequests; RECORD_RANGE8 coreReplies; RECORD_EXTRANGE extRequests; RECORD_EXTRANGE extReplies; RECORD_RANGE8 deliveredEvents; RECORD_RANGE8 deviceEvents; RECORD_RANGE8 errors; BOOL clientStarted; BOOL clientDied; } RECORDRANGE; #define sz_RECORDRANGE 24 /* typedef RECORDRANGE xRecordRange, *xRecordRangePtr; #define sz_xRecordRange 24 */ /* Cannot have structures within structures going over the wire */ typedef struct { CARD8 coreRequestsFirst; CARD8 coreRequestsLast; CARD8 coreRepliesFirst; CARD8 coreRepliesLast; CARD8 extRequestsMajorFirst; CARD8 extRequestsMajorLast; CARD16 extRequestsMinorFirst B16; CARD16 extRequestsMinorLast B16; CARD8 extRepliesMajorFirst; CARD8 extRepliesMajorLast; CARD16 extRepliesMinorFirst B16; CARD16 extRepliesMinorLast B16; CARD8 deliveredEventsFirst; CARD8 deliveredEventsLast; CARD8 deviceEventsFirst; CARD8 deviceEventsLast; CARD8 errorsFirst; CARD8 errorsLast; BOOL clientStarted; BOOL clientDied; } xRecordRange; #define sz_xRecordRange 24 typedef struct { RECORD_CLIENTSPEC clientResource B32; CARD32 nRanges B32; /* LISTofRECORDRANGE */ } RECORD_CLIENT_INFO; typedef RECORD_CLIENT_INFO xRecordClientInfo; /* * Initialize */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; CARD16 majorVersion B16; CARD16 minorVersion B16; } xRecordQueryVersionReq; #define sz_xRecordQueryVersionReq 8 typedef struct { CARD8 type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRecordQueryVersionReply; #define sz_xRecordQueryVersionReply 32 /* * Create RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; RECORD_ELEMENT_HEADER elementHeader; CARD8 pad; CARD16 pad0 B16; CARD32 nClients B32; CARD32 nRanges B32; /* LISTofRECORD_CLIENTSPEC */ /* LISTofRECORDRANGE */ } xRecordCreateContextReq; #define sz_xRecordCreateContextReq 20 /* * Add to RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; RECORD_ELEMENT_HEADER elementHeader; CARD8 pad; CARD16 pad0 B16; CARD32 nClients B32; CARD32 nRanges B32; /* LISTofRECORD_CLIENTSPEC */ /* LISTofRECORDRANGE */ } xRecordRegisterClientsReq; #define sz_xRecordRegisterClientsReq 20 /* * Delete from RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; CARD32 nClients B32; /* LISTofRECORD_CLIENTSPEC */ } xRecordUnregisterClientsReq; #define sz_xRecordUnregisterClientsReq 12 /* * Query RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; } xRecordGetContextReq; #define sz_xRecordGetContextReq 8 typedef struct { CARD8 type; BOOL enabled; CARD16 sequenceNumber B16; CARD32 length B32; RECORD_ELEMENT_HEADER elementHeader; CARD8 pad; CARD16 pad0 B16; CARD32 nClients B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; /* LISTofCLIENT_INFO */ /* intercepted-clients */ } xRecordGetContextReply; #define sz_xRecordGetContextReply 32 /* * Enable data interception */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; } xRecordEnableContextReq; #define sz_xRecordEnableContextReq 8 typedef struct { CARD8 type; CARD8 category; CARD16 sequenceNumber B16; CARD32 length B32; RECORD_ELEMENT_HEADER elementHeader; BOOL clientSwapped; CARD16 pad1 B16; RECORD_XIDBASE idBase B32; CARD32 serverTime B32; CARD32 recordedSequenceNumber B32; CARD32 pad3 B32; CARD32 pad4 B32; /* BYTE data; */ } xRecordEnableContextReply; #define sz_xRecordEnableContextReply 32 /* * Disable data interception */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; } xRecordDisableContextReq; #define sz_xRecordDisableContextReq 8 /* * Free RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; } xRecordFreeContextReq; #define sz_xRecordFreeContextReq 8 #undef RECORD_RC #undef RECORD_XIDBASE #undef RECORD_ELEMENT_HEADER #undef RECORD_CLIENTSPEC #endif nx-libs-3.5.99.23/nx-X11/include/extensions/render.h0000644000000000000000000001434513614532331016564 0ustar /* * $XFree86: xc/include/extensions/render.h,v 1.10 2002/11/06 22:47:49 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifndef _RENDER_H_ #define _RENDER_H_ typedef unsigned long Glyph; typedef unsigned long GlyphSet; typedef unsigned long Picture; typedef unsigned long PictFormat; #define RENDER_NAME "RENDER" #define RENDER_MAJOR 0 #define RENDER_MINOR 10 #define X_RenderQueryVersion 0 #define X_RenderQueryPictFormats 1 #define X_RenderQueryPictIndexValues 2 /* 0.7 */ #define X_RenderQueryDithers 3 #define X_RenderCreatePicture 4 #define X_RenderChangePicture 5 #define X_RenderSetPictureClipRectangles 6 #define X_RenderFreePicture 7 #define X_RenderComposite 8 #define X_RenderScale 9 #define X_RenderTrapezoids 10 #define X_RenderTriangles 11 #define X_RenderTriStrip 12 #define X_RenderTriFan 13 #define X_RenderColorTrapezoids 14 #define X_RenderColorTriangles 15 /* #define X_RenderTransform 16 */ #define X_RenderCreateGlyphSet 17 #define X_RenderReferenceGlyphSet 18 #define X_RenderFreeGlyphSet 19 #define X_RenderAddGlyphs 20 #define X_RenderAddGlyphsFromPicture 21 #define X_RenderFreeGlyphs 22 #define X_RenderCompositeGlyphs8 23 #define X_RenderCompositeGlyphs16 24 #define X_RenderCompositeGlyphs32 25 #define X_RenderFillRectangles 26 /* 0.5 */ #define X_RenderCreateCursor 27 /* 0.6 */ #define X_RenderSetPictureTransform 28 #define X_RenderQueryFilters 29 #define X_RenderSetPictureFilter 30 /* 0.8 */ #define X_RenderCreateAnimCursor 31 /* 0.9 */ #define X_RenderAddTraps 32 /* 0.10 */ #define X_RenderCreateSolidFill 33 #define X_RenderCreateLinearGradient 34 #define X_RenderCreateRadialGradient 35 #define X_RenderCreateConicalGradient 36 #define RenderNumberRequests (X_RenderCreateConicalGradient+1) #define BadPictFormat 0 #define BadPicture 1 #define BadPictOp 2 #define BadGlyphSet 3 #define BadGlyph 4 #define RenderNumberErrors (BadGlyph+1) #define PictTypeIndexed 0 #define PictTypeDirect 1 #define PictOpMinimum 0 #define PictOpClear 0 #define PictOpSrc 1 #define PictOpDst 2 #define PictOpOver 3 #define PictOpOverReverse 4 #define PictOpIn 5 #define PictOpInReverse 6 #define PictOpOut 7 #define PictOpOutReverse 8 #define PictOpAtop 9 #define PictOpAtopReverse 10 #define PictOpXor 11 #define PictOpAdd 12 #define PictOpSaturate 13 #define PictOpMaximum 13 /* * Operators only available in version 0.2 */ #define PictOpDisjointMinimum 0x10 #define PictOpDisjointClear 0x10 #define PictOpDisjointSrc 0x11 #define PictOpDisjointDst 0x12 #define PictOpDisjointOver 0x13 #define PictOpDisjointOverReverse 0x14 #define PictOpDisjointIn 0x15 #define PictOpDisjointInReverse 0x16 #define PictOpDisjointOut 0x17 #define PictOpDisjointOutReverse 0x18 #define PictOpDisjointAtop 0x19 #define PictOpDisjointAtopReverse 0x1a #define PictOpDisjointXor 0x1b #define PictOpDisjointMaximum 0x1b #define PictOpConjointMinimum 0x20 #define PictOpConjointClear 0x20 #define PictOpConjointSrc 0x21 #define PictOpConjointDst 0x22 #define PictOpConjointOver 0x23 #define PictOpConjointOverReverse 0x24 #define PictOpConjointIn 0x25 #define PictOpConjointInReverse 0x26 #define PictOpConjointOut 0x27 #define PictOpConjointOutReverse 0x28 #define PictOpConjointAtop 0x29 #define PictOpConjointAtopReverse 0x2a #define PictOpConjointXor 0x2b #define PictOpConjointMaximum 0x2b #define PolyEdgeSharp 0 #define PolyEdgeSmooth 1 #define PolyModePrecise 0 #define PolyModeImprecise 1 #define CPRepeat (1 << 0) #define CPAlphaMap (1 << 1) #define CPAlphaXOrigin (1 << 2) #define CPAlphaYOrigin (1 << 3) #define CPClipXOrigin (1 << 4) #define CPClipYOrigin (1 << 5) #define CPClipMask (1 << 6) #define CPGraphicsExposure (1 << 7) #define CPSubwindowMode (1 << 8) #define CPPolyEdge (1 << 9) #define CPPolyMode (1 << 10) #define CPDither (1 << 11) #define CPComponentAlpha (1 << 12) #define CPLastBit 12 /* Filters included in 0.6 */ #define FilterNearest "nearest" #define FilterBilinear "bilinear" /* Filters included in 0.10 */ #define FilterConvolution "convolution" #define FilterFast "fast" #define FilterGood "good" #define FilterBest "best" #define FilterAliasNone -1 /* Subpixel orders included in 0.6 */ #define SubPixelUnknown 0 #define SubPixelHorizontalRGB 1 #define SubPixelHorizontalBGR 2 #define SubPixelVerticalRGB 3 #define SubPixelVerticalBGR 4 #define SubPixelNone 5 /* Extended repeat attributes included in 0.10 */ #define RepeatNone 0 #define RepeatNormal 1 #define RepeatPad 2 #define RepeatReflect 3 #endif /* _RENDER_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/renderproto.h0000644000000000000000000003345513614532331017653 0ustar /* * $XFree86: xc/include/extensions/renderproto.h,v 1.12 2002/09/26 02:56:48 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifndef _XRENDERP_H_ #define _XRENDERP_H_ #include #include #define Window CARD32 #define Drawable CARD32 #define Font CARD32 #define Pixmap CARD32 #define Cursor CARD32 #define Colormap CARD32 #define GContext CARD32 #define Atom CARD32 #define VisualID CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define Picture CARD32 #define PictFormat CARD32 #define Fixed INT32 #define Glyphset CARD32 #define Glyph CARD32 /* * data structures */ typedef struct { CARD16 red B16; CARD16 redMask B16; CARD16 green B16; CARD16 greenMask B16; CARD16 blue B16; CARD16 blueMask B16; CARD16 alpha B16; CARD16 alphaMask B16; } xDirectFormat; #define sz_xDirectFormat 16 typedef struct { PictFormat id B32; CARD8 type; CARD8 depth; CARD16 pad1 B16; xDirectFormat direct; Colormap colormap; } xPictFormInfo; #define sz_xPictFormInfo 28 typedef struct { VisualID visual; PictFormat format; } xPictVisual; #define sz_xPictVisual 8 typedef struct { CARD8 depth; CARD8 pad1; CARD16 nPictVisuals B16; CARD32 pad2 B32; } xPictDepth; #define sz_xPictDepth 8 typedef struct { CARD32 nDepth B32; PictFormat fallback B32; } xPictScreen; #define sz_xPictScreen 8 typedef struct { CARD32 pixel B32; CARD16 red B16; CARD16 green B16; CARD16 blue B16; CARD16 alpha B16; } xIndexValue; #define sz_xIndexValue 12 typedef struct { CARD16 red B16; CARD16 green B16; CARD16 blue B16; CARD16 alpha B16; } xRenderColor; #define sz_xRenderColor 8 typedef struct { Fixed x B32; Fixed y B32; } xPointFixed; #define sz_xPointFixed 8 typedef struct { xPointFixed p1; xPointFixed p2; } xLineFixed; #define sz_xLineFixed 16 typedef struct { xPointFixed p1, p2, p3; } xTriangle; #define sz_xTriangle 24 typedef struct { Fixed top B32; Fixed bottom B32; xLineFixed left; xLineFixed right; } xTrapezoid; #define sz_xTrapezoid 40 typedef struct { CARD16 width B16; CARD16 height B16; INT16 x B16; INT16 y B16; INT16 xOff B16; INT16 yOff B16; } xGlyphInfo; #define sz_xGlyphInfo 12 typedef struct { CARD8 len; CARD8 pad1; CARD16 pad2; INT16 deltax; INT16 deltay; } xGlyphElt; #define sz_xGlyphElt 8 typedef struct { Fixed l, r, y; } xSpanFix; #define sz_xSpanFix 12 typedef struct { xSpanFix top, bot; } xTrap; #define sz_xTrap 24 /* * requests and replies */ typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xRenderQueryVersionReq; #define sz_xRenderQueryVersionReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRenderQueryVersionReply; #define sz_xRenderQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; } xRenderQueryPictFormatsReq; #define sz_xRenderQueryPictFormatsReq 4 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numFormats B32; CARD32 numScreens B32; CARD32 numDepths B32; CARD32 numVisuals B32; CARD32 numSubpixel B32; /* Version 0.6 */ CARD32 pad5 B32; } xRenderQueryPictFormatsReply; #define sz_xRenderQueryPictFormatsReply 32 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; PictFormat format B32; } xRenderQueryPictIndexValuesReq; #define sz_xRenderQueryPictIndexValuesReq 8 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numIndexValues; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xRenderQueryPictIndexValuesReply; #define sz_xRenderQueryPictIndexValuesReply 32 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture pid B32; Drawable drawable B32; PictFormat format B32; CARD32 mask B32; } xRenderCreatePictureReq; #define sz_xRenderCreatePictureReq 20 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture picture B32; CARD32 mask B32; } xRenderChangePictureReq; #define sz_xRenderChangePictureReq 12 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture picture B32; INT16 xOrigin B16; INT16 yOrigin B16; } xRenderSetPictureClipRectanglesReq; #define sz_xRenderSetPictureClipRectanglesReq 12 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture picture B32; } xRenderFreePictureReq; #define sz_xRenderFreePictureReq 8 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD8 op; CARD8 pad1; CARD16 pad2 B16; Picture src B32; Picture mask B32; Picture dst B32; INT16 xSrc B16; INT16 ySrc B16; INT16 xMask B16; INT16 yMask B16; INT16 xDst B16; INT16 yDst B16; CARD16 width B16; CARD16 height B16; } xRenderCompositeReq; #define sz_xRenderCompositeReq 36 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture src B32; Picture dst B32; CARD32 colorScale B32; CARD32 alphaScale B32; INT16 xSrc B16; INT16 ySrc B16; INT16 xDst B16; INT16 yDst B16; CARD16 width B16; CARD16 height B16; } xRenderScaleReq; #define sz_xRenderScaleReq 32 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD8 op; CARD8 pad1; CARD16 pad2 B16; Picture src B32; Picture dst B32; PictFormat maskFormat B32; INT16 xSrc B16; INT16 ySrc B16; } xRenderTrapezoidsReq; #define sz_xRenderTrapezoidsReq 24 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD8 op; CARD8 pad1; CARD16 pad2 B16; Picture src B32; Picture dst B32; PictFormat maskFormat B32; INT16 xSrc B16; INT16 ySrc B16; } xRenderTrianglesReq; #define sz_xRenderTrianglesReq 24 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD8 op; CARD8 pad1; CARD16 pad2 B16; Picture src B32; Picture dst B32; PictFormat maskFormat B32; INT16 xSrc B16; INT16 ySrc B16; } xRenderTriStripReq; #define sz_xRenderTriStripReq 24 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD8 op; CARD8 pad1; CARD16 pad2 B16; Picture src B32; Picture dst B32; PictFormat maskFormat B32; INT16 xSrc B16; INT16 ySrc B16; } xRenderTriFanReq; #define sz_xRenderTriFanReq 24 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Glyphset gsid B32; PictFormat format B32; } xRenderCreateGlyphSetReq; #define sz_xRenderCreateGlyphSetReq 12 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Glyphset gsid B32; Glyphset existing B32; } xRenderReferenceGlyphSetReq; #define sz_xRenderReferenceGlyphSetReq 24 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Glyphset glyphset B32; } xRenderFreeGlyphSetReq; #define sz_xRenderFreeGlyphSetReq 8 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Glyphset glyphset B32; CARD32 nglyphs; } xRenderAddGlyphsReq; #define sz_xRenderAddGlyphsReq 12 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Glyphset glyphset B32; } xRenderFreeGlyphsReq; #define sz_xRenderFreeGlyphsReq 8 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD8 op; CARD8 pad1; CARD16 pad2 B16; Picture src B32; Picture dst B32; PictFormat maskFormat B32; Glyphset glyphset B32; INT16 xSrc B16; INT16 ySrc B16; } xRenderCompositeGlyphsReq, xRenderCompositeGlyphs8Req, xRenderCompositeGlyphs16Req, xRenderCompositeGlyphs32Req; #define sz_xRenderCompositeGlyphs8Req 28 #define sz_xRenderCompositeGlyphs16Req 28 #define sz_xRenderCompositeGlyphs32Req 28 /* 0.1 and higher */ typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; CARD8 op; CARD8 pad1; CARD16 pad2 B16; Picture dst B32; xRenderColor color; } xRenderFillRectanglesReq; #define sz_xRenderFillRectanglesReq 20 /* 0.5 and higher */ typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Cursor cid B32; Picture src B32; CARD16 x B16; CARD16 y B16; } xRenderCreateCursorReq; #define sz_xRenderCreateCursorReq 16 /* 0.6 and higher */ /* * This can't use an array because 32-bit values may be in bitfields */ typedef struct { Fixed matrix11 B32; Fixed matrix12 B32; Fixed matrix13 B32; Fixed matrix21 B32; Fixed matrix22 B32; Fixed matrix23 B32; Fixed matrix31 B32; Fixed matrix32 B32; Fixed matrix33 B32; } xRenderTransform; #define sz_xRenderTransform 36 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture picture B32; xRenderTransform transform; } xRenderSetPictureTransformReq; #define sz_xRenderSetPictureTransformReq 44 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Drawable drawable B32; } xRenderQueryFiltersReq; #define sz_xRenderQueryFiltersReq 8 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numAliases B32; /* LISTofCARD16 */ CARD32 numFilters B32; /* LISTofSTRING8 */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRenderQueryFiltersReply; #define sz_xRenderQueryFiltersReply 32 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture picture B32; CARD16 nbytes B16; /* number of bytes in name */ CARD16 pad B16; } xRenderSetPictureFilterReq; #define sz_xRenderSetPictureFilterReq 12 /* 0.8 and higher */ typedef struct { Cursor cursor B32; CARD32 delay B32; } xAnimCursorElt; #define sz_xAnimCursorElt 8 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Cursor cid B32; } xRenderCreateAnimCursorReq; #define sz_xRenderCreateAnimCursorReq 8 /* 0.9 and higher */ typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture picture; INT16 xOff B16; INT16 yOff B16; } xRenderAddTrapsReq; #define sz_xRenderAddTrapsReq 12 /* 0.10 and higher */ typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture pid B32; xRenderColor color; } xRenderCreateSolidFillReq; #define sz_xRenderCreateSolidFillReq 16 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture pid B32; xPointFixed p1; xPointFixed p2; CARD32 nStops; } xRenderCreateLinearGradientReq; #define sz_xRenderCreateLinearGradientReq 28 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture pid B32; xPointFixed inner; xPointFixed outer; Fixed inner_radius; Fixed outer_radius; CARD32 nStops; } xRenderCreateRadialGradientReq; #define sz_xRenderCreateRadialGradientReq 36 typedef struct { CARD8 reqType; CARD8 renderReqType; CARD16 length B16; Picture pid B32; xPointFixed center; Fixed angle; /* in degrees */ CARD32 nStops; } xRenderCreateConicalGradientReq; #define sz_xRenderCreateConicalGradientReq 24 #undef Window #undef Drawable #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef Atom #undef VisualID #undef Time #undef KeyCode #undef KeySym #undef Picture #undef PictFormat #undef Fixed #undef Glyphset #undef Glyph #endif /* _XRENDERP_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/saver.h0000644000000000000000000000355413614532331016425 0ustar /* Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #ifndef _SAVER_H_ #define _SAVER_H_ #define ScreenSaverName "MIT-SCREEN-SAVER" #define ScreenSaverPropertyName "_MIT_SCREEN_SAVER_ID" #define ScreenSaverNotifyMask 0x00000001 #define ScreenSaverCycleMask 0x00000002 #define ScreenSaverMajorVersion 1 #define ScreenSaverMinorVersion 1 #define ScreenSaverOff 0 #define ScreenSaverOn 1 #define ScreenSaverCycle 2 #define ScreenSaverDisabled 3 #define ScreenSaverBlanked 0 #define ScreenSaverInternal 1 #define ScreenSaverExternal 2 #define ScreenSaverNotify 0 #define ScreenSaverNumberEvents 1 #endif /* _SAVER_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/saverproto.h0000644000000000000000000001222313614532331017502 0ustar /* Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #ifndef _SAVERPROTO_H_ #define _SAVERPROTO_H_ #include #define Window CARD32 #define Drawable CARD32 #define Font CARD32 #define Pixmap CARD32 #define Cursor CARD32 #define Colormap CARD32 #define GContext CARD32 #define Atom CARD32 #define VisualID CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define X_ScreenSaverQueryVersion 0 typedef struct _ScreenSaverQueryVersion { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverQueryVersion */ CARD16 length B16; CARD8 clientMajor; CARD8 clientMinor; CARD16 unused B16; } xScreenSaverQueryVersionReq; #define sz_xScreenSaverQueryVersionReq 8 typedef struct { CARD8 type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of protocol */ CARD16 minorVersion B16; /* minor version of protocol */ CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xScreenSaverQueryVersionReply; #define sz_xScreenSaverQueryVersionReply 32 #define X_ScreenSaverQueryInfo 1 typedef struct _ScreenSaverQueryInfo { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverQueryInfo */ CARD16 length B16; Drawable drawable B32; } xScreenSaverQueryInfoReq; #define sz_xScreenSaverQueryInfoReq 8 typedef struct { CARD8 type; /* X_Reply */ BYTE state; /* Off, On */ CARD16 sequenceNumber B16; CARD32 length B32; Window window B32; CARD32 tilOrSince B32; CARD32 idle B32; CARD32 eventMask B32; BYTE kind; /* Blanked, Internal, External */ CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; } xScreenSaverQueryInfoReply; #define sz_xScreenSaverQueryInfoReply 32 #define X_ScreenSaverSelectInput 2 typedef struct _ScreenSaverSelectInput { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverSelectInput */ CARD16 length B16; Drawable drawable B32; CARD32 eventMask B32; } xScreenSaverSelectInputReq; #define sz_xScreenSaverSelectInputReq 12 #define X_ScreenSaverSetAttributes 3 typedef struct _ScreenSaverSetAttributes { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverSetAttributes */ CARD16 length B16; Drawable drawable B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; BYTE c_class; CARD8 depth; VisualID visualID B32; CARD32 mask B32; } xScreenSaverSetAttributesReq; #define sz_xScreenSaverSetAttributesReq 28 #define X_ScreenSaverUnsetAttributes 4 typedef struct _ScreenSaverUnsetAttributes { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverUnsetAttributes */ CARD16 length B16; Drawable drawable B32; } xScreenSaverUnsetAttributesReq; #define sz_xScreenSaverUnsetAttributesReq 8 #define X_ScreenSaverSuspend 5 typedef struct _ScreenSaverSuspend { CARD8 reqType; CARD8 saverReqType; CARD16 length B16; Bool suspend B32; } xScreenSaverSuspendReq; #define sz_xScreenSaverSuspendReq 8 typedef struct _ScreenSaverNotify { CARD8 type; /* always eventBase + ScreenSaverNotify */ BYTE state; /* off, on, cycle */ CARD16 sequenceNumber B16; Time timestamp B32; Window root B32; Window window B32; /* screen saver window */ BYTE kind; /* blanked, internal, external */ BYTE forced; CARD16 pad0 B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xScreenSaverNotifyEvent; #define sz_xScreenSaverNotifyEvent 32 #undef Window #undef Drawable #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef Atom #undef VisualID #undef Time #undef KeyCode #undef KeySym #endif /* _SAVERPROTO_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/scrnsaver.h0000644000000000000000000001017113614532331017304 0ustar /* * $XConsortium: scrnsaver.h,v 1.6 94/04/17 20:59:34 keith Exp $ * Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ /* $XFree86$ */ #ifndef _SCRNSAVER_H_ #define _SCRNSAVER_H_ #include #include #include typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came frome a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* screen saver window */ Window root; /* root window of event screen */ int state; /* ScreenSaverOff, ScreenSaverOn, ScreenSaverCycle*/ int kind; /* ScreenSaverBlanked, ...Internal, ...External */ Bool forced; /* extents of new region */ Time time; /* event timestamp */ } XScreenSaverNotifyEvent; typedef struct { Window window; /* screen saver window - may not exist */ int state; /* ScreenSaverOff, ScreenSaverOn, ScreenSaverDisabled*/ int kind; /* ScreenSaverBlanked, ...Internal, ...External */ unsigned long til_or_since; /* time til or since screen saver */ unsigned long idle; /* total time since last user input */ unsigned long eventMask; /* currently selected events for this client */ } XScreenSaverInfo; _XFUNCPROTOBEGIN extern Bool XScreenSaverQueryExtension ( Display* /* display */, int* /* event_base */, int* /* error_base */ ); extern Status XScreenSaverQueryVersion ( Display* /* display */, int* /* major_version */, int* /* minor_version */ ); extern XScreenSaverInfo *XScreenSaverAllocInfo ( void ); extern Status XScreenSaverQueryInfo ( Display* /* display */, Drawable /* drawable */, XScreenSaverInfo* /* info */ ); extern void XScreenSaverSelectInput ( Display* /* display */, Drawable /* drawable */, unsigned long /* eventMask */ ); extern void XScreenSaverSetAttributes ( Display* /* display */, Drawable /* drawable */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, unsigned int /* border_width */, int /* depth */, unsigned int /* class */, Visual * /* visual */, unsigned long /* valuemask */, XSetWindowAttributes * /* attributes */ ); extern void XScreenSaverUnsetAttributes ( Display* /* display */, Drawable /* drawable */ ); extern Status XScreenSaverRegister ( Display* /* display */, int /* screen */, XID /* xid */, Atom /* type */ ); extern Status XScreenSaverUnregister ( Display* /* display */, int /* screen */ ); extern Status XScreenSaverGetRegistered ( Display* /* display */, int /* screen */, XID* /* xid */, Atom* /* type */ ); _XFUNCPROTOEND #endif /* _SCRNSAVER_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/security.h0000644000000000000000000001434113614532331017150 0ustar /* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _SECURITY_H #define _SECURITY_H #define _XAUTH_STRUCT_ONLY #include /* constants that server, library, and application all need */ #define XSecurityNumberEvents 1 #define XSecurityNumberErrors 2 #define XSecurityBadAuthorization 0 #define XSecurityBadAuthorizationProtocol 1 /* trust levels */ #define XSecurityClientTrusted 0 #define XSecurityClientUntrusted 1 /* authorization attribute masks */ #define XSecurityTimeout (1<<0) #define XSecurityTrustLevel (1<<1) #define XSecurityGroup (1<<2) #define XSecurityEventMask (1<<3) #define XSecurityAllAuthorizationAttributes \ (XSecurityTimeout | XSecurityTrustLevel | XSecurityGroup | XSecurityEventMask) /* event masks */ #define XSecurityAuthorizationRevokedMask (1<<0) #define XSecurityAllEventMasks XSecurityAuthorizationRevokedMask /* event offsets */ #define XSecurityAuthorizationRevoked 0 #define XSecurityAuthorizationName "XC-QUERY-SECURITY-1" #define XSecurityAuthorizationNameLen 19 #ifndef _SECURITY_SERVER _XFUNCPROTOBEGIN Status XSecurityQueryExtension ( Display *dpy, int *major_version_return, int *minor_version_return); Xauth *XSecurityAllocXauth(void); void XSecurityFreeXauth(Xauth *auth); /* type for returned auth ids */ typedef unsigned long XSecurityAuthorization; typedef struct { unsigned int timeout; unsigned int trust_level; XID group; long event_mask; } XSecurityAuthorizationAttributes; Xauth *XSecurityGenerateAuthorization( Display *dpy, Xauth *auth_in, unsigned long valuemask, XSecurityAuthorizationAttributes *attributes, XSecurityAuthorization *auth_id_return); Status XSecurityRevokeAuthorization( Display *dpy, XSecurityAuthorization auth_id); _XFUNCPROTOEND typedef struct { int type; /* event base + XSecurityAuthorizationRevoked */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ XSecurityAuthorization auth_id; /* revoked authorization id */ } XSecurityAuthorizationRevokedEvent; #else /* _SECURITY_SERVER */ #include "input.h" /* for DeviceIntPtr */ #include "property.h" /* for PropertyPtr */ #include "pixmap.h" /* for DrawablePtr */ #include "resource.h" /* for RESTYPE */ /* resource type to pass in LookupIDByType for authorizations */ extern RESTYPE SecurityAuthorizationResType; /* this is what we store for an authorization */ typedef struct { XID id; /* resource ID */ CARD32 timeout; /* how long to live in seconds after refcnt == 0 */ unsigned int trustLevel; /* trusted/untrusted */ XID group; /* see embedding extension */ unsigned int refcnt; /* how many clients connected with this auth */ unsigned int secondsRemaining; /* overflow time amount for >49 days */ OsTimerPtr timer; /* timer for this auth */ struct _OtherClients *eventClients; /* clients wanting events */ } SecurityAuthorizationRec, *SecurityAuthorizationPtr; /* The following callback is called when a GenerateAuthorization request * is processed to sanity check the group argument. The call data will * be a pointer to a SecurityValidateGroupInfoRec (below). * Functions registered on this callback are expected to examine the * group and set the valid field to TRUE if they recognize the group as a * legitimate group. If they don't recognize it, they should not change the * valid field. */ extern CallbackListPtr SecurityValidateGroupCallback; typedef struct { XID group; /* the group that was sent in GenerateAuthorization */ Bool valid; /* did anyone recognize it? if so, set to TRUE */ } SecurityValidateGroupInfoRec; /* Proc vectors for untrusted clients, swapped and unswapped versions. * These are the same as the normal proc vectors except that extensions * that haven't declared themselves secure will have ProcBadRequest plugged * in for their major opcode dispatcher. This prevents untrusted clients * from guessing extension major opcodes and using the extension even though * the extension can't be listed or queried. */ extern int (*UntrustedProcVector[256])(ClientPtr client); extern int (*SwappedUntrustedProcVector[256])(ClientPtr client); extern Bool SecurityCheckDeviceAccess(ClientPtr client, DeviceIntPtr dev, Bool fromRequest); extern void SecurityAudit(char *format, ...); extern int XSecurityOptions(int argc, char **argv, int i); /* Give this value or higher to the -audit option to get security messages */ #define SECURITY_AUDIT_LEVEL 4 extern void SecurityCensorImage( ClientPtr client, RegionPtr pVisibleRegion, long widthBytesLine, DrawablePtr pDraw, int x, int y, int w, int h, unsigned int format, char * pBuf); #define SecurityAllowOperation 0 #define SecurityIgnoreOperation 1 #define SecurityErrorOperation 2 char SecurityCheckPropertyAccess( ClientPtr client, WindowPtr pWin, ATOM propertyName, Mask access_mode); #define SECURITY_POLICY_FILE_VERSION "version-1" char **SecurityGetSitePolicyStrings(int *n); #endif /* _SECURITY_SERVER */ #endif /* _SECURITY_H */ nx-libs-3.5.99.23/nx-X11/include/extensions/securstr.h0000644000000000000000000000655013614532331017156 0ustar /* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _SECURSTR_H #define _SECURSTR_H #include #define SECURITY_EXTENSION_NAME "SECURITY" #define SECURITY_MAJOR_VERSION 1 #define SECURITY_MINOR_VERSION 0 #define X_SecurityQueryVersion 0 #define X_SecurityGenerateAuthorization 1 #define X_SecurityRevokeAuthorization 2 typedef struct { CARD8 reqType; CARD8 securityReqType; CARD16 length B16; CARD16 majorVersion B16; CARD16 minorVersion B16; } xSecurityQueryVersionReq; #define sz_xSecurityQueryVersionReq 8 typedef struct { CARD8 type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xSecurityQueryVersionReply; #define sz_xSecurityQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 securityReqType; CARD16 length B16; CARD16 nbytesAuthProto B16; CARD16 nbytesAuthData B16; CARD32 valueMask B32; /* auth protocol name padded to 4 bytes */ /* auth protocol data padded to 4 bytes */ /* list of CARD32 values, if any */ } xSecurityGenerateAuthorizationReq; #define sz_xSecurityGenerateAuthorizationReq 12 typedef struct { CARD8 type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 authId B32; CARD16 dataLength B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xSecurityGenerateAuthorizationReply; #define sz_xSecurityGenerateAuthorizationReply 32 typedef struct { CARD8 reqType; CARD8 securityReqType; CARD16 length B16; CARD32 authId B32; } xSecurityRevokeAuthorizationReq; #define sz_xSecurityRevokeAuthorizationReq 8 typedef struct _xSecurityAuthorizationRevokedEvent { BYTE type; BYTE detail; CARD16 sequenceNumber B16; CARD32 authId B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xSecurityAuthorizationRevokedEvent; #define sz_xSecurityAuthorizationRevokedEvent 32 #endif /* _SECURSTR_H */ nx-libs-3.5.99.23/nx-X11/include/extensions/shapeconst.h0000644000000000000000000000352613614532331017453 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ********************************************************/ #ifndef _SHAPECONST_H_ #define _SHAPECONST_H_ /* * Protocol requests constants and alignment values * These would really be in SHAPE's X.h and Xproto.h equivalents */ #define SHAPENAME "SHAPE" #define SHAPE_MAJOR_VERSION 1 /* current version numbers */ #define SHAPE_MINOR_VERSION 1 #define ShapeSet 0 #define ShapeUnion 1 #define ShapeIntersect 2 #define ShapeSubtract 3 #define ShapeInvert 4 #define ShapeBounding 0 #define ShapeClip 1 #define ShapeInput 2 #define ShapeNotifyMask (1L << 0) #define ShapeNotify 0 #define ShapeNumberEvents (ShapeNotify + 1) #endif /* _SHAPECONST_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/sync.h0000644000000000000000000003217213614532331016257 0ustar /* Copyright 1991, 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /*********************************************************** Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, and Olivetti Research Limited, Cambridge, England. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Olivetti not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef _SYNC_H_ #define _SYNC_H_ #include _XFUNCPROTOBEGIN #define SYNC_NAME "SYNC" #define SYNC_MAJOR_VERSION 3 #define SYNC_MINOR_VERSION 0 #define X_SyncInitialize 0 #define X_SyncListSystemCounters 1 #define X_SyncCreateCounter 2 #define X_SyncSetCounter 3 #define X_SyncChangeCounter 4 #define X_SyncQueryCounter 5 #define X_SyncDestroyCounter 6 #define X_SyncAwait 7 #define X_SyncCreateAlarm 8 #define X_SyncChangeAlarm 9 #define X_SyncQueryAlarm 10 #define X_SyncDestroyAlarm 11 #define X_SyncSetPriority 12 #define X_SyncGetPriority 13 #define XSyncCounterNotify 0 #define XSyncAlarmNotify 1 #define XSyncAlarmNotifyMask (1L << XSyncAlarmNotify) #define XSyncNumberEvents 2L #define XSyncBadCounter 0L #define XSyncBadAlarm 1L #define XSyncNumberErrors (XSyncBadAlarm + 1) /* * Flags for Alarm Attributes */ #define XSyncCACounter (1L<<0) #define XSyncCAValueType (1L<<1) #define XSyncCAValue (1L<<2) #define XSyncCATestType (1L<<3) #define XSyncCADelta (1L<<4) #define XSyncCAEvents (1L<<5) /* * Constants for the value_type argument of various requests */ typedef enum { XSyncAbsolute, XSyncRelative } XSyncValueType; /* * Alarm Test types */ typedef enum { XSyncPositiveTransition, XSyncNegativeTransition, XSyncPositiveComparison, XSyncNegativeComparison } XSyncTestType; /* * Alarm state constants */ typedef enum { XSyncAlarmActive, XSyncAlarmInactive, XSyncAlarmDestroyed } XSyncAlarmState; typedef XID XSyncCounter; typedef XID XSyncAlarm; typedef struct _XSyncValue { int hi; unsigned int lo; } XSyncValue; /* * Macros/functions for manipulating 64 bit values */ /* have to put these prototypes before the corresponding macro definitions */ extern void XSyncIntToValue( XSyncValue* /*pv*/, int /*i*/ ); extern void XSyncIntsToValue( XSyncValue* /*pv*/, unsigned int /*l*/, int /*h*/ ); extern Bool XSyncValueGreaterThan( XSyncValue /*a*/, XSyncValue /*b*/ ); extern Bool XSyncValueLessThan( XSyncValue /*a*/, XSyncValue /*b*/ ); extern Bool XSyncValueGreaterOrEqual( XSyncValue /*a*/, XSyncValue /*b*/ ); extern Bool XSyncValueLessOrEqual( XSyncValue /*a*/, XSyncValue /*b*/ ); extern Bool XSyncValueEqual( XSyncValue /*a*/, XSyncValue /*b*/ ); extern Bool XSyncValueIsNegative( XSyncValue /*v*/ ); extern Bool XSyncValueIsZero( XSyncValue /*a*/ ); extern Bool XSyncValueIsPositive( XSyncValue /*v*/ ); extern unsigned int XSyncValueLow32( XSyncValue /*v*/ ); extern int XSyncValueHigh32( XSyncValue /*v*/ ); extern void XSyncValueAdd( XSyncValue* /*presult*/, XSyncValue /*a*/, XSyncValue /*b*/, int* /*poverflow*/ ); extern void XSyncValueSubtract( XSyncValue* /*presult*/, XSyncValue /*a*/, XSyncValue /*b*/, int* /*poverflow*/ ); extern void XSyncMaxValue( XSyncValue* /*pv*/ ); extern void XSyncMinValue( XSyncValue* /*pv*/ ); _XFUNCPROTOEND /* The _XSync macros below are for library internal use only. They exist * so that if we have to make a fix, we can change it in this one place * and have both the macro and function variants inherit the fix. */ #define _XSyncIntToValue(pv, i) ((pv)->hi=((i<0)?~0:0),(pv)->lo=(i)) #define _XSyncIntsToValue(pv, l, h) ((pv)->lo = (l), (pv)->hi = (h)) #define _XSyncValueGreaterThan(a, b)\ ((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>(b).lo)) #define _XSyncValueLessThan(a, b)\ ((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<(b).lo)) #define _XSyncValueGreaterOrEqual(a, b)\ ((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>=(b).lo)) #define _XSyncValueLessOrEqual(a, b)\ ((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<=(b).lo)) #define _XSyncValueEqual(a, b) ((a).lo==(b).lo && (a).hi==(b).hi) #define _XSyncValueIsNegative(v) (((v).hi & 0x80000000) ? 1 : 0) #define _XSyncValueIsZero(a) ((a).lo==0 && (a).hi==0) #define _XSyncValueIsPositive(v) (((v).hi & 0x80000000) ? 0 : 1) #define _XSyncValueLow32(v) ((v).lo) #define _XSyncValueHigh32(v) ((v).hi) #define _XSyncValueAdd(presult,a,b,poverflow) {\ int t = (a).lo;\ Bool signa = XSyncValueIsNegative(a);\ Bool signb = XSyncValueIsNegative(b);\ ((presult)->lo = (a).lo + (b).lo);\ ((presult)->hi = (a).hi + (b).hi);\ if (t>(presult)->lo) (presult)->hi++;\ *poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\ } #define _XSyncValueSubtract(presult,a,b,poverflow) {\ int t = (a).lo;\ Bool signa = XSyncValueIsNegative(a);\ Bool signb = XSyncValueIsNegative(b);\ ((presult)->lo = (a).lo - (b).lo);\ ((presult)->hi = (a).hi - (b).hi);\ if (t>(presult)->lo) (presult)->hi--;\ *poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\ } #define _XSyncMaxValue(pv) ((pv)->hi = 0x7fffffff, (pv)->lo = 0xffffffff) #define _XSyncMinValue(pv) ((pv)->hi = 0x80000000, (pv)->lo = 0) /* * These are the publically usable macros. If you want the function version * of one of these, just #undef the macro to uncover the function. * (This is the same convention that the ANSI C library uses.) */ #define XSyncIntToValue(pv, i) _XSyncIntToValue(pv, i) #define XSyncIntsToValue(pv, l, h) _XSyncIntsToValue(pv, l, h) #define XSyncValueGreaterThan(a, b) _XSyncValueGreaterThan(a, b) #define XSyncValueLessThan(a, b) _XSyncValueLessThan(a, b) #define XSyncValueGreaterOrEqual(a, b) _XSyncValueGreaterOrEqual(a, b) #define XSyncValueLessOrEqual(a, b) _XSyncValueLessOrEqual(a, b) #define XSyncValueEqual(a, b) _XSyncValueEqual(a, b) #define XSyncValueIsNegative(v) _XSyncValueIsNegative(v) #define XSyncValueIsZero(a) _XSyncValueIsZero(a) #define XSyncValueIsPositive(v) _XSyncValueIsPositive(v) #define XSyncValueLow32(v) _XSyncValueLow32(v) #define XSyncValueHigh32(v) _XSyncValueHigh32(v) #define XSyncValueAdd(presult,a,b,poverflow) _XSyncValueAdd(presult,a,b,poverflow) #define XSyncValueSubtract(presult,a,b,poverflow) _XSyncValueSubtract(presult,a,b,poverflow) #define XSyncMaxValue(pv) _XSyncMaxValue(pv) #define XSyncMinValue(pv) _XSyncMinValue(pv) #ifndef _SYNC_SERVER typedef struct _XSyncSystemCounter { char *name; /* null-terminated name of system counter */ XSyncCounter counter; /* counter id of this system counter */ XSyncValue resolution; /* resolution of this system counter */ } XSyncSystemCounter; typedef struct { XSyncCounter counter; /* counter to trigger on */ XSyncValueType value_type; /* absolute/relative */ XSyncValue wait_value; /* value to compare counter to */ XSyncTestType test_type; /* pos/neg comparison/transtion */ } XSyncTrigger; typedef struct { XSyncTrigger trigger; /* trigger for await */ XSyncValue event_threshold; /* send event if past threshold */ } XSyncWaitCondition; typedef struct { XSyncTrigger trigger; XSyncValue delta; Bool events; XSyncAlarmState state; } XSyncAlarmAttributes; /* * Events */ typedef struct { int type; /* event base + XSyncCounterNotify */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ XSyncCounter counter; /* counter involved in await */ XSyncValue wait_value; /* value being waited for */ XSyncValue counter_value; /* counter value when this event was sent */ Time time; /* milliseconds */ int count; /* how many more events to come */ Bool destroyed; /* True if counter was destroyed */ } XSyncCounterNotifyEvent; typedef struct { int type; /* event base + XSyncCounterNotify */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ XSyncAlarm alarm; /* alarm that triggered */ XSyncValue counter_value; /* value that triggered the alarm */ XSyncValue alarm_value; /* test value of trigger in alarm */ Time time; /* milliseconds */ XSyncAlarmState state; /* new state of alarm */ } XSyncAlarmNotifyEvent; /* * Errors */ typedef struct { int type; Display *display; /* Display the event was read from */ XSyncAlarm alarm; /* resource id */ unsigned long serial; /* serial number of failed request */ unsigned char error_code; /* error base + XSyncBadAlarm */ unsigned char request_code; /* Major op-code of failed request */ unsigned char minor_code; /* Minor op-code of failed request */ } XSyncAlarmError; typedef struct { int type; Display *display; /* Display the event was read from */ XSyncCounter counter; /* resource id */ unsigned long serial; /* serial number of failed request */ unsigned char error_code; /* error base + XSyncBadCounter */ unsigned char request_code; /* Major op-code of failed request */ unsigned char minor_code; /* Minor op-code of failed request */ } XSyncCounterError; /* * Prototypes */ _XFUNCPROTOBEGIN extern Status XSyncQueryExtension( Display* /*dpy*/, int* /*event_base_return*/, int* /*error_base_return*/ ); extern Status XSyncInitialize( Display* /*dpy*/, int* /*major_version_return*/, int* /*minor_version_return*/ ); extern XSyncSystemCounter *XSyncListSystemCounters( Display* /*dpy*/, int* /*n_counters_return*/ ); extern void XSyncFreeSystemCounterList( XSyncSystemCounter* /*list*/ ); extern XSyncCounter XSyncCreateCounter( Display* /*dpy*/, XSyncValue /*initial_value*/ ); extern Status XSyncSetCounter( Display* /*dpy*/, XSyncCounter /*counter*/, XSyncValue /*value*/ ); extern Status XSyncChangeCounter( Display* /*dpy*/, XSyncCounter /*counter*/, XSyncValue /*value*/ ); extern Status XSyncDestroyCounter( Display* /*dpy*/, XSyncCounter /*counter*/ ); extern Status XSyncQueryCounter( Display* /*dpy*/, XSyncCounter /*counter*/, XSyncValue* /*value_return*/ ); extern Status XSyncAwait( Display* /*dpy*/, XSyncWaitCondition* /*wait_list*/, int /*n_conditions*/ ); extern XSyncAlarm XSyncCreateAlarm( Display* /*dpy*/, unsigned long /*values_mask*/, XSyncAlarmAttributes* /*values*/ ); extern Status XSyncDestroyAlarm( Display* /*dpy*/, XSyncAlarm /*alarm*/ ); extern Status XSyncQueryAlarm( Display* /*dpy*/, XSyncAlarm /*alarm*/, XSyncAlarmAttributes* /*values_return*/ ); extern Status XSyncChangeAlarm( Display* /*dpy*/, XSyncAlarm /*alarm*/, unsigned long /*values_mask*/, XSyncAlarmAttributes* /*values*/ ); extern Status XSyncSetPriority( Display* /*dpy*/, XID /*client_resource_id*/, int /*priority*/ ); extern Status XSyncGetPriority( Display* /*dpy*/, XID /*client_resource_id*/, int* /*return_priority*/ ); #endif /* _SYNC_SERVER */ _XFUNCPROTOEND #endif /* _SYNC_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/syncstr.h0000644000000000000000000002751413614532331017014 0ustar /* Copyright 1991, 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /*********************************************************** Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, and Olivetti Research Limited, Cambridge, England. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Olivetti not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef _SYNCSTR_H_ #define _SYNCSTR_H_ #include "sync.h" #ifndef _SYNC_OS /* cover up types from sync.h to make sure they're the right size for * protocol packaging. These will be undef'ed after all the protocol * structures are defined. */ #define XSyncCounter CARD32 #define XSyncAlarm CARD32 /* * Initialize */ typedef struct _xSyncInitialize { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; CARD8 majorVersion; CARD8 minorVersion; CARD16 pad B16; } xSyncInitializeReq; #define sz_xSyncInitializeReq 8 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD8 majorVersion; CARD8 minorVersion; CARD16 pad B16; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xSyncInitializeReply; #define sz_xSyncInitializeReply 32 /* * ListSystemCounters */ typedef struct _xSyncListSystemCounters { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; } xSyncListSystemCountersReq; #define sz_xSyncListSystemCountersReq 4 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; INT32 nCounters B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xSyncListSystemCountersReply; #define sz_xSyncListSystemCountersReply 32 typedef struct { XSyncCounter counter B32; INT32 resolution_hi B32; CARD32 resolution_lo B32; CARD16 name_length B16; } xSyncSystemCounter; #define sz_xSyncSystemCounter 14 /* * Create Counter */ typedef struct _xSyncCreateCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter cid B32; INT32 initial_value_hi B32; CARD32 initial_value_lo B32; } xSyncCreateCounterReq; #define sz_xSyncCreateCounterReq 16 /* * Change Counter */ typedef struct _xSyncChangeCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter cid B32; INT32 value_hi B32; CARD32 value_lo B32; } xSyncChangeCounterReq; #define sz_xSyncChangeCounterReq 16 /* * Set Counter */ typedef struct _xSyncSetCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter cid B32; INT32 value_hi B32; CARD32 value_lo B32; } xSyncSetCounterReq; #define sz_xSyncSetCounterReq 16 /* * Destroy Counter */ typedef struct _xSyncDestroyCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter counter B32; } xSyncDestroyCounterReq; #define sz_xSyncDestroyCounterReq 8 /* * Query Counter */ typedef struct _xSyncQueryCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter counter B32; } xSyncQueryCounterReq; #define sz_xSyncQueryCounterReq 8 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; INT32 value_hi B32; CARD32 value_lo B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xSyncQueryCounterReply; #define sz_xSyncQueryCounterReply 32 /* * Await */ typedef struct _xSyncAwaitReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; } xSyncAwaitReq; #define sz_xSyncAwaitReq 4 typedef struct _xSyncWaitCondition { XSyncCounter counter B32; CARD32 value_type B32; INT32 wait_value_hi B32; CARD32 wait_value_lo B32; CARD32 test_type B32; INT32 event_threshold_hi B32; CARD32 event_threshold_lo B32; } xSyncWaitCondition; #define sz_xSyncWaitCondition 28 /* * Create Alarm */ typedef struct _xSyncCreateAlarmReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncAlarm id B32; CARD32 valueMask B32; } xSyncCreateAlarmReq; #define sz_xSyncCreateAlarmReq 12 /* * Destroy Alarm */ typedef struct _xSyncDestroyAlarmReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncAlarm alarm B32; } xSyncDestroyAlarmReq; #define sz_xSyncDestroyAlarmReq 8 /* * Query Alarm */ typedef struct _xSyncQueryAlarmReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncAlarm alarm B32; } xSyncQueryAlarmReq; #define sz_xSyncQueryAlarmReq 8 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; XSyncCounter counter B32; CARD32 value_type B32; INT32 wait_value_hi B32; CARD32 wait_value_lo B32; CARD32 test_type B32; INT32 delta_hi B32; CARD32 delta_lo B32; BOOL events; BYTE state; BYTE pad0; BYTE pad1; } xSyncQueryAlarmReply; #define sz_xSyncQueryAlarmReply 40 /* * Change Alarm */ typedef struct _xSyncChangeAlarmReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncAlarm alarm B32; CARD32 valueMask B32; } xSyncChangeAlarmReq; #define sz_xSyncChangeAlarmReq 12 /* * SetPriority */ typedef struct _xSyncSetPriority{ CARD8 reqType; CARD8 syncReqType; CARD16 length B16; CARD32 id B32; INT32 priority B32; } xSyncSetPriorityReq; #define sz_xSyncSetPriorityReq 12 /* * Get Priority */ typedef struct _xSyncGetPriority{ CARD8 reqType; CARD8 syncReqType; CARD16 length B16; CARD32 id B32; /*XXX XID? */ } xSyncGetPriorityReq; #define sz_xSyncGetPriorityReq 8 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; INT32 priority B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xSyncGetPriorityReply; #define sz_xSyncGetPriorityReply 32 /* * Events */ typedef struct _xSyncCounterNotifyEvent { BYTE type; BYTE kind; CARD16 sequenceNumber B16; XSyncCounter counter B32; INT32 wait_value_hi B32; CARD32 wait_value_lo B32; INT32 counter_value_hi B32; CARD32 counter_value_lo B32; CARD32 time B32; CARD16 count B16; BOOL destroyed; BYTE pad0; } xSyncCounterNotifyEvent; typedef struct _xSyncAlarmNotifyEvent { BYTE type; BYTE kind; CARD16 sequenceNumber B16; XSyncAlarm alarm B32; INT32 counter_value_hi B32; CARD32 counter_value_lo B32; INT32 alarm_value_hi B32; CARD32 alarm_value_lo B32; CARD32 time B32; CARD8 state; BYTE pad0; BYTE pad1; BYTE pad2; } xSyncAlarmNotifyEvent; #undef XSyncCounter #undef XSyncAlarm #endif /* _SYNC_OS */ #ifdef _SYNC_SERVER #define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */ typedef struct _SyncCounter { ClientPtr client; /* Owning client. 0 for system counters */ XSyncCounter id; /* resource ID */ CARD64 value; /* counter value */ struct _SyncTriggerList *pTriglist; /* list of triggers */ Bool beingDestroyed; /* in process of going away */ struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */ } SyncCounter; /* * The System Counter interface */ typedef enum { XSyncCounterNeverChanges, XSyncCounterNeverIncreases, XSyncCounterNeverDecreases, XSyncCounterUnrestricted } SyncCounterType; typedef struct _SysCounterInfo { char *name; CARD64 resolution; CARD64 bracket_greater; CARD64 bracket_less; SyncCounterType counterType; /* how can this counter change */ void (*QueryValue)( void * /*pCounter*/, CARD64 * /*freshvalue*/ ); void (*BracketValues)( void * /*pCounter*/, CARD64 * /*lessthan*/, CARD64 * /*greaterthan*/ ); } SysCounterInfo; typedef struct _SyncTrigger { SyncCounter *pCounter; CARD64 wait_value; /* wait value */ unsigned int value_type; /* Absolute or Relative */ unsigned int test_type; /* transition or Comparision type */ CARD64 test_value; /* trigger event threshold value */ Bool (*CheckTrigger)( struct _SyncTrigger * /*pTrigger*/, CARD64 /*newval*/ ); void (*TriggerFired)( struct _SyncTrigger * /*pTrigger*/ ); void (*CounterDestroyed)( struct _SyncTrigger * /*pTrigger*/ ); } SyncTrigger; typedef struct _SyncTriggerList { SyncTrigger *pTrigger; struct _SyncTriggerList *next; } SyncTriggerList; typedef struct _SyncAlarmClientList { ClientPtr client; XID delete_id; struct _SyncAlarmClientList *next; } SyncAlarmClientList; typedef struct _SyncAlarm { SyncTrigger trigger; ClientPtr client; XSyncAlarm alarm_id; CARD64 delta; int events; int state; SyncAlarmClientList *pEventClients; } SyncAlarm; typedef struct { ClientPtr client; CARD32 delete_id; int num_waitconditions; } SyncAwaitHeader; typedef struct { SyncTrigger trigger; CARD64 event_threshold; SyncAwaitHeader *pHeader; } SyncAwait; typedef union { SyncAwaitHeader header; SyncAwait await; } SyncAwaitUnion; extern void * SyncCreateSystemCounter( char * /* name */, CARD64 /* inital_value */, CARD64 /* resolution */, SyncCounterType /* change characterization */, void (* /*QueryValue*/ ) ( void * /* pCounter */, CARD64 * /* pValue_return */), /* XXX prototype */ void (* /*BracketValues*/) ( void * /* pCounter */, CARD64 * /* pbracket_less */, CARD64 * /* pbracket_greater */) ); extern void SyncChangeCounter( SyncCounter * /* pCounter*/, CARD64 /* new_value */ ); extern void SyncDestroySystemCounter( void * pCounter ); extern void InitServertime(void); #endif /* _SYNC_SERVER */ #endif /* _SYNCSTR_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/xcmiscstr.h0000644000000000000000000000616513614532331017325 0ustar /* Copyright 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* $XFree86$ */ #ifndef _XCMISCSTR_H_ #define _XCMISCSTR_H_ #define X_XCMiscGetVersion 0 #define X_XCMiscGetXIDRange 1 #define X_XCMiscGetXIDList 2 #define XCMiscNumberEvents 0 #define XCMiscNumberErrors 0 #define XCMiscMajorVersion 1 #define XCMiscMinorVersion 1 #define XCMiscExtensionName "XC-MISC" typedef struct { CARD8 reqType; /* always XCMiscCode */ CARD8 miscReqType; /* always X_XCMiscGetVersion */ CARD16 length B16; CARD16 majorVersion B16; CARD16 minorVersion B16; } xXCMiscGetVersionReq; #define sz_xXCMiscGetVersionReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXCMiscGetVersionReply; #define sz_xXCMiscGetVersionReply 32 typedef struct { CARD8 reqType; /* always XCMiscCode */ CARD8 miscReqType; /* always X_XCMiscGetXIDRange */ CARD16 length B16; } xXCMiscGetXIDRangeReq; #define sz_xXCMiscGetXIDRangeReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 start_id B32; CARD32 count B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xXCMiscGetXIDRangeReply; #define sz_xXCMiscGetXIDRangeReply 32 typedef struct { CARD8 reqType; /* always XCMiscCode */ CARD8 miscReqType; /* always X_XCMiscGetXIDList */ CARD16 length B16; CARD32 count B32; /* number of IDs requested */ } xXCMiscGetXIDListReq; #define sz_xXCMiscGetXIDListReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 count B32; /* number of IDs requested */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXCMiscGetXIDListReply; #define sz_xXCMiscGetXIDListReply 32 #endif /* _XCMISCSTR_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/Xdbeproto.h0000644000000000000000000002105113614532331017243 0ustar /****************************************************************************** * * Copyright (c) 1994, 1995 Hewlett-Packard Company * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the Hewlett-Packard * Company shall not be used in advertising or otherwise to promote the * sale, use or other dealings in this Software without prior written * authorization from the Hewlett-Packard Company. * * Header file for Xlib-related DBE * *****************************************************************************/ #ifndef XDBE_PROTO_H #define XDBE_PROTO_H /* INCLUDES */ /* DEFINES */ /* Values for swap_action field of XdbeSwapInfo structure */ #define XdbeUndefined 0 #define XdbeBackground 1 #define XdbeUntouched 2 #define XdbeCopied 3 #ifdef NEED_DBE_PROTOCOL #define DBE_PROTOCOL_NAME "DOUBLE-BUFFER" /* Current version numbers */ #define DBE_MAJOR_VERSION 1 #define DBE_MINOR_VERSION 0 /* Used when adding extension; also used in Xdbe macros */ #define DbeNumberEvents 0 #define DbeBadBuffer 0 #define DbeNumberErrors (DbeBadBuffer + 1) /* Request values used in (S)ProcDbeDispatch() */ #define X_DbeGetVersion 0 #define X_DbeAllocateBackBufferName 1 #define X_DbeDeallocateBackBufferName 2 #define X_DbeSwapBuffers 3 #define X_DbeBeginIdiom 4 #define X_DbeEndIdiom 5 #define X_DbeGetVisualInfo 6 #define X_DbeGetBackBufferAttributes 7 typedef CARD8 xDbeSwapAction; typedef CARD32 xDbeBackBuffer; #endif /* NEED_DBE_PROTOCOL */ /* TYPEDEFS */ /* Client data types */ /* XdbeVisualInfo and XdbeScreenVisualInfo are defined in this file, * "Xdbeproto.h", rather than "Xdbe.h" because the server uses these data * types. */ typedef struct { VisualID visual; /* one visual ID that supports double-buffering */ int depth; /* depth of visual in bits */ int perflevel; /* performance level of visual */ } XdbeVisualInfo; typedef struct { int count; /* number of items in visual_depth */ XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */ } XdbeScreenVisualInfo; /* Protocol data types */ #ifdef NEED_DBE_PROTOCOL typedef struct { CARD32 window B32; /* window */ xDbeSwapAction swapAction; /* swap action */ CARD8 pad1; /* unused */ CARD16 pad2 B16; } xDbeSwapInfo; typedef struct { CARD32 visualID B32; /* associated visual */ CARD8 depth; /* depth of visual */ CARD8 perfLevel; /* performance level hint */ CARD16 pad1 B16; } xDbeVisInfo; #define sz_xDbeVisInfo 8 typedef struct { CARD32 n B32; /* number of visual info items in list */ } xDbeScreenVisInfo; /* followed by n xDbeVisInfo items */ typedef struct { CARD32 window B32; /* window */ } xDbeBufferAttributes; /* Requests and replies */ typedef struct { CARD8 reqType; /* major-opcode: always codes->major_opcode */ CARD8 dbeReqType; /* minor-opcode: always X_DbeGetVersion (0) */ CARD16 length B16; /* request length: (2) */ CARD8 majorVersion; /* client-major-version */ CARD8 minorVersion; /* client-minor-version */ CARD16 unused B16; /* unused */ } xDbeGetVersionReq; #define sz_xDbeGetVersionReq 8 typedef struct { BYTE type; /* Reply: X_Reply (1) */ CARD8 unused; /* unused */ CARD16 sequenceNumber B16; /* sequence number */ CARD32 length B32; /* reply length: (0) */ CARD8 majorVersion; /* server-major-version */ CARD8 minorVersion; /* server-minor-version */ CARD16 pad1 B16; /* unused */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xDbeGetVersionReply; #define sz_xDbeGetVersionReply 32 typedef struct { CARD8 reqType; /* major-opcode: codes->major_opcode */ CARD8 dbeReqType; /* X_DbeAllocateBackBufferName (1) */ CARD16 length B16; /* request length: (4) */ CARD32 window B32; /* window */ xDbeBackBuffer buffer B32; /* back buffer name */ xDbeSwapAction swapAction; /* swap action hint */ CARD8 pad1; /* unused */ CARD16 pad2 B16; } xDbeAllocateBackBufferNameReq; #define sz_xDbeAllocateBackBufferNameReq 16 typedef struct { CARD8 reqType; /* major-opcode: codes->major_opcode */ CARD8 dbeReqType; /* X_DbeDeallocateBackBufferName (2) */ CARD16 length B16; /* request length: (2) */ xDbeBackBuffer buffer B32; /* back buffer name */ } xDbeDeallocateBackBufferNameReq; #define sz_xDbeDeallocateBackBufferNameReq 8 typedef struct { CARD8 reqType; /* major-opcode: always codes->major_opcode */ CARD8 dbeReqType; /* minor-opcode: always X_DbeSwapBuffers (3) */ CARD16 length B16; /* request length: (2+2n) */ CARD32 n B32; /* n, number of window/swap action pairs */ } xDbeSwapBuffersReq; /* followed by n window/swap action pairs */ #define sz_xDbeSwapBuffersReq 8 typedef struct { CARD8 reqType; /* major-opcode: always codes->major_opcode */ CARD8 dbeReqType; /* minor-opcode: always X_DbeBeginIdom (4) */ CARD16 length B16; /* request length: (1) */ } xDbeBeginIdiomReq; #define sz_xDbeBeginIdiomReq 4 typedef struct { CARD8 reqType; /* major-opcode: always codes->major_opcode */ CARD8 dbeReqType; /* minor-opcode: always X_DbeEndIdom (5) */ CARD16 length B16; /* request length: (1) */ } xDbeEndIdiomReq; #define sz_xDbeEndIdiomReq 4 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 dbeReqType; /* always X_DbeGetVisualInfo (6) */ CARD16 length B16; /* request length: (2+n) */ CARD32 n B32; /* n, number of drawables in list */ } xDbeGetVisualInfoReq; /* followed by n drawables */ #define sz_xDbeGetVisualInfoReq 8 typedef struct { BYTE type; /* Reply: X_Reply (1) */ CARD8 unused; /* unused */ CARD16 sequenceNumber B16; /* sequence number */ CARD32 length B32; /* reply length */ CARD32 m; /* m, number of visual infos in list */ CARD32 pad1 B32; /* unused */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDbeGetVisualInfoReply; /* followed by m visual infos */ #define sz_xDbeGetVisualInfoReply 32 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 dbeReqType; /* X_DbeGetBackBufferAttributes (7) */ CARD16 length B16; /* request length: (2) */ xDbeBackBuffer buffer B32; /* back buffer name */ } xDbeGetBackBufferAttributesReq; #define sz_xDbeGetBackBufferAttributesReq 8 typedef struct { BYTE type; /* Reply: X_Reply (1) */ CARD8 unused; /* unused */ CARD16 sequenceNumber B16; /* sequence number */ CARD32 length B32; /* reply length: (0) */ CARD32 attributes; /* attributes */ CARD32 pad1 B32; /* unused */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDbeGetBackBufferAttributesReply; #define sz_xDbeGetBackBufferAttributesReply 32 #endif /* NEED_DBE_PROTOCOL */ #endif /* XDBE_PROTO_H */ nx-libs-3.5.99.23/nx-X11/include/extensions/xf86bigfont.h0000644000000000000000000000130013614532331017434 0ustar /* * Declarations for the BIGFONT extension. * * Copyright (c) 1999-2000 Bruno Haible * Copyright (c) 1999-2000 The XFree86 Project, Inc. */ /* THIS IS NOT AN X CONSORTIUM STANDARD */ #ifndef _XF86BIGFONT_H_ #define _XF86BIGFONT_H_ #include #define X_XF86BigfontQueryVersion 0 #define X_XF86BigfontQueryFont 1 #define XF86BigfontNumberEvents 0 #define XF86BigfontNumberErrors 0 #ifdef _XF86BIGFONT_SERVER_ _XFUNCPROTOBEGIN #include extern void XFree86BigfontExtensionInit(void); extern void XF86BigfontFreeFontShm(FontPtr); extern void XF86BigfontCleanup(void); _XFUNCPROTOEND #endif /* _XF86BIGFONT_SERVER_ */ #endif /* _XF86BIGFONT_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/xf86bigfproto.h0000644000000000000000000000506113614532331020007 0ustar /* * Declarations of request structures for the BIGFONT extension. * * Copyright (c) 1999-2000 Bruno Haible * Copyright (c) 1999-2000 The XFree86 Project, Inc. */ /* THIS IS NOT AN X CONSORTIUM STANDARD */ #ifndef _XF86BIGFPROTO_H_ #define _XF86BIGFPROTO_H_ #include #define XF86BIGFONTNAME "XFree86-Bigfont" #define XF86BIGFONT_MAJOR_VERSION 1 /* current version numbers */ #define XF86BIGFONT_MINOR_VERSION 1 typedef struct _XF86BigfontQueryVersion { CARD8 reqType; /* always XF86BigfontReqCode */ CARD8 xf86bigfontReqType; /* always X_XF86BigfontQueryVersion */ CARD16 length B16; } xXF86BigfontQueryVersionReq; #define sz_xXF86BigfontQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 capabilities; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of XFree86-Bigfont */ CARD16 minorVersion B16; /* minor version of XFree86-Bigfont */ CARD32 uid B32; CARD32 gid B32; CARD32 signature B32; CARD32 pad1 B32; CARD32 pad2 B32; } xXF86BigfontQueryVersionReply; #define sz_xXF86BigfontQueryVersionReply 32 /* Bit masks that can be set in the capabilities */ #define XF86Bigfont_CAP_LocalShm 1 typedef struct _XF86BigfontQueryFont { CARD8 reqType; /* always XF86BigfontReqCode */ CARD8 xf86bigfontReqType; /* always X_XF86BigfontQueryFont */ CARD16 length B16; CARD32 id B32; CARD32 flags B32; } xXF86BigfontQueryFontReq; #define sz_xXF86BigfontQueryFontReq 12 typedef struct { BYTE type; /* X_Reply */ CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; xCharInfo minBounds; CARD32 walign1 B32; xCharInfo maxBounds; CARD32 walign2 B32; CARD16 minCharOrByte2 B16; CARD16 maxCharOrByte2 B16; CARD16 defaultChar B16; CARD16 nFontProps B16; CARD8 drawDirection; CARD8 minByte1; CARD8 maxByte1; BOOL allCharsExist; INT16 fontAscent B16; INT16 fontDescent B16; CARD32 nCharInfos B32; CARD32 nUniqCharInfos B32; CARD32 shmid B32; CARD32 shmsegoffset B32; /* followed by nFontProps xFontProp structures */ /* and if nCharInfos > 0 && shmid == -1, followed by nUniqCharInfos xCharInfo structures and then by nCharInfos CARD16 indices (each >= 0, < nUniqCharInfos) and then, if nCharInfos is odd, one more CARD16 for padding. */ } xXF86BigfontQueryFontReply; #define sz_xXF86BigfontQueryFontReply 72 /* Bit masks that can be set in the flags */ #define XF86Bigfont_FLAGS_Shm 1 #endif /* _XF86BIGFPROTO_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/xfixesproto.h0000644000000000000000000003217713614532331017702 0ustar /* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /* * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _XFIXESPROTO_H_ #define _XFIXESPROTO_H_ #include #include #include #define Window CARD32 #define Drawable CARD32 #define Font CARD32 #define Pixmap CARD32 #define Cursor CARD32 #define Colormap CARD32 #define GContext CARD32 #define Atom CARD32 #define VisualID CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define Picture CARD32 /*************** Version 1 ******************/ typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; } xXFixesReq; /* * requests and replies */ typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xXFixesQueryVersionReq; #define sz_xXFixesQueryVersionReq 12 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXFixesQueryVersionReply; #define sz_xXFixesQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; BYTE mode; /* SetModeInsert/SetModeDelete*/ BYTE target; /* SaveSetNearest/SaveSetRoot*/ BYTE map; /* SaveSetMap/SaveSetUnmap */ BYTE pad1; Window window; } xXFixesChangeSaveSetReq; #define sz_xXFixesChangeSaveSetReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Window window B32; Atom selection B32; CARD32 eventMask B32; } xXFixesSelectSelectionInputReq; #define sz_xXFixesSelectSelectionInputReq 16 typedef struct { CARD8 type; CARD8 subtype; CARD16 sequenceNumber B16; Window window B32; Window owner B32; Atom selection B32; Time timestamp B32; Time selectionTimestamp B32; CARD32 pad2 B32; CARD32 pad3 B32; } xXFixesSelectionNotifyEvent; typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Window window B32; CARD32 eventMask B32; } xXFixesSelectCursorInputReq; #define sz_xXFixesSelectCursorInputReq 12 typedef struct { CARD8 type; CARD8 subtype; CARD16 sequenceNumber B16; Window window B32; CARD32 cursorSerial B32; Time timestamp; Atom name B32; /* Version 2 */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xXFixesCursorNotifyEvent; typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; } xXFixesGetCursorImageReq; #define sz_xXFixesGetCursorImageReq 4 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; CARD16 xhot B16; CARD16 yhot B16; CARD32 cursorSerial B32; CARD32 pad2 B32; CARD32 pad3 B32; } xXFixesGetCursorImageReply; #define sz_xXFixesGetCursorImageReply 32 /*************** Version 2 ******************/ #define Region CARD32 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; /* LISTofRECTANGLE */ } xXFixesCreateRegionReq; #define sz_xXFixesCreateRegionReq 8 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; Pixmap bitmap B32; } xXFixesCreateRegionFromBitmapReq; #define sz_xXFixesCreateRegionFromBitmapReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; Window window B32; CARD8 kind; CARD8 pad1; CARD16 pad2 B16; } xXFixesCreateRegionFromWindowReq; #define sz_xXFixesCreateRegionFromWindowReq 16 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; GContext gc B32; } xXFixesCreateRegionFromGCReq; #define sz_xXFixesCreateRegionFromGCReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; Picture picture B32; } xXFixesCreateRegionFromPictureReq; #define sz_xXFixesCreateRegionFromPictureReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; } xXFixesDestroyRegionReq; #define sz_xXFixesDestroyRegionReq 8 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; /* LISTofRECTANGLE */ } xXFixesSetRegionReq; #define sz_xXFixesSetRegionReq 8 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region source B32; Region destination B32; } xXFixesCopyRegionReq; #define sz_xXFixesCopyRegionReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region source1 B32; Region source2 B32; Region destination B32; } xXFixesCombineRegionReq, xXFixesUnionRegionReq, xXFixesIntersectRegionReq, xXFixesSubtractRegionReq; #define sz_xXFixesCombineRegionReq 16 #define sz_xXFixesUnionRegionReq sz_xXFixesCombineRegionReq #define sz_xXFixesIntersectRegionReq sz_xXFixesCombineRegionReq #define sz_xXFixesSubtractRegionReq sz_xXFixesCombineRegionReq typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region source B32; INT16 x B16, y B16; CARD16 width B16, height B16; Region destination B32; } xXFixesInvertRegionReq; #define sz_xXFixesInvertRegionReq 20 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; INT16 dx B16, dy B16; } xXFixesTranslateRegionReq; #define sz_xXFixesTranslateRegionReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region source B32; Region destination B32; } xXFixesRegionExtentsReq; #define sz_xXFixesRegionExtentsReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region region B32; } xXFixesFetchRegionReq; #define sz_xXFixesFetchRegionReq 8 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; INT16 x B16, y B16; CARD16 width B16, height B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXFixesFetchRegionReply; #define sz_xXFixesFetchRegionReply 32 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; GContext gc B32; Region region B32; INT16 xOrigin B16, yOrigin B16; } xXFixesSetGCClipRegionReq; #define sz_xXFixesSetGCClipRegionReq 16 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Window dest; BYTE destKind; CARD8 pad1; CARD16 pad2 B16; INT16 xOff B16, yOff B16; Region region; } xXFixesSetWindowShapeRegionReq; #define sz_xXFixesSetWindowShapeRegionReq 20 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Picture picture B32; Region region B32; INT16 xOrigin B16, yOrigin B16; } xXFixesSetPictureClipRegionReq; #define sz_xXFixesSetPictureClipRegionReq 16 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Cursor cursor B32; CARD16 nbytes B16; CARD16 pad B16; } xXFixesSetCursorNameReq; #define sz_xXFixesSetCursorNameReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Cursor cursor B32; } xXFixesGetCursorNameReq; #define sz_xXFixesGetCursorNameReq 8 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; Atom atom B32; CARD16 nbytes B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXFixesGetCursorNameReply; #define sz_xXFixesGetCursorNameReply 32 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; } xXFixesGetCursorImageAndNameReq; #define sz_xXFixesGetCursorImageAndNameReq 4 typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; CARD16 xhot B16; CARD16 yhot B16; CARD32 cursorSerial B32; Atom cursorName B32; CARD16 nbytes B16; CARD16 pad B16; } xXFixesGetCursorImageAndNameReply; #define sz_xXFixesGetCursorImageAndNameReply 32 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Cursor source B32; Cursor destination B32; } xXFixesChangeCursorReq; #define sz_xXFixesChangeCursorReq 12 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Cursor source B32; CARD16 nbytes; CARD16 pad; } xXFixesChangeCursorByNameReq; #define sz_xXFixesChangeCursorByNameReq 12 /*************** Version 3 ******************/ typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Region source B32; Region destination B32; CARD16 left B16; CARD16 right B16; CARD16 top B16; CARD16 bottom B16; } xXFixesExpandRegionReq; #define sz_xXFixesExpandRegionReq 20 /*************** Version 4.0 ******************/ typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Window window B32; } xXFixesHideCursorReq; #define sz_xXFixesHideCursorReq sizeof(xXFixesHideCursorReq) typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Window window B32; } xXFixesShowCursorReq; #define sz_xXFixesShowCursorReq sizeof(xXFixesShowCursorReq) /*************** Version 5.0 ******************/ #define Barrier CARD32 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Barrier barrier B32; Window window B32; INT16 x1 B16; INT16 y1 B16; INT16 x2 B16; INT16 y2 B16; CARD32 directions; CARD16 pad B16; CARD16 num_devices B16; /* array of CARD16 devices */ } xXFixesCreatePointerBarrierReq; #define sz_xXFixesCreatePointerBarrierReq 28 typedef struct { CARD8 reqType; CARD8 xfixesReqType; CARD16 length B16; Barrier barrier B32; } xXFixesDestroyPointerBarrierReq; #define sz_xXFixesDestroyPointerBarrierReq 8 #undef Barrier #undef Region #undef Picture #undef Window #undef Drawable #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef Atom #undef VisualID #undef Time #undef KeyCode #undef KeySym #endif /* _XFIXESPROTO_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/xfixeswire.h0000644000000000000000000001242413614532331017476 0ustar /* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /* * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _XFIXESWIRE_H_ #define _XFIXESWIRE_H_ #define XFIXES_NAME "XFIXES" #define XFIXES_MAJOR 4 #define XFIXES_MINOR 0 /*************** Version 1 ******************/ #define X_XFixesQueryVersion 0 #define X_XFixesChangeSaveSet 1 #define X_XFixesSelectSelectionInput 2 #define X_XFixesSelectCursorInput 3 #define X_XFixesGetCursorImage 4 /*************** Version 2 ******************/ #define X_XFixesCreateRegion 5 #define X_XFixesCreateRegionFromBitmap 6 #define X_XFixesCreateRegionFromWindow 7 #define X_XFixesCreateRegionFromGC 8 #define X_XFixesCreateRegionFromPicture 9 #define X_XFixesDestroyRegion 10 #define X_XFixesSetRegion 11 #define X_XFixesCopyRegion 12 #define X_XFixesUnionRegion 13 #define X_XFixesIntersectRegion 14 #define X_XFixesSubtractRegion 15 #define X_XFixesInvertRegion 16 #define X_XFixesTranslateRegion 17 #define X_XFixesRegionExtents 18 #define X_XFixesFetchRegion 19 #define X_XFixesSetGCClipRegion 20 #define X_XFixesSetWindowShapeRegion 21 #define X_XFixesSetPictureClipRegion 22 #define X_XFixesSetCursorName 23 #define X_XFixesGetCursorName 24 #define X_XFixesGetCursorImageAndName 25 #define X_XFixesChangeCursor 26 #define X_XFixesChangeCursorByName 27 /*************** Version 3 ******************/ #define X_XFixesExpandRegion 28 /*************** Version 4 ******************/ #define X_XFixesHideCursor 29 #define X_XFixesShowCursor 30 /*************** Version 5 ******************/ #define X_XFixesCreatePointerBarrier 31 #define X_XFixesDestroyPointerBarrier 32 #define XFixesNumberRequests (X_XFixesDestroyPointerBarrier+1) /* Selection events share one event number */ #define XFixesSelectionNotify 0 /* Within the selection, the 'subtype' field distinguishes */ #define XFixesSetSelectionOwnerNotify 0 #define XFixesSelectionWindowDestroyNotify 1 #define XFixesSelectionClientCloseNotify 2 #define XFixesSetSelectionOwnerNotifyMask (1L << 0) #define XFixesSelectionWindowDestroyNotifyMask (1L << 1) #define XFixesSelectionClientCloseNotifyMask (1L << 2) /* There's only one cursor event so far */ #define XFixesCursorNotify 1 #define XFixesDisplayCursorNotify 0 #define XFixesDisplayCursorNotifyMask (1L << 0) #define XFixesNumberEvents (2) /* errors */ #define BadRegion 0 #define BadBarrier 1 #define XFixesNumberErrors (BadBarrier+1) #define SaveSetNearest 0 #define SaveSetRoot 1 #define SaveSetMap 0 #define SaveSetUnmap 1 /*************** Version 2 ******************/ #define WindowRegionBounding 0 #define WindowRegionClip 1 /*************** Version 5 ******************/ #define BarrierPositiveX (1L << 0) #define BarrierPositiveY (1L << 1) #define BarrierNegativeX (1L << 2) #define BarrierNegativeY (1L << 3) #endif /* _XFIXESWIRE_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/XI.h0000644000000000000000000002050513614532331015620 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* Definitions used by the server, library and client */ #ifndef _XI_H_ #define _XI_H_ #define sz_xGetExtensionVersionReq 8 #define sz_xGetExtensionVersionReply 32 #define sz_xListInputDevicesReq 4 #define sz_xListInputDevicesReply 32 #define sz_xOpenDeviceReq 8 #define sz_xOpenDeviceReply 32 #define sz_xCloseDeviceReq 8 #define sz_xSetDeviceModeReq 8 #define sz_xSetDeviceModeReply 32 #define sz_xSelectExtensionEventReq 12 #define sz_xGetSelectedExtensionEventsReq 8 #define sz_xGetSelectedExtensionEventsReply 32 #define sz_xChangeDeviceDontPropagateListReq 12 #define sz_xGetDeviceDontPropagateListReq 8 #define sz_xGetDeviceDontPropagateListReply 32 #define sz_xGetDeviceMotionEventsReq 16 #define sz_xGetDeviceMotionEventsReply 32 #define sz_xChangeKeyboardDeviceReq 8 #define sz_xChangeKeyboardDeviceReply 32 #define sz_xChangePointerDeviceReq 8 #define sz_xChangePointerDeviceReply 32 #define sz_xGrabDeviceReq 20 #define sz_xGrabDeviceReply 32 #define sz_xUngrabDeviceReq 12 #define sz_xGrabDeviceKeyReq 20 #define sz_xGrabDeviceKeyReply 32 #define sz_xUngrabDeviceKeyReq 16 #define sz_xGrabDeviceButtonReq 20 #define sz_xGrabDeviceButtonReply 32 #define sz_xUngrabDeviceButtonReq 16 #define sz_xAllowDeviceEventsReq 12 #define sz_xGetDeviceFocusReq 8 #define sz_xGetDeviceFocusReply 32 #define sz_xSetDeviceFocusReq 16 #define sz_xGetFeedbackControlReq 8 #define sz_xGetFeedbackControlReply 32 #define sz_xChangeFeedbackControlReq 12 #define sz_xGetDeviceKeyMappingReq 8 #define sz_xGetDeviceKeyMappingReply 32 #define sz_xChangeDeviceKeyMappingReq 8 #define sz_xGetDeviceModifierMappingReq 8 #define sz_xSetDeviceModifierMappingReq 8 #define sz_xSetDeviceModifierMappingReply 32 #define sz_xGetDeviceButtonMappingReq 8 #define sz_xGetDeviceButtonMappingReply 32 #define sz_xSetDeviceButtonMappingReq 8 #define sz_xSetDeviceButtonMappingReply 32 #define sz_xQueryDeviceStateReq 8 #define sz_xQueryDeviceStateReply 32 #define sz_xSendExtensionEventReq 16 #define sz_xDeviceBellReq 8 #define sz_xSetDeviceValuatorsReq 8 #define sz_xSetDeviceValuatorsReply 32 #define sz_xGetDeviceControlReq 8 #define sz_xGetDeviceControlReply 32 #define sz_xChangeDeviceControlReq 8 #define sz_xChangeDeviceControlReply 32 #define INAME "XInputExtension" #define XI_KEYBOARD "KEYBOARD" #define XI_MOUSE "MOUSE" #define XI_TABLET "TABLET" #define XI_TOUCHSCREEN "TOUCHSCREEN" #define XI_TOUCHPAD "TOUCHPAD" #define XI_BARCODE "BARCODE" #define XI_BUTTONBOX "BUTTONBOX" #define XI_KNOB_BOX "KNOB_BOX" #define XI_ONE_KNOB "ONE_KNOB" #define XI_NINE_KNOB "NINE_KNOB" #define XI_TRACKBALL "TRACKBALL" #define XI_QUADRATURE "QUADRATURE" #define XI_ID_MODULE "ID_MODULE" #define XI_SPACEBALL "SPACEBALL" #define XI_DATAGLOVE "DATAGLOVE" #define XI_EYETRACKER "EYETRACKER" #define XI_CURSORKEYS "CURSORKEYS" #define XI_FOOTMOUSE "FOOTMOUSE" #define Dont_Check 0 #define XInput_Initial_Release 1 #define XInput_Add_XDeviceBell 2 #define XInput_Add_XSetDeviceValuators 3 #define XInput_Add_XChangeDeviceControl 4 #define XI_Absent 0 #define XI_Present 1 #define XI_Initial_Release_Major 1 #define XI_Initial_Release_Minor 0 #define XI_Add_XDeviceBell_Major 1 #define XI_Add_XDeviceBell_Minor 1 #define XI_Add_XSetDeviceValuators_Major 1 #define XI_Add_XSetDeviceValuators_Minor 2 #define XI_Add_XChangeDeviceControl_Major 1 #define XI_Add_XChangeDeviceControl_Minor 3 #define DEVICE_RESOLUTION 1 #define NoSuchExtension 1 #define COUNT 0 #define CREATE 1 #define NewPointer 0 #define NewKeyboard 1 #define XPOINTER 0 #define XKEYBOARD 1 #define UseXKeyboard 0xFF #define IsXPointer 0 #define IsXKeyboard 1 #define IsXExtensionDevice 2 #define AsyncThisDevice 0 #define SyncThisDevice 1 #define ReplayThisDevice 2 #define AsyncOtherDevices 3 #define AsyncAll 4 #define SyncAll 5 #define FollowKeyboard 3 #ifndef RevertToFollowKeyboard #define RevertToFollowKeyboard 3 #endif #define DvAccelNum (1L << 0) #define DvAccelDenom (1L << 1) #define DvThreshold (1L << 2) #define DvKeyClickPercent (1L<<0) #define DvPercent (1L<<1) #define DvPitch (1L<<2) #define DvDuration (1L<<3) #define DvLed (1L<<4) #define DvLedMode (1L<<5) #define DvKey (1L<<6) #define DvAutoRepeatMode (1L<<7) #define DvString (1L << 0) #define DvInteger (1L << 0) #define DeviceMode (1L << 0) #define Relative 0 #define Absolute 1 /* Merged from Metrolink tree for XINPUT stuff */ #define TS_Raw 57 #define TS_Scaled 58 #define SendCoreEvents 59 #define DontSendCoreEvents 60 /* End of merged section */ #define ProximityState (1L << 1) #define InProximity (0L << 1) #define OutOfProximity (1L << 1) #define AddToList 0 #define DeleteFromList 1 #define KeyClass 0 #define ButtonClass 1 #define ValuatorClass 2 #define FeedbackClass 3 #define ProximityClass 4 #define FocusClass 5 #define OtherClass 6 #define KbdFeedbackClass 0 #define PtrFeedbackClass 1 #define StringFeedbackClass 2 #define IntegerFeedbackClass 3 #define LedFeedbackClass 4 #define BellFeedbackClass 5 #define _devicePointerMotionHint 0 #define _deviceButton1Motion 1 #define _deviceButton2Motion 2 #define _deviceButton3Motion 3 #define _deviceButton4Motion 4 #define _deviceButton5Motion 5 #define _deviceButtonMotion 6 #define _deviceButtonGrab 7 #define _deviceOwnerGrabButton 8 #define _noExtensionEvent 9 #define XI_BadDevice 0 #define XI_BadEvent 1 #define XI_BadMode 2 #define XI_DeviceBusy 3 #define XI_BadClass 4 /* Make XEventClass be a CARD32 for 64 bit servers. Don't affect client * definition of XEventClass since that would be a library interface change. * See the top of X.h for more _XSERVER64 magic. */ #ifdef _XSERVER64 typedef CARD32 XEventClass; #else typedef unsigned long XEventClass; #endif /******************************************************************* * * Extension version structure. * */ typedef struct { int present; short major_version; short minor_version; } XExtensionVersion; #endif /* _XI_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/XIproto.h0000644000000000000000000011072013614532331016703 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XIPROTO_H #define _XIPROTO_H #include #include /* make sure types have right sizes for protocol structures. */ #define Window CARD32 #define Time CARD32 #define KeyCode CARD8 /********************************************************* * * number of events, errors, and extension name. * */ #define MORE_EVENTS 0x80 #define DEVICE_BITS 0x7F #define InputClassBits 0x3F /* bits in mode field for input classes */ #define ModeBitsShift 6 /* amount to shift the remaining bits */ #define numInputClasses 7 #define IEVENTS 15 #define IERRORS 5 #define CLIENT_REQ 1 typedef struct _XExtEventInfo { Mask mask; BYTE type; BYTE word; } XExtEventInfo; typedef unsigned char *Pointer; struct tmask { Mask mask; Pointer dev; }; /********************************************************* * * Event constants used by library. * */ #define XI_DeviceValuator 0 #define XI_DeviceKeyPress 1 #define XI_DeviceKeyRelease 2 #define XI_DeviceButtonPress 3 #define XI_DeviceButtonRelease 4 #define XI_DeviceMotionNotify 5 #define XI_DeviceFocusIn 6 #define XI_DeviceFocusOut 7 #define XI_ProximityIn 8 #define XI_ProximityOut 9 #define XI_DeviceStateNotify 10 #define XI_DeviceMappingNotify 11 #define XI_ChangeDeviceNotify 12 #define XI_DeviceKeystateNotify 13 #define XI_DeviceButtonstateNotify 14 /********************************************************* * * Protocol request constants * */ #define X_GetExtensionVersion 1 #define X_ListInputDevices 2 #define X_OpenDevice 3 #define X_CloseDevice 4 #define X_SetDeviceMode 5 #define X_SelectExtensionEvent 6 #define X_GetSelectedExtensionEvents 7 #define X_ChangeDeviceDontPropagateList 8 #define X_GetDeviceDontPropagateList 9 #define X_GetDeviceMotionEvents 10 #define X_ChangeKeyboardDevice 11 #define X_ChangePointerDevice 12 #define X_GrabDevice 13 #define X_UngrabDevice 14 #define X_GrabDeviceKey 15 #define X_UngrabDeviceKey 16 #define X_GrabDeviceButton 17 #define X_UngrabDeviceButton 18 #define X_AllowDeviceEvents 19 #define X_GetDeviceFocus 20 #define X_SetDeviceFocus 21 #define X_GetFeedbackControl 22 #define X_ChangeFeedbackControl 23 #define X_GetDeviceKeyMapping 24 #define X_ChangeDeviceKeyMapping 25 #define X_GetDeviceModifierMapping 26 #define X_SetDeviceModifierMapping 27 #define X_GetDeviceButtonMapping 28 #define X_SetDeviceButtonMapping 29 #define X_QueryDeviceState 30 #define X_SendExtensionEvent 31 #define X_DeviceBell 32 #define X_SetDeviceValuators 33 #define X_GetDeviceControl 34 #define X_ChangeDeviceControl 35 /********************************************************* * * Protocol request and reply structures. * * GetExtensionVersion. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetExtensionVersion */ CARD16 length B16; CARD16 nbytes B16; CARD8 pad1, pad2; } xGetExtensionVersionReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetExtensionVersion */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 major_version B16; CARD16 minor_version B16; BOOL present; CARD8 pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } xGetExtensionVersionReply; /********************************************************* * * ListInputDevices. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_ListInputDevices */ CARD16 length B16; } xListInputDevicesReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_ListInputDevices */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 ndevices; CARD8 pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xListInputDevicesReply; typedef struct _xDeviceInfo *xDeviceInfoPtr; typedef struct _xAnyClassinfo *xAnyClassPtr; typedef struct _xAnyClassinfo { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 length; } xAnyClassInfo; typedef struct _xDeviceInfo { CARD32 type B32; CARD8 id; CARD8 num_classes; CARD8 use; CARD8 pad1; } xDeviceInfo; typedef struct _xKeyInfo *xKeyInfoPtr; typedef struct _xKeyInfo { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 length; KeyCode min_keycode; KeyCode max_keycode; CARD16 num_keys B16; CARD8 pad1,pad2; } xKeyInfo; typedef struct _xButtonInfo *xButtonInfoPtr; typedef struct _xButtonInfo { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 length; CARD16 num_buttons B16; } xButtonInfo; typedef struct _xValuatorInfo *xValuatorInfoPtr; typedef struct _xValuatorInfo { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 length; CARD8 num_axes; CARD8 mode; CARD32 motion_buffer_size B32; } xValuatorInfo; typedef struct _xAxisInfo *xAxisInfoPtr; typedef struct _xAxisInfo { CARD32 resolution B32; CARD32 min_value B32; CARD32 max_value B32; } xAxisInfo; /********************************************************* * * OpenDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_OpenDevice */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xOpenDeviceReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_OpenDevice */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 num_classes; BYTE pad1, pad2, pad3; CARD32 pad00 B32; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } xOpenDeviceReply; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 event_type_base; } xInputClassInfo; /********************************************************* * * CloseDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_CloseDevice */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xCloseDeviceReq; /********************************************************* * * SetDeviceMode. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SetDeviceMode */ CARD16 length B16; CARD8 deviceid; CARD8 mode; BYTE pad1, pad2; } xSetDeviceModeReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_SetDeviceMode */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xSetDeviceModeReply; /********************************************************* * * SelectExtensionEvent. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SelectExtensionEvent */ CARD16 length B16; Window window B32; CARD16 count B16; CARD16 pad00 B16; } xSelectExtensionEventReq; /********************************************************* * * GetSelectedExtensionEvent. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_GetSelectedExtensionEvents */ CARD16 length B16; Window window B32; } xGetSelectedExtensionEventsReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* GetSelectedExtensionEvents */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 this_client_count B16; CARD16 all_clients_count B16; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGetSelectedExtensionEventsReply; /********************************************************* * * ChangeDeviceDontPropagateList. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_ChangeDeviceDontPropagateList */ CARD16 length B16; Window window B32; CARD16 count B16; CARD8 mode; BYTE pad; } xChangeDeviceDontPropagateListReq; /********************************************************* * * GetDeviceDontPropagateList. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_GetDeviceDontPropagateList */ CARD16 length B16; Window window B32; } xGetDeviceDontPropagateListReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* GetDeviceDontPropagateList */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 count B16; CARD16 pad00 B16; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGetDeviceDontPropagateListReply; /********************************************************* * * GetDeviceMotionEvents. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceMotionEvents*/ CARD16 length B16; Time start B32; Time stop B32; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetDeviceMotionEventsReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceMotionEvents */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 nEvents B32; CARD8 axes; CARD8 mode; BYTE pad1, pad2; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } xGetDeviceMotionEventsReply; /********************************************************* * * ChangeKeyboardDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_ChangeKeyboardDevice */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xChangeKeyboardDeviceReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_ChangeKeyboardDevice*/ CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xChangeKeyboardDeviceReply; /********************************************************* * * ChangePointerDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_ChangePointerDevice */ CARD16 length B16; CARD8 xaxis; CARD8 yaxis; CARD8 deviceid; BYTE pad1; } xChangePointerDeviceReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_ChangePointerDevice */ CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xChangePointerDeviceReply; /********************************************************* * * GrabDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GrabDevice */ CARD16 length B16; Window grabWindow B32; Time time B32; CARD16 event_count B16; CARD8 this_device_mode; CARD8 other_devices_mode; BOOL ownerEvents; CARD8 deviceid; CARD16 pad01 B16; } xGrabDeviceReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GrabDevice */ CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGrabDeviceReply; /********************************************************* * * UngrabDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_UnGrabDevice */ CARD16 length B16; Time time B32; CARD8 deviceid; BYTE pad1, pad2, pad3; } xUngrabDeviceReq; /********************************************************* * * GrabDeviceKey. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GrabDeviceKey */ CARD16 length B16; Window grabWindow B32; CARD16 event_count B16; CARD16 modifiers B16; CARD8 modifier_device; CARD8 grabbed_device; CARD8 key; BYTE this_device_mode; BYTE other_devices_mode; BOOL ownerEvents; BYTE pad1, pad2; } xGrabDeviceKeyReq; /********************************************************* * * UngrabDeviceKey. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_UngrabDeviceKey */ CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD8 modifier_device; CARD8 key; CARD8 grabbed_device; BYTE pad1, pad2, pad3; } xUngrabDeviceKeyReq; /********************************************************* * * GrabDeviceButton. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GrabDeviceButton */ CARD16 length B16; Window grabWindow B32; CARD8 grabbed_device; CARD8 modifier_device; CARD16 event_count B16; CARD16 modifiers B16; BYTE this_device_mode; BYTE other_devices_mode; CARD8 button; BOOL ownerEvents; BYTE pad1, pad2; } xGrabDeviceButtonReq; /********************************************************* * * UngrabDeviceButton. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_UngrabDeviceButton */ CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD8 modifier_device; CARD8 button; CARD8 grabbed_device; BYTE pad1, pad2, pad3; } xUngrabDeviceButtonReq; /********************************************************* * * AllowDeviceEvents. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_AllowDeviceEvents */ CARD16 length B16; Time time B32; CARD8 mode; CARD8 deviceid; BYTE pad1, pad2; } xAllowDeviceEventsReq; /********************************************************* * * GetDeviceFocus. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceFocus */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetDeviceFocusReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceFocus */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 focus B32; Time time B32; CARD8 revertTo; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; } xGetDeviceFocusReply; /********************************************************* * * SetDeviceFocus. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SetDeviceFocus */ CARD16 length B16; Window focus B32; Time time B32; CARD8 revertTo; CARD8 device; CARD16 pad01 B16; } xSetDeviceFocusReq; /********************************************************* * * GetFeedbackControl. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_GetFeedbackControl */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetFeedbackControlReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetFeedbackControl */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 num_feedbacks B16; CARD16 pad01 B16; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; CARD32 pad06 B32; } xGetFeedbackControlReply; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class */ #else CARD8 class; /* feedback class */ #endif CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ } xFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 id; CARD16 length B16; CARD16 pitch B16; CARD16 duration B16; CARD32 led_mask B32; CARD32 led_values B32; BOOL global_auto_repeat; CARD8 click; CARD8 percent; BYTE pad; BYTE auto_repeats[32]; } xKbdFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 id; CARD16 length B16; CARD8 pad1,pad2; CARD16 accelNum B16; CARD16 accelDenom B16; CARD16 threshold B16; } xPtrFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; CARD16 length B16; /* feedback length */ CARD32 resolution B32; INT32 min_value B32; INT32 max_value B32; } xIntegerFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; CARD16 length B16; /* feedback length */ CARD16 max_symbols B16; CARD16 num_syms_supported B16; } xStringFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; CARD16 length B16; /* feedback length */ CARD8 percent; BYTE pad1, pad2, pad3; CARD16 pitch B16; CARD16 duration B16; } xBellFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; CARD16 length B16; /* feedback length */ CARD32 led_mask B32; CARD32 led_values B32; } xLedFeedbackState; /********************************************************* * * ChangeFeedbackControl. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_ChangeFeedbackControl */ CARD16 length B16; CARD32 mask B32; CARD8 deviceid; CARD8 feedbackid; BYTE pad1, pad2; } xChangeFeedbackControlReq; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ } xFeedbackCtl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; /* feedback length */ CARD16 length B16; /* feedback length */ KeyCode key; CARD8 auto_repeat_mode; INT8 click; INT8 percent; INT16 pitch B16; INT16 duration B16; CARD32 led_mask B32; CARD32 led_values B32; } xKbdFeedbackCtl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ CARD8 pad1,pad2; INT16 num B16; INT16 denom B16; INT16 thresh B16; } xPtrFeedbackCtl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ INT32 int_to_display B32; } xIntegerFeedbackCtl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ CARD8 pad1,pad2; CARD16 num_keysyms B16; } xStringFeedbackCtl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ INT8 percent; BYTE pad1, pad2, pad3; INT16 pitch B16; INT16 duration B16; } xBellFeedbackCtl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; /* feedback class id */ #else CARD8 class; /* feedback class id */ #endif CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ CARD32 led_mask B32; CARD32 led_values B32; } xLedFeedbackCtl; /********************************************************* * * GetDeviceKeyMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceKeyMapping */ CARD16 length B16; CARD8 deviceid; KeyCode firstKeyCode; CARD8 count; BYTE pad1; } xGetDeviceKeyMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceKeyMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 keySymsPerKeyCode; CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetDeviceKeyMappingReply; /********************************************************* * * ChangeDeviceKeyMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_ChangeDeviceKeyMapping */ CARD16 length B16; CARD8 deviceid; KeyCode firstKeyCode; CARD8 keySymsPerKeyCode; CARD8 keyCodes; } xChangeDeviceKeyMappingReq; /********************************************************* * * GetDeviceModifierMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceModifierMapping */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetDeviceModifierMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceModifierMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 numKeyPerModifier; CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetDeviceModifierMappingReply; /********************************************************* * * SetDeviceModifierMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SetDeviceModifierMapping */ CARD16 length B16; CARD8 deviceid; CARD8 numKeyPerModifier; CARD16 pad1 B16; } xSetDeviceModifierMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_SetDeviceModifierMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 success; CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xSetDeviceModifierMappingReply; /********************************************************* * * GetDeviceButtonMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_GetDeviceButtonMapping */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetDeviceButtonMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceButtonMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 nElts; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGetDeviceButtonMappingReply; /********************************************************* * * SetDeviceButtonMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_SetDeviceButtonMapping */ CARD16 length B16; CARD8 deviceid; CARD8 map_length; BYTE pad1, pad2; } xSetDeviceButtonMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_SetDeviceButtonMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xSetDeviceButtonMappingReply; /********************************************************* * * QueryDeviceState. * */ typedef struct { CARD8 reqType; CARD8 ReqType; /* always X_QueryDeviceState */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xQueryDeviceStateReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_QueryDeviceState */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 num_classes; BYTE pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xQueryDeviceStateReply; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 length; CARD8 num_keys; BYTE pad1; CARD8 keys[32]; } xKeyState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 length; CARD8 num_buttons; BYTE pad1; CARD8 buttons[32]; } xButtonState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 length; CARD8 num_valuators; CARD8 mode; } xValuatorState; /********************************************************* * * SendExtensionEvent. * THIS REQUEST MUST BE KEPT A MULTIPLE OF 8 BYTES IN LENGTH! * MORE EVENTS MAY FOLLOW AND THEY MUST BE QUAD-ALIGNED! * */ typedef struct { CARD8 reqType; CARD8 ReqType; /* always X_SendExtensionEvent */ CARD16 length B16; Window destination B32; CARD8 deviceid; BOOL propagate; CARD16 count B16; CARD8 num_events; BYTE pad1,pad2,pad3; } xSendExtensionEventReq; /********************************************************* * * DeviceBell. * */ typedef struct { CARD8 reqType; CARD8 ReqType; /* always X_DeviceBell */ CARD16 length B16; CARD8 deviceid; CARD8 feedbackid; CARD8 feedbackclass; INT8 percent; } xDeviceBellReq; /********************************************************* * * SetDeviceValuators. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SetDeviceValuators */ CARD16 length B16; CARD8 deviceid; CARD8 first_valuator; CARD8 num_valuators; BYTE pad1; } xSetDeviceValuatorsReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_SetDeviceValuators */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xSetDeviceValuatorsReply; /********************************************************* * * GetDeviceControl. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceControl */ CARD16 length B16; CARD16 control B16; CARD8 deviceid; BYTE pad2; } xGetDeviceControlReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceControl */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGetDeviceControlReply; typedef struct { CARD16 control B16; /* control type */ CARD16 length B16; /* control length */ } xDeviceState; typedef struct { CARD16 control B16; /* control type */ CARD16 length B16; /* control length */ CARD32 num_valuators B32; /* number of valuators */ } xDeviceResolutionState; /********************************************************* * * ChangeDeviceControl. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_ChangeDeviceControl */ CARD16 length B16; CARD16 control B16; CARD8 deviceid; BYTE pad0; } xChangeDeviceControlReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_ChangeDeviceControl */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xChangeDeviceControlReply; typedef struct { CARD16 control B16; /* control type */ CARD16 length B16; /* control length */ } xDeviceCtl; typedef struct { CARD16 control B16; /* control type */ CARD16 length B16; /* control length */ CARD8 first_valuator; /* first valuator to change */ CARD8 num_valuators; /* number of valuators to change*/ CARD8 pad1,pad2; } xDeviceResolutionCtl; /* Merged from Metrolink tree for XINPUT stuff */ typedef struct { CARD16 control; CARD16 length; CARD32 min_x; CARD32 max_x; CARD32 min_y; CARD32 max_y; CARD32 button_threshold; } xDeviceTSCalibrationCtl; /* End of merged section */ /********************************************************** * * Input extension events. * * DeviceValuator * */ typedef struct { BYTE type; CARD8 deviceid; CARD16 sequenceNumber B16; KeyButMask device_state B16; CARD8 num_valuators; CARD8 first_valuator; INT32 valuator0 B32; INT32 valuator1 B32; INT32 valuator2 B32; INT32 valuator3 B32; INT32 valuator4 B32; INT32 valuator5 B32; } deviceValuator; /********************************************************** * * DeviceKeyButtonPointer. * * Used for: DeviceKeyPress, DeviceKeyRelease, * DeviceButtonPress, DeviceButtonRelease, * ProximityIn, ProximityOut * DeviceMotionNotify, * */ typedef struct { BYTE type; BYTE detail; CARD16 sequenceNumber B16; Time time B32; Window root B32; Window event B32; Window child B32; INT16 root_x B16; INT16 root_y B16; INT16 event_x B16; INT16 event_y B16; KeyButMask state B16; BOOL same_screen; CARD8 deviceid; } deviceKeyButtonPointer; /********************************************************** * * DeviceFocus. * */ typedef struct { BYTE type; BYTE detail; CARD16 sequenceNumber B16; Time time B32; Window window B32; BYTE mode; CARD8 deviceid; BYTE pad1, pad2; CARD32 pad00 B32; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; } deviceFocus; /********************************************************** * * DeviceStateNotify. * * Note that the two high-order bits in the classes_reported * field are the proximity state (InProximity or OutOfProximity), * and the device mode (Absolute or Relative), respectively. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; Time time B32; CARD8 num_keys; CARD8 num_buttons; CARD8 num_valuators; CARD8 classes_reported; CARD8 buttons[4]; CARD8 keys[4]; INT32 valuator0 B32; INT32 valuator1 B32; INT32 valuator2 B32; } deviceStateNotify; /********************************************************** * * DeviceKeyStateNotify. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; CARD8 keys[28]; } deviceKeyStateNotify; /********************************************************** * * DeviceButtonStateNotify. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; CARD8 buttons[28]; } deviceButtonStateNotify; /********************************************************** * * DeviceMappingNotify. * Fields must be kept in sync with core mappingnotify event. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; CARD8 request; KeyCode firstKeyCode; CARD8 count; BYTE pad1; Time time B32; CARD32 pad00 B32; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } deviceMappingNotify; /********************************************************** * * ChangeDeviceNotify. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; Time time B32; CARD8 request; BYTE pad1, pad2, pad3; CARD32 pad00 B32; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } changeDeviceNotify; #undef Window #undef Time #undef KeyCode #endif nx-libs-3.5.99.23/nx-X11/include/extensions/XKBconfig.h0000644000000000000000000001546613614532331017124 0ustar #ifndef _XKBCONFIG_H_ #define _XKBCONFIG_H_ 1 /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ typedef struct _XkbConfigRtrn *XkbConfigRtrnPtr; typedef struct _XkbConfigField *XkbConfigFieldPtr; typedef struct _XkbConfigFields *XkbConfigFieldsPtr; typedef Bool (*XkbConfigParseFunc)( FILE * /* file */, XkbConfigFieldsPtr /* fields */, XkbConfigFieldPtr /* field */, XkbDescPtr /* xkb */, XkbConfigRtrnPtr /* rtrn */ ); #define XkbCF_Check 0 #define XkbCF_Apply 1 #define XkbCF_CleanUp 2 #define XkbCF_Destroy 3 typedef Bool (*XkbConfigFinishFunc)( XkbConfigFieldsPtr /* fields */, XkbDescPtr /* xkb */, XkbConfigRtrnPtr /* rtrn */, int /* what */ ); typedef struct _XkbConfigRtrnPriv { int cfg_id; XPointer priv; struct _XkbConfigRtrnPriv * next; } XkbConfigRtrnPrivRec,*XkbConfigRtrnPrivPtr; typedef struct _XkbConfigModInfo { Bool replace; unsigned char mods; unsigned char mods_clear; unsigned short vmods; unsigned short vmods_clear; } XkbConfigModInfoRec,*XkbConfigModInfoPtr; typedef struct _XkbConfigUnboundMod { unsigned char what; unsigned char mods; unsigned short vmods; short merge; char * name; } XkbConfigUnboundModRec,*XkbConfigUnboundModPtr; #define XkbCF_MergeSet 0 #define XkbCF_MergeAdd 1 #define XkbCF_MergeRemove 2 #define XkbCF_InitialMods (1L<<0) #define XkbCF_InternalMods (1L<<1) #define XkbCF_IgnoreLockMods (1L<<2) #define XkbCF_InitialCtrls (1L<<3) #define XkbCF_AccessXTimeout (1L<<4) #define XkbCF_AccessXTimeoutCtrlsOn (1L<<5) #define XkbCF_AccessXTimeoutCtrlsOff (1L<<6) #define XkbCF_AccessXTimeoutOptsOn (1L<<7) #define XkbCF_AccessXTimeoutOptsOff (1L<<8) #define XkbCF_GroupsWrap (1L<<9) #define XkbCF_InitialOpts (1L<<10) typedef struct _XkbConfigRtrn { unsigned defined; int error; int line; int click_volume; int bell_volume; int bell_pitch; int bell_duration; int repeat_delay; int repeat_interval; char * rules_file; char * model; char * layout; char * variant; char * options; char * keymap; char * keycodes; char * geometry; char * phys_symbols; char * symbols; char * types; char * compat; Bool replace_initial_ctrls; unsigned long initial_ctrls; unsigned long initial_ctrls_clear; Bool replace_initial_opts; unsigned short initial_opts; unsigned short initial_opts_clear; XkbConfigModInfoRec initial_mods; XkbConfigModInfoRec internal_mods; XkbConfigModInfoRec ignore_lock_mods; short num_unbound_mods; short sz_unbound_mods; XkbConfigUnboundModPtr unbound_mods; int groups_wrap; int slow_keys_delay; int debounce_delay; int mk_delay; int mk_interval; int mk_time_to_max; int mk_max_speed; int mk_curve; int ax_timeout; Bool replace_axt_ctrls_on; Bool replace_axt_ctrls_off; unsigned long axt_ctrls_on; unsigned long axt_ctrls_off; unsigned long axt_ctrls_ignore; Bool replace_axt_opts_off; Bool replace_axt_opts_on; unsigned short axt_opts_off; unsigned short axt_opts_on; unsigned short axt_opts_ignore; XkbConfigRtrnPrivPtr priv; } XkbConfigRtrnRec; typedef struct _XkbConfigField { char * field; unsigned char field_id; } XkbConfigFieldRec; typedef struct _XkbConfigFields { unsigned short cfg_id; unsigned short num_fields; XkbConfigFieldPtr fields; XkbConfigParseFunc parser; XkbConfigFinishFunc finish; XPointer priv; struct _XkbConfigFields *next; } XkbConfigFieldsRec; #define XkbCF_EOF -1 #define XkbCF_Unknown 0 #define XkbCF_EOL 1 #define XkbCF_Semi 2 #define XkbCF_Equals 3 #define XkbCF_PlusEquals 4 #define XkbCF_MinusEquals 5 #define XkbCF_Plus 6 #define XkbCF_Minus 7 #define XkbCF_String 10 #define XkbCF_Ident 11 #define XkbCF_Integer 12 #define XkbCF_UnterminatedString 100 #define XkbCF_BadAlloc 101 #define XkbCF_MissingIdent 102 #define XkbCF_MissingEquals 103 #define XkbCF_ExpectedEOS 104 #define XkbCF_ExpectedBoolean 105 #define XkbCF_ExpectedInteger 106 #define XkbCF_ExpectedString 107 #define XkbCF_ExpectedModifier 108 #define XkbCF_ExpectedControl 109 #define XkbCF_ExpectedAXOption 110 #define XkbCF_ExpectedOperator 111 #define XkbCF_ExpectedOORGroupBehavior 112 typedef union { int ival; char * str; } XkbCFScanResultRec,*XkbCFScanResultPtr; extern XkbConfigFieldsPtr XkbCFDflts; _XFUNCPROTOBEGIN extern int XkbCFScan( FILE * /* file */, XkbCFScanResultPtr /* val_rtrn */, XkbConfigRtrnPtr /* rtrn */ ); extern XkbConfigFieldsPtr XkbCFDup( XkbConfigFieldsPtr /* fields */ ); extern XkbConfigFieldsPtr XkbCFFree( XkbConfigFieldsPtr /* fields */, Bool /* all */ ); extern XkbConfigUnboundModPtr XkbCFAddModByName( XkbConfigRtrnPtr /* rtrn */, int /* what */, char * /* name */, Bool /* merge */, XkbConfigUnboundModPtr /* last */ ); extern Bool XkbCFBindMods( XkbConfigRtrnPtr /* rtrn */, XkbDescPtr /* xkb */ ); extern Bool XkbCFApplyMods( XkbConfigRtrnPtr /* rtrn */, int /* what */, XkbConfigModInfoPtr /* info */ ); extern Bool XkbCFApplyRtrnValues( XkbConfigRtrnPtr /* rtrn */, XkbConfigFieldsPtr /* fields */, XkbDescPtr /* xkb */ ); extern XkbConfigRtrnPrivPtr XkbCFAddPrivate( XkbConfigRtrnPtr /* rtrn */, XkbConfigFieldsPtr /* fields */, XPointer /* ptr */ ); extern void XkbCFFreeRtrn( XkbConfigRtrnPtr /* rtrn */, XkbConfigFieldsPtr /* fields */, XkbDescPtr /* xkb */ ); extern Bool XkbCFParse( FILE * /* file */, XkbConfigFieldsPtr /* fields */, XkbDescPtr /* xkb */, XkbConfigRtrnPtr /* rtrn */ ); extern void XkbCFReportError( FILE * /* file */, char * /* name */, int /* error */, int /* line */ ); _XFUNCPROTOEND #endif /* _XKBCONFIG_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/XKBfile.h0000644000000000000000000002564613614532331016577 0ustar #ifndef _XKBFILE_H_ #define _XKBFILE_H_ 1 /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /***====================================================================***/ #define XkbXKMFile 0 #define XkbCFile 1 #define XkbXKBFile 2 #define XkbMessage 3 #define XkbMapDefined (1<<0) #define XkbStateDefined (1<<1) typedef struct _XkbFileInfo { unsigned type; unsigned defined; XkbDescPtr xkb; } XkbFileInfo,*XkbFileInfoPtr; typedef void (*XkbFileAddOnFunc)( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, int /* fileSection */, void * /* priv */ ); /***====================================================================***/ #define _XkbSuccess 0 #define _XkbErrMissingNames 1 #define _XkbErrMissingTypes 2 #define _XkbErrMissingReqTypes 3 #define _XkbErrMissingSymbols 4 #define _XkbErrMissingVMods 5 #define _XkbErrMissingIndicators 6 #define _XkbErrMissingCompatMap 7 #define _XkbErrMissingSymInterps 8 #define _XkbErrMissingGeometry 9 #define _XkbErrIllegalDoodad 10 #define _XkbErrIllegalTOCType 11 #define _XkbErrIllegalContents 12 #define _XkbErrEmptyFile 13 #define _XkbErrFileNotFound 14 #define _XkbErrFileCannotOpen 15 #define _XkbErrBadValue 16 #define _XkbErrBadMatch 17 #define _XkbErrBadTypeName 18 #define _XkbErrBadTypeWidth 19 #define _XkbErrBadFileType 20 #define _XkbErrBadFileVersion 21 #define _XkbErrBadFileFormat 22 #define _XkbErrBadAlloc 23 #define _XkbErrBadLength 24 #define _XkbErrXReqFailure 25 #define _XkbErrBadImplementation 26 extern char * _XkbErrMessages[]; extern unsigned _XkbErrCode; extern char * _XkbErrLocation; extern unsigned _XkbErrData; /***====================================================================***/ _XFUNCPROTOBEGIN extern char * XkbIndentText( unsigned /* size */ ); extern char * XkbAtomText( Display * /* dpy */, Atom /* atm */, unsigned /* format */ ); extern char * XkbKeysymText( KeySym /* sym */, unsigned /* format */ ); extern char * XkbStringText( char * /* str */, unsigned /* format */ ); extern char * XkbKeyNameText( char * /* name */, unsigned /* format */ ); extern char * XkbModIndexText( unsigned /* ndx */, unsigned /* format */ ); extern char * XkbModMaskText( unsigned /* mask */, unsigned /* format */ ); extern char * XkbVModIndexText( Display * /* dpy */, XkbDescPtr /* xkb */, unsigned /* ndx */, unsigned /* format */ ); extern char * XkbVModMaskText( Display * /* dpy */, XkbDescPtr /* xkb */, unsigned /* modMask */, unsigned /* mask */, unsigned /* format */ ); extern char * XkbConfigText( unsigned /* config */, unsigned /* format */ ); extern char * XkbSIMatchText( unsigned /* type */, unsigned /* format */ ); extern char * XkbIMWhichStateMaskText( unsigned /* use_which */, unsigned /* format */ ); extern char * XkbAccessXDetailText( unsigned /* state */, unsigned /* format */ ); extern char * XkbNKNDetailMaskText( unsigned /* detail */, unsigned /* format */ ); extern char * XkbControlsMaskText( unsigned /* ctrls */, unsigned /* format */ ); extern char * XkbGeomFPText( int /* val */, unsigned /* format */ ); extern char * XkbDoodadTypeText( unsigned /* type */, unsigned /* format */ ); extern char * XkbActionTypeText( unsigned /* type */, unsigned /* format */ ); extern char * XkbActionText( Display * /* dpy */, XkbDescPtr /* xkb */, XkbAction * /* action */, unsigned /* format */ ); extern char * XkbBehaviorText( XkbDescPtr /* xkb */, XkbBehavior * /* behavior */, unsigned /* format */ ); /***====================================================================***/ #define _XkbKSLower (1<<0) #define _XkbKSUpper (1<<1) #define XkbKSIsLower(k) (_XkbKSCheckCase(k)&_XkbKSLower) #define XkbKSIsUpper(k) (_XkbKSCheckCase(k)&_XkbKSUpper) #define XkbKSIsKeypad(k) (((k)>=XK_KP_Space)&&((k)<=XK_KP_Equal)) #define XkbKSIsDeadKey(k) \ (((k)>=XK_dead_grave)&&((k)<=XK_dead_semivoiced_sound)) extern unsigned _XkbKSCheckCase( KeySym /* sym */ ); extern int XkbFindKeycodeByName( XkbDescPtr /* xkb */, char * /* name */, Bool /* use_aliases */ ); extern Bool XkbLookupGroupAndLevel( XkbDescPtr /* xkb */, int /* key */, int * /* mods_inout */, int * /* grp_inout */, int * /* lvl_rtrn */ ); /***====================================================================***/ #ifndef XKB_IN_SERVER extern Bool XkbLookupCanonicalRGBColor( char * /* def */, XColor * /* color */ ); #endif /***====================================================================***/ extern char * XkbAtomGetString( Display * /* dpy */, Atom /* atm */ ); extern Atom XkbInternAtom( Display * /* dpy */, char * /* name */, Bool /* onlyIfExists */ ); extern Status XkbChangeKbdDisplay( Display * /* newDpy */, XkbFileInfo * /* result */ ); extern Atom XkbChangeAtomDisplay( Display * /* oldDpy */, Display * /* newDpy */, Atom /* atm */ ); extern void XkbInitAtoms( Display * /* dpy */ ); /***====================================================================***/ #ifdef _XKBGEOM_H_ #define XkbDW_Unknown 0 #define XkbDW_Doodad 1 #define XkbDW_Section 2 typedef struct _XkbDrawable { int type; int priority; union { XkbDoodadPtr doodad; XkbSectionPtr section; } u; struct _XkbDrawable * next; } XkbDrawableRec,*XkbDrawablePtr; extern XkbDrawablePtr XkbGetOrderedDrawables( XkbGeometryPtr /* geom */, XkbSectionPtr /* section */ ); extern void XkbFreeOrderedDrawables( XkbDrawablePtr /* draw */ ); #endif /***====================================================================***/ extern unsigned XkbConvertGetByNameComponents( Bool /* toXkm */, unsigned /* orig */ ); extern unsigned XkbConvertXkbComponents( Bool /* toXkm */, unsigned /* orig */ ); extern Bool XkbDetermineFileType( XkbFileInfo * /* xkb */, int /* format */, int * /* opts_missing */ ); extern Bool XkbNameMatchesPattern( char * /* name */, char * /* pattern */ ); /***====================================================================***/ extern Bool XkbWriteXKBKeycodes( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBKeyTypes( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBCompatMap( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBSymbols( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBGeometry( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBSemantics( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBLayout( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBKeymap( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBFile( FILE * /* file */, XkbFileInfo * /* result */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteCFile( FILE * /* file */, char * /* name */, XkbFileInfo * /* info */ ); extern Bool XkbWriteXKMFile( FILE * /* file */, XkbFileInfo * /* result */ ); extern Bool XkbWriteToServer( XkbFileInfo * /* result */ ); extern void XkbEnsureSafeMapName( char * /* name */ ); extern Bool XkbWriteXKBKeymapForNames( FILE * /* file */, XkbComponentNamesPtr /* names */, Display * /* dpy */, XkbDescPtr /* xkb */, unsigned /* want */, unsigned /* need */ ); extern Status XkbMergeFile( XkbDescPtr /* xkb */, XkbFileInfo /* finfo */ ); /***====================================================================***/ extern Bool XkmProbe( FILE * /* file */ ); extern unsigned XkbReadFromServer( Display * /* dpy */, unsigned /* need */, unsigned /* want */, XkbFileInfo * /* result */ ); extern unsigned XkmReadFile( FILE * /* file */, unsigned /* need */, unsigned /* want */, XkbFileInfo * /* result */ ); #ifdef _XKMFORMAT_H_ extern Bool XkmReadTOC( FILE * /* file */, xkmFileInfo * /* file_info */, int /* max_toc */, xkmSectionInfo * /* toc */ ); extern xkmSectionInfo *XkmFindTOCEntry( xkmFileInfo * /* finfo */, xkmSectionInfo * /* toc */, unsigned /* type */ ); extern Bool XkmReadFileSection( FILE * /* file */, xkmSectionInfo * /* toc */, XkbFileInfo * /* result */, unsigned * /* loaded_rtrn */ ); extern char * XkmReadFileSectionName( FILE * /* file */, xkmSectionInfo * /* toc */ ); #endif /* _XKMFORMAT_H */ _XFUNCPROTOEND #endif /* _XKBFILE_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/XKBgeom.h0000644000000000000000000003644613614532331016607 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBGEOM_H_ #define _XKBGEOM_H_ #include #ifdef XKB_IN_SERVER #define XkbAddGeomKeyAlias SrvXkbAddGeomKeyAlias #define XkbAddGeomColor SrvXkbAddGeomColor #define XkbAddGeomDoodad SrvXkbAddGeomDoodad #define XkbAddGeomKey SrvXkbAddGeomKey #define XkbAddGeomOutline SrvXkbAddGeomOutline #define XkbAddGeomOverlay SrvXkbAddGeomOverlay #define XkbAddGeomOverlayRow SrvXkbAddGeomOverlayRow #define XkbAddGeomOverlayKey SrvXkbAddGeomOverlayKey #define XkbAddGeomProperty SrvXkbAddGeomProperty #define XkbAddGeomRow SrvXkbAddGeomRow #define XkbAddGeomSection SrvXkbAddGeomSection #define XkbAddGeomShape SrvXkbAddGeomShape #define XkbAllocGeomKeyAliases SrvXkbAllocGeomKeyAliases #define XkbAllocGeomColors SrvXkbAllocGeomColors #define XkbAllocGeomDoodads SrvXkbAllocGeomDoodads #define XkbAllocGeomKeys SrvXkbAllocGeomKeys #define XkbAllocGeomOutlines SrvXkbAllocGeomOutlines #define XkbAllocGeomPoints SrvXkbAllocGeomPoints #define XkbAllocGeomProps SrvXkbAllocGeomProps #define XkbAllocGeomRows SrvXkbAllocGeomRows #define XkbAllocGeomSectionDoodads SrvXkbAllocGeomSectionDoodads #define XkbAllocGeomSections SrvXkbAllocGeomSections #define XkbAllocGeomOverlays SrvXkbAllocGeomOverlays #define XkbAllocGeomOverlayRows SrvXkbAllocGeomOverlayRows #define XkbAllocGeomOverlayKeys SrvXkbAllocGeomOverlayKeys #define XkbAllocGeomShapes SrvXkbAllocGeomShapes #define XkbAllocGeometry SrvXkbAllocGeometry #define XkbFreeGeomKeyAliases SrvXkbFreeGeomKeyAliases #define XkbFreeGeomColors SrvXkbFreeGeomColors #define XkbFreeGeomDoodads SrvXkbFreeGeomDoodads #define XkbFreeGeomProperties SrvXkbFreeGeomProperties #define XkbFreeGeomOverlayKeys SrvXkbFreeGeomOverlayKeys #define XkbFreeGeomOverlayRows SrvXkbFreeGeomOverlayRows #define XkbFreeGeomOverlays SrvXkbFreeGeomOverlays #define XkbFreeGeomKeys SrvXkbFreeGeomKeys #define XkbFreeGeomRows SrvXkbFreeGeomRows #define XkbFreeGeomSections SrvXkbFreeGeomSections #define XkbFreeGeomPoints SrvXkbFreeGeomPoints #define XkbFreeGeomOutlines SrvXkbFreeGeomOutlines #define XkbFreeGeomShapes SrvXkbFreeGeomShapes #define XkbFreeGeometry SrvXkbFreeGeometry #endif typedef struct _XkbProperty { char *name; char *value; } XkbPropertyRec,*XkbPropertyPtr; typedef struct _XkbColor { unsigned int pixel; char * spec; } XkbColorRec,*XkbColorPtr; typedef struct _XkbPoint { short x; short y; } XkbPointRec, *XkbPointPtr; typedef struct _XkbBounds { short x1,y1; short x2,y2; } XkbBoundsRec, *XkbBoundsPtr; #define XkbBoundsWidth(b) (((b)->x2)-((b)->x1)) #define XkbBoundsHeight(b) (((b)->y2)-((b)->y1)) typedef struct _XkbOutline { unsigned short num_points; unsigned short sz_points; unsigned short corner_radius; XkbPointPtr points; } XkbOutlineRec, *XkbOutlinePtr; typedef struct _XkbShape { Atom name; unsigned short num_outlines; unsigned short sz_outlines; XkbOutlinePtr outlines; XkbOutlinePtr approx; XkbOutlinePtr primary; XkbBoundsRec bounds; } XkbShapeRec, *XkbShapePtr; #define XkbOutlineIndex(s,o) ((int)((o)-&(s)->outlines[0])) typedef struct _XkbShapeDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; unsigned short color_ndx; unsigned short shape_ndx; } XkbShapeDoodadRec, *XkbShapeDoodadPtr; #define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) #define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) #define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) #define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) typedef struct _XkbTextDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; short width; short height; unsigned short color_ndx; char * text; char * font; } XkbTextDoodadRec, *XkbTextDoodadPtr; #define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) #define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) typedef struct _XkbIndicatorDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; unsigned short shape_ndx; unsigned short on_color_ndx; unsigned short off_color_ndx; } XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr; #define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) #define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx]) #define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx]) #define XkbSetIndicatorDoodadOnColor(g,d,c) \ ((d)->on_color_ndx= (c)-&(g)->colors[0]) #define XkbSetIndicatorDoodadOffColor(g,d,c) \ ((d)->off_color_ndx= (c)-&(g)->colors[0]) #define XkbSetIndicatorDoodadShape(g,d,s) \ ((d)->shape_ndx= (s)-&(g)->shapes[0]) typedef struct _XkbLogoDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; unsigned short color_ndx; unsigned short shape_ndx; char * logo_name; } XkbLogoDoodadRec, *XkbLogoDoodadPtr; #define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) #define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) #define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) #define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) typedef struct _XkbAnyDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; } XkbAnyDoodadRec, *XkbAnyDoodadPtr; typedef union _XkbDoodad { XkbAnyDoodadRec any; XkbShapeDoodadRec shape; XkbTextDoodadRec text; XkbIndicatorDoodadRec indicator; XkbLogoDoodadRec logo; } XkbDoodadRec, *XkbDoodadPtr; #define XkbUnknownDoodad 0 #define XkbOutlineDoodad 1 #define XkbSolidDoodad 2 #define XkbTextDoodad 3 #define XkbIndicatorDoodad 4 #define XkbLogoDoodad 5 typedef struct _XkbKey { XkbKeyNameRec name; short gap; unsigned char shape_ndx; unsigned char color_ndx; } XkbKeyRec, *XkbKeyPtr; #define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx]) #define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx]) #define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0]) #define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0]) typedef struct _XkbRow { short top; short left; unsigned short num_keys; unsigned short sz_keys; int vertical; XkbKeyPtr keys; XkbBoundsRec bounds; } XkbRowRec, *XkbRowPtr; typedef struct _XkbSection { Atom name; unsigned char priority; short top; short left; unsigned short width; unsigned short height; short angle; unsigned short num_rows; unsigned short num_doodads; unsigned short num_overlays; unsigned short sz_rows; unsigned short sz_doodads; unsigned short sz_overlays; XkbRowPtr rows; XkbDoodadPtr doodads; XkbBoundsRec bounds; struct _XkbOverlay *overlays; } XkbSectionRec, *XkbSectionPtr; typedef struct _XkbOverlayKey { XkbKeyNameRec over; XkbKeyNameRec under; } XkbOverlayKeyRec,*XkbOverlayKeyPtr; typedef struct _XkbOverlayRow { unsigned short row_under; unsigned short num_keys; unsigned short sz_keys; XkbOverlayKeyPtr keys; } XkbOverlayRowRec,*XkbOverlayRowPtr; typedef struct _XkbOverlay { Atom name; XkbSectionPtr section_under; unsigned short num_rows; unsigned short sz_rows; XkbOverlayRowPtr rows; XkbBoundsPtr bounds; } XkbOverlayRec,*XkbOverlayPtr; typedef struct _XkbGeometry { Atom name; unsigned short width_mm; unsigned short height_mm; char * label_font; XkbColorPtr label_color; XkbColorPtr base_color; unsigned short sz_properties; unsigned short sz_colors; unsigned short sz_shapes; unsigned short sz_sections; unsigned short sz_doodads; unsigned short sz_key_aliases; unsigned short num_properties; unsigned short num_colors; unsigned short num_shapes; unsigned short num_sections; unsigned short num_doodads; unsigned short num_key_aliases; XkbPropertyPtr properties; XkbColorPtr colors; XkbShapePtr shapes; XkbSectionPtr sections; XkbDoodadPtr doodads; XkbKeyAliasPtr key_aliases; } XkbGeometryRec; #define XkbGeomColorIndex(g,c) ((int)((c)-&(g)->colors[0])) #define XkbGeomPropertiesMask (1<<0) #define XkbGeomColorsMask (1<<1) #define XkbGeomShapesMask (1<<2) #define XkbGeomSectionsMask (1<<3) #define XkbGeomDoodadsMask (1<<4) #define XkbGeomKeyAliasesMask (1<<5) #define XkbGeomAllMask (0x3f) typedef struct _XkbGeometrySizes { unsigned int which; unsigned short num_properties; unsigned short num_colors; unsigned short num_shapes; unsigned short num_sections; unsigned short num_doodads; unsigned short num_key_aliases; } XkbGeometrySizesRec,*XkbGeometrySizesPtr; _XFUNCPROTOBEGIN extern XkbPropertyPtr XkbAddGeomProperty( XkbGeometryPtr /* geom */, char * /* name */, char * /* value */ ); extern XkbKeyAliasPtr XkbAddGeomKeyAlias( XkbGeometryPtr /* geom */, char * /* alias */, char * /* real */ ); extern XkbColorPtr XkbAddGeomColor( XkbGeometryPtr /* geom */, char * /* spec */, unsigned int /* pixel */ ); extern XkbOutlinePtr XkbAddGeomOutline( XkbShapePtr /* shape */, int /* sz_points */ ); extern XkbShapePtr XkbAddGeomShape( XkbGeometryPtr /* geom */, Atom /* name */, int /* sz_outlines */ ); extern XkbKeyPtr XkbAddGeomKey( XkbRowPtr /* row */ ); extern XkbRowPtr XkbAddGeomRow( XkbSectionPtr /* section */, int /* sz_keys */ ); extern XkbSectionPtr XkbAddGeomSection( XkbGeometryPtr /* geom */, Atom /* name */, int /* sz_rows */, int /* sz_doodads */, int /* sz_overlays */ ); extern XkbOverlayPtr XkbAddGeomOverlay( XkbSectionPtr /* section */, Atom /* name */, int /* sz_rows */ ); extern XkbOverlayRowPtr XkbAddGeomOverlayRow( XkbOverlayPtr /* overlay */, int /* row_under */, int /* sz_keys */ ); extern XkbOverlayKeyPtr XkbAddGeomOverlayKey( XkbOverlayPtr /* overlay */, XkbOverlayRowPtr /* row */, char * /* over */, char * /* under */ ); extern XkbDoodadPtr XkbAddGeomDoodad( XkbGeometryPtr /* geom */, XkbSectionPtr /* section */, Atom /* name */ ); extern void XkbFreeGeomKeyAliases( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomColors( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomDoodads( XkbDoodadPtr /* doodads */, int /* nDoodads */, Bool /* freeAll */ ); extern void XkbFreeGeomProperties( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomOverlayKeys( XkbOverlayRowPtr /* row */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomOverlayRows( XkbOverlayPtr /* overlay */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomOverlays( XkbSectionPtr /* section */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomKeys( XkbRowPtr /* row */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomRows( XkbSectionPtr /* section */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomSections( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomPoints( XkbOutlinePtr /* outline */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomOutlines( XkbShapePtr /* shape */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomShapes( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeometry( XkbGeometryPtr /* geom */, unsigned int /* which */, Bool /* freeMap */ ); extern Status XkbAllocGeomProps( XkbGeometryPtr /* geom */, int /* nProps */ ); extern Status XkbAllocGeomKeyAliases( XkbGeometryPtr /* geom */, int /* nAliases */ ); extern Status XkbAllocGeomColors( XkbGeometryPtr /* geom */, int /* nColors */ ); extern Status XkbAllocGeomShapes( XkbGeometryPtr /* geom */, int /* nShapes */ ); extern Status XkbAllocGeomSections( XkbGeometryPtr /* geom */, int /* nSections */ ); extern Status XkbAllocGeomOverlays( XkbSectionPtr /* section */, int /* num_needed */ ); extern Status XkbAllocGeomOverlayRows( XkbOverlayPtr /* overlay */, int /* num_needed */ ); extern Status XkbAllocGeomOverlayKeys( XkbOverlayRowPtr /* row */, int /* num_needed */ ); extern Status XkbAllocGeomDoodads( XkbGeometryPtr /* geom */, int /* nDoodads */ ); extern Status XkbAllocGeomSectionDoodads( XkbSectionPtr /* section */, int /* nDoodads */ ); extern Status XkbAllocGeomOutlines( XkbShapePtr /* shape */, int /* nOL */ ); extern Status XkbAllocGeomRows( XkbSectionPtr /* section */, int /* nRows */ ); extern Status XkbAllocGeomPoints( XkbOutlinePtr /* ol */, int /* nPts */ ); extern Status XkbAllocGeomKeys( XkbRowPtr /* row */, int /* nKeys */ ); extern Status XkbAllocGeometry( XkbDescPtr /* xkb */, XkbGeometrySizesPtr /* sizes */ ); extern Status XkbSetGeometry( Display * /* dpy */, unsigned /* deviceSpec */, XkbGeometryPtr /* geom */ ); extern Bool XkbComputeShapeTop( XkbShapePtr /* shape */, XkbBoundsPtr /* bounds */ ); extern Bool XkbComputeShapeBounds( XkbShapePtr /* shape */ ); extern Bool XkbComputeRowBounds( XkbGeometryPtr /* geom */, XkbSectionPtr /* section */, XkbRowPtr /* row */ ); extern Bool XkbComputeSectionBounds( XkbGeometryPtr /* geom */, XkbSectionPtr /* section */ ); extern char * XkbFindOverlayForKey( XkbGeometryPtr /* geom */, XkbSectionPtr /* wanted */, char * /* under */ ); extern Status XkbGetGeometry( Display * /* dpy */, XkbDescPtr /* xkb */ ); extern Status XkbGetNamedGeometry( Display * /* dpy */, XkbDescPtr /* xkb */, Atom /* name */ ); _XFUNCPROTOEND #endif /* _XKBSTR_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/XKB.h0000644000000000000000000006721513614532331015735 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKB_H_ #define _XKB_H_ /* * XKB request codes, used in: * - xkbReqType field of all requests * - requestMinor field of some events */ #define X_kbUseExtension 0 #define X_kbSelectEvents 1 #define X_kbBell 3 #define X_kbGetState 4 #define X_kbLatchLockState 5 #define X_kbGetControls 6 #define X_kbSetControls 7 #define X_kbGetMap 8 #define X_kbSetMap 9 #define X_kbGetCompatMap 10 #define X_kbSetCompatMap 11 #define X_kbGetIndicatorState 12 #define X_kbGetIndicatorMap 13 #define X_kbSetIndicatorMap 14 #define X_kbGetNamedIndicator 15 #define X_kbSetNamedIndicator 16 #define X_kbGetNames 17 #define X_kbSetNames 18 #define X_kbGetGeometry 19 #define X_kbSetGeometry 20 #define X_kbPerClientFlags 21 #define X_kbListComponents 22 #define X_kbGetKbdByName 23 #define X_kbGetDeviceInfo 24 #define X_kbSetDeviceInfo 25 #define X_kbSetDebuggingFlags 101 /* * In the X sense, XKB reports only one event. * The type field of all XKB events is XkbEventCode */ #define XkbEventCode 0 #define XkbNumberEvents (XkbEventCode+1) /* * XKB has a minor event code so it can use one X event code for * multiple purposes. * - reported in the xkbType field of all XKB events. * - XkbSelectEventDetails: Indicates the event for which event details * are being changed */ #define XkbNewKeyboardNotify 0 #define XkbMapNotify 1 #define XkbStateNotify 2 #define XkbControlsNotify 3 #define XkbIndicatorStateNotify 4 #define XkbIndicatorMapNotify 5 #define XkbNamesNotify 6 #define XkbCompatMapNotify 7 #define XkbBellNotify 8 #define XkbActionMessage 9 #define XkbAccessXNotify 10 #define XkbExtensionDeviceNotify 11 /* * Event Mask: * - XkbSelectEvents: Specifies event interest. */ #define XkbNewKeyboardNotifyMask (1L << 0) #define XkbMapNotifyMask (1L << 1) #define XkbStateNotifyMask (1L << 2) #define XkbControlsNotifyMask (1L << 3) #define XkbIndicatorStateNotifyMask (1L << 4) #define XkbIndicatorMapNotifyMask (1L << 5) #define XkbNamesNotifyMask (1L << 6) #define XkbCompatMapNotifyMask (1L << 7) #define XkbBellNotifyMask (1L << 8) #define XkbActionMessageMask (1L << 9) #define XkbAccessXNotifyMask (1L << 10) #define XkbExtensionDeviceNotifyMask (1L << 11) #define XkbAllEventsMask (0xFFF) /* * NewKeyboardNotify event details: */ #define XkbNKN_KeycodesMask (1L << 0) #define XkbNKN_GeometryMask (1L << 1) #define XkbNKN_DeviceIDMask (1L << 2) #define XkbAllNewKeyboardEventsMask (0x7) /* * AccessXNotify event types: * - The 'what' field of AccessXNotify events reports the * reason that the event was generated. */ #define XkbAXN_SKPress 0 #define XkbAXN_SKAccept 1 #define XkbAXN_SKReject 2 #define XkbAXN_SKRelease 3 #define XkbAXN_BKAccept 4 #define XkbAXN_BKReject 5 #define XkbAXN_AXKWarning 6 /* * AccessXNotify details: * - Used as an event detail mask to limit the conditions under which * AccessXNotify events are reported */ #define XkbAXN_SKPressMask (1L << 0) #define XkbAXN_SKAcceptMask (1L << 1) #define XkbAXN_SKRejectMask (1L << 2) #define XkbAXN_SKReleaseMask (1L << 3) #define XkbAXN_BKAcceptMask (1L << 4) #define XkbAXN_BKRejectMask (1L << 5) #define XkbAXN_AXKWarningMask (1L << 6) #define XkbAllAccessXEventsMask (0x7f) /* * Miscellaneous event details: * - event detail masks for assorted events that don't reall * have any details. */ #define XkbAllStateEventsMask XkbAllStateComponentsMask #define XkbAllMapEventsMask XkbAllMapComponentsMask #define XkbAllControlEventsMask XkbAllControlsMask #define XkbAllIndicatorEventsMask XkbAllIndicatorsMask #define XkbAllNameEventsMask XkbAllNamesMask #define XkbAllCompatMapEventsMask XkbAllCompatMask #define XkbAllBellEventsMask (1L << 0) #define XkbAllActionMessagesMask (1L << 0) /* * XKB reports one error: BadKeyboard * A further reason for the error is encoded into to most significant * byte of the resourceID for the error: * XkbErr_BadDevice - the device in question was not found * XkbErr_BadClass - the device was found but it doesn't belong to * the appropriate class. * XkbErr_BadId - the device was found and belongs to the right * class, but not feedback with a matching id was * found. * The low byte of the resourceID for this error contains the device * id, class specifier or feedback id that failed. */ #define XkbKeyboard 0 #define XkbNumberErrors 1 #define XkbErr_BadDevice 0xff #define XkbErr_BadClass 0xfe #define XkbErr_BadId 0xfd /* * Keyboard Components Mask: * - Specifies the components that follow a GetKeyboardByNameReply */ #define XkbClientMapMask (1L << 0) #define XkbServerMapMask (1L << 1) #define XkbCompatMapMask (1L << 2) #define XkbIndicatorMapMask (1L << 3) #define XkbNamesMask (1L << 4) #define XkbGeometryMask (1L << 5) #define XkbControlsMask (1L << 6) #define XkbAllComponentsMask (0x7f) /* * State detail mask: * - The 'changed' field of StateNotify events reports which of * the keyboard state components have changed. * - Used as an event detail mask to limit the conditions under * which StateNotify events are reported. */ #define XkbModifierStateMask (1L << 0) #define XkbModifierBaseMask (1L << 1) #define XkbModifierLatchMask (1L << 2) #define XkbModifierLockMask (1L << 3) #define XkbGroupStateMask (1L << 4) #define XkbGroupBaseMask (1L << 5) #define XkbGroupLatchMask (1L << 6) #define XkbGroupLockMask (1L << 7) #define XkbCompatStateMask (1L << 8) #define XkbGrabModsMask (1L << 9) #define XkbCompatGrabModsMask (1L << 10) #define XkbLookupModsMask (1L << 11) #define XkbCompatLookupModsMask (1L << 12) #define XkbPointerButtonMask (1L << 13) #define XkbAllStateComponentsMask (0x3fff) /* * Controls detail masks: * The controls specified in XkbAllControlsMask: * - The 'changed' field of ControlsNotify events reports which of * the keyboard controls have changed. * - The 'changeControls' field of the SetControls request specifies * the controls for which values are to be changed. * - Used as an event detail mask to limit the conditions under * which ControlsNotify events are reported. * * The controls specified in the XkbAllBooleanCtrlsMask: * - The 'enabledControls' field of ControlsNotify events reports the * current status of the boolean controls. * - The 'enabledControlsChanges' field of ControlsNotify events reports * any boolean controls that have been turned on or off. * - The 'affectEnabledControls' and 'enabledControls' fields of the * kbSetControls request change the set of enabled controls. * - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of * an XkbControlsRec specify the controls to be changed if the keyboard * times out and the values to which they should be changed. * - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags * request specifies the specify the controls to be reset when the * client exits and the values to which they should be reset. * - The 'ctrls' field of an indicator map specifies the controls * that drive the indicator. * - Specifies the boolean controls affected by the SetControls and * LockControls key actions. */ #define XkbRepeatKeysMask (1L << 0) #define XkbSlowKeysMask (1L << 1) #define XkbBounceKeysMask (1L << 2) #define XkbStickyKeysMask (1L << 3) #define XkbMouseKeysMask (1L << 4) #define XkbMouseKeysAccelMask (1L << 5) #define XkbAccessXKeysMask (1L << 6) #define XkbAccessXTimeoutMask (1L << 7) #define XkbAccessXFeedbackMask (1L << 8) #define XkbAudibleBellMask (1L << 9) #define XkbOverlay1Mask (1L << 10) #define XkbOverlay2Mask (1L << 11) #define XkbIgnoreGroupLockMask (1L << 12) #define XkbGroupsWrapMask (1L << 27) #define XkbInternalModsMask (1L << 28) #define XkbIgnoreLockModsMask (1L << 29) #define XkbPerKeyRepeatMask (1L << 30) #define XkbControlsEnabledMask (1L << 31) #define XkbAccessXOptionsMask (XkbStickyKeysMask|XkbAccessXFeedbackMask) #define XkbAllBooleanCtrlsMask (0x00001FFF) #define XkbAllControlsMask (0xF8001FFF) #define XkbAllControlEventsMask XkbAllControlsMask /* * AccessX Options Mask * - The 'accessXOptions' field of an XkbControlsRec specifies the * AccessX options that are currently in effect. * - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues' * fields of an XkbControlsRec specify the Access X options to be * changed if the keyboard times out and the values to which they * should be changed. */ #define XkbAX_SKPressFBMask (1L << 0) #define XkbAX_SKAcceptFBMask (1L << 1) #define XkbAX_FeatureFBMask (1L << 2) #define XkbAX_SlowWarnFBMask (1L << 3) #define XkbAX_IndicatorFBMask (1L << 4) #define XkbAX_StickyKeysFBMask (1L << 5) #define XkbAX_TwoKeysMask (1L << 6) #define XkbAX_LatchToLockMask (1L << 7) #define XkbAX_SKReleaseFBMask (1L << 8) #define XkbAX_SKRejectFBMask (1L << 9) #define XkbAX_BKRejectFBMask (1L << 10) #define XkbAX_DumbBellFBMask (1L << 11) #define XkbAX_FBOptionsMask (0xF3F) #define XkbAX_SKOptionsMask (0x0C0) #define XkbAX_AllOptionsMask (0xFFF) /* * XkbUseCoreKbd is used to specify the core keyboard without having * to look up its X input extension identifier. * XkbUseCorePtr is used to specify the core pointer without having * to look up its X input extension identifier. * XkbDfltXIClass is used to specify "don't care" any place that the * XKB protocol is looking for an X Input Extension * device class. * XkbDfltXIId is used to specify "don't care" any place that the * XKB protocol is looking for an X Input Extension * feedback identifier. * XkbAllXIClasses is used to get information about all device indicators, * whether they're part of the indicator feedback class * or the keyboard feedback class. * XkbAllXIIds is used to get information about all device indicator * feedbacks without having to list them. * XkbXINone is used to indicate that no class or id has been specified. * XkbLegalXILedClass(c) True if 'c' specifies a legal class with LEDs * XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells * XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device * XkbExplicitXIClass(c) True if 'c' explicitly specifies a device class * XkbExplicitXIId(c) True if 'i' explicitly specifies a device id * XkbSingleXIClass(c) True if 'c' specifies exactly one device class, * including the default. * XkbSingleXIId(i) True if 'i' specifies exactly one device * identifier, including the default. */ #define XkbUseCoreKbd 0x0100 #define XkbUseCorePtr 0x0200 #define XkbDfltXIClass 0x0300 #define XkbDfltXIId 0x0400 #define XkbAllXIClasses 0x0500 #define XkbAllXIIds 0x0600 #define XkbXINone 0xff00 #define XkbLegalXILedClass(c) (((c)==KbdFeedbackClass)||\ ((c)==LedFeedbackClass)||\ ((c)==XkbDfltXIClass)||\ ((c)==XkbAllXIClasses)) #define XkbLegalXIBellClass(c) (((c)==KbdFeedbackClass)||\ ((c)==BellFeedbackClass)||\ ((c)==XkbDfltXIClass)||\ ((c)==XkbAllXIClasses)) #define XkbExplicitXIDevice(c) (((c)&(~0xff))==0) #define XkbExplicitXIClass(c) (((c)&(~0xff))==0) #define XkbExplicitXIId(c) (((c)&(~0xff))==0) #define XkbSingleXIClass(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIClass)) #define XkbSingleXIId(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIId)) #define XkbNoModifier 0xff #define XkbNoShiftLevel 0xff #define XkbNoShape 0xff #define XkbNoIndicator 0xff #define XkbNoModifierMask 0 #define XkbAllModifiersMask 0xff #define XkbAllVirtualModsMask 0xffff #define XkbNumKbdGroups 4 #define XkbMaxKbdGroup (XkbNumKbdGroups-1) #define XkbMaxMouseKeysBtn 4 /* * Group Index and Mask: * - Indices into the kt_index array of a key type. * - Mask specifies types to be changed for XkbChangeTypesOfKey */ #define XkbGroup1Index 0 #define XkbGroup2Index 1 #define XkbGroup3Index 2 #define XkbGroup4Index 3 #define XkbAnyGroup 254 #define XkbAllGroups 255 #define XkbGroup1Mask (1<<0) #define XkbGroup2Mask (1<<1) #define XkbGroup3Mask (1<<2) #define XkbGroup4Mask (1<<3) #define XkbAnyGroupMask (1<<7) #define XkbAllGroupsMask (0xf) /* * BuildCoreState: Given a keyboard group and a modifier state, * construct the value to be reported an event. * GroupForCoreState: Given the state reported in an event, * determine the keyboard group. * IsLegalGroup: Returns TRUE if 'g' is a valid group index. */ #define XkbBuildCoreState(m,g) ((((g)&0x3)<<13)|((m)&0xff)) #define XkbGroupForCoreState(s) (((s)>>13)&0x3) #define XkbIsLegalGroup(g) (((g)>=0)&&((g)type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods)) #define XkbIsGroupAction(a) (((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup)) #define XkbIsPtrAction(a) (((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt)) /* * Key Behavior Qualifier: * KB_Permanent indicates that the behavior describes an unalterable * characteristic of the keyboard, not an XKB software-simulation of * the listed behavior. * Key Behavior Types: * Specifies the behavior of the underlying key. */ #define XkbKB_Permanent 0x80 #define XkbKB_OpMask 0x7f #define XkbKB_Default 0x00 #define XkbKB_Lock 0x01 #define XkbKB_RadioGroup 0x02 #define XkbKB_Overlay1 0x03 #define XkbKB_Overlay2 0x04 #define XkbKB_RGAllowNone 0x80 /* * Various macros which describe the range of legal keycodes. */ #define XkbMinLegalKeyCode 8 #define XkbMaxLegalKeyCode 255 #define XkbMaxKeyCount (XkbMaxLegalKeyCode-XkbMinLegalKeyCode+1) #define XkbPerKeyBitArraySize ((XkbMaxLegalKeyCode+1)/8) /* Seems kinda silly to check that an unsigned char is <= 255... */ #define XkbIsLegalKeycode(k) ((k)>=XkbMinLegalKeyCode) /* * Assorted constants and limits. */ #define XkbNumModifiers 8 #define XkbNumVirtualMods 16 #define XkbNumIndicators 32 #define XkbAllIndicatorsMask (0xffffffff) #define XkbMaxRadioGroups 32 #define XkbAllRadioGroupsMask (0xffffffff) #define XkbMaxShiftLevel 63 #define XkbMaxSymsPerKey (XkbMaxShiftLevel*XkbNumKbdGroups) #define XkbRGMaxMembers 12 #define XkbActionMessageLength 6 #define XkbKeyNameLength 4 #define XkbMaxRedirectCount 8 #define XkbGeomPtsPerMM 10 #define XkbGeomMaxColors 32 #define XkbGeomMaxLabelColors 3 #define XkbGeomMaxPriority 255 /* * Key Type index and mask for the four standard key types. */ #define XkbOneLevelIndex 0 #define XkbTwoLevelIndex 1 #define XkbAlphabeticIndex 2 #define XkbKeypadIndex 3 #define XkbLastRequiredType XkbKeypadIndex #define XkbNumRequiredTypes (XkbLastRequiredType+1) #define XkbMaxKeyTypes 255 #define XkbOneLevelMask (1<<0) #define XkbTwoLevelMask (1<<1) #define XkbAlphabeticMask (1<<2) #define XkbKeypadMask (1<<3) #define XkbAllRequiredTypes (0xf) #define XkbShiftLevel(n) ((n)-1) #define XkbShiftLevelMask(n) (1<<((n)-1)) /* * Extension name and version information */ #define XkbName "XKEYBOARD" #define XkbMajorVersion 1 #define XkbMinorVersion 0 /* * Explicit map components: * - Used in the 'explicit' field of an XkbServerMap. Specifies * the keyboard components that should _not_ be updated automatically * in response to core protocol keyboard mapping requests. */ #define XkbExplicitKeyTypesMask (0x0f) #define XkbExplicitKeyType1Mask (1<<0) #define XkbExplicitKeyType2Mask (1<<1) #define XkbExplicitKeyType3Mask (1<<2) #define XkbExplicitKeyType4Mask (1<<3) #define XkbExplicitInterpretMask (1<<4) #define XkbExplicitAutoRepeatMask (1<<5) #define XkbExplicitBehaviorMask (1<<6) #define XkbExplicitVModMapMask (1<<7) #define XkbAllExplicitMask (0xff) /* * Map components masks: * Those in AllMapComponentsMask: * - Specifies the individual fields to be loaded or changed for the * GetMap and SetMap requests. * Those in ClientInfoMask: * - Specifies the components to be allocated by XkbAllocClientMap. * Those in ServerInfoMask: * - Specifies the components to be allocated by XkbAllocServerMap. */ #define XkbKeyTypesMask (1<<0) #define XkbKeySymsMask (1<<1) #define XkbModifierMapMask (1<<2) #define XkbExplicitComponentsMask (1<<3) #define XkbKeyActionsMask (1<<4) #define XkbKeyBehaviorsMask (1<<5) #define XkbVirtualModsMask (1<<6) #define XkbVirtualModMapMask (1<<7) #define XkbAllClientInfoMask (XkbKeyTypesMask|XkbKeySymsMask|XkbModifierMapMask) #define XkbAllServerInfoMask (XkbExplicitComponentsMask|XkbKeyActionsMask|XkbKeyBehaviorsMask|XkbVirtualModsMask|XkbVirtualModMapMask) #define XkbAllMapComponentsMask (XkbAllClientInfoMask|XkbAllServerInfoMask) /* * Symbol interpretations flags: * - Used in the flags field of a symbol interpretation */ #define XkbSI_AutoRepeat (1<<0) #define XkbSI_LockingKey (1<<1) /* * Symbol interpretations match specification: * - Used in the match field of a symbol interpretation to specify * the conditions under which an interpretation is used. */ #define XkbSI_LevelOneOnly (0x80) #define XkbSI_OpMask (0x7f) #define XkbSI_NoneOf (0) #define XkbSI_AnyOfOrNone (1) #define XkbSI_AnyOf (2) #define XkbSI_AllOf (3) #define XkbSI_Exactly (4) /* * Indicator map flags: * - Used in the flags field of an indicator map to indicate the * conditions under which and indicator can be changed and the * effects of changing the indicator. */ #define XkbIM_NoExplicit (1L << 7) #define XkbIM_NoAutomatic (1L << 6) #define XkbIM_LEDDrivesKB (1L << 5) /* * Indicator map component specifications: * - Used by the 'which_groups' and 'which_mods' fields of an indicator * map to specify which keyboard components should be used to drive * the indicator. */ #define XkbIM_UseBase (1L << 0) #define XkbIM_UseLatched (1L << 1) #define XkbIM_UseLocked (1L << 2) #define XkbIM_UseEffective (1L << 3) #define XkbIM_UseCompat (1L << 4) #define XkbIM_UseNone 0 #define XkbIM_UseAnyGroup (XkbIM_UseBase|XkbIM_UseLatched|XkbIM_UseLocked\ |XkbIM_UseEffective) #define XkbIM_UseAnyMods (XkbIM_UseAnyGroup|XkbIM_UseCompat) /* * Compatibility Map Compontents: * - Specifies the components to be allocated in XkbAllocCompatMap. */ #define XkbSymInterpMask (1<<0) #define XkbGroupCompatMask (1<<1) #define XkbAllCompatMask (0x3) /* * Names component mask: * - Specifies the names to be loaded or changed for the GetNames and * SetNames requests. * - Specifies the names that have changed in a NamesNotify event. * - Specifies the names components to be allocated by XkbAllocNames. */ #define XkbKeycodesNameMask (1<<0) #define XkbGeometryNameMask (1<<1) #define XkbSymbolsNameMask (1<<2) #define XkbPhysSymbolsNameMask (1<<3) #define XkbTypesNameMask (1<<4) #define XkbCompatNameMask (1<<5) #define XkbKeyTypeNamesMask (1<<6) #define XkbKTLevelNamesMask (1<<7) #define XkbIndicatorNamesMask (1<<8) #define XkbKeyNamesMask (1<<9) #define XkbKeyAliasesMask (1<<10) #define XkbVirtualModNamesMask (1<<11) #define XkbGroupNamesMask (1<<12) #define XkbRGNamesMask (1<<13) #define XkbComponentNamesMask (0x3f) #define XkbAllNamesMask (0x3fff) /* * GetByName components: * - Specifies desired or necessary components to GetKbdByName request. * - Reports the components that were found in a GetKbdByNameReply */ #define XkbGBN_TypesMask (1L << 0) #define XkbGBN_CompatMapMask (1L << 1) #define XkbGBN_ClientSymbolsMask (1L << 2) #define XkbGBN_ServerSymbolsMask (1L << 3) #define XkbGBN_SymbolsMask (XkbGBN_ClientSymbolsMask|XkbGBN_ServerSymbolsMask) #define XkbGBN_IndicatorMapMask (1L << 4) #define XkbGBN_KeyNamesMask (1L << 5) #define XkbGBN_GeometryMask (1L << 6) #define XkbGBN_OtherNamesMask (1L << 7) #define XkbGBN_AllComponentsMask (0xff) /* * ListComponents flags */ #define XkbLC_Hidden (1L << 0) #define XkbLC_Default (1L << 1) #define XkbLC_Partial (1L << 2) #define XkbLC_AlphanumericKeys (1L << 8) #define XkbLC_ModifierKeys (1L << 9) #define XkbLC_KeypadKeys (1L << 10) #define XkbLC_FunctionKeys (1L << 11) #define XkbLC_AlternateGroup (1L << 12) /* * X Input Extension Interactions * - Specifies the possible interactions between XKB and the X input * extension * - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo) * XKB information about an extension device. * - Reports the list of supported optional features in the reply to * XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event. * XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify * events to indicate an attempt to use an unsupported feature. */ #define XkbXI_KeyboardsMask (1L << 0) #define XkbXI_ButtonActionsMask (1L << 1) #define XkbXI_IndicatorNamesMask (1L << 2) #define XkbXI_IndicatorMapsMask (1L << 3) #define XkbXI_IndicatorStateMask (1L << 4) #define XkbXI_UnsupportedFeatureMask (1L << 15) #define XkbXI_AllFeaturesMask (0x001f) #define XkbXI_AllDeviceFeaturesMask (0x001e) #define XkbXI_IndicatorsMask (0x001c) #define XkbAllExtensionDeviceEventsMask (0x801f) /* * Per-Client Flags: * - Specifies flags to be changed by the PerClientFlags request. */ #define XkbPCF_DetectableAutoRepeatMask (1L << 0) #define XkbPCF_GrabsUseXKBStateMask (1L << 1) #define XkbPCF_AutoResetControlsMask (1L << 2) #define XkbPCF_LookupStateWhenGrabbed (1L << 3) #define XkbPCF_SendEventUsesXKBState (1L << 4) #define XkbPCF_AllFlagsMask (0x1F) /* * Debugging flags and controls */ #define XkbDF_DisableLocks (1<<0) #endif /* _XKB_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/XKBproto.h0000644000000000000000000007426013614532331017017 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBPROTO_H_ #define _XKBPROTO_H_ #include #include #define Window CARD32 #define Atom CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define XkbPaddedSize(n) ((((unsigned int)(n)+3) >> 2) << 2) typedef struct _xkbUseExtension { CARD8 reqType; CARD8 xkbReqType; /* always X_KBUseExtension */ CARD16 length B16; CARD16 wantedMajor B16; CARD16 wantedMinor B16; } xkbUseExtensionReq; #define sz_xkbUseExtensionReq 8 typedef struct _xkbUseExtensionReply { BYTE type; /* X_Reply */ BOOL supported; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 serverMajor B16; CARD16 serverMinor B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbUseExtensionReply; #define sz_xkbUseExtensionReply 32 typedef struct _xkbSelectEvents { CARD8 reqType; CARD8 xkbReqType; /* X_KBSelectEvents */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 affectWhich B16; CARD16 clear B16; CARD16 selectAll B16; CARD16 affectMap B16; CARD16 map B16; } xkbSelectEventsReq; #define sz_xkbSelectEventsReq 16 typedef struct _xkbBell { CARD8 reqType; CARD8 xkbReqType; /* X_KBBell */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 bellClass B16; CARD16 bellID B16; INT8 percent; BOOL forceSound; BOOL eventOnly; CARD8 pad1; INT16 pitch B16; INT16 duration B16; CARD16 pad2 B16; Atom name B32; Window window B32; } xkbBellReq; #define sz_xkbBellReq 28 typedef struct _xkbGetState { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetState */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; } xkbGetStateReq; #define sz_xkbGetStateReq 8 typedef struct _xkbGetStateReply { BYTE type; BYTE deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD8 mods; CARD8 baseMods; CARD8 latchedMods; CARD8 lockedMods; CARD8 group; CARD8 lockedGroup; INT16 baseGroup B16; INT16 latchedGroup B16; CARD8 compatState; CARD8 grabMods; CARD8 compatGrabMods; CARD8 lookupMods; CARD8 compatLookupMods; CARD8 pad1; CARD16 ptrBtnState B16; CARD16 pad2 B16; CARD32 pad3 B32; } xkbGetStateReply; #define sz_xkbGetStateReply 32 typedef struct _xkbLatchLockState { CARD8 reqType; CARD8 xkbReqType; /* always X_KBLatchLockState */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 affectModLocks; CARD8 modLocks; BOOL lockGroup; CARD8 groupLock; CARD8 affectModLatches; CARD8 modLatches; CARD8 pad; BOOL latchGroup; INT16 groupLatch B16; } xkbLatchLockStateReq; #define sz_xkbLatchLockStateReq 16 typedef struct _xkbGetControls { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetControls */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; } xkbGetControlsReq; #define sz_xkbGetControlsReq 8 typedef struct _xkbGetControlsReply { BYTE type; /* X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD8 mkDfltBtn; CARD8 numGroups; CARD8 groupsWrap; CARD8 internalMods; CARD8 ignoreLockMods; CARD8 internalRealMods; CARD8 ignoreLockRealMods; CARD8 pad1; CARD16 internalVMods B16; CARD16 ignoreLockVMods B16; CARD16 repeatDelay B16; CARD16 repeatInterval B16; CARD16 slowKeysDelay B16; CARD16 debounceDelay B16; CARD16 mkDelay B16; CARD16 mkInterval B16; CARD16 mkTimeToMax B16; CARD16 mkMaxSpeed B16; INT16 mkCurve B16; CARD16 axOptions B16; CARD16 axTimeout B16; CARD16 axtOptsMask B16; CARD16 axtOptsValues B16; CARD16 pad2 B16; CARD32 axtCtrlsMask B32; CARD32 axtCtrlsValues B32; CARD32 enabledCtrls B32; BYTE perKeyRepeat[XkbPerKeyBitArraySize]; } xkbGetControlsReply; #define sz_xkbGetControlsReply 92 typedef struct _xkbSetControls { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetControls */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 affectInternalMods; CARD8 internalMods; CARD8 affectIgnoreLockMods; CARD8 ignoreLockMods; CARD16 affectInternalVMods B16; CARD16 internalVMods B16; CARD16 affectIgnoreLockVMods B16; CARD16 ignoreLockVMods B16; CARD8 mkDfltBtn; CARD8 groupsWrap; CARD16 axOptions B16; CARD16 pad1 B16; CARD32 affectEnabledCtrls B32; CARD32 enabledCtrls B32; CARD32 changeCtrls B32; CARD16 repeatDelay B16; CARD16 repeatInterval B16; CARD16 slowKeysDelay B16; CARD16 debounceDelay B16; CARD16 mkDelay B16; CARD16 mkInterval B16; CARD16 mkTimeToMax B16; CARD16 mkMaxSpeed B16; INT16 mkCurve B16; CARD16 axTimeout B16; CARD32 axtCtrlsMask B32; CARD32 axtCtrlsValues B32; CARD16 axtOptsMask B16; CARD16 axtOptsValues B16; BYTE perKeyRepeat[XkbPerKeyBitArraySize]; } xkbSetControlsReq; #define sz_xkbSetControlsReq 100 typedef struct _xkbKTMapEntryWireDesc { BOOL active; CARD8 mask; CARD8 level; CARD8 realMods; CARD16 virtualMods B16; CARD16 pad B16; } xkbKTMapEntryWireDesc; #define sz_xkbKTMapEntryWireDesc 8 typedef struct _xkbKTSetMapEntryWireDesc { CARD8 level; CARD8 realMods; CARD16 virtualMods B16; } xkbKTSetMapEntryWireDesc; #define sz_xkbKTSetMapEntryWireDesc 4 typedef struct _xkbModsWireDesc { CARD8 mask; /* GetMap only */ CARD8 realMods; CARD16 virtualMods B16; } xkbModsWireDesc; #define sz_xkbModsWireDesc 4 typedef struct _xkbKeyTypeWireDesc { CARD8 mask; CARD8 realMods; CARD16 virtualMods B16; CARD8 numLevels; CARD8 nMapEntries; BOOL preserve; CARD8 pad; } xkbKeyTypeWireDesc; #define sz_xkbKeyTypeWireDesc 8 typedef struct _xkbSymMapWireDesc { CARD8 ktIndex[XkbNumKbdGroups]; CARD8 groupInfo; CARD8 width; CARD16 nSyms B16; } xkbSymMapWireDesc; #define sz_xkbSymMapWireDesc 8 typedef struct _xkbVModMapWireDesc { KeyCode key; CARD8 pad; CARD16 vmods B16; } xkbVModMapWireDesc; #define sz_xkbVModMapWireDesc 4 typedef struct _xkbBehaviorWireDesc { CARD8 key; CARD8 type; CARD8 data; CARD8 pad; } xkbBehaviorWireDesc; #define sz_xkbBehaviorWireDesc 4 typedef struct _xkbActionWireDesc { CARD8 type; CARD8 data[7]; } xkbActionWireDesc; #define sz_xkbActionWireDesc 8 typedef struct _xkbGetMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 full B16; CARD16 partial B16; CARD8 firstType; CARD8 nTypes; KeyCode firstKeySym; CARD8 nKeySyms; KeyCode firstKeyAct; CARD8 nKeyActs; KeyCode firstKeyBehavior; CARD8 nKeyBehaviors; CARD16 virtualMods B16; KeyCode firstKeyExplicit; CARD8 nKeyExplicit; KeyCode firstModMapKey; CARD8 nModMapKeys; KeyCode firstVModMapKey; CARD8 nVModMapKeys; CARD16 pad1 B16; } xkbGetMapReq; #define sz_xkbGetMapReq 28 typedef struct _xkbGetMapReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 pad1 B16; KeyCode minKeyCode; KeyCode maxKeyCode; CARD16 present B16; CARD8 firstType; CARD8 nTypes; CARD8 totalTypes; KeyCode firstKeySym; CARD16 totalSyms B16; CARD8 nKeySyms; KeyCode firstKeyAct; CARD16 totalActs B16; CARD8 nKeyActs; KeyCode firstKeyBehavior; CARD8 nKeyBehaviors; CARD8 totalKeyBehaviors; KeyCode firstKeyExplicit; CARD8 nKeyExplicit; CARD8 totalKeyExplicit; KeyCode firstModMapKey; CARD8 nModMapKeys; CARD8 totalModMapKeys; KeyCode firstVModMapKey; CARD8 nVModMapKeys; CARD8 totalVModMapKeys; CARD8 pad2; CARD16 virtualMods B16; } xkbGetMapReply; #define sz_xkbGetMapReply 40 #define XkbSetMapResizeTypes (1L<<0) #define XkbSetMapRecomputeActions (1L<<1) #define XkbSetMapAllFlags (0x3) typedef struct _xkbSetMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 present B16; CARD16 flags B16; KeyCode minKeyCode; KeyCode maxKeyCode; CARD8 firstType; CARD8 nTypes; KeyCode firstKeySym; CARD8 nKeySyms; CARD16 totalSyms B16; KeyCode firstKeyAct; CARD8 nKeyActs; CARD16 totalActs B16; KeyCode firstKeyBehavior; CARD8 nKeyBehaviors; CARD8 totalKeyBehaviors; KeyCode firstKeyExplicit; CARD8 nKeyExplicit; CARD8 totalKeyExplicit; KeyCode firstModMapKey; CARD8 nModMapKeys; CARD8 totalModMapKeys; KeyCode firstVModMapKey; CARD8 nVModMapKeys; CARD8 totalVModMapKeys; CARD16 virtualMods B16; } xkbSetMapReq; #define sz_xkbSetMapReq 36 typedef struct _xkbSymInterpretWireDesc { CARD32 sym B32; CARD8 mods; CARD8 match; CARD8 virtualMod; CARD8 flags; xkbActionWireDesc act; } xkbSymInterpretWireDesc; #define sz_xkbSymInterpretWireDesc 16 typedef struct _xkbGetCompatMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetCompatMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 groups; BOOL getAllSI; CARD16 firstSI B16; CARD16 nSI B16; } xkbGetCompatMapReq; #define sz_xkbGetCompatMapReq 12 typedef struct _xkbGetCompatMapReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD8 groups; CARD8 pad1; CARD16 firstSI B16; CARD16 nSI B16; CARD16 nTotalSI B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbGetCompatMapReply; #define sz_xkbGetCompatMapReply 32 typedef struct _xkbSetCompatMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetCompatMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 pad1; BOOL recomputeActions; BOOL truncateSI; CARD8 groups; CARD16 firstSI B16; CARD16 nSI B16; CARD16 pad2 B16; } xkbSetCompatMapReq; #define sz_xkbSetCompatMapReq 16 typedef struct _xkbGetIndicatorState { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetIndicatorState */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad1 B16; } xkbGetIndicatorStateReq; #define sz_xkbGetIndicatorStateReq 8 typedef struct _xkbGetIndicatorStateReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 state B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbGetIndicatorStateReply; #define sz_xkbGetIndicatorStateReply 32 typedef struct _xkbGetIndicatorMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetIndicatorMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; CARD32 which B32; } xkbGetIndicatorMapReq; #define sz_xkbGetIndicatorMapReq 12 typedef struct _xkbGetIndicatorMapReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 which B32; CARD32 realIndicators B32; CARD8 nIndicators; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbGetIndicatorMapReply; #define sz_xkbGetIndicatorMapReply 32 typedef struct _xkbIndicatorMapWireDesc { CARD8 flags; CARD8 whichGroups; CARD8 groups; CARD8 whichMods; CARD8 mods; CARD8 realMods; CARD16 virtualMods B16; CARD32 ctrls B32; } xkbIndicatorMapWireDesc; #define sz_xkbIndicatorMapWireDesc 12 typedef struct _xkbSetIndicatorMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetIndicatorMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad1 B16; CARD32 which B32; } xkbSetIndicatorMapReq; #define sz_xkbSetIndicatorMapReq 12 typedef struct _xkbGetNamedIndicator { CARD8 reqType; CARD8 xkbReqType; /* X_KBGetNamedIndicator */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 ledClass B16; CARD16 ledID B16; CARD16 pad1 B16; Atom indicator B32; } xkbGetNamedIndicatorReq; #define sz_xkbGetNamedIndicatorReq 16 typedef struct _xkbGetNamedIndicatorReply { BYTE type; BYTE deviceID; CARD16 sequenceNumber B16; CARD32 length B32; Atom indicator B32; BOOL found; BOOL on; BOOL realIndicator; CARD8 ndx; CARD8 flags; CARD8 whichGroups; CARD8 groups; CARD8 whichMods; CARD8 mods; CARD8 realMods; CARD16 virtualMods B16; CARD32 ctrls B32; BOOL supported; CARD8 pad1; CARD16 pad2 B16; } xkbGetNamedIndicatorReply; #define sz_xkbGetNamedIndicatorReply 32 typedef struct _xkbSetNamedIndicator { CARD8 reqType; CARD8 xkbReqType; /* X_KBSetNamedIndicator */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 ledClass B16; CARD16 ledID B16; CARD16 pad1 B16; Atom indicator B32; BOOL setState; BOOL on; BOOL setMap; BOOL createMap; CARD8 pad2; CARD8 flags; CARD8 whichGroups; CARD8 groups; CARD8 whichMods; CARD8 realMods; CARD16 virtualMods B16; CARD32 ctrls B32; } xkbSetNamedIndicatorReq; #define sz_xkbSetNamedIndicatorReq 32 typedef struct _xkbGetNames { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetNames */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; CARD32 which B32; } xkbGetNamesReq; #define sz_xkbGetNamesReq 12 typedef struct _xkbGetNamesReply { BYTE type; BYTE deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 which B32; KeyCode minKeyCode; KeyCode maxKeyCode; CARD8 nTypes; CARD8 groupNames; CARD16 virtualMods B16; KeyCode firstKey; CARD8 nKeys; CARD32 indicators B32; CARD8 nRadioGroups; CARD8 nKeyAliases; CARD16 nKTLevels B16; CARD32 pad3 B32; } xkbGetNamesReply; #define sz_xkbGetNamesReply 32 typedef struct _xkbSetNames { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetNames */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 virtualMods B16; CARD32 which B32; CARD8 firstType; CARD8 nTypes; CARD8 firstKTLevel; CARD8 nKTLevels; CARD32 indicators B32; CARD8 groupNames; CARD8 nRadioGroups; KeyCode firstKey; CARD8 nKeys; CARD8 nKeyAliases; CARD8 pad1; CARD16 totalKTLevelNames B16; } xkbSetNamesReq; #define sz_xkbSetNamesReq 28 typedef struct _xkbPointWireDesc { INT16 x B16; INT16 y B16; } xkbPointWireDesc; #define sz_xkbPointWireDesc 4 typedef struct _xkbOutlineWireDesc { CARD8 nPoints; CARD8 cornerRadius; CARD16 pad B16; } xkbOutlineWireDesc; #define sz_xkbOutlineWireDesc 4 typedef struct _xkbShapeWireDesc { Atom name B32; CARD8 nOutlines; CARD8 primaryNdx; CARD8 approxNdx; CARD8 pad; } xkbShapeWireDesc; #define sz_xkbShapeWireDesc 8 typedef struct _xkbSectionWireDesc { Atom name B32; INT16 top B16; INT16 left B16; CARD16 width B16; CARD16 height B16; INT16 angle B16; CARD8 priority; CARD8 nRows; CARD8 nDoodads; CARD8 nOverlays; CARD16 pad B16; } xkbSectionWireDesc; #define sz_xkbSectionWireDesc 20 typedef struct _xkbRowWireDesc { INT16 top B16; INT16 left B16; CARD8 nKeys; BOOL vertical; CARD16 pad B16; } xkbRowWireDesc; #define sz_xkbRowWireDesc 8 typedef struct _xkbKeyWireDesc { CARD8 name[XkbKeyNameLength]; INT16 gap B16; CARD8 shapeNdx; CARD8 colorNdx; } xkbKeyWireDesc; #define sz_xkbKeyWireDesc 8 typedef struct _xkbOverlayWireDesc { Atom name B32; CARD8 nRows; CARD8 pad1; CARD16 pad2 B16; } xkbOverlayWireDesc; #define sz_xkbOverlayWireDesc 8 typedef struct _xkbOverlayRowWireDesc { CARD8 rowUnder; CARD8 nKeys; CARD16 pad1 B16; } xkbOverlayRowWireDesc; #define sz_xkbOverlayRowWireDesc 4 typedef struct _xkbOverlayKeyWireDesc { CARD8 over[XkbKeyNameLength]; CARD8 under[XkbKeyNameLength]; } xkbOverlayKeyWireDesc; #define sz_xkbOverlayKeyWireDesc 8 typedef struct _xkbShapeDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD8 colorNdx; CARD8 shapeNdx; CARD16 pad1 B16; CARD32 pad2 B32; } xkbShapeDoodadWireDesc; #define sz_xkbShapeDoodadWireDesc 20 typedef struct _xkbTextDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD16 width B16; CARD16 height B16; CARD8 colorNdx; CARD8 pad1; CARD16 pad2 B16; } xkbTextDoodadWireDesc; #define sz_xkbTextDoodadWireDesc 20 typedef struct _xkbIndicatorDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD8 shapeNdx; CARD8 onColorNdx; CARD8 offColorNdx; CARD8 pad1; CARD32 pad2 B32; } xkbIndicatorDoodadWireDesc; #define sz_xkbIndicatorDoodadWireDesc 20 typedef struct _xkbLogoDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD8 colorNdx; CARD8 shapeNdx; CARD16 pad1 B16; CARD32 pad2 B32; } xkbLogoDoodadWireDesc; #define sz_xkbLogoDoodadWireDesc 20 typedef struct _xkbAnyDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD32 pad2 B32; CARD32 pad3 B32; } xkbAnyDoodadWireDesc; #define sz_xkbAnyDoodadWireDesc 20 typedef union _xkbDoodadWireDesc { xkbAnyDoodadWireDesc any; xkbShapeDoodadWireDesc shape; xkbTextDoodadWireDesc text; xkbIndicatorDoodadWireDesc indicator; xkbLogoDoodadWireDesc logo; } xkbDoodadWireDesc; #define sz_xkbDoodadWireDesc 20 typedef struct _xkbGetGeometry { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetGeometry */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; Atom name B32; } xkbGetGeometryReq; #define sz_xkbGetGeometryReq 12 typedef struct _xkbGetGeometryReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; Atom name B32; BOOL found; CARD8 pad; CARD16 widthMM B16; CARD16 heightMM B16; CARD16 nProperties B16; CARD16 nColors B16; CARD16 nShapes B16; CARD16 nSections B16; CARD16 nDoodads B16; CARD16 nKeyAliases B16; CARD8 baseColorNdx; CARD8 labelColorNdx; } xkbGetGeometryReply; #define sz_xkbGetGeometryReply 32 typedef struct _xkbSetGeometry { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetGeometry */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 nShapes; CARD8 nSections; Atom name B32; CARD16 widthMM B16; CARD16 heightMM B16; CARD16 nProperties B16; CARD16 nColors B16; CARD16 nDoodads B16; CARD16 nKeyAliases B16; CARD8 baseColorNdx; CARD8 labelColorNdx; CARD16 pad B16; } xkbSetGeometryReq; #define sz_xkbSetGeometryReq 28 typedef struct _xkbPerClientFlags { CARD8 reqType; CARD8 xkbReqType;/* always X_KBPerClientFlags */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad1 B16; CARD32 change B32; CARD32 value B32; CARD32 ctrlsToChange B32; CARD32 autoCtrls B32; CARD32 autoCtrlValues B32; } xkbPerClientFlagsReq; #define sz_xkbPerClientFlagsReq 28 typedef struct _xkbPerClientFlagsReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 supported B32; CARD32 value B32; CARD32 autoCtrls B32; CARD32 autoCtrlValues B32; CARD32 pad1 B32; CARD32 pad2 B32; } xkbPerClientFlagsReply; #define sz_xkbPerClientFlagsReply 32 typedef struct _xkbListComponents { CARD8 reqType; CARD8 xkbReqType; /* always X_KBListComponents */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 maxNames B16; } xkbListComponentsReq; #define sz_xkbListComponentsReq 8 typedef struct _xkbListComponentsReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nKeymaps B16; CARD16 nKeycodes B16; CARD16 nTypes B16; CARD16 nCompatMaps B16; CARD16 nSymbols B16; CARD16 nGeometries B16; CARD16 extra B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; } xkbListComponentsReply; #define sz_xkbListComponentsReply 32 typedef struct _xkbGetKbdByName { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetKbdByName */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 need B16; /* combination of XkbGBN_* */ CARD16 want B16; /* combination of XkbGBN_* */ BOOL load; CARD8 pad; } xkbGetKbdByNameReq; #define sz_xkbGetKbdByNameReq 12 typedef struct _xkbGetKbdByNameReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; KeyCode minKeyCode; KeyCode maxKeyCode; BOOL loaded; BOOL newKeyboard; CARD16 found B16; /* combination of XkbGBN_* */ CARD16 reported B16; /* combination of XkbAllComponents */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xkbGetKbdByNameReply; #define sz_xkbGetKbdByNameReply 32 typedef struct _xkbDeviceLedsWireDesc { CARD16 ledClass B16; CARD16 ledID B16; CARD32 namesPresent B32; CARD32 mapsPresent B32; CARD32 physIndicators B32; CARD32 state B32; } xkbDeviceLedsWireDesc; #define sz_xkbDeviceLedsWireDesc 20 typedef struct _xkbGetDeviceInfo { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetDeviceInfo */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 wanted B16; BOOL allBtns; CARD8 firstBtn; CARD8 nBtns; CARD8 pad; CARD16 ledClass B16; CARD16 ledID B16; } xkbGetDeviceInfoReq; #define sz_xkbGetDeviceInfoReq 16 typedef struct _xkbGetDeviceInfoReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 present B16; CARD16 supported B16; CARD16 unsupported B16; CARD16 nDeviceLedFBs B16; CARD8 firstBtnWanted; CARD8 nBtnsWanted; CARD8 firstBtnRtrn; CARD8 nBtnsRtrn; CARD8 totalBtns; BOOL hasOwnState; CARD16 dfltKbdFB B16; CARD16 dfltLedFB B16; CARD16 pad B16; Atom devType B32; } xkbGetDeviceInfoReply; #define sz_xkbGetDeviceInfoReply 32 typedef struct _xkbSetDeviceInfo { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetDeviceInfo */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 firstBtn; CARD8 nBtns; CARD16 change B16; CARD16 nDeviceLedFBs B16; } xkbSetDeviceInfoReq; #define sz_xkbSetDeviceInfoReq 12 typedef struct _xkbSetDebuggingFlags { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetDebuggingFlags */ CARD16 length B16; CARD16 msgLength B16; CARD16 pad B16; CARD32 affectFlags B32; CARD32 flags B32; CARD32 affectCtrls B32; CARD32 ctrls B32; } xkbSetDebuggingFlagsReq; #define sz_xkbSetDebuggingFlagsReq 24 typedef struct _xkbSetDebuggingFlagsReply { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 currentFlags B32; CARD32 currentCtrls B32; CARD32 supportedFlags B32; CARD32 supportedCtrls B32; CARD32 pad1 B32; CARD32 pad2 B32; } xkbSetDebuggingFlagsReply; #define sz_xkbSetDebuggingFlagsReply 32 /* * X KEYBOARD EXTENSION EVENT STRUCTURES */ typedef struct _xkbAnyEvent { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xkbAnyEvent; #define sz_xkbAnyEvent 32 typedef struct _xkbNewKeyboardNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 oldDeviceID; KeyCode minKeyCode; KeyCode maxKeyCode; KeyCode oldMinKeyCode; KeyCode oldMaxKeyCode; CARD8 requestMajor; CARD8 requestMinor; CARD16 changed B16; CARD8 detail; CARD8 pad1; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xkbNewKeyboardNotify; #define sz_xkbNewKeyboardNotify 32 typedef struct _xkbMapNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 ptrBtnActions; CARD16 changed B16; KeyCode minKeyCode; KeyCode maxKeyCode; CARD8 firstType; CARD8 nTypes; KeyCode firstKeySym; CARD8 nKeySyms; KeyCode firstKeyAct; CARD8 nKeyActs; KeyCode firstKeyBehavior; CARD8 nKeyBehaviors; KeyCode firstKeyExplicit; CARD8 nKeyExplicit; KeyCode firstModMapKey; CARD8 nModMapKeys; KeyCode firstVModMapKey; CARD8 nVModMapKeys; CARD16 virtualMods B16; CARD16 pad1 B16; } xkbMapNotify; #define sz_xkbMapNotify 32 typedef struct _xkbStateNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 mods; CARD8 baseMods; CARD8 latchedMods; CARD8 lockedMods; CARD8 group; INT16 baseGroup B16; INT16 latchedGroup B16; CARD8 lockedGroup; CARD8 compatState; CARD8 grabMods; CARD8 compatGrabMods; CARD8 lookupMods; CARD8 compatLookupMods; CARD16 ptrBtnState B16; CARD16 changed B16; KeyCode keycode; CARD8 eventType; CARD8 requestMajor; CARD8 requestMinor; } xkbStateNotify; #define sz_xkbStateNotify 32 typedef struct _xkbControlsNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 numGroups; CARD16 pad1 B16; CARD32 changedControls B32; CARD32 enabledControls B32; CARD32 enabledControlChanges B32; KeyCode keycode; CARD8 eventType; CARD8 requestMajor; CARD8 requestMinor; CARD32 pad2 B32; } xkbControlsNotify; #define sz_xkbControlsNotify 32 typedef struct _xkbIndicatorNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 pad1; CARD16 pad2 B16; CARD32 state B32; CARD32 changed B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbIndicatorNotify; #define sz_xkbIndicatorNotify 32 typedef struct _xkbNamesNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 pad1; CARD16 changed B16; CARD8 firstType; CARD8 nTypes; CARD8 firstLevelName; CARD8 nLevelNames; CARD8 pad2; CARD8 nRadioGroups; CARD8 nAliases; CARD8 changedGroupNames; CARD16 changedVirtualMods B16; CARD8 firstKey; CARD8 nKeys; CARD32 changedIndicators B32; CARD32 pad3 B32; } xkbNamesNotify; #define sz_xkbNamesNotify 32 typedef struct _xkbCompatMapNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 changedGroups; CARD16 firstSI B16; CARD16 nSI B16; CARD16 nTotalSI B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xkbCompatMapNotify; #define sz_xkbCompatMapNotify 32 typedef struct _xkbBellNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 bellClass; CARD8 bellID; CARD8 percent; CARD16 pitch B16; CARD16 duration B16; Atom name B32; Window window B32; BOOL eventOnly; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; } xkbBellNotify; #define sz_xkbBellNotify 32 typedef struct _xkbActionMessage { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; KeyCode keycode; BOOL press; BOOL keyEventFollows; CARD8 mods; CARD8 group; CARD8 message[8]; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; } xkbActionMessage; #define sz_xkbActionMessage 32 typedef struct _xkbAccessXNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; KeyCode keycode; CARD16 detail B16; CARD16 slowKeysDelay B16; CARD16 debounceDelay B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xkbAccessXNotify; #define sz_xkbAccessXNotify 32 typedef struct _xkbExtensionDeviceNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 pad1; CARD16 reason B16; CARD16 ledClass B16; CARD16 ledID B16; CARD32 ledsDefined B32; CARD32 ledState B32; CARD8 firstBtn; CARD8 nBtns; CARD16 supported B16; CARD16 unsupported B16; CARD16 pad3 B16; } xkbExtensionDeviceNotify; #define sz_xkbExtensionDeviceNotify 32 typedef struct _xkbEvent { union { xkbAnyEvent any; xkbNewKeyboardNotify new_kbd; xkbMapNotify map; xkbStateNotify state; xkbControlsNotify ctrls; xkbIndicatorNotify indicators; xkbNamesNotify names; xkbCompatMapNotify compat; xkbBellNotify bell; xkbActionMessage message; xkbAccessXNotify accessx; xkbExtensionDeviceNotify device; } u; } xkbEvent; #define sz_xkbEvent 32 #undef Window #undef Atom #undef Time #undef KeyCode #undef KeySym #endif /* _XKBPROTO_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/XKBrules.h0000644000000000000000000001200613614532331016774 0ustar #ifndef _XKBRULES_H_ #define _XKBRULES_H_ 1 /************************************************************ Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /***====================================================================***/ typedef struct _XkbRF_VarDefs { char * model; char * layout; char * variant; char * options; unsigned short sz_extra; unsigned short num_extra; char * extra_names; char ** extra_values; } XkbRF_VarDefsRec,*XkbRF_VarDefsPtr; typedef struct _XkbRF_VarDesc { char * name; char * desc; } XkbRF_VarDescRec, *XkbRF_VarDescPtr; typedef struct _XkbRF_DescribeVars { int sz_desc; int num_desc; XkbRF_VarDescPtr desc; } XkbRF_DescribeVarsRec,*XkbRF_DescribeVarsPtr; typedef struct _XkbRF_Rule { int number; int layout_num; int variant_num; char * model; char * layout; char * variant; char * option; /* yields */ char * keycodes; char * symbols; char * types; char * compat; char * geometry; char * keymap; unsigned flags; } XkbRF_RuleRec,*XkbRF_RulePtr; typedef struct _XkbRF_Group { int number; char * name; char * words; } XkbRF_GroupRec, *XkbRF_GroupPtr; #define XkbRF_PendingMatch (1L<<1) #define XkbRF_Option (1L<<2) #define XkbRF_Append (1L<<3) #define XkbRF_Normal (1L<<4) #define XkbRF_Invalid (1L<<5) typedef struct _XkbRF_Rules { XkbRF_DescribeVarsRec models; XkbRF_DescribeVarsRec layouts; XkbRF_DescribeVarsRec variants; XkbRF_DescribeVarsRec options; unsigned short sz_extra; unsigned short num_extra; char ** extra_names; XkbRF_DescribeVarsPtr extra; unsigned short sz_rules; unsigned short num_rules; XkbRF_RulePtr rules; unsigned short sz_groups; unsigned short num_groups; XkbRF_GroupPtr groups; } XkbRF_RulesRec, *XkbRF_RulesPtr; /***====================================================================***/ _XFUNCPROTOBEGIN extern Bool XkbRF_GetComponents( XkbRF_RulesPtr /* rules */, XkbRF_VarDefsPtr /* var_defs */, XkbComponentNamesPtr /* names */ ); extern XkbRF_RulePtr XkbRF_AddRule( XkbRF_RulesPtr /* rules */ ); extern XkbRF_GroupPtr XkbRF_AddGroup(XkbRF_RulesPtr rules); extern Bool XkbRF_LoadRules( FILE * /* file */, XkbRF_RulesPtr /* rules */ ); extern Bool XkbRF_LoadRulesByName( char * /* base */, char * /* locale */, XkbRF_RulesPtr /* rules */ ); /***====================================================================***/ extern XkbRF_VarDescPtr XkbRF_AddVarDesc( XkbRF_DescribeVarsPtr /* vars */ ); extern XkbRF_VarDescPtr XkbRF_AddVarDescCopy( XkbRF_DescribeVarsPtr /* vars */, XkbRF_VarDescPtr /* copy_from */ ); extern XkbRF_DescribeVarsPtr XkbRF_AddVarToDescribe( XkbRF_RulesPtr /* rules */, char * /* name */ ); extern Bool XkbRF_LoadDescriptions( FILE * /* file */, XkbRF_RulesPtr /* rules */ ); extern Bool XkbRF_LoadDescriptionsByName( char * /* base */, char * /* locale */, XkbRF_RulesPtr /* rules */ ); extern XkbRF_RulesPtr XkbRF_Load( char * /* base */, char * /* locale */, Bool /* wantDesc */, Bool /* wantRules */ ); extern XkbRF_RulesPtr XkbRF_Create( int /* sz_rules */, int /* sz_extra */ ); /***====================================================================***/ extern void XkbRF_Free( XkbRF_RulesPtr /* rules */, Bool /* freeRules */ ); /***====================================================================***/ #define _XKB_RF_NAMES_PROP_ATOM "_XKB_RULES_NAMES" #define _XKB_RF_NAMES_PROP_MAXLEN 1024 #ifndef XKB_IN_SERVER extern Bool XkbRF_GetNamesProp( Display * /* dpy */, char ** /* rules_file_rtrn */, XkbRF_VarDefsPtr /* var_defs_rtrn */ ); extern Bool XkbRF_SetNamesProp( Display * /* dpy */, char * /* rules_file */, XkbRF_VarDefsPtr /* var_defs */ ); #endif _XFUNCPROTOEND #endif /* _XKBRULES_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/XKBsrv.h0000644000000000000000000006775213614532331016476 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBSRV_H_ #define _XKBSRV_H_ #ifdef XKB_IN_SERVER #define XkbAllocClientMap SrvXkbAllocClientMap #define XkbAllocServerMap SrvXkbAllocServerMap #define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey #define XkbAddKeyType SrvXkbAddKeyType #define XkbCopyKeyType SrvXkbCopyKeyType #define XkbCopyKeyTypes SrvXkbCopyKeyTypes #define XkbFreeClientMap SrvXkbFreeClientMap #define XkbFreeServerMap SrvXkbFreeServerMap #define XkbInitCanonicalKeyTypes SrvXkbInitCanonicalKeyTypes #define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols #define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey #define XkbUpdateMapFromCore SrvXkbUpdateMapFromCore #define XkbResizeKeyActions SrvXkbResizeKeyActions #define XkbResizeKeySyms SrvXkbResizeKeySyms #define XkbResizeKeyType SrvXkbResizeKeyType #define XkbAllocCompatMap SrvXkbAllocCompatMap #define XkbAllocControls SrvXkbAllocControls #define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps #define XkbAllocKeyboard SrvXkbAllocKeyboard #define XkbAllocNames SrvXkbAllocNames #define XkbFreeCompatMap SrvXkbFreeCompatMap #define XkbFreeControls SrvXkbFreeControls #define XkbFreeIndicatorMaps SrvXkbFreeIndicatorMaps #define XkbFreeKeyboard SrvXkbFreeKeyboard #define XkbFreeNames SrvXkbFreeNames #define XkbAddDeviceLedInfo SrvXkbAddDeviceLedInfo #define XkbAllocDeviceInfo SrvXkbAllocDeviceInfo #define XkbFreeDeviceInfo SrvXkbFreeDeviceInfo #define XkbResizeDeviceButtonActions SrvXkbResizeDeviceButtonActions #define XkbLatchModifiers SrvXkbLatchModifiers #define XkbLatchGroup SrvXkbLatchGroup #define XkbVirtualModsToReal SrvXkbVirtualModsToReal #define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange #define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges #define XkbUpdateActionVirtualMods SrvXkbUpdateActionVirtualMods #define XkbUpdateKeyTypeVirtualMods SrvXkbUpdateKeyTypeVirtualMods #endif #include #include #include "inputstr.h" #ifdef NXAGENT_SERVER extern char *_NXGetXkbBasePath(const char *path); extern char *_NXGetXkbCompPath(const char *path); #endif typedef struct _XkbInterest { DeviceIntPtr dev; ClientPtr client; XID resource; struct _XkbInterest * next; CARD16 extDevNotifyMask; CARD16 stateNotifyMask; CARD16 namesNotifyMask; CARD32 ctrlsNotifyMask; CARD8 compatNotifyMask; BOOL bellNotifyMask; BOOL actionMessageMask; CARD16 accessXNotifyMask; CARD32 iStateNotifyMask; CARD32 iMapNotifyMask; CARD16 altSymsNotifyMask; CARD32 autoCtrls; CARD32 autoCtrlValues; } XkbInterestRec,*XkbInterestPtr; typedef struct _XkbRadioGroup { CARD8 flags; CARD8 nMembers; CARD8 dfltDown; CARD8 currentDown; CARD8 members[XkbRGMaxMembers]; } XkbRadioGroupRec, *XkbRadioGroupPtr; typedef struct _XkbEventCause { CARD8 kc; CARD8 event; CARD8 mjr; CARD8 mnr; ClientPtr client; } XkbEventCauseRec,*XkbEventCausePtr; #define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\ (c)->mjr= (c)->mnr= 0; \ (c)->client= NULL; } #define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\ (c)->mjr= (j),(c)->mnr= (n);\ (c)->client= (cl); } #define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl) #define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl) #define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0) #define _OFF_TIMER 0 #define _KRG_WARN_TIMER 1 #define _KRG_TIMER 2 #define _SK_TIMEOUT_TIMER 3 #define _ALL_TIMEOUT_TIMER 4 #define _BEEP_NONE 0 #define _BEEP_FEATURE_ON 1 #define _BEEP_FEATURE_OFF 2 #define _BEEP_FEATURE_CHANGE 3 #define _BEEP_SLOW_WARN 4 #define _BEEP_SLOW_PRESS 5 #define _BEEP_SLOW_ACCEPT 6 #define _BEEP_SLOW_REJECT 7 #define _BEEP_SLOW_RELEASE 8 #define _BEEP_STICKY_LATCH 9 #define _BEEP_STICKY_LOCK 10 #define _BEEP_STICKY_UNLOCK 11 #define _BEEP_LED_ON 12 #define _BEEP_LED_OFF 13 #define _BEEP_LED_CHANGE 14 #define _BEEP_BOUNCE_REJECT 15 typedef struct _XkbSrvInfo { XkbStateRec prev_state; XkbStateRec state; XkbDescPtr desc; DeviceIntPtr device; KbdCtrlProcPtr kbdProc; XkbRadioGroupPtr radioGroups; CARD8 nRadioGroups; CARD8 clearMods; CARD8 setMods; INT16 groupChange; CARD16 dfltPtrDelta; double mouseKeysCurve; double mouseKeysCurveFactor; INT16 mouseKeysDX; INT16 mouseKeysDY; CARD8 mouseKeysFlags; Bool mouseKeysAccel; CARD8 mouseKeysCounter; CARD8 lockedPtrButtons; CARD8 shiftKeyCount; KeyCode mouseKey; KeyCode inactiveKey; KeyCode slowKey; KeyCode repeatKey; CARD8 krgTimerActive; CARD8 beepType; CARD8 beepCount; CARD32 flags; CARD32 lastPtrEventTime; CARD32 lastShiftEventTime; OsTimerPtr beepTimer; OsTimerPtr mouseKeyTimer; OsTimerPtr slowKeysTimer; OsTimerPtr bounceKeysTimer; OsTimerPtr repeatKeyTimer; OsTimerPtr krgTimer; } XkbSrvInfoRec, *XkbSrvInfoPtr; #define XkbSLI_IsDefault (1L<<0) #define XkbSLI_HasOwnState (1L<<1) typedef struct _XkbSrvLedInfo { CARD16 flags; CARD16 class; CARD16 id; union { KbdFeedbackPtr kf; LedFeedbackPtr lf; } fb; CARD32 physIndicators; CARD32 autoState; CARD32 explicitState; CARD32 effectiveState; CARD32 mapsPresent; CARD32 namesPresent; XkbIndicatorMapPtr maps; Atom * names; CARD32 usesBase; CARD32 usesLatched; CARD32 usesLocked; CARD32 usesEffective; CARD32 usesCompat; CARD32 usesControls; CARD32 usedComponents; } XkbSrvLedInfoRec, *XkbSrvLedInfoPtr; /* * Settings for xkbClientFlags field (used by DIX) * These flags _must_ not overlap with XkbPCF_* */ #define _XkbClientInitialized (1<<15) #define _XkbWantsDetectableAutoRepeat(c)\ ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask) /* * Settings for flags field */ #define _XkbStateNotifyInProgress (1<<0) typedef struct { ProcessInputProc processInputProc; ProcessInputProc realInputProc; DeviceUnwrapProc unwrapProc; } xkbDeviceInfoRec, *xkbDeviceInfoPtr; #define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ device->public.processInputProc = proc; \ oldprocs->processInputProc = \ oldprocs->realInputProc = device->public.realInputProc; \ device->public.realInputProc = proc; \ oldprocs->unwrapProc = device->unwrapProc; \ device->unwrapProc = unwrapproc; #define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ if (device->public.processInputProc == device->public.realInputProc)\ device->public.processInputProc = proc; \ oldprocs->processInputProc = \ oldprocs->realInputProc = device->public.realInputProc; \ device->public.realInputProc = proc; \ oldprocs->unwrapProc = device->unwrapProc; \ device->unwrapProc = unwrapproc; #define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs) \ device->public.processInputProc = oldprocs->processInputProc; \ device->public.realInputProc = oldprocs->realInputProc; \ device->unwrapProc = oldprocs->unwrapProc; #define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr) (dev)->devPrivates[xkbDevicePrivateIndex].ptr) /***====================================================================***/ /***====================================================================***/ #define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask) #define XkbAllFilteredEventsMask \ (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask) /***====================================================================***/ extern int XkbReqCode; extern int XkbEventBase; extern int XkbKeyboardErrorCode; extern int XkbDisableLockActions; extern char * XkbBaseDirectory; extern char * XkbBinDirectory; extern char * XkbInitialMap; extern int _XkbClientMajor; extern int _XkbClientMinor; extern unsigned int XkbXIUnsupported; extern char * XkbModelUsed,*XkbLayoutUsed,*XkbVariantUsed,*XkbOptionsUsed; extern Bool noXkbExtension; extern Bool XkbWantRulesProp; extern void * XkbLastRepeatEvent; extern CARD32 xkbDebugFlags; extern CARD32 xkbDebugCtrls; #ifndef XKB_IN_SERVER #define _XkbAlloc(s) Xalloc((s)) #define _XkbCalloc(n,s) Xcalloc((n)*(s)) #define _XkbRealloc(o,s) Xrealloc((o),(s)) #define _XkbTypedAlloc(t) ((t *)Xalloc(sizeof(t))) #define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n)*sizeof(t))) #define _XkbTypedRealloc(o,n,t) \ ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) #define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) #define _XkbFree(p) Xfree(p) #else #define _XkbAlloc(s) malloc((s)) #define _XkbCalloc(n,s) calloc((n), (s)) #define _XkbRealloc(o,s) realloc((o),(s)) #define _XkbTypedAlloc(t) ((t *)malloc(sizeof(t))) #define _XkbTypedCalloc(n,t) ((t *)calloc((n), sizeof(t))) #define _XkbTypedRealloc(o,n,t) \ ((o)?(t *)realloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) #define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) #define _XkbFree(p) free(p) #endif /* !XKB_IN_SERVER */ #define _XkbLibError(c,l,d) \ { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } #define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) #define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) #define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) extern int DeviceKeyPress,DeviceKeyRelease; extern int DeviceButtonPress,DeviceButtonRelease; #ifdef XINPUT #define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress)) #define _XkbIsReleaseEvent(t) (((t)==KeyRelease)||((t)==DeviceKeyRelease)) #else #define _XkbIsPressEvent(t) ((t)==KeyPress) #define _XkbIsReleaseEvent(t) ((t)==KeyRelease) #endif #define _XkbCoreKeycodeInRange(c,k) (((k)>=(c)->curKeySyms.minKeyCode)&&\ ((k)<=(c)->curKeySyms.maxKeyCode)) #define _XkbCoreNumKeys(c) ((c)->curKeySyms.maxKeyCode-\ (c)->curKeySyms.minKeyCode+1) #define XConvertCase(s,l,u) XkbConvertCase(s,l,u) #undef IsKeypadKey #define IsKeypadKey(s) XkbKSIsKeypad(s) #define Status int #define XPointer void * #define Display struct _XDisplay #ifndef True #define True 1 #define False 0 #endif #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN #else #define PATH_MAX 1024 #endif #endif _XFUNCPROTOBEGIN extern void XkbUseMsg( void ); extern int XkbProcessArguments( int /* argc */, char ** /* argv */, int /* i */ ); extern void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc); extern void XkbFreeCompatMap( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ ); extern void XkbFreeNames( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ ); extern DeviceIntPtr _XkbLookupAnyDevice( int /* id */, int * /* why_rtrn */ ); extern DeviceIntPtr _XkbLookupKeyboard( int /* id */, int * /* why_rtrn */ ); extern DeviceIntPtr _XkbLookupBellDevice( int /* id */, int * /* why_rtrn */ ); extern DeviceIntPtr _XkbLookupLedDevice( int /* id */, int * /* why_rtrn */ ); extern DeviceIntPtr _XkbLookupButtonDevice( int /* id */, int * /* why_rtrn */ ); extern XkbDescPtr XkbAllocKeyboard( void ); extern Status XkbAllocClientMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nTypes */ ); extern Status XkbAllocServerMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nNewActions */ ); extern void XkbFreeClientMap( XkbDescPtr /* xkb */, unsigned int /* what */, Bool /* freeMap */ ); extern void XkbFreeServerMap( XkbDescPtr /* xkb */, unsigned int /* what */, Bool /* freeMap */ ); extern Status XkbAllocIndicatorMaps( XkbDescPtr /* xkb */ ); extern Status XkbAllocCompatMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nInterpret */ ); extern Status XkbAllocNames( XkbDescPtr /* xkb */, unsigned int /* which */, int /* nTotalRG */, int /* nTotalAliases */ ); extern Status XkbAllocControls( XkbDescPtr /* xkb */, unsigned int /* which*/ ); extern Status XkbCopyKeyType( XkbKeyTypePtr /* from */, XkbKeyTypePtr /* into */ ); extern Status XkbCopyKeyTypes( XkbKeyTypePtr /* from */, XkbKeyTypePtr /* into */, int /* num_types */ ); extern Status XkbResizeKeyType( XkbDescPtr /* xkb */, int /* type_ndx */, int /* map_count */, Bool /* want_preserve */, int /* new_num_lvls */ ); extern void XkbFreeKeyboard( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeDesc */ ); extern void XkbSetActionKeyMods( XkbDescPtr /* xkb */, XkbAction * /* act */, unsigned int /* mods */ ); extern Bool XkbCheckActionVMods( XkbDescPtr /* xkb */, XkbAction * /* act */, unsigned int /* changed */ ); extern Bool XkbApplyVModChanges( XkbSrvInfoPtr /* xkbi */, unsigned int /* changed */, XkbChangesPtr /* pChanges */, unsigned int * /* needChecksRtrn */, XkbEventCausePtr /* cause */ ); extern void XkbApplyVModChangesToAllDevices( DeviceIntPtr /* dev */, XkbDescPtr /* xkb */, unsigned int /* changed */, XkbEventCausePtr /* cause */ ); extern unsigned int XkbMaskForVMask( XkbDescPtr /* xkb */, unsigned int /* vmask */ ); extern Bool XkbVirtualModsToReal( XkbDescPtr /* xkb */, unsigned int /* virtua_mask */, unsigned int * /* mask_rtrn */ ); extern unsigned int XkbAdjustGroup( int /* group */, XkbControlsPtr /* ctrls */ ); extern KeySym *XkbResizeKeySyms( XkbDescPtr /* xkb */, int /* key */, int /* needed */ ); extern XkbAction *XkbResizeKeyActions( XkbDescPtr /* xkb */, int /* key */, int /* needed */ ); extern void XkbUpdateKeyTypesFromCore( DeviceIntPtr /* pXDev */, KeyCode /* first */, CARD8 /* num */, XkbChangesPtr /* pChanges */ ); extern void XkbUpdateDescActions( XkbDescPtr /* xkb */, KeyCode /* first */, CARD8 /* num */, XkbChangesPtr /* changes */ ); extern void XkbUpdateActions( DeviceIntPtr /* pXDev */, KeyCode /* first */, CARD8 /* num */, XkbChangesPtr /* pChanges */, unsigned int * /* needChecksRtrn */, XkbEventCausePtr /* cause */ ); extern void XkbUpdateCoreDescription( DeviceIntPtr /* keybd */, Bool /* resize */ ); extern void XkbApplyMappingChange( DeviceIntPtr /* pXDev */, CARD8 /* request */, KeyCode /* firstKey */, CARD8 /* num */, ClientPtr /* client */ ); extern void XkbSetIndicators( DeviceIntPtr /* pXDev */, CARD32 /* affect */, CARD32 /* values */, XkbEventCausePtr /* cause */ ); extern void XkbUpdateIndicators( DeviceIntPtr /* keybd */, CARD32 /* changed */, Bool /* check_edevs */, XkbChangesPtr /* pChanges */, XkbEventCausePtr /* cause */ ); extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo( DeviceIntPtr /* dev */, KbdFeedbackPtr /* kf */, LedFeedbackPtr /* lf */, unsigned int /* needed_parts */ ); extern XkbSrvLedInfoPtr XkbFindSrvLedInfo( DeviceIntPtr /* dev */, unsigned int /* class */, unsigned int /* id */, unsigned int /* needed_parts */ ); extern void XkbApplyLedNameChanges( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* changed_names */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbApplyLedMapChanges( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* changed_maps */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbApplyLedStateChanges( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* changed_leds */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbUpdateLedAutoState( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* maps_to_check */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbFlushLedEvents( DeviceIntPtr /* dev */, DeviceIntPtr /* kbd */, XkbSrvLedInfoPtr /* sli */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbUpdateAllDeviceIndicators( XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern unsigned int XkbIndicatorsToUpdate( DeviceIntPtr /* dev */, unsigned long /* state_changes */, Bool /* enabled_ctrl_changes */ ); extern void XkbComputeDerivedState( XkbSrvInfoPtr /* xkbi */ ); extern void XkbCheckSecondaryEffects( XkbSrvInfoPtr /* xkbi */, unsigned int /* which */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbCheckIndicatorMaps( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* which */ ); extern unsigned int XkbStateChangedFlags( XkbStatePtr /* old */, XkbStatePtr /* new */ ); extern void XkbSendStateNotify( DeviceIntPtr /* kbd */, xkbStateNotify * /* pSN */ ); extern void XkbSendMapNotify( DeviceIntPtr /* kbd */, xkbMapNotify * /* ev */ ); extern int XkbComputeControlsNotify( DeviceIntPtr /* kbd */, XkbControlsPtr /* old */, XkbControlsPtr /* new */, xkbControlsNotify * /* pCN */, Bool /* forceCtrlProc */ ); extern void XkbSendControlsNotify( DeviceIntPtr /* kbd */, xkbControlsNotify * /* ev */ ); extern void XkbSendCompatMapNotify( DeviceIntPtr /* kbd */, xkbCompatMapNotify * /* ev */ ); extern void XkbSendIndicatorNotify( DeviceIntPtr /* kbd */, int /* xkbType */, xkbIndicatorNotify * /* ev */ ); extern void XkbHandleBell( BOOL /* force */, BOOL /* eventOnly */, DeviceIntPtr /* kbd */, CARD8 /* percent */, void * /* ctrl */, CARD8 /* class */, Atom /* name */, WindowPtr /* pWin */, ClientPtr /* pClient */ ); extern void XkbSendAccessXNotify( DeviceIntPtr /* kbd */, xkbAccessXNotify * /* pEv */ ); extern void XkbSendNamesNotify( DeviceIntPtr /* kbd */, xkbNamesNotify * /* ev */ ); extern void XkbSendCompatNotify( DeviceIntPtr /* kbd */, xkbCompatMapNotify * /* ev */ ); extern void XkbSendActionMessage( DeviceIntPtr /* kbd */, xkbActionMessage * /* ev */ ); extern void XkbSendExtensionDeviceNotify( DeviceIntPtr /* kbd */, ClientPtr /* client */, xkbExtensionDeviceNotify * /* ev */ ); extern void XkbSendNotification( DeviceIntPtr /* kbd */, XkbChangesPtr /* pChanges */, XkbEventCausePtr /* cause */ ); extern void XkbProcessKeyboardEvent( struct _xEvent * /* xE */, DeviceIntPtr /* keybd */, int /* count */ ); extern void XkbProcessOtherEvent( struct _xEvent * /* xE */, DeviceIntPtr /* keybd */, int /* count */ ); extern void XkbHandleActions( DeviceIntPtr /* dev */, DeviceIntPtr /* kbd */, struct _xEvent * /* xE */, int /* count */ ); extern Bool XkbEnableDisableControls( XkbSrvInfoPtr /* xkbi */, unsigned long /* change */, unsigned long /* newValues */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void AccessXInit( DeviceIntPtr /* dev */ ); extern Bool AccessXFilterPressEvent( register struct _xEvent * /* xE */, register DeviceIntPtr /* keybd */, int /* count */ ); extern Bool AccessXFilterReleaseEvent( register struct _xEvent * /* xE */, register DeviceIntPtr /* keybd */, int /* count */ ); extern void AccessXCancelRepeatKey( XkbSrvInfoPtr /* xkbi */, KeyCode /* key */ ); extern void AccessXComputeCurveFactor( XkbSrvInfoPtr /* xkbi */, XkbControlsPtr /* ctrls */ ); extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo( XkbDeviceInfoPtr /* devi */, unsigned int /* ledClass */, unsigned int /* ledId */ ); extern XkbDeviceInfoPtr XkbAllocDeviceInfo( unsigned int /* deviceSpec */, unsigned int /* nButtons */, unsigned int /* szLeds */ ); extern void XkbFreeDeviceInfo( XkbDeviceInfoPtr /* devi */, unsigned int /* which */, Bool /* freeDevI */ ); extern Status XkbResizeDeviceButtonActions( XkbDeviceInfoPtr /* devi */, unsigned int /* newTotal */ ); extern XkbInterestPtr XkbFindClientResource( DevicePtr /* inDev */, ClientPtr /* client */ ); extern XkbInterestPtr XkbAddClientResource( DevicePtr /* inDev */, ClientPtr /* client */, XID /* id */ ); extern int XkbRemoveClient( DevicePtr /* inDev */, ClientPtr /* client */ ); extern int XkbRemoveResourceClient( DevicePtr /* inDev */, XID /* id */ ); extern int XkbDDXInitDevice( DeviceIntPtr /* dev */ ); extern int XkbDDXAccessXBeep( DeviceIntPtr /* dev */, unsigned int /* what */, unsigned int /* which */ ); extern void XkbDDXKeyClick( DeviceIntPtr /* dev */, int /* keycode */, int /* synthetic */ ); extern int XkbDDXUsesSoftRepeat( DeviceIntPtr /* dev */ ); extern void XkbDDXKeybdCtrlProc( DeviceIntPtr /* dev */, KeybdCtrl * /* ctrl */ ); extern void XkbDDXChangeControls( DeviceIntPtr /* dev */, XkbControlsPtr /* old */, XkbControlsPtr /* new */ ); extern void XkbDDXUpdateIndicators( DeviceIntPtr /* keybd */, CARD32 /* newState */ ); extern void XkbDDXUpdateDeviceIndicators( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, CARD32 /* newState */ ); extern void XkbDDXFakePointerButton( int /* event */, int /* button */ ); extern void XkbDDXFakePointerMotion( unsigned int /* flags */, int /* x */, int /* y */ ); extern void XkbDDXFakeDeviceButton( DeviceIntPtr /* dev */, Bool /* press */, int /* button */ ); extern int XkbDDXTerminateServer( DeviceIntPtr /* dev */, KeyCode /* key */, XkbAction * /* act */ ); extern int XkbDDXSwitchScreen( DeviceIntPtr /* dev */, KeyCode /* key */, XkbAction * /* act */ ); extern int XkbDDXPrivate( DeviceIntPtr /* dev */, KeyCode /* key */, XkbAction * /* act */ ); extern void XkbDisableComputedAutoRepeats( DeviceIntPtr /* pXDev */, unsigned int /* key */ ); extern void XkbSetRepeatKeys( DeviceIntPtr /* pXDev */, int /* key */, int /* onoff */ ); extern int XkbLatchModifiers( DeviceIntPtr /* pXDev */, CARD8 /* mask */, CARD8 /* latches */ ); extern int XkbLatchGroup( DeviceIntPtr /* pXDev */, int /* group */ ); extern void XkbClearAllLatchesAndLocks( DeviceIntPtr /* dev */, XkbSrvInfoPtr /* xkbi */, Bool /* genEv */, XkbEventCausePtr /* cause */ ); extern void XkbSetRulesDflts( char * /* rulesFile */, char * /* model */, char * /* layout */, char * /* variant */, char * /* options */ ); extern void XkbInitDevice( DeviceIntPtr /* pXDev */ ); extern Bool XkbInitKeyboardDeviceStruct( DeviceIntPtr /* pXDev */, XkbComponentNamesPtr /* pNames */, KeySymsPtr /* pSyms */, CARD8 /* pMods */[], BellProcPtr /* bellProc */, KbdCtrlProcPtr /* ctrlProc */ ); extern int SProcXkbDispatch( ClientPtr /* client */ ); extern XkbGeometryPtr XkbLookupNamedGeometry( DeviceIntPtr /* dev */, Atom /* name */, Bool * /* shouldFree */ ); extern char * _XkbDupString( char * /* str */ ); extern void XkbConvertCase( KeySym /* sym */, KeySym * /* lower */, KeySym * /* upper */ ); extern Status XkbChangeKeycodeRange( XkbDescPtr /* xkb */, int /* minKC */, int /* maxKC */, XkbChangesPtr /* changes */ ); extern int XkbFinishDeviceInit( DeviceIntPtr /* pXDev */ ); extern void XkbFreeSrvLedInfo( XkbSrvLedInfoPtr /* sli */ ); extern void XkbFreeInfo( XkbSrvInfoPtr /* xkbi */ ); extern Status XkbChangeTypesOfKey( XkbDescPtr /* xkb */, int /* key */, int /* nGroups */, unsigned int /* groups */, int * /* newTypesIn */, XkbMapChangesPtr /* changes */ ); extern XkbKeyTypePtr XkbAddKeyType( XkbDescPtr /* xkb */, Atom /* name */, int /* map_count */, Bool /* want_preserve */, int /* num_lvls */ ); extern Status XkbInitCanonicalKeyTypes( XkbDescPtr /* xkb */, unsigned int /* which */, int /* keypadVMod */ ); extern int XkbKeyTypesForCoreSymbols( XkbDescPtr /* xkb */, int /* map_width */, KeySym * /* core_syms */, unsigned int /* protected */, int * /* types_inout */, KeySym * /* xkb_syms_rtrn */ ); extern Bool XkbApplyCompatMapToKey( XkbDescPtr /* xkb */, KeyCode /* key */, XkbChangesPtr /* changes */ ); extern Bool XkbUpdateMapFromCore( XkbDescPtr /* xkb */, KeyCode /* first_key */, int /* num_keys */, int /* map_width */, KeySym * /* core_keysyms */, XkbChangesPtr /* changes */ ); extern void XkbFreeControls( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ ); extern void XkbFreeIndicatorMaps( XkbDescPtr /* xkb */ ); extern Bool XkbApplyVirtualModChanges( XkbDescPtr /* xkb */, unsigned int /* changed */, XkbChangesPtr /* changes */ ); extern Bool XkbUpdateActionVirtualMods( XkbDescPtr /* xkb */, XkbAction * /* act */, unsigned int /* changed */ ); extern void XkbUpdateKeyTypeVirtualMods( XkbDescPtr /* xkb */, XkbKeyTypePtr /* type */, unsigned int /* changed */, XkbChangesPtr /* changes */ ); extern void XkbSendNewKeyboardNotify( DeviceIntPtr /* kbd */, xkbNewKeyboardNotify * /* pNKN */ ); #ifdef XKBSRV_NEED_FILE_FUNCS #include #include #include #define _XkbListKeymaps 0 #define _XkbListKeycodes 1 #define _XkbListTypes 2 #define _XkbListCompat 3 #define _XkbListSymbols 4 #define _XkbListGeometry 5 #define _XkbListNumComponents 6 typedef struct _XkbSrvListInfo { int szPool; int nPool; char * pool; int maxRtrn; int nTotal; char * pattern[_XkbListNumComponents]; int nFound[_XkbListNumComponents]; } XkbSrvListInfoRec,*XkbSrvListInfoPtr; char * XkbGetRulesDflts( XkbRF_VarDefsPtr /* defs */ ); extern void XkbSetRulesUsed( XkbRF_VarDefsPtr /* defs */ ); extern Status XkbDDXList( DeviceIntPtr /* dev */, XkbSrvListInfoPtr /* listing */, ClientPtr /* client */ ); extern unsigned int XkbDDXLoadKeymapByNames( DeviceIntPtr /* keybd */, XkbComponentNamesPtr /* names */, unsigned int /* want */, unsigned int /* need */, XkbFileInfoPtr /* finfoRtrn */, char * /* keymapNameRtrn */, int /* keymapNameRtrnLen */ ); extern Bool XkbDDXNamesFromRules( DeviceIntPtr /* keybd */, char * /* rules */, XkbRF_VarDefsPtr /* defs */, XkbComponentNamesPtr /* names */ ); extern FILE *XkbDDXOpenConfigFile( char * /* mapName */, char * /* fileNameRtrn */, int /* fileNameRtrnLen */ ); extern Bool XkbDDXApplyConfig( XPointer /* cfg_in */, XkbSrvInfoPtr /* xkbi */ ); extern XPointer XkbDDXPreloadConfig( char ** /* rulesFileRtrn */, XkbRF_VarDefsPtr /* defs */, XkbComponentNamesPtr /* names */, DeviceIntPtr /* dev */ ); extern int _XkbStrCaseCmp( char * /* str1 */, char * /* str2 */ ); #endif /* XKBSRV_NEED_FILE_FUNCS */ _XFUNCPROTOEND #define XkbAtomGetString(d,s) NameForAtom(s) #endif /* _XKBSRV_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/XKBstr.h0000644000000000000000000004320313614532331016455 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBSTR_H_ #define _XKBSTR_H_ #include #define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f)) #define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff))) #define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l))) /* * Common data structures and access macros */ typedef struct _XkbStateRec { unsigned char group; unsigned char locked_group; unsigned short base_group; unsigned short latched_group; unsigned char mods; unsigned char base_mods; unsigned char latched_mods; unsigned char locked_mods; unsigned char compat_state; unsigned char grab_mods; unsigned char compat_grab_mods; unsigned char lookup_mods; unsigned char compat_lookup_mods; unsigned short ptr_buttons; } XkbStateRec,*XkbStatePtr; #define XkbModLocks(s) ((s)->locked_mods) #define XkbStateMods(s) ((s)->base_mods|(s)->latched_mods|XkbModLocks(s)) #define XkbGroupLock(s) ((s)->locked_group) #define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s)) #define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group) #define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group) typedef struct _XkbMods { unsigned char mask; /* effective mods */ unsigned char real_mods; unsigned short vmods; } XkbModsRec,*XkbModsPtr; typedef struct _XkbKTMapEntry { Bool active; unsigned char level; XkbModsRec mods; } XkbKTMapEntryRec,*XkbKTMapEntryPtr; typedef struct _XkbKeyType { XkbModsRec mods; unsigned char num_levels; unsigned char map_count; XkbKTMapEntryPtr map; XkbModsPtr preserve; Atom name; Atom * level_names; } XkbKeyTypeRec, *XkbKeyTypePtr; #define XkbNumGroups(g) ((g)&0x0f) #define XkbOutOfRangeGroupInfo(g) ((g)&0xf0) #define XkbOutOfRangeGroupAction(g) ((g)&0xc0) #define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4) #define XkbSetGroupInfo(g,w,n) (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f)) #define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f)) /* * Structures and access macros used primarily by the server */ typedef struct _XkbBehavior { unsigned char type; unsigned char data; } XkbBehavior; #define XkbAnyActionDataSize 7 typedef struct _XkbAnyAction { unsigned char type; unsigned char data[XkbAnyActionDataSize]; } XkbAnyAction; typedef struct _XkbModAction { unsigned char type; unsigned char flags; unsigned char mask; unsigned char real_mods; unsigned char vmods1; unsigned char vmods2; } XkbModAction; #define XkbModActionVMods(a) \ ((short)(((a)->vmods1<<8)|((a)->vmods2))) #define XkbSetModActionVMods(a,v) \ (((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff)) typedef struct _XkbGroupAction { unsigned char type; unsigned char flags; char group_XXX; } XkbGroupAction; #define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX)) #define XkbSASetGroup(a,g) ((a)->group_XXX=(g)) typedef struct _XkbISOAction { unsigned char type; unsigned char flags; unsigned char mask; unsigned char real_mods; char group_XXX; unsigned char affect; unsigned char vmods1; unsigned char vmods2; } XkbISOAction; typedef struct _XkbPtrAction { unsigned char type; unsigned char flags; unsigned char high_XXX; unsigned char low_XXX; unsigned char high_YYY; unsigned char low_YYY; } XkbPtrAction; #define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX)) #define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY)) #define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX)) #define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY)) typedef struct _XkbPtrBtnAction { unsigned char type; unsigned char flags; unsigned char count; unsigned char button; } XkbPtrBtnAction; typedef struct _XkbPtrDfltAction { unsigned char type; unsigned char flags; unsigned char affect; char valueXXX; } XkbPtrDfltAction; #define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX)) #define XkbSASetPtrDfltValue(a,c) ((a)->valueXXX= ((c)&0xff)) typedef struct _XkbSwitchScreenAction { unsigned char type; unsigned char flags; char screenXXX; } XkbSwitchScreenAction; #define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX)) #define XkbSASetScreen(a,s) ((a)->screenXXX= ((s)&0xff)) typedef struct _XkbCtrlsAction { unsigned char type; unsigned char flags; unsigned char ctrls3; unsigned char ctrls2; unsigned char ctrls1; unsigned char ctrls0; } XkbCtrlsAction; #define XkbActionSetCtrls(a,c) (((a)->ctrls3=(((c)>>24)&0xff)),\ ((a)->ctrls2=(((c)>>16)&0xff)),\ ((a)->ctrls1=(((c)>>8)&0xff)),\ ((a)->ctrls0=((c)&0xff))) #define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\ (((unsigned int)(a)->ctrls2)<<16)|\ (((unsigned int)(a)->ctrls1)<<8)|\ ((unsigned int)((a)->ctrls0))) typedef struct _XkbMessageAction { unsigned char type; unsigned char flags; unsigned char message[6]; } XkbMessageAction; typedef struct _XkbRedirectKeyAction { unsigned char type; unsigned char new_key; unsigned char mods_mask; unsigned char mods; unsigned char vmods_mask0; unsigned char vmods_mask1; unsigned char vmods0; unsigned char vmods1; } XkbRedirectKeyAction; #define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\ ((unsigned int)(a)->vmods0)) #define XkbSARedirectSetVMods(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ ((a)->vmods_mask0=((m)&0xff))) #define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|\ ((unsigned int)(a)->vmods_mask0)) #define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ ((a)->vmods_mask0=((m)&0xff))) typedef struct _XkbDeviceBtnAction { unsigned char type; unsigned char flags; unsigned char count; unsigned char button; unsigned char device; } XkbDeviceBtnAction; typedef struct _XkbDeviceValuatorAction { unsigned char type; unsigned char device; unsigned char v1_what; unsigned char v1_ndx; unsigned char v1_value; unsigned char v2_what; unsigned char v2_ndx; unsigned char v2_value; } XkbDeviceValuatorAction; typedef union _XkbAction { XkbAnyAction any; XkbModAction mods; XkbGroupAction group; XkbISOAction iso; XkbPtrAction ptr; XkbPtrBtnAction btn; XkbPtrDfltAction dflt; XkbSwitchScreenAction screen; XkbCtrlsAction ctrls; XkbMessageAction msg; XkbRedirectKeyAction redirect; XkbDeviceBtnAction devbtn; XkbDeviceValuatorAction devval; unsigned char type; } XkbAction; typedef struct _XkbControls { unsigned char mk_dflt_btn; unsigned char num_groups; unsigned char groups_wrap; XkbModsRec internal; XkbModsRec ignore_lock; unsigned int enabled_ctrls; unsigned short repeat_delay; unsigned short repeat_interval; unsigned short slow_keys_delay; unsigned short debounce_delay; unsigned short mk_delay; unsigned short mk_interval; unsigned short mk_time_to_max; unsigned short mk_max_speed; short mk_curve; unsigned short ax_options; unsigned short ax_timeout; unsigned short axt_opts_mask; unsigned short axt_opts_values; unsigned int axt_ctrls_mask; unsigned int axt_ctrls_values; unsigned char per_key_repeat[XkbPerKeyBitArraySize]; } XkbControlsRec, *XkbControlsPtr; #define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask) #define XkbAX_NeedOption(c,w) ((c)->ax_options&(w)) #define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w)) typedef struct _XkbServerMapRec { unsigned short num_acts; unsigned short size_acts; XkbAction *acts; XkbBehavior *behaviors; unsigned short *key_acts; #if defined(__cplusplus) || defined(c_plusplus) /* explicit is a C++ reserved word */ unsigned char *c_explicit; #else unsigned char *explicit; #endif unsigned char vmods[XkbNumVirtualMods]; unsigned short *vmodmap; } XkbServerMapRec, *XkbServerMapPtr; #define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]]) /* * Structures and access macros used primarily by clients */ typedef struct _XkbSymMapRec { unsigned char kt_index[XkbNumKbdGroups]; unsigned char group_info; unsigned char width; unsigned short offset; } XkbSymMapRec, *XkbSymMapPtr; typedef struct _XkbClientMapRec { unsigned char size_types; unsigned char num_types; XkbKeyTypePtr types; unsigned short size_syms; unsigned short num_syms; KeySym *syms; XkbSymMapPtr key_sym_map; unsigned char *modmap; } XkbClientMapRec, *XkbClientMapPtr; #define XkbCMKeyGroupInfo(m,k) ((m)->key_sym_map[k].group_info) #define XkbCMKeyNumGroups(m,k) (XkbNumGroups((m)->key_sym_map[k].group_info)) #define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels) #define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width) #define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3]) #define XkbCMKeyType(m,k,g) (&(m)->types[XkbCMKeyTypeIndex(m,k,g)]) #define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k)) #define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset) #define XkbCMKeySymsPtr(m,k) (&(m)->syms[XkbCMKeySymsOffset(m,k)]) /* * Compatibility structures and access macros */ typedef struct _XkbSymInterpretRec { KeySym sym; unsigned char flags; unsigned char match; unsigned char mods; unsigned char virtual_mod; XkbAnyAction act; } XkbSymInterpretRec,*XkbSymInterpretPtr; typedef struct _XkbCompatMapRec { XkbSymInterpretPtr sym_interpret; XkbModsRec groups[XkbNumKbdGroups]; unsigned short num_si; unsigned short size_si; } XkbCompatMapRec, *XkbCompatMapPtr; typedef struct _XkbIndicatorMapRec { unsigned char flags; unsigned char which_groups; unsigned char groups; unsigned char which_mods; XkbModsRec mods; unsigned int ctrls; } XkbIndicatorMapRec, *XkbIndicatorMapPtr; #define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&\ (((i)->which_groups&&(i)->groups)||\ ((i)->which_mods&&(i)->mods.mask)||\ ((i)->ctrls))) #define XkbIM_InUse(i) (((i)->flags)||((i)->which_groups)||\ ((i)->which_mods)||((i)->ctrls)) typedef struct _XkbIndicatorRec { unsigned long phys_indicators; XkbIndicatorMapRec maps[XkbNumIndicators]; } XkbIndicatorRec,*XkbIndicatorPtr; typedef struct _XkbKeyNameRec { char name[XkbKeyNameLength]; } XkbKeyNameRec,*XkbKeyNamePtr; typedef struct _XkbKeyAliasRec { char real[XkbKeyNameLength]; char alias[XkbKeyNameLength]; } XkbKeyAliasRec,*XkbKeyAliasPtr; /* * Names for everything */ typedef struct _XkbNamesRec { Atom keycodes; Atom geometry; Atom symbols; Atom types; Atom compat; Atom vmods[XkbNumVirtualMods]; Atom indicators[XkbNumIndicators]; Atom groups[XkbNumKbdGroups]; XkbKeyNamePtr keys; XkbKeyAliasPtr key_aliases; Atom *radio_groups; Atom phys_symbols; unsigned char num_keys; unsigned char num_key_aliases; unsigned short num_rg; } XkbNamesRec,*XkbNamesPtr; typedef struct _XkbGeometry *XkbGeometryPtr; /* * Tie it all together into one big keyboard description */ typedef struct _XkbDesc { struct _XDisplay * dpy; unsigned short flags; unsigned short device_spec; KeyCode min_key_code; KeyCode max_key_code; XkbControlsPtr ctrls; XkbServerMapPtr server; XkbClientMapPtr map; XkbIndicatorPtr indicators; XkbNamesPtr names; XkbCompatMapPtr compat; XkbGeometryPtr geom; } XkbDescRec, *XkbDescPtr; #define XkbKeyKeyTypeIndex(d,k,g) (XkbCMKeyTypeIndex((d)->map,k,g)) #define XkbKeyKeyType(d,k,g) (XkbCMKeyType((d)->map,k,g)) #define XkbKeyGroupWidth(d,k,g) (XkbCMKeyGroupWidth((d)->map,k,g)) #define XkbKeyGroupsWidth(d,k) (XkbCMKeyGroupsWidth((d)->map,k)) #define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k))) #define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k))) #define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k))) #define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k))) #define XkbKeySym(d,k,n) (XkbKeySymsPtr(d,k)[n]) #define XkbKeySymEntry(d,k,sl,g) \ (XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl)))) #define XkbKeyAction(d,k,n) \ (XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL) #define XkbKeyActionEntry(d,k,sl,g) \ (XkbKeyHasActions(d,k)?\ XkbKeyAction(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))):NULL) #define XkbKeyHasActions(d,k) ((d)->server->key_acts[k]!=0) #define XkbKeyNumActions(d,k) (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1) #define XkbKeyActionsPtr(d,k) (XkbSMKeyActionsPtr((d)->server,k)) #define XkbKeycodeInRange(d,k) (((k)>=(d)->min_key_code)&&\ ((k)<=(d)->max_key_code)) #define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1) /* * The following structures can be used to track changes * to a keyboard device */ typedef struct _XkbMapChanges { unsigned short changed; KeyCode min_key_code; KeyCode max_key_code; unsigned char first_type; unsigned char num_types; KeyCode first_key_sym; unsigned char num_key_syms; KeyCode first_key_act; unsigned char num_key_acts; KeyCode first_key_behavior; unsigned char num_key_behaviors; KeyCode first_key_explicit; unsigned char num_key_explicit; KeyCode first_modmap_key; unsigned char num_modmap_keys; KeyCode first_vmodmap_key; unsigned char num_vmodmap_keys; unsigned char pad; unsigned short vmods; } XkbMapChangesRec,*XkbMapChangesPtr; typedef struct _XkbControlsChanges { unsigned int changed_ctrls; unsigned int enabled_ctrls_changes; Bool num_groups_changed; } XkbControlsChangesRec,*XkbControlsChangesPtr; typedef struct _XkbIndicatorChanges { unsigned int state_changes; unsigned int map_changes; } XkbIndicatorChangesRec,*XkbIndicatorChangesPtr; typedef struct _XkbNameChanges { unsigned int changed; unsigned char first_type; unsigned char num_types; unsigned char first_lvl; unsigned char num_lvls; unsigned char num_aliases; unsigned char num_rg; unsigned char first_key; unsigned char num_keys; unsigned short changed_vmods; unsigned long changed_indicators; unsigned char changed_groups; } XkbNameChangesRec,*XkbNameChangesPtr; typedef struct _XkbCompatChanges { unsigned char changed_groups; unsigned short first_si; unsigned short num_si; } XkbCompatChangesRec,*XkbCompatChangesPtr; typedef struct _XkbChanges { unsigned short device_spec; unsigned short state_changes; XkbMapChangesRec map; XkbControlsChangesRec ctrls; XkbIndicatorChangesRec indicators; XkbNameChangesRec names; XkbCompatChangesRec compat; } XkbChangesRec, *XkbChangesPtr; /* * These data structures are used to construct a keymap from * a set of components or to list components in the server * database. */ typedef struct _XkbComponentNames { char * keymap; char * keycodes; char * types; char * compat; char * symbols; char * geometry; } XkbComponentNamesRec, *XkbComponentNamesPtr; typedef struct _XkbComponentName { unsigned short flags; char * name; } XkbComponentNameRec,*XkbComponentNamePtr; typedef struct _XkbComponentList { int num_keymaps; int num_keycodes; int num_types; int num_compat; int num_symbols; int num_geometry; XkbComponentNamePtr keymaps; XkbComponentNamePtr keycodes; XkbComponentNamePtr types; XkbComponentNamePtr compat; XkbComponentNamePtr symbols; XkbComponentNamePtr geometry; } XkbComponentListRec, *XkbComponentListPtr; /* * The following data structures describe and track changes to a * non-keyboard extension device */ typedef struct _XkbDeviceLedInfo { unsigned short led_class; unsigned short led_id; unsigned int phys_indicators; unsigned int maps_present; unsigned int names_present; unsigned int state; Atom names[XkbNumIndicators]; XkbIndicatorMapRec maps[XkbNumIndicators]; } XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr; typedef struct _XkbDeviceInfo { char * name; Atom type; unsigned short device_spec; Bool has_own_state; unsigned short supported; unsigned short unsupported; unsigned short num_btns; XkbAction * btn_acts; unsigned short sz_leds; unsigned short num_leds; unsigned short dflt_kbd_fb; unsigned short dflt_led_fb; XkbDeviceLedInfoPtr leds; } XkbDeviceInfoRec,*XkbDeviceInfoPtr; #define XkbXI_DevHasBtnActs(d) (((d)->num_btns>0)&&((d)->btn_acts!=NULL)) #define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns)) #define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL)) typedef struct _XkbDeviceLedChanges { unsigned short led_class; unsigned short led_id; unsigned int defined; /* names or maps changed */ struct _XkbDeviceLedChanges *next; } XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr; typedef struct _XkbDeviceChanges { unsigned int changed; unsigned short first_btn; unsigned short num_btns; XkbDeviceLedChangesRec leds; } XkbDeviceChangesRec,*XkbDeviceChangesPtr; #endif /* _XKBSTR_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/XKMformat.h0000644000000000000000000001536413614532331017157 0ustar /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* $XFree86$ */ #ifndef _XKMFORMAT_H_ #define _XKMFORMAT_H_ 1 #include #include #include typedef struct _xkmFileInfo { CARD8 type; CARD8 min_kc; CARD8 max_kc; CARD8 num_toc; CARD16 present B16; CARD16 pad B16; } xkmFileInfo; #define sz_xkmFileInfo 8 typedef struct _xkmSectionInfo { CARD16 type B16; CARD16 format B16; CARD16 size B16; CARD16 offset B16; } xkmSectionInfo; #define sz_xkmSectionInfo 8 typedef struct _xkmKeyTypeDesc { CARD8 realMods; CARD8 numLevels; CARD16 virtualMods B16; CARD8 nMapEntries; CARD8 nLevelNames; CARD8 preserve; CARD8 pad; } xkmKeyTypeDesc; #define sz_xkmKeyTypeDesc 8 typedef struct _xkmKTMapEntryDesc { CARD8 level; CARD8 realMods; CARD16 virtualMods B16; } xkmKTMapEntryDesc; #define sz_xkmKTMapEntryDesc 4 typedef struct _xkmModsDesc { CARD8 realMods; CARD8 pad; CARD16 virtualMods B16; } xkmModsDesc; #define sz_xkmModsDesc 4 typedef struct _xkmVModMapDesc { CARD8 key; CARD8 pad; CARD16 vmods B16; } xkmVModMapDesc; #define sz_xkmVModMapDesc 4 typedef struct _xkmSymInterpretDesc { CARD32 sym B32; CARD8 mods; CARD8 match; CARD8 virtualMod; CARD8 flags; CARD8 actionType; CARD8 actionData[7]; } xkmSymInterpretDesc; #define sz_xkmSymInterpretDesc 16 typedef struct _xkmBehaviorDesc { CARD8 type; CARD8 data; CARD16 pad B16; } xkmBehaviorDesc; #define sz_xkmBehaviorDesc 4 typedef struct _xkmActionDesc { CARD8 type; CARD8 data[7]; } xkmActionDesc; #define sz_xkmActionDesc 8 #define XkmKeyHasTypes (0x0f) #define XkmKeyHasGroup1Type (1<<0) #define XkmKeyHasGroup2Type (1<<1) #define XkmKeyHasGroup3Type (1<<2) #define XkmKeyHasGroup4Type (1<<3) #define XkmKeyHasActions (1<<4) #define XkmKeyHasBehavior (1<<5) #define XkmRepeatingKey (1<<6) #define XkmNonRepeatingKey (1<<7) typedef struct _xkmKeySymMapDesc { CARD8 width; CARD8 num_groups; CARD8 modifier_map; CARD8 flags; } xkmKeySymMapDesc; #define sz_xkmKeySymMapDesc 4 typedef struct _xkmIndicatorMapDesc { CARD8 indicator; CARD8 flags; CARD8 which_mods; CARD8 real_mods; CARD16 vmods B16; CARD8 which_groups; CARD8 groups; CARD32 ctrls B32; } xkmIndicatorMapDesc; #define sz_xkmIndicatorMapDesc 12 typedef struct _xkmGeometryDesc { CARD16 width_mm B16; CARD16 height_mm B16; CARD8 base_color_ndx; CARD8 label_color_ndx; CARD16 num_properties B16; CARD16 num_colors B16; CARD16 num_shapes B16; CARD16 num_sections B16; CARD16 num_doodads B16; CARD16 num_key_aliases B16; CARD16 pad1 B16; } xkmGeometryDesc; #define sz_xkmGeometryDesc 20 typedef struct _xkmPointDesc { INT16 x B16; INT16 y B16; } xkmPointDesc; #define sz_xkmPointDesc 4 typedef struct _xkmOutlineDesc { CARD8 num_points; CARD8 corner_radius; CARD16 pad B16; } xkmOutlineDesc; #define sz_xkmOutlineDesc 4 typedef struct _xkmShapeDesc { CARD8 num_outlines; CARD8 primary_ndx; CARD8 approx_ndx; CARD8 pad; } xkmShapeDesc; #define sz_xkmShapeDesc 4 typedef struct _xkmSectionDesc { INT16 top B16; INT16 left B16; CARD16 width B16; CARD16 height B16; INT16 angle B16; CARD8 priority; CARD8 num_rows; CARD8 num_doodads; CARD8 num_overlays; CARD16 pad2 B16; } xkmSectionDesc; #define sz_xkmSectionDesc 16 typedef struct _xkmRowDesc { INT16 top B16; INT16 left B16; CARD8 num_keys; BOOL vertical; CARD16 pad B16; } xkmRowDesc; #define sz_xkmRowDesc 8 typedef struct _xkmKeyDesc { CARD8 name[XkbKeyNameLength]; INT16 gap B16; CARD8 shape_ndx; CARD8 color_ndx; } xkmKeyDesc; #define sz_xkmKeyDesc 8 typedef struct _xkmOverlayDesc { CARD8 num_rows; CARD8 pad1; CARD16 pad2 B16; } xkmOverlayDesc; #define sz_xkmOverlayDesc 4 typedef struct _xkmOverlayRowDesc { CARD8 row_under; CARD8 num_keys; CARD16 pad B16; } xkmOverlayRowDesc; #define sz_xkmOverlayRowDesc 4 typedef struct _xkmOverlayKeyDesc { char over[XkbKeyNameLength]; char under[XkbKeyNameLength]; } xkmOverlayKeyDesc; #define sz_xkmOverlayKeyDesc 8 typedef struct _xkmShapeDoodadDesc { CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD8 color_ndx; CARD8 shape_ndx; CARD16 pad B16; CARD32 pad1 B32; } xkmShapeDoodadDesc; #define sz_xkmShapeDoodadDesc 16 typedef struct _xkmTextDoodadDesc { CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD16 width B16; CARD16 height B16; CARD8 color_ndx; CARD8 pad1; CARD16 pad2 B16; } xkmTextDoodadDesc; #define sz_xkmTextDoodadDesc 16 typedef struct _xkmIndicatorDoodadDesc { CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; CARD8 shape_ndx; CARD8 on_color_ndx; CARD8 off_color_ndx; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; } xkmIndicatorDoodadDesc; #define sz_xkmIndicatorDoodadDesc 16 typedef struct _xkmLogoDoodadDesc { CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD8 color_ndx; CARD8 shape_ndx; CARD16 pad B16; CARD32 pad1 B32; } xkmLogoDoodadDesc; #define sz_xkmLogoDoodadDesc 16 typedef struct _xkmAnyDoodadDesc { CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; } xkmAnyDoodadDesc; #define sz_xkmAnyDoodadDesc 16 typedef union _xkmDoodadDesc { xkmAnyDoodadDesc any; xkmShapeDoodadDesc shape; xkmTextDoodadDesc text; xkmIndicatorDoodadDesc indicator; xkmLogoDoodadDesc logo; } xkmDoodadDesc; #define sz_xkmDoodadDesc 16 #endif /* _XKMFORMAT_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/XKM.h0000644000000000000000000000536013614532331015741 0ustar /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef XKM_H #define XKM_H 1 #define XkmFileVersion 15 #define XkmIllegalFile -1 #define XkmSemanticsFile 20 #define XkmLayoutFile 21 #define XkmKeymapFile 22 #define XkmGeometryFile 23 #define XkmTypesIndex 0 #define XkmCompatMapIndex 1 #define XkmSymbolsIndex 2 #define XkmIndicatorsIndex 3 #define XkmKeyNamesIndex 4 #define XkmGeometryIndex 5 #define XkmVirtualModsIndex 6 #define XkmLastIndex XkmVirtualModsIndex #define XkmTypesMask (1<<0) #define XkmCompatMapMask (1<<1) #define XkmSymbolsMask (1<<2) #define XkmIndicatorsMask (1<<3) #define XkmKeyNamesMask (1<<4) #define XkmGeometryMask (1<<5) #define XkmVirtualModsMask (1<<6) #define XkmLegalIndexMask (0x7f) #define XkmAllIndicesMask (0x7f) #define XkmSemanticsRequired (XkmCompatMapMask) #define XkmSemanticsOptional (XkmTypesMask|XkmVirtualModsMask|XkmIndicatorsMask) #define XkmSemanticsLegal (XkmSemanticsRequired|XkmSemanticsOptional) #define XkmLayoutRequired (XkmKeyNamesMask|XkmSymbolsMask|XkmTypesMask) #define XkmLayoutOptional (XkmVirtualModsMask|XkmGeometryMask) #define XkmLayoutLegal (XkmLayoutRequired|XkmLayoutOptional) #define XkmKeymapRequired (XkmSemanticsRequired|XkmLayoutRequired) #define XkmKeymapOptional ((XkmSemanticsOptional|XkmLayoutOptional)&(~XkmKeymapRequired)) #define XkmKeymapLegal (XkmKeymapRequired|XkmKeymapOptional) #define XkmLegalSection(m) (((m)&(~XkmKeymapLegal))==0) #define XkmSingleSection(m) (XkmLegalSection(m)&&(((m)&(~(m)+1))==(m))) #endif /* XKM_H */ nx-libs-3.5.99.23/nx-X11/include/extensions/XResproto.h0000644000000000000000000000541413614532331017247 0ustar /* Copyright (c) 2002 XFree86 Inc */ #ifndef _XRESPROTO_H #define _XRESPROTO_H #define XRES_MAJOR_VERSION 1 #define XRES_MINOR_VERSION 0 #define XRES_NAME "X-Resource" #define X_XResQueryVersion 0 #define X_XResQueryClients 1 #define X_XResQueryClientResources 2 #define X_XResQueryClientPixmapBytes 3 typedef struct { CARD32 resource_base; CARD32 resource_mask; } xXResClient; #define sz_xXResClient 8 typedef struct { CARD32 resource_type; CARD32 count; } xXResType; #define sz_xXResType 8 /* XResQueryVersion */ typedef struct _XResQueryVersion { CARD8 reqType; CARD8 XResReqType; CARD16 length B16; CARD8 client_major; CARD8 client_minor; CARD16 unused B16; } xXResQueryVersionReq; #define sz_xXResQueryVersionReq 8 typedef struct { CARD8 type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 server_major B16; CARD16 server_minor B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXResQueryVersionReply; #define sz_xXResQueryVersionReply 32 /* XResQueryClients */ typedef struct _XResQueryClients { CARD8 reqType; CARD8 XResReqType; CARD16 length B16; } xXResQueryClientsReq; #define sz_xXResQueryClientsReq 4 typedef struct { CARD8 type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num_clients B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXResQueryClientsReply; #define sz_xXResQueryClientsReply 32 /* XResQueryClientResources */ typedef struct _XResQueryClientResources { CARD8 reqType; CARD8 XResReqType; CARD16 length B16; CARD32 xid B32; } xXResQueryClientResourcesReq; #define sz_xXResQueryClientResourcesReq 8 typedef struct { CARD8 type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num_types B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXResQueryClientResourcesReply; #define sz_xXResQueryClientResourcesReply 32 /* XResQueryClientPixmapBytes */ typedef struct _XResQueryClientPixmapBytes { CARD8 reqType; CARD8 XResReqType; CARD16 length B16; CARD32 xid B32; } xXResQueryClientPixmapBytesReq; #define sz_xXResQueryClientPixmapBytesReq 8 typedef struct { CARD8 type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 bytes B32; CARD32 bytes_overflow B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXResQueryClientPixmapBytesReply; #define sz_xXResQueryClientPixmapBytesReply 32 #endif /* _XRESPROTO_H */ nx-libs-3.5.99.23/nx-X11/include/extensions/xtestconst.h0000644000000000000000000000277113614532331017523 0ustar /* Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _XTEST_H_ #define _XTEST_H_ #include #define X_XTestGetVersion 0 #define X_XTestCompareCursor 1 #define X_XTestFakeInput 2 #define X_XTestGrabControl 3 #define XTestNumberEvents 0 #define XTestNumberErrors 0 #define XTestMajorVersion 2 #define XTestMinorVersion 2 #define XTestExtensionName "XTEST" #endif nx-libs-3.5.99.23/nx-X11/include/extensions/xteststr.h0000644000000000000000000000630013614532331017175 0ustar /* Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _XTESTSTR_H_ #define _XTESTSTR_H_ #define Window CARD32 #define Time CARD32 #define Cursor CARD32 #define XTestCurrentCursor ((Cursor)1) typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 xtReqType; /* always X_XTestGetVersion */ CARD16 length B16; CARD8 majorVersion; CARD8 pad; CARD16 minorVersion B16; } xXTestGetVersionReq; #define sz_xXTestGetVersionReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 majorVersion; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 minorVersion B16; CARD16 pad0 B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXTestGetVersionReply; #define sz_xXTestGetVersionReply 32 typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 xtReqType; /* always X_XTestCompareCursor */ CARD16 length B16; Window window B32; Cursor cursor B32; } xXTestCompareCursorReq; #define sz_xXTestCompareCursorReq 12 typedef struct { BYTE type; /* X_Reply */ BOOL same; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXTestCompareCursorReply; #define sz_xXTestCompareCursorReply 32 /* used only on the client side */ typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 xtReqType; /* always X_XTestFakeInput */ CARD16 length B16; BYTE type; BYTE detail; CARD16 pad0 B16; Time time B32; Window root B32; CARD32 pad1 B32; CARD32 pad2 B32; INT16 rootX B16, rootY B16; CARD32 pad3 B32; CARD16 pad4 B16; CARD8 pad5; CARD8 deviceid; } xXTestFakeInputReq; #define sz_xXTestFakeInputReq 36 typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 xtReqType; /* always X_XTestGrabControl */ CARD16 length B16; BOOL impervious; CARD8 pad0; CARD8 pad1; CARD8 pad2; } xXTestGrabControlReq; #define sz_xXTestGrabControlReq 8 #undef Window #undef Time #undef Cursor #endif /* _XTESTSTR_H_ */ nx-libs-3.5.99.23/nx-X11/include/extensions/Xv.h0000644000000000000000000000574513614532331015706 0ustar /*********************************************************** Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef XV_H #define XV_H /* ** File: ** ** Xv.h --- Xv shared library and server header file ** ** Author: ** ** David Carver (Digital Workstation Engineering/Project Athena) ** ** Revisions: ** ** 05.15.91 Carver ** - version 2.0 upgrade ** ** 01.24.91 Carver ** - version 1.4 upgrade ** */ #include #define XvName "XVideo" #define XvVersion 2 #define XvRevision 2 /* Symbols */ typedef XID XvPortID; typedef XID XvEncodingID; #define XvNone 0 #define XvInput 0 #define XvOutput 1 #define XvInputMask (1L< #include #define XvMCName "XVideo-MotionCompensation" #define XvMCNumEvents 0 #define XvMCNumErrors 3 #define XvMCVersion 1 #define XvMCRevision 1 #define XvMCBadContext 0 #define XvMCBadSurface 1 #define XvMCBadSubpicture 2 /* Chroma formats */ #define XVMC_CHROMA_FORMAT_420 0x00000001 #define XVMC_CHROMA_FORMAT_422 0x00000002 #define XVMC_CHROMA_FORMAT_444 0x00000003 /* XvMCSurfaceInfo Flags */ #define XVMC_OVERLAID_SURFACE 0x00000001 #define XVMC_BACKEND_SUBPICTURE 0x00000002 #define XVMC_SUBPICTURE_INDEPENDENT_SCALING 0x00000004 #define XVMC_INTRA_UNSIGNED 0x00000008 /* Motion Compensation types */ #define XVMC_MOCOMP 0x00000000 #define XVMC_IDCT 0x00010000 #define XVMC_MPEG_1 0x00000001 #define XVMC_MPEG_2 0x00000002 #define XVMC_H263 0x00000003 #define XVMC_MPEG_4 0x00000004 #define XVMC_MB_TYPE_MOTION_FORWARD 0x02 #define XVMC_MB_TYPE_MOTION_BACKWARD 0x04 #define XVMC_MB_TYPE_PATTERN 0x08 #define XVMC_MB_TYPE_INTRA 0x10 #define XVMC_PREDICTION_FIELD 0x01 #define XVMC_PREDICTION_FRAME 0x02 #define XVMC_PREDICTION_DUAL_PRIME 0x03 #define XVMC_PREDICTION_16x8 0x02 #define XVMC_PREDICTION_4MV 0x04 #define XVMC_SELECT_FIRST_FORWARD 0x01 #define XVMC_SELECT_FIRST_BACKWARD 0x02 #define XVMC_SELECT_SECOND_FORWARD 0x04 #define XVMC_SELECT_SECOND_BACKWARD 0x08 #define XVMC_DCT_TYPE_FRAME 0x00 #define XVMC_DCT_TYPE_FIELD 0x01 #define XVMC_TOP_FIELD 0x00000001 #define XVMC_BOTTOM_FIELD 0x00000002 #define XVMC_FRAME_PICTURE (XVMC_TOP_FIELD | XVMC_BOTTOM_FIELD) #define XVMC_SECOND_FIELD 0x00000004 #define XVMC_DIRECT 0x00000001 #define XVMC_RENDERING 0x00000001 #define XVMC_DISPLAYING 0x00000002 typedef struct { int surface_type_id; int chroma_format; unsigned short max_width; unsigned short max_height; unsigned short subpicture_max_width; unsigned short subpicture_max_height; int mc_type; int flags; } XvMCSurfaceInfo; typedef struct { XID context_id; int surface_type_id; unsigned short width; unsigned short height; XvPortID port; int flags; void * privData; /* private to the library */ } XvMCContext; typedef struct { XID surface_id; XID context_id; int surface_type_id; unsigned short width; unsigned short height; void *privData; /* private to the library */ } XvMCSurface; typedef struct { XID subpicture_id; XID context_id; int xvimage_id; unsigned short width; unsigned short height; int num_palette_entries; int entry_bytes; char component_order[4]; void *privData; /* private to the library */ } XvMCSubpicture; typedef struct { unsigned int num_blocks; XID context_id; void *privData; short *blocks; } XvMCBlockArray; typedef struct { unsigned short x; unsigned short y; unsigned char macroblock_type; unsigned char motion_type; unsigned char motion_vertical_field_select; unsigned char dct_type; short PMV[2][2][2]; unsigned int index; unsigned short coded_block_pattern; unsigned short pad0; } XvMCMacroBlock; typedef struct { unsigned int num_blocks; XID context_id; void *privData; XvMCMacroBlock *macro_blocks; } XvMCMacroBlockArray; #endif nx-libs-3.5.99.23/nx-X11/include/extensions/XvMCproto.h0000644000000000000000000001143213614532331017200 0ustar #ifndef _XVMCPROTO_H_ #define _XVMCPROTO_H_ #define xvmc_QueryVersion 0 #define xvmc_ListSurfaceTypes 1 #define xvmc_CreateContext 2 #define xvmc_DestroyContext 3 #define xvmc_CreateSurface 4 #define xvmc_DestroySurface 5 #define xvmc_CreateSubpicture 6 #define xvmc_DestroySubpicture 7 #define xvmc_ListSubpictureTypes 8 #define xvmc_GetDRInfo 9 #define xvmc_LastRequest xvmc_GetDRInfo #define xvmcNumRequest (xvmc_LastRequest + 1) typedef struct { CARD32 surface_type_id B32; CARD16 chroma_format B16; CARD16 pad0 B16; CARD16 max_width B16; CARD16 max_height B16; CARD16 subpicture_max_width B16; CARD16 subpicture_max_height B16; CARD32 mc_type B32; CARD32 flags B32; } xvmcSurfaceInfo; #define sz_xvmcSurfaceInfo 24; typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; } xvmcQueryVersionReq; #define sz_xvmcQueryVersionReq 4; typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 major B32; CARD32 minor B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; } xvmcQueryVersionReply; #define sz_xvmcQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 port B32; } xvmcListSurfaceTypesReq; #define sz_xvmcListSurfaceTypesReq 8; typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num B32; CARD32 padl3 B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; } xvmcListSurfaceTypesReply; #define sz_xvmcListSurfaceTypesReply 32 typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 context_id B32; CARD32 port B32; CARD32 surface_type_id B32; CARD16 width B16; CARD16 height B16; CARD32 flags B32; } xvmcCreateContextReq; #define sz_xvmcCreateContextReq 24; typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 width_actual B16; CARD16 height_actual B16; CARD32 flags_return B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; } xvmcCreateContextReply; #define sz_xvmcCreateContextReply 32 typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 context_id B32; } xvmcDestroyContextReq; #define sz_xvmcDestroyContextReq 8; typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 surface_id B32; CARD32 context_id B32; } xvmcCreateSurfaceReq; #define sz_xvmcCreateSurfaceReq 12; typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 padl2 B32; CARD32 padl3 B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; } xvmcCreateSurfaceReply; #define sz_xvmcCreateSurfaceReply 32 typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 surface_id B32; } xvmcDestroySurfaceReq; #define sz_xvmcDestroySurfaceReq 8; typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 subpicture_id B32; CARD32 context_id B32; CARD32 xvimage_id B32; CARD16 width B16; CARD16 height B16; } xvmcCreateSubpictureReq; #define sz_xvmcCreateSubpictureReq 20; typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 width_actual B16; CARD16 height_actual B16; CARD16 num_palette_entries B16; CARD16 entry_bytes B16; CARD8 component_order[4]; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; } xvmcCreateSubpictureReply; #define sz_xvmcCreateSubpictureReply 32 typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 subpicture_id B32; } xvmcDestroySubpictureReq; #define sz_xvmcDestroySubpictureReq 8; typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 port B32; CARD32 surface_type_id B32; } xvmcListSubpictureTypesReq; #define sz_xvmcListSubpictureTypesReq 12; typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num B32; CARD32 padl2 B32; CARD32 padl3 B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; } xvmcListSubpictureTypesReply; #define sz_xvmcListSubpictureTypesReply 32 typedef struct { CARD8 reqType; CARD8 xvmcReqType; CARD16 length B16; CARD32 port B32; CARD32 shmKey B32; CARD32 magic B32; } xvmcGetDRInfoReq; #define sz_xvmcGetDRInfoReq 16; typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 major B32; CARD32 minor B32; CARD32 patchLevel B32; CARD32 nameLen B32; CARD32 busIDLen B32; CARD32 isLocal B32; } xvmcGetDRInfoReply; #define sz_xvmcGetDRInfoReply 32 #endif nx-libs-3.5.99.23/nx-X11/include/extensions/Xvproto.h0000644000000000000000000003152313614532331016763 0ustar /*********************************************************** Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef XVPROTO_H #define XVPROTO_H /* ** File: ** ** Xvproto.h --- Xv protocol header file ** ** Author: ** ** David Carver (Digital Workstation Engineering/Project Athena) ** ** Revisions: ** ** 11.06.91 Carver ** - changed SetPortControl to SetPortAttribute ** - changed GetPortControl to GetPortAttribute ** - changed QueryBestSize ** ** 15.05.91 Carver ** - version 2.0 upgrade ** ** 24.01.91 Carver ** - version 1.4 upgrade ** */ #include /* Symbols: These are undefined at the end of this file to restore the values they have in Xv.h */ #define XvPortID CARD32 #define XvEncodingID CARD32 #define ShmSeg CARD32 #define VisualID CARD32 #define Drawable CARD32 #define GContext CARD32 #define Time CARD32 #define Atom CARD32 /* Structures */ typedef struct { INT32 numerator B32; INT32 denominator B32; } xvRational; #define sz_xvRational 8 typedef struct { XvPortID base_id B32; CARD16 name_size B16; CARD16 num_ports B16; CARD16 num_formats B16; CARD8 type; CARD8 pad; } xvAdaptorInfo; #define sz_xvAdaptorInfo 12 typedef struct { XvEncodingID encoding B32; CARD16 name_size B16; CARD16 width B16, height B16; xvRational rate; CARD16 pad B16; } xvEncodingInfo; #define sz_xvEncodingInfo (12 + sz_xvRational) typedef struct { VisualID visual B32; CARD8 depth; CARD8 pad1; CARD16 pad2 B16; } xvFormat; #define sz_xvFormat 8 typedef struct { CARD32 flags B32; INT32 min B32; INT32 max B32; CARD32 size B32; } xvAttributeInfo; #define sz_xvAttributeInfo 16 typedef struct { CARD32 id B32; CARD8 type; CARD8 byte_order; CARD16 pad1 B16; CARD8 guid[16]; CARD8 bpp; CARD8 num_planes; CARD16 pad2 B16; CARD8 depth; CARD8 pad3; CARD16 pad4 B16; CARD32 red_mask B32; CARD32 green_mask B32; CARD32 blue_mask B32; CARD8 format; CARD8 pad5; CARD16 pad6 B16; CARD32 y_sample_bits B32; CARD32 u_sample_bits B32; CARD32 v_sample_bits B32; CARD32 horz_y_period B32; CARD32 horz_u_period B32; CARD32 horz_v_period B32; CARD32 vert_y_period B32; CARD32 vert_u_period B32; CARD32 vert_v_period B32; CARD8 comp_order[32]; CARD8 scanline_order; CARD8 pad7; CARD16 pad8 B16; CARD32 pad9 B32; CARD32 pad10 B32; } xvImageFormatInfo; #define sz_xvImageFormatInfo 128 /* Requests */ #define xv_QueryExtension 0 #define xv_QueryAdaptors 1 #define xv_QueryEncodings 2 #define xv_GrabPort 3 #define xv_UngrabPort 4 #define xv_PutVideo 5 #define xv_PutStill 6 #define xv_GetVideo 7 #define xv_GetStill 8 #define xv_StopVideo 9 #define xv_SelectVideoNotify 10 #define xv_SelectPortNotify 11 #define xv_QueryBestSize 12 #define xv_SetPortAttribute 13 #define xv_GetPortAttribute 14 #define xv_QueryPortAttributes 15 #define xv_ListImageFormats 16 #define xv_QueryImageAttributes 17 #define xv_PutImage 18 #define xv_ShmPutImage 19 #define xv_LastRequest xv_ShmPutImage #define xvNumRequests (xv_LastRequest + 1) typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; } xvQueryExtensionReq; #define sz_xvQueryExtensionReq 4 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; CARD32 window B32; } xvQueryAdaptorsReq; #define sz_xvQueryAdaptorsReq 8 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; CARD32 port B32; } xvQueryEncodingsReq; #define sz_xvQueryEncodingsReq 8 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Drawable drawable B32; GContext gc B32; INT16 vid_x B16; INT16 vid_y B16; CARD16 vid_w B16; CARD16 vid_h B16; INT16 drw_x B16; INT16 drw_y B16; CARD16 drw_w B16; CARD16 drw_h B16; } xvPutVideoReq; #define sz_xvPutVideoReq 32 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Drawable drawable B32; GContext gc B32; INT16 vid_x B16; INT16 vid_y B16; CARD16 vid_w B16; CARD16 vid_h B16; INT16 drw_x B16; INT16 drw_y B16; CARD16 drw_w B16; CARD16 drw_h B16; } xvPutStillReq; #define sz_xvPutStillReq 32 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Drawable drawable B32; GContext gc B32; INT16 vid_x B16; INT16 vid_y B16; CARD16 vid_w B16; CARD16 vid_h B16; INT16 drw_x B16; INT16 drw_y B16; CARD16 drw_w B16; CARD16 drw_h B16; } xvGetVideoReq; #define sz_xvGetVideoReq 32 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Drawable drawable B32; GContext gc B32; INT16 vid_x B16; INT16 vid_y B16; CARD16 vid_w B16; CARD16 vid_h B16; INT16 drw_x B16; INT16 drw_y B16; CARD16 drw_w B16; CARD16 drw_h B16; } xvGetStillReq; #define sz_xvGetStillReq 32 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Time time B32; } xvGrabPortReq; #define sz_xvGrabPortReq 12 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Time time B32; } xvUngrabPortReq; #define sz_xvUngrabPortReq 12 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; Drawable drawable B32; BOOL onoff; CARD8 pad1; CARD16 pad2; } xvSelectVideoNotifyReq; #define sz_xvSelectVideoNotifyReq 12 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; BOOL onoff; CARD8 pad1; CARD16 pad2; } xvSelectPortNotifyReq; #define sz_xvSelectPortNotifyReq 12 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Drawable drawable B32; } xvStopVideoReq; #define sz_xvStopVideoReq 12 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Atom attribute B32; INT32 value B32; } xvSetPortAttributeReq; #define sz_xvSetPortAttributeReq 16 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Atom attribute B32; } xvGetPortAttributeReq; #define sz_xvGetPortAttributeReq 12 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; CARD16 vid_w B16; CARD16 vid_h B16; CARD16 drw_w B16; CARD16 drw_h B16; CARD8 motion; CARD8 pad1; CARD16 pad2 B16; } xvQueryBestSizeReq; #define sz_xvQueryBestSizeReq 20 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; } xvQueryPortAttributesReq; #define sz_xvQueryPortAttributesReq 8 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Drawable drawable B32; GContext gc B32; CARD32 id B32; INT16 src_x B16; INT16 src_y B16; CARD16 src_w B16; CARD16 src_h B16; INT16 drw_x B16; INT16 drw_y B16; CARD16 drw_w B16; CARD16 drw_h B16; CARD16 width B16; CARD16 height B16; } xvPutImageReq; #define sz_xvPutImageReq 40 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; Drawable drawable B32; GContext gc B32; ShmSeg shmseg B32; CARD32 id B32; CARD32 offset B32; INT16 src_x B16; INT16 src_y B16; CARD16 src_w B16; CARD16 src_h B16; INT16 drw_x B16; INT16 drw_y B16; CARD16 drw_w B16; CARD16 drw_h B16; CARD16 width B16; CARD16 height B16; CARD8 send_event; CARD8 pad1; CARD16 pad2 B16; } xvShmPutImageReq; #define sz_xvShmPutImageReq 52 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; XvPortID port B32; } xvListImageFormatsReq; #define sz_xvListImageFormatsReq 8 typedef struct { CARD8 reqType; CARD8 xvReqType; CARD16 length B16; CARD32 port B32; CARD32 id B32; CARD16 width B16; CARD16 height B16; } xvQueryImageAttributesReq; #define sz_xvQueryImageAttributesReq 16 /* Replies */ typedef struct _QueryExtensionReply { BYTE type; /* X_Reply */ CARD8 padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 version B16; CARD16 revision B16; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvQueryExtensionReply; #define sz_xvQueryExtensionReply 32 typedef struct _QueryAdaptorsReply { BYTE type; /* X_Reply */ CARD8 padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 num_adaptors B16; CARD16 pads3 B16; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvQueryAdaptorsReply; #define sz_xvQueryAdaptorsReply 32 typedef struct _QueryEncodingsReply { BYTE type; /* X_Reply */ CARD8 padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 num_encodings B16; CARD32 padl3 B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvQueryEncodingsReply; #define sz_xvQueryEncodingsReply 32 typedef struct { BYTE type; /* X_Reply */ BYTE result; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD32 padl3 B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvGrabPortReply; #define sz_xvGrabPortReply 32 typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ INT32 value B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvGetPortAttributeReply; #define sz_xvGetPortAttributeReply 32 typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 actual_width B16; CARD16 actual_height B16; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvQueryBestSizeReply; #define sz_xvQueryBestSizeReply 32 typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD32 num_attributes B32; CARD32 text_size B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvQueryPortAttributesReply; #define sz_xvQueryPortAttributesReply 32 typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num_formats B32; CARD32 padl4 B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvListImageFormatsReply; #define sz_xvListImageFormatsReply 32 typedef struct { BYTE type; /* X_Reply */ BYTE padb1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num_planes B32; CARD32 data_size B32; CARD16 width B16; CARD16 height B16; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } xvQueryImageAttributesReply; #define sz_xvQueryImageAttributesReply 32 /* DEFINE EVENT STRUCTURE */ typedef struct { union { struct { BYTE type; BYTE detail; CARD16 sequenceNumber B16; } u; struct { BYTE type; BYTE reason; CARD16 sequenceNumber B16; Time time B32; Drawable drawable B32; XvPortID port B32; CARD32 padl5 B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } videoNotify; struct { BYTE type; BYTE padb1; CARD16 sequenceNumber B16; Time time B32; XvPortID port B32; Atom attribute B32; INT32 value B32; CARD32 padl6 B32; CARD32 padl7 B32; CARD32 padl8 B32; } portNotify; } u; } xvEvent; #undef XvPortID #undef XvEncodingID #undef ShmSeg #undef VisualID #undef Drawable #undef GContext #undef Time #undef Atom #endif /* XVPROTO_H */ nx-libs-3.5.99.23/nx-X11/include/GL/glx.h0000644000000000000000000002136313614532331014200 0ustar #ifndef __GLX_glx_h__ #define __GLX_glx_h__ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. */ #include #include #include #include #ifdef __cplusplus extern "C" { #endif /* ** GLX resources. */ typedef XID GLXContextID; typedef XID GLXPixmap; typedef XID GLXDrawable; typedef XID GLXPbuffer; typedef XID GLXWindow; typedef XID GLXFBConfigID; /* ** GLXContext is a pointer to opaque data. */ typedef struct __GLXcontextRec *GLXContext; /* ** GLXFBConfig is a pointer to opaque data. */ typedef struct __GLXFBConfigRec *GLXFBConfig; /************************************************************************/ extern XVisualInfo* glXChooseVisual (Display *dpy, int screen, int *attribList); extern void glXCopyContext (Display *dpy, GLXContext src, GLXContext dst, unsigned long mask); extern GLXContext glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct); extern GLXPixmap glXCreateGLXPixmap (Display *dpy, XVisualInfo *vis, Pixmap pixmap); extern void glXDestroyContext (Display *dpy, GLXContext ctx); extern void glXDestroyGLXPixmap (Display *dpy, GLXPixmap pix); extern int glXGetConfig (Display *dpy, XVisualInfo *vis, int attrib, int *value); extern GLXContext glXGetCurrentContext (void); extern GLXDrawable glXGetCurrentDrawable (void); extern Bool glXIsDirect (Display *dpy, GLXContext ctx); extern Bool glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx); extern Bool glXQueryExtension (Display *dpy, int *errorBase, int *eventBase); extern Bool glXQueryVersion (Display *dpy, int *major, int *minor); extern void glXSwapBuffers (Display *dpy, GLXDrawable drawable); extern void glXUseXFont (Font font, int first, int count, int listBase); extern void glXWaitGL (void); extern void glXWaitX (void); extern const char * glXGetClientString (Display *dpy, int name ); extern const char * glXQueryServerString (Display *dpy, int screen, int name ); extern const char * glXQueryExtensionsString (Display *dpy, int screen ); /* New for GLX 1.3 */ extern GLXFBConfig * glXGetFBConfigs (Display *dpy, int screen, int *nelements); extern GLXFBConfig * glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements); extern int glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value); extern XVisualInfo * glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config); extern GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); extern void glXDestroyWindow (Display *dpy, GLXWindow win); extern GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); extern void glXDestroyPixmap (Display *dpy, GLXPixmap pixmap); extern GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list); extern void glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf); extern void glXQueryDrawable (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); extern GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); extern Bool glXMakeContextCurrent (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx); extern GLXDrawable glXGetCurrentReadDrawable (void); extern Display * glXGetCurrentDisplay (void); extern int glXQueryContext (Display *dpy, GLXContext ctx, int attribute, int *value); extern void glXSelectEvent (Display *dpy, GLXDrawable draw, unsigned long event_mask); extern void glXGetSelectedEvent (Display *dpy, GLXDrawable draw, unsigned long *event_mask); /* GLX 1.4 and later */ extern void (*glXGetProcAddress(const GLubyte *procname))(void); #ifndef GLX_GLXEXT_LEGACY #include #else /* GLX extensions */ #define GLX_EXT_import_context 1 #define GLX_EXT_visual_info 1 #define GLX_EXT_visual_rating 1 #define GLX_ARB_get_proc_address 1 extern GLXContextID glXGetContextIDEXT (const GLXContext ctx); extern GLXContext glXImportContextEXT (Display *dpy, GLXContextID contextID); extern void glXFreeContextEXT (Display *dpy, GLXContext ctx); extern int glXQueryContextInfoEXT (Display *dpy, GLXContext ctx, int attribute, int *value); extern Display * glXGetCurrentDisplayEXT (void); extern void (*glXGetProcAddressARB(const GLubyte *procName))( void ); #endif /* GLX_GLXEXT_LEGACY */ /** ** The following aren't in glxext.h yet. **/ /* * ???. GLX_NV_vertex_array_range */ #ifndef GLX_NV_vertex_array_range #define GLX_NV_vertex_array_range extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); extern void glXFreeMemoryNV(GLvoid *pointer); typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer); #endif /* GLX_NV_vertex_array_range */ /* * ???. GLX_MESA_agp_offset (deprecated) */ #ifndef GLX_MESA_agp_offset #define GLX_MESA_agp_offset 1 extern GLuint glXGetAGPOffsetMESA(const GLvoid *pointer); typedef GLuint (* PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *pointer); #endif /* GLX_MESA_agp_offset */ /* * ???. GLX_MESA_allocate_memory */ #ifndef GLX_MESA_allocate_memory #define GLX_MESA_allocate_memory 1 extern void *glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority); extern void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer); extern GLuint glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer); typedef void * ( * PFNGLXALLOCATEMEMORYMESAPROC) (Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority); typedef void ( * PFNGLXFREEMEMORYMESAPROC) (Display *dpy, int scrn, void *pointer); typedef GLuint (* PFNGLXGETMEMORYOFFSETMESAPROC) (Display *dpy, int scrn, const void *pointer); #endif /* GLX_MESA_allocate_memory */ /* * ???. GLX_ARB_render_texture */ #ifndef GLX_ARB_render_texture #define GLX_ARB_render_texture 1 Bool glXBindTexImageARB( Display *dpy, GLXPbuffer pbuffer, int buffer ); Bool glXReleaseTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer ); Bool glXDrawableAttribARB( Display *dpy, GLXDrawable draw, const int *attribList ); #endif /*** Should these go here, or in another header? */ /* ** GLX Events */ typedef struct { int event_type; /* GLX_DAMAGED or GLX_SAVED */ int draw_type; /* GLX_WINDOW or GLX_PBUFFER */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came for SendEvent request */ Display *display; /* display the event was read from */ GLXDrawable drawable; /* XID of Drawable */ unsigned int buffer_mask; /* mask indicating which buffers are affected */ unsigned int aux_buffer; /* which aux buffer was affected */ int x, y; int width, height; int count; /* if nonzero, at least this many more */ } GLXPbufferClobberEvent; typedef union __GLXEvent { GLXPbufferClobberEvent glxpbufferclobber; long pad[24]; } GLXEvent; #ifdef __cplusplus } #endif #endif /* !__GLX_glx_h__ */ nx-libs-3.5.99.23/nx-X11/include/GL/glxint.h0000644000000000000000000001013413614532331014705 0ustar #ifndef __GLX_glxint_h__ #define __GLX_glxint_h__ /* ** The contents of this file are subject to the GLX Public License Version 1.0 ** (the "License"). You may not use this file except in compliance with the ** License. You may obtain a copy of the License at Silicon Graphics, Inc., ** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 ** or at http://www.sgi.com/software/opensource/glx/license.html. ** ** Software distributed under the License is distributed on an "AS IS" ** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY ** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR ** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific ** language governing rights and limitations under the License. ** ** The Original Software is GLX version 1.2 source code, released February, ** 1999. The developer of the Original Software is Silicon Graphics, Inc. ** Those portions of the Subject Software created by Silicon Graphics, Inc. ** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. ** ** $SGI$ */ #include #include #include "GL/gl.h" typedef struct __GLXvisualConfigRec __GLXvisualConfig; typedef struct __GLXFBConfigRec __GLXFBConfig; struct __GLXvisualConfigRec { VisualID vid; int class; Bool rgba; int redSize, greenSize, blueSize, alphaSize; unsigned long redMask, greenMask, blueMask, alphaMask; int accumRedSize, accumGreenSize, accumBlueSize, accumAlphaSize; Bool doubleBuffer; Bool stereo; int bufferSize; int depthSize; int stencilSize; int auxBuffers; int level; /* Start of Extended Visual Properties */ int visualRating; /* visual_rating extension */ int transparentPixel; /* visual_info extension */ /* colors are floats scaled to ints */ int transparentRed, transparentGreen, transparentBlue, transparentAlpha; int transparentIndex; int multiSampleSize; int nMultiSampleBuffers; int visualSelectGroup; }; #define __GLX_MIN_CONFIG_PROPS 18 #define __GLX_MAX_CONFIG_PROPS 500 #define __GLX_EXT_CONFIG_PROPS 10 /* ** Since we send all non-core visual properties as token, value pairs, ** we require 2 words across the wire. In order to maintain backwards ** compatibility, we need to send the total number of words that the ** VisualConfigs are sent back in so old libraries can simply "ignore" ** the new properties. */ #define __GLX_TOTAL_CONFIG (__GLX_MIN_CONFIG_PROPS + \ 2 * __GLX_EXT_CONFIG_PROPS) struct __GLXFBConfigRec { int visualType; int transparentType; /* colors are floats scaled to ints */ int transparentRed, transparentGreen, transparentBlue, transparentAlpha; int transparentIndex; int visualCaveat; int associatedVisualId; int screen; int drawableType; int renderType; int maxPbufferWidth, maxPbufferHeight, maxPbufferPixels; int optimalPbufferWidth, optimalPbufferHeight; /* for SGIX_pbuffer */ int visualSelectGroup; /* visuals grouped by select priority */ unsigned int id; GLboolean rgbMode; GLboolean colorIndexMode; GLboolean doubleBufferMode; GLboolean stereoMode; GLboolean haveAccumBuffer; GLboolean haveDepthBuffer; GLboolean haveStencilBuffer; /* The number of bits present in various buffers */ GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; GLint depthBits; GLint stencilBits; GLint indexBits; GLint redBits, greenBits, blueBits, alphaBits; GLuint redMask, greenMask, blueMask, alphaMask; GLuint multiSampleSize; /* Number of samples per pixel (0 if no ms) */ GLuint nMultiSampleBuffers; /* Number of availble ms buffers */ GLint maxAuxBuffers; /* frame buffer level */ GLint level; /* color ranges (for SGI_color_range) */ GLboolean extendedRange; GLdouble minRed, maxRed; GLdouble minGreen, maxGreen; GLdouble minBlue, maxBlue; GLdouble minAlpha, maxAlpha; }; #define __GLX_TOTAL_FBCONFIG_PROPS 35 #endif /* !__GLX_glxint_h__ */ nx-libs-3.5.99.23/nx-X11/include/GL/glxmd.h0000644000000000000000000000451113614532331014515 0ustar #ifndef _GLX_glxmd_h_ #define _GLX_glxmd_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. */ /* ** Machine dependent declarations. */ /* ** Define floating point wire types. These are in IEEE format on the wire. */ typedef float FLOAT32; typedef double FLOAT64; /* ** Like B32, but this is used to store floats in a request. ** ** NOTE: Machines that have a native 32-bit IEEE float can define this as ** nothing. Machines that don't might mimic the float with an integer, ** and then define this to :32. */ #define F32 #endif /* _GLX_glxmd_h_ */ nx-libs-3.5.99.23/nx-X11/include/GL/glxproto.h0000644000000000000000000022251713614532331015270 0ustar #ifndef _GLX_glxproto_h_ #define _GLX_glxproto_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. */ #include /*****************************************************************************/ /* ** Errrors. */ #define GLXBadContext 0 #define GLXBadContextState 1 #define GLXBadDrawable 2 #define GLXBadPixmap 3 #define GLXBadContextTag 4 #define GLXBadCurrentWindow 5 #define GLXBadRenderRequest 6 #define GLXBadLargeRequest 7 #define GLXUnsupportedPrivateRequest 8 #define GLXBadFBConfig 9 #define GLXBadPbuffer 10 #define GLXBadCurrentDrawable 11 #define GLXBadWindow 12 #define __GLX_NUMBER_ERRORS 12 /* ** Events. ** __GLX_NUMBER_EVENTS is set to 17 to account for the BufferClobberSGIX ** event - this helps initialization if the server supports the pbuffer ** extension and the client doesn't. */ #define GLX_PbufferClobber 0 #define __GLX_NUMBER_EVENTS 17 #define GLX_EXTENSION_NAME "GLX" #define GLX_EXTENSION_ALIAS "SGI-GLX" #define __GLX_MAX_CONTEXT_PROPS 3 #ifndef GLX_VENDOR #define GLX_VENDOR 0x1 #endif #ifndef GLX_VERSION #define GLX_VERSION 0x2 #endif #ifndef GLX_EXTENSIONS #define GLX_EXTENSIONS 0x3 #endif /*****************************************************************************/ /* ** For the structure definitions in this file, we must redefine these types in ** terms of Xmd.h types, which may include bitfields. All of these are ** undef'ed at the end of this file, restoring the definitions in glx.h. */ #define GLXContextID CARD32 #define GLXPixmap CARD32 #define GLXDrawable CARD32 #define GLXPbuffer CARD32 #define GLXWindow CARD32 #define GLXFBConfigID CARD32 #define GLXFBConfigIDSGIX CARD32 #define GLXPbufferSGIX CARD32 /* ** ContextTag is not exposed to the API. */ typedef CARD32 GLXContextTag; /*****************************************************************************/ /* ** Sizes of basic wire types. */ #define __GLX_SIZE_INT8 1 #define __GLX_SIZE_INT16 2 #define __GLX_SIZE_INT32 4 #define __GLX_SIZE_CARD8 1 #define __GLX_SIZE_CARD16 2 #define __GLX_SIZE_CARD32 4 #define __GLX_SIZE_FLOAT32 4 #define __GLX_SIZE_FLOAT64 8 /*****************************************************************************/ /* Requests */ /* ** Render command request. A bunch of rendering commands are packed into ** a single X extension request. */ typedef struct GLXRender { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; } xGLXRenderReq; #define sz_xGLXRenderReq 8 /* ** The maximum size that a GLXRender command can be. The value must fit ** in 16 bits and should be a multiple of 4. */ #define __GLX_MAX_RENDER_CMD_SIZE 64000 /* ** Large render command request. A single large rendering command ** is output in multiple X extension requests. The first packet ** contains an opcode dependent header (see below) that describes ** the data that follows. */ typedef struct GLXRenderLarge { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; CARD16 requestNumber B16; CARD16 requestTotal B16; CARD32 dataBytes B32; } xGLXRenderLargeReq; #define sz_xGLXRenderLargeReq 16 /* ** GLX single request. Commands that go over as single GLX protocol ** requests use this structure. The glxCode will be one of the X_GLsop ** opcodes. */ typedef struct GLXSingle { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; } xGLXSingleReq; #define sz_xGLXSingleReq 8 /* ** glXQueryVersion request */ typedef struct GLXQueryVersion { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 majorVersion B32; CARD32 minorVersion B32; } xGLXQueryVersionReq; #define sz_xGLXQueryVersionReq 12 /* ** glXIsDirect request */ typedef struct GLXIsDirect { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextID context B32; } xGLXIsDirectReq; #define sz_xGLXIsDirectReq 8 /* ** glXCreateContext request */ typedef struct GLXCreateContext { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextID context B32; CARD32 visual B32; CARD32 screen B32; GLXContextID shareList B32; BOOL isDirect; CARD8 reserved1; CARD16 reserved2 B16; } xGLXCreateContextReq; #define sz_xGLXCreateContextReq 24 /* ** glXDestroyContext request */ typedef struct GLXDestroyContext { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextID context B32; } xGLXDestroyContextReq; #define sz_xGLXDestroyContextReq 8 /* ** glXMakeCurrent request */ typedef struct GLXMakeCurrent { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXDrawable drawable B32; GLXContextID context B32; GLXContextTag oldContextTag B32; } xGLXMakeCurrentReq; #define sz_xGLXMakeCurrentReq 16 /* ** glXWaitGL request */ typedef struct GLXWaitGL { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; } xGLXWaitGLReq; #define sz_xGLXWaitGLReq 8 /* ** glXWaitX request */ typedef struct GLXWaitX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; } xGLXWaitXReq; #define sz_xGLXWaitXReq 8 /* ** glXCopyContext request */ typedef struct GLXCopyContext { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextID source B32; GLXContextID dest B32; CARD32 mask B32; GLXContextTag contextTag B32; } xGLXCopyContextReq; #define sz_xGLXCopyContextReq 20 /* ** glXSwapBuffers request */ typedef struct GLXSwapBuffers { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; GLXDrawable drawable B32; } xGLXSwapBuffersReq; #define sz_xGLXSwapBuffersReq 12 /* ** glXUseXFont request */ typedef struct GLXUseXFont { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag contextTag B32; CARD32 font B32; CARD32 first B32; CARD32 count B32; CARD32 listBase B32; } xGLXUseXFontReq; #define sz_xGLXUseXFontReq 24 /* ** glXCreateGLXPixmap request */ typedef struct GLXCreateGLXPixmap { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; CARD32 visual B32; CARD32 pixmap B32; GLXPixmap glxpixmap B32; } xGLXCreateGLXPixmapReq; #define sz_xGLXCreateGLXPixmapReq 20 /* ** glXDestroyGLXPixmap request */ typedef struct GLXDestroyGLXPixmap { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXPixmap glxpixmap B32; } xGLXDestroyGLXPixmapReq; #define sz_xGLXDestroyGLXPixmapReq 8 /* ** glXGetVisualConfigs request */ typedef struct GLXGetVisualConfigs { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; } xGLXGetVisualConfigsReq; #define sz_xGLXGetVisualConfigsReq 8 /* ** glXVendorPrivate request. */ typedef struct GLXVendorPrivate { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ GLXContextTag contextTag B32; /* ** More data may follow; this is just the header. */ } xGLXVendorPrivateReq; #define sz_xGLXVendorPrivateReq 12 /* ** glXVendorPrivateWithReply request */ typedef struct GLXVendorPrivateWithReply { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ GLXContextTag contextTag B32; /* ** More data may follow; this is just the header. */ } xGLXVendorPrivateWithReplyReq; #define sz_xGLXVendorPrivateWithReplyReq 12 /* ** glXQueryExtensionsString request */ typedef struct GLXQueryExtensionsString { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; } xGLXQueryExtensionsStringReq; #define sz_xGLXQueryExtensionsStringReq 8 /* ** glXQueryServerString request */ typedef struct GLXQueryServerString { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; CARD32 name B32; } xGLXQueryServerStringReq; #define sz_xGLXQueryServerStringReq 12 /* ** glXClientInfo request */ typedef struct GLXClientInfo { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 major B32; CARD32 minor B32; CARD32 numbytes B32; } xGLXClientInfoReq; #define sz_xGLXClientInfoReq 16 /*** Start of GLX 1.3 requests */ /* ** glXGetFBConfigs request */ typedef struct GLXGetFBConfigs { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; } xGLXGetFBConfigsReq; #define sz_xGLXGetFBConfigsReq 8 /* ** glXCreatePixmap request */ typedef struct GLXCreatePixmap { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; GLXFBConfigID fbconfig B32; CARD32 pixmap B32; GLXPixmap glxpixmap B32; CARD32 numAttribs B32; /* followed by attribute list */ } xGLXCreatePixmapReq; #define sz_xGLXCreatePixmapReq 24 /* ** glXDestroyPixmap request */ typedef struct GLXDestroyPixmap { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXPixmap glxpixmap B32; } xGLXDestroyPixmapReq; #define sz_xGLXDestroyPixmapReq 8 /* ** glXCreateNewContext request */ typedef struct GLXCreateNewContext { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextID context B32; GLXFBConfigID fbconfig B32; CARD32 screen B32; CARD32 renderType; GLXContextID shareList B32; BOOL isDirect; CARD8 reserved1; CARD16 reserved2 B16; } xGLXCreateNewContextReq; #define sz_xGLXCreateNewContextReq 28 /* ** glXQueryContext request */ typedef struct GLXQueryContext { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextID context B32; } xGLXQueryContextReq; #define sz_xGLXQueryContextReq 8 /* ** glXMakeContextCurrent request */ typedef struct GLXMakeContextCurrent { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXContextTag oldContextTag B32; GLXDrawable drawable B32; GLXDrawable readdrawable B32; GLXContextID context B32; } xGLXMakeContextCurrentReq; #define sz_xGLXMakeContextCurrentReq 20 /* ** glXCreatePbuffer request */ typedef struct GLXCreatePbuffer { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; GLXFBConfigID fbconfig B32; GLXPbuffer pbuffer B32; CARD32 numAttribs B32; /* followed by attribute list */ } xGLXCreatePbufferReq; #define sz_xGLXCreatePbufferReq 20 /* ** glXDestroyPbuffer request */ typedef struct GLXDestroyPbuffer { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXPbuffer pbuffer B32; } xGLXDestroyPbufferReq; #define sz_xGLXDestroyPbufferReq 8 /* ** glXGetDrawableAttributes request */ typedef struct GLXGetDrawableAttributes { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXDrawable drawable B32; } xGLXGetDrawableAttributesReq; #define sz_xGLXGetDrawableAttributesReq 8 /* ** glXChangeDrawableAttributes request */ typedef struct GLXChangeDrawableAttributes { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXDrawable drawable B32; CARD32 numAttribs B32; /* followed by attribute list */ } xGLXChangeDrawableAttributesReq; #define sz_xGLXChangeDrawableAttributesReq 12 /* ** glXCreateWindow request */ typedef struct GLXCreateWindow { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 screen B32; GLXFBConfigID fbconfig B32; CARD32 window B32; GLXWindow glxwindow B32; CARD32 numAttribs B32; /* followed by attribute list */ } xGLXCreateWindowReq; #define sz_xGLXCreateWindowReq 24 /* ** glXDestroyWindow request */ typedef struct GLXDestroyWindow { CARD8 reqType; CARD8 glxCode; CARD16 length B16; GLXWindow glxwindow B32; } xGLXDestroyWindowReq; #define sz_xGLXDestroyWindowReq 8 /* Replies */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 error B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetErrorReply; #define sz_xGLXGetErrorReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; GLXContextTag contextTag B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXMakeCurrentReply; #define sz_xGLXMakeCurrentReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXReadPixelsReply; #define sz_xGLXReadPixelsReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 width B32; CARD32 height B32; CARD32 depth B32; CARD32 pad6 B32; } xGLXGetTexImageReply; #define sz_xGLXGetTexImageReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 width B32; CARD32 height B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetSeparableFilterReply; #define sz_xGLXGetSeparableFilterReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 width B32; CARD32 height B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetConvolutionFilterReply; #define sz_xGLXGetConvolutionFilterReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 width B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetHistogramReply; #define sz_xGLXGetHistogramReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetMinmaxReply; #define sz_xGLXGetMinmaxReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 retval B32; CARD32 size B32; CARD32 newMode B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXRenderModeReply; #define sz_xGLXRenderModeReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 majorVersion B32; CARD32 minorVersion B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryVersionReply; #define sz_xGLXQueryVersionReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numVisuals B32; CARD32 numProps B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetVisualConfigsReply; #define sz_xGLXGetVisualConfigsReply 32 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; BOOL isDirect; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGLXIsDirectReply; #define sz_xGLXIsDirectReply 32 /* ** This reply structure is used for all single replies. Single replies ** ship either 1 piece of data or N pieces of data. In these cases ** size indicates how much data is to be returned. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 retval B32; CARD32 size B32; CARD32 pad3 B32; /* NOTE: may hold a single value */ CARD32 pad4 B32; /* NOTE: may hold half a double */ CARD32 pad5 B32; CARD32 pad6 B32; } xGLXSingleReply; #define sz_xGLXSingleReply 32 /* ** This reply structure is used for all Vendor Private replies. Vendor ** Private replies can ship up to 24 bytes within the header or can ** be variable sized, in which case, the reply length field indicates ** the number of words of data which follow the header. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 retval B32; CARD32 size B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXVendorPrivReply; #define sz_xGLXVendorPrivReply 32 /* ** QueryExtensionsStringReply ** n indicates the number of bytes to be returned. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 n B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryExtensionsStringReply; #define sz_xGLXQueryExtensionsStringReply 32 /* ** QueryServerString Reply struct ** n indicates the number of bytes to be returned. */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 n B32; CARD32 pad3 B32; /* NOTE: may hold a single value */ CARD32 pad4 B32; /* NOTE: may hold half a double */ CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryServerStringReply; #define sz_xGLXQueryServerStringReply 32 /*** Start of GLX 1.3 replies */ /* ** glXGetFBConfigs reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numFBConfigs B32; CARD32 numAttribs B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetFBConfigsReply; #define sz_xGLXGetFBConfigsReply 32 /* ** glXQueryContext reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 n B32; /* number of attribute/value pairs */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryContextReply; #define sz_xGLXQueryContextReply 32 /* ** glXMakeContextCurrent reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; GLXContextTag contextTag B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXMakeContextCurrentReply; #define sz_xGLXMakeContextCurrentReply 32 /* ** glXCreateGLXPbuffer reply ** This is used only in the direct rendering case on SGIs - otherwise ** CreateGLXPbuffer has no reply. It is not part of GLX 1.3. */ typedef struct { BYTE type; /* X_Reply */ CARD8 success; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXCreateGLXPbufferReply; #define sz_xGLXCreateGLXPbufferReply 32 /* ** glXGetDrawableAttributes reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 numAttribs B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetDrawableAttributesReply; #define sz_xGLXGetDrawableAttributesReply 32 /* ** glXGetColorTable reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 width B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXGetColorTableReply; #define sz_xGLXGetColorTableReply 32 /************************************************************************/ /* GLX extension requests and replies */ /* ** glXQueryContextInfoEXT request */ typedef struct GLXQueryContextInfoEXT { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ GLXContextID context B32; } xGLXQueryContextInfoEXTReq; #define sz_xGLXQueryContextInfoEXTReq 16 /* ** glXQueryContextInfoEXT reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 n B32; /* number of attribute/value pairs */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryContextInfoEXTReply; #define sz_xGLXQueryContextInfoEXTReply 32 /* ** glXMakeCurrentReadSGI request */ typedef struct GLXMakeCurrentReadSGI { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ GLXContextTag oldContextTag B32; GLXDrawable drawable B32; GLXDrawable readable B32; GLXContextID context B32; } xGLXMakeCurrentReadSGIReq; #define sz_xGLXMakeCurrentReadSGIReq 24 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; GLXContextTag contextTag B32; CARD32 writeVid B32; CARD32 writeType B32; CARD32 readVid B32; CARD32 readType B32; CARD32 pad6 B32; } xGLXMakeCurrentReadSGIReply; #define sz_xGLXMakeCurrentReadSGIReply 32 /* ** glXGetFBConfigsSGIX request */ typedef struct GLXGetFBConfigsSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ CARD32 screen B32; } xGLXGetFBConfigsSGIXReq; #define sz_xGLXGetFBConfigsSGIXReq 16 /* ** glXCreateContextWithConfigSGIX request */ typedef struct GLXCreateContextWithConfigSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ GLXContextID context B32; GLXFBConfigID fbconfig B32; CARD32 screen B32; CARD32 renderType; GLXContextID shareList B32; BOOL isDirect; CARD8 reserved1; CARD16 reserved2 B16; } xGLXCreateContextWithConfigSGIXReq; #define sz_xGLXCreateContextWithConfigSGIXReq 36 /* ** glXCreatePixmapWithConfigSGIX request */ typedef struct GLXCreateGLXPixmapWithConfigSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ CARD32 screen B32; GLXFBConfigID fbconfig B32; CARD32 pixmap B32; GLXPixmap glxpixmap B32; } xGLXCreateGLXPixmapWithConfigSGIXReq; #define sz_xGLXCreateGLXPixmapWithConfigSGIXReq 28 /* ** glXJoinSwapGroupSGIX request */ typedef struct GLXJoinSwapGroupSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 unused B32; /* corresponds to contextTag in hdr */ GLXDrawable drawable B32; GLXDrawable member B32; } xGLXJoinSwapGroupSGIXReq; #define sz_xGLXJoinSwapGroupSGIXReq 20 /* ** glXBindSwapBarrierSGIX request */ typedef struct GLXBindSwapBarrierSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 unused B32; /* corresponds to contextTag in hdr */ GLXDrawable drawable B32; CARD32 barrier B32; } xGLXBindSwapBarrierSGIXReq; #define sz_xGLXBindSwapBarrierSGIXReq 20 /* ** glXQueryMaxSwapBarriersSGIX request */ typedef struct GLXQueryMaxSwapBarriersSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 unused B32; /* corresponds to contextTag in hdr */ CARD32 screen B32; } xGLXQueryMaxSwapBarriersSGIXReq; #define sz_xGLXQueryMaxSwapBarriersSGIXReq 16 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 max B32; CARD32 size B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryMaxSwapBarriersSGIXReply; #define sz_xGLXQueryMaxSwapBarriersSGIXReply 32 /* ** glXQueryHyperpipeNetworkSGIX request */ typedef struct GLXQueryHyperpipeNetworkSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ CARD32 screen B32; } xGLXQueryHyperpipeNetworkSGIXReq; #define sz_xGLXQueryHyperpipeNetworkSGIXReq 16 /* ** glXQueryHyperpipeNetworkSGIX reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 n B32; CARD32 npipes B32; /* NOTE: may hold a single value */ CARD32 pad4 B32; /* NOTE: may hold half a double */ CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryHyperpipeNetworkSGIXReply; #define sz_xGLXQueryHyperpipeNetworkSGIXReply 32 /* ** glXDestroyHyperpipeConfigSGIX request */ typedef struct GLXDestroyHyperpipeConfigSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ CARD32 screen B32; CARD32 hpId B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xGLXDestroyHyperpipeConfigSGIXReq; #define sz_xGLXDestroyHyperpipeConfigSGIXReq 32 /* ** glXDestroyHyperpipeConfigSGIX reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 n B32; CARD32 success B32; /* NOTE: may hold a single value */ CARD32 pad4 B32; /* NOTE: may hold half a double */ CARD32 pad5 B32; CARD32 pad6 B32; } xGLXDestroyHyperpipeConfigSGIXReply; #define sz_xGLXDestroyHyperpipeConfigSGIXReply 32 /* ** glXQueryHyperpipeConfigSGIX request */ typedef struct GLXQueryHyperpipeConfigSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ CARD32 screen B32; CARD32 hpId B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xGLXQueryHyperpipeConfigSGIXReq; #define sz_xGLXQueryHyperpipeConfigSGIXReq 32 /* ** glXQueryHyperpipeConfigSGIX reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 n B32; CARD32 npipes B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXQueryHyperpipeConfigSGIXReply; #define sz_xGLXQueryHyperpipeConfigSGIXReply 32 /* ** glXHyperpipeConfigSGIX request */ typedef struct GLXHyperpipeConfigSGIX { CARD8 reqType; CARD8 glxCode; CARD16 length B16; CARD32 vendorCode B32; /* vendor-specific opcode */ CARD32 pad1 B32; /* unused; corresponds to contextTag in header */ CARD32 screen B32; CARD32 npipes B32; CARD32 networkId B32; CARD32 pad2 B32; CARD32 pad3 B32; /* followed by attribute list */ } xGLXHyperpipeConfigSGIXReq; #define sz_xGLXHyperpipeConfigSGIXReq 32 /* ** glXHyperpipeConfigSGIX reply */ typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 n B32; CARD32 npipes B32; CARD32 hpId B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGLXHyperpipeConfigSGIXReply; #define sz_xGLXHyperpipeConfigSGIXReply 32 /************************************************************************/ /* ** Events */ typedef struct { BYTE type; BYTE pad; CARD16 sequenceNumber B16; CARD16 event_type B16; /*** was clobber_class */ CARD16 draw_type B16; CARD32 drawable B32; CARD32 buffer_mask B32; /*** was mask */ CARD16 aux_buffer B16; CARD16 x B16; CARD16 y B16; CARD16 width B16; CARD16 height B16; CARD16 count B16; CARD32 unused2 B32; } xGLXPbufferClobberEvent; /************************************************************************/ /* ** Size of the standard X request header. */ #define __GLX_SINGLE_HDR_SIZE sz_xGLXSingleReq #define __GLX_VENDPRIV_HDR_SIZE sz_xGLXVendorPrivateReq #define __GLX_RENDER_HDR \ CARD16 length B16; \ CARD16 opcode B16 #define __GLX_RENDER_HDR_SIZE 4 typedef struct { __GLX_RENDER_HDR; } __GLXrenderHeader; #define __GLX_RENDER_LARGE_HDR \ CARD32 length B32; \ CARD32 opcode B32 #define __GLX_RENDER_LARGE_HDR_SIZE 8 typedef struct { __GLX_RENDER_LARGE_HDR; } __GLXrenderLargeHeader; /* ** The glBitmap, glPolygonStipple, glTexImage[12]D, glTexSubImage[12]D ** and glDrawPixels calls all have a pixel header transmitted after the ** Render or RenderLarge header and before their own opcode specific ** headers. */ #define __GLX_PIXEL_HDR \ BOOL swapBytes; \ BOOL lsbFirst; \ CARD8 reserved0; \ CARD8 reserved1; \ CARD32 rowLength B32; \ CARD32 skipRows B32; \ CARD32 skipPixels B32; \ CARD32 alignment B32 #define __GLX_PIXEL_HDR_SIZE 20 typedef struct { __GLX_PIXEL_HDR; } __GLXpixelHeader; /* ** glTexImage[34]D and glTexSubImage[34]D calls ** all have a pixel header transmitted after the Render or RenderLarge ** header and before their own opcode specific headers. */ #define __GLX_PIXEL_3D_HDR \ BOOL swapBytes; \ BOOL lsbFirst; \ CARD8 reserved0; \ CARD8 reserved1; \ CARD32 rowLength B32; \ CARD32 imageHeight B32; \ CARD32 imageDepth B32; \ CARD32 skipRows B32; \ CARD32 skipImages B32; \ CARD32 skipVolumes B32; \ CARD32 skipPixels B32; \ CARD32 alignment B32 #define __GLX_PIXEL_3D_HDR_SIZE 36 /* ** Data that is specific to a glBitmap call. The data is sent in the ** following order: ** Render or RenderLarge header ** Pixel header ** Bitmap header */ #define __GLX_BITMAP_HDR \ CARD32 width B32; \ CARD32 height B32; \ FLOAT32 xorig F32; \ FLOAT32 yorig F32; \ FLOAT32 xmove F32; \ FLOAT32 ymove F32 typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; __GLX_BITMAP_HDR; } __GLXbitmapHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_HDR; __GLX_BITMAP_HDR; } __GLXbitmapLargeHeader; typedef struct { __GLX_PIXEL_HDR; __GLX_BITMAP_HDR; } __GLXdispatchBitmapHeader; #define __GLX_BITMAP_HDR_SIZE 24 #define __GLX_BITMAP_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_BITMAP_HDR_SIZE) #define __GLX_BITMAP_CMD_DISPATCH_HDR_SIZE \ (__GLX_PIXEL_HDR_SIZE + __GLX_BITMAP_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; } __GLXpolygonStippleHeader; #define __GLX_POLYGONSTIPPLE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE) /* ** Data that is specific to a glTexImage1D or glTexImage2D call. The ** data is sent in the following order: ** Render or RenderLarge header ** Pixel header ** TexImage header ** When a glTexImage1D call the height field is unexamined by the server. */ #define __GLX_TEXIMAGE_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 components B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 border B32; \ CARD32 format B32; \ CARD32 type B32 #define __GLX_TEXIMAGE_HDR_SIZE 32 #define __GLX_TEXIMAGE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_TEXIMAGE_HDR_SIZE) #define __GLX_TEXIMAGE_CMD_DISPATCH_HDR_SIZE \ (__GLX_PIXEL_HDR_SIZE + __GLX_TEXIMAGE_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; __GLX_TEXIMAGE_HDR; } __GLXtexImageHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_HDR; __GLX_TEXIMAGE_HDR; } __GLXtexImageLargeHeader; typedef struct { __GLX_PIXEL_HDR; __GLX_TEXIMAGE_HDR; } __GLXdispatchTexImageHeader; /* ** Data that is specific to a glTexImage3D or glTexImage4D call. The ** data is sent in the following order: ** Render or RenderLarge header ** Pixel 3D header ** TexImage 3D header ** When a glTexImage3D call the size4d and woffset fields are unexamined ** by the server. ** Could be used by all TexImage commands and perhaps should be in the ** future. */ #define __GLX_TEXIMAGE_3D_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 internalformat B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 depth B32; \ CARD32 size4d B32; \ CARD32 border B32; \ CARD32 format B32; \ CARD32 type B32; \ CARD32 nullimage B32 #define __GLX_TEXIMAGE_3D_HDR_SIZE 44 #define __GLX_TEXIMAGE_3D_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_3D_HDR_SIZE + \ __GLX_TEXIMAGE_3D_HDR_SIZE) #define __GLX_TEXIMAGE_3D_CMD_DISPATCH_HDR_SIZE \ (__GLX_PIXEL_3D_HDR_SIZE + __GLX_TEXIMAGE_3D_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_3D_HDR; __GLX_TEXIMAGE_3D_HDR; } __GLXtexImage3DHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_3D_HDR; __GLX_TEXIMAGE_3D_HDR; } __GLXtexImage3DLargeHeader; typedef struct { __GLX_PIXEL_3D_HDR; __GLX_TEXIMAGE_3D_HDR; } __GLXdispatchTexImage3DHeader; /* ** Data that is specific to a glTexSubImage1D or glTexSubImage2D call. The ** data is sent in the following order: ** Render or RenderLarge header ** Pixel header ** TexSubImage header ** When a glTexSubImage1D call is made, the yoffset and height fields ** are unexamined by the server and are considered to be padding. */ #define __GLX_TEXSUBIMAGE_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 xoffset B32; \ CARD32 yoffset B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 format B32; \ CARD32 type B32; \ CARD32 nullImage \ #define __GLX_TEXSUBIMAGE_HDR_SIZE 36 #define __GLX_TEXSUBIMAGE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_TEXSUBIMAGE_HDR_SIZE) #define __GLX_TEXSUBIMAGE_CMD_DISPATCH_HDR_SIZE \ (__GLX_PIXEL_HDR_SIZE + __GLX_TEXSUBIMAGE_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; __GLX_TEXSUBIMAGE_HDR; } __GLXtexSubImageHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_HDR; __GLX_TEXSUBIMAGE_HDR; } __GLXtexSubImageLargeHeader; typedef struct { __GLX_PIXEL_HDR; __GLX_TEXSUBIMAGE_HDR; } __GLXdispatchTexSubImageHeader; /* ** Data that is specific to a glTexSubImage3D and 4D calls. The ** data is sent in the following order: ** Render or RenderLarge header ** Pixel 3D header ** TexSubImage 3D header ** When a glTexSubImage3D call is made, the woffset and size4d fields ** are unexamined by the server and are considered to be padding. */ #define __GLX_TEXSUBIMAGE_3D_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 xoffset B32; \ CARD32 yoffset B32; \ CARD32 zoffset B32; \ CARD32 woffset B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 depth B32; \ CARD32 size4d B32; \ CARD32 format B32; \ CARD32 type B32; \ CARD32 nullImage \ #define __GLX_TEXSUBIMAGE_3D_HDR_SIZE 52 #define __GLX_TEXSUBIMAGE_3D_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_3D_HDR_SIZE + \ __GLX_TEXSUBIMAGE_3D_HDR_SIZE) #define __GLX_TEXSUBIMAGE_3D_CMD_DISPATCH_HDR_SIZE \ (__GLX_PIXEL_3D_HDR_SIZE + __GLX_TEXSUBIMAGE_3D_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_3D_HDR; __GLX_TEXSUBIMAGE_3D_HDR; } __GLXtexSubImage3DHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_3D_HDR; __GLX_TEXSUBIMAGE_3D_HDR; } __GLXtexSubImage3DLargeHeader; typedef struct { __GLX_PIXEL_3D_HDR; __GLX_TEXSUBIMAGE_3D_HDR; } __GLXdispatchTexSubImage3DHeader; /** * Data that is specific to a \c glCompressedTexImage1D or * \c glCompressedTexImage2D call. The data is sent in the following * order: * - Render or RenderLarge header * - CompressedTexImage header * * When a \c glCompressedTexImage1D call is made, the \c height field is * not examined by the server and is considered padding. */ #define __GLX_COMPRESSED_TEXIMAGE_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 internalFormat B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 border B32; \ CARD32 imageSize B32 #define __GLX_COMPRESSED_TEXIMAGE_HDR_SIZE 28 #define __GLX_COMPRESSED_TEXIMAGE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_COMPRESSED_TEXIMAGE_HDR_SIZE) #define __GLX_COMPRESSED_TEXIMAGE_DISPATCH_HDR_SIZE \ (__GLX_COMPRESSED_TEXIMAGE_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_COMPRESSED_TEXIMAGE_HDR; } __GLXcompressedTexImageHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_COMPRESSED_TEXIMAGE_HDR; } __GLXcompressedTexImageLargeHeader; typedef struct { __GLX_COMPRESSED_TEXIMAGE_HDR; } __GLXdispatchCompressedTexImageHeader; /** * Data that is specifi to a \c glCompressedTexSubImage1D or * \c glCompressedTexSubImage2D call. The data is sent in the following * order: * - Render or RenderLarge header * - CompressedTexSubImage header * * When a \c glCompressedTexSubImage1D call is made, the \c yoffset and * \c height fields are not examined by the server and are considered padding. */ #define __GLX_COMPRESSED_TEXSUBIMAGE_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 xoffset B32; \ CARD32 yoffset B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 format B32; \ CARD32 imageSize B32 #define __GLX_COMPRESSED_TEXSUBIMAGE_HDR_SIZE 32 #define __GLX_COMPRESSED_TEXSUBIMAGE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_COMPRESSED_TEXSUBIMAGE_HDR_SIZE) #define __GLX_COMPRESSED_TEXSUBIMAGE_DISPATCH_HDR_SIZE \ (__GLX_COMPRESSED_TEXSUBIMAGE_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_COMPRESSED_TEXSUBIMAGE_HDR; } __GLXcompressedTexSubImageHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_COMPRESSED_TEXSUBIMAGE_HDR; } __GLXcompressedTexSubImageLargeHeader; typedef struct { __GLX_COMPRESSED_TEXSUBIMAGE_HDR; } __GLXdispatchCompressedTexSubImageHeader; /** * Data that is specific to a \c glCompressedTexImage3D call. The data is * sent in the following order: * - Render or RenderLarge header * - CompressedTexImage3D header */ #define __GLX_COMPRESSED_TEXIMAGE_3D_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 internalFormat B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 depth B32; \ CARD32 border B32; \ CARD32 imageSize B32 #define __GLX_COMPRESSED_TEXIMAGE_3D_HDR_SIZE 32 #define __GLX_COMPRESSED_TEXIMAGE_3D_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_COMPRESSED_TEXIMAGE_3D_HDR_SIZE) #define __GLX_COMPRESSED_TEXIMAGE_3D_DISPATCH_HDR_SIZE \ (__GLX_COMPRESSED_TEXIMAGE_3D_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_COMPRESSED_TEXIMAGE_3D_HDR; } __GLXcompressedTexImage3DHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_COMPRESSED_TEXIMAGE_3D_HDR; } __GLXcompressedTexImage3DLargeHeader; typedef struct { __GLX_COMPRESSED_TEXIMAGE_3D_HDR; } __GLXdispatchCompressedTexImage3DHeader; /** * Data that is specifi to a \c glCompressedTexSubImage3D call. The data is * sent in the following order: * - Render or RenderLarge header * - CompressedTexSubImage3D header */ #define __GLX_COMPRESSED_TEXSUBIMAGE_3D_HDR \ CARD32 target B32; \ CARD32 level B32; \ CARD32 xoffset B32; \ CARD32 yoffset B32; \ CARD32 zoffset B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 depth B32; \ CARD32 format B32; \ CARD32 imageSize B32 #define __GLX_COMPRESSED_TEXSUBIMAGE_3D_HDR_SIZE 32 #define __GLX_COMPRESSED_TEXSUBIMAGE_3D_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_COMPRESSED_TEXSUBIMAGE_3D_HDR_SIZE) #define __GLX_COMPRESSED_TEXSUBIMAGE_3D_DISPATCH_HDR_SIZE \ (__GLX_COMPRESSED_TEXSUBIMAGE_3D_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_COMPRESSED_TEXSUBIMAGE_3D_HDR; } __GLXcompressedTexSubImage3DHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_COMPRESSED_TEXSUBIMAGE_3D_HDR; } __GLXcompressedTexSubImage3DLargeHeader; typedef struct { __GLX_COMPRESSED_TEXSUBIMAGE_3D_HDR; } __GLXdispatchCompressedTexSubImage3DHeader; /* ** Data that is specific to a glDrawPixels call. The data is sent in the ** following order: ** Render or RenderLarge header ** Pixel header ** DrawPixels header */ #define __GLX_DRAWPIXELS_HDR \ CARD32 width B32; \ CARD32 height B32; \ CARD32 format B32; \ CARD32 type B32 #define __GLX_DRAWPIXELS_HDR_SIZE 16 #define __GLX_DRAWPIXELS_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_DRAWPIXELS_HDR_SIZE) #define __GLX_DRAWPIXELS_CMD_DISPATCH_HDR_SIZE \ (__GLX_PIXEL_HDR_SIZE + __GLX_DRAWPIXELS_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; __GLX_DRAWPIXELS_HDR; } __GLXdrawPixelsHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_HDR; __GLX_DRAWPIXELS_HDR; } __GLXdrawPixelsLargeHeader; typedef struct { __GLX_PIXEL_HDR; __GLX_DRAWPIXELS_HDR; } __GLXdispatchDrawPixelsHeader; /* ** Data that is specific to a glConvolutionFilter1D or glConvolutionFilter2D ** call. The data is sent in the following order: ** Render or RenderLarge header ** Pixel header ** ConvolutionFilter header ** When a glConvolutionFilter1D call the height field is unexamined by the server. */ #define __GLX_CONV_FILT_HDR \ CARD32 target B32; \ CARD32 internalformat B32; \ CARD32 width B32; \ CARD32 height B32; \ CARD32 format B32; \ CARD32 type B32 #define __GLX_CONV_FILT_HDR_SIZE 24 #define __GLX_CONV_FILT_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_CONV_FILT_HDR_SIZE) #define __GLX_CONV_FILT_CMD_DISPATCH_HDR_SIZE \ (__GLX_PIXEL_HDR_SIZE + __GLX_CONV_FILT_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; __GLX_CONV_FILT_HDR; } __GLXConvolutionFilterHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_HDR; __GLX_CONV_FILT_HDR; } __GLXConvolutionFilterLargeHeader; typedef struct { __GLX_PIXEL_HDR; __GLX_CONV_FILT_HDR; } __GLXdispatchConvolutionFilterHeader; /* ** Data that is specific to a glDrawArraysEXT call. The data is sent in the ** following order: ** Render or RenderLarge header ** Draw Arrays header ** a variable number of Component headers ** vertex data for each component type */ #define __GLX_DRAWARRAYS_HDR \ CARD32 numVertexes B32; \ CARD32 numComponents B32; \ CARD32 primType B32 #define __GLX_DRAWARRAYS_HDR_SIZE 12 #define __GLX_DRAWARRAYS_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_DRAWARRAYS_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_DRAWARRAYS_HDR; } __GLXdrawArraysHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_DRAWARRAYS_HDR; } __GLXdrawArraysLargeHeader; typedef struct { __GLX_DRAWARRAYS_HDR; } __GLXdispatchDrawArraysHeader; #define __GLX_COMPONENT_HDR \ CARD32 datatype B32; \ INT32 numVals B32; \ CARD32 component B32 typedef struct { __GLX_COMPONENT_HDR; } __GLXdispatchDrawArraysComponentHeader; #define __GLX_COMPONENT_HDR_SIZE 12 /* ** Data that is specific to a glColorTable call ** The data is sent in the following order: ** Render or RenderLarge header ** Pixel header ** ColorTable header */ #define __GLX_COLOR_TABLE_HDR \ CARD32 target B32; \ CARD32 internalformat B32; \ CARD32 width B32; \ CARD32 format B32; \ CARD32 type B32 #define __GLX_COLOR_TABLE_HDR_SIZE 20 #define __GLX_COLOR_TABLE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + __GLX_COLOR_TABLE_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; __GLX_COLOR_TABLE_HDR; } __GLXColorTableHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_HDR; __GLX_COLOR_TABLE_HDR; } __GLXColorTableLargeHeader; typedef struct { __GLX_PIXEL_HDR; __GLX_COLOR_TABLE_HDR; } __GLXdispatchColorTableHeader; /* ** Data that is specific to a glColorSubTable call ** The data is sent in the following order: ** Render or RenderLarge header ** Pixel header ** ColorTable header */ #define __GLX_COLOR_SUBTABLE_HDR \ CARD32 target B32; \ CARD32 start B32; \ CARD32 count B32; \ CARD32 format B32; \ CARD32 type B32 #define __GLX_COLOR_SUBTABLE_HDR_SIZE 20 #define __GLX_COLOR_SUBTABLE_CMD_HDR_SIZE \ (__GLX_RENDER_HDR_SIZE + __GLX_PIXEL_HDR_SIZE + \ __GLX_COLOR_SUBTABLE_HDR_SIZE) typedef struct { __GLX_RENDER_HDR; __GLX_PIXEL_HDR; __GLX_COLOR_SUBTABLE_HDR; } __GLXColorSubTableHeader; typedef struct { __GLX_RENDER_LARGE_HDR; __GLX_PIXEL_HDR; __GLX_COLOR_SUBTABLE_HDR; } __GLXColorSubTableLargeHeader; typedef struct { __GLX_PIXEL_HDR; __GLX_COLOR_SUBTABLE_HDR; } __GLXdispatchColorSubTableHeader; #define GLX_WINDOW_TYPE 1 #define GLX_PIXMAP_TYPE 2 #define GLX_VIDEO_SOURCE_TYPE 3 #define GLX_PBUFFER_TYPE 4 /* 5 is for DM_PBUFFER */ #define GLX_GLXWINDOW_TYPE 6 /*****************************************************************************/ /* ** Restore these definitions back to the typedefs in glx.h */ #undef GLXContextID #undef GLXPixmap #undef GLXDrawable #undef GLXPbuffer #undef GLXWindow #undef GLXFBConfigID #undef GLXFBConfigIDSGIX #undef GLXPbufferSGIX /* Opcodes for GLX commands */ #define X_GLXRender 1 #define X_GLXRenderLarge 2 #define X_GLXCreateContext 3 #define X_GLXDestroyContext 4 #define X_GLXMakeCurrent 5 #define X_GLXIsDirect 6 #define X_GLXQueryVersion 7 #define X_GLXWaitGL 8 #define X_GLXWaitX 9 #define X_GLXCopyContext 10 #define X_GLXSwapBuffers 11 #define X_GLXUseXFont 12 #define X_GLXCreateGLXPixmap 13 #define X_GLXGetVisualConfigs 14 #define X_GLXDestroyGLXPixmap 15 #define X_GLXVendorPrivate 16 #define X_GLXVendorPrivateWithReply 17 #define X_GLXQueryExtensionsString 18 #define X_GLXQueryServerString 19 #define X_GLXClientInfo 20 #define X_GLXGetFBConfigs 21 #define X_GLXCreatePixmap 22 #define X_GLXDestroyPixmap 23 #define X_GLXCreateNewContext 24 #define X_GLXQueryContext 25 #define X_GLXMakeContextCurrent 26 #define X_GLXCreatePbuffer 27 #define X_GLXDestroyPbuffer 28 #define X_GLXGetDrawableAttributes 29 #define X_GLXChangeDrawableAttributes 30 #define X_GLXCreateWindow 31 #define X_GLXDestroyWindow 32 /* Opcodes for single commands (part of GLX command space) */ #define X_GLsop_NewList 101 #define X_GLsop_EndList 102 #define X_GLsop_DeleteLists 103 #define X_GLsop_GenLists 104 #define X_GLsop_FeedbackBuffer 105 #define X_GLsop_SelectBuffer 106 #define X_GLsop_RenderMode 107 #define X_GLsop_Finish 108 #define X_GLsop_Flush 142 #define X_GLsop_PixelStoref 109 #define X_GLsop_PixelStorei 110 #define X_GLsop_ReadPixels 111 #define X_GLsop_GetBooleanv 112 #define X_GLsop_GetClipPlane 113 #define X_GLsop_GetDoublev 114 #define X_GLsop_GetError 115 #define X_GLsop_GetFloatv 116 #define X_GLsop_GetIntegerv 117 #define X_GLsop_GetLightfv 118 #define X_GLsop_GetLightiv 119 #define X_GLsop_GetMapdv 120 #define X_GLsop_GetMapfv 121 #define X_GLsop_GetMapiv 122 #define X_GLsop_GetMaterialfv 123 #define X_GLsop_GetMaterialiv 124 #define X_GLsop_GetPixelMapfv 125 #define X_GLsop_GetPixelMapuiv 126 #define X_GLsop_GetPixelMapusv 127 #define X_GLsop_GetPolygonStipple 128 #define X_GLsop_GetString 129 #define X_GLsop_GetTexEnvfv 130 #define X_GLsop_GetTexEnviv 131 #define X_GLsop_GetTexGendv 132 #define X_GLsop_GetTexGenfv 133 #define X_GLsop_GetTexGeniv 134 #define X_GLsop_GetTexImage 135 #define X_GLsop_GetTexParameterfv 136 #define X_GLsop_GetTexParameteriv 137 #define X_GLsop_GetTexLevelParameterfv 138 #define X_GLsop_GetTexLevelParameteriv 139 #define X_GLsop_IsEnabled 140 #define X_GLsop_IsList 141 #define X_GLsop_AreTexturesResident 143 #define X_GLsop_DeleteTextures 144 #define X_GLsop_GenTextures 145 #define X_GLsop_IsTexture 146 #define X_GLsop_GetColorTable 147 #define X_GLsop_GetColorTableParameterfv 148 #define X_GLsop_GetColorTableParameteriv 149 #define X_GLsop_GetConvolutionFilter 150 #define X_GLsop_GetConvolutionParameterfv 151 #define X_GLsop_GetConvolutionParameteriv 152 #define X_GLsop_GetSeparableFilter 153 #define X_GLsop_GetHistogram 154 #define X_GLsop_GetHistogramParameterfv 155 #define X_GLsop_GetHistogramParameteriv 156 #define X_GLsop_GetMinmax 157 #define X_GLsop_GetMinmaxParameterfv 158 #define X_GLsop_GetMinmaxParameteriv 159 #define X_GLsop_GetCompressedTexImage 160 /* Opcodes for rendering commands */ #define X_GLrop_CallList 1 #define X_GLrop_CallLists 2 #define X_GLrop_ListBase 3 #define X_GLrop_Begin 4 #define X_GLrop_Bitmap 5 #define X_GLrop_Color3bv 6 #define X_GLrop_Color3dv 7 #define X_GLrop_Color3fv 8 #define X_GLrop_Color3iv 9 #define X_GLrop_Color3sv 10 #define X_GLrop_Color3ubv 11 #define X_GLrop_Color3uiv 12 #define X_GLrop_Color3usv 13 #define X_GLrop_Color4bv 14 #define X_GLrop_Color4dv 15 #define X_GLrop_Color4fv 16 #define X_GLrop_Color4iv 17 #define X_GLrop_Color4sv 18 #define X_GLrop_Color4ubv 19 #define X_GLrop_Color4uiv 20 #define X_GLrop_Color4usv 21 #define X_GLrop_EdgeFlagv 22 #define X_GLrop_End 23 #define X_GLrop_Indexdv 24 #define X_GLrop_Indexfv 25 #define X_GLrop_Indexiv 26 #define X_GLrop_Indexsv 27 #define X_GLrop_Normal3bv 28 #define X_GLrop_Normal3dv 29 #define X_GLrop_Normal3fv 30 #define X_GLrop_Normal3iv 31 #define X_GLrop_Normal3sv 32 #define X_GLrop_RasterPos2dv 33 #define X_GLrop_RasterPos2fv 34 #define X_GLrop_RasterPos2iv 35 #define X_GLrop_RasterPos2sv 36 #define X_GLrop_RasterPos3dv 37 #define X_GLrop_RasterPos3fv 38 #define X_GLrop_RasterPos3iv 39 #define X_GLrop_RasterPos3sv 40 #define X_GLrop_RasterPos4dv 41 #define X_GLrop_RasterPos4fv 42 #define X_GLrop_RasterPos4iv 43 #define X_GLrop_RasterPos4sv 44 #define X_GLrop_Rectdv 45 #define X_GLrop_Rectfv 46 #define X_GLrop_Rectiv 47 #define X_GLrop_Rectsv 48 #define X_GLrop_TexCoord1dv 49 #define X_GLrop_TexCoord1fv 50 #define X_GLrop_TexCoord1iv 51 #define X_GLrop_TexCoord1sv 52 #define X_GLrop_TexCoord2dv 53 #define X_GLrop_TexCoord2fv 54 #define X_GLrop_TexCoord2iv 55 #define X_GLrop_TexCoord2sv 56 #define X_GLrop_TexCoord3dv 57 #define X_GLrop_TexCoord3fv 58 #define X_GLrop_TexCoord3iv 59 #define X_GLrop_TexCoord3sv 60 #define X_GLrop_TexCoord4dv 61 #define X_GLrop_TexCoord4fv 62 #define X_GLrop_TexCoord4iv 63 #define X_GLrop_TexCoord4sv 64 #define X_GLrop_Vertex2dv 65 #define X_GLrop_Vertex2fv 66 #define X_GLrop_Vertex2iv 67 #define X_GLrop_Vertex2sv 68 #define X_GLrop_Vertex3dv 69 #define X_GLrop_Vertex3fv 70 #define X_GLrop_Vertex3iv 71 #define X_GLrop_Vertex3sv 72 #define X_GLrop_Vertex4dv 73 #define X_GLrop_Vertex4fv 74 #define X_GLrop_Vertex4iv 75 #define X_GLrop_Vertex4sv 76 #define X_GLrop_ClipPlane 77 #define X_GLrop_ColorMaterial 78 #define X_GLrop_CullFace 79 #define X_GLrop_Fogf 80 #define X_GLrop_Fogfv 81 #define X_GLrop_Fogi 82 #define X_GLrop_Fogiv 83 #define X_GLrop_FrontFace 84 #define X_GLrop_Hint 85 #define X_GLrop_Lightf 86 #define X_GLrop_Lightfv 87 #define X_GLrop_Lighti 88 #define X_GLrop_Lightiv 89 #define X_GLrop_LightModelf 90 #define X_GLrop_LightModelfv 91 #define X_GLrop_LightModeli 92 #define X_GLrop_LightModeliv 93 #define X_GLrop_LineStipple 94 #define X_GLrop_LineWidth 95 #define X_GLrop_Materialf 96 #define X_GLrop_Materialfv 97 #define X_GLrop_Materiali 98 #define X_GLrop_Materialiv 99 #define X_GLrop_PointSize 100 #define X_GLrop_PolygonMode 101 #define X_GLrop_PolygonStipple 102 #define X_GLrop_Scissor 103 #define X_GLrop_ShadeModel 104 #define X_GLrop_TexParameterf 105 #define X_GLrop_TexParameterfv 106 #define X_GLrop_TexParameteri 107 #define X_GLrop_TexParameteriv 108 #define X_GLrop_TexImage1D 109 #define X_GLrop_TexImage2D 110 #define X_GLrop_TexEnvf 111 #define X_GLrop_TexEnvfv 112 #define X_GLrop_TexEnvi 113 #define X_GLrop_TexEnviv 114 #define X_GLrop_TexGend 115 #define X_GLrop_TexGendv 116 #define X_GLrop_TexGenf 117 #define X_GLrop_TexGenfv 118 #define X_GLrop_TexGeni 119 #define X_GLrop_TexGeniv 120 #define X_GLrop_InitNames 121 #define X_GLrop_LoadName 122 #define X_GLrop_PassThrough 123 #define X_GLrop_PopName 124 #define X_GLrop_PushName 125 #define X_GLrop_DrawBuffer 126 #define X_GLrop_Clear 127 #define X_GLrop_ClearAccum 128 #define X_GLrop_ClearIndex 129 #define X_GLrop_ClearColor 130 #define X_GLrop_ClearStencil 131 #define X_GLrop_ClearDepth 132 #define X_GLrop_StencilMask 133 #define X_GLrop_ColorMask 134 #define X_GLrop_DepthMask 135 #define X_GLrop_IndexMask 136 #define X_GLrop_Accum 137 #define X_GLrop_Disable 138 #define X_GLrop_Enable 139 #define X_GLrop_PopAttrib 141 #define X_GLrop_PushAttrib 142 #define X_GLrop_Map1d 143 #define X_GLrop_Map1f 144 #define X_GLrop_Map2d 145 #define X_GLrop_Map2f 146 #define X_GLrop_MapGrid1d 147 #define X_GLrop_MapGrid1f 148 #define X_GLrop_MapGrid2d 149 #define X_GLrop_MapGrid2f 150 #define X_GLrop_EvalCoord1dv 151 #define X_GLrop_EvalCoord1fv 152 #define X_GLrop_EvalCoord2dv 153 #define X_GLrop_EvalCoord2fv 154 #define X_GLrop_EvalMesh1 155 #define X_GLrop_EvalPoint1 156 #define X_GLrop_EvalMesh2 157 #define X_GLrop_EvalPoint2 158 #define X_GLrop_AlphaFunc 159 #define X_GLrop_BlendFunc 160 #define X_GLrop_LogicOp 161 #define X_GLrop_StencilFunc 162 #define X_GLrop_StencilOp 163 #define X_GLrop_DepthFunc 164 #define X_GLrop_PixelZoom 165 #define X_GLrop_PixelTransferf 166 #define X_GLrop_PixelTransferi 167 #define X_GLrop_PixelMapfv 168 #define X_GLrop_PixelMapuiv 169 #define X_GLrop_PixelMapusv 170 #define X_GLrop_ReadBuffer 171 #define X_GLrop_CopyPixels 172 #define X_GLrop_DrawPixels 173 #define X_GLrop_DepthRange 174 #define X_GLrop_Frustum 175 #define X_GLrop_LoadIdentity 176 #define X_GLrop_LoadMatrixf 177 #define X_GLrop_LoadMatrixd 178 #define X_GLrop_MatrixMode 179 #define X_GLrop_MultMatrixf 180 #define X_GLrop_MultMatrixd 181 #define X_GLrop_Ortho 182 #define X_GLrop_PopMatrix 183 #define X_GLrop_PushMatrix 184 #define X_GLrop_Rotated 185 #define X_GLrop_Rotatef 186 #define X_GLrop_Scaled 187 #define X_GLrop_Scalef 188 #define X_GLrop_Translated 189 #define X_GLrop_Translatef 190 #define X_GLrop_Viewport 191 #define X_GLrop_DrawArrays 193 #define X_GLrop_PolygonOffset 192 #define X_GLrop_CopyTexImage1D 4119 #define X_GLrop_CopyTexImage2D 4120 #define X_GLrop_CopyTexSubImage1D 4121 #define X_GLrop_CopyTexSubImage2D 4122 #define X_GLrop_TexSubImage1D 4099 #define X_GLrop_TexSubImage2D 4100 #define X_GLrop_BindTexture 4117 #define X_GLrop_PrioritizeTextures 4118 #define X_GLrop_Indexubv 194 #define X_GLrop_BlendColor 4096 #define X_GLrop_BlendEquation 4097 #define X_GLrop_ColorTable 2053 #define X_GLrop_ColorTableParameterfv 2054 #define X_GLrop_ColorTableParameteriv 2055 #define X_GLrop_CopyColorTable 2056 #define X_GLrop_ColorSubTable 195 #define X_GLrop_CopyColorSubTable 196 #define X_GLrop_ConvolutionFilter1D 4101 #define X_GLrop_ConvolutionFilter2D 4102 #define X_GLrop_ConvolutionParameterf 4103 #define X_GLrop_ConvolutionParameterfv 4104 #define X_GLrop_ConvolutionParameteri 4105 #define X_GLrop_ConvolutionParameteriv 4106 #define X_GLrop_CopyConvolutionFilter1D 4107 #define X_GLrop_CopyConvolutionFilter2D 4108 #define X_GLrop_SeparableFilter2D 4109 #define X_GLrop_Histogram 4110 #define X_GLrop_Minmax 4111 #define X_GLrop_ResetHistogram 4112 #define X_GLrop_ResetMinmax 4113 #define X_GLrop_TexImage3D 4114 #define X_GLrop_TexSubImage3D 4115 #define X_GLrop_CopyTexSubImage3D 4123 #define X_GLrop_DrawArraysEXT 4116 /* Added for core GL version 1.3 */ #define X_GLrop_ActiveTextureARB 197 #define X_GLrop_MultiTexCoord1dvARB 198 #define X_GLrop_MultiTexCoord1fvARB 199 #define X_GLrop_MultiTexCoord1ivARB 200 #define X_GLrop_MultiTexCoord1svARB 201 #define X_GLrop_MultiTexCoord2dvARB 202 #define X_GLrop_MultiTexCoord2fvARB 203 #define X_GLrop_MultiTexCoord2ivARB 204 #define X_GLrop_MultiTexCoord2svARB 205 #define X_GLrop_MultiTexCoord3dvARB 206 #define X_GLrop_MultiTexCoord3fvARB 207 #define X_GLrop_MultiTexCoord3ivARB 208 #define X_GLrop_MultiTexCoord3svARB 209 #define X_GLrop_MultiTexCoord4dvARB 210 #define X_GLrop_MultiTexCoord4fvARB 211 #define X_GLrop_MultiTexCoord4ivARB 212 #define X_GLrop_MultiTexCoord4svARB 213 #define X_GLrop_CompressedTexImage1D 214 #define X_GLrop_CompressedTexImage2D 215 #define X_GLrop_CompressedTexImage3D 216 #define X_GLrop_CompressedTexSubImage1D 217 #define X_GLrop_CompressedTexSubImage2D 218 #define X_GLrop_CompressedTexSubImage3D 219 #define X_GLrop_SampleCoverageARB 229 /* Added for core GL version 1.4 */ #define X_GLrop_WindowPos3fARB 230 #define X_GLrop_FogCoordfv 4124 #define X_GLrop_FogCoorddv 4125 #define X_GLrop_PointParameterfARB 2065 #define X_GLrop_PointParameterfvARB 2066 #define X_GLrop_SecondaryColor3bv 4126 #define X_GLrop_SecondaryColor3sv 4127 #define X_GLrop_SecondaryColor3iv 4128 #define X_GLrop_SecondaryColor3fv 4129 #define X_GLrop_SecondaryColor3dv 4130 #define X_GLrop_SecondaryColor3ubv 4131 #define X_GLrop_SecondaryColor3usv 4132 #define X_GLrop_SecondaryColor3uiv 4133 #define X_GLrop_BlendFuncSeparate 4134 #define X_GLrop_PointParameteri 4221 #define X_GLrop_PointParameteriv 4222 /* Added for core GL version 1.5 */ /* XXX opcodes not defined in the spec */ /* Opcodes for Vendor Private commands */ #define X_GLvop_GetConvolutionFilterEXT 1 #define X_GLvop_GetConvolutionParameterfvEXT 2 #define X_GLvop_GetConvolutionParameterivEXT 3 #define X_GLvop_GetSeparableFilterEXT 4 #define X_GLvop_GetHistogramEXT 5 #define X_GLvop_GetHistogramParameterfvEXT 6 #define X_GLvop_GetHistogramParameterivEXT 7 #define X_GLvop_GetMinmaxEXT 8 #define X_GLvop_GetMinmaxParameterfvEXT 9 #define X_GLvop_GetMinmaxParameterivEXT 10 #define X_GLvop_AreTexturesResidentEXT 11 #define X_GLvop_DeleteTexturesEXT 12 #define X_GLvop_GenTexturesEXT 13 #define X_GLvop_IsTextureEXT 14 #define X_GLvop_GetCombinerInputParameterfvNV 1270 #define X_GLvop_GetCombinerInputParameterivNV 1271 #define X_GLvop_GetCombinerOutputParameterfvNV 1272 #define X_GLvop_GetCombinerOutputParameterivNV 1273 #define X_GLvop_GetFinalCombinerOutputParameterfvNV 1274 #define X_GLvop_GetFinalCombinerOutputParameterivNV 1275 #define X_GLvop_DeleteFenceNV 1276 #define X_GLvop_GenFencesNV 1277 #define X_GLvop_IsFenceNV 1278 #define X_GLvop_TestFenceNV 1279 #define X_GLvop_GetFenceivNV 1280 #define X_GLvop_AreProgramsResidentNV 1293 #define X_GLvop_DeleteProgramARB 1294 #define X_GLvop_GenProgramsARB 1295 #define X_GLvop_GetProgramEnvParameterfvARB 1296 #define X_GLvop_GetProgramEnvParameterdvARB 1297 #define X_GLvop_GetProgramEnvParameterivNV 1298 #define X_GLvop_GetProgramStringNV 1299 #define X_GLvop_GetTrackMatrixivNV 1300 #define X_GLvop_GetVetrexAttribdvARB 1301 #define X_GLvop_GetVetrexAttribfvARB 1302 #define X_GLvop_GetVetrexAttribivARB 1303 #define X_GLvop_IsProgramARB 1304 #define X_GLvop_GetProgramLocalParameterfvARB 1305 #define X_GLvop_GetProgramLocalParameterdvARB 1306 #define X_GLvop_GetProgramivARB 1307 #define X_GLvop_GetProgramStringARB 1308 #define X_GLvop_GetProgramNamedParameter4fvNV 1310 #define X_GLvop_GetProgramNamedParameter4dvNV 1311 #define X_GLvop_SampleMaskSGIS 2048 #define X_GLvop_SamplePatternSGIS 2049 #define X_GLvop_GetDetailTexFuncSGIS 4096 #define X_GLvop_GetSharpenTexFuncSGIS 4097 #define X_GLvop_GetColorTableSGI 4098 #define X_GLvop_GetColorTableParameterfvSGI 4099 #define X_GLvop_GetColorTableParameterivSGI 4100 #define X_GLvop_GetTexFilterFuncSGIS 4101 #define X_GLvop_GetInstrumentsSGIX 4102 #define X_GLvop_InstrumentsBufferSGIX 4103 #define X_GLvop_PollInstrumentsSGIX 4104 #define X_GLvop_FlushRasterSGIX 4105 /* Opcodes for GLX vendor private commands */ #define X_GLXvop_QueryContextInfoEXT 1024 #define X_GLXvop_SwapIntervalSGI 65536 #define X_GLXvop_MakeCurrentReadSGI 65537 #define X_GLXvop_CreateGLXVideoSourceSGIX 65538 #define X_GLXvop_DestroyGLXVideoSourceSGIX 65539 #define X_GLXvop_GetFBConfigsSGIX 65540 #define X_GLXvop_CreateContextWithConfigSGIX 65541 #define X_GLXvop_CreateGLXPixmapWithConfigSGIX 65542 #define X_GLXvop_CreateGLXPbufferSGIX 65543 #define X_GLXvop_DestroyGLXPbufferSGIX 65544 #define X_GLXvop_ChangeDrawableAttributesSGIX 65545 #define X_GLXvop_GetDrawableAttributesSGIX 65546 #define X_GLXvop_JoinSwapGroupSGIX 65547 #define X_GLXvop_BindSwapBarrierSGIX 65548 #define X_GLXvop_QueryMaxSwapBarriersSGIX 65549 #define X_GLXvop_QueryHyperpipeNetworkSGIX 65550 #define X_GLXvop_QueryHyperpipeConfigSGIX 65551 #define X_GLXvop_HyperpipeConfigSGIX 65552 #define X_GLXvop_DestroyHyperpipeConfigSGIX 65553 /* ARB extension opcodes */ /* 1. GL_ARB_multitexture - see GL 1.2 opcodes */ /* 5. GL_ARB_multisample - see GL 1.3 opcodes */ /* 12. GL_ARB_texture_compression - see GL 1.3 opcodes */ /* 14. GL_ARB_point_parameters - see GL 1.4 opcodees */ /* 15. GL_ARB_vertex_blend */ #define X_GLrop_WeightbvARB 220 #define X_GLrop_WeightubvARB 221 #define X_GLrop_WeightsvARB 222 #define X_GLrop_WeightusvARB 223 #define X_GLrop_WeightivARB 224 #define X_GLrop_WeightuivARB 225 #define X_GLrop_VertexBlendARB 226 #define X_GLrop_WeightfvARB 227 #define X_GLrop_WeightdvARB 228 /* 16. GL_ARB_matrix_palette */ /* XXX opcodes not defined in the spec */ /* 25. GL_ARB_window_pos - see GL 1.4 opcodes */ /* 26. GL_ARB_vertex_program */ #define X_GLrop_BindProgramARB 4180 #define X_GLrop_ProgramEnvParameter4fvARB 4184 #define X_GLrop_ProgramEnvParameter4dvARB 4185 #define X_GLrop_VertexAttrib1svARB 4189 #define X_GLrop_VertexAttrib2svARB 4190 #define X_GLrop_VertexAttrib3svARB 4191 #define X_GLrop_VertexAttrib4svARB 4192 #define X_GLrop_VertexAttrib1fvARB 4193 #define X_GLrop_VertexAttrib2fvARB 4194 #define X_GLrop_VertexAttrib3fvARB 4195 #define X_GLrop_VertexAttrib4fvARB 4196 #define X_GLrop_VertexAttrib1dvARB 4197 #define X_GLrop_VertexAttrib2dvARB 4198 #define X_GLrop_VertexAttrib3dvARB 4199 #define X_GLrop_ProgramLocalParameter4fvARB 4215 #define X_GLrop_ProgramLocalParameter4dvARB 4216 #define X_GLrop_ProgramStringARB 4217 #define X_GLrop_VertexAttrib4dvARB 4200 #define X_GLrop_VertexAttrib4NubvARB 4201 #define X_GLrop_VertexAttrib4bvARB 4230 #define X_GLrop_VertexAttrib4ivARB 4231 #define X_GLrop_VertexAttrib4ubvARB 4232 #define X_GLrop_VertexAttrib4usvARB 4233 #define X_GLrop_VertexAttrib4uivARB 4234 #define X_GLrop_VertexAttrib4NbvARB 4235 #define X_GLrop_VertexAttrib4NsvARB 4236 #define X_GLrop_VertexAttrib4NivARB 4237 #define X_GLrop_VertexAttrib4NusvARB 4238 #define X_GLrop_VertexAttrib4NuivARB 4239 /* 27. GL_ARB_fragment_program - see GL_ARB_vertex_program opcodes */ /* 29. GL_ARB_occlusion_query */ /* XXX opcodes not defined in the spec */ /* New extension opcodes */ /* 145. GL_EXT_secondary_color - see GL 1.4 opcodes */ /* 188. GL_EXT_vertex_weighting */ #define X_GLrop_VertexWeightfvEXT 4135 /* 191. GL_NV_register_combiners */ #define X_GLrop_CombinerParameterfNV 4136 #define X_GLrop_CombinerParameterfvNV 4137 #define X_GLrop_CombinerParameteriNV 4138 #define X_GLrop_CombinerParameterivNV 4139 #define X_GLrop_CombinerInputNV 4140 #define X_GLrop_CombinerOutputNV 4141 #define X_GLrop_FinalCombinerInputNV 4142 /* 222. GL_NV_fence */ #define X_GLrop_SetFenceNV 4143 #define X_GLrop_FinishFenceNV 4144 /* 227. GL_NV_register_combiners2 */ /* XXX opcodes not defined in the spec */ /* 233. GL_NV_vertex_program - see also GL_ARB_vertex_program opcodes */ #define X_GLrop_ExecuteProgramNV 4181 #define X_GLrop_RequestResidentProgramsNV 4182 #define X_GLrop_LoadProgamNV 4183 #define X_GLrop_ProgramParameters4fvNV 4186 #define X_GLrop_ProgramParameters4dvNV 4187 #define X_GLrop_TrackMatrixNV 4188 #define X_GLrop_VertexAttribs1svNV 4202 #define X_GLrop_VertexAttribs2svNV 4203 #define X_GLrop_VertexAttribs3svNV 4204 #define X_GLrop_VertexAttribs4svNV 4205 #define X_GLrop_VertexAttribs1fvNV 4206 #define X_GLrop_VertexAttribs2fvNV 4207 #define X_GLrop_VertexAttribs3fvNV 4208 #define X_GLrop_VertexAttribs4fvNV 4209 #define X_GLrop_VertexAttribs1dvNV 4210 #define X_GLrop_VertexAttribs2dvNV 4211 #define X_GLrop_VertexAttribs3dvNV 4212 #define X_GLrop_VertexAttribs4dvNV 4213 #define X_GLrop_VertexAttribs4ubvNV 4214 /* 261. GL_NV_occlusion_query */ /* XXX opcodes not defined in the spec */ /* 262. GL_NV_point_sprite - see GL 1.4 opcodes */ /* 268. GL_EXT_stencil_two_side */ #define X_GLrop_ActiveStencilFaceEXT 4220 /* 282. GL_NV_fragment_program - see also GL_NV_vertex_program and GL_ARB_vertex_program opcodes */ #define X_GLrop_ProgramNamedParameter4fvNV 4218 #define X_GLrop_ProgramNamedParameter4dvNV 4219 /* 285. GL_NV_primitive_restart */ /* XXX opcodes not defined in the spec */ /* 297. GL_EXT_depth_bounds_test */ #define X_GLrop_DepthBoundsEXT 4229 /* 299. GL_EXT_blend_equation_separate */ #define X_GLrop_BlendEquationSeparateEXT 4228 #endif /* _GLX_glxproto_h_ */ nx-libs-3.5.99.23/nx-X11/include/GL/glxtokens.h0000644000000000000000000002113613614532331015422 0ustar #ifndef __GLX_glxtokens_h__ #define __GLX_glxtokens_h__ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. */ #ifdef __cplusplus extern "C" { #endif #define GLX_VERSION_1_1 1 #define GLX_VERSION_1_2 1 #define GLX_VERSION_1_3 1 #define GLX_VERSION_1_4 1 /* ** Visual Config Attributes (glXGetConfig, glXGetFBConfigAttrib) */ #define GLX_USE_GL 1 /* support GLX rendering */ #define GLX_BUFFER_SIZE 2 /* depth of the color buffer */ #define GLX_LEVEL 3 /* level in plane stacking */ #define GLX_RGBA 4 /* true if RGBA mode */ #define GLX_DOUBLEBUFFER 5 /* double buffering supported */ #define GLX_STEREO 6 /* stereo buffering supported */ #define GLX_AUX_BUFFERS 7 /* number of aux buffers */ #define GLX_RED_SIZE 8 /* number of red component bits */ #define GLX_GREEN_SIZE 9 /* number of green component bits */ #define GLX_BLUE_SIZE 10 /* number of blue component bits */ #define GLX_ALPHA_SIZE 11 /* number of alpha component bits */ #define GLX_DEPTH_SIZE 12 /* number of depth bits */ #define GLX_STENCIL_SIZE 13 /* number of stencil bits */ #define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */ #define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */ #define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */ #define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */ /* ** FBConfig-specific attributes */ #define GLX_X_VISUAL_TYPE 0x22 #define GLX_CONFIG_CAVEAT 0x20 /* Like visual_info VISUAL_CAVEAT_EXT */ #define GLX_TRANSPARENT_TYPE 0x23 #define GLX_TRANSPARENT_INDEX_VALUE 0x24 #define GLX_TRANSPARENT_RED_VALUE 0x25 #define GLX_TRANSPARENT_GREEN_VALUE 0x26 #define GLX_TRANSPARENT_BLUE_VALUE 0x27 #define GLX_TRANSPARENT_ALPHA_VALUE 0x28 #define GLX_DRAWABLE_TYPE 0x8010 #define GLX_RENDER_TYPE 0x8011 #define GLX_X_RENDERABLE 0x8012 #define GLX_FBCONFIG_ID 0x8013 #define GLX_MAX_PBUFFER_WIDTH 0x8016 #define GLX_MAX_PBUFFER_HEIGHT 0x8017 #define GLX_MAX_PBUFFER_PIXELS 0x8018 #define GLX_VISUAL_ID 0x800B /* FBConfigSGIX Attributes */ #define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 #define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A /* ** Error return values from glXGetConfig. Success is indicated by ** a value of 0. */ #define GLX_BAD_SCREEN 1 /* screen # is bad */ #define GLX_BAD_ATTRIBUTE 2 /* attribute to get is bad */ #define GLX_NO_EXTENSION 3 /* no glx extension on server */ #define GLX_BAD_VISUAL 4 /* visual # not known by GLX */ #define GLX_BAD_CONTEXT 5 /* returned only by import_context EXT? */ #define GLX_BAD_VALUE 6 /* returned only by glXSwapIntervalSGI? */ #define GLX_BAD_ENUM 7 /* unused? */ /* FBConfig attribute values */ /* ** Generic "don't care" value for glX ChooseFBConfig attributes (except ** GLX_LEVEL) */ #define GLX_DONT_CARE 0xFFFFFFFF /* GLX_RENDER_TYPE bits */ #define GLX_RGBA_BIT 0x00000001 #define GLX_COLOR_INDEX_BIT 0x00000002 /* GLX_DRAWABLE_TYPE bits */ #define GLX_WINDOW_BIT 0x00000001 #define GLX_PIXMAP_BIT 0x00000002 #define GLX_PBUFFER_BIT 0x00000004 /* GLX_CONFIG_CAVEAT attribute values */ #define GLX_NONE 0x8000 #define GLX_SLOW_CONFIG 0x8001 #define GLX_NON_CONFORMANT_CONFIG 0x800D /* GLX_X_VISUAL_TYPE attribute values */ #define GLX_TRUE_COLOR 0x8002 #define GLX_DIRECT_COLOR 0x8003 #define GLX_PSEUDO_COLOR 0x8004 #define GLX_STATIC_COLOR 0x8005 #define GLX_GRAY_SCALE 0x8006 #define GLX_STATIC_GRAY 0x8007 /* GLX_TRANSPARENT_TYPE attribute values */ /* #define GLX_NONE 0x8000 */ #define GLX_TRANSPARENT_RGB 0x8008 #define GLX_TRANSPARENT_INDEX 0x8009 /* glXCreateGLXPbuffer attributes */ #define GLX_PRESERVED_CONTENTS 0x801B #define GLX_LARGEST_PBUFFER 0x801C #define GLX_PBUFFER_HEIGHT 0x8040 /* New for GLX 1.3 */ #define GLX_PBUFFER_WIDTH 0x8041 /* New for GLX 1.3 */ /* glXQueryGLXPBuffer attributes */ #define GLX_WIDTH 0x801D #define GLX_HEIGHT 0x801E #define GLX_EVENT_MASK 0x801F /* glXCreateNewContext render_type attribute values */ #define GLX_RGBA_TYPE 0x8014 #define GLX_COLOR_INDEX_TYPE 0x8015 /* glXQueryContext attributes */ /* #define GLX_FBCONFIG_ID 0x8013 */ /* #define GLX_RENDER_TYPE 0x8011 */ #define GLX_SCREEN 0x800C /* glXSelectEvent event mask bits */ #define GLX_PBUFFER_CLOBBER_MASK 0x08000000 /* GLXPbufferClobberEvent event_type values */ #define GLX_DAMAGED 0x8020 #define GLX_SAVED 0x8021 /* GLXPbufferClobberEvent draw_type values */ #define GLX_WINDOW 0x8022 #define GLX_PBUFFER 0x8023 /* GLXPbufferClobberEvent buffer_mask bits */ #define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 #define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 #define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 #define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 #define GLX_AUX_BUFFERS_BIT 0x00000010 #define GLX_DEPTH_BUFFER_BIT 0x00000020 #define GLX_STENCIL_BUFFER_BIT 0x00000040 #define GLX_ACCUM_BUFFER_BIT 0x00000080 /* ** Extension return values from glXGetConfig. These are also ** accepted as parameter values for glXChooseVisual. */ #define GLX_X_VISUAL_TYPE_EXT 0x22 /* visual_info extension type */ #define GLX_TRANSPARENT_TYPE_EXT 0x23 /* visual_info extension */ #define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 /* visual_info extension */ #define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 /* visual_info extension */ #define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 /* visual_info extension */ #define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 /* visual_info extension */ #define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 /* visual_info extension */ /* Property values for visual_type */ #define GLX_TRUE_COLOR_EXT 0x8002 #define GLX_DIRECT_COLOR_EXT 0x8003 #define GLX_PSEUDO_COLOR_EXT 0x8004 #define GLX_STATIC_COLOR_EXT 0x8005 #define GLX_GRAY_SCALE_EXT 0x8006 #define GLX_STATIC_GRAY_EXT 0x8007 /* Property values for transparent pixel */ #define GLX_NONE_EXT 0x8000 #define GLX_TRANSPARENT_RGB_EXT 0x8008 #define GLX_TRANSPARENT_INDEX_EXT 0x8009 /* Property values for visual_rating */ #define GLX_VISUAL_CAVEAT_EXT 0x20 /* visual_rating extension type */ #define GLX_SLOW_VISUAL_EXT 0x8001 #define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D /* Property values for swap method (GLX_OML_swap_method) */ #define GLX_SWAP_METHOD_OML 0x8060 #define GLX_SWAP_EXCHANGE_OML 0x8061 #define GLX_SWAP_COPY_OML 0x8062 #define GLX_SWAP_UNDEFINED_OML 0x8063 /* Property values for multi-sampling */ #define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 /* visuals grouped by select priority */ /* ** Names for attributes to glXGetClientString. */ #define GLX_VENDOR 0x1 #define GLX_VERSION 0x2 #define GLX_EXTENSIONS 0x3 /* ** Names for attributes to glXQueryContextInfoEXT. */ #define GLX_SHARE_CONTEXT_EXT 0x800A /* id of share context */ #define GLX_VISUAL_ID_EXT 0x800B /* id of context's visual */ #define GLX_SCREEN_EXT 0x800C /* screen number */ /* * GLX 1.4 and later: */ #define GLX_SAMPLE_BUFFERS_SGIS 100000 #define GLX_SAMPLES_SGIS 100001 #ifdef __cplusplus } #endif #endif /* !__GLX_glxtokens_h__ */ nx-libs-3.5.99.23/nx-X11/include/GL/Imakefile0000644000000000000000000000105613614532331015043 0ustar LinkSourceFile(gl.h, $(MESASRCDIR)/include/GL) LinkSourceFile(glext.h, $(MESASRCDIR)/include/GL) LinkSourceFile(glxext.h, $(MESASRCDIR)/include/GL) LinkSourceFile(osmesa.h, $(MESASRCDIR)/include/GL) GLXHEADERS = gl.h glext.h glx.h glxint.h glxmd.h glxproto.h \ glxtokens.h osmesa.h glxext.h HEADERS = $(GLXHEADERS) all:: BuildIncludes($(HEADERS),GL,..) InstallMultipleFlags($(HEADERS),$(INCDIR)/GL,$(INSTINCFLAGS)) InstallDriverSDKNonExecFile(glxint.h,$(DRIVERSDKINCLUDEDIR)/GL) InstallDriverSDKNonExecFile(glxtokens.h,$(DRIVERSDKINCLUDEDIR)/GL) nx-libs-3.5.99.23/nx-X11/include/HPkeysym.h0000644000000000000000000001363413614532331014657 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Hewlett Packard or Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or direct, indirect, special, incidental or consequential damages in connection with the furnishing, performance, or use of this material. */ #ifndef _HPKEYSYM_H #define _HPKEYSYM #define hpXK_ClearLine 0x1000FF6F #define hpXK_InsertLine 0x1000FF70 #define hpXK_DeleteLine 0x1000FF71 #define hpXK_InsertChar 0x1000FF72 #define hpXK_DeleteChar 0x1000FF73 #define hpXK_BackTab 0x1000FF74 #define hpXK_KP_BackTab 0x1000FF75 #define hpXK_Modelock1 0x1000FF48 #define hpXK_Modelock2 0x1000FF49 #define hpXK_Reset 0x1000FF6C #define hpXK_System 0x1000FF6D #define hpXK_User 0x1000FF6E #define hpXK_mute_acute 0x100000A8 #define hpXK_mute_grave 0x100000A9 #define hpXK_mute_asciicircum 0x100000AA #define hpXK_mute_diaeresis 0x100000AB #define hpXK_mute_asciitilde 0x100000AC #define hpXK_lira 0x100000AF #define hpXK_guilder 0x100000BE #define hpXK_Ydiaeresis 0x100000EE #define hpXK_IO 0x100000EE #define hpXK_longminus 0x100000F6 #define hpXK_block 0x100000FC #ifndef _OSF_Keysyms #define _OSF_Keysyms #define osfXK_Copy 0x1004FF02 #define osfXK_Cut 0x1004FF03 #define osfXK_Paste 0x1004FF04 #define osfXK_BackTab 0x1004FF07 #define osfXK_BackSpace 0x1004FF08 #define osfXK_Clear 0x1004FF0B #define osfXK_Escape 0x1004FF1B #define osfXK_AddMode 0x1004FF31 #define osfXK_PrimaryPaste 0x1004FF32 #define osfXK_QuickPaste 0x1004FF33 #define osfXK_PageLeft 0x1004FF40 #define osfXK_PageUp 0x1004FF41 #define osfXK_PageDown 0x1004FF42 #define osfXK_PageRight 0x1004FF43 #define osfXK_Activate 0x1004FF44 #define osfXK_MenuBar 0x1004FF45 #define osfXK_Left 0x1004FF51 #define osfXK_Up 0x1004FF52 #define osfXK_Right 0x1004FF53 #define osfXK_Down 0x1004FF54 #define osfXK_EndLine 0x1004FF57 #define osfXK_BeginLine 0x1004FF58 #define osfXK_EndData 0x1004FF59 #define osfXK_BeginData 0x1004FF5A #define osfXK_PrevMenu 0x1004FF5B #define osfXK_NextMenu 0x1004FF5C #define osfXK_PrevField 0x1004FF5D #define osfXK_NextField 0x1004FF5E #define osfXK_Select 0x1004FF60 #define osfXK_Insert 0x1004FF63 #define osfXK_Undo 0x1004FF65 #define osfXK_Menu 0x1004FF67 #define osfXK_Cancel 0x1004FF69 #define osfXK_Help 0x1004FF6A #define osfXK_SelectAll 0x1004FF71 #define osfXK_DeselectAll 0x1004FF72 #define osfXK_Reselect 0x1004FF73 #define osfXK_Extend 0x1004FF74 #define osfXK_Restore 0x1004FF78 #define osfXK_Delete 0x1004FFFF #endif /* _OSF_Keysyms */ /************************************************************** * The use of the following macros is deprecated. * They are listed below only for backwards compatibility. */ #define XK_Reset 0x1000FF6C #define XK_System 0x1000FF6D #define XK_User 0x1000FF6E #define XK_ClearLine 0x1000FF6F #define XK_InsertLine 0x1000FF70 #define XK_DeleteLine 0x1000FF71 #define XK_InsertChar 0x1000FF72 #define XK_DeleteChar 0x1000FF73 #define XK_BackTab 0x1000FF74 #define XK_KP_BackTab 0x1000FF75 #define XK_Ext16bit_L 0x1000FF76 #define XK_Ext16bit_R 0x1000FF77 #define XK_mute_acute 0x100000a8 #define XK_mute_grave 0x100000a9 #define XK_mute_asciicircum 0x100000aa #define XK_mute_diaeresis 0x100000ab #define XK_mute_asciitilde 0x100000ac #define XK_lira 0x100000af #define XK_guilder 0x100000be #ifndef XK_Ydiaeresis #define XK_Ydiaeresis 0x100000ee #endif #define XK_IO 0x100000ee #define XK_longminus 0x100000f6 #define XK_block 0x100000fc #endif /* _HPKEYSYM_H */ nx-libs-3.5.99.23/nx-X11/include/Imakefile0000644000000000000000000000410413614532331014536 0ustar NULL = #define IHaveSubdirs #define PassCDebugFlags /**/ #if BuildGlxExt GLXDIR = GL #endif SUBDIRS = extensions $(GLXDIR) AU_HEADERS = Xauth.h #ifdef Win32Architecture EXTRA_HEADERS = Xw32defs.h Xwinsock.h Xwindows.h #elif defined(cygwinArchitecture) EXTRA_HEADERS = Xwindows.h #endif HEADERS = \ DECkeysym.h \ HPkeysym.h \ Sunkeysym.h \ X.h \ XF86keysym.h \ XWDFile.h \ Xalloca.h \ Xarch.h \ Xatom.h \ Xdefs.h \ Xfuncproto.h \ Xfuncs.h \ Xmd.h \ Xos.h \ Xos_r.h \ Xosdefs.h \ Xpoll.h \ Xproto.h \ Xprotostr.h \ Xthreads.h \ keysym.h \ keysymdef.h \ $(AU_HEADERS) \ $(EXTRA_HEADERS) \ $(NULL) all:: BuildIncludes($(HEADERS),nx-X11,..) includes:: -$(RM) $(BUILDINCDIR)/X11 -$(LN) nx-X11 $(BUILDINCDIR)/X11 #if BuildLibraries InstallMultipleFlags($(HEADERS),$(INCDIR)/nx-X11,$(INSTINCFLAGS)) #endif MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) InstallDriverSDKNonExecFile(X.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xalloca.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xarch.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xdefs.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xdefs.h,$(DRIVERSDKINCLUDEDIR)/X11) InstallDriverSDKNonExecFile(Xfuncproto.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xfuncs.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xmd.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xosdefs.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xproto.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xprotostr.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(keysym.h,$(DRIVERSDKINCLUDEDIR)) /* _XOPEN_SOURCE is defined where needed to move __fds_bits to fds_bits. */ USE_FDS_BITS = fds_bits Xpoll.h: Xpoll.h.in sed -e "s/@USE_FDS_BITS@/$(USE_FDS_BITS)/;" < Xpoll.h.in > Xpoll.h clean:: -$(RM) Xpoll.h XCOMM For the Linux/OpenGL base standard #if AlternateIncRoot install:: MakeDir($(DESTDIR)$(SYSTEMUSRINCDIR)) -$(RM) $(DESTDIR)$(SYSTEMUSRINCDIR)/GL @if [ ! -d $(DESTDIR)$(SYSTEMUSRINCDIR)/GL ]; then \ set -x; $(LN) $(INCDIR)/GL $(DESTDIR)$(SYSTEMUSRINCDIR)/GL; \ fi #endif nx-libs-3.5.99.23/nx-X11/include/keysymdef.h0000644000000000000000000052623113614532331015110 0ustar /*********************************************************** Copyright 1987, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* * The "X11 Window System Protocol" standard defines in Appendix A the * keysym codes. These 29-bit integer values identify characters or * functions associated with each key (e.g., via the visible * engraving) of a keyboard layout. This file assigns mnemonic macro * names for these keysyms. * * This file is also compiled (by src/util/makekeys.c in libX11) into * hash tables that can be accessed with X11 library functions such as * XStringToKeysym() and XKeysymToString(). * * Where a keysym corresponds one-to-one to an ISO 10646 / Unicode * character, this is noted in a comment that provides both the U+xxxx * Unicode position, as well as the official Unicode name of the * character. * * Where the correspondence is either not one-to-one or semantically * unclear, the Unicode position and name are enclosed in * parentheses. Such legacy keysyms should be considered deprecated * and are not recommended for use in future keyboard mappings. * * For any future extension of the keysyms with characters already * found in ISO 10646 / Unicode, the following algorithm shall be * used. The new keysym code position will simply be the character's * Unicode number plus 0x01000000. The keysym values in the range * 0x01000100 to 0x0110ffff are reserved to represent Unicode * characters in the range U+0100 to U+10FFFF. * * While most newer Unicode-based X11 clients do already accept * Unicode-mapped keysyms in the range 0x01000100 to 0x0110ffff, it * will remain necessary for clients -- in the interest of * compatibility with existing servers -- to also understand the * existing legacy keysym values in the range 0x0100 to 0x20ff. * * Where several mnemonic names are defined for the same keysym in this * file, all but the first one listed should be considered deprecated. * * Mnemonic names for keysyms are defined in this file with lines * that match one of these Perl regular expressions: * * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\* U+([0-9A-F]{4,6}) (.*) \*\/\s*$/ * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\*\(U+([0-9A-F]{4,6}) (.*)\)\*\/\s*$/ * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*(\/\*\s*(.*)\s*\*\/)?\s*$/ * * Before adding new keysyms, please do consider the following: In * addition to the keysym names defined in this file, the * XStringToKeysym() and XKeysymToString() functions will also handle * any keysym string of the form "U0020" to "U007E" and "U00A0" to * "U10FFFF" for all possible Unicode characters. In other words, * every possible Unicode character has already a keysym string * defined algorithmically, even if it is not listed here. Therefore, * defining an additional keysym macro is only necessary where a * non-hexadecimal mnemonic name is needed, or where the new keysym * does not represent any existing Unicode character. * * When adding new keysyms to this file, do not forget to also update the * following as needed: * * - the mappings in src/KeyBind.c in the repo * git://anongit.freedesktop.org/xorg/lib/libX11.git * * - the protocol specification in specs/keysyms.xml * in the repo git://anongit.freedesktop.org/xorg/proto/x11proto.git * */ #define XK_VoidSymbol 0xffffff /* Void symbol */ #ifdef XK_MISCELLANY /* * TTY function keys, cleverly chosen to map to ASCII, for convenience of * programming, but could have been arbitrary (at the cost of lookup * tables in client code). */ #define XK_BackSpace 0xff08 /* Back space, back char */ #define XK_Tab 0xff09 #define XK_Linefeed 0xff0a /* Linefeed, LF */ #define XK_Clear 0xff0b #define XK_Return 0xff0d /* Return, enter */ #define XK_Pause 0xff13 /* Pause, hold */ #define XK_Scroll_Lock 0xff14 #define XK_Sys_Req 0xff15 #define XK_Escape 0xff1b #define XK_Delete 0xffff /* Delete, rubout */ /* International & multi-key character composition */ #define XK_Multi_key 0xff20 /* Multi-key character compose */ #define XK_Codeinput 0xff37 #define XK_SingleCandidate 0xff3c #define XK_MultipleCandidate 0xff3d #define XK_PreviousCandidate 0xff3e /* Japanese keyboard support */ #define XK_Kanji 0xff21 /* Kanji, Kanji convert */ #define XK_Muhenkan 0xff22 /* Cancel Conversion */ #define XK_Henkan_Mode 0xff23 /* Start/Stop Conversion */ #define XK_Henkan 0xff23 /* Alias for Henkan_Mode */ #define XK_Romaji 0xff24 /* to Romaji */ #define XK_Hiragana 0xff25 /* to Hiragana */ #define XK_Katakana 0xff26 /* to Katakana */ #define XK_Hiragana_Katakana 0xff27 /* Hiragana/Katakana toggle */ #define XK_Zenkaku 0xff28 /* to Zenkaku */ #define XK_Hankaku 0xff29 /* to Hankaku */ #define XK_Zenkaku_Hankaku 0xff2a /* Zenkaku/Hankaku toggle */ #define XK_Touroku 0xff2b /* Add to Dictionary */ #define XK_Massyo 0xff2c /* Delete from Dictionary */ #define XK_Kana_Lock 0xff2d /* Kana Lock */ #define XK_Kana_Shift 0xff2e /* Kana Shift */ #define XK_Eisu_Shift 0xff2f /* Alphanumeric Shift */ #define XK_Eisu_toggle 0xff30 /* Alphanumeric toggle */ #define XK_Kanji_Bangou 0xff37 /* Codeinput */ #define XK_Zen_Koho 0xff3d /* Multiple/All Candidate(s) */ #define XK_Mae_Koho 0xff3e /* Previous Candidate */ /* 0xff31 thru 0xff3f are under XK_KOREAN */ /* Cursor control & motion */ #define XK_Home 0xff50 #define XK_Left 0xff51 /* Move left, left arrow */ #define XK_Up 0xff52 /* Move up, up arrow */ #define XK_Right 0xff53 /* Move right, right arrow */ #define XK_Down 0xff54 /* Move down, down arrow */ #define XK_Prior 0xff55 /* Prior, previous */ #define XK_Page_Up 0xff55 #define XK_Next 0xff56 /* Next */ #define XK_Page_Down 0xff56 #define XK_End 0xff57 /* EOL */ #define XK_Begin 0xff58 /* BOL */ /* Misc functions */ #define XK_Select 0xff60 /* Select, mark */ #define XK_Print 0xff61 #define XK_Execute 0xff62 /* Execute, run, do */ #define XK_Insert 0xff63 /* Insert, insert here */ #define XK_Undo 0xff65 #define XK_Redo 0xff66 /* Redo, again */ #define XK_Menu 0xff67 #define XK_Find 0xff68 /* Find, search */ #define XK_Cancel 0xff69 /* Cancel, stop, abort, exit */ #define XK_Help 0xff6a /* Help */ #define XK_Break 0xff6b #define XK_Mode_switch 0xff7e /* Character set switch */ #define XK_script_switch 0xff7e /* Alias for mode_switch */ #define XK_Num_Lock 0xff7f /* Keypad functions, keypad numbers cleverly chosen to map to ASCII */ #define XK_KP_Space 0xff80 /* Space */ #define XK_KP_Tab 0xff89 #define XK_KP_Enter 0xff8d /* Enter */ #define XK_KP_F1 0xff91 /* PF1, KP_A, ... */ #define XK_KP_F2 0xff92 #define XK_KP_F3 0xff93 #define XK_KP_F4 0xff94 #define XK_KP_Home 0xff95 #define XK_KP_Left 0xff96 #define XK_KP_Up 0xff97 #define XK_KP_Right 0xff98 #define XK_KP_Down 0xff99 #define XK_KP_Prior 0xff9a #define XK_KP_Page_Up 0xff9a #define XK_KP_Next 0xff9b #define XK_KP_Page_Down 0xff9b #define XK_KP_End 0xff9c #define XK_KP_Begin 0xff9d #define XK_KP_Insert 0xff9e #define XK_KP_Delete 0xff9f #define XK_KP_Equal 0xffbd /* Equals */ #define XK_KP_Multiply 0xffaa #define XK_KP_Add 0xffab #define XK_KP_Separator 0xffac /* Separator, often comma */ #define XK_KP_Subtract 0xffad #define XK_KP_Decimal 0xffae #define XK_KP_Divide 0xffaf #define XK_KP_0 0xffb0 #define XK_KP_1 0xffb1 #define XK_KP_2 0xffb2 #define XK_KP_3 0xffb3 #define XK_KP_4 0xffb4 #define XK_KP_5 0xffb5 #define XK_KP_6 0xffb6 #define XK_KP_7 0xffb7 #define XK_KP_8 0xffb8 #define XK_KP_9 0xffb9 /* * Auxiliary functions; note the duplicate definitions for left and right * function keys; Sun keyboards and a few other manufacturers have such * function key groups on the left and/or right sides of the keyboard. * We've not found a keyboard with more than 35 function keys total. */ #define XK_F1 0xffbe #define XK_F2 0xffbf #define XK_F3 0xffc0 #define XK_F4 0xffc1 #define XK_F5 0xffc2 #define XK_F6 0xffc3 #define XK_F7 0xffc4 #define XK_F8 0xffc5 #define XK_F9 0xffc6 #define XK_F10 0xffc7 #define XK_F11 0xffc8 #define XK_L1 0xffc8 #define XK_F12 0xffc9 #define XK_L2 0xffc9 #define XK_F13 0xffca #define XK_L3 0xffca #define XK_F14 0xffcb #define XK_L4 0xffcb #define XK_F15 0xffcc #define XK_L5 0xffcc #define XK_F16 0xffcd #define XK_L6 0xffcd #define XK_F17 0xffce #define XK_L7 0xffce #define XK_F18 0xffcf #define XK_L8 0xffcf #define XK_F19 0xffd0 #define XK_L9 0xffd0 #define XK_F20 0xffd1 #define XK_L10 0xffd1 #define XK_F21 0xffd2 #define XK_R1 0xffd2 #define XK_F22 0xffd3 #define XK_R2 0xffd3 #define XK_F23 0xffd4 #define XK_R3 0xffd4 #define XK_F24 0xffd5 #define XK_R4 0xffd5 #define XK_F25 0xffd6 #define XK_R5 0xffd6 #define XK_F26 0xffd7 #define XK_R6 0xffd7 #define XK_F27 0xffd8 #define XK_R7 0xffd8 #define XK_F28 0xffd9 #define XK_R8 0xffd9 #define XK_F29 0xffda #define XK_R9 0xffda #define XK_F30 0xffdb #define XK_R10 0xffdb #define XK_F31 0xffdc #define XK_R11 0xffdc #define XK_F32 0xffdd #define XK_R12 0xffdd #define XK_F33 0xffde #define XK_R13 0xffde #define XK_F34 0xffdf #define XK_R14 0xffdf #define XK_F35 0xffe0 #define XK_R15 0xffe0 /* Modifiers */ #define XK_Shift_L 0xffe1 /* Left shift */ #define XK_Shift_R 0xffe2 /* Right shift */ #define XK_Control_L 0xffe3 /* Left control */ #define XK_Control_R 0xffe4 /* Right control */ #define XK_Caps_Lock 0xffe5 /* Caps lock */ #define XK_Shift_Lock 0xffe6 /* Shift lock */ #define XK_Meta_L 0xffe7 /* Left meta */ #define XK_Meta_R 0xffe8 /* Right meta */ #define XK_Alt_L 0xffe9 /* Left alt */ #define XK_Alt_R 0xffea /* Right alt */ #define XK_Super_L 0xffeb /* Left super */ #define XK_Super_R 0xffec /* Right super */ #define XK_Hyper_L 0xffed /* Left hyper */ #define XK_Hyper_R 0xffee /* Right hyper */ #endif /* XK_MISCELLANY */ /* * Keyboard (XKB) Extension function and modifier keys * (from Appendix C of "The X Keyboard Extension: Protocol Specification") * Byte 3 = 0xfe */ #ifdef XK_XKB_KEYS #define XK_ISO_Lock 0xfe01 #define XK_ISO_Level2_Latch 0xfe02 #define XK_ISO_Level3_Shift 0xfe03 #define XK_ISO_Level3_Latch 0xfe04 #define XK_ISO_Level3_Lock 0xfe05 #define XK_ISO_Level5_Shift 0xfe11 #define XK_ISO_Level5_Latch 0xfe12 #define XK_ISO_Level5_Lock 0xfe13 #define XK_ISO_Group_Shift 0xff7e /* Alias for mode_switch */ #define XK_ISO_Group_Latch 0xfe06 #define XK_ISO_Group_Lock 0xfe07 #define XK_ISO_Next_Group 0xfe08 #define XK_ISO_Next_Group_Lock 0xfe09 #define XK_ISO_Prev_Group 0xfe0a #define XK_ISO_Prev_Group_Lock 0xfe0b #define XK_ISO_First_Group 0xfe0c #define XK_ISO_First_Group_Lock 0xfe0d #define XK_ISO_Last_Group 0xfe0e #define XK_ISO_Last_Group_Lock 0xfe0f #define XK_ISO_Left_Tab 0xfe20 #define XK_ISO_Move_Line_Up 0xfe21 #define XK_ISO_Move_Line_Down 0xfe22 #define XK_ISO_Partial_Line_Up 0xfe23 #define XK_ISO_Partial_Line_Down 0xfe24 #define XK_ISO_Partial_Space_Left 0xfe25 #define XK_ISO_Partial_Space_Right 0xfe26 #define XK_ISO_Set_Margin_Left 0xfe27 #define XK_ISO_Set_Margin_Right 0xfe28 #define XK_ISO_Release_Margin_Left 0xfe29 #define XK_ISO_Release_Margin_Right 0xfe2a #define XK_ISO_Release_Both_Margins 0xfe2b #define XK_ISO_Fast_Cursor_Left 0xfe2c #define XK_ISO_Fast_Cursor_Right 0xfe2d #define XK_ISO_Fast_Cursor_Up 0xfe2e #define XK_ISO_Fast_Cursor_Down 0xfe2f #define XK_ISO_Continuous_Underline 0xfe30 #define XK_ISO_Discontinuous_Underline 0xfe31 #define XK_ISO_Emphasize 0xfe32 #define XK_ISO_Center_Object 0xfe33 #define XK_ISO_Enter 0xfe34 #define XK_dead_grave 0xfe50 #define XK_dead_acute 0xfe51 #define XK_dead_circumflex 0xfe52 #define XK_dead_tilde 0xfe53 #define XK_dead_perispomeni 0xfe53 /* alias for dead_tilde */ #define XK_dead_macron 0xfe54 #define XK_dead_breve 0xfe55 #define XK_dead_abovedot 0xfe56 #define XK_dead_diaeresis 0xfe57 #define XK_dead_abovering 0xfe58 #define XK_dead_doubleacute 0xfe59 #define XK_dead_caron 0xfe5a #define XK_dead_cedilla 0xfe5b #define XK_dead_ogonek 0xfe5c #define XK_dead_iota 0xfe5d #define XK_dead_voiced_sound 0xfe5e #define XK_dead_semivoiced_sound 0xfe5f #define XK_dead_belowdot 0xfe60 #define XK_dead_hook 0xfe61 #define XK_dead_horn 0xfe62 #define XK_dead_stroke 0xfe63 #define XK_dead_abovecomma 0xfe64 #define XK_dead_psili 0xfe64 /* alias for dead_abovecomma */ #define XK_dead_abovereversedcomma 0xfe65 #define XK_dead_dasia 0xfe65 /* alias for dead_abovereversedcomma */ #define XK_dead_doublegrave 0xfe66 #define XK_dead_belowring 0xfe67 #define XK_dead_belowmacron 0xfe68 #define XK_dead_belowcircumflex 0xfe69 #define XK_dead_belowtilde 0xfe6a #define XK_dead_belowbreve 0xfe6b #define XK_dead_belowdiaeresis 0xfe6c #define XK_dead_invertedbreve 0xfe6d #define XK_dead_belowcomma 0xfe6e #define XK_dead_currency 0xfe6f /* extra dead elements for German T3 layout */ #define XK_dead_lowline 0xfe90 #define XK_dead_aboveverticalline 0xfe91 #define XK_dead_belowverticalline 0xfe92 #define XK_dead_longsolidusoverlay 0xfe93 /* dead vowels for universal syllable entry */ #define XK_dead_a 0xfe80 #define XK_dead_A 0xfe81 #define XK_dead_e 0xfe82 #define XK_dead_E 0xfe83 #define XK_dead_i 0xfe84 #define XK_dead_I 0xfe85 #define XK_dead_o 0xfe86 #define XK_dead_O 0xfe87 #define XK_dead_u 0xfe88 #define XK_dead_U 0xfe89 #define XK_dead_small_schwa 0xfe8a #define XK_dead_capital_schwa 0xfe8b #define XK_dead_greek 0xfe8c #define XK_First_Virtual_Screen 0xfed0 #define XK_Prev_Virtual_Screen 0xfed1 #define XK_Next_Virtual_Screen 0xfed2 #define XK_Last_Virtual_Screen 0xfed4 #define XK_Terminate_Server 0xfed5 #define XK_AccessX_Enable 0xfe70 #define XK_AccessX_Feedback_Enable 0xfe71 #define XK_RepeatKeys_Enable 0xfe72 #define XK_SlowKeys_Enable 0xfe73 #define XK_BounceKeys_Enable 0xfe74 #define XK_StickyKeys_Enable 0xfe75 #define XK_MouseKeys_Enable 0xfe76 #define XK_MouseKeys_Accel_Enable 0xfe77 #define XK_Overlay1_Enable 0xfe78 #define XK_Overlay2_Enable 0xfe79 #define XK_AudibleBell_Enable 0xfe7a #define XK_Pointer_Left 0xfee0 #define XK_Pointer_Right 0xfee1 #define XK_Pointer_Up 0xfee2 #define XK_Pointer_Down 0xfee3 #define XK_Pointer_UpLeft 0xfee4 #define XK_Pointer_UpRight 0xfee5 #define XK_Pointer_DownLeft 0xfee6 #define XK_Pointer_DownRight 0xfee7 #define XK_Pointer_Button_Dflt 0xfee8 #define XK_Pointer_Button1 0xfee9 #define XK_Pointer_Button2 0xfeea #define XK_Pointer_Button3 0xfeeb #define XK_Pointer_Button4 0xfeec #define XK_Pointer_Button5 0xfeed #define XK_Pointer_DblClick_Dflt 0xfeee #define XK_Pointer_DblClick1 0xfeef #define XK_Pointer_DblClick2 0xfef0 #define XK_Pointer_DblClick3 0xfef1 #define XK_Pointer_DblClick4 0xfef2 #define XK_Pointer_DblClick5 0xfef3 #define XK_Pointer_Drag_Dflt 0xfef4 #define XK_Pointer_Drag1 0xfef5 #define XK_Pointer_Drag2 0xfef6 #define XK_Pointer_Drag3 0xfef7 #define XK_Pointer_Drag4 0xfef8 #define XK_Pointer_Drag5 0xfefd #define XK_Pointer_EnableKeys 0xfef9 #define XK_Pointer_Accelerate 0xfefa #define XK_Pointer_DfltBtnNext 0xfefb #define XK_Pointer_DfltBtnPrev 0xfefc /* Single-Stroke Multiple-Character N-Graph Keysyms For The X Input Method */ #define XK_ch 0xfea0 #define XK_Ch 0xfea1 #define XK_CH 0xfea2 #define XK_c_h 0xfea3 #define XK_C_h 0xfea4 #define XK_C_H 0xfea5 #endif /* XK_XKB_KEYS */ /* * 3270 Terminal Keys * Byte 3 = 0xfd */ #ifdef XK_3270 #define XK_3270_Duplicate 0xfd01 #define XK_3270_FieldMark 0xfd02 #define XK_3270_Right2 0xfd03 #define XK_3270_Left2 0xfd04 #define XK_3270_BackTab 0xfd05 #define XK_3270_EraseEOF 0xfd06 #define XK_3270_EraseInput 0xfd07 #define XK_3270_Reset 0xfd08 #define XK_3270_Quit 0xfd09 #define XK_3270_PA1 0xfd0a #define XK_3270_PA2 0xfd0b #define XK_3270_PA3 0xfd0c #define XK_3270_Test 0xfd0d #define XK_3270_Attn 0xfd0e #define XK_3270_CursorBlink 0xfd0f #define XK_3270_AltCursor 0xfd10 #define XK_3270_KeyClick 0xfd11 #define XK_3270_Jump 0xfd12 #define XK_3270_Ident 0xfd13 #define XK_3270_Rule 0xfd14 #define XK_3270_Copy 0xfd15 #define XK_3270_Play 0xfd16 #define XK_3270_Setup 0xfd17 #define XK_3270_Record 0xfd18 #define XK_3270_ChangeScreen 0xfd19 #define XK_3270_DeleteWord 0xfd1a #define XK_3270_ExSelect 0xfd1b #define XK_3270_CursorSelect 0xfd1c #define XK_3270_PrintScreen 0xfd1d #define XK_3270_Enter 0xfd1e #endif /* XK_3270 */ /* * Latin 1 * (ISO/IEC 8859-1 = Unicode U+0020..U+00FF) * Byte 3 = 0 */ #ifdef XK_LATIN1 #define XK_space 0x0020 /* U+0020 SPACE */ #define XK_exclam 0x0021 /* U+0021 EXCLAMATION MARK */ #define XK_quotedbl 0x0022 /* U+0022 QUOTATION MARK */ #define XK_numbersign 0x0023 /* U+0023 NUMBER SIGN */ #define XK_dollar 0x0024 /* U+0024 DOLLAR SIGN */ #define XK_percent 0x0025 /* U+0025 PERCENT SIGN */ #define XK_ampersand 0x0026 /* U+0026 AMPERSAND */ #define XK_apostrophe 0x0027 /* U+0027 APOSTROPHE */ #define XK_quoteright 0x0027 /* deprecated */ #define XK_parenleft 0x0028 /* U+0028 LEFT PARENTHESIS */ #define XK_parenright 0x0029 /* U+0029 RIGHT PARENTHESIS */ #define XK_asterisk 0x002a /* U+002A ASTERISK */ #define XK_plus 0x002b /* U+002B PLUS SIGN */ #define XK_comma 0x002c /* U+002C COMMA */ #define XK_minus 0x002d /* U+002D HYPHEN-MINUS */ #define XK_period 0x002e /* U+002E FULL STOP */ #define XK_slash 0x002f /* U+002F SOLIDUS */ #define XK_0 0x0030 /* U+0030 DIGIT ZERO */ #define XK_1 0x0031 /* U+0031 DIGIT ONE */ #define XK_2 0x0032 /* U+0032 DIGIT TWO */ #define XK_3 0x0033 /* U+0033 DIGIT THREE */ #define XK_4 0x0034 /* U+0034 DIGIT FOUR */ #define XK_5 0x0035 /* U+0035 DIGIT FIVE */ #define XK_6 0x0036 /* U+0036 DIGIT SIX */ #define XK_7 0x0037 /* U+0037 DIGIT SEVEN */ #define XK_8 0x0038 /* U+0038 DIGIT EIGHT */ #define XK_9 0x0039 /* U+0039 DIGIT NINE */ #define XK_colon 0x003a /* U+003A COLON */ #define XK_semicolon 0x003b /* U+003B SEMICOLON */ #define XK_less 0x003c /* U+003C LESS-THAN SIGN */ #define XK_equal 0x003d /* U+003D EQUALS SIGN */ #define XK_greater 0x003e /* U+003E GREATER-THAN SIGN */ #define XK_question 0x003f /* U+003F QUESTION MARK */ #define XK_at 0x0040 /* U+0040 COMMERCIAL AT */ #define XK_A 0x0041 /* U+0041 LATIN CAPITAL LETTER A */ #define XK_B 0x0042 /* U+0042 LATIN CAPITAL LETTER B */ #define XK_C 0x0043 /* U+0043 LATIN CAPITAL LETTER C */ #define XK_D 0x0044 /* U+0044 LATIN CAPITAL LETTER D */ #define XK_E 0x0045 /* U+0045 LATIN CAPITAL LETTER E */ #define XK_F 0x0046 /* U+0046 LATIN CAPITAL LETTER F */ #define XK_G 0x0047 /* U+0047 LATIN CAPITAL LETTER G */ #define XK_H 0x0048 /* U+0048 LATIN CAPITAL LETTER H */ #define XK_I 0x0049 /* U+0049 LATIN CAPITAL LETTER I */ #define XK_J 0x004a /* U+004A LATIN CAPITAL LETTER J */ #define XK_K 0x004b /* U+004B LATIN CAPITAL LETTER K */ #define XK_L 0x004c /* U+004C LATIN CAPITAL LETTER L */ #define XK_M 0x004d /* U+004D LATIN CAPITAL LETTER M */ #define XK_N 0x004e /* U+004E LATIN CAPITAL LETTER N */ #define XK_O 0x004f /* U+004F LATIN CAPITAL LETTER O */ #define XK_P 0x0050 /* U+0050 LATIN CAPITAL LETTER P */ #define XK_Q 0x0051 /* U+0051 LATIN CAPITAL LETTER Q */ #define XK_R 0x0052 /* U+0052 LATIN CAPITAL LETTER R */ #define XK_S 0x0053 /* U+0053 LATIN CAPITAL LETTER S */ #define XK_T 0x0054 /* U+0054 LATIN CAPITAL LETTER T */ #define XK_U 0x0055 /* U+0055 LATIN CAPITAL LETTER U */ #define XK_V 0x0056 /* U+0056 LATIN CAPITAL LETTER V */ #define XK_W 0x0057 /* U+0057 LATIN CAPITAL LETTER W */ #define XK_X 0x0058 /* U+0058 LATIN CAPITAL LETTER X */ #define XK_Y 0x0059 /* U+0059 LATIN CAPITAL LETTER Y */ #define XK_Z 0x005a /* U+005A LATIN CAPITAL LETTER Z */ #define XK_bracketleft 0x005b /* U+005B LEFT SQUARE BRACKET */ #define XK_backslash 0x005c /* U+005C REVERSE SOLIDUS */ #define XK_bracketright 0x005d /* U+005D RIGHT SQUARE BRACKET */ #define XK_asciicircum 0x005e /* U+005E CIRCUMFLEX ACCENT */ #define XK_underscore 0x005f /* U+005F LOW LINE */ #define XK_grave 0x0060 /* U+0060 GRAVE ACCENT */ #define XK_quoteleft 0x0060 /* deprecated */ #define XK_a 0x0061 /* U+0061 LATIN SMALL LETTER A */ #define XK_b 0x0062 /* U+0062 LATIN SMALL LETTER B */ #define XK_c 0x0063 /* U+0063 LATIN SMALL LETTER C */ #define XK_d 0x0064 /* U+0064 LATIN SMALL LETTER D */ #define XK_e 0x0065 /* U+0065 LATIN SMALL LETTER E */ #define XK_f 0x0066 /* U+0066 LATIN SMALL LETTER F */ #define XK_g 0x0067 /* U+0067 LATIN SMALL LETTER G */ #define XK_h 0x0068 /* U+0068 LATIN SMALL LETTER H */ #define XK_i 0x0069 /* U+0069 LATIN SMALL LETTER I */ #define XK_j 0x006a /* U+006A LATIN SMALL LETTER J */ #define XK_k 0x006b /* U+006B LATIN SMALL LETTER K */ #define XK_l 0x006c /* U+006C LATIN SMALL LETTER L */ #define XK_m 0x006d /* U+006D LATIN SMALL LETTER M */ #define XK_n 0x006e /* U+006E LATIN SMALL LETTER N */ #define XK_o 0x006f /* U+006F LATIN SMALL LETTER O */ #define XK_p 0x0070 /* U+0070 LATIN SMALL LETTER P */ #define XK_q 0x0071 /* U+0071 LATIN SMALL LETTER Q */ #define XK_r 0x0072 /* U+0072 LATIN SMALL LETTER R */ #define XK_s 0x0073 /* U+0073 LATIN SMALL LETTER S */ #define XK_t 0x0074 /* U+0074 LATIN SMALL LETTER T */ #define XK_u 0x0075 /* U+0075 LATIN SMALL LETTER U */ #define XK_v 0x0076 /* U+0076 LATIN SMALL LETTER V */ #define XK_w 0x0077 /* U+0077 LATIN SMALL LETTER W */ #define XK_x 0x0078 /* U+0078 LATIN SMALL LETTER X */ #define XK_y 0x0079 /* U+0079 LATIN SMALL LETTER Y */ #define XK_z 0x007a /* U+007A LATIN SMALL LETTER Z */ #define XK_braceleft 0x007b /* U+007B LEFT CURLY BRACKET */ #define XK_bar 0x007c /* U+007C VERTICAL LINE */ #define XK_braceright 0x007d /* U+007D RIGHT CURLY BRACKET */ #define XK_asciitilde 0x007e /* U+007E TILDE */ #define XK_nobreakspace 0x00a0 /* U+00A0 NO-BREAK SPACE */ #define XK_exclamdown 0x00a1 /* U+00A1 INVERTED EXCLAMATION MARK */ #define XK_cent 0x00a2 /* U+00A2 CENT SIGN */ #define XK_sterling 0x00a3 /* U+00A3 POUND SIGN */ #define XK_currency 0x00a4 /* U+00A4 CURRENCY SIGN */ #define XK_yen 0x00a5 /* U+00A5 YEN SIGN */ #define XK_brokenbar 0x00a6 /* U+00A6 BROKEN BAR */ #define XK_section 0x00a7 /* U+00A7 SECTION SIGN */ #define XK_diaeresis 0x00a8 /* U+00A8 DIAERESIS */ #define XK_copyright 0x00a9 /* U+00A9 COPYRIGHT SIGN */ #define XK_ordfeminine 0x00aa /* U+00AA FEMININE ORDINAL INDICATOR */ #define XK_guillemotleft 0x00ab /* U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ #define XK_notsign 0x00ac /* U+00AC NOT SIGN */ #define XK_hyphen 0x00ad /* U+00AD SOFT HYPHEN */ #define XK_registered 0x00ae /* U+00AE REGISTERED SIGN */ #define XK_macron 0x00af /* U+00AF MACRON */ #define XK_degree 0x00b0 /* U+00B0 DEGREE SIGN */ #define XK_plusminus 0x00b1 /* U+00B1 PLUS-MINUS SIGN */ #define XK_twosuperior 0x00b2 /* U+00B2 SUPERSCRIPT TWO */ #define XK_threesuperior 0x00b3 /* U+00B3 SUPERSCRIPT THREE */ #define XK_acute 0x00b4 /* U+00B4 ACUTE ACCENT */ #define XK_mu 0x00b5 /* U+00B5 MICRO SIGN */ #define XK_paragraph 0x00b6 /* U+00B6 PILCROW SIGN */ #define XK_periodcentered 0x00b7 /* U+00B7 MIDDLE DOT */ #define XK_cedilla 0x00b8 /* U+00B8 CEDILLA */ #define XK_onesuperior 0x00b9 /* U+00B9 SUPERSCRIPT ONE */ #define XK_masculine 0x00ba /* U+00BA MASCULINE ORDINAL INDICATOR */ #define XK_guillemotright 0x00bb /* U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ #define XK_onequarter 0x00bc /* U+00BC VULGAR FRACTION ONE QUARTER */ #define XK_onehalf 0x00bd /* U+00BD VULGAR FRACTION ONE HALF */ #define XK_threequarters 0x00be /* U+00BE VULGAR FRACTION THREE QUARTERS */ #define XK_questiondown 0x00bf /* U+00BF INVERTED QUESTION MARK */ #define XK_Agrave 0x00c0 /* U+00C0 LATIN CAPITAL LETTER A WITH GRAVE */ #define XK_Aacute 0x00c1 /* U+00C1 LATIN CAPITAL LETTER A WITH ACUTE */ #define XK_Acircumflex 0x00c2 /* U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ #define XK_Atilde 0x00c3 /* U+00C3 LATIN CAPITAL LETTER A WITH TILDE */ #define XK_Adiaeresis 0x00c4 /* U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS */ #define XK_Aring 0x00c5 /* U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE */ #define XK_AE 0x00c6 /* U+00C6 LATIN CAPITAL LETTER AE */ #define XK_Ccedilla 0x00c7 /* U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA */ #define XK_Egrave 0x00c8 /* U+00C8 LATIN CAPITAL LETTER E WITH GRAVE */ #define XK_Eacute 0x00c9 /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */ #define XK_Ecircumflex 0x00ca /* U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX */ #define XK_Ediaeresis 0x00cb /* U+00CB LATIN CAPITAL LETTER E WITH DIAERESIS */ #define XK_Igrave 0x00cc /* U+00CC LATIN CAPITAL LETTER I WITH GRAVE */ #define XK_Iacute 0x00cd /* U+00CD LATIN CAPITAL LETTER I WITH ACUTE */ #define XK_Icircumflex 0x00ce /* U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */ #define XK_Idiaeresis 0x00cf /* U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS */ #define XK_ETH 0x00d0 /* U+00D0 LATIN CAPITAL LETTER ETH */ #define XK_Eth 0x00d0 /* deprecated */ #define XK_Ntilde 0x00d1 /* U+00D1 LATIN CAPITAL LETTER N WITH TILDE */ #define XK_Ograve 0x00d2 /* U+00D2 LATIN CAPITAL LETTER O WITH GRAVE */ #define XK_Oacute 0x00d3 /* U+00D3 LATIN CAPITAL LETTER O WITH ACUTE */ #define XK_Ocircumflex 0x00d4 /* U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ #define XK_Otilde 0x00d5 /* U+00D5 LATIN CAPITAL LETTER O WITH TILDE */ #define XK_Odiaeresis 0x00d6 /* U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS */ #define XK_multiply 0x00d7 /* U+00D7 MULTIPLICATION SIGN */ #define XK_Oslash 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */ #define XK_Ooblique 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */ #define XK_Ugrave 0x00d9 /* U+00D9 LATIN CAPITAL LETTER U WITH GRAVE */ #define XK_Uacute 0x00da /* U+00DA LATIN CAPITAL LETTER U WITH ACUTE */ #define XK_Ucircumflex 0x00db /* U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ #define XK_Udiaeresis 0x00dc /* U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS */ #define XK_Yacute 0x00dd /* U+00DD LATIN CAPITAL LETTER Y WITH ACUTE */ #define XK_THORN 0x00de /* U+00DE LATIN CAPITAL LETTER THORN */ #define XK_Thorn 0x00de /* deprecated */ #define XK_ssharp 0x00df /* U+00DF LATIN SMALL LETTER SHARP S */ #define XK_agrave 0x00e0 /* U+00E0 LATIN SMALL LETTER A WITH GRAVE */ #define XK_aacute 0x00e1 /* U+00E1 LATIN SMALL LETTER A WITH ACUTE */ #define XK_acircumflex 0x00e2 /* U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX */ #define XK_atilde 0x00e3 /* U+00E3 LATIN SMALL LETTER A WITH TILDE */ #define XK_adiaeresis 0x00e4 /* U+00E4 LATIN SMALL LETTER A WITH DIAERESIS */ #define XK_aring 0x00e5 /* U+00E5 LATIN SMALL LETTER A WITH RING ABOVE */ #define XK_ae 0x00e6 /* U+00E6 LATIN SMALL LETTER AE */ #define XK_ccedilla 0x00e7 /* U+00E7 LATIN SMALL LETTER C WITH CEDILLA */ #define XK_egrave 0x00e8 /* U+00E8 LATIN SMALL LETTER E WITH GRAVE */ #define XK_eacute 0x00e9 /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */ #define XK_ecircumflex 0x00ea /* U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX */ #define XK_ediaeresis 0x00eb /* U+00EB LATIN SMALL LETTER E WITH DIAERESIS */ #define XK_igrave 0x00ec /* U+00EC LATIN SMALL LETTER I WITH GRAVE */ #define XK_iacute 0x00ed /* U+00ED LATIN SMALL LETTER I WITH ACUTE */ #define XK_icircumflex 0x00ee /* U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX */ #define XK_idiaeresis 0x00ef /* U+00EF LATIN SMALL LETTER I WITH DIAERESIS */ #define XK_eth 0x00f0 /* U+00F0 LATIN SMALL LETTER ETH */ #define XK_ntilde 0x00f1 /* U+00F1 LATIN SMALL LETTER N WITH TILDE */ #define XK_ograve 0x00f2 /* U+00F2 LATIN SMALL LETTER O WITH GRAVE */ #define XK_oacute 0x00f3 /* U+00F3 LATIN SMALL LETTER O WITH ACUTE */ #define XK_ocircumflex 0x00f4 /* U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX */ #define XK_otilde 0x00f5 /* U+00F5 LATIN SMALL LETTER O WITH TILDE */ #define XK_odiaeresis 0x00f6 /* U+00F6 LATIN SMALL LETTER O WITH DIAERESIS */ #define XK_division 0x00f7 /* U+00F7 DIVISION SIGN */ #define XK_oslash 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */ #define XK_ooblique 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */ #define XK_ugrave 0x00f9 /* U+00F9 LATIN SMALL LETTER U WITH GRAVE */ #define XK_uacute 0x00fa /* U+00FA LATIN SMALL LETTER U WITH ACUTE */ #define XK_ucircumflex 0x00fb /* U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX */ #define XK_udiaeresis 0x00fc /* U+00FC LATIN SMALL LETTER U WITH DIAERESIS */ #define XK_yacute 0x00fd /* U+00FD LATIN SMALL LETTER Y WITH ACUTE */ #define XK_thorn 0x00fe /* U+00FE LATIN SMALL LETTER THORN */ #define XK_ydiaeresis 0x00ff /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ #endif /* XK_LATIN1 */ /* * Latin 2 * Byte 3 = 1 */ #ifdef XK_LATIN2 #define XK_Aogonek 0x01a1 /* U+0104 LATIN CAPITAL LETTER A WITH OGONEK */ #define XK_breve 0x01a2 /* U+02D8 BREVE */ #define XK_Lstroke 0x01a3 /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ #define XK_Lcaron 0x01a5 /* U+013D LATIN CAPITAL LETTER L WITH CARON */ #define XK_Sacute 0x01a6 /* U+015A LATIN CAPITAL LETTER S WITH ACUTE */ #define XK_Scaron 0x01a9 /* U+0160 LATIN CAPITAL LETTER S WITH CARON */ #define XK_Scedilla 0x01aa /* U+015E LATIN CAPITAL LETTER S WITH CEDILLA */ #define XK_Tcaron 0x01ab /* U+0164 LATIN CAPITAL LETTER T WITH CARON */ #define XK_Zacute 0x01ac /* U+0179 LATIN CAPITAL LETTER Z WITH ACUTE */ #define XK_Zcaron 0x01ae /* U+017D LATIN CAPITAL LETTER Z WITH CARON */ #define XK_Zabovedot 0x01af /* U+017B LATIN CAPITAL LETTER Z WITH DOT ABOVE */ #define XK_aogonek 0x01b1 /* U+0105 LATIN SMALL LETTER A WITH OGONEK */ #define XK_ogonek 0x01b2 /* U+02DB OGONEK */ #define XK_lstroke 0x01b3 /* U+0142 LATIN SMALL LETTER L WITH STROKE */ #define XK_lcaron 0x01b5 /* U+013E LATIN SMALL LETTER L WITH CARON */ #define XK_sacute 0x01b6 /* U+015B LATIN SMALL LETTER S WITH ACUTE */ #define XK_caron 0x01b7 /* U+02C7 CARON */ #define XK_scaron 0x01b9 /* U+0161 LATIN SMALL LETTER S WITH CARON */ #define XK_scedilla 0x01ba /* U+015F LATIN SMALL LETTER S WITH CEDILLA */ #define XK_tcaron 0x01bb /* U+0165 LATIN SMALL LETTER T WITH CARON */ #define XK_zacute 0x01bc /* U+017A LATIN SMALL LETTER Z WITH ACUTE */ #define XK_doubleacute 0x01bd /* U+02DD DOUBLE ACUTE ACCENT */ #define XK_zcaron 0x01be /* U+017E LATIN SMALL LETTER Z WITH CARON */ #define XK_zabovedot 0x01bf /* U+017C LATIN SMALL LETTER Z WITH DOT ABOVE */ #define XK_Racute 0x01c0 /* U+0154 LATIN CAPITAL LETTER R WITH ACUTE */ #define XK_Abreve 0x01c3 /* U+0102 LATIN CAPITAL LETTER A WITH BREVE */ #define XK_Lacute 0x01c5 /* U+0139 LATIN CAPITAL LETTER L WITH ACUTE */ #define XK_Cacute 0x01c6 /* U+0106 LATIN CAPITAL LETTER C WITH ACUTE */ #define XK_Ccaron 0x01c8 /* U+010C LATIN CAPITAL LETTER C WITH CARON */ #define XK_Eogonek 0x01ca /* U+0118 LATIN CAPITAL LETTER E WITH OGONEK */ #define XK_Ecaron 0x01cc /* U+011A LATIN CAPITAL LETTER E WITH CARON */ #define XK_Dcaron 0x01cf /* U+010E LATIN CAPITAL LETTER D WITH CARON */ #define XK_Dstroke 0x01d0 /* U+0110 LATIN CAPITAL LETTER D WITH STROKE */ #define XK_Nacute 0x01d1 /* U+0143 LATIN CAPITAL LETTER N WITH ACUTE */ #define XK_Ncaron 0x01d2 /* U+0147 LATIN CAPITAL LETTER N WITH CARON */ #define XK_Odoubleacute 0x01d5 /* U+0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */ #define XK_Rcaron 0x01d8 /* U+0158 LATIN CAPITAL LETTER R WITH CARON */ #define XK_Uring 0x01d9 /* U+016E LATIN CAPITAL LETTER U WITH RING ABOVE */ #define XK_Udoubleacute 0x01db /* U+0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */ #define XK_Tcedilla 0x01de /* U+0162 LATIN CAPITAL LETTER T WITH CEDILLA */ #define XK_racute 0x01e0 /* U+0155 LATIN SMALL LETTER R WITH ACUTE */ #define XK_abreve 0x01e3 /* U+0103 LATIN SMALL LETTER A WITH BREVE */ #define XK_lacute 0x01e5 /* U+013A LATIN SMALL LETTER L WITH ACUTE */ #define XK_cacute 0x01e6 /* U+0107 LATIN SMALL LETTER C WITH ACUTE */ #define XK_ccaron 0x01e8 /* U+010D LATIN SMALL LETTER C WITH CARON */ #define XK_eogonek 0x01ea /* U+0119 LATIN SMALL LETTER E WITH OGONEK */ #define XK_ecaron 0x01ec /* U+011B LATIN SMALL LETTER E WITH CARON */ #define XK_dcaron 0x01ef /* U+010F LATIN SMALL LETTER D WITH CARON */ #define XK_dstroke 0x01f0 /* U+0111 LATIN SMALL LETTER D WITH STROKE */ #define XK_nacute 0x01f1 /* U+0144 LATIN SMALL LETTER N WITH ACUTE */ #define XK_ncaron 0x01f2 /* U+0148 LATIN SMALL LETTER N WITH CARON */ #define XK_odoubleacute 0x01f5 /* U+0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE */ #define XK_rcaron 0x01f8 /* U+0159 LATIN SMALL LETTER R WITH CARON */ #define XK_uring 0x01f9 /* U+016F LATIN SMALL LETTER U WITH RING ABOVE */ #define XK_udoubleacute 0x01fb /* U+0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE */ #define XK_tcedilla 0x01fe /* U+0163 LATIN SMALL LETTER T WITH CEDILLA */ #define XK_abovedot 0x01ff /* U+02D9 DOT ABOVE */ #endif /* XK_LATIN2 */ /* * Latin 3 * Byte 3 = 2 */ #ifdef XK_LATIN3 #define XK_Hstroke 0x02a1 /* U+0126 LATIN CAPITAL LETTER H WITH STROKE */ #define XK_Hcircumflex 0x02a6 /* U+0124 LATIN CAPITAL LETTER H WITH CIRCUMFLEX */ #define XK_Iabovedot 0x02a9 /* U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE */ #define XK_Gbreve 0x02ab /* U+011E LATIN CAPITAL LETTER G WITH BREVE */ #define XK_Jcircumflex 0x02ac /* U+0134 LATIN CAPITAL LETTER J WITH CIRCUMFLEX */ #define XK_hstroke 0x02b1 /* U+0127 LATIN SMALL LETTER H WITH STROKE */ #define XK_hcircumflex 0x02b6 /* U+0125 LATIN SMALL LETTER H WITH CIRCUMFLEX */ #define XK_idotless 0x02b9 /* U+0131 LATIN SMALL LETTER DOTLESS I */ #define XK_gbreve 0x02bb /* U+011F LATIN SMALL LETTER G WITH BREVE */ #define XK_jcircumflex 0x02bc /* U+0135 LATIN SMALL LETTER J WITH CIRCUMFLEX */ #define XK_Cabovedot 0x02c5 /* U+010A LATIN CAPITAL LETTER C WITH DOT ABOVE */ #define XK_Ccircumflex 0x02c6 /* U+0108 LATIN CAPITAL LETTER C WITH CIRCUMFLEX */ #define XK_Gabovedot 0x02d5 /* U+0120 LATIN CAPITAL LETTER G WITH DOT ABOVE */ #define XK_Gcircumflex 0x02d8 /* U+011C LATIN CAPITAL LETTER G WITH CIRCUMFLEX */ #define XK_Ubreve 0x02dd /* U+016C LATIN CAPITAL LETTER U WITH BREVE */ #define XK_Scircumflex 0x02de /* U+015C LATIN CAPITAL LETTER S WITH CIRCUMFLEX */ #define XK_cabovedot 0x02e5 /* U+010B LATIN SMALL LETTER C WITH DOT ABOVE */ #define XK_ccircumflex 0x02e6 /* U+0109 LATIN SMALL LETTER C WITH CIRCUMFLEX */ #define XK_gabovedot 0x02f5 /* U+0121 LATIN SMALL LETTER G WITH DOT ABOVE */ #define XK_gcircumflex 0x02f8 /* U+011D LATIN SMALL LETTER G WITH CIRCUMFLEX */ #define XK_ubreve 0x02fd /* U+016D LATIN SMALL LETTER U WITH BREVE */ #define XK_scircumflex 0x02fe /* U+015D LATIN SMALL LETTER S WITH CIRCUMFLEX */ #endif /* XK_LATIN3 */ /* * Latin 4 * Byte 3 = 3 */ #ifdef XK_LATIN4 #define XK_kra 0x03a2 /* U+0138 LATIN SMALL LETTER KRA */ #define XK_kappa 0x03a2 /* deprecated */ #define XK_Rcedilla 0x03a3 /* U+0156 LATIN CAPITAL LETTER R WITH CEDILLA */ #define XK_Itilde 0x03a5 /* U+0128 LATIN CAPITAL LETTER I WITH TILDE */ #define XK_Lcedilla 0x03a6 /* U+013B LATIN CAPITAL LETTER L WITH CEDILLA */ #define XK_Emacron 0x03aa /* U+0112 LATIN CAPITAL LETTER E WITH MACRON */ #define XK_Gcedilla 0x03ab /* U+0122 LATIN CAPITAL LETTER G WITH CEDILLA */ #define XK_Tslash 0x03ac /* U+0166 LATIN CAPITAL LETTER T WITH STROKE */ #define XK_rcedilla 0x03b3 /* U+0157 LATIN SMALL LETTER R WITH CEDILLA */ #define XK_itilde 0x03b5 /* U+0129 LATIN SMALL LETTER I WITH TILDE */ #define XK_lcedilla 0x03b6 /* U+013C LATIN SMALL LETTER L WITH CEDILLA */ #define XK_emacron 0x03ba /* U+0113 LATIN SMALL LETTER E WITH MACRON */ #define XK_gcedilla 0x03bb /* U+0123 LATIN SMALL LETTER G WITH CEDILLA */ #define XK_tslash 0x03bc /* U+0167 LATIN SMALL LETTER T WITH STROKE */ #define XK_ENG 0x03bd /* U+014A LATIN CAPITAL LETTER ENG */ #define XK_eng 0x03bf /* U+014B LATIN SMALL LETTER ENG */ #define XK_Amacron 0x03c0 /* U+0100 LATIN CAPITAL LETTER A WITH MACRON */ #define XK_Iogonek 0x03c7 /* U+012E LATIN CAPITAL LETTER I WITH OGONEK */ #define XK_Eabovedot 0x03cc /* U+0116 LATIN CAPITAL LETTER E WITH DOT ABOVE */ #define XK_Imacron 0x03cf /* U+012A LATIN CAPITAL LETTER I WITH MACRON */ #define XK_Ncedilla 0x03d1 /* U+0145 LATIN CAPITAL LETTER N WITH CEDILLA */ #define XK_Omacron 0x03d2 /* U+014C LATIN CAPITAL LETTER O WITH MACRON */ #define XK_Kcedilla 0x03d3 /* U+0136 LATIN CAPITAL LETTER K WITH CEDILLA */ #define XK_Uogonek 0x03d9 /* U+0172 LATIN CAPITAL LETTER U WITH OGONEK */ #define XK_Utilde 0x03dd /* U+0168 LATIN CAPITAL LETTER U WITH TILDE */ #define XK_Umacron 0x03de /* U+016A LATIN CAPITAL LETTER U WITH MACRON */ #define XK_amacron 0x03e0 /* U+0101 LATIN SMALL LETTER A WITH MACRON */ #define XK_iogonek 0x03e7 /* U+012F LATIN SMALL LETTER I WITH OGONEK */ #define XK_eabovedot 0x03ec /* U+0117 LATIN SMALL LETTER E WITH DOT ABOVE */ #define XK_imacron 0x03ef /* U+012B LATIN SMALL LETTER I WITH MACRON */ #define XK_ncedilla 0x03f1 /* U+0146 LATIN SMALL LETTER N WITH CEDILLA */ #define XK_omacron 0x03f2 /* U+014D LATIN SMALL LETTER O WITH MACRON */ #define XK_kcedilla 0x03f3 /* U+0137 LATIN SMALL LETTER K WITH CEDILLA */ #define XK_uogonek 0x03f9 /* U+0173 LATIN SMALL LETTER U WITH OGONEK */ #define XK_utilde 0x03fd /* U+0169 LATIN SMALL LETTER U WITH TILDE */ #define XK_umacron 0x03fe /* U+016B LATIN SMALL LETTER U WITH MACRON */ #endif /* XK_LATIN4 */ /* * Latin 8 */ #ifdef XK_LATIN8 #define XK_Wcircumflex 0x1000174 /* U+0174 LATIN CAPITAL LETTER W WITH CIRCUMFLEX */ #define XK_wcircumflex 0x1000175 /* U+0175 LATIN SMALL LETTER W WITH CIRCUMFLEX */ #define XK_Ycircumflex 0x1000176 /* U+0176 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX */ #define XK_ycircumflex 0x1000177 /* U+0177 LATIN SMALL LETTER Y WITH CIRCUMFLEX */ #define XK_Babovedot 0x1001e02 /* U+1E02 LATIN CAPITAL LETTER B WITH DOT ABOVE */ #define XK_babovedot 0x1001e03 /* U+1E03 LATIN SMALL LETTER B WITH DOT ABOVE */ #define XK_Dabovedot 0x1001e0a /* U+1E0A LATIN CAPITAL LETTER D WITH DOT ABOVE */ #define XK_dabovedot 0x1001e0b /* U+1E0B LATIN SMALL LETTER D WITH DOT ABOVE */ #define XK_Fabovedot 0x1001e1e /* U+1E1E LATIN CAPITAL LETTER F WITH DOT ABOVE */ #define XK_fabovedot 0x1001e1f /* U+1E1F LATIN SMALL LETTER F WITH DOT ABOVE */ #define XK_Mabovedot 0x1001e40 /* U+1E40 LATIN CAPITAL LETTER M WITH DOT ABOVE */ #define XK_mabovedot 0x1001e41 /* U+1E41 LATIN SMALL LETTER M WITH DOT ABOVE */ #define XK_Pabovedot 0x1001e56 /* U+1E56 LATIN CAPITAL LETTER P WITH DOT ABOVE */ #define XK_pabovedot 0x1001e57 /* U+1E57 LATIN SMALL LETTER P WITH DOT ABOVE */ #define XK_Sabovedot 0x1001e60 /* U+1E60 LATIN CAPITAL LETTER S WITH DOT ABOVE */ #define XK_sabovedot 0x1001e61 /* U+1E61 LATIN SMALL LETTER S WITH DOT ABOVE */ #define XK_Tabovedot 0x1001e6a /* U+1E6A LATIN CAPITAL LETTER T WITH DOT ABOVE */ #define XK_tabovedot 0x1001e6b /* U+1E6B LATIN SMALL LETTER T WITH DOT ABOVE */ #define XK_Wgrave 0x1001e80 /* U+1E80 LATIN CAPITAL LETTER W WITH GRAVE */ #define XK_wgrave 0x1001e81 /* U+1E81 LATIN SMALL LETTER W WITH GRAVE */ #define XK_Wacute 0x1001e82 /* U+1E82 LATIN CAPITAL LETTER W WITH ACUTE */ #define XK_wacute 0x1001e83 /* U+1E83 LATIN SMALL LETTER W WITH ACUTE */ #define XK_Wdiaeresis 0x1001e84 /* U+1E84 LATIN CAPITAL LETTER W WITH DIAERESIS */ #define XK_wdiaeresis 0x1001e85 /* U+1E85 LATIN SMALL LETTER W WITH DIAERESIS */ #define XK_Ygrave 0x1001ef2 /* U+1EF2 LATIN CAPITAL LETTER Y WITH GRAVE */ #define XK_ygrave 0x1001ef3 /* U+1EF3 LATIN SMALL LETTER Y WITH GRAVE */ #endif /* XK_LATIN8 */ /* * Latin 9 * Byte 3 = 0x13 */ #ifdef XK_LATIN9 #define XK_OE 0x13bc /* U+0152 LATIN CAPITAL LIGATURE OE */ #define XK_oe 0x13bd /* U+0153 LATIN SMALL LIGATURE OE */ #define XK_Ydiaeresis 0x13be /* U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS */ #endif /* XK_LATIN9 */ /* * Katakana * Byte 3 = 4 */ #ifdef XK_KATAKANA #define XK_overline 0x047e /* U+203E OVERLINE */ #define XK_kana_fullstop 0x04a1 /* U+3002 IDEOGRAPHIC FULL STOP */ #define XK_kana_openingbracket 0x04a2 /* U+300C LEFT CORNER BRACKET */ #define XK_kana_closingbracket 0x04a3 /* U+300D RIGHT CORNER BRACKET */ #define XK_kana_comma 0x04a4 /* U+3001 IDEOGRAPHIC COMMA */ #define XK_kana_conjunctive 0x04a5 /* U+30FB KATAKANA MIDDLE DOT */ #define XK_kana_middledot 0x04a5 /* deprecated */ #define XK_kana_WO 0x04a6 /* U+30F2 KATAKANA LETTER WO */ #define XK_kana_a 0x04a7 /* U+30A1 KATAKANA LETTER SMALL A */ #define XK_kana_i 0x04a8 /* U+30A3 KATAKANA LETTER SMALL I */ #define XK_kana_u 0x04a9 /* U+30A5 KATAKANA LETTER SMALL U */ #define XK_kana_e 0x04aa /* U+30A7 KATAKANA LETTER SMALL E */ #define XK_kana_o 0x04ab /* U+30A9 KATAKANA LETTER SMALL O */ #define XK_kana_ya 0x04ac /* U+30E3 KATAKANA LETTER SMALL YA */ #define XK_kana_yu 0x04ad /* U+30E5 KATAKANA LETTER SMALL YU */ #define XK_kana_yo 0x04ae /* U+30E7 KATAKANA LETTER SMALL YO */ #define XK_kana_tsu 0x04af /* U+30C3 KATAKANA LETTER SMALL TU */ #define XK_kana_tu 0x04af /* deprecated */ #define XK_prolongedsound 0x04b0 /* U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK */ #define XK_kana_A 0x04b1 /* U+30A2 KATAKANA LETTER A */ #define XK_kana_I 0x04b2 /* U+30A4 KATAKANA LETTER I */ #define XK_kana_U 0x04b3 /* U+30A6 KATAKANA LETTER U */ #define XK_kana_E 0x04b4 /* U+30A8 KATAKANA LETTER E */ #define XK_kana_O 0x04b5 /* U+30AA KATAKANA LETTER O */ #define XK_kana_KA 0x04b6 /* U+30AB KATAKANA LETTER KA */ #define XK_kana_KI 0x04b7 /* U+30AD KATAKANA LETTER KI */ #define XK_kana_KU 0x04b8 /* U+30AF KATAKANA LETTER KU */ #define XK_kana_KE 0x04b9 /* U+30B1 KATAKANA LETTER KE */ #define XK_kana_KO 0x04ba /* U+30B3 KATAKANA LETTER KO */ #define XK_kana_SA 0x04bb /* U+30B5 KATAKANA LETTER SA */ #define XK_kana_SHI 0x04bc /* U+30B7 KATAKANA LETTER SI */ #define XK_kana_SU 0x04bd /* U+30B9 KATAKANA LETTER SU */ #define XK_kana_SE 0x04be /* U+30BB KATAKANA LETTER SE */ #define XK_kana_SO 0x04bf /* U+30BD KATAKANA LETTER SO */ #define XK_kana_TA 0x04c0 /* U+30BF KATAKANA LETTER TA */ #define XK_kana_CHI 0x04c1 /* U+30C1 KATAKANA LETTER TI */ #define XK_kana_TI 0x04c1 /* deprecated */ #define XK_kana_TSU 0x04c2 /* U+30C4 KATAKANA LETTER TU */ #define XK_kana_TU 0x04c2 /* deprecated */ #define XK_kana_TE 0x04c3 /* U+30C6 KATAKANA LETTER TE */ #define XK_kana_TO 0x04c4 /* U+30C8 KATAKANA LETTER TO */ #define XK_kana_NA 0x04c5 /* U+30CA KATAKANA LETTER NA */ #define XK_kana_NI 0x04c6 /* U+30CB KATAKANA LETTER NI */ #define XK_kana_NU 0x04c7 /* U+30CC KATAKANA LETTER NU */ #define XK_kana_NE 0x04c8 /* U+30CD KATAKANA LETTER NE */ #define XK_kana_NO 0x04c9 /* U+30CE KATAKANA LETTER NO */ #define XK_kana_HA 0x04ca /* U+30CF KATAKANA LETTER HA */ #define XK_kana_HI 0x04cb /* U+30D2 KATAKANA LETTER HI */ #define XK_kana_FU 0x04cc /* U+30D5 KATAKANA LETTER HU */ #define XK_kana_HU 0x04cc /* deprecated */ #define XK_kana_HE 0x04cd /* U+30D8 KATAKANA LETTER HE */ #define XK_kana_HO 0x04ce /* U+30DB KATAKANA LETTER HO */ #define XK_kana_MA 0x04cf /* U+30DE KATAKANA LETTER MA */ #define XK_kana_MI 0x04d0 /* U+30DF KATAKANA LETTER MI */ #define XK_kana_MU 0x04d1 /* U+30E0 KATAKANA LETTER MU */ #define XK_kana_ME 0x04d2 /* U+30E1 KATAKANA LETTER ME */ #define XK_kana_MO 0x04d3 /* U+30E2 KATAKANA LETTER MO */ #define XK_kana_YA 0x04d4 /* U+30E4 KATAKANA LETTER YA */ #define XK_kana_YU 0x04d5 /* U+30E6 KATAKANA LETTER YU */ #define XK_kana_YO 0x04d6 /* U+30E8 KATAKANA LETTER YO */ #define XK_kana_RA 0x04d7 /* U+30E9 KATAKANA LETTER RA */ #define XK_kana_RI 0x04d8 /* U+30EA KATAKANA LETTER RI */ #define XK_kana_RU 0x04d9 /* U+30EB KATAKANA LETTER RU */ #define XK_kana_RE 0x04da /* U+30EC KATAKANA LETTER RE */ #define XK_kana_RO 0x04db /* U+30ED KATAKANA LETTER RO */ #define XK_kana_WA 0x04dc /* U+30EF KATAKANA LETTER WA */ #define XK_kana_N 0x04dd /* U+30F3 KATAKANA LETTER N */ #define XK_voicedsound 0x04de /* U+309B KATAKANA-HIRAGANA VOICED SOUND MARK */ #define XK_semivoicedsound 0x04df /* U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */ #define XK_kana_switch 0xff7e /* Alias for mode_switch */ #endif /* XK_KATAKANA */ /* * Arabic * Byte 3 = 5 */ #ifdef XK_ARABIC #define XK_Farsi_0 0x10006f0 /* U+06F0 EXTENDED ARABIC-INDIC DIGIT ZERO */ #define XK_Farsi_1 0x10006f1 /* U+06F1 EXTENDED ARABIC-INDIC DIGIT ONE */ #define XK_Farsi_2 0x10006f2 /* U+06F2 EXTENDED ARABIC-INDIC DIGIT TWO */ #define XK_Farsi_3 0x10006f3 /* U+06F3 EXTENDED ARABIC-INDIC DIGIT THREE */ #define XK_Farsi_4 0x10006f4 /* U+06F4 EXTENDED ARABIC-INDIC DIGIT FOUR */ #define XK_Farsi_5 0x10006f5 /* U+06F5 EXTENDED ARABIC-INDIC DIGIT FIVE */ #define XK_Farsi_6 0x10006f6 /* U+06F6 EXTENDED ARABIC-INDIC DIGIT SIX */ #define XK_Farsi_7 0x10006f7 /* U+06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN */ #define XK_Farsi_8 0x10006f8 /* U+06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT */ #define XK_Farsi_9 0x10006f9 /* U+06F9 EXTENDED ARABIC-INDIC DIGIT NINE */ #define XK_Arabic_percent 0x100066a /* U+066A ARABIC PERCENT SIGN */ #define XK_Arabic_superscript_alef 0x1000670 /* U+0670 ARABIC LETTER SUPERSCRIPT ALEF */ #define XK_Arabic_tteh 0x1000679 /* U+0679 ARABIC LETTER TTEH */ #define XK_Arabic_peh 0x100067e /* U+067E ARABIC LETTER PEH */ #define XK_Arabic_tcheh 0x1000686 /* U+0686 ARABIC LETTER TCHEH */ #define XK_Arabic_ddal 0x1000688 /* U+0688 ARABIC LETTER DDAL */ #define XK_Arabic_rreh 0x1000691 /* U+0691 ARABIC LETTER RREH */ #define XK_Arabic_comma 0x05ac /* U+060C ARABIC COMMA */ #define XK_Arabic_fullstop 0x10006d4 /* U+06D4 ARABIC FULL STOP */ #define XK_Arabic_0 0x1000660 /* U+0660 ARABIC-INDIC DIGIT ZERO */ #define XK_Arabic_1 0x1000661 /* U+0661 ARABIC-INDIC DIGIT ONE */ #define XK_Arabic_2 0x1000662 /* U+0662 ARABIC-INDIC DIGIT TWO */ #define XK_Arabic_3 0x1000663 /* U+0663 ARABIC-INDIC DIGIT THREE */ #define XK_Arabic_4 0x1000664 /* U+0664 ARABIC-INDIC DIGIT FOUR */ #define XK_Arabic_5 0x1000665 /* U+0665 ARABIC-INDIC DIGIT FIVE */ #define XK_Arabic_6 0x1000666 /* U+0666 ARABIC-INDIC DIGIT SIX */ #define XK_Arabic_7 0x1000667 /* U+0667 ARABIC-INDIC DIGIT SEVEN */ #define XK_Arabic_8 0x1000668 /* U+0668 ARABIC-INDIC DIGIT EIGHT */ #define XK_Arabic_9 0x1000669 /* U+0669 ARABIC-INDIC DIGIT NINE */ #define XK_Arabic_semicolon 0x05bb /* U+061B ARABIC SEMICOLON */ #define XK_Arabic_question_mark 0x05bf /* U+061F ARABIC QUESTION MARK */ #define XK_Arabic_hamza 0x05c1 /* U+0621 ARABIC LETTER HAMZA */ #define XK_Arabic_maddaonalef 0x05c2 /* U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE */ #define XK_Arabic_hamzaonalef 0x05c3 /* U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE */ #define XK_Arabic_hamzaonwaw 0x05c4 /* U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE */ #define XK_Arabic_hamzaunderalef 0x05c5 /* U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW */ #define XK_Arabic_hamzaonyeh 0x05c6 /* U+0626 ARABIC LETTER YEH WITH HAMZA ABOVE */ #define XK_Arabic_alef 0x05c7 /* U+0627 ARABIC LETTER ALEF */ #define XK_Arabic_beh 0x05c8 /* U+0628 ARABIC LETTER BEH */ #define XK_Arabic_tehmarbuta 0x05c9 /* U+0629 ARABIC LETTER TEH MARBUTA */ #define XK_Arabic_teh 0x05ca /* U+062A ARABIC LETTER TEH */ #define XK_Arabic_theh 0x05cb /* U+062B ARABIC LETTER THEH */ #define XK_Arabic_jeem 0x05cc /* U+062C ARABIC LETTER JEEM */ #define XK_Arabic_hah 0x05cd /* U+062D ARABIC LETTER HAH */ #define XK_Arabic_khah 0x05ce /* U+062E ARABIC LETTER KHAH */ #define XK_Arabic_dal 0x05cf /* U+062F ARABIC LETTER DAL */ #define XK_Arabic_thal 0x05d0 /* U+0630 ARABIC LETTER THAL */ #define XK_Arabic_ra 0x05d1 /* U+0631 ARABIC LETTER REH */ #define XK_Arabic_zain 0x05d2 /* U+0632 ARABIC LETTER ZAIN */ #define XK_Arabic_seen 0x05d3 /* U+0633 ARABIC LETTER SEEN */ #define XK_Arabic_sheen 0x05d4 /* U+0634 ARABIC LETTER SHEEN */ #define XK_Arabic_sad 0x05d5 /* U+0635 ARABIC LETTER SAD */ #define XK_Arabic_dad 0x05d6 /* U+0636 ARABIC LETTER DAD */ #define XK_Arabic_tah 0x05d7 /* U+0637 ARABIC LETTER TAH */ #define XK_Arabic_zah 0x05d8 /* U+0638 ARABIC LETTER ZAH */ #define XK_Arabic_ain 0x05d9 /* U+0639 ARABIC LETTER AIN */ #define XK_Arabic_ghain 0x05da /* U+063A ARABIC LETTER GHAIN */ #define XK_Arabic_tatweel 0x05e0 /* U+0640 ARABIC TATWEEL */ #define XK_Arabic_feh 0x05e1 /* U+0641 ARABIC LETTER FEH */ #define XK_Arabic_qaf 0x05e2 /* U+0642 ARABIC LETTER QAF */ #define XK_Arabic_kaf 0x05e3 /* U+0643 ARABIC LETTER KAF */ #define XK_Arabic_lam 0x05e4 /* U+0644 ARABIC LETTER LAM */ #define XK_Arabic_meem 0x05e5 /* U+0645 ARABIC LETTER MEEM */ #define XK_Arabic_noon 0x05e6 /* U+0646 ARABIC LETTER NOON */ #define XK_Arabic_ha 0x05e7 /* U+0647 ARABIC LETTER HEH */ #define XK_Arabic_heh 0x05e7 /* deprecated */ #define XK_Arabic_waw 0x05e8 /* U+0648 ARABIC LETTER WAW */ #define XK_Arabic_alefmaksura 0x05e9 /* U+0649 ARABIC LETTER ALEF MAKSURA */ #define XK_Arabic_yeh 0x05ea /* U+064A ARABIC LETTER YEH */ #define XK_Arabic_fathatan 0x05eb /* U+064B ARABIC FATHATAN */ #define XK_Arabic_dammatan 0x05ec /* U+064C ARABIC DAMMATAN */ #define XK_Arabic_kasratan 0x05ed /* U+064D ARABIC KASRATAN */ #define XK_Arabic_fatha 0x05ee /* U+064E ARABIC FATHA */ #define XK_Arabic_damma 0x05ef /* U+064F ARABIC DAMMA */ #define XK_Arabic_kasra 0x05f0 /* U+0650 ARABIC KASRA */ #define XK_Arabic_shadda 0x05f1 /* U+0651 ARABIC SHADDA */ #define XK_Arabic_sukun 0x05f2 /* U+0652 ARABIC SUKUN */ #define XK_Arabic_madda_above 0x1000653 /* U+0653 ARABIC MADDAH ABOVE */ #define XK_Arabic_hamza_above 0x1000654 /* U+0654 ARABIC HAMZA ABOVE */ #define XK_Arabic_hamza_below 0x1000655 /* U+0655 ARABIC HAMZA BELOW */ #define XK_Arabic_jeh 0x1000698 /* U+0698 ARABIC LETTER JEH */ #define XK_Arabic_veh 0x10006a4 /* U+06A4 ARABIC LETTER VEH */ #define XK_Arabic_keheh 0x10006a9 /* U+06A9 ARABIC LETTER KEHEH */ #define XK_Arabic_gaf 0x10006af /* U+06AF ARABIC LETTER GAF */ #define XK_Arabic_noon_ghunna 0x10006ba /* U+06BA ARABIC LETTER NOON GHUNNA */ #define XK_Arabic_heh_doachashmee 0x10006be /* U+06BE ARABIC LETTER HEH DOACHASHMEE */ #define XK_Farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */ #define XK_Arabic_farsi_yeh 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */ #define XK_Arabic_yeh_baree 0x10006d2 /* U+06D2 ARABIC LETTER YEH BARREE */ #define XK_Arabic_heh_goal 0x10006c1 /* U+06C1 ARABIC LETTER HEH GOAL */ #define XK_Arabic_switch 0xff7e /* Alias for mode_switch */ #endif /* XK_ARABIC */ /* * Cyrillic * Byte 3 = 6 */ #ifdef XK_CYRILLIC #define XK_Cyrillic_GHE_bar 0x1000492 /* U+0492 CYRILLIC CAPITAL LETTER GHE WITH STROKE */ #define XK_Cyrillic_ghe_bar 0x1000493 /* U+0493 CYRILLIC SMALL LETTER GHE WITH STROKE */ #define XK_Cyrillic_ZHE_descender 0x1000496 /* U+0496 CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER */ #define XK_Cyrillic_zhe_descender 0x1000497 /* U+0497 CYRILLIC SMALL LETTER ZHE WITH DESCENDER */ #define XK_Cyrillic_KA_descender 0x100049a /* U+049A CYRILLIC CAPITAL LETTER KA WITH DESCENDER */ #define XK_Cyrillic_ka_descender 0x100049b /* U+049B CYRILLIC SMALL LETTER KA WITH DESCENDER */ #define XK_Cyrillic_KA_vertstroke 0x100049c /* U+049C CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE */ #define XK_Cyrillic_ka_vertstroke 0x100049d /* U+049D CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE */ #define XK_Cyrillic_EN_descender 0x10004a2 /* U+04A2 CYRILLIC CAPITAL LETTER EN WITH DESCENDER */ #define XK_Cyrillic_en_descender 0x10004a3 /* U+04A3 CYRILLIC SMALL LETTER EN WITH DESCENDER */ #define XK_Cyrillic_U_straight 0x10004ae /* U+04AE CYRILLIC CAPITAL LETTER STRAIGHT U */ #define XK_Cyrillic_u_straight 0x10004af /* U+04AF CYRILLIC SMALL LETTER STRAIGHT U */ #define XK_Cyrillic_U_straight_bar 0x10004b0 /* U+04B0 CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE */ #define XK_Cyrillic_u_straight_bar 0x10004b1 /* U+04B1 CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE */ #define XK_Cyrillic_HA_descender 0x10004b2 /* U+04B2 CYRILLIC CAPITAL LETTER HA WITH DESCENDER */ #define XK_Cyrillic_ha_descender 0x10004b3 /* U+04B3 CYRILLIC SMALL LETTER HA WITH DESCENDER */ #define XK_Cyrillic_CHE_descender 0x10004b6 /* U+04B6 CYRILLIC CAPITAL LETTER CHE WITH DESCENDER */ #define XK_Cyrillic_che_descender 0x10004b7 /* U+04B7 CYRILLIC SMALL LETTER CHE WITH DESCENDER */ #define XK_Cyrillic_CHE_vertstroke 0x10004b8 /* U+04B8 CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE */ #define XK_Cyrillic_che_vertstroke 0x10004b9 /* U+04B9 CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE */ #define XK_Cyrillic_SHHA 0x10004ba /* U+04BA CYRILLIC CAPITAL LETTER SHHA */ #define XK_Cyrillic_shha 0x10004bb /* U+04BB CYRILLIC SMALL LETTER SHHA */ #define XK_Cyrillic_SCHWA 0x10004d8 /* U+04D8 CYRILLIC CAPITAL LETTER SCHWA */ #define XK_Cyrillic_schwa 0x10004d9 /* U+04D9 CYRILLIC SMALL LETTER SCHWA */ #define XK_Cyrillic_I_macron 0x10004e2 /* U+04E2 CYRILLIC CAPITAL LETTER I WITH MACRON */ #define XK_Cyrillic_i_macron 0x10004e3 /* U+04E3 CYRILLIC SMALL LETTER I WITH MACRON */ #define XK_Cyrillic_O_bar 0x10004e8 /* U+04E8 CYRILLIC CAPITAL LETTER BARRED O */ #define XK_Cyrillic_o_bar 0x10004e9 /* U+04E9 CYRILLIC SMALL LETTER BARRED O */ #define XK_Cyrillic_U_macron 0x10004ee /* U+04EE CYRILLIC CAPITAL LETTER U WITH MACRON */ #define XK_Cyrillic_u_macron 0x10004ef /* U+04EF CYRILLIC SMALL LETTER U WITH MACRON */ #define XK_Serbian_dje 0x06a1 /* U+0452 CYRILLIC SMALL LETTER DJE */ #define XK_Macedonia_gje 0x06a2 /* U+0453 CYRILLIC SMALL LETTER GJE */ #define XK_Cyrillic_io 0x06a3 /* U+0451 CYRILLIC SMALL LETTER IO */ #define XK_Ukrainian_ie 0x06a4 /* U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE */ #define XK_Ukranian_je 0x06a4 /* deprecated */ #define XK_Macedonia_dse 0x06a5 /* U+0455 CYRILLIC SMALL LETTER DZE */ #define XK_Ukrainian_i 0x06a6 /* U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */ #define XK_Ukranian_i 0x06a6 /* deprecated */ #define XK_Ukrainian_yi 0x06a7 /* U+0457 CYRILLIC SMALL LETTER YI */ #define XK_Ukranian_yi 0x06a7 /* deprecated */ #define XK_Cyrillic_je 0x06a8 /* U+0458 CYRILLIC SMALL LETTER JE */ #define XK_Serbian_je 0x06a8 /* deprecated */ #define XK_Cyrillic_lje 0x06a9 /* U+0459 CYRILLIC SMALL LETTER LJE */ #define XK_Serbian_lje 0x06a9 /* deprecated */ #define XK_Cyrillic_nje 0x06aa /* U+045A CYRILLIC SMALL LETTER NJE */ #define XK_Serbian_nje 0x06aa /* deprecated */ #define XK_Serbian_tshe 0x06ab /* U+045B CYRILLIC SMALL LETTER TSHE */ #define XK_Macedonia_kje 0x06ac /* U+045C CYRILLIC SMALL LETTER KJE */ #define XK_Ukrainian_ghe_with_upturn 0x06ad /* U+0491 CYRILLIC SMALL LETTER GHE WITH UPTURN */ #define XK_Byelorussian_shortu 0x06ae /* U+045E CYRILLIC SMALL LETTER SHORT U */ #define XK_Cyrillic_dzhe 0x06af /* U+045F CYRILLIC SMALL LETTER DZHE */ #define XK_Serbian_dze 0x06af /* deprecated */ #define XK_numerosign 0x06b0 /* U+2116 NUMERO SIGN */ #define XK_Serbian_DJE 0x06b1 /* U+0402 CYRILLIC CAPITAL LETTER DJE */ #define XK_Macedonia_GJE 0x06b2 /* U+0403 CYRILLIC CAPITAL LETTER GJE */ #define XK_Cyrillic_IO 0x06b3 /* U+0401 CYRILLIC CAPITAL LETTER IO */ #define XK_Ukrainian_IE 0x06b4 /* U+0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE */ #define XK_Ukranian_JE 0x06b4 /* deprecated */ #define XK_Macedonia_DSE 0x06b5 /* U+0405 CYRILLIC CAPITAL LETTER DZE */ #define XK_Ukrainian_I 0x06b6 /* U+0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */ #define XK_Ukranian_I 0x06b6 /* deprecated */ #define XK_Ukrainian_YI 0x06b7 /* U+0407 CYRILLIC CAPITAL LETTER YI */ #define XK_Ukranian_YI 0x06b7 /* deprecated */ #define XK_Cyrillic_JE 0x06b8 /* U+0408 CYRILLIC CAPITAL LETTER JE */ #define XK_Serbian_JE 0x06b8 /* deprecated */ #define XK_Cyrillic_LJE 0x06b9 /* U+0409 CYRILLIC CAPITAL LETTER LJE */ #define XK_Serbian_LJE 0x06b9 /* deprecated */ #define XK_Cyrillic_NJE 0x06ba /* U+040A CYRILLIC CAPITAL LETTER NJE */ #define XK_Serbian_NJE 0x06ba /* deprecated */ #define XK_Serbian_TSHE 0x06bb /* U+040B CYRILLIC CAPITAL LETTER TSHE */ #define XK_Macedonia_KJE 0x06bc /* U+040C CYRILLIC CAPITAL LETTER KJE */ #define XK_Ukrainian_GHE_WITH_UPTURN 0x06bd /* U+0490 CYRILLIC CAPITAL LETTER GHE WITH UPTURN */ #define XK_Byelorussian_SHORTU 0x06be /* U+040E CYRILLIC CAPITAL LETTER SHORT U */ #define XK_Cyrillic_DZHE 0x06bf /* U+040F CYRILLIC CAPITAL LETTER DZHE */ #define XK_Serbian_DZE 0x06bf /* deprecated */ #define XK_Cyrillic_yu 0x06c0 /* U+044E CYRILLIC SMALL LETTER YU */ #define XK_Cyrillic_a 0x06c1 /* U+0430 CYRILLIC SMALL LETTER A */ #define XK_Cyrillic_be 0x06c2 /* U+0431 CYRILLIC SMALL LETTER BE */ #define XK_Cyrillic_tse 0x06c3 /* U+0446 CYRILLIC SMALL LETTER TSE */ #define XK_Cyrillic_de 0x06c4 /* U+0434 CYRILLIC SMALL LETTER DE */ #define XK_Cyrillic_ie 0x06c5 /* U+0435 CYRILLIC SMALL LETTER IE */ #define XK_Cyrillic_ef 0x06c6 /* U+0444 CYRILLIC SMALL LETTER EF */ #define XK_Cyrillic_ghe 0x06c7 /* U+0433 CYRILLIC SMALL LETTER GHE */ #define XK_Cyrillic_ha 0x06c8 /* U+0445 CYRILLIC SMALL LETTER HA */ #define XK_Cyrillic_i 0x06c9 /* U+0438 CYRILLIC SMALL LETTER I */ #define XK_Cyrillic_shorti 0x06ca /* U+0439 CYRILLIC SMALL LETTER SHORT I */ #define XK_Cyrillic_ka 0x06cb /* U+043A CYRILLIC SMALL LETTER KA */ #define XK_Cyrillic_el 0x06cc /* U+043B CYRILLIC SMALL LETTER EL */ #define XK_Cyrillic_em 0x06cd /* U+043C CYRILLIC SMALL LETTER EM */ #define XK_Cyrillic_en 0x06ce /* U+043D CYRILLIC SMALL LETTER EN */ #define XK_Cyrillic_o 0x06cf /* U+043E CYRILLIC SMALL LETTER O */ #define XK_Cyrillic_pe 0x06d0 /* U+043F CYRILLIC SMALL LETTER PE */ #define XK_Cyrillic_ya 0x06d1 /* U+044F CYRILLIC SMALL LETTER YA */ #define XK_Cyrillic_er 0x06d2 /* U+0440 CYRILLIC SMALL LETTER ER */ #define XK_Cyrillic_es 0x06d3 /* U+0441 CYRILLIC SMALL LETTER ES */ #define XK_Cyrillic_te 0x06d4 /* U+0442 CYRILLIC SMALL LETTER TE */ #define XK_Cyrillic_u 0x06d5 /* U+0443 CYRILLIC SMALL LETTER U */ #define XK_Cyrillic_zhe 0x06d6 /* U+0436 CYRILLIC SMALL LETTER ZHE */ #define XK_Cyrillic_ve 0x06d7 /* U+0432 CYRILLIC SMALL LETTER VE */ #define XK_Cyrillic_softsign 0x06d8 /* U+044C CYRILLIC SMALL LETTER SOFT SIGN */ #define XK_Cyrillic_yeru 0x06d9 /* U+044B CYRILLIC SMALL LETTER YERU */ #define XK_Cyrillic_ze 0x06da /* U+0437 CYRILLIC SMALL LETTER ZE */ #define XK_Cyrillic_sha 0x06db /* U+0448 CYRILLIC SMALL LETTER SHA */ #define XK_Cyrillic_e 0x06dc /* U+044D CYRILLIC SMALL LETTER E */ #define XK_Cyrillic_shcha 0x06dd /* U+0449 CYRILLIC SMALL LETTER SHCHA */ #define XK_Cyrillic_che 0x06de /* U+0447 CYRILLIC SMALL LETTER CHE */ #define XK_Cyrillic_hardsign 0x06df /* U+044A CYRILLIC SMALL LETTER HARD SIGN */ #define XK_Cyrillic_YU 0x06e0 /* U+042E CYRILLIC CAPITAL LETTER YU */ #define XK_Cyrillic_A 0x06e1 /* U+0410 CYRILLIC CAPITAL LETTER A */ #define XK_Cyrillic_BE 0x06e2 /* U+0411 CYRILLIC CAPITAL LETTER BE */ #define XK_Cyrillic_TSE 0x06e3 /* U+0426 CYRILLIC CAPITAL LETTER TSE */ #define XK_Cyrillic_DE 0x06e4 /* U+0414 CYRILLIC CAPITAL LETTER DE */ #define XK_Cyrillic_IE 0x06e5 /* U+0415 CYRILLIC CAPITAL LETTER IE */ #define XK_Cyrillic_EF 0x06e6 /* U+0424 CYRILLIC CAPITAL LETTER EF */ #define XK_Cyrillic_GHE 0x06e7 /* U+0413 CYRILLIC CAPITAL LETTER GHE */ #define XK_Cyrillic_HA 0x06e8 /* U+0425 CYRILLIC CAPITAL LETTER HA */ #define XK_Cyrillic_I 0x06e9 /* U+0418 CYRILLIC CAPITAL LETTER I */ #define XK_Cyrillic_SHORTI 0x06ea /* U+0419 CYRILLIC CAPITAL LETTER SHORT I */ #define XK_Cyrillic_KA 0x06eb /* U+041A CYRILLIC CAPITAL LETTER KA */ #define XK_Cyrillic_EL 0x06ec /* U+041B CYRILLIC CAPITAL LETTER EL */ #define XK_Cyrillic_EM 0x06ed /* U+041C CYRILLIC CAPITAL LETTER EM */ #define XK_Cyrillic_EN 0x06ee /* U+041D CYRILLIC CAPITAL LETTER EN */ #define XK_Cyrillic_O 0x06ef /* U+041E CYRILLIC CAPITAL LETTER O */ #define XK_Cyrillic_PE 0x06f0 /* U+041F CYRILLIC CAPITAL LETTER PE */ #define XK_Cyrillic_YA 0x06f1 /* U+042F CYRILLIC CAPITAL LETTER YA */ #define XK_Cyrillic_ER 0x06f2 /* U+0420 CYRILLIC CAPITAL LETTER ER */ #define XK_Cyrillic_ES 0x06f3 /* U+0421 CYRILLIC CAPITAL LETTER ES */ #define XK_Cyrillic_TE 0x06f4 /* U+0422 CYRILLIC CAPITAL LETTER TE */ #define XK_Cyrillic_U 0x06f5 /* U+0423 CYRILLIC CAPITAL LETTER U */ #define XK_Cyrillic_ZHE 0x06f6 /* U+0416 CYRILLIC CAPITAL LETTER ZHE */ #define XK_Cyrillic_VE 0x06f7 /* U+0412 CYRILLIC CAPITAL LETTER VE */ #define XK_Cyrillic_SOFTSIGN 0x06f8 /* U+042C CYRILLIC CAPITAL LETTER SOFT SIGN */ #define XK_Cyrillic_YERU 0x06f9 /* U+042B CYRILLIC CAPITAL LETTER YERU */ #define XK_Cyrillic_ZE 0x06fa /* U+0417 CYRILLIC CAPITAL LETTER ZE */ #define XK_Cyrillic_SHA 0x06fb /* U+0428 CYRILLIC CAPITAL LETTER SHA */ #define XK_Cyrillic_E 0x06fc /* U+042D CYRILLIC CAPITAL LETTER E */ #define XK_Cyrillic_SHCHA 0x06fd /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */ #define XK_Cyrillic_CHE 0x06fe /* U+0427 CYRILLIC CAPITAL LETTER CHE */ #define XK_Cyrillic_HARDSIGN 0x06ff /* U+042A CYRILLIC CAPITAL LETTER HARD SIGN */ #endif /* XK_CYRILLIC */ /* * Greek * (based on an early draft of, and not quite identical to, ISO/IEC 8859-7) * Byte 3 = 7 */ #ifdef XK_GREEK #define XK_Greek_ALPHAaccent 0x07a1 /* U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS */ #define XK_Greek_EPSILONaccent 0x07a2 /* U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS */ #define XK_Greek_ETAaccent 0x07a3 /* U+0389 GREEK CAPITAL LETTER ETA WITH TONOS */ #define XK_Greek_IOTAaccent 0x07a4 /* U+038A GREEK CAPITAL LETTER IOTA WITH TONOS */ #define XK_Greek_IOTAdieresis 0x07a5 /* U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */ #define XK_Greek_IOTAdiaeresis 0x07a5 /* old typo */ #define XK_Greek_OMICRONaccent 0x07a7 /* U+038C GREEK CAPITAL LETTER OMICRON WITH TONOS */ #define XK_Greek_UPSILONaccent 0x07a8 /* U+038E GREEK CAPITAL LETTER UPSILON WITH TONOS */ #define XK_Greek_UPSILONdieresis 0x07a9 /* U+03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */ #define XK_Greek_OMEGAaccent 0x07ab /* U+038F GREEK CAPITAL LETTER OMEGA WITH TONOS */ #define XK_Greek_accentdieresis 0x07ae /* U+0385 GREEK DIALYTIKA TONOS */ #define XK_Greek_horizbar 0x07af /* U+2015 HORIZONTAL BAR */ #define XK_Greek_alphaaccent 0x07b1 /* U+03AC GREEK SMALL LETTER ALPHA WITH TONOS */ #define XK_Greek_epsilonaccent 0x07b2 /* U+03AD GREEK SMALL LETTER EPSILON WITH TONOS */ #define XK_Greek_etaaccent 0x07b3 /* U+03AE GREEK SMALL LETTER ETA WITH TONOS */ #define XK_Greek_iotaaccent 0x07b4 /* U+03AF GREEK SMALL LETTER IOTA WITH TONOS */ #define XK_Greek_iotadieresis 0x07b5 /* U+03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA */ #define XK_Greek_iotaaccentdieresis 0x07b6 /* U+0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */ #define XK_Greek_omicronaccent 0x07b7 /* U+03CC GREEK SMALL LETTER OMICRON WITH TONOS */ #define XK_Greek_upsilonaccent 0x07b8 /* U+03CD GREEK SMALL LETTER UPSILON WITH TONOS */ #define XK_Greek_upsilondieresis 0x07b9 /* U+03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA */ #define XK_Greek_upsilonaccentdieresis 0x07ba /* U+03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */ #define XK_Greek_omegaaccent 0x07bb /* U+03CE GREEK SMALL LETTER OMEGA WITH TONOS */ #define XK_Greek_ALPHA 0x07c1 /* U+0391 GREEK CAPITAL LETTER ALPHA */ #define XK_Greek_BETA 0x07c2 /* U+0392 GREEK CAPITAL LETTER BETA */ #define XK_Greek_GAMMA 0x07c3 /* U+0393 GREEK CAPITAL LETTER GAMMA */ #define XK_Greek_DELTA 0x07c4 /* U+0394 GREEK CAPITAL LETTER DELTA */ #define XK_Greek_EPSILON 0x07c5 /* U+0395 GREEK CAPITAL LETTER EPSILON */ #define XK_Greek_ZETA 0x07c6 /* U+0396 GREEK CAPITAL LETTER ZETA */ #define XK_Greek_ETA 0x07c7 /* U+0397 GREEK CAPITAL LETTER ETA */ #define XK_Greek_THETA 0x07c8 /* U+0398 GREEK CAPITAL LETTER THETA */ #define XK_Greek_IOTA 0x07c9 /* U+0399 GREEK CAPITAL LETTER IOTA */ #define XK_Greek_KAPPA 0x07ca /* U+039A GREEK CAPITAL LETTER KAPPA */ #define XK_Greek_LAMDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */ #define XK_Greek_LAMBDA 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */ #define XK_Greek_MU 0x07cc /* U+039C GREEK CAPITAL LETTER MU */ #define XK_Greek_NU 0x07cd /* U+039D GREEK CAPITAL LETTER NU */ #define XK_Greek_XI 0x07ce /* U+039E GREEK CAPITAL LETTER XI */ #define XK_Greek_OMICRON 0x07cf /* U+039F GREEK CAPITAL LETTER OMICRON */ #define XK_Greek_PI 0x07d0 /* U+03A0 GREEK CAPITAL LETTER PI */ #define XK_Greek_RHO 0x07d1 /* U+03A1 GREEK CAPITAL LETTER RHO */ #define XK_Greek_SIGMA 0x07d2 /* U+03A3 GREEK CAPITAL LETTER SIGMA */ #define XK_Greek_TAU 0x07d4 /* U+03A4 GREEK CAPITAL LETTER TAU */ #define XK_Greek_UPSILON 0x07d5 /* U+03A5 GREEK CAPITAL LETTER UPSILON */ #define XK_Greek_PHI 0x07d6 /* U+03A6 GREEK CAPITAL LETTER PHI */ #define XK_Greek_CHI 0x07d7 /* U+03A7 GREEK CAPITAL LETTER CHI */ #define XK_Greek_PSI 0x07d8 /* U+03A8 GREEK CAPITAL LETTER PSI */ #define XK_Greek_OMEGA 0x07d9 /* U+03A9 GREEK CAPITAL LETTER OMEGA */ #define XK_Greek_alpha 0x07e1 /* U+03B1 GREEK SMALL LETTER ALPHA */ #define XK_Greek_beta 0x07e2 /* U+03B2 GREEK SMALL LETTER BETA */ #define XK_Greek_gamma 0x07e3 /* U+03B3 GREEK SMALL LETTER GAMMA */ #define XK_Greek_delta 0x07e4 /* U+03B4 GREEK SMALL LETTER DELTA */ #define XK_Greek_epsilon 0x07e5 /* U+03B5 GREEK SMALL LETTER EPSILON */ #define XK_Greek_zeta 0x07e6 /* U+03B6 GREEK SMALL LETTER ZETA */ #define XK_Greek_eta 0x07e7 /* U+03B7 GREEK SMALL LETTER ETA */ #define XK_Greek_theta 0x07e8 /* U+03B8 GREEK SMALL LETTER THETA */ #define XK_Greek_iota 0x07e9 /* U+03B9 GREEK SMALL LETTER IOTA */ #define XK_Greek_kappa 0x07ea /* U+03BA GREEK SMALL LETTER KAPPA */ #define XK_Greek_lamda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */ #define XK_Greek_lambda 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */ #define XK_Greek_mu 0x07ec /* U+03BC GREEK SMALL LETTER MU */ #define XK_Greek_nu 0x07ed /* U+03BD GREEK SMALL LETTER NU */ #define XK_Greek_xi 0x07ee /* U+03BE GREEK SMALL LETTER XI */ #define XK_Greek_omicron 0x07ef /* U+03BF GREEK SMALL LETTER OMICRON */ #define XK_Greek_pi 0x07f0 /* U+03C0 GREEK SMALL LETTER PI */ #define XK_Greek_rho 0x07f1 /* U+03C1 GREEK SMALL LETTER RHO */ #define XK_Greek_sigma 0x07f2 /* U+03C3 GREEK SMALL LETTER SIGMA */ #define XK_Greek_finalsmallsigma 0x07f3 /* U+03C2 GREEK SMALL LETTER FINAL SIGMA */ #define XK_Greek_tau 0x07f4 /* U+03C4 GREEK SMALL LETTER TAU */ #define XK_Greek_upsilon 0x07f5 /* U+03C5 GREEK SMALL LETTER UPSILON */ #define XK_Greek_phi 0x07f6 /* U+03C6 GREEK SMALL LETTER PHI */ #define XK_Greek_chi 0x07f7 /* U+03C7 GREEK SMALL LETTER CHI */ #define XK_Greek_psi 0x07f8 /* U+03C8 GREEK SMALL LETTER PSI */ #define XK_Greek_omega 0x07f9 /* U+03C9 GREEK SMALL LETTER OMEGA */ #define XK_Greek_switch 0xff7e /* Alias for mode_switch */ #endif /* XK_GREEK */ /* * Technical * (from the DEC VT330/VT420 Technical Character Set, http://vt100.net/charsets/technical.html) * Byte 3 = 8 */ #ifdef XK_TECHNICAL #define XK_leftradical 0x08a1 /* U+23B7 RADICAL SYMBOL BOTTOM */ #define XK_topleftradical 0x08a2 /*(U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT)*/ #define XK_horizconnector 0x08a3 /*(U+2500 BOX DRAWINGS LIGHT HORIZONTAL)*/ #define XK_topintegral 0x08a4 /* U+2320 TOP HALF INTEGRAL */ #define XK_botintegral 0x08a5 /* U+2321 BOTTOM HALF INTEGRAL */ #define XK_vertconnector 0x08a6 /*(U+2502 BOX DRAWINGS LIGHT VERTICAL)*/ #define XK_topleftsqbracket 0x08a7 /* U+23A1 LEFT SQUARE BRACKET UPPER CORNER */ #define XK_botleftsqbracket 0x08a8 /* U+23A3 LEFT SQUARE BRACKET LOWER CORNER */ #define XK_toprightsqbracket 0x08a9 /* U+23A4 RIGHT SQUARE BRACKET UPPER CORNER */ #define XK_botrightsqbracket 0x08aa /* U+23A6 RIGHT SQUARE BRACKET LOWER CORNER */ #define XK_topleftparens 0x08ab /* U+239B LEFT PARENTHESIS UPPER HOOK */ #define XK_botleftparens 0x08ac /* U+239D LEFT PARENTHESIS LOWER HOOK */ #define XK_toprightparens 0x08ad /* U+239E RIGHT PARENTHESIS UPPER HOOK */ #define XK_botrightparens 0x08ae /* U+23A0 RIGHT PARENTHESIS LOWER HOOK */ #define XK_leftmiddlecurlybrace 0x08af /* U+23A8 LEFT CURLY BRACKET MIDDLE PIECE */ #define XK_rightmiddlecurlybrace 0x08b0 /* U+23AC RIGHT CURLY BRACKET MIDDLE PIECE */ #define XK_topleftsummation 0x08b1 #define XK_botleftsummation 0x08b2 #define XK_topvertsummationconnector 0x08b3 #define XK_botvertsummationconnector 0x08b4 #define XK_toprightsummation 0x08b5 #define XK_botrightsummation 0x08b6 #define XK_rightmiddlesummation 0x08b7 #define XK_lessthanequal 0x08bc /* U+2264 LESS-THAN OR EQUAL TO */ #define XK_notequal 0x08bd /* U+2260 NOT EQUAL TO */ #define XK_greaterthanequal 0x08be /* U+2265 GREATER-THAN OR EQUAL TO */ #define XK_integral 0x08bf /* U+222B INTEGRAL */ #define XK_therefore 0x08c0 /* U+2234 THEREFORE */ #define XK_variation 0x08c1 /* U+221D PROPORTIONAL TO */ #define XK_infinity 0x08c2 /* U+221E INFINITY */ #define XK_nabla 0x08c5 /* U+2207 NABLA */ #define XK_approximate 0x08c8 /* U+223C TILDE OPERATOR */ #define XK_similarequal 0x08c9 /* U+2243 ASYMPTOTICALLY EQUAL TO */ #define XK_ifonlyif 0x08cd /* U+21D4 LEFT RIGHT DOUBLE ARROW */ #define XK_implies 0x08ce /* U+21D2 RIGHTWARDS DOUBLE ARROW */ #define XK_identical 0x08cf /* U+2261 IDENTICAL TO */ #define XK_radical 0x08d6 /* U+221A SQUARE ROOT */ #define XK_includedin 0x08da /* U+2282 SUBSET OF */ #define XK_includes 0x08db /* U+2283 SUPERSET OF */ #define XK_intersection 0x08dc /* U+2229 INTERSECTION */ #define XK_union 0x08dd /* U+222A UNION */ #define XK_logicaland 0x08de /* U+2227 LOGICAL AND */ #define XK_logicalor 0x08df /* U+2228 LOGICAL OR */ #define XK_partialderivative 0x08ef /* U+2202 PARTIAL DIFFERENTIAL */ #define XK_function 0x08f6 /* U+0192 LATIN SMALL LETTER F WITH HOOK */ #define XK_leftarrow 0x08fb /* U+2190 LEFTWARDS ARROW */ #define XK_uparrow 0x08fc /* U+2191 UPWARDS ARROW */ #define XK_rightarrow 0x08fd /* U+2192 RIGHTWARDS ARROW */ #define XK_downarrow 0x08fe /* U+2193 DOWNWARDS ARROW */ #endif /* XK_TECHNICAL */ /* * Special * (from the DEC VT100 Special Graphics Character Set) * Byte 3 = 9 */ #ifdef XK_SPECIAL #define XK_blank 0x09df #define XK_soliddiamond 0x09e0 /* U+25C6 BLACK DIAMOND */ #define XK_checkerboard 0x09e1 /* U+2592 MEDIUM SHADE */ #define XK_ht 0x09e2 /* U+2409 SYMBOL FOR HORIZONTAL TABULATION */ #define XK_ff 0x09e3 /* U+240C SYMBOL FOR FORM FEED */ #define XK_cr 0x09e4 /* U+240D SYMBOL FOR CARRIAGE RETURN */ #define XK_lf 0x09e5 /* U+240A SYMBOL FOR LINE FEED */ #define XK_nl 0x09e8 /* U+2424 SYMBOL FOR NEWLINE */ #define XK_vt 0x09e9 /* U+240B SYMBOL FOR VERTICAL TABULATION */ #define XK_lowrightcorner 0x09ea /* U+2518 BOX DRAWINGS LIGHT UP AND LEFT */ #define XK_uprightcorner 0x09eb /* U+2510 BOX DRAWINGS LIGHT DOWN AND LEFT */ #define XK_upleftcorner 0x09ec /* U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT */ #define XK_lowleftcorner 0x09ed /* U+2514 BOX DRAWINGS LIGHT UP AND RIGHT */ #define XK_crossinglines 0x09ee /* U+253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */ #define XK_horizlinescan1 0x09ef /* U+23BA HORIZONTAL SCAN LINE-1 */ #define XK_horizlinescan3 0x09f0 /* U+23BB HORIZONTAL SCAN LINE-3 */ #define XK_horizlinescan5 0x09f1 /* U+2500 BOX DRAWINGS LIGHT HORIZONTAL */ #define XK_horizlinescan7 0x09f2 /* U+23BC HORIZONTAL SCAN LINE-7 */ #define XK_horizlinescan9 0x09f3 /* U+23BD HORIZONTAL SCAN LINE-9 */ #define XK_leftt 0x09f4 /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ #define XK_rightt 0x09f5 /* U+2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT */ #define XK_bott 0x09f6 /* U+2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL */ #define XK_topt 0x09f7 /* U+252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */ #define XK_vertbar 0x09f8 /* U+2502 BOX DRAWINGS LIGHT VERTICAL */ #endif /* XK_SPECIAL */ /* * Publishing * (these are probably from a long forgotten DEC Publishing * font that once shipped with DECwrite) * Byte 3 = 0x0a */ #ifdef XK_PUBLISHING #define XK_emspace 0x0aa1 /* U+2003 EM SPACE */ #define XK_enspace 0x0aa2 /* U+2002 EN SPACE */ #define XK_em3space 0x0aa3 /* U+2004 THREE-PER-EM SPACE */ #define XK_em4space 0x0aa4 /* U+2005 FOUR-PER-EM SPACE */ #define XK_digitspace 0x0aa5 /* U+2007 FIGURE SPACE */ #define XK_punctspace 0x0aa6 /* U+2008 PUNCTUATION SPACE */ #define XK_thinspace 0x0aa7 /* U+2009 THIN SPACE */ #define XK_hairspace 0x0aa8 /* U+200A HAIR SPACE */ #define XK_emdash 0x0aa9 /* U+2014 EM DASH */ #define XK_endash 0x0aaa /* U+2013 EN DASH */ #define XK_signifblank 0x0aac /*(U+2423 OPEN BOX)*/ #define XK_ellipsis 0x0aae /* U+2026 HORIZONTAL ELLIPSIS */ #define XK_doubbaselinedot 0x0aaf /* U+2025 TWO DOT LEADER */ #define XK_onethird 0x0ab0 /* U+2153 VULGAR FRACTION ONE THIRD */ #define XK_twothirds 0x0ab1 /* U+2154 VULGAR FRACTION TWO THIRDS */ #define XK_onefifth 0x0ab2 /* U+2155 VULGAR FRACTION ONE FIFTH */ #define XK_twofifths 0x0ab3 /* U+2156 VULGAR FRACTION TWO FIFTHS */ #define XK_threefifths 0x0ab4 /* U+2157 VULGAR FRACTION THREE FIFTHS */ #define XK_fourfifths 0x0ab5 /* U+2158 VULGAR FRACTION FOUR FIFTHS */ #define XK_onesixth 0x0ab6 /* U+2159 VULGAR FRACTION ONE SIXTH */ #define XK_fivesixths 0x0ab7 /* U+215A VULGAR FRACTION FIVE SIXTHS */ #define XK_careof 0x0ab8 /* U+2105 CARE OF */ #define XK_figdash 0x0abb /* U+2012 FIGURE DASH */ #define XK_leftanglebracket 0x0abc /*(U+27E8 MATHEMATICAL LEFT ANGLE BRACKET)*/ #define XK_decimalpoint 0x0abd /*(U+002E FULL STOP)*/ #define XK_rightanglebracket 0x0abe /*(U+27E9 MATHEMATICAL RIGHT ANGLE BRACKET)*/ #define XK_marker 0x0abf #define XK_oneeighth 0x0ac3 /* U+215B VULGAR FRACTION ONE EIGHTH */ #define XK_threeeighths 0x0ac4 /* U+215C VULGAR FRACTION THREE EIGHTHS */ #define XK_fiveeighths 0x0ac5 /* U+215D VULGAR FRACTION FIVE EIGHTHS */ #define XK_seveneighths 0x0ac6 /* U+215E VULGAR FRACTION SEVEN EIGHTHS */ #define XK_trademark 0x0ac9 /* U+2122 TRADE MARK SIGN */ #define XK_signaturemark 0x0aca /*(U+2613 SALTIRE)*/ #define XK_trademarkincircle 0x0acb #define XK_leftopentriangle 0x0acc /*(U+25C1 WHITE LEFT-POINTING TRIANGLE)*/ #define XK_rightopentriangle 0x0acd /*(U+25B7 WHITE RIGHT-POINTING TRIANGLE)*/ #define XK_emopencircle 0x0ace /*(U+25CB WHITE CIRCLE)*/ #define XK_emopenrectangle 0x0acf /*(U+25AF WHITE VERTICAL RECTANGLE)*/ #define XK_leftsinglequotemark 0x0ad0 /* U+2018 LEFT SINGLE QUOTATION MARK */ #define XK_rightsinglequotemark 0x0ad1 /* U+2019 RIGHT SINGLE QUOTATION MARK */ #define XK_leftdoublequotemark 0x0ad2 /* U+201C LEFT DOUBLE QUOTATION MARK */ #define XK_rightdoublequotemark 0x0ad3 /* U+201D RIGHT DOUBLE QUOTATION MARK */ #define XK_prescription 0x0ad4 /* U+211E PRESCRIPTION TAKE */ #define XK_permille 0x0ad5 /* U+2030 PER MILLE SIGN */ #define XK_minutes 0x0ad6 /* U+2032 PRIME */ #define XK_seconds 0x0ad7 /* U+2033 DOUBLE PRIME */ #define XK_latincross 0x0ad9 /* U+271D LATIN CROSS */ #define XK_hexagram 0x0ada #define XK_filledrectbullet 0x0adb /*(U+25AC BLACK RECTANGLE)*/ #define XK_filledlefttribullet 0x0adc /*(U+25C0 BLACK LEFT-POINTING TRIANGLE)*/ #define XK_filledrighttribullet 0x0add /*(U+25B6 BLACK RIGHT-POINTING TRIANGLE)*/ #define XK_emfilledcircle 0x0ade /*(U+25CF BLACK CIRCLE)*/ #define XK_emfilledrect 0x0adf /*(U+25AE BLACK VERTICAL RECTANGLE)*/ #define XK_enopencircbullet 0x0ae0 /*(U+25E6 WHITE BULLET)*/ #define XK_enopensquarebullet 0x0ae1 /*(U+25AB WHITE SMALL SQUARE)*/ #define XK_openrectbullet 0x0ae2 /*(U+25AD WHITE RECTANGLE)*/ #define XK_opentribulletup 0x0ae3 /*(U+25B3 WHITE UP-POINTING TRIANGLE)*/ #define XK_opentribulletdown 0x0ae4 /*(U+25BD WHITE DOWN-POINTING TRIANGLE)*/ #define XK_openstar 0x0ae5 /*(U+2606 WHITE STAR)*/ #define XK_enfilledcircbullet 0x0ae6 /*(U+2022 BULLET)*/ #define XK_enfilledsqbullet 0x0ae7 /*(U+25AA BLACK SMALL SQUARE)*/ #define XK_filledtribulletup 0x0ae8 /*(U+25B2 BLACK UP-POINTING TRIANGLE)*/ #define XK_filledtribulletdown 0x0ae9 /*(U+25BC BLACK DOWN-POINTING TRIANGLE)*/ #define XK_leftpointer 0x0aea /*(U+261C WHITE LEFT POINTING INDEX)*/ #define XK_rightpointer 0x0aeb /*(U+261E WHITE RIGHT POINTING INDEX)*/ #define XK_club 0x0aec /* U+2663 BLACK CLUB SUIT */ #define XK_diamond 0x0aed /* U+2666 BLACK DIAMOND SUIT */ #define XK_heart 0x0aee /* U+2665 BLACK HEART SUIT */ #define XK_maltesecross 0x0af0 /* U+2720 MALTESE CROSS */ #define XK_dagger 0x0af1 /* U+2020 DAGGER */ #define XK_doubledagger 0x0af2 /* U+2021 DOUBLE DAGGER */ #define XK_checkmark 0x0af3 /* U+2713 CHECK MARK */ #define XK_ballotcross 0x0af4 /* U+2717 BALLOT X */ #define XK_musicalsharp 0x0af5 /* U+266F MUSIC SHARP SIGN */ #define XK_musicalflat 0x0af6 /* U+266D MUSIC FLAT SIGN */ #define XK_malesymbol 0x0af7 /* U+2642 MALE SIGN */ #define XK_femalesymbol 0x0af8 /* U+2640 FEMALE SIGN */ #define XK_telephone 0x0af9 /* U+260E BLACK TELEPHONE */ #define XK_telephonerecorder 0x0afa /* U+2315 TELEPHONE RECORDER */ #define XK_phonographcopyright 0x0afb /* U+2117 SOUND RECORDING COPYRIGHT */ #define XK_caret 0x0afc /* U+2038 CARET */ #define XK_singlelowquotemark 0x0afd /* U+201A SINGLE LOW-9 QUOTATION MARK */ #define XK_doublelowquotemark 0x0afe /* U+201E DOUBLE LOW-9 QUOTATION MARK */ #define XK_cursor 0x0aff #endif /* XK_PUBLISHING */ /* * APL * Byte 3 = 0x0b */ #ifdef XK_APL #define XK_leftcaret 0x0ba3 /*(U+003C LESS-THAN SIGN)*/ #define XK_rightcaret 0x0ba6 /*(U+003E GREATER-THAN SIGN)*/ #define XK_downcaret 0x0ba8 /*(U+2228 LOGICAL OR)*/ #define XK_upcaret 0x0ba9 /*(U+2227 LOGICAL AND)*/ #define XK_overbar 0x0bc0 /*(U+00AF MACRON)*/ #define XK_downtack 0x0bc2 /* U+22A4 DOWN TACK */ #define XK_upshoe 0x0bc3 /*(U+2229 INTERSECTION)*/ #define XK_downstile 0x0bc4 /* U+230A LEFT FLOOR */ #define XK_underbar 0x0bc6 /*(U+005F LOW LINE)*/ #define XK_jot 0x0bca /* U+2218 RING OPERATOR */ #define XK_quad 0x0bcc /* U+2395 APL FUNCTIONAL SYMBOL QUAD */ #define XK_uptack 0x0bce /* U+22A5 UP TACK */ #define XK_circle 0x0bcf /* U+25CB WHITE CIRCLE */ #define XK_upstile 0x0bd3 /* U+2308 LEFT CEILING */ #define XK_downshoe 0x0bd6 /*(U+222A UNION)*/ #define XK_rightshoe 0x0bd8 /*(U+2283 SUPERSET OF)*/ #define XK_leftshoe 0x0bda /*(U+2282 SUBSET OF)*/ #define XK_lefttack 0x0bdc /* U+22A3 LEFT TACK */ #define XK_righttack 0x0bfc /* U+22A2 RIGHT TACK */ #endif /* XK_APL */ /* * Hebrew * Byte 3 = 0x0c */ #ifdef XK_HEBREW #define XK_hebrew_doublelowline 0x0cdf /* U+2017 DOUBLE LOW LINE */ #define XK_hebrew_aleph 0x0ce0 /* U+05D0 HEBREW LETTER ALEF */ #define XK_hebrew_bet 0x0ce1 /* U+05D1 HEBREW LETTER BET */ #define XK_hebrew_beth 0x0ce1 /* deprecated */ #define XK_hebrew_gimel 0x0ce2 /* U+05D2 HEBREW LETTER GIMEL */ #define XK_hebrew_gimmel 0x0ce2 /* deprecated */ #define XK_hebrew_dalet 0x0ce3 /* U+05D3 HEBREW LETTER DALET */ #define XK_hebrew_daleth 0x0ce3 /* deprecated */ #define XK_hebrew_he 0x0ce4 /* U+05D4 HEBREW LETTER HE */ #define XK_hebrew_waw 0x0ce5 /* U+05D5 HEBREW LETTER VAV */ #define XK_hebrew_zain 0x0ce6 /* U+05D6 HEBREW LETTER ZAYIN */ #define XK_hebrew_zayin 0x0ce6 /* deprecated */ #define XK_hebrew_chet 0x0ce7 /* U+05D7 HEBREW LETTER HET */ #define XK_hebrew_het 0x0ce7 /* deprecated */ #define XK_hebrew_tet 0x0ce8 /* U+05D8 HEBREW LETTER TET */ #define XK_hebrew_teth 0x0ce8 /* deprecated */ #define XK_hebrew_yod 0x0ce9 /* U+05D9 HEBREW LETTER YOD */ #define XK_hebrew_finalkaph 0x0cea /* U+05DA HEBREW LETTER FINAL KAF */ #define XK_hebrew_kaph 0x0ceb /* U+05DB HEBREW LETTER KAF */ #define XK_hebrew_lamed 0x0cec /* U+05DC HEBREW LETTER LAMED */ #define XK_hebrew_finalmem 0x0ced /* U+05DD HEBREW LETTER FINAL MEM */ #define XK_hebrew_mem 0x0cee /* U+05DE HEBREW LETTER MEM */ #define XK_hebrew_finalnun 0x0cef /* U+05DF HEBREW LETTER FINAL NUN */ #define XK_hebrew_nun 0x0cf0 /* U+05E0 HEBREW LETTER NUN */ #define XK_hebrew_samech 0x0cf1 /* U+05E1 HEBREW LETTER SAMEKH */ #define XK_hebrew_samekh 0x0cf1 /* deprecated */ #define XK_hebrew_ayin 0x0cf2 /* U+05E2 HEBREW LETTER AYIN */ #define XK_hebrew_finalpe 0x0cf3 /* U+05E3 HEBREW LETTER FINAL PE */ #define XK_hebrew_pe 0x0cf4 /* U+05E4 HEBREW LETTER PE */ #define XK_hebrew_finalzade 0x0cf5 /* U+05E5 HEBREW LETTER FINAL TSADI */ #define XK_hebrew_finalzadi 0x0cf5 /* deprecated */ #define XK_hebrew_zade 0x0cf6 /* U+05E6 HEBREW LETTER TSADI */ #define XK_hebrew_zadi 0x0cf6 /* deprecated */ #define XK_hebrew_qoph 0x0cf7 /* U+05E7 HEBREW LETTER QOF */ #define XK_hebrew_kuf 0x0cf7 /* deprecated */ #define XK_hebrew_resh 0x0cf8 /* U+05E8 HEBREW LETTER RESH */ #define XK_hebrew_shin 0x0cf9 /* U+05E9 HEBREW LETTER SHIN */ #define XK_hebrew_taw 0x0cfa /* U+05EA HEBREW LETTER TAV */ #define XK_hebrew_taf 0x0cfa /* deprecated */ #define XK_Hebrew_switch 0xff7e /* Alias for mode_switch */ #endif /* XK_HEBREW */ /* * Thai * Byte 3 = 0x0d */ #ifdef XK_THAI #define XK_Thai_kokai 0x0da1 /* U+0E01 THAI CHARACTER KO KAI */ #define XK_Thai_khokhai 0x0da2 /* U+0E02 THAI CHARACTER KHO KHAI */ #define XK_Thai_khokhuat 0x0da3 /* U+0E03 THAI CHARACTER KHO KHUAT */ #define XK_Thai_khokhwai 0x0da4 /* U+0E04 THAI CHARACTER KHO KHWAI */ #define XK_Thai_khokhon 0x0da5 /* U+0E05 THAI CHARACTER KHO KHON */ #define XK_Thai_khorakhang 0x0da6 /* U+0E06 THAI CHARACTER KHO RAKHANG */ #define XK_Thai_ngongu 0x0da7 /* U+0E07 THAI CHARACTER NGO NGU */ #define XK_Thai_chochan 0x0da8 /* U+0E08 THAI CHARACTER CHO CHAN */ #define XK_Thai_choching 0x0da9 /* U+0E09 THAI CHARACTER CHO CHING */ #define XK_Thai_chochang 0x0daa /* U+0E0A THAI CHARACTER CHO CHANG */ #define XK_Thai_soso 0x0dab /* U+0E0B THAI CHARACTER SO SO */ #define XK_Thai_chochoe 0x0dac /* U+0E0C THAI CHARACTER CHO CHOE */ #define XK_Thai_yoying 0x0dad /* U+0E0D THAI CHARACTER YO YING */ #define XK_Thai_dochada 0x0dae /* U+0E0E THAI CHARACTER DO CHADA */ #define XK_Thai_topatak 0x0daf /* U+0E0F THAI CHARACTER TO PATAK */ #define XK_Thai_thothan 0x0db0 /* U+0E10 THAI CHARACTER THO THAN */ #define XK_Thai_thonangmontho 0x0db1 /* U+0E11 THAI CHARACTER THO NANGMONTHO */ #define XK_Thai_thophuthao 0x0db2 /* U+0E12 THAI CHARACTER THO PHUTHAO */ #define XK_Thai_nonen 0x0db3 /* U+0E13 THAI CHARACTER NO NEN */ #define XK_Thai_dodek 0x0db4 /* U+0E14 THAI CHARACTER DO DEK */ #define XK_Thai_totao 0x0db5 /* U+0E15 THAI CHARACTER TO TAO */ #define XK_Thai_thothung 0x0db6 /* U+0E16 THAI CHARACTER THO THUNG */ #define XK_Thai_thothahan 0x0db7 /* U+0E17 THAI CHARACTER THO THAHAN */ #define XK_Thai_thothong 0x0db8 /* U+0E18 THAI CHARACTER THO THONG */ #define XK_Thai_nonu 0x0db9 /* U+0E19 THAI CHARACTER NO NU */ #define XK_Thai_bobaimai 0x0dba /* U+0E1A THAI CHARACTER BO BAIMAI */ #define XK_Thai_popla 0x0dbb /* U+0E1B THAI CHARACTER PO PLA */ #define XK_Thai_phophung 0x0dbc /* U+0E1C THAI CHARACTER PHO PHUNG */ #define XK_Thai_fofa 0x0dbd /* U+0E1D THAI CHARACTER FO FA */ #define XK_Thai_phophan 0x0dbe /* U+0E1E THAI CHARACTER PHO PHAN */ #define XK_Thai_fofan 0x0dbf /* U+0E1F THAI CHARACTER FO FAN */ #define XK_Thai_phosamphao 0x0dc0 /* U+0E20 THAI CHARACTER PHO SAMPHAO */ #define XK_Thai_moma 0x0dc1 /* U+0E21 THAI CHARACTER MO MA */ #define XK_Thai_yoyak 0x0dc2 /* U+0E22 THAI CHARACTER YO YAK */ #define XK_Thai_rorua 0x0dc3 /* U+0E23 THAI CHARACTER RO RUA */ #define XK_Thai_ru 0x0dc4 /* U+0E24 THAI CHARACTER RU */ #define XK_Thai_loling 0x0dc5 /* U+0E25 THAI CHARACTER LO LING */ #define XK_Thai_lu 0x0dc6 /* U+0E26 THAI CHARACTER LU */ #define XK_Thai_wowaen 0x0dc7 /* U+0E27 THAI CHARACTER WO WAEN */ #define XK_Thai_sosala 0x0dc8 /* U+0E28 THAI CHARACTER SO SALA */ #define XK_Thai_sorusi 0x0dc9 /* U+0E29 THAI CHARACTER SO RUSI */ #define XK_Thai_sosua 0x0dca /* U+0E2A THAI CHARACTER SO SUA */ #define XK_Thai_hohip 0x0dcb /* U+0E2B THAI CHARACTER HO HIP */ #define XK_Thai_lochula 0x0dcc /* U+0E2C THAI CHARACTER LO CHULA */ #define XK_Thai_oang 0x0dcd /* U+0E2D THAI CHARACTER O ANG */ #define XK_Thai_honokhuk 0x0dce /* U+0E2E THAI CHARACTER HO NOKHUK */ #define XK_Thai_paiyannoi 0x0dcf /* U+0E2F THAI CHARACTER PAIYANNOI */ #define XK_Thai_saraa 0x0dd0 /* U+0E30 THAI CHARACTER SARA A */ #define XK_Thai_maihanakat 0x0dd1 /* U+0E31 THAI CHARACTER MAI HAN-AKAT */ #define XK_Thai_saraaa 0x0dd2 /* U+0E32 THAI CHARACTER SARA AA */ #define XK_Thai_saraam 0x0dd3 /* U+0E33 THAI CHARACTER SARA AM */ #define XK_Thai_sarai 0x0dd4 /* U+0E34 THAI CHARACTER SARA I */ #define XK_Thai_saraii 0x0dd5 /* U+0E35 THAI CHARACTER SARA II */ #define XK_Thai_saraue 0x0dd6 /* U+0E36 THAI CHARACTER SARA UE */ #define XK_Thai_sarauee 0x0dd7 /* U+0E37 THAI CHARACTER SARA UEE */ #define XK_Thai_sarau 0x0dd8 /* U+0E38 THAI CHARACTER SARA U */ #define XK_Thai_sarauu 0x0dd9 /* U+0E39 THAI CHARACTER SARA UU */ #define XK_Thai_phinthu 0x0dda /* U+0E3A THAI CHARACTER PHINTHU */ #define XK_Thai_maihanakat_maitho 0x0dde #define XK_Thai_baht 0x0ddf /* U+0E3F THAI CURRENCY SYMBOL BAHT */ #define XK_Thai_sarae 0x0de0 /* U+0E40 THAI CHARACTER SARA E */ #define XK_Thai_saraae 0x0de1 /* U+0E41 THAI CHARACTER SARA AE */ #define XK_Thai_sarao 0x0de2 /* U+0E42 THAI CHARACTER SARA O */ #define XK_Thai_saraaimaimuan 0x0de3 /* U+0E43 THAI CHARACTER SARA AI MAIMUAN */ #define XK_Thai_saraaimaimalai 0x0de4 /* U+0E44 THAI CHARACTER SARA AI MAIMALAI */ #define XK_Thai_lakkhangyao 0x0de5 /* U+0E45 THAI CHARACTER LAKKHANGYAO */ #define XK_Thai_maiyamok 0x0de6 /* U+0E46 THAI CHARACTER MAIYAMOK */ #define XK_Thai_maitaikhu 0x0de7 /* U+0E47 THAI CHARACTER MAITAIKHU */ #define XK_Thai_maiek 0x0de8 /* U+0E48 THAI CHARACTER MAI EK */ #define XK_Thai_maitho 0x0de9 /* U+0E49 THAI CHARACTER MAI THO */ #define XK_Thai_maitri 0x0dea /* U+0E4A THAI CHARACTER MAI TRI */ #define XK_Thai_maichattawa 0x0deb /* U+0E4B THAI CHARACTER MAI CHATTAWA */ #define XK_Thai_thanthakhat 0x0dec /* U+0E4C THAI CHARACTER THANTHAKHAT */ #define XK_Thai_nikhahit 0x0ded /* U+0E4D THAI CHARACTER NIKHAHIT */ #define XK_Thai_leksun 0x0df0 /* U+0E50 THAI DIGIT ZERO */ #define XK_Thai_leknung 0x0df1 /* U+0E51 THAI DIGIT ONE */ #define XK_Thai_leksong 0x0df2 /* U+0E52 THAI DIGIT TWO */ #define XK_Thai_leksam 0x0df3 /* U+0E53 THAI DIGIT THREE */ #define XK_Thai_leksi 0x0df4 /* U+0E54 THAI DIGIT FOUR */ #define XK_Thai_lekha 0x0df5 /* U+0E55 THAI DIGIT FIVE */ #define XK_Thai_lekhok 0x0df6 /* U+0E56 THAI DIGIT SIX */ #define XK_Thai_lekchet 0x0df7 /* U+0E57 THAI DIGIT SEVEN */ #define XK_Thai_lekpaet 0x0df8 /* U+0E58 THAI DIGIT EIGHT */ #define XK_Thai_lekkao 0x0df9 /* U+0E59 THAI DIGIT NINE */ #endif /* XK_THAI */ /* * Korean * Byte 3 = 0x0e */ #ifdef XK_KOREAN #define XK_Hangul 0xff31 /* Hangul start/stop(toggle) */ #define XK_Hangul_Start 0xff32 /* Hangul start */ #define XK_Hangul_End 0xff33 /* Hangul end, English start */ #define XK_Hangul_Hanja 0xff34 /* Start Hangul->Hanja Conversion */ #define XK_Hangul_Jamo 0xff35 /* Hangul Jamo mode */ #define XK_Hangul_Romaja 0xff36 /* Hangul Romaja mode */ #define XK_Hangul_Codeinput 0xff37 /* Hangul code input mode */ #define XK_Hangul_Jeonja 0xff38 /* Jeonja mode */ #define XK_Hangul_Banja 0xff39 /* Banja mode */ #define XK_Hangul_PreHanja 0xff3a /* Pre Hanja conversion */ #define XK_Hangul_PostHanja 0xff3b /* Post Hanja conversion */ #define XK_Hangul_SingleCandidate 0xff3c /* Single candidate */ #define XK_Hangul_MultipleCandidate 0xff3d /* Multiple candidate */ #define XK_Hangul_PreviousCandidate 0xff3e /* Previous candidate */ #define XK_Hangul_Special 0xff3f /* Special symbols */ #define XK_Hangul_switch 0xff7e /* Alias for mode_switch */ /* Hangul Consonant Characters */ #define XK_Hangul_Kiyeog 0x0ea1 #define XK_Hangul_SsangKiyeog 0x0ea2 #define XK_Hangul_KiyeogSios 0x0ea3 #define XK_Hangul_Nieun 0x0ea4 #define XK_Hangul_NieunJieuj 0x0ea5 #define XK_Hangul_NieunHieuh 0x0ea6 #define XK_Hangul_Dikeud 0x0ea7 #define XK_Hangul_SsangDikeud 0x0ea8 #define XK_Hangul_Rieul 0x0ea9 #define XK_Hangul_RieulKiyeog 0x0eaa #define XK_Hangul_RieulMieum 0x0eab #define XK_Hangul_RieulPieub 0x0eac #define XK_Hangul_RieulSios 0x0ead #define XK_Hangul_RieulTieut 0x0eae #define XK_Hangul_RieulPhieuf 0x0eaf #define XK_Hangul_RieulHieuh 0x0eb0 #define XK_Hangul_Mieum 0x0eb1 #define XK_Hangul_Pieub 0x0eb2 #define XK_Hangul_SsangPieub 0x0eb3 #define XK_Hangul_PieubSios 0x0eb4 #define XK_Hangul_Sios 0x0eb5 #define XK_Hangul_SsangSios 0x0eb6 #define XK_Hangul_Ieung 0x0eb7 #define XK_Hangul_Jieuj 0x0eb8 #define XK_Hangul_SsangJieuj 0x0eb9 #define XK_Hangul_Cieuc 0x0eba #define XK_Hangul_Khieuq 0x0ebb #define XK_Hangul_Tieut 0x0ebc #define XK_Hangul_Phieuf 0x0ebd #define XK_Hangul_Hieuh 0x0ebe /* Hangul Vowel Characters */ #define XK_Hangul_A 0x0ebf #define XK_Hangul_AE 0x0ec0 #define XK_Hangul_YA 0x0ec1 #define XK_Hangul_YAE 0x0ec2 #define XK_Hangul_EO 0x0ec3 #define XK_Hangul_E 0x0ec4 #define XK_Hangul_YEO 0x0ec5 #define XK_Hangul_YE 0x0ec6 #define XK_Hangul_O 0x0ec7 #define XK_Hangul_WA 0x0ec8 #define XK_Hangul_WAE 0x0ec9 #define XK_Hangul_OE 0x0eca #define XK_Hangul_YO 0x0ecb #define XK_Hangul_U 0x0ecc #define XK_Hangul_WEO 0x0ecd #define XK_Hangul_WE 0x0ece #define XK_Hangul_WI 0x0ecf #define XK_Hangul_YU 0x0ed0 #define XK_Hangul_EU 0x0ed1 #define XK_Hangul_YI 0x0ed2 #define XK_Hangul_I 0x0ed3 /* Hangul syllable-final (JongSeong) Characters */ #define XK_Hangul_J_Kiyeog 0x0ed4 #define XK_Hangul_J_SsangKiyeog 0x0ed5 #define XK_Hangul_J_KiyeogSios 0x0ed6 #define XK_Hangul_J_Nieun 0x0ed7 #define XK_Hangul_J_NieunJieuj 0x0ed8 #define XK_Hangul_J_NieunHieuh 0x0ed9 #define XK_Hangul_J_Dikeud 0x0eda #define XK_Hangul_J_Rieul 0x0edb #define XK_Hangul_J_RieulKiyeog 0x0edc #define XK_Hangul_J_RieulMieum 0x0edd #define XK_Hangul_J_RieulPieub 0x0ede #define XK_Hangul_J_RieulSios 0x0edf #define XK_Hangul_J_RieulTieut 0x0ee0 #define XK_Hangul_J_RieulPhieuf 0x0ee1 #define XK_Hangul_J_RieulHieuh 0x0ee2 #define XK_Hangul_J_Mieum 0x0ee3 #define XK_Hangul_J_Pieub 0x0ee4 #define XK_Hangul_J_PieubSios 0x0ee5 #define XK_Hangul_J_Sios 0x0ee6 #define XK_Hangul_J_SsangSios 0x0ee7 #define XK_Hangul_J_Ieung 0x0ee8 #define XK_Hangul_J_Jieuj 0x0ee9 #define XK_Hangul_J_Cieuc 0x0eea #define XK_Hangul_J_Khieuq 0x0eeb #define XK_Hangul_J_Tieut 0x0eec #define XK_Hangul_J_Phieuf 0x0eed #define XK_Hangul_J_Hieuh 0x0eee /* Ancient Hangul Consonant Characters */ #define XK_Hangul_RieulYeorinHieuh 0x0eef #define XK_Hangul_SunkyeongeumMieum 0x0ef0 #define XK_Hangul_SunkyeongeumPieub 0x0ef1 #define XK_Hangul_PanSios 0x0ef2 #define XK_Hangul_KkogjiDalrinIeung 0x0ef3 #define XK_Hangul_SunkyeongeumPhieuf 0x0ef4 #define XK_Hangul_YeorinHieuh 0x0ef5 /* Ancient Hangul Vowel Characters */ #define XK_Hangul_AraeA 0x0ef6 #define XK_Hangul_AraeAE 0x0ef7 /* Ancient Hangul syllable-final (JongSeong) Characters */ #define XK_Hangul_J_PanSios 0x0ef8 #define XK_Hangul_J_KkogjiDalrinIeung 0x0ef9 #define XK_Hangul_J_YeorinHieuh 0x0efa /* Korean currency symbol */ #define XK_Korean_Won 0x0eff /*(U+20A9 WON SIGN)*/ #endif /* XK_KOREAN */ /* * Armenian */ #ifdef XK_ARMENIAN #define XK_Armenian_ligature_ew 0x1000587 /* U+0587 ARMENIAN SMALL LIGATURE ECH YIWN */ #define XK_Armenian_full_stop 0x1000589 /* U+0589 ARMENIAN FULL STOP */ #define XK_Armenian_verjaket 0x1000589 /* U+0589 ARMENIAN FULL STOP */ #define XK_Armenian_separation_mark 0x100055d /* U+055D ARMENIAN COMMA */ #define XK_Armenian_but 0x100055d /* U+055D ARMENIAN COMMA */ #define XK_Armenian_hyphen 0x100058a /* U+058A ARMENIAN HYPHEN */ #define XK_Armenian_yentamna 0x100058a /* U+058A ARMENIAN HYPHEN */ #define XK_Armenian_exclam 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */ #define XK_Armenian_amanak 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */ #define XK_Armenian_accent 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */ #define XK_Armenian_shesht 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */ #define XK_Armenian_question 0x100055e /* U+055E ARMENIAN QUESTION MARK */ #define XK_Armenian_paruyk 0x100055e /* U+055E ARMENIAN QUESTION MARK */ #define XK_Armenian_AYB 0x1000531 /* U+0531 ARMENIAN CAPITAL LETTER AYB */ #define XK_Armenian_ayb 0x1000561 /* U+0561 ARMENIAN SMALL LETTER AYB */ #define XK_Armenian_BEN 0x1000532 /* U+0532 ARMENIAN CAPITAL LETTER BEN */ #define XK_Armenian_ben 0x1000562 /* U+0562 ARMENIAN SMALL LETTER BEN */ #define XK_Armenian_GIM 0x1000533 /* U+0533 ARMENIAN CAPITAL LETTER GIM */ #define XK_Armenian_gim 0x1000563 /* U+0563 ARMENIAN SMALL LETTER GIM */ #define XK_Armenian_DA 0x1000534 /* U+0534 ARMENIAN CAPITAL LETTER DA */ #define XK_Armenian_da 0x1000564 /* U+0564 ARMENIAN SMALL LETTER DA */ #define XK_Armenian_YECH 0x1000535 /* U+0535 ARMENIAN CAPITAL LETTER ECH */ #define XK_Armenian_yech 0x1000565 /* U+0565 ARMENIAN SMALL LETTER ECH */ #define XK_Armenian_ZA 0x1000536 /* U+0536 ARMENIAN CAPITAL LETTER ZA */ #define XK_Armenian_za 0x1000566 /* U+0566 ARMENIAN SMALL LETTER ZA */ #define XK_Armenian_E 0x1000537 /* U+0537 ARMENIAN CAPITAL LETTER EH */ #define XK_Armenian_e 0x1000567 /* U+0567 ARMENIAN SMALL LETTER EH */ #define XK_Armenian_AT 0x1000538 /* U+0538 ARMENIAN CAPITAL LETTER ET */ #define XK_Armenian_at 0x1000568 /* U+0568 ARMENIAN SMALL LETTER ET */ #define XK_Armenian_TO 0x1000539 /* U+0539 ARMENIAN CAPITAL LETTER TO */ #define XK_Armenian_to 0x1000569 /* U+0569 ARMENIAN SMALL LETTER TO */ #define XK_Armenian_ZHE 0x100053a /* U+053A ARMENIAN CAPITAL LETTER ZHE */ #define XK_Armenian_zhe 0x100056a /* U+056A ARMENIAN SMALL LETTER ZHE */ #define XK_Armenian_INI 0x100053b /* U+053B ARMENIAN CAPITAL LETTER INI */ #define XK_Armenian_ini 0x100056b /* U+056B ARMENIAN SMALL LETTER INI */ #define XK_Armenian_LYUN 0x100053c /* U+053C ARMENIAN CAPITAL LETTER LIWN */ #define XK_Armenian_lyun 0x100056c /* U+056C ARMENIAN SMALL LETTER LIWN */ #define XK_Armenian_KHE 0x100053d /* U+053D ARMENIAN CAPITAL LETTER XEH */ #define XK_Armenian_khe 0x100056d /* U+056D ARMENIAN SMALL LETTER XEH */ #define XK_Armenian_TSA 0x100053e /* U+053E ARMENIAN CAPITAL LETTER CA */ #define XK_Armenian_tsa 0x100056e /* U+056E ARMENIAN SMALL LETTER CA */ #define XK_Armenian_KEN 0x100053f /* U+053F ARMENIAN CAPITAL LETTER KEN */ #define XK_Armenian_ken 0x100056f /* U+056F ARMENIAN SMALL LETTER KEN */ #define XK_Armenian_HO 0x1000540 /* U+0540 ARMENIAN CAPITAL LETTER HO */ #define XK_Armenian_ho 0x1000570 /* U+0570 ARMENIAN SMALL LETTER HO */ #define XK_Armenian_DZA 0x1000541 /* U+0541 ARMENIAN CAPITAL LETTER JA */ #define XK_Armenian_dza 0x1000571 /* U+0571 ARMENIAN SMALL LETTER JA */ #define XK_Armenian_GHAT 0x1000542 /* U+0542 ARMENIAN CAPITAL LETTER GHAD */ #define XK_Armenian_ghat 0x1000572 /* U+0572 ARMENIAN SMALL LETTER GHAD */ #define XK_Armenian_TCHE 0x1000543 /* U+0543 ARMENIAN CAPITAL LETTER CHEH */ #define XK_Armenian_tche 0x1000573 /* U+0573 ARMENIAN SMALL LETTER CHEH */ #define XK_Armenian_MEN 0x1000544 /* U+0544 ARMENIAN CAPITAL LETTER MEN */ #define XK_Armenian_men 0x1000574 /* U+0574 ARMENIAN SMALL LETTER MEN */ #define XK_Armenian_HI 0x1000545 /* U+0545 ARMENIAN CAPITAL LETTER YI */ #define XK_Armenian_hi 0x1000575 /* U+0575 ARMENIAN SMALL LETTER YI */ #define XK_Armenian_NU 0x1000546 /* U+0546 ARMENIAN CAPITAL LETTER NOW */ #define XK_Armenian_nu 0x1000576 /* U+0576 ARMENIAN SMALL LETTER NOW */ #define XK_Armenian_SHA 0x1000547 /* U+0547 ARMENIAN CAPITAL LETTER SHA */ #define XK_Armenian_sha 0x1000577 /* U+0577 ARMENIAN SMALL LETTER SHA */ #define XK_Armenian_VO 0x1000548 /* U+0548 ARMENIAN CAPITAL LETTER VO */ #define XK_Armenian_vo 0x1000578 /* U+0578 ARMENIAN SMALL LETTER VO */ #define XK_Armenian_CHA 0x1000549 /* U+0549 ARMENIAN CAPITAL LETTER CHA */ #define XK_Armenian_cha 0x1000579 /* U+0579 ARMENIAN SMALL LETTER CHA */ #define XK_Armenian_PE 0x100054a /* U+054A ARMENIAN CAPITAL LETTER PEH */ #define XK_Armenian_pe 0x100057a /* U+057A ARMENIAN SMALL LETTER PEH */ #define XK_Armenian_JE 0x100054b /* U+054B ARMENIAN CAPITAL LETTER JHEH */ #define XK_Armenian_je 0x100057b /* U+057B ARMENIAN SMALL LETTER JHEH */ #define XK_Armenian_RA 0x100054c /* U+054C ARMENIAN CAPITAL LETTER RA */ #define XK_Armenian_ra 0x100057c /* U+057C ARMENIAN SMALL LETTER RA */ #define XK_Armenian_SE 0x100054d /* U+054D ARMENIAN CAPITAL LETTER SEH */ #define XK_Armenian_se 0x100057d /* U+057D ARMENIAN SMALL LETTER SEH */ #define XK_Armenian_VEV 0x100054e /* U+054E ARMENIAN CAPITAL LETTER VEW */ #define XK_Armenian_vev 0x100057e /* U+057E ARMENIAN SMALL LETTER VEW */ #define XK_Armenian_TYUN 0x100054f /* U+054F ARMENIAN CAPITAL LETTER TIWN */ #define XK_Armenian_tyun 0x100057f /* U+057F ARMENIAN SMALL LETTER TIWN */ #define XK_Armenian_RE 0x1000550 /* U+0550 ARMENIAN CAPITAL LETTER REH */ #define XK_Armenian_re 0x1000580 /* U+0580 ARMENIAN SMALL LETTER REH */ #define XK_Armenian_TSO 0x1000551 /* U+0551 ARMENIAN CAPITAL LETTER CO */ #define XK_Armenian_tso 0x1000581 /* U+0581 ARMENIAN SMALL LETTER CO */ #define XK_Armenian_VYUN 0x1000552 /* U+0552 ARMENIAN CAPITAL LETTER YIWN */ #define XK_Armenian_vyun 0x1000582 /* U+0582 ARMENIAN SMALL LETTER YIWN */ #define XK_Armenian_PYUR 0x1000553 /* U+0553 ARMENIAN CAPITAL LETTER PIWR */ #define XK_Armenian_pyur 0x1000583 /* U+0583 ARMENIAN SMALL LETTER PIWR */ #define XK_Armenian_KE 0x1000554 /* U+0554 ARMENIAN CAPITAL LETTER KEH */ #define XK_Armenian_ke 0x1000584 /* U+0584 ARMENIAN SMALL LETTER KEH */ #define XK_Armenian_O 0x1000555 /* U+0555 ARMENIAN CAPITAL LETTER OH */ #define XK_Armenian_o 0x1000585 /* U+0585 ARMENIAN SMALL LETTER OH */ #define XK_Armenian_FE 0x1000556 /* U+0556 ARMENIAN CAPITAL LETTER FEH */ #define XK_Armenian_fe 0x1000586 /* U+0586 ARMENIAN SMALL LETTER FEH */ #define XK_Armenian_apostrophe 0x100055a /* U+055A ARMENIAN APOSTROPHE */ #endif /* XK_ARMENIAN */ /* * Georgian */ #ifdef XK_GEORGIAN #define XK_Georgian_an 0x10010d0 /* U+10D0 GEORGIAN LETTER AN */ #define XK_Georgian_ban 0x10010d1 /* U+10D1 GEORGIAN LETTER BAN */ #define XK_Georgian_gan 0x10010d2 /* U+10D2 GEORGIAN LETTER GAN */ #define XK_Georgian_don 0x10010d3 /* U+10D3 GEORGIAN LETTER DON */ #define XK_Georgian_en 0x10010d4 /* U+10D4 GEORGIAN LETTER EN */ #define XK_Georgian_vin 0x10010d5 /* U+10D5 GEORGIAN LETTER VIN */ #define XK_Georgian_zen 0x10010d6 /* U+10D6 GEORGIAN LETTER ZEN */ #define XK_Georgian_tan 0x10010d7 /* U+10D7 GEORGIAN LETTER TAN */ #define XK_Georgian_in 0x10010d8 /* U+10D8 GEORGIAN LETTER IN */ #define XK_Georgian_kan 0x10010d9 /* U+10D9 GEORGIAN LETTER KAN */ #define XK_Georgian_las 0x10010da /* U+10DA GEORGIAN LETTER LAS */ #define XK_Georgian_man 0x10010db /* U+10DB GEORGIAN LETTER MAN */ #define XK_Georgian_nar 0x10010dc /* U+10DC GEORGIAN LETTER NAR */ #define XK_Georgian_on 0x10010dd /* U+10DD GEORGIAN LETTER ON */ #define XK_Georgian_par 0x10010de /* U+10DE GEORGIAN LETTER PAR */ #define XK_Georgian_zhar 0x10010df /* U+10DF GEORGIAN LETTER ZHAR */ #define XK_Georgian_rae 0x10010e0 /* U+10E0 GEORGIAN LETTER RAE */ #define XK_Georgian_san 0x10010e1 /* U+10E1 GEORGIAN LETTER SAN */ #define XK_Georgian_tar 0x10010e2 /* U+10E2 GEORGIAN LETTER TAR */ #define XK_Georgian_un 0x10010e3 /* U+10E3 GEORGIAN LETTER UN */ #define XK_Georgian_phar 0x10010e4 /* U+10E4 GEORGIAN LETTER PHAR */ #define XK_Georgian_khar 0x10010e5 /* U+10E5 GEORGIAN LETTER KHAR */ #define XK_Georgian_ghan 0x10010e6 /* U+10E6 GEORGIAN LETTER GHAN */ #define XK_Georgian_qar 0x10010e7 /* U+10E7 GEORGIAN LETTER QAR */ #define XK_Georgian_shin 0x10010e8 /* U+10E8 GEORGIAN LETTER SHIN */ #define XK_Georgian_chin 0x10010e9 /* U+10E9 GEORGIAN LETTER CHIN */ #define XK_Georgian_can 0x10010ea /* U+10EA GEORGIAN LETTER CAN */ #define XK_Georgian_jil 0x10010eb /* U+10EB GEORGIAN LETTER JIL */ #define XK_Georgian_cil 0x10010ec /* U+10EC GEORGIAN LETTER CIL */ #define XK_Georgian_char 0x10010ed /* U+10ED GEORGIAN LETTER CHAR */ #define XK_Georgian_xan 0x10010ee /* U+10EE GEORGIAN LETTER XAN */ #define XK_Georgian_jhan 0x10010ef /* U+10EF GEORGIAN LETTER JHAN */ #define XK_Georgian_hae 0x10010f0 /* U+10F0 GEORGIAN LETTER HAE */ #define XK_Georgian_he 0x10010f1 /* U+10F1 GEORGIAN LETTER HE */ #define XK_Georgian_hie 0x10010f2 /* U+10F2 GEORGIAN LETTER HIE */ #define XK_Georgian_we 0x10010f3 /* U+10F3 GEORGIAN LETTER WE */ #define XK_Georgian_har 0x10010f4 /* U+10F4 GEORGIAN LETTER HAR */ #define XK_Georgian_hoe 0x10010f5 /* U+10F5 GEORGIAN LETTER HOE */ #define XK_Georgian_fi 0x10010f6 /* U+10F6 GEORGIAN LETTER FI */ #endif /* XK_GEORGIAN */ /* * Azeri (and other Turkic or Caucasian languages) */ #ifdef XK_CAUCASUS /* latin */ #define XK_Xabovedot 0x1001e8a /* U+1E8A LATIN CAPITAL LETTER X WITH DOT ABOVE */ #define XK_Ibreve 0x100012c /* U+012C LATIN CAPITAL LETTER I WITH BREVE */ #define XK_Zstroke 0x10001b5 /* U+01B5 LATIN CAPITAL LETTER Z WITH STROKE */ #define XK_Gcaron 0x10001e6 /* U+01E6 LATIN CAPITAL LETTER G WITH CARON */ #define XK_Ocaron 0x10001d1 /* U+01D2 LATIN CAPITAL LETTER O WITH CARON */ #define XK_Obarred 0x100019f /* U+019F LATIN CAPITAL LETTER O WITH MIDDLE TILDE */ #define XK_xabovedot 0x1001e8b /* U+1E8B LATIN SMALL LETTER X WITH DOT ABOVE */ #define XK_ibreve 0x100012d /* U+012D LATIN SMALL LETTER I WITH BREVE */ #define XK_zstroke 0x10001b6 /* U+01B6 LATIN SMALL LETTER Z WITH STROKE */ #define XK_gcaron 0x10001e7 /* U+01E7 LATIN SMALL LETTER G WITH CARON */ #define XK_ocaron 0x10001d2 /* U+01D2 LATIN SMALL LETTER O WITH CARON */ #define XK_obarred 0x1000275 /* U+0275 LATIN SMALL LETTER BARRED O */ #define XK_SCHWA 0x100018f /* U+018F LATIN CAPITAL LETTER SCHWA */ #define XK_schwa 0x1000259 /* U+0259 LATIN SMALL LETTER SCHWA */ #define XK_EZH 0x10001b7 /* U+01B7 LATIN CAPITAL LETTER EZH */ #define XK_ezh 0x1000292 /* U+0292 LATIN SMALL LETTER EZH */ /* those are not really Caucasus */ /* For Inupiak */ #define XK_Lbelowdot 0x1001e36 /* U+1E36 LATIN CAPITAL LETTER L WITH DOT BELOW */ #define XK_lbelowdot 0x1001e37 /* U+1E37 LATIN SMALL LETTER L WITH DOT BELOW */ #endif /* XK_CAUCASUS */ /* * Vietnamese */ #ifdef XK_VIETNAMESE #define XK_Abelowdot 0x1001ea0 /* U+1EA0 LATIN CAPITAL LETTER A WITH DOT BELOW */ #define XK_abelowdot 0x1001ea1 /* U+1EA1 LATIN SMALL LETTER A WITH DOT BELOW */ #define XK_Ahook 0x1001ea2 /* U+1EA2 LATIN CAPITAL LETTER A WITH HOOK ABOVE */ #define XK_ahook 0x1001ea3 /* U+1EA3 LATIN SMALL LETTER A WITH HOOK ABOVE */ #define XK_Acircumflexacute 0x1001ea4 /* U+1EA4 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE */ #define XK_acircumflexacute 0x1001ea5 /* U+1EA5 LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE */ #define XK_Acircumflexgrave 0x1001ea6 /* U+1EA6 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE */ #define XK_acircumflexgrave 0x1001ea7 /* U+1EA7 LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE */ #define XK_Acircumflexhook 0x1001ea8 /* U+1EA8 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */ #define XK_acircumflexhook 0x1001ea9 /* U+1EA9 LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */ #define XK_Acircumflextilde 0x1001eaa /* U+1EAA LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE */ #define XK_acircumflextilde 0x1001eab /* U+1EAB LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE */ #define XK_Acircumflexbelowdot 0x1001eac /* U+1EAC LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW */ #define XK_acircumflexbelowdot 0x1001ead /* U+1EAD LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW */ #define XK_Abreveacute 0x1001eae /* U+1EAE LATIN CAPITAL LETTER A WITH BREVE AND ACUTE */ #define XK_abreveacute 0x1001eaf /* U+1EAF LATIN SMALL LETTER A WITH BREVE AND ACUTE */ #define XK_Abrevegrave 0x1001eb0 /* U+1EB0 LATIN CAPITAL LETTER A WITH BREVE AND GRAVE */ #define XK_abrevegrave 0x1001eb1 /* U+1EB1 LATIN SMALL LETTER A WITH BREVE AND GRAVE */ #define XK_Abrevehook 0x1001eb2 /* U+1EB2 LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE */ #define XK_abrevehook 0x1001eb3 /* U+1EB3 LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE */ #define XK_Abrevetilde 0x1001eb4 /* U+1EB4 LATIN CAPITAL LETTER A WITH BREVE AND TILDE */ #define XK_abrevetilde 0x1001eb5 /* U+1EB5 LATIN SMALL LETTER A WITH BREVE AND TILDE */ #define XK_Abrevebelowdot 0x1001eb6 /* U+1EB6 LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW */ #define XK_abrevebelowdot 0x1001eb7 /* U+1EB7 LATIN SMALL LETTER A WITH BREVE AND DOT BELOW */ #define XK_Ebelowdot 0x1001eb8 /* U+1EB8 LATIN CAPITAL LETTER E WITH DOT BELOW */ #define XK_ebelowdot 0x1001eb9 /* U+1EB9 LATIN SMALL LETTER E WITH DOT BELOW */ #define XK_Ehook 0x1001eba /* U+1EBA LATIN CAPITAL LETTER E WITH HOOK ABOVE */ #define XK_ehook 0x1001ebb /* U+1EBB LATIN SMALL LETTER E WITH HOOK ABOVE */ #define XK_Etilde 0x1001ebc /* U+1EBC LATIN CAPITAL LETTER E WITH TILDE */ #define XK_etilde 0x1001ebd /* U+1EBD LATIN SMALL LETTER E WITH TILDE */ #define XK_Ecircumflexacute 0x1001ebe /* U+1EBE LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE */ #define XK_ecircumflexacute 0x1001ebf /* U+1EBF LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE */ #define XK_Ecircumflexgrave 0x1001ec0 /* U+1EC0 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE */ #define XK_ecircumflexgrave 0x1001ec1 /* U+1EC1 LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE */ #define XK_Ecircumflexhook 0x1001ec2 /* U+1EC2 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */ #define XK_ecircumflexhook 0x1001ec3 /* U+1EC3 LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */ #define XK_Ecircumflextilde 0x1001ec4 /* U+1EC4 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE */ #define XK_ecircumflextilde 0x1001ec5 /* U+1EC5 LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE */ #define XK_Ecircumflexbelowdot 0x1001ec6 /* U+1EC6 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW */ #define XK_ecircumflexbelowdot 0x1001ec7 /* U+1EC7 LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW */ #define XK_Ihook 0x1001ec8 /* U+1EC8 LATIN CAPITAL LETTER I WITH HOOK ABOVE */ #define XK_ihook 0x1001ec9 /* U+1EC9 LATIN SMALL LETTER I WITH HOOK ABOVE */ #define XK_Ibelowdot 0x1001eca /* U+1ECA LATIN CAPITAL LETTER I WITH DOT BELOW */ #define XK_ibelowdot 0x1001ecb /* U+1ECB LATIN SMALL LETTER I WITH DOT BELOW */ #define XK_Obelowdot 0x1001ecc /* U+1ECC LATIN CAPITAL LETTER O WITH DOT BELOW */ #define XK_obelowdot 0x1001ecd /* U+1ECD LATIN SMALL LETTER O WITH DOT BELOW */ #define XK_Ohook 0x1001ece /* U+1ECE LATIN CAPITAL LETTER O WITH HOOK ABOVE */ #define XK_ohook 0x1001ecf /* U+1ECF LATIN SMALL LETTER O WITH HOOK ABOVE */ #define XK_Ocircumflexacute 0x1001ed0 /* U+1ED0 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE */ #define XK_ocircumflexacute 0x1001ed1 /* U+1ED1 LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE */ #define XK_Ocircumflexgrave 0x1001ed2 /* U+1ED2 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE */ #define XK_ocircumflexgrave 0x1001ed3 /* U+1ED3 LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE */ #define XK_Ocircumflexhook 0x1001ed4 /* U+1ED4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */ #define XK_ocircumflexhook 0x1001ed5 /* U+1ED5 LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */ #define XK_Ocircumflextilde 0x1001ed6 /* U+1ED6 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE */ #define XK_ocircumflextilde 0x1001ed7 /* U+1ED7 LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE */ #define XK_Ocircumflexbelowdot 0x1001ed8 /* U+1ED8 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW */ #define XK_ocircumflexbelowdot 0x1001ed9 /* U+1ED9 LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW */ #define XK_Ohornacute 0x1001eda /* U+1EDA LATIN CAPITAL LETTER O WITH HORN AND ACUTE */ #define XK_ohornacute 0x1001edb /* U+1EDB LATIN SMALL LETTER O WITH HORN AND ACUTE */ #define XK_Ohorngrave 0x1001edc /* U+1EDC LATIN CAPITAL LETTER O WITH HORN AND GRAVE */ #define XK_ohorngrave 0x1001edd /* U+1EDD LATIN SMALL LETTER O WITH HORN AND GRAVE */ #define XK_Ohornhook 0x1001ede /* U+1EDE LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE */ #define XK_ohornhook 0x1001edf /* U+1EDF LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE */ #define XK_Ohorntilde 0x1001ee0 /* U+1EE0 LATIN CAPITAL LETTER O WITH HORN AND TILDE */ #define XK_ohorntilde 0x1001ee1 /* U+1EE1 LATIN SMALL LETTER O WITH HORN AND TILDE */ #define XK_Ohornbelowdot 0x1001ee2 /* U+1EE2 LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW */ #define XK_ohornbelowdot 0x1001ee3 /* U+1EE3 LATIN SMALL LETTER O WITH HORN AND DOT BELOW */ #define XK_Ubelowdot 0x1001ee4 /* U+1EE4 LATIN CAPITAL LETTER U WITH DOT BELOW */ #define XK_ubelowdot 0x1001ee5 /* U+1EE5 LATIN SMALL LETTER U WITH DOT BELOW */ #define XK_Uhook 0x1001ee6 /* U+1EE6 LATIN CAPITAL LETTER U WITH HOOK ABOVE */ #define XK_uhook 0x1001ee7 /* U+1EE7 LATIN SMALL LETTER U WITH HOOK ABOVE */ #define XK_Uhornacute 0x1001ee8 /* U+1EE8 LATIN CAPITAL LETTER U WITH HORN AND ACUTE */ #define XK_uhornacute 0x1001ee9 /* U+1EE9 LATIN SMALL LETTER U WITH HORN AND ACUTE */ #define XK_Uhorngrave 0x1001eea /* U+1EEA LATIN CAPITAL LETTER U WITH HORN AND GRAVE */ #define XK_uhorngrave 0x1001eeb /* U+1EEB LATIN SMALL LETTER U WITH HORN AND GRAVE */ #define XK_Uhornhook 0x1001eec /* U+1EEC LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE */ #define XK_uhornhook 0x1001eed /* U+1EED LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE */ #define XK_Uhorntilde 0x1001eee /* U+1EEE LATIN CAPITAL LETTER U WITH HORN AND TILDE */ #define XK_uhorntilde 0x1001eef /* U+1EEF LATIN SMALL LETTER U WITH HORN AND TILDE */ #define XK_Uhornbelowdot 0x1001ef0 /* U+1EF0 LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW */ #define XK_uhornbelowdot 0x1001ef1 /* U+1EF1 LATIN SMALL LETTER U WITH HORN AND DOT BELOW */ #define XK_Ybelowdot 0x1001ef4 /* U+1EF4 LATIN CAPITAL LETTER Y WITH DOT BELOW */ #define XK_ybelowdot 0x1001ef5 /* U+1EF5 LATIN SMALL LETTER Y WITH DOT BELOW */ #define XK_Yhook 0x1001ef6 /* U+1EF6 LATIN CAPITAL LETTER Y WITH HOOK ABOVE */ #define XK_yhook 0x1001ef7 /* U+1EF7 LATIN SMALL LETTER Y WITH HOOK ABOVE */ #define XK_Ytilde 0x1001ef8 /* U+1EF8 LATIN CAPITAL LETTER Y WITH TILDE */ #define XK_ytilde 0x1001ef9 /* U+1EF9 LATIN SMALL LETTER Y WITH TILDE */ #define XK_Ohorn 0x10001a0 /* U+01A0 LATIN CAPITAL LETTER O WITH HORN */ #define XK_ohorn 0x10001a1 /* U+01A1 LATIN SMALL LETTER O WITH HORN */ #define XK_Uhorn 0x10001af /* U+01AF LATIN CAPITAL LETTER U WITH HORN */ #define XK_uhorn 0x10001b0 /* U+01B0 LATIN SMALL LETTER U WITH HORN */ #endif /* XK_VIETNAMESE */ #ifdef XK_CURRENCY #define XK_EcuSign 0x10020a0 /* U+20A0 EURO-CURRENCY SIGN */ #define XK_ColonSign 0x10020a1 /* U+20A1 COLON SIGN */ #define XK_CruzeiroSign 0x10020a2 /* U+20A2 CRUZEIRO SIGN */ #define XK_FFrancSign 0x10020a3 /* U+20A3 FRENCH FRANC SIGN */ #define XK_LiraSign 0x10020a4 /* U+20A4 LIRA SIGN */ #define XK_MillSign 0x10020a5 /* U+20A5 MILL SIGN */ #define XK_NairaSign 0x10020a6 /* U+20A6 NAIRA SIGN */ #define XK_PesetaSign 0x10020a7 /* U+20A7 PESETA SIGN */ #define XK_RupeeSign 0x10020a8 /* U+20A8 RUPEE SIGN */ #define XK_WonSign 0x10020a9 /* U+20A9 WON SIGN */ #define XK_NewSheqelSign 0x10020aa /* U+20AA NEW SHEQEL SIGN */ #define XK_DongSign 0x10020ab /* U+20AB DONG SIGN */ #define XK_EuroSign 0x20ac /* U+20AC EURO SIGN */ #endif /* XK_CURRENCY */ #ifdef XK_MATHEMATICAL /* one, two and three are defined above. */ #define XK_zerosuperior 0x1002070 /* U+2070 SUPERSCRIPT ZERO */ #define XK_foursuperior 0x1002074 /* U+2074 SUPERSCRIPT FOUR */ #define XK_fivesuperior 0x1002075 /* U+2075 SUPERSCRIPT FIVE */ #define XK_sixsuperior 0x1002076 /* U+2076 SUPERSCRIPT SIX */ #define XK_sevensuperior 0x1002077 /* U+2077 SUPERSCRIPT SEVEN */ #define XK_eightsuperior 0x1002078 /* U+2078 SUPERSCRIPT EIGHT */ #define XK_ninesuperior 0x1002079 /* U+2079 SUPERSCRIPT NINE */ #define XK_zerosubscript 0x1002080 /* U+2080 SUBSCRIPT ZERO */ #define XK_onesubscript 0x1002081 /* U+2081 SUBSCRIPT ONE */ #define XK_twosubscript 0x1002082 /* U+2082 SUBSCRIPT TWO */ #define XK_threesubscript 0x1002083 /* U+2083 SUBSCRIPT THREE */ #define XK_foursubscript 0x1002084 /* U+2084 SUBSCRIPT FOUR */ #define XK_fivesubscript 0x1002085 /* U+2085 SUBSCRIPT FIVE */ #define XK_sixsubscript 0x1002086 /* U+2086 SUBSCRIPT SIX */ #define XK_sevensubscript 0x1002087 /* U+2087 SUBSCRIPT SEVEN */ #define XK_eightsubscript 0x1002088 /* U+2088 SUBSCRIPT EIGHT */ #define XK_ninesubscript 0x1002089 /* U+2089 SUBSCRIPT NINE */ #define XK_partdifferential 0x1002202 /* U+2202 PARTIAL DIFFERENTIAL */ #define XK_emptyset 0x1002205 /* U+2205 NULL SET */ #define XK_elementof 0x1002208 /* U+2208 ELEMENT OF */ #define XK_notelementof 0x1002209 /* U+2209 NOT AN ELEMENT OF */ #define XK_containsas 0x100220B /* U+220B CONTAINS AS MEMBER */ #define XK_squareroot 0x100221A /* U+221A SQUARE ROOT */ #define XK_cuberoot 0x100221B /* U+221B CUBE ROOT */ #define XK_fourthroot 0x100221C /* U+221C FOURTH ROOT */ #define XK_dintegral 0x100222C /* U+222C DOUBLE INTEGRAL */ #define XK_tintegral 0x100222D /* U+222D TRIPLE INTEGRAL */ #define XK_because 0x1002235 /* U+2235 BECAUSE */ #define XK_approxeq 0x1002248 /* U+2245 ALMOST EQUAL TO */ #define XK_notapproxeq 0x1002247 /* U+2247 NOT ALMOST EQUAL TO */ #define XK_notidentical 0x1002262 /* U+2262 NOT IDENTICAL TO */ #define XK_stricteq 0x1002263 /* U+2263 STRICTLY EQUIVALENT TO */ #endif /* XK_MATHEMATICAL */ #ifdef XK_BRAILLE #define XK_braille_dot_1 0xfff1 #define XK_braille_dot_2 0xfff2 #define XK_braille_dot_3 0xfff3 #define XK_braille_dot_4 0xfff4 #define XK_braille_dot_5 0xfff5 #define XK_braille_dot_6 0xfff6 #define XK_braille_dot_7 0xfff7 #define XK_braille_dot_8 0xfff8 #define XK_braille_dot_9 0xfff9 #define XK_braille_dot_10 0xfffa #define XK_braille_blank 0x1002800 /* U+2800 BRAILLE PATTERN BLANK */ #define XK_braille_dots_1 0x1002801 /* U+2801 BRAILLE PATTERN DOTS-1 */ #define XK_braille_dots_2 0x1002802 /* U+2802 BRAILLE PATTERN DOTS-2 */ #define XK_braille_dots_12 0x1002803 /* U+2803 BRAILLE PATTERN DOTS-12 */ #define XK_braille_dots_3 0x1002804 /* U+2804 BRAILLE PATTERN DOTS-3 */ #define XK_braille_dots_13 0x1002805 /* U+2805 BRAILLE PATTERN DOTS-13 */ #define XK_braille_dots_23 0x1002806 /* U+2806 BRAILLE PATTERN DOTS-23 */ #define XK_braille_dots_123 0x1002807 /* U+2807 BRAILLE PATTERN DOTS-123 */ #define XK_braille_dots_4 0x1002808 /* U+2808 BRAILLE PATTERN DOTS-4 */ #define XK_braille_dots_14 0x1002809 /* U+2809 BRAILLE PATTERN DOTS-14 */ #define XK_braille_dots_24 0x100280a /* U+280a BRAILLE PATTERN DOTS-24 */ #define XK_braille_dots_124 0x100280b /* U+280b BRAILLE PATTERN DOTS-124 */ #define XK_braille_dots_34 0x100280c /* U+280c BRAILLE PATTERN DOTS-34 */ #define XK_braille_dots_134 0x100280d /* U+280d BRAILLE PATTERN DOTS-134 */ #define XK_braille_dots_234 0x100280e /* U+280e BRAILLE PATTERN DOTS-234 */ #define XK_braille_dots_1234 0x100280f /* U+280f BRAILLE PATTERN DOTS-1234 */ #define XK_braille_dots_5 0x1002810 /* U+2810 BRAILLE PATTERN DOTS-5 */ #define XK_braille_dots_15 0x1002811 /* U+2811 BRAILLE PATTERN DOTS-15 */ #define XK_braille_dots_25 0x1002812 /* U+2812 BRAILLE PATTERN DOTS-25 */ #define XK_braille_dots_125 0x1002813 /* U+2813 BRAILLE PATTERN DOTS-125 */ #define XK_braille_dots_35 0x1002814 /* U+2814 BRAILLE PATTERN DOTS-35 */ #define XK_braille_dots_135 0x1002815 /* U+2815 BRAILLE PATTERN DOTS-135 */ #define XK_braille_dots_235 0x1002816 /* U+2816 BRAILLE PATTERN DOTS-235 */ #define XK_braille_dots_1235 0x1002817 /* U+2817 BRAILLE PATTERN DOTS-1235 */ #define XK_braille_dots_45 0x1002818 /* U+2818 BRAILLE PATTERN DOTS-45 */ #define XK_braille_dots_145 0x1002819 /* U+2819 BRAILLE PATTERN DOTS-145 */ #define XK_braille_dots_245 0x100281a /* U+281a BRAILLE PATTERN DOTS-245 */ #define XK_braille_dots_1245 0x100281b /* U+281b BRAILLE PATTERN DOTS-1245 */ #define XK_braille_dots_345 0x100281c /* U+281c BRAILLE PATTERN DOTS-345 */ #define XK_braille_dots_1345 0x100281d /* U+281d BRAILLE PATTERN DOTS-1345 */ #define XK_braille_dots_2345 0x100281e /* U+281e BRAILLE PATTERN DOTS-2345 */ #define XK_braille_dots_12345 0x100281f /* U+281f BRAILLE PATTERN DOTS-12345 */ #define XK_braille_dots_6 0x1002820 /* U+2820 BRAILLE PATTERN DOTS-6 */ #define XK_braille_dots_16 0x1002821 /* U+2821 BRAILLE PATTERN DOTS-16 */ #define XK_braille_dots_26 0x1002822 /* U+2822 BRAILLE PATTERN DOTS-26 */ #define XK_braille_dots_126 0x1002823 /* U+2823 BRAILLE PATTERN DOTS-126 */ #define XK_braille_dots_36 0x1002824 /* U+2824 BRAILLE PATTERN DOTS-36 */ #define XK_braille_dots_136 0x1002825 /* U+2825 BRAILLE PATTERN DOTS-136 */ #define XK_braille_dots_236 0x1002826 /* U+2826 BRAILLE PATTERN DOTS-236 */ #define XK_braille_dots_1236 0x1002827 /* U+2827 BRAILLE PATTERN DOTS-1236 */ #define XK_braille_dots_46 0x1002828 /* U+2828 BRAILLE PATTERN DOTS-46 */ #define XK_braille_dots_146 0x1002829 /* U+2829 BRAILLE PATTERN DOTS-146 */ #define XK_braille_dots_246 0x100282a /* U+282a BRAILLE PATTERN DOTS-246 */ #define XK_braille_dots_1246 0x100282b /* U+282b BRAILLE PATTERN DOTS-1246 */ #define XK_braille_dots_346 0x100282c /* U+282c BRAILLE PATTERN DOTS-346 */ #define XK_braille_dots_1346 0x100282d /* U+282d BRAILLE PATTERN DOTS-1346 */ #define XK_braille_dots_2346 0x100282e /* U+282e BRAILLE PATTERN DOTS-2346 */ #define XK_braille_dots_12346 0x100282f /* U+282f BRAILLE PATTERN DOTS-12346 */ #define XK_braille_dots_56 0x1002830 /* U+2830 BRAILLE PATTERN DOTS-56 */ #define XK_braille_dots_156 0x1002831 /* U+2831 BRAILLE PATTERN DOTS-156 */ #define XK_braille_dots_256 0x1002832 /* U+2832 BRAILLE PATTERN DOTS-256 */ #define XK_braille_dots_1256 0x1002833 /* U+2833 BRAILLE PATTERN DOTS-1256 */ #define XK_braille_dots_356 0x1002834 /* U+2834 BRAILLE PATTERN DOTS-356 */ #define XK_braille_dots_1356 0x1002835 /* U+2835 BRAILLE PATTERN DOTS-1356 */ #define XK_braille_dots_2356 0x1002836 /* U+2836 BRAILLE PATTERN DOTS-2356 */ #define XK_braille_dots_12356 0x1002837 /* U+2837 BRAILLE PATTERN DOTS-12356 */ #define XK_braille_dots_456 0x1002838 /* U+2838 BRAILLE PATTERN DOTS-456 */ #define XK_braille_dots_1456 0x1002839 /* U+2839 BRAILLE PATTERN DOTS-1456 */ #define XK_braille_dots_2456 0x100283a /* U+283a BRAILLE PATTERN DOTS-2456 */ #define XK_braille_dots_12456 0x100283b /* U+283b BRAILLE PATTERN DOTS-12456 */ #define XK_braille_dots_3456 0x100283c /* U+283c BRAILLE PATTERN DOTS-3456 */ #define XK_braille_dots_13456 0x100283d /* U+283d BRAILLE PATTERN DOTS-13456 */ #define XK_braille_dots_23456 0x100283e /* U+283e BRAILLE PATTERN DOTS-23456 */ #define XK_braille_dots_123456 0x100283f /* U+283f BRAILLE PATTERN DOTS-123456 */ #define XK_braille_dots_7 0x1002840 /* U+2840 BRAILLE PATTERN DOTS-7 */ #define XK_braille_dots_17 0x1002841 /* U+2841 BRAILLE PATTERN DOTS-17 */ #define XK_braille_dots_27 0x1002842 /* U+2842 BRAILLE PATTERN DOTS-27 */ #define XK_braille_dots_127 0x1002843 /* U+2843 BRAILLE PATTERN DOTS-127 */ #define XK_braille_dots_37 0x1002844 /* U+2844 BRAILLE PATTERN DOTS-37 */ #define XK_braille_dots_137 0x1002845 /* U+2845 BRAILLE PATTERN DOTS-137 */ #define XK_braille_dots_237 0x1002846 /* U+2846 BRAILLE PATTERN DOTS-237 */ #define XK_braille_dots_1237 0x1002847 /* U+2847 BRAILLE PATTERN DOTS-1237 */ #define XK_braille_dots_47 0x1002848 /* U+2848 BRAILLE PATTERN DOTS-47 */ #define XK_braille_dots_147 0x1002849 /* U+2849 BRAILLE PATTERN DOTS-147 */ #define XK_braille_dots_247 0x100284a /* U+284a BRAILLE PATTERN DOTS-247 */ #define XK_braille_dots_1247 0x100284b /* U+284b BRAILLE PATTERN DOTS-1247 */ #define XK_braille_dots_347 0x100284c /* U+284c BRAILLE PATTERN DOTS-347 */ #define XK_braille_dots_1347 0x100284d /* U+284d BRAILLE PATTERN DOTS-1347 */ #define XK_braille_dots_2347 0x100284e /* U+284e BRAILLE PATTERN DOTS-2347 */ #define XK_braille_dots_12347 0x100284f /* U+284f BRAILLE PATTERN DOTS-12347 */ #define XK_braille_dots_57 0x1002850 /* U+2850 BRAILLE PATTERN DOTS-57 */ #define XK_braille_dots_157 0x1002851 /* U+2851 BRAILLE PATTERN DOTS-157 */ #define XK_braille_dots_257 0x1002852 /* U+2852 BRAILLE PATTERN DOTS-257 */ #define XK_braille_dots_1257 0x1002853 /* U+2853 BRAILLE PATTERN DOTS-1257 */ #define XK_braille_dots_357 0x1002854 /* U+2854 BRAILLE PATTERN DOTS-357 */ #define XK_braille_dots_1357 0x1002855 /* U+2855 BRAILLE PATTERN DOTS-1357 */ #define XK_braille_dots_2357 0x1002856 /* U+2856 BRAILLE PATTERN DOTS-2357 */ #define XK_braille_dots_12357 0x1002857 /* U+2857 BRAILLE PATTERN DOTS-12357 */ #define XK_braille_dots_457 0x1002858 /* U+2858 BRAILLE PATTERN DOTS-457 */ #define XK_braille_dots_1457 0x1002859 /* U+2859 BRAILLE PATTERN DOTS-1457 */ #define XK_braille_dots_2457 0x100285a /* U+285a BRAILLE PATTERN DOTS-2457 */ #define XK_braille_dots_12457 0x100285b /* U+285b BRAILLE PATTERN DOTS-12457 */ #define XK_braille_dots_3457 0x100285c /* U+285c BRAILLE PATTERN DOTS-3457 */ #define XK_braille_dots_13457 0x100285d /* U+285d BRAILLE PATTERN DOTS-13457 */ #define XK_braille_dots_23457 0x100285e /* U+285e BRAILLE PATTERN DOTS-23457 */ #define XK_braille_dots_123457 0x100285f /* U+285f BRAILLE PATTERN DOTS-123457 */ #define XK_braille_dots_67 0x1002860 /* U+2860 BRAILLE PATTERN DOTS-67 */ #define XK_braille_dots_167 0x1002861 /* U+2861 BRAILLE PATTERN DOTS-167 */ #define XK_braille_dots_267 0x1002862 /* U+2862 BRAILLE PATTERN DOTS-267 */ #define XK_braille_dots_1267 0x1002863 /* U+2863 BRAILLE PATTERN DOTS-1267 */ #define XK_braille_dots_367 0x1002864 /* U+2864 BRAILLE PATTERN DOTS-367 */ #define XK_braille_dots_1367 0x1002865 /* U+2865 BRAILLE PATTERN DOTS-1367 */ #define XK_braille_dots_2367 0x1002866 /* U+2866 BRAILLE PATTERN DOTS-2367 */ #define XK_braille_dots_12367 0x1002867 /* U+2867 BRAILLE PATTERN DOTS-12367 */ #define XK_braille_dots_467 0x1002868 /* U+2868 BRAILLE PATTERN DOTS-467 */ #define XK_braille_dots_1467 0x1002869 /* U+2869 BRAILLE PATTERN DOTS-1467 */ #define XK_braille_dots_2467 0x100286a /* U+286a BRAILLE PATTERN DOTS-2467 */ #define XK_braille_dots_12467 0x100286b /* U+286b BRAILLE PATTERN DOTS-12467 */ #define XK_braille_dots_3467 0x100286c /* U+286c BRAILLE PATTERN DOTS-3467 */ #define XK_braille_dots_13467 0x100286d /* U+286d BRAILLE PATTERN DOTS-13467 */ #define XK_braille_dots_23467 0x100286e /* U+286e BRAILLE PATTERN DOTS-23467 */ #define XK_braille_dots_123467 0x100286f /* U+286f BRAILLE PATTERN DOTS-123467 */ #define XK_braille_dots_567 0x1002870 /* U+2870 BRAILLE PATTERN DOTS-567 */ #define XK_braille_dots_1567 0x1002871 /* U+2871 BRAILLE PATTERN DOTS-1567 */ #define XK_braille_dots_2567 0x1002872 /* U+2872 BRAILLE PATTERN DOTS-2567 */ #define XK_braille_dots_12567 0x1002873 /* U+2873 BRAILLE PATTERN DOTS-12567 */ #define XK_braille_dots_3567 0x1002874 /* U+2874 BRAILLE PATTERN DOTS-3567 */ #define XK_braille_dots_13567 0x1002875 /* U+2875 BRAILLE PATTERN DOTS-13567 */ #define XK_braille_dots_23567 0x1002876 /* U+2876 BRAILLE PATTERN DOTS-23567 */ #define XK_braille_dots_123567 0x1002877 /* U+2877 BRAILLE PATTERN DOTS-123567 */ #define XK_braille_dots_4567 0x1002878 /* U+2878 BRAILLE PATTERN DOTS-4567 */ #define XK_braille_dots_14567 0x1002879 /* U+2879 BRAILLE PATTERN DOTS-14567 */ #define XK_braille_dots_24567 0x100287a /* U+287a BRAILLE PATTERN DOTS-24567 */ #define XK_braille_dots_124567 0x100287b /* U+287b BRAILLE PATTERN DOTS-124567 */ #define XK_braille_dots_34567 0x100287c /* U+287c BRAILLE PATTERN DOTS-34567 */ #define XK_braille_dots_134567 0x100287d /* U+287d BRAILLE PATTERN DOTS-134567 */ #define XK_braille_dots_234567 0x100287e /* U+287e BRAILLE PATTERN DOTS-234567 */ #define XK_braille_dots_1234567 0x100287f /* U+287f BRAILLE PATTERN DOTS-1234567 */ #define XK_braille_dots_8 0x1002880 /* U+2880 BRAILLE PATTERN DOTS-8 */ #define XK_braille_dots_18 0x1002881 /* U+2881 BRAILLE PATTERN DOTS-18 */ #define XK_braille_dots_28 0x1002882 /* U+2882 BRAILLE PATTERN DOTS-28 */ #define XK_braille_dots_128 0x1002883 /* U+2883 BRAILLE PATTERN DOTS-128 */ #define XK_braille_dots_38 0x1002884 /* U+2884 BRAILLE PATTERN DOTS-38 */ #define XK_braille_dots_138 0x1002885 /* U+2885 BRAILLE PATTERN DOTS-138 */ #define XK_braille_dots_238 0x1002886 /* U+2886 BRAILLE PATTERN DOTS-238 */ #define XK_braille_dots_1238 0x1002887 /* U+2887 BRAILLE PATTERN DOTS-1238 */ #define XK_braille_dots_48 0x1002888 /* U+2888 BRAILLE PATTERN DOTS-48 */ #define XK_braille_dots_148 0x1002889 /* U+2889 BRAILLE PATTERN DOTS-148 */ #define XK_braille_dots_248 0x100288a /* U+288a BRAILLE PATTERN DOTS-248 */ #define XK_braille_dots_1248 0x100288b /* U+288b BRAILLE PATTERN DOTS-1248 */ #define XK_braille_dots_348 0x100288c /* U+288c BRAILLE PATTERN DOTS-348 */ #define XK_braille_dots_1348 0x100288d /* U+288d BRAILLE PATTERN DOTS-1348 */ #define XK_braille_dots_2348 0x100288e /* U+288e BRAILLE PATTERN DOTS-2348 */ #define XK_braille_dots_12348 0x100288f /* U+288f BRAILLE PATTERN DOTS-12348 */ #define XK_braille_dots_58 0x1002890 /* U+2890 BRAILLE PATTERN DOTS-58 */ #define XK_braille_dots_158 0x1002891 /* U+2891 BRAILLE PATTERN DOTS-158 */ #define XK_braille_dots_258 0x1002892 /* U+2892 BRAILLE PATTERN DOTS-258 */ #define XK_braille_dots_1258 0x1002893 /* U+2893 BRAILLE PATTERN DOTS-1258 */ #define XK_braille_dots_358 0x1002894 /* U+2894 BRAILLE PATTERN DOTS-358 */ #define XK_braille_dots_1358 0x1002895 /* U+2895 BRAILLE PATTERN DOTS-1358 */ #define XK_braille_dots_2358 0x1002896 /* U+2896 BRAILLE PATTERN DOTS-2358 */ #define XK_braille_dots_12358 0x1002897 /* U+2897 BRAILLE PATTERN DOTS-12358 */ #define XK_braille_dots_458 0x1002898 /* U+2898 BRAILLE PATTERN DOTS-458 */ #define XK_braille_dots_1458 0x1002899 /* U+2899 BRAILLE PATTERN DOTS-1458 */ #define XK_braille_dots_2458 0x100289a /* U+289a BRAILLE PATTERN DOTS-2458 */ #define XK_braille_dots_12458 0x100289b /* U+289b BRAILLE PATTERN DOTS-12458 */ #define XK_braille_dots_3458 0x100289c /* U+289c BRAILLE PATTERN DOTS-3458 */ #define XK_braille_dots_13458 0x100289d /* U+289d BRAILLE PATTERN DOTS-13458 */ #define XK_braille_dots_23458 0x100289e /* U+289e BRAILLE PATTERN DOTS-23458 */ #define XK_braille_dots_123458 0x100289f /* U+289f BRAILLE PATTERN DOTS-123458 */ #define XK_braille_dots_68 0x10028a0 /* U+28a0 BRAILLE PATTERN DOTS-68 */ #define XK_braille_dots_168 0x10028a1 /* U+28a1 BRAILLE PATTERN DOTS-168 */ #define XK_braille_dots_268 0x10028a2 /* U+28a2 BRAILLE PATTERN DOTS-268 */ #define XK_braille_dots_1268 0x10028a3 /* U+28a3 BRAILLE PATTERN DOTS-1268 */ #define XK_braille_dots_368 0x10028a4 /* U+28a4 BRAILLE PATTERN DOTS-368 */ #define XK_braille_dots_1368 0x10028a5 /* U+28a5 BRAILLE PATTERN DOTS-1368 */ #define XK_braille_dots_2368 0x10028a6 /* U+28a6 BRAILLE PATTERN DOTS-2368 */ #define XK_braille_dots_12368 0x10028a7 /* U+28a7 BRAILLE PATTERN DOTS-12368 */ #define XK_braille_dots_468 0x10028a8 /* U+28a8 BRAILLE PATTERN DOTS-468 */ #define XK_braille_dots_1468 0x10028a9 /* U+28a9 BRAILLE PATTERN DOTS-1468 */ #define XK_braille_dots_2468 0x10028aa /* U+28aa BRAILLE PATTERN DOTS-2468 */ #define XK_braille_dots_12468 0x10028ab /* U+28ab BRAILLE PATTERN DOTS-12468 */ #define XK_braille_dots_3468 0x10028ac /* U+28ac BRAILLE PATTERN DOTS-3468 */ #define XK_braille_dots_13468 0x10028ad /* U+28ad BRAILLE PATTERN DOTS-13468 */ #define XK_braille_dots_23468 0x10028ae /* U+28ae BRAILLE PATTERN DOTS-23468 */ #define XK_braille_dots_123468 0x10028af /* U+28af BRAILLE PATTERN DOTS-123468 */ #define XK_braille_dots_568 0x10028b0 /* U+28b0 BRAILLE PATTERN DOTS-568 */ #define XK_braille_dots_1568 0x10028b1 /* U+28b1 BRAILLE PATTERN DOTS-1568 */ #define XK_braille_dots_2568 0x10028b2 /* U+28b2 BRAILLE PATTERN DOTS-2568 */ #define XK_braille_dots_12568 0x10028b3 /* U+28b3 BRAILLE PATTERN DOTS-12568 */ #define XK_braille_dots_3568 0x10028b4 /* U+28b4 BRAILLE PATTERN DOTS-3568 */ #define XK_braille_dots_13568 0x10028b5 /* U+28b5 BRAILLE PATTERN DOTS-13568 */ #define XK_braille_dots_23568 0x10028b6 /* U+28b6 BRAILLE PATTERN DOTS-23568 */ #define XK_braille_dots_123568 0x10028b7 /* U+28b7 BRAILLE PATTERN DOTS-123568 */ #define XK_braille_dots_4568 0x10028b8 /* U+28b8 BRAILLE PATTERN DOTS-4568 */ #define XK_braille_dots_14568 0x10028b9 /* U+28b9 BRAILLE PATTERN DOTS-14568 */ #define XK_braille_dots_24568 0x10028ba /* U+28ba BRAILLE PATTERN DOTS-24568 */ #define XK_braille_dots_124568 0x10028bb /* U+28bb BRAILLE PATTERN DOTS-124568 */ #define XK_braille_dots_34568 0x10028bc /* U+28bc BRAILLE PATTERN DOTS-34568 */ #define XK_braille_dots_134568 0x10028bd /* U+28bd BRAILLE PATTERN DOTS-134568 */ #define XK_braille_dots_234568 0x10028be /* U+28be BRAILLE PATTERN DOTS-234568 */ #define XK_braille_dots_1234568 0x10028bf /* U+28bf BRAILLE PATTERN DOTS-1234568 */ #define XK_braille_dots_78 0x10028c0 /* U+28c0 BRAILLE PATTERN DOTS-78 */ #define XK_braille_dots_178 0x10028c1 /* U+28c1 BRAILLE PATTERN DOTS-178 */ #define XK_braille_dots_278 0x10028c2 /* U+28c2 BRAILLE PATTERN DOTS-278 */ #define XK_braille_dots_1278 0x10028c3 /* U+28c3 BRAILLE PATTERN DOTS-1278 */ #define XK_braille_dots_378 0x10028c4 /* U+28c4 BRAILLE PATTERN DOTS-378 */ #define XK_braille_dots_1378 0x10028c5 /* U+28c5 BRAILLE PATTERN DOTS-1378 */ #define XK_braille_dots_2378 0x10028c6 /* U+28c6 BRAILLE PATTERN DOTS-2378 */ #define XK_braille_dots_12378 0x10028c7 /* U+28c7 BRAILLE PATTERN DOTS-12378 */ #define XK_braille_dots_478 0x10028c8 /* U+28c8 BRAILLE PATTERN DOTS-478 */ #define XK_braille_dots_1478 0x10028c9 /* U+28c9 BRAILLE PATTERN DOTS-1478 */ #define XK_braille_dots_2478 0x10028ca /* U+28ca BRAILLE PATTERN DOTS-2478 */ #define XK_braille_dots_12478 0x10028cb /* U+28cb BRAILLE PATTERN DOTS-12478 */ #define XK_braille_dots_3478 0x10028cc /* U+28cc BRAILLE PATTERN DOTS-3478 */ #define XK_braille_dots_13478 0x10028cd /* U+28cd BRAILLE PATTERN DOTS-13478 */ #define XK_braille_dots_23478 0x10028ce /* U+28ce BRAILLE PATTERN DOTS-23478 */ #define XK_braille_dots_123478 0x10028cf /* U+28cf BRAILLE PATTERN DOTS-123478 */ #define XK_braille_dots_578 0x10028d0 /* U+28d0 BRAILLE PATTERN DOTS-578 */ #define XK_braille_dots_1578 0x10028d1 /* U+28d1 BRAILLE PATTERN DOTS-1578 */ #define XK_braille_dots_2578 0x10028d2 /* U+28d2 BRAILLE PATTERN DOTS-2578 */ #define XK_braille_dots_12578 0x10028d3 /* U+28d3 BRAILLE PATTERN DOTS-12578 */ #define XK_braille_dots_3578 0x10028d4 /* U+28d4 BRAILLE PATTERN DOTS-3578 */ #define XK_braille_dots_13578 0x10028d5 /* U+28d5 BRAILLE PATTERN DOTS-13578 */ #define XK_braille_dots_23578 0x10028d6 /* U+28d6 BRAILLE PATTERN DOTS-23578 */ #define XK_braille_dots_123578 0x10028d7 /* U+28d7 BRAILLE PATTERN DOTS-123578 */ #define XK_braille_dots_4578 0x10028d8 /* U+28d8 BRAILLE PATTERN DOTS-4578 */ #define XK_braille_dots_14578 0x10028d9 /* U+28d9 BRAILLE PATTERN DOTS-14578 */ #define XK_braille_dots_24578 0x10028da /* U+28da BRAILLE PATTERN DOTS-24578 */ #define XK_braille_dots_124578 0x10028db /* U+28db BRAILLE PATTERN DOTS-124578 */ #define XK_braille_dots_34578 0x10028dc /* U+28dc BRAILLE PATTERN DOTS-34578 */ #define XK_braille_dots_134578 0x10028dd /* U+28dd BRAILLE PATTERN DOTS-134578 */ #define XK_braille_dots_234578 0x10028de /* U+28de BRAILLE PATTERN DOTS-234578 */ #define XK_braille_dots_1234578 0x10028df /* U+28df BRAILLE PATTERN DOTS-1234578 */ #define XK_braille_dots_678 0x10028e0 /* U+28e0 BRAILLE PATTERN DOTS-678 */ #define XK_braille_dots_1678 0x10028e1 /* U+28e1 BRAILLE PATTERN DOTS-1678 */ #define XK_braille_dots_2678 0x10028e2 /* U+28e2 BRAILLE PATTERN DOTS-2678 */ #define XK_braille_dots_12678 0x10028e3 /* U+28e3 BRAILLE PATTERN DOTS-12678 */ #define XK_braille_dots_3678 0x10028e4 /* U+28e4 BRAILLE PATTERN DOTS-3678 */ #define XK_braille_dots_13678 0x10028e5 /* U+28e5 BRAILLE PATTERN DOTS-13678 */ #define XK_braille_dots_23678 0x10028e6 /* U+28e6 BRAILLE PATTERN DOTS-23678 */ #define XK_braille_dots_123678 0x10028e7 /* U+28e7 BRAILLE PATTERN DOTS-123678 */ #define XK_braille_dots_4678 0x10028e8 /* U+28e8 BRAILLE PATTERN DOTS-4678 */ #define XK_braille_dots_14678 0x10028e9 /* U+28e9 BRAILLE PATTERN DOTS-14678 */ #define XK_braille_dots_24678 0x10028ea /* U+28ea BRAILLE PATTERN DOTS-24678 */ #define XK_braille_dots_124678 0x10028eb /* U+28eb BRAILLE PATTERN DOTS-124678 */ #define XK_braille_dots_34678 0x10028ec /* U+28ec BRAILLE PATTERN DOTS-34678 */ #define XK_braille_dots_134678 0x10028ed /* U+28ed BRAILLE PATTERN DOTS-134678 */ #define XK_braille_dots_234678 0x10028ee /* U+28ee BRAILLE PATTERN DOTS-234678 */ #define XK_braille_dots_1234678 0x10028ef /* U+28ef BRAILLE PATTERN DOTS-1234678 */ #define XK_braille_dots_5678 0x10028f0 /* U+28f0 BRAILLE PATTERN DOTS-5678 */ #define XK_braille_dots_15678 0x10028f1 /* U+28f1 BRAILLE PATTERN DOTS-15678 */ #define XK_braille_dots_25678 0x10028f2 /* U+28f2 BRAILLE PATTERN DOTS-25678 */ #define XK_braille_dots_125678 0x10028f3 /* U+28f3 BRAILLE PATTERN DOTS-125678 */ #define XK_braille_dots_35678 0x10028f4 /* U+28f4 BRAILLE PATTERN DOTS-35678 */ #define XK_braille_dots_135678 0x10028f5 /* U+28f5 BRAILLE PATTERN DOTS-135678 */ #define XK_braille_dots_235678 0x10028f6 /* U+28f6 BRAILLE PATTERN DOTS-235678 */ #define XK_braille_dots_1235678 0x10028f7 /* U+28f7 BRAILLE PATTERN DOTS-1235678 */ #define XK_braille_dots_45678 0x10028f8 /* U+28f8 BRAILLE PATTERN DOTS-45678 */ #define XK_braille_dots_145678 0x10028f9 /* U+28f9 BRAILLE PATTERN DOTS-145678 */ #define XK_braille_dots_245678 0x10028fa /* U+28fa BRAILLE PATTERN DOTS-245678 */ #define XK_braille_dots_1245678 0x10028fb /* U+28fb BRAILLE PATTERN DOTS-1245678 */ #define XK_braille_dots_345678 0x10028fc /* U+28fc BRAILLE PATTERN DOTS-345678 */ #define XK_braille_dots_1345678 0x10028fd /* U+28fd BRAILLE PATTERN DOTS-1345678 */ #define XK_braille_dots_2345678 0x10028fe /* U+28fe BRAILLE PATTERN DOTS-2345678 */ #define XK_braille_dots_12345678 0x10028ff /* U+28ff BRAILLE PATTERN DOTS-12345678 */ #endif /* XK_BRAILLE */ /* * Sinhala (http://unicode.org/charts/PDF/U0D80.pdf) * http://www.nongnu.org/sinhala/doc/transliteration/sinhala-transliteration_6.html */ #ifdef XK_SINHALA #define XK_Sinh_ng 0x1000d82 /* U+0D82 SINHALA ANUSVARAYA */ #define XK_Sinh_h2 0x1000d83 /* U+0D83 SINHALA VISARGAYA */ #define XK_Sinh_a 0x1000d85 /* U+0D85 SINHALA AYANNA */ #define XK_Sinh_aa 0x1000d86 /* U+0D86 SINHALA AAYANNA */ #define XK_Sinh_ae 0x1000d87 /* U+0D87 SINHALA AEYANNA */ #define XK_Sinh_aee 0x1000d88 /* U+0D88 SINHALA AEEYANNA */ #define XK_Sinh_i 0x1000d89 /* U+0D89 SINHALA IYANNA */ #define XK_Sinh_ii 0x1000d8a /* U+0D8A SINHALA IIYANNA */ #define XK_Sinh_u 0x1000d8b /* U+0D8B SINHALA UYANNA */ #define XK_Sinh_uu 0x1000d8c /* U+0D8C SINHALA UUYANNA */ #define XK_Sinh_ri 0x1000d8d /* U+0D8D SINHALA IRUYANNA */ #define XK_Sinh_rii 0x1000d8e /* U+0D8E SINHALA IRUUYANNA */ #define XK_Sinh_lu 0x1000d8f /* U+0D8F SINHALA ILUYANNA */ #define XK_Sinh_luu 0x1000d90 /* U+0D90 SINHALA ILUUYANNA */ #define XK_Sinh_e 0x1000d91 /* U+0D91 SINHALA EYANNA */ #define XK_Sinh_ee 0x1000d92 /* U+0D92 SINHALA EEYANNA */ #define XK_Sinh_ai 0x1000d93 /* U+0D93 SINHALA AIYANNA */ #define XK_Sinh_o 0x1000d94 /* U+0D94 SINHALA OYANNA */ #define XK_Sinh_oo 0x1000d95 /* U+0D95 SINHALA OOYANNA */ #define XK_Sinh_au 0x1000d96 /* U+0D96 SINHALA AUYANNA */ #define XK_Sinh_ka 0x1000d9a /* U+0D9A SINHALA KAYANNA */ #define XK_Sinh_kha 0x1000d9b /* U+0D9B SINHALA MAHA. KAYANNA */ #define XK_Sinh_ga 0x1000d9c /* U+0D9C SINHALA GAYANNA */ #define XK_Sinh_gha 0x1000d9d /* U+0D9D SINHALA MAHA. GAYANNA */ #define XK_Sinh_ng2 0x1000d9e /* U+0D9E SINHALA KANTAJA NAASIKYAYA */ #define XK_Sinh_nga 0x1000d9f /* U+0D9F SINHALA SANYAKA GAYANNA */ #define XK_Sinh_ca 0x1000da0 /* U+0DA0 SINHALA CAYANNA */ #define XK_Sinh_cha 0x1000da1 /* U+0DA1 SINHALA MAHA. CAYANNA */ #define XK_Sinh_ja 0x1000da2 /* U+0DA2 SINHALA JAYANNA */ #define XK_Sinh_jha 0x1000da3 /* U+0DA3 SINHALA MAHA. JAYANNA */ #define XK_Sinh_nya 0x1000da4 /* U+0DA4 SINHALA TAALUJA NAASIKYAYA */ #define XK_Sinh_jnya 0x1000da5 /* U+0DA5 SINHALA TAALUJA SANYOOGA NAASIKYAYA */ #define XK_Sinh_nja 0x1000da6 /* U+0DA6 SINHALA SANYAKA JAYANNA */ #define XK_Sinh_tta 0x1000da7 /* U+0DA7 SINHALA TTAYANNA */ #define XK_Sinh_ttha 0x1000da8 /* U+0DA8 SINHALA MAHA. TTAYANNA */ #define XK_Sinh_dda 0x1000da9 /* U+0DA9 SINHALA DDAYANNA */ #define XK_Sinh_ddha 0x1000daa /* U+0DAA SINHALA MAHA. DDAYANNA */ #define XK_Sinh_nna 0x1000dab /* U+0DAB SINHALA MUURDHAJA NAYANNA */ #define XK_Sinh_ndda 0x1000dac /* U+0DAC SINHALA SANYAKA DDAYANNA */ #define XK_Sinh_tha 0x1000dad /* U+0DAD SINHALA TAYANNA */ #define XK_Sinh_thha 0x1000dae /* U+0DAE SINHALA MAHA. TAYANNA */ #define XK_Sinh_dha 0x1000daf /* U+0DAF SINHALA DAYANNA */ #define XK_Sinh_dhha 0x1000db0 /* U+0DB0 SINHALA MAHA. DAYANNA */ #define XK_Sinh_na 0x1000db1 /* U+0DB1 SINHALA DANTAJA NAYANNA */ #define XK_Sinh_ndha 0x1000db3 /* U+0DB3 SINHALA SANYAKA DAYANNA */ #define XK_Sinh_pa 0x1000db4 /* U+0DB4 SINHALA PAYANNA */ #define XK_Sinh_pha 0x1000db5 /* U+0DB5 SINHALA MAHA. PAYANNA */ #define XK_Sinh_ba 0x1000db6 /* U+0DB6 SINHALA BAYANNA */ #define XK_Sinh_bha 0x1000db7 /* U+0DB7 SINHALA MAHA. BAYANNA */ #define XK_Sinh_ma 0x1000db8 /* U+0DB8 SINHALA MAYANNA */ #define XK_Sinh_mba 0x1000db9 /* U+0DB9 SINHALA AMBA BAYANNA */ #define XK_Sinh_ya 0x1000dba /* U+0DBA SINHALA YAYANNA */ #define XK_Sinh_ra 0x1000dbb /* U+0DBB SINHALA RAYANNA */ #define XK_Sinh_la 0x1000dbd /* U+0DBD SINHALA DANTAJA LAYANNA */ #define XK_Sinh_va 0x1000dc0 /* U+0DC0 SINHALA VAYANNA */ #define XK_Sinh_sha 0x1000dc1 /* U+0DC1 SINHALA TAALUJA SAYANNA */ #define XK_Sinh_ssha 0x1000dc2 /* U+0DC2 SINHALA MUURDHAJA SAYANNA */ #define XK_Sinh_sa 0x1000dc3 /* U+0DC3 SINHALA DANTAJA SAYANNA */ #define XK_Sinh_ha 0x1000dc4 /* U+0DC4 SINHALA HAYANNA */ #define XK_Sinh_lla 0x1000dc5 /* U+0DC5 SINHALA MUURDHAJA LAYANNA */ #define XK_Sinh_fa 0x1000dc6 /* U+0DC6 SINHALA FAYANNA */ #define XK_Sinh_al 0x1000dca /* U+0DCA SINHALA AL-LAKUNA */ #define XK_Sinh_aa2 0x1000dcf /* U+0DCF SINHALA AELA-PILLA */ #define XK_Sinh_ae2 0x1000dd0 /* U+0DD0 SINHALA AEDA-PILLA */ #define XK_Sinh_aee2 0x1000dd1 /* U+0DD1 SINHALA DIGA AEDA-PILLA */ #define XK_Sinh_i2 0x1000dd2 /* U+0DD2 SINHALA IS-PILLA */ #define XK_Sinh_ii2 0x1000dd3 /* U+0DD3 SINHALA DIGA IS-PILLA */ #define XK_Sinh_u2 0x1000dd4 /* U+0DD4 SINHALA PAA-PILLA */ #define XK_Sinh_uu2 0x1000dd6 /* U+0DD6 SINHALA DIGA PAA-PILLA */ #define XK_Sinh_ru2 0x1000dd8 /* U+0DD8 SINHALA GAETTA-PILLA */ #define XK_Sinh_e2 0x1000dd9 /* U+0DD9 SINHALA KOMBUVA */ #define XK_Sinh_ee2 0x1000dda /* U+0DDA SINHALA DIGA KOMBUVA */ #define XK_Sinh_ai2 0x1000ddb /* U+0DDB SINHALA KOMBU DEKA */ #define XK_Sinh_o2 0x1000ddc /* U+0DDC SINHALA KOMBUVA HAA AELA-PILLA*/ #define XK_Sinh_oo2 0x1000ddd /* U+0DDD SINHALA KOMBUVA HAA DIGA AELA-PILLA*/ #define XK_Sinh_au2 0x1000dde /* U+0DDE SINHALA KOMBUVA HAA GAYANUKITTA */ #define XK_Sinh_lu2 0x1000ddf /* U+0DDF SINHALA GAYANUKITTA */ #define XK_Sinh_ruu2 0x1000df2 /* U+0DF2 SINHALA DIGA GAETTA-PILLA */ #define XK_Sinh_luu2 0x1000df3 /* U+0DF3 SINHALA DIGA GAYANUKITTA */ #define XK_Sinh_kunddaliya 0x1000df4 /* U+0DF4 SINHALA KUNDDALIYA */ #endif /* XK_SINHALA */ nx-libs-3.5.99.23/nx-X11/include/keysym.h0000644000000000000000000000533113614532331014422 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* default keysyms */ #define XK_MISCELLANY #define XK_XKB_KEYS #define XK_LATIN1 #define XK_LATIN2 #define XK_LATIN3 #define XK_LATIN4 #define XK_LATIN8 #define XK_LATIN9 #define XK_CAUCASUS #define XK_GREEK #define XK_KATAKANA #define XK_ARABIC #define XK_CYRILLIC #define XK_HEBREW #define XK_THAI #define XK_KOREAN #define XK_ARMENIAN #define XK_GEORGIAN #define XK_VIETNAMESE #define XK_CURRENCY #define XK_MATHEMATICAL #define XK_BRAILLE #define XK_SINHALA #include nx-libs-3.5.99.23/nx-X11/include/Sunkeysym.h0000644000000000000000000000766613614532331015125 0ustar /* * Copyright (c) 1991, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /************************************************************ Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ***********************************************************/ /* * Floating Accent */ #define SunXK_FA_Grave 0x1005FF00 #define SunXK_FA_Circum 0x1005FF01 #define SunXK_FA_Tilde 0x1005FF02 #define SunXK_FA_Acute 0x1005FF03 #define SunXK_FA_Diaeresis 0x1005FF04 #define SunXK_FA_Cedilla 0x1005FF05 /* * Miscellaneous Functions */ #define SunXK_F36 0x1005FF10 /* Labeled F11 */ #define SunXK_F37 0x1005FF11 /* Labeled F12 */ #define SunXK_Sys_Req 0x1005FF60 #define SunXK_Print_Screen 0x0000FF61 /* Same as XK_Print */ /* * International & Multi-Key Character Composition */ #define SunXK_Compose 0x0000FF20 /* Same as XK_Multi_key */ #define SunXK_AltGraph 0x0000FF7E /* Same as XK_Mode_switch */ /* * Cursor Control */ #define SunXK_PageUp 0x0000FF55 /* Same as XK_Prior */ #define SunXK_PageDown 0x0000FF56 /* Same as XK_Next */ /* * Open Look Functions */ #define SunXK_Undo 0x0000FF65 /* Same as XK_Undo */ #define SunXK_Again 0x0000FF66 /* Same as XK_Redo */ #define SunXK_Find 0x0000FF68 /* Same as XK_Find */ #define SunXK_Stop 0x0000FF69 /* Same as XK_Cancel */ #define SunXK_Props 0x1005FF70 #define SunXK_Front 0x1005FF71 #define SunXK_Copy 0x1005FF72 #define SunXK_Open 0x1005FF73 #define SunXK_Paste 0x1005FF74 #define SunXK_Cut 0x1005FF75 #define SunXK_PowerSwitch 0x1005FF76 #define SunXK_AudioLowerVolume 0x1005FF77 #define SunXK_AudioMute 0x1005FF78 #define SunXK_AudioRaiseVolume 0x1005FF79 #define SunXK_VideoDegauss 0x1005FF7A #define SunXK_VideoLowerBrightness 0x1005FF7B #define SunXK_VideoRaiseBrightness 0x1005FF7C #define SunXK_PowerSwitchShift 0x1005FF7D nx-libs-3.5.99.23/nx-X11/include/Xalloca.h0000644000000000000000000001177313614532331014473 0ustar /* Copyright 1995, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * The purpose of this header is to define the macros ALLOCATE_LOCAL and * DEALLOCATE_LOCAL appropriately for the platform being compiled on. * These macros are used to make fast, function-local memory allocations. * Their characteristics are as follows: * * void *ALLOCATE_LOCAL(int size) * Returns a pointer to size bytes of memory, or NULL if the allocation * failed. The memory must be freed with DEALLOCATE_LOCAL before the * function that made the allocation returns. You should not ask for * large blocks of memory with this function, since on many platforms * the memory comes from the stack, which may have limited size. * * void DEALLOCATE_LOCAL(void *) * Frees the memory allocated by ALLOCATE_LOCAL. Omission of this * step may be harmless on some platforms, but will result in * memory leaks or worse on others. * * Before including this file, you should define two macros, * ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK, that have the * same characteristics as ALLOCATE_LOCAL and DEALLOCATE_LOCAL. The * header uses the fallbacks if it doesn't know a "better" way to define * ALLOCATE_LOCAL and DEALLOCATE_LOCAL. Typical usage would be: * * #define ALLOCATE_LOCAL_FALLBACK(_size) malloc(_size) * #define DEALLOCATE_LOCAL_FALLBACK(_ptr) free(_ptr) * #include "Xalloca.h" */ #ifndef XALLOCA_H #define XALLOCA_H 1 #ifndef INCLUDE_ALLOCA_H # if defined(__SUNPRO_C) /* Need to add more here to match Imake *.cf's */ # define INCLUDE_ALLOCA_H # endif #endif #ifdef INCLUDE_ALLOCA_H # include #endif #ifndef NO_ALLOCA /* * os-dependent definition of local allocation and deallocation * If you want something other than (DE)ALLOCATE_LOCAL_FALLBACK * for ALLOCATE/DEALLOCATE_LOCAL then you add that in here. */ # if defined(__HIGHC__) # ifndef NCR extern char *alloca(); # if HCVERSION < 21003 # define ALLOCATE_LOCAL(size) alloca((int)(size)) pragma on(alloca); # else /* HCVERSION >= 21003 */ # define ALLOCATE_LOCAL(size) _Alloca((int)(size)) # endif /* HCVERSION < 21003 */ # else /* NCR */ # define ALLOCATE_LOCAL(size) alloca(size) # endif # endif /* defined(__HIGHC__) */ # ifdef __GNUC__ # ifndef alloca # define alloca __builtin_alloca # endif /* !alloca */ # define ALLOCATE_LOCAL(size) alloca((int)(size)) # else /* ! __GNUC__ */ /* * warning: old mips alloca (pre 2.10) is unusable, new one is built in * Test is easy, the new one is named __builtin_alloca and comes * from alloca.h which #defines alloca. */ # ifndef NCR # if defined(vax) || defined(sun) || defined(apollo) || defined(stellar) || defined(alloca) /* * Some System V boxes extract alloca.o from /lib/libPW.a; if you * decide that you don't want to use alloca, you might want to fix it here. */ /* alloca might be a macro taking one arg (hi, Sun!), so give it one. */ # define __Xnullarg /* as nothing */ # ifndef X_NOT_STDC_ENV extern void *alloca(__Xnullarg); # else extern char *alloca(__Xnullarg); # endif # define ALLOCATE_LOCAL(size) alloca((int)(size)) # endif /* who does alloca */ # endif /* NCR */ # endif /* __GNUC__ */ #endif /* NO_ALLOCA */ #if !defined(ALLOCATE_LOCAL) # if defined(ALLOCATE_LOCAL_FALLBACK) && defined(DEALLOCATE_LOCAL_FALLBACK) # define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK(_size) # define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK(_ptr) # else /* no fallbacks supplied; error */ # define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK undefined! # define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK undefined! # endif /* defined(ALLOCATE_LOCAL_FALLBACK && DEALLOCATE_LOCAL_FALLBACK) */ #else # if !defined(DEALLOCATE_LOCAL) # define DEALLOCATE_LOCAL(_ptr) do {} while(0) # endif #endif /* defined(ALLOCATE_LOCAL) */ #endif /* XALLOCA_H */ nx-libs-3.5.99.23/nx-X11/include/Xarch.h0000644000000000000000000000543513614532331014153 0ustar #ifndef _XARCH_H_ #define _XARCH_H_ /* * Copyright 1997 Metro Link Incorporated * * All Rights Reserved * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of the above listed copyright holder(s) * not be used in advertising or publicity pertaining to distribution of * the software without specific, written prior permission. The above listed * copyright holder(s) make(s) no representations about the suitability of * this software for any purpose. It is provided "as is" without express or * implied warranty. * * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Determine the machine's byte order. */ /* See if it is set in the imake config first */ #ifdef X_BYTE_ORDER #define X_BIG_ENDIAN 4321 #define X_LITTLE_ENDIAN 1234 #else #ifdef SVR4 #if defined(NCR) || defined(Mips) #include #else #if !defined(sun) #include #endif #endif #elif defined(CSRG_BASED) #if defined(__NetBSD__) || defined(__OpenBSD__) #include #endif #include #elif defined(linux) #if defined __STRICT_ANSI__ #undef __STRICT_ANSI__ #include #define __STRICT_ANSI__ #else #include #endif /* 'endian.h' might have been included before 'Xarch.h' */ #if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN) #define LITTLE_ENDIAN __LITTLE_ENDIAN #endif #if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN) #define BIG_ENDIAN __BIG_ENDIAN #endif #if !defined(PDP_ENDIAN) && defined(__PDP_ENDIAN) #define PDP_ENDIAN __PDP_ENDIAN #endif #if !defined(BYTE_ORDER) && defined(__BYTE_ORDER) #define BYTE_ORDER __BYTE_ORDER #endif #endif #ifndef BYTE_ORDER #define LITTLE_ENDIAN 1234 #define BIG_ENDIAN 4321 #if (defined(sun) && defined(SVR4)) #include #ifdef _LITTLE_ENDIAN #define BYTE_ORDER LITTLE_ENDIAN #endif #ifdef _BIG_ENDIAN #define BYTE_ORDER BIG_ENDIAN #endif #endif /* sun */ #endif /* BYTE_ORDER */ #define X_BYTE_ORDER BYTE_ORDER #define X_BIG_ENDIAN BIG_ENDIAN #define X_LITTLE_ENDIAN LITTLE_ENDIAN #endif /* not in imake config */ #endif /* _XARCH_H_ */ nx-libs-3.5.99.23/nx-X11/include/Xatom.h0000644000000000000000000000472613614532331014200 0ustar #ifndef XATOM_H #define XATOM_H 1 /* THIS IS A GENERATED FILE * * Do not change! Changing this file implies a protocol change! */ #define XA_PRIMARY ((Atom) 1) #define XA_SECONDARY ((Atom) 2) #define XA_ARC ((Atom) 3) #define XA_ATOM ((Atom) 4) #define XA_BITMAP ((Atom) 5) #define XA_CARDINAL ((Atom) 6) #define XA_COLORMAP ((Atom) 7) #define XA_CURSOR ((Atom) 8) #define XA_CUT_BUFFER0 ((Atom) 9) #define XA_CUT_BUFFER1 ((Atom) 10) #define XA_CUT_BUFFER2 ((Atom) 11) #define XA_CUT_BUFFER3 ((Atom) 12) #define XA_CUT_BUFFER4 ((Atom) 13) #define XA_CUT_BUFFER5 ((Atom) 14) #define XA_CUT_BUFFER6 ((Atom) 15) #define XA_CUT_BUFFER7 ((Atom) 16) #define XA_DRAWABLE ((Atom) 17) #define XA_FONT ((Atom) 18) #define XA_INTEGER ((Atom) 19) #define XA_PIXMAP ((Atom) 20) #define XA_POINT ((Atom) 21) #define XA_RECTANGLE ((Atom) 22) #define XA_RESOURCE_MANAGER ((Atom) 23) #define XA_RGB_COLOR_MAP ((Atom) 24) #define XA_RGB_BEST_MAP ((Atom) 25) #define XA_RGB_BLUE_MAP ((Atom) 26) #define XA_RGB_DEFAULT_MAP ((Atom) 27) #define XA_RGB_GRAY_MAP ((Atom) 28) #define XA_RGB_GREEN_MAP ((Atom) 29) #define XA_RGB_RED_MAP ((Atom) 30) #define XA_STRING ((Atom) 31) #define XA_VISUALID ((Atom) 32) #define XA_WINDOW ((Atom) 33) #define XA_WM_COMMAND ((Atom) 34) #define XA_WM_HINTS ((Atom) 35) #define XA_WM_CLIENT_MACHINE ((Atom) 36) #define XA_WM_ICON_NAME ((Atom) 37) #define XA_WM_ICON_SIZE ((Atom) 38) #define XA_WM_NAME ((Atom) 39) #define XA_WM_NORMAL_HINTS ((Atom) 40) #define XA_WM_SIZE_HINTS ((Atom) 41) #define XA_WM_ZOOM_HINTS ((Atom) 42) #define XA_MIN_SPACE ((Atom) 43) #define XA_NORM_SPACE ((Atom) 44) #define XA_MAX_SPACE ((Atom) 45) #define XA_END_SPACE ((Atom) 46) #define XA_SUPERSCRIPT_X ((Atom) 47) #define XA_SUPERSCRIPT_Y ((Atom) 48) #define XA_SUBSCRIPT_X ((Atom) 49) #define XA_SUBSCRIPT_Y ((Atom) 50) #define XA_UNDERLINE_POSITION ((Atom) 51) #define XA_UNDERLINE_THICKNESS ((Atom) 52) #define XA_STRIKEOUT_ASCENT ((Atom) 53) #define XA_STRIKEOUT_DESCENT ((Atom) 54) #define XA_ITALIC_ANGLE ((Atom) 55) #define XA_X_HEIGHT ((Atom) 56) #define XA_QUAD_WIDTH ((Atom) 57) #define XA_WEIGHT ((Atom) 58) #define XA_POINT_SIZE ((Atom) 59) #define XA_RESOLUTION ((Atom) 60) #define XA_COPYRIGHT ((Atom) 61) #define XA_NOTICE ((Atom) 62) #define XA_FONT_NAME ((Atom) 63) #define XA_FAMILY_NAME ((Atom) 64) #define XA_FULL_NAME ((Atom) 65) #define XA_CAP_HEIGHT ((Atom) 66) #define XA_WM_CLASS ((Atom) 67) #define XA_WM_TRANSIENT_FOR ((Atom) 68) #define XA_LAST_PREDEFINED ((Atom) 68) #endif /* XATOM_H */ nx-libs-3.5.99.23/nx-X11/include/Xauth.h0000644000000000000000000000572113614532331014175 0ustar /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _Xauth_h #define _Xauth_h typedef struct xauth { unsigned short family; unsigned short address_length; char *address; unsigned short number_length; char *number; unsigned short name_length; char *name; unsigned short data_length; char *data; } Xauth; #ifndef _XAUTH_STRUCT_ONLY # include # include # include # define FamilyLocal (256) /* not part of X standard (i.e. X.h) */ # define FamilyWild (65535) # define FamilyNetname (254) /* not part of X standard */ # define FamilyLocalHost (252) /* for local non-net authentication */ _XFUNCPROTOBEGIN char *XauFileName(void); Xauth *XauReadAuth( FILE* /* auth_file */ ); Xauth *XauGetAuthByName( _Xconst char* /* display_name */ ); Xauth *XauGetAuthByAddr( #if NeedWidePrototypes unsigned int /* family */, unsigned int /* address_length */, #else unsigned short /* family */, unsigned short /* address_length */, #endif _Xconst char* /* address */, #if NeedWidePrototypes unsigned int /* number_length */, #else unsigned short /* number_length */, #endif _Xconst char* /* number */, #if NeedWidePrototypes unsigned int /* name_length */, #else unsigned short /* name_length */, #endif _Xconst char* /* name */ ); Xauth *XauGetBestAuthByAddr( #if NeedWidePrototypes unsigned int /* family */, unsigned int /* address_length */, #else unsigned short /* family */, unsigned short /* address_length */, #endif _Xconst char* /* address */, #if NeedWidePrototypes unsigned int /* number_length */, #else unsigned short /* number_length */, #endif _Xconst char* /* number */, int /* types_length */, char** /* type_names */, _Xconst int* /* type_lengths */ ); void XauDisposeAuth( Xauth* /* auth */ ); _XFUNCPROTOEND #endif /* _XAUTH_STRUCT_ONLY */ #endif /* _Xauth_h */ nx-libs-3.5.99.23/nx-X11/include/Xdefs.h0000644000000000000000000000455013614532331014154 0ustar /*********************************************************** Copyright (c) 1999 The XFree86 Project Inc. All Rights Reserved. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The XFree86 Project Inc. shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The XFree86 Project Inc.. */ /** ** Types definitions shared between server and clients **/ #ifndef _XDEFS_H #define _XDEFS_H #ifdef _XSERVER64 #include #endif #ifndef _XTYPEDEF_ATOM # define _XTYPEDEF_ATOM # ifndef _XSERVER64 typedef unsigned long Atom; # else typedef CARD32 Atom; # endif #endif #ifndef Bool # ifndef _XTYPEDEF_BOOL # define _XTYPEDEF_BOOL typedef int Bool; # endif #endif #ifndef _XTYPEDEF_POINTER # define _XTYPEDEF_POINTER typedef void *pointer; #endif #ifndef _XTYPEDEF_CLIENTPTR typedef struct _Client *ClientPtr; # define _XTYPEDEF_CLIENTPTR #endif #ifndef _XTYPEDEF_XID # define _XTYPEDEF_XID # ifndef _XSERVER64 typedef unsigned long XID; # else typedef CARD32 XID; # endif #endif #ifndef _XTYPEDEF_MASK # define _XTYPEDEF_MASK # ifndef _XSERVER64 typedef unsigned long Mask; # else typedef CARD32 Mask; # endif #endif #ifndef _XTYPEDEF_FONTPTR # define _XTYPEDEF_FONTPTR typedef struct _Font *FontPtr; /* also in fonts/include/font.h */ #endif #ifndef _XTYPEDEF_FONT # define _XTYPEDEF_FONT typedef XID Font; #endif #ifndef _XTYPEDEF_FSID # ifndef _XSERVER64 typedef unsigned long FSID; # else typedef CARD32 FSID; # endif #endif typedef FSID AccContext; /* OS independant time value XXX Should probably go in Xos.h */ typedef struct timeval **OSTimePtr; typedef void (* BlockHandlerProcPtr)(void * /* blockData */, OSTimePtr /* pTimeout */, void * /* pReadmask */); #endif nx-libs-3.5.99.23/nx-X11/include/XF86keysym.h0000644000000000000000000003235113614532331015040 0ustar /* * XFree86 vendor specific keysyms. * * The XFree86 keysym range is 0x10080001 - 0x1008FFFF. * * When adding new entries, the xc/lib/XKeysymDB file should also be * updated to make the new entries visible to Xlib. */ /* * ModeLock * * This one is old, and not really used any more since XKB offers this * functionality. */ #define XF86XK_ModeLock 0x1008FF01 /* Mode Switch Lock */ /* * Note, 0x1008FF07 - 0x1008FF0F are free and should be used for misc new * keysyms that don't fit into any of the groups below. * * 0x1008FF64, 0x1008FF6F, 0x1008FF71, 0x1008FF83 are no longer used, * and should be used first for new keysyms. * * Check in keysymdef.h for generic symbols before adding new XFree86-specific * symbols here. * * X.Org will not be adding to the XF86 set of keysyms, though they have * been adopted and are considered a "standard" part of X keysym definitions. * XFree86 never properly commented these keysyms, so we have done our * best to explain the semantic meaning of these keys. * * XFree86 has removed their mail archives of the period, that might have * shed more light on some of these definitions. Until/unless we resurrect * these archives, these are from memory and usage. */ /* Backlight controls. */ #define XF86XK_MonBrightnessUp 0x1008FF02 /* Monitor/panel brightness */ #define XF86XK_MonBrightnessDown 0x1008FF03 /* Monitor/panel brightness */ #define XF86XK_KbdLightOnOff 0x1008FF04 /* Keyboards may be lit */ #define XF86XK_KbdBrightnessUp 0x1008FF05 /* Keyboards may be lit */ #define XF86XK_KbdBrightnessDown 0x1008FF06 /* Keyboards may be lit */ /* * Keys found on some "Internet" keyboards. */ #define XF86XK_Standby 0x1008FF10 /* System into standby mode */ #define XF86XK_AudioLowerVolume 0x1008FF11 /* Volume control down */ #define XF86XK_AudioMute 0x1008FF12 /* Mute sound from the system */ #define XF86XK_AudioRaiseVolume 0x1008FF13 /* Volume control up */ #define XF86XK_AudioPlay 0x1008FF14 /* Start playing of audio > */ #define XF86XK_AudioStop 0x1008FF15 /* Stop playing audio */ #define XF86XK_AudioPrev 0x1008FF16 /* Previous track */ #define XF86XK_AudioNext 0x1008FF17 /* Next track */ #define XF86XK_HomePage 0x1008FF18 /* Display user's home page */ #define XF86XK_Mail 0x1008FF19 /* Invoke user's mail program */ #define XF86XK_Start 0x1008FF1A /* Start application */ #define XF86XK_Search 0x1008FF1B /* Search */ #define XF86XK_AudioRecord 0x1008FF1C /* Record audio application */ /* These are sometimes found on PDA's (e.g. Palm, PocketPC or elsewhere) */ #define XF86XK_Calculator 0x1008FF1D /* Invoke calculator program */ #define XF86XK_Memo 0x1008FF1E /* Invoke Memo taking program */ #define XF86XK_ToDoList 0x1008FF1F /* Invoke To Do List program */ #define XF86XK_Calendar 0x1008FF20 /* Invoke Calendar program */ #define XF86XK_PowerDown 0x1008FF21 /* Deep sleep the system */ #define XF86XK_ContrastAdjust 0x1008FF22 /* Adjust screen contrast */ #define XF86XK_RockerUp 0x1008FF23 /* Rocker switches exist up */ #define XF86XK_RockerDown 0x1008FF24 /* and down */ #define XF86XK_RockerEnter 0x1008FF25 /* and let you press them */ /* Some more "Internet" keyboard symbols */ #define XF86XK_Back 0x1008FF26 /* Like back on a browser */ #define XF86XK_Forward 0x1008FF27 /* Like forward on a browser */ #define XF86XK_Stop 0x1008FF28 /* Stop current operation */ #define XF86XK_Refresh 0x1008FF29 /* Refresh the page */ #define XF86XK_PowerOff 0x1008FF2A /* Power off system entirely */ #define XF86XK_WakeUp 0x1008FF2B /* Wake up system from sleep */ #define XF86XK_Eject 0x1008FF2C /* Eject device (e.g. DVD) */ #define XF86XK_ScreenSaver 0x1008FF2D /* Invoke screensaver */ #define XF86XK_WWW 0x1008FF2E /* Invoke web browser */ #define XF86XK_Sleep 0x1008FF2F /* Put system to sleep */ #define XF86XK_Favorites 0x1008FF30 /* Show favorite locations */ #define XF86XK_AudioPause 0x1008FF31 /* Pause audio playing */ #define XF86XK_AudioMedia 0x1008FF32 /* Launch media collection app */ #define XF86XK_MyComputer 0x1008FF33 /* Display "My Computer" window */ #define XF86XK_VendorHome 0x1008FF34 /* Display vendor home web site */ #define XF86XK_LightBulb 0x1008FF35 /* Light bulb keys exist */ #define XF86XK_Shop 0x1008FF36 /* Display shopping web site */ #define XF86XK_History 0x1008FF37 /* Show history of web surfing */ #define XF86XK_OpenURL 0x1008FF38 /* Open selected URL */ #define XF86XK_AddFavorite 0x1008FF39 /* Add URL to favorites list */ #define XF86XK_HotLinks 0x1008FF3A /* Show "hot" links */ #define XF86XK_BrightnessAdjust 0x1008FF3B /* Invoke brightness adj. UI */ #define XF86XK_Finance 0x1008FF3C /* Display financial site */ #define XF86XK_Community 0x1008FF3D /* Display user's community */ #define XF86XK_AudioRewind 0x1008FF3E /* "rewind" audio track */ #define XF86XK_BackForward 0x1008FF3F /* ??? */ #define XF86XK_Launch0 0x1008FF40 /* Launch Application */ #define XF86XK_Launch1 0x1008FF41 /* Launch Application */ #define XF86XK_Launch2 0x1008FF42 /* Launch Application */ #define XF86XK_Launch3 0x1008FF43 /* Launch Application */ #define XF86XK_Launch4 0x1008FF44 /* Launch Application */ #define XF86XK_Launch5 0x1008FF45 /* Launch Application */ #define XF86XK_Launch6 0x1008FF46 /* Launch Application */ #define XF86XK_Launch7 0x1008FF47 /* Launch Application */ #define XF86XK_Launch8 0x1008FF48 /* Launch Application */ #define XF86XK_Launch9 0x1008FF49 /* Launch Application */ #define XF86XK_LaunchA 0x1008FF4A /* Launch Application */ #define XF86XK_LaunchB 0x1008FF4B /* Launch Application */ #define XF86XK_LaunchC 0x1008FF4C /* Launch Application */ #define XF86XK_LaunchD 0x1008FF4D /* Launch Application */ #define XF86XK_LaunchE 0x1008FF4E /* Launch Application */ #define XF86XK_LaunchF 0x1008FF4F /* Launch Application */ #define XF86XK_ApplicationLeft 0x1008FF50 /* switch to application, left */ #define XF86XK_ApplicationRight 0x1008FF51 /* switch to application, right*/ #define XF86XK_Book 0x1008FF52 /* Launch bookreader */ #define XF86XK_CD 0x1008FF53 /* Launch CD/DVD player */ #define XF86XK_Calculater 0x1008FF54 /* Launch Calculater */ #define XF86XK_Clear 0x1008FF55 /* Clear window, screen */ #define XF86XK_Close 0x1008FF56 /* Close window */ #define XF86XK_Copy 0x1008FF57 /* Copy selection */ #define XF86XK_Cut 0x1008FF58 /* Cut selection */ #define XF86XK_Display 0x1008FF59 /* Output switch key */ #define XF86XK_DOS 0x1008FF5A /* Launch DOS (emulation) */ #define XF86XK_Documents 0x1008FF5B /* Open documents window */ #define XF86XK_Excel 0x1008FF5C /* Launch spread sheet */ #define XF86XK_Explorer 0x1008FF5D /* Launch file explorer */ #define XF86XK_Game 0x1008FF5E /* Launch game */ #define XF86XK_Go 0x1008FF5F /* Go to URL */ #define XF86XK_iTouch 0x1008FF60 /* Logitch iTouch- don't use */ #define XF86XK_LogOff 0x1008FF61 /* Log off system */ #define XF86XK_Market 0x1008FF62 /* ?? */ #define XF86XK_Meeting 0x1008FF63 /* enter meeting in calendar */ #define XF86XK_MenuKB 0x1008FF65 /* distingush keyboard from PB */ #define XF86XK_MenuPB 0x1008FF66 /* distinuish PB from keyboard */ #define XF86XK_MySites 0x1008FF67 /* Favourites */ #define XF86XK_New 0x1008FF68 /* New (folder, document... */ #define XF86XK_News 0x1008FF69 /* News */ #define XF86XK_OfficeHome 0x1008FF6A /* Office home (old Staroffice)*/ #define XF86XK_Open 0x1008FF6B /* Open */ #define XF86XK_Option 0x1008FF6C /* ?? */ #define XF86XK_Paste 0x1008FF6D /* Paste */ #define XF86XK_Phone 0x1008FF6E /* Launch phone; dial number */ #define XF86XK_Q 0x1008FF70 /* Compaq's Q - don't use */ #define XF86XK_Reply 0x1008FF72 /* Reply e.g., mail */ #define XF86XK_Reload 0x1008FF73 /* Reload web page, file, etc. */ #define XF86XK_RotateWindows 0x1008FF74 /* Rotate windows e.g. xrandr */ #define XF86XK_RotationPB 0x1008FF75 /* don't use */ #define XF86XK_RotationKB 0x1008FF76 /* don't use */ #define XF86XK_Save 0x1008FF77 /* Save (file, document, state */ #define XF86XK_ScrollUp 0x1008FF78 /* Scroll window/contents up */ #define XF86XK_ScrollDown 0x1008FF79 /* Scrool window/contentd down */ #define XF86XK_ScrollClick 0x1008FF7A /* Use XKB mousekeys instead */ #define XF86XK_Send 0x1008FF7B /* Send mail, file, object */ #define XF86XK_Spell 0x1008FF7C /* Spell checker */ #define XF86XK_SplitScreen 0x1008FF7D /* Split window or screen */ #define XF86XK_Support 0x1008FF7E /* Get support (??) */ #define XF86XK_TaskPane 0x1008FF7F /* Show tasks */ #define XF86XK_Terminal 0x1008FF80 /* Launch terminal emulator */ #define XF86XK_Tools 0x1008FF81 /* toolbox of desktop/app. */ #define XF86XK_Travel 0x1008FF82 /* ?? */ #define XF86XK_UserPB 0x1008FF84 /* ?? */ #define XF86XK_User1KB 0x1008FF85 /* ?? */ #define XF86XK_User2KB 0x1008FF86 /* ?? */ #define XF86XK_Video 0x1008FF87 /* Launch video player */ #define XF86XK_WheelButton 0x1008FF88 /* button from a mouse wheel */ #define XF86XK_Word 0x1008FF89 /* Launch word processor */ #define XF86XK_Xfer 0x1008FF8A #define XF86XK_ZoomIn 0x1008FF8B /* zoom in view, map, etc. */ #define XF86XK_ZoomOut 0x1008FF8C /* zoom out view, map, etc. */ #define XF86XK_Away 0x1008FF8D /* mark yourself as away */ #define XF86XK_Messenger 0x1008FF8E /* as in instant messaging */ #define XF86XK_WebCam 0x1008FF8F /* Launch web camera app. */ #define XF86XK_MailForward 0x1008FF90 /* Forward in mail */ #define XF86XK_Pictures 0x1008FF91 /* Show pictures */ #define XF86XK_Music 0x1008FF92 /* Launch music application */ #define XF86XK_Battery 0x1008FF93 /* Display battery information */ #define XF86XK_Bluetooth 0x1008FF94 /* Enable/disable Bluetooth */ #define XF86XK_WLAN 0x1008FF95 /* Enable/disable WLAN */ #define XF86XK_UWB 0x1008FF96 /* Enable/disable UWB */ #define XF86XK_AudioForward 0x1008FF97 /* fast-forward audio track */ #define XF86XK_AudioRepeat 0x1008FF98 /* toggle repeat mode */ #define XF86XK_AudioRandomPlay 0x1008FF99 /* toggle shuffle mode */ #define XF86XK_Subtitle 0x1008FF9A /* cycle through subtitle */ #define XF86XK_AudioCycleTrack 0x1008FF9B /* cycle through audio tracks */ #define XF86XK_CycleAngle 0x1008FF9C /* cycle through angles */ #define XF86XK_FrameBack 0x1008FF9D /* video: go one frame back */ #define XF86XK_FrameForward 0x1008FF9E /* video: go one frame forward */ #define XF86XK_Time 0x1008FF9F /* display, or shows an entry for time seeking */ #define XF86XK_Select 0x1008FFA0 /* Select button on joypads and remotes */ #define XF86XK_View 0x1008FFA1 /* Show a view options/properties */ #define XF86XK_TopMenu 0x1008FFA2 /* Go to a top-level menu in a video */ #define XF86XK_Red 0x1008FFA3 /* Red button */ #define XF86XK_Green 0x1008FFA4 /* Green button */ #define XF86XK_Yellow 0x1008FFA5 /* Yellow button */ #define XF86XK_Blue 0x1008FFA6 /* Blue button */ #define XF86XK_Suspend 0x1008FFA7 /* Sleep to RAM */ #define XF86XK_Hibernate 0x1008FFA8 /* Sleep to disk */ #define XF86XK_TouchpadToggle 0x1008FFA9 /* Toggle between touchpad/trackstick */ #define XF86XK_TouchpadOn 0x1008FFB0 /* The touchpad got switched on */ #define XF86XK_TouchpadOff 0x1008FFB1 /* The touchpad got switched off */ #define XF86XK_AudioMicMute 0x1008FFB2 /* Mute the Mic from the system */ /* Keys for special action keys (hot keys) */ /* Virtual terminals on some operating systems */ #define XF86XK_Switch_VT_1 0x1008FE01 #define XF86XK_Switch_VT_2 0x1008FE02 #define XF86XK_Switch_VT_3 0x1008FE03 #define XF86XK_Switch_VT_4 0x1008FE04 #define XF86XK_Switch_VT_5 0x1008FE05 #define XF86XK_Switch_VT_6 0x1008FE06 #define XF86XK_Switch_VT_7 0x1008FE07 #define XF86XK_Switch_VT_8 0x1008FE08 #define XF86XK_Switch_VT_9 0x1008FE09 #define XF86XK_Switch_VT_10 0x1008FE0A #define XF86XK_Switch_VT_11 0x1008FE0B #define XF86XK_Switch_VT_12 0x1008FE0C #define XF86XK_Ungrab 0x1008FE20 /* force ungrab */ #define XF86XK_ClearGrab 0x1008FE21 /* kill application with grab */ #define XF86XK_Next_VMode 0x1008FE22 /* next video mode available */ #define XF86XK_Prev_VMode 0x1008FE23 /* prev. video mode available */ #define XF86XK_LogWindowTree 0x1008FE24 /* print window tree to log */ #define XF86XK_LogGrabInfo 0x1008FE25 /* print all active grabs to log */ nx-libs-3.5.99.23/nx-X11/include/Xfuncproto.h0000644000000000000000000001314413614532331015251 0ustar /* * Copyright 1989, 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ /* Definitions to make function prototypes manageable */ #ifndef _XFUNCPROTO_H_ #define _XFUNCPROTO_H_ #ifndef NeedFunctionPrototypes #define NeedFunctionPrototypes 1 #endif /* NeedFunctionPrototypes */ #ifndef NeedVarargsPrototypes #define NeedVarargsPrototypes 1 #endif /* NeedVarargsPrototypes */ #if NeedFunctionPrototypes #ifndef NeedNestedPrototypes #define NeedNestedPrototypes 1 #endif /* NeedNestedPrototypes */ #ifndef _Xconst #define _Xconst const #endif /* _Xconst */ #ifndef NeedWidePrototypes #ifdef NARROWPROTO #define NeedWidePrototypes 0 #else #define NeedWidePrototypes 1 /* default to make interropt. easier */ #endif #endif /* NeedWidePrototypes */ #endif /* NeedFunctionPrototypes */ #ifndef _XFUNCPROTOBEGIN #if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */ #define _XFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */ #define _XFUNCPROTOEND } #else #define _XFUNCPROTOBEGIN #define _XFUNCPROTOEND #endif #endif /* _XFUNCPROTOBEGIN */ /* Added in X11R6.9, so available in any version of modular xproto */ #if defined(__GNUC__) && (__GNUC__ >= 4) # define _X_SENTINEL(x) __attribute__ ((__sentinel__(x))) #else # define _X_SENTINEL(x) #endif /* GNUC >= 4 */ /* Added in X11R6.9, so available in any version of modular xproto */ #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__) && !defined(__MINGW32__) # define _X_EXPORT __attribute__((visibility("default"))) # define _X_HIDDEN __attribute__((visibility("hidden"))) # define _X_INTERNAL __attribute__((visibility("internal"))) #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) # define _X_EXPORT __global # define _X_HIDDEN __hidden # define _X_INTERNAL __hidden #else /* not gcc >= 4 and not Sun Studio >= 8 */ # define _X_EXPORT # define _X_HIDDEN # define _X_INTERNAL #endif /* GNUC >= 4 */ /* Branch prediction hints for individual conditionals */ /* requires xproto >= 7.0.9 */ #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303) # define _X_LIKELY(x) __builtin_expect(!!(x), 1) # define _X_UNLIKELY(x) __builtin_expect(!!(x), 0) #else /* not gcc >= 3.3 */ # define _X_LIKELY(x) (x) # define _X_UNLIKELY(x) (x) #endif /* Bulk branch prediction hints via marking error path functions as "cold" */ /* requires xproto >= 7.0.25 */ #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403) /* 4.3+ */ # define _X_COLD __attribute__((__cold__)) #else # define _X_COLD /* nothing */ #endif /* Added in X11R6.9, so available in any version of modular xproto */ #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301) # define _X_DEPRECATED __attribute__((deprecated)) #else /* not gcc >= 3.1 */ # define _X_DEPRECATED #endif /* requires xproto >= 7.0.17 */ #if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define _X_NORETURN __attribute((noreturn)) #else # define _X_NORETURN #endif /* GNUC */ /* Added in X11R6.9, so available in any version of modular xproto */ #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203) # define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y))) #else /* not gcc >= 2.3 */ # define _X_ATTRIBUTE_PRINTF(x,y) #endif /* requires xproto >= 7.0.22 */ #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205) #define _X_UNUSED __attribute__((__unused__)) #else #define _X_UNUSED /* */ #endif /* C99 keyword "inline" or equivalent extensions in pre-C99 compilers */ /* requires xproto >= 7.0.9 (introduced in 7.0.8 but didn't support all compilers until 7.0.9) */ #if defined(inline) /* assume autoconf set it correctly */ || \ (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */ || \ (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)) # define _X_INLINE inline #elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */ # define _X_INLINE __inline__ #else # define _X_INLINE #endif /* C99 keyword "restrict" or equivalent extensions in pre-C99 compilers */ /* requires xproto >= 7.0.21 */ #ifndef _X_RESTRICT_KYWD # if defined(restrict) /* assume autoconf set it correctly */ || \ (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ \ && !defined(__cplusplus)) /* Workaround g++ issue on Solaris */ # define _X_RESTRICT_KYWD restrict # elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */ # define _X_RESTRICT_KYWD __restrict__ # else # define _X_RESTRICT_KYWD # endif #endif #endif /* _XFUNCPROTO_H_ */ nx-libs-3.5.99.23/nx-X11/include/Xfuncs.h0000644000000000000000000000571213614532331014352 0ustar /* * $XdotOrg: xc/include/Xfuncs.h,v 1.4 2005/11/08 06:33:25 jkj Exp $ * $Xorg: Xfuncs.h,v 1.4 2001/02/09 02:03:22 xorgcvs Exp $ * * Copyright 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ #ifndef _XFUNCS_H_ #define _XFUNCS_H_ #include #ifdef X_USEBFUNCS void bcopy(); void bzero(); int bcmp(); #else #if defined(SYSV) && !defined(__SCO__) && !defined(sun) && !defined(__UNIXWARE__) #include void bcopy(); #define bzero(b,len) memset(b, 0, len) #define bcmp(b1,b2,len) memcmp(b1, b2, len) #else #include #if defined(__SCO__) || defined(sun) || defined(__UNIXWARE__) #include #endif #define _XFUNCS_H_INCLUDED_STRING_H #if defined(sun) #define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len)) #define bzero(b,len) memset(b, 0, (size_t)(len)) #define bcmp(b1,b2,len) memcmp(b1, b2, (size_t)(len)) #endif #endif #endif /* X_USEBFUNCS */ /* the new Xfuncs.h */ #if !defined(X_NOT_STDC_ENV) && (!defined(sun) || defined(SVR4)) /* the ANSI C way */ #ifndef _XFUNCS_H_INCLUDED_STRING_H #include #endif #undef bzero #define bzero(b,len) memset(b,0,len) #else /* else X_NOT_STDC_ENV or SunOS 4 */ #if defined(SYSV) || defined(luna) || defined(sun) || defined(__sxg__) #include #define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) #if defined(SYSV) && defined(_XBCOPYFUNC) #undef memmove #define memmove(dst,src,len) _XBCOPYFUNC((char *)(src),(char *)(dst),(int)(len)) #define _XNEEDBCOPYFUNC #endif #else /* else vanilla BSD */ #define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) #define memcpy(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) #define memcmp(b1,b2,len) bcmp((char *)(b1),(char *)(b2),(int)(len)) #endif /* SYSV else */ #endif /* ! X_NOT_STDC_ENV else */ #if defined(X_NOT_STDC_ENV) || (defined(sun) && !defined(SVR4)) #define atexit(f) on_exit(f, 0) #endif #endif /* _XFUNCS_H_ */ nx-libs-3.5.99.23/nx-X11/include/X.h0000644000000000000000000004736013614532331013320 0ustar /* Definitions for the X window system likely to be used by applications */ #ifndef X_H #define X_H /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #define X_PROTOCOL 11 /* current protocol version */ #define X_PROTOCOL_REVISION 0 /* current minor version */ /* Resources */ /* * _XSERVER64 must ONLY be defined when compiling X server sources on * systems where unsigned long is not 32 bits, must NOT be used in * client or library code. */ #ifndef _XSERVER64 # ifndef _XTYPEDEF_XID # define _XTYPEDEF_XID typedef unsigned long XID; # endif # ifndef _XTYPEDEF_MASK # define _XTYPEDEF_MASK typedef unsigned long Mask; # endif # ifndef _XTYPEDEF_ATOM # define _XTYPEDEF_ATOM typedef unsigned long Atom; /* Also in Xdefs.h */ # endif typedef unsigned long VisualID; typedef unsigned long Time; #else # include # ifndef _XTYPEDEF_XID # define _XTYPEDEF_XID typedef CARD32 XID; # endif # ifndef _XTYPEDEF_MASK # define _XTYPEDEF_MASK typedef CARD32 Mask; # endif # ifndef _XTYPEDEF_ATOM # define _XTYPEDEF_ATOM typedef CARD32 Atom; # endif typedef CARD32 VisualID; typedef CARD32 Time; #endif typedef XID Window; typedef XID Drawable; #ifndef _XTYPEDEF_FONT # define _XTYPEDEF_FONT typedef XID Font; #endif typedef XID Pixmap; typedef XID Cursor; typedef XID Colormap; typedef XID GContext; typedef XID KeySym; typedef unsigned char KeyCode; /***************************************************************** * RESERVED RESOURCE AND CONSTANT DEFINITIONS *****************************************************************/ #ifndef None #define None 0L /* universal null resource or null atom */ #endif #define ParentRelative 1L /* background pixmap in CreateWindow and ChangeWindowAttributes */ #define CopyFromParent 0L /* border pixmap in CreateWindow and ChangeWindowAttributes special VisualID and special window class passed to CreateWindow */ #define PointerWindow 0L /* destination window in SendEvent */ #define InputFocus 1L /* destination window in SendEvent */ #define PointerRoot 1L /* focus window in SetInputFocus */ #define AnyPropertyType 0L /* special Atom, passed to GetProperty */ #define AnyKey 0L /* special Key Code, passed to GrabKey */ #define AnyButton 0L /* special Button Code, passed to GrabButton */ #define AllTemporary 0L /* special Resource ID passed to KillClient */ #define CurrentTime 0L /* special Time */ #define NoSymbol 0L /* special KeySym */ /***************************************************************** * EVENT DEFINITIONS *****************************************************************/ /* Input Event Masks. Used as event-mask window attribute and as arguments to Grab requests. Not to be confused with event names. */ #define NoEventMask 0L #define KeyPressMask (1L<<0) #define KeyReleaseMask (1L<<1) #define ButtonPressMask (1L<<2) #define ButtonReleaseMask (1L<<3) #define EnterWindowMask (1L<<4) #define LeaveWindowMask (1L<<5) #define PointerMotionMask (1L<<6) #define PointerMotionHintMask (1L<<7) #define Button1MotionMask (1L<<8) #define Button2MotionMask (1L<<9) #define Button3MotionMask (1L<<10) #define Button4MotionMask (1L<<11) #define Button5MotionMask (1L<<12) #define ButtonMotionMask (1L<<13) #define KeymapStateMask (1L<<14) #define ExposureMask (1L<<15) #define VisibilityChangeMask (1L<<16) #define StructureNotifyMask (1L<<17) #define ResizeRedirectMask (1L<<18) #define SubstructureNotifyMask (1L<<19) #define SubstructureRedirectMask (1L<<20) #define FocusChangeMask (1L<<21) #define PropertyChangeMask (1L<<22) #define ColormapChangeMask (1L<<23) #define OwnerGrabButtonMask (1L<<24) /* Event names. Used in "type" field in XEvent structures. Not to be confused with event masks above. They start from 2 because 0 and 1 are reserved in the protocol for errors and replies. */ #define KeyPress 2 #define KeyRelease 3 #define ButtonPress 4 #define ButtonRelease 5 #define MotionNotify 6 #define EnterNotify 7 #define LeaveNotify 8 #define FocusIn 9 #define FocusOut 10 #define KeymapNotify 11 #define Expose 12 #define GraphicsExpose 13 #define NoExpose 14 #define VisibilityNotify 15 #define CreateNotify 16 #define DestroyNotify 17 #define UnmapNotify 18 #define MapNotify 19 #define MapRequest 20 #define ReparentNotify 21 #define ConfigureNotify 22 #define ConfigureRequest 23 #define GravityNotify 24 #define ResizeRequest 25 #define CirculateNotify 26 #define CirculateRequest 27 #define PropertyNotify 28 #define SelectionClear 29 #define SelectionRequest 30 #define SelectionNotify 31 #define ColormapNotify 32 #define ClientMessage 33 #define MappingNotify 34 #define GenericEvent 35 #define LASTEvent 36 /* must be bigger than any event # */ /* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer, state in various key-, mouse-, and button-related events. */ #define ShiftMask (1<<0) #define LockMask (1<<1) #define ControlMask (1<<2) #define Mod1Mask (1<<3) #define Mod2Mask (1<<4) #define Mod3Mask (1<<5) #define Mod4Mask (1<<6) #define Mod5Mask (1<<7) /* modifier names. Used to build a SetModifierMapping request or to read a GetModifierMapping request. These correspond to the masks defined above. */ #define ShiftMapIndex 0 #define LockMapIndex 1 #define ControlMapIndex 2 #define Mod1MapIndex 3 #define Mod2MapIndex 4 #define Mod3MapIndex 5 #define Mod4MapIndex 6 #define Mod5MapIndex 7 /* button masks. Used in same manner as Key masks above. Not to be confused with button names below. */ #define Button1Mask (1<<8) #define Button2Mask (1<<9) #define Button3Mask (1<<10) #define Button4Mask (1<<11) #define Button5Mask (1<<12) #define AnyModifier (1<<15) /* used in GrabButton, GrabKey */ /* button names. Used as arguments to GrabButton and as detail in ButtonPress and ButtonRelease events. Not to be confused with button masks above. Note that 0 is already defined above as "AnyButton". */ #define Button1 1 #define Button2 2 #define Button3 3 #define Button4 4 #define Button5 5 /* Notify modes */ #define NotifyNormal 0 #define NotifyGrab 1 #define NotifyUngrab 2 #define NotifyWhileGrabbed 3 #define NotifyHint 1 /* for MotionNotify events */ /* Notify detail */ #define NotifyAncestor 0 #define NotifyVirtual 1 #define NotifyInferior 2 #define NotifyNonlinear 3 #define NotifyNonlinearVirtual 4 #define NotifyPointer 5 #define NotifyPointerRoot 6 #define NotifyDetailNone 7 /* Visibility notify */ #define VisibilityUnobscured 0 #define VisibilityPartiallyObscured 1 #define VisibilityFullyObscured 2 /* Circulation request */ #define PlaceOnTop 0 #define PlaceOnBottom 1 /* protocol families */ #define FamilyInternet 0 /* IPv4 */ #define FamilyDECnet 1 #define FamilyChaos 2 #define FamilyInternet6 6 /* IPv6 */ /* authentication families not tied to a specific protocol */ #define FamilyServerInterpreted 5 /* Property notification */ #define PropertyNewValue 0 #define PropertyDelete 1 /* Color Map notification */ #define ColormapUninstalled 0 #define ColormapInstalled 1 /* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */ #define GrabModeSync 0 #define GrabModeAsync 1 /* GrabPointer, GrabKeyboard reply status */ #define GrabSuccess 0 #define AlreadyGrabbed 1 #define GrabInvalidTime 2 #define GrabNotViewable 3 #define GrabFrozen 4 /* AllowEvents modes */ #define AsyncPointer 0 #define SyncPointer 1 #define ReplayPointer 2 #define AsyncKeyboard 3 #define SyncKeyboard 4 #define ReplayKeyboard 5 #define AsyncBoth 6 #define SyncBoth 7 /* Used in SetInputFocus, GetInputFocus */ #define RevertToNone (int)None #define RevertToPointerRoot (int)PointerRoot #define RevertToParent 2 /***************************************************************** * ERROR CODES *****************************************************************/ #define Success 0 /* everything's okay */ #define BadRequest 1 /* bad request code */ #define BadValue 2 /* int parameter out of range */ #define BadWindow 3 /* parameter not a Window */ #define BadPixmap 4 /* parameter not a Pixmap */ #define BadAtom 5 /* parameter not an Atom */ #define BadCursor 6 /* parameter not a Cursor */ #define BadFont 7 /* parameter not a Font */ #define BadMatch 8 /* parameter mismatch */ #define BadDrawable 9 /* parameter not a Pixmap or Window */ #define BadAccess 10 /* depending on context: - key/button already grabbed - attempt to free an illegal cmap entry - attempt to store into a read-only color map entry. - attempt to modify the access control list from other than the local host. */ #define BadAlloc 11 /* insufficient resources */ #define BadColor 12 /* no such colormap */ #define BadGC 13 /* parameter not a GC */ #define BadIDChoice 14 /* choice not in range or already used */ #define BadName 15 /* font or color name doesn't exist */ #define BadLength 16 /* Request length incorrect */ #define BadImplementation 17 /* server is defective */ #define FirstExtensionError 128 #define LastExtensionError 255 /***************************************************************** * WINDOW DEFINITIONS *****************************************************************/ /* Window classes used by CreateWindow */ /* Note that CopyFromParent is already defined as 0 above */ #define InputOutput 1 #define InputOnly 2 /* Window attributes for CreateWindow and ChangeWindowAttributes */ #define CWBackPixmap (1L<<0) #define CWBackPixel (1L<<1) #define CWBorderPixmap (1L<<2) #define CWBorderPixel (1L<<3) #define CWBitGravity (1L<<4) #define CWWinGravity (1L<<5) #define CWBackingStore (1L<<6) #define CWBackingPlanes (1L<<7) #define CWBackingPixel (1L<<8) #define CWOverrideRedirect (1L<<9) #define CWSaveUnder (1L<<10) #define CWEventMask (1L<<11) #define CWDontPropagate (1L<<12) #define CWColormap (1L<<13) #define CWCursor (1L<<14) /* ConfigureWindow structure */ #define CWX (1<<0) #define CWY (1<<1) #define CWWidth (1<<2) #define CWHeight (1<<3) #define CWBorderWidth (1<<4) #define CWSibling (1<<5) #define CWStackMode (1<<6) /* Bit Gravity */ #define ForgetGravity 0 #define NorthWestGravity 1 #define NorthGravity 2 #define NorthEastGravity 3 #define WestGravity 4 #define CenterGravity 5 #define EastGravity 6 #define SouthWestGravity 7 #define SouthGravity 8 #define SouthEastGravity 9 #define StaticGravity 10 /* Window gravity + bit gravity above */ #define UnmapGravity 0 /* Used in CreateWindow for backing-store hint */ #define NotUseful 0 #define WhenMapped 1 #define Always 2 /* Used in GetWindowAttributes reply */ #define IsUnmapped 0 #define IsUnviewable 1 #define IsViewable 2 /* Used in ChangeSaveSet */ #define SetModeInsert 0 #define SetModeDelete 1 /* Used in ChangeCloseDownMode */ #define DestroyAll 0 #define RetainPermanent 1 #define RetainTemporary 2 /* Window stacking method (in configureWindow) */ #define Above 0 #define Below 1 #define TopIf 2 #define BottomIf 3 #define Opposite 4 /* Circulation direction */ #define RaiseLowest 0 #define LowerHighest 1 /* Property modes */ #define PropModeReplace 0 #define PropModePrepend 1 #define PropModeAppend 2 /***************************************************************** * GRAPHICS DEFINITIONS *****************************************************************/ /* graphics functions, as in GC.alu */ #define GXclear 0x0 /* 0 */ #define GXand 0x1 /* src AND dst */ #define GXandReverse 0x2 /* src AND NOT dst */ #define GXcopy 0x3 /* src */ #define GXandInverted 0x4 /* NOT src AND dst */ #define GXnoop 0x5 /* dst */ #define GXxor 0x6 /* src XOR dst */ #define GXor 0x7 /* src OR dst */ #define GXnor 0x8 /* NOT src AND NOT dst */ #define GXequiv 0x9 /* NOT src XOR dst */ #define GXinvert 0xa /* NOT dst */ #define GXorReverse 0xb /* src OR NOT dst */ #define GXcopyInverted 0xc /* NOT src */ #define GXorInverted 0xd /* NOT src OR dst */ #define GXnand 0xe /* NOT src OR NOT dst */ #define GXset 0xf /* 1 */ /* LineStyle */ #define LineSolid 0 #define LineOnOffDash 1 #define LineDoubleDash 2 /* capStyle */ #define CapNotLast 0 #define CapButt 1 #define CapRound 2 #define CapProjecting 3 /* joinStyle */ #define JoinMiter 0 #define JoinRound 1 #define JoinBevel 2 /* fillStyle */ #define FillSolid 0 #define FillTiled 1 #define FillStippled 2 #define FillOpaqueStippled 3 /* fillRule */ #define EvenOddRule 0 #define WindingRule 1 /* subwindow mode */ #define ClipByChildren 0 #define IncludeInferiors 1 /* SetClipRectangles ordering */ #define Unsorted 0 #define YSorted 1 #define YXSorted 2 #define YXBanded 3 /* CoordinateMode for drawing routines */ #define CoordModeOrigin 0 /* relative to the origin */ #define CoordModePrevious 1 /* relative to previous point */ /* Polygon shapes */ #define Complex 0 /* paths may intersect */ #define Nonconvex 1 /* no paths intersect, but not convex */ #define Convex 2 /* wholly convex */ /* Arc modes for PolyFillArc */ #define ArcChord 0 /* join endpoints of arc */ #define ArcPieSlice 1 /* join endpoints to center of arc */ /* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into GC.stateChanges */ #define GCFunction (1L<<0) #define GCPlaneMask (1L<<1) #define GCForeground (1L<<2) #define GCBackground (1L<<3) #define GCLineWidth (1L<<4) #define GCLineStyle (1L<<5) #define GCCapStyle (1L<<6) #define GCJoinStyle (1L<<7) #define GCFillStyle (1L<<8) #define GCFillRule (1L<<9) #define GCTile (1L<<10) #define GCStipple (1L<<11) #define GCTileStipXOrigin (1L<<12) #define GCTileStipYOrigin (1L<<13) #define GCFont (1L<<14) #define GCSubwindowMode (1L<<15) #define GCGraphicsExposures (1L<<16) #define GCClipXOrigin (1L<<17) #define GCClipYOrigin (1L<<18) #define GCClipMask (1L<<19) #define GCDashOffset (1L<<20) #define GCDashList (1L<<21) #define GCArcMode (1L<<22) #define GCLastBit 22 /***************************************************************** * FONTS *****************************************************************/ /* used in QueryFont -- draw direction */ #define FontLeftToRight 0 #define FontRightToLeft 1 #define FontChange 255 /***************************************************************** * IMAGING *****************************************************************/ /* ImageFormat -- PutImage, GetImage */ #define XYBitmap 0 /* depth 1, XYFormat */ #define XYPixmap 1 /* depth == drawable depth */ #define ZPixmap 2 /* depth == drawable depth */ /***************************************************************** * COLOR MAP STUFF *****************************************************************/ /* For CreateColormap */ #define AllocNone 0 /* create map with no entries */ #define AllocAll 1 /* allocate entire map writeable */ /* Flags used in StoreNamedColor, StoreColors */ #define DoRed (1<<0) #define DoGreen (1<<1) #define DoBlue (1<<2) /***************************************************************** * CURSOR STUFF *****************************************************************/ /* QueryBestSize Class */ #define CursorShape 0 /* largest size that can be displayed */ #define TileShape 1 /* size tiled fastest */ #define StippleShape 2 /* size stippled fastest */ /***************************************************************** * KEYBOARD/POINTER STUFF *****************************************************************/ #define AutoRepeatModeOff 0 #define AutoRepeatModeOn 1 #define AutoRepeatModeDefault 2 #define LedModeOff 0 #define LedModeOn 1 /* masks for ChangeKeyboardControl */ #define KBKeyClickPercent (1L<<0) #define KBBellPercent (1L<<1) #define KBBellPitch (1L<<2) #define KBBellDuration (1L<<3) #define KBLed (1L<<4) #define KBLedMode (1L<<5) #define KBKey (1L<<6) #define KBAutoRepeatMode (1L<<7) #define MappingSuccess 0 #define MappingBusy 1 #define MappingFailed 2 #define MappingModifier 0 #define MappingKeyboard 1 #define MappingPointer 2 /***************************************************************** * SCREEN SAVER STUFF *****************************************************************/ #define DontPreferBlanking 0 #define PreferBlanking 1 #define DefaultBlanking 2 #define DisableScreenSaver 0 #define DisableScreenInterval 0 #define DontAllowExposures 0 #define AllowExposures 1 #define DefaultExposures 2 /* for ForceScreenSaver */ #define ScreenSaverReset 0 #define ScreenSaverActive 1 /***************************************************************** * HOSTS AND CONNECTIONS *****************************************************************/ /* for ChangeHosts */ #define HostInsert 0 #define HostDelete 1 /* for ChangeAccessControl */ #define EnableAccess 1 #define DisableAccess 0 /* Display classes used in opening the connection * Note that the statically allocated ones are even numbered and the * dynamically changeable ones are odd numbered */ #define StaticGray 0 #define GrayScale 1 #define StaticColor 2 #define PseudoColor 3 #define TrueColor 4 #define DirectColor 5 /* Byte order used in imageByteOrder and bitmapBitOrder */ #define LSBFirst 0 #define MSBFirst 1 #endif /* X_H */ nx-libs-3.5.99.23/nx-X11/include/Xmd.h0000644000000000000000000001155613614532331013637 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef XMD_H #define XMD_H 1 /* * Xmd.h: MACHINE DEPENDENT DECLARATIONS. */ /* * Special per-machine configuration flags. */ #if defined (_LP64) || \ defined(__alpha) || defined(__alpha__) || \ defined(__ia64__) || defined(ia64) || \ defined(__sparc64__) || \ defined(__s390x__) || \ (defined(__hppa__) && defined(__LP64__)) || \ defined(__amd64__) || defined(amd64) || \ defined(__powerpc64__) #define LONG64 /* 32/64-bit architecture */ #endif /* * Definition of macro used to set constants for size of network structures; * machines with preprocessors that can't handle all of the sz_ symbols * can define this macro to be sizeof(x) if and only if their compiler doesn't * pad out structures (esp. the xTextElt structure which contains only two * one-byte fields). Network structures should always define sz_symbols. * * The sz_ prefix is used instead of something more descriptive so that the * symbols are no more than 32 characters long (which causes problems for some * compilers and preprocessors). * * The extra indirection in the __STDC__ case is to get macro arguments to * expand correctly before the concatenation, rather than afterward. */ #if ((defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)) && !defined(UNIXCPP)) || defined(ANSICPP) #define _SIZEOF(x) sz_##x #define SIZEOF(x) _SIZEOF(x) #else #define SIZEOF(x) sz_/**/x #endif /* if ANSI C compiler else not */ /* * Bitfield suffixes for the protocol structure elements, if you * need them. Note that bitfields are not guarranteed to be signed * (or even unsigned) according to ANSI C. */ #define B32 #define B16 #ifdef LONG64 typedef long INT64; typedef int INT32; #else typedef long INT32; #endif typedef short INT16; #if defined(__STDC__) typedef signed char INT8; #else typedef char INT8; #endif #ifdef LONG64 typedef unsigned long CARD64; typedef unsigned int CARD32; #else typedef unsigned long CARD32; #endif typedef unsigned short CARD16; typedef unsigned char CARD8; typedef CARD32 BITS32; typedef CARD16 BITS16; #ifndef I_NEED_OS2_H typedef CARD8 BYTE; typedef CARD8 BOOL; #else #define BYTE CARD8 #define BOOL CARD8 #endif /* * definitions for sign-extending bitfields on 64-bit architectures */ #define cvtINT8toInt(val) (val) #define cvtINT16toInt(val) (val) #define cvtINT32toInt(val) (val) #define cvtINT8toShort(val) (val) #define cvtINT16toShort(val) (val) #define cvtINT32toShort(val) (val) #define cvtINT8toLong(val) (val) #define cvtINT16toLong(val) (val) #define cvtINT32toLong(val) (val) /* * this version should leave result of type (t *) */ #define NEXTPTR(p,t) (((t *)(p)) + 1) #endif /* XMD_H */ nx-libs-3.5.99.23/nx-X11/include/Xosdefs.h0000644000000000000000000000711613614532331014517 0ustar /* * O/S-dependent (mis)feature macro definitions * * $XdotOrg: xc/include/Xosdefs.h,v 1.7 2005/11/08 06:33:25 jkj Exp $ * $Xorg: Xosdefs.h,v 1.5 2001/02/09 02:03:23 xorgcvs Exp $ * Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _XOSDEFS_H_ #define _XOSDEFS_H_ /* * X_NOT_STDC_ENV means does not have ANSI C header files. Lack of this * symbol does NOT mean that the system has stdarg.h. * * X_NOT_POSIX means does not have POSIX header files. Lack of this * symbol does NOT mean that the POSIX environment is the default. * You may still have to define _POSIX_SOURCE to get it. */ #ifdef NOSTDHDRS #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef sony #if !defined(SYSTYPE_SYSV) && !defined(_SYSTYPE_SYSV) #define X_NOT_POSIX #endif #endif #ifdef UTEK #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef vax #ifndef ultrix /* assume vanilla BSD */ #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #endif #ifdef luna #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef Mips #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef USL #ifdef SYSV /* (release 3.2) */ #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #endif #ifdef _SCO_DS #ifndef __SCO__ #define __SCO__ #endif #endif #ifdef i386 #ifdef SYSV #if !defined(ISC) && !defined(__SCO__) && !defined(_SEQUENT_) && \ !defined(__UNIXWARE__) && !defined(sun) #if !defined(_POSIX_SOURCE) #define X_NOT_POSIX #endif #define X_NOT_STDC_ENV #endif #endif #endif #ifdef MOTOROLA #ifdef SYSV #define X_NOT_STDC_ENV #endif #endif #ifdef sun /* Imake configs define SVR4 on Solaris, but cc & gcc only define __SVR4 * This check allows non-Imake configured programs to build correctly. */ #if defined(__SVR4) && !defined(SVR4) #define SVR4 1 #endif #ifdef SVR4 /* define this to whatever it needs to be */ #define X_POSIX_C_SOURCE 199300L #endif #endif #ifdef WIN32 #ifndef _POSIX_ #define X_NOT_POSIX #endif #endif #if defined(nec_ews_svr2) || defined(SX) || defined(PC_UX) #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef __DARWIN__ #define NULL_NOT_ZERO #endif #ifdef __GNU__ #ifndef PATH_MAX #define PATH_MAX 4096 #endif #ifndef MAXPATHLEN #define MAXPATHLEN 4096 #endif #endif #if defined(__SCO__) || defined(__UNIXWARE__) # ifndef PATH_MAX # define PATH_MAX 1024 # endif # ifndef MAXPATHLEN # define MAXPATHLEN 1024 # endif #endif #if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) \ || defined(__Darwin__) || defined(__DragonFly__) # ifndef CSRG_BASED # define CSRG_BASED # endif #endif #endif /* _XOSDEFS_H_ */ nx-libs-3.5.99.23/nx-X11/include/Xos.h0000644000000000000000000001505113614532331013652 0ustar /* * $XdotOrg: xc/include/Xos.h,v 1.8 2005/11/08 06:33:25 jkj Exp $ * $Xorg: Xos.h,v 1.6 2001/02/09 02:03:22 xorgcvs Exp $ * * Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * * The X Window System is a Trademark of The Open Group. * */ /* This is a collection of things to try and minimize system dependencies * in a "signficant" number of source files. */ #ifndef _XOS_H_ #define _XOS_H_ #include /* * Get major data types (esp. caddr_t) */ #ifdef USG #ifndef __TYPES__ #include /* forgot to protect it... */ #define __TYPES__ #endif /* __TYPES__ */ #else /* USG */ #if defined(_POSIX_SOURCE) && defined(MOTOROLA) #undef _POSIX_SOURCE #include #define _POSIX_SOURCE #else # include #endif #endif /* USG */ #if defined(__SCO__) || defined(__UNIXWARE__) #include #endif #ifdef _SEQUENT_ /* * in_systm.h compatibility between SysV and BSD types u_char u_short u_long * select.h for typedef of args to select, fd_set, may use SVR4 later */ #include #include #endif /* _SEQUENT_ */ /* * Just about everyone needs the strings routines. We provide both forms here, * index/rindex and strchr/strrchr, so any systems that don't provide them all * need to have #defines here. * * These macros are defined this way, rather than, e.g.: * #defined index(s,c) strchr(s,c) * because someone might be using them as function pointers, and such * a change would break compatibility for anyone who's relying on them * being the way they currently are. So we're stuck with them this way, * which can be really inconvenient. :-( */ #ifndef X_NOT_STDC_ENV #include #if defined(__SCO__) || defined(__UNIXWARE__) #include #else #if (defined(sun) && defined(__SVR4)) #include #endif #ifdef __STDC__ #ifndef index #define index(s,c) (strchr((s),(c))) #endif #ifndef rindex #define rindex(s,c) (strrchr((s),(c))) #endif #else #ifndef index #define index strchr #endif #ifndef rindex #define rindex strrchr #endif #endif #endif #else #ifdef SYSV #if defined(clipper) || defined(__clipper__) #include #endif #include #define index strchr #define rindex strrchr #else #include #define strchr index #define strrchr rindex #endif #endif /* X_NOT_STDC_ENV */ /* * strerror() */ #if (defined(X_NOT_STDC_ENV) || (defined(sun) && !defined(SVR4)) || defined(macII)) && !defined(__GLIBC__) #ifndef strerror extern char *sys_errlist[]; extern int sys_nerr; #define strerror(n) \ (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error") #endif #endif /* * Get open(2) constants */ #if defined(X_NOT_POSIX) #include #if defined(USL) || defined(MOTOROLA) || (defined(i386) && (defined(SYSV) || defined(SVR4))) || defined(__sxg__) #include #endif #ifdef WIN32 #include #else #include #endif #else /* X_NOT_POSIX */ #if !defined(_POSIX_SOURCE) && defined(macII) #define _POSIX_SOURCE #include #include #undef _POSIX_SOURCE #else #include #include #endif #endif /* X_NOT_POSIX else */ /* * Get struct timeval and struct tm */ #if defined(SYSV) && !defined(_SEQUENT_) #ifndef USL #include #endif #include #if defined(USG) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__) && !defined(clipper) && !defined(__clipper__) struct timeval { long tv_sec; long tv_usec; }; #ifndef USL_SHARELIB struct timezone { int tz_minuteswest; int tz_dsttime; }; #endif /* USL_SHARELIB */ #endif /* USG */ #ifdef _SEQUENT_ struct timezone { int tz_minuteswest; int tz_dsttime; }; #endif /* _SEQUENT_ */ #else /* not SYSV */ #if defined(_POSIX_SOURCE) && defined(SVR4) /* need to omit _POSIX_SOURCE in order to get what we want in SVR4 */ #undef _POSIX_SOURCE #include #define _POSIX_SOURCE #elif defined(WIN32) #include #if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_) && !defined(_TIMEVAL_DEFINED) && !defined(_STRUCT_TIMEVAL) struct timeval { long tv_sec; /* seconds */ long tv_usec; /* and microseconds */ }; #define _TIMEVAL_DEFINED #endif #include #define gettimeofday(t) \ { \ struct _timeb _gtodtmp; \ _ftime (&_gtodtmp); \ (t)->tv_sec = _gtodtmp.time; \ (t)->tv_usec = _gtodtmp.millitm * 1000; \ } #elif defined(_SEQUENT_) #include #else #include #include #endif /* defined(_POSIX_SOURCE) && defined(SVR4) */ #endif /* SYSV */ /* define X_GETTIMEOFDAY macro, a portable gettimeofday() */ #if defined(_XOPEN_XPG4) || defined(_XOPEN_UNIX) /* _XOPEN_UNIX is XPG4.2 */ #define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0) #else #if defined(SVR4) || defined(VMS) || defined(WIN32) #define X_GETTIMEOFDAY(t) gettimeofday(t) #else #define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0) #endif #endif /* XPG4 else */ #ifdef __GNU__ #define PATH_MAX 4096 #define MAXPATHLEN 4096 #define OPEN_MAX 256 /* We define a reasonable limit. */ #endif /* use POSIX name for signal */ #if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD) && !defined(ISC) #define SIGCHLD SIGCLD #endif #ifdef ISC #include #include #define NGROUPS 16 #endif #if defined(ISC) || \ (defined(__linux__) && !defined(__GLIBC__)) /* * Some OS's may not have this */ #define X_NO_SYS_UN 1 struct sockaddr_un { short sun_family; char sun_path[108]; }; #endif #include #endif /* _XOS_H_ */ nx-libs-3.5.99.23/nx-X11/include/Xos_r.h0000644000000000000000000010042413614532331014172 0ustar /* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Various and sundry Thread-Safe functions used by X11, Motif, and CDE. * * Use this file in MT-safe code where you would have included * for readdir() * for getgrgid() or getgrnam() * for gethostbyname(), gethostbyaddr(), or getservbyname() * for getpwnam() or getpwuid() * for strtok() * for asctime(), ctime(), localtime(), or gmtime() * for getlogin() or ttyname() * or their thread-safe analogs. * * If you are on a platform that defines XTHREADS but does not have * MT-safe system API (e.g. UnixWare) you must define _Xos_processLock * and _Xos_processUnlock macros before including this header. * For convenience XOS_USE_XLIB_LOCKING or * XOS_USE_XT_LOCKING may be defined to obtain either Xlib-only or * Xt-based versions of these macros. These macros won't result in * truly thread-safe calls, but they are better than nothing. If you * do not want locking in this situation define XOS_USE_NO_LOCKING. * * NOTE: On systems lacking approriate _r functions Gethostbyname(), * Gethostbyaddr(), and Getservbyname() do NOT copy the host or * protocol lists! * * NOTE: On systems lacking appropriate _r functions Getgrgid() and * Getgrnam() do NOT copy the list of group members! * * This header is nominally intended to simplify porting X11, Motif, and * CDE; it may be useful to other people too. The structure below is * complicated, mostly because P1003.1c (the IEEE POSIX Threads spec) * went through lots of drafts, and some vendors shipped systems based * on draft API that were changed later. Unfortunately POSIX did not * provide a feature-test macro for distinguishing each of the drafts. */ /* * This header has several parts. Search for "Effective prototypes" * to locate the beginning of a section. */ /* This header can be included multiple times with different defines! */ #ifndef _XOS_R_H_ # define _XOS_R_H_ # include # include # ifndef X_NOT_POSIX # ifdef _POSIX_SOURCE # include # else # define _POSIX_SOURCE # include # undef _POSIX_SOURCE # endif # ifndef LINE_MAX # define X_LINE_MAX 2048 # else # define X_LINE_MAX LINE_MAX # endif # endif #endif /* _XOS_R_H */ #ifndef WIN32 #ifdef __cplusplus extern "C" { #endif # if defined(XOS_USE_XLIB_LOCKING) # ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */ typedef struct _LockInfoRec *LockInfoPtr; extern LockInfoPtr _Xglobal_lock; # endif # ifndef _Xos_isThreadInitialized # define _Xos_isThreadInitialized (_Xglobal_lock) # endif # if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) # ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */ # include /* for NeedFunctionPrototypes */ extern void (*_XLockMutex_fn)( # if NeedFunctionPrototypes LockInfoPtr /* lock */, char * /* file */, int /* line */ # endif ); extern void (*_XUnlockMutex_fn)( # if NeedFunctionPrototypes LockInfoPtr /* lock */, char * /* file */, int /* line */ # endif ); # endif # ifndef _Xos_processLock # define _Xos_processLock \ (_XLockMutex_fn ? (*_XLockMutex_fn)(_Xglobal_lock,__FILE__,__LINE__) : 0) # endif # ifndef _Xos_processUnlock # define _Xos_processUnlock \ (_XUnlockMutex_fn ? (*_XUnlockMutex_fn)(_Xglobal_lock,__FILE__,__LINE__) : 0) # endif # else # ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */ # include /* for NeedFunctionPrototypes */ extern void (*_XLockMutex_fn)( # if NeedFunctionPrototypes LockInfoPtr /* lock */ # endif ); extern void (*_XUnlockMutex_fn)( # if NeedFunctionPrototypes LockInfoPtr /* lock */ # endif ); # endif # ifndef _Xos_processLock # define _Xos_processLock \ (_XLockMutex_fn ? ((*_XLockMutex_fn)(_Xglobal_lock), 0) : 0) # endif # ifndef _Xos_processUnlock # define _Xos_processUnlock \ (_XUnlockMutex_fn ? ((*_XUnlockMutex_fn)(_Xglobal_lock), 0) : 0) # endif # endif # elif defined(XOS_USE_XT_LOCKING) # ifndef _XtThreadsI_h extern void (*_XtProcessLock)(void); # endif # ifndef _XtintrinsicP_h # include /* for NeedFunctionPrototypes */ extern void XtProcessLock( # if NeedFunctionPrototypes void # endif ); extern void XtProcessUnlock( # if NeedFunctionPrototypes void # endif ); # endif # ifndef _Xos_isThreadInitialized # define _Xos_isThreadInitialized _XtProcessLock # endif # ifndef _Xos_processLock # define _Xos_processLock XtProcessLock() # endif # ifndef _Xos_processUnlock # define _Xos_processUnlock XtProcessUnlock() # endif # elif defined(XOS_USE_NO_LOCKING) # ifndef _Xos_isThreadInitialized # define _Xos_isThreadInitialized 0 # endif # ifndef _Xos_processLock # define _Xos_processLock 0 # endif # ifndef _Xos_processUnlock # define _Xos_processUnlock 0 # endif # endif #endif /* !defined WIN32 */ /* * Solaris defines the POSIX thread-safe feature test macro, but * uses the older SVR4 thread-safe functions unless the POSIX ones * are specifically requested. Fix the feature test macro. */ #if defined(sun) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && \ (_POSIX_C_SOURCE - 0 < 199506L) && !defined(_POSIX_PTHREAD_SEMANTICS) # undef _POSIX_THREAD_SAFE_FUNCTIONS #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_PWD_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xgetpwparams; * * struct passwd* _XGetpwnam(const char *name, _Xgetpwparams); * struct passwd* _XGetpwuid(uid_t uid, _Xgetpwparams); */ #if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H) # include # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_PWDAPI) # define XOS_USE_MTSAFE_PWDAPI 1 # endif #endif #undef X_NEEDS_PWPARAMS #if !defined(X_INCLUDE_PWD_H) || defined(_XOS_INCLUDED_PWD_H) /* Do nothing */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ # if defined(X_NOT_POSIX) && !defined(i386) && !defined(SYSV) extern struct passwd *getpwuid(), *getpwnam(); # endif typedef int _Xgetpwparams; /* dummy */ # define _XGetpwuid(u,p) getpwuid((u)) # define _XGetpwnam(u,p) getpwnam((u)) #elif !defined(XOS_USE_MTSAFE_PWDAPI) || defined(XNO_MTSAFE_PWDAPI) /* UnixWare 2.0, or other systems with thread support but no _r API. */ # define X_NEEDS_PWPARAMS typedef struct { struct passwd pws; char pwbuf[1024]; struct passwd* pwp; size_t len; } _Xgetpwparams; /* * NetBSD and FreeBSD, at least, are missing several of the unixware passwd * fields. */ #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ defined(__APPLE__) || defined(__DARWIN__) || defined(__DragonFly__) static __inline__ void _Xpw_copyPasswd(_Xgetpwparams p) { memcpy(&(p).pws, (p).pwp, sizeof(struct passwd)); (p).pws.pw_name = (p).pwbuf; (p).len = strlen((p).pwp->pw_name); strcpy((p).pws.pw_name, (p).pwp->pw_name); (p).pws.pw_passwd = (p).pws.pw_name + (p).len + 1; (p).len = strlen((p).pwp->pw_passwd); strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd); (p).pws.pw_class = (p).pws.pw_passwd + (p).len + 1; (p).len = strlen((p).pwp->pw_class); strcpy((p).pws.pw_class, (p).pwp->pw_class); (p).pws.pw_gecos = (p).pws.pw_class + (p).len + 1; (p).len = strlen((p).pwp->pw_gecos); strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos); (p).pws.pw_dir = (p).pws.pw_gecos + (p).len + 1; (p).len = strlen((p).pwp->pw_dir); strcpy((p).pws.pw_dir, (p).pwp->pw_dir); (p).pws.pw_shell = (p).pws.pw_dir + (p).len + 1; (p).len = strlen((p).pwp->pw_shell); strcpy((p).pws.pw_shell, (p).pwp->pw_shell); (p).pwp = &(p).pws; } #else # define _Xpw_copyPasswd(p) \ (memcpy(&(p).pws, (p).pwp, sizeof(struct passwd)), \ ((p).pws.pw_name = (p).pwbuf), \ ((p).len = strlen((p).pwp->pw_name)), \ strcpy((p).pws.pw_name, (p).pwp->pw_name), \ ((p).pws.pw_passwd = (p).pws.pw_name + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_passwd)), \ strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd), \ ((p).pws.pw_age = (p).pws.pw_passwd + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_age)), \ strcpy((p).pws.pw_age, (p).pwp->pw_age), \ ((p).pws.pw_comment = (p).pws.pw_age + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_comment)), \ strcpy((p).pws.pw_comment, (p).pwp->pw_comment), \ ((p).pws.pw_gecos = (p).pws.pw_comment + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_gecos)), \ strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos), \ ((p).pws.pw_dir = (p).pws.pw_comment + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_dir)), \ strcpy((p).pws.pw_dir, (p).pwp->pw_dir), \ ((p).pws.pw_shell = (p).pws.pw_dir + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_shell)), \ strcpy((p).pws.pw_shell, (p).pwp->pw_shell), \ ((p).pwp = &(p).pws), \ 0 ) #endif # define _XGetpwuid(u,p) \ ( (_Xos_processLock), \ (((p).pwp = getpwuid((u))) ? _Xpw_copyPasswd(p), 0 : 0), \ (_Xos_processUnlock), \ (p).pwp ) # define _XGetpwnam(u,p) \ ( (_Xos_processLock), \ (((p).pwp = getpwnam((u))) ? _Xpw_copyPasswd(p), 0 : 0), \ (_Xos_processUnlock), \ (p).pwp ) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__) && !defined(__DARWIN__) /* SVR4 threads */ # define X_NEEDS_PWPARAMS typedef struct { struct passwd pws; char pwbuf[X_LINE_MAX]; } _Xgetpwparams; # if defined(_POSIX_REENTRANT_FUNCTIONS) || !defined(SVR4) # define _XGetpwuid(u,p) \ ((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) # define _XGetpwnam(u,p) \ ((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) # else /* SVR4 */ # define _XGetpwuid(u,p) \ ((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws) # define _XGetpwnam(u,p) \ ((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws) # endif /* SVR4 */ #else /* _POSIX_THREAD_SAFE_FUNCTIONS */ /* Digital UNIX 4.0, but not (beta) T4.0-1 */ # define X_NEEDS_PWPARAMS typedef struct { struct passwd pws; char pwbuf[X_LINE_MAX]; struct passwd* pwp; } _Xgetpwparams; typedef int _Xgetpwret; # define _XGetpwuid(u,p) \ ((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == 0) ? \ (p).pwp : NULL) # define _XGetpwnam(u,p) \ ((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == 0) ? \ (p).pwp : NULL) #endif /* X_INCLUDE_PWD_H */ #if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H) # define _XOS_INCLUDED_PWD_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * NOTE: On systems lacking the appropriate _r functions Gethostbyname(), * Gethostbyaddr(), and Getservbyname() do NOT copy the host or * protocol lists! * * #define X_INCLUDE_NETDB_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xgethostbynameparams; * typedef ... _Xgetservbynameparams; * * struct hostent* _XGethostbyname(const char* name,_Xgethostbynameparams); * struct hostent* _XGethostbyaddr(const char* addr, int len, int type, * _Xgethostbynameparams); * struct servent* _XGetservbyname(const char* name, const char* proto, * _Xgetservbynameparams); */ #undef XTHREADS_NEEDS_BYNAMEPARAMS #if defined(X_INCLUDE_NETDB_H) && !defined(_XOS_INCLUDED_NETDB_H) \ && !defined(WIN32) # include # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_NETDBAPI) # define XOS_USE_MTSAFE_NETDBAPI 1 # endif #endif #if !defined(X_INCLUDE_NETDB_H) || defined(_XOS_INCLUDED_NETDB_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xgethostbynameparams; /* dummy */ typedef int _Xgetservbynameparams; /* dummy */ # define _XGethostbyname(h,hp) gethostbyname((h)) # define _XGethostbyaddr(a,al,t,hp) gethostbyaddr((a),(al),(t)) # define _XGetservbyname(s,p,sp) getservbyname((s),(p)) #elif !defined(XOS_USE_MTSAFE_NETDBAPI) || defined(XNO_MTSAFE_NETDBAPI) /* UnixWare 2.0, or other systems with thread support but no _r API. */ /* WARNING: The h_addr_list and s_aliases values are *not* copied! */ #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) #include #endif typedef struct { struct hostent hent; char h_name[MAXHOSTNAMELEN]; struct hostent *hptr; } _Xgethostbynameparams; typedef struct { struct servent sent; char s_name[255]; char s_proto[255]; struct servent *sptr; } _Xgetservbynameparams; # define XTHREADS_NEEDS_BYNAMEPARAMS # define _Xg_copyHostent(hp) \ (memcpy(&(hp).hent, (hp).hptr, sizeof(struct hostent)), \ strcpy((hp).h_name, (hp).hptr->h_name), \ ((hp).hent.h_name = (hp).h_name), \ ((hp).hptr = &(hp).hent), \ 0 ) # define _Xg_copyServent(sp) \ (memcpy(&(sp).sent, (sp).sptr, sizeof(struct servent)), \ strcpy((sp).s_name, (sp).sptr->s_name), \ ((sp).sent.s_name = (sp).s_name), \ strcpy((sp).s_proto, (sp).sptr->s_proto), \ ((sp).sent.s_proto = (sp).s_proto), \ ((sp).sptr = &(sp).sent), \ 0 ) # define _XGethostbyname(h,hp) \ ((_Xos_processLock), \ (((hp).hptr = gethostbyname((h))) ? _Xg_copyHostent(hp) : 0), \ (_Xos_processUnlock), \ (hp).hptr ) # define _XGethostbyaddr(a,al,t,hp) \ ((_Xos_processLock), \ (((hp).hptr = gethostbyaddr((a),(al),(t))) ? _Xg_copyHostent(hp) : 0), \ (_Xos_processUnlock), \ (hp).hptr ) # define _XGetservbyname(s,p,sp) \ ((_Xos_processLock), \ (((sp).sptr = getservbyname((s),(p))) ? _Xg_copyServent(sp) : 0), \ (_Xos_processUnlock), \ (sp).sptr ) #elif defined(XUSE_NETDB_R_API) /* * POSIX does not specify _r equivalents for API, but some * vendors provide them anyway. Use them only when explicitly asked. */ # ifdef _POSIX_THREAD_SAFE_FUNCTIONS # define X_POSIX_THREAD_SAFE_FUNCTIONS 1 # endif # define XTHREADS_NEEDS_BYNAMEPARAMS # ifndef X_POSIX_THREAD_SAFE_FUNCTIONS typedef struct { struct hostent hent; char hbuf[X_LINE_MAX]; int herr; } _Xgethostbynameparams; typedef struct { struct servent sent; char sbuf[X_LINE_MAX]; } _Xgetservbynameparams; # define _XGethostbyname(h,hp) \ gethostbyname_r((h),&(hp).hent,(hp).hbuf,sizeof((hp).hbuf),&(hp).herr) # define _XGethostbyaddr(a,al,t,hp) \ gethostbyaddr_r((a),(al),(t),&(hp).hent,(hp).hbuf,sizeof((hp).hbuf),&(hp).herr) # define _XGetservbyname(s,p,sp) \ getservbyname_r((s),(p),&(sp).sent,(sp).sbuf,sizeof((sp).sbuf)) # else typedef struct { struct hostent hent; struct hostent_data hdata; } _Xgethostbynameparams; typedef struct { struct servent sent; struct servent_data sdata; } _Xgetservbynameparams; # define _XGethostbyname(h,hp) \ (bzero((char*)&(hp).hdata,sizeof((hp).hdata)), \ ((gethostbyname_r((h),&(hp).hent,&(hp).hdata) == -1) ? NULL : &(hp).hent)) # define _XGethostbyaddr(a,al,t,hp) \ (bzero((char*)&(hp).hdata,sizeof((hp).hdata)), \ ((gethostbyaddr_r((a),(al),(t),&(hp).hent,&(hp).hdata) == -1) ? NULL : &(hp).hent)) # define _XGetservbyname(s,p,sp) \ (bzero((char*)&(sp).sdata,sizeof((sp).sdata)), \ ((getservbyname_r((s),(p),&(sp).sent,&(sp).sdata) == -1) ? NULL : &(sp).sent) ) # endif # ifdef X_POSIX_THREAD_SAFE_FUNCTIONS # undef X_POSIX_THREAD_SAFE_FUNCTIONS # endif #else /* The regular API is assumed to be MT-safe under POSIX. */ typedef int _Xgethostbynameparams; /* dummy */ typedef int _Xgetservbynameparams; /* dummy */ # define _XGethostbyname(h,hp) gethostbyname((h)) # define _XGethostbyaddr(a,al,t,hp) gethostbyaddr((a),(al),(t)) # define _XGetservbyname(s,p,sp) getservbyname((s),(p)) #endif /* X_INCLUDE_NETDB_H */ #if defined(X_INCLUDE_NETDB_H) && !defined(_XOS_INCLUDED_NETDB_H) # define _XOS_INCLUDED_NETDB_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_DIRENT_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xreaddirparams; * * struct dirent *_XReaddir(DIR *dir_pointer, _Xreaddirparams); */ #if defined(X_INCLUDE_DIRENT_H) && !defined(_XOS_INCLUDED_DIRENT_H) # include # if !defined(X_NOT_POSIX) || defined(SYSV) || defined(USG) # include # else # include # ifndef dirent # define dirent direct # endif # endif # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_DIRENTAPI) # define XOS_USE_MTSAFE_DIRENTAPI 1 # endif #endif #if !defined(X_INCLUDE_DIRENT_H) || defined(_XOS_INCLUDED_DIRENT_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xreaddirparams; /* dummy */ # define _XReaddir(d,p) readdir(d) #elif !defined(XOS_USE_MTSAFE_DIRENTAPI) || defined(XNO_MTSAFE_DIRENTAPI) /* Systems with thread support but no _r API. */ typedef struct { struct dirent *result; struct dirent dir_entry; # ifdef _POSIX_PATH_MAX char buf[_POSIX_PATH_MAX]; # elif defined(NAME_MAX) char buf[NAME_MAX]; # else char buf[255]; # endif } _Xreaddirparams; # define _XReaddir(d,p) \ ( (_Xos_processLock), \ (((p).result = readdir((d))) ? \ (memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen), \ ((p).result = &(p).dir_entry), 0) : \ 0), \ (_Xos_processUnlock), \ (p).result ) #else typedef struct { struct dirent *result; struct dirent dir_entry; # ifdef _POSIX_PATH_MAX char buf[_POSIX_PATH_MAX]; # elif defined(NAME_MAX) char buf[NAME_MAX]; # else char buf[255]; # endif } _Xreaddirparams; # if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || \ defined(__APPLE__) || defined(__DARWIN__) /* POSIX final API, returns (int)0 on success. */ # define _XReaddir(d,p) \ (readdir_r((d), &((p).dir_entry), &((p).result)) ? NULL : (p).result) # elif defined(_POSIX_REENTRANT_FUNCTIONS) /* POSIX draft API, returns (int)0 on success. */ # define _XReaddir(d,p) \ (readdir_r((d),&((p).dir_entry)) ? NULL : &((p).dir_entry)) # elif defined(SVR4) /* Pre-POSIX API, returns non-NULL on success. */ # define _XReaddir(d,p) (readdir_r((d), &(p).dir_entry)) # else /* We have no idea what is going on. Fake it all using process locks. */ # define _XReaddir(d,p) \ ( (_Xos_processLock), \ (((p).result = readdir((d))) ? \ (memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen), \ ((p).result = &(p).dir_entry), 0) : \ 0), \ (_Xos_processUnlock), \ (p).result ) # endif #endif /* X_INCLUDE_DIRENT_H */ #if defined(X_INCLUDE_DIRENT_H) && !defined(_XOS_INCLUDED_DIRENT_H) # define _XOS_INCLUDED_DIRENT_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_UNISTD_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xgetloginparams; * typedef ... _Xttynameparams; * * char *_XGetlogin(_Xgetloginparams); * char *_XTtyname(int, _Xttynameparams); */ #if defined(X_INCLUDE_UNISTD_H) && !defined(_XOS_INCLUDED_UNISTD_H) /* already included by */ # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_UNISTDAPI) # define XOS_USE_MTSAFE_UNISTDAPI 1 # endif #endif #if !defined(X_INCLUDE_UNISTD_H) || defined(_XOS_INCLUDED_UNISTD_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xgetloginparams; /* dummy */ typedef int _Xttynameparams; /* dummy */ # define _XGetlogin(p) getlogin() # define _XTtyname(f) ttyname((f)) #elif !defined(XOS_USE_MTSAFE_UNISTDAPI) || defined(XNO_MTSAFE_UNISTDAPI) /* Systems with thread support but no _r API. */ typedef struct { char *result; # if defined(MAXLOGNAME) char buf[MAXLOGNAME]; # elif defined(LOGIN_NAME_MAX) char buf[LOGIN_NAME_MAX]; # else char buf[64]; # endif } _Xgetloginparams; typedef struct { char *result; # ifdef TTY_NAME_MAX char buf[TTY_NAME_MAX]; # elif defined(_POSIX_TTY_NAME_MAX) char buf[_POSIX_TTY_NAME_MAX]; # elif defined(_POSIX_PATH_MAX) char buf[_POSIX_PATH_MAX]; # else char buf[256]; # endif } _Xttynameparams; # define _XGetlogin(p) \ ( (_Xos_processLock), \ (((p).result = getlogin()) ? \ (strncpy((p).buf, (p).result, sizeof((p).buf)), \ ((p).buf[sizeof((p).buf)-1] = '\0'), \ ((p).result = (p).buf), 0) : 0), \ (_Xos_processUnlock), \ (p).result ) #define _XTtyname(f,p) \ ( (_Xos_processLock), \ (((p).result = ttyname(f)) ? \ (strncpy((p).buf, (p).result, sizeof((p).buf)), \ ((p).buf[sizeof((p).buf)-1] = '\0'), \ ((p).result = (p).buf), 0) : 0), \ (_Xos_processUnlock), \ (p).result ) #elif defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_POSIX_REENTRANT_FUNCTIONS) /* POSIX API. * * extern int getlogin_r(char *, size_t); * extern int ttyname_r(int, char *, size_t); */ typedef struct { # if defined(MAXLOGNAME) char buf[MAXLOGNAME]; # elif defined(LOGIN_NAME_MAX) char buf[LOGIN_NAME_MAX]; # else char buf[64]; # endif } _Xgetloginparams; typedef struct { # ifdef TTY_NAME_MAX char buf[TTY_NAME_MAX]; # elif defined(_POSIX_TTY_NAME_MAX) char buf[_POSIX_TTY_NAME_MAX]; # elif defined(_POSIX_PATH_MAX) char buf[_POSIX_PATH_MAX]; # else char buf[256]; # endif } _Xttynameparams; # define _XGetlogin(p) (getlogin_r((p).buf, sizeof((p).buf)) ? NULL : (p).buf) # define _XTtyname(f,p) \ (ttyname_r((f), (p).buf, sizeof((p).buf)) ? NULL : (p).buf) #else /* Pre-POSIX API. * * extern char *getlogin_r(char *, size_t); * extern char *ttyname_r(int, char *, size_t); */ typedef struct { # if defined(MAXLOGNAME) char buf[MAXLOGNAME]; # elif defined(LOGIN_NAME_MAX) char buf[LOGIN_NAME_MAX]; # else char buf[64]; # endif } _Xgetloginparams; typedef struct { # ifdef TTY_NAME_MAX char buf[TTY_NAME_MAX]; # elif defined(_POSIX_TTY_NAME_MAX) char buf[_POSIX_TTY_NAME_MAX]; # elif defined(_POSIX_PATH_MAX) char buf[_POSIX_PATH_MAX]; # else char buf[256]; # endif } _Xttynameparams; # define _XGetlogin(p) getlogin_r((p).buf, sizeof((p).buf)) # define _XTtyname(f,p) ttyname_r((f), (p).buf, sizeof((p).buf)) #endif /* X_INCLUDE_UNISTD_H */ #if defined(X_INCLUDE_UNISTD_H) && !defined(_XOS_INCLUDED_UNISTD_H) # define _XOS_INCLUDED_UNISTD_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_STRING_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xstrtokparams; * * char *_XStrtok(char *, const char*, _Xstrtokparams); */ #if defined(X_INCLUDE_STRING_H) && !defined(_XOS_INCLUDED_STRING_H) /* has already been included by */ # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_STRINGAPI) # define XOS_USE_MTSAFE_STRINGAPI 1 # endif #endif #if !defined(X_INCLUDE_STRING_H) || defined(_XOS_INCLUDED_STRING_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xstrtokparams; /* dummy */ # define _XStrtok(s1,s2,p) \ ( p = 0, (void)p, strtok((s1),(s2)) ) #elif !defined(XOS_USE_MTSAFE_STRINGAPI) || defined(XNO_MTSAFE_STRINGAPI) /* Systems with thread support but no _r API. */ typedef char *_Xstrtokparams; # define _XStrtok(s1,s2,p) \ ( (_Xos_processLock), \ ((p) = strtok((s1),(s2))), \ (_Xos_processUnlock), \ (p) ) #else /* POSIX or pre-POSIX API. */ typedef char * _Xstrtokparams; # define _XStrtok(s1,s2,p) strtok_r((s1),(s2),&(p)) #endif /* X_INCLUDE_STRING_H */ /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_TIME_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xatimeparams; * typedef ... _Xctimeparams; * typedef ... _Xgtimeparams; * typedef ... _Xltimeparams; * * char *_XAsctime(const struct tm *, _Xatimeparams); * char *_XCtime(const time_t *, _Xctimeparams); * struct tm *_XGmtime(const time_t *, _Xgtimeparams); * struct tm *_XLocaltime(const time_t *, _Xltimeparams); */ #if defined(X_INCLUDE_TIME_H) && !defined(_XOS_INCLUDED_TIME_H) # include # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_TIMEAPI) # define XOS_USE_MTSAFE_TIMEAPI 1 # endif #endif #if !defined(X_INCLUDE_TIME_H) || defined(_XOS_INCLUDED_TIME_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xatimeparams; /* dummy */ # define _XAsctime(t,p) asctime((t)) typedef int _Xctimeparams; /* dummy */ # define _XCtime(t,p) ctime((t)) typedef int _Xgtimeparams; /* dummy */ # define _XGmtime(t,p) gmtime((t)) typedef int _Xltimeparams; /* dummy */ # define _XLocaltime(t,p) localtime((t)) #elif !defined(XOS_USE_MTSAFE_TIMEAPI) || defined(XNO_MTSAFE_TIMEAPI) /* Systems with thread support but no _r API. */ typedef struct { # ifdef TIMELEN char buf[TIMELEN]; # else char buf[26]; # endif char *result; } _Xctimeparams, _Xatimeparams; typedef struct { struct tm buf; struct tm *result; } _Xgtimeparams, _Xltimeparams; # define _XAsctime(t,p) \ ( (_Xos_processLock), \ (((p).result = asctime((t))) ? \ (strncpy((p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ 0), \ (_Xos_processUnlock), \ (p).result ) # define _XCtime(t,p) \ ( (_Xos_processLock), \ (((p).result = ctime((t))) ? \ (strncpy((p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ 0), \ (_Xos_processUnlock), \ (p).result ) # define _XGmtime(t,p) \ ( (_Xos_processLock), \ (((p).result = gmtime(t)) ? \ (memcpy(&(p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ 0), \ (_Xos_processUnlock), \ (p).result ) # define _XLocaltime(t,p) \ ( (_Xos_processLock), \ (((p).result = localtime(t)) ? \ (memcpy(&(p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ 0), \ (_Xos_processUnlock), \ (p).result ) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(sun) /* Returns NULL on failure. Solaris 2.5 * * extern char *asctime_r(const struct tm *tm,char *buf, int buflen); * extern char *ctime_r(const time_t *clock, char *buf, int buflen); * extern struct tm *gmtime_r(const time_t *clock, struct tm *res); * extern struct tm *localtime_r(const time_t *clock, struct tm *res); */ # ifdef TIMELEN typedef char _Xatimeparams[TIMELEN]; typedef char _Xctimeparams[TIMELEN]; # else typedef char _Xatimeparams[26]; typedef char _Xctimeparams[26]; # endif typedef struct tm _Xgtimeparams; typedef struct tm _Xltimeparams; # define _XAsctime(t,p) asctime_r((t),(p),sizeof((p))) # define _XCtime(t,p) ctime_r((t),(p),sizeof((p))) # define _XGmtime(t,p) gmtime_r((t),&(p)) # define _XLocaltime(t,p) localtime_r((t),&(p)) #else /* defined(_POSIX_THREAD_SAFE_FUNCTIONS) */ /* POSIX final API. OSF/1 v4.0, etc. * * extern char *asctime_r(const struct tm *timeptr, char *buffer); * extern char *ctime_r(const time_t *timer, char *buffer); * extern struct tm *gmtime_r(const time_t *timer, struct tm *result); * extern struct tm *localtime_r(const time_t *timer, struct tm *result); */ # ifdef TIMELEN typedef char _Xatimeparams[TIMELEN]; typedef char _Xctimeparams[TIMELEN]; # else typedef char _Xatimeparams[26]; typedef char _Xctimeparams[26]; # endif typedef struct tm _Xgtimeparams; typedef struct tm _Xltimeparams; # define _XAsctime(t,p) asctime_r((t),(p)) # define _XCtime(t,p) ctime_r((t),(p)) # define _XGmtime(t,p) gmtime_r((t),&(p)) # define _XLocaltime(t,p) localtime_r((t),&(p)) #endif /* X_INCLUDE_TIME_H */ #if defined(X_INCLUDE_TIME_H) && !defined(_XOS_INCLUDED_TIME_H) # define _XOS_INCLUDED_TIME_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * NOTE: On systems lacking appropriate _r functions Getgrgid() and * Getgrnam() do NOT copy the list of group members! * * Remember that fgetgrent(), setgrent(), getgrent(), and endgrent() * are not included in POSIX. * * #define X_INCLUDE_GRP_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xgetgrparams; * * struct group *_XGetgrgid(gid_t, _Xgetgrparams); * struct group *_XGetgrnam(const char *, _Xgetgrparams); */ #if defined(X_INCLUDE_GRP_H) && !defined(_XOS_INCLUDED_GRP_H) # include # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_GRPAPI) # define XOS_USE_MTSAFE_GRPAPI 1 # endif #endif #if !defined(X_INCLUDE_GRP_H) || defined(_XOS_INCLUDED_GRP_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xgetgrparams; /* dummy */ #define _XGetgrgid(g,p) getgrgid((g)) #define _XGetgrnam(n,p) getgrnam((n)) #elif !defined(XOS_USE_MTSAFE_GRPAPI) || defined(XNO_MTSAFE_GRPAPI) /* Systems with thread support but no _r API. UnixWare 2.0. */ typedef struct { struct group grp; char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ struct group *pgrp; size_t len; } _Xgetgrparams; #ifdef SVR4 /* Copy the gr_passwd field too. */ # define _Xgrp_copyGroup(p) \ ( memcpy(&(p).grp, (p).pgrp, sizeof(struct group)), \ ((p).grp.gr_name = (p).buf), \ ((p).len = strlen((p).pgrp->gr_name)), \ strcpy((p).grp.gr_name, (p).pgrp->gr_name), \ ((p).grp.gr_passwd = (p).grp.gr_name + (p).len + 1), \ ((p).pgrp = &(p).grp), \ 0 ) #else # define _Xgrp_copyGroup(p) \ ( memcpy(&(p).grp, (p).pgrp, sizeof(struct group)), \ ((p).grp.gr_name = (p).buf), \ strcpy((p).grp.gr_name, (p).pgrp->gr_name), \ ((p).pgrp = &(p).grp), \ 0 ) #endif #define _XGetgrgid(g,p) \ ( (_Xos_processLock), \ (((p).pgrp = getgrgid((g))) ? _Xgrp_copyGroup(p) : 0), \ (_Xos_processUnlock), \ (p).pgrp ) #define _XGetgrnam(n,p) \ ( (_Xos_processLock), \ (((p).pgrp = getgrnam((n))) ? _Xgrp_copyGroup(p) : 0), \ (_Xos_processUnlock), \ (p).pgrp ) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(sun) /* Non-POSIX API. Solaris, DEC v3.2. * * extern struct group *getgrgid_r(gid_t, struct group *, char *, int); * extern struct group *getgrnam_r(const char *, struct group *, char *, int); */ typedef struct { struct group grp; char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ } _Xgetgrparams; #define _XGetgrgid(g,p) getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf)) #define _XGetgrnam(n,p) getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf)) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) /* Non-POSIX API. HP/UX 10. * * extern int getgrgid_r(gid_t, struct group *, char *, int); * extern int getgrnam_r(const char *, struct group *, char *, int); */ typedef struct { struct group grp; char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ } _Xgetgrparams; #define _XGetgrgid(g,p) \ ((getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf)) ? NULL : &(p).grp)) #define _XGetgrnam(n,p) \ ((getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf)) ? NULL : &(p).grp)) #else /* POSIX final API. DEC v4.0, IRIX 6.2. * * int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **); * int getgrnam_r(const char *, struct group *, char *, size_t, struct group **); */ typedef struct { struct group grp; char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ struct group *result; } _Xgetgrparams; #define _XGetgrgid(g,p) \ ((getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf), &(p).result) ? \ NULL : (p).result)) #define _XGetgrnam(n,p) \ ((getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf), &(p).result) ? \ NULL : (p).result)) #endif #if defined(X_INCLUDE_GRP_H) && !defined(_XOS_INCLUDED_GRP_H) # define _XOS_INCLUDED_GRP_H #endif #ifdef __cplusplus } /* Close scope of 'extern "C"' declaration which encloses file. */ #endif nx-libs-3.5.99.23/nx-X11/include/Xpoll.h.in0000644000000000000000000002236113614532331014606 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /**************************************************************************/ /* Copyright 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Copyright © 2005 Daniel Stone * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Daniel Stone not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. Daniel Stone makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * DANIEL STONE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * DANIEL STONE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _XPOLL_H_ #define _XPOLL_H_ #ifndef WIN32 #ifndef USE_POLL #include /* Below is the monster branch from hell. Basically, most systems will drop to * 'the branch below is the fallthrough for halfway modern systems', and include * , so we get the FD_* macros. */ #if defined(SVR4) && !defined(FD_SETSIZE) # include # ifdef luna # include # endif #else /* not SVR4 */ # include #endif #include #ifdef CSRG_BASED #include # if BSD < 199103 typedef long fd_mask; # endif #endif #define XFD_SETSIZE 256 #ifndef FD_SETSIZE #define FD_SETSIZE XFD_SETSIZE #endif #ifndef NBBY #define NBBY 8 /* number of bits in a byte */ #endif #ifndef NFDBITS #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ #endif #ifndef howmany #define howmany(x,y) (((x)+((y)-1))/(y)) #endif #if defined(BSD) && BSD < 198911 && !defined(luna) typedef struct fd_set { fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; } fd_set; #endif /* * Replace the standard Select with a version giving NX a * chance to check its own descriptors. This doesn't cover * the cases where the system is using poll or when system- * specific defines override the Select definition (OS/2). * See XlibInt.c for _XSelect(). */ #ifdef NX_TRANS_SOCKET extern int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); #define Select(n,r,w,e,t) _XSelect(n,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t) #else /* #ifdef NX_TRANS_SOCKET */ #define Select(n,r,w,e,t) select(n,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t) #endif /* #ifdef NX_TRANS_SOCKET */ #define __X_FDS_BITS @USE_FDS_BITS@ #ifndef __FDS_BITS # define __FDS_BITS(p) ((p)->__X_FDS_BITS) #endif #define __XFDS_BITS(p, n) (__FDS_BITS(p))[n] #ifndef FD_SET #define FD_SET(n, p) (__XFDS_BITS(p, ((n)/NFDBITS)) |= ((fd_mask)1 << ((n) % NFDBITS))) #endif #ifndef FD_CLR #define FD_CLR(n, p) (__XFDS_BITS((p), ((n)/NFDBITS)) &= ~((fd_mask)1 << ((n) % NFDBITS))) #endif #ifndef FD_ISSET #define FD_ISSET(n, p) ((__XFDS_BITS((p), ((n)/NFDBITS))) & ((fd_mask)1 << ((n) % NFDBITS))) #endif #ifndef FD_ZERO #define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) #endif /* * The howmany(FD_SETSIZE, NFDBITS) computes the number of elements in the * array. before accessing an element in the array we check it exists. * If it does not exist then the compiler discards the code to access it. */ #define XFD_ANYSET(p) \ ((howmany(FD_SETSIZE, NFDBITS) > 0 && (__XFDS_BITS(p, 0))) || \ (howmany(FD_SETSIZE, NFDBITS) > 1 && (__XFDS_BITS(p, 1))) || \ (howmany(FD_SETSIZE, NFDBITS) > 2 && (__XFDS_BITS(p, 2))) || \ (howmany(FD_SETSIZE, NFDBITS) > 3 && (__XFDS_BITS(p, 3))) || \ (howmany(FD_SETSIZE, NFDBITS) > 4 && (__XFDS_BITS(p, 4))) || \ (howmany(FD_SETSIZE, NFDBITS) > 5 && (__XFDS_BITS(p, 5))) || \ (howmany(FD_SETSIZE, NFDBITS) > 6 && (__XFDS_BITS(p, 6))) || \ (howmany(FD_SETSIZE, NFDBITS) > 7 && (__XFDS_BITS(p, 7)))) #define XFD_COPYSET(src,dst) { \ int __i__; \ for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \ __XFDS_BITS((dst), __i__) = __XFDS_BITS((src), __i__); \ } #define XFD_ANDSET(dst,b1,b2) { \ int __i__; \ for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \ __XFDS_BITS((dst), __i__) = ((__XFDS_BITS((b1), __i__)) & (__XFDS_BITS((b2), __i__))); \ } #define XFD_ORSET(dst,b1,b2) { \ int __i__; \ for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \ __XFDS_BITS((dst), __i__) = ((__XFDS_BITS((b1), __i__)) | (__XFDS_BITS((b2), __i__))); \ } #define XFD_UNSET(dst,b1) { \ int __i__; \ for (__i__ = 0; __i__ < howmany(FD_SETSIZE, NFDBITS); __i__++) \ __XFDS_BITS((dst), __i__) &= ~(__XFDS_BITS((b1), __i__)); \ } #else /* USE_POLL */ #include #endif /* USE_POLL */ #else /* WIN32 */ #define XFD_SETSIZE 256 #ifndef FD_SETSIZE #define FD_SETSIZE XFD_SETSIZE #endif #include #define Select(n,r,w,e,t) select(0,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t) #define XFD_SETCOUNT(p) (((fd_set FAR *)(p))->fd_count) #define XFD_FD(p,i) (((fd_set FAR *)(p))->fd_array[i]) #define XFD_ANYSET(p) XFD_SETCOUNT(p) #define XFD_COPYSET(src,dst) { \ u_int __i; \ FD_ZERO(dst); \ for (__i = 0; __i < XFD_SETCOUNT(src) ; __i++) { \ XFD_FD(dst,__i) = XFD_FD(src,__i); \ } \ XFD_SETCOUNT(dst) = XFD_SETCOUNT(src); \ } #define XFD_ANDSET(dst,b1,b2) { \ u_int __i; \ FD_ZERO(dst); \ for (__i = 0; __i < XFD_SETCOUNT(b1) ; __i++) { \ if (FD_ISSET(XFD_FD(b1,__i), b2)) \ FD_SET(XFD_FD(b1,__i), dst); \ } \ } #define XFD_ORSET(dst,b1,b2) { \ u_int __i; \ if (dst != b1) XFD_COPYSET(b1,dst); \ for (__i = 0; __i < XFD_SETCOUNT(b2) ; __i++) { \ if (!FD_ISSET(XFD_FD(b2,__i), dst)) \ FD_SET(XFD_FD(b2,__i), dst); \ } \ } /* this one is really sub-optimal */ #define XFD_UNSET(dst,b1) { \ u_int __i; \ for (__i = 0; __i < XFD_SETCOUNT(b1) ; __i++) { \ FD_CLR(XFD_FD(b1,__i), dst); \ } \ } /* we have to pay the price of having an array here, unlike with bitmasks calling twice FD_SET with the same fd is not transparent, so be careful */ #undef FD_SET #define FD_SET(fd,set) do { \ if (XFD_SETCOUNT(set) < FD_SETSIZE && !FD_ISSET(fd,set)) \ XFD_FD(set,XFD_SETCOUNT(set)++)=(fd); \ } while(0) #define getdtablesize() FD_SETSIZE #endif /* WIN32 */ #endif /* _XPOLL_H_ */ nx-libs-3.5.99.23/nx-X11/include/Xproto.h0000644000000000000000000015720513614532331014404 0ustar /* Definitions for the X window system used by server and c bindings */ /* * This packet-construction scheme makes the following assumptions: * * 1. The compiler is able * to generate code which addresses one- and two-byte quantities. * In the worst case, this would be done with bit-fields. If bit-fields * are used it may be necessary to reorder the request fields in this file, * depending on the order in which the machine assigns bit fields to * machine words. There may also be a problem with sign extension, * as K+R specify that bitfields are always unsigned. * * 2. 2- and 4-byte fields in packet structures must be ordered by hand * such that they are naturally-aligned, so that no compiler will ever * insert padding bytes. * * 3. All packets are hand-padded to a multiple of 4 bytes, for * the same reason. */ #ifndef XPROTO_H #define XPROTO_H /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include #include /* * Define constants for the sizes of the network packets. The sz_ prefix is * used instead of something more descriptive so that the symbols are no more * than 32 characters in length (which causes problems for some compilers). */ #define sz_xSegment 8 #define sz_xPoint 4 #define sz_xRectangle 8 #define sz_xArc 12 #define sz_xConnClientPrefix 12 #define sz_xConnSetupPrefix 8 #define sz_xConnSetup 32 #define sz_xPixmapFormat 8 #define sz_xDepth 8 #define sz_xVisualType 24 #define sz_xWindowRoot 40 #define sz_xTimecoord 8 #define sz_xHostEntry 4 #define sz_xCharInfo 12 #define sz_xFontProp 8 #define sz_xTextElt 2 #define sz_xColorItem 12 #define sz_xrgb 8 #define sz_xGenericReply 32 #define sz_xGetWindowAttributesReply 44 #define sz_xGetGeometryReply 32 #define sz_xQueryTreeReply 32 #define sz_xInternAtomReply 32 #define sz_xGetAtomNameReply 32 #define sz_xGetPropertyReply 32 #define sz_xListPropertiesReply 32 #define sz_xGetSelectionOwnerReply 32 #define sz_xGrabPointerReply 32 #define sz_xQueryPointerReply 32 #define sz_xGetMotionEventsReply 32 #define sz_xTranslateCoordsReply 32 #define sz_xGetInputFocusReply 32 #define sz_xQueryKeymapReply 40 #define sz_xQueryFontReply 60 #define sz_xQueryTextExtentsReply 32 #define sz_xListFontsReply 32 #define sz_xGetFontPathReply 32 #define sz_xGetImageReply 32 #define sz_xListInstalledColormapsReply 32 #define sz_xAllocColorReply 32 #define sz_xAllocNamedColorReply 32 #define sz_xAllocColorCellsReply 32 #define sz_xAllocColorPlanesReply 32 #define sz_xQueryColorsReply 32 #define sz_xLookupColorReply 32 #define sz_xQueryBestSizeReply 32 #define sz_xQueryExtensionReply 32 #define sz_xListExtensionsReply 32 #define sz_xSetMappingReply 32 #define sz_xGetKeyboardControlReply 52 #define sz_xGetPointerControlReply 32 #define sz_xGetScreenSaverReply 32 #define sz_xListHostsReply 32 #define sz_xSetModifierMappingReply 32 #define sz_xError 32 #define sz_xEvent 32 #define sz_xKeymapEvent 32 #define sz_xReq 4 #define sz_xResourceReq 8 #define sz_xCreateWindowReq 32 #define sz_xChangeWindowAttributesReq 12 #define sz_xChangeSaveSetReq 8 #define sz_xReparentWindowReq 16 #define sz_xConfigureWindowReq 12 #define sz_xCirculateWindowReq 8 #define sz_xInternAtomReq 8 #define sz_xChangePropertyReq 24 #define sz_xDeletePropertyReq 12 #define sz_xGetPropertyReq 24 #define sz_xSetSelectionOwnerReq 16 #define sz_xConvertSelectionReq 24 #define sz_xSendEventReq 44 #define sz_xGrabPointerReq 24 #define sz_xGrabButtonReq 24 #define sz_xUngrabButtonReq 12 #define sz_xChangeActivePointerGrabReq 16 #define sz_xGrabKeyboardReq 16 #define sz_xGrabKeyReq 16 #define sz_xUngrabKeyReq 12 #define sz_xAllowEventsReq 8 #define sz_xGetMotionEventsReq 16 #define sz_xTranslateCoordsReq 16 #define sz_xWarpPointerReq 24 #define sz_xSetInputFocusReq 12 #define sz_xOpenFontReq 12 #define sz_xQueryTextExtentsReq 8 #define sz_xListFontsReq 8 #define sz_xSetFontPathReq 8 #define sz_xCreatePixmapReq 16 #define sz_xCreateGCReq 16 #define sz_xChangeGCReq 12 #define sz_xCopyGCReq 16 #define sz_xSetDashesReq 12 #define sz_xSetClipRectanglesReq 12 #define sz_xCopyAreaReq 28 #define sz_xCopyPlaneReq 32 #define sz_xPolyPointReq 12 #define sz_xPolySegmentReq 12 #define sz_xFillPolyReq 16 #define sz_xPutImageReq 24 #define sz_xGetImageReq 20 #define sz_xPolyTextReq 16 #define sz_xImageTextReq 16 #define sz_xCreateColormapReq 16 #define sz_xCopyColormapAndFreeReq 12 #define sz_xAllocColorReq 16 #define sz_xAllocNamedColorReq 12 #define sz_xAllocColorCellsReq 12 #define sz_xAllocColorPlanesReq 16 #define sz_xFreeColorsReq 12 #define sz_xStoreColorsReq 8 #define sz_xStoreNamedColorReq 16 #define sz_xQueryColorsReq 8 #define sz_xLookupColorReq 12 #define sz_xCreateCursorReq 32 #define sz_xCreateGlyphCursorReq 32 #define sz_xRecolorCursorReq 20 #define sz_xQueryBestSizeReq 12 #define sz_xQueryExtensionReq 8 #define sz_xChangeKeyboardControlReq 8 #define sz_xBellReq 4 #define sz_xChangePointerControlReq 12 #define sz_xSetScreenSaverReq 12 #define sz_xChangeHostsReq 8 #define sz_xListHostsReq 4 #define sz_xChangeModeReq 4 #define sz_xRotatePropertiesReq 12 #define sz_xReply 32 #define sz_xGrabKeyboardReply 32 #define sz_xListFontsWithInfoReply 60 #define sz_xSetPointerMappingReply 32 #define sz_xGetKeyboardMappingReply 32 #define sz_xGetPointerMappingReply 32 #define sz_xGetModifierMappingReply 32 #define sz_xListFontsWithInfoReq 8 #define sz_xPolyLineReq 12 #define sz_xPolyArcReq 12 #define sz_xPolyRectangleReq 12 #define sz_xPolyFillRectangleReq 12 #define sz_xPolyFillArcReq 12 #define sz_xPolyText8Req 16 #define sz_xPolyText16Req 16 #define sz_xImageText8Req 16 #define sz_xImageText16Req 16 #define sz_xSetPointerMappingReq 4 #define sz_xForceScreenSaverReq 4 #define sz_xSetCloseDownModeReq 4 #define sz_xClearAreaReq 16 #define sz_xSetAccessControlReq 4 #define sz_xGetKeyboardMappingReq 8 #define sz_xSetModifierMappingReq 4 #define sz_xPropIconSize 24 #define sz_xChangeKeyboardMappingReq 8 /* For the purpose of the structure definitions in this file, we must redefine the following types in terms of Xmd.h's types, which may include bit fields. All of these are #undef'd at the end of this file, restoring the definitions in X.h. */ #define Window CARD32 #define Drawable CARD32 #define Font CARD32 #define Pixmap CARD32 #define Cursor CARD32 #define Colormap CARD32 #define GContext CARD32 #define Atom CARD32 #define VisualID CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define X_TCP_PORT 6000 /* add display number */ #define xTrue 1 #define xFalse 0 typedef CARD16 KeyButMask; /***************** Connection setup structures. See Chapter 8: Connection Setup of the X Window System Protocol specification for details. *****************/ /* Client initiates handshake with this data, followed by the strings * for the auth protocol & data. */ typedef struct { CARD8 byteOrder; BYTE pad; CARD16 majorVersion B16, minorVersion B16; CARD16 nbytesAuthProto B16; /* Authorization protocol */ CARD16 nbytesAuthString B16; /* Authorization string */ CARD16 pad2 B16; } xConnClientPrefix; /* Server response to xConnClientPrefix. * * If success == Success, this is followed by xConnSetup and * numRoots xWindowRoot structs. * * If success == Failure, this is followed by a reason string. * * The protocol also defines a case of success == Authenticate, but * that doesn't seem to have ever been implemented by the X Consortium. */ typedef struct { CARD8 success; BYTE lengthReason; /*num bytes in string following if failure */ CARD16 majorVersion B16, minorVersion B16; CARD16 length B16; /* 1/4 additional bytes in setup info */ } xConnSetupPrefix; typedef struct { CARD32 release B32; CARD32 ridBase B32, ridMask B32; CARD32 motionBufferSize B32; CARD16 nbytesVendor B16; /* number of bytes in vendor string */ CARD16 maxRequestSize B16; CARD8 numRoots; /* number of roots structs to follow */ CARD8 numFormats; /* number of pixmap formats */ CARD8 imageByteOrder; /* LSBFirst, MSBFirst */ CARD8 bitmapBitOrder; /* LeastSignificant, MostSign...*/ CARD8 bitmapScanlineUnit, /* 8, 16, 32 */ bitmapScanlinePad; /* 8, 16, 32 */ KeyCode minKeyCode, maxKeyCode; CARD32 pad2 B32; } xConnSetup; typedef struct { CARD8 depth; CARD8 bitsPerPixel; CARD8 scanLinePad; CARD8 pad1; CARD32 pad2 B32; } xPixmapFormat; /* window root */ typedef struct { CARD8 depth; CARD8 pad1; CARD16 nVisuals B16; /* number of xVisualType structures following */ CARD32 pad2 B32; } xDepth; typedef struct { VisualID visualID B32; #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 bitsPerRGB; CARD16 colormapEntries B16; CARD32 redMask B32, greenMask B32, blueMask B32; CARD32 pad B32; } xVisualType; typedef struct { Window windowId B32; Colormap defaultColormap B32; CARD32 whitePixel B32, blackPixel B32; CARD32 currentInputMask B32; CARD16 pixWidth B16, pixHeight B16; CARD16 mmWidth B16, mmHeight B16; CARD16 minInstalledMaps B16, maxInstalledMaps B16; VisualID rootVisualID B32; CARD8 backingStore; BOOL saveUnders; CARD8 rootDepth; CARD8 nDepths; /* number of xDepth structures following */ } xWindowRoot; /***************************************************************** * Structure Defns * Structures needed for replies *****************************************************************/ /* Used in GetMotionEvents */ typedef struct { CARD32 time B32; INT16 x B16, y B16; } xTimecoord; typedef struct { CARD8 family; BYTE pad; CARD16 length B16; } xHostEntry; typedef struct { INT16 leftSideBearing B16, rightSideBearing B16, characterWidth B16, ascent B16, descent B16; CARD16 attributes B16; } xCharInfo; typedef struct { Atom name B32; CARD32 value B32; } xFontProp; /* * non-aligned big-endian font ID follows this struct */ typedef struct { /* followed by string */ CARD8 len; /* number of *characters* in string, or FontChange (255) for font change, or 0 if just delta given */ INT8 delta; } xTextElt; typedef struct { CARD32 pixel B32; CARD16 red B16, green B16, blue B16; CARD8 flags; /* DoRed, DoGreen, DoBlue booleans */ CARD8 pad; } xColorItem; typedef struct { CARD16 red B16, green B16, blue B16, pad B16; } xrgb; typedef CARD8 KEYCODE; /***************** * XRep: * meant to be 32 byte quantity *****************/ /* GenericReply is the common format of all replies. The "data" items are specific to each individual reply type. */ typedef struct { BYTE type; /* X_Reply */ BYTE data1; /* depends on reply type */ CARD16 sequenceNumber B16; /* of last request received by server */ CARD32 length B32; /* 4 byte quantities beyond size of GenericReply */ CARD32 data00 B32; CARD32 data01 B32; CARD32 data02 B32; CARD32 data03 B32; CARD32 data04 B32; CARD32 data05 B32; } xGenericReply; /* Individual reply formats. */ typedef struct { BYTE type; /* X_Reply */ CARD8 backingStore; CARD16 sequenceNumber B16; CARD32 length B32; /* NOT 0; this is an extra-large reply */ VisualID visualID B32; #if defined(__cplusplus) || defined(c_plusplus) CARD16 c_class B16; #else CARD16 class B16; #endif CARD8 bitGravity; CARD8 winGravity; CARD32 backingBitPlanes B32; CARD32 backingPixel B32; BOOL saveUnder; BOOL mapInstalled; CARD8 mapState; BOOL override; Colormap colormap B32; CARD32 allEventMasks B32; CARD32 yourEventMask B32; CARD16 doNotPropagateMask B16; CARD16 pad B16; } xGetWindowAttributesReply; typedef struct { BYTE type; /* X_Reply */ CARD8 depth; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window root B32; INT16 x B16, y B16; CARD16 width B16, height B16; CARD16 borderWidth B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; } xGetGeometryReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; Window root B32, parent B32; CARD16 nChildren B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xQueryTreeReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Atom atom B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xInternAtomReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* of additional bytes */ CARD16 nameLength B16; /* # of characters in name */ CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetAtomNameReply; typedef struct { BYTE type; /* X_Reply */ CARD8 format; CARD16 sequenceNumber B16; CARD32 length B32; /* of additional bytes */ Atom propertyType B32; CARD32 bytesAfter B32; CARD32 nItems B32; /* # of 8, 16, or 32-bit entities in reply */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xGetPropertyReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nProperties B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListPropertiesReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window owner B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetSelectionOwnerReply; typedef struct { BYTE type; /* X_Reply */ BYTE status; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGrabPointerReply; typedef xGrabPointerReply xGrabKeyboardReply; typedef struct { BYTE type; /* X_Reply */ BOOL sameScreen; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window root B32, child B32; INT16 rootX B16, rootY B16, winX B16, winY B16; CARD16 mask B16; CARD16 pad1 B16; CARD32 pad B32; } xQueryPointerReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 nEvents B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetMotionEventsReply; typedef struct { BYTE type; /* X_Reply */ BOOL sameScreen; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window child B32; INT16 dstX B16, dstY B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xTranslateCoordsReply; typedef struct { BYTE type; /* X_Reply */ CARD8 revertTo; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window focus B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xGetInputFocusReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 2, NOT 0; this is an extra-large reply */ BYTE map[32]; } xQueryKeymapReply; /* Warning: this MUST match (up to component renaming) xListFontsWithInfoReply */ typedef struct _xQueryFontReply { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* definitely > 0, even if "nCharInfos" is 0 */ xCharInfo minBounds; CARD32 walign1 B32; xCharInfo maxBounds; CARD32 walign2 B32; CARD16 minCharOrByte2 B16, maxCharOrByte2 B16; CARD16 defaultChar B16; CARD16 nFontProps B16; /* followed by this many xFontProp structures */ CARD8 drawDirection; CARD8 minByte1, maxByte1; BOOL allCharsExist; INT16 fontAscent B16, fontDescent B16; CARD32 nCharInfos B32; /* followed by this many xCharInfo structures */ } xQueryFontReply; typedef struct { BYTE type; /* X_Reply */ CARD8 drawDirection; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ INT16 fontAscent B16, fontDescent B16; INT16 overallAscent B16, overallDescent B16; INT32 overallWidth B32, overallLeft B32, overallRight B32; CARD32 pad B32; } xQueryTextExtentsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nFonts B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListFontsReply; /* Warning: this MUST match (up to component renaming) xQueryFontReply */ typedef struct { BYTE type; /* X_Reply */ CARD8 nameLength; /* 0 indicates end-of-reply-sequence */ CARD16 sequenceNumber B16; CARD32 length B32; /* definitely > 0, even if "nameLength" is 0 */ xCharInfo minBounds; CARD32 walign1 B32; xCharInfo maxBounds; CARD32 walign2 B32; CARD16 minCharOrByte2 B16, maxCharOrByte2 B16; CARD16 defaultChar B16; CARD16 nFontProps B16; /* followed by this many xFontProp structures */ CARD8 drawDirection; CARD8 minByte1, maxByte1; BOOL allCharsExist; INT16 fontAscent B16, fontDescent B16; CARD32 nReplies B32; /* hint as to how many more replies might be coming */ } xListFontsWithInfoReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nPaths B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetFontPathReply; typedef struct { BYTE type; /* X_Reply */ CARD8 depth; CARD16 sequenceNumber B16; CARD32 length B32; VisualID visual B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetImageReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nColormaps B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListInstalledColormapsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 red B16, green B16, blue B16; CARD16 pad2 B16; CARD32 pixel B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xAllocColorReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD32 pixel B32; CARD16 exactRed B16, exactGreen B16, exactBlue B16; CARD16 screenRed B16, screenGreen B16, screenBlue B16; CARD32 pad2 B32; CARD32 pad3 B32; } xAllocNamedColorReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nPixels B16, nMasks B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xAllocColorCellsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nPixels B16; CARD16 pad2 B16; CARD32 redMask B32, greenMask B32, blueMask B32; CARD32 pad3 B32; CARD32 pad4 B32; } xAllocColorPlanesReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nColors B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xQueryColorsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 exactRed B16, exactGreen B16, exactBlue B16; CARD16 screenRed B16, screenGreen B16, screenBlue B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xLookupColorReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 width B16, height B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xQueryBestSizeReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ BOOL present; CARD8 major_opcode; CARD8 first_event; CARD8 first_error; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xQueryExtensionReply; typedef struct { BYTE type; /* X_Reply */ CARD8 nExtensions; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListExtensionsReply; typedef struct { BYTE type; /* X_Reply */ CARD8 success; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xSetMappingReply; typedef xSetMappingReply xSetPointerMappingReply; typedef xSetMappingReply xSetModifierMappingReply; typedef struct { BYTE type; /* X_Reply */ CARD8 nElts; /* how many elements does the map have */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetPointerMappingReply; typedef struct { BYTE type; CARD8 keySymsPerKeyCode; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetKeyboardMappingReply; typedef struct { BYTE type; CARD8 numKeyPerModifier; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetModifierMappingReply; typedef struct { BYTE type; /* X_Reply */ BOOL globalAutoRepeat; CARD16 sequenceNumber B16; CARD32 length B32; /* 5 */ CARD32 ledMask B32; CARD8 keyClickPercent, bellPercent; CARD16 bellPitch B16, bellDuration B16; CARD16 pad B16; BYTE map[32]; /* bit masks start here */ } xGetKeyboardControlReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 accelNumerator B16, accelDenominator B16; CARD16 threshold B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetPointerControlReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 timeout B16, interval B16; BOOL preferBlanking; BOOL allowExposures; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetScreenSaverReply; typedef struct { BYTE type; /* X_Reply */ BOOL enabled; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nHosts B16; CARD16 pad1 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListHostsReply; /***************************************************************** * Xerror * All errors are 32 bytes *****************************************************************/ typedef struct { BYTE type; /* X_Error */ BYTE errorCode; CARD16 sequenceNumber B16; /* the nth request from this client */ CARD32 resourceID B32; CARD16 minorCode B16; CARD8 majorCode; BYTE pad1; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xError; /***************************************************************** * xEvent * All events are 32 bytes *****************************************************************/ typedef struct _xEvent { union { struct { BYTE type; BYTE detail; CARD16 sequenceNumber B16; } u; struct { CARD32 pad00 B32; Time time B32; Window root B32, event B32, child B32; INT16 rootX B16, rootY B16, eventX B16, eventY B16; KeyButMask state B16; BOOL sameScreen; BYTE pad1; } keyButtonPointer; struct { CARD32 pad00 B32; Time time B32; Window root B32, event B32, child B32; INT16 rootX B16, rootY B16, eventX B16, eventY B16; KeyButMask state B16; BYTE mode; /* really XMode */ BYTE flags; /* sameScreen and focus booleans, packed together */ #define ELFlagFocus (1<<0) #define ELFlagSameScreen (1<<1) } enterLeave; struct { CARD32 pad00 B32; Window window B32; BYTE mode; /* really XMode */ BYTE pad1, pad2, pad3; } focus; struct { CARD32 pad00 B32; Window window B32; CARD16 x B16, y B16, width B16, height B16; CARD16 count B16; CARD16 pad2 B16; } expose; struct { CARD32 pad00 B32; Drawable drawable B32; CARD16 x B16, y B16, width B16, height B16; CARD16 minorEvent B16; CARD16 count B16; BYTE majorEvent; BYTE pad1, pad2, pad3; } graphicsExposure; struct { CARD32 pad00 B32; Drawable drawable B32; CARD16 minorEvent B16; BYTE majorEvent; BYTE bpad; } noExposure; struct { CARD32 pad00 B32; Window window B32; CARD8 state; BYTE pad1, pad2, pad3; } visibility; struct { CARD32 pad00 B32; Window parent B32, window B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; BOOL override; BYTE bpad; } createNotify; /* * The event fields in the structures for DestroyNotify, UnmapNotify, * MapNotify, ReparentNotify, ConfigureNotify, CirculateNotify, GravityNotify, * must be at the same offset because server internal code is depending upon * this to patch up the events before they are delivered. * Also note that MapRequest, ConfigureRequest and CirculateRequest have * the same offset for the event window. */ struct { CARD32 pad00 B32; Window event B32, window B32; } destroyNotify; struct { CARD32 pad00 B32; Window event B32, window B32; BOOL fromConfigure; BYTE pad1, pad2, pad3; } unmapNotify; struct { CARD32 pad00 B32; Window event B32, window B32; BOOL override; BYTE pad1, pad2, pad3; } mapNotify; struct { CARD32 pad00 B32; Window parent B32, window B32; } mapRequest; struct { CARD32 pad00 B32; Window event B32, window B32, parent B32; INT16 x B16, y B16; BOOL override; BYTE pad1, pad2, pad3; } reparent; struct { CARD32 pad00 B32; Window event B32, window B32, aboveSibling B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; BOOL override; BYTE bpad; } configureNotify; struct { CARD32 pad00 B32; Window parent B32, window B32, sibling B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; CARD16 valueMask B16; CARD32 pad1 B32; } configureRequest; struct { CARD32 pad00 B32; Window event B32, window B32; INT16 x B16, y B16; CARD32 pad1 B32, pad2 B32, pad3 B32, pad4 B32; } gravity; struct { CARD32 pad00 B32; Window window B32; CARD16 width B16, height B16; } resizeRequest; struct { /* The event field in the circulate record is really the parent when this is used as a CirculateRequest instead of a CirculateNotify */ CARD32 pad00 B32; Window event B32, window B32, parent B32; BYTE place; /* Top or Bottom */ BYTE pad1, pad2, pad3; } circulate; struct { CARD32 pad00 B32; Window window B32; Atom atom B32; Time time B32; BYTE state; /* NewValue or Deleted */ BYTE pad1; CARD16 pad2 B16; } property; struct { CARD32 pad00 B32; Time time B32; Window window B32; Atom atom B32; } selectionClear; struct { CARD32 pad00 B32; Time time B32; Window owner B32, requestor B32; Atom selection B32, target B32, property B32; } selectionRequest; struct { CARD32 pad00 B32; Time time B32; Window requestor B32; Atom selection B32, target B32, property B32; } selectionNotify; struct { CARD32 pad00 B32; Window window B32; Colormap colormap B32; #if defined(__cplusplus) || defined(c_plusplus) BOOL c_new; #else BOOL new; #endif BYTE state; /* Installed or UnInstalled */ BYTE pad1, pad2; } colormap; struct { CARD32 pad00 B32; CARD8 request; KeyCode firstKeyCode; CARD8 count; BYTE pad1; } mappingNotify; struct { CARD32 pad00 B32; Window window B32; union { struct { Atom type B32; INT32 longs0 B32; INT32 longs1 B32; INT32 longs2 B32; INT32 longs3 B32; INT32 longs4 B32; } l; struct { Atom type B32; INT16 shorts0 B16; INT16 shorts1 B16; INT16 shorts2 B16; INT16 shorts3 B16; INT16 shorts4 B16; INT16 shorts5 B16; INT16 shorts6 B16; INT16 shorts7 B16; INT16 shorts8 B16; INT16 shorts9 B16; } s; struct { Atom type B32; INT8 bytes[20]; } b; } u; } clientMessage; } u; } xEvent; /********************************************************* * * Generic event * * Those events are not part of the core protocol spec and can be used by * various extensions. * type is always GenericEvent * extension is the minor opcode of the extension the event belongs to. * evtype is the actual event type, unique __per extension__. * * GenericEvents can be longer than 32 bytes, with the length field * specifying the number of 4 byte blocks after the first 32 bytes. * * */ typedef struct { BYTE type; CARD8 extension; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 evtype B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGenericEvent; /* KeymapNotify events are not included in the above union because they are different from all other events: they do not have a "detail" or "sequenceNumber", so there is room for a 248-bit key mask. */ typedef struct { BYTE type; BYTE map[31]; } xKeymapEvent; #define XEventSize (sizeof(xEvent)) /* XReply is the union of all the replies above whose "fixed part" fits in 32 bytes. It does NOT include GetWindowAttributesReply, QueryFontReply, QueryKeymapReply, or GetKeyboardControlReply ListFontsWithInfoReply */ typedef union { xGenericReply generic; xGetGeometryReply geom; xQueryTreeReply tree; xInternAtomReply atom; xGetAtomNameReply atomName; xGetPropertyReply property; xListPropertiesReply listProperties; xGetSelectionOwnerReply selection; xGrabPointerReply grabPointer; xGrabKeyboardReply grabKeyboard; xQueryPointerReply pointer; xGetMotionEventsReply motionEvents; xTranslateCoordsReply coords; xGetInputFocusReply inputFocus; xQueryTextExtentsReply textExtents; xListFontsReply fonts; xGetFontPathReply fontPath; xGetImageReply image; xListInstalledColormapsReply colormaps; xAllocColorReply allocColor; xAllocNamedColorReply allocNamedColor; xAllocColorCellsReply colorCells; xAllocColorPlanesReply colorPlanes; xQueryColorsReply colors; xLookupColorReply lookupColor; xQueryBestSizeReply bestSize; xQueryExtensionReply extension; xListExtensionsReply extensions; xSetModifierMappingReply setModifierMapping; xGetModifierMappingReply getModifierMapping; xSetPointerMappingReply setPointerMapping; xGetKeyboardMappingReply getKeyboardMapping; xGetPointerMappingReply getPointerMapping; xGetPointerControlReply pointerControl; xGetScreenSaverReply screenSaver; xListHostsReply hosts; xError error; xEvent event; } xReply; /***************************************************************** * REQUESTS *****************************************************************/ /* Request structure */ typedef struct _xReq { CARD8 reqType; CARD8 data; /* meaning depends on request type */ CARD16 length B16; /* length in 4 bytes quantities of whole request, including this header */ } xReq; /***************************************************************** * structures that follow request. *****************************************************************/ /* ResourceReq is used for any request which has a resource ID (or Atom or Time) as its one and only argument. */ typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD32 id B32; /* a Window, Drawable, Font, GContext, Pixmap, etc. */ } xResourceReq; typedef struct { CARD8 reqType; CARD8 depth; CARD16 length B16; Window wid B32, parent B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; #if defined(__cplusplus) || defined(c_plusplus) CARD16 c_class B16; #else CARD16 class B16; #endif VisualID visual B32; CARD32 mask B32; } xCreateWindowReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; CARD32 valueMask B32; } xChangeWindowAttributesReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length B16; Window window B32; } xChangeSaveSetReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32, parent B32; INT16 x B16, y B16; } xReparentWindowReq; typedef struct { CARD8 reqType; CARD8 pad; CARD16 length B16; Window window B32; CARD16 mask B16; CARD16 pad2 B16; } xConfigureWindowReq; typedef struct { CARD8 reqType; CARD8 direction; CARD16 length B16; Window window B32; } xCirculateWindowReq; typedef struct { /* followed by padded string */ CARD8 reqType; BOOL onlyIfExists; CARD16 length B16; CARD16 nbytes B16; /* number of bytes in string */ CARD16 pad B16; } xInternAtomReq; typedef struct { CARD8 reqType; CARD8 mode; CARD16 length B16; Window window B32; Atom property B32, type B32; CARD8 format; BYTE pad[3]; CARD32 nUnits B32; /* length of stuff following, depends on format */ } xChangePropertyReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; Atom property B32; } xDeletePropertyReq; typedef struct { CARD8 reqType; #if defined(__cplusplus) || defined(c_plusplus) BOOL c_delete; #else BOOL delete; #endif CARD16 length B16; Window window B32; Atom property B32, type B32; CARD32 longOffset B32; CARD32 longLength B32; } xGetPropertyReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; Atom selection B32; Time time B32; } xSetSelectionOwnerReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window requestor B32; Atom selection B32, target B32, property B32; Time time B32; } xConvertSelectionReq; typedef struct { CARD8 reqType; BOOL propagate; CARD16 length B16; Window destination B32; CARD32 eventMask B32; xEvent event; } xSendEventReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; CARD16 eventMask B16; BYTE pointerMode, keyboardMode; Window confineTo B32; Cursor cursor B32; Time time B32; } xGrabPointerReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; CARD16 eventMask B16; BYTE pointerMode, keyboardMode; Window confineTo B32; Cursor cursor B32; CARD8 button; BYTE pad; CARD16 modifiers B16; } xGrabButtonReq; typedef struct { CARD8 reqType; CARD8 button; CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD16 pad B16; } xUngrabButtonReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cursor B32; Time time B32; CARD16 eventMask B16; CARD16 pad2 B16; } xChangeActivePointerGrabReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; Time time B32; BYTE pointerMode, keyboardMode; CARD16 pad B16; } xGrabKeyboardReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD8 key; BYTE pointerMode, keyboardMode; BYTE pad1, pad2, pad3; } xGrabKeyReq; typedef struct { CARD8 reqType; CARD8 key; CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD16 pad B16; } xUngrabKeyReq; typedef struct { CARD8 reqType; CARD8 mode; CARD16 length B16; Time time B32; } xAllowEventsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; Time start B32, stop B32; } xGetMotionEventsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window srcWid B32, dstWid B32; INT16 srcX B16, srcY B16; } xTranslateCoordsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window srcWid B32, dstWid B32; INT16 srcX B16, srcY B16; CARD16 srcWidth B16, srcHeight B16; INT16 dstX B16, dstY B16; } xWarpPointerReq; typedef struct { CARD8 reqType; CARD8 revertTo; CARD16 length B16; Window focus B32; Time time B32; } xSetInputFocusReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Font fid B32; CARD16 nbytes B16; BYTE pad1, pad2; /* string follows on word boundary */ } xOpenFontReq; typedef struct { CARD8 reqType; BOOL oddLength; CARD16 length B16; Font fid B32; } xQueryTextExtentsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD16 maxNames B16; CARD16 nbytes B16; /* followed immediately by string bytes */ } xListFontsReq; typedef xListFontsReq xListFontsWithInfoReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD16 nFonts B16; BYTE pad1, pad2; /* LISTofSTRING8 follows on word boundary */ } xSetFontPathReq; typedef struct { CARD8 reqType; CARD8 depth; CARD16 length B16; Pixmap pid B32; Drawable drawable B32; CARD16 width B16, height B16; } xCreatePixmapReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext gc B32; Drawable drawable B32; CARD32 mask B32; } xCreateGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext gc B32; CARD32 mask B32; } xChangeGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext srcGC B32, dstGC B32; CARD32 mask B32; } xCopyGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext gc B32; CARD16 dashOffset B16; CARD16 nDashes B16; /* length LISTofCARD8 of values following */ } xSetDashesReq; typedef struct { CARD8 reqType; BYTE ordering; CARD16 length B16; GContext gc B32; INT16 xOrigin B16, yOrigin B16; } xSetClipRectanglesReq; typedef struct { CARD8 reqType; BOOL exposures; CARD16 length B16; Window window B32; INT16 x B16, y B16; CARD16 width B16, height B16; } xClearAreaReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable srcDrawable B32, dstDrawable B32; GContext gc B32; INT16 srcX B16, srcY B16, dstX B16, dstY B16; CARD16 width B16, height B16; } xCopyAreaReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable srcDrawable B32, dstDrawable B32; GContext gc B32; INT16 srcX B16, srcY B16, dstX B16, dstY B16; CARD16 width B16, height B16; CARD32 bitPlane B32; } xCopyPlaneReq; typedef struct { CARD8 reqType; BYTE coordMode; CARD16 length B16; Drawable drawable B32; GContext gc B32; } xPolyPointReq; typedef xPolyPointReq xPolyLineReq; /* same request structure */ /* The following used for PolySegment, PolyRectangle, PolyArc, PolyFillRectangle, PolyFillArc */ typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable drawable B32; GContext gc B32; } xPolySegmentReq; typedef xPolySegmentReq xPolyArcReq; typedef xPolySegmentReq xPolyRectangleReq; typedef xPolySegmentReq xPolyFillRectangleReq; typedef xPolySegmentReq xPolyFillArcReq; typedef struct _FillPolyReq { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable drawable B32; GContext gc B32; BYTE shape; BYTE coordMode; CARD16 pad1 B16; } xFillPolyReq; typedef struct _PutImageReq { CARD8 reqType; CARD8 format; CARD16 length B16; Drawable drawable B32; GContext gc B32; CARD16 width B16, height B16; INT16 dstX B16, dstY B16; CARD8 leftPad; CARD8 depth; CARD16 pad B16; } xPutImageReq; typedef struct { CARD8 reqType; CARD8 format; CARD16 length B16; Drawable drawable B32; INT16 x B16, y B16; CARD16 width B16, height B16; CARD32 planeMask B32; } xGetImageReq; /* the following used by PolyText8 and PolyText16 */ typedef struct { CARD8 reqType; CARD8 pad; CARD16 length B16; Drawable drawable B32; GContext gc B32; INT16 x B16, y B16; /* items (xTextElt) start after struct */ } xPolyTextReq; typedef xPolyTextReq xPolyText8Req; typedef xPolyTextReq xPolyText16Req; typedef struct { CARD8 reqType; BYTE nChars; CARD16 length B16; Drawable drawable B32; GContext gc B32; INT16 x B16, y B16; } xImageTextReq; typedef xImageTextReq xImageText8Req; typedef xImageTextReq xImageText16Req; typedef struct { CARD8 reqType; BYTE alloc; CARD16 length B16; Colormap mid B32; Window window B32; VisualID visual B32; } xCreateColormapReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap mid B32; Colormap srcCmap B32; } xCopyColormapAndFreeReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD16 red B16, green B16, blue B16; CARD16 pad2 B16; } xAllocColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD16 nbytes B16; /* followed by structure */ BYTE pad1, pad2; } xAllocNamedColorReq; typedef struct { CARD8 reqType; BOOL contiguous; CARD16 length B16; Colormap cmap B32; CARD16 colors B16, planes B16; } xAllocColorCellsReq; typedef struct { CARD8 reqType; BOOL contiguous; CARD16 length B16; Colormap cmap B32; CARD16 colors B16, red B16, green B16, blue B16; } xAllocColorPlanesReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD32 planeMask B32; } xFreeColorsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; } xStoreColorsReq; typedef struct { CARD8 reqType; CARD8 flags; /* DoRed, DoGreen, DoBlue, as in xColorItem */ CARD16 length B16; Colormap cmap B32; CARD32 pixel B32; CARD16 nbytes B16; /* number of name string bytes following structure */ BYTE pad1, pad2; } xStoreNamedColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; } xQueryColorsReq; typedef struct { /* followed by string of length len */ CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD16 nbytes B16; /* number of string bytes following structure*/ BYTE pad1, pad2; } xLookupColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cid B32; Pixmap source B32, mask B32; CARD16 foreRed B16, foreGreen B16, foreBlue B16; CARD16 backRed B16, backGreen B16, backBlue B16; CARD16 x B16, y B16; } xCreateCursorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cid B32; Font source B32, mask B32; CARD16 sourceChar B16, maskChar B16; CARD16 foreRed B16, foreGreen B16, foreBlue B16; CARD16 backRed B16, backGreen B16, backBlue B16; } xCreateGlyphCursorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cursor B32; CARD16 foreRed B16, foreGreen B16, foreBlue B16; CARD16 backRed B16, backGreen B16, backBlue B16; } xRecolorCursorReq; typedef struct { CARD8 reqType; #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD16 length B16; Drawable drawable B32; CARD16 width B16, height B16; } xQueryBestSizeReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD16 nbytes B16; /* number of string bytes following structure */ BYTE pad1, pad2; } xQueryExtensionReq; typedef struct { CARD8 reqType; CARD8 numKeyPerModifier; CARD16 length B16; } xSetModifierMappingReq; typedef struct { CARD8 reqType; CARD8 nElts; /* how many elements in the map */ CARD16 length B16; } xSetPointerMappingReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; KeyCode firstKeyCode; CARD8 count; CARD16 pad1 B16; } xGetKeyboardMappingReq; typedef struct { CARD8 reqType; CARD8 keyCodes; CARD16 length B16; KeyCode firstKeyCode; CARD8 keySymsPerKeyCode; CARD16 pad1 B16; } xChangeKeyboardMappingReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD32 mask B32; } xChangeKeyboardControlReq; typedef struct { CARD8 reqType; INT8 percent; /* -100 to 100 */ CARD16 length B16; } xBellReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; INT16 accelNum B16, accelDenum B16; INT16 threshold B16; BOOL doAccel, doThresh; } xChangePointerControlReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; INT16 timeout B16, interval B16; BYTE preferBlank, allowExpose; CARD16 pad2 B16; } xSetScreenSaverReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length B16; CARD8 hostFamily; BYTE pad; CARD16 hostLength B16; } xChangeHostsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; } xListHostsReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length B16; } xChangeModeReq; typedef xChangeModeReq xSetAccessControlReq; typedef xChangeModeReq xSetCloseDownModeReq; typedef xChangeModeReq xForceScreenSaverReq; typedef struct { /* followed by LIST of ATOM */ CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; CARD16 nAtoms B16; INT16 nPositions B16; } xRotatePropertiesReq; /* Reply codes */ #define X_Reply 1 /* Normal reply */ #define X_Error 0 /* Error */ /* Request codes */ #define X_CreateWindow 1 #define X_ChangeWindowAttributes 2 #define X_GetWindowAttributes 3 #define X_DestroyWindow 4 #define X_DestroySubwindows 5 #define X_ChangeSaveSet 6 #define X_ReparentWindow 7 #define X_MapWindow 8 #define X_MapSubwindows 9 #define X_UnmapWindow 10 #define X_UnmapSubwindows 11 #define X_ConfigureWindow 12 #define X_CirculateWindow 13 #define X_GetGeometry 14 #define X_QueryTree 15 #define X_InternAtom 16 #define X_GetAtomName 17 #define X_ChangeProperty 18 #define X_DeleteProperty 19 #define X_GetProperty 20 #define X_ListProperties 21 #define X_SetSelectionOwner 22 #define X_GetSelectionOwner 23 #define X_ConvertSelection 24 #define X_SendEvent 25 #define X_GrabPointer 26 #define X_UngrabPointer 27 #define X_GrabButton 28 #define X_UngrabButton 29 #define X_ChangeActivePointerGrab 30 #define X_GrabKeyboard 31 #define X_UngrabKeyboard 32 #define X_GrabKey 33 #define X_UngrabKey 34 #define X_AllowEvents 35 #define X_GrabServer 36 #define X_UngrabServer 37 #define X_QueryPointer 38 #define X_GetMotionEvents 39 #define X_TranslateCoords 40 #define X_WarpPointer 41 #define X_SetInputFocus 42 #define X_GetInputFocus 43 #define X_QueryKeymap 44 #define X_OpenFont 45 #define X_CloseFont 46 #define X_QueryFont 47 #define X_QueryTextExtents 48 #define X_ListFonts 49 #define X_ListFontsWithInfo 50 #define X_SetFontPath 51 #define X_GetFontPath 52 #define X_CreatePixmap 53 #define X_FreePixmap 54 #define X_CreateGC 55 #define X_ChangeGC 56 #define X_CopyGC 57 #define X_SetDashes 58 #define X_SetClipRectangles 59 #define X_FreeGC 60 #define X_ClearArea 61 #define X_CopyArea 62 #define X_CopyPlane 63 #define X_PolyPoint 64 #define X_PolyLine 65 #define X_PolySegment 66 #define X_PolyRectangle 67 #define X_PolyArc 68 #define X_FillPoly 69 #define X_PolyFillRectangle 70 #define X_PolyFillArc 71 #define X_PutImage 72 #define X_GetImage 73 #define X_PolyText8 74 #define X_PolyText16 75 #define X_ImageText8 76 #define X_ImageText16 77 #define X_CreateColormap 78 #define X_FreeColormap 79 #define X_CopyColormapAndFree 80 #define X_InstallColormap 81 #define X_UninstallColormap 82 #define X_ListInstalledColormaps 83 #define X_AllocColor 84 #define X_AllocNamedColor 85 #define X_AllocColorCells 86 #define X_AllocColorPlanes 87 #define X_FreeColors 88 #define X_StoreColors 89 #define X_StoreNamedColor 90 #define X_QueryColors 91 #define X_LookupColor 92 #define X_CreateCursor 93 #define X_CreateGlyphCursor 94 #define X_FreeCursor 95 #define X_RecolorCursor 96 #define X_QueryBestSize 97 #define X_QueryExtension 98 #define X_ListExtensions 99 #define X_ChangeKeyboardMapping 100 #define X_GetKeyboardMapping 101 #define X_ChangeKeyboardControl 102 #define X_GetKeyboardControl 103 #define X_Bell 104 #define X_ChangePointerControl 105 #define X_GetPointerControl 106 #define X_SetScreenSaver 107 #define X_GetScreenSaver 108 #define X_ChangeHosts 109 #define X_ListHosts 110 #define X_SetAccessControl 111 #define X_SetCloseDownMode 112 #define X_KillClient 113 #define X_RotateProperties 114 #define X_ForceScreenSaver 115 #define X_SetPointerMapping 116 #define X_GetPointerMapping 117 #define X_SetModifierMapping 118 #define X_GetModifierMapping 119 #define X_NoOperation 127 /* restore these definitions back to the typedefs in X.h */ #undef Window #undef Drawable #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef Atom #undef VisualID #undef Time #undef KeyCode #undef KeySym #endif /* XPROTO_H */ nx-libs-3.5.99.23/nx-X11/include/Xprotostr.h0000644000000000000000000000537013614532331015130 0ustar #ifndef XPROTOSTRUCTS_H #define XPROTOSTRUCTS_H /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include /* Used by PolySegment */ typedef struct _xSegment { INT16 x1 B16, y1 B16, x2 B16, y2 B16; } xSegment; /* POINT */ typedef struct _xPoint { INT16 x B16, y B16; } xPoint; typedef struct _xRectangle { INT16 x B16, y B16; CARD16 width B16, height B16; } xRectangle; /* ARC */ typedef struct _xArc { INT16 x B16, y B16; CARD16 width B16, height B16; INT16 angle1 B16, angle2 B16; } xArc; #endif /* XPROTOSTRUCTS_H */ nx-libs-3.5.99.23/nx-X11/include/Xthreads.h0000644000000000000000000002646113614532331014672 0ustar /* * $Xorg: Xthreads.h,v 1.5 2001/02/09 02:03:23 xorgcvs Exp $ * * Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * * */ #ifndef _XTHREADS_H_ #define _XTHREADS_H_ /* Redefine these to XtMalloc/XtFree or whatever you want before including * this header file. */ #ifdef CTHREADS #include typedef cthread_t xthread_t; typedef struct condition xcondition_rec; typedef struct mutex xmutex_rec; #define xthread_init() cthread_init() #define xthread_self cthread_self #define xthread_fork(func,closure) cthread_fork(func,closure) #define xthread_yield() cthread_yield() #define xthread_exit(v) cthread_exit(v) #define xthread_set_name(t,str) cthread_set_name(t,str) #define xmutex_init(m) mutex_init(m) #define xmutex_clear(m) mutex_clear(m) #define xmutex_lock(m) mutex_lock(m) #define xmutex_unlock(m) mutex_unlock(m) #define xmutex_set_name(m,str) mutex_set_name(m,str) #define xcondition_init(cv) condition_init(cv) #define xcondition_clear(cv) condition_clear(cv) #define xcondition_wait(cv,m) condition_wait(cv,m) #define xcondition_signal(cv) condition_signal(cv) #define xcondition_broadcast(cv) condition_broadcast(cv) #define xcondition_set_name(cv,str) condition_set_name(cv,str) #else /* !CTHREADS */ #if defined(SVR4) && !defined(_SEQUENT_) #include #include typedef thread_t xthread_t; typedef thread_key_t xthread_key_t; typedef cond_t xcondition_rec; typedef mutex_t xmutex_rec; #if defined(__UNIXWARE__) extern xthread_t (*_x11_thr_self)(); #define xthread_self (_x11_thr_self) #else #define xthread_self thr_self #endif #define xthread_fork(func,closure) thr_create(NULL,0,func,closure,THR_NEW_LWP|THR_DETACHED,NULL) #define xthread_yield() thr_yield() #define xthread_exit(v) thr_exit(v) #define xthread_key_create(kp,d) thr_keycreate(kp,d) #ifdef sun #define xthread_key_delete(k) 0 #else #define xthread_key_delete(k) thr_keydelete(k) #endif #define xthread_set_specific(k,v) thr_setspecific(k,v) #define xthread_get_specific(k,vp) thr_getspecific(k,vp) #define xmutex_init(m) mutex_init(m,USYNC_THREAD,0) #define xmutex_clear(m) mutex_destroy(m) #define xmutex_lock(m) mutex_lock(m) #define xmutex_unlock(m) mutex_unlock(m) #define xcondition_init(cv) cond_init(cv,USYNC_THREAD,0) #define xcondition_clear(cv) cond_destroy(cv) #define xcondition_wait(cv,m) cond_wait(cv,m) #define xcondition_signal(cv) cond_signal(cv) #define xcondition_broadcast(cv) cond_broadcast(cv) #else /* !SVR4 */ #ifdef WIN32 #include typedef DWORD xthread_t; typedef DWORD xthread_key_t; struct _xthread_waiter { HANDLE sem; struct _xthread_waiter *next; }; typedef struct { CRITICAL_SECTION cs; struct _xthread_waiter *waiters; } xcondition_rec; typedef CRITICAL_SECTION xmutex_rec; #define xthread_init() _Xthread_init() #define xthread_self GetCurrentThreadId #define xthread_fork(func,closure) { \ DWORD _tmptid; \ CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, (LPVOID)closure, 0, \ &_tmptid); \ } #define xthread_yield() Sleep(0) #define xthread_exit(v) ExitThread((DWORD)(v)) #define xthread_key_create(kp,d) *(kp) = TlsAlloc() #define xthread_key_delete(k) TlsFree(k) #define xthread_set_specific(k,v) TlsSetValue(k,v) #define xthread_get_specific(k,vp) TlsGetValue(k) #define xmutex_init(m) InitializeCriticalSection(m) #define xmutex_clear(m) DeleteCriticalSection(m) #define _XMUTEX_NESTS #define xmutex_lock(m) EnterCriticalSection(m) #define xmutex_unlock(m) LeaveCriticalSection(m) #define xcondition_init(cv) { \ InitializeCriticalSection(&(cv)->cs); \ (cv)->waiters = NULL; \ } #define xcondition_clear(cv) DeleteCriticalSection(&(cv)->cs) extern struct _xthread_waiter *_Xthread_waiter(); #define xcondition_wait(cv,m) { \ struct _xthread_waiter *_tmpthr = _Xthread_waiter(); \ EnterCriticalSection(&(cv)->cs); \ _tmpthr->next = (cv)->waiters; \ (cv)->waiters = _tmpthr; \ LeaveCriticalSection(&(cv)->cs); \ LeaveCriticalSection(m); \ WaitForSingleObject(_tmpthr->sem, INFINITE); \ EnterCriticalSection(m); \ } #define xcondition_signal(cv) { \ EnterCriticalSection(&(cv)->cs); \ if ((cv)->waiters) { \ ReleaseSemaphore((cv)->waiters->sem, 1, NULL); \ (cv)->waiters = (cv)->waiters->next; \ } \ LeaveCriticalSection(&(cv)->cs); \ } #define xcondition_broadcast(cv) { \ struct _xthread_waiter *_tmpthr; \ EnterCriticalSection(&(cv)->cs); \ for (_tmpthr = (cv)->waiters; _tmpthr; _tmpthr = _tmpthr->next) \ ReleaseSemaphore(_tmpthr->sem, 1, NULL); \ (cv)->waiters = NULL; \ LeaveCriticalSection(&(cv)->cs); \ } #else /* !WIN32 */ #ifdef USE_TIS_SUPPORT /* * TIS support is intended for thread safe libraries. * This should not be used for general client programming. */ #include typedef pthread_t xthread_t; typedef pthread_key_t xthread_key_t; typedef pthread_cond_t xcondition_rec; typedef pthread_mutex_t xmutex_rec; #define xthread_self tis_self #define xthread_fork(func,closure) { pthread_t _tmpxthr; \ pthread_create(&_tmpxthr,NULL,func,closure); } #define xthread_yield() pthread_yield_np() #define xthread_exit(v) pthread_exit(v) #define xthread_key_create(kp,d) tis_key_create(kp,d) #define xthread_key_delete(k) tis_key_delete(k) #define xthread_set_specific(k,v) tis_setspecific(k,v) #define xthread_get_specific(k,vp) *(vp) = tis_getspecific(k) #define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER #define xmutex_init(m) tis_mutex_init(m) #define xmutex_clear(m) tis_mutex_destroy(m) #define xmutex_lock(m) tis_mutex_lock(m) #define xmutex_unlock(m) tis_mutex_unlock(m) #define xcondition_init(c) tis_cond_init(c) #define xcondition_clear(c) tis_cond_destroy(c) #define xcondition_wait(c,m) tis_cond_wait(c,m) #define xcondition_signal(c) tis_cond_signal(c) #define xcondition_broadcast(c) tis_cond_broadcast(c) #else #ifdef USE_NBSD_THREADLIB /* * NetBSD threadlib support is intended for thread safe libraries. * This should not be used for general client programming. */ #include typedef thr_t xthread_t; typedef thread_key_t xthread_key_t; typedef cond_t xcondition_rec; typedef mutex_t xmutex_rec; #define xthread_self thr_self #define xthread_fork(func,closure) { thr_t _tmpxthr; \ /* XXX Create it detached? --thorpej */ \ thr_create(&_tmpxthr,NULL,func,closure); } #define xthread_yield() thr_yield() #define xthread_exit(v) thr_exit(v) #define xthread_key_create(kp,d) thr_keycreate(kp,d) #define xthread_key_delete(k) thr_keydelete(k) #define xthread_set_specific(k,v) thr_setspecific(k,v) #define xthread_get_specific(k,vp) *(vp) = thr_getspecific(k) #define XMUTEX_INITIALIZER MUTEX_INITIALIZER #define xmutex_init(m) mutex_init(m, 0) #define xmutex_clear(m) mutex_destroy(m) #define xmutex_lock(m) mutex_lock(m) #define xmutex_unlock(m) mutex_unlock(m) #define xcondition_init(c) cond_init(c, 0, 0) #define xcondition_clear(c) cond_destroy(c) #define xcondition_wait(c,m) cond_wait(c,m) #define xcondition_signal(c) cond_signal(c) #define xcondition_broadcast(c) cond_broadcast(c) #else #include typedef pthread_t xthread_t; typedef pthread_key_t xthread_key_t; typedef pthread_cond_t xcondition_rec; typedef pthread_mutex_t xmutex_rec; #define xthread_self pthread_self #define xthread_yield() pthread_yield() #define xthread_exit(v) pthread_exit(v) #define xthread_set_specific(k,v) pthread_setspecific(k,v) #define xmutex_clear(m) pthread_mutex_destroy(m) #define xmutex_lock(m) pthread_mutex_lock(m) #define xmutex_unlock(m) pthread_mutex_unlock(m) #ifndef XPRE_STANDARD_API #define xthread_key_create(kp,d) pthread_key_create(kp,d) #define xthread_key_delete(k) pthread_key_delete(k) #define xthread_get_specific(k,vp) *(vp) = pthread_getspecific(k) #define xthread_fork(func,closure) { pthread_t _tmpxthr; \ pthread_create(&_tmpxthr,NULL,func,closure); } #define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER #define xmutex_init(m) pthread_mutex_init(m, NULL) #define xcondition_init(c) pthread_cond_init(c, NULL) #else /* XPRE_STANDARD_API */ #define xthread_key_create(kp,d) pthread_keycreate(kp,d) #define xthread_key_delete(k) 0 #define xthread_get_specific(k,vp) pthread_getspecific(k,vp) #define xthread_fork(func,closure) { pthread_t _tmpxthr; \ pthread_create(&_tmpxthr,pthread_attr_default,func,closure); } #define xmutex_init(m) pthread_mutex_init(m, pthread_mutexattr_default) #define xcondition_init(c) pthread_cond_init(c, pthread_condattr_default) #endif /* XPRE_STANDARD_API */ #define xcondition_clear(c) pthread_cond_destroy(c) #define xcondition_wait(c,m) pthread_cond_wait(c,m) #define xcondition_signal(c) pthread_cond_signal(c) #define xcondition_broadcast(c) pthread_cond_broadcast(c) #if defined(_DECTHREADS_) static xthread_t _X_no_thread_id; #define xthread_have_id(id) !pthread_equal(id, _X_no_thread_id) #define xthread_clear_id(id) id = _X_no_thread_id #define xthread_equal(id1,id2) pthread_equal(id1, id2) #endif /* _DECTHREADS_ */ #if defined(__linux__) #define xthread_have_id(id) !pthread_equal(id, 0) #define xthread_clear_id(id) id = 0 #define xthread_equal(id1,id2) pthread_equal(id1, id2) #endif /* linux */ #if defined(_CMA_VENDOR_) && defined(_CMA__IBM) && (_CMA_VENDOR_ == _CMA__IBM) #ifdef DEBUG /* too much of a hack to enable normally */ /* see also cma__obj_set_name() */ #define xmutex_set_name(m,str) ((char**)(m)->field1)[5] = (str) #define xcondition_set_name(cv,str) ((char**)(cv)->field1)[5] = (str) #endif /* DEBUG */ #endif /* _CMA_VENDOR_ == _CMA__IBM */ #endif /* USE_NBSD_THREADLIB */ #endif /* USE_TIS_SUPPORT */ #endif /* WIN32 */ #endif /* SVR4 */ #endif /* CTHREADS */ typedef xcondition_rec *xcondition_t; typedef xmutex_rec *xmutex_t; #ifndef xcondition_malloc #define xcondition_malloc() (xcondition_t)malloc(sizeof(xcondition_rec)) #endif #ifndef xcondition_free #define xcondition_free(c) free((char *)c) #endif #ifndef xmutex_malloc #define xmutex_malloc() (xmutex_t)malloc(sizeof(xmutex_rec)) #endif #ifndef xmutex_free #define xmutex_free(m) free((char *)m) #endif #ifndef xthread_have_id #define xthread_have_id(id) id #endif #ifndef xthread_clear_id #define xthread_clear_id(id) id = 0 #endif #ifndef xthread_equal #define xthread_equal(id1,id2) ((id1) == (id2)) #endif /* aids understood by some debuggers */ #ifndef xthread_set_name #define xthread_set_name(t,str) #endif #ifndef xmutex_set_name #define xmutex_set_name(m,str) #endif #ifndef xcondition_set_name #define xcondition_set_name(cv,str) #endif #endif /* _XTHREADS_H_ */ nx-libs-3.5.99.23/nx-X11/include/Xw32defs.h0000644000000000000000000000336213614532331014510 0ustar #ifndef _XW32DEFS_H #define _XW32DEFS_H #ifdef __GNUC__ /* mingw is more close to unix than msvc */ #if !defined(__daddr_t_defined) typedef char *caddr_t; #endif #define lstat stat #else typedef char *caddr_t; #define access _access #define alloca _alloca #define chdir _chdir #define chmod _chmod #define close _close #define creat _creat #define dup _dup #define dup2 _dup2 #define environ _environ #define execl _execl #define execle _execle #define execlp _execlp #define execlpe _execlpe #define execv _execv #define execve _execve #define execvp _execvp #define execvpe _execvpe #define fdopen _fdopen #define fileno _fileno #define fstat _fstat #define getcwd _getcwd #define getpid _getpid #define hypot _hypot #define isascii __isascii #define isatty _isatty #define lseek _lseek #define mkdir _mkdir #define mktemp _mktemp #define open _open #define putenv _putenv #define read _read #define rmdir _rmdir #define sleep(x) _sleep((x) * 1000) #define stat _stat #define sys_errlist _sys_errlist #define sys_nerr _sys_nerr #define umask _umask #define unlink _unlink #define write _write #define random rand #define srandom srand #define O_RDONLY _O_RDONLY #define O_WRONLY _O_WRONLY #define O_RDWR _O_RDWR #define O_APPEND _O_APPEND #define O_CREAT _O_CREAT #define O_TRUNC _O_TRUNC #define O_EXCL _O_EXCL #define O_TEXT _O_TEXT #define O_BINARY _O_BINARY #define O_RAW _O_BINARY #define S_IFMT _S_IFMT #define S_IFDIR _S_IFDIR #define S_IFCHR _S_IFCHR #define S_IFREG _S_IFREG #define S_IREAD _S_IREAD #define S_IWRITE _S_IWRITE #define S_IEXEC _S_IEXEC #define F_OK 0 #define X_OK 1 #define W_OK 2 #define R_OK 4 #endif /* __GNUC__ */ #endif nx-libs-3.5.99.23/nx-X11/include/XWDFile.h0000644000000000000000000000760313614532331014347 0ustar /* Copyright 1985, 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * XWDFile.h MIT Project Athena, X Window system window raster * image dumper, dump file format header file. * * Author: Tony Della Fera, DEC * 27-Jun-85 * * Modifier: William F. Wyatt, SAO * 18-Nov-86 - version 6 for saving/restoring color maps */ #ifndef XWDFILE_H #define XWDFILE_H #include #define XWD_FILE_VERSION 7 #define sz_XWDheader 100 #define sz_XWDColor 12 typedef CARD32 xwdval; /* for old broken programs */ /* Values in the file are most significant byte first. */ typedef struct _xwd_file_header { /* header_size = SIZEOF(XWDheader) + length of null-terminated * window name. */ CARD32 header_size B32; CARD32 file_version B32; /* = XWD_FILE_VERSION above */ CARD32 pixmap_format B32; /* ZPixmap or XYPixmap */ CARD32 pixmap_depth B32; /* Pixmap depth */ CARD32 pixmap_width B32; /* Pixmap width */ CARD32 pixmap_height B32; /* Pixmap height */ CARD32 xoffset B32; /* Bitmap x offset, normally 0 */ CARD32 byte_order B32; /* of image data: MSBFirst, LSBFirst */ /* bitmap_unit applies to bitmaps (depth 1 format XY) only. * It is the number of bits that each scanline is padded to. */ CARD32 bitmap_unit B32; CARD32 bitmap_bit_order B32; /* bitmaps only: MSBFirst, LSBFirst */ /* bitmap_pad applies to pixmaps (non-bitmaps) only. * It is the number of bits that each scanline is padded to. */ CARD32 bitmap_pad B32; CARD32 bits_per_pixel B32; /* Bits per pixel */ /* bytes_per_line is pixmap_width padded to bitmap_unit (bitmaps) * or bitmap_pad (pixmaps). It is the delta (in bytes) to get * to the same x position on an adjacent row. */ CARD32 bytes_per_line B32; CARD32 visual_class B32; /* Class of colormap */ CARD32 red_mask B32; /* Z red mask */ CARD32 green_mask B32; /* Z green mask */ CARD32 blue_mask B32; /* Z blue mask */ CARD32 bits_per_rgb B32; /* Log2 of distinct color values */ CARD32 colormap_entries B32; /* Number of entries in colormap; not used? */ CARD32 ncolors B32; /* Number of XWDColor structures */ CARD32 window_width B32; /* Window width */ CARD32 window_height B32; /* Window height */ CARD32 window_x B32; /* Window upper left X coordinate */ CARD32 window_y B32; /* Window upper left Y coordinate */ CARD32 window_bdrwidth B32; /* Window border width */ } XWDFileHeader; /* Null-terminated window name follows the above structure. */ /* Next comes XWDColor structures, at offset XWDFileHeader.header_size in * the file. XWDFileHeader.ncolors tells how many XWDColor structures * there are. */ typedef struct { CARD32 pixel B32; CARD16 red B16; CARD16 green B16; CARD16 blue B16; CARD8 flags; CARD8 pad; } XWDColor; /* Last comes the image data in the format described by XWDFileHeader. */ #endif /* XWDFILE_H */ nx-libs-3.5.99.23/nx-X11/include/Xwindows.h0000644000000000000000000000415413614532331014725 0ustar /* $Xorg$ */ /* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL- ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * This header file has for sole purpose to allow to include windows.h * without getting any name conflicts with our code. * Conflicts come from the fact that including windows.h actually pulls * in the whole Windows API... */ #undef _XFree86Server #ifdef XFree86Server #define _XFree86Server #undef XFree86Server #endif #define BOOL wBOOL #define INT32 wINT32 #undef Status #define Status wStatus #define ATOM wATOM #define BYTE wBYTE #define FreeResource wFreeResource #include #undef Status #define Status int #undef BYTE #undef BOOL #undef INT32 #undef ATOM #undef FreeResource #undef CreateWindowA #undef min #undef max #ifdef RESOURCE_H #undef RT_FONT #undef RT_CURSOR #define RT_FONT ((RESTYPE)4) #define RT_CURSOR ((RESTYPE)5) #endif #define sleep(x) Sleep(1000*x) #if defined(WIN32) && (!defined(PATH_MAX) || PATH_MAX < 1024) #undef PATH_MAX #define PATH_MAX 1024 #endif #ifdef _XFree86Server #define XFree86Server #undef _XFree86Server #endif nx-libs-3.5.99.23/nx-X11/include/Xwinsock.h0000644000000000000000000000353113614532331014706 0ustar /* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL- ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * This header file has for sole purpose to allow to include winsock.h * without getting any name conflicts with our code. * Conflicts come from the fact that including winsock.h actually pulls * in the whole Windows API... */ #undef _XFree86Server #ifdef XFree86Server #define _XFree86Server #undef XFree86Server #endif #define BOOL wBOOL #define INT32 wINT32 #undef Status #define Status wStatus #define ATOM wATOM #define BYTE wBYTE #define FreeResource wFreeResource #include #undef Status #define Status int #undef BYTE #undef BOOL #undef INT32 #undef ATOM #undef FreeResource #undef CreateWindowA #undef RT_FONT #undef RT_CURSOR #ifdef _XFree86Server #define XFree86Server #undef _XFree86Server #endif nx-libs-3.5.99.23/nx-X11/lib/configure.ac0000644000000000000000000002712213614532331014343 0ustar # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([libNX_X11], [1.6.7], [https://github.com/ArcticaProject/nx-libs/issues], [libNX_X11]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([src/config.h include/X11/XlibConf.h]) AC_CONFIG_MACRO_DIR([m4]) AC_CANONICAL_BUILD AC_CANONICAL_HOST # Set common system defines for POSIX extensions, such as _GNU_SOURCE # Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL) # to avoid autoconf errors. AC_USE_SYSTEM_EXTENSIONS # Initialize Automake AM_INIT_AUTOMAKE([foreign dist-bzip2]) # Initialize libtool AC_PROG_LIBTOOL # Upstream's pkg.m4 (since 0.27) offers this now, but define our own # compatible version in case the local version of pkgconfig isn't new enough. # https://bugs.freedesktop.org/show_bug.cgi?id=48743 m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], [install directory for nx-x11.pc pkg-config file])], [],[with_pkgconfigdir='$(libdir)/pkgconfig']) AC_SUBST([pkgconfigdir], [${with_pkgconfigdir}])]) NX_COMPILER_BRAND NX_DEFAULT_OPTIONS # Required when PKG_CHECK_MODULES called within an if statement PKG_PROG_PKG_CONFIG # Checks for pkg-config packages X11_REQUIRES='nx-xproto nx-xextproto nx-xtrans' X11_EXTRA_DEPS="" AC_SUBST(X11_EXTRA_DEPS) # Silence warning: ar: 'u' modifier ignored since 'D' is the default AC_SUBST(AR_FLAGS, [cr]) # Issue an error if nx-xtrans.m4 was not found and NX_XTRANS_CONNECTION_FLAGS macro # was not expanded, since libNX_X11 with no transport types is rather useless. m4_pattern_forbid([^NX_XTRANS_CONNECTION_FLAGS$]) # Transport selection macro from nx-xtrans.m4 NX_XTRANS_CONNECTION_FLAGS # Check for dlopen AC_MSG_CHECKING([if run-time linking is supported]) AC_SEARCH_LIBS(dlopen,[dl svld]) if test "x$ac_cv_search_dlopen" = xno; then AC_SEARCH_LIBS(shl_load,[dld]) if test "x$ac_cv_search_shl_load" != xno; then AC_DEFINE(HAVE_SHL_LOAD,1, [Use shl_load to load shared libraries]) AC_CHECK_HEADERS([dl.h]) fi else AC_DEFINE(HAVE_DLOPEN,1,[Use dlopen to load shared libraries]) AC_CHECK_HEADERS([dlfcn.h]) fi if test "x$ac_cv_header_dlfcn_h" = xyes -o "x$ac_cv_header_dl_h" = xyes; then HAVE_LOADABLE_MODULES=yes else HAVE_LOADABLE_MODULES=no fi AC_MSG_RESULT($HAVE_LOADABLE_MODULES) AC_MSG_CHECKING([if loadable Xcursor library support should be enabled]) AC_ARG_ENABLE(loadable-xcursor, AS_HELP_STRING([--disable-loadable-xcursor], [Controls loadable xcursor library support]), [XLIB_LOADABLE_XCURSOR=$enableval], [XLIB_LOADABLE_XCURSOR=$HAVE_LOADABLE_MODULES]) if test x$XLIB_LOADABLE_XCURSOR = xyes; then AC_DEFINE(USE_DYNAMIC_XCURSOR,1, [Use the X cursor library to load cursors]) fi AC_MSG_RESULT($XLIB_LOADABLE_XCURSOR) # Checks for header files. AC_CHECK_HEADERS([sys/select.h]) # Checks for typedefs, structures, and compiler characteristics. # Checks for library functions. AC_CHECK_FUNCS([strtol seteuid]) # Used in lcFile.c (see also --enable-xlocaledir settings below) XLOCALEDIR_IS_SAFE="no" AC_CHECK_DECL([issetugid]) AC_CHECK_FUNC([issetugid]) if test "$ac_cv_have_decl_issetugid" = yes && test "$ac_cv_func_issetugid" = yes; then XLOCALEDIR_IS_SAFE="yes" AC_DEFINE(HASSETUGID,1,[Has issetugid() function]) fi AC_CHECK_FUNC([getresuid], [XLOCALEDIR_IS_SAFE="yes"] AC_DEFINE(HASGETRESUID,1,[Has getresuid() & getresgid() functions])) # Used in Font.c AC_CHECK_FUNC([shmat], AC_DEFINE(HAS_SHM,1,[Has shm*() functions])) # Checks for system services # AC_PATH_XTRA # Threading support... AC_ARG_ENABLE(xthreads, AS_HELP_STRING([--disable-xthreads], [Disable Xlib support for Multithreading]), [xthreads=$enableval],[xthreads=yes]) AC_CHECK_LIB(c, getpwuid_r, [mtsafeapi="yes"], [mtsafeapi="no"]) case x$xthreads in xyes) AC_DEFINE(XTHREADS,1,[Whether libNX_X11 is compiled with thread support]) if test x$mtsafeapi = xyes then AC_DEFINE(XUSE_MTSAFE_API,1,[Whether libNX_X11 needs to use MT safe API's]) fi ;; *) ;; esac AC_CHECK_LIB(c, pthread_self, [thrstubs="no"], [thrstubs="yes"]) AM_CONDITIONAL(THRSTUBS, test x$thrstubs = xyes) # XXX incomplete, please fill this in if test x$xthreads = xyes ; then case $host_os in linux*|gnu*|k*bsd*-gnu) XTHREADLIB=-lpthread ;; netbsd*) XTHREAD_CFLAGS="-D_POSIX_THREAD_SAFE_FUNCTIONS" XTHREADLIB="-lpthread" ;; freebsd*) XTHREAD_CFLAGS="-D_THREAD_SAFE" XTHREADLIB="-pthread" ;; dragonfly*|openbsd*) XTHREADLIB="-pthread" ;; solaris*) XTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" ;; esac fi AC_SUBST(XTHREADLIB) AC_SUBST(XTHREAD_CFLAGS) AC_CHECK_FUNC(poll, [has_poll="yes"], [has_poll="no"]) AC_ARG_ENABLE([poll], AS_HELP_STRING([--disable-poll], [Disable poll() usage in XlibInt]), AS_IF([test "x$enable_poll" = "xno"], [want_poll="no"], [want_poll="yes"]), [want_poll="yes"]) if test x"$has_poll" = "xyes" && test x"$want_poll" = "xyes"; then use_poll="yes" AC_DEFINE(USE_POLL,1,[Enable using the poll() function in XlibInt]) else use_poll="no" fi # # Find keysymdef.h # AC_MSG_CHECKING([keysym definitions]) AC_ARG_WITH([keysymdefdir], [AC_HELP_STRING([--with-keysymdefdir=DIR], [The location of keysymdef.h (defaults to xproto include dir)])], [KEYSYMDEFDIR=$withval], [KEYSYMDEFDIR=`pwd`/../include]) if test ! -d "$KEYSYMDEFDIR"; then AC_MSG_ERROR([$KEYSYMDEFDIR doesn't exist or isn't a directory]) fi FILES="keysymdef.h XF86keysym.h Sunkeysym.h DECkeysym.h HPkeysym.h" for i in $FILES; do if test -f "$KEYSYMDEFDIR/$i"; then KEYSYMDEFS="$KEYSYMDEFS $KEYSYMDEFDIR/$i" elif test "x$i" = "xkeysymdef.h"; then AC_MSG_ERROR([Cannot find keysymdef.h]) fi done AC_MSG_RESULT([$KEYSYMDEFS]) AC_SUBST(KEYSYMDEFS) AC_ARG_ENABLE(xcms, AS_HELP_STRING([--disable-xcms], [Disable Xlib support for CMS *EXPERIMENTAL*]), [XCMS=$enableval],[XCMS=yes]) AM_CONDITIONAL(XCMS, [test x$XCMS = xyes ]) if test x"$XCMS" = "xyes"; then AC_DEFINE(XCMS,1,[Include support for XCMS]) fi AC_ARG_ENABLE(xlocale, AS_HELP_STRING([--disable-xlocale], [Disable Xlib locale implementation *EXPERIMENTAL*]), [XLOCALE=$enableval],[XLOCALE=yes]) AM_CONDITIONAL(XLOCALE, [ test x$XLOCALE = xyes ]) if test x"$XLOCALE" = "xyes"; then AC_DEFINE(XLOCALE,1,[support for X Locales]) fi # This disables XLOCALEDIR. Set it if you're using BuildLoadableXlibI18n, # don't have either issetugid() or getresuid(), and you need to protect # clients that are setgid or setuid to an id other than 0. AC_MSG_CHECKING([if XLOCALEDIR support should be enabled]) AC_ARG_ENABLE(xlocaledir, AS_HELP_STRING([--enable-xlocaledir], [Enable XLOCALEDIR environment variable support]), [ENABLE_XLOCALEDIR=$enableval],[ENABLE_XLOCALEDIR=$XLOCALEDIR_IS_SAFE]) if test "x$ENABLE_XLOCALEDIR" = "xno"; then AC_DEFINE(NO_XLOCALEDIR,1,[Disable XLOCALEDIR environment variable]) fi AC_MSG_RESULT($ENABLE_XLOCALEDIR) AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--disable-xf86bigfont], [Disable XF86BigFont extension support]), [XF86BIGFONT=$enableval],[XF86BIGFONT="yes"]) if test "x$XF86BIGFONT" = "xyes"; then # FIXME: Skip check for proto headers for now... Requires .pc files for all the proto # header packages we have. Keeping that in mind for later... # PKG_CHECK_MODULES(BIGFONT, [xf86bigfontproto >= 1.2.0], AC_DEFINE(XF86BIGFONT,1,[Enable XF86BIGFONT extension]) # ,XF86BIGFONT="no") fi AC_ARG_ENABLE(xkb, AS_HELP_STRING([--disable-xkb], [Disable XKB support *EXPERIMENTAL*]), [XKB=$enableval],[XKB=yes]) AM_CONDITIONAL(XKB, [ test x$XKB = xyes ]) if test x"$XKB" = "xyes"; then XKBPROTO_REQUIRES="kbproto" X11_REQUIRES="${X11_REQUIRES} kbproto inputproto" AC_DEFINE(XKB,1,[Use XKB]) else XKBPROTO_REQUIRES="" fi AC_SUBST(XKBPROTO_REQUIRES) AC_FUNC_MMAP() composecache_default=$ac_cv_func_mmap_fixed_mapped AC_CHECK_FUNC(nl_langinfo, , [composecache_default=no]) AC_ARG_ENABLE(composecache, AS_HELP_STRING([--disable-composecache], [Disable compose table cache support]), [COMPOSECACHE=$enableval],[COMPOSECACHE=$composecache_default]) if test x"$COMPOSECACHE" = "xyes"; then AC_DEFINE(COMPOSECACHE,1,[Include compose table cache support]) fi X11_DATADIR="${datadir}/nx/X11" AX_DEFINE_DIR(X11_DATADIR, X11_DATADIR, [Location of libNX_X11 data]) AC_SUBST(X11_DATADIR) X11_LIBDIR="${libdir}" AX_DEFINE_DIR(X11_LIBDIR, X11_LIBDIR, [Location of libNX_X11 library data]) AC_SUBST(X11_LIBDIR) # FIXME: Skip check for proto headers for now... Requires .pc files for all the proto # header packages we have. Keeping that in mind for later... #PKG_CHECK_MODULES(X11, [$X11_REQUIRES]) X11_CFLAGS="$X11_CFLAGS $XTHREAD_CFLAGS $BASE_CFLAGS" # # Yes, it would be nice to put the locale data in # /usr/share, but the locale stuff includes loadable # libraries which must be located in the same directory # as the other locale data, so for now, everything lives # in ${libdir} # AC_ARG_WITH(locale-lib-dir, AS_HELP_STRING([--with-locale-lib-dir=DIR], [Directory where locale libraries files are installed (default: $libdir/X11/locale)]), [ X11_LOCALELIBDIR="$withval" ], [ X11_LOCALELIBDIR="${X11_LIBDIR}/locale" ]) AX_DEFINE_DIR(XLOCALELIBDIR, X11_LOCALELIBDIR, [Location of libNX_X11 locale libraries]) AC_SUBST(X11_LOCALELIBDIR) AC_ARG_WITH(locale-data-dir, AS_HELP_STRING([--with-locale-data-dir=DIR], [Directory where locale data files are installed (default: /usr/share/X11/locale)]), [ X11_LOCALEDATADIR="$withval" ], [ X11_LOCALEDATADIR="/usr/share/X11/locale" ]) AX_DEFINE_DIR(XLOCALEDATADIR, X11_LOCALEDATADIR, [Location of libNX_X11 locale data files]) AC_SUBST(X11_LOCALEDATADIR) X11_LOCALEDIR="${X11_LOCALEDATADIR}" AX_DEFINE_DIR(XLOCALEDIR, X11_LOCALEDIR, [Location of libNX_X11 locale data]) AC_SUBST(X11_LOCALEDIR) XERRORDB="${X11_DATADIR}/XErrorDB" AX_DEFINE_DIR(XERRORDB, XERRORDB, [Location of error message database]) NX_CHECK_MALLOC_ZERO AC_CONFIG_FILES([include/Makefile modules/im/ximcp/Makefile modules/im/Makefile modules/lc/gen/Makefile modules/lc/def/Makefile modules/lc/Utf8/Makefile modules/lc/Makefile modules/om/generic/Makefile modules/om/Makefile modules/Makefile src/util/Makefile src/xcms/Makefile src/xkb/Makefile src/xlibi18n/Makefile src/Makefile Makefile nx-x11.pc]) AC_OUTPUT echo "" echo "NX_X11 will be built with the following settings:" echo " Loadable xcursor library support: "$XLIB_LOADABLE_XCURSOR echo " Threading support: "$xthreads echo " Use Threads safe API: "$mtsafeapi echo " Threads stubs in libNX_X11: "$thrstubs echo " USE_POLL: "$use_poll echo " XCMS: "$XCMS echo " Internationalization support: "$XLOCALE echo " XF86BigFont support: "$XF86BIGFONT echo " XKB support: "$XKB echo " XLOCALEDIR environment variable support: "$ENABLE_XLOCALEDIR echo " Compose table cache enabled: "$COMPOSECACHE echo "" nx-libs-3.5.99.23/nx-X11/lib/.gitignore0000644000000000000000000000017013614532331014037 0ustar aclocal.m4 config.log config.status configure libtool Makefile Makefile.in nx-x11.pc m4/libtool.m4 m4/lt*.m4 build-aux/ nx-libs-3.5.99.23/nx-X11/lib/include/Makefile.am0000644000000000000000000000107213614532331015530 0ustar NULL = x11includedir=${includedir}/nx-X11 x11include_HEADERS= \ X11/XKBlib.h \ X11/Xcms.h \ X11/Xlib.h \ X11/Xlibint.h \ X11/Xlocale.h \ X11/Xresource.h \ X11/Xutil.h \ X11/cursorfont.h \ X11/Xregion.h \ X11/ImUtil.h \ $(NULL) nodist_x11include_HEADERS=\ X11/XlibConf.h xtransincludedir=${includedir}/nx-X11/Xtrans xtransinclude_HEADERS = \ xtrans/Xtransint.h \ xtrans/Xtrans.h \ xtrans/Xtranslcl.c \ xtrans/transport.c \ xtrans/Xtrans.c \ xtrans/Xtranssock.c \ xtrans/Xtransutil.c \ $(NULL) EXTRA_DIST = \ X11/XlibConf.h.in nx-libs-3.5.99.23/nx-X11/lib/include/X11/cursorfont.h0000644000000000000000000000621513614532331016426 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #if !defined(_X11_CURSORFONT_H_) && !defined(_cursorfont_h_) #define _X11_CURSORFONT_H_ #define _cursorfont_h_ #define XC_num_glyphs 154 #define XC_X_cursor 0 #define XC_arrow 2 #define XC_based_arrow_down 4 #define XC_based_arrow_up 6 #define XC_boat 8 #define XC_bogosity 10 #define XC_bottom_left_corner 12 #define XC_bottom_right_corner 14 #define XC_bottom_side 16 #define XC_bottom_tee 18 #define XC_box_spiral 20 #define XC_center_ptr 22 #define XC_circle 24 #define XC_clock 26 #define XC_coffee_mug 28 #define XC_cross 30 #define XC_cross_reverse 32 #define XC_crosshair 34 #define XC_diamond_cross 36 #define XC_dot 38 #define XC_dotbox 40 #define XC_double_arrow 42 #define XC_draft_large 44 #define XC_draft_small 46 #define XC_draped_box 48 #define XC_exchange 50 #define XC_fleur 52 #define XC_gobbler 54 #define XC_gumby 56 #define XC_hand1 58 #define XC_hand2 60 #define XC_heart 62 #define XC_icon 64 #define XC_iron_cross 66 #define XC_left_ptr 68 #define XC_left_side 70 #define XC_left_tee 72 #define XC_leftbutton 74 #define XC_ll_angle 76 #define XC_lr_angle 78 #define XC_man 80 #define XC_middlebutton 82 #define XC_mouse 84 #define XC_pencil 86 #define XC_pirate 88 #define XC_plus 90 #define XC_question_arrow 92 #define XC_right_ptr 94 #define XC_right_side 96 #define XC_right_tee 98 #define XC_rightbutton 100 #define XC_rtl_logo 102 #define XC_sailboat 104 #define XC_sb_down_arrow 106 #define XC_sb_h_double_arrow 108 #define XC_sb_left_arrow 110 #define XC_sb_right_arrow 112 #define XC_sb_up_arrow 114 #define XC_sb_v_double_arrow 116 #define XC_shuttle 118 #define XC_sizing 120 #define XC_spider 122 #define XC_spraycan 124 #define XC_star 126 #define XC_target 128 #define XC_tcross 130 #define XC_top_left_arrow 132 #define XC_top_left_corner 134 #define XC_top_right_corner 136 #define XC_top_side 138 #define XC_top_tee 140 #define XC_trek 142 #define XC_ul_angle 144 #define XC_umbrella 146 #define XC_ur_angle 148 #define XC_watch 150 #define XC_xterm 152 #endif /* !defined(_X11_CURSORFONT_H_) && !defined(_cursorfont_h_) */ nx-libs-3.5.99.23/nx-X11/lib/include/X11/ImUtil.h0000644000000000000000000000104013614532331015414 0ustar #if !defined(_X11_IMUTIL_H_) && !defined(_IM_UTIL_H_) #define _X11_IMUTIL_H_ #define _IMUTIL_H_ extern int _XGetScanlinePad( Display *dpy, int depth); extern int _XGetBitsPerPixel( Display *dpy, int depth); extern int _XSetImage( XImage *srcimg, register XImage *dstimg, register int x, register int y); extern int _XReverse_Bytes( register unsigned char *bpt, register int nb); extern void _XInitImageFuncPtrs( register XImage *image); #endif /* !defined(_X11_IMUTIL_H_) && !defined(_IM_UTIL_H_) */ nx-libs-3.5.99.23/nx-X11/lib/include/X11/Xcms.h0000644000000000000000000005166213614532331015142 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * DESCRIPTION * Public include file for X Color Management System */ #if !defined(_X11_XCMS_H_) && !defined(_XCMS_H_) #define _X11_XCMS_H_ #define _XCMS_H_ #include /* The Xcms structs are full of implicit padding to properly align members. We can't clean that up without breaking ABI, so tell clang not to bother complaining about it. */ #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif /* * XCMS Status Values */ #define XcmsFailure 0 #define XcmsSuccess 1 #define XcmsSuccessWithCompression 2 /* * Color Space Format ID's * Color Space ID's are of XcmsColorFormat type. * * bit 31 * 0 == Device-Independent * 1 == Device-Dependent * * bit 30: * 0 == Registered with X Consortium * 1 == Unregistered */ #define XcmsUndefinedFormat (XcmsColorFormat)0x00000000 #define XcmsCIEXYZFormat (XcmsColorFormat)0x00000001 #define XcmsCIEuvYFormat (XcmsColorFormat)0x00000002 #define XcmsCIExyYFormat (XcmsColorFormat)0x00000003 #define XcmsCIELabFormat (XcmsColorFormat)0x00000004 #define XcmsCIELuvFormat (XcmsColorFormat)0x00000005 #define XcmsTekHVCFormat (XcmsColorFormat)0x00000006 #define XcmsRGBFormat (XcmsColorFormat)0x80000000 #define XcmsRGBiFormat (XcmsColorFormat)0x80000001 /* * State of XcmsPerScrnInfo */ #define XcmsInitNone 0x00 /* no initialization attempted */ #define XcmsInitSuccess 0x01 /* initialization successful */ #define XcmsInitFailure 0xff /* failure, use defaults */ #define DisplayOfCCC(ccc) ((ccc)->dpy) #define ScreenNumberOfCCC(ccc) ((ccc)->screenNumber) #define VisualOfCCC(ccc) ((ccc)->visual) #define ClientWhitePointOfCCC(ccc) (&(ccc)->clientWhitePt) #define ScreenWhitePointOfCCC(ccc) (&(ccc)->pPerScrnInfo->screenWhitePt) #define FunctionSetOfCCC(ccc) ((ccc)->pPerScrnInfo->functionSet) typedef unsigned long XcmsColorFormat; /* Color Space Format ID */ typedef double XcmsFloat; /* * Device RGB */ typedef struct { unsigned short red; /* scaled from 0x0000 to 0xffff */ unsigned short green; /* scaled from 0x0000 to 0xffff */ unsigned short blue; /* scaled from 0x0000 to 0xffff */ } XcmsRGB; /* * RGB Intensity */ typedef struct { XcmsFloat red; /* 0.0 - 1.0 */ XcmsFloat green; /* 0.0 - 1.0 */ XcmsFloat blue; /* 0.0 - 1.0 */ } XcmsRGBi; /* * CIE XYZ */ typedef struct { XcmsFloat X; XcmsFloat Y; XcmsFloat Z; } XcmsCIEXYZ; /* * CIE u'v'Y */ typedef struct { XcmsFloat u_prime; /* 0.0 - 1.0 */ XcmsFloat v_prime; /* 0.0 - 1.0 */ XcmsFloat Y; /* 0.0 - 1.0 */ } XcmsCIEuvY; /* * CIE xyY */ typedef struct { XcmsFloat x; /* 0.0 - 1.0 */ XcmsFloat y; /* 0.0 - 1.0 */ XcmsFloat Y; /* 0.0 - 1.0 */ } XcmsCIExyY; /* * CIE L*a*b* */ typedef struct { XcmsFloat L_star; /* 0.0 - 100.0 */ XcmsFloat a_star; XcmsFloat b_star; } XcmsCIELab; /* * CIE L*u*v* */ typedef struct { XcmsFloat L_star; /* 0.0 - 100.0 */ XcmsFloat u_star; XcmsFloat v_star; } XcmsCIELuv; /* * TekHVC */ typedef struct { XcmsFloat H; /* 0.0 - 360.0 */ XcmsFloat V; /* 0.0 - 100.0 */ XcmsFloat C; /* 0.0 - 100.0 */ } XcmsTekHVC; /* * PAD */ typedef struct { XcmsFloat pad0; XcmsFloat pad1; XcmsFloat pad2; XcmsFloat pad3; } XcmsPad; /* * XCMS Color Structure */ typedef struct { union { XcmsRGB RGB; XcmsRGBi RGBi; XcmsCIEXYZ CIEXYZ; XcmsCIEuvY CIEuvY; XcmsCIExyY CIExyY; XcmsCIELab CIELab; XcmsCIELuv CIELuv; XcmsTekHVC TekHVC; XcmsPad Pad; } spec; /* the color specification */ unsigned long pixel; /* pixel value (as needed) */ XcmsColorFormat format; /* the specification format */ } XcmsColor; /* * XCMS Per Screen related data */ typedef struct _XcmsPerScrnInfo { XcmsColor screenWhitePt; /* Screen White point */ XPointer functionSet; /* pointer to Screen Color Characterization */ /* Function Set structure */ XPointer screenData; /* pointer to corresponding Screen Color*/ /* Characterization Data */ unsigned char state; /* XcmsInitNone, XcmsInitSuccess, XcmsInitFailure */ char pad[3]; } XcmsPerScrnInfo; typedef struct _XcmsCCC *XcmsCCC; typedef Status (*XcmsCompressionProc)( /* Gamut Compression Proc */ XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); typedef Status (*XcmsWhiteAdjustProc)( /* White Point Adjust Proc */ XcmsCCC /* ccc */, XcmsColor* /* initial_white_point*/, XcmsColor* /* target_white_point*/, XcmsColorFormat /* target_format */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); /* * XCMS Color Conversion Context */ typedef struct _XcmsCCC { Display *dpy; /* X Display */ int screenNumber; /* X screen number */ Visual *visual; /* X Visual */ XcmsColor clientWhitePt; /* Client White Point */ XcmsCompressionProc gamutCompProc; /* Gamut Compression Function */ XPointer gamutCompClientData; /* Gamut Comp Func Client Data */ XcmsWhiteAdjustProc whitePtAdjProc; /* White Point Adjustment Function */ XPointer whitePtAdjClientData; /* White Pt Adj Func Client Data */ XcmsPerScrnInfo *pPerScrnInfo; /* pointer to per screen information */ /* associated with the above display */ /* screenNumber */ } XcmsCCCRec; typedef Status (*XcmsScreenInitProc)( /* Screen Initialization Proc */ Display* /* dpy */, int /* screen_number */, XcmsPerScrnInfo* /* screen_info */ ); typedef void (*XcmsScreenFreeProc)( XPointer /* screenData */ ); /* * Function List Pointer -- pointer to an array of function pointers. * The end of list is indicated by a NULL pointer. */ /* * XXX: The use of the XcmsConversionProc type is broken. The * device-independent colour conversion code uses it as: typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, XcmsColor *, unsigned int); * while the device-dependent code uses it as: typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, unsigned int, Bool *); * Until this is reworked, it's probably best to leave it unprotoized. * The code works regardless. */ typedef Status (*XcmsDDConversionProc)( /* using device-dependent version */ XcmsCCC /* ccc */, XcmsColor* /* pcolors_in_out */, unsigned int /* ncolors */, Bool* /* pCompressed */ ); typedef Status (*XcmsDIConversionProc)( /* using device-independent version */ XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* pcolors_in_out */, unsigned int /* ncolors */ ); typedef XcmsDIConversionProc XcmsConversionProc; typedef XcmsConversionProc *XcmsFuncListPtr; typedef int (*XcmsParseStringProc)( /* Color String Parsing Proc */ char* /* color_string */, XcmsColor* /* color_return */ ); /* * Color Space -- per Color Space related data (Device-Independent * or Device-Dependent) */ typedef struct _XcmsColorSpace { const char *prefix; /* Prefix of string format. */ XcmsColorFormat id; /* Format ID number. */ XcmsParseStringProc parseString; /* String format parsing function */ XcmsFuncListPtr to_CIEXYZ; /* Pointer to an array of function */ /* pointers such that when the */ /* functions are executed in sequence */ /* will convert a XcmsColor structure */ /* from this color space to CIEXYZ */ /* space. */ XcmsFuncListPtr from_CIEXYZ;/* Pointer to an array of function */ /* pointers such that when the */ /* functions are executed in sequence */ /* will convert a XcmsColor structure */ /* from CIEXYZ space to this color */ /* space. */ int inverse_flag; /* If 1, indicates that for 0 <= i < n */ /* where n is the number of function */ /* pointers in the lists to_CIEXYZ */ /* and from_CIEXYZ; for each function */ /* to_CIEXYZ[i] its inverse function */ /* is from_CIEXYZ[n - i]. */ } XcmsColorSpace; /* * Screen Color Characterization Function Set -- per device class * color space conversion functions. */ typedef struct _XcmsFunctionSet { XcmsColorSpace **DDColorSpaces; /* Pointer to an array of pointers to */ /* Device-DEPENDENT color spaces */ /* understood by this SCCFuncSet. */ XcmsScreenInitProc screenInitProc; /* Screen initialization function that */ /* reads Screen Color Characterization*/ /* Data off properties on the screen's*/ /* root window. */ XcmsScreenFreeProc screenFreeProc; /* Function that frees the SCCData */ /* structures. */ } XcmsFunctionSet; _XFUNCPROTOBEGIN extern Status XcmsAddColorSpace ( XcmsColorSpace* /* pColorSpace */ ); extern Status XcmsAddFunctionSet ( XcmsFunctionSet* /* functionSet */ ); extern Status XcmsAllocColor ( Display* /* dpy */, Colormap /* colormap */, XcmsColor* /* color_in_out */, XcmsColorFormat /* result_format */ ); extern Status XcmsAllocNamedColor ( Display* /* dpy */, Colormap /* colormap */, _Xconst char* /* color_string */, XcmsColor* /* color_scrn_return */, XcmsColor* /* color_exact_return */, XcmsColorFormat /* result_format */ ); extern XcmsCCC XcmsCCCOfColormap ( Display* /* dpy */, Colormap /* colormap */ ); extern Status XcmsCIELabClipab( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsCIELabClipL( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsCIELabClipLab( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsCIELabQueryMaxC ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsFloat /* L_star */, XcmsColor* /* color_return */ ); extern Status XcmsCIELabQueryMaxL ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsFloat /* chroma */, XcmsColor* /* color_return */ ); extern Status XcmsCIELabQueryMaxLC ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsColor* /* color_return */ ); extern Status XcmsCIELabQueryMinL ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsFloat /* chroma */, XcmsColor* /* color_return */ ); extern Status XcmsCIELabToCIEXYZ ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIELabWhiteShiftColors( XcmsCCC /* ccc */, XcmsColor* /* initial_white_point*/, XcmsColor* /* target_white_point*/, XcmsColorFormat /* target_format */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); extern Status XcmsCIELuvClipL( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsCIELuvClipLuv( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsCIELuvClipuv( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsCIELuvQueryMaxC ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsFloat /* L_star */, XcmsColor* /* color_return */ ); extern Status XcmsCIELuvQueryMaxL ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsFloat /* chroma */, XcmsColor* /* color_return */ ); extern Status XcmsCIELuvQueryMaxLC ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsColor* /* color_return */ ); extern Status XcmsCIELuvQueryMinL ( XcmsCCC /* ccc */, XcmsFloat /* hue_angle */, XcmsFloat /* chroma */, XcmsColor* /* color_return */ ); extern Status XcmsCIELuvToCIEuvY ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIELuvWhiteShiftColors( XcmsCCC /* ccc */, XcmsColor* /* initial_white_point*/, XcmsColor* /* target_white_point*/, XcmsColorFormat /* target_format */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); extern Status XcmsCIEXYZToCIELab ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIEXYZToCIEuvY ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIEXYZToCIExyY ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIEXYZToRGBi ( XcmsCCC /* ccc */, XcmsColor* /* colors */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); extern Status XcmsCIEuvYToCIELuv ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIEuvYToCIEXYZ ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIEuvYToTekHVC ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsCIExyYToCIEXYZ ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern XcmsColor *XcmsClientWhitePointOfCCC ( XcmsCCC /* ccc */ ); extern Status XcmsConvertColors ( XcmsCCC /* ccc */, XcmsColor* /* colorArry_in_out */, unsigned int /* nColors */, XcmsColorFormat /* targetFormat */, Bool* /* compArry_return */ ); extern XcmsCCC XcmsCreateCCC ( Display* /* dpy */, int /* screenNumber */, Visual* /* visual */, XcmsColor* /* clientWhitePt */, XcmsCompressionProc /* gamutCompProc */, XPointer /* gamutCompClientData */, XcmsWhiteAdjustProc /* whitePtAdjProc */, XPointer /* whitePtAdjClientData */ ); extern XcmsCCC XcmsDefaultCCC ( Display* /* dpy */, int /* screenNumber */ ); extern Display *XcmsDisplayOfCCC ( XcmsCCC /* ccc */ ); extern XcmsColorFormat XcmsFormatOfPrefix ( char* /* prefix */ ); extern void XcmsFreeCCC ( XcmsCCC /* ccc */ ); extern Status XcmsLookupColor ( Display* /* dpy */, Colormap /* colormap */, _Xconst char* /* color_string */, XcmsColor* /* pColor_exact_in_out */, XcmsColor* /* pColor_scrn_in_out */, XcmsColorFormat /* result_format */ ); extern char *XcmsPrefixOfFormat ( XcmsColorFormat /* id */ ); extern Status XcmsQueryBlack ( XcmsCCC /* ccc */, XcmsColorFormat /* target_format */, XcmsColor* /* color_return */ ); extern Status XcmsQueryBlue ( XcmsCCC /* ccc */, XcmsColorFormat /* target_format */, XcmsColor* /* color_return */ ); extern Status XcmsQueryColor ( Display* /* dpy */, Colormap /* colormap */, XcmsColor* /* pColor_in_out */, XcmsColorFormat /* result_format */ ); extern Status XcmsQueryColors ( Display* /* dpy */, Colormap /* colormap */, XcmsColor* /* colorArry_in_out */, unsigned int /* nColors */, XcmsColorFormat /* result_format */ ); extern Status XcmsQueryGreen ( XcmsCCC /* ccc */, XcmsColorFormat /* target_format */, XcmsColor* /* color_return */ ); extern Status XcmsQueryRed ( XcmsCCC /* ccc */, XcmsColorFormat /* target_format */, XcmsColor* /* color_return */ ); extern Status XcmsQueryWhite ( XcmsCCC /* ccc */, XcmsColorFormat /* target_format */, XcmsColor* /* color_return */ ); extern Status XcmsRGBiToCIEXYZ ( XcmsCCC /* ccc */, XcmsColor* /* colors */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); extern Status XcmsRGBiToRGB ( XcmsCCC /* ccc */, XcmsColor* /* colors */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); extern Status XcmsRGBToRGBi ( XcmsCCC /* ccc */, XcmsColor* /* colors */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); extern int XcmsScreenNumberOfCCC ( XcmsCCC /* ccc */ ); extern XcmsColor *XcmsScreenWhitePointOfCCC ( XcmsCCC /* ccc */ ); extern XcmsCCC XcmsSetCCCOfColormap( Display* /* dpy */, Colormap /* colormap */, XcmsCCC /* ccc */ ); extern XcmsCompressionProc XcmsSetCompressionProc ( XcmsCCC /* ccc */, XcmsCompressionProc /* compression_proc */, XPointer /* client_data */ ); extern XcmsWhiteAdjustProc XcmsSetWhiteAdjustProc ( XcmsCCC /* ccc */, XcmsWhiteAdjustProc /* white_adjust_proc */, XPointer /* client_data */ ); extern Status XcmsSetWhitePoint ( XcmsCCC /* ccc */, XcmsColor* /* color */ ); extern Status XcmsStoreColor ( Display* /* dpy */, Colormap /* colormap */, XcmsColor* /* pColor_in */ ); extern Status XcmsStoreColors ( Display* /* dpy */, Colormap /* colormap */, XcmsColor* /* colorArry_in */, unsigned int /* nColors */, Bool* /* compArry_return */ ); extern Status XcmsTekHVCClipC( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsTekHVCClipV( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsTekHVCClipVC( XcmsCCC /* ccc */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, unsigned int /* index */, Bool* /* compression_flags_return */ ); extern Status XcmsTekHVCQueryMaxC ( XcmsCCC /* ccc */, XcmsFloat /* hue */, XcmsFloat /* value */, XcmsColor* /* color_return */ ); extern Status XcmsTekHVCQueryMaxV ( XcmsCCC /* ccc */, XcmsFloat /* hue */, XcmsFloat /* chroma */, XcmsColor* /* color_return */ ); extern Status XcmsTekHVCQueryMaxVC ( XcmsCCC /* ccc */, XcmsFloat /* hue */, XcmsColor* /* color_return */ ); extern Status XcmsTekHVCQueryMaxVSamples ( XcmsCCC /* ccc */, XcmsFloat /* hue */, XcmsColor* /* colors_return */, unsigned int /* nsamples */ ); extern Status XcmsTekHVCQueryMinV ( XcmsCCC /* ccc */, XcmsFloat /* hue */, XcmsFloat /* chroma */, XcmsColor* /* color_return */ ); extern Status XcmsTekHVCToCIEuvY ( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); extern Status XcmsTekHVCWhiteShiftColors( XcmsCCC /* ccc */, XcmsColor* /* initial_white_point*/, XcmsColor* /* target_white_point*/, XcmsColorFormat /* target_format */, XcmsColor* /* colors_in_out */, unsigned int /* ncolors */, Bool* /* compression_flags_return */ ); extern Visual *XcmsVisualOfCCC ( XcmsCCC /* ccc */ ); #ifdef __clang__ #pragma clang diagnostic pop #endif _XFUNCPROTOEND #endif /* !defined(_X11_XCMS_H_) && !defined(_XCMS_H_) */ nx-libs-3.5.99.23/nx-X11/lib/include/X11/XKBlib.h0000644000000000000000000007455413614532331015350 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #if !defined(_X11_XKBLIB_H_) && !defined(_XKBLIB_H_) #define _X11_XKBLIB_H_ #define _XKBLIB_H_ #include #include typedef struct _XkbAnyEvent { int type; /* XkbAnyEvent */ unsigned long serial; /* # of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XKB event minor code */ unsigned int device; /* device ID */ } XkbAnyEvent; typedef struct _XkbNewKeyboardNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbNewKeyboardNotify */ int device; /* device ID */ int old_device; /* device ID of previous keyboard */ int min_key_code; /* minimum key code */ int max_key_code; /* maximum key code */ int old_min_key_code;/* min key code of previous kbd */ int old_max_key_code;/* max key code of previous kbd */ unsigned int changed; /* changed aspects of the keyboard */ char req_major; /* major and minor opcode of req */ char req_minor; /* that caused change, if applicable */ } XkbNewKeyboardNotifyEvent; typedef struct _XkbMapNotifyEvent { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbMapNotify */ int device; /* device ID */ unsigned int changed; /* fields which have been changed */ unsigned int flags; /* reserved */ int first_type; /* first changed key type */ int num_types; /* number of changed key types */ KeyCode min_key_code; KeyCode max_key_code; KeyCode first_key_sym; KeyCode first_key_act; KeyCode first_key_behavior; KeyCode first_key_explicit; KeyCode first_modmap_key; KeyCode first_vmodmap_key; int num_key_syms; int num_key_acts; int num_key_behaviors; int num_key_explicit; int num_modmap_keys; int num_vmodmap_keys; unsigned int vmods; /* mask of changed virtual mods */ } XkbMapNotifyEvent; typedef struct _XkbStateNotifyEvent { int type; /* XkbAnyEvent */ unsigned long serial; /* # of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbStateNotify */ int device; /* device ID */ unsigned int changed; /* mask of changed state components */ int group; /* keyboard group */ int base_group; /* base keyboard group */ int latched_group; /* latched keyboard group */ int locked_group; /* locked keyboard group */ unsigned int mods; /* modifier state */ unsigned int base_mods; /* base modifier state */ unsigned int latched_mods; /* latched modifiers */ unsigned int locked_mods; /* locked modifiers */ int compat_state; /* compatibility state */ unsigned char grab_mods; /* mods used for grabs */ unsigned char compat_grab_mods;/* grab mods for non-XKB clients */ unsigned char lookup_mods; /* mods sent to clients */ unsigned char compat_lookup_mods; /* mods sent to non-XKB clients */ int ptr_buttons; /* pointer button state */ KeyCode keycode; /* keycode that caused the change */ char event_type; /* KeyPress or KeyRelease */ char req_major; /* Major opcode of request */ char req_minor; /* Minor opcode of request */ } XkbStateNotifyEvent; typedef struct _XkbControlsNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbControlsNotify */ int device; /* device ID */ unsigned int changed_ctrls; /* controls with changed sub-values */ unsigned int enabled_ctrls; /* controls currently enabled */ unsigned int enabled_ctrl_changes;/* controls just {en,dis}abled */ int num_groups; /* total groups on keyboard */ KeyCode keycode; /* key that caused change or 0 */ char event_type; /* type of event that caused change */ char req_major; /* if keycode==0, major and minor */ char req_minor; /* opcode of req that caused change */ } XkbControlsNotifyEvent; typedef struct _XkbIndicatorNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbIndicatorNotify */ int device; /* device ID */ unsigned int changed; /* indicators with new state or map */ unsigned int state; /* current state of all indicators */ } XkbIndicatorNotifyEvent; typedef struct _XkbNamesNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbNamesNotify */ int device; /* device ID */ unsigned int changed; /* names that have changed */ int first_type; /* first key type with new name */ int num_types; /* number of key types with new names */ int first_lvl; /* first key type new new level names */ int num_lvls; /* # of key types w/new level names */ int num_aliases; /* total number of key aliases*/ int num_radio_groups;/* total number of radio groups */ unsigned int changed_vmods; /* virtual modifiers with new names */ unsigned int changed_groups; /* groups with new names */ unsigned int changed_indicators;/* indicators with new names */ int first_key; /* first key with new name */ int num_keys; /* number of keys with new names */ } XkbNamesNotifyEvent; typedef struct _XkbCompatMapNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbCompatMapNotify */ int device; /* device ID */ unsigned int changed_groups; /* groups with new compat maps */ int first_si; /* first new symbol interp */ int num_si; /* number of new symbol interps */ int num_total_si; /* total # of symbol interps */ } XkbCompatMapNotifyEvent; typedef struct _XkbBellNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbBellNotify */ int device; /* device ID */ int percent; /* requested volume as a % of maximum */ int pitch; /* requested pitch in Hz */ int duration; /* requested duration in useconds */ int bell_class; /* (input extension) feedback class */ int bell_id; /* (input extension) ID of feedback */ Atom name; /* "name" of requested bell */ Window window; /* window associated with event */ Bool event_only; /* "event only" requested */ } XkbBellNotifyEvent; typedef struct _XkbActionMessage { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbActionMessage */ int device; /* device ID */ KeyCode keycode; /* key that generated the event */ Bool press; /* true if act caused by key press */ Bool key_event_follows;/* true if key event also generated */ int group; /* effective group */ unsigned int mods; /* effective mods */ char message[XkbActionMessageLength+1]; /* message -- leave space for NUL */ } XkbActionMessageEvent; typedef struct _XkbAccessXNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbAccessXNotify */ int device; /* device ID */ int detail; /* XkbAXN_* */ int keycode; /* key of event */ int sk_delay; /* current slow keys delay */ int debounce_delay; /* current debounce delay */ } XkbAccessXNotifyEvent; typedef struct _XkbExtensionDeviceNotify { int type; /* XkbAnyEvent */ unsigned long serial; /* of last req processed by server */ Bool send_event; /* is this from a SendEvent request? */ Display * display; /* Display the event was read from */ Time time; /* milliseconds */ int xkb_type; /* XkbExtensionDeviceNotify */ int device; /* device ID */ unsigned int reason; /* reason for the event */ unsigned int supported; /* mask of supported features */ unsigned int unsupported; /* mask of unsupported features */ /* that some app tried to use */ int first_btn; /* first button that changed */ int num_btns; /* range of buttons changed */ unsigned int leds_defined; /* indicators with names or maps */ unsigned int led_state; /* current state of the indicators */ int led_class; /* feedback class for led changes */ int led_id; /* feedback id for led changes */ } XkbExtensionDeviceNotifyEvent; typedef union _XkbEvent { int type; XkbAnyEvent any; XkbNewKeyboardNotifyEvent new_kbd; XkbMapNotifyEvent map; XkbStateNotifyEvent state; XkbControlsNotifyEvent ctrls; XkbIndicatorNotifyEvent indicators; XkbNamesNotifyEvent names; XkbCompatMapNotifyEvent compat; XkbBellNotifyEvent bell; XkbActionMessageEvent message; XkbAccessXNotifyEvent accessx; XkbExtensionDeviceNotifyEvent device; XEvent core; } XkbEvent; typedef struct _XkbKbdDpyState XkbKbdDpyStateRec,*XkbKbdDpyStatePtr; /* XkbOpenDisplay error codes */ #define XkbOD_Success 0 #define XkbOD_BadLibraryVersion 1 #define XkbOD_ConnectionRefused 2 #define XkbOD_NonXkbServer 3 #define XkbOD_BadServerVersion 4 /* Values for XlibFlags */ #define XkbLC_ForceLatin1Lookup (1<<0) #define XkbLC_ConsumeLookupMods (1<<1) #define XkbLC_AlwaysConsumeShiftAndLock (1<<2) #define XkbLC_IgnoreNewKeyboards (1<<3) #define XkbLC_ControlFallback (1<<4) #define XkbLC_ConsumeKeysOnComposeFail (1<<29) #define XkbLC_ComposeLED (1<<30) #define XkbLC_BeepOnComposeFail (1<<31) #define XkbLC_AllComposeControls (0xc0000000) #define XkbLC_AllControls (0xc000001f) _XFUNCPROTOBEGIN extern Bool XkbIgnoreExtension( Bool /* ignore */ ); extern Display *XkbOpenDisplay( char * /* name */, int * /* ev_rtrn */, int * /* err_rtrn */, int * /* major_rtrn */, int * /* minor_rtrn */, int * /* reason */ ); extern Bool XkbQueryExtension( Display * /* dpy */, int * /* opcodeReturn */, int * /* eventBaseReturn */, int * /* errorBaseReturn */, int * /* majorRtrn */, int * /* minorRtrn */ ); extern Bool XkbUseExtension( Display * /* dpy */, int * /* major_rtrn */, int * /* minor_rtrn */ ); extern Bool XkbLibraryVersion( int * /* libMajorRtrn */, int * /* libMinorRtrn */ ); extern unsigned int XkbSetXlibControls( Display* /* dpy */, unsigned int /* affect */, unsigned int /* values */ ); extern unsigned int XkbGetXlibControls( Display* /* dpy */ ); extern unsigned int XkbXlibControlsImplemented(void); typedef Atom (*XkbInternAtomFunc)( Display * /* dpy */, _Xconst char * /* name */, Bool /* only_if_exists */ ); typedef char * (*XkbGetAtomNameFunc)( Display * /* dpy */, Atom /* atom */ ); extern void XkbSetAtomFuncs( XkbInternAtomFunc /* getAtom */, XkbGetAtomNameFunc /* getName */ ); extern KeySym XkbKeycodeToKeysym( Display * /* dpy */, #if NeedWidePrototypes unsigned int /* kc */, #else KeyCode /* kc */, #endif int /* group */, int /* level */ ); extern unsigned int XkbKeysymToModifiers( Display * /* dpy */, KeySym /* ks */ ); extern Bool XkbLookupKeySym( Display * /* dpy */, KeyCode /* keycode */, unsigned int /* modifiers */, unsigned int * /* modifiers_return */, KeySym * /* keysym_return */ ); extern int XkbLookupKeyBinding( Display * /* dpy */, KeySym /* sym_rtrn */, unsigned int /* mods */, char * /* buffer */, int /* nbytes */, int * /* extra_rtrn */ ); extern Bool XkbTranslateKeyCode( XkbDescPtr /* xkb */, KeyCode /* keycode */, unsigned int /* modifiers */, unsigned int * /* modifiers_return */, KeySym * /* keysym_return */ ); extern int XkbTranslateKeySym( Display * /* dpy */, register KeySym * /* sym_return */, unsigned int /* modifiers */, char * /* buffer */, int /* nbytes */, int * /* extra_rtrn */ ); extern Bool XkbSetAutoRepeatRate( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* delay */, unsigned int /* interval */ ); extern Bool XkbGetAutoRepeatRate( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int * /* delayRtrn */, unsigned int * /* intervalRtrn */ ); extern Bool XkbChangeEnabledControls( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* affect */, unsigned int /* values */ ); extern Bool XkbDeviceBell( Display * /* dpy */, Window /* win */, int /* deviceSpec */, int /* bellClass */, int /* bellID */, int /* percent */, Atom /* name */ ); extern Bool XkbForceDeviceBell( Display * /* dpy */, int /* deviceSpec */, int /* bellClass */, int /* bellID */, int /* percent */ ); extern Bool XkbDeviceBellEvent( Display * /* dpy */, Window /* win */, int /* deviceSpec */, int /* bellClass */, int /* bellID */, int /* percent */, Atom /* name */ ); extern Bool XkbBell( Display * /* dpy */, Window /* win */, int /* percent */, Atom /* name */ ); extern Bool XkbForceBell( Display * /* dpy */, int /* percent */ ); extern Bool XkbBellEvent( Display * /* dpy */, Window /* win */, int /* percent */, Atom /* name */ ); extern Bool XkbSelectEvents( Display * /* dpy */, unsigned int /* deviceID */, unsigned int /* affect */, unsigned int /* values */ ); extern Bool XkbSelectEventDetails( Display * /* dpy */, unsigned int /* deviceID */, unsigned int /* eventType */, unsigned long /* affect */, unsigned long /* details */ ); extern void XkbNoteMapChanges( XkbMapChangesPtr /* old */, XkbMapNotifyEvent * /* new */, unsigned int /* wanted */ ); extern void XkbNoteNameChanges( XkbNameChangesPtr /* old */, XkbNamesNotifyEvent * /* new */, unsigned int /* wanted */ ); extern Status XkbGetIndicatorState( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int * /* pStateRtrn */ ); extern Status XkbGetDeviceIndicatorState( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* ledClass */, unsigned int /* ledID */, unsigned int * /* pStateRtrn */ ); extern Status XkbGetIndicatorMap( Display * /* dpy */, unsigned long /* which */, XkbDescPtr /* desc */ ); extern Bool XkbSetIndicatorMap( Display * /* dpy */, unsigned long /* which */, XkbDescPtr /* desc */ ); #define XkbNoteIndicatorMapChanges(o,n,w) \ ((o)->map_changes|=((n)->map_changes&(w))) #define XkbNoteIndicatorStateChanges(o,n,w)\ ((o)->state_changes|=((n)->state_changes&(w))) #define XkbGetIndicatorMapChanges(d,x,c) \ (XkbGetIndicatorMap((d),(c)->map_changes,x)) #define XkbChangeIndicatorMaps(d,x,c) \ (XkbSetIndicatorMap((d),(c)->map_changes,x)) extern Bool XkbGetNamedIndicator( Display * /* dpy */, Atom /* name */, int * /* pNdxRtrn */, Bool * /* pStateRtrn */, XkbIndicatorMapPtr /* pMapRtrn */, Bool * /* pRealRtrn */ ); extern Bool XkbGetNamedDeviceIndicator( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* ledClass */, unsigned int /* ledID */, Atom /* name */, int * /* pNdxRtrn */, Bool * /* pStateRtrn */, XkbIndicatorMapPtr /* pMapRtrn */, Bool * /* pRealRtrn */ ); extern Bool XkbSetNamedIndicator( Display * /* dpy */, Atom /* name */, Bool /* changeState */, Bool /* state */, Bool /* createNewMap */, XkbIndicatorMapPtr /* pMap */ ); extern Bool XkbSetNamedDeviceIndicator( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* ledClass */, unsigned int /* ledID */, Atom /* name */, Bool /* changeState */, Bool /* state */, Bool /* createNewMap */, XkbIndicatorMapPtr /* pMap */ ); extern Bool XkbLockModifiers( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* affect */, unsigned int /* values */ ); extern Bool XkbLatchModifiers( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* affect */, unsigned int /* values */ ); extern Bool XkbLockGroup( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* group */ ); extern Bool XkbLatchGroup( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* group */ ); extern Bool XkbSetServerInternalMods( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* affectReal */, unsigned int /* realValues */, unsigned int /* affectVirtual */, unsigned int /* virtualValues */ ); extern Bool XkbSetIgnoreLockMods( Display * /* dpy */, unsigned int /* deviceSpec */, unsigned int /* affectReal */, unsigned int /* realValues */, unsigned int /* affectVirtual */, unsigned int /* virtualValues */ ); extern Bool XkbVirtualModsToReal( XkbDescPtr /* xkb */, unsigned int /* virtual_mask */, unsigned int * /* mask_rtrn */ ); extern Bool XkbComputeEffectiveMap( XkbDescPtr /* xkb */, XkbKeyTypePtr /* type */, unsigned char * /* map_rtrn */ ); extern Status XkbInitCanonicalKeyTypes( XkbDescPtr /* xkb */, unsigned int /* which */, int /* keypadVMod */ ); extern XkbDescPtr XkbAllocKeyboard( void ); extern void XkbFreeKeyboard( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeDesc */ ); extern Status XkbAllocClientMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nTypes */ ); extern Status XkbAllocServerMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nActions */ ); extern void XkbFreeClientMap( XkbDescPtr /* xkb */, unsigned int /* what */, Bool /* freeMap */ ); extern void XkbFreeServerMap( XkbDescPtr /* xkb */, unsigned int /* what */, Bool /* freeMap */ ); extern XkbKeyTypePtr XkbAddKeyType( XkbDescPtr /* xkb */, Atom /* name */, int /* map_count */, Bool /* want_preserve */, int /* num_lvls */ ); extern Status XkbAllocIndicatorMaps( XkbDescPtr /* xkb */ ); extern void XkbFreeIndicatorMaps( XkbDescPtr /* xkb */ ); extern XkbDescPtr XkbGetMap( Display * /* dpy */, unsigned int /* which */, unsigned int /* deviceSpec */ ); extern Status XkbGetUpdatedMap( Display * /* dpy */, unsigned int /* which */, XkbDescPtr /* desc */ ); extern Status XkbGetMapChanges( Display * /* dpy */, XkbDescPtr /* xkb */, XkbMapChangesPtr /* changes */ ); extern Status XkbRefreshKeyboardMapping( XkbMapNotifyEvent * /* event */ ); extern Status XkbGetKeyTypes( Display * /* dpy */, unsigned int /* first */, unsigned int /* num */, XkbDescPtr /* xkb */ ); extern Status XkbGetKeySyms( Display * /* dpy */, unsigned int /* first */, unsigned int /* num */, XkbDescPtr /* xkb */ ); extern Status XkbGetKeyActions( Display * /* dpy */, unsigned int /* first */, unsigned int /* num */, XkbDescPtr /* xkb */ ); extern Status XkbGetKeyBehaviors( Display * /* dpy */, unsigned int /* firstKey */, unsigned int /* nKeys */, XkbDescPtr /* desc */ ); extern Status XkbGetVirtualMods( Display * /* dpy */, unsigned int /* which */, XkbDescPtr /* desc */ ); extern Status XkbGetKeyExplicitComponents( Display * /* dpy */, unsigned int /* firstKey */, unsigned int /* nKeys */, XkbDescPtr /* desc */ ); extern Status XkbGetKeyModifierMap( Display * /* dpy */, unsigned int /* firstKey */, unsigned int /* nKeys */, XkbDescPtr /* desc */ ); extern Status XkbGetKeyVirtualModMap( Display * /* dpy */, unsigned int /* first */, unsigned int /* num */, XkbDescPtr /* xkb */ ); extern Status XkbAllocControls( XkbDescPtr /* xkb */, unsigned int /* which*/ ); extern void XkbFreeControls( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ ); extern Status XkbGetControls( Display * /* dpy */, unsigned long /* which */, XkbDescPtr /* desc */ ); extern Bool XkbSetControls( Display * /* dpy */, unsigned long /* which */, XkbDescPtr /* desc */ ); extern void XkbNoteControlsChanges( XkbControlsChangesPtr /* old */, XkbControlsNotifyEvent * /* new */, unsigned int /* wanted */ ); #define XkbGetControlsChanges(d,x,c) XkbGetControls(d,(c)->changed_ctrls,x) #define XkbChangeControls(d,x,c) XkbSetControls(d,(c)->changed_ctrls,x) extern Status XkbAllocCompatMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nInterpret */ ); extern void XkbFreeCompatMap( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ ); extern Status XkbGetCompatMap( Display * /* dpy */, unsigned int /* which */, XkbDescPtr /* xkb */ ); extern Bool XkbSetCompatMap( Display * /* dpy */, unsigned int /* which */, XkbDescPtr /* xkb */, Bool /* updateActions */ ); extern XkbSymInterpretPtr XkbAddSymInterpret( XkbDescPtr /* xkb */, XkbSymInterpretPtr /* si */, Bool /* updateMap */, XkbChangesPtr /* changes */ ); extern Status XkbAllocNames( XkbDescPtr /* xkb */, unsigned int /* which */, int /* nTotalRG */, int /* nTotalAliases */ ); extern Status XkbGetNames( Display * /* dpy */, unsigned int /* which */, XkbDescPtr /* desc */ ); extern Bool XkbSetNames( Display * /* dpy */, unsigned int /* which */, unsigned int /* firstType */, unsigned int /* nTypes */, XkbDescPtr /* desc */ ); extern Bool XkbChangeNames( Display * /* dpy */, XkbDescPtr /* xkb */, XkbNameChangesPtr /* changes */ ); extern void XkbFreeNames( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ ); extern Status XkbGetState( Display * /* dpy */, unsigned int /* deviceSpec */, XkbStatePtr /* rtrnState */ ); extern Bool XkbSetMap( Display * /* dpy */, unsigned int /* which */, XkbDescPtr /* desc */ ); extern Bool XkbChangeMap( Display* /* dpy */, XkbDescPtr /* desc */, XkbMapChangesPtr /* changes */ ); extern Bool XkbSetDetectableAutoRepeat( Display * /* dpy */, Bool /* detectable */, Bool * /* supported */ ); extern Bool XkbGetDetectableAutoRepeat( Display * /* dpy */, Bool * /* supported */ ); extern Bool XkbSetAutoResetControls( Display * /* dpy */, unsigned int /* changes */, unsigned int * /* auto_ctrls */, unsigned int * /* auto_values */ ); extern Bool XkbGetAutoResetControls( Display * /* dpy */, unsigned int * /* auto_ctrls */, unsigned int * /* auto_ctrl_values */ ); extern Bool XkbSetPerClientControls( Display * /* dpy */, unsigned int /* change */, unsigned int * /* values */ ); extern Bool XkbGetPerClientControls( Display * /* dpy */, unsigned int * /* ctrls */ ); extern Status XkbCopyKeyType( XkbKeyTypePtr /* from */, XkbKeyTypePtr /* into */ ); extern Status XkbCopyKeyTypes( XkbKeyTypePtr /* from */, XkbKeyTypePtr /* into */, int /* num_types */ ); extern Status XkbResizeKeyType( XkbDescPtr /* xkb */, int /* type_ndx */, int /* map_count */, Bool /* want_preserve */, int /* new_num_lvls */ ); extern KeySym *XkbResizeKeySyms( XkbDescPtr /* desc */, int /* forKey */, int /* symsNeeded */ ); extern XkbAction *XkbResizeKeyActions( XkbDescPtr /* desc */, int /* forKey */, int /* actsNeeded */ ); extern Status XkbChangeTypesOfKey( XkbDescPtr /* xkb */, int /* key */, int /* num_groups */, unsigned int /* groups */, int * /* newTypes */, XkbMapChangesPtr /* pChanges */ ); extern Status XkbChangeKeycodeRange( XkbDescPtr /* xkb */, int /* minKC */, int /* maxKC */, XkbChangesPtr /* changes */ ); /***====================================================================***/ extern XkbComponentListPtr XkbListComponents( Display * /* dpy */, unsigned int /* deviceSpec */, XkbComponentNamesPtr /* ptrns */, int * /* max_inout */ ); extern void XkbFreeComponentList( XkbComponentListPtr /* list */ ); extern XkbDescPtr XkbGetKeyboard( Display * /* dpy */, unsigned int /* which */, unsigned int /* deviceSpec */ ); extern XkbDescPtr XkbGetKeyboardByName( Display * /* dpy */, unsigned int /* deviceSpec */, XkbComponentNamesPtr /* names */, unsigned int /* want */, unsigned int /* need */, Bool /* load */ ); /***====================================================================***/ extern int XkbKeyTypesForCoreSymbols( /* returns # of groups */ XkbDescPtr /* xkb */, /* keyboard device */ int /* map_width */, /* width of core KeySym array */ KeySym * /* core_syms */, /* always mapWidth symbols */ unsigned int /* protected */, /* explicit key types */ int * /* types_inout */, /* always four type indices */ KeySym * /* xkb_syms_rtrn */ /* must have enough space */ ); extern Bool XkbApplyCompatMapToKey( /* False only on error */ XkbDescPtr /* xkb */, /* keymap to be edited */ KeyCode /* key */, /* key to be updated */ XkbChangesPtr /* changes */ /* resulting changes to map */ ); extern Bool XkbUpdateMapFromCore( /* False only on error */ XkbDescPtr /* xkb */, /* XKB keyboard to be edited */ KeyCode /* first_key */, /* first changed key */ int /* num_keys */, /* number of changed keys */ int /* map_width */, /* width of core keymap */ KeySym * /* core_keysyms */, /* symbols from core keymap */ XkbChangesPtr /* changes */ /* resulting changes */ ); /***====================================================================***/ extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo( XkbDeviceInfoPtr /* devi */, unsigned int /* ledClass */, unsigned int /* ledId */ ); extern Status XkbResizeDeviceButtonActions( XkbDeviceInfoPtr /* devi */, unsigned int /* newTotal */ ); extern XkbDeviceInfoPtr XkbAllocDeviceInfo( unsigned int /* deviceSpec */, unsigned int /* nButtons */, unsigned int /* szLeds */ ); extern void XkbFreeDeviceInfo( XkbDeviceInfoPtr /* devi */, unsigned int /* which */, Bool /* freeDevI */ ); extern void XkbNoteDeviceChanges( XkbDeviceChangesPtr /* old */, XkbExtensionDeviceNotifyEvent * /* new */, unsigned int /* wanted */ ); extern XkbDeviceInfoPtr XkbGetDeviceInfo( Display * /* dpy */, unsigned int /* which */, unsigned int /* deviceSpec */, unsigned int /* ledClass */, unsigned int /* ledID */ ); extern Status XkbGetDeviceInfoChanges( Display * /* dpy */, XkbDeviceInfoPtr /* devi */, XkbDeviceChangesPtr /* changes */ ); extern Status XkbGetDeviceButtonActions( Display * /* dpy */, XkbDeviceInfoPtr /* devi */, Bool /* all */, unsigned int /* first */, unsigned int /* nBtns */ ); extern Status XkbGetDeviceLedInfo( Display * /* dpy */, XkbDeviceInfoPtr /* devi */, unsigned int /* ledClass (class, XIDflt, XIAll) */, unsigned int /* ledId (id, XIDflt, XIAll) */, unsigned int /* which (XkbXI_Indicator{Names,Map}Mask */ ); extern Bool XkbSetDeviceInfo( Display * /* dpy */, unsigned int /* which */, XkbDeviceInfoPtr /* devi */ ); extern Bool XkbChangeDeviceInfo( Display* /* dpy */, XkbDeviceInfoPtr /* desc */, XkbDeviceChangesPtr /* changes */ ); extern Bool XkbSetDeviceLedInfo( Display * /* dpy */, XkbDeviceInfoPtr /* devi */, unsigned int /* ledClass */, unsigned int /* ledID */, unsigned int /* which */ ); extern Bool XkbSetDeviceButtonActions( Display * /* dpy */, XkbDeviceInfoPtr /* devi */, unsigned int /* first */, unsigned int /* nBtns */ ); /***====================================================================***/ extern char XkbToControl( char /* c */ ); /***====================================================================***/ extern Bool XkbSetDebuggingFlags( Display * /* dpy */, unsigned int /* mask */, unsigned int /* flags */, char * /* msg */, unsigned int /* ctrls_mask */, unsigned int /* ctrls */, unsigned int * /* rtrn_flags */, unsigned int * /* rtrn_ctrls */ ); extern Bool XkbApplyVirtualModChanges( XkbDescPtr /* xkb */, unsigned int /* changed */, XkbChangesPtr /* changes */ ); extern Bool XkbUpdateActionVirtualMods( XkbDescPtr /* xkb */, XkbAction * /* act */, unsigned int /* changed */ ); extern void XkbUpdateKeyTypeVirtualMods( XkbDescPtr /* xkb */, XkbKeyTypePtr /* type */, unsigned int /* changed */, XkbChangesPtr /* changes */ ); _XFUNCPROTOEND #endif /* !defined(_X11_XKBLIB_H_) && !defined(_XKBLIB_H_) */ nx-libs-3.5.99.23/nx-X11/lib/include/X11/XlibConf.h.in0000644000000000000000000000271613614532331016335 0ustar /* * Copyright © 2005 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _XLIBCONF_H_ #define _XLIBCONF_H_ /* * This header file exports defines necessary to correctly * use Xlibint.h both inside Xlib and by external libraries * such as extensions. */ /* Threading support? */ #undef XTHREADS /* Use multi-threaded libc functions? */ #undef XUSE_MTSAFE_API #endif /* _XLIBCONF_H_ */ nx-libs-3.5.99.23/nx-X11/lib/include/X11/Xlib.h0000644000000000000000000030344013614532331015120 0ustar /* Copyright 1985, 1986, 1987, 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Xlib.h - Header definition and support file for the C subroutine * interface library (Xlib) to the X Window System Protocol (V11). * Structures and symbols starting with "_" are private to the library. */ #if !defined(_X11_XLIB_H_) && !defined(_XLIB_H_) #define _X11_XLIB_H_ #define _XLIB_H_ #define XlibSpecificationRelease 6 #include #if defined(__SCO__) || defined(__UNIXWARE__) #include #endif #include /* applications should not depend on these two headers being included! */ #include #include #ifndef X_WCHAR #include #else /* replace this with #include or typedef appropriate for your system */ typedef unsigned long wchar_t; #endif extern int _Xmblen( char *str, int len ); /* API mentioning "UTF8" or "utf8" is an XFree86 extension, introduced in November 2000. Its presence is indicated through the following macro. */ #define X_HAVE_UTF8_STRING 1 /* The Xlib structs are full of implicit padding to properly align members. We can't clean that up without breaking ABI, so tell clang not to bother complaining about it. */ #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif typedef char *XPointer; #define Bool int #define Status int #define True 1 #define False 0 #define QueuedAlready 0 #define QueuedAfterReading 1 #define QueuedAfterFlush 2 #define ConnectionNumber(dpy) (((_XPrivDisplay)(dpy))->fd) #define RootWindow(dpy, scr) (ScreenOfDisplay(dpy,scr)->root) #define DefaultScreen(dpy) (((_XPrivDisplay)(dpy))->default_screen) #define DefaultRootWindow(dpy) (ScreenOfDisplay(dpy,DefaultScreen(dpy))->root) #define DefaultVisual(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_visual) #define DefaultGC(dpy, scr) (ScreenOfDisplay(dpy,scr)->default_gc) #define BlackPixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->black_pixel) #define WhitePixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->white_pixel) #define AllPlanes ((unsigned long)~0L) #define QLength(dpy) (((_XPrivDisplay)(dpy))->qlen) #define DisplayWidth(dpy, scr) (ScreenOfDisplay(dpy,scr)->width) #define DisplayHeight(dpy, scr) (ScreenOfDisplay(dpy,scr)->height) #define DisplayWidthMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mwidth) #define DisplayHeightMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mheight) #define DisplayPlanes(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth) #define DisplayCells(dpy, scr) (DefaultVisual(dpy,scr)->map_entries) #define ScreenCount(dpy) (((_XPrivDisplay)(dpy))->nscreens) #define ServerVendor(dpy) (((_XPrivDisplay)(dpy))->vendor) #define ProtocolVersion(dpy) (((_XPrivDisplay)(dpy))->proto_major_version) #define ProtocolRevision(dpy) (((_XPrivDisplay)(dpy))->proto_minor_version) #define VendorRelease(dpy) (((_XPrivDisplay)(dpy))->release) #define DisplayString(dpy) (((_XPrivDisplay)(dpy))->display_name) #define DefaultDepth(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth) #define DefaultColormap(dpy, scr)(ScreenOfDisplay(dpy,scr)->cmap) #define BitmapUnit(dpy) (((_XPrivDisplay)(dpy))->bitmap_unit) #define BitmapBitOrder(dpy) (((_XPrivDisplay)(dpy))->bitmap_bit_order) #define BitmapPad(dpy) (((_XPrivDisplay)(dpy))->bitmap_pad) #define ImageByteOrder(dpy) (((_XPrivDisplay)(dpy))->byte_order) #define NextRequest(dpy) (((_XPrivDisplay)(dpy))->request + 1) #define LastKnownRequestProcessed(dpy) (((_XPrivDisplay)(dpy))->last_request_read) /* macros for screen oriented applications (toolkit) */ #define ScreenOfDisplay(dpy, scr)(&((_XPrivDisplay)(dpy))->screens[scr]) #define DefaultScreenOfDisplay(dpy) ScreenOfDisplay(dpy,DefaultScreen(dpy)) #define DisplayOfScreen(s) ((s)->display) #define RootWindowOfScreen(s) ((s)->root) #define BlackPixelOfScreen(s) ((s)->black_pixel) #define WhitePixelOfScreen(s) ((s)->white_pixel) #define DefaultColormapOfScreen(s)((s)->cmap) #define DefaultDepthOfScreen(s) ((s)->root_depth) #define DefaultGCOfScreen(s) ((s)->default_gc) #define DefaultVisualOfScreen(s)((s)->root_visual) #define WidthOfScreen(s) ((s)->width) #define HeightOfScreen(s) ((s)->height) #define WidthMMOfScreen(s) ((s)->mwidth) #define HeightMMOfScreen(s) ((s)->mheight) #define PlanesOfScreen(s) ((s)->root_depth) #define CellsOfScreen(s) (DefaultVisualOfScreen((s))->map_entries) #define MinCmapsOfScreen(s) ((s)->min_maps) #define MaxCmapsOfScreen(s) ((s)->max_maps) #define DoesSaveUnders(s) ((s)->save_unders) #define DoesBackingStore(s) ((s)->backing_store) #define EventMaskOfScreen(s) ((s)->root_input_mask) /* * Extensions need a way to hang private data on some structures. */ typedef struct _XExtData { int number; /* number returned by XRegisterExtension */ struct _XExtData *next; /* next item on list of data for structure */ int (*free_private)( /* called to free private storage */ struct _XExtData *extension ); XPointer private_data; /* data private to this extension. */ } XExtData; /* * This file contains structures used by the extension mechanism. */ typedef struct { /* public to extension, cannot be changed */ int extension; /* extension number */ int major_opcode; /* major op-code assigned by server */ int first_event; /* first event number for the extension */ int first_error; /* first error number for the extension */ } XExtCodes; /* * Data structure for retrieving info about pixmap formats. */ typedef struct { int depth; int bits_per_pixel; int scanline_pad; } XPixmapFormatValues; /* * Data structure for setting graphics context. */ typedef struct { int function; /* logical operation */ unsigned long plane_mask;/* plane mask */ unsigned long foreground;/* foreground pixel */ unsigned long background;/* background pixel */ int line_width; /* line width */ int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */ int cap_style; /* CapNotLast, CapButt, CapRound, CapProjecting */ int join_style; /* JoinMiter, JoinRound, JoinBevel */ int fill_style; /* FillSolid, FillTiled, FillStippled, FillOpaeueStippled */ int fill_rule; /* EvenOddRule, WindingRule */ int arc_mode; /* ArcChord, ArcPieSlice */ Pixmap tile; /* tile pixmap for tiling operations */ Pixmap stipple; /* stipple 1 plane pixmap for stipping */ int ts_x_origin; /* offset for tile or stipple operations */ int ts_y_origin; Font font; /* default text font for text operations */ int subwindow_mode; /* ClipByChildren, IncludeInferiors */ Bool graphics_exposures;/* boolean, should exposures be generated */ int clip_x_origin; /* origin for clipping */ int clip_y_origin; Pixmap clip_mask; /* bitmap clipping; other calls for rects */ int dash_offset; /* patterned/dashed line information */ char dashes; } XGCValues; /* * Graphics context. The contents of this structure are implementation * dependent. A GC should be treated as opaque by application code. */ typedef struct _XGC #ifdef XLIB_ILLEGAL_ACCESS { XExtData *ext_data; /* hook for extension to hang data */ GContext gid; /* protocol ID for graphics context */ /* there is more to this structure, but it is private to Xlib */ } #endif *GC; /* * Visual structure; contains information about colormapping possible. */ typedef struct { XExtData *ext_data; /* hook for extension to hang data */ VisualID visualid; /* visual id of this visual */ #if defined(__cplusplus) || defined(c_plusplus) int c_class; /* C++ class of screen (monochrome, etc.) */ #else int class; /* class of screen (monochrome, etc.) */ #endif unsigned long red_mask, green_mask, blue_mask; /* mask values */ int bits_per_rgb; /* log base 2 of distinct color values */ int map_entries; /* color map entries */ } Visual; /* * Depth structure; contains information for each possible depth. */ typedef struct { int depth; /* this depth (Z) of the depth */ int nvisuals; /* number of Visual types at this depth */ Visual *visuals; /* list of visuals possible at this depth */ } Depth; /* * Information about the screen. The contents of this structure are * implementation dependent. A Screen should be treated as opaque * by application code. */ struct _XDisplay; /* Forward declare before use for C++ */ typedef struct { XExtData *ext_data; /* hook for extension to hang data */ struct _XDisplay *display;/* back pointer to display structure */ Window root; /* Root window id. */ int width, height; /* width and height of screen */ int mwidth, mheight; /* width and height of in millimeters */ int ndepths; /* number of depths possible */ Depth *depths; /* list of allowable depths on the screen */ int root_depth; /* bits per pixel */ Visual *root_visual; /* root visual */ GC default_gc; /* GC for the root root visual */ Colormap cmap; /* default color map */ unsigned long white_pixel; unsigned long black_pixel; /* White and Black pixel values */ int max_maps, min_maps; /* max and min color maps */ int backing_store; /* Never, WhenMapped, Always */ Bool save_unders; long root_input_mask; /* initial root input mask */ } Screen; /* * Format structure; describes ZFormat data the screen will understand. */ typedef struct { XExtData *ext_data; /* hook for extension to hang data */ int depth; /* depth of this image format */ int bits_per_pixel; /* bits/pixel at this depth */ int scanline_pad; /* scanline must padded to this multiple */ } ScreenFormat; /* * Data structure for setting window attributes. */ typedef struct { Pixmap background_pixmap; /* background or None or ParentRelative */ unsigned long background_pixel; /* background pixel */ Pixmap border_pixmap; /* border of the window */ unsigned long border_pixel; /* border pixel value */ int bit_gravity; /* one of bit gravity values */ int win_gravity; /* one of the window gravity values */ int backing_store; /* NotUseful, WhenMapped, Always */ unsigned long backing_planes;/* planes to be preseved if possible */ unsigned long backing_pixel;/* value to use in restoring planes */ Bool save_under; /* should bits under be saved? (popups) */ long event_mask; /* set of events that should be saved */ long do_not_propagate_mask; /* set of events that should not propagate */ Bool override_redirect; /* boolean value for override-redirect */ Colormap colormap; /* color map to be associated with window */ Cursor cursor; /* cursor to be displayed (or None) */ } XSetWindowAttributes; typedef struct { int x, y; /* location of window */ int width, height; /* width and height of window */ int border_width; /* border width of window */ int depth; /* depth of window */ Visual *visual; /* the associated visual structure */ Window root; /* root of screen containing window */ #if defined(__cplusplus) || defined(c_plusplus) int c_class; /* C++ InputOutput, InputOnly*/ #else int class; /* InputOutput, InputOnly*/ #endif int bit_gravity; /* one of bit gravity values */ int win_gravity; /* one of the window gravity values */ int backing_store; /* NotUseful, WhenMapped, Always */ unsigned long backing_planes;/* planes to be preserved if possible */ unsigned long backing_pixel;/* value to be used when restoring planes */ Bool save_under; /* boolean, should bits under be saved? */ Colormap colormap; /* color map to be associated with window */ Bool map_installed; /* boolean, is color map currently installed*/ int map_state; /* IsUnmapped, IsUnviewable, IsViewable */ long all_event_masks; /* set of events all people have interest in*/ long your_event_mask; /* my event mask */ long do_not_propagate_mask; /* set of events that should not propagate */ Bool override_redirect; /* boolean value for override-redirect */ Screen *screen; /* back pointer to correct screen */ } XWindowAttributes; /* * Data structure for host setting; getting routines. * */ typedef struct { int family; /* for example FamilyInternet */ int length; /* length of address, in bytes */ char *address; /* pointer to where to find the bytes */ } XHostAddress; /* * Data structure for ServerFamilyInterpreted addresses in host routines */ typedef struct { int typelength; /* length of type string, in bytes */ int valuelength; /* length of value string, in bytes */ char *type; /* pointer to where to find the type string */ char *value; /* pointer to where to find the address */ } XServerInterpretedAddress; /* * Data structure for "image" data, used by image manipulation routines. */ typedef struct _XImage { int width, height; /* size of image */ int xoffset; /* number of pixels offset in X direction */ int format; /* XYBitmap, XYPixmap, ZPixmap */ char *data; /* pointer to image data */ int byte_order; /* data byte order, LSBFirst, MSBFirst */ int bitmap_unit; /* quant. of scanline 8, 16, 32 */ int bitmap_bit_order; /* LSBFirst, MSBFirst */ int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */ int depth; /* depth of image */ int bytes_per_line; /* accelarator to next line */ int bits_per_pixel; /* bits per pixel (ZPixmap) */ unsigned long red_mask; /* bits in z arrangment */ unsigned long green_mask; unsigned long blue_mask; XPointer obdata; /* hook for the object routines to hang on */ struct funcs { /* image manipulation routines */ struct _XImage *(*create_image)( struct _XDisplay* /* display */, Visual* /* visual */, unsigned int /* depth */, int /* format */, int /* offset */, char* /* data */, unsigned int /* width */, unsigned int /* height */, int /* bitmap_pad */, int /* bytes_per_line */); int (*destroy_image) (struct _XImage *); unsigned long (*get_pixel) (struct _XImage *, int, int); int (*put_pixel) (struct _XImage *, int, int, unsigned long); struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int); int (*add_pixel) (struct _XImage *, long); } f; } XImage; /* * Data structure for XReconfigureWindow */ typedef struct { int x, y; int width, height; int border_width; Window sibling; int stack_mode; } XWindowChanges; /* * Data structure used by color operations */ typedef struct { unsigned long pixel; unsigned short red, green, blue; char flags; /* do_red, do_green, do_blue */ char pad; } XColor; /* * Data structures for graphics operations. On most machines, these are * congruent with the wire protocol structures, so reformatting the data * can be avoided on these architectures. */ typedef struct { short x1, y1, x2, y2; } XSegment; typedef struct { short x, y; } XPoint; typedef struct { short x, y; unsigned short width, height; } XRectangle; typedef struct { short x, y; unsigned short width, height; short angle1, angle2; } XArc; /* Data structure for XChangeKeyboardControl */ typedef struct { int key_click_percent; int bell_percent; int bell_pitch; int bell_duration; int led; int led_mode; int key; int auto_repeat_mode; /* On, Off, Default */ } XKeyboardControl; /* Data structure for XGetKeyboardControl */ typedef struct { int key_click_percent; int bell_percent; unsigned int bell_pitch, bell_duration; unsigned long led_mask; int global_auto_repeat; char auto_repeats[32]; } XKeyboardState; /* Data structure for XGetMotionEvents. */ typedef struct { Time time; short x, y; } XTimeCoord; /* Data structure for X{Set,Get}ModifierMapping */ typedef struct { int max_keypermod; /* The server's max # of keys per modifier */ KeyCode *modifiermap; /* An 8 by max_keypermod array of modifiers */ } XModifierKeymap; /* * Display datatype maintaining display specific data. * The contents of this structure are implementation dependent. * A Display should be treated as opaque by application code. */ #ifndef XLIB_ILLEGAL_ACCESS typedef struct _XDisplay Display; #endif struct _XPrivate; /* Forward declare before use for C++ */ struct _XrmHashBucketRec; typedef struct #ifdef XLIB_ILLEGAL_ACCESS _XDisplay #endif { XExtData *ext_data; /* hook for extension to hang data */ struct _XPrivate *private1; int fd; /* Network socket. */ int private2; int proto_major_version;/* major version of server's X protocol */ int proto_minor_version;/* minor version of servers X protocol */ char *vendor; /* vendor of the server hardware */ XID private3; XID private4; XID private5; int private6; XID (*resource_alloc)( /* allocator function */ struct _XDisplay* ); int byte_order; /* screen byte order, LSBFirst, MSBFirst */ int bitmap_unit; /* padding and data requirements */ int bitmap_pad; /* padding requirements on bitmaps */ int bitmap_bit_order; /* LeastSignificant or MostSignificant */ int nformats; /* number of pixmap formats in list */ ScreenFormat *pixmap_format; /* pixmap format list */ int private8; int release; /* release of the server */ struct _XPrivate *private9, *private10; int qlen; /* Length of input event queue */ unsigned long last_request_read; /* seq number of last event read */ unsigned long request; /* sequence number of last request. */ XPointer private11; XPointer private12; XPointer private13; XPointer private14; unsigned max_request_size; /* maximum number 32 bit words in request*/ struct _XrmHashBucketRec *db; int (*private15)( struct _XDisplay* ); char *display_name; /* "host:display" string used on this connect*/ int default_screen; /* default screen for operations */ int nscreens; /* number of screens on this server*/ Screen *screens; /* pointer to list of screens */ unsigned long motion_buffer; /* size of motion buffer */ unsigned long private16; int min_keycode; /* minimum defined keycode */ int max_keycode; /* maximum defined keycode */ XPointer private17; XPointer private18; int private19; char *xdefaults; /* contents of defaults from server */ /* there is more to this structure, but it is private to Xlib */ } #ifdef XLIB_ILLEGAL_ACCESS Display, #endif *_XPrivDisplay; #undef _XEVENT_ #ifndef _XEVENT_ /* * Definitions of specific events. */ typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window it is reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ unsigned int keycode; /* detail */ Bool same_screen; /* same screen flag */ } XKeyEvent; typedef XKeyEvent XKeyPressedEvent; typedef XKeyEvent XKeyReleasedEvent; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window it is reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ unsigned int button; /* detail */ Bool same_screen; /* same screen flag */ } XButtonEvent; typedef XButtonEvent XButtonPressedEvent; typedef XButtonEvent XButtonReleasedEvent; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ char is_hint; /* detail */ Bool same_screen; /* same screen flag */ } XMotionEvent; typedef XMotionEvent XPointerMovedEvent; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */ int detail; /* * NotifyAncestor, NotifyVirtual, NotifyInferior, * NotifyNonlinear,NotifyNonlinearVirtual */ Bool same_screen; /* same screen flag */ Bool focus; /* boolean focus */ unsigned int state; /* key or button mask */ } XCrossingEvent; typedef XCrossingEvent XEnterWindowEvent; typedef XCrossingEvent XLeaveWindowEvent; typedef struct { int type; /* FocusIn or FocusOut */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* window of event */ int mode; /* NotifyNormal, NotifyWhileGrabbed, NotifyGrab, NotifyUngrab */ int detail; /* * NotifyAncestor, NotifyVirtual, NotifyInferior, * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer, * NotifyPointerRoot, NotifyDetailNone */ } XFocusChangeEvent; typedef XFocusChangeEvent XFocusInEvent; typedef XFocusChangeEvent XFocusOutEvent; /* generated on EnterWindow and FocusIn when KeyMapState selected */ typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; char key_vector[32]; } XKeymapEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; int x, y; int width, height; int count; /* if non-zero, at least this many more */ } XExposeEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Drawable drawable; int x, y; int width, height; int count; /* if non-zero, at least this many more */ int major_code; /* core is CopyArea or CopyPlane */ int minor_code; /* not defined in the core */ } XGraphicsExposeEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Drawable drawable; int major_code; /* core is CopyArea or CopyPlane */ int minor_code; /* not defined in the core */ } XNoExposeEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; int state; /* Visibility state */ } XVisibilityEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window parent; /* parent of the window */ Window window; /* window id of window created */ int x, y; /* window location */ int width, height; /* size of window */ int border_width; /* border width */ Bool override_redirect; /* creation should be overridden */ } XCreateWindowEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; } XDestroyWindowEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; Bool from_configure; } XUnmapEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; Bool override_redirect; /* boolean, is override set... */ } XMapEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window parent; Window window; } XMapRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; Window parent; int x, y; Bool override_redirect; } XReparentEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; int x, y; int width, height; int border_width; Window above; Bool override_redirect; } XConfigureEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; int x, y; } XGravityEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; int width, height; } XResizeRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window parent; Window window; int x, y; int width, height; int border_width; Window above; int detail; /* Above, Below, TopIf, BottomIf, Opposite */ unsigned long value_mask; } XConfigureRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; int place; /* PlaceOnTop, PlaceOnBottom */ } XCirculateEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window parent; Window window; int place; /* PlaceOnTop, PlaceOnBottom */ } XCirculateRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; Atom atom; Time time; int state; /* NewValue, Deleted */ } XPropertyEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; Atom selection; Time time; } XSelectionClearEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window owner; Window requestor; Atom selection; Atom target; Atom property; Time time; } XSelectionRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window requestor; Atom selection; Atom target; Atom property; /* ATOM or None */ Time time; } XSelectionEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; Colormap colormap; /* COLORMAP or None */ #if defined(__cplusplus) || defined(c_plusplus) Bool c_new; /* C++ */ #else Bool new; #endif int state; /* ColormapInstalled, ColormapUninstalled */ } XColormapEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; Atom message_type; int format; union { char b[20]; short s[10]; long l[5]; } data; } XClientMessageEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* unused */ int request; /* one of MappingModifier, MappingKeyboard, MappingPointer */ int first_keycode; /* first keycode */ int count; /* defines range of change w. first_keycode*/ } XMappingEvent; typedef struct { int type; Display *display; /* Display the event was read from */ XID resourceid; /* resource id */ unsigned long serial; /* serial number of failed request */ unsigned char error_code; /* error code of failed request */ unsigned char request_code; /* Major op-code of failed request */ unsigned char minor_code; /* Minor op-code of failed request */ } XErrorEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display;/* Display the event was read from */ Window window; /* window on which event was requested in event mask */ } XAnyEvent; /*************************************************************** * * GenericEvent. This event is the standard event for all newer extensions. */ typedef struct { int type; /* of event. Always GenericEvent */ unsigned long serial; /* # of last request processed */ Bool send_event; /* true if from SendEvent request */ Display *display; /* Display the event was read from */ int extension; /* major opcode of extension that caused the event */ int evtype; /* actual event type. */ } XGenericEvent; typedef struct { int type; /* of event. Always GenericEvent */ unsigned long serial; /* # of last request processed */ Bool send_event; /* true if from SendEvent request */ Display *display; /* Display the event was read from */ int extension; /* major opcode of extension that caused the event */ int evtype; /* actual event type. */ unsigned int cookie; void *data; } XGenericEventCookie; /* * this union is defined so Xlib can always use the same sized * event structure internally, to avoid memory fragmentation. */ typedef union _XEvent { int type; /* must not be changed; first element */ XAnyEvent xany; XKeyEvent xkey; XButtonEvent xbutton; XMotionEvent xmotion; XCrossingEvent xcrossing; XFocusChangeEvent xfocus; XExposeEvent xexpose; XGraphicsExposeEvent xgraphicsexpose; XNoExposeEvent xnoexpose; XVisibilityEvent xvisibility; XCreateWindowEvent xcreatewindow; XDestroyWindowEvent xdestroywindow; XUnmapEvent xunmap; XMapEvent xmap; XMapRequestEvent xmaprequest; XReparentEvent xreparent; XConfigureEvent xconfigure; XGravityEvent xgravity; XResizeRequestEvent xresizerequest; XConfigureRequestEvent xconfigurerequest; XCirculateEvent xcirculate; XCirculateRequestEvent xcirculaterequest; XPropertyEvent xproperty; XSelectionClearEvent xselectionclear; XSelectionRequestEvent xselectionrequest; XSelectionEvent xselection; XColormapEvent xcolormap; XClientMessageEvent xclient; XMappingEvent xmapping; XErrorEvent xerror; XKeymapEvent xkeymap; XGenericEvent xgeneric; XGenericEventCookie xcookie; long pad[24]; } XEvent; #endif #define XAllocID(dpy) ((*((_XPrivDisplay)(dpy))->resource_alloc)((dpy))) /* * per character font metric information. */ typedef struct { short lbearing; /* origin to left edge of raster */ short rbearing; /* origin to right edge of raster */ short width; /* advance to next char's origin */ short ascent; /* baseline to top edge of raster */ short descent; /* baseline to bottom edge of raster */ unsigned short attributes; /* per char flags (not predefined) */ } XCharStruct; /* * To allow arbitrary information with fonts, there are additional properties * returned. */ typedef struct { Atom name; unsigned long card32; } XFontProp; typedef struct { XExtData *ext_data; /* hook for extension to hang data */ Font fid; /* Font id for this font */ unsigned direction; /* hint about direction the font is painted */ unsigned min_char_or_byte2;/* first character */ unsigned max_char_or_byte2;/* last character */ unsigned min_byte1; /* first row that exists */ unsigned max_byte1; /* last row that exists */ Bool all_chars_exist;/* flag if all characters have non-zero size*/ unsigned default_char; /* char to print for undefined character */ int n_properties; /* how many properties there are */ XFontProp *properties; /* pointer to array of additional properties*/ XCharStruct min_bounds; /* minimum bounds over all existing char*/ XCharStruct max_bounds; /* maximum bounds over all existing char*/ XCharStruct *per_char; /* first_char to last_char information */ int ascent; /* log. extent above baseline for spacing */ int descent; /* log. descent below baseline for spacing */ } XFontStruct; /* * PolyText routines take these as arguments. */ typedef struct { char *chars; /* pointer to string */ int nchars; /* number of characters */ int delta; /* delta between strings */ Font font; /* font to print it in, None don't change */ } XTextItem; typedef struct { /* normal 16 bit characters are two bytes */ unsigned char byte1; unsigned char byte2; } XChar2b; typedef struct { XChar2b *chars; /* two byte characters */ int nchars; /* number of characters */ int delta; /* delta between strings */ Font font; /* font to print it in, None don't change */ } XTextItem16; typedef union { Display *display; GC gc; Visual *visual; Screen *screen; ScreenFormat *pixmap_format; XFontStruct *font; } XEDataObject; typedef struct { XRectangle max_ink_extent; XRectangle max_logical_extent; } XFontSetExtents; /* unused: typedef void (*XOMProc)(); */ typedef struct _XOM *XOM; typedef struct _XOC *XOC, *XFontSet; typedef struct { char *chars; int nchars; int delta; XFontSet font_set; } XmbTextItem; typedef struct { wchar_t *chars; int nchars; int delta; XFontSet font_set; } XwcTextItem; #define XNRequiredCharSet "requiredCharSet" #define XNQueryOrientation "queryOrientation" #define XNBaseFontName "baseFontName" #define XNOMAutomatic "omAutomatic" #define XNMissingCharSet "missingCharSet" #define XNDefaultString "defaultString" #define XNOrientation "orientation" #define XNDirectionalDependentDrawing "directionalDependentDrawing" #define XNContextualDrawing "contextualDrawing" #define XNFontInfo "fontInfo" typedef struct { int charset_count; char **charset_list; } XOMCharSetList; typedef enum { XOMOrientation_LTR_TTB, XOMOrientation_RTL_TTB, XOMOrientation_TTB_LTR, XOMOrientation_TTB_RTL, XOMOrientation_Context } XOrientation; typedef struct { int num_orientation; XOrientation *orientation; /* Input Text description */ } XOMOrientation; typedef struct { int num_font; XFontStruct **font_struct_list; char **font_name_list; } XOMFontInfo; typedef struct _XIM *XIM; typedef struct _XIC *XIC; typedef void (*XIMProc)( XIM, XPointer, XPointer ); typedef Bool (*XICProc)( XIC, XPointer, XPointer ); typedef void (*XIDProc)( Display*, XPointer, XPointer ); typedef unsigned long XIMStyle; typedef struct { unsigned short count_styles; XIMStyle *supported_styles; } XIMStyles; #define XIMPreeditArea 0x0001L #define XIMPreeditCallbacks 0x0002L #define XIMPreeditPosition 0x0004L #define XIMPreeditNothing 0x0008L #define XIMPreeditNone 0x0010L #define XIMStatusArea 0x0100L #define XIMStatusCallbacks 0x0200L #define XIMStatusNothing 0x0400L #define XIMStatusNone 0x0800L #define XNVaNestedList "XNVaNestedList" #define XNQueryInputStyle "queryInputStyle" #define XNClientWindow "clientWindow" #define XNInputStyle "inputStyle" #define XNFocusWindow "focusWindow" #define XNResourceName "resourceName" #define XNResourceClass "resourceClass" #define XNGeometryCallback "geometryCallback" #define XNDestroyCallback "destroyCallback" #define XNFilterEvents "filterEvents" #define XNPreeditStartCallback "preeditStartCallback" #define XNPreeditDoneCallback "preeditDoneCallback" #define XNPreeditDrawCallback "preeditDrawCallback" #define XNPreeditCaretCallback "preeditCaretCallback" #define XNPreeditStateNotifyCallback "preeditStateNotifyCallback" #define XNPreeditAttributes "preeditAttributes" #define XNStatusStartCallback "statusStartCallback" #define XNStatusDoneCallback "statusDoneCallback" #define XNStatusDrawCallback "statusDrawCallback" #define XNStatusAttributes "statusAttributes" #define XNArea "area" #define XNAreaNeeded "areaNeeded" #define XNSpotLocation "spotLocation" #define XNColormap "colorMap" #define XNStdColormap "stdColorMap" #define XNForeground "foreground" #define XNBackground "background" #define XNBackgroundPixmap "backgroundPixmap" #define XNFontSet "fontSet" #define XNLineSpace "lineSpace" #define XNCursor "cursor" #define XNQueryIMValuesList "queryIMValuesList" #define XNQueryICValuesList "queryICValuesList" #define XNVisiblePosition "visiblePosition" #define XNR6PreeditCallback "r6PreeditCallback" #define XNStringConversionCallback "stringConversionCallback" #define XNStringConversion "stringConversion" #define XNResetState "resetState" #define XNHotKey "hotKey" #define XNHotKeyState "hotKeyState" #define XNPreeditState "preeditState" #define XNSeparatorofNestedList "separatorofNestedList" #define XBufferOverflow -1 #define XLookupNone 1 #define XLookupChars 2 #define XLookupKeySym 3 #define XLookupBoth 4 typedef void *XVaNestedList; typedef struct { XPointer client_data; XIMProc callback; } XIMCallback; typedef struct { XPointer client_data; XICProc callback; } XICCallback; typedef unsigned long XIMFeedback; #define XIMReverse 1L #define XIMUnderline (1L<<1) #define XIMHighlight (1L<<2) #define XIMPrimary (1L<<5) #define XIMSecondary (1L<<6) #define XIMTertiary (1L<<7) #define XIMVisibleToForward (1L<<8) #define XIMVisibleToBackword (1L<<9) #define XIMVisibleToCenter (1L<<10) typedef struct _XIMText { unsigned short length; XIMFeedback *feedback; Bool encoding_is_wchar; union { char *multi_byte; wchar_t *wide_char; } string; } XIMText; typedef unsigned long XIMPreeditState; #define XIMPreeditUnKnown 0L #define XIMPreeditEnable 1L #define XIMPreeditDisable (1L<<1) typedef struct _XIMPreeditStateNotifyCallbackStruct { XIMPreeditState state; } XIMPreeditStateNotifyCallbackStruct; typedef unsigned long XIMResetState; #define XIMInitialState 1L #define XIMPreserveState (1L<<1) typedef unsigned long XIMStringConversionFeedback; #define XIMStringConversionLeftEdge (0x00000001) #define XIMStringConversionRightEdge (0x00000002) #define XIMStringConversionTopEdge (0x00000004) #define XIMStringConversionBottomEdge (0x00000008) #define XIMStringConversionConcealed (0x00000010) #define XIMStringConversionWrapped (0x00000020) typedef struct _XIMStringConversionText { unsigned short length; XIMStringConversionFeedback *feedback; Bool encoding_is_wchar; union { char *mbs; wchar_t *wcs; } string; } XIMStringConversionText; typedef unsigned short XIMStringConversionPosition; typedef unsigned short XIMStringConversionType; #define XIMStringConversionBuffer (0x0001) #define XIMStringConversionLine (0x0002) #define XIMStringConversionWord (0x0003) #define XIMStringConversionChar (0x0004) typedef unsigned short XIMStringConversionOperation; #define XIMStringConversionSubstitution (0x0001) #define XIMStringConversionRetrieval (0x0002) typedef enum { XIMForwardChar, XIMBackwardChar, XIMForwardWord, XIMBackwardWord, XIMCaretUp, XIMCaretDown, XIMNextLine, XIMPreviousLine, XIMLineStart, XIMLineEnd, XIMAbsolutePosition, XIMDontChange } XIMCaretDirection; typedef struct _XIMStringConversionCallbackStruct { XIMStringConversionPosition position; XIMCaretDirection direction; XIMStringConversionOperation operation; unsigned short factor; XIMStringConversionText *text; } XIMStringConversionCallbackStruct; typedef struct _XIMPreeditDrawCallbackStruct { int caret; /* Cursor offset within pre-edit string */ int chg_first; /* Starting change position */ int chg_length; /* Length of the change in character count */ XIMText *text; } XIMPreeditDrawCallbackStruct; typedef enum { XIMIsInvisible, /* Disable caret feedback */ XIMIsPrimary, /* UI defined caret feedback */ XIMIsSecondary /* UI defined caret feedback */ } XIMCaretStyle; typedef struct _XIMPreeditCaretCallbackStruct { int position; /* Caret offset within pre-edit string */ XIMCaretDirection direction; /* Caret moves direction */ XIMCaretStyle style; /* Feedback of the caret */ } XIMPreeditCaretCallbackStruct; typedef enum { XIMTextType, XIMBitmapType } XIMStatusDataType; typedef struct _XIMStatusDrawCallbackStruct { XIMStatusDataType type; union { XIMText *text; Pixmap bitmap; } data; } XIMStatusDrawCallbackStruct; typedef struct _XIMHotKeyTrigger { KeySym keysym; int modifier; int modifier_mask; } XIMHotKeyTrigger; typedef struct _XIMHotKeyTriggers { int num_hot_key; XIMHotKeyTrigger *key; } XIMHotKeyTriggers; typedef unsigned long XIMHotKeyState; #define XIMHotKeyStateON (0x0001L) #define XIMHotKeyStateOFF (0x0002L) typedef struct { unsigned short count_values; char **supported_values; } XIMValuesList; _XFUNCPROTOBEGIN #if defined(WIN32) && !defined(_XLIBINT_) #define _Xdebug (*_Xdebug_p) #endif extern int _Xdebug; extern XFontStruct *XLoadQueryFont( Display* /* display */, _Xconst char* /* name */ ); extern XFontStruct *XQueryFont( Display* /* display */, XID /* font_ID */ ); extern XTimeCoord *XGetMotionEvents( Display* /* display */, Window /* w */, Time /* start */, Time /* stop */, int* /* nevents_return */ ); extern XModifierKeymap *XDeleteModifiermapEntry( XModifierKeymap* /* modmap */, #if NeedWidePrototypes unsigned int /* keycode_entry */, #else KeyCode /* keycode_entry */, #endif int /* modifier */ ); extern XModifierKeymap *XGetModifierMapping( Display* /* display */ ); extern XModifierKeymap *XInsertModifiermapEntry( XModifierKeymap* /* modmap */, #if NeedWidePrototypes unsigned int /* keycode_entry */, #else KeyCode /* keycode_entry */, #endif int /* modifier */ ); extern XModifierKeymap *XNewModifiermap( int /* max_keys_per_mod */ ); extern XImage *XCreateImage( Display* /* display */, Visual* /* visual */, unsigned int /* depth */, int /* format */, int /* offset */, char* /* data */, unsigned int /* width */, unsigned int /* height */, int /* bitmap_pad */, int /* bytes_per_line */ ); extern Status XInitImage( XImage* /* image */ ); extern XImage *XGetImage( Display* /* display */, Drawable /* d */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, unsigned long /* plane_mask */, int /* format */ ); extern XImage *XGetSubImage( Display* /* display */, Drawable /* d */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, unsigned long /* plane_mask */, int /* format */, XImage* /* dest_image */, int /* dest_x */, int /* dest_y */ ); /* * X function declarations. */ extern Display *XOpenDisplay( _Xconst char* /* display_name */ ); extern void XrmInitialize( void ); extern char *XFetchBytes( Display* /* display */, int* /* nbytes_return */ ); extern char *XFetchBuffer( Display* /* display */, int* /* nbytes_return */, int /* buffer */ ); extern char *XGetAtomName( Display* /* display */, Atom /* atom */ ); extern Status XGetAtomNames( Display* /* dpy */, Atom* /* atoms */, int /* count */, char** /* names_return */ ); extern char *XGetDefault( Display* /* display */, _Xconst char* /* program */, _Xconst char* /* option */ ); extern char *XDisplayName( _Xconst char* /* string */ ); extern char *XKeysymToString( KeySym /* keysym */ ); extern int (*XSynchronize( Display* /* display */, Bool /* onoff */ ))( Display* /* display */ ); extern int (*XSetAfterFunction( Display* /* display */, int (*) ( Display* /* display */ ) /* procedure */ ))( Display* /* display */ ); extern Atom XInternAtom( Display* /* display */, _Xconst char* /* atom_name */, Bool /* only_if_exists */ ); extern Status XInternAtoms( Display* /* dpy */, char** /* names */, int /* count */, Bool /* onlyIfExists */, Atom* /* atoms_return */ ); extern Colormap XCopyColormapAndFree( Display* /* display */, Colormap /* colormap */ ); extern Colormap XCreateColormap( Display* /* display */, Window /* w */, Visual* /* visual */, int /* alloc */ ); extern Cursor XCreatePixmapCursor( Display* /* display */, Pixmap /* source */, Pixmap /* mask */, XColor* /* foreground_color */, XColor* /* background_color */, unsigned int /* x */, unsigned int /* y */ ); extern Cursor XCreateGlyphCursor( Display* /* display */, Font /* source_font */, Font /* mask_font */, unsigned int /* source_char */, unsigned int /* mask_char */, XColor _Xconst * /* foreground_color */, XColor _Xconst * /* background_color */ ); extern Cursor XCreateFontCursor( Display* /* display */, unsigned int /* shape */ ); extern Font XLoadFont( Display* /* display */, _Xconst char* /* name */ ); extern GC XCreateGC( Display* /* display */, Drawable /* d */, unsigned long /* valuemask */, XGCValues* /* values */ ); extern GContext XGContextFromGC( GC /* gc */ ); extern void XFlushGC( Display* /* display */, GC /* gc */ ); extern Pixmap XCreatePixmap( Display* /* display */, Drawable /* d */, unsigned int /* width */, unsigned int /* height */, unsigned int /* depth */ ); extern Pixmap XCreateBitmapFromData( Display* /* display */, Drawable /* d */, _Xconst char* /* data */, unsigned int /* width */, unsigned int /* height */ ); extern Pixmap XCreatePixmapFromBitmapData( Display* /* display */, Drawable /* d */, char* /* data */, unsigned int /* width */, unsigned int /* height */, unsigned long /* fg */, unsigned long /* bg */, unsigned int /* depth */ ); extern Window XCreateSimpleWindow( Display* /* display */, Window /* parent */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, unsigned int /* border_width */, unsigned long /* border */, unsigned long /* background */ ); extern Window XGetSelectionOwner( Display* /* display */, Atom /* selection */ ); extern Window XCreateWindow( Display* /* display */, Window /* parent */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, unsigned int /* border_width */, int /* depth */, unsigned int /* class */, Visual* /* visual */, unsigned long /* valuemask */, XSetWindowAttributes* /* attributes */ ); extern Colormap *XListInstalledColormaps( Display* /* display */, Window /* w */, int* /* num_return */ ); extern char **XListFonts( Display* /* display */, _Xconst char* /* pattern */, int /* maxnames */, int* /* actual_count_return */ ); extern char **XListFontsWithInfo( Display* /* display */, _Xconst char* /* pattern */, int /* maxnames */, int* /* count_return */, XFontStruct** /* info_return */ ); extern char **XGetFontPath( Display* /* display */, int* /* npaths_return */ ); extern char **XListExtensions( Display* /* display */, int* /* nextensions_return */ ); extern Atom *XListProperties( Display* /* display */, Window /* w */, int* /* num_prop_return */ ); extern XHostAddress *XListHosts( Display* /* display */, int* /* nhosts_return */, Bool* /* state_return */ ); /* this is marked as_X_DEPRECATED in Xorg's upstream libX11 but NX needs it for performance reasons. Should be moved into the server. */ extern KeySym XKeycodeToKeysym( Display* /* display */, #if NeedWidePrototypes unsigned int /* keycode */, #else KeyCode /* keycode */, #endif int /* index */ ); extern KeySym XLookupKeysym( XKeyEvent* /* key_event */, int /* index */ ); extern KeySym *XGetKeyboardMapping( Display* /* display */, #if NeedWidePrototypes unsigned int /* first_keycode */, #else KeyCode /* first_keycode */, #endif int /* keycode_count */, int* /* keysyms_per_keycode_return */ ); extern KeySym XStringToKeysym( _Xconst char* /* string */ ); extern long XMaxRequestSize( Display* /* display */ ); extern long XExtendedMaxRequestSize( Display* /* display */ ); extern char *XResourceManagerString( Display* /* display */ ); extern char *XScreenResourceString( Screen* /* screen */ ); extern unsigned long XDisplayMotionBufferSize( Display* /* display */ ); extern VisualID XVisualIDFromVisual( Visual* /* visual */ ); /* multithread routines */ extern Status XInitThreads( void ); extern void XLockDisplay( Display* /* display */ ); extern void XUnlockDisplay( Display* /* display */ ); /* routines for dealing with extensions */ extern XExtCodes *XInitExtension( Display* /* display */, _Xconst char* /* name */ ); extern XExtCodes *XAddExtension( Display* /* display */ ); extern XExtData *XFindOnExtensionList( XExtData** /* structure */, int /* number */ ); extern XExtData **XEHeadOfExtensionList( XEDataObject /* object */ ); /* these are routines for which there are also macros */ extern Window XRootWindow( Display* /* display */, int /* screen_number */ ); extern Window XDefaultRootWindow( Display* /* display */ ); extern Window XRootWindowOfScreen( Screen* /* screen */ ); extern Visual *XDefaultVisual( Display* /* display */, int /* screen_number */ ); extern Visual *XDefaultVisualOfScreen( Screen* /* screen */ ); extern GC XDefaultGC( Display* /* display */, int /* screen_number */ ); extern GC XDefaultGCOfScreen( Screen* /* screen */ ); extern unsigned long XBlackPixel( Display* /* display */, int /* screen_number */ ); extern unsigned long XWhitePixel( Display* /* display */, int /* screen_number */ ); extern unsigned long XAllPlanes( void ); extern unsigned long XBlackPixelOfScreen( Screen* /* screen */ ); extern unsigned long XWhitePixelOfScreen( Screen* /* screen */ ); extern unsigned long XNextRequest( Display* /* display */ ); extern unsigned long XLastKnownRequestProcessed( Display* /* display */ ); extern char *XServerVendor( Display* /* display */ ); extern char *XDisplayString( Display* /* display */ ); extern Colormap XDefaultColormap( Display* /* display */, int /* screen_number */ ); extern Colormap XDefaultColormapOfScreen( Screen* /* screen */ ); extern Display *XDisplayOfScreen( Screen* /* screen */ ); extern Screen *XScreenOfDisplay( Display* /* display */, int /* screen_number */ ); extern Screen *XDefaultScreenOfDisplay( Display* /* display */ ); extern long XEventMaskOfScreen( Screen* /* screen */ ); extern int XScreenNumberOfScreen( Screen* /* screen */ ); typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */ Display* /* display */, XErrorEvent* /* error_event */ ); extern XErrorHandler XSetErrorHandler ( XErrorHandler /* handler */ ); typedef int (*XIOErrorHandler) ( /* WARNING, this type not in Xlib spec */ Display* /* display */ ); extern XIOErrorHandler XSetIOErrorHandler ( XIOErrorHandler /* handler */ ); extern XPixmapFormatValues *XListPixmapFormats( Display* /* display */, int* /* count_return */ ); extern int *XListDepths( Display* /* display */, int /* screen_number */, int* /* count_return */ ); /* ICCCM routines for things that don't require special include files; */ /* other declarations are given in Xutil.h */ extern Status XReconfigureWMWindow( Display* /* display */, Window /* w */, int /* screen_number */, unsigned int /* mask */, XWindowChanges* /* changes */ ); extern Status XGetWMProtocols( Display* /* display */, Window /* w */, Atom** /* protocols_return */, int* /* count_return */ ); extern Status XSetWMProtocols( Display* /* display */, Window /* w */, Atom* /* protocols */, int /* count */ ); extern Status XIconifyWindow( Display* /* display */, Window /* w */, int /* screen_number */ ); extern Status XWithdrawWindow( Display* /* display */, Window /* w */, int /* screen_number */ ); extern Status XGetCommand( Display* /* display */, Window /* w */, char*** /* argv_return */, int* /* argc_return */ ); extern Status XGetWMColormapWindows( Display* /* display */, Window /* w */, Window** /* windows_return */, int* /* count_return */ ); extern Status XSetWMColormapWindows( Display* /* display */, Window /* w */, Window* /* colormap_windows */, int /* count */ ); extern void XFreeStringList( char** /* list */ ); extern int XSetTransientForHint( Display* /* display */, Window /* w */, Window /* prop_window */ ); /* The following are given in alphabetical order */ extern int XActivateScreenSaver( Display* /* display */ ); extern int XAddHost( Display* /* display */, XHostAddress* /* host */ ); extern int XAddHosts( Display* /* display */, XHostAddress* /* hosts */, int /* num_hosts */ ); extern int XAddToExtensionList( struct _XExtData** /* structure */, XExtData* /* ext_data */ ); extern int XAddToSaveSet( Display* /* display */, Window /* w */ ); extern Status XAllocColor( Display* /* display */, Colormap /* colormap */, XColor* /* screen_in_out */ ); extern Status XAllocColorCells( Display* /* display */, Colormap /* colormap */, Bool /* contig */, unsigned long* /* plane_masks_return */, unsigned int /* nplanes */, unsigned long* /* pixels_return */, unsigned int /* npixels */ ); extern Status XAllocColorPlanes( Display* /* display */, Colormap /* colormap */, Bool /* contig */, unsigned long* /* pixels_return */, int /* ncolors */, int /* nreds */, int /* ngreens */, int /* nblues */, unsigned long* /* rmask_return */, unsigned long* /* gmask_return */, unsigned long* /* bmask_return */ ); extern Status XAllocNamedColor( Display* /* display */, Colormap /* colormap */, _Xconst char* /* color_name */, XColor* /* screen_def_return */, XColor* /* exact_def_return */ ); extern int XAllowEvents( Display* /* display */, int /* event_mode */, Time /* time */ ); extern int XAutoRepeatOff( Display* /* display */ ); extern int XAutoRepeatOn( Display* /* display */ ); extern int XBell( Display* /* display */, int /* percent */ ); extern int XBitmapBitOrder( Display* /* display */ ); extern int XBitmapPad( Display* /* display */ ); extern int XBitmapUnit( Display* /* display */ ); extern int XCellsOfScreen( Screen* /* screen */ ); extern int XChangeActivePointerGrab( Display* /* display */, unsigned int /* event_mask */, Cursor /* cursor */, Time /* time */ ); extern int XChangeGC( Display* /* display */, GC /* gc */, unsigned long /* valuemask */, XGCValues* /* values */ ); extern int XChangeKeyboardControl( Display* /* display */, unsigned long /* value_mask */, XKeyboardControl* /* values */ ); extern int XChangeKeyboardMapping( Display* /* display */, int /* first_keycode */, int /* keysyms_per_keycode */, KeySym* /* keysyms */, int /* num_codes */ ); extern int XChangePointerControl( Display* /* display */, Bool /* do_accel */, Bool /* do_threshold */, int /* accel_numerator */, int /* accel_denominator */, int /* threshold */ ); extern int XChangeProperty( Display* /* display */, Window /* w */, Atom /* property */, Atom /* type */, int /* format */, int /* mode */, _Xconst unsigned char* /* data */, int /* nelements */ ); extern int XChangeSaveSet( Display* /* display */, Window /* w */, int /* change_mode */ ); extern int XChangeWindowAttributes( Display* /* display */, Window /* w */, unsigned long /* valuemask */, XSetWindowAttributes* /* attributes */ ); extern Bool XCheckIfEvent( Display* /* display */, XEvent* /* event_return */, Bool (*) ( Display* /* display */, XEvent* /* event */, XPointer /* arg */ ) /* predicate */, XPointer /* arg */ ); #ifdef NX_TRANS_SOCKET /* * This is just like XCheckIfEvent() but doesn't * flush the output buffer if it can't read new * events. */ extern Bool XCheckIfEventNoFlush( Display* /* display */, XEvent* /* event_return */, Bool (*) ( Display* /* display */, XEvent* /* event */, XPointer /* arg */ ) /* predicate */, XPointer /* arg */ ); #endif extern Bool XCheckMaskEvent( Display* /* display */, long /* event_mask */, XEvent* /* event_return */ ); extern Bool XCheckTypedEvent( Display* /* display */, int /* event_type */, XEvent* /* event_return */ ); extern Bool XCheckTypedWindowEvent( Display* /* display */, Window /* w */, int /* event_type */, XEvent* /* event_return */ ); extern Bool XCheckWindowEvent( Display* /* display */, Window /* w */, long /* event_mask */, XEvent* /* event_return */ ); extern int XCirculateSubwindows( Display* /* display */, Window /* w */, int /* direction */ ); extern int XCirculateSubwindowsDown( Display* /* display */, Window /* w */ ); extern int XCirculateSubwindowsUp( Display* /* display */, Window /* w */ ); extern int XClearArea( Display* /* display */, Window /* w */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, Bool /* exposures */ ); extern int XClearWindow( Display* /* display */, Window /* w */ ); extern int XCloseDisplay( Display* /* display */ ); extern int XConfigureWindow( Display* /* display */, Window /* w */, unsigned int /* value_mask */, XWindowChanges* /* values */ ); extern int XConnectionNumber( Display* /* display */ ); extern int XConvertSelection( Display* /* display */, Atom /* selection */, Atom /* target */, Atom /* property */, Window /* requestor */, Time /* time */ ); extern int XCopyArea( Display* /* display */, Drawable /* src */, Drawable /* dest */, GC /* gc */, int /* src_x */, int /* src_y */, unsigned int /* width */, unsigned int /* height */, int /* dest_x */, int /* dest_y */ ); extern int XCopyGC( Display* /* display */, GC /* src */, unsigned long /* valuemask */, GC /* dest */ ); extern int XCopyPlane( Display* /* display */, Drawable /* src */, Drawable /* dest */, GC /* gc */, int /* src_x */, int /* src_y */, unsigned int /* width */, unsigned int /* height */, int /* dest_x */, int /* dest_y */, unsigned long /* plane */ ); extern int XDefaultDepth( Display* /* display */, int /* screen_number */ ); extern int XDefaultDepthOfScreen( Screen* /* screen */ ); extern int XDefaultScreen( Display* /* display */ ); extern int XDefineCursor( Display* /* display */, Window /* w */, Cursor /* cursor */ ); extern int XDeleteProperty( Display* /* display */, Window /* w */, Atom /* property */ ); extern int XDestroyWindow( Display* /* display */, Window /* w */ ); extern int XDestroySubwindows( Display* /* display */, Window /* w */ ); extern int XDoesBackingStore( Screen* /* screen */ ); extern Bool XDoesSaveUnders( Screen* /* screen */ ); extern int XDisableAccessControl( Display* /* display */ ); extern int XDisplayCells( Display* /* display */, int /* screen_number */ ); extern int XDisplayHeight( Display* /* display */, int /* screen_number */ ); extern int XDisplayHeightMM( Display* /* display */, int /* screen_number */ ); extern int XDisplayKeycodes( Display* /* display */, int* /* min_keycodes_return */, int* /* max_keycodes_return */ ); extern int XDisplayPlanes( Display* /* display */, int /* screen_number */ ); extern int XDisplayWidth( Display* /* display */, int /* screen_number */ ); extern int XDisplayWidthMM( Display* /* display */, int /* screen_number */ ); extern int XDrawArc( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, int /* angle1 */, int /* angle2 */ ); extern int XDrawArcs( Display* /* display */, Drawable /* d */, GC /* gc */, XArc* /* arcs */, int /* narcs */ ); extern int XDrawImageString( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, _Xconst char* /* string */, int /* length */ ); extern int XDrawImageString16( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, _Xconst XChar2b* /* string */, int /* length */ ); extern int XDrawLine( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x1 */, int /* y1 */, int /* x2 */, int /* y2 */ ); extern int XDrawLines( Display* /* display */, Drawable /* d */, GC /* gc */, XPoint* /* points */, int /* npoints */, int /* mode */ ); extern int XDrawPoint( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */ ); extern int XDrawPoints( Display* /* display */, Drawable /* d */, GC /* gc */, XPoint* /* points */, int /* npoints */, int /* mode */ ); extern int XDrawRectangle( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */ ); extern int XDrawRectangles( Display* /* display */, Drawable /* d */, GC /* gc */, XRectangle* /* rectangles */, int /* nrectangles */ ); extern int XDrawSegments( Display* /* display */, Drawable /* d */, GC /* gc */, XSegment* /* segments */, int /* nsegments */ ); extern int XDrawString( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, _Xconst char* /* string */, int /* length */ ); extern int XDrawString16( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, _Xconst XChar2b* /* string */, int /* length */ ); extern int XDrawText( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, XTextItem* /* items */, int /* nitems */ ); extern int XDrawText16( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, XTextItem16* /* items */, int /* nitems */ ); extern int XEnableAccessControl( Display* /* display */ ); extern int XEventsQueued( Display* /* display */, int /* mode */ ); extern Status XFetchName( Display* /* display */, Window /* w */, char** /* window_name_return */ ); extern int XFillArc( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, int /* angle1 */, int /* angle2 */ ); extern int XFillArcs( Display* /* display */, Drawable /* d */, GC /* gc */, XArc* /* arcs */, int /* narcs */ ); extern int XFillPolygon( Display* /* display */, Drawable /* d */, GC /* gc */, XPoint* /* points */, int /* npoints */, int /* shape */, int /* mode */ ); extern int XFillRectangle( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */ ); extern int XFillRectangles( Display* /* display */, Drawable /* d */, GC /* gc */, XRectangle* /* rectangles */, int /* nrectangles */ ); extern int XFlush( Display* /* display */ ); extern int XForceScreenSaver( Display* /* display */, int /* mode */ ); extern int XFree( void* /* data */ ); extern int XFreeColormap( Display* /* display */, Colormap /* colormap */ ); extern int XFreeColors( Display* /* display */, Colormap /* colormap */, unsigned long* /* pixels */, int /* npixels */, unsigned long /* planes */ ); extern int XFreeCursor( Display* /* display */, Cursor /* cursor */ ); extern int XFreeExtensionList( char** /* list */ ); extern int XFreeFont( Display* /* display */, XFontStruct* /* font_struct */ ); extern int XFreeFontInfo( char** /* names */, XFontStruct* /* free_info */, int /* actual_count */ ); extern int XFreeFontNames( char** /* list */ ); extern int XFreeFontPath( char** /* list */ ); extern int XFreeGC( Display* /* display */, GC /* gc */ ); extern int XFreeModifiermap( XModifierKeymap* /* modmap */ ); extern int XFreePixmap( Display* /* display */, Pixmap /* pixmap */ ); extern int XGeometry( Display* /* display */, int /* screen */, _Xconst char* /* position */, _Xconst char* /* default_position */, unsigned int /* bwidth */, unsigned int /* fwidth */, unsigned int /* fheight */, int /* xadder */, int /* yadder */, int* /* x_return */, int* /* y_return */, int* /* width_return */, int* /* height_return */ ); extern int XGetErrorDatabaseText( Display* /* display */, _Xconst char* /* name */, _Xconst char* /* message */, _Xconst char* /* default_string */, char* /* buffer_return */, int /* length */ ); extern int XGetErrorText( Display* /* display */, int /* code */, char* /* buffer_return */, int /* length */ ); extern Bool XGetFontProperty( XFontStruct* /* font_struct */, Atom /* atom */, unsigned long* /* value_return */ ); extern Status XGetGCValues( Display* /* display */, GC /* gc */, unsigned long /* valuemask */, XGCValues* /* values_return */ ); extern Status XGetGeometry( Display* /* display */, Drawable /* d */, Window* /* root_return */, int* /* x_return */, int* /* y_return */, unsigned int* /* width_return */, unsigned int* /* height_return */, unsigned int* /* border_width_return */, unsigned int* /* depth_return */ ); extern Status XGetIconName( Display* /* display */, Window /* w */, char** /* icon_name_return */ ); extern int XGetInputFocus( Display* /* display */, Window* /* focus_return */, int* /* revert_to_return */ ); extern int XGetKeyboardControl( Display* /* display */, XKeyboardState* /* values_return */ ); extern int XGetPointerControl( Display* /* display */, int* /* accel_numerator_return */, int* /* accel_denominator_return */, int* /* threshold_return */ ); extern int XGetPointerMapping( Display* /* display */, unsigned char* /* map_return */, int /* nmap */ ); extern int XGetScreenSaver( Display* /* display */, int* /* timeout_return */, int* /* interval_return */, int* /* prefer_blanking_return */, int* /* allow_exposures_return */ ); extern Status XGetTransientForHint( Display* /* display */, Window /* w */, Window* /* prop_window_return */ ); extern int XGetWindowProperty( Display* /* display */, Window /* w */, Atom /* property */, long /* long_offset */, long /* long_length */, Bool /* delete */, Atom /* req_type */, Atom* /* actual_type_return */, int* /* actual_format_return */, unsigned long* /* nitems_return */, unsigned long* /* bytes_after_return */, unsigned char** /* prop_return */ ); extern Status XGetWindowAttributes( Display* /* display */, Window /* w */, XWindowAttributes* /* window_attributes_return */ ); extern int XGrabButton( Display* /* display */, unsigned int /* button */, unsigned int /* modifiers */, Window /* grab_window */, Bool /* owner_events */, unsigned int /* event_mask */, int /* pointer_mode */, int /* keyboard_mode */, Window /* confine_to */, Cursor /* cursor */ ); extern int XGrabKey( Display* /* display */, int /* keycode */, unsigned int /* modifiers */, Window /* grab_window */, Bool /* owner_events */, int /* pointer_mode */, int /* keyboard_mode */ ); extern int XGrabKeyboard( Display* /* display */, Window /* grab_window */, Bool /* owner_events */, int /* pointer_mode */, int /* keyboard_mode */, Time /* time */ ); extern int XGrabPointer( Display* /* display */, Window /* grab_window */, Bool /* owner_events */, unsigned int /* event_mask */, int /* pointer_mode */, int /* keyboard_mode */, Window /* confine_to */, Cursor /* cursor */, Time /* time */ ); extern int XGrabServer( Display* /* display */ ); extern int XHeightMMOfScreen( Screen* /* screen */ ); extern int XHeightOfScreen( Screen* /* screen */ ); extern int XIfEvent( Display* /* display */, XEvent* /* event_return */, Bool (*) ( Display* /* display */, XEvent* /* event */, XPointer /* arg */ ) /* predicate */, XPointer /* arg */ ); extern int XImageByteOrder( Display* /* display */ ); extern int XInstallColormap( Display* /* display */, Colormap /* colormap */ ); extern KeyCode XKeysymToKeycode( Display* /* display */, KeySym /* keysym */ ); extern int XKillClient( Display* /* display */, XID /* resource */ ); extern Status XLookupColor( Display* /* display */, Colormap /* colormap */, _Xconst char* /* color_name */, XColor* /* exact_def_return */, XColor* /* screen_def_return */ ); extern int XLowerWindow( Display* /* display */, Window /* w */ ); extern int XMapRaised( Display* /* display */, Window /* w */ ); extern int XMapSubwindows( Display* /* display */, Window /* w */ ); extern int XMapWindow( Display* /* display */, Window /* w */ ); extern int XMaskEvent( Display* /* display */, long /* event_mask */, XEvent* /* event_return */ ); extern int XMaxCmapsOfScreen( Screen* /* screen */ ); extern int XMinCmapsOfScreen( Screen* /* screen */ ); extern int XMoveResizeWindow( Display* /* display */, Window /* w */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */ ); extern int XMoveWindow( Display* /* display */, Window /* w */, int /* x */, int /* y */ ); extern int XNextEvent( Display* /* display */, XEvent* /* event_return */ ); extern int XNoOp( Display* /* display */ ); extern Status XParseColor( Display* /* display */, Colormap /* colormap */, _Xconst char* /* spec */, XColor* /* exact_def_return */ ); extern int XParseGeometry( _Xconst char* /* parsestring */, int* /* x_return */, int* /* y_return */, unsigned int* /* width_return */, unsigned int* /* height_return */ ); extern int XPeekEvent( Display* /* display */, XEvent* /* event_return */ ); extern int XPeekIfEvent( Display* /* display */, XEvent* /* event_return */, Bool (*) ( Display* /* display */, XEvent* /* event */, XPointer /* arg */ ) /* predicate */, XPointer /* arg */ ); extern int XPending( Display* /* display */ ); extern int XPlanesOfScreen( Screen* /* screen */ ); extern int XProtocolRevision( Display* /* display */ ); extern int XProtocolVersion( Display* /* display */ ); extern int XPutBackEvent( Display* /* display */, XEvent* /* event */ ); extern int XPutImage( Display* /* display */, Drawable /* d */, GC /* gc */, XImage* /* image */, int /* src_x */, int /* src_y */, int /* dest_x */, int /* dest_y */, unsigned int /* width */, unsigned int /* height */ ); extern int XQLength( Display* /* display */ ); extern Status XQueryBestCursor( Display* /* display */, Drawable /* d */, unsigned int /* width */, unsigned int /* height */, unsigned int* /* width_return */, unsigned int* /* height_return */ ); extern Status XQueryBestSize( Display* /* display */, int /* class */, Drawable /* which_screen */, unsigned int /* width */, unsigned int /* height */, unsigned int* /* width_return */, unsigned int* /* height_return */ ); extern Status XQueryBestStipple( Display* /* display */, Drawable /* which_screen */, unsigned int /* width */, unsigned int /* height */, unsigned int* /* width_return */, unsigned int* /* height_return */ ); extern Status XQueryBestTile( Display* /* display */, Drawable /* which_screen */, unsigned int /* width */, unsigned int /* height */, unsigned int* /* width_return */, unsigned int* /* height_return */ ); extern int XQueryColor( Display* /* display */, Colormap /* colormap */, XColor* /* def_in_out */ ); extern int XQueryColors( Display* /* display */, Colormap /* colormap */, XColor* /* defs_in_out */, int /* ncolors */ ); extern Bool XQueryExtension( Display* /* display */, _Xconst char* /* name */, int* /* major_opcode_return */, int* /* first_event_return */, int* /* first_error_return */ ); extern int XQueryKeymap( Display* /* display */, char [32] /* keys_return */ ); extern Bool XQueryPointer( Display* /* display */, Window /* w */, Window* /* root_return */, Window* /* child_return */, int* /* root_x_return */, int* /* root_y_return */, int* /* win_x_return */, int* /* win_y_return */, unsigned int* /* mask_return */ ); extern int XQueryTextExtents( Display* /* display */, XID /* font_ID */, _Xconst char* /* string */, int /* nchars */, int* /* direction_return */, int* /* font_ascent_return */, int* /* font_descent_return */, XCharStruct* /* overall_return */ ); extern int XQueryTextExtents16( Display* /* display */, XID /* font_ID */, _Xconst XChar2b* /* string */, int /* nchars */, int* /* direction_return */, int* /* font_ascent_return */, int* /* font_descent_return */, XCharStruct* /* overall_return */ ); extern Status XQueryTree( Display* /* display */, Window /* w */, Window* /* root_return */, Window* /* parent_return */, Window** /* children_return */, unsigned int* /* nchildren_return */ ); extern int XRaiseWindow( Display* /* display */, Window /* w */ ); extern int XReadBitmapFile( Display* /* display */, Drawable /* d */, _Xconst char* /* filename */, unsigned int* /* width_return */, unsigned int* /* height_return */, Pixmap* /* bitmap_return */, int* /* x_hot_return */, int* /* y_hot_return */ ); extern int XReadBitmapFileData( _Xconst char* /* filename */, unsigned int* /* width_return */, unsigned int* /* height_return */, unsigned char** /* data_return */, int* /* x_hot_return */, int* /* y_hot_return */ ); extern int XRebindKeysym( Display* /* display */, KeySym /* keysym */, KeySym* /* list */, int /* mod_count */, _Xconst unsigned char* /* string */, int /* bytes_string */ ); extern int XRecolorCursor( Display* /* display */, Cursor /* cursor */, XColor* /* foreground_color */, XColor* /* background_color */ ); extern int XRefreshKeyboardMapping( XMappingEvent* /* event_map */ ); extern int XRemoveFromSaveSet( Display* /* display */, Window /* w */ ); extern int XRemoveHost( Display* /* display */, XHostAddress* /* host */ ); extern int XRemoveHosts( Display* /* display */, XHostAddress* /* hosts */, int /* num_hosts */ ); extern int XReparentWindow( Display* /* display */, Window /* w */, Window /* parent */, int /* x */, int /* y */ ); extern int XResetScreenSaver( Display* /* display */ ); extern int XResizeWindow( Display* /* display */, Window /* w */, unsigned int /* width */, unsigned int /* height */ ); extern int XRestackWindows( Display* /* display */, Window* /* windows */, int /* nwindows */ ); extern int XRotateBuffers( Display* /* display */, int /* rotate */ ); extern int XRotateWindowProperties( Display* /* display */, Window /* w */, Atom* /* properties */, int /* num_prop */, int /* npositions */ ); extern int XScreenCount( Display* /* display */ ); extern int XSelectInput( Display* /* display */, Window /* w */, long /* event_mask */ ); extern Status XSendEvent( Display* /* display */, Window /* w */, Bool /* propagate */, long /* event_mask */, XEvent* /* event_send */ ); extern int XSetAccessControl( Display* /* display */, int /* mode */ ); extern int XSetArcMode( Display* /* display */, GC /* gc */, int /* arc_mode */ ); extern int XSetBackground( Display* /* display */, GC /* gc */, unsigned long /* background */ ); extern int XSetClipMask( Display* /* display */, GC /* gc */, Pixmap /* pixmap */ ); extern int XSetClipOrigin( Display* /* display */, GC /* gc */, int /* clip_x_origin */, int /* clip_y_origin */ ); extern int XSetClipRectangles( Display* /* display */, GC /* gc */, int /* clip_x_origin */, int /* clip_y_origin */, XRectangle* /* rectangles */, int /* n */, int /* ordering */ ); extern int XSetCloseDownMode( Display* /* display */, int /* close_mode */ ); extern int XSetCommand( Display* /* display */, Window /* w */, char** /* argv */, int /* argc */ ); extern int XSetDashes( Display* /* display */, GC /* gc */, int /* dash_offset */, _Xconst char* /* dash_list */, int /* n */ ); extern int XSetFillRule( Display* /* display */, GC /* gc */, int /* fill_rule */ ); extern int XSetFillStyle( Display* /* display */, GC /* gc */, int /* fill_style */ ); extern int XSetFont( Display* /* display */, GC /* gc */, Font /* font */ ); extern int XSetFontPath( Display* /* display */, char** /* directories */, int /* ndirs */ ); extern int XSetForeground( Display* /* display */, GC /* gc */, unsigned long /* foreground */ ); extern int XSetFunction( Display* /* display */, GC /* gc */, int /* function */ ); extern int XSetGraphicsExposures( Display* /* display */, GC /* gc */, Bool /* graphics_exposures */ ); extern int XSetIconName( Display* /* display */, Window /* w */, _Xconst char* /* icon_name */ ); extern int XSetInputFocus( Display* /* display */, Window /* focus */, int /* revert_to */, Time /* time */ ); extern int XSetLineAttributes( Display* /* display */, GC /* gc */, unsigned int /* line_width */, int /* line_style */, int /* cap_style */, int /* join_style */ ); extern int XSetModifierMapping( Display* /* display */, XModifierKeymap* /* modmap */ ); extern int XSetPlaneMask( Display* /* display */, GC /* gc */, unsigned long /* plane_mask */ ); extern int XSetPointerMapping( Display* /* display */, _Xconst unsigned char* /* map */, int /* nmap */ ); extern int XSetScreenSaver( Display* /* display */, int /* timeout */, int /* interval */, int /* prefer_blanking */, int /* allow_exposures */ ); extern int XSetSelectionOwner( Display* /* display */, Atom /* selection */, Window /* owner */, Time /* time */ ); extern int XSetState( Display* /* display */, GC /* gc */, unsigned long /* foreground */, unsigned long /* background */, int /* function */, unsigned long /* plane_mask */ ); extern int XSetStipple( Display* /* display */, GC /* gc */, Pixmap /* stipple */ ); extern int XSetSubwindowMode( Display* /* display */, GC /* gc */, int /* subwindow_mode */ ); extern int XSetTSOrigin( Display* /* display */, GC /* gc */, int /* ts_x_origin */, int /* ts_y_origin */ ); extern int XSetTile( Display* /* display */, GC /* gc */, Pixmap /* tile */ ); extern int XSetWindowBackground( Display* /* display */, Window /* w */, unsigned long /* background_pixel */ ); extern int XSetWindowBackgroundPixmap( Display* /* display */, Window /* w */, Pixmap /* background_pixmap */ ); extern int XSetWindowBorder( Display* /* display */, Window /* w */, unsigned long /* border_pixel */ ); extern int XSetWindowBorderPixmap( Display* /* display */, Window /* w */, Pixmap /* border_pixmap */ ); extern int XSetWindowBorderWidth( Display* /* display */, Window /* w */, unsigned int /* width */ ); extern int XSetWindowColormap( Display* /* display */, Window /* w */, Colormap /* colormap */ ); extern int XStoreBuffer( Display* /* display */, _Xconst char* /* bytes */, int /* nbytes */, int /* buffer */ ); extern int XStoreBytes( Display* /* display */, _Xconst char* /* bytes */, int /* nbytes */ ); extern int XStoreColor( Display* /* display */, Colormap /* colormap */, XColor* /* color */ ); extern int XStoreColors( Display* /* display */, Colormap /* colormap */, XColor* /* color */, int /* ncolors */ ); extern int XStoreName( Display* /* display */, Window /* w */, _Xconst char* /* window_name */ ); extern int XStoreNamedColor( Display* /* display */, Colormap /* colormap */, _Xconst char* /* color */, unsigned long /* pixel */, int /* flags */ ); extern int XSync( Display* /* display */, Bool /* discard */ ); extern int XTextExtents( XFontStruct* /* font_struct */, _Xconst char* /* string */, int /* nchars */, int* /* direction_return */, int* /* font_ascent_return */, int* /* font_descent_return */, XCharStruct* /* overall_return */ ); extern int XTextExtents16( XFontStruct* /* font_struct */, _Xconst XChar2b* /* string */, int /* nchars */, int* /* direction_return */, int* /* font_ascent_return */, int* /* font_descent_return */, XCharStruct* /* overall_return */ ); extern int XTextWidth( XFontStruct* /* font_struct */, _Xconst char* /* string */, int /* count */ ); extern int XTextWidth16( XFontStruct* /* font_struct */, _Xconst XChar2b* /* string */, int /* count */ ); extern Bool XTranslateCoordinates( Display* /* display */, Window /* src_w */, Window /* dest_w */, int /* src_x */, int /* src_y */, int* /* dest_x_return */, int* /* dest_y_return */, Window* /* child_return */ ); extern int XUndefineCursor( Display* /* display */, Window /* w */ ); extern int XUngrabButton( Display* /* display */, unsigned int /* button */, unsigned int /* modifiers */, Window /* grab_window */ ); extern int XUngrabKey( Display* /* display */, int /* keycode */, unsigned int /* modifiers */, Window /* grab_window */ ); extern int XUngrabKeyboard( Display* /* display */, Time /* time */ ); extern int XUngrabPointer( Display* /* display */, Time /* time */ ); extern int XUngrabServer( Display* /* display */ ); extern int XUninstallColormap( Display* /* display */, Colormap /* colormap */ ); extern int XUnloadFont( Display* /* display */, Font /* font */ ); extern int XUnmapSubwindows( Display* /* display */, Window /* w */ ); extern int XUnmapWindow( Display* /* display */, Window /* w */ ); extern int XVendorRelease( Display* /* display */ ); extern int XWarpPointer( Display* /* display */, Window /* src_w */, Window /* dest_w */, int /* src_x */, int /* src_y */, unsigned int /* src_width */, unsigned int /* src_height */, int /* dest_x */, int /* dest_y */ ); extern int XWidthMMOfScreen( Screen* /* screen */ ); extern int XWidthOfScreen( Screen* /* screen */ ); extern int XWindowEvent( Display* /* display */, Window /* w */, long /* event_mask */, XEvent* /* event_return */ ); extern int XWriteBitmapFile( Display* /* display */, _Xconst char* /* filename */, Pixmap /* bitmap */, unsigned int /* width */, unsigned int /* height */, int /* x_hot */, int /* y_hot */ ); extern Bool XSupportsLocale (void); extern char *XSetLocaleModifiers( const char* /* modifier_list */ ); extern XOM XOpenOM( Display* /* display */, struct _XrmHashBucketRec* /* rdb */, _Xconst char* /* res_name */, _Xconst char* /* res_class */ ); extern Status XCloseOM( XOM /* om */ ); extern char *XSetOMValues( XOM /* om */, ... ) _X_SENTINEL(0); extern char *XGetOMValues( XOM /* om */, ... ) _X_SENTINEL(0); extern Display *XDisplayOfOM( XOM /* om */ ); extern char *XLocaleOfOM( XOM /* om */ ); extern XOC XCreateOC( XOM /* om */, ... ) _X_SENTINEL(0); extern void XDestroyOC( XOC /* oc */ ); extern XOM XOMOfOC( XOC /* oc */ ); extern char *XSetOCValues( XOC /* oc */, ... ) _X_SENTINEL(0); extern char *XGetOCValues( XOC /* oc */, ... ) _X_SENTINEL(0); extern XFontSet XCreateFontSet( Display* /* display */, _Xconst char* /* base_font_name_list */, char*** /* missing_charset_list */, int* /* missing_charset_count */, char** /* def_string */ ); extern void XFreeFontSet( Display* /* display */, XFontSet /* font_set */ ); extern int XFontsOfFontSet( XFontSet /* font_set */, XFontStruct*** /* font_struct_list */, char*** /* font_name_list */ ); extern char *XBaseFontNameListOfFontSet( XFontSet /* font_set */ ); extern char *XLocaleOfFontSet( XFontSet /* font_set */ ); extern Bool XContextDependentDrawing( XFontSet /* font_set */ ); extern Bool XDirectionalDependentDrawing( XFontSet /* font_set */ ); extern Bool XContextualDrawing( XFontSet /* font_set */ ); extern XFontSetExtents *XExtentsOfFontSet( XFontSet /* font_set */ ); extern int XmbTextEscapement( XFontSet /* font_set */, _Xconst char* /* text */, int /* bytes_text */ ); extern int XwcTextEscapement( XFontSet /* font_set */, _Xconst wchar_t* /* text */, int /* num_wchars */ ); extern int Xutf8TextEscapement( XFontSet /* font_set */, _Xconst char* /* text */, int /* bytes_text */ ); extern int XmbTextExtents( XFontSet /* font_set */, _Xconst char* /* text */, int /* bytes_text */, XRectangle* /* overall_ink_return */, XRectangle* /* overall_logical_return */ ); extern int XwcTextExtents( XFontSet /* font_set */, _Xconst wchar_t* /* text */, int /* num_wchars */, XRectangle* /* overall_ink_return */, XRectangle* /* overall_logical_return */ ); extern int Xutf8TextExtents( XFontSet /* font_set */, _Xconst char* /* text */, int /* bytes_text */, XRectangle* /* overall_ink_return */, XRectangle* /* overall_logical_return */ ); extern Status XmbTextPerCharExtents( XFontSet /* font_set */, _Xconst char* /* text */, int /* bytes_text */, XRectangle* /* ink_extents_buffer */, XRectangle* /* logical_extents_buffer */, int /* buffer_size */, int* /* num_chars */, XRectangle* /* overall_ink_return */, XRectangle* /* overall_logical_return */ ); extern Status XwcTextPerCharExtents( XFontSet /* font_set */, _Xconst wchar_t* /* text */, int /* num_wchars */, XRectangle* /* ink_extents_buffer */, XRectangle* /* logical_extents_buffer */, int /* buffer_size */, int* /* num_chars */, XRectangle* /* overall_ink_return */, XRectangle* /* overall_logical_return */ ); extern Status Xutf8TextPerCharExtents( XFontSet /* font_set */, _Xconst char* /* text */, int /* bytes_text */, XRectangle* /* ink_extents_buffer */, XRectangle* /* logical_extents_buffer */, int /* buffer_size */, int* /* num_chars */, XRectangle* /* overall_ink_return */, XRectangle* /* overall_logical_return */ ); extern void XmbDrawText( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, XmbTextItem* /* text_items */, int /* nitems */ ); extern void XwcDrawText( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, XwcTextItem* /* text_items */, int /* nitems */ ); extern void Xutf8DrawText( Display* /* display */, Drawable /* d */, GC /* gc */, int /* x */, int /* y */, XmbTextItem* /* text_items */, int /* nitems */ ); extern void XmbDrawString( Display* /* display */, Drawable /* d */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst char* /* text */, int /* bytes_text */ ); extern void XwcDrawString( Display* /* display */, Drawable /* d */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst wchar_t* /* text */, int /* num_wchars */ ); extern void Xutf8DrawString( Display* /* display */, Drawable /* d */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst char* /* text */, int /* bytes_text */ ); extern void XmbDrawImageString( Display* /* display */, Drawable /* d */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst char* /* text */, int /* bytes_text */ ); extern void XwcDrawImageString( Display* /* display */, Drawable /* d */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst wchar_t* /* text */, int /* num_wchars */ ); extern void Xutf8DrawImageString( Display* /* display */, Drawable /* d */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst char* /* text */, int /* bytes_text */ ); extern XIM XOpenIM( Display* /* dpy */, struct _XrmHashBucketRec* /* rdb */, char* /* res_name */, char* /* res_class */ ); extern Status XCloseIM( XIM /* im */ ); extern char *XGetIMValues( XIM /* im */, ... ) _X_SENTINEL(0); extern char *XSetIMValues( XIM /* im */, ... ) _X_SENTINEL(0); extern Display *XDisplayOfIM( XIM /* im */ ); extern char *XLocaleOfIM( XIM /* im*/ ); extern XIC XCreateIC( XIM /* im */, ... ) _X_SENTINEL(0); extern void XDestroyIC( XIC /* ic */ ); extern void XSetICFocus( XIC /* ic */ ); extern void XUnsetICFocus( XIC /* ic */ ); extern wchar_t *XwcResetIC( XIC /* ic */ ); extern char *XmbResetIC( XIC /* ic */ ); extern char *Xutf8ResetIC( XIC /* ic */ ); extern char *XSetICValues( XIC /* ic */, ... ) _X_SENTINEL(0); extern char *XGetICValues( XIC /* ic */, ... ) _X_SENTINEL(0); extern XIM XIMOfIC( XIC /* ic */ ); extern Bool XFilterEvent( XEvent* /* event */, Window /* window */ ); extern int XmbLookupString( XIC /* ic */, XKeyPressedEvent* /* event */, char* /* buffer_return */, int /* bytes_buffer */, KeySym* /* keysym_return */, Status* /* status_return */ ); extern int XwcLookupString( XIC /* ic */, XKeyPressedEvent* /* event */, wchar_t* /* buffer_return */, int /* wchars_buffer */, KeySym* /* keysym_return */, Status* /* status_return */ ); extern int Xutf8LookupString( XIC /* ic */, XKeyPressedEvent* /* event */, char* /* buffer_return */, int /* bytes_buffer */, KeySym* /* keysym_return */, Status* /* status_return */ ); extern XVaNestedList XVaCreateNestedList( int /*unused*/, ... ) _X_SENTINEL(0); /* internal connections for IMs */ extern Bool XRegisterIMInstantiateCallback( Display* /* dpy */, struct _XrmHashBucketRec* /* rdb */, char* /* res_name */, char* /* res_class */, XIDProc /* callback */, XPointer /* client_data */ ); extern Bool XUnregisterIMInstantiateCallback( Display* /* dpy */, struct _XrmHashBucketRec* /* rdb */, char* /* res_name */, char* /* res_class */, XIDProc /* callback */, XPointer /* client_data */ ); typedef void (*XConnectionWatchProc)( Display* /* dpy */, XPointer /* client_data */, int /* fd */, Bool /* opening */, /* open or close flag */ XPointer* /* watch_data */ /* open sets, close uses */ ); extern Status XInternalConnectionNumbers( Display* /* dpy */, int** /* fd_return */, int* /* count_return */ ); extern void XProcessInternalConnection( Display* /* dpy */, int /* fd */ ); extern Status XAddConnectionWatch( Display* /* dpy */, XConnectionWatchProc /* callback */, XPointer /* client_data */ ); extern void XRemoveConnectionWatch( Display* /* dpy */, XConnectionWatchProc /* callback */, XPointer /* client_data */ ); extern void XSetAuthorization( char * /* name */, int /* namelen */, char * /* data */, int /* datalen */ ); extern int _Xmbtowc( wchar_t * /* wstr */, char * /* str */, int /* len */ ); extern int _Xwctomb( char * /* str */, wchar_t /* wc */ ); extern Bool XGetEventData( Display* /* dpy */, XGenericEventCookie* /* cookie*/ ); extern void XFreeEventData( Display* /* dpy */, XGenericEventCookie* /* cookie*/ ); #ifdef __clang__ #pragma clang diagnostic pop #endif _XFUNCPROTOEND #endif /* #if !defined(_X11_XLIB_H_) && !defined(_XLIB_H_) */ nx-libs-3.5.99.23/nx-X11/lib/include/X11/Xlibint.h0000644000000000000000000012312413614532331015632 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1984, 1985, 1987, 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #if !defined(_X11_XLIBINT_H_) && !defined(_XLIBINT_H_) #define _X11_XLIBINT_H_ #define _XLIBINT_H_ /* * Xlibint.h - Header definition and support file for the internal * support routines used by the C subroutine interface * library (Xlib) to the X Window System. * * Warning, there be dragons here.... */ #include #include #include /* to declare xEvent */ #include /* for configured options like XTHREADS */ /* The Xlib structs are full of implicit padding to properly align members. We can't clean that up without breaking ABI, so tell clang not to bother complaining about it. */ #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif #ifdef NX_TRANS_SOCKET #include #define _XGetIOError(dpy) \ (dpy -> flags & XlibDisplayIOError) #endif #ifdef WIN32 #define _XFlush _XFlushIt #endif struct _XGC { XExtData *ext_data; /* hook for extension to hang data */ GContext gid; /* protocol ID for graphics context */ Bool rects; /* boolean: TRUE if clipmask is list of rectangles */ Bool dashes; /* boolean: TRUE if dash-list is really a list */ unsigned long dirty;/* cache dirty bits */ XGCValues values; /* shadow structure of values */ }; struct _XDisplay { XExtData *ext_data; /* hook for extension to hang data */ struct _XFreeFuncs *free_funcs; /* internal free functions */ int fd; /* Network socket. */ int conn_checker; /* ugly thing used by _XEventsQueued */ int proto_major_version;/* maj. version of server's X protocol */ int proto_minor_version;/* minor version of server's X protocol */ char *vendor; /* vendor of the server hardware */ XID resource_base; /* resource ID base */ XID resource_mask; /* resource ID mask bits */ XID resource_id; /* allocator current ID */ int resource_shift; /* allocator shift to correct bits */ XID (*resource_alloc)( /* allocator function */ struct _XDisplay* ); int byte_order; /* screen byte order, LSBFirst, MSBFirst */ int bitmap_unit; /* padding and data requirements */ int bitmap_pad; /* padding requirements on bitmaps */ int bitmap_bit_order; /* LeastSignificant or MostSignificant */ int nformats; /* number of pixmap formats in list */ ScreenFormat *pixmap_format; /* pixmap format list */ int vnumber; /* Xlib's X protocol version number. */ int release; /* release of the server */ struct _XSQEvent *head, *tail; /* Input event queue. */ int qlen; /* Length of input event queue */ unsigned long last_request_read; /* seq number of last event read */ unsigned long request; /* sequence number of last request. */ char *last_req; /* beginning of last request, or dummy */ char *buffer; /* Output buffer starting address. */ char *bufptr; /* Output buffer index pointer. */ char *bufmax; /* Output buffer maximum+1 address. */ unsigned max_request_size; /* maximum number 32 bit words in request*/ struct _XrmHashBucketRec *db; int (*synchandler)( /* Synchronization handler */ struct _XDisplay* ); char *display_name; /* "host:display" string used on this connect*/ int default_screen; /* default screen for operations */ int nscreens; /* number of screens on this server*/ Screen *screens; /* pointer to list of screens */ unsigned long motion_buffer; /* size of motion buffer */ volatile unsigned long flags; /* internal connection flags */ int min_keycode; /* minimum defined keycode */ int max_keycode; /* maximum defined keycode */ KeySym *keysyms; /* This server's keysyms */ XModifierKeymap *modifiermap; /* This server's modifier keymap */ int keysyms_per_keycode;/* number of rows */ char *xdefaults; /* contents of defaults from server */ char *scratch_buffer; /* place to hang scratch buffer */ unsigned long scratch_length; /* length of scratch buffer */ int ext_number; /* extension number on this display */ struct _XExten *ext_procs; /* extensions initialized on this display */ /* * the following can be fixed size, as the protocol defines how * much address space is available. * While this could be done using the extension vector, there * may be MANY events processed, so a search through the extension * list to find the right procedure for each event might be * expensive if many extensions are being used. */ Bool (*event_vec[128])( /* vector for wire to event */ Display * /* dpy */, XEvent * /* re */, xEvent * /* event */ ); Status (*wire_vec[128])( /* vector for event to wire */ Display * /* dpy */, XEvent * /* re */, xEvent * /* event */ ); KeySym lock_meaning; /* for XLookupString */ struct _XLockInfo *lock; /* multi-thread state, display lock */ struct _XInternalAsync *async_handlers; /* for internal async */ unsigned long bigreq_size; /* max size of big requests */ struct _XLockPtrs *lock_fns; /* pointers to threads functions */ void (*idlist_alloc)( /* XID list allocator function */ Display * /* dpy */, XID * /* ids */, int /* count */ ); /* things above this line should not move, for binary compatibility */ struct _XKeytrans *key_bindings; /* for XLookupString */ Font cursor_font; /* for XCreateFontCursor */ struct _XDisplayAtoms *atoms; /* for XInternAtom */ unsigned int mode_switch; /* keyboard group modifiers */ unsigned int num_lock; /* keyboard numlock modifiers */ struct _XContextDB *context_db; /* context database */ Bool (**error_vec)( /* vector for wire to error */ Display * /* display */, XErrorEvent * /* he */, xError * /* we */ ); /* * Xcms information */ struct { XPointer defaultCCCs; /* pointer to an array of default XcmsCCC */ XPointer clientCmaps; /* pointer to linked list of XcmsCmapRec */ XPointer perVisualIntensityMaps; /* linked list of XcmsIntensityMap */ } cms; struct _XIMFilter *im_filters; struct _XSQEvent *qfree; /* unallocated event queue elements */ unsigned long next_event_serial_num; /* inserted into next queue elt */ struct _XExten *flushes; /* Flush hooks */ struct _XConnectionInfo *im_fd_info; /* _XRegisterInternalConnection */ int im_fd_length; /* number of im_fd_info */ struct _XConnWatchInfo *conn_watchers; /* XAddConnectionWatch */ int watcher_count; /* number of conn_watchers */ XPointer filedes; /* struct pollfd cache for _XWaitForReadable */ int (*savedsynchandler)( /* user synchandler when Xlib usurps */ Display * /* dpy */ ); XID resource_max; /* allocator max ID */ int xcmisc_opcode; /* major opcode for XC-MISC */ struct _XkbInfoRec *xkb_info; /* XKB info */ struct _XtransConnInfo *trans_conn; /* transport connection object */ struct _X11XCBPrivate *xcb; /* XCB glue private data */ /* Generic event cookie handling */ unsigned int next_cookie; /* next event cookie */ /* vector for wire to generic event, index is (extension - 128) */ Bool (*generic_event_vec[128])( Display * /* dpy */, XGenericEventCookie * /* Xlib event */, xEvent * /* wire event */); /* vector for event copy, index is (extension - 128) */ Bool (*generic_event_copy_vec[128])( Display * /* dpy */, XGenericEventCookie * /* in */, XGenericEventCookie * /* out*/); void *cookiejar; /* cookie events returned but not claimed */ #ifndef LONG64 unsigned long last_request_read_upper32bit; unsigned long request_upper32bit; #endif }; #define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n) /* * access "last_request_read" and "request" with 64bit * warning: the value argument of the SET-macros must not * have any side-effects because it may get called twice. */ #ifndef LONG64 /* accessors for 32-bit unsigned long */ #define X_DPY_GET_REQUEST(dpy) \ ( \ ((uint64_t)(((struct _XDisplay*)dpy)->request)) \ + (((uint64_t)(((struct _XDisplay*)dpy)->request_upper32bit)) << 32) \ ) #define X_DPY_SET_REQUEST(dpy, value) \ ( \ (((struct _XDisplay*)dpy)->request = \ (value) & 0xFFFFFFFFUL), \ (((struct _XDisplay*)dpy)->request_upper32bit = \ ((uint64_t)(value)) >> 32), \ (void)0 /* don't use the result */ \ ) #define X_DPY_GET_LAST_REQUEST_READ(dpy) \ ( \ ((uint64_t)(((struct _XDisplay*)dpy)->last_request_read)) \ + ( \ ((uint64_t)( \ ((struct _XDisplay*)dpy)->last_request_read_upper32bit \ )) << 32 \ ) \ ) #define X_DPY_SET_LAST_REQUEST_READ(dpy, value) \ ( \ (((struct _XDisplay*)dpy)->last_request_read = \ (value) & 0xFFFFFFFFUL), \ (((struct _XDisplay*)dpy)->last_request_read_upper32bit = \ ((uint64_t)(value)) >> 32), \ (void)0 /* don't use the result */ \ ) /* * widen a 32-bit sequence number to a 64 sequence number. * This macro makes the following assumptions: * - ulseq refers to a sequence that has already been sent * - ulseq means the most recent possible sequence number * with these lower 32 bits. * * The following optimization is used: * The comparison result is taken a 0 or 1 to avoid a branch. */ #define X_DPY_WIDEN_UNSIGNED_LONG_SEQ(dpy, ulseq) \ ( \ ((uint64_t)ulseq) \ + \ (( \ ((uint64_t)(((struct _XDisplay*)dpy)->request_upper32bit)) \ - (uint64_t)( \ (ulseq) > (((struct _XDisplay*)dpy)->request) \ ) \ ) << 32) \ ) #define X_DPY_REQUEST_INCREMENT(dpy) \ ( \ ((struct _XDisplay*)dpy)->request++, \ ( \ (((struct _XDisplay*)dpy)->request == 0) ? ( \ ((struct _XDisplay*)dpy)->request_upper32bit++ \ ) : 0 \ ), \ (void)0 /* don't use the result */ \ ) #define X_DPY_REQUEST_DECREMENT(dpy) \ ( \ ( \ (((struct _XDisplay*)dpy)->request == 0) ? (\ ((struct _XDisplay*)dpy)->request--, /* wrap */ \ ((struct _XDisplay*)dpy)->request_upper32bit-- \ ) : ( \ ((struct _XDisplay*)dpy)->request-- \ ) \ ), \ (void)0 /* don't use the result */ \ ) #else /* accessors for 64-bit unsigned long */ #define X_DPY_GET_REQUEST(dpy) \ (((struct _XDisplay*)dpy)->request) #define X_DPY_SET_REQUEST(dpy, value) \ ((struct _XDisplay*)dpy)->request = (value) #define X_DPY_GET_LAST_REQUEST_READ(dpy) \ (((struct _XDisplay*)dpy)->last_request_read) #define X_DPY_SET_LAST_REQUEST_READ(dpy, value) \ ((struct _XDisplay*)dpy)->last_request_read = (value) #define X_DPY_WIDEN_UNSIGNED_LONG_SEQ(dpy, ulseq) ulseq #define X_DPY_REQUEST_INCREMENT(dpy) ((struct _XDisplay*)dpy)->request++ #define X_DPY_REQUEST_DECREMENT(dpy) ((struct _XDisplay*)dpy)->request-- #endif #ifndef _XEVENT_ /* * _QEvent datatype for use in input queueing. */ typedef struct _XSQEvent { struct _XSQEvent *next; XEvent event; unsigned long qserial_num; /* so multi-threaded code can find new ones */ } _XQEvent; #endif #include #include #define _XBCOPYFUNC _Xbcopy #include #include /* Utek leaves kernel macros around in include files (bleah) */ #ifdef dirty #undef dirty #endif #include #include #include _XFUNCPROTOBEGIN /* * The following definitions can be used for locking requests in multi-threaded * address spaces. */ #ifdef XTHREADS /* Author: Stephen Gildea, MIT X Consortium * * declarations for C Threads locking */ typedef struct _LockInfoRec *LockInfoPtr; /* interfaces for locking.c */ struct _XLockPtrs { /* used by all, including extensions; do not move */ void (*lock_display)( Display *dpy #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char *file , int line #endif ); void (*unlock_display)( Display *dpy #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char *file , int line #endif ); }; #if defined(WIN32) && !defined(_XLIBINT_) #define _XCreateMutex_fn (*_XCreateMutex_fn_p) #define _XFreeMutex_fn (*_XFreeMutex_fn_p) #define _XLockMutex_fn (*_XLockMutex_fn_p) #define _XUnlockMutex_fn (*_XUnlockMutex_fn_p) #define _Xglobal_lock (*_Xglobal_lock_p) #endif /* in XlibInt.c */ extern void (*_XCreateMutex_fn)( LockInfoPtr /* lock */ ); extern void (*_XFreeMutex_fn)( LockInfoPtr /* lock */ ); extern void (*_XLockMutex_fn)( LockInfoPtr /* lock */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char * /* file */ , int /* line */ #endif ); extern void (*_XUnlockMutex_fn)( LockInfoPtr /* lock */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char * /* file */ , int /* line */ #endif ); extern LockInfoPtr _Xglobal_lock; #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) #define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__) #define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)((d),__FILE__,__LINE__) #define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__) #define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__) #else /* used everywhere, so must be fast if not using threads */ #define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d) #define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d) #define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock) #define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock) #endif #define _XCreateMutex(lock) if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock); #define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock); #else /* XTHREADS */ #define LockDisplay(dis) #define _XLockMutex(lock) #define _XUnlockMutex(lock) #define UnlockDisplay(dis) #define _XCreateMutex(lock) #define _XFreeMutex(lock) #endif #define Xfree(ptr) free((ptr)) /* * Note that some machines do not return a valid pointer for malloc(0), in * which case we provide an alternate under the control of the * define MALLOC_0_RETURNS_NULL. This is necessary because some * Xlib code expects malloc(0) to return a valid pointer to storage. */ #if defined(MALLOC_0_RETURNS_NULL) || defined(__clang_analyzer__) # define Xmalloc(size) malloc(((size) == 0 ? 1 : (size))) # define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size))) # define Xcalloc(nelem, elsize) calloc(((nelem) == 0 ? 1 : (nelem)), (elsize)) #else # define Xmalloc(size) malloc((size)) # define Xrealloc(ptr, size) realloc((ptr), (size)) # define Xcalloc(nelem, elsize) calloc((nelem), (elsize)) #endif #include #define LOCKED 1 #define UNLOCKED 0 #ifdef NX_TRANS_SOCKET #ifndef BUFSIZE /* Output buffer size is configurable */ #define BUFSIZE 8192 /* but this is still used for reading. */ #endif #else #ifndef BUFSIZE #define BUFSIZE 2048 /* X output buffer size. */ #endif #endif #ifndef PTSPERBATCH #define PTSPERBATCH 1024 /* point batching */ #endif #ifndef WLNSPERBATCH #define WLNSPERBATCH 50 /* wide line batching */ #endif #ifndef ZLNSPERBATCH #define ZLNSPERBATCH 1024 /* thin line batching */ #endif #ifndef WRCTSPERBATCH #define WRCTSPERBATCH 10 /* wide line rectangle batching */ #endif #ifndef ZRCTSPERBATCH #define ZRCTSPERBATCH 256 /* thin line rectangle batching */ #endif #ifndef FRCTSPERBATCH #define FRCTSPERBATCH 256 /* filled rectangle batching */ #endif #ifndef FARCSPERBATCH #define FARCSPERBATCH 256 /* filled arc batching */ #endif #ifndef CURSORFONT #define CURSORFONT "cursor" /* standard cursor fonts */ #endif /* * Display flags */ #define XlibDisplayIOError (1L << 0) #define XlibDisplayClosing (1L << 1) #define XlibDisplayNoXkb (1L << 2) #define XlibDisplayPrivSync (1L << 3) #define XlibDisplayProcConni (1L << 4) /* in _XProcessInternalConnection */ #define XlibDisplayReadEvents (1L << 5) /* in _XReadEvents */ #define XlibDisplayReply (1L << 5) /* in _XReply */ #define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */ #define XlibDisplayDfltRMDB (1L << 7) /* mark if RM db from XGetDefault */ /* * X Protocol packetizing macros. */ /* Leftover from CRAY support - was defined empty on all non-Cray systems */ #define WORD64ALIGN /** * Return a len-sized request buffer for the request type. This function may * flush the output queue. * * @param dpy The display connection * @param type The request type * @param len Length of the request in bytes * * @returns A pointer to the request buffer with a few default values * initialized. */ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); /* GetReqSized is the same as GetReq but allows the caller to specify the * size in bytes. 'sz' must be a multiple of 4! */ #define GetReqSized(name, sz, req) \ req = (x##name##Req *) _XGetRequest(dpy, X_##name, sz) /* * GetReq - Get the next available X request packet in the buffer and * return it. * * "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc. * "req" is the name of the request pointer. * */ #define GetReq(name, req) \ GetReqSized(name, SIZEOF(x##name##Req), req) /* GetReqExtra is the same as GetReq, but allocates "n" additional bytes after the request. "n" must be a multiple of 4! */ #define GetReqExtra(name, n, req) \ GetReqSized(name, SIZEOF(x##name##Req) + n, req) /* * GetResReq is for those requests that have a resource ID * (Window, Pixmap, GContext, etc.) as their single argument. * "rid" is the name of the resource. */ #define GetResReq(name, rid, req) \ req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \ req->id = (rid) /* * GetEmptyReq is for those requests that have no arguments * at all. */ #define GetEmptyReq(name, req) \ req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq)) /* * MakeBigReq sets the CARD16 "req->length" to 0 and inserts a new CARD32 * length, after req->length, before the data in the request. The new length * includes the "n" extra 32-bit words. * * Do not use MakeBigReq if there is no data already in the request. * req->length must already be >= 2. */ #ifdef LONG64 #define MakeBigReq(req,n) \ { \ CARD64 _BRdat; \ CARD32 _BRlen = req->length - 1; \ req->length = 0; \ _BRdat = ((CARD32 *)req)[_BRlen]; \ memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ ((CARD32 *)req)[1] = _BRlen + n + 2; \ Data32(dpy, &_BRdat, 4); \ } #else #define MakeBigReq(req,n) \ { \ CARD32 _BRdat; \ CARD32 _BRlen = req->length - 1; \ req->length = 0; \ _BRdat = ((CARD32 *)req)[_BRlen]; \ memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ ((CARD32 *)req)[1] = _BRlen + n + 2; \ Data32(dpy, &_BRdat, 4); \ } #endif /* * SetReqLen increases the count of 32-bit words in the request by "n", * or by "badlen" if "n" is too large. * * Do not use SetReqLen if "req" does not already have data after the * xReq header. req->length must already be >= 2. */ #ifndef __clang_analyzer__ #define SetReqLen(req,n,badlen) \ if ((req->length + n) > (unsigned)65535) { \ if (dpy->bigreq_size) { \ MakeBigReq(req,n) \ } else { \ n = badlen; \ req->length += n; \ } \ } else \ req->length += n #else #define SetReqLen(req,n,badlen) \ req->length += n #endif #define SyncHandle() \ if (dpy->synchandler) (*dpy->synchandler)(dpy) extern void _XFlushGCCache(Display *dpy, GC gc); #define FlushGC(dpy, gc) \ if ((gc)->dirty) _XFlushGCCache((dpy), (gc)) /* * Data - Place data in the buffer and pad the end to provide * 32 bit word alignment. Transmit if the buffer fills. * * "dpy" is a pointer to a Display. * "data" is a pointer to a data buffer. * "len" is the length of the data buffer. */ #ifndef DataRoutineIsProcedure #define Data(dpy, data, len) {\ if (dpy->bufptr + (len) <= dpy->bufmax) {\ memcpy(dpy->bufptr, data, (int)len);\ dpy->bufptr += ((len) + 3) & ~3;\ } else\ _XSend(dpy, data, len);\ } #endif /* DataRoutineIsProcedure */ /* Allocate bytes from the buffer. No padding is done, so if * the length is not a multiple of 4, the caller must be * careful to leave the buffer aligned after sending the * current request. * * "type" is the type of the pointer being assigned to. * "ptr" is the pointer being assigned to. * "n" is the number of bytes to allocate. * * Example: * xTextElt *elt; * BufAlloc (xTextElt *, elt, nbytes) */ #define BufAlloc(type, ptr, n) \ if (dpy->bufptr + (n) > dpy->bufmax) \ _XFlush (dpy); \ ptr = (type) dpy->bufptr; \ memset(ptr, '\0', n); \ dpy->bufptr += (n); #define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) #define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len)) #ifdef LONG64 #define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)data, len) extern int _XData32( Display *dpy, _Xconst long *data, unsigned len ); extern void _XRead32( Display *dpy, long *data, long len ); #else #define Data32(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) #define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) #endif #define PackData16(dpy,data,len) Data16 (dpy, data, len) #define PackData32(dpy,data,len) Data32 (dpy, data, len) /* Xlib manual is bogus */ #define PackData(dpy,data,len) PackData16 (dpy, data, len) #define min(a,b) (((a) < (b)) ? (a) : (b)) #define max(a,b) (((a) > (b)) ? (a) : (b)) #define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \ (((cs)->rbearing|(cs)->lbearing| \ (cs)->ascent|(cs)->descent) == 0)) /* * CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit * character. If the character is in the column and exists, then return the * appropriate metrics (note that fonts with common per-character metrics will * return min_bounds). If none of these hold true, try again with the default * char. */ #define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \ { \ cs = def; \ if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ if (fs->per_char == NULL) { \ cs = &fs->min_bounds; \ } else { \ cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \ if (CI_NONEXISTCHAR(cs)) cs = def; \ } \ } \ } #define CI_GET_DEFAULT_INFO_1D(fs,cs) \ CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs) /* * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and * column. This is used for fonts that have more than row zero. */ #define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \ { \ cs = def; \ if (row >= fs->min_byte1 && row <= fs->max_byte1 && \ col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ if (fs->per_char == NULL) { \ cs = &fs->min_bounds; \ } else { \ cs = &fs->per_char[((row - fs->min_byte1) * \ (fs->max_char_or_byte2 - \ fs->min_char_or_byte2 + 1)) + \ (col - fs->min_char_or_byte2)]; \ if (CI_NONEXISTCHAR(cs)) cs = def; \ } \ } \ } #define CI_GET_DEFAULT_INFO_2D(fs,cs) \ { \ unsigned int r = (fs->default_char >> 8); \ unsigned int c = (fs->default_char & 0xff); \ CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \ } /* srcvar must be a variable for large architecture version */ #define OneDataCard32(dpy,dstaddr,srcvar) \ { *(CARD32 *)(dstaddr) = (srcvar); } typedef struct _XInternalAsync { struct _XInternalAsync *next; /* * handler arguments: * rep is the generic reply that caused this handler * to be invoked. It must also be passed to _XGetAsyncReply. * buf and len are opaque values that must be passed to * _XGetAsyncReply or _XGetAsyncData. * data is the closure stored in this struct. * The handler returns True iff it handled this reply. */ Bool (*handler)( Display* /* dpy */, xReply* /* rep */, char* /* buf */, int /* len */, XPointer /* data */ ); XPointer data; } _XAsyncHandler; /* * This struct is part of the ABI and is defined by value * in user-code. This means that we cannot make * the sequence-numbers 64bit. */ typedef struct _XAsyncEState { unsigned long min_sequence_number; unsigned long max_sequence_number; unsigned char error_code; unsigned char major_opcode; unsigned short minor_opcode; unsigned char last_error_received; int error_count; } _XAsyncErrorState; extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler); #define DeqAsyncHandler(dpy,handler) { \ if (dpy->async_handlers == (handler)) \ dpy->async_handlers = (handler)->next; \ else \ _XDeqAsyncHandler(dpy, handler); \ } typedef void (*FreeFuncType) ( Display* /* display */ ); typedef int (*FreeModmapType) ( XModifierKeymap* /* modmap */ ); /* * This structure is private to the library. */ typedef struct _XFreeFuncs { FreeFuncType atoms; /* _XFreeAtomTable */ FreeModmapType modifiermap; /* XFreeModifiermap */ FreeFuncType key_bindings; /* _XFreeKeyBindings */ FreeFuncType context_db; /* _XFreeContextDB */ FreeFuncType defaultCCCs; /* _XcmsFreeDefaultCCCs */ FreeFuncType clientCmaps; /* _XcmsFreeClientCmaps */ FreeFuncType intensityMaps; /* _XcmsFreeIntensityMaps */ FreeFuncType im_filters; /* _XFreeIMFilters */ FreeFuncType xkb; /* _XkbFreeInfo */ } _XFreeFuncRec; /* types for InitExt.c */ typedef int (*CreateGCType) ( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ); typedef int (*CopyGCType)( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ); typedef int (*FlushGCType) ( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ); typedef int (*FreeGCType) ( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ); typedef int (*CreateFontType) ( Display* /* display */, XFontStruct* /* fs */, XExtCodes* /* codes */ ); typedef int (*FreeFontType) ( Display* /* display */, XFontStruct* /* fs */, XExtCodes* /* codes */ ); typedef int (*CloseDisplayType) ( Display* /* display */, XExtCodes* /* codes */ ); typedef int (*ErrorType) ( Display* /* display */, xError* /* err */, XExtCodes* /* codes */, int* /* ret_code */ ); typedef char* (*ErrorStringType) ( Display* /* display */, int /* code */, XExtCodes* /* codes */, char* /* buffer */, int /* nbytes */ ); typedef void (*PrintErrorType)( Display* /* display */, XErrorEvent* /* ev */, void* /* fp */ ); typedef void (*BeforeFlushType)( Display* /* display */, XExtCodes* /* codes */, _Xconst char* /* data */, long /* len */ ); /* * This structure is private to the library. */ typedef struct _XExten { /* private to extension mechanism */ struct _XExten *next; /* next in list */ XExtCodes codes; /* public information, all extension told */ CreateGCType create_GC; /* routine to call when GC created */ CopyGCType copy_GC; /* routine to call when GC copied */ FlushGCType flush_GC; /* routine to call when GC flushed */ FreeGCType free_GC; /* routine to call when GC freed */ CreateFontType create_Font; /* routine to call when Font created */ FreeFontType free_Font; /* routine to call when Font freed */ CloseDisplayType close_display; /* routine to call when connection closed */ ErrorType error; /* who to call when an error occurs */ ErrorStringType error_string; /* routine to supply error string */ char *name; /* name of this extension */ PrintErrorType error_values; /* routine to supply error values */ BeforeFlushType before_flush; /* routine to call when sending data */ struct _XExten *next_flush; /* next in list of those with flushes */ } _XExtension; /* Temporary definition until we can depend on an xproto release with it */ #ifdef _X_COLD # define _XLIB_COLD _X_COLD #elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403) /* 4.3+ */ # define _XLIB_COLD __attribute__((__cold__)) #else # define _XLIB_COLD /* nothing */ #endif /* extension hooks */ #ifdef DataRoutineIsProcedure extern void Data(Display *dpy, char *data, long len); #endif extern int _XError( Display* /* dpy */, xError* /* rep */ ); extern int _XIOError( Display* /* dpy */ #ifdef NX_TRANS_SOCKET ); #else ) _X_NORETURN; #endif /* NX_TRANS_SOCKET */ extern int (*_XIOErrorFunction)( Display* /* dpy */ ); extern int (*_XErrorFunction)( Display* /* dpy */, XErrorEvent* /* error_event */ ); extern void _XEatData( Display* /* dpy */, unsigned long /* n */ ) _XLIB_COLD; extern void _XEatDataWords( Display* /* dpy */, unsigned long /* n */ ) _XLIB_COLD; #if defined(__SUNPRO_C) /* Studio compiler alternative to "cold" attribute */ # pragma rarely_called(_XEatData, _XEatDataWords) #endif extern char *_XAllocScratch( Display* /* dpy */, unsigned long /* nbytes */ ); extern char *_XAllocTemp( Display* /* dpy */, unsigned long /* nbytes */ ); extern void _XFreeTemp( Display* /* dpy */, char* /* buf */, unsigned long /* nbytes */ ); extern Visual *_XVIDtoVisual( Display* /* dpy */, VisualID /* id */ ); extern unsigned long _XSetLastRequestRead( Display* /* dpy */, xGenericReply* /* rep */ ); extern int _XGetHostname( char* /* buf */, int /* maxlen */ ); extern Screen *_XScreenOfWindow( Display* /* dpy */, Window /* w */ ); extern Bool _XAsyncErrorHandler( Display* /* dpy */, xReply* /* rep */, char* /* buf */, int /* len */, XPointer /* data */ ); extern char *_XGetAsyncReply( Display* /* dpy */, char* /* replbuf */, xReply* /* rep */, char* /* buf */, int /* len */, int /* extra */, Bool /* discard */ ); extern void _XGetAsyncData( Display* /* dpy */, char * /* data */, char * /* buf */, int /* len */, int /* skip */, int /* datalen */, int /* discardtotal */ ); extern void _XFlush( Display* /* dpy */ ); extern int _XEventsQueued( Display* /* dpy */, int /* mode */ ); extern void _XReadEvents( Display* /* dpy */ ); extern int _XRead( Display* /* dpy */, char* /* data */, long /* size */ ); extern void _XReadPad( Display* /* dpy */, char* /* data */, long /* size */ ); extern void _XSend( Display* /* dpy */, _Xconst char* /* data */, long /* size */ ); extern Status _XReply( Display* /* dpy */, xReply* /* rep */, int /* extra */, Bool /* discard */ ); extern void _XEnq( Display* /* dpy */, xEvent* /* event */ ); extern void _XDeq( Display* /* dpy */, _XQEvent* /* prev */, _XQEvent* /* qelt */ ); extern Bool _XUnknownWireEvent( Display* /* dpy */, XEvent* /* re */, xEvent* /* event */ ); extern Bool _XUnknownWireEventCookie( Display* /* dpy */, XGenericEventCookie* /* re */, xEvent* /* event */ ); extern Bool _XUnknownCopyEventCookie( Display* /* dpy */, XGenericEventCookie* /* in */, XGenericEventCookie* /* out */ ); extern Status _XUnknownNativeEvent( Display* /* dpy */, XEvent* /* re */, xEvent* /* event */ ); extern Bool _XWireToEvent(Display *dpy, XEvent *re, xEvent *event); extern Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we); extern Bool _XPollfdCacheInit(Display *dpy); extern void _XPollfdCacheAdd(Display *dpy, int fd); extern void _XPollfdCacheDel(Display *dpy, int fd); extern XID _XAllocID(Display *dpy); extern void _XAllocIDs(Display *dpy, XID *ids, int count); extern int _XFreeExtData( XExtData* /* extension */ ); extern int (*XESetCreateGC( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ) /* proc */ ))( Display*, GC, XExtCodes* ); extern int (*XESetCopyGC( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ) /* proc */ ))( Display*, GC, XExtCodes* ); extern int (*XESetFlushGC( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ) /* proc */ ))( Display*, GC, XExtCodes* ); extern int (*XESetFreeGC( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, GC /* gc */, XExtCodes* /* codes */ ) /* proc */ ))( Display*, GC, XExtCodes* ); extern int (*XESetCreateFont( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, XFontStruct* /* fs */, XExtCodes* /* codes */ ) /* proc */ ))( Display*, XFontStruct*, XExtCodes* ); extern int (*XESetFreeFont( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, XFontStruct* /* fs */, XExtCodes* /* codes */ ) /* proc */ ))( Display*, XFontStruct*, XExtCodes* ); extern int (*XESetCloseDisplay( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, XExtCodes* /* codes */ ) /* proc */ ))( Display*, XExtCodes* ); extern int (*XESetError( Display* /* display */, int /* extension */, int (*) ( Display* /* display */, xError* /* err */, XExtCodes* /* codes */, int* /* ret_code */ ) /* proc */ ))( Display*, xError*, XExtCodes*, int* ); extern char* (*XESetErrorString( Display* /* display */, int /* extension */, char* (*) ( Display* /* display */, int /* code */, XExtCodes* /* codes */, char* /* buffer */, int /* nbytes */ ) /* proc */ ))( Display*, int, XExtCodes*, char*, int ); extern void (*XESetPrintErrorValues ( Display* /* display */, int /* extension */, void (*)( Display* /* display */, XErrorEvent* /* ev */, void* /* fp */ ) /* proc */ ))( Display*, XErrorEvent*, void* ); extern Bool (*XESetWireToEvent( Display* /* display */, int /* event_number */, Bool (*) ( Display* /* display */, XEvent* /* re */, xEvent* /* event */ ) /* proc */ ))( Display*, XEvent*, xEvent* ); extern Bool (*XESetWireToEventCookie( Display* /* display */, int /* extension */, Bool (*) ( Display* /* display */, XGenericEventCookie* /* re */, xEvent* /* event */ ) /* proc */ ))( Display*, XGenericEventCookie*, xEvent* ); extern Bool (*XESetCopyEventCookie( Display* /* display */, int /* extension */, Bool (*) ( Display* /* display */, XGenericEventCookie* /* in */, XGenericEventCookie* /* out */ ) /* proc */ ))( Display*, XGenericEventCookie*, XGenericEventCookie* ); extern Status (*XESetEventToWire( Display* /* display */, int /* event_number */, Status (*) ( Display* /* display */, XEvent* /* re */, xEvent* /* event */ ) /* proc */ ))( Display*, XEvent*, xEvent* ); extern Bool (*XESetWireToError( Display* /* display */, int /* error_number */, Bool (*) ( Display* /* display */, XErrorEvent* /* he */, xError* /* we */ ) /* proc */ ))( Display*, XErrorEvent*, xError* ); extern void (*XESetBeforeFlush( Display* /* display */, int /* error_number */, void (*) ( Display* /* display */, XExtCodes* /* codes */, _Xconst char* /* data */, long /* len */ ) /* proc */ ))( Display*, XExtCodes*, _Xconst char*, long ); /* internal connections for IMs */ typedef void (*_XInternalConnectionProc)( Display* /* dpy */, int /* fd */, XPointer /* call_data */ ); extern Status _XRegisterInternalConnection( Display* /* dpy */, int /* fd */, _XInternalConnectionProc /* callback */, XPointer /* call_data */ ); extern void _XUnregisterInternalConnection( Display* /* dpy */, int /* fd */ ); extern void _XProcessInternalConnection( Display* /* dpy */, struct _XConnectionInfo* /* conn_info */ ); /* Display structure has pointers to these */ struct _XConnectionInfo { /* info from _XRegisterInternalConnection */ int fd; _XInternalConnectionProc read_callback; XPointer call_data; XPointer *watch_data; /* set/used by XConnectionWatchProc */ struct _XConnectionInfo *next; }; struct _XConnWatchInfo { /* info from XAddConnectionWatch */ XConnectionWatchProc fn; XPointer client_data; struct _XConnWatchInfo *next; }; extern int _XTextHeight( XFontStruct* /* font_struct */, _Xconst char* /* string */, int /* count */ ); extern int _XTextHeight16( XFontStruct* /* font_struct */, _Xconst XChar2b* /* string */, int /* count */ ); #if defined(WIN32) extern int _XOpenFile( _Xconst char* /* path */, int /* flags */ ); extern int _XOpenFileMode( _Xconst char* /* path */, int /* flags */, mode_t /* mode */ ); extern void* _XFopenFile( _Xconst char* /* path */, _Xconst char* /* mode */ ); extern int _XAccessFile( _Xconst char* /* path */ ); #else #define _XOpenFile(path,flags) open(path,flags) #define _XOpenFileMode(path,flags,mode) open(path,flags,mode) #define _XFopenFile(path,mode) fopen(path,mode) #endif /* EvToWire.c */ extern Status _XEventToWire(Display *dpy, XEvent *re, xEvent *event); extern int _XF86LoadQueryLocaleFont( Display* /* dpy */, _Xconst char* /* name*/, XFontStruct** /* xfp*/, Font* /* fidp */ ); extern void _XProcessWindowAttributes ( Display *dpy, xChangeWindowAttributesReq *req, unsigned long valuemask, XSetWindowAttributes *attributes); extern int _XDefaultError( Display *dpy, XErrorEvent *event); extern int _XDefaultIOError( Display *dpy); extern void _XSetClipRectangles ( Display *dpy, GC gc, int clip_x_origin, int clip_y_origin, XRectangle *rectangles, int n, int ordering); Status _XGetWindowAttributes( Display *dpy, Window w, XWindowAttributes *attr); int _XPutBackEvent ( Display *dpy, XEvent *event); extern Bool _XIsEventCookie( Display *dpy, XEvent *ev); extern void _XFreeEventCookies( Display *dpy); extern void _XStoreEventCookie( Display *dpy, XEvent *ev); extern Bool _XFetchEventCookie( Display *dpy, XGenericEventCookie *ev); extern Bool _XCopyEventCookie( Display *dpy, XGenericEventCookie *in, XGenericEventCookie *out); /* lcFile.c */ extern void xlocaledir( char *buf, int buf_len ); #ifdef __clang__ #pragma clang diagnostic pop #endif _XFUNCPROTOEND #endif /* !defined(_X11_XLIBINT_H_) && !defined(_XLIBINT_H_) */ nx-libs-3.5.99.23/nx-X11/lib/include/X11/Xlocale.h0000644000000000000000000000255513614532331015614 0ustar /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #if !defined(_X11_XLOCALE_H_) && !defined(_XLOCALE_H_) #define _X11_XLOCALE_H_ #define _XLOCALE_H_ #include #include #include #endif /* !defined(_X11_XLOCALE_H_) && !defined(_XLOCALE_H_) */ nx-libs-3.5.99.23/nx-X11/lib/include/X11/Xregion.h0000644000000000000000000001362013614532331015633 0ustar /************************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************/ #if !defined(_X11_XREGION_H_) && !defined(_XREGION_H) #define _X11_XREGION_H_ #define _XREGION_H typedef struct { short x1, x2, y1, y2; } Box, BOX, BoxRec, *BoxPtr; typedef struct { short x, y, width, height; }RECTANGLE, RectangleRec, *RectanglePtr; #define TRUE 1 #define FALSE 0 #define MAXSHORT 32767 #define MINSHORT -MAXSHORT #ifndef MAX #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif #ifndef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif /* * clip region */ typedef struct _XRegion { long size; long numRects; BOX *rects; BOX extents; } REGION; /* Xutil.h contains the declaration: * typedef struct _XRegion *Region; */ /* 1 if two BOXs overlap. * 0 if two BOXs do not overlap. * Remember, x2 and y2 are not in the region */ #define EXTENTCHECK(r1, r2) \ ((r1)->x2 > (r2)->x1 && \ (r1)->x1 < (r2)->x2 && \ (r1)->y2 > (r2)->y1 && \ (r1)->y1 < (r2)->y2) /* * update region extents */ #define EXTENTS(r,idRect){\ if((r)->x1 < (idRect)->extents.x1)\ (idRect)->extents.x1 = (r)->x1;\ if((r)->y1 < (idRect)->extents.y1)\ (idRect)->extents.y1 = (r)->y1;\ if((r)->x2 > (idRect)->extents.x2)\ (idRect)->extents.x2 = (r)->x2;\ if((r)->y2 > (idRect)->extents.y2)\ (idRect)->extents.y2 = (r)->y2;\ } /* * Check to see if there is enough memory in the present region. */ #define MEMCHECK(reg, rect, firstrect){\ if ((reg)->numRects >= ((reg)->size - 1)){\ BoxPtr tmpRect = Xrealloc ((firstrect), \ (2 * (sizeof(BOX)) * ((reg)->size))); \ if (tmpRect == NULL) \ return(0);\ (firstrect) = tmpRect; \ (reg)->size *= 2;\ (rect) = &(firstrect)[(reg)->numRects];\ }\ } /* this routine checks to see if the previous rectangle is the same * or subsumes the new rectangle to add. */ #define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\ (!(((Reg)->numRects > 0)&&\ ((R-1)->y1 == (Ry1)) &&\ ((R-1)->y2 == (Ry2)) &&\ ((R-1)->x1 <= (Rx1)) &&\ ((R-1)->x2 >= (Rx2)))) /* add a rectangle to the given Region */ #define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\ if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\ CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\ (r)->x1 = (rx1);\ (r)->y1 = (ry1);\ (r)->x2 = (rx2);\ (r)->y2 = (ry2);\ EXTENTS((r), (reg));\ (reg)->numRects++;\ (r)++;\ }\ } /* add a rectangle to the given Region */ #define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\ if ((rx1 < rx2) && (ry1 < ry2) &&\ CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\ (r)->x1 = (rx1);\ (r)->y1 = (ry1);\ (r)->x2 = (rx2);\ (r)->y2 = (ry2);\ (reg)->numRects++;\ (r)++;\ }\ } #define EMPTY_REGION(pReg) pReg->numRects = 0 #define REGION_NOT_EMPTY(pReg) pReg->numRects #define INBOX(r, x, y) \ ( ( ((r).x2 > x)) && \ ( ((r).x1 <= x)) && \ ( ((r).y2 > y)) && \ ( ((r).y1 <= y)) ) /* * number of points to buffer before sending them off * to scanlines() : Must be an even number */ #define NUMPTSTOBUFFER 200 /* * used to allocate buffers for points and link * the buffers together */ typedef struct _POINTBLOCK { XPoint pts[NUMPTSTOBUFFER]; struct _POINTBLOCK *next; } POINTBLOCK; #endif /* !defined(_X11_XREGION_H_) && !defined(_XREGION_H) */ nx-libs-3.5.99.23/nx-X11/lib/include/X11/Xresource.h0000644000000000000000000002474313614532331016207 0ustar /*********************************************************** Copyright 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #if !defined(_X11_XRESOURCE_H_) && !defined(_XRESOURCE_H_) #define _X11_XRESOURCE_H_ #define _XRESOURCE_H_ #ifndef _XP_PRINT_SERVER_ #include #endif /**************************************************************** **************************************************************** *** *** *** *** *** X Resource Manager Intrinsics *** *** *** *** *** **************************************************************** ****************************************************************/ _XFUNCPROTOBEGIN /**************************************************************** * * Memory Management * ****************************************************************/ extern char *Xpermalloc( unsigned int /* size */ ); /**************************************************************** * * Quark Management * ****************************************************************/ typedef int XrmQuark, *XrmQuarkList; #define NULLQUARK ((XrmQuark) 0) typedef char *XrmString; #define NULLSTRING ((XrmString) 0) /* find quark for string, create new quark if none already exists */ extern XrmQuark XrmStringToQuark( _Xconst char* /* string */ ); extern XrmQuark XrmPermStringToQuark( _Xconst char* /* string */ ); /* find string for quark */ extern XrmString XrmQuarkToString( XrmQuark /* quark */ ); extern XrmQuark XrmUniqueQuark( void ); #define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0) /**************************************************************** * * Conversion of Strings to Lists * ****************************************************************/ typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList; extern void XrmStringToQuarkList( _Xconst char* /* string */, XrmQuarkList /* quarks_return */ ); extern void XrmStringToBindingQuarkList( _Xconst char* /* string */, XrmBindingList /* bindings_return */, XrmQuarkList /* quarks_return */ ); /**************************************************************** * * Name and Class lists. * ****************************************************************/ typedef XrmQuark XrmName; typedef XrmQuarkList XrmNameList; #define XrmNameToString(name) XrmQuarkToString(name) #define XrmStringToName(string) XrmStringToQuark(string) #define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name) typedef XrmQuark XrmClass; typedef XrmQuarkList XrmClassList; #define XrmClassToString(c_class) XrmQuarkToString(c_class) #define XrmStringToClass(c_class) XrmStringToQuark(c_class) #define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class) /**************************************************************** * * Resource Representation Types and Values * ****************************************************************/ typedef XrmQuark XrmRepresentation; #define XrmStringToRepresentation(string) XrmStringToQuark(string) #define XrmRepresentationToString(type) XrmQuarkToString(type) typedef struct { unsigned int size; XPointer addr; } XrmValue, *XrmValuePtr; /**************************************************************** * * Resource Manager Functions * ****************************************************************/ typedef struct _XrmHashBucketRec *XrmHashBucket; typedef XrmHashBucket *XrmHashTable; typedef XrmHashTable XrmSearchList[]; typedef struct _XrmHashBucketRec *XrmDatabase; extern void XrmDestroyDatabase( XrmDatabase /* database */ ); extern void XrmQPutResource( XrmDatabase* /* database */, XrmBindingList /* bindings */, XrmQuarkList /* quarks */, XrmRepresentation /* type */, XrmValue* /* value */ ); extern void XrmPutResource( XrmDatabase* /* database */, _Xconst char* /* specifier */, _Xconst char* /* type */, XrmValue* /* value */ ); extern void XrmQPutStringResource( XrmDatabase* /* database */, XrmBindingList /* bindings */, XrmQuarkList /* quarks */, _Xconst char* /* value */ ); extern void XrmPutStringResource( XrmDatabase* /* database */, _Xconst char* /* specifier */, _Xconst char* /* value */ ); extern void XrmPutLineResource( XrmDatabase* /* database */, _Xconst char* /* line */ ); extern Bool XrmQGetResource( XrmDatabase /* database */, XrmNameList /* quark_name */, XrmClassList /* quark_class */, XrmRepresentation* /* quark_type_return */, XrmValue* /* value_return */ ); extern Bool XrmGetResource( XrmDatabase /* database */, _Xconst char* /* str_name */, _Xconst char* /* str_class */, char** /* str_type_return */, XrmValue* /* value_return */ ); extern Bool XrmQGetSearchList( XrmDatabase /* database */, XrmNameList /* names */, XrmClassList /* classes */, XrmSearchList /* list_return */, int /* list_length */ ); extern Bool XrmQGetSearchResource( XrmSearchList /* list */, XrmName /* name */, XrmClass /* class */, XrmRepresentation* /* type_return */, XrmValue* /* value_return */ ); /**************************************************************** * * Resource Database Management * ****************************************************************/ #ifndef _XP_PRINT_SERVER_ extern void XrmSetDatabase( Display* /* display */, XrmDatabase /* database */ ); extern XrmDatabase XrmGetDatabase( Display* /* display */ ); #endif /* !_XP_PRINT_SERVER_ */ extern XrmDatabase XrmGetFileDatabase( _Xconst char* /* filename */ ); extern Status XrmCombineFileDatabase( _Xconst char* /* filename */, XrmDatabase* /* target */, Bool /* override */ ); extern XrmDatabase XrmGetStringDatabase( _Xconst char* /* data */ /* null terminated string */ ); extern void XrmPutFileDatabase( XrmDatabase /* database */, _Xconst char* /* filename */ ); extern void XrmMergeDatabases( XrmDatabase /* source_db */, XrmDatabase* /* target_db */ ); extern void XrmCombineDatabase( XrmDatabase /* source_db */, XrmDatabase* /* target_db */, Bool /* override */ ); #define XrmEnumAllLevels 0 #define XrmEnumOneLevel 1 extern Bool XrmEnumerateDatabase( XrmDatabase /* db */, XrmNameList /* name_prefix */, XrmClassList /* class_prefix */, int /* mode */, Bool (*)( XrmDatabase* /* db */, XrmBindingList /* bindings */, XrmQuarkList /* quarks */, XrmRepresentation* /* type */, XrmValue* /* value */, XPointer /* closure */ ) /* proc */, XPointer /* closure */ ); extern const char *XrmLocaleOfDatabase( XrmDatabase /* database */ ); /**************************************************************** * * Command line option mapping to resource entries * ****************************************************************/ typedef enum { XrmoptionNoArg, /* Value is specified in OptionDescRec.value */ XrmoptionIsArg, /* Value is the option string itself */ XrmoptionStickyArg, /* Value is characters immediately following option */ XrmoptionSepArg, /* Value is next argument in argv */ XrmoptionResArg, /* Resource and value in next argument in argv */ XrmoptionSkipArg, /* Ignore this option and the next argument in argv */ XrmoptionSkipLine, /* Ignore this option and the rest of argv */ XrmoptionSkipNArgs /* Ignore this option and the next OptionDescRes.value arguments in argv */ } XrmOptionKind; typedef struct { char *option; /* Option abbreviation in argv */ char *specifier; /* Resource specifier */ XrmOptionKind argKind; /* Which style of option it is */ XPointer value; /* Value to provide if XrmoptionNoArg */ } XrmOptionDescRec, *XrmOptionDescList; extern void XrmParseCommand( XrmDatabase* /* database */, XrmOptionDescList /* table */, int /* table_count */, _Xconst char* /* name */, int* /* argc_in_out */, char** /* argv_in_out */ ); _XFUNCPROTOEND #endif /* !defined(_X11_XRESOURCE_H_) && !defined(_XRESOURCE_H_) */ /* DON'T ADD STUFF AFTER THIS #endif */ nx-libs-3.5.99.23/nx-X11/lib/include/X11/Xutil.h0000644000000000000000000005167713614532331015343 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #if !defined(_X11_XUTIL_H_) && !defined(_XUTIL_H_) #define _X11_XUTIL_H_ #define _XUTIL_H_ /* You must include before including this file */ #include #include /* The Xlib structs are full of implicit padding to properly align members. We can't clean that up without breaking ABI, so tell clang not to bother complaining about it. */ #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif /* * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding * value (x, y, width, height) was found in the parsed string. */ #define NoValue 0x0000 #define XValue 0x0001 #define YValue 0x0002 #define WidthValue 0x0004 #define HeightValue 0x0008 #define AllValues 0x000F #define XNegative 0x0010 #define YNegative 0x0020 /* * new version containing base_width, base_height, and win_gravity fields; * used with WM_NORMAL_HINTS. */ typedef struct { long flags; /* marks which fields in this structure are defined */ int x, y; /* obsolete for new window mgrs, but clients */ int width, height; /* should set so old wm's don't mess up */ int min_width, min_height; int max_width, max_height; int width_inc, height_inc; struct { int x; /* numerator */ int y; /* denominator */ } min_aspect, max_aspect; int base_width, base_height; /* added by ICCCM version 1 */ int win_gravity; /* added by ICCCM version 1 */ } XSizeHints; /* * The next block of definitions are for window manager properties that * clients and applications use for communication. */ /* flags argument in size hints */ #define USPosition (1L << 0) /* user specified x, y */ #define USSize (1L << 1) /* user specified width, height */ #define PPosition (1L << 2) /* program specified position */ #define PSize (1L << 3) /* program specified size */ #define PMinSize (1L << 4) /* program specified minimum size */ #define PMaxSize (1L << 5) /* program specified maximum size */ #define PResizeInc (1L << 6) /* program specified resize increments */ #define PAspect (1L << 7) /* program specified min and max aspect ratios */ #define PBaseSize (1L << 8) /* program specified base for incrementing */ #define PWinGravity (1L << 9) /* program specified window gravity */ /* obsolete */ #define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect) typedef struct { long flags; /* marks which fields in this structure are defined */ Bool input; /* does this application rely on the window manager to get keyboard input? */ int initial_state; /* see below */ Pixmap icon_pixmap; /* pixmap to be used as icon */ Window icon_window; /* window to be used as icon */ int icon_x, icon_y; /* initial position of icon */ Pixmap icon_mask; /* icon mask bitmap */ XID window_group; /* id of related window group */ /* this structure may be extended in the future */ } XWMHints; /* definition for flags of XWMHints */ #define InputHint (1L << 0) #define StateHint (1L << 1) #define IconPixmapHint (1L << 2) #define IconWindowHint (1L << 3) #define IconPositionHint (1L << 4) #define IconMaskHint (1L << 5) #define WindowGroupHint (1L << 6) #define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \ IconPositionHint|IconMaskHint|WindowGroupHint) #define XUrgencyHint (1L << 8) /* definitions for initial window state */ #define WithdrawnState 0 /* for windows that are not mapped */ #define NormalState 1 /* most applications want to start this way */ #define IconicState 3 /* application wants to start as an icon */ /* * Obsolete states no longer defined by ICCCM */ #define DontCareState 0 /* don't know or care */ #define ZoomState 2 /* application wants to start zoomed */ #define InactiveState 4 /* application believes it is seldom used; */ /* some wm's may put it on inactive menu */ /* * new structure for manipulating TEXT properties; used with WM_NAME, * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND. */ typedef struct { unsigned char *value; /* same as Property routines */ Atom encoding; /* prop type */ int format; /* prop data format: 8, 16, or 32 */ unsigned long nitems; /* number of data items in value */ } XTextProperty; #define XNoMemory -1 #define XLocaleNotSupported -2 #define XConverterNotFound -3 typedef enum { XStringStyle, /* STRING */ XCompoundTextStyle, /* COMPOUND_TEXT */ XTextStyle, /* text in owner's encoding (current locale)*/ XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */ /* The following is an XFree86 extension, introduced in November 2000 */ XUTF8StringStyle /* UTF8_STRING */ } XICCEncodingStyle; typedef struct { int min_width, min_height; int max_width, max_height; int width_inc, height_inc; } XIconSize; typedef struct { char *res_name; char *res_class; } XClassHint; #ifdef XUTIL_DEFINE_FUNCTIONS extern int XDestroyImage( XImage *ximage); extern unsigned long XGetPixel( XImage *ximage, int x, int y); extern int XPutPixel( XImage *ximage, int x, int y, unsigned long pixel); extern XImage *XSubImage( XImage *ximage, int x, int y, unsigned int width, unsigned int height); extern int XAddPixel( XImage *ximage, long value); #else /* * These macros are used to give some sugar to the image routines so that * naive people are more comfortable with them. */ #define XDestroyImage(ximage) \ ((*((ximage)->f.destroy_image))((ximage))) #define XGetPixel(ximage, x, y) \ ((*((ximage)->f.get_pixel))((ximage), (x), (y))) #define XPutPixel(ximage, x, y, pixel) \ ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel))) #define XSubImage(ximage, x, y, width, height) \ ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height))) #define XAddPixel(ximage, value) \ ((*((ximage)->f.add_pixel))((ximage), (value))) #endif /* * Compose sequence status structure, used in calling XLookupString. */ typedef struct _XComposeStatus { XPointer compose_ptr; /* state table pointer */ int chars_matched; /* match state */ } XComposeStatus; /* * Keysym macros, used on Keysyms to test for classes of symbols */ #define IsKeypadKey(keysym) \ (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal)) #define IsPrivateKeypadKey(keysym) \ (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF)) #define IsCursorKey(keysym) \ (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select)) #define IsPFKey(keysym) \ (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4)) #define IsFunctionKey(keysym) \ (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35)) #define IsMiscFunctionKey(keysym) \ (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break)) #ifdef XK_XKB_KEYS #define IsModifierKey(keysym) \ ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \ || (((KeySym)(keysym) >= XK_ISO_Lock) && \ ((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \ || ((KeySym)(keysym) == XK_Mode_switch) \ || ((KeySym)(keysym) == XK_Num_Lock)) #else #define IsModifierKey(keysym) \ ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \ || ((KeySym)(keysym) == XK_Mode_switch) \ || ((KeySym)(keysym) == XK_Num_Lock)) #endif /* * opaque reference to Region data type */ typedef struct _XRegion *Region; /* Return values from XRectInRegion() */ #define RectangleOut 0 #define RectangleIn 1 #define RectanglePart 2 /* * Information used by the visual utility routines to find desired visual * type from the many visuals a display may support. */ typedef struct { Visual *visual; VisualID visualid; int screen; int depth; #if defined(__cplusplus) || defined(c_plusplus) int c_class; /* C++ */ #else int class; #endif unsigned long red_mask; unsigned long green_mask; unsigned long blue_mask; int colormap_size; int bits_per_rgb; } XVisualInfo; #define VisualNoMask 0x0 #define VisualIDMask 0x1 #define VisualScreenMask 0x2 #define VisualDepthMask 0x4 #define VisualClassMask 0x8 #define VisualRedMaskMask 0x10 #define VisualGreenMaskMask 0x20 #define VisualBlueMaskMask 0x40 #define VisualColormapSizeMask 0x80 #define VisualBitsPerRGBMask 0x100 #define VisualAllMask 0x1FF /* * This defines a window manager property that clients may use to * share standard color maps of type RGB_COLOR_MAP: */ typedef struct { Colormap colormap; unsigned long red_max; unsigned long red_mult; unsigned long green_max; unsigned long green_mult; unsigned long blue_max; unsigned long blue_mult; unsigned long base_pixel; VisualID visualid; /* added by ICCCM version 1 */ XID killid; /* added by ICCCM version 1 */ } XStandardColormap; #define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */ /* * return codes for XReadBitmapFile and XWriteBitmapFile */ #define BitmapSuccess 0 #define BitmapOpenFailed 1 #define BitmapFileInvalid 2 #define BitmapNoMemory 3 /**************************************************************** * * Context Management * ****************************************************************/ /* Associative lookup table return codes */ #define XCSUCCESS 0 /* No error. */ #define XCNOMEM 1 /* Out of memory */ #define XCNOENT 2 /* No entry in table */ typedef int XContext; #define XUniqueContext() ((XContext) XrmUniqueQuark()) #define XStringToContext(string) ((XContext) XrmStringToQuark(string)) _XFUNCPROTOBEGIN /* The following declarations are alphabetized. */ extern XClassHint *XAllocClassHint ( void ); extern XIconSize *XAllocIconSize ( void ); extern XSizeHints *XAllocSizeHints ( void ); extern XStandardColormap *XAllocStandardColormap ( void ); extern XWMHints *XAllocWMHints ( void ); extern int XClipBox( Region /* r */, XRectangle* /* rect_return */ ); extern Region XCreateRegion( void ); extern const char *XDefaultString (void); extern int XDeleteContext( Display* /* display */, XID /* rid */, XContext /* context */ ); extern int XDestroyRegion( Region /* r */ ); extern int XEmptyRegion( Region /* r */ ); extern int XEqualRegion( Region /* r1 */, Region /* r2 */ ); extern int XFindContext( Display* /* display */, XID /* rid */, XContext /* context */, XPointer* /* data_return */ ); extern Status XGetClassHint( Display* /* display */, Window /* w */, XClassHint* /* class_hints_return */ ); extern Status XGetIconSizes( Display* /* display */, Window /* w */, XIconSize** /* size_list_return */, int* /* count_return */ ); extern Status XGetNormalHints( Display* /* display */, Window /* w */, XSizeHints* /* hints_return */ ); extern Status XGetRGBColormaps( Display* /* display */, Window /* w */, XStandardColormap** /* stdcmap_return */, int* /* count_return */, Atom /* property */ ); extern Status XGetSizeHints( Display* /* display */, Window /* w */, XSizeHints* /* hints_return */, Atom /* property */ ); extern Status XGetStandardColormap( Display* /* display */, Window /* w */, XStandardColormap* /* colormap_return */, Atom /* property */ ); extern Status XGetTextProperty( Display* /* display */, Window /* window */, XTextProperty* /* text_prop_return */, Atom /* property */ ); extern XVisualInfo *XGetVisualInfo( Display* /* display */, long /* vinfo_mask */, XVisualInfo* /* vinfo_template */, int* /* nitems_return */ ); extern Status XGetWMClientMachine( Display* /* display */, Window /* w */, XTextProperty* /* text_prop_return */ ); extern XWMHints *XGetWMHints( Display* /* display */, Window /* w */ ); extern Status XGetWMIconName( Display* /* display */, Window /* w */, XTextProperty* /* text_prop_return */ ); extern Status XGetWMName( Display* /* display */, Window /* w */, XTextProperty* /* text_prop_return */ ); extern Status XGetWMNormalHints( Display* /* display */, Window /* w */, XSizeHints* /* hints_return */, long* /* supplied_return */ ); extern Status XGetWMSizeHints( Display* /* display */, Window /* w */, XSizeHints* /* hints_return */, long* /* supplied_return */, Atom /* property */ ); extern Status XGetZoomHints( Display* /* display */, Window /* w */, XSizeHints* /* zhints_return */ ); extern int XIntersectRegion( Region /* sra */, Region /* srb */, Region /* dr_return */ ); extern void XConvertCase( KeySym /* sym */, KeySym* /* lower */, KeySym* /* upper */ ); extern int XLookupString( XKeyEvent* /* event_struct */, char* /* buffer_return */, int /* bytes_buffer */, KeySym* /* keysym_return */, XComposeStatus* /* status_in_out */ ); extern Status XMatchVisualInfo( Display* /* display */, int /* screen */, int /* depth */, int /* class */, XVisualInfo* /* vinfo_return */ ); extern int XOffsetRegion( Region /* r */, int /* dx */, int /* dy */ ); extern Bool XPointInRegion( Region /* r */, int /* x */, int /* y */ ); extern Region XPolygonRegion( XPoint* /* points */, int /* n */, int /* fill_rule */ ); extern int XRectInRegion( Region /* r */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */ ); extern int XSaveContext( Display* /* display */, XID /* rid */, XContext /* context */, _Xconst char* /* data */ ); extern int XSetClassHint( Display* /* display */, Window /* w */, XClassHint* /* class_hints */ ); extern int XSetIconSizes( Display* /* display */, Window /* w */, XIconSize* /* size_list */, int /* count */ ); extern int XSetNormalHints( Display* /* display */, Window /* w */, XSizeHints* /* hints */ ); extern void XSetRGBColormaps( Display* /* display */, Window /* w */, XStandardColormap* /* stdcmaps */, int /* count */, Atom /* property */ ); extern int XSetSizeHints( Display* /* display */, Window /* w */, XSizeHints* /* hints */, Atom /* property */ ); extern int XSetStandardProperties( Display* /* display */, Window /* w */, _Xconst char* /* window_name */, _Xconst char* /* icon_name */, Pixmap /* icon_pixmap */, char** /* argv */, int /* argc */, XSizeHints* /* hints */ ); extern void XSetTextProperty( Display* /* display */, Window /* w */, XTextProperty* /* text_prop */, Atom /* property */ ); extern void XSetWMClientMachine( Display* /* display */, Window /* w */, XTextProperty* /* text_prop */ ); extern int XSetWMHints( Display* /* display */, Window /* w */, XWMHints* /* wm_hints */ ); extern void XSetWMIconName( Display* /* display */, Window /* w */, XTextProperty* /* text_prop */ ); extern void XSetWMName( Display* /* display */, Window /* w */, XTextProperty* /* text_prop */ ); extern void XSetWMNormalHints( Display* /* display */, Window /* w */, XSizeHints* /* hints */ ); extern void XSetWMProperties( Display* /* display */, Window /* w */, XTextProperty* /* window_name */, XTextProperty* /* icon_name */, char** /* argv */, int /* argc */, XSizeHints* /* normal_hints */, XWMHints* /* wm_hints */, XClassHint* /* class_hints */ ); extern void XmbSetWMProperties( Display* /* display */, Window /* w */, _Xconst char* /* window_name */, _Xconst char* /* icon_name */, char** /* argv */, int /* argc */, XSizeHints* /* normal_hints */, XWMHints* /* wm_hints */, XClassHint* /* class_hints */ ); extern void Xutf8SetWMProperties( Display* /* display */, Window /* w */, _Xconst char* /* window_name */, _Xconst char* /* icon_name */, char** /* argv */, int /* argc */, XSizeHints* /* normal_hints */, XWMHints* /* wm_hints */, XClassHint* /* class_hints */ ); extern void XSetWMSizeHints( Display* /* display */, Window /* w */, XSizeHints* /* hints */, Atom /* property */ ); extern int XSetRegion( Display* /* display */, GC /* gc */, Region /* r */ ); extern void XSetStandardColormap( Display* /* display */, Window /* w */, XStandardColormap* /* colormap */, Atom /* property */ ); extern int XSetZoomHints( Display* /* display */, Window /* w */, XSizeHints* /* zhints */ ); extern int XShrinkRegion( Region /* r */, int /* dx */, int /* dy */ ); extern Status XStringListToTextProperty( char** /* list */, int /* count */, XTextProperty* /* text_prop_return */ ); extern int XSubtractRegion( Region /* sra */, Region /* srb */, Region /* dr_return */ ); extern int XmbTextListToTextProperty( Display* display, char** list, int count, XICCEncodingStyle style, XTextProperty* text_prop_return ); extern int XwcTextListToTextProperty( Display* display, wchar_t** list, int count, XICCEncodingStyle style, XTextProperty* text_prop_return ); extern int Xutf8TextListToTextProperty( Display* display, char** list, int count, XICCEncodingStyle style, XTextProperty* text_prop_return ); extern void XwcFreeStringList( wchar_t** list ); extern Status XTextPropertyToStringList( XTextProperty* /* text_prop */, char*** /* list_return */, int* /* count_return */ ); extern int XmbTextPropertyToTextList( Display* display, const XTextProperty* text_prop, char*** list_return, int* count_return ); extern int XwcTextPropertyToTextList( Display* display, const XTextProperty* text_prop, wchar_t*** list_return, int* count_return ); extern int Xutf8TextPropertyToTextList( Display* display, const XTextProperty* text_prop, char*** list_return, int* count_return ); extern int XUnionRectWithRegion( XRectangle* /* rectangle */, Region /* src_region */, Region /* dest_region_return */ ); extern int XUnionRegion( Region /* sra */, Region /* srb */, Region /* dr_return */ ); extern int XWMGeometry( Display* /* display */, int /* screen_number */, _Xconst char* /* user_geometry */, _Xconst char* /* default_geometry */, unsigned int /* border_width */, XSizeHints* /* hints */, int* /* x_return */, int* /* y_return */, int* /* width_return */, int* /* height_return */, int* /* gravity_return */ ); extern int XXorRegion( Region /* sra */, Region /* srb */, Region /* dr_return */ ); #ifdef __clang__ #pragma clang diagnostic pop #endif _XFUNCPROTOEND #endif /* !defined(_X11_XUTIL_H_) && !defined(_XUTIL_H_) */ nx-libs-3.5.99.23/nx-X11/lib/include/xtrans/transport.c0000644000000000000000000000547413614532331017225 0ustar /* Copyright 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name NCR not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. NCR makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #define XTRANS_TRANSPORT_C /* used to flag Xtransint.h that it's being used here, not just #included in another file */ #include "Xtransint.h" #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wformat-nonliteral" #pragma clang diagnostic ignored "-Wdeprecated-declarations" #endif #ifdef LOCALCONN #include "Xtranslcl.c" #endif #if defined(TCPCONN) || defined(UNIXCONN) #include "Xtranssock.c" #endif #include "Xtrans.c" #include "Xtransutil.c" #ifdef __clang__ #pragma clang diagnostic pop #endif nx-libs-3.5.99.23/nx-X11/lib/include/xtrans/Xtrans.c0000644000000000000000000007222713614532331016450 0ustar /* Copyright 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name NCR not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. NCR makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #include #include #ifdef HAVE_SYSTEMD_DAEMON #include #endif /* * The transport table contains a definition for every transport (protocol) * family. All operations that can be made on the transport go through this * table. * * Each transport is assigned a unique transport id. * * New transports can be added by adding an entry in this table. * For compatiblity, the transport ids should never be renumbered. * Always add to the end of the list. */ #define TRANS_TLI_INET_INDEX 1 #define TRANS_TLI_TCP_INDEX 2 #define TRANS_TLI_TLI_INDEX 3 #define TRANS_SOCKET_UNIX_INDEX 4 #define TRANS_SOCKET_LOCAL_INDEX 5 #define TRANS_SOCKET_INET_INDEX 6 #define TRANS_SOCKET_TCP_INDEX 7 #define TRANS_DNET_INDEX 8 #define TRANS_LOCAL_LOCAL_INDEX 9 #define TRANS_LOCAL_PTS_INDEX 10 #define TRANS_LOCAL_NAMED_INDEX 11 /* 12 used to be ISC, but that's gone. */ #define TRANS_LOCAL_SCO_INDEX 13 #define TRANS_SOCKET_INET6_INDEX 14 #define TRANS_LOCAL_PIPE_INDEX 15 static Xtransport_table Xtransports[] = { #if defined(TCPCONN) { &TRANS(SocketTCPFuncs), TRANS_SOCKET_TCP_INDEX }, #if defined(IPv6) && defined(AF_INET6) { &TRANS(SocketINET6Funcs), TRANS_SOCKET_INET6_INDEX }, #endif /* IPv6 */ { &TRANS(SocketINETFuncs), TRANS_SOCKET_INET_INDEX }, #endif /* TCPCONN */ #if defined(UNIXCONN) #if !defined(LOCALCONN) { &TRANS(SocketLocalFuncs), TRANS_SOCKET_LOCAL_INDEX }, #endif /* !LOCALCONN */ { &TRANS(SocketUNIXFuncs), TRANS_SOCKET_UNIX_INDEX }, #endif /* UNIXCONN */ #if defined(LOCALCONN) { &TRANS(LocalFuncs), TRANS_LOCAL_LOCAL_INDEX }, #ifndef __sun { &TRANS(PTSFuncs), TRANS_LOCAL_PTS_INDEX }, #endif /* __sun */ #if defined(SVR4) || defined(__SVR4) { &TRANS(NAMEDFuncs), TRANS_LOCAL_NAMED_INDEX }, #endif #ifdef __sun { &TRANS(PIPEFuncs), TRANS_LOCAL_PIPE_INDEX }, #endif /* __sun */ #if defined(__SCO__) || defined(__UNIXWARE__) { &TRANS(SCOFuncs), TRANS_LOCAL_SCO_INDEX }, #endif /* __SCO__ || __UNIXWARE__ */ #endif /* LOCALCONN */ }; #define NUMTRANS (sizeof(Xtransports)/sizeof(Xtransport_table)) #ifdef WIN32 #define ioctl ioctlsocket #endif /* * These are a few utility function used by the public interface functions. */ void TRANS(FreeConnInfo) (XtransConnInfo ciptr) { prmsg (3,"FreeConnInfo(%p)\n", (void *) ciptr); if (ciptr->addr) free (ciptr->addr); if (ciptr->peeraddr) free (ciptr->peeraddr); if (ciptr->port) free (ciptr->port); free (ciptr); } #define PROTOBUFSIZE 20 static Xtransport * TRANS(SelectTransport) (const char *protocol) { char protobuf[PROTOBUFSIZE]; int i; prmsg (3,"SelectTransport(%s)\n", protocol); /* * Force Protocol to be lowercase as a way of doing * a case insensitive match. */ strncpy (protobuf, protocol, PROTOBUFSIZE - 1); protobuf[PROTOBUFSIZE-1] = '\0'; for (i = 0; i < PROTOBUFSIZE && protobuf[i] != '\0'; i++) if (isupper ((unsigned char)protobuf[i])) protobuf[i] = tolower ((unsigned char)protobuf[i]); /* Look at all of the configured protocols */ for (i = 0; i < NUMTRANS; i++) { if (!strcmp (protobuf, Xtransports[i].transport->TransName)) return Xtransports[i].transport; } return NULL; } #ifndef TEST_t static #endif /* TEST_t */ int TRANS(ParseAddress) (const char *address, char **protocol, char **host, char **port) { /* * For the font library, the address is a string formatted * as "protocol/host:port[/catalogue]". Note that the catologue * is optional. At this time, the catologue info is ignored, but * we have to parse it anyways. * * Other than fontlib, the address is a string formatted * as "protocol/host:port". * * If the protocol part is missing, then assume TCP. * If the protocol part and host part are missing, then assume local. * If a "::" is found then assume DNET. */ char *mybuf, *tmpptr; const char *_protocol; char *_host, *_port; char hostnamebuf[256]; int _host_len; prmsg (3,"ParseAddress(%s)\n", address); /* Copy the string so it can be changed */ tmpptr = mybuf = strdup (address); /* Parse the string to get each component */ /* Get the protocol part */ _protocol = mybuf; if ( ((mybuf = strchr (mybuf,'/')) == NULL) && ((mybuf = strrchr (tmpptr,':')) == NULL) ) { /* address is in a bad format */ *protocol = NULL; *host = NULL; *port = NULL; free (tmpptr); return 0; } if (*mybuf == ':') { /* * If there is a hostname, then assume tcp, otherwise * it must be local. */ if (mybuf == tmpptr) { /* There is neither a protocol or host specified */ _protocol = "local"; } else { /* There is a hostname specified */ _protocol = "tcp"; mybuf = tmpptr; /* reset to the begining of the host ptr */ } } else { /* *mybuf == '/' */ *mybuf ++= '\0'; /* put a null at the end of the protocol */ if (strlen(_protocol) == 0) { /* * If there is a hostname, then assume tcp, otherwise * it must be local. */ if (*mybuf != ':') _protocol = "tcp"; else _protocol = "local"; } } /* Get the host part */ _host = mybuf; if ((mybuf = strrchr (mybuf,':')) == NULL) { *protocol = NULL; *host = NULL; *port = NULL; free (tmpptr); return 0; } *mybuf ++= '\0'; _host_len = strlen(_host); if (_host_len == 0) { TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf)); _host = hostnamebuf; } #if defined(IPv6) && defined(AF_INET6) /* hostname in IPv6 [numeric_addr]:0 form? */ else if ( (_host_len > 3) && ((strcmp(_protocol, "tcp") == 0) || (strcmp(_protocol, "inet6") == 0)) && (*_host == '[') && (*(_host + _host_len - 1) == ']') ) { struct sockaddr_in6 sin6; *(_host + _host_len - 1) = '\0'; /* Verify address is valid IPv6 numeric form */ if (inet_pton(AF_INET6, _host + 1, &sin6) == 1) { /* It is. Use it as such. */ _host++; _protocol = "inet6"; } else { /* It's not, restore it just in case some other code can use it. */ *(_host + _host_len - 1) = ']'; } } #endif /* Get the port */ _port = mybuf; #if defined(FONT_t) || defined(FS_t) /* * Is there an optional catalogue list? */ if ((mybuf = strchr (mybuf,'/')) != NULL) *mybuf ++= '\0'; /* * The rest, if any, is the (currently unused) catalogue list. * * _catalogue = mybuf; */ #endif #ifdef HAVE_LAUNCHD /* launchd sockets will look like 'local//tmp/launch-XgkNns/:0' */ if(address != NULL && strlen(address)>8 && (!strncmp(address,"local//",7))) { _protocol="local"; _host=""; _port=address+6; } #endif /* * Now that we have all of the components, allocate new * string space for them. */ if ((*protocol = strdup (_protocol)) == NULL) { /* Malloc failed */ *port = NULL; *host = NULL; *protocol = NULL; free (tmpptr); return 0; } if ((*host = strdup (_host)) == NULL) { /* Malloc failed */ *port = NULL; *host = NULL; free (*protocol); *protocol = NULL; free (tmpptr); return 0; } if ((*port = strdup (_port)) == NULL) { /* Malloc failed */ *port = NULL; free (*host); *host = NULL; free (*protocol); *protocol = NULL; free (tmpptr); return 0; } free (tmpptr); return 1; } /* * TRANS(Open) does all of the real work opening a connection. The only * funny part about this is the type parameter which is used to decide which * type of open to perform. */ static XtransConnInfo TRANS(Open) (int type, const char *address) { char *protocol = NULL, *host = NULL, *port = NULL; XtransConnInfo ciptr = NULL; Xtransport *thistrans; prmsg (2,"Open(%d,%s)\n", type, address); #if defined(WIN32) && defined(TCPCONN) if (TRANS(WSAStartup)()) { prmsg (1,"Open: WSAStartup failed\n"); return NULL; } #endif /* Parse the Address */ if (TRANS(ParseAddress) (address, &protocol, &host, &port) == 0) { prmsg (1,"Open: Unable to Parse address %s\n", address); return NULL; } /* Determine the transport type */ if ((thistrans = TRANS(SelectTransport) (protocol)) == NULL) { prmsg (1,"Open: Unable to find transport for %s\n", protocol); free (protocol); free (host); free (port); return NULL; } /* Open the transport */ switch (type) { case XTRANS_OPEN_COTS_CLIENT: #ifdef TRANS_CLIENT ciptr = thistrans->OpenCOTSClient(thistrans, protocol, host, port); #endif /* TRANS_CLIENT */ break; case XTRANS_OPEN_COTS_SERVER: #ifdef TRANS_SERVER ciptr = thistrans->OpenCOTSServer(thistrans, protocol, host, port); #endif /* TRANS_SERVER */ break; default: prmsg (1,"Open: Unknown Open type %d\n", type); } if (ciptr == NULL) { if (!(thistrans->flags & TRANS_DISABLED)) { prmsg (1,"Open: transport open failed for %s/%s:%s\n", protocol, host, port); } free (protocol); free (host); free (port); return NULL; } ciptr->transptr = thistrans; ciptr->port = port; /* We need this for TRANS(Reopen) */ free (protocol); free (host); return ciptr; } #ifdef TRANS_REOPEN /* * We might want to create an XtransConnInfo object based on a previously * opened connection. For example, the font server may clone itself and * pass file descriptors to the parent. */ static XtransConnInfo TRANS(Reopen) (int type, int trans_id, int fd, const char *port) { XtransConnInfo ciptr = NULL; Xtransport *thistrans = NULL; char *save_port; int i; prmsg (2,"Reopen(%d,%d,%s)\n", trans_id, fd, port); /* Determine the transport type */ for (i = 0; i < NUMTRANS; i++) if (Xtransports[i].transport_id == trans_id) { thistrans = Xtransports[i].transport; break; } if (thistrans == NULL) { prmsg (1,"Reopen: Unable to find transport id %d\n", trans_id); return NULL; } if ((save_port = strdup (port)) == NULL) { prmsg (1,"Reopen: Unable to malloc port string\n"); return NULL; } /* Get a new XtransConnInfo object */ switch (type) { case XTRANS_OPEN_COTS_SERVER: ciptr = thistrans->ReopenCOTSServer(thistrans, fd, port); break; default: prmsg (1,"Reopen: Bad Open type %d\n", type); } if (ciptr == NULL) { prmsg (1,"Reopen: transport open failed\n"); free (save_port); return NULL; } ciptr->transptr = thistrans; ciptr->port = save_port; return ciptr; } #endif /* TRANS_REOPEN */ /* * These are the public interfaces to this Transport interface. * These are the only functions that should have knowledge of the transport * table. */ #ifdef TRANS_CLIENT XtransConnInfo TRANS(OpenCOTSClient) (const char *address) { prmsg (2,"OpenCOTSClient(%s)\n", address); return TRANS(Open) (XTRANS_OPEN_COTS_CLIENT, address); } #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER XtransConnInfo TRANS(OpenCOTSServer) (const char *address) { prmsg (2,"OpenCOTSServer(%s)\n", address); return TRANS(Open) (XTRANS_OPEN_COTS_SERVER, address); } #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN XtransConnInfo TRANS(ReopenCOTSServer) (int trans_id, int fd, const char *port) { prmsg (2,"ReopenCOTSServer(%d, %d, %s)\n", trans_id, fd, port); return TRANS(Reopen) (XTRANS_OPEN_COTS_SERVER, trans_id, fd, port); } int TRANS(GetReopenInfo) (XtransConnInfo ciptr, int *trans_id, int *fd, char **port) { int i; for (i = 0; i < NUMTRANS; i++) if (Xtransports[i].transport == ciptr->transptr) { *trans_id = Xtransports[i].transport_id; *fd = ciptr->fd; if ((*port = strdup (ciptr->port)) == NULL) return 0; else return 1; } return 0; } #endif /* TRANS_REOPEN */ int TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg) { int fd = ciptr->fd; int ret = 0; prmsg (2,"SetOption(%d,%d,%d)\n", fd, option, arg); /* * For now, all transport type use the same stuff for setting options. * As long as this is true, we can put the common code here. Once a more * complicated transport such as shared memory or an OSI implementation * that uses the session and application libraries is implemented, this * code may have to move to a transport dependent function. * * ret = ciptr->transptr->SetOption (ciptr, option, arg); */ switch (option) { case TRANS_NONBLOCKING: switch (arg) { case 0: /* Set to blocking mode */ break; case 1: /* Set to non-blocking mode */ #if defined(O_NONBLOCK) && !defined(SCO325) ret = fcntl (fd, F_GETFL, 0); if (ret != -1) ret = fcntl (fd, F_SETFL, ret | O_NONBLOCK); #else #ifdef FIOSNBIO { int arg; arg = 1; ret = ioctl (fd, FIOSNBIO, &arg); } #else #if defined(WIN32) { #ifdef WIN32 u_long arg; #else int arg; #endif arg = 1; /* IBM TCP/IP understands this option too well: it causes TRANS(Read) to fail * eventually with EWOULDBLOCK */ ret = ioctl (fd, FIONBIO, &arg); } #else ret = fcntl (fd, F_GETFL, 0); #ifdef FNDELAY ret = fcntl (fd, F_SETFL, ret | FNDELAY); #else ret = fcntl (fd, F_SETFL, ret | O_NDELAY); #endif #endif /* WIN32 */ #endif /* FIOSNBIO */ #endif /* O_NONBLOCK */ break; default: /* Unknown option */ break; } break; case TRANS_CLOSEONEXEC: #ifdef F_SETFD #ifdef FD_CLOEXEC ret = fcntl (fd, F_SETFD, FD_CLOEXEC); #else ret = fcntl (fd, F_SETFD, 1); #endif /* FD_CLOEXEC */ #endif /* F_SETFD */ break; } return ret; } #ifdef TRANS_SERVER int TRANS(CreateListener) (XtransConnInfo ciptr, const char *port, unsigned int flags) { return ciptr->transptr->CreateListener (ciptr, port, flags); } int TRANS(Received) (const char * protocol) { Xtransport *trans; int i = 0, ret = 0; prmsg (5, "Received(%s)\n", protocol); if ((trans = TRANS(SelectTransport)(protocol)) == NULL) { prmsg (1,"Received: unable to find transport: %s\n", protocol); return -1; } if (trans->flags & TRANS_ALIAS) { if (trans->nolisten) while (trans->nolisten[i]) { ret |= TRANS(Received)(trans->nolisten[i]); i++; } } trans->flags |= TRANS_RECEIVED; return ret; } int TRANS(NoListen) (const char * protocol) { Xtransport *trans; int i = 0, ret = 0; if ((trans = TRANS(SelectTransport)(protocol)) == NULL) { prmsg (1,"TransNoListen: unable to find transport: %s\n", protocol); return -1; } if (trans->flags & TRANS_ALIAS) { if (trans->nolisten) while (trans->nolisten[i]) { ret |= TRANS(NoListen)(trans->nolisten[i]); i++; } } trans->flags |= TRANS_NOLISTEN; return ret; } int TRANS(Listen) (const char * protocol) { Xtransport *trans; int i = 0, ret = 0; if ((trans = TRANS(SelectTransport)(protocol)) == NULL) { prmsg (1,"TransListen: unable to find transport: %s\n", protocol); return -1; } if (trans->flags & TRANS_ALIAS) { if (trans->nolisten) while (trans->nolisten[i]) { ret |= TRANS(Listen)(trans->nolisten[i]); i++; } } trans->flags &= ~TRANS_NOLISTEN; return ret; } int TRANS(IsListening) (const char * protocol) { Xtransport *trans; if ((trans = TRANS(SelectTransport)(protocol)) == NULL) { prmsg (1,"TransIsListening: unable to find transport: %s\n", protocol); return 0; } return !(trans->flags & TRANS_NOLISTEN); } int TRANS(ResetListener) (XtransConnInfo ciptr) { if (ciptr->transptr->ResetListener) return ciptr->transptr->ResetListener (ciptr); else return TRANS_RESET_NOOP; } XtransConnInfo TRANS(Accept) (XtransConnInfo ciptr, int *status) { XtransConnInfo newciptr; prmsg (2,"Accept(%d)\n", ciptr->fd); newciptr = ciptr->transptr->Accept (ciptr, status); if (newciptr) newciptr->transptr = ciptr->transptr; return newciptr; } #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT int TRANS(Connect) (XtransConnInfo ciptr, const char *address) { char *protocol; char *host; char *port; int ret; prmsg (2,"Connect(%d,%s)\n", ciptr->fd, address); if (TRANS(ParseAddress) (address, &protocol, &host, &port) == 0) { prmsg (1,"Connect: Unable to Parse address %s\n", address); return -1; } #ifdef HAVE_LAUNCHD if (!host) host=strdup(""); #endif if (!port || !*port) { prmsg (1,"Connect: Missing port specification in %s\n", address); if (protocol) free (protocol); if (host) free (host); return -1; } ret = ciptr->transptr->Connect (ciptr, host, port); if (protocol) free (protocol); if (host) free (host); if (port) free (port); return ret; } #endif /* TRANS_CLIENT */ int TRANS(BytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend) { return ciptr->transptr->BytesReadable (ciptr, pend); } int TRANS(Read) (XtransConnInfo ciptr, char *buf, int size) { return ciptr->transptr->Read (ciptr, buf, size); } int TRANS(Write) (XtransConnInfo ciptr, char *buf, int size) { return ciptr->transptr->Write (ciptr, buf, size); } int TRANS(Readv) (XtransConnInfo ciptr, struct iovec *buf, int size) { return ciptr->transptr->Readv (ciptr, buf, size); } int TRANS(Writev) (XtransConnInfo ciptr, struct iovec *buf, int size) { return ciptr->transptr->Writev (ciptr, buf, size); } #if XTRANS_SEND_FDS int TRANS(SendFd) (XtransConnInfo ciptr, int fd, int do_close) { return ciptr->transptr->SendFd(ciptr, fd, do_close); } int TRANS(RecvFd) (XtransConnInfo ciptr) { return ciptr->transptr->RecvFd(ciptr); } #endif int TRANS(Disconnect) (XtransConnInfo ciptr) { return ciptr->transptr->Disconnect (ciptr); } int TRANS(Close) (XtransConnInfo ciptr) { int ret; prmsg (2,"Close(%d)\n", ciptr->fd); ret = ciptr->transptr->Close (ciptr); TRANS(FreeConnInfo) (ciptr); return ret; } int TRANS(CloseForCloning) (XtransConnInfo ciptr) { int ret; prmsg (2,"CloseForCloning(%d)\n", ciptr->fd); ret = ciptr->transptr->CloseForCloning (ciptr); TRANS(FreeConnInfo) (ciptr); return ret; } int TRANS(IsLocal) (XtransConnInfo ciptr) { return (ciptr->family == AF_UNIX); } #ifdef NX_TRANS_SOCKET /* this is needed for pre-xcb X11 as we have in NX */ int TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp, Xtransaddr **addrp) { prmsg (2,"GetMyAddr(%d)\n", ciptr->fd); *familyp = ciptr->family; *addrlenp = ciptr->addrlen; if ((*addrp = (Xtransaddr *) malloc (ciptr->addrlen)) == NULL) { prmsg (1,"GetMyAddr: malloc failed\n"); return -1; } memcpy(*addrp, ciptr->addr, ciptr->addrlen); return 0; } #endif int TRANS(GetPeerAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp, Xtransaddr **addrp) { prmsg (2,"GetPeerAddr(%d)\n", ciptr->fd); *familyp = ciptr->family; *addrlenp = ciptr->peeraddrlen; if ((*addrp = malloc (ciptr->peeraddrlen)) == NULL) { prmsg (1,"GetPeerAddr: malloc failed\n"); return -1; } memcpy(*addrp, ciptr->peeraddr, ciptr->peeraddrlen); return 0; } int TRANS(GetConnectionNumber) (XtransConnInfo ciptr) { return ciptr->fd; } /* * These functions are really utility functions, but they require knowledge * of the internal data structures, so they have to be part of the Transport * Independant API. */ #ifdef TRANS_SERVER static int complete_network_count (void) { int count = 0; int found_local = 0; int i; /* * For a complete network, we only need one LOCALCONN transport to work */ for (i = 0; i < NUMTRANS; i++) { if (Xtransports[i].transport->flags & TRANS_ALIAS || Xtransports[i].transport->flags & TRANS_NOLISTEN) continue; if (Xtransports[i].transport->flags & TRANS_LOCAL) found_local = 1; else count++; } return (count + found_local); } static int receive_listening_fds(const char* port, XtransConnInfo* temp_ciptrs, int* count_ret) { #ifdef HAVE_SYSTEMD_DAEMON XtransConnInfo ciptr; int i, systemd_listen_fds; systemd_listen_fds = sd_listen_fds(1); if (systemd_listen_fds < 0) { prmsg (1, "receive_listening_fds: sd_listen_fds error: %s\n", strerror(-systemd_listen_fds)); return -1; } for (i = 0; i < systemd_listen_fds && *count_ret < NUMTRANS; i++) { struct sockaddr_storage a; int ti; const char* tn; socklen_t al; al = sizeof(a); if (getsockname(i + SD_LISTEN_FDS_START, (struct sockaddr*)&a, &al) < 0) { prmsg (1, "receive_listening_fds: getsockname error: %s\n", strerror(errno)); return -1; } switch (a.ss_family) { case AF_UNIX: ti = TRANS_SOCKET_UNIX_INDEX; if (*((struct sockaddr_un*)&a)->sun_path == '\0' && al > sizeof(sa_family_t)) tn = "local"; else tn = "unix"; break; case AF_INET: ti = TRANS_SOCKET_INET_INDEX; tn = "inet"; break; #if defined(IPv6) && defined(AF_INET6) case AF_INET6: ti = TRANS_SOCKET_INET6_INDEX; tn = "inet6"; break; #endif /* IPv6 */ default: prmsg (1, "receive_listening_fds:" "Got unknown socket address family\n"); return -1; } ciptr = TRANS(ReopenCOTSServer)(ti, i + SD_LISTEN_FDS_START, port); if (!ciptr) { prmsg (1, "receive_listening_fds:" "Got NULL while trying to reopen socket received from systemd.\n"); return -1; } prmsg (5, "receive_listening_fds: received listener for %s, %d\n", tn, ciptr->fd); temp_ciptrs[(*count_ret)++] = ciptr; TRANS(Received)(tn); } #endif /* HAVE_SYSTEMD_DAEMON */ return 0; } #ifdef XQUARTZ_EXPORTS_LAUNCHD_FD extern int xquartz_launchd_fd; #endif int TRANS(MakeAllCOTSServerListeners) (const char *port, int *partial, int *count_ret, XtransConnInfo **ciptrs_ret) { char buffer[256]; /* ??? What size ?? */ XtransConnInfo ciptr, temp_ciptrs[NUMTRANS]; int status, i, j; #if defined(IPv6) && defined(AF_INET6) int ipv6_succ = 0; #endif prmsg (2,"MakeAllCOTSServerListeners(%s,%p)\n", port ? port : "NULL", (void *) ciptrs_ret); *count_ret = 0; #ifdef XQUARTZ_EXPORTS_LAUNCHD_FD fprintf(stderr, "Launchd socket fd: %d\n", xquartz_launchd_fd); if(xquartz_launchd_fd != -1) { if((ciptr = TRANS(ReopenCOTSServer(TRANS_SOCKET_LOCAL_INDEX, xquartz_launchd_fd, getenv("DISPLAY"))))==NULL) fprintf(stderr,"Got NULL while trying to Reopen launchd port\n"); else temp_ciptrs[(*count_ret)++] = ciptr; } #endif if (receive_listening_fds(port, temp_ciptrs, count_ret) < 0) return -1; for (i = 0; i < NUMTRANS; i++) { Xtransport *trans = Xtransports[i].transport; unsigned int flags = 0; if (trans->flags&TRANS_ALIAS || trans->flags&TRANS_NOLISTEN || trans->flags&TRANS_RECEIVED) continue; snprintf(buffer, sizeof(buffer), "%s/:%s", trans->TransName, port ? port : ""); prmsg (5,"MakeAllCOTSServerListeners: opening %s\n", buffer); if ((ciptr = TRANS(OpenCOTSServer(buffer))) == NULL) { if (trans->flags & TRANS_DISABLED) continue; prmsg (1, "MakeAllCOTSServerListeners: failed to open listener for %s\n", trans->TransName); continue; } #if defined(IPv6) && defined(AF_INET6) if ((Xtransports[i].transport_id == TRANS_SOCKET_INET_INDEX && ipv6_succ)) flags |= ADDR_IN_USE_ALLOWED; #endif if ((status = TRANS(CreateListener (ciptr, port, flags))) < 0) { if (status == TRANS_ADDR_IN_USE) { /* * We failed to bind to the specified address because the * address is in use. It must be that a server is already * running at this address, and this function should fail. */ prmsg (1, "MakeAllCOTSServerListeners: server already running\n"); for (j = 0; j < *count_ret; j++) TRANS(Close) (temp_ciptrs[j]); *count_ret = 0; *ciptrs_ret = NULL; *partial = 0; return -1; } else { prmsg (1, "MakeAllCOTSServerListeners: failed to create listener for %s\n", trans->TransName); continue; } } #if defined(IPv6) && defined(AF_INET6) if (Xtransports[i].transport_id == TRANS_SOCKET_INET6_INDEX) ipv6_succ = 1; #endif prmsg (5, "MakeAllCOTSServerListeners: opened listener for %s, %d\n", trans->TransName, ciptr->fd); temp_ciptrs[*count_ret] = ciptr; (*count_ret)++; } *partial = (*count_ret < complete_network_count()); prmsg (5, "MakeAllCOTSServerListeners: partial=%d, actual=%d, complete=%d \n", *partial, *count_ret, complete_network_count()); if (*count_ret > 0) { if ((*ciptrs_ret = malloc ( *count_ret * sizeof (XtransConnInfo))) == NULL) { return -1; } for (i = 0; i < *count_ret; i++) { (*ciptrs_ret)[i] = temp_ciptrs[i]; } } else *ciptrs_ret = NULL; return 0; } #endif /* TRANS_SERVER */ /* * These routines are not part of the X Transport Interface, but they * may be used by it. */ #ifdef WIN32 /* * emulate readv */ static int TRANS(ReadV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt) { int i, len, total; char *base; ESET(0); for (i = 0, total = 0; i < iovcnt; i++, iov++) { len = iov->iov_len; base = iov->iov_base; while (len > 0) { register int nbytes; nbytes = TRANS(Read) (ciptr, base, len); if (nbytes < 0 && total == 0) return -1; if (nbytes <= 0) return total; ESET(0); len -= nbytes; total += nbytes; base += nbytes; } } return total; } /* * emulate writev */ static int TRANS(WriteV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt) { int i, len, total; char *base; ESET(0); for (i = 0, total = 0; i < iovcnt; i++, iov++) { len = iov->iov_len; base = iov->iov_base; while (len > 0) { register int nbytes; nbytes = TRANS(Write) (ciptr, base, len); if (nbytes < 0 && total == 0) return -1; if (nbytes <= 0) return total; ESET(0); len -= nbytes; total += nbytes; base += nbytes; } } return total; } #endif /* WIN32 */ #if defined(_POSIX_SOURCE) || defined(USG) || defined(SVR4) || defined(__SVR4) || defined(__SCO__) #ifndef NEED_UTSNAME #define NEED_UTSNAME #endif #include #endif /* * TRANS(GetHostname) - similar to gethostname but allows special processing. */ int TRANS(GetHostname) (char *buf, int maxlen) { int len; #ifdef NEED_UTSNAME struct utsname name; uname (&name); len = strlen (name.nodename); if (len >= maxlen) len = maxlen - 1; strncpy (buf, name.nodename, len); buf[len] = '\0'; #else buf[0] = '\0'; (void) gethostname (buf, maxlen); buf [maxlen - 1] = '\0'; len = strlen(buf); #endif /* NEED_UTSNAME */ return len; } nx-libs-3.5.99.23/nx-X11/lib/include/xtrans/Xtrans.h0000644000000000000000000002152413614532331016447 0ustar /* Copyright 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name NCR not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. NCR makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _XTRANS_H_ #define _XTRANS_H_ #include #include #include #ifndef WIN32 #include #endif #ifdef __clang__ /* Not all clients make use of all provided statics */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-function" #endif /* * Set the functions names according to where this code is being compiled. */ #ifdef X11_t #define TRANS(func) _X11Trans##func #ifdef XTRANSDEBUG static const char *__xtransname = "_X11Trans"; #endif #endif /* X11_t */ #ifdef XSERV_t #define TRANS(func) _XSERVTrans##func #ifdef XTRANSDEBUG static const char *__xtransname = "_XSERVTrans"; #endif #define X11_t #endif /* XSERV_t */ #ifdef XIM_t #define TRANS(func) _XimXTrans##func #ifdef XTRANSDEBUG static const char *__xtransname = "_XimTrans"; #endif #endif /* XIM_t */ #ifdef FS_t #define TRANS(func) _FSTrans##func #ifdef XTRANSDEBUG static const char *__xtransname = "_FSTrans"; #endif #endif /* FS_t */ #ifdef FONT_t #define TRANS(func) _FontTrans##func #ifdef XTRANSDEBUG static const char *__xtransname = "_FontTrans"; #endif #endif /* FONT_t */ #ifdef ICE_t #define TRANS(func) _IceTrans##func #ifdef XTRANSDEBUG static const char *__xtransname = "_IceTrans"; #endif #endif /* ICE_t */ #if !defined(TRANS) #define TRANS(func) _XTrans##func #ifdef XTRANSDEBUG static const char *__xtransname = "_XTrans"; #endif #endif /* !TRANS */ #ifdef __clang__ #pragma clang diagnostic pop #endif /* * Create a single address structure that can be used wherever * an address structure is needed. struct sockaddr is not big enough * to hold a sockadd_un, so we create this definition to have a single * structure that is big enough for all the structures we might need. * * This structure needs to be independent of the socket/TLI interface used. */ #if defined(IPv6) && defined(AF_INET6) typedef struct sockaddr_storage Xtransaddr; #else #define XTRANS_MAX_ADDR_LEN 128 /* large enough to hold sun_path */ typedef struct { unsigned char addr[XTRANS_MAX_ADDR_LEN]; } Xtransaddr; #endif #ifdef LONG64 typedef int BytesReadable_t; #else typedef long BytesReadable_t; #endif #if defined(WIN32) || defined(USG) /* * TRANS(Readv) and TRANS(Writev) use struct iovec, normally found * in Berkeley systems in . See the readv(2) and writev(2) * manual pages for details. */ struct iovec { caddr_t iov_base; int iov_len; }; #else #include #endif typedef struct _XtransConnInfo *XtransConnInfo; /* * Transport Option definitions */ #define TRANS_NONBLOCKING 1 #define TRANS_CLOSEONEXEC 2 /* * Return values of Connect (0 is success) */ #define TRANS_CONNECT_FAILED -1 #define TRANS_TRY_CONNECT_AGAIN -2 #define TRANS_IN_PROGRESS -3 /* * Return values of CreateListener (0 is success) */ #define TRANS_CREATE_LISTENER_FAILED -1 #define TRANS_ADDR_IN_USE -2 /* * Return values of Accept (0 is success) */ #define TRANS_ACCEPT_BAD_MALLOC -1 #define TRANS_ACCEPT_FAILED -2 #define TRANS_ACCEPT_MISC_ERROR -3 /* * ResetListener return values */ #define TRANS_RESET_NOOP 1 #define TRANS_RESET_NEW_FD 2 #define TRANS_RESET_FAILURE 3 /* * Function prototypes for the exposed interface */ void TRANS(FreeConnInfo) ( XtransConnInfo /* ciptr */ ); #ifdef TRANS_CLIENT XtransConnInfo TRANS(OpenCOTSClient)( const char * /* address */ ); #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER XtransConnInfo TRANS(OpenCOTSServer)( const char * /* address */ ); #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN XtransConnInfo TRANS(ReopenCOTSServer)( int, /* trans_id */ int, /* fd */ const char * /* port */ ); int TRANS(GetReopenInfo)( XtransConnInfo, /* ciptr */ int *, /* trans_id */ int *, /* fd */ char ** /* port */ ); #endif /* TRANS_REOPEN */ int TRANS(SetOption)( XtransConnInfo, /* ciptr */ int, /* option */ int /* arg */ ); #ifdef TRANS_SERVER int TRANS(CreateListener)( XtransConnInfo, /* ciptr */ const char *, /* port */ unsigned int /* flags */ ); int TRANS(Received) ( const char* /* protocol*/ ); int TRANS(NoListen) ( const char* /* protocol*/ ); int TRANS(Listen) ( const char* /* protocol*/ ); int TRANS(IsListening) ( const char* /* protocol*/ ); int TRANS(ResetListener)( XtransConnInfo /* ciptr */ ); XtransConnInfo TRANS(Accept)( XtransConnInfo, /* ciptr */ int * /* status */ ); #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT int TRANS(Connect)( XtransConnInfo, /* ciptr */ const char * /* address */ ); #endif /* TRANS_CLIENT */ int TRANS(BytesReadable)( XtransConnInfo, /* ciptr */ BytesReadable_t * /* pend */ ); int TRANS(Read)( XtransConnInfo, /* ciptr */ char *, /* buf */ int /* size */ ); int TRANS(Write)( XtransConnInfo, /* ciptr */ char *, /* buf */ int /* size */ ); int TRANS(Readv)( XtransConnInfo, /* ciptr */ struct iovec *, /* buf */ int /* size */ ); int TRANS(Writev)( XtransConnInfo, /* ciptr */ struct iovec *, /* buf */ int /* size */ ); int TRANS(SendFd) (XtransConnInfo ciptr, int fd, int do_close); int TRANS(RecvFd) (XtransConnInfo ciptr); int TRANS(Disconnect)( XtransConnInfo /* ciptr */ ); int TRANS(Close)( XtransConnInfo /* ciptr */ ); int TRANS(CloseForCloning)( XtransConnInfo /* ciptr */ ); int TRANS(IsLocal)( XtransConnInfo /* ciptr */ ); #ifdef NX_TRANS_SOCKET /* needed for pre-xcb libX11 as we have in NX */ int TRANS(GetMyAddr)( XtransConnInfo, /* ciptr */ int *, /* familyp */ int *, /* addrlenp */ Xtransaddr ** /* addrp */ ); #endif int TRANS(GetPeerAddr)( XtransConnInfo, /* ciptr */ int *, /* familyp */ int *, /* addrlenp */ Xtransaddr ** /* addrp */ ); int TRANS(GetConnectionNumber)( XtransConnInfo /* ciptr */ ); #ifdef TRANS_SERVER int TRANS(MakeAllCOTSServerListeners)( const char *, /* port */ int *, /* partial */ int *, /* count_ret */ XtransConnInfo ** /* ciptrs_ret */ ); #endif /* TRANS_SERVER */ /* * Function Prototypes for Utility Functions. */ #ifdef X11_t int TRANS(ConvertAddress)( int *, /* familyp */ int *, /* addrlenp */ Xtransaddr ** /* addrp */ ); #endif /* X11_t */ #ifdef ICE_t char * TRANS(GetMyNetworkId)( XtransConnInfo /* ciptr */ ); char * TRANS(GetPeerNetworkId)( XtransConnInfo /* ciptr */ ); #endif /* ICE_t */ int TRANS(GetHostname) ( char * /* buf */, int /* maxlen */ ); #if defined(WIN32) && defined(TCPCONN) int TRANS(WSAStartup)(); #endif #endif /* _XTRANS_H_ */ nx-libs-3.5.99.23/nx-X11/lib/include/xtrans/Xtransint.h0000644000000000000000000002370713614532331017167 0ustar /* Copyright 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name NCR not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. NCR makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _XTRANSINT_H_ #define _XTRANSINT_H_ /* * XTRANSDEBUG will enable the PRMSG() macros used in the X Transport * Interface code. Each use of the PRMSG macro has a level associated with * it. XTRANSDEBUG is defined to be a level. If the invocation level is =< * the value of XTRANSDEBUG, then the message will be printed out to stderr. * Recommended levels are: * * XTRANSDEBUG=1 Error messages * XTRANSDEBUG=2 API Function Tracing * XTRANSDEBUG=3 All Function Tracing * XTRANSDEBUG=4 printing of intermediate values * XTRANSDEBUG=5 really detailed stuff #define XTRANSDEBUG 2 * * Defining XTRANSDEBUGTIMESTAMP will cause printing timestamps with each * message. */ #if !defined(XTRANSDEBUG) && defined(XTRANS_TRANSPORT_C) # define XTRANSDEBUG 1 #endif #ifdef WIN32 # define _WILLWINSOCK_ #endif #include "Xtrans.h" #ifndef _X_UNUSED /* Defined in Xfuncproto.h in xproto >= 7.0.22 */ # define _X_UNUSED /* */ #endif #ifdef XTRANSDEBUG # include #endif /* XTRANSDEBUG */ #include #ifndef WIN32 # include # include # include /* * Moved the setting of NEED_UTSNAME to this header file from Xtrans.c, * to avoid a race condition. JKJ (6/5/97) */ # if defined(_POSIX_SOURCE) || defined(USG) || defined(SVR4) || defined(__SVR4) || defined(__SCO__) # ifndef NEED_UTSNAME # define NEED_UTSNAME # endif # include # endif # define ESET(val) errno = val # define EGET() errno #else /* WIN32 */ # include /* for USHRT_MAX */ # define ESET(val) WSASetLastError(val) # define EGET() WSAGetLastError() #endif /* WIN32 */ #include #ifdef X11_t #define X_TCP_PORT 6000 #endif #if XTRANS_SEND_FDS struct _XtransConnFd { struct _XtransConnFd *next; int fd; int do_close; }; #endif struct _XtransConnInfo { struct _Xtransport *transptr; int index; char *priv; int flags; int fd; char *port; int family; char *addr; int addrlen; char *peeraddr; int peeraddrlen; struct _XtransConnFd *recv_fds; struct _XtransConnFd *send_fds; }; #define XTRANS_OPEN_COTS_CLIENT 1 #define XTRANS_OPEN_COTS_SERVER 2 typedef struct _Xtransport { const char *TransName; int flags; #ifdef TRANS_CLIENT XtransConnInfo (*OpenCOTSClient)( struct _Xtransport *, /* transport */ const char *, /* protocol */ const char *, /* host */ const char * /* port */ ); #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER const char ** nolisten; XtransConnInfo (*OpenCOTSServer)( struct _Xtransport *, /* transport */ const char *, /* protocol */ const char *, /* host */ const char * /* port */ ); #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN XtransConnInfo (*ReopenCOTSServer)( struct _Xtransport *, /* transport */ int, /* fd */ const char * /* port */ ); #endif /* TRANS_REOPEN */ int (*SetOption)( XtransConnInfo, /* connection */ int, /* option */ int /* arg */ ); #ifdef TRANS_SERVER /* Flags */ # define ADDR_IN_USE_ALLOWED 1 int (*CreateListener)( XtransConnInfo, /* connection */ const char *, /* port */ unsigned int /* flags */ ); int (*ResetListener)( XtransConnInfo /* connection */ ); XtransConnInfo (*Accept)( XtransConnInfo, /* connection */ int * /* status */ ); #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT int (*Connect)( XtransConnInfo, /* connection */ const char *, /* host */ const char * /* port */ ); #endif /* TRANS_CLIENT */ int (*BytesReadable)( XtransConnInfo, /* connection */ BytesReadable_t * /* pend */ ); int (*Read)( XtransConnInfo, /* connection */ char *, /* buf */ int /* size */ ); int (*Write)( XtransConnInfo, /* connection */ char *, /* buf */ int /* size */ ); int (*Readv)( XtransConnInfo, /* connection */ struct iovec *, /* buf */ int /* size */ ); int (*Writev)( XtransConnInfo, /* connection */ struct iovec *, /* buf */ int /* size */ ); #if XTRANS_SEND_FDS int (*SendFd)( XtransConnInfo, /* connection */ int, /* fd */ int /* do_close */ ); int (*RecvFd)( XtransConnInfo /* connection */ ); #endif int (*Disconnect)( XtransConnInfo /* connection */ ); int (*Close)( XtransConnInfo /* connection */ ); int (*CloseForCloning)( XtransConnInfo /* connection */ ); } Xtransport; typedef struct _Xtransport_table { Xtransport *transport; int transport_id; } Xtransport_table; /* * Flags for the flags member of Xtransport. */ #define TRANS_ALIAS (1<<0) /* record is an alias, don't create server */ #define TRANS_LOCAL (1<<1) /* local transport */ #define TRANS_DISABLED (1<<2) /* Don't open this one */ #define TRANS_NOLISTEN (1<<3) /* Don't listen on this one */ #define TRANS_NOUNLINK (1<<4) /* Don't unlink transport endpoints */ #define TRANS_ABSTRACT (1<<5) /* Use abstract sockets if available */ #define TRANS_NOXAUTH (1<<6) /* Don't verify authentication (because it's secure some other way at the OS layer) */ #define TRANS_RECEIVED (1<<7) /* The fd for this has already been opened by someone else. */ /* Flags to preserve when setting others */ #define TRANS_KEEPFLAGS (TRANS_NOUNLINK|TRANS_ABSTRACT) #ifdef XTRANS_TRANSPORT_C /* only provide static function prototypes when building the transport.c file that has them in */ #ifdef __clang__ /* Not all clients make use of all provided statics */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-function" #endif /* * readv() and writev() don't exist or don't work correctly on some * systems, so they may be emulated. */ #ifdef WIN32 #define READV(ciptr, iov, iovcnt) TRANS(ReadV)(ciptr, iov, iovcnt) static int TRANS(ReadV)( XtransConnInfo, /* ciptr */ struct iovec *, /* iov */ int /* iovcnt */ ); #else #define READV(ciptr, iov, iovcnt) readv(ciptr->fd, iov, iovcnt) #endif /* WIN32 */ #ifdef WIN32 #define WRITEV(ciptr, iov, iovcnt) TRANS(WriteV)(ciptr, iov, iovcnt) static int TRANS(WriteV)( XtransConnInfo, /* ciptr */ struct iovec *, /* iov */ int /* iovcnt */ ); #else #define WRITEV(ciptr, iov, iovcnt) writev(ciptr->fd, iov, iovcnt) #endif /* WIN32 */ #if defined(X11_t) static int is_numeric ( const char * /* str */ ); #endif #ifdef TRANS_SERVER static int trans_mkdir ( const char *, /* path */ int /* mode */ ); #endif #ifdef __clang__ #pragma clang diagnostic pop #endif /* * Some XTRANSDEBUG stuff */ #ifdef XTRANSDEBUG #include /* * The X server provides ErrorF() & VErrorF(), for other software that uses * xtrans, we provide our own simple versions. */ # if defined(XSERV_t) && defined(TRANS_SERVER) # include "os.h" # else static inline void _X_ATTRIBUTE_PRINTF(1, 0) VErrorF(const char *f, va_list args) { vfprintf(stderr, f, args); fflush(stderr); } static inline void _X_ATTRIBUTE_PRINTF(1, 2) ErrorF(const char *f, ...) { va_list args; va_start(args, f); VErrorF(f, args); va_end(args); } # endif /* xserver */ #endif /* XTRANSDEBUG */ static inline void _X_ATTRIBUTE_PRINTF(2, 3) prmsg(int lvl, const char *f, ...) { #ifdef XTRANSDEBUG va_list args; va_start(args, f); if (lvl <= XTRANSDEBUG) { int saveerrno = errno; ErrorF("%s", __xtransname); VErrorF(f, args); # ifdef XTRANSDEBUGTIMESTAMP { struct timeval tp; gettimeofday(&tp, 0); ErrorF("timestamp (ms): %d\n", tp.tv_sec * 1000 + tp.tv_usec / 1000); } # endif errno = saveerrno; } va_end(args); #endif /* XTRANSDEBUG */ } #endif /* XTRANS_TRANSPORT_C */ #endif /* _XTRANSINT_H_ */ nx-libs-3.5.99.23/nx-X11/lib/include/xtrans/Xtranslcl.c0000644000000000000000000015357313614532331017147 0ustar /* Copyright 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name NCR not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. NCR makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * * The connection code/ideas in lib/X and server/os for SVR4/Intel * environments was contributed by the following companies/groups: * * MetroLink Inc * NCR * Pittsburgh Powercomputing Corporation (PPc)/Quarterdeck Office Systems * SGCS * Unix System Laboratories (USL) / Novell * XFree86 * * The goal is to have common connection code among all SVR4/Intel vendors. * * ALL THE ABOVE COMPANIES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, * IN NO EVENT SHALL THESE COMPANIES * BE LIABLE FOR ANY SPECIAL, INDIRECT * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE * OR PERFORMANCE OF THIS SOFTWARE. */ #include #include #include #include #include #if defined(SVR4) || defined(__SVR4) #include #endif #ifdef __sun # include #else #include #endif #include #include /* * The local transports should be treated the same as a UNIX domain socket * wrt authentication, etc. Because of this, we will use struct sockaddr_un * for the address format. This will simplify the code in other places like * The X Server. */ #include #ifndef X_NO_SYS_UN #include #endif /* Types of local connections supported: * - PTS * - named pipes * - SCO */ #if !defined(__sun) # define LOCAL_TRANS_PTS #endif #if defined(SVR4) || defined(__SVR4) # define LOCAL_TRANS_NAMED #endif #if defined(__SCO__) || defined(__UNIXWARE__) # define LOCAL_TRANS_SCO #endif static int TRANS(LocalClose)(XtransConnInfo ciptr); /* * These functions actually implement the local connection mechanisms. */ /* Type Not Supported */ static int TRANS(OpenFail)(XtransConnInfo ciptr _X_UNUSED, const char *port _X_UNUSED) { return -1; } #ifdef TRANS_REOPEN static int TRANS(ReopenFail)(XtransConnInfo ciptr _X_UNUSED, int fd _X_UNUSED, const char *port _X_UNUSED) { return 0; } #endif /* TRANS_REOPEN */ #if XTRANS_SEND_FDS static int TRANS(LocalRecvFdInvalid)(XtransConnInfo ciptr) { errno = EINVAL; return -1; } static int TRANS(LocalSendFdInvalid)(XtransConnInfo ciptr, int fd, int do_close) { errno = EINVAL; return -1; } #endif static int TRANS(FillAddrInfo)(XtransConnInfo ciptr, const char *sun_path, const char *peer_sun_path) { struct sockaddr_un *sunaddr; struct sockaddr_un *p_sunaddr; ciptr->family = AF_UNIX; ciptr->addrlen = sizeof (struct sockaddr_un); if ((sunaddr = malloc (ciptr->addrlen)) == NULL) { prmsg(1,"FillAddrInfo: failed to allocate memory for addr\n"); return 0; } sunaddr->sun_family = AF_UNIX; if (strlen(sun_path) > sizeof(sunaddr->sun_path) - 1) { prmsg(1, "FillAddrInfo: path too long\n"); free((char *) sunaddr); return 0; } strcpy (sunaddr->sun_path, sun_path); #if defined(BSD44SOCKETS) sunaddr->sun_len = strlen (sunaddr->sun_path); #endif ciptr->addr = (char *) sunaddr; ciptr->peeraddrlen = sizeof (struct sockaddr_un); if ((p_sunaddr = malloc (ciptr->peeraddrlen)) == NULL) { prmsg(1, "FillAddrInfo: failed to allocate memory for peer addr\n"); free (sunaddr); ciptr->addr = NULL; return 0; } p_sunaddr->sun_family = AF_UNIX; if (strlen(peer_sun_path) > sizeof(p_sunaddr->sun_path) - 1) { prmsg(1, "FillAddrInfo: peer path too long\n"); free((char *) p_sunaddr); return 0; } strcpy (p_sunaddr->sun_path, peer_sun_path); #if defined(BSD44SOCKETS) p_sunaddr->sun_len = strlen (p_sunaddr->sun_path); #endif ciptr->peeraddr = (char *) p_sunaddr; return 1; } #ifdef LOCAL_TRANS_PTS /* PTS */ #if defined(SYSV) && !defined(__SCO__) #define SIGNAL_T int #else #define SIGNAL_T void #endif /* SYSV */ typedef SIGNAL_T (*PFV)(); extern PFV signal(); extern char *ptsname( int ); static void _dummy(int sig _X_UNUSED) { } #endif /* LOCAL_TRANS_PTS */ #ifndef __sun #define X_STREAMS_DIR "/dev/X" #define DEV_SPX "/dev/spx" #else #ifndef X11_t #define X_STREAMS_DIR "/dev/X" #else #define X_STREAMS_DIR "/tmp/.X11-pipe" #endif #endif #define DEV_PTMX "/dev/ptmx" #if defined(X11_t) #define PTSNODENAME "/dev/X/server." #ifdef __sun #define NAMEDNODENAME "/tmp/.X11-pipe/X" #else #define NAMEDNODENAME "/dev/X/Nserver." #define SCORNODENAME "/dev/X%1sR" #define SCOSNODENAME "/dev/X%1sS" #endif /* !__sun */ #endif #if defined(XIM_t) #ifdef __sun #define NAMEDNODENAME "/tmp/.XIM-pipe/XIM" #else #define PTSNODENAME "/dev/X/XIM." #define NAMEDNODENAME "/dev/X/NXIM." #define SCORNODENAME "/dev/XIM.%sR" #define SCOSNODENAME "/dev/XIM.%sS" #endif #endif #if defined(FS_t) || defined (FONT_t) #ifdef __sun #define NAMEDNODENAME "/tmp/.font-pipe/fs" #else /* * USL has already defined something here. We need to check with them * and see if their choice is usable here. */ #define PTSNODENAME "/dev/X/fontserver." #define NAMEDNODENAME "/dev/X/Nfontserver." #define SCORNODENAME "/dev/fontserver.%sR" #define SCOSNODENAME "/dev/fontserver.%sS" #endif #endif #if defined(ICE_t) #ifdef __sun #define NAMEDNODENAME "/tmp/.ICE-pipe/" #else #define PTSNODENAME "/dev/X/ICE." #define NAMEDNODENAME "/dev/X/NICE." #define SCORNODENAME "/dev/ICE.%sR" #define SCOSNODENAME "/dev/ICE.%sS" #endif #endif #if defined(TEST_t) #ifdef __sun #define NAMEDNODENAME "/tmp/.Test-unix/test" #endif #define PTSNODENAME "/dev/X/transtest." #define NAMEDNODENAME "/dev/X/Ntranstest." #define SCORNODENAME "/dev/transtest.%sR" #define SCOSNODENAME "/dev/transtest.%sS" #endif #ifdef LOCAL_TRANS_PTS #ifdef TRANS_CLIENT static int TRANS(PTSOpenClient)(XtransConnInfo ciptr, const char *port) { #ifdef PTSNODENAME int fd,server,exitval,alarm_time,ret; char server_path[64]; char *slave, namelen; char buf[20]; /* MAX_PATH_LEN?? */ PFV savef; pid_t saved_pid; #endif prmsg(2,"PTSOpenClient(%s)\n", port); #if !defined(PTSNODENAME) prmsg(1,"PTSOpenClient: Protocol is not supported by a pts connection\n"); return -1; #else if (port && *port ) { if( *port == '/' ) { /* A full pathname */ snprintf(server_path, sizeof(server_path), "%s", port); } else { snprintf(server_path, sizeof(server_path), "%s%s", PTSNODENAME, port); } } else { snprintf(server_path, sizeof(server_path), "%s%d", PTSNODENAME, getpid()); } /* * Open the node the on which the server is listening. */ if ((server = open (server_path, O_RDWR)) < 0) { prmsg(1,"PTSOpenClient: failed to open %s\n", server_path); return -1; } /* * Open the streams based pipe that will be this connection. */ if ((fd = open(DEV_PTMX, O_RDWR)) < 0) { prmsg(1,"PTSOpenClient: failed to open %s\n", DEV_PTMX); close(server); return(-1); } (void) grantpt(fd); (void) unlockpt(fd); slave = ptsname(fd); /* get name */ if( slave == NULL ) { prmsg(1,"PTSOpenClient: failed to get ptsname()\n"); close(fd); close(server); return -1; } /* * This is neccesary for the case where a program is setuid to non-root. * grantpt() calls /usr/lib/pt_chmod which is set-uid root. This program will * set the owner of the pt device incorrectly if the uid is not restored * before it is called. The problem is that once it gets restored, it * cannot be changed back to its original condition, hence the fork(). */ if(!(saved_pid=fork())) { uid_t saved_euid; saved_euid = geteuid(); /** sets the euid to the actual/real uid **/ if (setuid( getuid() ) == -1) { exit(1); } if( chown( slave, saved_euid, -1 ) < 0 ) { exit( 1 ); } exit( 0 ); } waitpid(saved_pid, &exitval, 0); if (WIFEXITED(exitval) && WEXITSTATUS(exitval) != 0) { close(fd); close(server); prmsg(1, "PTSOpenClient: cannot set the owner of %s\n", slave); return(-1); } if (chmod(slave, 0666) < 0) { close(fd); close(server); prmsg(1,"PTSOpenClient: Cannot chmod %s\n", slave); return(-1); } /* * write slave name to server */ namelen = strlen(slave); buf[0] = namelen; (void) sprintf(&buf[1], slave); (void) write(server, buf, namelen+1); (void) close(server); /* * wait for server to respond */ savef = signal(SIGALRM, _dummy); alarm_time = alarm (30); /* CONNECT_TIMEOUT */ ret = read(fd, buf, 1); (void) alarm(alarm_time); (void) signal(SIGALRM, savef); if (ret != 1) { prmsg(1, "PTSOpenClient: failed to get acknoledgement from server\n"); (void) close(fd); fd = -1; } /* * Everything looks good: fill in the XtransConnInfo structure. */ if (TRANS(FillAddrInfo) (ciptr, slave, server_path) == 0) { prmsg(1,"PTSOpenClient: failed to fill in addr info\n"); close(fd); return -1; } return(fd); #endif /* !PTSNODENAME */ } #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER static int TRANS(PTSOpenServer)(XtransConnInfo ciptr, const char *port) { #ifdef PTSNODENAME int fd, server; char server_path[64], *slave; int mode; #endif prmsg(2,"PTSOpenServer(%s)\n", port); #if !defined(PTSNODENAME) prmsg(1,"PTSOpenServer: Protocol is not supported by a pts connection\n"); return -1; #else if (port && *port ) { if( *port == '/' ) { /* A full pathname */ (void) sprintf(server_path, "%s", port); } else { (void) sprintf(server_path, "%s%s", PTSNODENAME, port); } } else { (void) sprintf(server_path, "%s%d", PTSNODENAME, getpid()); } #ifdef HAS_STICKY_DIR_BIT mode = 01777; #else mode = 0777; #endif if (trans_mkdir(X_STREAMS_DIR, mode) == -1) { prmsg (1, "PTSOpenServer: mkdir(%s) failed, errno = %d\n", X_STREAMS_DIR, errno); return(-1); } #if 0 if( (fd=open(server_path, O_RDWR)) >= 0 ) { /* * This doesn't prevent the server from starting up, and doesn't * prevent clients from trying to connect to the in-use PTS (which * is often in use by something other than another server). */ prmsg(1, "PTSOpenServer: A server is already running on port %s\n", port); prmsg(1, "PTSOpenServer: Remove %s if this is incorrect.\n", server_path); close(fd); return(-1); } #else /* Just remove the old path (which is what happens with UNIXCONN) */ #endif unlink(server_path); if( (fd=open(DEV_PTMX, O_RDWR)) < 0) { prmsg(1, "PTSOpenServer: Unable to open %s\n", DEV_PTMX); return(-1); } grantpt(fd); unlockpt(fd); if( (slave=ptsname(fd)) == NULL) { prmsg(1, "PTSOpenServer: Unable to get slave device name\n"); close(fd); return(-1); } if( link(slave,server_path) < 0 ) { prmsg(1, "PTSOpenServer: Unable to link %s to %s\n", slave, server_path); close(fd); return(-1); } if( chmod(server_path, 0666) < 0 ) { prmsg(1, "PTSOpenServer: Unable to chmod %s to 0666\n", server_path); close(fd); return(-1); } if( (server=open(server_path, O_RDWR)) < 0 ) { prmsg(1, "PTSOpenServer: Unable to open server device %s\n", server_path); close(fd); return(-1); } close(server); /* * Everything looks good: fill in the XtransConnInfo structure. */ if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) { prmsg(1,"PTSOpenServer: failed to fill in addr info\n"); close(fd); return -1; } return fd; #endif /* !PTSNODENAME */ } static int TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) { int newfd; int in; unsigned char length; char buf[256]; struct sockaddr_un *sunaddr; prmsg(2,"PTSAccept(%x->%d)\n",ciptr,ciptr->fd); if( (in=read(ciptr->fd,&length,1)) <= 0 ){ if( !in ) { prmsg(2, "PTSAccept: Incoming connection closed\n"); } else { prmsg(1, "PTSAccept: Error reading incoming connection. errno=%d \n", errno); } *status = TRANS_ACCEPT_MISC_ERROR; return -1; } if( (in=read(ciptr->fd,buf,length)) <= 0 ){ if( !in ) { prmsg(2, "PTSAccept: Incoming connection closed\n"); } else { prmsg(1, "PTSAccept: Error reading device name for new connection. errno=%d \n", errno); } *status = TRANS_ACCEPT_MISC_ERROR; return -1; } buf[length] = '\0'; if( (newfd=open(buf,O_RDWR)) < 0 ) { prmsg(1, "PTSAccept: Failed to open %s\n",buf); *status = TRANS_ACCEPT_MISC_ERROR; return -1; } write(newfd,"1",1); /* * Everything looks good: fill in the XtransConnInfo structure. */ newciptr->addrlen=ciptr->addrlen; if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) { prmsg(1,"PTSAccept: failed to allocate memory for peer addr\n"); close(newfd); *status = TRANS_ACCEPT_BAD_MALLOC; return -1; } memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); newciptr->peeraddrlen=sizeof(struct sockaddr_un); if( (sunaddr = malloc(newciptr->peeraddrlen)) == NULL ) { prmsg(1,"PTSAccept: failed to allocate memory for peer addr\n"); free(newciptr->addr); close(newfd); *status = TRANS_ACCEPT_BAD_MALLOC; return -1; } sunaddr->sun_family=AF_UNIX; strcpy(sunaddr->sun_path,buf); #if defined(BSD44SOCKETS) sunaddr->sun_len=strlen(sunaddr->sun_path); #endif newciptr->peeraddr=(char *)sunaddr; *status = 0; return newfd; } #endif /* TRANS_SERVER */ #endif /* LOCAL_TRANS_PTS */ #ifdef LOCAL_TRANS_NAMED /* NAMED */ #ifdef TRANS_CLIENT static int TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, const char *port) { #ifdef NAMEDNODENAME int fd; char server_path[64]; struct stat filestat; # ifndef __sun extern int isastream(int); # endif #endif prmsg(2,"NAMEDOpenClient(%s)\n", port); #if !defined(NAMEDNODENAME) prmsg(1,"NAMEDOpenClient: Protocol is not supported by a NAMED connection\n"); return -1; #else if ( port && *port ) { if( *port == '/' ) { /* A full pathname */ (void) snprintf(server_path, sizeof(server_path), "%s", port); } else { (void) snprintf(server_path, sizeof(server_path), "%s%s", NAMEDNODENAME, port); } } else { (void) snprintf(server_path, sizeof(server_path), "%s%ld", NAMEDNODENAME, (long)getpid()); } if ((fd = open(server_path, O_RDWR)) < 0) { prmsg(1,"NAMEDOpenClient: Cannot open %s for NAMED connection\n", server_path); return -1; } if (fstat(fd, &filestat) < 0 ) { prmsg(1,"NAMEDOpenClient: Cannot stat %s for NAMED connection\n", server_path); (void) close(fd); return -1; } if ((filestat.st_mode & S_IFMT) != S_IFIFO) { prmsg(1,"NAMEDOpenClient: Device %s is not a FIFO\n", server_path); /* Is this really a failure? */ (void) close(fd); return -1; } if (isastream(fd) <= 0) { prmsg(1,"NAMEDOpenClient: %s is not a streams device\n", server_path); (void) close(fd); return -1; } /* * Everything looks good: fill in the XtransConnInfo structure. */ if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) { prmsg(1,"NAMEDOpenClient: failed to fill in addr info\n"); close(fd); return -1; } return(fd); #endif /* !NAMEDNODENAME */ } #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER #ifdef NAMEDNODENAME static int TRANS(NAMEDOpenPipe)(const char *server_path) { int fd, pipefd[2]; struct stat sbuf; int mode; prmsg(2,"NAMEDOpenPipe(%s)\n", server_path); #ifdef HAS_STICKY_DIR_BIT mode = 01777; #else mode = 0777; #endif if (trans_mkdir(X_STREAMS_DIR, mode) == -1) { prmsg (1, "NAMEDOpenPipe: mkdir(%s) failed, errno = %d\n", X_STREAMS_DIR, errno); return(-1); } if(stat(server_path, &sbuf) != 0) { if (errno == ENOENT) { if ((fd = creat(server_path, (mode_t)0666)) == -1) { prmsg(1, "NAMEDOpenPipe: Can't open %s\n", server_path); return(-1); } close(fd); if (chmod(server_path, (mode_t)0666) < 0) { prmsg(1, "NAMEDOpenPipe: Can't open %s\n", server_path); return(-1); } } else { prmsg(1, "NAMEDOpenPipe: stat on %s failed\n", server_path); return(-1); } } if( pipe(pipefd) != 0) { prmsg(1, "NAMEDOpenPipe: pipe() failed, errno=%d\n",errno); return(-1); } if( ioctl(pipefd[0], I_PUSH, "connld") != 0) { prmsg(1, "NAMEDOpenPipe: ioctl(I_PUSH,\"connld\") failed, errno=%d\n",errno); close(pipefd[0]); close(pipefd[1]); return(-1); } if( fattach(pipefd[0], server_path) != 0) { prmsg(1, "NAMEDOpenPipe: fattach(%s) failed, errno=%d\n", server_path,errno); close(pipefd[0]); close(pipefd[1]); return(-1); } return(pipefd[1]); } #endif static int TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, const char *port) { #ifdef NAMEDNODENAME int fd; char server_path[64]; #endif prmsg(2,"NAMEDOpenServer(%s)\n", port); #if !defined(NAMEDNODENAME) prmsg(1,"NAMEDOpenServer: Protocol is not supported by a NAMED connection\n"); return -1; #else if ( port && *port ) { if( *port == '/' ) { /* A full pathname */ (void) snprintf(server_path, sizeof(server_path), "%s", port); } else { (void) snprintf(server_path, sizeof(server_path), "%s%s", NAMEDNODENAME, port); } } else { (void) snprintf(server_path, sizeof(server_path), "%s%ld", NAMEDNODENAME, (long)getpid()); } fd = TRANS(NAMEDOpenPipe)(server_path); if (fd < 0) { return -1; } /* * Everything looks good: fill in the XtransConnInfo structure. */ if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) { prmsg(1,"NAMEDOpenServer: failed to fill in addr info\n"); TRANS(LocalClose)(ciptr); return -1; } return fd; #endif /* !NAMEDNODENAME */ } static int TRANS(NAMEDResetListener) (XtransConnInfo ciptr) { struct sockaddr_un *sockname=(struct sockaddr_un *) ciptr->addr; struct stat statb; prmsg(2,"NAMEDResetListener(%p, %d)\n", ciptr, ciptr->fd); if (ciptr->fd != -1) { /* * see if the pipe has disappeared */ if (stat (sockname->sun_path, &statb) == -1 || (statb.st_mode & S_IFMT) != S_IFIFO) { prmsg(3, "Pipe %s trashed, recreating\n", sockname->sun_path); TRANS(LocalClose)(ciptr); ciptr->fd = TRANS(NAMEDOpenPipe)(sockname->sun_path); if (ciptr->fd >= 0) return TRANS_RESET_NEW_FD; else return TRANS_CREATE_LISTENER_FAILED; } } return TRANS_RESET_NOOP; } static int TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) { struct strrecvfd str; prmsg(2,"NAMEDAccept(%p->%d)\n", ciptr, ciptr->fd); if( ioctl(ciptr->fd, I_RECVFD, &str ) < 0 ) { prmsg(1, "NAMEDAccept: ioctl(I_RECVFD) failed, errno=%d\n", errno); *status = TRANS_ACCEPT_MISC_ERROR; return(-1); } /* * Everything looks good: fill in the XtransConnInfo structure. */ newciptr->family=ciptr->family; newciptr->addrlen=ciptr->addrlen; if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) { prmsg(1, "NAMEDAccept: failed to allocate memory for pipe addr\n"); close(str.fd); *status = TRANS_ACCEPT_BAD_MALLOC; return -1; } memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); newciptr->peeraddrlen=newciptr->addrlen; if( (newciptr->peeraddr = malloc(newciptr->peeraddrlen)) == NULL ) { prmsg(1, "NAMEDAccept: failed to allocate memory for peer addr\n"); free(newciptr->addr); close(str.fd); *status = TRANS_ACCEPT_BAD_MALLOC; return -1; } memcpy(newciptr->peeraddr,newciptr->addr,newciptr->peeraddrlen); *status = 0; return str.fd; } #endif /* TRANS_SERVER */ #endif /* LOCAL_TRANS_NAMED */ #if defined(LOCAL_TRANS_SCO) /* * connect_spipe is used by the SCO connection type. */ static int connect_spipe(int fd1, int fd2) { long temp; struct strfdinsert sbuf; sbuf.databuf.maxlen = -1; sbuf.databuf.len = -1; sbuf.databuf.buf = NULL; sbuf.ctlbuf.maxlen = sizeof(long); sbuf.ctlbuf.len = sizeof(long); sbuf.ctlbuf.buf = (caddr_t)&temp; sbuf.offset = 0; sbuf.fildes = fd2; sbuf.flags = 0; if( ioctl(fd1, I_FDINSERT, &sbuf) < 0 ) return(-1); return(0); } /* * named_spipe is used by the SCO connection type. */ static int named_spipe(int fd, char *path) { int oldUmask, ret; struct stat sbuf; oldUmask = umask(0); (void) fstat(fd, &sbuf); ret = mknod(path, 0020666, sbuf.st_rdev); umask(oldUmask); if (ret < 0) { ret = -1; } else { ret = fd; } return(ret); } #endif /* defined(LOCAL_TRANS_SCO) */ #ifdef LOCAL_TRANS_SCO /* SCO */ /* * 2002-11-09 (jkj@sco.com) * * This code has been modified to match what is in the actual SCO X server. * This greatly helps inter-operability between X11R6 and X11R5 (the native * SCO server). Mainly, it relies on streams nodes existing in /dev, not * creating them or unlinking them, which breaks the native X server. * * However, this is only for the X protocol. For all other protocols, we * do in fact create the nodes, as only X11R6 will use them, and this makes * it possible to have both types of clients running, otherwise we get all * kinds of nasty errors on startup for anything that doesnt use the X * protocol (like SM, when KDE starts up). */ #ifdef TRANS_CLIENT static int TRANS(SCOOpenClient)(XtransConnInfo ciptr, const char *port) { #ifdef SCORNODENAME int fd, server, fl, ret; char server_path[64]; struct strbuf ctlbuf; unsigned long alarm_time; void (*savef)(); long temp; extern int getmsg(), putmsg(); #endif prmsg(2,"SCOOpenClient(%s)\n", port); if (!port || !port[0]) port = "0"; #if !defined(SCORNODENAME) prmsg(2,"SCOOpenClient: Protocol is not supported by a SCO connection\n"); return -1; #else (void) sprintf(server_path, SCORNODENAME, port); if ((server = open(server_path, O_RDWR)) < 0) { prmsg(1,"SCOOpenClient: failed to open %s\n", server_path); return -1; } if ((fd = open(DEV_SPX, O_RDWR)) < 0) { prmsg(1,"SCOOpenClient: failed to open %s\n", DEV_SPX); close(server); return -1; } (void) write(server, &server, 1); ctlbuf.len = 0; ctlbuf.maxlen = sizeof(long); ctlbuf.buf = (caddr_t)&temp; fl = 0; savef = signal(SIGALRM, _dummy); alarm_time = alarm(10); ret = getmsg(server, &ctlbuf, 0, &fl); (void) alarm(alarm_time); (void) signal(SIGALRM, savef); if (ret < 0) { prmsg(1,"SCOOpenClient: error from getmsg\n"); close(fd); close(server); return -1; } /* The msg we got via getmsg is the result of an * I_FDINSERT, so if we do a putmsg with whatever * we recieved, we're doing another I_FDINSERT ... */ (void) putmsg(fd, &ctlbuf, 0, 0); (void) fcntl(fd,F_SETFL,fcntl(fd,F_GETFL,0)|O_NDELAY); (void) close(server); /* * Everything looks good: fill in the XtransConnInfo structure. */ #if defined(X11_t) && defined(__SCO__) ciptr->flags |= TRANS_NOUNLINK; #endif if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) { prmsg(1,"SCOOpenClient: failed to fill addr info\n"); close(fd); return -1; } return(fd); #endif /* !SCORNODENAME */ } #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER static int TRANS(SCOOpenServer)(XtransConnInfo ciptr, const char *port) { #ifdef SCORNODENAME char serverR_path[64]; char serverS_path[64]; struct flock mylock; int fdr = -1; int fds = -1; #endif prmsg(2,"SCOOpenServer(%s)\n", port); if (!port || !port[0]) port = "0"; #if !defined(SCORNODENAME) prmsg(1,"SCOOpenServer: Protocol is not supported by a SCO connection\n"); return -1; #else (void) sprintf(serverR_path, SCORNODENAME, port); (void) sprintf(serverS_path, SCOSNODENAME, port); #if !defined(X11_t) || !defined(__SCO__) unlink(serverR_path); unlink(serverS_path); if ((fds = open(DEV_SPX, O_RDWR)) < 0 || (fdr = open(DEV_SPX, O_RDWR)) < 0 ) { prmsg(1,"SCOOpenServer: failed to open %s\n", DEV_SPX); if (fds >= 0) close(fds); if (fdr >= 0) close(fdr); return -1; } if (named_spipe (fds, serverS_path) == -1) { prmsg(1,"SCOOpenServer: failed to create %s\n", serverS_path); close (fdr); close (fds); return -1; } if (named_spipe (fdr, serverR_path) == -1) { prmsg(1,"SCOOpenServer: failed to create %s\n", serverR_path); close (fdr); close (fds); return -1; } #else /* X11_t */ fds = open (serverS_path, O_RDWR | O_NDELAY); if (fds < 0) { prmsg(1,"SCOOpenServer: failed to open %s\n", serverS_path); return -1; } /* * Lock the connection device for the duration of the server. * This resolves multiple server starts especially on SMP machines. */ mylock.l_type = F_WRLCK; mylock.l_whence = 0; mylock.l_start = 0; mylock.l_len = 0; if (fcntl (fds, F_SETLK, &mylock) < 0) { prmsg(1,"SCOOpenServer: failed to lock %s\n", serverS_path); close (fds); return -1; } fdr = open (serverR_path, O_RDWR | O_NDELAY); if (fdr < 0) { prmsg(1,"SCOOpenServer: failed to open %s\n", serverR_path); close (fds); return -1; } #endif /* X11_t */ if (connect_spipe(fds, fdr)) { prmsg(1,"SCOOpenServer: ioctl(I_FDINSERT) failed on %s\n", serverS_path); close (fdr); close (fds); return -1; } /* * Everything looks good: fill in the XtransConnInfo structure. */ #if defined(X11_t) && defined(__SCO__) ciptr->flags |= TRANS_NOUNLINK; #endif if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0) { prmsg(1,"SCOOpenServer: failed to fill in addr info\n"); close(fds); close(fdr); return -1; } return(fds); #endif /* !SCORNODENAME */ } static int TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) { char c; int fd; prmsg(2,"SCOAccept(%d)\n", ciptr->fd); if (read(ciptr->fd, &c, 1) < 0) { prmsg(1,"SCOAccept: can't read from client\n"); *status = TRANS_ACCEPT_MISC_ERROR; return(-1); } if( (fd = open(DEV_SPX, O_RDWR)) < 0 ) { prmsg(1,"SCOAccept: can't open \"%s\"\n",DEV_SPX); *status = TRANS_ACCEPT_MISC_ERROR; return(-1); } if (connect_spipe (ciptr->fd, fd) < 0) { prmsg(1,"SCOAccept: ioctl(I_FDINSERT) failed\n"); close (fd); *status = TRANS_ACCEPT_MISC_ERROR; return -1; } /* * Everything looks good: fill in the XtransConnInfo structure. */ newciptr->addrlen=ciptr->addrlen; if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) { prmsg(1, "SCOAccept: failed to allocate memory for peer addr\n"); close(fd); *status = TRANS_ACCEPT_BAD_MALLOC; return -1; } memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); #if defined(__SCO__) newciptr->flags |= TRANS_NOUNLINK; #endif newciptr->peeraddrlen=newciptr->addrlen; if( (newciptr->peeraddr = malloc(newciptr->peeraddrlen)) == NULL ) { prmsg(1, "SCOAccept: failed to allocate memory for peer addr\n"); free(newciptr->addr); close(fd); *status = TRANS_ACCEPT_BAD_MALLOC; return -1; } memcpy(newciptr->peeraddr,newciptr->addr,newciptr->peeraddrlen); *status = 0; return(fd); } #endif /* TRANS_SERVER */ #endif /* LOCAL_TRANS_SCO */ #ifdef TRANS_REOPEN #ifdef LOCAL_TRANS_PTS static int TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, const char *port) { #ifdef PTSNODENAME char server_path[64]; #endif prmsg(2,"PTSReopenServer(%d,%s)\n", fd, port); #if !defined(PTSNODENAME) prmsg(1,"PTSReopenServer: Protocol is not supported by a pts connection\n"); return 0; #else if (port && *port ) { if( *port == '/' ) { /* A full pathname */ snprintf(server_path, sizeof(server_path), "%s", port); } else { snprintf(server_path, sizeof(server_path), "%s%s", PTSNODENAME, port); } } else { snprintf(server_path, sizeof(server_path), "%s%ld", PTSNODENAME, (long)getpid()); } if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) { prmsg(1,"PTSReopenServer: failed to fill in addr info\n"); return 0; } return 1; #endif /* !PTSNODENAME */ } #endif /* LOCAL_TRANS_PTS */ #ifdef LOCAL_TRANS_NAMED static int TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd _X_UNUSED, const char *port) { #ifdef NAMEDNODENAME char server_path[64]; #endif prmsg(2,"NAMEDReopenServer(%s)\n", port); #if !defined(NAMEDNODENAME) prmsg(1,"NAMEDReopenServer: Protocol is not supported by a NAMED connection\n"); return 0; #else if ( port && *port ) { if( *port == '/' ) { /* A full pathname */ snprintf(server_path, sizeof(server_path),"%s", port); } else { snprintf(server_path, sizeof(server_path), "%s%s", NAMEDNODENAME, port); } } else { snprintf(server_path, sizeof(server_path), "%s%ld", NAMEDNODENAME, (long)getpid()); } if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) { prmsg(1,"NAMEDReopenServer: failed to fill in addr info\n"); return 0; } return 1; #endif /* !NAMEDNODENAME */ } #endif /* LOCAL_TRANS_NAMED */ #ifdef LOCAL_TRANS_SCO static int TRANS(SCOReopenServer)(XtransConnInfo ciptr, int fd, const char *port) { #ifdef SCORNODENAME char serverR_path[64], serverS_path[64]; #endif prmsg(2,"SCOReopenServer(%s)\n", port); if (!port || !port[0]) port = "0"; #if !defined(SCORNODENAME) prmsg(2,"SCOReopenServer: Protocol is not supported by a SCO connection\n"); return 0; #else (void) sprintf(serverR_path, SCORNODENAME, port); (void) sprintf(serverS_path, SCOSNODENAME, port); #if defined(X11_t) && defined(__SCO__) ciptr->flags |= TRANS_NOUNLINK; #endif if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0) { prmsg(1, "SCOReopenServer: failed to fill in addr info\n"); return 0; } return 1; #endif /* SCORNODENAME */ } #endif /* LOCAL_TRANS_SCO */ #endif /* TRANS_REOPEN */ /* * This table contains all of the entry points for the different local * connection mechanisms. */ typedef struct _LOCALtrans2dev { const char *transname; #ifdef TRANS_CLIENT int (*devcotsopenclient)( XtransConnInfo, const char * /*port*/ ); #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER int (*devcotsopenserver)( XtransConnInfo, const char * /*port*/ ); #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT int (*devcltsopenclient)( XtransConnInfo, const char * /*port*/ ); #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER int (*devcltsopenserver)( XtransConnInfo, const char * /*port*/ ); #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN int (*devcotsreopenserver)( XtransConnInfo, int, /* fd */ const char * /* port */ ); int (*devcltsreopenserver)( XtransConnInfo, int, /* fd */ const char * /* port */ ); #endif /* TRANS_REOPEN */ #ifdef TRANS_SERVER int (*devreset)( XtransConnInfo /* ciptr */ ); int (*devaccept)( XtransConnInfo, XtransConnInfo, int * ); #endif /* TRANS_SERVER */ } LOCALtrans2dev; static LOCALtrans2dev LOCALtrans2devtab[] = { #ifdef LOCAL_TRANS_PTS {"", #ifdef TRANS_CLIENT TRANS(PTSOpenClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(PTSOpenServer), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(OpenFail), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(OpenFail), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(PTSReopenServer), TRANS(ReopenFail), #endif #ifdef TRANS_SERVER NULL, /* ResetListener */ TRANS(PTSAccept) #endif /* TRANS_SERVER */ }, {"local", #ifdef TRANS_CLIENT TRANS(PTSOpenClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(PTSOpenServer), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(OpenFail), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(OpenFail), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(PTSReopenServer), TRANS(ReopenFail), #endif #ifdef TRANS_SERVER NULL, /* ResetListener */ TRANS(PTSAccept) #endif /* TRANS_SERVER */ }, {"pts", #ifdef TRANS_CLIENT TRANS(PTSOpenClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(PTSOpenServer), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(OpenFail), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(OpenFail), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(PTSReopenServer), TRANS(ReopenFail), #endif #ifdef TRANS_SERVER NULL, /* ResetListener */ TRANS(PTSAccept) #endif /* TRANS_SERVER */ }, #else /* !LOCAL_TRANS_PTS */ {"", #ifdef TRANS_CLIENT TRANS(NAMEDOpenClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(NAMEDOpenServer), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(OpenFail), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(OpenFail), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(NAMEDReopenServer), TRANS(ReopenFail), #endif #ifdef TRANS_SERVER TRANS(NAMEDResetListener), TRANS(NAMEDAccept) #endif /* TRANS_SERVER */ }, {"local", #ifdef TRANS_CLIENT TRANS(NAMEDOpenClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(NAMEDOpenServer), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(OpenFail), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(OpenFail), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(NAMEDReopenServer), TRANS(ReopenFail), #endif #ifdef TRANS_SERVER TRANS(NAMEDResetListener), TRANS(NAMEDAccept) #endif /* TRANS_SERVER */ }, #endif /* !LOCAL_TRANS_PTS */ #ifdef LOCAL_TRANS_NAMED {"named", #ifdef TRANS_CLIENT TRANS(NAMEDOpenClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(NAMEDOpenServer), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(OpenFail), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(OpenFail), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(NAMEDReopenServer), TRANS(ReopenFail), #endif #ifdef TRANS_SERVER TRANS(NAMEDResetListener), TRANS(NAMEDAccept) #endif /* TRANS_SERVER */ }, #ifdef __sun /* Alias "pipe" to named, since that's what Solaris called it */ {"pipe", #ifdef TRANS_CLIENT TRANS(NAMEDOpenClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(NAMEDOpenServer), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(OpenFail), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(OpenFail), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(NAMEDReopenServer), TRANS(ReopenFail), #endif #ifdef TRANS_SERVER TRANS(NAMEDResetListener), TRANS(NAMEDAccept) #endif /* TRANS_SERVER */ }, #endif /* __sun */ #endif /* LOCAL_TRANS_NAMED */ #ifdef LOCAL_TRANS_SCO {"sco", #ifdef TRANS_CLIENT TRANS(SCOOpenClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(SCOOpenServer), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(OpenFail), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER TRANS(OpenFail), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(SCOReopenServer), TRANS(ReopenFail), #endif #ifdef TRANS_SERVER NULL, /* ResetListener */ TRANS(SCOAccept) #endif /* TRANS_SERVER */ }, #endif /* LOCAL_TRANS_SCO */ }; #define NUMTRANSPORTS (sizeof(LOCALtrans2devtab)/sizeof(LOCALtrans2dev)) static const char *XLOCAL=NULL; static char *workingXLOCAL=NULL; static char *freeXLOCAL=NULL; #if defined(__SCO__) #define DEF_XLOCAL "SCO:UNIX:PTS" #elif defined(__UNIXWARE__) #define DEF_XLOCAL "UNIX:PTS:NAMED:SCO" #elif defined(__sun) #define DEF_XLOCAL "UNIX:NAMED" #else #define DEF_XLOCAL "UNIX:PTS:NAMED:SCO" #endif static void TRANS(LocalInitTransports)(const char *protocol) { prmsg(3,"LocalInitTransports(%s)\n", protocol); if( strcmp(protocol,"local") && strcmp(protocol,"LOCAL") ) { workingXLOCAL = freeXLOCAL = strdup (protocol); } else { XLOCAL=(char *)getenv("XLOCAL"); if(XLOCAL==NULL) XLOCAL=DEF_XLOCAL; workingXLOCAL = freeXLOCAL = strdup (XLOCAL); } } static void TRANS(LocalEndTransports)(void) { prmsg(3,"LocalEndTransports()\n"); free(freeXLOCAL); } #define TYPEBUFSIZE 32 #ifdef TRANS_CLIENT static LOCALtrans2dev * TRANS(LocalGetNextTransport)(void) { int i,j; char *typetocheck; char typebuf[TYPEBUFSIZE]; prmsg(3,"LocalGetNextTransport()\n"); while(1) { if( workingXLOCAL == NULL || *workingXLOCAL == '\0' ) return NULL; typetocheck=workingXLOCAL; workingXLOCAL=strchr(workingXLOCAL,':'); if(workingXLOCAL && *workingXLOCAL) *workingXLOCAL++='\0'; for(i=0;i #endif /* * Make sure 'host' is really local. */ static int HostReallyLocal (const char *host) { /* * The 'host' passed to this function may have been generated * by either uname() or gethostname(). We try both if possible. */ #ifdef NEED_UTSNAME struct utsname name; #endif char buf[256]; #ifdef NEED_UTSNAME if (uname (&name) >= 0 && strcmp (host, name.nodename) == 0) return (1); #endif buf[0] = '\0'; (void) gethostname (buf, 256); buf[255] = '\0'; if (strcmp (host, buf) == 0) return (1); return (0); } static XtransConnInfo TRANS(LocalOpenClient)(int type, const char *protocol, const char *host, const char *port) { LOCALtrans2dev *transptr; XtransConnInfo ciptr; int index; prmsg(3,"LocalOpenClient()\n"); /* * Make sure 'host' is really local. If not, we return failure. * The reason we make this check is because a process may advertise * a "local" address for which it can accept connections, but if a * process on a remote machine tries to connect to this address, * we know for sure it will fail. */ if (strcmp (host, "unix") != 0 && !HostReallyLocal (host)) { prmsg (1, "LocalOpenClient: Cannot connect to non-local host %s\n", host); return NULL; } #if defined(X11_t) /* * X has a well known port, that is transport dependant. It is easier * to handle it here, than try and come up with a transport independent * representation that can be passed in and resolved the usual way. * * The port that is passed here is really a string containing the idisplay * from ConnectDisplay(). Since that is what we want for the local transports, * we don't have to do anything special. */ #endif /* X11_t */ if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) { prmsg(1,"LocalOpenClient: calloc(1,%lu) failed\n", sizeof(struct _XtransConnInfo)); return NULL; } ciptr->fd = -1; TRANS(LocalInitTransports)(protocol); index = 0; for(transptr=TRANS(LocalGetNextTransport)(); transptr!=NULL;transptr=TRANS(LocalGetNextTransport)(), index++) { switch( type ) { case XTRANS_OPEN_COTS_CLIENT: ciptr->fd=transptr->devcotsopenclient(ciptr,port); break; case XTRANS_OPEN_COTS_SERVER: prmsg(1, "LocalOpenClient: Should not be opening a server with this function\n"); break; default: prmsg(1, "LocalOpenClient: Unknown Open type %d\n", type); } if( ciptr->fd >= 0 ) break; } TRANS(LocalEndTransports)(); if( ciptr->fd < 0 ) { free(ciptr); return NULL; } ciptr->priv=(char *)transptr; ciptr->index = index; return ciptr; } #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER static XtransConnInfo TRANS(LocalOpenServer)(int type, const char *protocol, const char *host _X_UNUSED, const char *port) { int i; XtransConnInfo ciptr; prmsg(2,"LocalOpenServer(%d,%s,%s)\n", type, protocol, port); #if defined(X11_t) /* * For X11, the port will be in the format xserverN where N is the * display number. All of the local connections just need to know * the display number because they don't do any name resolution on * the port. This just truncates port to the display portion. */ #endif /* X11_t */ if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) { prmsg(1,"LocalOpenServer: calloc(1,%lu) failed\n", sizeof(struct _XtransConnInfo)); return NULL; } for(i=1;ifd=LOCALtrans2devtab[i].devcotsopenserver(ciptr,port); break; default: prmsg(1,"LocalOpenServer: Unknown Open type %d\n", type ); } if( ciptr->fd >= 0 ) { ciptr->priv=(char *)&LOCALtrans2devtab[i]; ciptr->index=i; ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS); return ciptr; } } free(ciptr); return NULL; } #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN static XtransConnInfo TRANS(LocalReopenServer)(int type, int index, int fd, const char *port) { XtransConnInfo ciptr; int stat = 0; prmsg(2,"LocalReopenServer(%d,%d,%d)\n", type, index, fd); if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) { prmsg(1,"LocalReopenServer: calloc(1,%lu) failed\n", sizeof(struct _XtransConnInfo)); return NULL; } ciptr->fd = fd; switch( type ) { case XTRANS_OPEN_COTS_SERVER: stat = LOCALtrans2devtab[index].devcotsreopenserver(ciptr,fd,port); break; default: prmsg(1,"LocalReopenServer: Unknown Open type %d\n", type ); } if( stat > 0 ) { ciptr->priv=(char *)&LOCALtrans2devtab[index]; ciptr->index=index; ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS); return ciptr; } free(ciptr); return NULL; } #endif /* TRANS_REOPEN */ /* * This is the Local implementation of the X Transport service layer */ #ifdef TRANS_CLIENT static XtransConnInfo TRANS(LocalOpenCOTSClient)(Xtransport *thistrans _X_UNUSED, const char *protocol, const char *host, const char *port) { prmsg(2,"LocalOpenCOTSClient(%s,%s,%s)\n",protocol,host,port); return TRANS(LocalOpenClient)(XTRANS_OPEN_COTS_CLIENT, protocol, host, port); } #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER static XtransConnInfo TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, const char *protocol, const char *host, const char *port) { char *typetocheck = NULL; int found = 0; char typebuf[TYPEBUFSIZE]; prmsg(2,"LocalOpenCOTSServer(%s,%s,%s)\n",protocol,host,port); /* Check if this local type is in the XLOCAL list */ TRANS(LocalInitTransports)("local"); typetocheck = workingXLOCAL; while (typetocheck && !found) { int j; workingXLOCAL = strchr(workingXLOCAL, ':'); if (workingXLOCAL && *workingXLOCAL) *workingXLOCAL++ = '\0'; strncpy(typebuf, typetocheck, TYPEBUFSIZE); for (j = 0; j < TYPEBUFSIZE; j++) if (isupper(typebuf[j])) typebuf[j] = tolower(typebuf[j]); if (!strcmp(thistrans->TransName, typebuf)) found = 1; typetocheck = workingXLOCAL; } TRANS(LocalEndTransports)(); if (!found) { prmsg(3,"LocalOpenCOTSServer: disabling %s\n",thistrans->TransName); thistrans->flags |= TRANS_DISABLED; return NULL; } return TRANS(LocalOpenServer)(XTRANS_OPEN_COTS_SERVER, protocol, host, port); } #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN static XtransConnInfo TRANS(LocalReopenCOTSServer)(Xtransport *thistrans, int fd, const char *port) { int index; prmsg(2,"LocalReopenCOTSServer(%d,%s)\n", fd, port); for(index=1;indexTransName, LOCALtrans2devtab[index].transname) == 0 ) break; } if (index >= NUMTRANSPORTS) { return (NULL); } return TRANS(LocalReopenServer)(XTRANS_OPEN_COTS_SERVER, index, fd, port); } #endif /* TRANS_REOPEN */ static int TRANS(LocalSetOption)(XtransConnInfo ciptr, int option, int arg) { prmsg(2,"LocalSetOption(%d,%d,%d)\n",ciptr->fd,option,arg); return -1; } #ifdef TRANS_SERVER static int TRANS(LocalCreateListener)(XtransConnInfo ciptr, const char *port, unsigned int flags _X_UNUSED) { prmsg(2,"LocalCreateListener(%p->%d,%s)\n",ciptr,ciptr->fd,port); return 0; } static int TRANS(LocalResetListener)(XtransConnInfo ciptr) { LOCALtrans2dev *transptr; prmsg(2,"LocalResetListener(%p)\n",ciptr); transptr=(LOCALtrans2dev *)ciptr->priv; if (transptr->devreset != NULL) { return transptr->devreset(ciptr); } return TRANS_RESET_NOOP; } static XtransConnInfo TRANS(LocalAccept)(XtransConnInfo ciptr, int *status) { XtransConnInfo newciptr; LOCALtrans2dev *transptr; prmsg(2,"LocalAccept(%p->%d)\n", ciptr, ciptr->fd); transptr=(LOCALtrans2dev *)ciptr->priv; if( (newciptr = calloc(1,sizeof(struct _XtransConnInfo)))==NULL ) { prmsg(1,"LocalAccept: calloc(1,%lu) failed\n", sizeof(struct _XtransConnInfo)); *status = TRANS_ACCEPT_BAD_MALLOC; return NULL; } newciptr->fd=transptr->devaccept(ciptr,newciptr,status); if( newciptr->fd < 0 ) { free(newciptr); return NULL; } newciptr->priv=(char *)transptr; newciptr->index = ciptr->index; *status = 0; return newciptr; } #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT static int TRANS(LocalConnect)(XtransConnInfo ciptr, const char *host _X_UNUSED, const char *port) { prmsg(2,"LocalConnect(%p->%d,%s)\n", ciptr, ciptr->fd, port); return 0; } #endif /* TRANS_CLIENT */ static int TRANS(LocalBytesReadable)(XtransConnInfo ciptr, BytesReadable_t *pend ) { prmsg(2,"LocalBytesReadable(%p->%d,%p)\n", ciptr, ciptr->fd, pend); #if defined(SCO325) return ioctl(ciptr->fd, I_NREAD, (char *)pend); #else return ioctl(ciptr->fd, FIONREAD, (char *)pend); #endif } static int TRANS(LocalRead)(XtransConnInfo ciptr, char *buf, int size) { prmsg(2,"LocalRead(%d,%p,%d)\n", ciptr->fd, buf, size ); return read(ciptr->fd,buf,size); } static int TRANS(LocalWrite)(XtransConnInfo ciptr, char *buf, int size) { prmsg(2,"LocalWrite(%d,%p,%d)\n", ciptr->fd, buf, size ); return write(ciptr->fd,buf,size); } static int TRANS(LocalReadv)(XtransConnInfo ciptr, struct iovec *buf, int size) { prmsg(2,"LocalReadv(%d,%p,%d)\n", ciptr->fd, buf, size ); return READV(ciptr,buf,size); } static int TRANS(LocalWritev)(XtransConnInfo ciptr, struct iovec *buf, int size) { prmsg(2,"LocalWritev(%d,%p,%d)\n", ciptr->fd, buf, size ); return WRITEV(ciptr,buf,size); } static int TRANS(LocalDisconnect)(XtransConnInfo ciptr) { prmsg(2,"LocalDisconnect(%p->%d)\n", ciptr, ciptr->fd); return 0; } static int TRANS(LocalClose)(XtransConnInfo ciptr) { struct sockaddr_un *sockname=(struct sockaddr_un *) ciptr->addr; int ret; prmsg(2,"LocalClose(%p->%d)\n", ciptr, ciptr->fd ); ret=close(ciptr->fd); if(ciptr->flags && sockname && sockname->sun_family == AF_UNIX && sockname->sun_path[0] ) { if (!(ciptr->flags & TRANS_NOUNLINK)) unlink(sockname->sun_path); } return ret; } static int TRANS(LocalCloseForCloning)(XtransConnInfo ciptr) { int ret; prmsg(2,"LocalCloseForCloning(%p->%d)\n", ciptr, ciptr->fd ); /* Don't unlink path */ ret=close(ciptr->fd); return ret; } /* * MakeAllCOTSServerListeners() will go through the entire Xtransports[] * array defined in Xtrans.c and try to OpenCOTSServer() for each entry. * We will add duplicate entries to that table so that the OpenCOTSServer() * function will get called once for each type of local transport. * * The TransName is in lowercase, so it will never match during a normal * call to SelectTransport() in Xtrans.c. */ #ifdef TRANS_SERVER static const char * local_aliases[] = { # ifdef LOCAL_TRANS_PTS "pts", # endif "named", # ifdef __sun "pipe", /* compatibility with Solaris Xlib */ # endif # ifdef LOCAL_TRANS_SCO "sco", # endif NULL }; #endif Xtransport TRANS(LocalFuncs) = { /* Local Interface */ "local", TRANS_ALIAS | TRANS_LOCAL, #ifdef TRANS_CLIENT TRANS(LocalOpenCOTSClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER local_aliases, TRANS(LocalOpenCOTSServer), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(LocalReopenCOTSServer), #endif TRANS(LocalSetOption), #ifdef TRANS_SERVER TRANS(LocalCreateListener), TRANS(LocalResetListener), TRANS(LocalAccept), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(LocalConnect), #endif /* TRANS_CLIENT */ TRANS(LocalBytesReadable), TRANS(LocalRead), TRANS(LocalWrite), TRANS(LocalReadv), TRANS(LocalWritev), #if XTRANS_SEND_FDS TRANS(LocalSendFdInvalid), TRANS(LocalRecvFdInvalid), #endif TRANS(LocalDisconnect), TRANS(LocalClose), TRANS(LocalCloseForCloning), }; #ifdef LOCAL_TRANS_PTS Xtransport TRANS(PTSFuncs) = { /* Local Interface */ "pts", TRANS_LOCAL, #ifdef TRANS_CLIENT TRANS(LocalOpenCOTSClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER NULL, TRANS(LocalOpenCOTSServer), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(LocalReopenCOTSServer), #endif TRANS(LocalSetOption), #ifdef TRANS_SERVER TRANS(LocalCreateListener), TRANS(LocalResetListener), TRANS(LocalAccept), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(LocalConnect), #endif /* TRANS_CLIENT */ TRANS(LocalBytesReadable), TRANS(LocalRead), TRANS(LocalWrite), TRANS(LocalReadv), TRANS(LocalWritev), #if XTRANS_SEND_FDS TRANS(LocalSendFdInvalid), TRANS(LocalRecvFdInvalid), #endif TRANS(LocalDisconnect), TRANS(LocalClose), TRANS(LocalCloseForCloning), }; #endif /* LOCAL_TRANS_PTS */ #ifdef LOCAL_TRANS_NAMED Xtransport TRANS(NAMEDFuncs) = { /* Local Interface */ "named", TRANS_LOCAL, #ifdef TRANS_CLIENT TRANS(LocalOpenCOTSClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER NULL, TRANS(LocalOpenCOTSServer), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(LocalReopenCOTSServer), #endif TRANS(LocalSetOption), #ifdef TRANS_SERVER TRANS(LocalCreateListener), TRANS(LocalResetListener), TRANS(LocalAccept), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(LocalConnect), #endif /* TRANS_CLIENT */ TRANS(LocalBytesReadable), TRANS(LocalRead), TRANS(LocalWrite), TRANS(LocalReadv), TRANS(LocalWritev), #if XTRANS_SEND_FDS TRANS(LocalSendFdInvalid), TRANS(LocalRecvFdInvalid), #endif TRANS(LocalDisconnect), TRANS(LocalClose), TRANS(LocalCloseForCloning), }; #ifdef __sun Xtransport TRANS(PIPEFuncs) = { /* Local Interface */ "pipe", TRANS_ALIAS | TRANS_LOCAL, #ifdef TRANS_CLIENT TRANS(LocalOpenCOTSClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER NULL, TRANS(LocalOpenCOTSServer), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(LocalReopenCOTSServer), #endif TRANS(LocalSetOption), #ifdef TRANS_SERVER TRANS(LocalCreateListener), TRANS(LocalResetListener), TRANS(LocalAccept), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(LocalConnect), #endif /* TRANS_CLIENT */ TRANS(LocalBytesReadable), TRANS(LocalRead), TRANS(LocalWrite), TRANS(LocalReadv), TRANS(LocalWritev), #if XTRANS_SEND_FDS TRANS(LocalSendFdInvalid), TRANS(LocalRecvFdInvalid), #endif TRANS(LocalDisconnect), TRANS(LocalClose), TRANS(LocalCloseForCloning), }; #endif /* __sun */ #endif /* LOCAL_TRANS_NAMED */ #ifdef LOCAL_TRANS_SCO Xtransport TRANS(SCOFuncs) = { /* Local Interface */ "sco", TRANS_LOCAL, #ifdef TRANS_CLIENT TRANS(LocalOpenCOTSClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER NULL, TRANS(LocalOpenCOTSServer), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(LocalReopenCOTSServer), #endif TRANS(LocalSetOption), #ifdef TRANS_SERVER TRANS(LocalCreateListener), TRANS(LocalResetListener), TRANS(LocalAccept), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(LocalConnect), #endif /* TRANS_CLIENT */ TRANS(LocalBytesReadable), TRANS(LocalRead), TRANS(LocalWrite), TRANS(LocalReadv), TRANS(LocalWritev), #if XTRANS_SEND_FDS TRANS(LocalSendFdInvalid), TRANS(LocalRecvFdInvalid), #endif TRANS(LocalDisconnect), TRANS(LocalClose), TRANS(LocalCloseForCloning), }; #endif /* LOCAL_TRANS_SCO */ nx-libs-3.5.99.23/nx-X11/lib/include/xtrans/Xtranssock.c0000644000000000000000000024541013614532331017324 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /* Copyright 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the copyright holders. * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name NCR not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. NCR makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_DEBUG #define XTRANSDEBUG 5 #endif #ifndef PF_LOCAL #define PF_LOCAL PF_UNIX #endif #endif #include #ifdef XTHREADS #include #endif #ifndef WIN32 #if defined(TCPCONN) || defined(UNIXCONN) #include #include #include #endif #if defined(TCPCONN) || defined(UNIXCONN) #define X_INCLUDE_NETDB_H #define XOS_USE_NO_LOCKING #include #endif #ifdef UNIXCONN #ifndef X_NO_SYS_UN #include #endif #include #endif #ifndef NO_TCP_H #if defined(linux) || defined(__GLIBC__) #include #endif /* linux || __GLIBC__ */ #if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) #include #include #endif /* __NetBSD__ || __OpenBSD__ || __FreeBSD__ || __DragonFly__ */ #include #endif /* !NO_TCP_H */ #include #if defined(SVR4) || defined(__SVR4) #include #endif #include #else /* !WIN32 */ #include #include #include #undef close #define close closesocket #define ECONNREFUSED WSAECONNREFUSED #define EADDRINUSE WSAEADDRINUSE #define EPROTOTYPE WSAEPROTOTYPE #undef EWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK #define EINPROGRESS WSAEINPROGRESS #undef EINTR #define EINTR WSAEINTR #define X_INCLUDE_NETDB_H #define XOS_USE_MTSAFE_NETDBAPI #include #endif /* WIN32 */ #if defined(SO_DONTLINGER) && defined(SO_LINGER) #undef SO_DONTLINGER #endif /* others don't need this */ #define SocketInitOnce() /**/ #ifdef linux #define HAVE_ABSTRACT_SOCKETS #endif #define MIN_BACKLOG 128 #ifdef SOMAXCONN #if SOMAXCONN > MIN_BACKLOG #define BACKLOG SOMAXCONN #endif #endif #ifndef BACKLOG #define BACKLOG MIN_BACKLOG #endif /* * This is the Socket implementation of the X Transport service layer * * This file contains the implementation for both the UNIX and INET domains, * and can be built for either one, or both. * */ typedef struct _Sockettrans2dev { const char *transname; int family; int devcotsname; int devcltsname; int protocol; } Sockettrans2dev; static Sockettrans2dev Sockettrans2devtab[] = { #ifdef TCPCONN {"inet",AF_INET,SOCK_STREAM,SOCK_DGRAM,0}, #if !defined(IPv6) || !defined(AF_INET6) {"tcp",AF_INET,SOCK_STREAM,SOCK_DGRAM,0}, #else /* IPv6 */ {"tcp",AF_INET6,SOCK_STREAM,SOCK_DGRAM,0}, {"tcp",AF_INET,SOCK_STREAM,SOCK_DGRAM,0}, /* fallback */ {"inet6",AF_INET6,SOCK_STREAM,SOCK_DGRAM,0}, #endif #endif /* TCPCONN */ #ifdef UNIXCONN {"unix",AF_UNIX,SOCK_STREAM,SOCK_DGRAM,0}, #if !defined(LOCALCONN) {"local",AF_UNIX,SOCK_STREAM,SOCK_DGRAM,0}, #endif /* !LOCALCONN */ #endif /* UNIXCONN */ }; #define NUMSOCKETFAMILIES (sizeof(Sockettrans2devtab)/sizeof(Sockettrans2dev)) #ifdef TCPCONN static int TRANS(SocketINETClose) (XtransConnInfo ciptr); #endif #ifdef UNIXCONN #if defined(X11_t) #define UNIX_PATH "/tmp/.X11-unix/X" #define UNIX_DIR "/tmp/.X11-unix" #endif /* X11_t */ #if defined(XIM_t) #define UNIX_PATH "/tmp/.XIM-unix/XIM" #define UNIX_DIR "/tmp/.XIM-unix" #endif /* XIM_t */ #if defined(FS_t) || defined(FONT_t) #define UNIX_PATH "/tmp/.font-unix/fs" #define UNIX_DIR "/tmp/.font-unix" #endif /* FS_t || FONT_t */ #if defined(ICE_t) #define UNIX_PATH "/tmp/.ICE-unix/" #define UNIX_DIR "/tmp/.ICE-unix" #endif /* ICE_t */ #endif /* UNIXCONN */ #define PORTBUFSIZE 32 #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 255 #endif #if defined HAVE_SOCKLEN_T || (defined(IPv6) && defined(AF_INET6)) # define SOCKLEN_T socklen_t #elif defined(SVR4) || defined(__SVR4) || defined(__SCO__) # define SOCKLEN_T size_t #else # define SOCKLEN_T int #endif #ifndef X11_t /* * No NX changes if this is not * compiled as a X11 transport. */ #undef NX_TRANS_SOCKET #endif #ifdef NX_TRANS_SOCKET #if XTRANS_SEND_FDS #error XTRANS_SEND_FDS is unsupported for NX! #endif #ifdef TRANS_CLIENT #include typedef struct { XtransConnInfo info; int local; int remote; int congestion; } _NXProxyConnInfo; #define NX_PROXY_CONN_LIMIT 256 static _NXProxyConnInfo *_NXProxyConnInfoTab[NX_PROXY_CONN_LIMIT]; #endif /* #ifdef TRANS_CLIENT */ /* * Forcibly close any connection attempt on the * listening socket. Need this to avoid loopback * connections to the agent server. */ #ifdef TRANS_SERVER void TRANS(SocketRejectConnection) (XtransConnInfo ciptr) { socklen_t sa_l = sizeof(struct sockaddr); struct sockaddr sa; fd_set fs; struct timeval t; int f; prmsg (3, "SocketRejectConnection(%p)\n", (void *) ciptr); FD_ZERO(&fs); FD_SET(ciptr -> fd, &fs); t.tv_sec = 0; t.tv_usec = 0; /* * Check if there is an awaiting connection. */ if (select(ciptr -> fd + 1, &fs, NULL, NULL, &t) == 1) { #ifdef NX_TRANS_TEST fprintf(stderr, "SocketRejectConnection: Accepting connection attempt on fd [%d].\n", ciptr -> fd); #endif /* * If there is one, close it. */ if ((f = accept(ciptr -> fd, &sa, &sa_l)) >= 0) { #ifdef NX_TRANS_TEST fprintf(stderr, "SocketRejectConnection: Closing connection attempt on fd [%d].\n", ciptr -> fd); #endif close(f); } } } #endif /* #ifdef TRANS_SERVER */ #ifdef TRANS_CLIENT void *TRANS(SocketProxyConnInfo) (XtransConnInfo ciptr) { if (_NXProxyConnInfoTab[ciptr->fd] != NULL) { return ciptr->priv; } return NULL; } static XtransConnInfo TRANS(SocketCreateConnInfo) () { XtransConnInfo ciptr; int fds[2]; #ifdef NX_TRANS_TEST fprintf(stderr, "SocketCreateConnInfo: Going to create the NX connection info.\n"); #endif if ((ciptr = (XtransConnInfo) calloc (1, sizeof(struct _XtransConnInfo))) == NULL) { prmsg (1, "SocketCreateConnInfo: malloc failed\n"); return NULL; } /* * Create a pair of sockets. We'll communicate with * the NX proxy by reading and writing to our end. */ #ifdef NX_TRANS_TEST fprintf(stderr, "SocketCreateConnInfo: Going to create the NX socketpair.\n"); #endif if (socketpair(PF_LOCAL, SOCK_STREAM, 0, fds) < 0) { prmsg (1, "SocketCreateConnInfo: socketpair() failed.\n"); free ((char *) ciptr); return NULL; } #ifdef NX_TRANS_TEST fprintf(stderr, "SocketCreateConnInfo: X socket end is [%d] NX proxy end is [%d].\n", fds[0], fds[1]); #endif /* * Save in _NXProxyConnInfoTab the local and remote end of * the socketpair. The remote end will be used by the proxy. * When the memory-to-memory transport is activated, the * agent and the proxy don't read or write to the real des- * criptors but the communication takes place by reading * and writing to the proxy's buffers. */ ciptr->fd = fds[0]; if (ciptr->fd >= NX_PROXY_CONN_LIMIT) { prmsg (1, "SocketCreateConnInfo: No space for a new _NXProxyConnInfo for [%d].\n", ciptr->fd); free ((char *) ciptr); return NULL; } else if (_NXProxyConnInfoTab[ciptr->fd] != NULL) { prmsg (1, "SocketCreateConnInfo: _NXProxyConnInfo for [%d] is not NULL. Exiting.\n", ciptr->fd); exit(1); } _NXProxyConnInfoTab[ciptr->fd] = (_NXProxyConnInfo *) calloc(1, sizeof(_NXProxyConnInfo)); if (_NXProxyConnInfoTab[ciptr->fd] == NULL) { prmsg (1, "SocketCreateConnInfo: Alloc of _NXProxyConnInfo failed.\n"); free ((char *) ciptr); return NULL; } #ifdef NX_TRANS_TEST fprintf(stderr, "SocketCreateConnInfo: Allocated new _NXProxyConnInfo for [%d].\n", ciptr->fd); #endif _NXProxyConnInfoTab[ciptr->fd]->info = ciptr; _NXProxyConnInfoTab[ciptr->fd]->local = fds[0]; _NXProxyConnInfoTab[ciptr->fd]->remote = fds[1]; _NXProxyConnInfoTab[ciptr->fd]->congestion = 0; ciptr->priv = (char *) _NXProxyConnInfoTab[ciptr->fd]; return ciptr; } static int TRANS(SocketConnectConnInfo) (XtransConnInfo ciptr, const char *host, const char *port) { int fds[2]; char display[1024]; _NXProxyConnInfo *proxy_conn; #ifdef NX_TRANS_TEST fprintf(stderr, "SocketConnectConnInfo: Going to connect NX fd [%d] to host [%s] port [%s].\n", ciptr->fd, host, port); #endif /* * We should have already created the socket pair. */ proxy_conn = (_NXProxyConnInfo *) ciptr->priv; if (proxy_conn == NULL) { prmsg (1, "SocketConnectConnInfo: Pointer to _NXProxyConnInfo is NULL. Exiting.\n"); exit(1); } else if (_NXProxyConnInfoTab[ciptr->fd] != (_NXProxyConnInfo *) ciptr->priv) { prmsg (1, "SocketConnectConnInfo: Can't find _NXProxyConnInfo in table. Exiting.\n"); exit(1); } if (strlen(host) + strlen(port) + 1 >= 1023) { prmsg (1, "SocketConnectConnInfo: Length of NX display string '%s:%s' would exceed %d characters.\n", host, port, 1023); return TRANS_CONNECT_FAILED; } sprintf(display, "%s:%s", host, port); #ifdef NX_TRANS_TEST fprintf(stderr, "SocketConnectConnInfo: Setting close-on-exec flag on local NX descriptor [%d].\n", proxy_conn -> local); #endif #ifdef F_SETFD #ifdef FD_CLOEXEC if (fcntl(proxy_conn -> local, F_SETFD, FD_CLOEXEC) != 0) #else if (fcntl(proxy_conn -> local, F_SETFD, 1) != 0) #endif #endif { prmsg (1, "SocketConnectConnInfo: Cannot set close-on-exec on local NX descriptor [%d].\n", proxy_conn -> local); return TRANS_CONNECT_FAILED; } #ifdef NX_TRANS_TEST fprintf(stderr, "SocketConnectConnInfo: Creating the NX transport with display [%s].\n", display); #endif if (NXTransCreate(NX_FD_ANY, NX_MODE_CLIENT, display) < 0) { prmsg (1, "SocketConnectConnInfo: Cannot create the NX transport.\n"); return TRANS_CONNECT_FAILED; } #ifdef NX_TRANS_TEST fprintf(stderr, "SocketConnectConnInfo: Starting the NX agent with descriptor [%d].\n", proxy_conn -> remote); #endif fds[0] = proxy_conn -> local; fds[1] = proxy_conn -> remote; NXTransAgent(fds); return 0; } static void TRANS(SocketCloseConnInfo) (XtransConnInfo ciptr) { _NXProxyConnInfo *proxy_conn; #ifdef NX_TRANS_TEST fprintf(stderr, "SocketCloseConnInfo: Going to close the NX fd [%d].\n", ciptr->fd); #endif proxy_conn = (_NXProxyConnInfo *) ciptr->priv; if (proxy_conn == NULL) { prmsg (1, "SocketCloseConnInfo: Pointer to _NXProxyConnInfo is NULL. Exiting.\n"); exit(1); } else if (ciptr->fd >= NX_PROXY_CONN_LIMIT || _NXProxyConnInfoTab[ciptr->fd] != (_NXProxyConnInfo *) ciptr->priv) { prmsg (1, "SocketCloseConnInfo: Can't find _NXProxyConnInfo in table. Exiting.\n"); exit(1); } else if (_NXProxyConnInfoTab[ciptr->fd] -> info != ciptr || _NXProxyConnInfoTab[ciptr->fd] -> local != ciptr->fd) { prmsg (1, "SocketCloseConnInfo: Invalid _NXProxyConnInfo structure for [%d]. Exiting.\n", ciptr->fd); exit(1); } else if (proxy_conn->local < 0 || proxy_conn->remote < 0) { prmsg (1, "SocketCloseConnInfo: Invalid socket pair in NX connection for [%d]. Exiting.\n", ciptr->fd); exit(1); } NXTransClose(ciptr->fd); /* * Get rid of the _NXProxyConnInfo structure. */ #ifdef NX_TRANS_TEST fprintf(stderr, "SocketCloseConnInfo: Freeing _NXProxyConnInfo structure for [%d].\n", ciptr->fd); #endif free((char *) _NXProxyConnInfoTab[ciptr->fd]); _NXProxyConnInfoTab[ciptr->fd] = NULL; ciptr->priv = NULL; #ifdef NX_TRANS_TEST fprintf(stderr, "SocketCloseConnInfo: Should now close the local descriptor [%d].\n", ciptr->fd); #endif } #endif /* #ifdef TRANS_CLIENT */ #if defined(TRANS_CLIENT) && defined(NX_TRANS_CHANGE) /* * Check the congestion state of the NX transport * and return 1 if there has been a change. This * can be extended by adding a few counters track- * ing the bandwidth usage of the X11 connection. */ int TRANS(SocketCongestionChange) (XtransConnInfo ciptr, int *state) { int congestion; _NXProxyConnInfo *proxy_conn; prmsg (3, "SocketCongestionChange(%p)\n", (void *) ciptr); proxy_conn = (_NXProxyConnInfo *) ciptr->priv; if (proxy_conn == NULL) { #ifdef NX_TRANS_DEBUG fprintf(stderr, "SocketCongestionChange: Descriptor [%d] doesn't appear to be a NX connection.\n", ciptr->fd); #endif return 0; } #ifdef NX_TRANS_DEBUG fprintf(stderr, "SocketCongestionChange: Checking congestion on fd [%d] with old state [%d].\n", ciptr->fd, proxy_conn->congestion); #endif congestion = NXTransCongestion(ciptr->fd); if (congestion != proxy_conn->congestion) { proxy_conn->congestion = congestion; #ifdef NX_TRANS_TEST fprintf(stderr, "SocketCongestionChange: Change detected on fd [%d] with new state [%d].\n", ciptr->fd, proxy_conn->congestion); #endif return 1; } #ifdef NX_TRANS_TEST fprintf(stderr, "SocketCongestionChange: No change on fd [%d] with current state [%d].\n", ciptr->fd, congestion); #endif return 0; } #endif /* #if defined(TRANS_CLIENT) && defined(NX_TRANS_CHANGE) */ #endif /* #ifdef NX_TRANS_SOCKET */ /* * These are some utility function used by the real interface function below. */ static int TRANS(SocketSelectFamily) (int first, const char *family) { int i; prmsg (3,"SocketSelectFamily(%s)\n", family); for (i = first + 1; i < NUMSOCKETFAMILIES;i++) { if (!strcmp (family, Sockettrans2devtab[i].transname)) return i; } return (first == -1 ? -2 : -1); } /* * This function gets the local address of the socket and stores it in the * XtransConnInfo structure for the connection. */ static int TRANS(SocketINETGetAddr) (XtransConnInfo ciptr) { #if defined(IPv6) && defined(AF_INET6) struct sockaddr_storage socknamev6; #else struct sockaddr_in socknamev4; #endif void *socknamePtr; SOCKLEN_T namelen; prmsg (3,"SocketINETGetAddr(%p)\n", (void *) ciptr); #if defined(IPv6) && defined(AF_INET6) namelen = sizeof(socknamev6); socknamePtr = &socknamev6; #else namelen = sizeof(socknamev4); socknamePtr = &socknamev4; #endif bzero(socknamePtr, namelen); if (getsockname (ciptr->fd,(struct sockaddr *) socknamePtr, (void *)&namelen) < 0) { #ifdef WIN32 errno = WSAGetLastError(); #endif prmsg (1,"SocketINETGetAddr: getsockname() failed: %d\n", EGET()); return -1; } /* * Everything looks good: fill in the XtransConnInfo structure. */ if ((ciptr->addr = malloc (namelen)) == NULL) { prmsg (1, "SocketINETGetAddr: Can't allocate space for the addr\n"); return -1; } #if defined(IPv6) && defined(AF_INET6) ciptr->family = ((struct sockaddr *)socknamePtr)->sa_family; #else ciptr->family = socknamev4.sin_family; #endif ciptr->addrlen = namelen; memcpy (ciptr->addr, socknamePtr, ciptr->addrlen); return 0; } /* * This function gets the remote address of the socket and stores it in the * XtransConnInfo structure for the connection. */ static int TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr) { #if defined(IPv6) && defined(AF_INET6) struct sockaddr_storage socknamev6; #endif struct sockaddr_in socknamev4; void *socknamePtr; SOCKLEN_T namelen; #if defined(IPv6) && defined(AF_INET6) if (ciptr->family == AF_INET6) { namelen = sizeof(socknamev6); socknamePtr = &socknamev6; } else #endif { namelen = sizeof(socknamev4); socknamePtr = &socknamev4; } bzero(socknamePtr, namelen); prmsg (3,"SocketINETGetPeerAddr(%p)\n", (void *) ciptr); if (getpeername (ciptr->fd, (struct sockaddr *) socknamePtr, (void *)&namelen) < 0) { #ifdef WIN32 errno = WSAGetLastError(); #endif prmsg (1,"SocketINETGetPeerAddr: getpeername() failed: %d\n", EGET()); return -1; } /* * Everything looks good: fill in the XtransConnInfo structure. */ if ((ciptr->peeraddr = malloc (namelen)) == NULL) { prmsg (1, "SocketINETGetPeerAddr: Can't allocate space for the addr\n"); return -1; } ciptr->peeraddrlen = namelen; memcpy (ciptr->peeraddr, socknamePtr, ciptr->peeraddrlen); return 0; } static XtransConnInfo TRANS(SocketOpen) (int i, int type) { XtransConnInfo ciptr; prmsg (3,"SocketOpen(%d,%d)\n", i, type); if ((ciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) { prmsg (1, "SocketOpen: malloc failed\n"); return NULL; } if ((ciptr->fd = socket(Sockettrans2devtab[i].family, type, Sockettrans2devtab[i].protocol)) < 0 #ifndef WIN32 #if (defined(X11_t) && !defined(USE_POLL)) || defined(FS_t) || defined(FONT_t) || ciptr->fd >= sysconf(_SC_OPEN_MAX) #endif #endif ) { #ifdef WIN32 errno = WSAGetLastError(); #endif prmsg (2, "SocketOpen: socket() failed for %s\n", Sockettrans2devtab[i].transname); free (ciptr); return NULL; } #ifdef TCP_NODELAY if (Sockettrans2devtab[i].family == AF_INET #if defined(IPv6) && defined(AF_INET6) || Sockettrans2devtab[i].family == AF_INET6 #endif ) { /* * turn off TCP coalescence for INET sockets */ int tmp = 1; setsockopt (ciptr->fd, IPPROTO_TCP, TCP_NODELAY, (char *) &tmp, sizeof (int)); } #endif /* * Some systems provide a really small default buffer size for * UNIX sockets. Bump it up a bit such that large transfers don't * proceed at glacial speed. */ #ifdef SO_SNDBUF if (Sockettrans2devtab[i].family == AF_UNIX) { SOCKLEN_T len = sizeof (int); int val; if (getsockopt (ciptr->fd, SOL_SOCKET, SO_SNDBUF, (char *) &val, &len) == 0 && val < 64 * 1024) { val = 64 * 1024; setsockopt (ciptr->fd, SOL_SOCKET, SO_SNDBUF, (char *) &val, sizeof (int)); } } #endif return ciptr; } #ifdef TRANS_REOPEN static XtransConnInfo TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, const char *port) { XtransConnInfo ciptr; int portlen; struct sockaddr *addr; size_t addrlen; prmsg (3,"SocketReopen(%d,%d,%s)\n", type, fd, port); if (port == NULL) { prmsg (1, "SocketReopen: port was null!\n"); return NULL; } portlen = strlen(port) + 1; // include space for trailing null #ifdef SOCK_MAXADDRLEN if (portlen < 0 || portlen > (SOCK_MAXADDRLEN + 2)) { prmsg (1, "SocketReopen: invalid portlen %d\n", portlen); return NULL; } if (portlen < 14) portlen = 14; #else if (portlen < 0 || portlen > 14) { prmsg (1, "SocketReopen: invalid portlen %d\n", portlen); return NULL; } #endif /*SOCK_MAXADDRLEN*/ if ((ciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) { prmsg (1, "SocketReopen: malloc(ciptr) failed\n"); return NULL; } ciptr->fd = fd; addrlen = portlen + offsetof(struct sockaddr, sa_data); if ((addr = calloc (1, addrlen)) == NULL) { prmsg (1, "SocketReopen: malloc(addr) failed\n"); free (ciptr); return NULL; } ciptr->addr = (char *) addr; ciptr->addrlen = addrlen; if ((ciptr->peeraddr = calloc (1, addrlen)) == NULL) { prmsg (1, "SocketReopen: malloc(portaddr) failed\n"); free (addr); free (ciptr); return NULL; } ciptr->peeraddrlen = addrlen; /* Initialize ciptr structure as if it were a normally-opened unix socket */ ciptr->flags = TRANS_LOCAL | TRANS_NOUNLINK; #ifdef BSD44SOCKETS addr->sa_len = addrlen; #endif addr->sa_family = AF_UNIX; #if defined(HAVE_STRLCPY) || defined(HAS_STRLCPY) strlcpy(addr->sa_data, port, portlen); #else strncpy(addr->sa_data, port, portlen); #endif ciptr->family = AF_UNIX; memcpy(ciptr->peeraddr, ciptr->addr, addrlen); ciptr->port = rindex(addr->sa_data, ':'); if (ciptr->port == NULL) { if (is_numeric(addr->sa_data)) { ciptr->port = addr->sa_data; } } else if (ciptr->port[0] == ':') { ciptr->port++; } /* port should now point to portnum or NULL */ return ciptr; } #endif /* TRANS_REOPEN */ /* * These functions are the interface supplied in the Xtransport structure */ #ifdef TRANS_CLIENT static XtransConnInfo TRANS(SocketOpenCOTSClientBase) (const char *transname, const char *protocol, const char *host, const char *port, int previndex) { XtransConnInfo ciptr; int i = previndex; prmsg (2, "SocketOpenCOTSClient(%s,%s,%s)\n", protocol, host, port); SocketInitOnce(); while ((i = TRANS(SocketSelectFamily) (i, transname)) >= 0) { #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) if ((!strcmp(protocol, "local") || !strcmp(protocol, "nx")) && (!strcasecmp(host, "nx") || !strncasecmp(host, "nx,", 3))) { ciptr = TRANS(SocketCreateConnInfo) (); if (ciptr == NULL) { prmsg (1, "SocketOpenCOTSClient: Unable to create the NX connection info for %s.\n", transname); return NULL; } ciptr->index = i; return ciptr; } #endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ if ((ciptr = TRANS(SocketOpen) ( i, Sockettrans2devtab[i].devcotsname)) != NULL) { /* Save the index for later use */ ciptr->index = i; break; } } if (i < 0) { if (i == -1) prmsg (1,"SocketOpenCOTSClient: Unable to open socket for %s\n", transname); else prmsg (1,"SocketOpenCOTSClient: Unable to determine socket type for %s\n", transname); return NULL; } #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) ciptr->priv = NULL; #endif return ciptr; } static XtransConnInfo TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, const char *protocol, const char *host, const char *port) { return TRANS(SocketOpenCOTSClientBase)( thistrans->TransName, protocol, host, port, -1); } #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER static XtransConnInfo TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, const char *protocol, const char *host, const char *port) { XtransConnInfo ciptr; int i = -1; prmsg (2,"SocketOpenCOTSServer(%s,%s,%s)\n", protocol, host, port); SocketInitOnce(); while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) { if ((ciptr = TRANS(SocketOpen) ( i, Sockettrans2devtab[i].devcotsname)) != NULL) break; } if (i < 0) { if (i == -1) prmsg (1,"SocketOpenCOTSServer: Unable to open socket for %s\n", thistrans->TransName); else prmsg (1,"SocketOpenCOTSServer: Unable to determine socket type for %s\n", thistrans->TransName); return NULL; } /* * Using this prevents the bind() check for an existing server listening * on the same port, but it is required for other reasons. */ #ifdef SO_REUSEADDR /* * SO_REUSEADDR only applied to AF_INET && AF_INET6 */ if (Sockettrans2devtab[i].family == AF_INET #if defined(IPv6) && defined(AF_INET6) || Sockettrans2devtab[i].family == AF_INET6 #endif ) { int one = 1; setsockopt (ciptr->fd, SOL_SOCKET, SO_REUSEADDR, (char *) &one, sizeof (int)); } #endif #ifdef IPV6_V6ONLY if (Sockettrans2devtab[i].family == AF_INET6) { int one = 1; setsockopt(ciptr->fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(int)); } #endif /* Save the index for later use */ ciptr->index = i; return ciptr; } #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN static XtransConnInfo TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, const char *port) { XtransConnInfo ciptr; int i = -1; prmsg (2, "SocketReopenCOTSServer(%d, %s)\n", fd, port); SocketInitOnce(); while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) { if ((ciptr = TRANS(SocketReopen) ( i, Sockettrans2devtab[i].devcotsname, fd, port)) != NULL) break; } if (i < 0) { if (i == -1) prmsg (1,"SocketReopenCOTSServer: Unable to open socket for %s\n", thistrans->TransName); else prmsg (1,"SocketReopenCOTSServer: Unable to determine socket type for %s\n", thistrans->TransName); return NULL; } /* Save the index for later use */ ciptr->index = i; return ciptr; } #endif /* TRANS_REOPEN */ static int TRANS(SocketSetOption) (XtransConnInfo ciptr, int option, int arg) { prmsg (2,"SocketSetOption(%d,%d,%d)\n", ciptr->fd, option, arg); #ifdef NX_TRANS_TEST fprintf(stderr, "SocketSetOption: WARNING! Not setting option [%d] with value [%d] on descriptor [%d].\n", option, arg, ciptr -> fd); #endif return -1; } #ifdef UNIXCONN static int set_sun_path(const char *port, const char *upath, char *path, int abstract) { struct sockaddr_un s; int maxlen = sizeof(s.sun_path) - 1; const char *at = ""; if (!port || !*port || !path) return -1; #ifdef HAVE_ABSTRACT_SOCKETS if (port[0] == '@') upath = ""; else if (abstract) at = "@"; #endif if (*port == '/') /* a full pathname */ upath = ""; if (strlen(port) + strlen(upath) > maxlen) return -1; snprintf(path, sizeof(s.sun_path), "%s%s%s", at, upath, port); return 0; } #endif #ifdef TRANS_SERVER static int TRANS(SocketCreateListener) (XtransConnInfo ciptr, struct sockaddr *sockname, int socknamelen, unsigned int flags) { SOCKLEN_T namelen = socknamelen; int fd = ciptr->fd; int retry; prmsg (3, "SocketCreateListener(%p,%d)\n", (void *) ciptr, fd); if (Sockettrans2devtab[ciptr->index].family == AF_INET #if defined(IPv6) && defined(AF_INET6) || Sockettrans2devtab[ciptr->index].family == AF_INET6 #endif ) retry = 20; else retry = 0; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "SocketCreateListener: Creating listener for ciptr at [%p] on path [%s].\n", (void *) ciptr, ((struct sockaddr_un *) sockname)->sun_family == AF_UNIX ? ((struct sockaddr_un *) sockname)->sun_path : "TCP"); #endif while (bind (fd, (struct sockaddr *) sockname, namelen) < 0) { if (errno == EADDRINUSE) { if (flags & ADDR_IN_USE_ALLOWED) break; else return TRANS_ADDR_IN_USE; } if (retry-- == 0) { prmsg (1, "SocketCreateListener: failed to bind listener\n"); close (fd); return TRANS_CREATE_LISTENER_FAILED; } #ifdef SO_REUSEADDR sleep (1); #else sleep (10); #endif /* SO_REUSEDADDR */ } if (Sockettrans2devtab[ciptr->index].family == AF_INET #if defined(IPv6) && defined(AF_INET6) || Sockettrans2devtab[ciptr->index].family == AF_INET6 #endif ) { #ifdef SO_DONTLINGER setsockopt (fd, SOL_SOCKET, SO_DONTLINGER, (char *) NULL, 0); #else #ifdef SO_LINGER { static int linger[2] = { 0, 0 }; setsockopt (fd, SOL_SOCKET, SO_LINGER, (char *) linger, sizeof (linger)); } #endif #endif } if (listen (fd, BACKLOG) < 0) { prmsg (1, "SocketCreateListener: listen() failed\n"); close (fd); return TRANS_CREATE_LISTENER_FAILED; } /* Set a flag to indicate that this connection is a listener */ ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS); #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "SocketCreateListener: Set flags to [%d] for ciptr [%p].\n", ciptr->flags, (void *) ciptr); #endif return 0; } #ifdef TCPCONN static int TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, const char *port, unsigned int flags) { #if defined(IPv6) && defined(AF_INET6) struct sockaddr_storage sockname; #else struct sockaddr_in sockname; #endif unsigned short sport; SOCKLEN_T namelen = sizeof(sockname); int status; long tmpport; #ifdef XTHREADS_NEEDS_BYNAMEPARAMS _Xgetservbynameparams sparams; #endif struct servent *servp; #ifdef X11_t char portbuf[PORTBUFSIZE]; #endif prmsg (2, "SocketINETCreateListener(%s)\n", port); #ifdef X11_t /* * X has a well known port, that is transport dependent. It is easier * to handle it here, than try and come up with a transport independent * representation that can be passed in and resolved the usual way. * * The port that is passed here is really a string containing the idisplay * from ConnectDisplay(). */ if (is_numeric (port)) { /* fixup the server port address */ tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10); snprintf (portbuf, sizeof(portbuf), "%lu", tmpport); port = portbuf; } #endif if (port && *port) { /* Check to see if the port string is just a number (handles X11) */ if (!is_numeric (port)) { if ((servp = _XGetservbyname (port,"tcp",sparams)) == NULL) { prmsg (1, "SocketINETCreateListener: Unable to get service for %s\n", port); return TRANS_CREATE_LISTENER_FAILED; } /* we trust getservbyname to return a valid number */ sport = servp->s_port; } else { tmpport = strtol (port, (char**)NULL, 10); /* * check that somehow the port address isn't negative or in * the range of reserved port addresses. This can happen and * be very bad if the server is suid-root and the user does * something (dumb) like `X :60049`. */ if (tmpport < 1024 || tmpport > USHRT_MAX) return TRANS_CREATE_LISTENER_FAILED; sport = (unsigned short) tmpport; } } else sport = 0; bzero(&sockname, sizeof(sockname)); #if defined(IPv6) && defined(AF_INET6) if (Sockettrans2devtab[ciptr->index].family == AF_INET) { namelen = sizeof (struct sockaddr_in); #ifdef BSD44SOCKETS ((struct sockaddr_in *)&sockname)->sin_len = namelen; #endif ((struct sockaddr_in *)&sockname)->sin_family = AF_INET; ((struct sockaddr_in *)&sockname)->sin_port = htons(sport); ((struct sockaddr_in *)&sockname)->sin_addr.s_addr = htonl(INADDR_ANY); } else { namelen = sizeof (struct sockaddr_in6); #ifdef SIN6_LEN ((struct sockaddr_in6 *)&sockname)->sin6_len = sizeof(sockname); #endif ((struct sockaddr_in6 *)&sockname)->sin6_family = AF_INET6; ((struct sockaddr_in6 *)&sockname)->sin6_port = htons(sport); ((struct sockaddr_in6 *)&sockname)->sin6_addr = in6addr_any; } #else #ifdef BSD44SOCKETS sockname.sin_len = sizeof (sockname); #endif sockname.sin_family = AF_INET; sockname.sin_port = htons (sport); sockname.sin_addr.s_addr = htonl (INADDR_ANY); #endif if ((status = TRANS(SocketCreateListener) (ciptr, (struct sockaddr *) &sockname, namelen, flags)) < 0) { prmsg (1, "SocketINETCreateListener: ...SocketCreateListener() failed\n"); return status; } if (TRANS(SocketINETGetAddr) (ciptr) < 0) { prmsg (1, "SocketINETCreateListener: ...SocketINETGetAddr() failed\n"); return TRANS_CREATE_LISTENER_FAILED; } return 0; } #endif /* TCPCONN */ #ifdef UNIXCONN static int TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, const char *port, unsigned int flags) { struct sockaddr_un sockname; int namelen; int oldUmask; int status; unsigned int mode; char tmpport[108]; int abstract = 0; #ifdef HAVE_ABSTRACT_SOCKETS abstract = ciptr->transptr->flags & TRANS_ABSTRACT; #endif prmsg (2, "SocketUNIXCreateListener(%s)\n", port ? port : "NULL"); /* Make sure the directory is created */ oldUmask = umask (0); #ifdef UNIX_DIR #ifdef HAS_STICKY_DIR_BIT mode = 01777; #else mode = 0777; #endif if (!abstract && trans_mkdir(UNIX_DIR, mode) == -1) { prmsg (1, "SocketUNIXCreateListener: mkdir(%s) failed, errno = %d\n", UNIX_DIR, errno); (void) umask (oldUmask); return TRANS_CREATE_LISTENER_FAILED; } #endif memset(&sockname, 0, sizeof(sockname)); sockname.sun_family = AF_UNIX; if (!(port && *port)) { snprintf (tmpport, sizeof(tmpport), "%s%ld", UNIX_PATH, (long)getpid()); port = tmpport; } if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) { prmsg (1, "SocketUNIXCreateListener: path too long\n"); return TRANS_CREATE_LISTENER_FAILED; } #if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) sockname.sun_len = strlen(sockname.sun_path); #endif #if defined(BSD44SOCKETS) || defined(SUN_LEN) namelen = SUN_LEN(&sockname); #else namelen = strlen(sockname.sun_path) + offsetof(struct sockaddr_un, sun_path); #endif #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "SocketUNIXCreateListener: Unlinking path [%s] for ciptr at [%p].\n", sockname.sun_path, (void *) ciptr); #endif if (abstract) { sockname.sun_path[0] = '\0'; namelen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&sockname.sun_path[1]); } else unlink (sockname.sun_path); if ((status = TRANS(SocketCreateListener) (ciptr, (struct sockaddr *) &sockname, namelen, flags)) < 0) { prmsg (1, "SocketUNIXCreateListener: ...SocketCreateListener() failed\n"); (void) umask (oldUmask); return status; } /* * Now that the listener is esablished, create the addr info for * this connection. getpeername() doesn't work for UNIX Domain Sockets * on some systems (hpux at least), so we will just do it manually, instead * of calling something like TRANS(SocketUNIXGetAddr). */ namelen = sizeof (sockname); /* this will always make it the same size */ if ((ciptr->addr = malloc (namelen)) == NULL) { prmsg (1, "SocketUNIXCreateListener: Can't allocate space for the addr\n"); (void) umask (oldUmask); return TRANS_CREATE_LISTENER_FAILED; } if (abstract) sockname.sun_path[0] = '@'; ciptr->family = sockname.sun_family; ciptr->addrlen = namelen; memcpy (ciptr->addr, &sockname, ciptr->addrlen); (void) umask (oldUmask); return 0; } static int TRANS(SocketUNIXResetListener) (XtransConnInfo ciptr) { /* * See if the unix domain socket has disappeared. If it has, recreate it. */ struct sockaddr_un *unsock = (struct sockaddr_un *) ciptr->addr; struct stat statb; int status = TRANS_RESET_NOOP; unsigned int mode; int abstract = 0; #ifdef HAVE_ABSTRACT_SOCKETS abstract = ciptr->transptr->flags & TRANS_ABSTRACT; #endif prmsg (3, "SocketUNIXResetListener(%p,%d)\n", (void *) ciptr, ciptr->fd); if (!abstract && ( stat (unsock->sun_path, &statb) == -1 || ((statb.st_mode & S_IFMT) != #if defined(NCR) || defined(SCO325) || !defined(S_IFSOCK) S_IFIFO #else S_IFSOCK #endif ))) { int oldUmask = umask (0); #ifdef UNIX_DIR #ifdef HAS_STICKY_DIR_BIT mode = 01777; #else mode = 0777; #endif if (trans_mkdir(UNIX_DIR, mode) == -1) { prmsg (1, "SocketUNIXResetListener: mkdir(%s) failed, errno = %d\n", UNIX_DIR, errno); (void) umask (oldUmask); return TRANS_RESET_FAILURE; } #endif close (ciptr->fd); unlink (unsock->sun_path); if ((ciptr->fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { TRANS(FreeConnInfo) (ciptr); (void) umask (oldUmask); return TRANS_RESET_FAILURE; } if (bind (ciptr->fd, (struct sockaddr *) unsock, ciptr->addrlen) < 0) { close (ciptr->fd); TRANS(FreeConnInfo) (ciptr); return TRANS_RESET_FAILURE; } if (listen (ciptr->fd, BACKLOG) < 0) { close (ciptr->fd); TRANS(FreeConnInfo) (ciptr); (void) umask (oldUmask); return TRANS_RESET_FAILURE; } umask (oldUmask); status = TRANS_RESET_NEW_FD; } return status; } #endif /* UNIXCONN */ #ifdef TCPCONN static XtransConnInfo TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status) { XtransConnInfo newciptr; struct sockaddr_in sockname; SOCKLEN_T namelen = sizeof(sockname); prmsg (2, "SocketINETAccept(%p,%d)\n", (void *) ciptr, ciptr->fd); if ((newciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) { prmsg (1, "SocketINETAccept: malloc failed\n"); *status = TRANS_ACCEPT_BAD_MALLOC; return NULL; } if ((newciptr->fd = accept (ciptr->fd, (struct sockaddr *) &sockname, (void *)&namelen)) < 0) { #ifdef WIN32 errno = WSAGetLastError(); #endif prmsg (1, "SocketINETAccept: accept() failed\n"); free (newciptr); *status = TRANS_ACCEPT_FAILED; return NULL; } #ifdef TCP_NODELAY { /* * turn off TCP coalescence for INET sockets */ int tmp = 1; setsockopt (newciptr->fd, IPPROTO_TCP, TCP_NODELAY, (char *) &tmp, sizeof (int)); } #endif /* * Get this address again because the transport may give a more * specific address now that a connection is established. */ if (TRANS(SocketINETGetAddr) (newciptr) < 0) { prmsg (1, "SocketINETAccept: ...SocketINETGetAddr() failed:\n"); close (newciptr->fd); free (newciptr); *status = TRANS_ACCEPT_MISC_ERROR; return NULL; } if (TRANS(SocketINETGetPeerAddr) (newciptr) < 0) { prmsg (1, "SocketINETAccept: ...SocketINETGetPeerAddr() failed:\n"); close (newciptr->fd); if (newciptr->addr) free (newciptr->addr); free (newciptr); *status = TRANS_ACCEPT_MISC_ERROR; return NULL; } *status = 0; return newciptr; } #endif /* TCPCONN */ #ifdef UNIXCONN static XtransConnInfo TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) { XtransConnInfo newciptr; struct sockaddr_un sockname; SOCKLEN_T namelen = sizeof sockname; prmsg (2, "SocketUNIXAccept(%p,%d)\n", (void *) ciptr, ciptr->fd); if ((newciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) { prmsg (1, "SocketUNIXAccept: malloc() failed\n"); *status = TRANS_ACCEPT_BAD_MALLOC; return NULL; } if ((newciptr->fd = accept (ciptr->fd, (struct sockaddr *) &sockname, (void *)&namelen)) < 0) { prmsg (1, "SocketUNIXAccept: accept() failed\n"); free (newciptr); *status = TRANS_ACCEPT_FAILED; return NULL; } ciptr->addrlen = namelen; /* * Get the socket name and the peer name from the listener socket, * since this is unix domain. */ if ((newciptr->addr = malloc (ciptr->addrlen)) == NULL) { prmsg (1, "SocketUNIXAccept: Can't allocate space for the addr\n"); close (newciptr->fd); free (newciptr); *status = TRANS_ACCEPT_BAD_MALLOC; return NULL; } /* * if the socket is abstract, we already modified the address to have a * @ instead of the initial NUL, so no need to do that again here. */ newciptr->addrlen = ciptr->addrlen; memcpy (newciptr->addr, ciptr->addr, newciptr->addrlen); if ((newciptr->peeraddr = malloc (ciptr->addrlen)) == NULL) { prmsg (1, "SocketUNIXAccept: Can't allocate space for the addr\n"); close (newciptr->fd); if (newciptr->addr) free (newciptr->addr); free (newciptr); *status = TRANS_ACCEPT_BAD_MALLOC; return NULL; } newciptr->peeraddrlen = ciptr->addrlen; memcpy (newciptr->peeraddr, ciptr->addr, newciptr->addrlen); newciptr->family = AF_UNIX; *status = 0; return newciptr; } #endif /* UNIXCONN */ #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT #ifdef TCPCONN #if defined(IPv6) && defined(AF_INET6) struct addrlist { struct addrinfo * addr; struct addrinfo * firstaddr; char port[PORTBUFSIZE]; char host[MAXHOSTNAMELEN]; }; static struct addrlist *addrlist = NULL; #endif static int TRANS(SocketINETConnect) (XtransConnInfo ciptr, const char *host, const char *port) { struct sockaddr * socketaddr = NULL; int socketaddrlen = 0; int res; #if defined(IPv6) && defined(AF_INET6) struct addrinfo hints; char ntopbuf[INET6_ADDRSTRLEN]; int resetonce = 0; #else struct sockaddr_in sockname; struct hostent *hostp; struct servent *servp; unsigned long tmpaddr; #endif #ifdef XTHREADS_NEEDS_BYNAMEPARAMS _Xgethostbynameparams hparams; _Xgetservbynameparams sparams; #endif #ifdef X11_t char portbuf[PORTBUFSIZE]; #endif char hostnamebuf[256]; /* tmp space */ prmsg (2,"SocketINETConnect(%d,%s,%s)\n", ciptr->fd, host, port); if (!host) { hostnamebuf[0] = '\0'; (void) TRANS(GetHostname) (hostnamebuf, sizeof hostnamebuf); host = hostnamebuf; } #ifdef X11_t /* * X has a well known port, that is transport dependent. It is easier * to handle it here, than try and come up with a transport independent * representation that can be passed in and resolved the usual way. * * The port that is passed here is really a string containing the idisplay * from ConnectDisplay(). */ if (is_numeric (port)) { long tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10); snprintf (portbuf, sizeof(portbuf), "%lu", tmpport); port = portbuf; } #endif #if defined(IPv6) && defined(AF_INET6) { if (addrlist != NULL) { if (strcmp(host,addrlist->host) || strcmp(port,addrlist->port)) { if (addrlist->firstaddr) freeaddrinfo(addrlist->firstaddr); addrlist->firstaddr = NULL; } } else { addrlist = malloc(sizeof(struct addrlist)); addrlist->firstaddr = NULL; } if (addrlist->firstaddr == NULL) { strncpy(addrlist->port, port, sizeof(addrlist->port)); addrlist->port[sizeof(addrlist->port) - 1] = '\0'; strncpy(addrlist->host, host, sizeof(addrlist->host)); addrlist->host[sizeof(addrlist->host) - 1] = '\0'; bzero(&hints,sizeof(hints)); hints.ai_socktype = Sockettrans2devtab[ciptr->index].devcotsname; res = getaddrinfo(host,port,&hints,&addrlist->firstaddr); if (res != 0) { prmsg (1, "SocketINETConnect() can't get address " "for %s:%s: %s\n", host, port, gai_strerror(res)); ESET(EINVAL); return TRANS_CONNECT_FAILED; } for (res = 0, addrlist->addr = addrlist->firstaddr; addrlist->addr ; res++) { addrlist->addr = addrlist->addr->ai_next; } prmsg(4,"Got New Address list with %d addresses\n", res); res = 0; addrlist->addr = NULL; } while (socketaddr == NULL) { if (addrlist->addr == NULL) { if (resetonce) { /* Already checked entire list - no usable addresses */ prmsg (1, "SocketINETConnect() no usable address " "for %s:%s\n", host, port); return TRANS_CONNECT_FAILED; } else { /* Go back to beginning of list */ resetonce = 1; addrlist->addr = addrlist->firstaddr; } } socketaddr = addrlist->addr->ai_addr; socketaddrlen = addrlist->addr->ai_addrlen; if (addrlist->addr->ai_family == AF_INET) { struct sockaddr_in *sin = (struct sockaddr_in *) socketaddr; prmsg (4,"SocketINETConnect() sockname.sin_addr = %s\n", inet_ntop(addrlist->addr->ai_family,&sin->sin_addr, ntopbuf,sizeof(ntopbuf))); prmsg (4,"SocketINETConnect() sockname.sin_port = %d\n", ntohs(sin->sin_port)); if (Sockettrans2devtab[ciptr->index].family == AF_INET6) { if (strcmp(Sockettrans2devtab[ciptr->index].transname, "tcp") == 0) { XtransConnInfo newciptr; /* * Our socket is an IPv6 socket, but the address is * IPv4. Close it and get an IPv4 socket. This is * needed for IPv4 connections to work on platforms * that don't allow IPv4 over IPv6 sockets. */ TRANS(SocketINETClose)(ciptr); newciptr = TRANS(SocketOpenCOTSClientBase)( "tcp", "tcp", host, port, ciptr->index); if (newciptr) ciptr->fd = newciptr->fd; if (!newciptr || Sockettrans2devtab[newciptr->index].family != AF_INET) { socketaddr = NULL; prmsg (4,"SocketINETConnect() Cannot get IPv4 " " socketfor IPv4 address\n"); } if (newciptr) free(newciptr); } else { socketaddr = NULL; prmsg (4,"SocketINETConnect Skipping IPv4 address\n"); } } } else if (addrlist->addr->ai_family == AF_INET6) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) socketaddr; prmsg (4,"SocketINETConnect() sockname.sin6_addr = %s\n", inet_ntop(addrlist->addr->ai_family, &sin6->sin6_addr,ntopbuf,sizeof(ntopbuf))); prmsg (4,"SocketINETConnect() sockname.sin6_port = %d\n", ntohs(sin6->sin6_port)); if (Sockettrans2devtab[ciptr->index].family == AF_INET) { if (strcmp(Sockettrans2devtab[ciptr->index].transname, "tcp") == 0) { XtransConnInfo newciptr; /* * Close the IPv4 socket and try to open an IPv6 socket. */ TRANS(SocketINETClose)(ciptr); newciptr = TRANS(SocketOpenCOTSClientBase)( "tcp", "tcp", host, port, -1); if (newciptr) ciptr->fd = newciptr->fd; if (!newciptr || Sockettrans2devtab[newciptr->index].family != AF_INET6) { socketaddr = NULL; prmsg (4,"SocketINETConnect() Cannot get IPv6 " "socket for IPv6 address\n"); } if (newciptr) free(newciptr); } else { socketaddr = NULL; prmsg (4,"SocketINETConnect() Skipping IPv6 address\n"); } } } else { socketaddr = NULL; /* Unsupported address type */ } if (socketaddr == NULL) { addrlist->addr = addrlist->addr->ai_next; } } } #else { /* * Build the socket name. */ #ifdef BSD44SOCKETS sockname.sin_len = sizeof (struct sockaddr_in); #endif sockname.sin_family = AF_INET; /* * fill in sin_addr */ #ifndef INADDR_NONE #define INADDR_NONE ((in_addr_t) 0xffffffff) #endif /* check for ww.xx.yy.zz host string */ if (isascii (host[0]) && isdigit (host[0])) { tmpaddr = inet_addr (host); /* returns network byte order */ } else { tmpaddr = INADDR_NONE; } prmsg (4,"SocketINETConnect() inet_addr(%s) = %x\n", host, tmpaddr); if (tmpaddr == INADDR_NONE) { if ((hostp = _XGethostbyname(host,hparams)) == NULL) { prmsg (1,"SocketINETConnect: Can't get address for %s\n", host); ESET(EINVAL); return TRANS_CONNECT_FAILED; } if (hostp->h_addrtype != AF_INET) { /* is IP host? */ prmsg (1,"SocketINETConnect: not INET host%s\n", host); ESET(EPROTOTYPE); return TRANS_CONNECT_FAILED; } memcpy ((char *) &sockname.sin_addr, (char *) hostp->h_addr, sizeof (sockname.sin_addr)); } else { sockname.sin_addr.s_addr = tmpaddr; } /* * fill in sin_port */ /* Check for number in the port string */ if (!is_numeric (port)) { if ((servp = _XGetservbyname (port,"tcp",sparams)) == NULL) { prmsg (1,"SocketINETConnect: can't get service for %s\n", port); return TRANS_CONNECT_FAILED; } sockname.sin_port = htons (servp->s_port); } else { long tmpport = strtol (port, (char**)NULL, 10); if (tmpport < 1024 || tmpport > USHRT_MAX) return TRANS_CONNECT_FAILED; sockname.sin_port = htons (((unsigned short) tmpport)); } prmsg (4,"SocketINETConnect: sockname.sin_port = %d\n", ntohs(sockname.sin_port)); socketaddr = (struct sockaddr *) &sockname; socketaddrlen = sizeof(sockname); } #endif /* * Turn on socket keepalive so the client process will eventually * be notified with a SIGPIPE signal if the display server fails * to respond to a periodic transmission of messages * on the connected socket. * This is useful to avoid hung application processes when the * processes are not spawned from the xdm session and * the display server terminates abnormally. * (Someone turned off the power switch.) */ { int tmp = 1; setsockopt (ciptr->fd, SOL_SOCKET, SO_KEEPALIVE, (char *) &tmp, sizeof (int)); } /* * Do the connect() */ if (connect (ciptr->fd, socketaddr, socketaddrlen ) < 0) { #ifdef WIN32 int olderrno = WSAGetLastError(); #else int olderrno = errno; #endif /* * If the error was ECONNREFUSED, the server may be overloaded * and we should try again. * * If the error was EWOULDBLOCK or EINPROGRESS then the socket * was non-blocking and we should poll using select * * If the error was EINTR, the connect was interrupted and we * should try again. * * If multiple addresses are found for a host then we should * try to connect again with a different address for a larger * number of errors that made us quit before, since those * could be caused by trying to use an IPv6 address to contact * a machine with an IPv4-only server or other reasons that * only affect one of a set of addresses. */ if (olderrno == ECONNREFUSED || olderrno == EINTR #if defined(IPv6) && defined(AF_INET6) || (((addrlist->addr->ai_next != NULL) || (addrlist->addr != addrlist->firstaddr)) && (olderrno == ENETUNREACH || olderrno == EAFNOSUPPORT || olderrno == EADDRNOTAVAIL || olderrno == ETIMEDOUT #if defined(EHOSTDOWN) || olderrno == EHOSTDOWN #endif )) #endif ) res = TRANS_TRY_CONNECT_AGAIN; else if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS) res = TRANS_IN_PROGRESS; else { prmsg (2,"SocketINETConnect: Can't connect: errno = %d\n", olderrno); res = TRANS_CONNECT_FAILED; } } else { res = 0; /* * Sync up the address fields of ciptr. */ if (TRANS(SocketINETGetAddr) (ciptr) < 0) { prmsg (1, "SocketINETConnect: ...SocketINETGetAddr() failed:\n"); res = TRANS_CONNECT_FAILED; } else if (TRANS(SocketINETGetPeerAddr) (ciptr) < 0) { prmsg (1, "SocketINETConnect: ...SocketINETGetPeerAddr() failed:\n"); res = TRANS_CONNECT_FAILED; } } #if defined(IPv6) && defined(AF_INET6) if (res != 0) { addrlist->addr = addrlist->addr->ai_next; } #endif return res; } #endif /* TCPCONN */ #ifdef UNIXCONN /* * Make sure 'host' is really local. */ static int UnixHostReallyLocal (const char *host) { char hostnamebuf[256]; TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf)); if (strcmp (hostnamebuf, host) == 0) { return (1); } else { #if defined(IPv6) && defined(AF_INET6) struct addrinfo *localhostaddr; struct addrinfo *otherhostaddr; struct addrinfo *i, *j; int equiv = 0; if (getaddrinfo(hostnamebuf, NULL, NULL, &localhostaddr) != 0) return 0; if (getaddrinfo(host, NULL, NULL, &otherhostaddr) != 0) { freeaddrinfo(localhostaddr); return 0; } for (i = localhostaddr; i != NULL && equiv == 0; i = i->ai_next) { for (j = otherhostaddr; j != NULL && equiv == 0; j = j->ai_next) { if (i->ai_family == j->ai_family) { if (i->ai_family == AF_INET) { struct sockaddr_in *sinA = (struct sockaddr_in *) i->ai_addr; struct sockaddr_in *sinB = (struct sockaddr_in *) j->ai_addr; struct in_addr *A = &sinA->sin_addr; struct in_addr *B = &sinB->sin_addr; if (memcmp(A,B,sizeof(struct in_addr)) == 0) { equiv = 1; } } else if (i->ai_family == AF_INET6) { struct sockaddr_in6 *sinA = (struct sockaddr_in6 *) i->ai_addr; struct sockaddr_in6 *sinB = (struct sockaddr_in6 *) j->ai_addr; struct in6_addr *A = &sinA->sin6_addr; struct in6_addr *B = &sinB->sin6_addr; if (memcmp(A,B,sizeof(struct in6_addr)) == 0) { equiv = 1; } } } } } freeaddrinfo(localhostaddr); freeaddrinfo(otherhostaddr); return equiv; #else /* * A host may have more than one network address. If any of the * network addresses of 'host' (specified to the connect call) * match any of the network addresses of 'hostname' (determined * by TRANS(GetHostname)), then the two hostnames are equivalent, * and we know that 'host' is really a local host. */ char specified_local_addr_list[10][4]; int scount, equiv, i, j; #ifdef XTHREADS_NEEDS_BYNAMEPARAMS _Xgethostbynameparams hparams; #endif struct hostent *hostp; if ((hostp = _XGethostbyname (host,hparams)) == NULL) return (0); scount = 0; while (hostp->h_addr_list[scount] && scount <= 8) { /* * The 2nd call to gethostname() overrides the data * from the 1st call, so we must save the address list. */ specified_local_addr_list[scount][0] = hostp->h_addr_list[scount][0]; specified_local_addr_list[scount][1] = hostp->h_addr_list[scount][1]; specified_local_addr_list[scount][2] = hostp->h_addr_list[scount][2]; specified_local_addr_list[scount][3] = hostp->h_addr_list[scount][3]; scount++; } if ((hostp = _XGethostbyname (hostnamebuf,hparams)) == NULL) return (0); equiv = 0; i = 0; while (i < scount && !equiv) { j = 0; while (hostp->h_addr_list[j]) { if ((specified_local_addr_list[i][0] == hostp->h_addr_list[j][0]) && (specified_local_addr_list[i][1] == hostp->h_addr_list[j][1]) && (specified_local_addr_list[i][2] == hostp->h_addr_list[j][2]) && (specified_local_addr_list[i][3] == hostp->h_addr_list[j][3])) { /* They're equal, so we're done */ equiv = 1; break; } j++; } i++; } return (equiv); #endif } } static int TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, const char *host, const char *port) { struct sockaddr_un sockname; SOCKLEN_T namelen; int abstract = 0; #ifdef HAVE_ABSTRACT_SOCKETS abstract = ciptr->transptr->flags & TRANS_ABSTRACT; #endif prmsg (2,"SocketUNIXConnect(%d,%s,%s)\n", ciptr->fd, host, port); /* * Make sure 'host' is really local. If not, we return failure. * The reason we make this check is because a process may advertise * a "local" network ID for which it can accept connections, but if * a process on a remote machine tries to connect to this network ID, * we know for sure it will fail. */ #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) if (host && *host && host[0]!='/' && strcmp(host, "unix") != 0 && strcasecmp(host, "nx") != 0 && strncasecmp(host, "nx,", 3) != 0 && !UnixHostReallyLocal (host)) #else if (host && *host && host[0]!='/' && strcmp (host, "unix") != 0 && !UnixHostReallyLocal (host)) #endif { prmsg (1, "SocketUNIXConnect: Cannot connect to non-local host %s\n", host); return TRANS_CONNECT_FAILED; } /* * Check the port. */ if (!port || !*port) { prmsg (1,"SocketUNIXConnect: Missing port specification\n"); return TRANS_CONNECT_FAILED; } /* * Build the socket name. */ sockname.sun_family = AF_UNIX; if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) { prmsg (1, "SocketUNIXConnect: path too long\n"); return TRANS_CONNECT_FAILED; } #if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) sockname.sun_len = strlen (sockname.sun_path); #endif #if defined(BSD44SOCKETS) || defined(SUN_LEN) namelen = SUN_LEN (&sockname); #else namelen = strlen (sockname.sun_path) + offsetof(struct sockaddr_un, sun_path); #endif #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) if (ciptr->priv != NULL) { if (TRANS(SocketConnectConnInfo) (ciptr, host, port) != 0) { return TRANS_CONNECT_FAILED; } goto SocketUNIXConnectPost; } #endif /* * Adjust the socket path if using abstract sockets. * Done here because otherwise all the strlen() calls above would fail. */ if (abstract) { sockname.sun_path[0] = '\0'; } /* * Do the connect() */ if (connect (ciptr->fd, (struct sockaddr *) &sockname, namelen) < 0) { int olderrno = errno; int connected = 0; if (!connected) { errno = olderrno; /* * If the error was ENOENT, the server may be starting up; we used * to suggest to try again in this case with * TRANS_TRY_CONNECT_AGAIN, but this introduced problems for * processes still referencing stale sockets in their environment. * Hence, we now return a hard error, TRANS_CONNECT_FAILED, and it * is suggested that higher level stacks handle retries on their * level when they face a slow starting server. * * If the error was EWOULDBLOCK or EINPROGRESS then the socket * was non-blocking and we should poll using select * * If the error was EINTR, the connect was interrupted and we * should try again. */ if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS) return TRANS_IN_PROGRESS; else if (olderrno == EINTR) return TRANS_TRY_CONNECT_AGAIN; else if (olderrno == ENOENT || olderrno == ECONNREFUSED) { /* If opening as abstract socket failed, try again normally */ if (abstract) { ciptr->transptr->flags &= ~(TRANS_ABSTRACT); return TRANS_TRY_CONNECT_AGAIN; } else { return TRANS_CONNECT_FAILED; } } else { prmsg (2,"SocketUNIXConnect: Can't connect: errno = %d\n", EGET()); return TRANS_CONNECT_FAILED; } } } #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) SocketUNIXConnectPost: #endif /* * Get the socket name and the peer name from the connect socket, * since this is unix domain. */ if ((ciptr->addr = malloc(namelen)) == NULL || (ciptr->peeraddr = malloc(namelen)) == NULL) { prmsg (1, "SocketUNIXCreateListener: Can't allocate space for the addr\n"); return TRANS_CONNECT_FAILED; } if (abstract) sockname.sun_path[0] = '@'; ciptr->family = AF_UNIX; ciptr->addrlen = namelen; ciptr->peeraddrlen = namelen; memcpy (ciptr->addr, &sockname, ciptr->addrlen); memcpy (ciptr->peeraddr, &sockname, ciptr->peeraddrlen); return 0; } #endif /* UNIXCONN */ #endif /* TRANS_CLIENT */ static int TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend) { prmsg (2,"SocketBytesReadable(%p,%d,%p)\n", (void *) ciptr, ciptr->fd, (void *) pend); #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) if (ciptr->priv) { if (NXTransRunning(ciptr->fd) == 0) { /* * Force the application to shut down the * socket if the NX transport is gone. We * may probably save this additional call. */ #ifdef NX_TRANS_DEBUG fprintf(stderr, "SocketBytesReadable: NX transport not running for descriptor [%d].\n", ciptr->fd); #endif ESET(EPIPE); return -1; } else { /* * Emulate BytesReadable. Some X applications may use the system * select() in their main loop, instead of the _XSelect() that is * replaced by NX. Still these applications use _XEventsQueued to * poll events from the X connection, and _XEventsQueued uses the * NX _XSelect(), so it is generally possible to let the client * yield the control to NX and let it handle the I/O on the proxy * descriptors even if the application is not explicitly designed * to work as a NX agent. */ #ifdef NX_TRANS_DEBUG int result; result = NXTransReadable(ciptr->fd, (int *) pend); fprintf(stderr, "SocketBytesReadable: Descriptor [%d] result [%d] readable [%ld].\n", ciptr->fd, result, *pend); return result; #else return NXTransReadable(ciptr->fd, (int *) pend); #endif } } #endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ #ifdef WIN32 { int ret = ioctlsocket ((SOCKET) ciptr->fd, FIONREAD, (u_long *) pend); if (ret == SOCKET_ERROR) errno = WSAGetLastError(); return ret; } #else return ioctl (ciptr->fd, FIONREAD, (char *) pend); #endif /* WIN32 */ } #if XTRANS_SEND_FDS static void appendFd(struct _XtransConnFd **prev, int fd, int do_close) { struct _XtransConnFd *cf, *new; new = malloc (sizeof (struct _XtransConnFd)); if (!new) { /* XXX mark connection as broken */ close(fd); return; } new->next = 0; new->fd = fd; new->do_close = do_close; /* search to end of list */ for (; (cf = *prev); prev = &(cf->next)); *prev = new; } static int removeFd(struct _XtransConnFd **prev) { struct _XtransConnFd *cf; int fd; if ((cf = *prev)) { *prev = cf->next; fd = cf->fd; free(cf); } else fd = -1; return fd; } static void discardFd(struct _XtransConnFd **prev, struct _XtransConnFd *upto, int do_close) { struct _XtransConnFd *cf, *next; for (cf = *prev; cf != upto; cf = next) { next = cf->next; if (do_close || cf->do_close) close(cf->fd); free(cf); } *prev = upto; } static void cleanupFds(XtransConnInfo ciptr) { /* Clean up the send list but don't close the fds */ discardFd(&ciptr->send_fds, NULL, 0); /* Clean up the recv list and *do* close the fds */ discardFd(&ciptr->recv_fds, NULL, 1); } static int nFd(struct _XtransConnFd **prev) { struct _XtransConnFd *cf; int n = 0; for (cf = *prev; cf; cf = cf->next) n++; return n; } static int TRANS(SocketRecvFd) (XtransConnInfo ciptr) { prmsg (2, "SocketRecvFd(%d)\n", ciptr->fd); return removeFd(&ciptr->recv_fds); } static int TRANS(SocketSendFd) (XtransConnInfo ciptr, int fd, int do_close) { appendFd(&ciptr->send_fds, fd, do_close); return 0; } static int TRANS(SocketRecvFdInvalid)(XtransConnInfo ciptr) { errno = EINVAL; return -1; } static int TRANS(SocketSendFdInvalid)(XtransConnInfo ciptr, int fd, int do_close) { errno = EINVAL; return -1; } #define MAX_FDS 128 union fd_pass { struct cmsghdr cmsghdr; char buf[CMSG_SPACE(MAX_FDS * sizeof(int))]; }; #endif /* XTRANS_SEND_FDS */ static int TRANS(SocketRead) (XtransConnInfo ciptr, char *buf, int size) { prmsg (2,"SocketRead(%d,%p,%d)\n", ciptr->fd, (void *) buf, size); #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) /* * If we have a valid priv pointer then this * is an internal connection to the proxy. * In this case we should emulate the read. */ if (ciptr->priv) { int result; result = NXTransRead(ciptr->fd, buf, size); #ifdef NX_TRANS_DEBUG if (result < 0 && EGET() == EAGAIN) { fprintf(stderr, "SocketRead: Read from descriptor [%d] would block.\n", ciptr->fd); } else { fprintf(stderr, "SocketRead: Read [%d] bytes from descriptor [%d].\n", result, ciptr->fd); } #endif return result; } else { /* FIXME: same code as below, should be possible without duplication */ #if XTRANS_SEND_FDS struct iovec iov = { .iov_base = buf, .iov_len = size }; union fd_pass cmsgbuf; struct msghdr msg = { .msg_name = NULL, .msg_namelen = 0, .msg_iov = &iov, .msg_iovlen = 1, .msg_control = cmsgbuf.buf, .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int)) }; size = recvmsg(ciptr->fd, &msg, 0); if (size >= 0) { struct cmsghdr *hdr; for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); int i; int *fd = (int *) CMSG_DATA(hdr); for (i = 0; i < nfd; i++) appendFd(&ciptr->recv_fds, fd[i], 0); } } } return size; #else return read (ciptr->fd, buf, size); #endif /* XTRANS_SEND_FDS */ } #else /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ #if defined(WIN32) { int ret = recv ((SOCKET)ciptr->fd, buf, size, 0); #ifdef WIN32 if (ret == SOCKET_ERROR) errno = WSAGetLastError(); #endif return ret; } #else #if XTRANS_SEND_FDS { struct iovec iov = { .iov_base = buf, .iov_len = size }; union fd_pass cmsgbuf; struct msghdr msg = { .msg_name = NULL, .msg_namelen = 0, .msg_iov = &iov, .msg_iovlen = 1, .msg_control = cmsgbuf.buf, .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int)) }; size = recvmsg(ciptr->fd, &msg, 0); if (size >= 0) { struct cmsghdr *hdr; for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); int i; int *fd = (int *) CMSG_DATA(hdr); for (i = 0; i < nfd; i++) appendFd(&ciptr->recv_fds, fd[i], 0); } } } return size; } #else return read (ciptr->fd, buf, size); #endif /* XTRANS_SEND_FDS */ #endif /* WIN32 */ #endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ } static int TRANS(SocketReadv) (XtransConnInfo ciptr, struct iovec *buf, int size) { prmsg (2,"SocketReadv(%d,%p,%d)\n", ciptr->fd, (void *) buf, size); #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) /* * If we have a valid priv pointer then this * is an internal connection to the proxy. * In this case we should emulate the readv. */ if (ciptr->priv) { return NXTransReadVector(ciptr->fd, buf, size); } else { /* FIXME: same code as below, should be possible without duplication */ #if XTRANS_SEND_FDS union fd_pass cmsgbuf; struct msghdr msg = { .msg_name = NULL, .msg_namelen = 0, .msg_iov = buf, .msg_iovlen = size, .msg_control = cmsgbuf.buf, .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int)) }; size = recvmsg(ciptr->fd, &msg, 0); if (size >= 0) { struct cmsghdr *hdr; for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); int i; int *fd = (int *) CMSG_DATA(hdr); for (i = 0; i < nfd; i++) appendFd(&ciptr->recv_fds, fd[i], 0); } } } return size; #else return READV (ciptr, buf, size); #endif } #else /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ #if XTRANS_SEND_FDS { union fd_pass cmsgbuf; struct msghdr msg = { .msg_name = NULL, .msg_namelen = 0, .msg_iov = buf, .msg_iovlen = size, .msg_control = cmsgbuf.buf, .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int)) }; size = recvmsg(ciptr->fd, &msg, 0); if (size >= 0) { struct cmsghdr *hdr; for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); int i; int *fd = (int *) CMSG_DATA(hdr); for (i = 0; i < nfd; i++) appendFd(&ciptr->recv_fds, fd[i], 0); } } } return size; } #else return READV (ciptr, buf, size); #endif #endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ } static int TRANS(SocketWritev) (XtransConnInfo ciptr, struct iovec *buf, int size) { prmsg (2,"SocketWritev(%d,%p,%d)\n", ciptr->fd, (void *) buf, size); #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) /* * If we have a valid priv pointer then this * is an internal connection to the proxy. * In this case we should emulate the writev. */ if (ciptr->priv) { return NXTransWriteVector(ciptr->fd, buf, size); } #endif #if XTRANS_SEND_FDS if (ciptr->send_fds) { union fd_pass cmsgbuf; int nfd = nFd(&ciptr->send_fds); struct _XtransConnFd *cf = ciptr->send_fds; struct msghdr msg = { .msg_name = NULL, .msg_namelen = 0, .msg_iov = buf, .msg_iovlen = size, .msg_control = cmsgbuf.buf, .msg_controllen = CMSG_LEN(nfd * sizeof(int)) }; struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); int i; int *fds; hdr->cmsg_len = msg.msg_controllen; hdr->cmsg_level = SOL_SOCKET; hdr->cmsg_type = SCM_RIGHTS; fds = (int *) CMSG_DATA(hdr); /* Set up fds */ for (i = 0; i < nfd; i++) { fds[i] = cf->fd; cf = cf->next; } i = sendmsg(ciptr->fd, &msg, 0); if (i > 0) discardFd(&ciptr->send_fds, cf, 0); return i; } #endif return WRITEV (ciptr, buf, size); } static int TRANS(SocketWrite) (XtransConnInfo ciptr, char *buf, int size) { prmsg (2,"SocketWrite(%d,%p,%d)\n", ciptr->fd, (void *) buf, size); #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) /* * If we have a valid priv pointer then this * is an internal connection to the proxy. * In this case we should emulate the write. */ if (ciptr->priv) { int result; result = NXTransWrite(ciptr->fd, buf, size); #ifdef NX_TRANS_DEBUG if (result < 0 && EGET() == EAGAIN) { fprintf(stderr, "SocketWrite: Write on descriptor [%d] would block.\n", ciptr->fd); } else { fprintf(stderr, "SocketWrite: Written [%d] bytes on descriptor [%d].\n", result, ciptr->fd); } #endif return result; } else { /* FIXME: same code as below, should be possible without duplication */ #if XTRANS_SEND_FDS if (ciptr->send_fds) { struct iovec iov; iov.iov_base = buf; iov.iov_len = size; return TRANS(SocketWritev)(ciptr, &iov, 1); } #endif /* XTRANS_SEND_FDS */ return write (ciptr->fd, buf, size); } #else /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ #if defined(WIN32) { int ret = send ((SOCKET)ciptr->fd, buf, size, 0); #ifdef WIN32 if (ret == SOCKET_ERROR) errno = WSAGetLastError(); #endif return ret; } #else #if XTRANS_SEND_FDS if (ciptr->send_fds) { struct iovec iov; iov.iov_base = buf; iov.iov_len = size; return TRANS(SocketWritev)(ciptr, &iov, 1); } #endif /* XTRANS_SEND_FDS */ return write (ciptr->fd, buf, size); #endif /* WIN32 */ #endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ } static int TRANS(SocketDisconnect) (XtransConnInfo ciptr) { prmsg (2,"SocketDisconnect(%p,%d)\n", (void *) ciptr, ciptr->fd); #ifdef WIN32 { int ret = shutdown (ciptr->fd, 2); if (ret == SOCKET_ERROR) errno = WSAGetLastError(); return ret; } #else return shutdown (ciptr->fd, 2); /* disallow further sends and receives */ #endif } #ifdef TCPCONN static int TRANS(SocketINETClose) (XtransConnInfo ciptr) { prmsg (2,"SocketINETClose(%p,%d)\n", (void *) ciptr, ciptr->fd); #ifdef WIN32 { int ret = close (ciptr->fd); if (ret == SOCKET_ERROR) errno = WSAGetLastError(); return ret; } #else return close (ciptr->fd); #endif } #endif /* TCPCONN */ #ifdef UNIXCONN static int TRANS(SocketUNIXClose) (XtransConnInfo ciptr) { /* * If this is the server side, then once the socket is closed, * it must be unlinked to completely close it */ struct sockaddr_un *sockname = (struct sockaddr_un *) ciptr->addr; int ret; prmsg (2,"SocketUNIXClose(%p,%d)\n", (void *) ciptr, ciptr->fd); #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) if (ciptr->priv) { TRANS(SocketCloseConnInfo) (ciptr); } #endif #if XTRANS_SEND_FDS cleanupFds(ciptr); #endif ret = close(ciptr->fd); #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "SocketUNIXClose: Flags are [%d] for ciptr at [%p] check is [%d].\n", ciptr->flags, (void *) ciptr, (ciptr->flags && sockname && sockname->sun_family == AF_UNIX && sockname->sun_path[0])); #endif if (ciptr->flags && sockname && sockname->sun_family == AF_UNIX && sockname->sun_path[0]) { #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) if (!(ciptr->flags & TRANS_NOUNLINK || ciptr->transptr->flags & TRANS_ABSTRACT)) { fprintf(stderr, "SocketUNIXClose: Unlinking path [%s] for ciptr at [%p].\n", sockname->sun_path, (void *) ciptr); unlink (sockname->sun_path); } #else if (!(ciptr->flags & TRANS_NOUNLINK || ciptr->transptr->flags & TRANS_ABSTRACT)) unlink (sockname->sun_path); #endif } return ret; } static int TRANS(SocketUNIXCloseForCloning) (XtransConnInfo ciptr) { /* * Don't unlink path. */ int ret; prmsg (2,"SocketUNIXCloseForCloning(%p,%d)\n", (void *) ciptr, ciptr->fd); #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) if (ciptr->priv) { TRANS(SocketCloseConnInfo) (ciptr); } #endif #if XTRANS_SEND_FDS cleanupFds(ciptr); #endif ret = close(ciptr->fd); return ret; } #endif /* UNIXCONN */ #ifdef TCPCONN # ifdef TRANS_SERVER static const char* tcp_nolisten[] = { "inet", #if defined(IPv6) && defined(AF_INET6) "inet6", #endif NULL }; # endif Xtransport TRANS(SocketTCPFuncs) = { /* Socket Interface */ "tcp", TRANS_ALIAS, #ifdef TRANS_CLIENT TRANS(SocketOpenCOTSClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER tcp_nolisten, TRANS(SocketOpenCOTSServer), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(SocketReopenCOTSServer), #endif TRANS(SocketSetOption), #ifdef TRANS_SERVER TRANS(SocketINETCreateListener), NULL, /* ResetListener */ TRANS(SocketINETAccept), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(SocketINETConnect), #endif /* TRANS_CLIENT */ TRANS(SocketBytesReadable), TRANS(SocketRead), TRANS(SocketWrite), TRANS(SocketReadv), TRANS(SocketWritev), #if XTRANS_SEND_FDS TRANS(SocketSendFdInvalid), TRANS(SocketRecvFdInvalid), #endif TRANS(SocketDisconnect), TRANS(SocketINETClose), TRANS(SocketINETClose), }; Xtransport TRANS(SocketINETFuncs) = { /* Socket Interface */ "inet", 0, #ifdef TRANS_CLIENT TRANS(SocketOpenCOTSClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER NULL, TRANS(SocketOpenCOTSServer), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(SocketReopenCOTSServer), #endif TRANS(SocketSetOption), #ifdef TRANS_SERVER TRANS(SocketINETCreateListener), NULL, /* ResetListener */ TRANS(SocketINETAccept), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(SocketINETConnect), #endif /* TRANS_CLIENT */ TRANS(SocketBytesReadable), TRANS(SocketRead), TRANS(SocketWrite), TRANS(SocketReadv), TRANS(SocketWritev), #if XTRANS_SEND_FDS TRANS(SocketSendFdInvalid), TRANS(SocketRecvFdInvalid), #endif TRANS(SocketDisconnect), TRANS(SocketINETClose), TRANS(SocketINETClose), }; #if defined(IPv6) && defined(AF_INET6) Xtransport TRANS(SocketINET6Funcs) = { /* Socket Interface */ "inet6", 0, #ifdef TRANS_CLIENT TRANS(SocketOpenCOTSClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER NULL, TRANS(SocketOpenCOTSServer), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(SocketReopenCOTSServer), #endif TRANS(SocketSetOption), #ifdef TRANS_SERVER TRANS(SocketINETCreateListener), NULL, /* ResetListener */ TRANS(SocketINETAccept), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(SocketINETConnect), #endif /* TRANS_CLIENT */ TRANS(SocketBytesReadable), TRANS(SocketRead), TRANS(SocketWrite), TRANS(SocketReadv), TRANS(SocketWritev), #if XTRANS_SEND_FDS TRANS(SocketSendFdInvalid), TRANS(SocketRecvFdInvalid), #endif TRANS(SocketDisconnect), TRANS(SocketINETClose), TRANS(SocketINETClose), }; #endif /* IPv6 */ #endif /* TCPCONN */ #ifdef UNIXCONN #if !defined(LOCALCONN) Xtransport TRANS(SocketLocalFuncs) = { /* Socket Interface */ "local", #ifdef HAVE_ABSTRACT_SOCKETS TRANS_ABSTRACT, #else 0, #endif #ifdef TRANS_CLIENT TRANS(SocketOpenCOTSClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER NULL, TRANS(SocketOpenCOTSServer), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(SocketReopenCOTSServer), #endif TRANS(SocketSetOption), #ifdef TRANS_SERVER TRANS(SocketUNIXCreateListener), TRANS(SocketUNIXResetListener), TRANS(SocketUNIXAccept), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(SocketUNIXConnect), #endif /* TRANS_CLIENT */ TRANS(SocketBytesReadable), TRANS(SocketRead), TRANS(SocketWrite), TRANS(SocketReadv), TRANS(SocketWritev), #if XTRANS_SEND_FDS TRANS(SocketSendFd), TRANS(SocketRecvFd), #endif TRANS(SocketDisconnect), TRANS(SocketUNIXClose), TRANS(SocketUNIXCloseForCloning), }; #endif /* !LOCALCONN */ # ifdef TRANS_SERVER # if !defined(LOCALCONN) static const char* unix_nolisten[] = { "local" , NULL }; # endif # endif Xtransport TRANS(SocketUNIXFuncs) = { /* Socket Interface */ "unix", #if !defined(LOCALCONN) && !defined(HAVE_ABSTRACT_SOCKETS) TRANS_ALIAS, #else 0, #endif #ifdef TRANS_CLIENT TRANS(SocketOpenCOTSClient), #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER #if !defined(LOCALCONN) unix_nolisten, #else NULL, #endif TRANS(SocketOpenCOTSServer), #endif /* TRANS_SERVER */ #ifdef TRANS_REOPEN TRANS(SocketReopenCOTSServer), #endif TRANS(SocketSetOption), #ifdef TRANS_SERVER TRANS(SocketUNIXCreateListener), TRANS(SocketUNIXResetListener), TRANS(SocketUNIXAccept), #endif /* TRANS_SERVER */ #ifdef TRANS_CLIENT TRANS(SocketUNIXConnect), #endif /* TRANS_CLIENT */ TRANS(SocketBytesReadable), TRANS(SocketRead), TRANS(SocketWrite), TRANS(SocketReadv), TRANS(SocketWritev), #if XTRANS_SEND_FDS TRANS(SocketSendFd), TRANS(SocketRecvFd), #endif TRANS(SocketDisconnect), TRANS(SocketUNIXClose), TRANS(SocketUNIXCloseForCloning), }; #endif /* UNIXCONN */ nx-libs-3.5.99.23/nx-X11/lib/include/xtrans/Xtransutil.c0000644000000000000000000003517413614532331017346 0ustar /* Copyright 1993, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name NCR not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. NCR makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * NCRS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * These are some utility functions created for convenience or to provide * an interface that is similar to an existing interface. These are built * only using the Transport Independant API, and have no knowledge of * the internal implementation. */ #ifdef XTHREADS #include #endif #ifdef WIN32 #include #include #endif #ifdef X11_t /* * These values come from X.h and Xauth.h, and MUST match them. Some * of these values are also defined by the ChangeHost protocol message. */ #define FamilyInternet 0 /* IPv4 */ #define FamilyDECnet 1 #define FamilyChaos 2 #define FamilyInternet6 6 #define FamilyAmoeba 33 #define FamilyLocalHost 252 #define FamilyKrb5Principal 253 #define FamilyNetname 254 #define FamilyLocal 256 #define FamilyWild 65535 /* * TRANS(ConvertAddress) converts a sockaddr based address to an * X authorization based address. Some of this is defined as part of * the ChangeHost protocol. The rest is just done in a consistent manner. */ int TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp) { prmsg(2,"ConvertAddress(%d,%d,%p)\n",*familyp,*addrlenp,(void *) *addrp); switch( *familyp ) { #if defined(TCPCONN) case AF_INET: { /* * Check for the BSD hack localhost address 127.0.0.1. * In this case, we are really FamilyLocal. */ struct sockaddr_in saddr; int len = sizeof(saddr.sin_addr.s_addr); char *cp = (char *) &saddr.sin_addr.s_addr; memcpy (&saddr, *addrp, sizeof (struct sockaddr_in)); if ((len == 4) && (cp[0] == 127) && (cp[1] == 0) && (cp[2] == 0) && (cp[3] == 1)) { *familyp=FamilyLocal; } else { *familyp=FamilyInternet; *addrlenp=len; memcpy(*addrp,&saddr.sin_addr,len); } break; } #if defined(IPv6) && defined(AF_INET6) case AF_INET6: { struct sockaddr_in6 saddr6; memcpy (&saddr6, *addrp, sizeof (struct sockaddr_in6)); if (IN6_IS_ADDR_LOOPBACK(&saddr6.sin6_addr)) { *familyp=FamilyLocal; } else if (IN6_IS_ADDR_V4MAPPED(&(saddr6.sin6_addr))) { char *cp = (char *) &saddr6.sin6_addr.s6_addr[12]; if ((cp[0] == 127) && (cp[1] == 0) && (cp[2] == 0) && (cp[3] == 1)) { *familyp=FamilyLocal; } else { *familyp=FamilyInternet; *addrlenp = sizeof (struct in_addr); memcpy(*addrp,cp,*addrlenp); } } else { *familyp=FamilyInternet6; *addrlenp=sizeof(saddr6.sin6_addr); memcpy(*addrp,&saddr6.sin6_addr,sizeof(saddr6.sin6_addr)); } break; } #endif /* IPv6 */ #endif /* defined(TCPCONN) */ #if defined(UNIXCONN) || defined(LOCALCONN) case AF_UNIX: { *familyp=FamilyLocal; break; } #endif /* defined(UNIXCONN) || defined(LOCALCONN) */ #if (defined(__SCO__) || defined(__UNIXWARE__)) && defined(LOCALCONN) case 0: { *familyp=FamilyLocal; break; } #endif default: prmsg(1,"ConvertAddress: Unknown family type %d\n", *familyp); return -1; } if (*familyp == FamilyLocal) { /* * In the case of a local connection, we need to get the * host name for authentication. */ char hostnamebuf[256]; int len = TRANS(GetHostname) (hostnamebuf, sizeof hostnamebuf); if (len > 0) { if (*addrp && *addrlenp < (len + 1)) { free (*addrp); *addrp = NULL; } if (!*addrp) *addrp = malloc (len + 1); if (*addrp) { strcpy ((char *) *addrp, hostnamebuf); *addrlenp = len; } else { *addrlenp = 0; } } else { if (*addrp) free (*addrp); *addrp = NULL; *addrlenp = 0; } } return 0; } #endif /* X11_t */ #ifdef ICE_t /* Needed for _XGethostbyaddr usage in TRANS(GetPeerNetworkId) */ # if defined(TCPCONN) || defined(UNIXCONN) # define X_INCLUDE_NETDB_H # define XOS_USE_NO_LOCKING # include # endif #include char * TRANS(GetMyNetworkId) (XtransConnInfo ciptr) { int family = ciptr->family; char *addr = ciptr->addr; char hostnamebuf[256]; char *networkId = NULL; const char *transName = ciptr->transptr->TransName; if (gethostname (hostnamebuf, sizeof (hostnamebuf)) < 0) { return (NULL); } switch (family) { #if defined(UNIXCONN) || defined(LOCALCONN) case AF_UNIX: { struct sockaddr_un *saddr = (struct sockaddr_un *) addr; networkId = malloc (3 + strlen (transName) + strlen (hostnamebuf) + strlen (saddr->sun_path)); sprintf (networkId, "%s/%s:%s", transName, hostnamebuf, saddr->sun_path); break; } #endif /* defined(UNIXCONN) || defined(LOCALCONN) */ #if defined(TCPCONN) case AF_INET: #if defined(IPv6) && defined(AF_INET6) case AF_INET6: #endif { struct sockaddr_in *saddr = (struct sockaddr_in *) addr; #if defined(IPv6) && defined(AF_INET6) struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) addr; #endif int portnum; char portnumbuf[10]; #if defined(IPv6) && defined(AF_INET6) if (family == AF_INET6) portnum = ntohs (saddr6->sin6_port); else #endif portnum = ntohs (saddr->sin_port); snprintf (portnumbuf, sizeof(portnumbuf), "%d", portnum); networkId = malloc (3 + strlen (transName) + strlen (hostnamebuf) + strlen (portnumbuf)); sprintf (networkId, "%s/%s:%s", transName, hostnamebuf, portnumbuf); break; } #endif /* defined(TCPCONN) */ default: break; } return (networkId); } #include static jmp_buf env; #ifdef SIGALRM static volatile int nameserver_timedout = 0; static void nameserver_lost(int sig _X_UNUSED) { nameserver_timedout = 1; longjmp (env, -1); /* NOTREACHED */ } #endif /* SIGALARM */ char * TRANS(GetPeerNetworkId) (XtransConnInfo ciptr) { int family = ciptr->family; char *peer_addr = ciptr->peeraddr; char *hostname; char addrbuf[256]; const char *addr = NULL; switch (family) { case AF_UNSPEC: #if defined(UNIXCONN) || defined(LOCALCONN) case AF_UNIX: { if (gethostname (addrbuf, sizeof (addrbuf)) == 0) addr = addrbuf; break; } #endif /* defined(UNIXCONN) || defined(LOCALCONN) */ #if defined(TCPCONN) case AF_INET: #if defined(IPv6) && defined(AF_INET6) case AF_INET6: #endif { struct sockaddr_in *saddr = (struct sockaddr_in *) peer_addr; #if defined(IPv6) && defined(AF_INET6) struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) peer_addr; #endif char *address; int addresslen; #ifdef XTHREADS_NEEDS_BYNAMEPARAMS _Xgethostbynameparams hparams; #endif struct hostent * volatile hostp = NULL; #if defined(IPv6) && defined(AF_INET6) if (family == AF_INET6) { address = (char *) &saddr6->sin6_addr; addresslen = sizeof (saddr6->sin6_addr); } else #endif { address = (char *) &saddr->sin_addr; addresslen = sizeof (saddr->sin_addr); } #ifdef SIGALRM /* * gethostbyaddr can take a LONG time if the host does not exist. * Assume that if it does not respond in NAMESERVER_TIMEOUT seconds * that something is wrong and do not make the user wait. * gethostbyaddr will continue after a signal, so we have to * jump out of it. */ nameserver_timedout = 0; signal (SIGALRM, nameserver_lost); alarm (4); if (setjmp(env) == 0) { #endif hostp = _XGethostbyaddr (address, addresslen, family, hparams); #ifdef SIGALRM } alarm (0); #endif if (hostp != NULL) addr = hostp->h_name; else #if defined(IPv6) && defined(AF_INET6) addr = inet_ntop (family, address, addrbuf, sizeof (addrbuf)); #else addr = inet_ntoa (saddr->sin_addr); #endif break; } #endif /* defined(TCPCONN) */ default: return (NULL); } hostname = malloc (strlen (ciptr->transptr->TransName) + strlen (addr) + 2); strcpy (hostname, ciptr->transptr->TransName); strcat (hostname, "/"); if (addr) strcat (hostname, addr); return (hostname); } #endif /* ICE_t */ #if defined(WIN32) && defined(TCPCONN) int TRANS(WSAStartup) (void) { static WSADATA wsadata; prmsg (2,"WSAStartup()\n"); if (!wsadata.wVersion && WSAStartup(MAKEWORD(2,2), &wsadata)) return 1; return 0; } #endif #include #if defined(X11_t) static int is_numeric (const char *str) { int i; for (i = 0; i < (int) strlen (str); i++) if (!isdigit (str[i])) return (0); return (1); } #endif #ifdef TRANS_SERVER #include #include #include #if !defined(S_IFLNK) && !defined(S_ISLNK) #undef lstat #define lstat(a,b) stat(a,b) #endif #define FAIL_IF_NOMODE 1 #define FAIL_IF_NOT_ROOT 2 #define WARN_NO_ACCESS 4 /* * We make the assumption that when the 'sticky' (t) bit is requested * it's not save if the directory has non-root ownership or the sticky * bit cannot be set and fail. */ static int trans_mkdir(const char *path, int mode) { struct stat buf; if (lstat(path, &buf) != 0) { if (errno != ENOENT) { prmsg(1, "mkdir: ERROR: (l)stat failed for %s (%d)\n", path, errno); return -1; } /* Dir doesn't exist. Try to create it */ #if !defined(WIN32) && !defined(__CYGWIN__) /* * 'sticky' bit requested: assume application makes * certain security implications. If effective user ID * is != 0: fail as we may not be able to meet them. */ if (geteuid() != 0) { if (mode & 01000) { prmsg(1, "mkdir: ERROR: euid != 0," "directory %s will not be created.\n", path); #ifdef FAIL_HARD return -1; #endif } else { prmsg(1, "mkdir: Cannot create %s with root ownership\n", path); } } #endif #ifndef WIN32 if (mkdir(path, mode) == 0) { if (chmod(path, mode)) { prmsg(1, "mkdir: ERROR: Mode of %s should be set to %04o\n", path, mode); #ifdef FAIL_HARD return -1; #endif } #else if (mkdir(path) == 0) { #endif } else { prmsg(1, "mkdir: ERROR: Cannot create %s\n", path); return -1; } return 0; } else { if (S_ISDIR(buf.st_mode)) { int updateOwner = 0; int updateMode = 0; int updatedOwner = 0; int updatedMode = 0; int status = 0; /* Check if the directory's ownership is OK. */ if (buf.st_uid != 0) updateOwner = 1; /* * Check if the directory's mode is OK. An exact match isn't * required, just a mode that isn't more permissive than the * one requested. */ if ((~mode) & 0077 & buf.st_mode) updateMode = 1; /* * If the directory is not writeable not everybody may * be able to create sockets. Therefore warn if mode * cannot be fixed. */ if ((~buf.st_mode) & 0022 & mode) { updateMode = 1; status |= WARN_NO_ACCESS; } /* * If 'sticky' bit is requested fail if owner isn't root * as we assume the caller makes certain security implications */ if (mode & 01000) { status |= FAIL_IF_NOT_ROOT; if (!(buf.st_mode & 01000)) { status |= FAIL_IF_NOMODE; updateMode = 1; } } #ifdef HAS_FCHOWN /* * If fchown(2) and fchmod(2) are available, try to correct the * directory's owner and mode. Otherwise it isn't safe to attempt * to do this. */ if (updateMode || updateOwner) { int fd = -1; struct stat fbuf; if ((fd = open(path, O_RDONLY)) != -1) { if (fstat(fd, &fbuf) == -1) { prmsg(1, "mkdir: ERROR: fstat failed for %s (%d)\n", path, errno); close(fd); return -1; } /* * Verify that we've opened the same directory as was * checked above. */ if (!S_ISDIR(fbuf.st_mode) || buf.st_dev != fbuf.st_dev || buf.st_ino != fbuf.st_ino) { prmsg(1, "mkdir: ERROR: inode for %s changed\n", path); close(fd); return -1; } if (updateOwner && fchown(fd, 0, 0) == 0) updatedOwner = 1; if (updateMode && fchmod(fd, mode) == 0) updatedMode = 1; close(fd); } } #endif if (updateOwner && !updatedOwner) { #ifdef FAIL_HARD if (status & FAIL_IF_NOT_ROOT) { prmsg(1, "mkdir: ERROR: Owner of %s must be set to root\n", path); return -1; } #endif #if !defined(__APPLE_CC__) && !defined(__CYGWIN__) prmsg(1, "mkdir: Owner of %s should be set to root\n", path); #endif } if (updateMode && !updatedMode) { #ifdef FAIL_HARD if (status & FAIL_IF_NOMODE) { prmsg(1, "mkdir: ERROR: Mode of %s must be set to %04o\n", path, mode); return -1; } #endif prmsg(1, "mkdir: Mode of %s should be set to %04o\n", path, mode); if (status & WARN_NO_ACCESS) { prmsg(1, "mkdir: this may cause subsequent errors\n"); } } return 0; } return -1; } /* In all other cases, fail */ return -1; } #endif /* TRANS_SERVER */ nx-libs-3.5.99.23/nx-X11/lib/m4/ax_define_dir.m40000644000000000000000000000325213614532331015415 0ustar # =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_define_dir.html # =========================================================================== # # SYNOPSIS # # AX_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION]) # # DESCRIPTION # # This macro sets VARNAME to the expansion of the DIR variable, taking # care of fixing up ${prefix} and such. # # VARNAME is then offered as both an output variable and a C preprocessor # symbol. # # Example: # # AX_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.]) # # LICENSE # # Copyright (c) 2008 Stepan Kasal # Copyright (c) 2008 Andreas Schwab # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2008 Alexandre Oliva # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 6 AU_ALIAS([AC_DEFINE_DIR], [AX_DEFINE_DIR]) AC_DEFUN([AX_DEFINE_DIR], [ prefix_NONE= exec_prefix_NONE= test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn dnl refers to ${prefix}. Thus we have to use `eval' twice. eval ax_define_dir="\"[$]$2\"" eval ax_define_dir="\"$ax_define_dir\"" AC_SUBST($1, "$ax_define_dir") AC_DEFINE_UNQUOTED($1, "$ax_define_dir", [$3]) test "$prefix_NONE" && prefix=NONE test "$exec_prefix_NONE" && exec_prefix=NONE ]) nx-libs-3.5.99.23/nx-X11/lib/m4/nx-macros.m40000644000000000000000000004165413614532424014557 0ustar dnl nx-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. dnl dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. dnl Copyright (c) 2017, Mike Gabriel dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the "Software"), dnl to deal in the Software without restriction, including without limitation dnl the rights to use, copy, modify, merge, publish, distribute, sublicense, dnl and/or sell copies of the Software, and to permit persons to whom the dnl Software is furnished to do so, subject to the following conditions: dnl dnl The above copyright notice and this permission notice (including the next dnl paragraph) shall be included in all copies or substantial portions of the dnl Software. dnl dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER dnl DEALINGS IN THE SOFTWARE. # NX_COMPILER_BRAND # ------------------- # Checks for various brands of compilers and sets flags as appropriate: # GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes" # GNU g++ - relies on AC_PROG_CXX to set GXX to "yes" # clang compiler - sets CLANGCC to "yes" # Intel compiler - sets INTELCC to "yes" # Sun/Oracle Solaris Studio cc - sets SUNCC to "yes" # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_COMPILER_BRAND], [ AC_LANG_CASE( [C], [ AC_REQUIRE([AC_PROG_CC_C99]) ], [C++], [ AC_REQUIRE([AC_PROG_CXX]) ] ) AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"]) AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) ]) # NX_COMPILER_BRAND # NX_TESTSET_CFLAG(, , [, ...]) # --------------- # Test if the compiler works when passed the given flag as a command line argument. # If it succeeds, the flag is appended to the given variable. If not, it tries the # next flag in the list until there are no more options. # # Note that this does not guarantee that the compiler supports the flag as some # compilers will simply ignore arguments that they do not understand, but we do # attempt to weed out false positives by using -Werror=unknown-warning-option and # -Werror=unused-command-line-argument # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_TESTSET_CFLAG], [ m4_if([$#], 0, [m4_fatal([NX_TESTSET_CFLAG was given with an unsupported number of arguments])]) m4_if([$#], 1, [m4_fatal([NX_TESTSET_CFLAG was given with an unsupported number of arguments])]) AC_LANG_COMPILER_REQUIRE AC_LANG_CASE( [C], [ AC_REQUIRE([AC_PROG_CC_C99]) define([PREFIX], [C]) define([CACHE_PREFIX], [cc]) define([COMPILER], [$CC]) ], [C++], [ define([PREFIX], [CXX]) define([CACHE_PREFIX], [cxx]) define([COMPILER], [$CXX]) ] ) [nx_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]" if test "x$[nx_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option], AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes], [nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no])) [nx_testset_]CACHE_PREFIX[_unknown_warning_option]=$[nx_cv_]CACHE_PREFIX[_flag_unknown_warning_option] PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" fi if test "x$[nx_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then if test "x$[nx_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" fi PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument], AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes], [nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no])) [nx_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[nx_cv_]CACHE_PREFIX[_flag_unused_command_line_argument] PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" fi found="no" m4_foreach([flag], m4_cdr($@), [ if test $found = "no" ; then if test "x$nx_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" fi if test "x$nx_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" fi PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag[" dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[]) cacheid=AS_TR_SH([nx_cv_]CACHE_PREFIX[_flag_]flag[]) AC_CACHE_VAL($cacheid, [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])], [eval $cacheid=yes], [eval $cacheid=no])]) PREFIX[FLAGS]="$[nx_testset_save_]PREFIX[FLAGS]" eval supported=\$$cacheid AC_MSG_RESULT([$supported]) if test "$supported" = "yes" ; then $1="$$1 ]flag[" found="yes" fi fi ]) ]) # NX_TESTSET_CFLAG # NX_COMPILER_FLAGS # --------------- # Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line # arguments supported by the selected compiler which do NOT alter the generated # code. These arguments will cause the compiler to print various warnings # during compilation AND turn a conservative set of warnings into errors. # # The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in # future versions of util-macros as options are added to new compilers. # # Derived from https://cgit.freedesktop.org/xorg/util/macros/ and adapted to # nxcomp{,shad}. AC_DEFUN([NX_COMPILER_FLAGS], [ AC_REQUIRE([NX_COMPILER_BRAND]) AC_ARG_ENABLE(selective-werror, AS_HELP_STRING([--disable-selective-werror], [Turn off selective compiler errors. (default: enabled)]), [SELECTIVE_WERROR=$enableval], [SELECTIVE_WERROR=yes]) AC_LANG_CASE( [C], [ define([PREFIX], [C]) ], [C++], [ define([PREFIX], [CXX]) ] ) # -v is too short to test reliably with NX_TESTSET_CFLAG if test "x$SUNCC" = "xyes"; then [BASE_]PREFIX[FLAGS]="-v" else [BASE_]PREFIX[FLAGS]="" fi # This chunk of warnings were those that existed in the legacy CWARNFLAGS NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat]) AC_LANG_CASE( [C], [ NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement]) ] ) # This chunk adds additional warnings that could catch undesired effects. NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) # These are currently disabled because they are noisy. They will be enabled # in the future once the codebase is sufficiently modernized to silence # them. For now, I don't want them to drown out the other warnings. # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) # NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) # Turn some warnings into errors, so we don't accidentally get successful builds # when there are problems that should be fixed. if test "x$SELECTIVE_WERROR" = "xyes" ; then NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION else AC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors. This should not be necessary. Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast]) NX_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast]) fi AC_SUBST([BASE_]PREFIX[FLAGS]) ]) # NX_COMPILER_FLAGS # NX_STRICT_OPTION # ----------------------- # # Add configure option to enable strict compilation flags, such as treating # warnings as fatal errors. # If --enable-strict-compilation is passed to configure, adds strict flags to # $BASE_CFLAGS or $BASE_CXXFLAGS. # # Also exports $STRICT_CFLAGS for use in other tests or when strict compilation # is unconditionally desired. AC_DEFUN([NX_STRICT_OPTION], [ AC_REQUIRE([NX_COMPILER_FLAGS]) AC_ARG_ENABLE(strict-compilation, AS_HELP_STRING([--enable-strict-compilation], [Enable all warnings from compiler and make them errors (default: disabled)]), [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) AC_LANG_CASE( [C], [ define([PREFIX], [C]) ], [C++], [ define([PREFIX], [CXX]) ] ) [STRICT_]PREFIX[FLAGS]="" NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic]) NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn]) # Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not # activate it with -Werror, so we add it here explicitly. NX_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes]) if test "x$STRICT_COMPILE" = "xyes"; then [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]" fi AC_SUBST([STRICT_]PREFIX[FLAGS]) AC_SUBST([BASE_]PREFIX[FLAGS]) ]) # NX_STRICT_OPTION # NX_DEFAULT_OPTIONS # -------------------- # # Defines default options for X.Org-like modules. # AC_DEFUN([NX_DEFAULT_OPTIONS], [ AC_REQUIRE([AC_PROG_INSTALL]) NX_COMPILER_FLAGS NX_STRICT_OPTION m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) ]) # NX_DEFAULT_OPTIONS # NX_CHECK_MALLOC_ZERO # ---------------------- # Minimum version: 1.0.0 # # Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if # malloc(0) returns NULL. Packages should add one of these cflags to # their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. AC_DEFUN([NX_CHECK_MALLOC_ZERO],[ AC_ARG_ENABLE(malloc0returnsnull, AS_HELP_STRING([--enable-malloc0returnsnull], [malloc(0) returns NULL (default: auto)]), [MALLOC_ZERO_RETURNS_NULL=$enableval], [MALLOC_ZERO_RETURNS_NULL=auto]) AC_MSG_CHECKING([whether malloc(0) returns NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then AC_RUN_IFELSE([AC_LANG_PROGRAM([ #include ],[ char *m0, *r0, *c0, *p; m0 = malloc(0); p = malloc(10); r0 = realloc(p,0); c0 = calloc(0,10); exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); ])], [MALLOC_ZERO_RETURNS_NULL=yes], [MALLOC_ZERO_RETURNS_NULL=no], [MALLOC_ZERO_RETURNS_NULL=yes]) fi AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL" XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC" else MALLOC_ZERO_CFLAGS="" XMALLOC_ZERO_CFLAGS="" XTMALLOC_ZERO_CFLAGS="" fi AC_SUBST([MALLOC_ZERO_CFLAGS]) AC_SUBST([XMALLOC_ZERO_CFLAGS]) AC_SUBST([XTMALLOC_ZERO_CFLAGS]) ]) # NX_CHECK_MALLOC_ZERO dnl Check to see if we're running under Cygwin32. AC_DEFUN([NX_BUILD_ON_CYGWIN32], [AC_CACHE_CHECK([for Cygwin32 environment], nxconf_cv_cygwin32, [AC_TRY_COMPILE(,[return __CYGWIN32__;], nxconf_cv_cygwin32=yes, nxconf_cv_cygwin32=no) rm -f conftest*]) CYGWIN32= test "$nxconf_cv_cygwin32" = yes && CYGWIN32=yes ]) # NX_BUILD_ON_CYGWIN32 dnl Check whether we're building on a AMD64. AC_DEFUN([NX_BUILD_ON_AMD64], [AC_CACHE_CHECK([for Amd64 environment], nxconf_cv_amd64, [AC_TRY_COMPILE(,[return (__amd64__ || __x86_64__);], nxconf_cv_amd64=yes, nxconf_cv_amd64=no) rm -f conftest*]) AMD64= test "$nxconf_cv_amd64" = yes && AMD64=yes ]) # NX_BUILD_ON_AMD64 dnl Check for Darwin environment. AC_DEFUN([NX_BUILD_ON_DARWIN], [AC_CACHE_CHECK([for Darwin environment], nxconf_cv_darwin, [AC_TRY_COMPILE(,[return __APPLE__;], nxconf_cv_darwin=yes, nxconf_cv_darwin=no) rm -f conftest*]) DARWIN= test "$nxconf_cv_darwin" = yes && DARWIN=yes ]) # NX_BUILD_ON_DARWIN # Check to see if we're running under Solaris. AC_DEFUN([NX_BUILD_ON_SUN], [AC_CACHE_CHECK([for Solaris environment], nxconf_cv_sun, [AC_TRY_COMPILE(,[return __sun;], nxconf_cv_sun=yes, nxconf_cv_sun=no) rm -f conftest*]) SUN= test "$nxconf_cv_sun" = yes && SUN=yes ]) # NX_BUILD_ON_SUN # Check to see if we're running under FreeBSD. AC_DEFUN([NX_BUILD_ON_FreeBSD], [AC_CACHE_CHECK([for FreeBSD environment], nxconf_cv_freebsd, [AC_TRY_COMPILE(,[return __FreeBSD__;], nxconf_cv_freebsd=yes, nxconf_cv_freebsd=no) rm -f conftest*]) FreeBSD= test "$nxconf_cv_freebsd" = yes && FreeBSD=yes ]) # NX_BUILD_ON_FreeBSD # Check to see if we're generating binaries in ELF format. AC_DEFUN([NX_TARGET_USE_ELF], [AC_CACHE_CHECK([if target system is ELF-based], [nxconf_cv_targetelf], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[ #ifndef __ELF__ #error not an ELF-based system error! #endif ]], [[ ]])], [nxconf_cv_targetelf=yes], [nxconf_cv_targetelf=no])]) AM_CONDITIONAL([TARGET_ELF], [test x"$nxconf_cv_targetelf" = "xyes"]) ]) # NX_TARGET_USE_ELF AC_DEFUN([LIBJPEG_FALLBACK_CHECK],[ AC_MSG_CHECKING([for libjpeg shared library file and headers]) AC_CHECK_LIB([jpeg], [jpeg_destroy_compress], [have_jpeg_lib=yes], [have_jpeg_lib=no]) AC_CHECK_HEADERS([jpeglib.h], [have_jpeg_headers=yes], [have_jpeg_headers=no]) if test x"$have_jpeg_lib" = "xyes" && test x"$have_jpeg_headers" = "xyes"; then AC_MSG_RESULT([yes]) JPEG_CFLAGS="" JPEG_LIBS="-ljpeg" else AC_MSG_RESULT([no]) AC_MSG_FAILURE([Could not find libjpeg on your system, make sure the JPEG shared library and header files are installed.]) fi ]) # LIBJPEG_FALLBACK_CHECK AC_DEFUN([ZLIB_FALLBACK_CHECK],[ AC_MSG_CHECKING([for zlib shared library file and headers]) AC_CHECK_LIB([z], [inflateEnd], [have_zlib_lib=yes], [have_zlib_lib=no]) AC_CHECK_HEADERS([zlib.h], [have_zlib_headers=yes], [have_zlib_headers=no]) if test x"$have_zlib_lib" = "xyes" && test x"$have_zlib_headers" = "xyes"; then AC_MSG_RESULT([yes]) Z_CFLAGS="" Z_LIBS="-lz" else AC_MSG_RESULT([no]) AC_MSG_FAILURE([Could not find zlib on your system, make sure the zlib shared library and header files are installed.]) fi ]) # ZLIB_FALLBACK_CHECK nx-libs-3.5.99.23/nx-X11/lib/m4/nx-xtrans.m40000644000000000000000000001454513614532424014611 0ustar dnl dnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the "Software"), dnl to deal in the Software without restriction, including without limitation dnl the rights to use, copy, modify, merge, publish, distribute, sublicense, dnl and/or sell copies of the Software, and to permit persons to whom the dnl Software is furnished to do so, subject to the following conditions: dnl dnl The above copyright notice and this permission notice (including the next dnl paragraph) shall be included in all copies or substantial portions of the dnl Software. dnl dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER dnl DEALINGS IN THE SOFTWARE. dnl # NX_XTRANS_TCP_FLAGS() # ------------------ # Find needed libraries for TCP sockets, and check for IPv6 support AC_DEFUN([NX_XTRANS_TCP_FLAGS],[ # SVR4 hides these in libraries other than libc AC_SEARCH_LIBS(socket, [socket]) AC_SEARCH_LIBS(gethostbyname, [nsl]) if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then AC_CHECK_LIB([ws2_32],[main]) fi # Needs to come after above checks for libsocket & libnsl for SVR4 systems AC_ARG_ENABLE(ipv6, AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]), [IPV6CONN=$enableval], [AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])]) AC_MSG_CHECKING([if IPv6 support should be built]) if test "$IPV6CONN" = "yes"; then AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections]) fi AC_MSG_RESULT($IPV6CONN) # 4.3BSD-Reno added a new member to struct sockaddr_in AC_CHECK_MEMBER([struct sockaddr_in.sin_len], AC_DEFINE([BSD44SOCKETS],1, [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [ #include #include #include ]) # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc. AC_CHECK_TYPES([socklen_t], [], [], [ AC_INCLUDES_DEFAULT #include ]) # XPG4v2/UNIX95 added msg_control - check to see if we need to define # _XOPEN_SOURCE to get it (such as on Solaris) AC_CHECK_MEMBER([struct msghdr.msg_control], [], [], [ AC_INCLUDES_DEFAULT #include ]) # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03 if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then unset ac_cv_member_struct_msghdr_msg_control AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600]) AC_CHECK_MEMBER([struct msghdr.msg_control], [AC_DEFINE([_XOPEN_SOURCE], [600], [Defined if needed to expose struct msghdr.msg_control]) ], [], [ #define _XOPEN_SOURCE 600 AC_INCLUDES_DEFAULT #include ]) fi # If that didn't work, fall back to XPG5/UNIX98 with C89 if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then unset ac_cv_member_struct_msghdr_msg_control AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500]) AC_CHECK_MEMBER([struct msghdr.msg_control], [AC_DEFINE([_XOPEN_SOURCE], [500], [Defined if needed to expose struct msghdr.msg_control]) ], [], [ #define _XOPEN_SOURCE 500 AC_INCLUDES_DEFAULT #include ]) fi ]) # NX_XTRANS_TCP_FLAGS # NX_XTRANS_CONNECTION_FLAGS() # ------------------------- # Standard checks for which Xtrans transports to use by the Xorg packages # that use Xtrans functions AC_DEFUN([NX_XTRANS_CONNECTION_FLAGS],[ AC_REQUIRE([AC_CANONICAL_HOST]) [case $host_os in mingw*) unixdef="no" ;; *) unixdef="yes" ;; esac] AC_ARG_ENABLE(unix-transport, AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]), [UNIXCONN=$enableval], [UNIXCONN=$unixdef]) AC_MSG_CHECKING([if Xtrans should support UNIX socket connections]) if test "$UNIXCONN" = "yes"; then AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections]) fi AC_MSG_RESULT($UNIXCONN) AC_ARG_ENABLE(tcp-transport, AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]), [TCPCONN=$enableval], [TCPCONN=yes]) AC_MSG_CHECKING([if Xtrans should support TCP socket connections]) AC_MSG_RESULT($TCPCONN) if test "$TCPCONN" = "yes"; then AC_DEFINE(TCPCONN,1,[Support TCP socket connections]) NX_XTRANS_TCP_FLAGS fi AC_ARG_ENABLE(nxcomp-transport, AS_HELP_STRING([--enable-nxcomp-transport],[Enable nxcomp mediated transport]), [NXCOMPCONN=$enableval], [NXCOMPCONN=yes]) AC_MSG_CHECKING([if Xtrans should support nxcomp mediated connections]) AC_MSG_RESULT($NXCOMPCONN) if test "$NXCOMPCONN" = "yes"; then AC_DEFINE(NX_TRANS_SOCKET,1,[Support nxcomp mediated socket connections]) AC_DEFINE(NX_TRANS_EXIT,1,[Support nxcomp NX_TRANS_EXIT feature]) NX_XTRANS_TCP_FLAGS fi ]) # NX_XTRANS_CONNECTION_FLAGS # NX_XTRANS_SECURE_RPC_FLAGS() # ------------------------- # Check for Secure RPC functions - must come after NX_XTRANS_TCP_FLAGS # so that any necessary networking libraries are already found AC_DEFUN([NX_XTRANS_SECURE_RPC_FLAGS], [AC_REQUIRE([NX_XTRANS_TCP_FLAGS]) AC_ARG_ENABLE(secure-rpc, AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]), [SECURE_RPC=$enableval], [SECURE_RPC="try"]) if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then FOUND_SECURE_RPC="no" AC_CHECK_FUNCS([authdes_seccreate authdes_create], [FOUND_SECURE_RPC="yes"]) if test "x$FOUND_SECURE_RPC" = "xno" ; then if test "x$SECURE_RPC" = "xyes" ; then AC_MSG_ERROR([Secure RPC requested, but required functions not found]) fi SECURE_RPC="no" else dnl FreeBSD keeps getsecretkey in librpcsvc AC_SEARCH_LIBS(getsecretkey, [rpcsvc]) SECURE_RPC="yes" fi fi AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported]) if test "x$SECURE_RPC" = "xyes" ; then AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients]) fi AC_MSG_RESULT($SECURE_RPC) ]) # NX_XTRANS_SECURE_RPC_FLAGS nx-libs-3.5.99.23/nx-X11/lib/Makefile.am0000644000000000000000000000220713614532331014106 0ustar NULL = SUBDIRS = modules src pkgconfig_DATA = nx-x11.pc ACLOCAL_AMFLAGS = -I m4 MAINTAINERCLEANFILES = \ $(srcdir)/autom4te.cache/* \ $(srcdir)/build-aux/* \ $(srcdir)/Makefile.in \ $(srcdir)/src/Makefile.in \ $(srcdir)/src/xkb/Makefile.in \ $(srcdir)/src/util/Makefile.in \ $(srcdir)/src/xcms/Makefile.in \ $(srcdir)/src/xlibi18n/Makefile.in \ $(srcdir)/modules/om/generic/Makefile.in \ $(srcdir)/modules/om/Makefile.in \ $(srcdir)/modules/Makefile.in \ $(srcdir)/modules/im/ximcp/Makefile.in \ $(srcdir)/modules/im/Makefile.in \ $(srcdir)/modules/lc/Makefile.in \ $(srcdir)/modules/lc/gen/Makefile.in \ $(srcdir)/modules/lc/def/Makefile.in \ $(srcdir)/modules/lc/Utf8/Makefile.in \ $(srcdir)/include/Makefile.in \ $(srcdir)/aclocal.m4 \ $(srcdir)/src/config.h.in \ $(srcdir)/src/config.h.in~ \ $(srcdir)/configure \ $(srcdir)/m4/libtool.m4 \ $(srcdir)/m4/lt~obsolete.m4 \ $(srcdir)/m4/ltoptions.m4 \ $(srcdir)/m4/ltsugar.m4 \ $(srcdir)/m4/ltversion.m4 \ $(NULL) DISTCLEANFILES=$(MAINTAINERCLEANFILES) nx-libs-3.5.99.23/nx-X11/lib/modules/im/Makefile.am0000644000000000000000000000002013614532331016152 0ustar SUBDIRS = ximcp nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imCallbk.c0000644000000000000000000004736113614532331017143 0ustar /*********************************************************************** Copyright 1993 by Digital Equipment Corporation, Maynard, Massachusetts, Copyright 1994 by FUJITSU LIMITED Copyright 1994 by Sony Corporation All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital, FUJITSU LIMITED and Sony Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL, FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL, FUJITSU LIMITED AND SONY CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Hiroyuki Miyamoto Digital Equipment Corporation miyamoto@jrd.dec.com Modifier: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp Makoto Wakamatsu Sony Corporation makoto@sm.sony.co.jp ***********************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" #include "XlcPubI.h" #define sz_CARD8 1 #define sz_INT8 1 #define sz_CARD16 2 #define sz_INT16 2 #define sz_BITMASK16 sz_CARD16 #define sz_CARD32 4 #define sz_INT32 4 #define sz_BITMASK32 sz_CARD32 #define sz_XIMID sizeof(XIMID) #define sz_XICID sizeof(XICID) #define sz_XIMATTRID sizeof(XIMATTRID) #define sz_XICATTRID sizeof(XICATTRID) #define sz_ximPacketHeader (XIM_HEADER_SIZE + sz_XIMID + sz_XICID) #define sz_ximGeometry 0 #define sz_ximStrConversion (sz_CARD32 + sz_CARD32 + sz_CARD32 + sz_CARD32) #define sz_ximPreeditStart 0 #define sz_ximPreeditStartReply sz_INT32 #define sz_ximPreeditCaret (sz_INT32 + sz_CARD32 + sz_CARD32) #define sz_ximPreeditCaretReply sz_CARD32 #define sz_ximPreeditDone 0 #define sz_ximStatusStart 0 #define sz_ximStatusDone 0 typedef enum { XimCbSuccess, XimCbNoCallback, XimCbError, XimCbQueued, XimCbBadContextID, XimCbBadOpcode } XimCbStatus; typedef XimCbStatus (*XimCb)( Xim, Xic, char*, int ); #define PACKET_TO_MAJOROPCODE(p) (*(CARD8*)((CARD8*)(p))) #define PACKET_TO_MINOROPCODE(p) (*(CARD8*)((CARD8*)(p) + sz_CARD8)) #define PACKET_TO_LENGTH(p) (*(CARD16*)((CARD8*)(p) + sz_CARD8 + sz_CARD8)) #define PACKET_TO_IMID(p) (*(XIMID*)((CARD8*)(p) + XIM_HEADER_SIZE)) #define PACKET_TO_ICID(p) (*(XICID*)((CARD8*)(p) + XIM_HEADER_SIZE + sz_XIMID)) #define _XimWriteData(im,len,data) \ (im->private.proto.write((im),(len),(XPointer)(data))) #define _XimReadData(im,buf,buf_len,len) \ (im->private.proto.read((im),(XPointer)(buf),(buf_len),&(len))) #define _XimFlushData(im) im->private.proto.flush((im)) static XimCbStatus _XimGeometryCallback(Xim, Xic, char*, int); static XimCbStatus _XimStrConversionCallback(Xim, Xic, char*, int); static XimCbStatus _XimPreeditStartCallback(Xim, Xic, char*, int); static XimCbStatus _XimPreeditDoneCallback(Xim, Xic, char*, int); static void _free_memory_for_text(XIMText*); static XimCbStatus _XimPreeditDrawCallback(Xim, Xic, char*, int); static XimCbStatus _XimPreeditCaretCallback(Xim, Xic, char*, int); static XimCbStatus _XimStatusStartCallback(Xim, Xic, char*, int); static XimCbStatus _XimStatusDoneCallback(Xim, Xic, char*, int); static XimCbStatus _XimStatusDrawCallback(Xim, Xic, char*, int); static XimCbStatus _XimPreeditStateNotifyCallback(Xim, Xic, char *, int); #if defined(__STDC__) && ((defined(sun) && defined(SVR4)) || defined(WIN32)) #define RConst /**/ #else #define RConst const #endif /* NOTE: * the table below depends on the protocol number * defined in the IM Protocol document. */ static RConst XimCb callback_table[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #000-009 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #010-019 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #020-029 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #030-039 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #040-049 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #050-059 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #060-069 */ _XimGeometryCallback, /* #070 */ _XimStrConversionCallback, /* #071 */ NULL, /* #072 */ _XimPreeditStartCallback, /* #073 */ NULL, /* #074 */ _XimPreeditDrawCallback, /* #075 */ _XimPreeditCaretCallback, /* #076 */ NULL, /* #077 */ _XimPreeditDoneCallback, /* #078 */ _XimStatusStartCallback, /* #079 */ _XimStatusDrawCallback, /* #080 */ _XimStatusDoneCallback, /* #081 */ _XimPreeditStateNotifyCallback /* #082 */ }; static Bool _XimIsReadyForProcess(Xic ic) { return(!ic->private.proto.waitCallback); /* check HM */ } static void _XimProcessPendingCallbacks(Xic ic) { XimPendingCallback pcbq; while (((pcbq = ic->private.proto.pend_cb_que) != (XimPendingCallback)NULL) && _XimIsReadyForProcess(ic)) { (void) (*callback_table[pcbq->major_opcode])(pcbq->im, pcbq->ic, pcbq->proto, pcbq->proto_len); ic->private.proto.pend_cb_que = pcbq->next; Xfree(pcbq->proto); /* free memory of XimPendingCallback */ Xfree(pcbq); } } static void _XimPutCbIntoQueue(Xic ic, XimPendingCallback call_data) { XimPendingCallback pcbq = ic->private.proto.pend_cb_que; /* Queuing is FIFO */ while (pcbq != (XimPendingCallback)NULL) { if (pcbq->next == (XimPendingCallback)NULL) { break; } pcbq = pcbq->next; } if (pcbq == (XimPendingCallback)NULL) { ic->private.proto.pend_cb_que = call_data; } else { pcbq->next = call_data; } } Bool _XimCbDispatch(Xim xim, INT16 len, XPointer data, XPointer call_data) { /* `data' points to the beginning of the packet defined in IM Protocol doc. */ int major_opcode = PACKET_TO_MAJOROPCODE(data); XIMID imid = PACKET_TO_IMID(data); XICID icid = PACKET_TO_ICID(data); Xim im = (Xim)call_data; /* check HM */ Xic ic = _XimICOfXICID(im, icid); char* proto; int proto_len; /* check validity of im/ic */ if ((imid != im->private.proto.imid) || !ic) { return False; /* status = XimCbBadContextID; */ } /* process pending callbacks */ _XimProcessPendingCallbacks(ic); /* check if the protocol should be processed here */ if (major_opcode > 82) { return False; /* status = XimCbBadOpcode; */ } if (!callback_table[major_opcode]) { return False; /* status = XimCbBadOpcode; */ } /* move the pointer ahead by the IM Protocol packet header size */ proto = (char*)data + sz_ximPacketHeader; proto_len = (int)len - sz_ximPacketHeader; /* check if it can be processed right away * and if no, queue the protocol, otherwise invoke a callback */ if (!_XimIsReadyForProcess(ic)) { /* queue the protocol */ XimPendingCallback pcb; char *proto_buf = (proto_len > 0) ? Xmalloc(proto_len) : NULL; pcb = Xmalloc(sizeof(XimPendingCallbackRec)); if (pcb && (proto_len <= 0 || proto_buf)) { if (proto_len > 0) memcpy(proto_buf, proto, proto_len); pcb->major_opcode = major_opcode; pcb->im = im; pcb->ic = ic; pcb->proto = proto_buf; pcb->proto_len = proto_len; pcb->next = (XimPendingCallback)NULL; /* queue is FIFO */ _XimPutCbIntoQueue(ic, pcb); /* status = XimCbQueued; */ } else { /* status = XimCbError; */ Xfree(pcb); Xfree(proto_buf); } } else { /* invoke each callback according to the major opcode. * `proto' points to the next address of IM-ID and IC-ID. * `proto_len' specifies the packet length. */ (void) (*callback_table[major_opcode])(im, ic, proto, proto_len); } return True; } static XimCbStatus _XimGeometryCallback(Xim im, Xic ic, char* proto, int len) { XICCallback* cb = &ic->core.geometry_callback; /* invoke the callack */ if (cb && cb->callback) { (*cb->callback)((XIC)ic, cb->client_data, (XPointer)NULL); } else { /* no callback registered */ return XimCbNoCallback; } return XimCbSuccess; } static XimCbStatus _XimStrConversionCallback(Xim im, Xic ic, char* proto, int len) { XICCallback* cb = &ic->core.string_conversion_callback; /* check HM */ XIMStringConversionCallbackStruct cbrec; /* invoke the callback */ if (cb && cb->callback) { int p = XIM_HEADER_SIZE; cbrec.position = (XIMStringConversionPosition) *(CARD32*)&proto[p]; p += sz_CARD32; cbrec.direction = (XIMCaretDirection) *(CARD32*)&proto[p]; p += sz_CARD32; cbrec.operation = (XIMStringConversionOperation) *(CARD32*)&proto[p]; p += sz_CARD32; cbrec.factor = (unsigned short) *(CARD32*)&proto[p]; (*cb->callback)((XIC)ic, cb->client_data, (XPointer)&cbrec); } else { /* no callback registered */ _XimError(im, ic, (CARD16)XIM_BadSomething, (INT16)len, (CARD16)XIM_STR_CONVERSION, (char*)proto); /* send XIM_ERROR */ return XimCbNoCallback; } /* send a reply */ { CARD8 *buf; INT16 buf_len; int p, length_in_bytes, i; /* Assumption: * `cbrec.text->length' means the string length in characters */ { length_in_bytes = (cbrec.text->encoding_is_wchar)? sizeof(wchar_t) * cbrec.text->length: /* wchar */ strlen(cbrec.text->string.mbs); /* mb */ buf_len = XIM_HEADER_SIZE + sz_CARD16 + 2 + length_in_bytes + XIM_PAD(2 + length_in_bytes) + 2 + 2 + sz_CARD32 * cbrec.text->length; buf = Xmalloc(buf_len); } _XimSetHeader((XPointer)buf, XIM_STR_CONVERSION_REPLY, 0, &buf_len); buf_len -= XIM_HEADER_SIZE; /* added by _XimSetHeader (HACK) */ p = XIM_HEADER_SIZE; *(CARD16*)&buf[p] = (CARD16)im->private.proto.imid; p += sz_CARD16; *(CARD16*)&buf[p] = (CARD16)ic->private.proto.icid; p += sz_CARD16; *(CARD16*)&buf[p] = (CARD16)cbrec.text->length; p += sz_CARD16; memcpy(&buf[p],&cbrec.text->string.mbs,length_in_bytes); p += length_in_bytes; *(CARD16*)&buf[p] = (CARD16)(sz_CARD32*cbrec.text->length); p += XIM_PAD(2); for (i = 0; i < (int)cbrec.text->length; i++) { *(CARD32*)&buf[p] = (CARD32)cbrec.text->feedback[i]; p += sz_CARD32; } if (!(_XimWriteData(im, buf_len, buf))) { return XimCbError; } _XimFlushData(im); Xfree(buf); } return XimCbSuccess; } static XimCbStatus _XimPreeditStartCallback(Xim im, Xic ic, char* proto, int len) { XICCallback* cb = &ic->core.preedit_attr.start_callback; int ret; /* invoke the callback */ if (cb && cb->callback){ ret = (*(cb->callback))((XIC)ic, cb->client_data, (XPointer)NULL); } else { /* no callback registered */ _XimError(im, ic, (CARD16)XIM_BadSomething, (INT16)len, (CARD16)XIM_PREEDIT_START, (char*)proto); /* send XIM_ERROR */ return XimCbNoCallback; } /* send a reply */ { CARD32 buf32[(sz_ximPacketHeader + sz_ximPreeditStartReply) / 4]; CARD8 *buf = (CARD8 *)buf32; INT16 buf_len = sz_XIMID + sz_XICID + sz_ximPreeditStartReply; int p; _XimSetHeader((XPointer)buf, XIM_PREEDIT_START_REPLY, 0, &buf_len); p = XIM_HEADER_SIZE; *(CARD16*)&buf[p] = (CARD16)im->private.proto.imid; p += sz_CARD16; *(CARD16*)&buf[p] = (CARD16)ic->private.proto.icid; p += sz_CARD16; *(INT32*)&buf[p] = (INT32)ret; if (!(_XimWriteData(im, buf_len, buf))) { return XimCbError; } _XimFlushData(im); } return XimCbSuccess; } static XimCbStatus _XimPreeditDoneCallback(Xim im, Xic ic, char* proto, int len) { XICCallback* cb = &ic->core.preedit_attr.done_callback; /* invoke the callback */ if (cb && cb->callback) { (*cb->callback)((XIC)ic, cb->client_data, (XPointer)NULL); } else { /* no callback registered */ return XimCbNoCallback; } return XimCbSuccess; } static void _read_text_from_packet(Xim im, char* buf, XIMText** text_ptr) { int status; XIMText* text; int tmp_len; char* tmp_buf; Status s = 0; status = (int)*(BITMASK32*)buf; buf += sz_BITMASK32; /* string part */ if (status & 0x00000001) /* "no string" bit on */ { buf += sz_CARD16; /* skip "length of preedit string" */ buf += 2; /* pad */ *text_ptr = (XIMText*)NULL; return; } *text_ptr = text = Xmalloc(sizeof(XIMText)); if (text == (XIMText*)NULL) return; tmp_len = (int)*(CARD16*)buf; buf += sz_CARD16; if ((tmp_buf = Xmalloc(tmp_len + 1))) { memcpy(tmp_buf, buf, tmp_len); tmp_buf[tmp_len] = '\0'; text->encoding_is_wchar = False; text->length = im->methods->ctstombs((XIM)im, tmp_buf, tmp_len, NULL, 0, &s); /* CT? HM */ if (s != XLookupNone) { #ifndef NO_DEC_I18N_FIX /* Allow for NULL-terminated */ if ((text->string.multi_byte = Xmalloc(text->length * XLC_PUBLIC(im->core.lcd,mb_cur_max) + 1))) { #else if (text->string.multi_byte = Xmalloc(text->length+1)) { #endif int tmp; #ifndef NO_DEC_I18N_FIX char *char_tmp; int char_len; #endif tmp = im->methods->ctstombs((XIM)im, tmp_buf, tmp_len, #ifndef NO_DEC_I18N_FIX text->string.multi_byte, text->length * XLC_PUBLIC(im->core.lcd,mb_cur_max) + 1, #else text->string.multi_byte, text->length, #endif &s); text->string.multi_byte[tmp] = '\0'; #ifndef NO_DEC_I18N_FIX text->length = 0; char_tmp = text->string.multi_byte; while (*char_tmp != '\0') { char_len = mblen(char_tmp, strlen(char_tmp)); char_tmp = char_tmp + char_len; (text->length)++; } #endif } } else { text->length = 0; text->string.multi_byte = NULL; } Xfree(tmp_buf); } buf += tmp_len; buf += XIM_PAD(sz_CARD16 + tmp_len); /* pad */ /* feedback part */ if (status & 0x00000002) /* "no feedback" bit on */ { text->feedback = (XIMFeedback*)NULL; } else { int i, j; i = (int)*(CARD16*)buf; buf += sz_CARD16; buf += sz_CARD16; /* skip `unused' */ text->feedback = Xmalloc(i*(sizeof(XIMFeedback)/sizeof(CARD32))); j = 0; while (i > 0) { text->feedback[j] = (XIMFeedback)*(CARD32*)buf; buf += sz_CARD32; i -= sz_CARD32; j++; } /* * text->length tells how long both the status string and * the feedback array are. If there's "no string" the * text->length was set to zero previously. See above. * But if there is feedback (i.e. not "no feedback") then * we need to convey the length of the feedback array. * It might have been better if the protocol sent two * different values, one for the length of the status * string and one for the length of the feedback array. */ if (status & 0x00000001) /* "no string" bit on */ { text->length = j; } } } static void _free_memory_for_text(XIMText* text) { if (text) { Xfree(text->string.multi_byte); Xfree(text->feedback); Xfree(text); } } static XimCbStatus _XimPreeditDrawCallback(Xim im, Xic ic, char* proto, int len) { XICCallback* cb = &ic->core.preedit_attr.draw_callback; XIMPreeditDrawCallbackStruct cbs; /* invoke the callback */ if (cb && cb->callback) { cbs.caret = (int)*(INT32*)proto; proto += sz_INT32; cbs.chg_first = (int)*(INT32*)proto; proto += sz_INT32; cbs.chg_length = (int)*(INT32*)proto; proto += sz_INT32; _read_text_from_packet(im, proto, &cbs.text); (*cb->callback)((XIC)ic, cb->client_data, (XPointer)&cbs); _free_memory_for_text((XIMText*)cbs.text); } else { /* no callback registered */ return XimCbNoCallback; } return XimCbSuccess; } static XimCbStatus _XimPreeditCaretCallback(Xim im, Xic ic, char* proto, int len) { XICCallback* cb = &ic->core.preedit_attr.caret_callback; XIMPreeditCaretCallbackStruct cbs; /* invoke the callback */ if (cb && cb->callback) { cbs.position = (int)*(INT32*)proto; proto += sz_INT32; cbs.direction = (XIMCaretDirection)*(CARD32*)proto; proto += sz_CARD32; cbs.style = (XIMCaretStyle)*(CARD32*)proto; proto += sz_CARD32; (*cb->callback)((XIC)ic, cb->client_data, (XPointer)&cbs); } else { /* no callback registered */ _XimError(im, ic, (CARD16)XIM_BadSomething, (INT16)len, (CARD16)XIM_PREEDIT_CARET, (char*)proto); /* send XIM_ERROR */ return XimCbNoCallback; } /* Send a reply */ { CARD8 buf[sz_ximPacketHeader + sz_ximPreeditCaretReply]; INT16 rlen = sz_XIMID + sz_XICID + sz_ximPreeditCaretReply; int p; _XimSetHeader((XPointer)buf, XIM_PREEDIT_CARET_REPLY, 0, &rlen); p = XIM_HEADER_SIZE; *(CARD16*)&buf[p] = (CARD16)im->private.proto.imid; p += sz_CARD16; *(CARD16*)&buf[p] = (CARD16)ic->private.proto.icid; p += sz_CARD16; *(CARD32*)&buf[p] = (CARD32)cbs.position; if (!(_XimWriteData(im, rlen, buf))) { return XimCbError; } _XimFlushData(im); } return XimCbSuccess; } static XimCbStatus _XimStatusStartCallback(Xim im, Xic ic, char* proto, int len) { XICCallback* cb = &ic->core.status_attr.start_callback; /* invoke the callback */ if (cb && cb->callback) { (*cb->callback)((XIC)ic, cb->client_data, (XPointer)NULL); } else { /* no callback registered */ return XimCbNoCallback; } return XimCbSuccess; } static XimCbStatus _XimStatusDoneCallback(Xim im, Xic ic, char* proto, int len) { XICCallback* cb = &ic->core.status_attr.done_callback; /* invoke the callback */ if (cb && cb->callback) { (*cb->callback)((XIC)ic, cb->client_data, (XPointer)NULL); } else { /* no callback registered */ return XimCbNoCallback; } return XimCbSuccess; } static XimCbStatus _XimStatusDrawCallback(Xim im, Xic ic, char* proto, int len) { XICCallback* cb = &ic->core.status_attr.draw_callback; XIMStatusDrawCallbackStruct cbs; /* invoke the callback */ if (cb && cb->callback) { cbs.type = (XIMStatusDataType)*(CARD32*)proto; proto += sz_CARD32; if (cbs.type == XIMTextType) { _read_text_from_packet(im, proto, &cbs.data.text); } else if (cbs.type == XIMBitmapType) { cbs.data.bitmap = (Pixmap)*(CARD32*)proto; } (*cb->callback)((XIC)ic, cb->client_data, (XPointer)&cbs); if (cbs.type == XIMTextType) _free_memory_for_text((XIMText *)cbs.data.text); } else { /* no callback registered */ return XimCbNoCallback; } return XimCbSuccess; } static XimCbStatus _XimPreeditStateNotifyCallback( Xim im, Xic ic, char* proto, int len ) { XICCallback *cb = &ic->core.preedit_attr.state_notify_callback; /* invoke the callack */ if( cb && cb->callback ) { XIMPreeditStateNotifyCallbackStruct cbrec; cbrec.state = *(BITMASK32 *)proto; (*cb->callback)( (XIC)ic, cb->client_data, (XPointer)&cbrec ); } else { /* no callback registered */ return XimCbNoCallback; } return XimCbSuccess; } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imDefFlt.c0000644000000000000000000002222713614532331017111 0ustar /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xutil.h" #include "Xlcint.h" #include "Ximint.h" static long _XimTriggerCheck( Xim im, XKeyEvent *ev, INT32 len, CARD32 *keylist) { register long i; KeySym keysym; CARD32 buf32[BUFSIZE/4]; char *buf = (char *)buf32; int modifier; int modifier_mask; CARD32 min_len = sizeof(CARD32) /* sizeof keysym */ + sizeof(CARD32) /* sizeof modifier */ + sizeof(CARD32); /* sizeof modifier mask */ XLookupString(ev, buf, BUFSIZE, &keysym, NULL); if (!keysym) return -1; for (i = 0; len >= min_len; i += 3, len -= min_len) { modifier = keylist[i + 1]; modifier_mask = keylist[i + 2]; if (((KeySym)keylist[i] == keysym) && ((ev->state & modifier_mask) == modifier)) return i; } return -1; } static long _XimTriggerOnCheck( Xim im, XKeyEvent *ev) { return _XimTriggerCheck(im, ev, (INT32)im->private.proto.im_onkeylist[0], &im->private.proto.im_onkeylist[1]); } static long _XimTriggerOffCheck( Xim im, XKeyEvent *ev) { return _XimTriggerCheck(im, ev, (INT32)im->private.proto.im_offkeylist[0], &im->private.proto.im_offkeylist[1]); } static Bool _XimOnKeysCheck( Xic ic, XKeyEvent *ev) { Xim im = (Xim)ic->core.im; long idx; if (IS_DYNAMIC_EVENT_FLOW(ic->core.im) && im->private.proto.im_onkeylist && im->private.proto.im_onkeylist[0]) { if ((idx = _XimTriggerOnCheck(im, ev)) >= 0) { (void)_XimTriggerNotify(im, ic, 0, (CARD32)idx); /* Trigger on */ return True; } } return False; } static Bool _XimOffKeysCheck( Xic ic, XKeyEvent *ev) { Xim im = (Xim)ic->core.im; long idx; if (IS_DYNAMIC_EVENT_FLOW(ic->core.im) && im->private.proto.im_offkeylist && im->private.proto.im_offkeylist[0]) { if ((idx = _XimTriggerOffCheck(im, ev)) >= 0) { _XimTriggerNotify(im, ic, 1, (CARD32)idx); /* Trigger off */ return True; } } return False; } static void _XimPendingFilter( Xic ic) { Xim im = (Xim)ic->core.im; if (IS_NEED_SYNC_REPLY(im)) { (void)_XimProcSyncReply(im, ic); UNMARK_NEED_SYNC_REPLY(im); } return; } static Bool _XimProtoKeypressFilter( Xic ic, XKeyEvent *ev) { Xim im = (Xim)ic->core.im; if (IS_FABRICATED(im)) { _XimPendingFilter(ic); UNMARK_FABRICATED(im); return NOTFILTERD; } if (IS_NEGLECT_EVENT(ic, KeyPressMask)) return FILTERD; #ifdef XIM_CONNECTABLE if (!IS_IC_CONNECTED(ic)) { if (IS_CONNECTABLE(im)) { if (_XimConnectServer(im)) { if (!_XimReCreateIC(ic)) { _XimDelayModeSetAttr(im); return NOTFILTERD; } } else { return NOTFILTERD; } } else { return NOTFILTERD; } } #else if (!IS_IC_CONNECTED(ic)) return NOTFILTERD; #endif /* XIM_CONNECTABLE */ if (!IS_FORWARD_EVENT(ic, KeyPressMask)) { if (_XimOnKeysCheck(ic, ev)) return FILTERD; return NOTFILTERD; } if (_XimOffKeysCheck(ic, ev)) return FILTERD; if (_XimForwardEvent(ic, (XEvent *)ev, IS_SYNCHRONOUS_EVENT(ic, KeyPressMask))) return FILTERD; return NOTFILTERD; } static Bool _XimFilterKeypress( Display *d, Window w, XEvent *ev, XPointer client_data) { return _XimProtoKeypressFilter((Xic)client_data, (XKeyEvent *)ev ); } static Bool _XimProtoKeyreleaseFilter( Xic ic, XKeyEvent *ev) { Xim im = (Xim)ic->core.im; if (IS_FABRICATED(im)) { _XimPendingFilter(ic); UNMARK_FABRICATED(im); return NOTFILTERD; } if (IS_NEGLECT_EVENT(ic, KeyReleaseMask)) return FILTERD; #ifdef XIM_CONNECTABLE if (!IS_IC_CONNECTED(ic)) { if (IS_CONNECTABLE(im)) { if (_XimConnectServer(im)) { if (!_XimReCreateIC(ic)) { _XimDelayModeSetAttr(im); return NOTFILTERD; } } else { return NOTFILTERD; } } else { return NOTFILTERD; } } #else if (!IS_IC_CONNECTED(ic)) return NOTFILTERD; #endif /* XIM_CONNECTABLE */ if (!IS_FORWARD_EVENT(ic, KeyReleaseMask)) { if (_XimOnKeysCheck(ic, ev)) return FILTERD; return NOTFILTERD; } if (_XimOffKeysCheck(ic, ev)) return FILTERD; if (_XimForwardEvent(ic, (XEvent *)ev, IS_SYNCHRONOUS_EVENT(ic, KeyPressMask))) return FILTERD; return NOTFILTERD; } static Bool _XimFilterKeyrelease( Display *d, Window w, XEvent *ev, XPointer client_data) { return _XimProtoKeyreleaseFilter((Xic)client_data, (XKeyEvent *)ev); } static void _XimRegisterKeyPressFilter( Xic ic) { if (ic->core.focus_window) { if (!(ic->private.proto.registed_filter_event & KEYPRESS_MASK)) { _XRegisterFilterByType (ic->core.im->core.display, ic->core.focus_window, KeyPress, KeyPress, _XimFilterKeypress, (XPointer)ic); ic->private.proto.registed_filter_event |= KEYPRESS_MASK; } } return; } static void _XimRegisterKeyReleaseFilter( Xic ic) { if (ic->core.focus_window) { if (!(ic->private.proto.registed_filter_event & KEYRELEASE_MASK)) { _XRegisterFilterByType (ic->core.im->core.display, ic->core.focus_window, KeyRelease, KeyRelease, _XimFilterKeyrelease, (XPointer)ic); ic->private.proto.registed_filter_event |= KEYRELEASE_MASK; } } return; } static void _XimUnregisterKeyPressFilter( Xic ic) { if (ic->core.focus_window) { if (ic->private.proto.registed_filter_event & KEYPRESS_MASK) { _XUnregisterFilter (ic->core.im->core.display, ic->core.focus_window, _XimFilterKeypress, (XPointer)ic); ic->private.proto.registed_filter_event &= ~KEYPRESS_MASK; } } return; } static void _XimUnregisterKeyReleaseFilter( Xic ic) { if (ic->core.focus_window) { if (ic->private.proto.registed_filter_event & KEYRELEASE_MASK) { _XUnregisterFilter (ic->core.im->core.display, ic->core.focus_window, _XimFilterKeyrelease, (XPointer)ic); ic->private.proto.registed_filter_event &= ~KEYRELEASE_MASK; } } return; } void _XimRegisterFilter( Xic ic) { _XimRegisterKeyPressFilter(ic); if (IS_FORWARD_EVENT(ic, KeyReleaseMask)) _XimRegisterKeyReleaseFilter(ic); return; } void _XimUnregisterFilter( Xic ic) { _XimUnregisterKeyPressFilter(ic); _XimUnregisterKeyReleaseFilter(ic); return; } void _XimReregisterFilter( Xic ic) { if (IS_FORWARD_EVENT(ic, KeyReleaseMask)) _XimRegisterKeyReleaseFilter(ic); else _XimUnregisterKeyReleaseFilter(ic); return; } static Bool _XimFilterServerDestroy( Display *d, Window w, XEvent *ev, XPointer client_data) { Xim im = (Xim)client_data; if (ev->type == DestroyNotify) { UNMARK_SERVER_CONNECTED(im); #ifdef XIM_CONNECTABLE if (!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { _XimServerReconectableDestroy(); return True; } #endif /* XIM_CONNECTABLE */ _XimServerDestroy(im); } return True; } void _XimRegisterServerFilter( Xim im) { if (im->private.proto.im_window) { if (!(im->private.proto.registed_filter_event & DESTROYNOTIFY_MASK)) { _XRegisterFilterByMask(im->core.display, im->private.proto.im_window, StructureNotifyMask, _XimFilterServerDestroy, (XPointer)im); XSelectInput(im->core.display, im->private.proto.im_window, StructureNotifyMask); im->private.proto.registed_filter_event |= DESTROYNOTIFY_MASK; } } return; } void _XimUnregisterServerFilter( Xim im) { if (im->private.proto.im_window) { if (im->private.proto.registed_filter_event & DESTROYNOTIFY_MASK) { _XUnregisterFilter(im->core.display, im->private.proto.im_window, _XimFilterServerDestroy, (XPointer)im); im->private.proto.registed_filter_event &= ~DESTROYNOTIFY_MASK; } } return; } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imDefIc.c0000644000000000000000000012133013614532331016712 0ustar /* * Copyright 1991, 1992 Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" static Bool _XimCreateICCheck( Xim im, INT16 len, XPointer data, XPointer arg) { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); XIMID imid = buf_s[0]; if ((major_opcode == XIM_CREATE_IC_REPLY) && (minor_opcode == 0) && (imid == im->private.proto.imid)) return True; if ((major_opcode == XIM_ERROR) && (minor_opcode == 0) && (buf_s[2] & XIM_IMID_VALID) && (imid == im->private.proto.imid)) return True; return False; } #ifdef XIM_CONNECTABLE Bool _XimReCreateIC(ic) Xic ic; { Xim im = (Xim)ic->core.im; Xic save_ic; XIMResourceList res; unsigned int num; XIMStyle input_style = ic->core.input_style; XimDefICValues ic_values; INT16 len; CARD16 *buf_s; char *tmp; CARD32 tmp_buf32[BUFSIZE/4]; char *tmp_buf = (char *)tmp_buf32; char *buf; int buf_size; char *data; int data_len; int ret_len; int total; int idx; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int ret_code; if (!(save_ic = Xmalloc(sizeof(XicRec)))) return False; memcpy((char *)save_ic, (char *)ic, sizeof(XicRec)); ic->core.filter_events = im->private.proto.forward_event_mask; ic->private.proto.forward_event_mask = im->private.proto.forward_event_mask; ic->private.proto.synchronous_event_mask = im->private.proto.synchronous_event_mask; num = im->core.ic_num_resources; buf_size = sizeof(XIMResource) * num; if (!(res = Xmalloc(buf_size))) goto ErrorOnReCreateIC; (void)memcpy((char *)res, (char *)im->core.ic_resources, buf_size); ic->private.proto.ic_resources = res; ic->private.proto.ic_num_resources = num; num = im->private.proto.ic_num_inner_resources; buf_size = sizeof(XIMResource) * num; if (!(res = Xmalloc(buf_size))) goto ErrorOnReCreateIC; (void)memcpy((char *)res, (char *)im->private.proto.ic_inner_resources, buf_size); ic->private.proto.ic_inner_resources = res; ic->private.proto.ic_num_inner_resources = num; _XimSetICMode(ic->private.proto.ic_resources, ic->private.proto.ic_num_resources, input_style); _XimSetICMode(ic->private.proto.ic_inner_resources, ic->private.proto.ic_num_inner_resources, input_style); _XimGetCurrentICValues(ic, &ic_values); buf = tmp_buf; buf_size = XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(INT16); data_len = BUFSIZE - buf_size; total = 0; idx = 0; for (;;) { data = &buf[buf_size]; if (!_XimEncodeSavedICATTRIBUTE(ic, ic->private.proto.ic_resources, ic->private.proto.ic_num_resources, &idx, data, data_len, &ret_len, (XPointer)&ic_values, XIM_CREATEIC)) { if (buf != tmp_buf) Xfree(buf); goto ErrorOnReCreateIC; } total += ret_len; if (idx == -1) { break; } buf_size += ret_len; if (buf == tmp_buf) { if (!(tmp = Xmalloc(buf_size + data_len))) { goto ErrorOnReCreateIC; } memcpy(tmp, buf, buf_size); buf = tmp; } else { if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { Xfree(buf); goto ErrorOnReCreateIC; } buf = tmp; } } buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; buf_s[0] = im->private.proto.imid; buf_s[1] = (INT16)total; len = (INT16)(sizeof(CARD16) + sizeof(INT16) + total); _XimSetHeader((XPointer)buf, XIM_CREATE_IC, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) { if (buf != tmp_buf) Xfree(buf); goto ErrorOnReCreateIC; } _XimFlush(im); if (buf != tmp_buf) Xfree(buf); ic->private.proto.waitCallback = True; buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimCreateICCheck, 0); if (ret_code == XIM_TRUE) { preply = reply; } else if (ret_code == XIM_OVERFLOW) { if (len <= 0) { preply = reply; } else { buf_size = (int)len; preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimCreateICCheck, 0); if (ret_code != XIM_TRUE) { Xfree(preply); ic->private.proto.waitCallback = False; goto ErrorOnReCreateIC; } } } else { ic->private.proto.waitCallback = False; goto ErrorOnReCreateIC; } ic->private.proto.waitCallback = False; buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if (reply != preply) Xfree(preply); goto ErrorOnReCreateIC; } ic->private.proto.icid = buf_s[1]; /* icid */ if (reply != preply) Xfree(preply); _XimRegisterFilter(ic); MARK_IC_CONNECTED(ic); Xfree(save_ic->private.proto.ic_resources); Xfree(save_ic->private.proto.ic_inner_resources); Xfree(save_ic); return True; ErrorOnReCreateIC: memcpy((char *)ic, (char *)save_ic, sizeof(XicRec)); Xfree(save_ic); return False; } static char * _XimDelayModeGetICValues(ic, arg) Xic ic; XIMArg *arg; { XimDefICValues ic_values; _XimGetCurrentICValues(ic, &ic_values); return _XimGetICValueData(ic, (XPointer)&ic_values, ic->private.proto.ic_resources, ic->private.proto.ic_num_resources, arg, XIM_GETICVALUES); } #endif /* XIM_CONNECTABLE */ static Bool _XimGetICValuesCheck( Xim im, INT16 len, XPointer data, XPointer arg) { Xic ic = (Xic)arg; CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); XIMID imid = buf_s[0]; XICID icid = buf_s[1]; if ((major_opcode == XIM_GET_IC_VALUES_REPLY) && (minor_opcode == 0) && (imid == im->private.proto.imid) && (icid == ic->private.proto.icid)) return True; if ((major_opcode == XIM_ERROR) && (minor_opcode == 0) && (buf_s[2] & XIM_IMID_VALID) && (imid == im->private.proto.imid) && (buf_s[2] & XIM_ICID_VALID) && (icid == ic->private.proto.icid)) return True; return False; } static char * _XimProtoGetICValues( XIC xic, XIMArg *arg) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; register XIMArg *p; register XIMArg *pp; register int n; CARD8 *buf; CARD16 *buf_s; INT16 len; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply = NULL; int buf_size; int ret_code; char *makeid_name; char *decode_name; CARD16 *data = NULL; INT16 data_len = 0; #ifndef XIM_CONNECTABLE if (!IS_IC_CONNECTED(ic)) return arg->name; #else if (!IS_IC_CONNECTED(ic)) { if (IS_CONNECTABLE(im)) { if (_XimConnectServer(im)) { if (!_XimReCreateIC(ic)) { _XimDelayModeSetAttr(im); return _XimDelayModeGetICValues(ic, arg); } } else { return _XimDelayModeGetICValues(ic, arg); } } else { return arg->name; } } #endif /* XIM_CONNECTABLE */ for (n = 0, p = arg; p && p->name; p++) { n++; if ((strcmp(p->name, XNPreeditAttributes) == 0) || (strcmp(p->name, XNStatusAttributes) == 0)) { n++; for (pp = (XIMArg *)p->value; pp && pp->name; pp++) n++; } } if (!n) return (char *)NULL; buf_size = sizeof(CARD16) * n; buf_size += XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(CARD16) + sizeof(INT16) + XIM_PAD(2 + buf_size); if (!(buf = Xmalloc(buf_size))) return arg->name; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; makeid_name = _XimMakeICAttrIDList(ic, ic->private.proto.ic_resources, ic->private.proto.ic_num_resources, arg, &buf_s[3], &len, XIM_GETICVALUES); if (len > 0) { buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = ic->private.proto.icid; /* icid */ buf_s[2] = len; /* length of ic-attr-id */ len += sizeof(INT16); /* sizeof length of attr */ XIM_SET_PAD(&buf_s[2], len); /* pad */ len += sizeof(CARD16) /* sizeof imid */ + sizeof(CARD16); /* sizeof icid */ _XimSetHeader((XPointer)buf, XIM_GET_IC_VALUES, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) { Xfree(buf); return arg->name; } _XimFlush(im); Xfree(buf); buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimGetICValuesCheck, (XPointer)ic); if (ret_code == XIM_TRUE) { preply = reply; } else if (ret_code == XIM_OVERFLOW) { if (len <= 0) { preply = reply; } else { buf_size = (int)len; preply = Xmalloc(len); ret_code = _XimRead(im, &len, preply, buf_size, _XimGetICValuesCheck, (XPointer)ic); if (ret_code != XIM_TRUE) { if (preply != reply) Xfree(preply); return arg->name; } } } else { return arg->name; } buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if (reply != preply) Xfree(preply); return arg->name; } data = &buf_s[4]; data_len = buf_s[2]; } else if (len < 0) { return arg->name; } decode_name = _XimDecodeICATTRIBUTE(ic, ic->private.proto.ic_resources, ic->private.proto.ic_num_resources, data, data_len, arg, XIM_GETICVALUES); if (reply != preply) Xfree(preply); if (decode_name) return decode_name; else return makeid_name; } #ifdef XIM_CONNECTABLE static Bool _XimCheckNestQuarkList(quark_list, num_quark, quark, separator) XrmQuark *quark_list; int num_quark; XrmQuark quark; XrmQuark separator; { register int i; for (i = 0; i < num_quark; i++) { if (quark_list[i] == separator) { break; } if (quark_list[i] == quark) { return True; } } return False; } static Bool _XimCheckNestedQuarkList(quark_list, idx, num_quark, arg, separator) XrmQuark **quark_list; int idx; int *num_quark; XIMArg *arg; XrmQuark separator; { XrmQuark *q_list = *quark_list; int n_quark = *num_quark; register XIMArg *p; XrmQuark quark; XrmQuark *tmp; register int i; for (p = arg; p && p->name; p++) { quark = XrmStringToQuark(p->name); if (_XimCheckNestQuarkList(&q_list[idx], n_quark - idx, quark, separator)) { continue; } if (!(tmp = Xmalloc((sizeof(XrmQuark) * (n_quark + 1))))) { *quark_list = q_list; *num_quark = n_quark; return False; } n_quark++; for (i = 0; i < idx; i++) { tmp[i] = q_list[i]; } tmp[i] = quark; for (i = idx + 1; i < n_quark; i++) { tmp[i] = q_list[i - 1]; } q_list = tmp; } *quark_list = q_list; *num_quark = n_quark; return True; } static Bool _XimCheckICQuarkList(quark_list, num_quark, quark, idx) XrmQuark *quark_list; int num_quark; XrmQuark quark; int *idx; { register int i; for (i = 0; i < num_quark; i++) { if (quark_list[i] == quark) { *idx = i; return True; } } return False; } static Bool _XimSaveICValues(ic, arg) Xic ic; XIMArg *arg; { register XIMArg *p; register int n; XrmQuark *quark_list; XrmQuark *tmp; XrmQuark quark; int num_quark; XrmQuark pre_quark; XrmQuark sts_quark; XrmQuark separator; int idx; pre_quark = XrmStringToQuark(XNPreeditAttributes); sts_quark = XrmStringToQuark(XNStatusAttributes); separator = XrmStringToQuark(XNSeparatorofNestedList); if (quark_list = ic->private.proto.saved_icvalues) { num_quark = ic->private.proto.num_saved_icvalues; for (p = arg; p && p->name; p++) { quark = XrmStringToQuark(p->name); if ((quark == pre_quark) || (quark == sts_quark)) { if (!_XimCheckICQuarkList(quark_list, num_quark, quark, &idx)) { register XIMArg *pp; int nn; XrmQuark *q_list; for (pp = (XIMArg *)p->value, nn = 0; pp && pp->name; pp++, nn++); if (!(tmp = Xrealloc(quark_list, (sizeof(XrmQuark) * (num_quark + nn + 2))))) { ic->private.proto.saved_icvalues = quark_list; ic->private.proto.num_saved_icvalues = num_quark; return False; } quark_list = tmp; q_list = &quark_list[num_quark]; num_quark += nn + 2; *q_list++ = quark; for (pp = (XIMArg *)p->value; pp && pp->name; pp++, quark_list++) { *q_list = XrmStringToQuark(pp->name); } *q_list = separator; } else { if (!_XimCheckNestedQuarkList(&quark_list, idx + 1, &num_quark, (XIMArg *)p->value, separator)) { ic->private.proto.saved_icvalues = quark_list; ic->private.proto.num_saved_icvalues = num_quark; return False; } } } else { if (_XimCheckICQuarkList(quark_list, num_quark, quark, &idx)) { continue; } if (!(tmp = Xrealloc(quark_list, (sizeof(XrmQuark) * (num_quark + 1))))) { ic->private.proto.saved_icvalues = quark_list; ic->private.proto.num_saved_icvalues = num_quark; return False; } quark_list = tmp; quark_list[num_quark] = quark; num_quark++; } } ic->private.proto.saved_icvalues = quark_list; ic->private.proto.num_saved_icvalues = num_quark; return True; } for (p = arg, n = 0; p && p->name; p++, n++) { if ((!strcmp(p->name, XNPreeditAttributes)) || (!strcmp(p->name, XNStatusAttributes))) { register XIMArg *pp; int nn; for (pp = (XIMArg *)p->value, nn = 0; pp && pp->name; pp++, nn++); n += nn + 1; } } if (!(quark_list = Xmalloc(sizeof(XrmQuark) * n))) { return False; } ic->private.proto.saved_icvalues = quark_list; ic->private.proto.num_saved_icvalues = n; for (p = arg; p && p->name; p++, quark_list++) { *quark_list = XrmStringToQuark(p->name); if ((*quark_list == pre_quark) || (*quark_list == sts_quark)) { register XIMArg *pp; quark_list++; for (pp = (XIMArg *)p->value; pp && pp->name; pp++, quark_list++) { *quark_list = XrmStringToQuark(pp->name); } *quark_list = separator; } } return True; } static char * _XimDelayModeSetICValues(ic, arg) Xic ic; XIMArg *arg; { XimDefICValues ic_values; char *name; _XimGetCurrentICValues(ic, &ic_values); name = _XimSetICValueData(ic, (XPointer)&ic_values, ic->private.proto.ic_resources, ic->private.proto.ic_num_resources, arg, XIM_SETICVALUES, False); _XimSetCurrentICValues(ic, &ic_values); return name; } #endif /* XIM_CONNECTABLE */ static Bool _XimSetICValuesCheck( Xim im, INT16 len, XPointer data, XPointer arg) { Xic ic = (Xic)arg; CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); XIMID imid = buf_s[0]; XICID icid = buf_s[1]; if ((major_opcode == XIM_SET_IC_VALUES_REPLY) && (minor_opcode == 0) && (imid == im->private.proto.imid) && (icid == ic->private.proto.icid)) return True; if ((major_opcode == XIM_ERROR) && (minor_opcode == 0) && (buf_s[2] & XIM_IMID_VALID) && (imid == im->private.proto.imid) && (buf_s[2] & XIM_ICID_VALID) && (icid == ic->private.proto.icid)) return True; return False; } static char * _XimProtoSetICValues( XIC xic, XIMArg *arg) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; XimDefICValues ic_values; INT16 len; CARD16 *buf_s; char *tmp; CARD32 tmp_buf32[BUFSIZE/4]; char *tmp_buf = (char *)tmp_buf32; char *buf; int buf_size; char *data; int data_len; int ret_len; int total; XIMArg *arg_ret; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply = NULL; int ret_code; BITMASK32 flag = 0L; char *name; char *tmp_name = (arg) ? arg->name : NULL; #ifndef XIM_CONNECTABLE if (!IS_IC_CONNECTED(ic)) return tmp_name; #else if (!_XimSaveICValues(ic, arg)) return NULL; if (!IS_IC_CONNECTED(ic)) { if (IS_CONNECTABLE(im)) { if (_XimConnectServer(im)) { if (!_XimReCreateIC(ic)) { _XimDelayModeSetAttr(im); return _XimDelayModeSetICValues(ic, arg); } } else { return _XimDelayModeSetICValues(ic, arg); } } else { return tmp_name; } } #endif /* XIM_CONNECTABLE */ _XimGetCurrentICValues(ic, &ic_values); buf = tmp_buf; buf_size = XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(CARD16) + sizeof(INT16) + sizeof(CARD16); data_len = BUFSIZE - buf_size; total = 0; arg_ret = arg; for (;;) { data = &buf[buf_size]; if ((name = _XimEncodeICATTRIBUTE(ic, ic->private.proto.ic_resources, ic->private.proto.ic_num_resources, arg, &arg_ret, data, data_len, &ret_len, (XPointer)&ic_values, &flag, XIM_SETICVALUES))) { break; } total += ret_len; if (!(arg = arg_ret)) { break; } buf_size += ret_len; if (buf == tmp_buf) { if (!(tmp = Xmalloc(buf_size + data_len))) { return tmp_name; } memcpy(tmp, buf, buf_size); buf = tmp; } else { if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { Xfree(buf); return tmp_name; } buf = tmp; } } _XimSetCurrentICValues(ic, &ic_values); if (!total) { return tmp_name; } buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; #ifdef EXT_MOVE if (_XimExtenMove(im, ic, flag, &buf_s[4], (INT16)total)) return name; #endif buf_s[0] = im->private.proto.imid; buf_s[1] = ic->private.proto.icid; buf_s[2] = (INT16)total; buf_s[3] = 0; len = (INT16)(sizeof(CARD16) + sizeof(CARD16) + sizeof(INT16) + sizeof(CARD16) + total); _XimSetHeader((XPointer)buf, XIM_SET_IC_VALUES, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) { if (buf != tmp_buf) Xfree(buf); return tmp_name; } _XimFlush(im); if (buf != tmp_buf) Xfree(buf); ic->private.proto.waitCallback = True; buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimSetICValuesCheck, (XPointer)ic); if (ret_code == XIM_TRUE) { preply = reply; } else if (ret_code == XIM_OVERFLOW) { buf_size = (int)len; preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimSetICValuesCheck, (XPointer)ic); if (ret_code != XIM_TRUE) { Xfree(preply); ic->private.proto.waitCallback = False; return tmp_name; } } else { ic->private.proto.waitCallback = False; return tmp_name; } ic->private.proto.waitCallback = False; buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if (reply != preply) Xfree(preply); return tmp_name; } if (reply != preply) Xfree(preply); return name; } static Bool _XimDestroyICCheck( Xim im, INT16 len, XPointer data, XPointer arg) { Xic ic = (Xic)arg; CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); XIMID imid = buf_s[0]; XICID icid = buf_s[1]; Bool ret = False; if ((major_opcode == XIM_DESTROY_IC_REPLY) && (minor_opcode == 0) && (imid == im->private.proto.imid) && (icid == ic->private.proto.icid)) ret = True; if ((major_opcode == XIM_ERROR) && (minor_opcode == 0) && (buf_s[2] & XIM_IMID_VALID) && (imid == im->private.proto.imid) && (buf_s[2] & XIM_ICID_VALID) && (icid == ic->private.proto.icid)) ret = False; return ret; } static void _XimProtoICFree( Xic ic) { #ifdef XIM_CONNECTABLE Xim im = (Xim)ic->core.im; #endif Xfree(ic->private.proto.preedit_font); ic->private.proto.preedit_font = NULL; Xfree(ic->private.proto.status_font); ic->private.proto.status_font = NULL; if (ic->private.proto.commit_info) { _XimFreeCommitInfo(ic); ic->private.proto.commit_info = NULL; } Xfree(ic->private.proto.ic_inner_resources); ic->private.proto.ic_inner_resources = NULL; #ifdef XIM_CONNECTABLE if (IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { return; } #endif /* XIM_CONNECTABLE */ Xfree(ic->private.proto.saved_icvalues); ic->private.proto.saved_icvalues = NULL; Xfree(ic->private.proto.ic_resources); ic->private.proto.ic_resources = NULL; Xfree(ic->core.hotkey); ic->core.hotkey = NULL; return; } static void _XimProtoDestroyIC( XIC xic) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; INT16 len; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int buf_size; int ret_code; if (IS_SERVER_CONNECTED(im)) { buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = ic->private.proto.icid; /* icid */ len = sizeof(CARD16) /* sizeof imid */ + sizeof(CARD16); /* sizeof icid */ _XimSetHeader((XPointer)buf, XIM_DESTROY_IC, 0, &len); (void)_XimWrite(im, len, (XPointer)buf); _XimFlush(im); buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimDestroyICCheck, (XPointer)ic); if (ret_code == XIM_OVERFLOW) { buf_size = len; preply = Xmalloc(buf_size); (void)_XimRead(im, &len, preply, buf_size, _XimDestroyICCheck, (XPointer)ic); Xfree(preply); } } UNMARK_IC_CONNECTED(ic); _XimUnregisterFilter(ic); _XimProtoICFree(ic); return; } /* * Some functions require the request queue from the server to be flushed * so that the ordering of client initiated status changes and those requested * by the server is well defined. * _XimSync() would be the function of choice here as it should get a * XIM_SYNC_REPLY back from the server. * This however isn't implemented in the piece of junk that is used by most * input servers as the server side protocol if to XIM. * Since this code is not shipped as a library together with the client side * XIM code but is duplicated by every input server around the world there * is no easy fix to this but this ugly hack below. * Obtaining an IC value from the server sends a request and empties out the * event/server request queue until the answer to this request is found. * Thus it is guaranteed that any pending server side request gets processed. * This is what the hack below is doing. */ static void BrokenSyncWithServer(XIC xic) { CARD32 dummy; XGetICValues(xic, XNFilterEvents, &dummy, NULL); } static void _XimProtoSetFocus( XIC xic) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; INT16 len; #ifndef XIM_CONNECTABLE if (!IS_IC_CONNECTED(ic)) return; #else if (!IS_IC_CONNECTED(ic)) { if (IS_CONNECTABLE(im)) { if (_XimConnectServer(im)) { if (!_XimReCreateIC(ic)) { _XimDelayModeSetAttr(im); return; } } else { return; } } else { return; } } #endif /* XIM_CONNECTABLE */ BrokenSyncWithServer(xic); buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = ic->private.proto.icid; /* icid */ len = sizeof(CARD16) /* sizeof imid */ + sizeof(CARD16); /* sizeof icid */ _XimSetHeader((XPointer)buf, XIM_SET_IC_FOCUS, 0, &len); (void)_XimWrite(im, len, (XPointer)buf); _XimFlush(im); _XimRegisterFilter(ic); return; } static void _XimProtoUnsetFocus( XIC xic) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; INT16 len; #ifndef XIM_CONNECTABLE if (!IS_IC_CONNECTED(ic)) return; #else if (!IS_IC_CONNECTED(ic)) { if (IS_CONNECTABLE(im)) { if (_XimConnectServer(im)) { if (!_XimReCreateIC(ic)) { _XimDelayModeSetAttr(im); return; } } else { return; } } else { return; } } #endif /* XIM_CONNECTABLE */ BrokenSyncWithServer(xic); buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = ic->private.proto.icid; /* icid */ len = sizeof(CARD16) /* sizeof imid */ + sizeof(CARD16); /* sizeof icid */ _XimSetHeader((XPointer)buf, XIM_UNSET_IC_FOCUS, 0, &len); (void)_XimWrite(im, len, (XPointer)buf); _XimFlush(im); _XimUnregisterFilter(ic); return; } static Bool _XimResetICCheck( Xim im, INT16 len, XPointer data, XPointer arg) { Xic ic = (Xic)arg; CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); XIMID imid = buf_s[0]; XICID icid = buf_s[1]; if ((major_opcode == XIM_RESET_IC_REPLY) && (minor_opcode == 0) && (imid == im->private.proto.imid) && (icid == ic->private.proto.icid)) return True; if ((major_opcode == XIM_ERROR) && (minor_opcode == 0) && (buf_s[2] & XIM_IMID_VALID) && (imid == im->private.proto.imid) && (buf_s[2] & XIM_ICID_VALID) && (icid == ic->private.proto.icid)) return True; return False; } static char * _XimProtoReset( XIC xic, char * (*retfunc) (Xim im, Xic ic, XPointer buf) ) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; INT16 len; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int buf_size; int ret_code; char *commit; if (!IS_IC_CONNECTED(ic)) return (char *)NULL; buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = ic->private.proto.icid; /* icid */ len = sizeof(CARD16) /* sizeof imid */ + sizeof(CARD16); /* sizeof icid */ _XimSetHeader((XPointer)buf, XIM_RESET_IC, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) return NULL; _XimFlush(im); ic->private.proto.waitCallback = True; buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimResetICCheck, (XPointer)ic); if (ret_code == XIM_TRUE) { preply = reply; } else if (ret_code == XIM_OVERFLOW) { if (len < 0) { preply = reply; } else { buf_size = len; preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimResetICCheck, (XPointer)ic); if (ret_code != XIM_TRUE) { Xfree(preply); ic->private.proto.waitCallback = False; return NULL; } } } else { ic->private.proto.waitCallback = False; return NULL; } ic->private.proto.waitCallback = False; buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if (reply != preply) free(preply); return NULL; } commit = retfunc(im, ic, (XPointer)&buf_s[2]); if (reply != preply) Xfree(preply); return commit; } static char * _XimCommitedMbString( Xim im, Xic ic, XPointer buf) { CARD16 *buf_s = (CARD16 *)buf; XimCommitInfo info; int len; int new_len; char *commit; char *new_commit = NULL; char *str; Status status; len = 0; for (info = ic->private.proto.commit_info; info; info = info->next) len += info->string_len; len += buf_s[0]; if ( len == 0 ) return( NULL ); if (!(commit = Xmalloc(len + 1))) goto Error_On_Reset; str = commit; for (info = ic->private.proto.commit_info; info; info = info->next) { (void)memcpy(str, info->string, info->string_len); str += info->string_len; } (void)memcpy(str, (char *)&buf_s[1], buf_s[0]); commit[len] = '\0'; new_len = im->methods->ctstombs((XIM)im, commit, len, NULL, 0, &status); if (status != XLookupNone) { if (!(new_commit = Xmalloc(new_len + 1))) { Xfree(commit); goto Error_On_Reset; } (void)im->methods->ctstombs((XIM)im, commit, len, new_commit, new_len, NULL); new_commit[new_len] = '\0'; } Xfree(commit); Error_On_Reset: _XimFreeCommitInfo( ic ); return new_commit; } static char * _XimProtoMbReset( XIC xic) { return _XimProtoReset(xic, _XimCommitedMbString); } static wchar_t * _XimCommitedWcString( Xim im, Xic ic, XPointer buf) { CARD16 *buf_s = (CARD16 *)buf; XimCommitInfo info; int len; int new_len; char *commit; wchar_t *new_commit = (wchar_t *)NULL; char *str; Status status; len = 0; for (info = ic->private.proto.commit_info; info; info = info->next) len += info->string_len; len += buf_s[0]; if ( len == 0 ) return( (wchar_t *)NULL ); if (!(commit = Xmalloc(len + 1))) goto Error_On_Reset; str = commit; for (info = ic->private.proto.commit_info; info; info = info->next) { (void)memcpy(str, info->string, info->string_len); str += info->string_len; } (void)memcpy(str, (char *)&buf_s[1], buf_s[0]); commit[len] = '\0'; new_len = im->methods->ctstowcs((XIM)im, commit, len, NULL, 0, &status); if (status != XLookupNone) { if (!(new_commit = (wchar_t *)Xmalloc(sizeof(wchar_t) * (new_len + 1)))) { Xfree(commit); goto Error_On_Reset; } (void)im->methods->ctstowcs((XIM)im, commit, len, new_commit, new_len, NULL); new_commit[new_len] = (wchar_t)'\0'; } Xfree(commit); Error_On_Reset: _XimFreeCommitInfo( ic ); return new_commit; } static wchar_t * _XimProtoWcReset( XIC xic) { return (wchar_t *) _XimProtoReset(xic, (char * (*) (Xim, Xic, XPointer)) _XimCommitedWcString); } static char * _XimCommitedUtf8String( Xim im, Xic ic, XPointer buf) { CARD16 *buf_s = (CARD16 *)buf; XimCommitInfo info; int len; int new_len; char *commit; char *new_commit = NULL; char *str; Status status; len = 0; for (info = ic->private.proto.commit_info; info; info = info->next) len += info->string_len; len += buf_s[0]; if ( len == 0 ) return( NULL ); if (!(commit = Xmalloc(len + 1))) goto Error_On_Reset; str = commit; for (info = ic->private.proto.commit_info; info; info = info->next) { (void)memcpy(str, info->string, info->string_len); str += info->string_len; } (void)memcpy(str, (char *)&buf_s[1], buf_s[0]); commit[len] = '\0'; new_len = im->methods->ctstoutf8((XIM)im, commit, len, NULL, 0, &status); if (status != XLookupNone) { if (!(new_commit = Xmalloc(new_len + 1))) { Xfree(commit); goto Error_On_Reset; } (void)im->methods->ctstoutf8((XIM)im, commit, len, new_commit, new_len, NULL); new_commit[new_len] = '\0'; } Xfree(commit); Error_On_Reset: _XimFreeCommitInfo( ic ); return new_commit; } static char * _XimProtoUtf8Reset( XIC xic) { return _XimProtoReset(xic, _XimCommitedUtf8String); } static XICMethodsRec ic_methods = { _XimProtoDestroyIC, /* destroy */ _XimProtoSetFocus, /* set_focus */ _XimProtoUnsetFocus, /* unset_focus */ _XimProtoSetICValues, /* set_values */ _XimProtoGetICValues, /* get_values */ _XimProtoMbReset, /* mb_reset */ _XimProtoWcReset, /* wc_reset */ _XimProtoUtf8Reset, /* utf8_reset */ _XimProtoMbLookupString, /* mb_lookup_string */ _XimProtoWcLookupString, /* wc_lookup_string */ _XimProtoUtf8LookupString /* utf8_lookup_string */ }; static Bool _XimGetInputStyle( XIMArg *arg, XIMStyle *input_style) { register XIMArg *p; for (p = arg; p && p->name; p++) { if (!(strcmp(p->name, XNInputStyle))) { *input_style = (XIMStyle)p->value; return True; } } return False; } #ifdef XIM_CONNECTABLE static Bool _XimDelayModeCreateIC( Xic ic, XIMArg *values, XIMResourceList res, unsigned int num) { Xim im = (Xim)ic->core.im; XimDefICValues ic_values; int len; XIMStyle input_style; bzero((char *)&ic_values, sizeof(XimDefICValues)); _XimGetCurrentICValues(ic, &ic_values); if (!(_XimGetInputStyle(values, &input_style))) return False; _XimSetICMode(res, num, input_style); if (_XimSetICValueData(ic, (XPointer)&ic_values, res, num, values, XIM_CREATEIC, False)) { return False; } _XimSetCurrentICValues(ic, &ic_values); if (!_XimSetICDefaults(ic, (XPointer)&ic_values, XIM_SETICDEFAULTS, res, num)) { return False; } ic_values.filter_events = KeyPressMask; _XimSetCurrentICValues(ic, &ic_values); _XimRegisterFilter(ic); return True; } Bool _XimReconnectModeCreateIC(ic) Xic ic; { Xim im = (Xim)ic->core.im; int len; XIMStyle input_style = ic->core.input_style; XIMResourceList res; unsigned int num; num = im->core.ic_num_resources; len = sizeof(XIMResource) * num; if (!(res = Xmalloc(len))) return False; (void)memcpy((char *)res, (char *)im->core.ic_resources, len); ic->private.proto.ic_resources = res; ic->private.proto.ic_num_resources = num; _XimSetICMode(res, num, input_style); ic->core.filter_events = KeyPressMask; return True; } #endif /* XIM_CONNECTABLE */ XIC _XimProtoCreateIC( XIM xim, XIMArg *arg) { Xim im = (Xim)xim; Xic ic; XimDefICValues ic_values; XIMResourceList res; unsigned int num; XIMStyle input_style; INT16 len; CARD16 *buf_s; char *tmp; CARD32 tmp_buf32[BUFSIZE/4]; char *tmp_buf = (char *)tmp_buf32; char *buf; int buf_size; char *data; int data_len; int ret_len; int total; XIMArg *arg_ret; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int ret_code; #ifdef XIM_CONNECTABLE if (!IS_SERVER_CONNECTED(im) && !IS_CONNECTABLE(im)) return (XIC)NULL; #else if (!IS_SERVER_CONNECTED(im)) return (XIC)NULL; #endif /* XIM_CONNECTABLE */ if (!(_XimGetInputStyle(arg, &input_style))) return (XIC)NULL; if ((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL) return (XIC)NULL; ic->methods = &ic_methods; ic->core.im = (XIM)im; ic->core.input_style = input_style; num = im->core.ic_num_resources; len = sizeof(XIMResource) * num; if (!(res = Xmalloc(len))) goto ErrorOnCreatingIC; (void)memcpy((char *)res, (char *)im->core.ic_resources, len); ic->private.proto.ic_resources = res; ic->private.proto.ic_num_resources = num; #ifdef XIM_CONNECTABLE if (!_XimSaveICValues(ic, arg)) return False; if (!IS_SERVER_CONNECTED(im)) { if (!_XimConnectServer(im)) { if (_XimDelayModeCreateIC(ic, arg, res, num)) { return (XIC)ic; } goto ErrorOnCreatingIC; } } #endif /* XIM_CONNECTABLE */ ic->core.filter_events = im->private.proto.forward_event_mask; ic->private.proto.forward_event_mask = im->private.proto.forward_event_mask; ic->private.proto.synchronous_event_mask = im->private.proto.synchronous_event_mask; num = im->private.proto.ic_num_inner_resources; len = sizeof(XIMResource) * num; if (!(res = Xmalloc(len))) goto ErrorOnCreatingIC; (void)memcpy((char *)res, (char *)im->private.proto.ic_inner_resources, len); ic->private.proto.ic_inner_resources = res; ic->private.proto.ic_num_inner_resources = num; _XimSetICMode(ic->private.proto.ic_resources, ic->private.proto.ic_num_resources, input_style); _XimSetICMode(ic->private.proto.ic_inner_resources, ic->private.proto.ic_num_inner_resources, input_style); _XimGetCurrentICValues(ic, &ic_values); buf = tmp_buf; buf_size = XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(INT16); data_len = BUFSIZE - buf_size; total = 0; arg_ret = arg; for (;;) { data = &buf[buf_size]; if (_XimEncodeICATTRIBUTE(ic, ic->private.proto.ic_resources, ic->private.proto.ic_num_resources, arg, &arg_ret, data, data_len, &ret_len, (XPointer)&ic_values, 0, XIM_CREATEIC)) { goto ErrorOnCreatingIC; } total += ret_len; if (!(arg = arg_ret)) { break; } buf_size += ret_len; if (buf == tmp_buf) { if (!(tmp = Xmalloc(buf_size + data_len))) { goto ErrorOnCreatingIC; } memcpy(tmp, buf, buf_size); buf = tmp; } else { if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { Xfree(buf); goto ErrorOnCreatingIC; } buf = tmp; } } _XimSetCurrentICValues(ic, &ic_values); if (!(_XimCheckCreateICValues(ic->private.proto.ic_resources, ic->private.proto.ic_num_resources))) goto ErrorOnCreatingIC; _XimRegisterFilter(ic); buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; buf_s[0] = im->private.proto.imid; buf_s[1] = (INT16)total; len = (INT16)(sizeof(CARD16) + sizeof(INT16) + total); _XimSetHeader((XPointer)buf, XIM_CREATE_IC, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) { if (buf != tmp_buf) Xfree(buf); goto ErrorOnCreatingIC; } _XimFlush(im); if (buf != tmp_buf) Xfree(buf); ic->private.proto.waitCallback = True; buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimCreateICCheck, 0); if (ret_code == XIM_TRUE) { preply = reply; } else if (ret_code == XIM_OVERFLOW) { if (len <= 0) { preply = reply; } else { buf_size = (int)len; preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimCreateICCheck, 0); if (ret_code != XIM_TRUE) { Xfree(preply); ic->private.proto.waitCallback = False; goto ErrorOnCreatingIC; } } } else { ic->private.proto.waitCallback = False; goto ErrorOnCreatingIC; } ic->private.proto.waitCallback = False; buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if (reply != preply) Xfree(preply); goto ErrorOnCreatingIC; } ic->private.proto.icid = buf_s[1]; /* icid */ if (reply != preply) Xfree(preply); MARK_IC_CONNECTED(ic); return (XIC)ic; ErrorOnCreatingIC: _XimUnregisterFilter(ic); Xfree(ic->private.proto.ic_resources); Xfree(ic->private.proto.ic_inner_resources); Xfree(ic); return (XIC)NULL; } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imDefIm.c0000644000000000000000000013710313614532331016731 0ustar /* * Copyright 1990, 1991, 1992 Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1993, 1994 by Sony Corporation Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital, FUJITSU LIMITED and Sony Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL, FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL, FUJITSU LIMITED AND SONY CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp Makoto Wakamatsu Sony Corporation makoto@sm.sony.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xlcint.h" #include "XlcPublic.h" #include "XlcPubI.h" #include "XimTrInt.h" #include "Ximint.h" int _XimCheckDataSize( XPointer buf, int len) { CARD16 *buf_s = (CARD16 *)buf; if(len < XIM_HEADER_SIZE) return -1; return buf_s[1]; } void _XimSetHeader( XPointer buf, CARD8 major_opcode, CARD8 minor_opcode, INT16 *len ) { CARD8 *buf_b = (CARD8 *)buf; CARD16 *buf_s = (CARD16 *)buf; buf_b[0] = major_opcode; buf_b[1] = minor_opcode; buf_s[1] = ((*len) / 4); *len += XIM_HEADER_SIZE; return; } char _XimGetMyEndian(void) { CARD16 test_card = 1; if(*((char *)&test_card)) return LITTLEENDIAN; else return BIGENDIAN; } static Bool _XimCheckServerName( Xim im, char *str) { char *server_name = im->core.im_name; int len; int str_len; int category_len = strlen(XIM_SERVER_CATEGORY); char *pp; register char *p; if(server_name && *server_name) len = strlen(server_name); else return True; if((int)strlen(str) < category_len) return False; if(strncmp(str, XIM_SERVER_CATEGORY, category_len)) return False; pp = &str[category_len]; for(;;) { for(p = pp; (*p != ',') && (*p); p++); str_len = (int)(p - pp); if((len == str_len) && (!strncmp(pp, server_name, len))) break; if(!(*p)) return False; pp = p + 1; } return True; } static char * _XimCheckLocaleName( Xim im, char *address, int address_len, char *locale_name[], int len) { int category_len; char *pp; register char *p; register int n; Bool finish = False; category_len = strlen(XIM_LOCAL_CATEGORY); if(address_len < category_len) return (char*)NULL; if(strncmp(address, XIM_LOCAL_CATEGORY, category_len)) return (char*)NULL; pp = &address[category_len]; for(;;) { for( p = pp; *p && *p != ','; p++); if (!*p) finish = True; address_len = (int)(p - pp); *p = '\0'; for( n = 0; n < len; n++ ) if( locale_name[n] && !_XlcCompareISOLatin1( pp, locale_name[n] ) ) return locale_name[n]; if (finish) break; pp = p + 1; } return (char *)NULL; } static Bool _XimCheckTransport( char *address, int address_len, const char *transport, int len, char **trans_addr) { int category_len = strlen(XIM_TRANSPORT_CATEGORY); char *pp; register char *p; if(address_len < category_len) return False; if(strncmp(address, XIM_TRANSPORT_CATEGORY, category_len)) return False; pp = &address[category_len]; for(;;) { *trans_addr = pp; for(p = pp; (*p != '/') && (*p != ',') && (*p); p++); if(*p == ',') { pp = p + 1; continue; } if(!(*p)) return False; address_len = (int)(p - pp); if((len == address_len) && (!strncmp(pp, transport, len))) break; pp = p + 1; } pp = p + 1; for(p = pp; (*p != ',') && (*p); p++); if (*p) *p = '\0'; return True; } static Bool _CheckSNEvent( Display *display, XEvent *xevent, XPointer arg) { XSelectionEvent *event = (XSelectionEvent *)xevent; Window window = *(Window*)arg; if((event->type == SelectionNotify) && (window == event->requestor)) return True; return False; } static Bool _XimGetSelectionNotify( Display *display, Window window, Atom target, char **ret_address) { XEvent event; XSelectionEvent *ev = (XSelectionEvent *)&event; Atom actual_type; int actual_format; unsigned long nitems, bytes_after; for(;;) { XIfEvent(display, &event, _CheckSNEvent, (XPointer)&window); if((ev->type == SelectionNotify) && (window == ev->requestor)) break; } if(ev->property == (Atom)None) return False; if( XGetWindowProperty( display, window, target, 0L, 1000000L, True, target, &actual_type, &actual_format, &nitems, &bytes_after, (unsigned char **)&*ret_address ) != Success ) return False; return True; } static Bool _XimPreConnectionIM( Xim im, Atom selection) { Display *display = im->core.display; Atom locales, transport; char *address; XLCd lcd; char *language; char *territory; char *codeset; char *trans_addr; char *locale_name[4], *locale; int llen, tlen, clen; register int i; Window window; char *str; if(!(lcd = im->core.lcd)) return False; for( i = 0; i < 4; i++ ) locale_name[i] = NULL; /* requestor window */ if(!(window = XCreateSimpleWindow(display, DefaultRootWindow(display), 0, 0, 1, 1, 1, 0, 0))) return False; /* server name check */ if( !(str = XGetAtomName( display, selection )) ) return False; if(!_XimCheckServerName(im, str)) { XFree( (XPointer)str ); goto Error; } XFree( (XPointer)str ); /* locale name check */ _XGetLCValues(lcd, XlcNLanguage, &language, XlcNTerritory, &territory, XlcNCodeset, &codeset, NULL); llen = strlen( language ); tlen = territory ? strlen( territory ): 0; clen = codeset ? strlen( codeset ): 0; if( tlen != 0 && clen != 0 ) { if( (locale_name[0] = Xmalloc(llen+tlen+clen+3)) != NULL ) sprintf( locale_name[0], "%s_%s.%s", language, territory, codeset ); } if( clen != 0 ) { if( (locale_name[1] = Xmalloc(llen+clen+2)) != NULL ) sprintf( locale_name[1], "%s.%s", language, codeset ); else goto Error; } if( tlen != 0 ) { if( (locale_name[2] = Xmalloc(llen+tlen+2)) != NULL ) sprintf( locale_name[2], "%s_%s", language, territory ); else goto Error; } if( (locale_name[3] = Xmalloc(llen+1)) != NULL ) strcpy( locale_name[3], language ); else goto Error; if((locales = XInternAtom(display, XIM_LOCALES, True)) == (Atom)None) goto Error; XConvertSelection(display, selection, locales, locales, window, CurrentTime); if(!(_XimGetSelectionNotify(display, window, locales, &address))) goto Error; if((locale = _XimCheckLocaleName(im, address, strlen(address), locale_name, 4)) == NULL) { XFree((XPointer)address); goto Error; } im->private.proto.locale_name = locale; for( i = 0; i < 4; i++ ) { if( locale_name[i] != NULL && locale_name[i] != locale ) { XFree( locale_name[i] ); locale_name[i] = NULL; } } XFree((XPointer)address); /* transport check */ if((transport = XInternAtom(display, XIM_TRANSPORT, True)) == (Atom)None) goto Error; XConvertSelection(display, selection, transport, transport, window, CurrentTime); if(!_XimGetSelectionNotify(display, window, transport, &address)) goto Error; for(i = 0; _XimTransportRec[i].transportname ; i++) { if( _XimCheckTransport(address, strlen(address), _XimTransportRec[i].transportname, strlen(_XimTransportRec[i].transportname), &trans_addr)) { if( _XimTransportRec[i].config(im, trans_addr) ) { XFree((XPointer)address); XDestroyWindow(display, window); return True; } } } XFree((XPointer)address); Error: for( i = 0; i < 4; i++ ) if( locale_name[i] != NULL ) XFree( locale_name[i] ); XDestroyWindow(display, window); return False; } static Bool _XimPreConnect( Xim im) { Display *display = im->core.display; Atom imserver; Atom actual_type; int actual_format; unsigned long nitems; unsigned long bytes_after; unsigned char *prop_return; Atom *atoms; Window im_window = 0; register int i; if((imserver = XInternAtom(display, XIM_SERVERS, True)) == (Atom)None) return False; if(XGetWindowProperty(display, RootWindow(display, 0), imserver, 0L, 1000000L, False, XA_ATOM, &actual_type, &actual_format, &nitems, &bytes_after, &prop_return) != Success) return False; if( (actual_type != XA_ATOM) || (actual_format != 32) ) { if( nitems ) XFree((XPointer)prop_return); return False; } atoms = (Atom *)prop_return; for(i = 0; i < nitems; i++) { if((im_window = XGetSelectionOwner(display, atoms[i])) == (Window)None) continue; if(_XimPreConnectionIM(im, atoms[i])) break; } XFree((XPointer)prop_return); if(i >= nitems) return False; im->private.proto.im_window = im_window; return True; } static Bool _XimGetAuthProtocolNames( Xim im, CARD16 *buf, CARD8 *num, INT16 *len) { if (!IS_USE_AUTHORIZATION_FUNC(im)) { *num = 0; *len = 0; return True; } /* * Not yet */ return True; } static Bool _XimSetAuthReplyData( Xim im, XPointer buf, INT16 *len) { /* * Not yet */ *len = 0; return True; } static Bool _XimSetAuthNextData( Xim im, XPointer buf, INT16 *len) { /* * Not yet */ *len = 0; return True; } static Bool _XimSetAuthRequiredData( Xim im, XPointer buf, INT16 *len) { /* * Not yet */ *len = 0; return True; } static Bool _XimCheckAuthSetupData( Xim im, XPointer buf) { /* * Not yet */ return True; } static Bool _XimCheckAuthNextData( Xim im, XPointer buf) { /* * Not yet */ return True; } #define NO_MORE_AUTH 2 #define GOOD_AUTH 1 #define BAD_AUTH 0 static int _XimClientAuthCheck( Xim im, XPointer buf) { /* * Not yet */ return NO_MORE_AUTH; } static void _XimAuthNG( Xim im) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; INT16 len = 0; _XimSetHeader((XPointer)buf, XIM_AUTH_NG, 0, &len); (void)_XimWrite(im, len, (XPointer)buf); _XimFlush(im); return; } static Bool _XimAllRecv( Xim im, INT16 len, XPointer data, XPointer arg) { return True; } #define CLIENT_WAIT1 1 #define CLIENT_WAIT2 2 static Bool _XimConnection( Xim im) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD8 *buf_b = &buf[XIM_HEADER_SIZE]; CARD16 *buf_s = (CARD16 *)((XPointer)buf_b); INT16 len; CARD8 num; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int buf_size; int ret_code; CARD8 major_opcode; int wait_mode; int ret; if(!(_XimConnect(im))) /* Transport Connect */ return False; if(!_XimDispatchInit(im)) return False; _XimRegProtoIntrCallback(im, XIM_ERROR, 0, _XimErrorCallback, (XPointer)im); if(!_XimGetAuthProtocolNames(im, &buf_s[4], &num, &len)) return False; im->private.proto.protocol_major_version = PROTOCOLMAJORVERSION; im->private.proto.protocol_minor_version = PROTOCOLMINORVERSION; buf_b[0] = _XimGetMyEndian(); buf_b[1] = 0; buf_s[1] = PROTOCOLMAJORVERSION; buf_s[2] = PROTOCOLMINORVERSION; buf_s[3] = num; len += sizeof(CARD8) + sizeof(CARD8) + sizeof(CARD16) + sizeof(CARD16) + sizeof(CARD16); major_opcode = XIM_CONNECT; wait_mode = (IS_USE_AUTHORIZATION_FUNC(im)) ? CLIENT_WAIT1 : CLIENT_WAIT2; for(;;) { _XimSetHeader((XPointer)buf, major_opcode, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) return False; _XimFlush(im); buf_size = BUFSIZE; ret_code = _XimRead(im, &len, reply, buf_size, _XimAllRecv, 0); if(ret_code == XIM_TRUE) { preply = reply; } else if(ret_code == XIM_OVERFLOW) { if(len <= 0) { preply = reply; } else { buf_size = len; preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimAllRecv, 0); if(ret_code != XIM_TRUE) { Xfree(preply); return False; } } } else return False; major_opcode = *((CARD8 *)preply); buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (wait_mode == CLIENT_WAIT1) { if (major_opcode == XIM_AUTH_REQUIRED) { ret = _XimClientAuthCheck(im, (XPointer)buf_s); if(reply != preply) Xfree(preply); if (ret == NO_MORE_AUTH) { if (!(_XimSetAuthReplyData(im, (XPointer)&buf[XIM_HEADER_SIZE], &len))) { _XimAuthNG(im); return False; } major_opcode = XIM_AUTH_REPLY; wait_mode = CLIENT_WAIT2; } else if (ret == GOOD_AUTH) { if (!(_XimSetAuthNextData(im, (XPointer)&buf[XIM_HEADER_SIZE], &len))) { _XimAuthNG(im); return False; } major_opcode = XIM_AUTH_NEXT; } else { /* BAD_AUTH */ _XimAuthNG(im); return False; } } else { if(reply != preply) Xfree(preply); _XimAuthNG(im); return False; } } else { /* CLIENT_WAIT2 */ if (major_opcode == XIM_CONNECT_REPLY) { break; } else if (major_opcode == XIM_AUTH_SETUP) { if (!(_XimCheckAuthSetupData(im, (XPointer)buf_s))) { _XimAuthNG(im); return False; } if(reply != preply) Xfree(preply); if (!(_XimSetAuthRequiredData(im, (XPointer)&buf[XIM_HEADER_SIZE], &len))) { _XimAuthNG(im); return False; } major_opcode = XIM_AUTH_REQUIRED; } else if (major_opcode == XIM_AUTH_NEXT) { if (!(_XimCheckAuthNextData(im, (XPointer)buf_s))) { _XimAuthNG(im); return False; } if(reply != preply) Xfree(preply); if (!(_XimSetAuthRequiredData(im, (XPointer)&buf[XIM_HEADER_SIZE], &len))) { _XimAuthNG(im); return False; } major_opcode = XIM_AUTH_REQUIRED; } else if (major_opcode == XIM_AUTH_NG) { if(reply != preply) Xfree(preply); return False; } else { _XimAuthNG(im); if(reply != preply) Xfree(preply); return False; } } } if (!( buf_s[0] == im->private.proto.protocol_major_version && buf_s[1] == im->private.proto.protocol_minor_version)) { if(reply != preply) Xfree(preply); return False; } if(reply != preply) Xfree(preply); MARK_SERVER_CONNECTED(im); _XimRegProtoIntrCallback(im, XIM_REGISTER_TRIGGERKEYS, 0, _XimRegisterTriggerKeysCallback, (XPointer)im); return True; } static Bool _XimDisconnectCheck( Xim im, INT16 len, XPointer data, XPointer arg) { CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); if ((major_opcode == XIM_DISCONNECT_REPLY) && (minor_opcode == 0)) return True; if ((major_opcode == XIM_ERROR) && (minor_opcode == 0)) return True; return False; } static Bool _XimDisconnect( Xim im) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; INT16 len = 0; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int buf_size; int ret_code; if (IS_SERVER_CONNECTED(im)) { _XimSetHeader((XPointer)buf, XIM_DISCONNECT, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) return False; _XimFlush(im); buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimDisconnectCheck, 0); if(ret_code == XIM_OVERFLOW) { if(len > 0) { buf_size = len; preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimDisconnectCheck, 0); Xfree(preply); if(ret_code != XIM_TRUE) return False; } } else if(ret_code == XIM_FALSE) return False; } if (!(_XimShutdown(im))) /* Transport shutdown */ return False; return True; } static Bool _XimOpenCheck( Xim im, INT16 len, XPointer data, XPointer arg) { CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); if ((major_opcode == XIM_OPEN_REPLY) && (minor_opcode == 0)) return True; if ((major_opcode == XIM_ERROR) && (minor_opcode == 0)) return True; return False; } static Bool _XimOpen( Xim im) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD8 *buf_b = &buf[XIM_HEADER_SIZE]; CARD16 *buf_s; INT16 len; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int buf_size; int ret_code; char *locale_name; locale_name = im->private.proto.locale_name; len = strlen(locale_name); buf_b[0] = (BYTE)len; /* length of locale name */ (void)strcpy((char *)&buf_b[1], locale_name); /* locale name */ len += sizeof(BYTE); /* sizeof length */ XIM_SET_PAD(buf_b, len); /* pad */ _XimSetHeader((XPointer)buf, XIM_OPEN, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) return False; _XimFlush(im); buf_size = BUFSIZE; ret_code = _XimRead(im, &len, reply, buf_size, _XimOpenCheck, 0); if(ret_code == XIM_TRUE) { preply = reply; } else if(ret_code == XIM_OVERFLOW) { if(len <= 0) { preply = reply; } else { buf_size = len; preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimOpenCheck, 0); if(ret_code != XIM_TRUE) { Xfree(preply); return False; } } } else return False; buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if(reply != preply) Xfree(preply); return False; } im->private.proto.imid = buf_s[0]; /* imid */ if (!(_XimGetAttributeID(im, &buf_s[1]))) { if(reply != preply) Xfree(preply); return False; } if(reply != preply) Xfree(preply); if (!(_XimSetInnerIMResourceList(&(im->private.proto.im_inner_resources), &(im->private.proto.im_num_inner_resources)))) return False; if (!(_XimSetInnerICResourceList(&(im->private.proto.ic_inner_resources), &(im->private.proto.ic_num_inner_resources)))) return False; _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); _XimSetIMMode(im->private.proto.im_inner_resources, im->private.proto.im_num_inner_resources); /* Transport Callbak */ _XimRegProtoIntrCallback(im, XIM_SET_EVENT_MASK, 0, _XimSetEventMaskCallback, (XPointer)im); _XimRegProtoIntrCallback(im, XIM_FORWARD_EVENT, 0, _XimForwardEventCallback, (XPointer)im); _XimRegProtoIntrCallback(im, XIM_COMMIT, 0, _XimCommitCallback, (XPointer)im); _XimRegProtoIntrCallback(im, XIM_SYNC, 0, _XimSyncCallback, (XPointer)im); if(!_XimExtension(im)) return False; /* register a hook for callback protocols */ _XimRegisterDispatcher(im, _XimCbDispatch, (XPointer)im); return True; } static Bool _XimCloseCheck( Xim im, INT16 len, XPointer data, XPointer arg) { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); XIMID imid = buf_s[0]; if ((major_opcode == XIM_CLOSE_REPLY) && (minor_opcode == 0) && (imid == im->private.proto.imid)) return True; if ((major_opcode == XIM_ERROR) && (minor_opcode == 0) && (buf_s[2] & XIM_IMID_VALID) && (imid == im->private.proto.imid)) return True; return False; } static Bool _XimClose( Xim im) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; INT16 len; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int buf_size; int ret_code; if (!IS_SERVER_CONNECTED(im)) return True; buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = 0; /* unused */ len = sizeof(CARD16) /* sizeof imid */ + sizeof(CARD16); /* sizeof unused */ _XimSetHeader((XPointer)buf, XIM_CLOSE, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) return False; _XimFlush(im); buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimCloseCheck, 0); if(ret_code == XIM_TRUE) { preply = reply; } else if(ret_code == XIM_OVERFLOW) { if(len <= 0) { preply = reply; } else { buf_size = len; preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimCloseCheck, 0); if(ret_code != XIM_TRUE) { Xfree(preply); return False; } } } else return False; buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if(reply != preply) Xfree(preply); return False; } if(reply != preply) Xfree(preply); return True; } void _XimProtoIMFree( Xim im) { /* XIMPrivateRec */ if (im->private.proto.im_onkeylist) { Xfree(im->private.proto.im_onkeylist); im->private.proto.im_onkeylist = NULL; } if (im->private.proto.im_offkeylist) { Xfree(im->private.proto.im_offkeylist); im->private.proto.im_offkeylist = NULL; } if (im->private.proto.intrproto) { _XimFreeProtoIntrCallback(im); im->private.proto.intrproto = NULL; } if (im->private.proto.im_inner_resources) { Xfree(im->private.proto.im_inner_resources); im->private.proto.im_inner_resources = NULL; } if (im->private.proto.ic_inner_resources) { Xfree(im->private.proto.ic_inner_resources); im->private.proto.ic_inner_resources = NULL; } if (im->private.proto.hold_data) { Xfree(im->private.proto.hold_data); im->private.proto.hold_data = NULL; } if (im->private.proto.locale_name) { Xfree(im->private.proto.locale_name); im->private.proto.locale_name = NULL; } if (im->private.proto.ctom_conv) { _XlcCloseConverter(im->private.proto.ctom_conv); im->private.proto.ctom_conv = NULL; } if (im->private.proto.ctow_conv) { _XlcCloseConverter(im->private.proto.ctow_conv); im->private.proto.ctow_conv = NULL; } if (im->private.proto.ctoutf8_conv) { _XlcCloseConverter(im->private.proto.ctoutf8_conv); im->private.proto.ctoutf8_conv = NULL; } if (im->private.proto.cstomb_conv) { _XlcCloseConverter(im->private.proto.cstomb_conv); im->private.proto.cstomb_conv = NULL; } if (im->private.proto.cstowc_conv) { _XlcCloseConverter(im->private.proto.cstowc_conv); im->private.proto.cstowc_conv = NULL; } if (im->private.proto.cstoutf8_conv) { _XlcCloseConverter(im->private.proto.cstoutf8_conv); im->private.proto.cstoutf8_conv = NULL; } if (im->private.proto.ucstoc_conv) { _XlcCloseConverter(im->private.proto.ucstoc_conv); im->private.proto.ucstoc_conv = NULL; } if (im->private.proto.ucstoutf8_conv) { _XlcCloseConverter(im->private.proto.ucstoutf8_conv); im->private.proto.ucstoutf8_conv = NULL; } #ifdef XIM_CONNECTABLE if (!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { return; } #endif /* XIM_CONNECTABLE */ if (im->private.proto.saved_imvalues) { Xfree(im->private.proto.saved_imvalues); im->private.proto.saved_imvalues = NULL; } if (im->private.proto.default_styles) { Xfree(im->private.proto.default_styles); im->private.proto.default_styles = NULL; } /* core */ if (im->core.res_name) { Xfree(im->core.res_name); im->core.res_name = NULL; } if (im->core.res_class) { Xfree(im->core.res_class); im->core.res_class = NULL; } if (im->core.im_values_list) { Xfree(im->core.im_values_list); im->core.im_values_list = NULL; } if (im->core.ic_values_list) { Xfree(im->core.ic_values_list); im->core.ic_values_list = NULL; } if (im->core.im_name) { Xfree(im->core.im_name); im->core.im_name = NULL; } if (im->core.styles) { Xfree(im->core.styles); im->core.styles = NULL; } if (im->core.im_resources) { Xfree(im->core.im_resources); im->core.im_resources = NULL; } if (im->core.ic_resources) { Xfree(im->core.ic_resources); im->core.ic_resources = NULL; } return; } static Status _XimProtoCloseIM( XIM xim) { Xim im = (Xim)xim; XIC ic; XIC next; Status status; ic = im->core.ic_chain; while (ic) { (*ic->methods->destroy) (ic); next = ic->core.next; #ifdef XIM_CONNECTABLE if (!(!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im))) { Xfree (ic); } #else Xfree (ic); #endif /* XIM_CONNECTABLE */ ic = next; } #ifdef XIM_CONNECTABLE if (!(!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im))) im->core.ic_chain = NULL; #else im->core.ic_chain = NULL; #endif _XimUnregisterServerFilter(im); _XimResetIMInstantiateCallback(im); status = (Status)_XimClose(im); status = (Status)_XimDisconnect(im) && status; _XimProtoIMFree(im); #ifdef XIM_CONNECTABLE if (!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { _XimReconnectModeSetAttr(im); for (ic = im->core.ic_chain; ic; ic = ic->core.next) { _XimReconnectModeCreateIC(ic); } return 0; } #endif /* XIM_CONNECTABLE */ _XimDestroyIMStructureList(im); return status; } #ifdef XIM_CONNECTABLE static Bool _XimCheckIMQuarkList( XrmQuark *quark_list, int num_quark, XrmQuark quark) { register int i; for (i = 0; i < num_quark; i++) { if (quark_list[i] == quark) { return True; } } return False; } static Bool _XimSaveIMValues( Xim im, XIMArg *arg) { register XIMArg *p; register int n; XrmQuark *quark_list; XrmQuark *tmp; XrmQuark quark; int num_quark; if (quark_list = im->private.proto.saved_imvalues) { num_quark = im->private.proto.num_saved_imvalues; for (p = arg; p && p->name; p++) { quark = XrmStringToQuark(p->name); if (_XimCheckIMQuarkList(quark_list, num_quark, quark)) { continue; } if (!(tmp = Xrealloc(quark_list, (sizeof(XrmQuark) * (num_quark + 1))))) { im->private.proto.saved_imvalues = quark_list; im->private.proto.num_saved_imvalues = num_quark; return False; } num_quark++; quark_list = tmp; quark_list[num_quark] = quark; } im->private.proto.saved_imvalues = quark_list; im->private.proto.num_saved_imvalues = num_quark; return True; } for (p = arg, n = 0; p && p->name; p++, n++); if (!(quark_list = Xmalloc(sizeof(XrmQuark) * n))) { return False; } im->private.proto.saved_imvalues = quark_list; im->private.proto.num_saved_imvalues = n; for (p = arg; p && p->name; p++, quark_list++) { *quark_list = XrmStringToQuark(p->name); } return True; } static char * _XimDelayModeSetIMValues( Xim im, XIMArg *arg) { XimDefIMValues im_values; char *name; XIMArg *values; _XimGetCurrentIMValues(im, &im_values); name = _XimSetIMValueData(im, (XPointer)&im_values, values, im->core.im_resources, im->core.im_num_resources); _XimSetCurrentIMValues(im, &im_values); return name; } #endif /* XIM_CONNECTABLE */ static Bool _XimSetIMValuesCheck( Xim im, INT16 len, XPointer data, XPointer arg) { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); XIMID imid = buf_s[0]; if ((major_opcode == XIM_SET_IM_VALUES_REPLY) && (minor_opcode == 0) && (imid == im->private.proto.imid)) return True; if ((major_opcode == XIM_ERROR) && (minor_opcode == 0) && (buf_s[2] & XIM_IMID_VALID) && (imid == im->private.proto.imid)) return True; return False; } static char * _XimProtoSetIMValues( XIM xim, XIMArg *arg) { Xim im = (Xim)xim; XimDefIMValues im_values; INT16 len; CARD16 *buf_s; char *tmp; CARD32 tmp_buf32[BUFSIZE/4]; char *tmp_buf = (char *)tmp_buf32; char *buf; int buf_size; char *data; int data_len; int ret_len; int total; XIMArg *arg_ret; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int ret_code; char *name; #ifndef XIM_CONNECTABLE if (!IS_SERVER_CONNECTED(im)) return arg->name; #else if (!_XimSaveIMValues(im, arg)) return arg->name; if (!IS_SERVER_CONNECTED(im)) { if (IS_CONNECTABLE(im)) { if (!_XimConnectServer(im)) { return _XimDelayModeSetIMValues(im, arg); } } else { return arg->name; } } #endif /* XIM_CONNECTABLE */ _XimGetCurrentIMValues(im, &im_values); buf = tmp_buf; buf_size = XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(INT16); data_len = BUFSIZE - buf_size; total = 0; arg_ret = arg; for (;;) { data = &buf[buf_size]; if ((name = _XimEncodeIMATTRIBUTE(im, im->core.im_resources, im->core.im_num_resources, arg, &arg_ret, data, data_len, &ret_len, (XPointer)&im_values, XIM_SETIMVALUES))) { if (buf != tmp_buf) Xfree(buf); break; } total += ret_len; if (!(arg = arg_ret)) { break; } buf_size += ret_len; if (buf == tmp_buf) { if (!(tmp = Xmalloc(buf_size + data_len))) { return arg->name; } memcpy(tmp, buf, buf_size); buf = tmp; } else { if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { Xfree(buf); return arg->name; } buf = tmp; } } _XimSetCurrentIMValues(im, &im_values); if (!total) return (char *)NULL; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; buf_s[0] = im->private.proto.imid; buf_s[1] = (INT16)total; len = (INT16)(sizeof(CARD16) + sizeof(INT16) + total); _XimSetHeader((XPointer)buf, XIM_SET_IM_VALUES, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) { if (buf != tmp_buf) Xfree(buf); return arg->name; } _XimFlush(im); if (buf != tmp_buf) Xfree(buf); buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimSetIMValuesCheck, 0); if(ret_code == XIM_TRUE) { preply = reply; } else if(ret_code == XIM_OVERFLOW) { if(len <= 0) { preply = reply; } else { buf_size = (int)len; preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, reply, buf_size, _XimSetIMValuesCheck, 0); if(ret_code != XIM_TRUE) { Xfree(preply); return arg->name; } } } else return arg->name; buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if(reply != preply) Xfree(preply); return arg->name; } if(reply != preply) Xfree(preply); return name; } #ifdef XIM_CONNECTABLE static char * _XimDelayModeGetIMValues( Xim im, XIMArg *arg) { XimDefIMValues im_values; _XimGetCurrentIMValues(im, &im_values); return(_XimGetIMValueData(im, (XPointer)&im_values, arg, im->core.im_resources, im->core.im_num_resources)); } #endif /* XIM_CONNECTABLE */ static Bool _XimGetIMValuesCheck( Xim im, INT16 len, XPointer data, XPointer arg) { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); XIMID imid = buf_s[0]; if ((major_opcode == XIM_GET_IM_VALUES_REPLY) && (minor_opcode == 0) && (imid == im->private.proto.imid)) return True; if ((major_opcode == XIM_ERROR) && (minor_opcode == 0) && (buf_s[2] & XIM_IMID_VALID) && (imid == im->private.proto.imid)) return True; return False; } static char * _XimProtoGetIMValues( XIM xim, XIMArg *arg) { Xim im = (Xim)xim; register XIMArg *p; register int n; CARD8 *buf; CARD16 *buf_s; INT16 len; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply = NULL; int buf_size; int ret_code; char *makeid_name; char *decode_name; CARD16 *data = NULL; INT16 data_len = 0; #ifndef XIM_CONNECTABLE if (!IS_SERVER_CONNECTED(im)) return arg->name; #else if (!IS_SERVER_CONNECTED(im)) { if (IS_CONNECTABLE(im)) { if (!_XimConnectServer(im)) { return _XimDelayModeGetIMValues(im, arg); } } else { return arg->name; } } #endif /* XIM_CONNECTABLE */ for (n = 0, p = arg; p->name; p++) n++; if (!n) return (char *)NULL; buf_size = sizeof(CARD16) * n; buf_size += XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(INT16) + XIM_PAD(buf_size); if (!(buf = Xmalloc(buf_size))) return arg->name; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; makeid_name = _XimMakeIMAttrIDList(im, im->core.im_resources, im->core.im_num_resources, arg, &buf_s[2], &len, XIM_GETIMVALUES); if (len) { buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = len; /* length of im-attr-id */ XIM_SET_PAD(&buf_s[2], len); /* pad */ len += sizeof(CARD16) /* sizeof imid */ + sizeof(INT16); /* sizeof length of attr */ _XimSetHeader((XPointer)buf, XIM_GET_IM_VALUES, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) { Xfree(buf); return arg->name; } _XimFlush(im); Xfree(buf); buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimGetIMValuesCheck, 0); if(ret_code == XIM_TRUE) { preply = reply; } else if(ret_code == XIM_OVERFLOW) { if(len <= 0) { preply = reply; } else { buf_size = len; preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimGetIMValuesCheck, 0); if(ret_code != XIM_TRUE) { Xfree(preply); return arg->name; } } } else return arg->name; buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if(reply != preply) Xfree(preply); return arg->name; } data = &buf_s[2]; data_len = buf_s[1]; } decode_name = _XimDecodeIMATTRIBUTE(im, im->core.im_resources, im->core.im_num_resources, data, data_len, arg, XIM_GETIMVALUES); if (reply != preply) Xfree(preply); if (decode_name) return decode_name; else return makeid_name; } static XIMMethodsRec im_methods = { _XimProtoCloseIM, /* close */ _XimProtoSetIMValues, /* set_values */ _XimProtoGetIMValues, /* get_values */ _XimProtoCreateIC, /* create_ic */ _Ximctstombs, /* ctstombs */ _Ximctstowcs, /* ctstowcs */ _Ximctstoutf8 /* ctstoutf8 */ }; static Bool _XimSetEncodingByName( Xim im, char **buf, int *len) { char *encoding = (char *)NULL; int encoding_len; int compound_len; BYTE *ret; _XGetLCValues(im->core.lcd, XlcNCodeset, &encoding, NULL); if (!encoding) { *buf = (char *)NULL; *len = 0; return True; } encoding_len = strlen(encoding); compound_len = strlen("COMPOUND_TEXT"); *len = encoding_len + sizeof(BYTE) + compound_len + sizeof(BYTE); if (!(ret = Xmalloc(*len))) { return False; } *buf = (char *)ret; ret[0] = (BYTE)encoding_len; (void)strncpy((char *)&ret[1], encoding, encoding_len); ret += (encoding_len + sizeof(BYTE)); ret[0] = (BYTE)compound_len; (void)strncpy((char *)&ret[1], "COMPOUND_TEXT", compound_len); return True; } static Bool _XimSetEncodingByDetail( Xim im, char **buf, int *len) { *len = 0; *buf = NULL; return True; } static Bool _XimGetEncoding( Xim im, CARD16 *buf, char *name, int name_len, char *detail, int detail_len) { XLCd lcd = im->core.lcd; CARD16 category = buf[0]; CARD16 idx = buf[1]; int len; XlcConv ctom_conv = NULL; XlcConv ctow_conv = NULL; XlcConv ctoutf8_conv = NULL; XlcConv conv; XimProtoPrivateRec *private = &im->private.proto; if (idx == (CARD16)XIM_Default_Encoding_IDX) { /* XXX */ if (!(ctom_conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte))) return False; if (!(ctow_conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar))) return False; if (!(ctoutf8_conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNUtf8String))) return False; } if (category == XIM_Encoding_NameCategory) { while (name_len > 0) { len = (int)name[0]; if (!strncmp(&name[1], "COMPOUND_TEXT", len)) { if (!(ctom_conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte))) return False; if (!(ctow_conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar))) return False; if (!(ctoutf8_conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNUtf8String))) return False; break; } else { /* * Not yet */ } len += sizeof(BYTE); name_len -= len; name += len; } } else if (category == XIM_Encoding_DetailCategory) { /* * Not yet */ } else { return False; } private->ctom_conv = ctom_conv; private->ctow_conv = ctow_conv; private->ctoutf8_conv = ctoutf8_conv; if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte))) return False; private->cstomb_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNWideChar))) return False; private->cstowc_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String))) return False; private->cstoutf8_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) return False; private->ucstoc_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) return False; private->ucstoutf8_conv = conv; return True; } static Bool _XimEncodingNegoCheck( Xim im, INT16 len, XPointer data, XPointer arg) { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); XIMID imid = buf_s[0]; if ((major_opcode == XIM_ENCODING_NEGOTIATION_REPLY) && (minor_opcode == 0) && (imid == im->private.proto.imid)) return True; if ((major_opcode == XIM_ERROR) && (minor_opcode == 0) && (buf_s[2] & XIM_IMID_VALID) && (imid == im->private.proto.imid)) return True; return False; } static Bool _XimEncodingNegotiation( Xim im) { char *name_ptr = 0; int name_len = 0; char *detail_ptr = 0; int detail_len = 0; CARD8 *buf; CARD16 *buf_s; INT16 len; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int buf_size; int ret_code; if (!(_XimSetEncodingByName(im, &name_ptr, &name_len))) return False; if (!(_XimSetEncodingByDetail(im, &detail_ptr, &detail_len))) goto free_name_ptr; len = sizeof(CARD16) + sizeof(INT16) + name_len + XIM_PAD(name_len) + sizeof(INT16) + sizeof(CARD16) + detail_len; if (!(buf = Xmalloc(XIM_HEADER_SIZE + len))) goto free_detail_ptr; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; buf_s[0] = im->private.proto.imid; buf_s[1] = (INT16)name_len; if (name_ptr) (void)memcpy((char *)&buf_s[2], name_ptr, name_len); XIM_SET_PAD(&buf_s[2], name_len); buf_s = (CARD16 *)((char *)&buf_s[2] + name_len); buf_s[0] = detail_len; buf_s[1] = 0; if (detail_ptr) (void)memcpy((char *)&buf_s[2], detail_ptr, detail_len); _XimSetHeader((XPointer)buf, XIM_ENCODING_NEGOTIATION, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) { Xfree(buf); goto free_detail_ptr; } _XimFlush(im); Xfree(buf); buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimEncodingNegoCheck, 0); if(ret_code == XIM_TRUE) { preply = reply; } else if(ret_code == XIM_OVERFLOW) { if(len <= 0) { preply = reply; } else { buf_size = len; preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimEncodingNegoCheck, 0); if(ret_code != XIM_TRUE) goto free_preply; } } else goto free_detail_ptr; buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); goto free_preply; } if (!(_XimGetEncoding(im, &buf_s[1], name_ptr, name_len, detail_ptr, detail_len))) goto free_preply; Xfree(name_ptr); Xfree(detail_ptr); if(reply != preply) Xfree(preply); return True; free_preply: if (reply != preply) Xfree(preply); free_detail_ptr: Xfree(detail_ptr); free_name_ptr: Xfree(name_ptr); return False; } #ifdef XIM_CONNECTABLE static Bool _XimSendSavedIMValues( Xim im) { XimDefIMValues im_values; INT16 len; CARD16 *buf_s; char *tmp; CARD32 tmp_buf32[BUFSIZE/4]; char *tmp_buf = (char *)tmp_buf32; char *buf; int buf_size; char *data; int data_len; int ret_len; int total; int idx; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int ret_code; _XimGetCurrentIMValues(im, &im_values); buf = tmp_buf; buf_size = XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(INT16); data_len = BUFSIZE - buf_size; total = 0; idx = 0; for (;;) { data = &buf[buf_size]; if (!_XimEncodeSavedIMATTRIBUTE(im, im->core.im_resources, im->core.im_num_resources, &idx, data, data_len, &ret_len, (XPointer)&im_values, XIM_SETIMVALUES)) { if (buf != tmp_buf) Xfree(buf); return False; } total += ret_len; if (idx == -1) { break; } buf_size += ret_len; if (buf == tmp_buf) { if (!(tmp = Xmalloc(buf_size + data_len))) { return False; } memcpy(tmp, buf, buf_size); buf = tmp; } else { if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { Xfree(buf); return False; } buf = tmp; } } if (!total) return True; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; buf_s[0] = im->private.proto.imid; buf_s[1] = (INT16)total; len = (INT16)(sizeof(CARD16) + sizeof(INT16) + total); _XimSetHeader((XPointer)buf, XIM_SET_IM_VALUES, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) { if (buf != tmp_buf) Xfree(buf); return False; } _XimFlush(im); if (buf != tmp_buf) Xfree(buf); buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimSetIMValuesCheck, 0); if(ret_code == XIM_TRUE) { preply = reply; } else if(ret_code == XIM_OVERFLOW) { if(len <= 0) { preply = reply; } else { buf_size = (int)len; preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, reply, buf_size, _XimSetIMValuesCheck, 0); if(ret_code != XIM_TRUE) { Xfree(preply); return False; } } } else return False; buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if(reply != preply) Xfree(preply); return False; } if(reply != preply) Xfree(preply); return True; } static void _XimDelayModeIMFree( Xim im) { if (im->core.im_resources) { Xfree(im->core.im_resources); im->core.im_resources = NULL; } if (im->core.ic_resources) { Xfree(im->core.ic_resources); im->core.ic_resources = NULL; } if (im->core.im_values_list) { Xfree(im->core.im_values_list); im->core.im_values_list = NULL; } if (im->core.ic_values_list) { Xfree(im->core.ic_values_list); im->core.ic_values_list = NULL; } return; } Bool _XimConnectServer( Xim im) { Xim save_im; if (!(save_im = Xmalloc(sizeof(XimRec)))) return False; memcpy((char *)save_im, (char *)im, sizeof(XimRec)); if (_XimPreConnect(im) && _XimConnection(im) && _XimOpen(im) && _XimEncodingNegotiation(im)) { if (_XimSendSavedIMValues(im)) { _XimDelayModeIMFree(save_im); _XimRegisterServerFilter(im); Xfree(save_im); return True; } } memcpy((char *)im, (char *)save_im, sizeof(XimRec)); Xfree(save_im); return False; } Bool _XimDelayModeSetAttr( Xim im) { XimDefIMValues im_values; if(!_XimSetIMResourceList(&im->core.im_resources, &im->core.im_num_resources)) { return False; } if(!_XimSetICResourceList(&im->core.ic_resources, &im->core.ic_num_resources)) { return False; } _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); _XimGetCurrentIMValues(im, &im_values); if(!_XimSetLocalIMDefaults(im, (XPointer)&im_values, im->core.im_resources, im->core.im_num_resources)) { return False; } _XimSetCurrentIMValues(im, &im_values); if (im->private.proto.default_styles) { if (im->core.styles) Xfree(im->core.styles); im->core.styles = im->private.proto.default_styles; } return True; } static Bool _XimReconnectModeSetAttr( Xim im) { XimDefIMValues im_values; if(!_XimSetIMResourceList(&im->core.im_resources, &im->core.im_num_resources)) { return False; } if(!_XimSetICResourceList(&im->core.ic_resources, &im->core.ic_num_resources)) { return False; } _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); if (im->private.proto.default_styles) { if (im->core.styles) Xfree(im->core.styles); im->core.styles = im->private.proto.default_styles; } return True; } #endif /* XIM_CONNECTABLE */ Bool _XimProtoOpenIM( Xim im) { _XimInitialResourceInfo(); im->methods = &im_methods; #ifdef XIM_CONNECTABLE _XimSetProtoResource(im); #endif /* XIM_CONNECTABLE */ if (_XimPreConnect(im)) { if (_XimConnection(im) && _XimOpen(im) && _XimEncodingNegotiation(im)) { _XimRegisterServerFilter(im); return True; } _XimShutdown(im); #ifdef XIM_CONNECTABLE } else if (IS_DELAYBINDABLE(im)) { if (_XimDelayModeSetAttr(im)) return True; #endif /* XIM_CONNECTABLE */ } _XimProtoIMFree(im); return False; } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imDefLkup.c0000644000000000000000000006507213614532331017304 0ustar /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" Xic _XimICOfXICID( Xim im, XICID icid) { Xic pic; for (pic = (Xic)im->core.ic_chain; pic; pic = (Xic)pic->core.next) { if (pic->private.proto.icid == icid) return pic; } return (Xic)0; } static void _XimProcIMSetEventMask( Xim im, XPointer buf) { EVENTMASK *buf_l = (EVENTMASK *)buf; im->private.proto.forward_event_mask = buf_l[0]; im->private.proto.synchronous_event_mask = buf_l[1]; return; } static void _XimProcICSetEventMask( Xic ic, XPointer buf) { EVENTMASK *buf_l = (EVENTMASK *)buf; ic->private.proto.forward_event_mask = buf_l[0]; ic->private.proto.synchronous_event_mask = buf_l[1]; _XimReregisterFilter(ic); return; } Bool _XimSetEventMaskCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); XIMID imid = buf_s[0]; XICID icid = buf_s[1]; Xim im = (Xim)call_data; Xic ic; if (imid == im->private.proto.imid) { if (icid) { ic = _XimICOfXICID(im, icid); _XimProcICSetEventMask(ic, (XPointer)&buf_s[2]); } else { _XimProcIMSetEventMask(im, (XPointer)&buf_s[2]); } return True; } return False; } static Bool _XimSyncCheck( Xim im, INT16 len, XPointer data, XPointer arg) { Xic ic = (Xic)arg; CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); XIMID imid = buf_s[0]; XICID icid = buf_s[1]; if ((major_opcode == XIM_SYNC_REPLY) && (minor_opcode == 0) && (imid == im->private.proto.imid) && (icid == ic->private.proto.icid)) return True; if ((major_opcode == XIM_ERROR) && (minor_opcode == 0) && (buf_s[2] & XIM_IMID_VALID) && (imid == im->private.proto.imid) && (buf_s[2] & XIM_ICID_VALID) && (icid == ic->private.proto.icid)) return True; return False; } Bool _XimSync( Xim im, Xic ic) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; INT16 len; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int buf_size; int ret_code; buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = ic->private.proto.icid; /* icid */ len = sizeof(CARD16) /* sizeof imid */ + sizeof(CARD16); /* sizeof icid */ _XimSetHeader((XPointer)buf, XIM_SYNC, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) return False; _XimFlush(im); buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimSyncCheck, (XPointer)ic); if(ret_code == XIM_TRUE) { preply = reply; } else if(ret_code == XIM_OVERFLOW) { if(len <= 0) { preply = reply; } else { buf_size = len; preply = Xmalloc(len); ret_code = _XimRead(im, &len, preply, buf_size, _XimSyncCheck, (XPointer)ic); if(ret_code != XIM_TRUE) { Xfree(preply); return False; } } } else { return False; } buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if(reply != preply) Xfree(preply); return False; } if(reply != preply) Xfree(preply); return True; } Bool _XimProcSyncReply( Xim im, Xic ic) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; INT16 len; buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = ic->private.proto.icid; /* icid */ len = sizeof(CARD16) /* sizeof imid */ + sizeof(CARD16); /* sizeof icid */ _XimSetHeader((XPointer)buf, XIM_SYNC_REPLY, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) return False; _XimFlush(im); return True; } Bool _XimRespSyncReply( Xic ic, BITMASK16 mode) { if (mode & XimSYNCHRONUS) /* SYNC Request */ MARK_NEED_SYNC_REPLY(ic->core.im); return True; } Bool _XimSyncCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); XIMID imid = buf_s[0]; XICID icid = buf_s[1]; Xim im = (Xim)call_data; Xic ic; if ((imid == im->private.proto.imid) && (ic = _XimICOfXICID(im, icid))) { (void)_XimProcSyncReply(im, ic); return True; } return False; } static INT16 _XimSetEventToWire( XEvent *ev, xEvent *event) { if (!(_XimProtoEventToWire(ev, event, False))) return 0; event->u.u.sequenceNumber = ((XAnyEvent *)ev)->serial & (unsigned long)0xffff; return sz_xEvent; } static Bool _XimForwardEventCore( Xic ic, XEvent *ev, Bool sync) { Xim im = (Xim)ic->core.im; CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int buf_size; int ret_code; INT16 len; bzero(buf32, sizeof(buf32)); /* valgrind noticed uninitialized memory use! */ if (!(len = _XimSetEventToWire(ev, (xEvent *)&buf_s[4]))) return False; /* X event */ buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = ic->private.proto.icid; /* icid */ buf_s[2] = sync ? XimSYNCHRONUS : 0; /* flag */ buf_s[3] = (CARD16)((((XAnyEvent *)ev)->serial & ~((unsigned long)0xffff)) >> 16); /* serial number */ len += sizeof(CARD16) /* sizeof imid */ + sizeof(CARD16) /* sizeof icid */ + sizeof(BITMASK16) /* sizeof flag */ + sizeof(CARD16); /* sizeof serila number */ _XimSetHeader((XPointer)buf, XIM_FORWARD_EVENT, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) return False; _XimFlush(im); if (sync) { buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimSyncCheck, (XPointer)ic); if(ret_code == XIM_TRUE) { preply = reply; } else if(ret_code == XIM_OVERFLOW) { if(len <= 0) { preply = reply; } else { buf_size = len; preply = Xmalloc(len); ret_code = _XimRead(im, &len, preply, buf_size, _XimSyncCheck, (XPointer)ic); if(ret_code != XIM_TRUE) { Xfree(preply); return False; } } } else { return False; } buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if(reply != preply) Xfree(preply); return False; } if(reply != preply) Xfree(preply); } return True; } Bool _XimForwardEvent( Xic ic, XEvent *ev, Bool sync) { #ifdef EXT_FORWARD if (((ev->type == KeyPress) || (ev->type == KeyRelease))) if (_XimExtForwardKeyEvent(ic, (XKeyEvent *)ev, sync)) return True; #endif return _XimForwardEventCore(ic, ev, sync); } static void _XimProcEvent( Display *d, Xic ic, XEvent *ev, CARD16 *buf) { INT16 serial = buf[0]; xEvent *xev = (xEvent *)&buf[1]; _XimProtoWireToEvent(ev, xev, False); ev->xany.serial |= serial << 16; ev->xany.send_event = False; ev->xany.display = d; MARK_FABRICATED(ic->core.im); return; } static Bool _XimForwardEventRecv( Xim im, Xic ic, XPointer buf) { CARD16 *buf_s = (CARD16 *)buf; Display *d = im->core.display; XEvent ev; _XimProcEvent(d, ic, &ev, &buf_s[1]); (void)_XimRespSyncReply(ic, buf_s[0]); XPutBackEvent(d, &ev); return True; } Bool _XimForwardEventCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); XIMID imid = buf_s[0]; XICID icid = buf_s[1]; Xim im = (Xim)call_data; Xic ic; if ((imid == im->private.proto.imid) && (ic = _XimICOfXICID(im, icid))) { (void)_XimForwardEventRecv(im, ic, (XPointer)&buf_s[2]); return True; } return False; } static Bool _XimRegisterTriggerkey( Xim im, XPointer buf) { CARD32 *buf_l = (CARD32 *)buf; CARD32 len; CARD32 *key; if (IS_DYNAMIC_EVENT_FLOW(im)) /* already Dynamic event flow mode */ return True; /* * register onkeylist */ len = buf_l[0]; /* length of on-keys */ len += sizeof(INT32); /* sizeof length of on-keys */ if (!(key = Xmalloc(len))) { _XimError(im, 0, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); return False; } memcpy((char *)key, (char *)buf_l, len); im->private.proto.im_onkeylist = key; MARK_DYNAMIC_EVENT_FLOW(im); /* * register offkeylist */ buf_l = (CARD32 *)((char *)buf + len); len = buf_l[0]; /* length of off-keys */ len += sizeof(INT32); /* sizeof length of off-keys */ if (!(key = Xmalloc(len))) { _XimError(im, 0, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); return False; } memcpy((char *)key, (char *)buf_l, len); im->private.proto.im_offkeylist = key; return True; } Bool _XimRegisterTriggerKeysCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); Xim im = (Xim)call_data; (void )_XimRegisterTriggerkey(im, (XPointer)&buf_s[2]); return True; } EVENTMASK _XimGetWindowEventmask( Xic ic) { Xim im = (Xim )ic->core.im; XWindowAttributes atr; if (!XGetWindowAttributes(im->core.display, ic->core.focus_window, &atr)) return 0; return (EVENTMASK)atr.your_event_mask; } static Bool _XimTriggerNotifyCheck( Xim im, INT16 len, XPointer data, XPointer arg) { Xic ic = (Xic)arg; CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); XIMID imid = buf_s[0]; XICID icid = buf_s[1]; if ((major_opcode == XIM_TRIGGER_NOTIFY_REPLY) && (minor_opcode == 0) && (imid == im->private.proto.imid) && (icid == ic->private.proto.icid)) return True; if ((major_opcode == XIM_ERROR) && (minor_opcode == 0) && (buf_s[2] & XIM_IMID_VALID) && (imid == im->private.proto.imid) && (buf_s[2] & XIM_ICID_VALID) && (icid == ic->private.proto.icid)) return True; return False; } Bool _XimTriggerNotify( Xim im, Xic ic, int mode, CARD32 idx) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; CARD32 *buf_l = (CARD32 *)&buf[XIM_HEADER_SIZE]; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int buf_size; int ret_code; INT16 len; EVENTMASK mask = _XimGetWindowEventmask(ic); buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = ic->private.proto.icid; /* icid */ buf_l[1] = mode; /* flag */ buf_l[2] = idx; /* index of keys list */ buf_l[3] = mask; /* select-event-mask */ len = sizeof(CARD16) /* sizeof imid */ + sizeof(CARD16) /* sizeof icid */ + sizeof(CARD32) /* sizeof flag */ + sizeof(CARD32) /* sizeof index of key list */ + sizeof(EVENTMASK); /* sizeof select-event-mask */ _XimSetHeader((XPointer)buf, XIM_TRIGGER_NOTIFY, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) return False; _XimFlush(im); buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimTriggerNotifyCheck, (XPointer)ic); if(ret_code == XIM_TRUE) { preply = reply; } else if(ret_code == XIM_OVERFLOW) { if(len <= 0) { preply = reply; } else { buf_size = len; preply = Xmalloc(len); ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimTriggerNotifyCheck, (XPointer)ic); if(ret_code != XIM_TRUE) { Xfree(preply); return False; } } } else { return False; } buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if(reply != preply) Xfree(preply); return False; } if(reply != preply) Xfree(preply); return True; } static Bool _XimRegCommitInfo( Xic ic, char *string, int string_len, KeySym *keysym, int keysym_len) { XimCommitInfo info; if (!(info = Xmalloc(sizeof(XimCommitInfoRec)))) return False; info->string = string; info->string_len = string_len; info->keysym = keysym; info->keysym_len = keysym_len; info->next = ic->private.proto.commit_info; ic->private.proto.commit_info = info; return True; } static void _XimUnregCommitInfo( Xic ic) { XimCommitInfo info; if (!(info = ic->private.proto.commit_info)) return; Xfree(info->string); Xfree(info->keysym); ic->private.proto.commit_info = info->next; Xfree(info); return; } void _XimFreeCommitInfo( Xic ic) { while (ic->private.proto.commit_info) _XimUnregCommitInfo(ic); return; } static Bool _XimProcKeySym( Xic ic, CARD32 sym, KeySym **xim_keysym, int *xim_keysym_len) { Xim im = (Xim)ic->core.im; if (!(*xim_keysym = Xmalloc(sizeof(KeySym)))) { _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); return False; } **xim_keysym = (KeySym)sym; *xim_keysym_len = 1; return True; } static Bool _XimProcCommit( Xic ic, BYTE *buf, int len, char **xim_string, int *xim_string_len) { Xim im = (Xim)ic->core.im; char *string; if (!(string = Xmalloc(len + 1))) { _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); return False; } (void)memcpy(string, (char *)buf, len); string[len] = '\0'; *xim_string = string; *xim_string_len = len; return True; } static Bool _XimCommitRecv( Xim im, Xic ic, XPointer buf) { CARD16 *buf_s = (CARD16 *)buf; BITMASK16 flag = buf_s[0]; XKeyEvent ev; char *string = NULL; int string_len = 0; KeySym *keysym = NULL; int keysym_len = 0; if ((flag & XimLookupBoth) == XimLookupChars) { if (!(_XimProcCommit(ic, (BYTE *)&buf_s[2], (int)buf_s[1], &string, &string_len))) return False; } else if ((flag & XimLookupBoth) == XimLookupKeySym) { if (!(_XimProcKeySym(ic, *(CARD32 *)&buf_s[2], &keysym, &keysym_len))) return False; } else if ((flag & XimLookupBoth) == XimLookupBoth) { if (!(_XimProcKeySym(ic, *(CARD32 *)&buf_s[2], &keysym, &keysym_len))) return False; if (!(_XimProcCommit(ic, (BYTE *)&buf_s[5], (int)buf_s[4], &string, &string_len))) { Xfree(keysym); return False; } } if (!(_XimRegCommitInfo(ic, string, string_len, keysym, keysym_len))) { Xfree(string); Xfree(keysym); _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); return False; } (void)_XimRespSyncReply(ic, flag); if (ic->private.proto.registed_filter_event & (KEYPRESS_MASK | KEYRELEASE_MASK)) MARK_FABRICATED(im); bzero(&ev, sizeof(ev)); /* uninitialized : found when running kterm under valgrind */ ev.type = KeyPress; ev.send_event = False; ev.display = im->core.display; ev.window = ic->core.focus_window; ev.keycode = 0; ev.state = 0; ev.time = 0L; ev.serial = LastKnownRequestProcessed(im->core.display); /* FIXME : I wish there were COMMENTs (!) about the data passed around. */ #if 0 fprintf(stderr,"%s,%d: putback k press FIXED ev.time=0 ev.serial=%lu\n", __FILE__, __LINE__, ev.serial); #endif XPutBackEvent(im->core.display, (XEvent *)&ev); return True; } Bool _XimCommitCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); XIMID imid = buf_s[0]; XICID icid = buf_s[1]; Xim im = (Xim)call_data; Xic ic; if ((imid == im->private.proto.imid) && (ic = _XimICOfXICID(im, icid))) { (void)_XimCommitRecv(im, ic, (XPointer)&buf_s[2]); return True; } return False; } void _XimProcError( Xim im, Xic ic, XPointer data) { return; } Bool _XimErrorCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); BITMASK16 flag = buf_s[2]; XIMID imid; XICID icid; Xim im = (Xim)call_data; Xic ic = NULL; if (flag & XIM_IMID_VALID) { imid = buf_s[0]; if (imid != im->private.proto.imid) return False; } if (flag & XIM_ICID_VALID) { icid = buf_s[1]; if (!(ic = _XimICOfXICID(im, icid))) return False; } _XimProcError(im, ic, (XPointer)&buf_s[3]); return True; } Bool _XimError( Xim im, Xic ic, CARD16 error_code, INT16 detail_length, CARD16 type, char *detail) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; INT16 len = 0; buf_s[0] = im->private.proto.imid; /* imid */ buf_s[2] = XIM_IMID_VALID; /* flag */ if (ic) { buf_s[1] = ic->private.proto.icid; /* icid */ buf_s[2] |= XIM_ICID_VALID; /* flag */ } buf_s[3] = error_code; /* Error Code */ buf_s[4] = detail_length; /* length of error detail */ buf_s[5] = type; /* type of error detail */ if (detail_length && detail) { len = detail_length; memcpy((char *)&buf_s[6], detail, len); XIM_SET_PAD(&buf_s[6], len); } len += sizeof(CARD16) /* sizeof imid */ + sizeof(CARD16) /* sizeof icid */ + sizeof(BITMASK16) /* sizeof flag */ + sizeof(CARD16) /* sizeof error_code */ + sizeof(INT16) /* sizeof length of detail */ + sizeof(CARD16); /* sizeof type */ _XimSetHeader((XPointer)buf, XIM_ERROR, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) return False; _XimFlush(im); return True; } static int _Ximctsconvert( XlcConv conv, char *from, int from_len, char *to, int to_len, Status *state) { int from_left; int to_left; int from_savelen; int to_savelen; int from_cnvlen; int to_cnvlen; char *from_buf; char *to_buf; char scratchbuf[BUFSIZ]; Status tmp_state; if (!state) state = &tmp_state; if (!conv || !from || !from_len) { *state = XLookupNone; return 0; } /* Reset the converter. The CompoundText at 'from' starts in initial state. */ _XlcResetConverter(conv); from_left = from_len; to_left = BUFSIZ; from_cnvlen = 0; to_cnvlen = 0; for (;;) { from_buf = &from[from_cnvlen]; from_savelen = from_left; to_buf = &scratchbuf[to_cnvlen]; to_savelen = to_left; if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { *state = XLookupNone; return 0; } from_cnvlen += (from_savelen - from_left); to_cnvlen += (to_savelen - to_left); if (from_left == 0) { if (!to_cnvlen) { *state = XLookupNone; return 0; } break; } } if (!to || !to_len || (to_len < to_cnvlen)) { *state = XBufferOverflow; } else { memcpy(to, scratchbuf, to_cnvlen); *state = XLookupChars; } return to_cnvlen; } int _Ximctstombs(XIM xim, char *from, int from_len, char *to, int to_len, Status *state) { return _Ximctsconvert(((Xim)xim)->private.proto.ctom_conv, from, from_len, to, to_len, state); } int _Ximctstowcs( XIM xim, char *from, int from_len, wchar_t *to, int to_len, Status *state) { Xim im = (Xim)xim; XlcConv conv = im->private.proto.ctow_conv; int from_left; int to_left; int from_savelen; int to_savelen; int from_cnvlen; int to_cnvlen; char *from_buf; wchar_t *to_buf; wchar_t scratchbuf[BUFSIZ]; Status tmp_state; if (!state) state = &tmp_state; if (!conv || !from || !from_len) { *state = XLookupNone; return 0; } /* Reset the converter. The CompoundText at 'from' starts in initial state. */ _XlcResetConverter(conv); from_left = from_len; to_left = BUFSIZ; from_cnvlen = 0; to_cnvlen = 0; for (;;) { from_buf = &from[from_cnvlen]; from_savelen = from_left; to_buf = &scratchbuf[to_cnvlen]; to_savelen = to_left; if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { *state = XLookupNone; return 0; } from_cnvlen += (from_savelen - from_left); to_cnvlen += (to_savelen - to_left); if (from_left == 0) { if (!to_cnvlen){ *state = XLookupNone; return 0; } break; } } if (!to || !to_len || (to_len < to_cnvlen)) { *state = XBufferOverflow; } else { memcpy(to, scratchbuf, to_cnvlen * sizeof(wchar_t)); *state = XLookupChars; } return to_cnvlen; } int _Ximctstoutf8( XIM xim, char *from, int from_len, char *to, int to_len, Status *state) { return _Ximctsconvert(((Xim)xim)->private.proto.ctoutf8_conv, from, from_len, to, to_len, state); } int _XimProtoMbLookupString( XIC xic, XKeyEvent *ev, char *buffer, int bytes, KeySym *keysym, Status *state) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; int ret; Status tmp_state; XimCommitInfo info; if (!IS_SERVER_CONNECTED(im)) return 0; if (!state) state = &tmp_state; if ((ev->type == KeyPress) && (ev->keycode == 0)) { /* Filter function */ if (!(info = ic->private.proto.commit_info)) { *state = XLookupNone; return 0; } ret = im->methods->ctstombs((XIM)im, info->string, info->string_len, buffer, bytes, state); if (*state == XBufferOverflow) return ret; if (keysym && (info->keysym && *(info->keysym))) { *keysym = *(info->keysym); if (*state == XLookupChars) *state = XLookupBoth; else *state = XLookupKeySym; } _XimUnregCommitInfo(ic); } else if (ev->type == KeyPress) { ret = _XimLookupMBText(ic, ev, buffer, bytes, keysym, NULL); if (ret > 0) { if (ret > bytes) *state = XBufferOverflow; else if (keysym && *keysym != NoSymbol) *state = XLookupBoth; else *state = XLookupChars; } else { if (keysym && *keysym != NoSymbol) *state = XLookupKeySym; else *state = XLookupNone; } } else { *state = XLookupNone; ret = 0; } return ret; } int _XimProtoWcLookupString( XIC xic, XKeyEvent *ev, wchar_t *buffer, int bytes, KeySym *keysym, Status *state) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; int ret; Status tmp_state; XimCommitInfo info; if (!IS_SERVER_CONNECTED(im)) return 0; if (!state) state = &tmp_state; if (ev->type == KeyPress && ev->keycode == 0) { /* Filter function */ if (!(info = ic->private.proto.commit_info)) { *state = XLookupNone; return 0; } ret = im->methods->ctstowcs((XIM)im, info->string, info->string_len, buffer, bytes, state); if (*state == XBufferOverflow) return ret; if (keysym && (info->keysym && *(info->keysym))) { *keysym = *(info->keysym); if (*state == XLookupChars) *state = XLookupBoth; else *state = XLookupKeySym; } _XimUnregCommitInfo(ic); } else if (ev->type == KeyPress) { ret = _XimLookupWCText(ic, ev, buffer, bytes, keysym, NULL); if (ret > 0) { if (ret > bytes) *state = XBufferOverflow; else if (keysym && *keysym != NoSymbol) *state = XLookupBoth; else *state = XLookupChars; } else { if (keysym && *keysym != NoSymbol) *state = XLookupKeySym; else *state = XLookupNone; } } else { *state = XLookupNone; ret = 0; } return ret; } int _XimProtoUtf8LookupString( XIC xic, XKeyEvent *ev, char *buffer, int bytes, KeySym *keysym, Status *state) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; int ret; Status tmp_state; XimCommitInfo info; if (!IS_SERVER_CONNECTED(im)) return 0; if (!state) state = &tmp_state; if (ev->type == KeyPress && ev->keycode == 0) { /* Filter function */ if (!(info = ic->private.proto.commit_info)) { *state = XLookupNone; return 0; } ret = im->methods->ctstoutf8((XIM)im, info->string, info->string_len, buffer, bytes, state); if (*state == XBufferOverflow) return ret; if (keysym && (info->keysym && *(info->keysym))) { *keysym = *(info->keysym); if (*state == XLookupChars) *state = XLookupBoth; else *state = XLookupKeySym; } _XimUnregCommitInfo(ic); } else if (ev->type == KeyPress) { ret = _XimLookupUTF8Text(ic, ev, buffer, bytes, keysym, NULL); if (ret > 0) { if (ret > bytes) *state = XBufferOverflow; else if (keysym && *keysym != NoSymbol) *state = XLookupBoth; else *state = XLookupChars; } else { if (keysym && *keysym != NoSymbol) *state = XLookupKeySym; else *state = XLookupNone; } } else { *state = XLookupNone; ret = 0; } return ret; } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imDispch.c0000644000000000000000000000565013614532331017160 0ustar /****************************************************************** Copyright 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xutil.h" #include "Xlcint.h" #include "Ximint.h" Bool _XimRegProtoIntrCallback( Xim im, CARD16 major_code, CARD16 minor_code, Bool (*proc)( Xim, INT16, XPointer, XPointer ), XPointer call_data) { XimProtoIntrRec *rec; if (!(rec = Xmalloc(sizeof(XimProtoIntrRec)))) return False; rec->func = proc; rec->major_code = major_code; rec->minor_code = minor_code; rec->call_data = call_data; rec->next = im->private.proto.intrproto; im->private.proto.intrproto = rec; return True; } void _XimFreeProtoIntrCallback(Xim im) { register XimProtoIntrRec *rec, *next; for (rec = im->private.proto.intrproto; rec;) { next = rec->next; Xfree(rec); rec = next; } im->private.proto.intrproto = NULL; return; } static Bool _XimTransportIntr( Xim im, INT16 len, XPointer data, XPointer call_data) { Xim call_im = (Xim)call_data; XimProtoIntrRec *rec = call_im->private.proto.intrproto; CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); for (; rec; rec = rec->next) { if ((major_opcode == (CARD8)rec->major_code) && (minor_opcode == (CARD8)rec->minor_code)) if ((*rec->func)(call_im, len, data, rec->call_data)) return True; } return False; } Bool _XimDispatchInit(Xim im) { if (_XimRegisterDispatcher(im, _XimTransportIntr, (XPointer)im)) return True; return False; } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imEvToWire.c0000644000000000000000000007327413614532331017461 0ustar /*********************************************************** Copyright 1993 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Ximint.h" #define sw16(n, s) ((s) ? \ (((n) << 8 & 0xff00) | \ ((n) >> 8 & 0xff) \ ) : n) #define sw32(n, s) ((s) ? \ (((n) << 24 & 0xff000000) | \ ((n) << 8 & 0xff0000) | \ ((n) >> 8 & 0xff00) | \ ((n) >> 24 & 0xff) \ ) : n) Status _XimProtoEventToWire( register XEvent *re, /* pointer to where event should be reformatted */ register xEvent *event, /* wire protocol event */ Bool sw) /* swap byte? */ { switch (event->u.u.type = re->type) { case KeyPress: case KeyRelease: { register XKeyEvent *ev = (XKeyEvent*) re; event->u.keyButtonPointer.root = sw32(ev->root, sw); event->u.keyButtonPointer.event = sw32(ev->window, sw); event->u.keyButtonPointer.child = sw32(ev->subwindow, sw); event->u.keyButtonPointer.time = sw32(ev->time, sw); event->u.keyButtonPointer.eventX = sw16(ev->x, sw) ; event->u.keyButtonPointer.eventY = sw16(ev->y, sw) ; event->u.keyButtonPointer.rootX = sw16(ev->x_root, sw); event->u.keyButtonPointer.rootY = sw16(ev->y_root, sw); event->u.keyButtonPointer.state = sw16(ev->state, sw); event->u.keyButtonPointer.sameScreen = ev->same_screen; event->u.u.detail = ev->keycode; } break; case ButtonPress: case ButtonRelease: { register XButtonEvent *ev = (XButtonEvent *) re; event->u.keyButtonPointer.root = sw32(ev->root, sw); event->u.keyButtonPointer.event = sw32(ev->window, sw); event->u.keyButtonPointer.child = sw32(ev->subwindow, sw); event->u.keyButtonPointer.time = sw32(ev->time, sw); event->u.keyButtonPointer.eventX = sw16(ev->x, sw); event->u.keyButtonPointer.eventY = sw16(ev->y, sw); event->u.keyButtonPointer.rootX = sw16(ev->x_root, sw); event->u.keyButtonPointer.rootY = sw16(ev->y_root, sw); event->u.keyButtonPointer.state = sw16(ev->state, sw); event->u.keyButtonPointer.sameScreen = ev->same_screen; event->u.u.detail = ev->button; } break; case MotionNotify: { register XMotionEvent *ev = (XMotionEvent *)re; event->u.keyButtonPointer.root = sw32(ev->root, sw); event->u.keyButtonPointer.event = sw32(ev->window, sw); event->u.keyButtonPointer.child = sw32(ev->subwindow, sw); event->u.keyButtonPointer.time = sw32(ev->time, sw); event->u.keyButtonPointer.eventX= sw16(ev->x, sw); event->u.keyButtonPointer.eventY= sw16(ev->y, sw); event->u.keyButtonPointer.rootX = sw16(ev->x_root, sw); event->u.keyButtonPointer.rootY = sw16(ev->y_root, sw); event->u.keyButtonPointer.state = sw16(ev->state, sw); event->u.keyButtonPointer.sameScreen= ev->same_screen; event->u.u.detail = ev->is_hint; } break; case EnterNotify: case LeaveNotify: { register XCrossingEvent *ev = (XCrossingEvent *) re; event->u.enterLeave.root = sw32(ev->root, sw); event->u.enterLeave.event = sw32(ev->window, sw); event->u.enterLeave.child = sw32(ev->subwindow, sw); event->u.enterLeave.time = sw32(ev->time, sw); event->u.enterLeave.eventX = sw16(ev->x, sw); event->u.enterLeave.eventY = sw16(ev->y, sw); event->u.enterLeave.rootX = sw16(ev->x_root, sw); event->u.enterLeave.rootY = sw16(ev->y_root, sw); event->u.enterLeave.state = sw16(ev->state, sw); event->u.enterLeave.mode = ev->mode; event->u.enterLeave.flags = 0; if (ev->same_screen) { event->u.enterLeave.flags |= ELFlagSameScreen; } if (ev->focus) { event->u.enterLeave.flags |= ELFlagFocus; } event->u.u.detail = ev->detail; } break; case FocusIn: case FocusOut: { register XFocusChangeEvent *ev = (XFocusChangeEvent *) re; event->u.focus.window = sw32(ev->window, sw); event->u.focus.mode = ev->mode; event->u.u.detail = ev->detail; } break; case KeymapNotify: { register XKeymapEvent *ev = (XKeymapEvent *) re; memcpy((char *)(((xKeymapEvent *) event)->map), &ev->key_vector[1], sizeof (((xKeymapEvent *) event)->map)); } break; case Expose: { register XExposeEvent *ev = (XExposeEvent *) re; event->u.expose.window = sw32(ev->window, sw); event->u.expose.x = sw16(ev->x, sw); event->u.expose.y = sw16(ev->y, sw); event->u.expose.width = sw16(ev->width, sw); event->u.expose.height = sw16(ev->height, sw); event->u.expose.count = sw16(ev->count, sw); } break; case GraphicsExpose: { register XGraphicsExposeEvent *ev = (XGraphicsExposeEvent *) re; event->u.graphicsExposure.drawable = sw32(ev->drawable, sw); event->u.graphicsExposure.x = sw16(ev->x, sw); event->u.graphicsExposure.y = sw16(ev->y, sw); event->u.graphicsExposure.width = sw16(ev->width, sw); event->u.graphicsExposure.height = sw16(ev->height, sw); event->u.graphicsExposure.count = sw16(ev->count, sw); event->u.graphicsExposure.majorEvent= ev->major_code; event->u.graphicsExposure.minorEvent= sw16(ev->minor_code, sw); } break; case NoExpose: { register XNoExposeEvent *ev = (XNoExposeEvent *) re; event->u.noExposure.drawable = sw32(ev->drawable, sw); event->u.noExposure.majorEvent = ev->major_code; event->u.noExposure.minorEvent = sw16(ev->minor_code, sw); } break; case VisibilityNotify: { register XVisibilityEvent *ev = (XVisibilityEvent *) re; event->u.visibility.window = sw32(ev->window, sw); event->u.visibility.state = ev->state; } break; case CreateNotify: { register XCreateWindowEvent *ev = (XCreateWindowEvent *) re; event->u.createNotify.window = sw32(ev->window, sw); event->u.createNotify.parent = sw32(ev->parent, sw); event->u.createNotify.x = sw16(ev->x, sw); event->u.createNotify.y = sw16(ev->y, sw); event->u.createNotify.width = sw16(ev->width, sw); event->u.createNotify.height = sw16(ev->height, sw); event->u.createNotify.borderWidth = sw16(ev->border_width, sw); event->u.createNotify.override = ev->override_redirect; } break; case DestroyNotify: { register XDestroyWindowEvent *ev = (XDestroyWindowEvent *) re; event->u.destroyNotify.window = sw32(ev->window, sw); event->u.destroyNotify.event = sw32(ev->event, sw); } break; case UnmapNotify: { register XUnmapEvent *ev = (XUnmapEvent *) re; event->u.unmapNotify.window = sw32(ev->window, sw); event->u.unmapNotify.event = sw32(ev->event, sw); event->u.unmapNotify.fromConfigure = ev->from_configure; } break; case MapNotify: { register XMapEvent *ev = (XMapEvent *) re; event->u.mapNotify.window = sw32(ev->window, sw); event->u.mapNotify.event = sw32(ev->event, sw); event->u.mapNotify.override = ev->override_redirect; } break; case MapRequest: { register XMapRequestEvent *ev = (XMapRequestEvent *) re; event->u.mapRequest.window = sw32(ev->window, sw); event->u.mapRequest.parent = sw32(ev->parent, sw); } break; case ReparentNotify: { register XReparentEvent *ev = (XReparentEvent *) re; event->u.reparent.window = sw32(ev->window, sw); event->u.reparent.event = sw32(ev->event, sw); event->u.reparent.parent = sw32(ev->parent, sw); event->u.reparent.x = sw16(ev->x, sw); event->u.reparent.y = sw16(ev->y, sw); event->u.reparent.override = ev->override_redirect; } break; case ConfigureNotify: { register XConfigureEvent *ev = (XConfigureEvent *) re; event->u.configureNotify.window = sw32(ev->window, sw); event->u.configureNotify.event = sw32(ev->event, sw); event->u.configureNotify.aboveSibling = sw32(ev->above, sw); event->u.configureNotify.x = sw16(ev->x, sw); event->u.configureNotify.y = sw16(ev->y, sw); event->u.configureNotify.width = sw16(ev->width, sw); event->u.configureNotify.height = sw16(ev->height, sw); event->u.configureNotify.borderWidth= sw16(ev->border_width, sw); event->u.configureNotify.override = ev->override_redirect; } break; case ConfigureRequest: { register XConfigureRequestEvent *ev = (XConfigureRequestEvent *) re; event->u.configureRequest.window = sw32(ev->window, sw); event->u.configureRequest.parent = sw32(ev->parent, sw); event->u.configureRequest.sibling = sw32(ev->above, sw); event->u.configureRequest.x = sw16(ev->x, sw); event->u.configureRequest.y = sw16(ev->y, sw); event->u.configureRequest.width = sw16(ev->width, sw); event->u.configureRequest.height = sw16(ev->height, sw); event->u.configureRequest.borderWidth= sw16(ev->border_width, sw); event->u.configureRequest.valueMask= sw16(ev->value_mask, sw); event->u.u.detail = ev->detail; } break; case GravityNotify: { register XGravityEvent *ev = (XGravityEvent *) re; event->u.gravity.window = sw32(ev->window, sw); event->u.gravity.event = sw32(ev->event, sw); event->u.gravity.x = sw16(ev->x, sw); event->u.gravity.y = sw16(ev->y, sw); } break; case ResizeRequest: { register XResizeRequestEvent *ev = (XResizeRequestEvent *) re; event->u.resizeRequest.window = sw32(ev->window, sw); event->u.resizeRequest.width = sw16(ev->width, sw); event->u.resizeRequest.height = sw16(ev->height, sw); } break; case CirculateNotify: { register XCirculateEvent *ev = (XCirculateEvent *) re; event->u.circulate.window = sw32(ev->window, sw); event->u.circulate.event = sw32(ev->event, sw); event->u.circulate.place = ev->place; } break; case CirculateRequest: { register XCirculateRequestEvent *ev = (XCirculateRequestEvent *) re; event->u.circulate.window = sw32(ev->window, sw); event->u.circulate.event = sw32(ev->parent, sw); event->u.circulate.place = ev->place; } break; case PropertyNotify: { register XPropertyEvent *ev = (XPropertyEvent *) re; event->u.property.window = sw32(ev->window, sw); event->u.property.atom = sw32(ev->atom, sw); event->u.property.time = sw32(ev->time, sw); event->u.property.state = ev->state; } break; case SelectionClear: { register XSelectionClearEvent *ev = (XSelectionClearEvent *) re; event->u.selectionClear.window = sw32(ev->window, sw); event->u.selectionClear.atom = sw32(ev->selection, sw); event->u.selectionClear.time = sw32(ev->time, sw); } break; case SelectionRequest: { register XSelectionRequestEvent *ev = (XSelectionRequestEvent *) re; event->u.selectionRequest.owner = sw32(ev->owner, sw); event->u.selectionRequest.requestor = sw32(ev->requestor, sw); event->u.selectionRequest.selection = sw32(ev->selection, sw); event->u.selectionRequest.target = sw32(ev->target, sw); event->u.selectionRequest.property = sw32(ev->property, sw); event->u.selectionRequest.time = sw32(ev->time, sw); } break; case SelectionNotify: { register XSelectionEvent *ev = (XSelectionEvent *) re; event->u.selectionNotify.requestor = sw32(ev->requestor, sw); event->u.selectionNotify.selection = sw32(ev->selection, sw); event->u.selectionNotify.target = sw32(ev->target, sw); event->u.selectionNotify.property = sw32(ev->property, sw); event->u.selectionNotify.time = sw32(ev->time, sw); } break; case ColormapNotify: { register XColormapEvent *ev = (XColormapEvent *) re; event->u.colormap.window = sw32(ev->window, sw); event->u.colormap.colormap = sw32(ev->colormap, sw); event->u.colormap.new = ev->new; event->u.colormap.state = ev->state; } break; case ClientMessage: { register int i; register XClientMessageEvent *ev = (XClientMessageEvent *) re; event->u.clientMessage.window = sw32(ev->window, sw); event->u.u.detail = ev->format; switch (ev->format) { case 8: event->u.clientMessage.u.b.type = sw32(ev->message_type, sw); for (i = 0; i < 20; i++) event->u.clientMessage.u.b.bytes[i] = ev->data.b[i]; break; case 16: event->u.clientMessage.u.s.type = sw32(ev->message_type, sw); event->u.clientMessage.u.s.shorts0 = sw16(ev->data.s[0], sw); event->u.clientMessage.u.s.shorts1 = sw16(ev->data.s[1], sw); event->u.clientMessage.u.s.shorts2 = sw16(ev->data.s[2], sw); event->u.clientMessage.u.s.shorts3 = sw16(ev->data.s[3], sw); event->u.clientMessage.u.s.shorts4 = sw16(ev->data.s[4], sw); event->u.clientMessage.u.s.shorts5 = sw16(ev->data.s[5], sw); event->u.clientMessage.u.s.shorts6 = sw16(ev->data.s[6], sw); event->u.clientMessage.u.s.shorts7 = sw16(ev->data.s[7], sw); event->u.clientMessage.u.s.shorts8 = sw16(ev->data.s[8], sw); event->u.clientMessage.u.s.shorts9 = sw16(ev->data.s[9], sw); break; case 32: event->u.clientMessage.u.l.type = sw32(ev->message_type, sw); event->u.clientMessage.u.l.longs0 = sw32(ev->data.l[0], sw); event->u.clientMessage.u.l.longs1 = sw32(ev->data.l[1], sw); event->u.clientMessage.u.l.longs2 = sw32(ev->data.l[2], sw); event->u.clientMessage.u.l.longs3 = sw32(ev->data.l[3], sw); event->u.clientMessage.u.l.longs4 = sw32(ev->data.l[4], sw); break; default: /* client passing bogus data, let server complain */ break; } } break; case MappingNotify: { register XMappingEvent *ev = (XMappingEvent *) re; event->u.mappingNotify.firstKeyCode = ev->first_keycode; event->u.mappingNotify.request = ev->request; event->u.mappingNotify.count = ev->count; } break; default: return(0); } /* Common process */ if (((XAnyEvent *)re)->send_event) event->u.u.type |= 0x80; event->u.u.sequenceNumber = ((XAnyEvent *)re)->serial & ~((unsigned long)0xffff); event->u.u.sequenceNumber = sw16(event->u.u.sequenceNumber, sw); return(1); } /* * reformat a wire event into an XEvent structure of the right type. */ Bool _XimProtoWireToEvent( register XEvent *re, /* pointer to where event should be reformatted */ register xEvent *event, /* wire protocol event */ Bool sw) /* swap byte? */ { re->type = event->u.u.type & 0x7f; ((XAnyEvent *)re)->serial = sw16(event->u.u.sequenceNumber, sw); ((XAnyEvent *)re)->send_event = ((event->u.u.type & 0x80) != 0); ((XAnyEvent *)re)->display = NULL; /* Ignore the leading bit of the event type since it is set when a client sends an event rather than the server. */ switch (event-> u.u.type & 0177) { case KeyPress: case KeyRelease: { register XKeyEvent *ev = (XKeyEvent*) re; ev->root = sw32(event->u.keyButtonPointer.root, sw); ev->window = sw32(event->u.keyButtonPointer.event, sw); ev->subwindow = sw32(event->u.keyButtonPointer.child, sw); ev->time = sw32(event->u.keyButtonPointer.time, sw); ev->x = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventX, sw)); ev->y = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventY, sw)); ev->x_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootX, sw)); ev->y_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootY, sw)); ev->state = sw16(event->u.keyButtonPointer.state, sw); ev->same_screen = event->u.keyButtonPointer.sameScreen; ev->keycode = event->u.u.detail; } break; case ButtonPress: case ButtonRelease: { register XButtonEvent *ev = (XButtonEvent *) re; ev->root = sw32(event->u.keyButtonPointer.root, sw); ev->window = sw32(event->u.keyButtonPointer.event, sw); ev->subwindow = sw32(event->u.keyButtonPointer.child, sw); ev->time = sw32(event->u.keyButtonPointer.time, sw); ev->x = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventX, sw)); ev->y = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventY, sw)); ev->x_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootX, sw)); ev->y_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootY, sw)); ev->state = sw16(event->u.keyButtonPointer.state, sw); ev->same_screen = event->u.keyButtonPointer.sameScreen; ev->button = event->u.u.detail; } break; case MotionNotify: { register XMotionEvent *ev = (XMotionEvent *)re; ev->root = sw32(event->u.keyButtonPointer.root, sw); ev->window = sw32(event->u.keyButtonPointer.event, sw); ev->subwindow = sw32(event->u.keyButtonPointer.child, sw); ev->time = sw32(event->u.keyButtonPointer.time, sw); ev->x = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventX, sw)); ev->y = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventY, sw)); ev->x_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootX, sw)); ev->y_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootY, sw)); ev->state = sw16(event->u.keyButtonPointer.state, sw); ev->same_screen = event->u.keyButtonPointer.sameScreen; ev->is_hint = event->u.u.detail; } break; case EnterNotify: case LeaveNotify: { register XCrossingEvent *ev = (XCrossingEvent *) re; ev->root = sw32(event->u.enterLeave.root, sw); ev->window = sw32(event->u.enterLeave.event, sw); ev->subwindow = sw32(event->u.enterLeave.child, sw); ev->time = sw32(event->u.enterLeave.time, sw); ev->x = cvtINT16toInt(sw16(event->u.enterLeave.eventX, sw)); ev->y = cvtINT16toInt(sw16(event->u.enterLeave.eventY, sw)); ev->x_root = cvtINT16toInt(sw16(event->u.enterLeave.rootX, sw)); ev->y_root = cvtINT16toInt(sw16(event->u.enterLeave.rootY, sw)); ev->state = sw16(event->u.enterLeave.state, sw); ev->mode = event->u.enterLeave.mode; ev->same_screen = (event->u.enterLeave.flags & ELFlagSameScreen) && True; ev->focus = (event->u.enterLeave.flags & ELFlagFocus) && True; ev->detail = event->u.u.detail; } break; case FocusIn: case FocusOut: { register XFocusChangeEvent *ev = (XFocusChangeEvent *) re; ev->window = sw32(event->u.focus.window, sw); ev->mode = event->u.focus.mode; ev->detail = event->u.u.detail; } break; case KeymapNotify: { register XKeymapEvent *ev = (XKeymapEvent *) re; ev->window = None; memcpy(&ev->key_vector[1], (char *)((xKeymapEvent *) event)->map, sizeof (((xKeymapEvent *) event)->map)); } break; case Expose: { register XExposeEvent *ev = (XExposeEvent *) re; ev->window = sw32(event->u.expose.window, sw); ev->x = sw16(event->u.expose.x, sw); ev->y = sw16(event->u.expose.y, sw); ev->width = sw16(event->u.expose.width, sw); ev->height = sw16(event->u.expose.height, sw); ev->count = sw16(event->u.expose.count, sw); } break; case GraphicsExpose: { register XGraphicsExposeEvent *ev = (XGraphicsExposeEvent *) re; ev->drawable = sw32(event->u.graphicsExposure.drawable, sw); ev->x = sw16(event->u.graphicsExposure.x, sw); ev->y = sw16(event->u.graphicsExposure.y, sw); ev->width = sw16(event->u.graphicsExposure.width, sw); ev->height = sw16(event->u.graphicsExposure.height, sw); ev->count = sw16(event->u.graphicsExposure.count, sw); ev->major_code = event->u.graphicsExposure.majorEvent; ev->minor_code = sw16(event->u.graphicsExposure.minorEvent, sw); } break; case NoExpose: { register XNoExposeEvent *ev = (XNoExposeEvent *) re; ev->drawable = sw32(event->u.noExposure.drawable, sw); ev->major_code = event->u.noExposure.majorEvent; ev->minor_code = sw16(event->u.noExposure.minorEvent, sw); } break; case VisibilityNotify: { register XVisibilityEvent *ev = (XVisibilityEvent *) re; ev->window = sw32(event->u.visibility.window, sw); ev->state = event->u.visibility.state; } break; case CreateNotify: { register XCreateWindowEvent *ev = (XCreateWindowEvent *) re; ev->window = sw32(event->u.createNotify.window, sw); ev->parent = sw32(event->u.createNotify.parent, sw); ev->x = cvtINT16toInt(sw16(event->u.createNotify.x, sw)); ev->y = cvtINT16toInt(sw16(event->u.createNotify.y, sw)); ev->width = sw16(event->u.createNotify.width, sw); ev->height = sw16(event->u.createNotify.height, sw); ev->border_width = sw16(event->u.createNotify.borderWidth, sw); ev->override_redirect = event->u.createNotify.override; } break; case DestroyNotify: { register XDestroyWindowEvent *ev = (XDestroyWindowEvent *) re; ev->window = sw32(event->u.destroyNotify.window, sw); ev->event = sw32(event->u.destroyNotify.event, sw); } break; case UnmapNotify: { register XUnmapEvent *ev = (XUnmapEvent *) re; ev->window = sw32(event->u.unmapNotify.window, sw); ev->event = sw32(event->u.unmapNotify.event, sw); ev->from_configure = event->u.unmapNotify.fromConfigure; } break; case MapNotify: { register XMapEvent *ev = (XMapEvent *) re; ev->window = sw32(event->u.mapNotify.window, sw); ev->event = sw32(event->u.mapNotify.event, sw); ev->override_redirect = event->u.mapNotify.override; } break; case MapRequest: { register XMapRequestEvent *ev = (XMapRequestEvent *) re; ev->window = sw32(event->u.mapRequest.window, sw); ev->parent = sw32(event->u.mapRequest.parent, sw); } break; case ReparentNotify: { register XReparentEvent *ev = (XReparentEvent *) re; ev->event = sw32(event->u.reparent.event, sw); ev->window = sw32(event->u.reparent.window, sw); ev->parent = sw32(event->u.reparent.parent, sw); ev->x = cvtINT16toInt(sw16(event->u.reparent.x, sw)); ev->y = cvtINT16toInt(sw16(event->u.reparent.y, sw)); ev->override_redirect = event->u.reparent.override; } break; case ConfigureNotify: { register XConfigureEvent *ev = (XConfigureEvent *) re; ev->event = sw32(event->u.configureNotify.event, sw); ev->window = sw32(event->u.configureNotify.window, sw); ev->above = sw32(event->u.configureNotify.aboveSibling, sw); ev->x = cvtINT16toInt(sw16(event->u.configureNotify.x, sw)); ev->y = cvtINT16toInt(sw16(event->u.configureNotify.y, sw)); ev->width = sw16(event->u.configureNotify.width, sw); ev->height = sw16(event->u.configureNotify.height, sw); ev->border_width = sw16(event->u.configureNotify.borderWidth, sw); ev->override_redirect = event->u.configureNotify.override; } break; case ConfigureRequest: { register XConfigureRequestEvent *ev = (XConfigureRequestEvent *) re; ev->window = sw32(event->u.configureRequest.window, sw); ev->parent = sw32(event->u.configureRequest.parent, sw); ev->above = sw32(event->u.configureRequest.sibling, sw); ev->x = cvtINT16toInt(sw16(event->u.configureRequest.x, sw)); ev->y = cvtINT16toInt(sw16(event->u.configureRequest.y, sw)); ev->width = sw16(event->u.configureRequest.width, sw); ev->height = sw16(event->u.configureRequest.height, sw); ev->border_width = sw16(event->u.configureRequest.borderWidth, sw); ev->value_mask = sw16(event->u.configureRequest.valueMask, sw); ev->detail = event->u.u.detail; } break; case GravityNotify: { register XGravityEvent *ev = (XGravityEvent *) re; ev->window = sw32(event->u.gravity.window, sw); ev->event = sw32(event->u.gravity.event, sw); ev->x = cvtINT16toInt(sw16(event->u.gravity.x, sw)); ev->y = cvtINT16toInt(sw16(event->u.gravity.y, sw)); } break; case ResizeRequest: { register XResizeRequestEvent *ev = (XResizeRequestEvent *) re; ev->window = sw32(event->u.resizeRequest.window, sw); ev->width = sw16(event->u.resizeRequest.width, sw); ev->height = sw16(event->u.resizeRequest.height, sw); } break; case CirculateNotify: { register XCirculateEvent *ev = (XCirculateEvent *) re; ev->window = sw32(event->u.circulate.window, sw); ev->event = sw32(event->u.circulate.event, sw); ev->place = event->u.circulate.place; } break; case CirculateRequest: { register XCirculateRequestEvent *ev = (XCirculateRequestEvent *) re; ev->window = sw32(event->u.circulate.window, sw); ev->parent = sw32(event->u.circulate.event, sw); ev->place = event->u.circulate.place; } break; case PropertyNotify: { register XPropertyEvent *ev = (XPropertyEvent *) re; ev->window = sw32(event->u.property.window, sw); ev->atom = sw32(event->u.property.atom, sw); ev->time = sw32(event->u.property.time, sw); ev->state = event->u.property.state; } break; case SelectionClear: { register XSelectionClearEvent *ev = (XSelectionClearEvent *) re; ev->window = sw32(event->u.selectionClear.window, sw); ev->selection = sw32(event->u.selectionClear.atom, sw); ev->time = sw32(event->u.selectionClear.time, sw); } break; case SelectionRequest: { register XSelectionRequestEvent *ev = (XSelectionRequestEvent *) re; ev->owner = sw32(event->u.selectionRequest.owner, sw); ev->requestor = sw32(event->u.selectionRequest.requestor, sw); ev->selection = sw32(event->u.selectionRequest.selection, sw); ev->target = sw32(event->u.selectionRequest.target, sw); ev->property = sw32(event->u.selectionRequest.property, sw); ev->time = sw32(event->u.selectionRequest.time, sw); } break; case SelectionNotify: { register XSelectionEvent *ev = (XSelectionEvent *) re; ev->requestor = sw32(event->u.selectionNotify.requestor, sw); ev->selection = sw32(event->u.selectionNotify.selection, sw); ev->target = sw32(event->u.selectionNotify.target, sw); ev->property = sw32(event->u.selectionNotify.property, sw); ev->time = sw32(event->u.selectionNotify.time, sw); } break; case ColormapNotify: { register XColormapEvent *ev = (XColormapEvent *) re; ev->window = sw32(event->u.colormap.window, sw); ev->colormap = sw32(event->u.colormap.colormap, sw); ev->new = event->u.colormap.new; ev->state = event->u.colormap.state; } break; case ClientMessage: { register int i; register XClientMessageEvent *ev = (XClientMessageEvent *) re; ev->window = sw32(event->u.clientMessage.window, sw); ev->format = event->u.u.detail; switch (ev->format) { case 8: ev->message_type = sw32(event->u.clientMessage.u.b.type, sw); for (i = 0; i < 20; i++) ev->data.b[i] = event->u.clientMessage.u.b.bytes[i]; break; case 16: ev->message_type = sw32(event->u.clientMessage.u.s.type, sw); ev->data.s[0] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts0, sw)); ev->data.s[1] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts1, sw)); ev->data.s[2] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts2, sw)); ev->data.s[3] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts3, sw)); ev->data.s[4] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts4, sw)); ev->data.s[5] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts5, sw)); ev->data.s[6] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts6, sw)); ev->data.s[7] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts7, sw)); ev->data.s[8] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts8, sw)); ev->data.s[9] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts9, sw)); break; case 32: ev->message_type = sw32(event->u.clientMessage.u.l.type, sw); ev->data.l[0] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs0, sw)); ev->data.l[1] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs1, sw)); ev->data.l[2] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs2, sw)); ev->data.l[3] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs3, sw)); ev->data.l[4] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs4, sw)); break; default: /* XXX should never occur */ break; } } break; case MappingNotify: { register XMappingEvent *ev = (XMappingEvent *)re; ev->window = 0; ev->first_keycode = event->u.mappingNotify.firstKeyCode; ev->request = event->u.mappingNotify.request; ev->count = event->u.mappingNotify.count; } break; default: return(False); } return(True); } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imExten.c0000644000000000000000000003437613614532331017040 0ustar /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" /* * index of extensions */ #define XIM_EXT_SET_EVENT_MASK_IDX 0 #ifdef EXT_FORWARD #define XIM_EXT_FORWARD_KEYEVENT_IDX 1 #endif #ifdef EXT_MOVE #define XIM_EXT_MOVE_IDX 2 #endif typedef struct _XIM_QueryExtRec { Bool is_support; const char *name; int name_len; CARD16 major_opcode; CARD16 minor_opcode; int idx; } XIM_QueryExtRec; static XIM_QueryExtRec extensions[] = { {False, "XIM_EXT_SET_EVENT_MASK", 0, 0, 0, XIM_EXT_SET_EVENT_MASK_IDX}, #ifdef EXT_FORWARD {False, "XIM_EXT_FORWARD_KEYEVENT", 0, 0, 0, XIM_EXT_FORWARD_KEYEVENT_IDX}, #endif #ifdef EXT_MOVE {False, "XIM_EXT_MOVE", 0, 0, 0, XIM_EXT_MOVE_IDX}, #endif {False, NULL, 0, 0, 0, 0} /* dummy */ }; static int _XimIsSupportExt( int idx) { register int i; int n = XIMNumber(extensions) - 1; for (i = 0; i < n; i++) { if (extensions[i].idx == idx) { if (extensions[i].is_support) return i; else break; } } return -1; } static Bool _XimProcExtSetEventMask( Xim im, Xic ic, XPointer buf) { EVENTMASK *buf_l = (EVENTMASK *)buf; EVENTMASK select_mask = _XimGetWindowEventmask(ic); ic->private.proto.filter_event_mask = buf_l[0]; ic->private.proto.intercept_event_mask = buf_l[1]; ic->private.proto.select_event_mask = buf_l[2]; ic->private.proto.forward_event_mask = buf_l[3]; ic->private.proto.synchronous_event_mask = buf_l[4]; select_mask &= ~ic->private.proto.intercept_event_mask; /* deselected event mask */ select_mask |= ic->private.proto.select_event_mask; /* selected event mask */ XSelectInput(im->core.display, ic->core.focus_window, select_mask); _XimReregisterFilter(ic); if (!(_XimProcSyncReply(im, ic))) return False; return True; } static Bool _XimExtSetEventMaskCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); XIMID imid = buf_s[0]; XICID icid = buf_s[1]; Xim im = (Xim)call_data; Xic ic; if ((imid == im->private.proto.imid) && (ic = _XimICOfXICID(im, icid))) { (void)_XimProcExtSetEventMask(im, ic, (XPointer)&buf_s[2]); return True; } return False; } #ifdef EXT_FORWARD static Bool _XimProcExtForwardKeyEvent( Xim im, Xic ic, XPointer buf) { CARD8 *buf_b = (CARD8 *)buf; CARD16 *buf_s = (CARD16 *)buf; CARD32 *buf_l = (CARD32 *)buf; XEvent ev; XKeyEvent *kev = (XKeyEvent *)&ev; bzero(&ev, sizeof(XEvent)); kev->send_event = False; kev->display = im->core.display; kev->serial = buf_s[1]; /* sequence number */ kev->type = buf_b[4] & 0x7f; /* xEvent.u.u.type */ kev->keycode = buf_b[5]; /* Keycode */ kev->state = buf_s[3]; /* state */ kev->time = buf_l[2]; /* time */ XPutBackEvent(im->core.display, &ev); _XimRespSyncReply(ic, buf_s[0]); MARK_FABRICATED(im); return True; } static Bool _XimExtForwardKeyEventCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); XIMID imid = buf_s[0]; XICID icid = buf_s[1]; Xim im = (Xim)call_data; Xic ic; if ((imid == im->private.proto.imid) && (ic = _XimICOfXICID(im, icid))) { (void)_XimProcExtForwardKeyEvent(im, ic, (XPointer)&buf_s[2]); return True; } return False; } static Bool _XimExtForwardKeyEventCheck( Xim im, INT16 len, XPointer data, XPointer arg) { Xic ic = (Xic)arg; CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); XIMID imid = buf_s[0]; XICID icid = buf_s[1]; if ((major_opcode == XIM_SYNC_REPLY) && (minor_opcode == 0) && (imid == im->private.proto.imid) && (icid == ic->private.proto.icid)) if ((major_opcode == XIM_ERROR) && (minor_opcode == 0) && (buf_s[2] & XIM_IMID_VALID) && (imid == im->private.proto.imid) && (buf_s[2] & XIM_ICID_VALID) && (icid == ic->private.proto.icid)) return True; return False; } Bool _XimExtForwardKeyEvent( Xic ic, XKeyEvent *ev, Bool sync) { Xim im = (Xim) ic->core.im; CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD8 *buf_b = &buf[XIM_HEADER_SIZE]; CARD16 *buf_s = (CARD16 *)buf_b; CARD32 *buf_l = (CARD32 *)buf_b; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int buf_size; int ret_code; INT16 len; int idx; if ((idx = _XimIsSupportExt(XIM_EXT_FORWARD_KEYEVENT_IDX)) < 0) return False; buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = ic->private.proto.icid; /* icid */ buf_s[2] = sync ? XimSYNCHRONUS : 0; /* flag */ buf_s[3] = (CARD16)(((XAnyEvent *)ev)->serial & ((unsigned long) 0xffff)); /* sequence number */ buf_b[8] = ev->type; /* xEvent.u.u.type */ buf_b[9] = ev->keycode; /* keycode */ buf_s[5] = ev->state; /* state */ buf_l[3] = ev->time; /* time */ len = sizeof(CARD16) /* sizeof imid */ + sizeof(CARD16) /* sizeof icid */ + sizeof(BITMASK16) /* sizeof flag */ + sizeof(CARD16) /* sizeof sequence number */ + sizeof(BYTE) /* sizeof xEvent.u.u.type */ + sizeof(BYTE) /* sizeof keycode */ + sizeof(CARD16) /* sizeof state */ + sizeof(CARD32); /* sizeof time */ _XimSetHeader((XPointer)buf, extensions[idx].major_opcode, extensions[idx].minor_opcode, &len); if (!(_XimWrite(im, len, (XPointer)buf))) return False; _XimFlush(im); if (sync) { buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimExtForwardKeyEventCheck, (XPointer)ic); if(ret_code == XIM_TRUE) { preply = reply; } else if(ret_code == XIM_OVERFLOW) { if(len <= 0) { preply = reply; } else { buf_sizex = len; preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, preply, buf_size, _XimExtForwardKeyEventCheck, (XPointer)ic); if(ret_code != XIM_TRUE) { Xfree(preply); return False; } } } else return False; buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if(reply != preply) Xfree(preply); return False; } if(reply != preply) Xfree(preply); } return True; } #endif /* EXT_FORWARD */ static int _XimCheckExtensionListSize(void) { register int i; int len; int total = 0; int n = XIMNumber(extensions) - 1; for (i = 0; i < n; i++) { len = strlen(extensions[i].name); extensions[i].name_len = len; len += sizeof(BYTE); total += len; } return total; } static void _XimSetExtensionList( CARD8 *buf) { register int i; int len; int n = XIMNumber(extensions) - 1; for (i = 0; i < n; i++) { len = extensions[i].name_len; buf[0] = (BYTE)len; (void)strcpy((char *)&buf[1], extensions[i].name); len += sizeof(BYTE); buf += len; } return; } static unsigned int _XimCountNumberOfExtension( INT16 total, CARD8 *ext) { unsigned int n; INT16 len; INT16 min_len = sizeof(CARD8) + sizeof(CARD8) + sizeof(INT16); n = 0; while (total > min_len) { len = *((INT16 *)(&ext[2])); len += (min_len + XIM_PAD(len)); total -= len; ext += len; n++; } return n; } static Bool _XimParseExtensionList( Xim im, CARD16 *data) { int num = XIMNumber(extensions) - 1; unsigned int n; CARD8 *buf; register int i; register int j; INT16 len; if (!(n = _XimCountNumberOfExtension(data[0], (CARD8 *)&data[1]))) return True; buf = (CARD8 *)&data[1]; for (i = 0; i < n; i++) { len = *((INT16 *)(&buf[2])); for (j = 0; j < num; j++) { if (!(strncmp(extensions[j].name, (char *)&buf[4], len))) { extensions[j].major_opcode = buf[0]; extensions[j].minor_opcode = buf[1]; extensions[j].is_support = True; break; } } len += sizeof(CARD8) /* sizeof major_opcode */ + sizeof(CARD8) /* sizeof minor_opcode */ + sizeof(INT16) /* sizeof length */ + XIM_PAD(len); /* sizeof pad */ buf += len; } return True; } static Bool _XimQueryExtensionCheck( Xim im, INT16 len, XPointer data, XPointer arg) { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); XIMID imid = buf_s[0]; if ((major_opcode == XIM_QUERY_EXTENSION_REPLY) && (minor_opcode == 0) && (imid == im->private.proto.imid)) return True; if ((major_opcode == XIM_ERROR) && (minor_opcode == 0) && (buf_s[2] & XIM_IMID_VALID) && (imid == im->private.proto.imid)) return True; return False; } Bool _XimExtension( Xim im) { CARD8 *buf; CARD16 *buf_s; int buf_len; INT16 len; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int buf_size; int ret_code; int idx; if (!(len = _XimCheckExtensionListSize())) return True; buf_len = XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(INT16) + len + XIM_PAD(len); if (!(buf = Xmalloc(buf_len))) return False; buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = len; /* length of Extensions */ _XimSetExtensionList((CARD8 *)&buf_s[2]); /* extensions supported */ XIM_SET_PAD(&buf_s[2], len); /* pad */ len += sizeof(CARD16) /* sizeof imid */ + sizeof(INT16); /* sizeof length of extensions */ _XimSetHeader((XPointer)buf, XIM_QUERY_EXTENSION, 0, &len); if (!(_XimWrite(im, len, (XPointer)buf))) { XFree(buf); return False; } XFree(buf); _XimFlush(im); buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimQueryExtensionCheck, 0); if(ret_code == XIM_TRUE) { preply = reply; } else if(ret_code == XIM_OVERFLOW) { if(len <= 0) { preply = reply; } else { buf_size = len; preply = Xmalloc(buf_size); ret_code = _XimRead(im, &len, reply, buf_size, _XimQueryExtensionCheck, 0); if(ret_code != XIM_TRUE) { Xfree(preply); return False; } } } else return False; buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); if (*((CARD8 *)preply) == XIM_ERROR) { _XimProcError(im, 0, (XPointer)&buf_s[3]); if(reply != preply) Xfree(preply); return False; } if (!(_XimParseExtensionList(im, &buf_s[1]))) { if(reply != preply) Xfree(preply); return False; } if(reply != preply) Xfree(preply); if ((idx = _XimIsSupportExt(XIM_EXT_SET_EVENT_MASK_IDX)) >= 0) _XimRegProtoIntrCallback(im, extensions[idx].major_opcode, extensions[idx].minor_opcode, _XimExtSetEventMaskCallback, (XPointer)im); #ifdef EXT_FORWARD if ((idx = _XimIsSupportExt(XIM_EXT_FORWARD_KEYEVENT_IDX)) >= 0) _XimRegProtoIntrCallback(im, extensions[idx].major_opcode, extensions[idx].minor_opcode, _XimExtForwardKeyEventCallback, (XPointer)im); #endif return True; } #ifdef EXT_MOVE /* flag of ExtenArgCheck */ #define EXT_XNSPOTLOCATION (1L<<0) /* macro for ExtenArgCheck */ #define SET_EXT_XNSPOTLOCATION(flag) (flag |= EXT_XNSPOTLOCATION) #define IS_EXT_XNSPOTLOCATION(flag) (flag & EXT_XNSPOTLOCATION) /* length of XPoint attribute */ #define XIM_Xpoint_length 12 static Bool _XimExtMove( Xim im, Xic ic, CARD16 x, CARD16 y) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; INT16 len; int idx; if ((idx = _XimIsSupportExt(XIM_EXT_MOVE_IDX)) < 0) return False; buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = ic->private.proto.icid; /* icid */ buf_s[2] = x; /* X */ buf_s[3] = y; /* Y */ len = sizeof(CARD16) /* sizeof imid */ + sizeof(CARD16) /* sizeof icid */ + sizeof(INT16) /* sizeof X */ + sizeof(INT16); /* sizeof Y */ _XimSetHeader((XPointer)buf, extensions[idx].major_opcode, extensions[idx].minor_opcode, &len); if (!(_XimWrite(im, len, (XPointer)buf))) return False; _XimFlush(im); return True; } BITMASK32 _XimExtenArgCheck( XIMArg *arg) { CARD32 flag = 0L; if (!strcmp(arg->name, XNSpotLocation)) SET_EXT_XNSPOTLOCATION(flag); return flag; } Bool _XimExtenMove( Xim im, Xic ic, CARD32 flag, CARD16 *buf, INT16 length) { if ((IS_EXT_XNSPOTLOCATION(flag)) && (length == XIM_Xpoint_length)) return _XimExtMove(im, ic, buf[4], buf[5]); return False; } #endif /* EXT_MOVE */ nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imImSw.c0000644000000000000000000000422013614532331016615 0ustar /****************************************************************** Copyright 1992, 1993 by FUJITSU LIMITED Copyright 1993 by Digital Equipment Corporation Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED and Digital Equipment Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED and Digital Equipment Corporation makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp Modifier: Franky Ling Digital Equipment Corporation frankyling@hgrd01.enet.dec.com ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" #include "XimImSw.h" static Bool _XimCheckIfDefault( Xim im) { return(True); } XimImsportSW _XimImSportRec[] = { { _XimCheckIfLocalProcessing, _XimLocalOpenIM, _XimLocalIMFree }, { _XimCheckIfThaiProcessing, _XimThaiOpenIM, _XimThaiIMFree }, { _XimCheckIfDefault, _XimProtoOpenIM, _XimProtoIMFree }, { NULL, NULL, NULL }, }; nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imInsClbk.c0000644000000000000000000001653313614532331017275 0ustar /****************************************************************** Copyright 1993, 1994 by Sony Corporation Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Sony Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Sony Corporation makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. SONY CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SONY CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Makoto Wakamatsu Sony Corporation makoto@sm.sony.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xlcint.h" #include "XlcPublic.h" #include "Ximint.h" typedef struct _XimInstCallback { Bool call; Bool destroy; Display *display; XLCd lcd; char name[XIM_MAXLCNAMELEN]; char *modifiers; XrmDatabase rdb; char *res_name; char *res_class; XIDProc callback; XPointer client_data; struct _XimInstCallback *next; } XimInstCallbackRec, *XimInstCallback; static XimInstCallback callback_list = NULL; static Bool lock = False; static void MakeLocale( XLCd lcd, char locale[] ) { char *language, *territory, *codeset; _XGetLCValues( lcd, XlcNLanguage, &language, XlcNTerritory, &territory, XlcNCodeset, &codeset, NULL ); strcpy( locale, language ); if( territory && *territory ) { strcat( locale, "_" ); strcat( locale, territory ); } if( codeset && *codeset ) { strcat( locale, "." ); strcat( locale, codeset ); } } static Bool _XimFilterPropertyNotify( Display *display, Window window, XEvent *event, XPointer client_data) { Atom ims, actual_type, *atoms; int actual_format; unsigned long nitems, bytes_after; int ii; XIM xim; Bool flag = False; XimInstCallback icb, picb, tmp; if( (ims = XInternAtom( display, XIM_SERVERS, True )) == None || event->xproperty.atom != ims || event->xproperty.state == PropertyDelete ) return( False ); if( XGetWindowProperty( display, RootWindow(display, 0), ims, 0L, 1000000L, False, XA_ATOM, &actual_type, &actual_format, &nitems, &bytes_after, (unsigned char **)&atoms ) != Success ) { return( False ); } if( actual_type != XA_ATOM || actual_format != 32 ) { XFree( atoms ); return( False ); } lock = True; for( ii = 0; ii < nitems; ii++ ) { if(XGetSelectionOwner (display, atoms[ii])) { for( icb = callback_list; icb; icb = icb->next ) { if( !icb->call && !icb->destroy ) { xim = (*icb->lcd->methods->open_im)( icb->lcd, display, icb->rdb, icb->res_name, icb->res_class ); if( xim ) { xim->methods->close( (XIM)xim ); flag = True; icb->call = True; icb->callback( icb->display, icb->client_data, NULL ); } } } break; } } XFree( atoms ); for( icb = callback_list, picb = NULL; icb; ) { if( icb->destroy ) { if( picb ) picb->next = icb->next; else callback_list = icb->next; tmp = icb; icb = icb->next; XFree( tmp ); } else { picb = icb; icb = icb->next; } } lock = False; return( flag ); } Bool _XimRegisterIMInstantiateCallback( XLCd lcd, Display *display, XrmDatabase rdb, char *res_name, char *res_class, XIDProc callback, XPointer client_data) { XimInstCallback icb, tmp; XIM xim; Window root; XWindowAttributes attr; if( lock ) return( False ); icb = Xmalloc(sizeof(XimInstCallbackRec)); if( !icb ) return( False ); icb->call = icb->destroy = False; icb->display = display; icb->lcd = lcd; MakeLocale( lcd, icb->name ); icb->modifiers = lcd->core->modifiers; /* XXXXX */ icb->rdb = rdb; icb->res_name = res_name; icb->res_class = res_class; icb->callback = callback; icb->client_data = client_data; icb->next = NULL; if( !callback_list ) callback_list = icb; else { for( tmp = callback_list; tmp->next; tmp = tmp->next ); tmp->next = icb; } xim = (*lcd->methods->open_im)( lcd, display, rdb, res_name, res_class ); if( icb == callback_list ) { root = RootWindow( display, 0 ); XGetWindowAttributes( display, root, &attr ); _XRegisterFilterByType( display, root, PropertyNotify, PropertyNotify, _XimFilterPropertyNotify, (XPointer)NULL ); XSelectInput( display, root, attr.your_event_mask | PropertyChangeMask ); } if( xim ) { lock = True; xim->methods->close( (XIM)xim ); lock = False; icb->call = True; callback( display, client_data, NULL ); } return( True ); } Bool _XimUnRegisterIMInstantiateCallback( XLCd lcd, Display *display, XrmDatabase rdb, char *res_name, char *res_class, XIDProc callback, XPointer client_data) { char locale[XIM_MAXLCNAMELEN]; XimInstCallback icb, picb; if( !callback_list ) return( False ); MakeLocale( lcd, locale ); for( icb = callback_list, picb = NULL; icb; picb = icb, icb = icb->next ) { if( !strcmp( locale, icb->name ) && (lcd->core->modifiers == icb->modifiers || /* XXXXX */ (lcd->core->modifiers && icb->modifiers && !strcmp( lcd->core->modifiers, icb->modifiers ))) && rdb == icb->rdb && /* XXXXX */ ((res_name == NULL && icb->res_name == NULL) || (res_name != NULL && icb->res_name != NULL && !strcmp( res_name, icb->res_name ))) && ((res_class == NULL && icb->res_class == NULL) || (res_class != NULL && icb->res_class != NULL && !strcmp( res_class, icb->res_class ))) && (callback == icb->callback) && (client_data == icb->client_data) && /* XXXXX */ !icb->destroy ) { if( lock ) icb->destroy = True; else { if( !picb ) { callback_list = icb->next; _XUnregisterFilter( display, RootWindow(display, 0), _XimFilterPropertyNotify, (XPointer)NULL ); } else picb->next = icb->next; _XCloseLC( icb->lcd ); XFree( icb ); } return( True ); } } return( False ); } void _XimResetIMInstantiateCallback(Xim xim) { char locale[XIM_MAXLCNAMELEN]; XimInstCallback icb; XLCd lcd = xim->core.lcd; if( !callback_list && lock ) return; MakeLocale( lcd, locale ); for( icb = callback_list; icb; icb = icb->next ) if( !strcmp( locale, icb->name ) && (lcd->core->modifiers == icb->modifiers || (lcd->core->modifiers && icb->modifiers && !strcmp( lcd->core->modifiers, icb->modifiers ))) ) icb->call = False; } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imInt.c0000644000000000000000000001427313614532331016501 0ustar /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" #include "XimImSw.h" static Xim *_XimCurrentIMlist = (Xim *)NULL; static int _XimCurrentIMcount = 0; static Bool _XimSetIMStructureList( Xim im) { register int i; Xim *xim; if(!(_XimCurrentIMlist)) { if(!(_XimCurrentIMlist = Xmalloc(sizeof(Xim)))) return False; _XimCurrentIMlist[0] = im; _XimCurrentIMcount = 1; } else { for(i = 0; i < _XimCurrentIMcount; i++) { if(!( _XimCurrentIMlist[i])) { _XimCurrentIMlist[i] = im; break; } } if(i >= _XimCurrentIMcount) { if(!(xim = Xrealloc(_XimCurrentIMlist, ((i + 1) * sizeof(Xim))))) return False; _XimCurrentIMlist = xim; _XimCurrentIMlist[_XimCurrentIMcount] = im; _XimCurrentIMcount++; } } return True; } void _XimDestroyIMStructureList(Xim im) { register int i; for(i = 0; i < _XimCurrentIMcount; i++) { if(_XimCurrentIMlist[i] == im) { _XimCurrentIMlist[i] = NULL; break; } } return; } void _XimServerDestroy(Xim im_2_destroy) { register int i; Xim im; XIC ic; for(i = 0; i < _XimCurrentIMcount; i++) { if(!(im = _XimCurrentIMlist[i])) continue; /* * Only continue if this im is the one to be destroyed. */ if (im != im_2_destroy) continue; if (im->core.destroy_callback.callback) (*im->core.destroy_callback.callback)((XIM)im, im->core.destroy_callback.client_data, NULL); for (ic = im->core.ic_chain; ic; ic = ic->core.next) { if (ic->core.destroy_callback.callback) { (*ic->core.destroy_callback.callback)(ic, ic->core.destroy_callback.client_data, NULL); } } _XimResetIMInstantiateCallback( im ); (void)im->methods->close((XIM)im); Xfree(im); _XimCurrentIMlist[i] = NULL; return; } } #ifdef XIM_CONNECTABLE void _XimServerReconectableDestroy(void) { register int i; Xim im; XIC ic; for(i = 0; i < _XimCurrentIMcount; i++) { if(!(im = _XimCurrentIMlist[i])) continue; if (im->core.destroy_callback.callback) (*im->core.destroy_callback.callback)(im, im->core.destroy_callback.client_data, NULL); for (ic = im->core.ic_chain; ic; ic = ic->core.next) { if (ic->core.destroy_callback.callback) { (*ic->core.destroy_callback.callback)(ic, ic->core.destroy_callback.client_data, NULL); } } _XimResetIMInstantiateCallback( im ); (void)im->methods->close((XIM)im); } return; } #endif /* XIM_CONNECTABLE */ static const char * _XimStrstr( register const char *src, register const char *dest) { int len; len = strlen(dest); while((src = strchr(src, *dest))) { if(!strncmp(src, dest, len)) return src; src++; } return NULL; } static char * _XimMakeImName( XLCd lcd) { const char* begin = NULL; const char* end = NULL; char* ret = NULL; const char* ximmodifier = XIMMODIFIER; if(lcd->core->modifiers != NULL && *lcd->core->modifiers != '\0') { begin = _XimStrstr(lcd->core->modifiers, ximmodifier); if (begin != NULL) { end = begin += strlen(ximmodifier); while (*end && *end != '@') end++; } } ret = Xmalloc(end - begin + 1); if (ret != NULL) { if (begin != NULL && end != NULL) { (void)strncpy(ret, begin, end - begin); ret[end - begin] = '\0'; } else { ret[0] = '\0'; } } return ret; } XIM _XimOpenIM( XLCd lcd, Display *dpy, XrmDatabase rdb, char *res_name, char *res_class) { Xim im; register int i; if (!(im = Xcalloc(1, sizeof(XimRec)))) return (XIM)NULL; im->core.lcd = lcd; im->core.ic_chain = (XIC)NULL; im->core.display = dpy; im->core.rdb = rdb; im->core.res_name = NULL; im->core.res_class = NULL; if((res_name != NULL) && (*res_name != '\0')){ if(!(im->core.res_name = strdup(res_name))) goto Error1; } if((res_class != NULL) && (*res_class != '\0')){ if(!(im->core.res_class = strdup(res_class))) goto Error2; } if(!(im->core.im_name = _XimMakeImName(lcd))) goto Error3; for(i= 0; ; i++) { if(_XimImSportRec[i].checkprocessing(im)) { if(!(_XimImSportRec[i].im_open(im))) goto Error4; if(!_XimSetIMStructureList(im)) goto Error4; return (XIM)im; } } Error4 : _XimImSportRec[i].im_free(im); Xfree(im); return NULL; Error3 : Xfree(im->core.im_name); Error2: Xfree(im->core.res_class); Error1: Xfree(im->core.res_name); Xfree(im); return NULL; } Bool _XInitIM(XLCd lcd) { if(lcd == (XLCd)NULL) return False; lcd->methods->open_im = _XimOpenIM; lcd->methods->register_callback = _XimRegisterIMInstantiateCallback; lcd->methods->unregister_callback = _XimUnRegisterIMInstantiateCallback; return True; } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imLcFlt.c0000644000000000000000000001240013614532331016741 0ustar /****************************************************************** Copyright 1992 by Fuji Xerox Co., Ltd. Copyright 1992, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Fuji Xerox, FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Fuji Xerox, FUJITSU LIMITED make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJI XEROX, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJI XEROX, FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author : Kazunori Nishihara Fuji Xerox Modifier : Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include "Xlcint.h" #include "Ximint.h" Bool _XimLocalFilter(Display *d, Window w, XEvent *ev, XPointer client_data) { Xic ic = (Xic)client_data; KeySym keysym; static char buf[256]; static unsigned prevcode = 0, prevstate = 0; unsigned currstate; DefTree *b = ic->private.local.base.tree; DTIndex t; Bool braille = False, anymodifier = False; if(ev->xkey.keycode == 0) return (False); XLookupString((XKeyEvent *)ev, buf, sizeof(buf), &keysym, NULL); if(keysym >= XK_braille_dot_1 && keysym <= XK_braille_dot_8) { if(ev->type == KeyPress) { ic->private.local.brl_pressed |= 1<<(keysym-XK_braille_dot_1); return(True); } else { if(!ic->private.local.brl_committing || ev->xkey.time - ic->private.local.brl_release_start > 300) { ic->private.local.brl_committing = ic->private.local.brl_pressed; ic->private.local.brl_release_start = ev->xkey.time; } ic->private.local.brl_pressed &= ~(1<<(keysym-XK_braille_dot_1)); if(!ic->private.local.brl_pressed && ic->private.local.brl_committing) { /* Commited a braille pattern, let it go through compose tree */ keysym = XK_braille_blank | ic->private.local.brl_committing; ev->type = KeyPress; braille = True; } else { return(True); } } } if(((Xim)ic->core.im)->private.local.top == 0 ) goto emit_braille; currstate = ev->xkey.state; if(ev->type == KeyPress) { prevcode = ev->xkey.keycode; prevstate = currstate; if(IsModifierKey(keysym)) return(False); prevcode = 0; } else { if(prevcode != ev->xkey.keycode) return False; /* For lookup, we use the state at the time when the key was pressed, */ /* because this state was not affected by the modifier that is mapped */ /* to the key. */ ev->xkey.state = prevstate; XLookupString((XKeyEvent *)ev, buf, sizeof(buf), &keysym, NULL); } for(t = ic->private.local.context; t; t = b[t].next) { if(IsModifierKey(b[t].keysym)) anymodifier = True; if(((ev->xkey.state & b[t].modifier_mask) == b[t].modifier) && (keysym == b[t].keysym)) break; } /* Restore the state */ ev->xkey.state = currstate; if(t) { /* Matched */ if(b[t].succession) { /* Intermediate */ ic->private.local.context = b[t].succession; return (ev->type == KeyPress); } else { /* Terminate (reached to leaf) */ ic->private.local.composed = t; ic->private.local.brl_committed = 0; /* return back to client KeyPressEvent keycode == 0 */ ev->xkey.keycode = 0; ev->xkey.type = KeyPress; XPutBackEvent(d, ev); if(prevcode){ /* For modifier key releases, restore the event, as we do not */ /* filter it. */ ev->xkey.type = KeyRelease; ev->xkey.keycode = prevcode; } /* initialize internal state for next key sequence */ ic->private.local.context = ((Xim)ic->core.im)->private.local.top; return (ev->type == KeyPress); } } else { /* Unmatched */ /* Unmatched modifier key releases abort matching only in the case that */ /* there was any modifier that would have matched */ if((ic->private.local.context == ((Xim)ic->core.im)->private.local.top) || (ev->type == KeyRelease && !anymodifier)) { goto emit_braille; } /* Error (Sequence Unmatch occured) */ /* initialize internal state for next key sequence */ ic->private.local.context = ((Xim)ic->core.im)->private.local.top; return (ev->type == KeyPress); } emit_braille: if(braille) { /* Braille pattern is not in compose tree, emit alone */ ic->private.local.brl_committed = ic->private.local.brl_committing; ic->private.local.composed = 0; ev->xkey.keycode = 0; _XPutBackEvent(d, ev); return(True); } return(False); } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imLcGIc.c0000644000000000000000000000343113614532331016662 0ustar /****************************************************************** Copyright 1992,1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" char * _XimLocalGetICValues(XIC xic, XIMArg *values) { Xic ic = (Xic)xic; XimDefICValues ic_values; _XimGetCurrentICValues(ic, &ic_values); return(_XimGetICValueData(ic, (XPointer)&ic_values, ic->private.local.ic_resources, ic->private.local.ic_num_resources, values, XIM_GETICVALUES)); } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imLcIc.c0000644000000000000000000001312613614532331016555 0ustar /****************************************************************** Copyright 1992,1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" static void _XimLocalUnSetFocus( XIC xic) { Xic ic = (Xic)xic; ((Xim)ic->core.im)->private.local.current_ic = (XIC)NULL; if (ic->core.focus_window) _XUnregisterFilter(ic->core.im->core.display, ic->core.focus_window, _XimLocalFilter, (XPointer)ic); return; } static void _XimLocalDestroyIC( XIC xic) { Xic ic = (Xic)xic; if(((Xim)ic->core.im)->private.local.current_ic == (XIC)ic) { ((Xim)ic->core.im)->private.local.current_ic = (XIC)NULL; } if (ic->core.focus_window) _XUnregisterFilter(ic->core.im->core.display, ic->core.focus_window, _XimLocalFilter, (XPointer)ic); if(ic->private.local.ic_resources) { Xfree(ic->private.local.ic_resources); ic->private.local.ic_resources = NULL; } return; } static void _XimLocalSetFocus( XIC xic) { Xic ic = (Xic)xic; XIC current_ic = ((Xim)ic->core.im)->private.local.current_ic; if (current_ic == (XIC)ic) return; if (current_ic != (XIC)NULL) { _XimLocalUnSetFocus(current_ic); } ((Xim)ic->core.im)->private.local.current_ic = (XIC)ic; if (ic->core.focus_window) _XRegisterFilterByType(ic->core.im->core.display, ic->core.focus_window, KeyPress, KeyRelease, _XimLocalFilter, (XPointer)ic); return; } static void _XimLocalReset( XIC xic) { Xic ic = (Xic)xic; ic->private.local.composed = 0; ic->private.local.context = ((Xim)ic->core.im)->private.local.top; ic->private.local.brl_pressed = 0; ic->private.local.brl_committing = 0; ic->private.local.brl_committed = 0; } static char * _XimLocalMbReset( XIC xic) { _XimLocalReset(xic); return (char *)NULL; } static wchar_t * _XimLocalWcReset( XIC xic) { _XimLocalReset(xic); return (wchar_t *)NULL; } static XICMethodsRec Local_ic_methods = { _XimLocalDestroyIC, /* destroy */ _XimLocalSetFocus, /* set_focus */ _XimLocalUnSetFocus, /* unset_focus */ _XimLocalSetICValues, /* set_values */ _XimLocalGetICValues, /* get_values */ _XimLocalMbReset, /* mb_reset */ _XimLocalWcReset, /* wc_reset */ _XimLocalMbReset, /* utf8_reset */ _XimLocalMbLookupString, /* mb_lookup_string */ _XimLocalWcLookupString, /* wc_lookup_string */ _XimLocalUtf8LookupString /* utf8_lookup_string */ }; XIC _XimLocalCreateIC( XIM im, XIMArg *values) { Xic ic; XimDefICValues ic_values; XIMResourceList res; unsigned int num; int len; if((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL) { return ((XIC)NULL); } ic->methods = &Local_ic_methods; ic->core.im = im; ic->private.local.base = ((Xim)im)->private.local.base; ic->private.local.context = ((Xim)im)->private.local.top; ic->private.local.composed = 0; ic->private.local.brl_pressed = 0; ic->private.local.brl_committing = 0; ic->private.local.brl_committed = 0; num = im->core.ic_num_resources; len = sizeof(XIMResource) * num; if((res = Xmalloc(len)) == (XIMResourceList)NULL) { goto Set_Error; } (void)memcpy((char *)res, (char *)im->core.ic_resources, len); ic->private.local.ic_resources = res; ic->private.local.ic_num_resources = num; bzero((char *)&ic_values, sizeof(XimDefICValues)); if(_XimCheckLocalInputStyle(ic, (XPointer)&ic_values, values, im->core.styles, res, num) == False) { goto Set_Error; } _XimSetICMode(res, num, ic_values.input_style); if(_XimSetICValueData(ic, (XPointer)&ic_values, ic->private.local.ic_resources, ic->private.local.ic_num_resources, values, XIM_CREATEIC, True)) { goto Set_Error; } ic_values.filter_events = KeyPressMask | KeyReleaseMask; _XimSetCurrentICValues(ic, &ic_values); if(_XimSetICDefaults(ic, (XPointer)&ic_values, XIM_SETICDEFAULTS, res, num) == False) { goto Set_Error; } _XimSetCurrentICValues(ic, &ic_values); return((XIC)ic); Set_Error : if (ic->private.local.ic_resources) { Xfree(ic->private.local.ic_resources); ic->private.local.ic_resources = NULL; } Xfree(ic); return((XIC)NULL); } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imLcIm.c0000644000000000000000000004732013614532331016572 0ustar /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1993 by Digital Equipment Corporation Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED and Digital Equipment Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED and Digital Equipment Corporation makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp Modifier: Franky Ling Digital Equipment Corporation frankyling@hgrd01.enet.dec.com ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include "Xlibint.h" #include "Xlcint.h" #include "XlcPublic.h" #include "XlcPubI.h" #include "Ximint.h" #include #include #ifdef COMPOSECACHE # include # include # include # include #endif #ifdef COMPOSECACHE /* include trailing '/' for cache directory, file prefix otherwise */ #define XIM_GLOBAL_CACHE_DIR "/var/cache/libx11/compose/" #define XIM_HOME_CACHE_DIR "/.compose-cache/" #define XIM_CACHE_MAGIC ('X' | 'i'<<8 | 'm'<<16 | 'C'<<24) #define XIM_CACHE_VERSION 4 #define XIM_CACHE_TREE_ALIGNMENT 4 #define XIM_HASH_PRIME_1 13 #define XIM_HASH_PRIME_2 1234096939 typedef INT32 DTStructIndex; struct _XimCacheStruct { INT32 id; INT32 version; DTStructIndex tree; DTStructIndex mb; DTStructIndex wc; DTStructIndex utf8; DTStructIndex size; DTIndex top; DTIndex treeused; DTCharIndex mbused; DTCharIndex wcused; DTCharIndex utf8used; char fname[]; /* char encoding[] */ }; static struct _XimCacheStruct* _XimCache_mmap = NULL; static DefTreeBase _XimCachedDefaultTreeBase; static int _XimCachedDefaultTreeRefcount = 0; #endif Bool _XimCheckIfLocalProcessing(Xim im) { FILE *fp; char *name; if(strcmp(im->core.im_name, "") == 0) { name = _XlcFileName(im->core.lcd, COMPOSE_FILE); if (name != (char *)NULL) { fp = _XFopenFile (name, "r"); Xfree(name); if (fp != (FILE *)NULL) { fclose(fp); return(True); } } return(False); } else if(strcmp(im->core.im_name, "local") == 0 || strcmp(im->core.im_name, "none" ) == 0 ) { return(True); } return(False); } static void XimFreeDefaultTree( DefTreeBase *b) { if (!b) return; if (b->tree == NULL) return; #ifdef COMPOSECACHE if (b->tree == _XimCachedDefaultTreeBase.tree) { _XimCachedDefaultTreeRefcount--; /* No deleting, it's a cache after all. */ return; } #endif Xfree (b->tree); b->tree = NULL; Xfree (b->mb); b->mb = NULL; Xfree (b->wc); b->wc = NULL; Xfree (b->utf8); b->utf8 = NULL; b->treeused = b->treesize = 0; b->mbused = b->mbsize = 0; b->wcused = b->wcsize = 0; b->utf8used = b->utf8size = 0; } void _XimLocalIMFree( Xim im) { XimFreeDefaultTree(&im->private.local.base); im->private.local.top = 0; Xfree(im->core.im_resources); im->core.im_resources = NULL; Xfree(im->core.ic_resources); im->core.ic_resources = NULL; Xfree(im->core.im_values_list); im->core.im_values_list = NULL; Xfree(im->core.ic_values_list); im->core.ic_values_list = NULL; Xfree(im->core.styles); im->core.styles = NULL; Xfree(im->core.res_name); im->core.res_name = NULL; Xfree(im->core.res_class); im->core.res_class = NULL; Xfree(im->core.im_name); im->core.im_name = NULL; if (im->private.local.ctom_conv) { _XlcCloseConverter(im->private.local.ctom_conv); im->private.local.ctom_conv = NULL; } if (im->private.local.ctow_conv) { _XlcCloseConverter(im->private.local.ctow_conv); im->private.local.ctow_conv = NULL; } if (im->private.local.ctoutf8_conv) { _XlcCloseConverter(im->private.local.ctoutf8_conv); im->private.local.ctoutf8_conv = NULL; } if (im->private.local.cstomb_conv) { _XlcCloseConverter(im->private.local.cstomb_conv); im->private.local.cstomb_conv = NULL; } if (im->private.local.cstowc_conv) { _XlcCloseConverter(im->private.local.cstowc_conv); im->private.local.cstowc_conv = NULL; } if (im->private.local.cstoutf8_conv) { _XlcCloseConverter(im->private.local.cstoutf8_conv); im->private.local.cstoutf8_conv = NULL; } if (im->private.local.ucstoc_conv) { _XlcCloseConverter(im->private.local.ucstoc_conv); im->private.local.ucstoc_conv = NULL; } if (im->private.local.ucstoutf8_conv) { _XlcCloseConverter(im->private.local.ucstoutf8_conv); im->private.local.ucstoutf8_conv = NULL; } return; } static Status _XimLocalCloseIM( XIM xim) { Xim im = (Xim)xim; XIC ic; XIC next; ic = im->core.ic_chain; im->core.ic_chain = NULL; while (ic) { (*ic->methods->destroy) (ic); next = ic->core.next; Xfree (ic); ic = next; } _XimLocalIMFree(im); _XimDestroyIMStructureList(im); return(True); } char * _XimLocalGetIMValues( XIM xim, XIMArg *values) { Xim im = (Xim)xim; XimDefIMValues im_values; _XimGetCurrentIMValues(im, &im_values); return(_XimGetIMValueData(im, (XPointer)&im_values, values, im->core.im_resources, im->core.im_num_resources)); } char * _XimLocalSetIMValues( XIM xim, XIMArg *values) { Xim im = (Xim)xim; XimDefIMValues im_values; char *name = (char *)NULL; _XimGetCurrentIMValues(im, &im_values); name = _XimSetIMValueData(im, (XPointer)&im_values, values, im->core.im_resources, im->core.im_num_resources); _XimSetCurrentIMValues(im, &im_values); return(name); } #ifdef COMPOSECACHE static Bool _XimReadCachedDefaultTree( int fd_cache, const char *name, const char *encoding, DTStructIndex size) { struct _XimCacheStruct* m; int namelen = strlen (name) + 1; int encodinglen = strlen (encoding) + 1; m = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd_cache, 0); if (m == NULL || m == MAP_FAILED) return False; assert (m->id == XIM_CACHE_MAGIC); assert (m->version == XIM_CACHE_VERSION); if (size != m->size || size < sizeof (struct _XimCacheStruct) + namelen + encodinglen) { fprintf (stderr, "Ignoring broken XimCache %s [%s]\n", name, encoding); munmap (m, size); return False; } if (strncmp (name, m->fname, namelen) != 0) { /* m->fname may *not* be terminated - but who cares here */ fprintf (stderr, "Filename hash clash - expected %s, got %s\n", name, m->fname); munmap (m, size); return False; } if (strncmp (encoding, m->fname + namelen, encodinglen) != 0) { /* m->fname+namelen may *not* be terminated - but who cares here */ fprintf (stderr, "Enoding hash clash - expected %s, got %s\n", encoding, m->fname + namelen); munmap (m, size); return False; } _XimCache_mmap = m; _XimCachedDefaultTreeBase.tree = (DefTree *) (((char *) m) + m->tree); _XimCachedDefaultTreeBase.mb = (((char *) m) + m->mb); _XimCachedDefaultTreeBase.wc = (wchar_t *) (((char *) m) + m->wc); _XimCachedDefaultTreeBase.utf8 = (((char *) m) + m->utf8); _XimCachedDefaultTreeBase.treeused = m->treeused; _XimCachedDefaultTreeBase.mbused = m->mbused; _XimCachedDefaultTreeBase.wcused = m->wcused; _XimCachedDefaultTreeBase.utf8used = m->utf8used; /* treesize etc. is ignored because only used during parsing */ _XimCachedDefaultTreeRefcount = 0; /* fprintf (stderr, "read cached tree at %p: %s\n", (void *) m, name); */ return True; } static unsigned int strToHash ( const char *name) { unsigned int hash = 0; while (*name) hash = hash * XIM_HASH_PRIME_1 + *(unsigned const char *)name++; return hash % XIM_HASH_PRIME_2; } /* Returns read-only fd of cache file, -1 if none. * Sets *res to cache filename if safe. Sets *size to file size of cache. */ static int _XimCachedFileName ( const char *dir, const char *name, const char *intname, const char *encoding, uid_t uid, int isglobal, char **res, off_t *size) { struct stat st_name, st; int fd; unsigned int len, hash, hash2; struct _XimCacheStruct *m; /* There are some races here with 'dir', but we are either in our own home * or the global cache dir, and not inside some public writable dir */ /* fprintf (stderr, "XimCachedFileName for dir %s name %s intname %s encoding %s uid %d\n", dir, name, intname, encoding, uid); */ if (stat (name, &st_name) == -1 || ! S_ISREG (st_name.st_mode) || stat (dir, &st) == -1 || ! S_ISDIR (st.st_mode) || st.st_uid != uid || (st.st_mode & 0022) != 0000) { *res = NULL; return -1; } len = strlen (dir); hash = strToHash (intname); hash2 = strToHash (encoding); *res = Xmalloc (len + 1 + 27 + 1); /* Max VERSION 9999 */ if (len == 0 || dir [len-1] != '/') sprintf (*res, "%s/%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(), XIM_CACHE_VERSION, (unsigned int)sizeof (DefTree), hash, hash2); else sprintf (*res, "%s%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(), XIM_CACHE_VERSION, (unsigned int)sizeof (DefTree), hash, hash2); /* fprintf (stderr, "-> %s\n", *res); */ if ( (fd = _XOpenFile (*res, O_RDONLY)) == -1) return -1; if (fstat (fd, &st) == -1) { Xfree (*res); *res = NULL; close (fd); return -1; } *size = st.st_size; if (! S_ISREG (st.st_mode) || st.st_uid != uid || (st.st_mode & 0022) != 0000 || st.st_mtime <= st_name.st_mtime || (st.st_mtime < time (NULL) - 24*60*60 && ! isglobal)) { close (fd); if (unlink (*res) != 0) { Xfree (*res); *res = NULL; /* cache is not safe */ } return -1; } m = mmap (NULL, sizeof (struct _XimCacheStruct), PROT_READ, MAP_PRIVATE, fd, 0); if (m == NULL || m == MAP_FAILED) { close (fd); Xfree (*res); *res = NULL; return -1; } if (*size < sizeof (struct _XimCacheStruct) || m->id != XIM_CACHE_MAGIC) { munmap (m, sizeof (struct _XimCacheStruct)); close (fd); fprintf (stderr, "Ignoring broken XimCache %s\n", *res); Xfree (*res); *res = NULL; return -1; } if (m->version != XIM_CACHE_VERSION) { munmap (m, sizeof (struct _XimCacheStruct)); close (fd); if (unlink (*res) != 0) { Xfree (*res); *res = NULL; /* cache is not safe */ } return -1; } munmap (m, sizeof (struct _XimCacheStruct)); return fd; } static Bool _XimLoadCache ( int fd, const char *name, const char *encoding, off_t size, Xim im) { if (_XimCache_mmap || _XimReadCachedDefaultTree (fd, name, encoding, size)) { _XimCachedDefaultTreeRefcount++; memcpy (&im->private.local.base, &_XimCachedDefaultTreeBase, sizeof (_XimCachedDefaultTreeBase)); im->private.local.top = _XimCache_mmap->top; return True; } return False; } static void _XimWriteCachedDefaultTree( const char *name, const char *encoding, const char *cachename, Xim im) { int fd; FILE *fp; struct _XimCacheStruct *m; int msize = (sizeof(struct _XimCacheStruct) + strlen(name) + strlen(encoding) + 2 + XIM_CACHE_TREE_ALIGNMENT-1) & -XIM_CACHE_TREE_ALIGNMENT; DefTreeBase *b = &im->private.local.base; if (! b->tree && ! (b->tree = Xcalloc (1, sizeof(DefTree))) ) return; if (! b->mb && ! (b->mb = Xmalloc (1)) ) return; if (! b->wc && ! (b->wc = Xmalloc (sizeof(wchar_t))) ) return; if (! b->utf8 && ! (b->utf8 = Xmalloc (1)) ) return; /* First entry is always unused */ b->mb[0] = 0; b->wc[0] = 0; b->utf8[0] = 0; m = Xcalloc (1, msize); m->id = XIM_CACHE_MAGIC; m->version = XIM_CACHE_VERSION; m->top = im->private.local.top; m->treeused = b->treeused; m->mbused = b->mbused; m->wcused = b->wcused; m->utf8used = b->utf8used; /* Tree first, then wide chars, then the rest due to alignment */ m->tree = msize; m->wc = msize + sizeof (DefTree) * m->treeused; m->mb = m->wc + sizeof (wchar_t) * m->wcused; m->utf8 = m->mb + m->mbused; m->size = m->utf8 + m->utf8used; strcpy (m->fname, name); strcpy (m->fname+strlen(name)+1, encoding); /* This STILL might be racy on NFS */ if ( (fd = _XOpenFileMode (cachename, O_WRONLY | O_CREAT | O_EXCL, 0600)) < 0) { Xfree(m); return; } if (! (fp = fdopen (fd, "wb")) ) { close (fd); Xfree(m); return; } fwrite (m, msize, 1, fp); fwrite (im->private.local.base.tree, sizeof(DefTree), m->treeused, fp); fwrite (im->private.local.base.wc, sizeof(wchar_t), m->wcused, fp); fwrite (im->private.local.base.mb, 1, m->mbused, fp); fwrite (im->private.local.base.utf8, 1, m->utf8used, fp); if (fclose (fp) != 0) unlink (cachename); _XimCache_mmap = m; memcpy (&_XimCachedDefaultTreeBase, &im->private.local.base, sizeof (_XimCachedDefaultTreeBase)); /* fprintf (stderr, "wrote tree %s size %ld to %s\n", name, m->size, cachename); */ } #endif static void _XimCreateDefaultTree( Xim im) { FILE *fp = NULL; char *name, *tmpname = NULL; char *cachename = NULL; /* Should use getpwent() instead of $HOME (cross-platform?) */ char *home = getenv("HOME"); char *tmpcachedir = NULL; int hl = home ? strlen (home) : 0; #ifdef COMPOSECACHE char *intname; char *cachedir = NULL; const char *encoding = nl_langinfo (CODESET); uid_t euid = geteuid (); gid_t egid = getegid (); int cachefd = -1; off_t size; #endif name = getenv("XCOMPOSEFILE"); if (name == (char *) NULL) { if (home != (char *) NULL) { tmpname = name = Xmalloc(hl + 10 + 1); if (name != (char *) NULL) { int fd; strcpy(name, home); strcpy(name + hl, "/.XCompose"); if ( (fd = _XOpenFile (name, O_RDONLY)) < 0) { Xfree (name); name = tmpname = NULL; } else close (fd); } } } if (name == (char *) NULL) { tmpname = name = _XlcFileName(im->core.lcd, COMPOSE_FILE); } #ifdef COMPOSECACHE intname = name; if (getuid () == euid && getgid () == egid && euid != 0) { char *c; /* Usage: XCOMPOSECACHE=[=] * cachedir: directory of cache files * filename: internally used name for cache file */ cachedir = getenv("XCOMPOSECACHE"); if (cachedir && (c = strchr (cachedir, '='))) { tmpcachedir = strdup (cachedir); intname = tmpcachedir + (c-cachedir) + 1; tmpcachedir[c-cachedir] = '\0'; cachedir = tmpcachedir; } } if (! cachedir) { cachefd = _XimCachedFileName (XIM_GLOBAL_CACHE_DIR, name, intname, encoding, 0, 1, &cachename, &size); if (cachefd != -1) { if (_XimLoadCache (cachefd, intname, encoding, size, im)) { Xfree (tmpcachedir); Xfree (tmpname); Xfree (cachename); close (cachefd); return; } close (cachefd); } Xfree (cachename); cachename = NULL; } if (getuid () == euid && getgid () == egid && euid != 0 && home) { if (! cachedir) { tmpcachedir = cachedir = Xmalloc (hl+strlen(XIM_HOME_CACHE_DIR)+1); strcpy (cachedir, home); strcat (cachedir, XIM_HOME_CACHE_DIR); } cachefd = _XimCachedFileName (cachedir, name, intname, encoding, euid, 0, &cachename, &size); if (cachefd != -1) { if (_XimLoadCache (cachefd, intname, encoding, size, im)) { Xfree (tmpcachedir); Xfree (tmpname); Xfree (cachename); close (cachefd); return; } close (cachefd); } } #endif if (! (fp = _XFopenFile (name, "r"))) { Xfree (tmpcachedir); Xfree (tmpname); Xfree (cachename); return; } _XimParseStringFile(fp, im); fclose(fp); #ifdef COMPOSECACHE if (cachename) { assert (euid != 0); _XimWriteCachedDefaultTree (intname, encoding, cachename, im); } #endif Xfree (tmpcachedir); Xfree (tmpname); Xfree (cachename); } static XIMMethodsRec Xim_im_local_methods = { _XimLocalCloseIM, /* close */ _XimLocalSetIMValues, /* set_values */ _XimLocalGetIMValues, /* get_values */ _XimLocalCreateIC, /* create_ic */ _XimLcctstombs, /* ctstombs */ _XimLcctstowcs, /* ctstowcs */ _XimLcctstoutf8 /* ctstoutf8 */ }; Bool _XimLocalOpenIM( Xim im) { XLCd lcd = im->core.lcd; XlcConv conv; XimDefIMValues im_values; XimLocalPrivateRec* private = &im->private.local; _XimInitialResourceInfo(); if(_XimSetIMResourceList(&im->core.im_resources, &im->core.im_num_resources) == False) { goto Open_Error; } if(_XimSetICResourceList(&im->core.ic_resources, &im->core.ic_num_resources) == False) { goto Open_Error; } _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); _XimGetCurrentIMValues(im, &im_values); if(_XimSetLocalIMDefaults(im, (XPointer)&im_values, im->core.im_resources, im->core.im_num_resources) == False) { goto Open_Error; } _XimSetCurrentIMValues(im, &im_values); if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte))) goto Open_Error; private->ctom_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar))) goto Open_Error; private->ctow_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNUtf8String))) goto Open_Error; private->ctoutf8_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte))) goto Open_Error; private->cstomb_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNWideChar))) goto Open_Error; private->cstowc_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String))) goto Open_Error; private->cstoutf8_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) goto Open_Error; private->ucstoc_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) goto Open_Error; private->ucstoutf8_conv = conv; private->base.treeused = 1; private->base.mbused = 1; private->base.wcused = 1; private->base.utf8used = 1; _XimCreateDefaultTree(im); im->methods = &Xim_im_local_methods; private->current_ic = (XIC)NULL; return(True); Open_Error : _XimLocalIMFree(im); return(False); } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imLcLkup.c0000644000000000000000000002604413614532331017140 0ustar /****************************************************************** Copyright 1992 by Fuji Xerox Co., Ltd. Copyright 1992, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Fuji Xerox, FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Fuji Xerox, FUJITSU LIMITED make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJI XEROX, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJI XEROX, FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Kazunori Nishihara Fuji Xerox Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include "Xlibint.h" #include "Xlcint.h" #include "XlcPubI.h" #include "Ximint.h" int _XimLocalMbLookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes, KeySym *keysym, Status *status) { Xic ic = (Xic)xic; int ret; DefTree *b = ic->private.local.base.tree; char *mb = ic->private.local.base.mb; if(ev->type != KeyPress) { if(status) *status = XLookupNone; return(0); } if(ev->keycode == 0 && ( (ic->private.local.composed != 0) ||(ic->private.local.brl_committed != 0))) { if (ic->private.local.brl_committed != 0) { /* Braille Event */ unsigned char pattern = ic->private.local.brl_committed; char mb2[XLC_PUBLIC(ic->core.im->core.lcd, mb_cur_max)]; ret = _Xlcwctomb(ic->core.im->core.lcd, mb2, BRL_UC_ROW | pattern); if(ret > bytes) { if(status) *status = XBufferOverflow; return(ret); } if(keysym) *keysym = XK_braille_blank | pattern; if(ret > 0) { if (keysym) { if(status) *status = XLookupBoth; } else { if(status) *status = XLookupChars; } memcpy(buffer, mb2, ret); } else { if(keysym) { if(status) *status = XLookupKeySym; } else { if(status) *status = XLookupNone; } } } else { /* Composed Event */ ret = strlen(&mb[b[ic->private.local.composed].mb]); if(ret > bytes) { if(status) *status = XBufferOverflow; return(ret); } memcpy(buffer, &mb[b[ic->private.local.composed].mb], ret); if(keysym) *keysym = b[ic->private.local.composed].ks; if (ret > 0) { if (keysym && *keysym != NoSymbol) { if(status) *status = XLookupBoth; } else { if(status) *status = XLookupChars; } } else { if(keysym && *keysym != NoSymbol) { if(status) *status = XLookupKeySym; } else { if(status) *status = XLookupNone; } } } return (ret); } else { /* Throughed Event */ ret = _XimLookupMBText(ic, ev, buffer, bytes, keysym, NULL); if(ret > 0) { if (ret > bytes) { if (status) *status = XBufferOverflow; } else if (keysym && *keysym != NoSymbol) { if(status) *status = XLookupBoth; } else { if(status) *status = XLookupChars; } } else { if(keysym && *keysym != NoSymbol) { if(status) *status = XLookupKeySym; } else { if(status) *status = XLookupNone; } } } return (ret); } int _XimLocalWcLookupString(XIC xic, XKeyEvent *ev, wchar_t *buffer, int wlen, KeySym *keysym, Status *status) { Xic ic = (Xic)xic; int ret; DefTree *b = ic->private.local.base.tree; wchar_t *wc = ic->private.local.base.wc; if(ev->type != KeyPress) { if(status) *status = XLookupNone; return(0); } if(ev->keycode == 0) { if (ic->private.local.brl_committed != 0) { /* Braille Event */ unsigned char pattern = ic->private.local.brl_committed; ret = 1; if (ret > wlen) { if(status) *status = XBufferOverflow; return (ret); } *buffer = BRL_UC_ROW | pattern; if(keysym) { *keysym = XK_braille_blank | pattern; if(status) *status = XLookupBoth; } else if(status) *status = XLookupChars; } else { /* Composed Event */ ret = _Xwcslen(&wc[b[ic->private.local.composed].wc]); if(ret > wlen) { if(status) *status = XBufferOverflow; return (ret); } memcpy((char *)buffer, (char *)&wc[b[ic->private.local.composed].wc], ret * sizeof(wchar_t)); if(keysym) *keysym = b[ic->private.local.composed].ks; if (ret > 0) { if (keysym && *keysym != NoSymbol) { if(status) *status = XLookupBoth; } else { if(status) *status = XLookupChars; } } else { if(keysym && *keysym != NoSymbol) { if(status) *status = XLookupKeySym; } else { if(status) *status = XLookupNone; } } } return (ret); } else { /* Throughed Event */ ret = _XimLookupWCText(ic, ev, buffer, wlen, keysym, NULL); if(ret > 0) { if (ret > wlen) { if (status) *status = XBufferOverflow; } else if (keysym && *keysym != NoSymbol) { if(status) *status = XLookupBoth; } else { if(status) *status = XLookupChars; } } else { if(keysym && *keysym != NoSymbol) { if(status) *status = XLookupKeySym; } else { if(status) *status = XLookupNone; } } } return (ret); } int _XimLocalUtf8LookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes, KeySym *keysym, Status *status) { Xic ic = (Xic)xic; int ret; DefTree *b = ic->private.local.base.tree; char *utf8 = ic->private.local.base.utf8; if(ev->type != KeyPress) { if(status) *status = XLookupNone; return(0); } if(ev->keycode == 0) { if (ic->private.local.brl_committed != 0) { /* Braille Event */ unsigned char pattern = ic->private.local.brl_committed; ret = 3; if (ret > bytes) { if(status) *status = XBufferOverflow; return (ret); } buffer[0] = 0xe0 | ((BRL_UC_ROW >> 12) & 0x0f); buffer[1] = 0x80 | ((BRL_UC_ROW >> 8) & 0x30) | (pattern >> 6); buffer[2] = 0x80 | (pattern & 0x3f); if(keysym) { *keysym = XK_braille_blank | pattern; if(status) *status = XLookupBoth; } else if(status) *status = XLookupChars; } else { /* Composed Event */ ret = strlen(&utf8[b[ic->private.local.composed].utf8]); if(ret > bytes) { if(status) *status = XBufferOverflow; return (ret); } memcpy(buffer, &utf8[b[ic->private.local.composed].utf8], ret); if(keysym) *keysym = b[ic->private.local.composed].ks; if (ret > 0) { if (keysym && *keysym != NoSymbol) { if(status) *status = XLookupBoth; } else { if(status) *status = XLookupChars; } } else { if(keysym && *keysym != NoSymbol) { if(status) *status = XLookupKeySym; } else { if(status) *status = XLookupNone; } } } return (ret); } else { /* Throughed Event */ ret = _XimLookupUTF8Text(ic, ev, buffer, bytes, keysym, NULL); if(ret > 0) { if (ret > bytes) { if (status) *status = XBufferOverflow; } else if (keysym && *keysym != NoSymbol) { if(status) *status = XLookupBoth; } else { if(status) *status = XLookupChars; } } else { if(keysym && *keysym != NoSymbol) { if(status) *status = XLookupKeySym; } else { if(status) *status = XLookupNone; } } } return (ret); } static int _XimLcctsconvert( XlcConv conv, char *from, int from_len, char *to, int to_len, Status *state) { int from_left; int to_left; int from_savelen; int to_savelen; int from_cnvlen; int to_cnvlen; char *from_buf; char *to_buf; char scratchbuf[BUFSIZ]; Status tmp_state; if (!state) state = &tmp_state; if (!conv || !from || !from_len) { *state = XLookupNone; return 0; } /* Reset the converter. The CompoundText at 'from' starts in initial state. */ _XlcResetConverter(conv); from_left = from_len; to_left = BUFSIZ; from_cnvlen = 0; to_cnvlen = 0; for (;;) { from_buf = &from[from_cnvlen]; from_savelen = from_left; to_buf = &scratchbuf[to_cnvlen]; to_savelen = to_left; if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { *state = XLookupNone; return 0; } from_cnvlen += (from_savelen - from_left); to_cnvlen += (to_savelen - to_left); if (from_left == 0) { if (!to_cnvlen) { *state = XLookupNone; return 0; } break; } } if (!to || !to_len || (to_len < to_cnvlen)) { *state = XBufferOverflow; } else { memcpy(to, scratchbuf, to_cnvlen); *state = XLookupChars; } return to_cnvlen; } int _XimLcctstombs(XIM xim, char *from, int from_len, char *to, int to_len, Status *state) { return _XimLcctsconvert(((Xim)xim)->private.local.ctom_conv, from, from_len, to, to_len, state); } int _XimLcctstowcs(XIM xim, char *from, int from_len, wchar_t *to, int to_len, Status *state) { Xim im = (Xim)xim; XlcConv conv = im->private.local.ctow_conv; int from_left; int to_left; int from_savelen; int to_savelen; int from_cnvlen; int to_cnvlen; char *from_buf; wchar_t *to_buf; wchar_t scratchbuf[BUFSIZ]; Status tmp_state; if (!state) state = &tmp_state; if (!conv || !from || !from_len) { *state = XLookupNone; return 0; } /* Reset the converter. The CompoundText at 'from' starts in initial state. */ _XlcResetConverter(conv); from_left = from_len; to_left = BUFSIZ; from_cnvlen = 0; to_cnvlen = 0; for (;;) { from_buf = &from[from_cnvlen]; from_savelen = from_left; to_buf = &scratchbuf[to_cnvlen]; to_savelen = to_left; if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { *state = XLookupNone; return 0; } from_cnvlen += (from_savelen - from_left); to_cnvlen += (to_savelen - to_left); if (from_left == 0) { if (!to_cnvlen){ *state = XLookupNone; return 0; } break; } } if (!to || !to_len || (to_len < to_cnvlen)) { *state = XBufferOverflow; } else { memcpy(to, scratchbuf, to_cnvlen * sizeof(wchar_t)); *state = XLookupChars; } return to_cnvlen; } int _XimLcctstoutf8(XIM xim, char *from, int from_len, char *to, int to_len, Status *state) { return _XimLcctsconvert(((Xim)xim)->private.local.ctoutf8_conv, from, from_len, to, to_len, state); } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imLcPrs.c0000644000000000000000000004240513614532331016770 0ustar /****************************************************************** Copyright 1992 by Oki Technosystems Laboratory, Inc. Copyright 1992 by Fuji Xerox Co., Ltd. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Oki Technosystems Laboratory and Fuji Xerox not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Oki Technosystems Laboratory and Fuji Xerox make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. OKI TECHNOSYSTEMS LABORATORY AND FUJI XEROX DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL OKI TECHNOSYSTEMS LABORATORY AND FUJI XEROX BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Yasuhiro Kawai Oki Technosystems Laboratory Author: Kazunori Nishihara Fuji Xerox ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" #include #include #include #include "pathmax.h" #define XLC_BUFSIZE 256 extern int _Xmbstowcs( wchar_t *wstr, char *str, int len ); extern int _Xmbstoutf8( char *ustr, const char *str, int len ); static void parsestringfile(FILE *fp, Xim im, int depth); /* * Parsing File Format: * * FILE ::= { [PRODUCTION] [COMMENT] "\n"} * PRODUCTION ::= LHS ":" RHS [ COMMENT ] * COMMENT ::= "#" {} * LHS ::= EVENT { EVENT } * EVENT ::= [MODIFIER_LIST] "<" keysym ">" * MODIFIER_LIST ::= (["!"] {MODIFIER} ) | "None" * MODIFIER ::= ["~"] MODIFIER_NAME * MODIFIER_NAME ::= ("Ctrl"|"Lock"|"Caps"|"Shift"|"Alt"|"Meta") * RHS ::= ( STRING | keysym | STRING keysym ) * STRING ::= '"' { CHAR } '"' * CHAR ::= GRAPHIC_CHAR | ESCAPED_CHAR * GRAPHIC_CHAR ::= locale (codeset) dependent code * ESCAPED_CHAR ::= ('\\' | '\"' | OCTAL | HEX ) * OCTAL ::= '\' OCTAL_CHAR [OCTAL_CHAR [OCTAL_CHAR]] * OCTAL_CHAR ::= (0|1|2|3|4|5|6|7) * HEX ::= '\' (x|X) HEX_CHAR [HEX_CHAR]] * HEX_CHAR ::= (0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F|a|b|c|d|e|f) * */ static int nextch( FILE *fp, int *lastch) { int c; if (*lastch != 0) { c = *lastch; *lastch = 0; } else { c = getc(fp); if (c == '\\') { c = getc(fp); if (c == '\n') { c = getc(fp); } else { ungetc(c, fp); c = '\\'; } } } return(c); } static void putbackch( int c, int *lastch) { *lastch = c; } #define ENDOFFILE 0 #define ENDOFLINE 1 #define COLON 2 #define LESS 3 #define GREATER 4 #define EXCLAM 5 #define TILDE 6 #define STRING 7 #define KEY 8 #define ERROR 9 #ifndef isalnum #define isalnum(c) \ (('0' <= (c) && (c) <= '9') || \ ('A' <= (c) && (c) <= 'Z') || \ ('a' <= (c) && (c) <= 'z')) #endif static int nexttoken( FILE *fp, char *tokenbuf, int *lastch) { int c; int token; char *p; int i, j; while ((c = nextch(fp, lastch)) == ' ' || c == '\t') { } switch (c) { case EOF: token = ENDOFFILE; break; case '\n': token = ENDOFLINE; break; case '<': token = LESS; break; case '>': token = GREATER; break; case ':': token = COLON; break; case '!': token = EXCLAM; break; case '~': token = TILDE; break; case '"': p = tokenbuf; while ((c = nextch(fp, lastch)) != '"') { if (c == '\n' || c == EOF) { putbackch(c, lastch); token = ERROR; goto string_error; } else if (c == '\\') { c = nextch(fp, lastch); switch (c) { case '\\': case '"': *p++ = c; break; case 'n': *p++ = '\n'; break; case 'r': *p++ = '\r'; break; case 't': *p++ = '\t'; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': i = c - '0'; c = nextch(fp, lastch); for (j = 0; j < 2 && c >= '0' && c <= '7'; j++) { i <<= 3; i += c - '0'; c = nextch(fp, lastch); } putbackch(c, lastch); *p++ = (char)i; break; case 'X': case 'x': i = 0; for (j = 0; j < 2; j++) { c = nextch(fp, lastch); i <<= 4; if (c >= '0' && c <= '9') { i += c - '0'; } else if (c >= 'A' && c <= 'F') { i += c - 'A' + 10; } else if (c >= 'a' && c <= 'f') { i += c - 'a' + 10; } else { putbackch(c, lastch); i >>= 4; break; } } if (j == 0) { token = ERROR; goto string_error; } *p++ = (char)i; break; case EOF: putbackch(c, lastch); token = ERROR; goto string_error; default: *p++ = c; break; } } else { *p++ = c; } } *p = '\0'; token = STRING; break; case '#': while ((c = nextch(fp, lastch)) != '\n' && c != EOF) { } if (c == '\n') { token = ENDOFLINE; } else { token = ENDOFFILE; } break; default: if (isalnum(c) || c == '_' || c == '-') { p = tokenbuf; *p++ = c; c = nextch(fp, lastch); while (isalnum(c) || c == '_' || c == '-') { *p++ = c; c = nextch(fp, lastch); } *p = '\0'; putbackch(c, lastch); token = KEY; } else { token = ERROR; } break; } string_error: return(token); } static long modmask( char *name) { struct _modtbl { const char name[6]; long mask; }; static const struct _modtbl tbl[] = { { "Ctrl", ControlMask }, { "Lock", LockMask }, { "Caps", LockMask }, { "Shift", ShiftMask }, { "Alt", Mod1Mask }, { "Meta", Mod1Mask }}; int i, num_entries = sizeof (tbl) / sizeof (tbl[0]); for (i = 0; i < num_entries; i++) if (!strcmp (name, tbl[i].name)) return tbl[i].mask; return 0; } static char* TransFileName(Xim im, char *name) { char *home = NULL, *lcCompose = NULL; char dir[XLC_BUFSIZE] = ""; char *i = name, *ret = NULL, *j; size_t l = 0; while (*i) { if (*i == '%') { i++; switch (*i) { case '%': l++; break; case 'H': if (home == NULL) home = getenv("HOME"); if (home) { size_t Hsize = strlen(home); if (Hsize > PATH_MAX) /* your home directory length is ridiculous */ goto end; l += Hsize; } break; case 'L': if (lcCompose == NULL) lcCompose = _XlcFileName(im->core.lcd, COMPOSE_FILE); if (lcCompose) { size_t Lsize = strlen(lcCompose); if (Lsize > PATH_MAX) /* your compose pathname length is ridiculous */ goto end; l += Lsize; } break; case 'S': if (dir[0] == '\0') xlocaledir(dir, XLC_BUFSIZE); if (dir[0]) { size_t Ssize = strlen(dir); if (Ssize > PATH_MAX) /* your locale directory path length is ridiculous */ goto end; l += Ssize; } break; } } else { l++; } i++; if (l > PATH_MAX) /* your expanded path length is ridiculous */ goto end; } j = ret = Xmalloc(l+1); if (ret == NULL) goto end; i = name; while (*i) { if (*i == '%') { i++; switch (*i) { case '%': *j++ = '%'; break; case 'H': if (home) { strcpy(j, home); j += strlen(home); } break; case 'L': if (lcCompose) { strcpy(j, lcCompose); j += strlen(lcCompose); } break; case 'S': strcpy(j, dir); j += strlen(dir); break; } i++; } else { *j++ = *i++; } } *j = '\0'; end: Xfree(lcCompose); return ret; } #ifndef MB_LEN_MAX #define MB_LEN_MAX 6 #endif static int get_mb_string (Xim im, char *buf, KeySym ks) { XPointer from, to; int from_len, to_len, len; XPointer args[1]; XlcCharSet charset; char local_buf[MB_LEN_MAX]; unsigned int ucs; ucs = KeySymToUcs4(ks); from = (XPointer) &ucs; to = (XPointer) local_buf; from_len = 1; to_len = MB_LEN_MAX; args[0] = (XPointer) &charset; if (_XlcConvert(im->private.local.ucstoc_conv, &from, &from_len, &to, &to_len, args, 1 ) != 0) { return 0; } from = (XPointer) local_buf; to = (XPointer) buf; from_len = MB_LEN_MAX - to_len; to_len = MB_LEN_MAX + 1; args[0] = (XPointer) charset; if (_XlcConvert(im->private.local.cstomb_conv, &from, &from_len, &to, &to_len, args, 1 ) != 0) { return 0; } len = MB_LEN_MAX + 1 - to_len; buf[len] = '\0'; return len; } #define AllMask (ShiftMask | LockMask | ControlMask | Mod1Mask) #define LOCAL_WC_BUFSIZE 128 #define LOCAL_UTF8_BUFSIZE 256 #define SEQUENCE_MAX 10 static int parseline( FILE *fp, Xim im, char* tokenbuf, int depth) { int token; DTModifier modifier_mask; DTModifier modifier; DTModifier tmp; KeySym keysym = NoSymbol; DTIndex *top = &im->private.local.top; DefTreeBase *b = &im->private.local.base; DTIndex t; DefTree *p = NULL; Bool exclam, tilde; KeySym rhs_keysym = 0; char *rhs_string_mb; int l; int lastch = 0; char local_mb_buf[MB_LEN_MAX+1]; wchar_t local_wc_buf[LOCAL_WC_BUFSIZE], *rhs_string_wc; char local_utf8_buf[LOCAL_UTF8_BUFSIZE], *rhs_string_utf8; struct DefBuffer { DTModifier modifier_mask; DTModifier modifier; KeySym keysym; }; struct DefBuffer buf[SEQUENCE_MAX]; int i, n; do { token = nexttoken(fp, tokenbuf, &lastch); } while (token == ENDOFLINE); if (token == ENDOFFILE) { return(-1); } n = 0; do { if ((token == KEY) && (strcmp("include", tokenbuf) == 0)) { char *filename; FILE *infp; token = nexttoken(fp, tokenbuf, &lastch); if (token != KEY && token != STRING) goto error; if (++depth > 100) goto error; if ((filename = TransFileName(im, tokenbuf)) == NULL) goto error; infp = _XFopenFile(filename, "r"); Xfree(filename); if (infp == NULL) goto error; parsestringfile(infp, im, depth); fclose(infp); return (0); } else if ((token == KEY) && (strcmp("None", tokenbuf) == 0)) { modifier = 0; modifier_mask = AllMask; token = nexttoken(fp, tokenbuf, &lastch); } else { modifier_mask = modifier = 0; exclam = False; if (token == EXCLAM) { exclam = True; token = nexttoken(fp, tokenbuf, &lastch); } while (token == TILDE || token == KEY) { tilde = False; if (token == TILDE) { tilde = True; token = nexttoken(fp, tokenbuf, &lastch); if (token != KEY) goto error; } tmp = modmask(tokenbuf); if (!tmp) { goto error; } modifier_mask |= tmp; if (tilde) { modifier &= ~tmp; } else { modifier |= tmp; } token = nexttoken(fp, tokenbuf, &lastch); } if (exclam) { modifier_mask = AllMask; } } if (token != LESS) { goto error; } token = nexttoken(fp, tokenbuf, &lastch); if (token != KEY) { goto error; } token = nexttoken(fp, tokenbuf, &lastch); if (token != GREATER) { goto error; } keysym = XStringToKeysym(tokenbuf); if (keysym == NoSymbol) { goto error; } buf[n].keysym = keysym; buf[n].modifier = modifier; buf[n].modifier_mask = modifier_mask; n++; if( n >= SEQUENCE_MAX ) goto error; token = nexttoken(fp, tokenbuf, &lastch); } while (token != COLON); token = nexttoken(fp, tokenbuf, &lastch); if (token == STRING) { l = strlen(tokenbuf) + 1; while (b->mbused + l > b->mbsize) { DTCharIndex newsize = b->mbsize ? b->mbsize * 1.5 : 1024; char *newmb = Xrealloc (b->mb, newsize); if (newmb == NULL) goto error; b->mb = newmb; b->mbsize = newsize; } rhs_string_mb = &b->mb[b->mbused]; b->mbused += l; strcpy(rhs_string_mb, tokenbuf); token = nexttoken(fp, tokenbuf, &lastch); if (token == KEY) { rhs_keysym = XStringToKeysym(tokenbuf); if (rhs_keysym == NoSymbol) { goto error; } token = nexttoken(fp, tokenbuf, &lastch); } if (token != ENDOFLINE && token != ENDOFFILE) { goto error; } } else if (token == KEY) { rhs_keysym = XStringToKeysym(tokenbuf); if (rhs_keysym == NoSymbol) { goto error; } token = nexttoken(fp, tokenbuf, &lastch); if (token != ENDOFLINE && token != ENDOFFILE) { goto error; } l = get_mb_string(im, local_mb_buf, rhs_keysym); while (b->mbused + l + 1 > b->mbsize) { DTCharIndex newsize = b->mbsize ? b->mbsize * 1.5 : 1024; char *newmb = Xrealloc (b->mb, newsize); if (newmb == NULL) goto error; b->mb = newmb; b->mbsize = newsize; } rhs_string_mb = &b->mb[b->mbused]; b->mbused += l + 1; memcpy(rhs_string_mb, local_mb_buf, l); rhs_string_mb[l] = '\0'; } else { goto error; } l = _Xmbstowcs(local_wc_buf, rhs_string_mb, LOCAL_WC_BUFSIZE - 1); if (l == LOCAL_WC_BUFSIZE - 1) { local_wc_buf[l] = (wchar_t)'\0'; } while (b->wcused + l + 1 > b->wcsize) { DTCharIndex newsize = b->wcsize ? b->wcsize * 1.5 : 512; wchar_t *newwc = Xrealloc (b->wc, sizeof(wchar_t) * newsize); if (newwc == NULL) goto error; b->wc = newwc; b->wcsize = newsize; } rhs_string_wc = &b->wc[b->wcused]; b->wcused += l + 1; memcpy((char *)rhs_string_wc, (char *)local_wc_buf, (l + 1) * sizeof(wchar_t) ); l = _Xmbstoutf8(local_utf8_buf, rhs_string_mb, LOCAL_UTF8_BUFSIZE - 1); if (l == LOCAL_UTF8_BUFSIZE - 1) { local_utf8_buf[l] = '\0'; } while (b->utf8used + l + 1 > b->utf8size) { DTCharIndex newsize = b->utf8size ? b->utf8size * 1.5 : 1024; char *newutf8 = Xrealloc (b->utf8, newsize); if (newutf8 == NULL) goto error; b->utf8 = newutf8; b->utf8size = newsize; } rhs_string_utf8 = &b->utf8[b->utf8used]; b->utf8used += l + 1; memcpy(rhs_string_utf8, local_utf8_buf, l + 1); for (i = 0; i < n; i++) { for (t = *top; t; t = b->tree[t].next) { if (buf[i].keysym == b->tree[t].keysym && buf[i].modifier == b->tree[t].modifier && buf[i].modifier_mask == b->tree[t].modifier_mask) { break; } } if (t) { p = &b->tree[t]; top = &p->succession; } else { while (b->treeused >= b->treesize) { DefTree *old = b->tree; int oldsize = b->treesize; int newsize = b->treesize ? b->treesize * 1.5 : 256; DefTree *new = Xrealloc (b->tree, sizeof(DefTree) * newsize); if (new == NULL) goto error; b->tree = new; b->treesize = newsize; if (top >= (DTIndex *) old && top < (DTIndex *) &old[oldsize]) top = (DTIndex *) (((char *) top) + (((char *)b->tree)-(char *)old)); } p = &b->tree[b->treeused]; p->keysym = buf[i].keysym; p->modifier = buf[i].modifier; p->modifier_mask = buf[i].modifier_mask; p->succession = 0; p->next = *top; p->mb = 0; p->wc = 0; p->utf8 = 0; p->ks = NoSymbol; *top = b->treeused; top = &p->succession; b->treeused++; } } /* old entries no longer freed... */ p->mb = rhs_string_mb - b->mb; p->wc = rhs_string_wc - b->wc; p->utf8 = rhs_string_utf8 - b->utf8; p->ks = rhs_keysym; return(n); error: while (token != ENDOFLINE && token != ENDOFFILE) { token = nexttoken(fp, tokenbuf, &lastch); } return(0); } void _XimParseStringFile( FILE *fp, Xim im) { parsestringfile(fp, im, 0); } static void parsestringfile( FILE *fp, Xim im, int depth) { char tb[8192]; char* tbp; struct stat st; if (fstat (fileno (fp), &st) != -1) { unsigned long size = (unsigned long) st.st_size; if (st.st_size >= INT_MAX) return; if (size <= sizeof tb) tbp = tb; else tbp = malloc (size); if (tbp != NULL) { while (parseline(fp, im, tbp, depth) >= 0) {} if (tbp != tb) free (tbp); } } } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imLcSIc.c0000644000000000000000000000372213614532331016701 0ustar /****************************************************************** Copyright 1990, 1991, 1992, 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" char * _XimLocalSetICValues(XIC xic, XIMArg *values) { XimDefICValues ic_values; Xic ic = (Xic)xic; char *name; _XimGetCurrentICValues(ic, &ic_values); name = _XimSetICValueData(ic, (XPointer)&ic_values, ic->private.local.ic_resources, ic->private.local.ic_num_resources, values, XIM_SETICVALUES, True); _XimSetCurrentICValues(ic, &ic_values); return(name); } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imRmAttr.c0000644000000000000000000010425313614532331017156 0ustar /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" static XIMResourceList _XimGetNestedListSeparator( XIMResourceList res_list, /* LISTofIMATTR or IMATTR */ unsigned int res_num) { return _XimGetResourceListRec(res_list, res_num, XNSeparatorofNestedList); } static Bool _XimCheckInnerIMAttributes( Xim im, XIMArg *arg, unsigned long mode) { XIMResourceList res; int check; if (!(res = _XimGetResourceListRec(im->private.proto.im_inner_resources, im->private.proto.im_num_inner_resources, arg->name))) return False; check = _XimCheckIMMode(res, mode); if(check == XIM_CHECK_INVALID) return True; else if(check == XIM_CHECK_ERROR) return False; return True; } char * _XimMakeIMAttrIDList( Xim im, XIMResourceList res_list, unsigned int res_num, XIMArg *arg, CARD16 *buf, INT16 *len, unsigned long mode) { register XIMArg *p; XIMResourceList res; int check; *len = 0; if (!arg) return (char *)NULL; for (p = arg; p->name; p++) { if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { if (_XimCheckInnerIMAttributes(im, p, mode)) continue; return p->name; } check = _XimCheckIMMode(res, mode); if (check == XIM_CHECK_INVALID) continue; else if (check == XIM_CHECK_ERROR) return p->name; *buf = res->id; *len += sizeof(CARD16); buf++; } return (char *)NULL; } static Bool _XimCheckInnerICAttributes( Xic ic, XIMArg *arg, unsigned long mode) { XIMResourceList res; int check; if (!(res = _XimGetResourceListRec(ic->private.proto.ic_inner_resources, ic->private.proto.ic_num_inner_resources, arg->name))) return False; check = _XimCheckICMode(res, mode); if(check == XIM_CHECK_INVALID) return True; else if(check == XIM_CHECK_ERROR) return False; return True; } char * _XimMakeICAttrIDList( Xic ic, XIMResourceList res_list, unsigned int res_num, XIMArg *arg, CARD16 *buf, INT16 *len, unsigned long mode) { register XIMArg *p; XIMResourceList res; int check; XrmQuark pre_quark; XrmQuark sts_quark; char *name; INT16 new_len; *len = 0; if (!arg) return (char *)NULL; pre_quark = XrmStringToQuark(XNPreeditAttributes); sts_quark = XrmStringToQuark(XNStatusAttributes); for (p = arg; p && p->name; p++) { if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { if (_XimCheckInnerICAttributes(ic, p, mode)) continue; *len = -1; return p->name; } check = _XimCheckICMode(res, mode); if(check == XIM_CHECK_INVALID) continue; else if(check == XIM_CHECK_ERROR) { *len = -1; return p->name; } *buf = res->id; *len += sizeof(CARD16); buf++; if (res->resource_size == XimType_NEST) { if (res->xrm_name == pre_quark) { if ((name = _XimMakeICAttrIDList(ic, res_list, res_num, (XIMArg *)p->value, buf, &new_len, (mode | XIM_PREEDIT_ATTR)))) { if (new_len < 0) *len = -1; else *len += new_len; return name; } *len += new_len; buf = (CARD16 *)((char *)buf + new_len); } else if (res->xrm_name == sts_quark) { if ((name = _XimMakeICAttrIDList(ic, res_list, res_num, (XIMArg *)p->value, buf, &new_len, (mode | XIM_STATUS_ATTR)))) { if (new_len < 0) *len = -1; else *len += new_len; return name; } *len += new_len; buf = (CARD16 *)((char *)buf + new_len); } if (!(res = _XimGetNestedListSeparator(res_list, res_num))) { p++; if (p) { *len = -1; return p->name; } else { return (char *)NULL; } } *buf = res->id; *len += sizeof(CARD16); buf++; } } return (char *)NULL; } static Bool _XimAttributeToValue( Xic ic, XIMResourceList res, CARD16 *data, INT16 data_len, XPointer value, BITMASK32 mode) { switch (res->resource_size) { case XimType_SeparatorOfNestedList: case XimType_NEST: break; case XimType_CARD8: case XimType_CARD16: case XimType_CARD32: case XimType_Window: case XimType_XIMHotKeyState: _XCopyToArg((XPointer)data, (XPointer *)&value, data_len); break; case XimType_STRING8: { char *str; if (!(value)) return False; if (!(str = Xmalloc(data_len + 1))) return False; (void)memcpy(str, (char *)data, data_len); str[data_len] = '\0'; *((char **)value) = str; break; } case XimType_XIMStyles: { INT16 num = data[0]; register CARD32 *style_list = (CARD32 *)&data[2]; XIMStyle *style; XIMStyles *rep; register int i; char *p; int alloc_len; if (!(value)) return False; alloc_len = sizeof(XIMStyles) + sizeof(XIMStyle) * num; if (!(p = Xmalloc(alloc_len))) return False; rep = (XIMStyles *)p; style = (XIMStyle *)(p + sizeof(XIMStyles)); for (i = 0; i < num; i++) style[i] = (XIMStyle)style_list[i]; rep->count_styles = (unsigned short)num; rep->supported_styles = style; *((XIMStyles **)value) = rep; break; } case XimType_XRectangle: { XRectangle *rep; if (!(value)) return False; if (!(rep = Xmalloc(sizeof(XRectangle)))) return False; rep->x = data[0]; rep->y = data[1]; rep->width = data[2]; rep->height = data[3]; *((XRectangle **)value) = rep; break; } case XimType_XPoint: { XPoint *rep; if (!(value)) return False; if (!(rep = Xmalloc(sizeof(XPoint)))) return False; rep->x = data[0]; rep->y = data[1]; *((XPoint **)value) = rep; break; } case XimType_XFontSet: { INT16 len = data[0]; char *base_name; XFontSet rep = (XFontSet)NULL; char **missing_list = NULL; int missing_count; char *def_string; if (!(value)) return False; if (!ic) return False; if (!(base_name = Xmalloc(len + 1))) return False; (void)strncpy(base_name, (char *)&data[1], (int)len); base_name[len] = '\0'; if (mode & XIM_PREEDIT_ATTR) { if (!strcmp(base_name, ic->private.proto.preedit_font)) { rep = ic->core.preedit_attr.fontset; } else if (!ic->private.proto.preedit_font_length) { rep = XCreateFontSet(ic->core.im->core.display, base_name, &missing_list, &missing_count, &def_string); } } else if (mode & XIM_STATUS_ATTR) { if (!strcmp(base_name, ic->private.proto.status_font)) { rep = ic->core.status_attr.fontset; } else if (!ic->private.proto.status_font_length) { rep = XCreateFontSet(ic->core.im->core.display, base_name, &missing_list, &missing_count, &def_string); } } Xfree(base_name); Xfree(missing_list); *((XFontSet *)value) = rep; break; } case XimType_XIMHotKeyTriggers: { INT32 num = *((CARD32 *)data); register CARD32 *key_list = (CARD32 *)&data[2]; XIMHotKeyTrigger *key; XIMHotKeyTriggers *rep; register int i; char *p; int alloc_len; if (!(value)) return False; alloc_len = sizeof(XIMHotKeyTriggers) + sizeof(XIMHotKeyTrigger) * num; if (!(p = Xmalloc(alloc_len))) return False; rep = (XIMHotKeyTriggers *)p; key = (XIMHotKeyTrigger *)(p + sizeof(XIMHotKeyTriggers)); for (i = 0; i < num; i++, key_list += 3) { key[i].keysym = (KeySym)key_list[0]; /* keysym */ key[i].modifier = (int)key_list[1]; /* modifier */ key[i].modifier_mask = (int)key_list[2]; /* modifier_mask */ } rep->num_hot_key = (int)num; rep->key = key; *((XIMHotKeyTriggers **)value) = rep; break; } case XimType_XIMStringConversion: { break; } default: return False; } return True; } static Bool _XimDecodeInnerIMATTRIBUTE( Xim im, XIMArg *arg) { XIMResourceList res; XimDefIMValues im_values; if (!(res = _XimGetResourceListRec(im->private.proto.im_inner_resources, im->private.proto.im_num_inner_resources, arg->name))) return False; _XimGetCurrentIMValues(im, &im_values); return _XimDecodeLocalIMAttr(res, (XPointer)&im_values, arg->value); } char * _XimDecodeIMATTRIBUTE( Xim im, XIMResourceList res_list, unsigned int res_num, CARD16 *data, INT16 data_len, XIMArg *arg, BITMASK32 mode) { register XIMArg *p; XIMResourceList res; int check; INT16 len; CARD16 *buf; INT16 total; INT16 min_len = sizeof(CARD16) /* sizeof attributeID */ + sizeof(INT16); /* sizeof length */ for (p = arg; p->name; p++) { if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { if (_XimDecodeInnerIMATTRIBUTE(im, p)) continue; return p->name; } check = _XimCheckIMMode(res, mode); if(check == XIM_CHECK_INVALID) continue; else if(check == XIM_CHECK_ERROR) return p->name; total = data_len; buf = data; while (total >= min_len) { if (res->id == buf[0]) break; len = buf[1]; len += XIM_PAD(len) + min_len; buf = (CARD16 *)((char *)buf + len); total -= len; } if (total < min_len) return p->name; if (!(_XimAttributeToValue((Xic) im->private.local.current_ic, res, &buf[2], buf[1], p->value, mode))) return p->name; } return (char *)NULL; } static Bool _XimDecodeInnerICATTRIBUTE( Xic ic, XIMArg *arg, unsigned long mode) { XIMResourceList res; XimDefICValues ic_values; if (!(res = _XimGetResourceListRec(ic->private.proto.ic_inner_resources, ic->private.proto.ic_num_inner_resources, arg->name))) return False; _XimGetCurrentICValues(ic, &ic_values); if (!_XimDecodeLocalICAttr(res, (XPointer)&ic_values, arg->value, mode)) return False; _XimSetCurrentICValues(ic, &ic_values); return True; } char * _XimDecodeICATTRIBUTE( Xic ic, XIMResourceList res_list, unsigned int res_num, CARD16 *data, INT16 data_len, XIMArg *arg, BITMASK32 mode) { register XIMArg *p; XIMResourceList res; int check; INT16 len; CARD16 *buf; INT16 total; char *name; INT16 min_len = sizeof(CARD16) /* sizeof attributeID */ + sizeof(INT16); /* sizeof length */ XrmQuark pre_quark; XrmQuark sts_quark; if (!arg) return (char *)NULL; pre_quark = XrmStringToQuark(XNPreeditAttributes); sts_quark = XrmStringToQuark(XNStatusAttributes); for (p = arg; p->name; p++) { if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { if (_XimDecodeInnerICATTRIBUTE(ic, p, mode)) continue; return p->name; } check = _XimCheckICMode(res, mode); if (check == XIM_CHECK_INVALID) continue; else if (check == XIM_CHECK_ERROR) return p->name; total = data_len; buf = data; while (total >= min_len) { if (res->id == buf[0]) break; len = buf[1]; len += XIM_PAD(len) + min_len; buf = (CARD16 *)((char *)buf + len); total -= len; } if (total < min_len) return p->name; if (res->resource_size == XimType_NEST) { if (res->xrm_name == pre_quark) { if ((name = _XimDecodeICATTRIBUTE(ic, res_list, res_num, &buf[2], buf[1], (XIMArg *)p->value, (mode | XIM_PREEDIT_ATTR)))) return name; } else if (res->xrm_name == sts_quark) { if ((name = _XimDecodeICATTRIBUTE(ic, res_list, res_num, &buf[2], buf[1], (XIMArg *)p->value, (mode | XIM_STATUS_ATTR)))) return name; } } else { if (!(_XimAttributeToValue(ic, res, &buf[2], buf[1], p->value, mode))) return p->name; } } return (char *)NULL; } static Bool _XimValueToAttribute( XIMResourceList res, XPointer buf, int buf_size, XPointer value, int *len, unsigned long mode, XPointer param) { int ret_len; switch (res->resource_size) { case XimType_SeparatorOfNestedList: case XimType_NEST: *len = 0; break; case XimType_CARD8: ret_len = sizeof(CARD8); if (buf_size < ret_len + XIM_PAD(ret_len)) { *len = -1; return False; } *((CARD8 *)buf) = (CARD8)(long)value; *len = ret_len; break; case XimType_CARD16: ret_len = sizeof(CARD16); if (buf_size < ret_len + XIM_PAD(ret_len)) { *len = -1; return False; } *((CARD16 *)buf) = (CARD16)(long)value; *len = ret_len; break; case XimType_CARD32: case XimType_Window: case XimType_XIMHotKeyState: ret_len = sizeof(CARD32); if (buf_size < ret_len + XIM_PAD(ret_len)) { *len = -1; return False; } *((CARD32 *)buf) = (CARD32)(long)value; *len = ret_len; break; case XimType_STRING8: if (!value) { *len = 0; return False; } ret_len = strlen((char *)value); if (buf_size < ret_len + XIM_PAD(ret_len)) { *len = -1; return False; } (void)memcpy((char *)buf, (char *)value, ret_len); *len = ret_len; break; case XimType_XRectangle: { XRectangle *rect = (XRectangle *)value; CARD16 *buf_s = (CARD16 *)buf; if (!rect) { *len = 0; return False; } ret_len = sizeof(INT16) /* sizeof X */ + sizeof(INT16) /* sizeof Y */ + sizeof(CARD16) /* sizeof width */ + sizeof(CARD16); /* sizeof height */ if (buf_size < ret_len + XIM_PAD(ret_len)) { *len = -1; return False; } buf_s[0] = (CARD16)rect->x; /* X */ buf_s[1] = (CARD16)rect->y; /* Y */ buf_s[2] = (CARD16)rect->width; /* width */ buf_s[3] = (CARD16)rect->height; /* heght */ *len = ret_len; break; } case XimType_XPoint: { XPoint *point = (XPoint *)value; CARD16 *buf_s = (CARD16 *)buf; if (!point) { *len = 0; return False; } ret_len = sizeof(INT16) /* sizeof X */ + sizeof(INT16); /* sizeof Y */ if (buf_size < ret_len + XIM_PAD(ret_len)) { *len = -1; return False; } buf_s[0] = (CARD16)point->x; /* X */ buf_s[1] = (CARD16)point->y; /* Y */ *len = ret_len; break; } case XimType_XFontSet: { XFontSet font = (XFontSet)value; Xic ic = (Xic)param; char *base_name = NULL; int length = 0; CARD16 *buf_s = (CARD16 *)buf; if (!font) { *len = 0; return False; } if (mode & XIM_PREEDIT_ATTR) { base_name = ic->private.proto.preedit_font; length = ic->private.proto.preedit_font_length; } else if (mode & XIM_STATUS_ATTR) { base_name = ic->private.proto.status_font; length = ic->private.proto.status_font_length; } if (!base_name) { *len = 0; return False; } ret_len = sizeof(CARD16) /* sizeof length of Base name */ + length; /* sizeof Base font name list */ if (buf_size < ret_len + XIM_PAD(ret_len)) { *len = -1; return False; } buf_s[0] = (INT16)length; /* length of Base font name */ (void)memcpy((char *)&buf_s[1], base_name, length); /* Base font name list */ *len = ret_len; break; } case XimType_XIMHotKeyTriggers: { XIMHotKeyTriggers *hotkey = (XIMHotKeyTriggers *)value; INT32 num; CARD32 *buf_l = (CARD32 *)buf; register CARD32 *key = (CARD32 *)&buf_l[1]; register int i; if (!hotkey) { *len = 0; return False; } num = (INT32)hotkey->num_hot_key; ret_len = sizeof(INT32) /* sizeof number of key list */ + (sizeof(CARD32) /* sizeof keysyn */ + sizeof(CARD32) /* sizeof modifier */ + sizeof(CARD32)) /* sizeof modifier_mask */ * num; /* number of key list */ if (buf_size < ret_len + XIM_PAD(ret_len)) { *len = -1; return False; } buf_l[0] = num; /* number of key list */ for (i = 0; i < num; i++, key += 3) { key[0] = (CARD32)(hotkey->key[i].keysym); /* keysym */ key[1] = (CARD32)(hotkey->key[i].modifier); /* modifier */ key[2] = (CARD32)(hotkey->key[i].modifier_mask); /* modifier_mask */ } *len = ret_len; break; } case XimType_XIMStringConversion: { *len = 0; break; } default: return False; } return True; } static Bool _XimSetInnerIMAttributes( Xim im, XPointer top, XIMArg *arg, unsigned long mode) { XIMResourceList res; int check; if (!(res = _XimGetResourceListRec(im->private.proto.im_inner_resources, im->private.proto.im_num_inner_resources, arg->name))) return False; check = _XimCheckIMMode(res, mode); if(check == XIM_CHECK_INVALID) return True; else if(check == XIM_CHECK_ERROR) return False; return _XimEncodeLocalIMAttr(res, top, arg->value); } char * _XimEncodeIMATTRIBUTE( Xim im, XIMResourceList res_list, unsigned int res_num, XIMArg *arg, XIMArg **arg_ret, char *buf, int size, int *ret_len, XPointer top, unsigned long mode) { register XIMArg *p; XIMResourceList res; int check; CARD16 *buf_s; int len; int min_len = sizeof(CARD16) /* sizeof attribute ID */ + sizeof(INT16); /* sizeof value length */ *ret_len = 0; for (p = arg; p->name; p++) { if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { if (_XimSetInnerIMAttributes(im, top, p, mode)) continue; return p->name; } check = _XimCheckIMMode(res, mode); if (check == XIM_CHECK_INVALID) continue; else if (check == XIM_CHECK_ERROR) return p->name; if (!(_XimEncodeLocalIMAttr(res, top, p->value))) return p->name; buf_s = (CARD16 *)buf; if (!(_XimValueToAttribute(res, (XPointer)&buf_s[2], (size - min_len), p->value, &len, mode, (XPointer)NULL))) return p->name; if (len == 0) { continue; } else if (len < 0) { *arg_ret = p; return (char *)NULL; } buf_s[0] = res->id; /* attribute ID */ buf_s[1] = len; /* value length */ XIM_SET_PAD(&buf_s[2], len); /* pad */ len += min_len; buf += len; *ret_len += len; size -= len; } *arg_ret = (XIMArg *)NULL; return (char *)NULL; } #ifdef XIM_CONNECTABLE Bool _XimEncodeSavedIMATTRIBUTE( Xim im, XIMResourceList res_list, unsigned int res_num, int *idx, char *buf, int size, int *ret_len, XPointer top, unsigned long mode) { register int i; int num = im->private.proto.num_saved_imvalues; XrmQuark *quark_list = im->private.proto.saved_imvalues; XIMResourceList res; XPointer value; CARD16 *buf_s; int len; int min_len = sizeof(CARD16) /* sizeof attribute ID */ + sizeof(INT16); /* sizeof value length */ if (!im->private.proto.saved_imvalues) { *idx = -1; *ret_len = 0; return True; } *ret_len = 0; for (i = *idx; i < num; i++) { if (!(res = _XimGetResourceListRecByQuark(res_list, res_num, quark_list[i]))) continue; if (!_XimDecodeLocalIMAttr(res, top, value)) return False; buf_s = (CARD16 *)buf; if (!(_XimValueToAttribute(res, (XPointer)&buf_s[2], (size - min_len), value, &len, mode, (XPointer)NULL))) return False; if (len == 0) { continue; } else if (len < 0) { *idx = i; return True; } buf_s[0] = res->id; /* attribute ID */ buf_s[1] = len; /* value length */ XIM_SET_PAD(&buf_s[2], len); /* pad */ len += min_len; buf += len; *ret_len += len; size -= len; } *idx = -1; return True; } #endif /* XIM_CONNECTABLE */ static Bool _XimEncodeTopValue( Xic ic, XIMResourceList res, XIMArg *p) { if (res->xrm_name == XrmStringToQuark(XNClientWindow)) { ic->core.client_window = (Window)p->value; if (ic->core.focus_window == (Window)0) ic->core.focus_window = ic->core.client_window; _XimRegisterFilter(ic); } else if (res->xrm_name == XrmStringToQuark(XNFocusWindow)) { if (ic->core.client_window) { _XimUnregisterFilter(ic); ic->core.focus_window = (Window)p->value; _XimRegisterFilter(ic); } else /* client_window not yet */ ic->core.focus_window = (Window)p->value; } return True; } static Bool _XimEncodePreeditValue( Xic ic, XIMResourceList res, XIMArg *p) { if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { XStandardColormap *colormap_ret; int count; if (!(XGetRGBColormaps(ic->core.im->core.display, ic->core.focus_window, &colormap_ret, &count, (Atom)p->value))) return False; XFree(colormap_ret); } else if (res->xrm_name == XrmStringToQuark(XNFontSet)) { int list_ret; XFontStruct **struct_list; char **name_list; char *tmp; int len; register int i; if (!p->value) return False; Xfree(ic->private.proto.preedit_font); list_ret = XFontsOfFontSet((XFontSet)p->value, &struct_list, &name_list); for (i = 0, len = 0; i < list_ret; i++) { len += (strlen(name_list[i]) + sizeof(char)); } if (!(tmp = Xmalloc(len + 1))) { ic->private.proto.preedit_font = NULL; return False; } tmp[0] = '\0'; for (i = 0; i < list_ret; i++) { strcat(tmp, name_list[i]); strcat(tmp, ","); } tmp[len - 1] = 0; ic->private.proto.preedit_font = tmp; ic->private.proto.preedit_font_length = len - 1; } return True; } static Bool _XimEncodeStatusValue( Xic ic, XIMResourceList res, XIMArg *p) { if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { XStandardColormap *colormap_ret = NULL; int count; if (!(XGetRGBColormaps(ic->core.im->core.display, ic->core.focus_window, &colormap_ret, &count, (Atom)p->value))) return False; XFree(colormap_ret); } else if (res->xrm_name == XrmStringToQuark(XNFontSet)) { int list_ret; XFontStruct **struct_list; char **name_list; char *tmp; int len; register int i; if (!p->value) return False; Xfree(ic->private.proto.status_font); list_ret = XFontsOfFontSet((XFontSet)p->value, &struct_list, &name_list); for (i = 0, len = 0; i < list_ret; i++) { len += (strlen(name_list[i]) + sizeof(char)); } if (!(tmp = Xmalloc(len+1))) { ic->private.proto.status_font = NULL; return False; } tmp[0] = '\0'; for(i = 0; i < list_ret; i++) { strcat(tmp, name_list[i]); strcat(tmp, ","); } tmp[len - 1] = 0; ic->private.proto.status_font = tmp; ic->private.proto.status_font_length = len - 1; } return True; } static Bool _XimSetInnerICAttributes( Xic ic, XPointer top, XIMArg *arg, unsigned long mode) { XIMResourceList res; int check; if (!(res = _XimGetResourceListRec(ic->private.proto.ic_inner_resources, ic->private.proto.ic_num_inner_resources, arg->name))) return False; check = _XimCheckICMode(res, mode); if(check == XIM_CHECK_INVALID) return True; else if(check == XIM_CHECK_ERROR) return False; return _XimEncodeLocalICAttr(ic, res, top, arg, mode); } char * _XimEncodeICATTRIBUTE( Xic ic, XIMResourceList res_list, unsigned int res_num, XIMArg *arg, XIMArg **arg_ret, char *buf, int size, int *ret_len, XPointer top, BITMASK32 *flag, unsigned long mode) { register XIMArg *p; XIMResourceList res; int check; CARD16 *buf_s; int len; int min_len = sizeof(CARD16) /* sizeof attribute ID */ + sizeof(INT16); /* sizeof value length */ XrmQuark pre_quark; XrmQuark sts_quark; char *name; pre_quark = XrmStringToQuark(XNPreeditAttributes); sts_quark = XrmStringToQuark(XNStatusAttributes); *ret_len = 0; for (p = arg; p && p->name; p++) { buf_s = (CARD16 *)buf; if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { if (_XimSetInnerICAttributes(ic, top, p, mode)) continue; return p->name; } check = _XimCheckICMode(res, mode); if (check == XIM_CHECK_INVALID) continue; else if (check == XIM_CHECK_ERROR) return p->name; if (mode & XIM_PREEDIT_ATTR) { if (!(_XimEncodePreeditValue(ic, res, p))) return p->name; } else if (mode & XIM_STATUS_ATTR) { if (!(_XimEncodeStatusValue(ic, res, p))) return p->name; } else { if (!(_XimEncodeTopValue(ic, res, p))) return p->name; } if (res->resource_size == XimType_NEST) { XimDefICValues *ic_attr = (XimDefICValues *)top; if (res->xrm_name == pre_quark) { XIMArg *arg_rt; if ((name = _XimEncodeICATTRIBUTE(ic, res_list, res_num, (XIMArg *)p->value, &arg_rt, (char *)&buf_s[2], (size - min_len), &len, (XPointer)&ic_attr->preedit_attr, flag, (mode | XIM_PREEDIT_ATTR)))) { return name; } } else if (res->xrm_name == sts_quark) { XIMArg *arg_rt; if ((name = _XimEncodeICATTRIBUTE(ic, res_list, res_num, (XIMArg *)p->value, &arg_rt, (char *)&buf_s[2], (size - min_len), &len, (XPointer)&ic_attr->status_attr, flag, (mode | XIM_STATUS_ATTR)))) { return name; } } } else { #ifdef EXT_MOVE if (flag) *flag |= _XimExtenArgCheck(p); #endif if (!(_XimEncodeLocalICAttr(ic, res, top, p, mode))) return p->name; if (!(_XimValueToAttribute(res, (XPointer)&buf_s[2], (size - min_len), p->value, &len, mode, (XPointer)ic))) return p->name; } if (len == 0) { continue; } else if (len < 0) { *arg_ret = p; return (char *)NULL; } buf_s[0] = res->id; /* attribute ID */ buf_s[1] = len; /* value length */ XIM_SET_PAD(&buf_s[2], len); /* pad */ len += min_len; buf += len; *ret_len += len; size -= len; } *arg_ret = (XIMArg *)NULL; return (char *)NULL; } #ifdef XIM_CONNECTABLE static Bool _XimEncodeSavedPreeditValue( Xic ic, XIMResourceList res, XPointer value) { int list_ret; XFontStruct **struct_list; char **name_list; char *tmp; int len; register int i; if (res->xrm_name == XrmStringToQuark(XNFontSet)) { if (!value) return False; if (ic->private.proto.preedit_font) Xfree(ic->private.proto.preedit_font); list_ret = XFontsOfFontSet((XFontSet)value, &struct_list, &name_list); for(i = 0, len = 0; i < list_ret; i++) { len += (strlen(name_list[i]) + sizeof(char)); } if(!(tmp = Xmalloc(len + 1))) { ic->private.proto.preedit_font = NULL; return False; } tmp[0] = '\0'; for(i = 0; i < list_ret; i++) { strcat(tmp, name_list[i]); strcat(tmp, ","); } tmp[len - 1] = 0; ic->private.proto.preedit_font = tmp; ic->private.proto.preedit_font_length = len - 1; } return True; } static Bool _XimEncodeSavedStatusValue( Xic ic, XIMResourceList res, XPointer value) { int list_ret; XFontStruct **struct_list; char **name_list; char *tmp; int len; register int i; if (res->xrm_name == XrmStringToQuark(XNFontSet)) { if (!value) return False; Xfree(ic->private.proto.status_font); list_ret = XFontsOfFontSet((XFontSet)value, &struct_list, &name_list); for(i = 0, len = 0; i < list_ret; i++) { len += (strlen(name_list[i]) + sizeof(char)); } if(!(tmp = Xmalloc(len + 1))) { ic->private.proto.status_font = NULL; return False; } tmp[0] = '\0'; for(i = 0; i < list_ret; i++) { strcat(tmp, name_list[i]); strcat(tmp, ","); } tmp[len - 1] = 0; ic->private.proto.status_font = tmp; ic->private.proto.status_font_length = len - 1; } return True; } Bool _XimEncodeSavedICATTRIBUTE( Xic ic, XIMResourceList res_list, unsigned int res_num, int *idx, char *buf, int size, int *ret_len, XPointer top, unsigned long mode) { int i; int num = ic->private.proto.num_saved_icvalues; XrmQuark *quark_list = ic->private.proto.saved_icvalues; XIMResourceList res; XPointer value; CARD16 *buf_s; int len; int min_len = sizeof(CARD16) /* sizeof attribute ID */ + sizeof(INT16); /* sizeof value length */ XrmQuark pre_quark; XrmQuark sts_quark; XrmQuark separator; if (!ic->private.proto.saved_icvalues) { *idx = -1; *ret_len = 0; return True; } pre_quark = XrmStringToQuark(XNPreeditAttributes); sts_quark = XrmStringToQuark(XNStatusAttributes); separator = XrmStringToQuark(XNSeparatorofNestedList); *ret_len = 0; for (i = *idx; i < num; i++) { if (quark_list[i] == separator) { *idx = i; return True; } if (!(res = _XimGetResourceListRecByQuark(res_list, res_num, quark_list[i]))) continue; if (!_XimDecodeLocalICAttr(res, top,(XPointer)&value, mode)) return False; if (mode & XIM_PREEDIT_ATTR) { if (!(_XimEncodeSavedPreeditValue(ic, res, value))) { return False; } } else if (mode & XIM_STATUS_ATTR) { if (!(_XimEncodeSavedStatusValue(ic, res, value))) { return False; } } buf_s = (CARD16 *)buf; if (res->resource_size == XimType_NEST) { XimDefICValues *ic_attr = (XimDefICValues *)top; i++; if (res->xrm_name == pre_quark) { if (!_XimEncodeSavedICATTRIBUTE(ic, res_list, res_num, &i, (char *)&buf_s[2], (size - min_len), &len, (XPointer)&ic_attr->preedit_attr, (mode | XIM_PREEDIT_ATTR))) { return False; } } else if (res->xrm_name == sts_quark) { if (!_XimEncodeSavedICATTRIBUTE(ic, res_list, res_num, &i, (char *)&buf_s[2], (size - min_len), &len, (XPointer)&ic_attr->status_attr, (mode | XIM_STATUS_ATTR))) { return False; } } } else { if (!(_XimValueToAttribute(res, (XPointer)&buf_s[2], (size - min_len), value, &len, mode, (XPointer)ic))) { return False; } } if (len == 0) { continue; } else if (len < 0) { if (quark_list[i] == separator) i++; *idx = i; return True; } buf_s[0] = res->id; /* attribute ID */ buf_s[1] = len; /* value length */ XIM_SET_PAD(&buf_s[2], len); /* pad */ len += min_len; buf += len; *ret_len += len; size -= len; } *idx = -1; return True; } #endif /* XIM_CONNECTABLE */ static unsigned int _XimCountNumberOfAttr( INT16 total, CARD16 *attr, int *names_len) { unsigned int n; INT16 len; INT16 min_len = sizeof(CARD16) /* sizeof attribute ID */ + sizeof(CARD16) /* sizeof type of value */ + sizeof(INT16); /* sizeof length of attribute */ n = 0; *names_len = 0; while (total > min_len) { len = attr[2]; *names_len += (len + 1); len += (min_len + XIM_PAD(len + 2)); total -= len; attr = (CARD16 *)((char *)attr + len); n++; } return n; } Bool _XimGetAttributeID( Xim im, CARD16 *buf) { unsigned int n; XIMResourceList res; char *names; int names_len; XPointer tmp; XIMValuesList *values_list; char **values; int values_len; register int i; INT16 len; INT16 min_len = sizeof(CARD16) /* sizeof attribute ID */ + sizeof(CARD16) /* sizeof type of value */ + sizeof(INT16); /* sizeof length of attr */ /* * IM attribute ID */ if (!(n = _XimCountNumberOfAttr(buf[0], &buf[1], &names_len))) return False; if (!(res = Xcalloc(n, sizeof(XIMResource)))) return False; values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len; if (!(tmp = Xcalloc(1, values_len))) { Xfree(res); return False; } values_list = (XIMValuesList *)tmp; values = (char **)((char *)tmp + sizeof(XIMValuesList)); names = (char *)((char *)values + (sizeof(char **) * n)); values_list->count_values = n; values_list->supported_values = values; buf++; for (i = 0; i < n; i++) { len = buf[2]; (void)memcpy(names, (char *)&buf[3], len); values[i] = names; names[len] = '\0'; res[i].resource_name = names; res[i].resource_size = buf[1]; res[i].id = buf[0]; names += (len + 1); len += (min_len + XIM_PAD(len + 2)); buf = (CARD16 *)((char *)buf + len); } _XIMCompileResourceList(res, n); Xfree(im->core.im_resources); Xfree(im->core.im_values_list); im->core.im_resources = res; im->core.im_num_resources = n; im->core.im_values_list = values_list; /* * IC attribute ID */ if (!(n = _XimCountNumberOfAttr(buf[0], &buf[2], &names_len))) return False; if (!(res = Xcalloc(n, sizeof(XIMResource)))) return False; values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len; if (!(tmp = Xcalloc(1, values_len))) { Xfree(res); return False; } values_list = (XIMValuesList *)tmp; values = (char **)((char *)tmp + sizeof(XIMValuesList)); names = (char *)((char *)values + (sizeof(char **) * n)); values_list->count_values = n; values_list->supported_values = values; buf += 2; for (i = 0; i < n; i++) { len = buf[2]; (void)memcpy(names, (char *)&buf[3], len); values[i] = names; names[len] = '\0'; res[i].resource_name = names; res[i].resource_size = buf[1]; res[i].id = buf[0]; names += (len + 1); len += (min_len + XIM_PAD(len + 2)); buf = (CARD16 *)((char *)buf + len); } _XIMCompileResourceList(res, n); Xfree(im->core.ic_resources); Xfree(im->core.ic_values_list); im->core.ic_resources = res; im->core.ic_num_resources = n; im->core.ic_values_list = values_list; return True; } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imRm.c0000644000000000000000000023431613614532331016327 0ustar /****************************************************************** Copyright 1990, 1991, 1992,1993, 1994 by FUJITSU LIMITED Copyright 1994 by Sony Corporation Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED and Sony Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED and Sony Corporation make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED AND SONY CORPORATION DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED AND SONY CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp Modifier: Makoto Wakamatsu Sony Corporation makoto@sm.sony.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" #include "Xresource.h" #define GET_NAME(x) name_table + x.name_offset typedef struct _XimValueOffsetInfo { unsigned short name_offset; XrmQuark quark; unsigned int offset; Bool (*defaults)( struct _XimValueOffsetInfo *, XPointer, XPointer, unsigned long ); Bool (*encode)( struct _XimValueOffsetInfo *, XPointer, XPointer ); Bool (*decode)( struct _XimValueOffsetInfo *, XPointer, XPointer ); } XimValueOffsetInfoRec, *XimValueOffsetInfo; #ifdef XIM_CONNECTABLE static Bool _XimCheckBool(str) char *str; { if(!strcmp(str, "True") || !strcmp(str, "true") || !strcmp(str, "Yes") || !strcmp(str, "yes") || !strcmp(str, "ON") || !strcmp(str, "on")) return True; return False; } void _XimSetProtoResource(im) Xim im; { char res_name_buf[256]; char* res_name; size_t res_name_len; char res_class_buf[256]; char* res_class; size_t res_class_len; char* str_type; XrmValue value; XIMStyle preedit_style = 0; XIMStyle status_style = 0; XIMStyles* imstyles; char* dotximdot = ".xim."; char* ximdot = "xim."; char* dotXimdot = ".Xim."; char* Ximdot = "Xim."; if (!im->core.rdb) return; res_name_len = strlen (im->core.res_name); if (res_name_len < 200) { res_name = res_name_buf; res_name_len = sizeof(res_name_buf); } else { res_name_len += 50; res_name = Xmalloc (res_name_len); } res_class_len = strlen (im->core.res_class); if (res_class_len < 200) { res_class = res_class_buf; res_class_len = sizeof(res_class_buf); } else { res_class_len += 50; res_class = Xmalloc (res_class_len); } /* pretend malloc always works */ (void) snprintf (res_name, res_name_len, "%s%s%s", im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? dotximdot : ximdot, "useAuth"); (void) snprintf (res_class, res_class_len, "%s%s%s", im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? dotXimdot : Ximdot, "UseAuth"); bzero(&value, sizeof(XrmValue)); if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { if(_XimCheckBool(value.addr)) { MARK_USE_AUTHORIZATION_FUNC(im); } } (void) snprintf (res_name, res_name_len, "%s%s%s", im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? dotximdot : ximdot, "delaybinding"); (void) snprintf (res_class, res_class_len, "%s%s%s", im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? dotXimdot : Ximdot, "Delaybinding"); bzero(&value, sizeof(XrmValue)); if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { if(_XimCheckBool(value.addr)) { MARK_DELAYBINDABLE(im); } } (void) snprintf (res_name, res_name_len, "%s%s%s", im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? dotximdot : ximdot, "reconnect"); (void) snprintf (res_class, res_class_len, "%s%s%s", im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? dotXimdot : Ximdot, "Reconnect"); bzero(&value, sizeof(XrmValue)); if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { if(_XimCheckBool(value.addr)) { MARK_RECONNECTABLE(im); } } if(!IS_CONNECTABLE(im)) { if (res_name != res_name_buf) Xfree (res_name); if (res_class != res_class_buf) Xfree (res_class); return; } (void) snprintf (res_name, res_name_len, "%s%s%s", im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? dotximdot : ximdot, "preeditDefaultStyle"); (void) snprintf (res_class, res_class_len, "%s%s%s", im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? dotXimdot : Ximdot, "PreeditDefaultStyle"); if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { if(!strcmp(value.addr, "XIMPreeditArea")) preedit_style = XIMPreeditArea; else if(!strcmp(value.addr, "XIMPreeditCallbacks")) preedit_style = XIMPreeditCallbacks; else if(!strcmp(value.addr, "XIMPreeditPosition")) preedit_style = XIMPreeditPosition; else if(!strcmp(value.addr, "XIMPreeditNothing")) preedit_style = XIMPreeditNothing; else if(!strcmp(value.addr, "XIMPreeditNone")) preedit_style = XIMPreeditNone; } if(!preedit_style) preedit_style = XIMPreeditNothing; (void) snprintf (res_name, res_name_len, "%s%s%s", im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? dotximdot : ximdot, "statusDefaultStyle"); (void) snprintf (res_class, res_class_len, "%s%s%s", im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? dotXimdot : Ximdot, "StatusDefaultStyle"); if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { if(!strcmp(value.addr, "XIMStatusArea")) status_style = XIMStatusArea; else if(!strcmp(value.addr, "XIMStatusCallbacks")) status_style = XIMStatusCallbacks; else if(!strcmp(value.addr, "XIMStatusNothing")) status_style = XIMStatusNothing; else if(!strcmp(value.addr, "XIMStatusNone")) status_style = XIMStatusNone; } if(!status_style) status_style = XIMStatusNothing; if(!(imstyles = Xmalloc(sizeof(XIMStyles) + sizeof(XIMStyle)))){ if (res_name != res_name_buf) Xfree (res_name); if (res_class != res_class_buf) Xfree (res_class); return; } imstyles->count_styles = 1; imstyles->supported_styles = (XIMStyle *)((char *)imstyles + sizeof(XIMStyles)); imstyles->supported_styles[0] = preedit_style | status_style; im->private.proto.default_styles = imstyles; if (res_name != res_name_buf) Xfree (res_name); if (res_class != res_class_buf) Xfree (res_class); } #endif /* XIM_CONNECTABLE */ static const char name_table[] = /* 0 */ XNQueryInputStyle"\0" /* 16 */ XNClientWindow"\0" /* 29 */ XNInputStyle"\0" /* 40 */ XNFocusWindow"\0" /* 52 */ XNResourceName"\0" /* 65 */ XNResourceClass"\0" /* 79 */ XNGeometryCallback"\0" /* 96 */ XNDestroyCallback"\0" /* 112 */ XNFilterEvents"\0" /* 125 */ XNPreeditStartCallback"\0" /* 146 */ XNPreeditDoneCallback"\0" /* 166 */ XNPreeditDrawCallback"\0" /* 186 */ XNPreeditCaretCallback"\0" /* 207 */ XNPreeditStateNotifyCallback"\0" /* 234 */ XNPreeditAttributes"\0" /* 252 */ XNStatusStartCallback"\0" /* 272 */ XNStatusDoneCallback"\0" /* 291 */ XNStatusDrawCallback"\0" /* 310 */ XNStatusAttributes"\0" /* 327 */ XNArea"\0" /* 332 */ XNAreaNeeded"\0" /* 343 */ XNSpotLocation"\0" /* 356 */ XNColormap"\0" /* 365 */ XNStdColormap"\0" /* 377 */ XNForeground"\0" /* 388 */ XNBackground"\0" /* 399 */ XNBackgroundPixmap"\0" /* 416 */ XNFontSet"\0" /* 424 */ XNLineSpace"\0" /* 434 */ XNCursor"\0" /* 441 */ XNQueryIMValuesList"\0" /* 459 */ XNQueryICValuesList"\0" /* 477 */ XNVisiblePosition"\0" /* 493 */ XNStringConversionCallback"\0" /* 518 */ XNStringConversion"\0" /* 535 */ XNResetState"\0" /* 546 */ XNHotKey"\0" /* 553 */ XNHotKeyState"\0" /* 565 */ XNPreeditState ; #define OFFSET_XNQUERYINPUTSTYLE 0 #define OFFSET_XNCLIENTWINDOW 16 #define OFFSET_XNINPUTSTYLE 29 #define OFFSET_XNFOCUSWINDOW 40 #define OFFSET_XNRESOURCENAME 52 #define OFFSET_XNRESOURCECLASS 65 #define OFFSET_XNGEOMETRYCALLBACK 79 #define OFFSET_XNDESTROYCALLBACK 96 #define OFFSET_XNFILTEREVENTS 112 #define OFFSET_XNPREEDITSTARTCALLBACK 125 #define OFFSET_XNPREEDITDONECALLBACK 146 #define OFFSET_XNPREEDITDRAWCALLBACK 166 #define OFFSET_XNPREEDITCARETCALLBACK 186 #define OFFSET_XNPREEDITSTATENOTIFYCALLBACK 207 #define OFFSET_XNPREEDITATTRIBUTES 234 #define OFFSET_XNSTATUSSTARTCALLBACK 252 #define OFFSET_XNSTATUSDONECALLBACK 272 #define OFFSET_XNSTATUSDRAWCALLBACK 291 #define OFFSET_XNSTATUSATTRIBUTES 310 #define OFFSET_XNAREA 327 #define OFFSET_XNAREANEEDED 332 #define OFFSET_XNSPOTLOCATION 343 #define OFFSET_XNCOLORMAP 356 #define OFFSET_XNSTDCOLORMAP 365 #define OFFSET_XNFOREGROUND 377 #define OFFSET_XNBACKGROUND 388 #define OFFSET_XNBACKGROUNDPIXMAP 399 #define OFFSET_XNFONTSET 416 #define OFFSET_XNLINESPACE 424 #define OFFSET_XNCURSOR 434 #define OFFSET_XNQUERYIMVALUESLIST 441 #define OFFSET_XNQUERYICVALUESLIST 459 #define OFFSET_XNVISIBLEPOSITION 477 #define OFFSET_XNSTRINGCONVERSIONCALLBACK 493 #define OFFSET_XNSTRINGCONVERSION 518 #define OFFSET_XNRESETSTATE 535 #define OFFSET_XNHOTKEY 546 #define OFFSET_XNHOTKEYSTATE 553 #define OFFSET_XNPREEDITSTATE 565 /* offsets into name_table */ static const unsigned short supported_local_im_values_list[] = { OFFSET_XNQUERYINPUTSTYLE, OFFSET_XNRESOURCENAME, OFFSET_XNRESOURCECLASS, OFFSET_XNDESTROYCALLBACK, OFFSET_XNQUERYIMVALUESLIST, OFFSET_XNQUERYICVALUESLIST, OFFSET_XNVISIBLEPOSITION }; /* offsets into name_table */ static const unsigned short supported_local_ic_values_list[] = { OFFSET_XNINPUTSTYLE, OFFSET_XNCLIENTWINDOW, OFFSET_XNFOCUSWINDOW, OFFSET_XNRESOURCENAME, OFFSET_XNRESOURCECLASS, OFFSET_XNGEOMETRYCALLBACK, OFFSET_XNFILTEREVENTS, OFFSET_XNDESTROYCALLBACK, OFFSET_XNSTRINGCONVERSIONCALLBACK, OFFSET_XNSTRINGCONVERSIONCALLBACK, OFFSET_XNRESETSTATE, OFFSET_XNHOTKEY, OFFSET_XNHOTKEYSTATE, OFFSET_XNPREEDITATTRIBUTES, OFFSET_XNSTATUSATTRIBUTES, OFFSET_XNAREA, OFFSET_XNAREANEEDED, OFFSET_XNSPOTLOCATION, OFFSET_XNCOLORMAP, OFFSET_XNSTDCOLORMAP, OFFSET_XNFOREGROUND, OFFSET_XNBACKGROUND, OFFSET_XNBACKGROUNDPIXMAP, OFFSET_XNFONTSET, OFFSET_XNLINESPACE, OFFSET_XNCURSOR, OFFSET_XNPREEDITSTARTCALLBACK, OFFSET_XNPREEDITDONECALLBACK, OFFSET_XNPREEDITDRAWCALLBACK, OFFSET_XNPREEDITCARETCALLBACK, OFFSET_XNSTATUSSTARTCALLBACK, OFFSET_XNSTATUSDONECALLBACK, OFFSET_XNSTATUSDRAWCALLBACK, OFFSET_XNPREEDITSTATE, OFFSET_XNPREEDITSTATENOTIFYCALLBACK }; static XIMStyle const supported_local_styles[] = { XIMPreeditNone | XIMStatusNone, XIMPreeditNothing | XIMStatusNothing, 0 /* dummy */ }; static Bool _XimDefaultStyles( XimValueOffsetInfo info, XPointer top, XPointer parm, /* unused */ unsigned long mode) /* unused */ { XIMStyles *styles; XIMStyles **out; register int i; unsigned int n; int len; XPointer tmp; n = XIMNumber(supported_local_styles) - 1; len = sizeof(XIMStyles) + sizeof(XIMStyle) * n; if(!(tmp = Xcalloc(1, len))) { return False; } styles = (XIMStyles *)tmp; if (n > 0) { styles->count_styles = (unsigned short)n; styles->supported_styles = (XIMStyle *)((char *)tmp + sizeof(XIMStyles)); for(i = 0; i < n; i++) { styles->supported_styles[i] = supported_local_styles[i]; } } out = (XIMStyles **)((char *)top + info->offset); *out = styles; return True; } static Bool _XimDefaultIMValues( XimValueOffsetInfo info, XPointer top, XPointer parm, /* unused */ unsigned long mode) /* unused */ { XIMValuesList *values_list; XIMValuesList **out; register int i; unsigned int n; int len; XPointer tmp; n = XIMNumber(supported_local_im_values_list); len = sizeof(XIMValuesList) + sizeof(char **) * n; if(!(tmp = Xcalloc(1, len))) { return False; } values_list = (XIMValuesList *)tmp; if (n > 0) { values_list->count_values = (unsigned short)n; values_list->supported_values = (char **)((char *)tmp + sizeof(XIMValuesList)); for(i = 0; i < n; i++) { values_list->supported_values[i] = (char *)name_table + supported_local_im_values_list[i]; } } out = (XIMValuesList **)((char *)top + info->offset); *out = values_list; return True; } static Bool _XimDefaultICValues( XimValueOffsetInfo info, XPointer top, XPointer parm, /* unused */ unsigned long mode) /* unused */ { XIMValuesList *values_list; XIMValuesList **out; register int i; unsigned int n; int len; XPointer tmp; n = XIMNumber(supported_local_ic_values_list); len = sizeof(XIMValuesList) + sizeof(char **) * n; if(!(tmp = Xcalloc(1, len))) { return False; } values_list = (XIMValuesList *)tmp; if (n > 0) { values_list->count_values = (unsigned short)n; values_list->supported_values = (char **)((char *)tmp + sizeof(XIMValuesList)); for(i = 0; i < n; i++) { values_list->supported_values[i] = (char *)name_table + supported_local_ic_values_list[i]; } } out = (XIMValuesList **)((char *)top + info->offset); *out = values_list; return True; } static Bool _XimDefaultVisiblePos( XimValueOffsetInfo info, XPointer top, XPointer parm, /* unused */ unsigned long mode) /* unused */ { Bool *out; out = (Bool *)((char *)top + info->offset); *out = False; return True; } static Bool _XimDefaultFocusWindow( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { Xic ic = (Xic)parm; Window *out; if(ic->core.client_window == (Window)NULL) { return True; } out = (Window *)((char *)top + info->offset); *out = ic->core.client_window; return True; } static Bool _XimDefaultResName( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { Xic ic = (Xic)parm; Xim im = (Xim)ic->core.im; char **out; if(im->core.res_name == (char *)NULL) { return True; } out = (char **)((char *)top + info->offset); *out = im->core.res_name; return True; } static Bool _XimDefaultResClass( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { Xic ic = (Xic)parm; Xim im = (Xim)ic->core.im; char **out; if(im->core.res_class == (char *)NULL) { return True; } out = (char **)((char *)top + info->offset); *out = im->core.res_class; return True; } static Bool _XimDefaultDestroyCB( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { Xic ic = (Xic)parm; Xim im = (Xim)ic->core.im; XIMCallback *out; out = (XIMCallback *)((char *)top + info->offset); *out = im->core.destroy_callback; return True; } static Bool _XimDefaultResetState( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { XIMResetState *out; out = (XIMResetState *)((char *)top + info->offset); *out = XIMInitialState; return True; } static Bool _XimDefaultHotKeyState( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { XIMHotKeyState *out; out = (XIMHotKeyState *)((char *)top + info->offset); *out = XIMHotKeyStateOFF; return True; } static Bool _XimDefaultArea( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { Xic ic = (Xic)parm; Xim im = (Xim)ic->core.im; Window root_return; int x_return, y_return; unsigned int width_return, height_return; unsigned int border_width_return; unsigned int depth_return; XRectangle area; XRectangle *out; if(ic->core.focus_window == (Window)NULL) { return True; } if(XGetGeometry(im->core.display, (Drawable)ic->core.focus_window, &root_return, &x_return, &y_return, &width_return, &height_return, &border_width_return, &depth_return) == (Status)Success) { return True; } area.x = 0; area.y = 0; area.width = width_return; area.height = height_return; out = (XRectangle *)((char *)top + info->offset); *out = area; return True; } static Bool _XimDefaultColormap( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { Xic ic = (Xic)parm; Xim im = (Xim)ic->core.im; XWindowAttributes win_attr; Colormap *out; if(ic->core.client_window == (Window)NULL) { return True; } if(XGetWindowAttributes(im->core.display, ic->core.client_window, &win_attr) == (Status)Success) { return True; } out = (Colormap *)((char *)top + info->offset); *out = win_attr.colormap; return True; } static Bool _XimDefaultStdColormap( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { Atom *out; out = (Atom *)((char *)top + info->offset); *out = (Atom)0; return True; } static Bool _XimDefaultFg( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { Xic ic = (Xic)parm; Xim im = (Xim)ic->core.im; unsigned long fg; unsigned long *out; fg = WhitePixel(im->core.display, DefaultScreen(im->core.display)); out = (unsigned long *)((char *)top + info->offset); *out = fg; return True; } static Bool _XimDefaultBg( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { Xic ic = (Xic)parm; Xim im = (Xim)ic->core.im; unsigned long bg; unsigned long *out; bg = BlackPixel(im->core.display, DefaultScreen(im->core.display)); out = (unsigned long *)((char *)top + info->offset); *out = bg; return True; } static Bool _XimDefaultBgPixmap( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { Pixmap *out; out = (Pixmap *)((char *)top + info->offset); *out = (Pixmap)0; return True; } static Bool _XimDefaultFontSet( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { XFontSet *out; out = (XFontSet *)((char *)top + info->offset); *out = 0; return True; } static Bool _XimDefaultLineSpace( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { Xic ic = (Xic)parm; XFontSet fontset; XFontSetExtents *fset_extents; int line_space = 0; int *out; if(mode & XIM_PREEDIT_ATTR) { fontset = ic->core.preedit_attr.fontset; } else if(mode & XIM_STATUS_ATTR) { fontset = ic->core.status_attr.fontset; } else { return True; } if (fontset) { fset_extents = XExtentsOfFontSet(fontset); line_space = fset_extents->max_logical_extent.height; } out = (int *)((char *)top + info->offset); *out = line_space; return True; } static Bool _XimDefaultCursor( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { Cursor *out; out = (Cursor *)((char *)top + info->offset); *out = (Cursor)0; return True; } static Bool _XimDefaultPreeditState( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { XIMPreeditState *out; out = (XIMPreeditState *)((char *)top + info->offset); *out = XIMPreeditDisable; return True; } static Bool _XimDefaultNest( XimValueOffsetInfo info, XPointer top, XPointer parm, unsigned long mode) { return True; } static Bool _XimEncodeCallback( XimValueOffsetInfo info, XPointer top, XPointer val) { XIMCallback *out; out = (XIMCallback *)((char *)top + info->offset); *out = *((XIMCallback *)val); return True; } static Bool _XimEncodeString( XimValueOffsetInfo info, XPointer top, XPointer val) { char *string; char **out; if(val == (XPointer)NULL) { return False; } if (!(string = strdup((char *)val))) { return False; } out = (char **)((char *)top + info->offset); if(*out) { Xfree(*out); } *out = string; return True; } static Bool _XimEncodeStyle( XimValueOffsetInfo info, XPointer top, XPointer val) { XIMStyle *out; out = (XIMStyle *)((char *)top + info->offset); *out = (XIMStyle)val; return True; } static Bool _XimEncodeWindow( XimValueOffsetInfo info, XPointer top, XPointer val) { Window *out; out = (Window *)((char *)top + info->offset); *out = (Window)val; return True; } static Bool _XimEncodeStringConv( XimValueOffsetInfo info, XPointer top, XPointer val) { /* * Not yet */ return True; } static Bool _XimEncodeResetState( XimValueOffsetInfo info, XPointer top, XPointer val) { XIMResetState *out; out = (XIMResetState *)((char *)top + info->offset); *out = (XIMResetState)val; return True; } static Bool _XimEncodeHotKey( XimValueOffsetInfo info, XPointer top, XPointer val) { XIMHotKeyTriggers *hotkey = (XIMHotKeyTriggers *)val; XIMHotKeyTriggers **out; XIMHotKeyTriggers *key_list; XIMHotKeyTrigger *key; XPointer tmp; int num; int len; register int i; if(hotkey == (XIMHotKeyTriggers *)NULL) { return True; } if((num = hotkey->num_hot_key) == 0) { return True; } len = sizeof(XIMHotKeyTriggers) + sizeof(XIMHotKeyTrigger) * num; if(!(tmp = Xmalloc(len))) { return False; } key_list = (XIMHotKeyTriggers *)tmp; key = (XIMHotKeyTrigger *)((char *)tmp + sizeof(XIMHotKeyTriggers)); for(i = 0; i < num; i++) { key[i] = hotkey->key[i]; } key_list->num_hot_key = num; key_list->key = key; out = (XIMHotKeyTriggers **)((char *)top + info->offset); *out = key_list; return True; } static Bool _XimEncodeHotKetState( XimValueOffsetInfo info, XPointer top, XPointer val) { XIMHotKeyState *out; out = (XIMHotKeyState *)((char *)top + info->offset); *out = (XIMHotKeyState)val; return True; } static Bool _XimEncodeRectangle( XimValueOffsetInfo info, XPointer top, XPointer val) { XRectangle *out; out = (XRectangle *)((char *)top + info->offset); *out = *((XRectangle *)val); return True; } static Bool _XimEncodeSpot( XimValueOffsetInfo info, XPointer top, XPointer val) { XPoint *out; out = (XPoint *)((char *)top + info->offset); *out = *((XPoint *)val); return True; } static Bool _XimEncodeColormap( XimValueOffsetInfo info, XPointer top, XPointer val) { Colormap *out; out = (Colormap *)((char *)top + info->offset); *out = (Colormap)val; return True; } static Bool _XimEncodeStdColormap( XimValueOffsetInfo info, XPointer top, XPointer val) { Atom *out; out = (Atom *)((char *)top + info->offset); *out = (Atom)val; return True; } static Bool _XimEncodeLong( XimValueOffsetInfo info, XPointer top, XPointer val) { unsigned long *out; out = (unsigned long *)((char *)top + info->offset); *out = (unsigned long)val; return True; } static Bool _XimEncodeBgPixmap( XimValueOffsetInfo info, XPointer top, XPointer val) { Pixmap *out; out = (Pixmap *)((char *)top + info->offset); *out = (Pixmap)val; return True; } static Bool _XimEncodeFontSet( XimValueOffsetInfo info, XPointer top, XPointer val) { XFontSet *out; out = (XFontSet *)((char *)top + info->offset); *out = (XFontSet)val; return True; } static Bool _XimEncodeLineSpace( XimValueOffsetInfo info, XPointer top, XPointer val) { int *out; out = (int *)((char *)top + info->offset); *out = (long)val; return True; } static Bool _XimEncodeCursor( XimValueOffsetInfo info, XPointer top, XPointer val) { Cursor *out; out = (Cursor *)((char *)top + info->offset); *out = (Cursor)val; return True; } static Bool _XimEncodePreeditState( XimValueOffsetInfo info, XPointer top, XPointer val) { XIMPreeditState *out; out = (XIMPreeditState *)((char *)top + info->offset); *out = (XIMPreeditState)val; return True; } static Bool _XimEncodeNest( XimValueOffsetInfo info, XPointer top, XPointer val) { return True; } static Bool _XimDecodeStyles( XimValueOffsetInfo info, XPointer top, XPointer val) { XIMStyles *styles; XIMStyles *out; register int i; unsigned int num; int len; XPointer tmp; if(val == (XPointer)NULL) { return False; } styles = *((XIMStyles **)((char *)top + info->offset)); num = styles->count_styles; len = sizeof(XIMStyles) + sizeof(XIMStyle) * num; if(!(tmp = Xcalloc(1, len))) { return False; } out = (XIMStyles *)tmp; if(num >0) { out->count_styles = (unsigned short)num; out->supported_styles = (XIMStyle *)((char *)tmp + sizeof(XIMStyles)); for(i = 0; i < num; i++) { out->supported_styles[i] = styles->supported_styles[i]; } } *((XIMStyles **)val) = out; return True; } static Bool _XimDecodeValues( XimValueOffsetInfo info, XPointer top, XPointer val) { XIMValuesList *values_list; XIMValuesList *out; register int i; unsigned int num; int len; XPointer tmp; if(val == (XPointer)NULL) { return False; } values_list = *((XIMValuesList **)((char *)top + info->offset)); num = values_list->count_values; len = sizeof(XIMValuesList) + sizeof(char **) * num; if(!(tmp = Xcalloc(1, len))) { return False; } out = (XIMValuesList *)tmp; if(num) { out->count_values = (unsigned short)num; out->supported_values = (char **)((char *)tmp + sizeof(XIMValuesList)); for(i = 0; i < num; i++) { out->supported_values[i] = values_list->supported_values[i]; } } *((XIMValuesList **)val) = out; return True; } static Bool _XimDecodeCallback( XimValueOffsetInfo info, XPointer top, XPointer val) { XIMCallback *in; XIMCallback *callback; in = (XIMCallback *)((char *)top + info->offset); if(!(callback = Xmalloc(sizeof(XIMCallback)))) { return False; } callback->client_data = in->client_data; callback->callback = in->callback; *((XIMCallback **)val) = callback; return True; } static Bool _XimDecodeString( XimValueOffsetInfo info, XPointer top, XPointer val) { char *in; char *string; in = *((char **)((char *)top + info->offset)); if (in != NULL) { string = strdup(in); } else { string = Xcalloc(1, 1); /* strdup("") */ } if (string == NULL) { return False; } *((char **)val) = string; return True; } static Bool _XimDecodeBool( XimValueOffsetInfo info, XPointer top, XPointer val) { Bool *in; in = (Bool *)((char *)top + info->offset); *((Bool *)val) = *in; return True; } static Bool _XimDecodeStyle( XimValueOffsetInfo info, XPointer top, XPointer val) { XIMStyle *in; in = (XIMStyle *)((char *)top + info->offset); *((XIMStyle *)val) = *in; return True; } static Bool _XimDecodeWindow( XimValueOffsetInfo info, XPointer top, XPointer val) { Window *in; in = (Window *)((char *)top + info->offset); *((Window *)val) = *in; return True; } static Bool _XimDecodeStringConv( XimValueOffsetInfo info, XPointer top, XPointer val) { /* * Not yet */ return True; } static Bool _XimDecodeResetState( XimValueOffsetInfo info, XPointer top, XPointer val) { XIMResetState *in; in = (XIMResetState *)((char *)top + info->offset); *((XIMResetState *)val) = *in; return True; } static Bool _XimDecodeHotKey( XimValueOffsetInfo info, XPointer top, XPointer val) { XIMHotKeyTriggers *in; XIMHotKeyTriggers *hotkey; XIMHotKeyTrigger *key; XPointer tmp; int num; int len; register int i; in = *((XIMHotKeyTriggers **)((char *)top + info->offset)); num = in->num_hot_key; len = sizeof(XIMHotKeyTriggers) + sizeof(XIMHotKeyTrigger) * num; if(!(tmp = Xmalloc(len))) { return False; } hotkey = (XIMHotKeyTriggers *)tmp; key = (XIMHotKeyTrigger *)((char *)tmp + sizeof(XIMHotKeyTriggers)); for(i = 0; i < num; i++) { key[i] = in->key[i]; } hotkey->num_hot_key = num; hotkey->key = key; *((XIMHotKeyTriggers **)val) = hotkey; return True; } static Bool _XimDecodeHotKetState( XimValueOffsetInfo info, XPointer top, XPointer val) { XIMHotKeyState *in; in = (XIMHotKeyState *)((char *)top + info->offset); *((XIMHotKeyState *)val) = *in; return True; } static Bool _XimDecodeRectangle( XimValueOffsetInfo info, XPointer top, XPointer val) { XRectangle *in; XRectangle *rect; in = (XRectangle *)((char *)top + info->offset); if(!(rect = Xmalloc(sizeof(XRectangle)))) { return False; } *rect = *in; *((XRectangle **)val) = rect; return True; } static Bool _XimDecodeSpot( XimValueOffsetInfo info, XPointer top, XPointer val) { XPoint *in; XPoint *spot; in = (XPoint *)((char *)top + info->offset); if(!(spot = Xmalloc(sizeof(XPoint)))) { return False; } *spot = *in; *((XPoint **)val) = spot; return True; } static Bool _XimDecodeColormap( XimValueOffsetInfo info, XPointer top, XPointer val) { Colormap *in; in = (Colormap *)((char *)top + info->offset); *((Colormap *)val) = *in; return True; } static Bool _XimDecodeStdColormap( XimValueOffsetInfo info, XPointer top, XPointer val) { Atom *in; in = (Atom *)((char *)top + info->offset); *((Atom *)val) = *in; return True; } static Bool _XimDecodeLong( XimValueOffsetInfo info, XPointer top, XPointer val) { unsigned long *in; in = (unsigned long *)((char *)top + info->offset); *((unsigned long *)val) = *in; return True; } static Bool _XimDecodeBgPixmap( XimValueOffsetInfo info, XPointer top, XPointer val) { Pixmap *in; in = (Pixmap *)((char *)top + info->offset); *((Pixmap *)val) = *in; return True; } static Bool _XimDecodeFontSet( XimValueOffsetInfo info, XPointer top, XPointer val) { XFontSet *in; in = (XFontSet *)((char *)top + info->offset); *((XFontSet *)val) = *in; return True; } static Bool _XimDecodeLineSpace( XimValueOffsetInfo info, XPointer top, XPointer val) { int *in; in = (int *)((char *)top + info->offset); *((int *)val) = *in; return True; } static Bool _XimDecodeCursor( XimValueOffsetInfo info, XPointer top, XPointer val) { Cursor *in; in = (Cursor *)((char *)top + info->offset); *((Cursor *)val) = *in; return True; } static Bool _XimDecodePreeditState( XimValueOffsetInfo info, XPointer top, XPointer val) { XIMPreeditState *in; in = (XIMPreeditState *)((char *)top + info->offset); *((XIMPreeditState *)val) = *in; return True; } static Bool _XimDecodeNest( XimValueOffsetInfo info, XPointer top, XPointer val) { return True; } static XIMResource im_resources[] = { {XNQueryInputStyle, 0, XimType_XIMStyles, 0, 0, 0}, {XNDestroyCallback, 0, 0, 0, 0, 0}, {XNResourceName, 0, XimType_STRING8, 0, 0, 0}, {XNResourceClass, 0, XimType_STRING8, 0, 0, 0}, {XNQueryIMValuesList, 0, 0, 0, 0, 0}, {XNQueryICValuesList, 0, 0, 0, 0, 0}, {XNVisiblePosition, 0, 0, 0, 0, 0} }; static XIMResource im_inner_resources[] = { {XNDestroyCallback, 0, 0, 0, 0, 0}, {XNResourceName, 0, XimType_STRING8, 0, 0, 0}, {XNResourceClass, 0, XimType_STRING8, 0, 0, 0}, {XNQueryIMValuesList, 0, 0, 0, 0, 0}, {XNQueryICValuesList, 0, 0, 0, 0, 0}, {XNVisiblePosition, 0, 0, 0, 0, 0} }; static XIMResource ic_resources[] = { {XNInputStyle, 0, XimType_CARD32, 0, 0, 0}, {XNClientWindow, 0, XimType_Window, 0, 0, 0}, {XNFocusWindow, 0, XimType_Window, 0, 0, 0}, {XNResourceName, 0, XimType_STRING8, 0, 0, 0}, {XNResourceClass, 0, XimType_STRING8, 0, 0, 0}, {XNGeometryCallback, 0, 0, 0, 0, 0}, {XNFilterEvents, 0, XimType_CARD32, 0, 0, 0}, {XNDestroyCallback, 0, 0, 0, 0, 0}, {XNStringConversionCallback, 0, 0, 0, 0, 0}, {XNStringConversion, 0, XimType_XIMStringConversion,0, 0, 0}, {XNResetState, 0, 0, 0, 0, 0}, {XNHotKey, 0, XimType_XIMHotKeyTriggers,0, 0, 0}, {XNHotKeyState, 0, XimType_XIMHotKeyState, 0, 0, 0}, {XNPreeditAttributes, 0, XimType_NEST, 0, 0, 0}, {XNStatusAttributes, 0, XimType_NEST, 0, 0, 0}, {XNArea, 0, XimType_XRectangle, 0, 0, 0}, {XNAreaNeeded, 0, XimType_XRectangle, 0, 0, 0}, {XNSpotLocation, 0, XimType_XPoint, 0, 0, 0}, {XNColormap, 0, XimType_CARD32, 0, 0, 0}, {XNStdColormap, 0, XimType_CARD32, 0, 0, 0}, {XNForeground, 0, XimType_CARD32, 0, 0, 0}, {XNBackground, 0, XimType_CARD32, 0, 0, 0}, {XNBackgroundPixmap, 0, XimType_CARD32, 0, 0, 0}, {XNFontSet, 0, XimType_XFontSet, 0, 0, 0}, {XNLineSpace, 0, XimType_CARD32, 0, 0, 0}, {XNCursor, 0, XimType_CARD32, 0, 0, 0}, {XNPreeditStartCallback, 0, 0, 0, 0, 0}, {XNPreeditDoneCallback, 0, 0, 0, 0, 0}, {XNPreeditDrawCallback, 0, 0, 0, 0, 0}, {XNPreeditCaretCallback, 0, 0, 0, 0, 0}, {XNStatusStartCallback, 0, 0, 0, 0, 0}, {XNStatusDoneCallback, 0, 0, 0, 0, 0}, {XNStatusDrawCallback, 0, 0, 0, 0, 0}, {XNPreeditState, 0, 0, 0, 0, 0}, {XNPreeditStateNotifyCallback, 0, 0, 0, 0, 0}, }; static XIMResource ic_inner_resources[] = { {XNResourceName, 0, XimType_STRING8, 0, 0, 0}, {XNResourceClass, 0, XimType_STRING8, 0, 0, 0}, {XNGeometryCallback, 0, 0, 0, 0, 0}, {XNDestroyCallback, 0, 0, 0, 0, 0}, {XNStringConversionCallback, 0, 0, 0, 0, 0}, {XNPreeditStartCallback, 0, 0, 0, 0, 0}, {XNPreeditDoneCallback, 0, 0, 0, 0, 0}, {XNPreeditDrawCallback, 0, 0, 0, 0, 0}, {XNPreeditCaretCallback, 0, 0, 0, 0, 0}, {XNStatusStartCallback, 0, 0, 0, 0, 0}, {XNStatusDoneCallback, 0, 0, 0, 0, 0}, {XNStatusDrawCallback, 0, 0, 0, 0, 0}, {XNPreeditStateNotifyCallback, 0, 0, 0, 0, 0}, }; static XimValueOffsetInfoRec im_attr_info[] = { {OFFSET_XNQUERYINPUTSTYLE, 0, XOffsetOf(XimDefIMValues, styles), _XimDefaultStyles, NULL, _XimDecodeStyles}, {OFFSET_XNDESTROYCALLBACK, 0, XOffsetOf(XimDefIMValues, destroy_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, {OFFSET_XNRESOURCENAME, 0, XOffsetOf(XimDefIMValues, res_name), NULL, _XimEncodeString, _XimDecodeString}, {OFFSET_XNRESOURCECLASS, 0, XOffsetOf(XimDefIMValues, res_class), NULL, _XimEncodeString, _XimDecodeString}, {OFFSET_XNQUERYIMVALUESLIST, 0, XOffsetOf(XimDefIMValues, im_values_list), _XimDefaultIMValues, NULL, _XimDecodeValues}, {OFFSET_XNQUERYICVALUESLIST, 0, XOffsetOf(XimDefIMValues, ic_values_list), _XimDefaultICValues, NULL, _XimDecodeValues}, {OFFSET_XNVISIBLEPOSITION, 0, XOffsetOf(XimDefIMValues, visible_position), _XimDefaultVisiblePos, NULL, _XimDecodeBool} }; static XimValueOffsetInfoRec ic_attr_info[] = { {OFFSET_XNINPUTSTYLE, 0, XOffsetOf(XimDefICValues, input_style), NULL, _XimEncodeStyle, _XimDecodeStyle}, {OFFSET_XNCLIENTWINDOW, 0, XOffsetOf(XimDefICValues, client_window), NULL, _XimEncodeWindow, _XimDecodeWindow}, {OFFSET_XNFOCUSWINDOW, 0, XOffsetOf(XimDefICValues, focus_window), _XimDefaultFocusWindow, _XimEncodeWindow, _XimDecodeWindow}, {OFFSET_XNRESOURCENAME, 0, XOffsetOf(XimDefICValues, res_name), _XimDefaultResName, _XimEncodeString, _XimDecodeString}, {OFFSET_XNRESOURCECLASS, 0, XOffsetOf(XimDefICValues, res_class), _XimDefaultResClass, _XimEncodeString, _XimDecodeString}, {OFFSET_XNGEOMETRYCALLBACK, 0, XOffsetOf(XimDefICValues, geometry_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, {OFFSET_XNFILTEREVENTS, 0, XOffsetOf(XimDefICValues, filter_events), NULL, NULL, _XimDecodeLong}, {OFFSET_XNDESTROYCALLBACK, 0, XOffsetOf(XimDefICValues, destroy_callback), _XimDefaultDestroyCB, _XimEncodeCallback, _XimDecodeCallback}, {OFFSET_XNSTRINGCONVERSIONCALLBACK, 0, XOffsetOf(XimDefICValues, string_conversion_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, {OFFSET_XNSTRINGCONVERSION, 0, XOffsetOf(XimDefICValues, string_conversion), NULL, _XimEncodeStringConv, _XimDecodeStringConv}, {OFFSET_XNRESETSTATE, 0, XOffsetOf(XimDefICValues, reset_state), _XimDefaultResetState, _XimEncodeResetState, _XimDecodeResetState}, {OFFSET_XNHOTKEY, 0, XOffsetOf(XimDefICValues, hotkey), NULL, _XimEncodeHotKey, _XimDecodeHotKey}, {OFFSET_XNHOTKEYSTATE, 0, XOffsetOf(XimDefICValues, hotkey_state), _XimDefaultHotKeyState, _XimEncodeHotKetState, _XimDecodeHotKetState}, {OFFSET_XNPREEDITATTRIBUTES, 0, XOffsetOf(XimDefICValues, preedit_attr), _XimDefaultNest, _XimEncodeNest, _XimDecodeNest}, {OFFSET_XNSTATUSATTRIBUTES, 0, XOffsetOf(XimDefICValues, status_attr), _XimDefaultNest, _XimEncodeNest, _XimDecodeNest}, }; static XimValueOffsetInfoRec ic_pre_attr_info[] = { {OFFSET_XNAREA, 0, XOffsetOf(ICPreeditAttributes, area), _XimDefaultArea, _XimEncodeRectangle, _XimDecodeRectangle}, {OFFSET_XNAREANEEDED, 0, XOffsetOf(ICPreeditAttributes, area_needed), NULL, _XimEncodeRectangle, _XimDecodeRectangle}, {OFFSET_XNSPOTLOCATION, 0, XOffsetOf(ICPreeditAttributes, spot_location), NULL, _XimEncodeSpot, _XimDecodeSpot}, {OFFSET_XNCOLORMAP, 0, XOffsetOf(ICPreeditAttributes, colormap), _XimDefaultColormap, _XimEncodeColormap, _XimDecodeColormap}, {OFFSET_XNSTDCOLORMAP, 0, XOffsetOf(ICPreeditAttributes, std_colormap), _XimDefaultStdColormap, _XimEncodeStdColormap, _XimDecodeStdColormap}, {OFFSET_XNFOREGROUND, 0, XOffsetOf(ICPreeditAttributes, foreground), _XimDefaultFg, _XimEncodeLong, _XimDecodeLong}, {OFFSET_XNBACKGROUND, 0, XOffsetOf(ICPreeditAttributes, background), _XimDefaultBg, _XimEncodeLong, _XimDecodeLong}, {OFFSET_XNBACKGROUNDPIXMAP, 0, XOffsetOf(ICPreeditAttributes, background_pixmap), _XimDefaultBgPixmap, _XimEncodeBgPixmap, _XimDecodeBgPixmap}, {OFFSET_XNFONTSET, 0, XOffsetOf(ICPreeditAttributes, fontset), _XimDefaultFontSet, _XimEncodeFontSet, _XimDecodeFontSet}, {OFFSET_XNLINESPACE, 0, XOffsetOf(ICPreeditAttributes, line_spacing), _XimDefaultLineSpace, _XimEncodeLineSpace, _XimDecodeLineSpace}, {OFFSET_XNCURSOR, 0, XOffsetOf(ICPreeditAttributes, cursor), _XimDefaultCursor, _XimEncodeCursor, _XimDecodeCursor}, {OFFSET_XNPREEDITSTARTCALLBACK, 0, XOffsetOf(ICPreeditAttributes, start_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, {OFFSET_XNPREEDITDONECALLBACK, 0, XOffsetOf(ICPreeditAttributes, done_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, {OFFSET_XNPREEDITDRAWCALLBACK, 0, XOffsetOf(ICPreeditAttributes, draw_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, {OFFSET_XNPREEDITCARETCALLBACK, 0, XOffsetOf(ICPreeditAttributes, caret_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, {OFFSET_XNPREEDITSTATE, 0, XOffsetOf(ICPreeditAttributes, preedit_state), _XimDefaultPreeditState, _XimEncodePreeditState,_XimDecodePreeditState}, {OFFSET_XNPREEDITSTATENOTIFYCALLBACK, 0, XOffsetOf(ICPreeditAttributes, state_notify_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, }; static XimValueOffsetInfoRec ic_sts_attr_info[] = { {OFFSET_XNAREA, 0, XOffsetOf(ICStatusAttributes, area), _XimDefaultArea, _XimEncodeRectangle, _XimDecodeRectangle}, {OFFSET_XNAREANEEDED, 0, XOffsetOf(ICStatusAttributes, area_needed), NULL, _XimEncodeRectangle, _XimDecodeRectangle}, {OFFSET_XNCOLORMAP, 0, XOffsetOf(ICStatusAttributes, colormap), _XimDefaultColormap, _XimEncodeColormap, _XimDecodeColormap}, {OFFSET_XNSTDCOLORMAP, 0, XOffsetOf(ICStatusAttributes, std_colormap), _XimDefaultStdColormap, _XimEncodeStdColormap, _XimDecodeStdColormap}, {OFFSET_XNFOREGROUND, 0, XOffsetOf(ICStatusAttributes, foreground), _XimDefaultFg, _XimEncodeLong, _XimDecodeLong}, {OFFSET_XNBACKGROUND, 0, XOffsetOf(ICStatusAttributes, background), _XimDefaultBg, _XimEncodeLong, _XimDecodeLong}, {OFFSET_XNBACKGROUNDPIXMAP, 0, XOffsetOf(ICStatusAttributes, background_pixmap), _XimDefaultBgPixmap, _XimEncodeBgPixmap, _XimDecodeBgPixmap}, {OFFSET_XNFONTSET, 0, XOffsetOf(ICStatusAttributes, fontset), _XimDefaultFontSet, _XimEncodeFontSet, _XimDecodeFontSet}, {OFFSET_XNLINESPACE, 0, XOffsetOf(ICStatusAttributes, line_spacing), _XimDefaultLineSpace, _XimEncodeLineSpace, _XimDecodeLineSpace}, {OFFSET_XNCURSOR, 0, XOffsetOf(ICStatusAttributes, cursor), _XimDefaultCursor, _XimEncodeCursor, _XimDecodeCursor}, {OFFSET_XNSTATUSSTARTCALLBACK, 0, XOffsetOf(ICStatusAttributes, start_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, {OFFSET_XNSTATUSDONECALLBACK, 0, XOffsetOf(ICStatusAttributes, done_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, {OFFSET_XNSTATUSDRAWCALLBACK, 0, XOffsetOf(ICStatusAttributes, draw_callback), NULL, _XimEncodeCallback, _XimDecodeCallback} }; typedef struct _XimIMMode { unsigned short name_offset; unsigned short mode; } XimIMMode; static const XimIMMode im_mode[] = { {OFFSET_XNQUERYINPUTSTYLE, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, {OFFSET_XNDESTROYCALLBACK, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, {OFFSET_XNRESOURCENAME, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, {OFFSET_XNRESOURCECLASS, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, {OFFSET_XNQUERYIMVALUESLIST, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, {OFFSET_XNQUERYICVALUESLIST, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, {OFFSET_XNVISIBLEPOSITION, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)} }; typedef struct _XimICMode { unsigned short name_offset; unsigned short preedit_callback_mode; unsigned short preedit_position_mode; unsigned short preedit_area_mode; unsigned short preedit_nothing_mode; unsigned short preedit_none_mode; unsigned short status_callback_mode; unsigned short status_area_mode; unsigned short status_nothing_mode; unsigned short status_none_mode; } XimICMode; static const XimICMode ic_mode[] = { {OFFSET_XNINPUTSTYLE, (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET), (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET), (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET), (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET)}, {OFFSET_XNCLIENTWINDOW, (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), 0, (XIM_MODE_STS_ONCE | XIM_MODE_STS_GET), (XIM_MODE_STS_ONCE | XIM_MODE_STS_GET), (XIM_MODE_STS_ONCE | XIM_MODE_STS_GET), 0}, {OFFSET_XNFOCUSWINDOW, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, {OFFSET_XNRESOURCENAME, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, {OFFSET_XNRESOURCECLASS, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, {OFFSET_XNGEOMETRYCALLBACK, 0, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0, 0}, {OFFSET_XNFILTEREVENTS, XIM_MODE_PRE_GET, XIM_MODE_PRE_GET, XIM_MODE_PRE_GET, XIM_MODE_PRE_GET, 0, XIM_MODE_STS_GET, XIM_MODE_STS_GET, XIM_MODE_STS_GET, XIM_MODE_STS_GET}, {OFFSET_XNDESTROYCALLBACK, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, 0}, {OFFSET_XNSTRINGCONVERSIONCALLBACK, (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, 0}, {OFFSET_XNSTRINGCONVERSION, XIM_MODE_PRE_SET, XIM_MODE_PRE_SET, XIM_MODE_PRE_SET, XIM_MODE_PRE_SET, XIM_MODE_PRE_SET, 0, 0, 0, 0}, {OFFSET_XNRESETSTATE, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, 0, 0}, {OFFSET_XNHOTKEY, (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, 0, 0}, {OFFSET_XNHOTKEYSTATE, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, 0, 0}, {OFFSET_XNPREEDITATTRIBUTES, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, 0, 0}, {OFFSET_XNSTATUSATTRIBUTES, 0, 0, 0, 0, 0, (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, {OFFSET_XNAREA, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0, 0}, {OFFSET_XNAREANEEDED, 0, 0, (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, (XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0, 0}, {OFFSET_XNSPOTLOCATION, 0, /*(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),*/ (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, 0}, {OFFSET_XNCOLORMAP, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, {OFFSET_XNSTDCOLORMAP, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, {OFFSET_XNFOREGROUND, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, {OFFSET_XNBACKGROUND, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, {OFFSET_XNBACKGROUNDPIXMAP, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, {OFFSET_XNFONTSET, 0, (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, (XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, {OFFSET_XNLINESPACE, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, {OFFSET_XNCURSOR, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, {OFFSET_XNPREEDITSTARTCALLBACK, (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, 0, 0, 0, 0, 0}, {OFFSET_XNPREEDITDONECALLBACK, (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, 0, 0, 0, 0, 0}, {OFFSET_XNPREEDITDRAWCALLBACK, (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, 0, 0, 0, 0, 0}, {OFFSET_XNPREEDITCARETCALLBACK, (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, 0, 0, 0, 0, 0}, {OFFSET_XNPREEDITSTATE, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, 0, 0}, {OFFSET_XNPREEDITSTATENOTIFYCALLBACK, (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, 0, 0, 0}, {OFFSET_XNSTATUSSTARTCALLBACK, 0, 0, 0, 0, 0, (XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0, 0, 0}, {OFFSET_XNSTATUSDONECALLBACK, 0, 0, 0, 0, 0, (XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0, 0, 0}, {OFFSET_XNSTATUSDRAWCALLBACK, 0, 0, 0, 0, 0, (XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0, 0, 0} }; /* the quarks are separated from im_mode/ic_mode so those arrays * can be const. */ static XrmQuark im_mode_quark[sizeof(im_mode) / sizeof(im_mode[0])]; static XrmQuark ic_mode_quark[sizeof(ic_mode) / sizeof(ic_mode[0])]; static Bool _XimSetResourceList( XIMResourceList *res_list, unsigned int *list_num, XIMResourceList resource, unsigned int num_resource, unsigned short id) { register int i; int len; XIMResourceList res; len = sizeof(XIMResource) * num_resource; if(!(res = Xcalloc(1, len))) { return False; } for(i = 0; i < num_resource; i++, id++) { res[i] = resource[i]; res[i].id = id; } _XIMCompileResourceList(res, num_resource); *res_list = res; *list_num = num_resource; return True; } Bool _XimSetIMResourceList( XIMResourceList *res_list, unsigned int *list_num) { return _XimSetResourceList(res_list, list_num, im_resources, XIMNumber(im_resources), 100); } Bool _XimSetICResourceList( XIMResourceList *res_list, unsigned int *list_num) { return _XimSetResourceList(res_list, list_num, ic_resources, XIMNumber(ic_resources), 200); } Bool _XimSetInnerIMResourceList( XIMResourceList *res_list, unsigned int *list_num) { return _XimSetResourceList(res_list, list_num, im_inner_resources, XIMNumber(im_inner_resources), 100); } Bool _XimSetInnerICResourceList( XIMResourceList *res_list, unsigned int *list_num) { return _XimSetResourceList(res_list, list_num, ic_inner_resources, XIMNumber(ic_inner_resources), 200); } static XIMResourceList _XimGetResourceListRecByMode( XIMResourceList res_list, unsigned int list_num, unsigned short mode) { register int i; for(i = 0; i < list_num; i++) { if (res_list[i].mode & mode) { return (XIMResourceList)&res_list[i]; } } return (XIMResourceList)NULL; } Bool _XimCheckCreateICValues( XIMResourceList res_list, unsigned int list_num) { if (!_XimGetResourceListRecByMode(res_list, list_num, XIM_MODE_IC_CREATE)) { return True; } return False; } XIMResourceList _XimGetResourceListRecByQuark( XIMResourceList res_list, unsigned int list_num, XrmQuark quark) { register int i; for(i = 0; i < list_num; i++) { if (res_list[i].xrm_name == quark) { return (XIMResourceList)&res_list[i]; } } return (XIMResourceList)NULL; } XIMResourceList _XimGetResourceListRec( XIMResourceList res_list, unsigned int list_num, const char *name) { XrmQuark quark = XrmStringToQuark(name); return _XimGetResourceListRecByQuark(res_list, list_num, quark); } char * _XimSetIMValueData( Xim im, XPointer top, XIMArg *values, XIMResourceList res_list, unsigned int list_num) { register XIMArg *p; XIMResourceList res; int check; for(p = values; p->name != NULL; p++) { if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { return p->name; } check = _XimCheckIMMode(res, XIM_SETIMVALUES); if(check == XIM_CHECK_INVALID) { continue; } else if (check == XIM_CHECK_ERROR) { return p->name; } if(!_XimEncodeLocalIMAttr(res, top, p->value)) { return p->name; } } return NULL; } char * _XimGetIMValueData( Xim im, XPointer top, XIMArg *values, XIMResourceList res_list, unsigned int list_num) { register XIMArg *p; XIMResourceList res; int check; for(p = values; p->name != NULL; p++) { if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { return p->name; } check = _XimCheckIMMode(res, XIM_GETIMVALUES); if(check == XIM_CHECK_INVALID) { continue; } else if (check == XIM_CHECK_ERROR) { return p->name; } if(!_XimDecodeLocalIMAttr(res, top, p->value)) { return p->name; } } return NULL; } void _XimSetIMMode( XIMResourceList res_list, unsigned int list_num) { XIMResourceList res; unsigned int n = XIMNumber(im_mode); register int i; for(i = 0; i < n; i++) { if(!(res = _XimGetResourceListRecByQuark(res_list, list_num, im_mode_quark[i]))) { continue; } res->mode = im_mode[i].mode; } return; } static int _XimCheckSetIMDefaultsMode( XIMResourceList res) { if(res->mode & XIM_MODE_IM_DEFAULT) { return XIM_CHECK_VALID; } return XIM_CHECK_INVALID; } static int _XimCheckSetIMValuesMode( XIMResourceList res) { if(res->mode & XIM_MODE_IM_SET) { return XIM_CHECK_VALID; } return XIM_CHECK_INVALID; } static int _XimCheckGetIMValuesMode( XIMResourceList res) { if(res->mode & XIM_MODE_IM_GET) { return XIM_CHECK_VALID; } return XIM_CHECK_INVALID; } int _XimCheckIMMode( XIMResourceList res, unsigned long mode) { if(res->mode == 0) { return XIM_CHECK_INVALID; } if(mode & XIM_SETIMDEFAULTS) { return _XimCheckSetIMDefaultsMode(res); } else if (mode & XIM_SETIMVALUES) { return _XimCheckSetIMValuesMode(res); } else if (mode & XIM_GETIMVALUES) { return _XimCheckGetIMValuesMode(res); } else { return XIM_CHECK_ERROR; } } void _XimSetICMode(XIMResourceList res_list, unsigned int list_num, XIMStyle style) { XIMResourceList res; unsigned int n = XIMNumber(ic_mode); register int i; unsigned int pre_offset; unsigned int sts_offset; if(style & XIMPreeditArea) { pre_offset = XOffsetOf(XimICMode, preedit_area_mode); } else if(style & XIMPreeditCallbacks) { pre_offset = XOffsetOf(XimICMode, preedit_callback_mode); } else if(style & XIMPreeditPosition) { pre_offset = XOffsetOf(XimICMode, preedit_position_mode); } else if(style & XIMPreeditNothing) { pre_offset = XOffsetOf(XimICMode, preedit_nothing_mode); } else { pre_offset = XOffsetOf(XimICMode, preedit_none_mode); } if(style & XIMStatusArea) { sts_offset = XOffsetOf(XimICMode, status_area_mode); } else if(style & XIMStatusCallbacks) { sts_offset = XOffsetOf(XimICMode, status_callback_mode); } else if(style & XIMStatusNothing) { sts_offset = XOffsetOf(XimICMode, status_nothing_mode); } else { sts_offset = XOffsetOf(XimICMode, status_none_mode); } for(i = 0; i < n; i++) { if(!(res = _XimGetResourceListRecByQuark(res_list, list_num, ic_mode_quark[i]))) { continue; } res->mode = ( (*(const unsigned short *)((const char *)&ic_mode[i] + pre_offset)) | (*(const unsigned short *)((const char *)&ic_mode[i] + sts_offset))); } return; } static int _XimCheckSetICDefaultsMode( XIMResourceList res, unsigned long mode) { if(mode & XIM_PREEDIT_ATTR) { if(!(res->mode & XIM_MODE_PRE_MASK)) { return XIM_CHECK_INVALID; } if(res->mode & XIM_MODE_PRE_CREATE) { return XIM_CHECK_ERROR; } else if (!(res->mode & XIM_MODE_PRE_DEFAULT)) { return XIM_CHECK_INVALID; } } else if(mode & XIM_STATUS_ATTR) { if(!(res->mode & XIM_MODE_STS_MASK)) { return XIM_CHECK_INVALID; } if(res->mode & XIM_MODE_STS_CREATE) { return XIM_CHECK_ERROR; } if(!(res->mode & XIM_MODE_STS_DEFAULT)) { return XIM_CHECK_INVALID; } } else { if(!res->mode) { return XIM_CHECK_INVALID; } if(res->mode & XIM_MODE_IC_CREATE) { return XIM_CHECK_ERROR; } if(!(res->mode & XIM_MODE_IC_DEFAULT)) { return XIM_CHECK_INVALID; } } return XIM_CHECK_VALID; } static int _XimCheckCreateICMode( XIMResourceList res, unsigned long mode) { if(mode & XIM_PREEDIT_ATTR) { if(!(res->mode & XIM_MODE_PRE_MASK)) { return XIM_CHECK_INVALID; } if(res->mode & XIM_MODE_PRE_CREATE) { res->mode &= ~XIM_MODE_PRE_CREATE; } else if(res->mode & XIM_MODE_PRE_ONCE) { res->mode &= ~XIM_MODE_PRE_ONCE; } else if(res->mode & XIM_MODE_PRE_DEFAULT) { res->mode &= ~XIM_MODE_PRE_DEFAULT; } else if (!(res->mode & XIM_MODE_PRE_SET)) { return XIM_CHECK_ERROR; } } else if(mode & XIM_STATUS_ATTR) { if(!(res->mode & XIM_MODE_STS_MASK)) { return XIM_CHECK_INVALID; } if(res->mode & XIM_MODE_STS_CREATE) { res->mode &= ~XIM_MODE_STS_CREATE; } else if(res->mode & XIM_MODE_STS_ONCE) { res->mode &= ~XIM_MODE_STS_ONCE; } else if(res->mode & XIM_MODE_STS_DEFAULT) { res->mode &= ~XIM_MODE_STS_DEFAULT; } else if (!(res->mode & XIM_MODE_STS_SET)) { return XIM_CHECK_ERROR; } } else { if(!res->mode) { return XIM_CHECK_INVALID; } if(res->mode & XIM_MODE_IC_CREATE) { res->mode &= ~XIM_MODE_IC_CREATE; } else if(res->mode & XIM_MODE_IC_ONCE) { res->mode &= ~XIM_MODE_IC_ONCE; } else if(res->mode & XIM_MODE_IC_DEFAULT) { res->mode &= ~XIM_MODE_IC_DEFAULT; } else if (!(res->mode & XIM_MODE_IC_SET)) { return XIM_CHECK_ERROR; } } return XIM_CHECK_VALID; } static int _XimCheckSetICValuesMode( XIMResourceList res, unsigned long mode) { if(mode & XIM_PREEDIT_ATTR) { if(!(res->mode & XIM_MODE_PRE_MASK)) { return XIM_CHECK_INVALID; } if(res->mode & XIM_MODE_PRE_ONCE) { res->mode &= ~XIM_MODE_PRE_ONCE; } else if(!(res->mode & XIM_MODE_PRE_SET)) { return XIM_CHECK_ERROR; } } else if(mode & XIM_STATUS_ATTR) { if(!(res->mode & XIM_MODE_STS_MASK)) { return XIM_CHECK_INVALID; } if(res->mode & XIM_MODE_STS_ONCE) { res->mode &= ~XIM_MODE_STS_ONCE; } else if(!(res->mode & XIM_MODE_STS_SET)) { return XIM_CHECK_ERROR; } } else { if(!res->mode) { return XIM_CHECK_INVALID; } if(res->mode & XIM_MODE_IC_ONCE) { res->mode &= ~XIM_MODE_IC_ONCE; } else if(!(res->mode & XIM_MODE_IC_SET)) { return XIM_CHECK_ERROR; } } return XIM_CHECK_VALID; } static int _XimCheckGetICValuesMode( XIMResourceList res, unsigned long mode) { if(mode & XIM_PREEDIT_ATTR) { if(!(res->mode & XIM_MODE_PRE_MASK)) { return XIM_CHECK_INVALID; } if(!(res->mode & XIM_MODE_PRE_GET)) { return XIM_CHECK_ERROR; } } else if(mode & XIM_STATUS_ATTR) { if(!(res->mode & XIM_MODE_STS_MASK)) { return XIM_CHECK_INVALID; } if(!(res->mode & XIM_MODE_STS_GET)) { return XIM_CHECK_ERROR; } } else { if(!res->mode) { return XIM_CHECK_INVALID; } if(!(res->mode & XIM_MODE_IC_GET)) { return XIM_CHECK_ERROR; } } return XIM_CHECK_VALID; } int _XimCheckICMode( XIMResourceList res, unsigned long mode) { if(mode &XIM_SETICDEFAULTS) { return _XimCheckSetICDefaultsMode(res, mode); } else if (mode & XIM_CREATEIC) { return _XimCheckCreateICMode(res, mode); } else if (mode & XIM_SETICVALUES) { return _XimCheckSetICValuesMode(res, mode); } else if (mode & XIM_GETICVALUES) { return _XimCheckGetICValuesMode(res, mode); } else { return XIM_CHECK_ERROR; } } Bool _XimSetLocalIMDefaults( Xim im, XPointer top, XIMResourceList res_list, unsigned int list_num) { XimValueOffsetInfo info; unsigned int num; register int i; XIMResourceList res; int check; info = im_attr_info; num = XIMNumber(im_attr_info); for(i = 0; i < num; i++) { if((res = _XimGetResourceListRecByQuark( res_list, list_num, info[i].quark)) == (XIMResourceList)NULL) { return False; } check = _XimCheckIMMode(res, XIM_SETIMDEFAULTS); if(check == XIM_CHECK_INVALID) { continue; } else if (check == XIM_CHECK_ERROR) { return False; } if(!info[i].defaults) { continue; } if(!(info[i].defaults(&info[i], top, (XPointer)NULL, 0))) { return False; } } return True; } Bool _XimSetICDefaults( Xic ic, XPointer top, unsigned long mode, XIMResourceList res_list, unsigned int list_num) { unsigned int num; XimValueOffsetInfo info; register int i; XIMResourceList res; int check; XrmQuark pre_quark; XrmQuark sts_quark; pre_quark = XrmStringToQuark(XNPreeditAttributes); sts_quark = XrmStringToQuark(XNStatusAttributes); if(mode & XIM_PREEDIT_ATTR) { info = ic_pre_attr_info; num = XIMNumber(ic_pre_attr_info); } else if(mode & XIM_STATUS_ATTR) { info = ic_sts_attr_info; num = XIMNumber(ic_sts_attr_info); } else { info = ic_attr_info; num = XIMNumber(ic_attr_info); } for(i = 0; i < num; i++) { if(info[i].quark == pre_quark) { if(!_XimSetICDefaults(ic, (XPointer)((char *)top + info[i].offset), (mode | XIM_PREEDIT_ATTR), res_list, list_num)) { return False; } } else if (info[i].quark == sts_quark) { if(!_XimSetICDefaults(ic, (XPointer)((char *)top + info[i].offset), (mode | XIM_STATUS_ATTR), res_list, list_num)) { return False; } } else { if(!(res = _XimGetResourceListRecByQuark(res_list, list_num, info[i].quark))) { return False; } check = _XimCheckICMode(res, mode); if (check == XIM_CHECK_INVALID) { continue; } else if (check == XIM_CHECK_ERROR) { return False; } if (!info[i].defaults) { continue; } if (!(info[i].defaults(&info[i], top, (XPointer)ic, mode))) { return False; } } } return True; } static Bool _XimEncodeAttr( XimValueOffsetInfo info, unsigned int num, XIMResourceList res, XPointer top, XPointer val) { register int i; for(i = 0; i < num; i++ ) { if(info[i].quark == res->xrm_name) { if(!info[i].encode) { return False; } return (*info[i].encode)(&info[i], top, val); } } return False; } Bool _XimEncodeLocalIMAttr( XIMResourceList res, XPointer top, XPointer val) { return _XimEncodeAttr(im_attr_info, XIMNumber(im_attr_info), res, top, val); } Bool _XimEncodeLocalICAttr( Xic ic, XIMResourceList res, XPointer top, XIMArg *arg, unsigned long mode) { unsigned int num; XimValueOffsetInfo info; if(mode & XIM_PREEDIT_ATTR) { info = ic_pre_attr_info; num = XIMNumber(ic_pre_attr_info); } else if(mode & XIM_STATUS_ATTR) { info = ic_sts_attr_info; num = XIMNumber(ic_sts_attr_info); } else { info = ic_attr_info; num = XIMNumber(ic_attr_info); } return _XimEncodeAttr(info, num, res, top, arg->value); } static Bool _XimEncodeLocalTopValue( Xic ic, XIMResourceList res, XPointer val, Bool flag) { XIMArg *p = (XIMArg *)val; if (res->xrm_name == XrmStringToQuark(XNClientWindow)) { ic->core.client_window = (Window)p->value; if (ic->core.focus_window == (Window)0) ic->core.focus_window = ic->core.client_window; if (flag) { _XRegisterFilterByType(ic->core.im->core.display, ic->core.focus_window, KeyPress, KeyRelease, _XimLocalFilter, (XPointer)ic); } } else if (res->xrm_name == XrmStringToQuark(XNFocusWindow)) { if (ic->core.client_window) { if (flag) { _XUnregisterFilter(ic->core.im->core.display, ic->core.focus_window, _XimLocalFilter, (XPointer)ic); } ic->core.focus_window = (Window)p->value; if (flag) { _XRegisterFilterByType(ic->core.im->core.display, ic->core.focus_window, KeyPress, KeyRelease, _XimLocalFilter, (XPointer)ic); } } else ic->core.focus_window = (Window)p->value; } return True; } static Bool _XimEncodeLocalPreeditValue( Xic ic, XIMResourceList res, XPointer val) { XIMArg *p = (XIMArg *)val; if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { XStandardColormap *colormap_ret; int count; if (!(XGetRGBColormaps(ic->core.im->core.display, ic->core.focus_window, &colormap_ret, &count, (Atom)p->value))) return False; Xfree(colormap_ret); } return True; } static Bool _XimEncodeLocalStatusValue( Xic ic, XIMResourceList res, XPointer val) { XIMArg *p = (XIMArg *)val; if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { XStandardColormap *colormap_ret; int count; if (!(XGetRGBColormaps(ic->core.im->core.display, ic->core.focus_window, &colormap_ret, &count, (Atom)p->value))) return False; Xfree(colormap_ret); } return True; } char * _XimSetICValueData( Xic ic, XPointer top, XIMResourceList res_list, unsigned int list_num, XIMArg *values, unsigned long mode, Bool flag) { register XIMArg *p; XIMResourceList res; char *name; int check; XrmQuark pre_quark; XrmQuark sts_quark; pre_quark = XrmStringToQuark(XNPreeditAttributes); sts_quark = XrmStringToQuark(XNStatusAttributes); for(p = values; p->name != NULL; p++) { if((res = _XimGetResourceListRec(res_list, list_num, p->name)) == (XIMResourceList)NULL) { return p->name; } if(res->xrm_name == pre_quark) { if(((name = _XimSetICValueData(ic, (XPointer)(&((XimDefICValues *)top)->preedit_attr), res_list, list_num, (XIMArg *)p->value, (mode | XIM_PREEDIT_ATTR), flag)))) { return name; } } else if(res->xrm_name == sts_quark) { if(((name = _XimSetICValueData(ic, (XPointer)(&((XimDefICValues *)top)->status_attr), res_list, list_num, (XIMArg *)p->value, (mode | XIM_STATUS_ATTR), flag)))) { return name; } } else { check = _XimCheckICMode(res, mode); if(check == XIM_CHECK_INVALID) { continue; } else if(check == XIM_CHECK_ERROR) { return p->name; } if(mode & XIM_PREEDIT_ATTR) { if (!_XimEncodeLocalPreeditValue(ic, res, (XPointer)p)) return p->name; } else if(mode & XIM_STATUS_ATTR) { if (!_XimEncodeLocalStatusValue(ic, res, (XPointer)p)) return p->name; } else { if (!_XimEncodeLocalTopValue(ic, res, (XPointer)p, flag)) return p->name; } if(_XimEncodeLocalICAttr(ic, res, top, p, mode) == False) { return p->name; } } } return NULL; } static Bool _XimCheckInputStyle( XIMStyles *styles, XIMStyle style) { int num = styles->count_styles; register int i; for(i = 0; i < num; i++) { if(styles->supported_styles[i] == style) { return True; } } return False; } Bool _XimCheckLocalInputStyle( Xic ic, XPointer top, XIMArg *values, XIMStyles *styles, XIMResourceList res_list, unsigned int list_num) { XrmQuark quark = XrmStringToQuark(XNInputStyle); register XIMArg *p; XIMResourceList res; for(p = values; p && p->name != NULL; p++) { if(quark == XrmStringToQuark(p->name)) { if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { return False; } if(!_XimEncodeLocalICAttr(ic, res, top, p, 0)) { return False; } if (_XimCheckInputStyle(styles, ((XimDefICValues *)top)->input_style)) { return True; } return False; } } return False; } static Bool _XimDecodeAttr( XimValueOffsetInfo info, unsigned int num, XIMResourceList res, XPointer top, XPointer val) { register int i; for(i = 0; i < num; i++ ) { if(info[i].quark == res->xrm_name) { if(!info[i].decode) { return False; } return (*info[i].decode)(&info[i], top, val); } } return False; } Bool _XimDecodeLocalIMAttr( XIMResourceList res, XPointer top, XPointer val) { return _XimDecodeAttr(im_attr_info, XIMNumber(im_attr_info), res, top, val); } Bool _XimDecodeLocalICAttr( XIMResourceList res, XPointer top, XPointer val, unsigned long mode) { unsigned int num; XimValueOffsetInfo info; if(mode & XIM_PREEDIT_ATTR) { info = ic_pre_attr_info; num = XIMNumber(ic_pre_attr_info); } else if(mode & XIM_STATUS_ATTR) { info = ic_sts_attr_info; num = XIMNumber(ic_sts_attr_info); } else { info = ic_attr_info; num = XIMNumber(ic_attr_info); } return _XimDecodeAttr(info, num, res, top, val); } char * _XimGetICValueData(Xic ic, XPointer top, XIMResourceList res_list, unsigned int list_num, XIMArg *values, unsigned long mode) { register XIMArg *p; XIMResourceList res; char *name; int check; XrmQuark pre_quark; XrmQuark sts_quark; pre_quark = XrmStringToQuark(XNPreeditAttributes); sts_quark = XrmStringToQuark(XNStatusAttributes); for(p = values; p->name != NULL; p++) { if((res = _XimGetResourceListRec(res_list, list_num, p->name)) == (XIMResourceList)NULL) { return p->name; } if(res->xrm_name == pre_quark) { if((name = _XimGetICValueData(ic, (XPointer)(&((XimDefICValues *)top)->preedit_attr), res_list, list_num, (XIMArg *)p->value, (mode | XIM_PREEDIT_ATTR)))) { return name; } } else if(res->xrm_name == sts_quark) { if((name = _XimGetICValueData(ic, (XPointer)(&((XimDefICValues *)top)->status_attr), res_list, list_num, (XIMArg *)p->value, (mode | XIM_STATUS_ATTR)))) { return name; } } else { check = _XimCheckICMode(res, mode); if(check == XIM_CHECK_INVALID) { continue; } else if(check == XIM_CHECK_ERROR) { return p->name; } if(_XimDecodeLocalICAttr(res, top, p->value, mode) == False) { return p->name; } } } return NULL; } void _XimGetCurrentIMValues(Xim im, XimDefIMValues *im_values) { bzero((char *)im_values, sizeof(XimDefIMValues)); im_values->styles = im->core.styles; im_values->im_values_list = im->core.im_values_list; im_values->ic_values_list = im->core.ic_values_list; im_values->destroy_callback = im->core.destroy_callback; im_values->res_name = im->core.res_name; im_values->res_class = im->core.res_class; im_values->visible_position = im->core.visible_position; } void _XimSetCurrentIMValues(Xim im, XimDefIMValues *im_values) { im->core.styles = im_values->styles; im->core.im_values_list = im_values->im_values_list; im->core.ic_values_list = im_values->ic_values_list; im->core.destroy_callback = im_values->destroy_callback; im->core.res_name = im_values->res_name; im->core.res_class = im_values->res_class; im->core.visible_position = im_values->visible_position; } void _XimGetCurrentICValues(Xic ic, XimDefICValues *ic_values) { bzero((char *)ic_values, sizeof(XimDefICValues)); ic_values->input_style = ic->core.input_style; ic_values->client_window = ic->core.client_window; ic_values->focus_window = ic->core.focus_window; ic_values->filter_events = ic->core.filter_events; ic_values->geometry_callback = ic->core.geometry_callback; ic_values->res_name = ic->core.res_name; ic_values->res_class = ic->core.res_class; ic_values->destroy_callback = ic->core.destroy_callback; ic_values->string_conversion_callback = ic->core.string_conversion_callback; ic_values->string_conversion = ic->core.string_conversion; ic_values->reset_state = ic->core.reset_state; ic_values->hotkey = ic->core.hotkey; ic_values->hotkey_state = ic->core.hotkey_state; ic_values->preedit_attr = ic->core.preedit_attr; ic_values->status_attr = ic->core.status_attr; } void _XimSetCurrentICValues( Xic ic, XimDefICValues *ic_values) { ic->core.input_style = ic_values->input_style; ic->core.client_window = ic_values->client_window; if (ic_values->focus_window) ic->core.focus_window = ic_values->focus_window; ic->core.filter_events = ic_values->filter_events; ic->core.geometry_callback = ic_values->geometry_callback; ic->core.res_name = ic_values->res_name; ic->core.res_class = ic_values->res_class; ic->core.destroy_callback = ic_values->destroy_callback; ic->core.string_conversion_callback = ic_values->string_conversion_callback; ic->core.string_conversion = ic_values->string_conversion; ic->core.reset_state = ic_values->reset_state; ic->core.hotkey = ic_values->hotkey; ic->core.hotkey_state = ic_values->hotkey_state; ic->core.preedit_attr = ic_values->preedit_attr; ic->core.status_attr = ic_values->status_attr; } static void _XimInitialIMOffsetInfo(void) { unsigned int n = XIMNumber(im_attr_info); register int i; for(i = 0; i < n; i++) { im_attr_info[i].quark = XrmStringToQuark(GET_NAME(im_attr_info[i])); } } static void _XimInitialICOffsetInfo(void) { unsigned int n; register int i; n = XIMNumber(ic_attr_info); for(i = 0; i < n; i++) { ic_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_attr_info[i])); } n = XIMNumber(ic_pre_attr_info); for(i = 0; i < n; i++) { ic_pre_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_pre_attr_info[i])); } n = XIMNumber(ic_sts_attr_info); for(i = 0; i < n; i++) { ic_sts_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_sts_attr_info[i])); } } static void _XimInitialIMMode(void) { unsigned int n = XIMNumber(im_mode); register int i; for(i = 0; i < n; i++) { im_mode_quark[i] = XrmStringToQuark(GET_NAME(im_mode[i])); } } static void _XimInitialICMode(void) { unsigned int n = XIMNumber(ic_mode); register int i; for(i = 0; i < n; i++) { ic_mode_quark[i] = XrmStringToQuark(GET_NAME(ic_mode[i])); } } void _XimInitialResourceInfo(void) { static Bool init_flag = False; if(init_flag == True) { return; } _XimInitialIMOffsetInfo(); _XimInitialICOffsetInfo(); _XimInitialIMMode(); _XimInitialICMode(); init_flag = True; } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imThaiFlt.c0000644000000000000000000012763513614532331017311 0ustar /*********************************************************** Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1993 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* **++ ** FACILITY: ** ** Xlib ** ** ABSTRACT: ** ** Thai specific functions. ** Handles character classifications, composibility checking, ** Input sequence check and other Thai specific requirements ** according to WTT specification and DEC extensions. ** ** MODIFICATION HISTORY: ** **/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" #include "XimThai.h" #include "XlcPubI.h" #define SPACE 32 /* character classification table */ #define TACTIS_CHARS 256 static char const tactis_chtype[TACTIS_CHARS] = { CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 0 - 7 */ CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 8 - 15 */ CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 16 - 23 */ CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 24 - 31 */ NON, NON, NON, NON, NON, NON, NON, NON, /* 32 - 39 */ NON, NON, NON, NON, NON, NON, NON, NON, /* 40 - 47 */ NON, NON, NON, NON, NON, NON, NON, NON, /* 48 - 55 */ NON, NON, NON, NON, NON, NON, NON, NON, /* 56 - 63 */ NON, NON, NON, NON, NON, NON, NON, NON, /* 64 - 71 */ NON, NON, NON, NON, NON, NON, NON, NON, /* 72 - 79 */ NON, NON, NON, NON, NON, NON, NON, NON, /* 80 - 87 */ NON, NON, NON, NON, NON, NON, NON, NON, /* 88 - 95 */ NON, NON, NON, NON, NON, NON, NON, NON, /* 96 - 103 */ NON, NON, NON, NON, NON, NON, NON, NON, /* 104 - 111 */ NON, NON, NON, NON, NON, NON, NON, NON, /* 112 - 119 */ NON, NON, NON, NON, NON, NON, NON, CTRL, /* 120 - 127 */ CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 128 - 135 */ CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 136 - 143 */ CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 144 - 151 */ CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 152 - 159 */ NON, CONS, CONS, CONS, CONS, CONS, CONS, CONS, /* 160 - 167 */ CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS, /* 168 - 175 */ CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS, /* 176 - 183 */ CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS, /* 184 - 191 */ CONS, CONS, CONS, CONS, FV3, CONS, FV3, CONS, /* 192 - 199 */ CONS, CONS, CONS, CONS, CONS, CONS, CONS, NON, /* 200 - 207 */ FV1, AV2, FV1, FV1, AV1, AV3, AV2, AV3, /* 208 - 215 */ BV1, BV2, BD, NON, NON, NON, NON, NON, /* 216 - 223 */ LV, LV, LV, LV, LV, FV2, NON, AD2, /* 224 - 231 */ TONE, TONE, TONE, TONE, AD1, AD1, AD3, NON, /* 232 - 239 */ NON, NON, NON, NON, NON, NON, NON, NON, /* 240 - 247 */ NON, NON, NON, NON, NON, NON, NON, CTRL /* 248 - 255 */ }; /* Composibility checking tables */ #define NC 0 /* NOT COMPOSIBLE - following char displays in next cell */ #define CP 1 /* COMPOSIBLE - following char is displayed in the same cell as leading char, also implies ACCEPT */ #define XC 3 /* Non-display */ #define AC 4 /* ACCEPT - display the following char in the next cell */ #define RJ 5 /* REJECT - discard that following char, ignore it */ #define CH_CLASSES 17 /* 17 classes of chars */ static char const write_rules_lookup[CH_CLASSES][CH_CLASSES] = { /* Table 0: writing/outputing rules */ /* row: leading char, column: following char */ /* CTRL NON CONS LV FV1 FV2 FV3 BV1 BV2 BD TONE AD1 AD2 AD3 AV1 AV2 AV3 */ {XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*CTRL*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*NON*/ ,{XC, NC, NC, NC, NC, NC, NC, CP, CP, CP, CP, CP, CP, CP, CP, CP, CP}/*CONS*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*LV*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*FV1*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*FV2*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*FV3*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, CP, NC, NC, NC, NC, NC}/*BV1*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, NC, NC, NC, NC, NC, NC}/*BV2*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*BD*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*TONE*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*AD1*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*AD2*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*AD3*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, CP, NC, NC, NC, NC, NC}/*AV1*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, NC, NC, NC, NC, NC, NC}/*AV2*/ ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, NC, CP, NC, NC, NC, NC}/*AV3*/ }; static char const wtt_isc1_lookup[CH_CLASSES][CH_CLASSES] = { /* Table 1: WTT default input sequence check rules */ /* row: leading char, column: following char */ /* CTRL NON CONS LV FV1 FV2 FV3 BV1 BV2 BD TONE AD1 AD2 AD3 AV1 AV2 AV3 */ {XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*CTRL*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*NON*/ ,{XC, AC, AC, AC, AC, AC, AC, CP, CP, CP, CP, CP, CP, CP, CP, CP, CP}/*CONS*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*LV*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV1*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV2*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV3*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*BV1*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*BV2*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*BD*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*TONE*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD1*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD2*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD3*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*AV1*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*AV2*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, CP, RJ, RJ, RJ, RJ}/*AV3*/ }; static char const wtt_isc2_lookup[CH_CLASSES][CH_CLASSES] = { /* Table 2: WTT strict input sequence check rules */ /* row: leading char, column: following char */ /* CTRL NON CONS LV FV1 FV2 FV3 BV1 BV2 BD TONE AD1 AD2 AD3 AV1 AV2 AV3 */ {XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*CTRL*/ ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*NON*/ ,{XC, AC, AC, AC, AC, RJ, AC, CP, CP, CP, CP, CP, CP, CP, CP, CP, CP}/*CONS*/ ,{XC, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*LV*/ ,{XC, AC, AC, AC, AC, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV1*/ ,{XC, AC, AC, AC, AC, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV2*/ ,{XC, AC, AC, AC, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV3*/ ,{XC, AC, AC, AC, AC, RJ, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*BV1*/ ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*BV2*/ ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*BD*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*TONE*/ ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD1*/ ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD2*/ ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD3*/ ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*AV1*/ ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*AV2*/ ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, CP, RJ, CP, RJ, RJ, RJ, RJ}/*AV3*/ }; static char const thaicat_isc_lookup[CH_CLASSES][CH_CLASSES] = { /* Table 3: Thaicat input sequence check rules */ /* row: leading char, column: following char */ /* CTRL NON CONS LV FV1 FV2 FV3 BV1 BV2 BD TONE AD1 AD2 AD3 AV1 AV2 AV3 */ {XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*CTRL*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*NON*/ ,{XC, AC, AC, AC, AC, AC, AC, CP, CP, CP, CP, CP, CP, CP, CP, CP, CP}/*CONS*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*LV*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV1*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV2*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ} /*FV3*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*BV1*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*BV2*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*BD*/ ,{XC, AC, AC, AC, AC, AC, AC, CP, CP, RJ, RJ, RJ, RJ, RJ, CP, CP, CP}/*TONE*/ ,{XC, AC, AC, AC, AC, AC, AC, CP, RJ, RJ, RJ, RJ, RJ, RJ, CP, RJ, RJ}/*AD1*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, CP}/*AD2*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD3*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*AV1*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*AV2*/ ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, CP, RJ, RJ, RJ, RJ}/*AV3*/ }; /* returns classification of a char */ static int THAI_chtype (unsigned char ch) { return tactis_chtype[ch]; } #ifdef UNUSED /* returns the display level */ static int THAI_chlevel (unsigned char ch) { int chlevel; switch (tactis_chtype[ch]) { case CTRL: chlevel = NON; break; case BV1: case BV2: case BD: chlevel = BELOW; break; case TONE: case AD1: case AD2: chlevel = TOP; break; case AV1: case AV2: case AV3: case AD3: chlevel = ABOVE; break; case NON: case CONS: case LV: case FV1: case FV2: case FV3: default: /* if tactis_chtype is invalid */ chlevel = BASE; break; } return chlevel; } /* return True if char is non-spacing */ static Bool THAI_isdead (unsigned char ch) { return ((tactis_chtype[ch] == CTRL) || (tactis_chtype[ch] == BV1) || (tactis_chtype[ch] == BV2) || (tactis_chtype[ch] == BD) || (tactis_chtype[ch] == TONE) || (tactis_chtype[ch] == AD1) || (tactis_chtype[ch] == AD2) || (tactis_chtype[ch] == AD3) || (tactis_chtype[ch] == AV1) || (tactis_chtype[ch] == AV2) || (tactis_chtype[ch] == AV3)); } /* return True if char is consonant */ static Bool THAI_iscons (unsigned char ch) { return (tactis_chtype[ch] == CONS); } /* return True if char is vowel */ static Bool THAI_isvowel (unsigned char ch) { return ((tactis_chtype[ch] == LV) || (tactis_chtype[ch] == FV1) || (tactis_chtype[ch] == FV2) || (tactis_chtype[ch] == FV3) || (tactis_chtype[ch] == BV1) || (tactis_chtype[ch] == BV2) || (tactis_chtype[ch] == AV1) || (tactis_chtype[ch] == AV2) || (tactis_chtype[ch] == AV3)); } /* return True if char is tonemark */ static Bool THAI_istone (unsigned char ch) { return (tactis_chtype[ch] == TONE); } #endif static Bool THAI_iscomposible ( unsigned char follow_ch, unsigned char lead_ch) {/* "Can follow_ch be put in the same display cell as lead_ch?" */ return (write_rules_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] == CP); } static Bool THAI_isaccepted ( unsigned char follow_ch, unsigned char lead_ch, unsigned char mode) { Bool iskeyvalid; /* means "Can follow_ch be keyed in after lead_ch?" */ switch (mode) { case WTT_ISC1: iskeyvalid = (wtt_isc1_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] != RJ); break; case WTT_ISC2: iskeyvalid = (wtt_isc2_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] != RJ); break; case THAICAT_ISC: iskeyvalid = (thaicat_isc_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] != RJ); break; default: iskeyvalid = True; break; } return iskeyvalid; } #ifdef UNUSED static void THAI_apply_write_rules( unsigned char *instr, unsigned char *outstr, unsigned char insert_ch, int *num_insert_ch) { /* Input parameters: instr - input string insert_ch specify what char to be added when invalid composition is found Output parameters: outstr - output string after input string has been applied the rules num_insert_ch - number of insert_ch added to outstr. */ unsigned char *lead_ch = NULL, *follow_ch = NULL, *out_ch = NULL; *num_insert_ch = 0; lead_ch = follow_ch = instr; out_ch = outstr; if ((*lead_ch == '\0') || !(THAI_find_chtype(instr,DEAD))) { /* Empty string or can't find any non-spacing char*/ strcpy((char *)outstr, (char *)instr); } else { /* String of length >= 1, keep looking */ follow_ch++; if (THAI_isdead(*lead_ch)) { /* is first char non-spacing? */ *out_ch++ = SPACE; (*num_insert_ch)++; } *out_ch++ = *lead_ch; while (*follow_ch != '\0') /* more char in string to check */ { if (THAI_isdead(*follow_ch) && !THAI_iscomposible(*follow_ch,*lead_ch)) { *out_ch++ = SPACE; (*num_insert_ch)++; } *out_ch++ = *follow_ch; lead_ch = follow_ch; follow_ch++; } *out_ch = '\0'; } } static int THAI_find_chtype ( unsigned char *instr, int chtype) { /* Input parameters: instr - input string chtype - type of character to look for Output parameters: function returns first position of character with matched chtype function returns -1 if it does not find. */ int i = 0, position = -1; switch (chtype) { case DEAD: for (i = 0; *instr != '\0' && THAI_isdead(*instr); i++, instr++) ; if (*instr != '\0') position = i; break; default: break; } return position; } static int THAI_apply_scm( unsigned char *instr, unsigned char *outstr, unsigned char spec_ch, int num_sp, unsigned char insert_ch) { unsigned char *scan, *outch; int i, dead_count, found_count; Bool isconsecutive; scan = instr; outch = outstr; dead_count = found_count = 0; isconsecutive = False; while (*scan != '\0') { if (THAI_isdead(*scan)) dead_count++; /* count number of non-spacing char */ if (*scan == spec_ch) if (!isconsecutive) found_count++; /* count number consecutive spec char found */ *outch++ = *scan++; if (found_count == num_sp) { for (i = 0; i < dead_count; i++) *outch++ = insert_ch; dead_count = found_count = 0; } } /* what to return? */ return 0; /* probably not right but better than returning garbage */ } /* The following functions are copied from XKeyBind.c */ static void ComputeMaskFromKeytrans(); static int IsCancelComposeKey(KeySym *symbol, XKeyEvent *event); static void SetLed(Display *dpy, int num, int state); static CARD8 FindKeyCode(); /* The following functions are specific to this module */ static int XThaiTranslateKey(); static int XThaiTranslateKeySym(); static KeySym HexIMNormalKey( XicThaiPart *thai_part, KeySym symbol, XKeyEvent *event); static KeySym HexIMFirstComposeKey( XicThaiPart *thai_part, KeySym symbol, XKeyEvent *event); static KeySym HexIMSecondComposeKey( XicThaiPart *thai_part, KeySym symbol XKeyEvent *event); static KeySym HexIMComposeSequence(KeySym ks1, KeySym ks2); static void InitIscMode(Xic ic); static Bool ThaiComposeConvert( Display *dpy, KeySym insym, KeySym *outsym, KeySym *lower, KeySym *upper); #endif /* * Definitions */ #define BellVolume 0 #define ucs2tis(wc) \ (unsigned char) ( \ (0<=(wc)&&(wc)<=0x7F) ? \ (wc) : \ ((0x0E01<=(wc)&&(wc)<=0x0E5F) ? ((wc)-0x0E00+0xA0) : 0)) /* "c" is an unsigned char */ #define tis2ucs(c) \ ( \ ((c)<=0x7F) ? \ (wchar_t)(c) : \ ((0x0A1<=(c)) ? ((wchar_t)(c)-0xA0+0x0E00) : 0)) /* * Macros to save and recall last input character in XIC */ #define IC_SavePreviousChar(ic,ch) \ ((ic)->private.local.base.mb[(ic)->private.local.base.tree[(ic)->private.local.context].mb] = (char) (ch)) #define IC_ClearPreviousChar(ic) \ ((ic)->private.local.base.mb[(ic)->private.local.base.tree[(ic)->private.local.context].mb] = 0) #define IC_GetPreviousChar(ic) \ (IC_RealGetPreviousChar(ic,1)) #define IC_GetContextChar(ic) \ (IC_RealGetPreviousChar(ic,2)) #define IC_DeletePreviousChar(ic) \ (IC_RealDeletePreviousChar(ic)) static unsigned char IC_RealGetPreviousChar(Xic ic, unsigned short pos) { XICCallback* cb = &ic->core.string_conversion_callback; DefTreeBase *b = &ic->private.local.base; if (cb && cb->callback) { XIMStringConversionCallbackStruct screc; unsigned char c; /* Use a safe value of position = 0 and stretch the range to desired * place, as XIM protocol is unclear here whether it could be negative */ screc.position = 0; screc.direction = XIMBackwardChar; screc.operation = XIMStringConversionRetrieval; screc.factor = pos; screc.text = 0; (cb->callback)((XIC)ic, cb->client_data, (XPointer)&screc); if (!screc.text) return (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb]; if ((screc.text->feedback && *screc.text->feedback == XIMStringConversionLeftEdge) || screc.text->length < 1) { c = 0; } else { Xim im; XlcConv conv; int from_left; int to_left; char *from_buf; char *to_buf; im = (Xim) XIMOfIC((XIC)ic); if (screc.text->encoding_is_wchar) { conv = _XlcOpenConverter(im->core.lcd, XlcNWideChar, im->core.lcd, XlcNCharSet); from_buf = (char *) screc.text->string.wcs; from_left = screc.text->length * sizeof(wchar_t); } else { conv = _XlcOpenConverter(im->core.lcd, XlcNMultiByte, im->core.lcd, XlcNCharSet); from_buf = screc.text->string.mbs; from_left = screc.text->length; } to_buf = (char *)&c; to_left = 1; _XlcResetConverter(conv); if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { c = (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb]; } _XlcCloseConverter(conv); XFree(screc.text->string.mbs); } XFree(screc.text); return c; } else { return (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb]; } } static unsigned char IC_RealDeletePreviousChar(Xic ic) { XICCallback* cb = &ic->core.string_conversion_callback; if (cb && cb->callback) { XIMStringConversionCallbackStruct screc; unsigned char c; screc.position = 0; screc.direction = XIMBackwardChar; screc.operation = XIMStringConversionSubstitution; screc.factor = 1; screc.text = 0; (cb->callback)((XIC)ic, cb->client_data, (XPointer)&screc); if (!screc.text) { return 0; } if ((screc.text->feedback && *screc.text->feedback == XIMStringConversionLeftEdge) || screc.text->length < 1) { c = 0; } else { if (screc.text->encoding_is_wchar) { c = ucs2tis(screc.text->string.wcs[0]); XFree(screc.text->string.wcs); } else { c = screc.text->string.mbs[0]; XFree(screc.text->string.mbs); } } XFree(screc.text); return c; } else { return 0; } } /* * Input sequence check mode in XIC */ #define IC_IscMode(ic) ((ic)->private.local.thai.input_mode) /* * Max. size of string handled by the two String Lookup functions. */ #define STR_LKUP_BUF_SIZE 256 /* * Size of buffer to contain previous locale name. */ #define SAV_LOCALE_NAME_SIZE 256 /* * Size of buffer to contain the IM modifier. */ #define MAXTHAIIMMODLEN 20 #define AllMods (ShiftMask|LockMask|ControlMask| \ Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask) #define IsISOControlKey(ks) ((ks) >= XK_2 && (ks) <= XK_8) #define IsValidControlKey(ks) (((((ks)>=XK_A && (ks)<=XK_asciitilde) || \ (ks)==XK_space || (ks)==XK_Delete) && \ ((ks)!=0))) #define COMPOSE_LED 2 #ifdef UNUSED typedef KeySym (*StateProc)( XicThaiPart *thai_part, KeySym symbol, XKeyEvent *event); /* * macros to classify XKeyEvent state field */ #define IsShift(state) (((state) & ShiftMask) != 0) #define IsLock(state) (((state) & LockMask) != 0) #define IsControl(state) (((state) & ControlMask) != 0) #define IsMod1(state) (((state) & Mod1Mask) != 0) #define IsMod2(state) (((state) & Mod2Mask) != 0) #define IsMod3(state) (((state) & Mod3Mask) != 0) #define IsMod4(state) (((state) & Mod4Mask) != 0) #define IsMod5(state) (((state) & Mod5Mask) != 0) /* * key starts Thai compose sequence (Hex input method) if : */ #define IsComposeKey(ks, event) \ (( ks==XK_Alt_L && \ IsControl((event)->state) && \ !IsShift((event)->state)) \ ? True : False) /* * State handler to implement the Thai hex input method. */ static int const nstate_handlers = 3; static StateProc state_handler[] = { HexIMNormalKey, HexIMFirstComposeKey, HexIMSecondComposeKey }; /* * Table for 'Thai Compose' character input. * The current implementation uses latin-1 keysyms. */ struct _XMapThaiKey { KeySym from; KeySym to; }; static struct _XMapThaiKey const ThaiComposeTable[] = { { /* 0xa4 */ XK_currency, /* 0xa5 */ XK_yen }, { /* 0xa2 */ XK_cent, /* 0xa3 */ XK_sterling }, { /* 0xe6 */ XK_ae, /* 0xef */ XK_idiaeresis }, { /* 0xd3 */ XK_Oacute, /* 0xee */ XK_icircumflex }, { /* 0xb9 */ XK_onesuperior, /* 0xfa */ XK_uacute }, { /* 0xd2 */ XK_Ograve, /* 0xe5 */ XK_aring }, { /* 0xbc */ XK_onequarter, /* 0xfb */ XK_ucircumflex }, { XK_VoidSymbol, XK_VoidSymbol } }; struct _XKeytrans { struct _XKeytrans *next;/* next on list */ char *string; /* string to return when the time comes */ int len; /* length of string (since NULL is legit)*/ KeySym key; /* keysym rebound */ unsigned int state; /* modifier state */ KeySym *modifiers; /* modifier keysyms you want */ int mlen; /* length of modifier list */ }; /* Convert keysym to 'Thai Compose' keysym */ /* The current implementation use latin-1 keysyms */ static Bool ThaiComposeConvert( Display *dpy, KeySym insym, KeySym *outsym, KeySym *lower, KeySym *upper) { struct _XMapThaiKey const *table_entry = ThaiComposeTable; while (table_entry->from != XK_VoidSymbol) { if (table_entry->from == insym) { *outsym = table_entry->to; *lower = *outsym; *upper = *outsym; return True; } table_entry++; } return False; } static int XThaiTranslateKey( register Display *dpy, KeyCode keycode, register unsigned int modifiers, unsigned int *modifiers_return, KeySym *keysym_return, KeySym *lsym_return, KeySym *usym_return) { int per; register KeySym *syms; KeySym sym = 0, lsym = 0, usym = 0; if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) return 0; *modifiers_return = (ShiftMask|LockMask) | dpy->mode_switch; if (((int)keycode < dpy->min_keycode) || ((int)keycode > dpy->max_keycode)) { *keysym_return = NoSymbol; return 1; } per = dpy->keysyms_per_keycode; syms = &dpy->keysyms[(keycode - dpy->min_keycode) * per]; while ((per > 2) && (syms[per - 1] == NoSymbol)) per--; if ((per > 2) && (modifiers & dpy->mode_switch)) { syms += 2; per -= 2; } if (!(modifiers & ShiftMask) && (!(modifiers & LockMask) || (dpy->lock_meaning == NoSymbol))) { if ((per == 1) || (syms[1] == NoSymbol)) XConvertCase(syms[0], keysym_return, &usym); else { XConvertCase(syms[0], &lsym, &usym); *keysym_return = syms[0]; } } else if (!(modifiers & LockMask) || (dpy->lock_meaning != XK_Caps_Lock)) { if ((per == 1) || ((usym = syms[1]) == NoSymbol)) XConvertCase(syms[0], &lsym, &usym); *keysym_return = usym; } else { if ((per == 1) || ((sym = syms[1]) == NoSymbol)) sym = syms[0]; XConvertCase(sym, &lsym, &usym); if (!(modifiers & ShiftMask) && (sym != syms[0]) && ((sym != usym) || (lsym == usym))) XConvertCase(syms[0], &lsym, &usym); *keysym_return = usym; } /* * ThaiCat keyboard support : * When the Shift and Thai keys are hold for some keys a 'Thai Compose' * character code is generated which is different from column 3 and * 4 of the keymap. * Since we don't know whether ThaiCat keyboard or WTT keyboard is * in use, the same mapping is done for all Thai input. * We just arbitary choose to use column 3 keysyms as the indices of * this mapping. * When the control key is also hold, this mapping has no effect. */ if ((modifiers & Mod1Mask) && (modifiers & ShiftMask) && !(modifiers & ControlMask)) { if (ThaiComposeConvert(dpy, syms[0], &sym, &lsym, &usym)) *keysym_return = sym; } if (*keysym_return == XK_VoidSymbol) *keysym_return = NoSymbol; *lsym_return = lsym; *usym_return = usym; return 1; } /* * XThaiTranslateKeySym * * Translate KeySym to TACTIS code output. * The current implementation uses ISO latin-1 keysym. * Should be changed to TACTIS keysyms when they are defined by the * standard. */ static int XThaiTranslateKeySym( Display *dpy, register KeySym symbol, register KeySym lsym, register KeySym usym, unsigned int modifiers, unsigned char *buffer, int nbytes) { KeySym ckey = 0; register struct _XKeytrans *p; int length; unsigned long hiBytes; register unsigned char c; /* * initialize length = 1 ; */ length = 1; if (!symbol) return 0; /* see if symbol rebound, if so, return that string. */ for (p = dpy->key_bindings; p; p = p->next) { if (((modifiers & AllMods) == p->state) && (symbol == p->key)) { length = p->len; if (length > nbytes) length = nbytes; memcpy (buffer, p->string, length); return length; } } /* try to convert to TACTIS, handling control */ hiBytes = symbol >> 8; if (!(nbytes && ((hiBytes == 0) || ((hiBytes == 0xFF) && (((symbol >= XK_BackSpace) && (symbol <= XK_Clear)) || (symbol == XK_Return) || (symbol == XK_Escape) || (symbol == XK_KP_Space) || (symbol == XK_KP_Tab) || (symbol == XK_KP_Enter) || ((symbol >= XK_KP_Multiply) && (symbol <= XK_KP_9)) || (symbol == XK_KP_Equal) || (symbol == XK_Scroll_Lock) || #ifdef DXK_PRIVATE /* DEC private keysyms */ (symbol == DXK_Remove) || #endif (symbol == NoSymbol) || (symbol == XK_Delete)))))) return 0; /* if X keysym, convert to ascii by grabbing low 7 bits */ if (symbol == XK_KP_Space) c = XK_space & 0x7F; /* patch encoding botch */ /* not for Thai else if (symbol == XK_hyphen) c = XK_minus & 0xFF; */ /* map to equiv character */ else if (hiBytes == 0xFF) c = symbol & 0x7F; else c = symbol & 0xFF; /* only apply Control key if it makes sense, else ignore it */ if (modifiers & ControlMask) { if (!(IsKeypadKey(lsym) || lsym==XK_Return || lsym==XK_Tab)) { if (IsISOControlKey(lsym)) ckey = lsym; else if (IsISOControlKey(usym)) ckey = usym; else if (lsym == XK_question) ckey = lsym; else if (usym == XK_question) ckey = usym; else if (IsValidControlKey(lsym)) ckey = lsym; else if (IsValidControlKey(usym)) ckey = usym; else length = 0; if (length != 0) { if (ckey == XK_2) c = '\000'; else if (ckey >= XK_3 && ckey <= XK_7) c = (char)(ckey-('3'-'\033')); else if (ckey == XK_8) c = '\177'; else if (ckey == XK_Delete) c = '\030'; else if (ckey == XK_question) c = '\037'; else if (ckey == XK_quoteleft) c = '\036'; /* KLee 1/24/91 */ else c = (char)(ckey & 0x1f); } } } /* * ThaiCat has a key that generates two TACTIS codes D1 & E9. * It is represented by the latin-1 keysym XK_thorn (0xfe). * If c is XK_thorn, this key is pressed and it is converted to * 0xd1 0xe9. */ if (c == XK_thorn) { buffer[0] = 0xd1; buffer[1] = 0xe9; buffer[2] = '\0'; return 2; } else { /* Normal case */ buffer[0] = c; buffer[1] = '\0'; return 1; } } /* * given a KeySym, returns the first keycode containing it, if any. */ static CARD8 FindKeyCode( register Display *dpy, register KeySym code) { register KeySym *kmax = dpy->keysyms + (dpy->max_keycode - dpy->min_keycode + 1) * dpy->keysyms_per_keycode; register KeySym *k = dpy->keysyms; while (k < kmax) { if (*k == code) return (((k - dpy->keysyms) / dpy->keysyms_per_keycode) + dpy->min_keycode); k += 1; } return 0; } /* * given a list of modifiers, computes the mask necessary for later matching. * This routine must lookup the key in the Keymap and then search to see * what modifier it is bound to, if any. Sets the AnyModifier bit if it * can't map some keysym to a modifier. */ static void ComputeMaskFromKeytrans( Display *dpy, register struct _XKeytrans *p) { register int i; register CARD8 code; register XModifierKeymap *m = dpy->modifiermap; p->state = AnyModifier; for (i = 0; i < p->mlen; i++) { /* if not found, then not on current keyboard */ if ((code = FindKeyCode(dpy, p->modifiers[i])) == 0) return; /* code is now the keycode for the modifier you want */ { register int j = m->max_keypermod<<3; while ((--j >= 0) && (code != m->modifiermap[j])) ; if (j < 0) return; p->state |= (1<<(j/m->max_keypermod)); } } p->state &= AllMods; } /************************************************************************ * * * Compose handling routines - compose handlers 0,1,2 * * ************************************************************************/ #define NORMAL_KEY_STATE 0 #define FIRST_COMPOSE_KEY_STATE 1 #define SECOND_COMPOSE_KEY_STATE 2 static KeySym HexIMNormalKey( XicThaiPart *thai_part, KeySym symbol, XKeyEvent *event) { if (IsComposeKey (symbol, event)) /* start compose sequence */ { SetLed (event->display,COMPOSE_LED, LedModeOn); thai_part->comp_state = FIRST_COMPOSE_KEY_STATE; return NoSymbol; } return symbol; } static KeySym HexIMFirstComposeKey( XicThaiPart *thai_part, KeySym symbol, XKeyEvent *event) { if (IsModifierKey (symbol)) return symbol; /* ignore shift etc. */ if (IsCancelComposeKey (&symbol, event)) /* cancel sequence */ { SetLed (event->display,COMPOSE_LED, LedModeOff); thai_part->comp_state = NORMAL_KEY_STATE; return symbol; } if (IsComposeKey (symbol, event)) /* restart sequence ?? */ { return NoSymbol; /* no state change necessary */ } thai_part->keysym = symbol; /* save key pressed */ thai_part->comp_state = SECOND_COMPOSE_KEY_STATE; return NoSymbol; } static KeySym HexIMSecondComposeKey( XicThaiPart *thai_part, KeySym symbol, XKeyEvent *event) { if (IsModifierKey (symbol)) return symbol; /* ignore shift etc. */ if (IsComposeKey (symbol, event)) /* restart sequence ? */ { thai_part->comp_state =FIRST_COMPOSE_KEY_STATE; return NoSymbol; } SetLed (event->display,COMPOSE_LED, LedModeOff); if (IsCancelComposeKey (&symbol, event)) /* cancel sequence ? */ { thai_part->comp_state = NORMAL_KEY_STATE; return symbol; } if ((symbol = HexIMComposeSequence (thai_part->keysym, symbol)) ==NoSymbol) { /* invalid compose sequence */ XBell(event->display, BellVolume); } thai_part->comp_state = NORMAL_KEY_STATE; /* reset to normal state */ return symbol; } /* * Interprets two keysyms entered as hex digits and return the Thai keysym * correspond to the TACTIS code formed. * The current implementation of this routine returns ISO Latin Keysyms. */ static KeySym HexIMComposeSequence(KeySym ks1, KeySym ks2) { int hi_digit; int lo_digit; int tactis_code; if ((ks1 >= XK_0) && (ks1 <= XK_9)) hi_digit = ks1 - XK_0; else if ((ks1 >= XK_A) && (ks1 <= XK_F)) hi_digit = ks1 - XK_A + 10; else if ((ks1 >= XK_a) && (ks1 <= XK_f)) hi_digit = ks1 - XK_a + 10; else /* out of range */ return NoSymbol; if ((ks2 >= XK_0) && (ks2 <= XK_9)) lo_digit = ks2 - XK_0; else if ((ks2 >= XK_A) && (ks2 <= XK_F)) lo_digit = ks2 - XK_A + 10; else if ((ks2 >= XK_a) && (ks2 <= XK_f)) lo_digit = ks2 - XK_a + 10; else /* out of range */ return NoSymbol; tactis_code = hi_digit * 0x10 + lo_digit ; return (KeySym)tactis_code; } /* * routine determines * 1) whether key event should cancel a compose sequence * 2) whether cancelling key event should be processed or ignored */ static int IsCancelComposeKey( KeySym *symbol, XKeyEvent *event) { if (*symbol==XK_Delete && !IsControl(event->state) && !IsMod1(event->state)) { *symbol=NoSymbol; /* cancel compose sequence, and ignore key */ return True; } if (IsComposeKey(*symbol, event)) return False; return ( IsControl (event->state) || IsMod1(event->state) || IsKeypadKey (*symbol) || IsFunctionKey (*symbol) || IsMiscFunctionKey (*symbol) || #ifdef DXK_PRIVATE /* DEC private keysyms */ *symbol == DXK_Remove || #endif IsPFKey (*symbol) || IsCursorKey (*symbol) || (*symbol >= XK_Tab && *symbol < XK_Multi_key) ? True : False); /* cancel compose sequence and pass */ /* cancelling key through */ } /* * set specified keyboard LED on or off */ static void SetLed( Display *dpy, int num, int state) { XKeyboardControl led_control; led_control.led_mode = state; led_control.led = num; XChangeKeyboardControl (dpy, KBLed | KBLedMode, &led_control); } #endif /* * Initialize ISC mode from im modifier */ static void InitIscMode(Xic ic) { Xim im; char *im_modifier_name; /* If already defined, just return */ if (IC_IscMode(ic)) return; /* Get IM modifier */ im = (Xim) XIMOfIC((XIC)ic); im_modifier_name = im->core.im_name; /* Match with predefined value, default is Basic Check */ if (!strncmp(im_modifier_name,"BasicCheck",MAXTHAIIMMODLEN+1)) IC_IscMode(ic) = WTT_ISC1; else if (!strncmp(im_modifier_name,"Strict",MAXTHAIIMMODLEN+1)) IC_IscMode(ic) = WTT_ISC2; else if (!strncmp(im_modifier_name,"Thaicat",MAXTHAIIMMODLEN+1)) IC_IscMode(ic) = THAICAT_ISC; else if (!strncmp(im_modifier_name,"Passthrough",MAXTHAIIMMODLEN+1)) IC_IscMode(ic) = NOISC; else IC_IscMode(ic) = WTT_ISC1; return; } /* * Helper functions for _XimThaiFilter() */ static Bool ThaiFltAcceptInput(Xic ic, unsigned char new_char, KeySym symbol) { DefTreeBase *b = &ic->private.local.base; b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char); b->wc[b->tree[ic->private.local.composed].wc+1] = '\0'; if ((new_char <= 0x1f) || (new_char == 0x7f)) b->tree[ic->private.local.composed].keysym = symbol; else b->tree[ic->private.local.composed].keysym = NoSymbol; return True; } static Bool ThaiFltReorderInput(Xic ic, unsigned char previous_char, unsigned char new_char) { DefTreeBase *b = &ic->private.local.base; if (!IC_DeletePreviousChar(ic)) return False; b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char); b->wc[b->tree[ic->private.local.composed].wc+1] = tis2ucs(previous_char); b->wc[b->tree[ic->private.local.composed].wc+2] = '\0'; b->tree[ic->private.local.composed].keysym = NoSymbol; return True; } static Bool ThaiFltReplaceInput(Xic ic, unsigned char new_char, KeySym symbol) { DefTreeBase *b = &ic->private.local.base; if (!IC_DeletePreviousChar(ic)) return False; b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char); b->wc[b->tree[ic->private.local.composed].wc+1] = '\0'; if ((new_char <= 0x1f) || (new_char == 0x7f)) b->tree[ic->private.local.composed].keysym = symbol; else b->tree[ic->private.local.composed].keysym = NoSymbol; return True; } static unsigned NumLockMask(Display *d) { int i; XModifierKeymap *map; KeyCode numlock_keycode = XKeysymToKeycode (d, XK_Num_Lock); if (numlock_keycode == NoSymbol) return 0; map = XGetModifierMapping (d); if (!map) return 0; for (i = 0; i < 8; i++) { if (map->modifiermap[map->max_keypermod * i] == numlock_keycode) { XFreeModifiermap(map); return 1 << i; } } XFreeModifiermap(map); return 0; } /* * Filter function for TACTIS */ Bool _XimThaiFilter(Display *d, Window w, XEvent *ev, XPointer client_data) { Xic ic = (Xic)client_data; KeySym symbol; int isc_mode; /* Thai Input Sequence Check mode */ unsigned char previous_char; /* Last inputted Thai char */ unsigned char new_char; #ifdef UNUSED unsigned int modifiers; KeySym lsym,usym; int state; XicThaiPart *thai_part; char buf[10]; #endif wchar_t wbuf[10]; Bool isReject; DefTreeBase *b = &ic->private.local.base; if ((ev->type != KeyPress) || (ev->xkey.keycode == 0)) return False; if (!IC_IscMode(ic)) InitIscMode(ic); XwcLookupString((XIC)ic, &ev->xkey, wbuf, sizeof(wbuf) / sizeof(wbuf[0]), &symbol, NULL); if ((ev->xkey.state & (AllMods & ~(ShiftMask|LockMask|NumLockMask(d)))) || ((symbol >> 8 == 0xFF) && ((XK_BackSpace <= symbol && symbol <= XK_Clear) || (symbol == XK_Return) || (symbol == XK_Pause) || (symbol == XK_Scroll_Lock) || (symbol == XK_Sys_Req) || (symbol == XK_Escape) || (symbol == XK_Delete) || IsCursorKey(symbol) || IsKeypadKey(symbol) || IsMiscFunctionKey(symbol) || IsFunctionKey(symbol)))) { IC_ClearPreviousChar(ic); return False; } if (((symbol >> 8 == 0xFF) && IsModifierKey(symbol)) || #ifdef XK_XKB_KEYS ((symbol >> 8 == 0xFE) && (XK_ISO_Lock <= symbol && symbol <= XK_ISO_Last_Group_Lock)) || #endif (symbol == NoSymbol)) { return False; } #ifdef UNUSED if (! XThaiTranslateKey(ev->xkey.display, ev->xkey.keycode, ev->xkey.state, &modifiers, &symbol, &lsym, &usym)) return False; /* * Hex input method processing */ thai_part = &ic->private.local.thai; state = thai_part->comp_state; if (state >= 0 && state < nstate_handlers) /* call handler for state */ { symbol = (* state_handler[state])(thai_part, symbol, (XKeyEvent *)ev); } /* * Translate KeySym into mb. */ count = XThaiTranslateKeySym(ev->xkey.display, symbol, lsym, usym, ev->xkey.state, buf, 10); if (!symbol && !count) return True; /* Return symbol if cannot convert to character */ if (!count) return False; #endif /* * Thai Input sequence check */ isc_mode = IC_IscMode(ic); if (!(previous_char = IC_GetPreviousChar(ic))) previous_char = ' '; new_char = ucs2tis(wbuf[0]); isReject = True; if (THAI_isaccepted(new_char, previous_char, isc_mode)) { ThaiFltAcceptInput(ic, new_char, symbol); isReject = False; } else { unsigned char context_char; context_char = IC_GetContextChar(ic); if (context_char) { if (THAI_iscomposible(new_char, context_char)) { if (THAI_iscomposible(previous_char, new_char)) { isReject = !ThaiFltReorderInput(ic, previous_char, new_char); } else if (THAI_iscomposible(previous_char, context_char)) { isReject = !ThaiFltReplaceInput(ic, new_char, symbol); } else if (THAI_chtype(previous_char) == FV1 && THAI_chtype(new_char) == TONE) { isReject = !ThaiFltReorderInput(ic, previous_char, new_char); } } else if (THAI_isaccepted(new_char, context_char, isc_mode)) { isReject = !ThaiFltReplaceInput(ic, new_char, symbol); } } } if (isReject) { /* reject character */ XBell(ev->xkey.display, BellVolume); return True; } _Xlcwcstombs(ic->core.im->core.lcd, &b->mb[b->tree[ic->private.local.composed].mb], &b->wc[b->tree[ic->private.local.composed].wc], 10); _Xlcmbstoutf8(ic->core.im->core.lcd, &b->utf8[b->tree[ic->private.local.composed].utf8], &b->mb[b->tree[ic->private.local.composed].mb], 10); /* Remember the last character inputted * (as fallback in case StringConversionCallback is not provided) */ IC_SavePreviousChar(ic, new_char); ev->xkey.keycode = 0; XPutBackEvent(d, ev); return True; } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imThaiIc.c0000644000000000000000000001440113614532331017101 0ustar /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1993 by Digital Equipment Corporation Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED and Digital Equipment Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED and Digital Equipment Corporation makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp Modifier: Franky Ling Digital Equipment Corporation frankyling@hgrd01.enet.dec.com ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" static void _XimThaiUnSetFocus( XIC xic) { Xic ic = (Xic)xic; ((Xim)ic->core.im)->private.local.current_ic = (XIC)NULL; if (ic->core.focus_window) _XUnregisterFilter(ic->core.im->core.display, ic->core.focus_window, _XimThaiFilter, (XPointer)ic); return; } static void _XimThaiDestroyIC( XIC xic) { Xic ic = (Xic)xic; DefTreeBase *b = &ic->private.local.base; if(((Xim)ic->core.im)->private.local.current_ic == (XIC)ic) { _XimThaiUnSetFocus(xic); } Xfree(ic->private.local.ic_resources); ic->private.local.ic_resources = NULL; Xfree (b->tree); b->tree = NULL; Xfree (b->mb); b->mb = NULL; Xfree (b->wc); b->wc = NULL; Xfree (b->utf8); b->utf8 = NULL; return; } static void _XimThaiSetFocus( XIC xic) { Xic ic = (Xic)xic; XIC current_ic = ((Xim)ic->core.im)->private.local.current_ic; if (current_ic == (XIC)ic) return; if (current_ic != (XIC)NULL) { _XimThaiUnSetFocus(current_ic); } ((Xim)ic->core.im)->private.local.current_ic = (XIC)ic; if (ic->core.focus_window) _XRegisterFilterByType(ic->core.im->core.display, ic->core.focus_window, KeyPress, KeyPress, _XimThaiFilter, (XPointer)ic); return; } static void _XimThaiReset( XIC xic) { Xic ic = (Xic)xic; DefTreeBase *b = &ic->private.local.base; ic->private.local.thai.comp_state = 0; ic->private.local.thai.keysym = 0; b->mb[b->tree[ic->private.local.composed].mb] = '\0'; b->wc[b->tree[ic->private.local.composed].wc] = '\0'; b->utf8[b->tree[ic->private.local.composed].utf8] = '\0'; } static char * _XimThaiMbReset( XIC xic) { _XimThaiReset(xic); return (char *)NULL; } static wchar_t * _XimThaiWcReset( XIC xic) { _XimThaiReset(xic); return (wchar_t *)NULL; } static XICMethodsRec Thai_ic_methods = { _XimThaiDestroyIC, /* destroy */ _XimThaiSetFocus, /* set_focus */ _XimThaiUnSetFocus, /* unset_focus */ _XimLocalSetICValues, /* set_values */ _XimLocalGetICValues, /* get_values */ _XimThaiMbReset, /* mb_reset */ _XimThaiWcReset, /* wc_reset */ _XimThaiMbReset, /* utf8_reset */ _XimLocalMbLookupString, /* mb_lookup_string */ _XimLocalWcLookupString, /* wc_lookup_string */ _XimLocalUtf8LookupString /* utf8_lookup_string */ }; XIC _XimThaiCreateIC( XIM im, XIMArg *values) { Xic ic; XimDefICValues ic_values; XIMResourceList res; unsigned int num; int len; DefTree *tree; if((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL) { return ((XIC)NULL); } ic->methods = &Thai_ic_methods; ic->core.im = im; ic->core.filter_events = KeyPressMask; if (! (ic->private.local.base.tree = tree = Xmalloc(sizeof(DefTree)*3)) ) goto Set_Error; if (! (ic->private.local.base.mb = Xmalloc(21)) ) goto Set_Error; if (! (ic->private.local.base.wc = Xmalloc(sizeof(wchar_t)*21)) ) goto Set_Error; if (! (ic->private.local.base.utf8 = Xmalloc(21)) ) goto Set_Error; ic->private.local.context = 1; tree[1].mb = 1; tree[1].wc = 1; tree[1].utf8 = 1; ic->private.local.composed = 2; tree[2].mb = 11; tree[2].wc = 11; tree[2].utf8 = 11; ic->private.local.thai.comp_state = 0; ic->private.local.thai.keysym = 0; ic->private.local.thai.input_mode = 0; num = im->core.ic_num_resources; len = sizeof(XIMResource) * num; if((res = Xmalloc(len)) == (XIMResourceList)NULL) { goto Set_Error; } (void)memcpy((char *)res, (char *)im->core.ic_resources, len); ic->private.local.ic_resources = res; ic->private.local.ic_num_resources = num; bzero((char *)&ic_values, sizeof(XimDefICValues)); if(_XimCheckLocalInputStyle(ic, (XPointer)&ic_values, values, im->core.styles, res, num) == False) { goto Set_Error; } _XimSetICMode(res, num, ic_values.input_style); if(_XimSetICValueData(ic, (XPointer)&ic_values, ic->private.local.ic_resources, ic->private.local.ic_num_resources, values, XIM_CREATEIC, True)) { goto Set_Error; } if(_XimSetICDefaults(ic, (XPointer)&ic_values, XIM_SETICDEFAULTS, res, num) == False) { goto Set_Error; } ic_values.filter_events = KeyPressMask; _XimSetCurrentICValues(ic, &ic_values); return ((XIC)ic); Set_Error : if (ic->private.local.ic_resources) { Xfree(ic->private.local.ic_resources); } Xfree(ic); return((XIC)NULL); } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imThaiIm.c0000644000000000000000000001554113614532331017121 0ustar /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1993 by Digital Equipment Corporation Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED and Digital Equipment Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED and Digital Equipment Corporation makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp Modifier: Franky Ling Digital Equipment Corporation frankyling@hgrd01.enet.dec.com ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "Xlibint.h" #include "Xlcint.h" #include "XlcPublic.h" #include "XlcPubI.h" #include "Ximint.h" static XIMMethodsRec Xim_im_thai_methods = { _XimThaiCloseIM, /* close */ _XimLocalSetIMValues, /* set_values */ _XimLocalGetIMValues, /* get_values */ _XimThaiCreateIC, /* create_ic */ _XimLcctstombs, /* ctstombs */ _XimLcctstowcs, /* ctstowcs */ _XimLcctstoutf8 /* ctstoutf8 */ }; #define THAI_LANGUAGE_NAME "th" Bool _XimCheckIfThaiProcessing(Xim im) { char *language; _XGetLCValues(im->core.lcd, XlcNLanguage, &language, NULL); if(strcmp(language, THAI_LANGUAGE_NAME) == 0 && (strcmp(im->core.im_name, "") == 0 || strcmp(im->core.im_name, "BasicCheck") == 0 || strcmp(im->core.im_name, "Strict") == 0 || strcmp(im->core.im_name, "Thaicat") == 0 || strcmp(im->core.im_name, "Passthrough") == 0)) { return(True); } return(False); } Bool _XimThaiOpenIM(Xim im) { XLCd lcd = im->core.lcd; XlcConv conv; XimDefIMValues im_values; XimLocalPrivateRec* private = &im->private.local; _XimInitialResourceInfo(); if(_XimSetIMResourceList(&im->core.im_resources, &im->core.im_num_resources) == False) { goto Open_Error; } if(_XimSetICResourceList(&im->core.ic_resources, &im->core.ic_num_resources) == False) { goto Open_Error; } _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); _XimGetCurrentIMValues(im, &im_values); if(_XimSetLocalIMDefaults(im, (XPointer)&im_values, im->core.im_resources, im->core.im_num_resources) == False) { goto Open_Error; } _XimSetCurrentIMValues(im, &im_values); if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte))) goto Open_Error; private->ctom_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar))) goto Open_Error; private->ctow_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNUtf8String))) goto Open_Error; private->ctoutf8_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte))) goto Open_Error; private->cstomb_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNWideChar))) goto Open_Error; private->cstowc_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String))) goto Open_Error; private->cstoutf8_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) goto Open_Error; private->ucstoc_conv = conv; if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) goto Open_Error; private->ucstoutf8_conv = conv; im->methods = &Xim_im_thai_methods; private->current_ic = (XIC)NULL; return(True); Open_Error : _XimThaiIMFree(im); return(False); } void _XimThaiIMFree(Xim im) { if(im->core.im_resources) { Xfree(im->core.im_resources); im->core.im_resources = NULL; } if(im->core.ic_resources) { Xfree(im->core.ic_resources); im->core.ic_resources = NULL; } if(im->core.im_values_list) { Xfree(im->core.im_values_list); im->core.im_values_list = NULL; } if(im->core.ic_values_list) { Xfree(im->core.ic_values_list); im->core.ic_values_list = NULL; } if(im->core.styles) { Xfree(im->core.styles); im->core.styles = NULL; } if(im->core.res_name) { Xfree(im->core.res_name); im->core.res_name = NULL; } if(im->core.res_class) { Xfree(im->core.res_class); im->core.res_class = NULL; } if(im->core.im_name) { Xfree(im->core.im_name); im->core.im_name = NULL; } if (im->private.local.ctom_conv) { _XlcCloseConverter(im->private.local.ctom_conv); im->private.local.ctom_conv = NULL; } if (im->private.local.ctow_conv) { _XlcCloseConverter(im->private.local.ctow_conv); im->private.local.ctow_conv = NULL; } if (im->private.local.ctoutf8_conv) { _XlcCloseConverter(im->private.local.ctoutf8_conv); im->private.local.ctoutf8_conv = NULL; } if (im->private.local.cstomb_conv) { _XlcCloseConverter(im->private.local.cstomb_conv); im->private.local.cstomb_conv = NULL; } if (im->private.local.cstowc_conv) { _XlcCloseConverter(im->private.local.cstowc_conv); im->private.local.cstowc_conv = NULL; } if (im->private.local.cstoutf8_conv) { _XlcCloseConverter(im->private.local.cstoutf8_conv); im->private.local.cstoutf8_conv = NULL; } if (im->private.local.ucstoc_conv) { _XlcCloseConverter(im->private.local.ucstoc_conv); im->private.local.ucstoc_conv = NULL; } if (im->private.local.ucstoutf8_conv) { _XlcCloseConverter(im->private.local.ucstoutf8_conv); im->private.local.ucstoutf8_conv = NULL; } return; } Status _XimThaiCloseIM(XIM xim) { Xim im = (Xim)xim; XIC ic; XIC next; ic = im->core.ic_chain; im->core.ic_chain = NULL; while (ic) { (*ic->methods->destroy) (ic); next = ic->core.next; Xfree (ic); ic = next; } _XimThaiIMFree(im); return(True); } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imTrans.c0000644000000000000000000002021413614532331017026 0ustar /* * Copyright 1992 Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "Xlibint.h" #include #include "Xlcint.h" #include "Ximint.h" #include "XimTrans.h" #include "XimTrInt.h" #ifdef WIN32 #include #endif #ifndef XIM_CONNECTION_RETRIES #define XIM_CONNECTION_RETRIES 5 #endif static Bool _XimTransConnect( Xim im) { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; int connect_stat, retry; Window window; for (retry = XIM_CONNECTION_RETRIES; retry >= 0; retry--) { if ((spec->trans_conn = _XimXTransOpenCOTSClient ( spec->address)) == NULL) { break; } if ((connect_stat = _XimXTransConnect ( spec->trans_conn, spec->address)) < 0) { _XimXTransClose (spec->trans_conn); spec->trans_conn = NULL; if (connect_stat == TRANS_TRY_CONNECT_AGAIN) continue; else break; } else break; } if (spec->trans_conn == NULL) return False; spec->fd = _XimXTransGetConnectionNumber (spec->trans_conn); if (!(window = XCreateSimpleWindow(im->core.display, DefaultRootWindow(im->core.display), 0, 0, 1, 1, 1, 0, 0))) return False; spec->window = window; _XRegisterFilterByType(im->core.display, window, KeyPress, KeyPress, _XimTransFilterWaitEvent, (XPointer)im); return _XRegisterInternalConnection(im->core.display, spec->fd, (_XInternalConnectionProc)_XimTransInternalConnection, (XPointer)im); } static Bool _XimTransShutdown( Xim im) { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; _XimXTransDisconnect(spec->trans_conn); (void)_XimXTransClose(spec->trans_conn); _XimFreeTransIntrCallback(im); _XUnregisterInternalConnection(im->core.display, spec->fd); _XUnregisterFilter(im->core.display, spec->window, _XimTransFilterWaitEvent, (XPointer)im); XDestroyWindow(im->core.display, spec->window); Xfree(spec->address); Xfree(spec); return True; } Bool _XimTransRegisterDispatcher( Xim im, Bool (*callback)( Xim, INT16, XPointer, XPointer ), XPointer call_data) { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; TransIntrCallbackPtr rec; if (!(rec = Xmalloc(sizeof(TransIntrCallbackRec)))) return False; rec->func = callback; rec->call_data = call_data; rec->next = spec->intr_cb; spec->intr_cb = rec; return True; } void _XimFreeTransIntrCallback( Xim im) { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; register TransIntrCallbackPtr rec, next; for (rec = spec->intr_cb; rec;) { next = rec->next; Xfree(rec); rec = next; } return; } Bool _XimTransCallDispatcher(Xim im, INT16 len, XPointer data) { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; TransIntrCallbackRec *rec; for (rec = spec->intr_cb; rec; rec = rec->next) { if ((*rec->func)(im, len, data, rec->call_data)) return True; } return False; } Bool _XimTransFilterWaitEvent( Display *d, Window w, XEvent *ev, XPointer arg) { Xim im = (Xim)arg; TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; spec->is_putback = False; return _XimFilterWaitEvent(im); } void _XimTransInternalConnection( Display *d, int fd, XPointer arg) { Xim im = (Xim)arg; XEvent ev; XKeyEvent *kev; TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; if (spec->is_putback) return; bzero(&ev, sizeof(ev)); /* FIXME: other fields may be accessed, too. */ kev = (XKeyEvent *)&ev; kev->type = KeyPress; kev->send_event = False; kev->display = im->core.display; kev->window = spec->window; kev->keycode = 0; kev->time = 0L; kev->serial = LastKnownRequestProcessed(im->core.display); #if 0 fprintf(stderr,"%s,%d: putback FIXED kev->time=0 kev->serial=%lu\n", __FILE__, __LINE__, kev->serial); #endif XPutBackEvent(im->core.display, &ev); XFlush(im->core.display); spec->is_putback = True; return; } Bool _XimTransWrite(Xim im, INT16 len, XPointer data) { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; char *buf = (char *)data; register int nbyte; while (len > 0) { if ((nbyte = _XimXTransWrite(spec->trans_conn, buf, len)) <= 0) return False; len -= nbyte; buf += nbyte; } return True; } Bool _XimTransRead( Xim im, XPointer recv_buf, int buf_len, int *ret_len) { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; int len; if (buf_len == 0) { *ret_len = 0; return True; } if ((len = _XimXTransRead(spec->trans_conn, recv_buf, buf_len)) <= 0) return False; *ret_len = len; return True; } void _XimTransFlush( Xim im) { return; } Bool _XimTransConf( Xim im, char *address) { char *paddr; TransSpecRec *spec; if (!(paddr = strdup(address))) return False; if (!(spec = Xcalloc(1, sizeof(TransSpecRec)))) { Xfree(paddr); return False; } spec->address = paddr; im->private.proto.spec = (XPointer)spec; im->private.proto.connect = _XimTransConnect; im->private.proto.shutdown = _XimTransShutdown; im->private.proto.write = _XimTransWrite; im->private.proto.read = _XimTransRead; im->private.proto.flush = _XimTransFlush; im->private.proto.register_dispatcher = _XimTransRegisterDispatcher; im->private.proto.call_dispatcher = _XimTransCallDispatcher; return True; } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imTransR.c0000644000000000000000000001770713614532331017165 0ustar /* * Copyright 1992 Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" #include "XimTrInt.h" #include "Ximint.h" TransportSW _XimTransportRec[] = { { "X", _XimXConf }, /* 1st entry must be X. This will be a fallback */ #ifdef TCPCONN { "tcp", _XimTransConf }, /* use X transport lib */ #endif /* TCPCONN */ #if defined(UNIXCONN) || defined(LOCALCONN) { "local", _XimTransConf }, /* use X transport lib */ #endif /* UNIXCONN */ { (char *)NULL, (Bool (*)(Xim, char *))NULL }, }; Bool _XimConnect(Xim im) { return im->private.proto.connect(im); } Bool _XimShutdown(Xim im) { return im->private.proto.shutdown(im); } Bool _XimWrite(Xim im, INT16 len, XPointer data) { return im->private.proto.write(im, len, data); } static int _CheckProtocolData( Xim im, char *recv_buf) { int data_len; data_len = (int)(((*((CARD16 *)recv_buf + 1)) * 4) + XIM_HEADER_SIZE); return data_len; } static int _XimReadData( Xim im, INT16 *len, XPointer buf, int buf_size) { char *hold_buf; char *tmp; int data_len; int packet_size; int ret_len; register int i; if (buf_size < XIM_HEADER_SIZE) { *len = (INT16)XIM_HEADER_SIZE; return XIM_OVERFLOW; } bzero(buf, buf_size); packet_size = 0; data_len = 0; if ((hold_buf = im->private.proto.hold_data)) { data_len = im->private.proto.hold_data_len; if (data_len >= XIM_HEADER_SIZE) { packet_size = _CheckProtocolData(im, hold_buf); if (packet_size > buf_size) { *len = (INT16)packet_size; return XIM_OVERFLOW; } if (packet_size <= data_len) { memcpy(buf, hold_buf, packet_size); for (i = packet_size; i < data_len; i++) { if (hold_buf[i]) break; } data_len -= i; if (data_len) { if (!(tmp = Xmalloc(data_len))) { return XIM_FALSE; } memcpy(tmp, &hold_buf[i], data_len); im->private.proto.hold_data = tmp; im->private.proto.hold_data_len = data_len; } else { im->private.proto.hold_data = 0; im->private.proto.hold_data_len = 0; } Xfree(hold_buf); *len = (INT16)packet_size; return XIM_TRUE; } } memcpy(buf, hold_buf, data_len); buf_size -= data_len; Xfree(hold_buf); im->private.proto.hold_data = 0; im->private.proto.hold_data_len = 0; } if (!packet_size) { while (data_len < XIM_HEADER_SIZE) { if (!(im->private.proto.read(im, (XPointer)&buf[data_len], buf_size, &ret_len))) { return XIM_FALSE; } data_len += ret_len; buf_size -= ret_len; } packet_size = _CheckProtocolData(im, buf); } if (packet_size > buf_size) { if (!(tmp = Xmalloc(data_len))) { return XIM_FALSE; } memcpy(tmp, buf, data_len); bzero(buf, data_len); im->private.proto.hold_data = tmp; im->private.proto.hold_data_len = data_len; *len = (INT16)packet_size; return XIM_OVERFLOW; } while (data_len < packet_size) { if (!(im->private.proto.read(im, (XPointer)&buf[data_len], buf_size, &ret_len))) { return XIM_FALSE; } data_len += ret_len; buf_size -= ret_len; } for (i = packet_size; i < data_len; i++) { if (buf[i]) break; } data_len -= i; if (data_len) { if (!(tmp = Xmalloc(data_len))) { return XIM_FALSE; } memcpy(tmp, &buf[i], data_len); bzero(&buf[i], data_len); im->private.proto.hold_data = tmp; im->private.proto.hold_data_len = data_len; } else { im->private.proto.hold_data = 0; im->private.proto.hold_data_len = 0; } *len = (INT16)packet_size; return XIM_TRUE; } static Bool _XimCallDispatcher( Xim im, INT16 len, XPointer data) { return im->private.proto.call_dispatcher(im, len, data); } int _XimRead(Xim im, INT16 *len, XPointer buf, int buf_size, Bool (*predicate)(Xim, INT16, XPointer, XPointer), XPointer arg) { INT16 read_len; int ret_code; for (;;) { ret_code = _XimReadData(im, &read_len, buf, buf_size); if(ret_code != XIM_TRUE) { return ret_code; } if ((*predicate)(im, read_len, buf, arg)) break; if (_XimCallDispatcher(im, read_len, buf)) continue; _XimError(im, 0, XIM_BadProtocol, (INT16)0, (CARD16)0, (char *)NULL); } *len = read_len; return True; } Bool _XimRegisterDispatcher( Xim im, Bool (*callback)( Xim, INT16, XPointer, XPointer ), XPointer call_data) { return im->private.proto.register_dispatcher(im, callback, call_data); } void _XimFlush(Xim im) { im->private.proto.flush(im); return; } Bool _XimFilterWaitEvent(Xim im) { INT16 read_len; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int buf_size; int ret_code; buf_size = BUFSIZE; ret_code = _XimReadData(im, &read_len, (XPointer)reply, buf_size); if(ret_code == XIM_TRUE) { preply = reply; } else if(ret_code == XIM_OVERFLOW) { if(read_len <= 0) { preply = reply; } else { buf_size = (int)read_len; preply = Xmalloc(buf_size); ret_code = _XimReadData(im, &read_len, preply, buf_size); if(ret_code != XIM_TRUE) { if (preply != reply) Xfree(preply); return False; } } } else { return False; } if (_XimCallDispatcher(im, read_len, preply)) { if(reply != preply) Xfree(preply); return True; } _XimError(im, 0, XIM_BadProtocol, (INT16)0, (CARD16)0, (char *)NULL); if(reply != preply) Xfree(preply); return True; } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/imTrX.c0000644000000000000000000003675613614532331016476 0ustar /* * Copyright 1992 Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" #include "XimTrInt.h" #include "XimTrX.h" static Bool _XimXRegisterDispatcher( Xim im, Bool (*callback)( Xim, INT16, XPointer, XPointer ), XPointer call_data) { XIntrCallbackPtr rec; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; if (!(rec = Xmalloc(sizeof(XIntrCallbackRec)))) return False; rec->func = callback; rec->call_data = call_data; rec->next = spec->intr_cb; spec->intr_cb = rec; return True; } static void _XimXFreeIntrCallback( Xim im) { XSpecRec *spec = (XSpecRec *)im->private.proto.spec; register XIntrCallbackPtr rec, next; for (rec = spec->intr_cb; rec;) { next = rec->next; Xfree(rec); rec = next; } return; } static Bool _XimXCallDispatcher(Xim im, INT16 len, XPointer data) { register XIntrCallbackRec *rec; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; for (rec = spec->intr_cb; rec; rec = rec->next) { if ((*rec->func)(im, len, data, rec->call_data)) return True; } return False; } static Bool _XimXFilterWaitEvent( Display *d, Window w, XEvent *ev, XPointer arg) { Xim im = (Xim)arg; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; Bool ret; spec->ev = (XPointer)ev; ret = _XimFilterWaitEvent(im); /* * If ev is a pointer to a stack variable, there could be * a coredump later on if the pointer is dereferenced. * Therefore, reset to NULL to force reinitialization in * _XimXRead(). * * Keep in mind _XimXRead may be called again when the stack * is very different. */ spec->ev = (XPointer)NULL; return ret; } static Bool _CheckConnect( Display *display, XEvent *event, XPointer xim) { Xim im = (Xim)xim; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; if ((event->type == ClientMessage) && (event->xclient.message_type == spec->imconnectid)) { return True; } return False; } static Bool _XimXConnect(Xim im) { XEvent event; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; CARD32 major_code; CARD32 minor_code; if (!(spec->lib_connect_wid = XCreateSimpleWindow(im->core.display, DefaultRootWindow(im->core.display), 0, 0, 1, 1, 1, 0, 0))) { return False; } event.xclient.type = ClientMessage; event.xclient.display = im->core.display; event.xclient.window = im->private.proto.im_window; event.xclient.message_type = spec->imconnectid; event.xclient.format = 32; event.xclient.data.l[0] = (CARD32)spec->lib_connect_wid; event.xclient.data.l[1] = spec->major_code; event.xclient.data.l[2] = spec->minor_code; event.xclient.data.l[3] = 0; event.xclient.data.l[4] = 0; if(event.xclient.data.l[1] == 1 || event.xclient.data.l[1] == 2) { XWindowAttributes atr; long event_mask; XGetWindowAttributes(im->core.display, spec->lib_connect_wid, &atr); event_mask = atr.your_event_mask | PropertyChangeMask; XSelectInput(im->core.display, spec->lib_connect_wid, event_mask); _XRegisterFilterByType(im->core.display, spec->lib_connect_wid, PropertyNotify, PropertyNotify, _XimXFilterWaitEvent, (XPointer)im); } XSendEvent(im->core.display, im->private.proto.im_window, False, NoEventMask, &event); XFlush(im->core.display); for (;;) { XIfEvent(im->core.display, &event, _CheckConnect, (XPointer)im); if (event.xclient.type != ClientMessage) { return False; } if (event.xclient.message_type == spec->imconnectid) break; } spec->ims_connect_wid = (Window)event.xclient.data.l[0]; major_code = (CARD32)event.xclient.data.l[1]; minor_code = (CARD32)event.xclient.data.l[2]; if (((major_code == 0) && (minor_code <= 2)) || ((major_code == 1) && (minor_code == 0)) || ((major_code == 2) && (minor_code <= 1))) { spec->major_code = major_code; spec->minor_code = minor_code; } if (((major_code == 0) && (minor_code == 2)) || ((major_code == 2) && (minor_code == 1))) { spec->BoundarySize = (CARD32)event.xclient.data.l[3]; } /* ClientMessage Event Filter */ _XRegisterFilterByType(im->core.display, spec->lib_connect_wid, ClientMessage, ClientMessage, _XimXFilterWaitEvent, (XPointer)im); return True; } static Bool _XimXShutdown(Xim im) { XSpecRec *spec = (XSpecRec *)im->private.proto.spec; if (!spec) return True; /* ClientMessage Event Filter */ _XUnregisterFilter(im->core.display, ((XSpecRec *)im->private.proto.spec)->lib_connect_wid, _XimXFilterWaitEvent, (XPointer)im); XDestroyWindow(im->core.display, ((XSpecRec *)im->private.proto.spec)->lib_connect_wid); _XimXFreeIntrCallback(im); Xfree(spec); im->private.proto.spec = 0; return True; } static char * _NewAtom( char *atomName) { static int sequence = 0; (void)sprintf(atomName, "_client%d", sequence); sequence = ((sequence < 20) ? sequence + 1 : 0); return atomName; } static Bool _XimXWrite(Xim im, INT16 len, XPointer data) { Atom atom; char atomName[16]; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; XEvent event; CARD8 *p; CARD32 major_code = spec->major_code; CARD32 minor_code = spec->minor_code; int BoundSize; bzero(&event,sizeof(XEvent)); event.xclient.type = ClientMessage; event.xclient.display = im->core.display; event.xclient.window = spec->ims_connect_wid; if(major_code == 1 && minor_code == 0) { BoundSize = 0; } else if((major_code == 0 && minor_code == 2) || (major_code == 2 && minor_code == 1)) { BoundSize = spec->BoundarySize; } else if(major_code == 0 && minor_code == 1) { BoundSize = len; } else { BoundSize = XIM_CM_DATA_SIZE; } if (len > BoundSize) { event.xclient.message_type = spec->improtocolid; atom = XInternAtom(im->core.display, _NewAtom(atomName), False); XChangeProperty(im->core.display, spec->ims_connect_wid, atom, XA_STRING, 8, PropModeAppend, (unsigned char *)data, len); if(major_code == 0) { event.xclient.format = 32; event.xclient.data.l[0] = (long)len; event.xclient.data.l[1] = (long)atom; XSendEvent(im->core.display, spec->ims_connect_wid, False, NoEventMask, &event); } } else { int length; event.xclient.format = 8; for(length = 0 ; length < len ; length += XIM_CM_DATA_SIZE) { p = (CARD8 *)&event.xclient.data.b[0]; if((length + XIM_CM_DATA_SIZE) >= len) { event.xclient.message_type = spec->improtocolid; bzero(p, XIM_CM_DATA_SIZE); memcpy((char *)p, (data + length), (len - length)); } else { event.xclient.message_type = spec->immoredataid; memcpy((char *)p, (data + length), XIM_CM_DATA_SIZE); } XSendEvent(im->core.display, spec->ims_connect_wid, False, NoEventMask, &event); } } return True; } static Bool _XimXGetReadData( Xim im, char *buf, int buf_len, int *ret_len, XEvent *event) { char *data; int len; char tmp_buf[XIM_CM_DATA_SIZE]; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; unsigned long length; Atom prop; int return_code; Atom type_ret; int format_ret; unsigned long nitems; unsigned long bytes_after_ret; unsigned char *prop_ret; if ((event->type == ClientMessage) && !((event->xclient.message_type == spec->improtocolid) || (event->xclient.message_type == spec->immoredataid))) { /* This event has nothing to do with us, * FIXME should not have gotten here then... */ return False; } else if ((event->type == ClientMessage) && (event->xclient.format == 8)) { data = event->xclient.data.b; if (buf_len >= XIM_CM_DATA_SIZE) { (void)memcpy(buf, data, XIM_CM_DATA_SIZE); *ret_len = XIM_CM_DATA_SIZE; } else { (void)memcpy(buf, data, buf_len); len = XIM_CM_DATA_SIZE - buf_len; (void)memcpy(tmp_buf, &data[buf_len], len); bzero(data, XIM_CM_DATA_SIZE); (void)memcpy(data, tmp_buf, len); XPutBackEvent(im->core.display, event); *ret_len = buf_len; } } else if ((event->type == ClientMessage) && (event->xclient.format == 32)) { length = (unsigned long)event->xclient.data.l[0]; prop = (Atom)event->xclient.data.l[1]; return_code = XGetWindowProperty(im->core.display, spec->lib_connect_wid, prop, 0L, (long)((length + 3)/ 4), True, AnyPropertyType, &type_ret, &format_ret, &nitems, &bytes_after_ret, &prop_ret); if (return_code != Success || format_ret == 0 || nitems == 0) { if (return_code == Success) XFree(prop_ret); return False; } if (buf_len >= (int)nitems) { (void)memcpy(buf, prop_ret, (int)nitems); *ret_len = (int)nitems; if (bytes_after_ret > 0) { XFree(prop_ret); if (XGetWindowProperty(im->core.display, spec->lib_connect_wid, prop, 0L, ((length + bytes_after_ret + 3)/ 4), True, AnyPropertyType, &type_ret, &format_ret, &nitems, &bytes_after_ret, &prop_ret) == Success) { XChangeProperty(im->core.display, spec->lib_connect_wid, prop, XA_STRING, 8, PropModePrepend, &prop_ret[length], (nitems - length)); } else { return False; } } } else { (void)memcpy(buf, prop_ret, buf_len); *ret_len = buf_len; len = nitems - buf_len; if (bytes_after_ret > 0) { XFree(prop_ret); if (XGetWindowProperty(im->core.display, spec->lib_connect_wid, prop, 0L, ((length + bytes_after_ret + 3)/ 4), True, AnyPropertyType, &type_ret, &format_ret, &nitems, &bytes_after_ret, &prop_ret) != Success) { return False; } } XChangeProperty(im->core.display, spec->lib_connect_wid, prop, XA_STRING, 8, PropModePrepend, &prop_ret[buf_len], len); event->xclient.data.l[0] = (long)len; event->xclient.data.l[1] = (long)prop; XPutBackEvent(im->core.display, event); } XFree(prop_ret); } else if (event->type == PropertyNotify) { prop = event->xproperty.atom; return_code = XGetWindowProperty(im->core.display, spec->lib_connect_wid, prop, 0L, 1000000L, True, AnyPropertyType, &type_ret, &format_ret, &nitems, &bytes_after_ret, &prop_ret); if (return_code != Success || format_ret == 0 || nitems == 0) { if (return_code == Success) XFree(prop_ret); return False; } if (buf_len >= nitems) { (void)memcpy(buf, prop_ret, (int)nitems); *ret_len = (int)nitems; } else { (void)memcpy(buf, prop_ret, buf_len); *ret_len = buf_len; len = nitems - buf_len; XChangeProperty(im->core.display, spec->lib_connect_wid, prop, XA_STRING, 8, PropModePrepend, &prop_ret[buf_len], len); } XFree(prop_ret); } return True; } static Bool _CheckCMEvent( Display *display, XEvent *event, XPointer xim) { Xim im = (Xim)xim; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; CARD32 major_code = spec->major_code; if ((event->type == ClientMessage) &&((event->xclient.message_type == spec->improtocolid) || (event->xclient.message_type == spec->immoredataid))) return True; if((major_code == 1 || major_code == 2) && (event->type == PropertyNotify) && (event->xproperty.state == PropertyNewValue)) return True; return False; } static Bool _XimXRead(Xim im, XPointer recv_buf, int buf_len, int *ret_len) { XEvent *ev; XEvent event; int len = 0; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; XPointer arg = spec->ev; if (!arg) { bzero(&event, sizeof(XEvent)); ev = &event; XIfEvent(im->core.display, ev, _CheckCMEvent, (XPointer)im); } else { ev = (XEvent *)arg; spec->ev = (XPointer)NULL; } if (!(_XimXGetReadData(im, recv_buf, buf_len, &len, ev))) return False; *ret_len = len; return True; } static void _XimXFlush(Xim im) { XFlush(im->core.display); return; } Bool _XimXConf(Xim im, char *address) { XSpecRec *spec; if (!(spec = Xcalloc(1, sizeof(XSpecRec)))) return False; spec->improtocolid = XInternAtom(im->core.display, _XIM_PROTOCOL, False); spec->imconnectid = XInternAtom(im->core.display, _XIM_XCONNECT, False); spec->immoredataid = XInternAtom(im->core.display, _XIM_MOREDATA, False); spec->major_code = MAJOR_TRANSPORT_VERSION; spec->minor_code = MINOR_TRANSPORT_VERSION; im->private.proto.spec = (XPointer)spec; im->private.proto.connect = _XimXConnect; im->private.proto.shutdown = _XimXShutdown; im->private.proto.write = _XimXWrite; im->private.proto.read = _XimXRead; im->private.proto.flush = _XimXFlush; im->private.proto.register_dispatcher = _XimXRegisterDispatcher; im->private.proto.call_dispatcher = _XimXCallDispatcher; return True; } nx-libs-3.5.99.23/nx-X11/lib/modules/im/ximcp/Makefile.am0000644000000000000000000000200313614532331017275 0ustar NULL = noinst_LTLIBRARIES=libximcp.la AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/include/X11 \ -I$(top_builddir)/include \ -I$(top_builddir)/include/X11 \ -I$(top_srcdir)/src/xcms \ -I$(top_srcdir)/src/xkb \ -I$(top_srcdir)/src/xlibi18n \ -I$(top_srcdir)/src \ -I$(top_srcdir)/../exports/include \ -D_GNU_SOURCE \ -DXIM_t \ -DTRANS_CLIENT \ $(NULL) AM_CFLAGS = \ $(X11_CFLAGS) \ $(BIGFONT_CFLAGS) \ $(MALLOC_ZERO_CFLAGS) \ $(CWARNFLAGS) \ $(NULL) ximcp_la_SOURCES = \ imCallbk.c \ imDefFlt.c \ imDefIc.c \ imDefIm.c \ imDefLkup.c \ imDispch.c \ imEvToWire.c \ imExten.c \ imImSw.c \ imInsClbk.c \ imInt.c \ imLcFlt.c \ imLcGIc.c \ imLcIc.c \ imLcIm.c \ imLcLkup.c \ imLcPrs.c \ imLcSIc.c \ imRmAttr.c \ imRm.c \ imThaiFlt.c \ imThaiIc.c \ imThaiIm.c \ imTrans.c \ imTransR.c \ imTrX.c \ $(NULL) libximcp_la_SOURCES = $(ximcp_la_SOURCES) nx-libs-3.5.99.23/nx-X11/lib/modules/lc/def/lcDefConv.c0000644000000000000000000003757513614532331016705 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ /* * 2000 * Modifier: Ivan Pascal The XFree86 Project */ /* * The default locale loader. * Supports: one byte per char (iso8859 like) locales. * How: converts bytes to wide characters in a 1:1 manner. * Platforms: all systems. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XlcGeneric.h" #ifndef MB_LEN_MAX #define MB_LEN_MAX 6 #endif #if !defined(X_LOCALE) #define STDCVT #endif #define GR 0x80 #define GL 0x7f typedef struct _StateRec *State; typedef struct _StateRec { CodeSet GL_codeset; CodeSet GR_codeset; wchar_t wc_mask; wchar_t wc_encode_mask; Bool (*MBtoWC) (State state, const char *ch, wchar_t *wc); Bool (*WCtoMB) (State state, wchar_t wc, char *ch); } StateRec; static Bool MBtoWCdef( State state, const char *ch, wchar_t *wc) { wchar_t wc_encoding; CodeSet codeset = (*ch & GR) ? state->GR_codeset : state->GL_codeset; if (!codeset) return False; wc_encoding = codeset->wc_encoding; *wc = ((wchar_t) *ch & state->wc_mask) | wc_encoding; return True; } #ifdef STDCVT static Bool MBtoWCstd( State state, const char *ch, wchar_t *wc) { return (mbtowc(wc, ch, 1) == 1); } #endif static Bool WCtoMBdef( State state, wchar_t wc, char *ch) { wchar_t wc_encoding = wc & state->wc_encode_mask; CodeSet codeset; codeset = state->GL_codeset; if (codeset && (wc_encoding == codeset->wc_encoding)) { *ch = wc & state->wc_mask; return True; } codeset = state->GR_codeset; if (codeset && (wc_encoding == codeset->wc_encoding)) { *ch = (wc & state->wc_mask) | GR; return True; } return False; } #ifdef STDCVT static Bool WCtoMBstd( State state, wchar_t wc, char *ch) { return (wctomb(ch, wc) == 1); } #endif static XlcCharSet get_charset( State state, char side) { CodeSet codeset = side ? state->GR_codeset : state->GL_codeset; if (codeset) { int i; XlcCharSet charset; for (i = 0; i < codeset->num_charsets; i++) { charset = codeset->charset_list[i]; if (*charset->ct_sequence != '\0') return charset; } return *(codeset->charset_list); } return (XlcCharSet) NULL; } static int def_mbstowcs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { const char *src; wchar_t *dst = (wchar_t *) *to; State state = (State) conv->state; int unconv = 0; if (from == NULL || *from == NULL) return 0; src = (const char *) *from; while (*from_left && *to_left) { (*from_left)--; if (state->MBtoWC (state, src++, dst)) { dst++; (*to_left)--; } else { unconv++; } } *from = (XPointer) src; *to = (XPointer) dst; return unconv; } static int def_wcstombs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { const wchar_t *src; char *dst = (char *) *to; State state = (State) conv->state; char ch[MB_LEN_MAX]; int unconv = 0; if (from == NULL || *from == NULL) return 0; src = (const wchar_t *) *from; while (*from_left && *to_left) { (*from_left)--; if (state->WCtoMB (state, *src++, ch)) { *dst++ = *ch; (*to_left)--; } else { unconv++; } } *from = (XPointer) src; *to = (XPointer) dst; return unconv; } static int mbstostr( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { const char *src; char *dst = (char *) *to; CodeSet codeset; State state = (State) conv->state; char ch; int unconv = 0; if (from == NULL || *from == NULL) return 0; src = (const char *) *from; while (*from_left && *to_left) { ch = *src++; (*from_left)--; codeset = (ch & GR) ? state->GR_codeset : state->GL_codeset; if (codeset && codeset->string_encoding) { *dst++ = ch; (*to_left)--; } else { unconv++; } } *from = (XPointer) src; *to = (XPointer) dst; return unconv; } static int wcstostr( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { const wchar_t *src; char *dst = (char *) *to; CodeSet codeset; State state = (State) conv->state; char ch[MB_LEN_MAX]; int unconv = 0; if (from == NULL || *from == NULL) return 0; src = (const wchar_t *) *from; while (*from_left && *to_left) { (*from_left)--; if (state->WCtoMB (state, *src++, ch)) { codeset = (*ch & GR) ? state->GR_codeset : state->GL_codeset; if (codeset && codeset->string_encoding) { *dst++ = *ch; (*to_left)--; } else { unconv++; } } else { unconv++; } } *from = (XPointer) src; *to = (XPointer) dst; return unconv; } static int mbstocs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { const char *src; char *dst = (char *) *to; int length; State state = (State) conv->state; char cur_side; int unconv = 0; if (from == NULL || *from == NULL) return 0; src = (const char *) *from; length = min(*from_left, *to_left); cur_side = *src & GR; while (length) { if ((char) (*src & GR) != cur_side) break; *dst++ = *src++; length--; } if (num_args > 0) { XlcCharSet charset = get_charset(state, cur_side); if (charset) { *((XlcCharSet *) args[0]) = charset; } else { dst = *to; unconv = -1; } } *from_left -= src - (char *) *from; *to_left -= dst - (char *) *to; *from = (XPointer) src; *to = (XPointer) dst; return unconv; } static int wcstocs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { const wchar_t *src; char *dst = (char *) *to; State state = (State) conv->state; char cur_side = 0, ch[MB_LEN_MAX]; int unconv = 0; Bool found = False; if (from == NULL || *from == NULL) return 0; src = (const wchar_t *) *from; while (*from_left) { if ((found = state->WCtoMB (state, *src, ch))) break; unconv++; src++; (*from_left)--; } if (found) { cur_side = *ch & GR; while (*from_left && *to_left) { (*from_left)--; if (state->WCtoMB (state, *src++, ch)) { if ((char) (*ch & GR) != cur_side) { src--; (*from_left)++; break; } else { *dst++ = *ch; (*to_left)--; } } else { unconv++; } } } else { unconv++; } if (num_args > 0) { XlcCharSet charset = get_charset(state, cur_side); if (charset) { *((XlcCharSet *) args[0]) = charset; } else { unconv = -1; } } *from = (XPointer) src; *to = (XPointer) dst; return unconv; } static int cstombs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { const char *src; char *dst = (char *) *to; CodeSet codeset; XlcCharSet charset; State state = (State) conv->state; unsigned char cur_side = 0; int i; Bool found = False; if (from == NULL || *from == NULL) return 0; src = (const char *) *from; if (num_args > 0) { charset = (XlcCharSet) args[0]; if (charset == NULL) return -1; } else { return -1; } if ((charset->side == XlcGL) || (charset->side == XlcGLGR)) { codeset = state->GL_codeset; if (codeset) { for (i = 0; i < codeset->num_charsets; i++) if (charset == codeset->charset_list[i]) { found = True; cur_side = 0; break; } } } if (!found && ((charset->side == XlcGR) || (charset->side == XlcGLGR))) { codeset = state->GR_codeset; if (codeset) { for (i = 0; i < codeset->num_charsets; i++) if (charset == codeset->charset_list[i]) { found = True; cur_side = GR; break; } } } if (found) { int length = min(*from_left, *to_left); while (length) { *dst++ = *src++ | cur_side; length--; } } else { return -1; } *from_left -= src - (char *) *from; *to_left -= dst - (char *) *to; *from = (XPointer) src; *to = (XPointer) dst; return 0; } static int cstowcs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { const char *src; wchar_t *dst = (wchar_t *) *to; CodeSet codeset; XlcCharSet charset; State state = (State) conv->state; Bool found = False; int i, unconv = 0; unsigned char cur_side = 0; if (from == NULL || *from == NULL) return 0; src = (const char *) *from; if (num_args > 0) { charset = (XlcCharSet) args[0]; if (charset == NULL) return -1; } else { return -1; } if ((charset->side == XlcGL) || (charset->side == XlcGLGR)) { codeset = state->GL_codeset; if (codeset) { for (i = 0; i < codeset->num_charsets; i++) if (charset == codeset->charset_list[i]) { found = True; cur_side = 0; break; } } } if (!found && ((charset->side == XlcGR) || (charset->side == XlcGLGR))) { codeset = state->GR_codeset; if (codeset) { for (i = 0; i < codeset->num_charsets; i++) if (charset == codeset->charset_list[i]) { found = True; cur_side = GR; break; } } } if (found) { char ch; while (*from_left && *to_left) { ch = *src++ | cur_side; (*from_left)--; if (state->MBtoWC (state, &ch, dst)) { dst++; (*to_left)--; } else { unconv++; } } } else { return -1; } *from = (XPointer) src; *to = (XPointer) dst; return unconv; } static int strtombs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { const char *src; char *dst = (char *) *to; int length; if (from == NULL || *from == NULL) return 0; src = (const char *) *from; length = min(*from_left, *to_left); while (length) { *dst++ = *src++; length--; } *from_left -= src - (char *) *from; *to_left -= dst - (char *) *to; *from = (XPointer) src; *to = (XPointer) dst; return 0; } static void close_converter( XlcConv conv) { Xfree(conv->state); Xfree(conv); } static XlcConv create_conv( XLCd lcd, XlcConvMethods methods) { XlcConv conv; State state; conv = Xcalloc(1, sizeof(XlcConvRec)); if (conv == NULL) return (XlcConv) NULL; state = Xmalloc(sizeof(StateRec)); if (state == NULL) { close_converter(conv); return (XlcConv) NULL; } state->GL_codeset = XLC_GENERIC(lcd, initial_state_GL); state->GR_codeset = XLC_GENERIC(lcd, initial_state_GR); state->wc_mask = (1 << XLC_GENERIC(lcd, wc_shift_bits)) - 1; state->wc_encode_mask = XLC_GENERIC(lcd, wc_encode_mask); #ifdef STDCVT if (XLC_GENERIC(lcd, use_stdc_env) == True) state->MBtoWC = &MBtoWCstd; else #endif state->MBtoWC = &MBtoWCdef; #ifdef STDCVT if (XLC_GENERIC(lcd, use_stdc_env) == True) state->WCtoMB = &WCtoMBstd; else #endif state->WCtoMB = &WCtoMBdef; conv->methods = methods; conv->state = (XPointer) state; return conv; } static XlcConvMethodsRec mbstowcs_methods = { close_converter, def_mbstowcs, NULL }; static XlcConv open_mbstowcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &mbstowcs_methods); } static XlcConvMethodsRec mbstostr_methods = { close_converter, mbstostr, NULL }; static XlcConv open_mbstostr( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &mbstostr_methods); } static XlcConvMethodsRec mbstocs_methods = { close_converter, mbstocs, NULL }; static XlcConv open_mbstocs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &mbstocs_methods); } static XlcConvMethodsRec wcstombs_methods = { close_converter, def_wcstombs, NULL }; static XlcConv open_wcstombs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &wcstombs_methods); } static XlcConvMethodsRec wcstostr_methods = { close_converter, wcstostr, NULL }; static XlcConv open_wcstostr( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &wcstostr_methods); } static XlcConvMethodsRec wcstocs_methods = { close_converter, wcstocs, NULL }; static XlcConv open_wcstocs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &wcstocs_methods); } static XlcConvMethodsRec strtombs_methods = { close_converter, strtombs, NULL }; static XlcConv open_strtombs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &strtombs_methods); } static XlcConvMethodsRec cstombs_methods = { close_converter, cstombs, NULL }; static XlcConv open_cstombs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &cstombs_methods); } static XlcConvMethodsRec cstowcs_methods = { close_converter, cstowcs, NULL }; static XlcConv open_cstowcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &cstowcs_methods); } XLCd _XlcDefaultLoader( const char *name) { XLCd lcd; lcd = _XlcCreateLC(name, _XlcGenericMethods); if (lcd == NULL) return lcd; if (XLC_PUBLIC(lcd, mb_cur_max) != 1){ _XlcDestroyLC(lcd); return (XLCd) NULL; } _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_mbstowcs); _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_mbstostr); _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_mbstocs); _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_mbstocs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_wcstombs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtombs); _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_mbstowcs); _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstombs); _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); _XlcAddUtf8Converters(lcd); return lcd; } nx-libs-3.5.99.23/nx-X11/lib/modules/lc/def/Makefile.am0000644000000000000000000000102613614532331016710 0ustar NULL = noinst_LTLIBRARIES = libxlcDef.la AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/include/X11 \ -I$(top_builddir)/include \ -I$(top_builddir)/include/X11 \ -I$(top_srcdir)/src/xcms \ -I$(top_srcdir)/src/xkb \ -I$(top_srcdir)/src/xlibi18n \ -I$(top_srcdir)/../exports/include \ -D_GNU_SOURCE \ $(NULL) AM_CFLAGS = \ $(X11_CFLAGS) \ $(BIGFONT_CFLAGS) \ $(CWARNFLAG) \ $(NULL) xlcDef_la_SOURCES = \ lcDefConv.c \ $(NULL) libxlcDef_la_SOURCES = $(xlcDef_la_SOURCES) nx-libs-3.5.99.23/nx-X11/lib/modules/lc/gen/lcGenConv.c0000644000000000000000000021311113614532331016711 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ /* * (c) Copyright 1995 FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. * * Modifier: Masayoshi Shimamura FUJITSU LIMITED * */ /* * 2000 * Modifier: Ivan Pascal The XFree86 Project */ /* * A generic locale loader for all kinds of ISO-2022 based codesets. * Supports: all locales. * How: Provides generic converters for ISO-2022 based codesets. Extensible as * far as ISO-2022 is extensible: codesets can be given by name in the * stream. Overall distinction between GL (0x00..0x7f) and GR (0x80..0xff). * In every chunk between escape sequences, the number of bytes per * character (char_size) is constant. * Platforms: all systems. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XlcGeneric.h" #include #if !defined(X_LOCALE) #define STDCVT #endif typedef struct _CTDataRec { const char *name; const char *encoding; /* Compound Text encoding */ } CTDataRec, *CTData; static CTDataRec directionality_data[] = { { "BEGIN_LEFT-TO-RIGHT_TEXT", "\2331]" }, { "BEGIN_RIGHT-TO-LEFT_TEXT", "\2332]" }, { "END_OF_STRING", "\233]" }, }; typedef struct _StateRec { XLCd lcd; /* CT state */ XlcCharSet charset; /* charset of current state */ XlcCharSet GL_charset; /* charset of initial state in GL */ XlcCharSet GR_charset; /* charset of initial state in GR */ /* MB shift state */ CodeSet GL_codeset; CodeSet GR_codeset; } StateRec, *State; #define GR 0x80 /* begins right-side (non-ascii) region */ #define GL 0x7f /* ends left-side (ascii) region */ #define ESC 0x1b #define CSI 0x9b #define STX 0x02 #define isrightside(c) ((c) & GR) #define isleftside(c) (!isrightside(c)) /* Forward declarations for local routines. */ static int mbstocts (XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args); static int ctstombs (XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args); static int cstombs (XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args); /* ------------------------------------------------------------------------- */ /* Misc */ /* ------------------------------------------------------------------------- */ static int compare( const char *src, const char *encoding, int length) { const char *start = src; while (length-- > 0) { if (*src++ != *encoding++) return 0; if (*encoding == '\0') return src - start; } return 0; } static unsigned long conv_to_dest( Conversion conv, unsigned long code) { int i; int conv_num = conv->conv_num; FontScope convlist = conv->convlist; for (i = 0; i < conv_num; i++) { if (convlist[i].start <= code && code <= convlist[i].end) { switch (convlist[i].shift_direction) { case '+': return(code + convlist[i].shift); case '-': return(code - convlist[i].shift); default: return(code); } } } return(code); } static unsigned long conv_to_source( Conversion conv, unsigned long code) { int i; int conv_num; FontScope convlist; unsigned long start_p; unsigned long start_m; unsigned long end_p; unsigned long end_m; if (!conv) return(code); conv_num = conv->conv_num; convlist = conv->convlist; for (i = 0; i < conv_num; i++) { switch (convlist[i].shift_direction) { case '+': start_p = convlist[i].start + convlist[i].shift; end_p = convlist[i].end + convlist[i].shift; if (start_p <= code && code <= end_p) return(code - convlist[i].shift); break; case '-': start_m = convlist[i].start - convlist[i].shift; end_m = convlist[i].end - convlist[i].shift; if (start_m <= code && code <= end_m) return(code + convlist[i].shift); break; default: continue; } } return(code); } static unsigned long mb_to_gi( unsigned long mb, CodeSet codeset) { int i; unsigned long mb_tmp, mask = 0; if (codeset->mbconv) { mb_tmp = conv_to_dest(codeset->mbconv, mb); if (mb_tmp != mb) return(mb_tmp); } if (codeset->side == XlcC0 || codeset->side == XlcGL || codeset->side == XlcC1 || codeset->side == XlcGR) { for (i = 0; i < codeset->length; i++) mask = (mask << 8) | GL; mb = mb & mask; } return(mb); } static unsigned long gi_to_mb( unsigned long glyph_index, CodeSet codeset) { int i; unsigned long mask = 0; if (codeset->side == XlcC1 || codeset->side == XlcGR) { for (i = 0; i < codeset->length; i++) mask = (mask << 8) | GR; glyph_index = glyph_index | mask; } if (codeset->mbconv) return( conv_to_source(codeset->mbconv, glyph_index) ); return(glyph_index); } static Bool gi_to_wc( XLCd lcd, unsigned long glyph_index, CodeSet codeset, wchar_t *wc) { unsigned char mask = 0; unsigned long wc_encoding = codeset->wc_encoding; int length = codeset->length; unsigned long wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits); mask = (1 << wc_shift_bits) - 1 ; for (*wc = 0, length--; length >= 0; length--) *wc = (*wc << wc_shift_bits) | ((glyph_index >> (length * 8 )) & mask); *wc = *wc | wc_encoding; return(True); } static Bool wc_to_gi( XLCd lcd, wchar_t wc, unsigned long *glyph_index, CodeSet *codeset) { int i; unsigned char mask = 0; unsigned long wc_encoding; unsigned long wc_encode_mask = XLC_GENERIC(lcd, wc_encode_mask); unsigned long wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits); int codeset_num = XLC_GENERIC(lcd, codeset_num); CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); wc_encoding = wc & wc_encode_mask; for (*codeset = NULL, i = 0; i < codeset_num; i++) { if (wc_encoding == codeset_list[i]->wc_encoding) { *codeset = codeset_list[i]; break; } } if (*codeset == NULL) return(False); mask = (1 << wc_shift_bits) - 1 ; wc = wc & ~wc_encode_mask; for (*glyph_index = 0, i = (*codeset)->length - 1; i >= 0; i--) *glyph_index = (*glyph_index << 8) | ( ((unsigned long)wc >> (i * wc_shift_bits)) & mask ); return(True); } static CodeSet mb_parse_codeset( State state, int num, const char **inbufptr, int *from_left) { int len; int from_len = (*from_left) + 1; const char *src = (*inbufptr) - 1; ParseInfo *mb_parse_list = XLC_GENERIC(state->lcd, mb_parse_list); ParseInfo parse_info; CodeSet codeset; for (--num ; (parse_info = mb_parse_list[num]) != NULL; num++) { len = compare(src, parse_info->encoding, from_len); if (len > 0) { codeset = parse_info->codeset; if (parse_info->type == E_LSL) state->GL_codeset = codeset; else if (parse_info->type == E_LSR) state->GR_codeset = codeset; --len; *inbufptr += len; *from_left -= len; return codeset; } } return (CodeSet) NULL; } static CodeSet byteM_parse_codeset( XLCd lcd, const char *inbufptr) { unsigned char ch; CodeSet codeset; ByteInfoList byteM; ByteInfoListRec byteM_rec; ByteInfo byteinfo; ByteInfoRec byteinfo_rec; Bool hit = False; int i, j, k; int codeset_num = XLC_GENERIC(lcd, codeset_num); CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); for (i = 0; i < codeset_num; i++) { codeset = codeset_list[i]; byteM = codeset->byteM; if (codeset->side != XlcNONE || byteM == NULL) continue; for (j = 0; j < codeset->length; j++) { ch = *((const unsigned char *)(inbufptr + j)); byteM_rec = byteM[j]; byteinfo = byteM_rec.byteinfo; for (hit = False, k = 0; k < byteM_rec.byteinfo_num; k++) { byteinfo_rec = byteinfo[k]; if (byteinfo_rec.start <= ch && ch <= byteinfo_rec.end) { hit = True; break; } } if (!hit) break; } if (hit) return(codeset); } return(NULL); } #define GLGR_parse_codeset(ch) \ (isrightside(ch) ? (state->GR_codeset) : \ (state->GL_codeset) ) static XlcCharSet gi_parse_charset( unsigned long glyph_index, CodeSet codeset) { int i; XlcCharSet *charset_list = codeset->charset_list; int num_charsets = codeset->num_charsets; ExtdSegment ctextseg = codeset->ctextseg; XlcCharSet charset = NULL; int area_num; FontScope area; /* lockup ct sequence */ for (i = 0; i < num_charsets; i++) { charset = charset_list[i]; if (*charset->ct_sequence != '\0') break; } if (i >= num_charsets) return(NULL); if (charset->source != CSsrcStd) return (charset); if (!ctextseg) return(charset); area = ctextseg->area; area_num = ctextseg->area_num; for (i = 0; i < area_num; i++) { if (area[i].start <= glyph_index && glyph_index <= area[i].end) { charset = ctextseg->charset; if (*charset->ct_sequence == '\0') return(NULL); break; } } return(charset); } static Bool ct_parse_csi( const char *inbufptr, int *ctr_seq_len) { int i; int num = sizeof(directionality_data) / sizeof(directionality_data[0]); for (i = 0; i < num; i++) { if ( !(*ctr_seq_len = strlen(directionality_data[i].encoding)) ) continue; if ( strncmp(inbufptr, directionality_data[i].encoding, *ctr_seq_len) == 0) return(True); } return(False); } static int cmp_esc_sequence( const char *inbufptr, XlcCharSet charset) { int seq_len, name_len, total_len; unsigned char byte_m, byte_l; const char *ct_sequence = charset->ct_sequence; const char *encoding_name = charset->encoding_name; /* check esc sequence */ if ( !(seq_len = strlen(ct_sequence) ) ) return(0); if ( strncmp(inbufptr, ct_sequence, seq_len) != 0) return(0); /* Standard Character Set Encoding ? */ if (charset->source == CSsrcStd) return(seq_len); /* * Non-Standard Character Set Encoding * * +--- ---+-----+-----+-----+---- ----+-----+-----+------- ------+ * | ctseq | M | L | encoding name | STX | contents | * +--- ---+-----+-----+-----+---- ----+-----+-----+------- ------+ * 4bytes 1byte 1byte variable length 1byte variable length * | | * +----------------------------------------------+ * rest length = ((M - 128) * 128) + (L - 128) */ /* get length of encoding name */ inbufptr += seq_len; byte_m = *inbufptr++; byte_l = *inbufptr++; name_len = strlen(encoding_name); if (((byte_m - 128) * 128 + (byte_l - 128) - 1) < name_len) return(0); if ( _XlcNCompareISOLatin1(inbufptr, encoding_name, name_len) != 0 ) return(0); /* check STX (Start of Text) */ inbufptr = inbufptr + name_len; if ( *inbufptr != STX ) return(0); total_len = seq_len + name_len + 3; return(total_len); } static Bool ct_parse_charset( XLCd lcd, const char *inbufptr, XlcCharSet *charset, int *ctr_seq_len) { int i, j; ExtdSegment ctextseg; int num_charsets; XlcCharSet *charset_list; CodeSet codeset; int codeset_num = XLC_GENERIC(lcd, codeset_num); CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); int segment_conv_num = XLC_GENERIC(lcd, segment_conv_num); SegConv segment_conv = XLC_GENERIC(lcd, segment_conv); /* get charset from XLC_XLOCALE by escape sequence */ for (i = 0; i < codeset_num; i++) { codeset = codeset_list[i]; num_charsets = codeset->num_charsets; charset_list = codeset->charset_list; ctextseg = codeset->ctextseg; for (j = 0; j < num_charsets; j++) { *charset = charset_list[j]; if ((*ctr_seq_len = cmp_esc_sequence(inbufptr, *charset))) return(True); } if (ctextseg) { *charset = ctextseg->charset; if ((*ctr_seq_len = cmp_esc_sequence(inbufptr, *charset))) return(True); } } /* get charset from XLC_SEGMENTCONVERSION by escape sequence */ if (!segment_conv) return(False); for (i = 0; i < segment_conv_num; i++) { *charset = segment_conv[i].source; if ((*ctr_seq_len = cmp_esc_sequence(inbufptr, *charset))) return(True); *charset = segment_conv[i].dest; if ((*ctr_seq_len = cmp_esc_sequence(inbufptr, *charset))) return(True); } return(False); } static Bool segment_conversion( XLCd lcd, XlcCharSet *charset, unsigned long *glyph_index) { int i; int segment_conv_num = XLC_GENERIC(lcd, segment_conv_num); SegConv segment_conv = XLC_GENERIC(lcd, segment_conv); FontScopeRec range; ConversionRec conv_rec; if (!segment_conv) return(True); for (i = 0; i < segment_conv_num; i++) { if (segment_conv[i].source == *charset) break; } if (i >= segment_conv_num) return(True); range = segment_conv[i].range; if (*glyph_index < range.start || range.end < *glyph_index) return(True); *charset = segment_conv[i].dest; conv_rec.conv_num = segment_conv[i].conv_num; conv_rec.convlist = segment_conv[i].conv; *glyph_index = conv_to_dest(&conv_rec, *glyph_index); return(True); } static CodeSet _XlcGetCodeSetFromName( XLCd lcd, const char *name) { int i, j; XlcCharSet charset; int num_charsets; XlcCharSet *charset_list; CodeSet codeset; int codeset_num = XLC_GENERIC(lcd, codeset_num); CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); for (i = 0; i < codeset_num; i++) { codeset = codeset_list[i]; num_charsets = codeset->num_charsets; charset_list = codeset->charset_list; for (j = 0; j < num_charsets; j++) { charset = charset_list[j]; if (!strlen(charset->name)) continue; if ( strcmp(charset->name, name) == 0) return(codeset); } } return(NULL); } static Bool _XlcGetCodeSetFromCharSet( XLCd lcd, XlcCharSet charset, CodeSet *codeset, unsigned long *glyph_index) { int j, num; CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); XlcCharSet *charset_list; int codeset_num, num_charsets; Conversion ctconv; unsigned long glyph_index_tmp = 0; ExtdSegment ctextseg; codeset_num = XLC_GENERIC(lcd, codeset_num); for (num = 0 ; num < codeset_num; num++) { *codeset = codeset_list[num]; ctconv = (*codeset)->ctconv; ctextseg = (*codeset)->ctextseg; num_charsets = (*codeset)->num_charsets; charset_list = (*codeset)->charset_list; glyph_index_tmp = conv_to_source(ctconv, *glyph_index); if (charset->source == CSsrcStd) { /* Standard Character Set Encoding */ if (glyph_index_tmp == *glyph_index) { for (j = 0; j < num_charsets; j++) { if (charset_list[j] == charset) { goto end_loop; } } } } else { /* Non-Standard Character Set Encoding */ for (j = 0; j < num_charsets; j++) { if (charset_list[j] == charset) { goto end_loop; } } if (glyph_index_tmp != *glyph_index) { if (ctextseg && ctextseg->charset == charset) { goto end_loop; } } } } end_loop: if (num < codeset_num) { *glyph_index = glyph_index_tmp; return(True); } return(False); } #define check_string_encoding(codeset) (codeset->string_encoding) static void output_ulong_value( char *outbufptr, unsigned long code, int length, XlcSide side) { int i; for (i = (length - 1) * 8; i >= 0; i -= 8) { *outbufptr = ( code >> i) & 0xff; if (side == XlcC0 || side == XlcGL) { *outbufptr = *outbufptr & GL; } else if (side == XlcC1 || side == XlcGR) { *outbufptr = *outbufptr | GR; } outbufptr++; } } /* -------------------------------------------------------------------------- */ /* Init */ /* -------------------------------------------------------------------------- */ static XlcCharSet default_GL_charset = 0; static XlcCharSet default_GR_charset = 0; static void init_state( XlcConv conv) { State state = (State) conv->state; /* for CT */ state->charset = NULL; state->GL_charset = default_GL_charset; state->GR_charset = default_GR_charset; /* for MB shift state */ state->GL_codeset = XLC_GENERIC(state->lcd, initial_state_GL); state->GR_codeset = XLC_GENERIC(state->lcd, initial_state_GR); } /* -------------------------------------------------------------------------- */ /* Convert */ /* -------------------------------------------------------------------------- */ static int mbstowcs_org( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; unsigned char ch; unsigned long mb = 0; wchar_t wc; int length = 0, len_left = 0; int unconv_num = 0; int num; CodeSet codeset = NULL; const char *inbufptr; wchar_t *outbufptr = (wchar_t *) *to; int from_size = *from_left; unsigned char *mb_parse_table = XLC_GENERIC(lcd, mb_parse_table); if (from == NULL || *from == NULL) { _XlcResetConverter(conv); return( 0 ); } inbufptr = *from; while (*from_left && *to_left) { ch = *inbufptr++; (*from_left)--; /* null ? */ if (!ch) { if (outbufptr) {*outbufptr++ = L'\0';} (*to_left)--; /* error check */ if (len_left) { unconv_num += (length - len_left); len_left = 0; } continue; } /* same mb char data */ if (len_left) goto output_one_wc; /* next mb char data for single shift ? */ if (mb_parse_table && (num = mb_parse_table[ch]) ) { codeset = mb_parse_codeset(state, num, &inbufptr, from_left); if (codeset != NULL) { length = len_left = codeset->length; mb = 0; continue; } } /* next mb char data for byteM ? */ if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1)))) goto next_mb_char; /* next mb char data for GL or GR side ? */ if ((codeset = GLGR_parse_codeset(ch))) goto next_mb_char; /* can't find codeset for the ch */ unconv_num++; continue; next_mb_char: length = len_left = codeset->length; mb = 0; output_one_wc: mb = (mb << 8) | ch; /* 1 byte left shift */ len_left--; /* last of one mb char data */ if (!len_left) { gi_to_wc(lcd, mb_to_gi(mb, codeset), codeset, &wc); if (outbufptr) {*outbufptr++ = wc;} (*to_left)--; } } /* end of while */ /* error check on last char */ if (len_left) { inbufptr -= (length - len_left); (*from_left) += (length - len_left); unconv_num += (length - len_left); } *from = (XPointer) ((const char *) *from + from_size); *from_left = 0; *to = (XPointer) outbufptr; return unconv_num; } static int stdc_mbstowcs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { const char *src = *((const char **) from); wchar_t *dst = *((wchar_t **) to); int src_left = *from_left; int dst_left = *to_left; int length, unconv_num = 0; while (src_left > 0 && dst_left > 0) { length = mbtowc(dst, src, src_left); if (length > 0) { src += length; src_left -= length; if (dst) dst++; dst_left--; } else if (length < 0) { src++; src_left--; unconv_num++; } else { /* null ? */ src++; src_left--; if (dst) *dst++ = L'\0'; dst_left--; } } *from = (XPointer) src; if (dst) *to = (XPointer) dst; *from_left = src_left; *to_left = dst_left; return unconv_num; } static int wcstombs_org( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; char *encoding; unsigned long mb, glyph_index; wchar_t wc; int length; int unconv_num = 0; CodeSet codeset; const wchar_t *inbufptr = (const wchar_t *) *from; char *outbufptr = *to; int from_size = *from_left; const char *default_string = XLC_PUBLIC(lcd, default_string); int defstr_len = strlen(default_string); while (*from_left && *to_left) { wc = *inbufptr++; (*from_left)--; /* null ? */ if (!wc) { if (outbufptr) {*outbufptr++ = '\0';} (*to_left)--; continue; } /* convert */ if ( !wc_to_gi(lcd, wc, &glyph_index, &codeset) ) { /* output default_string of XDefaultString() */ if (*to_left < defstr_len) break; if (outbufptr) { strncpy((char *)outbufptr, default_string, defstr_len); outbufptr += defstr_len; } (*to_left) -= defstr_len; unconv_num++; } else { mb = gi_to_mb(glyph_index, codeset); if (codeset->parse_info) { Bool need_shift = False; switch (codeset->parse_info->type) { case E_LSL : if (codeset != state->GL_codeset) { need_shift = True; state->GL_codeset = codeset; } break; case E_LSR : if (codeset != state->GR_codeset) { need_shift = True; state->GR_codeset = codeset; } break; /* case E_SS */ default: need_shift = True; } /* output shift sequence */ if (need_shift) { encoding = codeset->parse_info->encoding; length = strlen(encoding); if (*to_left < length) break; if (outbufptr) { strncpy((char *)outbufptr, encoding, length); outbufptr += length; } (*to_left) -= length; } } /* output characters */ length = codeset->length; if (*to_left < length) break; if (outbufptr) { output_ulong_value(outbufptr, mb, length, XlcNONE); outbufptr += length; } (*to_left) -= length; } } /* end of while */ *from = (XPointer) ((const wchar_t *) *from + from_size); *from_left = 0; *to = (XPointer) outbufptr; return unconv_num; } static int stdc_wcstombs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { const wchar_t *src = *((const wchar_t **) from); char *dst = *((char **) to); int src_left = *from_left; int dst_left = *to_left; int length, unconv_num = 0; while (src_left > 0 && dst_left >= MB_CUR_MAX) { length = wctomb(dst, *src); /* XXX */ if (length > 0) { src++; src_left--; if (dst) dst += length; dst_left -= length; } else if (length < 0) { src++; src_left--; unconv_num++; } } *from = (XPointer) src; if (dst) *to = (XPointer) dst; *from_left = src_left; *to_left = dst_left; return unconv_num; } static int wcstocts( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; unsigned long glyph_index; wchar_t wc; int total_len, seq_len, name_len; int unconv_num = 0; Bool first_flag = True, standard_flag; XlcSide side; CodeSet codeset; XlcCharSet charset, old_charset = NULL; const char *ct_sequence; const wchar_t *inbufptr = (const wchar_t *) *from; char *outbufptr = *to; int from_size = *from_left; char *ext_seg_len = NULL; while (*from_left && *to_left) { wc = *inbufptr++; (*from_left)--; /* null ? */ if (!wc) { if (outbufptr) {*outbufptr++ = '\0';} (*to_left)--; continue; } /* convert */ if ( !wc_to_gi(lcd, wc, &glyph_index, &codeset) ) { unconv_num++; continue; } /* parse charset */ if ( !(charset = gi_parse_charset(glyph_index, codeset)) ) { unconv_num++; continue; } /* Standard Character Set Encoding ? */ standard_flag = charset->source == CSsrcStd ? True : False; /* * Non-Standard Character Set Encoding * * +-----+-----+-----+-----+-----+-----+-----+---- ----+-----+-----+ * | esc sequence | M | L | encoding name | STX | * +-----+-----+-----+-----+-----+-----+-----+---- ----+-----+-----+ * 4bytes 1byte 1byte variable length 1byte * | | * +-----------------------------------------+ * name length = ((M - 128) * 128) + (L - 128) */ /* make encoding data */ ct_sequence = charset->ct_sequence; side = charset->side; seq_len = strlen(ct_sequence); if (standard_flag) { name_len = 0; total_len = seq_len; } else { name_len = strlen(charset->encoding_name) + 1; total_len = seq_len + name_len + 2; } /* output escape sequence of CT */ if ( (charset != old_charset) && !(first_flag && charset->string_encoding) ){ if ( (ext_seg_len != NULL) && outbufptr) { int i = (outbufptr - ext_seg_len) - 2; *ext_seg_len++ = i / 128 + 128; *ext_seg_len = i % 128 + 128; ext_seg_len = NULL; } if (*to_left < total_len + 1) { unconv_num++; break; } if (outbufptr) { strcpy((char *)outbufptr, ct_sequence); outbufptr += seq_len; if (!standard_flag) { const char *i = charset->encoding_name; ext_seg_len = outbufptr; outbufptr += 2; for (; *i ; i++) *outbufptr++ = ((*i >= 'A') && (*i <= 'Z')) ? *i - 'A' + 'a' : *i; *outbufptr++ = STX; } } (*to_left) -= total_len; first_flag = False; old_charset = charset; } /* output glyph index */ if (codeset->ctconv) glyph_index = conv_to_dest(codeset->ctconv, glyph_index); if (*to_left < charset->char_size) { unconv_num++; break; } if (outbufptr) { output_ulong_value(outbufptr, glyph_index, charset->char_size, side); outbufptr += charset->char_size; } (*to_left) -= charset->char_size; } /* end of while */ if ( (ext_seg_len != NULL) && outbufptr) { int i = (outbufptr - ext_seg_len) - 2; *ext_seg_len++ = i / 128 + 128; *ext_seg_len = i % 128 + 128; } *from = (XPointer) ((const wchar_t *) *from + from_size); *from_left = 0; *to = (XPointer) outbufptr; return unconv_num; } static int stdc_wcstocts( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); char *buf_ptr1 = buf; int buf_left1 = (*from_left) * MB_CUR_MAX; char *buf_ptr2 = buf_ptr1; int buf_left2; int unconv_num1 = 0, unconv_num2 = 0; unconv_num1 = stdc_wcstombs(conv, from, from_left, &buf_ptr1, &buf_left1, args, num_args); if (unconv_num1 < 0) goto ret; buf_left2 = buf_ptr1 - buf_ptr2; unconv_num2 = mbstocts(conv, &buf_ptr2, &buf_left2, to, to_left, args, num_args); if (unconv_num2 < 0) goto ret; ret: Xfree(buf); return (unconv_num1 + unconv_num2); } static int ctstowcs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; unsigned char ch; unsigned long glyph_index = 0; wchar_t wc; int ctr_seq_len = 0, gi_len_left = 0, gi_len = 0; int unconv_num = 0; CodeSet codeset = NULL; XlcCharSet charset_tmp; const char *inbufptr; wchar_t *outbufptr = (wchar_t *) *to; int from_size = *from_left; _XlcResetConverter(conv); /* ??? */ if (from == NULL || *from == NULL) { _XlcResetConverter(conv); return( 0 ); } inbufptr = *from; while (*from_left && *to_left) { ch = *inbufptr++; (*from_left)--; /* null ? */ if (!ch) { if (outbufptr) {*outbufptr++ = L'\0';} (*to_left)--; /* error check */ if (gi_len_left) { unconv_num += (gi_len - gi_len_left); gi_len_left = 0; } continue; } /* same glyph_index data */ if (gi_len_left) goto output_one_wc; /* control sequence ? */ if (ch == CSI) { if ( !ct_parse_csi(inbufptr - 1, &ctr_seq_len) ) goto skip_the_seg; if (*from_left + 1 < ctr_seq_len) { inbufptr--; (*from_left)++; unconv_num += *from_left; break; } /* skip the control sequence */ inbufptr += (ctr_seq_len - 1); *from_left -= (ctr_seq_len - 1); continue; } /* escape sequence ? */ if (ch == ESC) { if ( !ct_parse_charset(lcd, inbufptr - 1, &state->charset, &ctr_seq_len) ) goto skip_the_seg; if (state->charset->side == XlcC0 || state->charset->side == XlcGL) { state->GL_charset = state->charset; } else if (state->charset->side == XlcC1 || state->charset->side == XlcGR) { state->GR_charset = state->charset; } else if (state->charset->side == XlcGLGR) { state->GL_charset = state->charset; state->GR_charset = state->charset; } if (*from_left + 1 < ctr_seq_len) { inbufptr--; (*from_left)++; unconv_num += *from_left; break; } /* skip the escape sequence */ inbufptr += (ctr_seq_len - 1); *from_left -= (ctr_seq_len - 1); continue; } /* check current state */ if (isleftside(ch)) state->charset = state->GL_charset; else state->charset = state->GR_charset; gi_len = gi_len_left = state->charset->char_size; glyph_index = 0; output_one_wc: if (state->charset->side == XlcC1 || state->charset->side == XlcGR) glyph_index = (glyph_index << 8) | (ch & GL); else glyph_index = (glyph_index << 8) | ch; gi_len_left--; /* last of one glyph_index data */ if (!gi_len_left) { /* segment conversion */ charset_tmp = state->charset; segment_conversion(lcd, &charset_tmp, &glyph_index); /* get codeset */ if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp, &codeset, &glyph_index) ) { unconv_num += gi_len; continue; } /* convert glyph index to wicd char */ gi_to_wc(lcd, glyph_index, codeset, &wc); if (outbufptr) {*outbufptr++ = wc;} (*to_left)--; } continue; skip_the_seg: /* skip until next escape or control sequence */ while ( *from_left ) { ch = *inbufptr++; (*from_left)--; unconv_num++; if (ch == ESC || ch == CSI) { inbufptr--; (*from_left)++; unconv_num--; break; } } if ( !(*from_left) ) break; } /* end of while */ /* error check on last char */ if (gi_len_left) { inbufptr -= (gi_len - gi_len_left); (*from_left) += (gi_len - gi_len_left); unconv_num += (gi_len - gi_len_left); } *from = (XPointer) ((const char *) *from + from_size); *from_left = 0; *to = (XPointer) outbufptr; return unconv_num; } static int cstowcs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; unsigned char ch; unsigned long glyph_index = 0; wchar_t wc; int gi_len_left = 0, gi_len = 0; int unconv_num = 0; CodeSet codeset = NULL; XlcCharSet charset, charset_tmp; const char *inbufptr; wchar_t *outbufptr = (wchar_t *) *to; int from_size = *from_left; if (from == NULL || *from == NULL) { return( 0 ); } inbufptr = *from; charset = (XlcCharSet) args[0]; while (*from_left && *to_left) { if (!gi_len_left) { gi_len_left = gi_len = charset->char_size; glyph_index = 0; } ch = *inbufptr++; (*from_left)--; /* null ? */ if (!ch) { if (outbufptr) {*outbufptr++ = L'\0';} (*to_left)--; /* error check */ if (gi_len_left) { unconv_num += (gi_len - gi_len_left); gi_len_left = 0; } continue; } if (charset->side == XlcC1 || charset->side == XlcGR) glyph_index = (glyph_index << 8) | (ch & GL); else glyph_index = (glyph_index << 8) | ch; gi_len_left--; /* last of one glyph_index data */ if (!gi_len_left) { /* segment conversion */ charset_tmp = charset; segment_conversion(lcd, &charset_tmp, &glyph_index); /* get codeset */ if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp, &codeset, &glyph_index) ) { unconv_num += gi_len; continue; } /* convert glyph index to wicd char */ gi_to_wc(lcd, glyph_index, codeset, &wc); if (outbufptr) {*outbufptr++ = wc;} (*to_left)--; } } /* end of while */ /* error check on last char */ if (gi_len_left) { inbufptr -= (gi_len - gi_len_left); (*from_left) += (gi_len - gi_len_left); unconv_num += (gi_len - gi_len_left); } *from = (XPointer) ((const char *) *from + from_size); *from_left = 0; *to = (XPointer) outbufptr; return unconv_num; } static int stdc_ctstowcs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); char *buf_ptr1 = buf; int buf_left1 = (*from_left) * MB_CUR_MAX; char *buf_ptr2 = buf_ptr1; int buf_left2; int unconv_num1 = 0, unconv_num2 = 0; unconv_num1 = ctstombs(conv, from, from_left, &buf_ptr1, &buf_left1, args, num_args); if (unconv_num1 < 0) goto ret; buf_left2 = buf_ptr1 - buf_ptr2; unconv_num2 = stdc_mbstowcs(conv, &buf_ptr2, &buf_left2, to, to_left, args, num_args); if (unconv_num2 < 0) goto ret; ret: Xfree(buf); return (unconv_num1 + unconv_num2); } static int stdc_cstowcs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); char *buf_ptr1 = buf; int buf_left1 = (*from_left) * MB_CUR_MAX; char *buf_ptr2 = buf_ptr1; int buf_left2; int unconv_num1 = 0, unconv_num2 = 0; unconv_num1 = cstombs(conv, from, from_left, &buf_ptr1, &buf_left1, args, num_args); if (unconv_num1 < 0) goto ret; buf_left2 = buf_ptr1 - buf_ptr2; unconv_num2 = stdc_mbstowcs(conv, &buf_ptr2, &buf_left2, to, to_left, args, num_args); if (unconv_num2 < 0) goto ret; ret: Xfree(buf); return (unconv_num1 + unconv_num2); } static int mbstocts( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { XPointer buf = Xmalloc((*from_left) * sizeof(wchar_t)); char *buf_ptr1 = buf; int buf_left1 = (*from_left); char *buf_ptr2 = buf_ptr1; int buf_left2; int unconv_num1 = 0, unconv_num2 = 0; unconv_num1 = mbstowcs_org(conv, from, from_left, &buf_ptr1, &buf_left1, args, num_args); if (unconv_num1 < 0) goto ret; buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t); unconv_num2 += wcstocts(conv, &buf_ptr2, &buf_left2, to, to_left, args, num_args); if (unconv_num2 < 0) goto ret; ret: Xfree(buf); return (unconv_num1 + unconv_num2); } static int mbstostr( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; unsigned char ch; unsigned long mb = 0; int length = 0, len_left = 0; int unconv_num = 0; int num; CodeSet codeset = NULL; const char *inbufptr; char *outbufptr = *to; int from_size = *from_left; unsigned char *mb_parse_table = XLC_GENERIC(lcd, mb_parse_table); if (from == NULL || *from == NULL) { _XlcResetConverter(conv); return( 0 ); } inbufptr = *from; while (*from_left && *to_left) { ch = *inbufptr++; (*from_left)--; /* null ? */ if (!ch) { if (outbufptr) {*outbufptr++ = '\0';} (*to_left)--; /* error check */ if (len_left) { unconv_num += (length - len_left); len_left = 0; } continue; } /* same mb char data */ if (len_left) goto output_one_mb; /* next mb char data for single shift ? */ if (mb_parse_table && (num = mb_parse_table[ch]) ) { codeset = mb_parse_codeset(state, num, &inbufptr, from_left); if (codeset != NULL) { length = len_left = codeset->length; mb = 0; continue; } } /* next char data : byteM ? */ if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1)))) goto next_mb_char; /* next char data : GL or GR side ? */ if ((codeset = GLGR_parse_codeset(ch))) goto next_mb_char; /* can't find codeset for the ch */ unconv_num++; continue; next_mb_char: length = len_left = codeset->length; mb = 0; output_one_mb: mb = (mb << 8) | ch; /* 1 byte left shift */ len_left--; /* last of one mb char data */ if (!len_left) { if (check_string_encoding(codeset)) { if (outbufptr) {*outbufptr++ = mb & 0xff;} (*to_left)--; } else { unconv_num++; } } } /* end of while */ /* error check on last char */ if (len_left) { inbufptr -= (length - len_left); (*from_left) += (length - len_left); unconv_num += (length - len_left); } *from = (XPointer) ((const char *) *from + from_size); *from_left = 0; *to = (XPointer) outbufptr; return unconv_num; } static int mbtocs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; unsigned char ch; unsigned long mb = 0; unsigned long glyph_index; int length = 0, len_left = 0, char_len; int unconv_num = 0; int num; XlcSide side; CodeSet codeset = NULL; XlcCharSet charset = NULL; const char *inbufptr; char *outbufptr = *to; int from_size = *from_left; unsigned char *mb_parse_table = XLC_GENERIC(lcd, mb_parse_table); if (from == NULL || *from == NULL) { _XlcResetConverter(conv); return( 0 ); } inbufptr = *from; while (*from_left && *to_left) { ch = *inbufptr++; (*from_left)--; /* null ? */ if (!ch) { unconv_num = 1; if (len_left) unconv_num += (length - len_left); break; } /* same mb char data */ if (len_left) goto output; /* next mb char data for single shift ? */ if (mb_parse_table && (num = mb_parse_table[ch]) ) { codeset = mb_parse_codeset(state, num, &inbufptr, from_left); if (codeset != NULL) { length = len_left = codeset->length; mb = 0; continue; } } /* next mb char data for byteM ? */ if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1)))) goto next_mb_char; /* next mb char data for GL or GR side ? */ if ((codeset = GLGR_parse_codeset(ch))) goto next_mb_char; /* can't find codeset for the ch */ unconv_num = 1; break; next_mb_char: length = len_left = codeset->length; mb = 0; output: mb = (mb << 8) | ch; /* 1 byte left shift */ len_left--; /* last of one mb char data */ if (!len_left) { glyph_index = mb_to_gi(mb, codeset); if (!(charset = gi_parse_charset(glyph_index, codeset))) { unconv_num = length; break; } char_len = charset->char_size; side = charset->side; /* output glyph index */ if (codeset->ctconv) glyph_index = conv_to_dest(codeset->ctconv, glyph_index); if (*to_left < char_len) { unconv_num = length; break; } if (outbufptr) { output_ulong_value(outbufptr, glyph_index, char_len, side); outbufptr += char_len; } (*to_left) -= char_len; break; } } /* end of while */ /* error end */ if (unconv_num) { *from = (XPointer) ((const char *) *from + from_size); *from_left = 0; *to = (XPointer) outbufptr; return -1; } /* normal end */ *from = (XPointer) inbufptr; *to = (XPointer) outbufptr; if (num_args > 0) *((XlcCharSet *) args[0]) = charset; return 0; } static int mbstocs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { int ret; XlcCharSet charset_old, charset = NULL; XPointer tmp_args[1]; const char *inbufptr; int in_left; char *outbufptr; int out_left; tmp_args[0] = (XPointer) &charset; ret = mbtocs(conv, from, from_left, to, to_left, tmp_args, 1); charset_old = charset; while ( ret == 0 && *from_left && *to_left) { inbufptr = *from; in_left = *from_left; outbufptr = *to; out_left = *to_left; ret = mbtocs(conv, from, from_left, to, to_left, tmp_args, 1); if (charset_old != charset) { *from = (XPointer) inbufptr; *from_left = in_left; *to = (XPointer) outbufptr; *to_left = out_left; break; } } if (num_args > 0) *((XlcCharSet *) args[0]) = charset_old; /* error end */ if (ret != 0) return( -1 ); return(0); } static int wcstostr( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; char *encoding; unsigned long mb, glyph_index; wchar_t wc; int length; int unconv_num = 0; CodeSet codeset; const wchar_t *inbufptr = (const wchar_t *) *from; char *outbufptr = *to; int from_size = *from_left; const char *default_string = XLC_PUBLIC(lcd, default_string); int defstr_len = strlen(default_string); while (*from_left && *to_left) { wc = *inbufptr++; (*from_left)--; /* null ? */ if (!wc) { if (outbufptr) {*outbufptr++ = '\0';} (*to_left)--; continue; } /* convert */ if ( !wc_to_gi(lcd, wc, &glyph_index, &codeset) ) { /* output default_string of XDefaultString() */ if (*to_left < defstr_len) break; if (outbufptr) { strncpy((char *)outbufptr, default_string, defstr_len); outbufptr += defstr_len; } (*to_left) -= defstr_len; unconv_num++; } else { mb = gi_to_mb(glyph_index, codeset); if (check_string_encoding(codeset)) { if (codeset->parse_info) { Bool need_shift = False; switch (codeset->parse_info->type) { case E_LSL : if (codeset != state->GL_codeset) { need_shift = True; state->GL_codeset = codeset; } break; case E_LSR : if (codeset != state->GR_codeset) { need_shift = True; state->GR_codeset = codeset; } break; /* case E_SS */ default: need_shift = True; } /* output shift sequence */ if (need_shift) { encoding = codeset->parse_info->encoding; length = strlen(encoding); if (*to_left < length) break; if (outbufptr) { strncpy((char *)outbufptr, encoding, length); outbufptr += length; } (*to_left) -= length; } } /* output characters */ length = codeset->length; if (*to_left < length) break; if (outbufptr) { output_ulong_value(outbufptr, mb, length, XlcNONE); outbufptr += length; } (*to_left) -= length; } else { unconv_num++; } } } /* end of while */ *from = (XPointer) ((const wchar_t *) *from + from_size); *from_left = 0; *to = (XPointer) outbufptr; return unconv_num; } static int stdc_wcstostr( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); char *buf_ptr1 = buf; int buf_left1 = (*from_left) * MB_CUR_MAX; char *buf_ptr2 = buf_ptr1; int buf_left2; int unconv_num1 = 0, unconv_num2 = 0; unconv_num1 = stdc_wcstombs(conv, from, from_left, &buf_ptr1, &buf_left1, args, num_args); if (unconv_num1 < 0) goto ret; buf_left2 = buf_ptr1 - buf_ptr2; unconv_num2 = mbstostr(conv, &buf_ptr2, &buf_left2, to, to_left, args, num_args); if (unconv_num2 < 0) goto ret; ret: Xfree(buf); return (unconv_num1 + unconv_num2); } static int wctocs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; wchar_t wc; unsigned long glyph_index; int char_len; int unconv_num = 0; XlcSide side; CodeSet codeset; XlcCharSet charset = NULL; const wchar_t *inbufptr = (const wchar_t *) *from; char *outbufptr = *to; int from_size = *from_left; if (*from_left && *to_left) { wc = *inbufptr++; (*from_left)--; /* null ? */ if (!wc) { unconv_num = 1; goto end; } /* convert */ if ( !wc_to_gi(lcd, wc, &glyph_index, &codeset) ) { unconv_num = 1; goto end; } if ( !(charset = gi_parse_charset(glyph_index, codeset)) ) { unconv_num = 1; goto end; } char_len = charset->char_size; side = charset->side; /* output glyph index */ if (codeset->ctconv) glyph_index = conv_to_dest(codeset->ctconv, glyph_index); if (*to_left < char_len) { unconv_num++; goto end; } if (outbufptr) { output_ulong_value(outbufptr, glyph_index, char_len, side); outbufptr += char_len; } (*to_left) -= char_len; } end: /* error end */ if (unconv_num) { *from = (XPointer) ((const wchar_t *) *from + from_size); *from_left = 0; *to = (XPointer) outbufptr; return -1; } /* normal end */ *from = (XPointer) inbufptr; *to = (XPointer) outbufptr; if (num_args > 0) *((XlcCharSet *) args[0]) = charset; return 0; } static int stdc_wctocs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { const wchar_t *src = *((const wchar_t **) from); wchar_t wch; XPointer tmp_from, save_from = *from; char tmp[32]; int length, ret, src_left = *from_left; int from_size = *from_left; if (src_left > 0 && *to_left > 0) { if ((wch = *src)) { length = wctomb(tmp, wch); } else { goto end; } if (length < 0) goto end; tmp_from = (XPointer) tmp; ret = mbtocs(conv, &tmp_from, &length, to, to_left, args, num_args); if (ret < 0) goto end; src++; src_left--; } end: /* error end */ if (save_from == (XPointer) src) { *from = (XPointer) ((const wchar_t *) *from + from_size); *from_left = 0; return -1; } /* normal end */ *from = (XPointer) src; *from_left = src_left; return 0; } static int wcstocs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { int ret; XlcCharSet charset_old, charset = NULL; XPointer tmp_args[1]; const wchar_t *inbufptr; int in_left; XPointer outbufptr; int out_left; tmp_args[0] = (XPointer) &charset; ret = wctocs(conv, from, from_left, to, to_left, tmp_args, 1); charset_old = charset; while ( ret == 0 && *from_left && *to_left) { inbufptr = (const wchar_t *) *from; in_left = *from_left; outbufptr = *to; out_left = *to_left; ret = wctocs(conv, from, from_left, to, to_left, tmp_args, 1); if (charset_old != charset) { *from = (XPointer) inbufptr; *from_left = in_left; *to = (XPointer) outbufptr; *to_left = out_left; break; } } if (num_args > 0) *((XlcCharSet *) args[0]) = charset_old; /* error end */ if (ret != 0) return( -1 ); return(0); } #ifdef STDCVT static int stdc_wcstocs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { int ret; XlcCharSet charset_old, charset = NULL; XPointer tmp_args[1]; const wchar_t *inbufptr; int in_left; XPointer outbufptr; int out_left; tmp_args[0] = (XPointer) &charset; ret = stdc_wctocs(conv, from, from_left, to, to_left, tmp_args, 1); charset_old = charset; while ( ret == 0 && *from_left && *to_left ) { inbufptr = (const wchar_t *) *from; in_left = *from_left; outbufptr = *to; out_left = *to_left; ret = stdc_wctocs(conv, from, from_left, to, to_left, tmp_args, 1); if (charset_old != charset) { *from = (XPointer) inbufptr; *from_left = in_left; *to = (XPointer) outbufptr; *to_left = out_left; break; } } if (num_args > 0) *((XlcCharSet *) args[0]) = charset_old; /* error end */ if (ret != 0) return( -1 ); return(0); } #endif static int ctstombs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { XPointer buf = Xmalloc((*from_left) * sizeof(wchar_t)); char *buf_ptr1 = buf; int buf_left1 = (*from_left); char *buf_ptr2 = buf_ptr1; int buf_left2; int unconv_num1 = 0, unconv_num2 = 0; unconv_num1 = ctstowcs(conv, from, from_left, &buf_ptr1, &buf_left1, args, num_args); if (unconv_num1 < 0) goto ret; buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t); unconv_num2 += wcstombs_org(conv, &buf_ptr2, &buf_left2, to, to_left, args, num_args); if (unconv_num2 < 0) goto ret; ret: Xfree(buf); return (unconv_num1 + unconv_num2); } static int cstombs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { XPointer buf = Xmalloc((*from_left) * sizeof(wchar_t)); char *buf_ptr1 = buf; int buf_left1 = (*from_left); char *buf_ptr2 = buf_ptr1; int buf_left2; int unconv_num1 = 0, unconv_num2 = 0; unconv_num1 = cstowcs(conv, from, from_left, &buf_ptr1, &buf_left1, args, num_args); if (unconv_num1 < 0) goto ret; buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t); unconv_num2 += wcstombs_org(conv, &buf_ptr2, &buf_left2, to, to_left, args, num_args); if (unconv_num2 < 0) goto ret; ret: Xfree(buf); return (unconv_num1 + unconv_num2); } static int strtombs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; char *encoding; unsigned long mb, glyph_index; unsigned char ch; int length; int unconv_num = 0; CodeSet codeset; const char *inbufptr = *from; char *outbufptr = *to; int from_size = *from_left; while (*from_left && *to_left) { ch = *inbufptr++; (*from_left)--; /* null ? */ if (!ch) { if (outbufptr) {*outbufptr++ = '\0';} (*to_left)--; continue; } /* convert */ if (isleftside(ch)) { glyph_index = ch; codeset = _XlcGetCodeSetFromName(lcd, "ISO8859-1:GL"); } else { glyph_index = ch & GL; codeset = _XlcGetCodeSetFromName(lcd, "ISO8859-1:GR"); } if (!codeset) { unconv_num++; continue; } mb = gi_to_mb(glyph_index, codeset); if (codeset->parse_info) { Bool need_shift = False; switch (codeset->parse_info->type) { case E_LSL : if (codeset != state->GL_codeset) { need_shift = True; state->GL_codeset = codeset; } break; case E_LSR : if (codeset != state->GR_codeset) { need_shift = True; state->GR_codeset = codeset; } break; /* case E_SS */ default: need_shift = True; } /* output shift sequence */ if (need_shift) { encoding = codeset->parse_info->encoding; length = strlen(encoding); if (*to_left < length) break; if (outbufptr) { strncpy((char *)outbufptr, encoding, length); outbufptr += length; } (*to_left) -= length; } } /* output characters */ length = codeset->length; if (*to_left < length) break; if (outbufptr) { output_ulong_value(outbufptr, mb, length, XlcNONE); outbufptr += length; } (*to_left) -= length; } /* end of while */ *from = (XPointer) ((const char *) *from + from_size); *from_left = 0; *to = (XPointer) outbufptr; return unconv_num; } static int strtowcs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; XLCd lcd = state->lcd; unsigned char ch; unsigned long glyph_index; wchar_t wc; int unconv_num = 0; CodeSet codeset; const char *inbufptr = *from; wchar_t *outbufptr = (wchar_t *)*to; int from_size = *from_left; while (*from_left && *to_left) { ch = *inbufptr++; (*from_left)--; /* null ? */ if (!ch) { if (outbufptr) {*outbufptr++ = L'\0';} (*to_left)--; continue; } /* convert */ if (isleftside(ch)) { glyph_index = ch; codeset = _XlcGetCodeSetFromName(lcd, "ISO8859-1:GL"); } else { glyph_index = ch & GL; codeset = _XlcGetCodeSetFromName(lcd, "ISO8859-1:GR"); } if (!codeset) { unconv_num++; continue; } gi_to_wc(lcd, glyph_index, codeset, &wc); if (outbufptr) {*outbufptr++ = wc;} (*to_left)--; } /* end of while */ *from = (XPointer) ((const char *) *from + from_size); *from_left = 0; *to = (XPointer) outbufptr; return unconv_num; } static int stdc_strtowcs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); char *buf_ptr1 = buf; int buf_left1 = (*from_left) * MB_CUR_MAX; char *buf_ptr2 = buf_ptr1; int buf_left2; int unconv_num1 = 0, unconv_num2 = 0; unconv_num1 = strtombs(conv, from, from_left, &buf_ptr1, &buf_left1, args, num_args); if (unconv_num1 < 0) goto ret; buf_left2 = buf_ptr1 - buf_ptr2; unconv_num2 = stdc_mbstowcs(conv, &buf_ptr2, &buf_left2, to, to_left, args, num_args); if (unconv_num2 < 0) goto ret; ret: Xfree(buf); return (unconv_num1 + unconv_num2); } /* -------------------------------------------------------------------------- */ /* Close */ /* -------------------------------------------------------------------------- */ static void close_converter( XlcConv conv) { Xfree(conv->state); Xfree(conv->methods); Xfree(conv); } /* -------------------------------------------------------------------------- */ /* Open */ /* -------------------------------------------------------------------------- */ static XlcConv create_conv( XLCd lcd, XlcConvMethods methods) { XlcConv conv; State state; conv = Xcalloc(1, sizeof(XlcConvRec)); if (conv == NULL) return (XlcConv) NULL; conv->methods = Xmalloc(sizeof(XlcConvMethodsRec)); if (conv->methods == NULL) goto err; *conv->methods = *methods; conv->methods->reset = init_state; conv->state = Xcalloc(1, sizeof(StateRec)); if (conv->state == NULL) goto err; state = (State) conv->state; state->lcd = lcd; _XlcResetConverter(conv); return conv; err: close_converter(conv); return (XlcConv) NULL; } static XlcConvMethodsRec mbstocts_methods = { close_converter, mbstocts, NULL }; static XlcConv open_mbstocts( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &mbstocts_methods); } static XlcConvMethodsRec mbstostr_methods = { close_converter, mbstostr, NULL }; static XlcConv open_mbstostr( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &mbstostr_methods); } static XlcConvMethodsRec mbstocs_methods = { close_converter, mbstocs, NULL }; static XlcConv open_mbstocs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &mbstocs_methods); } static XlcConvMethodsRec mbtocs_methods = { close_converter, mbtocs, NULL }; static XlcConv open_mbtocs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &mbtocs_methods); } static XlcConvMethodsRec ctstombs_methods = { close_converter, ctstombs, NULL }; static XlcConv open_ctstombs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &ctstombs_methods); } static XlcConvMethodsRec cstombs_methods = { close_converter, cstombs, NULL }; static XlcConv open_cstombs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &cstombs_methods); } static XlcConvMethodsRec strtombs_methods = { close_converter, strtombs, NULL }; static XlcConv open_strtombs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &strtombs_methods); } #ifdef STDCVT static XlcConvMethodsRec stdc_mbstowcs_methods = { close_converter, stdc_mbstowcs, NULL }; static XlcConv open_stdc_mbstowcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &stdc_mbstowcs_methods); } static XlcConvMethodsRec stdc_wcstombs_methods = { close_converter, stdc_wcstombs, NULL }; static XlcConv open_stdc_wcstombs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &stdc_wcstombs_methods); } static XlcConvMethodsRec stdc_wcstocts_methods = { close_converter, stdc_wcstocts, NULL }; static XlcConv open_stdc_wcstocts( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &stdc_wcstocts_methods); } static XlcConvMethodsRec stdc_wcstostr_methods = { close_converter, stdc_wcstostr, NULL }; static XlcConv open_stdc_wcstostr( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &stdc_wcstostr_methods); } static XlcConvMethodsRec stdc_wcstocs_methods = { close_converter, stdc_wcstocs, NULL }; static XlcConv open_stdc_wcstocs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &stdc_wcstocs_methods); } static XlcConvMethodsRec stdc_wctocs_methods = { close_converter, stdc_wctocs, NULL }; static XlcConv open_stdc_wctocs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &stdc_wctocs_methods); } static XlcConvMethodsRec stdc_ctstowcs_methods = { close_converter, stdc_ctstowcs, NULL }; static XlcConv open_stdc_ctstowcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &stdc_ctstowcs_methods); } static XlcConvMethodsRec stdc_cstowcs_methods = { close_converter, stdc_cstowcs, NULL }; static XlcConv open_stdc_cstowcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &stdc_cstowcs_methods); } static XlcConvMethodsRec stdc_strtowcs_methods = { close_converter, stdc_strtowcs, NULL }; static XlcConv open_stdc_strtowcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &stdc_strtowcs_methods); } #endif /* STDCVT */ static XlcConvMethodsRec mbstowcs_methods = { close_converter, mbstowcs_org, NULL }; static XlcConv open_mbstowcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &mbstowcs_methods); } static XlcConvMethodsRec wcstombs_methods = { close_converter, wcstombs_org, NULL }; static XlcConv open_wcstombs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &wcstombs_methods); } static XlcConvMethodsRec wcstocts_methods = { close_converter, wcstocts, NULL }; static XlcConv open_wcstocts( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &wcstocts_methods); } static XlcConvMethodsRec wcstostr_methods = { close_converter, wcstostr, NULL }; static XlcConv open_wcstostr( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &wcstostr_methods); } static XlcConvMethodsRec wcstocs_methods = { close_converter, wcstocs, NULL }; static XlcConv open_wcstocs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &wcstocs_methods); } static XlcConvMethodsRec wctocs_methods = { close_converter, wctocs, NULL }; static XlcConv open_wctocs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &wctocs_methods); } static XlcConvMethodsRec ctstowcs_methods = { close_converter, ctstowcs, NULL }; static XlcConv open_ctstowcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &ctstowcs_methods); } static XlcConvMethodsRec cstowcs_methods = { close_converter, cstowcs, NULL }; static XlcConv open_cstowcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &cstowcs_methods); } static XlcConvMethodsRec strtowcs_methods = { close_converter, strtowcs, NULL }; static XlcConv open_strtowcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &strtowcs_methods); } /* -------------------------------------------------------------------------- */ /* Loader */ /* -------------------------------------------------------------------------- */ XLCd _XlcGenericLoader( const char *name) { XLCd lcd; #ifdef STDCVT XLCdGenericPart *gen; #endif lcd = _XlcCreateLC(name, _XlcGenericMethods); if (lcd == NULL) return lcd; default_GL_charset = _XlcGetCharSet("ISO8859-1:GL"); default_GR_charset = _XlcGetCharSet("ISO8859-1:GR"); _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCompoundText, open_mbstocts); _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_mbstostr); _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_mbstocs); _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_mbtocs); _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte, open_ctstombs); _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtombs); _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstombs); #ifdef STDCVT gen = XLC_GENERIC_PART(lcd); if (gen->use_stdc_env != True) { #endif _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_mbstowcs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_wcstombs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCompoundText, open_wcstocts); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_wctocs); _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar, open_ctstowcs); _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_strtowcs); _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); #ifdef STDCVT } #endif #ifdef STDCVT if (gen->use_stdc_env == True) { _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_stdc_mbstowcs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_stdc_wcstombs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCompoundText, open_stdc_wcstocts); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_stdc_wcstostr); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_stdc_wcstocs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_stdc_wctocs); _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar, open_stdc_ctstowcs); _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_stdc_strtowcs); _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_stdc_cstowcs); } #endif _XlcAddUtf8Converters(lcd); return lcd; } nx-libs-3.5.99.23/nx-X11/lib/modules/lc/gen/Makefile.am0000644000000000000000000000103713614532331016725 0ustar NULL = noinst_LTLIBRARIES = libxlibi18n.la AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/include/X11 \ -I$(top_builddir)/include \ -I$(top_builddir)/include/X11 \ -I$(top_srcdir)/src/xcms \ -I$(top_srcdir)/src/xkb \ -I$(top_srcdir)/src/xlibi18n \ -I$(top_srcdir)/../exports/include \ -D_GNU_SOURCE \ $(NULL) AM_CFLAGS = \ $(X11_CFLAGS) \ $(BIGFONT_CFLAGS) \ $(CWARNFLAGS) \ $(NULL) xlibi18n_la_SOURCES = \ lcGenConv.c \ $(NULL) libxlibi18n_la_SOURCES = $(xlibi18n_la_SOURCES) nx-libs-3.5.99.23/nx-X11/lib/modules/lc/Makefile.am0000644000000000000000000000002713614532331016152 0ustar SUBDIRS = Utf8 def gen nx-libs-3.5.99.23/nx-X11/lib/modules/lc/Utf8/lcUTF8Load.c0000644000000000000000000000442613614532331016764 0ustar /****************************************************************** Copyright 1993 by SunSoft, Inc. Copyright 1999-2000 by Bruno Haible Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of SunSoft, Inc. and Bruno Haible not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. SunSoft, Inc. and Bruno Haible make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. SunSoft Inc. AND Bruno Haible DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SunSoft, Inc. OR Bruno Haible BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* * This file contains the UTF-8 locale loader. * Supports: all locales with codeset UTF-8. * Platforms: all systems. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "XlcPubI.h" #include "XlcGeneric.h" XLCd _XlcUtf8Loader( const char *name) { XLCd lcd; lcd = _XlcCreateLC(name, _XlcGenericMethods); if (lcd == (XLCd) NULL) return lcd; /* The official IANA name for UTF-8 is "UTF-8" in upper case with a dash. */ if (!XLC_PUBLIC_PART(lcd)->codeset) { _XlcDestroyLC(lcd); return (XLCd) NULL; } else if (!_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "UTF-8")) { _XlcAddUtf8LocaleConverters(lcd); } else if (!_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "GB18030")) { _XlcAddGB18030LocaleConverters(lcd); } else { _XlcDestroyLC(lcd); return (XLCd) NULL; } _XlcAddUtf8Converters(lcd); return lcd; } nx-libs-3.5.99.23/nx-X11/lib/modules/lc/Utf8/Makefile.am0000644000000000000000000000111013614532331016772 0ustar NULL = noinst_LTLIBRARIES = libxlcUTF8Load.la AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/include/X11 \ -I$(top_builddir)/include \ -I$(top_builddir)/include/X11 \ -I$(top_srcdir)/src/xcms \ -I$(top_srcdir)/src/xkb \ -I$(top_srcdir)/src/xlibi18n \ -I$(top_srcdir)/../exports/include \ -D_GNU_SOURCE \ $(NULL) AM_CFLAGS = \ $(X11_CFLAGS) \ $(BIGFONT_CFLAGS) \ $(MALLOC_ZERO_CFLAGS) \ $(CWARNFLAGS) \ $(NULL) xlcUTF8Load_la_SOURCES = \ lcUTF8Load.c \ $(NULL) libxlcUTF8Load_la_SOURCES = $(xlcUTF8Load_la_SOURCES) nx-libs-3.5.99.23/nx-X11/lib/modules/Makefile.am0000644000000000000000000000002313614532331015550 0ustar SUBDIRS = im lc om nx-libs-3.5.99.23/nx-X11/lib/modules/om/generic/Makefile.am0000644000000000000000000000132313614532331017603 0ustar NULL = AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/include/X11 \ -I$(top_builddir)/include \ -I$(top_builddir)/include/X11 \ -I$(top_srcdir)/src/xcms \ -I$(top_srcdir)/src/xkb \ -I$(top_srcdir)/src/xlibi18n \ -I$(top_srcdir)/src \ -I$(top_srcdir)/../exports/include \ -D_GNU_SOURCE \ $(NULL) AM_CFLAGS = \ $(X11_CFLAGS) \ $(BIGFONT_CFLAGS) \ $(MALLOC_ZERO_CFLAGS) \ $(CWARNFLAGS) \ $(NULL) noinst_LTLIBRARIES = libxomGeneric.la xomGeneric_la_SOURCES = \ omDefault.c \ omGeneric.c \ omImText.c \ omText.c \ omTextEsc.c \ omTextExt.c \ omTextPer.c \ omXChar.c \ $(NULL) libxomGeneric_la_SOURCES = $(xomGeneric_la_SOURCES) nx-libs-3.5.99.23/nx-X11/lib/modules/om/generic/omDefault.c0000644000000000000000000002424113614532331017637 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ /* * (c) Copyright 1995 FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XomGeneric.h" #include #include #include #define DefineLocalBuf char local_buf[BUFSIZ] #define AllocLocalBuf(length) (length > BUFSIZ ? (char *)Xmalloc(length) : local_buf) #define FreeLocalBuf(ptr) if (ptr != local_buf) Xfree(ptr) static Bool wcs_to_mbs( XOC oc, char *to, _Xconst wchar_t *from, int length) { XlcConv conv; int to_left, ret; conv = _XomInitConverter(oc, XOMWideChar); if (conv == NULL) return False; to_left = length; ret = _XlcConvert(conv, (XPointer *) &from, &length, (XPointer *) &to, &to_left, NULL, 0); if (ret != 0 || length > 0) return False; return True; } static Bool utf8_to_mbs( XOC oc, char *to, _Xconst char *from, int length) { XlcConv conv; int to_left, ret; conv = _XomInitConverter(oc, XOMUtf8String); if (conv == NULL) return False; to_left = length; ret = _XlcConvert(conv, (XPointer *) &from, &length, (XPointer *) &to, &to_left, NULL, 0); if (ret != 0 || length > 0) return False; return True; } int _XmbDefaultTextEscapement(XOC oc, _Xconst char *text, int length) { return XTextWidth(*oc->core.font_info.font_struct_list, text, length); } int _XwcDefaultTextEscapement(XOC oc, _Xconst wchar_t *text, int length) { DefineLocalBuf; char *buf = AllocLocalBuf(length); int ret; if (buf == NULL) return 0; if (wcs_to_mbs(oc, buf, text, length) == False) { ret = 0; goto err; } ret = _XmbDefaultTextEscapement(oc, buf, length); err: FreeLocalBuf(buf); return ret; } int _Xutf8DefaultTextEscapement(XOC oc, _Xconst char *text, int length) { DefineLocalBuf; char *buf = AllocLocalBuf(length); int ret; if (buf == NULL) return 0; if (utf8_to_mbs(oc, buf, text, length) == False) { ret = 0; goto err; } ret = _XmbDefaultTextEscapement(oc, buf, length); err: FreeLocalBuf(buf); return ret; } int _XmbDefaultTextExtents(XOC oc, _Xconst char *text, int length, XRectangle *overall_ink, XRectangle *overall_logical) { int direction, logical_ascent, logical_descent; XCharStruct overall; XTextExtents(*oc->core.font_info.font_struct_list, text, length, &direction, &logical_ascent, &logical_descent, &overall); if (overall_ink) { overall_ink->x = overall.lbearing; overall_ink->y = -(overall.ascent); overall_ink->width = overall.rbearing - overall.lbearing; overall_ink->height = overall.ascent + overall.descent; } if (overall_logical) { overall_logical->x = 0; overall_logical->y = -(logical_ascent); overall_logical->width = overall.width; overall_logical->height = logical_ascent + logical_descent; } return overall.width; } int _XwcDefaultTextExtents(XOC oc, _Xconst wchar_t *text, int length, XRectangle *overall_ink, XRectangle *overall_logical) { DefineLocalBuf; char *buf = AllocLocalBuf(length); int ret; if (buf == NULL) return 0; if (wcs_to_mbs(oc, buf, text, length) == False) { ret = 0; goto err; } ret = _XmbDefaultTextExtents(oc, buf, length, overall_ink, overall_logical); err: FreeLocalBuf(buf); return ret; } int _Xutf8DefaultTextExtents(XOC oc, _Xconst char *text, int length, XRectangle *overall_ink, XRectangle *overall_logical) { DefineLocalBuf; char *buf = AllocLocalBuf(length); int ret; if (buf == NULL) return 0; if (utf8_to_mbs(oc, buf, text, length) == False) { ret = 0; goto err; } ret = _XmbDefaultTextExtents(oc, buf, length, overall_ink, overall_logical); err: FreeLocalBuf(buf); return ret; } Status _XmbDefaultTextPerCharExtents(XOC oc, _Xconst char *text, int length, XRectangle *ink_buf, XRectangle *logical_buf, int buf_size, int *num_chars, XRectangle *overall_ink, XRectangle *overall_logical) { XFontStruct *font = *oc->core.font_info.font_struct_list; XCharStruct *def, *cs, overall; Bool first = True; if (buf_size < length) return 0; bzero((char *) &overall, sizeof(XCharStruct)); *num_chars = 0; CI_GET_DEFAULT_INFO_1D(font, def) while (length-- > 0) { CI_GET_CHAR_INFO_1D(font, *text, def, cs) text++; if (cs == NULL) continue; ink_buf->x = overall.width + cs->lbearing; ink_buf->y = -(cs->ascent); ink_buf->width = cs->rbearing - cs->lbearing; ink_buf->height = cs->ascent + cs->descent; ink_buf++; logical_buf->x = overall.width; logical_buf->y = -(font->ascent); logical_buf->width = cs->width; logical_buf->height = font->ascent + font->descent; logical_buf++; if (first) { overall = *cs; first = False; } else { overall.ascent = max(overall.ascent, cs->ascent); overall.descent = max(overall.descent, cs->descent); overall.lbearing = min(overall.lbearing, overall.width + cs->lbearing); overall.rbearing = max(overall.rbearing, overall.width + cs->rbearing); overall.width += cs->width; } (*num_chars)++; } if (overall_ink) { overall_ink->x = overall.lbearing; overall_ink->y = -(overall.ascent); overall_ink->width = overall.rbearing - overall.lbearing; overall_ink->height = overall.ascent + overall.descent; } if (overall_logical) { overall_logical->x = 0; overall_logical->y = -(font->ascent); overall_logical->width = overall.width; overall_logical->height = font->ascent + font->descent; } return 1; } Status _XwcDefaultTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length, XRectangle *ink_buf, XRectangle *logical_buf, int buf_size, int *num_chars, XRectangle *overall_ink, XRectangle *overall_logical) { DefineLocalBuf; char *buf = AllocLocalBuf(length); Status ret; if (buf == NULL) return 0; if (wcs_to_mbs(oc, buf, text, length) == False) { ret = 0; goto err; } ret = _XmbDefaultTextPerCharExtents(oc, buf, length, ink_buf, logical_buf, buf_size, num_chars, overall_ink, overall_logical); err: FreeLocalBuf(buf); return ret; } Status _Xutf8DefaultTextPerCharExtents(XOC oc, _Xconst char *text, int length, XRectangle *ink_buf, XRectangle *logical_buf, int buf_size, int *num_chars, XRectangle *overall_ink, XRectangle *overall_logical) { DefineLocalBuf; char *buf = AllocLocalBuf(length); Status ret; if (buf == NULL) return 0; if (utf8_to_mbs(oc, buf, text, length) == False) { ret = 0; goto err; } ret = _XmbDefaultTextPerCharExtents(oc, buf, length, ink_buf, logical_buf, buf_size, num_chars, overall_ink, overall_logical); err: FreeLocalBuf(buf); return ret; } int _XmbDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length) { XFontStruct *font = *oc->core.font_info.font_struct_list; XSetFont(dpy, gc, font->fid); XDrawString(dpy, d, gc, x, y, text, length); return XTextWidth(font, text, length); } int _XwcDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst wchar_t *text, int length) { DefineLocalBuf; char *buf = AllocLocalBuf(length); int ret; if (buf == NULL) return 0; if (wcs_to_mbs(oc, buf, text, length) == False) { ret = 0; goto err; } ret = _XmbDefaultDrawString(dpy, d, oc, gc, x, y, buf, length); err: FreeLocalBuf(buf); return ret; } int _Xutf8DefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length) { DefineLocalBuf; char *buf = AllocLocalBuf(length); int ret; if (buf == NULL) return 0; if (utf8_to_mbs(oc, buf, text, length) == False) { ret = 0; goto err; } ret = _XmbDefaultDrawString(dpy, d, oc, gc, x, y, buf, length); err: FreeLocalBuf(buf); return ret; } void _XmbDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length) { XSetFont(dpy, gc, (*oc->core.font_info.font_struct_list)->fid); XDrawImageString(dpy, d, gc, x, y, text, length); } void _XwcDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst wchar_t *text, int length) { DefineLocalBuf; char *buf = AllocLocalBuf(length); if (buf == NULL) return; if (wcs_to_mbs(oc, buf, text, length) == False) goto err; _XmbDefaultDrawImageString(dpy, d, oc, gc, x, y, buf, length); err: FreeLocalBuf(buf); } void _Xutf8DefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length) { DefineLocalBuf; char *buf = AllocLocalBuf(length); if (buf == NULL) return; if (utf8_to_mbs(oc, buf, text, length) == False) goto err; _XmbDefaultDrawImageString(dpy, d, oc, gc, x, y, buf, length); err: FreeLocalBuf(buf); } nx-libs-3.5.99.23/nx-X11/lib/modules/om/generic/omGeneric.c0000644000000000000000000014624713614532331017642 0ustar /* #define FONTDEBUG */ /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ /* * Copyright 1995 by FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. * * Modifier: Takanori Tateno FUJITSU LIMITED * */ /* * Fixed the algorithms in parse_fontname() and parse_fontdata() * to improve the logic for determining which font should be * returned for a given CharSet. We even added some comments * so that you can figure out what in the heck we're doing. We * realize this is a departure from the norm, but hey, we're * rebels! :-) :-) * * Modifiers: Jeff Walls, Paul Anderson: HEWLETT-PACKARD */ /* * Cleaned up mess, removed some blabla * Egbert Eich, SuSE Linux AG */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XomGeneric.h" #include "XlcGeneric.h" #include #include #include #include #include #define MAXFONTS 100 #define PIXEL_SIZE_FIELD 7 #define POINT_SIZE_FIELD 8 #define CHARSET_ENCODING_FIELD 14 #define XLFD_MAX_LEN 255 /* For VW/UDC start */ static FontData init_fontdata( FontData font_data, int font_data_count) { FontData fd; int i; fd = Xcalloc(font_data_count, sizeof(FontDataRec)); if(fd == (FontData) NULL) return False; for(i = 0 ; i < font_data_count ; i++) fd[i] = font_data[i]; return fd; } static VRotate init_vrotate( FontData font_data, int font_data_count, int type, CodeRange code_range, int code_range_num) { VRotate vrotate; int i; if(type == VROTATE_NONE) return (VRotate)NULL; vrotate = Xcalloc(font_data_count, sizeof(VRotateRec)); if(vrotate == (VRotate) NULL) return False; for(i = 0 ; i < font_data_count ; i++) { vrotate[i].charset_name = font_data[i].name; vrotate[i].side = font_data[i].side; if(type == VROTATE_PART) { vrotate[i].num_cr = code_range_num; vrotate[i].code_range = code_range; } } return vrotate; } static Bool init_fontset( XOC oc) { XOCGenericPart *gen; FontSet font_set; OMData data; int count; count = XOM_GENERIC(oc->core.om)->data_num; data = XOM_GENERIC(oc->core.om)->data; font_set = Xcalloc(count, sizeof(FontSetRec)); if (font_set == NULL) return False; gen = XOC_GENERIC(oc); gen->font_set_num = count; gen->font_set = font_set; for ( ; count-- > 0; data++, font_set++) { font_set->charset_count = data->charset_count; font_set->charset_list = data->charset_list; if((font_set->font_data = init_fontdata(data->font_data, data->font_data_count)) == NULL) goto err; font_set->font_data_count = data->font_data_count; if((font_set->substitute = init_fontdata(data->substitute, data->substitute_num)) == NULL) goto err; font_set->substitute_num = data->substitute_num; if((font_set->vmap = init_fontdata(data->vmap, data->vmap_num)) == NULL) goto err; font_set->vmap_num = data->vmap_num; if(data->vrotate_type != VROTATE_NONE) { /* A vrotate member is specified primary font data */ /* as initial value. */ if((font_set->vrotate = init_vrotate(data->font_data, data->font_data_count, data->vrotate_type, data->vrotate, data->vrotate_num)) == NULL) goto err; font_set->vrotate_num = data->font_data_count; } } return True; err: Xfree(font_set->font_data); Xfree(font_set->substitute); Xfree(font_set->vmap); Xfree(font_set->vrotate); Xfree(font_set); gen->font_set = (FontSet) NULL; gen->font_set_num = 0; return False; } /* For VW/UDC end */ static char * get_prop_name( Display *dpy, XFontStruct *fs) { unsigned long fp; if (XGetFontProperty(fs, XA_FONT, &fp)) return XGetAtomName(dpy, fp); return (char *) NULL; } /* For VW/UDC start */ static Bool load_fontdata( XOC oc, FontData font_data, int font_data_num) { Display *dpy = oc->core.om->core.display; FontData fd = font_data; if(font_data == NULL) return(True); for( ; font_data_num-- ; fd++) { if(fd->xlfd_name != (char *) NULL && fd->font == NULL) { fd->font = XLoadQueryFont(dpy, fd->xlfd_name); if (fd->font == NULL){ return False; } } } return True; } static Bool load_fontset_data( XOC oc, FontSet font_set) { Display *dpy = oc->core.om->core.display; if(font_set->font_name == (char *)NULL) return False ; /* If font_set->font is not NULL, it contains the *best* * match font for this FontSet. * -- jjw/pma (HP) */ if(font_set->font == NULL) { font_set->font = XLoadQueryFont(dpy, font_set->font_name); if (font_set->font == NULL){ return False; } } return True; } static Bool load_font( XOC oc) { XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set = gen->font_set; int num = gen->font_set_num; for ( ; num-- > 0; font_set++) { if (font_set->font_name == NULL) continue; if (load_fontset_data (oc, font_set) != True) return False; #ifndef TESTVERSION if(load_fontdata(oc, font_set->font_data, font_set->font_data_count) != True) return False; if(load_fontdata(oc, font_set->substitute, font_set->substitute_num) != True) return False; #endif /* Add 1996.05.20 */ if( oc->core.orientation == XOMOrientation_TTB_RTL || oc->core.orientation == XOMOrientation_TTB_LTR ){ if (font_set->vpart_initialize == 0) { load_fontdata(oc, font_set->vmap, font_set->vmap_num); load_fontdata(oc, (FontData) font_set->vrotate, font_set->vrotate_num); font_set->vpart_initialize = 1; } } if (font_set->font->min_byte1 || font_set->font->max_byte1) font_set->is_xchar2b = True; else font_set->is_xchar2b = False; } return True; } /* For VW/UDC end */ static Bool load_font_info( XOC oc) { Display *dpy = oc->core.om->core.display; XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set = gen->font_set; char **fn_list; int fn_num, num = gen->font_set_num; for ( ; num-- > 0; font_set++) { if (font_set->font_name == NULL) continue; if (font_set->info == NULL) { fn_list = XListFontsWithInfo(dpy, font_set->font_name, 1, &fn_num, &font_set->info); if (font_set->info == NULL) return False; XFreeFontNames(fn_list); } } return True; } /* For Vertical Writing start */ static void check_fontset_extents( XCharStruct *overall, int *logical_ascent, int *logical_descent, XFontStruct *font) { overall->lbearing = min(overall->lbearing, font->min_bounds.lbearing); overall->rbearing = max(overall->rbearing, font->max_bounds.rbearing); overall->ascent = max(overall->ascent, font->max_bounds.ascent); overall->descent = max(overall->descent, font->max_bounds.descent); overall->width = max(overall->width, font->max_bounds.width); *logical_ascent = max(*logical_ascent, font->ascent); *logical_descent = max(*logical_descent, font->descent); } /* For Vertical Writing end */ static void set_fontset_extents( XOC oc) { XRectangle *ink = &oc->core.font_set_extents.max_ink_extent; XRectangle *logical = &oc->core.font_set_extents.max_logical_extent; XFontStruct **font_list, *font; XCharStruct overall; int logical_ascent, logical_descent; int num = oc->core.font_info.num_font; font_list = oc->core.font_info.font_struct_list; font = *font_list++; overall = font->max_bounds; overall.lbearing = font->min_bounds.lbearing; logical_ascent = font->ascent; logical_descent = font->descent; /* For Vertical Writing start */ while (--num > 0) { font = *font_list++; check_fontset_extents(&overall, &logical_ascent, &logical_descent, font); } { XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set = gen->font_set; FontData font_data; int font_set_num = gen->font_set_num; int font_data_count; for( ; font_set_num-- ; font_set++) { if(font_set->vmap_num > 0) { font_data = font_set->vmap; font_data_count = font_set->vmap_num; for( ; font_data_count-- ; font_data++) { if(font_data->font != NULL) { check_fontset_extents(&overall, &logical_ascent, &logical_descent, font_data->font); } } } if(font_set->vrotate_num > 0 && font_set->vrotate != NULL) { font_data = (FontData) font_set->vrotate; font_data_count = font_set->vrotate_num; for( ; font_data_count-- ; font_data++) { if(font_data->font != NULL) { check_fontset_extents(&overall, &logical_ascent, &logical_descent, font_data->font); } } } } } /* For Vertical Writing start */ ink->x = overall.lbearing; ink->y = -(overall.ascent); ink->width = overall.rbearing - overall.lbearing; ink->height = overall.ascent + overall.descent; logical->x = 0; logical->y = -(logical_ascent); logical->width = overall.width; logical->height = logical_ascent + logical_descent; } static Bool init_core_part( XOC oc) { XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set; int font_set_num; XFontStruct **font_struct_list; char **font_name_list, *font_name_buf; int count, length; font_set = gen->font_set; font_set_num = gen->font_set_num; count = length = 0; for ( ; font_set_num-- > 0; font_set++) { if (font_set->font_name == NULL) continue; length += strlen(font_set->font_name) + 1; count++; } if (count == 0) return False; font_struct_list = Xmalloc(sizeof(XFontStruct *) * count); if (font_struct_list == NULL) return False; font_name_list = Xmalloc(sizeof(char *) * count); if (font_name_list == NULL) goto err; font_name_buf = Xmalloc(length); if (font_name_buf == NULL) goto err; oc->core.font_info.num_font = count; oc->core.font_info.font_name_list = font_name_list; oc->core.font_info.font_struct_list = font_struct_list; font_set = gen->font_set; font_set_num = gen->font_set_num; for (count = 0; font_set_num-- > 0; font_set++) { if (font_set->font_name == NULL) continue; font_set->id = count; if (font_set->font) *font_struct_list++ = font_set->font; else *font_struct_list++ = font_set->info; strcpy(font_name_buf, font_set->font_name); Xfree(font_set->font_name); *font_name_list++ = font_set->font_name = font_name_buf; font_name_buf += strlen(font_name_buf) + 1; count++; } set_fontset_extents(oc); return True; err: Xfree(font_name_list); Xfree(font_struct_list); return False; } static char * get_font_name( XOC oc, char *pattern) { char **list, *name; int count = 0; list = XListFonts(oc->core.om->core.display, pattern, 1, &count); if (list == NULL) return NULL; name = strdup(*list); XFreeFontNames(list); return name; } /* For VW/UDC start*/ static char * get_rotate_fontname( char *font_name) { char *pattern = NULL, *ptr = NULL; char *fields[CHARSET_ENCODING_FIELD]; char str_pixel[32], str_point[4]; char *rotate_font_ptr = NULL; int pixel_size = 0; int field_num = 0, len = 0; if(font_name == (char *) NULL || (len = strlen(font_name)) <= 0 || len > XLFD_MAX_LEN) return NULL; pattern = strdup(font_name); if(!pattern) return NULL; memset(fields, 0, sizeof(char *) * 14); ptr = pattern; while(isspace(*ptr)) { ptr++; } if(*ptr == '-') ptr++; for(field_num = 0 ; field_num < CHARSET_ENCODING_FIELD && ptr && *ptr ; ptr++, field_num++) { fields[field_num] = ptr; if((ptr = strchr(ptr, '-'))) { *ptr = '\0'; } else { field_num++; /* Count last field */ break; } } if(field_num < CHARSET_ENCODING_FIELD) goto free_pattern; /* Pixel Size field : fields[6] */ for(ptr = fields[PIXEL_SIZE_FIELD - 1] ; ptr && *ptr; ptr++) { if(!isdigit(*ptr)) { if(*ptr == '['){ /* 960730 */ strcpy(pattern, font_name); return(pattern); } goto free_pattern; } } pixel_size = atoi(fields[PIXEL_SIZE_FIELD - 1]); snprintf(str_pixel, sizeof(str_pixel), "[ 0 ~%d %d 0 ]", pixel_size, pixel_size); fields[6] = str_pixel; /* Point Size field : fields[7] */ strcpy(str_point, "*"); fields[POINT_SIZE_FIELD - 1] = str_point; len = 0; for (field_num = 0; field_num < CHARSET_ENCODING_FIELD && fields[field_num]; field_num++) { len += 1 + strlen(fields[field_num]); } /* Max XLFD length is 255 */ if (len > XLFD_MAX_LEN) goto free_pattern; rotate_font_ptr = Xmalloc(len + 1); if(!rotate_font_ptr) goto free_pattern; rotate_font_ptr[0] = '\0'; for(field_num = 0 ; field_num < CHARSET_ENCODING_FIELD && fields[field_num] ; field_num++) { strcat(rotate_font_ptr, "-"); strcat(rotate_font_ptr, fields[field_num]); } free_pattern: Xfree(pattern); return rotate_font_ptr; } static Bool is_match_charset( FontData font_data, char *font_name) { char *last; int length, name_len; name_len = strlen(font_name); last = font_name + name_len; length = strlen(font_data->name); if (length > name_len) return False; if (_XlcCompareISOLatin1(last - length, font_data->name) == 0) return True; return False; } static int parse_all_name( XOC oc, FontData font_data, char *pattern) { #ifdef OLDCODE if(is_match_charset(font_data, pattern) != True) return False; font_data->xlfd_name = strdup(pattern); if(font_data->xlfd_name == NULL) return (-1); return True; #else /* OLDCODE */ Display *dpy = oc->core.om->core.display; char **fn_list = NULL, *prop_fname = NULL; int list_num; XFontStruct *fs_list; if(is_match_charset(font_data, pattern) != True) { /* * pattern should not contain any wildcard (execpt '?') * this was probably added to make this case insensitive. */ if ((fn_list = XListFontsWithInfo(dpy, pattern, MAXFONTS, &list_num, &fs_list)) == NULL) { return False; } /* shouldn't we loop here ? */ else if ((prop_fname = get_prop_name(dpy, fs_list)) == NULL) { XFreeFontInfo(fn_list, fs_list, list_num); return False; } else if ((is_match_charset(font_data, prop_fname) != True)) { XFree(prop_fname); XFreeFontInfo(fn_list, fs_list, list_num); return False; } else { font_data->xlfd_name = prop_fname; XFreeFontInfo(fn_list, fs_list, list_num); return True; } } font_data->xlfd_name = strdup(pattern); if(font_data->xlfd_name == NULL) return (-1); return True; #endif /* OLDCODE */ } static int parse_omit_name( XOC oc, FontData font_data, char *pattern) { char* last = (char *) NULL; char* base_name; char buf[XLFD_MAX_LEN + 1]; int length = 0; int num_fields; /* * If the font specified by "pattern" is expandable to be * a member of "font_data"'s FontSet, we've found a match. */ if(is_match_charset(font_data, pattern) == True) { if ((font_data->xlfd_name = get_font_name(oc, pattern)) != NULL) { return True; } } length = strlen (pattern); if (length > XLFD_MAX_LEN) return -1; strcpy(buf, pattern); last = buf + length - 1; /* Replace the original encoding with the encoding for this FontSet. */ /* Figure out how many fields have been specified in this xlfd. */ for (num_fields = 0, base_name = buf; *base_name != '\0'; base_name++) if (*base_name == '-') num_fields++; switch (num_fields) { case 12: /* This is the best way to have specifed the fontset. In this * case, there is no original encoding. E.g., * -*-*-*-*-*-*-14-*-*-*-*-* * To this, we'll append a dash: * -*-*-*-*-*-*-14-*-*-*-*-*- * then append the encoding to get: * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 */ /* * Take care of: * -*-*-*-*-*-*-14-*-*-*-*- */ if (*(last) == '-') *++last = '*'; *++last = '-'; break; case 13: /* Got the charset, not the encoding, zap the charset In this * case, there is no original encoding, but there is a charset. E.g., * -*-*-*-*-*-*-14-*-*-*-*-*-jisx0212.1990 * To this, we remove the charset: * -*-*-*-*-*-*-14-*-*-*-*-*- * then append the new encoding to get: * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 */ last = strrchr (buf, '-'); num_fields = 12; break; case 14: /* Both the charset and the encoding are specified. Get rid * of them so that we can append the new charset encoding. E.g., * -*-*-*-*-*-*-14-*-*-*-*-*-jisx0212.1990-0 * To this, we'll remove the encoding and charset to get: * -*-*-*-*-*-*-14-*-*-*-*-*- * then append the new encoding to get: * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 */ last = strrchr (buf, '-'); *last = '\0'; last = strrchr (buf, '-'); num_fields = 12; break; default: if (*last != '-') *++last = '-'; break; } /* At this point, "last" is pointing to the last "-" in the * xlfd, and all xlfd's at this point take a form similar to: * -*-*-*-*-*-*-14-*-*-*-*-*- * (i.e., no encoding). * After the strcpy, we'll end up with something similar to: * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 * * If the modified font is found in the current FontSet, * we've found a match. */ last++; if ((last - buf) + strlen(font_data->name) > XLFD_MAX_LEN) return -1; strcpy(last, font_data->name); if ((font_data->xlfd_name = get_font_name(oc, buf)) != NULL) return True; /* This may mot be needed anymore as XListFonts() takes care of this */ if (num_fields < 12) { if ((last - buf) > (XLFD_MAX_LEN - 2)) return -1; *last = '*'; *(last + 1) = '-'; strcpy(last + 2, font_data->name); num_fields++; last+=2; if ((font_data->xlfd_name = get_font_name(oc, buf)) != NULL) return True; } return False; } typedef enum{C_PRIMARY, C_SUBSTITUTE, C_VMAP, C_VROTATE } ClassType; static int parse_fontdata( XOC oc, FontSet font_set, FontData font_data, int font_data_count, char **name_list, int name_list_count, ClassType class, FontDataRec *font_data_return) { char **cur_name_list = name_list; char *font_name = (char *) NULL; char *pattern = (char *) NULL; int found_num = 0, ret = 0; int count = name_list_count; if(name_list == NULL || count <= 0) { return False; } if(font_data == NULL || font_data_count <= 0) { return False; } /* Loop through each font encoding defined in the "font_data" FontSet. */ for ( ; font_data_count-- > 0; font_data++) { Bool is_found = False; font_name = (char *) NULL; count = name_list_count; cur_name_list = name_list; /* * Loop through each font specified by the user * in the call to XCreateFontset(). */ while (count-- > 0) { pattern = *cur_name_list++; if (pattern == NULL || *pattern == '\0') continue; #ifdef FONTDEBUG fprintf(stderr,"Font pattern: %s %s\n", pattern,font_data->name); #endif /* * If the current font is fully specified (i.e., the * xlfd contains no wildcards) and the font exists on * the X Server, we have a match. */ if (strchr(pattern, '*') == NULL && (font_name = get_font_name(oc, pattern))) { /* * Find the full xlfd name for this font. If the font is * already in xlfd format, it is simply returned. If the * font is an alias for another font, the xlfd of the * aliased font is returned. */ ret = parse_all_name(oc, font_data, font_name); Xfree(font_name); if (ret == -1) return -1; if (ret == False) continue; /* * Since there was an exact match of a fully-specified font * or a font alias, we can return now since the desired font * was found for the current font encoding for this FontSet. * * Previous implementations of this algorithm would * not return here. Instead, they continued searching * through the font encodings for this FontSet. The side-effect * of that behavior is you may return a "substitute" match * instead of an "exact" match. We believe there should be a * preference on exact matches. Therefore, as soon as we * find one, we bail. * * Also, previous implementations seemed to think it was * important to find either a primary or substitute font * for each Font encoding in the FontSet before returning an * acceptable font. We don't believe this is necessary. * All the client cares about is finding a reasonable font * for what was passed in. If we find an exact match, * there's no reason to look any further. * * -- jjw/pma (HP) */ if (font_data_return) { font_data_return->xlfd_name = strdup(font_data->xlfd_name); if (!font_data_return->xlfd_name) return -1; font_data_return->side = font_data->side; } #ifdef FONTDEBUG fprintf(stderr,"XLFD name: %s\n",font_data->xlfd_name); #endif return True; } /* * If the font name is not fully specified * (i.e., it has wildcards), we have more work to do. * See the comments in parse_omit_name() * for the list of things to do. */ ret = parse_omit_name(oc, font_data, pattern); if (ret == -1) return -1; if (ret == False) continue; /* * A font which matched the wild-carded specification was found. * Only update the return data if a font has not yet been found. * This maintains the convention that FontSets listed higher in * a CodeSet in the Locale Database have higher priority than * those FontSets listed lower in the CodeSet. In the following * example: * * fs1 { * charset HP-JIS:GR * font JISX0208.1990-0:GL;\ * JISX0208.1990-1:GR;\ * JISX0208.1983-0:GL;\ * JISX0208.1983-1:GR * } * * a font found in the JISX0208.1990-0 FontSet will have a * higher priority than a font found in the JISX0208.1983-0 * FontSet. */ if (font_data_return && font_data_return->xlfd_name == NULL) { #ifdef FONTDEBUG fprintf(stderr,"XLFD name: %s\n",font_data->xlfd_name); #endif font_data_return->xlfd_name = strdup(font_data->xlfd_name); if (!font_data_return->xlfd_name) return -1; font_data_return->side = font_data->side; } found_num++; is_found = True; break; } switch(class) { case C_PRIMARY: if(is_found == False) { /* * Did not find a font for the current FontSet. Check the * FontSet's "substitute" font for a match. If we find a * match, we'll keep searching in hopes of finding an exact * match later down the FontSet list. * * when we return and we have found a font font_data_return * contains the first (ie. best) match no matter if this * is a C_PRIMARY or a C_SUBSTITUTE font */ ret = parse_fontdata(oc, font_set, font_set->substitute, font_set->substitute_num, name_list, name_list_count, C_SUBSTITUTE, font_data_return); if (ret == -1) return -1; if (ret == False) continue; found_num++; is_found = True; } #ifdef TESTVERSION else return True; #endif break; case C_SUBSTITUTE: case C_VMAP: if(is_found == True) return True; break; case C_VROTATE: if(is_found == True) { char *rotate_name; if((rotate_name = get_rotate_fontname(font_data->xlfd_name)) != NULL) { Xfree(font_data->xlfd_name); font_data->xlfd_name = rotate_name; return True; } Xfree(font_data->xlfd_name); font_data->xlfd_name = NULL; return False; } break; } } if(class == C_PRIMARY && found_num >= 1) return True; return False; } static int parse_vw( XOC oc, FontSet font_set, char **name_list, int count) { FontData vmap = font_set->vmap; VRotate vrotate = font_set->vrotate; int vmap_num = font_set->vmap_num; int vrotate_num = font_set->vrotate_num; int ret = 0, i = 0; if(vmap_num > 0) { if(parse_fontdata(oc, font_set, vmap, vmap_num, name_list, count, C_VMAP,NULL) == -1) return (-1); } if(vrotate_num > 0) { ret = parse_fontdata(oc, font_set, (FontData) vrotate, vrotate_num, name_list, count, C_VROTATE, NULL); if(ret == -1) { return (-1); } else if(ret == False) { CodeRange code_range; int num_cr; int sub_num = font_set->substitute_num; code_range = vrotate[0].code_range; /* ? */ num_cr = vrotate[0].num_cr; /* ? */ for(i = 0 ; i < vrotate_num ; i++) { if(vrotate[i].xlfd_name) Xfree(vrotate[i].xlfd_name); } Xfree(vrotate); if(sub_num > 0) { vrotate = font_set->vrotate = Xcalloc(sub_num, sizeof(VRotateRec)); if(font_set->vrotate == (VRotate)NULL) return (-1); for(i = 0 ; i < sub_num ; i++) { vrotate[i].charset_name = font_set->substitute[i].name; vrotate[i].side = font_set->substitute[i].side; vrotate[i].code_range = code_range; vrotate[i].num_cr = num_cr; } vrotate_num = font_set->vrotate_num = sub_num; } else { vrotate = font_set->vrotate = (VRotate)NULL; } ret = parse_fontdata(oc, font_set, (FontData) vrotate, vrotate_num, name_list, count, C_VROTATE, NULL); if(ret == -1) return (-1); } } return True; } static int parse_fontname( XOC oc) { XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set; FontDataRec font_data_return; char *base_name, **name_list; int font_set_num = 0; int found_num = 0; int count = 0; int ret; int i; name_list = _XParseBaseFontNameList(oc->core.base_name_list, &count); if (name_list == NULL) return -1; font_set = gen->font_set; font_set_num = gen->font_set_num; /* Loop through all of the CharSets defined in the Locale * database for the current Locale. */ for( ; font_set_num-- > 0 ; font_set++) { if(font_set->font_name) continue; if(font_set->font_data_count > 0) { /* * If there are a non-zero number of FontSets defined * for this CharSet. * Try to find a font for this CharSet. If we find an * acceptable font, we save the information for return * to the client. If we do not find an acceptable font, * a "missing_charset" will be reported to the client * for this CharSet. */ font_data_return.xlfd_name = NULL; font_data_return.side = XlcUnknown; ret = parse_fontdata(oc, font_set, font_set->font_data, font_set->font_data_count, name_list, count, C_PRIMARY, &font_data_return); if(ret == -1) { goto err; } else if(ret == True) { /* * We can't just loop thru fontset->font_data to * find the first (ie. best) match: parse_fontdata * will try a substitute font if no primary one could * be matched. It returns the required information in * font_data_return. */ font_set->font_name = strdup(font_data_return.xlfd_name); if(font_set->font_name == (char *) NULL) goto err; font_set->side = font_data_return.side; Xfree (font_data_return.xlfd_name); font_data_return.xlfd_name = NULL; if(parse_vw(oc, font_set, name_list, count) == -1) goto err; found_num++; } } else if(font_set->substitute_num > 0) { /* * If there are no FontSets defined for this * CharSet. We can only find "substitute" fonts. */ ret = parse_fontdata(oc, font_set, font_set->substitute, font_set->substitute_num, name_list, count, C_SUBSTITUTE, NULL); if(ret == -1) { goto err; } else if(ret == True) { for(i=0;isubstitute_num;i++){ if(font_set->substitute[i].xlfd_name != NULL){ break; } } font_set->font_name = strdup(font_set->substitute[i].xlfd_name); if(font_set->font_name == (char *) NULL) goto err; font_set->side = font_set->substitute[i].side; if(parse_vw(oc, font_set, name_list, count) == -1) goto err; found_num++; } } } base_name = strdup(oc->core.base_name_list); if (base_name == NULL) goto err; oc->core.base_name_list = base_name; XFreeStringList(name_list); return found_num; err: XFreeStringList(name_list); /* Prevent this from being freed twice */ oc->core.base_name_list = NULL; return -1; } /* For VW/UDC end*/ static Bool set_missing_list( XOC oc) { XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set; char **charset_list, *charset_buf; int count, length, font_set_num; int result = 1; font_set = gen->font_set; font_set_num = gen->font_set_num; count = length = 0; for ( ; font_set_num-- > 0; font_set++) { if (font_set->info || font_set->font) { continue; } /* Change 1996.01.23 start */ if(font_set->font_data_count <= 0 || font_set->font_data == (FontData)NULL) { if(font_set->substitute_num <= 0 || font_set->substitute == (FontData)NULL) { if(font_set->charset_list != NULL){ length += strlen(font_set->charset_list[0]->encoding_name) + 1; } else { length += 1; } } else { length += strlen(font_set->substitute->name) + 1; } } else { length += strlen(font_set->font_data->name) + 1; } /* Change 1996.01.23 end */ count++; } if (count < 1) { return True; } charset_list = Xmalloc(sizeof(char *) * count); if (charset_list == NULL) { return False; } charset_buf = Xmalloc(length); if (charset_buf == NULL) { Xfree(charset_list); return False; } oc->core.missing_list.charset_list = charset_list; oc->core.missing_list.charset_count = count; font_set = gen->font_set; font_set_num = gen->font_set_num; for ( ; font_set_num-- > 0; font_set++) { if (font_set->info || font_set->font) { continue; } /* Change 1996.01.23 start */ if(font_set->font_data_count <= 0 || font_set->font_data == (FontData)NULL) { if(font_set->substitute_num <= 0 || font_set->substitute == (FontData)NULL) { if(font_set->charset_list != NULL){ strcpy(charset_buf, font_set->charset_list[0]->encoding_name); } else { strcpy(charset_buf, ""); } result = 0; } else { strcpy(charset_buf, font_set->substitute->name); } } else { strcpy(charset_buf, font_set->font_data->name); } /* Change 1996.01.23 end */ *charset_list++ = charset_buf; charset_buf += strlen(charset_buf) + 1; } if(result == 0) { return(False); } return True; } static Bool create_fontset( XOC oc) { XOMGenericPart *gen = XOM_GENERIC(oc->core.om); int found_num; if (init_fontset(oc) == False) return False; found_num = parse_fontname(oc); if (found_num <= 0) { if (found_num == 0) set_missing_list(oc); return False; } if (gen->on_demand_loading == True) { if (load_font_info(oc) == False) return False; } else { if (load_font(oc) == False) return False; } if (init_core_part(oc) == False) return False; if (set_missing_list(oc) == False) return False; return True; } /* For VW/UDC start */ static void free_fontdataOC( Display *dpy, FontData font_data, int font_data_count) { for( ; font_data_count-- ; font_data++) { if(font_data->xlfd_name){ Xfree(font_data->xlfd_name); font_data->xlfd_name = NULL; } if(font_data->font){ /* ADD 1996.01.7 */ if(font_data->font->fid) /* Add 1996.01.23 */ XFreeFont(dpy,font_data->font); /* ADD 1996.01.7 */ else /* Add 1996.01.23 */ XFreeFontInfo(NULL, font_data->font, 1);/* Add 1996.01.23 */ font_data->font = NULL; } /* * font_data->name and font_data->scopes belong to the OM not OC. * To save space this data is shared between OM and OC. We are * not allowed to free it here. * It has been moved to free_fontdataOM() */ /* if(font_data->scopes){ Xfree(font_data->scopes); font_data->scopes = NULL; } if(font_data->name){ Xfree(font_data->name); font_data->name = NULL; } */ } } static void destroy_fontdata( XOCGenericPart *gen, Display *dpy) { FontSet font_set = (FontSet) NULL; int font_set_num = 0; if (gen->font_set) { font_set = gen->font_set; font_set_num = gen->font_set_num; for( ; font_set_num-- ; font_set++) { if (font_set->font) { if(font_set->font->fid) XFreeFont(dpy,font_set->font); else XFreeFontInfo(NULL, font_set->font, 1); font_set->font = NULL; } if(font_set->font_data) { if (font_set->info) XFreeFontInfo(NULL, font_set->info, 1); free_fontdataOC(dpy, font_set->font_data, font_set->font_data_count); Xfree(font_set->font_data); font_set->font_data = NULL; } if(font_set->substitute) { free_fontdataOC(dpy, font_set->substitute, font_set->substitute_num); Xfree(font_set->substitute); font_set->substitute = NULL; } if(font_set->vmap) { free_fontdataOC(dpy, font_set->vmap, font_set->vmap_num); Xfree(font_set->vmap); font_set->vmap = NULL; } if(font_set->vrotate) { free_fontdataOC(dpy, (FontData)font_set->vrotate, font_set->vrotate_num); Xfree(font_set->vrotate); font_set->vrotate = NULL; } } Xfree(gen->font_set); gen->font_set = NULL; } } /* For VW/UDC end */ static void destroy_oc( XOC oc) { Display *dpy = oc->core.om->core.display; XOCGenericPart *gen = XOC_GENERIC(oc); if (gen->mbs_to_cs) _XlcCloseConverter(gen->mbs_to_cs); if (gen->wcs_to_cs) _XlcCloseConverter(gen->wcs_to_cs); if (gen->utf8_to_cs) _XlcCloseConverter(gen->utf8_to_cs); /* For VW/UDC start */ /* Change 1996.01.8 */ destroy_fontdata(gen,dpy); /* */ /* For VW/UDC end */ Xfree(oc->core.base_name_list); XFreeStringList(oc->core.font_info.font_name_list); Xfree(oc->core.font_info.font_struct_list); XFreeStringList(oc->core.missing_list.charset_list); #ifdef notdef Xfree(oc->core.res_name); Xfree(oc->core.res_class); #endif Xfree(oc); } static char * set_oc_values( XOC oc, XlcArgList args, int num_args) { XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set = gen->font_set; char *ret; int num = gen->font_set_num; if (oc->core.resources == NULL) return NULL; ret = _XlcSetValues((XPointer) oc, oc->core.resources, oc->core.num_resources, args, num_args, XlcSetMask); if(ret != NULL){ return(ret); } else { for ( ; num-- > 0; font_set++) { if (font_set->font_name == NULL) continue; if (font_set->vpart_initialize != 0) continue; if( oc->core.orientation == XOMOrientation_TTB_RTL || oc->core.orientation == XOMOrientation_TTB_LTR ){ load_fontdata(oc, font_set->vmap, font_set->vmap_num); load_fontdata(oc, (FontData) font_set->vrotate, font_set->vrotate_num); font_set->vpart_initialize = 1; } } return(NULL); } } static char * get_oc_values( XOC oc, XlcArgList args, int num_args) { if (oc->core.resources == NULL) return NULL; return _XlcGetValues((XPointer) oc, oc->core.resources, oc->core.num_resources, args, num_args, XlcGetMask); } static XOCMethodsRec oc_default_methods = { destroy_oc, set_oc_values, get_oc_values, _XmbDefaultTextEscapement, _XmbDefaultTextExtents, _XmbDefaultTextPerCharExtents, _XmbDefaultDrawString, _XmbDefaultDrawImageString, _XwcDefaultTextEscapement, _XwcDefaultTextExtents, _XwcDefaultTextPerCharExtents, _XwcDefaultDrawString, _XwcDefaultDrawImageString, _Xutf8DefaultTextEscapement, _Xutf8DefaultTextExtents, _Xutf8DefaultTextPerCharExtents, _Xutf8DefaultDrawString, _Xutf8DefaultDrawImageString }; static XOCMethodsRec oc_generic_methods = { destroy_oc, set_oc_values, get_oc_values, _XmbGenericTextEscapement, _XmbGenericTextExtents, _XmbGenericTextPerCharExtents, _XmbGenericDrawString, _XmbGenericDrawImageString, _XwcGenericTextEscapement, _XwcGenericTextExtents, _XwcGenericTextPerCharExtents, _XwcGenericDrawString, _XwcGenericDrawImageString, _Xutf8GenericTextEscapement, _Xutf8GenericTextExtents, _Xutf8GenericTextPerCharExtents, _Xutf8GenericDrawString, _Xutf8GenericDrawImageString }; typedef struct _XOCMethodsListRec { const char *name; XOCMethods methods; } XOCMethodsListRec, *XOCMethodsList; static XOCMethodsListRec oc_methods_list[] = { { "default", &oc_default_methods }, { "generic", &oc_generic_methods } }; static XlcResource oc_resources[] = { { XNBaseFontName, NULLQUARK, sizeof(char *), XOffsetOf(XOCRec, core.base_name_list), XlcCreateMask | XlcGetMask }, { XNOMAutomatic, NULLQUARK, sizeof(Bool), XOffsetOf(XOCRec, core.om_automatic), XlcGetMask }, { XNMissingCharSet, NULLQUARK, sizeof(XOMCharSetList), XOffsetOf(XOCRec, core.missing_list), XlcGetMask }, { XNDefaultString, NULLQUARK, sizeof(char *), XOffsetOf(XOCRec, core.default_string), XlcGetMask }, { XNOrientation, NULLQUARK, sizeof(XOrientation), XOffsetOf(XOCRec, core.orientation), XlcDefaultMask | XlcSetMask | XlcGetMask }, { XNResourceName, NULLQUARK, sizeof(char *), XOffsetOf(XOCRec, core.res_name), XlcSetMask | XlcGetMask }, { XNResourceClass, NULLQUARK, sizeof(char *), XOffsetOf(XOCRec, core.res_class), XlcSetMask | XlcGetMask }, { XNFontInfo, NULLQUARK, sizeof(XOMFontInfo), XOffsetOf(XOCRec, core.font_info), XlcGetMask } }; static XOC create_oc( XOM om, XlcArgList args, int num_args) { XOC oc; XOMGenericPart *gen = XOM_GENERIC(om); XOCMethodsList methods_list = oc_methods_list; int count; oc = Xcalloc(1, sizeof(XOCGenericRec)); if (oc == NULL) return (XOC) NULL; oc->core.om = om; if (oc_resources[0].xrm_name == NULLQUARK) _XlcCompileResourceList(oc_resources, XlcNumber(oc_resources)); if (_XlcSetValues((XPointer) oc, oc_resources, XlcNumber(oc_resources), args, num_args, XlcCreateMask | XlcDefaultMask)) goto err; if (oc->core.base_name_list == NULL) goto err; oc->core.resources = oc_resources; oc->core.num_resources = XlcNumber(oc_resources); if (create_fontset(oc) == False) goto err; oc->methods = &oc_generic_methods; if (gen->object_name) { count = XlcNumber(oc_methods_list); for ( ; count-- > 0; methods_list++) { if (!_XlcCompareISOLatin1(gen->object_name, methods_list->name)) { oc->methods = methods_list->methods; break; } } } return oc; err: destroy_oc(oc); return (XOC) NULL; } static void free_fontdataOM( FontData font_data, int font_data_count) { if (!font_data) return; for( ; font_data_count-- ; font_data++) { Xfree(font_data->name); font_data->name = NULL; Xfree(font_data->scopes); font_data->scopes = NULL; } } static Status close_om( XOM om) { XOMGenericPart *gen = XOM_GENERIC(om); OMData data; int count; if ((data = gen->data)) { for (count = gen->data_num; count-- > 0; data++) { Xfree(data->charset_list); data->charset_list = NULL; /* free font_data for om */ free_fontdataOM(data->font_data,data->font_data_count); Xfree(data->font_data); data->font_data = NULL; /* free substitute for om */ free_fontdataOM(data->substitute,data->substitute_num); Xfree(data->substitute); data->substitute = NULL; /* free vmap for om */ free_fontdataOM(data->vmap,data->vmap_num); Xfree(data->vmap); data->vmap = NULL; /* free vrotate for om */ Xfree(data->vrotate); data->vrotate = NULL; } Xfree(gen->data); gen->data = NULL; } Xfree(gen->object_name); gen->object_name = NULL; Xfree(om->core.res_name); om->core.res_name = NULL; Xfree(om->core.res_class); om->core.res_class = NULL; if (om->core.required_charset.charset_list && om->core.required_charset.charset_count > 0){ XFreeStringList(om->core.required_charset.charset_list); om->core.required_charset.charset_list = NULL; } else { Xfree((char*)om->core.required_charset.charset_list); om->core.required_charset.charset_list = NULL; } Xfree(om->core.orientation_list.orientation); om->core.orientation_list.orientation = NULL; Xfree(om); return 1; } static char * set_om_values( XOM om, XlcArgList args, int num_args) { if (om->core.resources == NULL) return NULL; return _XlcSetValues((XPointer) om, om->core.resources, om->core.num_resources, args, num_args, XlcSetMask); } static char * get_om_values( XOM om, XlcArgList args, int num_args) { if (om->core.resources == NULL) return NULL; return _XlcGetValues((XPointer) om, om->core.resources, om->core.num_resources, args, num_args, XlcGetMask); } static XOMMethodsRec methods = { close_om, set_om_values, get_om_values, create_oc }; static XlcResource om_resources[] = { { XNRequiredCharSet, NULLQUARK, sizeof(XOMCharSetList), XOffsetOf(XOMRec, core.required_charset), XlcGetMask }, { XNQueryOrientation, NULLQUARK, sizeof(XOMOrientation), XOffsetOf(XOMRec, core.orientation_list), XlcGetMask }, { XNDirectionalDependentDrawing, NULLQUARK, sizeof(Bool), XOffsetOf(XOMRec, core.directional_dependent), XlcGetMask }, { XNContextualDrawing, NULLQUARK, sizeof(Bool), XOffsetOf(XOMRec, core.contextual_drawing), XlcGetMask } }; static XOM create_om( XLCd lcd, Display *dpy, XrmDatabase rdb, _Xconst char *res_name, _Xconst char *res_class) { XOM om; om = Xcalloc(1, sizeof(XOMGenericRec)); if (om == NULL) return (XOM) NULL; om->methods = &methods; om->core.lcd = lcd; om->core.display = dpy; om->core.rdb = rdb; if (res_name) { om->core.res_name = strdup(res_name); if (om->core.res_name == NULL) goto err; } if (res_class) { om->core.res_class = strdup(res_class); if (om->core.res_class == NULL) goto err; } if (om_resources[0].xrm_name == NULLQUARK) _XlcCompileResourceList(om_resources, XlcNumber(om_resources)); om->core.resources = om_resources; om->core.num_resources = XlcNumber(om_resources); return om; err: close_om(om); return (XOM) NULL; } static OMData add_data( XOM om) { XOMGenericPart *gen = XOM_GENERIC(om); OMData new; int num; if ((num = gen->data_num)) new = Xrealloc(gen->data, (num + 1) * sizeof(OMDataRec)); else new = Xmalloc(sizeof(OMDataRec)); if (new == NULL) return NULL; gen->data_num = num + 1; gen->data = new; new += num; bzero((char *) new, sizeof(OMDataRec)); return new; } /* For VW/UDC */ FontData read_EncodingInfo( int count, char **value) { FontData font_data,ret; char *buf, *bufptr,*scp; int len, i; font_data = Xcalloc(count, sizeof(FontDataRec)); if (font_data == NULL) return NULL; ret = font_data; for (i = 0; i < count; i++, font_data++) { /* strcpy(buf, *value++); */ buf = *value; value++; if ((bufptr = strchr(buf, ':'))) { len = (int)(bufptr - buf); bufptr++ ; } else len = strlen(buf); font_data->name = Xmalloc(len + 1); if (font_data->name == NULL) { free_fontdataOM(ret, i + 1); Xfree(ret); return NULL; } strncpy(font_data->name, buf,len); font_data->name[len] = 0; if (bufptr && _XlcCompareISOLatin1(bufptr, "GL") == 0) font_data->side = XlcGL; else if (bufptr && _XlcCompareISOLatin1(bufptr, "GR") == 0) font_data->side = XlcGR; else font_data->side = XlcGLGR; if (bufptr && (scp = strchr(bufptr, '['))){ font_data->scopes = _XlcParse_scopemaps(scp,&(font_data->scopes_num)); } } return(ret); } static CodeRange read_vrotate( int count, char **value, int *type, int *vrotate_num) { CodeRange range; if(!strcmp(value[0],"all")){ *type = VROTATE_ALL ; *vrotate_num = 0 ; return (NULL); } else if(*(value[0]) == '['){ *type = VROTATE_PART ; range = (CodeRange) _XlcParse_scopemaps(value[0],vrotate_num); return (range); } else { *type = VROTATE_NONE ; *vrotate_num = 0 ; return (NULL); } } static void read_vw( XLCd lcd, OMData font_set, int num) { char **value, buf[BUFSIZ]; int count; snprintf(buf, sizeof(buf), "fs%d.font.vertical_map", num); _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); if (count > 0){ _XlcDbg_printValue(buf,value,count); font_set->vmap_num = count; font_set->vmap = read_EncodingInfo(count,value); } snprintf(buf, sizeof(buf), "fs%d.font.vertical_rotate", num); _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); if (count > 0){ _XlcDbg_printValue(buf,value,count); font_set->vrotate = read_vrotate(count,value,&(font_set->vrotate_type), &(font_set->vrotate_num)); } } /* VW/UDC end */ static Bool init_om( XOM om) { XLCd lcd = om->core.lcd; XOMGenericPart *gen = XOM_GENERIC(om); OMData data; XlcCharSet *charset_list; FontData font_data; char **required_list; XOrientation *orientation; char **value, buf[BUFSIZ], *bufptr; int count = 0, num = 0, length = 0; _XlcGetResource(lcd, "XLC_FONTSET", "on_demand_loading", &value, &count); if (count > 0 && _XlcCompareISOLatin1(*value, "True") == 0) gen->on_demand_loading = True; _XlcGetResource(lcd, "XLC_FONTSET", "object_name", &value, &count); if (count > 0) { gen->object_name = strdup(*value); if (gen->object_name == NULL) return False; } for (num = 0; ; num++) { snprintf(buf, sizeof(buf), "fs%d.charset.name", num); _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); if( count < 1){ snprintf(buf, sizeof(buf), "fs%d.charset", num); _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); if (count < 1) break; } data = add_data(om); if (data == NULL) return False; charset_list = Xmalloc(sizeof(XlcCharSet) * count); if (charset_list == NULL) return False; data->charset_list = charset_list; data->charset_count = count; while (count-- > 0){ *charset_list++ = _XlcGetCharSet(*value++); } snprintf(buf, sizeof(buf), "fs%d.charset.udc_area", num); _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); if( count > 0){ UDCArea udc; int i,flag = 0; udc = Xmalloc(count * sizeof(UDCAreaRec)); if (udc == NULL) return False; for(i=0;icharset_count;i++){ if(data->charset_list[i]->udc_area == NULL){ data->charset_list[i]->udc_area = udc; data->charset_list[i]->udc_area_num = count; flag = 1; } } if(flag == 0){ Xfree(udc); } } snprintf(buf, sizeof(buf), "fs%d.font.primary", num); _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); if (count < 1){ snprintf(buf, sizeof(buf), "fs%d.font", num); _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); if (count < 1) return False; } font_data = read_EncodingInfo(count,value); if (font_data == NULL) return False; data->font_data = font_data; data->font_data_count = count; snprintf(buf, sizeof(buf), "fs%d.font.substitute", num); _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); if (count > 0){ font_data = read_EncodingInfo(count,value); if (font_data == NULL) return False; data->substitute = font_data; data->substitute_num = count; } else { snprintf(buf, sizeof(buf), "fs%d.font", num); _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); if (count < 1) { data->substitute = NULL; data->substitute_num = 0; } else { font_data = read_EncodingInfo(count,value); data->substitute = font_data; data->substitute_num = count; } } read_vw(lcd,data,num); length += strlen(data->font_data->name) + 1; } /* required charset list */ required_list = Xmalloc(sizeof(char *) * gen->data_num); if (required_list == NULL) return False; om->core.required_charset.charset_list = required_list; om->core.required_charset.charset_count = gen->data_num; count = gen->data_num; data = gen->data; if (count > 0) { bufptr = Xmalloc(length); if (bufptr == NULL) { Xfree(required_list); return False; } for ( ; count-- > 0; data++) { strcpy(bufptr, data->font_data->name); *required_list++ = bufptr; bufptr += strlen(bufptr) + 1; } } /* orientation list */ orientation = Xmalloc(sizeof(XOrientation) * 2); if (orientation == NULL) return False; orientation[0] = XOMOrientation_LTR_TTB; orientation[1] = XOMOrientation_TTB_RTL; om->core.orientation_list.orientation = orientation; om->core.orientation_list.num_orientation = 2; /* directional dependent drawing */ om->core.directional_dependent = False; /* contexual drawing */ om->core.contextual_drawing = False; /* context dependent */ om->core.context_dependent = False; return True; } XOM _XomGenericOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb, _Xconst char *res_name, _Xconst char *res_class) { XOM om; om = create_om(lcd, dpy, rdb, res_name, res_class); if (om == NULL) return (XOM) NULL; if (init_om(om) == False) goto err; return om; err: close_om(om); return (XOM) NULL; } Bool _XInitOM( XLCd lcd) { lcd->methods->open_om = _XomGenericOpenOM; return True; } nx-libs-3.5.99.23/nx-X11/lib/modules/om/generic/omImText.c0000644000000000000000000000543013614532331017464 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XomGeneric.h" #define GET_VALUE_MASK (GCFunction | GCForeground | GCBackground | GCFillStyle) #define SET_VALUE_MASK (GCFunction | GCForeground | GCFillStyle) static void _XomGenericDrawImageString( Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, XOMTextType type, XPointer text, int length) { XGCValues values; XRectangle extent; XGetGCValues(dpy, gc, GET_VALUE_MASK, &values); XSetFunction(dpy, gc, GXcopy); XSetForeground(dpy, gc, values.background); XSetFillStyle(dpy, gc, FillSolid); _XomGenericTextExtents(oc, type, text, length, 0, &extent); XFillRectangle(dpy, d, gc, x + extent.x, y + extent.y, extent.width, extent.height); XChangeGC(dpy, gc, SET_VALUE_MASK, &values); _XomGenericDrawString(dpy, d, oc, gc, x, y, type, text, length); } void _XmbGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length) { _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMMultiByte, (XPointer) text, length); } void _XwcGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst wchar_t *text, int length) { _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMWideChar, (XPointer) text, length); } void _Xutf8GenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length) { _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMUtf8String, (XPointer) text, length); } nx-libs-3.5.99.23/nx-X11/lib/modules/om/generic/omText.c0000644000000000000000000002222413614532331017176 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ /* * Copyright 1995 by FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. */ /* * Modifiers: Jeff Walls, Paul Anderson (HEWLETT-PACKARD) */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XomGeneric.h" #include /* For VW/UDC */ static int is_rotate( XOC oc, XFontStruct *font) { XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set; VRotate vrotate; int font_set_count; int vrotate_num; font_set = gen->font_set; font_set_count = gen->font_set_num; for( ; font_set_count-- ; font_set++) { if((font_set->vrotate_num > 0) && (font_set->vrotate)) { vrotate = font_set->vrotate; vrotate_num = font_set->vrotate_num; for( ; vrotate_num-- ; vrotate++) if(vrotate->font == font) return True; } } return False; } static int is_codemap( XOC oc, XFontStruct *font) { XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set; FontData vmap; int font_set_count; int vmap_num; font_set = gen->font_set; font_set_count = gen->font_set_num; for( ; font_set_count-- ; font_set++) { if(font_set->vmap_num > 0) { vmap = font_set->vmap; vmap_num = font_set->vmap_num; for( ; vmap_num-- ; vmap++) if(vmap->font == font) return True; } } return False; } static int draw_vertical( Display *dpy, Drawable d, XOC oc, GC gc, XFontStruct *font, Bool is_xchar2b, int x, int y, XPointer text, int length) { XChar2b *buf2b; char *buf; int wx = 0, wy = 0; int direction = 0; int font_ascent_return = 0, font_descent_return = 0; int i; XCharStruct overall; wy = y; if (is_xchar2b) { for(i = 0, buf2b = (XChar2b *) text ; i < length ; i++, buf2b++) { if(is_rotate(oc, font) == True) { XTextExtents16(font, buf2b, 1, &direction, &font_ascent_return, &font_descent_return, &overall); wx = x - (int)((overall.rbearing - overall.lbearing) >> 1) - (int) overall.lbearing; wy += overall.ascent; XDrawString16(dpy, d, gc, wx, wy, buf2b, 1); wy += overall.descent; } else { wx = x - (int)((font->max_bounds.rbearing - font->min_bounds.lbearing) >> 1) - (int) font->min_bounds.lbearing; wy += font->max_bounds.ascent; XDrawString16(dpy, d, gc, wx, wy, buf2b, 1); wy += font->max_bounds.descent; } } } else { for(i = 0, buf = (char *)text ; i < length && *buf ; i++, buf++) { if(is_rotate(oc, font) == True) { XTextExtents(font, buf, 1, &direction, &font_ascent_return, &font_descent_return, &overall); wx = x - (int)((overall.rbearing - overall.lbearing) >> 1) - (int) overall.lbearing; wy += overall.ascent; XDrawString(dpy, d, gc, wx, wy, buf, 1); wy += overall.descent; } else { wx = x - (int)((font->max_bounds.rbearing - font->min_bounds.lbearing) >> 1) - (int) font->min_bounds.lbearing; wy += font->max_bounds.ascent; XDrawString(dpy, d, gc, wx, wy, buf, 1); wy += font->max_bounds.descent; } } } return wy; } #define VMAP 0 #define VROTATE 1 #define FONTSCOPE 2 static int DrawStringWithFontSet( Display *dpy, Drawable d, XOC oc, FontSet fs, GC gc, int x, int y, XPointer text, int length) { XFontStruct *font; Bool is_xchar2b; unsigned char *ptr; int ptr_len, char_len = 0; FontData fd; int ret = 0; ptr = (unsigned char *)text; is_xchar2b = fs->is_xchar2b; while (length > 0) { fd = _XomGetFontDataFromFontSet(fs, ptr,length,&ptr_len,is_xchar2b,FONTSCOPE); if(ptr_len <= 0) break; /* First, see if the "Best Match" font for the FontSet was set. * If it was, use that font. If it was not set, then use the * font defined by font_set->font_data[0] (which is what * _XomGetFontDataFromFontSet() always seems to return for * non-VW text). Note that given the new algorithm in * parse_fontname() and parse_fontdata(), fs->font will * *always* contain good data. We should probably remove * the check for "fd->font", but we won't :-) -- jjw/pma (HP) */ if((font = fs->font) == (XFontStruct *) NULL){ if(fd == (FontData) NULL || (font = fd->font) == (XFontStruct *) NULL) break; } switch(oc->core.orientation) { case XOMOrientation_LTR_TTB: case XOMOrientation_RTL_TTB: XSetFont(dpy, gc, font->fid); if (is_xchar2b) { char_len = ptr_len / sizeof(XChar2b); XDrawString16(dpy, d, gc, x, y, (XChar2b *)ptr, char_len); x += XTextWidth16(font, (XChar2b *)ptr, char_len); } else { char_len = ptr_len; XDrawString(dpy, d, gc, x, y, (char *)ptr, char_len); x += XTextWidth(font, (char *)ptr, char_len); } break; case XOMOrientation_TTB_RTL: case XOMOrientation_TTB_LTR: if(fs->font == font) { fd = _XomGetFontDataFromFontSet(fs, ptr,length,&ptr_len,is_xchar2b,VMAP); if(ptr_len <= 0) break; if(fd == (FontData) NULL || (font = fd->font) == (XFontStruct *) NULL) break; if(is_codemap(oc, fd->font) == False) { fd = _XomGetFontDataFromFontSet(fs, ptr,length,&ptr_len,is_xchar2b,VROTATE); if(ptr_len <= 0) break; if(fd == (FontData) NULL || (font = fd->font) == (XFontStruct *) NULL) break; } } if(is_xchar2b) char_len = ptr_len / sizeof(XChar2b); else char_len = ptr_len; XSetFont(dpy, gc, font->fid); y = draw_vertical(dpy, d, oc, gc, font, is_xchar2b, x, y, (char *)ptr, char_len); break; case XOMOrientation_Context: /* never used? */ break; } if(char_len <= 0) break; length -= char_len; ptr += ptr_len; } switch(oc->core.orientation) { case XOMOrientation_LTR_TTB: case XOMOrientation_RTL_TTB: ret = x; break; case XOMOrientation_TTB_RTL: case XOMOrientation_TTB_LTR: ret = y; break; case XOMOrientation_Context: /* not used? */ break; } return ret; } /* For VW/UDC */ int _XomGenericDrawString( Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, XOMTextType type, XPointer text, int length) { XlcConv conv; XFontStruct *font; Bool is_xchar2b; /* VW/UDC */ XPointer args[3]; FontSet fs; /* VW/UDC */ XChar2b xchar2b_buf[BUFSIZ], *buf; int start_x = x; int start_y = y; int left = 0, buf_len = 0; int next = 0; conv = _XomInitConverter(oc, type); if (conv == NULL) return -1; args[0] = (XPointer) &font; args[1] = (XPointer) &is_xchar2b; args[2] = (XPointer) &fs; while (length > 0) { buf = xchar2b_buf; left = buf_len = BUFSIZ; if (_XomConvert(oc, conv, (XPointer *) &text, &length, (XPointer *) &buf, &left, args, 3) < 0) break; buf_len -= left; /* For VW/UDC */ next = DrawStringWithFontSet(dpy, d, oc, fs, gc, x, y, (XPointer)xchar2b_buf, buf_len); switch(oc->core.orientation) { case XOMOrientation_LTR_TTB: case XOMOrientation_RTL_TTB: x = next; break; case XOMOrientation_TTB_RTL: case XOMOrientation_TTB_LTR: y = next; break; case XOMOrientation_Context: /* not used */ break; } /* For VW/UDC */ } x -= start_x; y -= start_y; return x; } int _XmbGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length) { return _XomGenericDrawString(dpy, d, oc, gc, x, y, XOMMultiByte, (XPointer) text, length); } int _XwcGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst wchar_t *text, int length) { return _XomGenericDrawString(dpy, d, oc, gc, x, y, XOMWideChar, (XPointer) text, length); } int _Xutf8GenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length) { return _XomGenericDrawString(dpy, d, oc, gc, x, y, XOMUtf8String, (XPointer) text, length); } nx-libs-3.5.99.23/nx-X11/lib/modules/om/generic/omTextEsc.c0000644000000000000000000001703613614532331017636 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ /* * Copyright 1995 by FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XomGeneric.h" #include /* For VW/UDC start */ #define VMAP 0 #define VROTATE 1 #define FONTSCOPE 2 static int is_rotate( XOC oc, XFontStruct *font) { XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set; VRotate vrotate; int font_set_count; int vrotate_num; font_set = gen->font_set; font_set_count = gen->font_set_num; for( ; font_set_count-- ; font_set++) { if((font_set->vrotate_num > 0) && (font_set->vrotate != NULL)) { vrotate = font_set->vrotate; vrotate_num = font_set->vrotate_num; for( ; vrotate_num-- ; vrotate++) if(vrotate->font == font) return True; } } return False; } static int is_codemap( XOC oc, XFontStruct *font) { XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set; FontData vmap; int font_set_count; int vmap_num; font_set = gen->font_set; font_set_count = gen->font_set_num; for( ; font_set_count-- ; font_set++) { if(font_set->vmap_num > 0) { vmap = font_set->vmap; vmap_num = font_set->vmap_num; for( ; vmap_num-- ; vmap++) if(vmap->font == font) return True; } } return False; } static int escapement_vertical( XOC oc, XFontStruct *font, Bool is_xchar2b, XPointer text, int length) { XChar2b *buf2b; char *buf; int escapement = 0, i; if(is_xchar2b) { for(i = 0, buf2b = (XChar2b *) text ; i < length ; i++, buf2b++) { if(is_rotate(oc, font) == True) { escapement += _XTextHeight16(font, buf2b, 1); } else { escapement += (int) (font->max_bounds.ascent + font->max_bounds.descent); } } } else { for(i = 0, buf = (char *)text ; i < length && *buf ; i++, buf++) { if(is_rotate(oc, font) == True) { escapement += _XTextHeight(font, buf, 1); } else { escapement += (int) (font->max_bounds.ascent + font->max_bounds.descent); } } } return escapement; } static int TextWidthWithFontSet( FontSet font_set, XOC oc, XPointer text, int length) { FontData fd; XFontStruct *font; unsigned char *ptr = (unsigned char *)text; Bool is_xchar2b; int ptr_len = length; int escapement = 0, char_len = 0; if(font_set == (FontSet) NULL) return escapement; is_xchar2b = font_set->is_xchar2b; while(length > 0) { fd = _XomGetFontDataFromFontSet(font_set, ptr, length, &ptr_len, is_xchar2b, FONTSCOPE); if(ptr_len <= 0) break; /* * First, see if the "Best Match" font for the FontSet was set. * If it was, use that font. If it was not set, then use the * font defined by font_set->font_data[0] (which is what * _XomGetFontDataFromFontSet() always seems to return for * non-VW text). Note that given the new algorithm in * parse_fontname() and parse_fontdata(), fs->font will * *always* contain good data. We should probably remove * the check for "fd->font", but we won't :-) -- jjw/pma (HP) * * Above comment and way this is done propagated from omText.c * Note that fd->font is junk so using the result of the * above call /needs/ to be ignored. * * Owen Taylor 12 Jul 2000 * */ if(fd == (FontData) NULL || (font = font_set->font) == (XFontStruct *) NULL) { if((font = fd->font) == (XFontStruct *) NULL) break; } switch(oc->core.orientation) { case XOMOrientation_LTR_TTB: case XOMOrientation_RTL_TTB: if (is_xchar2b) { char_len = ptr_len / sizeof(XChar2b); escapement += XTextWidth16(font, (XChar2b *)ptr, char_len); } else { char_len = ptr_len; escapement += XTextWidth(font, (char *)ptr, char_len); } break; case XOMOrientation_TTB_LTR: case XOMOrientation_TTB_RTL: if(font_set->font == font) { fd = _XomGetFontDataFromFontSet(font_set, ptr, length, &ptr_len, is_xchar2b, VMAP); if(ptr_len <= 0) break; if(fd == (FontData) NULL || (font = fd->font) == (XFontStruct *) NULL) break; if(is_codemap(oc, fd->font) == False) { fd = _XomGetFontDataFromFontSet(font_set, ptr, length, &ptr_len, is_xchar2b, VROTATE); if(ptr_len <= 0) break; if(fd == (FontData) NULL || (font = fd->font) == (XFontStruct *) NULL) break; } } if(is_xchar2b) char_len = ptr_len / sizeof(XChar2b); else char_len = ptr_len; escapement += escapement_vertical(oc, font, is_xchar2b, (XPointer) ptr, char_len); break; case XOMOrientation_Context: /* not used? */ break; } if(char_len <= 0) break; length -= char_len; ptr += ptr_len; } return escapement; } /* For VW/UDC end */ static int _XomGenericTextEscapement( XOC oc, XOMTextType type, XPointer text, int length) { XlcConv conv; XFontStruct *font; Bool is_xchar2b; /* VW/UDC */ XPointer args[3]; FontSet font_set; /* VW/UDC */ XChar2b xchar2b_buf[BUFSIZ], *buf; int escapement = 0; int buf_len = 0, left = 0; conv = _XomInitConverter(oc, type); if (conv == NULL) return escapement; args[0] = (XPointer) &font; args[1] = (XPointer) &is_xchar2b; args[2] = (XPointer) &font_set; while (length > 0) { buf = xchar2b_buf; left = buf_len = BUFSIZ; if (_XomConvert(oc, conv, (XPointer *) &text, &length, (XPointer *) &buf, &left, args, 3) < 0) break; buf_len -= left; /* VW/UDC */ escapement += TextWidthWithFontSet(font_set, oc, (XPointer) xchar2b_buf, buf_len); /* VW/UDC */ } return escapement; } int _XmbGenericTextEscapement(XOC oc, _Xconst char *text, int length) { return _XomGenericTextEscapement(oc, XOMMultiByte, (XPointer) text, length); } int _XwcGenericTextEscapement(XOC oc, _Xconst wchar_t *text, int length) { return _XomGenericTextEscapement(oc, XOMWideChar, (XPointer) text, length); } int _Xutf8GenericTextEscapement(XOC oc, _Xconst char *text, int length) { return _XomGenericTextEscapement(oc, XOMUtf8String, (XPointer) text, length); } nx-libs-3.5.99.23/nx-X11/lib/modules/om/generic/omTextExt.c0000644000000000000000000001033513614532331017657 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XomGeneric.h" #include int _XomGenericTextExtents( XOC oc, XOMTextType type, XPointer text, int length, XRectangle *overall_ink, XRectangle *overall_logical) { XlcConv conv; XFontStruct *font; Bool is_xchar2b; XPointer args[2]; XChar2b xchar2b_buf[BUFSIZ], *buf; int direction, logical_ascent, logical_descent, tmp_ascent, tmp_descent; XCharStruct overall, tmp_overall; int buf_len, left; Bool first = True; conv = _XomInitConverter(oc, type); if (conv == NULL) return 0; bzero((char *) &overall, sizeof(XCharStruct)); logical_ascent = logical_descent = 0; args[0] = (XPointer) &font; args[1] = (XPointer) &is_xchar2b; while (length > 0) { buf = xchar2b_buf; left = buf_len = BUFSIZ; if (_XomConvert(oc, conv, (XPointer *) &text, &length, (XPointer *) &buf, &left, args, 2) < 0) break; buf_len -= left; if (is_xchar2b) XTextExtents16(font, xchar2b_buf, buf_len, &direction, &tmp_ascent, &tmp_descent, &tmp_overall); else XTextExtents(font, (char *) xchar2b_buf, buf_len, &direction, &tmp_ascent, &tmp_descent, &tmp_overall); if (first) { /* initialize overall */ overall = tmp_overall; logical_ascent = tmp_ascent; logical_descent = tmp_descent; first = False; } else { overall.lbearing = min(overall.lbearing, overall.width + tmp_overall.lbearing); overall.rbearing = max(overall.rbearing, overall.width + tmp_overall.rbearing); overall.ascent = max(overall.ascent, tmp_overall.ascent); overall.descent = max(overall.descent, tmp_overall.descent); overall.width += tmp_overall.width; logical_ascent = max(logical_ascent, tmp_ascent); logical_descent = max(logical_descent, tmp_descent); } } if (overall_ink) { overall_ink->x = overall.lbearing; overall_ink->y = -(overall.ascent); overall_ink->width = overall.rbearing - overall.lbearing; overall_ink->height = overall.ascent + overall.descent; } if (overall_logical) { overall_logical->x = 0; overall_logical->y = -(logical_ascent); overall_logical->width = overall.width; overall_logical->height = logical_ascent + logical_descent; } return overall.width; } int _XmbGenericTextExtents(XOC oc, _Xconst char *text, int length, XRectangle *overall_ink, XRectangle *overall_logical) { return _XomGenericTextExtents(oc, XOMMultiByte, (XPointer) text, length, overall_ink, overall_logical); } int _XwcGenericTextExtents(XOC oc, _Xconst wchar_t *text, int length, XRectangle *overall_ink, XRectangle *overall_logical) { return _XomGenericTextExtents(oc, XOMWideChar, (XPointer) text, length, overall_ink, overall_logical); } int _Xutf8GenericTextExtents(XOC oc, _Xconst char *text, int length, XRectangle *overall_ink, XRectangle *overall_logical) { return _XomGenericTextExtents(oc, XOMUtf8String, (XPointer) text, length, overall_ink, overall_logical); } nx-libs-3.5.99.23/nx-X11/lib/modules/om/generic/omTextPer.c0000644000000000000000000001327613614532331017654 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XomGeneric.h" #include static Status _XomGenericTextPerCharExtents( XOC oc, XOMTextType type, XPointer text, int length, XRectangle *ink_buf, XRectangle *logical_buf, int buf_size, int *num_chars, XRectangle *overall_ink, XRectangle *overall_logical) { XlcConv conv; XFontStruct *font; Bool is_xchar2b; XPointer args[2]; XChar2b xchar2b_buf[BUFSIZ], *xchar2b_ptr; char *xchar_ptr = NULL; XCharStruct *def, *cs, overall; int buf_len, left, require_num; int logical_ascent, logical_descent; Bool first = True; conv = _XomInitConverter(oc, type); if (conv == NULL) return 0; bzero((char *) &overall, sizeof(XCharStruct)); logical_ascent = logical_descent = require_num = *num_chars = 0; args[0] = (XPointer) &font; args[1] = (XPointer) &is_xchar2b; while (length > 0) { xchar2b_ptr = xchar2b_buf; left = buf_len = BUFSIZ; if (_XomConvert(oc, conv, (XPointer *) &text, &length, (XPointer *) &xchar2b_ptr, &left, args, 2) < 0) break; buf_len -= left; if (require_num) { require_num += buf_len; continue; } if (buf_size < buf_len) { require_num = *num_chars + buf_len; continue; } buf_size -= buf_len; if (first) { logical_ascent = font->ascent; logical_descent = font->descent; } else { logical_ascent = max(logical_ascent, font->ascent); logical_descent = max(logical_descent, font->descent); } if (is_xchar2b) { CI_GET_DEFAULT_INFO_2D(font, def) xchar2b_ptr = xchar2b_buf; } else { CI_GET_DEFAULT_INFO_1D(font, def) xchar_ptr = (char *) xchar2b_buf; } while (buf_len-- > 0) { if (is_xchar2b) { CI_GET_CHAR_INFO_2D(font, xchar2b_ptr->byte1, xchar2b_ptr->byte2, def, cs) xchar2b_ptr++; } else { CI_GET_CHAR_INFO_1D(font, *xchar_ptr, def, cs) xchar_ptr++; } if (cs == NULL) continue; ink_buf->x = overall.width + cs->lbearing; ink_buf->y = -(cs->ascent); ink_buf->width = cs->rbearing - cs->lbearing; ink_buf->height = cs->ascent + cs->descent; ink_buf++; logical_buf->x = overall.width; logical_buf->y = -(font->ascent); logical_buf->width = cs->width; logical_buf->height = font->ascent + font->descent; logical_buf++; if (first) { overall = *cs; first = False; } else { overall.ascent = max(overall.ascent, cs->ascent); overall.descent = max(overall.descent, cs->descent); overall.lbearing = min(overall.lbearing, overall.width + cs->lbearing); overall.rbearing = max(overall.rbearing, overall.width + cs->rbearing); overall.width += cs->width; } (*num_chars)++; } } if (require_num) { *num_chars = require_num; return 0; } else { if (overall_ink) { overall_ink->x = overall.lbearing; overall_ink->y = -(overall.ascent); overall_ink->width = overall.rbearing - overall.lbearing; overall_ink->height = overall.ascent + overall.descent; } if (overall_logical) { overall_logical->x = 0; overall_logical->y = -(logical_ascent); overall_logical->width = overall.width; overall_logical->height = logical_ascent + logical_descent; } } return 1; } Status _XmbGenericTextPerCharExtents(XOC oc, _Xconst char *text, int length, XRectangle *ink_buf, XRectangle *logical_buf, int buf_size, int *num_chars, XRectangle *overall_ink, XRectangle *overall_logical) { return _XomGenericTextPerCharExtents(oc, XOMMultiByte, (XPointer) text, length, ink_buf, logical_buf, buf_size, num_chars, overall_ink, overall_logical); } Status _XwcGenericTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length, XRectangle *ink_buf, XRectangle *logical_buf, int buf_size, int *num_chars, XRectangle *overall_ink, XRectangle *overall_logical) { return _XomGenericTextPerCharExtents(oc, XOMWideChar, (XPointer) text, length, ink_buf, logical_buf, buf_size, num_chars, overall_ink, overall_logical); } Status _Xutf8GenericTextPerCharExtents(XOC oc, _Xconst char *text, int length, XRectangle *ink_buf, XRectangle *logical_buf, int buf_size, int *num_chars, XRectangle *overall_ink, XRectangle *overall_logical) { return _XomGenericTextPerCharExtents(oc, XOMUtf8String, (XPointer) text, length, ink_buf, logical_buf, buf_size, num_chars, overall_ink, overall_logical); } nx-libs-3.5.99.23/nx-X11/lib/modules/om/generic/omXChar.c0000644000000000000000000002301513614532331017256 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ /* * Copyright 1995 by FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. * * Modifier: Takanori Tateno FUJITSU LIMITED * */ /* * Modifiers: Jeff Walls, Paul Anderson (HEWLETT-PACKARD) */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XlcPublic.h" #include "XomGeneric.h" #include /* for VW/UDC start */ static Bool ismatch_scopes( FontData fontdata, unsigned long *value, Bool is_shift) { register int scopes_num = fontdata->scopes_num; FontScope scopes = fontdata->scopes; if (!scopes_num) return False; if(fontdata->font == NULL) return False; for(;scopes_num--;scopes++) if ((scopes->start <= (*value & 0x7f7f)) && ((scopes->end) >= (*value & 0x7f7f))){ if(is_shift == True) { if(scopes->shift){ if(scopes->shift_direction == '+'){ *value += scopes->shift ; } else if( scopes->shift_direction == '-'){ *value -= scopes->shift ; } } } return True; } return False; } static int check_vertical_fonttype( char *name) { char *ptr; int type = 0; if(name == (char *)NULL || (int) strlen(name) <= 0) return False; /* Obtains the pointer of CHARSET_ENCODING_FIELD. */ if((ptr = strchr(name, '-')) == (char *) NULL) return False; ptr++; /* Obtains the pointer of vertical_map font type. */ if((ptr = strchr(ptr, '.')) == (char *) NULL) return False; ptr++; switch(*ptr) { case '1': type = 1; break; case '2': type = 2; break; case '3': type = 3; break; } return type; } /* */ #define VMAP 0 #define VROTATE 1 #define FONTSCOPE 2 FontData _XomGetFontDataFromFontSet( FontSet fs, unsigned char *str, int len, int *len_ret, int is2b, int type) /* VMAP , VROTATE , else */ { unsigned long value; int num,i,hit,csize; FontData fontdata; unsigned char *c; int vfont_type; c = str; hit = -1; if(type == VMAP){ fontdata = fs->vmap; num = fs->vmap_num; } else if(type == VROTATE){ fontdata = (FontData)fs->vrotate; num = fs->vrotate_num; } else { if(fs->font_data_count <= 0 || fs->font_data == (FontData)NULL) { fontdata = fs->substitute; num = fs->substitute_num; }else { fontdata = fs->font_data; num = fs->font_data_count; } /* CDExc20229 fix */ if(fontdata == NULL || num == 0){ return(NULL); } } if(is2b){ csize = 2; } else { csize = 1; } for(;len;len--){ if(is2b){ value = (((unsigned long)*c) << 8)|(unsigned long)*(c + 1); } else { value = (unsigned long)*c; } /* ### NOTE: This routine DOES NOT WORK! * ### We can work around the problem in the calling routine, * ### but we really need to understand this better. As it * ### stands, the algorithm ALWAYS returns "fontdata[0]" * ### for non-VW text! This is clearly wrong. In fact, * ### given the new parse_font[name|data]() algorithms, * ### we may not even need this routine to do anything * ### for non-VW text (since font_set->font always contains * ### the best font for this fontset). -- jjw/pma (HP) */ for (i=0;ifont_data_count <= 0 || fs->font_data == (FontData)NULL) fontdata = fs->substitute; else fontdata = fs->font_data; /* Change 1996.01.23 end */ } hit = 0; c += csize; break; } if( hit == -1 ) hit = i; if(is2b){ *c = (unsigned char)(value >> 8); *(c + 1) = (unsigned char)(value); } else { *c = (unsigned char)value; } c += csize; } *len_ret = (c - str); return(&(fontdata[hit])); } /* for VW/UDC end */ static FontSet _XomGetFontSetFromCharSet( XOC oc, XlcCharSet charset) { register FontSet font_set = XOC_GENERIC(oc)->font_set; register int num = XOC_GENERIC(oc)->font_set_num; XlcCharSet *charset_list; int charset_count; for ( ; num-- > 0; font_set++) { charset_count = font_set->charset_count; charset_list = font_set->charset_list; for ( ; charset_count-- > 0; charset_list++) if (*charset_list == charset) return font_set; } return (FontSet) NULL; } static void shift_to_gl( register char *text, register int length) { while (length-- > 0) *text++ &= 0x7f; } static void shift_to_gr( register char *text, register int length) { while (length-- > 0) *text++ |= 0x80; } static Bool load_font( XOC oc, FontSet font_set) { font_set->font = XLoadQueryFont(oc->core.om->core.display, oc->core.font_info.font_name_list[font_set->id]); if (font_set->font == NULL) return False; oc->core.font_info.font_struct_list[font_set->id] = font_set->font; XFreeFontInfo(NULL, font_set->info, 1); font_set->info = NULL; if (font_set->font->min_byte1 || font_set->font->max_byte1) font_set->is_xchar2b = True; else font_set->is_xchar2b = False; return True; } int _XomConvert( XOC oc, XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { XPointer cs, lc_args[1]; XlcCharSet charset; int length, cs_left, ret; FontSet font_set; cs = *to; cs_left = *to_left; lc_args[0] = (XPointer) &charset; ret = _XlcConvert(conv, from, from_left, &cs, &cs_left, lc_args, 1); if (ret < 0) return -1; font_set = _XomGetFontSetFromCharSet(oc, charset); if (font_set == NULL) return -1; if (font_set->font == NULL && load_font(oc, font_set) == False) return -1; length = *to_left - cs_left; if (font_set->side != charset->side) { if (font_set->side == XlcGL) shift_to_gl(*to, length); else if (font_set->side == XlcGR) shift_to_gr(*to, length); } if (font_set->is_xchar2b) length >>= 1; *to = cs; *to_left -= length; *((XFontStruct **) args[0]) = font_set->font; *((Bool *) args[1]) = font_set->is_xchar2b; if(num_args >= 3){ *((FontSet *) args[2]) = font_set; } return ret; } XlcConv _XomInitConverter( XOC oc, XOMTextType type) { XOCGenericPart *gen = XOC_GENERIC(oc); XlcConv *convp; const char *conv_type; XlcConv conv; XLCd lcd; switch (type) { case XOMWideChar: convp = &gen->wcs_to_cs; conv_type = XlcNWideChar; break; case XOMMultiByte: convp = &gen->mbs_to_cs; conv_type = XlcNMultiByte; break; case XOMUtf8String: convp = &gen->utf8_to_cs; conv_type = XlcNUtf8String; break; default: return (XlcConv) NULL; } conv = *convp; if (conv) { _XlcResetConverter(conv); return conv; } lcd = oc->core.om->core.lcd; conv = _XlcOpenConverter(lcd, conv_type, lcd, XlcNFontCharSet); if (conv == (XlcConv) NULL) { conv = _XlcOpenConverter(lcd, conv_type, lcd, XlcNCharSet); if (conv == (XlcConv) NULL) return (XlcConv) NULL; } *convp = conv; return conv; } nx-libs-3.5.99.23/nx-X11/lib/modules/om/Makefile.am0000644000000000000000000000002213614532331016162 0ustar SUBDIRS = generic nx-libs-3.5.99.23/nx-X11/lib/nx-x11.pc.in0000644000000000000000000000076013614532331014041 0ustar prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ xthreadlib=@XTHREADLIB@ Name: NX_X11 Description: NX_X11 Library Version: @PACKAGE_VERSION@ # FIXME: we currently build from one source tree... Get back to this # whenever we take the nx-libs source code apart and split up the # components #Requires: nx-xproto @XKBPROTO_REQUIRES@ #Requires.private: @X11_EXTRA_DEPS@ Cflags: -I${includedir} @XTHREAD_CFLAGS@ Libs: -L${libdir} -lNX_X11 Libs.private: @XTHREADLIB@ nx-libs-3.5.99.23/nx-X11/lib/src/AllCells.c0000644000000000000000000000416613614532331014506 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Status XAllocColorCells( register Display *dpy, Colormap cmap, Bool contig, unsigned long *masks, /* LISTofCARD32 */ /* RETURN */ unsigned int nplanes, /* CARD16 */ unsigned long *pixels, /* LISTofCARD32 */ /* RETURN */ unsigned int ncolors) /* CARD16 */ { Status status; xAllocColorCellsReply rep; register xAllocColorCellsReq *req; LockDisplay(dpy); GetReq(AllocColorCells, req); req->cmap = cmap; req->colors = ncolors; req->planes = nplanes; req->contiguous = contig; status = _XReply(dpy, (xReply *)&rep, 0, xFalse); if (status) { if ((rep.nPixels > ncolors) || (rep.nMasks > nplanes)) { _XEatDataWords(dpy, rep.length); status = 0; /* Failure */ } else { _XRead32 (dpy, (long *) pixels, 4L * (long) (rep.nPixels)); _XRead32 (dpy, (long *) masks, 4L * (long) (rep.nMasks)); } } UnlockDisplay(dpy); SyncHandle(); return(status); } nx-libs-3.5.99.23/nx-X11/lib/src/AllowEv.c0000644000000000000000000000271413614532331014361 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XAllowEvents( register Display *dpy, int mode, Time time) { register xAllowEventsReq *req; LockDisplay(dpy); GetReq(AllowEvents,req); req->mode = mode; req->time = time; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/AllPlanes.c0000644000000000000000000000412613614532331014662 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Status XAllocColorPlanes( register Display *dpy, Colormap cmap, Bool contig, unsigned long *pixels, /* LISTofCARD32 */ /* RETURN */ int ncolors, int nreds, int ngreens, int nblues, unsigned long *rmask, unsigned long *gmask, unsigned long *bmask) /* CARD32 */ /* RETURN */ { xAllocColorPlanesReply rep; Status status; register xAllocColorPlanesReq *req; LockDisplay(dpy); GetReq(AllocColorPlanes,req); req->cmap = cmap; req->colors = ncolors; req->red = nreds; req->green = ngreens; req->blue = nblues; req->contiguous = contig; status = _XReply(dpy, (xReply *)&rep, 0, xFalse); if (status) { *rmask = rep.redMask; *gmask = rep.greenMask; *bmask = rep.blueMask; /* sizeof(CARD32) = 4 */ _XRead32 (dpy, (long *) pixels, (long)(ncolors * 4)); } UnlockDisplay(dpy); SyncHandle(); return(status); } nx-libs-3.5.99.23/nx-X11/lib/src/AuDispose.c0000644000000000000000000000274013614532331014703 0ustar /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include void XauDisposeAuth (Xauth *auth) { if (auth) { free (auth->address); free (auth->number); free (auth->name); if (auth->data) { (void) bzero (auth->data, auth->data_length); (void) free (auth->data); } free ((char *) auth); } return; } nx-libs-3.5.99.23/nx-X11/lib/src/AuFileName.c0000644000000000000000000000450013614532331014751 0ustar /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include static char *buf = NULL; static void free_filename_buffer(void) { free(buf); buf = NULL; } char * XauFileName (void) { const char *slashDotXauthority = "/.Xauthority"; char *name; static size_t bsize; static int atexit_registered = 0; #ifdef WIN32 char dir[128]; #endif size_t size; if ((name = getenv ("XAUTHORITY"))) return name; name = getenv ("HOME"); if (!name) { #ifdef WIN32 if ((name = getenv("USERNAME"))) { snprintf(dir, sizeof(dir), "/users/%s", name); name = dir; } if (!name) #endif return NULL; } size = strlen (name) + strlen(&slashDotXauthority[1]) + 2; if ((size > bsize) || (buf == NULL)) { free (buf); assert(size > 0); buf = malloc (size); if (!buf) { bsize = 0; return NULL; } if (!atexit_registered) { atexit(free_filename_buffer); atexit_registered = 1; } bsize = size; } snprintf (buf, bsize, "%s%s", name, slashDotXauthority + (name[0] == '/' && name[1] == '\0' ? 1 : 0)); return buf; } nx-libs-3.5.99.23/nx-X11/lib/src/AuGetBest.c0000644000000000000000000000664713614532331014644 0ustar /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #ifdef XTHREADS #include #endif #define binaryEqual(a, b, len) (memcmp(a, b, len) == 0) Xauth * XauGetBestAuthByAddr ( #if NeedWidePrototypes unsigned int family, unsigned int address_length, #else unsigned short family, unsigned short address_length, #endif _Xconst char* address, #if NeedWidePrototypes unsigned int number_length, #else unsigned short number_length, #endif _Xconst char* number, int types_length, char** types, _Xconst int* type_lengths) { FILE *auth_file; char *auth_name; Xauth *entry; Xauth *best; int best_type; int type; auth_name = XauFileName (); if (!auth_name) return NULL; if (access (auth_name, R_OK) != 0) /* checks REAL id */ return NULL; auth_file = fopen (auth_name, "rb"); if (!auth_file) return NULL; best = NULL; best_type = types_length; for (;;) { entry = XauReadAuth (auth_file); if (!entry) break; /* * Match when: * either family or entry->family are FamilyWild or * family and entry->family are the same and * address and entry->address are the same * and * either number or entry->number are empty or * number and entry->number are the same * and * either name or entry->name are empty or * name and entry->name are the same */ if ((family == FamilyWild || entry->family == FamilyWild || (entry->family == family && ((address_length == entry->address_length && binaryEqual (entry->address, address, address_length)) ))) && (number_length == 0 || entry->number_length == 0 || (number_length == entry->number_length && binaryEqual (entry->number, number, number_length)))) { if (best_type == 0) { best = entry; break; } for (type = 0; type < best_type; type++) if (type_lengths[type] == entry->name_length && !(strncmp (types[type], entry->name, entry->name_length))) { break; } if (type < best_type) { if (best) XauDisposeAuth (best); best = entry; best_type = type; if (type == 0) break; continue; } } XauDisposeAuth (entry); } (void) fclose (auth_file); return best; } nx-libs-3.5.99.23/nx-X11/lib/src/AuRead.c0000644000000000000000000001010113614532331014136 0ustar /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #ifdef NX_TRANS_SOCKET #include #endif static int read_short (unsigned short *shortp, FILE *file) { unsigned char file_short[2]; #ifdef NX_TRANS_SOCKET /* * Added a check on EINTR to prevent the fread() call to be * interrupted by any signal not blocked by OsBlockSignals(). */ for (;;) { if (fread ((char *) file_short, sizeof (file_short), 1, file) != 1) { if (errno == EINTR && ferror (file)) { perror ("Reading from auth file"); clearerr (file); continue; } return 0; } break; } #else if (fread ((char *) file_short, sizeof (file_short), 1, file) != 1) return 0; #endif *shortp = file_short[0] * 256 + file_short[1]; return 1; } static int read_counted_string (unsigned short *countp, char **stringp, FILE *file) { unsigned short len; char *data; if (read_short (&len, file) == 0) return 0; if (len == 0) { data = NULL; } else { data = malloc ((unsigned) len); if (!data) return 0; #ifdef NX_TRANS_SOCKET for (;;) { if (fread (data, sizeof (char), len, file) != len) { if (errno == EINTR && ferror (file)) { perror ("Reading from auth file"); clearerr (file); continue; } bzero (data, len); free (data); return 0; } break; } #else if (fread (data, sizeof (char), len, file) != len) { bzero (data, len); free (data); return 0; } #endif } *stringp = data; *countp = len; return 1; } Xauth * XauReadAuth (FILE *auth_file) { Xauth local; Xauth *ret; if (read_short (&local.family, auth_file) == 0) return NULL; if (read_counted_string (&local.address_length, &local.address, auth_file) == 0) return NULL; if (read_counted_string (&local.number_length, &local.number, auth_file) == 0) { free (local.address); return NULL; } if (read_counted_string (&local.name_length, &local.name, auth_file) == 0) { free (local.address); free (local.number); return NULL; } if (read_counted_string (&local.data_length, &local.data, auth_file) == 0) { free (local.address); free (local.number); free (local.name); return NULL; } ret = (Xauth *) malloc (sizeof (Xauth)); if (!ret) { free (local.address); free (local.number); free (local.name); if (local.data) { bzero (local.data, local.data_length); free (local.data); } return NULL; } *ret = local; return ret; } nx-libs-3.5.99.23/nx-X11/lib/src/AutoRep.c0000644000000000000000000000307013614532331014363 0ustar /* Copyright 1985, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XAutoRepeatOn (register Display *dpy) { XKeyboardControl values; values.auto_repeat_mode = AutoRepeatModeOn; XChangeKeyboardControl (dpy, KBAutoRepeatMode, &values); return 1; } int XAutoRepeatOff (register Display *dpy) { XKeyboardControl values; values.auto_repeat_mode = AutoRepeatModeOff; XChangeKeyboardControl (dpy, KBAutoRepeatMode, &values); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/Backgnd.c0000644000000000000000000000311713614532331014337 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetWindowBackground( register Display *dpy, Window w, unsigned long pixel) { register xChangeWindowAttributesReq *req; LockDisplay(dpy); GetReqExtra (ChangeWindowAttributes, 4, req); req->window = w; req->valueMask = CWBackPixel; OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), pixel); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/BdrWidth.c0000644000000000000000000000314513614532331014516 0ustar /* Copyright 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetWindowBorderWidth( Display *dpy, Window w, unsigned int width) { unsigned long lwidth = width; /* must be CARD32 */ register xConfigureWindowReq *req; LockDisplay(dpy); GetReqExtra(ConfigureWindow, 4, req); req->window = w; req->mask = CWBorderWidth; OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), lwidth); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/Bell.c0000644000000000000000000000263013614532331013663 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XBell( register Display *dpy, int percent) { register xBellReq *req; LockDisplay(dpy); GetReq(Bell,req); req->percent = percent; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/Border.c0000644000000000000000000000311513614532331014221 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetWindowBorder( register Display *dpy, Window w, unsigned long pixel) { register xChangeWindowAttributesReq *req; LockDisplay(dpy); GetReqExtra (ChangeWindowAttributes, 4, req); req->window = w; req->valueMask = CWBorderPixel; OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), pixel); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ChAccCon.c0000644000000000000000000000320313614532331014403 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XEnableAccessControl(register Display *dpy) { return XSetAccessControl(dpy, EnableAccess); } int XDisableAccessControl(register Display *dpy) { return XSetAccessControl(dpy, DisableAccess); } int XSetAccessControl( register Display *dpy, int mode) { register xSetAccessControlReq *req; LockDisplay(dpy); GetReq(SetAccessControl, req); req->mode = mode; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ChActPGb.c0000644000000000000000000000307513614532331014364 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XChangeActivePointerGrab( register Display *dpy, unsigned int event_mask, /* CARD16 */ Cursor curs, Time time) { register xChangeActivePointerGrabReq *req; LockDisplay(dpy); GetReq(ChangeActivePointerGrab, req); req->eventMask = event_mask; req->cursor = curs; req->time = time; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ChClMode.c0000644000000000000000000000266413614532331014432 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetCloseDownMode( register Display *dpy, int mode) { register xSetCloseDownModeReq *req; LockDisplay(dpy); GetReq(SetCloseDownMode, req); req->mode = mode; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ChCmap.c0000644000000000000000000000311513614532331014137 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetWindowColormap( register Display *dpy, Window w, Colormap colormap) { register xChangeWindowAttributesReq *req; LockDisplay(dpy); GetReqExtra (ChangeWindowAttributes, 4, req); req->window = w; req->valueMask = CWColormap; OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), colormap); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ChGC.c0000644000000000000000000000316613614532331013556 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Cr.h" int XChangeGC ( register Display *dpy, GC gc, unsigned long valuemask, XGCValues *values) { LockDisplay(dpy); valuemask &= (1L << (GCLastBit + 1)) - 1; if (valuemask) _XUpdateGCCache (gc, valuemask, values); /* if any Resource ID changed, must flush */ if (gc->dirty & (GCFont | GCTile | GCStipple)) _XFlushGCCache(dpy, gc); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ChKeyCon.c0000644000000000000000000000457213614532331014457 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XChangeKeyboardControl( register Display *dpy, unsigned long mask, XKeyboardControl *value_list) { unsigned long values[8]; register unsigned long *value = values; long nvalues; register xChangeKeyboardControlReq *req; LockDisplay(dpy); GetReq(ChangeKeyboardControl, req); req->mask = mask; if (mask & KBKeyClickPercent) *value++ = value_list->key_click_percent; if (mask & KBBellPercent) *value++ = value_list->bell_percent; if (mask & KBBellPitch) *value++ = value_list->bell_pitch; if (mask & KBBellDuration) *value++ = value_list->bell_duration; if (mask & KBLed) *value++ = value_list->led; if (mask & KBLedMode) *value++ = value_list->led_mode; if (mask & KBKey) *value++ = value_list->key; if (mask & KBAutoRepeatMode) *value++ = value_list->auto_repeat_mode; req->length += (nvalues = value - values); /* note: Data is a macro that uses its arguments multiple times, so "nvalues" is changed in a separate assignment statement */ nvalues <<= 2; Data32 (dpy, (long *) values, nvalues); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ChkIfEv.c0000644000000000000000000000720113614532331014263 0ustar /* Copyright 1985, 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* * Check existing events in queue to find if any match. If so, return. * If not, flush buffer and see if any more events are readable. If one * matches, return. If all else fails, tell the user no events found. */ Bool XCheckIfEvent ( register Display *dpy, register XEvent *event, /* XEvent to be filled in. */ Bool (*predicate)( Display* /* display */, XEvent* /* event */, char* /* arg */ ), /* function to call */ char *arg) { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; int n; /* time through count */ LockDisplay(dpy); prev = NULL; for (n = 3; --n >= 0;) { for (qelt = prev ? prev->next : dpy->head; qelt; prev = qelt, qelt = qelt->next) { if(qelt->qserial_num > qe_serial && (*predicate)(dpy, &qelt->event, arg)) { *event = qelt->event; _XDeq(dpy, prev, qelt); _XStoreEventCookie(dpy, event); UnlockDisplay(dpy); return True; } } if (prev) qe_serial = prev->qserial_num; switch (n) { case 2: _XEventsQueued(dpy, QueuedAfterReading); break; case 1: _XFlush(dpy); break; } if (prev && prev->qserial_num != qe_serial) /* another thread has snatched this event */ prev = NULL; } UnlockDisplay(dpy); return False; } #ifdef NX_TRANS_SOCKET /* * This is just like XCheckIfEvent() but doesn't * flush the output buffer if it can't read new * events. */ Bool XCheckIfEventNoFlush ( register Display *dpy, register XEvent *event, /* XEvent to be filled in. */ Bool (*predicate)( Display* /* display */, XEvent* /* event */, char* /* arg */ ), /* function to call */ char *arg) { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; int n; /* time through count */ LockDisplay(dpy); prev = NULL; for (n = 2; --n >= 0;) { for (qelt = prev ? prev->next : dpy->head; qelt; prev = qelt, qelt = qelt->next) { if(qelt->qserial_num > qe_serial && (*predicate)(dpy, &qelt->event, arg)) { *event = qelt->event; _XDeq(dpy, prev, qelt); _XStoreEventCookie(dpy, event); UnlockDisplay(dpy); return True; } } if (prev) qe_serial = prev->qserial_num; switch (n) { case 1: _XEventsQueued(dpy, QueuedAfterReading); break; } if (prev && prev->qserial_num != qe_serial) /* another thread has snatched this event */ prev = NULL; } UnlockDisplay(dpy); return False; } #endif nx-libs-3.5.99.23/nx-X11/lib/src/ChkMaskEv.c0000644000000000000000000000540413614532331014623 0ustar /* Copyright 1985, 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" extern long const _Xevent_to_mask[]; #define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask) #define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ Button4MotionMask|Button5MotionMask) /* * Check existing events in queue to find if any match. If so, return. * If not, flush buffer and see if any more events are readable. If one * matches, return. If all else fails, tell the user no events found. */ Bool XCheckMaskEvent ( register Display *dpy, long mask, /* Selected event mask. */ register XEvent *event) /* XEvent to be filled in. */ { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; int n; /* time through count */ LockDisplay(dpy); /* Delete unclaimed cookies */ _XFreeEventCookies(dpy); prev = NULL; for (n = 3; --n >= 0;) { for (qelt = prev ? prev->next : dpy->head; qelt; prev = qelt, qelt = qelt->next) { if ((qelt->event.type < GenericEvent) && (_Xevent_to_mask[qelt->event.type] & mask) && ((qelt->event.type != MotionNotify) || (mask & AllPointers) || (mask & AllButtons & qelt->event.xmotion.state))) { *event = qelt->event; _XDeq(dpy, prev, qelt); UnlockDisplay(dpy); return True; } } if (prev) qe_serial = prev->qserial_num; switch (n) { case 2: _XEventsQueued(dpy, QueuedAfterReading); break; case 1: _XFlush(dpy); break; } if (prev && prev->qserial_num != qe_serial) /* another thread has snatched this event */ prev = NULL; } UnlockDisplay(dpy); return False; } nx-libs-3.5.99.23/nx-X11/lib/src/ChkTypEv.c0000644000000000000000000000457113614532331014510 0ustar /* Copyright 1985, 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* * Check existing events in queue to find if any match. If so, return. * If not, flush buffer and see if any more events are readable. If one * matches, return. If all else fails, tell the user no events found. */ Bool XCheckTypedEvent ( register Display *dpy, int type, /* Selected event type. */ register XEvent *event) /* XEvent to be filled in. */ { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; int n; /* time through count */ LockDisplay(dpy); /* Delete unclaimed cookies */ _XFreeEventCookies(dpy); prev = NULL; for (n = 3; --n >= 0;) { for (qelt = prev ? prev->next : dpy->head; qelt; prev = qelt, qelt = qelt->next) { if (qelt->event.type == type) { *event = qelt->event; _XDeq(dpy, prev, qelt); _XStoreEventCookie(dpy, event); UnlockDisplay(dpy); return True; } } if (prev) qe_serial = prev->qserial_num; switch (n) { case 2: _XEventsQueued(dpy, QueuedAfterReading); break; case 1: _XFlush(dpy); break; } if (prev && prev->qserial_num != qe_serial) /* another thread has snatched this event */ prev = NULL; } UnlockDisplay(dpy); return False; } nx-libs-3.5.99.23/nx-X11/lib/src/ChkTypWEv.c0000644000000000000000000000471413614532331014636 0ustar /* Copyright 1985, 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* * Check existing events in queue to find if any match. If so, return. * If not, flush buffer and see if any more events are readable. If one * matches, return. If all else fails, tell the user no events found. */ Bool XCheckTypedWindowEvent ( register Display *dpy, Window w, /* Selected window. */ int type, /* Selected event type. */ register XEvent *event) /* XEvent to be filled in. */ { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; int n; /* time through count */ LockDisplay(dpy); /* Delete unclaimed cookies */ _XFreeEventCookies(dpy); prev = NULL; for (n = 3; --n >= 0;) { for (qelt = prev ? prev->next : dpy->head; qelt; prev = qelt, qelt = qelt->next) { if ((qelt->event.xany.window == w) && (qelt->event.type == type)) { *event = qelt->event; _XDeq(dpy, prev, qelt); _XStoreEventCookie(dpy, event); UnlockDisplay(dpy); return True; } } if (prev) qe_serial = prev->qserial_num; switch (n) { case 2: _XEventsQueued(dpy, QueuedAfterReading); break; case 1: _XFlush(dpy); break; } if (prev && prev->qserial_num != qe_serial) /* another thread has snatched this event */ prev = NULL; } UnlockDisplay(dpy); return False; } nx-libs-3.5.99.23/nx-X11/lib/src/ChkWinEv.c0000644000000000000000000000552113614532331014465 0ustar /* Copyright 1985, 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" extern long const _Xevent_to_mask[]; #define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask) #define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ Button4MotionMask|Button5MotionMask) /* * Check existing events in queue to find if any match. If so, return. * If not, flush buffer and see if any more events are readable. If one * matches, return. If all else fails, tell the user no events found. */ Bool XCheckWindowEvent ( register Display *dpy, Window w, /* Selected window. */ long mask, /* Selected event mask. */ register XEvent *event) /* XEvent to be filled in. */ { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; int n; /* time through count */ LockDisplay(dpy); /* Delete unclaimed cookies */ _XFreeEventCookies(dpy); prev = NULL; for (n = 3; --n >= 0;) { for (qelt = prev ? prev->next : dpy->head; qelt; prev = qelt, qelt = qelt->next) { if ((qelt->event.xany.window == w) && (qelt->event.type < GenericEvent) && (_Xevent_to_mask[qelt->event.type] & mask) && ((qelt->event.type != MotionNotify) || (mask & AllPointers) || (mask & AllButtons & qelt->event.xmotion.state))) { *event = qelt->event; _XDeq(dpy, prev, qelt); UnlockDisplay(dpy); return True; } } if (prev) qe_serial = prev->qserial_num; switch (n) { case 2: _XEventsQueued(dpy, QueuedAfterReading); break; case 1: _XFlush(dpy); break; } if (prev && prev->qserial_num != qe_serial) /* another thread has snatched this event */ prev = NULL; } UnlockDisplay(dpy); return False; } nx-libs-3.5.99.23/nx-X11/lib/src/ChPntCon.c0000644000000000000000000000325713614532331014467 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XChangePointerControl( register Display *dpy, Bool do_acc, Bool do_thresh, int acc_numerator, int acc_denominator, int threshold) { register xChangePointerControlReq *req; LockDisplay(dpy); GetReq(ChangePointerControl, req); req->doAccel = do_acc; req->doThresh = do_thresh; req->accelNum = acc_numerator; req->accelDenum = acc_denominator; req->threshold = threshold; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ChProp.c0000644000000000000000000000532113614532331014200 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XChangeProperty ( register Display *dpy, Window w, Atom property, Atom type, int format, /* 8, 16, or 32 */ int mode, /* PropModeReplace, PropModePrepend, PropModeAppend */ _Xconst unsigned char *data, int nelements) { register xChangePropertyReq *req; register long len; LockDisplay(dpy); GetReq (ChangeProperty, req); req->window = w; req->property = property; req->type = type; req->mode = mode; if (nelements < 0) { req->nUnits = 0; req->format = 0; /* ask for garbage, get garbage */ } else { req->nUnits = nelements; req->format = format; } switch (req->format) { case 8: len = ((long)nelements + 3)>>2; if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { SetReqLen(req, len, len); Data (dpy, (_Xconst char *)data, nelements); } /* else force BadLength */ break; case 16: len = ((long)nelements + 1)>>1; if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { SetReqLen(req, len, len); len = (long)nelements << 1; Data16 (dpy, (_Xconst short *) data, len); } /* else force BadLength */ break; case 32: len = nelements; if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { SetReqLen(req, len, len); len = (long)nelements << 2; Data32 (dpy, (_Xconst long *) data, len); } /* else force BadLength */ break; default: /* BadValue will be generated */ ; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ChSaveSet.c0000644000000000000000000000330113614532331014626 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XChangeSaveSet( register Display *dpy, Window win, int mode) { register xChangeSaveSetReq *req; LockDisplay(dpy); GetReq(ChangeSaveSet, req); req->window = win; req->mode = mode; UnlockDisplay(dpy); SyncHandle(); return 1; } int XAddToSaveSet( register Display *dpy, Window win) { return XChangeSaveSet(dpy,win,SetModeInsert); } int XRemoveFromSaveSet ( register Display *dpy, Window win) { return XChangeSaveSet(dpy,win,SetModeDelete); } nx-libs-3.5.99.23/nx-X11/lib/src/ChWAttrs.c0000644000000000000000000000363113614532331014506 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #define AllMaskBits (CWBackPixmap|CWBackPixel|CWBorderPixmap|\ CWBorderPixel|CWBitGravity|CWWinGravity|\ CWBackingStore|CWBackingPlanes|CWBackingPixel|\ CWOverrideRedirect|CWSaveUnder|CWEventMask|\ CWDontPropagate|CWColormap|CWCursor) int XChangeWindowAttributes ( register Display *dpy, Window w, unsigned long valuemask, XSetWindowAttributes *attributes) { register xChangeWindowAttributesReq *req; LockDisplay(dpy); GetReq(ChangeWindowAttributes,req); req->window = w; valuemask &= AllMaskBits; if ((req->valueMask = valuemask)) _XProcessWindowAttributes (dpy, req, valuemask, attributes); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ChWindow.c0000644000000000000000000000323413614532331014530 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XResizeWindow( register Display *dpy, Window w, unsigned int width, unsigned int height) { register xConfigureWindowReq *req; LockDisplay(dpy); GetReqExtra(ConfigureWindow, 8, req); /* 2 4-byte quantities */ req->window = w; req->mask = CWWidth | CWHeight; { CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xConfigureWindowReq); *valuePtr++ = width; *valuePtr = height; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/CirWin.c0000644000000000000000000000274713614532331014211 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XCirculateSubwindows( register Display *dpy, Window w, int direction) { register xCirculateWindowReq *req; LockDisplay(dpy); GetReq(CirculateWindow, req); req->window = w; req->direction = direction; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/CirWinDn.c0000644000000000000000000000273313614532331014466 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XCirculateSubwindowsDown( register Display *dpy, Window w) { register xCirculateWindowReq *req; LockDisplay(dpy); GetReq(CirculateWindow, req); req->window = w; req->direction = LowerHighest; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/CirWinUp.c0000644000000000000000000000273013614532331014506 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XCirculateSubwindowsUp( register Display *dpy, Window w) { register xCirculateWindowReq *req; LockDisplay(dpy); GetReq(CirculateWindow, req); req->window = w; req->direction = RaiseLowest; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ClDisplay.c0000644000000000000000000000477513614532331014705 0ustar /* Copyright 1985, 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #if USE_XCB #include "Xxcbint.h" #else /* !USE_XCB */ #include #endif /* USE_XCB */ #include "Xlib.h" #include "Xlibint.h" #include "Xintconn.h" /* * XCloseDisplay - XSync the connection to the X Server, close the connection, * and free all associated storage. Extension close procs should only free * memory and must be careful about the types of requests they generate. */ int XCloseDisplay ( register Display *dpy) { register _XExtension *ext; register int i; if (!(dpy->flags & XlibDisplayClosing)) { dpy->flags |= XlibDisplayClosing; for (i = 0; i < dpy->nscreens; i++) { register Screen *sp = &dpy->screens[i]; XFreeGC (dpy, sp->default_gc); } if (dpy->cursor_font != None) { XUnloadFont (dpy, dpy->cursor_font); } XSync(dpy, 1); /* throw away pending events, catch errors */ /* call out to any extensions interested */ for (ext = dpy->ext_procs; ext; ext = ext->next) { if (ext->close_display) (*ext->close_display)(dpy, &ext->codes); } /* if the closes generated more protocol, sync them up */ if (dpy->request != dpy->last_request_read) XSync(dpy, 1); } #if USE_XCB xcb_disconnect(dpy->xcb->connection); #else /* !USE_XCB */ _XDisconnectDisplay(dpy->trans_conn); #endif /* USE_XCB */ _XFreeDisplayStructure (dpy); return 0; } nx-libs-3.5.99.23/nx-X11/lib/src/ClearArea.c0000644000000000000000000000315413614532331014626 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XClearArea ( register Display *dpy, Window w, int x, int y, unsigned int width, unsigned int height, Bool exposures) { register xClearAreaReq *req; LockDisplay(dpy); GetReq(ClearArea, req); req->window = w; req->x = x; req->y = y; req->width = width; req->height = height; req->exposures = exposures; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/Clear.c0000644000000000000000000000305313614532331014033 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XClearWindow( register Display *dpy, Window w) { register xClearAreaReq *req; LockDisplay(dpy); GetReq(ClearArea, req); req->window = w; req->x = req->y = req->width = req->height = 0; /* these values mean "clear the entire window" */ req->exposures = xFalse; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/Cmap.h0000644000000000000000000000023313614532331013667 0ustar #ifndef _CMAP_H_ #define _CMAP_H_ #include extern void _XcmsDeleteCmapRec( Display *dpy, Colormap cmap); #endif /* _CMAP_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/ConfWind.c0000644000000000000000000000333213614532331014514 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XMoveResizeWindow( register Display *dpy, Window w, int x, int y, unsigned int width, unsigned int height) { register xConfigureWindowReq *req; LockDisplay(dpy); GetReqExtra(ConfigureWindow, 16, req); req->window = w; req->mask = CWX | CWY | CWWidth | CWHeight; { register CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xConfigureWindowReq); *valuePtr++ = x; *valuePtr++ = y; *valuePtr++ = width; *valuePtr = height; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ConnDis.c0000644000000000000000000011637613614532331014357 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * This file contains operating system dependencies. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #ifdef HASXDMAUTH #include #endif #include #include #include #if !defined(WIN32) #include #else #include #endif #ifndef X_CONNECTION_RETRIES /* number retries on ECONNREFUSED */ #define X_CONNECTION_RETRIES 5 #endif #include "Xintconn.h" /* prototypes */ static void GetAuthorization( XtransConnInfo trans_conn, int family, char *saddr, int saddrlen, int idisplay, char **auth_namep, int *auth_namelenp, char **auth_datap, int *auth_datalenp); /* functions */ static char *copystring (const char *src, int len) { char *dst = Xmalloc (len + 1); if (dst) { strncpy (dst, src, len); dst[len] = '\0'; } return dst; } #define Xstrdup(s) copystring(s, strlen(s)) #ifdef TCPCONN # define TCP_TRANS "tcp" #endif #ifdef UNIXCONN # define UNIX_TRANS "unix" #endif #if defined(LOCALCONN) || defined(UNIXCONN) # define LOCAL_TRANS "local" #endif /* FIXME: This should be handled through Makefile/configure logic. See configure.ac in upstream libX11 */ #ifdef UNIXCONN # ifdef TCPCONN # define LOCAL_TRANSPORT_LIST LOCAL_TRANS,UNIX_TRANS,TCP_TRANS # else # define LOCAL_TRANSPORT_LIST LOCAL_TRANS,UNIX_TRANS # endif #else # ifdef TCPCONN # define LOCAL_TRANSPORT_LIST TCP_TRANS # else # define LOCAL_TRANSPORT_LIST # endif #endif /* * Attempts to connect to server, given display name. Returns file descriptor * (network socket) or -1 if connection fails. Display names may be of the * following format: * * [protocol/] [hostname] : [:] displaynumber [.screennumber] * * A string with exactly two colons seperating hostname from the * display indicates a (now unsupported) DECnet style name. Colons in * the hostname may occur if an IPv6 numeric address is used as the * hostname. An IPv6 numeric address may also end in a double colon, * so three colons in a row indicates an IPv6 address ending in :: * followed by :display. To make it easier for people to read, an * IPv6 numeric address hostname may be surrounded by [ ] in a similar * fashion to the IPv6 numeric address URL syntax defined by IETF RFC * 2732. * * If no hostname and no protocol is specified, the string is interpreted * as the most efficient local connection to a server on the same machine. * This is usually: * * o shared memory * o local stream * o UNIX domain socket * o TCP to local host * * This function will eventually call the X Transport Interface functions * which expects the hostname in the format: * * [protocol/] [hostname] : [:] displaynumber * */ XtransConnInfo _X11TransConnectDisplay ( char *display_name, char **fullnamep, /* RETURN */ int *dpynump, /* RETURN */ int *screenp, /* RETURN */ char **auth_namep, /* RETURN */ int *auth_namelenp, /* RETURN */ char **auth_datap, /* RETURN */ int *auth_datalenp) /* RETURN */ { int family; int saddrlen; Xtransaddr *saddr; char *lastp, *lastc, *p; /* char pointers */ char *pprotocol = NULL; /* start of protocol name */ char *phostname = NULL; /* start of host of display */ char *pdpynum = NULL; /* start of dpynum of display */ char *pscrnum = NULL; /* start of screen of display */ int idisplay = 0; /* required display number */ int iscreen = 0; /* optional screen number */ /* int (*connfunc)(); */ /* method to create connection */ int len, hostlen; /* length tmp variable */ int retry; /* retry counter */ char addrbuf[128]; /* final address passed to X Transport Interface */ char* address = addrbuf; XtransConnInfo trans_conn = NULL; /* transport connection object */ int connect_stat; #if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN) Bool reset_hostname = False; /* Reset hostname? */ char *original_hostname = NULL; int local_transport_index = -1; const char *local_transport[] = { LOCAL_TRANSPORT_LIST, NULL }; #endif p = display_name; saddrlen = 0; /* set so that we can clear later */ saddr = NULL; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "_X11TransConnectDisplay: Called with display_name [%s].\n", display_name); #endif #ifdef NX_TRANS_SOCKET /* * Check if user selected the "nx" * protocol or an "nx" hostname. */ if (!strncasecmp(p, "nx/", 3) || !strcasecmp(p, "nx") || !strncasecmp(p, "nx:", 3) || !strncasecmp(p, "nx,", 3)) { if (*(display_name + 2) == '/') { p += 3; } pprotocol = copystring ("nx", 2); if (!pprotocol) goto bad; #ifdef NX_TRANS_TEST fprintf(stderr, "_X11TransConnectDisplay: Forced protocol to [%s].\n", pprotocol); #endif } else { #endif /* * Step 0, find the protocol. This is delimited by the optional * slash ('/'). */ for (lastp = p; *p && *p != ':' && *p != '/'; p++) ; if (!*p) return NULL; /* must have a colon */ if (p != lastp && *p != ':') { /* protocol given? */ pprotocol = copystring (lastp, p - lastp); if (!pprotocol) goto bad; /* no memory */ p++; /* skip the '/' */ } else p = display_name; /* reset the pointer in case no protocol was given */ #ifdef NX_TRANS_SOCKET } /* End of step 0. */ /* * Check if user specified the "nx" protocol or * hostname is "nx" or in the form "nx,...". */ if (pprotocol && !strcasecmp(pprotocol, "nx")) { #ifdef NX_TRANS_TEST fprintf(stderr, "_X11TransConnectDisplay: Checking hostname [%s].\n", p); #endif /* * Options can include a "display=" tuple so * need to scan right to left. */ lastp = p; lastc = NULL; for (; *p; p++) if (*p == ':') lastc = p; /* * Don't complain if no screen was provided. */ if (lastc) { phostname = copystring (lastp, lastc - lastp); p = lastc; } else { phostname = copystring (lastp, strlen(lastp)); } if (!phostname) goto bad; #ifdef NX_TRANS_TEST fprintf(stderr, "_X11TransConnectDisplay: Forced hostname [%s].\n", phostname); #endif } else { #endif /* * Step 1, find the hostname. This is delimited by either one colon, * or two colons in the case of DECnet (DECnet Phase V allows a single * colon in the hostname). (See note above regarding IPv6 numeric * addresses with triple colons or [] brackets.) * FIXME: we do not support DECnet anymore, so maybe remove these checks? */ lastp = p; lastc = NULL; for (; *p; p++) if (*p == ':') lastc = p; if (!lastc) return NULL; /* must have a colon */ if ((lastp != lastc) && (*(lastc - 1) == ':') #if defined(IPv6) && defined(AF_INET6) && ( ((lastc - 1) == lastp) || (*(lastc - 2) != ':')) #endif ) { /* DECnet display specified */ goto bad; } else hostlen = lastc - lastp; if (hostlen > 0) { /* hostname given? */ phostname = copystring (lastp, hostlen); if (!phostname) goto bad; /* no memory */ } p = lastc; #if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN) /* check if phostname == localnodename AND protocol not specified */ if (!pprotocol && phostname) { char localhostname[256]; if ((_XGetHostname (localhostname, sizeof localhostname) > 0) && (strcmp(phostname, localhostname) == 0)) { original_hostname = phostname; phostname = NULL; reset_hostname = True; } } #endif #ifdef NX_TRANS_SOCKET } /* End of step 1. */ /* * Check if no display was specified. In this case * search the "port=n" option in NX host string. */ if (*p) { #endif /* * Step 2, find the display number. This field is required and is * delimited either by a nul or a period, depending on whether or not * a screen number is present. */ for (lastp = ++p; *p && isascii(*p) && isdigit(*p); p++) ; if ((p == lastp) || /* required field */ (*p != '\0' && *p != '.') || /* invalid non-digit terminator */ !(pdpynum = copystring (lastp, p - lastp))) /* no memory */ goto bad; idisplay = atoi (pdpynum); #ifdef NX_TRANS_SOCKET } else { char *host = NULL; char *name = NULL; char *value = NULL; #ifdef NX_TRANS_TEST fprintf(stderr, "_X11TransConnectDisplay: Searching port in port [%s].\n", phostname); #endif if (!strncasecmp(phostname, "nx,", 3)) { host = copystring(phostname + 3, strlen(phostname) - 3); } if (!host) goto bad; idisplay = -1; name = strtok(host, "="); while (name) { value = strtok(NULL, ","); if (value == NULL || strstr(value, "=") != NULL || strstr(name, ",") != NULL || strlen(value) >= 128) { Xfree(host); goto bad; } else if (strcasecmp(name, "port") == 0) { idisplay = atoi(value); pdpynum = copystring(value, strlen(value)); if (!pdpynum) goto bad; break; } name = strtok(NULL, "="); } Xfree(host); if (idisplay == -1) { goto bad; } } /* End of step 2. */ #endif /* * Step 3, find the screen number. This field is optional. It is * present only if the display number was followed by a period (which * we've already verified is the only non-nul character). */ if (*p) { for (lastp = ++p; *p && isascii(*p) && isdigit (*p); p++) ; if (p != lastp) { if (*p || /* non-digits */ !(pscrnum = copystring (lastp, p - lastp))) /* no memory */ goto bad; iscreen = atoi (lastp); } } /* * At this point, we know the following information: * * pprotocol protocol string or NULL * phostname hostname string or NULL * idisplay display number * iscreen screen number * * We can now decide which transport to use based on the ConnectionFlags * build parameter the hostname string. If phostname is NULL or equals * the string "local", then choose the best transport. If phostname * is "unix", then choose BSD UNIX domain sockets (if configured). */ #ifdef NX_TRANS_SOCKET /* * If user selected the "nx" protocol * force "local" transport. */ if (pprotocol && !strcasecmp(pprotocol, "nx")) { pprotocol = copystring ("local", 5); if (!pprotocol) goto bad; #ifdef NX_TRANS_TEST fprintf(stderr, "_X11TransConnectDisplay: Converted protocol to [%s].\n", pprotocol); #endif } #endif #if defined(TCPCONN) || defined(UNIXCONN) || defined(LOCALCONN) if (!pprotocol) { #if defined(UNIXCONN) if (phostname && (strcmp (phostname, "unix") == 0)) { Xfree(pprotocol); pprotocol = copystring ("unix", 4); } else #endif #ifdef HAVE_LAUNCHD if (phostname && phostname[0]=='/') { pprotocol = copystring ("local", 5); } #endif if (!phostname) { if (local_transport[0] != NULL) { pprotocol = Xstrdup(local_transport[0]); local_transport_index = 0; } } if (!pprotocol) { /* if still not found one, tcp is our last resort */ pprotocol = copystring ("tcp", 3); } } #endif connect: /* * This seems kind of backwards, but we need to put the protocol, * host, and port back together to pass to _X11TransOpenCOTSClient(). */ { int olen = 3 + (pprotocol ? strlen(pprotocol) : 0) + (phostname ? strlen(phostname) : 0) + (pdpynum ? strlen(pdpynum) : 0); if (olen > sizeof addrbuf) address = Xmalloc (olen); } if (!address) goto bad; sprintf(address,"%s/%s:%d", pprotocol ? pprotocol : "", phostname ? phostname : "", idisplay ); /* * Make the connection, also need to get the auth address info for * the connection. Do retries in case server host has hit its * backlog (which, unfortunately, isn't distinguishable from there not * being a server listening at all, which is why we have to not retry * too many times). */ #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "_X11TransConnectDisplay: Entering connection loop.\n"); #endif for(retry=X_CONNECTION_RETRIES; retry>=0; retry-- ) { #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransOpenCOTSClient(address) with address [%s].\n", address); #endif if ( (trans_conn = _X11TransOpenCOTSClient(address)) == NULL ) { break; } #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransConnect(trans_conn,address).\n"); #endif if ((connect_stat = _X11TransConnect(trans_conn,address)) < 0 ) { #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransClose(trans_conn).\n"); #endif _X11TransClose(trans_conn); trans_conn = NULL; if (connect_stat == TRANS_TRY_CONNECT_AGAIN) continue; else break; } #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr).\n"); #endif _X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr); /* * The family is given in a socket format (ie AF_INET). This * will convert it to the format used by the authorization and * X protocol (ie FamilyInternet). */ #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransConvertAddress(&family, &saddrlen, &saddr).\n"); #endif if( _X11TransConvertAddress(&family, &saddrlen, &saddr) < 0 ) { _X11TransClose(trans_conn); trans_conn = NULL; if (saddr) { free ((char *) saddr); saddr = NULL; } continue; } break; } #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "_X11TransConnectDisplay: Out of connection loop.\n"); #endif if (address != addrbuf) Xfree (address); address = addrbuf; if( trans_conn == NULL ) goto bad; /* * Set close-on-exec so that programs that fork() doesn't get confused. */ _X11TransSetOption(trans_conn,TRANS_CLOSEONEXEC,1); /* * Build the expanded display name: * * [host] : [:] dpy . scr \0 */ #if defined(LOCALCONN) || defined(TCPCONN) || defined(UNIXCONN) /* * If we computed the host name, get rid of it so that * XDisplayString() and XDisplayName() agree. */ if (reset_hostname && (phostname != original_hostname)) { Xfree (phostname); phostname = original_hostname; original_hostname = NULL; } #endif len = ((phostname ? strlen(phostname) : 0) + 1 + strlen(pdpynum) + 1 + (pscrnum ? strlen(pscrnum) : 1) + 1); *fullnamep = (char *) Xmalloc (len); if (!*fullnamep) goto bad; #ifdef HAVE_LAUNCHD if (phostname && strlen(phostname) > 11 && !strncmp(phostname, "/tmp/launch", 11)) sprintf (*fullnamep, "%s%s%d", (phostname ? phostname : ""), ":", idisplay); else #endif sprintf (*fullnamep, "%s%s%d.%d", (phostname ? phostname : ""), ":", idisplay, iscreen); *dpynump = idisplay; *screenp = iscreen; if (pprotocol) Xfree (pprotocol); if (phostname) Xfree (phostname); if (pdpynum) Xfree (pdpynum); if (pscrnum) Xfree (pscrnum); #if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN) if (original_hostname) Xfree (original_hostname); #endif GetAuthorization(trans_conn, family, (char *) saddr, saddrlen, idisplay, auth_namep, auth_namelenp, auth_datap, auth_datalenp); return trans_conn; /* * error return; make sure everything is cleaned up. */ bad: if (trans_conn) (void)_X11TransClose(trans_conn); if (saddr) free ((char *) saddr); if (pprotocol) Xfree (pprotocol); if (phostname) Xfree (phostname); if (address && address != addrbuf) { Xfree(address); address = addrbuf; } #if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN) /* If connecting to the local machine, and we failed, try again with * the next transport type available, if there is one. */ if (local_transport_index >= 0) { if (local_transport[++local_transport_index] != NULL) { pprotocol = Xstrdup(local_transport[local_transport_index]); #ifdef TCPCONN if (strcmp(pprotocol, "tcp") == 0) { if (original_hostname != NULL) { phostname = original_hostname; original_hostname = NULL; } else { phostname = copystring("localhost", 9); } } else #endif /* TCPCONN */ { if ((phostname != NULL) && (original_hostname == NULL)) { original_hostname = phostname; } phostname = NULL; } goto connect; } } /* No more to try, we've failed all available local transports */ if (original_hostname) Xfree(original_hostname); #endif /* LOCALCONN || UNIXCONN || TCPCONN */ if (pdpynum) Xfree (pdpynum); if (pscrnum) Xfree (pscrnum); return NULL; } /* * This is gross, but we need it for compatiblity. * The test suite relies on the following interface. * */ int _XConnectDisplay ( char *display_name, char **fullnamep, /* RETURN */ int *dpynump, /* RETURN */ int *screenp, /* RETURN */ char **auth_namep, /* RETURN */ int *auth_namelenp, /* RETURN */ char **auth_datap, /* RETURN */ int *auth_datalenp) /* RETURN */ { XtransConnInfo trans_conn; trans_conn = _X11TransConnectDisplay ( display_name, fullnamep, dpynump, screenp, auth_namep, auth_namelenp, auth_datap, auth_datalenp); if (trans_conn) { int fd = _X11TransGetConnectionNumber (trans_conn); _X11TransFreeConnInfo (trans_conn); return (fd); } else return (-1); } /***************************************************************************** * * * Connection Utility Routines * * * *****************************************************************************/ /* * Disconnect from server. */ int _XDisconnectDisplay (XtransConnInfo trans_conn) { _X11TransDisconnect(trans_conn); _X11TransClose(trans_conn); return 0; } Bool _XSendClientPrefix( Display *dpy, xConnClientPrefix *client, /* contains count for auth_* */ char *auth_proto, char *auth_string, /* NOT null-terminated */ xConnSetupPrefix *prefix) /* prefix information */ { int auth_length = client->nbytesAuthProto; int auth_strlen = client->nbytesAuthString; static char padbuf[3]; /* for padding to 4x bytes */ int pad; struct iovec iovarray[5], *iov = iovarray; int niov = 0; int len = 0; #define add_to_iov(b,l) \ { iov->iov_base = (b); iov->iov_len = (l); iov++, niov++; len += (l); } add_to_iov ((caddr_t) client, SIZEOF(xConnClientPrefix)); /* * write authorization protocol name and data */ if (auth_length > 0) { add_to_iov (auth_proto, auth_length); pad = -auth_length & 3; /* pad auth_length to a multiple of 4 */ if (pad) add_to_iov (padbuf, pad); } if (auth_strlen > 0) { add_to_iov (auth_string, auth_strlen); pad = -auth_strlen & 3; /* pad auth_strlen to a multiple of 4 */ if (pad) add_to_iov (padbuf, pad); } #undef add_to_iov len -= _X11TransWritev (dpy->trans_conn, iovarray, niov); /* * Set the connection non-blocking since we use select() to block. */ _X11TransSetOption(dpy->trans_conn, TRANS_NONBLOCKING, 1); if (len != 0) return -1; #ifdef NX_TRANS_SOCKET if (_NXDisplayWriteFunction != NULL) { (*_NXDisplayWriteFunction)(dpy, len); } #ifdef NX_TRANS_CHANGE if (_NXDisplayCongestionFunction != NULL && _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { (*_NXDisplayCongestionFunction)(dpy, congestion); } #endif #endif #ifdef K5AUTH if (auth_length == 14 && !strncmp(auth_proto, "MIT-KERBEROS-5", 14)) { return k5_clientauth(dpy, prefix); } else #endif return 0; } #ifdef SECURE_RPC #include #ifdef ultrix #include #include #endif #endif #ifdef HASXDMAUTH #include #define Time_t time_t #endif /* * First, a routine for setting authorization data */ static int xauth_namelen = 0; static char *xauth_name = NULL; /* NULL means use default mechanism */ static int xauth_datalen = 0; static char *xauth_data = NULL; /* NULL means get default data */ /* * This is a list of the authorization names which Xlib currently supports. * Xau will choose the file entry which matches the earliest entry in this * array, allowing us to prioritize these in terms of the most secure first */ static char *default_xauth_names[] = { #ifdef K5AUTH "MIT-KERBEROS-5", #endif #ifdef SECURE_RPC "SUN-DES-1", #endif #ifdef HASXDMAUTH "XDM-AUTHORIZATION-1", #endif "MIT-MAGIC-COOKIE-1" }; static _Xconst int default_xauth_lengths[] = { #ifdef K5AUTH 14, /* strlen ("MIT-KERBEROS-5") */ #endif #ifdef SECURE_RPC 9, /* strlen ("SUN-DES-1") */ #endif #ifdef HASXDMAUTH 19, /* strlen ("XDM-AUTHORIZATION-1") */ #endif 18 /* strlen ("MIT-MAGIC-COOKIE-1") */ }; #define NUM_DEFAULT_AUTH (sizeof (default_xauth_names) / sizeof (default_xauth_names[0])) static char **xauth_names = default_xauth_names; static _Xconst int *xauth_lengths = default_xauth_lengths; static int xauth_names_length = NUM_DEFAULT_AUTH; void XSetAuthorization ( char *name, int namelen, /* *len are lengths of name and data */ char *data, int datalen) /* name/data are NULL or arbitrary array of bytes */ { char *tmpname, *tmpdata; _XLockMutex(_Xglobal_lock); if (xauth_name) Xfree (xauth_name); /* free any existing data */ if (xauth_data) Xfree (xauth_data); xauth_name = xauth_data = NULL; /* mark it no longer valid */ xauth_namelen = xauth_datalen = 0; _XUnlockMutex(_Xglobal_lock); if (namelen < 0) namelen = 0; /* check for bogus inputs */ if (datalen < 0) datalen = 0; /* maybe should return? */ if (namelen > 0) { /* try to allocate space */ tmpname = Xmalloc ((unsigned) namelen); if (!tmpname) return; memcpy (tmpname, name, namelen); } else { tmpname = NULL; } if (datalen > 0) { tmpdata = Xmalloc ((unsigned) datalen); if (!tmpdata) { if (tmpname) (void) Xfree (tmpname); return; } memcpy (tmpdata, data, datalen); } else { tmpdata = NULL; } _XLockMutex(_Xglobal_lock); xauth_name = tmpname; /* and store the suckers */ xauth_namelen = namelen; if (tmpname) { xauth_names = &xauth_name; xauth_lengths = &xauth_namelen; xauth_names_length = 1; } else { xauth_names = default_xauth_names; xauth_lengths = default_xauth_lengths; xauth_names_length = NUM_DEFAULT_AUTH; } xauth_data = tmpdata; xauth_datalen = datalen; _XUnlockMutex(_Xglobal_lock); return; } #ifdef SECURE_RPC /* * Create a credential that we can send to the X server. */ static int auth_ezencode( char *servername, int window, char *cred_out, int *len) { AUTH *a; XDR xdr; #if defined(SVR4) && defined(sun) a = authdes_seccreate(servername, window, NULL, NULL); #else a = (AUTH *)authdes_create(servername, window, NULL, NULL); #endif if (a == (AUTH *)NULL) { perror("auth_create"); return 0; } xdrmem_create(&xdr, cred_out, *len, XDR_ENCODE); if (AUTH_MARSHALL(a, &xdr) == FALSE) { perror("auth_marshall"); AUTH_DESTROY(a); return 0; } *len = xdr_getpos(&xdr); AUTH_DESTROY(a); return 1; } #endif #ifdef K5AUTH #include extern krb5_flags krb5_kdc_default_options; /* * k5_clientauth * * Returns non-zero if the setup prefix has been read, * so we can tell XOpenDisplay to not bother looking for it by * itself. */ static int k5_clientauth(dpy, sprefix) Display *dpy; xConnSetupPrefix *sprefix; { krb5_error_code retval; xReq prefix; char *buf; CARD16 plen, tlen; krb5_data kbuf; krb5_ccache cc; krb5_creds creds; krb5_principal cprinc, sprinc; krb5_ap_rep_enc_part *repl; krb5_init_ets(); /* * stage 0: get encoded principal and tgt from server */ _XRead(dpy, (char *)&prefix, sz_xReq); if (prefix.reqType != 2 && prefix.reqType != 3) /* not an auth packet... so deal */ if (prefix.reqType == 0 || prefix.reqType == 1) { memcpy((char *)sprefix, (char *)&prefix, sz_xReq); _XRead(dpy, (char *)sprefix + sz_xReq, sz_xConnSetupPrefix - sz_xReq); /* ewww... gross */ return 1; } else { fprintf(stderr, "Xlib: Krb5 stage 0: got illegal connection setup success code %d\n", prefix.reqType); return -1; } if (prefix.data != 0) { fprintf(stderr, "Xlib: got out of sequence (%d) packet in Krb5 auth\n", prefix.data); return -1; } buf = (char *)malloc((prefix.length << 2) - sz_xReq); if (buf == NULL) /* malloc failed. Run away! */ { fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n"); return -1; } tlen = (prefix.length << 2) - sz_xReq; _XRead(dpy, buf, tlen); if (prefix.reqType == 2 && tlen < 6) { fprintf(stderr, "Xlib: Krb5 stage 0 reply from server too short\n"); free(buf); return -1; } if (prefix.reqType == 2) { plen = *(CARD16 *)buf; kbuf.data = buf + 2; kbuf.length = (plen > tlen) ? tlen : plen; } else { kbuf.data = buf; kbuf.length = tlen; } if (XauKrb5Decode(kbuf, &sprinc)) { free(buf); fprintf(stderr, "Xlib: XauKrb5Decode bombed\n"); return -1; } if (prefix.reqType == 3) /* do some special stuff here */ { char *sname, *hostname = NULL; sname = (char *)malloc(krb5_princ_component(sprinc, 0)->length + 1); if (sname == NULL) { free(buf); krb5_free_principal(sprinc); fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n"); return -1; } memcpy(sname, krb5_princ_component(sprinc, 0)->data, krb5_princ_component(sprinc, 0)->length); sname[krb5_princ_component(sprinc, 0)->length] = '\0'; krb5_free_principal(sprinc); if (dpy->display_name[0] != ':') /* hunt for a hostname */ { char *t; if ((hostname = (char *)malloc(strlen(dpy->display_name))) == NULL) { free(buf); free(sname); fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n"); return -1; } strcpy(hostname, dpy->display_name); t = strchr(hostname, ':'); if (t == NULL) { free(buf); free(sname); free(hostname); fprintf(stderr, "Xlib: shouldn't get here! malformed display name."); return -1; } if ((t - hostname + 1 < strlen(hostname)) && t[1] == ':') t++; *t = '\0'; /* truncate the dpy number out */ } retval = krb5_sname_to_principal(hostname, sname, KRB5_NT_SRV_HST, &sprinc); free(sname); if (hostname) free(hostname); if (retval) { free(buf); fprintf(stderr, "Xlib: krb5_sname_to_principal failed: %s\n", error_message(retval)); return -1; } } if (retval = krb5_cc_default(&cc)) { free(buf); krb5_free_principal(sprinc); fprintf(stderr, "Xlib: krb5_cc_default failed: %s\n", error_message(retval)); return -1; } if (retval = krb5_cc_get_principal(cc, &cprinc)) { free(buf); krb5_free_principal(sprinc); fprintf(stderr, "Xlib: cannot get Kerberos principal from \"%s\": %s\n", krb5_cc_default_name(), error_message(retval)); return -1; } bzero((char *)&creds, sizeof(creds)); creds.server = sprinc; creds.client = cprinc; if (prefix.reqType == 2) { creds.second_ticket.length = tlen - plen - 2; creds.second_ticket.data = buf + 2 + plen; retval = krb5_get_credentials(KRB5_GC_USER_USER | krb5_kdc_default_options, cc, &creds); } else retval = krb5_get_credentials(krb5_kdc_default_options, cc, &creds); if (retval) { free(buf); krb5_free_cred_contents(&creds); fprintf(stderr, "Xlib: cannot get Kerberos credentials: %s\n", error_message(retval)); return -1; } /* * now format the ap_req to send to the server */ if (prefix.reqType == 2) retval = krb5_mk_req_extended(AP_OPTS_USE_SESSION_KEY | AP_OPTS_MUTUAL_REQUIRED, NULL, 0, 0, NULL, cc, &creds, NULL, &kbuf); else retval = krb5_mk_req_extended(AP_OPTS_MUTUAL_REQUIRED, NULL, 0, 0, NULL, cc, &creds, NULL, &kbuf); free(buf); if (retval) /* Some manner of Kerberos lossage */ { krb5_free_cred_contents(&creds); fprintf(stderr, "Xlib: krb5_mk_req_extended failed: %s\n", error_message(retval)); return -1; } prefix.reqType = 1; prefix.data = 0; prefix.length = (kbuf.length + sz_xReq + 3) >> 2; /* * stage 1: send ap_req to server */ _XSend(dpy, (char *)&prefix, sz_xReq); _XSend(dpy, (char *)kbuf.data, kbuf.length); free(kbuf.data); /* * stage 2: get ap_rep from server to mutually authenticate */ _XRead(dpy, (char *)&prefix, sz_xReq); if (prefix.reqType != 2) if (prefix.reqType == 0 || prefix.reqType == 1) { memcpy((char *)sprefix, (char *)&prefix, sz_xReq); _XRead(dpy, (char *)sprefix + sz_xReq, sz_xConnSetupPrefix - sz_xReq); return 1; } else { fprintf(stderr, "Xlib: Krb5 stage 2: got illegal connection setup success code %d\n", prefix.reqType); return -1; } if (prefix.data != 2) return -1; kbuf.length = (prefix.length << 2) - sz_xReq; kbuf.data = (char *)malloc(kbuf.length); if (kbuf.data == NULL) { fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n"); return -1; } _XRead(dpy, (char *)kbuf.data, kbuf.length); retval = krb5_rd_rep(&kbuf, &creds.keyblock, &repl); if (retval) { free(kbuf.data); fprintf(stderr, "Xlib: krb5_rd_rep failed: %s\n", error_message(retval)); return -1; } free(kbuf.data); /* * stage 3: send a short ack to the server and return */ prefix.reqType = 3; prefix.data = 0; prefix.length = sz_xReq >> 2; _XSend(dpy, (char *)&prefix, sz_xReq); return 0; } #endif /* K5AUTH */ static void GetAuthorization( XtransConnInfo trans_conn, int family, char *saddr, int saddrlen, int idisplay, char **auth_namep, /* RETURN */ int *auth_namelenp, /* RETURN */ char **auth_datap, /* RETURN */ int *auth_datalenp) /* RETURN */ { #ifdef SECURE_RPC char rpc_cred[MAX_AUTH_BYTES]; #endif #ifdef HASXDMAUTH unsigned char xdmcp_data[192/8]; #endif char *auth_name; int auth_namelen; unsigned char *auth_data; int auth_datalen; Xauth *authptr = NULL; /* * Look up the authorization protocol name and data if necessary. */ if (xauth_name && xauth_data) { auth_namelen = xauth_namelen; auth_name = xauth_name; auth_datalen = xauth_datalen; auth_data = (unsigned char *) xauth_data; } else { char dpynumbuf[40]; /* big enough to hold 2^64 and more */ (void) sprintf (dpynumbuf, "%d", idisplay); authptr = XauGetBestAuthByAddr ((unsigned short) family, (unsigned short) saddrlen, saddr, (unsigned short) strlen (dpynumbuf), dpynumbuf, xauth_names_length, xauth_names, xauth_lengths); if (authptr) { auth_namelen = authptr->name_length; auth_name = (char *)authptr->name; auth_datalen = authptr->data_length; auth_data = (unsigned char *) authptr->data; } else { auth_namelen = 0; auth_name = NULL; auth_datalen = 0; auth_data = NULL; } } #ifdef HASXDMAUTH /* * build XDM-AUTHORIZATION-1 data */ if (auth_namelen == 19 && !strncmp (auth_name, "XDM-AUTHORIZATION-1", 19)) { int i, j; Time_t now; int family, addrlen; Xtransaddr *addr = NULL; for (j = 0; j < 8; j++) xdmcp_data[j] = auth_data[j]; _X11TransGetMyAddr(trans_conn, &family, &addrlen, &addr); switch( family ) { #ifdef AF_INET case AF_INET: { /* * addr will contain a sockaddr_in with all * of the members already in network byte order. */ for(i=4; i<8; i++) /* do sin_addr */ xdmcp_data[j++] = ((char *)addr)[i]; for(i=2; i<4; i++) /* do sin_port */ xdmcp_data[j++] = ((char *)addr)[i]; break; } #endif /* AF_INET */ #if defined(IPv6) && defined(AF_INET6) case AF_INET6: /* XXX This should probably never happen */ { unsigned char ipv4mappedprefix[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff }; /* In the case of v4 mapped addresses send the v4 part of the address - addr is already in network byte order */ if (memcmp((char*)addr+8, ipv4mappedprefix, 12) == 0) { for (i = 20 ; i < 24; i++) xdmcp_data[j++] = ((char *)addr)[i]; /* Port number */ for (i=2; i<4; i++) xdmcp_data[j++] = ((char *)addr)[i]; } else { /* Fake data to keep the data aligned. Otherwise the the server will bail about incorrect timing data */ for (i = 0; i < 6; i++) { xdmcp_data[j++] = 0; } } break; } #endif /* AF_INET6 */ #ifdef AF_UNIX case AF_UNIX: { /* * We don't use the sockaddr_un for this encoding. * Instead, we create a sockaddr_in filled with * a decreasing counter for the address, and the * pid for the port. */ static unsigned long unix_addr = 0xFFFFFFFF; unsigned long the_addr; unsigned short the_port; unsigned long the_utime; struct timeval tp; X_GETTIMEOFDAY(&tp); _XLockMutex(_Xglobal_lock); the_addr = unix_addr--; _XUnlockMutex(_Xglobal_lock); the_utime = (unsigned long) tp.tv_usec; the_port = getpid (); xdmcp_data[j++] = (the_utime >> 24) & 0xFF; xdmcp_data[j++] = (the_utime >> 16) & 0xFF; xdmcp_data[j++] = ((the_utime >> 8) & 0xF0) | ((the_addr >> 8) & 0x0F); xdmcp_data[j++] = (the_addr >> 0) & 0xFF; xdmcp_data[j++] = (the_port >> 8) & 0xFF; xdmcp_data[j++] = (the_port >> 0) & 0xFF; break; } #endif /* AF_UNIX */ default: /* * Need to return some kind of errro status here. * maybe a NULL auth?? */ break; } /* switch */ if (addr) free ((char *) addr); time (&now); xdmcp_data[j++] = (now >> 24) & 0xFF; xdmcp_data[j++] = (now >> 16) & 0xFF; xdmcp_data[j++] = (now >> 8) & 0xFF; xdmcp_data[j++] = (now >> 0) & 0xFF; while (j < 192 / 8) xdmcp_data[j++] = 0; _XLockMutex(_Xglobal_lock); /* this function might use static data, hence the lock around it */ XdmcpWrap (xdmcp_data, auth_data + 8, xdmcp_data, j); _XUnlockMutex(_Xglobal_lock); auth_data = xdmcp_data; auth_datalen = j; } #endif /* HASXDMAUTH */ #ifdef SECURE_RPC /* * The SUN-DES-1 authorization protocol uses the * "secure RPC" mechanism in SunOS 4.0+. */ if (auth_namelen == 9 && !strncmp(auth_name, "SUN-DES-1", 9)) { char servernetname[MAXNETNAMELEN + 1]; /* * Copy over the server's netname from the authorization * data field filled in by XauGetAuthByAddr(). */ if (auth_datalen > MAXNETNAMELEN) { auth_datalen = 0; auth_data = NULL; } else { memcpy(servernetname, auth_data, auth_datalen); servernetname[auth_datalen] = '\0'; auth_datalen = sizeof (rpc_cred); if (auth_ezencode(servernetname, 100, rpc_cred, &auth_datalen)) auth_data = (unsigned char *) rpc_cred; else { auth_datalen = 0; auth_data = NULL; } } } #endif if (saddr) free ((char *) saddr); if ((*auth_namelenp = auth_namelen)) { if ((*auth_namep = Xmalloc(auth_namelen))) memcpy(*auth_namep, auth_name, auth_namelen); else *auth_namelenp = 0; } else *auth_namep = NULL; if ((*auth_datalenp = auth_datalen)) { if ((*auth_datap = Xmalloc(auth_datalen))) memcpy(*auth_datap, auth_data, auth_datalen); else *auth_datalenp = 0; } else *auth_datap = NULL; if (authptr) XauDisposeAuth (authptr); } nx-libs-3.5.99.23/nx-X11/lib/src/Context.c0000644000000000000000000002010513614532331014426 0ustar /*********************************************************** Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* Copyright 1987, 1988, 1990, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* This module implements a simple sparse array. XSaveContext(a,b,c,d) will store d in position (a,b,c) of the array. XFindContext(a,b,c,&d) will set d to be the value in position (a,b,c). XDeleteContext(a,b,c) will delete the entry in (a,b,c). a is a display id, b is a resource id, and c is a Context. d is just an XPointer. This code will work with any range of parameters, but is geared to be most efficient with very few (one or two) different a's. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xutil.h" #ifdef XTHREADS #include "locking.h" #endif #define INITHASHMASK 63 /* Number of entries originally in the hash table. */ typedef struct _TableEntryRec { /* Stores one entry. */ XID rid; XContext context; XPointer data; struct _TableEntryRec *next; } TableEntryRec, *TableEntry; typedef struct _XContextDB { /* Stores hash table for one display. */ TableEntry *table; /* Pointer to array of hash entries. */ int mask; /* Current size of hash table minus 1. */ int numentries; /* Number of entries currently in table. */ #ifdef XTHREADS LockInfoRec linfo; #endif } DBRec, *DB; #ifdef MOTIFBC static DB NullDB = (DB)0; #endif /* Given an XID and a context, returns a value between 0 and HashSize-1. Currently, this requires that HashSize be a power of 2. */ #define Hash(db,rid,context) \ (db)->table[(((rid) << 1) + context) & (db)->mask] /* Resize the given db */ static void ResizeTable(DB db) { TableEntry *otable; register TableEntry entry, next, *pold, *head; register int i, j; otable = db->table; for (i = INITHASHMASK+1; (i + i) < db->numentries; ) i += i; db->table = Xcalloc(i, sizeof(TableEntry)); if (!db->table) { db->table = otable; return; } j = db->mask + 1; db->mask = i - 1; for (pold = otable ; --j >= 0; pold++) { for (entry = *pold; entry; entry = next) { next = entry->next; head = &Hash(db, entry->rid, entry->context); entry->next = *head; *head = entry; } } Xfree(otable); } static void _XFreeContextDB(Display *display) { register DB db; register int i; register TableEntry *pentry, entry, next; db = display->context_db; if (db) { for (i = db->mask + 1, pentry = db->table ; --i >= 0; pentry++) { for (entry = *pentry; entry; entry = next) { next = entry->next; Xfree(entry); } } Xfree(db->table); _XFreeMutex(&db->linfo); Xfree(db); } } /* Public routines. */ /* Save the given value of data to correspond with the keys XID and context. Returns nonzero error code if an error has occured, 0 otherwise. Possible errors are Out-of-memory. */ int XSaveContext( Display *display, register XID rid, register XContext context, _Xconst char* data) { DB *pdb; register DB db; TableEntry *head; register TableEntry entry; #ifdef MOTIFBC if (!display) { pdb = &NullDB; db = *pdb; } else #endif { LockDisplay(display); pdb = &display->context_db; db = *pdb; UnlockDisplay(display); } if (!db) { db = Xmalloc(sizeof(DBRec)); if (!db) return XCNOMEM; db->mask = INITHASHMASK; db->table = Xcalloc(db->mask + 1, sizeof(TableEntry)); if (!db->table) { Xfree(db); return XCNOMEM; } db->numentries = 0; _XCreateMutex(&db->linfo); #ifdef MOTIFBC if (!display) *pdb = db; else #endif { LockDisplay(display); *pdb = db; display->free_funcs->context_db = _XFreeContextDB; UnlockDisplay(display); } } _XLockMutex(&db->linfo); head = &Hash(db, rid, context); _XUnlockMutex(&db->linfo); for (entry = *head; entry; entry = entry->next) { if (entry->rid == rid && entry->context == context) { entry->data = (XPointer)data; return 0; } } entry = Xmalloc(sizeof(TableEntryRec)); if (!entry) return XCNOMEM; entry->rid = rid; entry->context = context; entry->data = (XPointer)data; entry->next = *head; *head = entry; _XLockMutex(&db->linfo); db->numentries++; if (db->numentries > (db->mask << 2)) ResizeTable(db); _XUnlockMutex(&db->linfo); return 0; } /* Given an XID and context, returns the associated data. Note that data here is a pointer since it is a return value. Returns nonzero error code if an error has occured, 0 otherwise. Possible errors are Entry-not-found. */ int XFindContext(Display *display, XID rid, XContext context, XPointer *data) { register DB db; register TableEntry entry; #ifdef MOTIFBC if (!display) db = NullDB; else #endif { LockDisplay(display); db = display->context_db; UnlockDisplay(display); } if (!db) return XCNOENT; _XLockMutex(&db->linfo); for (entry = Hash(db, rid, context); entry; entry = entry->next) { if (entry->rid == rid && entry->context == context) { *data = (XPointer)entry->data; _XUnlockMutex(&db->linfo); return 0; } } _XUnlockMutex(&db->linfo); return XCNOENT; } /* Deletes the entry for the given XID and context from the datastructure. This returns the same thing that FindContext would have returned if called with the same arguments. */ int XDeleteContext(Display *display, XID rid, XContext context) { register DB db; register TableEntry entry, *prev; #ifdef MOTIFBC if (!display) db = NullDB; else #endif { LockDisplay(display); db = display->context_db; UnlockDisplay(display); } if (!db) return XCNOENT; _XLockMutex(&db->linfo); for (prev = &Hash(db, rid, context); (entry = *prev); prev = &entry->next) { if (entry->rid == rid && entry->context == context) { *prev = entry->next; Xfree(entry); db->numentries--; if (db->numentries < db->mask && db->mask > INITHASHMASK) ResizeTable(db); _XUnlockMutex(&db->linfo); return 0; } } _XUnlockMutex(&db->linfo); return XCNOENT; } nx-libs-3.5.99.23/nx-X11/lib/src/ConvSel.c0000644000000000000000000000317113614532331014357 0ustar /* Copyright 1986,1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XConvertSelection( register Display *dpy, Atom selection, Atom target, Atom property, Window requestor, Time time) { register xConvertSelectionReq *req; LockDisplay(dpy); GetReq(ConvertSelection, req); req->selection = selection; req->target = target; req->property = property; req->requestor = requestor; req->time = time; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/CopyArea.c0000644000000000000000000000346613614532331014520 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XCopyArea( register Display *dpy, Drawable src_drawable, Drawable dst_drawable, GC gc, int src_x, int src_y, unsigned int width, unsigned int height, int dst_x, int dst_y) { register xCopyAreaReq *req; LockDisplay(dpy); FlushGC(dpy, gc); GetReq(CopyArea, req); req->srcDrawable = src_drawable; req->dstDrawable = dst_drawable; req->gc = gc->gid; req->srcX = src_x; req->srcY = src_y; req->dstX = dst_x; req->dstY = dst_y; req->width = width; req->height = height; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/CopyCmap.c0000644000000000000000000000342213614532331014520 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #else #define XCMS 1 #endif #include "Xlibint.h" #if XCMS #include "Xcmsint.h" /* cmsCmap.c */ extern XcmsCmapRec * _XcmsCopyCmapRecAndFree(Display *dpy, Colormap src_cmap, Colormap copy_cmap); #endif Colormap XCopyColormapAndFree( register Display *dpy, Colormap src_cmap) { Colormap mid; register xCopyColormapAndFreeReq *req; LockDisplay(dpy); GetReq(CopyColormapAndFree, req); mid = req->mid = XAllocID(dpy); req->srcCmap = src_cmap; UnlockDisplay(dpy); SyncHandle(); #if XCMS _XcmsCopyCmapRecAndFree(dpy, src_cmap, mid); #endif return(mid); } nx-libs-3.5.99.23/nx-X11/lib/src/CopyGC.c0000644000000000000000000000766313614532331014144 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XCopyGC ( register Display *dpy, GC srcGC, unsigned long mask, /* which ones to set initially */ GC destGC) { register XGCValues *destgv = &destGC->values, *srcgv = &srcGC->values; register xCopyGCReq *req; register _XExtension *ext; LockDisplay(dpy); mask &= (1L << (GCLastBit + 1)) - 1; /* if some of the source values to be copied are "dirty", flush them out before sending the CopyGC request. */ if (srcGC->dirty & mask) _XFlushGCCache(dpy, srcGC); /* mark the copied values "not dirty" in the destination. */ destGC->dirty &= ~mask; GetReq(CopyGC, req); req->srcGC = srcGC->gid; req->dstGC = destGC->gid; req->mask = mask; if (mask & GCFunction) destgv->function = srcgv->function; if (mask & GCPlaneMask) destgv->plane_mask = srcgv->plane_mask; if (mask & GCForeground) destgv->foreground = srcgv->foreground; if (mask & GCBackground) destgv->background = srcgv->background; if (mask & GCLineWidth) destgv->line_width = srcgv->line_width; if (mask & GCLineStyle) destgv->line_style = srcgv->line_style; if (mask & GCCapStyle) destgv->cap_style = srcgv->cap_style; if (mask & GCJoinStyle) destgv->join_style = srcgv->join_style; if (mask & GCFillStyle) destgv->fill_style = srcgv->fill_style; if (mask & GCFillRule) destgv->fill_rule = srcgv->fill_rule; if (mask & GCArcMode) destgv->arc_mode = srcgv->arc_mode; if (mask & GCTile) destgv->tile = srcgv->tile; if (mask & GCStipple) destgv->stipple = srcgv->stipple; if (mask & GCTileStipXOrigin) destgv->ts_x_origin = srcgv->ts_x_origin; if (mask & GCTileStipYOrigin) destgv->ts_y_origin = srcgv->ts_y_origin; if (mask & GCFont) destgv->font = srcgv->font; if (mask & GCSubwindowMode) destgv->subwindow_mode = srcgv->subwindow_mode; if (mask & GCGraphicsExposures) destgv->graphics_exposures = srcgv->graphics_exposures; if (mask & GCClipXOrigin) destgv->clip_x_origin = srcgv->clip_x_origin; if (mask & GCClipYOrigin) destgv->clip_y_origin = srcgv->clip_y_origin; if (mask & GCClipMask) { destGC->rects = srcGC->rects; destgv->clip_mask = srcgv->clip_mask; } if (mask & GCDashOffset) destgv->dash_offset = srcgv->dash_offset; if (mask & GCDashList) { destGC->dashes = srcGC->dashes; destgv->dashes = srcgv->dashes; } /* call out to any extensions interested */ for (ext = dpy->ext_procs; ext; ext = ext->next) if (ext->copy_GC) (*ext->copy_GC)(dpy, destGC, &ext->codes); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/CopyPlane.c0000644000000000000000000000356613614532331014710 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XCopyPlane( register Display *dpy, Drawable src_drawable, Drawable dst_drawable, GC gc, int src_x, int src_y, unsigned int width, unsigned int height, int dst_x, int dst_y, unsigned long bit_plane) { register xCopyPlaneReq *req; LockDisplay(dpy); FlushGC(dpy, gc); GetReq(CopyPlane, req); req->srcDrawable = src_drawable; req->dstDrawable = dst_drawable; req->gc = gc->gid; req->srcX = src_x; req->srcY = src_y; req->dstX = dst_x; req->dstY = dst_y; req->width = width; req->height = height; req->bitPlane = bit_plane; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/CrBFData.c0000644000000000000000000000512713614532331014357 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlib.h" /* * XCreateBitmapFromData: Routine to make a pixmap of depth 1 from user * supplied data. * D is any drawable on the same screen that the pixmap will be used in. * Data is a pointer to the bit data, and * width & height give the size in bits of the pixmap. * * The following format is assumed for data: * * format=XYPixmap * bit_order=LSBFirst * byte_order=LSBFirst * padding=8 * bitmap_unit=8 * xoffset=0 * no extra bytes per line */ Pixmap XCreateBitmapFromData( Display *display, Drawable d, _Xconst char *data, unsigned int width, unsigned int height) { Pixmap pix = XCreatePixmap(display, d, width, height, 1); GC gc = XCreateGC(display, pix, (unsigned long) 0, (XGCValues *) 0); if (gc == NULL) { XFreePixmap(display, pix); return (Pixmap) None; } else { XImage ximage = { .height = height, .width = width, .depth = 1, .bits_per_pixel = 1, .xoffset = 0, .format = XYPixmap, .data = (char *) data, .byte_order = LSBFirst, .bitmap_unit = 8, .bitmap_bit_order = LSBFirst, .bitmap_pad = 8, .bytes_per_line = (width + 7) / 8, }; XPutImage(display, pix, gc, &ximage, 0, 0, 0, 0, width, height); XFreeGC(display, gc); return(pix); } } nx-libs-3.5.99.23/nx-X11/lib/src/CrCmap.c0000644000000000000000000000334413614532331014155 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" Colormap XCreateColormap( register Display *dpy, Window w, Visual *visual, int alloc) { register xCreateColormapReq *req; Colormap mid; LockDisplay(dpy); GetReq(CreateColormap, req); req->window = w; mid = req->mid = XAllocID(dpy); req->alloc = alloc; if (visual == CopyFromParent) req->visual = CopyFromParent; else req->visual = visual->visualid; UnlockDisplay(dpy); SyncHandle(); #ifdef XCMS _XcmsAddCmapRec(dpy, mid, w, visual); #endif return(mid); } nx-libs-3.5.99.23/nx-X11/lib/src/CrCursor.c0000644000000000000000000000433713614532331014555 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #ifdef USE_DYNAMIC_XCURSOR Cursor _XTryShapeBitmapCursor (Display *dpy, Pixmap source, Pixmap mask, XColor *foreground, XColor *background, unsigned int x, unsigned int y); #endif Cursor XCreatePixmapCursor( register Display *dpy, Pixmap source, Pixmap mask, XColor *foreground, XColor *background, unsigned int x, unsigned int y) { register xCreateCursorReq *req; Cursor cid; #ifdef USE_DYNAMIC_XCURSOR cid = _XTryShapeBitmapCursor (dpy, source, mask, foreground, background, x, y); if (cid) return cid; #endif LockDisplay(dpy); GetReq(CreateCursor, req); req->cid = cid = XAllocID(dpy); req->source = source; req->mask = mask; req->foreRed = foreground->red; req->foreGreen = foreground->green; req->foreBlue = foreground->blue; req->backRed = background->red; req->backGreen = background->green; req->backBlue = background->blue; req->x = x; req->y = y; UnlockDisplay(dpy); SyncHandle(); return (cid); } nx-libs-3.5.99.23/nx-X11/lib/src/CrGC.c0000644000000000000000000002377413614532331013577 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Cr.h" static XGCValues const initial_GC = { GXcopy, /* function */ AllPlanes, /* plane_mask */ 0L, /* foreground */ 1L, /* background */ 0, /* line_width */ LineSolid, /* line_style */ CapButt, /* cap_style */ JoinMiter, /* join_style */ FillSolid, /* fill_style */ EvenOddRule,/* fill_rule */ ArcPieSlice,/* arc_mode */ (Pixmap)~0L,/* tile, impossible (unknown) resource */ (Pixmap)~0L,/* stipple, impossible (unknown) resource */ 0, /* ts_x_origin */ 0, /* ts_y_origin */ (Font)~0L, /* font, impossible (unknown) resource */ ClipByChildren, /* subwindow_mode */ True, /* graphics_exposures */ 0, /* clip_x_origin */ 0, /* clip_y_origin */ None, /* clip_mask */ 0, /* dash_offset */ 4 /* dashes (list [4,4]) */ }; static void _XGenerateGCList( register Display *dpy, GC gc, xReq *req); GC XCreateGC ( register Display *dpy, Drawable d, /* Window or Pixmap for which depth matches */ unsigned long valuemask, /* which ones to set initially */ XGCValues *values) /* the values themselves */ { register GC gc; register xCreateGCReq *req; register _XExtension *ext; LockDisplay(dpy); if ((gc = Xmalloc (sizeof(struct _XGC))) == NULL) { UnlockDisplay(dpy); SyncHandle(); return (NULL); } gc->rects = 0; gc->dashes = 0; gc->ext_data = NULL; gc->values = initial_GC; gc->dirty = 0L; valuemask &= (1L << (GCLastBit + 1)) - 1; if (valuemask) _XUpdateGCCache (gc, valuemask, values); GetReq(CreateGC, req); req->drawable = d; req->gc = gc->gid = XAllocID(dpy); if ((req->mask = gc->dirty)) _XGenerateGCList (dpy, gc, (xReq *) req); /* call out to any extensions interested */ for (ext = dpy->ext_procs; ext; ext = ext->next) if (ext->create_GC) (*ext->create_GC)(dpy, gc, &ext->codes); gc->dirty = 0L; /* allow extensions to see dirty bits */ UnlockDisplay(dpy); SyncHandle(); return (gc); } /* * GenerateGCList looks at the GC dirty bits, and appends all the required * long words to the request being generated. */ static void _XGenerateGCList ( register Display *dpy, GC gc, xReq *req) { unsigned long values[32]; register unsigned long *value = values; long nvalues; register XGCValues *gv = &gc->values; register unsigned long dirty = gc->dirty; /* * Note: The order of these tests are critical; the order must be the * same as the GC mask bits in the word. */ if (dirty & GCFunction) *value++ = gv->function; if (dirty & GCPlaneMask) *value++ = gv->plane_mask; if (dirty & GCForeground) *value++ = gv->foreground; if (dirty & GCBackground) *value++ = gv->background; if (dirty & GCLineWidth) *value++ = gv->line_width; if (dirty & GCLineStyle) *value++ = gv->line_style; if (dirty & GCCapStyle) *value++ = gv->cap_style; if (dirty & GCJoinStyle) *value++ = gv->join_style; if (dirty & GCFillStyle) *value++ = gv->fill_style; if (dirty & GCFillRule) *value++ = gv->fill_rule; if (dirty & GCTile) *value++ = gv->tile; if (dirty & GCStipple) *value++ = gv->stipple; if (dirty & GCTileStipXOrigin) *value++ = gv->ts_x_origin; if (dirty & GCTileStipYOrigin) *value++ = gv->ts_y_origin; if (dirty & GCFont) *value++ = gv->font; if (dirty & GCSubwindowMode) *value++ = gv->subwindow_mode; if (dirty & GCGraphicsExposures) *value++ = gv->graphics_exposures; if (dirty & GCClipXOrigin) *value++ = gv->clip_x_origin; if (dirty & GCClipYOrigin) *value++ = gv->clip_y_origin; if (dirty & GCClipMask) *value++ = gv->clip_mask; if (dirty & GCDashOffset) *value++ = gv->dash_offset; if (dirty & GCDashList) *value++ = gv->dashes; if (dirty & GCArcMode) *value++ = gv->arc_mode; req->length += (nvalues = value - values); /* * note: Data is a macro that uses its arguments multiple * times, so "nvalues" is changed in a separate assignment * statement */ nvalues <<= 2; Data32 (dpy, (long *) values, nvalues); } int _XUpdateGCCache ( register GC gc, register unsigned long mask, register XGCValues *attr) { register XGCValues *gv = &gc->values; if (mask & GCFunction) if (gv->function != attr->function) { gv->function = attr->function; gc->dirty |= GCFunction; } if (mask & GCPlaneMask) if (gv->plane_mask != attr->plane_mask) { gv->plane_mask = attr->plane_mask; gc->dirty |= GCPlaneMask; } if (mask & GCForeground) if (gv->foreground != attr->foreground) { gv->foreground = attr->foreground; gc->dirty |= GCForeground; } if (mask & GCBackground) if (gv->background != attr->background) { gv->background = attr->background; gc->dirty |= GCBackground; } if (mask & GCLineWidth) if (gv->line_width != attr->line_width) { gv->line_width = attr->line_width; gc->dirty |= GCLineWidth; } if (mask & GCLineStyle) if (gv->line_style != attr->line_style) { gv->line_style = attr->line_style; gc->dirty |= GCLineStyle; } if (mask & GCCapStyle) if (gv->cap_style != attr->cap_style) { gv->cap_style = attr->cap_style; gc->dirty |= GCCapStyle; } if (mask & GCJoinStyle) if (gv->join_style != attr->join_style) { gv->join_style = attr->join_style; gc->dirty |= GCJoinStyle; } if (mask & GCFillStyle) if (gv->fill_style != attr->fill_style) { gv->fill_style = attr->fill_style; gc->dirty |= GCFillStyle; } if (mask & GCFillRule) if (gv->fill_rule != attr->fill_rule) { gv->fill_rule = attr->fill_rule; gc->dirty |= GCFillRule; } if (mask & GCArcMode) if (gv->arc_mode != attr->arc_mode) { gv->arc_mode = attr->arc_mode; gc->dirty |= GCArcMode; } /* always write through tile change, since client may have changed pixmap contents */ if (mask & GCTile) { gv->tile = attr->tile; gc->dirty |= GCTile; } /* always write through stipple change, since client may have changed pixmap contents */ if (mask & GCStipple) { gv->stipple = attr->stipple; gc->dirty |= GCStipple; } if (mask & GCTileStipXOrigin) if (gv->ts_x_origin != attr->ts_x_origin) { gv->ts_x_origin = attr->ts_x_origin; gc->dirty |= GCTileStipXOrigin; } if (mask & GCTileStipYOrigin) if (gv->ts_y_origin != attr->ts_y_origin) { gv->ts_y_origin = attr->ts_y_origin; gc->dirty |= GCTileStipYOrigin; } if (mask & GCFont) if (gv->font != attr->font) { gv->font = attr->font; gc->dirty |= GCFont; } if (mask & GCSubwindowMode) if (gv->subwindow_mode != attr->subwindow_mode) { gv->subwindow_mode = attr->subwindow_mode; gc->dirty |= GCSubwindowMode; } if (mask & GCGraphicsExposures) if (gv->graphics_exposures != attr->graphics_exposures) { gv->graphics_exposures = attr->graphics_exposures; gc->dirty |= GCGraphicsExposures; } if (mask & GCClipXOrigin) if (gv->clip_x_origin != attr->clip_x_origin) { gv->clip_x_origin = attr->clip_x_origin; gc->dirty |= GCClipXOrigin; } if (mask & GCClipYOrigin) if (gv->clip_y_origin != attr->clip_y_origin) { gv->clip_y_origin = attr->clip_y_origin; gc->dirty |= GCClipYOrigin; } /* always write through mask change, since client may have changed pixmap contents */ if (mask & GCClipMask) { gv->clip_mask = attr->clip_mask; gc->dirty |= GCClipMask; gc->rects = 0; } if (mask & GCDashOffset) if (gv->dash_offset != attr->dash_offset) { gv->dash_offset = attr->dash_offset; gc->dirty |= GCDashOffset; } if (mask & GCDashList) if ((gv->dashes != attr->dashes) || (gc->dashes == True)) { gv->dashes = attr->dashes; gc->dirty |= GCDashList; gc->dashes = 0; } return 0; } /* can only call when display is already locked. */ void _XFlushGCCache( Display *dpy, GC gc) { register xChangeGCReq *req; register _XExtension *ext; if (gc->dirty) { GetReq(ChangeGC, req); req->gc = gc->gid; req->mask = gc->dirty; _XGenerateGCList (dpy, gc, (xReq *) req); /* call out to any extensions interested */ for (ext = dpy->ext_procs; ext; ext = ext->next) if (ext->flush_GC) (*ext->flush_GC)(dpy, gc, &ext->codes); gc->dirty = 0L; /* allow extensions to see dirty bits */ } } void XFlushGC( Display *dpy, GC gc) { FlushGC(dpy, gc); } GContext XGContextFromGC(GC gc) { return (gc->gid); } nx-libs-3.5.99.23/nx-X11/lib/src/CrGlCur.c0000644000000000000000000001313113614532331014304 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #ifdef USE_DYNAMIC_XCURSOR #include #include #include #include "Cr.h" #ifdef __CYGWIN__ #define LIBXCURSOR "cygXcursor-1.dll" #endif typedef void *XModuleType; #ifndef LIBXCURSOR #define LIBXCURSOR "libXcursor.so.1" #endif static char libraryName[] = LIBXCURSOR; static XModuleType open_library (void) { char *library = libraryName; char *dot; XModuleType module; for (;;) { module = dlopen(library, RTLD_LAZY); if (module) return module; dot = strrchr (library, '.'); if (!dot) break; *dot = '\0'; } return NULL; } static void * fetch_symbol (XModuleType module, const char *under_symbol) { void *result = NULL; const char *symbol = under_symbol + 1; result = dlsym (module, symbol); if (!result) result = dlsym (module, under_symbol); return result; } typedef void (*NoticeCreateBitmapFunc) (Display *dpy, Pixmap pid, unsigned int width, unsigned int height); typedef void (*NoticePutBitmapFunc) (Display *dpy, Drawable draw, XImage *image); typedef Cursor (*TryShapeBitmapCursorFunc) (Display *dpy, Pixmap source, Pixmap mask, XColor *foreground, XColor *background, unsigned int x, unsigned int y); typedef Cursor (*TryShapeCursorFunc) (Display *dpy, Font source_font, Font mask_font, unsigned int source_char, unsigned int mask_char, XColor _Xconst *foreground, XColor _Xconst *background); static XModuleType _XcursorModule; static Bool _XcursorModuleTried; #define GetFunc(type,name,ret) {\ static Bool been_here; \ static type staticFunc; \ \ _XLockMutex (_Xglobal_lock); \ if (!been_here) \ { \ been_here = True; \ if (!_XcursorModuleTried) \ { \ _XcursorModuleTried = True; \ _XcursorModule = open_library (); \ } \ if (_XcursorModule) \ staticFunc = (type) fetch_symbol (_XcursorModule, "_" name); \ } \ ret = staticFunc; \ _XUnlockMutex (_Xglobal_lock); \ } static Cursor _XTryShapeCursor (Display *dpy, Font source_font, Font mask_font, unsigned int source_char, unsigned int mask_char, XColor _Xconst *foreground, XColor _Xconst *background) { TryShapeCursorFunc func; GetFunc (TryShapeCursorFunc, "XcursorTryShapeCursor", func); if (func) return (*func) (dpy, source_font, mask_font, source_char, mask_char, foreground, background); return None; } void _XNoticeCreateBitmap (Display *dpy, Pixmap pid, unsigned int width, unsigned int height) { NoticeCreateBitmapFunc func; GetFunc (NoticeCreateBitmapFunc, "XcursorNoticeCreateBitmap", func); if (func) (*func) (dpy, pid, width, height); } void _XNoticePutBitmap (Display *dpy, Drawable draw, XImage *image) { NoticePutBitmapFunc func; GetFunc (NoticePutBitmapFunc, "XcursorNoticePutBitmap", func); if (func) (*func) (dpy, draw, image); } Cursor _XTryShapeBitmapCursor (Display *dpy, Pixmap source, Pixmap mask, XColor *foreground, XColor *background, unsigned int x, unsigned int y) { TryShapeBitmapCursorFunc func; GetFunc (TryShapeBitmapCursorFunc, "XcursorTryShapeBitmapCursor", func); if (func) return (*func) (dpy, source, mask, foreground, background, x, y); return None; } #endif Cursor XCreateGlyphCursor( register Display *dpy, Font source_font, Font mask_font, unsigned int source_char, unsigned int mask_char, XColor _Xconst *foreground, XColor _Xconst *background) { Cursor cid; register xCreateGlyphCursorReq *req; #ifdef USE_DYNAMIC_XCURSOR cid = _XTryShapeCursor (dpy, source_font, mask_font, source_char, mask_char, foreground, background); if (cid) return cid; #endif LockDisplay(dpy); GetReq(CreateGlyphCursor, req); cid = req->cid = XAllocID(dpy); req->source = source_font; req->mask = mask_font; req->sourceChar = source_char; req->maskChar = mask_char; req->foreRed = foreground->red; req->foreGreen = foreground->green; req->foreBlue = foreground->blue; req->backRed = background->red; req->backGreen = background->green; req->backBlue = background->blue; UnlockDisplay(dpy); SyncHandle(); return (cid); } nx-libs-3.5.99.23/nx-X11/lib/src/Cr.h0000644000000000000000000000124313614532331013355 0ustar #ifndef _CR_H_ #define _CR_H_ #include extern int _XUpdateGCCache( register GC gc, register unsigned long mask, register XGCValues *attr); extern void _XNoticeCreateBitmap( Display *dpy, Pixmap pid, unsigned int width, unsigned int height); extern void _XNoticePutBitmap( Display *dpy, Drawable draw, XImage *image); extern Cursor _XTryShapeBitmapCursor( Display *dpy, Pixmap source, Pixmap mask, XColor *foreground, XColor *background, unsigned int x, unsigned int y); #endif /* _CR_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/CrPFBData.c0000644000000000000000000000560313614532331014476 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlib.h" #include /* * XCreatePixmapFromBitmapData: Routine to make a pixmap from user supplied bitmap data. * D is any drawable on the same screen that the pixmap will be used in. * Data is a pointer to the bit data, and * width & height give the size in bits of the pixmap. * Fg and Bg are the pixel values to use for the two colors. * Depth is the depth of the pixmap to create. * * The following format is assumed for data: * * format=XYPixmap * bit_order=LSBFirst * byte_order=LSBFirst * padding=8 * bitmap_unit=8 * xoffset=0 * no extra bytes per line */ Pixmap XCreatePixmapFromBitmapData( Display *display, Drawable d, char *data, unsigned int width, unsigned int height, unsigned long fg, unsigned long bg, unsigned int depth) { Pixmap pix = XCreatePixmap(display, d, width, height, depth); XGCValues gcv = { .foreground = fg, .background = bg }; GC gc = XCreateGC(display, pix, GCForeground|GCBackground, &gcv); if (gc == NULL) { XFreePixmap(display, pix); return (Pixmap) None; } else { XImage ximage = { .height = height, .width = width, .depth = 1, .bits_per_pixel = 1, .xoffset = 0, .format = XYBitmap, .data = data, .byte_order = LSBFirst, .bitmap_unit = 8, .bitmap_bit_order = LSBFirst, .bitmap_pad = 8, .bytes_per_line = (width + 7) / 8 }; XPutImage(display, pix, gc, &ximage, 0, 0, 0, 0, width, height); XFreeGC(display, gc); return(pix); } } nx-libs-3.5.99.23/nx-X11/lib/src/CrPixmap.c0000644000000000000000000000360513614532331014533 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #ifdef USE_DYNAMIC_XCURSOR void _XNoticeCreateBitmap (Display *dpy, Pixmap pid, unsigned int width, unsigned int height); #endif Pixmap XCreatePixmap ( register Display *dpy, Drawable d, unsigned int width, unsigned int height, unsigned int depth) { Pixmap pid; register xCreatePixmapReq *req; LockDisplay(dpy); GetReq(CreatePixmap, req); req->drawable = d; req->width = width; req->height = height; req->depth = depth; pid = req->pid = XAllocID(dpy); UnlockDisplay(dpy); SyncHandle(); #ifdef USE_DYNAMIC_XCURSOR if (depth == 1) _XNoticeCreateBitmap (dpy, pid, width, height); #endif return (pid); } nx-libs-3.5.99.23/nx-X11/lib/src/CrWindow.c0000644000000000000000000000403113614532331014536 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Window XCreateSimpleWindow( register Display *dpy, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int borderWidth, unsigned long border, unsigned long background) { Window wid; register xCreateWindowReq *req; LockDisplay(dpy); GetReqExtra(CreateWindow, 8, req); req->parent = parent; req->x = x; req->y = y; req->width = width; req->height = height; req->borderWidth = borderWidth; req->depth = 0; req->class = CopyFromParent; req->visual = CopyFromParent; wid = req->wid = XAllocID(dpy); req->mask = CWBackPixel | CWBorderPixel; { register CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xCreateWindowReq); *valuePtr++ = background; *valuePtr = border; } UnlockDisplay(dpy); SyncHandle(); return (wid); } nx-libs-3.5.99.23/nx-X11/lib/src/Cursor.c0000644000000000000000000000361113614532331014262 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" static XColor _Xconst foreground = { 0, 0, 0, 0 }; /* black */ static XColor _Xconst background = { 0, 65535, 65535, 65535 }; /* white */ Cursor XCreateFontCursor( Display *dpy, unsigned int which) { /* * the cursor font contains the shape glyph followed by the mask * glyph; so character position 0 contains a shape, 1 the mask for 0, * 2 a shape, etc. contains hash define names * for all of these. */ if (dpy->cursor_font == None) { dpy->cursor_font = XLoadFont (dpy, CURSORFONT); if (dpy->cursor_font == None) return None; } return XCreateGlyphCursor (dpy, dpy->cursor_font, dpy->cursor_font, which, which + 1, &foreground, &background); } nx-libs-3.5.99.23/nx-X11/lib/src/DefCursor.c0000644000000000000000000000310013614532331014672 0ustar /* Copyright 1986,1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDefineCursor ( register Display *dpy, Window w, Cursor cursor) { register xChangeWindowAttributesReq *req; LockDisplay(dpy); GetReqExtra (ChangeWindowAttributes, 4, req); req->window = w; req->valueMask = CWCursor; OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), cursor); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/DelProp.c0000644000000000000000000000274713614532331014363 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDeleteProperty( register Display *dpy, Window window, Atom property) { register xDeletePropertyReq *req; LockDisplay(dpy); GetReq(DeleteProperty, req); req->window = window; req->property = property; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/Depths.c0000644000000000000000000000346113614532331014237 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include /* * XListDepths - return info from connection setup */ int *XListDepths ( Display *dpy, int scrnum, int *countp) { Screen *scr; int count; int *depths; if (scrnum < 0 || scrnum >= dpy->nscreens) return NULL; scr = &dpy->screens[scrnum]; if ((count = scr->ndepths) > 0) { register Depth *dp; register int i; depths = Xmalloc (count * sizeof(int)); if (!depths) return NULL; for (i = 0, dp = scr->depths; i < count; i++, dp++) depths[i] = dp->depth; } else { /* a screen must have a depth */ return NULL; } *countp = count; return depths; } nx-libs-3.5.99.23/nx-X11/lib/src/DestSubs.c0000644000000000000000000000264213614532331014544 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDestroySubwindows( register Display *dpy, Window win) { register xResourceReq *req; LockDisplay(dpy); GetResReq (DestroySubwindows,win, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/DestWind.c0000644000000000000000000000261513614532331014531 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDestroyWindow ( register Display *dpy, Window w) { register xResourceReq *req; LockDisplay(dpy); GetResReq(DestroyWindow, w, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/DisName.c0000644000000000000000000000420013614532331014320 0ustar /* Copyright 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* XDisplayName.c */ /* * Returns the name of the display XOpenDisplay would use. This is better * than just printing the "display" variable in a program because that * could be NULL and/or there could be an environment variable set. * This makes it easier for programmers to provide meaningful error * messages. * * * For example, this is used in XOpenDisplay() as * strncpy( displaybuf, XDisplayName( display ), sizeof(displaybuf) ); * if ( *displaybuf == '\0' ) return( NULL ); * This check is actually unnecessary because the next thing is an index() * call looking for a ':' which will fail and we'll return(NULL). */ /* Written at Waterloo - JMSellens */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Xlib.h" char * XDisplayName( _Xconst char *display) { char *d; if ( display != (char *)NULL && *display != '\0' ) return( (char *)display ); if ( (d = getenv( "DISPLAY" )) != (char *)NULL ) return( d ); return( (char *) "" ); } nx-libs-3.5.99.23/nx-X11/lib/src/DrArc.c0000644000000000000000000000425613614532331014006 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* Note to future maintainers: XDrawArc does NOT batch successive PolyArc requests into a single request like XDrawLine, XDrawPoint, etc. We don't do this because X_PolyArc applies the GC's join-style if the last point in one arc coincides with the first point in another. The client wouldn't expect this and would have no easy way to defeat it. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDrawArc( register Display *dpy, Drawable d, GC gc, int x, int y, /* INT16 */ unsigned int width, unsigned int height, /* CARD16 */ int angle1, int angle2) /* INT16 */ { register xPolyArcReq *req; register xArc *arc; LockDisplay(dpy); FlushGC(dpy, gc); GetReqExtra (PolyArc, SIZEOF(xArc), req); req->drawable = d; req->gc = gc->gid; arc = (xArc *) NEXTPTR(req,xPolyArcReq); arc->x = x; arc->y = y; arc->width = width; arc->height = height; arc->angle1 = angle1; arc->angle2 = angle2; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/DrArcs.c0000644000000000000000000000330613614532331014164 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #define arc_scale (SIZEOF(xArc) / 4) int XDrawArcs( register Display *dpy, Drawable d, GC gc, XArc *arcs, int n_arcs) { register xPolyArcReq *req; register long len; LockDisplay(dpy); FlushGC(dpy, gc); GetReq(PolyArc,req); req->drawable = d; req->gc = gc->gid; len = ((long)n_arcs) * arc_scale; SetReqLen(req, len, 1); len <<= 2; /* watch out for macros... */ Data16 (dpy, (short *) arcs, len); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/DrLine.c0000644000000000000000000000467313614532331014173 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* precompute the maximum size of batching request allowed */ #define wsize (SIZEOF(xPolySegmentReq) + WLNSPERBATCH * SIZEOF(xSegment)) #define zsize (SIZEOF(xPolySegmentReq) + ZLNSPERBATCH * SIZEOF(xSegment)) int XDrawLine ( register Display *dpy, Drawable d, GC gc, int x1, int y1, int x2, int y2) { register xSegment *segment; LockDisplay(dpy); FlushGC(dpy, gc); { register xPolySegmentReq *req = (xPolySegmentReq *) dpy->last_req; /* if same as previous request, with same drawable, batch requests */ if ( (req->reqType == X_PolySegment) && (req->drawable == d) && (req->gc == gc->gid) && ((dpy->bufptr + SIZEOF(xSegment)) <= dpy->bufmax) && (((char *)dpy->bufptr - (char *)req) < (gc->values.line_width ? wsize : zsize)) ) { req->length += SIZEOF(xSegment) >> 2; segment = (xSegment *) dpy->bufptr; dpy->bufptr += SIZEOF(xSegment); } else { GetReqExtra (PolySegment, SIZEOF(xSegment), req); req->drawable = d; req->gc = gc->gid; segment = (xSegment *) NEXTPTR(req,xPolySegmentReq); } segment->x1 = x1; segment->y1 = y1; segment->x2 = x2; segment->y2 = y2; UnlockDisplay(dpy); SyncHandle(); } return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/DrLines.c0000644000000000000000000000340313614532331014344 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDrawLines ( register Display *dpy, Drawable d, GC gc, XPoint *points, int npoints, int mode) { register xPolyLineReq *req; register long length; LockDisplay(dpy); FlushGC(dpy, gc); GetReq (PolyLine, req); req->drawable = d; req->gc = gc->gid; req->coordMode = mode; SetReqLen(req, npoints, 65535 - req->length); /* each point is 2 16-bit integers */ length = npoints << 2; /* watch out for macros... */ Data16 (dpy, (short *) points, length); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/DrPoint.c0000644000000000000000000000446313614532331014372 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* precompute the maximum size of batching request allowed */ #define size (SIZEOF(xPolyPointReq) + PTSPERBATCH * SIZEOF(xPoint)) int XDrawPoint( register Display *dpy, Drawable d, GC gc, int x, int y) /* INT16 */ { xPoint *point; LockDisplay(dpy); FlushGC(dpy, gc); { register xPolyPointReq *req = (xPolyPointReq *) dpy->last_req; /* if same as previous request, with same drawable, batch requests */ if ( (req->reqType == X_PolyPoint) && (req->drawable == d) && (req->gc == gc->gid) && (req->coordMode == CoordModeOrigin) && ((dpy->bufptr + SIZEOF(xPoint)) <= dpy->bufmax) && (((char *)dpy->bufptr - (char *)req) < size) ) { req->length += SIZEOF(xPoint) >> 2; point = (xPoint *) dpy->bufptr; dpy->bufptr += SIZEOF(xPoint); } else { GetReqExtra(PolyPoint, 4, req); /* 1 point = 4 bytes */ req->drawable = d; req->gc = gc->gid; req->coordMode = CoordModeOrigin; point = (xPoint *) NEXTPTR(req,xPolyPointReq); } point->x = x; point->y = y; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/DrPoints.c0000644000000000000000000000454013614532331014551 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDrawPoints( register Display *dpy, Drawable d, GC gc, XPoint *points, int n_points, int mode) /* CoordMode */ { register xPolyPointReq *req; register long nbytes; int n; int xoff, yoff; XPoint pt; xoff = yoff = 0; LockDisplay(dpy); FlushGC(dpy, gc); while (n_points) { GetReq(PolyPoint, req); req->drawable = d; req->gc = gc->gid; req->coordMode = mode; n = n_points; if (!dpy->bigreq_size && n > (dpy->max_request_size - req->length)) n = dpy->max_request_size - req->length; SetReqLen(req, n, n); nbytes = ((long)n) << 2; /* watch out for macros... */ if (xoff || yoff) { pt.x = xoff + points->x; pt.y = yoff + points->y; Data16 (dpy, (short *) &pt, 4); if (nbytes > 4) { Data16 (dpy, (short *) (points + 1), nbytes - 4); } } else { Data16 (dpy, (short *) points, nbytes); } n_points -= n; if (n_points && (mode == CoordModePrevious)) { register XPoint *pptr = points; points += n; while (pptr != points) { xoff += pptr->x; yoff += pptr->y; pptr++; } } else points += n; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/DrRect.c0000644000000000000000000000477313614532331014202 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* precompute the maximum size of batching request allowed */ #define wsize (SIZEOF(xPolyRectangleReq) + WRCTSPERBATCH * SIZEOF(xRectangle)) #define zsize (SIZEOF(xPolyRectangleReq) + ZRCTSPERBATCH * SIZEOF(xRectangle)) int XDrawRectangle( register Display *dpy, Drawable d, GC gc, int x, int y, /* INT16 */ unsigned int width, unsigned int height) /* CARD16 */ { xRectangle *rect; LockDisplay(dpy); FlushGC(dpy, gc); { register xPolyRectangleReq *req = (xPolyRectangleReq *) dpy->last_req; /* if same as previous request, with same drawable, batch requests */ if ( (req->reqType == X_PolyRectangle) && (req->drawable == d) && (req->gc == gc->gid) && ((dpy->bufptr + SIZEOF(xRectangle)) <= dpy->bufmax) && (((char *)dpy->bufptr - (char *)req) < (gc->values.line_width ? wsize : zsize)) ) { req->length += SIZEOF(xRectangle) >> 2; rect = (xRectangle *) dpy->bufptr; dpy->bufptr += SIZEOF(xRectangle); } else { GetReqExtra(PolyRectangle, SIZEOF(xRectangle), req); req->drawable = d; req->gc = gc->gid; rect = (xRectangle *) NEXTPTR(req,xPolyRectangleReq); } rect->x = x; rect->y = y; rect->width = width; rect->height = height; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/DrRects.c0000644000000000000000000000360113614532331014352 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDrawRectangles( register Display *dpy, Drawable d, GC gc, XRectangle *rects, int n_rects) { register xPolyRectangleReq *req; long len; int n; LockDisplay(dpy); FlushGC(dpy, gc); while (n_rects) { GetReq(PolyRectangle, req); req->drawable = d; req->gc = gc->gid; n = n_rects; len = ((long)n) << 1; if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { n = (dpy->max_request_size - req->length) >> 1; len = ((long)n) << 1; } SetReqLen(req, len, len); len <<= 2; /* watch out for macros... */ Data16 (dpy, (short *) rects, len); n_rects -= n; rects += n; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/DrSegs.c0000644000000000000000000000361513614532331014200 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDrawSegments ( register Display *dpy, Drawable d, GC gc, XSegment *segments, int nsegments) { register xPolySegmentReq *req; long len; int n; LockDisplay(dpy); FlushGC(dpy, gc); while (nsegments) { GetReq (PolySegment, req); req->drawable = d; req->gc = gc->gid; n = nsegments; len = ((long)n) << 1; if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { n = (dpy->max_request_size - req->length) >> 1; len = ((long)n) << 1; } SetReqLen(req, len, len); len <<= 2; /* watch out for macros... */ Data16 (dpy, (short *) segments, len); nsegments -= n; segments += n; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ErrDes.c0000644000000000000000000001437213614532331014177 0ustar /* */ /*********************************************************** Copyright 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include "Xresource.h" #include #ifndef ERRORDB #ifndef XERRORDB #define ERRORDB "/usr/lib/X11/XErrorDB" #else #define ERRORDB XERRORDB #endif #endif /* * descriptions of errors in Section 4 of Protocol doc (pp. 350-351); more * verbose descriptions are given in the error database */ static const char _XErrorList[] = /* No error */ "no error\0" /* BadRequest */ "BadRequest\0" /* BadValue */ "BadValue\0" /* BadWindow */ "BadWindow\0" /* BadPixmap */ "BadPixmap\0" /* BadAtom */ "BadAtom\0" /* BadCursor */ "BadCursor\0" /* BadFont */ "BadFont\0" /* BadMatch */ "BadMatch\0" /* BadDrawable */ "BadDrawable\0" /* BadAccess */ "BadAccess\0" /* BadAlloc */ "BadAlloc\0" /* BadColor */ "BadColor\0" /* BadGC */ "BadGC\0" /* BadIDChoice */ "BadIDChoice\0" /* BadName */ "BadName\0" /* BadLength */ "BadLength\0" /* BadImplementation */ "BadImplementation" ; /* offsets into _XErrorList */ static const unsigned char _XErrorOffsets[] = { 0, 9, 20, 29, 39, 49, 57, 67, 75, 84, 96, 106, 115, 124, 130, 142, 150, 160 }; int XGetErrorText( register Display *dpy, register int code, char *buffer, int nbytes) { char buf[150]; register _XExtension *ext; _XExtension *bext = (_XExtension *)NULL; if (nbytes == 0) return 0; if (code <= BadImplementation && code > 0) { snprintf(buf, sizeof(buf), "%d", code); (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, _XErrorList + _XErrorOffsets[code], buffer, nbytes); } else buffer[0] = '\0'; /* call out to any extensions interested */ for (ext = dpy->ext_procs; ext; ext = ext->next) { if (ext->error_string) (*ext->error_string)(dpy, code, &ext->codes, buffer, nbytes); if (ext->codes.first_error && ext->codes.first_error <= code && (!bext || ext->codes.first_error > bext->codes.first_error)) bext = ext; } if (!buffer[0] && bext) { snprintf(buf, sizeof(buf), "%s.%d", bext->name, code - bext->codes.first_error); (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, "", buffer, nbytes); } if (!buffer[0]) snprintf(buffer, nbytes, "%d", code); return 0; } int /*ARGSUSED*/ XGetErrorDatabaseText( Display *dpy, register _Xconst char *name, register _Xconst char *type, _Xconst char *defaultp, char *buffer, int nbytes) { static XrmDatabase db = NULL; XrmString type_str; XrmValue result; char temp[BUFSIZ]; char* tptr; unsigned long tlen; if (nbytes == 0) return 0; if (!db) { /* the Xrm routines expect to be called with the global mutex unlocked. */ XrmDatabase temp_db; int do_destroy; const char *dbname; XrmInitialize(); #ifdef WIN32 dbname = getenv("XERRORDB"); if (!dbname) dbname = ERRORDB; #else dbname = ERRORDB; #endif temp_db = XrmGetFileDatabase(dbname); _XLockMutex(_Xglobal_lock); if (!db) { db = temp_db; do_destroy = 0; } else do_destroy = 1; /* we didn't need to get it after all */ _XUnlockMutex(_Xglobal_lock); if (do_destroy) XrmDestroyDatabase(temp_db); } if (db) { tlen = strlen (name) + strlen (type) + 2; if (tlen <= sizeof(temp)) tptr = temp; else tptr = Xmalloc (tlen); if (tptr) { snprintf(tptr, tlen, "%s.%s", name, type); XrmGetResource(db, tptr, "ErrorType.ErrorNumber", &type_str, &result); if (tptr != temp) Xfree (tptr); } else { result.addr = (XPointer) NULL; } } else result.addr = (XPointer)NULL; if (!result.addr) { result.addr = (XPointer) defaultp; result.size = strlen(defaultp) + 1; } (void) strncpy (buffer, (char *) result.addr, nbytes); if (result.size > nbytes) buffer[nbytes-1] = '\0'; return 0; } nx-libs-3.5.99.23/nx-X11/lib/src/ErrHndlr.c0000644000000000000000000000461613614532331014533 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* * XErrorHandler - This procedure sets the X non-fatal error handler * (_XErrorFunction) to be the specified routine. If NULL is passed in * the original error handler is restored. */ XErrorHandler XSetErrorHandler(XErrorHandler handler) { int (*oldhandler)(Display *dpy, XErrorEvent *event); _XLockMutex(_Xglobal_lock); oldhandler = _XErrorFunction; if (!oldhandler) oldhandler = _XDefaultError; if (handler != NULL) { _XErrorFunction = handler; } else { _XErrorFunction = _XDefaultError; } _XUnlockMutex(_Xglobal_lock); return (XErrorHandler) oldhandler; } /* * XIOErrorHandler - This procedure sets the X fatal I/O error handler * (_XIOErrorFunction) to be the specified routine. If NULL is passed in * the original error handler is restored. */ XIOErrorHandler XSetIOErrorHandler(XIOErrorHandler handler) { int (*oldhandler)(Display *dpy); _XLockMutex(_Xglobal_lock); oldhandler = _XIOErrorFunction; if (!oldhandler) oldhandler = _XDefaultIOError; if (handler != NULL) { _XIOErrorFunction = handler; } else { _XIOErrorFunction = _XDefaultIOError; } _XUnlockMutex(_Xglobal_lock); return (XIOErrorHandler) oldhandler; } nx-libs-3.5.99.23/nx-X11/lib/src/evtomask.c0000644000000000000000000000573313614532331014645 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include /* * This array can be used given an event type to determine the mask bits * that could have generated it. */ long const _Xevent_to_mask [LASTEvent] = { 0, /* no event 0 */ 0, /* no event 1 */ KeyPressMask, /* KeyPress */ KeyReleaseMask, /* KeyRelease */ ButtonPressMask, /* ButtonPress */ ButtonReleaseMask, /* ButtonRelease */ PointerMotionMask|PointerMotionHintMask|Button1MotionMask| Button2MotionMask|Button3MotionMask|Button4MotionMask| Button5MotionMask|ButtonMotionMask, /* MotionNotify */ EnterWindowMask, /* EnterNotify */ LeaveWindowMask, /* LeaveNotify */ FocusChangeMask, /* FocusIn */ FocusChangeMask, /* FocusOut */ KeymapStateMask, /* KeymapNotify */ ExposureMask, /* Expose */ ExposureMask, /* GraphicsExpose */ ExposureMask, /* NoExpose */ VisibilityChangeMask, /* VisibilityNotify */ SubstructureNotifyMask, /* CreateNotify */ StructureNotifyMask|SubstructureNotifyMask, /* DestroyNotify */ StructureNotifyMask|SubstructureNotifyMask, /* UnmapNotify */ StructureNotifyMask|SubstructureNotifyMask, /* MapNotify */ SubstructureRedirectMask, /* MapRequest */ SubstructureNotifyMask|StructureNotifyMask, /* ReparentNotify */ StructureNotifyMask|SubstructureNotifyMask, /* ConfigureNotify */ SubstructureRedirectMask, /* ConfigureRequest */ SubstructureNotifyMask|StructureNotifyMask, /* GravityNotify */ ResizeRedirectMask, /* ResizeRequest */ SubstructureNotifyMask|StructureNotifyMask, /* CirculateNotify */ SubstructureRedirectMask, /* CirculateRequest */ PropertyChangeMask, /* PropertyNotify */ 0, /* SelectionClear */ 0, /* SelectionRequest */ 0, /* SelectionNotify */ ColormapChangeMask, /* ColormapNotify */ 0, /* ClientMessage */ 0, /* MappingNotify */ }; nx-libs-3.5.99.23/nx-X11/lib/src/EvToWire.c0000644000000000000000000003304413614532331014514 0ustar /* Copyright 1985, 1986, 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * XEvToWire.c - Internal support routines for the C subroutine * interface library (Xlib) to the X Window System Protocol V11.0. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* * Reformat an XEvent structure to a wire event of the right type. * Return True on success. If the type is unrecognized, return what * _XUnknownNativeEvent returns (i.e., False). */ Status _XEventToWire( register Display *dpy, register XEvent *re, /* in: from */ register xEvent *event) /* out: to */ { switch (event->u.u.type = re->type) { case KeyPress: case KeyRelease: { register XKeyEvent *ev = (XKeyEvent*) re; event->u.keyButtonPointer.root = ev->root; event->u.keyButtonPointer.event = ev->window; event->u.keyButtonPointer.child = ev->subwindow; event->u.keyButtonPointer.time = ev->time; event->u.keyButtonPointer.eventX = ev->x ; event->u.keyButtonPointer.eventY = ev->y ; event->u.keyButtonPointer.rootX = ev->x_root; event->u.keyButtonPointer.rootY = ev->y_root; event->u.keyButtonPointer.state = ev->state; event->u.keyButtonPointer.sameScreen = ev->same_screen; event->u.u.detail = ev->keycode; } break; case ButtonPress: case ButtonRelease: { register XButtonEvent *ev = (XButtonEvent *) re; event->u.keyButtonPointer.root = ev->root; event->u.keyButtonPointer.event = ev->window; event->u.keyButtonPointer.child = ev->subwindow; event->u.keyButtonPointer.time = ev->time; event->u.keyButtonPointer.eventX = ev->x; event->u.keyButtonPointer.eventY = ev->y; event->u.keyButtonPointer.rootX = ev->x_root; event->u.keyButtonPointer.rootY = ev->y_root; event->u.keyButtonPointer.state = ev->state; event->u.keyButtonPointer.sameScreen = ev->same_screen; event->u.u.detail = ev->button; } break; case MotionNotify: { register XMotionEvent *ev = (XMotionEvent *)re; event->u.keyButtonPointer.root = ev->root; event->u.keyButtonPointer.event = ev->window; event->u.keyButtonPointer.child = ev->subwindow; event->u.keyButtonPointer.time = ev->time; event->u.keyButtonPointer.eventX= ev->x; event->u.keyButtonPointer.eventY= ev->y; event->u.keyButtonPointer.rootX = ev->x_root; event->u.keyButtonPointer.rootY = ev->y_root; event->u.keyButtonPointer.state = ev->state; event->u.keyButtonPointer.sameScreen= ev->same_screen; event->u.u.detail = ev->is_hint; } break; case EnterNotify: case LeaveNotify: { register XCrossingEvent *ev = (XCrossingEvent *) re; event->u.enterLeave.root = ev->root; event->u.enterLeave.event = ev->window; event->u.enterLeave.child = ev->subwindow; event->u.enterLeave.time = ev->time; event->u.enterLeave.eventX = ev->x; event->u.enterLeave.eventY = ev->y; event->u.enterLeave.rootX = ev->x_root; event->u.enterLeave.rootY = ev->y_root; event->u.enterLeave.state = ev->state; event->u.enterLeave.mode = ev->mode; event->u.enterLeave.flags = 0; if (ev->same_screen) { event->u.enterLeave.flags |= ELFlagSameScreen; } if (ev->focus) { event->u.enterLeave.flags |= ELFlagFocus; } event->u.u.detail = ev->detail; } break; case FocusIn: case FocusOut: { register XFocusChangeEvent *ev = (XFocusChangeEvent *) re; event->u.focus.window = ev->window; event->u.focus.mode = ev->mode; event->u.u.detail = ev->detail; } break; case KeymapNotify: { register XKeymapEvent *ev = (XKeymapEvent *) re; memcpy ((char *)(((xKeymapEvent *) event)->map), &ev->key_vector[1], sizeof (((xKeymapEvent *) event)->map)); } break; case Expose: { register XExposeEvent *ev = (XExposeEvent *) re; event->u.expose.window = ev->window; event->u.expose.x = ev->x; event->u.expose.y = ev->y; event->u.expose.width = ev->width; event->u.expose.height = ev->height; event->u.expose.count = ev->count; } break; case GraphicsExpose: { register XGraphicsExposeEvent *ev = (XGraphicsExposeEvent *) re; event->u.graphicsExposure.drawable = ev->drawable; event->u.graphicsExposure.x = ev->x; event->u.graphicsExposure.y = ev->y; event->u.graphicsExposure.width = ev->width; event->u.graphicsExposure.height = ev->height; event->u.graphicsExposure.count = ev->count; event->u.graphicsExposure.majorEvent= ev->major_code; event->u.graphicsExposure.minorEvent= ev->minor_code; } break; case NoExpose: { register XNoExposeEvent *ev = (XNoExposeEvent *) re; event->u.noExposure.drawable = ev->drawable; event->u.noExposure.majorEvent = ev->major_code; event->u.noExposure.minorEvent = ev->minor_code; } break; case VisibilityNotify: { register XVisibilityEvent *ev = (XVisibilityEvent *) re; event->u.visibility.window = ev->window; event->u.visibility.state = ev->state; } break; case CreateNotify: { register XCreateWindowEvent *ev = (XCreateWindowEvent *) re; event->u.createNotify.window = ev->window; event->u.createNotify.parent = ev->parent; event->u.createNotify.x = ev->x; event->u.createNotify.y = ev->y; event->u.createNotify.width = ev->width; event->u.createNotify.height = ev->height; event->u.createNotify.borderWidth = ev->border_width; event->u.createNotify.override = ev->override_redirect; } break; case DestroyNotify: { register XDestroyWindowEvent *ev = (XDestroyWindowEvent *) re; event->u.destroyNotify.window = ev->window; event->u.destroyNotify.event = ev->event; } break; case UnmapNotify: { register XUnmapEvent *ev = (XUnmapEvent *) re; event->u.unmapNotify.window = ev->window; event->u.unmapNotify.event = ev->event; event->u.unmapNotify.fromConfigure = ev->from_configure; } break; case MapNotify: { register XMapEvent *ev = (XMapEvent *) re; event->u.mapNotify.window = ev->window; event->u.mapNotify.event = ev->event; event->u.mapNotify.override = ev->override_redirect; } break; case MapRequest: { register XMapRequestEvent *ev = (XMapRequestEvent *) re; event->u.mapRequest.window = ev->window; event->u.mapRequest.parent = ev->parent; } break; case ReparentNotify: { register XReparentEvent *ev = (XReparentEvent *) re; event->u.reparent.window = ev->window; event->u.reparent.event = ev->event; event->u.reparent.parent = ev->parent; event->u.reparent.x = ev->x; event->u.reparent.y = ev->y; event->u.reparent.override = ev->override_redirect; } break; case ConfigureNotify: { register XConfigureEvent *ev = (XConfigureEvent *) re; event->u.configureNotify.window = ev->window; event->u.configureNotify.event = ev->event; event->u.configureNotify.aboveSibling = ev->above; event->u.configureNotify.x = ev->x; event->u.configureNotify.y = ev->y; event->u.configureNotify.width = ev->width; event->u.configureNotify.height = ev->height; event->u.configureNotify.borderWidth= ev->border_width; event->u.configureNotify.override = ev->override_redirect; } break; case ConfigureRequest: { register XConfigureRequestEvent *ev = (XConfigureRequestEvent *) re; event->u.configureRequest.window = ev->window; event->u.configureRequest.parent = ev->parent; event->u.configureRequest.sibling = ev->above; event->u.configureRequest.x = ev->x; event->u.configureRequest.y = ev->y; event->u.configureRequest.width = ev->width; event->u.configureRequest.height = ev->height; event->u.configureRequest.borderWidth= ev->border_width; event->u.configureRequest.valueMask= ev->value_mask; event->u.u.detail = ev->detail; } break; case GravityNotify: { register XGravityEvent *ev = (XGravityEvent *) re; event->u.gravity.window = ev->window; event->u.gravity.event = ev->event; event->u.gravity.x = ev->x; event->u.gravity.y = ev->y; } break; case ResizeRequest: { register XResizeRequestEvent *ev = (XResizeRequestEvent *) re; event->u.resizeRequest.window = ev->window; event->u.resizeRequest.width = ev->width; event->u.resizeRequest.height = ev->height; } break; case CirculateNotify: { register XCirculateEvent *ev = (XCirculateEvent *) re; event->u.circulate.window = ev->window; event->u.circulate.event = ev->event; event->u.circulate.place = ev->place; } break; case CirculateRequest: { register XCirculateRequestEvent *ev = (XCirculateRequestEvent *) re; event->u.circulate.window = ev->window; event->u.circulate.event = ev->parent; event->u.circulate.place = ev->place; } break; case PropertyNotify: { register XPropertyEvent *ev = (XPropertyEvent *) re; event->u.property.window = ev->window; event->u.property.atom = ev->atom; event->u.property.time = ev->time; event->u.property.state = ev->state; } break; case SelectionClear: { register XSelectionClearEvent *ev = (XSelectionClearEvent *) re; event->u.selectionClear.window = ev->window; event->u.selectionClear.atom = ev->selection; event->u.selectionClear.time = ev->time; } break; case SelectionRequest: { register XSelectionRequestEvent *ev = (XSelectionRequestEvent *) re; event->u.selectionRequest.owner = ev->owner; event->u.selectionRequest.requestor = ev->requestor; event->u.selectionRequest.selection = ev->selection; event->u.selectionRequest.target = ev->target; event->u.selectionRequest.property = ev->property; event->u.selectionRequest.time = ev->time; } break; case SelectionNotify: { register XSelectionEvent *ev = (XSelectionEvent *) re; event->u.selectionNotify.requestor = ev->requestor; event->u.selectionNotify.selection = ev->selection; event->u.selectionNotify.target = ev->target; event->u.selectionNotify.property = ev->property; event->u.selectionNotify.time = ev->time; } break; case ColormapNotify: { register XColormapEvent *ev = (XColormapEvent *) re; event->u.colormap.window = ev->window; event->u.colormap.colormap = ev->colormap; event->u.colormap.new = ev->new; event->u.colormap.state = ev->state; } break; case ClientMessage: { register int i; register XClientMessageEvent *ev = (XClientMessageEvent *) re; event->u.clientMessage.window = ev->window; event->u.u.detail = ev->format; switch (ev->format) { case 8: event->u.clientMessage.u.b.type = ev->message_type; for (i = 0; i < 20; i++) event->u.clientMessage.u.b.bytes[i] = ev->data.b[i]; break; case 16: event->u.clientMessage.u.s.type = ev->message_type; event->u.clientMessage.u.s.shorts0 = ev->data.s[0]; event->u.clientMessage.u.s.shorts1 = ev->data.s[1]; event->u.clientMessage.u.s.shorts2 = ev->data.s[2]; event->u.clientMessage.u.s.shorts3 = ev->data.s[3]; event->u.clientMessage.u.s.shorts4 = ev->data.s[4]; event->u.clientMessage.u.s.shorts5 = ev->data.s[5]; event->u.clientMessage.u.s.shorts6 = ev->data.s[6]; event->u.clientMessage.u.s.shorts7 = ev->data.s[7]; event->u.clientMessage.u.s.shorts8 = ev->data.s[8]; event->u.clientMessage.u.s.shorts9 = ev->data.s[9]; break; case 32: event->u.clientMessage.u.l.type = ev->message_type; event->u.clientMessage.u.l.longs0 = ev->data.l[0]; event->u.clientMessage.u.l.longs1 = ev->data.l[1]; event->u.clientMessage.u.l.longs2 = ev->data.l[2]; event->u.clientMessage.u.l.longs3 = ev->data.l[3]; event->u.clientMessage.u.l.longs4 = ev->data.l[4]; break; default: /* client passing bogus data, let server complain */ break; } } break; case MappingNotify: { register XMappingEvent *ev = (XMappingEvent *) re; event->u.mappingNotify.firstKeyCode = ev->first_keycode; event->u.mappingNotify.request = ev->request; event->u.mappingNotify.count = ev->count; } break; default: return(_XUnknownNativeEvent(dpy, re, event)); } return(1); } nx-libs-3.5.99.23/nx-X11/lib/src/FetchName.c0000644000000000000000000000532113614532331014637 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include Status XFetchName ( register Display *dpy, Window w, char **name) { Atom actual_type; int actual_format; unsigned long nitems; unsigned long leftover; unsigned char *data = NULL; if (XGetWindowProperty(dpy, w, XA_WM_NAME, 0L, (long)BUFSIZ, False, XA_STRING, &actual_type, &actual_format, &nitems, &leftover, &data) != Success) { *name = NULL; return (0); } if ( (actual_type == XA_STRING) && (actual_format == 8) ) { /* The data returned by XGetWindowProperty is guarranteed to contain one extra byte that is null terminated to make retrieveing string properties easy. */ *name = (char *)data; return(1); } Xfree (data); *name = NULL; return(0); } Status XGetIconName ( register Display *dpy, Window w, char **icon_name) { Atom actual_type; int actual_format; unsigned long nitems; unsigned long leftover; unsigned char *data = NULL; if (XGetWindowProperty(dpy, w, XA_WM_ICON_NAME, 0L, (long)BUFSIZ, False, XA_STRING, &actual_type, &actual_format, &nitems, &leftover, &data) != Success) { *icon_name = NULL; return (0); } if ( (actual_type == XA_STRING) && (actual_format == 8) ) { /* The data returned by XGetWindowProperty is guarranteed to contain one extra byte that is null terminated to make retrieveing string properties easy. */ *icon_name = (char*)data; return(1); } Xfree (data); *icon_name = NULL; return(0); } nx-libs-3.5.99.23/nx-X11/lib/src/FillArc.c0000644000000000000000000000462713614532331014331 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* precompute the maximum size of batching request allowed */ #define size (SIZEOF(xPolyFillArcReq) + FARCSPERBATCH * SIZEOF(xArc)) int XFillArc( register Display *dpy, Drawable d, GC gc, int x, int y, /* INT16 */ unsigned int width, unsigned int height, /* CARD16 */ int angle1, int angle2) /* INT16 */ { xArc *arc; LockDisplay(dpy); FlushGC(dpy, gc); { register xPolyFillArcReq *req = (xPolyFillArcReq *) dpy->last_req; /* if same as previous request, with same drawable, batch requests */ if ( (req->reqType == X_PolyFillArc) && (req->drawable == d) && (req->gc == gc->gid) && ((dpy->bufptr + SIZEOF(xArc)) <= dpy->bufmax) && (((char *)dpy->bufptr - (char *)req) < size) ) { req->length += SIZEOF(xArc) >> 2; arc = (xArc *) dpy->bufptr; dpy->bufptr += SIZEOF(xArc); } else { GetReqExtra(PolyFillArc, SIZEOF(xArc), req); req->drawable = d; req->gc = gc->gid; arc = (xArc *) NEXTPTR(req,xPolyFillArcReq); } arc->x = x; arc->y = y; arc->width = width; arc->height = height; arc->angle1 = angle1; arc->angle2 = angle2; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/FillArcs.c0000644000000000000000000000364513614532331014513 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #define arc_scale (SIZEOF(xArc) / 4) int XFillArcs( register Display *dpy, Drawable d, GC gc, XArc *arcs, int n_arcs) { register xPolyFillArcReq *req; long len; int n; LockDisplay(dpy); FlushGC(dpy, gc); while (n_arcs) { GetReq(PolyFillArc, req); req->drawable = d; req->gc = gc->gid; n = n_arcs; len = ((long)n) * arc_scale; if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { n = (dpy->max_request_size - req->length) / arc_scale; len = ((long)n) * arc_scale; } SetReqLen(req, len, len); len <<= 2; /* watch out for macros... */ Data16 (dpy, (short *) arcs, len); n_arcs -= n; arcs += n; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/FillPoly.c0000644000000000000000000000345513614532331014545 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XFillPolygon( register Display *dpy, Drawable d, GC gc, XPoint *points, int n_points, int shape, int mode) { register xFillPolyReq *req; register long nbytes; LockDisplay(dpy); FlushGC(dpy, gc); GetReq(FillPoly, req); req->drawable = d; req->gc = gc->gid; req->shape = shape; req->coordMode = mode; SetReqLen(req, n_points, 65535 - req->length); /* shift (mult. by 4) before passing to the (possible) macro */ nbytes = n_points << 2; Data16 (dpy, (short *) points, nbytes); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/FillRct.c0000644000000000000000000000463113614532331014347 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* precompute the maximum size of batching request allowed */ #define size (SIZEOF(xPolyFillRectangleReq) + FRCTSPERBATCH * SIZEOF(xRectangle)) int XFillRectangle( register Display *dpy, Drawable d, GC gc, int x, int y, /* INT16 */ unsigned int width, unsigned int height) /* CARD16 */ { xRectangle *rect; LockDisplay(dpy); FlushGC(dpy, gc); { register xPolyFillRectangleReq *req = (xPolyFillRectangleReq *) dpy->last_req; /* if same as previous request, with same drawable, batch requests */ if ( (req->reqType == X_PolyFillRectangle) && (req->drawable == d) && (req->gc == gc->gid) && ((dpy->bufptr + SIZEOF(xRectangle)) <= dpy->bufmax) && (((char *)dpy->bufptr - (char *)req) < size) ) { req->length += SIZEOF(xRectangle) >> 2; rect = (xRectangle *) dpy->bufptr; dpy->bufptr += SIZEOF(xRectangle); } else { GetReqExtra(PolyFillRectangle, SIZEOF(xRectangle), req); req->drawable = d; req->gc = gc->gid; rect = (xRectangle *) NEXTPTR(req,xPolyFillRectangleReq); } rect->x = x; rect->y = y; rect->width = width; rect->height = height; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/FillRcts.c0000644000000000000000000000363113614532331014531 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XFillRectangles( register Display *dpy, Drawable d, GC gc, XRectangle *rectangles, int n_rects) { register xPolyFillRectangleReq *req; long len; int n; LockDisplay(dpy); FlushGC(dpy, gc); while (n_rects) { GetReq(PolyFillRectangle, req); req->drawable = d; req->gc = gc->gid; n = n_rects; len = ((long)n) << 1; if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { n = (dpy->max_request_size - req->length) >> 1; len = ((long)n) << 1; } SetReqLen(req, len, len); len <<= 2; /* watch out for macros... */ Data16 (dpy, (short *) rectangles, len); n_rects -= n; rectangles += n; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/FilterEv.c0000644000000000000000000000645713614532331014540 0ustar /* * Copyright 1990, 1991 by OMRON Corporation * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name OMRON not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. OMRON makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * Author: Seiji Kuwari OMRON Corporation * kuwa@omron.co.jp * kuwa%omron.co.jp@uunet.uu.net */ /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #else #define XLOCALE 1 #endif #include "Xlibint.h" #if XLOCALE #include "Xlcint.h" #endif extern long const _Xevent_to_mask[]; /* * Look up if there is a specified filter for the event. */ Bool XFilterEvent( XEvent *ev, Window window) { #if XLOCALE XFilterEventList p; Window win; long mask; Bool ret; if (window) win = window; else win = ev->xany.window; if (ev->type >= LASTEvent) mask = 0; else mask = _Xevent_to_mask[ev->type]; LockDisplay(ev->xany.display); for (p = ev->xany.display->im_filters; p != NULL; p = p->next) { if (win == p->window) { if ((mask & p->event_mask) || (ev->type >= p->start_type && ev->type <= p->end_type)) { UnlockDisplay(ev->xany.display); ret = (*(p->filter))(ev->xany.display, p->window, ev, p->client_data); return(ret); } } } UnlockDisplay(ev->xany.display); #endif return(False); } nx-libs-3.5.99.23/nx-X11/lib/src/Flush.c0000644000000000000000000000264513614532331014074 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* Flush all buffered output requests. */ /* NOTE: NOT necessary when calling any of the Xlib routines. */ int XFlush (register Display *dpy) { LockDisplay(dpy); _XFlush (dpy); UnlockDisplay(dpy); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/Font.c0000644000000000000000000005056013614532331013720 0ustar /* Copyright 1986, 1998 The Open Group Copyright (c) 2000 The XFree86 Project, Inc. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM OR THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium or of the XFree86 Project shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium and the XFree86 Project. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #if defined(XF86BIGFONT) #define USE_XF86BIGFONT #endif #ifdef USE_XF86BIGFONT #include #ifdef HAS_SHM #include #include #endif #include #include #include #endif #include "Xlcint.h" #include "XlcPubI.h" static XFontStruct *_XQueryFont( Display* /* dpy */, Font /* fid */, unsigned long /* seq */ ); #ifdef USE_XF86BIGFONT /* Private data for this extension. */ typedef struct { XExtCodes *codes; CARD32 serverSignature; CARD32 serverCapabilities; } XF86BigfontCodes; /* Additional bit masks that can be set in serverCapabilities */ #define CAP_VerifiedLocal 256 static XF86BigfontCodes *_XF86BigfontCodes( Display* /* dpy */ ); static XFontStruct *_XF86BigfontQueryFont( Display* /* dpy */, XF86BigfontCodes* /* extcodes */, Font /* fid */, unsigned long /* seq */ ); void _XF86BigfontFreeFontMetrics( XFontStruct* /* fs */ ); #endif /* USE_XF86BIGFONT */ XFontStruct *XLoadQueryFont( register Display *dpy, _Xconst char *name) { XFontStruct *font_result; register long nbytes; Font fid; xOpenFontReq *req; unsigned long seq; #ifdef USE_XF86BIGFONT XF86BigfontCodes *extcodes = _XF86BigfontCodes(dpy); #endif if (_XF86LoadQueryLocaleFont(dpy, name, &font_result, (Font *)0)) return font_result; LockDisplay(dpy); GetReq(OpenFont, req); seq = dpy->request; nbytes = req->nbytes = name ? strlen(name) : 0; req->fid = fid = XAllocID(dpy); req->length += (nbytes+3)>>2; Data (dpy, name, nbytes); font_result = NULL; #ifdef USE_XF86BIGFONT if (extcodes) { font_result = _XF86BigfontQueryFont(dpy, extcodes, fid, seq); seq = 0; } #endif if (!font_result) font_result = _XQueryFont(dpy, fid, seq); UnlockDisplay(dpy); SyncHandle(); return font_result; } XFontStruct *XQueryFont ( register Display *dpy, Font fid) { XFontStruct *font_result; #ifdef USE_XF86BIGFONT XF86BigfontCodes *extcodes = _XF86BigfontCodes(dpy); #endif LockDisplay(dpy); font_result = NULL; #ifdef USE_XF86BIGFONT if (extcodes) { font_result = _XF86BigfontQueryFont(dpy, extcodes, fid, 0L); } #endif if (!font_result) font_result = _XQueryFont(dpy, fid, 0L); UnlockDisplay(dpy); SyncHandle(); return font_result; } int XFreeFont( register Display *dpy, XFontStruct *fs) { register xResourceReq *req; register _XExtension *ext; LockDisplay(dpy); /* call out to any extensions interested */ for (ext = dpy->ext_procs; ext; ext = ext->next) if (ext->free_Font) (*ext->free_Font)(dpy, fs, &ext->codes); GetResReq (CloseFont, fs->fid, req); UnlockDisplay(dpy); SyncHandle(); if (fs->per_char) { #ifdef USE_XF86BIGFONT _XF86BigfontFreeFontMetrics(fs); #else Xfree (fs->per_char); #endif } _XFreeExtData(fs->ext_data); Xfree (fs->properties); Xfree (fs); return 1; } static XFontStruct * _XQueryFont ( register Display *dpy, Font fid, unsigned long seq) { register XFontStruct *fs; unsigned long nbytes; unsigned long reply_left; /* unused data words left in reply buffer */ xQueryFontReply reply; register xResourceReq *req; register _XExtension *ext; _XAsyncHandler async; _XAsyncErrorState async_state; if (seq) { async_state.min_sequence_number = seq; async_state.max_sequence_number = seq; async_state.error_code = BadName; async_state.major_opcode = X_OpenFont; async_state.minor_opcode = 0; async_state.error_count = 0; async.next = dpy->async_handlers; async.handler = _XAsyncErrorHandler; async.data = (XPointer)&async_state; dpy->async_handlers = &async; } GetResReq(QueryFont, fid, req); if (!_XReply (dpy, (xReply *) &reply, ((SIZEOF(xQueryFontReply) - SIZEOF(xReply)) >> 2), xFalse)) { if (seq) DeqAsyncHandler(dpy, &async); return (XFontStruct *)NULL; } if (seq) DeqAsyncHandler(dpy, &async); reply_left = reply.length - ((SIZEOF(xQueryFontReply) - SIZEOF(xReply)) >> 2); if (! (fs = Xmalloc (sizeof (XFontStruct)))) { _XEatDataWords(dpy, reply_left); return (XFontStruct *)NULL; } fs->ext_data = NULL; fs->fid = fid; fs->direction = reply.drawDirection; fs->min_char_or_byte2 = reply.minCharOrByte2; fs->max_char_or_byte2 = reply.maxCharOrByte2; fs->min_byte1 = reply.minByte1; fs->max_byte1 = reply.maxByte1; fs->default_char = reply.defaultChar; fs->all_chars_exist = reply.allCharsExist; fs->ascent = cvtINT16toInt (reply.fontAscent); fs->descent = cvtINT16toInt (reply.fontDescent); /* XXX the next two statements won't work if short isn't 16 bits */ fs->min_bounds = * (XCharStruct *) &reply.minBounds; fs->max_bounds = * (XCharStruct *) &reply.maxBounds; fs->n_properties = reply.nFontProps; /* * if no properties defined for the font, then it is bad * font, but shouldn't try to read nothing. */ fs->properties = NULL; if (fs->n_properties > 0) { /* nFontProps is a CARD16 */ nbytes = reply.nFontProps * SIZEOF(xFontProp); if ((nbytes >> 2) <= reply_left) { size_t pbytes = reply.nFontProps * sizeof(XFontProp); fs->properties = Xmalloc (pbytes); } if (! fs->properties) { Xfree(fs); _XEatDataWords(dpy, reply_left); return (XFontStruct *)NULL; } _XRead32 (dpy, (long *)fs->properties, nbytes); reply_left -= (nbytes >> 2); } /* * If no characters in font, then it is a bad font, but * shouldn't try to read nothing. */ fs->per_char = NULL; if (reply.nCharInfos > 0){ /* nCharInfos is a CARD32 */ if (reply.nCharInfos < (INT_MAX / sizeof(XCharStruct))) { nbytes = reply.nCharInfos * SIZEOF(xCharInfo); if ((nbytes >> 2) <= reply_left) { size_t cibytes = reply.nCharInfos * sizeof(XCharStruct); fs->per_char = Xmalloc (cibytes); } } if (! fs->per_char) { Xfree(fs->properties); Xfree(fs); _XEatDataWords(dpy, reply_left); return (XFontStruct *)NULL; } _XRead16 (dpy, (char *)fs->per_char, nbytes); } /* call out to any extensions interested */ for (ext = dpy->ext_procs; ext; ext = ext->next) if (ext->create_Font) (*ext->create_Font)(dpy, fs, &ext->codes); return fs; } #ifdef USE_XF86BIGFONT /* Magic cookie for finding the right XExtData structure on the display's extension list. */ static int XF86BigfontNumber = 1040697125; static int _XF86BigfontFreeCodes ( XExtData *extension) { /* Don't Xfree(extension->private_data) because it is on the same malloc chunk as extension. */ /* Don't Xfree(extension->private_data->codes) because this is shared with the display's ext_procs list. */ return 0; } static XF86BigfontCodes * _XF86BigfontCodes ( register Display *dpy) { XEDataObject dpy_union; XExtData *pData; XF86BigfontCodes *pCodes; char *envval; dpy_union.display = dpy; /* If the server is known to support the XF86Bigfont extension, * return the extension codes. If the server is known to not support * the extension, don't bother checking again. */ pData = XFindOnExtensionList(XEHeadOfExtensionList(dpy_union), XF86BigfontNumber); if (pData) return (XF86BigfontCodes *) pData->private_data; pData = Xmalloc(sizeof(XExtData) + sizeof(XF86BigfontCodes)); if (!pData) { /* Out of luck. */ return (XF86BigfontCodes *) NULL; } /* See if the server supports the XF86Bigfont extension. */ envval = getenv("XF86BIGFONT_DISABLE"); /* Let the user disable it. */ if (envval != NULL && envval[0] != '\0') pCodes = NULL; else { XExtCodes *codes = XInitExtension(dpy, XF86BIGFONTNAME); if (codes == NULL) pCodes = NULL; else { pCodes = (XF86BigfontCodes *) &pData[1]; pCodes->codes = codes; } } pData->number = XF86BigfontNumber; pData->private_data = (XPointer) pCodes; pData->free_private = _XF86BigfontFreeCodes; XAddToExtensionList(XEHeadOfExtensionList(dpy_union), pData); if (pCodes) { int result; /* See if the server supports the XF86BigfontQueryFont request. */ xXF86BigfontQueryVersionReply reply; register xXF86BigfontQueryVersionReq *req; LockDisplay(dpy); GetReq(XF86BigfontQueryVersion, req); req->reqType = pCodes->codes->major_opcode; req->xf86bigfontReqType = X_XF86BigfontQueryVersion; result = _XReply (dpy, (xReply *) &reply, (SIZEOF(xXF86BigfontQueryVersionReply) - SIZEOF(xReply)) >> 2, xFalse); UnlockDisplay(dpy); SyncHandle(); if(!result) goto ignore_extension; /* No need to provide backward compatibility with version 1.0. It was never widely distributed. */ if (!(reply.majorVersion > 1 || (reply.majorVersion == 1 && reply.minorVersion >= 1))) goto ignore_extension; pCodes->serverSignature = reply.signature; pCodes->serverCapabilities = reply.capabilities; } return pCodes; ignore_extension: /* No need to Xfree(pCodes) or Xfree(pCodes->codes), see _XF86BigfontFreeCodes comment. */ pCodes = (XF86BigfontCodes *) NULL; pData->private_data = (XPointer) pCodes; return pCodes; } static int _XF86BigfontFreeNop ( XExtData *extension) { return 0; } static XFontStruct * _XF86BigfontQueryFont ( register Display *dpy, XF86BigfontCodes *extcodes, Font fid, unsigned long seq) { register XFontStruct *fs; unsigned long nbytes; unsigned long reply_left; /* unused data left in reply buffer */ xXF86BigfontQueryFontReply reply; register xXF86BigfontQueryFontReq *req; register _XExtension *ext; _XAsyncHandler async1; _XAsyncErrorState async1_state; _XAsyncHandler async2; _XAsyncErrorState async2_state; if (seq) { async1_state.min_sequence_number = seq; async1_state.max_sequence_number = seq; async1_state.error_code = BadName; async1_state.major_opcode = X_OpenFont; async1_state.minor_opcode = 0; async1_state.error_count = 0; async1.next = dpy->async_handlers; async1.handler = _XAsyncErrorHandler; async1.data = (XPointer)&async1_state; dpy->async_handlers = &async1; } GetReq(XF86BigfontQueryFont, req); req->reqType = extcodes->codes->major_opcode; req->xf86bigfontReqType = X_XF86BigfontQueryFont; req->id = fid; req->flags = (extcodes->serverCapabilities & XF86Bigfont_CAP_LocalShm ? XF86Bigfont_FLAGS_Shm : 0); /* The function _XQueryFont benefits from a "magic" error handler for BadFont coming from a X_QueryFont request. (See function _XReply.) We have to establish an error handler ourselves. */ async2_state.min_sequence_number = dpy->request; async2_state.max_sequence_number = dpy->request; async2_state.error_code = BadFont; async2_state.major_opcode = extcodes->codes->major_opcode; async2_state.minor_opcode = X_XF86BigfontQueryFont; async2_state.error_count = 0; async2.next = dpy->async_handlers; async2.handler = _XAsyncErrorHandler; async2.data = (XPointer)&async2_state; dpy->async_handlers = &async2; if (!_XReply (dpy, (xReply *) &reply, ((SIZEOF(xXF86BigfontQueryFontReply) - SIZEOF(xReply)) >> 2), xFalse)) { DeqAsyncHandler(dpy, &async2); if (seq) DeqAsyncHandler(dpy, &async1); return (XFontStruct *)NULL; } DeqAsyncHandler(dpy, &async2); if (seq) DeqAsyncHandler(dpy, &async1); reply_left = reply.length - ((SIZEOF(xXF86BigfontQueryFontReply) - SIZEOF(xReply)) >> 2); if (! (fs = Xmalloc (sizeof (XFontStruct)))) { _XEatDataWords(dpy, reply_left); return (XFontStruct *)NULL; } fs->ext_data = NULL; fs->fid = fid; fs->direction = reply.drawDirection; fs->min_char_or_byte2 = reply.minCharOrByte2; fs->max_char_or_byte2 = reply.maxCharOrByte2; fs->min_byte1 = reply.minByte1; fs->max_byte1 = reply.maxByte1; fs->default_char = reply.defaultChar; fs->all_chars_exist = reply.allCharsExist; fs->ascent = cvtINT16toInt (reply.fontAscent); fs->descent = cvtINT16toInt (reply.fontDescent); /* XXX the next two statements won't work if short isn't 16 bits */ fs->min_bounds = * (XCharStruct *) &reply.minBounds; fs->max_bounds = * (XCharStruct *) &reply.maxBounds; fs->n_properties = reply.nFontProps; /* * if no properties defined for the font, then it is bad * font, but shouldn't try to read nothing. */ fs->properties = NULL; if (fs->n_properties > 0) { /* nFontProps is a CARD16 */ nbytes = reply.nFontProps * SIZEOF(xFontProp); if ((nbytes >> 2) <= reply_left) { size_t pbytes = reply.nFontProps * sizeof(XFontProp); fs->properties = Xmalloc (pbytes); } if (! fs->properties) { Xfree(fs); _XEatDataWords(dpy, reply_left); return (XFontStruct *)NULL; } _XRead32 (dpy, (long *)fs->properties, nbytes); reply_left -= (nbytes >> 2); } fs->per_char = NULL; #ifndef LONG64 /* compares each part to half the maximum, which should be far more than any real font needs, so the combined total doesn't overflow either */ if (reply.nUniqCharInfos > ((ULONG_MAX / 2) / SIZEOF(xCharInfo)) || reply.nCharInfos > ((ULONG_MAX / 2) / sizeof(CARD16))) { Xfree(fs->properties); Xfree(fs); _XEatDataWords(dpy, reply_left); return (XFontStruct *)NULL; } #endif if (reply.nCharInfos > 0) { /* fprintf(stderr, "received font metrics, nCharInfos = %d, nUniqCharInfos = %d, shmid = %d\n", reply.nCharInfos, reply.nUniqCharInfos, reply.shmid); */ if (reply.shmid == (CARD32)(-1)) { xCharInfo* pUniqCI; CARD16* pIndex2UniqIndex; int i; nbytes = reply.nUniqCharInfos * SIZEOF(xCharInfo) + (reply.nCharInfos+1)/2 * 2 * sizeof(CARD16); pUniqCI = Xmalloc (nbytes); if (!pUniqCI) { Xfree(fs->properties); Xfree(fs); _XEatDataWords(dpy, reply_left); return (XFontStruct *)NULL; } if (! (fs->per_char = Xmalloc (reply.nCharInfos * sizeof(XCharStruct)))) { Xfree(pUniqCI); Xfree(fs->properties); Xfree(fs); _XEatDataWords(dpy, reply_left); return (XFontStruct *)NULL; } _XRead16 (dpy, (char *) pUniqCI, nbytes); pIndex2UniqIndex = (CARD16*) (pUniqCI + reply.nUniqCharInfos); for (i = 0; i < reply.nCharInfos; i++) { if (pIndex2UniqIndex[i] >= reply.nUniqCharInfos) { fprintf(stderr, "_XF86BigfontQueryFont: server returned wrong data\n"); Xfree(pUniqCI); Xfree(fs->properties); Xfree(fs); return (XFontStruct *)NULL; } /* XXX the next statement won't work if short isn't 16 bits */ fs->per_char[i] = * (XCharStruct *) &pUniqCI[pIndex2UniqIndex[i]]; } Xfree(pUniqCI); } else { #ifdef HAS_SHM XExtData *pData; XEDataObject fs_union; char *addr; pData = Xmalloc(sizeof(XExtData)); if (!pData) { Xfree(fs->properties); Xfree(fs); return (XFontStruct *)NULL; } /* In some cases (e.g. an ssh daemon forwarding an X session to a remote machine) it is possible that the X server thinks we are running on the same machine (because getpeername() and LocalClient() cannot know about the forwarding) but we are not really local. Therefore, when we attach the first shared memory segment, we verify that we are on the same machine as the X server by checking that 1. shmat() succeeds, 2. the segment has a sufficient size, 3. it contains the X server's signature. Then we set the CAP_VerifiedLocal bit to indicate the verification was successful. */ if ((addr = shmat(reply.shmid, NULL, SHM_RDONLY)) == (char *)-1) { if (extcodes->serverCapabilities & CAP_VerifiedLocal) fprintf(stderr, "_XF86BigfontQueryFont: could not attach shm segment\n"); Xfree(pData); Xfree(fs->properties); Xfree(fs); /* Stop requesting shared memory transport from now on. */ extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm; return (XFontStruct *)NULL; } if (!(extcodes->serverCapabilities & CAP_VerifiedLocal)) { struct shmid_ds buf; if (!(shmctl(reply.shmid, IPC_STAT, &buf) >= 0 && reply.nCharInfos < (INT_MAX / sizeof(XCharStruct)) && buf.shm_segsz >= reply.shmsegoffset + reply.nCharInfos * sizeof(XCharStruct) + sizeof(CARD32) && *(CARD32 *)(addr + reply.shmsegoffset + reply.nCharInfos * sizeof(XCharStruct)) == extcodes->serverSignature)) { shmdt(addr); Xfree(pData); Xfree(fs->properties); Xfree(fs); /* Stop requesting shared memory transport from now on. */ extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm; return (XFontStruct *)NULL; } extcodes->serverCapabilities |= CAP_VerifiedLocal; } pData->number = XF86BigfontNumber; pData->private_data = (XPointer) addr; pData->free_private = _XF86BigfontFreeNop; fs_union.font = fs; XAddToExtensionList(XEHeadOfExtensionList(fs_union), pData); fs->per_char = (XCharStruct *) (addr + reply.shmsegoffset); #else fprintf(stderr, "_XF86BigfontQueryFont: try recompiling libX11 with HasShm, Xserver has shm support\n"); if (fs->properties) Xfree(fs->properties); Xfree(fs); /* Stop requesting shared memory transport from now on. */ extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm; return (XFontStruct *)NULL; #endif } } /* call out to any extensions interested */ for (ext = dpy->ext_procs; ext; ext = ext->next) if (ext->create_Font) (*ext->create_Font)(dpy, fs, &ext->codes); return fs; } void _XF86BigfontFreeFontMetrics (XFontStruct *fs) { #ifdef HAS_SHM XExtData *pData; XEDataObject fs_union; fs_union.font = fs; if ((pData = XFindOnExtensionList(XEHeadOfExtensionList(fs_union), XF86BigfontNumber))) shmdt ((char *) pData->private_data); else Xfree (fs->per_char); #else Xfree (fs->per_char); #endif } #endif /* USE_XF86BIGFONT */ int _XF86LoadQueryLocaleFont( Display *dpy, _Xconst char *name, XFontStruct **xfp, Font *fidp) { int l; const char *charset, *p; char buf[256]; XFontStruct *fs; XLCd lcd; if (!name) return 0; l = strlen(name); if (l < 2 || name[l - 1] != '*' || name[l - 2] != '-') return 0; charset = NULL; /* next three lines stolen from _XkbGetCharset() */ lcd = _XlcCurrentLC(); if ((lcd = _XlcCurrentLC()) != 0) charset = XLC_PUBLIC(lcd, encoding_name); if (!charset || (p = strrchr(charset, '-')) == 0 || p == charset || p[1] == 0 || (p[1] == '*' && p[2] == 0)) { /* prefer latin1 if no encoding found */ charset = "ISO8859-1"; p = charset + 7; } if (l - 2 - (p - charset) < 0) return 0; if (_XlcNCompareISOLatin1(name + l - 2 - (p - charset), charset, p - charset)) return 0; if (strlen(p + 1) + l - 1 >= sizeof(buf) - 1) return 0; strcpy(buf, name); strcpy(buf + l - 1, p + 1); fs = XLoadQueryFont(dpy, buf); if (!fs) return 0; if (xfp) { *xfp = fs; if (fidp) *fidp = fs->fid; } else if (fidp) { if (fs->per_char) { #ifdef USE_XF86BIGFONT _XF86BigfontFreeFontMetrics(fs); #else Xfree (fs->per_char); #endif } _XFreeExtData(fs->ext_data); Xfree (fs->properties); *fidp = fs->fid; Xfree (fs); } else { XFreeFont(dpy, fs); } return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/FontInfo.c0000644000000000000000000001421313614532331014527 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #if defined(XF86BIGFONT) #define USE_XF86BIGFONT #endif #ifdef USE_XF86BIGFONT extern void _XF86BigfontFreeFontMetrics( XFontStruct* /* fs */ ); #endif char **XListFontsWithInfo( register Display *dpy, _Xconst char *pattern, /* null-terminated */ int maxNames, int *actualCount, /* RETURN */ XFontStruct **info) /* RETURN */ { unsigned long nbytes; unsigned long reply_left; /* unused data left in reply buffer */ register int i; register XFontStruct *fs; unsigned int size = 0; XFontStruct *finfo = NULL; char **flist = NULL; xListFontsWithInfoReply reply; register xListFontsReq *req; int j; LockDisplay(dpy); GetReq(ListFontsWithInfo, req); req->maxNames = maxNames; nbytes = req->nbytes = pattern ? strlen (pattern) : 0; req->length += (nbytes + 3) >> 2; _XSend (dpy, pattern, nbytes); /* use _XSend instead of Data, since subsequent _XReply will flush buffer */ for (i = 0; ; i++) { if (!_XReply (dpy, (xReply *) &reply, ((SIZEOF(xListFontsWithInfoReply) - SIZEOF(xGenericReply)) >> 2), xFalse)) { reply.nameLength = 0; /* avoid trying to read more replies */ reply_left = 0; goto badmem; } reply_left = reply.length - ((SIZEOF(xListFontsWithInfoReply) - SIZEOF(xGenericReply)) >> 2); if (reply.nameLength == 0) { _XEatDataWords(dpy, reply_left); break; } if (reply.nReplies >= (INT_MAX - i)) /* avoid overflowing size */ goto badmem; if ((i + reply.nReplies) >= size) { size = i + reply.nReplies + 1; if (size >= (INT_MAX / sizeof(XFontStruct))) goto badmem; if (finfo) { XFontStruct * tmp_finfo; char ** tmp_flist; tmp_finfo = Xrealloc (finfo, sizeof(XFontStruct) * size); if (tmp_finfo) finfo = tmp_finfo; else goto badmem; tmp_flist = Xrealloc (flist, sizeof(char *) * (size+1)); if (tmp_flist) flist = tmp_flist; else goto badmem; } else { if (! (finfo = Xmalloc(sizeof(XFontStruct) * size))) goto clearwire; if (! (flist = Xmalloc(sizeof(char *) * (size+1)))) { Xfree(finfo); goto clearwire; } } } fs = &finfo[i]; fs->ext_data = NULL; fs->per_char = NULL; fs->fid = None; fs->direction = reply.drawDirection; fs->min_char_or_byte2 = reply.minCharOrByte2; fs->max_char_or_byte2 = reply.maxCharOrByte2; fs->min_byte1 = reply.minByte1; fs->max_byte1 = reply.maxByte1; fs->default_char = reply.defaultChar; fs->all_chars_exist = reply.allCharsExist; fs->ascent = cvtINT16toInt (reply.fontAscent); fs->descent = cvtINT16toInt (reply.fontDescent); /* XXX the next two statements won't work if short isn't 16 bits */ fs->min_bounds = * (XCharStruct *) &reply.minBounds; fs->max_bounds = * (XCharStruct *) &reply.maxBounds; fs->n_properties = reply.nFontProps; fs->properties = NULL; if (fs->n_properties > 0) { /* nFontProps is a CARD16 */ nbytes = reply.nFontProps * SIZEOF(xFontProp); if ((nbytes >> 2) <= reply_left) { size_t pbytes = reply.nFontProps * sizeof(XFontProp); fs->properties = Xmalloc (pbytes); } if (! fs->properties) goto badmem; _XRead32 (dpy, (long *)fs->properties, nbytes); reply_left -= (nbytes >> 2); } /* nameLength is a CARD8 */ nbytes = reply.nameLength + 1; if (!i) nbytes++; /* make first string 1 byte longer, to match XListFonts */ flist[i] = Xmalloc (nbytes); if (! flist[i]) { if (finfo[i].properties) Xfree(finfo[i].properties); goto badmem; } if (!i) { *flist[0] = 0; /* zero to distinguish from XListFonts */ flist[0]++; } flist[i][reply.nameLength] = '\0'; _XReadPad (dpy, flist[i], (long) reply.nameLength); } *info = finfo; *actualCount = i; if (flist) flist[i] = NULL; /* required in case XFreeFontNames is called */ UnlockDisplay(dpy); SyncHandle(); return (flist); badmem: /* Free all memory allocated by this function. */ for (j=(i-1); (j >= 0); j--) { if (j == 0) flist[j]--; /* was incremented above */ Xfree(flist[j]); if (finfo[j].properties) Xfree(finfo[j].properties); } Xfree(flist); Xfree(finfo); clearwire: /* Clear the wire. */ _XEatDataWords(dpy, reply_left); while ((reply.nameLength != 0) && _XReply(dpy, (xReply *) &reply, ((SIZEOF(xListFontsWithInfoReply) - SIZEOF(xGenericReply)) >> 2), xTrue)); UnlockDisplay(dpy); SyncHandle(); *info = NULL; *actualCount = 0; return (char **) NULL; } int XFreeFontInfo ( char **names, XFontStruct *info, int actualCount) { register int i; if (names) { Xfree (names[0]-1); for (i = 1; i < actualCount; i++) { Xfree (names[i]); } Xfree(names); } if (info) { for (i = 0; i < actualCount; i++) { if (info[i].per_char) #ifdef USE_XF86BIGFONT _XF86BigfontFreeFontMetrics(&info[i]); #else Xfree (info[i].per_char); #endif if (info[i].properties) Xfree (info[i].properties); } Xfree(info); } return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/FontNames.c0000644000000000000000000000663513614532331014710 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include char ** XListFonts( register Display *dpy, _Xconst char *pattern, /* null-terminated */ int maxNames, int *actualCount) /* RETURN */ { register long nbytes; register unsigned i; register int length; char **flist = NULL; char *ch = NULL; char *chstart; char *chend; int count = 0; xListFontsReply rep; register xListFontsReq *req; unsigned long rlen = 0; LockDisplay(dpy); GetReq(ListFonts, req); req->maxNames = maxNames; nbytes = req->nbytes = pattern ? strlen (pattern) : 0; req->length += (nbytes + 3) >> 2; _XSend (dpy, pattern, nbytes); /* use _XSend instead of Data, since following _XReply will flush buffer */ if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) { *actualCount = 0; UnlockDisplay(dpy); SyncHandle(); return (char **) NULL; } if (rep.nFonts) { flist = Xmalloc (rep.nFonts * sizeof(char *)); if (rep.length > 0 && rep.length < (INT_MAX >> 2)) { rlen = rep.length << 2; ch = Xmalloc(rlen + 1); /* +1 to leave room for last null-terminator */ } if ((! flist) || (! ch)) { Xfree(flist); Xfree(ch); _XEatDataWords(dpy, rep.length); *actualCount = 0; UnlockDisplay(dpy); SyncHandle(); return (char **) NULL; } _XReadPad (dpy, ch, rlen); /* * unpack into null terminated strings. */ chstart = ch; chend = ch + rlen; length = *(unsigned char *)ch; *ch = 1; /* make sure it is non-zero for XFreeFontNames */ for (i = 0; i < rep.nFonts; i++) { if (ch + length < chend) { flist[i] = ch + 1; /* skip over length */ ch += length + 1; /* find next length ... */ length = *(unsigned char *)ch; *ch = '\0'; /* and replace with null-termination */ count++; } else { Xfree(chstart); Xfree(flist); flist = NULL; count = 0; break; } } } *actualCount = count; UnlockDisplay(dpy); SyncHandle(); return (flist); } int XFreeFontNames(char **list) { if (list) { if (!*(list[0]-1)) { /* from ListFontsWithInfo */ register char **names; for (names = list+1; *names; names++) Xfree (*names); } Xfree (list[0]-1); Xfree (list); } return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/FreeCmap.c0000644000000000000000000000277013614532331014474 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlib.h" #include "Xlibint.h" #include "Cmap.h" int XFreeColormap( register Display *dpy, Colormap cmap) { register xResourceReq *req; LockDisplay(dpy); GetResReq(FreeColormap, cmap, req); UnlockDisplay(dpy); SyncHandle(); #ifdef XCMS _XcmsDeleteCmapRec(dpy, cmap); #endif return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/FreeCols.c0000644000000000000000000000340713614532331014512 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XFreeColors( register Display *dpy, Colormap cmap, unsigned long *pixels, /* LISTofCARD32 */ int npixels, unsigned long planes) /* CARD32 */ { register xFreeColorsReq *req; register long nbytes; LockDisplay(dpy); GetReq(FreeColors, req); req->cmap = cmap; req->planeMask = planes; /* on the VAX, each pixel is a 32-bit (unsigned) integer */ req->length += npixels; nbytes = npixels << 2; /* watch out for macros... */ Data32 (dpy, (long *) pixels, nbytes); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/FreeCurs.c0000644000000000000000000000263113614532331014524 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XFreeCursor( register Display *dpy, Cursor cursor) { register xResourceReq *req; LockDisplay(dpy); GetResReq(FreeCursor, cursor, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/FreeEData.c0000644000000000000000000000272613614532331014573 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int _XFreeExtData (XExtData *extension) { XExtData *temp; while (extension) { if (extension->free_private) (*extension->free_private)(extension); else Xfree (extension->private_data); temp = extension->next; Xfree (extension); extension = temp; } return 0; } nx-libs-3.5.99.23/nx-X11/lib/src/FreeEventData.c0000644000000000000000000000266613614532331015473 0ustar /* * Copyright © 2009 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" void XFreeEventData(Display *dpy, XGenericEventCookie *event) { if (_XIsEventCookie(dpy, (XEvent*)event) && event->data) { XFree(event->data); event->data = NULL; event->cookie = 0; } return; } nx-libs-3.5.99.23/nx-X11/lib/src/FreeGC.c0000644000000000000000000000320313614532331014075 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XFreeGC ( register Display *dpy, GC gc) { register xResourceReq *req; register _XExtension *ext; LockDisplay(dpy); /* call out to any extensions interested */ for (ext = dpy->ext_procs; ext; ext = ext->next) if (ext->free_GC) (*ext->free_GC)(dpy, gc, &ext->codes); GetResReq (FreeGC, gc->gid, req); UnlockDisplay(dpy); SyncHandle(); _XFreeExtData(gc->ext_data); Xfree (gc); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/FreePix.c0000644000000000000000000000263113614532331014350 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XFreePixmap( register Display *dpy, Pixmap pixmap) { register xResourceReq *req; LockDisplay(dpy); GetResReq(FreePixmap, pixmap, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/FSSaver.c0000644000000000000000000000322613614532331014320 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XActivateScreenSaver(register Display *dpy) { XForceScreenSaver (dpy, ScreenSaverActive); return 1; } int XResetScreenSaver(register Display *dpy) { XForceScreenSaver (dpy, ScreenSaverReset); return 1; } int XForceScreenSaver( register Display *dpy, int mode) { register xForceScreenSaverReq *req; LockDisplay(dpy); GetReq(ForceScreenSaver, req); req->mode = mode; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/FSWrap.c0000644000000000000000000001473213614532331014155 0ustar /* * Copyright 1991 by the Open Software Foundation * Copyright 1993 by the TOSHIBA Corp. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name Open Software Foundation * not be used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Open Software * Foundation makes no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * OPEN SOFTWARE FOUNDATION DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * M. Collins OSF * * Katsuhisa Yano TOSHIBA Corp. */ /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" #include #include #define XMAXLIST 256 char ** _XParseBaseFontNameList( char *str, int *num) { char *plist[XMAXLIST]; char **list; char *ptr, *psave; *num = 0; if (!str || !*str) { return (char **)NULL; } while (*str && isspace(*str)) str++; if (!*str) return (char **)NULL; if (!(ptr = strdup(str))) { return (char **)NULL; } psave = ptr; /* somebody who specifies more than XMAXLIST basefontnames will lose */ while (*num < (sizeof plist / sizeof plist[0])) { char *back; plist[*num] = ptr; if ((ptr = strchr(ptr, ','))) { back = ptr; } else { back = plist[*num] + strlen(plist[*num]); } while (isspace(*(back - 1))) back--; *back = '\0'; (*num)++; if (!ptr) break; ptr++; while (*ptr && isspace(*ptr)) ptr++; if (!*ptr) break; } if (!(list = Xmalloc(sizeof(char *) * (*num + 1)))) { Xfree(psave); return (char **)NULL; } memcpy((char *)list, (char *)plist, sizeof(char *) * (*num)); *(list + *num) = NULL; return list; } static char ** copy_string_list( char **string_list, int list_count) { char **string_list_ret, **list_src, **list_dst, *dst; int length, count; if (string_list == NULL || list_count <= 0) return (char **) NULL; string_list_ret = Xmalloc(sizeof(char *) * list_count); if (string_list_ret == NULL) return (char **) NULL; list_src = string_list; count = list_count; for (length = 0; count-- > 0; list_src++) length += strlen(*list_src) + 1; dst = Xmalloc(length); if (dst == NULL) { Xfree(string_list_ret); return (char **) NULL; } list_src = string_list; count = list_count; list_dst = string_list_ret; for ( ; count-- > 0; list_src++) { strcpy(dst, *list_src); *list_dst++ = dst; dst += strlen(dst) + 1; } return string_list_ret; } XFontSet XCreateFontSet ( Display *dpy, _Xconst char *base_font_name_list, char ***missing_charset_list, int *missing_charset_count, char **def_string) { XOM om; XOC oc; XOMCharSetList *list; *missing_charset_list = NULL; *missing_charset_count = 0; om = XOpenOM(dpy, NULL, NULL, NULL); if (om == NULL) return (XFontSet) NULL; if ((oc = XCreateOC(om, XNBaseFontName, base_font_name_list, NULL))) { list = &oc->core.missing_list; oc->core.om_automatic = True; } else list = &om->core.required_charset; *missing_charset_list = copy_string_list(list->charset_list, list->charset_count); *missing_charset_count = list->charset_count; if (list->charset_list && *missing_charset_list == NULL) oc = NULL; if (oc && def_string) { *def_string = oc->core.default_string; if (!*def_string) *def_string = (char *)""; } if (oc == NULL) XCloseOM(om); return (XFontSet) oc; } int XFontsOfFontSet( XFontSet font_set, XFontStruct ***font_struct_list, char ***font_name_list) { *font_name_list = font_set->core.font_info.font_name_list; *font_struct_list = font_set->core.font_info.font_struct_list; return font_set->core.font_info.num_font; } char * XBaseFontNameListOfFontSet(XFontSet font_set) { return font_set->core.base_name_list; } char * XLocaleOfFontSet(XFontSet font_set) { return font_set->core.om->core.lcd->core->name; } Bool XContextDependentDrawing(XFontSet font_set) { return font_set->core.om->core.context_dependent; } Bool XDirectionalDependentDrawing(XFontSet font_set) { return font_set->core.om->core.directional_dependent; } Bool XContextualDrawing(XFontSet font_set) { return font_set->core.om->core.contextual_drawing; } XFontSetExtents * XExtentsOfFontSet(XFontSet font_set) { if (!font_set) return NULL; return &font_set->core.font_set_extents; } void XFreeFontSet( Display *dpy, XFontSet font_set) { XCloseOM(font_set->core.om); } nx-libs-3.5.99.23/nx-X11/lib/src/GCMisc.c0000644000000000000000000000523113614532331014112 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetArcMode ( register Display *dpy, register GC gc, int arc_mode) { LockDisplay(dpy); if (gc->values.arc_mode != arc_mode) { gc->values.arc_mode = arc_mode; gc->dirty |= GCArcMode; } UnlockDisplay(dpy); SyncHandle(); return 1; } int XSetFillRule ( register Display *dpy, register GC gc, int fill_rule) { LockDisplay(dpy); if (gc->values.fill_rule != fill_rule) { gc->values.fill_rule = fill_rule; gc->dirty |= GCFillRule; } UnlockDisplay(dpy); SyncHandle(); return 1; } int XSetFillStyle ( register Display *dpy, register GC gc, int fill_style) { LockDisplay(dpy); if (gc->values.fill_style != fill_style) { gc->values.fill_style = fill_style; gc->dirty |= GCFillStyle; } UnlockDisplay(dpy); SyncHandle(); return 1; } int XSetGraphicsExposures ( register Display *dpy, register GC gc, Bool graphics_exposures) { LockDisplay(dpy); if (gc->values.graphics_exposures != graphics_exposures) { gc->values.graphics_exposures = graphics_exposures; gc->dirty |= GCGraphicsExposures; } UnlockDisplay(dpy); SyncHandle(); return 1; } int XSetSubwindowMode ( register Display *dpy, register GC gc, int subwindow_mode) { LockDisplay(dpy); if (gc->values.subwindow_mode != subwindow_mode) { gc->values.subwindow_mode = subwindow_mode; gc->dirty |= GCSubwindowMode; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/Geom.c0000644000000000000000000000626413614532331013703 0ustar /* Copyright 1985, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xutil.h" /* * This routine given a user supplied positional argument and a default * argument (fully qualified) will return the position the window should take * returns 0 if there was some problem, else the position bitmask. */ int XGeometry ( Display *dpy, /* user's display connection */ int screen, /* screen on which to do computation */ _Xconst char *pos, /* user provided geometry spec */ _Xconst char *def, /* default geometry spec for window */ unsigned int bwidth, /* border width */ unsigned int fwidth, /* size of position units */ unsigned int fheight, int xadd, /* any additional interior space */ int yadd, register int *x, /* always set on successful RETURN */ register int *y, /* always set on successful RETURN */ register int *width, /* always set on successful RETURN */ register int *height) /* always set on successful RETURN */ { int px, py; /* returned values from parse */ unsigned int pwidth, pheight; /* returned values from parse */ int dx, dy; /* default values from parse */ unsigned int dwidth, dheight; /* default values from parse */ int pmask, dmask; /* values back from parse */ pmask = XParseGeometry(pos, &px, &py, &pwidth, &pheight); dmask = XParseGeometry(def, &dx, &dy, &dwidth, &dheight); /* set default values */ *x = (dmask & XNegative) ? DisplayWidth(dpy, screen) + dx - dwidth * fwidth - 2 * bwidth - xadd : dx; *y = (dmask & YNegative) ? DisplayHeight(dpy, screen) + dy - dheight * fheight - 2 * bwidth - yadd : dy; *width = dwidth; *height = dheight; if (pmask & WidthValue) *width = pwidth; if (pmask & HeightValue) *height = pheight; if (pmask & XValue) *x = (pmask & XNegative) ? DisplayWidth(dpy, screen) + px - *width * fwidth - 2 * bwidth - xadd : px; if (pmask & YValue) *y = (pmask & YNegative) ? DisplayHeight(dpy, screen) + py - *height * fheight - 2 * bwidth - yadd : py; return (pmask); } nx-libs-3.5.99.23/nx-X11/lib/src/GetAtomNm.c0000644000000000000000000001170713614532331014645 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xintatom.h" static char *_XGetAtomName( Display *dpy, Atom atom) { xResourceReq *req; char *name; register Entry *table; register int idx; register Entry e; if (dpy->atoms) { table = dpy->atoms->table; for (idx = TABLESIZE; --idx >= 0; ) { if ((e = *table++) && (e->atom == atom)) { idx = strlen(EntryName(e)) + 1; if ((name = Xmalloc(idx))) strcpy(name, EntryName(e)); return name; } } } GetResReq(GetAtomName, atom, req); return (char *)NULL; } char *XGetAtomName( register Display *dpy, Atom atom) { xGetAtomNameReply rep; char *name; LockDisplay(dpy); if ((name = _XGetAtomName(dpy, atom))) { UnlockDisplay(dpy); return name; } if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); return(NULL); } if ((name = Xmalloc(rep.nameLength + 1))) { _XReadPad(dpy, name, (long)rep.nameLength); name[rep.nameLength] = '\0'; _XUpdateAtomCache(dpy, name, atom, 0, -1, 0); } else { _XEatDataWords(dpy, rep.length); name = (char *) NULL; } UnlockDisplay(dpy); SyncHandle(); return(name); } typedef struct { unsigned long start_seq; unsigned long stop_seq; Atom *atoms; char **names; int idx; int count; Status status; } _XGetAtomNameState; static Bool _XGetAtomNameHandler( register Display *dpy, register xReply *rep, char *buf, int len, XPointer data) { register _XGetAtomNameState *state; xGetAtomNameReply replbuf; register xGetAtomNameReply *repl; state = (_XGetAtomNameState *)data; if (dpy->last_request_read < state->start_seq || dpy->last_request_read > state->stop_seq) return False; while (state->idx < state->count && state->names[state->idx]) state->idx++; if (state->idx >= state->count) return False; if (rep->generic.type == X_Error) { state->status = 0; return False; } repl = (xGetAtomNameReply *) _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, (SIZEOF(xGetAtomNameReply) - SIZEOF(xReply)) >> 2, False); state->names[state->idx] = Xmalloc(repl->nameLength + 1); _XGetAsyncData(dpy, state->names[state->idx], buf, len, SIZEOF(xGetAtomNameReply), repl->nameLength, repl->length << 2); if (state->names[state->idx]) { state->names[state->idx][repl->nameLength] = '\0'; _XUpdateAtomCache(dpy, state->names[state->idx], state->atoms[state->idx], 0, -1, 0); } else { state->status = 0; } return True; } Status XGetAtomNames ( Display *dpy, Atom *atoms, int count, char **names_return) { _XAsyncHandler async; _XGetAtomNameState async_state; xGetAtomNameReply rep; int i; int missed = -1; LockDisplay(dpy); async_state.start_seq = dpy->request + 1; async_state.atoms = atoms; async_state.names = names_return; async_state.idx = 0; async_state.count = count - 1; async_state.status = 1; async.next = dpy->async_handlers; async.handler = _XGetAtomNameHandler; async.data = (XPointer)&async_state; dpy->async_handlers = &async; for (i = 0; i < count; i++) { if (!(names_return[i] = _XGetAtomName(dpy, atoms[i]))) { missed = i; async_state.stop_seq = dpy->request; } } if (missed >= 0) { if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { if ((names_return[missed] = Xmalloc(rep.nameLength + 1))) { _XReadPad(dpy, names_return[missed], (long)rep.nameLength); names_return[missed][rep.nameLength] = '\0'; _XUpdateAtomCache(dpy, names_return[missed], atoms[missed], 0, -1, 0); } else { _XEatDataWords(dpy, rep.length); async_state.status = 0; } } } DeqAsyncHandler(dpy, &async); UnlockDisplay(dpy); if (missed >= 0) SyncHandle(); return async_state.status; } nx-libs-3.5.99.23/nx-X11/lib/src/GetColor.c0000644000000000000000000000616413614532331014531 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xcmsint.h" Status XAllocNamedColor( register Display *dpy, Colormap cmap, _Xconst char *colorname, /* STRING8 */ XColor *hard_def, /* RETURN */ XColor *exact_def) /* RETURN */ { long nbytes; xAllocNamedColorReply rep; xAllocNamedColorReq *req; XcmsCCC ccc; XcmsColor cmsColor_exact; Status ret; #ifdef XCMS /* * Let's Attempt to use Xcms and i18n approach to Parse Color */ if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { const char *tmpName = colorname; switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact, XcmsRGBFormat)) { case XcmsSuccess: case XcmsSuccessWithCompression: _XcmsRGB_to_XColor(&cmsColor_exact, exact_def, 1); memcpy((char *)hard_def, (char *)exact_def, sizeof(XColor)); ret = XAllocColor(dpy, cmap, hard_def); exact_def->pixel = hard_def->pixel; return(ret); case XcmsFailure: case _XCMS_NEWNAME: /* * if the result was _XCMS_NEWNAME tmpName points to * a string in cmsColNm.c:pairs table, for example, * gray70 would become tekhvc:0.0/70.0/0.0 */ break; } } #endif /* * Xcms and i18n approach failed. */ LockDisplay(dpy); GetReq(AllocNamedColor, req); req->cmap = cmap; nbytes = req->nbytes = strlen(colorname); req->length += (nbytes + 3) >> 2; /* round up to mult of 4 */ _XSend(dpy, colorname, nbytes); /* _XSend is more efficient that Data, since _XReply follows */ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay(dpy); SyncHandle(); return (0); } exact_def->red = rep.exactRed; exact_def->green = rep.exactGreen; exact_def->blue = rep.exactBlue; hard_def->red = rep.screenRed; hard_def->green = rep.screenGreen; hard_def->blue = rep.screenBlue; exact_def->pixel = hard_def->pixel = rep.pixel; UnlockDisplay(dpy); SyncHandle(); return (1); } nx-libs-3.5.99.23/nx-X11/lib/src/GetDflt.c0000644000000000000000000001434213614532331014341 0ustar /*********************************************************** Copyright 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include #include "pathmax.h" #ifdef XTHREADS #include #endif #ifndef WIN32 #define X_INCLUDE_PWD_H #define XOS_USE_XLIB_LOCKING #include #endif #include #include /*ARGSUSED*/ static char * GetHomeDir( char *dest, int len) { #ifdef WIN32 register char *ptr1 = NULL; register char *ptr2 = NULL; int len1 = 0, len2 = 0; if ((ptr1 = getenv("HOME"))) { /* old, deprecated */ len1 = strlen (ptr1); } else if ((ptr1 = getenv("HOMEDRIVE")) && (ptr2 = getenv("HOMEDIR"))) { len1 = strlen (ptr1); len2 = strlen (ptr2); } else if ((ptr2 = getenv("USERNAME"))) { len1 = strlen (ptr1 = "/users/"); len2 = strlen (ptr2); } if ((len1 + len2 + 1) < len) snprintf (dest, len, "%s%s", ptr1, (ptr2) ? ptr2 : ""); else *dest = '\0'; #else #ifdef X_NEEDS_PWPARAMS _Xgetpwparams pwparams; #endif struct passwd *pw; register char *ptr; if (len <= 0 || dest == NULL) return NULL; if ((ptr = getenv("HOME"))) { (void) strncpy(dest, ptr, len-1); dest[len-1] = '\0'; } else { if ((ptr = getenv("USER"))) pw = _XGetpwnam(ptr,pwparams); else pw = _XGetpwuid(getuid(),pwparams); if (pw != NULL) { (void) strncpy(dest, pw->pw_dir, len-1); dest[len-1] = '\0'; } else *dest = '\0'; } #endif return dest; } static XrmDatabase InitDefaults( Display *dpy) /* display for defaults.... */ { XrmDatabase userdb; XrmDatabase xdb; char fname[PATH_MAX]; /* longer than any conceivable size */ char *xenv; XrmInitialize(); /* * See lib/Xt/Initialize.c * * First, get the defaults from the server; if none, then load from * ~/.Xdefaults. Next, if there is an XENVIRONMENT environment variable, * then load that file. */ if (dpy->xdefaults == NULL) { const char *slashDotXdefaults = "/.Xdefaults"; (void) GetHomeDir (fname, PATH_MAX - strlen (slashDotXdefaults) - 1); (void) strcat (fname, slashDotXdefaults); xdb = XrmGetFileDatabase (fname); } else { xdb = XrmGetStringDatabase(dpy->xdefaults); } if (!(xenv = getenv ("XENVIRONMENT"))) { const char *slashDotXdefaultsDash = "/.Xdefaults-"; int len; (void) GetHomeDir (fname, PATH_MAX - strlen (slashDotXdefaultsDash) - 1); (void) strcat (fname, slashDotXdefaultsDash); len = strlen (fname); (void) _XGetHostname (fname+len, PATH_MAX-len); xenv = fname; } userdb = XrmGetFileDatabase (xenv); XrmMergeDatabases (userdb, &xdb); return (xdb); #ifdef old if (fname[0] != '\0') userdb = XrmGetFileDatabase(fname); xdb = XrmGetStringDatabase(dpy->xdefaults); XrmMergeDatabases(userdb, &xdb); return xdb; #endif } char * XGetDefault( Display *dpy, /* display for defaults.... */ char _Xconst *prog, /* name of program for option */ register _Xconst char *name) /* name of option program wants */ { /* to get, for example, "font" */ XrmName names[3]; XrmClass classes[3]; XrmRepresentation fromType; XrmValue result; char *progname; #ifdef WIN32 char *progname2; #endif /* * strip path off of program name (XXX - this is OS specific) */ progname = strrchr (prog, '/'); #ifdef WIN32 progname2 = strrchr (prog, '\\'); if (progname2 && (!progname || progname < progname2)) progname = progname2; #endif if (progname) progname++; else progname = (char *)prog; /* * see if database has ever been initialized. Lookups can be done * without locks held. */ LockDisplay(dpy); if (dpy->db == NULL) { dpy->db = InitDefaults(dpy); dpy->flags |= XlibDisplayDfltRMDB; } UnlockDisplay(dpy); names[0] = XrmStringToName(progname); names[1] = XrmStringToName(name); names[2] = NULLQUARK; classes[0] = XrmStringToClass("Program"); classes[1] = XrmStringToClass("Name"); classes[2] = NULLQUARK; (void)XrmQGetResource(dpy->db, names, classes, &fromType, &result); return (result.addr); } nx-libs-3.5.99.23/nx-X11/lib/src/GetEventData.c0000644000000000000000000000260213614532331015317 0ustar /* * Copyright © 2009 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Bool XGetEventData(Display *dpy, XGenericEventCookie *event) { Bool rc; LockDisplay(dpy); rc = _XFetchEventCookie(dpy, event); UnlockDisplay(dpy); return rc; } nx-libs-3.5.99.23/nx-X11/lib/src/GetFPath.c0000644000000000000000000000534713614532331014457 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include char **XGetFontPath( register Display *dpy, int *npaths) /* RETURN */ { xGetFontPathReply rep; unsigned long nbytes = 0; char **flist = NULL; char *ch = NULL; char *chend; int count = 0; register unsigned i; register int length; _X_UNUSED register xReq *req; LockDisplay(dpy); GetEmptyReq (GetFontPath, req); (void) _XReply (dpy, (xReply *) &rep, 0, xFalse); if (rep.nPaths) { flist = Xmalloc(rep.nPaths * sizeof (char *)); if (rep.length < (INT_MAX >> 2)) { nbytes = (unsigned long) rep.length << 2; ch = Xmalloc (nbytes + 1); /* +1 to leave room for last null-terminator */ } if ((! flist) || (! ch)) { Xfree(flist); Xfree(ch); _XEatDataWords(dpy, rep.length); UnlockDisplay(dpy); SyncHandle(); return (char **) NULL; } _XReadPad (dpy, ch, nbytes); /* * unpack into null terminated strings. */ chend = ch + nbytes; length = *(unsigned char *)ch; for (i = 0; i < rep.nPaths; i++) { if (ch + length < chend) { flist[i] = ch+1; /* skip over length */ ch += length + 1; /* find next length ... */ length = *(unsigned char *)ch; *ch = '\0'; /* and replace with null-termination */ count++; } else if (i == 0) { Xfree(flist); Xfree(ch); flist = NULL; break; } else flist[i] = NULL; } } *npaths = count; UnlockDisplay(dpy); SyncHandle(); return (flist); } int XFreeFontPath (char **list) { if (list != NULL) { Xfree (list[0]-1); Xfree (list); } return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/GetFProp.c0000644000000000000000000000332613614532331014476 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Bool XGetFontProperty( XFontStruct *fs, register Atom name, unsigned long *valuePtr) { /* XXX this is a simple linear search for now. If the protocol is changed to sort the property list, this should become a binary search. */ register XFontProp *prop = fs->properties; register XFontProp *last = prop + fs->n_properties; while (prop != last) { if (prop->name == name) { *valuePtr = prop->card32; return (1); } prop++; } return (0); } nx-libs-3.5.99.23/nx-X11/lib/src/GetGCVals.c0000644000000000000000000000741113614532331014566 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* * All gc fields except GCClipMask and GCDashList */ #define ValidGCValuesBits (GCFunction | GCPlaneMask | GCForeground | \ GCBackground | GCLineWidth | GCLineStyle | \ GCCapStyle | GCJoinStyle | GCFillStyle | \ GCFillRule | GCTile | GCStipple | \ GCTileStipXOrigin | GCTileStipYOrigin | \ GCFont | GCSubwindowMode | GCGraphicsExposures | \ GCClipXOrigin | GCClipYOrigin | GCDashOffset | \ GCArcMode) /*ARGSUSED*/ Status XGetGCValues ( Display *dpy, GC gc, unsigned long valuemask, XGCValues *values) { if (valuemask == ValidGCValuesBits) { char dashes = values->dashes; Pixmap clip_mask = values->clip_mask; *values = gc->values; values->dashes = dashes; values->clip_mask = clip_mask; return True; } if (valuemask & ~ValidGCValuesBits) return False; if (valuemask & GCFunction) values->function = gc->values.function; if (valuemask & GCPlaneMask) values->plane_mask = gc->values.plane_mask; if (valuemask & GCForeground) values->foreground = gc->values.foreground; if (valuemask & GCBackground) values->background = gc->values.background; if (valuemask & GCLineWidth) values->line_width = gc->values.line_width; if (valuemask & GCLineStyle) values->line_style = gc->values.line_style; if (valuemask & GCCapStyle) values->cap_style = gc->values.cap_style; if (valuemask & GCJoinStyle) values->join_style = gc->values.join_style; if (valuemask & GCFillStyle) values->fill_style = gc->values.fill_style; if (valuemask & GCFillRule) values->fill_rule = gc->values.fill_rule; if (valuemask & GCTile) values->tile = gc->values.tile; if (valuemask & GCStipple) values->stipple = gc->values.stipple; if (valuemask & GCTileStipXOrigin) values->ts_x_origin = gc->values.ts_x_origin; if (valuemask & GCTileStipYOrigin) values->ts_y_origin = gc->values.ts_y_origin; if (valuemask & GCFont) values->font = gc->values.font; if (valuemask & GCSubwindowMode) values->subwindow_mode = gc->values.subwindow_mode; if (valuemask & GCGraphicsExposures) values->graphics_exposures = gc->values.graphics_exposures; if (valuemask & GCClipXOrigin) values->clip_x_origin = gc->values.clip_x_origin; if (valuemask & GCClipYOrigin) values->clip_y_origin = gc->values.clip_y_origin; if (valuemask & GCDashOffset) values->dash_offset = gc->values.dash_offset; if (valuemask & GCArcMode) values->arc_mode = gc->values.arc_mode; return True; } nx-libs-3.5.99.23/nx-X11/lib/src/GetGeom.c0000644000000000000000000000363613614532331014343 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Status XGetGeometry ( register Display *dpy, Drawable d, Window *root, /* RETURN */ int *x, int *y, /* RETURN */ unsigned int *width, unsigned int *height, unsigned int *borderWidth, unsigned int *depth) /* RETURN */ { xGetGeometryReply rep; register xResourceReq *req; LockDisplay(dpy); GetResReq(GetGeometry, d, req); if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) { UnlockDisplay(dpy); SyncHandle(); return (0); } *root = rep.root; *x = cvtINT16toInt (rep.x); *y = cvtINT16toInt (rep.y); *width = rep.width; *height = rep.height; *borderWidth = rep.borderWidth; *depth = rep.depth; UnlockDisplay(dpy); SyncHandle(); return (1); } nx-libs-3.5.99.23/nx-X11/lib/src/GetHColor.c0000644000000000000000000000340113614532331014630 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Status XAllocColor( register Display *dpy, Colormap cmap, XColor *def) { Status status; xAllocColorReply rep; register xAllocColorReq *req; LockDisplay(dpy); GetReq(AllocColor, req); req->cmap = cmap; req->red = def->red; req->green = def->green; req->blue = def->blue; status = _XReply(dpy, (xReply *) &rep, 0, xTrue); if (status) { def->pixel = rep.pixel; def->red = rep.red; def->green = rep.green; def->blue = rep.blue; } UnlockDisplay(dpy); SyncHandle(); return(status); } nx-libs-3.5.99.23/nx-X11/lib/src/GetHints.c0000644000000000000000000002317513614532331014541 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "Xatomtype.h" #include #include Status XGetSizeHints ( Display *dpy, Window w, XSizeHints *hints, Atom property) { xPropSizeHints *prop = NULL; Atom actual_type; int actual_format; unsigned long leftover; unsigned long nitems; if (XGetWindowProperty(dpy, w, property, 0L, (long) OldNumPropSizeElements, False, XA_WM_SIZE_HINTS, &actual_type, &actual_format, &nitems, &leftover, (unsigned char **)&prop) != Success) return (0); if ((actual_type != XA_WM_SIZE_HINTS) || (nitems < OldNumPropSizeElements) || (actual_format != 32)) { Xfree (prop); return(0); } hints->flags = (prop->flags & (USPosition|USSize|PAllHints)); hints->x = cvtINT32toInt (prop->x); hints->y = cvtINT32toInt (prop->y); hints->width = cvtINT32toInt (prop->width); hints->height = cvtINT32toInt (prop->height); hints->min_width = cvtINT32toInt (prop->minWidth); hints->min_height = cvtINT32toInt (prop->minHeight); hints->max_width = cvtINT32toInt (prop->maxWidth); hints->max_height = cvtINT32toInt (prop->maxHeight); hints->width_inc = cvtINT32toInt (prop->widthInc); hints->height_inc = cvtINT32toInt (prop->heightInc); hints->min_aspect.x = cvtINT32toInt (prop->minAspectX); hints->min_aspect.y = cvtINT32toInt (prop->minAspectY); hints->max_aspect.x = cvtINT32toInt (prop->maxAspectX); hints->max_aspect.y = cvtINT32toInt (prop->maxAspectY); Xfree(prop); return(1); } /* * must return a pointer to the hint, in malloc'd memory, or routine is not * extensible; any use of the caller's memory would cause things to be stepped * on. */ XWMHints *XGetWMHints ( Display *dpy, Window w) { xPropWMHints *prop = NULL; register XWMHints *hints; Atom actual_type; int actual_format; unsigned long leftover; unsigned long nitems; if (XGetWindowProperty(dpy, w, XA_WM_HINTS, 0L, (long)NumPropWMHintsElements, False, XA_WM_HINTS, &actual_type, &actual_format, &nitems, &leftover, (unsigned char **)&prop) != Success) return (NULL); /* If the property is undefined on the window, return null pointer. */ /* pre-R3 bogusly truncated window_group, don't fail on them */ if ((actual_type != XA_WM_HINTS) || (nitems < (NumPropWMHintsElements - 1)) || (actual_format != 32)) { Xfree (prop); return(NULL); } /* static copies not allowed in library, due to reentrancy constraint*/ if ((hints = Xcalloc (1, sizeof(XWMHints)))) { hints->flags = prop->flags; hints->input = (prop->input ? True : False); hints->initial_state = cvtINT32toInt (prop->initialState); hints->icon_pixmap = prop->iconPixmap; hints->icon_window = prop->iconWindow; hints->icon_x = cvtINT32toInt (prop->iconX); hints->icon_y = cvtINT32toInt (prop->iconY); hints->icon_mask = prop->iconMask; if (nitems >= NumPropWMHintsElements) hints->window_group = prop->windowGroup; else hints->window_group = 0; } Xfree (prop); return(hints); } Status XGetZoomHints ( Display *dpy, Window w, XSizeHints *zhints) { return (XGetSizeHints(dpy, w, zhints, XA_WM_ZOOM_HINTS)); } Status XGetNormalHints ( Display *dpy, Window w, XSizeHints *hints) { return (XGetSizeHints(dpy, w, hints, XA_WM_NORMAL_HINTS)); } /* * XGetIconSizes reads the property * ICONSIZE_ATOM type: ICONSIZE_ATOM format: 32 */ Status XGetIconSizes ( Display *dpy, Window w, /* typically, root */ XIconSize **size_list, /* RETURN */ int *count) /* RETURN number of items on the list */ { xPropIconSize *prop = NULL; register xPropIconSize *pp; register XIconSize *hp, *hints; Atom actual_type; int actual_format; unsigned long leftover; unsigned long nitems; register int i; if (XGetWindowProperty(dpy, w, XA_WM_ICON_SIZE, 0L, 60L, False, XA_WM_ICON_SIZE, &actual_type, &actual_format, &nitems, &leftover, (unsigned char **)&prop) != Success) return (0); pp = prop; if ((actual_type != XA_WM_ICON_SIZE) || (nitems < NumPropIconSizeElements) || (nitems % NumPropIconSizeElements != 0) || (actual_format != 32)) { Xfree (prop); return(0); } /* static copies not allowed in library, due to reentrancy constraint*/ nitems /= NumPropIconSizeElements; if (! (hp = hints = Xcalloc (nitems, sizeof(XIconSize)))) { Xfree (prop); return 0; } /* march down array putting things into native form */ for (i = 0; i < nitems; i++) { hp->min_width = cvtINT32toInt (pp->minWidth); hp->min_height = cvtINT32toInt (pp->minHeight); hp->max_width = cvtINT32toInt (pp->maxWidth); hp->max_height = cvtINT32toInt (pp->maxHeight); hp->width_inc = cvtINT32toInt (pp->widthInc); hp->height_inc = cvtINT32toInt (pp->heightInc); hp += 1; pp += 1; } *count = nitems; *size_list = hints; Xfree (prop); return(1); } Status XGetCommand ( Display *dpy, Window w, char ***argvp, int *argcp) { XTextProperty tp; int argc; char **argv; if (!XGetTextProperty (dpy, w, &tp, XA_WM_COMMAND)) return 0; if (tp.encoding != XA_STRING || tp.format != 8) { Xfree (tp.value); return 0; } /* * ignore final if present since UNIX WM_COMMAND is nul-terminated */ if (tp.nitems && (tp.value[tp.nitems - 1] == '\0')) tp.nitems--; /* * create a string list and return if successful */ if (!XTextPropertyToStringList (&tp, &argv, &argc)) { Xfree (tp.value); return (0); } Xfree (tp.value); *argvp = argv; *argcp = argc; return 1; } Status XGetTransientForHint( Display *dpy, Window w, Window *propWindow) { Atom actual_type; int actual_format; unsigned long nitems; unsigned long leftover; Window *data = NULL; if (XGetWindowProperty(dpy, w, XA_WM_TRANSIENT_FOR, 0L, 1L, False, XA_WINDOW, &actual_type, &actual_format, &nitems, &leftover, (unsigned char **) &data) != Success) { *propWindow = None; return (0); } if ( (actual_type == XA_WINDOW) && (actual_format == 32) && (nitems != 0) ) { *propWindow = *data; Xfree( (char *) data); return (1); } *propWindow = None; Xfree( (char *) data); return(0); } Status XGetClassHint( Display *dpy, Window w, XClassHint *classhint) /* RETURN */ { int len_name, len_class; Atom actual_type; int actual_format; unsigned long nitems; unsigned long leftover; unsigned char *data = NULL; if (XGetWindowProperty(dpy, w, XA_WM_CLASS, 0L, (long)BUFSIZ, False, XA_STRING, &actual_type, &actual_format, &nitems, &leftover, &data) != Success) return (0); if ( (actual_type == XA_STRING) && (actual_format == 8) ) { len_name = strlen((char *) data); if (! (classhint->res_name = Xmalloc(len_name + 1))) { Xfree(data); return (0); } strcpy(classhint->res_name, (char *) data); if (len_name == nitems) len_name--; len_class = strlen((char *) (data+len_name+1)); if (! (classhint->res_class = Xmalloc(len_class + 1))) { Xfree(classhint->res_name); classhint->res_name = (char *) NULL; Xfree(data); return (0); } strcpy(classhint->res_class, (char *) (data+len_name+1)); Xfree( (char *) data); return(1); } Xfree( (char *) data); return(0); } nx-libs-3.5.99.23/nx-X11/lib/src/GetIFocus.c0000644000000000000000000000307213614532331014636 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XGetInputFocus( register Display *dpy, Window *focus, int *revert_to) { xGetInputFocusReply rep; _X_UNUSED register xReq *req; LockDisplay(dpy); GetEmptyReq(GetInputFocus, req); (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); *focus = rep.focus; *revert_to = rep.revertTo; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/GetImage.c0000644000000000000000000001013113614532331014462 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include /* for XDestroyImage */ #include "ImUtil.h" #include #define ROUNDUP(nbytes, pad) (((((nbytes) - 1) + (pad)) / (pad)) * (pad)) static unsigned int Ones( /* HACKMEM 169 */ unsigned long mask) { register unsigned long y; y = (mask >> 1) &033333333333; y = mask - y - ((y >>1) & 033333333333); return ((unsigned int) (((y + (y >> 3)) & 030707070707) % 077)); } XImage *XGetImage ( register Display *dpy, Drawable d, int x, int y, unsigned int width, unsigned int height, unsigned long plane_mask, int format) /* either XYPixmap or ZPixmap */ { xGetImageReply rep; register xGetImageReq *req; char *data; unsigned long nbytes; XImage *image; int planes; LockDisplay(dpy); GetReq (GetImage, req); /* * first set up the standard stuff in the request */ req->drawable = d; req->x = x; req->y = y; req->width = width; req->height = height; req->planeMask = plane_mask; req->format = format; if (_XReply (dpy, (xReply *) &rep, 0, xFalse) == 0 || rep.length == 0) { UnlockDisplay(dpy); SyncHandle(); return (XImage *)NULL; } if (rep.length < (INT_MAX >> 2)) { nbytes = (unsigned long)rep.length << 2; data = Xmalloc(nbytes); } else data = NULL; if (! data) { _XEatDataWords(dpy, rep.length); UnlockDisplay(dpy); SyncHandle(); return (XImage *) NULL; } _XReadPad (dpy, data, nbytes); if (format == XYPixmap) { image = XCreateImage(dpy, _XVIDtoVisual(dpy, rep.visual), Ones (plane_mask & (((unsigned long)0xFFFFFFFF) >> (32 - rep.depth))), format, 0, data, width, height, dpy->bitmap_pad, 0); planes = image->depth; } else { /* format == ZPixmap */ image = XCreateImage (dpy, _XVIDtoVisual(dpy, rep.visual), rep.depth, ZPixmap, 0, data, width, height, _XGetScanlinePad(dpy, (int) rep.depth), 0); planes = 1; } if (!image) { Xfree(data); } else { if (planes < 1 || image->height < 1 || image->bytes_per_line < 1 || INT_MAX / image->height <= image->bytes_per_line || INT_MAX / planes <= image->height * image->bytes_per_line || nbytes < planes * image->height * image->bytes_per_line) { XDestroyImage(image); image = NULL; } } UnlockDisplay(dpy); SyncHandle(); return (image); } XImage *XGetSubImage( register Display *dpy, Drawable d, int x, int y, unsigned int width, unsigned int height, unsigned long plane_mask, int format, /* either XYPixmap or ZPixmap */ XImage *dest_image, int dest_x, int dest_y) { XImage *temp_image; temp_image = XGetImage(dpy, d, x, y, width, height, plane_mask, format); if (!temp_image) return (XImage *)NULL; _XSetImage(temp_image, dest_image, dest_x, dest_y); XDestroyImage(temp_image); return (dest_image); } nx-libs-3.5.99.23/nx-X11/lib/src/GetKCnt.c0000644000000000000000000000363713614532331014314 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XGetKeyboardControl ( register Display *dpy, register XKeyboardState *state) { xGetKeyboardControlReply rep; _X_UNUSED register xReq *req; LockDisplay(dpy); GetEmptyReq (GetKeyboardControl, req); (void) _XReply (dpy, (xReply *) &rep, (SIZEOF(xGetKeyboardControlReply) - SIZEOF(xReply)) >> 2, xTrue); state->key_click_percent = rep.keyClickPercent; state->bell_percent = rep.bellPercent; state->bell_pitch = rep.bellPitch; state->bell_duration = rep.bellDuration; state->led_mask = rep.ledMask; state->global_auto_repeat = rep.globalAutoRepeat; memcpy (state->auto_repeats, rep.map, sizeof state->auto_repeats); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/GetMoEv.c0000644000000000000000000000456513614532331014324 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include XTimeCoord *XGetMotionEvents( register Display *dpy, Window w, Time start, Time stop, int *nEvents) /* RETURN */ { xGetMotionEventsReply rep; register xGetMotionEventsReq *req; XTimeCoord *tc = NULL; LockDisplay(dpy); GetReq(GetMotionEvents, req); req->window = w; /* XXX is this right for all machines? */ req->start = start; req->stop = stop; if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return (NULL); } if (rep.nEvents && (rep.nEvents < (INT_MAX / sizeof(XTimeCoord)))) tc = Xmalloc(rep.nEvents * sizeof(XTimeCoord)); if (tc == NULL) { /* server returned either no events or a bad event count */ *nEvents = 0; _XEatDataWords (dpy, rep.length); } else { register XTimeCoord *tcptr; unsigned int i; xTimecoord xtc; *nEvents = (int) rep.nEvents; for (i = rep.nEvents, tcptr = tc; i > 0; i--, tcptr++) { _XRead (dpy, (char *) &xtc, SIZEOF (xTimecoord)); tcptr->time = xtc.time; tcptr->x = cvtINT16toShort (xtc.x); tcptr->y = cvtINT16toShort (xtc.y); } } UnlockDisplay(dpy); SyncHandle(); return (tc); } nx-libs-3.5.99.23/nx-X11/lib/src/GetNrmHint.c0000644000000000000000000001077613614532331015036 0ustar /*********************************************************** Copyright 1988 by Wyse Technology, Inc., San Jose, Ca, Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL AND WYSE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL OR WYSE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* Copyright 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Xatomtype.h" #include #include Status XGetWMSizeHints ( Display *dpy, Window w, XSizeHints *hints, long *supplied, Atom property) { xPropSizeHints *prop = NULL; Atom actual_type; int actual_format; unsigned long leftover; unsigned long nitems; if (XGetWindowProperty (dpy, w, property, 0L, (long)NumPropSizeElements, False, XA_WM_SIZE_HINTS, &actual_type, &actual_format, &nitems, &leftover, (unsigned char **)&prop) != Success) return False; if ((actual_type != XA_WM_SIZE_HINTS) || (nitems < OldNumPropSizeElements) || (actual_format != 32)) { Xfree (prop); return False; } hints->flags = prop->flags; /* XSizeHints misdeclares these as int instead of long */ hints->x = cvtINT32toInt (prop->x); hints->y = cvtINT32toInt (prop->y); hints->width = cvtINT32toInt (prop->width); hints->height = cvtINT32toInt (prop->height); hints->min_width = cvtINT32toInt (prop->minWidth); hints->min_height = cvtINT32toInt (prop->minHeight); hints->max_width = cvtINT32toInt (prop->maxWidth); hints->max_height = cvtINT32toInt (prop->maxHeight); hints->width_inc = cvtINT32toInt (prop->widthInc); hints->height_inc = cvtINT32toInt (prop->heightInc); hints->min_aspect.x = cvtINT32toInt (prop->minAspectX); hints->min_aspect.y = cvtINT32toInt (prop->minAspectY); hints->max_aspect.x = cvtINT32toInt (prop->maxAspectX); hints->max_aspect.y = cvtINT32toInt (prop->maxAspectY); *supplied = (USPosition | USSize | PAllHints); if (nitems >= NumPropSizeElements) { hints->base_width= cvtINT32toInt (prop->baseWidth); hints->base_height= cvtINT32toInt (prop->baseHeight); hints->win_gravity= cvtINT32toInt (prop->winGravity); *supplied |= (PBaseSize | PWinGravity); } hints->flags &= (*supplied); /* get rid of unwanted bits */ Xfree(prop); return True; } Status XGetWMNormalHints ( Display *dpy, Window w, XSizeHints *hints, long *supplied) { return (XGetWMSizeHints (dpy, w, hints, supplied, XA_WM_NORMAL_HINTS)); } nx-libs-3.5.99.23/nx-X11/lib/src/GetPCnt.c0000644000000000000000000000327613614532331014320 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XGetPointerControl( register Display *dpy, /* the following are return only vars */ int *accel_numer, int *accel_denom, int *threshold) { xGetPointerControlReply rep; _X_UNUSED xReq *req; LockDisplay(dpy); GetEmptyReq(GetPointerControl, req); (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); *accel_numer = rep.accelNumerator; *accel_denom = rep.accelDenominator; *threshold = rep.threshold; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/GetPntMap.c0000644000000000000000000000676013614532331014654 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #ifdef MIN /* some systems define this in */ #undef MIN #endif #define MIN(a, b) ((a) < (b) ? (a) : (b)) int XGetPointerMapping ( register Display *dpy, unsigned char *map, /* RETURN */ int nmaps) { unsigned char mapping[256]; /* known fixed size */ unsigned long nbytes, remainder = 0; xGetPointerMappingReply rep; _X_UNUSED register xReq *req; LockDisplay(dpy); GetEmptyReq(GetPointerMapping, req); if (! _XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return 0; } /* Don't count on the server returning a valid value */ if (rep.length >= (INT_MAX >> 2)) { _XEatDataWords(dpy, rep.length); UnlockDisplay(dpy); SyncHandle(); return 0; } nbytes = (unsigned long) rep.length << 2; if (nbytes > sizeof mapping) { remainder = nbytes - sizeof mapping; nbytes = sizeof mapping; } _XRead (dpy, (char *)mapping, nbytes); /* don't return more data than the user asked for. */ if (rep.nElts) { memcpy ((char *) map, (char *) mapping, MIN((int)rep.nElts, nmaps) ); } if (remainder) _XEatData(dpy, remainder); UnlockDisplay(dpy); SyncHandle(); return ((int) rep.nElts); } KeySym * XGetKeyboardMapping (Display *dpy, #if NeedWidePrototypes unsigned int first_keycode, #else KeyCode first_keycode, #endif int count, int *keysyms_per_keycode) { unsigned long nbytes; CARD32 nkeysyms; register KeySym *mapping = NULL; xGetKeyboardMappingReply rep; register xGetKeyboardMappingReq *req; LockDisplay(dpy); GetReq(GetKeyboardMapping, req); req->firstKeyCode = first_keycode; req->count = count; if (! _XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return (KeySym *) NULL; } nkeysyms = rep.length; if (nkeysyms > 0) { if (nkeysyms < (INT_MAX / sizeof (KeySym))) { nbytes = nkeysyms * sizeof (KeySym); mapping = Xmalloc (nbytes); } if (! mapping) { _XEatDataWords(dpy, rep.length); UnlockDisplay(dpy); SyncHandle(); return (KeySym *) NULL; } nbytes = nkeysyms << 2; _XRead32 (dpy, (long *) mapping, nbytes); } *keysyms_per_keycode = rep.keySymsPerKeyCode; UnlockDisplay(dpy); SyncHandle(); return (mapping); } nx-libs-3.5.99.23/nx-X11/lib/src/GetProp.c0000644000000000000000000001054413614532331014370 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include int XGetWindowProperty( register Display *dpy, Window w, Atom property, long offset, long length, Bool delete, Atom req_type, Atom *actual_type, /* RETURN */ int *actual_format, /* RETURN 8, 16, or 32 */ unsigned long *nitems, /* RETURN # of 8-, 16-, or 32-bit entities */ unsigned long *bytesafter, /* RETURN */ unsigned char **prop) /* RETURN */ { xGetPropertyReply reply; register xGetPropertyReq *req; xError error = {0}; /* Always initialize return values, in case callers fail to initialize them and fail to check the return code for an error. */ *actual_type = None; *actual_format = 0; *nitems = *bytesafter = 0L; *prop = (unsigned char *) NULL; LockDisplay(dpy); GetReq (GetProperty, req); req->window = w; req->property = property; req->type = req_type; req->delete = delete; req->longOffset = offset; req->longLength = length; error.sequenceNumber = dpy->request; if (!_XReply (dpy, (xReply *) &reply, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return (1); /* not Success */ } if (reply.propertyType != None) { unsigned long nbytes, netbytes; int format = reply.format; /* * Protect against both integer overflow and just plain oversized * memory allocation - no server should ever return this many props. */ if (reply.nItems >= (INT_MAX >> 4)) format = -1; /* fall through to default error case */ switch (format) { /* * One extra byte is malloced than is needed to contain the property * data, but this last byte is null terminated and convenient for * returning string properties, so the client doesn't then have to * recopy the string to make it null terminated. */ case 8: nbytes = netbytes = reply.nItems; if (nbytes + 1 > 0 && (*prop = Xmalloc (nbytes + 1))) _XReadPad (dpy, (char *) *prop, netbytes); break; case 16: nbytes = reply.nItems * sizeof (short); netbytes = reply.nItems << 1; if (nbytes + 1 > 0 && (*prop = Xmalloc (nbytes + 1))) _XRead16Pad (dpy, (short *) *prop, netbytes); break; case 32: nbytes = reply.nItems * sizeof (long); netbytes = reply.nItems << 2; if (nbytes + 1 > 0 && (*prop = Xmalloc (nbytes + 1))) _XRead32 (dpy, (long *) *prop, netbytes); break; default: /* * This part of the code should never be reached. If it is, * the server sent back a property with an invalid format. * This is a BadImplementation error. */ { /* sequence number stored above */ error.type = X_Error; error.majorCode = X_GetProperty; error.minorCode = 0; error.errorCode = BadImplementation; _XError(dpy, &error); } nbytes = netbytes = 0L; break; } if (! *prop) { _XEatDataWords(dpy, reply.length); UnlockDisplay(dpy); SyncHandle(); return(BadAlloc); /* not Success */ } (*prop)[nbytes] = '\0'; } *actual_type = reply.propertyType; *actual_format = reply.format; *nitems = reply.nItems; *bytesafter = reply.bytesAfter; UnlockDisplay(dpy); SyncHandle(); return(Success); } nx-libs-3.5.99.23/nx-X11/lib/src/GetRGBCMap.c0000644000000000000000000000775513614532331014635 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Xatomtype.h" #include Status XGetRGBColormaps ( Display *dpy, Window w, XStandardColormap **stdcmap, /* RETURN */ int *count, /* RETURN */ Atom property) /* XA_RGB_BEST_MAP, etc. */ { register int i; /* iterator variable */ xPropStandardColormap *data = NULL; /* data read in from prop */ Atom actual_type; /* how the prop was actually stored */ int actual_format; /* ditto */ unsigned long leftover; /* how much was left over */ unsigned long nitems; /* number of 32bits read */ int ncmaps; /* number of structs this makes */ Bool old_style = False; /* if was too short */ VisualID def_visual = None; /* visual to use if prop too short */ XStandardColormap *cmaps; /* return value */ if (XGetWindowProperty (dpy, w, property, 0L, 1000000L, False, XA_RGB_COLOR_MAP, &actual_type, &actual_format, &nitems, &leftover, (unsigned char **)&data) != Success) return False; /* if wrong type or format, or too small for us, then punt */ if ((actual_type != XA_RGB_COLOR_MAP) || (actual_format != 32) || (nitems < OldNumPropStandardColormapElements)) { Xfree (data); return False; } /* * See how many properties were found; if pre-ICCCM then assume * default visual and a kill id of 1. */ if (nitems < NumPropStandardColormapElements) { ncmaps = 1; old_style = True; if (nitems < (NumPropStandardColormapElements - 1)) { Screen *sp = _XScreenOfWindow (dpy, w); if (!sp) { Xfree (data); return False; } def_visual = sp->root_visual->visualid; } } else { /* * make sure we have an integral number of colormaps */ ncmaps = (nitems / NumPropStandardColormapElements); if ((((unsigned long) ncmaps) * NumPropStandardColormapElements) != nitems) { Xfree (data); return False; } } /* * allocate array */ cmaps = Xmalloc (ncmaps * sizeof (XStandardColormap)); if (!cmaps) { Xfree (data); return False; } /* * and fill it in, handling compatibility with pre-ICCCM short stdcmaps */ { register XStandardColormap *map; register xPropStandardColormap *prop; for (i = ncmaps, map = cmaps, prop = data; i > 0; i--, map++, prop++) { map->colormap = prop->colormap; map->red_max = prop->red_max; map->red_mult = prop->red_mult; map->green_max = prop->green_max; map->green_mult = prop->green_mult; map->blue_max = prop->blue_max; map->blue_mult = prop->blue_mult; map->base_pixel = prop->base_pixel; map->visualid = (def_visual ? def_visual : prop->visualid); map->killid = (old_style ? None : prop->killid); } } Xfree (data); *stdcmap = cmaps; *count = ncmaps; return True; } nx-libs-3.5.99.23/nx-X11/lib/src/GetSOwner.c0000644000000000000000000000303713614532331014664 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Window XGetSelectionOwner( register Display *dpy, Atom selection) { xGetSelectionOwnerReply rep; register xResourceReq *req; LockDisplay(dpy); GetResReq(GetSelectionOwner, selection, req); if (_XReply(dpy, (xReply *)&rep, 0, xTrue) == 0) rep.owner = None; UnlockDisplay(dpy); SyncHandle(); return(rep.owner); } nx-libs-3.5.99.23/nx-X11/lib/src/GetSSaver.c0000644000000000000000000000337413614532331014656 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XGetScreenSaver( register Display *dpy, /* the following are return only vars */ int *timeout, int *interval, int *prefer_blanking, int *allow_exp) /*boolean */ { xGetScreenSaverReply rep; _X_UNUSED register xReq *req; LockDisplay(dpy); GetEmptyReq(GetScreenSaver, req); (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); *timeout = rep.timeout; *interval = rep.interval; *prefer_blanking = rep.preferBlanking; *allow_exp = rep.allowExposures; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/GetStCmap.c0000644000000000000000000000737513614532331014647 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Xatomtype.h" #include /* * WARNING * * This is a pre-ICCCM routine. It must not reference any of the new fields * in the XStandardColormap structure. */ Status XGetStandardColormap ( Display *dpy, Window w, XStandardColormap *cmap, Atom property) /* XA_RGB_BEST_MAP, etc. */ { Status stat; /* return value */ XStandardColormap *stdcmaps; /* will get malloced value */ int nstdcmaps; /* count of above */ stat = XGetRGBColormaps (dpy, w, &stdcmaps, &nstdcmaps, property); if (stat) { XStandardColormap *use; if (nstdcmaps > 1) { VisualID vid; Screen *sp = _XScreenOfWindow (dpy, w); int i; if (!sp) { Xfree (stdcmaps); return False; } vid = sp->root_visual->visualid; for (i = 0; i < nstdcmaps; i++) { if (stdcmaps[i].visualid == vid) break; } if (i == nstdcmaps) { /* not found */ Xfree (stdcmaps); return False; } use = &stdcmaps[i]; } else { use = stdcmaps; } /* * assign only those fields which were in the pre-ICCCM version */ cmap->colormap = use->colormap; cmap->red_max = use->red_max; cmap->red_mult = use->red_mult; cmap->green_max = use->green_max; cmap->green_mult = use->green_mult; cmap->blue_max = use->blue_max; cmap->blue_mult = use->blue_mult; cmap->base_pixel = use->base_pixel; Xfree (stdcmaps); /* don't need alloced memory */ } return stat; } nx-libs-3.5.99.23/nx-X11/lib/src/GetTxtProp.c0000644000000000000000000000674413614532331015077 0ustar /*********************************************************** Copyright 1988 by Wyse Technology, Inc., San Jose, Ca., All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name Wyse not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include Status XGetTextProperty ( Display *display, Window window, XTextProperty *tp, Atom property) { Atom actual_type; int actual_format = 0; unsigned long nitems = 0L, leftover = 0L; unsigned char *prop = NULL; if (XGetWindowProperty (display, window, property, 0L, 1000000L, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &leftover, &prop) == Success && actual_type != None) { /* okay, fill it in */ tp->value = prop; tp->encoding = actual_type; tp->format = actual_format; tp->nitems = nitems; return True; } tp->value = NULL; tp->encoding = None; tp->format = 0; tp->nitems = 0; return False; } Status XGetWMName ( Display *dpy, Window w, XTextProperty *tp) { return (XGetTextProperty (dpy, w, tp, XA_WM_NAME)); } Status XGetWMIconName ( Display *dpy, Window w, XTextProperty *tp) { return (XGetTextProperty (dpy, w, tp, XA_WM_ICON_NAME)); } Status XGetWMClientMachine ( Display *dpy, Window w, XTextProperty *tp) { return (XGetTextProperty (dpy, w, tp, XA_WM_CLIENT_MACHINE)); } nx-libs-3.5.99.23/nx-X11/lib/src/GetWAttrs.c0000644000000000000000000001052313614532331014671 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" typedef struct _WAttrsState { unsigned long attr_seq; unsigned long geom_seq; XWindowAttributes *attr; } _XWAttrsState; static Bool _XWAttrsHandler( register Display *dpy, register xReply *rep, char *buf, int len, XPointer data) { register _XWAttrsState *state; xGetWindowAttributesReply replbuf; register xGetWindowAttributesReply *repl; register XWindowAttributes *attr; state = (_XWAttrsState *)data; if (dpy->last_request_read != state->attr_seq) { if (dpy->last_request_read == state->geom_seq && !state->attr && rep->generic.type == X_Error && rep->error.errorCode == BadDrawable) return True; return False; } if (rep->generic.type == X_Error) { state->attr = (XWindowAttributes *)NULL; return False; } repl = (xGetWindowAttributesReply *) _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, (SIZEOF(xGetWindowAttributesReply) - SIZEOF(xReply)) >> 2, True); attr = state->attr; attr->class = repl->class; attr->bit_gravity = repl->bitGravity; attr->win_gravity = repl->winGravity; attr->backing_store = repl->backingStore; attr->backing_planes = repl->backingBitPlanes; attr->backing_pixel = repl->backingPixel; attr->save_under = repl->saveUnder; attr->colormap = repl->colormap; attr->map_installed = repl->mapInstalled; attr->map_state = repl->mapState; attr->all_event_masks = repl->allEventMasks; attr->your_event_mask = repl->yourEventMask; attr->do_not_propagate_mask = repl->doNotPropagateMask; attr->override_redirect = repl->override; attr->visual = _XVIDtoVisual (dpy, repl->visualID); return True; } Status _XGetWindowAttributes( register Display *dpy, Window w, XWindowAttributes *attr) { xGetGeometryReply rep; register xResourceReq *req; register int i; register Screen *sp; _XAsyncHandler async; _XWAttrsState async_state; GetResReq(GetWindowAttributes, w, req); async_state.attr_seq = dpy->request; async_state.geom_seq = 0; async_state.attr = attr; async.next = dpy->async_handlers; async.handler = _XWAttrsHandler; async.data = (XPointer)&async_state; dpy->async_handlers = &async; GetResReq(GetGeometry, w, req); async_state.geom_seq = dpy->request; if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) { DeqAsyncHandler(dpy, &async); return (0); } DeqAsyncHandler(dpy, &async); if (!async_state.attr) { return (0); } attr->x = cvtINT16toInt (rep.x); attr->y = cvtINT16toInt (rep.y); attr->width = rep.width; attr->height = rep.height; attr->border_width = rep.borderWidth; attr->depth = rep.depth; attr->root = rep.root; /* find correct screen so that applications find it easier.... */ for (i = 0; i < dpy->nscreens; i++) { sp = &dpy->screens[i]; if (sp->root == attr->root) { attr->screen = sp; break; } } return(1); } Status XGetWindowAttributes( Display *dpy, Window w, XWindowAttributes *attr) { Status ret; LockDisplay(dpy); ret = _XGetWindowAttributes(dpy, w, attr); UnlockDisplay(dpy); SyncHandle(); return ret; } nx-libs-3.5.99.23/nx-X11/lib/src/GetWMCMapW.c0000644000000000000000000000612613614532331014664 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include Status XGetWMColormapWindows ( Display *dpy, Window w, Window **colormapWindows, int *countReturn) { Atom *data = NULL; Atom actual_type; Atom prop; int actual_format; unsigned long leftover, nitems; prop = XInternAtom(dpy, "WM_COLORMAP_WINDOWS", False); if (prop == None) return False; /* get the property */ if (XGetWindowProperty (dpy, w, prop, 0L, 1000000L, False, XA_WINDOW, &actual_type, &actual_format, &nitems, &leftover, (unsigned char **) &data) != Success) return False; if (actual_type != XA_WINDOW || actual_format != 32) { Xfree (data); return False; } *colormapWindows = (Window *) data; *countReturn = (int) nitems; return True; } nx-libs-3.5.99.23/nx-X11/lib/src/GetWMProto.c0000644000000000000000000000605613614532331015022 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include Status XGetWMProtocols ( Display *dpy, Window w, Atom **protocols, int *countReturn) { Atom *data = NULL; Atom actual_type; Atom prop; int actual_format; unsigned long leftover, nitems; prop = XInternAtom(dpy, "WM_PROTOCOLS", False); if (prop == None) return False; /* get the property */ if (XGetWindowProperty (dpy, w, prop, 0L, 1000000L, False, XA_ATOM, &actual_type, &actual_format, &nitems, &leftover, (unsigned char **) &data) != Success) return False; if (actual_type != XA_ATOM || actual_format != 32) { Xfree (data); return False; } *protocols = (Atom *) data; *countReturn = (int) nitems; return True; } nx-libs-3.5.99.23/nx-X11/lib/src/globals.c0000644000000000000000000000605213614532331014432 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * * Global data * * This file should contain only those objects which must be predefined. */ #ifdef HAVE_CONFIG_H #include #endif #include /* * If possible, it is useful to have the global data default to a null value. * Some shared library implementations are *much* happier if there isn't any * global initialized data. */ #ifdef NULL_NOT_ZERO /* then need to initialize */ #define SetZero(t,var,z) t var = z #else #define SetZero(t,var,z) t var #endif #ifdef USL_SHAREDLIB /* then need extra variables */ /* * If we need to define extra variables for each global */ #define ZEROINIT(t,var,val) SetZero(t,var,val); \ SetZero (long, _libX_##var##Flag, 0); \ SetZero (void *, _libX_##var##Ptr, NULL) #else /* else not USL_SHAREDLIB */ /* * no extra crud */ #define ZEROINIT(t,var,val) SetZero (t, var, val) #endif /* USL_SHAREDLIB */ /* * Error handlers; used to be in XlibInt.c */ ZEROINIT (XErrorHandler, _XErrorFunction, NULL); ZEROINIT (XIOErrorHandler, _XIOErrorFunction, NULL); ZEROINIT (_XQEvent *, _qfree, NULL); /* * Debugging information and display list; used to be in XOpenDis.c */ ZEROINIT (int, _Xdebug, 0); ZEROINIT (Display *, _XHeadOfDisplayList, NULL); #ifdef XTEST1 /* * Stuff for input synthesis extension: */ /* * Holds the two event type codes for this extension. The event type codes * for this extension may vary depending on how many extensions are installed * already, so the initial values given below will be added to the base event * code that is aquired when this extension is installed. * * These two variables must be available to programs that use this extension. */ int XTestInputActionType = 0; int XTestFakeAckType = 1; #endif /* * NOTE: any additional external definition NEED * to be inserted BELOW this point!!! */ /* * NOTE: any additional external definition NEED * to be inserted ABOVE this point!!! */ nx-libs-3.5.99.23/nx-X11/lib/src/GrButton.c0000644000000000000000000000364013614532331014553 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XGrabButton( register Display *dpy, unsigned int button, /* CARD8 */ unsigned int modifiers, /* CARD16 */ Window grab_window, Bool owner_events, unsigned int event_mask, /* CARD16 */ int pointer_mode, int keyboard_mode, Window confine_to, Cursor curs) { register xGrabButtonReq *req; LockDisplay(dpy); GetReq(GrabButton, req); req->modifiers = modifiers; req->button = button; req->grabWindow = grab_window; req->ownerEvents = owner_events; req->eventMask = event_mask; req->pointerMode = pointer_mode; req->keyboardMode = keyboard_mode; req->confineTo = confine_to; req->cursor = curs; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/GrKeybd.c0000644000000000000000000000350513614532331014336 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XGrabKeyboard ( register Display *dpy, Window window, Bool ownerEvents, int pointerMode, int keyboardMode, Time time) { xGrabKeyboardReply rep; register xGrabKeyboardReq *req; register int status; LockDisplay(dpy); GetReq(GrabKeyboard, req); req->grabWindow = window; req->ownerEvents = ownerEvents; req->pointerMode = pointerMode; req->keyboardMode = keyboardMode; req->time = time; /* if we ever return, suppress the error */ if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) rep.status = GrabSuccess; status = rep.status; UnlockDisplay(dpy); SyncHandle(); return (status); } nx-libs-3.5.99.23/nx-X11/lib/src/GrKey.c0000644000000000000000000000330413614532331014025 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XGrabKey( register Display *dpy, int key, unsigned int modifiers, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode) { register xGrabKeyReq *req; LockDisplay(dpy); GetReq(GrabKey, req); req->ownerEvents = owner_events; req->grabWindow = grab_window; req->modifiers = modifiers; req->key = key; req->pointerMode = pointer_mode; req->keyboardMode = keyboard_mode; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/GrPointer.c0000644000000000000000000000402713614532331014720 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XGrabPointer( register Display *dpy, Window grab_window, Bool owner_events, unsigned int event_mask, /* CARD16 */ int pointer_mode, int keyboard_mode, Window confine_to, Cursor curs, Time time) { xGrabPointerReply rep; register xGrabPointerReq *req; register int status; LockDisplay(dpy); GetReq(GrabPointer, req); req->grabWindow = grab_window; req->ownerEvents = owner_events; req->eventMask = event_mask; req->pointerMode = pointer_mode; req->keyboardMode = keyboard_mode; req->confineTo = confine_to; req->cursor = curs; req->time = time; /* if we ever return, suppress the error */ if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) rep.status = GrabSuccess; status = rep.status; UnlockDisplay(dpy); SyncHandle(); return (status); } nx-libs-3.5.99.23/nx-X11/lib/src/GrServer.c0000644000000000000000000000256313614532331014551 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XGrabServer (register Display *dpy) { _X_UNUSED register xReq *req; LockDisplay(dpy); GetEmptyReq(GrabServer, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/Host.c0000644000000000000000000001061613614532331013725 0ustar /* Copyright 1986, 1998 The Open Group All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. X Window System is a trademark of The Open Group. */ /* * Copyright 2004 Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /* this might be rightly regarded an os dependent file */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" static inline int changehost (Display *dpy, XHostAddress *host, BYTE mode) { xChangeHostsReq *req; int length; XServerInterpretedAddress *siAddr; int addrlen; siAddr = host->family == FamilyServerInterpreted ? (XServerInterpretedAddress *)host->address : NULL; addrlen = siAddr ? siAddr->typelength + siAddr->valuelength + 1 : host->length; length = (addrlen + 3) & ~0x3; /* round up */ LockDisplay(dpy); GetReqExtra (ChangeHosts, length, req); if (!req) { UnlockDisplay(dpy); return 0; } req->mode = mode; req->hostFamily = host->family; req->hostLength = addrlen; if (siAddr) { char *dest = (char *) NEXTPTR(req,xChangeHostsReq); memcpy(dest, siAddr->type, siAddr->typelength); dest[siAddr->typelength] = '\0'; memcpy(dest + siAddr->typelength + 1,siAddr->value,siAddr->valuelength); } else { memcpy((char *) NEXTPTR(req,xChangeHostsReq), host->address, addrlen); } UnlockDisplay(dpy); SyncHandle(); return 1; } int XAddHost ( register Display *dpy, XHostAddress *host) { return changehost(dpy, host, HostInsert); } int XRemoveHost ( register Display *dpy, XHostAddress *host) { return changehost(dpy, host, HostDelete); } int XAddHosts ( register Display *dpy, XHostAddress *hosts, int n) { register int i; for (i = 0; i < n; i++) { (void) XAddHost(dpy, &hosts[i]); } return 1; } int XRemoveHosts ( register Display *dpy, XHostAddress *hosts, int n) { register int i; for (i = 0; i < n; i++) { (void) XRemoveHost(dpy, &hosts[i]); } return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/Iconify.c0000644000000000000000000000613713614532331014413 0ustar /*********************************************************** Copyright 1988 by Wyse Technology, Inc., San Jose, Ca. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name Wyse not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include /* * This function instructs the window manager to change this window from * NormalState to IconicState. */ Status XIconifyWindow ( Display *dpy, Window w, int screen) { Atom prop; prop = XInternAtom (dpy, "WM_CHANGE_STATE", False); if (prop == None) return False; else { XClientMessageEvent ev = { .type = ClientMessage, .window = w, .message_type = prop, .format = 32, .data.l[0] = IconicState }; Window root = RootWindow (dpy, screen); return (XSendEvent (dpy, root, False, SubstructureRedirectMask|SubstructureNotifyMask, (XEvent *)&ev)); } } nx-libs-3.5.99.23/nx-X11/lib/src/IfEvent.c0000644000000000000000000000440313614532331014345 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* * Flush output and (wait for and) return the next event matching the * predicate in the queue. */ int XIfEvent ( register Display *dpy, register XEvent *event, Bool (*predicate)( Display* /* display */, XEvent* /* event */, char* /* arg */ ), /* function to call */ char *arg) { register _XQEvent *qelt, *prev; unsigned long qe_serial = 0; LockDisplay(dpy); prev = NULL; while (1) { for (qelt = prev ? prev->next : dpy->head; qelt; prev = qelt, qelt = qelt->next) { if(qelt->qserial_num > qe_serial && (*predicate)(dpy, &qelt->event, arg)) { *event = qelt->event; _XDeq(dpy, prev, qelt); _XStoreEventCookie(dpy, event); UnlockDisplay(dpy); return 0; } } if (prev) qe_serial = prev->qserial_num; _XReadEvents(dpy); if (prev && prev->qserial_num != qe_serial) /* another thread has snatched this event */ prev = NULL; #ifdef NX_TRANS_SOCKET if (_XGetIOError(dpy)) { UnlockDisplay(dpy); return 0; } #endif } } nx-libs-3.5.99.23/nx-X11/lib/src/imConv.c0000644000000000000000000002371513614532331014247 0ustar /****************************************************************** Copyright 1991, 1992 by Fuji Xerox Co.,Ltd. Copyright 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Fuji Xerox Co.,Ltd. , and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Fuji Xerox Co.,Ltd. , and FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJI XEROX CO.,LTD. AND FUJITSU LIMITED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJI XEROX CO.,LTD. AND FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Auther: Kazunori Nishihara, Fuji Xerox Co.,Ltd. kaz@ssdev.ksp.fujixerox.co.jp Modifier: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ /* 2000 Modifier: Ivan Pascal The XFree86 Project. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" #include "XlcPubI.h" #ifdef XKB /* * rather than just call _XLookupString (i.e. the pre-XKB XLookupString) * do this because with XKB the event may have some funky modifiers that * _XLookupString doesn't grok. */ #include "XKBlib.h" #define XLOOKUPSTRING lookup_string #else #define XLOOKUPSTRING XLookupString #endif typedef unsigned int ucs4_t; typedef int (*ucstocsConvProc)( XPointer, unsigned char *, ucs4_t, int ); struct SubstRec { const char encoding_name[8]; const char charset_name[12]; }; static const struct SubstRec SubstTable[] = { {"STRING", "ISO8859-1"}, {"TIS620", "TIS620-0"}, {"UTF-8", "ISO10646-1"} }; #define num_substitute (sizeof SubstTable / sizeof SubstTable[0]) /* * Given the name of a charset, returns the pointer to convertors * from UCS char to specified charset char. * This converter is needed for _XimGetCharCode subroutine. */ XPointer _XimGetLocaleCode ( _Xconst char* encoding_name) { XPointer cvt = _Utf8GetConvByName(encoding_name); if (!cvt && encoding_name) { int i; for (i = 0; i < num_substitute; i++) if (!strcmp(encoding_name, SubstTable[i].encoding_name)) return _Utf8GetConvByName(SubstTable[i].charset_name); } return cvt; } /* * Returns the locale dependent representation of a keysym. * The locale's encoding is passed in form of pointer to UCS convertor. * The resulting multi-byte sequence is placed starting at buf (a buffer * with nbytes bytes, nbytes should be >= 8) and is NUL terminated. * Returns the length of the resulting multi-byte sequence, excluding the * terminating NUL byte. Return 0 if the keysym is not representable in the * locale */ /*ARGSUSED*/ int _XimGetCharCode ( XPointer ucs_conv, KeySym keysym, unsigned char* buf, int nbytes) { int count = 0; ucstocsConvProc cvt = (ucstocsConvProc) ucs_conv; ucs4_t ucs4; if (keysym < 0x80) { buf[0] = (char) keysym; count = 1; } else if (cvt) { ucs4 = KeySymToUcs4(keysym); if (ucs4) count = (*cvt)((XPointer)NULL, buf, ucs4, nbytes); } if (count < 0) count = 0; if (count>nbytes) return nbytes; if (countdisplay); XkbSetXlibControls (event->display, XkbLC_ForceLatin1Lookup, XkbLC_ForceLatin1Lookup); ret = XLookupString(event, (char *)buffer, nbytes, keysym, status); XkbSetXlibControls (event->display, XkbLC_ForceLatin1Lookup, ctrls); return ret; } #endif #define BUF_SIZE (20) int _XimLookupMBText( Xic ic, XKeyEvent* event, char* buffer, int nbytes, KeySym* keysym, XComposeStatus* status) { int count; KeySym symbol; Status dummy; Xim im = (Xim)ic->core.im; XimCommonPrivateRec* private = &im->private.common; unsigned char look[BUF_SIZE]; ucs4_t ucs4; /* force a latin-1 lookup for compatibility */ count = XLOOKUPSTRING(event, (char *)buffer, nbytes, &symbol, status); if (keysym != NULL) *keysym = symbol; if ((nbytes == 0) || (symbol == NoSymbol)) return count; if (count > 1) { memcpy(look, (char *)buffer,count); look[count] = '\0'; if ((count = im->methods->ctstombs(ic->core.im, (char*) look, count, buffer, nbytes, &dummy)) < 0) { count = 0; } } else if ((count == 0) || (count == 1 && (symbol > 0x7f && symbol < 0xff00))) { XPointer from = (XPointer) &ucs4; XPointer to = (XPointer) look; int from_len = 1; int to_len = BUF_SIZE; XPointer args[1]; XlcCharSet charset; args[0] = (XPointer) &charset; ucs4 = (ucs4_t) KeySymToUcs4(symbol); if (!ucs4) return 0; if (_XlcConvert(private->ucstoc_conv, &from, &from_len, &to, &to_len, args, 1 ) != 0) { count = 0; } else { from = (XPointer) look; to = (XPointer) buffer; from_len = BUF_SIZE - to_len; to_len = nbytes; args[0] = (XPointer) charset; if (_XlcConvert(private->cstomb_conv, &from, &from_len, &to, &to_len, args, 1 ) != 0) { count = 0; } else { count = nbytes - to_len; } } } /* FIXME: * we should make sure that if the character is a Latin1 character * and it's on the right side, and we're in a non-Latin1 locale * that this is a valid Latin1 character for this locale. */ return count; } int _XimLookupWCText( Xic ic, XKeyEvent* event, wchar_t* buffer, int nbytes, KeySym* keysym, XComposeStatus* status) { int count; KeySym symbol; Status dummy; Xim im = (Xim)ic->core.im; XimCommonPrivateRec* private = &im->private.common; unsigned char look[BUF_SIZE]; ucs4_t ucs4; /* force a latin-1 lookup for compatibility */ count = XLOOKUPSTRING(event, (char *)look, nbytes, &symbol, status); if (keysym != NULL) *keysym = symbol; if ((nbytes == 0) || (symbol == NoSymbol)) return count; if (count > 1) { if ((count = im->methods->ctstowcs(ic->core.im, (char*) look, count, buffer, nbytes, &dummy)) < 0) { count = 0; } } else if ((count == 0) || (count == 1 && (symbol > 0x7f && symbol < 0xff00))) { XPointer from = (XPointer) &ucs4; XPointer to = (XPointer) look; int from_len = 1; int to_len = BUF_SIZE; XPointer args[1]; XlcCharSet charset; args[0] = (XPointer) &charset; ucs4 = (ucs4_t) KeySymToUcs4(symbol); if (!ucs4) return 0; if (_XlcConvert(private->ucstoc_conv, &from, &from_len, &to, &to_len, args, 1 ) != 0) { count = 0; } else { from = (XPointer) look; to = (XPointer) buffer; from_len = BUF_SIZE - to_len; to_len = nbytes; args[0] = (XPointer) charset; if (_XlcConvert(private->cstowc_conv, &from, &from_len, &to, &to_len, args, 1 ) != 0) { count = 0; } else { count = nbytes - to_len; } } } else /* FIXME: * we should make sure that if the character is a Latin1 character * and it's on the right side, and we're in a non-Latin1 locale * that this is a valid Latin1 character for this locale. */ buffer[0] = look[0]; return count; } int _XimLookupUTF8Text( Xic ic, XKeyEvent* event, char* buffer, int nbytes, KeySym* keysym, XComposeStatus* status) { int count; KeySym symbol; Status dummy; Xim im = (Xim)ic->core.im; XimCommonPrivateRec* private = &im->private.common; unsigned char look[BUF_SIZE]; ucs4_t ucs4; /* force a latin-1 lookup for compatibility */ count = XLOOKUPSTRING(event, (char *)buffer, nbytes, &symbol, status); if (keysym != NULL) *keysym = symbol; if ((nbytes == 0) || (symbol == NoSymbol)) return count; if (count > 1) { memcpy(look, (char *)buffer,count); look[count] = '\0'; if ((count = im->methods->ctstoutf8(ic->core.im, (char*) look, count, buffer, nbytes, &dummy)) < 0) { count = 0; } } else if ((count == 0) || (count == 1 && (symbol > 0x7f && symbol < 0xff00))) { XPointer from = (XPointer) &ucs4; int from_len = 1; XPointer to = (XPointer) buffer; int to_len = nbytes; ucs4 = (ucs4_t) KeySymToUcs4(symbol); if (!ucs4) return 0; if (_XlcConvert(private->ucstoutf8_conv, &from, &from_len, &to, &to_len, NULL, 0) != 0) { count = 0; } else { count = nbytes - to_len; } } /* FIXME: * we should make sure that if the character is a Latin1 character * and it's on the right side, and we're in a non-Latin1 locale * that this is a valid Latin1 character for this locale. */ return count; } nx-libs-3.5.99.23/nx-X11/lib/src/ImText16.c0000644000000000000000000000521613614532331014371 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDrawImageString16( register Display *dpy, Drawable d, GC gc, int x, int y, _Xconst XChar2b *string, int length) { register xImageText16Req *req; XChar2b *CharacterOffset = (XChar2b *)string; int FirstTimeThrough = True; int lastX = 0; LockDisplay(dpy); FlushGC(dpy, gc); while (length > 0) { int Unit, Datalength; if (length > 255) Unit = 255; else Unit = length; if (FirstTimeThrough) { FirstTimeThrough = False; } else { char buf[512]; xQueryTextExtentsReq *qreq; xQueryTextExtentsReply rep; unsigned char *ptr; XChar2b *str; int i; GetReq(QueryTextExtents, qreq); qreq->fid = gc->gid; qreq->length += (510 + 3)>>2; qreq->oddLength = 1; str = CharacterOffset - 255; for (ptr = (unsigned char *)buf, i = 255; --i >= 0; str++) { *ptr++ = str->byte1; *ptr++ = str->byte2; } Data (dpy, buf, 510); if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) break; x = lastX + cvtINT32toInt (rep.overallWidth); } GetReq (ImageText16, req); req->length += ((Unit << 1) + 3) >> 2; req->nChars = Unit; req->drawable = d; req->gc = gc->gid; req->y = y; lastX = req->x = x; Datalength = Unit << 1; Data (dpy, (char *)CharacterOffset, (long)Datalength); CharacterOffset += Unit; length -= Unit; } UnlockDisplay(dpy); SyncHandle(); return 0; } nx-libs-3.5.99.23/nx-X11/lib/src/ImText.c0000644000000000000000000000501613614532331014220 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDrawImageString( register Display *dpy, Drawable d, GC gc, int x, int y, _Xconst char *string, int length) { register xImageText8Req *req; char *CharacterOffset = (char *)string; int FirstTimeThrough = True; int lastX = 0; LockDisplay(dpy); FlushGC(dpy, gc); while (length > 0) { int Unit; if (length > 255) Unit = 255; else Unit = length; if (FirstTimeThrough) { FirstTimeThrough = False; } else { char buf[512]; char *ptr, *str; xQueryTextExtentsReq *qreq; xQueryTextExtentsReply rep; int i; GetReq(QueryTextExtents, qreq); qreq->fid = gc->gid; qreq->length += (510 + 3)>>2; qreq->oddLength = 1; str = CharacterOffset - 255; for (ptr = buf, i = 255; --i >= 0; ) { *ptr++ = 0; *ptr++ = *str++; } Data (dpy, buf, 510); if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) break; x = lastX + cvtINT32toInt (rep.overallWidth); } GetReq (ImageText8, req); req->length += (Unit + 3) >> 2; req->nChars = Unit; req->drawable = d; req->gc = gc->gid; req->y = y; lastX = req->x = x; Data (dpy, CharacterOffset, (long)Unit); CharacterOffset += Unit; length -= Unit; } UnlockDisplay(dpy); SyncHandle(); return 0; } nx-libs-3.5.99.23/nx-X11/lib/src/ImUtil.c0000644000000000000000000007063213614532331014217 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "ImUtil.h" static int _XDestroyImage(XImage *); static unsigned long _XGetPixel(XImage *, int, int); static unsigned long _XGetPixel1(XImage *, int, int); static unsigned long _XGetPixel8(XImage *, int, int); static unsigned long _XGetPixel16(XImage *, int, int); static unsigned long _XGetPixel32(XImage *, int, int); static int _XPutPixel(XImage *, int, int, unsigned long); static int _XPutPixel1(XImage *, int, int, unsigned long); static int _XPutPixel8(XImage *, int, int, unsigned long); static int _XPutPixel16(XImage *, int, int, unsigned long); static int _XPutPixel32(XImage *, int, int, unsigned long); static XImage *_XSubImage(XImage *, int, int, unsigned int, unsigned int); static int _XAddPixel(XImage *, long); static unsigned char const _lomask[0x09] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; static unsigned char const _himask[0x09] = { 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00 }; /* These two convenience routines return the scanline_pad and bits_per_pixel associated with a specific depth of ZPixmap format image for a display. */ int _XGetScanlinePad( Display *dpy, int depth) { register ScreenFormat *fmt = dpy->pixmap_format; register int i; for (i = dpy->nformats + 1; --i; ++fmt) if (fmt->depth == depth) return(fmt->scanline_pad); return(dpy->bitmap_pad); } int _XGetBitsPerPixel( Display *dpy, int depth) { register ScreenFormat *fmt = dpy->pixmap_format; register int i; for (i = dpy->nformats + 1; --i; ++fmt) if (fmt->depth == depth) return(fmt->bits_per_pixel); if (depth <= 4) return 4; if (depth <= 8) return 8; if (depth <= 16) return 16; return 32; } /* * This module provides rudimentary manipulation routines for image data * structures. The functions provided are: * * XCreateImage Creates a default XImage data structure * _XDestroyImage Deletes an XImage data structure * _XGetPixel Reads a pixel from an image data structure * _XGetPixel32 Reads a pixel from a 32-bit Z image data structure * _XGetPixel16 Reads a pixel from a 16-bit Z image data structure * _XGetPixel8 Reads a pixel from an 8-bit Z image data structure * _XGetPixel1 Reads a pixel from an 1-bit image data structure * _XPutPixel Writes a pixel into an image data structure * _XPutPixel32 Writes a pixel into a 32-bit Z image data structure * _XPutPixel16 Writes a pixel into a 16-bit Z image data structure * _XPutPixel8 Writes a pixel into an 8-bit Z image data structure * _XPutPixel1 Writes a pixel into an 1-bit image data structure * _XSubImage Clones a new (sub)image from an existing one * _XSetImage Writes an image data pattern into another image * _XAddPixel Adds a constant value to every pixel in an image * * The logic contained in these routines makes several assumptions about * the image data structures, and at least for current implementations * these assumptions are believed to be true. They are: * * For all formats, bits_per_pixel is less than or equal to 32. * For XY formats, bitmap_unit is always less than or equal to bitmap_pad. * For XY formats, bitmap_unit is 8, 16, or 32 bits. * For Z format, bits_per_pixel is 1, 4, 8, 16, 24, or 32 bits. */ static void _xynormalizeimagebits ( register unsigned char *bp, register XImage *img) { register unsigned char c; if (img->byte_order != img->bitmap_bit_order) { switch (img->bitmap_unit) { case 16: c = *bp; *bp = *(bp + 1); *(bp + 1) = c; break; case 32: c = *(bp + 3); *(bp + 3) = *bp; *bp = c; c = *(bp + 2); *(bp + 2) = *(bp + 1); *(bp + 1) = c; break; } } if (img->bitmap_bit_order == MSBFirst) _XReverse_Bytes (bp, img->bitmap_unit >> 3); } static void _znormalizeimagebits ( register unsigned char *bp, register XImage *img) { register unsigned char c; switch (img->bits_per_pixel) { case 4: *bp = ((*bp >> 4) & 0xF) | ((*bp << 4) & ~0xF); break; case 16: c = *bp; *bp = *(bp + 1); *(bp + 1) = c; break; case 24: c = *(bp + 2); *(bp + 2) = *bp; *bp = c; break; case 32: c = *(bp + 3); *(bp + 3) = *bp; *bp = c; c = *(bp + 2); *(bp + 2) = *(bp + 1); *(bp + 1) = c; break; } } static void _putbits( register char *src, /* address of source bit string */ int dstoffset, /* bit offset into destination; range is 0-31 */ register int numbits,/* number of bits to copy to destination */ register char *dst) /* address of destination bit string */ { register unsigned char chlo, chhi; int hibits; dst = dst + (dstoffset >> 3); dstoffset = dstoffset & 7; hibits = 8 - dstoffset; chlo = *dst & _lomask[dstoffset]; for (;;) { chhi = (*src << dstoffset) & _himask[dstoffset]; if (numbits <= hibits) { chhi = chhi & _lomask[dstoffset + numbits]; *dst = (*dst & _himask[dstoffset + numbits]) | chlo | chhi; break; } *dst = chhi | chlo; dst++; numbits = numbits - hibits; chlo = (unsigned char) (*src & _himask[hibits]) >> hibits; src++; if (numbits <= dstoffset) { chlo = chlo & _lomask[numbits]; *dst = (*dst & _himask[numbits]) | chlo; break; } numbits = numbits - dstoffset; } } /* * Macros * * The ROUNDUP macro rounds up a quantity to the specified boundary, * then truncates to bytes. * * The XYNORMALIZE macro determines whether XY format data requires * normalization and calls a routine to do so if needed. The logic in * this module is designed for LSBFirst byte and bit order, so * normalization is done as required to present the data in this order. * * The ZNORMALIZE macro performs byte and nibble order normalization if * required for Z format data. * * The XYINDEX macro computes the index to the starting byte (char) boundary * for a bitmap_unit containing a pixel with coordinates x and y for image * data in XY format. * * The ZINDEX macro computes the index to the starting byte (char) boundary * for a pixel with coordinates x and y for image data in ZPixmap format. * */ #define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3)) #define XYNORMALIZE(bp, img) \ if ((img->byte_order == MSBFirst) || (img->bitmap_bit_order == MSBFirst)) \ _xynormalizeimagebits((unsigned char *)(bp), img) #define ZNORMALIZE(bp, img) \ if (img->byte_order == MSBFirst) \ _znormalizeimagebits((unsigned char *)(bp), img) #define XYINDEX(x, y, img) \ ((y) * img->bytes_per_line) + \ (((x) + img->xoffset) / img->bitmap_unit) * (img->bitmap_unit >> 3) #define ZINDEX(x, y, img) ((y) * img->bytes_per_line) + \ (((x) * img->bits_per_pixel) >> 3) /* * This routine initializes the image object function pointers. The * intent is to provide native (i.e. fast) routines for native format images * only using the generic (i.e. slow) routines when fast ones don't exist. * However, with the current rather botched external interface, clients may * have to mung image attributes after the image gets created, so the fast * routines always have to check to make sure the optimization is still * valid, and reinit the functions if not. */ void _XInitImageFuncPtrs ( register XImage *image) { image->f.create_image = XCreateImage; image->f.destroy_image = _XDestroyImage; if ((image->format == ZPixmap) && (image->bits_per_pixel == 8)) { image->f.get_pixel = _XGetPixel8; image->f.put_pixel = _XPutPixel8; } else if (((image->bits_per_pixel | image->depth) == 1) && (image->byte_order == image->bitmap_bit_order)) { image->f.get_pixel = _XGetPixel1; image->f.put_pixel = _XPutPixel1; } else if ((image->format == ZPixmap) && (image->bits_per_pixel == 32)) { image->f.get_pixel = _XGetPixel32; image->f.put_pixel = _XPutPixel32; } else if ((image->format == ZPixmap) && (image->bits_per_pixel == 16)) { image->f.get_pixel = _XGetPixel16; image->f.put_pixel = _XPutPixel16; } else { image->f.get_pixel = _XGetPixel; image->f.put_pixel = _XPutPixel; } image->f.sub_image = _XSubImage; /* image->f.set_image = _XSetImage;*/ image->f.add_pixel = _XAddPixel; } /* * CreateImage * * Allocates the memory necessary for an XImage data structure. * Initializes the structure with "default" values and returns XImage. * */ XImage *XCreateImage ( register Display *dpy, register Visual *visual, unsigned int depth, int format, int offset, /*How many pixels from the start of the data does the picture to be transmitted start?*/ char *data, unsigned int width, unsigned int height, int xpad, int image_bytes_per_line) /*How many bytes between a pixel on one line and the pixel with the same X coordinate on the next line? 0 means XCreateImage can calculate it.*/ { register XImage *image; int bits_per_pixel = 1; int min_bytes_per_line; if (depth == 0 || depth > 32 || (format != XYBitmap && format != XYPixmap && format != ZPixmap) || (format == XYBitmap && depth != 1) || (xpad != 8 && xpad != 16 && xpad != 32) || offset < 0) return (XImage *) NULL; if ((image = Xcalloc(1, sizeof(XImage))) == NULL) return (XImage *) NULL; image->width = width; image->height = height; image->format = format; image->byte_order = dpy->byte_order; image->bitmap_unit = dpy->bitmap_unit; image->bitmap_bit_order = dpy->bitmap_bit_order; if (visual != NULL) { image->red_mask = visual->red_mask; image->green_mask = visual->green_mask; image->blue_mask = visual->blue_mask; } else { image->red_mask = image->green_mask = image->blue_mask = 0; } if (format == ZPixmap) { bits_per_pixel = _XGetBitsPerPixel(dpy, (int) depth); } image->xoffset = offset; image->bitmap_pad = xpad; image->depth = depth; image->data = data; /* * compute per line accelerator. */ { if (format == ZPixmap) min_bytes_per_line = ROUNDUP((bits_per_pixel * width), image->bitmap_pad); else min_bytes_per_line = ROUNDUP((width + offset), image->bitmap_pad); } if (image_bytes_per_line == 0) { image->bytes_per_line = min_bytes_per_line; } else if (image_bytes_per_line < min_bytes_per_line) { Xfree(image); return NULL; } else { image->bytes_per_line = image_bytes_per_line; } image->bits_per_pixel = bits_per_pixel; image->obdata = NULL; _XInitImageFuncPtrs (image); return image; } Status XInitImage (XImage *image) { int min_bytes_per_line; if (image->depth == 0 || image->depth > 32 || image->bits_per_pixel > 32 || image->bitmap_unit > 32 || image->bits_per_pixel < 0 || image->bitmap_unit < 0 || (image->format != XYBitmap && image->format != XYPixmap && image->format != ZPixmap) || (image->format == XYBitmap && image->depth != 1) || (image->bitmap_pad != 8 && image->bitmap_pad != 16 && image->bitmap_pad != 32) || image->xoffset < 0) return 0; /* * compute per line accelerator. */ if (image->format == ZPixmap) min_bytes_per_line = ROUNDUP((image->bits_per_pixel * image->width), image->bitmap_pad); else min_bytes_per_line = ROUNDUP((image->width + image->xoffset), image->bitmap_pad); if (image->bytes_per_line == 0) { image->bytes_per_line = min_bytes_per_line; } else if (image->bytes_per_line < min_bytes_per_line) { return 0; } _XInitImageFuncPtrs (image); return 1; } /* * _DestroyImage * * Deallocates the memory associated with the ximage data structure. * this version handles the case of the image data being malloc'd * entirely by the library. */ static int _XDestroyImage (XImage *ximage) { Xfree(ximage->data); Xfree(ximage->obdata); Xfree(ximage); return 1; } /* * GetPixel * * Returns the specified pixel. The X and Y coordinates are relative to * the origin (upper left [0,0]) of the image. The pixel value is returned * in normalized format, i.e. the LSB of the long is the LSB of the pixel. * The algorithm used is: * * copy the source bitmap_unit or Zpixel into temp * normalize temp if needed * extract the pixel bits into return value * */ static unsigned long const low_bits_table[] = { 0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff }; static unsigned long _XGetPixel ( register XImage *ximage, int x, int y) { unsigned long pixel, px; register char *src; register char *dst; register int i, j; int bits, nbytes; long plane; if ((ximage->bits_per_pixel | ximage->depth) == 1) { src = &ximage->data[XYINDEX(x, y, ximage)]; dst = (char *)&pixel; pixel = 0; for (i = ximage->bitmap_unit >> 3; --i >= 0; ) *dst++ = *src++; XYNORMALIZE(&pixel, ximage); bits = (x + ximage->xoffset) % ximage->bitmap_unit; pixel = ((((char *)&pixel)[bits>>3])>>(bits&7)) & 1; } else if (ximage->format == XYPixmap) { pixel = 0; plane = 0; nbytes = ximage->bitmap_unit >> 3; for (i = ximage->depth; --i >= 0; ) { src = &ximage->data[XYINDEX(x, y, ximage)+ plane]; dst = (char *)&px; px = 0; for (j = nbytes; --j >= 0; ) *dst++ = *src++; XYNORMALIZE(&px, ximage); bits = (x + ximage->xoffset) % ximage->bitmap_unit; pixel = (pixel << 1) | (((((char *)&px)[bits>>3])>>(bits&7)) & 1); plane = plane + (ximage->bytes_per_line * ximage->height); } } else if (ximage->format == ZPixmap) { src = &ximage->data[ZINDEX(x, y, ximage)]; dst = (char *)&px; px = 0; for (i = (ximage->bits_per_pixel + 7) >> 3; --i >= 0; ) *dst++ = *src++; ZNORMALIZE(&px, ximage); pixel = 0; for (i=sizeof(unsigned long); --i >= 0; ) pixel = (pixel << 8) | ((unsigned char *)&px)[i]; if (ximage->bits_per_pixel == 4) { if (x & 1) pixel >>= 4; else pixel &= 0xf; } } else { return 0; /* bad image */ } if (ximage->bits_per_pixel == ximage->depth) return pixel; else return (pixel & low_bits_table[ximage->depth]); } static CARD32 const byteorderpixel = MSBFirst << 24; static unsigned long _XGetPixel32 ( register XImage *ximage, int x, int y) { register unsigned char *addr; unsigned long pixel; if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 32)) { addr = &((unsigned char *)ximage->data) [y * ximage->bytes_per_line + (x << 2)]; if (*((const char *)&byteorderpixel) == ximage->byte_order) pixel = *((CARD32 *)addr); else if (ximage->byte_order == MSBFirst) pixel = ((unsigned long)addr[0] << 24 | (unsigned long)addr[1] << 16 | (unsigned long)addr[2] << 8 | addr[3]); else pixel = ((unsigned long)addr[3] << 24 | (unsigned long)addr[2] << 16 | (unsigned long)addr[1] << 8 | addr[0]); if (ximage->depth != 32) pixel &= low_bits_table[ximage->depth]; return pixel; } else { _XInitImageFuncPtrs(ximage); return XGetPixel(ximage, x, y); } } static unsigned long _XGetPixel16 ( register XImage *ximage, int x, int y) { register unsigned char *addr; unsigned long pixel; if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 16)) { addr = &((unsigned char *)ximage->data) [y * ximage->bytes_per_line + (x << 1)]; if (ximage->byte_order == MSBFirst) pixel = addr[0] << 8 | addr[1]; else pixel = addr[1] << 8 | addr[0]; if (ximage->depth != 16) pixel &= low_bits_table[ximage->depth]; return pixel; } else { _XInitImageFuncPtrs(ximage); return XGetPixel(ximage, x, y); } } static unsigned long _XGetPixel8 ( register XImage *ximage, int x, int y) { unsigned char pixel; if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 8)) { pixel = ((unsigned char *)ximage->data) [y * ximage->bytes_per_line + x]; if (ximage->depth != 8) pixel &= low_bits_table[ximage->depth]; return pixel; } else { _XInitImageFuncPtrs(ximage); return XGetPixel(ximage, x, y); } } static unsigned long _XGetPixel1 ( register XImage *ximage, int x, int y) { unsigned char bit; int xoff, yoff; if (((ximage->bits_per_pixel | ximage->depth) == 1) && (ximage->byte_order == ximage->bitmap_bit_order)) { xoff = x + ximage->xoffset; yoff = y * ximage->bytes_per_line + (xoff >> 3); xoff &= 7; if (ximage->bitmap_bit_order == MSBFirst) bit = 0x80 >> xoff; else bit = 1 << xoff; return (ximage->data[yoff] & bit) ? 1 : 0; } else { _XInitImageFuncPtrs(ximage); return XGetPixel(ximage, x, y); } } /* * PutPixel * * Overwrites the specified pixel. The X and Y coordinates are relative to * the origin (upper left [0,0]) of the image. The input pixel value must be * in normalized format, i.e. the LSB of the long is the LSB of the pixel. * The algorithm used is: * * copy the destination bitmap_unit or Zpixel to temp * normalize temp if needed * copy the pixel bits into the temp * renormalize temp if needed * copy the temp back into the destination image data * */ static int _XPutPixel ( register XImage *ximage, int x, int y, unsigned long pixel) { unsigned long px, npixel; register char *src; register char *dst; register int i; int j, nbytes; long plane; if (ximage->depth == 4) pixel &= 0xf; npixel = pixel; for (i=0, px=pixel; i>=8) ((unsigned char *)&pixel)[i] = px; if ((ximage->bits_per_pixel | ximage->depth) == 1) { src = &ximage->data[XYINDEX(x, y, ximage)]; dst = (char *)&px; px = 0; nbytes = ximage->bitmap_unit >> 3; for (i = nbytes; --i >= 0; ) *dst++ = *src++; XYNORMALIZE(&px, ximage); i = ((x + ximage->xoffset) % ximage->bitmap_unit); _putbits ((char *)&pixel, i, 1, (char *)&px); XYNORMALIZE(&px, ximage); src = (char *) &px; dst = &ximage->data[XYINDEX(x, y, ximage)]; for (i = nbytes; --i >= 0; ) *dst++ = *src++; } else if (ximage->format == XYPixmap) { plane = (ximage->bytes_per_line * ximage->height) * (ximage->depth - 1); /* do least signif plane 1st */ nbytes = ximage->bitmap_unit >> 3; for (j = ximage->depth; --j >= 0; ) { src = &ximage->data[XYINDEX(x, y, ximage) + plane]; dst = (char *) &px; px = 0; for (i = nbytes; --i >= 0; ) *dst++ = *src++; XYNORMALIZE(&px, ximage); i = ((x + ximage->xoffset) % ximage->bitmap_unit); _putbits ((char *)&pixel, i, 1, (char *)&px); XYNORMALIZE(&px, ximage); src = (char *)&px; dst = &ximage->data[XYINDEX(x, y, ximage) + plane]; for (i = nbytes; --i >= 0; ) *dst++ = *src++; npixel = npixel >> 1; for (i=0, px=npixel; i>=8) ((unsigned char *)&pixel)[i] = px; plane = plane - (ximage->bytes_per_line * ximage->height); } } else if (ximage->format == ZPixmap) { src = &ximage->data[ZINDEX(x, y, ximage)]; dst = (char *)&px; px = 0; nbytes = (ximage->bits_per_pixel + 7) >> 3; for (i = nbytes; --i >= 0; ) *dst++ = *src++; ZNORMALIZE(&px, ximage); _putbits ((char *)&pixel, (x * ximage->bits_per_pixel) & 7, ximage->bits_per_pixel, (char *)&px); ZNORMALIZE(&px, ximage); src = (char *)&px; dst = &ximage->data[ZINDEX(x, y, ximage)]; for (i = nbytes; --i >= 0; ) *dst++ = *src++; } else { return 0; /* bad image */ } return 1; } static int _XPutPixel32 ( register XImage *ximage, int x, int y, unsigned long pixel) { unsigned char *addr; if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 32)) { addr = &((unsigned char *)ximage->data) [y * ximage->bytes_per_line + (x << 2)]; if (*((const char *)&byteorderpixel) == ximage->byte_order) *((CARD32 *)addr) = pixel; else if (ximage->byte_order == MSBFirst) { addr[0] = pixel >> 24; addr[1] = pixel >> 16; addr[2] = pixel >> 8; addr[3] = pixel; } else { addr[3] = pixel >> 24; addr[2] = pixel >> 16; addr[1] = pixel >> 8; addr[0] = pixel; } return 1; } else { _XInitImageFuncPtrs(ximage); return XPutPixel(ximage, x, y, pixel); } } static int _XPutPixel16 ( register XImage *ximage, int x, int y, unsigned long pixel) { unsigned char *addr; if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 16)) { addr = &((unsigned char *)ximage->data) [y * ximage->bytes_per_line + (x << 1)]; if (ximage->byte_order == MSBFirst) { addr[0] = pixel >> 8; addr[1] = pixel; } else { addr[1] = pixel >> 8; addr[0] = pixel; } return 1; } else { _XInitImageFuncPtrs(ximage); return XPutPixel(ximage, x, y, pixel); } } static int _XPutPixel8 ( register XImage *ximage, int x, int y, unsigned long pixel) { if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 8)) { ximage->data[y * ximage->bytes_per_line + x] = pixel; return 1; } else { _XInitImageFuncPtrs(ximage); return XPutPixel(ximage, x, y, pixel); } } static int _XPutPixel1 ( register XImage *ximage, int x, int y, unsigned long pixel) { unsigned char bit; int xoff, yoff; if (((ximage->bits_per_pixel | ximage->depth) == 1) && (ximage->byte_order == ximage->bitmap_bit_order)) { xoff = x + ximage->xoffset; yoff = y * ximage->bytes_per_line + (xoff >> 3); xoff &= 7; if (ximage->bitmap_bit_order == MSBFirst) bit = 0x80 >> xoff; else bit = 1 << xoff; if (pixel & 1) ximage->data[yoff] |= bit; else ximage->data[yoff] &= ~bit; return 1; } else { _XInitImageFuncPtrs(ximage); return XPutPixel(ximage, x, y, pixel); } } /* * SubImage * * Creates a new image that is a subsection of an existing one. * Allocates the memory necessary for the new XImage data structure. * Pointer to new image is returned. The algorithm used is repetitive * calls to get and put pixel. * */ static XImage *_XSubImage ( XImage *ximage, register int x, /* starting x coordinate in existing image */ register int y, /* starting y coordinate in existing image */ unsigned int width, /* width in pixels of new subimage */ unsigned int height)/* height in pixels of new subimage */ { register XImage *subimage; int dsize; register int row, col; register unsigned long pixel; char *data; if ((subimage = Xcalloc (1, sizeof (XImage))) == NULL) return (XImage *) NULL; subimage->width = width; subimage->height = height; subimage->xoffset = 0; subimage->format = ximage->format; subimage->byte_order = ximage->byte_order; subimage->bitmap_unit = ximage->bitmap_unit; subimage->bitmap_bit_order = ximage->bitmap_bit_order; subimage->bitmap_pad = ximage->bitmap_pad; subimage->bits_per_pixel = ximage->bits_per_pixel; subimage->depth = ximage->depth; /* * compute per line accelerator. */ if (subimage->format == ZPixmap) subimage->bytes_per_line = ROUNDUP(subimage->bits_per_pixel * width, subimage->bitmap_pad); else subimage->bytes_per_line = ROUNDUP(width, subimage->bitmap_pad); subimage->obdata = NULL; _XInitImageFuncPtrs (subimage); dsize = subimage->bytes_per_line * height; if (subimage->format == XYPixmap) dsize = dsize * subimage->depth; if (((data = Xcalloc (1, dsize)) == NULL) && (dsize > 0)) { Xfree(subimage); return (XImage *) NULL; } subimage->data = data; /* * Test for cases where the new subimage is larger than the region * that we are copying from the existing data. In those cases, * copy the area of the existing image, and allow the "uncovered" * area of new subimage to remain with zero filled pixels. */ if (height > ximage->height - y ) height = ximage->height - y; if (width > ximage->width - x ) width = ximage->width - x; for (row = y; row < (y + height); row++) { for (col = x; col < (x + width); col++) { pixel = XGetPixel(ximage, col, row); XPutPixel(subimage, (col - x), (row - y), pixel); } } return subimage; } /* * SetImage * * Overwrites a section of one image with all of the data from another. * If the two images are not of the same format (i.e. XYPixmap and ZPixmap), * the image data is converted to the destination format. The following * restrictions apply: * * 1. The depths of the source and destination images must be equal. * * 2. If the height of the source image is too large to fit between * the specified y starting point and the bottom of the image, * then scanlines are truncated on the bottom. * * 3. If the width of the source image is too large to fit between * the specified x starting point and the end of the scanline, * then pixels are truncated on the right. * * The images need not have the same bitmap_bit_order, byte_order, * bitmap_unit, bits_per_pixel, bitmap_pad, or xoffset. * */ int _XSetImage( XImage *srcimg, register XImage *dstimg, register int x, register int y) { register unsigned long pixel; register int row, col; int width, height, startrow, startcol; if (x < 0) { startcol = -x; x = 0; } else startcol = 0; if (y < 0) { startrow = -y; y = 0; } else startrow = 0; width = dstimg->width - x; if (srcimg->width < width) width = srcimg->width; height = dstimg->height - y; if (srcimg->height < height) height = srcimg->height; /* this is slow, will do better later */ for (row = startrow; row < height; row++) { for (col = startcol; col < width; col++) { pixel = XGetPixel(srcimg, col, row); XPutPixel(dstimg, x + col, y + row, pixel); } } return 1; } /* * AddPixel * * Adds a constant value to every pixel in a pixmap. * */ static int _XAddPixel ( register XImage *ximage, register long value) { register int x; register int y; if (!value) return 0; if ((ximage->bits_per_pixel | ximage->depth) == 1) { /* The only value that we can add here to an XYBitmap * is one. Since 1 + value = ~value for one bit wide * data, we do this quickly by taking the ones complement * of the entire bitmap data (offset and pad included!). * Note that we don't need to be concerned with bit or * byte order at all. */ register unsigned char *dp = (unsigned char *) ximage->data; x = ximage->bytes_per_line * ximage->height; while (--x >= 0) { *dp = ~*dp; dp++; } } else if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 8)) { register unsigned char *dp = (unsigned char *) ximage->data; x = ximage->bytes_per_line * ximage->height; while (--x >= 0) *dp++ += value; } else if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 16) && (*((const char *)&byteorderpixel) == ximage->byte_order)) { register unsigned short *dp = (unsigned short *) ximage->data; x = (ximage->bytes_per_line >> 1) * ximage->height; while (--x >= 0) *dp++ += value; } else if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 32) && (*((const char *)&byteorderpixel) == ximage->byte_order)) { register CARD32 *dp = (CARD32 *) ximage->data; x = (ximage->bytes_per_line >> 2) * ximage->height; while (--x >= 0) *dp++ += value; } else { for (y = ximage->height; --y >= 0; ) { for (x = ximage->width; --x >= 0; ) { register unsigned long pixel = XGetPixel(ximage, x, y); pixel = pixel + value; XPutPixel(ximage, x, y, pixel); } } } return 0; } nx-libs-3.5.99.23/nx-X11/lib/src/InitExt.c0000644000000000000000000002633413614532331014400 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include /* * This routine is used to link a extension in so it will be called * at appropriate times. */ XExtCodes *XInitExtension ( Display *dpy, _Xconst char *name) { XExtCodes codes; /* temp. place for extension information. */ register _XExtension *ext;/* need a place to build it all */ if (!XQueryExtension(dpy, name, &codes.major_opcode, &codes.first_event, &codes.first_error)) return (NULL); LockDisplay (dpy); if (! (ext = Xcalloc (1, sizeof (_XExtension))) || ! (ext->name = strdup(name))) { Xfree(ext); UnlockDisplay(dpy); return (XExtCodes *) NULL; } codes.extension = dpy->ext_number++; ext->codes = codes; /* chain it onto the display list */ ext->next = dpy->ext_procs; dpy->ext_procs = ext; UnlockDisplay (dpy); return (&ext->codes); /* tell him which extension */ } XExtCodes *XAddExtension (Display *dpy) { register _XExtension *ext; LockDisplay (dpy); if (! (ext = Xcalloc (1, sizeof (_XExtension)))) { UnlockDisplay(dpy); return (XExtCodes *) NULL; } ext->codes.extension = dpy->ext_number++; /* chain it onto the display list */ ext->next = dpy->ext_procs; dpy->ext_procs = ext; UnlockDisplay (dpy); return (&ext->codes); /* tell him which extension */ } static _XExtension *XLookupExtension ( register Display *dpy, /* display */ register int extension) /* extension number */ { register _XExtension *ext; for (ext = dpy->ext_procs; ext; ext = ext->next) if (ext->codes.extension == extension) return (ext); return (NULL); } XExtData **XEHeadOfExtensionList(XEDataObject object) { return *(XExtData ***)&object; } int XAddToExtensionList( XExtData **structure, XExtData *ext_data) { ext_data->next = *structure; *structure = ext_data; return 1; } XExtData *XFindOnExtensionList( XExtData **structure, int number) { XExtData *ext; ext = *structure; while (ext && (ext->number != number)) ext = ext->next; return ext; } /* * Routines to hang procs on the extension structure. */ CreateGCType XESetCreateGC( Display *dpy, /* display */ int extension, /* extension number */ CreateGCType proc) /* routine to call when GC created */ { register _XExtension *e; /* for lookup of extension */ register CreateGCType oldproc; if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); LockDisplay(dpy); oldproc = e->create_GC; e->create_GC = proc; UnlockDisplay(dpy); return (CreateGCType)oldproc; } CopyGCType XESetCopyGC( Display *dpy, /* display */ int extension, /* extension number */ CopyGCType proc) /* routine to call when GC copied */ { register _XExtension *e; /* for lookup of extension */ register CopyGCType oldproc; if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); LockDisplay(dpy); oldproc = e->copy_GC; e->copy_GC = proc; UnlockDisplay(dpy); return (CopyGCType)oldproc; } FlushGCType XESetFlushGC( Display *dpy, /* display */ int extension, /* extension number */ FlushGCType proc) /* routine to call when GC copied */ { register _XExtension *e; /* for lookup of extension */ register FlushGCType oldproc; if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); LockDisplay(dpy); oldproc = e->flush_GC; e->flush_GC = proc; UnlockDisplay(dpy); return (FlushGCType)oldproc; } FreeGCType XESetFreeGC( Display *dpy, /* display */ int extension, /* extension number */ FreeGCType proc) /* routine to call when GC freed */ { register _XExtension *e; /* for lookup of extension */ register FreeGCType oldproc; if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); LockDisplay(dpy); oldproc = e->free_GC; e->free_GC = proc; UnlockDisplay(dpy); return (FreeGCType)oldproc; } CreateFontType XESetCreateFont( Display *dpy, /* display */ int extension, /* extension number */ CreateFontType proc) /* routine to call when font created */ { register _XExtension *e; /* for lookup of extension */ register CreateFontType oldproc; if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); LockDisplay(dpy); oldproc = e->create_Font; e->create_Font = proc; UnlockDisplay(dpy); return (CreateFontType)oldproc; } FreeFontType XESetFreeFont( Display *dpy, /* display */ int extension, /* extension number */ FreeFontType proc) /* routine to call when font freed */ { register _XExtension *e; /* for lookup of extension */ register FreeFontType oldproc; if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); LockDisplay(dpy); oldproc = e->free_Font; e->free_Font = proc; UnlockDisplay(dpy); return (FreeFontType)oldproc; } CloseDisplayType XESetCloseDisplay( Display *dpy, /* display */ int extension, /* extension number */ CloseDisplayType proc) /* routine to call when display closed */ { register _XExtension *e; /* for lookup of extension */ register CloseDisplayType oldproc; if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); LockDisplay(dpy); oldproc = e->close_display; e->close_display = proc; UnlockDisplay(dpy); return (CloseDisplayType)oldproc; } typedef Bool (*WireToEventType) ( Display* /* display */, XEvent* /* re */, xEvent* /* event */ ); WireToEventType XESetWireToEvent( Display *dpy, /* display */ int event_number, /* event routine to replace */ WireToEventType proc) /* routine to call when converting event */ { register WireToEventType oldproc; if (proc == NULL) proc = (WireToEventType)_XUnknownWireEvent; LockDisplay (dpy); oldproc = dpy->event_vec[event_number]; dpy->event_vec[event_number] = proc; UnlockDisplay (dpy); return (WireToEventType)oldproc; } typedef Bool (*WireToEventCookieType) ( Display* /* display */, XGenericEventCookie* /* re */, xEvent* /* event */ ); WireToEventCookieType XESetWireToEventCookie( Display *dpy, /* display */ int extension, /* extension major opcode */ WireToEventCookieType proc /* routine to call for generic events */ ) { WireToEventCookieType oldproc; if (proc == NULL) proc = (WireToEventCookieType)_XUnknownWireEventCookie; LockDisplay (dpy); oldproc = dpy->generic_event_vec[extension & 0x7F]; dpy->generic_event_vec[extension & 0x7F] = proc; UnlockDisplay (dpy); return (WireToEventCookieType)oldproc; } typedef Bool (*CopyEventCookieType) ( Display* /* display */, XGenericEventCookie* /* in */, XGenericEventCookie* /* out */ ); CopyEventCookieType XESetCopyEventCookie( Display *dpy, /* display */ int extension, /* extension major opcode */ CopyEventCookieType proc /* routine to copy generic events */ ) { CopyEventCookieType oldproc; if (proc == NULL) proc = (CopyEventCookieType)_XUnknownCopyEventCookie; LockDisplay (dpy); oldproc = dpy->generic_event_copy_vec[extension & 0x7F]; dpy->generic_event_copy_vec[extension & 0x7F] = proc; UnlockDisplay (dpy); return (CopyEventCookieType)oldproc; } typedef Status (*EventToWireType) ( Display* /* display */, XEvent* /* re */, xEvent* /* event */ ); EventToWireType XESetEventToWire( Display *dpy, /* display */ int event_number, /* event routine to replace */ EventToWireType proc) /* routine to call when converting event */ { register EventToWireType oldproc; if (proc == NULL) proc = (EventToWireType) _XUnknownNativeEvent; LockDisplay (dpy); oldproc = dpy->wire_vec[event_number]; dpy->wire_vec[event_number] = proc; UnlockDisplay(dpy); return (EventToWireType)oldproc; } typedef Bool (*WireToErrorType) ( Display* /* display */, XErrorEvent* /* he */, xError* /* we */ ); WireToErrorType XESetWireToError( Display *dpy, /* display */ int error_number, /* error routine to replace */ WireToErrorType proc) /* routine to call when converting error */ { register WireToErrorType oldproc = NULL; if (proc == NULL) proc = (WireToErrorType)_XDefaultWireError; LockDisplay (dpy); if (!dpy->error_vec) { int i; dpy->error_vec = Xmalloc(256 * sizeof(oldproc)); for (i = 1; i < 256; i++) dpy->error_vec[i] = _XDefaultWireError; } if (dpy->error_vec) { oldproc = dpy->error_vec[error_number]; dpy->error_vec[error_number] = proc; } UnlockDisplay (dpy); return (WireToErrorType)oldproc; } ErrorType XESetError( Display *dpy, /* display */ int extension, /* extension number */ ErrorType proc) /* routine to call when X error happens */ { register _XExtension *e; /* for lookup of extension */ register ErrorType oldproc; if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); LockDisplay(dpy); oldproc = e->error; e->error = proc; UnlockDisplay(dpy); return (ErrorType)oldproc; } ErrorStringType XESetErrorString( Display *dpy, /* display */ int extension, /* extension number */ ErrorStringType proc) /* routine to call when I/O error happens */ { register _XExtension *e; /* for lookup of extension */ register ErrorStringType oldproc; if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); LockDisplay(dpy); oldproc = e->error_string; e->error_string = proc; UnlockDisplay(dpy); return (ErrorStringType)oldproc; } PrintErrorType XESetPrintErrorValues( Display *dpy, /* display */ int extension, /* extension number */ PrintErrorType proc) /* routine to call to print */ { register _XExtension *e; /* for lookup of extension */ register PrintErrorType oldproc; if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); LockDisplay(dpy); oldproc = e->error_values; e->error_values = proc; UnlockDisplay(dpy); return (PrintErrorType)oldproc; } BeforeFlushType XESetBeforeFlush( Display *dpy, /* display */ int extension, /* extension number */ BeforeFlushType proc) /* routine to call on flush */ { register _XExtension *e; /* for lookup of extension */ register BeforeFlushType oldproc; register _XExtension *ext; if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); LockDisplay(dpy); oldproc = e->before_flush; e->before_flush = proc; for (ext = dpy->flushes; ext && ext != e; ext = ext->next) ; if (!ext) { e->next_flush = dpy->flushes; dpy->flushes = e; } UnlockDisplay(dpy); return (BeforeFlushType)oldproc; } nx-libs-3.5.99.23/nx-X11/lib/src/InsCmap.c0000644000000000000000000000264113614532331014341 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XInstallColormap( register Display *dpy, Colormap cmap) { register xResourceReq *req; LockDisplay(dpy); GetResReq(InstallColormap, cmap, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/IntAtom.c0000644000000000000000000001624513614532331014367 0ustar /* Copyright 1986, 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xintatom.h" #define HASH(sig) ((sig) & (TABLESIZE-1)) #define REHASHVAL(sig) ((((sig) % (TABLESIZE-3)) + 2) | 1) #define REHASH(idx,rehash) ((idx + rehash) & (TABLESIZE-1)) void _XFreeAtomTable(Display *dpy) { register Entry *table; register int i; register Entry e; if (dpy->atoms) { table = dpy->atoms->table; for (i = TABLESIZE; --i >= 0; ) { if ((e = *table++) && (e != RESERVED)) Xfree(e); } Xfree(dpy->atoms); } } static Atom _XInternAtom( Display *dpy, _Xconst char *name, Bool onlyIfExists, unsigned long *psig, int *pidx, int *pn) { register AtomTable *atoms; register char *s1, c, *s2; register unsigned long sig; register int idx = 0, i; Entry e; int n, firstidx, rehash = 0; xInternAtomReq *req; /* look in the cache first */ if (!(atoms = dpy->atoms)) { dpy->atoms = atoms = Xcalloc(1, sizeof(AtomTable)); dpy->free_funcs->atoms = _XFreeAtomTable; } sig = 0; for (s1 = (char *)name; (c = *s1++); ) sig += c; n = s1 - (char *)name - 1; if (atoms) { firstidx = idx = HASH(sig); while ((e = atoms->table[idx])) { if (e != RESERVED && e->sig == sig) { for (i = n, s1 = (char *)name, s2 = EntryName(e); --i >= 0; ) { if (*s1++ != *s2++) goto nomatch; } if (!*s2) return e->atom; } nomatch: if (idx == firstidx) rehash = REHASHVAL(sig); idx = REHASH(idx, rehash); if (idx == firstidx) break; } } *psig = sig; *pidx = idx; if (atoms && !atoms->table[idx]) atoms->table[idx] = RESERVED; /* reserve slot */ *pn = n; /* not found, go to the server */ GetReq(InternAtom, req); req->nbytes = n; req->onlyIfExists = onlyIfExists; req->length += (n+3)>>2; Data(dpy, name, n); return None; } void _XUpdateAtomCache( Display *dpy, const char *name, Atom atom, unsigned long sig, int idx, int n) { Entry e, oe; register char *s1; register char c; int firstidx, rehash; if (!dpy->atoms) { if (idx < 0) { dpy->atoms = Xcalloc(1, sizeof(AtomTable)); dpy->free_funcs->atoms = _XFreeAtomTable; } if (!dpy->atoms) return; } if (!sig) { for (s1 = (char *)name; (c = *s1++); ) sig += c; n = s1 - (char *)name - 1; if (idx < 0) { firstidx = idx = HASH(sig); if (dpy->atoms->table[idx]) { rehash = REHASHVAL(sig); do idx = REHASH(idx, rehash); while (idx != firstidx && dpy->atoms->table[idx]); } } } e = Xmalloc(sizeof(EntryRec) + n + 1); if (e) { e->sig = sig; e->atom = atom; strcpy(EntryName(e), name); if ((oe = dpy->atoms->table[idx]) && (oe != RESERVED)) Xfree(oe); dpy->atoms->table[idx] = e; } } Atom XInternAtom ( Display *dpy, const char *name, Bool onlyIfExists) { Atom atom; unsigned long sig; int idx, n; xInternAtomReply rep; if (!name) name = ""; LockDisplay(dpy); if ((atom = _XInternAtom(dpy, name, onlyIfExists, &sig, &idx, &n))) { UnlockDisplay(dpy); return atom; } if (dpy->atoms && dpy->atoms->table[idx] == RESERVED) dpy->atoms->table[idx] = NULL; /* unreserve slot */ if (_XReply (dpy, (xReply *)&rep, 0, xTrue)) { if ((atom = rep.atom)) _XUpdateAtomCache(dpy, name, atom, sig, idx, n); } UnlockDisplay(dpy); SyncHandle(); return (rep.atom); } typedef struct { unsigned long start_seq; unsigned long stop_seq; char **names; Atom *atoms; int count; Status status; } _XIntAtomState; static Bool _XIntAtomHandler( register Display *dpy, register xReply *rep, char *buf, int len, XPointer data) { register _XIntAtomState *state; register int i, idx = 0; xInternAtomReply replbuf; register xInternAtomReply *repl; state = (_XIntAtomState *)data; if (dpy->last_request_read < state->start_seq || dpy->last_request_read > state->stop_seq) return False; for (i = 0; i < state->count; i++) { if (state->atoms[i] & 0x80000000) { idx = ~state->atoms[i]; state->atoms[i] = None; break; } } if (i >= state->count) return False; if (rep->generic.type == X_Error) { state->status = 0; return False; } repl = (xInternAtomReply *) _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, (SIZEOF(xInternAtomReply) - SIZEOF(xReply)) >> 2, True); if ((state->atoms[i] = repl->atom)) _XUpdateAtomCache(dpy, state->names[i], (Atom) repl->atom, (unsigned long)0, idx, 0); return True; } Status XInternAtoms ( Display *dpy, char **names, int count, Bool onlyIfExists, Atom *atoms_return) { int i, idx, n, tidx; unsigned long sig; _XAsyncHandler async; _XIntAtomState async_state; int missed = -1; xInternAtomReply rep; LockDisplay(dpy); async_state.start_seq = dpy->request + 1; async_state.atoms = atoms_return; async_state.names = names; async_state.count = count - 1; async_state.status = 1; async.next = dpy->async_handlers; async.handler = _XIntAtomHandler; async.data = (XPointer)&async_state; dpy->async_handlers = &async; for (i = 0; i < count; i++) { if (!(atoms_return[i] = _XInternAtom(dpy, names[i], onlyIfExists, &sig, &idx, &n))) { missed = i; atoms_return[i] = ~((Atom)idx); async_state.stop_seq = dpy->request; } } if (missed >= 0) { if (dpy->atoms) { /* unreserve anything we just reserved */ for (i = 0; i < count; i++) { if (atoms_return[i] & 0x80000000) { tidx = ~atoms_return[i]; if (dpy->atoms->table[tidx] == RESERVED) dpy->atoms->table[tidx] = NULL; } } } if (_XReply (dpy, (xReply *)&rep, 0, xTrue)) { if ((atoms_return[missed] = rep.atom)) _XUpdateAtomCache(dpy, names[missed], (Atom) rep.atom, sig, idx, n); } else { atoms_return[missed] = None; async_state.status = 0; } } DeqAsyncHandler(dpy, &async); UnlockDisplay(dpy); if (missed >= 0) SyncHandle(); return async_state.status; } nx-libs-3.5.99.23/nx-X11/lib/src/KeyBind.c0000644000000000000000000010210613614532331014331 0ustar /* Copyright 1985, 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* Beware, here be monsters (still under construction... - JG */ #ifdef HAVE_CONFIG_H #include #endif #include #include #define XK_MISCELLANY #define XK_LATIN1 #define XK_LATIN2 #define XK_LATIN3 #define XK_LATIN4 #define XK_LATIN8 #define XK_LATIN9 #define XK_CYRILLIC #define XK_GREEK #define XK_ARMENIAN #define XK_CAUCASUS #define XK_VIETNAMESE #define XK_XKB_KEYS #define XK_SINHALA #include #include #include "Xresource.h" #include "Key.h" #ifdef XKB #include "XKBlib.h" #include "XKBlibint.h" #define XKeycodeToKeysym _XKeycodeToKeysym #define XKeysymToKeycode _XKeysymToKeycode #define XLookupKeysym _XLookupKeysym #define XRefreshKeyboardMapping _XRefreshKeyboardMapping #define XLookupString _XLookupString /* XKBBind.c */ #else #define XkbKeysymToModifiers _XKeysymToModifiers #endif #define AllMods (ShiftMask|LockMask|ControlMask| \ Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask) static void ComputeMaskFromKeytrans( Display *dpy, register struct _XKeytrans *p); struct _XKeytrans { struct _XKeytrans *next;/* next on list */ char *string; /* string to return when the time comes */ int len; /* length of string (since NULL is legit)*/ KeySym key; /* keysym rebound */ unsigned int state; /* modifier state */ KeySym *modifiers; /* modifier keysyms you want */ int mlen; /* length of modifier list */ }; static KeySym KeyCodetoKeySym(register Display *dpy, KeyCode keycode, int col) { register int per = dpy->keysyms_per_keycode; register KeySym *syms; KeySym lsym, usym; if ((col < 0) || ((col >= per) && (col > 3)) || ((int)keycode < dpy->min_keycode) || ((int)keycode > dpy->max_keycode)) return NoSymbol; syms = &dpy->keysyms[(keycode - dpy->min_keycode) * per]; if (col < 4) { if (col > 1) { while ((per > 2) && (syms[per - 1] == NoSymbol)) per--; if (per < 3) col -= 2; } if ((per <= (col|1)) || (syms[col|1] == NoSymbol)) { XConvertCase(syms[col&~1], &lsym, &usym); if (!(col & 1)) return lsym; else if (usym == lsym) return NoSymbol; else return usym; } } return syms[col]; } KeySym XKeycodeToKeysym(Display *dpy, #if NeedWidePrototypes unsigned int kc, #else KeyCode kc, #endif int col) { if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) return NoSymbol; return KeyCodetoKeySym(dpy, kc, col); } KeyCode XKeysymToKeycode( Display *dpy, KeySym ks) { register int i, j; if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) return (KeyCode) 0; for (j = 0; j < dpy->keysyms_per_keycode; j++) { for (i = dpy->min_keycode; i <= dpy->max_keycode; i++) { if (KeyCodetoKeySym(dpy, (KeyCode) i, j) == ks) return i; } } return 0; } KeySym XLookupKeysym( register XKeyEvent *event, int col) { if ((! event->display->keysyms) && (! _XKeyInitialize(event->display))) return NoSymbol; return KeyCodetoKeySym(event->display, event->keycode, col); } static void ResetModMap( Display *dpy) { register XModifierKeymap *map; register int i, j, n; KeySym sym; register struct _XKeytrans *p; map = dpy->modifiermap; /* If any Lock key contains Caps_Lock, then interpret as Caps_Lock, * else if any contains Shift_Lock, then interpret as Shift_Lock, * else ignore Lock altogether. */ dpy->lock_meaning = NoSymbol; /* Lock modifiers are in the second row of the matrix */ n = 2 * map->max_keypermod; for (i = map->max_keypermod; i < n; i++) { for (j = 0; j < dpy->keysyms_per_keycode; j++) { sym = KeyCodetoKeySym(dpy, map->modifiermap[i], j); if (sym == XK_Caps_Lock) { dpy->lock_meaning = XK_Caps_Lock; break; } else if (sym == XK_Shift_Lock) { dpy->lock_meaning = XK_Shift_Lock; } else if (sym == XK_ISO_Lock) { dpy->lock_meaning = XK_Caps_Lock; break; } } } /* Now find any Mod modifier acting as the Group or Numlock modifier */ dpy->mode_switch = 0; dpy->num_lock = 0; n *= 4; for (i = 3*map->max_keypermod; i < n; i++) { for (j = 0; j < dpy->keysyms_per_keycode; j++) { sym = KeyCodetoKeySym(dpy, map->modifiermap[i], j); if (sym == XK_Mode_switch) dpy->mode_switch |= 1 << (i / map->max_keypermod); if (sym == XK_Num_Lock) dpy->num_lock |= 1 << (i / map->max_keypermod); } } for (p = dpy->key_bindings; p; p = p->next) ComputeMaskFromKeytrans(dpy, p); } static int InitModMap( Display *dpy) { register XModifierKeymap *map; if (! (map = XGetModifierMapping(dpy))) return 0; LockDisplay(dpy); if (dpy->modifiermap) XFreeModifiermap(dpy->modifiermap); dpy->modifiermap = map; dpy->free_funcs->modifiermap = XFreeModifiermap; if (dpy->keysyms) ResetModMap(dpy); UnlockDisplay(dpy); return 1; } int XRefreshKeyboardMapping(register XMappingEvent *event) { if(event->request == MappingKeyboard) { /* XXX should really only refresh what is necessary * for now, make initialize test fail */ LockDisplay(event->display); if (event->display->keysyms) { Xfree (event->display->keysyms); event->display->keysyms = NULL; } UnlockDisplay(event->display); } if(event->request == MappingModifier) { LockDisplay(event->display); if (event->display->modifiermap) { XFreeModifiermap(event->display->modifiermap); event->display->modifiermap = NULL; } UnlockDisplay(event->display); /* go ahead and get it now, since initialize test may not fail */ if (event->display->keysyms) (void) InitModMap(event->display); } return 1; } int _XKeyInitialize( Display *dpy) { int per, n; KeySym *keysyms; /* * lets go get the keysyms from the server. */ if (!dpy->keysyms) { n = dpy->max_keycode - dpy->min_keycode + 1; keysyms = XGetKeyboardMapping (dpy, (KeyCode) dpy->min_keycode, n, &per); /* keysyms may be NULL */ if (! keysyms) return 0; LockDisplay(dpy); Xfree (dpy->keysyms); dpy->keysyms = keysyms; dpy->keysyms_per_keycode = per; if (dpy->modifiermap) ResetModMap(dpy); UnlockDisplay(dpy); } if (!dpy->modifiermap) return InitModMap(dpy); return 1; } static void UCSConvertCase( register unsigned code, KeySym *lower, KeySym *upper ) { /* Case conversion for UCS, as in Unicode Data version 4.0.0 */ /* NB: Only converts simple one-to-one mappings. */ /* Tables are used where they take less space than */ /* the code to work out the mappings. Zero values mean */ /* undefined code points. */ static unsigned short const IPAExt_upper_mapping[] = { /* part only */ 0x0181, 0x0186, 0x0255, 0x0189, 0x018A, 0x0258, 0x018F, 0x025A, 0x0190, 0x025C, 0x025D, 0x025E, 0x025F, 0x0193, 0x0261, 0x0262, 0x0194, 0x0264, 0x0265, 0x0266, 0x0267, 0x0197, 0x0196, 0x026A, 0x026B, 0x026C, 0x026D, 0x026E, 0x019C, 0x0270, 0x0271, 0x019D, 0x0273, 0x0274, 0x019F, 0x0276, 0x0277, 0x0278, 0x0279, 0x027A, 0x027B, 0x027C, 0x027D, 0x027E, 0x027F, 0x01A6, 0x0281, 0x0282, 0x01A9, 0x0284, 0x0285, 0x0286, 0x0287, 0x01AE, 0x0289, 0x01B1, 0x01B2, 0x028C, 0x028D, 0x028E, 0x028F, 0x0290, 0x0291, 0x01B7 }; static unsigned short const LatinExtB_upper_mapping[] = { /* first part only */ 0x0180, 0x0181, 0x0182, 0x0182, 0x0184, 0x0184, 0x0186, 0x0187, 0x0187, 0x0189, 0x018A, 0x018B, 0x018B, 0x018D, 0x018E, 0x018F, 0x0190, 0x0191, 0x0191, 0x0193, 0x0194, 0x01F6, 0x0196, 0x0197, 0x0198, 0x0198, 0x019A, 0x019B, 0x019C, 0x019D, 0x0220, 0x019F, 0x01A0, 0x01A0, 0x01A2, 0x01A2, 0x01A4, 0x01A4, 0x01A6, 0x01A7, 0x01A7, 0x01A9, 0x01AA, 0x01AB, 0x01AC, 0x01AC, 0x01AE, 0x01AF, 0x01AF, 0x01B1, 0x01B2, 0x01B3, 0x01B3, 0x01B5, 0x01B5, 0x01B7, 0x01B8, 0x01B8, 0x01BA, 0x01BB, 0x01BC, 0x01BC, 0x01BE, 0x01F7, 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C4, 0x01C4, 0x01C4, 0x01C7, 0x01C7, 0x01C7, 0x01CA, 0x01CA, 0x01CA }; static unsigned short const LatinExtB_lower_mapping[] = { /* first part only */ 0x0180, 0x0253, 0x0183, 0x0183, 0x0185, 0x0185, 0x0254, 0x0188, 0x0188, 0x0256, 0x0257, 0x018C, 0x018C, 0x018D, 0x01DD, 0x0259, 0x025B, 0x0192, 0x0192, 0x0260, 0x0263, 0x0195, 0x0269, 0x0268, 0x0199, 0x0199, 0x019A, 0x019B, 0x026F, 0x0272, 0x019E, 0x0275, 0x01A1, 0x01A1, 0x01A3, 0x01A3, 0x01A5, 0x01A5, 0x0280, 0x01A8, 0x01A8, 0x0283, 0x01AA, 0x01AB, 0x01AD, 0x01AD, 0x0288, 0x01B0, 0x01B0, 0x028A, 0x028B, 0x01B4, 0x01B4, 0x01B6, 0x01B6, 0x0292, 0x01B9, 0x01B9, 0x01BA, 0x01BB, 0x01BD, 0x01BD, 0x01BE, 0x01BF, 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C6, 0x01C6, 0x01C6, 0x01C9, 0x01C9, 0x01C9, 0x01CC, 0x01CC, 0x01CC }; static unsigned short const Greek_upper_mapping[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0374, 0x0375, 0x0000, 0x0000, 0x0000, 0x0000, 0x037A, 0x0000, 0x0000, 0x0000, 0x037E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0384, 0x0385, 0x0386, 0x0387, 0x0388, 0x0389, 0x038A, 0x0000, 0x038C, 0x0000, 0x038E, 0x038F, 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x0386, 0x0388, 0x0389, 0x038A, 0x03B0, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0, 0x03A1, 0x03A3, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x038C, 0x038E, 0x038F, 0x0000, 0x0392, 0x0398, 0x03D2, 0x03D3, 0x03D4, 0x03A6, 0x03A0, 0x03D7, 0x03D8, 0x03D8, 0x03DA, 0x03DA, 0x03DC, 0x03DC, 0x03DE, 0x03DE, 0x03E0, 0x03E0, 0x03E2, 0x03E2, 0x03E4, 0x03E4, 0x03E6, 0x03E6, 0x03E8, 0x03E8, 0x03EA, 0x03EA, 0x03EC, 0x03EC, 0x03EE, 0x03EE, 0x039A, 0x03A1, 0x03F9, 0x03F3, 0x03F4, 0x0395, 0x03F6, 0x03F7, 0x03F7, 0x03F9, 0x03FA, 0x03FA, 0x0000, 0x0000, 0x0000, 0x0000 }; static unsigned short const Greek_lower_mapping[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0374, 0x0375, 0x0000, 0x0000, 0x0000, 0x0000, 0x037A, 0x0000, 0x0000, 0x0000, 0x037E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0384, 0x0385, 0x03AC, 0x0387, 0x03AD, 0x03AE, 0x03AF, 0x0000, 0x03CC, 0x0000, 0x03CD, 0x03CE, 0x0390, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x0000, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000, 0x03D0, 0x03D1, 0x03D2, 0x03D3, 0x03D4, 0x03D5, 0x03D6, 0x03D7, 0x03D9, 0x03D9, 0x03DB, 0x03DB, 0x03DD, 0x03DD, 0x03DF, 0x03DF, 0x03E1, 0x03E1, 0x03E3, 0x03E3, 0x03E5, 0x03E5, 0x03E7, 0x03E7, 0x03E9, 0x03E9, 0x03EB, 0x03EB, 0x03ED, 0x03ED, 0x03EF, 0x03EF, 0x03F0, 0x03F1, 0x03F2, 0x03F3, 0x03B8, 0x03F5, 0x03F6, 0x03F8, 0x03F8, 0x03F2, 0x03FB, 0x03FB, 0x0000, 0x0000, 0x0000, 0x0000 }; static unsigned short const GreekExt_lower_mapping[] = { 0x1F00, 0x1F01, 0x1F02, 0x1F03, 0x1F04, 0x1F05, 0x1F06, 0x1F07, 0x1F00, 0x1F01, 0x1F02, 0x1F03, 0x1F04, 0x1F05, 0x1F06, 0x1F07, 0x1F10, 0x1F11, 0x1F12, 0x1F13, 0x1F14, 0x1F15, 0x0000, 0x0000, 0x1F10, 0x1F11, 0x1F12, 0x1F13, 0x1F14, 0x1F15, 0x0000, 0x0000, 0x1F20, 0x1F21, 0x1F22, 0x1F23, 0x1F24, 0x1F25, 0x1F26, 0x1F27, 0x1F20, 0x1F21, 0x1F22, 0x1F23, 0x1F24, 0x1F25, 0x1F26, 0x1F27, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37, 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37, 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F45, 0x0000, 0x0000, 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F45, 0x0000, 0x0000, 0x1F50, 0x1F51, 0x1F52, 0x1F53, 0x1F54, 0x1F55, 0x1F56, 0x1F57, 0x0000, 0x1F51, 0x0000, 0x1F53, 0x0000, 0x1F55, 0x0000, 0x1F57, 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67, 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67, 0x1F70, 0x1F71, 0x1F72, 0x1F73, 0x1F74, 0x1F75, 0x1F76, 0x1F77, 0x1F78, 0x1F79, 0x1F7A, 0x1F7B, 0x1F7C, 0x1F7D, 0x0000, 0x0000, 0x1F80, 0x1F81, 0x1F82, 0x1F83, 0x1F84, 0x1F85, 0x1F86, 0x1F87, 0x1F80, 0x1F81, 0x1F82, 0x1F83, 0x1F84, 0x1F85, 0x1F86, 0x1F87, 0x1F90, 0x1F91, 0x1F92, 0x1F93, 0x1F94, 0x1F95, 0x1F96, 0x1F97, 0x1F90, 0x1F91, 0x1F92, 0x1F93, 0x1F94, 0x1F95, 0x1F96, 0x1F97, 0x1FA0, 0x1FA1, 0x1FA2, 0x1FA3, 0x1FA4, 0x1FA5, 0x1FA6, 0x1FA7, 0x1FA0, 0x1FA1, 0x1FA2, 0x1FA3, 0x1FA4, 0x1FA5, 0x1FA6, 0x1FA7, 0x1FB0, 0x1FB1, 0x1FB2, 0x1FB3, 0x1FB4, 0x0000, 0x1FB6, 0x1FB7, 0x1FB0, 0x1FB1, 0x1F70, 0x1F71, 0x1FB3, 0x1FBD, 0x1FBE, 0x1FBF, 0x1FC0, 0x1FC1, 0x1FC2, 0x1FC3, 0x1FC4, 0x0000, 0x1FC6, 0x1FC7, 0x1F72, 0x1F73, 0x1F74, 0x1F75, 0x1FC3, 0x1FCD, 0x1FCE, 0x1FCF, 0x1FD0, 0x1FD1, 0x1FD2, 0x1FD3, 0x0000, 0x0000, 0x1FD6, 0x1FD7, 0x1FD0, 0x1FD1, 0x1F76, 0x1F77, 0x0000, 0x1FDD, 0x1FDE, 0x1FDF, 0x1FE0, 0x1FE1, 0x1FE2, 0x1FE3, 0x1FE4, 0x1FE5, 0x1FE6, 0x1FE7, 0x1FE0, 0x1FE1, 0x1F7A, 0x1F7B, 0x1FE5, 0x1FED, 0x1FEE, 0x1FEF, 0x0000, 0x0000, 0x1FF2, 0x1FF3, 0x1FF4, 0x0000, 0x1FF6, 0x1FF7, 0x1F78, 0x1F79, 0x1F7C, 0x1F7D, 0x1FF3, 0x1FFD, 0x1FFE, 0x0000 }; static unsigned short const GreekExt_upper_mapping[] = { 0x1F08, 0x1F09, 0x1F0A, 0x1F0B, 0x1F0C, 0x1F0D, 0x1F0E, 0x1F0F, 0x1F08, 0x1F09, 0x1F0A, 0x1F0B, 0x1F0C, 0x1F0D, 0x1F0E, 0x1F0F, 0x1F18, 0x1F19, 0x1F1A, 0x1F1B, 0x1F1C, 0x1F1D, 0x0000, 0x0000, 0x1F18, 0x1F19, 0x1F1A, 0x1F1B, 0x1F1C, 0x1F1D, 0x0000, 0x0000, 0x1F28, 0x1F29, 0x1F2A, 0x1F2B, 0x1F2C, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F28, 0x1F29, 0x1F2A, 0x1F2B, 0x1F2C, 0x1F2D, 0x1F2E, 0x1F2F, 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F, 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F, 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F4D, 0x0000, 0x0000, 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F4D, 0x0000, 0x0000, 0x1F50, 0x1F59, 0x1F52, 0x1F5B, 0x1F54, 0x1F5D, 0x1F56, 0x1F5F, 0x0000, 0x1F59, 0x0000, 0x1F5B, 0x0000, 0x1F5D, 0x0000, 0x1F5F, 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F6D, 0x1F6E, 0x1F6F, 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F6D, 0x1F6E, 0x1F6F, 0x1FBA, 0x1FBB, 0x1FC8, 0x1FC9, 0x1FCA, 0x1FCB, 0x1FDA, 0x1FDB, 0x1FF8, 0x1FF9, 0x1FEA, 0x1FEB, 0x1FFA, 0x1FFB, 0x0000, 0x0000, 0x1F88, 0x1F89, 0x1F8A, 0x1F8B, 0x1F8C, 0x1F8D, 0x1F8E, 0x1F8F, 0x1F88, 0x1F89, 0x1F8A, 0x1F8B, 0x1F8C, 0x1F8D, 0x1F8E, 0x1F8F, 0x1F98, 0x1F99, 0x1F9A, 0x1F9B, 0x1F9C, 0x1F9D, 0x1F9E, 0x1F9F, 0x1F98, 0x1F99, 0x1F9A, 0x1F9B, 0x1F9C, 0x1F9D, 0x1F9E, 0x1F9F, 0x1FA8, 0x1FA9, 0x1FAA, 0x1FAB, 0x1FAC, 0x1FAD, 0x1FAE, 0x1FAF, 0x1FA8, 0x1FA9, 0x1FAA, 0x1FAB, 0x1FAC, 0x1FAD, 0x1FAE, 0x1FAF, 0x1FB8, 0x1FB9, 0x1FB2, 0x1FBC, 0x1FB4, 0x0000, 0x1FB6, 0x1FB7, 0x1FB8, 0x1FB9, 0x1FBA, 0x1FBB, 0x1FBC, 0x1FBD, 0x0399, 0x1FBF, 0x1FC0, 0x1FC1, 0x1FC2, 0x1FCC, 0x1FC4, 0x0000, 0x1FC6, 0x1FC7, 0x1FC8, 0x1FC9, 0x1FCA, 0x1FCB, 0x1FCC, 0x1FCD, 0x1FCE, 0x1FCF, 0x1FD8, 0x1FD9, 0x1FD2, 0x1FD3, 0x0000, 0x0000, 0x1FD6, 0x1FD7, 0x1FD8, 0x1FD9, 0x1FDA, 0x1FDB, 0x0000, 0x1FDD, 0x1FDE, 0x1FDF, 0x1FE8, 0x1FE9, 0x1FE2, 0x1FE3, 0x1FE4, 0x1FEC, 0x1FE6, 0x1FE7, 0x1FE8, 0x1FE9, 0x1FEA, 0x1FEB, 0x1FEC, 0x1FED, 0x1FEE, 0x1FEF, 0x0000, 0x0000, 0x1FF2, 0x1FFC, 0x1FF4, 0x0000, 0x1FF6, 0x1FF7, 0x1FF8, 0x1FF9, 0x1FFA, 0x1FFB, 0x1FFC, 0x1FFD, 0x1FFE, 0x0000 }; *lower = code; *upper = code; /* Basic Latin and Latin-1 Supplement, U+0000 to U+00FF */ if (code <= 0x00ff) { if (code >= 0x0041 && code <= 0x005a) /* A-Z */ *lower += 0x20; else if (code >= 0x0061 && code <= 0x007a) /* a-z */ *upper -= 0x20; else if ( (code >= 0x00c0 && code <= 0x00d6) || (code >= 0x00d8 && code <= 0x00de) ) *lower += 0x20; else if ( (code >= 0x00e0 && code <= 0x00f6) || (code >= 0x00f8 && code <= 0x00fe) ) *upper -= 0x20; else if (code == 0x00ff) /* y with diaeresis */ *upper = 0x0178; else if (code == 0x00b5) /* micro sign */ *upper = 0x039c; return; } /* Latin Extended-A, U+0100 to U+017F */ if (code >= 0x0100 && code <= 0x017f) { if ( (code >= 0x0100 && code <= 0x012f) || (code >= 0x0132 && code <= 0x0137) || (code >= 0x014a && code <= 0x0177) ) { *upper = code & ~1; *lower = code | 1; } else if ( (code >= 0x0139 && code <= 0x0148) || (code >= 0x0179 && code <= 0x017e) ) { if (code & 1) *lower += 1; else *upper -= 1; } else if (code == 0x0130) *lower = 0x0069; else if (code == 0x0131) *upper = 0x0049; else if (code == 0x0178) *lower = 0x00ff; else if (code == 0x017f) *upper = 0x0053; return; } /* Latin Extended-B, U+0180 to U+024F */ if (code >= 0x0180 && code <= 0x024f) { if (code >= 0x01cd && code <= 0x01dc) { if (code & 1) *lower += 1; else *upper -= 1; } else if ( (code >= 0x01de && code <= 0x01ef) || (code >= 0x01f4 && code <= 0x01f5) || (code >= 0x01f8 && code <= 0x021f) || (code >= 0x0222 && code <= 0x0233) ) { *lower |= 1; *upper &= ~1; } else if (code >= 0x0180 && code <= 0x01cc) { *lower = LatinExtB_lower_mapping[code - 0x0180]; *upper = LatinExtB_upper_mapping[code - 0x0180]; } else if (code == 0x01dd) *upper = 0x018e; else if (code == 0x01f1 || code == 0x01f2) { *lower = 0x01f3; *upper = 0x01f1; } else if (code == 0x01f3) *upper = 0x01f1; else if (code == 0x01f6) *lower = 0x0195; else if (code == 0x01f7) *lower = 0x01bf; else if (code == 0x0220) *lower = 0x019e; return; } /* IPA Extensions, U+0250 to U+02AF */ if (code >= 0x0253 && code <= 0x0292) { *upper = IPAExt_upper_mapping[code - 0x0253]; } /* Combining Diacritical Marks, U+0300 to U+036F */ if (code == 0x0345) { *upper = 0x0399; } /* Greek and Coptic, U+0370 to U+03FF */ if (code >= 0x0370 && code <= 0x03ff) { *lower = Greek_lower_mapping[code - 0x0370]; *upper = Greek_upper_mapping[code - 0x0370]; if (*upper == 0) *upper = code; if (*lower == 0) *lower = code; } /* Cyrillic and Cyrillic Supplementary, U+0400 to U+052F */ if ( (code >= 0x0400 && code <= 0x04ff) || (code >= 0x0500 && code <= 0x052f) ) { if (code >= 0x0400 && code <= 0x040f) *lower += 0x50; else if (code >= 0x0410 && code <= 0x042f) *lower += 0x20; else if (code >= 0x0430 && code <= 0x044f) *upper -= 0x20; else if (code >= 0x0450 && code <= 0x045f) *upper -= 0x50; else if ( (code >= 0x0460 && code <= 0x0481) || (code >= 0x048a && code <= 0x04bf) || (code >= 0x04d0 && code <= 0x04f5) || (code >= 0x04f8 && code <= 0x04f9) || (code >= 0x0500 && code <= 0x050f) ) { *upper &= ~1; *lower |= 1; } else if (code >= 0x04c1 && code <= 0x04ce) { if (code & 1) *lower += 1; else *upper -= 1; } } /* Armenian, U+0530 to U+058F */ if (code >= 0x0530 && code <= 0x058f) { if (code >= 0x0531 && code <= 0x0556) *lower += 0x30; else if (code >=0x0561 && code <= 0x0586) *upper -= 0x30; } /* Latin Extended Additional, U+1E00 to U+1EFF */ if (code >= 0x1e00 && code <= 0x1eff) { if ( (code >= 0x1e00 && code <= 0x1e95) || (code >= 0x1ea0 && code <= 0x1ef9) ) { *upper &= ~1; *lower |= 1; } else if (code == 0x1e9b) *upper = 0x1e60; } /* Greek Extended, U+1F00 to U+1FFF */ if (code >= 0x1f00 && code <= 0x1fff) { *lower = GreekExt_lower_mapping[code - 0x1f00]; *upper = GreekExt_upper_mapping[code - 0x1f00]; if (*upper == 0) *upper = code; if (*lower == 0) *lower = code; } /* Letterlike Symbols, U+2100 to U+214F */ if (code >= 0x2100 && code <= 0x214f) { switch (code) { case 0x2126: *lower = 0x03c9; break; case 0x212a: *lower = 0x006b; break; case 0x212b: *lower = 0x00e5; break; } } /* Number Forms, U+2150 to U+218F */ else if (code >= 0x2160 && code <= 0x216f) *lower += 0x10; else if (code >= 0x2170 && code <= 0x217f) *upper -= 0x10; /* Enclosed Alphanumerics, U+2460 to U+24FF */ else if (code >= 0x24b6 && code <= 0x24cf) *lower += 0x1a; else if (code >= 0x24d0 && code <= 0x24e9) *upper -= 0x1a; /* Halfwidth and Fullwidth Forms, U+FF00 to U+FFEF */ else if (code >= 0xff21 && code <= 0xff3a) *lower += 0x20; else if (code >= 0xff41 && code <= 0xff5a) *upper -= 0x20; /* Deseret, U+10400 to U+104FF */ else if (code >= 0x10400 && code <= 0x10427) *lower += 0x28; else if (code >= 0x10428 && code <= 0x1044f) *upper -= 0x28; } void XConvertCase( register KeySym sym, KeySym *lower, KeySym *upper) { /* Latin 1 keysym */ if (sym < 0x100) { UCSConvertCase(sym, lower, upper); return; } /* Unicode keysym */ if ((sym & 0xff000000) == 0x01000000) { UCSConvertCase((sym & 0x00ffffff), lower, upper); *upper |= 0x01000000; *lower |= 0x01000000; return; } /* Legacy keysym */ *lower = sym; *upper = sym; switch(sym >> 8) { case 1: /* Latin 2 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym == XK_Aogonek) *lower = XK_aogonek; else if (sym >= XK_Lstroke && sym <= XK_Sacute) *lower += (XK_lstroke - XK_Lstroke); else if (sym >= XK_Scaron && sym <= XK_Zacute) *lower += (XK_scaron - XK_Scaron); else if (sym >= XK_Zcaron && sym <= XK_Zabovedot) *lower += (XK_zcaron - XK_Zcaron); else if (sym == XK_aogonek) *upper = XK_Aogonek; else if (sym >= XK_lstroke && sym <= XK_sacute) *upper -= (XK_lstroke - XK_Lstroke); else if (sym >= XK_scaron && sym <= XK_zacute) *upper -= (XK_scaron - XK_Scaron); else if (sym >= XK_zcaron && sym <= XK_zabovedot) *upper -= (XK_zcaron - XK_Zcaron); else if (sym >= XK_Racute && sym <= XK_Tcedilla) *lower += (XK_racute - XK_Racute); else if (sym >= XK_racute && sym <= XK_tcedilla) *upper -= (XK_racute - XK_Racute); break; case 2: /* Latin 3 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= XK_Hstroke && sym <= XK_Hcircumflex) *lower += (XK_hstroke - XK_Hstroke); else if (sym >= XK_Gbreve && sym <= XK_Jcircumflex) *lower += (XK_gbreve - XK_Gbreve); else if (sym >= XK_hstroke && sym <= XK_hcircumflex) *upper -= (XK_hstroke - XK_Hstroke); else if (sym >= XK_gbreve && sym <= XK_jcircumflex) *upper -= (XK_gbreve - XK_Gbreve); else if (sym >= XK_Cabovedot && sym <= XK_Scircumflex) *lower += (XK_cabovedot - XK_Cabovedot); else if (sym >= XK_cabovedot && sym <= XK_scircumflex) *upper -= (XK_cabovedot - XK_Cabovedot); break; case 3: /* Latin 4 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= XK_Rcedilla && sym <= XK_Tslash) *lower += (XK_rcedilla - XK_Rcedilla); else if (sym >= XK_rcedilla && sym <= XK_tslash) *upper -= (XK_rcedilla - XK_Rcedilla); else if (sym == XK_ENG) *lower = XK_eng; else if (sym == XK_eng) *upper = XK_ENG; else if (sym >= XK_Amacron && sym <= XK_Umacron) *lower += (XK_amacron - XK_Amacron); else if (sym >= XK_amacron && sym <= XK_umacron) *upper -= (XK_amacron - XK_Amacron); break; case 6: /* Cyrillic */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= XK_Serbian_DJE && sym <= XK_Serbian_DZE) *lower -= (XK_Serbian_DJE - XK_Serbian_dje); else if (sym >= XK_Serbian_dje && sym <= XK_Serbian_dze) *upper += (XK_Serbian_DJE - XK_Serbian_dje); else if (sym >= XK_Cyrillic_YU && sym <= XK_Cyrillic_HARDSIGN) *lower -= (XK_Cyrillic_YU - XK_Cyrillic_yu); else if (sym >= XK_Cyrillic_yu && sym <= XK_Cyrillic_hardsign) *upper += (XK_Cyrillic_YU - XK_Cyrillic_yu); break; case 7: /* Greek */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= XK_Greek_ALPHAaccent && sym <= XK_Greek_OMEGAaccent) *lower += (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent); else if (sym >= XK_Greek_alphaaccent && sym <= XK_Greek_omegaaccent && sym != XK_Greek_iotaaccentdieresis && sym != XK_Greek_upsilonaccentdieresis) *upper -= (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent); else if (sym >= XK_Greek_ALPHA && sym <= XK_Greek_OMEGA) *lower += (XK_Greek_alpha - XK_Greek_ALPHA); else if (sym >= XK_Greek_alpha && sym <= XK_Greek_omega && sym != XK_Greek_finalsmallsigma) *upper -= (XK_Greek_alpha - XK_Greek_ALPHA); break; case 0x13: /* Latin 9 */ if (sym == XK_OE) *lower = XK_oe; else if (sym == XK_oe) *upper = XK_OE; else if (sym == XK_Ydiaeresis) *lower = XK_ydiaeresis; break; } } int _XTranslateKey( register Display *dpy, KeyCode keycode, register unsigned int modifiers, unsigned int *modifiers_return, KeySym *keysym_return) { int per; register KeySym *syms; KeySym sym, lsym, usym; if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) return 0; *modifiers_return = ((ShiftMask|LockMask) | dpy->mode_switch | dpy->num_lock); if (((int)keycode < dpy->min_keycode) || ((int)keycode > dpy->max_keycode)) { *keysym_return = NoSymbol; return 1; } per = dpy->keysyms_per_keycode; syms = &dpy->keysyms[(keycode - dpy->min_keycode) * per]; while ((per > 2) && (syms[per - 1] == NoSymbol)) per--; if ((per > 2) && (modifiers & dpy->mode_switch)) { syms += 2; per -= 2; } if ((modifiers & dpy->num_lock) && (per > 1 && (IsKeypadKey(syms[1]) || IsPrivateKeypadKey(syms[1])))) { if ((modifiers & ShiftMask) || ((modifiers & LockMask) && (dpy->lock_meaning == XK_Shift_Lock))) *keysym_return = syms[0]; else *keysym_return = syms[1]; } else if (!(modifiers & ShiftMask) && (!(modifiers & LockMask) || (dpy->lock_meaning == NoSymbol))) { if ((per == 1) || (syms[1] == NoSymbol)) XConvertCase(syms[0], keysym_return, &usym); else *keysym_return = syms[0]; } else if (!(modifiers & LockMask) || (dpy->lock_meaning != XK_Caps_Lock)) { if ((per == 1) || ((usym = syms[1]) == NoSymbol)) XConvertCase(syms[0], &lsym, &usym); *keysym_return = usym; } else { if ((per == 1) || ((sym = syms[1]) == NoSymbol)) sym = syms[0]; XConvertCase(sym, &lsym, &usym); if (!(modifiers & ShiftMask) && (sym != syms[0]) && ((sym != usym) || (lsym == usym))) XConvertCase(syms[0], &lsym, &usym); *keysym_return = usym; } if (*keysym_return == XK_VoidSymbol) *keysym_return = NoSymbol; return 1; } int _XTranslateKeySym( Display *dpy, register KeySym symbol, unsigned int modifiers, char *buffer, int nbytes) { register struct _XKeytrans *p; int length; unsigned long hiBytes; register unsigned char c; if (!symbol) return 0; /* see if symbol rebound, if so, return that string. */ for (p = dpy->key_bindings; p; p = p->next) { if (((modifiers & AllMods) == p->state) && (symbol == p->key)) { length = p->len; if (length > nbytes) length = nbytes; memcpy (buffer, p->string, length); return length; } } /* try to convert to Latin-1, handling control */ hiBytes = symbol >> 8; if (!(nbytes && ((hiBytes == 0) || ((hiBytes == 0xFF) && (((symbol >= XK_BackSpace) && (symbol <= XK_Clear)) || (symbol == XK_Return) || (symbol == XK_Escape) || (symbol == XK_KP_Space) || (symbol == XK_KP_Tab) || (symbol == XK_KP_Enter) || ((symbol >= XK_KP_Multiply) && (symbol <= XK_KP_9)) || (symbol == XK_KP_Equal) || (symbol == XK_Delete)))))) return 0; /* if X keysym, convert to ascii by grabbing low 7 bits */ if (symbol == XK_KP_Space) c = XK_space & 0x7F; /* patch encoding botch */ else if (hiBytes == 0xFF) c = symbol & 0x7F; else c = symbol & 0xFF; /* only apply Control key if it makes sense, else ignore it */ if (modifiers & ControlMask) { if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F; else if (c == '2') c = '\000'; else if (c >= '3' && c <= '7') c -= ('3' - '\033'); else if (c == '8') c = '\177'; else if (c == '/') c = '_' & 0x1F; } buffer[0] = c; return 1; } /*ARGSUSED*/ int XLookupString ( register XKeyEvent *event, char *buffer, /* buffer */ int nbytes, /* space in buffer for characters */ KeySym *keysym, XComposeStatus *status) /* not implemented */ { unsigned int modifiers; KeySym symbol; if (! _XTranslateKey(event->display, event->keycode, event->state, &modifiers, &symbol)) return 0; if (keysym) *keysym = symbol; /* arguable whether to use (event->state & ~modifiers) here */ return _XTranslateKeySym(event->display, symbol, event->state, buffer, nbytes); } static void _XFreeKeyBindings( Display *dpy) { register struct _XKeytrans *p, *np; for (p = dpy->key_bindings; p; p = np) { np = p->next; Xfree(p->string); Xfree(p->modifiers); Xfree(p); } } int XRebindKeysym ( Display *dpy, KeySym keysym, KeySym *mlist, int nm, /* number of modifiers in mlist */ _Xconst unsigned char *str, int nbytes) { register struct _XKeytrans *tmp, *p; int nb; if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) return 0; LockDisplay(dpy); tmp = dpy->key_bindings; nb = sizeof(KeySym) * nm; if ((! (p = Xcalloc( 1, sizeof(struct _XKeytrans)))) || ((! (p->string = Xmalloc(nbytes))) && (nbytes > 0)) || ((! (p->modifiers = Xmalloc(nb))) && (nb > 0))) { if (p) { Xfree(p->string); Xfree(p->modifiers); Xfree(p); } UnlockDisplay(dpy); return 0; } dpy->key_bindings = p; dpy->free_funcs->key_bindings = _XFreeKeyBindings; p->next = tmp; /* chain onto list */ memcpy (p->string, str, nbytes); p->len = nbytes; memcpy ((char *) p->modifiers, (char *) mlist, nb); p->key = keysym; p->mlen = nm; ComputeMaskFromKeytrans(dpy, p); UnlockDisplay(dpy); return 0; } unsigned _XKeysymToModifiers( Display *dpy, KeySym ks) { CARD8 code,mods; register KeySym *kmax; register KeySym *k; register XModifierKeymap *m; if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) return 0; kmax = dpy->keysyms + (dpy->max_keycode - dpy->min_keycode + 1) * dpy->keysyms_per_keycode; k = dpy->keysyms; m = dpy->modifiermap; mods= 0; while (kmax_keypermod<<3; code=(((k-dpy->keysyms)/dpy->keysyms_per_keycode)+dpy->min_keycode); while (--j >= 0) { if (code == m->modifiermap[j]) mods|= (1<<(j/m->max_keypermod)); } } k++; } return mods; } /* * given a list of modifiers, computes the mask necessary for later matching. * This routine must lookup the key in the Keymap and then search to see * what modifier it is bound to, if any. Sets the AnyModifier bit if it * can't map some keysym to a modifier. */ static void ComputeMaskFromKeytrans( Display *dpy, register struct _XKeytrans *p) { register int i; p->state = AnyModifier; for (i = 0; i < p->mlen; i++) { p->state|= XkbKeysymToModifiers(dpy,p->modifiers[i]); } p->state &= AllMods; } nx-libs-3.5.99.23/nx-X11/lib/src/Key.h0000644000000000000000000000042613614532331013543 0ustar #ifndef _KEY_H_ #define _KEY_H_ #include #include #ifndef NEEDKTABLE extern const unsigned char _XkeyTable[]; #endif extern int _XKeyInitialize( Display *dpy); extern XrmDatabase _XInitKeysymDB( void); #endif /* _KEY_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/KeysymStr.c0000644000000000000000000000731213614532331014761 0ustar /* Copyright 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include #include "Xresinternal.h" #include /* sprintf */ #define NEEDVTABLE #include "ks_tables.h" #include "Key.h" typedef struct _GRNData { char *name; XrmRepresentation type; XrmValuePtr value; } GRNData; /*ARGSUSED*/ static Bool SameValue( XrmDatabase* db, XrmBindingList bindings, XrmQuarkList quarks, XrmRepresentation* type, XrmValuePtr value, XPointer data ) { GRNData *gd = (GRNData *)data; if ((*type == gd->type) && (value->size == gd->value->size) && !strncmp((char *)value->addr, (char *)gd->value->addr, value->size)) { gd->name = XrmQuarkToString(*quarks); /* XXX */ return True; } return False; } char *XKeysymToString(KeySym ks) { XrmDatabase keysymdb; if (!ks || (ks & ((unsigned long) ~0x1fffffff)) != 0) return ((char *)NULL); if (ks == XK_VoidSymbol) ks = 0; if (ks <= 0x1fffffff) { unsigned char val1 = ks >> 24; unsigned char val2 = (ks >> 16) & 0xff; unsigned char val3 = (ks >> 8) & 0xff; unsigned char val4 = ks & 0xff; int i = ks % VTABLESIZE; int h = i + 1; int n = VMAXHASH; int idx; while ((idx = hashKeysym[i])) { const unsigned char *entry = &_XkeyTable[idx]; if ((entry[0] == val1) && (entry[1] == val2) && (entry[2] == val3) && (entry[3] == val4)) return ((char *)entry + 4); if (!--n) break; i += h; if (i >= VTABLESIZE) i -= VTABLESIZE; } } if ((keysymdb = _XInitKeysymDB())) { char buf[9]; XrmValue resval; XrmQuark empty = NULLQUARK; GRNData data; snprintf(buf, sizeof(buf), "%lX", ks); resval.addr = (XPointer)buf; resval.size = strlen(buf) + 1; data.name = (char *)NULL; data.type = XrmPermStringToQuark("String"); data.value = &resval; (void)XrmEnumerateDatabase(keysymdb, &empty, &empty, XrmEnumAllLevels, SameValue, (XPointer)&data); if (data.name) return data.name; } if (ks >= 0x01000100 && ks <= 0x0110ffff) { KeySym val = ks & 0xffffff; char *s; int i; if (val & 0xff0000) i = 10; else i = 6; s = Xmalloc(i); if (s == NULL) return s; i--; s[i--] = '\0'; for (; i; i--){ unsigned char val1 = val & 0xf; val >>= 4; if (val1 < 10) s[i] = '0'+ val1; else s[i] = 'A'+ val1 - 10; } s[i] = 'U'; return s; } return ((char *) NULL); } nx-libs-3.5.99.23/nx-X11/lib/src/KillCl.c0000644000000000000000000000261113614532331014156 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XKillClient( register Display *dpy, XID resource) { register xResourceReq *req; LockDisplay(dpy); GetResReq(KillClient, resource, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/LiHosts.c0000644000000000000000000001257713614532331014405 0ustar /* Copyright 1986, 1998 The Open Group All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. X Window System is a trademark of The Open Group. */ /* * Copyright 2004 Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /* This can really be considered an os dependent routine */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include /* * can be freed using XFree. */ XHostAddress *XListHosts ( register Display *dpy, int *nhosts, /* RETURN */ Bool *enabled) /* RETURN */ { register XHostAddress *outbuf = NULL, *op; xListHostsReply reply; unsigned char *buf, *bp; register unsigned i; _X_UNUSED register xListHostsReq *req; XServerInterpretedAddress *sip; *nhosts = 0; LockDisplay(dpy); GetReq (ListHosts, req); if (!_XReply (dpy, (xReply *) &reply, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return (XHostAddress *) NULL; } if (reply.nHosts) { unsigned long nbytes = reply.length << 2; /* number of bytes in reply */ const unsigned long max_hosts = INT_MAX / (sizeof(XHostAddress) + sizeof(XServerInterpretedAddress)); if (reply.nHosts < max_hosts) { unsigned long hostbytes = reply.nHosts * (sizeof(XHostAddress) + sizeof(XServerInterpretedAddress)); if (reply.length < (INT_MAX >> 2) && (hostbytes >> 2) < ((INT_MAX >> 2) - reply.length)) outbuf = Xmalloc(nbytes + hostbytes); } if (! outbuf) { _XEatDataWords(dpy, reply.length); UnlockDisplay(dpy); SyncHandle(); return (XHostAddress *) NULL; } op = outbuf; sip = (XServerInterpretedAddress *) (((unsigned char *) outbuf) + (reply.nHosts * sizeof(XHostAddress))); bp = buf = ((unsigned char *) sip) + (reply.nHosts * sizeof(XServerInterpretedAddress)); _XRead (dpy, (char *) buf, nbytes); for (i = 0; i < reply.nHosts; i++) { if (bp > buf + nbytes - SIZEOF(xHostEntry)) goto fail; op->family = ((xHostEntry *) bp)->family; op->length =((xHostEntry *) bp)->length; if (op->family == FamilyServerInterpreted) { char *tp = (char *) (bp + SIZEOF(xHostEntry)); char *vp; if (tp > (char *) (buf + nbytes - op->length)) goto fail; vp = memchr(tp, 0, op->length); if (vp != NULL) { sip->type = tp; sip->typelength = vp - tp; sip->value = vp + 1; sip->valuelength = op->length - (sip->typelength + 1); } else { sip->type = sip->value = NULL; sip->typelength = sip->valuelength = 0; } op->address = (char *) sip; sip++; } else { op->address = (char *) (bp + SIZEOF(xHostEntry)); if (op->address > (char *) (buf + nbytes - op->length)) goto fail; } bp += SIZEOF(xHostEntry) + (((op->length + 3) >> 2) << 2); op++; } } *enabled = reply.enabled; *nhosts = reply.nHosts; UnlockDisplay(dpy); SyncHandle(); return (outbuf); fail: *enabled = reply.enabled; *nhosts = 0; Xfree(outbuf); return (NULL); } nx-libs-3.5.99.23/nx-X11/lib/src/LiICmaps.c0000644000000000000000000000405613614532331014452 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Colormap *XListInstalledColormaps( register Display *dpy, Window win, int *n) /* RETURN */ { unsigned long nbytes; Colormap *cmaps; xListInstalledColormapsReply rep; register xResourceReq *req; LockDisplay(dpy); GetResReq(ListInstalledColormaps, win, req); if(_XReply(dpy, (xReply *) &rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); *n = 0; return((Colormap *) NULL); } if (rep.nColormaps) { nbytes = rep.nColormaps * sizeof(Colormap); cmaps = Xmalloc(nbytes); if (! cmaps) { _XEatDataWords(dpy, rep.length); UnlockDisplay(dpy); SyncHandle(); return((Colormap *) NULL); } nbytes = rep.nColormaps << 2; _XRead32 (dpy, (long *) cmaps, nbytes); } else cmaps = (Colormap *) NULL; *n = rep.nColormaps; UnlockDisplay(dpy); SyncHandle(); return(cmaps); } nx-libs-3.5.99.23/nx-X11/lib/src/LiProps.c0000644000000000000000000000405613614532331014401 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Atom *XListProperties( register Display *dpy, Window window, int *n_props) /* RETURN */ { unsigned long nbytes; xListPropertiesReply rep; Atom *properties; register xResourceReq *req; LockDisplay(dpy); GetResReq(ListProperties, window, req); if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { *n_props = 0; UnlockDisplay(dpy); SyncHandle(); return ((Atom *) NULL); } if (rep.nProperties) { nbytes = rep.nProperties * sizeof(Atom); properties = Xmalloc (nbytes); if (! properties) { _XEatDataWords(dpy, rep.length); UnlockDisplay(dpy); SyncHandle(); return (Atom *) NULL; } nbytes = rep.nProperties << 2; _XRead32 (dpy, (long *) properties, nbytes); } else properties = (Atom *) NULL; *n_props = rep.nProperties; UnlockDisplay(dpy); SyncHandle(); return (properties); } nx-libs-3.5.99.23/nx-X11/lib/src/ListExt.c0000644000000000000000000000552013614532331014402 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include char **XListExtensions( register Display *dpy, int *nextensions) /* RETURN */ { xListExtensionsReply rep; char **list = NULL; char *ch = NULL; char *chend; int count = 0; register unsigned i; register int length; _X_UNUSED register xReq *req; unsigned long rlen = 0; LockDisplay(dpy); GetEmptyReq (ListExtensions, req); if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return (char **) NULL; } if (rep.nExtensions) { list = Xmalloc (rep.nExtensions * sizeof (char *)); if (rep.length > 0 && rep.length < (INT_MAX >> 2)) { rlen = rep.length << 2; ch = Xmalloc (rlen + 1); /* +1 to leave room for last null-terminator */ } if ((!list) || (!ch)) { Xfree(list); Xfree(ch); _XEatDataWords(dpy, rep.length); UnlockDisplay(dpy); SyncHandle(); return (char **) NULL; } _XReadPad (dpy, ch, rlen); /* * unpack into null terminated strings. */ chend = ch + rlen; length = *(unsigned char *)ch; for (i = 0; i < rep.nExtensions; i++) { if (ch + length < chend) { list[i] = ch+1; /* skip over length */ ch += length + 1; /* find next length ... */ length = *(unsigned char *)ch; *ch = '\0'; /* and replace with null-termination */ count++; } else if (i == 0) { Xfree(list); Xfree(ch); list = NULL; break; } else list[i] = NULL; } } *nextensions = count; UnlockDisplay(dpy); SyncHandle(); return (list); } int XFreeExtensionList (char **list) { if (list != NULL) { Xfree (list[0]-1); Xfree (list); } return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/LoadFont.c0000644000000000000000000000337513614532331014522 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Font XLoadFont ( register Display *dpy, _Xconst char *name) { register long nbytes; Font fid; register xOpenFontReq *req; if (_XF86LoadQueryLocaleFont(dpy, name, (XFontStruct **)0, &fid)) return fid; LockDisplay(dpy); GetReq(OpenFont, req); nbytes = req->nbytes = name ? strlen(name) : 0; req->fid = fid = XAllocID(dpy); req->length += (nbytes+3)>>2; Data (dpy, name, nbytes); UnlockDisplay(dpy); SyncHandle(); return (fid); /* can't return (req->fid) since request may have already been sent */ } nx-libs-3.5.99.23/nx-X11/lib/src/LockDis.c0000644000000000000000000000460113614532331014335 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Stephen Gildea, MIT X Consortium * * XLockDis.c - multi-thread application-level locking routines */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #ifdef XTHREADS #include "locking.h" #endif void XLockDisplay( register Display* dpy) { #ifdef XTHREADS LockDisplay(dpy); if (dpy->lock) (*dpy->lock->user_lock_display)(dpy); /* * We want the threads in the reply queue to all get out before * XLockDisplay returns, in case they have any side effects the * caller of XLockDisplay was trying to protect against. * XLockDisplay puts itself at the head of the event waiters queue * to wait for all the replies to come in. */ if (dpy->lock && dpy->lock->reply_awaiters) { struct _XCVList *cvl; cvl = (*dpy->lock->create_cvl)(dpy); /* stuff ourselves on the head of the queue */ cvl->next = dpy->lock->event_awaiters; dpy->lock->event_awaiters = cvl; while (dpy->lock->reply_awaiters) ConditionWait(dpy, cvl->cv); UnlockNextEventReader(dpy); /* pass the signal on */ } UnlockDisplay(dpy); #endif } void XUnlockDisplay( register Display* dpy) { #ifdef XTHREADS LockDisplay(dpy); if (dpy->lock) (*dpy->lock->user_unlock_display)(dpy); UnlockDisplay(dpy); #endif } nx-libs-3.5.99.23/nx-X11/lib/src/locking.c0000644000000000000000000003740213614532331014440 0ustar /* Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Stephen Gildea, MIT X Consortium * * locking.c - multi-thread locking routines implemented in C Threads */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #undef _XLockMutex #undef _XUnlockMutex #undef _XCreateMutex #undef _XFreeMutex #ifdef XTHREADS #ifdef __UNIXWARE__ #include #endif #include "Xprivate.h" #include "locking.h" #ifdef XTHREADS_WARN #include /* for warn/debug stuff */ #endif /* Additional arguments for source code location lock call was made from */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) # define XTHREADS_FILE_LINE_ARGS \ , \ char* file, /* source file, from macro */ \ int line #else # define XTHREADS_FILE_LINE_ARGS /* None */ #endif #define NUM_FREE_CVLS 4 /* in lcWrap.c */ extern LockInfoPtr _Xi18n_lock; #ifdef WIN32 static DWORD _X_TlsIndex = (DWORD)-1; void _Xthread_init(void) { if (_X_TlsIndex == (DWORD)-1) _X_TlsIndex = TlsAlloc(); } struct _xthread_waiter * _Xthread_waiter(void) { struct _xthread_waiter *me; if (!(me = TlsGetValue(_X_TlsIndex))) { me = xmalloc(sizeof(struct _xthread_waiter)); me->sem = CreateSemaphore(NULL, 0, 1, NULL); me->next = NULL; TlsSetValue(_X_TlsIndex, me); } return me; } #endif /* WIN32 */ static xthread_t _Xthread_self(void) { return xthread_self(); } static LockInfoRec global_lock; static LockInfoRec i18n_lock; static void _XLockMutex( LockInfoPtr lip XTHREADS_FILE_LINE_ARGS ) { xmutex_lock(lip->lock); } static void _XUnlockMutex( LockInfoPtr lip XTHREADS_FILE_LINE_ARGS ) { xmutex_unlock(lip->lock); } static void _XCreateMutex( LockInfoPtr lip) { lip->lock = xmutex_malloc(); if (lip->lock) { xmutex_init(lip->lock); xmutex_set_name(lip->lock, "Xlib"); } } static void _XFreeMutex( LockInfoPtr lip) { xmutex_clear(lip->lock); xmutex_free(lip->lock); } #ifdef XTHREADS_WARN static char *locking_file; static int locking_line; static xthread_t locking_thread; static Bool xlibint_unlock = False; /* XlibInt.c may Unlock and re-Lock */ /* history that is useful to examine in a debugger */ #define LOCK_HIST_SIZE 21 static struct { Bool lockp; /* True for lock, False for unlock */ xthread_t thread; char *file; int line; } locking_history[LOCK_HIST_SIZE]; int lock_hist_loc = 0; /* next slot to fill */ static void _XLockDisplayWarn( Display *dpy, char *file, /* source file, from macro */ int line) { xthread_t self; xthread_t old_locker; self = xthread_self(); old_locker = locking_thread; if (xthread_have_id(old_locker)) { if (xthread_equal(old_locker, self)) printf("Xlib ERROR: %s line %d thread %x: locking display already locked at %s line %d\n", file, line, self, locking_file, locking_line); #ifdef XTHREADS_DEBUG else printf("%s line %d: thread %x waiting on lock held by %s line %d thread %x\n", file, line, self, locking_file, locking_line, old_locker); #endif /* XTHREADS_DEBUG */ } xmutex_lock(dpy->lock->mutex); if (strcmp(file, "XlibInt.c") == 0) { if (!xlibint_unlock) printf("Xlib ERROR: XlibInt.c line %d thread %x locking display it did not unlock\n", line, self); xlibint_unlock = False; } #ifdef XTHREADS_DEBUG /* if (old_locker && old_locker != self) */ if (strcmp("XClearArea.c", file) && strcmp("XDrSegs.c", file)) /* ico */ printf("%s line %d: thread %x got display lock\n", file, line, self); #endif /* XTHREADS_DEBUG */ locking_thread = self; if (strcmp(file, "XlibInt.c") != 0) { locking_file = file; locking_line = line; } locking_history[lock_hist_loc].file = file; locking_history[lock_hist_loc].line = line; locking_history[lock_hist_loc].thread = self; locking_history[lock_hist_loc].lockp = True; lock_hist_loc++; if (lock_hist_loc >= LOCK_HIST_SIZE) lock_hist_loc = 0; } #endif /* XTHREADS_WARN */ static void _XUnlockDisplay( Display *dpy XTHREADS_FILE_LINE_ARGS ) { #ifdef XTHREADS_WARN xthread_t self = xthread_self(); #ifdef XTHREADS_DEBUG if (strcmp("XClearArea.c", file) && strcmp("XDrSegs.c", file)) /* ico */ printf("%s line %d: thread %x unlocking display\n", file, line, self); #endif /* XTHREADS_DEBUG */ if (!xthread_have_id(locking_thread)) printf("Xlib ERROR: %s line %d thread %x: unlocking display that is not locked\n", file, line, self); else if (strcmp(file, "XlibInt.c") == 0) xlibint_unlock = True; #ifdef XTHREADS_DEBUG else if (strcmp(file, locking_file) != 0) /* not always an error because locking_file is not per-thread */ printf("%s line %d: unlocking display locked from %s line %d (probably okay)\n", file, line, locking_file, locking_line); #endif /* XTHREADS_DEBUG */ xthread_clear_id(locking_thread); locking_history[lock_hist_loc].file = file; locking_history[lock_hist_loc].line = line; locking_history[lock_hist_loc].thread = self; locking_history[lock_hist_loc].lockp = False; lock_hist_loc++; if (lock_hist_loc >= LOCK_HIST_SIZE) lock_hist_loc = 0; #endif /* XTHREADS_WARN */ xmutex_unlock(dpy->lock->mutex); } static struct _XCVList *_XCreateCVL( Display *dpy) { struct _XCVList *cvl; if ((cvl = dpy->lock->free_cvls) != NULL) { dpy->lock->free_cvls = cvl->next; dpy->lock->num_free_cvls--; } else { cvl = Xmalloc(sizeof(struct _XCVList)); if (!cvl) return NULL; cvl->cv = xcondition_malloc(); if (!cvl->cv) { Xfree(cvl); return NULL; } xcondition_init(cvl->cv); xcondition_set_name(cvl->cv, "Xlib read queue"); } cvl->next = NULL; return cvl; } /* Put ourselves on the queue to read the connection. Allocates and returns a queue element. */ static struct _XCVList * _XPushReader( Display *dpy, struct _XCVList ***tail) { struct _XCVList *cvl; cvl = _XCreateCVL(dpy); #ifdef XTHREADS_DEBUG printf("_XPushReader called in thread %x, pushing %x\n", xthread_self(), cvl); #endif **tail = cvl; *tail = &cvl->next; return cvl; } /* signal the next thread waiting to read the connection */ static void _XPopReader( Display *dpy, struct _XCVList **list, struct _XCVList ***tail) { register struct _XCVList *front = *list; #ifdef XTHREADS_DEBUG printf("_XPopReader called in thread %x, popping %x\n", xthread_self(), front); #endif if (dpy->flags & XlibDisplayProcConni) /* we never added ourself in the first place */ return; if (front) { /* check "front" for paranoia */ *list = front->next; if (*tail == &front->next) /* did we free the last elt? */ *tail = list; if (dpy->lock->num_free_cvls < NUM_FREE_CVLS) { front->next = dpy->lock->free_cvls; dpy->lock->free_cvls = front; dpy->lock->num_free_cvls++; } else { xcondition_clear(front->cv); Xfree(front->cv); Xfree(front); } } /* signal new front after it is in place */ if ((dpy->lock->reply_first = (dpy->lock->reply_awaiters != NULL))) { ConditionSignal(dpy, dpy->lock->reply_awaiters->cv); } else if (dpy->lock->event_awaiters) { ConditionSignal(dpy, dpy->lock->event_awaiters->cv); } } static void _XConditionWait( xcondition_t cv, xmutex_t mutex XTHREADS_FILE_LINE_ARGS ) { #ifdef XTHREADS_WARN xthread_t self = xthread_self(); char *old_file = locking_file; int old_line = locking_line; #ifdef XTHREADS_DEBUG printf("line %d thread %x in condition wait\n", line, self); #endif xthread_clear_id(locking_thread); locking_history[lock_hist_loc].file = file; locking_history[lock_hist_loc].line = line; locking_history[lock_hist_loc].thread = self; locking_history[lock_hist_loc].lockp = False; lock_hist_loc++; if (lock_hist_loc >= LOCK_HIST_SIZE) lock_hist_loc = 0; #endif /* XTHREADS_WARN */ xcondition_wait(cv, mutex); #ifdef XTHREADS_WARN locking_thread = self; locking_file = old_file; locking_line = old_line; locking_history[lock_hist_loc].file = file; locking_history[lock_hist_loc].line = line; locking_history[lock_hist_loc].thread = self; locking_history[lock_hist_loc].lockp = True; lock_hist_loc++; if (lock_hist_loc >= LOCK_HIST_SIZE) lock_hist_loc = 0; #ifdef XTHREADS_DEBUG printf("line %d thread %x was signaled\n", line, self); #endif /* XTHREADS_DEBUG */ #endif /* XTHREADS_WARN */ } static void _XConditionSignal( xcondition_t cv XTHREADS_FILE_LINE_ARGS ) { #ifdef XTHREADS_WARN #ifdef XTHREADS_DEBUG printf("line %d thread %x is signalling\n", line, xthread_self()); #endif #endif xcondition_signal(cv); } static void _XConditionBroadcast( xcondition_t cv XTHREADS_FILE_LINE_ARGS ) { #ifdef XTHREADS_WARN #ifdef XTHREADS_DEBUG printf("line %d thread %x is broadcasting\n", line, xthread_self()); #endif #endif xcondition_broadcast(cv); } static void _XFreeDisplayLock( Display *dpy) { struct _XCVList *cvl; if (dpy->lock != NULL) { if (dpy->lock->mutex != NULL) { xmutex_clear(dpy->lock->mutex); xmutex_free(dpy->lock->mutex); } if (dpy->lock->cv != NULL) { xcondition_clear(dpy->lock->cv); xcondition_free(dpy->lock->cv); } if (dpy->lock->writers != NULL) { xcondition_clear(dpy->lock->writers); xcondition_free(dpy->lock->writers); } while ((cvl = dpy->lock->free_cvls)) { dpy->lock->free_cvls = cvl->next; xcondition_clear(cvl->cv); Xfree(cvl->cv); Xfree(cvl); } Xfree(dpy->lock); dpy->lock = NULL; } if (dpy->lock_fns != NULL) { Xfree(dpy->lock_fns); dpy->lock_fns = NULL; } } /* * wait for thread with user-level display lock to release it. */ static void _XDisplayLockWait( Display *dpy) { xthread_t self; while (dpy->lock->locking_level > 0) { self = xthread_self(); if (xthread_equal(dpy->lock->locking_thread, self)) break; ConditionWait(dpy, dpy->lock->cv); } } static void _XLockDisplay( Display *dpy XTHREADS_FILE_LINE_ARGS ) { #ifdef XTHREADS_WARN _XLockDisplayWarn(dpy, file, line); #else xmutex_lock(dpy->lock->mutex); #endif if (dpy->lock->locking_level > 0) _XDisplayLockWait(dpy); _XIDHandler(dpy); _XSeqSyncFunction(dpy); } /* * _XReply is allowed to exit from select/poll and clean up even if a * user-level lock is in force, so it uses this instead of _XFancyLockDisplay. */ static void _XInternalLockDisplay( Display *dpy, Bool wskip XTHREADS_FILE_LINE_ARGS ) { #ifdef XTHREADS_WARN _XLockDisplayWarn(dpy, file, line); #else xmutex_lock(dpy->lock->mutex); #endif if (!wskip && dpy->lock->locking_level > 0) _XDisplayLockWait(dpy); } static void _XUserLockDisplay( register Display* dpy) { _XDisplayLockWait(dpy); if (++dpy->lock->locking_level == 1) { dpy->lock->lock_wait = _XDisplayLockWait; dpy->lock->locking_thread = xthread_self(); } } static void _XUserUnlockDisplay( register Display* dpy) { if (dpy->lock->locking_level > 0 && --dpy->lock->locking_level == 0) { /* signal other threads that might be waiting in XLockDisplay */ ConditionBroadcast(dpy, dpy->lock->cv); dpy->lock->lock_wait = NULL; xthread_clear_id(dpy->lock->locking_thread); } } /* returns 0 if initialized ok, -1 if unable to allocate a mutex or other memory */ static int _XInitDisplayLock( Display *dpy) { dpy->lock_fns = Xmalloc(sizeof(struct _XLockPtrs)); if (dpy->lock_fns == NULL) return -1; dpy->lock = Xmalloc(sizeof(struct _XLockInfo)); if (dpy->lock == NULL) { _XFreeDisplayLock(dpy); return -1; } dpy->lock->cv = xcondition_malloc(); dpy->lock->mutex = xmutex_malloc(); dpy->lock->writers = xcondition_malloc(); if (!dpy->lock->cv || !dpy->lock->mutex || !dpy->lock->writers) { _XFreeDisplayLock(dpy); return -1; } dpy->lock->reply_bytes_left = 0; dpy->lock->reply_was_read = False; dpy->lock->reply_awaiters = NULL; dpy->lock->reply_awaiters_tail = &dpy->lock->reply_awaiters; dpy->lock->event_awaiters = NULL; dpy->lock->event_awaiters_tail = &dpy->lock->event_awaiters; dpy->lock->reply_first = False; dpy->lock->locking_level = 0; dpy->lock->num_free_cvls = 0; dpy->lock->free_cvls = NULL; xthread_clear_id(dpy->lock->locking_thread); xthread_clear_id(dpy->lock->reading_thread); xthread_clear_id(dpy->lock->conni_thread); xmutex_init(dpy->lock->mutex); xmutex_set_name(dpy->lock->mutex, "Xlib Display"); xcondition_init(dpy->lock->cv); xcondition_set_name(dpy->lock->cv, "XLockDisplay"); xcondition_init(dpy->lock->writers); xcondition_set_name(dpy->lock->writers, "Xlib wait for writable"); dpy->lock_fns->lock_display = _XLockDisplay; dpy->lock->internal_lock_display = _XInternalLockDisplay; dpy->lock_fns->unlock_display = _XUnlockDisplay; dpy->lock->user_lock_display = _XUserLockDisplay; dpy->lock->user_unlock_display = _XUserUnlockDisplay; dpy->lock->pop_reader = _XPopReader; dpy->lock->push_reader = _XPushReader; dpy->lock->condition_wait = _XConditionWait; dpy->lock->condition_signal = _XConditionSignal; dpy->lock->condition_broadcast = _XConditionBroadcast; dpy->lock->create_cvl = _XCreateCVL; dpy->lock->lock_wait = NULL; /* filled in by XLockDisplay() */ return 0; } #ifdef __UNIXWARE__ xthread_t __x11_thr_self() { return 0; } xthread_t (*_x11_thr_self)() = __x11_thr_self; #endif Status XInitThreads(void) { if (_Xglobal_lock) return 1; #ifdef __UNIXWARE__ else { void *dl_handle = dlopen(NULL, RTLD_LAZY); if (!dl_handle || ((_x11_thr_self = (xthread_t(*)())dlsym(dl_handle,"thr_self")) == 0)) { _x11_thr_self = __x11_thr_self; (void) fprintf (stderr, "XInitThreads called, but no libthread in the calling program!\n" ); } } #endif /* __UNIXWARE__ */ #ifdef xthread_init xthread_init(); /* return value? */ #endif if (!(global_lock.lock = xmutex_malloc())) return 0; if (!(i18n_lock.lock = xmutex_malloc())) { xmutex_free(global_lock.lock); global_lock.lock = NULL; return 0; } _Xglobal_lock = &global_lock; xmutex_init(_Xglobal_lock->lock); xmutex_set_name(_Xglobal_lock->lock, "Xlib global"); _Xi18n_lock = &i18n_lock; xmutex_init(_Xi18n_lock->lock); xmutex_set_name(_Xi18n_lock->lock, "Xlib i18n"); _XLockMutex_fn = _XLockMutex; _XUnlockMutex_fn = _XUnlockMutex; _XCreateMutex_fn = _XCreateMutex; _XFreeMutex_fn = _XFreeMutex; _XInitDisplayLock_fn = _XInitDisplayLock; _XFreeDisplayLock_fn = _XFreeDisplayLock; _Xthread_self_fn = _Xthread_self; #ifdef XTHREADS_WARN #ifdef XTHREADS_DEBUG setlinebuf(stdout); /* for debugging messages */ #endif #endif return 1; } #else /* XTHREADS */ Status XInitThreads(void) { return 0; } #endif /* XTHREADS */ nx-libs-3.5.99.23/nx-X11/lib/src/locking.h0000644000000000000000000001157313614532331014446 0ustar /* Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Stephen Gildea, MIT X Consortium * * locking.h - data types for C Threads locking. * Used by XlibInt.c, locking.c, LockDis.c */ #ifndef _X_locking_H_ #define _X_locking_H_ #define xmalloc(s) Xmalloc(s) #define xfree(s) Xfree(s) #include #include #include struct _XCVList { xcondition_t cv; xReply *buf; struct _XCVList *next; }; extern xthread_t (*_Xthread_self_fn)( /* in XlibInt.c */ void ); /* Display->lock is a pointer to one of these */ struct _XLockInfo { xmutex_t mutex; /* mutex for critical sections */ int reply_bytes_left; /* nbytes of the reply still to read */ Bool reply_was_read; /* _XReadEvents read a reply for _XReply */ struct _XCVList *reply_awaiters; /* list of CVs for _XReply */ struct _XCVList **reply_awaiters_tail; struct _XCVList *event_awaiters; /* list of CVs for _XReadEvents */ struct _XCVList **event_awaiters_tail; Bool reply_first; /* who may read, reply queue or event queue */ /* for XLockDisplay */ int locking_level; /* how many times into XLockDisplay we are */ xthread_t locking_thread; /* thread that did XLockDisplay */ xcondition_t cv; /* wait if another thread has XLockDisplay */ xthread_t reading_thread; /* cache */ xthread_t conni_thread; /* thread in XProcessInternalConnection */ xcondition_t writers; /* wait for writable */ int num_free_cvls; struct _XCVList *free_cvls; /* used only in XlibInt.c */ void (*pop_reader)( Display* /* dpy */, struct _XCVList** /* list */, struct _XCVList*** /* tail */ ); struct _XCVList *(*push_reader)( Display * /* dpy */, struct _XCVList*** /* tail */ ); void (*condition_wait)( xcondition_t /* cv */, xmutex_t /* mutex */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char* /* file */, int /* line */ #endif ); void (*internal_lock_display)( Display* /* dpy */, Bool /* wskip */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char* /* file */, int /* line */ #endif ); /* used in XlibInt.c and locking.c */ void (*condition_signal)( xcondition_t /* cv */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char* /* file */, int /* line */ #endif ); void (*condition_broadcast)( xcondition_t /* cv */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char* /* file */, int /* line */ #endif ); /* used in XlibInt.c and XLockDis.c */ void (*lock_wait)( Display* /* dpy */ ); void (*user_lock_display)( Display* /* dpy */ ); void (*user_unlock_display)( Display* /* dpy */ ); struct _XCVList *(*create_cvl)( Display * /* dpy */ ); }; #define UnlockNextEventReader(d) if ((d)->lock) \ (*(d)->lock->pop_reader)((d),&(d)->lock->event_awaiters,&(d)->lock->event_awaiters_tail) #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) #define ConditionWait(d,c) if ((d)->lock) \ (*(d)->lock->condition_wait)(c, (d)->lock->mutex,__FILE__,__LINE__) #define ConditionSignal(d,c) if ((d)->lock) \ (*(d)->lock->condition_signal)(c,__FILE__,__LINE__) #define ConditionBroadcast(d,c) if ((d)->lock) \ (*(d)->lock->condition_broadcast)(c,__FILE__,__LINE__) #else #define ConditionWait(d,c) if ((d)->lock) \ (*(d)->lock->condition_wait)(c, (d)->lock->mutex) #define ConditionSignal(d,c) if ((d)->lock) \ (*(d)->lock->condition_signal)(c) #define ConditionBroadcast(d,c) if ((d)->lock) \ (*(d)->lock->condition_broadcast)(c) #endif typedef struct _LockInfoRec { xmutex_t lock; } LockInfoRec; /* XOpenDis.c */ extern int (*_XInitDisplayLock_fn)(Display *dpy); extern void (*_XFreeDisplayLock_fn)(Display *dpy); #endif /* _X_locking_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/LookupCol.c0000644000000000000000000000541313614532331014716 0ustar /* Copyright 1985, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xcmsint.h" Status XLookupColor ( register Display *dpy, Colormap cmap, _Xconst char *spec, XColor *def, XColor *scr) { register int n; xLookupColorReply reply; register xLookupColorReq *req; XcmsCCC ccc; XcmsColor cmsColor_exact; #ifdef XCMS /* * Let's Attempt to use Xcms and i18n approach to Parse Color */ if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { const char *tmpName = spec; switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact, XcmsRGBFormat)) { case XcmsSuccess: case XcmsSuccessWithCompression: _XcmsRGB_to_XColor(&cmsColor_exact, def, 1); memcpy((char *)scr, (char *)def, sizeof(XColor)); _XUnresolveColor(ccc, scr); return(1); case XcmsFailure: case _XCMS_NEWNAME: /* * if the result was _XCMS_NEWNAME tmpName points to * a string in cmsColNm.c:pairs table, for example, * gray70 would become tekhvc:0.0/70.0/0.0 */ break; } } #endif /* * Xcms and i18n methods failed, so lets pass it to the server * for parsing. */ n = strlen (spec); LockDisplay(dpy); GetReq (LookupColor, req); req->cmap = cmap; req->nbytes = n; req->length += (n + 3) >> 2; Data (dpy, spec, (long)n); if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) { UnlockDisplay(dpy); SyncHandle(); return (0); } def->red = reply.exactRed; def->green = reply.exactGreen; def->blue = reply.exactBlue; scr->red = reply.screenRed; scr->green = reply.screenGreen; scr->blue = reply.screenBlue; UnlockDisplay(dpy); SyncHandle(); return (1); } nx-libs-3.5.99.23/nx-X11/lib/src/LowerWin.c0000644000000000000000000000307713614532331014561 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XLowerWindow( Display *dpy, Window w) { register xConfigureWindowReq *req; unsigned long val = Below; /* needed for macro */ LockDisplay(dpy); GetReqExtra(ConfigureWindow, 4, req); req->window = w; req->mask = CWStackMode; OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), val); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/Macros.c0000644000000000000000000001611513614532331014234 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #define XUTIL_DEFINE_FUNCTIONS #include "Xutil.h" #if USE_XCB #include "Xxcbint.h" #endif /* * This file makes full definitions of routines for each macro. * We do not expect C programs to use these, but other languages may * need them. */ int XConnectionNumber(Display *dpy) { return (ConnectionNumber(dpy)); } Window XRootWindow (Display *dpy, int scr) { return (RootWindow(dpy,scr)); } int XDefaultScreen(Display *dpy) { return (DefaultScreen(dpy)); } Window XDefaultRootWindow (Display *dpy) { return (RootWindow(dpy,DefaultScreen(dpy))); } Visual *XDefaultVisual(Display *dpy, int scr) { return (DefaultVisual(dpy, scr)); } GC XDefaultGC(Display *dpy, int scr) { return (DefaultGC(dpy,scr)); } unsigned long XBlackPixel(Display *dpy, int scr) { return (BlackPixel(dpy, scr)); } unsigned long XWhitePixel(Display *dpy, int scr) { return (WhitePixel(dpy,scr)); } unsigned long XAllPlanes(void) { return AllPlanes; } int XQLength(Display *dpy) { return (QLength(dpy)); } int XDisplayWidth(Display *dpy, int scr) { return (DisplayWidth(dpy,scr)); } int XDisplayHeight(Display *dpy, int scr) { return (DisplayHeight(dpy, scr)); } int XDisplayWidthMM(Display *dpy, int scr) { return (DisplayWidthMM(dpy, scr)); } int XDisplayHeightMM(Display *dpy, int scr) { return (DisplayHeightMM(dpy, scr)); } int XDisplayPlanes(Display *dpy, int scr) { return (DisplayPlanes(dpy, scr)); } int XDisplayCells(Display *dpy, int scr) { return (DisplayCells (dpy, scr)); } int XScreenCount(Display *dpy) { return (ScreenCount(dpy)); } char *XServerVendor(Display *dpy) { return (ServerVendor(dpy)); } int XProtocolVersion(Display *dpy) { return (ProtocolVersion(dpy)); } int XProtocolRevision(Display *dpy) { return (ProtocolRevision(dpy));} int XVendorRelease(Display *dpy) { return (VendorRelease(dpy)); } char *XDisplayString(Display *dpy) { return (DisplayString(dpy)); } int XDefaultDepth(Display *dpy, int scr) { return(DefaultDepth(dpy, scr)); } Colormap XDefaultColormap(Display *dpy, int scr) { return (DefaultColormap(dpy, scr)); } int XBitmapUnit(Display *dpy) { return (BitmapUnit(dpy)); } int XBitmapBitOrder(Display *dpy) { return (BitmapBitOrder(dpy)); } int XBitmapPad(Display *dpy) { return (BitmapPad(dpy)); } int XImageByteOrder(Display *dpy) { return (ImageByteOrder(dpy)); } #if !USE_XCB unsigned long XNextRequest(Display *dpy) { return (NextRequest(dpy)); } #else /* XNextRequest() differs from the rest of the functions here because it is * no longer a macro wrapper - when libX11 is being used mixed together * with direct use of xcb, the next request field of the Display structure will * not be updated. We can't fix the NextRequest() macro in any easy way, * but we can at least make XNextRequest() do the right thing. */ unsigned long XNextRequest(Display *dpy) { unsigned long next_request; LockDisplay(dpy); next_request = _XNextRequest(dpy); UnlockDisplay(dpy); return next_request; } #endif unsigned long XLastKnownRequestProcessed(Display *dpy) { return (LastKnownRequestProcessed(dpy)); } /* screen oriented macros (toolkit) */ Screen *XScreenOfDisplay(Display *dpy, int scr) { return (ScreenOfDisplay(dpy, scr)); } Screen *XDefaultScreenOfDisplay(Display *dpy) { return (DefaultScreenOfDisplay(dpy)); } Display *XDisplayOfScreen(Screen *s) { return (DisplayOfScreen(s)); } Window XRootWindowOfScreen(Screen *s) { return (RootWindowOfScreen(s)); } unsigned long XBlackPixelOfScreen(Screen *s) { return (BlackPixelOfScreen(s)); } unsigned long XWhitePixelOfScreen(Screen *s) { return (WhitePixelOfScreen(s)); } Colormap XDefaultColormapOfScreen(Screen *s) { return (DefaultColormapOfScreen(s)); } int XDefaultDepthOfScreen(Screen *s) { return (DefaultDepthOfScreen(s)); } GC XDefaultGCOfScreen(Screen *s) { return (DefaultGCOfScreen(s)); } Visual *XDefaultVisualOfScreen(Screen *s) { return (DefaultVisualOfScreen(s)); } int XWidthOfScreen(Screen *s) { return (WidthOfScreen(s)); } int XHeightOfScreen(Screen *s) { return (HeightOfScreen(s)); } int XWidthMMOfScreen(Screen *s) { return (WidthMMOfScreen(s)); } int XHeightMMOfScreen(Screen *s) { return (HeightMMOfScreen(s)); } int XPlanesOfScreen(Screen *s) { return (PlanesOfScreen(s)); } int XCellsOfScreen(Screen *s) { return (CellsOfScreen(s)); } int XMinCmapsOfScreen(Screen *s) { return (MinCmapsOfScreen(s)); } int XMaxCmapsOfScreen(Screen *s) { return (MaxCmapsOfScreen(s)); } Bool XDoesSaveUnders(Screen *s) { return (DoesSaveUnders(s)); } int XDoesBackingStore(Screen *s) { return (DoesBackingStore(s)); } long XEventMaskOfScreen(Screen *s) { return (EventMaskOfScreen(s)); } int XScreenNumberOfScreen (register Screen *scr) { register Display *dpy = scr->display; register Screen *dpyscr = dpy->screens; register int i; for (i = 0; i < dpy->nscreens; i++, dpyscr++) { if (scr == dpyscr) return i; } return -1; } /* * These macros are used to give some sugar to the image routines so that * naive people are more comfortable with them. */ #undef XDestroyImage int XDestroyImage( XImage *ximage) { return((*((ximage)->f.destroy_image))((ximage))); } #undef XGetPixel unsigned long XGetPixel( XImage *ximage, int x, int y) { return ((*((ximage)->f.get_pixel))((ximage), (x), (y))); } #undef XPutPixel int XPutPixel( XImage *ximage, int x, int y, unsigned long pixel) { return((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel))); } #undef XSubImage XImage *XSubImage( XImage *ximage, int x, int y, unsigned int width, unsigned int height) { return((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height))); } #undef XAddPixel int XAddPixel( XImage *ximage, long value) { return((*((ximage)->f.add_pixel))((ximage), (value))); } int XNoOp (register Display *dpy) { _X_UNUSED register xReq *req; LockDisplay(dpy); GetEmptyReq(NoOperation, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/Makefile.am0000644000000000000000000001540713614532331014703 0ustar NULL = if XKB XKB_SUBDIRS = xkb endif SUBDIRS = util xcms xlibi18n $(XKB_SUBDIRS) lib_LTLIBRARIES = libNX_X11.la BUILT_SOURCES=ks_tables.h CLEANFILES=ks_tables.h ks_tables_h AM_CPPFLAGS= \ -I$(top_srcdir)/include \ -I$(top_srcdir)/include/X11 \ -I$(top_builddir)/include \ -I$(top_builddir)/include/X11 \ -I$(top_srcdir)/src/xcms \ -I$(top_srcdir)/src/xkb \ -I$(top_srcdir)/src/xlibi18n \ -I$(top_srcdir)/../exports/include \ -D_GNU_SOURCE \ -DX11_t \ -DTRANS_CLIENT \ -DUSE_XCB=0 \ $(NULL) AM_CFLAGS= \ $(X11_CFLAGS) \ $(BIGFONT_CFLAGS) \ $(XMALLOC_ZERO_CFLAGS) \ $(CWARNFLAGS) \ $(NULL) # # =============================== I18N ============================= # I18N_LIBS = \ xlibi18n/libi18n.la \ $(NULL) # # =============================== XCMS ============================= # XCMS_LIBS = \ xcms/libxcms.la \ $(NULL) # # =============================== XKB ============================== # XKB_LIBS = \ xkb/libxkb.la \ $(NULL) # # =============================== XLIB ============================= # libNX_X11_la_SOURCES = \ AllCells.c \ AllowEv.c \ AllPlanes.c \ AuDispose.c \ AuFileName.c \ AuGetBest.c \ AuRead.c \ AutoRep.c \ Backgnd.c \ BdrWidth.c \ Bell.c \ Border.c \ ChAccCon.c \ ChActPGb.c \ ChClMode.c \ ChCmap.c \ ChGC.c \ ChKeyCon.c \ ChkIfEv.c \ ChkMaskEv.c \ ChkTypEv.c \ ChkTypWEv.c \ ChkWinEv.c \ ChPntCon.c \ ChProp.c \ ChSaveSet.c \ ChWAttrs.c \ ChWindow.c \ CirWin.c \ CirWinDn.c \ CirWinUp.c \ ClDisplay.c \ ClearArea.c \ Clear.c \ ConfWind.c \ ConnDis.c \ Context.c \ ConvSel.c \ CopyArea.c \ CopyCmap.c \ CopyGC.c \ CopyPlane.c \ CrBFData.c \ CrCmap.c \ CrCursor.c \ CrGC.c \ CrGlCur.c \ CrPFBData.c \ CrPixmap.c \ CrWindow.c \ Cursor.c \ DefCursor.c \ DelProp.c \ Depths.c \ DestSubs.c \ DestWind.c \ DisName.c \ DrArc.c \ DrArcs.c \ DrLine.c \ DrLines.c \ DrPoint.c \ DrPoints.c \ DrRect.c \ DrRects.c \ DrSegs.c \ ErrDes.c \ ErrHndlr.c \ evtomask.c \ EvToWire.c \ FetchName.c \ FillArc.c \ FillArcs.c \ FillPoly.c \ FillRct.c \ FillRcts.c \ FilterEv.c \ Flush.c \ Font.c \ FontInfo.c \ FontNames.c \ FreeCmap.c \ FreeCols.c \ FreeCurs.c \ FreeEData.c \ FreeEventData.c \ FreeGC.c \ FreePix.c \ FSSaver.c \ FSWrap.c \ GCMisc.c \ Geom.c \ GetAtomNm.c \ GetColor.c \ GetDflt.c \ GetEventData.c \ GetFPath.c \ GetFProp.c \ GetGCVals.c \ GetGeom.c \ GetHColor.c \ GetHints.c \ GetIFocus.c \ GetImage.c \ GetKCnt.c \ GetMoEv.c \ GetNrmHint.c \ GetPCnt.c \ GetPntMap.c \ GetProp.c \ GetRGBCMap.c \ GetSOwner.c \ GetSSaver.c \ GetStCmap.c \ GetTxtProp.c \ GetWAttrs.c \ GetWMCMapW.c \ GetWMProto.c \ globals.c \ GrButton.c \ GrKeybd.c \ GrKey.c \ GrPointer.c \ GrServer.c \ Host.c \ Iconify.c \ IfEvent.c \ imConv.c \ ImText16.c \ ImText.c \ ImUtil.c \ InitExt.c \ InsCmap.c \ IntAtom.c \ KeyBind.c \ KeysymStr.c \ KillCl.c \ LiHosts.c \ LiICmaps.c \ LiProps.c \ ListExt.c \ LoadFont.c \ LockDis.c \ locking.c \ LookupCol.c \ LowerWin.c \ Macros.c \ MapRaised.c \ MapSubs.c \ MapWindow.c \ MaskEvent.c \ Misc.c \ ModMap.c \ MoveWin.c \ NextEvent.c \ OCWrap.c \ OMWrap.c \ OpenDis.c \ ParseCmd.c \ ParseCol.c \ ParseGeom.c \ PeekEvent.c \ PeekIfEv.c \ Pending.c \ PixFormats.c \ PmapBgnd.c \ PmapBord.c \ PolyReg.c \ PolyTxt16.c \ PolyTxt.c \ PropAlloc.c \ PutBEvent.c \ PutImage.c \ Quarks.c \ QuBest.c \ QuColor.c \ QuColors.c \ QuCurShp.c \ QuExt.c \ QuKeybd.c \ QuPntr.c \ QuStipShp.c \ QuTextE16.c \ QuTextExt.c \ QuTileShp.c \ QuTree.c \ RaiseWin.c \ RdBitF.c \ RecolorC.c \ ReconfWin.c \ ReconfWM.c \ Region.c \ RegstFlt.c \ RepWindow.c \ RestackWs.c \ RotProp.c \ ScrResStr.c \ SelInput.c \ SendEvent.c \ SetBack.c \ SetClMask.c \ SetClOrig.c \ SetCRects.c \ SetDashes.c \ SetFont.c \ SetFore.c \ SetFPath.c \ SetFunc.c \ SetHints.c \ SetIFocus.c \ SetLocale.c \ SetLStyle.c \ SetNrmHint.c \ SetPMask.c \ SetPntMap.c \ SetRGBCMap.c \ SetSOwner.c \ SetSSaver.c \ SetState.c \ SetStCmap.c \ SetStip.c \ SetTile.c \ SetTSOrig.c \ SetTxtProp.c \ SetWMCMapW.c \ SetWMProto.c \ StBytes.c \ StColor.c \ StColors.c \ StName.c \ StNColor.c \ StrKeysym.c \ StrToText.c \ Sync.c \ Synchro.c \ Text16.c \ Text.c \ TextExt16.c \ TextExt.c \ TextToStr.c \ TrCoords.c \ UndefCurs.c \ UngrabBut.c \ UngrabKbd.c \ UngrabKey.c \ UngrabPtr.c \ UngrabSvr.c \ UninsCmap.c \ UnldFont.c \ UnmapSubs.c \ UnmapWin.c \ VisUtil.c \ WarpPtr.c \ Window.c \ WinEvent.c \ Withdraw.c \ WMGeom.c \ WMProps.c \ WrBitF.c \ XlibAsync.c \ XlibInt.c \ Xrm.c \ x11_trans.c \ $(NULL) # # ========================= Extra stuff ============================ # x11datadir = @X11_DATADIR@ x11data_DATA = XErrorDB EXTRA_DIST = \ $(x11data_DATA) \ $(NULL) if THRSTUBS libNX_X11_la_SOURCES+=UIThrStubs.c else EXTRA_DIST += \ UIThrStubs.c \ $(NULL) endif libNX_X11_la_LDFLAGS = -version-number 6:3:0 -no-undefined if XLOCALE USE_I18N_LIBS = $(I18N_LIBS) endif if XCMS USE_XCMS_LIBS = $(XCMS_LIBS) endif if XKB USE_XKB_LIBS = $(XKB_LIBS) endif libNX_X11_la_LIBADD = \ $(USE_I18N_LIBS) \ $(USE_XCMS_LIBS) \ $(USE_XKB_LIBS) \ $(X11_LIBS) \ -L$(top_srcdir)/../../nxcomp/src/.libs -lXcomp \ $(NULL) preprocess: $(patsubst %.c,%.ii,$(libX11_la_SOURCES)) .c.ii: $(COMPILE) -E -o $@ `test -f '$<' || echo '$(srcdir)/'`$< # # Building ks_tables.h requires the makekeys utility # KEYSYMDEFS=@KEYSYMDEFS@ ks_tables.h: $(KEYSYMDEFS) $(top_builddir)/src/util/makekeys$(EXEEXT) $(top_builddir)/src/util/makekeys $(KEYSYMDEFS) > ks_tables_h mv ks_tables_h $@ $(top_builddir)/src/util/makekeys$(EXEEXT): force cd util && $(MAKE) force: nx-libs-3.5.99.23/nx-X11/lib/src/MapRaised.c0000644000000000000000000000321413614532331014651 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XMapRaised ( register Display *dpy, Window w) { register xConfigureWindowReq *req; register xResourceReq *req2; unsigned long val = Above; /* needed for macro */ LockDisplay(dpy); GetReqExtra(ConfigureWindow, 4, req); req->window = w; req->mask = CWStackMode; OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), val); GetResReq (MapWindow, w, req2); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/MapSubs.c0000644000000000000000000000263013614532331014357 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XMapSubwindows( register Display *dpy, Window win) { register xResourceReq *req; LockDisplay(dpy); GetResReq(MapSubwindows, win, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/MapWindow.c0000644000000000000000000000257713614532331014724 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XMapWindow ( register Display *dpy, Window w) { register xResourceReq *req; LockDisplay (dpy); GetResReq(MapWindow, w, req); UnlockDisplay (dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/MaskEvent.c0000644000000000000000000000525113614532331014704 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" extern long const _Xevent_to_mask[]; #define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask) #define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ Button4MotionMask|Button5MotionMask) /* * return the next event in the queue matching one of the events in the mask. * If no event, flush output, and wait until match succeeds. * Events earlier in the queue are not discarded. */ int XMaskEvent ( register Display *dpy, long mask, /* Selected event mask. */ register XEvent *event) /* XEvent to be filled in. */ { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; LockDisplay(dpy); /* Delete unclaimed cookies */ _XFreeEventCookies(dpy); prev = NULL; while (1) { for (qelt = prev ? prev->next : dpy->head; qelt; prev = qelt, qelt = qelt->next) { if ((qelt->event.type < GenericEvent) && (_Xevent_to_mask[qelt->event.type] & mask) && ((qelt->event.type != MotionNotify) || (mask & AllPointers) || (mask & AllButtons & qelt->event.xmotion.state))) { *event = qelt->event; _XDeq(dpy, prev, qelt); UnlockDisplay(dpy); return 0; } } if (prev) qe_serial = prev->qserial_num; _XReadEvents(dpy); if (prev && prev->qserial_num != qe_serial) /* another thread has snatched this event */ prev = NULL; #ifdef NX_TRANS_SOCKET if (_XGetIOError(dpy)) { UnlockDisplay(dpy); return 0; } #endif } } nx-libs-3.5.99.23/nx-X11/lib/src/Misc.c0000644000000000000000000000342513614532331013703 0ustar /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" long XMaxRequestSize(Display *dpy) { return dpy->max_request_size; } char *XResourceManagerString(Display *dpy) { return dpy->xdefaults; } unsigned long XDisplayMotionBufferSize(Display *dpy) { return dpy->motion_buffer; } int XDisplayKeycodes( Display *dpy, int *min_keycode_return, int *max_keycode_return) { *min_keycode_return = dpy->min_keycode; *max_keycode_return = dpy->max_keycode; return 1; } VisualID XVisualIDFromVisual(Visual *visual) { return visual->visualid; } long XExtendedMaxRequestSize(Display *dpy) { return dpy->bigreq_size; } nx-libs-3.5.99.23/nx-X11/lib/src/ModMap.c0000644000000000000000000001171313614532331014164 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include XModifierKeymap * XGetModifierMapping(register Display *dpy) { xGetModifierMappingReply rep; _X_UNUSED register xReq *req; unsigned long nbytes; XModifierKeymap *res; LockDisplay(dpy); GetEmptyReq(GetModifierMapping, req); (void) _XReply (dpy, (xReply *)&rep, 0, xFalse); if (rep.length < (INT_MAX >> 2) && (rep.length >> 1) == rep.numKeyPerModifier) { nbytes = (unsigned long)rep.length << 2; res = Xmalloc(sizeof (XModifierKeymap)); if (res) res->modifiermap = Xmalloc (nbytes); } else res = NULL; if ((! res) || (! res->modifiermap)) { Xfree(res); res = (XModifierKeymap *) NULL; _XEatDataWords(dpy, rep.length); } else { _XReadPad(dpy, (char *) res->modifiermap, (long) nbytes); res->max_keypermod = rep.numKeyPerModifier; } UnlockDisplay(dpy); SyncHandle(); return (res); } /* * Returns: * MappingSuccess (0) Success * MappingBusy (1) Busy - one or more old or new modifiers are down * MappingFailed (2) Failed - one or more new modifiers unacceptable */ int XSetModifierMapping( register Display *dpy, register XModifierKeymap *modifier_map) { register xSetModifierMappingReq *req; xSetModifierMappingReply rep; int mapSize = modifier_map->max_keypermod << 3; /* 8 modifiers */ LockDisplay(dpy); GetReq(SetModifierMapping, req); req->length += mapSize >> 2; req->numKeyPerModifier = modifier_map->max_keypermod; Data(dpy, (const char *)modifier_map->modifiermap, mapSize); (void) _XReply(dpy, (xReply *) & rep, (SIZEOF(xSetModifierMappingReply) - SIZEOF(xReply)) >> 2, xTrue); UnlockDisplay(dpy); SyncHandle(); return (rep.success); } XModifierKeymap * XNewModifiermap(int keyspermodifier) { XModifierKeymap *res = Xmalloc((sizeof (XModifierKeymap))); if (res) { res->max_keypermod = keyspermodifier; res->modifiermap = (keyspermodifier > 0 ? Xmalloc(8 * keyspermodifier) : (KeyCode *) NULL); if (keyspermodifier && (res->modifiermap == NULL)) { Xfree(res); return (XModifierKeymap *) NULL; } } return (res); } int XFreeModifiermap(XModifierKeymap *map) { if (map) { Xfree(map->modifiermap); Xfree(map); } return 1; } XModifierKeymap * XInsertModifiermapEntry(XModifierKeymap *map, #if NeedWidePrototypes unsigned int keycode, #else KeyCode keycode, #endif int modifier) { XModifierKeymap *newmap; int i, row = modifier * map->max_keypermod, newrow, lastrow; for (i=0; imax_keypermod; i++) { if (map->modifiermap[ row+i ] == keycode) return(map); /* already in the map */ if (map->modifiermap[ row+i ] == 0) { map->modifiermap[ row+i ] = keycode; return(map); /* we added it without stretching the map */ } } /* stretch the map */ if ((newmap = XNewModifiermap(map->max_keypermod+1)) == NULL) return (XModifierKeymap *) NULL; newrow = row = 0; lastrow = newmap->max_keypermod * 8; while (newrow < lastrow) { for (i=0; imax_keypermod; i++) newmap->modifiermap[ newrow+i ] = map->modifiermap[ row+i ]; newmap->modifiermap[ newrow+i ] = 0; row += map->max_keypermod; newrow += newmap->max_keypermod; } (void) XFreeModifiermap(map); newrow = newmap->max_keypermod * modifier + newmap->max_keypermod - 1; newmap->modifiermap[ newrow ] = keycode; return(newmap); } XModifierKeymap * XDeleteModifiermapEntry(XModifierKeymap *map, #if NeedWidePrototypes unsigned int keycode, #else KeyCode keycode, #endif int modifier) { int i, row = modifier * map->max_keypermod; for (i=0; imax_keypermod; i++) { if (map->modifiermap[ row+i ] == keycode) map->modifiermap[ row+i ] = 0; } /* should we shrink the map?? */ return (map); } nx-libs-3.5.99.23/nx-X11/lib/src/MoveWin.c0000644000000000000000000000312613614532331014372 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XMoveWindow ( register Display *dpy, Window w, int x, int y) { register xConfigureWindowReq *req; LockDisplay(dpy); GetReqExtra(ConfigureWindow, 8, req); req->window = w; req->mask = CWX | CWY; { CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xConfigureWindowReq); *valuePtr++ = x; *valuePtr = y; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/NextEvent.c0000644000000000000000000000333713614532331014732 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* * Return next event in queue, or if none, flush output and wait for * events. */ int XNextEvent ( register Display *dpy, register XEvent *event) { register _XQEvent *qelt; LockDisplay(dpy); /* Delete unclaimed cookies */ _XFreeEventCookies(dpy); if (dpy->head == NULL) _XReadEvents(dpy); #ifdef NX_TRANS_SOCKET if (_XGetIOError(dpy)) { UnlockDisplay(dpy); return 0; } #endif qelt = dpy->head; *event = qelt->event; _XDeq(dpy, NULL, qelt); _XStoreEventCookie(dpy, event); UnlockDisplay(dpy); return 0; } nx-libs-3.5.99.23/nx-X11/lib/src/OCWrap.c0000644000000000000000000000577113614532331014151 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" XOC XCreateOC(XOM om, ...) { va_list var; XlcArgList args; XOC oc; int num_args; va_start(var, om); _XlcCountVaList(var, &num_args); va_end(var); va_start(var, om); _XlcVaToArgList(var, num_args, &args); va_end(var); if (args == (XlcArgList) NULL) return (XOC) NULL; oc = (*om->methods->create_oc)(om, args, num_args); Xfree(args); if (oc) { oc->core.next = om->core.oc_list; om->core.oc_list = oc; } return oc; } void XDestroyOC(XOC oc) { XOC prev, oc_list; prev = oc_list = oc->core.om->core.oc_list; if (oc_list == oc) oc->core.om->core.oc_list = oc_list->core.next; else { while ((oc_list = oc_list->core.next)) { if (oc_list == oc) { prev->core.next = oc_list->core.next; break; } prev = oc_list; } } (*oc->methods->destroy)(oc); } XOM XOMOfOC(XOC oc) { return oc->core.om; } char * XSetOCValues(XOC oc, ...) { va_list var; XlcArgList args; char *ret; int num_args; va_start(var, oc); _XlcCountVaList(var, &num_args); va_end(var); va_start(var, oc); _XlcVaToArgList(var, num_args, &args); va_end(var); if (args == (XlcArgList) NULL) return (char *) NULL; ret = (*oc->methods->set_values)(oc, args, num_args); Xfree(args); return ret; } char * XGetOCValues(XOC oc, ...) { va_list var; XlcArgList args; char *ret; int num_args; va_start(var, oc); _XlcCountVaList(var, &num_args); va_end(var); va_start(var, oc); _XlcVaToArgList(var, num_args, &args); va_end(var); if (args == (XlcArgList) NULL) return (char *) NULL; ret = (*oc->methods->get_values)(oc, args, num_args); Xfree(args); return ret; } nx-libs-3.5.99.23/nx-X11/lib/src/OMWrap.c0000644000000000000000000000547513614532331014164 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" XOM XOpenOM(Display *dpy, XrmDatabase rdb, _Xconst char *res_name, _Xconst char *res_class) { XLCd lcd = _XOpenLC((char *) NULL); if (lcd == NULL) return (XOM) NULL; if (lcd->methods->open_om) return (*lcd->methods->open_om)(lcd, dpy, rdb, res_name, res_class); return (XOM) NULL; } Status XCloseOM(XOM om) { XOC oc, next; XLCd lcd = om->core.lcd; next = om->core.oc_list; while ((oc = next)) { next = oc->core.next; (*oc->methods->destroy)(oc); } om->core.oc_list = NULL; _XCloseLC(lcd); return (*om->methods->close)(om); } char * XSetOMValues(XOM om, ...) { va_list var; XlcArgList args; char *ret; int num_args; va_start(var, om); _XlcCountVaList(var, &num_args); va_end(var); va_start(var, om); _XlcVaToArgList(var, num_args, &args); va_end(var); if (args == (XlcArgList) NULL) return (char *) NULL; ret = (*om->methods->set_values)(om, args, num_args); Xfree(args); return ret; } char * XGetOMValues(XOM om, ...) { va_list var; XlcArgList args; char *ret; int num_args; va_start(var, om); _XlcCountVaList(var, &num_args); va_end(var); va_start(var, om); _XlcVaToArgList(var, num_args, &args); va_end(var); if (args == (XlcArgList) NULL) return (char *) NULL; ret = (*om->methods->get_values)(om, args, num_args); Xfree(args); return ret; } Display * XDisplayOfOM(XOM om) { return om->core.display; } char * XLocaleOfOM(XOM om) { return om->core.lcd->core->name; } nx-libs-3.5.99.23/nx-X11/lib/src/OpenDis.c0000644000000000000000000007107313614532331014355 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1985, 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #if USE_XCB #include "Xxcbint.h" #else /* !USE_XCB */ #include #include #endif /* USE_XCB */ #include #include #include #include "Xintconn.h" #ifdef XKB #include "XKBlib.h" #endif /* XKB */ #ifdef NX_TRANS_SOCKET extern void *_X11TransSocketProxyConnInfo(XtransConnInfo); #endif #if !USE_XCB #define bignamelen (sizeof(XBigReqExtensionName) - 1) typedef struct { unsigned long seq; int opcode; } _XBigReqState; #endif /* !USE_XCB */ #ifdef XTHREADS #include "locking.h" int (*_XInitDisplayLock_fn)(Display *dpy) = NULL; void (*_XFreeDisplayLock_fn)(Display *dpy) = NULL; #define InitDisplayLock(d) (_XInitDisplayLock_fn ? (*_XInitDisplayLock_fn)(d) : Success) #define FreeDisplayLock(d) if (_XFreeDisplayLock_fn) (*_XFreeDisplayLock_fn)(d) #else #define InitDisplayLock(dis) Success #define FreeDisplayLock(dis) #endif /* XTHREADS */ static xReq _dummy_request = { 0, 0, 0 }; static void OutOfMemory(Display *dpy, char *setup); #if !USE_XCB static Bool _XBigReqHandler(Display *dpy, xReply *rep, char *buf, int len, XPointer data); #endif /* !USE_XCB */ /* * Connects to a server, creates a Display object and returns a pointer to * the newly created Display back to the caller. */ Display * XOpenDisplay ( register _Xconst char *display) { register Display *dpy; /* New Display object being created. */ register int i; int j, k; /* random iterator indexes */ char *display_name; /* pointer to display name */ #if !USE_XCB int endian; /* to determine which endian. */ xConnClientPrefix client; /* client information */ int idisplay; /* display number */ int prefixread = 0; /* setup prefix already read? */ char *conn_auth_name, *conn_auth_data; int conn_auth_namelen, conn_auth_datalen; #endif /* !USE_XCB */ char *setup = NULL; /* memory allocated at startup */ char *fullname = NULL; /* expanded name of display */ int iscreen; /* screen number */ xConnSetupPrefix prefix; /* prefix information */ int vendorlen; /* length of vendor string */ union { xConnSetup *setup; char *failure; char *vendor; xPixmapFormat *sf; xWindowRoot *rp; xDepth *dp; xVisualType *vp; } u; /* proto data returned from server */ long setuplength; /* number of bytes in setup message */ long usedbytes = 0; /* number of bytes we have processed */ unsigned long mask; long int conn_buf_size; char *xlib_buffer_size; #if !USE_XCB bzero((char *) &client, sizeof(client)); bzero((char *) &prefix, sizeof(prefix)); #endif /* !USE_XCB */ #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "\nXOpenDisplay: Called with display [%s].\n", display); #endif /* * If the display specifier string supplied as an argument to this * routine is NULL or a pointer to NULL, read the DISPLAY variable. */ if (display == NULL || *display == '\0') { if ((display_name = getenv("DISPLAY")) == NULL) { /* Oops! No DISPLAY environment variable - error. */ return(NULL); } } else { /* Display is non-NULL, copy the pointer */ display_name = (char *)display; } /* * Set the default error handlers. This allows the global variables to * default to NULL for use with shared libraries. */ if (_XErrorFunction == NULL) (void) XSetErrorHandler (NULL); if (_XIOErrorFunction == NULL) (void) XSetIOErrorHandler (NULL); /* * Attempt to allocate a display structure. Return NULL if allocation fails. */ if ((dpy = Xcalloc(1, sizeof(Display))) == NULL) { return(NULL); } /* * Call the Connect routine to get the transport connection object. * If NULL is returned, the connection failed. The connect routine * will set fullname to point to the expanded name. */ #if USE_XCB if(!_XConnectXCB(dpy, display, &fullname, &iscreen)) { /* Try falling back on other transports if no transport specified */ const char *slash = strrchr(display_name, '/'); if(slash == NULL) { const char *protocols[] = {"local", "unix", "tcp", "inet6", "inet", NULL}; const char **s; size_t buf_size = strlen(display_name) + 7; // max strlen + 2 (null + /) char *buf = Xmalloc(buf_size * sizeof(char)); if(buf) { for(s = protocols; buf && *s; s++) { snprintf(buf, buf_size, "%s/%s", *s, display_name); if(_XConnectXCB(dpy, buf, &fullname, &iscreen)) goto fallback_success; } Xfree(buf); } } dpy->display_name = fullname; OutOfMemory(dpy, NULL); return NULL; } fallback_success: #else /* !USE_XCB */ if ((dpy->trans_conn = _X11TransConnectDisplay ( display_name, &fullname, &idisplay, &iscreen, &conn_auth_name, &conn_auth_namelen, &conn_auth_data, &conn_auth_datalen)) == NULL) { Xfree ((char *) dpy); return(NULL); } dpy->fd = _X11TransGetConnectionNumber (dpy->trans_conn); #endif /* USE_XCB */ #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "\nXOpenDisplay: Connected display with dpy->fd = [%d].\n", dpy->fd); #endif /* Initialize as much of the display structure as we can. * Initialize pointers to NULL so that XFreeDisplayStructure will * work if we run out of memory before we finish initializing. */ dpy->display_name = fullname; dpy->keysyms = (KeySym *) NULL; dpy->modifiermap = NULL; dpy->lock_meaning = NoSymbol; dpy->keysyms_per_keycode = 0; dpy->xdefaults = (char *)NULL; dpy->scratch_length = 0L; dpy->scratch_buffer = NULL; dpy->key_bindings = NULL; dpy->ext_procs = (_XExtension *)NULL; dpy->ext_data = (XExtData *)NULL; dpy->ext_number = 0; dpy->event_vec[X_Error] = _XUnknownWireEvent; dpy->event_vec[X_Reply] = _XUnknownWireEvent; dpy->wire_vec[X_Error] = _XUnknownNativeEvent; dpy->wire_vec[X_Reply] = _XUnknownNativeEvent; for (i = KeyPress; i < LASTEvent; i++) { dpy->event_vec[i] = _XWireToEvent; dpy->wire_vec[i] = NULL; } for (i = LASTEvent; i < 128; i++) { dpy->event_vec[i] = _XUnknownWireEvent; dpy->wire_vec[i] = _XUnknownNativeEvent; } dpy->resource_id = 0; dpy->db = (struct _XrmHashBucketRec *)NULL; dpy->cursor_font = None; dpy->flags = 0; dpy->async_handlers = NULL; dpy->screens = NULL; dpy->vendor = NULL; dpy->buffer = NULL; dpy->atoms = NULL; dpy->error_vec = NULL; dpy->context_db = NULL; dpy->free_funcs = NULL; dpy->pixmap_format = NULL; dpy->cms.clientCmaps = NULL; dpy->cms.defaultCCCs = NULL; dpy->cms.perVisualIntensityMaps = NULL; dpy->im_filters = NULL; dpy->bigreq_size = 0; dpy->lock = NULL; dpy->lock_fns = NULL; dpy->qfree = NULL; dpy->next_event_serial_num = 1; dpy->im_fd_info = NULL; dpy->im_fd_length = 0; dpy->conn_watchers = NULL; dpy->watcher_count = 0; dpy->filedes = NULL; dpy->flushes = NULL; dpy->xcmisc_opcode = 0; dpy->xkb_info = NULL; /* * Setup other information in this display structure. */ dpy->vnumber = X_PROTOCOL; dpy->resource_alloc = _XAllocID; dpy->idlist_alloc = _XAllocIDs; dpy->synchandler = NULL; dpy->savedsynchandler = NULL; dpy->request = 0; dpy->last_request_read = 0; dpy->default_screen = iscreen; /* Value returned by ConnectDisplay */ dpy->last_req = (char *)&_dummy_request; /* Initialize the display lock */ if (InitDisplayLock(dpy) != 0) { OutOfMemory (dpy, setup); return(NULL); } if (!_XPollfdCacheInit(dpy)) { OutOfMemory (dpy, setup); return(NULL); } /* Set up the output buffers. */ #ifndef XLIBDEFAULTBUFSIZE #define XLIBDEFAULTBUFSIZE 16384 /* 16k */ #endif #ifndef XLIBMINBUFSIZE #define XLIBMINBUFSIZE BUFSIZE /* old default buffer size */ #endif xlib_buffer_size = getenv("XLIBBUFFERSIZE"); #ifdef __sun /* Backwards compatibility for old Solaris libX11 name */ if (xlib_buffer_size == NULL) xlib_buffer_size = getenv("XSUNBUFFERSIZE"); #endif if (xlib_buffer_size == NULL) conn_buf_size = XLIBDEFAULTBUFSIZE; else conn_buf_size = 1024 * strtol(xlib_buffer_size, NULL, 10); if (conn_buf_size < XLIBMINBUFSIZE) conn_buf_size = XLIBMINBUFSIZE; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf (stderr, "Xlib: Running with XLIBBUFFERSIZE [%d] XLIBMINBUFSIZE [%d] " "buffer size [%ld].\n", XLIBDEFAULTBUFSIZE, XLIBMINBUFSIZE, conn_buf_size); #endif if ((dpy->bufptr = dpy->buffer = Xcalloc(1, conn_buf_size)) == NULL) { OutOfMemory (dpy, setup); return(NULL); } dpy->bufmax = dpy->buffer + conn_buf_size; #if USE_XCB dpy->xcb->real_bufmax = dpy->bufmax; dpy->bufmax = dpy->buffer; #endif /* Set up the input event queue and input event queue parameters. */ dpy->head = dpy->tail = NULL; dpy->qlen = 0; /* Set up free-function record */ if ((dpy->free_funcs = Xcalloc(1, sizeof(_XFreeFuncRec))) == NULL) { OutOfMemory (dpy, setup); return(NULL); } #if !USE_XCB /* * The xConnClientPrefix describes the initial connection setup information * and is followed by the authorization information. Sites that are interested * in security are strongly encouraged to use an authentication and * authorization system such as Kerberos. */ endian = 1; if (*(char *) &endian) client.byteOrder = '\154'; /* 'l' */ else client.byteOrder = '\102'; /* 'B' */ client.majorVersion = X_PROTOCOL; client.minorVersion = X_PROTOCOL_REVISION; client.nbytesAuthProto = conn_auth_namelen; client.nbytesAuthString = conn_auth_datalen; prefixread = _XSendClientPrefix(dpy, &client, conn_auth_name, conn_auth_data, &prefix); if (prefixread < 0) { _XDisconnectDisplay (dpy->trans_conn); Xfree ((char *)dpy); return(NULL); } if (conn_auth_name) Xfree(conn_auth_name); if (conn_auth_data) Xfree(conn_auth_data); /* * Now see if connection was accepted... */ /* these internal functions expect the display to be locked */ LockDisplay(dpy); if (prefixread == 0) _XRead (dpy, (char *)&prefix,(long)SIZEOF(xConnSetupPrefix)); /* an Authenticate reply we weren't expecting? */ if (prefix.success != xTrue && prefix.success != xFalse) { fprintf (stderr, "Xlib: unexpected connection setup reply from server, type %d.\r\n", prefix.success); _XDisconnectDisplay (dpy->trans_conn); Xfree ((char *)dpy); return(NULL); } if (prefix.majorVersion != X_PROTOCOL) { /* XXX - printing messages marks a bad programming interface */ #ifdef NX_TRANS_SOCKET if (_X11TransSocketProxyConnInfo(dpy->trans_conn) == NULL) { fprintf (stderr, "Xlib: client uses different protocol version (%d) " "than server (%d)!\r\n", X_PROTOCOL, prefix.majorVersion); } #else fprintf (stderr, "Xlib: client uses different protocol version (%d) than server (%d)!\r\n", X_PROTOCOL, prefix.majorVersion); #endif _XDisconnectDisplay (dpy->trans_conn); Xfree ((char *)dpy); return(NULL); } #endif /* !USE_XCB */ #if USE_XCB { const struct xcb_setup_t *xcbsetup = xcb_get_setup(dpy->xcb->connection); memcpy(&prefix, xcbsetup, sizeof(prefix)); setuplength = prefix.length << 2; setup = (char *) xcbsetup; setup += SIZEOF(xConnSetupPrefix); u.setup = (xConnSetup *) setup; } #else /* !USE_XCB */ setuplength = prefix.length << 2; if ( (u.setup = (xConnSetup *) (setup = Xmalloc ((unsigned) setuplength))) == NULL) { _XDisconnectDisplay (dpy->trans_conn); Xfree ((char *)dpy); return(NULL); } _XRead (dpy, (char *)u.setup, setuplength); /* * If the connection was not accepted by the server due to problems, * give error message to the user.... */ if (prefix.success != xTrue) { /* XXX - printing messages marks a bad programming interface */ fprintf (stderr, "Xlib: connection to \"%s\" refused by server\r\nXlib: ", fullname); if (prefix.lengthReason > setuplength) { fprintf (stderr, "Xlib: Broken initial reply: length of reason > length of packet\r\n"); }else{ (void) fwrite (u.failure, (size_t)sizeof(char), (size_t)prefix.lengthReason, stderr); (void) fwrite ("\r\n", sizeof(char), 2, stderr); } OutOfMemory(dpy, setup); return (NULL); } #endif /* USE_XCB */ /* * Check if the reply was long enough to get any information out of it. */ usedbytes = sz_xConnSetup; if (setuplength < usedbytes ) { fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); OutOfMemory(dpy, setup); return (NULL); } /* * We succeeded at authorization, so let us move the data into * the display structure. */ dpy->proto_major_version= prefix.majorVersion; dpy->proto_minor_version= prefix.minorVersion; dpy->release = u.setup->release; dpy->resource_base = u.setup->ridBase; dpy->resource_mask = u.setup->ridMask; dpy->min_keycode = u.setup->minKeyCode; dpy->max_keycode = u.setup->maxKeyCode; dpy->motion_buffer = u.setup->motionBufferSize; dpy->nformats = u.setup->numFormats; dpy->nscreens = u.setup->numRoots; dpy->byte_order = u.setup->imageByteOrder; dpy->bitmap_unit = u.setup->bitmapScanlineUnit; dpy->bitmap_pad = u.setup->bitmapScanlinePad; dpy->bitmap_bit_order = u.setup->bitmapBitOrder; dpy->max_request_size = u.setup->maxRequestSize; mask = dpy->resource_mask; dpy->resource_shift = 0; if (!mask) { fprintf (stderr, "Xlib: connection to \"%s\" invalid setup\n", fullname); OutOfMemory(dpy, setup); return (NULL); } while (!(mask & 1)) { dpy->resource_shift++; mask = mask >> 1; } dpy->resource_max = (dpy->resource_mask >> dpy->resource_shift) - 5; /* * now extract the vendor string... String must be null terminated, * padded to multiple of 4 bytes. */ /* Check for a sane vendor string length */ if (u.setup->nbytesVendor > 256) { OutOfMemory(dpy, setup); return (NULL); } dpy->vendor = Xmalloc(u.setup->nbytesVendor + 1); if (dpy->vendor == NULL) { OutOfMemory(dpy, setup); return (NULL); } vendorlen = u.setup->nbytesVendor; /* * validate setup length */ usedbytes += (vendorlen + 3) & ~3; if (setuplength < usedbytes) { fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); OutOfMemory(dpy, setup); return (NULL); } u.setup = (xConnSetup *) (((char *) u.setup) + sz_xConnSetup); (void) strncpy(dpy->vendor, u.vendor, vendorlen); dpy->vendor[vendorlen] = '\0'; vendorlen = (vendorlen + 3) & ~3; /* round up */ u.vendor += vendorlen; /* * Now iterate down setup information..... */ dpy->pixmap_format = Xcalloc(dpy->nformats, sizeof(ScreenFormat)); if (dpy->pixmap_format == NULL) { OutOfMemory (dpy, setup); return(NULL); } /* * First decode the Z axis Screen format information. */ usedbytes += dpy->nformats * sz_xPixmapFormat; if (setuplength < usedbytes) { fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); OutOfMemory (dpy, setup); return(NULL); } for (i = 0; i < dpy->nformats; i++) { register ScreenFormat *fmt = &dpy->pixmap_format[i]; fmt->depth = u.sf->depth; fmt->bits_per_pixel = u.sf->bitsPerPixel; fmt->scanline_pad = u.sf->scanLinePad; fmt->ext_data = NULL; u.sf = (xPixmapFormat *) (((char *) u.sf) + sz_xPixmapFormat); } /* * next the Screen structures. */ dpy->screens = Xcalloc(dpy->nscreens, sizeof(Screen)); if (dpy->screens == NULL) { OutOfMemory (dpy, setup); return(NULL); } /* * Now go deal with each screen structure. */ for (i = 0; i < dpy->nscreens; i++) { register Screen *sp = &dpy->screens[i]; VisualID root_visualID; usedbytes += sz_xWindowRoot; if (setuplength < usedbytes) { fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); OutOfMemory (dpy, setup); return(NULL); } root_visualID = u.rp->rootVisualID; sp->display = dpy; sp->root = u.rp->windowId; sp->cmap = u.rp->defaultColormap; sp->white_pixel = u.rp->whitePixel; sp->black_pixel = u.rp->blackPixel; sp->root_input_mask = u.rp->currentInputMask; sp->width = u.rp->pixWidth; sp->height = u.rp->pixHeight; sp->mwidth = u.rp->mmWidth; sp->mheight = u.rp->mmHeight; sp->min_maps = u.rp->minInstalledMaps; sp->max_maps = u.rp->maxInstalledMaps; sp->backing_store= u.rp->backingStore; sp->save_unders = u.rp->saveUnders; sp->root_depth = u.rp->rootDepth; sp->ndepths = u.rp->nDepths; sp->ext_data = NULL; u.rp = (xWindowRoot *) (((char *) u.rp) + sz_xWindowRoot); /* * lets set up the depth structures. */ sp->depths = Xcalloc(sp->ndepths, sizeof(Depth)); if (sp->depths == NULL) { OutOfMemory (dpy, setup); return(NULL); } /* * for all depths on this screen. */ for (j = 0; j < sp->ndepths; j++) { Depth *dp = &sp->depths[j]; usedbytes += sz_xDepth; if (setuplength < usedbytes) { fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); OutOfMemory (dpy, setup); return(NULL); } dp->depth = u.dp->depth; dp->nvisuals = u.dp->nVisuals; u.dp = (xDepth *) (((char *) u.dp) + sz_xDepth); if (dp->nvisuals > 0) { dp->visuals = Xcalloc(dp->nvisuals, sizeof(Visual)); if (dp->visuals == NULL) { OutOfMemory (dpy, setup); return(NULL); } for (k = 0; k < dp->nvisuals; k++) { register Visual *vp = &dp->visuals[k]; usedbytes += sz_xVisualType; if (setuplength < usedbytes) { fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); OutOfMemory (dpy, setup); return(NULL); } vp->visualid = u.vp->visualID; vp->class = u.vp->class; vp->bits_per_rgb= u.vp->bitsPerRGB; vp->map_entries = u.vp->colormapEntries; vp->red_mask = u.vp->redMask; vp->green_mask = u.vp->greenMask; vp->blue_mask = u.vp->blueMask; vp->ext_data = NULL; u.vp = (xVisualType *) (((char *) u.vp) + sz_xVisualType); } if (dp->depth == 32 && getenv ("XLIB_SKIP_ARGB_VISUALS")) { Xfree (dp->visuals); dp->visuals = NULL; dp->nvisuals = 0; } } else { dp->visuals = (Visual *) NULL; } } sp->root_visual = _XVIDtoVisual(dpy, root_visualID); } if(usedbytes != setuplength){ /* Sanity check, shouldn't happen. */ fprintf(stderr, "Xlib: Did not parse entire setup message: " "parsed: %ld, message: %ld\n", usedbytes, setuplength); OutOfMemory(dpy, setup); return(NULL); } /* * Now start talking to the server to setup all other information... */ #if !USE_XCB Xfree (setup); /* all finished with setup information */ #endif /* !USE_XCB */ /* * Make sure default screen is legal. */ if (iscreen >= dpy->nscreens) { OutOfMemory(dpy, (char *) NULL); return(NULL); } #if !USE_XCB /* * finished calling internal routines, now unlock for external routines */ UnlockDisplay(dpy); #endif /* !USE_XCB */ #if USE_XCB /* * get availability of large requests */ dpy->bigreq_size = xcb_get_maximum_request_length(dpy->xcb->connection); if(dpy->bigreq_size <= dpy->max_request_size) dpy->bigreq_size = 0; #endif /* USE_XCB */ /* * Set up other stuff clients are always going to use. */ for (i = 0; i < dpy->nscreens; i++) { register Screen *sp = &dpy->screens[i]; XGCValues values; values.foreground = sp->black_pixel; values.background = sp->white_pixel; if ((sp->default_gc = XCreateGC (dpy, sp->root, GCForeground|GCBackground, &values)) == NULL) { OutOfMemory(dpy, (char *) NULL); return (NULL); } } /* * call into synchronization routine so that all programs can be * forced synchronous */ (void) XSynchronize(dpy, _Xdebug); /* * get the resource manager database off the root window. */ LockDisplay(dpy); { xGetPropertyReply reply; xGetPropertyReq *req; #if !USE_XCB _XAsyncHandler async; _XBigReqState async_state; xQueryExtensionReq *qreq; xBigReqEnableReq *breq; xBigReqEnableReply brep; GetReq(QueryExtension, qreq); async_state.seq = dpy->request; async_state.opcode = 0; async.next = dpy->async_handlers; async.handler = _XBigReqHandler; async.data = (XPointer)&async_state; dpy->async_handlers = &async; qreq->nbytes = bignamelen; qreq->length += (bignamelen+3)>>2; Data(dpy, XBigReqExtensionName, bignamelen); #endif /* !USE_XCB */ GetReq (GetProperty, req); req->window = RootWindow(dpy, 0); req->property = XA_RESOURCE_MANAGER; req->type = XA_STRING; req->delete = False; req->longOffset = 0; req->longLength = 100000000L; if (_XReply (dpy, (xReply *) &reply, 0, xFalse)) { if (reply.format == 8 && reply.propertyType == XA_STRING && (reply.nItems + 1 > 0) && (reply.nItems <= req->longLength * 4) && (dpy->xdefaults = Xmalloc (reply.nItems + 1))) { _XReadPad (dpy, dpy->xdefaults, reply.nItems); dpy->xdefaults[reply.nItems] = '\0'; } else if (reply.propertyType != None) _XEatDataWords(dpy, reply.length); } #if !USE_XCB DeqAsyncHandler(dpy, &async); if (async_state.opcode) { GetReq(BigReqEnable, breq); breq->reqType = async_state.opcode; breq->brReqType = X_BigReqEnable; if (_XReply(dpy, (xReply *)&brep, 0, xFalse)) dpy->bigreq_size = brep.max_request_size; } #endif /* !USE_XCB */ } UnlockDisplay(dpy); #ifdef MOTIFBC { extern Display *_XHeadOfDisplayList; _XHeadOfDisplayList = dpy; } #endif #ifdef XKB XkbUseExtension(dpy,NULL,NULL); #endif /* * and return successfully */ #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "XOpenDisplay: Returning display at [%p].\n", dpy); #endif return(dpy); } #if !USE_XCB static Bool _XBigReqHandler( register Display *dpy, register xReply *rep, char *buf, int len, XPointer data) { _XBigReqState *state; xQueryExtensionReply replbuf; xQueryExtensionReply *repl; state = (_XBigReqState *)data; if (dpy->last_request_read != state->seq) return False; if (rep->generic.type == X_Error) return True; repl = (xQueryExtensionReply *) _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, (SIZEOF(xQueryExtensionReply) - SIZEOF(xReply)) >> 2, True); if (repl->present) state->opcode = repl->major_opcode; return True; } #endif /* !USE_XCB */ /* XFreeDisplayStructure frees all the storage associated with a * Display. It is used by XOpenDisplay if it runs out of memory, * and also by XCloseDisplay. It needs to check whether all pointers * are non-NULL before dereferencing them, since it may be called * by XOpenDisplay before the Display structure is fully formed. * XOpenDisplay must be sure to initialize all the pointers to NULL * before the first possible call on this. */ void _XFreeDisplayStructure(Display *dpy) { /* move all cookies in the EQ to the jar, then free them. */ if (dpy->qfree) { _XQEvent *qelt = dpy->qfree; while (qelt) { if (_XIsEventCookie(dpy, &qelt->event)) _XStoreEventCookie(dpy, &qelt->event); qelt = qelt->next; } } if (dpy->cookiejar) _XFreeEventCookies(dpy); while (dpy->ext_procs) { _XExtension *ext = dpy->ext_procs; dpy->ext_procs = ext->next; Xfree (ext->name); Xfree (ext); } if (dpy->im_filters) (*dpy->free_funcs->im_filters)(dpy); if (dpy->cms.clientCmaps) (*dpy->free_funcs->clientCmaps)(dpy); if (dpy->cms.defaultCCCs) (*dpy->free_funcs->defaultCCCs)(dpy); if (dpy->cms.perVisualIntensityMaps) (*dpy->free_funcs->intensityMaps)(dpy); if (dpy->atoms) (*dpy->free_funcs->atoms)(dpy); if (dpy->modifiermap) (*dpy->free_funcs->modifiermap)(dpy->modifiermap); if (dpy->key_bindings) (*dpy->free_funcs->key_bindings)(dpy); if (dpy->context_db) (*dpy->free_funcs->context_db)(dpy); if (dpy->xkb_info) (*dpy->free_funcs->xkb)(dpy); /* if RM database was allocated by XGetDefault() free it */ if (dpy->db && (dpy->flags & XlibDisplayDfltRMDB)) XrmDestroyDatabase(dpy->db); if (dpy->screens) { register int i; for (i = 0; i < dpy->nscreens; i++) { Screen *sp = &dpy->screens[i]; if (sp->depths) { register int j; for (j = 0; j < sp->ndepths; j++) { Depth *dp = &sp->depths[j]; if (dp->visuals) { register int k; for (k = 0; k < dp->nvisuals; k++) _XFreeExtData (dp->visuals[k].ext_data); Xfree (dp->visuals); } } Xfree (sp->depths); } _XFreeExtData (sp->ext_data); } Xfree (dpy->screens); } if (dpy->pixmap_format) { register int i; for (i = 0; i < dpy->nformats; i++) _XFreeExtData (dpy->pixmap_format[i].ext_data); Xfree (dpy->pixmap_format); } free(dpy->display_name); Xfree (dpy->vendor); Xfree (dpy->buffer); Xfree (dpy->keysyms); Xfree (dpy->xdefaults); Xfree (dpy->error_vec); _XFreeExtData (dpy->ext_data); Xfree (dpy->free_funcs); Xfree (dpy->scratch_buffer); FreeDisplayLock(dpy); if (dpy->qfree) { register _XQEvent *qelt = dpy->qfree; while (qelt) { register _XQEvent *qnxt = qelt->next; Xfree (qelt); qelt = qnxt; } } while (dpy->im_fd_info) { struct _XConnectionInfo *conni = dpy->im_fd_info; dpy->im_fd_info = conni->next; Xfree (conni->watch_data); Xfree (conni); } if (dpy->conn_watchers) { struct _XConnWatchInfo *watcher = dpy->conn_watchers; dpy->conn_watchers = watcher->next; Xfree (watcher); } Xfree (dpy->filedes); #if USE_XCB _XFreeX11XCBStructure(dpy); #endif /* USE_XCB */ Xfree (dpy); } /* OutOfMemory is called if malloc fails. XOpenDisplay returns NULL after this returns. */ static void OutOfMemory(Display *dpy, char *setup) { #if USE_XCB if(dpy->xcb->connection) xcb_disconnect(dpy->xcb->connection); #else /* !USE_XCB */ _XDisconnectDisplay (dpy->trans_conn); #endif /* USE_XCB */ _XFreeDisplayStructure (dpy); #if !USE_XCB if (setup) Xfree (setup); #endif /* !USE_XCB */ } nx-libs-3.5.99.23/nx-X11/lib/src/ParseCmd.c0000644000000000000000000001556713614532331014520 0ustar /*********************************************************** Copyright 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* XrmParseCommand() Parse command line and store argument values into resource database Allows any un-ambiguous abbreviation for an option name, but requires that the table be ordered with any options that are prefixes of other options appearing before the longer version in the table. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include static void _XReportParseError(XrmOptionDescRec *arg, const char *msg) { (void) fprintf(stderr, "Error parsing argument \"%s\" (%s); %s\n", arg->option, arg->specifier, msg); exit(1); } void XrmParseCommand( XrmDatabase *pdb, /* data base */ register XrmOptionDescList options, /* pointer to table of valid options */ int num_options, /* number of options */ _Xconst char *prefix, /* name to prefix resources with */ int *argc, /* address of argument count */ char **argv) /* argument list (command line) */ { int foundOption; char **argsave; register int i, myargc; XrmBinding bindings[100]; XrmQuark quarks[100]; XrmBinding *start_bindings; XrmQuark *start_quarks; char *optP, *argP = NULL, optchar, argchar = 0; int matches; enum {DontCare, Check, NotSorted, Sorted} table_is_sorted; char **argend; #define PutCommandResource(value_str) \ { \ XrmStringToBindingQuarkList( \ options[i].specifier, start_bindings, start_quarks); \ XrmQPutStringResource(pdb, bindings, quarks, value_str); \ } /* PutCommandResource */ myargc = (*argc); argend = argv + myargc; argsave = ++argv; /* Initialize bindings/quark list with prefix (typically app name). */ quarks[0] = XrmStringToName(prefix); bindings[0] = XrmBindTightly; start_quarks = quarks+1; start_bindings = bindings+1; table_is_sorted = (myargc > 2) ? Check : DontCare; for (--myargc; myargc > 0; --myargc, ++argv) { foundOption = False; matches = 0; for (i=0; i < num_options; ++i) { /* checking the sort order first insures we don't have to re-do the check if the arg hits on the last entry in the table. Useful because usually '=' is the last entry and users frequently specify geometry early in the command */ if (table_is_sorted == Check && i > 0 && strcmp(options[i].option, options[i-1].option) < 0) { table_is_sorted = NotSorted; } for (argP = *argv, optP = options[i].option; (optchar = *optP++) && (argchar = *argP++) && argchar == optchar;); if (!optchar) { if (!*argP || options[i].argKind == XrmoptionStickyArg || options[i].argKind == XrmoptionIsArg) { /* give preference to exact matches, StickyArg and IsArg */ matches = 1; foundOption = i; break; } } else if (!argchar) { /* may be an abbreviation for this option */ matches++; foundOption = i; } else if (table_is_sorted == Sorted && optchar > argchar) { break; } if (table_is_sorted == Check && i > 0 && strcmp(options[i].option, options[i-1].option) < 0) { table_is_sorted = NotSorted; } } if (table_is_sorted == Check && i >= (num_options-1)) table_is_sorted = Sorted; if (matches == 1) { i = foundOption; switch (options[i].argKind){ case XrmoptionNoArg: --(*argc); PutCommandResource(options[i].value); break; case XrmoptionIsArg: --(*argc); PutCommandResource(*argv); break; case XrmoptionStickyArg: --(*argc); PutCommandResource(argP); break; case XrmoptionSepArg: if (myargc > 1) { ++argv; --myargc; --(*argc); --(*argc); PutCommandResource(*argv); } else (*argsave++) = (*argv); break; case XrmoptionResArg: if (myargc > 1) { ++argv; --myargc; --(*argc); --(*argc); XrmPutLineResource(pdb, *argv); } else (*argsave++) = (*argv); break; case XrmoptionSkipArg: if (myargc > 1) { --myargc; (*argsave++) = (*argv++); } (*argsave++) = (*argv); break; case XrmoptionSkipLine: for (; myargc > 0; myargc--) (*argsave++) = (*argv++); break; case XrmoptionSkipNArgs: { register int j = 1 + (long) options[i].value; if (j > myargc) j = myargc; for (; j > 0; j--) { (*argsave++) = (*argv++); myargc--; } argv--; /* went one too far before */ myargc++; } break; default: _XReportParseError (&options[i], "unknown kind"); break; } } else (*argsave++) = (*argv); /*compress arglist*/ } if (argsave < argend) (*argsave)=NULL; /* put NULL terminator on compressed argv */ } nx-libs-3.5.99.23/nx-X11/lib/src/ParseCol.c0000644000000000000000000000662113614532331014521 0ustar /* Copyright 1985, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xcmsint.h" Status XParseColor ( register Display *dpy, Colormap cmap, _Xconst char *spec, XColor *def) { register int n, i; int r, g, b; char c; XcmsCCC ccc; XcmsColor cmsColor; if (!spec) return(0); n = strlen (spec); if (*spec == '#') { /* * RGB */ spec++; n--; if (n != 3 && n != 6 && n != 9 && n != 12) return (0); n /= 3; g = b = 0; do { r = g; g = b; b = 0; for (i = n; --i >= 0; ) { c = *spec++; b <<= 4; if (c >= '0' && c <= '9') b |= c - '0'; else if (c >= 'A' && c <= 'F') b |= c - ('A' - 10); else if (c >= 'a' && c <= 'f') b |= c - ('a' - 10); else return (0); } } while (*spec != '\0'); n <<= 2; n = 16 - n; def->red = r << n; def->green = g << n; def->blue = b << n; def->flags = DoRed | DoGreen | DoBlue; return (1); } #ifdef XCMS /* * Let's Attempt to use Xcms and i18n approach to Parse Color */ if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { const char *tmpName = spec; switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor, XcmsRGBFormat)) { case XcmsSuccess: case XcmsSuccessWithCompression: cmsColor.pixel = def->pixel; _XcmsRGB_to_XColor(&cmsColor, def, 1); return(1); case XcmsFailure: case _XCMS_NEWNAME: /* * if the result was _XCMS_NEWNAME tmpName points to * a string in cmsColNm.c:pairs table, for example, * gray70 would become tekhvc:0.0/70.0/0.0 */ break; } } #endif /* * Xcms and i18n methods failed, so lets pass it to the server * for parsing. */ { xLookupColorReply reply; register xLookupColorReq *req; LockDisplay(dpy); GetReq (LookupColor, req); req->cmap = cmap; req->nbytes = n = strlen(spec); req->length += (n + 3) >> 2; Data (dpy, spec, (long)n); if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) { UnlockDisplay(dpy); SyncHandle(); return (0); } def->red = reply.exactRed; def->green = reply.exactGreen; def->blue = reply.exactBlue; def->flags = DoRed | DoGreen | DoBlue; UnlockDisplay(dpy); SyncHandle(); return (1); } } nx-libs-3.5.99.23/nx-X11/lib/src/ParseGeom.c0000644000000000000000000001014713614532331014671 0ustar /* Copyright 1985, 1986, 1987,1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xutil.h" /* * XParseGeometry parses strings of the form * "=x{+-}{+-}", where * width, height, xoffset, and yoffset are unsigned integers. * Example: "=80x24+300-49" * The equal sign is optional. * It returns a bitmask that indicates which of the four values * were actually found in the string. For each value found, * the corresponding argument is updated; for each value * not found, the corresponding argument is left unchanged. */ static int ReadInteger(char *string, char **NextString) { register int Result = 0; int Sign = 1; if (*string == '+') string++; else if (*string == '-') { string++; Sign = -1; } for (; (*string >= '0') && (*string <= '9'); string++) { Result = (Result * 10) + (*string - '0'); } *NextString = string; if (Sign >= 0) return (Result); else return (-Result); } int XParseGeometry ( _Xconst char *string, int *x, int *y, unsigned int *width, /* RETURN */ unsigned int *height) /* RETURN */ { int mask = NoValue; register char *strind; unsigned int tempWidth = 0, tempHeight = 0; int tempX = 0, tempY = 0; char *nextCharacter; if ( (string == NULL) || (*string == '\0')) return(mask); if (*string == '=') string++; /* ignore possible '=' at beg of geometry spec */ strind = (char *)string; if (*strind != '+' && *strind != '-' && *strind != 'x') { tempWidth = ReadInteger(strind, &nextCharacter); if (strind == nextCharacter) return (0); strind = nextCharacter; mask |= WidthValue; } if (*strind == 'x' || *strind == 'X') { strind++; tempHeight = ReadInteger(strind, &nextCharacter); if (strind == nextCharacter) return (0); strind = nextCharacter; mask |= HeightValue; } if ((*strind == '+') || (*strind == '-')) { if (*strind == '-') { strind++; tempX = -ReadInteger(strind, &nextCharacter); if (strind == nextCharacter) return (0); strind = nextCharacter; mask |= XNegative; } else { strind++; tempX = ReadInteger(strind, &nextCharacter); if (strind == nextCharacter) return(0); strind = nextCharacter; } mask |= XValue; if ((*strind == '+') || (*strind == '-')) { if (*strind == '-') { strind++; tempY = -ReadInteger(strind, &nextCharacter); if (strind == nextCharacter) return(0); strind = nextCharacter; mask |= YNegative; } else { strind++; tempY = ReadInteger(strind, &nextCharacter); if (strind == nextCharacter) return(0); strind = nextCharacter; } mask |= YValue; } } /* If strind isn't at the end of the string the it's an invalid geometry specification. */ if (*strind != '\0') return (0); if (mask & XValue) *x = tempX; if (mask & YValue) *y = tempY; if (mask & WidthValue) *width = tempWidth; if (mask & HeightValue) *height = tempHeight; return (mask); } nx-libs-3.5.99.23/nx-X11/lib/src/pathmax.h0000644000000000000000000000537413614532331014464 0ustar /*********************************************************** Copyright 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* * Provides a single definition of PATH_MAX instead of replicating this mess * in multiple files */ #ifdef HAVE_CONFIG_H #include #endif #include #ifndef X_NOT_POSIX #ifdef _POSIX_SOURCE #include #else #define _POSIX_SOURCE #include #undef _POSIX_SOURCE #endif #endif #ifndef PATH_MAX #ifdef WIN32 #define PATH_MAX 512 #else #include #endif #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN #else #define PATH_MAX 1024 #endif #endif #endif nx-libs-3.5.99.23/nx-X11/lib/src/PeekEvent.c0000644000000000000000000000342313614532331014674 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* * Return the next event in the queue, * BUT do not remove it from the queue. * If none found, flush and wait until there is an event to peek. */ int XPeekEvent ( register Display *dpy, register XEvent *event) { XEvent copy; LockDisplay(dpy); if (dpy->head == NULL) _XReadEvents(dpy); #ifdef NX_TRANS_SOCKET if (_XGetIOError(dpy)) { UnlockDisplay(dpy); return 1; } #endif *event = (dpy->head)->event; if (_XCopyEventCookie(dpy, &event->xcookie, ©.xcookie)) { _XStoreEventCookie(dpy, ©); *event = copy; } UnlockDisplay(dpy); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/PeekIfEv.c0000644000000000000000000000461613614532331014451 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* * return the next event in the queue that satisfies the predicate. * BUT do not remove it from the queue. * If none found, flush, and then wait until one satisfies the predicate. */ int XPeekIfEvent ( register Display *dpy, register XEvent *event, Bool (*predicate)( Display* /* display */, XEvent* /* event */, char* /* arg */ ), char *arg) { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; LockDisplay(dpy); prev = NULL; while (1) { for (qelt = prev ? prev->next : dpy->head; qelt; prev = qelt, qelt = qelt->next) { if(qelt->qserial_num > qe_serial && (*predicate)(dpy, &qelt->event, arg)) { XEvent copy; *event = qelt->event; if (_XCopyEventCookie(dpy, &event->xcookie, ©.xcookie)) { _XStoreEventCookie(dpy, ©); *event = copy; } UnlockDisplay(dpy); return 0; } } if (prev) qe_serial = prev->qserial_num; _XReadEvents(dpy); if (prev && prev->qserial_num != qe_serial) /* another thread has snatched this event */ prev = NULL; #ifdef NX_TRANS_SOCKET if (_XGetIOError(dpy)) { UnlockDisplay(dpy); return 0; } #endif } } nx-libs-3.5.99.23/nx-X11/lib/src/Pending.c0000644000000000000000000000417413614532331014376 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) #include #endif #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* Read in pending events if needed and return the number of queued events. */ int XEventsQueued ( register Display *dpy, int mode) { int ret_val; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "\nXEventsQueued: Called with a display at [%p].\n", (void *)dpy); #endif LockDisplay(dpy); if (dpy->qlen || (mode == QueuedAlready)) ret_val = dpy->qlen; else ret_val = _XEventsQueued (dpy, mode); #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "\nXEventsQueued: Going to unlock the display at [%p].\n", (void *)dpy); #endif UnlockDisplay(dpy); return ret_val; } int XPending (register Display *dpy) { int ret_val; LockDisplay(dpy); if (dpy->qlen) ret_val = dpy->qlen; else ret_val = _XEventsQueued (dpy, QueuedAfterFlush); UnlockDisplay(dpy); return ret_val; } nx-libs-3.5.99.23/nx-X11/lib/src/PixFormats.c0000644000000000000000000000357213614532331015107 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include /* * XListPixmapFormats - return info from connection setup */ XPixmapFormatValues *XListPixmapFormats ( Display *dpy, int *count) /* RETURN */ { XPixmapFormatValues *formats = Xmalloc(dpy->nformats * sizeof (XPixmapFormatValues)); if (formats) { register int i; register XPixmapFormatValues *f; register ScreenFormat *sf; /* * copy data from internal Xlib data structure in display */ for (i = dpy->nformats, f = formats, sf = dpy->pixmap_format; i > 0; i--, f++, sf++) { f->depth = sf->depth; f->bits_per_pixel = sf->bits_per_pixel; f->scanline_pad = sf->scanline_pad; } *count = dpy->nformats; } return formats; } nx-libs-3.5.99.23/nx-X11/lib/src/PmapBgnd.c0000644000000000000000000000312213614532331014472 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetWindowBackgroundPixmap( register Display *dpy, Window w, Pixmap pixmap) { register xChangeWindowAttributesReq *req; LockDisplay (dpy); GetReqExtra (ChangeWindowAttributes, 4, req); req->window = w; req->valueMask = CWBackPixmap; OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), pixmap); UnlockDisplay (dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/PmapBord.c0000644000000000000000000000311613614532331014511 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetWindowBorderPixmap( register Display *dpy, Window w, Pixmap pixmap) { register xChangeWindowAttributesReq *req; LockDisplay(dpy); GetReqExtra (ChangeWindowAttributes, 4, req); req->window = w; req->valueMask = CWBorderPixmap; OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), pixmap); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/poly.h0000644000000000000000000002530013614532331013774 0ustar /************************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************/ /* * This file contains a few macros to help track * the edge of a filled object. The object is assumed * to be filled in scanline order, and thus the * algorithm used is an extension of Bresenham's line * drawing algorithm which assumes that y is always the * major axis. * Since these pieces of code are the same for any filled shape, * it is more convenient to gather the library in one * place, but since these pieces of code are also in * the inner loops of output primitives, procedure call * overhead is out of the question. * See the author for a derivation if needed. */ /* * In scan converting polygons, we want to choose those pixels * which are inside the polygon. Thus, we add .5 to the starting * x coordinate for both left and right edges. Now we choose the * first pixel which is inside the pgon for the left edge and the * first pixel which is outside the pgon for the right edge. * Draw the left pixel, but not the right. * * How to add .5 to the starting x coordinate: * If the edge is moving to the right, then subtract dy from the * error term from the general form of the algorithm. * If the edge is moving to the left, then add dy to the error term. * * The reason for the difference between edges moving to the left * and edges moving to the right is simple: If an edge is moving * to the right, then we want the algorithm to flip immediately. * If it is moving to the left, then we don't want it to flip until * we traverse an entire pixel. */ #define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \ int dx; /* local storage */ \ \ /* \ * if the edge is horizontal, then it is ignored \ * and assumed not to be processed. Otherwise, do this stuff. \ */ \ if ((dy) != 0) { \ xStart = (x1); \ dx = (x2) - xStart; \ if (dx < 0) { \ m = dx / (dy); \ m1 = m - 1; \ incr1 = -2 * dx + 2 * (dy) * m1; \ incr2 = -2 * dx + 2 * (dy) * m; \ d = 2 * m * (dy) - 2 * dx - 2 * (dy); \ } else { \ m = dx / (dy); \ m1 = m + 1; \ incr1 = 2 * dx - 2 * (dy) * m1; \ incr2 = 2 * dx - 2 * (dy) * m; \ d = -2 * m * (dy) + 2 * dx; \ } \ } \ } #define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \ if (m1 > 0) { \ if (d > 0) { \ minval += m1; \ d += incr1; \ } \ else { \ minval += m; \ d += incr2; \ } \ } else {\ if (d >= 0) { \ minval += m1; \ d += incr1; \ } \ else { \ minval += m; \ d += incr2; \ } \ } \ } /* * This structure contains all of the information needed * to run the bresenham algorithm. * The variables may be hardcoded into the declarations * instead of using this structure to make use of * register declarations. */ typedef struct { int minor_axis; /* minor axis */ int d; /* decision variable */ int m, m1; /* slope and slope+1 */ int incr1, incr2; /* error increments */ } BRESINFO; #define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \ BRESINITPGON(dmaj, min1, min2, bres.minor_axis, bres.d, \ bres.m, bres.m1, bres.incr1, bres.incr2) #define BRESINCRPGONSTRUCT(bres) \ BRESINCRPGON(bres.d, bres.minor_axis, bres.m, bres.m1, bres.incr1, bres.incr2) /* * These are the data structures needed to scan * convert regions. Two different scan conversion * methods are available -- the even-odd method, and * the winding number method. * The even-odd rule states that a point is inside * the polygon if a ray drawn from that point in any * direction will pass through an odd number of * path segments. * By the winding number rule, a point is decided * to be inside the polygon if a ray drawn from that * point in any direction passes through a different * number of clockwise and counter-clockwise path * segments. * * These data structures are adapted somewhat from * the algorithm in (Foley/Van Dam) for scan converting * polygons. * The basic algorithm is to start at the top (smallest y) * of the polygon, stepping down to the bottom of * the polygon by incrementing the y coordinate. We * keep a list of edges which the current scanline crosses, * sorted by x. This list is called the Active Edge Table (AET) * As we change the y-coordinate, we update each entry in * in the active edge table to reflect the edges new xcoord. * This list must be sorted at each scanline in case * two edges intersect. * We also keep a data structure known as the Edge Table (ET), * which keeps track of all the edges which the current * scanline has not yet reached. The ET is basically a * list of ScanLineList structures containing a list of * edges which are entered at a given scanline. There is one * ScanLineList per scanline at which an edge is entered. * When we enter a new edge, we move it from the ET to the AET. * * From the AET, we can implement the even-odd rule as in * (Foley/Van Dam). * The winding number rule is a little trickier. We also * keep the EdgeTableEntries in the AET linked by the * nextWETE (winding EdgeTableEntry) link. This allows * the edges to be linked just as before for updating * purposes, but only uses the edges linked by the nextWETE * link as edges representing spans of the polygon to * drawn (as with the even-odd rule). */ /* * for the winding number rule */ #define CLOCKWISE 1 #define COUNTERCLOCKWISE -1 typedef struct _EdgeTableEntry { int ymax; /* ycoord at which we exit this edge. */ BRESINFO bres; /* Bresenham info to run the edge */ struct _EdgeTableEntry *next; /* next in the list */ struct _EdgeTableEntry *back; /* for insertion sort */ struct _EdgeTableEntry *nextWETE; /* for winding num rule */ int ClockWise; /* flag for winding number rule */ } EdgeTableEntry; typedef struct _ScanLineList{ int scanline; /* the scanline represented */ EdgeTableEntry *edgelist; /* header node */ struct _ScanLineList *next; /* next in the list */ } ScanLineList; typedef struct { int ymax; /* ymax for the polygon */ int ymin; /* ymin for the polygon */ ScanLineList scanlines; /* header node */ } EdgeTable; /* * Here is a struct to help with storage allocation * so we can allocate a big chunk at a time, and then take * pieces from this heap when we need to. */ #define SLLSPERBLOCK 25 typedef struct _ScanLineListBlock { ScanLineList SLLs[SLLSPERBLOCK]; struct _ScanLineListBlock *next; } ScanLineListBlock; /* * * a few macros for the inner loops of the fill code where * performance considerations don't allow a procedure call. * * Evaluate the given edge at the given scanline. * If the edge has expired, then we leave it and fix up * the active edge table; otherwise, we increment the * x value to be ready for the next scanline. * The winding number rule is in effect, so we must notify * the caller when the edge has been removed so he * can reorder the Winding Active Edge Table. */ #define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) { \ if (pAET->ymax == y) { /* leaving this edge */ \ pPrevAET->next = pAET->next; \ pAET = pPrevAET->next; \ fixWAET = 1; \ if (pAET) \ pAET->back = pPrevAET; \ } \ else { \ BRESINCRPGONSTRUCT(pAET->bres); \ pPrevAET = pAET; \ pAET = pAET->next; \ } \ } /* * Evaluate the given edge at the given scanline. * If the edge has expired, then we leave it and fix up * the active edge table; otherwise, we increment the * x value to be ready for the next scanline. * The even-odd rule is in effect. */ #define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \ if (pAET->ymax == y) { /* leaving this edge */ \ pPrevAET->next = pAET->next; \ pAET = pPrevAET->next; \ if (pAET) \ pAET->back = pPrevAET; \ } \ else { \ BRESINCRPGONSTRUCT(pAET->bres); \ pPrevAET = pAET; \ pAET = pAET->next; \ } \ } nx-libs-3.5.99.23/nx-X11/lib/src/PolyReg.c0000644000000000000000000004307513614532331014376 0ustar /************************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************/ #define LARGE_COORDINATE 1000000 #define SMALL_COORDINATE -LARGE_COORDINATE #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xutil.h" #include #include "poly.h" /* * InsertEdgeInET * * Insert the given edge into the edge table. * First we must find the correct bucket in the * Edge table, then find the right slot in the * bucket. Finally, we can insert it. * */ static void InsertEdgeInET( EdgeTable *ET, EdgeTableEntry *ETE, int scanline, ScanLineListBlock **SLLBlock, int *iSLLBlock) { register EdgeTableEntry *start, *prev; register ScanLineList *pSLL, *pPrevSLL; ScanLineListBlock *tmpSLLBlock; /* * find the right bucket to put the edge into */ pPrevSLL = &ET->scanlines; pSLL = pPrevSLL->next; while (pSLL && (pSLL->scanline < scanline)) { pPrevSLL = pSLL; pSLL = pSLL->next; } /* * reassign pSLL (pointer to ScanLineList) if necessary */ if ((!pSLL) || (pSLL->scanline > scanline)) { if (*iSLLBlock > SLLSPERBLOCK-1) { tmpSLLBlock = Xmalloc(sizeof(ScanLineListBlock)); (*SLLBlock)->next = tmpSLLBlock; tmpSLLBlock->next = (ScanLineListBlock *)NULL; *SLLBlock = tmpSLLBlock; *iSLLBlock = 0; } pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]); pSLL->next = pPrevSLL->next; pSLL->edgelist = (EdgeTableEntry *)NULL; pPrevSLL->next = pSLL; } pSLL->scanline = scanline; /* * now insert the edge in the right bucket */ prev = (EdgeTableEntry *)NULL; start = pSLL->edgelist; while (start && (start->bres.minor_axis < ETE->bres.minor_axis)) { prev = start; start = start->next; } ETE->next = start; if (prev) prev->next = ETE; else pSLL->edgelist = ETE; } /* * CreateEdgeTable * * This routine creates the edge table for * scan converting polygons. * The Edge Table (ET) looks like: * * EdgeTable * -------- * | ymax | ScanLineLists * |scanline|-->------------>-------------->... * -------- |scanline| |scanline| * |edgelist| |edgelist| * --------- --------- * | | * | | * V V * list of ETEs list of ETEs * * where ETE is an EdgeTableEntry data structure, * and there is one ScanLineList per scanline at * which an edge is initially entered. * */ static void CreateETandAET( register int count, register XPoint *pts, EdgeTable *ET, EdgeTableEntry *AET, register EdgeTableEntry *pETEs, ScanLineListBlock *pSLLBlock) { register XPoint *top, *bottom; register XPoint *PrevPt, *CurrPt; int iSLLBlock = 0; int dy; if (count < 2) return; /* * initialize the Active Edge Table */ AET->next = (EdgeTableEntry *)NULL; AET->back = (EdgeTableEntry *)NULL; AET->nextWETE = (EdgeTableEntry *)NULL; AET->bres.minor_axis = SMALL_COORDINATE; /* * initialize the Edge Table. */ ET->scanlines.next = (ScanLineList *)NULL; ET->ymax = SMALL_COORDINATE; ET->ymin = LARGE_COORDINATE; pSLLBlock->next = (ScanLineListBlock *)NULL; PrevPt = &pts[count-1]; /* * for each vertex in the array of points. * In this loop we are dealing with two vertices at * a time -- these make up one edge of the polygon. */ while (count--) { CurrPt = pts++; /* * find out which point is above and which is below. */ if (PrevPt->y > CurrPt->y) { bottom = PrevPt, top = CurrPt; pETEs->ClockWise = 0; } else { bottom = CurrPt, top = PrevPt; pETEs->ClockWise = 1; } /* * don't add horizontal edges to the Edge table. */ if (bottom->y != top->y) { pETEs->ymax = bottom->y-1; /* -1 so we don't get last scanline */ /* * initialize integer edge algorithm */ dy = bottom->y - top->y; BRESINITPGONSTRUCT(dy, top->x, bottom->x, pETEs->bres); InsertEdgeInET(ET, pETEs, top->y, &pSLLBlock, &iSLLBlock); if (PrevPt->y > ET->ymax) ET->ymax = PrevPt->y; if (PrevPt->y < ET->ymin) ET->ymin = PrevPt->y; pETEs++; } PrevPt = CurrPt; } } /* * loadAET * * This routine moves EdgeTableEntries from the * EdgeTable into the Active Edge Table, * leaving them sorted by smaller x coordinate. * */ static void loadAET( register EdgeTableEntry *AET, register EdgeTableEntry *ETEs) { register EdgeTableEntry *pPrevAET; register EdgeTableEntry *tmp; pPrevAET = AET; AET = AET->next; while (ETEs) { while (AET && (AET->bres.minor_axis < ETEs->bres.minor_axis)) { pPrevAET = AET; AET = AET->next; } tmp = ETEs->next; ETEs->next = AET; if (AET) AET->back = ETEs; ETEs->back = pPrevAET; pPrevAET->next = ETEs; pPrevAET = ETEs; ETEs = tmp; } } /* * computeWAET * * This routine links the AET by the * nextWETE (winding EdgeTableEntry) link for * use by the winding number rule. The final * Active Edge Table (AET) might look something * like: * * AET * ---------- --------- --------- * |ymax | |ymax | |ymax | * | ... | |... | |... | * |next |->|next |->|next |->... * |nextWETE| |nextWETE| |nextWETE| * --------- --------- ^-------- * | | | * V-------------------> V---> ... * */ static void computeWAET( register EdgeTableEntry *AET) { register EdgeTableEntry *pWETE; register int inside = 1; register int isInside = 0; AET->nextWETE = (EdgeTableEntry *)NULL; pWETE = AET; AET = AET->next; while (AET) { if (AET->ClockWise) isInside++; else isInside--; if ((!inside && !isInside) || ( inside && isInside)) { pWETE->nextWETE = AET; pWETE = AET; inside = !inside; } AET = AET->next; } pWETE->nextWETE = (EdgeTableEntry *)NULL; } /* * InsertionSort * * Just a simple insertion sort using * pointers and back pointers to sort the Active * Edge Table. * */ static int InsertionSort( register EdgeTableEntry *AET) { register EdgeTableEntry *pETEchase; register EdgeTableEntry *pETEinsert; register EdgeTableEntry *pETEchaseBackTMP; register int changed = 0; AET = AET->next; while (AET) { pETEinsert = AET; pETEchase = AET; while (pETEchase->back->bres.minor_axis > AET->bres.minor_axis) pETEchase = pETEchase->back; AET = AET->next; if (pETEchase != pETEinsert) { pETEchaseBackTMP = pETEchase->back; pETEinsert->back->next = AET; if (AET) AET->back = pETEinsert->back; pETEinsert->next = pETEchase; pETEchase->back->next = pETEinsert; pETEchase->back = pETEinsert; pETEinsert->back = pETEchaseBackTMP; changed = 1; } } return(changed); } /* * Clean up our act. */ static void FreeStorage( register ScanLineListBlock *pSLLBlock) { register ScanLineListBlock *tmpSLLBlock; while (pSLLBlock) { tmpSLLBlock = pSLLBlock->next; Xfree(pSLLBlock); pSLLBlock = tmpSLLBlock; } } /* * Create an array of rectangles from a list of points. * If indeed these things (POINTS, RECTS) are the same, * then this proc is still needed, because it allocates * storage for the array, which was allocated on the * stack by the calling procedure. * */ static int PtsToRegion( register int numFullPtBlocks, register int iCurPtBlock, POINTBLOCK *FirstPtBlock, REGION *reg) { register BOX *rects; register XPoint *pts; register POINTBLOCK *CurPtBlock; register int i; register BOX *extents; register int numRects; BOX *prevRects = reg->rects; extents = ®->extents; numRects = ((numFullPtBlocks * NUMPTSTOBUFFER) + iCurPtBlock) >> 1; if (!(reg->rects = Xrealloc(reg->rects, sizeof(BOX) * numRects))) { Xfree(prevRects); return(0); } reg->size = numRects; CurPtBlock = FirstPtBlock; rects = reg->rects - 1; numRects = 0; extents->x1 = MAXSHORT, extents->x2 = MINSHORT; for ( ; numFullPtBlocks >= 0; numFullPtBlocks--) { /* the loop uses 2 points per iteration */ i = NUMPTSTOBUFFER >> 1; if (!numFullPtBlocks) i = iCurPtBlock >> 1; for (pts = CurPtBlock->pts; i--; pts += 2) { if (pts->x == pts[1].x) continue; if (numRects && pts->x == rects->x1 && pts->y == rects->y2 && pts[1].x == rects->x2 && (numRects == 1 || rects[-1].y1 != rects->y1) && (i && pts[2].y > pts[1].y)) { rects->y2 = pts[1].y + 1; continue; } numRects++; rects++; rects->x1 = pts->x; rects->y1 = pts->y; rects->x2 = pts[1].x; rects->y2 = pts[1].y + 1; if (rects->x1 < extents->x1) extents->x1 = rects->x1; if (rects->x2 > extents->x2) extents->x2 = rects->x2; } CurPtBlock = CurPtBlock->next; } if (numRects) { extents->y1 = reg->rects->y1; extents->y2 = rects->y2; } else { extents->x1 = 0; extents->y1 = 0; extents->x2 = 0; extents->y2 = 0; } reg->numRects = numRects; return(TRUE); } /* * polytoregion * * Scan converts a polygon by returning a run-length * encoding of the resultant bitmap -- the run-length * encoding is in the form of an array of rectangles. */ Region XPolygonRegion( XPoint *Pts, /* the pts */ int Count, /* number of pts */ int rule) /* winding rule */ { Region region; register EdgeTableEntry *pAET; /* Active Edge Table */ register int y; /* current scanline */ register int iPts = 0; /* number of pts in buffer */ register EdgeTableEntry *pWETE; /* Winding Edge Table Entry*/ register ScanLineList *pSLL; /* current scanLineList */ register XPoint *pts; /* output buffer */ EdgeTableEntry *pPrevAET; /* ptr to previous AET */ EdgeTable ET; /* header node for ET */ EdgeTableEntry AET; /* header node for AET */ EdgeTableEntry *pETEs; /* EdgeTableEntries pool */ ScanLineListBlock SLLBlock; /* header for scanlinelist */ int fixWAET = FALSE; POINTBLOCK FirstPtBlock, *curPtBlock; /* PtBlock buffers */ POINTBLOCK *tmpPtBlock; int numFullPtBlocks = 0; if (! (region = XCreateRegion())) return (Region) NULL; /* special case a rectangle */ pts = Pts; if (((Count == 4) || ((Count == 5) && (pts[4].x == pts[0].x) && (pts[4].y == pts[0].y))) && (((pts[0].y == pts[1].y) && (pts[1].x == pts[2].x) && (pts[2].y == pts[3].y) && (pts[3].x == pts[0].x)) || ((pts[0].x == pts[1].x) && (pts[1].y == pts[2].y) && (pts[2].x == pts[3].x) && (pts[3].y == pts[0].y)))) { region->extents.x1 = min(pts[0].x, pts[2].x); region->extents.y1 = min(pts[0].y, pts[2].y); region->extents.x2 = max(pts[0].x, pts[2].x); region->extents.y2 = max(pts[0].y, pts[2].y); if ((region->extents.x1 != region->extents.x2) && (region->extents.y1 != region->extents.y2)) { region->numRects = 1; *(region->rects) = region->extents; } return(region); } if (Count < 2) return region; if (! (pETEs = Xmalloc(sizeof(EdgeTableEntry) * Count))) { XDestroyRegion(region); return (Region) NULL; } pts = FirstPtBlock.pts; CreateETandAET(Count, Pts, &ET, &AET, pETEs, &SLLBlock); pSLL = ET.scanlines.next; curPtBlock = &FirstPtBlock; if (rule == EvenOddRule) { /* * for each scanline */ for (y = ET.ymin; y < ET.ymax; y++) { /* * Add a new edge to the active edge table when we * get to the next edge. */ if (pSLL != NULL && y == pSLL->scanline) { loadAET(&AET, pSLL->edgelist); pSLL = pSLL->next; } pPrevAET = &AET; pAET = AET.next; /* * for each active edge */ while (pAET) { pts->x = pAET->bres.minor_axis, pts->y = y; pts++, iPts++; /* * send out the buffer */ if (iPts == NUMPTSTOBUFFER) { tmpPtBlock = Xmalloc(sizeof(POINTBLOCK)); curPtBlock->next = tmpPtBlock; curPtBlock = tmpPtBlock; pts = curPtBlock->pts; numFullPtBlocks++; iPts = 0; } EVALUATEEDGEEVENODD(pAET, pPrevAET, y); } (void) InsertionSort(&AET); } } else { /* * for each scanline */ for (y = ET.ymin; y < ET.ymax; y++) { /* * Add a new edge to the active edge table when we * get to the next edge. */ if (pSLL != NULL && y == pSLL->scanline) { loadAET(&AET, pSLL->edgelist); computeWAET(&AET); pSLL = pSLL->next; } pPrevAET = &AET; pAET = AET.next; pWETE = pAET; /* * for each active edge */ while (pAET) { /* * add to the buffer only those edges that * are in the Winding active edge table. */ if (pWETE == pAET) { pts->x = pAET->bres.minor_axis, pts->y = y; pts++, iPts++; /* * send out the buffer */ if (iPts == NUMPTSTOBUFFER) { tmpPtBlock = Xmalloc(sizeof(POINTBLOCK)); curPtBlock->next = tmpPtBlock; curPtBlock = tmpPtBlock; pts = curPtBlock->pts; numFullPtBlocks++; iPts = 0; } pWETE = pWETE->nextWETE; } EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET); } /* * recompute the winding active edge table if * we just resorted or have exited an edge. */ if (InsertionSort(&AET) || fixWAET) { computeWAET(&AET); fixWAET = FALSE; } } } FreeStorage(SLLBlock.next); (void) PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, region); for (curPtBlock = FirstPtBlock.next; --numFullPtBlocks >= 0;) { tmpPtBlock = curPtBlock->next; Xfree(curPtBlock); curPtBlock = tmpPtBlock; } Xfree(pETEs); return(region); } nx-libs-3.5.99.23/nx-X11/lib/src/PolyTxt16.c0000644000000000000000000001354013614532331014601 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDrawText16( register Display *dpy, Drawable d, GC gc, int x, int y, XTextItem16 *items, int nitems) { register int i; register XTextItem16 *item; int length = 0; register xPolyText16Req *req; LockDisplay(dpy); FlushGC(dpy, gc); GetReq (PolyText16, req); req->drawable = d; req->gc = gc->gid; req->x = x; req->y = y; item = items; for (i=0; i < nitems; i++) { if (item->font) length += 5; /* a 255 byte, plus size of Font id */ if (item->delta) { if (item->delta > 0) { length += SIZEOF(xTextElt) * ((item->delta + 126) / 127); } else { length += SIZEOF(xTextElt) * ((-item->delta + 127) / 128); } } if (item->nchars > 0) { length += SIZEOF(xTextElt) * ((item->nchars + 253) / 254 - 1); if (!item->delta) length += SIZEOF(xTextElt); length += item->nchars << 1; } item++; } req->length += (length + 3)>>2; /* convert to number of 32-bit words */ /* * If the entire request does not fit into the remaining space in the * buffer, flush the buffer first. If the request does fit into the * empty buffer, then we won't have to flush it at the end to keep * the buffer 32-bit aligned. */ if (dpy->bufptr + length > dpy->bufmax) _XFlush (dpy); item = items; for (i=0; i< nitems; i++) { if (item->font) { /* to mark a font shift, write a 255 byte followed by the 4 bytes of font ID, big-end first */ register unsigned char *f; BufAlloc (unsigned char *, f, 5); f[0] = 255; f[1] = (item->font & 0xff000000) >> 24; f[2] = (item->font & 0x00ff0000) >> 16; f[3] = (item->font & 0x0000ff00) >> 8; f[4] = item->font & 0x000000ff; /* update GC shadow */ gc->values.font = item->font; } { int nbytes = SIZEOF(xTextElt); int PartialNChars = item->nchars; int PartialDelta = item->delta; register xTextElt *elt = NULL; int FirstTimeThrough = True; XChar2b *CharacterOffset = item->chars; while((PartialDelta < -128) || (PartialDelta > 127)) { int nb = SIZEOF(xTextElt); BufAlloc (xTextElt *, elt, nb); elt->len = 0; if (PartialDelta > 0 ) { elt->delta = 127; PartialDelta = PartialDelta - 127; } else { elt->delta = -128; PartialDelta = PartialDelta + 128; } } if (PartialDelta) { BufAlloc (xTextElt *, elt, nbytes); elt->len = 0; elt->delta = PartialDelta; } while(PartialNChars > 254) { nbytes = 254 * 2; if (FirstTimeThrough) { FirstTimeThrough = False; if (!item->delta) { nbytes += SIZEOF(xTextElt); BufAlloc (xTextElt *, elt, nbytes); elt->delta = 0; } else { char *DummyChar; BufAlloc(char *, DummyChar, nbytes); #ifdef lint DummyChar = DummyChar; #endif } } else { nbytes += SIZEOF(xTextElt); BufAlloc (xTextElt *, elt, nbytes); elt->delta = 0; } elt->len = 254; memcpy ((char *) (elt + 1), (char *)CharacterOffset, 254 * 2); PartialNChars = PartialNChars - 254; CharacterOffset += 254; } if (PartialNChars) { nbytes = PartialNChars * 2; if (FirstTimeThrough) { FirstTimeThrough = False; if (!item->delta) { nbytes += SIZEOF(xTextElt); BufAlloc (xTextElt *, elt, nbytes); elt->delta = 0; } else { char *DummyChar; BufAlloc(char *, DummyChar, nbytes); #ifdef lint DummyChar = DummyChar; #endif } } else { nbytes += SIZEOF(xTextElt); BufAlloc (xTextElt *, elt, nbytes); elt->delta = 0; } elt->len = PartialNChars; memcpy ((char *) (elt + 1), (char *)CharacterOffset, PartialNChars * 2); } } item++; } /* Pad request out to a 32-bit boundary */ if (length &= 3) { char *pad; /* * BufAlloc is a macro that uses its last argument more than * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" */ length = 4 - length; BufAlloc (char *, pad, length); /* * if there are 3 bytes of padding, the first byte MUST be 0 * so the pad bytes aren't mistaken for a final xTextElt */ *pad = 0; } /* * If the buffer pointer is not now pointing to a 32-bit boundary, * we must flush the buffer so that it does point to a 32-bit boundary * at the end of this routine. */ if ((dpy->bufptr - dpy->buffer) & 3) _XFlush (dpy); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/PolyTxt.c0000644000000000000000000001404613614532331014434 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDrawText( register Display *dpy, Drawable d, GC gc, int x, int y, XTextItem *items, int nitems) { register int i; register XTextItem *item; int length = 0; register xPolyText8Req *req; LockDisplay(dpy); FlushGC(dpy, gc); GetReq (PolyText8, req); req->drawable = d; req->gc = gc->gid; req->x = x; req->y = y; item = items; for (i=0; i < nitems; i++) { if (item->font) length += 5; /* a 255 byte, plus size of Font id */ if (item->delta) { if (item->delta > 0) { length += SIZEOF(xTextElt) * ((item->delta + 126) / 127); } else { length += SIZEOF(xTextElt) * ((-item->delta + 127) / 128); } } if (item->nchars > 0) { length += SIZEOF(xTextElt) * ((item->nchars + 253) / 254 - 1); if (!item->delta) length += SIZEOF(xTextElt); length += item->nchars; } item++; } req->length += (length + 3)>>2; /* convert to number of 32-bit words */ /* * If the entire request does not fit into the remaining space in the * buffer, flush the buffer first. If the request does fit into the * empty buffer, then we won't have to flush it at the end to keep * the buffer 32-bit aligned. */ if (dpy->bufptr + length > dpy->bufmax) _XFlush (dpy); item = items; for (i=0; i< nitems; i++) { if (item->font) { /* to mark a font shift, write a 255 byte followed by the 4 bytes of font ID, big-end first */ register unsigned char *f; BufAlloc (unsigned char *, f, 5); f[0] = 255; f[1] = (item->font & 0xff000000) >> 24; f[2] = (item->font & 0x00ff0000) >> 16; f[3] = (item->font & 0x0000ff00) >> 8; f[4] = item->font & 0x000000ff; /* update GC shadow */ gc->values.font = item->font; } { int nbytes = SIZEOF(xTextElt); int PartialNChars = item->nchars; int PartialDelta = item->delta; /* register xTextElt *elt; */ int FirstTimeThrough = True; char *CharacterOffset = item->chars; char *tbuf = NULL; while((PartialDelta < -128) || (PartialDelta > 127)) { int nb = SIZEOF(xTextElt); BufAlloc (char *, tbuf, nb); *tbuf = 0; /* elt->len */ if (PartialDelta > 0 ) { *(tbuf+1) = 127; /* elt->delta */ PartialDelta = PartialDelta - 127; } else { /* -128 = 0x8, need to be careful of signed chars... */ *((unsigned char *)(tbuf+1)) = 0x80; /* elt->delta */ PartialDelta = PartialDelta + 128; } } if (PartialDelta) { BufAlloc (char *, tbuf , nbytes); *tbuf = 0; /* elt->len */ *(tbuf+1) = PartialDelta; /* elt->delta */ } while(PartialNChars > 254) { nbytes = 254; if (FirstTimeThrough) { FirstTimeThrough = False; if (!item->delta) { nbytes += SIZEOF(xTextElt); BufAlloc (char *, tbuf, nbytes); *(tbuf+1) = 0; /* elt->delta */ } else { char *DummyChar; BufAlloc(char *, DummyChar, nbytes); } } else { nbytes += SIZEOF(xTextElt); BufAlloc (char *, tbuf, nbytes); *(tbuf+1) = 0; /* elt->delta */ } /* watch out for signs on chars */ *(unsigned char *)tbuf = 254; /* elt->len */ memcpy (tbuf+2 , CharacterOffset, 254); PartialNChars = PartialNChars - 254; CharacterOffset += 254; } if (PartialNChars) { nbytes = PartialNChars; if (FirstTimeThrough) { FirstTimeThrough = False; if (!item->delta) { nbytes += SIZEOF(xTextElt); BufAlloc (char *, tbuf, nbytes); *(tbuf+1) = 0; /* elt->delta */ } else { char *DummyChar; BufAlloc(char *, DummyChar, nbytes); } } else { nbytes += SIZEOF(xTextElt); BufAlloc (char *, tbuf, nbytes); *(tbuf+1) = 0; /* elt->delta */ } *tbuf = PartialNChars; /* elt->len */ memcpy (tbuf+2 , CharacterOffset, PartialNChars); } } item++; } /* Pad request out to a 32-bit boundary */ if (length &= 3) { char *pad; /* * BufAlloc is a macro that uses its last argument more than * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" */ length = 4 - length; BufAlloc (char *, pad, length); /* * if there are 3 bytes of padding, the first byte MUST be 0 * so the pad bytes aren't mistaken for a final xTextElt */ *pad = 0; } /* * If the buffer pointer is not now pointing to a 32-bit boundary, * we must flush the buffer so that it does point to a 32-bit boundary * at the end of this routine. */ if ((dpy->bufptr - dpy->buffer) & 3) _XFlush (dpy); UnlockDisplay(dpy); SyncHandle(); return 0; } nx-libs-3.5.99.23/nx-X11/lib/src/PropAlloc.c0000644000000000000000000000341213614532331014677 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xutil.h" #include /* * Routines for allocating space for structures that are expected to get * longer at some point. */ XSizeHints *XAllocSizeHints (void) { return Xcalloc (1, sizeof (XSizeHints)); } XStandardColormap *XAllocStandardColormap (void) { return Xcalloc (1, sizeof (XStandardColormap)); } XWMHints *XAllocWMHints (void) { return Xcalloc (1, sizeof (XWMHints)); } XClassHint *XAllocClassHint (void) { return Xcalloc (1, sizeof (XClassHint)); } XIconSize *XAllocIconSize (void) { return Xcalloc (1, sizeof (XIconSize)); } nx-libs-3.5.99.23/nx-X11/lib/src/PutBEvent.c0000644000000000000000000000446013614532331014664 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* XPutBackEvent puts an event back at the head of the queue. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int _XPutBackEvent ( register Display *dpy, register XEvent *event) { register _XQEvent *qelt; XEvent store = *event; if (!dpy->qfree) { if ((dpy->qfree = Xmalloc (sizeof (_XQEvent))) == NULL) { return 0; } dpy->qfree->next = NULL; } /* unclaimed cookie? */ if (_XIsEventCookie(dpy, event)) { XEvent copy = {0}; /* if not claimed, then just fetch and store again */ if (!event->xcookie.data) { _XFetchEventCookie(dpy, &event->xcookie); store = *event; } else { /* if claimed, copy, client must free */ _XCopyEventCookie(dpy, &event->xcookie, ©.xcookie); store = copy; } } qelt = dpy->qfree; dpy->qfree = qelt->next; qelt->qserial_num = dpy->next_event_serial_num++; qelt->next = dpy->head; qelt->event = store; dpy->head = qelt; if (dpy->tail == NULL) dpy->tail = qelt; dpy->qlen++; return 0; } int XPutBackEvent ( register Display * dpy, register XEvent *event) { int ret; LockDisplay(dpy); ret = _XPutBackEvent(dpy, event); UnlockDisplay(dpy); return ret; } nx-libs-3.5.99.23/nx-X11/lib/src/PutImage.c0000644000000000000000000007446313614532331014535 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xutil.h" #include #include "Cr.h" #include "ImUtil.h" #if defined(__STDC__) && ((defined(sun) && defined(SVR4)) || defined(WIN32)) #define RConst /**/ #else #define RConst const #endif /* assumes pad is a power of 2 */ #define ROUNDUP(nbytes, pad) (((nbytes) + ((pad) - 1)) & ~(long)((pad) - 1)) static unsigned char const _reverse_byte[0x100] = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff }; static unsigned char const _reverse_nibs[0x100] = { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, 0x81, 0x91, 0xa1, 0xb1, 0xc1, 0xd1, 0xe1, 0xf1, 0x02, 0x12, 0x22, 0x32, 0x42, 0x52, 0x62, 0x72, 0x82, 0x92, 0xa2, 0xb2, 0xc2, 0xd2, 0xe2, 0xf2, 0x03, 0x13, 0x23, 0x33, 0x43, 0x53, 0x63, 0x73, 0x83, 0x93, 0xa3, 0xb3, 0xc3, 0xd3, 0xe3, 0xf3, 0x04, 0x14, 0x24, 0x34, 0x44, 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb4, 0xc4, 0xd4, 0xe4, 0xf4, 0x05, 0x15, 0x25, 0x35, 0x45, 0x55, 0x65, 0x75, 0x85, 0x95, 0xa5, 0xb5, 0xc5, 0xd5, 0xe5, 0xf5, 0x06, 0x16, 0x26, 0x36, 0x46, 0x56, 0x66, 0x76, 0x86, 0x96, 0xa6, 0xb6, 0xc6, 0xd6, 0xe6, 0xf6, 0x07, 0x17, 0x27, 0x37, 0x47, 0x57, 0x67, 0x77, 0x87, 0x97, 0xa7, 0xb7, 0xc7, 0xd7, 0xe7, 0xf7, 0x08, 0x18, 0x28, 0x38, 0x48, 0x58, 0x68, 0x78, 0x88, 0x98, 0xa8, 0xb8, 0xc8, 0xd8, 0xe8, 0xf8, 0x09, 0x19, 0x29, 0x39, 0x49, 0x59, 0x69, 0x79, 0x89, 0x99, 0xa9, 0xb9, 0xc9, 0xd9, 0xe9, 0xf9, 0x0a, 0x1a, 0x2a, 0x3a, 0x4a, 0x5a, 0x6a, 0x7a, 0x8a, 0x9a, 0xaa, 0xba, 0xca, 0xda, 0xea, 0xfa, 0x0b, 0x1b, 0x2b, 0x3b, 0x4b, 0x5b, 0x6b, 0x7b, 0x8b, 0x9b, 0xab, 0xbb, 0xcb, 0xdb, 0xeb, 0xfb, 0x0c, 0x1c, 0x2c, 0x3c, 0x4c, 0x5c, 0x6c, 0x7c, 0x8c, 0x9c, 0xac, 0xbc, 0xcc, 0xdc, 0xec, 0xfc, 0x0d, 0x1d, 0x2d, 0x3d, 0x4d, 0x5d, 0x6d, 0x7d, 0x8d, 0x9d, 0xad, 0xbd, 0xcd, 0xdd, 0xed, 0xfd, 0x0e, 0x1e, 0x2e, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, 0x8e, 0x9e, 0xae, 0xbe, 0xce, 0xde, 0xee, 0xfe, 0x0f, 0x1f, 0x2f, 0x3f, 0x4f, 0x5f, 0x6f, 0x7f, 0x8f, 0x9f, 0xaf, 0xbf, 0xcf, 0xdf, 0xef, 0xff }; int _XReverse_Bytes( register unsigned char *bpt, register int nb) { do { *bpt = _reverse_byte[*bpt]; bpt++; } while (--nb > 0); return 0; } /* XXX the following functions are declared int instead of void because various * compilers and lints complain about later initialization of SwapFunc and/or * (swapfunc == NoSwap) when void is used. */ /*ARGSUSED*/ static void NoSwap ( register unsigned char *src, register unsigned char *dest, long srclen, long srcinc, long destinc, unsigned int height, int half_order) { long h = height; if (srcinc == destinc) memcpy((char *)dest, (char *)src, (int)(srcinc * (h - 1) + srclen)); else for (; --h >= 0; src += srcinc, dest += destinc) memcpy((char *)dest, (char *)src, (int)srclen); } static void SwapTwoBytes ( register unsigned char *src, register unsigned char *dest, long srclen, long srcinc, long destinc, unsigned int height, int half_order) { long length = ROUNDUP(srclen, 2); register long h, n; srcinc -= length; destinc -= length; for (h = height; --h >= 0; src += srcinc, dest += destinc) { if ((h == 0) && (srclen != length)) { length -= 2; if (half_order == MSBFirst) *(dest + length) = *(src + length + 1); else *(dest + length + 1) = *(src + length); } for (n = length; n > 0; n -= 2, src += 2) { *dest++ = *(src + 1); *dest++ = *src; } } } static void SwapThreeBytes ( register unsigned char *src, register unsigned char *dest, long srclen, long srcinc, long destinc, unsigned int height, int byte_order) { long length = ((srclen + 2) / 3) * 3; register long h, n; srcinc -= length; destinc -= length; for (h = height; --h >= 0; src += srcinc, dest += destinc) { if ((h == 0) && (srclen != length)) { length -= 3; if ((srclen - length) == 2) *(dest + length + 1) = *(src + length + 1); if (byte_order == MSBFirst) *(dest + length) = *(src + length + 2); else *(dest + length + 2) = *(src + length); } for (n = length; n > 0; n -= 3, src += 3) { *dest++ = *(src + 2); *dest++ = *(src + 1); *dest++ = *src; } } } static void SwapFourBytes ( register unsigned char *src, register unsigned char *dest, long srclen, long srcinc, long destinc, unsigned int height, int half_order) { long length = ROUNDUP(srclen, 4); register long h, n; srcinc -= length; destinc -= length; for (h = height; --h >= 0; src += srcinc, dest += destinc) { if ((h == 0) && (srclen != length)) { length -= 4; if (half_order == MSBFirst) *(dest + length) = *(src + length + 3); if (((half_order == LSBFirst) && ((srclen - length) == 3)) || ((half_order == MSBFirst) && (srclen & 2))) *(dest + length + 1) = *(src + length + 2); if (((half_order == MSBFirst) && ((srclen - length) == 3)) || ((half_order == LSBFirst) && (srclen & 2))) *(dest + length + 2) = *(src + length + 1); if (half_order == LSBFirst) *(dest + length + 3) = *(src + length); } for (n = length; n > 0; n -= 4, src += 4) { *dest++ = *(src + 3); *dest++ = *(src + 2); *dest++ = *(src + 1); *dest++ = *src; } } } static void SwapWords ( register unsigned char *src, register unsigned char *dest, long srclen, long srcinc, long destinc, unsigned int height, int half_order) { long length = ROUNDUP(srclen, 4); register long h, n; srcinc -= length; destinc -= length; for (h = height; --h >= 0; src += srcinc, dest += destinc) { if ((h == 0) && (srclen != length)) { length -= 4; if (half_order == MSBFirst) *(dest + length + 1) = *(src + length + 3); if (((half_order == LSBFirst) && ((srclen - length) == 3)) || ((half_order == MSBFirst) && (srclen & 2))) *(dest + length) = *(src + length + 2); if (((half_order == MSBFirst) && ((srclen - length) == 3)) || ((half_order == LSBFirst) && (srclen & 2))) *(dest + length + 3) = *(src + length + 1); if (half_order == LSBFirst) *(dest + length + 2) = *(src + length); } for (n = length; n > 0; n -= 4, src += 2) { *dest++ = *(src + 2); *dest++ = *(src + 3); *dest++ = *src++; *dest++ = *src++; } } } static void SwapNibbles( register unsigned char *src, register unsigned char *dest, long srclen, long srcinc, long destinc, unsigned int height) { register long h, n; register const unsigned char *rev = _reverse_nibs; srcinc -= srclen; destinc -= srclen; for (h = height; --h >= 0; src += srcinc, dest += destinc) for (n = srclen; --n >= 0; ) *dest++ = rev[*src++]; } static void ShiftNibblesLeft ( register unsigned char *src, register unsigned char *dest, long srclen, long srcinc, long destinc, unsigned int height, int nibble_order) { register long h, n; register unsigned char c1, c2; srcinc -= srclen; destinc -= srclen; if (nibble_order == MSBFirst) { for (h = height; --h >= 0; src += srcinc, dest += destinc) for (n = srclen; --n >= 0; ) { c1 = *src++; c2 = *src; *dest++ = ((c1 & 0x0f) << 4) | ((c2 & (unsigned)0xf0) >> 4); } } else { for (h = height; --h >= 0; src += srcinc, dest += destinc) for (n = srclen; --n >= 0; ) { c1 = *src++; c2 = *src; *dest++ = ((c2 & 0x0f) << 4) | ((c1 & (unsigned)0xf0) >> 4); } } } /*ARGSUSED*/ static void SwapBits( register unsigned char *src, register unsigned char *dest, long srclen, long srcinc, long destinc, unsigned int height, int half_order) { register long h, n; register const unsigned char *rev = _reverse_byte; srcinc -= srclen; destinc -= srclen; for (h = height; --h >= 0; src += srcinc, dest += destinc) for (n = srclen; --n >= 0; ) *dest++ = rev[*src++]; } static void SwapBitsAndTwoBytes( register unsigned char *src, register unsigned char *dest, long srclen, long srcinc, long destinc, unsigned int height, int half_order) { long length = ROUNDUP(srclen, 2); register long h, n; register const unsigned char *rev = _reverse_byte; srcinc -= length; destinc -= length; for (h = height; --h >= 0; src += srcinc, dest += destinc) { if ((h == 0) && (srclen != length)) { length -= 2; if (half_order == MSBFirst) *(dest + length) = rev[*(src + length + 1)]; else *(dest + length + 1) = rev[*(src + length)]; } for (n = length; n > 0; n -= 2, src += 2) { *dest++ = rev[*(src + 1)]; *dest++ = rev[*src]; } } } static void SwapBitsAndFourBytes( register unsigned char *src, register unsigned char *dest, long srclen, long srcinc, long destinc, unsigned int height, int half_order) { long length = ROUNDUP(srclen, 4); register long h, n; register const unsigned char *rev = _reverse_byte; srcinc -= length; destinc -= length; for (h = height; --h >= 0; src += srcinc, dest += destinc) { if ((h == 0) && (srclen != length)) { length -= 4; if (half_order == MSBFirst) *(dest + length) = rev[*(src + length + 3)]; if (((half_order == LSBFirst) && ((srclen - length) == 3)) || ((half_order == MSBFirst) && (srclen & 2))) *(dest + length + 1) = rev[*(src + length + 2)]; if (((half_order == MSBFirst) && ((srclen - length) == 3)) || ((half_order == LSBFirst) && (srclen & 2))) *(dest + length + 2) = rev[*(src + length + 1)]; if (half_order == LSBFirst) *(dest + length + 3) = rev[*(src + length)]; } for (n = length; n > 0; n -= 4, src += 4) { *dest++ = rev[*(src + 3)]; *dest++ = rev[*(src + 2)]; *dest++ = rev[*(src + 1)]; *dest++ = rev[*src]; } } } static void SwapBitsAndWords( register unsigned char *src, register unsigned char *dest, long srclen, long srcinc, long destinc, unsigned int height, int half_order) { long length = ROUNDUP(srclen, 4); register long h, n; register const unsigned char *rev = _reverse_byte; srcinc -= length; destinc -= length; for (h = height; --h >= 0; src += srcinc, dest += destinc) { if ((h == 0) && (srclen != length)) { length -= 4; if (half_order == MSBFirst) *(dest + length + 1) = rev[*(src + length + 3)]; if (((half_order == LSBFirst) && ((srclen - length) == 3)) || ((half_order == MSBFirst) && (srclen & 2))) *(dest + length) = rev[*(src + length + 2)]; if (((half_order == MSBFirst) && ((srclen - length) == 3)) || ((half_order == LSBFirst) && (srclen & 2))) *(dest + length + 3) = rev[*(src + length + 1)]; if (half_order == LSBFirst) *(dest + length + 2) = rev[*(src + length)]; } for (n = length; n > 0; n -= 4, src += 2) { *dest++ = rev[*(src + 2)]; *dest++ = rev[*(src + 3)]; *dest++ = rev[*src++]; *dest++ = rev[*src++]; } } } /* The following table gives the bit ordering within bytes (when accessed sequentially) for a scanline containing 32 bits, with bits numbered 0 to 31, where bit 0 should be leftmost on the display. For a given byte labelled A-B, A is for the most significant bit of the byte, and B is for the least significant bit. legend: 1 scanline-unit = 8 2 scanline-unit = 16 4 scanline-unit = 32 M byte-order = MostSignificant L byte-order = LeastSignificant m bit-order = MostSignificant l bit-order = LeastSignificant format ordering 1Mm 00-07 08-15 16-23 24-31 2Mm 00-07 08-15 16-23 24-31 4Mm 00-07 08-15 16-23 24-31 1Ml 07-00 15-08 23-16 31-24 2Ml 15-08 07-00 31-24 23-16 4Ml 31-24 23-16 15-08 07-00 1Lm 00-07 08-15 16-23 24-31 2Lm 08-15 00-07 24-31 16-23 4Lm 24-31 16-23 08-15 00-07 1Ll 07-00 15-08 23-16 31-24 2Ll 07-00 15-08 23-16 31-24 4Ll 07-00 15-08 23-16 31-24 The following table gives the required conversion between any two formats. It is based strictly on the table above. If you believe one, you should believe the other. legend: n no changes s reverse 8-bit units within 16-bit units l reverse 8-bit units within 32-bit units w reverse 16-bit units within 32-bit units R reverse bits within 8-bit units S s+R L l+R W w+R */ static void (* RConst (SwapFunction[12][12]))( register unsigned char *src, register unsigned char *dest, long srclen, long srcinc, long destinc, unsigned int height, int half_order) = { #define n NoSwap, #define s SwapTwoBytes, #define l SwapFourBytes, #define w SwapWords, #define R SwapBits, #define S SwapBitsAndTwoBytes, #define L SwapBitsAndFourBytes, #define W SwapBitsAndWords, /* 1Mm 2Mm 4Mm 1Ml 2Ml 4Ml 1Lm 2Lm 4Lm 1Ll 2Ll 4Ll */ /* 1Mm */ { n n n R S L n s l R R R }, /* 2Mm */ { n n n R S L n s l R R R }, /* 4Mm */ { n n n R S L n s l R R R }, /* 1Ml */ { R R R n s l R S L n n n }, /* 2Ml */ { S S S s n w S R W s s s }, /* 4Ml */ { L L L l w n L W R l l l }, /* 1Lm */ { n n n R S L n s l R R R }, /* 2Lm */ { s s s S R W s n w S S S }, /* 4Lm */ { l l l L W R l w n L L L }, /* 1Ll */ { R R R n s l R S L n n n }, /* 2Ll */ { R R R n s l R S L n n n }, /* 4Ll */ { R R R n s l R S L n n n } #undef n #undef s #undef l #undef w #undef R #undef S #undef L #undef W }; /* Of course, the table above is a lie. We also need to factor in the * order of the source data to cope with swapping half of a unit at the * end of a scanline, since we are trying to avoid de-ref'ing off the * end of the source. * * Defines whether the first half of a unit has the first half of the data */ static int const HalfOrder[12] = { LSBFirst, /* 1Mm */ LSBFirst, /* 2Mm */ LSBFirst, /* 4Mm */ LSBFirst, /* 1Ml */ MSBFirst, /* 2Ml */ MSBFirst, /* 4Ml */ LSBFirst, /* 1Lm */ MSBFirst, /* 2Lm */ MSBFirst, /* 4Lm */ LSBFirst, /* 1Ll */ LSBFirst, /* 2Ll */ LSBFirst /* 4Ll */ }; /* Finally, for SwapWords cases, the half order depends not just on the source * but also on the destination scanline unit. Use of this table changes some * MSBFirsts to LSBFirsts that are "do not care" (because the function will be * NoSwap or SwapBits) in addition to changing the desired ones. */ static int const HalfOrderWord[12] = { MSBFirst, /* 1Mm */ MSBFirst, /* 2Mm */ MSBFirst, /* 4Mm */ MSBFirst, /* 1Ml */ MSBFirst, /* 2Ml */ LSBFirst, /* 4Ml */ MSBFirst, /* 1Lm */ MSBFirst, /* 2Lm */ LSBFirst, /* 4Lm */ MSBFirst, /* 1Ll */ MSBFirst, /* 2Ll */ MSBFirst /* 4Ll */ }; /* * This macro creates a value from 0 to 11 suitable for indexing * into the table above. */ #define ComposeIndex(bitmap_unit, bitmap_bit_order, byte_order) \ (((bitmap_unit == 32) ? 2 : ((bitmap_unit == 16) ? 1 : 0)) \ + (((bitmap_bit_order == MSBFirst) ? 0 : 3) \ + ((byte_order == MSBFirst) ? 0 : 6))) /* Cancel a GetReq operation, before doing _XSend or Data */ #define UnGetReq(name)\ dpy->bufptr -= SIZEOF(x##name##Req);\ dpy->request-- static void SendXYImage( register Display *dpy, register xPutImageReq *req, register XImage *image, int req_xoffset, int req_yoffset) { register int j; long total_xoffset, bytes_per_src, bytes_per_dest, length; long bytes_per_line, bytes_per_src_plane, bytes_per_dest_plane; char *src, *dest, *buf; char *extra = (char *)NULL; register void (*swapfunc)( register unsigned char *src, register unsigned char *dest, long srclen, long srcinc, long destinc, unsigned int height, int half_order); int half_order; total_xoffset = image->xoffset + req_xoffset; req->leftPad = total_xoffset & (dpy->bitmap_unit - 1); total_xoffset = (unsigned)(total_xoffset - req->leftPad) >> 3; /* The protocol requires left-pad of zero on all ZPixmap, even * though the 1-bit case is identical to bitmap format. This is a * bug in the protocol, caused because 1-bit ZPixmap was added late * in the game. Hairy shifting code compensation isn't worth it, * just use XYPixmap format instead. */ if ((req->leftPad != 0) && (req->format == ZPixmap)) req->format = XYPixmap; bytes_per_dest = (unsigned long)ROUNDUP((long)req->width + req->leftPad, dpy->bitmap_pad) >> 3; bytes_per_dest_plane = bytes_per_dest * req->height; length = bytes_per_dest_plane * image->depth; req->length += (length + 3) >> 2; swapfunc = SwapFunction[ComposeIndex(image->bitmap_unit, image->bitmap_bit_order, image->byte_order)] [ComposeIndex(dpy->bitmap_unit, dpy->bitmap_bit_order, dpy->byte_order)]; half_order = HalfOrder[ComposeIndex(image->bitmap_unit, image->bitmap_bit_order, image->byte_order)]; if (half_order == MSBFirst) half_order = HalfOrderWord[ComposeIndex(dpy->bitmap_unit, dpy->bitmap_bit_order, dpy->byte_order)]; src = image->data + (image->bytes_per_line * req_yoffset) + total_xoffset; /* when total_xoffset > 0, we have to worry about stepping off the * end of image->data. */ if ((swapfunc == NoSwap) && (image->bytes_per_line == bytes_per_dest) && (((total_xoffset == 0) && ((image->depth == 1) || (image->height == req->height))) || ((image->depth == 1) && ((req_yoffset + req->height) < (unsigned)image->height)))) { Data(dpy, src, length); return; } length = ROUNDUP(length, 4); if ((dpy->bufptr + length) > dpy->bufmax) { if ((buf = _XAllocScratch(dpy, length)) == NULL) { UnGetReq(PutImage); return; } } else buf = dpy->bufptr; bytes_per_src = (req->width + req->leftPad + (unsigned)7) >> 3; bytes_per_line = image->bytes_per_line; bytes_per_src_plane = bytes_per_line * image->height; total_xoffset &= (image->bitmap_unit - 1) >> 3; if ((total_xoffset > 0) && (image->byte_order != image->bitmap_bit_order)) { char *temp; long bytes_per_temp_plane, temp_length; bytes_per_line = bytes_per_src + total_xoffset; src -= total_xoffset; bytes_per_temp_plane = bytes_per_line * req->height; temp_length = ROUNDUP(bytes_per_temp_plane * image->depth, 4); if (buf == dpy->bufptr) { if (! (temp = _XAllocScratch(dpy, temp_length))) { UnGetReq(PutImage); return; } } else if ((extra = temp = Xmalloc(temp_length)) == NULL) { UnGetReq(PutImage); return; } swapfunc = SwapFunction[ComposeIndex(image->bitmap_unit, image->bitmap_bit_order, image->byte_order)] [ComposeIndex(image->bitmap_unit, dpy->byte_order, dpy->byte_order)]; for (dest = temp, j = image->depth; --j >= 0; src += bytes_per_src_plane, dest += bytes_per_temp_plane) (*swapfunc)((unsigned char *)src, (unsigned char *)dest, bytes_per_line, (long)image->bytes_per_line, bytes_per_line, req->height, half_order); swapfunc = SwapFunction[ComposeIndex(image->bitmap_unit, dpy->byte_order, dpy->byte_order)] [ComposeIndex(dpy->bitmap_unit, dpy->bitmap_bit_order, dpy->byte_order)]; half_order = HalfOrder[ComposeIndex(image->bitmap_unit, dpy->byte_order, dpy->byte_order)]; src = temp + total_xoffset; bytes_per_src_plane = bytes_per_temp_plane; } for (dest = buf, j = image->depth; --j >= 0; src += bytes_per_src_plane, dest += bytes_per_dest_plane) (*swapfunc)((unsigned char *)src, (unsigned char *)dest, bytes_per_src, bytes_per_line, bytes_per_dest, req->height, half_order); Xfree(extra); if (buf == dpy->bufptr) dpy->bufptr += length; else _XSend(dpy, buf, length); } static void SendZImage( register Display *dpy, register xPutImageReq *req, register XImage *image, int req_xoffset, int req_yoffset, int dest_bits_per_pixel, int dest_scanline_pad) { long bytes_per_src, bytes_per_dest, length; unsigned char *src, *dest; unsigned char *shifted_src = NULL; req->leftPad = 0; bytes_per_src = ROUNDUP((long)req->width * image->bits_per_pixel, 8) >> 3; bytes_per_dest = ROUNDUP((long)req->width * dest_bits_per_pixel, dest_scanline_pad) >> 3; length = bytes_per_dest * req->height; req->length += (length + 3) >> 2; src = (unsigned char *)image->data + (req_yoffset * image->bytes_per_line) + ((req_xoffset * image->bits_per_pixel) >> 3); if ((image->bits_per_pixel == 4) && ((unsigned int) req_xoffset & 0x01)) { if (! (shifted_src = Xmalloc(req->height * image->bytes_per_line))) { UnGetReq(PutImage); return; } ShiftNibblesLeft(src, shifted_src, bytes_per_src, (long) image->bytes_per_line, (long) image->bytes_per_line, req->height, image->byte_order); src = shifted_src; } /* when req_xoffset > 0, we have to worry about stepping off the * end of image->data. */ if (((image->byte_order == dpy->byte_order) || (image->bits_per_pixel == 8)) && ((long)image->bytes_per_line == bytes_per_dest) && ((req_xoffset == 0) || ((req_yoffset + req->height) < (unsigned)image->height))) { Data(dpy, (char *)src, length); Xfree(shifted_src); return; } length = ROUNDUP(length, 4); if ((dpy->bufptr + length) <= dpy->bufmax) dest = (unsigned char *)dpy->bufptr; else if ((dest = (unsigned char *) _XAllocScratch(dpy, length)) == NULL) { Xfree(shifted_src); UnGetReq(PutImage); return; } if ((image->byte_order == dpy->byte_order) || (image->bits_per_pixel == 8)) NoSwap(src, dest, bytes_per_src, (long)image->bytes_per_line, bytes_per_dest, req->height, image->byte_order); else if (image->bits_per_pixel == 32) SwapFourBytes(src, dest, bytes_per_src, (long)image->bytes_per_line, bytes_per_dest, req->height, image->byte_order); else if (image->bits_per_pixel == 24) SwapThreeBytes(src, dest, bytes_per_src, (long)image->bytes_per_line, bytes_per_dest, req->height, image->byte_order); else if (image->bits_per_pixel == 16) SwapTwoBytes(src, dest, bytes_per_src, (long)image->bytes_per_line, bytes_per_dest, req->height, image->byte_order); else SwapNibbles(src, dest, bytes_per_src, (long)image->bytes_per_line, bytes_per_dest, req->height); if (dest == (unsigned char *)dpy->bufptr) dpy->bufptr += length; else _XSend(dpy, (char *)dest, length); Xfree(shifted_src); } static void PutImageRequest( register Display *dpy, Drawable d, GC gc, register XImage *image, int req_xoffset, int req_yoffset, int x, int y, unsigned int req_width, unsigned int req_height, int dest_bits_per_pixel, int dest_scanline_pad) { register xPutImageReq *req; GetReq(PutImage, req); req->drawable = d; req->gc = gc->gid; req->dstX = x; req->dstY = y; req->width = req_width; req->height = req_height; req->depth = image->depth; req->format = image->format; if ((image->bits_per_pixel == 1) || (image->format != ZPixmap)) SendXYImage(dpy, req, image, req_xoffset, req_yoffset); else SendZImage(dpy, req, image, req_xoffset, req_yoffset, dest_bits_per_pixel, dest_scanline_pad); } static void PutSubImage ( register Display *dpy, Drawable d, GC gc, register XImage *image, int req_xoffset, int req_yoffset, int x, int y, unsigned int req_width, unsigned int req_height, int dest_bits_per_pixel, int dest_scanline_pad) { int left_pad, BytesPerRow, Available; if ((req_width == 0) || (req_height == 0)) return; Available = ((65536 < dpy->max_request_size) ? (65536 << 2) : (dpy->max_request_size << 2)) - SIZEOF(xPutImageReq); if ((image->bits_per_pixel == 1) || (image->format != ZPixmap)) { left_pad = (image->xoffset + req_xoffset) & (dpy->bitmap_unit - 1); BytesPerRow = (ROUNDUP((long)req_width + left_pad, dpy->bitmap_pad) >> 3) * image->depth; } else { left_pad = 0; BytesPerRow = ROUNDUP((long)req_width * dest_bits_per_pixel, dest_scanline_pad) >> 3; } if ((BytesPerRow * req_height) <= Available) { PutImageRequest(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, req_width, req_height, dest_bits_per_pixel, dest_scanline_pad); } else if (req_height > 1) { int SubImageHeight = Available / BytesPerRow; if (SubImageHeight == 0) SubImageHeight = 1; PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, req_width, (unsigned int) SubImageHeight, dest_bits_per_pixel, dest_scanline_pad); PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset + SubImageHeight, x, y + SubImageHeight, req_width, req_height - SubImageHeight, dest_bits_per_pixel, dest_scanline_pad); } else { int SubImageWidth = (((Available << 3) / dest_scanline_pad) * dest_scanline_pad) - left_pad; PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, (unsigned int) SubImageWidth, 1, dest_bits_per_pixel, dest_scanline_pad); PutSubImage(dpy, d, gc, image, req_xoffset + SubImageWidth, req_yoffset, x + SubImageWidth, y, req_width - SubImageWidth, 1, dest_bits_per_pixel, dest_scanline_pad); } } int XPutImage ( register Display *dpy, Drawable d, GC gc, register XImage *image, int req_xoffset, int req_yoffset, int x, int y, unsigned int req_width, unsigned int req_height) { long width = req_width; long height = req_height; int dest_bits_per_pixel, dest_scanline_pad; if (req_xoffset < 0) { width += req_xoffset; req_xoffset = 0; } if (req_yoffset < 0) { height += req_yoffset; req_yoffset = 0; } if ((req_xoffset + width) > image->width) width = image->width - req_xoffset; if ((req_yoffset + height) > image->height) height = image->height - req_yoffset; if ((width <= 0) || (height <= 0)) return 0; if ((image->bits_per_pixel == 1) || (image->format != ZPixmap)) { dest_bits_per_pixel = 1; dest_scanline_pad = dpy->bitmap_pad; } else { register int n; register ScreenFormat *format; dest_bits_per_pixel = image->bits_per_pixel; dest_scanline_pad = image->bitmap_pad; for (n = dpy->nformats, format = dpy->pixmap_format; --n >= 0; format++) if (format->depth == image->depth) { dest_bits_per_pixel = format->bits_per_pixel; dest_scanline_pad = format->scanline_pad; } if (dest_bits_per_pixel != image->bits_per_pixel) { XImage img; register long i, j; /* XXX slow, but works */ img.width = width; img.height = height; img.xoffset = 0; img.format = ZPixmap; img.byte_order = dpy->byte_order; img.bitmap_unit = dpy->bitmap_unit; img.bitmap_bit_order = dpy->bitmap_bit_order; img.bitmap_pad = dest_scanline_pad; img.depth = image->depth; img.bits_per_pixel = dest_bits_per_pixel; img.bytes_per_line = ROUNDUP((dest_bits_per_pixel * width), dest_scanline_pad) >> 3; img.data = Xmalloc(img.bytes_per_line * height); if (img.data == NULL) return 0; _XInitImageFuncPtrs(&img); for (j = height; --j >= 0; ) for (i = width; --i >= 0; ) XPutPixel(&img, i, j, XGetPixel(image, req_xoffset + i, req_yoffset + j)); LockDisplay(dpy); FlushGC(dpy, gc); PutSubImage(dpy, d, gc, &img, 0, 0, x, y, (unsigned int) width, (unsigned int) height, dest_bits_per_pixel, dest_scanline_pad); UnlockDisplay(dpy); SyncHandle(); Xfree(img.data); return 0; } } LockDisplay(dpy); FlushGC(dpy, gc); PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, (unsigned int) width, (unsigned int) height, dest_bits_per_pixel, dest_scanline_pad); UnlockDisplay(dpy); SyncHandle(); #ifdef USE_DYNAMIC_XCURSOR if (image->bits_per_pixel == 1 && x == 0 && y == 0 && width == image->width && height == image->height && gc->values.function == GXcopy && (gc->values.plane_mask & 1)) { _XNoticePutBitmap (dpy, d, image); } #endif return 0; } nx-libs-3.5.99.23/nx-X11/lib/src/Quarks.c0000644000000000000000000002471013614532331014256 0ustar /*********************************************************** Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* Copyright 1987, 1988, 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include "Xresinternal.h" /* Not cost effective, at least for vanilla MIT clients */ /* #define PERMQ */ #ifdef PERMQ typedef unsigned char Bits; #endif typedef unsigned long Entry; /* dont confuse with EntryRec from Xintatom.h */ static XrmQuark nextQuark = 1; /* next available quark number */ static unsigned long quarkMask = 0; static Entry zero = 0; static Entry *quarkTable = &zero; /* crock */ static unsigned long quarkRehash; static XrmString **stringTable = NULL; #ifdef PERMQ static Bits **permTable = NULL; #endif static XrmQuark nextUniq = -1; /* next quark from XrmUniqueQuark */ #define QUANTUMSHIFT 8 #define QUANTUMMASK ((1 << QUANTUMSHIFT) - 1) #define CHUNKPER 8 #define CHUNKMASK ((CHUNKPER << QUANTUMSHIFT) - 1) #define LARGEQUARK ((Entry)0x80000000L) #define QUARKSHIFT 18 #define QUARKMASK ((LARGEQUARK - 1) >> QUARKSHIFT) #define XSIGMASK ((1L << QUARKSHIFT) - 1) #define STRQUANTSIZE (sizeof(XrmString) * (QUANTUMMASK + 1)) #ifdef PERMQ #define QUANTSIZE (STRQUANTSIZE + \ (sizeof(Bits) * ((QUANTUMMASK + 1) >> 3))) #else #define QUANTSIZE STRQUANTSIZE #endif #define HASH(sig) ((sig) & quarkMask) #define REHASHVAL(sig) ((((sig) % quarkRehash) + 2) | 1) #define REHASH(idx,rehash) ((idx + rehash) & quarkMask) #define NAME(q) stringTable[(q) >> QUANTUMSHIFT][(q) & QUANTUMMASK] #ifdef PERMQ #define BYTEREF(q) permTable[(q) >> QUANTUMSHIFT][((q) & QUANTUMMASK) >> 3] #define ISPERM(q) (BYTEREF(q) & (1 << ((q) & 7))) #define SETPERM(q) BYTEREF(q) |= (1 << ((q) & 7)) #define CLEARPERM(q) BYTEREF(q) &= ~(1 << ((q) & 7)) #endif /* Permanent memory allocation */ #define WALIGN sizeof(unsigned long) #define DALIGN sizeof(double) #define NEVERFREETABLESIZE ((8192-12) & ~(DALIGN-1)) static char *neverFreeTable = NULL; static int neverFreeTableSize = 0; static char *permalloc(unsigned int length) { char *ret; if (neverFreeTableSize < length) { if (length >= NEVERFREETABLESIZE) return Xmalloc(length); if (! (ret = Xmalloc(NEVERFREETABLESIZE))) return (char *) NULL; neverFreeTableSize = NEVERFREETABLESIZE; neverFreeTable = ret; } ret = neverFreeTable; neverFreeTable += length; neverFreeTableSize -= length; return(ret); } typedef struct {char a; double b;} TestType1; typedef struct {char a; unsigned long b;} TestType2; #ifdef XTHREADS static char *_Xpermalloc(unsigned int length); char *Xpermalloc(unsigned int length) { char *p; _XLockMutex(_Xglobal_lock); p = _Xpermalloc(length); _XUnlockMutex(_Xglobal_lock); return p; } #define Xpermalloc _Xpermalloc static #endif /* XTHREADS */ char *Xpermalloc(unsigned int length) { int i; if (neverFreeTableSize && length < NEVERFREETABLESIZE) { if ((sizeof(TestType1) != (sizeof(TestType2) - sizeof(unsigned long) + sizeof(double))) && !(length & (DALIGN-1)) && ((i = (NEVERFREETABLESIZE - neverFreeTableSize) & (DALIGN-1)))) { neverFreeTableSize -= DALIGN - i; neverFreeTable += DALIGN - i; } else if ((i = (NEVERFREETABLESIZE - neverFreeTableSize) & (WALIGN-1))) { neverFreeTableSize -= WALIGN - i; neverFreeTable += WALIGN - i; } } return permalloc(length); } static Bool ExpandQuarkTable(void) { unsigned long oldmask, newmask; register char c, *s; register Entry *oldentries, *entries; register Entry entry; register int oldidx, newidx, rehash; Signature sig; XrmQuark q; oldentries = quarkTable; if ((oldmask = quarkMask)) newmask = (oldmask << 1) + 1; else { if (!stringTable) { stringTable = Xmalloc(sizeof(XrmString *) * CHUNKPER); if (!stringTable) return False; stringTable[0] = (XrmString *)NULL; } #ifdef PERMQ if (!permTable) permTable = Xmalloc(sizeof(Bits *) * CHUNKPER); if (!permTable) return False; #endif stringTable[0] = (XrmString *)Xpermalloc(QUANTSIZE); if (!stringTable[0]) return False; #ifdef PERMQ permTable[0] = (Bits *)((char *)stringTable[0] + STRQUANTSIZE); #endif newmask = 0x1ff; } entries = Xcalloc(newmask + 1, sizeof(Entry)); if (!entries) return False; quarkTable = entries; quarkMask = newmask; quarkRehash = quarkMask - 2; for (oldidx = 0; oldidx <= oldmask; oldidx++) { if ((entry = oldentries[oldidx])) { if (entry & LARGEQUARK) q = entry & (LARGEQUARK-1); else q = (entry >> QUARKSHIFT) & QUARKMASK; for (sig = 0, s = NAME(q); (c = *s++); ) sig = (sig << 1) + c; newidx = HASH(sig); if (entries[newidx]) { rehash = REHASHVAL(sig); do { newidx = REHASH(newidx, rehash); } while (entries[newidx]); } entries[newidx] = entry; } } if (oldmask) Xfree(oldentries); return True; } XrmQuark _XrmInternalStringToQuark( register _Xconst char *name, register int len, register Signature sig, Bool permstring) { register XrmQuark q; register Entry entry; register int idx, rehash; register int i; register char *s1, *s2; char *new; rehash = 0; idx = HASH(sig); _XLockMutex(_Xglobal_lock); while ((entry = quarkTable[idx])) { if (entry & LARGEQUARK) q = entry & (LARGEQUARK-1); else { if ((entry - sig) & XSIGMASK) goto nomatch; q = (entry >> QUARKSHIFT) & QUARKMASK; } for (i = len, s1 = (char *)name, s2 = NAME(q); --i >= 0; ) { if (*s1++ != *s2++) goto nomatch; } if (*s2) { nomatch: if (!rehash) rehash = REHASHVAL(sig); idx = REHASH(idx, rehash); continue; } #ifdef PERMQ if (permstring && !ISPERM(q)) { Xfree(NAME(q)); NAME(q) = (char *)name; SETPERM(q); } #endif _XUnlockMutex(_Xglobal_lock); return q; } if (nextUniq == nextQuark) goto fail; if ((nextQuark + (nextQuark >> 2)) > quarkMask) { if (!ExpandQuarkTable()) goto fail; _XUnlockMutex(_Xglobal_lock); return _XrmInternalStringToQuark(name, len, sig, permstring); } q = nextQuark; if (!(q & QUANTUMMASK)) { if (!(q & CHUNKMASK)) { if (!(new = Xrealloc(stringTable, sizeof(XrmString *) * ((q >> QUANTUMSHIFT) + CHUNKPER)))) goto fail; stringTable = (XrmString **)new; #ifdef PERMQ if (!(new = Xrealloc(permTable, sizeof(Bits *) * ((q >> QUANTUMSHIFT) + CHUNKPER)))) goto fail; permTable = (Bits **)new; #endif } new = Xpermalloc(QUANTSIZE); if (!new) goto fail; stringTable[q >> QUANTUMSHIFT] = (XrmString *)new; #ifdef PERMQ permTable[q >> QUANTUMSHIFT] = (Bits *)(new + STRQUANTSIZE); #endif } if (!permstring) { s2 = (char *)name; #ifdef PERMQ name = Xmalloc(len+1); #else name = permalloc(len+1); #endif if (!name) goto fail; for (i = len, s1 = (char *)name; --i >= 0; ) *s1++ = *s2++; *s1++ = '\0'; #ifdef PERMQ CLEARPERM(q); } else { SETPERM(q); #endif } NAME(q) = (char *)name; if (q <= QUARKMASK) entry = (q << QUARKSHIFT) | (sig & XSIGMASK); else entry = q | LARGEQUARK; quarkTable[idx] = entry; nextQuark++; _XUnlockMutex(_Xglobal_lock); return q; fail: _XUnlockMutex(_Xglobal_lock); return NULLQUARK; } XrmQuark XrmStringToQuark( _Xconst char *name) { register char c, *tname; register Signature sig = 0; if (!name) return (NULLQUARK); for (tname = (char *)name; (c = *tname++); ) sig = (sig << 1) + c; return _XrmInternalStringToQuark(name, tname-(char *)name-1, sig, False); } XrmQuark XrmPermStringToQuark( _Xconst char *name) { register char c, *tname; register Signature sig = 0; if (!name) return (NULLQUARK); for (tname = (char *)name; (c = *tname++); ) sig = (sig << 1) + c; return _XrmInternalStringToQuark(name, tname-(char *)name-1, sig, True); } XrmQuark XrmUniqueQuark(void) { XrmQuark q; _XLockMutex(_Xglobal_lock); if (nextUniq == nextQuark) q = NULLQUARK; else q = nextUniq--; _XUnlockMutex(_Xglobal_lock); return q; } XrmString XrmQuarkToString(register XrmQuark quark) { XrmString s; _XLockMutex(_Xglobal_lock); if (quark <= 0 || quark >= nextQuark) s = NULLSTRING; else { #ifdef PERMQ /* We have to mark the quark as permanent, since the caller might hold * onto the string pointer forver. */ SETPERM(quark); #endif s = NAME(quark); } _XUnlockMutex(_Xglobal_lock); return s; } nx-libs-3.5.99.23/nx-X11/lib/src/QuBest.c0000644000000000000000000000352113614532331014210 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Status XQueryBestSize( register Display *dpy, int class, Drawable drawable, unsigned int width, unsigned int height, unsigned int *ret_width, unsigned int *ret_height) { xQueryBestSizeReply rep; register xQueryBestSizeReq *req; LockDisplay(dpy); GetReq(QueryBestSize, req); req->class = class; req->drawable = drawable; req->width = width; req->height = height; if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { UnlockDisplay(dpy); SyncHandle(); return 0; } *ret_width = rep.width; *ret_height = rep.height; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/QuColor.c0000644000000000000000000000363113614532331014373 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XQueryColor( register Display *dpy, Colormap cmap, XColor *def) /* RETURN */ { xrgb color; xQueryColorsReply rep; register xQueryColorsReq *req; unsigned long val = def->pixel; /* needed for macro below */ LockDisplay(dpy); GetReqExtra(QueryColors, 4, req); /* a pixel (CARD32) is 4 bytes */ req->cmap = cmap; OneDataCard32 (dpy, NEXTPTR(req,xQueryColorsReq), val); if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) { _XRead(dpy, (char *)&color, (long) SIZEOF(xrgb)); def->red = color.red; def->blue = color.blue; def->green = color.green; def->flags = DoRed | DoGreen | DoBlue; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/QuColors.c0000644000000000000000000000524713614532331014563 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" static void _XQueryColors( register Display *dpy, Colormap cmap, XColor *defs, /* RETURN */ int ncolors) { register int i; xQueryColorsReply rep; register xQueryColorsReq *req; GetReq(QueryColors, req); req->cmap = cmap; SetReqLen(req, ncolors, ncolors); /* each pixel is a CARD32 */ for (i = 0; i < ncolors; i++) Data32 (dpy, (long *)&defs[i].pixel, 4L); /* XXX this isn't very efficient */ if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) { unsigned long nbytes = (long) ncolors * SIZEOF(xrgb); xrgb *color = Xmalloc(nbytes); if (color != NULL) { _XRead(dpy, (char *) color, nbytes); for (i = 0; i < ncolors; i++) { register XColor *def = &defs[i]; register xrgb *rgb = &color[i]; def->red = rgb->red; def->green = rgb->green; def->blue = rgb->blue; def->flags = DoRed | DoGreen | DoBlue; } Xfree(color); } else _XEatDataWords(dpy, rep.length); } } int XQueryColors( register Display * const dpy, const Colormap cmap, XColor *defs, /* RETURN */ int ncolors) { int n; if (dpy->bigreq_size > 0) n = dpy->bigreq_size - (sizeof (xQueryColorsReq) >> 2) - 1; else n = dpy->max_request_size - (sizeof (xQueryColorsReq) >> 2); LockDisplay(dpy); while (ncolors >= n) { _XQueryColors(dpy, cmap, defs, n); defs += n; ncolors -= n; } if (ncolors > 0) _XQueryColors(dpy, cmap, defs, ncolors); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/QuCurShp.c0000644000000000000000000000347613614532331014530 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Status XQueryBestCursor( register Display *dpy, Drawable drawable, unsigned int width, unsigned int height, unsigned int *ret_width, unsigned int *ret_height) { xQueryBestSizeReply rep; register xQueryBestSizeReq *req; LockDisplay(dpy); GetReq(QueryBestSize, req); req->class = CursorShape; req->drawable = drawable; req->width = width; req->height = height; if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { UnlockDisplay(dpy); SyncHandle(); return 0; } *ret_width = rep.width; *ret_height = rep.height; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/QuExt.c0000644000000000000000000000354213614532331014056 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Bool XQueryExtension( register Display *dpy, _Xconst char *name, int *major_opcode, /* RETURN */ int *first_event, /* RETURN */ int *first_error) /* RETURN */ { xQueryExtensionReply rep; register xQueryExtensionReq *req; LockDisplay(dpy); GetReq(QueryExtension, req); req->nbytes = name ? strlen(name) : 0; req->length += (req->nbytes+(unsigned)3)>>2; _XSend(dpy, name, (long)req->nbytes); (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); *major_opcode = rep.major_opcode; *first_event = rep.first_event; *first_error = rep.first_error; UnlockDisplay(dpy); SyncHandle(); return (rep.present); } nx-libs-3.5.99.23/nx-X11/lib/src/QuKeybd.c0000644000000000000000000000321613614532331014352 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" struct kmap { char map[32]; }; int XQueryKeymap( register Display *dpy, char keys[32]) { xQueryKeymapReply rep; _X_UNUSED register xReq *req; LockDisplay(dpy); GetEmptyReq(QueryKeymap, req); (void) _XReply(dpy, (xReply *)&rep, (SIZEOF(xQueryKeymapReply) - SIZEOF(xReply)) >> 2, xTrue); *(struct kmap *) keys = *(struct kmap *)rep.map; /* faster than memcpy */ UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/QuPntr.c0000644000000000000000000000363713614532331014246 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Bool XQueryPointer( register Display *dpy, Window w, Window *root, Window *child, int *root_x, int *root_y, int *win_x, int *win_y, unsigned int *mask) { xQueryPointerReply rep; xResourceReq *req; LockDisplay(dpy); GetResReq(QueryPointer, w, req); if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { UnlockDisplay(dpy); SyncHandle(); return(False); } *root = rep.root; *child = rep.child; *root_x = cvtINT16toInt (rep.rootX); *root_y = cvtINT16toInt (rep.rootY); *win_x = cvtINT16toInt (rep.winX); *win_y = cvtINT16toInt (rep.winY); *mask = rep.mask; UnlockDisplay(dpy); SyncHandle(); return (rep.sameScreen); } nx-libs-3.5.99.23/nx-X11/lib/src/QuStipShp.c0000644000000000000000000000350613614532331014710 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Status XQueryBestStipple( register Display *dpy, Drawable drawable, unsigned int width, unsigned int height, unsigned int *ret_width, unsigned int *ret_height) { xQueryBestSizeReply rep; register xQueryBestSizeReq *req; LockDisplay(dpy); GetReq(QueryBestSize, req); req->class = StippleShape; req->drawable = drawable; req->width = width; req->height = height; if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { UnlockDisplay(dpy); SyncHandle(); return 0; } *ret_width = rep.width; *ret_height = rep.height; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/QuTextE16.c0000644000000000000000000000520113614532331014510 0ustar /* Copyright 1986, 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XQueryTextExtents16 ( register Display *dpy, Font fid, _Xconst XChar2b *string, register int nchars, int *dir, int *font_ascent, int *font_descent, register XCharStruct *overall) { register long i; register unsigned char *ptr; char *buf; xQueryTextExtentsReply rep; long nbytes; register xQueryTextExtentsReq *req; LockDisplay(dpy); nbytes = nchars << 1; GetReq(QueryTextExtents, req); req->fid = fid; if ((buf = _XAllocScratch (dpy, (unsigned long) nbytes))) { req->length += (nbytes + 3)>>2; req->oddLength = nchars & 1; for (ptr = (unsigned char *)buf, i = nchars; --i >= 0; string++) { *ptr++ = string->byte1; *ptr++ = string->byte2; } Data (dpy, buf, nbytes); } if (!_XReply (dpy, (xReply *)&rep, 0, xTrue) || !buf) { UnlockDisplay(dpy); SyncHandle(); return 0; } *dir = rep.drawDirection; *font_ascent = cvtINT16toInt (rep.fontAscent); *font_descent = cvtINT16toInt (rep.fontDescent); overall->ascent = (short) cvtINT16toShort (rep.overallAscent); overall->descent = (short) cvtINT16toShort (rep.overallDescent); /* XXX bogus - we're throwing away information!!! */ overall->width = (short) cvtINT32toInt (rep.overallWidth); overall->lbearing = (short) cvtINT32toInt (rep.overallLeft); overall->rbearing = (short) cvtINT32toInt (rep.overallRight); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/QuTextExt.c0000644000000000000000000000512013614532331014715 0ustar /* Copyright 1986, 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XQueryTextExtents ( register Display *dpy, Font fid, register _Xconst char *string, register int nchars, int *dir, int *font_ascent, int *font_descent, register XCharStruct *overall) { register int i; register char *ptr; char *buf; xQueryTextExtentsReply rep; long nbytes; register xQueryTextExtentsReq *req; LockDisplay(dpy); nbytes = nchars << 1; GetReq(QueryTextExtents, req); req->fid = fid; if ((buf = _XAllocScratch (dpy, (unsigned long) nbytes))) { req->length += (nbytes + 3)>>2; req->oddLength = nchars & 1; for (ptr = buf, i = nchars; --i >= 0;) { *ptr++ = 0; *ptr++ = *string++; } Data (dpy, buf, nbytes); } if (!_XReply (dpy, (xReply *)&rep, 0, xTrue) || !buf) { UnlockDisplay(dpy); SyncHandle(); return 0; } *dir = rep.drawDirection; *font_ascent = cvtINT16toInt (rep.fontAscent); *font_descent = cvtINT16toInt (rep.fontDescent); overall->ascent = (short) cvtINT16toShort (rep.overallAscent); overall->descent = (short) cvtINT16toShort (rep.overallDescent); /* XXX bogus - we're throwing away information!!! */ overall->width = (short) cvtINT32toInt (rep.overallWidth); overall->lbearing = (short) cvtINT32toInt (rep.overallLeft); overall->rbearing = (short) cvtINT32toInt (rep.overallRight); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/QuTileShp.c0000644000000000000000000000350213614532331014662 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Status XQueryBestTile( register Display *dpy, Drawable drawable, unsigned int width, unsigned int height, unsigned int *ret_width, unsigned int *ret_height) { xQueryBestSizeReply rep; register xQueryBestSizeReq *req; LockDisplay(dpy); GetReq(QueryBestSize, req); req->class = TileShape; req->drawable = drawable; req->width = width; req->height = height; if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { UnlockDisplay(dpy); SyncHandle(); return(0); } *ret_width = rep.width; *ret_height = rep.height; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/QuTree.c0000644000000000000000000000414113614532331014211 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Status XQueryTree ( register Display *dpy, Window w, Window *root, /* RETURN */ Window *parent, /* RETURN */ Window **children, /* RETURN */ unsigned int *nchildren) /* RETURN */ { unsigned long nbytes; xQueryTreeReply rep; register xResourceReq *req; LockDisplay(dpy); GetResReq(QueryTree, w, req); if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return (0); } *children = (Window *) NULL; if (rep.nChildren != 0) { nbytes = rep.nChildren * sizeof(Window); *children = Xmalloc(nbytes); if (! *children) { _XEatDataWords(dpy, rep.length); UnlockDisplay(dpy); SyncHandle(); return (0); } nbytes = rep.nChildren << 2; _XRead32 (dpy, (long *) *children, nbytes); } *parent = rep.parent; *root = rep.root; *nchildren = rep.nChildren; UnlockDisplay(dpy); SyncHandle(); return (1); } nx-libs-3.5.99.23/nx-X11/lib/src/RaiseWin.c0000644000000000000000000000311713614532331014527 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XRaiseWindow ( register Display *dpy, Window w) { register xConfigureWindowReq *req; unsigned long val = Above; /* needed for macro below */ LockDisplay(dpy); GetReqExtra(ConfigureWindow, 4, req); req->window = w; req->mask = CWStackMode; OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), val); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/RdBitF.c0000644000000000000000000001553213614532331014124 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Code to read bitmaps from disk files. Interprets * data from X10 and X11 bitmap files and creates * Pixmap representations of files. Returns Pixmap * ID and specifics about image. * * Modified for speedup by Jim Becker, changed image * data parsing logic (removed some fscanf()s). * Aug 5, 1988 * * Note that this file and ../Xmu/RdBitF.c look very similar.... Keep them * that way (but don't use common source code so that people can have one * without the other). */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include "Xutil.h" #include #include #define MAX_SIZE 255 /* shared data for the image read/parse logic */ static const short hexTable[256] = { ['0'] = 0, ['1'] = 1, ['2'] = 2, ['3'] = 3, ['4'] = 4, ['5'] = 5, ['6'] = 6, ['7'] = 7, ['8'] = 8, ['9'] = 9, ['A'] = 10, ['B'] = 11, ['C'] = 12, ['D'] = 13, ['E'] = 14, ['F'] = 15, ['a'] = 10, ['b'] = 11, ['c'] = 12, ['d'] = 13, ['e'] = 14, ['f'] = 15, [' '] = -1, [','] = -1, ['}'] = -1, ['\n'] = -1, ['\t'] = -1 }; /* * read next hex value in the input stream, return -1 if EOF */ static int NextInt ( FILE *fstream) { int ch; int value = 0; int gotone = 0; int done = 0; /* loop, accumulate hex value until find delimiter */ /* skip any initial delimiters found in read stream */ while (!done) { ch = getc(fstream); if (ch == EOF) { value = -1; done++; } else { /* trim high bits, check type and accumulate */ ch &= 0xff; if (isascii(ch) && isxdigit(ch)) { value = (value << 4) + hexTable[ch]; gotone++; } else if ((hexTable[ch]) < 0 && gotone) done++; } } return value; } int XReadBitmapFileData ( _Xconst char *filename, unsigned int *width, /* RETURNED */ unsigned int *height, /* RETURNED */ unsigned char **data, /* RETURNED */ int *x_hot, /* RETURNED */ int *y_hot) /* RETURNED */ { FILE *fstream; /* handle on file */ unsigned char *bits = NULL; /* working variable */ char line[MAX_SIZE]; /* input line from file */ int size; /* number of bytes of data */ char name_and_type[MAX_SIZE]; /* an input line */ char *type; /* for parsing */ int value; /* from an input line */ int version10p; /* boolean, old format */ int padding; /* to handle alignment */ int bytes_per_line; /* per scanline of data */ unsigned int ww = 0; /* width */ unsigned int hh = 0; /* height */ int hx = -1; /* x hotspot */ int hy = -1; /* y hotspot */ if (!(fstream = fopen(filename, "r"))) return BitmapOpenFailed; /* error cleanup and return macro */ #define RETURN(code) \ { Xfree (bits); fclose (fstream); return code; } while (fgets(line, MAX_SIZE, fstream)) { if (strlen(line) == MAX_SIZE-1) RETURN (BitmapFileInvalid); if (sscanf(line,"#define %s %d",name_and_type,&value) == 2) { if (!(type = strrchr(name_and_type, '_'))) type = name_and_type; else type++; if (!strcmp("width", type)) ww = (unsigned int) value; if (!strcmp("height", type)) hh = (unsigned int) value; if (!strcmp("hot", type)) { if (type-- == name_and_type || type-- == name_and_type) continue; if (!strcmp("x_hot", type)) hx = value; if (!strcmp("y_hot", type)) hy = value; } continue; } if (sscanf(line, "static short %s = {", name_and_type) == 1) version10p = 1; else if (sscanf(line,"static unsigned char %s = {",name_and_type) == 1) version10p = 0; else if (sscanf(line, "static char %s = {", name_and_type) == 1) version10p = 0; else continue; if (!(type = strrchr(name_and_type, '_'))) type = name_and_type; else type++; if (strcmp("bits[]", type)) continue; if (!ww || !hh) RETURN (BitmapFileInvalid); if ((ww % 16) && ((ww % 16) < 9) && version10p) padding = 1; else padding = 0; bytes_per_line = (ww+7)/8 + padding; size = bytes_per_line * hh; bits = Xmalloc (size); if (!bits) RETURN (BitmapNoMemory); if (version10p) { unsigned char *ptr; int bytes; for (bytes=0, ptr=bits; bytes> 8; } } else { unsigned char *ptr; int bytes; for (bytes=0, ptr=bits; bytes #endif #include "Xlibint.h" int XRecolorCursor( register Display *dpy, Cursor cursor, XColor *foreground, XColor *background) { register xRecolorCursorReq *req; LockDisplay(dpy); GetReq(RecolorCursor, req); req->cursor = cursor; req->foreRed = foreground->red; req->foreGreen = foreground->green; req->foreBlue = foreground->blue; req->backRed = background->red; req->backGreen = background->green; req->backBlue = background->blue; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ReconfWin.c0000644000000000000000000000436413614532331014705 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #define AllMaskBits (CWX|CWY|CWWidth|CWHeight|\ CWBorderWidth|CWSibling|CWStackMode) int XConfigureWindow( register Display *dpy, Window w, unsigned int mask, XWindowChanges *changes) { unsigned long values[7]; register unsigned long *value = values; long nvalues; register xConfigureWindowReq *req; LockDisplay(dpy); GetReq(ConfigureWindow, req); req->window = w; mask &= AllMaskBits; req->mask = mask; if (mask & CWX) *value++ = changes->x; if (mask & CWY) *value++ = changes->y; if (mask & CWWidth) *value++ = changes->width; if (mask & CWHeight) *value++ = changes->height; if (mask & CWBorderWidth) *value++ = changes->border_width; if (mask & CWSibling) *value++ = changes->sibling; if (mask & CWStackMode) *value++ = changes->stack_mode; req->length += (nvalues = value - values); nvalues <<= 2; /* watch out for macros... */ Data32 (dpy, (long *) values, nvalues); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ReconfWM.c0000644000000000000000000001007713614532331014471 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #define AllMaskBits (CWX|CWY|CWWidth|CWHeight|\ CWBorderWidth|CWSibling|CWStackMode) Status XReconfigureWMWindow ( register Display *dpy, Window w, int screen, unsigned int mask, XWindowChanges *changes) { Window root = RootWindow (dpy, screen); _XAsyncHandler async; _XAsyncErrorState async_state; /* * Only need to go through the trouble if we are actually changing the * stacking mode. */ if (!(mask & CWStackMode)) { XConfigureWindow (dpy, w, mask, changes); return True; } /* * We need to inline XConfigureWindow and XSync so that everything is done * while the display is locked. */ LockDisplay(dpy); /* * XConfigureWindow (dpy, w, mask, changes); */ { unsigned long values[7]; register unsigned long *value = values; long nvalues; register xConfigureWindowReq *req; GetReq(ConfigureWindow, req); async_state.min_sequence_number = dpy->request; async_state.max_sequence_number = dpy->request; async_state.error_code = BadMatch; async_state.major_opcode = X_ConfigureWindow; async_state.minor_opcode = 0; async_state.error_count = 0; async.next = dpy->async_handlers; async.handler = _XAsyncErrorHandler; async.data = (XPointer)&async_state; dpy->async_handlers = &async; req->window = w; mask &= AllMaskBits; req->mask = mask; if (mask & CWX) *value++ = changes->x; if (mask & CWY) *value++ = changes->y; if (mask & CWWidth) *value++ = changes->width; if (mask & CWHeight) *value++ = changes->height; if (mask & CWBorderWidth) *value++ = changes->border_width; if (mask & CWSibling) *value++ = changes->sibling; if (mask & CWStackMode) *value++ = changes->stack_mode; req->length += (nvalues = value - values); nvalues <<= 2; /* watch out for macros... */ Data32 (dpy, (long *) values, nvalues); } /* * XSync (dpy, 0) */ { xGetInputFocusReply rep; _X_UNUSED register xReq *req; GetEmptyReq(GetInputFocus, req); (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); } DeqAsyncHandler(dpy, &async); UnlockDisplay(dpy); SyncHandle(); /* * If the request succeeded, then everything is okay; otherwise, send event */ if (!async_state.error_count) return True; else { XConfigureRequestEvent ev = { .type = ConfigureRequest, .window = w, .parent = root, .value_mask = (mask & AllMaskBits), .x = changes->x, .y = changes->y, .width = changes->width, .height = changes->height, .border_width = changes->border_width, .above = changes->sibling, .detail = changes->stack_mode, }; return (XSendEvent (dpy, root, False, SubstructureRedirectMask|SubstructureNotifyMask, (XEvent *)&ev)); } } nx-libs-3.5.99.23/nx-X11/lib/src/Region.c0000644000000000000000000012234313614532331014234 0ustar /************************************************************************ Copyright 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************/ /* * The functions in this file implement the Region abstraction, similar to one * used in the X11 sample server. A Region is simply an area, as the name * implies, and is implemented as a "y-x-banded" array of rectangles. To * explain: Each Region is made up of a certain number of rectangles sorted * by y coordinate first, and then by x coordinate. * * Furthermore, the rectangles are banded such that every rectangle with a * given upper-left y coordinate (y1) will have the same lower-right y * coordinate (y2) and vice versa. If a rectangle has scanlines in a band, it * will span the entire vertical distance of the band. This means that some * areas that could be merged into a taller rectangle will be represented as * several shorter rectangles to account for shorter rectangles to its left * or right but within its "vertical scope". * * An added constraint on the rectangles is that they must cover as much * horizontal area as possible. E.g. no two rectangles in a band are allowed * to touch. * * Whenever possible, bands will be merged together to cover a greater vertical * distance (and thus reduce the number of rectangles). Two bands can be merged * only if the bottom of one touches the top of the other and they have * rectangles in the same places (of the same width, of course). This maintains * the y-x-banding that's so nice to have... */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xutil.h" #include #include "poly.h" #ifdef DEBUG #include #define assert(expr) {if (!(expr)) fprintf(stderr,\ "Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__); } #else #define assert(expr) #endif typedef int (*overlapProcp)( register Region pReg, register BoxPtr r1, BoxPtr r1End, register BoxPtr r2, BoxPtr r2End, short y1, short y2); typedef int (*nonOverlapProcp)( register Region pReg, register BoxPtr r, BoxPtr rEnd, register short y1, register short y2); static void miRegionOp( register Region newReg, /* Place to store result */ Region reg1, /* First region in operation */ Region reg2, /* 2d region in operation */ int (*overlapFunc)( register Region pReg, register BoxPtr r1, BoxPtr r1End, register BoxPtr r2, BoxPtr r2End, short y1, short y2), /* Function to call for over- * lapping bands */ int (*nonOverlap1Func)( register Region pReg, register BoxPtr r, BoxPtr rEnd, register short y1, register short y2), /* Function to call for non- * overlapping bands in region * 1 */ int (*nonOverlap2Func)( register Region pReg, register BoxPtr r, BoxPtr rEnd, register short y1, register short y2)); /* Function to call for non- * overlapping bands in region * 2 */ /* Create a new empty region */ Region XCreateRegion(void) { Region temp; if (! (temp = Xmalloc(sizeof( REGION )))) return (Region) NULL; if (! (temp->rects = Xmalloc(sizeof( BOX )))) { Xfree(temp); return (Region) NULL; } temp->numRects = 0; temp->extents.x1 = 0; temp->extents.y1 = 0; temp->extents.x2 = 0; temp->extents.y2 = 0; temp->size = 1; return( temp ); } int XClipBox( Region r, XRectangle *rect) { rect->x = r->extents.x1; rect->y = r->extents.y1; rect->width = r->extents.x2 - r->extents.x1; rect->height = r->extents.y2 - r->extents.y1; return 1; } int XUnionRectWithRegion( register XRectangle *rect, Region source, Region dest) { REGION region; if (!rect->width || !rect->height) return 0; region.rects = ®ion.extents; region.numRects = 1; region.extents.x1 = rect->x; region.extents.y1 = rect->y; region.extents.x2 = rect->x + rect->width; region.extents.y2 = rect->y + rect->height; region.size = 1; return XUnionRegion(®ion, source, dest); } /*- *----------------------------------------------------------------------- * miSetExtents -- * Reset the extents of a region to what they should be. Called by * miSubtract and miIntersect b/c they can't figure it out along the * way or do so easily, as miUnion can. * * Results: * None. * * Side Effects: * The region's 'extents' structure is overwritten. * *----------------------------------------------------------------------- */ static void miSetExtents ( Region pReg) { register BoxPtr pBox, pBoxEnd, pExtents; if (pReg->numRects == 0) { pReg->extents.x1 = 0; pReg->extents.y1 = 0; pReg->extents.x2 = 0; pReg->extents.y2 = 0; return; } pExtents = &pReg->extents; pBox = pReg->rects; pBoxEnd = &pBox[pReg->numRects - 1]; /* * Since pBox is the first rectangle in the region, it must have the * smallest y1 and since pBoxEnd is the last rectangle in the region, * it must have the largest y2, because of banding. Initialize x1 and * x2 from pBox and pBoxEnd, resp., as good things to initialize them * to... */ pExtents->x1 = pBox->x1; pExtents->y1 = pBox->y1; pExtents->x2 = pBoxEnd->x2; pExtents->y2 = pBoxEnd->y2; assert(pExtents->y1 < pExtents->y2); while (pBox <= pBoxEnd) { if (pBox->x1 < pExtents->x1) { pExtents->x1 = pBox->x1; } if (pBox->x2 > pExtents->x2) { pExtents->x2 = pBox->x2; } pBox++; } assert(pExtents->x1 < pExtents->x2); } int XSetRegion( Display *dpy, GC gc, register Region r) { register int i; register XRectangle *xr, *pr; register BOX *pb; unsigned long total; LockDisplay (dpy); total = r->numRects * sizeof (XRectangle); if ((xr = (XRectangle *) _XAllocTemp(dpy, total))) { for (pr = xr, pb = r->rects, i = r->numRects; --i >= 0; pr++, pb++) { pr->x = pb->x1; pr->y = pb->y1; pr->width = pb->x2 - pb->x1; pr->height = pb->y2 - pb->y1; } } if (xr || !r->numRects) _XSetClipRectangles(dpy, gc, 0, 0, xr, r->numRects, YXBanded); if (xr) _XFreeTemp(dpy, (char *)xr, total); UnlockDisplay(dpy); SyncHandle(); return 1; } int XDestroyRegion( Region r) { Xfree( (char *) r->rects ); Xfree( (char *) r ); return 1; } /* TranslateRegion(pRegion, x, y) translates in place added by raymond */ int XOffsetRegion( register Region pRegion, register int x, register int y) { register int nbox; register BOX *pbox; pbox = pRegion->rects; nbox = pRegion->numRects; while(nbox--) { pbox->x1 += x; pbox->x2 += x; pbox->y1 += y; pbox->y2 += y; pbox++; } pRegion->extents.x1 += x; pRegion->extents.x2 += x; pRegion->extents.y1 += y; pRegion->extents.y2 += y; return 1; } /* Utility procedure Compress: Replace r by the region r', where p in r' iff (Quantifer m <= dx) (p + m in r), and Quantifier is Exists if grow is TRUE, For all if grow is FALSE, and (x,y) + m = (x+m,y) if xdir is TRUE; (x,y+m) if xdir is FALSE. Thus, if xdir is TRUE and grow is FALSE, r is replaced by the region of all points p such that p and the next dx points on the same horizontal scan line are all in r. We do this using by noting that p is the head of a run of length 2^i + k iff p is the head of a run of length 2^i and p+2^i is the head of a run of length k. Thus, the loop invariant: s contains the region corresponding to the runs of length shift. r contains the region corresponding to the runs of length 1 + dxo & (shift-1), where dxo is the original value of dx. dx = dxo & ~(shift-1). As parameters, s and t are scratch regions, so that we don't have to allocate them on every call. */ #define ZOpRegion(a,b,c) if (grow) XUnionRegion(a,b,c); \ else XIntersectRegion(a,b,c) #define ZShiftRegion(a,b) if (xdir) XOffsetRegion(a,b,0); \ else XOffsetRegion(a,0,b) #define ZCopyRegion(a,b) XUnionRegion(a,a,b) static void Compress( Region r, Region s, Region t, register unsigned dx, register int xdir, register int grow) { register unsigned shift = 1; ZCopyRegion(r, s); while (dx) { if (dx & shift) { ZShiftRegion(r, -(int)shift); ZOpRegion(r, s, r); dx -= shift; if (!dx) break; } ZCopyRegion(s, t); ZShiftRegion(s, -(int)shift); ZOpRegion(s, t, s); shift <<= 1; } } #undef ZOpRegion #undef ZShiftRegion #undef ZCopyRegion int XShrinkRegion( Region r, int dx, int dy) { Region s, t; int grow; if (!dx && !dy) return 0; if (! (s = XCreateRegion()) ) return 0; if (! (t = XCreateRegion()) ) { XDestroyRegion(s); return 0; } if ((grow = (dx < 0))) dx = -dx; if (dx) Compress(r, s, t, (unsigned) 2*dx, TRUE, grow); if ((grow = (dy < 0))) dy = -dy; if (dy) Compress(r, s, t, (unsigned) 2*dy, FALSE, grow); XOffsetRegion(r, dx, dy); XDestroyRegion(s); XDestroyRegion(t); return 0; } /*====================================================================== * Region Intersection *====================================================================*/ /*- *----------------------------------------------------------------------- * miIntersectO -- * Handle an overlapping band for miIntersect. * * Results: * None. * * Side Effects: * Rectangles may be added to the region. * *----------------------------------------------------------------------- */ /* static void*/ static int miIntersectO ( register Region pReg, register BoxPtr r1, BoxPtr r1End, register BoxPtr r2, BoxPtr r2End, short y1, short y2) { register short x1; register short x2; register BoxPtr pNextRect; pNextRect = &pReg->rects[pReg->numRects]; while ((r1 != r1End) && (r2 != r2End)) { x1 = max(r1->x1,r2->x1); x2 = min(r1->x2,r2->x2); /* * If there's any overlap between the two rectangles, add that * overlap to the new region. * There's no need to check for subsumption because the only way * such a need could arise is if some region has two rectangles * right next to each other. Since that should never happen... */ if (x1 < x2) { assert(y1rects); pNextRect->x1 = x1; pNextRect->y1 = y1; pNextRect->x2 = x2; pNextRect->y2 = y2; pReg->numRects += 1; pNextRect++; assert(pReg->numRects <= pReg->size); } /* * Need to advance the pointers. Shift the one that extends * to the right the least, since the other still has a chance to * overlap with that region's next rectangle, if you see what I mean. */ if (r1->x2 < r2->x2) { r1++; } else if (r2->x2 < r1->x2) { r2++; } else { r1++; r2++; } } return 0; /* lint */ } int XIntersectRegion( Region reg1, Region reg2, /* source regions */ register Region newReg) /* destination Region */ { /* check for trivial reject */ if ( (!(reg1->numRects)) || (!(reg2->numRects)) || (!EXTENTCHECK(®1->extents, ®2->extents))) newReg->numRects = 0; else miRegionOp (newReg, reg1, reg2, miIntersectO, NULL, NULL); /* * Can't alter newReg's extents before we call miRegionOp because * it might be one of the source regions and miRegionOp depends * on the extents of those regions being the same. Besides, this * way there's no checking against rectangles that will be nuked * due to coalescing, so we have to examine fewer rectangles. */ miSetExtents(newReg); return 1; } static int miRegionCopy( register Region dstrgn, register Region rgn) { if (dstrgn != rgn) /* don't want to copy to itself */ { if (dstrgn->size < rgn->numRects) { if (dstrgn->rects) { BOX *prevRects = dstrgn->rects; dstrgn->rects = Xrealloc(dstrgn->rects, rgn->numRects * (sizeof(BOX))); if (! dstrgn->rects) { Xfree(prevRects); dstrgn->size = 0; return 0; } } dstrgn->size = rgn->numRects; } dstrgn->numRects = rgn->numRects; dstrgn->extents.x1 = rgn->extents.x1; dstrgn->extents.y1 = rgn->extents.y1; dstrgn->extents.x2 = rgn->extents.x2; dstrgn->extents.y2 = rgn->extents.y2; memcpy((char *) dstrgn->rects, (char *) rgn->rects, (int) (rgn->numRects * sizeof(BOX))); } return 1; } /*====================================================================== * Generic Region Operator *====================================================================*/ /*- *----------------------------------------------------------------------- * miCoalesce -- * Attempt to merge the boxes in the current band with those in the * previous one. Used only by miRegionOp. * * Results: * The new index for the previous band. * * Side Effects: * If coalescing takes place: * - rectangles in the previous band will have their y2 fields * altered. * - pReg->numRects will be decreased. * *----------------------------------------------------------------------- */ /* static int*/ static int miCoalesce( register Region pReg, /* Region to coalesce */ int prevStart, /* Index of start of previous band */ int curStart) /* Index of start of current band */ { register BoxPtr pPrevBox; /* Current box in previous band */ register BoxPtr pCurBox; /* Current box in current band */ register BoxPtr pRegEnd; /* End of region */ int curNumRects; /* Number of rectangles in current * band */ int prevNumRects; /* Number of rectangles in previous * band */ int bandY1; /* Y1 coordinate for current band */ pRegEnd = &pReg->rects[pReg->numRects]; pPrevBox = &pReg->rects[prevStart]; prevNumRects = curStart - prevStart; /* * Figure out how many rectangles are in the current band. Have to do * this because multiple bands could have been added in miRegionOp * at the end when one region has been exhausted. */ pCurBox = &pReg->rects[curStart]; bandY1 = pCurBox->y1; for (curNumRects = 0; (pCurBox != pRegEnd) && (pCurBox->y1 == bandY1); curNumRects++) { pCurBox++; } if (pCurBox != pRegEnd) { /* * If more than one band was added, we have to find the start * of the last band added so the next coalescing job can start * at the right place... (given when multiple bands are added, * this may be pointless -- see above). */ pRegEnd--; while (pRegEnd[-1].y1 == pRegEnd->y1) { pRegEnd--; } curStart = pRegEnd - pReg->rects; pRegEnd = pReg->rects + pReg->numRects; } if ((curNumRects == prevNumRects) && (curNumRects != 0)) { pCurBox -= curNumRects; /* * The bands may only be coalesced if the bottom of the previous * matches the top scanline of the current. */ if (pPrevBox->y2 == pCurBox->y1) { /* * Make sure the bands have boxes in the same places. This * assumes that boxes have been added in such a way that they * cover the most area possible. I.e. two boxes in a band must * have some horizontal space between them. */ do { if ((pPrevBox->x1 != pCurBox->x1) || (pPrevBox->x2 != pCurBox->x2)) { /* * The bands don't line up so they can't be coalesced. */ return (curStart); } pPrevBox++; pCurBox++; prevNumRects -= 1; } while (prevNumRects != 0); pReg->numRects -= curNumRects; pCurBox -= curNumRects; pPrevBox -= curNumRects; /* * The bands may be merged, so set the bottom y of each box * in the previous band to that of the corresponding box in * the current band. */ do { pPrevBox->y2 = pCurBox->y2; pPrevBox++; pCurBox++; curNumRects -= 1; } while (curNumRects != 0); /* * If only one band was added to the region, we have to backup * curStart to the start of the previous band. * * If more than one band was added to the region, copy the * other bands down. The assumption here is that the other bands * came from the same region as the current one and no further * coalescing can be done on them since it's all been done * already... curStart is already in the right place. */ if (pCurBox == pRegEnd) { curStart = prevStart; } else { do { *pPrevBox++ = *pCurBox++; } while (pCurBox != pRegEnd); } } } return (curStart); } /*- *----------------------------------------------------------------------- * miRegionOp -- * Apply an operation to two regions. Called by miUnion, miInverse, * miSubtract, miIntersect... * * Results: * None. * * Side Effects: * The new region is overwritten. * * Notes: * The idea behind this function is to view the two regions as sets. * Together they cover a rectangle of area that this function divides * into horizontal bands where points are covered only by one region * or by both. For the first case, the nonOverlapFunc is called with * each the band and the band's upper and lower extents. For the * second, the overlapFunc is called to process the entire band. It * is responsible for clipping the rectangles in the band, though * this function provides the boundaries. * At the end of each band, the new region is coalesced, if possible, * to reduce the number of rectangles in the region. * *----------------------------------------------------------------------- */ /* static void*/ static void miRegionOp( register Region newReg, /* Place to store result */ Region reg1, /* First region in operation */ Region reg2, /* 2d region in operation */ int (*overlapFunc)( register Region pReg, register BoxPtr r1, BoxPtr r1End, register BoxPtr r2, BoxPtr r2End, short y1, short y2), /* Function to call for over- * lapping bands */ int (*nonOverlap1Func)( register Region pReg, register BoxPtr r, BoxPtr rEnd, register short y1, register short y2), /* Function to call for non- * overlapping bands in region * 1 */ int (*nonOverlap2Func)( register Region pReg, register BoxPtr r, BoxPtr rEnd, register short y1, register short y2)) /* Function to call for non- * overlapping bands in region * 2 */ { register BoxPtr r1; /* Pointer into first region */ register BoxPtr r2; /* Pointer into 2d region */ BoxPtr r1End; /* End of 1st region */ BoxPtr r2End; /* End of 2d region */ register short ybot; /* Bottom of intersection */ register short ytop; /* Top of intersection */ BoxPtr oldRects; /* Old rects for newReg */ int prevBand; /* Index of start of * previous band in newReg */ int curBand; /* Index of start of current * band in newReg */ register BoxPtr r1BandEnd; /* End of current band in r1 */ register BoxPtr r2BandEnd; /* End of current band in r2 */ short top; /* Top of non-overlapping * band */ short bot; /* Bottom of non-overlapping * band */ /* * Initialization: * set r1, r2, r1End and r2End appropriately, preserve the important * parts of the destination region until the end in case it's one of * the two source regions, then mark the "new" region empty, allocating * another array of rectangles for it to use. */ r1 = reg1->rects; r2 = reg2->rects; r1End = r1 + reg1->numRects; r2End = r2 + reg2->numRects; oldRects = newReg->rects; EMPTY_REGION(newReg); /* * Allocate a reasonable number of rectangles for the new region. The idea * is to allocate enough so the individual functions don't need to * reallocate and copy the array, which is time consuming, yet we don't * have to worry about using too much memory. I hope to be able to * nuke the Xrealloc() at the end of this function eventually. */ newReg->size = max(reg1->numRects,reg2->numRects) * 2; if (! (newReg->rects = Xmalloc (sizeof(BoxRec) * newReg->size))) { newReg->size = 0; return; } /* * Initialize ybot and ytop. * In the upcoming loop, ybot and ytop serve different functions depending * on whether the band being handled is an overlapping or non-overlapping * band. * In the case of a non-overlapping band (only one of the regions * has points in the band), ybot is the bottom of the most recent * intersection and thus clips the top of the rectangles in that band. * ytop is the top of the next intersection between the two regions and * serves to clip the bottom of the rectangles in the current band. * For an overlapping band (where the two regions intersect), ytop clips * the top of the rectangles of both regions and ybot clips the bottoms. */ if (reg1->extents.y1 < reg2->extents.y1) ybot = reg1->extents.y1; else ybot = reg2->extents.y1; /* * prevBand serves to mark the start of the previous band so rectangles * can be coalesced into larger rectangles. qv. miCoalesce, above. * In the beginning, there is no previous band, so prevBand == curBand * (curBand is set later on, of course, but the first band will always * start at index 0). prevBand and curBand must be indices because of * the possible expansion, and resultant moving, of the new region's * array of rectangles. */ prevBand = 0; do { curBand = newReg->numRects; /* * This algorithm proceeds one source-band (as opposed to a * destination band, which is determined by where the two regions * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the * rectangle after the last one in the current band for their * respective regions. */ r1BandEnd = r1; while ((r1BandEnd != r1End) && (r1BandEnd->y1 == r1->y1)) { r1BandEnd++; } r2BandEnd = r2; while ((r2BandEnd != r2End) && (r2BandEnd->y1 == r2->y1)) { r2BandEnd++; } /* * First handle the band that doesn't intersect, if any. * * Note that attention is restricted to one band in the * non-intersecting region at once, so if a region has n * bands between the current position and the next place it overlaps * the other, this entire loop will be passed through n times. */ if (r1->y1 < r2->y1) { top = max(r1->y1,ybot); bot = min(r1->y2,r2->y1); if ((top != bot) && (nonOverlap1Func != NULL)) { (* nonOverlap1Func) (newReg, r1, r1BandEnd, top, bot); } ytop = r2->y1; } else if (r2->y1 < r1->y1) { top = max(r2->y1,ybot); bot = min(r2->y2,r1->y1); if ((top != bot) && (nonOverlap2Func != NULL)) { (* nonOverlap2Func) (newReg, r2, r2BandEnd, top, bot); } ytop = r1->y1; } else { ytop = r1->y1; } /* * If any rectangles got added to the region, try and coalesce them * with rectangles from the previous band. Note we could just do * this test in miCoalesce, but some machines incur a not * inconsiderable cost for function calls, so... */ if (newReg->numRects != curBand) { prevBand = miCoalesce (newReg, prevBand, curBand); } /* * Now see if we've hit an intersecting band. The two bands only * intersect if ybot > ytop */ ybot = min(r1->y2, r2->y2); curBand = newReg->numRects; if (ybot > ytop) { (* overlapFunc) (newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot); } if (newReg->numRects != curBand) { prevBand = miCoalesce (newReg, prevBand, curBand); } /* * If we've finished with a band (y2 == ybot) we skip forward * in the region to the next band. */ if (r1->y2 == ybot) { r1 = r1BandEnd; } if (r2->y2 == ybot) { r2 = r2BandEnd; } } while ((r1 != r1End) && (r2 != r2End)); /* * Deal with whichever region still has rectangles left. */ curBand = newReg->numRects; if (r1 != r1End) { if (nonOverlap1Func != NULL) { do { r1BandEnd = r1; while ((r1BandEnd < r1End) && (r1BandEnd->y1 == r1->y1)) { r1BandEnd++; } (* nonOverlap1Func) (newReg, r1, r1BandEnd, max(r1->y1,ybot), r1->y2); r1 = r1BandEnd; } while (r1 != r1End); } } else if ((r2 != r2End) && (nonOverlap2Func != NULL)) { do { r2BandEnd = r2; while ((r2BandEnd < r2End) && (r2BandEnd->y1 == r2->y1)) { r2BandEnd++; } (* nonOverlap2Func) (newReg, r2, r2BandEnd, max(r2->y1,ybot), r2->y2); r2 = r2BandEnd; } while (r2 != r2End); } if (newReg->numRects != curBand) { (void) miCoalesce (newReg, prevBand, curBand); } /* * A bit of cleanup. To keep regions from growing without bound, * we shrink the array of rectangles to match the new number of * rectangles in the region. This never goes to 0, however... * * Only do this stuff if the number of rectangles allocated is more than * twice the number of rectangles in the region (a simple optimization...). */ if (newReg->numRects < (newReg->size >> 1)) { if (REGION_NOT_EMPTY(newReg)) { BoxPtr prev_rects = newReg->rects; newReg->rects = Xrealloc (newReg->rects, sizeof(BoxRec) * newReg->numRects); if (! newReg->rects) newReg->rects = prev_rects; else newReg->size = newReg->numRects; } else { /* * No point in doing the extra work involved in an Xrealloc if * the region is empty */ newReg->size = 1; Xfree(newReg->rects); newReg->rects = Xmalloc(sizeof(BoxRec)); } } Xfree (oldRects); return; } /*====================================================================== * Region Union *====================================================================*/ /*- *----------------------------------------------------------------------- * miUnionNonO -- * Handle a non-overlapping band for the union operation. Just * Adds the rectangles into the region. Doesn't have to check for * subsumption or anything. * * Results: * None. * * Side Effects: * pReg->numRects is incremented and the final rectangles overwritten * with the rectangles we're passed. * *----------------------------------------------------------------------- */ /* static void*/ static int miUnionNonO ( register Region pReg, register BoxPtr r, BoxPtr rEnd, register short y1, register short y2) { register BoxPtr pNextRect; pNextRect = &pReg->rects[pReg->numRects]; assert(y1 < y2); while (r != rEnd) { assert(r->x1 < r->x2); MEMCHECK(pReg, pNextRect, pReg->rects); pNextRect->x1 = r->x1; pNextRect->y1 = y1; pNextRect->x2 = r->x2; pNextRect->y2 = y2; pReg->numRects += 1; pNextRect++; assert(pReg->numRects<=pReg->size); r++; } return 0; /* lint */ } /*- *----------------------------------------------------------------------- * miUnionO -- * Handle an overlapping band for the union operation. Picks the * left-most rectangle each time and merges it into the region. * * Results: * None. * * Side Effects: * Rectangles are overwritten in pReg->rects and pReg->numRects will * be changed. * *----------------------------------------------------------------------- */ /* static void*/ static int miUnionO ( register Region pReg, register BoxPtr r1, BoxPtr r1End, register BoxPtr r2, BoxPtr r2End, register short y1, register short y2) { register BoxPtr pNextRect; pNextRect = &pReg->rects[pReg->numRects]; #define MERGERECT(r) \ if ((pReg->numRects != 0) && \ (pNextRect[-1].y1 == y1) && \ (pNextRect[-1].y2 == y2) && \ (pNextRect[-1].x2 >= r->x1)) \ { \ if (pNextRect[-1].x2 < r->x2) \ { \ pNextRect[-1].x2 = r->x2; \ assert(pNextRect[-1].x1rects); \ pNextRect->y1 = y1; \ pNextRect->y2 = y2; \ pNextRect->x1 = r->x1; \ pNextRect->x2 = r->x2; \ pReg->numRects += 1; \ pNextRect += 1; \ } \ assert(pReg->numRects<=pReg->size);\ r++; assert (y1x1 < r2->x1) { MERGERECT(r1); } else { MERGERECT(r2); } } if (r1 != r1End) { do { MERGERECT(r1); } while (r1 != r1End); } else while (r2 != r2End) { MERGERECT(r2); } return 0; /* lint */ } int XUnionRegion( Region reg1, Region reg2, /* source regions */ Region newReg) /* destination Region */ { /* checks all the simple cases */ /* * Region 1 and 2 are the same or region 1 is empty */ if ( (reg1 == reg2) || (!(reg1->numRects)) ) { if (newReg != reg2) return miRegionCopy(newReg, reg2); return 1; } /* * if nothing to union (region 2 empty) */ if (!(reg2->numRects)) { if (newReg != reg1) return miRegionCopy(newReg, reg1); return 1; } /* * Region 1 completely subsumes region 2 */ if ((reg1->numRects == 1) && (reg1->extents.x1 <= reg2->extents.x1) && (reg1->extents.y1 <= reg2->extents.y1) && (reg1->extents.x2 >= reg2->extents.x2) && (reg1->extents.y2 >= reg2->extents.y2)) { if (newReg != reg1) return miRegionCopy(newReg, reg1); return 1; } /* * Region 2 completely subsumes region 1 */ if ((reg2->numRects == 1) && (reg2->extents.x1 <= reg1->extents.x1) && (reg2->extents.y1 <= reg1->extents.y1) && (reg2->extents.x2 >= reg1->extents.x2) && (reg2->extents.y2 >= reg1->extents.y2)) { if (newReg != reg2) return miRegionCopy(newReg, reg2); return 1; } miRegionOp (newReg, reg1, reg2, miUnionO, miUnionNonO, miUnionNonO); newReg->extents.x1 = min(reg1->extents.x1, reg2->extents.x1); newReg->extents.y1 = min(reg1->extents.y1, reg2->extents.y1); newReg->extents.x2 = max(reg1->extents.x2, reg2->extents.x2); newReg->extents.y2 = max(reg1->extents.y2, reg2->extents.y2); return 1; } /*====================================================================== * Region Subtraction *====================================================================*/ /*- *----------------------------------------------------------------------- * miSubtractNonO -- * Deal with non-overlapping band for subtraction. Any parts from * region 2 we discard. Anything from region 1 we add to the region. * * Results: * None. * * Side Effects: * pReg may be affected. * *----------------------------------------------------------------------- */ /* static void*/ static int miSubtractNonO1 ( register Region pReg, register BoxPtr r, BoxPtr rEnd, register short y1, register short y2) { register BoxPtr pNextRect; pNextRect = &pReg->rects[pReg->numRects]; assert(y1x1x2); MEMCHECK(pReg, pNextRect, pReg->rects); pNextRect->x1 = r->x1; pNextRect->y1 = y1; pNextRect->x2 = r->x2; pNextRect->y2 = y2; pReg->numRects += 1; pNextRect++; assert(pReg->numRects <= pReg->size); r++; } return 0; /* lint */ } /*- *----------------------------------------------------------------------- * miSubtractO -- * Overlapping band subtraction. x1 is the left-most point not yet * checked. * * Results: * None. * * Side Effects: * pReg may have rectangles added to it. * *----------------------------------------------------------------------- */ /* static void*/ static int miSubtractO ( register Region pReg, register BoxPtr r1, BoxPtr r1End, register BoxPtr r2, BoxPtr r2End, register short y1, register short y2) { register BoxPtr pNextRect; register int x1; x1 = r1->x1; assert(y1rects[pReg->numRects]; while ((r1 != r1End) && (r2 != r2End)) { if (r2->x2 <= x1) { /* * Subtrahend missed the boat: go to next subtrahend. */ r2++; } else if (r2->x1 <= x1) { /* * Subtrahend preceeds minuend: nuke left edge of minuend. */ x1 = r2->x2; if (x1 >= r1->x2) { /* * Minuend completely covered: advance to next minuend and * reset left fence to edge of new minuend. */ r1++; if (r1 != r1End) x1 = r1->x1; } else { /* * Subtrahend now used up since it doesn't extend beyond * minuend */ r2++; } } else if (r2->x1 < r1->x2) { /* * Left part of subtrahend covers part of minuend: add uncovered * part of minuend to region and skip to next subtrahend. */ assert(x1x1); MEMCHECK(pReg, pNextRect, pReg->rects); pNextRect->x1 = x1; pNextRect->y1 = y1; pNextRect->x2 = r2->x1; pNextRect->y2 = y2; pReg->numRects += 1; pNextRect++; assert(pReg->numRects<=pReg->size); x1 = r2->x2; if (x1 >= r1->x2) { /* * Minuend used up: advance to new... */ r1++; if (r1 != r1End) x1 = r1->x1; } else { /* * Subtrahend used up */ r2++; } } else { /* * Minuend used up: add any remaining piece before advancing. */ if (r1->x2 > x1) { MEMCHECK(pReg, pNextRect, pReg->rects); pNextRect->x1 = x1; pNextRect->y1 = y1; pNextRect->x2 = r1->x2; pNextRect->y2 = y2; pReg->numRects += 1; pNextRect++; assert(pReg->numRects<=pReg->size); } r1++; if (r1 != r1End) x1 = r1->x1; } } /* * Add remaining minuend rectangles to region. */ while (r1 != r1End) { assert(x1x2); MEMCHECK(pReg, pNextRect, pReg->rects); pNextRect->x1 = x1; pNextRect->y1 = y1; pNextRect->x2 = r1->x2; pNextRect->y2 = y2; pReg->numRects += 1; pNextRect++; assert(pReg->numRects<=pReg->size); r1++; if (r1 != r1End) { x1 = r1->x1; } } return 0; /* lint */ } /*- *----------------------------------------------------------------------- * miSubtract -- * Subtract regS from regM and leave the result in regD. * S stands for subtrahend, M for minuend and D for difference. * * Results: * TRUE. * * Side Effects: * regD is overwritten. * *----------------------------------------------------------------------- */ int XSubtractRegion( Region regM, Region regS, register Region regD) { /* check for trivial reject */ if ( (!(regM->numRects)) || (!(regS->numRects)) || (!EXTENTCHECK(®M->extents, ®S->extents)) ) { return miRegionCopy(regD, regM); } miRegionOp (regD, regM, regS, miSubtractO, miSubtractNonO1, NULL); /* * Can't alter newReg's extents before we call miRegionOp because * it might be one of the source regions and miRegionOp depends * on the extents of those regions being the unaltered. Besides, this * way there's no checking against rectangles that will be nuked * due to coalescing, so we have to examine fewer rectangles. */ miSetExtents (regD); return 1; } int XXorRegion(Region sra, Region srb, Region dr) { Region tra, trb; if (! (tra = XCreateRegion()) ) return 0; if (! (trb = XCreateRegion()) ) { XDestroyRegion(tra); return 0; } (void) XSubtractRegion(sra,srb,tra); (void) XSubtractRegion(srb,sra,trb); (void) XUnionRegion(tra,trb,dr); XDestroyRegion(tra); XDestroyRegion(trb); return 0; } /* * Check to see if the region is empty. Assumes a region is passed * as a parameter */ int XEmptyRegion( Region r) { if( r->numRects == 0 ) return TRUE; else return FALSE; } /* * Check to see if two regions are equal */ int XEqualRegion(Region r1, Region r2) { int i; if( r1->numRects != r2->numRects ) return FALSE; else if( r1->numRects == 0 ) return TRUE; else if ( r1->extents.x1 != r2->extents.x1 ) return FALSE; else if ( r1->extents.x2 != r2->extents.x2 ) return FALSE; else if ( r1->extents.y1 != r2->extents.y1 ) return FALSE; else if ( r1->extents.y2 != r2->extents.y2 ) return FALSE; else for( i=0; i < r1->numRects; i++ ) { if ( r1->rects[i].x1 != r2->rects[i].x1 ) return FALSE; else if ( r1->rects[i].x2 != r2->rects[i].x2 ) return FALSE; else if ( r1->rects[i].y1 != r2->rects[i].y1 ) return FALSE; else if ( r1->rects[i].y2 != r2->rects[i].y2 ) return FALSE; } return TRUE; } int XPointInRegion( Region pRegion, int x, int y) { int i; if (pRegion->numRects == 0) return FALSE; if (!INBOX(pRegion->extents, x, y)) return FALSE; for (i=0; inumRects; i++) { if (INBOX (pRegion->rects[i], x, y)) return TRUE; } return FALSE; } int XRectInRegion( register Region region, int rx, int ry, unsigned int rwidth, unsigned int rheight) { register BoxPtr pbox; register BoxPtr pboxEnd; Box rect; register BoxPtr prect = ▭ int partIn, partOut; prect->x1 = rx; prect->y1 = ry; prect->x2 = rwidth + rx; prect->y2 = rheight + ry; /* this is (just) a useful optimization */ if ((region->numRects == 0) || !EXTENTCHECK(®ion->extents, prect)) return(RectangleOut); partOut = FALSE; partIn = FALSE; /* can stop when both partOut and partIn are TRUE, or we reach prect->y2 */ for (pbox = region->rects, pboxEnd = pbox + region->numRects; pbox < pboxEnd; pbox++) { if (pbox->y2 <= ry) continue; /* getting up to speed or skipping remainder of band */ if (pbox->y1 > ry) { partOut = TRUE; /* missed part of rectangle above */ if (partIn || (pbox->y1 >= prect->y2)) break; ry = pbox->y1; /* x guaranteed to be == prect->x1 */ } if (pbox->x2 <= rx) continue; /* not far enough over yet */ if (pbox->x1 > rx) { partOut = TRUE; /* missed part of rectangle to left */ if (partIn) break; } if (pbox->x1 < prect->x2) { partIn = TRUE; /* definitely overlap */ if (partOut) break; } if (pbox->x2 >= prect->x2) { ry = pbox->y2; /* finished with this band */ if (ry >= prect->y2) break; rx = prect->x1; /* reset x out to left again */ } else { /* * Because boxes in a band are maximal width, if the first box * to overlap the rectangle doesn't completely cover it in that * band, the rectangle must be partially out, since some of it * will be uncovered in that band. partIn will have been set true * by now... */ break; } } return(partIn ? ((ry < prect->y2) ? RectanglePart : RectangleIn) : RectangleOut); } nx-libs-3.5.99.23/nx-X11/lib/src/RegstFlt.c0000644000000000000000000001073113614532331014540 0ustar /* * Copyright 1990, 1991 by OMRON Corporation * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name OMRON not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. OMRON makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * Author: Seiji Kuwari OMRON Corporation * kuwa@omron.co.jp * kuwa%omron.co.jp@uunet.uu.net */ /* Copyright 1990, 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" static void _XFreeIMFilters( Display *display) { register XFilterEventList fl; while ((fl = display->im_filters)) { display->im_filters = fl->next; Xfree(fl); } } /* * Register a filter with the filter machinery by event mask. */ void _XRegisterFilterByMask( Display *display, Window window, unsigned long event_mask, Bool (*filter)( Display*, Window, XEvent*, XPointer ), XPointer client_data) { XFilterEventRec *rec; rec = Xmalloc(sizeof(XFilterEventRec)); if (!rec) return; rec->window = window; rec->event_mask = event_mask; rec->start_type = 0; rec->end_type = 0; rec->filter = filter; rec->client_data = client_data; LockDisplay(display); rec->next = display->im_filters; display->im_filters = rec; display->free_funcs->im_filters = _XFreeIMFilters; UnlockDisplay(display); } /* * Register a filter with the filter machinery by type code. */ void _XRegisterFilterByType( Display *display, Window window, int start_type, int end_type, Bool (*filter)( Display*, Window, XEvent*, XPointer ), XPointer client_data) { XFilterEventRec *rec; rec = Xmalloc(sizeof(XFilterEventRec)); if (!rec) return; rec->window = window; rec->event_mask = 0; rec->start_type = start_type; rec->end_type = end_type; rec->filter = filter; rec->client_data = client_data; LockDisplay(display); rec->next = display->im_filters; display->im_filters = rec; display->free_funcs->im_filters = _XFreeIMFilters; UnlockDisplay(display); } void _XUnregisterFilter( Display *display, Window window, Bool (*filter)( Display*, Window, XEvent*, XPointer ), XPointer client_data) { register XFilterEventList *prev, fl; for (prev = &display->im_filters; (fl = *prev); ) { if (fl->window == window && fl->filter == filter && fl->client_data == client_data) { *prev = fl->next; Xfree(fl); } else prev = &fl->next; } } nx-libs-3.5.99.23/nx-X11/lib/src/RepWindow.c0000644000000000000000000000300613614532331014721 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XReparentWindow( register Display *dpy, Window w, Window p, int x, int y) { register xReparentWindowReq *req; LockDisplay(dpy); GetReq(ReparentWindow, req); req->window = w; req->parent = p; req->x = x; req->y = y; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/RestackWs.c0000644000000000000000000000330713614532331014715 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XRestackWindows ( register Display *dpy, register Window *windows, int n) { int i = 0; LockDisplay(dpy); while (windows++, ++i < n) { register xConfigureWindowReq *req; GetReqExtra (ConfigureWindow, 8, req); req->window = *windows; req->mask = CWSibling | CWStackMode; { register CARD32 *values = (CARD32 *) NEXTPTR(req,xConfigureWindowReq); *values++ = *(windows-1); *values = Below; } } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/RotProp.c0000644000000000000000000000335013614532331014412 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XRotateWindowProperties( register Display *dpy, Window w, Atom *properties, register int nprops, int npositions) { register long nbytes; register xRotatePropertiesReq *req; LockDisplay(dpy); GetReq (RotateProperties, req); req->window = w; req->nAtoms = nprops; req->nPositions = npositions; req->length += nprops; nbytes = nprops << 2; /* XXX Cray needs packing here.... */ Data32 (dpy, (long *) properties, nbytes); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/ScrResStr.c0000644000000000000000000000347313614532331014705 0ustar /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include char *XScreenResourceString(Screen *screen) { Atom prop_name; Atom actual_type; int actual_format; unsigned long nitems; unsigned long leftover; char *val = NULL; prop_name = XInternAtom(screen->display, "SCREEN_RESOURCES", True); if (prop_name && XGetWindowProperty(screen->display, screen->root, prop_name, 0L, 100000000L, False, XA_STRING, &actual_type, &actual_format, &nitems, &leftover, (unsigned char **) &val) == Success) { if ((actual_type == XA_STRING) && (actual_format == 8)) return val; Xfree(val); } return (char *)NULL; } nx-libs-3.5.99.23/nx-X11/lib/src/SelInput.c0000644000000000000000000000307513614532331014554 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSelectInput ( register Display *dpy, Window w, long mask) { register xChangeWindowAttributesReq *req; LockDisplay(dpy); GetReqExtra (ChangeWindowAttributes, 4, req); req->window = w; req->valueMask = CWEventMask; OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), mask); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SendEvent.c0000644000000000000000000000434013614532331014700 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* * In order to avoid all images requiring _XEventToWire, we install the * event converter here if it has never been installed. */ Status XSendEvent( register Display *dpy, Window w, Bool propagate, long event_mask, XEvent *event) { register xSendEventReq *req; xEvent ev; register Status (**fp)( Display * /* dpy */, XEvent * /* re */, xEvent * /* event */); Status status; /* initialize all of the event's fields first, before setting * the meaningful ones later. */ memset (&ev, 0, sizeof (ev)); LockDisplay (dpy); /* call through display to find proper conversion routine */ fp = &dpy->wire_vec[event->type & 0177]; if (*fp == NULL) *fp = _XEventToWire; status = (**fp)(dpy, event, &ev); if (status) { GetReq(SendEvent, req); req->destination = w; req->propagate = propagate; req->eventMask = event_mask; req->event = ev; } UnlockDisplay(dpy); SyncHandle(); return(status); } nx-libs-3.5.99.23/nx-X11/lib/src/SetBack.c0000644000000000000000000000275513614532331014331 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetBackground ( register Display *dpy, GC gc, unsigned long background) /* CARD32 */ { LockDisplay(dpy); if (gc->values.background != background) { gc->values.background = background; gc->dirty |= GCBackground; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetClMask.c0000644000000000000000000000302013614532331014625 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetClipMask ( register Display *dpy, GC gc, Pixmap mask) { LockDisplay(dpy); /* always update, since client may have changed pixmap contents */ gc->values.clip_mask = mask; gc->dirty |= GCClipMask; gc->rects = 0; _XFlushGCCache(dpy, gc); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetClOrig.c0000644000000000000000000000314413614532331014641 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetClipOrigin ( register Display *dpy, GC gc, int xorig, int yorig) { XGCValues *gv = &gc->values; LockDisplay(dpy); if (xorig != gv->clip_x_origin) { gv->clip_x_origin = xorig; gc->dirty |= GCClipXOrigin; } if (yorig != gv->clip_y_origin) { gv->clip_y_origin = yorig; gc->dirty |= GCClipYOrigin; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetCRects.c0000644000000000000000000000501013614532331014637 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* can only call when display is locked. */ void _XSetClipRectangles ( register Display *dpy, GC gc, int clip_x_origin, int clip_y_origin, XRectangle *rectangles, int n, int ordering) { register xSetClipRectanglesReq *req; register long len; unsigned long dirty; register _XExtension *ext; GetReq (SetClipRectangles, req); req->gc = gc->gid; req->xOrigin = gc->values.clip_x_origin = clip_x_origin; req->yOrigin = gc->values.clip_y_origin = clip_y_origin; req->ordering = ordering; len = ((long)n) << 1; SetReqLen(req, len, 1); len <<= 2; Data16 (dpy, (short *) rectangles, len); gc->rects = 1; dirty = gc->dirty & ~(GCClipMask | GCClipXOrigin | GCClipYOrigin); gc->dirty = GCClipMask | GCClipXOrigin | GCClipYOrigin; /* call out to any extensions interested */ for (ext = dpy->ext_procs; ext; ext = ext->next) if (ext->flush_GC) (*ext->flush_GC)(dpy, gc, &ext->codes); gc->dirty = dirty; } int XSetClipRectangles ( register Display *dpy, GC gc, int clip_x_origin, int clip_y_origin, XRectangle *rectangles, int n, int ordering) { LockDisplay(dpy); _XSetClipRectangles (dpy, gc, clip_x_origin, clip_y_origin, rectangles, n, ordering); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetDashes.c0000644000000000000000000000325713614532331014676 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetDashes ( register Display *dpy, GC gc, int dash_offset, _Xconst char *list, int n) { register xSetDashesReq *req; LockDisplay(dpy); GetReq (SetDashes,req); req->gc = gc->gid; req->dashOffset = gc->values.dash_offset = dash_offset; req->nDashes = n; req->length += (n+3)>>2; gc->dashes = 1; gc->dirty &= ~(GCDashList | GCDashOffset); Data (dpy, list, (long)n); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetFont.c0000644000000000000000000000271613614532331014374 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetFont ( register Display *dpy, GC gc, Font font) { LockDisplay(dpy); if (gc->values.font != font) { gc->values.font = font; gc->dirty |= GCFont; _XFlushGCCache(dpy, gc); } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetFore.c0000644000000000000000000000275513614532331014364 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetForeground ( register Display *dpy, GC gc, unsigned long foreground) /* CARD32 */ { LockDisplay(dpy); if (gc->values.foreground != foreground) { gc->values.foreground = foreground; gc->dirty |= GCForeground; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetFPath.c0000644000000000000000000000403413614532331014463 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #define safestrlen(s) ((s) ? strlen(s) : 0) int XSetFontPath ( register Display *dpy, char **directories, int ndirs) { register int n = 0; register int i; register int nbytes; char *p; register xSetFontPathReq *req; int retCode; LockDisplay(dpy); GetReq (SetFontPath, req); req->nFonts = ndirs; for (i = 0; i < ndirs; i++) { n += safestrlen (directories[i]) + 1; } nbytes = (n + 3) & ~3; req->length += nbytes >> 2; if ((p = Xmalloc (nbytes))) { /* * pack into counted strings. */ char *tmp = p; for (i = 0; i < ndirs; i++) { register int length = safestrlen (directories[i]); *p = length; memcpy (p + 1, directories[i], length); p += length + 1; } Data (dpy, tmp, nbytes); Xfree (tmp); retCode = 1; } else retCode = 0; UnlockDisplay(dpy); SyncHandle(); return (retCode); } nx-libs-3.5.99.23/nx-X11/lib/src/SetFunc.c0000644000000000000000000000271013614532331014353 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetFunction ( register Display *dpy, GC gc, int function) { LockDisplay(dpy); if (gc->values.function != function) { gc->values.function = function; gc->dirty |= GCFunction; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetHints.c0000644000000000000000000002135713614532331014555 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Xatomtype.h" #include #include #define safestrlen(s) ((s) ? strlen(s) : 0) int XSetSizeHints( /* old routine */ Display *dpy, Window w, XSizeHints *hints, Atom property) { xPropSizeHints prop; memset(&prop, 0, sizeof(prop)); prop.flags = (hints->flags & (USPosition|USSize|PAllHints)); if (hints->flags & (USPosition|PPosition)) { prop.x = hints->x; prop.y = hints->y; } if (hints->flags & (USSize|PSize)) { prop.width = hints->width; prop.height = hints->height; } if (hints->flags & PMinSize) { prop.minWidth = hints->min_width; prop.minHeight = hints->min_height; } if (hints->flags & PMaxSize) { prop.maxWidth = hints->max_width; prop.maxHeight = hints->max_height; } if (hints->flags & PResizeInc) { prop.widthInc = hints->width_inc; prop.heightInc = hints->height_inc; } if (hints->flags & PAspect) { prop.minAspectX = hints->min_aspect.x; prop.minAspectY = hints->min_aspect.y; prop.maxAspectX = hints->max_aspect.x; prop.maxAspectY = hints->max_aspect.y; } return XChangeProperty (dpy, w, property, XA_WM_SIZE_HINTS, 32, PropModeReplace, (unsigned char *) &prop, OldNumPropSizeElements); } /* * XSetWMHints sets the property * WM_HINTS type: WM_HINTS format:32 */ int XSetWMHints ( Display *dpy, Window w, XWMHints *wmhints) { xPropWMHints prop; memset(&prop, 0, sizeof(prop)); prop.flags = wmhints->flags; if (wmhints->flags & InputHint) prop.input = (wmhints->input == True ? 1 : 0); if (wmhints->flags & StateHint) prop.initialState = wmhints->initial_state; if (wmhints->flags & IconPixmapHint) prop.iconPixmap = wmhints->icon_pixmap; if (wmhints->flags & IconWindowHint) prop.iconWindow = wmhints->icon_window; if (wmhints->flags & IconPositionHint) { prop.iconX = wmhints->icon_x; prop.iconY = wmhints->icon_y; } if (wmhints->flags & IconMaskHint) prop.iconMask = wmhints->icon_mask; if (wmhints->flags & WindowGroupHint) prop.windowGroup = wmhints->window_group; return XChangeProperty (dpy, w, XA_WM_HINTS, XA_WM_HINTS, 32, PropModeReplace, (unsigned char *) &prop, NumPropWMHintsElements); } /* * XSetZoomHints sets the property * WM_ZOOM_HINTS type: WM_SIZE_HINTS format: 32 */ int XSetZoomHints ( Display *dpy, Window w, XSizeHints *zhints) { return XSetSizeHints (dpy, w, zhints, XA_WM_ZOOM_HINTS); } /* * XSetNormalHints sets the property * WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32 */ int XSetNormalHints ( /* old routine */ Display *dpy, Window w, XSizeHints *hints) { return XSetSizeHints (dpy, w, hints, XA_WM_NORMAL_HINTS); } /* * Note, the following is one of the few cases were we really do want sizeof * when examining a protocol structure. This is because the XChangeProperty * routine will take care of converting to host to network data structures. */ int XSetIconSizes ( Display *dpy, Window w, /* typically, root */ XIconSize *list, int count) /* number of items on the list */ { register int i; xPropIconSize *pp, *prop; #define size_of_the_real_thing sizeof /* avoid grepping screwups */ unsigned nbytes = count * size_of_the_real_thing(xPropIconSize); #undef size_of_the_real_thing if ((prop = pp = Xmalloc (nbytes))) { for (i = 0; i < count; i++) { pp->minWidth = list->min_width; pp->minHeight = list->min_height; pp->maxWidth = list->max_width; pp->maxHeight = list->max_height; pp->widthInc = list->width_inc; pp->heightInc = list->height_inc; pp += 1; list += 1; } XChangeProperty (dpy, w, XA_WM_ICON_SIZE, XA_WM_ICON_SIZE, 32, PropModeReplace, (unsigned char *) prop, count * NumPropIconSizeElements); Xfree (prop); } return 1; } int XSetCommand ( Display *dpy, Window w, char **argv, int argc) { register int i; size_t nbytes; register char *buf, *bp; for (i = 0, nbytes = 0; i < argc; i++) { nbytes += safestrlen(argv[i]) + 1; } if ((bp = buf = Xmalloc(nbytes))) { /* copy arguments into single buffer */ for (i = 0; i < argc; i++) { if (argv[i]) { (void) strcpy(bp, argv[i]); bp += strlen(argv[i]) + 1; } else *bp++ = '\0'; } XChangeProperty (dpy, w, XA_WM_COMMAND, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, nbytes); Xfree(buf); } return 1; } /* * XSetStandardProperties sets the following properties: * WM_NAME type: STRING format: 8 * WM_ICON_NAME type: STRING format: 8 * WM_HINTS type: WM_HINTS format: 32 * WM_COMMAND type: STRING * WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32 */ int XSetStandardProperties ( Display *dpy, Window w, /* window to decorate */ _Xconst char *name, /* name of application */ _Xconst char *icon_string,/* name string for icon */ Pixmap icon_pixmap, /* pixmap to use as icon, or None */ char **argv, /* command to be used to restart application */ int argc, /* count of arguments */ XSizeHints *hints) /* size hints for window in its normal state */ { XWMHints phints; phints.flags = 0; if (name != NULL) XStoreName (dpy, w, name); if (icon_string != NULL) { XChangeProperty (dpy, w, XA_WM_ICON_NAME, XA_STRING, 8, PropModeReplace, (_Xconst unsigned char *)icon_string, safestrlen(icon_string)); } if (icon_pixmap != None) { phints.icon_pixmap = icon_pixmap; phints.flags |= IconPixmapHint; } if (argv != NULL) XSetCommand(dpy, w, argv, argc); if (hints != NULL) XSetNormalHints(dpy, w, hints); if (phints.flags != 0) XSetWMHints(dpy, w, &phints); return 1; } int XSetTransientForHint( Display *dpy, Window w, Window propWindow) { return XChangeProperty(dpy, w, XA_WM_TRANSIENT_FOR, XA_WINDOW, 32, PropModeReplace, (unsigned char *) &propWindow, 1); } int XSetClassHint( Display *dpy, Window w, XClassHint *classhint) { char *class_string; char *s; size_t len_nm, len_cl; len_nm = safestrlen(classhint->res_name); len_cl = safestrlen(classhint->res_class); if ((class_string = s = Xmalloc(len_nm + len_cl + 2))) { if (len_nm) { strcpy(s, classhint->res_name); s += len_nm + 1; } else *s++ = '\0'; if (len_cl) strcpy(s, classhint->res_class); else *s = '\0'; XChangeProperty(dpy, w, XA_WM_CLASS, XA_STRING, 8, PropModeReplace, (unsigned char *) class_string, len_nm+len_cl+2); Xfree(class_string); } return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetIFocus.c0000644000000000000000000000301013614532331014642 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetInputFocus( register Display *dpy, Window focus, int revert_to, Time time) { register xSetInputFocusReq *req; LockDisplay(dpy); GetReq(SetInputFocus, req); req->focus = focus; req->revertTo = revert_to; req->time = time; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetLocale.c0000644000000000000000000001331313614532331014660 0ustar /* * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation, * and Nippon Telegraph and Telephone Corporation * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of OMRON, NTT Software, and NTT * not be used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. OMRON, NTT Software, * and NTT make no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * OMRON, NTT SOFTWARE, AND NTT, DISCLAIM ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL OMRON, NTT SOFTWARE, OR NTT, BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Authors: Li Yuhong OMRON Corporation * Tetsuya Kato NTT Software Corporation * Hiroshi Kuribayashi OMRON Corporation * */ /* Copyright 1987,1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" #include #include #include "XlcPubI.h" #define MAXLOCALE 64 /* buffer size of locale name */ #if defined(__DARWIN__) || defined(__APPLE__) || defined(__CYGWIN__) char * _Xsetlocale( int category, _Xconst char *name ) { return setlocale(category, name); } #endif /* __DARWIN__ || __APPLE__ || __CYGWIN__ */ /* * _XlcMapOSLocaleName is an implementation dependent routine that derives * the LC_CTYPE locale name as used in the sample implementation from that * returned by setlocale. * * Should match the code in Xt ExtractLocaleName. * * This function name is a bit of a misnomer. Even the siname parameter * name is a misnomer. On most modern operating systems this function is * a no-op, simply returning the osname; but on older operating systems * like Ultrix, or HPUX 9.x and earlier, when you set LANG=german.88591 * then the string returned by setlocale(LC_ALL, "") will look something * like: "german.88591 german.88591 ... german.88591". Then this function * will pick out the LC_CTYPE component and return a pointer to that. */ char * _XlcMapOSLocaleName( char *osname, char *siname) { /* FIXME: correct indentation levels after ancient platform clean-up */ #if defined(CSRG_BASED) || defined(sun) || defined(SVR4) || defined(ultrix) || defined(WIN32) || defined(linux) # ifdef ultrix # define SKIPCOUNT 2 # define STARTCHAR '\001' # define ENDCHAR '\001' # else # if defined(WIN32) # define SKIPCOUNT 1 # define STARTCHAR '=' # define ENDCHAR ';' # define WHITEFILL # else # if defined(linux) # define STARTSTR "LC_CTYPE=" # define ENDCHAR ';' # else # if !defined(sun) || defined(SVR4) # define STARTCHAR '/' # define ENDCHAR '/' # endif # endif # endif # endif char *start; char *end; int len; # ifdef SKIPCOUNT int n; # endif start = osname; # ifdef SKIPCOUNT for (n = SKIPCOUNT; --n >= 0 && start && (start = strchr (start, STARTCHAR)); start++) ; if (!start) start = osname; # endif # ifdef STARTCHAR if (start && (start = strchr (start, STARTCHAR))) # elif defined (STARTSTR) if (start && (start = strstr (start,STARTSTR))) # endif { # ifdef STARTCHAR start++; # elif defined (STARTSTR) start += strlen(STARTSTR); # endif if ((end = strchr (start, ENDCHAR))) { len = end - start; if (len >= MAXLOCALE) len = MAXLOCALE - 1; strncpy(siname, start, len); *(siname + len) = '\0'; # ifdef WHITEFILL for (start = siname; start = strchr(start, ' '); ) *start++ = '-'; # endif return siname; } else /* if no ENDCHAR is found we are at the end of the line */ return start; } # ifdef WHITEFILL if (strchr(osname, ' ')) { len = strlen(osname); if (len >= MAXLOCALE - 1) len = MAXLOCALE - 1; strncpy(siname, osname, len); *(siname + len) = '\0'; for (start = siname; start = strchr(start, ' '); ) *start++ = '-'; return siname; } # endif # undef STARTCHAR # undef ENDCHAR # undef WHITEFILL #endif return osname; } nx-libs-3.5.99.23/nx-X11/lib/src/SetLStyle.c0000644000000000000000000000354113614532331014677 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetLineAttributes( register Display *dpy, GC gc, unsigned int linewidth, /* CARD16 */ int linestyle, int capstyle, int joinstyle) { XGCValues *gv = &gc->values; LockDisplay(dpy); if (linewidth != gv->line_width) { gv->line_width = linewidth; gc->dirty |= GCLineWidth; } if (linestyle != gv->line_style) { gv->line_style = linestyle; gc->dirty |= GCLineStyle; } if (capstyle != gv->cap_style) { gv->cap_style = capstyle; gc->dirty |= GCCapStyle; } if (joinstyle != gv->join_style) { gv->join_style = joinstyle; gc->dirty |= GCJoinStyle; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetNrmHint.c0000644000000000000000000001016313614532331015040 0ustar /*********************************************************** Copyright 1988 by Wyse Technology, Inc., San Jose, Ca, Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL AND WYSE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL OR WYSE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* Copyright 1987, 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Xatomtype.h" #include #include void XSetWMSizeHints ( Display *dpy, Window w, XSizeHints *hints, Atom prop) { xPropSizeHints data; memset(&data, 0, sizeof(data)); data.flags = (hints->flags & (USPosition|USSize|PPosition|PSize|PMinSize|PMaxSize| PResizeInc|PAspect|PBaseSize|PWinGravity)); /* * The x, y, width, and height fields are obsolete; but, applications * that want to work with old window managers might set them. */ if (hints->flags & (USPosition|PPosition)) { data.x = hints->x; data.y = hints->y; } if (hints->flags & (USSize|PSize)) { data.width = hints->width; data.height = hints->height; } if (hints->flags & PMinSize) { data.minWidth = hints->min_width; data.minHeight = hints->min_height; } if (hints->flags & PMaxSize) { data.maxWidth = hints->max_width; data.maxHeight = hints->max_height; } if (hints->flags & PResizeInc) { data.widthInc = hints->width_inc; data.heightInc = hints->height_inc; } if (hints->flags & PAspect) { data.minAspectX = hints->min_aspect.x; data.minAspectY = hints->min_aspect.y; data.maxAspectX = hints->max_aspect.x; data.maxAspectY = hints->max_aspect.y; } if (hints->flags & PBaseSize) { data.baseWidth = hints->base_width; data.baseHeight = hints->base_height; } if (hints->flags & PWinGravity) { data.winGravity = hints->win_gravity; } XChangeProperty (dpy, w, prop, XA_WM_SIZE_HINTS, 32, PropModeReplace, (unsigned char *) &data, NumPropSizeElements); } void XSetWMNormalHints ( Display *dpy, Window w, XSizeHints *hints) { XSetWMSizeHints (dpy, w, hints, XA_WM_NORMAL_HINTS); } nx-libs-3.5.99.23/nx-X11/lib/src/SetPMask.c0000644000000000000000000000275013614532331014477 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetPlaneMask ( register Display *dpy, GC gc, unsigned long planemask) /* CARD32 */ { LockDisplay(dpy); if (gc->values.plane_mask != planemask) { gc->values.plane_mask = planemask; gc->dirty |= GCPlaneMask; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetPntMap.c0000644000000000000000000000455113614532331014664 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* returns either DeviceMappingSuccess or DeviceMappingBusy */ int XSetPointerMapping ( register Display *dpy, _Xconst unsigned char *map, int nmaps) { register xSetPointerMappingReq *req; xSetPointerMappingReply rep; LockDisplay(dpy); GetReq (SetPointerMapping, req); req->nElts = nmaps; req->length += (nmaps + 3)>>2; Data (dpy, (_Xconst char *)map, (long) nmaps); if (_XReply (dpy, (xReply *)&rep, 0, xFalse) == 0) rep.success = MappingSuccess; UnlockDisplay(dpy); SyncHandle(); return ((int) rep.success); } int XChangeKeyboardMapping ( register Display *dpy, int first_keycode, int keysyms_per_keycode, KeySym *keysyms, int nkeycodes) { register long nbytes; register xChangeKeyboardMappingReq *req; LockDisplay(dpy); GetReq (ChangeKeyboardMapping, req); req->firstKeyCode = first_keycode; req->keyCodes = nkeycodes; req->keySymsPerKeyCode = keysyms_per_keycode; req->length += nkeycodes * keysyms_per_keycode; nbytes = keysyms_per_keycode * nkeycodes * 4; Data32 (dpy, (long *)keysyms, nbytes); UnlockDisplay(dpy); SyncHandle(); return 0; } nx-libs-3.5.99.23/nx-X11/lib/src/SetRGBCMap.c0000644000000000000000000000612513614532331014637 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Xatomtype.h" #include void XSetRGBColormaps ( Display *dpy, Window w, XStandardColormap *cmaps, int count, Atom property) /* XA_RGB_BEST_MAP, etc. */ { register int i; /* iterator variable */ register xPropStandardColormap *map; /* tmp variable, data in prop */ register XStandardColormap *cmap; /* tmp variable, user data */ xPropStandardColormap *data, tmpdata; /* scratch data */ int mode = PropModeReplace; /* for partial writes */ Bool alloced_scratch_space; /* do we need to free? */ if (count < 1) return; /* * if doing more than one, allocate scratch space for it */ if ((count > 1) && ((data = ((xPropStandardColormap *) Xmalloc(count*sizeof(xPropStandardColormap)))) != NULL)) { alloced_scratch_space = True; } else { data = &tmpdata; alloced_scratch_space = False; } /* * Do the iteration. If using temp space put out each part of the prop; * otherwise, wait until the end and blast it all at once. */ for (i = count, map = data, cmap = cmaps; i > 0; i--, cmap++) { map->colormap = cmap->colormap; map->red_max = cmap->red_max; map->red_mult = cmap->red_mult; map->green_max = cmap->green_max; map->green_mult = cmap->green_mult; map->blue_max = cmap->blue_max; map->blue_mult = cmap->blue_mult; map->base_pixel = cmap->base_pixel; map->visualid = cmap->visualid; map->killid = cmap->killid; if (alloced_scratch_space) { map++; } else { XChangeProperty (dpy, w, property, XA_RGB_COLOR_MAP, 32, mode, (unsigned char *) data, NumPropStandardColormapElements); mode = PropModeAppend; } } if (alloced_scratch_space) { XChangeProperty (dpy, w, property, XA_RGB_COLOR_MAP, 32, PropModeReplace, (unsigned char *) data, (int) (count * NumPropStandardColormapElements)); Xfree (data); } } nx-libs-3.5.99.23/nx-X11/lib/src/SetSOwner.c0000644000000000000000000000302513614532331014675 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetSelectionOwner( register Display *dpy, Atom selection, Window owner, Time time) { register xSetSelectionOwnerReq *req; LockDisplay(dpy); GetReq(SetSelectionOwner,req); req->selection = selection; req->window = owner; req->time = time; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetSSaver.c0000644000000000000000000000313013614532331014660 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetScreenSaver( register Display *dpy, int timeout, int interval, int prefer_blank, int allow_exp) { register xSetScreenSaverReq *req; LockDisplay(dpy); GetReq(SetScreenSaver, req); req->timeout = timeout; req->interval = interval; req->preferBlank = prefer_blank; req->allowExpose = allow_exp; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetState.c0000644000000000000000000000354713614532331014551 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetState( register Display *dpy, GC gc, unsigned long foreground, unsigned long background, int function, unsigned long planemask) { XGCValues *gv = &gc->values; LockDisplay(dpy); if (function != gv->function) { gv->function = function; gc->dirty |= GCFunction; } if (planemask != gv->plane_mask) { gv->plane_mask = planemask; gc->dirty |= GCPlaneMask; } if (foreground != gv->foreground) { gv->foreground = foreground; gc->dirty |= GCForeground; } if (background != gv->background) { gv->background = background; gc->dirty |= GCBackground; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetStCmap.c0000644000000000000000000000653613614532331014661 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Xatomtype.h" #include /* * WARNING * * This is a pre-ICCCM routine. It must not reference any of the new fields * in the XStandardColormap structure. */ void XSetStandardColormap( Display *dpy, Window w, XStandardColormap *cmap, Atom property) /* XA_RGB_BEST_MAP, etc. */ { Screen *sp; XStandardColormap stdcmap; sp = _XScreenOfWindow (dpy, w); if (!sp) { /* already caught the XGetGeometry error in _XScreenOfWindow */ return; } stdcmap.colormap = cmap->colormap; stdcmap.red_max = cmap->red_max; stdcmap.red_mult = cmap->red_mult; stdcmap.green_max = cmap->green_max; stdcmap.green_mult = cmap->green_mult; stdcmap.blue_max = cmap->blue_max; stdcmap.blue_mult = cmap->blue_mult; stdcmap.base_pixel = cmap->base_pixel; stdcmap.visualid = sp->root_visual->visualid; stdcmap.killid = None; /* don't know how to kill this one */ #ifdef XCMS XSetRGBColormaps (dpy, w, &stdcmap, 1, property); #endif return; } nx-libs-3.5.99.23/nx-X11/lib/src/SetStip.c0000644000000000000000000000277713614532331014414 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetStipple ( register Display *dpy, GC gc, Pixmap stipple) { LockDisplay(dpy); /* always update, since client may have changed pixmap contents */ gc->values.stipple = stipple; gc->dirty |= GCStipple; _XFlushGCCache(dpy, gc); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetTile.c0000644000000000000000000000276013614532331014362 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetTile ( register Display *dpy, GC gc, Pixmap tile) { LockDisplay(dpy); /* always update, since client may have changed pixmap contents */ gc->values.tile = tile; gc->dirty |= GCTile; _XFlushGCCache(dpy, gc); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetTSOrig.c0000644000000000000000000000307413614532331014633 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XSetTSOrigin ( register Display *dpy, GC gc, int x, int y) { XGCValues *gv = &gc->values; LockDisplay(dpy); if (x != gv->ts_x_origin) { gv->ts_x_origin = x; gc->dirty |= GCTileStipXOrigin; } if (y != gv->ts_y_origin) { gv->ts_y_origin = y; gc->dirty |= GCTileStipYOrigin; } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/SetTxtProp.c0000644000000000000000000000575013614532331015107 0ustar /*********************************************************** Copyright 1988 by Wyse Technology, Inc., San Jose, Ca. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Wyse not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include void XSetTextProperty ( Display *dpy, Window w, XTextProperty *tp, Atom property) { XChangeProperty (dpy, w, property, tp->encoding, tp->format, PropModeReplace, tp->value, tp->nitems); } void XSetWMName ( Display *dpy, Window w, XTextProperty *tp) { XSetTextProperty (dpy, w, tp, XA_WM_NAME); } void XSetWMIconName ( Display *dpy, Window w, XTextProperty *tp) { XSetTextProperty (dpy, w, tp, XA_WM_ICON_NAME); } void XSetWMClientMachine ( Display *dpy, Window w, XTextProperty *tp) { XSetTextProperty (dpy, w, tp, XA_WM_CLIENT_MACHINE); } nx-libs-3.5.99.23/nx-X11/lib/src/SetWMCMapW.c0000644000000000000000000000537013614532331014700 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include /* * XSetWMProtocols sets the property * WM_COLORMAP_WINDOWS type: WINDOW format:32 */ Status XSetWMColormapWindows ( Display *dpy, Window w, Window *windows, int count) { Atom prop; prop = XInternAtom (dpy, "WM_COLORMAP_WINDOWS", False); if (prop == None) return False; XChangeProperty (dpy, w, prop, XA_WINDOW, 32, PropModeReplace, (unsigned char *) windows, count); return True; } nx-libs-3.5.99.23/nx-X11/lib/src/SetWMProto.c0000644000000000000000000000534313614532331015034 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include /* * XSetWMProtocols sets the property * WM_PROTOCOLS type: ATOM format: 32 */ Status XSetWMProtocols ( Display *dpy, Window w, Atom *protocols, int count) { Atom prop; prop = XInternAtom (dpy, "WM_PROTOCOLS", False); if (prop == None) return False; XChangeProperty (dpy, w, prop, XA_ATOM, 32, PropModeReplace, (unsigned char *) protocols, count); return True; } nx-libs-3.5.99.23/nx-X11/lib/src/StBytes.c0000644000000000000000000000565613614532331014415 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include /* insulate predefined atom numbers from cut routines */ static const Atom n_to_atom[8] = { XA_CUT_BUFFER0, XA_CUT_BUFFER1, XA_CUT_BUFFER2, XA_CUT_BUFFER3, XA_CUT_BUFFER4, XA_CUT_BUFFER5, XA_CUT_BUFFER6, XA_CUT_BUFFER7}; int XRotateBuffers ( register Display *dpy, int rotate) { /* XRotateWindowProperties wants a non-const Atom*, but it doesn't * modify it, so this is safe. */ return XRotateWindowProperties(dpy, RootWindow(dpy, 0), (Atom *)n_to_atom, 8, rotate); } char *XFetchBuffer ( register Display *dpy, int *nbytes, register int buffer) { Atom actual_type; int actual_format; unsigned long nitems; unsigned long leftover; unsigned char *data; *nbytes = 0; if ((buffer < 0) || (buffer > 7)) return (NULL); /* XXX should be (sizeof (maxint) - 1)/4 */ if (XGetWindowProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], 0L, 10000000L, False, XA_STRING, &actual_type, &actual_format, &nitems, &leftover, &data) != Success) { return (NULL); } if ( (actual_type == XA_STRING) && (actual_format != 32) ) { *nbytes = nitems; return((char *)data); } Xfree (data); return(NULL); } char *XFetchBytes ( register Display *dpy, int *nbytes) { return (XFetchBuffer (dpy, nbytes, 0)); } int XStoreBuffer ( register Display *dpy, _Xconst char *bytes, int nbytes, register int buffer) { if ((buffer < 0) || (buffer > 7)) return 0; return XChangeProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], XA_STRING, 8, PropModeReplace, (_Xconst unsigned char *) bytes, nbytes); } int XStoreBytes ( register Display *dpy, _Xconst char *bytes, int nbytes) { return XStoreBuffer (dpy, bytes, nbytes, 0); } nx-libs-3.5.99.23/nx-X11/lib/src/StColor.c0000644000000000000000000000341113614532331014370 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XStoreColor( register Display *dpy, Colormap cmap, XColor *def) { xColorItem *citem; register xStoreColorsReq *req; LockDisplay(dpy); GetReqExtra(StoreColors, SIZEOF(xColorItem), req); /* assume size is 4*n */ req->cmap = cmap; citem = (xColorItem *) NEXTPTR(req,xStoreColorsReq); citem->pixel = def->pixel; citem->red = def->red; citem->green = def->green; citem->blue = def->blue; citem->flags = def->flags; /* do_red, do_green, do_blue */ citem->pad = 0; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/StColors.c0000644000000000000000000000370613614532331014562 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XStoreColors( register Display *dpy, Colormap cmap, XColor *defs, int ncolors) { register int i; xColorItem citem; register xStoreColorsReq *req; LockDisplay(dpy); GetReq(StoreColors, req); req->cmap = cmap; req->length += (ncolors * SIZEOF(xColorItem)) >> 2; /* assume size is 4*n */ for (i = 0; i < ncolors; i++) { citem.pixel = defs[i].pixel; citem.red = defs[i].red; citem.green = defs[i].green; citem.blue = defs[i].blue; citem.flags = defs[i].flags; citem.pad = 0; /* note that xColorItem doesn't contain all 16-bit quantities, so we can't use Data16 */ Data(dpy, (char *)&citem, (long) SIZEOF(xColorItem)); /* assume size is 4*n */ } UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/StName.c0000644000000000000000000000334313614532331014176 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include int XStoreName ( register Display *dpy, Window w, _Xconst char *name) { return XChangeProperty(dpy, w, XA_WM_NAME, XA_STRING, 8, PropModeReplace, (_Xconst unsigned char *)name, name ? strlen(name) : 0); } int XSetIconName ( register Display *dpy, Window w, _Xconst char *icon_name) { return XChangeProperty(dpy, w, XA_WM_ICON_NAME, XA_STRING, 8, PropModeReplace, (_Xconst unsigned char *)icon_name, icon_name ? strlen(icon_name) : 0); } nx-libs-3.5.99.23/nx-X11/lib/src/StNColor.c0000644000000000000000000000474113614532331014515 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xcmsint.h" int XStoreNamedColor( register Display *dpy, Colormap cmap, _Xconst char *name, /* STRING8 */ unsigned long pixel, /* CARD32 */ int flags) /* DoRed, DoGreen, DoBlue */ { unsigned int nbytes; register xStoreNamedColorReq *req; XcmsCCC ccc; XcmsColor cmsColor_exact; XColor scr_def; #ifdef XCMS /* * Let's Attempt to use Xcms approach to Parse Color */ if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { if (_XcmsResolveColorString(ccc, &name, &cmsColor_exact, XcmsRGBFormat) >= XcmsSuccess) { _XcmsRGB_to_XColor(&cmsColor_exact, &scr_def, 1); scr_def.pixel = pixel; scr_def.flags = flags; return XStoreColor(dpy, cmap, &scr_def); } /* * Otherwise we failed; or name was changed with yet another * name. Thus pass name to the X Server. */ } #endif /* * The Xcms and i18n methods failed, so lets pass it to the server * for parsing. */ LockDisplay(dpy); GetReq(StoreNamedColor, req); req->cmap = cmap; req->flags = flags; req->pixel = pixel; req->nbytes = nbytes = strlen(name); req->length += (nbytes + 3) >> 2; /* round up to multiple of 4 */ Data(dpy, name, (long)nbytes); UnlockDisplay(dpy); SyncHandle(); return 0; } nx-libs-3.5.99.23/nx-X11/lib/src/StrKeysym.c0000644000000000000000000001117413614532331014762 0ustar /* Copyright 1985, 1987, 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include #include #include "Xresinternal.h" #define NEEDKTABLE #include "ks_tables.h" #include "Key.h" #ifndef KEYSYMDB #ifndef XKEYSYMDB #define KEYSYMDB "/usr/lib/X11/XKeysymDB" #else #define KEYSYMDB XKEYSYMDB #endif #endif static Bool initialized; static XrmDatabase keysymdb; static XrmQuark Qkeysym[2]; XrmDatabase _XInitKeysymDB(void) { if (!initialized) { const char *dbname; XrmInitialize(); /* use and name of this env var is not part of the standard */ /* implementation-dependent feature */ dbname = getenv("XKEYSYMDB"); if (!dbname) dbname = KEYSYMDB; keysymdb = XrmGetFileDatabase(dbname); if (keysymdb) Qkeysym[0] = XrmStringToQuark("Keysym"); initialized = True; } return keysymdb; } KeySym XStringToKeysym(_Xconst char *s) { register int i, n; int h; register Signature sig = 0; register const char *p = s; register int c; register int idx; const unsigned char *entry; unsigned char sig1, sig2; KeySym val; while ((c = *p++)) sig = (sig << 1) + c; i = sig % KTABLESIZE; h = i + 1; sig1 = (sig >> 8) & 0xff; sig2 = sig & 0xff; n = KMAXHASH; while ((idx = hashString[i])) { entry = &_XkeyTable[idx]; if ((entry[0] == sig1) && (entry[1] == sig2) && !strcmp(s, (const char *)entry + 6)) { val = (entry[2] << 24) | (entry[3] << 16) | (entry[4] << 8) | entry[5]; if (!val) val = XK_VoidSymbol; return val; } if (!--n) break; i += h; if (i >= KTABLESIZE) i -= KTABLESIZE; } if (!initialized) (void)_XInitKeysymDB(); if (keysymdb) { XrmValue result; XrmRepresentation from_type; char d; XrmQuark names[2]; names[0] = _XrmInternalStringToQuark(s, p - s - 1, sig, False); names[1] = NULLQUARK; (void)XrmQGetResource(keysymdb, names, Qkeysym, &from_type, &result); if (result.addr && (result.size > 1)) { val = 0; for (i = 0; i < result.size - 1; i++) { d = ((char *)result.addr)[i]; if ('0' <= d && d <= '9') val = (val<<4)+d-'0'; else if ('a' <= d && d <= 'f') val = (val<<4)+d-'a'+10; else if ('A' <= d && d <= 'F') val = (val<<4)+d-'A'+10; else return NoSymbol; } return val; } } if (*s == 'U') { val = 0; for (p = &s[1]; *p; p++) { c = *p; if ('0' <= c && c <= '9') val = (val<<4)+c-'0'; else if ('a' <= c && c <= 'f') val = (val<<4)+c-'a'+10; else if ('A' <= c && c <= 'F') val = (val<<4)+c-'A'+10; else return NoSymbol; if (val > 0x10ffff) return NoSymbol; } if (val < 0x20 || (val > 0x7e && val < 0xa0)) return NoSymbol; if (val < 0x100) return val; return val | 0x01000000; } if (strlen(s) > 2 && s[0] == '0' && s[1] == 'x') { char *tmp = NULL; val = strtoul(s, &tmp, 16); if (val == ULONG_MAX || (tmp && *tmp != '\0')) return NoSymbol; else return val; } /* Stupid inconsistency between the headers and XKeysymDB: the former has * no separating underscore, while some XF86* syms in the latter did. * As a last ditch effort, try without. */ if (strncmp(s, "XF86_", 5) == 0) { KeySym ret; char *tmp = strdup(s); if (!tmp) return NoSymbol; memmove(&tmp[4], &tmp[5], strlen(s) - 5 + 1); ret = XStringToKeysym(tmp); free(tmp); return ret; } return NoSymbol; } nx-libs-3.5.99.23/nx-X11/lib/src/StrToText.c0000644000000000000000000000516113614532331014727 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include /* * XStringListToTextProperty - fill in TextProperty structure with * concatenated list of null-separated strings. Return True if successful * else False. Allocate room on end for trailing NULL, but don't include in * count. */ Status XStringListToTextProperty ( char **argv, int argc, XTextProperty *textprop) { register int i; register unsigned int nbytes; XTextProperty proto; /* figure out how much space we'll need for this list */ for (i = 0, nbytes = 0; i < argc; i++) { nbytes += (unsigned) ((argv[i] ? strlen (argv[i]) : 0) + 1); } /* fill in a prototype containing results so far */ proto.encoding = XA_STRING; proto.format = 8; if (nbytes) proto.nitems = nbytes - 1; /* subtract one for trailing */ else proto.nitems = 0; proto.value = NULL; /* build concatenated list of strings */ if (nbytes > 0) { register char *buf = Xmalloc (nbytes); if (!buf) return False; proto.value = (unsigned char *) buf; for (i = 0; i < argc; i++) { char *arg = argv[i]; if (arg) { (void) strcpy (buf, arg); buf += (strlen (arg) + 1); } else { *buf++ = '\0'; } } } else { proto.value = Xmalloc (1); /* easier for client */ if (!proto.value) return False; proto.value[0] = '\0'; } /* we were successful, so set return value */ *textprop = proto; return True; } nx-libs-3.5.99.23/nx-X11/lib/src/Sync.c0000644000000000000000000000351113614532331013720 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" /* Synchronize with errors and events, optionally discarding pending events */ int XSync ( register Display *dpy, Bool discard) { xGetInputFocusReply rep; _X_UNUSED register xReq *req; LockDisplay(dpy); GetEmptyReq(GetInputFocus, req); (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); if (discard && dpy->head) { _XQEvent *qelt; for (qelt=dpy->head; qelt; qelt=qelt->next) qelt->qserial_num = 0; ((_XQEvent *)dpy->tail)->next = dpy->qfree; dpy->qfree = (_XQEvent *)dpy->head; dpy->head = dpy->tail = NULL; dpy->qlen = 0; } UnlockDisplay(dpy); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/Synchro.c0000644000000000000000000000404213614532331014431 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" static int _XSyncFunction(register Display *dpy) { XSync(dpy,0); return 0; } int (*XSynchronize(Display *dpy, int onoff))(Display *) { int (*temp)(Display *); int (*func)(Display *) = NULL; if (onoff) func = _XSyncFunction; LockDisplay(dpy); if (dpy->flags & XlibDisplayPrivSync) { temp = dpy->savedsynchandler; dpy->savedsynchandler = func; } else { temp = dpy->synchandler; dpy->synchandler = func; } UnlockDisplay(dpy); return (temp); } int (*XSetAfterFunction( Display *dpy, int (*func)( Display* ) ))(Display *) { int (*temp)(Display *); LockDisplay(dpy); if (dpy->flags & XlibDisplayPrivSync) { temp = dpy->savedsynchandler; dpy->savedsynchandler = func; } else { temp = dpy->synchandler; dpy->synchandler = func; } UnlockDisplay(dpy); return (temp); } nx-libs-3.5.99.23/nx-X11/lib/src/Text16.c0000644000000000000000000000677513614532331014116 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDrawString16( register Display *dpy, Drawable d, GC gc, int x, int y, _Xconst XChar2b *string, int length) { int Datalength = 0; register xPolyText16Req *req; if (length <= 0) return 0; LockDisplay(dpy); FlushGC(dpy, gc); GetReq (PolyText16, req); req->drawable = d; req->gc = gc->gid; req->x = x; req->y = y; Datalength += SIZEOF(xTextElt) * ((length + 253) / 254) + (length << 1); req->length += (Datalength + 3)>>2; /* convert to number of 32-bit words */ /* * If the entire request does not fit into the remaining space in the * buffer, flush the buffer first. If the request does fit into the * empty buffer, then we won't have to flush it at the end to keep * the buffer 32-bit aligned. */ if (dpy->bufptr + Datalength > dpy->bufmax) _XFlush (dpy); { int nbytes; int PartialNChars = length; register xTextElt *elt; XChar2b *CharacterOffset = (XChar2b *)string; while(PartialNChars > 254) { nbytes = 254 * 2 + SIZEOF(xTextElt); BufAlloc (xTextElt *, elt, nbytes); elt->delta = 0; elt->len = 254; memcpy (((char *) elt) + 2, (char *)CharacterOffset, 254 * 2); PartialNChars = PartialNChars - 254; CharacterOffset += 254; } if (PartialNChars) { nbytes = PartialNChars * 2 + SIZEOF(xTextElt); BufAlloc (xTextElt *, elt, nbytes); elt->delta = 0; elt->len = PartialNChars; memcpy(((char *)elt) + 2, (char *)CharacterOffset, PartialNChars * 2); } } /* Pad request out to a 32-bit boundary */ if (Datalength &= 3) { char *pad; /* * BufAlloc is a macro that uses its last argument more than * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" */ length = 4 - Datalength; BufAlloc (char *, pad, length); /* * if there are 3 bytes of padding, the first byte MUST be 0 * so the pad bytes aren't mistaken for a final xTextElt */ *pad = 0; } /* * If the buffer pointer is not now pointing to a 32-bit boundary, * we must flush the buffer so that it does point to a 32-bit boundary * at the end of this routine. */ if ((dpy->bufptr - dpy->buffer) & 3) _XFlush (dpy); UnlockDisplay(dpy); SyncHandle(); return 0; } nx-libs-3.5.99.23/nx-X11/lib/src/Text.c0000644000000000000000000000742613614532331013741 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XDrawString( register Display *dpy, Drawable d, GC gc, int x, int y, _Xconst char *string, int length) { int Datalength = 0; register xPolyText8Req *req; if (length <= 0) return 0; LockDisplay(dpy); FlushGC(dpy, gc); GetReq (PolyText8, req); req->drawable = d; req->gc = gc->gid; req->x = x; req->y = y; Datalength += SIZEOF(xTextElt) * ((length + 253) / 254) + length; req->length += (Datalength + 3)>>2; /* convert to number of 32-bit words */ /* * If the entire request does not fit into the remaining space in the * buffer, flush the buffer first. If the request does fit into the * empty buffer, then we won't have to flush it at the end to keep * the buffer 32-bit aligned. */ if (dpy->bufptr + Datalength > dpy->bufmax) _XFlush (dpy); { int nbytes; int PartialNChars = length; /* register xTextElt *elt; */ char *CharacterOffset = (char *)string; unsigned char *tbuf; while(PartialNChars > 254) { nbytes = 254 + SIZEOF(xTextElt); BufAlloc (unsigned char *, tbuf, nbytes); /* elt->delta = 0; * elt->len = 254; */ *(unsigned char *)tbuf = 254; *(tbuf+1) = 0; /* memcpy ((char *) (elt + 1), CharacterOffset, 254); */ memcpy ((char *)tbuf+2, CharacterOffset, 254); PartialNChars = PartialNChars - 254; CharacterOffset += 254; } if (PartialNChars) { nbytes = PartialNChars + SIZEOF(xTextElt); BufAlloc (unsigned char *, tbuf, nbytes); /* elt->delta = 0; * elt->len = PartialNChars; */ *(unsigned char *)tbuf = PartialNChars; *(tbuf+1) = 0; /* memcpy ((char *) (elt + 1), CharacterOffset, PartialNChars); */ memcpy ((char *)tbuf+2, CharacterOffset, PartialNChars); } } /* Pad request out to a 32-bit boundary */ if (Datalength &= 3) { char *pad; /* * BufAlloc is a macro that uses its last argument more than * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" */ length = 4 - Datalength; BufAlloc (char *, pad, length); /* * if there are 3 bytes of padding, the first byte MUST be 0 * so the pad bytes aren't mistaken for a final xTextElt */ *pad = 0; } /* * If the buffer pointer is not now pointing to a 32-bit boundary, * we must flush the buffer so that it does point to a 32-bit boundary * at the end of this routine. */ if ((dpy->bufptr - dpy->buffer) & 3) _XFlush (dpy); UnlockDisplay(dpy); SyncHandle(); return 0; } nx-libs-3.5.99.23/nx-X11/lib/src/TextExt16.c0000644000000000000000000001360713614532331014567 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Copyright 1995 by FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #define min_byte2 min_char_or_byte2 #define max_byte2 max_char_or_byte2 /* * XTextExtents16 - compute the extents of string given as a sequence of * XChar2bs. */ int XTextExtents16 ( XFontStruct *fs, _Xconst XChar2b *string, int nchars, int *dir, /* RETURN font information */ int *font_ascent, /* RETURN font information */ int *font_descent, /* RETURN font information */ register XCharStruct *overall) /* RETURN character information */ { int i; /* iterator */ Bool singlerow = (fs->max_byte1 == 0); /* optimization */ int nfound = 0; /* number of characters found */ XCharStruct *def; /* info about default char */ if (singlerow) { CI_GET_DEFAULT_INFO_1D (fs, def); } else { CI_GET_DEFAULT_INFO_2D (fs, def); } *dir = fs->direction; *font_ascent = fs->ascent; *font_descent = fs->descent; /* * Iterate over the input string getting the appropriate * char struct. * The default (which may be null if there is no def_char) will be returned * if the character doesn't exist. On the first time * through the loop, * assign the values to overall; otherwise, compute * the new values. */ for (i = 0; i < nchars; i++, string++) { register XCharStruct *cs; unsigned int r = (unsigned int) string->byte1; /* watch for macros */ unsigned int c = (unsigned int) string->byte2; /* watch for macros */ if (singlerow) { unsigned int ind = ((r << 8) | c); /* watch for macros */ CI_GET_CHAR_INFO_1D (fs, ind, def, cs); } else { CI_GET_CHAR_INFO_2D (fs, r, c, def, cs); } if (cs) { if (nfound++ == 0) { *overall = *cs; } else { overall->ascent = max (overall->ascent, cs->ascent); overall->descent = max (overall->descent, cs->descent); overall->lbearing = min (overall->lbearing, overall->width + cs->lbearing); overall->rbearing = max (overall->rbearing, overall->width + cs->rbearing); overall->width += cs->width; } } } /* * if there were no characters, then set everything to 0 */ if (nfound == 0) { overall->width = overall->ascent = overall->descent = overall->lbearing = overall->rbearing = 0; } return 0; } /* * XTextWidth16 - compute the width of sequence of XChar2bs. This is a * subset of XTextExtents16. */ int XTextWidth16 ( XFontStruct *fs, _Xconst XChar2b *string, int count) { int i; /* iterator */ Bool singlerow = (fs->max_byte1 == 0); /* optimization */ XCharStruct *def; /* info about default char */ int width = 0; /* RETURN value */ if (singlerow) { CI_GET_DEFAULT_INFO_1D (fs, def); } else { CI_GET_DEFAULT_INFO_2D (fs, def); } if (def && fs->min_bounds.width == fs->max_bounds.width) return (fs->min_bounds.width * count); /* * Iterate over all character in the input string; only consider characters * that exist. */ for (i = 0; i < count; i++, string++) { register XCharStruct *cs; unsigned int r = (unsigned int) string->byte1; /* watch for macros */ unsigned int c = (unsigned int) string->byte2; /* watch for macros */ if (singlerow) { unsigned int ind = ((r << 8) | c); /* watch for macros */ CI_GET_CHAR_INFO_1D (fs, ind, def, cs); } else { CI_GET_CHAR_INFO_2D (fs, r, c, def, cs); } if (cs) width += cs->width; } return width; } /* * _XTextHeight16 - compute the height of sequence of XChar2bs. */ int _XTextHeight16 ( XFontStruct *fs, _Xconst XChar2b *string, int count) { int i; /* iterator */ Bool singlerow = (fs->max_byte1 == 0); /* optimization */ XCharStruct *def; /* info about default char */ int height = 0; /* RETURN value */ if (singlerow) { CI_GET_DEFAULT_INFO_1D (fs, def); } else { CI_GET_DEFAULT_INFO_2D (fs, def); } if (def && (fs->min_bounds.ascent == fs->max_bounds.ascent) && (fs->min_bounds.descent == fs->max_bounds.descent)) return ((fs->min_bounds.ascent + fs->min_bounds.descent) * count); /* * Iterate over all character in the input string; only consider characters * that exist. */ for (i = 0; i < count; i++, string++) { register XCharStruct *cs; unsigned int r = (unsigned int) string->byte1; /* watch for macros */ unsigned int c = (unsigned int) string->byte2; /* watch for macros */ if (singlerow) { unsigned int ind = ((r << 8) | c); /* watch for macros */ CI_GET_CHAR_INFO_1D (fs, ind, def, cs); } else { CI_GET_CHAR_INFO_2D (fs, r, c, def, cs); } if (cs) height += (cs->ascent + cs->descent); } return height; } nx-libs-3.5.99.23/nx-X11/lib/src/TextExt.c0000644000000000000000000001526313614532331014420 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Copyright 1995 by FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #define min_byte2 min_char_or_byte2 #define max_byte2 max_char_or_byte2 /* * CI_GET_ROWZERO_CHAR_INFO_2D - do the same thing as CI_GET_CHAR_INFO_1D, * except that the font has more than one row. This is special case of more * general version used in XTextExt16.c since row == 0. This is used when * max_byte2 is not zero. A further optimization would do the check for * min_byte1 being zero ahead of time. */ #define CI_GET_ROWZERO_CHAR_INFO_2D(fs,col,def,cs) \ { \ cs = def; \ if (fs->min_byte1 == 0 && \ col >= fs->min_byte2 && col <= fs->max_byte2) { \ if (fs->per_char == NULL) { \ cs = &fs->min_bounds; \ } else { \ cs = &fs->per_char[(col - fs->min_byte2)]; \ if (CI_NONEXISTCHAR(cs)) cs = def; \ } \ } \ } /* * XTextExtents - compute the extents of string given as a sequences of eight * bit bytes. Since we know that the input characters will always be from the * first row of the font (i.e. byte1 == 0), we can do some optimizations beyond * what is done in XTextExtents16. */ int XTextExtents ( XFontStruct *fs, _Xconst char *string, int nchars, int *dir, /* RETURN font information */ int *font_ascent, /* RETURN font information */ int *font_descent, /* RETURN font information */ register XCharStruct *overall) /* RETURN character information */ { int i; /* iterator */ Bool singlerow = (fs->max_byte1 == 0); /* optimization */ int nfound = 0; /* number of characters found */ XCharStruct *def; /* info about default char */ unsigned char *us; /* be 8bit clean */ if (singlerow) { /* optimization */ CI_GET_DEFAULT_INFO_1D (fs, def); } else { CI_GET_DEFAULT_INFO_2D (fs, def); } *dir = fs->direction; *font_ascent = fs->ascent; *font_descent = fs->descent; /* * Iterate over the input string getting the appropriate * char struct. * The default (which may be null if there is no def_char) will be returned * if the character doesn't exist. On the first time * through the loop, * assign the values to overall; otherwise, compute * the new values. */ for (i = 0, us = (unsigned char *) string; i < nchars; i++, us++) { register unsigned uc = (unsigned) *us; /* since about to do macro */ register XCharStruct *cs; if (singlerow) { /* optimization */ CI_GET_CHAR_INFO_1D (fs, uc, def, cs); } else { CI_GET_ROWZERO_CHAR_INFO_2D (fs, uc, def, cs); } if (cs) { if (nfound++ == 0) { *overall = *cs; } else { overall->ascent = max (overall->ascent, cs->ascent); overall->descent = max (overall->descent, cs->descent); overall->lbearing = min (overall->lbearing, overall->width + cs->lbearing); overall->rbearing = max (overall->rbearing, overall->width + cs->rbearing); overall->width += cs->width; } } } /* * if there were no characters, then set everything to 0 */ if (nfound == 0) { overall->width = overall->ascent = overall->descent = overall->lbearing = overall->rbearing = 0; } return 0; } /* * XTextWidth - compute the width of a string of eightbit bytes. This is a * subset of XTextExtents. */ int XTextWidth ( XFontStruct *fs, _Xconst char *string, int count) { int i; /* iterator */ Bool singlerow = (fs->max_byte1 == 0); /* optimization */ XCharStruct *def; /* info about default char */ unsigned char *us; /* be 8bit clean */ int width = 0; /* RETURN value */ if (singlerow) { /* optimization */ CI_GET_DEFAULT_INFO_1D (fs, def); } else { CI_GET_DEFAULT_INFO_2D (fs, def); } if (def && fs->min_bounds.width == fs->max_bounds.width) return (fs->min_bounds.width * count); /* * Iterate over all character in the input string; only consider characters * that exist. */ for (i = 0, us = (unsigned char *) string; i < count; i++, us++) { register unsigned uc = (unsigned) *us; /* since about to do macro */ register XCharStruct *cs; if (singlerow) { /* optimization */ CI_GET_CHAR_INFO_1D (fs, uc, def, cs); } else { CI_GET_ROWZERO_CHAR_INFO_2D (fs, uc, def, cs); } if (cs) width += cs->width; } return width; } /* * _XTextHeight - compute the height of a string of eightbit bytes. */ int _XTextHeight ( XFontStruct *fs, _Xconst char *string, int count) { int i; /* iterator */ Bool singlerow = (fs->max_byte1 == 0); /* optimization */ XCharStruct *def; /* info about default char */ unsigned char *us; /* be 8bit clean */ int height = 0; /* RETURN value */ if (singlerow) { /* optimization */ CI_GET_DEFAULT_INFO_1D (fs, def); } else { CI_GET_DEFAULT_INFO_2D (fs, def); } if (def && (fs->min_bounds.ascent == fs->max_bounds.ascent) && (fs->min_bounds.descent == fs->max_bounds.descent)) return ((fs->min_bounds.ascent + fs->min_bounds.descent) * count); /* * Iterate over all character in the input string; only consider characters * that exist. */ for (i = 0, us = (unsigned char *) string; i < count; i++, us++) { register unsigned uc = (unsigned) *us; /* since about to do macro */ register XCharStruct *cs; if (singlerow) { /* optimization */ CI_GET_CHAR_INFO_1D (fs, uc, def, cs); } else { CI_GET_ROWZERO_CHAR_INFO_2D (fs, uc, def, cs); } if (cs) height += (cs->ascent + cs->descent); } return height; } nx-libs-3.5.99.23/nx-X11/lib/src/TextToStr.c0000644000000000000000000000576113614532331014735 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include /* * XTextPropertyToStringList - set list and count to contain data stored in * null-separated STRING property. */ Status XTextPropertyToStringList ( XTextProperty *tp, char ***list_return, int *count_return) { char **list; /* return value */ int nelements; /* return value */ register char *cp; /* temp variable */ char *start; /* start of thing to copy */ int i, j; /* iterator variables */ int datalen = (int) tp->nitems; /* for convenience */ /* * make sure we understand how to do it */ if (tp->encoding != XA_STRING || tp->format != 8) return False; if (datalen == 0) { *list_return = NULL; *count_return = 0; return True; } /* * walk the list to figure out how many elements there are */ nelements = 1; /* since null-separated */ for (cp = (char *) tp->value, i = datalen; i > 0; cp++, i--) { if (*cp == '\0') nelements++; } /* * allocate list and duplicate */ list = Xmalloc (nelements * sizeof (char *)); if (!list) return False; start = Xmalloc ((datalen + 1) * sizeof (char)); /* for */ if (!start) { Xfree (list); return False; } /* * copy data */ memcpy (start, (char *) tp->value, tp->nitems); start[datalen] = '\0'; /* * walk down list setting value */ for (cp = start, i = datalen + 1, j = 0; i > 0; cp++, i--) { if (*cp == '\0') { list[j] = start; start = (cp + 1); j++; } } /* * append final null pointer and then return data */ *list_return = list; *count_return = nelements; return True; } void XFreeStringList (char **list) { if (list) { if (list[0]) Xfree (list[0]); Xfree (list); list = NULL; } } nx-libs-3.5.99.23/nx-X11/lib/src/TrCoords.c0000644000000000000000000000361713614532331014552 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" Bool XTranslateCoordinates( register Display *dpy, Window src_win, Window dest_win, int src_x, int src_y, int *dst_x, int *dst_y, Window *child) { register xTranslateCoordsReq *req; xTranslateCoordsReply rep; LockDisplay(dpy); GetReq(TranslateCoords, req); req->srcWid = src_win; req->dstWid = dest_win; req->srcX = src_x; req->srcY = src_y; if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { UnlockDisplay(dpy); SyncHandle(); return(False); } *child = rep.child; *dst_x = cvtINT16toInt (rep.dstX); *dst_y = cvtINT16toInt (rep.dstY); UnlockDisplay(dpy); SyncHandle(); return ((int)rep.sameScreen); } nx-libs-3.5.99.23/nx-X11/lib/src/UIThrStubs.c0000644000000000000000000001426413614532331015027 0ustar /* * * Copyright (c) 1995 David E. Wexelblat. All rights reserved * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL DAVID E. WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of David E. Wexelblat shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from David E. Wexelblat. * */ /* * Stubs for thread functions needed by the X library. Supports * UnixWare 2.x threads; may support Solaris 2 threads as well, but not * tested. Defining things this way removes the dependency of the X * library on the threads library, but still supports threads if the user * specificies the thread library on the link line. */ /* * Modifications by Carlos A M dos Santos, XFree86 Project, November 1999. * * Explanation from : * The structure below is complicated, mostly because P1003.1c (the * IEEE POSIX Threads spec) went through lots of drafts, and some * vendors shipped systems based on draft API that were changed later. * Unfortunately POSIX did not provide a feature-test macro for * distinguishing each of the drafts. */ #ifdef CTHREADS #ifdef HAVE_CONFIG_H #include #endif #include typedef cthread_t xthread_t; #define xthread_self cthread_self #pragma weak cthread_self = _Xthr_self_stub_ #define xmutex_init mutex_init #pragma weak mutex_init = _Xthr_zero_stub_ #pragma weak mutex_clear = _Xthr_zero_stub_ #pragma weak mutex_lock = _Xthr_zero_stub_ #pragma weak mutex_unlock = _Xthr_zero_stub_ #pragma weak condition_init = _Xthr_zero_stub_ #pragma weak condition_clear = _Xthr_zero_stub_ #pragma weak condition_wait = _Xthr_zero_stub_ #pragma weak condition_signal = _Xthr_zero_stub_ #pragma weak condition_broadcast = _Xthr_zero_stub_ #else /* !CTHREADS */ #if defined(SVR4) #include typedef thread_t xthread_t; #pragma weak thr_self = _Xthr_self_stub_ #pragma weak mutex_init = _Xthr_zero_stub_ #pragma weak mutex_destroy = _Xthr_zero_stub_ #pragma weak mutex_lock = _Xthr_zero_stub_ #pragma weak mutex_unlock = _Xthr_zero_stub_ #pragma weak cond_init = _Xthr_zero_stub_ #pragma weak cond_destroy = _Xthr_zero_stub_ #pragma weak cond_wait = _Xthr_zero_stub_ #pragma weak cond_signal = _Xthr_zero_stub_ #pragma weak cond_broadcast = _Xthr_zero_stub_ #else /* !SVR4 */ #ifdef WIN32 #include #else /* !WIN32 */ #ifdef USE_TIS_SUPPORT #include typedef pthread_t xthread_t; #pragma weak tis_self = _Xthr_self_stub_ #pragma weak tis_mutex_init = _Xthr_zero_stub_ #pragma weak tis_mutex_destroy = _Xthr_zero_stub_ #pragma weak tis_mutex_lock = _Xthr_zero_stub_ #pragma weak tis_mutex_unlock = _Xthr_zero_stub_ #pragma weak tis_cond_init = _Xthr_zero_stub_ #pragma weak tis_cond_destroy = _Xthr_zero_stub_ #pragma weak tis_cond_wait = _Xthr_zero_stub_ #pragma weak tis_cond_signal = _Xthr_zero_stub_ #pragma weak tis_cond_broadcast = _Xthr_zero_stub_ #else #include typedef pthread_t xthread_t; #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) xthread_t pthread_self() __attribute__ ((weak, alias ("_Xthr_self_stub_"))); int pthread_mutex_init() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); int pthread_mutex_destroy() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); int pthread_mutex_lock() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); int pthread_mutex_unlock() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); int pthread_cond_init() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); int pthread_cond_destroy() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); int pthread_cond_wait() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); int pthread_cond_signal() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); int pthread_cond_broadcast() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); int pthread_key_create() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); void *pthread_getspecific() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); int pthread_setspecific() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); #else /* __GNUC__ */ #pragma weak pthread_self = _Xthr_self_stub_ #pragma weak pthread_mutex_init = _Xthr_zero_stub_ #pragma weak pthread_mutex_destroy = _Xthr_zero_stub_ #pragma weak pthread_mutex_lock = _Xthr_zero_stub_ #pragma weak pthread_mutex_unlock = _Xthr_zero_stub_ #pragma weak pthread_cond_init = _Xthr_zero_stub_ #pragma weak pthread_cond_destroy = _Xthr_zero_stub_ #pragma weak pthread_cond_wait = _Xthr_zero_stub_ #pragma weak pthread_cond_signal = _Xthr_zero_stub_ #pragma weak pthread_cond_broadcast = _Xthr_zero_stub_ /* These are added for libGL */ #pragma weak pthread_key_create = _Xthr_zero_stub_ #pragma weak pthread_getspecific = _Xthr_zero_stub_ #pragma weak pthread_setspecific = _Xthr_zero_stub_ #endif /* __GNUC__ */ #if defined(_DECTHREADS_) || defined(linux) #pragma weak pthread_equal = _Xthr_equal_stub_ /* See Xthreads.h! */ int _Xthr_equal_stub_() { return(1); } #endif /* _DECTHREADS_ || linux */ #endif /* USE_TIS_SUPPORT */ #endif /* WIN32 */ #endif /* SVR4 */ #endif /* CTHREADS */ static xthread_t _Xthr_self_stub_() { static xthread_t _X_no_thread_id; return(_X_no_thread_id); /* defined by */ } static int _Xthr_zero_stub_() { return(0); } nx-libs-3.5.99.23/nx-X11/lib/src/UndefCurs.c0000644000000000000000000000312313614532331014701 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XUndefineCursor ( register Display *dpy, Window w) { register xChangeWindowAttributesReq *req; unsigned long defcurs = None; LockDisplay(dpy); GetReqExtra (ChangeWindowAttributes, 4, req); req->window = w; req->valueMask = CWCursor; OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), defcurs); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/UngrabBut.c0000644000000000000000000000310613614532331014675 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XUngrabButton( register Display *dpy, unsigned int button, /* CARD8 */ unsigned int modifiers, /* CARD16 */ Window grab_window) { register xUngrabButtonReq *req; LockDisplay(dpy); GetReq(UngrabButton, req); req->button = button; req->modifiers = modifiers; req->grabWindow = grab_window; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/UngrabKbd.c0000644000000000000000000000263213614532331014646 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XUngrabKeyboard ( register Display *dpy, Time time) { register xResourceReq *req; LockDisplay(dpy); GetResReq(UngrabKeyboard, time, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/UngrabKey.c0000644000000000000000000000303113614532331014670 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XUngrabKey( register Display *dpy, int key, unsigned int modifiers, Window grab_window) { register xUngrabKeyReq *req; LockDisplay(dpy); GetReq(UngrabKey, req); req->grabWindow = grab_window; req->modifiers = modifiers; req->key = key; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/UngrabPtr.c0000644000000000000000000000263113614532331014712 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XUngrabPointer( register Display *dpy, Time time) { register xResourceReq *req; LockDisplay(dpy); GetResReq(UngrabPointer, time, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/UngrabSvr.c0000644000000000000000000000262213614532331014717 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XUngrabServer ( register Display *dpy) { _X_UNUSED register xReq *req; LockDisplay(dpy); GetEmptyReq(UngrabServer, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/UninsCmap.c0000644000000000000000000000264513614532331014710 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XUninstallColormap( register Display *dpy, Colormap cmap) { register xResourceReq *req; LockDisplay(dpy); GetResReq(UninstallColormap, cmap, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/UnldFont.c0000644000000000000000000000262513614532331014542 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XUnloadFont( register Display *dpy, Font font) { register xResourceReq *req; LockDisplay(dpy); GetResReq(CloseFont, font, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/UnmapSubs.c0000644000000000000000000000263413614532331014726 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XUnmapSubwindows( register Display *dpy, Window win) { register xResourceReq *req; LockDisplay(dpy); GetResReq(UnmapSubwindows,win, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/UnmapWin.c0000644000000000000000000000262713614532331014551 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XUnmapWindow ( register Display *dpy, Window w) { register xResourceReq *req; LockDisplay(dpy); GetResReq(UnmapWindow, w, req); UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/util/Makefile.am0000644000000000000000000000033413614532331015651 0ustar NULL = noinst_PROGRAMS=makekeys AM_CFLAGS = \ $(X11_CFLAGS) \ $(CWARNFLAGS) \ $(NULL) AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/../exports/include \ $(NULL) EXTRA_DIST = mkks.sh nx-libs-3.5.99.23/nx-X11/lib/src/util/makekeys.c0000644000000000000000000001775113614532331015605 0ustar /* Copyright 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* Constructs hash tables for XStringToKeysym and XKeysymToString. */ #include #include #include #include #include #include #include "../Xresinternal.h" #define KTNUM 4000 static struct info { char *name; KeySym val; } info[KTNUM]; #define MIN_REHASH 15 #define MATCHES 10 static char tab[KTNUM]; static unsigned short offsets[KTNUM]; static unsigned short indexes[KTNUM]; static KeySym values[KTNUM]; static int ksnum = 0; static int parse_line(const char *buf, char *key, KeySym *val, char *prefix) { int i; char alias[128]; char *tmp, *tmpa; /* See if we can catch a straight XK_foo 0x1234-style definition first; * the trickery around tmp is to account for prefices. */ i = sscanf(buf, "#define %127s 0x%lx", key, val); if (i == 2 && (tmp = strstr(key, "XK_"))) { memcpy(prefix, key, tmp - key); prefix[tmp - key] = '\0'; tmp += 3; memmove(key, tmp, strlen(tmp) + 1); return 1; } /* Now try to catch alias (XK_foo XK_bar) definitions, and resolve them * immediately: if the target is in the form XF86XK_foo, we need to * canonicalise this to XF86foo before we do the lookup. */ i = sscanf(buf, "#define %127s %127s", key, alias); if (i == 2 && (tmp = strstr(key, "XK_")) && (tmpa = strstr(alias, "XK_"))) { memcpy(prefix, key, tmp - key); prefix[tmp - key] = '\0'; tmp += 3; memmove(key, tmp, strlen(tmp) + 1); memmove(tmpa, tmpa + 3, strlen(tmpa + 3) + 1); for (i = ksnum - 1; i >= 0; i--) { if (strcmp(info[i].name, alias) == 0) { *val = info[i].val; return 1; } } fprintf(stderr, "can't find matching definition %s for keysym %s%s\n", alias, prefix, key); } return 0; } int main(int argc, char *argv[]) { int max_rehash; Signature sig; int i, j, k, l, z; FILE *fptr; char *name; char c; int first; int best_max_rehash; int best_z = 0; int num_found; KeySym val; char key[128], prefix[128]; static char buf[1024]; for (l = 1; l < argc; l++) { fptr = fopen(argv[l], "r"); if (!fptr) { fprintf(stderr, "couldn't open %s\n", argv[l]); continue; } while (fgets(buf, sizeof(buf), fptr)) { if (!parse_line(buf, key, &val, prefix)) continue; if (val == XK_VoidSymbol) val = 0; if (val > 0x1fffffff) { fprintf(stderr, "ignoring illegal keysym (%s, %lx)\n", key, val); continue; } name = malloc(strlen(prefix) + strlen(key) + 1); if (!name) { fprintf(stderr, "makekeys: out of memory!\n"); exit(1); } sprintf(name, "%s%s", prefix, key); info[ksnum].name = name; info[ksnum].val = val; ksnum++; if (ksnum == KTNUM) { fprintf(stderr, "makekeys: too many keysyms!\n"); exit(1); } } fclose(fptr); } printf("/* This file is generated from keysymdef.h. */\n"); printf("/* Do not edit. */\n"); printf("\n"); best_max_rehash = ksnum; num_found = 0; for (z = ksnum; z < KTNUM; z++) { max_rehash = 0; for (name = tab, i = z; --i >= 0;) *name++ = 0; for (i = 0; i < ksnum; i++) { name = info[i].name; sig = 0; while ((c = *name++)) sig = (sig << 1) + c; first = j = sig % z; for (k = 0; tab[j]; k++) { j += first + 1; if (j >= z) j -= z; if (j == first) goto next1; } tab[j] = 1; if (k > max_rehash) max_rehash = k; } if (max_rehash < MIN_REHASH) { if (max_rehash < best_max_rehash) { best_max_rehash = max_rehash; best_z = z; } num_found++; if (num_found >= MATCHES) break; } next1: ; } z = best_z; if (z == 0) { fprintf(stderr, "makekeys: failed to find small enough hash!\n" "Try increasing KTNUM in makekeys.c\n"); exit(1); } printf("#ifdef NEEDKTABLE\n"); printf("const unsigned char _XkeyTable[] = {\n"); printf("0,\n"); k = 1; for (i = 0; i < ksnum; i++) { name = info[i].name; sig = 0; while ((c = *name++)) sig = (sig << 1) + c; first = j = sig % z; while (offsets[j]) { j += first + 1; if (j >= z) j -= z; } offsets[j] = k; indexes[i] = k; val = info[i].val; printf("0x%.2"PRIx32", 0x%.2"PRIx32", 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, ", (sig >> 8) & 0xff, sig & 0xff, (val >> 24) & 0xff, (val >> 16) & 0xff, (val >> 8) & 0xff, val & 0xff); for (name = info[i].name, k += 7; (c = *name++); k++) printf("'%c',", c); printf((i == (ksnum-1)) ? "0\n" : "0,\n"); } printf("};\n"); printf("\n"); printf("#define KTABLESIZE %d\n", z); printf("#define KMAXHASH %d\n", best_max_rehash + 1); printf("\n"); printf("static const unsigned short hashString[KTABLESIZE] = {\n"); for (i = 0; i < z;) { printf("0x%.4x", offsets[i]); i++; if (i == z) break; printf((i & 7) ? ", " : ",\n"); } printf("\n"); printf("};\n"); printf("#endif /* NEEDKTABLE */\n"); best_max_rehash = ksnum; num_found = 0; for (z = ksnum; z < KTNUM; z++) { max_rehash = 0; for (name = tab, i = z; --i >= 0;) *name++ = 0; for (i = 0; i < ksnum; i++) { val = info[i].val; first = j = val % z; for (k = 0; tab[j]; k++) { if (values[j] == val) goto skip1; j += first + 1; if (j >= z) j -= z; if (j == first) goto next2; } tab[j] = 1; values[j] = val; if (k > max_rehash) max_rehash = k; skip1: ; } if (max_rehash < MIN_REHASH) { if (max_rehash < best_max_rehash) { best_max_rehash = max_rehash; best_z = z; } num_found++; if (num_found >= MATCHES) break; } next2: ; } z = best_z; if (z == 0) { fprintf(stderr, "makekeys: failed to find small enough hash!\n" "Try increasing KTNUM in makekeys.c\n"); exit(1); } for (i = z; --i >= 0;) offsets[i] = 0; for (i = 0; i < ksnum; i++) { val = info[i].val; first = j = val % z; while (offsets[j]) { if (values[j] == val) goto skip2; j += first + 1; if (j >= z) j -= z; } offsets[j] = indexes[i] + 2; values[j] = val; skip2: ; } printf("\n"); printf("#ifdef NEEDVTABLE\n"); printf("#define VTABLESIZE %d\n", z); printf("#define VMAXHASH %d\n", best_max_rehash + 1); printf("\n"); printf("static const unsigned short hashKeysym[VTABLESIZE] = {\n"); for (i = 0; i < z;) { printf("0x%.4x", offsets[i]); i++; if (i == z) break; printf((i & 7) ? ", " : ",\n"); } printf("\n"); printf("};\n"); printf("#endif /* NEEDVTABLE */\n"); exit(0); } nx-libs-3.5.99.23/nx-X11/lib/src/util/mkks.sh0000644000000000000000000000036413614532331015121 0ustar #!/bin/sh cat $* | awk 'BEGIN { \ printf "/*\n * This file is generated from %s. Do not edit.\n */\n", \ "$(INCLUDESRC)/keysymdef.h";\ } \ /^#define/ { \ len = length($2)-3; \ printf("{ \"%s\", %s },\n", substr($2,4,len), $3); \ }' nx-libs-3.5.99.23/nx-X11/lib/src/utlist.h0000644000000000000000000001337413614532331014345 0ustar /* Copyright (c) 2007-2009, Troy D. Hanson All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef UTLIST_H #define UTLIST_H #define UTLIST_VERSION 1.7 /* From: http://uthash.sourceforge.net/utlist.html */ /* * This file contains macros to manipulate singly and doubly-linked lists. * * 1. LL_ macros: singly-linked lists. * 2. DL_ macros: doubly-linked lists. * 3. CDL_ macros: circular doubly-linked lists. * * To use singly-linked lists, your structure must have a "next" pointer. * To use doubly-linked lists, your structure must "prev" and "next" pointers. * Either way, the pointer to the head of the list must be initialized to NULL. * * ----------------.EXAMPLE ------------------------- * struct item { * int id; * struct item *prev, *next; * } * * struct item *list = NULL: * * int main() { * struct item *item; * ... allocate and populate item ... * DL_APPEND(list, item); * } * -------------------------------------------------- * * For doubly-linked lists, the append and delete macros are O(1) * For singly-linked lists, append and delete are O(n) but prepend is O(1) * The sort macro is O(n log(n)) for all types of single/double/circular lists. */ /****************************************************************************** * doubly linked list macros (non-circular) * *****************************************************************************/ #define DL_PREPEND(head,add) \ do { \ (add)->next = head; \ if (head) { \ (add)->prev = (head)->prev; \ (head)->prev = (add); \ } else { \ (add)->prev = (add); \ } \ (head) = (add); \ } while (0) #define DL_APPEND(head,add) \ do { \ if (head) { \ (add)->prev = (head)->prev; \ (head)->prev->next = (add); \ (head)->prev = (add); \ (add)->next = NULL; \ } else { \ (head)=(add); \ (head)->prev = (head); \ (head)->next = NULL; \ } \ } while (0); #define DL_DELETE(head,del) \ do { \ if ((del)->prev == (del)) { \ (head)=NULL; \ } else if ((del)==(head)) { \ (del)->next->prev = (del)->prev; \ (head) = (del)->next; \ } else { \ (del)->prev->next = (del)->next; \ if ((del)->next) { \ (del)->next->prev = (del)->prev; \ } else { \ (head)->prev = (del)->prev; \ } \ } \ } while (0); #define DL_FOREACH(head,el) \ for(el=head;el;el=el->next) #define DL_FOREACH_SAFE(head,el,tmp) \ for(el=head,tmp=el->next;el;el=tmp,tmp=(el) ? (el->next) : NULL) #endif /* UTLIST_H */ nx-libs-3.5.99.23/nx-X11/lib/src/VisUtil.c0000644000000000000000000001566413614532331014417 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xutil.h" #include /* * This procedure returns a list of visual information structures * that match the specified attributes given in the visual information * template. * * If no visuals exist that match the specified attributes, a NULL is * returned. * * The choices for visual_info_mask are: * * VisualNoMask * VisualIDMask * VisualScreenMask * VisualDepthMask * VisualClassMask * VisualRedMaskMask * VisualGreenMaskMask * VisualBlueMaskMask * VisualColormapSizeMask * VisualBitsPerRGBMask * VisualAllMask */ XVisualInfo *XGetVisualInfo( Display *dpy, register long visual_info_mask, register XVisualInfo *visual_info_template, int *nitems) /* RETURN */ { register Visual *vp; register Depth *dp; Screen *sp; int ii,screen_s,screen_e,total,count; register XVisualInfo *vip,*vip_base; /* NOTE: NO HIGH PERFORMING CODE TO BE FOUND HERE */ LockDisplay(dpy); /* ALLOCATE THE ORIGINAL BUFFER; REALLOCED LATER IF OVERFLOW OCCURS; FREED AT END IF NO VISUALS ARE FOUND */ count = 0; total = 10; if (! (vip_base = vip = Xmalloc(sizeof(XVisualInfo) * total))) { UnlockDisplay(dpy); return (XVisualInfo *) NULL; } /* DETERMINE IF WE DO ALL SCREENS OR ONLY ONE */ screen_s = 0; screen_e = dpy->nscreens; if (visual_info_mask & VisualScreenMask) { screen_s = visual_info_template->screen; if (screen_s < 0 || screen_s >= screen_e) screen_e = screen_s; else screen_e = screen_s + 1; } /* LOOP THROUGH SCREENS */ for (ii=screen_s; iiscreens[ii]); /* LOOP THROUGH DEPTHS */ for (dp=sp->depths; dp < (sp->depths + sp->ndepths); dp++) { if ((visual_info_mask & VisualDepthMask) && (dp->depth != visual_info_template->depth)) continue; /* LOOP THROUGH VISUALS */ if (dp->visuals) { for (vp=dp->visuals; vp<(dp->visuals + dp->nvisuals); vp++) { if ((visual_info_mask & VisualIDMask) && (vp->visualid != visual_info_template->visualid)) continue; if ((visual_info_mask & VisualClassMask) && (vp->class != visual_info_template->class)) continue; if ((visual_info_mask & VisualRedMaskMask) && (vp->red_mask != visual_info_template->red_mask)) continue; if ((visual_info_mask & VisualGreenMaskMask) && (vp->green_mask != visual_info_template->green_mask)) continue; if ((visual_info_mask & VisualBlueMaskMask) && (vp->blue_mask != visual_info_template->blue_mask)) continue; if ((visual_info_mask & VisualColormapSizeMask) && (vp->map_entries != visual_info_template->colormap_size)) continue; if ((visual_info_mask & VisualBitsPerRGBMask) && (vp->bits_per_rgb != visual_info_template->bits_per_rgb)) continue; /* YEA!!! WE FOUND A GOOD ONE */ if (count+1 > total) { XVisualInfo *old_vip_base = vip_base; total += 10; if (! (vip_base = Xrealloc(vip_base, sizeof(XVisualInfo) * total))) { Xfree(old_vip_base); UnlockDisplay(dpy); return (XVisualInfo *) NULL; } vip = &vip_base[count]; } count++; vip->visual = _XVIDtoVisual(dpy, vp->visualid); vip->visualid = vp->visualid; vip->screen = ii; vip->depth = dp->depth; vip->class = vp->class; vip->red_mask = vp->red_mask; vip->green_mask = vp->green_mask; vip->blue_mask = vp->blue_mask; vip->colormap_size = vp->map_entries; vip->bits_per_rgb = vp->bits_per_rgb; vip++; } /* END OF LOOP ON VISUALS */ } /* END OF IF THERE ARE ANY VISUALS AT THIS DEPTH */ } /* END OF LOOP ON DEPTHS */ } /* END OF LOOP ON SCREENS */ UnlockDisplay(dpy); if (count) { *nitems = count; return vip_base; } Xfree(vip_base); *nitems = 0; return NULL; } /* * This procedure will return the visual information for a visual * that matches the specified depth and class for a screen. Since * multiple visuals may exist that match the specified depth and * class, which visual chosen is undefined. * * If a visual is found, True is returned as the function value, * otherwise False is returned. */ Status XMatchVisualInfo( Display *dpy, int screen, int depth, int class, XVisualInfo *visual_info) /* RETURNED */ { Visual *vp; Depth *dp; Screen *sp; int ii,jj; if (screen < 0 || screen >= dpy->nscreens) return False; LockDisplay(dpy); sp = (Screen *)(&dpy->screens[screen]); dp = sp->depths; for (ii=0; ii < sp->ndepths; ii++) { /* LOOK THROUGH DEPTHS FOR THE WANTED DEPTH */ if (dp->depth == depth) { vp = dp->visuals; /* LOOK THROUGH VISUALS FOR THE WANTED CLASS */ /* if nvisuals == 0 then vp will be NULL */ for (jj=0; jjnvisuals; jj++) { if (vp->class == class) { visual_info->visual = _XVIDtoVisual(dpy, vp->visualid); visual_info->visualid = vp->visualid; visual_info->screen = screen; visual_info->depth = depth; visual_info->class = vp->class; visual_info->red_mask = vp->red_mask; visual_info->green_mask = vp->green_mask; visual_info->blue_mask = vp->blue_mask; visual_info->colormap_size = vp->map_entries; visual_info->bits_per_rgb = vp->bits_per_rgb; UnlockDisplay(dpy); return True; } vp++; } } dp++; } UnlockDisplay(dpy); return False; } nx-libs-3.5.99.23/nx-X11/lib/src/WarpPtr.c0000644000000000000000000000337713614532331014415 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" int XWarpPointer( register Display *dpy, Window src_win, Window dest_win, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y) { register xWarpPointerReq *req; LockDisplay(dpy); GetReq(WarpPointer, req); req->srcWid = src_win; req->dstWid = dest_win; req->srcX = src_x; req->srcY = src_y; req->srcWidth = src_width; req->srcHeight = src_height; req->dstX = dest_x; req->dstY = dest_y; UnlockDisplay(dpy); SyncHandle(); return 1; } nx-libs-3.5.99.23/nx-X11/lib/src/Window.c0000644000000000000000000000771313614532331014263 0ustar /* Copyright 1986, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" void _XProcessWindowAttributes ( register Display *dpy, xChangeWindowAttributesReq *req, register unsigned long valuemask, register XSetWindowAttributes *attributes) { unsigned long values[32]; register unsigned long *value = values; unsigned int nvalues; if (valuemask & CWBackPixmap) *value++ = attributes->background_pixmap; if (valuemask & CWBackPixel) *value++ = attributes->background_pixel; if (valuemask & CWBorderPixmap) *value++ = attributes->border_pixmap; if (valuemask & CWBorderPixel) *value++ = attributes->border_pixel; if (valuemask & CWBitGravity) *value++ = attributes->bit_gravity; if (valuemask & CWWinGravity) *value++ = attributes->win_gravity; if (valuemask & CWBackingStore) *value++ = attributes->backing_store; if (valuemask & CWBackingPlanes) *value++ = attributes->backing_planes; if (valuemask & CWBackingPixel) *value++ = attributes->backing_pixel; if (valuemask & CWOverrideRedirect) *value++ = attributes->override_redirect; if (valuemask & CWSaveUnder) *value++ = attributes->save_under; if (valuemask & CWEventMask) *value++ = attributes->event_mask; if (valuemask & CWDontPropagate) *value++ = attributes->do_not_propagate_mask; if (valuemask & CWColormap) *value++ = attributes->colormap; if (valuemask & CWCursor) *value++ = attributes->cursor; req->length += (nvalues = value - values); nvalues <<= 2; /* watch out for macros... */ Data32 (dpy, (long *) values, (long)nvalues); } #define AllMaskBits (CWBackPixmap|CWBackPixel|CWBorderPixmap|\ CWBorderPixel|CWBitGravity|CWWinGravity|\ CWBackingStore|CWBackingPlanes|CWBackingPixel|\ CWOverrideRedirect|CWSaveUnder|CWEventMask|\ CWDontPropagate|CWColormap|CWCursor) Window XCreateWindow( register Display *dpy, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int borderWidth, int depth, unsigned int class, Visual *visual, unsigned long valuemask, XSetWindowAttributes *attributes) { Window wid; register xCreateWindowReq *req; LockDisplay(dpy); GetReq(CreateWindow, req); req->parent = parent; req->x = x; req->y = y; req->width = width; req->height = height; req->borderWidth = borderWidth; req->depth = depth; req->class = class; if (visual == CopyFromParent) req->visual = CopyFromParent; else req->visual = visual->visualid; wid = req->wid = XAllocID(dpy); valuemask &= AllMaskBits; if ((req->mask = valuemask)) _XProcessWindowAttributes (dpy, (xChangeWindowAttributesReq *)req, valuemask, attributes); UnlockDisplay(dpy); SyncHandle(); return (wid); } nx-libs-3.5.99.23/nx-X11/lib/src/WinEvent.c0000644000000000000000000000541013614532331014543 0ustar /* Copyright 1985, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" extern long const _Xevent_to_mask[]; #define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask) #define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ Button4MotionMask|Button5MotionMask) /* * Return the next event in the queue * for the given window matching one of the events in the mask. * Events earlier in the queue are not discarded. * If none found, flush, and then wait until an event arrives which * matches. */ int XWindowEvent ( register Display *dpy, Window w, /* Selected window. */ long mask, /* Selected event mask. */ register XEvent *event) /* XEvent to be filled in. */ { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; LockDisplay(dpy); /* Delete unclaimed cookies */ _XFreeEventCookies(dpy); prev = NULL; while (1) { for (qelt = prev ? prev->next : dpy->head; qelt; prev = qelt, qelt = qelt->next) { if ((qelt->event.xany.window == w) && (qelt->event.type < GenericEvent) && (_Xevent_to_mask[qelt->event.type] & mask) && ((qelt->event.type != MotionNotify) || (mask & AllPointers) || (mask & AllButtons & qelt->event.xmotion.state))) { *event = qelt->event; _XDeq(dpy, prev, qelt); UnlockDisplay(dpy); return 0; } } if (prev) qe_serial = prev->qserial_num; _XReadEvents(dpy); if (prev && prev->qserial_num != qe_serial) /* another thread has snatched this event */ prev = NULL; #ifdef NX_TRANS_SOCKET if (_XGetIOError(dpy)) { UnlockDisplay(dpy); return 0; } #endif } } nx-libs-3.5.99.23/nx-X11/lib/src/Withdraw.c0000644000000000000000000000574413614532331014607 0ustar /*********************************************************** Copyright 1988 by Wyse Technology, Inc., San Jose, Ca., All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name Wyse not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include /* * This function instructs the window manager to change this window from * NormalState or IconicState to Withdrawn. */ Status XWithdrawWindow ( Display *dpy, Window w, int screen) { XUnmapWindow (dpy, w); { Window root = RootWindow (dpy, screen); XUnmapEvent ev = { .type = UnmapNotify, .event = root, .window = w, .from_configure = False }; return (XSendEvent (dpy, root, False, SubstructureRedirectMask|SubstructureNotifyMask, (XEvent *)&ev)); } } nx-libs-3.5.99.23/nx-X11/lib/src/WMGeom.c0000644000000000000000000001461513614532331014146 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xutil.h" static int _GeometryMaskToGravity( int mask); /* * This routine given a user supplied positional argument and a default * argument (fully qualified) will return the position the window should take * as well as the gravity to be set in the WM_NORMAL_HINTS size hints. * Always sets all return values and returns a mask describing which fields * were set by the user or'ed with whether or not the x and y values should * be considered "negative". */ int XWMGeometry ( Display *dpy, /* user's display connection */ int screen, /* screen on which to do computation */ _Xconst char *user_geom, /* user provided geometry spec */ _Xconst char *def_geom, /* default geometry spec for window */ unsigned int bwidth, /* border width */ XSizeHints *hints, /* usually WM_NORMAL_HINTS */ int *x_return, /* location of window */ int *y_return, /* location of window */ int *width_return, /* size of window */ int *height_return, /* size of window */ int *gravity_return) /* gravity of window */ { int ux, uy; /* returned values from parse */ unsigned int uwidth, uheight; /* returned values from parse */ int umask; /* parse mask of returned values */ int dx, dy; /* default values from parse */ unsigned int dwidth, dheight; /* default values from parse */ int dmask; /* parse mask of returned values */ int base_width, base_height; /* valid amounts */ int min_width, min_height; /* valid amounts */ int width_inc, height_inc; /* valid amounts */ int rx, ry, rwidth, rheight; /* return values */ int rmask; /* return mask */ /* * Get the base sizes and increments. Section 4.1.2.3 of the ICCCM * states that the base and minimum sizes are defaults for each other. * If neither is given, then the base sizes should be 0. These parameters * control the sets of sizes that window managers should allow for the * window according to the following formulae: * * width = base_width + (i * width_inc) * height = base_height + (j * height_inc) */ base_width = ((hints->flags & PBaseSize) ? hints->base_width : ((hints->flags & PMinSize) ? hints->min_width : 0)); base_height = ((hints->flags & PBaseSize) ? hints->base_height : ((hints->flags & PMinSize) ? hints->min_height : 0)); min_width = ((hints->flags & PMinSize) ? hints->min_width : base_width); min_height = ((hints->flags & PMinSize) ? hints->min_height : base_height); width_inc = (hints->flags & PResizeInc) ? hints->width_inc : 1; height_inc = (hints->flags & PResizeInc) ? hints->height_inc : 1; /* * parse the two geometry masks */ rmask = umask = XParseGeometry (user_geom, &ux, &uy, &uwidth, &uheight); dmask = XParseGeometry (def_geom, &dx, &dy, &dwidth, &dheight); /* * get the width and height: * 1. if user-specified, then take that value * 2. else, if program-specified, then take that value * 3. else, take 1 * 4. multiply by the size increment * 5. and add to the base size */ rwidth = ((((umask & WidthValue) ? uwidth : ((dmask & WidthValue) ? dwidth : 1)) * width_inc) + base_width); rheight = ((((umask & HeightValue) ? uheight : ((dmask & HeightValue) ? dheight : 1)) * height_inc) + base_height); /* * Make sure computed size is within limits. Note that we always do the * lower bounds check since the base size (which defaults to 0) should * be used if a minimum size isn't specified. */ if (rwidth < min_width) rwidth = min_width; if (rheight < min_height) rheight = min_height; if (hints->flags & PMaxSize) { if (rwidth > hints->max_width) rwidth = hints->max_width; if (rheight > hints->max_height) rheight = hints->max_height; } /* * Compute the location. Set the negative flags in the return mask * (and watch out for borders), if necessary. */ if (umask & XValue) { rx = ((umask & XNegative) ? (DisplayWidth (dpy, screen) + ux - rwidth - 2 * bwidth) : ux); } else if (dmask & XValue) { if (dmask & XNegative) { rx = (DisplayWidth (dpy, screen) + dx - rwidth - 2 * bwidth); rmask |= XNegative; } else rx = dx; } else { rx = 0; /* gotta choose something... */ } if (umask & YValue) { ry = ((umask & YNegative) ? (DisplayHeight(dpy, screen) + uy - rheight - 2 * bwidth) : uy); } else if (dmask & YValue) { if (dmask & YNegative) { ry = (DisplayHeight(dpy, screen) + dy - rheight - 2 * bwidth); rmask |= YNegative; } else ry = dy; } else { ry = 0; /* gotta choose something... */ } /* * All finished, so set the return variables. */ *x_return = rx; *y_return = ry; *width_return = rwidth; *height_return = rheight; *gravity_return = _GeometryMaskToGravity (rmask); return rmask; } static int _GeometryMaskToGravity( int mask) { switch (mask & (XNegative|YNegative)) { case 0: return NorthWestGravity; case XNegative: return NorthEastGravity; case YNegative: return SouthWestGravity; default: return SouthEastGravity; } } nx-libs-3.5.99.23/nx-X11/lib/src/WMProps.c0000644000000000000000000001164713614532331014364 0ustar /* Copyright 1987, 1988, 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /*********************************************************** Copyright 1988 by Wyse Technology, Inc., San Jose, Ca., Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Wyse not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include /* * XSetWMProperties sets the following properties: * WM_NAME type: TEXT format: varies? * WM_ICON_NAME type: TEXT format: varies? * WM_HINTS type: WM_HINTS format: 32 * WM_COMMAND type: TEXT format: varies? * WM_CLIENT_MACHINE type: TEXT format: varies? * WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32 * WM_CLASS type: STRING/STRING format: 8 * WM_LOCALE_NAME type: STRING format: 8 */ void XSetWMProperties ( Display *dpy, Window w, /* window to decorate */ XTextProperty *windowName, /* name of application */ XTextProperty *iconName, /* name string for icon */ char **argv, /* command line */ int argc, /* size of command line */ XSizeHints *sizeHints, /* size hints for window in its normal state */ XWMHints *wmHints, /* miscelaneous window manager hints */ XClassHint *classHints) /* resource name and class */ { XTextProperty textprop; char hostName[256]; int len = _XGetHostname (hostName, sizeof hostName); char *locale; /* set names of window and icon */ if (windowName) XSetWMName (dpy, w, windowName); if (iconName) XSetWMIconName (dpy, w, iconName); /* set the command if given */ if (argv) { /* * for UNIX and other operating systems which use nul-terminated * arrays of STRINGs. */ XSetCommand (dpy, w, argv, argc); } /* set the name of the machine on which this application is running */ textprop.value = (unsigned char *) hostName; textprop.encoding = XA_STRING; textprop.format = 8; textprop.nitems = len; XSetWMClientMachine (dpy, w, &textprop); /* set hints about how geometry and window manager interaction */ if (sizeHints) XSetWMNormalHints (dpy, w, sizeHints); if (wmHints) XSetWMHints (dpy, w, wmHints); if (classHints) { XClassHint tmp; if (!classHints->res_name) { tmp.res_name = getenv ("RESOURCE_NAME"); if (!tmp.res_name && argv && argv[0]) { /* * UNIX uses /dir/subdir/.../basename; other operating * systems will have to change this. */ char *cp = strrchr (argv[0], '/'); tmp.res_name = (cp ? cp + 1 : argv[0]); } tmp.res_class = classHints->res_class; classHints = &tmp; } XSetClassHint (dpy, w, classHints); } locale = setlocale(LC_CTYPE, (char *)NULL); if (locale) XChangeProperty (dpy, w, XInternAtom(dpy, "WM_LOCALE_NAME", False), XA_STRING, 8, PropModeReplace, (unsigned char *)locale, strlen(locale)); } nx-libs-3.5.99.23/nx-X11/lib/src/WrBitF.c0000644000000000000000000000723513614532331014150 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include "Xutil.h" #include #define ERR_RETURN NULL static char *Format_Image( XImage *image, int *resultsize) { register int x, c, b; register char *ptr; int y; char *data; int width, height; int bytes_per_line; width = image->width; height = image->height; bytes_per_line = (width+7)/8; *resultsize = bytes_per_line * height; /* Calculate size of data */ data = Xmalloc( *resultsize ); /* Get space for data */ if (!data) return(ERR_RETURN); /* * The slow but robust brute force method of converting the image: */ ptr = data; c = 0; b=1; for (y=0; y nx-libs-3.5.99.23/nx-X11/lib/src/Xatomtype.h0000644000000000000000000001205213614532331015003 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef _XATOMTYPE_H_ #define _XATOMTYPE_H_ /* * This files defines crock C structures for calling XGetWindowProperty and * XChangeProperty. All fields must be longs as the semantics of property * routines will handle conversion to and from actual 32 bit objects. If your * compiler doesn't treat &structoflongs the same as &arrayoflongs[0], you * will have some work to do. */ #define BOOL long #define SIGNEDINT long #define UNSIGNEDINT unsigned long #define RESOURCEID unsigned long /* this structure may be extended, but do not change the order */ typedef struct { UNSIGNEDINT flags; SIGNEDINT x, y, width, height; /* need to cvt; only for pre-ICCCM */ SIGNEDINT minWidth, minHeight; /* need to cvt */ SIGNEDINT maxWidth, maxHeight; /* need to cvt */ SIGNEDINT widthInc, heightInc; /* need to cvt */ SIGNEDINT minAspectX, minAspectY; /* need to cvt */ SIGNEDINT maxAspectX, maxAspectY; /* need to cvt */ SIGNEDINT baseWidth,baseHeight; /* need to cvt; ICCCM version 1 */ SIGNEDINT winGravity; /* need to cvt; ICCCM version 1 */ } xPropSizeHints; #define OldNumPropSizeElements 15 /* pre-ICCCM */ #define NumPropSizeElements 18 /* ICCCM version 1 */ /* this structure may be extended, but do not change the order */ /* RGB properties */ typedef struct { RESOURCEID colormap; UNSIGNEDINT red_max; UNSIGNEDINT red_mult; UNSIGNEDINT green_max; UNSIGNEDINT green_mult; UNSIGNEDINT blue_max; UNSIGNEDINT blue_mult; UNSIGNEDINT base_pixel; RESOURCEID visualid; /* ICCCM version 1 */ RESOURCEID killid; /* ICCCM version 1 */ } xPropStandardColormap; #define OldNumPropStandardColormapElements 8 /* pre-ICCCM */ #define NumPropStandardColormapElements 10 /* ICCCM version 1 */ /* this structure may be extended, but do not change the order */ typedef struct { UNSIGNEDINT flags; BOOL input; /* need to convert */ SIGNEDINT initialState; /* need to cvt */ RESOURCEID iconPixmap; RESOURCEID iconWindow; SIGNEDINT iconX; /* need to cvt */ SIGNEDINT iconY; /* need to cvt */ RESOURCEID iconMask; UNSIGNEDINT windowGroup; } xPropWMHints; #define NumPropWMHintsElements 9 /* number of elements in this structure */ /* this structure defines the icon size hints information */ typedef struct { SIGNEDINT minWidth, minHeight; /* need to cvt */ SIGNEDINT maxWidth, maxHeight; /* need to cvt */ SIGNEDINT widthInc, heightInc; /* need to cvt */ } xPropIconSize; #define NumPropIconSizeElements 6 /* number of elements in this structure */ /* this structure defines the window manager state information */ typedef struct { SIGNEDINT state; /* need to cvt */ RESOURCEID iconWindow; } xPropWMState; #define NumPropWMStateElements 2 /* number of elements in struct */ #undef BOOL #undef SIGNEDINT #undef UNSIGNEDINT #undef RESOURCEID #endif /* _XATOMTYPE_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/xcms/AddDIC.c0000644000000000000000000001101113614532331014760 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsAddDIC.c * * DESCRIPTION * Source for XcmsAddColorSpace * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * DEFINES */ #define NextUnregDiCsID(lastid) \ (XCMS_UNREG_ID(lastid) ? ++lastid : XCMS_FIRST_UNREG_DI_ID) #define MAX(x,y) ((x) < (y) ? (y) : (x)) /* * NAME * XcmsAddColorSpace - Add a Device-Independent Color Space * * SYNOPSIS */ Status XcmsAddColorSpace(XcmsColorSpace *pCS) /* * DESCRIPTION * DI Color Spaces are managed on a global basis. * This means that with exception of the provided DI color spaces: * CIEXYZ, CIExyY, CIELab, CIEuvY, CIELuv, and TekHVC * DI color spaces may have different XcmsColorFormat IDs between * clients. So, you must be careful when using XcmsColor * structures between clients! Use the routines XcmsFormatOfPrefix() * and XcmsPrefixOfFormat() appropriately. * * RETURNS * XcmsSuccess if succeeded, otherwise XcmsFailure */ { XcmsColorSpace **papColorSpaces; XcmsColorSpace *ptmpCS; XcmsColorFormat lastID = 0; if ((pCS->id = _XcmsRegFormatOfPrefix(pCS->prefix)) != 0) { if (XCMS_DD_ID(pCS->id)) { /* This is a Device-Dependent Color Space */ return(XcmsFailure); } /* * REGISTERED DI Color Space * then see if the color space has already been added to the * system: * a. If the same ID/prefix and same XcmsColorSpec is found, * then its a duplicate, so return success. * b. If same ID/prefix but different XcmsColorSpec is * found, then add the color space to the front of the * list using the same ID. This allows one to override * an existing DI Color Space. * c. Otherwise none found so just add the color space. */ if ((papColorSpaces = _XcmsDIColorSpaces) != NULL) { while ((ptmpCS = *papColorSpaces++) != NULL) { if (pCS->id == ptmpCS->id) { if (pCS == ptmpCS) { /* a. duplicate*/ return(XcmsSuccess); } /* b. same ID/prefix but different XcmsColorSpace */ break; } } } /* c. None found */ } else { /* * UNREGISTERED DI Color Space * then see if the color space has already been added to the * system: * a. If same prefix and XcmsColorSpec, then * its a duplicate ... return success. * b. If same prefix but different XcmsColorSpec, then * add the color space to the front of the list using * the same ID. This allows one to override an existing * DI Color Space. * c. Otherwise none found so, add the color space using the * next unregistered ID for the connection. */ if ((papColorSpaces = _XcmsDIColorSpaces) != NULL) { while ((ptmpCS = *papColorSpaces++) != NULL) { lastID = MAX(lastID, ptmpCS->id); if (strcmp(pCS->prefix, ptmpCS->prefix) == 0) { if (pCS == ptmpCS) { /* a. duplicate */ return(XcmsSuccess); } /* b. same prefix but different XcmsColorSpec */ pCS->id = ptmpCS->id; goto AddColorSpace; } } } /* c. None found */ pCS->id = NextUnregDiCsID(lastID); } AddColorSpace: if ((papColorSpaces = (XcmsColorSpace **) _XcmsPushPointerArray((XPointer *)_XcmsDIColorSpaces, (XPointer)pCS, (XPointer *)_XcmsDIColorSpacesInit)) == NULL) { return(XcmsFailure); } _XcmsDIColorSpaces = papColorSpaces; return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/AddSF.c0000644000000000000000000001047713614532331014710 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsAddSF.c * * DESCRIPTION * Source for XcmsAddFunctionSet * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * DEFINES */ #define NextUnregDdCsID(lastid) \ (XCMS_UNREG_ID(lastid) ? ++lastid : XCMS_FIRST_UNREG_DD_ID) #define MIN(x,y) ((x) > (y) ? (y) : (x)) /* * NAME * XcmsAddFunctionSet - Add an Screen Color Characterization * Function Set * * SYNOPSIS */ Status XcmsAddFunctionSet(XcmsFunctionSet *pNewFS) /* * DESCRIPTION * Additional Screen Color Characterization Function Sets are * managed on a global basis. This means that with exception * of the provided DD color spaces: * RGB and RGBi * DD color spaces may have different XcmsColorFormat IDs between * clients. So, you must be careful when using XcmsColorFormat * across clients! Use the routines XcmsFormatOfPrefix() * and XcmsPrefixOfFormat() appropriately. * * RETURNS * XcmsSuccess if succeeded, otherwise XcmsFailure * * CAVEATS * Additional Screen Color Characterization Function Sets * should be added prior to any use of the routine * XcmsCreateCCC(). If not, XcmsCCC structures created * prior to the call of this routines will not have had * a chance to initialize using the added Screen Color * Characterization Function Set. */ { XcmsFunctionSet **papSCCFuncSets = _XcmsSCCFuncSets; XcmsColorSpace **papNewCSs; XcmsColorSpace *pNewCS, **paptmpCS; XcmsColorFormat lastID = 0; if (papSCCFuncSets != NULL) { if ((papNewCSs = pNewFS->DDColorSpaces) == NULL) { /* * Error, new Screen Color Characterization Function Set * missing color spaces */ return(XcmsFailure); } while ((pNewCS = *papNewCSs++) != NULL) { if ((pNewCS->id = _XcmsRegFormatOfPrefix(pNewCS->prefix)) != 0) { if (XCMS_DI_ID(pNewCS->id)) { /* This is a Device-Independent Color Space */ return(XcmsFailure); } /* * REGISTERED DD Color Space * therefore use the registered ID. */ } else { /* * UNREGISTERED DD Color Space * then see if the color space is already in * _XcmsDDColorSpaces. * a. If same prefix, then use the same ID. * b. Otherwise, use a new ID. */ for (paptmpCS = _XcmsDDColorSpaces; *paptmpCS != NULL; paptmpCS++){ lastID = MIN(lastID, (*paptmpCS)->id); if (strcmp(pNewCS->prefix, (*paptmpCS)->prefix) == 0) { pNewCS->id = (*paptmpCS)->id; break; } } if (pNewCS->id == 0) { /* still haven't found one */ pNewCS->id = NextUnregDdCsID(lastID); if ((paptmpCS = (XcmsColorSpace **)_XcmsPushPointerArray( (XPointer *) _XcmsDDColorSpaces, (XPointer) pNewCS, (XPointer *) _XcmsDDColorSpacesInit)) == NULL) { return(XcmsFailure); } _XcmsDDColorSpaces = paptmpCS; } } } } if ((papSCCFuncSets = (XcmsFunctionSet **) _XcmsPushPointerArray((XPointer *) _XcmsSCCFuncSets, (XPointer) pNewFS, (XPointer *)_XcmsSCCFuncSetsInit)) == NULL) { return(XcmsFailure); } _XcmsSCCFuncSets = papSCCFuncSets; return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/CCC.c0000644000000000000000000001730413614532331014353 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsCCC.c - Color Conversion Context Routines * * DESCRIPTION * Routines to create, access, and free Color Conversion * Context structures. * * */ /* Copyright 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * PUBLIC INTERFACES * * * ************************************************************************/ /* * NAME * XcmsCreateCCC * * SYNOPSIS */ XcmsCCC XcmsCreateCCC( Display *dpy, int screenNumber, Visual *visual, XcmsColor *clientWhitePt, XcmsCompressionProc gamutCompProc, XPointer gamutCompClientData, XcmsWhiteAdjustProc whitePtAdjProc, XPointer whitePtAdjClientData) /* * DESCRIPTION * Given a Display, Screen, Visual, etc., this routine creates * an appropriate Color Conversion Context. * * RETURNS * Returns NULL if failed; otherwise address of the newly * created XcmsCCC. * */ { XcmsCCC pDefaultCCC = XcmsDefaultCCC(dpy, screenNumber); XcmsCCC newccc; XcmsIntensityMap *pIMap; XcmsPerScrnInfo *pNewScrnInfo; if (pDefaultCCC == NULL || !(newccc = Xcalloc(1, sizeof(XcmsCCCRec)))) { return(NULL); } /* * Should inherit the following as result of a memmove(): * dpy * screenNumber * pPerScrnInfo */ memcpy((char *)newccc, (char *)pDefaultCCC, sizeof(XcmsCCCRec)); if (clientWhitePt) { memcpy((char *)&newccc->clientWhitePt, (char *)clientWhitePt, sizeof(XcmsColor)); } if (gamutCompProc) { newccc->gamutCompProc = gamutCompProc; } if (gamutCompClientData) { newccc->gamutCompClientData = gamutCompClientData; } if (whitePtAdjProc) { newccc->whitePtAdjProc = whitePtAdjProc; } if (whitePtAdjClientData) { newccc->whitePtAdjClientData = whitePtAdjClientData; } /* * Now check our list of per-Visual Intensity tables. * If one exists replace the pPerScrnInfo. */ if ((pIMap = _XcmsGetIntensityMap(dpy, visual)) != NULL) { if (!(pNewScrnInfo = Xcalloc(1, sizeof(XcmsPerScrnInfo)))) { Xfree(newccc); return(NULL); } memcpy((char *)pNewScrnInfo, (char *)newccc->pPerScrnInfo, sizeof(XcmsPerScrnInfo)); pNewScrnInfo->screenData = pIMap->screenData; newccc->pPerScrnInfo = pNewScrnInfo; } /* * Set visual component */ newccc->visual = visual; return(newccc); } /* * NAME * XcmsDefaultCCC * * SYNOPSIS */ XcmsCCC XcmsDefaultCCC( Display *dpy, int screenNumber) /* * DESCRIPTION * Given a Display and Screen, this routine creates * returns the Screen's default Color Conversion Context. * Note that a Screen's default CCC is built with the * screen default visual. * * RETURNS * Returns NULL if failed; otherwise address of the * XcmsCCC for the Screen's default CCC. * */ { XcmsCCC ccc; if ((screenNumber < 0) || (screenNumber >= ScreenCount(dpy))) { return((XcmsCCC)NULL); } /* * Check if the XcmsCCC's for each screen has been created */ if ((XcmsCCC)dpy->cms.defaultCCCs == NULL) { if (!_XcmsInitDefaultCCCs(dpy)) { return((XcmsCCC)NULL); } } ccc = (XcmsCCC)dpy->cms.defaultCCCs + screenNumber; if (!ccc->pPerScrnInfo) { /* * Need to create the XcmsPerScrnInfo structure. The * _XcmsInitScrnInfo routine will create the XcmsPerScrnInfo * structure as well as initialize its functionSet and pScreenData * components. */ if (!_XcmsInitScrnInfo(dpy, screenNumber)) { return((XcmsCCC)NULL); } return(ccc); } else { /* * If ccc->pPerScrnInfo->state == XcmsInitSuccess, * then the pPerScrnInfo component has already been initialized * therefore, just return ccc. * If ccc->pPerScrnInfo->state == XcmsInitFailure, * then this means that we already attempted to initialize * the pPerScrnInfo component but failed therefore stuffing * the pPerScrnInfo component with defaults. Just return ccc. * If ccc->pPerScrnInfo->state == XcmsInitNone, * then attempt to initialize the pPerScrnInfo component. */ switch (ccc->pPerScrnInfo->state) { case XcmsInitFailure : /* fall through */ case XcmsInitSuccess : return(ccc); case XcmsInitNone : /* XcmsPerScreenInfo has not been initialized */ if (!_XcmsInitScrnInfo(dpy, screenNumber)) { return((XcmsCCC)NULL); } return(ccc); default : return((XcmsCCC)NULL); } } } /* * NAME * XcmsFreeCCC * * SYNOPSIS */ void XcmsFreeCCC(XcmsCCC ccc) /* * DESCRIPTION * Frees memory associated with a Color Conversion Context * that was created with XcmsCreateCCC(). * * RETURNS * void * */ { if (ccc->dpy->cms.defaultCCCs && ccc == ((XcmsCCC)ccc->dpy->cms.defaultCCCs) + ccc->screenNumber) { /* do not allow clients to free DefaultCCC's */ return; } /* * Note that XcmsPerScrnInfo sub-structures are freed here only if * they are for visuals that have per-Visual intensity tables. * Otherwise the XcmsPerScrnInfo structure is being shared! * For the latter, there is only one allocated per Screen and it just * so happens * that we place its initial reference is placed in the * default CCC. The routine _XcmsFreeDefaultCCCs frees them. */ if (_XcmsGetIntensityMap(ccc->dpy, ccc->visual) != NULL) { Xfree(ccc->pPerScrnInfo); } Xfree(ccc); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/cmsAllCol.c0000644000000000000000000000426013614532331015631 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsAllCol.c * * DESCRIPTION * Source for XcmsAllocColor * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * NAME * XcmsAllocColor - Allocate Color * * SYNOPSIS */ Status XcmsAllocColor( Display *dpy, Colormap colormap, XcmsColor *pXcmsColor_in_out, XcmsColorFormat result_format) /* * DESCRIPTION * Given a device-dependent or device-independent color * specification, XcmsAllocColor will convert it to X RGB * values then use it in a call to XAllocColor. * * RETURNS * XcmsFailure if failed; * XcmsSuccess if it succeeded without gamut compression; * XcmsSuccessWithCompression if it succeeded with gamut * compression; * * Also returns the pixel value of the color cell and a color * specification of the color actually stored. * */ { return(_XcmsSetGetColor(XAllocColor, dpy, colormap, pXcmsColor_in_out, result_format, (Bool *)NULL)); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/cmsAllNCol.c0000644000000000000000000001275513614532331015757 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsAlNCol.c * * DESCRIPTION * Source for XcmsAllocNamedColor * * */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * NAME * XcmsAllocNamedColor - * * SYNOPSIS */ Status XcmsAllocNamedColor ( Display *dpy, Colormap cmap, _Xconst char *colorname, XcmsColor *pColor_scrn_return, XcmsColor *pColor_exact_return, XcmsColorFormat result_format) /* * DESCRIPTION * Finds the color specification associated with the color * name in the Device-Independent Color Name Database, then * converts that color specification to an RGB format. This * RGB value is then used in a call to XAllocColor to allocate * a read-only color cell. * * RETURNS * 0 if failed to parse string or find any entry in the database. * 1 if succeeded in converting color name to XcmsColor. * 2 if succeeded in converting color name to another color name. * */ { long nbytes; xAllocNamedColorReply rep; xAllocNamedColorReq *req; XColor hard_def; XColor exact_def; Status retval1 = 1; Status retval2 = XcmsSuccess; XcmsColor tmpColor; XColor XColor_in_out; XcmsCCC ccc; /* * 0. Check for invalid arguments. */ if (dpy == NULL || colorname[0] == '\0' || pColor_scrn_return == 0 || pColor_exact_return == NULL) { return(XcmsFailure); } if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { return(XcmsFailure); } /* * 1. Convert string to a XcmsColor using Xcms and i18n mechanism */ if ((retval1 = _XcmsResolveColorString(ccc, &colorname, &tmpColor, result_format)) == XcmsFailure) { return(XcmsFailure); } if (retval1 == _XCMS_NEWNAME) { goto PassToServer; } memcpy((char *)pColor_exact_return, (char *)&tmpColor, sizeof(XcmsColor)); /* * 2. Convert tmpColor to RGB * Assume pColor_exact_return is now adjusted to Client White Point */ if ((retval2 = XcmsConvertColors(ccc, &tmpColor, 1, XcmsRGBFormat, (Bool *) NULL)) == XcmsFailure) { return(XcmsFailure); } /* * 3. Convert to XColor and call XAllocColor */ _XcmsRGB_to_XColor(&tmpColor, &XColor_in_out, 1); if (XAllocColor(ccc->dpy, cmap, &XColor_in_out) == 0) { return(XcmsFailure); } /* * 4. pColor_scrn_return * * Now convert to the target format. * We can ignore the return value because we're already in a * device-dependent format. */ _XColor_to_XcmsRGB(ccc, &XColor_in_out, pColor_scrn_return, 1); if (result_format != XcmsRGBFormat) { if (result_format == XcmsUndefinedFormat) { result_format = pColor_exact_return->format; } if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } } return(retval1 > retval2 ? retval1 : retval2); PassToServer: /* * All previous methods failed, so lets pass it to the server * for parsing. */ dpy = ccc->dpy; LockDisplay(dpy); GetReq(AllocNamedColor, req); req->cmap = cmap; nbytes = req->nbytes = strlen(colorname); req->length += (nbytes + 3) >> 2; /* round up to mult of 4 */ _XSend(dpy, colorname, nbytes); /* _XSend is more efficient that Data, since _XReply follows */ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay(dpy); SyncHandle(); return (0); } exact_def.red = rep.exactRed; exact_def.green = rep.exactGreen; exact_def.blue = rep.exactBlue; hard_def.red = rep.screenRed; hard_def.green = rep.screenGreen; hard_def.blue = rep.screenBlue; exact_def.pixel = hard_def.pixel = rep.pixel; UnlockDisplay(dpy); SyncHandle(); /* * Now convert to the target format. */ _XColor_to_XcmsRGB(ccc, &exact_def, pColor_exact_return, 1); _XColor_to_XcmsRGB(ccc, &hard_def, pColor_scrn_return, 1); if (result_format != XcmsRGBFormat && result_format != XcmsUndefinedFormat) { if (XcmsConvertColors(ccc, pColor_exact_return, 1, result_format, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } } return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/cmsCmap.c0000644000000000000000000002747213614532331015355 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsCmap.c - Client Colormap Management Routines * * DESCRIPTION * Routines that store additional information about * colormaps being used by the X Client. * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Xutil.h" #include "Cmap.h" #include "Cv.h" /* * FORWARD DECLARATIONS */ static void _XcmsFreeClientCmaps(Display *dpy); /************************************************************************ * * * PRIVATE INTERFACES * * * ************************************************************************/ /* * NAME * CmapRecForColormap * * SYNOPSIS */ static XcmsCmapRec * CmapRecForColormap( Display *dpy, Colormap cmap) /* * DESCRIPTION * Find the corresponding XcmsCmapRec for cmap. In not found * this routines attempts to create one. * * RETURNS * Returns NULL if failed; otherwise the address to * the corresponding XcmsCmapRec. * */ { XcmsCmapRec *pRec; int nScrn; int i, j; XVisualInfo visualTemplate; /* Template of the visual we want */ XVisualInfo *visualList; /* List for visuals that match */ int nVisualsMatched; /* Number of visuals that match */ Window tmpWindow; Visual *vp; unsigned long border = 0; _XAsyncHandler async; _XAsyncErrorState async_state; for (pRec = (XcmsCmapRec *)dpy->cms.clientCmaps; pRec != NULL; pRec = pRec->pNext) { if (pRec->cmapID == cmap) { return(pRec); } } /* * Can't find an XcmsCmapRec associated with cmap in our records. * Let's try to see if its a default colormap */ nScrn = ScreenCount(dpy); for (i = 0; i < nScrn; i++) { if (cmap == DefaultColormap(dpy, i)) { /* It is ... lets go ahead and store that info */ if ((pRec = _XcmsAddCmapRec(dpy, cmap, RootWindow(dpy, i), DefaultVisual(dpy, i))) == NULL) { return((XcmsCmapRec *)NULL); } pRec->ccc = XcmsCreateCCC( dpy, i, /* screenNumber */ DefaultVisual(dpy, i), (XcmsColor *)NULL, /* clientWhitePt */ (XcmsCompressionProc)NULL, /* gamutCompProc */ (XPointer)NULL, /* gamutCompClientData */ (XcmsWhiteAdjustProc)NULL, /* whitePtAdjProc */ (XPointer)NULL /* whitePtAdjClientData */ ); return(pRec); } } /* * Nope, its not a default colormap, so it's probably a foreign color map * of which we have no specific details. Let's go through the * rigorous process of finding this colormap: * for each screen * for each screen's visual types * create a window with cmap specified as the colormap * if successful * Add a CmapRec * Create an XcmsCCC * return the CmapRec * else * continue */ async_state.error_code = 0; /* don't care */ async_state.major_opcode = X_CreateWindow; async_state.minor_opcode = 0; for (i = 0; i < nScrn; i++) { visualTemplate.screen = i; visualList = XGetVisualInfo(dpy, VisualScreenMask, &visualTemplate, &nVisualsMatched); if (visualList == NULL) { continue; } /* * Attempt to create a window with cmap */ j = 0; do { vp = (visualList+j)->visual; LockDisplay(dpy); { register xCreateWindowReq *req; GetReq(CreateWindow, req); async_state.min_sequence_number = dpy->request; async_state.max_sequence_number = dpy->request; async_state.error_count = 0; async.next = dpy->async_handlers; async.handler = _XAsyncErrorHandler; async.data = (XPointer)&async_state; dpy->async_handlers = &async; req->parent = RootWindow(dpy, i); req->x = 0; req->y = 0; req->width = 1; req->height = 1; req->borderWidth = 0; req->depth = (visualList+j)->depth; req->class = CopyFromParent; req->visual = vp->visualid; tmpWindow = req->wid = XAllocID(dpy); req->mask = CWBorderPixel | CWColormap; req->length += 2; Data32 (dpy, (long *) &border, 4); Data32 (dpy, (long *) &cmap, 4); } { xGetInputFocusReply rep; _X_UNUSED register xReq *req; GetEmptyReq(GetInputFocus, req); (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); } DeqAsyncHandler(dpy, &async); UnlockDisplay(dpy); SyncHandle(); } while (async_state.error_count > 0 && ++j < nVisualsMatched); Xfree(visualList); /* * if successful */ if (j < nVisualsMatched) { if ((pRec = _XcmsAddCmapRec(dpy, cmap, tmpWindow, vp)) == NULL) return((XcmsCmapRec *)NULL); pRec->ccc = XcmsCreateCCC( dpy, i, /* screenNumber */ vp, (XcmsColor *)NULL, /* clientWhitePt */ (XcmsCompressionProc)NULL, /* gamutCompProc */ (XPointer)NULL, /* gamutCompClientData */ (XcmsWhiteAdjustProc)NULL, /* whitePtAdjProc */ (XPointer)NULL /* whitePtAdjClientData */ ); XDestroyWindow(dpy, tmpWindow); return(pRec); } } return(NULL); } /************************************************************************ * * * API PRIVATE INTERFACES * * * ************************************************************************/ /* * NAME * _XcmsAddCmapRec * * SYNOPSIS */ XcmsCmapRec * _XcmsAddCmapRec( Display *dpy, Colormap cmap, Window windowID, Visual *visual) /* * DESCRIPTION * Create an XcmsCmapRec for the specified cmap, windowID, * and visual, then adds it to its list of CmapRec's. * * RETURNS * Returns NULL if failed; otherwise the address to * the added XcmsCmapRec. * */ { XcmsCmapRec *pNew; if ((pNew = Xcalloc(1, sizeof(XcmsCmapRec))) == NULL) { return((XcmsCmapRec *)NULL); } pNew->cmapID = cmap; pNew->dpy = dpy; pNew->windowID = windowID; pNew->visual = visual; pNew->pNext = (XcmsCmapRec *)dpy->cms.clientCmaps; dpy->cms.clientCmaps = (XPointer)pNew; dpy->free_funcs->clientCmaps = _XcmsFreeClientCmaps; /* * Note, we don't create the XcmsCCC for pNew->ccc here because * it may require the use of XGetWindowAttributes (a round trip request) * to determine the screen. */ return(pNew); } /* * NAME * _XcmsCopyCmapRecAndFree * * SYNOPSIS */ XcmsCmapRec * _XcmsCopyCmapRecAndFree( Display *dpy, Colormap src_cmap, Colormap copy_cmap) /* * DESCRIPTION * Augments Xlib's XCopyColormapAndFree() to copy * XcmsCmapRecs. * * RETURNS * Returns NULL if failed; otherwise the address to * the copy XcmsCmapRec. * */ { XcmsCmapRec *pRec_src; XcmsCmapRec *pRec_copy; if ((pRec_src = CmapRecForColormap(dpy, src_cmap)) != NULL) { pRec_copy =_XcmsAddCmapRec(dpy, copy_cmap, pRec_src->windowID, pRec_src->visual); if (pRec_copy != NULL && pRec_src->ccc) { pRec_copy->ccc = Xcalloc(1, sizeof(XcmsCCCRec)); memcpy((char *)pRec_copy->ccc, (char *)pRec_src->ccc, sizeof(XcmsCCCRec)); } return(pRec_copy); } return((XcmsCmapRec *)NULL); } /* * NAME * _XcmsDeleteCmapRec * * SYNOPSIS */ void _XcmsDeleteCmapRec( Display *dpy, Colormap cmap) /* * DESCRIPTION * Removes and frees the specified XcmsCmapRec structure * from the linked list of structures. * * RETURNS * void * */ { XcmsCmapRec **pPrevPtr; XcmsCmapRec *pRec; int scr; /* If it is the default cmap for a screen, do not delete it, * because the server will not actually free it */ for (scr = ScreenCount(dpy); --scr >= 0; ) { if (cmap == DefaultColormap(dpy, scr)) return; } /* search for it in the list */ pPrevPtr = (XcmsCmapRec **)&dpy->cms.clientCmaps; while ((pRec = *pPrevPtr) && (pRec->cmapID != cmap)) { pPrevPtr = &pRec->pNext; } if (pRec) { if (pRec->ccc) { XcmsFreeCCC(pRec->ccc); } *pPrevPtr = pRec->pNext; Xfree(pRec); } } /* * NAME * _XcmsFreeClientCmaps * * SYNOPSIS */ static void _XcmsFreeClientCmaps( Display *dpy) /* * DESCRIPTION * Frees all XcmsCmapRec structures in the linked list * and sets dpy->cms.clientCmaps to NULL. * * RETURNS * void * */ { XcmsCmapRec *pRecNext, *pRecFree; pRecNext = (XcmsCmapRec *)dpy->cms.clientCmaps; while (pRecNext != NULL) { pRecFree = pRecNext; pRecNext = pRecNext->pNext; if (pRecFree->ccc) { /* Free the XcmsCCC structure */ XcmsFreeCCC(pRecFree->ccc); } /* Now free the XcmsCmapRec structure */ Xfree(pRecFree); } dpy->cms.clientCmaps = (XPointer)NULL; } /************************************************************************ * * * PUBLIC INTERFACES * * * ************************************************************************/ /* * NAME * XcmsCCCOfColormap * * SYNOPSIS */ XcmsCCC XcmsCCCOfColormap( Display *dpy, Colormap cmap) /* * DESCRIPTION * Finds the XcmsCCC associated with the specified colormap. * * RETURNS * Returns NULL if failed; otherwise the address to * the associated XcmsCCC structure. * */ { XWindowAttributes windowAttr; XcmsCmapRec *pRec; int nScrn = ScreenCount(dpy); int i; if ((pRec = CmapRecForColormap(dpy, cmap)) != NULL) { if (pRec->ccc) { /* XcmsCmapRec already has a XcmsCCC */ return(pRec->ccc); } /* * The XcmsCmapRec does not have a XcmsCCC yet, so let's create * one. But first, we need to know the screen associated with * cmap, so use XGetWindowAttributes() to extract that * information. Unless, of course there is only one screen!! */ if (nScrn == 1) { /* Assume screenNumber == 0 */ return(pRec->ccc = XcmsCreateCCC( dpy, 0, /* screenNumber */ pRec->visual, (XcmsColor *)NULL, /* clientWhitePt */ (XcmsCompressionProc)NULL, /* gamutCompProc */ (XPointer)NULL, /* gamutCompClientData */ (XcmsWhiteAdjustProc)NULL, /* whitePtAdjProc */ (XPointer)NULL /* whitePtAdjClientData */ )); } else { if (XGetWindowAttributes(dpy, pRec->windowID, &windowAttr)) { for (i = 0; i < nScrn; i++) { if (ScreenOfDisplay(dpy, i) == windowAttr.screen) { return(pRec->ccc = XcmsCreateCCC( dpy, i, /* screenNumber */ pRec->visual, (XcmsColor *)NULL, /* clientWhitePt */ (XcmsCompressionProc)NULL, /* gamutCompProc */ (XPointer)NULL, /* gamutCompClientData */ (XcmsWhiteAdjustProc)NULL, /* whitePtAdjProc */ (XPointer)NULL /* whitePtAdjClientData */ )); } } } } } /* * No such cmap */ return(NULL); } XcmsCCC XcmsSetCCCOfColormap( Display *dpy, Colormap cmap, XcmsCCC ccc) { XcmsCCC prev_ccc = NULL; XcmsCmapRec *pRec; pRec = CmapRecForColormap(dpy, cmap); if (pRec) { prev_ccc = pRec->ccc; pRec->ccc = ccc; } return prev_ccc; } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/cmsColNm.c0000644000000000000000000005736213614532331015506 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * XcmsColNm.c * * DESCRIPTION * Source for _XcmsLookupColorName(). * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include #include #include #include #include #define XK_LATIN1 #include #include "Cv.h" /* forwards/locals */ static Status LoadColornameDB(void); /* * LOCAL DEFINES * #define declarations local to this package. */ #ifndef XCMSDB #define XCMSDB XCMSDIR "/Xcms.txt" #endif #ifndef isgraph # define isgraph(c) (isprint((c)) && !isspace((c))) #endif #ifndef XCMSDB_MAXLINELEN # define XCMSDB_MAXLINELEN 256 #endif #define FORMAT_VERSION "0.1" #define START_TOKEN "XCMS_COLORDB_START" #define END_TOKEN "XCMS_COLORDB_END" #define DELIM_CHAR '\t' #define NOT_VISITED 0x0 #define VISITED 0x1 #define CYCLE 0xFFFF #define XcmsDbInitNone -1 #define XcmsDbInitFailure 0 #define XcmsDbInitSuccess 1 /* * LOCAL TYPEDEFS */ typedef struct _XcmsPair { const char *first; const char *second; int flag; } XcmsPair; /* * LOCAL VARIABLES */ static int XcmsColorDbState = XcmsDbInitNone; static int nEntries; static char *strings; static XcmsPair *pairs; static const char whitePtStr[] = "WhitePoint"; /************************************************************************ * * * PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * _XcmsColorSpaceOfString * * SYNOPSIS */ static XcmsColorSpace * _XcmsColorSpaceOfString( XcmsCCC ccc, const char *color_string) /* * DESCRIPTION * Returns a pointer to the color space structure * (XcmsColorSpace) associated with the specified color string. * * RETURNS * Pointer to matching XcmsColorSpace structure if found; * otherwise NULL. * * CAVEATS * */ { XcmsColorSpace **papColorSpaces; size_t n; char *pchar; if ((pchar = strchr(color_string, ':')) == NULL) { return(XcmsFailure); } n = (size_t)(pchar - color_string); if (ccc == NULL) { return(NULL); } /* * First try Device-Independent color spaces */ papColorSpaces = _XcmsDIColorSpaces; if (papColorSpaces != NULL) { while (*papColorSpaces != NULL) { if (strncmp((*papColorSpaces)->prefix, color_string, n) == 0 && !((*papColorSpaces)->prefix)[n]) { return(*papColorSpaces); } papColorSpaces++; } } /* * Next try Device-Dependent color spaces */ papColorSpaces = ((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet)->DDColorSpaces; if (papColorSpaces != NULL) { while (*papColorSpaces != NULL) { if (strncmp((*papColorSpaces)->prefix, color_string, n) == 0 && !((*papColorSpaces)->prefix)[n]) { return(*papColorSpaces); } papColorSpaces++; } } return(NULL); } /* * NAME * _XcmsParseColorString * * SYNOPSIS */ static int _XcmsParseColorString( XcmsCCC ccc, const char *color_string, XcmsColor *pColor) /* * DESCRIPTION * Assuming color_string contains a numerical string color * specification, attempts to parse a string into an * XcmsColor structure. * * RETURNS * 0 if failed; otherwise non-zero. * * CAVEATS * A color string containing a numerical color specification * must be in ISO Latin-1 encoding! */ { XcmsColorSpace *pColorSpace; char string_buf[64]; char *string_lowered; size_t len; int res; if (ccc == NULL) { return(0); } /* * While copying color_string to string_lowered, convert to lowercase */ if ((len = strlen(color_string)) >= sizeof(string_buf)) { string_lowered = Xmalloc(len+1); } else { string_lowered = string_buf; } _XcmsCopyISOLatin1Lowered(string_lowered, color_string); if (*string_lowered == '#') { if ((pColorSpace = _XcmsColorSpaceOfString(ccc, "rgb:")) != NULL) { res = (*pColorSpace->parseString)(string_lowered, pColor); if (len >= sizeof(string_buf)) Xfree(string_lowered); return res; } } if ((pColorSpace = _XcmsColorSpaceOfString(ccc, string_lowered)) != NULL) { res = (*pColorSpace->parseString)(string_lowered, pColor); if (len >= sizeof(string_buf)) Xfree(string_lowered); return res; } if (len >= sizeof(string_buf)) Xfree(string_lowered); return(0); } /* * NAME * FirstCmp - Compare color names of pair recs * * SYNOPSIS */ static int FirstCmp(const void *p1, const void *p2) /* * DESCRIPTION * Compares the color names of XcmsColorTuples. * This routine is public to allow access from qsort???. * * RETURNS * 0 if equal; * < 0 if first precedes second, * > 0 if first succeeds second. * */ { return(strcmp(((const XcmsPair *)p1)->first, ((const XcmsPair *)p2)->first)); } /* * NAME * stringSectionSize - determine memory needed for strings * * SYNOPSIS */ static void SetNoVisit(void) /* * DESCRIPTION * * RETURNS * void * */ { int i; XcmsPair *pair = pairs; for (i = 0; i < nEntries; i++, pair++) { if (pair->flag != CYCLE) { pair->flag = NOT_VISITED; } } } /* * NAME * field2 - extract two fields * * SYNOPSIS */ static int field2( char *pBuf, char delim, /* in: field delimiter */ char **p1, /* in/out: pointer to pointer to field 1 */ char **p2) /* in/out: pointer to pointer to field 2 */ /* * DESCRIPTION * Extracts two fields from a "record". * * RETURNS * XcmsSuccess if succeeded, otherwise XcmsFailure. * */ { *p1 = *p2 = NULL; /* Find Field 1 */ while (!isgraph(*pBuf)) { if ((*pBuf == '\n') || (*pBuf == '\0')) { return(XcmsFailure); } if (isspace(*pBuf) || (*pBuf == delim)) { pBuf++; } } *p1 = pBuf; /* Find end of Field 2 */ while (isprint(*pBuf) && (*pBuf != delim)) { pBuf++; } if ((*pBuf == '\n') || (*pBuf == '\0')) { return(XcmsFailure); } if ((*pBuf == ' ') || (*pBuf == delim)) { *pBuf++ = '\0'; /* stuff end of string character */ } else { return(XcmsFailure); } /* Find Field 2 */ while (!isgraph(*pBuf)) { if ((*pBuf == '\n') || (*pBuf == '\0')) { return(XcmsFailure); } if (isspace(*pBuf) || (*pBuf == delim)) { pBuf++; } } *p2 = pBuf; /* Find end of Field 2 */ while (isprint(*pBuf) && (*pBuf != delim)) { pBuf++; } if (*pBuf != '\0') { *pBuf = '\0'; /* stuff end of string character */ } return(XcmsSuccess); } /* * NAME * _XcmsLookupColorName - Lookup DB entry for a color name * * SYNOPSIS */ static Status _XcmsLookupColorName( XcmsCCC ccc, const char **name, XcmsColor *pColor) /* * DESCRIPTION * Searches for an entry in the Device-Independent Color Name * Database for the specified string. * * RETURNS * XcmsFailure if failed to find a matching entry in * the database. * XcmsSuccess if succeeded in converting color name to * XcmsColor. * _XCMS_NEWNAME if succeeded in converting color string (which * is a color name to yet another color name. Note * that the new name is passed back via 'name'. */ { Status retval = 0; char name_lowered_64[64]; char *name_lowered; register int i, j, left, right; int len; const char *tmpName; XcmsPair *pair = NULL; /* * Check state of Database: * XcmsDbInitNone * XcmsDbInitSuccess * XcmsDbInitFailure */ if (XcmsColorDbState == XcmsDbInitFailure) { return(XcmsFailure); } if (XcmsColorDbState == XcmsDbInitNone) { if (!LoadColornameDB()) { return(XcmsFailure); } } SetNoVisit(); /* * While copying name to name_lowered, convert to lowercase */ tmpName = *name; Retry: if ((len = strlen(tmpName)) > 63) { name_lowered = Xmalloc(len+1); } else { name_lowered = name_lowered_64; } _XcmsCopyISOLatin1Lowered(name_lowered, tmpName); /* * Now, remove spaces. */ for (i = 0, j = 0; j < len; j++) { if (!isspace(name_lowered[j])) { name_lowered[i++] = name_lowered[j]; } } name_lowered[i] = '\0'; left = 0; right = nEntries - 1; while (left <= right) { i = (left + right) >> 1; pair = &pairs[i]; j = strcmp(name_lowered, pair->first); if (j < 0) right = i - 1; else if (j > 0) left = i + 1; else { break; } } if (len > 63) Xfree(name_lowered); if (left > right) { if (retval == 2) { if (*name != tmpName) { *name = tmpName; } return(_XCMS_NEWNAME); } return(XcmsFailure); } if (pair->flag == CYCLE) { return(XcmsFailure); } if (pair->flag == VISITED) { pair->flag = CYCLE; return(XcmsFailure); } if (_XcmsParseColorString(ccc, pair->second, pColor) == XcmsSuccess) { /* f2 contains a numerical string specification */ return(XcmsSuccess); } else { /* f2 does not contain a numerical string specification */ tmpName = pair->second; pair->flag = VISITED; retval = 2; goto Retry; } } /* * NAME * RemoveSpaces * * SYNOPSIS */ static int RemoveSpaces( char *pString) /* * DESCRIPTION * Removes spaces from string. * * RETURNS * Void * */ { int i, count = 0; char *cptr; /* REMOVE SPACES */ cptr = pString; for (i = strlen(pString); i; i--, cptr++) { if (!isspace(*cptr)) { *pString++ = *cptr; count++; } } *pString = '\0'; return(count); } /* * NAME * stringSectionSize - determine memory needed for strings * * SYNOPSIS */ static int stringSectionSize( FILE *stream, int *pNumEntries, int *pSectionSize) /* * DESCRIPTION * Determines the amount of memory required to store the * color name strings and also the number of strings. * * RETURNS * XcmsSuccess if succeeded, otherwise XcmsFailure. * */ { char buf[XCMSDB_MAXLINELEN]; char token[XCMSDB_MAXLINELEN]; char token2[XCMSDB_MAXLINELEN]; char *pBuf; char *f1; char *f2; size_t i; unsigned int numEntries = 0; unsigned int sectionSize = 0; *pNumEntries = 0; *pSectionSize = 0; /* * Advance to START_TOKEN * Anything before is just considered as comments. */ while((pBuf = fgets(buf, XCMSDB_MAXLINELEN, stream)) != NULL) { if ((sscanf(buf, "%s %s", token, token2)) && (strcmp(token, START_TOKEN) == 0)) { if (strcmp(token2, FORMAT_VERSION) != 0) { /* text file not in the right format */ return(XcmsFailure); } break; } /* else it was just a blank line or comment */ } if (pBuf == NULL) { return(XcmsFailure); } while((fgets(buf, XCMSDB_MAXLINELEN, stream)) != NULL) { if ((sscanf(buf, "%s", token)) && (strcmp(token, END_TOKEN) == 0)) { break; } if (field2(buf, DELIM_CHAR, &f1, &f2) != XcmsSuccess) { return(XcmsFailure); } numEntries++; if (numEntries >= INT_MAX) return(XcmsFailure); i = strlen(f1); if (i >= INT_MAX - sectionSize) return(XcmsFailure); sectionSize += i + 1; for (; i; i--, f1++) { /* REMOVE SPACES FROM COUNT */ if (isspace(*f1)) { sectionSize--; } } i = strlen(f2); if (i >= INT_MAX - sectionSize) return(XcmsFailure); sectionSize += i + 1; for (; i; i--, f2++) { /* REMOVE SPACES FROM COUNT */ if (isspace(*f2)) { sectionSize--; } } } *pNumEntries = (int) numEntries; *pSectionSize = (int) sectionSize; return(XcmsSuccess); } /* * NAME * ReadColornameDB - Read the Color Name Database * * SYNOPSIS */ static Status ReadColornameDB( FILE *stream, XcmsPair *pRec, char *pString) /* * DESCRIPTION * Loads the Color Name Database from a text file. * * RETURNS * XcmsSuccess if succeeded, otherwise XcmsFailure. * */ { char buf[XCMSDB_MAXLINELEN]; char token[XCMSDB_MAXLINELEN]; char token2[XCMSDB_MAXLINELEN]; char *f1; char *f2; char *pBuf; /* * Advance to START_TOKEN * Anything before is just considered as comments. */ while((pBuf = fgets(buf, XCMSDB_MAXLINELEN, stream)) != NULL) { if ((sscanf(buf, "%s %s", token, token2)) && (strcmp(token, START_TOKEN) == 0)) { if (strcmp(token2, FORMAT_VERSION) != 0) { /* text file not in the right format */ return(XcmsFailure); } break; } /* else it was just a blank line or comment */ } if (pBuf == NULL) { return(XcmsFailure); } /* * Process lines between START_TOKEN to END_TOKEN */ while ((fgets(buf, XCMSDB_MAXLINELEN, stream)) != NULL) { if ((sscanf(buf, "%s", token)) && (strcmp(token, END_TOKEN) == 0)) { /* * Found END_TOKEN so break out of for loop */ break; } /* * Get pairs */ if (field2(buf, DELIM_CHAR, &f1, &f2) != XcmsSuccess) { /* Invalid line */ continue; } /* * Add strings */ /* Left String */ pRec->first = pString; _XcmsCopyISOLatin1Lowered(pString, f1); pString += (1 + RemoveSpaces(pString)); pRec->second = pString; /* Right String */ _XcmsCopyISOLatin1Lowered(pString, f2); pString += RemoveSpaces(pString) + 1; pRec++; } return(XcmsSuccess); } /* * NAME * LoadColornameDB - Load the Color Name Database * * SYNOPSIS */ static Status LoadColornameDB(void) /* * DESCRIPTION * Loads the Color Name Database from a text file. * * RETURNS * XcmsSuccess if succeeded, otherwise XcmsFailure. * */ { int size; FILE *stream; const char *pathname; struct stat txt; int length; /* use and name of this env var is not part of the standard */ /* implementation-dependent feature */ if ((pathname = getenv("XCMSDB")) == NULL) { pathname = XCMSDB; } length = strlen(pathname); if ((length == 0) || (length >= (BUFSIZ - 5))){ XcmsColorDbState = XcmsDbInitFailure; return(XcmsFailure); } if (stat(pathname, &txt)) { /* can't stat file */ XcmsColorDbState = XcmsDbInitFailure; return(XcmsFailure); } if ((stream = _XFopenFile (pathname, "r")) == NULL) { /* can't open file */ XcmsColorDbState = XcmsDbInitFailure; return(XcmsFailure); } if (stringSectionSize(stream, &nEntries, &size) != XcmsSuccess || nEntries == 0) { (void) fclose(stream); XcmsColorDbState = XcmsDbInitFailure; return(XcmsFailure); } rewind(stream); strings = Xmalloc(size); pairs = Xcalloc(nEntries, sizeof(XcmsPair)); ReadColornameDB(stream, pairs, strings); (void) fclose(stream); /* * sort the pair recs */ qsort((char *)pairs, nEntries, sizeof(XcmsPair), FirstCmp); XcmsColorDbState = XcmsDbInitSuccess; return(XcmsSuccess); } /************************************************************************ * * * API PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * _XcmsCopyISOLatin1Lowered * * SYNOPSIS */ void _XcmsCopyISOLatin1Lowered( char *dst, const char *src) /* * DESCRIPTION * ISO Latin-1 case conversion routine * Identical to XmuCopyISOLatin1Lowered() but provided here * to eliminate need to link with libXmu.a. * * IMPLEMENTORS NOTE: * This routine is also used in XcmsFormatOfPrefix. * * RETURNS * Void * */ { register unsigned char *dest; register const unsigned char *source; for (dest = (unsigned char *)dst, source = (const unsigned char *)src; *source; source++, dest++) { if ((*source >= XK_A) && (*source <= XK_Z)) *dest = *source + (XK_a - XK_A); else if ((*source >= XK_Agrave) && (*source <= XK_Odiaeresis)) *dest = *source + (XK_agrave - XK_Agrave); else if ((*source >= XK_Ooblique) && (*source <= XK_Thorn)) *dest = *source + (XK_oslash - XK_Ooblique); else *dest = *source; } *dest = '\0'; } /* * NAME * _XcmsResolveColorString - * * SYNOPSIS */ Status _XcmsResolveColorString ( XcmsCCC ccc, const char **color_string, XcmsColor *pColor_exact_return, XcmsColorFormat result_format) /* * DESCRIPTION * The XcmsLookupColor function finds the color specification * associated with a color name in the Device-Independent Color * Name Database. * RETURNS * XcmsFailure if failed to convert valid color string. * XcmsSuccess if succeeded in converting color string to * XcmsColor. * _XCMS_NEWNAME if failed to parse the string or find it in * the database, or if succeeded in looking it up and * found another name which is not in the database. * Note that the new name is returned in color_string. * * This function returns both the color specification found in the * database (db specification) and the color specification for the * color displayable by the specified screen (screen * specification). The calling routine sets the format for these * returned specifications in the XcmsColor format component. * If XcmsUndefinedFormat, the specification is returned in the * format used to store the color in the database. */ { XcmsColor dbWhitePt; /* whitePt associated with pColor_exact_return*/ /* the screen's white point */ XcmsColor *pClientWhitePt; int retval; const char *strptr = whitePtStr; /* * 0. Check for invalid arguments. */ if (ccc == NULL || (*color_string)[0] == '\0' || pColor_exact_return == NULL) { return(XcmsFailure); } /* * 1. First attempt to parse the string * If successful, then convert the specification to the target format * and return. */ if (_XcmsParseColorString(ccc, *color_string, pColor_exact_return) == 1) { if (result_format != XcmsUndefinedFormat && pColor_exact_return->format != result_format) { /* need to be converted to the target format */ return(XcmsConvertColors(ccc, pColor_exact_return, 1, result_format, (Bool *)NULL)); } else { return(XcmsSuccess); } } /* * 2. Attempt to find it in the DI Color Name Database */ /* * a. Convert String into a XcmsColor structure * Attempt to extract the specification for color_string from the * DI Database (pColor_exact_return). If the DI Database does not * have this entry, then return failure. */ retval = _XcmsLookupColorName(ccc, color_string, pColor_exact_return); if (retval != XcmsSuccess) { /* color_string replaced with a color name, or not found */ return(_XCMS_NEWNAME); } if (pColor_exact_return->format == XcmsUndefinedFormat) { return(XcmsFailure); } /* * b. If result_format not defined, then assume target format * is the exact format. */ if (result_format == XcmsUndefinedFormat) { result_format = pColor_exact_return->format; } if ((ClientWhitePointOfCCC(ccc))->format == XcmsUndefinedFormat) { pClientWhitePt = ScreenWhitePointOfCCC(ccc); } else { pClientWhitePt = ClientWhitePointOfCCC(ccc); } /* * c. Convert to the target format, making adjustments for white * point differences as necessary. */ if (XCMS_DD_ID(pColor_exact_return->format)) { /* * The spec format is Device-Dependent, therefore assume the * its white point is the Screen White Point. */ if (XCMS_DD_ID(result_format)) { /* * Target format is Device-Dependent * Therefore, DD --> DD conversion */ return(_XcmsDDConvertColors(ccc, pColor_exact_return, 1, result_format, (Bool *) NULL)); } else { /* * Target format is Device-Independent * Therefore, DD --> DI conversion */ if (ccc->whitePtAdjProc && !_XcmsEqualWhitePts(ccc, pClientWhitePt, ScreenWhitePointOfCCC(ccc))) { return((*ccc->whitePtAdjProc)(ccc, ScreenWhitePointOfCCC(ccc), pClientWhitePt, result_format, pColor_exact_return, 1, (Bool *) NULL)); } else { if (_XcmsDDConvertColors(ccc, pColor_exact_return, 1, XcmsCIEXYZFormat, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } return(_XcmsDIConvertColors(ccc, pColor_exact_return, pClientWhitePt, 1, result_format)); } } } else { /* * The spec format is Device-Independent, therefore attempt * to find a database white point. * * If the Database does not have a white point, then assume the * database white point is the same as the Screen White Point. */ if (_XcmsLookupColorName(ccc, &strptr, &dbWhitePt) != 1) { memcpy((char *)&dbWhitePt, (char *)&ccc->pPerScrnInfo->screenWhitePt, sizeof(XcmsColor)); } if (XCMS_DD_ID(result_format)) { /* * Target format is Device-Dependent * Therefore, DI --> DD conversion */ if (ccc->whitePtAdjProc && !_XcmsEqualWhitePts(ccc, &dbWhitePt, ScreenWhitePointOfCCC(ccc))) { return((*ccc->whitePtAdjProc)(ccc, &dbWhitePt, ScreenWhitePointOfCCC(ccc), result_format, pColor_exact_return, 1, (Bool *)NULL)); } else { if (pColor_exact_return->format != XcmsCIEXYZFormat) { if (_XcmsDIConvertColors(ccc, pColor_exact_return, &dbWhitePt, 1, XcmsCIEXYZFormat) == XcmsFailure) { return(XcmsFailure); } } return (_XcmsDDConvertColors(ccc, pColor_exact_return, 1, result_format, (Bool *)NULL)); } } else { /* * Target format is Device-Independent * Therefore, DI --> DI conversion */ if (ccc->whitePtAdjProc && !_XcmsEqualWhitePts(ccc, &dbWhitePt, pClientWhitePt)) { /* * The calling routine wants to resolve this color * in terms if it's white point (i.e. Client White Point). * Therefore, apply white adjustment for the displacement * between dbWhitePt to clientWhitePt. */ return((*ccc->whitePtAdjProc)(ccc, &dbWhitePt, pClientWhitePt, result_format, pColor_exact_return, 1, (Bool *)NULL)); } else if (_XcmsEqualWhitePts(ccc, &dbWhitePt, pClientWhitePt)) { /* * Can use either dbWhitePt or pClientWhitePt to * convert to the result_format. */ if (pColor_exact_return->format == result_format) { return(XcmsSuccess); } else { return (_XcmsDIConvertColors(ccc, pColor_exact_return, &dbWhitePt, 1, result_format)); } } else { /* * Need to convert to a white point independent color * space (let's choose CIEXYZ) then convert to the * target color space. Why? Lets assume that * pColor_exact_return->format and result format * are white point dependent format (e.g., CIELUV, CIELAB, * TekHVC ... same or any combination). If so, we'll * need to convert the color with dbWhitePt to an absolute * spec (i.e. non-white point dependent) then convert that * absolute value with clientWhitePt to the result_format. */ if (pColor_exact_return->format != XcmsCIEXYZFormat) { if (_XcmsDIConvertColors(ccc, pColor_exact_return, &dbWhitePt, 1, XcmsCIEXYZFormat) == XcmsFailure) { return(XcmsFailure); } } if (result_format == XcmsCIEXYZFormat) { return(XcmsSuccess); } else { return(_XcmsDIConvertColors(ccc, pColor_exact_return, pClientWhitePt, 1, result_format)); } } } } } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/cmsGlobls.c0000644000000000000000000001006713614532331015707 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsGlobls.c * * DESCRIPTION * Source file containing Xcms globals * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * GLOBALS * Variables declared in this package that are allowed * to be used globally. */ /* * Initial array of Device Independent Color Spaces */ XcmsColorSpace *_XcmsDIColorSpacesInit[] = { &XcmsCIEXYZColorSpace, &XcmsCIEuvYColorSpace, &XcmsCIExyYColorSpace, &XcmsCIELabColorSpace, &XcmsCIELuvColorSpace, &XcmsTekHVCColorSpace, &XcmsUNDEFINEDColorSpace, NULL }; /* * Pointer to the array of pointers to XcmsColorSpace structures for * Device-Independent Color Spaces that are currently accessible by * the color management system. End of list is indicated by a NULL pointer. */ XcmsColorSpace **_XcmsDIColorSpaces = _XcmsDIColorSpacesInit; /* * Initial array of Device Dependent Color Spaces */ XcmsColorSpace *_XcmsDDColorSpacesInit[] = { &XcmsRGBColorSpace, &XcmsRGBiColorSpace, NULL }; /* * Pointer to the array of pointers to XcmsColorSpace structures for * Device-Dependent Color Spaces that are currently accessible by * the color management system. End of list is indicated by a NULL pointer. */ XcmsColorSpace **_XcmsDDColorSpaces = &_XcmsDDColorSpacesInit[0]; /* * Initial array of Screen Color Characterization Function Sets */ XcmsFunctionSet *_XcmsSCCFuncSetsInit[] = { &XcmsLinearRGBFunctionSet, #ifdef GRAY &XcmsGrayFunctionSet, #endif /* GRAY */ NULL}; /* * Pointer to the array of pointers to XcmsSCCFuncSet structures * (Screen Color Characterization Function Sets) that are currently * accessible by the color management system. End of list is * indicated by a NULL pointer. */ XcmsFunctionSet **_XcmsSCCFuncSets = _XcmsSCCFuncSetsInit; /* * X Consortium Registered Device-Independent Color Spaces * Note that prefix must be in lowercase. */ const char _XcmsCIEXYZ_prefix[] = "ciexyz"; const char _XcmsCIEuvY_prefix[] = "cieuvy"; const char _XcmsCIExyY_prefix[] = "ciexyy"; const char _XcmsCIELab_prefix[] = "cielab"; const char _XcmsCIELuv_prefix[] = "cieluv"; const char _XcmsTekHVC_prefix[] = "tekhvc"; /* * Registered Device-Dependent Color Spaces */ const char _XcmsRGBi_prefix[] = "rgbi"; const char _XcmsRGB_prefix[] = "rgb"; XcmsRegColorSpaceEntry _XcmsRegColorSpaces[] = { { _XcmsCIEXYZ_prefix, XcmsCIEXYZFormat }, { _XcmsCIEuvY_prefix, XcmsCIEuvYFormat }, { _XcmsCIExyY_prefix, XcmsCIExyYFormat }, { _XcmsCIELab_prefix, XcmsCIELabFormat }, { _XcmsCIELuv_prefix, XcmsCIELuvFormat }, { _XcmsTekHVC_prefix, XcmsTekHVCFormat }, { _XcmsRGB_prefix, XcmsRGBFormat }, { _XcmsRGBi_prefix, XcmsRGBiFormat }, { NULL, 0 } }; nx-libs-3.5.99.23/nx-X11/lib/src/xcms/cmsInt.c0000644000000000000000000002167213614532331015223 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsInt.c - Xcms API utility routines * * DESCRIPTION * Xcms Application Program Interface (API) utility * routines for hanging information directly onto * the Display structure. * * */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" #ifndef XCMSCOMPPROC # define XCMSCOMPPROC XcmsTekHVCClipC #endif /* forward/static */ static void _XcmsFreeDefaultCCCs(Display *dpy); /************************************************************************ * * * API PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * _XcmsCopyPointerArray * * SYNOPSIS */ XPointer * _XcmsCopyPointerArray( XPointer *pap) /* * DESCRIPTION * Copies an array of NULL terminated pointers. * * RETURNS * Returns NULL if failed; otherwise the address to * the copy. * */ { XPointer *newArray; char **tmp; int n; for (tmp = pap, n = 0; *tmp != NULL; tmp++, n++); n++; /* add 1 to include the NULL pointer */ if ((newArray = Xmalloc(n * sizeof(XPointer)))) { memcpy((char *)newArray, (char *)pap, (unsigned)(n * sizeof(XPointer))); } return((XPointer *)newArray); } /* * NAME * _XcmsFreePointerArray * * SYNOPSIS */ void _XcmsFreePointerArray( XPointer *pap) /* * DESCRIPTION * Frees an array of NULL terminated pointers. * * RETURNS * void * */ { Xfree(pap); } /* * NAME * _XcmsPushPointerArray * * SYNOPSIS */ XPointer * _XcmsPushPointerArray( XPointer *pap, XPointer p, XPointer *papNoFree) /* * DESCRIPTION * Places the specified pointer at the head of an array of NULL * terminated pointers. * * RETURNS * Returns NULL if failed; otherwise the address to * the head of the array. * */ { XPointer *newArray; char **tmp; int n; for (tmp = pap, n = 0; *tmp != NULL; tmp++, n++); /* add 2: 1 for the new pointer and another for the NULL pointer */ n += 2; if ((newArray = Xmalloc(n * sizeof(XPointer)))) { memcpy((char *)(newArray+1),(char *)pap, (unsigned)((n-1) * sizeof(XPointer))); *newArray = p; } if (pap != papNoFree) { _XcmsFreePointerArray(pap); } return((XPointer *)newArray); } /* * NAME * _XcmsInitDefaultCCCs * * SYNOPSIS */ int _XcmsInitDefaultCCCs( Display *dpy) /* * DESCRIPTION * Initializes the Xcms per Display Info structure * (XcmsPerDpyInfo). * * RETURNS * Returns 0 if failed; otherwise non-zero. * */ { int nScrn = ScreenCount(dpy); int i; XcmsCCC ccc; if (nScrn <= 0) { return(0); } /* * Create an array of XcmsCCC structures, one for each screen. * They serve as the screen's default CCC. */ if (!(ccc = Xcalloc((unsigned)nScrn, sizeof(XcmsCCCRec)))) { return(0); } dpy->cms.defaultCCCs = (XPointer)ccc; dpy->free_funcs->defaultCCCs = _XcmsFreeDefaultCCCs; for (i = 0; i < nScrn; i++, ccc++) { ccc->dpy = dpy; ccc->screenNumber = i; ccc->visual = DefaultVisual(dpy, i); /* * Used calloc to allocate memory so: * ccc->clientWhitePt->format == XcmsUndefinedFormat * ccc->gamutCompProc == NULL * ccc->whitePtAdjProc == NULL * ccc->pPerScrnInfo = NULL * * Don't need to create XcmsPerScrnInfo and its functionSet and * pScreenData components until the default CCC is accessed. * Note that the XcmsDefaultCCC routine calls _XcmsInitScrnInto * to do this. */ ccc->gamutCompProc = XCMSCOMPPROC; } return(1); } /* * NAME * _XcmsFreeDefaultCCCs - Free Default CCCs and its PerScrnInfo * * SYNOPSIS */ static void _XcmsFreeDefaultCCCs( Display *dpy) /* * DESCRIPTION * This routine frees the default XcmsCCC's associated with * each screen and its associated substructures as neccessary. * * RETURNS * void * * */ { int nScrn = ScreenCount(dpy); XcmsCCC ccc; int i; /* * Free Screen data in each DefaultCCC * Do not use XcmsFreeCCC here because it will not free * DefaultCCC's. */ ccc = (XcmsCCC)dpy->cms.defaultCCCs; for (i = nScrn; i--; ccc++) { /* * Check if XcmsPerScrnInfo exists. * * This is the only place where XcmsPerScrnInfo structures * are freed since there is only one allocated per Screen. * It just so happens that we place its reference in the * default CCC. */ if (ccc->pPerScrnInfo) { /* Check if SCCData exists */ if (ccc->pPerScrnInfo->state != XcmsInitNone && ccc->pPerScrnInfo->screenData) { (*((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet)->screenFreeProc) (ccc->pPerScrnInfo->screenData); } Xfree(ccc->pPerScrnInfo); } } /* * Free the array of XcmsCCC structures */ Xfree(dpy->cms.defaultCCCs); dpy->cms.defaultCCCs = (XPointer)NULL; } /* * NAME * _XcmsInitScrnInfo * * SYNOPSIS */ int _XcmsInitScrnInfo( register Display *dpy, int screenNumber) /* * DESCRIPTION * Given a display and screen number, this routine attempts * to initialize the Xcms per Screen Info structure * (XcmsPerScrnInfo). * * RETURNS * Returns zero if initialization failed; non-zero otherwise. */ { XcmsFunctionSet **papSCCFuncSet = _XcmsSCCFuncSets; XcmsCCC defaultccc; /* * Check if the XcmsCCC's for each screen has been created. * Really dont need to be created until some routine uses the Xcms * API routines. */ if ((XcmsCCC)dpy->cms.defaultCCCs == NULL) { if (!_XcmsInitDefaultCCCs(dpy)) { return(0); } } defaultccc = (XcmsCCC)dpy->cms.defaultCCCs + screenNumber; /* * For each SCCFuncSet, try its pInitScrnFunc. * If the function succeeds, then we got it! */ if (!defaultccc->pPerScrnInfo) { /* * This is one of two places where XcmsPerScrnInfo structures * are allocated. There is one allocated per Screen that is * shared among visuals that do not have specific intensity * tables. Other XcmsPerScrnInfo structures are created * for the latter (see XcmsCreateCCC). The ones created * here are referenced by the default CCC. */ if (!(defaultccc->pPerScrnInfo = Xcalloc(1, sizeof(XcmsPerScrnInfo)))) { return(0); } defaultccc->pPerScrnInfo->state = XcmsInitNone; } while (*papSCCFuncSet != NULL) { if ((*(*papSCCFuncSet)->screenInitProc)(dpy, screenNumber, defaultccc->pPerScrnInfo)) { defaultccc->pPerScrnInfo->state = XcmsInitSuccess; return(1); } papSCCFuncSet++; } /* * Use Default SCCData */ return(_XcmsLRGB_InitScrnDefault(dpy, screenNumber, defaultccc->pPerScrnInfo)); } /* * NAME * _XcmsFreeIntensityMaps * * SYNOPSIS */ void _XcmsFreeIntensityMaps( Display *dpy) /* * DESCRIPTION * Frees all XcmsIntensityMap structures in the linked list * and sets dpy->cms.perVisualIntensityMaps to NULL. * * RETURNS * void * */ { XcmsIntensityMap *pNext, *pFree; pNext = (XcmsIntensityMap *)dpy->cms.perVisualIntensityMaps; while (pNext != NULL) { pFree = pNext; pNext = pNext->pNext; (*pFree->pFreeScreenData)(pFree->screenData); /* Now free the XcmsIntensityMap structure */ Xfree(pFree); } dpy->cms.perVisualIntensityMaps = (XPointer)NULL; } /* * NAME * _XcmsGetIntensityMap * * SYNOPSIS */ XcmsIntensityMap * _XcmsGetIntensityMap( Display *dpy, Visual *visual) /* * DESCRIPTION * Attempts to return a per-Visual intensity map. * * RETURNS * Pointer to the XcmsIntensityMap structure if found; * otherwise NULL * */ { VisualID targetID = visual->visualid; XcmsIntensityMap *pNext; pNext = (XcmsIntensityMap *)dpy->cms.perVisualIntensityMaps; while (pNext != NULL) { if (targetID == pNext->visualID) { return(pNext); } pNext = pNext->pNext; } return((XcmsIntensityMap *)NULL); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/cmsLkCol.c0000644000000000000000000001266613614532331015500 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsLkCol.c * * DESCRIPTION * Source for XcmsLookupColor * * */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * NAME * XcmsLookupColor - * * SYNOPSIS */ Status XcmsLookupColor ( Display *dpy, Colormap cmap, _Xconst char *colorname, XcmsColor *pColor_exact_return, XcmsColor *pColor_scrn_return, XcmsColorFormat result_format) /* * DESCRIPTION * The XcmsLookupColor function finds the color specification * associated with a color name in the Device-Independent Color * Name Database. * RETURNS * This function returns both the color specification found in the * database (db specification) and the color specification for the * color displayable by the specified screen (screen * specification). The calling routine sets the format for these * returned specifications in the XcmsColor format component. * If XcmsUndefinedFormat, the specification is returned in the * format used to store the color in the database. */ { Status retval1 = XcmsSuccess; Status retval2 = XcmsSuccess; XcmsCCC ccc; register int n; xLookupColorReply reply; register xLookupColorReq *req; XColor def = {0,}; XColor scr = {0,}; /* * 0. Check for invalid arguments. */ if (dpy == NULL || colorname[0] == '\0' || pColor_scrn_return == 0 || pColor_exact_return == NULL) { return(XcmsFailure); } if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { return(XcmsFailure); } /* * 1. Convert string to a XcmsColor */ if ((retval1 = _XcmsResolveColorString(ccc, &colorname, pColor_exact_return, result_format)) == XcmsFailure) { return(XcmsFailure); } if (retval1 == _XCMS_NEWNAME) { goto PassToServer; } /* * 2. pColor_scrn_return * Assume the pColor_exact_return has already been adjusted to * the Client White Point. * */ /* * Convert to RGB, adjusting for white point differences if necessary. */ memcpy((char *)pColor_scrn_return, (char *)pColor_exact_return, sizeof(XcmsColor)); if (pColor_scrn_return->format == XcmsRGBFormat) { retval2 = XcmsSuccess; } else if ((retval2 = XcmsConvertColors(ccc, pColor_scrn_return, 1, XcmsRGBFormat, (Bool *)NULL)) == XcmsFailure) { return(XcmsFailure); } /* * Then, convert XcmsColor structure to the target specification * format. Note that we must use NULL instead of passing * pCompressed. */ if (result_format == XcmsUndefinedFormat) { result_format = pColor_exact_return->format; } if (result_format == XcmsRGBFormat) { _XcmsUnresolveColor(ccc, pColor_scrn_return); } else { _XcmsResolveColor(ccc, pColor_scrn_return); if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } } return(retval1 > retval2 ? retval1 : retval2); PassToServer: /* * Xcms and i18n methods failed, so lets pass it to the server * for parsing. */ LockDisplay(dpy); GetReq (LookupColor, req); req->cmap = cmap; req->nbytes = n = strlen(colorname); req->length += (n + 3) >> 2; Data (dpy, colorname, (long)n); if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) { UnlockDisplay(dpy); SyncHandle(); return (XcmsFailure); } def.red = reply.exactRed; def.green = reply.exactGreen; def.blue = reply.exactBlue; scr.red = reply.screenRed; scr.green = reply.screenGreen; scr.blue = reply.screenBlue; UnlockDisplay(dpy); SyncHandle(); _XColor_to_XcmsRGB(ccc, &def, pColor_exact_return, 1); _XColor_to_XcmsRGB(ccc, &scr, pColor_scrn_return, 1); /* * Then, convert XcmsColor structure to the target specification * format. Note that we must use NULL instead of passing * pCompressed. */ if (result_format != XcmsRGBFormat && result_format != XcmsUndefinedFormat) { if (XcmsConvertColors(ccc, pColor_exact_return, 1, result_format, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } } return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/cmsMath.c0000644000000000000000000000604613614532331015360 0ustar /* Copyright 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Stephen Gildea, MIT X Consortium, January 1991 */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #ifdef DEBUG #include #endif #include #ifndef DBL_EPSILON #define DBL_EPSILON 1e-6 #endif #ifdef _X_ROOT_STATS int cbrt_loopcount; int sqrt_loopcount; #endif /* Newton's Method: x_n+1 = x_n - ( f(x_n) / f'(x_n) ) */ /* for cube roots, x^3 - a = 0, x_new = x - 1/3 (x - a/x^2) */ double _XcmsCubeRoot(double a) { register double abs_a, cur_guess, delta; #ifdef DEBUG printf("_XcmsCubeRoot passed in %g\n", a); #endif #ifdef _X_ROOT_STATS cbrt_loopcount = 0; #endif if (a == 0.) return 0.; abs_a = a<0. ? -a : a; /* convert to positive to speed loop tests */ /* arbitrary first guess */ if (abs_a > 1.) cur_guess = abs_a/8.; else cur_guess = abs_a*8.; do { #ifdef _X_ROOT_STATS cbrt_loopcount++; #endif delta = (cur_guess - abs_a/(cur_guess*cur_guess))/3.; cur_guess -= delta; if (delta < 0.) delta = -delta; } while (delta >= cur_guess*DBL_EPSILON); if (a < 0.) cur_guess = -cur_guess; #ifdef DEBUG printf("_XcmsCubeRoot returning %g\n", cur_guess); #endif return cur_guess; } /* for square roots, x^2 - a = 0, x_new = x - 1/2 (x - a/x) */ double _XcmsSquareRoot(double a) { register double cur_guess, delta; #ifdef DEBUG printf("_XcmsSquareRoot passed in %g\n", a); #endif #ifdef _X_ROOT_STATS sqrt_loopcount = 0; #endif if (a == 0.) return 0.; if (a < 0.) { /* errno = EDOM; */ return 0.; } /* arbitrary first guess */ if (a > 1.) cur_guess = a/4.; else cur_guess = a*4.; do { #ifdef _X_ROOT_STATS sqrt_loopcount++; #endif delta = (cur_guess - a/cur_guess)/2.; cur_guess -= delta; if (delta < 0.) delta = -delta; } while (delta >= cur_guess*DBL_EPSILON); #ifdef DEBUG printf("_XcmsSquareRoot returning %g\n", cur_guess); #endif return cur_guess; } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/cmsProp.c0000644000000000000000000000744213614532331015410 0ustar /* * * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * XcmsProp.c * * DESCRIPTION * This utility routines for manipulating properties. * */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * API PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * _XcmsGetElement -- get an element value from the property passed * * SYNOPSIS */ unsigned long _XcmsGetElement( int format, char **pValue, unsigned long *pCount) /* * DESCRIPTION * Get the next element from the property and return it. * Also increment the pointer the amount needed. * * Returns * unsigned long */ { unsigned long value; switch (format) { case 32: value = *((unsigned long *)(*pValue)) & 0xFFFFFFFF; *pValue += sizeof(unsigned long); *pCount -= 1; break; case 16: value = *((unsigned short *)(*pValue)); *pValue += sizeof(unsigned short); *pCount -= 1; break; case 8: value = *((unsigned char *) (*pValue)); *pValue += 1; *pCount -= 1; break; default: value = 0; break; } return(value); } /* * NAME * _XcmsGetProperty -- Determine the existance of a property * * SYNOPSIS */ int _XcmsGetProperty( Display *pDpy, Window w, Atom property, int *pFormat, unsigned long *pNItems, unsigned long *pNBytes, char **pValue) /* * DESCRIPTION * * Returns * 0 if property does not exist. * 1 if property exists. */ { char *prop_ret; int format_ret; long len = 6516; #ifdef NXAGENT_SERVER unsigned long nitems_ret, after_ret = 0; #else unsigned long nitems_ret, after_ret; #endif Atom atom_ret; int xgwp_ret; while (True) { xgwp_ret = XGetWindowProperty (pDpy, w, property, 0, len, False, XA_INTEGER, &atom_ret, &format_ret, &nitems_ret, &after_ret, (unsigned char **)&prop_ret); if (xgwp_ret == Success && after_ret > 0) { len += nitems_ret * (format_ret >> 3); XFree (prop_ret); } else { break; } } if (xgwp_ret != Success || format_ret == 0 || nitems_ret == 0) { /* the property does not exist or is of an unexpected type or getting window property failed */ XFree (prop_ret); return(XcmsFailure); } *pFormat = format_ret; *pNItems = nitems_ret; *pNBytes = nitems_ret * (format_ret >> 3); *pValue = prop_ret; return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/cmsTrig.c0000644000000000000000000003501313614532331015370 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. */ /* * It should be pointed out that for simplicity's sake, the * environment parameters are defined as floating point constants, * rather than octal or hexadecimal initializations of allocated * storage areas. This means that the range of allowed numbers * may not exactly match the hardware's capabilities. For example, * if the maximum positive double precision floating point number * is EXACTLY 1.11...E100 and the constant "MAXDOUBLE is * defined to be 1.11E100 then the numbers between 1.11E100 and * 1.11...E100 are considered to be undefined. For most * applications, this will cause no problems. * * An alternate method is to allocate a global static "double" variable, * say "maxdouble", and use a union declaration and initialization * to initialize it with the proper bits for the EXACT maximum value. * This was not done because the only compilers available to the * author did not fully support union initialization features. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xcmsint.h" /* forward/static */ static double _XcmsModulo(double value, double base); static double _XcmsPolynomial( register int order, double const *coeffs, double x); static double _XcmsModuloF( double val, register double *dp); /* * DEFINES */ #define XCMS_MAXERROR 0.000001 #define XCMS_MAXITER 10000 #define XCMS_PI 3.14159265358979323846264338327950 #define XCMS_TWOPI 6.28318530717958620 #define XCMS_HALFPI 1.57079632679489660 #define XCMS_FOURTHPI 0.785398163397448280 #define XCMS_SIXTHPI 0.523598775598298820 #define XCMS_RADIANS(d) ((d) * XCMS_PI / 180.0) #define XCMS_DEGREES(r) ((r) * 180.0 / XCMS_PI) #define XCMS_X6_UNDERFLOWS (4.209340e-52) /* X**6 almost underflows */ #define XCMS_X16_UNDERFLOWS (5.421010e-20) /* X**16 almost underflows*/ #define XCMS_CHAR_BIT 8 #define XCMS_LONG_MAX 0x7FFFFFFF #define XCMS_DEXPLEN 11 #define XCMS_NBITS(type) (XCMS_CHAR_BIT * (int)sizeof(type)) #define XCMS_FABS(x) ((x) < 0.0 ? -(x) : (x)) /* XCMS_DMAXPOWTWO - largest power of two exactly representable as a double */ #define XCMS_DMAXPOWTWO ((double)(XCMS_LONG_MAX) * \ (1L << ((XCMS_NBITS(double)-XCMS_DEXPLEN) - XCMS_NBITS(int) + 1))) /* * LOCAL VARIABLES */ static double const cos_pcoeffs[] = { 0.12905394659037374438e7, -0.37456703915723204710e6, 0.13432300986539084285e5, -0.11231450823340933092e3 }; static double const cos_qcoeffs[] = { 0.12905394659037373590e7, 0.23467773107245835052e5, 0.20969518196726306286e3, 1.0 }; static double const sin_pcoeffs[] = { 0.20664343336995858240e7, -0.18160398797407332550e6, 0.35999306949636188317e4, -0.20107483294588615719e2 }; static double const sin_qcoeffs[] = { 0.26310659102647698963e7, 0.39270242774649000308e5, 0.27811919481083844087e3, 1.0 }; /* * * FUNCTION * * _XcmsCosine double precision cosine * * KEY WORDS * * cos * machine independent routines * trigonometric functions * math libraries * * DESCRIPTION * * Returns double precision cosine of double precision * floating point argument. * * USAGE * * double _XcmsCosine (x) * double x; * * REFERENCES * * Computer Approximations, J.F. Hart et al, John Wiley & Sons, * 1968, pp. 112-120. * * RESTRICTIONS * * The sin and cos routines are interactive in the sense that * in the process of reducing the argument to the range -PI/4 * to PI/4, each may call the other. Ultimately one or the * other uses a polynomial approximation on the reduced * argument. The sin approximation has a maximum relative error * of 10**(-17.59) and the cos approximation has a maximum * relative error of 10**(-16.18). * * These error bounds assume exact arithmetic * in the polynomial evaluation. Additional rounding and * truncation errors may occur as the argument is reduced * to the range over which the polynomial approximation * is valid, and as the polynomial is evaluated using * finite-precision arithmetic. * * PROGRAMMER * * Fred Fish * * INTERNALS * * Computes cos(x) from: * * (1) Reduce argument x to range -PI to PI. * * (2) If x > PI/2 then call cos recursively * using relation cos(x) = -cos(x - PI). * * (3) If x < -PI/2 then call cos recursively * using relation cos(x) = -cos(x + PI). * * (4) If x > PI/4 then call sin using * relation cos(x) = sin(PI/2 - x). * * (5) If x < -PI/4 then call cos using * relation cos(x) = sin(PI/2 + x). * * (6) If x would cause underflow in approx * evaluation arithmetic then return * sqrt(1.0 - x**2). * * (7) By now x has been reduced to range * -PI/4 to PI/4 and the approximation * from HART pg. 119 can be used: * * cos(x) = ( p(y) / q(y) ) * Where: * * y = x * (4/PI) * * p(y) = SUM [ Pj * (y**(2*j)) ] * over j = {0,1,2,3} * * q(y) = SUM [ Qj * (y**(2*j)) ] * over j = {0,1,2,3} * * P0 = 0.12905394659037374438571854e+7 * P1 = -0.3745670391572320471032359e+6 * P2 = 0.134323009865390842853673e+5 * P3 = -0.112314508233409330923e+3 * Q0 = 0.12905394659037373590295914e+7 * Q1 = 0.234677731072458350524124e+5 * Q2 = 0.2096951819672630628621e+3 * Q3 = 1.0000... * (coefficients from HART table #3843 pg 244) * * * **** NOTE **** The range reduction relations used in * this routine depend on the final approximation being valid * over the negative argument range in addition to the positive * argument range. The particular approximation chosen from * HART satisfies this requirement, although not explicitly * stated in the text. This may not be true of other * approximations given in the reference. * */ double _XcmsCosine(double x) { auto double y; auto double yt2; double retval; if (x < -XCMS_PI || x > XCMS_PI) { x = _XcmsModulo (x, XCMS_TWOPI); if (x > XCMS_PI) { x = x - XCMS_TWOPI; } else if (x < -XCMS_PI) { x = x + XCMS_TWOPI; } } if (x > XCMS_HALFPI) { retval = -(_XcmsCosine (x - XCMS_PI)); } else if (x < -XCMS_HALFPI) { retval = -(_XcmsCosine (x + XCMS_PI)); } else if (x > XCMS_FOURTHPI) { retval = _XcmsSine (XCMS_HALFPI - x); } else if (x < -XCMS_FOURTHPI) { retval = _XcmsSine (XCMS_HALFPI + x); } else if (x < XCMS_X6_UNDERFLOWS && x > -XCMS_X6_UNDERFLOWS) { retval = _XcmsSquareRoot (1.0 - (x * x)); } else { y = x / XCMS_FOURTHPI; yt2 = y * y; retval = _XcmsPolynomial (3, cos_pcoeffs, yt2) / _XcmsPolynomial (3, cos_qcoeffs, yt2); } return (retval); } /* * FUNCTION * * _XcmsModulo double precision modulo * * KEY WORDS * * _XcmsModulo * machine independent routines * math libraries * * DESCRIPTION * * Returns double precision modulo of two double * precision arguments. * * USAGE * * double _XcmsModulo (value, base) * double value; * double base; * * PROGRAMMER * * Fred Fish * */ static double _XcmsModulo(double value, double base) { auto double intpart; value /= base; value = _XcmsModuloF (value, &intpart); value *= base; return(value); } /* * frac = (double) _XcmsModuloF(double val, double *dp) * return fractional part of 'val' * set *dp to integer part of 'val' * * Note -> only compiled for the CA or KA. For the KB/MC, * "math.c" instantiates a copy of the inline function * defined in "math.h". */ static double _XcmsModuloF( double val, register double *dp) { register double abs; /* * Don't use a register for this. The extra precision this results * in on some systems causes problems. */ double ip; /* should check for illegal values here - nan, inf, etc */ abs = XCMS_FABS(val); if (abs >= XCMS_DMAXPOWTWO) { ip = val; } else { ip = abs + XCMS_DMAXPOWTWO; /* dump fraction */ ip -= XCMS_DMAXPOWTWO; /* restore w/o frac */ if (ip > abs) /* if it rounds up */ ip -= 1.0; /* fix it */ ip = XCMS_FABS(ip); } *dp = ip; return (val - ip); /* signed fractional part */ } /* * FUNCTION * * _XcmsPolynomial double precision polynomial evaluation * * KEY WORDS * * poly * machine independent routines * math libraries * * DESCRIPTION * * Evaluates a polynomial and returns double precision * result. Is passed a the order of the polynomial, * a pointer to an array of double precision polynomial * coefficients (in ascending order), and the independent * variable. * * USAGE * * double _XcmsPolynomial (order, coeffs, x) * int order; * double *coeffs; * double x; * * PROGRAMMER * * Fred Fish * * INTERNALS * * Evalates the polynomial using recursion and the form: * * P(x) = P0 + x(P1 + x(P2 +...x(Pn))) * */ static double _XcmsPolynomial( register int order, double const *coeffs, double x) { auto double rtn_value; coeffs += order; rtn_value = *coeffs--; while(order-- > 0) rtn_value = *coeffs-- + (x * rtn_value); return(rtn_value); } /* * FUNCTION * * _XcmsSine double precision sine * * KEY WORDS * * sin * machine independent routines * trigonometric functions * math libraries * * DESCRIPTION * * Returns double precision sine of double precision * floating point argument. * * USAGE * * double _XcmsSine (x) * double x; * * REFERENCES * * Computer Approximations, J.F. Hart et al, John Wiley & Sons, * 1968, pp. 112-120. * * RESTRICTIONS * * The sin and cos routines are interactive in the sense that * in the process of reducing the argument to the range -PI/4 * to PI/4, each may call the other. Ultimately one or the * other uses a polynomial approximation on the reduced * argument. The sin approximation has a maximum relative error * of 10**(-17.59) and the cos approximation has a maximum * relative error of 10**(-16.18). * * These error bounds assume exact arithmetic * in the polynomial evaluation. Additional rounding and * truncation errors may occur as the argument is reduced * to the range over which the polynomial approximation * is valid, and as the polynomial is evaluated using * finite-precision arithmetic. * * PROGRAMMER * * Fred Fish * * INTERNALS * * Computes sin(x) from: * * (1) Reduce argument x to range -PI to PI. * * (2) If x > PI/2 then call sin recursively * using relation sin(x) = -sin(x - PI). * * (3) If x < -PI/2 then call sin recursively * using relation sin(x) = -sin(x + PI). * * (4) If x > PI/4 then call cos using * relation sin(x) = cos(PI/2 - x). * * (5) If x < -PI/4 then call cos using * relation sin(x) = -cos(PI/2 + x). * * (6) If x is small enough that polynomial * evaluation would cause underflow * then return x, since sin(x) * approaches x as x approaches zero. * * (7) By now x has been reduced to range * -PI/4 to PI/4 and the approximation * from HART pg. 118 can be used: * * sin(x) = y * ( p(y) / q(y) ) * Where: * * y = x * (4/PI) * * p(y) = SUM [ Pj * (y**(2*j)) ] * over j = {0,1,2,3} * * q(y) = SUM [ Qj * (y**(2*j)) ] * over j = {0,1,2,3} * * P0 = 0.206643433369958582409167054e+7 * P1 = -0.18160398797407332550219213e+6 * P2 = 0.359993069496361883172836e+4 * P3 = -0.2010748329458861571949e+2 * Q0 = 0.263106591026476989637710307e+7 * Q1 = 0.3927024277464900030883986e+5 * Q2 = 0.27811919481083844087953e+3 * Q3 = 1.0000... * (coefficients from HART table #3063 pg 234) * * * **** NOTE **** The range reduction relations used in * this routine depend on the final approximation being valid * over the negative argument range in addition to the positive * argument range. The particular approximation chosen from * HART satisfies this requirement, although not explicitly * stated in the text. This may not be true of other * approximations given in the reference. * */ double _XcmsSine (double x) { double y; double yt2; double retval; if (x < -XCMS_PI || x > XCMS_PI) { x = _XcmsModulo (x, XCMS_TWOPI); if (x > XCMS_PI) { x = x - XCMS_TWOPI; } else if (x < -XCMS_PI) { x = x + XCMS_TWOPI; } } if (x > XCMS_HALFPI) { retval = -(_XcmsSine (x - XCMS_PI)); } else if (x < -XCMS_HALFPI) { retval = -(_XcmsSine (x + XCMS_PI)); } else if (x > XCMS_FOURTHPI) { retval = _XcmsCosine (XCMS_HALFPI - x); } else if (x < -XCMS_FOURTHPI) { retval = -(_XcmsCosine (XCMS_HALFPI + x)); } else if (x < XCMS_X6_UNDERFLOWS && x > -XCMS_X6_UNDERFLOWS) { retval = x; } else { y = x / XCMS_FOURTHPI; yt2 = y * y; retval = y * (_XcmsPolynomial (3, sin_pcoeffs, yt2) / _XcmsPolynomial(3, sin_qcoeffs, yt2)); } return(retval); } /* * NAME * _XcmsArcTangent * * SYNOPSIS */ double _XcmsArcTangent(double x) /* * DESCRIPTION * Computes the arctangent. * This is an implementation of the Gauss algorithm as * described in: * Forman S. Acton, Numerical Methods That Work, * New York, NY, Harper & Row, 1970. * * RETURNS * Returns the arctangent */ { double ai, a1 = 0.0, bi, b1 = 0.0, l, d; double maxerror; int i; if (x == 0.0) { return (0.0); } if (x < 1.0) { maxerror = x * XCMS_MAXERROR; } else { maxerror = XCMS_MAXERROR; } ai = _XcmsSquareRoot( 1.0 / (1.0 + (x * x)) ); bi = 1.0; for (i = 0; i < XCMS_MAXITER; i++) { a1 = (ai + bi) / 2.0; b1 = _XcmsSquareRoot((a1 * bi)); if (a1 == b1) break; d = XCMS_FABS(a1 - b1); if (d < maxerror) break; ai = a1; bi = b1; } l = ((a1 > b1) ? b1 : a1); a1 = _XcmsSquareRoot(1 + (x * x)); return (x / (a1 * l)); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/CvCols.c0000644000000000000000000006355113614532331015161 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsCvCols.c * * DESCRIPTION * Xcms API routine that converts between the * device-independent color spaces. * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * LOCAL DEFINES */ #define DD_FORMAT 0x01 #define DI_FORMAT 0x02 #define MIX_FORMAT 0x04 #ifndef MAX # define MAX(x,y) ((x) > (y) ? (x) : (y)) #endif /************************************************************************ * * * PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * EqualCIEXYZ * * SYNOPSIS */ static int EqualCIEXYZ( XcmsColor *p1, XcmsColor *p2) /* * DESCRIPTION * Compares two XcmsColor structures that are in XcmsCIEXYZFormat * * RETURNS * Returns 1 if equal; 0 otherwise. * */ { if (p1->format != XcmsCIEXYZFormat || p2->format != XcmsCIEXYZFormat) { return(0); } if ((p1->spec.CIEXYZ.X != p2->spec.CIEXYZ.X) || (p1->spec.CIEXYZ.Y != p2->spec.CIEXYZ.Y) || (p1->spec.CIEXYZ.Z != p2->spec.CIEXYZ.Z)) { return(0); } return(1); } /* * NAME * XcmsColorSpace * * SYNOPSIS */ static XcmsColorSpace * ColorSpaceOfID( XcmsCCC ccc, XcmsColorFormat id) /* * DESCRIPTION * Returns a pointer to the color space structure * (XcmsColorSpace) associated with the specified color space * ID. * * RETURNS * Pointer to matching XcmsColorSpace structure if found; * otherwise NULL. */ { XcmsColorSpace **papColorSpaces; if (ccc == NULL) { return(NULL); } /* * First try Device-Independent color spaces */ papColorSpaces = _XcmsDIColorSpaces; if (papColorSpaces != NULL) { while (*papColorSpaces != NULL) { if ((*papColorSpaces)->id == id) { return(*papColorSpaces); } papColorSpaces++; } } /* * Next try Device-Dependent color spaces */ papColorSpaces = ((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet)->DDColorSpaces; if (papColorSpaces != NULL) { while (*papColorSpaces != NULL) { if ((*papColorSpaces)->id == id) { return(*papColorSpaces); } papColorSpaces++; } } return(NULL); } /* * NAME * ValidDIColorSpaceID * * SYNOPSIS */ static int ValidDIColorSpaceID( XcmsColorFormat id) /* * DESCRIPTION * Determines if the specified color space ID is a valid * Device-Independent color space in the specified Color * Conversion Context. * * RETURNS * Returns zero if not valid; otherwise non-zero. */ { XcmsColorSpace **papRec; papRec = _XcmsDIColorSpaces; if (papRec != NULL) { while (*papRec != NULL) { if ((*papRec)->id == id) { return(1); } papRec++; } } return(0); } /* * NAME * ValidDDColorSpaceID * * SYNOPSIS */ static int ValidDDColorSpaceID( XcmsCCC ccc, XcmsColorFormat id) /* * DESCRIPTION * Determines if the specified color space ID is a valid * Device-Dependent color space in the specified Color * Conversion Context. * * RETURNS * Returns zero if not valid; otherwise non-zero. */ { XcmsColorSpace **papRec; if (ccc->pPerScrnInfo->state != XcmsInitNone) { papRec = ((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet)->DDColorSpaces; while (*papRec != NULL) { if ((*papRec)->id == id) { return(1); } papRec++; } } return(0); } /* * NAME * ConvertMixedColors - Convert XcmsColor structures * * SYNOPSIS */ static Status ConvertMixedColors( XcmsCCC ccc, XcmsColor *pColors_in_out, XcmsColor *pWhitePt, unsigned int nColors, XcmsColorFormat targetFormat, unsigned char format_flag) /* * DESCRIPTION * This routine will only convert the following types of * batches: * DI to DI * DD to DD * DD to CIEXYZ * In other words, it will not convert the following types of * batches: * DI to DD * DD to DI(not CIEXYZ) * * format_flag: * 0x01 : convert Device-Dependent only specifications to the * target format. * 0x02 : convert Device-Independent only specifications to the * target format. * 0x03 : convert all specifications to the target format. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if none of the color specifications were * compressed in the conversion process * XcmsSuccessWithCompression if at least one of the * color specifications were compressed in the * conversion process. * */ { XcmsColor *pColor, *pColors_start; XcmsColorFormat format; Status retval_tmp; Status retval = XcmsSuccess; unsigned int iColors; unsigned int nBatch; /* * Convert array of mixed color specifications in batches of * contiguous formats to the target format */ iColors = 0; while (iColors < nColors) { /* * Find contiguous array of color specifications with the * same format */ pColor = pColors_start = pColors_in_out + iColors; format = pColors_start->format; nBatch = 0; while (iColors < nColors && pColor->format == format) { pColor++; nBatch++; iColors++; } if (format != targetFormat) { /* * Need to convert this batch from current format to target format. */ if (XCMS_DI_ID(format) && (format_flag & DI_FORMAT) && XCMS_DI_ID(targetFormat)) { /* * DI->DI * * Format of interest is Device-Independent, * This batch contains Device-Independent specifications, and * the Target format is Device-Independent. */ retval_tmp = _XcmsDIConvertColors(ccc, pColors_start, pWhitePt, nBatch, targetFormat); } else if (XCMS_DD_ID(format) && (format_flag & DD_FORMAT) && (targetFormat == XcmsCIEXYZFormat)) { /* * DD->CIEXYZ * * Format of interest is Device-Dependent, * This batch contains Device-Dependent specifications, and * the Target format is CIEXYZ. * * Since DD->CIEXYZ we can use NULL instead of pCompressed. */ if ((ccc->whitePtAdjProc != NULL) && !_XcmsEqualWhitePts(ccc, pWhitePt, ScreenWhitePointOfCCC(ccc))) { /* * Need to call WhiteAdjustProc (Screen White Point to * White Point). */ retval_tmp = (*ccc->whitePtAdjProc)(ccc, ScreenWhitePointOfCCC(ccc), pWhitePt, XcmsCIEXYZFormat, pColors_start, nBatch, (Bool *)NULL); } else { retval_tmp = _XcmsDDConvertColors(ccc, pColors_start, nBatch, XcmsCIEXYZFormat, (Bool *)NULL); } } else if (XCMS_DD_ID(format) && (format_flag & DD_FORMAT) && XCMS_DD_ID(targetFormat)) { /* * DD->DD(not CIEXYZ) * * Format of interest is Device-Dependent, * This batch contains Device-Dependent specifications, and * the Target format is Device-Dependent and not CIEXYZ. */ retval_tmp = _XcmsDDConvertColors(ccc, pColors_start, nBatch, targetFormat, (Bool *)NULL); } else { /* * This routine is called for the wrong reason. */ return(XcmsFailure); } if (retval_tmp == XcmsFailure) { return(XcmsFailure); } retval = MAX(retval, retval_tmp); } } return(retval); } /************************************************************************ * * * API PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * _XcmsEqualWhitePts * * SYNOPSIS */ int _XcmsEqualWhitePts(XcmsCCC ccc, XcmsColor *pWhitePt1, XcmsColor *pWhitePt2) /* * DESCRIPTION * * RETURNS * Returns 0 if not equal; otherwise 1. * */ { XcmsColor tmp1, tmp2; memcpy((char *)&tmp1, (char *)pWhitePt1, sizeof(XcmsColor)); memcpy((char *)&tmp2, (char *)pWhitePt2, sizeof(XcmsColor)); if (tmp1.format != XcmsCIEXYZFormat) { if (_XcmsDIConvertColors(ccc, &tmp1, (XcmsColor *) NULL, 1, XcmsCIEXYZFormat)==0) { return(0); } } if (tmp2.format != XcmsCIEXYZFormat) { if (_XcmsDIConvertColors(ccc, &tmp2, (XcmsColor *) NULL, 1, XcmsCIEXYZFormat)==0) { return(0); } } return (EqualCIEXYZ(&tmp1, &tmp2)); } /* * NAME * _XcmsDIConvertColors - Convert XcmsColor structures * * SYNOPSIS */ Status _XcmsDIConvertColors( XcmsCCC ccc, XcmsColor *pColors_in_out, XcmsColor *pWhitePt, unsigned int nColors, XcmsColorFormat newFormat) /* * DESCRIPTION * Convert XcmsColor structures to another Device-Independent * form. * * Here are some assumptions that this routine makes: * 1. The calling routine has already checked if * pColors_in_out->format == newFormat, therefore * there is no need to check again here. * 2. The calling routine has already checked nColors, * therefore this routine assumes nColors > 0. * 3. The calling routine may want to convert only between * CIExyY <-> CIEXYZ <-> CIEuvY * therefore, this routine allows pWhitePt to equal NULL. * * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded. * */ { XcmsColorSpace *pFrom, *pTo; XcmsDIConversionProc *src_to_CIEXYZ, *src_from_CIEXYZ; XcmsDIConversionProc *dest_to_CIEXYZ, *dest_from_CIEXYZ; XcmsDIConversionProc *to_CIEXYZ_stop, *from_CIEXYZ_start; XcmsDIConversionProc *tmp; /* * Allow pWhitePt to equal NULL. This appropriate when converting * anywhere between: * CIExyY <-> CIEXYZ <-> CIEuvY */ if (pColors_in_out == NULL || !ValidDIColorSpaceID(pColors_in_out->format) || !ValidDIColorSpaceID(newFormat)) { return(XcmsFailure); } /* * Get a handle on the function list for the current specification format */ if ((pFrom = ColorSpaceOfID(ccc, pColors_in_out->format)) == NULL) { return(XcmsFailure); } /* * Get a handle on the function list for the new specification format */ if ((pTo = ColorSpaceOfID(ccc, newFormat)) == NULL) { return(XcmsFailure); } src_to_CIEXYZ = pFrom->to_CIEXYZ; src_from_CIEXYZ = pFrom->from_CIEXYZ; dest_to_CIEXYZ = pTo->to_CIEXYZ; dest_from_CIEXYZ = pTo->from_CIEXYZ; if (pTo->inverse_flag && pFrom->inverse_flag) { /* * Find common function pointers */ for (to_CIEXYZ_stop = src_to_CIEXYZ; *to_CIEXYZ_stop; to_CIEXYZ_stop++){ for (tmp = dest_to_CIEXYZ; *tmp; tmp++) { if (*to_CIEXYZ_stop == *tmp) { goto Continue; } } } Continue: /* * Execute the functions to CIEXYZ, stopping short as necessary */ while (src_to_CIEXYZ != to_CIEXYZ_stop) { if ((*src_to_CIEXYZ++)(ccc, pWhitePt, pColors_in_out, nColors) == XcmsFailure) { return(XcmsFailure); } } /* * Determine where to start on the from_CIEXYZ path. */ from_CIEXYZ_start = dest_from_CIEXYZ; tmp = src_from_CIEXYZ; while ((*from_CIEXYZ_start == *tmp) && (*from_CIEXYZ_start != NULL)) { from_CIEXYZ_start++; tmp++; } } else { /* * The function in at least one of the Color Spaces are not * complementary, i.e., * for an i, 0 <= i < n elements * from_CIEXYZ[i] is not the inverse of to_CIEXYZ[i] * * Execute the functions all the way to CIEXYZ */ while (*src_to_CIEXYZ) { if ((*src_to_CIEXYZ++)(ccc, pWhitePt, pColors_in_out, nColors) == XcmsFailure) { return(XcmsFailure); } } /* * Determine where to start on the from_CIEXYZ path. */ from_CIEXYZ_start = dest_from_CIEXYZ; } /* * Execute the functions from CIEXYZ. */ while (*from_CIEXYZ_start) { if ((*from_CIEXYZ_start++)(ccc, pWhitePt, pColors_in_out, nColors) == XcmsFailure) { return(XcmsFailure); } } return(XcmsSuccess); } /* * NAME * _XcmsDDConvertColors - Convert XcmsColor structures * * SYNOPSIS */ Status _XcmsDDConvertColors( XcmsCCC ccc, XcmsColor *pColors_in_out, unsigned int nColors, XcmsColorFormat newFormat, Bool *pCompressed) /* * DESCRIPTION * Convert XcmsColor structures: * * 1. From CIEXYZ to Device-Dependent formats (typically RGB and * RGBi), * or * 2. Between Device-Dependent formats (typically RGB and RGBi). * * Assumes that these specifications have already been white point * adjusted if necessary from Client White Point to Screen * White Point. Therefore, the white point now associated * with the specifications is the Screen White Point. * * pCompressed may be NULL. If so this indicates that the * calling routine is not interested in knowing exactly which * color was compressed, if any. * * * RETURNS * XcmsFailure if failed, * XcmsSuccess if none of the color specifications were * compressed in the conversion process * XcmsSuccessWithCompression if at least one of the * color specifications were compressed in the * conversion process. * */ { XcmsColorSpace *pFrom, *pTo; XcmsDDConversionProc *src_to_CIEXYZ, *src_from_CIEXYZ; XcmsDDConversionProc *dest_to_CIEXYZ, *dest_from_CIEXYZ; XcmsDDConversionProc *from_CIEXYZ_start, *to_CIEXYZ_stop; XcmsDDConversionProc *tmp; int retval; int hasCompressed = 0; if (ccc == NULL || pColors_in_out == NULL) { return(XcmsFailure); } if (nColors == 0 || pColors_in_out->format == newFormat) { /* do nothing */ return(XcmsSuccess); } if (((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet) == NULL) { return(XcmsFailure); /* hmm, an internal error? */ } /* * Its ok if pColors_in_out->format == XcmsCIEXYZFormat * or * if newFormat == XcmsCIEXYZFormat */ if ( !( ValidDDColorSpaceID(ccc, pColors_in_out->format) || (pColors_in_out->format == XcmsCIEXYZFormat)) || !(ValidDDColorSpaceID(ccc, newFormat) || newFormat == XcmsCIEXYZFormat)) { return(XcmsFailure); } if ((pFrom = ColorSpaceOfID(ccc, pColors_in_out->format)) == NULL){ return(XcmsFailure); } if ((pTo = ColorSpaceOfID(ccc, newFormat)) == NULL) { return(XcmsFailure); } src_to_CIEXYZ = (XcmsDDConversionProc *)pFrom->to_CIEXYZ; src_from_CIEXYZ = (XcmsDDConversionProc *)pFrom->from_CIEXYZ; dest_to_CIEXYZ = (XcmsDDConversionProc *)pTo->to_CIEXYZ; dest_from_CIEXYZ = (XcmsDDConversionProc *)pTo->from_CIEXYZ; if (pTo->inverse_flag && pFrom->inverse_flag) { /* * Find common function pointers */ for (to_CIEXYZ_stop = src_to_CIEXYZ; *to_CIEXYZ_stop; to_CIEXYZ_stop++){ for (tmp = dest_to_CIEXYZ; *tmp; tmp++) { if (*to_CIEXYZ_stop == *tmp) { goto Continue; } } } Continue: /* * Execute the functions */ while (src_to_CIEXYZ != to_CIEXYZ_stop) { retval = (*src_to_CIEXYZ++)(ccc, pColors_in_out, nColors, pCompressed); if (retval == XcmsFailure) { return(XcmsFailure); } hasCompressed |= (retval == XcmsSuccessWithCompression); } /* * Determine where to start on the from_CIEXYZ path. */ from_CIEXYZ_start = dest_from_CIEXYZ; tmp = src_from_CIEXYZ; while ((*from_CIEXYZ_start == *tmp) && (*from_CIEXYZ_start != NULL)) { from_CIEXYZ_start++; tmp++; } } else { /* * The function in at least one of the Color Spaces are not * complementary, i.e., * for an i, 0 <= i < n elements * from_CIEXYZ[i] is not the inverse of to_CIEXYZ[i] * * Execute the functions all the way to CIEXYZ */ while (*src_to_CIEXYZ) { retval = (*src_to_CIEXYZ++)(ccc, pColors_in_out, nColors, pCompressed); if (retval == XcmsFailure) { return(XcmsFailure); } hasCompressed |= (retval == XcmsSuccessWithCompression); } /* * Determine where to start on the from_CIEXYZ path. */ from_CIEXYZ_start = dest_from_CIEXYZ; } while (*from_CIEXYZ_start) { retval = (*from_CIEXYZ_start++)(ccc, pColors_in_out, nColors, pCompressed); if (retval == XcmsFailure) { return(XcmsFailure); } hasCompressed |= (retval == XcmsSuccessWithCompression); } return(hasCompressed ? XcmsSuccessWithCompression : XcmsSuccess); } /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsConvertColors - Convert XcmsColor structures * * SYNOPSIS */ Status XcmsConvertColors( XcmsCCC ccc, XcmsColor *pColors_in_out, unsigned int nColors, XcmsColorFormat targetFormat, Bool *pCompressed) /* * DESCRIPTION * Convert XcmsColor structures to another format * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded without gamut compression, * XcmsSuccessWithCompression if succeeded with gamut * compression. * */ { XcmsColor clientWhitePt; XcmsColor Color1; XcmsColor *pColors_tmp; int callWhiteAdjustProc = 0; XcmsColorFormat format; Status retval; unsigned char contents_flag = 0x00; unsigned int iColors; if (ccc == NULL || pColors_in_out == NULL || !(ValidDIColorSpaceID(targetFormat) || ValidDDColorSpaceID(ccc, targetFormat))) { return(XcmsFailure); } /* * Check formats in color specification array */ format = pColors_in_out->format; for (pColors_tmp = pColors_in_out, iColors = nColors; iColors; pColors_tmp++, iColors--) { if (!(ValidDIColorSpaceID(pColors_tmp->format) || ValidDDColorSpaceID(ccc, pColors_tmp->format))) { return(XcmsFailure); } if (XCMS_DI_ID(pColors_tmp->format)) { contents_flag |= DI_FORMAT; } else { contents_flag |= DD_FORMAT; } if (pColors_tmp->format != format) { contents_flag |= MIX_FORMAT; } } /* * Check if we need the Client White Point. */ if ((contents_flag & DI_FORMAT) || XCMS_DI_ID(targetFormat)) { /* To proceed, we need to get the Client White Point */ memcpy((char *)&clientWhitePt, (char *)&ccc->clientWhitePt, sizeof(XcmsColor)); if (clientWhitePt.format == XcmsUndefinedFormat) { /* * Client White Point is undefined, therefore set to the Screen * White Point. * Since Client White Point == Screen White Point, WhiteAdjustProc * is not called. */ memcpy((char *)&clientWhitePt, (char *)&ccc->pPerScrnInfo->screenWhitePt, sizeof(XcmsColor)); } else if ((ccc->whitePtAdjProc != NULL) && !_XcmsEqualWhitePts(ccc, &clientWhitePt, ScreenWhitePointOfCCC(ccc))) { /* * Client White Point != Screen White Point, and WhiteAdjustProc * is not NULL, therefore, will need to call it when * converting between DI and DD specifications. */ callWhiteAdjustProc = 1; } } /* * Make copy of array of color specifications */ if (nColors > 1) { pColors_tmp = Xmalloc(nColors * sizeof(XcmsColor)); } else { pColors_tmp = &Color1; } memcpy((char *)pColors_tmp, (char *)pColors_in_out, nColors * sizeof(XcmsColor)); /* * zero out pCompressed */ if (pCompressed) { bzero((char *)pCompressed, nColors * sizeof(Bool)); } if (contents_flag == DD_FORMAT || contents_flag == DI_FORMAT) { /* * ENTIRE ARRAY IS IN ONE FORMAT. */ if (XCMS_DI_ID(format) && XCMS_DI_ID(targetFormat)) { /* * DI-to-DI only conversion */ retval = _XcmsDIConvertColors(ccc, pColors_tmp, &clientWhitePt, nColors, targetFormat); } else if (XCMS_DD_ID(format) && XCMS_DD_ID(targetFormat)) { /* * DD-to-DD only conversion * Since DD->DD there will be no compressed thus we can * pass NULL instead of pCompressed. */ retval = _XcmsDDConvertColors(ccc, pColors_tmp, nColors, targetFormat, (Bool *)NULL); } else { /* * Otherwise we have: * 1. Device-Independent to Device-Dependent Conversion * OR * 2. Device-Dependent to Device-Independent Conversion * * We need to go from oldFormat -> CIEXYZ -> targetFormat * adjusting for white points as necessary. */ if (XCMS_DI_ID(format)) { /* * 1. Device-Independent to Device-Dependent Conversion */ if (callWhiteAdjustProc) { /* * White Point Adjustment * Client White Point to Screen White Point */ retval = (*ccc->whitePtAdjProc)(ccc, &clientWhitePt, ScreenWhitePointOfCCC(ccc), targetFormat, pColors_tmp, nColors, pCompressed); } else { if (_XcmsDIConvertColors(ccc, pColors_tmp, &clientWhitePt, nColors, XcmsCIEXYZFormat) == XcmsFailure) { goto Failure; } retval = _XcmsDDConvertColors(ccc, pColors_tmp, nColors, targetFormat, pCompressed); } } else { /* * 2. Device-Dependent to Device-Independent Conversion */ if (callWhiteAdjustProc) { /* * White Point Adjustment * Screen White Point to Client White Point */ retval = (*ccc->whitePtAdjProc)(ccc, ScreenWhitePointOfCCC(ccc), &clientWhitePt, targetFormat, pColors_tmp, nColors, pCompressed); } else { /* * Since DD->CIEXYZ, no compression takes place therefore * we can pass NULL instead of pCompressed. */ if (_XcmsDDConvertColors(ccc, pColors_tmp, nColors, XcmsCIEXYZFormat, (Bool *)NULL) == XcmsFailure) { goto Failure; } retval = _XcmsDIConvertColors(ccc, pColors_tmp, &clientWhitePt, nColors, targetFormat); } } } } else { /* * ARRAY HAS MIXED FORMATS. */ if ((contents_flag == (DI_FORMAT | MIX_FORMAT)) && XCMS_DI_ID(targetFormat)) { /* * Convert from DI to DI in batches of contiguous formats * * Because DI->DI, WhiteAdjustProc not called. */ retval = ConvertMixedColors(ccc, pColors_tmp, &clientWhitePt, nColors, targetFormat, (unsigned char)DI_FORMAT); } else if ((contents_flag == (DD_FORMAT | MIX_FORMAT)) && XCMS_DD_ID(targetFormat)) { /* * Convert from DD to DD in batches of contiguous formats * * Because DD->DD, WhiteAdjustProc not called. */ retval = ConvertMixedColors(ccc, pColors_tmp, (XcmsColor *)NULL, nColors, targetFormat, (unsigned char)DD_FORMAT); } else if (XCMS_DI_ID(targetFormat)) { /* * We need to convert from DI-to-DI and DD-to-DI, therefore * 1. convert DD specifications to CIEXYZ, then * 2. convert all in batches to the target DI format. * * Note that ConvertMixedColors will call WhiteAdjustProc * as necessary. */ /* * Convert only DD specifications in batches of contiguous formats * to CIEXYZ * * Since DD->CIEXYZ, ConvertMixedColors will apply WhiteAdjustProc * if required. */ retval = ConvertMixedColors(ccc, pColors_tmp, &clientWhitePt, nColors, XcmsCIEXYZFormat, (unsigned char)DD_FORMAT); /* * Because at this point we may have a mix of DI formats * (e.g., CIEXYZ, CIELuv) we must convert the specs to the * target DI format in batches of contiguous source formats. */ retval = ConvertMixedColors(ccc, pColors_tmp, &clientWhitePt, nColors, targetFormat, (unsigned char)DI_FORMAT); } else { /* * We need to convert from DI-to-DD and DD-to-DD, therefore * 1. convert DI specifications to CIEXYZ, then * 2. convert all to the DD target format. * * This allows white point adjustment and gamut compression * to be applied to all the color specifications in one * swoop if those functions do in fact modify the entire * group of color specifications. */ /* * Convert in batches to CIEXYZ * * If DD->CIEXYZ, ConvertMixedColors will apply WhiteAdjustProc * if required. */ if ((retval = ConvertMixedColors(ccc, pColors_tmp, &clientWhitePt, nColors, XcmsCIEXYZFormat, (unsigned char)(DI_FORMAT | DD_FORMAT))) == XcmsFailure) { goto Failure; } /* * Convert all specifications (now in CIEXYZ format) to * the target DD format. * Since CIEXYZ->DD, compression MAY take place therefore * we must pass pCompressed. * Note that WhiteAdjustProc must be used if necessary. */ if (callWhiteAdjustProc) { /* * White Point Adjustment * Client White Point to Screen White Point */ retval = (*ccc->whitePtAdjProc)(ccc, &clientWhitePt, ScreenWhitePointOfCCC(ccc), targetFormat, pColors_tmp, nColors, pCompressed); } else { retval = _XcmsDDConvertColors(ccc, pColors_tmp, nColors, targetFormat, pCompressed); } } } if (retval != XcmsFailure) { memcpy((char *)pColors_in_out, (char *)pColors_tmp, nColors * sizeof(XcmsColor)); } if (nColors > 1) { Xfree(pColors_tmp); } return(retval); Failure: if (nColors > 1) { Xfree(pColors_tmp); } return(XcmsFailure); } /* * NAME * XcmsRegFormatOfPrefix * * SYNOPSIS */ XcmsColorFormat _XcmsRegFormatOfPrefix( _Xconst char *prefix) /* * DESCRIPTION * Returns a color space ID associated with the specified * X Consortium registered color space prefix. * * RETURNS * The color space ID if found; * otherwise NULL. */ { XcmsRegColorSpaceEntry *pEntry = _XcmsRegColorSpaces; while (pEntry->prefix != NULL) { if (strcmp(prefix, pEntry->prefix) == 0) { return(pEntry->id); } pEntry++; } return(XcmsUndefinedFormat); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/CvColW.c0000644000000000000000000001003713614532331015114 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * * NAME * XcmsCvColW.c * * DESCRIPTION * * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * API PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * _XcmsConvertColorsWithWhitePt - Convert XcmsColor structures * * SYNOPSIS */ Status _XcmsConvertColorsWithWhitePt( XcmsCCC ccc, XcmsColor *pColors_in_out, XcmsColor *pWhitePt, unsigned int nColors, XcmsColorFormat newFormat, Bool *pCompressed) /* * DESCRIPTION * Convert XcmsColor structures between device-independent * and/or device-dependent formats but allowing the calling * routine to specify the white point to be associated * with the color specifications (overriding * ccc->clientWhitePt). * * This routine has been provided for use in white point * adjustment routines. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded without gamut compression, * XcmsSuccessWithCompression if succeeded with gamut * compression. * */ { if (ccc == NULL || pColors_in_out == NULL || pColors_in_out->format == XcmsUndefinedFormat) { return(XcmsFailure); } if (nColors == 0 || pColors_in_out->format == newFormat) { /* do nothing */ return(XcmsSuccess); } if (XCMS_DI_ID(pColors_in_out->format) && XCMS_DI_ID(newFormat)) { /* * Device-Independent to Device-Independent Conversion */ return(_XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors, newFormat)); } if (XCMS_DD_ID(pColors_in_out->format) && XCMS_DD_ID(newFormat)) { /* * Device-Dependent to Device-Dependent Conversion */ return(_XcmsDDConvertColors(ccc, pColors_in_out, nColors, newFormat, pCompressed)); } /* * Otherwise we have: * 1. Device-Independent to Device-Dependent Conversion * OR * 2. Device-Dependent to Device-Independent Conversion */ if (XCMS_DI_ID(pColors_in_out->format)) { /* * 1. Device-Independent to Device-Dependent Conversion */ /* First convert to CIEXYZ */ if (_XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors, XcmsCIEXYZFormat) == XcmsFailure) { return(XcmsFailure); } /* Then convert to DD Format */ return(_XcmsDDConvertColors(ccc, pColors_in_out, nColors, newFormat, pCompressed)); } else { /* * 2. Device-Dependent to Device-Independent Conversion */ /* First convert to CIEXYZ */ if (_XcmsDDConvertColors(ccc, pColors_in_out, nColors, XcmsCIEXYZFormat, pCompressed) == XcmsFailure) { return(XcmsFailure); } /* Then convert to DI Format */ return(_XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors, newFormat)); } } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/Cv.h0000644000000000000000000001115713614532331014340 0ustar #ifndef _CV_H_ #define _CV_H_ /* variables */ extern const char _XcmsCIEXYZ_prefix[]; extern const char _XcmsCIEuvY_prefix[]; extern const char _XcmsCIExyY_prefix[]; extern const char _XcmsCIELab_prefix[]; extern const char _XcmsCIELuv_prefix[]; extern const char _XcmsTekHVC_prefix[]; extern const char _XcmsRGBi_prefix[]; extern const char _XcmsRGB_prefix[]; extern XcmsColorSpace XcmsUNDEFINEDColorSpace; extern XcmsColorSpace XcmsTekHVCColorSpace; extern XcmsColorSpace XcmsCIEXYZColorSpace; extern XcmsColorSpace XcmsCIEuvYColorSpace; extern XcmsColorSpace XcmsCIExyYColorSpace; extern XcmsColorSpace XcmsCIELabColorSpace; extern XcmsColorSpace XcmsCIELuvColorSpace; extern XcmsColorSpace XcmsRGBColorSpace; extern XcmsColorSpace XcmsRGBiColorSpace; extern XcmsColorSpace *_XcmsDIColorSpacesInit[]; extern XcmsColorSpace **_XcmsDIColorSpaces; extern XcmsColorSpace *_XcmsDDColorSpacesInit[]; extern XcmsColorSpace **_XcmsDDColorSpaces; extern XcmsFunctionSet XcmsLinearRGBFunctionSet; extern XcmsFunctionSet *_XcmsSCCFuncSetsInit[]; extern XcmsFunctionSet **_XcmsSCCFuncSets; extern XcmsRegColorSpaceEntry _XcmsRegColorSpaces[]; /* functions */ extern XPointer * _XcmsCopyPointerArray( XPointer *pap); extern void _XcmsFreePointerArray( XPointer *pap); extern XPointer * _XcmsPushPointerArray( XPointer *pap, XPointer p, XPointer *papNoFree); extern Status _XcmsCIEXYZ_ValidSpec( XcmsColor *pColor); extern Status _XcmsCIEuvY_ValidSpec( XcmsColor *pColor); extern int _XcmsTekHVC_CheckModify( XcmsColor *pColor); extern Status _XcmsTekHVCQueryMaxVCRGB( XcmsCCC ccc, XcmsFloat hue, XcmsColor *pColor_return, XcmsRGBi *pRGB_return); extern Status _XcmsCIELabQueryMaxLCRGB( XcmsCCC ccc, XcmsFloat hue, /* hue in radians */ XcmsColor *pColor_return, XcmsRGBi *pRGB_return); extern Status _XcmsConvertColorsWithWhitePt( XcmsCCC ccc, XcmsColor *pColors_in_out, XcmsColor *pWhitePt, unsigned int nColors, XcmsColorFormat newFormat, Bool *pCompressed); extern Status _XcmsDIConvertColors( XcmsCCC ccc, XcmsColor *pColors_in_out, XcmsColor *pWhitePt, unsigned int nColors, XcmsColorFormat newFormat); extern Status _XcmsDDConvertColors( XcmsCCC ccc, XcmsColor *pColors_in_out, unsigned int nColors, XcmsColorFormat newFormat, Bool *pCompressed); extern XcmsColorFormat _XcmsRegFormatOfPrefix( _Xconst char *prefix); extern void _XColor_to_XcmsRGB( XcmsCCC ccc, XColor *pXColors, XcmsColor *pColors, unsigned int nColors); extern Status _XcmsSetGetColor( Status (*xColorProc)( Display* /* display */, Colormap /* colormap */, XColor* /* screen_in_out */), Display *dpy, Colormap cmap, XcmsColor *pColors_in_out, XcmsColorFormat result_format, Bool *pCompressed); extern Status _XcmsSetGetColors( Status (*xColorProc)( Display* /* display */, Colormap /* colormap */, XColor* /* screen_in_out */, int /* nColors */), Display *dpy, Colormap cmap, XcmsColor *pColors_in_out, int nColors, XcmsColorFormat result_format, Bool *pCompressed); extern Status _XcmsCIELuvQueryMaxLCRGB( XcmsCCC ccc, XcmsFloat hue, /* hue in radians */ XcmsColor *pColor_return, XcmsRGBi *pRGB_return); extern XcmsIntensityMap * _XcmsGetIntensityMap( Display *dpy, Visual *visual); extern int _XcmsInitDefaultCCCs( Display *dpy); extern int _XcmsInitScrnInfo( register Display *dpy, int screenNumber); extern XcmsCmapRec * _XcmsCopyCmapRecAndFree( Display *dpy, Colormap src_cmap, Colormap copy_cmap); extern void _XcmsCopyISOLatin1Lowered( char *dst, const char *src); extern int _XcmsEqualWhitePts( XcmsCCC ccc, XcmsColor *pWhitePt1, XcmsColor *pWhitePt2); extern int _XcmsLRGB_InitScrnDefault( Display *dpy, int screenNumber, XcmsPerScrnInfo *pPerScrnInfo); extern void _XcmsFreeIntensityMaps( Display *dpy); extern int _XcmsGetProperty( Display *pDpy, Window w, Atom property, int *pFormat, unsigned long *pNItems, unsigned long *pNBytes, char **pValue); extern unsigned long _XcmsGetElement( int format, char **pValue, unsigned long *pCount); extern void _XcmsUnresolveColor( XcmsCCC ccc, XcmsColor *pColor); extern void _XcmsResolveColor( XcmsCCC ccc, XcmsColor *pXcmsColor); #endif /* _CV_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/xcms/HVC.c0000644000000000000000000003736713614532331014416 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. TekColor is a * trademark of Tektronix, Inc. The term "TekHVC" designates a particular * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent * foreign patents pending). Permission is hereby granted to use, copy, * modify, sell, and otherwise distribute this software and its * documentation for any purpose and without fee, provided that: * * 1. This copyright, permission, and disclaimer notice is reproduced in * all copies of this software and any modification thereof and in * supporting documentation; * 2. Any color-handling application which displays TekHVC color * cooordinates identifies these as TekHVC color coordinates in any * interface that displays these coordinates and in any associated * documentation; * 3. The term "TekHVC" is always used, and is only used, in association * with the mathematical derivations of the TekHVC Color Space, * including those provided in this file and any equivalent pathways and * mathematical derivations, regardless of digital (e.g., floating point * or integer) representation. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * TekHVC.c * * DESCRIPTION * This file contains routines that support the TekHVC * color space to include conversions to and from the CIE * XYZ space. * * DOCUMENTATION * "TekColor Color Management System, System Implementor's Manual" */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include #include #include "Cv.h" #include /* * DEFINES */ #define u_BR 0.7127 /* u' Best Red */ #define v_BR 0.4931 /* v' Best Red */ #define EPS 0.001 #define CHROMA_SCALE_FACTOR 7.50725 #ifndef PI # ifdef M_PI # define PI M_PI # else # define PI 3.14159265358979323846264338327950 # endif #endif #ifndef degrees # define degrees(r) ((XcmsFloat)(r) * 180.0 / PI) #endif /* degrees */ #ifndef radians # define radians(d) ((XcmsFloat)(d) * PI / 180.0) #endif /* radians */ /************************************************************************* * Note: The DBL_EPSILON for ANSI is 1e-5 so my checks need to take * this into account. If your DBL_EPSILON is different then * adjust this define. * * Also note that EPS is the error factor in the calculations * This may need to be the same as XMY_DBL_EPSILON in * some implementations. **************************************************************************/ #ifdef DBL_EPSILON # define XMY_DBL_EPSILON DBL_EPSILON #else # define XMY_DBL_EPSILON 0.00001 #endif /* * FORWARD DECLARATIONS */ static int TekHVC_ParseString(register char *spec, XcmsColor *pColor); static Status XcmsTekHVC_ValidSpec(XcmsColor *pColor); /* * LOCAL VARIABLES */ /* * NULL terminated list of functions applied to get from TekHVC to CIEXYZ */ static XcmsConversionProc Fl_TekHVC_to_CIEXYZ[] = { XcmsTekHVCToCIEuvY, XcmsCIEuvYToCIEXYZ, NULL }; /* * NULL terminated list of functions applied to get from CIEXYZ to TekHVC */ static XcmsConversionProc Fl_CIEXYZ_to_TekHVC[] = { XcmsCIEXYZToCIEuvY, XcmsCIEuvYToTekHVC, NULL }; /* * GLOBALS */ /* * TekHVC Color Space */ XcmsColorSpace XcmsTekHVCColorSpace = { _XcmsTekHVC_prefix, /* prefix */ XcmsTekHVCFormat, /* id */ TekHVC_ParseString, /* parseString */ Fl_TekHVC_to_CIEXYZ, /* to_CIEXYZ */ Fl_CIEXYZ_to_TekHVC, /* from_CIEXYZ */ 1 }; /************************************************************************ * * * PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * TekHVC_ParseString * * SYNOPSIS */ static int TekHVC_ParseString( register char *spec, XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert * it into a XcmsColor structure with XcmsTekHVCFormat. * The assumed TekHVC string syntax is: * TekHVC:// * Where H, V, and C are in string input format for floats * consisting of: * a. an optional sign * b. a string of numbers possibly containing a decimal point, * c. an optional exponent field containing an 'E' or 'e' * followed by a possibly signed integer string. * * RETURNS * XcmsFailure if invalid; * XcmsSuccess if valid. */ { size_t n; char *pchar; if ((pchar = strchr(spec, ':')) == NULL) { return(XcmsFailure); } n = (size_t)(pchar - spec); /* * Check for proper prefix. */ if (strncmp(spec, _XcmsTekHVC_prefix, n) != 0) { return(XcmsFailure); } /* * Attempt to parse the value portion. */ if (sscanf(spec + n + 1, "%lf/%lf/%lf", &pColor->spec.TekHVC.H, &pColor->spec.TekHVC.V, &pColor->spec.TekHVC.C) != 3) { char *s; /* Maybe failed due to locale */ int f; if ((s = strdup(spec))) { for (f = 0; s[f]; ++f) if (s[f] == '.') s[f] = ','; else if (s[f] == ',') s[f] = '.'; if (sscanf(s + n + 1, "%lf/%lf/%lf", &pColor->spec.TekHVC.H, &pColor->spec.TekHVC.V, &pColor->spec.TekHVC.C) != 3) { free(s); return(XcmsFailure); } free(s); } else return(XcmsFailure); } pColor->format = XcmsTekHVCFormat; pColor->pixel = 0; return(XcmsTekHVC_ValidSpec(pColor)); } /* * NAME * ThetaOffset -- compute thetaOffset * * SYNOPSIS */ static int ThetaOffset( XcmsColor *pWhitePt, XcmsFloat *pThetaOffset) /* * DESCRIPTION * This routine computes the theta offset of a given * white point, i.e. XcmsColor. It is used in both this * conversion and the printer conversions. * * RETURNS * 0 if failed. * 1 if succeeded with no modifications. * * ASSUMPTIONS * Assumes: * pWhitePt != NULL * pWhitePt->format == XcmsCIEuvYFormat * */ { double div, slopeuv; if (pWhitePt == NULL || pWhitePt->format != XcmsCIEuvYFormat) { return(0); } if ((div = u_BR - pWhitePt->spec.CIEuvY.u_prime) == 0.0) { return(0); } slopeuv = (v_BR - pWhitePt->spec.CIEuvY.v_prime) / div; *pThetaOffset = degrees(XCMS_ATAN(slopeuv)); return(1); } /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsTekHVC_ValidSpec() * * SYNOPSIS */ static int XcmsTekHVC_ValidSpec( XcmsColor *pColor) /* * DESCRIPTION * Checks if values in the color specification are valid. * Also brings hue into the range 0.0 <= Hue < 360.0 * * RETURNS * 0 if not valid. * 1 if valid. * */ { if (pColor->format != XcmsTekHVCFormat) { return(XcmsFailure); } if (pColor->spec.TekHVC.V < (0.0 - XMY_DBL_EPSILON) || pColor->spec.TekHVC.V > (100.0 + XMY_DBL_EPSILON) || (pColor->spec.TekHVC.C < 0.0 - XMY_DBL_EPSILON)) { return(XcmsFailure); } if (pColor->spec.TekHVC.V < 0.0) { pColor->spec.TekHVC.V = 0.0 + XMY_DBL_EPSILON; } else if (pColor->spec.TekHVC.V > 100.0) { pColor->spec.TekHVC.V = 100.0 - XMY_DBL_EPSILON; } if (pColor->spec.TekHVC.C < 0.0) { pColor->spec.TekHVC.C = 0.0 - XMY_DBL_EPSILON; } while (pColor->spec.TekHVC.H < 0.0) { pColor->spec.TekHVC.H += 360.0; } while (pColor->spec.TekHVC.H >= 360.0) { pColor->spec.TekHVC.H -= 360.0; } return(XcmsSuccess); } /* * NAME * XcmsTekHVCToCIEuvY - convert TekHVC to CIEuvY * * SYNOPSIS */ Status XcmsTekHVCToCIEuvY( XcmsCCC ccc, XcmsColor *pHVC_WhitePt, XcmsColor *pColors_in_out, unsigned int nColors) /* * DESCRIPTION * Transforms an array of TekHVC color specifications, given * their associated white point, to CIECIEuvY.color * specifications. * * RETURNS * XcmsFailure if failed, XcmsSuccess otherwise. * */ { XcmsFloat thetaOffset; XcmsColor *pColor = pColors_in_out; XcmsColor whitePt; XcmsCIEuvY uvY_return; XcmsFloat tempHue, u, v; XcmsFloat tmpVal; unsigned int i; /* * Check arguments */ if (pHVC_WhitePt == NULL || pColors_in_out == NULL) { return(XcmsFailure); } /* * Make sure white point is in CIEuvY form */ if (pHVC_WhitePt->format != XcmsCIEuvYFormat) { /* Make copy of the white point because we're going to modify it */ memcpy((char *)&whitePt, (char *)pHVC_WhitePt, sizeof(XcmsColor)); if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, XcmsCIEuvYFormat)) { return(XcmsFailure); } pHVC_WhitePt = &whitePt; } /* Make sure it is a white point, i.e., Y == 1.0 */ if (pHVC_WhitePt->spec.CIEuvY.Y != 1.0) { return(XcmsFailure); } /* Get the thetaOffset */ if (!ThetaOffset(pHVC_WhitePt, &thetaOffset)) { return(XcmsFailure); } /* * Now convert each XcmsColor structure to CIEXYZ form */ for (i = 0; i < nColors; i++, pColor++) { /* Make sure original format is TekHVC and is valid */ if (!XcmsTekHVC_ValidSpec(pColor)) { return(XcmsFailure); } if (pColor->spec.TekHVC.V == 0.0 || pColor->spec.TekHVC.V == 100.0) { if (pColor->spec.TekHVC.V == 100.0) { uvY_return.Y = 1.0; } else { /* pColor->spec.TekHVC.V == 0.0 */ uvY_return.Y = 0.0; } uvY_return.u_prime = pHVC_WhitePt->spec.CIEuvY.u_prime; uvY_return.v_prime = pHVC_WhitePt->spec.CIEuvY.v_prime; } else { /* Find the hue based on the white point offset */ tempHue = pColor->spec.TekHVC.H + thetaOffset; while (tempHue < 0.0) { tempHue += 360.0; } while (tempHue >= 360.0) { tempHue -= 360.0; } tempHue = radians(tempHue); /* Calculate u'v' for the obtained hue */ u = (XcmsFloat) ((XCMS_COS(tempHue) * pColor->spec.TekHVC.C) / (pColor->spec.TekHVC.V * (double)CHROMA_SCALE_FACTOR)); v = (XcmsFloat) ((XCMS_SIN(tempHue) * pColor->spec.TekHVC.C) / (pColor->spec.TekHVC.V * (double)CHROMA_SCALE_FACTOR)); /* Based on the white point get the offset from best red */ uvY_return.u_prime = u + pHVC_WhitePt->spec.CIEuvY.u_prime; uvY_return.v_prime = v + pHVC_WhitePt->spec.CIEuvY.v_prime; /* Calculate the Y value based on the L* = V. */ if (pColor->spec.TekHVC.V < 7.99953624) { uvY_return.Y = pColor->spec.TekHVC.V / 903.29; } else { tmpVal = (pColor->spec.TekHVC.V + 16.0) / 116.0; uvY_return.Y = tmpVal * tmpVal * tmpVal; /* tmpVal ** 3 */ } } /* Copy result to pColor */ memcpy((char *)&pColor->spec, (char *)&uvY_return, sizeof(XcmsCIEuvY)); /* Identify that the format is now CIEuvY */ pColor->format = XcmsCIEuvYFormat; } return(XcmsSuccess); } /* * NAME * XcmsCIEuvYToTekHVC - convert CIEuvY to TekHVC * * SYNOPSIS */ Status XcmsCIEuvYToTekHVC( XcmsCCC ccc, XcmsColor *pHVC_WhitePt, XcmsColor *pColors_in_out, unsigned int nColors) /* * DESCRIPTION * Transforms an array of CIECIEuvY.color specifications, given * their assiciated white point, to TekHVC specifications. * * RETURNS * XcmsFailure if failed, XcmsSuccess otherwise. * */ { XcmsFloat theta, L2, u, v, nThetaLow, nThetaHigh; XcmsFloat thetaOffset; XcmsColor *pColor = pColors_in_out; XcmsColor whitePt; XcmsTekHVC HVC_return; unsigned int i; /* * Check arguments */ if (pHVC_WhitePt == NULL || pColors_in_out == NULL) { return(XcmsFailure); } /* * Make sure white point is in CIEuvY form */ if (pHVC_WhitePt->format != XcmsCIEuvYFormat) { /* Make copy of the white point because we're going to modify it */ memcpy((char *)&whitePt, (char *)pHVC_WhitePt, sizeof(XcmsColor)); if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, XcmsCIEuvYFormat)) { return(XcmsFailure); } pHVC_WhitePt = &whitePt; } /* Make sure it is a white point, i.e., Y == 1.0 */ if (pHVC_WhitePt->spec.CIEuvY.Y != 1.0) { return(XcmsFailure); } if (!ThetaOffset(pHVC_WhitePt, &thetaOffset)) { return(XcmsFailure); } /* * Now convert each XcmsColor structure to CIEXYZ form */ for (i = 0; i < nColors; i++, pColor++) { if (!_XcmsCIEuvY_ValidSpec(pColor)) { return(XcmsFailure); } /* Use the white point offset to determine HVC */ u = pColor->spec.CIEuvY.u_prime - pHVC_WhitePt->spec.CIEuvY.u_prime; v = pColor->spec.CIEuvY.v_prime - pHVC_WhitePt->spec.CIEuvY.v_prime; /* Calculate the offset */ if (u == 0.0) { theta = 0.0; } else { theta = v / u; theta = (XcmsFloat) XCMS_ATAN((double)theta); theta = degrees(theta); } nThetaLow = 0.0; nThetaHigh = 360.0; if (u > 0.0 && v > 0.0) { nThetaLow = 0.0; nThetaHigh = 90.0; } else if (u < 0.0 && v > 0.0) { nThetaLow = 90.0; nThetaHigh = 180.0; } else if (u < 0.0 && v < 0.0) { nThetaLow = 180.0; nThetaHigh = 270.0; } else if (u > 0.0 && v < 0.0) { nThetaLow = 270.0; nThetaHigh = 360.0; } while (theta < nThetaLow) { theta += 90.0; } while (theta >= nThetaHigh) { theta -= 90.0; } /* calculate the L value from the given Y */ L2 = (pColor->spec.CIEuvY.Y < 0.008856) ? (pColor->spec.CIEuvY.Y * 903.29) : ((XcmsFloat)(XCMS_CUBEROOT(pColor->spec.CIEuvY.Y) * 116.0) - 16.0); HVC_return.C = L2 * CHROMA_SCALE_FACTOR * XCMS_SQRT((double) ((u * u) + (v * v))); if (HVC_return.C < 0.0) { theta = 0.0; } HVC_return.V = L2; HVC_return.H = theta - thetaOffset; /* * If this is within the error margin let some other routine later * in the chain worry about the slop in the calculations. */ while (HVC_return.H < -EPS) { HVC_return.H += 360.0; } while (HVC_return.H >= 360.0 + EPS) { HVC_return.H -= 360.0; } /* Copy result to pColor */ memcpy((char *)&pColor->spec, (char *)&HVC_return, sizeof(XcmsTekHVC)); /* Identify that the format is now CIEuvY */ pColor->format = XcmsTekHVCFormat; } return(XcmsSuccess); } /* * NAME * _XcmsTekHVC_CheckModify * * SYNOPSIS */ int _XcmsTekHVC_CheckModify( XcmsColor *pColor) /* * DESCRIPTION * Checks if values in the color specification are valid. * If they are not it modifies the values. * Also brings hue into the range 0.0 <= Hue < 360.0 * * RETURNS * 0 if not valid. * 1 if valid. * */ { int n; /* For now only use the TekHVC numbers as inputs */ if (pColor->format != XcmsTekHVCFormat) { return(0); } if (pColor->spec.TekHVC.V < 0.0) { pColor->spec.TekHVC.V = 0.0 + XMY_DBL_EPSILON; } else if (pColor->spec.TekHVC.V > 100.0) { pColor->spec.TekHVC.V = 100.0 - XMY_DBL_EPSILON; } if (pColor->spec.TekHVC.C < 0.0) { pColor->spec.TekHVC.C = 0.0 - XMY_DBL_EPSILON; } if (pColor->spec.TekHVC.H < 0.0) { n = -pColor->spec.TekHVC.H / 360.0; pColor->spec.TekHVC.H += (n + 1) * 360.0; if (pColor->spec.TekHVC.H >= 360.0) pColor->spec.TekHVC.H -= 360.0; } else if (pColor->spec.TekHVC.H >= 360.0) { n = pColor->spec.TekHVC.H / 360.0; pColor->spec.TekHVC.H -= n * 360.0; } return(1); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/HVCGcC.c0000644000000000000000000001123413614532331014754 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. TekColor is a * trademark of Tektronix, Inc. The term "TekHVC" designates a particular * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent * foreign patents pending). Permission is hereby granted to use, copy, * modify, sell, and otherwise distribute this software and its * documentation for any purpose and without fee, provided that: * * 1. This copyright, permission, and disclaimer notice is reproduced in * all copies of this software and any modification thereof and in * supporting documentation; * 2. Any color-handling application which displays TekHVC color * cooordinates identifies these as TekHVC color coordinates in any * interface that displays these coordinates and in any associated * documentation; * 3. The term "TekHVC" is always used, and is only used, in association * with the mathematical derivations of the TekHVC Color Space, * including those provided in this file and any equivalent pathways and * mathematical derivations, regardless of digital (e.g., floating point * or integer) representation. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * TekHVCGcC.c * * DESCRIPTION * Source for XcmsTekHVCClipC() gamut compression routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsTekHVCClipC - Reduce the chroma for a hue and value * * SYNOPSIS */ /* ARGSUSED */ Status XcmsTekHVCClipC ( XcmsCCC ccc, XcmsColor *pColors_in_out, unsigned int nColors, unsigned int i, Bool *pCompressed) /* * DESCRIPTION * Reduce the Chroma for a specific hue and value to * to bring the given color into the gamut of the * specified device. As required of gamut compression * functions in Xcms, this routine returns pColor_in_out * in XcmsCIEXYZFormat on successful completion. * * Since this routine works with the value within * pColor_in_out intermediate results may be returned * even though it may be invalid. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { Status retval; XcmsColor *pColor; /* * Color specification passed as input can be assumed to: * 1. Be in XcmsCIEXYZFormat * 2. Already be white point adjusted for the Screen White Point. * This means that the white point now associated with this * color spec is the Screen White Point (even if the * ccc->clientWhitePt differs). */ /* * Insure TekHVC installed */ if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { return(XcmsFailure); } pColor = pColors_in_out + i; if (ccc->visual->class < StaticColor && FunctionSetOfCCC(ccc) != (XPointer) &XcmsLinearRGBFunctionSet) { /* * GRAY ! */ _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat); pColor->spec.TekHVC.H = pColor->spec.TekHVC.C = 0.0; _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); if (pCompressed) { *(pCompressed + i) = True; } return(XcmsSuccess); } else { if (pColor->format != XcmsTekHVCFormat) { if (_XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat) == XcmsFailure) { return(XcmsFailure); } } if (XcmsTekHVCQueryMaxC(ccc, pColor->spec.TekHVC.H, pColor->spec.TekHVC.V, pColor) == XcmsFailure) { return(XcmsFailure); } retval = _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); if (retval != XcmsFailure && pCompressed != NULL) { *(pCompressed + i) = True; } return(retval); } } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/HVCGcV.c0000644000000000000000000001546613614532331015012 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. TekColor is a * trademark of Tektronix, Inc. The term "TekHVC" designates a particular * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent * foreign patents pending). Permission is hereby granted to use, copy, * modify, sell, and otherwise distribute this software and its * documentation for any purpose and without fee, provided that: * * 1. This copyright, permission, and disclaimer notice is reproduced in * all copies of this software and any modification thereof and in * supporting documentation; * 2. Any color-handling application which displays TekHVC color * cooordinates identifies these as TekHVC color coordinates in any * interface that displays these coordinates and in any associated * documentation; * 3. The term "TekHVC" is always used, and is only used, in association * with the mathematical derivations of the TekHVC Color Space, * including those provided in this file and any equivalent pathways and * mathematical derivations, regardless of digital (e.g., floating point * or integer) representation. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * TekHVCGcV.c * * DESCRIPTION * Source for XcmsTekHVCClipV() gamut compression routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsTekHVCClipV - Return the closest value * * SYNOPSIS */ /* ARGSUSED */ Status XcmsTekHVCClipV ( XcmsCCC ccc, XcmsColor *pColors_in_out, unsigned int nColors, unsigned int i, Bool *pCompressed) /* * DESCRIPTION * Return the closest value for a specific hue and chroma. * This routine takes any color as input and outputs * a CIE XYZ color. * * Since this routine works with the value within * pColor_in_out intermediate results may be returned * even though it may be invalid. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { XcmsColor *pColor; XcmsColor hvc_max; XcmsCCCRec myCCC; Status retval; /* * Insure TekHVC installed */ if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { return(XcmsFailure); } /* Use my own CCC */ memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* Inherit Screen WP */ myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression */ /* * Color specification passed as input can be assumed to: * 1. Be in XcmsCIEXYZFormat * 2. Already be white point adjusted for the Screen White Point. * This means that the white point now associated with this * color spec is the Screen White Point (even if the * ccc->clientWhitePt differs). */ pColor = pColors_in_out + i; if (ccc->visual->class < StaticColor && FunctionSetOfCCC(ccc) != (XPointer) &XcmsLinearRGBFunctionSet) { /* * GRAY ! */ return(XcmsFailure); } else { /* Convert from CIEXYZ to TekHVC format */ if (_XcmsDIConvertColors(&myCCC, pColor, &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat) == XcmsFailure) { return(XcmsFailure); } /* check to make sure we have a valid TekHVC number */ if (!_XcmsTekHVC_CheckModify (pColor)) { return (XcmsFailure); } /* Step 1: compute the maximum value and chroma for this hue. */ /* This copy may be overkill but it preserves the pixel etc. */ memcpy((char *)&hvc_max, (char *)pColor, sizeof(XcmsColor)); if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, hvc_max.spec.TekHVC.H, &hvc_max, (XcmsRGBi *)NULL) == XcmsFailure) { return (XcmsFailure); } /* Now check and return the appropriate value */ if (pColor->spec.TekHVC.C == hvc_max.spec.TekHVC.C) { /* When the chroma input is equal to the maximum chroma */ /* merely return the value for that chroma. */ pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; if (!_XcmsTekHVC_CheckModify (pColor)) { return (XcmsFailure); } retval = _XcmsDIConvertColors(&myCCC, pColor, &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); } else if (pColor->spec.TekHVC.C > hvc_max.spec.TekHVC.C) { /* When the chroma input is greater than the maximum chroma */ /* merely return the value and chroma for the given hue. */ pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; return (XcmsFailure); } else if (pColor->spec.TekHVC.V < hvc_max.spec.TekHVC.V) { /* When the value input is less than the maximum value point */ /* compute the intersection of the line from 0,0 to max_V, max_C */ /* using the chroma input. */ pColor->spec.TekHVC.V = pColor->spec.TekHVC.C * hvc_max.spec.TekHVC.V / hvc_max.spec.TekHVC.C; if (pColor->spec.TekHVC.V >= hvc_max.spec.TekHVC.V) { pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; } if (!_XcmsTekHVC_CheckModify (pColor)) { return (XcmsFailure); } retval = _XcmsDIConvertColors(&myCCC, pColor, &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); } else { /* When the value input is greater than the maximum value point */ /* use HvcMaxValue to find the maximum value for the given chroma. */ if (pColor->format != XcmsTekHVCFormat) { if (_XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat) == XcmsFailure) { return(XcmsFailure); } } if (XcmsTekHVCQueryMaxV(&myCCC, pColor->spec.TekHVC.H, pColor->spec.TekHVC.C, pColor) == XcmsFailure) { return (XcmsFailure); } retval = _XcmsDIConvertColors(&myCCC, pColor, &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); } if (retval != XcmsFailure && pCompressed != NULL) { *(pCompressed + i) = True; } return(retval); } } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/HVCGcVC.c0000644000000000000000000002120713614532331015103 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. TekColor is a * trademark of Tektronix, Inc. The term "TekHVC" designates a particular * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent * foreign patents pending). Permission is hereby granted to use, copy, * modify, sell, and otherwise distribute this software and its * documentation for any purpose and without fee, provided that: * * 1. This copyright, permission, and disclaimer notice is reproduced in * all copies of this software and any modification thereof and in * supporting documentation; * 2. Any color-handling application which displays TekHVC color * cooordinates identifies these as TekHVC color coordinates in any * interface that displays these coordinates and in any associated * documentation; * 3. The term "TekHVC" is always used, and is only used, in association * with the mathematical derivations of the TekHVC Color Space, * including those provided in this file and any equivalent pathways and * mathematical derivations, regardless of digital (e.g., floating point * or integer) representation. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * TekHVCGcVC.c * * DESCRIPTION * Source for XcmsTekHVCClipVC() gamut * compression function. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include #include "Cv.h" /* * INTERNALS * Internal defines that need NOT be exported to any package or * program using this package. */ #define MAXBISECTCOUNT 100 /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsTekHVCClipVC - Return the closest value and chroma * * SYNOPSIS */ /* ARGSUSED */ Status XcmsTekHVCClipVC ( XcmsCCC ccc, XcmsColor *pColors_in_out, unsigned int nColors, unsigned int i, Bool *pCompressed) /* * DESCRIPTION * This routine will find the closest value and chroma * for a specific hue. The color input is converted to * HVC format and returned as CIE XYZ format. * * Since this routine works with the value within * pColor_in_out intermediate results may be returned * even though it may be invalid. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { Status retval; XcmsCCCRec myCCC; XcmsColor *pColor; XcmsColor hvc_max; XcmsRGBi rgb_max; int nCount, nMaxCount, nI, nILast; XcmsFloat Chroma, Value, bestChroma, bestValue, nT, saveDist, tmpDist; /* * Insure TekHVC installed */ if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { return(XcmsFailure); } /* Use my own CCC */ memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* inherit screen white pt */ myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression func */ /* * Color specification passed as input can be assumed to: * 1. Be in XcmsCIEXYZFormat * 2. Already be white point adjusted for the Screen White Point. * This means that the white point now associated with this * color spec is the Screen White Point (even if the * ccc->clientWhitePt differs). */ pColor = pColors_in_out + i; if (ccc->visual->class < StaticColor && FunctionSetOfCCC(ccc) != (XPointer) &XcmsLinearRGBFunctionSet) { /* * GRAY ! */ _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat); pColor->spec.TekHVC.H = pColor->spec.TekHVC.C = 0.0; _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); if (pCompressed) { *(pCompressed + i) = True; } return(XcmsSuccess); } else { /* Convert from CIEXYZ to TekHVC format */ if (_XcmsDIConvertColors(&myCCC, pColor, &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat) == XcmsFailure) { return(XcmsFailure); } if (!_XcmsTekHVC_CheckModify(pColor)) { return (XcmsFailure); } /* Step 1: compute the maximum value and chroma for this hue. */ /* This copy may be overkill but it preserves the pixel etc. */ memcpy((char *)&hvc_max, (char *)pColor, sizeof(XcmsColor)); if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, hvc_max.spec.TekHVC.H, &hvc_max, &rgb_max) == XcmsFailure) { return (XcmsFailure); } /* Now check and return the appropriate value */ if (pColor->spec.TekHVC.V == hvc_max.spec.TekHVC.V) { /* When the value input is equal to the maximum value */ /* merely return the chroma for that value. */ pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; retval = _XcmsDIConvertColors(&myCCC, pColor, &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); } if (pColor->spec.TekHVC.V < hvc_max.spec.TekHVC.V) { /* return the intersection of the perpindicular line through */ /* the value and chroma given and the line from 0,0 and hvc_max. */ Chroma = pColor->spec.TekHVC.C; Value = pColor->spec.TekHVC.V; pColor->spec.TekHVC.C = (Value + (hvc_max.spec.TekHVC.C / hvc_max.spec.TekHVC.V * Chroma)) / ((hvc_max.spec.TekHVC.V / hvc_max.spec.TekHVC.C) + (hvc_max.spec.TekHVC.C / hvc_max.spec.TekHVC.V)); if (pColor->spec.TekHVC.C >= hvc_max.spec.TekHVC.C) { pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; } else { pColor->spec.TekHVC.V = pColor->spec.TekHVC.C * hvc_max.spec.TekHVC.V / hvc_max.spec.TekHVC.C; } retval = _XcmsDIConvertColors(&myCCC, pColor, &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); if (retval != XcmsFailure && pCompressed != NULL) { *(pCompressed + i) = True; } return (retval); } /* return the closest point on the upper part of the hue leaf. */ /* must do a bisection here to compute the delta e. */ nMaxCount = MAXBISECTCOUNT; nI = nMaxCount / 2; bestValue = Value = pColor->spec.TekHVC.V; bestChroma = Chroma = pColor->spec.TekHVC.C; saveDist = (XcmsFloat) XCMS_SQRT ((double) (((Chroma - hvc_max.spec.TekHVC.C) * (Chroma - hvc_max.spec.TekHVC.C)) + ((Value - hvc_max.spec.TekHVC.V) * (Value - hvc_max.spec.TekHVC.V)))); for (nCount = 0; nCount < nMaxCount; nCount++) { nT = (XcmsFloat) nI / (XcmsFloat) nMaxCount; pColor->spec.RGBi.red = rgb_max.red * (1.0 - nT) + nT; pColor->spec.RGBi.green = rgb_max.green * (1.0 - nT) + nT; pColor->spec.RGBi.blue = rgb_max.blue * (1.0 - nT) + nT; pColor->format = XcmsRGBiFormat; /* Convert from RGBi to HVC */ if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, (Bool *) NULL) == XcmsFailure) { return (XcmsFailure); } if (!_XcmsTekHVC_CheckModify(pColor)) { return (XcmsFailure); } tmpDist = (XcmsFloat) XCMS_SQRT ((double) (((Chroma - pColor->spec.TekHVC.C) * (Chroma - pColor->spec.TekHVC.C)) + ((Value - pColor->spec.TekHVC.V) * (Value - pColor->spec.TekHVC.V)))); nILast = nI; if (tmpDist > saveDist) { nI /= 2; } else { nI = (nMaxCount + nI) / 2; saveDist = tmpDist; bestValue = pColor->spec.TekHVC.V; bestChroma = pColor->spec.TekHVC.C; } if (nI == nILast || nI == 0) { break; } } if (bestChroma >= hvc_max.spec.TekHVC.C) { pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; } else { pColor->spec.TekHVC.C = bestChroma; pColor->spec.TekHVC.V = bestValue; } if (!_XcmsTekHVC_CheckModify(pColor)) { return (XcmsFailure); } retval = _XcmsDIConvertColors(&myCCC, pColor, &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); if (retval != XcmsFailure && pCompressed != NULL) { *(pCompressed + i) = True; } return(retval); } } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/HVCMnV.c0000644000000000000000000001223513614532331015022 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. TekColor is a * trademark of Tektronix, Inc. The term "TekHVC" designates a particular * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent * foreign patents pending). Permission is hereby granted to use, copy, * modify, sell, and otherwise distribute this software and its * documentation for any purpose and without fee, provided that: * * 1. This copyright, permission, and disclaimer notice is reproduced in * all copies of this software and any modification thereof and in * supporting documentation; * 2. Any color-handling application which displays TekHVC color * cooordinates identifies these as TekHVC color coordinates in any * interface that displays these coordinates and in any associated * documentation; * 3. The term "TekHVC" is always used, and is only used, in association * with the mathematical derivations of the TekHVC Color Space, * including those provided in this file and any equivalent pathways and * mathematical derivations, regardless of digital (e.g., floating point * or integer) representation. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * TekHVCMnV.c * * DESCRIPTION * Source for XcmsTekHVCQueryMinV gamut boundary querying routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * DEFINES */ #define EPS 0.001 /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsTekHVCQueryMinV - Compute minimum value for hue and chroma * * SYNOPSIS */ Status XcmsTekHVCQueryMinV ( XcmsCCC ccc, XcmsFloat hue, XcmsFloat chroma, XcmsColor *pColor_return) /* * DESCRIPTION * Return the minimum value for a specific hue, and the * corresponding chroma. The input color specification * may be in any format, however output is in XcmsTekHVCFormat. * * Since this routine works with the value within * pColor_return intermediate results may be returned * even though it may be invalid. * * ASSUMPTIONS * This routine assumes that the white point associated with * the color specification is the Screen White Point. The * Screen White Point will also be associated with the * returned color specification. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded with no modifications * */ { XcmsCCCRec myCCC; XcmsColor tmp; XcmsColor max_vc; /* * Check Arguments */ if (ccc == NULL || pColor_return == NULL) { return(XcmsFailure); } /* * Insure TekHVC installed */ if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { return(XcmsFailure); } /* Use my own CCC */ memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* inherit screen white pt */ myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut comp func */ tmp.spec.TekHVC.H = hue; tmp.spec.TekHVC.V = 100.0; tmp.spec.TekHVC.C = chroma; tmp.pixel = pColor_return->pixel; tmp.format = XcmsTekHVCFormat; /* Check for a valid HVC */ if (!_XcmsTekHVC_CheckModify (&tmp)) { return(XcmsFailure); } /* Step 1: compute the maximum value and chroma for this hue. */ /* This copy may be overkill but it preserves the pixel etc. */ memcpy((char *)&max_vc, (char *)&tmp, sizeof(XcmsColor)); if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, max_vc.spec.TekHVC.H, &max_vc, (XcmsRGBi *)NULL) == XcmsFailure) { return(XcmsFailure); } /* Step 2: find the intersection with the maximum hvc and chroma line. */ if (tmp.spec.TekHVC.C > max_vc.spec.TekHVC.C + EPS) { /* If the chroma is to large then return maximum hvc. */ tmp.spec.TekHVC.C = max_vc.spec.TekHVC.C; tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; } else { tmp.spec.TekHVC.V = tmp.spec.TekHVC.C * max_vc.spec.TekHVC.V / max_vc.spec.TekHVC.C; if (tmp.spec.TekHVC.V > max_vc.spec.TekHVC.V) { tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; } else if (tmp.spec.TekHVC.V < 0.0) { tmp.spec.TekHVC.V = tmp.spec.TekHVC.C = 0.0; } } if (_XcmsTekHVC_CheckModify (&tmp)) { memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); return(XcmsSuccess); } else { return(XcmsFailure); } } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/HVCMxC.c0000644000000000000000000001712613614532331015015 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. TekColor is a * trademark of Tektronix, Inc. The term "TekHVC" designates a particular * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent * foreign patents pending). Permission is hereby granted to use, copy, * modify, sell, and otherwise distribute this software and its * documentation for any purpose and without fee, provided that: * * 1. This copyright, permission, and disclaimer notice is reproduced in * all copies of this software and any modification thereof and in * supporting documentation; * 2. Any color-handling application which displays TekHVC color * cooordinates identifies these as TekHVC color coordinates in any * interface that displays these coordinates and in any associated * documentation; * 3. The term "TekHVC" is always used, and is only used, in association * with the mathematical derivations of the TekHVC Color Space, * including those provided in this file and any equivalent pathways and * mathematical derivations, regardless of digital (e.g., floating point * or integer) representation. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * TekHVCMxC.c * * DESCRIPTION * Source for the XcmsTekHVCQueryMaxC() gamut boudary * querying routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include #include "Cv.h" /* * DEFINES */ #define MAXBISECTCOUNT 100 #define EPS 0.001 /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsTekHVCQueryMaxC - Compute the maximum chroma for a hue and value * * SYNOPSIS */ Status XcmsTekHVCQueryMaxC( XcmsCCC ccc, XcmsFloat hue, XcmsFloat value, XcmsColor *pColor_return) /* * DESCRIPTION * Return the maximum chroma for a specific hue and value. * The returned format is in XcmsTekHVCFormat. * * * ASSUMPTIONS * This routine assumes that the white point associated with * the color specification is the Screen White Point. The * Screen White Point will also be associated with the * returned color specification. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { XcmsCCCRec myCCC; XcmsColor tmp; XcmsColor max_vc; XcmsRGBi rgb_saved; int nCount, nMaxCount; XcmsFloat nValue, savedValue, lastValue, lastChroma, prevValue; XcmsFloat maxDist, nT, rFactor; XcmsFloat ftmp1, ftmp2; /* * Check Arguments */ if (ccc == NULL || pColor_return == NULL) { return(XcmsFailure); } /* * Insure TekHVC installed */ if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { return(XcmsFailure); } /* Use my own CCC */ memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat; /* inherit screen white Pt */ myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut comp func */ tmp.spec.TekHVC.H = hue; tmp.spec.TekHVC.V = value; tmp.spec.TekHVC.C = 100.0; tmp.pixel = pColor_return->pixel; tmp.format = XcmsTekHVCFormat; /* check to make sure we have a valid TekHVC number */ if (!_XcmsTekHVC_CheckModify(&tmp)) { return(XcmsFailure); } /* Step 1: compute the maximum value and chroma for this hue. */ memcpy((char *)&max_vc, (char *)&tmp, sizeof(XcmsColor)); if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, hue, &max_vc, &rgb_saved) == XcmsFailure) { return(XcmsFailure); } /* Step 2: If the value is less than the value for the maximum */ /* value, chroma point then the chroma is on the line */ /* from max_vc to 0,0. */ if (value <= max_vc.spec.TekHVC.V) { tmp.spec.TekHVC.C = value * max_vc.spec.TekHVC.C / max_vc.spec.TekHVC.V; if (_XcmsTekHVC_CheckModify (&tmp)) { memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); return(XcmsSuccess); } else { return(XcmsFailure); } } else { /* must do a bisection here to compute the maximum chroma */ /* save the structure input so that any elements that */ /* are not touched are recopied later in the routine. */ nValue = savedValue = value; lastChroma = -1.0; lastValue = -1.0; nMaxCount = MAXBISECTCOUNT; maxDist = 100.0 - max_vc.spec.TekHVC.V; rFactor = 1.0; for (nCount = 0; nCount < nMaxCount; nCount++) { prevValue = lastValue; lastValue = tmp.spec.TekHVC.V; lastChroma = tmp.spec.TekHVC.C; nT = (nValue - max_vc.spec.TekHVC.V) / maxDist * rFactor; tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; tmp.format = XcmsRGBiFormat; /* convert from RGB to HVC */ if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } /* Now check the return against what is expected */ if (tmp.spec.TekHVC.V <= savedValue + EPS && tmp.spec.TekHVC.V >= savedValue - EPS) { /* make sure to return the input hue */ tmp.spec.TekHVC.H = hue; if (_XcmsTekHVC_CheckModify (&tmp)) { memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); return(XcmsSuccess); } else { return(XcmsFailure); } } nValue += savedValue - tmp.spec.TekHVC.V; if (nValue < max_vc.spec.TekHVC.V) { nValue = max_vc.spec.TekHVC.V; rFactor *= 0.5; /* selective relaxation employed */ } else if (nValue > 100.0) { /* make sure to return the input hue */ tmp.spec.TekHVC.H = hue; /* avoid using fabs */ ftmp1 = lastValue - savedValue; if (ftmp1 < 0.0) ftmp1 = -ftmp1; ftmp2 = tmp.spec.TekHVC.V - savedValue; if (ftmp2 < 0.0) ftmp2 = -ftmp2; if (ftmp1 < ftmp2) { tmp.spec.TekHVC.V = lastValue; tmp.spec.TekHVC.C = lastChroma; } if (_XcmsTekHVC_CheckModify (&tmp)) { memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); return(XcmsSuccess); } else { return(XcmsFailure); } } else if (tmp.spec.TekHVC.V <= prevValue + EPS && tmp.spec.TekHVC.V >= prevValue - EPS) { rFactor *= 0.5; /* selective relaxation employed */ } } if (nCount >= nMaxCount) { /* avoid using fabs */ ftmp1 = lastValue - savedValue; if (ftmp1 < 0.0) ftmp1 = -ftmp1; ftmp2 = tmp.spec.TekHVC.V - savedValue; if (ftmp2 < 0.0) ftmp2 = -ftmp2; if (ftmp1 < ftmp2) { tmp.spec.TekHVC.V = lastValue; tmp.spec.TekHVC.C = lastChroma; } } } /* make sure to return the input hue */ tmp.spec.TekHVC.H = hue; memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/HVCMxV.c0000644000000000000000000001771113614532331015040 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. TekColor is a * trademark of Tektronix, Inc. The term "TekHVC" designates a particular * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent * foreign patents pending). Permission is hereby granted to use, copy, * modify, sell, and otherwise distribute this software and its * documentation for any purpose and without fee, provided that: * * 1. This copyright, permission, and disclaimer notice is reproduced in * all copies of this software and any modification thereof and in * supporting documentation; * 2. Any color-handling application which displays TekHVC color * cooordinates identifies these as TekHVC color coordinates in any * interface that displays these coordinates and in any associated * documentation; * 3. The term "TekHVC" is always used, and is only used, in association * with the mathematical derivations of the TekHVC Color Space, * including those provided in this file and any equivalent pathways and * mathematical derivations, regardless of digital (e.g., floating point * or integer) representation. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * TekHVCMxV.c * * DESCRIPTION * Source for the XcmsTekHVCQueryMaxV() gamut boundary * querying routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include #include "Cv.h" /* * DEFINES */ #define MAXBISECTCOUNT 100 #define EPS 0.001 /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsTekHVCQueryMaxV - Compute maximum value for a hue and chroma * * SYNOPSIS */ Status XcmsTekHVCQueryMaxV( XcmsCCC ccc, XcmsFloat hue, XcmsFloat chroma, XcmsColor *pColor_return) /* * DESCRIPTION * Return the maximum value for a specified hue and chroma. * * ASSUMPTIONS * This routine assumes that the white point associated with * the color specification is the Screen White Point. The * Screen White Point will also be associated with the * returned color specification. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded with no modifications * */ { XcmsCCCRec myCCC; XcmsColor tmp; XcmsColor max_vc; XcmsRGBi rgb_saved; int nCount, nMaxCount; XcmsFloat nT, nChroma, savedChroma, lastValue, lastChroma, prevChroma; XcmsFloat rFactor; XcmsFloat ftmp1, ftmp2; /* * Check Arguments */ if (ccc == NULL || pColor_return == NULL) { return(XcmsFailure); } /* * Insure TekHVC installed */ if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { return(XcmsFailure); } /* setup the CCC to use for the conversions. */ memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat; myCCC.gamutCompProc = (XcmsCompressionProc) NULL; tmp.spec.TekHVC.H = hue; tmp.spec.TekHVC.V = 0.0; tmp.spec.TekHVC.C = chroma; tmp.pixel = pColor_return->pixel; tmp.format = XcmsTekHVCFormat; if (!_XcmsTekHVC_CheckModify (&tmp)) { return(XcmsFailure); } /* Step 1: compute the maximum value and chroma for this hue. */ /* This copy may be overkill but it preserves the pixel etc. */ memcpy((char *)&max_vc, (char *)&tmp, sizeof(XcmsColor)); hue = max_vc.spec.TekHVC.H; if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, max_vc.spec.TekHVC.H, &max_vc, &rgb_saved) == XcmsFailure) { return(XcmsFailure); } if (max_vc.spec.TekHVC.C < tmp.spec.TekHVC.C) { /* * If the chroma is greater than the chroma for the * maximum value/chroma point then the value is the * the value for the maximum value, chroma point. * This is an error but it I return the best approximation I can. * Thus the inconsistency. */ tmp.spec.TekHVC.C = max_vc.spec.TekHVC.C; tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); return(XcmsSuccess); } else if (max_vc.spec.TekHVC.C == tmp.spec.TekHVC.C) { /* * If the chroma is equal to the chroma for the * maximum value/chroma point then the value is the * the value for the maximum value, chroma point. */ tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); return(XcmsSuccess); } else { /* must do a bisection here to compute the maximum value */ /* save the structure input so that any elements that */ /* are not touched are recopied later in the routine. */ nChroma = savedChroma = tmp.spec.TekHVC.C; tmp.spec.TekHVC.C = max_vc.spec.TekHVC.C; tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; lastChroma = -1.0; lastValue = -1.0; nMaxCount = MAXBISECTCOUNT; rFactor = 1.0; for (nCount = 0; nCount < nMaxCount; nCount++) { prevChroma = lastChroma; lastValue = tmp.spec.TekHVC.V; lastChroma = tmp.spec.TekHVC.C; nT = (1.0 - (nChroma / max_vc.spec.TekHVC.C)) * rFactor; tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; tmp.format = XcmsRGBiFormat; /* convert from RGB to HVC */ if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } /* Now check the return against what is expected */ if (tmp.spec.TekHVC.C <= savedChroma + EPS && tmp.spec.TekHVC.C >= savedChroma - EPS) { tmp.spec.TekHVC.H = hue; /* use the saved hue */ memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); return(XcmsSuccess); } nChroma += savedChroma - tmp.spec.TekHVC.C; if (nChroma > max_vc.spec.TekHVC.C) { nChroma = max_vc.spec.TekHVC.C; rFactor *= 0.5; /* selective relaxation employed */ } else if (nChroma < 0.0) { /* avoid using fabs */ ftmp1 = lastChroma - savedChroma; if (ftmp1 < 0.0) ftmp1 = -ftmp1; ftmp2 = tmp.spec.TekHVC.C - savedChroma; if (ftmp2 < 0.0) ftmp2 = -ftmp2; if (ftmp1 < ftmp2) { tmp.spec.TekHVC.V = lastValue; tmp.spec.TekHVC.C = lastChroma; } /* make sure to return the input hue */ tmp.spec.TekHVC.H = hue; if (!_XcmsTekHVC_CheckModify(&tmp)) { return(XcmsFailure); } memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); return(XcmsSuccess); } else if (tmp.spec.TekHVC.C <= prevChroma + EPS && tmp.spec.TekHVC.C >= prevChroma - EPS) { rFactor *= 0.5; /* selective relaxation employed */ } } if (nCount >= nMaxCount) { /* avoid using fabs */ ftmp1 = lastChroma - savedChroma; if (ftmp1 < 0.0) ftmp1 = -ftmp1; ftmp2 = tmp.spec.TekHVC.C - savedChroma; if (ftmp2 < 0.0) ftmp2 = -ftmp2; if (ftmp1 < ftmp2) { tmp.spec.TekHVC.V = lastValue; tmp.spec.TekHVC.C = lastChroma; } } } /* make sure to return the input hue */ tmp.spec.TekHVC.H = hue; memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/HVCMxVC.c0000644000000000000000000001551313614532331015141 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. TekColor is a * trademark of Tektronix, Inc. The term "TekHVC" designates a particular * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent * foreign patents pending). Permission is hereby granted to use, copy, * modify, sell, and otherwise distribute this software and its * documentation for any purpose and without fee, provided that: * * 1. This copyright, permission, and disclaimer notice is reproduced in * all copies of this software and any modification thereof and in * supporting documentation; * 2. Any color-handling application which displays TekHVC color * cooordinates identifies these as TekHVC color coordinates in any * interface that displays these coordinates and in any associated * documentation; * 3. The term "TekHVC" is always used, and is only used, in association * with the mathematical derivations of the TekHVC Color Space, * including those provided in this file and any equivalent pathways and * mathematical derivations, regardless of digital (e.g., floating point * or integer) representation. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * TekHVCMxVC.c * * DESCRIPTION * Source for the XcmsTekHVCQueryMaxVC() gamut boundary * querying routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * DEFINES */ #define MIN(x,y) ((x) > (y) ? (y) : (x)) #define MIN3(x,y,z) ((x) > (MIN((y), (z))) ? (MIN((y), (z))) : (x)) #define MAX(x,y) ((x) > (y) ? (x) : (y)) #define MAX3(x,y,z) ((x) > (MAX((y), (z))) ? (x) : (MAX((y), (z)))) #define START_V 40.0 #define START_C 120.0 /************************************************************************ * * * API PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * _XcmsTekHVCQueryMaxVCRGB - Compute maximum value/chroma. * * SYNOPSIS */ Status _XcmsTekHVCQueryMaxVCRGB( XcmsCCC ccc, XcmsFloat hue, XcmsColor *pColor_return, XcmsRGBi *pRGB_return) /* * DESCRIPTION * Return the maximum chroma for a specified hue, and the * corresponding value. This is computed by a binary search of * all possible chromas. An assumption is made that there are * no local maxima. Use the unrounded Max Chroma because * the difference check can be small. * * NOTE: No local CCC is used because this is a private * routine and all routines that call it are expected * to behave properly, i.e. send a local CCC with * no white adjust function and no gamut compression * function. * * This routine only accepts hue as input and outputs * HVC's and RGBi's. * * RETURNS * XcmsFailure - Failure * XCMS_SUCCUSS - Succeeded * */ { XcmsFloat nSmall, nLarge; XcmsColor tmp; tmp.format = XcmsTekHVCFormat; tmp.spec.TekHVC.H = hue; /* Use some unreachable color on the given hue */ tmp.spec.TekHVC.V = START_V; tmp.spec.TekHVC.C = START_C; /* * Convert from HVC to RGB * * Note that the CIEXYZ to RGBi conversion routine must stuff the * out of bounds RGBi values in tmp when the ccc->gamutCompProc * is NULL. */ if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsRGBiFormat, (Bool *) NULL) == XcmsFailure) && tmp.format != XcmsRGBiFormat) { return (XcmsFailure); } /* Now pick the smallest RGB */ nSmall = MIN3(tmp.spec.RGBi.red, tmp.spec.RGBi.green, tmp.spec.RGBi.blue); /* Make the smallest RGB equal to zero */ tmp.spec.RGBi.red -= nSmall; tmp.spec.RGBi.green -= nSmall; tmp.spec.RGBi.blue -= nSmall; /* Now pick the largest RGB */ nLarge = MAX3(tmp.spec.RGBi.red, tmp.spec.RGBi.green, tmp.spec.RGBi.blue); /* Scale the RGB values based on the largest one */ tmp.spec.RGBi.red /= nLarge; tmp.spec.RGBi.green /= nLarge; tmp.spec.RGBi.blue /= nLarge; tmp.format = XcmsRGBiFormat; /* If the calling routine wants RGB value give them the ones used. */ if (pRGB_return) { pRGB_return->red = tmp.spec.RGBi.red; pRGB_return->green = tmp.spec.RGBi.green; pRGB_return->blue = tmp.spec.RGBi.blue; } /* Convert from RGBi to HVC */ if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, (Bool *) NULL) == XcmsFailure) { return (XcmsFailure); } /* make sure to return the input hue */ tmp.spec.TekHVC.H = hue; memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); return (XcmsSuccess); } /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsTekHVCQueryMaxVC - Compute maximum value and chroma. * * SYNOPSIS */ Status XcmsTekHVCQueryMaxVC ( XcmsCCC ccc, XcmsFloat hue, XcmsColor *pColor_return) /* * DESCRIPTION * Return the maximum chroma for the specified hue, and the * corresponding value. * * ASSUMPTIONS * This routine assumes that the white point associated with * the color specification is the Screen White Point. The * Screen White Point will also be associated with the * returned color specification. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { XcmsCCCRec myCCC; /* * Check Arguments */ if (ccc == NULL || pColor_return == NULL) { return(XcmsFailure); } /* * Insure TekHVC installed */ if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { return(XcmsFailure); } /* Use my own CCC */ memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat; myCCC.gamutCompProc = (XcmsCompressionProc)NULL; while (hue < 0.0) { hue += 360.0; } while (hue >= 360.0) { hue -= 360.0; } return(_XcmsTekHVCQueryMaxVCRGB (&myCCC, hue, pColor_return, (XcmsRGBi *)NULL)); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/HVCMxVs.c0000644000000000000000000001201513614532331015213 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. TekColor is a * trademark of Tektronix, Inc. The term "TekHVC" designates a particular * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent * foreign patents pending). Permission is hereby granted to use, copy, * modify, sell, and otherwise distribute this software and its * documentation for any purpose and without fee, provided that: * * 1. This copyright, permission, and disclaimer notice is reproduced in * all copies of this software and any modification thereof and in * supporting documentation; * 2. Any color-handling application which displays TekHVC color * cooordinates identifies these as TekHVC color coordinates in any * interface that displays these coordinates and in any associated * documentation; * 3. The term "TekHVC" is always used, and is only used, in association * with the mathematical derivations of the TekHVC Color Space, * including those provided in this file and any equivalent pathways and * mathematical derivations, regardless of digital (e.g., floating point * or integer) representation. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * TekHVCMxVs.c * * DESCRIPTION * Source for the XcmsTekHVCQueryMaxVSamples() gamut boundary * querying routine. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsTekHVCQueryMaxVSamples - Compute a set of value/chroma * pairs. * * SYNOPSIS */ Status XcmsTekHVCQueryMaxVSamples( XcmsCCC ccc, XcmsFloat hue, XcmsColor *pColor_in_out, unsigned int nSamples) /* * DESCRIPTION * Return a set of values and chromas for the input Hue. * This routine will take any color as input. * It returns TekHVC colors. * * Since this routine works with the value within * pColor_in_out intermediate results may be returned * even though it may be invalid. * * ASSUMPTIONS * This routine assumes that the white point associated with * the color specification is the Screen White Point. The * Screen White Point will also be associated with the * returned color specification. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { XcmsCCCRec myCCC; XcmsColor *pHVC; XcmsRGBi rgb_saved; unsigned short nI; XcmsFloat nT; /* * Check Arguments */ if (ccc == NULL || pColor_in_out == NULL || nSamples == 0) { return(XcmsFailure); } /* * Insure TekHVC installed */ if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { return(XcmsFailure); } /* setup the CCC to use for the conversions. */ memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat; myCCC.gamutCompProc = (XcmsCompressionProc) NULL; /* Step 1: compute the maximum value and chroma for this hue. */ /* save the Hue for use later. */ while (hue < 0.0) { hue += 360.0; } while (hue > 360.0) { hue -= 360.0; } pColor_in_out->spec.TekHVC.H = hue; pColor_in_out->format = XcmsTekHVCFormat; /* Get the maximum value and chroma point for this hue */ if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, pColor_in_out->spec.TekHVC.H, pColor_in_out, (XcmsRGBi *)&rgb_saved) == XcmsFailure) { return (XcmsFailure); } /* Step 2: Convert each of the RGBi's to HVC's */ pHVC = pColor_in_out; for (nI = 0; nI < nSamples; nI++, pHVC++) { nT = (XcmsFloat) nI / (XcmsFloat) nSamples; pHVC->spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; pHVC->spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; pHVC->spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; pHVC->format = XcmsRGBiFormat; pHVC->pixel = pColor_in_out->pixel; /* convert from RGB to HVC */ if (_XcmsConvertColorsWithWhitePt(&myCCC, pHVC, &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } /* make sure to return the input hue */ pHVC->spec.TekHVC.H = hue; } return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/HVCWpAj.c0000644000000000000000000000745513614532331015173 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. TekColor is a * trademark of Tektronix, Inc. The term "TekHVC" designates a particular * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent * foreign patents pending). Permission is hereby granted to use, copy, * modify, sell, and otherwise distribute this software and its * documentation for any purpose and without fee, provided that: * * 1. This copyright, permission, and disclaimer notice is reproduced in * all copies of this software and any modification thereof and in * supporting documentation; * 2. Any color-handling application which displays TekHVC color * cooordinates identifies these as TekHVC color coordinates in any * interface that displays these coordinates and in any associated * documentation; * 3. The term "TekHVC" is always used, and is only used, in association * with the mathematical derivations of the TekHVC Color Space, * including those provided in this file and any equivalent pathways and * mathematical derivations, regardless of digital (e.g., floating point * or integer) representation. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * DESCRIPTION * TekHVCWpAj.c * * DESCRIPTION * This file contains routine(s) that support white point * adjustment of color specifications in the TekHVC color * space. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsTekHVCWhiteShiftColors * * SYNOPSIS */ Status XcmsTekHVCWhiteShiftColors( XcmsCCC ccc, XcmsColor *pWhitePtFrom, XcmsColor *pWhitePtTo, XcmsColorFormat destSpecFmt, XcmsColor *pColors_in_out, unsigned int nColors, Bool *pCompressed) /* * DESCRIPTION * Convert color specifications in an array of XcmsColor structures * for differences in white points. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded without gamut compression, * XcmsSuccessWithCompression if succeeded with * gamut compression. */ { if (pWhitePtFrom == NULL || pWhitePtTo == NULL || pColors_in_out == NULL) { return(XcmsFailure); } /* * Insure TekHVC installed */ if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { return(XcmsFailure); } /* * Convert to TekHVC using pWhitePtFrom * We can ignore return value for compression because we are converting * to XcmsTekHVCFormat which is device-independent, not device-dependent. */ if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, nColors, XcmsTekHVCFormat, pCompressed) == XcmsFailure) { return(XcmsFailure); } /* * Convert from TekHVC to destSpecFmt using pWhitePtTo */ return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtTo, nColors, destSpecFmt, pCompressed)); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/IdOfPr.c0000644000000000000000000000562213614532331015106 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsIdOfPr.c * * DESCRIPTION * Source for XcmsFormatOfPrefix() * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * NAME * XcmsFormatOfPrefix * * SYNOPSIS */ XcmsColorFormat XcmsFormatOfPrefix(char *prefix) /* * DESCRIPTION * Returns the Color Space ID for the specified prefix * if the color space is found in the Color Conversion * Context. * * RETURNS * Color Space ID if found; zero otherwise. */ { XcmsColorSpace **papColorSpaces; char string_buf[64]; char *string_lowered; size_t len; /* * While copying prefix to string_lowered, convert to lowercase */ if ((len = strlen(prefix)) >= sizeof(string_buf)) { string_lowered = Xmalloc(len+1); } else { string_lowered = string_buf; } _XcmsCopyISOLatin1Lowered(string_lowered, prefix); /* * First try Device-Independent color spaces */ papColorSpaces = _XcmsDIColorSpaces; if (papColorSpaces != NULL) { while (*papColorSpaces != NULL) { if (strcmp((*papColorSpaces)->prefix, string_lowered) == 0) { if (len >= sizeof(string_buf)) Xfree(string_lowered); return((*papColorSpaces)->id); } papColorSpaces++; } } /* * Next try Device-Dependent color spaces */ papColorSpaces = _XcmsDDColorSpaces; if (papColorSpaces != NULL) { while (*papColorSpaces != NULL) { if (strcmp((*papColorSpaces)->prefix, string_lowered) == 0) { if (len >= sizeof(string_buf)) Xfree(string_lowered); return((*papColorSpaces)->id); } papColorSpaces++; } } if (len >= sizeof(string_buf)) Xfree(string_lowered); return(XcmsUndefinedFormat); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/Lab.c0000644000000000000000000002516513614532331014465 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * CIELab.c * * DESCRIPTION * This file contains routines that support the CIE L*a*b* * color space to include conversions to and from the CIE * XYZ space. These conversions are from Principles of * Color Technology Second Edition, Fred W. Billmeyer, Jr. * and Max Saltzman, John Wiley & Sons, Inc., 1981. * * Note that the range for L* is 0 to 1. */ #ifdef HAVE_CONFIG_H #include #endif #include #include /* sscanf */ #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * DEFINES * Internal definitions that need NOT be exported to any package * or program using this package. */ #ifdef DBL_EPSILON # define XMY_DBL_EPSILON DBL_EPSILON #else # define XMY_DBL_EPSILON 0.00001 #endif #define DIV16BY116 0.137931 /* * FORWARD DECLARATIONS */ static int CIELab_ParseString(register char *spec, XcmsColor *pColor); static Status XcmsCIELab_ValidSpec(XcmsColor *pColor); /* * LOCAL VARIABLES */ /* * NULL terminated list of functions applied to get from CIELab to CIEXYZ */ static XcmsConversionProc Fl_CIELab_to_CIEXYZ[] = { XcmsCIELabToCIEXYZ, NULL }; /* * NULL terminated list of functions applied to get from CIEXYZ to CIELab */ static XcmsConversionProc Fl_CIEXYZ_to_CIELab[] = { XcmsCIEXYZToCIELab, NULL }; /* * GLOBALS */ /* * CIE Lab Color Space */ XcmsColorSpace XcmsCIELabColorSpace = { _XcmsCIELab_prefix, /* prefix */ XcmsCIELabFormat, /* id */ CIELab_ParseString, /* parseString */ Fl_CIELab_to_CIEXYZ, /* to_CIEXYZ */ Fl_CIEXYZ_to_CIELab, /* from_CIEXYZ */ 1 }; /************************************************************************ * * * PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * CIELab_ParseString * * SYNOPSIS */ static int CIELab_ParseString( register char *spec, XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert * it into a XcmsColor structure with XcmsCIELabFormat. * The assumed CIELab string syntax is: * CIELab:// * Where L, a, and b are in string input format for floats * consisting of: * a. an optional sign * b. a string of numbers possibly containing a decimal point, * c. an optional exponent field containing an 'E' or 'e' * followed by a possibly signed integer string. * * RETURNS * 0 if failed, non-zero otherwise. */ { int n; char *pchar; if ((pchar = strchr(spec, ':')) == NULL) { return(XcmsFailure); } n = (int)(pchar - spec); /* * Check for proper prefix. */ if (strncmp(spec, _XcmsCIELab_prefix, n) != 0) { return(XcmsFailure); } /* * Attempt to parse the value portion. */ if (sscanf(spec + n + 1, "%lf/%lf/%lf", &pColor->spec.CIELab.L_star, &pColor->spec.CIELab.a_star, &pColor->spec.CIELab.b_star) != 3) { char *s; /* Maybe failed due to locale */ int f; if ((s = strdup(spec))) { for (f = 0; s[f]; ++f) if (s[f] == '.') s[f] = ','; else if (s[f] == ',') s[f] = '.'; if (sscanf(s + n + 1, "%lf/%lf/%lf", &pColor->spec.CIELab.L_star, &pColor->spec.CIELab.a_star, &pColor->spec.CIELab.b_star) != 3) { free(s); return(XcmsFailure); } free(s); } else return(XcmsFailure); } pColor->format = XcmsCIELabFormat; pColor->pixel = 0; return(XcmsCIELab_ValidSpec(pColor)); } /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELab_ValidSpec * * SYNOPSIS */ static Status XcmsCIELab_ValidSpec( XcmsColor *pColor) /* * DESCRIPTION * Checks if color specification valid for CIE L*a*b*. * * RETURNS * XcmsFailure if invalid, * XcmsSuccess if valid. * */ { if (pColor->format != XcmsCIELabFormat || (pColor->spec.CIELab.L_star < 0.0 - XMY_DBL_EPSILON) || (pColor->spec.CIELab.L_star > 100.0 + XMY_DBL_EPSILON)) { return(XcmsFailure); } return(XcmsSuccess); } /* * NAME * XcmsCIELabToCIEXYZ - convert CIELab to CIEXYZ * * SYNOPSIS */ Status XcmsCIELabToCIEXYZ( XcmsCCC ccc, XcmsColor *pLab_WhitePt, XcmsColor *pColors_in_out, unsigned int nColors) /* * DESCRIPTION * Converts color specifications in an array of XcmsColor * structures from CIELab format to CIEXYZ format. * * WARNING: This routine assumes that Yn = 1.0; * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded. * */ { XcmsCIEXYZ XYZ_return; XcmsFloat tmpFloat, tmpL; XcmsColor whitePt; unsigned int i; XcmsColor *pColor = pColors_in_out; /* * Check arguments */ if (pLab_WhitePt == NULL || pColors_in_out == NULL) { return(XcmsFailure); } /* * Make sure white point is in CIEXYZ form, if not, convert it. */ if (pLab_WhitePt->format != XcmsCIEXYZFormat) { /* Make a copy of the white point because we're going to modify it */ memcpy((char *)&whitePt, (char *)pLab_WhitePt, sizeof(XcmsColor)); if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, XcmsCIEXYZFormat)) { return(XcmsFailure); } pLab_WhitePt = &whitePt; } /* * Make sure it is a white point, i.e., Y == 1.0 */ if (pLab_WhitePt->spec.CIEXYZ.Y != 1.0) { return (0); } /* * Now convert each XcmsColor structure to CIEXYZ form */ for (i = 0; i < nColors; i++, pColor++) { /* Make sure original format is CIELab */ if (!XcmsCIELab_ValidSpec(pColor)) { return(XcmsFailure); } /* Calculate Y: assume that Yn = 1.0 */ tmpL = (pColor->spec.CIELab.L_star + 16.0) / 116.0; XYZ_return.Y = tmpL * tmpL * tmpL; if (XYZ_return.Y < 0.008856) { /* Calculate Y: assume that Yn = 1.0 */ tmpL = pColor->spec.CIELab.L_star / 9.03292; /* Calculate X */ XYZ_return.X = pLab_WhitePt->spec.CIEXYZ.X * ((pColor->spec.CIELab.a_star / 3893.5) + tmpL); /* Calculate Y */ XYZ_return.Y = tmpL; /* Calculate Z */ XYZ_return.Z = pLab_WhitePt->spec.CIEXYZ.Z * (tmpL - (pColor->spec.CIELab.b_star / 1557.4)); } else { /* Calculate X */ tmpFloat = tmpL + (pColor->spec.CIELab.a_star / 5.0); XYZ_return.X = pLab_WhitePt->spec.CIEXYZ.X * tmpFloat * tmpFloat * tmpFloat; /* Calculate Z */ tmpFloat = tmpL - (pColor->spec.CIELab.b_star / 2.0); XYZ_return.Z = pLab_WhitePt->spec.CIEXYZ.Z * tmpFloat * tmpFloat * tmpFloat; } memcpy((char *)&pColor->spec.CIEXYZ, (char *)&XYZ_return, sizeof(XcmsCIEXYZ)); pColor->format = XcmsCIEXYZFormat; } return (1); } /* * NAME * XcmsCIEXYZToCIELab - convert CIEXYZ to CIELab * * SYNOPSIS */ Status XcmsCIEXYZToCIELab( XcmsCCC ccc, XcmsColor *pLab_WhitePt, XcmsColor *pColors_in_out, unsigned int nColors) /* * DESCRIPTION * Converts color specifications in an array of XcmsColor * structures from CIEXYZ format to CIELab format. * * WARNING: This routine assumes that Yn = 1.0; * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded. * */ { XcmsCIELab Lab_return; XcmsFloat fX_Xn, fY_Yn, fZ_Zn; XcmsColor whitePt; unsigned int i; XcmsColor *pColor = pColors_in_out; /* * Check arguments */ if (pLab_WhitePt == NULL || pColors_in_out == NULL) { return(XcmsFailure); } /* * Make sure white point is in CIEXYZ form, if not, convert it. */ if (pLab_WhitePt->format != XcmsCIEXYZFormat) { /* Make a copy of the white point because we're going to modify it */ memcpy((char *)&whitePt, (char *)pLab_WhitePt, sizeof(XcmsColor)); if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, XcmsCIEXYZFormat)) { return(XcmsFailure); } pLab_WhitePt = &whitePt; } /* * Make sure it is a white point, i.e., Y == 1.0 */ if (pLab_WhitePt->spec.CIEXYZ.Y != 1.0) { return(XcmsFailure); } /* * Now convert each XcmsColor structure to CIEXYZ form */ for (i = 0; i < nColors; i++, pColor++) { /* Make sure original format is CIELab */ if (!_XcmsCIEXYZ_ValidSpec(pColor)) { return(XcmsFailure); } /* Calculate L*: assume Yn = 1.0 */ if (pColor->spec.CIEXYZ.Y < 0.008856) { fY_Yn = (0.07787 * pColor->spec.CIEXYZ.Y) + DIV16BY116; /* note fY_Yn used to compute Lab_return.a below */ Lab_return.L_star = 116.0 * (fY_Yn - DIV16BY116); } else { fY_Yn = (XcmsFloat)XCMS_CUBEROOT(pColor->spec.CIEXYZ.Y); /* note fY_Yn used to compute Lab_return.a_star below */ Lab_return.L_star = (116.0 * fY_Yn) - 16.0; } /* Calculate f(X/Xn) */ if ((fX_Xn = pColor->spec.CIEXYZ.X / pLab_WhitePt->spec.CIEXYZ.X) < 0.008856) { fX_Xn = (0.07787 * fX_Xn) + DIV16BY116; } else { fX_Xn = (XcmsFloat) XCMS_CUBEROOT(fX_Xn); } /* Calculate f(Z/Zn) */ if ((fZ_Zn = pColor->spec.CIEXYZ.Z / pLab_WhitePt->spec.CIEXYZ.Z) < 0.008856) { fZ_Zn = (0.07787 * fZ_Zn) + DIV16BY116; } else { fZ_Zn = (XcmsFloat) XCMS_CUBEROOT(fZ_Zn); } Lab_return.a_star = 5.0 * (fX_Xn - fY_Yn); Lab_return.b_star = 2.0 * (fY_Yn - fZ_Zn); memcpy((char *)&pColor->spec.CIELab, (char *)&Lab_return, sizeof(XcmsCIELab)); pColor->format = XcmsCIELabFormat; } return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LabGcC.c0000644000000000000000000000733413614532331015040 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * CIELabGcC.c * * DESCRIPTION * Source for XcmsCIELabClipuv() gamut compression routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELabClipab - Reduce the chroma for a hue and L* * * SYNOPSIS */ /* ARGSUSED */ Status XcmsCIELabClipab ( XcmsCCC ccc, XcmsColor *pColors_in_out, unsigned int nColors, unsigned int i, Bool *pCompressed) /* * DESCRIPTION * Reduce the Chroma for a specific hue and chroma to * to bring the given color into the gamut of the * specified device. As required of gamut compression * functions, this routine returns pColor_in_out * in XcmsCIEXYZFormat on successful completion. * * Since this routine works with the L* within * pColor_in_out intermediate results may be returned * even though it may be invalid. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { Status retval; XcmsColor *pColor; /* * Color specification passed as input can be assumed to: * 1. Be in XcmsCIEXYZFormat * 2. Already be white point adjusted for the Screen White Point. * This means that the white point now associated with this * color spec is the Screen White Point (even if the * ccc->clientWhitePt differs). */ pColor = pColors_in_out + i; if (ccc->visual->class < PseudoColor) { /* * GRAY ! */ _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), 1, XcmsCIELabFormat); _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), 1, XcmsCIEXYZFormat); if (pCompressed) { *(pCompressed + i) = True; } return(XcmsSuccess); } else { if (pColor->format != XcmsCIELabFormat) { if (_XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIELabFormat) == XcmsFailure) { return(XcmsFailure); } } if (XcmsCIELabQueryMaxC(ccc, degrees(XCMS_CIELAB_PMETRIC_HUE(pColor->spec.CIELab.a_star, pColor->spec.CIELab.b_star)), pColor->spec.CIELab.L_star, pColor) == XcmsFailure) { return(XcmsFailure); } retval = _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); if (retval != XcmsFailure && pCompressed != NULL) { *(pCompressed + i) = True; } return(retval); } } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LabGcL.c0000644000000000000000000001320513614532331015043 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * CIELabGcL.c * * DESCRIPTION * Source for XcmsCIELabClipL() gamut compression routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELabClipL - Return the closest L* * * SYNOPSIS */ /* ARGSUSED */ Status XcmsCIELabClipL ( XcmsCCC ccc, XcmsColor *pColors_in_out, unsigned int nColors, unsigned int i, Bool *pCompressed) /* * DESCRIPTION * Return the closest L* for a specific hue and chroma. * This routine takes any color as input and outputs * a CIE XYZ color. * * Since this routine works with the L* within * pColor_in_out intermediate results may be returned * even though it may be invalid. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { XcmsCCCRec myCCC; XcmsColor *pColor; XcmsColor Lab_max; XcmsFloat hue, chroma, maxChroma; Status retval; /* Use my own CCC */ memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* Inherit Screen WP */ myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression */ /* * Color specification passed as input can be assumed to: * 1. Be in XcmsCIEXYZFormat * 2. Already be white point adjusted for the Screen White Point. * This means that the white point now associated with this * color spec is the Screen White Point (even if the * ccc->clientWhitePt differs). */ pColor = pColors_in_out + i; if (ccc->visual->class < StaticColor) { /* * GRAY ! */ return(XcmsFailure); } else { /* Convert from CIEXYZ to CIE L*u*v* format */ if (_XcmsDIConvertColors(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat) == XcmsFailure) { return(XcmsFailure); } hue = XCMS_CIELAB_PMETRIC_HUE(pColor->spec.CIELab.a_star, pColor->spec.CIELab.b_star); chroma = XCMS_CIELAB_PMETRIC_CHROMA(pColor->spec.CIELab.a_star, pColor->spec.CIELab.b_star); /* Step 1: compute the maximum L* and chroma for this hue. */ /* This copy may be overkill but it preserves the pixel etc. */ memcpy((char *)&Lab_max, (char *)pColor, sizeof(XcmsColor)); if (_XcmsCIELabQueryMaxLCRGB (&myCCC, hue, &Lab_max, (XcmsRGBi *)NULL) == XcmsFailure) { return (XcmsFailure); } maxChroma = XCMS_CIELAB_PMETRIC_CHROMA(Lab_max.spec.CIELab.a_star, Lab_max.spec.CIELab.b_star); /* Now check and return the appropriate L* */ if (chroma == maxChroma) { /* When the chroma input is equal to the maximum chroma */ /* merely return the L* for that chroma. */ memcpy((char *)pColor, (char *)&Lab_max, sizeof(XcmsColor)); retval = _XcmsDIConvertColors(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); } else if (chroma > maxChroma) { /* When the chroma input is greater than the maximum chroma */ /* merely return the L* and chroma for the given hue. */ memcpy((char *)pColor, (char *)&Lab_max, sizeof(XcmsColor)); return (XcmsFailure); } else if (pColor->spec.CIELab.L_star < Lab_max.spec.CIELab.L_star) { /* Find the minimum lightness for the given chroma. */ if (pColor->format != XcmsCIELabFormat) { if (_XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), 1, XcmsCIELabFormat) == XcmsFailure) { return(XcmsFailure); } } if (XcmsCIELabQueryMinL(&myCCC, degrees(hue), chroma, pColor) == XcmsFailure) { return (XcmsFailure); } retval = _XcmsDIConvertColors(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); } else { /* Find the maximum lightness for the given chroma. */ if (pColor->format != XcmsCIELabFormat) { if (_XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), 1, XcmsCIELabFormat) == XcmsFailure) { return(XcmsFailure); } } if (XcmsCIELabQueryMaxL(&myCCC, degrees(hue), chroma, pColor) == XcmsFailure) { return (XcmsFailure); } retval = _XcmsDIConvertColors(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); } if (retval != XcmsFailure && pCompressed != NULL) { *(pCompressed + i) = True; } return(retval); } } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LabGcLC.c0000644000000000000000000001651613614532331015156 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * CIELabGcLC.c * * DESCRIPTION * Source for XcmsCIELabClipLab() gamut * compression function. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include #include "Cv.h" /* * INTERNALS * Internal defines that need NOT be exported to any package or * program using this package. */ #define MAXBISECTCOUNT 100 /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELabClipLab - Return the closest L* and chroma * * SYNOPSIS */ /* ARGSUSED */ Status XcmsCIELabClipLab ( XcmsCCC ccc, XcmsColor *pColors_in_out, unsigned int nColors, unsigned int i, Bool *pCompressed) /* * DESCRIPTION * This routine will find the closest L* and chroma * for a specific hue. The color input is converted to * CIE L*u*v* format and returned as CIE XYZ format. * * Since this routine works with the L* within * pColor_in_out intermediate results may be returned * even though it may be invalid. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { Status retval; XcmsCCCRec myCCC; XcmsColor *pColor; XcmsColor Lab_max; XcmsFloat hue, chroma, maxChroma; XcmsFloat Chroma, bestChroma, Lstar, maxLstar, saveLstar; XcmsFloat bestLstar, bestastar, bestbstar; XcmsFloat nT, saveDist, tmpDist; XcmsRGBi rgb_max; int nCount, nMaxCount, nI, nILast; /* Use my own CCC */ memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* inherit screen white */ myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression func */ /* * Color specification passed as input can be assumed to: * 1. Be in XcmsCIEXYZFormat * 2. Already be white point adjusted for the Screen White Point. * This means that the white point now associated with this * color spec is the Screen White Point (even if the * ccc->clientWhitePt differs). */ pColor = pColors_in_out + i; if (ccc->visual->class < StaticColor) { /* * GRAY ! */ _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), 1, XcmsCIELabFormat); _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), 1, XcmsCIEXYZFormat); if (pCompressed) { *(pCompressed + i) = True; } return(XcmsSuccess); } /* Convert from CIEXYZ to CIELab format */ if (_XcmsDIConvertColors(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat) == XcmsFailure) { return(XcmsFailure); } /* Step 1: compute the maximum L* and chroma for this hue. */ /* This copy may be overkill but it preserves the pixel etc. */ saveLstar = pColor->spec.CIELab.L_star; hue = XCMS_CIELAB_PMETRIC_HUE(pColor->spec.CIELab.a_star, pColor->spec.CIELab.b_star); chroma = XCMS_CIELAB_PMETRIC_CHROMA(pColor->spec.CIELab.a_star, pColor->spec.CIELab.b_star); memcpy((char *)&Lab_max, (char *)pColor, sizeof(XcmsColor)); if (_XcmsCIELabQueryMaxLCRGB (&myCCC, hue, &Lab_max, &rgb_max) == XcmsFailure) { return (XcmsFailure); } maxLstar = Lab_max.spec.CIELab.L_star; /* Now check and return the appropriate L* */ if (saveLstar == maxLstar) { /* When the L* input is equal to the maximum L* */ /* merely return the maximum Lab point. */ memcpy((char *)pColor, (char *)&Lab_max, sizeof(XcmsColor)); retval = _XcmsDIConvertColors(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); } else { /* return the closest point on the hue leaf. */ /* must do a bisection here to compute the delta e. */ maxChroma = XCMS_CIELAB_PMETRIC_CHROMA(Lab_max.spec.CIELab.a_star, Lab_max.spec.CIELab.b_star); nMaxCount = MAXBISECTCOUNT; nI = nMaxCount / 2; bestLstar = Lstar = pColor->spec.CIELab.L_star; bestastar = pColor->spec.CIELab.a_star; bestbstar = pColor->spec.CIELab.b_star; bestChroma = Chroma = chroma; saveDist = XCMS_SQRT(((Chroma - maxChroma) * (Chroma - maxChroma)) + ((Lstar - maxLstar) * (Lstar - maxLstar))); for (nCount = 0; nCount < nMaxCount; nCount++) { nT = (XcmsFloat) nI / (XcmsFloat) nMaxCount; if (saveLstar > maxLstar) { pColor->spec.RGBi.red = rgb_max.red * (1.0 - nT) + nT; pColor->spec.RGBi.green = rgb_max.green * (1.0 - nT) + nT; pColor->spec.RGBi.blue = rgb_max.blue * (1.0 - nT) + nT; } else { pColor->spec.RGBi.red = rgb_max.red - (rgb_max.red * nT); pColor->spec.RGBi.green = rgb_max.green - (rgb_max.green * nT); pColor->spec.RGBi.blue = rgb_max.blue - (rgb_max.blue * nT); } pColor->format = XcmsRGBiFormat; /* Convert from RGBi to CIE Lab */ if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat, (Bool *) NULL) == XcmsFailure) { return (XcmsFailure); } chroma = XCMS_CIELAB_PMETRIC_CHROMA(pColor->spec.CIELab.a_star, pColor->spec.CIELab.b_star); tmpDist = XCMS_SQRT(((Chroma - chroma) * (Chroma - chroma)) + ((Lstar - pColor->spec.CIELab.L_star) * (Lstar - pColor->spec.CIELab.L_star))); nILast = nI; if (tmpDist > saveDist) { nI /= 2; } else { nI = (nMaxCount + nI) / 2; saveDist = tmpDist; bestLstar = pColor->spec.CIELab.L_star; bestastar = pColor->spec.CIELab.a_star; bestbstar = pColor->spec.CIELab.b_star; bestChroma = chroma; } if (nI == nILast || nI == 0) { break; } } if (bestChroma >= maxChroma) { pColor->spec.CIELab.L_star = maxLstar; pColor->spec.CIELab.a_star = Lab_max.spec.CIELab.a_star; pColor->spec.CIELab.b_star = Lab_max.spec.CIELab.b_star; } else { pColor->spec.CIELab.L_star = bestLstar; pColor->spec.CIELab.a_star = bestastar; pColor->spec.CIELab.b_star = bestbstar; } retval = _XcmsDIConvertColors(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); if (retval != XcmsFailure && pCompressed != NULL) { *(pCompressed + i) = True; } } return(retval); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LabMnL.c0000644000000000000000000001513413614532331015067 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * CIELabMnL.c * * DESCRIPTION * Source for the XcmsCIELabQueryMinL() gamut boundary * querying routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include #include "Cv.h" /* * DEFINES */ #define MAXBISECTCOUNT 100 #define EPS (XcmsFloat)0.001 #define START_L_STAR (XcmsFloat)40.0 /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELabQueryMinL - Compute max Lstar for a hue and chroma * * SYNOPSIS */ Status XcmsCIELabQueryMinL( XcmsCCC ccc, XcmsFloat hue_angle, /* hue angle in degrees */ XcmsFloat chroma, XcmsColor *pColor_return) /* * DESCRIPTION * Return the maximum Lstar for a specified hue_angle and chroma. * * ASSUMPTIONS * This routine assumes that the white point associated with * the color specification is the Screen White Point. The * Screen White Point will also be associated with the * returned color specification. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded with no modifications * */ { XcmsCCCRec myCCC; XcmsColor max_lc, tmp, prev; XcmsFloat max_chroma, tmp_chroma; XcmsFloat hue, nT, nChroma, lastChroma, prevChroma; XcmsFloat rFactor; XcmsRGBi rgb_saved; int nCount, nMaxCount; /* * Check Arguments */ if (ccc == NULL || pColor_return == NULL) { return(XcmsFailure); } /* setup the CCC to use for the conversions. */ memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat; myCCC.gamutCompProc = (XcmsCompressionProc) NULL; while (hue_angle < 0.0) { hue_angle += 360.0; } while (hue_angle >= 360.0) { hue_angle -= 360.0; } hue = radians(hue_angle); tmp.spec.CIELab.L_star = START_L_STAR; tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, chroma); tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, chroma); tmp.pixel = pColor_return->pixel; tmp.format = XcmsCIELabFormat; /* Step 1: Obtain the maximum L_star and chroma for this hue. */ if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) == XcmsFailure) { return(XcmsFailure); } max_chroma = XCMS_CIELAB_PMETRIC_CHROMA(max_lc.spec.CIELab.a_star, max_lc.spec.CIELab.b_star); if (max_chroma <= chroma) { /* * If the chroma is greater than the chroma for the * maximum L/chroma point then the L_star is the * the L_star for the maximum L_star/chroma point. * This is an error but I return the best approximation I can. * Thus the inconsistency. */ memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); return(XcmsSuccess); } /* * If the chroma is equal to the chroma for the * maximum L_star/chroma point then the L_star is the * the L_star for the maximum L* and chroma point. */ /* if (max_chroma == chroma) { * memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); * return(XcmsSuccess); * } */ /* must do a bisection here to compute the maximum L* */ /* save the structure input so that any elements that */ /* are not touched are recopied later in the routine. */ nChroma = chroma; tmp_chroma = max_chroma; lastChroma = -1.0; nMaxCount = MAXBISECTCOUNT; rFactor = 1.0; for (nCount = 0; nCount < nMaxCount; nCount++) { prevChroma = lastChroma; lastChroma = tmp_chroma; nT = (nChroma - max_chroma) / max_chroma * rFactor; memcpy ((char *)&prev, (char *)&tmp, sizeof(XcmsColor)); tmp.spec.RGBi.red = rgb_saved.red + (rgb_saved.red * nT); tmp.spec.RGBi.green = rgb_saved.green + (rgb_saved.green * nT); tmp.spec.RGBi.blue = rgb_saved.blue + (rgb_saved.blue * nT); tmp.format = XcmsRGBiFormat; /* convert from RGB to CIELab */ if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } /* Now check the return against what is expected */ tmp_chroma = XCMS_CIELAB_PMETRIC_CHROMA(tmp.spec.CIELab.a_star, tmp.spec.CIELab.b_star); if (tmp_chroma <= chroma + EPS && tmp_chroma >= chroma - EPS) { /* Found It! */ memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); return(XcmsSuccess); } nChroma += chroma - tmp_chroma; if (nChroma > max_chroma) { nChroma = max_chroma; rFactor *= 0.5; /* selective relaxation employed */ } else if (nChroma < 0.0) { if (XCMS_FABS(lastChroma - chroma) < XCMS_FABS(tmp_chroma - chroma)) { memcpy ((char *)pColor_return, (char *)&prev, sizeof(XcmsColor)); } else { memcpy ((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); } return(XcmsSuccess); } else if (tmp_chroma <= prevChroma + EPS && tmp_chroma >= prevChroma - EPS) { rFactor *= 0.5; /* selective relaxation employed */ } } if (nCount >= nMaxCount) { if (XCMS_FABS(lastChroma - chroma) < XCMS_FABS(tmp_chroma - chroma)) { memcpy ((char *)pColor_return, (char *)&prev, sizeof(XcmsColor)); } else { memcpy ((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); } } memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LabMxC.c0000644000000000000000000001445113614532331015071 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * * NAME * CIELabMxC.c * * DESCRIPTION * Source for the XcmsCIELabQueryMaxC() gamut boundary * querying routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include #include "Cv.h" /* * DEFINES */ #define MAXBISECTCOUNT 100 #define EPS (XcmsFloat)0.001 #define START_CHROMA (XcmsFloat)3.6 #define TOPL (XcmsFloat)100.0 /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELabQueryMaxC - max chroma for a hue_angle and L_star * * SYNOPSIS */ Status XcmsCIELabQueryMaxC( XcmsCCC ccc, XcmsFloat hue_angle, /* hue angle in degrees */ XcmsFloat L_star, XcmsColor *pColor_return) /* * DESCRIPTION * Return the maximum chroma for a specific hue_angle and L_star. * The returned format is in XcmsCIELabFormat. * * * ASSUMPTIONS * This routine assumes that the white point associated with * the color specification is the Screen White Point. The * Screen White Point will also be associated with the * returned color specification. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { XcmsCCCRec myCCC; XcmsColor tmp; XcmsColor max_lc; XcmsFloat n_L_star, last_L_star, prev_L_star; XcmsFloat hue, lastaStar, lastbStar, /*lastChroma,*/ maxDist, nT, rFactor; XcmsRGBi rgb_saved; int nCount, nMaxCount; /* * Check Arguments */ if (ccc == NULL || pColor_return == NULL) { return(XcmsFailure); } /* Use my own CCC and inherit screen white Pt */ memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat; myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut comp func */ while (hue_angle < 0.0) { hue_angle += 360.0; } while (hue_angle >= 360.0) { hue_angle -= 360.0; } hue = radians(hue_angle); tmp.spec.CIELab.L_star = L_star; tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, START_CHROMA); tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, START_CHROMA); tmp.pixel = pColor_return->pixel; tmp.format = XcmsCIELabFormat; /* Step 1: compute the maximum L_star and chroma for this hue. */ memcpy((char *)&max_lc, (char *)&tmp, sizeof(XcmsColor)); if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) == XcmsFailure) { return(XcmsFailure); } /* * Step 2: Do a bisection here to compute the maximum chroma * Note the differences between when the point to be found * is above the maximum LC point and when it is below. */ if (L_star <= max_lc.spec.CIELab.L_star) { maxDist = max_lc.spec.CIELab.L_star; } else { maxDist = TOPL - max_lc.spec.CIELab.L_star; } n_L_star = L_star; last_L_star = -1.0; nMaxCount = MAXBISECTCOUNT; rFactor = 1.0; for (nCount = 0; nCount < nMaxCount; nCount++) { prev_L_star = last_L_star; last_L_star = tmp.spec.CIELab.L_star; /* lastChroma = XCMS_CIELAB_PMETRIC_CHROMA(tmp.spec.CIELab.a_star, */ /* tmp.spec.CIELab.b_star); */ lastaStar = tmp.spec.CIELab.a_star; lastbStar = tmp.spec.CIELab.b_star; nT = (n_L_star - max_lc.spec.CIELab.L_star) / maxDist * rFactor; if (nT > 0) { tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; } else { tmp.spec.RGBi.red = rgb_saved.red + (rgb_saved.red * nT); tmp.spec.RGBi.green = rgb_saved.green + (rgb_saved.green * nT); tmp.spec.RGBi.blue = rgb_saved.blue + (rgb_saved.blue * nT); } tmp.format = XcmsRGBiFormat; /* convert from RGB to CIELab */ if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } /* * Now check if we've reached the target L_star */ /* printf("result Lstar = %lf\n", tmp.spec.CIELab.L_star); */ if (tmp.spec.CIELab.L_star <= L_star + EPS && tmp.spec.CIELab.L_star >= L_star - EPS) { memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); return(XcmsSuccess); } if (nT > 0) { n_L_star += ((TOPL - n_L_star) * (L_star - tmp.spec.CIELab.L_star)) / (TOPL - L_star); } else { n_L_star *= L_star / tmp.spec.CIELuv.L_star; } if (tmp.spec.CIELab.L_star <= prev_L_star + EPS && tmp.spec.CIELab.L_star >= prev_L_star - EPS) { rFactor *= 0.5; /* selective relaxation employed */ /* printf("rFactor = %lf\n", rFactor); */ } } if (XCMS_FABS(last_L_star - L_star) < XCMS_FABS(tmp.spec.CIELab.L_star - L_star)) { tmp.spec.CIELab.a_star = lastaStar; tmp.spec.CIELab.b_star = lastbStar; /* tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, lastChroma); */ /* tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, lastChroma); */ } tmp.spec.CIELab.L_star = L_star; memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LabMxL.c0000644000000000000000000001507213614532331015102 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * CIELabMxL.c * * DESCRIPTION * Source for the XcmsCIELabQueryMaxL() gamut boundary * querying routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include #include "Cv.h" /* * DEFINES */ #define MAXBISECTCOUNT 100 #define EPS (XcmsFloat)0.001 #define START_L_STAR (XcmsFloat)40 /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELabQueryMaxL - Compute max Lstar for a hue and chroma * * SYNOPSIS */ Status XcmsCIELabQueryMaxL( XcmsCCC ccc, XcmsFloat hue_angle, /* hue in degrees */ XcmsFloat chroma, XcmsColor *pColor_return) /* * DESCRIPTION * Return the maximum Lstar for a specified hue_angle and chroma. * * ASSUMPTIONS * This routine assumes that the white point associated with * the color specification is the Screen White Point. The * Screen White Point will also be associated with the * returned color specification. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded with no modifications * */ { XcmsCCCRec myCCC; XcmsColor max_lc, tmp, prev; XcmsFloat max_chroma, tmp_chroma; XcmsFloat hue, nT, nChroma, lastChroma, prevChroma; XcmsFloat rFactor; XcmsRGBi rgb_saved; int nCount, nMaxCount; /* * Check Arguments */ if (ccc == NULL || pColor_return == NULL) { return(XcmsFailure); } /* setup the CCC to use for the conversions. */ memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat; myCCC.gamutCompProc = (XcmsCompressionProc) NULL; while (hue_angle < 0.0) { hue_angle += 360.0; } while (hue_angle >= 360.0) { hue_angle -= 360.0; } hue = radians(hue_angle); tmp.spec.CIELab.L_star = START_L_STAR; tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, chroma); tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, chroma); tmp.pixel = pColor_return->pixel; tmp.format = XcmsCIELabFormat; /* Step 1: Obtain the maximum L_star and chroma for this hue. */ if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) == XcmsFailure) { return(XcmsFailure); } max_chroma = XCMS_CIELAB_PMETRIC_CHROMA(max_lc.spec.CIELab.a_star, max_lc.spec.CIELab.b_star); if (max_chroma <= chroma) { /* * If the chroma is greater than the chroma for the * maximum L/chroma point then the L_star is the * the L_star for the maximum L_star/chroma point. * This is an error but I return the best approximation I can. * Thus the inconsistency. */ memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); return(XcmsSuccess); } /* * If the chroma is equal to the chroma for the * maximum L_star/chroma point then the L_star is the * the L_star for the maximum L* and chroma point. */ /* if (max_chroma == chroma) { * memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); * return(XcmsSuccess); * } */ /* must do a bisection here to compute the maximum L* */ /* save the structure input so that any elements that */ /* are not touched are recopied later in the routine. */ nChroma = chroma; tmp_chroma = max_chroma; lastChroma = -1.0; nMaxCount = MAXBISECTCOUNT; rFactor = 1.0; for (nCount = 0; nCount < nMaxCount; nCount++) { prevChroma = lastChroma; lastChroma = tmp_chroma; nT = (1.0 - (nChroma / max_chroma)) * rFactor; memcpy ((char *)&prev, (char *)&tmp, sizeof(XcmsColor)); tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; tmp.format = XcmsRGBiFormat; /* convert from RGB to CIELab */ if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } /* Now check the return against what is expected */ tmp_chroma = XCMS_CIELAB_PMETRIC_CHROMA(tmp.spec.CIELab.a_star, tmp.spec.CIELab.b_star); if (tmp_chroma <= chroma + EPS && tmp_chroma >= chroma - EPS) { /* Found It! */ memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); return(XcmsSuccess); } nChroma += chroma - tmp_chroma; if (nChroma > max_chroma) { nChroma = max_chroma; rFactor *= 0.5; /* selective relaxation employed */ } else if (nChroma < 0.0) { if (XCMS_FABS(lastChroma - chroma) < XCMS_FABS(tmp_chroma - chroma)) { memcpy ((char *)pColor_return, (char *)&prev, sizeof(XcmsColor)); } else { memcpy ((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); } return(XcmsSuccess); } else if (tmp_chroma <= prevChroma + EPS && tmp_chroma >= prevChroma - EPS) { rFactor *= 0.5; /* selective relaxation employed */ } } if (nCount >= nMaxCount) { if (XCMS_FABS(lastChroma - chroma) < XCMS_FABS(tmp_chroma - chroma)) { memcpy ((char *)pColor_return, (char *)&prev, sizeof(XcmsColor)); } else { memcpy ((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); } } memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LabMxLC.c0000644000000000000000000001450113614532331015201 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * * NAME * CIELabMxVC.c * * DESCRIPTION * Source for the XcmsCIELabQueryMaxLC() gamut boundary * querying routine. * * DOCUMENTATION * "TekColor Color Management System, System Implementor's Manual" * and * Fred W. Billmeyer & Max Saltzman, "Principles of Color * Technology", John Wily & Sons, Inc, 1981. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * DEFINES */ #define MIN(x,y) ((x) > (y) ? (y) : (x)) #define MIN3(x,y,z) ((x) > (MIN((y), (z))) ? (MIN((y), (z))) : (x)) #define MAX(x,y) ((x) > (y) ? (x) : (y)) #define MAX3(x,y,z) ((x) > (MAX((y), (z))) ? (x) : (MAX((y), (z)))) #define START_LSTAR (XcmsFloat)40.0 #define START_CHROMA (XcmsFloat)3.6 /************************************************************************ * * * API PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * _XcmsCIELabQueryMaxLCRGB - Compute maximum L* and chroma. * * SYNOPSIS */ Status _XcmsCIELabQueryMaxLCRGB( XcmsCCC ccc, XcmsFloat hue, /* hue in radians */ XcmsColor *pColor_return, XcmsRGBi *pRGB_return) /* * DESCRIPTION * Return the maximum psychometric chroma for a specified * hue, and the corresponding L*. This is computed * by a binary search of all possible chromas. An assumption * is made that there are no local maxima. Use the unrounded * Max psychometric chroma because the difference check can be * small. * * NOTE: No local CCC is used because this is a private * routine and all routines that call it are expected * to behave properly, i.e. send a local CCC with * no white adjust function and no gamut compression * function. * * This routine only accepts hue in radians as input and outputs * Lab and RGBi. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { XcmsFloat nSmall, nLarge; XcmsColor tmp; tmp.format = XcmsCIELabFormat; /* Use some unreachable color on the given hue */ tmp.spec.CIELab.L_star = START_LSTAR; tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, START_CHROMA); tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, START_CHROMA); /* * Convert from Lab to RGB * * Note that the CIEXYZ to RGBi conversion routine must stuff the * out of bounds RGBi values in tmp when the ccc->gamutCompProc * is NULL. */ if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc), (unsigned int)1, XcmsRGBiFormat, (Bool *) NULL) == XcmsFailure) && tmp.format != XcmsRGBiFormat) { return (XcmsFailure); } /* Now pick the smallest RGB */ nSmall = MIN3(tmp.spec.RGBi.red, tmp.spec.RGBi.green, tmp.spec.RGBi.blue); /* Make the smallest RGB equal to zero */ tmp.spec.RGBi.red -= nSmall; tmp.spec.RGBi.green -= nSmall; tmp.spec.RGBi.blue -= nSmall; /* Now pick the largest RGB */ nLarge = MAX3(tmp.spec.RGBi.red, tmp.spec.RGBi.green, tmp.spec.RGBi.blue); /* Scale the RGB values based on the largest one */ tmp.spec.RGBi.red /= nLarge; tmp.spec.RGBi.green /= nLarge; tmp.spec.RGBi.blue /= nLarge; tmp.format = XcmsRGBiFormat; /* If the calling routine wants RGB value give them the ones used. */ if (pRGB_return) { pRGB_return->red = tmp.spec.RGBi.red; pRGB_return->green = tmp.spec.RGBi.green; pRGB_return->blue = tmp.spec.RGBi.blue; } /* Convert from RGBi to Lab */ if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc), 1, XcmsCIELabFormat, (Bool *) NULL) == XcmsFailure) { return (XcmsFailure); } memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); return (XcmsSuccess); } /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELabQueryMaxLC - Compute maximum L* and chroma. * * SYNOPSIS */ Status XcmsCIELabQueryMaxLC ( XcmsCCC ccc, XcmsFloat hue_angle, /* hue_angle in degrees */ XcmsColor *pColor_return) /* * DESCRIPTION * Return the point of maximum chroma for the specified * hue_angle. * * ASSUMPTIONS * This routine assumes that the white point associated with * the color specification is the Screen White Point. The * Screen White Point will also be associated with the * returned color specification. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { XcmsCCCRec myCCC; /* * Check Arguments */ if (ccc == NULL || pColor_return == NULL) { return(XcmsFailure); } /* Use my own CCC */ memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat; myCCC.gamutCompProc = (XcmsCompressionProc)NULL; while (hue_angle < 0.0) { hue_angle += 360.0; } while (hue_angle >= 360.0) { hue_angle -= 360.0; } return(_XcmsCIELabQueryMaxLCRGB (&myCCC, radians(hue_angle), pColor_return, (XcmsRGBi *)NULL)); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LabWpAj.c0000644000000000000000000000541513614532331015243 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * CIELabWpAj.c * * DESCRIPTION * This file contains routine(s) that support white point * adjustment of color specifications in the CIE L*a*b* color * space. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * EXTERNS */ /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELabWhiteShiftColors * * SYNOPSIS */ Status XcmsCIELabWhiteShiftColors( XcmsCCC ccc, XcmsColor *pWhitePtFrom, XcmsColor *pWhitePtTo, XcmsColorFormat destSpecFmt, XcmsColor *pColors_in_out, unsigned int nColors, Bool *pCompressed) /* * DESCRIPTION * Adjust color specifications in XcmsColor structures for * differences in white points. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded without gamut compression, * XcmsSuccessWithCompression if succeeded with gamut * compression. */ { if (pWhitePtFrom == NULL || pWhitePtTo == NULL || pColors_in_out == NULL) { return(0); } /* * Convert to CIELab using pWhitePtFrom */ if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, nColors, XcmsCIELabFormat, pCompressed) == XcmsFailure) { return(XcmsFailure); } /* * Convert from CIELab to destSpecFmt using pWhitePtTo */ return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtTo, nColors, destSpecFmt, pCompressed)); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LRGB.c0000644000000000000000000013557213614532331014521 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsLRGB.c * * DESCRIPTION * This file contains the conversion routines: * 1. CIE XYZ to RGB intensity * 2. RGB intensity to device RGB * 3. device RGB to RGB intensity * 4. RGB intensity to CIE XYZ * */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * LOCAL DEFINES * #define declarations local to this package. */ #define EPS 0.001 #ifndef MIN #define MIN(x,y) ((x) > (y) ? (y) : (x)) #endif /* MIN */ #ifndef MAX #define MAX(x,y) ((x) > (y) ? (x) : (y)) #endif /* MAX */ #ifndef MIN3 #define MIN3(x,y,z) ((x) > (MIN((y), (z))) ? (MIN((y), (z))) : (x)) #endif /* MIN3 */ #ifndef MAX3 #define MAX3(x,y,z) ((x) > (MAX((y), (z))) ? (x) : (MAX((y), (z)))) #endif /* MAX3 */ /* * LOCAL TYPEDEFS * typedefs local to this package (for use with local vars). * */ /* * FORWARD DECLARATIONS */ static void LINEAR_RGB_FreeSCCData(XPointer pScreenDataTemp); static int LINEAR_RGB_InitSCCData(Display *dpy, int screenNumber, XcmsPerScrnInfo *pPerScrnInfo); static int XcmsLRGB_RGB_ParseString(register char *spec, XcmsColor *pColor); static int XcmsLRGB_RGBi_ParseString(register char *spec, XcmsColor *pColor); static Status _XcmsGetTableType0( IntensityTbl *pTbl, int format, char **pChar, unsigned long *pCount); static Status _XcmsGetTableType1( IntensityTbl *pTbl, int format, char **pChar, unsigned long *pCount); /* * LOCALS VARIABLES * Variables local to this package. * Usage example: * static int ExampleLocalVar; */ static unsigned short const MASK[17] = { 0x0000, /* 0 bitsPerRGB */ 0x8000, /* 1 bitsPerRGB */ 0xc000, /* 2 bitsPerRGB */ 0xe000, /* 3 bitsPerRGB */ 0xf000, /* 4 bitsPerRGB */ 0xf800, /* 5 bitsPerRGB */ 0xfc00, /* 6 bitsPerRGB */ 0xfe00, /* 7 bitsPerRGB */ 0xff00, /* 8 bitsPerRGB */ 0xff80, /* 9 bitsPerRGB */ 0xffc0, /* 10 bitsPerRGB */ 0xffe0, /* 11 bitsPerRGB */ 0xfff0, /* 12 bitsPerRGB */ 0xfff8, /* 13 bitsPerRGB */ 0xfffc, /* 14 bitsPerRGB */ 0xfffe, /* 15 bitsPerRGB */ 0xffff /* 16 bitsPerRGB */ }; /* * A NULL terminated array of function pointers that when applied * in series will convert an XcmsColor structure from XcmsRGBFormat * to XcmsCIEXYZFormat. */ static XcmsConversionProc Fl_RGB_to_CIEXYZ[] = { (XcmsConversionProc)XcmsRGBToRGBi, (XcmsConversionProc)XcmsRGBiToCIEXYZ, NULL }; /* * A NULL terminated array of function pointers that when applied * in series will convert an XcmsColor structure from XcmsCIEXYZFormat * to XcmsRGBFormat. */ static XcmsConversionProc Fl_CIEXYZ_to_RGB[] = { (XcmsConversionProc)XcmsCIEXYZToRGBi, (XcmsConversionProc)XcmsRGBiToRGB, NULL }; /* * A NULL terminated array of function pointers that when applied * in series will convert an XcmsColor structure from XcmsRGBiFormat * to XcmsCIEXYZFormat. */ static XcmsConversionProc Fl_RGBi_to_CIEXYZ[] = { (XcmsConversionProc)XcmsRGBiToCIEXYZ, NULL }; /* * A NULL terminated array of function pointers that when applied * in series will convert an XcmsColor structure from XcmsCIEXYZFormat * to XcmsRGBiFormat. */ static XcmsConversionProc Fl_CIEXYZ_to_RGBi[] = { (XcmsConversionProc)XcmsCIEXYZToRGBi, NULL }; /* * RGBi Color Spaces */ XcmsColorSpace XcmsRGBiColorSpace = { _XcmsRGBi_prefix, /* prefix */ XcmsRGBiFormat, /* id */ XcmsLRGB_RGBi_ParseString, /* parseString */ Fl_RGBi_to_CIEXYZ, /* to_CIEXYZ */ Fl_CIEXYZ_to_RGBi, /* from_CIEXYZ */ 1 }; /* * RGB Color Spaces */ XcmsColorSpace XcmsRGBColorSpace = { _XcmsRGB_prefix, /* prefix */ XcmsRGBFormat, /* id */ XcmsLRGB_RGB_ParseString, /* parseString */ Fl_RGB_to_CIEXYZ, /* to_CIEXYZ */ Fl_CIEXYZ_to_RGB, /* from_CIEXYZ */ 1 }; /* * Device-Independent Color Spaces known to the * LINEAR_RGB Screen Color Characteristics Function Set. */ static XcmsColorSpace *DDColorSpaces[] = { &XcmsRGBColorSpace, &XcmsRGBiColorSpace, NULL }; /* * GLOBALS * Variables declared in this package that are allowed * to be used globally. */ /* * LINEAR_RGB Screen Color Characteristics Function Set. */ XcmsFunctionSet XcmsLinearRGBFunctionSet = { &DDColorSpaces[0], /* pDDColorSpaces */ LINEAR_RGB_InitSCCData, /* pInitScrnFunc */ LINEAR_RGB_FreeSCCData /* pFreeSCCData */ }; /* * DESCRIPTION * Contents of Default SCCData should be replaced if other * data should be used as default. * * */ /* * NAME Tektronix 19" (Sony) CRT * PART_NUMBER 119-2451-00 * MODEL Tek4300, Tek4800 */ static IntensityRec const Default_RGB_RedTuples[] = { /* {unsigned short value, XcmsFloat intensity} */ { 0x0000, 0.000000 }, { 0x0909, 0.000000 }, { 0x0a0a, 0.000936 }, { 0x0f0f, 0.001481 }, { 0x1414, 0.002329 }, { 0x1919, 0.003529 }, { 0x1e1e, 0.005127 }, { 0x2323, 0.007169 }, { 0x2828, 0.009699 }, { 0x2d2d, 0.012759 }, { 0x3232, 0.016392 }, { 0x3737, 0.020637 }, { 0x3c3c, 0.025533 }, { 0x4141, 0.031119 }, { 0x4646, 0.037431 }, { 0x4b4b, 0.044504 }, { 0x5050, 0.052373 }, { 0x5555, 0.061069 }, { 0x5a5a, 0.070624 }, { 0x5f5f, 0.081070 }, { 0x6464, 0.092433 }, { 0x6969, 0.104744 }, { 0x6e6e, 0.118026 }, { 0x7373, 0.132307 }, { 0x7878, 0.147610 }, { 0x7d7d, 0.163958 }, { 0x8282, 0.181371 }, { 0x8787, 0.199871 }, { 0x8c8c, 0.219475 }, { 0x9191, 0.240202 }, { 0x9696, 0.262069 }, { 0x9b9b, 0.285089 }, { 0xa0a0, 0.309278 }, { 0xa5a5, 0.334647 }, { 0xaaaa, 0.361208 }, { 0xafaf, 0.388971 }, { 0xb4b4, 0.417945 }, { 0xb9b9, 0.448138 }, { 0xbebe, 0.479555 }, { 0xc3c3, 0.512202 }, { 0xc8c8, 0.546082 }, { 0xcdcd, 0.581199 }, { 0xd2d2, 0.617552 }, { 0xd7d7, 0.655144 }, { 0xdcdc, 0.693971 }, { 0xe1e1, 0.734031 }, { 0xe6e6, 0.775322 }, { 0xebeb, 0.817837 }, { 0xf0f0, 0.861571 }, { 0xf5f5, 0.906515 }, { 0xfafa, 0.952662 }, { 0xffff, 1.000000 } }; static IntensityRec const Default_RGB_GreenTuples[] = { /* {unsigned short value, XcmsFloat intensity} */ { 0x0000, 0.000000 }, { 0x1313, 0.000000 }, { 0x1414, 0.000832 }, { 0x1919, 0.001998 }, { 0x1e1e, 0.003612 }, { 0x2323, 0.005736 }, { 0x2828, 0.008428 }, { 0x2d2d, 0.011745 }, { 0x3232, 0.015740 }, { 0x3737, 0.020463 }, { 0x3c3c, 0.025960 }, { 0x4141, 0.032275 }, { 0x4646, 0.039449 }, { 0x4b4b, 0.047519 }, { 0x5050, 0.056520 }, { 0x5555, 0.066484 }, { 0x5a5a, 0.077439 }, { 0x5f5f, 0.089409 }, { 0x6464, 0.102418 }, { 0x6969, 0.116485 }, { 0x6e6e, 0.131625 }, { 0x7373, 0.147853 }, { 0x7878, 0.165176 }, { 0x7d7d, 0.183604 }, { 0x8282, 0.203140 }, { 0x8787, 0.223783 }, { 0x8c8c, 0.245533 }, { 0x9191, 0.268384 }, { 0x9696, 0.292327 }, { 0x9b9b, 0.317351 }, { 0xa0a0, 0.343441 }, { 0xa5a5, 0.370580 }, { 0xaaaa, 0.398747 }, { 0xafaf, 0.427919 }, { 0xb4b4, 0.458068 }, { 0xb9b9, 0.489165 }, { 0xbebe, 0.521176 }, { 0xc3c3, 0.554067 }, { 0xc8c8, 0.587797 }, { 0xcdcd, 0.622324 }, { 0xd2d2, 0.657604 }, { 0xd7d7, 0.693588 }, { 0xdcdc, 0.730225 }, { 0xe1e1, 0.767459 }, { 0xe6e6, 0.805235 }, { 0xebeb, 0.843491 }, { 0xf0f0, 0.882164 }, { 0xf5f5, 0.921187 }, { 0xfafa, 0.960490 }, { 0xffff, 1.000000 } }; static IntensityRec const Default_RGB_BlueTuples[] = { /* {unsigned short value, XcmsFloat intensity} */ { 0x0000, 0.000000 }, { 0x0e0e, 0.000000 }, { 0x0f0f, 0.001341 }, { 0x1414, 0.002080 }, { 0x1919, 0.003188 }, { 0x1e1e, 0.004729 }, { 0x2323, 0.006766 }, { 0x2828, 0.009357 }, { 0x2d2d, 0.012559 }, { 0x3232, 0.016424 }, { 0x3737, 0.021004 }, { 0x3c3c, 0.026344 }, { 0x4141, 0.032489 }, { 0x4646, 0.039481 }, { 0x4b4b, 0.047357 }, { 0x5050, 0.056154 }, { 0x5555, 0.065903 }, { 0x5a5a, 0.076634 }, { 0x5f5f, 0.088373 }, { 0x6464, 0.101145 }, { 0x6969, 0.114968 }, { 0x6e6e, 0.129862 }, { 0x7373, 0.145841 }, { 0x7878, 0.162915 }, { 0x7d7d, 0.181095 }, { 0x8282, 0.200386 }, { 0x8787, 0.220791 }, { 0x8c8c, 0.242309 }, { 0x9191, 0.264937 }, { 0x9696, 0.288670 }, { 0x9b9b, 0.313499 }, { 0xa0a0, 0.339410 }, { 0xa5a5, 0.366390 }, { 0xaaaa, 0.394421 }, { 0xafaf, 0.423481 }, { 0xb4b4, 0.453547 }, { 0xb9b9, 0.484592 }, { 0xbebe, 0.516587 }, { 0xc3c3, 0.549498 }, { 0xc8c8, 0.583291 }, { 0xcdcd, 0.617925 }, { 0xd2d2, 0.653361 }, { 0xd7d7, 0.689553 }, { 0xdcdc, 0.726454 }, { 0xe1e1, 0.764013 }, { 0xe6e6, 0.802178 }, { 0xebeb, 0.840891 }, { 0xf0f0, 0.880093 }, { 0xf5f5, 0.919723 }, { 0xfafa, 0.959715 }, { 0xffff, 1.00000 } }; static IntensityTbl Default_RGB_RedTbl = { /* IntensityRec *pBase */ (IntensityRec *) Default_RGB_RedTuples, /* unsigned int nEntries */ 52 }; static IntensityTbl Default_RGB_GreenTbl = { /* IntensityRec *pBase */ (IntensityRec *)Default_RGB_GreenTuples, /* unsigned int nEntries */ 50 }; static IntensityTbl Default_RGB_BlueTbl = { /* IntensityRec *pBase */ (IntensityRec *)Default_RGB_BlueTuples, /* unsigned int nEntries */ 51 }; static LINEAR_RGB_SCCData Default_RGB_SCCData = { /* XcmsFloat XYZtoRGBmatrix[3][3] */ { { 3.48340481253539000, -1.52176374927285200, -0.55923133354049780 }, {-1.07152751306193600, 1.96593795204372400, 0.03673691339553462 }, { 0.06351179790497788, -0.20020501000496480, 0.81070942031648220 } }, /* XcmsFloat RGBtoXYZmatrix[3][3] */ { { 0.38106149108714790, 0.32025712365352110, 0.24834578525933100 }, { 0.20729745115140850, 0.68054638776373240, 0.11215616108485920 }, { 0.02133944350088028, 0.14297193020246480, 1.24172892629665500 } }, /* IntensityTbl *pRedTbl */ &Default_RGB_RedTbl, /* IntensityTbl *pGreenTbl */ &Default_RGB_GreenTbl, /* IntensityTbl *pBlueTbl */ &Default_RGB_BlueTbl }; /************************************************************************ * * * PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * LINEAR_RGB_InitSCCData() * * SYNOPSIS */ static Status LINEAR_RGB_InitSCCData( Display *dpy, int screenNumber, XcmsPerScrnInfo *pPerScrnInfo) /* * DESCRIPTION * * RETURNS * XcmsFailure if failed. * XcmsSuccess if succeeded. * */ { Atom CorrectAtom = XInternAtom (dpy, XDCCC_CORRECT_ATOM_NAME, True); Atom MatrixAtom = XInternAtom (dpy, XDCCC_MATRIX_ATOM_NAME, True); int format_return, count, cType, nTables; unsigned long nitems, nbytes_return; char *property_return, *pChar; XcmsFloat *pValue; #ifdef ALLDEBUG IntensityRec *pIRec; #endif /* ALLDEBUG */ VisualID visualID; LINEAR_RGB_SCCData *pScreenData, *pScreenDefaultData; XcmsIntensityMap *pNewMap; /* * Allocate memory for pScreenData */ if (!(pScreenData = pScreenDefaultData = (LINEAR_RGB_SCCData *) Xcalloc (1, sizeof(LINEAR_RGB_SCCData)))) { return(XcmsFailure); } /* * 1. Get the XYZ->RGB and RGB->XYZ matrices */ if (MatrixAtom == None || !_XcmsGetProperty (dpy, RootWindow(dpy, screenNumber), MatrixAtom, &format_return, &nitems, &nbytes_return, &property_return) || nitems != 18 || format_return != 32) { /* * As per the XDCCC, there must be 18 data items and each must be * in 32 bits ! */ goto FreeSCCData; } else { /* * RGBtoXYZ and XYZtoRGB matrices */ pValue = (XcmsFloat *) pScreenData; pChar = property_return; for (count = 0; count < 18; count++) { *pValue++ = (long)_XcmsGetElement(format_return, &pChar, &nitems) / (XcmsFloat)XDCCC_NUMBER; } Xfree (property_return); pPerScrnInfo->screenWhitePt.spec.CIEXYZ.X = pScreenData->RGBtoXYZmatrix[0][0] + pScreenData->RGBtoXYZmatrix[0][1] + pScreenData->RGBtoXYZmatrix[0][2]; pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y = pScreenData->RGBtoXYZmatrix[1][0] + pScreenData->RGBtoXYZmatrix[1][1] + pScreenData->RGBtoXYZmatrix[1][2]; pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Z = pScreenData->RGBtoXYZmatrix[2][0] + pScreenData->RGBtoXYZmatrix[2][1] + pScreenData->RGBtoXYZmatrix[2][2]; /* * Compute the Screen White Point */ if ((pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y < (1.0 - EPS) ) || (pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y > (1.0 + EPS))) { goto FreeSCCData; } else { pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y = 1.0; } pPerScrnInfo->screenWhitePt.format = XcmsCIEXYZFormat; pPerScrnInfo->screenWhitePt.pixel = 0; #ifdef PDEBUG printf ("RGB to XYZ Matrix values:\n"); printf (" %f %f %f\n %f %f %f\n %f %f %f\n", pScreenData->RGBtoXYZmatrix[0][0], pScreenData->RGBtoXYZmatrix[0][1], pScreenData->RGBtoXYZmatrix[0][2], pScreenData->RGBtoXYZmatrix[1][0], pScreenData->RGBtoXYZmatrix[1][1], pScreenData->RGBtoXYZmatrix[1][2], pScreenData->RGBtoXYZmatrix[2][0], pScreenData->RGBtoXYZmatrix[2][1], pScreenData->RGBtoXYZmatrix[2][2]); printf ("XYZ to RGB Matrix values:\n"); printf (" %f %f %f\n %f %f %f\n %f %f %f\n", pScreenData->XYZtoRGBmatrix[0][0], pScreenData->XYZtoRGBmatrix[0][1], pScreenData->XYZtoRGBmatrix[0][2], pScreenData->XYZtoRGBmatrix[1][0], pScreenData->XYZtoRGBmatrix[1][1], pScreenData->XYZtoRGBmatrix[1][2], pScreenData->XYZtoRGBmatrix[2][0], pScreenData->XYZtoRGBmatrix[2][1], pScreenData->XYZtoRGBmatrix[2][2]); printf ("Screen White Pt value: %f %f %f\n", pPerScrnInfo->screenWhitePt.spec.CIEXYZ.X, pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y, pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Z); #endif /* PDEBUG */ } /* * 2. Get the Intensity Profile */ if (CorrectAtom == None || !_XcmsGetProperty (dpy, RootWindow(dpy, screenNumber), CorrectAtom, &format_return, &nitems, &nbytes_return, &property_return)) { goto FreeSCCData; } pChar = property_return; while (nitems) { switch (format_return) { case 8: /* * Must have at least: * VisualID0 * VisualID1 * VisualID2 * VisualID3 * type * count * length * intensity1 * intensity2 */ if (nitems < 9) { goto Free_property_return; } count = 3; break; case 16: /* * Must have at least: * VisualID0 * VisualID3 * type * count * length * intensity1 * intensity2 */ if (nitems < 7) { goto Free_property_return; } count = 1; break; case 32: /* * Must have at least: * VisualID0 * type * count * length * intensity1 * intensity2 */ if (nitems < 6) { goto Free_property_return; } count = 0; break; default: goto Free_property_return; } /* * Get VisualID */ visualID = _XcmsGetElement(format_return, &pChar, &nitems); while (count--) { visualID = visualID << format_return; visualID |= _XcmsGetElement(format_return, &pChar, &nitems); } if (visualID == 0) { /* * This is a shared intensity table */ pScreenData = pScreenDefaultData; } else { /* * This is a per-Visual intensity table */ if (!(pScreenData = (LINEAR_RGB_SCCData *) Xcalloc (1, sizeof(LINEAR_RGB_SCCData)))) { goto Free_property_return; } /* copy matrices */ memcpy((char *)pScreenData, (char *)pScreenDefaultData, 18 * sizeof(XcmsFloat)); /* Create, initialize, and add map */ if (!(pNewMap = (XcmsIntensityMap *) Xcalloc (1, sizeof(XcmsIntensityMap)))) { Xfree(pScreenData); goto Free_property_return; } pNewMap->visualID = visualID; pNewMap->screenData = (XPointer)pScreenData; pNewMap->pFreeScreenData = LINEAR_RGB_FreeSCCData; pNewMap->pNext = (XcmsIntensityMap *)dpy->cms.perVisualIntensityMaps; dpy->cms.perVisualIntensityMaps = (XPointer)pNewMap; dpy->free_funcs->intensityMaps = _XcmsFreeIntensityMaps; } cType = _XcmsGetElement(format_return, &pChar, &nitems); nTables = _XcmsGetElement(format_return, &pChar, &nitems); if (cType == 0) { /* Red Intensity Table */ if (!(pScreenData->pRedTbl = (IntensityTbl *) Xcalloc (1, sizeof(IntensityTbl)))) { goto Free_property_return; } if (_XcmsGetTableType0(pScreenData->pRedTbl, format_return, &pChar, &nitems) == XcmsFailure) { goto FreeRedTbl; } if (nTables == 1) { /* Green Intensity Table */ pScreenData->pGreenTbl = pScreenData->pRedTbl; /* Blue Intensity Table */ pScreenData->pBlueTbl = pScreenData->pRedTbl; } else { /* Green Intensity Table */ if (!(pScreenData->pGreenTbl = (IntensityTbl *) Xcalloc (1, sizeof(IntensityTbl)))) { goto FreeRedTblElements; } if (_XcmsGetTableType0(pScreenData->pGreenTbl, format_return, &pChar, &nitems) == XcmsFailure) { goto FreeGreenTbl; } /* Blue Intensity Table */ if (!(pScreenData->pBlueTbl = (IntensityTbl *) Xcalloc (1, sizeof(IntensityTbl)))) { goto FreeGreenTblElements; } if (_XcmsGetTableType0(pScreenData->pBlueTbl, format_return, &pChar, &nitems) == XcmsFailure) { goto FreeBlueTbl; } } } else if (cType == 1) { /* Red Intensity Table */ if (!(pScreenData->pRedTbl = (IntensityTbl *) Xcalloc (1, sizeof(IntensityTbl)))) { goto Free_property_return; } if (_XcmsGetTableType1(pScreenData->pRedTbl, format_return, &pChar, &nitems) == XcmsFailure) { goto FreeRedTbl; } if (nTables == 1) { /* Green Intensity Table */ pScreenData->pGreenTbl = pScreenData->pRedTbl; /* Blue Intensity Table */ pScreenData->pBlueTbl = pScreenData->pRedTbl; } else { /* Green Intensity Table */ if (!(pScreenData->pGreenTbl = (IntensityTbl *) Xcalloc (1, sizeof(IntensityTbl)))) { goto FreeRedTblElements; } if (_XcmsGetTableType1(pScreenData->pGreenTbl, format_return, &pChar, &nitems) == XcmsFailure) { goto FreeGreenTbl; } /* Blue Intensity Table */ if (!(pScreenData->pBlueTbl = (IntensityTbl *) Xcalloc (1, sizeof(IntensityTbl)))) { goto FreeGreenTblElements; } if (_XcmsGetTableType1(pScreenData->pBlueTbl, format_return, &pChar, &nitems) == XcmsFailure) { goto FreeBlueTbl; } } } else { goto Free_property_return; } #ifdef ALLDEBUG printf ("Intensity Table RED %d\n", pScreenData->pRedTbl->nEntries); pIRec = (IntensityRec *) pScreenData->pRedTbl->pBase; for (count = 0; count < pScreenData->pRedTbl->nEntries; count++, pIRec++) { printf ("\t0x%4x\t%f\n", pIRec->value, pIRec->intensity); } if (pScreenData->pGreenTbl->pBase != pScreenData->pRedTbl->pBase) { printf ("Intensity Table GREEN %d\n", pScreenData->pGreenTbl->nEntries); pIRec = (IntensityRec *)pScreenData->pGreenTbl->pBase; for (count = 0; count < pScreenData->pGreenTbl->nEntries; count++, pIRec++) { printf ("\t0x%4x\t%f\n", pIRec->value, pIRec->intensity); } } if (pScreenData->pBlueTbl->pBase != pScreenData->pRedTbl->pBase) { printf ("Intensity Table BLUE %d\n", pScreenData->pBlueTbl->nEntries); pIRec = (IntensityRec *) pScreenData->pBlueTbl->pBase; for (count = 0; count < pScreenData->pBlueTbl->nEntries; count++, pIRec++) { printf ("\t0x%4x\t%f\n", pIRec->value, pIRec->intensity); } } #endif /* ALLDEBUG */ } Xfree (property_return); /* Free the old memory and use the new structure created. */ LINEAR_RGB_FreeSCCData(pPerScrnInfo->screenData); pPerScrnInfo->functionSet = (XPointer) &XcmsLinearRGBFunctionSet; pPerScrnInfo->screenData = (XPointer) pScreenData; pPerScrnInfo->state = XcmsInitSuccess; return(XcmsSuccess); FreeBlueTblElements: Xfree(pScreenData->pBlueTbl->pBase); FreeBlueTbl: Xfree(pScreenData->pBlueTbl); FreeGreenTblElements: Xfree(pScreenData->pGreenTbl->pBase); FreeGreenTbl: Xfree(pScreenData->pGreenTbl); FreeRedTblElements: Xfree(pScreenData->pRedTbl->pBase); FreeRedTbl: Xfree(pScreenData->pRedTbl); Free_property_return: Xfree (property_return); FreeSCCData: Xfree(pScreenDefaultData); pPerScrnInfo->state = XcmsInitNone; return(XcmsFailure); } /* * NAME * LINEAR_RGB_FreeSCCData() * * SYNOPSIS */ static void LINEAR_RGB_FreeSCCData( XPointer pScreenDataTemp) /* * DESCRIPTION * * RETURNS * 0 if failed. * 1 if succeeded with no modifications. * */ { LINEAR_RGB_SCCData *pScreenData = (LINEAR_RGB_SCCData *) pScreenDataTemp; if (pScreenData && pScreenData != &Default_RGB_SCCData) { if (pScreenData->pRedTbl) { if (pScreenData->pGreenTbl) { if (pScreenData->pRedTbl->pBase != pScreenData->pGreenTbl->pBase) { if (pScreenData->pGreenTbl->pBase) { Xfree (pScreenData->pGreenTbl->pBase); } } if (pScreenData->pGreenTbl != pScreenData->pRedTbl) { Xfree (pScreenData->pGreenTbl); } } if (pScreenData->pBlueTbl) { if (pScreenData->pRedTbl->pBase != pScreenData->pBlueTbl->pBase) { if (pScreenData->pBlueTbl->pBase) { Xfree (pScreenData->pBlueTbl->pBase); } } if (pScreenData->pBlueTbl != pScreenData->pRedTbl) { Xfree (pScreenData->pBlueTbl); } } if (pScreenData->pRedTbl->pBase) { Xfree (pScreenData->pRedTbl->pBase); } Xfree (pScreenData->pRedTbl); } Xfree (pScreenData); } } /************************************************************************ * * * API PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * _XcmsGetTableType0 * * SYNOPSIS */ static Status _XcmsGetTableType0( IntensityTbl *pTbl, int format, char **pChar, unsigned long *pCount) /* * DESCRIPTION * * RETURNS * XcmsFailure if failed. * XcmsSuccess if succeeded. * */ { unsigned int nElements; IntensityRec *pIRec; nElements = pTbl->nEntries = _XcmsGetElement(format, pChar, pCount) + 1; if (!(pIRec = pTbl->pBase = (IntensityRec *) Xcalloc (nElements, sizeof(IntensityRec)))) { return(XcmsFailure); } switch (format) { case 8: for (; nElements--; pIRec++) { /* 0xFFFF/0xFF = 0x101 */ pIRec->value = _XcmsGetElement (format, pChar, pCount) * 0x101; pIRec->intensity = _XcmsGetElement (format, pChar, pCount) / (XcmsFloat)255.0; } break; case 16: for (; nElements--; pIRec++) { pIRec->value = _XcmsGetElement (format, pChar, pCount); pIRec->intensity = _XcmsGetElement (format, pChar, pCount) / (XcmsFloat)65535.0; } break; case 32: for (; nElements--; pIRec++) { pIRec->value = _XcmsGetElement (format, pChar, pCount); pIRec->intensity = _XcmsGetElement (format, pChar, pCount) / (XcmsFloat)4294967295.0; } break; default: return(XcmsFailure); } return(XcmsSuccess); } /* * NAME * _XcmsGetTableType1 * * SYNOPSIS */ static Status _XcmsGetTableType1( IntensityTbl *pTbl, int format, char **pChar, unsigned long *pCount) /* * DESCRIPTION * * RETURNS * XcmsFailure if failed. * XcmsSuccess if succeeded. * */ { unsigned int count; unsigned int max_index; IntensityRec *pIRec; max_index = _XcmsGetElement(format, pChar, pCount); pTbl->nEntries = max_index + 1; if (!(pIRec = pTbl->pBase = (IntensityRec *) Xcalloc (max_index+1, sizeof(IntensityRec)))) { return(XcmsFailure); } switch (format) { case 8: for (count = 0; count < max_index+1; count++, pIRec++) { pIRec->value = (count * 65535) / max_index; pIRec->intensity = _XcmsGetElement (format, pChar, pCount) / (XcmsFloat)255.0; } break; case 16: for (count = 0; count < max_index+1; count++, pIRec++) { pIRec->value = (count * 65535) / max_index; pIRec->intensity = _XcmsGetElement (format, pChar, pCount) / (XcmsFloat)65535.0; } break; case 32: for (count = 0; count < max_index+1; count++, pIRec++) { pIRec->value = (count * 65535) / max_index; pIRec->intensity = _XcmsGetElement (format, pChar, pCount) / (XcmsFloat)4294967295.0; } break; default: return(XcmsFailure); } return(XcmsSuccess); } /* * NAME * ValueCmp * * SYNOPSIS */ static int _XcmsValueCmp( IntensityRec *p1, IntensityRec *p2) /* * DESCRIPTION * Compares the value component of two IntensityRec * structures. * * RETURNS * 0 if p1->value is equal to p2->value * < 0 if p1->value is less than p2->value * > 0 if p1->value is greater than p2->value * */ { return (p1->value - p2->value); } /* * NAME * IntensityCmp * * SYNOPSIS */ static int _XcmsIntensityCmp( IntensityRec *p1, IntensityRec *p2) /* * DESCRIPTION * Compares the intensity component of two IntensityRec * structures. * * RETURNS * 0 if equal; * < 0 if first precedes second * > 0 if first succeeds second * */ { if (p1->intensity < p2->intensity) { return (-1); } if (p1->intensity > p2->intensity) { return (XcmsSuccess); } return (XcmsFailure); } /* * NAME * ValueInterpolation * * SYNOPSIS */ /* ARGSUSED */ static int _XcmsValueInterpolation( IntensityRec *key, IntensityRec *lo, IntensityRec *hi, IntensityRec *answer, int bitsPerRGB) /* * DESCRIPTION * Based on a given value, performs a linear interpolation * on the intensities between two IntensityRec structures. * Note that the bitsPerRGB parameter is ignored. * * RETURNS * Returns 0 if failed; otherwise non-zero. */ { XcmsFloat ratio; ratio = ((XcmsFloat)key->value - (XcmsFloat)lo->value) / ((XcmsFloat)hi->value - (XcmsFloat)lo->value); answer->value = key->value; answer->intensity = (hi->intensity - lo->intensity) * ratio; answer->intensity += lo->intensity; return (XcmsSuccess); } /* * NAME * IntensityInterpolation * * SYNOPSIS */ static int _XcmsIntensityInterpolation( IntensityRec *key, IntensityRec *lo, IntensityRec *hi, IntensityRec *answer, int bitsPerRGB) /* * DESCRIPTION * Based on a given intensity, performs a linear interpolation * on the values between two IntensityRec structures. * The bitsPerRGB parameter is necessary to perform rounding * to the correct number of significant bits. * * RETURNS * Returns 0 if failed; otherwise non-zero. */ { XcmsFloat ratio; long target, up, down; int shift = 16 - bitsPerRGB; int max_color = (1 << bitsPerRGB) - 1; ratio = (key->intensity - lo->intensity) / (hi->intensity - lo->intensity); answer->intensity = key->intensity; target = hi->value - lo->value; target *= ratio; target += lo->value; /* * Ok now, lets find the closest in respects to bits per RGB */ up = ((target >> shift) * 0xFFFF) / max_color; if (up < target) { down = up; up = (MIN((down >> shift) + 1, max_color) * 0xFFFF) / max_color; } else { down = (MAX((up >> shift) - 1, 0) * 0xFFFF) / max_color; } answer->value = ((up - target) < (target - down) ? up : down); answer->value &= MASK[bitsPerRGB]; return (XcmsSuccess); } typedef int (*comparProcp)( char *p1, char *p2); typedef int (*interpolProcp)( char *key, char *lo, char *hi, char *answer, int bitsPerRGB); /* * NAME * _XcmsTableSearch * * SYNOPSIS */ static int _XcmsTableSearch( char *key, int bitsPerRGB, char *base, unsigned nel, unsigned nKeyPtrSize, int (*compar)( char *p1, char *p2), int (*interpol)( char *key, char *lo, char *hi, char *answer, int bitsPerRGB), char *answer) /* * DESCRIPTION * A binary search through the specificied table. * * RETURNS * Returns 0 if failed; otherwise non-zero. * */ { char *hi, *lo, *mid, *last; int result; last = hi = base + ((nel - 1) * nKeyPtrSize); mid = lo = base; /* use only the significants bits, then scale into 16 bits */ ((IntensityRec *)key)->value = ((unsigned long) (((IntensityRec *)key)->value >> (16 - bitsPerRGB)) * 0xFFFF) / ((1 << bitsPerRGB) - 1); /* Special case so that zero intensity always maps to zero value */ if ((*compar) (key,lo) <= 0) { memcpy (answer, lo, nKeyPtrSize); ((IntensityRec *)answer)->value &= MASK[bitsPerRGB]; return XcmsSuccess; } while (mid != last) { last = mid; mid = lo + (((unsigned)(hi - lo) / nKeyPtrSize) / 2) * nKeyPtrSize; result = (*compar) (key, mid); if (result == 0) { memcpy(answer, mid, nKeyPtrSize); ((IntensityRec *)answer)->value &= MASK[bitsPerRGB]; return (XcmsSuccess); } else if (result < 0) { hi = mid; } else { lo = mid; } } /* * If we got to here, we didn't find a solution, so we * need to apply interpolation. */ return ((*interpol)(key, lo, hi, answer, bitsPerRGB)); } /* * NAME * _XcmsMatVec - multiply a 3 x 3 by a 3 x 1 vector * * SYNOPSIS */ static void _XcmsMatVec( XcmsFloat *pMat, XcmsFloat *pIn, XcmsFloat *pOut) /* * DESCRIPTION * Multiply the passed vector by the passed matrix to return a * vector. Matrix is 3x3, vectors are of length 3. * * RETURNS * void */ { int i, j; for (i = 0; i < 3; i++) { pOut[i] = 0.0; for (j = 0; j < 3; j++) pOut[i] += *(pMat+(i*3)+j) * pIn[j]; } } /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsLRGB_RGB_ParseString * * SYNOPSIS */ static int XcmsLRGB_RGB_ParseString( register char *spec, XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert * it into a XcmsColor structure with XcmsRGBFormat. * * RETURNS * 0 if failed, non-zero otherwise. */ { register int n, i; unsigned short r, g, b; char c; char *pchar; unsigned short *pShort; /* * Check for old # format */ if (*spec == '#') { /* * Attempt to parse the value portion. */ spec++; n = strlen(spec); if (n != 3 && n != 6 && n != 9 && n != 12) { return(XcmsFailure); } n /= 3; g = b = 0; do { r = g; g = b; b = 0; for (i = n; --i >= 0; ) { c = *spec++; b <<= 4; if (c >= '0' && c <= '9') b |= c - '0'; /* assume string in lowercase else if (c >= 'A' && c <= 'F') b |= c - ('A' - 10); */ else if (c >= 'a' && c <= 'f') b |= c - ('a' - 10); else return (XcmsFailure); } } while (*spec != '\0'); /* * Succeeded ! */ n <<= 2; n = 16 - n; /* shift instead of scale, to match old broken semantics */ pColor->spec.RGB.red = r << n; pColor->spec.RGB.green = g << n; pColor->spec.RGB.blue = b << n; } else { if ((pchar = strchr(spec, ':')) == NULL) { return(XcmsFailure); } n = (int)(pchar - spec); /* * Check for proper prefix. */ if (strncmp(spec, _XcmsRGB_prefix, n) != 0) { return(XcmsFailure); } /* * Attempt to parse the value portion. */ spec += (n + 1); pShort = &pColor->spec.RGB.red; for (i = 0; i < 3; i++, pShort++, spec++) { n = 0; *pShort = 0; while (*spec != '/' && *spec != '\0') { if (++n > 4) { return(XcmsFailure); } c = *spec++; *pShort <<= 4; if (c >= '0' && c <= '9') *pShort |= c - '0'; /* assume string in lowercase else if (c >= 'A' && c <= 'F') *pShort |= c - ('A' - 10); */ else if (c >= 'a' && c <= 'f') *pShort |= c - ('a' - 10); else return (XcmsFailure); } if (n == 0) return (XcmsFailure); if (n < 4) { *pShort = ((unsigned long)*pShort * 0xFFFF) / ((1 << n*4) - 1); } } } pColor->format = XcmsRGBFormat; pColor->pixel = 0; return (XcmsSuccess); } /* * NAME * XcmsLRGB_RGBi_ParseString * * SYNOPSIS */ static int XcmsLRGB_RGBi_ParseString( register char *spec, XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert * it into a XcmsColor structure with XcmsRGBiFormat. * The assumed RGBi string syntax is: * RGBi:// * Where r, g, and b are in string input format for floats * consisting of: * a. an optional sign * b. a string of numbers possibly containing a decimal point, * c. an optional exponent field containing an 'E' or 'e' * followed by a possibly signed integer string. * * RETURNS * 0 if failed, non-zero otherwise. */ { size_t n; char *pchar; if ((pchar = strchr(spec, ':')) == NULL) { return(XcmsFailure); } n = (size_t)(pchar - spec); /* * Check for proper prefix. */ if (strncmp(spec, _XcmsRGBi_prefix, n) != 0) { return(XcmsFailure); } /* * Attempt to parse the value portion. */ if (sscanf(spec + n + 1, "%lf/%lf/%lf", &pColor->spec.RGBi.red, &pColor->spec.RGBi.green, &pColor->spec.RGBi.blue) != 3) { char *s; /* Maybe failed due to locale */ int f; if ((s = strdup(spec))) { for (f = 0; s[f]; ++f) if (s[f] == '.') s[f] = ','; else if (s[f] == ',') s[f] = '.'; if (sscanf(s + n + 1, "%lf/%lf/%lf", &pColor->spec.RGBi.red, &pColor->spec.RGBi.green, &pColor->spec.RGBi.blue) != 3) { free(s); return(XcmsFailure); } free(s); } else return(XcmsFailure); } /* * Succeeded ! */ pColor->format = XcmsRGBiFormat; pColor->pixel = 0; return (XcmsSuccess); } /* * NAME * XcmsCIEXYZToRGBi - convert CIE XYZ to RGB * * SYNOPSIS */ /* ARGSUSED */ Status XcmsCIEXYZToRGBi( XcmsCCC ccc, XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */ unsigned int nColors, /* Number of colors */ Bool *pCompressed) /* pointer to an array of Bool */ /* * DESCRIPTION * Converts color specifications in an array of XcmsColor * structures from RGB format to RGBi format. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded without gamut compression. * XcmsSuccessWithCompression if succeeded with gamut * compression. */ { LINEAR_RGB_SCCData *pScreenData; XcmsFloat tmp[3]; int hasCompressed = 0; unsigned int i; XcmsColor *pColor = pXcmsColors_in_out; if (ccc == NULL) { return(XcmsFailure); } pScreenData = (LINEAR_RGB_SCCData *)ccc->pPerScrnInfo->screenData; /* * XcmsColors should be White Point Adjusted, if necessary, by now! */ /* * NEW!!! for extended gamut compression * * 1. Need to zero out pCompressed * * 2. Need to save initial address of pColor * * 3. Need to save initial address of pCompressed */ for (i = 0; i < nColors; i++) { /* Make sure format is XcmsCIEXYZFormat */ if (pColor->format != XcmsCIEXYZFormat) { return(XcmsFailure); } /* Multiply [A]-1 * [XYZ] to get RGB intensity */ _XcmsMatVec((XcmsFloat *) pScreenData->XYZtoRGBmatrix, (XcmsFloat *) &pColor->spec, tmp); if ((MIN3 (tmp[0], tmp[1], tmp[2]) < -EPS) || (MAX3 (tmp[0], tmp[1], tmp[2]) > (1.0 + EPS))) { /* * RGBi out of screen's gamut */ if (ccc->gamutCompProc == NULL) { /* * Aha!! Here's that little trick that will allow * gamut compression routines to get the out of bound * RGBi. */ memcpy((char *)&pColor->spec, (char *)tmp, sizeof(tmp)); pColor->format = XcmsRGBiFormat; return(XcmsFailure); } else if ((*ccc->gamutCompProc)(ccc, pXcmsColors_in_out, nColors, i, pCompressed) == 0) { return(XcmsFailure); } /* * The gamut compression function should return colors in CIEXYZ * Also check again to if the new color is within gamut. */ if (pColor->format != XcmsCIEXYZFormat) { return(XcmsFailure); } _XcmsMatVec((XcmsFloat *) pScreenData->XYZtoRGBmatrix, (XcmsFloat *) &pColor->spec, tmp); if ((MIN3 (tmp[0], tmp[1], tmp[2]) < -EPS) || (MAX3 (tmp[0], tmp[1], tmp[2]) > (1.0 + EPS))) { return(XcmsFailure); } hasCompressed++; } memcpy((char *)&pColor->spec, (char *)tmp, sizeof(tmp)); /* These if statements are done to ensure the fudge factor is */ /* is taken into account. */ if (pColor->spec.RGBi.red < 0.0) { pColor->spec.RGBi.red = 0.0; } else if (pColor->spec.RGBi.red > 1.0) { pColor->spec.RGBi.red = 1.0; } if (pColor->spec.RGBi.green < 0.0) { pColor->spec.RGBi.green = 0.0; } else if (pColor->spec.RGBi.green > 1.0) { pColor->spec.RGBi.green = 1.0; } if (pColor->spec.RGBi.blue < 0.0) { pColor->spec.RGBi.blue = 0.0; } else if (pColor->spec.RGBi.blue > 1.0) { pColor->spec.RGBi.blue = 1.0; } (pColor++)->format = XcmsRGBiFormat; } return (hasCompressed ? XcmsSuccessWithCompression : XcmsSuccess); } /* * NAME * LINEAR_RGBi_to_CIEXYZ - convert RGBi to CIEXYZ * * SYNOPSIS */ /* ARGSUSED */ Status XcmsRGBiToCIEXYZ( XcmsCCC ccc, XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */ unsigned int nColors, /* Number of colors */ Bool *pCompressed) /* pointer to a bit array */ /* * DESCRIPTION * Converts color specifications in an array of XcmsColor * structures from RGBi format to CIEXYZ format. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded. */ { LINEAR_RGB_SCCData *pScreenData; XcmsFloat tmp[3]; /* * pCompressed ignored in this function. */ if (ccc == NULL) { return(XcmsFailure); } pScreenData = (LINEAR_RGB_SCCData *)ccc->pPerScrnInfo->screenData; /* * XcmsColors should be White Point Adjusted, if necessary, by now! */ while (nColors--) { /* Multiply [A]-1 * [XYZ] to get RGB intensity */ _XcmsMatVec((XcmsFloat *) pScreenData->RGBtoXYZmatrix, (XcmsFloat *) &pXcmsColors_in_out->spec, tmp); memcpy((char *)&pXcmsColors_in_out->spec, (char *)tmp, sizeof(tmp)); (pXcmsColors_in_out++)->format = XcmsCIEXYZFormat; } return(XcmsSuccess); } /* * NAME * XcmsRGBiToRGB * * SYNOPSIS */ /* ARGSUSED */ Status XcmsRGBiToRGB( XcmsCCC ccc, XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */ unsigned int nColors, /* Number of colors */ Bool *pCompressed) /* pointer to a bit array */ /* * DESCRIPTION * Converts color specifications in an array of XcmsColor * structures from RGBi format to RGB format. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded without gamut compression. * XcmsSuccessWithCompression if succeeded with gamut * compression. */ { LINEAR_RGB_SCCData *pScreenData; XcmsRGB tmpRGB; IntensityRec keyIRec, answerIRec; /* * pCompressed ignored in this function. */ if (ccc == NULL) { return(XcmsFailure); } pScreenData = (LINEAR_RGB_SCCData *)ccc->pPerScrnInfo->screenData; while (nColors--) { /* Make sure format is XcmsRGBiFormat */ if (pXcmsColors_in_out->format != XcmsRGBiFormat) { return(XcmsFailure); } keyIRec.intensity = pXcmsColors_in_out->spec.RGBi.red; if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, (char *)pScreenData->pRedTbl->pBase, (unsigned)pScreenData->pRedTbl->nEntries, (unsigned)sizeof(IntensityRec), (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) { return(XcmsFailure); } tmpRGB.red = answerIRec.value; keyIRec.intensity = pXcmsColors_in_out->spec.RGBi.green; if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, (char *)pScreenData->pGreenTbl->pBase, (unsigned)pScreenData->pGreenTbl->nEntries, (unsigned)sizeof(IntensityRec), (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) { return(XcmsFailure); } tmpRGB.green = answerIRec.value; keyIRec.intensity = pXcmsColors_in_out->spec.RGBi.blue; if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, (char *)pScreenData->pBlueTbl->pBase, (unsigned)pScreenData->pBlueTbl->nEntries, (unsigned)sizeof(IntensityRec), (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) { return(XcmsFailure); } tmpRGB.blue = answerIRec.value; memcpy((char *)&pXcmsColors_in_out->spec, (char *)&tmpRGB, sizeof(XcmsRGB)); (pXcmsColors_in_out++)->format = XcmsRGBFormat; } return(XcmsSuccess); } /* * NAME * XcmsRGBToRGBi * * SYNOPSIS */ /* ARGSUSED */ Status XcmsRGBToRGBi( XcmsCCC ccc, XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */ unsigned int nColors, /* Number of colors */ Bool *pCompressed) /* pointer to a bit array */ /* * DESCRIPTION * Converts color specifications in an array of XcmsColor * structures from RGB format to RGBi format. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded. */ { LINEAR_RGB_SCCData *pScreenData; XcmsRGBi tmpRGBi; IntensityRec keyIRec, answerIRec; /* * pCompressed ignored in this function. */ if (ccc == NULL) { return(XcmsFailure); } pScreenData = (LINEAR_RGB_SCCData *)ccc->pPerScrnInfo->screenData; while (nColors--) { /* Make sure format is XcmsRGBFormat */ if (pXcmsColors_in_out->format != XcmsRGBFormat) { return(XcmsFailure); } keyIRec.value = pXcmsColors_in_out->spec.RGB.red; if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, (char *)pScreenData->pRedTbl->pBase, (unsigned)pScreenData->pRedTbl->nEntries, (unsigned)sizeof(IntensityRec), (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) { return(XcmsFailure); } tmpRGBi.red = answerIRec.intensity; keyIRec.value = pXcmsColors_in_out->spec.RGB.green; if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, (char *)pScreenData->pGreenTbl->pBase, (unsigned)pScreenData->pGreenTbl->nEntries, (unsigned)sizeof(IntensityRec), (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) { return(XcmsFailure); } tmpRGBi.green = answerIRec.intensity; keyIRec.value = pXcmsColors_in_out->spec.RGB.blue; if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, (char *)pScreenData->pBlueTbl->pBase, (unsigned)pScreenData->pBlueTbl->nEntries, (unsigned)sizeof(IntensityRec), (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) { return(XcmsFailure); } tmpRGBi.blue = answerIRec.intensity; memcpy((char *)&pXcmsColors_in_out->spec, (char *)&tmpRGBi, sizeof(XcmsRGBi)); (pXcmsColors_in_out++)->format = XcmsRGBiFormat; } return(XcmsSuccess); } /* * NAME * _XcmsInitScrnDefaultInfo * * SYNOPSIS */ /* ARGSUSED */ int _XcmsLRGB_InitScrnDefault( Display *dpy, int screenNumber, XcmsPerScrnInfo *pPerScrnInfo) /* * DESCRIPTION * Given a display and screen number, this routine attempts * to initialize the Xcms per Screen Info structure * (XcmsPerScrnInfo) with defaults. * * RETURNS * Returns zero if initialization failed; non-zero otherwise. */ { pPerScrnInfo->screenData = (XPointer)&Default_RGB_SCCData; pPerScrnInfo->screenWhitePt.spec.CIEXYZ.X = Default_RGB_SCCData.RGBtoXYZmatrix[0][0] + Default_RGB_SCCData.RGBtoXYZmatrix[0][1] + Default_RGB_SCCData.RGBtoXYZmatrix[0][2]; pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y = Default_RGB_SCCData.RGBtoXYZmatrix[1][0] + Default_RGB_SCCData.RGBtoXYZmatrix[1][1] + Default_RGB_SCCData.RGBtoXYZmatrix[1][2]; pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Z = Default_RGB_SCCData.RGBtoXYZmatrix[2][0] + Default_RGB_SCCData.RGBtoXYZmatrix[2][1] + Default_RGB_SCCData.RGBtoXYZmatrix[2][2]; if ((pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y < (1.0 - EPS) ) || (pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y > (1.0 + EPS))) { pPerScrnInfo->screenData = (XPointer)NULL; pPerScrnInfo->state = XcmsInitNone; return(0); } pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y = 1.0; pPerScrnInfo->screenWhitePt.format = XcmsCIEXYZFormat; pPerScrnInfo->screenWhitePt.pixel = 0; pPerScrnInfo->functionSet = (XPointer)&XcmsLinearRGBFunctionSet; pPerScrnInfo->state = XcmsInitFailure; /* default initialization */ return(1); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/Luv.c0000644000000000000000000002355413614532331014535 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * CIELuv.c * * DESCRIPTION * This file contains routines that support the CIE L*u*v* * color space to include conversions to and from the CIE * XYZ space. * * DOCUMENTATION * "TekColor Color Management System, System Implementor's Manual" * and * Fred W. Billmeyer & Max Saltzman, "Principles of Color * Technology", John Wily & Sons, Inc, 1981. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" #include /* sscanf */ /* * FORWARD DECLARATIONS */ static int CIELuv_ParseString(register char *spec, XcmsColor *pColor); static Status XcmsCIELuv_ValidSpec(XcmsColor *pColor); /* * DEFINES * Internal definitions that need NOT be exported to any package * or program using this package. */ #ifdef DBL_EPSILON # define XMY_DBL_EPSILON DBL_EPSILON #else # define XMY_DBL_EPSILON 0.00001 #endif /* * LOCAL VARIABLES */ /* * NULL terminated list of functions applied to get from CIELuv to CIEXYZ */ static XcmsConversionProc Fl_CIELuv_to_CIEXYZ[] = { XcmsCIELuvToCIEuvY, XcmsCIEuvYToCIEXYZ, NULL }; /* * NULL terminated list of functions applied to get from CIEXYZ to CIELuv */ static XcmsConversionProc Fl_CIEXYZ_to_CIELuv[] = { XcmsCIEXYZToCIEuvY, XcmsCIEuvYToCIELuv, NULL }; /* * GLOBALS */ /* * CIE Luv Color Space */ XcmsColorSpace XcmsCIELuvColorSpace = { _XcmsCIELuv_prefix, /* prefix */ XcmsCIELuvFormat, /* id */ CIELuv_ParseString, /* parseString */ Fl_CIELuv_to_CIEXYZ, /* to_CIEXYZ */ Fl_CIEXYZ_to_CIELuv, /* from_CIEXYZ */ 1 }; /************************************************************************ * * * PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * CIELuv_ParseString * * SYNOPSIS */ static int CIELuv_ParseString( register char *spec, XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert * it into a XcmsColor structure with XcmsCIELuvFormat. * The assumed CIELuv string syntax is: * CIELuv:// * Where L, u, and v are in string input format for floats * consisting of: * a. an optional sign * b. a string of numbers possibly containing a decimal point, * c. an optional exponent field containing an 'E' or 'e' * followed by a possibly signed integer string. * * RETURNS * 0 if failed, non-zero otherwise. */ { int n; char *pchar; if ((pchar = strchr(spec, ':')) == NULL) { return(XcmsFailure); } n = (int)(pchar - spec); /* * Check for proper prefix. */ if (strncmp(spec, _XcmsCIELuv_prefix, n) != 0) { return(XcmsFailure); } /* * Attempt to parse the value portion. */ if (sscanf(spec + n + 1, "%lf/%lf/%lf", &pColor->spec.CIELuv.L_star, &pColor->spec.CIELuv.u_star, &pColor->spec.CIELuv.v_star) != 3) { char *s; /* Maybe failed due to locale */ int f; if ((s = strdup(spec))) { for (f = 0; s[f]; ++f) if (s[f] == '.') s[f] = ','; else if (s[f] == ',') s[f] = '.'; if (sscanf(s + n + 1, "%lf/%lf/%lf", &pColor->spec.CIELuv.L_star, &pColor->spec.CIELuv.u_star, &pColor->spec.CIELuv.v_star) != 3) { free(s); return(XcmsFailure); } free(s); } else return(XcmsFailure); } pColor->format = XcmsCIELuvFormat; pColor->pixel = 0; return(XcmsCIELuv_ValidSpec(pColor)); } /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELuv_ValidSpec * * SYNOPSIS */ static Status XcmsCIELuv_ValidSpec( XcmsColor *pColor) /* * DESCRIPTION * Checks if color specification valid for CIE L*u*v*. * * RETURNS * XcmsFailure if invalid, * XcmsSuccess if valid. * */ { if (pColor->format != XcmsCIELuvFormat || (pColor->spec.CIELuv.L_star < 0.0 - XMY_DBL_EPSILON) || (pColor->spec.CIELuv.L_star > 100.0 + XMY_DBL_EPSILON)) { return(XcmsFailure); } return(XcmsSuccess); } /* * NAME * XcmsCIELuvToCIEuvY - convert CIELuv to CIEuvY * * SYNOPSIS */ Status XcmsCIELuvToCIEuvY( XcmsCCC ccc, XcmsColor *pLuv_WhitePt, XcmsColor *pColors_in_out, unsigned int nColors) /* * DESCRIPTION * Converts color specifications in an array of XcmsColor * structures from CIELuv format to CIEuvY format. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded. * */ { XcmsColor *pColor = pColors_in_out; XcmsColor whitePt; XcmsCIEuvY uvY_return; XcmsFloat tmpVal; unsigned int i; /* * Check arguments */ if (pLuv_WhitePt == NULL || pColors_in_out == NULL) { return(XcmsFailure); } /* * Make sure white point is in CIEuvY form */ if (pLuv_WhitePt->format != XcmsCIEuvYFormat) { /* Make copy of the white point because we're going to modify it */ memcpy((char *)&whitePt, (char *)pLuv_WhitePt, sizeof(XcmsColor)); if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, XcmsCIEuvYFormat)) { return(XcmsFailure); } pLuv_WhitePt = &whitePt; } /* Make sure it is a white point, i.e., Y == 1.0 */ if (pLuv_WhitePt->spec.CIEuvY.Y != 1.0) { return(XcmsFailure); } /* * Now convert each XcmsColor structure to CIEXYZ form */ for (i = 0; i < nColors; i++, pColor++) { /* Make sure original format is CIELuv and is valid */ if (!XcmsCIELuv_ValidSpec(pColor)) { return(XcmsFailure); } if (pColor->spec.CIELuv.L_star < 7.99953624) { uvY_return.Y = pColor->spec.CIELuv.L_star / 903.29; } else { tmpVal = (pColor->spec.CIELuv.L_star + 16.0) / 116.0; uvY_return.Y = tmpVal * tmpVal * tmpVal; /* tmpVal ** 3 */ } if (pColor->spec.CIELuv.L_star == 0.0) { uvY_return.u_prime = pLuv_WhitePt->spec.CIEuvY.u_prime; uvY_return.v_prime = pLuv_WhitePt->spec.CIEuvY.v_prime; } else { tmpVal = 13.0 * (pColor->spec.CIELuv.L_star / 100.0); uvY_return.u_prime = pColor->spec.CIELuv.u_star/tmpVal + pLuv_WhitePt->spec.CIEuvY.u_prime; uvY_return.v_prime = pColor->spec.CIELuv.v_star/tmpVal + pLuv_WhitePt->spec.CIEuvY.v_prime; } /* Copy result to pColor */ memcpy((char *)&pColor->spec, (char *)&uvY_return, sizeof(XcmsCIEuvY)); /* Identify that the format is now CIEuvY */ pColor->format = XcmsCIEuvYFormat; } return(XcmsSuccess); } /* * NAME * XcmsCIEuvYToCIELuv - convert CIEuvY to CIELuv * * SYNOPSIS */ Status XcmsCIEuvYToCIELuv( XcmsCCC ccc, XcmsColor *pLuv_WhitePt, XcmsColor *pColors_in_out, unsigned int nColors) /* * DESCRIPTION * Converts color specifications in an array of XcmsColor * structures from CIEuvY format to CIELab format. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded. * */ { XcmsColor *pColor = pColors_in_out; XcmsColor whitePt; XcmsCIELuv Luv_return; XcmsFloat tmpVal; unsigned int i; /* * Check arguments */ if (pLuv_WhitePt == NULL || pColors_in_out == NULL) { return(XcmsFailure); } /* * Make sure white point is in CIEuvY form */ if (pLuv_WhitePt->format != XcmsCIEuvYFormat) { /* Make copy of the white point because we're going to modify it */ memcpy((char *)&whitePt, (char *)pLuv_WhitePt, sizeof(XcmsColor)); if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, XcmsCIEuvYFormat)) { return(XcmsFailure); } pLuv_WhitePt = &whitePt; } /* Make sure it is a white point, i.e., Y == 1.0 */ if (pLuv_WhitePt->spec.CIEuvY.Y != 1.0) { return(XcmsFailure); } /* * Now convert each XcmsColor structure to CIEXYZ form */ for (i = 0; i < nColors; i++, pColor++) { if (!_XcmsCIEuvY_ValidSpec(pColor)) { return(XcmsFailure); } /* Now convert the uvY to Luv */ Luv_return.L_star = (pColor->spec.CIEuvY.Y < 0.008856) ? (pColor->spec.CIEuvY.Y * 903.29) : ((XcmsFloat)(XCMS_CUBEROOT(pColor->spec.CIEuvY.Y) * 116.0) - 16.0); tmpVal = 13.0 * (Luv_return.L_star / 100.0); Luv_return.u_star = tmpVal * (pColor->spec.CIEuvY.u_prime - pLuv_WhitePt->spec.CIEuvY.u_prime); Luv_return.v_star = tmpVal * (pColor->spec.CIEuvY.v_prime - pLuv_WhitePt->spec.CIEuvY.v_prime); /* Copy result to pColor */ memcpy((char *)&pColor->spec, (char *)&Luv_return, sizeof(XcmsCIELuv)); /* Identify that the format is now CIEuvY */ pColor->format = XcmsCIELuvFormat; } return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LuvGcC.c0000644000000000000000000000733413614532331015110 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * CIELuvGcC.c * * DESCRIPTION * Source for XcmsCIELuvClipuv() gamut compression routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELuvClipuv - Reduce the chroma for a hue and L* * * SYNOPSIS */ /* ARGSUSED */ Status XcmsCIELuvClipuv ( XcmsCCC ccc, XcmsColor *pColors_in_out, unsigned int nColors, unsigned int i, Bool *pCompressed) /* * DESCRIPTION * Reduce the Chroma for a specific hue and chroma to * to bring the given color into the gamut of the * specified device. As required of gamut compression * functions, this routine returns pColor_in_out * in XcmsCIEXYZFormat on successful completion. * * Since this routine works with the L* within * pColor_in_out intermediate results may be returned * even though it may be invalid. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { Status retval; XcmsColor *pColor; /* * Color specification passed as input can be assumed to: * 1. Be in XcmsCIEXYZFormat * 2. Already be white point adjusted for the Screen White Point. * This means that the white point now associated with this * color spec is the Screen White Point (even if the * ccc->clientWhitePt differs). */ pColor = pColors_in_out + i; if (ccc->visual->class < PseudoColor) { /* * GRAY ! */ _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), 1, XcmsCIELuvFormat); _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), 1, XcmsCIEXYZFormat); if (pCompressed) { *(pCompressed + i) = True; } return(XcmsSuccess); } else { if (pColor->format != XcmsCIELuvFormat) { if (_XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIELuvFormat) == XcmsFailure) { return(XcmsFailure); } } if (XcmsCIELuvQueryMaxC(ccc, degrees(XCMS_CIELUV_PMETRIC_HUE(pColor->spec.CIELuv.u_star, pColor->spec.CIELuv.v_star)), pColor->spec.CIELuv.L_star, pColor) == XcmsFailure) { return(XcmsFailure); } retval = _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); if (retval != XcmsFailure && pCompressed != NULL) { *(pCompressed + i) = True; } return(retval); } } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LuvGcL.c0000644000000000000000000001320513614532331015113 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * CIELuvGcL.c * * DESCRIPTION * Source for XcmsCIELuvClipL() gamut compression routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELuvClipL - Return the closest L* * * SYNOPSIS */ /* ARGSUSED */ Status XcmsCIELuvClipL ( XcmsCCC ccc, XcmsColor *pColors_in_out, unsigned int nColors, unsigned int i, Bool *pCompressed) /* * DESCRIPTION * Return the closest L* for a specific hue and chroma. * This routine takes any color as input and outputs * a CIE XYZ color. * * Since this routine works with the L* within * pColor_in_out intermediate results may be returned * even though it may be invalid. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { XcmsCCCRec myCCC; XcmsColor *pColor; XcmsColor Luv_max; XcmsFloat hue, chroma, maxChroma; Status retval; /* Use my own CCC */ memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* Inherit Screen WP */ myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression */ /* * Color specification passed as input can be assumed to: * 1. Be in XcmsCIEXYZFormat * 2. Already be white point adjusted for the Screen White Point. * This means that the white point now associated with this * color spec is the Screen White Point (even if the * ccc->clientWhitePt differs). */ pColor = pColors_in_out + i; if (ccc->visual->class < StaticColor) { /* * GRAY ! */ return(XcmsFailure); } else { /* Convert from CIEXYZ to CIE L*u*v* format */ if (_XcmsDIConvertColors(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat) == XcmsFailure) { return(XcmsFailure); } hue = XCMS_CIELUV_PMETRIC_HUE(pColor->spec.CIELuv.u_star, pColor->spec.CIELuv.v_star); chroma = XCMS_CIELUV_PMETRIC_CHROMA(pColor->spec.CIELuv.u_star, pColor->spec.CIELuv.v_star); /* Step 1: compute the maximum L* and chroma for this hue. */ /* This copy may be overkill but it preserves the pixel etc. */ memcpy((char *)&Luv_max, (char *)pColor, sizeof(XcmsColor)); if (_XcmsCIELuvQueryMaxLCRGB (&myCCC, hue, &Luv_max, (XcmsRGBi *)NULL) == XcmsFailure) { return (XcmsFailure); } maxChroma = XCMS_CIELUV_PMETRIC_CHROMA(Luv_max.spec.CIELuv.u_star, Luv_max.spec.CIELuv.v_star); /* Now check and return the appropriate L* */ if (chroma == maxChroma) { /* When the chroma input is equal to the maximum chroma */ /* merely return the L* for that chroma. */ memcpy((char *)pColor, (char *)&Luv_max, sizeof(XcmsColor)); retval = _XcmsDIConvertColors(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); } else if (chroma > maxChroma) { /* When the chroma input is greater than the maximum chroma */ /* merely return the L* and chroma for the given hue. */ memcpy((char *)pColor, (char *)&Luv_max, sizeof(XcmsColor)); return (XcmsFailure); } else if (pColor->spec.CIELuv.L_star < Luv_max.spec.CIELuv.L_star) { /* Find the minimum lightness for the given chroma. */ if (pColor->format != XcmsCIELuvFormat) { if (_XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), 1, XcmsCIELuvFormat) == XcmsFailure) { return(XcmsFailure); } } if (XcmsCIELuvQueryMinL(&myCCC, degrees(hue), chroma, pColor) == XcmsFailure) { return (XcmsFailure); } retval = _XcmsDIConvertColors(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); } else { /* Find the maximum lightness for the given chroma. */ if (pColor->format != XcmsCIELuvFormat) { if (_XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), 1, XcmsCIELuvFormat) == XcmsFailure) { return(XcmsFailure); } } if (XcmsCIELuvQueryMaxL(&myCCC, degrees(hue), chroma, pColor) == XcmsFailure) { return (XcmsFailure); } retval = _XcmsDIConvertColors(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); } if (retval != XcmsFailure && pCompressed != NULL) { *(pCompressed + i) = True; } return(retval); } } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LuvGcLC.c0000644000000000000000000001650613614532331015225 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * CIELuvGcLC.c * * DESCRIPTION * Source for XcmsCIELuvClipLuv() gamut * compression function. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include #include "Cv.h" /* * INTERNALS * Internal defines that need NOT be exported to any package or * program using this package. */ #define MAXBISECTCOUNT 100 /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELuvClipLuv - Return the closest L* and chroma * * SYNOPSIS */ /* ARGSUSED */ Status XcmsCIELuvClipLuv ( XcmsCCC ccc, XcmsColor *pColors_in_out, unsigned int nColors, unsigned int i, Bool *pCompressed) /* * DESCRIPTION * This routine will find the closest L* and chroma * for a specific hue. The color input is converted to * CIE L*u*v* format and returned as CIE XYZ format. * * Since this routine works with the L* within * pColor_in_out intermediate results may be returned * even though it may be invalid. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { Status retval; XcmsCCCRec myCCC; XcmsColor *pColor; XcmsColor Luv_max; XcmsFloat hue, chroma, maxChroma; XcmsFloat Chroma, bestChroma, Lstar, maxLstar, saveLstar; XcmsFloat bestLstar, bestustar, bestvstar; XcmsFloat nT, saveDist, tmpDist; XcmsRGBi rgb_max; int nCount, nMaxCount, nI, nILast; /* Use my own CCC */ memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* inherit screen white */ myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression func */ /* * Color specification passed as input can be assumed to: * 1. Be in XcmsCIEXYZFormat * 2. Already be white point adjusted for the Screen White Point. * This means that the white point now associated with this * color spec is the Screen White Point (even if the * ccc->clientWhitePt differs). */ pColor = pColors_in_out + i; if (ccc->visual->class < StaticColor) { /* * GRAY ! */ _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), 1, XcmsCIELuvFormat); _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), 1, XcmsCIEXYZFormat); if (pCompressed) { *(pCompressed + i) = True; } return(XcmsSuccess); } /* Convert from CIEXYZ to CIELuv format */ if (_XcmsDIConvertColors(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat) == XcmsFailure) { return(XcmsFailure); } /* Step 1: compute the maximum L* and chroma for this hue. */ /* This copy may be overkill but it preserves the pixel etc. */ saveLstar = pColor->spec.CIELuv.L_star; hue = XCMS_CIELUV_PMETRIC_HUE(pColor->spec.CIELuv.u_star, pColor->spec.CIELuv.v_star); chroma = XCMS_CIELUV_PMETRIC_CHROMA(pColor->spec.CIELuv.u_star, pColor->spec.CIELuv.v_star); memcpy((char *)&Luv_max, (char *)pColor, sizeof(XcmsColor)); if (_XcmsCIELuvQueryMaxLCRGB (&myCCC, hue, &Luv_max, &rgb_max) == XcmsFailure) { return (XcmsFailure); } maxLstar = Luv_max.spec.CIELuv.L_star; /* Now check and return the appropriate L* */ if (saveLstar == maxLstar) { /* When the L* input is equal to the maximum L* */ /* merely return the maximum Luv point. */ memcpy((char *)pColor, (char *)&Luv_max, sizeof(XcmsColor)); retval = _XcmsDIConvertColors(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); } else { /* return the closest point on the hue leaf. */ /* must do a bisection here to compute the delta e. */ maxChroma = XCMS_CIELUV_PMETRIC_CHROMA(Luv_max.spec.CIELuv.u_star, Luv_max.spec.CIELuv.v_star); nMaxCount = MAXBISECTCOUNT; nI = nMaxCount / 2; bestLstar = Lstar = pColor->spec.CIELuv.L_star; bestustar = pColor->spec.CIELuv.u_star; bestvstar = pColor->spec.CIELuv.v_star; bestChroma = Chroma = chroma; saveDist = XCMS_SQRT(((Chroma - maxChroma) * (Chroma - maxChroma)) + ((Lstar - maxLstar) * (Lstar - maxLstar))); for (nCount = 0; nCount < nMaxCount; nCount++) { nT = (XcmsFloat) nI / (XcmsFloat) nMaxCount; if (saveLstar > maxLstar) { pColor->spec.RGBi.red = rgb_max.red * (1.0 - nT) + nT; pColor->spec.RGBi.green = rgb_max.green * (1.0 - nT) + nT; pColor->spec.RGBi.blue = rgb_max.blue * (1.0 - nT) + nT; } else { pColor->spec.RGBi.red = rgb_max.red - (rgb_max.red * nT); pColor->spec.RGBi.green = rgb_max.green - (rgb_max.green * nT); pColor->spec.RGBi.blue = rgb_max.blue - (rgb_max.blue * nT); } pColor->format = XcmsRGBiFormat; /* Convert from RGBi to CIE Luv */ if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat, (Bool *) NULL) == XcmsFailure) { return (XcmsFailure); } chroma = XCMS_CIELUV_PMETRIC_CHROMA(pColor->spec.CIELuv.u_star, pColor->spec.CIELuv.v_star); tmpDist = XCMS_SQRT(((Chroma - chroma) * (Chroma - chroma)) + ((Lstar - pColor->spec.CIELuv.L_star) * (Lstar - pColor->spec.CIELuv.L_star))); nILast = nI; if (tmpDist > saveDist) { nI /= 2; } else { nI = (nMaxCount + nI) / 2; saveDist = tmpDist; bestLstar = pColor->spec.CIELuv.L_star; bestustar = pColor->spec.CIELuv.u_star; bestvstar = pColor->spec.CIELuv.v_star; bestChroma = chroma; } if (nI == nILast || nI == 0) { break; } } if (bestChroma >= maxChroma) { pColor->spec.CIELuv.L_star = maxLstar; pColor->spec.CIELuv.u_star = Luv_max.spec.CIELuv.u_star; pColor->spec.CIELuv.v_star = Luv_max.spec.CIELuv.v_star; } else { pColor->spec.CIELuv.L_star = bestLstar; pColor->spec.CIELuv.u_star = bestustar; pColor->spec.CIELuv.v_star = bestvstar; } retval = _XcmsDIConvertColors(&myCCC, pColor, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); if (retval != XcmsFailure && pCompressed != NULL) { *(pCompressed + i) = True; } } return(retval); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LuvMnL.c0000644000000000000000000001513413614532331015137 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * CIELuvMnL.c * * DESCRIPTION * Source for the XcmsCIELuvQueryMinL() gamut boundary * querying routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include #include "Cv.h" /* * DEFINES */ #define MAXBISECTCOUNT 100 #define EPS (XcmsFloat)0.001 #define START_L_STAR (XcmsFloat)40.0 /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELuvQueryMinL - Compute max Lstar for a hue and chroma * * SYNOPSIS */ Status XcmsCIELuvQueryMinL( XcmsCCC ccc, XcmsFloat hue_angle, /* hue angle in degrees */ XcmsFloat chroma, XcmsColor *pColor_return) /* * DESCRIPTION * Return the maximum Lstar for a specified hue_angle and chroma. * * ASSUMPTIONS * This routine assumes that the white point associated with * the color specification is the Screen White Point. The * Screen White Point will also be associated with the * returned color specification. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded with no modifications * */ { XcmsCCCRec myCCC; XcmsColor max_lc, tmp, prev; XcmsFloat max_chroma, tmp_chroma; XcmsFloat hue, nT, nChroma, lastChroma, prevChroma; XcmsFloat rFactor; XcmsRGBi rgb_saved; int nCount, nMaxCount; /* * Check Arguments */ if (ccc == NULL || pColor_return == NULL) { return(XcmsFailure); } /* setup the CCC to use for the conversions. */ memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat; myCCC.gamutCompProc = (XcmsCompressionProc) NULL; while (hue_angle < 0.0) { hue_angle += 360.0; } while (hue_angle >= 360.0) { hue_angle -= 360.0; } hue = radians(hue_angle); tmp.spec.CIELuv.L_star = START_L_STAR; tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, chroma); tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, chroma); tmp.pixel = pColor_return->pixel; tmp.format = XcmsCIELuvFormat; /* Step 1: Obtain the maximum L_star and chroma for this hue. */ if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) == XcmsFailure) { return(XcmsFailure); } max_chroma = XCMS_CIELUV_PMETRIC_CHROMA(max_lc.spec.CIELuv.u_star, max_lc.spec.CIELuv.v_star); if (max_chroma <= chroma) { /* * If the chroma is greater than the chroma for the * maximum L/chroma point then the L_star is the * the L_star for the maximum L_star/chroma point. * This is an error but I return the best approximation I can. * Thus the inconsistency. */ memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); return(XcmsSuccess); } /* * If the chroma is equal to the chroma for the * maximum L_star/chroma point then the L_star is the * the L_star for the maximum L* and chroma point. */ /* if (max_chroma == chroma) { * memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); * return(XcmsSuccess); * } */ /* must do a bisection here to compute the maximum L* */ /* save the structure input so that any elements that */ /* are not touched are recopied later in the routine. */ nChroma = chroma; tmp_chroma = max_chroma; lastChroma = -1.0; nMaxCount = MAXBISECTCOUNT; rFactor = 1.0; for (nCount = 0; nCount < nMaxCount; nCount++) { prevChroma = lastChroma; lastChroma = tmp_chroma; nT = (nChroma - max_chroma) / max_chroma * rFactor; memcpy ((char *)&prev, (char *)&tmp, sizeof(XcmsColor)); tmp.spec.RGBi.red = rgb_saved.red + (rgb_saved.red * nT); tmp.spec.RGBi.green = rgb_saved.green + (rgb_saved.green * nT); tmp.spec.RGBi.blue = rgb_saved.blue + (rgb_saved.blue * nT); tmp.format = XcmsRGBiFormat; /* convert from RGB to CIELuv */ if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } /* Now check the return against what is expected */ tmp_chroma = XCMS_CIELUV_PMETRIC_CHROMA(tmp.spec.CIELuv.u_star, tmp.spec.CIELuv.v_star); if (tmp_chroma <= chroma + EPS && tmp_chroma >= chroma - EPS) { /* Found It! */ memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); return(XcmsSuccess); } nChroma += chroma - tmp_chroma; if (nChroma > max_chroma) { nChroma = max_chroma; rFactor *= 0.5; /* selective relaxation employed */ } else if (nChroma < 0.0) { if (XCMS_FABS(lastChroma - chroma) < XCMS_FABS(tmp_chroma - chroma)) { memcpy ((char *)pColor_return, (char *)&prev, sizeof(XcmsColor)); } else { memcpy ((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); } return(XcmsSuccess); } else if (tmp_chroma <= prevChroma + EPS && tmp_chroma >= prevChroma - EPS) { rFactor *= 0.5; /* selective relaxation employed */ } } if (nCount >= nMaxCount) { if (XCMS_FABS(lastChroma - chroma) < XCMS_FABS(tmp_chroma - chroma)) { memcpy ((char *)pColor_return, (char *)&prev, sizeof(XcmsColor)); } else { memcpy ((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); } } memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LuvMxC.c0000644000000000000000000001455313614532331015144 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * * NAME * CIELuvMxC.c * * DESCRIPTION * Source for the XcmsCIELuvQueryMaxC() gamut boundary * querying routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include #include "Cv.h" /* * DEFINES */ #define MAXBISECTCOUNT 100 #define EPS (XcmsFloat)0.001 #define START_CHROMA (XcmsFloat)2.2 #define TOPL (XcmsFloat)100.0 /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELuvQueryMaxC - max chroma for a hue_angle and L_star * * SYNOPSIS */ Status XcmsCIELuvQueryMaxC( XcmsCCC ccc, XcmsFloat hue_angle, /* hue angle in degrees */ XcmsFloat L_star, XcmsColor *pColor_return) /* * DESCRIPTION * Return the maximum chroma for a specific hue_angle and L_star. * The returned format is in XcmsCIELuvFormat. * * * ASSUMPTIONS * This routine assumes that the white point associated with * the color specification is the Screen White Point. The * Screen White Point will also be associated with the * returned color specification. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { XcmsCCCRec myCCC; XcmsColor tmp; XcmsColor max_lc; XcmsFloat n_L_star, last_L_star, prev_L_star; XcmsFloat hue, lastuStar, lastvStar, /*lastChroma,*/ maxDist, nT, rFactor; XcmsRGBi rgb_saved; int nCount, nMaxCount; /* * Check Arguments */ if (ccc == NULL || pColor_return == NULL) { return(XcmsFailure); } /* Use my own CCC and inherit screen white Pt */ memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat; myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut comp func */ while (hue_angle < 0.0) { hue_angle += 360.0; } while (hue_angle >= 360.0) { hue_angle -= 360.0; } hue = radians(hue_angle); tmp.spec.CIELuv.L_star = L_star; tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, START_CHROMA); tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, START_CHROMA); tmp.pixel = pColor_return->pixel; tmp.format = XcmsCIELuvFormat; /* Step 1: compute the maximum L_star and chroma for this hue. */ memcpy((char *)&max_lc, (char *)&tmp, sizeof(XcmsColor)); if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) == XcmsFailure) { return(XcmsFailure); } /* * Step 2: Do a bisection here to compute the maximum chroma * Note the differences between when the point to be found * is above the maximum LC point and when it is below. */ if (L_star <= max_lc.spec.CIELuv.L_star) { maxDist = max_lc.spec.CIELuv.L_star; } else { maxDist = TOPL - max_lc.spec.CIELuv.L_star; } n_L_star = L_star; last_L_star = -1.0; nMaxCount = MAXBISECTCOUNT; rFactor = 1.0; for (nCount = 0; nCount < nMaxCount; nCount++) { prev_L_star = last_L_star; last_L_star = tmp.spec.CIELuv.L_star; /* lastChroma = XCMS_CIELUV_PMETRIC_CHROMA(tmp.spec.CIELuv.u_star, */ /* tmp.spec.CIELuv.v_star); */ lastuStar = tmp.spec.CIELuv.u_star; lastvStar = tmp.spec.CIELuv.v_star; nT = (n_L_star - max_lc.spec.CIELuv.L_star) / maxDist * rFactor; /* printf("(n_L_star, nT) = %lf %lf ", n_L_star, nT); */ if (nT > 0) { tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; } else { tmp.spec.RGBi.red = rgb_saved.red + (rgb_saved.red * nT); tmp.spec.RGBi.green = rgb_saved.green + (rgb_saved.green * nT); tmp.spec.RGBi.blue = rgb_saved.blue + (rgb_saved.blue * nT); } tmp.format = XcmsRGBiFormat; /* convert from RGB to CIELuv */ if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } /* * Now check if we've reached the target L_star */ /* printf("result Lstar = %lf\n", tmp.spec.CIELuv.L_star); */ if (tmp.spec.CIELuv.L_star <= L_star + EPS && tmp.spec.CIELuv.L_star >= L_star - EPS) { memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); return(XcmsSuccess); } if (nT > 0) { n_L_star += ((TOPL - n_L_star) * (L_star - tmp.spec.CIELuv.L_star)) / (TOPL - L_star); } else { n_L_star *= L_star / tmp.spec.CIELuv.L_star; } if (tmp.spec.CIELuv.L_star <= prev_L_star + EPS && tmp.spec.CIELuv.L_star >= prev_L_star - EPS) { rFactor *= 0.5; /* selective relaxation employed */ /* printf("rFactor = %lf\n", rFactor); */ } } if (XCMS_FABS(last_L_star - L_star) < XCMS_FABS(tmp.spec.CIELuv.L_star - L_star)) { tmp.spec.CIELuv.u_star = lastuStar; tmp.spec.CIELuv.v_star = lastvStar; /* tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, lastChroma); */ /* tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, lastChroma); */ } tmp.spec.CIELuv.L_star = L_star; memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LuvMxL.c0000644000000000000000000001510613614532331015150 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * CIELuvMxL.c * * DESCRIPTION * Source for the XcmsCIELuvQueryMaxL() gamut boundary * querying routine. * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include #include "Cv.h" /* * DEFINES */ #define MAXBISECTCOUNT 100 #define EPS (XcmsFloat)0.001 #define START_L_STAR (XcmsFloat)40.0 /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELuvQueryMaxL - Compute max Lstar for a hue and chroma * * SYNOPSIS */ Status XcmsCIELuvQueryMaxL( XcmsCCC ccc, XcmsFloat hue_angle, /* hue angle in degrees */ XcmsFloat chroma, XcmsColor *pColor_return) /* * DESCRIPTION * Return the maximum Lstar for a specified hue_angle and chroma. * * ASSUMPTIONS * This routine assumes that the white point associated with * the color specification is the Screen White Point. The * Screen White Point will also be associated with the * returned color specification. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded with no modifications * */ { XcmsCCCRec myCCC; XcmsColor max_lc, tmp, prev; XcmsFloat max_chroma, tmp_chroma; XcmsFloat hue, nT, nChroma, lastChroma, prevChroma; XcmsFloat rFactor; XcmsRGBi rgb_saved; int nCount, nMaxCount; /* * Check Arguments */ if (ccc == NULL || pColor_return == NULL) { return(XcmsFailure); } /* setup the CCC to use for the conversions. */ memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat; myCCC.gamutCompProc = (XcmsCompressionProc) NULL; while (hue_angle < 0.0) { hue_angle += 360.0; } while (hue_angle >= 360.0) { hue_angle -= 360.0; } hue = radians(hue_angle); tmp.spec.CIELuv.L_star = START_L_STAR; tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, chroma); tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, chroma); tmp.pixel = pColor_return->pixel; tmp.format = XcmsCIELuvFormat; /* Step 1: Obtain the maximum L_star and chroma for this hue. */ if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) == XcmsFailure) { return(XcmsFailure); } max_chroma = XCMS_CIELUV_PMETRIC_CHROMA(max_lc.spec.CIELuv.u_star, max_lc.spec.CIELuv.v_star); if (max_chroma <= chroma) { /* * If the chroma is greater than the chroma for the * maximum L/chroma point then the L_star is the * the L_star for the maximum L_star/chroma point. * This is an error but I return the best approximation I can. * Thus the inconsistency. */ memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); return(XcmsSuccess); } /* * If the chroma is equal to the chroma for the * maximum L_star/chroma point then the L_star is the * the L_star for the maximum L* and chroma point. */ /* if (max_chroma == chroma) { * memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); * return(XcmsSuccess); * } */ /* must do a bisection here to compute the maximum L* */ /* save the structure input so that any elements that */ /* are not touched are recopied later in the routine. */ nChroma = chroma; tmp_chroma = max_chroma; lastChroma = -1.0; nMaxCount = MAXBISECTCOUNT; rFactor = 1.0; for (nCount = 0; nCount < nMaxCount; nCount++) { prevChroma = lastChroma; lastChroma = tmp_chroma; nT = (1.0 - (nChroma / max_chroma)) * rFactor; memcpy ((char *)&prev, (char *)&tmp, sizeof(XcmsColor)); tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; tmp.format = XcmsRGBiFormat; /* convert from RGB to CIELuv */ if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } /* Now check the return against what is expected */ tmp_chroma = XCMS_CIELUV_PMETRIC_CHROMA(tmp.spec.CIELuv.u_star, tmp.spec.CIELuv.v_star); if (tmp_chroma <= chroma + EPS && tmp_chroma >= chroma - EPS) { /* Found It! */ memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); return(XcmsSuccess); } nChroma += chroma - tmp_chroma; if (nChroma > max_chroma) { nChroma = max_chroma; rFactor *= 0.5; /* selective relaxation employed */ } else if (nChroma < 0.0) { if (XCMS_FABS(lastChroma - chroma) < XCMS_FABS(tmp_chroma - chroma)) { memcpy ((char *)pColor_return, (char *)&prev, sizeof(XcmsColor)); } else { memcpy ((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); } return(XcmsSuccess); } else if (tmp_chroma <= prevChroma + EPS && tmp_chroma >= prevChroma - EPS) { rFactor *= 0.5; /* selective relaxation employed */ } } if (nCount >= nMaxCount) { if (XCMS_FABS(lastChroma - chroma) < XCMS_FABS(tmp_chroma - chroma)) { memcpy ((char *)pColor_return, (char *)&prev, sizeof(XcmsColor)); } else { memcpy ((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); } } memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LuvMxLC.c0000644000000000000000000001450713614532331015257 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * * NAME * CIELuvMxVC.c * * DESCRIPTION * Source for the XcmsCIELuvQueryMaxLC() gamut boundary * querying routine. * * DOCUMENTATION * "TekColor Color Management System, System Implementor's Manual" * and * Fred W. Billmeyer & Max Saltzman, "Principles of Color * Technology", John Wily & Sons, Inc, 1981. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * DEFINES */ #define MIN(x,y) ((x) > (y) ? (y) : (x)) #define MIN3(x,y,z) ((x) > (MIN((y), (z))) ? (MIN((y), (z))) : (x)) #define MAX(x,y) ((x) > (y) ? (x) : (y)) #define MAX3(x,y,z) ((x) > (MAX((y), (z))) ? (x) : (MAX((y), (z)))) #define START_LSTAR (XcmsFloat)40.0 #define START_CHROMA (XcmsFloat)2.2 /************************************************************************ * * * API PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * _XcmsCIELuvQueryMaxLCRGB - Compute maximum L* and chroma. * * SYNOPSIS */ Status _XcmsCIELuvQueryMaxLCRGB( XcmsCCC ccc, XcmsFloat hue, /* hue in radians */ XcmsColor *pColor_return, XcmsRGBi *pRGB_return) /* * DESCRIPTION * Return the maximum psychometric chroma for a specified * hue angle(radians), and the corresponding L*. This is computed * by a binary search of all possible chromas. An assumption * is made that there are no local maxima. Use the unrounded * Max psychometric chroma because the difference check can be * small. * * NOTE: No local CCC is used because this is a private * routine and all routines that call it are expected * to behave properly, i.e. send a local CCC with * no white adjust function and no gamut compression * function. * * This routine only accepts hue as input and outputs * Luv and RGBi. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { XcmsFloat nSmall, nLarge; XcmsColor tmp; tmp.format = XcmsCIELuvFormat; /* Use some unreachable color on the given hue angle */ tmp.spec.CIELuv.L_star = START_LSTAR; tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, START_CHROMA); tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, START_CHROMA); /* * Convert from Luv to RGB * * Note that the CIEXYZ to RGBi conversion routine must stuff the * out of bounds RGBi values in tmp when the ccc->gamutCompProc * is NULL. */ if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc), (unsigned int)1, XcmsRGBiFormat, (Bool *) NULL) == XcmsFailure) && tmp.format != XcmsRGBiFormat) { return (XcmsFailure); } /* Now pick the smallest RGB */ nSmall = MIN3(tmp.spec.RGBi.red, tmp.spec.RGBi.green, tmp.spec.RGBi.blue); /* Make the smallest RGB equal to zero */ tmp.spec.RGBi.red -= nSmall; tmp.spec.RGBi.green -= nSmall; tmp.spec.RGBi.blue -= nSmall; /* Now pick the largest RGB */ nLarge = MAX3(tmp.spec.RGBi.red, tmp.spec.RGBi.green, tmp.spec.RGBi.blue); /* Scale the RGB values based on the largest one */ tmp.spec.RGBi.red /= nLarge; tmp.spec.RGBi.green /= nLarge; tmp.spec.RGBi.blue /= nLarge; tmp.format = XcmsRGBiFormat; /* If the calling routine wants RGB value give them the ones used. */ if (pRGB_return) { pRGB_return->red = tmp.spec.RGBi.red; pRGB_return->green = tmp.spec.RGBi.green; pRGB_return->blue = tmp.spec.RGBi.blue; } /* Convert from RGBi to Luv */ if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc), 1, XcmsCIELuvFormat, (Bool *) NULL) == XcmsFailure) { return (XcmsFailure); } memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); return (XcmsSuccess); } /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELuvQueryMaxLC - Compute maximum L* and chroma. * * SYNOPSIS */ Status XcmsCIELuvQueryMaxLC ( XcmsCCC ccc, XcmsFloat hue_angle, /* hue angle in degrees */ XcmsColor *pColor_return) /* * DESCRIPTION * Return the point of maximum chroma for the specified * hue angle. * * ASSUMPTIONS * This routine assumes that the white point associated with * the color specification is the Screen White Point. The * Screen White Point will also be associated with the * returned color specification. * * RETURNS * XcmsFailure - Failure * XcmsSuccess - Succeeded * */ { XcmsCCCRec myCCC; /* * Check Arguments */ if (ccc == NULL || pColor_return == NULL) { return(XcmsFailure); } /* Use my own CCC */ memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); myCCC.clientWhitePt.format = XcmsUndefinedFormat; myCCC.gamutCompProc = (XcmsCompressionProc)NULL; while (hue_angle < 0.0) { hue_angle += 360.0; } while (hue_angle >= 360.0) { hue_angle -= 360.0; } return(_XcmsCIELuvQueryMaxLCRGB (&myCCC, radians(hue_angle), pColor_return, (XcmsRGBi *)NULL)); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/LuvWpAj.c0000644000000000000000000000566213614532331015317 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * CIELuvWpAj.c * * DESCRIPTION * This file contains routine(s) that support white point * adjustment of color specifications in the CIE CIELuv.color * space. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELuvWhiteShiftColors * * SYNOPSIS */ Status XcmsCIELuvWhiteShiftColors( XcmsCCC ccc, XcmsColor *pWhitePtFrom, XcmsColor *pWhitePtTo, XcmsColorFormat destSpecFmt, XcmsColor *pColors_in_out, unsigned int nColors, Bool *pCompressed) /* * DESCRIPTION * Adjusts color specifications in an array of XcmsColor * structures for white point differences. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded without gamut compression, * XcmsSuccessWithCompression if succeeded with * gamut compression. */ { if (pWhitePtFrom == NULL || pWhitePtTo == NULL || pColors_in_out == NULL) { return(XcmsFailure); } /* * Convert to CIELuv using pWhitePtFrom * We can ignore return value for compression because we are converting * to XcmsCIELuvFormat which is device-independent, not device-dependent. */ if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, nColors, XcmsCIELuvFormat, pCompressed) == XcmsFailure) { return(XcmsFailure); } /* * Convert from CIELuv to destSpecFmt using pWhitePtTo */ return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtTo, nColors, destSpecFmt, pCompressed)); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/Makefile.am0000644000000000000000000000302113614532331015642 0ustar NULL = noinst_LTLIBRARIES = libxcms.la AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/include/X11 \ -I$(top_builddir)/include \ -I$(top_builddir)/include/X11 \ -I$(top_srcdir)/src/xcms \ -I$(top_srcdir)/src/xkb \ -I$(top_srcdir)/src/xlibi18n \ -I$(top_srcdir)/src \ -I$(top_srcdir)/../exports/include \ -D_GNU_SOURCE \ -DXCMSDIR=\"$(X11dir)\" \ $(NULL) AM_CFLAGS = \ $(X11_CFLAGS) \ $(BIGFONT_CFLAGS) \ $(XMALLOC_ZERO_CFLAGS) \ $(CWARNFLAGS) libxcms_la_SOURCES = \ AddDIC.c \ AddSF.c \ CCC.c \ CvColW.c \ CvCols.c \ HVC.c \ HVCGcC.c \ HVCGcV.c \ HVCGcVC.c \ HVCMnV.c \ HVCMxC.c \ HVCMxV.c \ HVCMxVC.c \ HVCMxVs.c \ HVCWpAj.c \ IdOfPr.c \ LRGB.c \ Lab.c \ LabGcC.c \ LabGcL.c \ LabGcLC.c \ LabMnL.c \ LabMxC.c \ LabMxL.c \ LabMxLC.c \ LabWpAj.c \ Luv.c \ LuvGcC.c \ LuvGcL.c \ LuvGcLC.c \ LuvMnL.c \ LuvMxC.c \ LuvMxL.c \ LuvMxLC.c \ LuvWpAj.c \ OfCCC.c \ PrOfId.c \ QBlack.c \ QBlue.c \ QGreen.c \ QRed.c \ QWhite.c \ QuCol.c \ QuCols.c \ SetCCC.c \ SetGetCols.c \ StCol.c \ StCols.c \ UNDEFINED.c \ XRGB.c \ XYZ.c \ cmsAllCol.c \ cmsAllNCol.c \ cmsCmap.c \ cmsColNm.c \ cmsGlobls.c \ cmsInt.c \ cmsLkCol.c \ cmsMath.c \ cmsProp.c \ cmsTrig.c \ uvY.c \ xyY.c \ $(NULL) X11dir = $(X11_DATADIR) dist_X11_DATA = Xcms.txt nx-libs-3.5.99.23/nx-X11/lib/src/xcms/OfCCC.c0000644000000000000000000000600313614532331014632 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsOfCCC.c - Color Conversion Context Querying Routines * * DESCRIPTION * Routines to query components of a Color Conversion * Context structure. * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlib.h" #include "Xcms.h" /************************************************************************ * * * PUBLIC INTERFACES * * * ************************************************************************/ /* * NAME * XcmsDisplayOfCCC * * SYNOPSIS */ Display * XcmsDisplayOfCCC( XcmsCCC ccc) /* * DESCRIPTION * Queries the Display of the specified CCC. * * RETURNS * Pointer to the Display. * */ { return(ccc->dpy); } /* * NAME * XcmsVisualOfCCC * * SYNOPSIS */ Visual * XcmsVisualOfCCC( XcmsCCC ccc) /* * DESCRIPTION * Queries the Visual of the specified CCC. * * RETURNS * Pointer to the Visual. * */ { return(ccc->visual); } /* * NAME * XcmsScreenNumberOfCCC * * SYNOPSIS */ int XcmsScreenNumberOfCCC( XcmsCCC ccc) /* * DESCRIPTION * Queries the screen number of the specified CCC. * * RETURNS * screen number. * */ { return(ccc->screenNumber); } /* * NAME * XcmsScreenWhitePointOfCCC * * SYNOPSIS */ XcmsColor * XcmsScreenWhitePointOfCCC( XcmsCCC ccc) /* * DESCRIPTION * Queries the screen white point of the specified CCC. * * RETURNS * Pointer to the XcmsColor containing the screen white point. * */ { return(&ccc->pPerScrnInfo->screenWhitePt); } /* * NAME * XcmsClientWhitePointOfCCC * * SYNOPSIS */ XcmsColor * XcmsClientWhitePointOfCCC( XcmsCCC ccc) /* * DESCRIPTION * Queries the client white point of the specified CCC. * * RETURNS * Pointer to the XcmsColor containing the client white point. * */ { return(&ccc->clientWhitePt); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/PrOfId.c0000644000000000000000000000476413614532331015114 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsPrOfId.c * * DESCRIPTION * Source for XcmsPrefixOfFormat() * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * NAME * XcmsPrefixOfId * * SYNOPSIS */ char * XcmsPrefixOfFormat( XcmsColorFormat id) /* * DESCRIPTION * Returns the color space prefix for the specified color * space ID if the color space is found in the Color * Conversion Context. * * RETURNS * Returns a color space prefix. * * CAVEATS * Space is allocated for the returned string, therefore, * the application is responsible for freeing (using XFree) * the space. * */ { XcmsColorSpace **papColorSpaces; /* * First try Device-Independent color spaces */ papColorSpaces = _XcmsDIColorSpaces; if (papColorSpaces != NULL) { while (*papColorSpaces != NULL) { if ((*papColorSpaces)->id == id) { return strdup((*papColorSpaces)->prefix); } papColorSpaces++; } } /* * Next try Device-Dependent color spaces */ papColorSpaces = _XcmsDDColorSpaces; if (papColorSpaces != NULL) { while (*papColorSpaces != NULL) { if ((*papColorSpaces)->id == id) { return strdup((*papColorSpaces)->prefix); } papColorSpaces++; } } return(NULL); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/QBlack.c0000644000000000000000000000454513614532331015123 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsQBlack.c - Query Black * * DESCRIPTION * Routine to obtain a color specification for zero * red, green, and blue intensities. * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcms.h" /************************************************************************ * * * PUBLIC INTERFACES * * * ************************************************************************/ /* * NAME * XcmsQueryBlack * * SYNOPSIS */ Status XcmsQueryBlack( XcmsCCC ccc, XcmsColorFormat target_format, XcmsColor *pColor_ret) /* * DESCRIPTION * Returns the color specification in the target format for * zero intensity red, green, and blue. * * RETURNS * Returns XcmsSuccess, if failed; otherwise XcmsFailure * */ { XcmsColor tmp; tmp.format = XcmsRGBiFormat; tmp.pixel = 0; tmp.spec.RGBi.red = 0.0; tmp.spec.RGBi.green = 0.0; tmp.spec.RGBi.blue = 0.0; if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { return(XcmsFailure); } memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/QBlue.c0000644000000000000000000000460313614532331014771 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsQBlue.c - Query Blue * * DESCRIPTION * Routine to obtain a color specification for full * blue intensity and zero red and green intensities. * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcms.h" /************************************************************************ * * * PUBLIC INTERFACES * * * ************************************************************************/ /* * NAME * XcmsQueryBlue * * SYNOPSIS */ Status XcmsQueryBlue( XcmsCCC ccc, XcmsColorFormat target_format, XcmsColor *pColor_ret) /* * DESCRIPTION * Returns the color specification in the target format for * full intensity blue and zero intensity red and green. * * RETURNS * Returns XcmsSuccess, if failed; otherwise XcmsFailure * */ { XcmsColor tmp; tmp.format = XcmsRGBiFormat; tmp.pixel = 0; tmp.spec.RGBi.red = 0.0; tmp.spec.RGBi.green = 0.0; tmp.spec.RGBi.blue = 1.0; if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { return(XcmsFailure); } memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/QGreen.c0000644000000000000000000000460713614532331015146 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsQGreen.c - Query Green * * DESCRIPTION * Routine to obtain a color specification for full * green intensity and zero red and blue intensities. * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcms.h" /************************************************************************ * * * PUBLIC INTERFACES * * * ************************************************************************/ /* * NAME * XcmsQueryGreen * * SYNOPSIS */ Status XcmsQueryGreen( XcmsCCC ccc, XcmsColorFormat target_format, XcmsColor *pColor_ret) /* * DESCRIPTION * Returns the color specification in the target format for * full intensity green and zero intensity red and blue. * * RETURNS * Returns XcmsSuccess, if failed; otherwise XcmsFailure * */ { XcmsColor tmp; tmp.format = XcmsRGBiFormat; tmp.pixel = 0; tmp.spec.RGBi.red = 0.0; tmp.spec.RGBi.green = 1.0; tmp.spec.RGBi.blue = 0.0; if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { return(XcmsFailure); } memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/QRed.c0000644000000000000000000000460013614532331014611 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsQRed.c - Query Red * * DESCRIPTION * Routine to obtain a color specification for full * red intensity and zero green and blue intensities. * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcms.h" /************************************************************************ * * * PUBLIC INTERFACES * * * ************************************************************************/ /* * NAME * XcmsQueryRed * * SYNOPSIS */ Status XcmsQueryRed( XcmsCCC ccc, XcmsColorFormat target_format, XcmsColor *pColor_ret) /* * DESCRIPTION * Returns the color specification in the target format for * full intensity red and zero intensity green and blue. * * RETURNS * Returns XcmsSuccess, if failed; otherwise XcmsFailure * */ { XcmsColor tmp; tmp.format = XcmsRGBiFormat; tmp.pixel = 0; tmp.spec.RGBi.red = 1.0; tmp.spec.RGBi.green = 0.0; tmp.spec.RGBi.blue = 0.0; if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { return(XcmsFailure); } memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/QuCol.c0000644000000000000000000000451313614532331015004 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsQuCol.c * * DESCRIPTION * Source for XcmsQueryColors * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsQueryColor - Query Color * * SYNOPSIS */ Status XcmsQueryColor( Display *dpy, Colormap colormap, XcmsColor *pXcmsColor_in_out, XcmsColorFormat result_format) /* * DESCRIPTION * This routine uses XQueryColor to obtain the X RGB values * stored in the specified colormap for the specified pixel. * The X RGB values are then converted to the target format as * specified by the format component of the XcmsColor structure. * * RETURNS * XcmsFailure if failed; * XcmsSuccess if it succeeded. * * Returns a color specification of the color stored in the * specified pixel. */ { return(_XcmsSetGetColor(XQueryColor, dpy, colormap, pXcmsColor_in_out, result_format, (Bool *) NULL)); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/QuCols.c0000644000000000000000000000457313614532331015175 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsQuCol.c * * DESCRIPTION * Source for XcmsQueryColors * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsQueryColors - Query Colors * * SYNOPSIS */ Status XcmsQueryColors( Display *dpy, Colormap colormap, XcmsColor *pXcmsColors_in_out, unsigned int nColors, XcmsColorFormat result_format) /* * DESCRIPTION * This routine uses XQueryColors to obtain the X RGB values * stored in the specified colormap for the specified pixels. * The X RGB values are then converted to the target format as * specified by the format component of the XcmsColor structure. * * RETURNS * XcmsFailure if failed; * XcmsSuccess if it succeeded. * * Returns the color specifications of the colors stored in the * specified pixels. */ { return(_XcmsSetGetColors(XQueryColors, dpy, colormap, pXcmsColors_in_out, nColors, result_format, (Bool *) NULL)); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/QWhite.c0000644000000000000000000000454513614532331015167 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsQWhite.c - Query White * * DESCRIPTION * Routine to obtain a color specification for full * red, green, and blue intensities. * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcms.h" /************************************************************************ * * * PUBLIC INTERFACES * * * ************************************************************************/ /* * NAME * XcmsQueryWhite * * SYNOPSIS */ Status XcmsQueryWhite( XcmsCCC ccc, XcmsColorFormat target_format, XcmsColor *pColor_ret) /* * DESCRIPTION * Returns the color specification in the target format for * full intensity red, green, and blue. * * RETURNS * Returns XcmsSuccess, if failed; otherwise XcmsFailure * */ { XcmsColor tmp; tmp.format = XcmsRGBiFormat; tmp.pixel = 0; tmp.spec.RGBi.red = 1.0; tmp.spec.RGBi.green = 1.0; tmp.spec.RGBi.blue = 1.0; if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { return(XcmsFailure); } memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/SetCCC.c0000644000000000000000000000646213614532331015032 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsSetCCC.c - Color Conversion Context Setting Routines * * DESCRIPTION * Routines to set components of a Color Conversion * Context structure. * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcms.h" /************************************************************************ * * * PUBLIC INTERFACES * * * ************************************************************************/ /* * NAME * XcmsSetWhitePoint * * SYNOPSIS */ Status XcmsSetWhitePoint( XcmsCCC ccc, XcmsColor *pColor) /* * DESCRIPTION * Sets the Client White Point in the specified CCC. * * RETURNS * Returns XcmsSuccess if succeeded; otherwise XcmsFailure. * */ { if (pColor == NULL || pColor->format == XcmsUndefinedFormat) { ccc->clientWhitePt.format = XcmsUndefinedFormat; } else if (pColor->format != XcmsCIEXYZFormat && pColor->format != XcmsCIEuvYFormat && pColor->format != XcmsCIExyYFormat) { return(XcmsFailure); } else { memcpy((char *)&ccc->clientWhitePt, (char *)pColor, sizeof(XcmsColor)); } return(XcmsSuccess); } /* * NAME * XcmsSetCompressionProc * * SYNOPSIS */ XcmsCompressionProc XcmsSetCompressionProc( XcmsCCC ccc, XcmsCompressionProc compression_proc, XPointer client_data) /* * DESCRIPTION * Set the specified CCC's compression function and client data. * * RETURNS * Returns the old compression function. * */ { XcmsCompressionProc old = ccc->gamutCompProc; ccc->gamutCompProc = compression_proc; ccc->gamutCompClientData = client_data; return(old); } /* * NAME * XcmsSetWhiteAdjustProc * * SYNOPSIS */ XcmsWhiteAdjustProc XcmsSetWhiteAdjustProc( XcmsCCC ccc, XcmsWhiteAdjustProc white_adjust_proc, XPointer client_data ) /* * DESCRIPTION * Set the specified CCC's white_adjust function and client data. * * RETURNS * Returns the old white_adjust function. * */ { XcmsWhiteAdjustProc old = ccc->whitePtAdjProc; ccc->whitePtAdjProc = white_adjust_proc; ccc->whitePtAdjClientData = client_data; return(old); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/SetGetCols.c0000644000000000000000000001677513614532331016012 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsSetGet.c * * DESCRIPTION * Source for _XcmsSetGetColors() * * */ /* * EXTERNAL INCLUDES * Include files that must be exported to any package or * program using this package. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * API PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * XcmsSetColor - * * SYNOPSIS */ Status _XcmsSetGetColor( Status (*xColorProc)( Display* /* display */, Colormap /* colormap */, XColor* /* screen_in_out */), Display *dpy, Colormap cmap, XcmsColor *pColors_in_out, XcmsColorFormat result_format, Bool *pCompressed) /* * DESCRIPTION * Routine containing code common to: * XcmsAllocColor * XcmsQueryColor * XcmsStoreColor * * RETURNS * XcmsFailure if failed; * XcmsSuccess if it succeeded without gamut compression; * XcmsSuccessWithCompression if it succeeded with gamut * compression; */ { XcmsCCC ccc; XColor XColors_in_out; Status retval = XcmsSuccess; /* * Argument Checking * 1. Assume xColorProc is correct * 2. Insure ccc not NULL * 3. Assume cmap correct (should be checked by Server) * 4. Insure pColors_in_out valid * 5. Assume method_in is valid (should be checked by Server) */ if (dpy == NULL) { return(XcmsFailure); } if (result_format == XcmsUndefinedFormat) { return(XcmsFailure); } if ( !((*xColorProc == XAllocColor) || (*xColorProc == XStoreColor) || (*xColorProc == XQueryColor)) ) { return(XcmsFailure); } if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { return(XcmsFailure); } if (*xColorProc == XQueryColor) { goto Query; } /* * Convert to RGB, adjusting for white point differences if necessary. */ if ((retval = XcmsConvertColors(ccc, pColors_in_out, 1, XcmsRGBFormat, pCompressed)) == XcmsFailure) { return(XcmsFailure); } Query: /* * Convert XcmsColor to XColor structures */ _XcmsRGB_to_XColor(pColors_in_out, &XColors_in_out, 1); /* * Now make appropriate X Call */ if (*xColorProc == XAllocColor) { if ((*xColorProc)(ccc->dpy, cmap, &XColors_in_out) == 0) { return(XcmsFailure); } } else if ((*xColorProc == XQueryColor) || (*xColorProc == XStoreColor)) { /* Note: XQueryColor and XStoreColor do not return any Status */ (*xColorProc)(ccc->dpy, cmap, &XColors_in_out); } else { return(XcmsFailure); } if ((*xColorProc == XStoreColor)) { return(retval); } /* * Now, convert the returned XColor (i.e., rgb) to XcmsColor structures */ _XColor_to_XcmsRGB(ccc, &XColors_in_out, pColors_in_out, 1); /* * Then, convert XcmsColor structures to the original specification * format. Note that we must use NULL instead of passing * pCompressed. */ if (result_format != XcmsRGBFormat) { if (XcmsConvertColors(ccc, pColors_in_out, 1, result_format, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } } return(retval); } /* * NAME * XcmsSetColors - * * SYNOPSIS */ Status _XcmsSetGetColors( Status (*xColorProc)( Display* /* display */, Colormap /* colormap */, XColor* /* screen_in_out */, int /* nColors */), Display *dpy, Colormap cmap, XcmsColor *pColors_in_out, int nColors, XcmsColorFormat result_format, Bool *pCompressed) /* * DESCRIPTION * Routine containing code common to: * XcmsQueryColors * XcmsStoreColors * * RETURNS * XcmsFailure if failed; * XcmsSuccess if it succeeded without gamut compression; * XcmsSuccessWithCompression if it succeeded with gamut * compression; */ { XcmsCCC ccc; XColor *pXColors_in_out; Status retval = XcmsSuccess; /* * Argument Checking * 1. Assume xColorProc is correct * 2. Insure ccc not NULL * 3. Assume cmap correct (should be checked by Server) * 4. Insure pColors_in_out valid * 5. Assume method_in is valid (should be checked by Server) * 6. Insure nColors > 0 */ if (dpy == NULL) { return(XcmsFailure); } if (nColors == 0) { return(XcmsSuccess); } if (result_format == XcmsUndefinedFormat) { return(XcmsFailure); } if ( !((*xColorProc == XStoreColors) || (*xColorProc == XQueryColors)) ) { return(XcmsFailure); } if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { return(XcmsFailure); } /* * Allocate space for XColors */ if ((pXColors_in_out = Xcalloc(nColors, sizeof(XColor))) == NULL) { return(XcmsFailure); } if (*xColorProc == XQueryColors) { goto Query; } /* * Convert to RGB, adjusting for white point differences if necessary. */ if ((retval = XcmsConvertColors(ccc, pColors_in_out, nColors, XcmsRGBFormat, pCompressed)) == XcmsFailure) { Xfree(pXColors_in_out); return(XcmsFailure); } Query: /* * Convert XcmsColor to XColor structures */ _XcmsRGB_to_XColor(pColors_in_out, pXColors_in_out, nColors); /* * Now make appropriate X Call */ if ((*xColorProc == XQueryColors) || (*xColorProc == XStoreColors)){ /* Note: XQueryColors and XStoreColors do not return any Status */ (*xColorProc)(ccc->dpy, cmap, pXColors_in_out, nColors); } else { Xfree(pXColors_in_out); return(XcmsFailure); } if (*xColorProc == XStoreColors) { Xfree(pXColors_in_out); return(retval); } /* * Now, convert the returned XColor (i.e., rgb) to XcmsColor structures */ _XColor_to_XcmsRGB(ccc, pXColors_in_out, pColors_in_out, nColors); Xfree(pXColors_in_out); /* * Then, convert XcmsColor structures to the original specification * format. Note that we must use NULL instead of passing * pCompressed. */ if (result_format != XcmsRGBFormat) { if (XcmsConvertColors(ccc, pColors_in_out, nColors, result_format, (Bool *) NULL) == XcmsFailure) { return(XcmsFailure); } } return(retval); } /* ### EOF ### */ nx-libs-3.5.99.23/nx-X11/lib/src/xcms/StCol.c0000644000000000000000000000461613614532331015011 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsStCol.c * * DESCRIPTION * Source for XcmsStoreColor * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsStoreColor - Store Color * * SYNOPSIS */ Status XcmsStoreColor( Display *dpy, Colormap colormap, XcmsColor *pColor_in) /* * DESCRIPTION * Given a device-dependent or device-independent color * specification, this routine will convert it to X RGB * values then use it in a call to XStoreColor. * * RETURNS * XcmsFailure if failed; * XcmsSuccess if it succeeded without gamut compression; * XcmsSuccessWithCompression if it succeeded with gamut * compression; * * Since XStoreColor has no return value this routine * does not return the color specification of the color actually * stored. */ { XcmsColor tmpColor; tmpColor = *pColor_in; return(_XcmsSetGetColor(XStoreColor, dpy, colormap, &tmpColor, XcmsRGBFormat, (Bool *) NULL)); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/StCols.c0000644000000000000000000000602213614532331015165 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsStCols.c * * DESCRIPTION * Source for XcmsStoreColors * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsStoreColors - Store Colors * * SYNOPSIS */ Status XcmsStoreColors( Display *dpy, Colormap colormap, XcmsColor *pColors_in, unsigned int nColors, Bool *pCompressed) /* * DESCRIPTION * Given device-dependent or device-independent color * specifications, this routine will convert them to X RGB * values then use it in a call to XStoreColors. * * RETURNS * XcmsFailure if failed; * XcmsSuccess if it succeeded without gamut compression; * XcmsSuccessWithCompression if it succeeded with gamut * compression; * * Since XStoreColors has no return value, this routine * does not return color specifications of the colors actually * stored. */ { XcmsColor Color1; XcmsColor *pColors_tmp; Status retval; /* * Make copy of array of color specifications so we don't * overwrite the contents. */ if (nColors > 1) { pColors_tmp = Xmalloc(nColors * sizeof(XcmsColor)); } else { pColors_tmp = &Color1; } memcpy((char *)pColors_tmp, (char *)pColors_in, nColors * sizeof(XcmsColor)); /* * Call routine to store colors using the copied color structures */ retval = _XcmsSetGetColors (XStoreColors, dpy, colormap, pColors_tmp, nColors, XcmsRGBFormat, pCompressed); /* * Free copies as needed. */ if (nColors > 1) { Xfree(pColors_tmp); } /* * Ah, finally return. */ return(retval); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/UNDEFINED.c0000644000000000000000000000612613614532331015264 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * * NAME * UNDEFINED.c * * DESCRIPTION * UNDEFINED Color Space * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" /* * FORWARD DECLARATIONS */ static int DummyParseStringProc( char* /* color_string */, XcmsColor* /* color_return */ ); static Status ReturnZero( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ); /* * LOCALS VARIABLES */ static Status (*(Fl_ReturnZero[]))( XcmsCCC /* ccc */, XcmsColor* /* white_point */, XcmsColor* /* colors */, unsigned int /* ncolors */ ) = { ReturnZero, NULL }; /* * GLOBALS * Variables declared in this package that are allowed * to be used globally. */ /* * UNDEFINED Color Space */ XcmsColorSpace XcmsUNDEFINEDColorSpace = { "undefined", /* prefix */ XcmsUndefinedFormat, /* id */ &DummyParseStringProc, /* parseString */ Fl_ReturnZero, /* to_CIEXYZ */ Fl_ReturnZero /* from_CIEXYZ */ }; /************************************************************************ * * * PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * ReturnZero * * SYNOPSIS */ /* ARGSUSED */ static Status ReturnZero( XcmsCCC ccc /* ccc */, XcmsColor* white /* white_point */, XcmsColor* colors /* colors */, unsigned int ncolors /* ncolors */ ) /* * DESCRIPTION * Does nothing. * * RETURNS * 0 * */ { return(0); } static int DummyParseStringProc( char* color_string /* color_string */, XcmsColor* color_return /* color_return */ ) { return(0); } /* ### EOF ### */ nx-libs-3.5.99.23/nx-X11/lib/src/xcms/uvY.c0000644000000000000000000002444013614532331014545 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * CIEuvy.c * * DESCRIPTION * This file contains routines that support the CIE u'v'Y * color space to include conversions to and from the CIE * XYZ space. * * DOCUMENTATION * "TekColor Color Management System, System Implementor's Manual" */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" #include /* * FORWARD DECLARATIONS */ static int CIEuvY_ParseString(register char *spec, XcmsColor *pColor); /* * DEFINES * Internal definitions that need NOT be exported to any package * or program using this package. */ #ifdef DBL_EPSILON # define XMY_DBL_EPSILON DBL_EPSILON #else # define XMY_DBL_EPSILON 0.00001 #endif /* * LOCAL VARIABLES */ /* * NULL terminated list of functions applied to get from CIEuvY to CIEXYZ */ static XcmsConversionProc Fl_CIEuvY_to_CIEXYZ[] = { XcmsCIEuvYToCIEXYZ, NULL }; /* * NULL terminated list of functions applied to get from CIEXYZ to CIEuvY */ static XcmsConversionProc Fl_CIEXYZ_to_CIEuvY[] = { XcmsCIEXYZToCIEuvY, NULL }; /* * GLOBALS */ /* * CIE uvY Color Space */ XcmsColorSpace XcmsCIEuvYColorSpace = { _XcmsCIEuvY_prefix, /* prefix */ XcmsCIEuvYFormat, /* id */ CIEuvY_ParseString, /* parseString */ Fl_CIEuvY_to_CIEXYZ, /* to_CIEXYZ */ Fl_CIEXYZ_to_CIEuvY, /* from_CIEXYZ */ 1 }; /************************************************************************ * * * PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * CIEuvY_ParseString * * SYNOPSIS */ static int CIEuvY_ParseString( register char *spec, XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert * it into a XcmsColor structure with XcmsCIEuvYFormat. * The assumed CIEuvY string syntax is: * CIEuvY:// * Where u, v, and Y are in string input format for floats * consisting of: * a. an optional sign * b. a string of numbers possibly containing a decimal point, * c. an optional exponent field containing an 'E' or 'e' * followed by a possibly signed integer string. * * RETURNS * 0 if failed, non-zero otherwise. */ { size_t n; char *pchar; if ((pchar = strchr(spec, ':')) == NULL) { return(XcmsFailure); } n = (size_t)(pchar - spec); /* * Check for proper prefix. */ if (strncmp(spec, _XcmsCIEuvY_prefix, n) != 0) { return(XcmsFailure); } /* * Attempt to parse the value portion. */ if (sscanf(spec + n + 1, "%lf/%lf/%lf", &pColor->spec.CIEuvY.u_prime, &pColor->spec.CIEuvY.v_prime, &pColor->spec.CIEuvY.Y) != 3) { char *s; /* Maybe failed due to locale */ int f; if ((s = strdup(spec))) { for (f = 0; s[f]; ++f) if (s[f] == '.') s[f] = ','; else if (s[f] == ',') s[f] = '.'; if (sscanf(s + n + 1, "%lf/%lf/%lf", &pColor->spec.CIEuvY.u_prime, &pColor->spec.CIEuvY.v_prime, &pColor->spec.CIEuvY.Y) != 3) { free(s); return(XcmsFailure); } free(s); } else return(XcmsFailure); } pColor->format = XcmsCIEuvYFormat; pColor->pixel = 0; return(_XcmsCIEuvY_ValidSpec(pColor)); } /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIEuvY_ValidSpec * * SYNOPSIS */ Status _XcmsCIEuvY_ValidSpec( XcmsColor *pColor) /* * DESCRIPTION * Checks if color specification valid for CIE u'v'Y. * * RETURNS * XcmsFailure if invalid, * XcmsSuccess if valid. * */ { if (pColor->format != XcmsCIEuvYFormat || (pColor->spec.CIEuvY.Y < 0.0 - XMY_DBL_EPSILON) || (pColor->spec.CIEuvY.Y > 1.0 + XMY_DBL_EPSILON)) { return(XcmsFailure); } return(XcmsSuccess); } /* * NAME * XcmsCIEuvYToCIEXYZ - convert CIEuvY to CIEXYZ * * SYNOPSIS */ Status XcmsCIEuvYToCIEXYZ( XcmsCCC ccc, XcmsColor *puvY_WhitePt, XcmsColor *pColors_in_out, unsigned int nColors) /* * DESCRIPTION * Converts color specifications in an array of XcmsColor * structures from CIEuvY format to CIEXYZ format. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded. * */ { XcmsCIEXYZ XYZ_return; XcmsColor whitePt; unsigned int i; XcmsColor *pColor = pColors_in_out; XcmsFloat div, x, y, z, Y; /* * Check arguments * Postpone checking puvY_WhitePt until it is actually needed * otherwise converting between XYZ and uvY will fail. */ if (pColors_in_out == NULL) { return(XcmsFailure); } /* * Now convert each XcmsColor structure to CIEXYZ form */ for (i = 0; i < nColors; i++, pColor++) { /* Make sure original format is CIEuvY */ if (!_XcmsCIEuvY_ValidSpec(pColor)) { return(XcmsFailure); } /* * Convert to CIEXYZ */ Y = pColor->spec.CIEuvY.Y; /* Convert color u'v' to xyz space */ div = (6.0 * pColor->spec.CIEuvY.u_prime) - (16.0 * pColor->spec.CIEuvY.v_prime) + 12.0; if (div == 0.0) { /* use white point since div == 0 */ if (puvY_WhitePt == NULL ) { return(XcmsFailure); } /* * Make sure white point is in CIEuvY form */ if (puvY_WhitePt->format != XcmsCIEuvYFormat) { /* Make copy of the white point because we're going to modify it */ memcpy((char *)&whitePt, (char *)puvY_WhitePt, sizeof(XcmsColor)); if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, XcmsCIEuvYFormat)) { return(XcmsFailure); } puvY_WhitePt = &whitePt; } /* Make sure it is a white point, i.e., Y == 1.0 */ if (puvY_WhitePt->spec.CIEuvY.Y != 1.0) { return(XcmsFailure); } div = (6.0 * puvY_WhitePt->spec.CIEuvY.u_prime) - (16.0 * puvY_WhitePt->spec.CIEuvY.v_prime) + 12.0; if (div == 0) { /* internal error */ return(XcmsFailure); } x = 9.0 * puvY_WhitePt->spec.CIEuvY.u_prime / div; y = 4.0 * puvY_WhitePt->spec.CIEuvY.v_prime / div; } else { x = 9.0 * pColor->spec.CIEuvY.u_prime / div; y = 4.0 * pColor->spec.CIEuvY.v_prime / div; } z = 1.0 - x - y; /* Convert from xyz to XYZ */ /* Conversion uses color normalized lightness based on Y */ if (y != 0.0) { XYZ_return.X = x * Y / y; } else { XYZ_return.X = x; } XYZ_return.Y = Y; if (y != 0.0) { XYZ_return.Z = z * Y / y; } else { XYZ_return.Z = z; } memcpy((char *)&pColor->spec.CIEXYZ, (char *)&XYZ_return, sizeof(XcmsCIEXYZ)); /* Identify that format is now CIEXYZ */ pColor->format = XcmsCIEXYZFormat; } return(XcmsSuccess); } /* * NAME * XcmsCIEXYZToCIEuvY - convert CIEXYZ to CIEuvY * * SYNOPSIS */ Status XcmsCIEXYZToCIEuvY( XcmsCCC ccc, XcmsColor *puvY_WhitePt, XcmsColor *pColors_in_out, unsigned int nColors) /* * DESCRIPTION * Converts color specifications in an array of XcmsColor * structures from CIEXYZ format to CIEuvY format. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded. * */ { XcmsCIEuvY uvY_return; XcmsColor whitePt; unsigned int i; XcmsColor *pColor = pColors_in_out; XcmsFloat div; /* * Check arguments * Postpone checking puvY_WhitePt until it is actually needed * otherwise converting between XYZ and uvY will fail. */ if (pColors_in_out == NULL) { return(XcmsFailure); } /* * Now convert each XcmsColor structure to CIEuvY form */ for (i = 0; i < nColors; i++, pColor++) { /* Make sure original format is CIEXYZ */ if (!_XcmsCIEXYZ_ValidSpec(pColor)) { return(XcmsFailure); } /* Convert to CIEuvY */ div = pColor->spec.CIEXYZ.X + (15.0 * pColor->spec.CIEXYZ.Y) + (3.0 * pColor->spec.CIEXYZ.Z); if (div == 0.0) { /* Use white point since div == 0.0 */ if (puvY_WhitePt == NULL ) { return(XcmsFailure); } /* * Make sure white point is in CIEuvY form */ if (puvY_WhitePt->format != XcmsCIEuvYFormat) { /* Make copy of the white point because we're going to modify it */ memcpy((char *)&whitePt, (char *)puvY_WhitePt, sizeof(XcmsColor)); if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, XcmsCIEuvYFormat)) { return(XcmsFailure); } puvY_WhitePt = &whitePt; } /* Make sure it is a white point, i.e., Y == 1.0 */ if (puvY_WhitePt->spec.CIEuvY.Y != 1.0) { return(XcmsFailure); } uvY_return.Y = pColor->spec.CIEXYZ.Y; uvY_return.u_prime = puvY_WhitePt->spec.CIEuvY.u_prime; uvY_return.v_prime = puvY_WhitePt->spec.CIEuvY.v_prime; } else { uvY_return.u_prime = 4.0 * pColor->spec.CIEXYZ.X / div; uvY_return.v_prime = 9.0 * pColor->spec.CIEXYZ.Y / div; uvY_return.Y = pColor->spec.CIEXYZ.Y; } memcpy((char *)&pColor->spec.CIEuvY, (char *)&uvY_return, sizeof(XcmsCIEuvY)); /* Identify that format is now CIEuvY */ pColor->format = XcmsCIEuvYFormat; } return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/Xcmsint.h0000644000000000000000000001666413614532331015425 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * DESCRIPTION * Private include file for Color Management System. * (i.e., for API internal use only) * */ #ifndef _XCMSINT_H_ #define _XCMSINT_H_ #include /* * DEFINES */ /* * Private Status Value */ #define _XCMS_NEWNAME -1 /* * Color Space ID's are of XcmsColorFormat type. * * bit 31 * 0 == Device-Independent * 1 == Device-Dependent * * bit 30: * 0 == Registered with X Consortium * 1 == Unregistered */ #define XCMS_DD_ID(id) ((id) & (XcmsColorFormat)0x80000000) #define XCMS_DI_ID(id) (!((id) & (XcmsColorFormat)0x80000000)) #define XCMS_UNREG_ID(id) ((id) & (XcmsColorFormat)0x40000000) #define XCMS_REG_ID(id) (!((id) & (XcmsColorFormat)0x40000000)) #define XCMS_FIRST_REG_DI_ID (XcmsColorFormat)0x00000001 #define XCMS_FIRST_UNREG_DI_ID (XcmsColorFormat)0x40000000 #define XCMS_FIRST_REG_DD_ID (XcmsColorFormat)0x80000000 #define XCMS_FIRST_UNREG_DD_ID (XcmsColorFormat)0xc0000000 /* * TYPEDEFS */ /* * Structure for caching Colormap info. * This is provided for the Xlib modifications to: * XAllocNamedColor() * XLookupColor() * XParseColor() * XStoreNamedColor() */ typedef struct _XcmsCmapRec { Colormap cmapID; Display *dpy; Window windowID; Visual *visual; struct _XcmsCCC *ccc; struct _XcmsCmapRec *pNext; } XcmsCmapRec; /* * Intensity Record (i.e., value / intensity tuple) */ typedef struct _IntensityRec { unsigned short value; XcmsFloat intensity; } IntensityRec; /* * Intensity Table */ typedef struct _IntensityTbl { IntensityRec *pBase; unsigned int nEntries; } IntensityTbl; /* * Structure for storing per-Visual Intensity Tables (aka gamma maps). */ typedef struct _XcmsIntensityMap { VisualID visualID; XPointer screenData; /* pointer to corresponding Screen Color*/ /* Characterization Data */ void (*pFreeScreenData)(XPointer pScreenDataTemp); /* Function that frees a Screen */ /* structure. */ struct _XcmsIntensityMap *pNext; } XcmsIntensityMap; /* * Structure for storing "registered" color space prefix/ID */ typedef struct _XcmsRegColorSpaceEntry { const char *prefix; /* Color Space prefix (e.g., "CIEXYZ:") */ XcmsColorFormat id; /* Color Space ID (e.g., XcmsCIEXYZFormat) */ } XcmsRegColorSpaceEntry; /* * Xcms Per Display (i.e. connection) related data */ typedef struct _XcmsPerDpyInfo { XcmsCCC paDefaultCCC; /* based on default visual of screen */ /* * Pointer to an array of XcmsCCC structures, one for * each screen. */ XcmsCmapRec *pClientCmaps; /* Pointer to linked list of XcmsCmapRec's */ } XcmsPerDpyInfo, *XcmsPerDpyInfoPtr; /* * DEFINES */ #define XDCCC_NUMBER 0x8000000L /* 2**27 per XDCCC */ #ifdef GRAY #define XDCCC_SCREENWHITEPT_ATOM_NAME "XDCCC_GRAY_SCREENWHITEPOINT" #define XDCCC_GRAY_CORRECT_ATOM_NAME "XDCCC_GRAY_CORRECTION" #endif /* GRAY */ #ifndef _ConversionValues typedef struct _ConversionValues { IntensityTbl IntensityTbl; } ConversionValues; #endif #ifdef GRAY typedef struct { IntensityTbl *IntensityTbl; } GRAY_SCCData; #endif /* GRAY */ /* * DEFINES */ #define XDCCC_MATRIX_ATOM_NAME "XDCCC_LINEAR_RGB_MATRICES" #define XDCCC_CORRECT_ATOM_NAME "XDCCC_LINEAR_RGB_CORRECTION" typedef struct { XcmsFloat XYZtoRGBmatrix[3][3]; XcmsFloat RGBtoXYZmatrix[3][3]; IntensityTbl *pRedTbl; IntensityTbl *pGreenTbl; IntensityTbl *pBlueTbl; } LINEAR_RGB_SCCData; /* function prototypes */ extern XcmsCmapRec * _XcmsAddCmapRec( Display *dpy, Colormap cmap, Window windowID, Visual *visual); extern void _XcmsRGB_to_XColor( XcmsColor *pColors, XColor *pXColors, unsigned int nColors); extern Status _XcmsResolveColorString ( XcmsCCC ccc, const char **color_string, XcmsColor *pColor_exact_return, XcmsColorFormat result_format); extern void _XUnresolveColor( XcmsCCC ccc, XColor *pXColor); /* * DESCRIPTION * Include file for defining the math macros used in the * XCMS source. Instead of using math library routines * directly, XCMS uses macros so that based on the * definitions here, vendors and sites can specify exactly * what routine will be called (those from libm.a or their * custom routines). If not defined to math library routines * (e.g., sqrt in libm.a), then the client is not forced to * be linked with -lm. */ #define XCMS_ATAN(x) _XcmsArcTangent(x) #define XCMS_COS(x) _XcmsCosine(x) #define XCMS_CUBEROOT(x) _XcmsCubeRoot(x) #define XCMS_FABS(x) ((x) < 0.0 ? -(x) : (x)) #define XCMS_SIN(x) _XcmsSine(x) #define XCMS_SQRT(x) _XcmsSquareRoot(x) #define XCMS_TAN(x) (XCMS_SIN(x) / XCMS_COS(x)) double _XcmsArcTangent(double a); double _XcmsCosine(double a); double _XcmsCubeRoot(double a); double _XcmsSine(double a); double _XcmsSquareRoot(double a); /* * DEFINES FOR GAMUT COMPRESSION AND QUERY ROUTINES */ #ifndef PI # ifdef M_PI # define PI M_PI # else # define PI 3.14159265358979323846264338327950 # endif /* M_PI */ #endif /* PI */ #ifndef degrees # define degrees(r) ((XcmsFloat)(r) * 180.0 / PI) #endif /* degrees */ #ifndef radians # define radians(d) ((XcmsFloat)(d) * PI / 180.0) #endif /* radians */ #define XCMS_CIEUSTAROFHUE(h,c) \ ((XCMS_COS((h)) == 0.0) ? (XcmsFloat)0.0 : (XcmsFloat) \ ((XcmsFloat)(c) / (XcmsFloat)XCMS_SQRT((XCMS_TAN(h) * XCMS_TAN(h)) + \ (XcmsFloat)1.0))) #define XCMS_CIEVSTAROFHUE(h,c) \ ((XCMS_COS((h)) == 0.0) ? (XcmsFloat)0.0 : (XcmsFloat) \ ((XcmsFloat)(c) / (XcmsFloat)XCMS_SQRT(((XcmsFloat)1.0 / \ (XcmsFloat)(XCMS_TAN(h) * XCMS_TAN(h))) + (XcmsFloat)1.0))) /* this hue is returned in radians */ #define XCMS_CIELUV_PMETRIC_HUE(u,v) \ (((u) != 0.0) ? XCMS_ATAN( (v) / (u)) : ((v >= 0.0) ? PI / 2 : -(PI / 2))) #define XCMS_CIELUV_PMETRIC_CHROMA(u,v) XCMS_SQRT(((u)*(u)) + ((v)*(v))) #define XCMS_CIEASTAROFHUE(h,c) XCMS_CIEUSTAROFHUE((h), (c)) #define XCMS_CIEBSTAROFHUE(h,c) XCMS_CIEVSTAROFHUE((h), (c)) #define XCMS_CIELAB_PMETRIC_HUE(a,b) XCMS_CIELUV_PMETRIC_HUE((a), (b)) #define XCMS_CIELAB_PMETRIC_CHROMA(a,b) XCMS_CIELUV_PMETRIC_CHROMA((a), (b)) #endif /* _XCMSINT_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/xcms/Xcms.txt0000644000000000000000000000327313614532331015272 0ustar /* * (c) Copyright 1990 1991 Tektronix Inc. * All Rights Reserved * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and that * both that copyright notice and this permission notice appear in * supporting documentation, and that the name of Tektronix not be used * in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. * * Tektronix disclaims all warranties with regard to this software, including * all implied warranties of merchantability and fitness, in no event shall * Tektronix be liable for any special, indirect or consequential damages or * any damages whatsoever resulting from loss of use, data or profits, * whether in an action of contract, negligence or other tortious action, * arising out of or in connection with the use or performance of this * software. * * * NAME * Xcms.txt * * DESCRIPTION * Sample Color Name Database * */ This device-independent color name database is provided just as an example. There are no claims that these color specifications are or should be bound to the corresponding color name. As you can see, the start of the database is indicated by "XCMS_COLORDB_START". Anything before this is assumed to be comments. The "0.1" indicates the version number of the format/syntax used in this file. The color name is delimited from the color specification by one or more tabs. XCMS_COLORDB_START 0.1 cms red CIEXYZ:0.3811/0.2073/0.0213 cms green CIEXYZ:0.3203/0.6805/0.1430 cms blue CIEXYZ:0.2483/0.1122/1.2417 XCMS_COLORDB_END nx-libs-3.5.99.23/nx-X11/lib/src/xcms/XRGB.c0000644000000000000000000001330513614532331014522 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * NAME * XcmsRtoX.c * * DESCRIPTION * Convert color specifications in XcmsRGB format in one array of * XcmsColor structures to RGB in an array of XColor structures. * * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * LOCAL VARIABLES */ static unsigned short const MASK[17] = { 0x0000, /* 0 bitsPerRGB */ 0x8000, /* 1 bitsPerRGB */ 0xc000, /* 2 bitsPerRGB */ 0xe000, /* 3 bitsPerRGB */ 0xf000, /* 4 bitsPerRGB */ 0xf800, /* 5 bitsPerRGB */ 0xfc00, /* 6 bitsPerRGB */ 0xfe00, /* 7 bitsPerRGB */ 0xff00, /* 8 bitsPerRGB */ 0xff80, /* 9 bitsPerRGB */ 0xffc0, /* 10 bitsPerRGB */ 0xffe0, /* 11 bitsPerRGB */ 0xfff0, /* 12 bitsPerRGB */ 0xfff8, /* 13 bitsPerRGB */ 0xfffc, /* 14 bitsPerRGB */ 0xfffe, /* 15 bitsPerRGB */ 0xffff /* 16 bitsPerRGB */ }; /************************************************************************ * * * API PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * _XcmsRGB_to_XColor - * * SYNOPSIS */ void _XcmsRGB_to_XColor( XcmsColor *pColors, XColor *pXColors, unsigned int nColors) /* * DESCRIPTION * Translates a color specification in XcmsRGBFormat in a XcmsColor * structure to an XColor structure. * * RETURNS * void. */ { for (; nColors--; pXColors++, pColors++) { pXColors->pixel = pColors->pixel; pXColors->red = pColors->spec.RGB.red; pXColors->green = pColors->spec.RGB.green; pXColors->blue = pColors->spec.RGB.blue; pXColors->flags = (DoRed | DoGreen | DoBlue); } } /* * NAME * _XColor_to_XcmsRGB * * SYNOPSIS */ void _XColor_to_XcmsRGB( XcmsCCC ccc, XColor *pXColors, XcmsColor *pColors, unsigned int nColors) /* * DESCRIPTION * Translates an RGB color specification in an XColor * structure to an XcmsRGB structure. * * IMPORTANT NOTE: Bit replication that may have been caused * with ResolveColor() routine in the X Server is undone * here if requested! For example, if red = 0xcaca and the * bits_per_rgb is 8, then spec.RGB.red will be 0xca00. * * RETURNS * void */ { int bits_per_rgb = ccc->visual->bits_per_rgb; for (; nColors--; pXColors++, pColors++) { pColors->spec.RGB.red = (pXColors->red & MASK[bits_per_rgb]); pColors->spec.RGB.green = (pXColors->green & MASK[bits_per_rgb]); pColors->spec.RGB.blue = (pXColors->blue & MASK[bits_per_rgb]); pColors->format = XcmsRGBFormat; pColors->pixel = pXColors->pixel; } } /* * NAME * _XcmsResolveColor * * SYNOPSIS */ void _XcmsResolveColor( XcmsCCC ccc, XcmsColor *pXcmsColor) /* * DESCRIPTION * Uses the X Server ResolveColor() algorithm to * modify values to closest values supported by hardware. * Old algorithm simply masked low-order bits. The new algorithm * has the effect of replicating significant bits into lower order * bits in order to stretch the hardware value into all 16 bits. * * On a display with N-bit DACs, the "hardware" color is computed as: * * ((unsignedlong)(ClientValue >> (16-N)) * 0xFFFF) / ((1 << N) - 1) * * * RETURNS * void. */ { int shift; int max_color; shift = 16 - ccc->visual->bits_per_rgb; max_color = (1 << ccc->visual->bits_per_rgb) - 1; pXcmsColor->spec.RGB.red = ((unsigned long)(pXcmsColor->spec.RGB.red >> shift) * 0xFFFF) / max_color; pXcmsColor->spec.RGB.green = ((unsigned long)(pXcmsColor->spec.RGB.green >> shift) * 0xFFFF) / max_color; pXcmsColor->spec.RGB.blue = ((unsigned long)(pXcmsColor->spec.RGB.blue >> shift) * 0xFFFF) / max_color; } /* * NAME * _XcmsUnresolveColor * * SYNOPSIS */ void _XcmsUnresolveColor( XcmsCCC ccc, XcmsColor *pColor) /* * DESCRIPTION * Masks out insignificant bits. * * RETURNS * void. * * ASSUMPTIONS * format == XcmsRGBFormat */ { int bits_per_rgb = ccc->visual->bits_per_rgb; pColor->spec.RGB.red &= MASK[bits_per_rgb]; pColor->spec.RGB.green &= MASK[bits_per_rgb]; pColor->spec.RGB.blue &= MASK[bits_per_rgb]; } /* * NAME * _XUnresolveColor * * SYNOPSIS */ void _XUnresolveColor( XcmsCCC ccc, XColor *pXColor) /* * DESCRIPTION * Masks out insignificant bits. * * RETURNS * void. */ { int bits_per_rgb = ccc->visual->bits_per_rgb; pXColor->red &= MASK[bits_per_rgb]; pXColor->green &= MASK[bits_per_rgb]; pXColor->blue &= MASK[bits_per_rgb]; } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/xyY.c0000644000000000000000000002321013614532331014545 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of Xcms based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * NAME * CIExyY.c * * DESCRIPTION * This file contains routines that support the CIE xyY * color space to include conversions to and from the CIE * XYZ space. * * DOCUMENTATION * "TekColor Color Management System, System Implementor's Manual" */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" /* * DEFINES */ #define EPS 0.00001 /* some extremely small number */ #ifdef DBL_EPSILON # define XMY_DBL_EPSILON DBL_EPSILON #else # define XMY_DBL_EPSILON 0.00001 #endif /* * FORWARD DECLARATIONS */ static int CIExyY_ParseString(register char *spec, XcmsColor *pColor); static Status XcmsCIExyY_ValidSpec(XcmsColor *pColor); /* * LOCAL VARIABLES */ /* * NULL terminated list of functions applied to get from CIExyY to CIEXYZ */ static XcmsConversionProc Fl_CIExyY_to_CIEXYZ[] = { XcmsCIExyYToCIEXYZ, NULL }; /* * NULL terminated list of functions applied to get from CIEXYZ to CIExyY */ static XcmsConversionProc Fl_CIEXYZ_to_CIExyY[] = { XcmsCIEXYZToCIExyY, NULL }; /* * GLOBALS */ /* * CIE xyY Color Space */ XcmsColorSpace XcmsCIExyYColorSpace = { _XcmsCIExyY_prefix, /* prefix */ XcmsCIExyYFormat, /* id */ CIExyY_ParseString, /* parseString */ Fl_CIExyY_to_CIEXYZ, /* to_CIEXYZ */ Fl_CIEXYZ_to_CIExyY, /* from_CIEXYZ */ 1 }; /************************************************************************ * * * PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * CIExyY_ParseString * * SYNOPSIS */ static int CIExyY_ParseString( register char *spec, XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert * it into a XcmsColor structure with XcmsCIExyYFormat. * The assumed CIExyY string syntax is: * CIExyY:// * Where x, y, and Y are in string input format for floats * consisting of: * a. an optional sign * b. a string of numbers possibly containing a decimal point, * c. an optional exponent field containing an 'E' or 'e' * followed by a possibly signed integer string. * * RETURNS * 0 if failed, non-zero otherwise. */ { int n; char *pchar; if ((pchar = strchr(spec, ':')) == NULL) { return(XcmsFailure); } n = (int)(pchar - spec); /* * Check for proper prefix. */ if (strncmp(spec, _XcmsCIExyY_prefix, n) != 0) { return(XcmsFailure); } /* * Attempt to parse the value portion. */ if (sscanf(spec + n + 1, "%lf/%lf/%lf", &pColor->spec.CIExyY.x, &pColor->spec.CIExyY.y, &pColor->spec.CIExyY.Y) != 3) { char *s; /* Maybe failed due to locale */ int f; if ((s = strdup(spec))) { for (f = 0; s[f]; ++f) if (s[f] == '.') s[f] = ','; else if (s[f] == ',') s[f] = '.'; if (sscanf(s + n + 1, "%lf/%lf/%lf", &pColor->spec.CIExyY.x, &pColor->spec.CIExyY.y, &pColor->spec.CIExyY.Y) != 3) { free(s); return(XcmsFailure); } free(s); } else return(XcmsFailure); } pColor->format = XcmsCIExyYFormat; pColor->pixel = 0; return(XcmsCIExyY_ValidSpec(pColor)); } /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * CIExyY_ValidSpec() * * SYNOPSIS */ static Status XcmsCIExyY_ValidSpec( XcmsColor *pColor) /* * DESCRIPTION * Checks a valid CIExyY color specification. * * RETURNS * XcmsFailure if invalid. * XcmsSuccess if valid. * */ { if (pColor->format != XcmsCIExyYFormat || (pColor->spec.CIExyY.x < 0.0 - XMY_DBL_EPSILON) || (pColor->spec.CIExyY.x > 1.0 + XMY_DBL_EPSILON) || (pColor->spec.CIExyY.y < 0.0 - XMY_DBL_EPSILON) || (pColor->spec.CIExyY.y > 1.0 + XMY_DBL_EPSILON) || (pColor->spec.CIExyY.Y < 0.0 - XMY_DBL_EPSILON) || (pColor->spec.CIExyY.Y > 1.0 + XMY_DBL_EPSILON)) { return(XcmsFailure); } return(XcmsSuccess); } /* * NAME * XcmsCIExyYToCIEXYZ - convert CIExyY to CIEXYZ * * SYNOPSIS */ Status XcmsCIExyYToCIEXYZ( XcmsCCC ccc, XcmsColor *pxyY_WhitePt, XcmsColor *pColors_in_out, unsigned int nColors) /* * DESCRIPTION * Converts color specifications in an array of XcmsColor * structures from CIExyY format to CIEXYZ format. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded. */ { XcmsColor *pColor = pColors_in_out; XcmsColor whitePt; XcmsCIEXYZ XYZ_return; XcmsFloat div; /* temporary storage in case divisor is zero */ XcmsFloat u, v, x, y, z; /* temporary storage */ unsigned int i; /* * Check arguments */ if (pxyY_WhitePt == NULL || pColors_in_out == NULL) { return(XcmsFailure); } /* * Now convert each XcmsColor structure to CIEXYZ form */ for (i = 0; i < nColors; i++, pColor++) { /* Make sure original format is CIExyY and valid */ if (!XcmsCIExyY_ValidSpec(pColor)) { return(XcmsFailure); } if ((div = (-2 * pColor->spec.CIExyY.x) + (12 * pColor->spec.CIExyY.y) + 3) == 0.0) { /* Note that the divisor is zero */ /* This return is abitrary. */ XYZ_return.X = 0; XYZ_return.Y = 0; XYZ_return.Z = 0; } else { /* * Make sure white point is in CIEXYZ form */ if (pxyY_WhitePt->format != XcmsCIEXYZFormat) { /* Make copy of the white point because we're going to modify it */ memcpy((char *)&whitePt, (char *)pxyY_WhitePt, sizeof(XcmsColor)); if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, XcmsCIEXYZFormat)) { return(XcmsFailure); } pxyY_WhitePt = &whitePt; } /* Make sure it is a white point, i.e., Y == 1.0 */ if (pxyY_WhitePt->spec.CIEXYZ.Y != 1.0) { return(XcmsFailure); } /* Convert from xyY to uvY to XYZ */ u = (4 * pColor->spec.CIExyY.x) / div; v = (9 * pColor->spec.CIExyY.y) / div; div = (6.0 * u) - (16.0 * v) + 12.0; if (div == 0.0) { /* Note that the divisor is zero */ /* This return is abitrary. */ if ((div = (6.0 * whitePt.spec.CIEuvY.u_prime) - (16.0 * whitePt.spec.CIEuvY.v_prime) + 12.0) == 0.0) { div = EPS; } x = 9.0 * whitePt.spec.CIEuvY.u_prime / div; y = 4.0 * whitePt.spec.CIEuvY.u_prime / div; } else { /* convert u, v to small xyz */ x = 9.0 * u / div; y = 4.0 * v / div; } z = 1.0 - x - y; if (y == 0.0) y = EPS; /* Have to worry about divide by 0 */ XYZ_return.Y = pColor->spec.CIExyY.Y; XYZ_return.X = x * XYZ_return.Y / y; XYZ_return.Z = z * XYZ_return.Y / y; } /* Copy result to pColor */ memcpy ((char *)&pColor->spec, (char *)&XYZ_return, sizeof(XcmsCIEXYZ)); /* Identify that the format is now CIEXYZ */ pColor->format = XcmsCIEXYZFormat; } return(XcmsSuccess); } /* * NAME * XcmsCIEXYZToCIExyY - convert CIEXYZ to CIExyY * * SYNOPSIS */ /* ARGSUSED */ Status XcmsCIEXYZToCIExyY( XcmsCCC ccc, XcmsColor *pxyY_WhitePt, XcmsColor *pColors_in_out, unsigned int nColors) /* * DESCRIPTION * Converts color specifications in an array of XcmsColor * structures from CIEXYZ format to CIExyY format. * * RETURNS * XcmsFailure if failed, * XcmsSuccess if succeeded. * */ { XcmsColor *pColor = pColors_in_out; XcmsCIExyY xyY_return; XcmsFloat div; /* temporary storage in case divisor is zero */ unsigned int i; /* * Check arguments * pxyY_WhitePt ignored */ if (pColors_in_out == NULL) { return(XcmsFailure); } /* * Now convert each XcmsColor structure to CIEXYZ form */ for (i = 0; i < nColors; i++, pColor++) { if (!_XcmsCIEXYZ_ValidSpec(pColor)) { return(XcmsFailure); } /* Now convert for XYZ to xyY */ if ((div = pColor->spec.CIEXYZ.X + pColor->spec.CIEXYZ.Y + pColor->spec.CIEXYZ.Z) == 0.0) { div = EPS; } xyY_return.x = pColor->spec.CIEXYZ.X / div; xyY_return.y = pColor->spec.CIEXYZ.Y / div; xyY_return.Y = pColor->spec.CIEXYZ.Y; /* Copy result to pColor */ memcpy ((char *)&pColor->spec, (char *)&xyY_return, sizeof(XcmsCIExyY)); /* Identify that the format is now CIEXYZ */ pColor->format = XcmsCIExyYFormat; } return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/xcms/XYZ.c0000644000000000000000000001134413614532331014453 0ustar /* * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. * All Rights Reserved * * This file is a component of an X Window System-specific implementation * of XCMS based on the TekColor Color Management System. Permission is * hereby granted to use, copy, modify, sell, and otherwise distribute this * software and its documentation for any purpose and without fee, provided * that this copyright, permission, and disclaimer notice is reproduced in * all copies of this software and in supporting documentation. TekColor * is a trademark of Tektronix, Inc. * * Tektronix makes no representation about the suitability of this software * for any purpose. It is provided "as is" and with all faults. * * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. * * * * NAME * CIEXYZ.c * * DESCRIPTION * CIE XYZ Color Space * * */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" #include /* sscanf */ /* * DEFINES * Internal definitions that need NOT be exported to any package * or program using this package. */ #ifdef DBL_EPSILON # define XMY_DBL_EPSILON DBL_EPSILON #else # define XMY_DBL_EPSILON 0.00001 #endif /* * FORWARD DECLARATIONS */ static int CIEXYZ_ParseString(register char *spec, XcmsColor *pColor); /* * LOCALS VARIABLES */ static XcmsConversionProc Fl_CIEXYZ_to_CIEXYZ[] = { NULL }; /* * GLOBALS * Variables declared in this package that are allowed * to be used globally. */ /* * CIE XYZ Color Space */ XcmsColorSpace XcmsCIEXYZColorSpace = { _XcmsCIEXYZ_prefix, /* prefix */ XcmsCIEXYZFormat, /* id */ CIEXYZ_ParseString, /* parseString */ Fl_CIEXYZ_to_CIEXYZ, /* to_CIEXYZ */ Fl_CIEXYZ_to_CIEXYZ, /* from_CIEXYZ */ 1 }; /************************************************************************ * * * PRIVATE ROUTINES * * * ************************************************************************/ /* * NAME * CIEXYZ_ParseString * * SYNOPSIS */ static int CIEXYZ_ParseString( register char *spec, XcmsColor *pColor) /* * DESCRIPTION * This routines takes a string and attempts to convert * it into a XcmsColor structure with XcmsCIEXYZFormat. * The assumed CIEXYZ string syntax is: * CIEXYZ:// * Where X, Y, and Z are in string input format for floats * consisting of: * a. an optional sign * b. a string of numbers possibly containing a decimal point, * c. an optional exponent field containing an 'E' or 'e' * followed by a possibly signed integer string. * * RETURNS */ { size_t n; char *pchar; if ((pchar = strchr(spec, ':')) == NULL) { return(XcmsFailure); } n = (size_t)(pchar - spec); /* * Check for proper prefix. */ if (strncmp(spec, _XcmsCIEXYZ_prefix, n) != 0) { return(XcmsFailure); } /* * Attempt to parse the value portion. */ if (sscanf(spec + n + 1, "%lf/%lf/%lf", &pColor->spec.CIEXYZ.X, &pColor->spec.CIEXYZ.Y, &pColor->spec.CIEXYZ.Z) != 3) { char *s; /* Maybe failed due to locale */ int f; if ((s = strdup(spec))) { for (f = 0; s[f]; ++f) if (s[f] == '.') s[f] = ','; else if (s[f] == ',') s[f] = '.'; if (sscanf(s + n + 1, "%lf/%lf/%lf", &pColor->spec.CIEXYZ.X, &pColor->spec.CIEXYZ.Y, &pColor->spec.CIEXYZ.Z) != 3) { free(s); return(XcmsFailure); } free(s); } else return(XcmsFailure); } pColor->format = XcmsCIEXYZFormat; pColor->pixel = 0; return(_XcmsCIEXYZ_ValidSpec(pColor)); } /************************************************************************ * * * PUBLIC ROUTINES * * * ************************************************************************/ /* * NAME * XcmsCIELab_ValidSpec * * SYNOPSIS */ Status _XcmsCIEXYZ_ValidSpec( XcmsColor *pColor) /* * DESCRIPTION * Checks if color specification valid for CIE XYZ * * RETURNS * XcmsFailure if invalid, * XcmsSuccess if valid. * */ { if (pColor->format != XcmsCIEXYZFormat || (pColor->spec.CIEXYZ.Y < 0.0 - XMY_DBL_EPSILON) || (pColor->spec.CIEXYZ.Y > 1.0 + XMY_DBL_EPSILON)) { return(XcmsFailure); } return(XcmsSuccess); } nx-libs-3.5.99.23/nx-X11/lib/src/XErrorDB0000644000000000000000000012213513614532331014216 0ustar ! ! Copyright 1993, 1995, 1998 The Open Group ! Permission to use, copy, modify, distribute, and sell this software and its ! documentation for any purpose is hereby granted without fee, provided that ! the above copyright notice appear in all copies and that both that ! copyright notice and this permission notice appear in supporting ! documentation. ! ! The above copyright notice and this permission notice shall be ! included in all copies or substantial portions of the Software. ! ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ! MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ! IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR ! OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ! ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ! OTHER DEALINGS IN THE SOFTWARE. ! ! Except as contained in this notice, the name of The Open Group shall ! not be used in advertising or otherwise to promote the sale, use or ! other dealings in this Software without prior written authorization ! from The Open Group. ! ! ! these are used in XGetErrorMessage. XlibMessage.XError: X Error of failed request XlibMessage.MajorCode: Major opcode of failed request: %d XlibMessage.MinorCode: Minor opcode of failed request: %d XlibMessage.ResourceID: Resource id in failed request: 0x%lx XlibMessage.Value: Value in failed request: 0x%lx XlibMessage.AtomID: Atom id in failed request: 0x%lx XlibMessage.ErrorSerial: Serial number of failed request: %lu XlibMessage.CurrentSerial: Current serial number in output stream: %lu ! X request codes. XRequest.1:X_CreateWindow XRequest.2:X_ChangeWindowAttributes XRequest.3:X_GetWindowAttributes XRequest.4:X_DestroyWindow XRequest.5:X_DestroySubwindows XRequest.6:X_ChangeSaveSet XRequest.7:X_ReparentWindow XRequest.8:X_MapWindow XRequest.9:X_MapSubwindows XRequest.10:X_UnmapWindow XRequest.11:X_UnmapSubwindows XRequest.12:X_ConfigureWindow XRequest.13:X_CirculateWindow XRequest.14:X_GetGeometry XRequest.15:X_QueryTree XRequest.16:X_InternAtom XRequest.17:X_GetAtomName XRequest.18:X_ChangeProperty XRequest.19:X_DeleteProperty XRequest.20:X_GetProperty XRequest.21:X_ListProperties XRequest.22:X_SetSelectionOwner XRequest.23:X_GetSelectionOwner XRequest.24:X_ConvertSelection XRequest.25:X_SendEvent XRequest.26:X_GrabPointer XRequest.27:X_UngrabPointer XRequest.28:X_GrabButton XRequest.29:X_UngrabButton XRequest.30:X_ChangeActivePointerGrab XRequest.31:X_GrabKeyboard XRequest.32:X_UngrabKeyboard XRequest.33:X_GrabKey XRequest.34:X_UngrabKey XRequest.35:X_AllowEvents XRequest.36:X_GrabServer XRequest.37:X_UngrabServer XRequest.38:X_QueryPointer XRequest.39:X_GetMotionEvents XRequest.40:X_TranslateCoords XRequest.41:X_WarpPointer XRequest.42:X_SetInputFocus XRequest.43:X_GetInputFocus XRequest.44:X_QueryKeymap XRequest.45:X_OpenFont XRequest.46:X_CloseFont XRequest.47:X_QueryFont XRequest.48:X_QueryTextExtents XRequest.49:X_ListFonts XRequest.50:X_ListFontsWithInfo XRequest.51:X_SetFontPath XRequest.52:X_GetFontPath XRequest.53:X_CreatePixmap XRequest.54:X_FreePixmap XRequest.55:X_CreateGC XRequest.56:X_ChangeGC XRequest.57:X_CopyGC XRequest.58:X_SetDashes XRequest.59:X_SetClipRectangles XRequest.60:X_FreeGC XRequest.61:X_ClearArea XRequest.62:X_CopyArea XRequest.63:X_CopyPlane XRequest.64:X_PolyPoint XRequest.65:X_PolyLine XRequest.66:X_PolySegment XRequest.67:X_PolyRectangle XRequest.68:X_PolyArc XRequest.69:X_FillPoly XRequest.70:X_PolyFillRectangle XRequest.71:X_PolyFillArc XRequest.72:X_PutImage XRequest.73:X_GetImage XRequest.74:X_PolyText8 XRequest.75:X_PolyText16 XRequest.76:X_ImageText8 XRequest.77:X_ImageText16 XRequest.78:X_CreateColormap XRequest.79:X_FreeColormap XRequest.80:X_CopyColormapAndFree XRequest.81:X_InstallColormap XRequest.82:X_UninstallColormap XRequest.83:X_ListInstalledColormaps XRequest.84:X_AllocColor XRequest.85:X_AllocNamedColor XRequest.86:X_AllocColorCells XRequest.87:X_AllocColorPlanes XRequest.88:X_FreeColors XRequest.89:X_StoreColors XRequest.90:X_StoreNamedColor XRequest.91:X_QueryColors XRequest.92:X_LookupColor XRequest.93:X_CreateCursor XRequest.94:X_CreateGlyphCursor XRequest.95:X_FreeCursor XRequest.96:X_RecolorCursor XRequest.97:X_QueryBestSize XRequest.98:X_QueryExtension XRequest.99:X_ListExtensions XRequest.100:X_ChangeKeyboardMapping XRequest.101:X_GetKeyboardMapping XRequest.102:X_ChangeKeyboardControl XRequest.103:X_GetKeyboardControl XRequest.104:X_Bell XRequest.105:X_ChangePointerControl XRequest.106:X_GetPointerControl XRequest.107:X_SetScreenSaver XRequest.108:X_GetScreenSaver XRequest.109:X_ChangeHosts XRequest.110:X_ListHosts XRequest.111:X_SetAccessControl XRequest.112:X_SetCloseDownMode XRequest.113:X_KillClient XRequest.114:X_RotateProperties XRequest.115:X_ForceScreenSaver XRequest.116:X_SetPointerMapping XRequest.117:X_GetPointerMapping XRequest.118:X_SetModifierMapping XRequest.119:X_GetModifierMapping XRequest.127:X_NoOperation ! X Error Codes XProtoError.0: unknown error code 0 XProtoError.1: BadRequest (invalid request code or no such operation) XProtoError.2: BadValue (integer parameter out of range for operation) XProtoError.3: BadWindow (invalid Window parameter) XProtoError.4: BadPixmap (invalid Pixmap parameter) XProtoError.5: BadAtom (invalid Atom parameter) XProtoError.6: BadCursor (invalid Cursor parameter) XProtoError.7: BadFont (invalid Font parameter) XProtoError.8: BadMatch (invalid parameter attributes) XProtoError.9: BadDrawable (invalid Pixmap or Window parameter) XProtoError.10: BadAccess (attempt to access private resource denied) XProtoError.11: BadAlloc (insufficient resources for operation) XProtoError.12: BadColor (invalid Colormap parameter) XProtoError.13: BadGC (invalid GC parameter) XProtoError.14: BadIDChoice (invalid resource ID chosen for this connection) XProtoError.15: BadName (named color or font does not exist) XProtoError.16: BadLength (poly request too large or internal Xlib length error) XProtoError.17: BadImplementation (server does not implement operation) ! Multi-Buffering extension, not an X Consortium standard XRequest.Multi-Buffering.0: X_MbufGetBufferVersion XRequest.Multi-Buffering.1: X_MbufCreateImageBuffers XRequest.Multi-Buffering.2: X_MbufDestroyImageBuffers XRequest.Multi-Buffering.3: X_MbufDisplayImageBuffers XRequest.Multi-Buffering.4: X_MbufSetMultiBufferAttributes XRequest.Multi-Buffering.5: X_MbufGetMultiBufferAttributes XRequest.Multi-Buffering.6: X_MbufSetBufferAttributes XRequest.Multi-Buffering.7: X_MbufGetBufferAttributes XRequest.Multi-Buffering.8: X_MbufGetBufferInfo XRequest.Multi-Buffering.9: X_MbufCreateStereoWindow XProtoError.Multi-Buffering.0: BadBuffer (invalid Buffer parameter) XlibMessage.Multi-Buffering.0: Buffer id in failed request: 0x%lx ! SHAPE extension, an X Consortium standard XRequest.SHAPE.0: X_ShapeQueryVersion XRequest.SHAPE.1: X_ShapeRectangles XRequest.SHAPE.2: X_ShapeMask XRequest.SHAPE.3: X_ShapeCombine XRequest.SHAPE.4: X_ShapeOffset XRequest.SHAPE.5: X_ShapeQueryExtents XRequest.SHAPE.6: X_ShapeSelectInput XRequest.SHAPE.7: X_ShapeInputSelected XRequest.SHAPE.8: X_ShapeGetRectangles ! Input extension, an X Consortium standard XRequest.XInputExtension.1:X_GetExtensionVersion XRequest.XInputExtension.2:X_ListInputDevices XRequest.XInputExtension.3:X_OpenDevice XRequest.XInputExtension.4:X_CloseDevice XRequest.XInputExtension.5:X_SetDeviceMode XRequest.XInputExtension.6:X_SelectExtensionEvent XRequest.XInputExtension.7:X_GetSelectedExtensionEvents XRequest.XInputExtension.8:X_ChangeDeviceDontPropagateList XRequest.XInputExtension.9:X_GetDeviceDontPropagateList XRequest.XInputExtension.10:X_GetDeviceMotionEvents XRequest.XInputExtension.11:X_ChangeKeyboardDevice XRequest.XInputExtension.12:X_ChangePointerDevice XRequest.XInputExtension.13:X_GrabDevice XRequest.XInputExtension.14:X_UngrabDevice XRequest.XInputExtension.15:X_GrabDeviceKey XRequest.XInputExtension.16:X_UngrabDeviceKey XRequest.XInputExtension.17:X_GrabDeviceButton XRequest.XInputExtension.18:X_UngrabDeviceButton XRequest.XInputExtension.19:X_AllowDeviceEvents XRequest.XInputExtension.20:X_GetDeviceFocus XRequest.XInputExtension.21:X_SetDeviceFocus XRequest.XInputExtension.22:X_GetFeedbackControl XRequest.XInputExtension.23:X_ChangeFeedbackControl XRequest.XInputExtension.24:X_GetDeviceKeyMapping XRequest.XInputExtension.25:X_ChangeDeviceKeyMapping XRequest.XInputExtension.26:X_GetDeviceModifierMapping XRequest.XInputExtension.27:X_SetDeviceModifierMapping XRequest.XInputExtension.28:X_GetDeviceButtonMapping XRequest.XInputExtension.29:X_SetDeviceButtonMapping XRequest.XInputExtension.30:X_QueryDeviceState XRequest.XInputExtension.31:X_SendExtensionEvent XRequest.XInputExtension.32:X_DeviceBell XRequest.XInputExtension.33:X_SetDeviceValuators XRequest.XInputExtension.34:X_GetDeviceControl XRequest.XInputExtension.35:X_ChangeDeviceControl XRequest.XInputExtension.36: X_ListDeviceProperties XRequest.XInputExtension.37: X_ChangeDeviceProperty XRequest.XInputExtension.38: X_DeleteDeviceProperty XRequest.XInputExtension.39: X_GetDeviceProperty XProtoError.XInputExtension.0: XI_BadDevice (invalid Device parameter) XlibMessage.XInputExtension.0: Device id in failed request: 0x%lx XProtoError.XInputExtension.1: XI_BadEvent (invalid Event parameter) XlibMessage.XInputExtension.1: Event id in failed request: 0x%lx XProtoError.XInputExtension.2: XI_BadMode (invalid Mode parameter) XlibMessage.XInputExtension.2: Mode id in failed request: 0x%lx XProtoError.XInputExtension.3: XI_DeviceBusy XlibMessage.XInputExtension.3: Device id in failed request: 0x%lx XProtoError.XInputExtension.4: XI_BadClass (invalid Class parameter) XlibMessage.XInputExtension.4: Class id in failed request: 0x%lx ! MIT-SHM extension, experimental, not an X Consortium standard XRequest.MIT-SHM.0: X_ShmQueryVersion XRequest.MIT-SHM.1: X_ShmAttach XRequest.MIT-SHM.2: X_ShmDetach XRequest.MIT-SHM.3: X_ShmPutImage XRequest.MIT-SHM.4: X_ShmGetImage XRequest.MIT-SHM.5: X_ShmCreatePixmap XProtoError.MIT-SHM.0: BadShmSeg (invalid shared segment parameter) XlibMessage.MIT-SHM.0: Segment id in failed request: 0x%lx ! MIT-SUNDRY-NONSTANDARD extension, definitely not an X Consortium standard XRequest.MIT-SUNDRY-NONSTANDARD.0: X_MITSetBugMode XRequest.MIT-SUNDRY-NONSTANDARD.1: X_MITGetBugMode ! X3D-PEX extension XRequest.X3D-PEX.1: PEX_GetExtensionInfo XRequest.X3D-PEX.2: PEX_GetEnumeratedTypeInfo XRequest.X3D-PEX.3: PEX_GetImpDepConstants XRequest.X3D-PEX.4: PEX_CreateLookupTable XRequest.X3D-PEX.5: PEX_CopyLookupTable XRequest.X3D-PEX.6: PEX_FreeLookupTable XRequest.X3D-PEX.7: PEX_GetTableInfo XRequest.X3D-PEX.8: PEX_GetPredefinedEntries XRequest.X3D-PEX.9: PEX_GetDefinedIndices XRequest.X3D-PEX.10: PEX_GetTableEntry XRequest.X3D-PEX.11: PEX_GetTableEntries XRequest.X3D-PEX.12: PEX_SetTableEntries XRequest.X3D-PEX.13: PEX_DeleteTableEntries XRequest.X3D-PEX.14: PEX_CreatePipelineContext XRequest.X3D-PEX.15: PEX_CopyPipelineContext XRequest.X3D-PEX.16: PEX_FreePipelineContext XRequest.X3D-PEX.17: PEX_GetPipelineContext XRequest.X3D-PEX.18: PEX_ChangePipelineContext XRequest.X3D-PEX.19: PEX_CreateRenderer XRequest.X3D-PEX.20: PEX_FreeRenderer XRequest.X3D-PEX.21: PEX_ChangeRenderer XRequest.X3D-PEX.22: PEX_GetRendererAttributes XRequest.X3D-PEX.23: PEX_GetRendererDynamics XRequest.X3D-PEX.24: PEX_BeginRendering XRequest.X3D-PEX.25: PEX_EndRendering XRequest.X3D-PEX.26: PEX_BeginStructure XRequest.X3D-PEX.27: PEX_EndStructure XRequest.X3D-PEX.28: PEX_RenderOutputCommands XRequest.X3D-PEX.29: PEX_RenderNetwork XRequest.X3D-PEX.30: PEX_CreateStructure XRequest.X3D-PEX.31: PEX_CopyStructure XRequest.X3D-PEX.32: PEX_DestroyStructures XRequest.X3D-PEX.33: PEX_GetStructureInfo XRequest.X3D-PEX.34: PEX_GetElementInfo XRequest.X3D-PEX.35: PEX_GetStructuresInNetwork XRequest.X3D-PEX.36: PEX_GetAncestors XRequest.X3D-PEX.37: PEX_GetDescendants XRequest.X3D-PEX.38: PEX_FetchElements XRequest.X3D-PEX.39: PEX_SetEditingMode XRequest.X3D-PEX.40: PEX_SetElementPointer XRequest.X3D-PEX.41: PEX_SetElementPointerAtLabel XRequest.X3D-PEX.42: PEX_ElementSearch XRequest.X3D-PEX.43: PEX_StoreElements XRequest.X3D-PEX.44: PEX_DeleteElements XRequest.X3D-PEX.45: PEX_DeleteElementsToLabel XRequest.X3D-PEX.46: PEX_DeleteBetweenLabels XRequest.X3D-PEX.47: PEX_CopyElements XRequest.X3D-PEX.48: PEX_ChangeStructureRefs XRequest.X3D-PEX.49: PEX_CreateNameSet XRequest.X3D-PEX.50: PEX_CopyNameSet XRequest.X3D-PEX.51: PEX_FreeNameSet XRequest.X3D-PEX.52: PEX_GetNameSet XRequest.X3D-PEX.53: PEX_ChangeNameSet XRequest.X3D-PEX.54: PEX_CreateSearchContext XRequest.X3D-PEX.55: PEX_CopySearchContext XRequest.X3D-PEX.56: PEX_FreeSearchContext XRequest.X3D-PEX.57: PEX_GetSearchContext XRequest.X3D-PEX.58: PEX_ChangeSearchContext XRequest.X3D-PEX.59: PEX_SearchNetwork XRequest.X3D-PEX.60: PEX_CreatePhigsWks XRequest.X3D-PEX.61: PEX_FreePhigsWks XRequest.X3D-PEX.62: PEX_GetWksInfo XRequest.X3D-PEX.63: PEX_GetDynamics XRequest.X3D-PEX.64: PEX_GetViewRep XRequest.X3D-PEX.65: PEX_RedrawAllStructures XRequest.X3D-PEX.66: PEX_UpdateWorkstation XRequest.X3D-PEX.67: PEX_RedrawClipRegion XRequest.X3D-PEX.68: PEX_ExecuteDeferredActions XRequest.X3D-PEX.69: PEX_SetViewPriority XRequest.X3D-PEX.70: PEX_SetDisplayUpdateMode XRequest.X3D-PEX.71: PEX_MapDCtoWC XRequest.X3D-PEX.72: PEX_MapWCtoDC XRequest.X3D-PEX.73: PEX_SetViewRep XRequest.X3D-PEX.74: PEX_SetWksWindow XRequest.X3D-PEX.75: PEX_SetWksViewport XRequest.X3D-PEX.76: PEX_SetHlhsrMode XRequest.X3D-PEX.77: PEX_SetWksBufferMode XRequest.X3D-PEX.78: PEX_PostStructure XRequest.X3D-PEX.79: PEX_UnpostStructure XRequest.X3D-PEX.80: PEX_UnpostAllStructures XRequest.X3D-PEX.81: PEX_GetWksPostings XRequest.X3D-PEX.82: PEX_GetPickDevice XRequest.X3D-PEX.83: PEX_ChangePickDevice XRequest.X3D-PEX.84: PEX_CreatePickMeasure XRequest.X3D-PEX.85: PEX_FreePickMeasure XRequest.X3D-PEX.86: PEX_GetPickMeasure XRequest.X3D-PEX.87: PEX_UpdatePickMeasure XRequest.X3D-PEX.88: PEX_OpenFont XRequest.X3D-PEX.89: PEX_CloseFont XRequest.X3D-PEX.90: PEX_QueryFont XRequest.X3D-PEX.91: PEX_ListFonts XRequest.X3D-PEX.92: PEX_ListFontsWithInfo XRequest.X3D-PEX.93: PEX_QueryTextExtents XRequest.X3D-PEX.94: PEX_MatchRenderingTargets XRequest.X3D-PEX.95: PEX_Escape XRequest.X3D-PEX.96: PEX_EscapeWithReply XRequest.X3D-PEX.97: PEX_RenderElements XRequest.X3D-PEX.98: PEX_AccumulateState XRequest.X3D-PEX.99: PEX_BeginPickOne XRequest.X3D-PEX.100: PEX_EndPickOne XRequest.X3D-PEX.101: PEX_PickOne XRequest.X3D-PEX.102: PEX_BeginPickAll XRequest.X3D-PEX.103: PEX_EndPickAll XRequest.X3D-PEX.104: PEX_PickAll XProtoError.X3D-PEX.0: PEXColorTypeError XlibMessage.X3D-PEX.0: Color type in failed request: 0x%lx XProtoError.X3D-PEX.1: PEXRendererStateError XlibMessage.X3D-PEX.1: Renderer id in failed request: 0x%lx XProtoError.X3D-PEX.2: PEXFloatingPointFormatError XlibMessage.X3D-PEX.2: Format in failed request: 0x%lx XProtoError.X3D-PEX.3: PEXLabelError XlibMessage.X3D-PEX.3: Label in failed request: 0x%lx XProtoError.X3D-PEX.4: PEXLookupTableError XlibMessage.X3D-PEX.4: Table id in failed request: 0x%lx XProtoError.X3D-PEX.5: PEXNameSetError XlibMessage.X3D-PEX.5: Nameset in failed request: 0x%lx XProtoError.X3D-PEX.6: PEXPathError XlibMessage.X3D-PEX.6: Path id in failed request: 0x%lx XProtoError.X3D-PEX.7: PEXFontError XlibMessage.X3D-PEX.7: Font id in failed request: 0x%lx XProtoError.X3D-PEX.8: PEXPhigsWksError XlibMessage.X3D-PEX.8: Workstation id in failed request: 0x%lx XProtoError.X3D-PEX.9: PEXPickMeasureError XlibMessage.X3D-PEX.9: Device id in failed request: 0x%lx XProtoError.X3D-PEX.10: PEXPipelineContextError XlibMessage.X3D-PEX.10: Context id in failed request: 0x%lx XProtoError.X3D-PEX.11: PEXRendererError XlibMessage.X3D-PEX.11: Renderer id in failed request: 0x%lx XProtoError.X3D-PEX.12: PEXSearchContextError XlibMessage.X3D-PEX.12: Context id in failed request: 0x%lx XProtoError.X3D-PEX.13: PEXStructureError XlibMessage.X3D-PEX.13: Structure id in failed request: 0x%lx XProtoError.X3D-PEX.14: PEXOutputCommandError XlibMessage.X3D-PEX.14: Resource id in failed request: 0x%lx ! XTEST extension, an X Consortium standard XRequest.XTEST.0: X_XTestGetVersion XRequest.XTEST.1: X_XTestCompareCursor XRequest.XTEST.2: X_XTestFakeInput XRequest.XTEST.3: X_XTestGrabControl ! BIG-REQUESTS extension, an X Consortium standard XRequest.BIG-REQUESTS.0: X_BigReqEnable ! XIE extension, an X Consortium standard XRequest.XIE.1: XIE_QueryImageExtension XRequest.XIE.2: XIE_QueryTechniques XRequest.XIE.3: XIE_CreateColorList XRequest.XIE.4: XIE_DestroyColorList XRequest.XIE.5: XIE_PurgeColorList XRequest.XIE.6: XIE_QueryColorList XRequest.XIE.7: XIE_CreateLUT XRequest.XIE.8: XIE_DestroyLUT XRequest.XIE.9: XIE_CreatePhotomap XRequest.XIE.10: XIE_DestroyPhotomap XRequest.XIE.11: XIE_QueryPhotomap XRequest.XIE.12: XIE_CreateROI XRequest.XIE.13: XIE_DestroyROI XRequest.XIE.14: XIE_CreatePhotospace XRequest.XIE.15: XIE_DestroyPhotospace XRequest.XIE.16: XIE_ExecuteImmediate XRequest.XIE.17: XIE_CreatePhotoflo XRequest.XIE.18: XIE_DestroyPhotoflo XRequest.XIE.19: XIE_ExecutePhotoflo XRequest.XIE.20: XIE_ModifyPhotoflo XRequest.XIE.21: XIE_RedefinePhotoflo XRequest.XIE.22: XIE_PutClientData XRequest.XIE.23: XIE_GetClientData XRequest.XIE.24: XIE_QueryPhotoflo XRequest.XIE.25: XIE_Await XRequest.XIE.26: XIE_Abort XProtoError.XIE.0: XIE_ColorListError XlibMessage.XIE.0: ColorList in failed request: 0x%lx XProtoError.XIE.1: XIE_LUTError XlibMessage.XIE.1: LUT in failed request: 0x%lx XProtoError.XIE.2: XIE_PhotofloError XlibMessage.XIE.2: Photoflo in failed request: 0x%lx XProtoError.XIE.3: XIE_PhotomapError XlibMessage.XIE.3: Photomap in failed request: 0x%lx XProtoError.XIE.4: XIE_PhotospaceError XlibMessage.XIE.4: Photospace in failed request: 0x%lx XProtoError.XIE.5: XIE_ROIError XlibMessage.XIE.5: ROI in failed request: 0x%lx XProtoError.XIE.6: XIE_FloError XlibMessage.XIE.6: Photoflo in failed request: 0x%lx ! SYNC extension, an X Consortium standard XRequest.SYNC.0: X_SyncInitialize XRequest.SYNC.1: X_SyncListSystemCounters XRequest.SYNC.2: X_SyncCreateCounter XRequest.SYNC.3: X_SyncSetCounter XRequest.SYNC.4: X_SyncChangeCounter XRequest.SYNC.5: X_SyncQueryCounter XRequest.SYNC.6: X_SyncDestroyCounter XRequest.SYNC.7: X_SyncAwait XRequest.SYNC.8: X_SyncCreateAlarm XRequest.SYNC.9: X_SyncChangeAlarm XRequest.SYNC.10: X_SyncQueryAlarm XRequest.SYNC.11: X_SyncDestroyAlarm XRequest.SYNC.12: X_SyncSetPriority XRequest.SYNC.13: X_SyncGetPriority XProtoError.SYNC.0: XSyncBadCounter XlibMessage.SYNC.0: Counter in failed request: 0x%lx XProtoError.SYNC.1: XSyncBadAlarm XlibMessage.SYNC.1: Alarm in failed request: 0x%lx ! XKB extension XRequest.XKEYBOARD.0: XkbUseExtension XRequest.XKEYBOARD.1: XkbSelectEvents XRequest.XKEYBOARD.2: OBSOLETE XRequest.XKEYBOARD.3: XkbBell XRequest.XKEYBOARD.4: XkbGetState XRequest.XKEYBOARD.5: XkbLatchLockState XRequest.XKEYBOARD.6: XkbGetControls XRequest.XKEYBOARD.7: XkbSetControls XRequest.XKEYBOARD.8: XkbGetMap XRequest.XKEYBOARD.9: XkbSetMap XRequest.XKEYBOARD.10: XkbGetCompatMap XRequest.XKEYBOARD.11: XkbSetCompatMap XRequest.XKEYBOARD.12: XkbGetIndicatorState XRequest.XKEYBOARD.13: XkbGetIndicatorMap XRequest.XKEYBOARD.14: XkbSetIndicatorMap XRequest.XKEYBOARD.15: XkbGetNamedIndicator XRequest.XKEYBOARD.16: XkbSetNamedIndicator XRequest.XKEYBOARD.17: XkbGetNames XRequest.XKEYBOARD.18: XkbSetNames XRequest.XKEYBOARD.19: XkbGetGeometry XRequest.XKEYBOARD.20: XkbSetGeometry XRequest.XKEYBOARD.21: XkbPerClientFlags XRequest.XKEYBOARD.22: XkbListComponents XRequest.XKEYBOARD.23: XkbGetKbdByName XRequest.XKEYBOARD.24: XkbGetDeviceInfo XRequest.XKEYBOARD.25: XkbSetDeviceInfo XRequest.XKEYBOARD.101: XkbSetDebuggingFlags XProtoError.XKEYBOARD.0: XkbBadKeyboard XlibMessage.XKEYBOARD.0: Device id in failed request: 0x%lx ! GLX extension for OpenGL, an OpenGL Architectural Review Board standard ! GLX Commands XRequest.GLX.7: X_GLXQueryVersion XRequest.GLX.3: X_GLXCreateContext XRequest.GLX.4: X_GLXDestroyContext XRequest.GLX.5: X_GLXMakeCurrent XRequest.GLX.6: X_GLXIsDirect XRequest.GLX.10: X_GLXCopyContext XRequest.GLX.8: X_GLXWaitGL XRequest.GLX.9: X_GLXWaitX XRequest.GLX.11: X_GLXSwapBuffers XRequest.GLX.12: X_GLXUseXFont XRequest.GLX.13: X_GLXCreateGLXPixmap XRequest.GLX.15: X_GLXDestroyGLXPixmap XRequest.GLX.14: X_GLXGetVisualConfigs XRequest.GLX.16: X_GLXVendorPrivate XRequest.GLX.17: X_GLXVendorPrivateWithReply XRequest.GLX.18: X_GLXQueryExtensionsString XRequest.GLX.19: X_GLXQueryServerString XRequest.GLX.20: X_GLXClientInfo XRequest.GLX.21: X_GLXGetFBConfigs XRequest.GLX.22: X_GLXCreatePixmap XRequest.GLX.23: X_GLXDestroyPixmap XRequest.GLX.24: X_GLXCreateNewContext XRequest.GLX.25: X_GLXQueryContext XRequest.GLX.26: X_GLXMakeContextCurrent XRequest.GLX.27: X_GLXCreatePbuffer XRequest.GLX.28: X_GLXDestroyPbuffer XRequest.GLX.29: X_GLXGetDrawableAttributes XRequest.GLX.30: X_GLXChangeDrawableAttributes XRequest.GLX.31: X_GLXCreateWindow XRequest.GLX.32: X_GLXDestroyWindow ! GL Non-rendering Commands XRequest.GLX.103: X_GLXDeleteLists XRequest.GLX.102: X_GLXEndList XRequest.GLX.105: X_GLXFeedbackBuffer XRequest.GLX.108: X_GLXFinish XRequest.GLX.142: X_GLXFlush XRequest.GLX.104: X_GLXGenLists XRequest.GLX.112: X_GLXGetBooleanv XRequest.GLX.113: X_GLXGetClipPlane XRequest.GLX.114: X_GLXGetDoublev XRequest.GLX.115: X_GLXGetError XRequest.GLX.116: X_GLXGetFloatv XRequest.GLX.117: X_GLXGetIntegerv XRequest.GLX.118: X_GLXGetLightfv XRequest.GLX.119: X_GLXGetLightiv XRequest.GLX.120: X_GLXGetMapdv XRequest.GLX.121: X_GLXGetMapfv XRequest.GLX.122: X_GLXGetMapiv XRequest.GLX.123: X_GLXGetMaterialfv XRequest.GLX.124: X_GLXGetMaterialiv XRequest.GLX.125: X_GLXGetPixelfv XRequest.GLX.126: X_GLXGetPixelMapuiv XRequest.GLX.127: X_GLXGetPixelMapusv XRequest.GLX.129: X_GLXGetString XRequest.GLX.130: X_GLXGetTexEnvfv XRequest.GLX.131: X_GLXGetTexEnviv XRequest.GLX.132: X_GLXGetTexGendv XRequest.GLX.133: X_GLXGetTexGenfv XRequest.GLX.134: X_GLXGetTexGeniv XRequest.GLX.138: X_GLXGetTexLevelParameterfv XRequest.GLX.139: X_GLXGetTexLevelParameteriv XRequest.GLX.136: X_GLXGetTexParameterfv XRequest.GLX.137: X_GLXGetTexParameteriv XRequest.GLX.140: X_GLXIsEnabled XRequest.GLX.141: X_GLXIsList XRequest.GLX.101: X_GLXNewList XRequest.GLX.109: X_GLXPixelStoref XRequest.GLX.110: X_GLXPixelStorei XRequest.GLX.107: X_GLXRenderMode XRequest.GLX.106: X_GLXSelectBuffer ! GL Non-rendering Commands That Return Pixel Data XRequest.GLX.128: X_GLXGetPolygonStipple XRequest.GLX.135: X_GLXGetTexImage XRequest.GLX.111: X_GLXReadPixels ! GL Rendering Commands XRequest.GLX.1: X_GLXRender XRequest.GLX.2: X_GLXRenderLarge ! GLX Errors XProtoError.GLX.0: GLXBadContext XProtoError.GLX.1: GLXBadContextState XProtoError.GLX.2: GLXBadDrawable XProtoError.GLX.3: GLXBadPixmap XProtoError.GLX.4: GLXBadContextTag XProtoError.GLX.5: GLXBadCurrentWindow XProtoError.GLX.6: GLXBadRenderRequest XProtoError.GLX.7: GLXBadLargeRequest XProtoError.GLX.8: GLXUnsupportedPrivateRequest XProtoError.GLX.9: GLXBadFBConfig XProtoError.GLX.10: GLXBadPbuffer XProtoError.GLX.11: GLXBadCurrentDrawable XProtoError.GLX.12: GLXBadWindow XProtoError.GLX.13: GLXBadProfileARB ! XC-MISC extension, an X Consortium standard XRequest.XC-MISC.0: XCMiscGetVersion XRequest.XC-MISC.1: XCMiscGetXIDRange ! RECORD extension XRequest.RECORD.0: XRecordQueryVersion XRequest.RECORD.1: XRecordCreateContext XRequest.RECORD.2: XRecordRegisterClients XRequest.RECORD.3: XRecordUnregisterClients XRequest.RECORD.4: XRecordGetContext XRequest.RECORD.5: XRecordEnableContext XRequest.RECORD.6: XRecordDisableContext XRequest.RECORD.7: XRecordFreeContext XProtoError.RECORD.0: XRecordBadContext XlibMessage.RECORD.0: Context in failed request: 0x%lx ! XFree86-VidModeExtension -- not an X Consortium standard XRequest.XFree86-VidModeExtension.0: XF86VidModeQueryVersion XRequest.XFree86-VidModeExtension.1: XF86VidModeGetModeLine XRequest.XFree86-VidModeExtension.2: XF86VidModeModModeLine XRequest.XFree86-VidModeExtension.3: XF86VidModeSwitchMode XRequest.XFree86-VidModeExtension.4: XF86VidModeGetMonitor XRequest.XFree86-VidModeExtension.5: XF86VidModeLockModeSwitch XRequest.XFree86-VidModeExtension.6: XF86VidModeGetAllModeLines XRequest.XFree86-VidModeExtension.7: XF86VidModeAddModeLine XRequest.XFree86-VidModeExtension.8: XF86VidModeDeleteModeLine XRequest.XFree86-VidModeExtension.9: XF86VidModeValidateModeLine XRequest.XFree86-VidModeExtension.10: XF86VidModeSwitchToMode XRequest.XFree86-VidModeExtension.11: XF86VidModeGetViewPort XRequest.XFree86-VidModeExtension.12: XF86VidModeSetViewPort XRequest.XFree86-VidModeExtension.13: XF86VidModeGetDotClocks XRequest.XFree86-VidModeExtension.14: XF86VidModeSetClientVersion XRequest.XFree86-VidModeExtension.15: XF86VidModeSetGamma XRequest.XFree86-VidModeExtension.16: XF86VidModeGetGamma XRequest.XFree86-VidModeExtension.17: XF86VidModeGetGammaRamp XRequest.XFree86-VidModeExtension.18: XF86VidModeSetGammaRamp XRequest.XFree86-VidModeExtension.19: XF86VidModeGetGammaRampSize XRequest.XFree86-VidModeExtension.20: XF86VidModeGetPermissions XProtoError.XFree86-VidModeExtension.0: XF86VidModeBadClock XProtoError.XFree86-VidModeExtension.1: XF86VidModeBadHTimings XProtoError.XFree86-VidModeExtension.2: XF86VidModeBadVTimings XProtoError.XFree86-VidModeExtension.3: XF86VidModeModeUnsuitable XProtoError.XFree86-VidModeExtension.4: XF86VidModeExtensionDisabled XProtoError.XFree86-VidModeExtension.5: XF86VidModeClientNotLocal XProtoError.XFree86-VidModeExtension.6: XF86VidModeZoomLocked ! XFree86-Misc -- not an X Consortium standard XRequest.XFree86-Misc.0: XF86MiscQueryVersion XRequest.XFree86-Misc.1: XF86MiscGetSaver XRequest.XFree86-Misc.2: XF86MiscSetSaver XRequest.XFree86-Misc.3: XF86MiscGetMouseSettings XRequest.XFree86-Misc.4: XF86MiscGetKbdSettings XRequest.XFree86-Misc.5: XF86MiscSetMouseSettings XRequest.XFree86-Misc.6: XF86MiscSetKbdSettings XRequest.XFree86-Misc.7: XF86MiscSetGrabKeysState XRequest.XFree86-Misc.8: XF86MiscSetClientVersion XRequest.XFree86-Misc.9: XF86MiscGetFilePaths XProtoError.XFree86-Misc.0: XF86MiscBadMouseProtocol XProtoError.XFree86-Misc.1: XF86MiscBadMouseBaudRate XProtoError.XFree86-Misc.2: XF86MiscBadMouseFlags XProtoError.XFree86-Misc.3: XF86MiscBadMouseCombo XProtoError.XFree86-Misc.4: XF86MiscBadKbdType XProtoError.XFree86-Misc.5: XF86MiscModInDevDisabled XProtoError.XFree86-Misc.6: XF86MiscModInDevClientNotLocal XProtoError.XFree86-Misc.7: XF86MiscNoModule ! XFree86-DGA -- not an X Consortium standard XRequest.XFree86-DGA.0: XF86DGAQueryVersion XRequest.XFree86-DGA.1: XF86DGAGetVideoLL XRequest.XFree86-DGA.2: XF86DGADirectVideo XRequest.XFree86-DGA.3: XF86DGAGetViewPortSize XRequest.XFree86-DGA.4: XF86DGASetViewPort XRequest.XFree86-DGA.5: XF86DGAGetVidPage XRequest.XFree86-DGA.6: XF86DGASetVidPage XRequest.XFree86-DGA.7: XF86DGAInstallColormap XRequest.XFree86-DGA.8: XF86DGAQueryDirectVideo XRequest.XFree86-DGA.9: XF86DGAViewPortChanged XRequest.XFree86-DGA.10: XF86DGAObsolete1 XRequest.XFree86-DGA.11: XF86DGAObsolete2 XRequest.XFree86-DGA.12: XDGAQueryModes XRequest.XFree86-DGA.13: XDGASetMode XRequest.XFree86-DGA.14: XDGASetViewport XRequest.XFree86-DGA.15: XDGAInstallColormap XRequest.XFree86-DGA.16: XDGASelectInput XRequest.XFree86-DGA.17: XDGAFillRectangle XRequest.XFree86-DGA.18: XDGACopyArea XRequest.XFree86-DGA.19: XDGACopyTransparentArea XRequest.XFree86-DGA.20: XDGAGetViewportStatus XRequest.XFree86-DGA.21: XDGASync XRequest.XFree86-DGA.22: XDGAOpenFramebuffer XRequest.XFree86-DGA.23: XDGACloseFramebuffer XRequest.XFree86-DGA.24: XDGASetClientVersion XRequest.XFree86-DGA.25: XDGAChangePixmapMode XRequest.XFree86-DGA.26: XDGACreateColormap XProtoError.XFree86-DGA.0: XF86DGAClientNotLocal XProtoError.XFree86-DGA.1: XF86DGANoDirectVideoMode XProtoError.XFree86-DGA.2: XF86DGAScreenNotActive XProtoError.XFree86-DGA.3: XF86DGADirectNotActivated XProtoError.XFree86-DGA.4: XF86DGAOperationNotSupported ! DOUBLE-BUFFER (DBE), an X Consortium standard XRequest.DOUBLE-BUFFER.0: DBEGetVersion XRequest.DOUBLE-BUFFER.1: DBEAllocateBackBufferName XRequest.DOUBLE-BUFFER.2: DBEDeallocateBackBufferName XRequest.DOUBLE-BUFFER.3: DBESwapBuffers XRequest.DOUBLE-BUFFER.4: DBEBeginIdiom XRequest.DOUBLE-BUFFER.5: DBEEndIdiom XRequest.DOUBLE-BUFFER.6: DBEGetVisualInfo XRequest.DOUBLE-BUFFER.7: DBEGetBackBufferAttributes XProtoError.DOUBLE-BUFFER.0: DBEBadBuffer (invalid BackBuffer parameter) XlibMessage.DOUBLE-BUFFER.0: BackBuffer in failed request: 0x%lx ! SECURITY XRequest.SECURITY.0: SecurityQueryVersion XRequest.SECURITY.1: SecurityGenerateAuthorization XProtoError.SECURITY.0: SecurityBadAuthorization (invalid authorization id) XProtoError.SECURITY.1: SecurityBadAuthorizationProtocol (invalid authorization name or data) XlibMessage.SECURITY.1: authorization id in failed request: 0x%lx ! AppGroup XRequest.APPGROUP.0: XagQueryVersion XRequest.APPGROUP.1: XagCreate XRequest.APPGROUP.2: XagDestroy XRequest.APPGROUP.3: XagGetAttr XRequest.APPGROUP.4: XagQuery XRequest.APPGROUP.5: XagCreateAssoc XRequest.APPGROUP.6: XagDestroyAssoc XProtoError.APPGROUP.0: XagBadAppGroup (invalid AppGroup parameter) ! LBX XRequest.LBX.0: LbxQueryVersion XRequest.LBX.1: LbxStartProxy XRequest.LBX.2: LbxStopProxy XRequest.LBX.3: LbxSwitch XRequest.LBX.4: LbxNewClient XRequest.LBX.5: LbxCloseClient XRequest.LBX.6: LbxModifySequence XRequest.LBX.7: LbxAllowMotion XRequest.LBX.8: LbxIncrementPixel XRequest.LBX.9: LbxDelta XRequest.LBX.10: LbxGetModifierMapping XRequest.LBX.11: LbxQueryTag XRequest.LBX.12: LbxInvalidateTag XRequest.LBX.13: LbxPolyPoint XRequest.LBX.14: LbxPolyLine XRequest.LBX.15: LbxPolySegment XRequest.LBX.16: LbxPolyRectangle XRequest.LBX.17: LbxPolyArc XRequest.LBX.18: LbxFillPoly XRequest.LBX.19: LbxPolyFillRectangle XRequest.LBX.20: LbxPolyFillArc XRequest.LBX.21: LbxGetKeyboardMapping XRequest.LBX.22: LbxQueryFont XRequest.LBX.23: LbxChangeProperty XRequest.LBX.24: LbxGetProperty XRequest.LBX.25: LbxTagData XRequest.LBX.26: LbxCopyArea XRequest.LBX.27: LbxCopyPlane XRequest.LBX.28: LbxPolyText8 XRequest.LBX.29: LbxPolyText16 XRequest.LBX.30: LbxImageText8 XRequest.LBX.31: LbxImageText16 XRequest.LBX.32: LbxQueryExtension XRequest.LBX.33: LbxPutImage XRequest.LBX.34: LbxGetImage XRequest.LBX.35: LbxBeginLargeRequest XRequest.LBX.36: LbxLargeRequestData XRequest.LBX.37: LbxEndLargeRequest XRequest.LBX.38: LbxInternAtoms XRequest.LBX.39: LbxGetWinAttrAndGeom XRequest.LBX.40: LbxGrabCmap XRequest.LBX.41: LbxReleaseCmap XRequest.LBX.42: LbxAllocColor XRequest.LBX.43: LbxSync XProtoError.LBX.0: BadLbxClient ! XpExtension XRequest.XpExtension.0: PrintQueryVersion XRequest.XpExtension.1: PrintGetPrinterList XRequest.XpExtension.2: PrintCreateContext XRequest.XpExtension.3: PrintSetContext XRequest.XpExtension.4: PrintGetContext XRequest.XpExtension.5: PrintDestroyContext XRequest.XpExtension.6: PrintGetContextScreen XRequest.XpExtension.7: PrintStartJob XRequest.XpExtension.8: PrintEndJob XRequest.XpExtension.9: PrintStartDoc XRequest.XpExtension.10: PrintEndDoc XRequest.XpExtension.11: PrintPutDocumentData XRequest.XpExtension.12: PrintGetDocumentData XRequest.XpExtension.13: PrintStartPage XRequest.XpExtension.14: PrintEndPage XRequest.XpExtension.15: PrintSelectInput XRequest.XpExtension.16: PrintInputSelected XRequest.XpExtension.17: PrintGetAttributes XRequest.XpExtension.18: PrintSetAttributes XRequest.XpExtension.19: PrintGetOneAttribute XRequest.XpExtension.20: PrintRehashPrinterList XRequest.XpExtension.21: PrintGetPageDimensions XRequest.XpExtension.22: PrintQueryScreens XRequest.XpExtension.23: PrintSetImageResolution XRequest.XpExtension.24: PrintGetImageResolution XProtoError.XpExtension.0: XPBadContext (Print Context invalid or missing) XlibMessage.XpExtension.0: Context in failed request: 0x%lx XProtoError.XpExtension.1: XPBadSequence (Illegal sequence of XP operations) XProtoError.XpExtension.2: XPBadResourceID (X resource not valid) ! TOG-CUP, an X Project Team specification XRequest.TOG-CUP.0: CUPQueryVersion XRequest.TOG-CUP.1: CUPGetReservedColormapEntries XRequest.TOG-CUP.2: CUPStoreColors ! Extended-Visual-Information, an X Project Team specification XRequest.Extended-Visual-Information.0: EVIQueryVersion XRequest.Extended-Visual-Information.1: EVIGetVisualInfo ! DPMS (Display Power Management Signaling), an X Project Team specification XRequest.DPMS.0: DPMSGetVersion XRequest.DPMS.1: DPMSCapable XRequest.DPMS.2: DPMSGetTimeouts XRequest.DPMS.3: DPMSSetTimeouts XRequest.DPMS.4: DPMSEnable XRequest.DPMS.5: DPMSDisable XRequest.DPMS.6: DPMSForceLevel XRequest.DPMS.7: DPMSInfo ! XINERAMA, not an X Project Team specification XRequest.XINERAMA.0: XINERAMAQueryVersion XRequest.XINERAMA.1: XINERAMAGetState XRequest.XINERAMA.2: XINERAMAGetScreenCount XRequest.XINERAMA.3: XINERAMAGetScreenSize XRequest.XINERAMA.4: XINERAMAIsActive XRequest.XINERAMA.5: XINERAMAQueryScreens ! XF86Rush extension, not a standard spec Xrequest.XFree86-Rush.0: XF86RushQueryVersion Xrequest.XFree86-Rush.1: XF86RushLockPixmap Xrequest.XFree86-Rush.2: XF86RushUnlockPixmap Xrequest.XFree86-Rush.3: XF86RushUnlockAllPixmaps Xrequest.XFree86-Rush.4: XF86RushGetCopyMode Xrequest.XFree86-Rush.5: XF86RushSetCopyMode Xrequest.XFree86-Rush.6: XF86RushGetPixelStride Xrequest.XFree86-Rush.7: XF86RushSetPixelStride Xrequest.XFree86-Rush.8: XF86RushOverlayPixmap Xrequest.XFree86-Rush.9: XF86RushStatusRegOffset Xrequest.XFree86-Rush.10: XF86RushAT3DEnableRegs Xrequest.XFree86-Rush.11: XF86RushAT3DDisableRegs ! XVideo Xrequest.XVideo.0: XvQueryExtension Xrequest.XVideo.1: XvQueryAdaptors Xrequest.XVideo.2: XvQueryEncodings Xrequest.XVideo.3: XvGrabPort Xrequest.XVideo.4: XvUngrabPort Xrequest.XVideo.5: XvPutVideo Xrequest.XVideo.6: XvPutStill Xrequest.XVideo.7: XvGetVideo Xrequest.XVideo.8: XvGetStill Xrequest.XVideo.9: XvStopVideo Xrequest.XVideo.10: XvSelectVideoNotify Xrequest.XVideo.11: XvSelectPortNotify Xrequest.XVideo.12: XvQueryBestSize Xrequest.XVideo.13: XvSetPortAttribute Xrequest.XVideo.14: XvGetPortAttribute Xrequest.XVideo.15: XvQueryPortAttributes Xrequest.XVideo.16: XvListImageFormats Xrequest.XVideo.17: XvQueryImageAttributes Xrequest.XVideo.18: XvPutImage Xrequest.XVideo.19: XvShmPutImage XProtoError.XVideo.0: XvBadPort XProtoError.XVideo.1: XvBadEncoding XProtoError.XVideo.2: XvBadControl ! XFree86-Bigfont Xrequest.XFree86-Bigfont.0: XF86BigfontQueryVersion Xrequest.XFree86-Bigfont.1: XF86BigfontQueryFont ! Adobe-DPS-Extension, not a standard XRequest.Adobe-DPS-Extension.1: PSInit XRequest.Adobe-DPS-Extension.2: PSCreateContext XRequest.Adobe-DPS-Extension.3: PSCreateSpace XRequest.Adobe-DPS-Extension.4: PSGiveInput XRequest.Adobe-DPS-Extension.5: PSGetStatus XRequest.Adobe-DPS-Extension.6: PSDestroySpace XRequest.Adobe-DPS-Extension.7: PSReset XRequest.Adobe-DPS-Extension.8: PSNotifyContext XRequest.Adobe-DPS-Extension.9: PSCreateContextFromID XRequest.Adobe-DPS-Extension.10: PSXIDFromContext XRequest.Adobe-DPS-Extension.11: PSContextFromXID XRequest.Adobe-DPS-Extension.12: PSSetStatusMask XRequest.Adobe-DPS-Extension.13: PSCreateSecureContext XRequest.Adobe-DPS-Extension.14: PSNotifyWhenReady XProtoError.Adobe-DPS-Extension.0: PSErrorBadContext (invalid Context parameter) XlibMessage.Adobe-DPS-Extension.0: Context id in failed request: 0x%lx XProtoError.Adobe-DPS-Extension.1: PSErrorBadSpace (invalid Space parameter) XlibMessage.Adobe-DPS-Extension.1: Space id in failed request: 0x%lx XProtoError.Adobe-DPS-Extension.2: PSErrorAbort (interpreter aborted) XlibMessage.Adobe-DPS-Extension.2: Value in failed request: 0x%lx ! RANDR XRequest.RANDR.0: RRQueryVersion XRequest.RANDR.1: RROldGetScreenInfo XRequest.RANDR.2: RRSetScreenConfig XRequest.RANDR.3: RROldScreenChangeSelectInput XRequest.RANDR.4: RRSelectInput XRequest.RANDR.5: RRGetScreenInfo XRequest.RANDR.6: RRGetScreenSizeRange XRequest.RANDR.7: RRSetScreenSize XRequest.RANDR.8: RRGetScreenResources XRequest.RANDR.9: RRGetOutputInfo XRequest.RANDR.10: RRListOutputProperties XRequest.RANDR.11: RRQueryOutputProperty XRequest.RANDR.12: RRConfigureOutputProperty XRequest.RANDR.13: RRChangeOutputProperty XRequest.RANDR.14: RRDeleteOutputProperty XRequest.RANDR.15: RRGetOutputProperty XRequest.RANDR.16: RRCreateMode XRequest.RANDR.17: RRDestroyMode XRequest.RANDR.18: RRAddOutputMode XRequest.RANDR.19: RRDeleteOutputMode XRequest.RANDR.20: RRGetCrtcInfo XRequest.RANDR.21: RRSetCrtcConfig XRequest.RANDR.22: RRGetCrtcGammaSize XRequest.RANDR.23: RRGetCrtcGamma XRequest.RANDR.24: RRSetCrtcGamma XRequest.RANDR.25: RRGetScreenResourcesCurrent XRequest.RANDR.26: RRSetCrtcTransform XRequest.RANDR.27: RRGetCrtcTransform XRequest.RANDR.28: RRGetPanning XRequest.RANDR.29: RRSetPanning XRequest.RANDR.30: RRSetOutputPrimary XRequest.RANDR.31: RRGetOutputPrimary XRequest.RANDR.32: RRGetProviders XRequest.RANDR.33: RRGetProviderInfo XRequest.RANDR.34: RRSetProviderOffloadSink XRequest.RANDR.35: RRSetProviderOutputSource XRequest.RANDR.36: RRListProviderProperties XRequest.RANDR.37: RRQueryProviderProperty XRequest.RANDR.38: RRConfigureProviderProperty XRequest.RANDR.39: RRChangeProviderProperty XRequest.RANDR.40: RRDeleteProviderProperty XRequest.RANDR.41: RRGetProviderProperty XProtoError.RANDR.0: BadRROutput (invalid Output parameter) XlibMessage.RANDR.0: Output id in failed request: 0x%lx XProtoError.RANDR.1: BadRRCrtc (invalid Crtc parameter) XlibMessage.RANDR.1: Crtc id in failed request: 0x%lx XProtoError.RANDR.2: BadRRMode (invalid Mode parameter) XlibMessage.RANDR.2: Mode id in failed request: 0x%lx XProtoError.RANDR.3: BadRRProvider (invalid Provider parameter) XlibMessage.RANDR.3: Provider id in failed request: 0x%lx ! RENDER XRequest.RENDER.0: RenderQueryVersion XRequest.RENDER.1: RenderQueryPictFormats XRequest.RENDER.2: RenderQueryPictIndexValues XRequest.RENDER.3: RenderQueryDithers XRequest.RENDER.4: RenderCreatePicture XRequest.RENDER.5: RenderChangePicture XRequest.RENDER.6: RenderSetPictureClipRectangles XRequest.RENDER.7: RenderFreePicture XRequest.RENDER.8: RenderComposite XRequest.RENDER.9: RenderScale XRequest.RENDER.10: RenderTrapezoids XRequest.RENDER.11: RenderTriangles XRequest.RENDER.12: RenderTriStrip XRequest.RENDER.13: RenderTriFan XRequest.RENDER.14: RenderColorTrapezoids XRequest.RENDER.15: RenderColorTriangles XRequest.RENDER.16: RenderTransform XRequest.RENDER.17: RenderCreateGlyphSet XRequest.RENDER.18: RenderReferenceGlyphSet XRequest.RENDER.19: RenderFreeGlyphSet XRequest.RENDER.20: RenderAddGlyphs XRequest.RENDER.21: RenderAddGlyphsFromPicture XRequest.RENDER.22: RenderFreeGlyphs XRequest.RENDER.23: RenderCompositeGlyphs8 XRequest.RENDER.24: RenderCompositeGlyphs16 XRequest.RENDER.25: RenderCompositeGlyphs32 XRequest.RENDER.26: RenderFillRectangles XRequest.RENDER.27: RenderCreateCursor XRequest.RENDER.28: RenderSetPictureTransform XRequest.RENDER.29: RenderQueryFilters XRequest.RENDER.30: RenderSetPictureFilter XRequest.RENDER.31: RenderCreateAnimCursor XRequest.RENDER.32: RenderAddTraps XRequest.RENDER.33: RenderCreateSolidFill XRequest.RENDER.34: RenderCreateLinearGradient XRequest.RENDER.35: RenderCreateRadialGradient XRequest.RENDER.36: RenderCreateConicalGradient XProtoError.RENDER.0: RenderBadFormat (invalid PictFormat parameter) XlibMessage.RENDER.0: PictFormat id in failed request: 0x%lx XProtoError.RENDER.1: RenderBadPicture (invalid Picture parameter) XlibMessage.RENDER.1: Picture id in failed request: 0x%lx XProtoError.RENDER.2: RenderBadPictOp (invalid PictOp parameter) XlibMessage.RENDER.2: PictOp in failed request: 0x%lx XProtoError.RENDER.3: RenderBadGlyphSet (invalid GlyphSet parameter) XlibMessage.RENDER.3: GlyphSet id in failed request: 0x%lx XProtoError.RENDER.4: RenderBadGlyph (invalid Glyph parameter) XlibMessage.RENDER.4: Glyph in failed request: 0x%lx ! XFixes XRequest.XFIXES.0: XFixesQueryVersion XRequest.XFIXES.1: XFixesChangeSaveSet XRequest.XFIXES.2: XFixesSelectSelectionInput XRequest.XFIXES.3: XFixesSelectCursorInput XRequest.XFIXES.4: XFixesGetCursorImage XRequest.XFIXES.5: XFixesCreateRegion XRequest.XFIXES.6: XFixesCreateRegionFromBitmap XRequest.XFIXES.7: XFixesCreateRegionFromWindow XRequest.XFIXES.8: XFixesCreateRegionFromGC XRequest.XFIXES.9: XFixesCreateRegionFromPicture XRequest.XFIXES.10: XFixesDestroyRegion XRequest.XFIXES.11: XFixesSetRegion XRequest.XFIXES.12: XFixesCopyRegion XRequest.XFIXES.13: XFixesUnionRegion XRequest.XFIXES.14: XFixesIntersectRegion XRequest.XFIXES.15: XFixesSubtractRegion XRequest.XFIXES.16: XFixesInvertRegion XRequest.XFIXES.17: XFixesTranslateRegion XRequest.XFIXES.18: XFixesRegionExtents XRequest.XFIXES.19: XFixesFetchRegion XRequest.XFIXES.20: XFixesSetGCClipRegion XRequest.XFIXES.21: XFixesSetWindowShapeRegion XRequest.XFIXES.22: XFixesSetPictureClipRegion XRequest.XFIXES.23: XFixesSetCursorName XRequest.XFIXES.24: XFixesGetCursorName XRequest.XFIXES.25: XFixesGetCursorImageAndName XRequest.XFIXES.26: XFixesChangeCursor XRequest.XFIXES.27: XFixesChangeCursorByName XRequest.XFIXES.28: XFixesExpandRegion XRequest.XFIXES.29: XFixesHideCursor XRequest.XFIXES.30: XFixesShowCursor XProtoError.XFIXES.0: BadRegion (invalid Region parameter) XlibMessage.XFIXES.0: Region id in failed request: 0x%lx ! DAMAGE extension XRequest.DAMAGE.0: XDamageQueryVersion XRequest.DAMAGE.1: XDamageCreate XRequest.DAMAGE.2: XDamageDestroy XRequest.DAMAGE.3: XDamageSubtract XRequest.DAMAGE.4: XDamageAdd XProtoError.DAMAGE.0: BadDamage (invalid Damage parameter) XlibMessage.DAMAGE.0: Damage id in failed request: 0x%lx ! DRI2 extension XRequest.DRI2.0: DRI2QueryVersion XRequest.DRI2.1: DRI2Connect XRequest.DRI2.2: DRI2Authenticate XRequest.DRI2.3: DRI2CreateDrawable XRequest.DRI2.4: DRI2DestroyDrawable XRequest.DRI2.5: DRI2GetBuffers XRequest.DRI2.6: DRI2CopyRegion XRequest.DRI2.7: DRI2GetBuffersWithFormat XRequest.DRI2.8: DRI2SwapBuffers XRequest.DRI2.9: DRI2GetMSC XRequest.DRI2.10: DRI2WaitMSC XRequest.DRI2.11: DRI2WaitSBC XRequest.DRI2.12: DRI2SwapInterval nx-libs-3.5.99.23/nx-X11/lib/src/Xintatom.h0000644000000000000000000000111013614532331014605 0ustar #ifndef _XINTATOM_H_ #define _XINTATOM_H_ 1 #include #include /* IntAtom.c */ #define TABLESIZE 64 typedef struct _Entry { unsigned long sig; Atom atom; } EntryRec, *Entry; #define RESERVED ((Entry) 1) #define EntryName(e) ((char *)(e+1)) typedef struct _XDisplayAtoms { Entry table[TABLESIZE]; } AtomTable; _XFUNCPROTOBEGIN extern void _XUpdateAtomCache(Display *dpy, const char *name, Atom atom, unsigned long sig, int idx, int n); extern void _XFreeAtomTable(Display *dpy); _XFUNCPROTOEND #endif /* _XINTATOM_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/Xintconn.h0000644000000000000000000000202713614532331014612 0ustar #ifndef _XINTCONN_H_ #define _XINTCONN_H_ 1 #include #include _XFUNCPROTOBEGIN #if !USE_XCB /* ConnDis.c */ int _XConnectDisplay ( char *display_name, char **fullnamep, /* RETURN */ int *dpynump, /* RETURN */ int *screenp, /* RETURN */ char **auth_namep, /* RETURN */ int *auth_namelenp, /* RETURN */ char **auth_datap, /* RETURN */ int *auth_datalenp); /* RETURN */ extern int _XDisconnectDisplay(XtransConnInfo trans_conn); extern Bool _XSendClientPrefix(Display *dpy, xConnClientPrefix *client, char *auth_proto, char *auth_string, xConnSetupPrefix *prefix); extern XtransConnInfo _X11TransConnectDisplay(char *display_name, char **fullnamep, int *dpynump, int *screenp, char **auth_namep, int *auth_namelenp, char **auth_datap, int *auth_datalenp); #endif /* !USE_XCB */ /* OpenDis.c */ extern void _XFreeDisplayStructure(Display *dpy); _XFUNCPROTOEND #endif /* _XINTCONN_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/xkb/Makefile.am0000644000000000000000000000152413614532331015462 0ustar NULL = noinst_LTLIBRARIES = libxkb.la AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/include/X11 \ -I$(top_builddir)/include \ -I$(top_builddir)/include/X11 \ -I$(top_srcdir)/src/xcms \ -I$(top_srcdir)/src/xkb \ -I$(top_srcdir)/src/xlibi18n \ -I$(top_srcdir)/../exports/include \ -D_GNU_SOURCE \ $(NULL) AM_CFLAGS = \ $(X11_CFLAGS) \ $(BIGFONT_CFLAGS) \ $(XMALLOC_ZERO_CFLAGS) \ $(CWARNFLAGS) \ $(NULL) libxkb_la_SOURCES = \ XKB.c \ XKBBind.c \ XKBCompat.c \ XKBCtrls.c \ XKBCvt.c \ XKBGetMap.c \ XKBGetByName.c \ XKBNames.c \ XKBRdBuf.c \ XKBSetMap.c \ XKBUse.c \ XKBleds.c \ XKBBell.c \ XKBGeom.c \ XKBSetGeom.c \ XKBExtDev.c \ XKBList.c \ XKBMisc.c \ XKBMAlloc.c \ XKBGAlloc.c \ XKBAlloc.c \ $(NULL) nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBAlloc.c0000644000000000000000000003507713614532331015203 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "XKBlibint.h" #include #include #include "XKBlibint.h" /***===================================================================***/ /*ARGSUSED*/ Status XkbAllocCompatMap(XkbDescPtr xkb, unsigned which, unsigned nSI) { XkbCompatMapPtr compat; XkbSymInterpretRec *prev_interpret; if (!xkb) return BadMatch; if (xkb->compat) { if (xkb->compat->size_si >= nSI) return Success; compat = xkb->compat; compat->size_si = nSI; if (compat->sym_interpret == NULL) compat->num_si = 0; prev_interpret = compat->sym_interpret; compat->sym_interpret = _XkbTypedRealloc(compat->sym_interpret, nSI, XkbSymInterpretRec); if (compat->sym_interpret == NULL) { _XkbFree(prev_interpret); compat->size_si = compat->num_si = 0; return BadAlloc; } if (compat->num_si != 0) { _XkbClearElems(compat->sym_interpret, compat->num_si, compat->size_si - 1, XkbSymInterpretRec); } return Success; } compat = _XkbTypedCalloc(1, XkbCompatMapRec); if (compat == NULL) return BadAlloc; if (nSI > 0) { compat->sym_interpret = _XkbTypedCalloc(nSI, XkbSymInterpretRec); if (!compat->sym_interpret) { _XkbFree(compat); return BadAlloc; } } compat->size_si = nSI; compat->num_si = 0; bzero((char *) &compat->groups[0], XkbNumKbdGroups * sizeof(XkbModsRec)); xkb->compat = compat; return Success; } void XkbFreeCompatMap(XkbDescPtr xkb, unsigned which, Bool freeMap) { register XkbCompatMapPtr compat; if ((xkb == NULL) || (xkb->compat == NULL)) return; compat = xkb->compat; if (freeMap) which = XkbAllCompatMask; if (which & XkbGroupCompatMask) bzero(&compat->groups[0], XkbNumKbdGroups * sizeof(XkbModsRec)); if (which & XkbSymInterpMask) { if ((compat->sym_interpret) && (compat->size_si > 0)) _XkbFree(compat->sym_interpret); compat->size_si = compat->num_si = 0; compat->sym_interpret = NULL; } if (freeMap) { _XkbFree(compat); xkb->compat = NULL; } return; } /***===================================================================***/ Status XkbAllocNames(XkbDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases) { XkbNamesPtr names; if (xkb == NULL) return BadMatch; if (xkb->names == NULL) { xkb->names = _XkbTypedCalloc(1, XkbNamesRec); if (xkb->names == NULL) return BadAlloc; } names = xkb->names; if ((which & XkbKTLevelNamesMask) && (xkb->map != NULL) && (xkb->map->types != NULL)) { register int i; XkbKeyTypePtr type = xkb->map->types; for (i = 0; i < xkb->map->num_types; i++, type++) { if (type->level_names == NULL) { type->level_names = _XkbTypedCalloc(type->num_levels, Atom); if (type->level_names == NULL) return BadAlloc; } } } if ((which & XkbKeyNamesMask) && (names->keys == NULL)) { if ((!XkbIsLegalKeycode(xkb->min_key_code)) || (!XkbIsLegalKeycode(xkb->max_key_code)) || (xkb->max_key_code < xkb->min_key_code)) return BadValue; names->keys = _XkbTypedCalloc((xkb->max_key_code + 1), XkbKeyNameRec); if (names->keys == NULL) return BadAlloc; } if ((which & XkbKeyAliasesMask) && (nTotalAliases > 0)) { if (names->key_aliases == NULL) { names->key_aliases = _XkbTypedCalloc(nTotalAliases, XkbKeyAliasRec); } else if (nTotalAliases > names->num_key_aliases) { XkbKeyAliasRec *prev_aliases = names->key_aliases; names->key_aliases = _XkbTypedRealloc(names->key_aliases, nTotalAliases, XkbKeyAliasRec); if (names->key_aliases != NULL) { _XkbClearElems(names->key_aliases, names->num_key_aliases, nTotalAliases - 1, XkbKeyAliasRec); } else { _XkbFree(prev_aliases); } } if (names->key_aliases == NULL) { names->num_key_aliases = 0; return BadAlloc; } names->num_key_aliases = nTotalAliases; } if ((which & XkbRGNamesMask) && (nTotalRG > 0)) { if (names->radio_groups == NULL) { names->radio_groups = _XkbTypedCalloc(nTotalRG, Atom); } else if (nTotalRG > names->num_rg) { Atom *prev_radio_groups = names->radio_groups; names->radio_groups = _XkbTypedRealloc(names->radio_groups, nTotalRG, Atom); if (names->radio_groups != NULL) { _XkbClearElems(names->radio_groups, names->num_rg, nTotalRG - 1, Atom); } else { _XkbFree(prev_radio_groups); } } if (names->radio_groups == NULL) return BadAlloc; names->num_rg = nTotalRG; } return Success; } void XkbFreeNames(XkbDescPtr xkb, unsigned which, Bool freeMap) { XkbNamesPtr names; if ((xkb == NULL) || (xkb->names == NULL)) return; names = xkb->names; if (freeMap) which = XkbAllNamesMask; if (which & XkbKTLevelNamesMask) { XkbClientMapPtr map = xkb->map; if ((map != NULL) && (map->types != NULL)) { register int i; register XkbKeyTypePtr type; type = map->types; for (i = 0; i < map->num_types; i++, type++) { _XkbFree(type->level_names); type->level_names = NULL; } } } if (which & XkbKeyNamesMask) { _XkbFree(names->keys); names->keys = NULL; names->num_keys = 0; } if (which & XkbKeyAliasesMask) { _XkbFree(names->key_aliases); names->key_aliases = NULL; names->num_key_aliases = 0; } if (which & XkbRGNamesMask) { _XkbFree(names->radio_groups); names->radio_groups = NULL; names->num_rg = 0; } if (freeMap) { _XkbFree(names); xkb->names = NULL; } return; } /***===================================================================***/ /*ARGSUSED*/ Status XkbAllocControls(XkbDescPtr xkb, unsigned which) { if (xkb == NULL) return BadMatch; if (xkb->ctrls == NULL) { xkb->ctrls = _XkbTypedCalloc(1, XkbControlsRec); if (!xkb->ctrls) return BadAlloc; } return Success; } /*ARGSUSED*/ void XkbFreeControls(XkbDescPtr xkb, unsigned which, Bool freeMap) { if (freeMap && (xkb != NULL) && (xkb->ctrls != NULL)) { _XkbFree(xkb->ctrls); xkb->ctrls = NULL; } return; } /***===================================================================***/ Status XkbAllocIndicatorMaps(XkbDescPtr xkb) { if (xkb == NULL) return BadMatch; if (xkb->indicators == NULL) { xkb->indicators = _XkbTypedCalloc(1, XkbIndicatorRec); if (!xkb->indicators) return BadAlloc; } return Success; } void XkbFreeIndicatorMaps(XkbDescPtr xkb) { if ((xkb != NULL) && (xkb->indicators != NULL)) { _XkbFree(xkb->indicators); xkb->indicators = NULL; } return; } /***====================================================================***/ XkbDescRec * XkbAllocKeyboard(void) { XkbDescRec *xkb; xkb = _XkbTypedCalloc(1, XkbDescRec); if (xkb) xkb->device_spec = XkbUseCoreKbd; return xkb; } void XkbFreeKeyboard(XkbDescPtr xkb, unsigned which, Bool freeAll) { if (xkb == NULL) return; if (freeAll) which = XkbAllComponentsMask; if (which & XkbClientMapMask) XkbFreeClientMap(xkb, XkbAllClientInfoMask, True); if (which & XkbServerMapMask) XkbFreeServerMap(xkb, XkbAllServerInfoMask, True); if (which & XkbCompatMapMask) XkbFreeCompatMap(xkb, XkbAllCompatMask, True); if (which & XkbIndicatorMapMask) XkbFreeIndicatorMaps(xkb); if (which & XkbNamesMask) XkbFreeNames(xkb, XkbAllNamesMask, True); if ((which & XkbGeometryMask) && (xkb->geom != NULL)) XkbFreeGeometry(xkb->geom, XkbGeomAllMask, True); if (which & XkbControlsMask) XkbFreeControls(xkb, XkbAllControlsMask, True); if (freeAll) _XkbFree(xkb); return; } /***====================================================================***/ XkbDeviceLedInfoPtr XkbAddDeviceLedInfo(XkbDeviceInfoPtr devi, unsigned ledClass, unsigned ledId) { XkbDeviceLedInfoPtr devli; register int i; if ((!devi) || (!XkbSingleXIClass(ledClass)) || (!XkbSingleXIId(ledId))) return NULL; for (i = 0, devli = devi->leds; i < devi->num_leds; i++, devli++) { if ((devli->led_class == ledClass) && (devli->led_id == ledId)) return devli; } if (devi->num_leds >= devi->sz_leds) { XkbDeviceLedInfoRec *prev_leds = devi->leds; if (devi->sz_leds > 0) devi->sz_leds *= 2; else devi->sz_leds = 1; devi->leds = _XkbTypedRealloc(devi->leds, devi->sz_leds, XkbDeviceLedInfoRec); if (!devi->leds) { _XkbFree(prev_leds); devi->sz_leds = devi->num_leds = 0; return NULL; } i = devi->num_leds; for (devli = &devi->leds[i]; i < devi->sz_leds; i++, devli++) { bzero(devli, sizeof(XkbDeviceLedInfoRec)); devli->led_class = XkbXINone; devli->led_id = XkbXINone; } } devli = &devi->leds[devi->num_leds++]; bzero(devli, sizeof(XkbDeviceLedInfoRec)); devli->led_class = ledClass; devli->led_id = ledId; return devli; } Status XkbResizeDeviceButtonActions(XkbDeviceInfoPtr devi, unsigned newTotal) { XkbAction *prev_btn_acts; if ((!devi) || (newTotal > 255)) return BadValue; if ((devi->btn_acts != NULL) && (newTotal == devi->num_btns)) return Success; if (newTotal == 0) { if (devi->btn_acts != NULL) { _XkbFree(devi->btn_acts); devi->btn_acts = NULL; } devi->num_btns = 0; return Success; } prev_btn_acts = devi->btn_acts; devi->btn_acts = _XkbTypedRealloc(devi->btn_acts, newTotal, XkbAction); if (devi->btn_acts == NULL) { _XkbFree(prev_btn_acts); devi->num_btns = 0; return BadAlloc; } if (newTotal > devi->num_btns) { XkbAction *act; act = &devi->btn_acts[devi->num_btns]; bzero((char *) act, (newTotal - devi->num_btns) * sizeof(XkbAction)); } devi->num_btns = newTotal; return Success; } /*ARGSUSED*/ XkbDeviceInfoPtr XkbAllocDeviceInfo(unsigned deviceSpec, unsigned nButtons, unsigned szLeds) { XkbDeviceInfoPtr devi; devi = _XkbTypedCalloc(1, XkbDeviceInfoRec); if (devi != NULL) { devi->device_spec = deviceSpec; devi->has_own_state = False; devi->num_btns = 0; devi->btn_acts = NULL; if (nButtons > 0) { devi->num_btns = nButtons; devi->btn_acts = _XkbTypedCalloc(nButtons, XkbAction); if (!devi->btn_acts) { _XkbFree(devi); return NULL; } } devi->dflt_kbd_fb = XkbXINone; devi->dflt_led_fb = XkbXINone; devi->num_leds = 0; devi->sz_leds = 0; devi->leds = NULL; if (szLeds > 0) { devi->sz_leds = szLeds; devi->leds = _XkbTypedCalloc(szLeds, XkbDeviceLedInfoRec); if (!devi->leds) { _XkbFree(devi->btn_acts); _XkbFree(devi); return NULL; } } } return devi; } void XkbFreeDeviceInfo(XkbDeviceInfoPtr devi, unsigned which, Bool freeDevI) { if (devi) { if (freeDevI) { which = XkbXI_AllDeviceFeaturesMask; if (devi->name) { _XkbFree(devi->name); devi->name = NULL; } } if ((which & XkbXI_ButtonActionsMask) && (devi->btn_acts)) { _XkbFree(devi->btn_acts); devi->num_btns = 0; devi->btn_acts = NULL; } if ((which & XkbXI_IndicatorsMask) && (devi->leds)) { register int i; if ((which & XkbXI_IndicatorsMask) == XkbXI_IndicatorsMask) { _XkbFree(devi->leds); devi->sz_leds = devi->num_leds = 0; devi->leds = NULL; } else { XkbDeviceLedInfoPtr devli; for (i = 0, devli = devi->leds; i < devi->num_leds; i++, devli++) { if (which & XkbXI_IndicatorMapsMask) bzero((char *) &devli->maps[0], sizeof(devli->maps)); else bzero((char *) &devli->names[0], sizeof(devli->names)); } } } if (freeDevI) _XkbFree(devi); } return; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBBell.c0000644000000000000000000001231213614532331015012 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include #include "XKBlibint.h" Bool XkbDeviceBell(Display *dpy, Window window, int deviceID, int bellClass, int bellID, int percent, Atom name) { register xkbBellReq *req; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbBell, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbBell; req->deviceSpec = deviceID; req->window = (CARD32) window; req->bellClass = (CARD16) bellClass; req->bellID = (CARD16) bellID; req->percent = percent; req->forceSound = False; req->eventOnly = False; req->pitch = 0; req->duration = 0; req->name = (CARD32) name; req->pad1 = 0; req->pad2 = 0; UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbForceDeviceBell(Display *dpy, int deviceID, int bellClass, int bellID, int percent) { register xkbBellReq *req; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbBell, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbBell; req->deviceSpec = deviceID; req->window = (CARD32) None; req->bellClass = (CARD16) bellClass; req->bellID = (CARD16) bellID; req->percent = percent; req->forceSound = True; req->eventOnly = False; req->pitch = 0; req->duration = 0; req->name = None; req->pad1 = 0; req->pad2 = 0; UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbDeviceBellEvent(Display *dpy, Window window, int deviceID, int bellClass, int bellID, int percent, Atom name) { register xkbBellReq *req; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbBell, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbBell; req->deviceSpec = deviceID; req->window = (CARD32) window; req->bellClass = (CARD16) bellClass; req->bellID = (CARD16) bellID; req->percent = percent; req->forceSound = False; req->eventOnly = True; req->pitch = 0; req->duration = 0; req->name = (CARD32) name; req->pad1 = 0; req->pad2 = 0; UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbBell(Display *dpy, Window window, int percent, Atom name) { if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) { XBell(dpy, percent); return False; } return XkbDeviceBell(dpy, window, XkbUseCoreKbd, XkbDfltXIClass, XkbDfltXIId, percent, name); } Bool XkbForceBell(Display *dpy, int percent) { if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) { XBell(dpy, percent); return False; } return XkbForceDeviceBell(dpy, XkbUseCoreKbd, XkbDfltXIClass, XkbDfltXIId, percent); } Bool XkbBellEvent(Display *dpy, Window window, int percent, Atom name) { if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) { return False; } /* class 0 = KbdFeedbackClass (X Input Extension) */ return XkbDeviceBellEvent(dpy, window, XkbUseCoreKbd, XkbDfltXIClass, XkbDfltXIId, percent, name); } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBBind.c0000644000000000000000000005704413614532331015023 0ustar /* Copyright 1985, 1987, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* the new monsters ate the old ones */ #ifdef HAVE_CONFIG_H #include #endif #include "XKBlib.h" #include #include #include #include #include #include #include "XKBlibint.h" #define AllMods (ShiftMask|LockMask|ControlMask| \ Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask) static int _XkbLoadDpy(Display *dpy); struct _XKeytrans { struct _XKeytrans *next; /* next on list */ char *string; /* string to return when the time comes */ int len; /* length of string (since NULL is legit) */ KeySym key; /* keysym rebound */ unsigned int state; /* modifier state */ KeySym *modifiers; /* modifier keysyms you want */ int mlen; /* length of modifier list */ }; KeySym XkbKeycodeToKeysym(Display *dpy, #if NeedWidePrototypes unsigned int kc, #else KeyCode kc, #endif int group, int level) { XkbDescRec *xkb; if (_XkbUnavailable(dpy)) return NoSymbol; _XkbCheckPendingRefresh(dpy, dpy->xkb_info); xkb = dpy->xkb_info->desc; if ((kc < xkb->min_key_code) || (kc > xkb->max_key_code)) return NoSymbol; if ((group < 0) || (level < 0) || (group >= XkbKeyNumGroups(xkb, kc))) return NoSymbol; if (level >= XkbKeyGroupWidth(xkb, kc, group)) { /* for compatibility with the core protocol, _always_ allow */ /* two symbols in the first two groups. If either of the */ /* two is of type ONE_LEVEL, just replicate the first symbol */ if ((group > XkbGroup2Index) || (XkbKeyGroupWidth(xkb, kc, group) != 1) || (level != 1)) { return NoSymbol; } level = 0; } return XkbKeySymEntry(xkb, kc, level, group); } KeySym XKeycodeToKeysym(Display *dpy, #if NeedWidePrototypes unsigned int kc, #else KeyCode kc, #endif int col) { XkbDescRec *xkb; if (_XkbUnavailable(dpy)) return _XKeycodeToKeysym(dpy, kc, col); _XkbCheckPendingRefresh(dpy, dpy->xkb_info); #ifdef NX_TRANS_SOCKET /* check again, we have seen cases where the connection broke during CheckPendingEvents(), followed by a crash when accessing dpy. See https://github.com/ArcticaProject/nx-libs/issues/801 */ if (_XkbUnavailable(dpy)) return _XKeycodeToKeysym(dpy, kc, col); #endif xkb = dpy->xkb_info->desc; #ifdef NX_TRANS_SOCKET if (xkb == NULL) return _XKeycodeToKeysym(dpy, kc, col); #endif if ((kc < xkb->min_key_code) || (kc > xkb->max_key_code)) return NoSymbol; if (col > 3) { int lastSym, tmp, nGrp; lastSym = 3; nGrp = XkbKeyNumGroups(xkb, kc); if ((nGrp > 0) && ((tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup1Index)) > 2)) { if (col <= (lastSym + tmp - 2)) return XkbKeycodeToKeysym(dpy, kc, XkbGroup1Index, col - lastSym + 2); lastSym += tmp - 2; } if ((nGrp > 1) && ((tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup2Index)) > 2)) { if (col <= (lastSym + tmp - 2)) return XkbKeycodeToKeysym(dpy, kc, XkbGroup2Index, col - lastSym + 2); lastSym += tmp - 2; } if (nGrp > 2) { tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup3Index); if (col <= lastSym + tmp) return XkbKeycodeToKeysym(dpy, kc, XkbGroup3Index, col - lastSym); lastSym += tmp; } if (nGrp > 3) { tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup4Index); if (col <= lastSym + tmp) return XkbKeycodeToKeysym(dpy, kc, XkbGroup4Index, col - lastSym); } return NoSymbol; } return XkbKeycodeToKeysym(dpy, kc, (col >> 1), (col & 1)); } KeyCode XKeysymToKeycode(Display *dpy, KeySym ks) { register int i, j, gotOne; if (_XkbUnavailable(dpy)) return _XKeysymToKeycode(dpy, ks); _XkbCheckPendingRefresh(dpy, dpy->xkb_info); j = 0; do { register XkbDescRec *xkb = dpy->xkb_info->desc; gotOne = 0; for (i = dpy->min_keycode; i <= dpy->max_keycode; i++) { if (j < (int) XkbKeyNumSyms(xkb, i)) { gotOne = 1; if (XkbKeySym(xkb, i, j) == ks) return i; } } j++; } while (gotOne); return 0; } static int _XkbComputeModmap(Display *dpy) { register XkbDescPtr xkb; xkb = dpy->xkb_info->desc; if (XkbGetUpdatedMap(dpy, XkbModifierMapMask, xkb) == Success) return 1; return 0; } unsigned XkbKeysymToModifiers(Display *dpy, KeySym ks) { XkbDescRec *xkb; register int i, j; register KeySym *pSyms; CARD8 mods; if (_XkbUnavailable(dpy)) return _XKeysymToModifiers(dpy, ks); _XkbCheckPendingRefresh(dpy, dpy->xkb_info); if (_XkbNeedModmap(dpy->xkb_info) && (!_XkbComputeModmap(dpy))) return _XKeysymToModifiers(dpy, ks); xkb = dpy->xkb_info->desc; mods = 0; for (i = xkb->min_key_code; i <= (int) xkb->max_key_code; i++) { pSyms = XkbKeySymsPtr(xkb, i); for (j = XkbKeyNumSyms(xkb, i) - 1; j >= 0; j--) { if (pSyms[j] == ks) { mods |= xkb->map->modmap[i]; break; } } } return mods; } KeySym XLookupKeysym(register XKeyEvent * event, int col) { Display *dpy = event->display; if (_XkbUnavailable(dpy)) return _XLookupKeysym(event, col); _XkbCheckPendingRefresh(dpy, dpy->xkb_info); return XKeycodeToKeysym(dpy, event->keycode, col); } /* * Not a public entry point -- XkbTranslateKey is an obsolete name * that is preserved here so that functions linked against the old * version will continue to work in a shared library environment. */ int XkbTranslateKey(register Display *dpy, KeyCode key, register unsigned int mods, unsigned int *mods_rtrn, KeySym *keysym_rtrn); int XkbTranslateKey(register Display *dpy, KeyCode key, register unsigned int mods, unsigned int *mods_rtrn, KeySym *keysym_rtrn) { return XkbLookupKeySym(dpy, key, mods, mods_rtrn, keysym_rtrn); } Bool XkbLookupKeySym(register Display *dpy, KeyCode key, register unsigned int mods, unsigned int *mods_rtrn, KeySym *keysym_rtrn) { if (_XkbUnavailable(dpy)) return _XTranslateKey(dpy, key, mods, mods_rtrn, keysym_rtrn); _XkbCheckPendingRefresh(dpy, dpy->xkb_info); return XkbTranslateKeyCode(dpy->xkb_info->desc, key, mods, mods_rtrn, keysym_rtrn); } Bool XkbTranslateKeyCode(register XkbDescPtr xkb, KeyCode key, register unsigned int mods, unsigned int *mods_rtrn, KeySym *keysym_rtrn) { XkbKeyTypeRec *type; int col, nKeyGroups; unsigned preserve, effectiveGroup; KeySym *syms; if (mods_rtrn != NULL) *mods_rtrn = 0; nKeyGroups = XkbKeyNumGroups(xkb, key); if ((!XkbKeycodeInRange(xkb, key)) || (nKeyGroups == 0)) { if (keysym_rtrn != NULL) *keysym_rtrn = NoSymbol; return False; } syms = XkbKeySymsPtr(xkb, key); /* find the offset of the effective group */ col = 0; effectiveGroup = XkbGroupForCoreState(mods); if (effectiveGroup >= nKeyGroups) { unsigned groupInfo = XkbKeyGroupInfo(xkb, key); switch (XkbOutOfRangeGroupAction(groupInfo)) { default: effectiveGroup %= nKeyGroups; break; case XkbClampIntoRange: effectiveGroup = nKeyGroups - 1; break; case XkbRedirectIntoRange: effectiveGroup = XkbOutOfRangeGroupNumber(groupInfo); if (effectiveGroup >= nKeyGroups) effectiveGroup = 0; break; } } col = effectiveGroup * XkbKeyGroupsWidth(xkb, key); type = XkbKeyKeyType(xkb, key, effectiveGroup); preserve = 0; if (type->map) { /* find the column (shift level) within the group */ register int i; register XkbKTMapEntryPtr entry; for (i = 0, entry = type->map; i < type->map_count; i++, entry++) { if ((entry->active) && ((mods & type->mods.mask) == entry->mods.mask)) { col += entry->level; if (type->preserve) preserve = type->preserve[i].mask; break; } } } if (keysym_rtrn != NULL) *keysym_rtrn = syms[col]; if (mods_rtrn) { *mods_rtrn = type->mods.mask & (~preserve); /* The Motif VTS doesn't get the help callback called if help * is bound to Shift+, and it appears as though it * is XkbTranslateKeyCode that is causing the problem. The * core X version of XTranslateKey always OR's in ShiftMask * and LockMask for mods_rtrn, so this "fix" keeps this behavior * and solves the VTS problem. */ if ((xkb->dpy) && (xkb->dpy->xkb_info) && (xkb->dpy->xkb_info-> xlib_ctrls & XkbLC_AlwaysConsumeShiftAndLock)) { *mods_rtrn |= (ShiftMask | LockMask); } } return (syms[col] != NoSymbol); } Status XkbRefreshKeyboardMapping(register XkbMapNotifyEvent * event) { Display *dpy = event->display; XkbInfoPtr xkbi; if (_XkbUnavailable(dpy)) { _XRefreshKeyboardMapping((XMappingEvent *) event); return Success; } xkbi = dpy->xkb_info; if (((event->type & 0x7f) - xkbi->codes->first_event) != XkbEventCode) return BadMatch; if (event->xkb_type == XkbNewKeyboardNotify) { _XkbReloadDpy(dpy); return Success; } if (event->xkb_type == XkbMapNotify) { XkbMapChangesRec changes; Status rtrn; if (xkbi->flags & XkbMapPending) changes = xkbi->changes; else bzero(&changes, sizeof(changes)); XkbNoteMapChanges(&changes, event, XKB_XLIB_MAP_MASK); if ((rtrn = XkbGetMapChanges(dpy, xkbi->desc, &changes)) != Success) { #ifdef DEBUG fprintf(stderr, "Internal Error! XkbGetMapChanges failed:\n"); #endif xkbi->changes = changes; } else if (xkbi->flags & XkbMapPending) { xkbi->flags &= ~XkbMapPending; bzero(&xkbi->changes, sizeof(XkbMapChangesRec)); } return rtrn; } return BadMatch; } int XRefreshKeyboardMapping(register XMappingEvent * event) { XkbEvent *xkbevent = (XkbEvent *) event; Display *dpy = event->display; XkbMapChangesRec changes; XkbInfoPtr xkbi; /* always do this for input methods, which still use the old keymap */ (void) _XRefreshKeyboardMapping(event); if (_XkbUnavailable(dpy)) return 1; xkbi = dpy->xkb_info; if (((event->type & 0x7f) - xkbi->codes->first_event) == XkbEventCode) return XkbRefreshKeyboardMapping(&xkbevent->map); if (xkbi->flags & XkbXlibNewKeyboard) { _XkbReloadDpy(dpy); return 1; } if ((xkbi->flags & XkbMapPending) || (event->request == MappingKeyboard)) { if (xkbi->flags & XkbMapPending) { changes = xkbi->changes; _XkbNoteCoreMapChanges(&changes, event, XKB_XLIB_MAP_MASK); } else { bzero(&changes, sizeof(changes)); changes.changed = XkbKeySymsMask; if (xkbi->desc->min_key_code < xkbi->desc->max_key_code) { changes.first_key_sym = xkbi->desc->min_key_code; changes.num_key_syms = xkbi->desc->max_key_code - xkbi->desc->min_key_code + 1; } else { changes.first_key_sym = event->first_keycode; changes.num_key_syms = event->count; } } if (XkbGetMapChanges(dpy, xkbi->desc, &changes) != Success) { #ifdef DEBUG fprintf(stderr, "Internal Error! XkbGetMapChanges failed:\n"); if (changes.changed & XkbKeyTypesMask) { int first = changes.first_type; int last = changes.first_type + changes.num_types - 1; fprintf(stderr, " types: %d..%d\n", first, last); } if (changes.changed & XkbKeySymsMask) { int first = changes.first_key_sym; int last = changes.first_key_sym + changes.num_key_syms - 1; fprintf(stderr, " symbols: %d..%d\n", first, last); } if (changes.changed & XkbKeyActionsMask) { int first = changes.first_key_act; int last = changes.first_key_act + changes.num_key_acts - 1; fprintf(stderr, " acts: %d..%d\n", first, last); } if (changes.changed & XkbKeyBehaviorsMask) { int first = changes.first_key_behavior; int last = first + changes.num_key_behaviors - 1; fprintf(stderr, " behaviors: %d..%d\n", first, last); } if (changes.changed & XkbVirtualModsMask) { fprintf(stderr, "virtual mods: 0x%04x\n", changes.vmods); } if (changes.changed & XkbExplicitComponentsMask) { int first = changes.first_key_explicit; int last = first + changes.num_key_explicit - 1; fprintf(stderr, " explicit: %d..%d\n", first, last); } #endif } LockDisplay(dpy); if (xkbi->flags & XkbMapPending) { xkbi->flags &= ~XkbMapPending; bzero(&xkbi->changes, sizeof(XkbMapChangesRec)); } UnlockDisplay(dpy); } if (event->request == MappingModifier) { LockDisplay(dpy); if (xkbi->desc->map->modmap) { _XkbFree(xkbi->desc->map->modmap); xkbi->desc->map->modmap = NULL; } if (dpy->key_bindings) { register struct _XKeytrans *p; for (p = dpy->key_bindings; p; p = p->next) { register int i; p->state = 0; if (p->mlen > 0) { for (i = 0; i < p->mlen; i++) { p->state |= XkbKeysymToModifiers(dpy, p->modifiers[i]); } if (p->state) p->state &= AllMods; else p->state = AnyModifier; } } } UnlockDisplay(dpy); } return 1; } static int _XkbLoadDpy(Display *dpy) { XkbInfoPtr xkbi; unsigned query, oldEvents; XkbDescRec *desc; if (!XkbUseExtension(dpy, NULL, NULL)) return 0; xkbi = dpy->xkb_info; query = XkbAllClientInfoMask; desc = XkbGetMap(dpy, query, XkbUseCoreKbd); if (!desc) { #ifdef DEBUG fprintf(stderr, "Warning! XkbGetMap failed!\n"); #endif return 0; } LockDisplay(dpy); xkbi->desc = desc; UnlockDisplay(dpy); oldEvents = xkbi->selected_events; if (!(xkbi->xlib_ctrls & XkbLC_IgnoreNewKeyboards)) { XkbSelectEventDetails(dpy, xkbi->desc->device_spec, XkbNewKeyboardNotify, XkbNKN_KeycodesMask | XkbNKN_DeviceIDMask, XkbNKN_KeycodesMask | XkbNKN_DeviceIDMask); } XkbSelectEventDetails(dpy, xkbi->desc->device_spec, XkbMapNotify, XkbAllClientInfoMask, XkbAllClientInfoMask); LockDisplay(dpy); xkbi->selected_events = oldEvents; UnlockDisplay(dpy); return 1; } void _XkbReloadDpy(Display *dpy) { XkbInfoPtr xkbi; XkbDescRec *desc; unsigned oldDeviceID; if (_XkbUnavailable(dpy)) return; xkbi = dpy->xkb_info; LockDisplay(dpy); if (xkbi->desc) { oldDeviceID = xkbi->desc->device_spec; XkbFreeKeyboard(xkbi->desc, XkbAllComponentsMask, True); xkbi->desc = NULL; xkbi->flags &= ~(XkbMapPending | XkbXlibNewKeyboard); xkbi->changes.changed = 0; } else oldDeviceID = XkbUseCoreKbd; UnlockDisplay(dpy); desc = XkbGetMap(dpy, XkbAllClientInfoMask, XkbUseCoreKbd); if (!desc) return; LockDisplay(dpy); xkbi->desc = desc; UnlockDisplay(dpy); if (desc->device_spec != oldDeviceID) { /* transfer(?) event masks here */ #ifdef NOTYET unsigned oldEvents; oldEvents = xkbi->selected_events; XkbSelectEventDetails(dpy, xkbi->desc->device_spec, XkbMapNotify, XkbAllMapComponentsMask, XkbAllClientInfoMask); LockDisplay(dpy); xkbi->selected_events = oldEvents; UnlockDisplay(dpy); #endif } return; } int XkbTranslateKeySym(register Display *dpy, register KeySym *sym_rtrn, unsigned int mods, char *buffer, int nbytes, int *extra_rtrn) { register XkbInfoPtr xkb; XkbKSToMBFunc cvtr; XPointer priv; char tmp[4]; int n; xkb = dpy->xkb_info; if (!xkb->cvt.KSToMB) { _XkbGetConverters(_XkbGetCharset(), &xkb->cvt); _XkbGetConverters("ISO8859-1", &xkb->latin1cvt); } if (extra_rtrn) *extra_rtrn = 0; if ((buffer == NULL) || (nbytes == 0)) { buffer = tmp; nbytes = 4; } /* see if symbol rebound, if so, return that string. */ n = XkbLookupKeyBinding(dpy, *sym_rtrn, mods, buffer, nbytes, extra_rtrn); if (n) return n; if (nbytes > 0) buffer[0] = '\0'; if (xkb->cvt.KSToUpper && (mods & LockMask)) { *sym_rtrn = (*xkb->cvt.KSToUpper) (*sym_rtrn); } if (xkb->xlib_ctrls & XkbLC_ForceLatin1Lookup) { cvtr = xkb->latin1cvt.KSToMB; priv = xkb->latin1cvt.KSToMBPriv; } else { cvtr = xkb->cvt.KSToMB; priv = xkb->cvt.KSToMBPriv; } n = (*cvtr) (priv, *sym_rtrn, buffer, nbytes, extra_rtrn); if ((!xkb->cvt.KSToUpper) && (mods & LockMask)) { register int i; int change; for (i = change = 0; i < n; i++) { char ch = toupper(buffer[i]); change = (change || (buffer[i] != ch)); buffer[i] = ch; } if (change) { if (n == 1) *sym_rtrn = (*xkb->cvt.MBToKS) (xkb->cvt.MBToKSPriv, buffer, n, NULL); else *sym_rtrn = NoSymbol; } } if (mods & ControlMask) { if (n == 1) { buffer[0] = XkbToControl(buffer[0]); if (nbytes > 1) buffer[1] = '\0'; return 1; } if (nbytes > 0) buffer[0] = '\0'; return 0; } return n; } int XLookupString(register XKeyEvent *event, char *buffer, int nbytes, KeySym *keysym, XComposeStatus *status) { KeySym dummy; int rtrnLen; unsigned int new_mods; Display *dpy = event->display; if (keysym == NULL) keysym = &dummy; if (!XkbLookupKeySym(dpy, event->keycode, event->state, &new_mods, keysym)) return 0; new_mods = (event->state & (~new_mods)); /* find the group where a symbol can be converted to control one */ if (new_mods & ControlMask && *keysym > 0x7F && (dpy->xkb_info->xlib_ctrls & XkbLC_ControlFallback)) { XKeyEvent tmp_ev = *event; KeySym tmp_keysym; unsigned int tmp_new_mods; if (_XkbUnavailable(dpy)) { tmp_ev.state = event->state ^ dpy->mode_switch; if (XkbLookupKeySym(dpy, tmp_ev.keycode, tmp_ev.state, &tmp_new_mods, &tmp_keysym) && tmp_keysym != NoSymbol && tmp_keysym < 0x80) { *keysym = tmp_keysym; } } else { int n = XkbKeyNumGroups(dpy->xkb_info->desc, tmp_ev.keycode); int i; for (i = 0; i < n; i++) { if (XkbGroupForCoreState(event->state) == i) continue; tmp_ev.state = XkbBuildCoreState(tmp_ev.state, i); if (XkbLookupKeySym(dpy, tmp_ev.keycode, tmp_ev.state, &tmp_new_mods, &tmp_keysym) && tmp_keysym != NoSymbol && tmp_keysym < 0x80) { *keysym = tmp_keysym; new_mods = (event->state & (~tmp_new_mods)); break; } } } } /* We *should* use the new_mods (which does not contain any modifiers */ /* that were used to compute the symbol here, but pre-XKB XLookupString */ /* did not and we have to remain compatible. Sigh. */ if (_XkbUnavailable(dpy) || (dpy->xkb_info->xlib_ctrls & XkbLC_ConsumeLookupMods) == 0) new_mods = event->state; rtrnLen = XkbLookupKeyBinding(dpy, *keysym, new_mods, buffer, nbytes, NULL); if (rtrnLen > 0) return rtrnLen; return XkbTranslateKeySym(dpy, keysym, new_mods, buffer, nbytes, NULL); } int XkbLookupKeyBinding(Display *dpy, register KeySym sym, unsigned int mods, char *buffer, int nbytes, int *extra_rtrn) { register struct _XKeytrans *p; if (extra_rtrn) *extra_rtrn = 0; for (p = dpy->key_bindings; p; p = p->next) { if (((mods & AllMods) == p->state) && (sym == p->key)) { int tmp = p->len; if (tmp > nbytes) { if (extra_rtrn) *extra_rtrn = (tmp - nbytes); tmp = nbytes; } memcpy(buffer, p->string, tmp); if (tmp < nbytes) buffer[tmp] = '\0'; return tmp; } } return 0; } char XkbToControl(char ch) { register char c = ch; if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F; else if (c == '2') c = '\000'; else if (c >= '3' && c <= '7') c -= ('3' - '\033'); else if (c == '8') c = '\177'; else if (c == '/') c = '_' & 0x1F; return c; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKB.c0000644000000000000000000005553613614532331014232 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include #include "XKBlibint.h" XkbInternAtomFunc _XkbInternAtomFunc = XInternAtom; XkbGetAtomNameFunc _XkbGetAtomNameFunc = XGetAtomName; Bool XkbQueryExtension(Display *dpy, int *opcodeReturn, int *eventBaseReturn, int *errorBaseReturn, int *majorReturn, int *minorReturn) { if (!XkbUseExtension(dpy, majorReturn, minorReturn)) return False; if (opcodeReturn) *opcodeReturn = dpy->xkb_info->codes->major_opcode; if (eventBaseReturn) *eventBaseReturn = dpy->xkb_info->codes->first_event; if (errorBaseReturn) *errorBaseReturn = dpy->xkb_info->codes->first_error; if (majorReturn) *majorReturn = dpy->xkb_info->srv_major; if (minorReturn) *minorReturn = dpy->xkb_info->srv_minor; return True; } Bool XkbLibraryVersion(int *libMajorRtrn, int *libMinorRtrn) { int supported; if (*libMajorRtrn != XkbMajorVersion) { /* version 0.65 is (almost) compatible with 1.00 */ if ((XkbMajorVersion == 1) && (((*libMajorRtrn) == 0) && ((*libMinorRtrn) == 65))) supported = True; else supported = False; } else { supported = True; } *libMajorRtrn = XkbMajorVersion; *libMinorRtrn = XkbMinorVersion; return supported; } Bool XkbSelectEvents(Display *dpy, unsigned int deviceSpec, unsigned int affect, unsigned int selectAll) { register xkbSelectEventsReq *req; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; xkbi->selected_events &= ~affect; xkbi->selected_events |= (affect & selectAll); GetReq(kbSelectEvents, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbSelectEvents; req->deviceSpec = deviceSpec; req->affectWhich = (CARD16) affect; req->clear = affect & (~selectAll); req->selectAll = affect & selectAll; if (affect & XkbMapNotifyMask) { req->affectMap = XkbAllMapComponentsMask; /* the implicit support needs the client info */ /* even if the client itself doesn't want it */ if (selectAll & XkbMapNotifyMask) req->map = XkbAllMapEventsMask; else req->map = XkbAllClientInfoMask; if (selectAll & XkbMapNotifyMask) xkbi->selected_map_details = XkbAllMapEventsMask; else xkbi->selected_map_details = 0; } if (affect & XkbNewKeyboardNotifyMask) { if (selectAll & XkbNewKeyboardNotifyMask) xkbi->selected_nkn_details = XkbAllNewKeyboardEventsMask; else xkbi->selected_nkn_details = 0; if (!(xkbi->xlib_ctrls & XkbLC_IgnoreNewKeyboards)) { /* we want it, even if the client doesn't. Don't mess */ /* around with details -- ask for all of them and throw */ /* away the ones we don't need */ req->selectAll |= XkbNewKeyboardNotifyMask; } } UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbSelectEventDetails(Display *dpy, unsigned deviceSpec, unsigned eventType, unsigned long int affect, unsigned long int details) { register xkbSelectEventsReq *req; XkbInfoPtr xkbi; int size = 0; char *out; union { CARD8 *c8; CARD16 *c16; CARD32 *c32; } u; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; if (affect & details) xkbi->selected_events |= (1 << eventType); else xkbi->selected_events &= ~(1 << eventType); GetReq(kbSelectEvents, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbSelectEvents; req->deviceSpec = deviceSpec; req->clear = req->selectAll = 0; if (eventType == XkbMapNotify) { /* we need all of the client info, even if the application */ /* doesn't. Make sure that we always request the stuff */ /* that the implicit support needs, and just filter out anything */ /* the client doesn't want later */ req->affectMap = (CARD16) affect; req->map = (CARD16) details | (XkbAllClientInfoMask & affect); req->affectWhich = XkbMapNotifyMask; xkbi->selected_map_details &= ~affect; xkbi->selected_map_details |= (details & affect); } else { req->affectMap = req->map = 0; req->affectWhich = (1 << eventType); switch (eventType) { case XkbNewKeyboardNotify: xkbi->selected_nkn_details &= ~affect; xkbi->selected_nkn_details |= (details & affect); if (!(xkbi->xlib_ctrls & XkbLC_IgnoreNewKeyboards)) details = (affect & XkbAllNewKeyboardEventsMask); case XkbStateNotify: case XkbNamesNotify: case XkbAccessXNotify: case XkbExtensionDeviceNotify: size = 2; req->length += 1; break; case XkbControlsNotify: case XkbIndicatorStateNotify: case XkbIndicatorMapNotify: size = 4; req->length += 2; break; case XkbBellNotify: case XkbActionMessage: case XkbCompatMapNotify: size = 1; req->length += 1; break; } BufAlloc(char *, out, (((size * 2) + (unsigned) 3) / 4) * 4); u.c8 = (CARD8 *) out; if (size == 2) { u.c16[0] = (CARD16) affect; u.c16[1] = (CARD16) details; } else if (size == 4) { u.c32[0] = (CARD32) affect; u.c32[1] = (CARD32) details; } else { u.c8[0] = (CARD8) affect; u.c8[1] = (CARD8) details; } } UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbLockModifiers(Display *dpy, unsigned int deviceSpec, unsigned int affect, unsigned int values) { register xkbLatchLockStateReq *req; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbLatchLockState, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbLatchLockState; req->deviceSpec = deviceSpec; req->affectModLocks = affect; req->modLocks = values; req->lockGroup = False; req->groupLock = 0; req->affectModLatches = req->modLatches = 0; req->latchGroup = False; req->groupLatch = 0; UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbLatchModifiers(Display *dpy, unsigned int deviceSpec, unsigned int affect, unsigned int values) { register xkbLatchLockStateReq *req; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbLatchLockState, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbLatchLockState; req->deviceSpec = deviceSpec; req->affectModLatches = affect; req->modLatches = values; req->latchGroup = False; req->groupLatch = 0; req->affectModLocks = req->modLocks = 0; req->lockGroup = False; req->groupLock = 0; UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbLockGroup(Display *dpy, unsigned int deviceSpec, unsigned int group) { register xkbLatchLockStateReq *req; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbLatchLockState, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbLatchLockState; req->deviceSpec = deviceSpec; req->affectModLocks = 0; req->modLocks = 0; req->lockGroup = True; req->groupLock = group; req->affectModLatches = req->modLatches = 0; req->latchGroup = False; req->groupLatch = 0; UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbLatchGroup(Display *dpy, unsigned int deviceSpec, unsigned int group) { register xkbLatchLockStateReq *req; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbLatchLockState, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbLatchLockState; req->deviceSpec = deviceSpec; req->affectModLatches = 0; req->modLatches = 0; req->latchGroup = True; req->groupLatch = group; req->affectModLocks = req->modLocks = 0; req->lockGroup = False; req->groupLock = 0; UnlockDisplay(dpy); SyncHandle(); return True; } unsigned XkbSetXlibControls(Display *dpy, unsigned affect, unsigned values) { if (!dpy->xkb_info) XkbUseExtension(dpy, NULL, NULL); if (!dpy->xkb_info) return 0; affect &= XkbLC_AllControls; dpy->xkb_info->xlib_ctrls &= ~affect; dpy->xkb_info->xlib_ctrls |= (affect & values); return dpy->xkb_info->xlib_ctrls; } unsigned XkbGetXlibControls(Display *dpy) { if (!dpy->xkb_info) XkbUseExtension(dpy, NULL, NULL); if (!dpy->xkb_info) return 0; return dpy->xkb_info->xlib_ctrls; } unsigned int XkbXlibControlsImplemented(void) { return XkbLC_AllControls & ~XkbLC_AllComposeControls; } Bool XkbSetDebuggingFlags(Display *dpy, unsigned int mask, unsigned int flags, char *msg, unsigned int ctrls_mask, unsigned int ctrls, unsigned int *rtrn_flags, unsigned int *rtrn_ctrls) { register xkbSetDebuggingFlagsReq *req; xkbSetDebuggingFlagsReply rep; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbSetDebuggingFlags, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbSetDebuggingFlags; req->affectFlags = mask; req->flags = flags; req->affectCtrls = ctrls_mask; req->ctrls = ctrls; if (msg) { char *out; req->msgLength = (unsigned short) strlen(msg) + 1; req->length += (req->msgLength + (unsigned) 3) >> 2; BufAlloc(char *, out, ((req->msgLength + (unsigned) 3) / 4) * 4); memcpy(out, msg, req->msgLength); } else req->msgLength = 0; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } if (rtrn_flags) *rtrn_flags = rep.currentFlags; if (rtrn_ctrls) *rtrn_ctrls = rep.currentCtrls; UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbComputeEffectiveMap(XkbDescPtr xkb, XkbKeyTypePtr type, unsigned char *map_rtrn) { register int i; unsigned tmp; XkbKTMapEntryPtr entry = NULL; if ((!xkb) || (!type) || (!xkb->server)) return False; if (type->mods.vmods != 0) { if (!XkbVirtualModsToReal(xkb, type->mods.vmods, &tmp)) return False; type->mods.mask = tmp | type->mods.real_mods; entry = type->map; for (i = 0; i < type->map_count; i++, entry++) { tmp = 0; if (entry->mods.vmods != 0) { if (!XkbVirtualModsToReal(xkb, entry->mods.vmods, &tmp)) return False; if (tmp == 0) { entry->active = False; continue; } } entry->active = True; entry->mods.mask = (entry->mods.real_mods | tmp) & type->mods.mask; } } else { type->mods.mask = type->mods.real_mods; } if (map_rtrn != NULL) { bzero(map_rtrn, type->mods.mask + 1); for (i = 0; i < type->map_count; i++) { if (entry && entry->active) { map_rtrn[type->map[i].mods.mask] = type->map[i].level; } } } return True; } Status XkbGetState(Display *dpy, unsigned deviceSpec, XkbStatePtr rtrn) { register xkbGetStateReq *req; xkbGetStateReply rep; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbGetState, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbGetState; req->deviceSpec = deviceSpec; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return BadImplementation; } rtrn->mods = rep.mods; rtrn->base_mods = rep.baseMods; rtrn->latched_mods = rep.latchedMods; rtrn->locked_mods = rep.lockedMods; rtrn->group = rep.group; rtrn->base_group = rep.baseGroup; rtrn->latched_group = rep.latchedGroup; rtrn->locked_group = rep.lockedGroup; rtrn->compat_state = rep.compatState; rtrn->grab_mods = rep.grabMods; rtrn->compat_grab_mods = rep.compatGrabMods; rtrn->lookup_mods = rep.lookupMods; rtrn->compat_lookup_mods = rep.compatLookupMods; rtrn->ptr_buttons = rep.ptrBtnState; UnlockDisplay(dpy); SyncHandle(); return Success; } Bool XkbSetDetectableAutoRepeat(Display *dpy, Bool detectable, Bool *supported) { register xkbPerClientFlagsReq *req; xkbPerClientFlagsReply rep; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbPerClientFlags, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbPerClientFlags; req->deviceSpec = XkbUseCoreKbd; req->change = XkbPCF_DetectableAutoRepeatMask; if (detectable) req->value = XkbPCF_DetectableAutoRepeatMask; else req->value = 0; req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } UnlockDisplay(dpy); SyncHandle(); if (supported != NULL) *supported = ((rep.supported & XkbPCF_DetectableAutoRepeatMask) != 0); return ((rep.value & XkbPCF_DetectableAutoRepeatMask) != 0); } Bool XkbGetDetectableAutoRepeat(Display *dpy, Bool *supported) { register xkbPerClientFlagsReq *req; xkbPerClientFlagsReply rep; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbPerClientFlags, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbPerClientFlags; req->deviceSpec = XkbUseCoreKbd; req->change = 0; req->value = 0; req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } UnlockDisplay(dpy); SyncHandle(); if (supported != NULL) *supported = ((rep.supported & XkbPCF_DetectableAutoRepeatMask) != 0); return ((rep.value & XkbPCF_DetectableAutoRepeatMask) != 0); } Bool XkbSetAutoResetControls(Display *dpy, unsigned changes, unsigned *auto_ctrls, unsigned *auto_values) { register xkbPerClientFlagsReq *req; xkbPerClientFlagsReply rep; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbPerClientFlags, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbPerClientFlags; req->change = XkbPCF_AutoResetControlsMask; req->deviceSpec = XkbUseCoreKbd; req->value = XkbPCF_AutoResetControlsMask; req->ctrlsToChange = changes; req->autoCtrls = *auto_ctrls; req->autoCtrlValues = *auto_values; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } UnlockDisplay(dpy); SyncHandle(); *auto_ctrls = rep.autoCtrls; *auto_values = rep.autoCtrlValues; return ((rep.value & XkbPCF_AutoResetControlsMask) != 0); } Bool XkbGetAutoResetControls(Display *dpy, unsigned *auto_ctrls, unsigned *auto_ctrl_values) { register xkbPerClientFlagsReq *req; xkbPerClientFlagsReply rep; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbPerClientFlags, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbPerClientFlags; req->deviceSpec = XkbUseCoreKbd; req->change = 0; req->value = 0; req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } UnlockDisplay(dpy); SyncHandle(); if (auto_ctrls) *auto_ctrls = rep.autoCtrls; if (auto_ctrl_values) *auto_ctrl_values = rep.autoCtrlValues; return ((rep.value & XkbPCF_AutoResetControlsMask) != 0); } Bool XkbSetPerClientControls(Display *dpy, unsigned change, unsigned *values) { register xkbPerClientFlagsReq *req; xkbPerClientFlagsReply rep; XkbInfoPtr xkbi; unsigned value_hold = *values; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || (change & ~(XkbPCF_GrabsUseXKBStateMask | XkbPCF_LookupStateWhenGrabbed | XkbPCF_SendEventUsesXKBState))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbPerClientFlags, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbPerClientFlags; req->change = change; req->deviceSpec = XkbUseCoreKbd; req->value = *values; req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } UnlockDisplay(dpy); SyncHandle(); *values = rep.value; return ((rep.value & value_hold) != 0); } Bool XkbGetPerClientControls(Display *dpy, unsigned *ctrls) { register xkbPerClientFlagsReq *req; xkbPerClientFlagsReply rep; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || (ctrls == NULL)) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbPerClientFlags, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbPerClientFlags; req->deviceSpec = XkbUseCoreKbd; req->change = 0; req->value = 0; req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } UnlockDisplay(dpy); SyncHandle(); *ctrls = (rep.value & (XkbPCF_GrabsUseXKBStateMask | XkbPCF_LookupStateWhenGrabbed | XkbPCF_SendEventUsesXKBState)); return (True); } Display * XkbOpenDisplay(char *name, int *ev_rtrn, int *err_rtrn, int *major_rtrn, int *minor_rtrn, int *reason) { Display *dpy; int major_num, minor_num; if ((major_rtrn != NULL) && (minor_rtrn != NULL)) { if (!XkbLibraryVersion(major_rtrn, minor_rtrn)) { if (reason != NULL) *reason = XkbOD_BadLibraryVersion; return NULL; } } else { major_num = XkbMajorVersion; minor_num = XkbMinorVersion; major_rtrn = &major_num; minor_rtrn = &minor_num; } dpy = XOpenDisplay(name); if (dpy == NULL) { if (reason != NULL) *reason = XkbOD_ConnectionRefused; return NULL; } if (!XkbQueryExtension(dpy, NULL, ev_rtrn, err_rtrn, major_rtrn, minor_rtrn)) { if (reason != NULL) { if ((*major_rtrn != 0) || (*minor_rtrn != 0)) *reason = XkbOD_BadServerVersion; else *reason = XkbOD_NonXkbServer; } XCloseDisplay(dpy); return NULL; } if (reason != NULL) *reason = XkbOD_Success; return dpy; } void XkbSetAtomFuncs(XkbInternAtomFunc getAtom, XkbGetAtomNameFunc getName) { _XkbInternAtomFunc = (getAtom ? getAtom : XInternAtom); _XkbGetAtomNameFunc = (getName ? getName : XGetAtomName); return; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBCompat.c0000644000000000000000000001734213614532331015367 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #define NEED_MAP_READERS #include "Xlibint.h" #include #include "XKBlibint.h" Status _XkbReadGetCompatMapReply(Display *dpy, xkbGetCompatMapReply *rep, XkbDescPtr xkb, int *nread_rtrn) { register int i; XkbReadBufferRec buf; if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) return BadAlloc; if (nread_rtrn) *nread_rtrn = (int) rep->length * 4; i = rep->firstSI + rep->nSI; if ((!xkb->compat) && (XkbAllocCompatMap(xkb, XkbAllCompatMask, i) != Success)) return BadAlloc; if (rep->nSI != 0) { XkbSymInterpretRec *syms; xkbSymInterpretWireDesc *wire; wire = (xkbSymInterpretWireDesc *) _XkbGetReadBufferPtr(&buf, rep->nSI * SIZEOF (xkbSymInterpretWireDesc)); if (wire == NULL) goto BAILOUT; syms = &xkb->compat->sym_interpret[rep->firstSI]; for (i = 0; i < rep->nSI; i++, syms++, wire++) { syms->sym = wire->sym; syms->mods = wire->mods; syms->match = wire->match; syms->virtual_mod = wire->virtualMod; syms->flags = wire->flags; syms->act = *((XkbAnyAction *) &wire->act); } xkb->compat->num_si += rep->nSI; } if (rep->groups & XkbAllGroupsMask) { register unsigned bit, nGroups; xkbModsWireDesc *wire; for (i = 0, nGroups = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) { if (rep->groups & bit) nGroups++; } wire = (xkbModsWireDesc *) _XkbGetReadBufferPtr(&buf, nGroups * SIZEOF(xkbModsWireDesc)); if (wire == NULL) goto BAILOUT; for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) { if ((rep->groups & bit) == 0) continue; xkb->compat->groups[i].mask = wire->mask; xkb->compat->groups[i].real_mods = wire->realMods; xkb->compat->groups[i].vmods = wire->virtualMods; wire++; } } i = _XkbFreeReadBuffer(&buf); if (i) fprintf(stderr, "CompatMapReply! Bad length (%d extra bytes)\n", i); if (i || buf.error) return BadLength; return Success; BAILOUT: _XkbFreeReadBuffer(&buf); return BadLength; } Status XkbGetCompatMap(Display *dpy, unsigned which, XkbDescPtr xkb) { register xkbGetCompatMapReq *req; xkbGetCompatMapReply rep; Status status; XkbInfoPtr xkbi; if ((!dpy) || (!xkb) || (dpy->flags & XlibDisplayNoXkb) || ((xkb->dpy != NULL) && (xkb->dpy != dpy)) || (!dpy->xkb_info && (!XkbUseExtension(dpy, NULL, NULL)))) return BadAccess; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbGetCompatMap, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbGetCompatMap; req->deviceSpec = xkb->device_spec; if (which & XkbSymInterpMask) req->getAllSI = True; else req->getAllSI = False; req->firstSI = req->nSI = 0; if (which & XkbGroupCompatMask) req->groups = XkbAllGroupsMask; else req->groups = 0; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return BadLength; } if (xkb->dpy == NULL) xkb->dpy = dpy; if (xkb->device_spec == XkbUseCoreKbd) xkb->device_spec = rep.deviceID; status = _XkbReadGetCompatMapReply(dpy, &rep, xkb, NULL); UnlockDisplay(dpy); SyncHandle(); return status; } static Bool _XkbWriteSetCompatMap(Display *dpy, xkbSetCompatMapReq *req, XkbDescPtr xkb) { CARD16 firstSI; CARD16 nSI; int size; register int i, nGroups; register unsigned bit; unsigned groups; char *buf; firstSI = req->firstSI; nSI = req->nSI; size = nSI * SIZEOF(xkbSymInterpretWireDesc); nGroups = 0; groups = req->groups; if (groups & XkbAllGroupsMask) { for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) { if (groups & bit) nGroups++; } size += SIZEOF(xkbModsWireDesc) * nGroups; } req->length += size / 4; BufAlloc(char *, buf, size); if (!buf) return False; if (nSI) { XkbSymInterpretPtr sym = &xkb->compat->sym_interpret[firstSI]; xkbSymInterpretWireDesc *wire = (xkbSymInterpretWireDesc *) buf; for (i = 0; i < nSI; i++, wire++, sym++) { wire->sym = (CARD32) sym->sym; wire->mods = sym->mods; wire->match = sym->match; wire->flags = sym->flags; wire->virtualMod = sym->virtual_mod; memcpy(&wire->act, &sym->act, sz_xkbActionWireDesc); } buf += nSI * SIZEOF(xkbSymInterpretWireDesc); } if (groups & XkbAllGroupsMask) { xkbModsWireDesc *out = (xkbModsWireDesc *) buf; for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) { if ((groups & bit) != 0) { out->mask = xkb->compat->groups[i].mask; out->realMods = xkb->compat->groups[i].real_mods; out->virtualMods = xkb->compat->groups[i].vmods; out++; } } buf += nGroups * SIZEOF(xkbModsWireDesc); } return True; } Bool XkbSetCompatMap(Display *dpy, unsigned which, XkbDescPtr xkb, Bool updateActions) { register xkbSetCompatMapReq *req; Status ok; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (dpy != xkb->dpy) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; if ((!xkb->compat) || ((which & XkbSymInterpMask) && (!xkb->compat->sym_interpret))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbSetCompatMap, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbSetCompatMap; req->deviceSpec = xkb->device_spec; req->recomputeActions = updateActions; if (which & XkbSymInterpMask) { req->truncateSI = True; req->firstSI = 0; req->nSI = xkb->compat->num_si; } else { req->truncateSI = False; req->firstSI = 0; req->nSI = 0; } if (which & XkbGroupCompatMask) req->groups = XkbAllGroupsMask; else req->groups = 0; ok = _XkbWriteSetCompatMap(dpy, req, xkb); UnlockDisplay(dpy); SyncHandle(); return ok; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBCtrls.c0000644000000000000000000002705413614532331015234 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include #include "XKBlibint.h" static xkbSetControlsReq * _XkbGetSetControlsReq(Display *dpy, XkbInfoPtr xkbi, unsigned int deviceSpec) { xkbSetControlsReq *req; GetReq(kbSetControls, req); bzero(req, SIZEOF(xkbSetControlsReq)); req->reqType = xkbi->codes->major_opcode; req->length = (SIZEOF(xkbSetControlsReq) >> 2); req->xkbReqType = X_kbSetControls; req->deviceSpec = deviceSpec; return req; } Bool XkbSetAutoRepeatRate(Display *dpy, unsigned int deviceSpec, unsigned int timeout, unsigned int interval) { register xkbSetControlsReq *req; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, deviceSpec); req->changeCtrls = XkbRepeatKeysMask; req->repeatDelay = timeout; req->repeatInterval = interval; UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbGetAutoRepeatRate(Display *dpy, unsigned int deviceSpec, unsigned int *timeoutp, unsigned int *intervalp) { register xkbGetControlsReq *req; xkbGetControlsReply rep; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbGetControls, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbGetControls; req->deviceSpec = deviceSpec; if (!_XReply(dpy, (xReply *) &rep, (SIZEOF(xkbGetControlsReply) - SIZEOF(xReply)) >> 2, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } UnlockDisplay(dpy); SyncHandle(); *timeoutp = rep.repeatDelay; *intervalp = rep.repeatInterval; return True; } Bool XkbSetServerInternalMods(Display *dpy, unsigned deviceSpec, unsigned affectReal, unsigned realValues, unsigned affectVirtual, unsigned virtualValues) { register xkbSetControlsReq *req; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, deviceSpec); req->affectInternalMods = affectReal; req->internalMods = realValues; req->affectInternalVMods = affectVirtual; req->internalVMods = virtualValues; req->changeCtrls = XkbInternalModsMask; UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbSetIgnoreLockMods(Display *dpy, unsigned int deviceSpec, unsigned affectReal, unsigned realValues, unsigned affectVirtual, unsigned virtualValues) { register xkbSetControlsReq *req; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, deviceSpec); req->affectIgnoreLockMods = affectReal; req->ignoreLockMods = realValues; req->affectIgnoreLockVMods = affectVirtual; req->ignoreLockVMods = virtualValues; req->changeCtrls = XkbIgnoreLockModsMask; UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbChangeEnabledControls(Display *dpy, unsigned deviceSpec, unsigned affect, unsigned values) { register xkbSetControlsReq *req; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, deviceSpec); req->affectEnabledCtrls = affect; req->enabledCtrls = (affect & values); req->changeCtrls = XkbControlsEnabledMask; UnlockDisplay(dpy); SyncHandle(); return True; } Status XkbGetControls(Display *dpy, unsigned long which, XkbDescPtr xkb) { register xkbGetControlsReq *req; xkbGetControlsReply rep; XkbControlsPtr ctrls; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; if ((!xkb) || (!which)) return BadMatch; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbGetControls, req); if (!xkb->ctrls) { xkb->ctrls = _XkbTypedCalloc(1, XkbControlsRec); if (!xkb->ctrls) { UnlockDisplay(dpy); SyncHandle(); return BadAlloc; } } req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbGetControls; req->deviceSpec = xkb->device_spec; if (!_XReply(dpy, (xReply *) &rep, (SIZEOF(xkbGetControlsReply) - SIZEOF(xReply)) >> 2, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return BadImplementation; } if (xkb->device_spec == XkbUseCoreKbd) xkb->device_spec = rep.deviceID; ctrls = xkb->ctrls; if (which & XkbControlsEnabledMask) ctrls->enabled_ctrls = rep.enabledCtrls; ctrls->num_groups = rep.numGroups; if (which & XkbGroupsWrapMask) ctrls->groups_wrap = rep.groupsWrap; if (which & XkbInternalModsMask) { ctrls->internal.mask = rep.internalMods; ctrls->internal.real_mods = rep.internalRealMods; ctrls->internal.vmods = rep.internalVMods; } if (which & XkbIgnoreLockModsMask) { ctrls->ignore_lock.mask = rep.ignoreLockMods; ctrls->ignore_lock.real_mods = rep.ignoreLockRealMods; ctrls->ignore_lock.vmods = rep.ignoreLockVMods; } if (which & XkbRepeatKeysMask) { ctrls->repeat_delay = rep.repeatDelay; ctrls->repeat_interval = rep.repeatInterval; } if (which & XkbSlowKeysMask) ctrls->slow_keys_delay = rep.slowKeysDelay; if (which & XkbBounceKeysMask) ctrls->debounce_delay = rep.debounceDelay; if (which & XkbMouseKeysMask) { ctrls->mk_dflt_btn = rep.mkDfltBtn; } if (which & XkbMouseKeysAccelMask) { ctrls->mk_delay = rep.mkDelay; ctrls->mk_interval = rep.mkInterval; ctrls->mk_time_to_max = rep.mkTimeToMax; ctrls->mk_max_speed = rep.mkMaxSpeed; ctrls->mk_curve = rep.mkCurve; } if (which & XkbAccessXKeysMask) ctrls->ax_options = rep.axOptions; if (which & XkbStickyKeysMask) { ctrls->ax_options &= ~XkbAX_SKOptionsMask; ctrls->ax_options |= rep.axOptions & XkbAX_SKOptionsMask; } if (which & XkbAccessXFeedbackMask) { ctrls->ax_options &= ~XkbAX_FBOptionsMask; ctrls->ax_options |= rep.axOptions & XkbAX_FBOptionsMask; } if (which & XkbAccessXTimeoutMask) { ctrls->ax_timeout = rep.axTimeout; ctrls->axt_ctrls_mask = rep.axtCtrlsMask; ctrls->axt_ctrls_values = rep.axtCtrlsValues; ctrls->axt_opts_mask = rep.axtOptsMask; ctrls->axt_opts_values = rep.axtOptsValues; } if (which & XkbPerKeyRepeatMask) { memcpy(ctrls->per_key_repeat, rep.perKeyRepeat, XkbPerKeyBitArraySize); } UnlockDisplay(dpy); SyncHandle(); return Success; } Bool XkbSetControls(Display *dpy, unsigned long which, XkbDescPtr xkb) { register xkbSetControlsReq *req; XkbControlsPtr ctrls; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; if ((!xkb) || (!xkb->ctrls)) return False; ctrls = xkb->ctrls; LockDisplay(dpy); req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, xkb->device_spec); req->changeCtrls = (CARD32) which; if (which & XkbInternalModsMask) { req->affectInternalMods = ~0; req->internalMods = ctrls->internal.real_mods; req->affectInternalVMods = ~0; req->internalVMods = ctrls->internal.vmods; } if (which & XkbIgnoreLockModsMask) { req->affectIgnoreLockMods = ~0; req->ignoreLockMods = ctrls->ignore_lock.real_mods; req->affectIgnoreLockVMods = ~0; req->ignoreLockVMods = ctrls->ignore_lock.vmods; } if (which & XkbControlsEnabledMask) { req->affectEnabledCtrls = XkbAllBooleanCtrlsMask; req->enabledCtrls = ctrls->enabled_ctrls; } if (which & XkbRepeatKeysMask) { req->repeatDelay = ctrls->repeat_delay; req->repeatInterval = ctrls->repeat_interval; } if (which & XkbSlowKeysMask) req->slowKeysDelay = ctrls->slow_keys_delay; if (which & XkbBounceKeysMask) req->debounceDelay = ctrls->debounce_delay; if (which & XkbMouseKeysMask) { req->mkDfltBtn = ctrls->mk_dflt_btn; } if (which & XkbGroupsWrapMask) req->groupsWrap = ctrls->groups_wrap; if (which & (XkbAccessXKeysMask | XkbStickyKeysMask | XkbAccessXFeedbackMask)) req->axOptions = ctrls->ax_options; if (which & XkbMouseKeysAccelMask) { req->mkDelay = ctrls->mk_delay; req->mkInterval = ctrls->mk_interval; req->mkTimeToMax = ctrls->mk_time_to_max; req->mkMaxSpeed = ctrls->mk_max_speed; req->mkCurve = ctrls->mk_curve; } if (which & XkbAccessXTimeoutMask) { req->axTimeout = ctrls->ax_timeout; req->axtCtrlsMask = ctrls->axt_ctrls_mask; req->axtCtrlsValues = ctrls->axt_ctrls_values; req->axtOptsMask = ctrls->axt_opts_mask; req->axtOptsValues = ctrls->axt_opts_values; } if (which & XkbPerKeyRepeatMask) { memcpy(req->perKeyRepeat, ctrls->per_key_repeat, XkbPerKeyBitArraySize); } UnlockDisplay(dpy); SyncHandle(); return True; } /***====================================================================***/ void XkbNoteControlsChanges(XkbControlsChangesPtr old, XkbControlsNotifyEvent *new, unsigned int wanted) { old->changed_ctrls |= (new->changed_ctrls & wanted); if (new->changed_ctrls & XkbControlsEnabledMask & wanted) old->enabled_ctrls_changes ^= new->enabled_ctrl_changes; /* num_groups_changed?? */ return; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBCvt.c0000644000000000000000000002254713614532331014703 0ustar /* Copyright 1988, 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "Xlibint.h" #include "Xlcint.h" #include "XlcPubI.h" #include "Ximint.h" #include #include #define XK_LATIN1 #define XK_PUBLISHING #include #include #include "XKBlibint.h" #include #include #include static int _XkbHandleSpecialSym(KeySym keysym, char *buffer, int nbytes, int *extra_rtrn) { /* try to convert to Latin-1, handling ctrl */ if (!(((keysym >= XK_BackSpace) && (keysym <= XK_Clear)) || (keysym == XK_Return) || (keysym == XK_Escape) || (keysym == XK_KP_Space) || (keysym == XK_KP_Tab) || (keysym == XK_KP_Enter) || ((keysym >= XK_KP_Multiply) && (keysym <= XK_KP_9)) || (keysym == XK_KP_Equal) || (keysym == XK_Delete))) return 0; if (nbytes < 1) { if (extra_rtrn) *extra_rtrn = 1; return 0; } /* if X keysym, convert to ascii by grabbing low 7 bits */ if (keysym == XK_KP_Space) buffer[0] = XK_space & 0x7F; /* patch encoding botch */ else if (keysym == XK_hyphen) buffer[0] = (char) (XK_minus & 0xFF); /* map to equiv character */ else buffer[0] = (char) (keysym & 0x7F); return 1; } /*ARGSUSED*/ static int _XkbKSToKnownSet(XPointer priv, KeySym keysym, char *buffer, int nbytes, int *extra_rtrn) { char tbuf[8], *buf; if (extra_rtrn) *extra_rtrn = 0; /* convert "dead" diacriticals for dumb applications */ if ((keysym & 0xffffff00) == 0xfe00) { switch (keysym) { case XK_dead_grave: keysym = XK_grave; break; case XK_dead_acute: keysym = XK_acute; break; case XK_dead_circumflex: keysym = XK_asciicircum; break; case XK_dead_tilde: keysym = XK_asciitilde; break; case XK_dead_macron: keysym = XK_macron; break; case XK_dead_breve: keysym = XK_breve; break; case XK_dead_abovedot: keysym = XK_abovedot; break; case XK_dead_diaeresis: keysym = XK_diaeresis; break; case XK_dead_abovering: keysym = XK_degree; break; case XK_dead_doubleacute: keysym = XK_doubleacute; break; case XK_dead_caron: keysym = XK_caron; break; case XK_dead_cedilla: keysym = XK_cedilla; break; case XK_dead_ogonek: keysym = XK_ogonek; break; case XK_dead_iota: keysym = XK_Greek_iota; break; #ifdef XK_KATAKANA case XK_dead_voiced_sound: keysym = XK_voicedsound; break; case XK_dead_semivoiced_sound: keysym = XK_semivoicedsound; break; #endif } } if (nbytes < 1) buf = tbuf; else buf = buffer; if ((keysym & 0xffffff00) == 0xff00) { return _XkbHandleSpecialSym(keysym, buf, nbytes, extra_rtrn); } return _XimGetCharCode(priv, keysym, (unsigned char *) buf, nbytes); } typedef struct _XkbToKS { unsigned prefix; char *map; } XkbToKS; /*ARGSUSED*/ static KeySym _XkbKnownSetToKS(XPointer priv, char *buffer, int nbytes, Status *status) { if (nbytes != 1) return NoSymbol; if (((buffer[0] & 0x80) == 0) && (buffer[0] >= 32)) return buffer[0]; else if ((buffer[0] & 0x7f) >= 32) { XkbToKS *map = (XkbToKS *) priv; if (map) { if (map->map) return map->prefix | map->map[buffer[0] & 0x7f]; else return map->prefix | buffer[0]; } return buffer[0]; } return NoSymbol; } static KeySym __XkbDefaultToUpper(KeySym sym) { KeySym lower, upper; XConvertCase(sym, &lower, &upper); return upper; } #ifdef XKB_EXTEND_LOOKUP_STRING static int Strcmp(char *str1, char *str2) { char str[256]; char c, *s; /* * unchecked strings from the environment can end up here, so check * the length before copying. */ if (strlen(str1) >= sizeof(str)) /* almost certain it's a mismatch */ return 1; for (s = str; (c = *str1++);) { if (isupper(c)) c = tolower(c); *s++ = c; } *s = '\0'; return (strcmp(str, str2)); } #endif int _XkbGetConverters(const char *encoding_name, XkbConverters * cvt_rtrn) { if (!cvt_rtrn) return 0; cvt_rtrn->KSToMB = _XkbKSToKnownSet; cvt_rtrn->KSToMBPriv = _XimGetLocaleCode(encoding_name); cvt_rtrn->MBToKS = _XkbKnownSetToKS; cvt_rtrn->MBToKSPriv = NULL; cvt_rtrn->KSToUpper = __XkbDefaultToUpper; return 1; } /***====================================================================***/ /* * The function _XkbGetCharset seems to be missnamed as what it seems to * be used for is to determine the encoding-name for the locale. ??? */ #ifdef XKB_EXTEND_LOOKUP_STRING /* * XKB_EXTEND_LOOKUP_STRING is not used by the SI. It is used by various * X Consortium/X Project Team members, so we leave it in the source as * an simplify integration by these companies. */ #define CHARSET_FILE "/usr/lib/X11/input/charsets" static char *_XkbKnownLanguages = "c=ascii:da,de,en,es,fr,is,it,nl,no,pt,sv=iso8859-1:hu,pl,cs=iso8859-2:" "eo=iso8859-3:sp=iso8859-5:ar,ara=iso8859-6:el=iso8859-7:he=iso8859-8:" "tr=iso8859-9:lt,lv=iso8859-13:et,fi=iso8859-15:ru=koi8-r:uk=koi8-u:" "th,th_TH,th_TH.iso8859-11=iso8859-11:th_TH.TIS620=tis620:hy=armscii-8:" "vi=tcvn-5712:ka=georgian-academy:be,bg=microsoft-cp1251"; char * _XkbGetCharset(void) { /* * PAGE USAGE TUNING: explicitly initialize to move these to data * instead of bss */ static char buf[100] = { 0 }; char lang[256]; char *start, *tmp, *end, *next, *set; char *country, *charset; char *locale; tmp = getenv("_XKB_CHARSET"); if (tmp) return tmp; locale = setlocale(LC_CTYPE, NULL); if (locale == NULL) return NULL; if (strlen(locale) >= sizeof(lang)) return NULL; for (tmp = lang; *tmp = *locale++; tmp++) { if (isupper(*tmp)) *tmp = tolower(*tmp); } country = strchr(lang, '_'); if (country) { *country++ = '\0'; charset = strchr(country, '.'); if (charset) *charset++ = '\0'; if (charset) { strncpy(buf, charset, 99); buf[99] = '\0'; return buf; } } else { charset = NULL; } if ((tmp = getenv("_XKB_LOCALE_CHARSETS")) != NULL) { start = _XkbAlloc(strlen(tmp) + 1); strcpy(start, tmp); tmp = start; } else { struct stat sbuf; FILE *file; char *cf = CHARSET_FILE; #ifndef S_ISREG # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) #endif if ((stat(cf, &sbuf) == 0) && S_ISREG(sbuf.st_mode) && (file = fopen(cf, "r"))) { tmp = _XkbAlloc(sbuf.st_size + 1); if (tmp != NULL) { sbuf.st_size = (long) fread(tmp, 1, sbuf.st_size, file); tmp[sbuf.st_size] = '\0'; } fclose(file); } } if (tmp == NULL) { tmp = _XkbAlloc(strlen(_XkbKnownLanguages) + 1); if (!tmp) return NULL; strcpy(tmp, _XkbKnownLanguages); } start = tmp; do { if ((set = strchr(tmp, '=')) == NULL) break; *set++ = '\0'; if ((next = strchr(set, ':')) != NULL) *next++ = '\0'; while (tmp && *tmp) { if ((end = strchr(tmp, ',')) != NULL) *end++ = '\0'; if (Strcmp(tmp, lang) == 0) { strncpy(buf, set, 100); buf[99] = '\0'; Xfree(start); return buf; } tmp = end; } tmp = next; } while (tmp && *tmp); Xfree(start); return NULL; } #else char * _XkbGetCharset(void) { char *tmp; XLCd lcd; tmp = getenv("_XKB_CHARSET"); if (tmp) return tmp; lcd = _XlcCurrentLC(); if (lcd) return XLC_PUBLIC(lcd, encoding_name); return NULL; } #endif nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBExtDev.c0000644000000000000000000006452713614532331015352 0ustar /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #define NEED_MAP_READERS #include "Xlibint.h" #include #include "XKBlibint.h" #include /***====================================================================***/ void XkbNoteDeviceChanges(XkbDeviceChangesPtr old, XkbExtensionDeviceNotifyEvent *new, unsigned int wanted) { if ((!old) || (!new) || (!wanted) || ((new->reason & wanted) == 0)) return; if ((wanted & new->reason) & XkbXI_ButtonActionsMask) { if (old->changed & XkbXI_ButtonActionsMask) { int first, last, newLast; if (new->first_btn < old->first_btn) first = new->first_btn; else first = old->first_btn; last = old->first_btn + old->num_btns - 1; newLast = new->first_btn + new->num_btns - 1; if (newLast > last) last = newLast; old->first_btn = first; old->num_btns = (last - first) + 1; } else { old->changed |= XkbXI_ButtonActionsMask; old->first_btn = new->first_btn; old->num_btns = new->num_btns; } } if ((wanted & new->reason) & XkbXI_IndicatorsMask) { XkbDeviceLedChangesPtr this; if (old->changed & XkbXI_IndicatorsMask) { XkbDeviceLedChangesPtr found = NULL; for (this = &old->leds; this && (!found); this = this->next) { if ((this->led_class == new->led_class) && (this->led_id == new->led_id)) { found = this; } } if (!found) { found = _XkbTypedCalloc(1, XkbDeviceLedChangesRec); if (!found) return; found->next = old->leds.next; found->led_class = new->led_class; found->led_id = new->led_id; old->leds.next = found; } if ((wanted & new->reason) & XkbXI_IndicatorNamesMask) found->defined = new->leds_defined; } else { old->changed |= ((wanted & new->reason) & XkbXI_IndicatorsMask); old->leds.led_class = new->led_class; old->leds.led_id = new->led_id; old->leds.defined = new->leds_defined; if (old->leds.next) { XkbDeviceLedChangesPtr next; for (this = old->leds.next; this; this = next) { next = this->next; _XkbFree(this); } old->leds.next = NULL; } } } return; } /***====================================================================***/ static Status _XkbReadDeviceLedInfo(XkbReadBufferPtr buf, unsigned present, XkbDeviceInfoPtr devi) { register unsigned i, bit; XkbDeviceLedInfoPtr devli; xkbDeviceLedsWireDesc *wireli; wireli = _XkbGetTypedRdBufPtr(buf, 1, xkbDeviceLedsWireDesc); if (!wireli) return BadLength; devli = XkbAddDeviceLedInfo(devi, wireli->ledClass, wireli->ledID); if (!devli) return BadAlloc; devli->phys_indicators = wireli->physIndicators; if (present & XkbXI_IndicatorStateMask) devli->state = wireli->state; if (present & XkbXI_IndicatorNamesMask) { devli->names_present = wireli->namesPresent; if (devli->names_present) { for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { if (wireli->namesPresent & bit) { if (!_XkbCopyFromReadBuffer(buf, (char *) &devli->names[i], 4)) return BadLength; } } } } if (present & XkbXI_IndicatorMapsMask) { devli->maps_present = wireli->mapsPresent; if (devli->maps_present) { XkbIndicatorMapPtr im; xkbIndicatorMapWireDesc *wireim; for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { if (wireli->mapsPresent & bit) { wireim = _XkbGetTypedRdBufPtr(buf, 1, xkbIndicatorMapWireDesc); if (!wireim) return BadAlloc; im = &devli->maps[i]; im->flags = wireim->flags; im->which_groups = wireim->whichGroups; im->groups = wireim->groups; im->which_mods = wireim->whichMods; im->mods.mask = wireim->mods; im->mods.real_mods = wireim->realMods; im->mods.vmods = wireim->virtualMods; im->ctrls = wireim->ctrls; } } } } return Success; } static Status _XkbReadGetDeviceInfoReply(Display *dpy, xkbGetDeviceInfoReply *rep, XkbDeviceInfoPtr devi) { XkbReadBufferRec buf; XkbAction *act; int tmp; if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) return BadAlloc; if ((rep->totalBtns > 0) && (rep->totalBtns != devi->num_btns)) { tmp = XkbResizeDeviceButtonActions(devi, rep->totalBtns); if (tmp != Success) return tmp; } if (rep->nBtnsWanted > 0) { if (((unsigned short) rep->firstBtnWanted + rep->nBtnsWanted) >= devi->num_btns) goto BAILOUT; act = &devi->btn_acts[rep->firstBtnWanted]; bzero((char *) act, (rep->nBtnsWanted * sizeof(XkbAction))); } _XkbFree(devi->name); if (!_XkbGetReadBufferCountedString(&buf, &devi->name)) goto BAILOUT; if (rep->nBtnsRtrn > 0) { int size; if (((unsigned short) rep->firstBtnRtrn + rep->nBtnsRtrn) >= devi->num_btns) goto BAILOUT; act = &devi->btn_acts[rep->firstBtnRtrn]; size = rep->nBtnsRtrn * SIZEOF(xkbActionWireDesc); if (!_XkbCopyFromReadBuffer(&buf, (char *) act, size)) goto BAILOUT; } if (rep->nDeviceLedFBs > 0) { register int i; for (i = 0; i < rep->nDeviceLedFBs; i++) { if ((tmp = _XkbReadDeviceLedInfo(&buf, rep->present, devi)) != Success) return tmp; } } tmp = _XkbFreeReadBuffer(&buf); if (tmp) fprintf(stderr, "GetDeviceInfo! Bad length (%d extra bytes)\n", tmp); if (tmp || buf.error) return BadLength; return Success; BAILOUT: _XkbFreeReadBuffer(&buf); return BadLength; } XkbDeviceInfoPtr XkbGetDeviceInfo(Display *dpy, unsigned which, unsigned deviceSpec, unsigned class, unsigned id) { register xkbGetDeviceInfoReq *req; xkbGetDeviceInfoReply rep; Status status; XkbDeviceInfoPtr devi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return NULL; LockDisplay(dpy); GetReq(kbGetDeviceInfo, req); req->reqType = dpy->xkb_info->codes->major_opcode; req->xkbReqType = X_kbGetDeviceInfo; req->deviceSpec = deviceSpec; req->wanted = which; req->allBtns = ((which & XkbXI_ButtonActionsMask) != 0); req->firstBtn = req->nBtns = 0; req->ledClass = class; req->ledID = id; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return NULL; } devi = XkbAllocDeviceInfo(rep.deviceID, rep.totalBtns, rep.nDeviceLedFBs); if (devi) { devi->supported = rep.supported; devi->unsupported = rep.unsupported; devi->type = rep.devType; devi->has_own_state = rep.hasOwnState; devi->dflt_kbd_fb = rep.dfltKbdFB; devi->dflt_led_fb = rep.dfltLedFB; status = _XkbReadGetDeviceInfoReply(dpy, &rep, devi); if (status != Success) { XkbFreeDeviceInfo(devi, XkbXI_AllDeviceFeaturesMask, True); devi = NULL; } } UnlockDisplay(dpy); SyncHandle(); return devi; } Status XkbGetDeviceInfoChanges(Display *dpy, XkbDeviceInfoPtr devi, XkbDeviceChangesPtr changes) { register xkbGetDeviceInfoReq *req; xkbGetDeviceInfoReply rep; Status status; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadMatch; if ((changes->changed & XkbXI_AllDeviceFeaturesMask) == 0) return Success; changes->changed &= ~XkbXI_AllDeviceFeaturesMask; status = Success; LockDisplay(dpy); while ((changes->changed) && (status == Success)) { GetReq(kbGetDeviceInfo, req); req->reqType = dpy->xkb_info->codes->major_opcode; req->xkbReqType = X_kbGetDeviceInfo; req->deviceSpec = devi->device_spec; req->wanted = changes->changed; req->allBtns = False; if (changes->changed & XkbXI_ButtonActionsMask) { req->firstBtn = changes->first_btn; req->nBtns = changes->num_btns; changes->changed &= ~XkbXI_ButtonActionsMask; } else req->firstBtn = req->nBtns = 0; if (changes->changed & XkbXI_IndicatorsMask) { req->ledClass = changes->leds.led_class; req->ledID = changes->leds.led_id; if (changes->leds.next == NULL) changes->changed &= ~XkbXI_IndicatorsMask; else { XkbDeviceLedChangesPtr next; next = changes->leds.next; changes->leds = *next; _XkbFree(next); } } else { req->ledClass = XkbDfltXIClass; req->ledID = XkbDfltXIId; } if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { status = BadLength; break; } devi->supported |= rep.supported; devi->unsupported |= rep.unsupported; devi->type = rep.devType; status = _XkbReadGetDeviceInfoReply(dpy, &rep, devi); } UnlockDisplay(dpy); SyncHandle(); return status; } Status XkbGetDeviceButtonActions(Display *dpy, XkbDeviceInfoPtr devi, Bool all, unsigned int first, unsigned int num) { register xkbGetDeviceInfoReq *req; xkbGetDeviceInfoReply rep; Status status; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadMatch; if (!devi) return BadValue; LockDisplay(dpy); GetReq(kbGetDeviceInfo, req); req->reqType = dpy->xkb_info->codes->major_opcode; req->xkbReqType = X_kbGetDeviceInfo; req->deviceSpec = devi->device_spec; req->wanted = XkbXI_ButtonActionsMask; req->allBtns = all; req->firstBtn = first; req->nBtns = num; req->ledClass = XkbDfltXIClass; req->ledID = XkbDfltXIId; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return BadLength; } devi->type = rep.devType; devi->supported = rep.supported; devi->unsupported = rep.unsupported; status = _XkbReadGetDeviceInfoReply(dpy, &rep, devi); UnlockDisplay(dpy); SyncHandle(); return status; } Status XkbGetDeviceLedInfo(Display *dpy, XkbDeviceInfoPtr devi, unsigned int ledClass, unsigned int ledId, unsigned int which) { register xkbGetDeviceInfoReq *req; xkbGetDeviceInfoReply rep; Status status; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadMatch; if (((which & XkbXI_IndicatorsMask) == 0) || (which & (~XkbXI_IndicatorsMask))) return BadMatch; if (!devi) return BadValue; LockDisplay(dpy); GetReq(kbGetDeviceInfo, req); req->reqType = dpy->xkb_info->codes->major_opcode; req->xkbReqType = X_kbGetDeviceInfo; req->deviceSpec = devi->device_spec; req->wanted = which; req->allBtns = False; req->firstBtn = req->nBtns = 0; req->ledClass = ledClass; req->ledID = ledId; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return BadLength; } devi->type = rep.devType; devi->supported = rep.supported; devi->unsupported = rep.unsupported; status = _XkbReadGetDeviceInfoReply(dpy, &rep, devi); UnlockDisplay(dpy); SyncHandle(); return status; } /***====================================================================***/ typedef struct _LedInfoStuff { Bool used; XkbDeviceLedInfoPtr devli; } LedInfoStuff; typedef struct _SetLedStuff { unsigned wanted; int num_info; int dflt_class; LedInfoStuff *dflt_kbd_fb; LedInfoStuff *dflt_led_fb; LedInfoStuff *info; } SetLedStuff; static void _InitLedStuff(SetLedStuff *stuff, unsigned wanted, XkbDeviceInfoPtr devi) { int i; register XkbDeviceLedInfoPtr devli; bzero(stuff, sizeof(SetLedStuff)); stuff->wanted = wanted; stuff->dflt_class = XkbXINone; if ((devi->num_leds < 1) || ((wanted & XkbXI_IndicatorsMask) == 0)) return; stuff->info = _XkbTypedCalloc(devi->num_leds, LedInfoStuff); if (!stuff->info) return; stuff->num_info = devi->num_leds; for (devli = &devi->leds[0], i = 0; i < devi->num_leds; i++, devli++) { stuff->info[i].devli = devli; if (devli->led_class == KbdFeedbackClass) { stuff->dflt_class = KbdFeedbackClass; if (stuff->dflt_kbd_fb == NULL) stuff->dflt_kbd_fb = &stuff->info[i]; } else if (devli->led_class == LedFeedbackClass) { if (stuff->dflt_class == XkbXINone) stuff->dflt_class = LedFeedbackClass; if (stuff->dflt_led_fb == NULL) stuff->dflt_led_fb = &stuff->info[i]; } } return; } static void _FreeLedStuff(SetLedStuff * stuff) { if (stuff->num_info > 0) _XkbFree(stuff->info); bzero(stuff, sizeof(SetLedStuff)); return; } static int _XkbSizeLedInfo(unsigned changed, XkbDeviceLedInfoPtr devli) { register int i, size; register unsigned bit, namesNeeded, mapsNeeded; size = SIZEOF(xkbDeviceLedsWireDesc); namesNeeded = mapsNeeded = 0; if (changed & XkbXI_IndicatorNamesMask) namesNeeded = devli->names_present; if (changed & XkbXI_IndicatorMapsMask) mapsNeeded = devli->maps_present; if ((namesNeeded) || (mapsNeeded)) { for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { if (namesNeeded & bit) size += 4; /* atoms are 4 bytes on the wire */ if (mapsNeeded & bit) size += SIZEOF(xkbIndicatorMapWireDesc); } } return size; } static Bool _SizeMatches(SetLedStuff *stuff, XkbDeviceLedChangesPtr changes, int *sz_rtrn, int *nleds_rtrn) { int i, nMatch, class, id; LedInfoStuff *linfo; Bool match; nMatch = 0; class = changes->led_class; id = changes->led_id; if (class == XkbDfltXIClass) class = stuff->dflt_class; for (i = 0, linfo = &stuff->info[0]; i < stuff->num_info; i++, linfo++) { XkbDeviceLedInfoPtr devli; LedInfoStuff *dflt; devli = linfo->devli; match = ((class == devli->led_class) || (class == XkbAllXIClasses)); if (devli->led_class == KbdFeedbackClass) dflt = stuff->dflt_kbd_fb; else dflt = stuff->dflt_led_fb; match = (match && (id == devli->led_id)) || (id == XkbAllXIIds) || ((id == XkbDfltXIId) && (linfo == dflt)); if (match) { if (!linfo->used) { *sz_rtrn += _XkbSizeLedInfo(stuff->wanted, devli); *nleds_rtrn += 1; linfo->used = True; if ((class != XkbAllXIClasses) && (id != XkbAllXIIds)) return True; } nMatch++; linfo->used = True; } } return (nMatch > 0); } /***====================================================================***/ static Status _XkbSetDeviceInfoSize(XkbDeviceInfoPtr devi, XkbDeviceChangesPtr changes, SetLedStuff *stuff, int *sz_rtrn, int *num_leds_rtrn) { *sz_rtrn = 0; if ((changes->changed & XkbXI_ButtonActionsMask) && (changes->num_btns > 0)) { if (!XkbXI_LegalDevBtn (devi, (changes->first_btn + changes->num_btns - 1))) return BadMatch; *sz_rtrn += changes->num_btns * SIZEOF(xkbActionWireDesc); } else { changes->changed &= ~XkbXI_ButtonActionsMask; changes->first_btn = changes->num_btns = 0; } if ((changes->changed & XkbXI_IndicatorsMask) && XkbLegalXILedClass(changes->leds.led_class)) { XkbDeviceLedChangesPtr leds; for (leds = &changes->leds; leds != NULL; leds = leds->next) { if (!_SizeMatches(stuff, leds, sz_rtrn, num_leds_rtrn)) return BadMatch; } } else { changes->changed &= ~XkbXI_IndicatorsMask; *num_leds_rtrn = 0; } return Success; } static char * _XkbWriteLedInfo(char *wire, unsigned changed, XkbDeviceLedInfoPtr devli) { register int i; register unsigned bit, namesNeeded, mapsNeeded; xkbDeviceLedsWireDesc *lwire; namesNeeded = mapsNeeded = 0; if (changed & XkbXI_IndicatorNamesMask) namesNeeded = devli->names_present; if (changed & XkbXI_IndicatorMapsMask) mapsNeeded = devli->maps_present; lwire = (xkbDeviceLedsWireDesc *) wire; lwire->ledClass = devli->led_class; lwire->ledID = devli->led_id; lwire->namesPresent = namesNeeded; lwire->mapsPresent = mapsNeeded; lwire->physIndicators = devli->phys_indicators; lwire->state = devli->state; wire = (char *) &lwire[1]; if (namesNeeded) { CARD32 *awire = (CARD32 *) wire; for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { if (namesNeeded & bit) { *awire = (CARD32) devli->names[i]; awire++; } } wire = (char *) awire; } if (mapsNeeded) { xkbIndicatorMapWireDesc *mwire = (xkbIndicatorMapWireDesc *) wire; for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { if (mapsNeeded & bit) { XkbIndicatorMapPtr map = &devli->maps[i]; mwire->flags = map->flags; mwire->whichGroups = map->which_groups; mwire->groups = map->groups; mwire->whichMods = map->which_mods; mwire->mods = map->mods.mask; mwire->realMods = map->mods.real_mods; mwire->virtualMods = map->mods.vmods; mwire->ctrls = map->ctrls; mwire++; } } wire = (char *) mwire; } return wire; } static int _XkbWriteSetDeviceInfo(char *wire, XkbDeviceChangesPtr changes, SetLedStuff *stuff, XkbDeviceInfoPtr devi) { char *start = wire; if (changes->changed & XkbXI_ButtonActionsMask) { int size = changes->num_btns * SIZEOF(xkbActionWireDesc); memcpy(wire, (char *) &devi->btn_acts[changes->first_btn], size); wire += size; } if (changes->changed & XkbXI_IndicatorsMask) { register int i; register LedInfoStuff *linfo; for (i = 0, linfo = &stuff->info[0]; i < stuff->num_info; i++, linfo++) { if (linfo->used) { register char *new_wire; new_wire = _XkbWriteLedInfo(wire, stuff->wanted, linfo->devli); if (!new_wire) return wire - start; wire = new_wire; } } } return wire - start; } Bool XkbSetDeviceInfo(Display *dpy, unsigned which, XkbDeviceInfoPtr devi) { register xkbSetDeviceInfoReq *req; Status ok = 0; int size, nLeds; XkbInfoPtr xkbi; XkbDeviceChangesRec changes; SetLedStuff lstuff; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; if ((!devi) || (which & (~XkbXI_AllDeviceFeaturesMask)) || ((which & XkbXI_ButtonActionsMask) && (!XkbXI_DevHasBtnActs(devi))) || ((which & XkbXI_IndicatorsMask) && (!XkbXI_DevHasLeds(devi)))) return False; bzero((char *) &changes, sizeof(XkbDeviceChangesRec)); changes.changed = which; changes.first_btn = 0; changes.num_btns = devi->num_btns; changes.leds.led_class = XkbAllXIClasses; changes.leds.led_id = XkbAllXIIds; changes.leds.defined = 0; size = nLeds = 0; _InitLedStuff(&lstuff, changes.changed, devi); if (_XkbSetDeviceInfoSize(devi, &changes, &lstuff, &size, &nLeds) != Success) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbSetDeviceInfo, req); req->length += size / 4; req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbSetDeviceInfo; req->deviceSpec = devi->device_spec; req->firstBtn = changes.first_btn; req->nBtns = changes.num_btns; req->change = changes.changed; req->nDeviceLedFBs = nLeds; if (size > 0) { char *wire; BufAlloc(char *, wire, size); ok = (wire != NULL) && (_XkbWriteSetDeviceInfo(wire, &changes, &lstuff, devi) == size); } UnlockDisplay(dpy); SyncHandle(); _FreeLedStuff(&lstuff); /* 12/11/95 (ef) -- XXX!! should clear changes here */ return ok; } Bool XkbChangeDeviceInfo(Display *dpy, XkbDeviceInfoPtr devi, XkbDeviceChangesPtr changes) { register xkbSetDeviceInfoReq *req; Status ok = 0; int size, nLeds; XkbInfoPtr xkbi; SetLedStuff lstuff; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; if ((!devi) || (changes->changed & (~XkbXI_AllDeviceFeaturesMask)) || ((changes->changed & XkbXI_ButtonActionsMask) && (!XkbXI_DevHasBtnActs(devi))) || ((changes->changed & XkbXI_IndicatorsMask) && (!XkbXI_DevHasLeds(devi)))) return False; size = nLeds = 0; _InitLedStuff(&lstuff, changes->changed, devi); if (_XkbSetDeviceInfoSize(devi, changes, &lstuff, &size, &nLeds) != Success) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbSetDeviceInfo, req); req->length += size / 4; req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbSetDeviceInfo; req->deviceSpec = devi->device_spec; req->firstBtn = changes->first_btn; req->nBtns = changes->num_btns; req->change = changes->changed; req->nDeviceLedFBs = nLeds; if (size > 0) { char *wire; BufAlloc(char *, wire, size); ok = (wire != NULL) && (_XkbWriteSetDeviceInfo(wire, changes, &lstuff, devi) == size); } UnlockDisplay(dpy); SyncHandle(); _FreeLedStuff(&lstuff); /* 12/11/95 (ef) -- XXX!! should clear changes here */ return ok; } Bool XkbSetDeviceLedInfo(Display *dpy, XkbDeviceInfoPtr devi, unsigned ledClass, unsigned ledID, unsigned which) { return False; } Bool XkbSetDeviceButtonActions(Display *dpy, XkbDeviceInfoPtr devi, unsigned int first, unsigned int nBtns) { register xkbSetDeviceInfoReq *req; Status ok = 0; int size, nLeds; XkbInfoPtr xkbi; XkbDeviceChangesRec changes; SetLedStuff lstuff; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; if ((!devi) || (!XkbXI_DevHasBtnActs(devi)) || (first + nBtns > devi->num_btns)) return False; if (nBtns == 0) return True; bzero((char *) &changes, sizeof(XkbDeviceChangesRec)); changes.changed = XkbXI_ButtonActionsMask; changes.first_btn = first; changes.num_btns = nBtns; changes.leds.led_class = XkbXINone; changes.leds.led_id = XkbXINone; changes.leds.defined = 0; size = nLeds = 0; if (_XkbSetDeviceInfoSize(devi, &changes, NULL, &size, &nLeds) != Success) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbSetDeviceInfo, req); req->length += size / 4; req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbSetDeviceInfo; req->deviceSpec = devi->device_spec; req->firstBtn = changes.first_btn; req->nBtns = changes.num_btns; req->change = changes.changed; req->nDeviceLedFBs = nLeds; if (size > 0) { char *wire; BufAlloc(char *, wire, size); ok = (wire != NULL) && (_XkbWriteSetDeviceInfo(wire, &changes, &lstuff, devi) == size); } UnlockDisplay(dpy); SyncHandle(); return ok; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBGAlloc.c0000644000000000000000000007162713614532331015313 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "XKBlibint.h" #include #include /***====================================================================***/ static void _XkbFreeGeomLeafElems(Bool freeAll, int first, int count, unsigned short *num_inout, unsigned short *sz_inout, char **elems, unsigned int elem_sz) { if ((freeAll) || (*elems == NULL)) { *num_inout = *sz_inout = 0; if (*elems != NULL) { _XkbFree(*elems); *elems = NULL; } return; } if ((first >= (*num_inout)) || (first < 0) || (count < 1)) return; if (first + count >= (*num_inout)) { /* truncating the array is easy */ (*num_inout) = first; } else { char *ptr; int extra; ptr = *elems; extra = ((*num_inout) - (first + count)) * elem_sz; if (extra > 0) memmove(&ptr[first * elem_sz], &ptr[(first + count) * elem_sz], extra); (*num_inout) -= count; } return; } typedef void (*ContentsClearFunc) ( char * /* priv */ ); static void _XkbFreeGeomNonLeafElems(Bool freeAll, int first, int count, unsigned short *num_inout, unsigned short *sz_inout, char **elems, unsigned int elem_sz, ContentsClearFunc freeFunc) { register int i; register char *ptr; if (freeAll) { first = 0; count = (*num_inout); } else if ((first >= (*num_inout)) || (first < 0) || (count < 1)) return; else if (first + count > (*num_inout)) count = (*num_inout) - first; if (*elems == NULL) return; if (freeFunc) { ptr = *elems; ptr += first * elem_sz; for (i = 0; i < count; i++) { (*freeFunc) (ptr); ptr += elem_sz; } } if (freeAll) { (*num_inout) = (*sz_inout) = 0; if (*elems) { _XkbFree(*elems); *elems = NULL; } } else if (first + count >= (*num_inout)) *num_inout = first; else { i = ((*num_inout) - (first + count)) * elem_sz; ptr = *elems; memmove(&ptr[first * elem_sz], &ptr[(first + count) * elem_sz], i); (*num_inout) -= count; } return; } /***====================================================================***/ static void _XkbClearProperty(char *prop_in) { XkbPropertyPtr prop = (XkbPropertyPtr) prop_in; if (prop->name) { _XkbFree(prop->name); prop->name = NULL; } if (prop->value) { _XkbFree(prop->value); prop->value = NULL; } return; } void XkbFreeGeomProperties(XkbGeometryPtr geom, int first, int count, Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll, first, count, &geom->num_properties, &geom->sz_properties, (char **) &geom->properties, sizeof(XkbPropertyRec), _XkbClearProperty); return; } /***====================================================================***/ void XkbFreeGeomKeyAliases(XkbGeometryPtr geom, int first, int count, Bool freeAll) { _XkbFreeGeomLeafElems(freeAll, first, count, &geom->num_key_aliases, &geom->sz_key_aliases, (char **) &geom->key_aliases, sizeof(XkbKeyAliasRec)); return; } /***====================================================================***/ static void _XkbClearColor(char *color_in) { XkbColorPtr color = (XkbColorPtr) color_in; _XkbFree(color->spec); return; } void XkbFreeGeomColors(XkbGeometryPtr geom, int first, int count, Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll, first, count, &geom->num_colors, &geom->sz_colors, (char **) &geom->colors, sizeof(XkbColorRec), _XkbClearColor); return; } /***====================================================================***/ void XkbFreeGeomPoints(XkbOutlinePtr outline, int first, int count, Bool freeAll) { _XkbFreeGeomLeafElems(freeAll, first, count, &outline->num_points, &outline->sz_points, (char **) &outline->points, sizeof(XkbPointRec)); return; } /***====================================================================***/ static void _XkbClearOutline(char *outline_in) { XkbOutlinePtr outline = (XkbOutlinePtr) outline_in; if (outline->points != NULL) XkbFreeGeomPoints(outline, 0, outline->num_points, True); return; } void XkbFreeGeomOutlines(XkbShapePtr shape, int first, int count, Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll, first, count, &shape->num_outlines, &shape->sz_outlines, (char **) &shape->outlines, sizeof(XkbOutlineRec), _XkbClearOutline); return; } /***====================================================================***/ static void _XkbClearShape(char *shape_in) { XkbShapePtr shape = (XkbShapePtr) shape_in; if (shape->outlines) XkbFreeGeomOutlines(shape, 0, shape->num_outlines, True); return; } void XkbFreeGeomShapes(XkbGeometryPtr geom, int first, int count, Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll, first, count, &geom->num_shapes, &geom->sz_shapes, (char **) &geom->shapes, sizeof(XkbShapeRec), _XkbClearShape); return; } /***====================================================================***/ void XkbFreeGeomOverlayKeys(XkbOverlayRowPtr row, int first, int count, Bool freeAll) { _XkbFreeGeomLeafElems(freeAll, first, count, &row->num_keys, &row->sz_keys, (char **) &row->keys, sizeof(XkbOverlayKeyRec)); return; } /***====================================================================***/ static void _XkbClearOverlayRow(char *row_in) { XkbOverlayRowPtr row = (XkbOverlayRowPtr) row_in; if (row->keys != NULL) XkbFreeGeomOverlayKeys(row, 0, row->num_keys, True); return; } void XkbFreeGeomOverlayRows(XkbOverlayPtr overlay, int first, int count, Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll, first, count, &overlay->num_rows, &overlay->sz_rows, (char **) &overlay->rows, sizeof(XkbOverlayRowRec), _XkbClearOverlayRow); return; } /***====================================================================***/ static void _XkbClearOverlay(char *overlay_in) { XkbOverlayPtr overlay = (XkbOverlayPtr) overlay_in; if (overlay->rows != NULL) XkbFreeGeomOverlayRows(overlay, 0, overlay->num_rows, True); return; } void XkbFreeGeomOverlays(XkbSectionPtr section, int first, int count, Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll, first, count, §ion->num_overlays, §ion->sz_overlays, (char **) §ion->overlays, sizeof(XkbOverlayRec), _XkbClearOverlay); return; } /***====================================================================***/ void XkbFreeGeomKeys(XkbRowPtr row, int first, int count, Bool freeAll) { _XkbFreeGeomLeafElems(freeAll, first, count, &row->num_keys, &row->sz_keys, (char **) &row->keys, sizeof(XkbKeyRec)); return; } /***====================================================================***/ static void _XkbClearRow(char *row_in) { XkbRowPtr row = (XkbRowPtr) row_in; if (row->keys != NULL) XkbFreeGeomKeys(row, 0, row->num_keys, True); return; } void XkbFreeGeomRows(XkbSectionPtr section, int first, int count, Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll, first, count, §ion->num_rows, §ion->sz_rows, (char **) §ion->rows, sizeof(XkbRowRec), _XkbClearRow); } /***====================================================================***/ static void _XkbClearSection(char *section_in) { XkbSectionPtr section = (XkbSectionPtr) section_in; if (section->rows != NULL) XkbFreeGeomRows(section, 0, section->num_rows, True); if (section->doodads != NULL) { XkbFreeGeomDoodads(section->doodads, section->num_doodads, True); section->doodads = NULL; } return; } void XkbFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll, first, count, &geom->num_sections, &geom->sz_sections, (char **) &geom->sections, sizeof(XkbSectionRec), _XkbClearSection); return; } /***====================================================================***/ static void _XkbClearDoodad(char *doodad_in) { XkbDoodadPtr doodad = (XkbDoodadPtr) doodad_in; switch (doodad->any.type) { case XkbTextDoodad: { if (doodad->text.text != NULL) { _XkbFree(doodad->text.text); doodad->text.text = NULL; } if (doodad->text.font != NULL) { _XkbFree(doodad->text.font); doodad->text.font = NULL; } } break; case XkbLogoDoodad: { if (doodad->logo.logo_name != NULL) { _XkbFree(doodad->logo.logo_name); doodad->logo.logo_name = NULL; } } break; } return; } void XkbFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool freeAll) { register int i; register XkbDoodadPtr doodad; if (doodads) { for (i = 0, doodad = doodads; i < nDoodads; i++, doodad++) { _XkbClearDoodad((char *) doodad); } if (freeAll) _XkbFree(doodads); } return; } void XkbFreeGeometry(XkbGeometryPtr geom, unsigned which, Bool freeMap) { if (geom == NULL) return; if (freeMap) which = XkbGeomAllMask; if ((which & XkbGeomPropertiesMask) && (geom->properties != NULL)) XkbFreeGeomProperties(geom, 0, geom->num_properties, True); if ((which & XkbGeomColorsMask) && (geom->colors != NULL)) XkbFreeGeomColors(geom, 0, geom->num_colors, True); if ((which & XkbGeomShapesMask) && (geom->shapes != NULL)) XkbFreeGeomShapes(geom, 0, geom->num_shapes, True); if ((which & XkbGeomSectionsMask) && (geom->sections != NULL)) XkbFreeGeomSections(geom, 0, geom->num_sections, True); if ((which & XkbGeomDoodadsMask) && (geom->doodads != NULL)) { XkbFreeGeomDoodads(geom->doodads, geom->num_doodads, True); geom->doodads = NULL; geom->num_doodads = geom->sz_doodads = 0; } if ((which & XkbGeomKeyAliasesMask) && (geom->key_aliases != NULL)) XkbFreeGeomKeyAliases(geom, 0, geom->num_key_aliases, True); if (freeMap) { if (geom->label_font != NULL) { _XkbFree(geom->label_font); geom->label_font = NULL; } _XkbFree(geom); } return; } /***====================================================================***/ static Status _XkbGeomAlloc(XPointer *old, unsigned short *num, unsigned short *total, int num_new, size_t sz_elem) { if (num_new < 1) return Success; if ((*old) == NULL) *num = *total = 0; if ((*num) + num_new <= (*total)) return Success; *total = (*num) + num_new; if ((*old) != NULL) (*old) = (XPointer) _XkbRealloc((*old), (*total) * sz_elem); else (*old) = (XPointer) _XkbCalloc((*total), sz_elem); if ((*old) == NULL) { *total = *num = 0; return BadAlloc; } if (*num > 0) { char *tmp = (char *) (*old); bzero(&tmp[sz_elem * (*num)], (num_new * sz_elem)); } return Success; } #define _XkbAllocProps(g, n) _XkbGeomAlloc((XPointer *)&(g)->properties, \ &(g)->num_properties, &(g)->sz_properties, \ (n), sizeof(XkbPropertyRec)) #define _XkbAllocColors(g, n) _XkbGeomAlloc((XPointer *)&(g)->colors, \ &(g)->num_colors, &(g)->sz_colors, \ (n), sizeof(XkbColorRec)) #define _XkbAllocShapes(g, n) _XkbGeomAlloc((XPointer *)&(g)->shapes, \ &(g)->num_shapes, &(g)->sz_shapes, \ (n), sizeof(XkbShapeRec)) #define _XkbAllocSections(g, n) _XkbGeomAlloc((XPointer *)&(g)->sections, \ &(g)->num_sections, &(g)->sz_sections, \ (n), sizeof(XkbSectionRec)) #define _XkbAllocDoodads(g, n) _XkbGeomAlloc((XPointer *)&(g)->doodads, \ &(g)->num_doodads, &(g)->sz_doodads, \ (n), sizeof(XkbDoodadRec)) #define _XkbAllocKeyAliases(g, n) _XkbGeomAlloc((XPointer *)&(g)->key_aliases, \ &(g)->num_key_aliases, &(g)->sz_key_aliases, \ (n), sizeof(XkbKeyAliasRec)) #define _XkbAllocOutlines(s, n) _XkbGeomAlloc((XPointer *)&(s)->outlines, \ &(s)->num_outlines, &(s)->sz_outlines, \ (n), sizeof(XkbOutlineRec)) #define _XkbAllocRows(s, n) _XkbGeomAlloc((XPointer *)&(s)->rows, \ &(s)->num_rows, &(s)->sz_rows, \ (n), sizeof(XkbRowRec)) #define _XkbAllocPoints(o, n) _XkbGeomAlloc((XPointer *)&(o)->points, \ &(o)->num_points, &(o)->sz_points, \ (n), sizeof(XkbPointRec)) #define _XkbAllocKeys(r, n) _XkbGeomAlloc((XPointer *)&(r)->keys, \ &(r)->num_keys, &(r)->sz_keys, \ (n), sizeof(XkbKeyRec)) #define _XkbAllocOverlays(s, n) _XkbGeomAlloc((XPointer *)&(s)->overlays, \ &(s)->num_overlays, &(s)->sz_overlays, \ (n), sizeof(XkbOverlayRec)) #define _XkbAllocOverlayRows(o, n) _XkbGeomAlloc((XPointer *)&(o)->rows, \ &(o)->num_rows, &(o)->sz_rows, \ (n), sizeof(XkbOverlayRowRec)) #define _XkbAllocOverlayKeys(r, n) _XkbGeomAlloc((XPointer *)&(r)->keys, \ &(r)->num_keys, &(r)->sz_keys, \ (n), sizeof(XkbOverlayKeyRec)) Status XkbAllocGeomProps(XkbGeometryPtr geom, int nProps) { return _XkbAllocProps(geom, nProps); } Status XkbAllocGeomColors(XkbGeometryPtr geom, int nColors) { return _XkbAllocColors(geom, nColors); } Status XkbAllocGeomKeyAliases(XkbGeometryPtr geom, int nKeyAliases) { return _XkbAllocKeyAliases(geom, nKeyAliases); } Status XkbAllocGeomShapes(XkbGeometryPtr geom, int nShapes) { return _XkbAllocShapes(geom, nShapes); } Status XkbAllocGeomSections(XkbGeometryPtr geom, int nSections) { return _XkbAllocSections(geom, nSections); } Status XkbAllocGeomOverlays(XkbSectionPtr section, int nOverlays) { return _XkbAllocOverlays(section, nOverlays); } Status XkbAllocGeomOverlayRows(XkbOverlayPtr overlay, int nRows) { return _XkbAllocOverlayRows(overlay, nRows); } Status XkbAllocGeomOverlayKeys(XkbOverlayRowPtr row, int nKeys) { return _XkbAllocOverlayKeys(row, nKeys); } Status XkbAllocGeomDoodads(XkbGeometryPtr geom, int nDoodads) { return _XkbAllocDoodads(geom, nDoodads); } Status XkbAllocGeomSectionDoodads(XkbSectionPtr section, int nDoodads) { return _XkbAllocDoodads(section, nDoodads); } Status XkbAllocGeomOutlines(XkbShapePtr shape, int nOL) { return _XkbAllocOutlines(shape, nOL); } Status XkbAllocGeomRows(XkbSectionPtr section, int nRows) { return _XkbAllocRows(section, nRows); } Status XkbAllocGeomPoints(XkbOutlinePtr ol, int nPts) { return _XkbAllocPoints(ol, nPts); } Status XkbAllocGeomKeys(XkbRowPtr row, int nKeys) { return _XkbAllocKeys(row, nKeys); } Status XkbAllocGeometry(XkbDescPtr xkb, XkbGeometrySizesPtr sizes) { XkbGeometryPtr geom; Status rtrn; if (xkb->geom == NULL) { xkb->geom = _XkbTypedCalloc(1, XkbGeometryRec); if (!xkb->geom) return BadAlloc; } geom = xkb->geom; if ((sizes->which & XkbGeomPropertiesMask) && ((rtrn = _XkbAllocProps(geom, sizes->num_properties)) != Success)) { goto BAIL; } if ((sizes->which & XkbGeomColorsMask) && ((rtrn = _XkbAllocColors(geom, sizes->num_colors)) != Success)) { goto BAIL; } if ((sizes->which & XkbGeomShapesMask) && ((rtrn = _XkbAllocShapes(geom, sizes->num_shapes)) != Success)) { goto BAIL; } if ((sizes->which & XkbGeomSectionsMask) && ((rtrn = _XkbAllocSections(geom, sizes->num_sections)) != Success)) { goto BAIL; } if ((sizes->which & XkbGeomDoodadsMask) && ((rtrn = _XkbAllocDoodads(geom, sizes->num_doodads)) != Success)) { goto BAIL; } if ((sizes->which & XkbGeomKeyAliasesMask) && ((rtrn = _XkbAllocKeyAliases(geom, sizes->num_key_aliases)) != Success)) { goto BAIL; } return Success; BAIL: XkbFreeGeometry(geom, XkbGeomAllMask, True); xkb->geom = NULL; return rtrn; } /***====================================================================***/ XkbPropertyPtr XkbAddGeomProperty(XkbGeometryPtr geom, char *name, char *value) { register int i; register XkbPropertyPtr prop; if ((!geom) || (!name) || (!value)) return NULL; for (i = 0, prop = geom->properties; i < geom->num_properties; i++, prop++) { if ((prop->name) && (strcmp(name, prop->name) == 0)) { _XkbFree(prop->value); prop->value = strdup(value); return prop; } } if ((geom->num_properties >= geom->sz_properties) && (_XkbAllocProps(geom, 1) != Success)) { return NULL; } prop = &geom->properties[geom->num_properties]; prop->name = strdup(name); if (!prop->name) return NULL; prop->value = strdup(value); if (!prop->value) { _XkbFree(prop->name); prop->name = NULL; return NULL; } geom->num_properties++; return prop; } XkbKeyAliasPtr XkbAddGeomKeyAlias(XkbGeometryPtr geom, char *aliasStr, char *realStr) { register int i; register XkbKeyAliasPtr alias; if ((!geom) || (!aliasStr) || (!realStr) || (!aliasStr[0]) || (!realStr[0])) return NULL; for (i = 0, alias = geom->key_aliases; i < geom->num_key_aliases; i++, alias++) { if (strncmp(alias->alias, aliasStr, XkbKeyNameLength) == 0) { bzero(alias->real, XkbKeyNameLength); strncpy(alias->real, realStr, XkbKeyNameLength); return alias; } } if ((geom->num_key_aliases >= geom->sz_key_aliases) && (_XkbAllocKeyAliases(geom, 1) != Success)) { return NULL; } alias = &geom->key_aliases[geom->num_key_aliases]; bzero(alias, sizeof(XkbKeyAliasRec)); strncpy(alias->alias, aliasStr, XkbKeyNameLength); strncpy(alias->real, realStr, XkbKeyNameLength); geom->num_key_aliases++; return alias; } XkbColorPtr XkbAddGeomColor(XkbGeometryPtr geom, char *spec, unsigned int pixel) { register int i; register XkbColorPtr color; if ((!geom) || (!spec)) return NULL; for (i = 0, color = geom->colors; i < geom->num_colors; i++, color++) { if ((color->spec) && (strcmp(color->spec, spec) == 0)) { color->pixel = pixel; return color; } } if ((geom->num_colors >= geom->sz_colors) && (_XkbAllocColors(geom, 1) != Success)) { return NULL; } color = &geom->colors[geom->num_colors]; color->pixel = pixel; color->spec = strdup(spec); if (!color->spec) return NULL; geom->num_colors++; return color; } XkbOutlinePtr XkbAddGeomOutline(XkbShapePtr shape, int sz_points) { XkbOutlinePtr outline; if ((!shape) || (sz_points < 0)) return NULL; if ((shape->num_outlines >= shape->sz_outlines) && (_XkbAllocOutlines(shape, 1) != Success)) { return NULL; } outline = &shape->outlines[shape->num_outlines]; bzero(outline, sizeof(XkbOutlineRec)); if ((sz_points > 0) && (_XkbAllocPoints(outline, sz_points) != Success)) return NULL; shape->num_outlines++; return outline; } XkbShapePtr XkbAddGeomShape(XkbGeometryPtr geom, Atom name, int sz_outlines) { XkbShapePtr shape; register int i; if ((!geom) || (!name) || (sz_outlines < 0)) return NULL; if (geom->num_shapes > 0) { for (shape = geom->shapes, i = 0; i < geom->num_shapes; i++, shape++) { if (name == shape->name) return shape; } } if ((geom->num_shapes >= geom->sz_shapes) && (_XkbAllocShapes(geom, 1) != Success)) return NULL; shape = &geom->shapes[geom->num_shapes]; bzero(shape, sizeof(XkbShapeRec)); if ((sz_outlines > 0) && (_XkbAllocOutlines(shape, sz_outlines) != Success)) return NULL; shape->name = name; shape->primary = shape->approx = NULL; geom->num_shapes++; return shape; } XkbKeyPtr XkbAddGeomKey(XkbRowPtr row) { XkbKeyPtr key; if (!row) return NULL; if ((row->num_keys >= row->sz_keys) && (_XkbAllocKeys(row, 1) != Success)) return NULL; key = &row->keys[row->num_keys++]; bzero(key, sizeof(XkbKeyRec)); return key; } XkbRowPtr XkbAddGeomRow(XkbSectionPtr section, int sz_keys) { XkbRowPtr row; if ((!section) || (sz_keys < 0)) return NULL; if ((section->num_rows >= section->sz_rows) && (_XkbAllocRows(section, 1) != Success)) return NULL; row = §ion->rows[section->num_rows]; bzero(row, sizeof(XkbRowRec)); if ((sz_keys > 0) && (_XkbAllocKeys(row, sz_keys) != Success)) return NULL; section->num_rows++; return row; } XkbSectionPtr XkbAddGeomSection(XkbGeometryPtr geom, Atom name, int sz_rows, int sz_doodads, int sz_over) { register int i; XkbSectionPtr section; if ((!geom) || (name == None) || (sz_rows < 0)) return NULL; for (i = 0, section = geom->sections; i < geom->num_sections; i++, section++) { if (section->name != name) continue; if (((sz_rows > 0) && (_XkbAllocRows(section, sz_rows) != Success)) || ((sz_doodads > 0) && (_XkbAllocDoodads(section, sz_doodads) != Success)) || ((sz_over > 0) && (_XkbAllocOverlays(section, sz_over) != Success))) return NULL; return section; } if ((geom->num_sections >= geom->sz_sections) && (_XkbAllocSections(geom, 1) != Success)) return NULL; section = &geom->sections[geom->num_sections]; if ((sz_rows > 0) && (_XkbAllocRows(section, sz_rows) != Success)) return NULL; if ((sz_doodads > 0) && (_XkbAllocDoodads(section, sz_doodads) != Success)) { if (section->rows) { _XkbFree(section->rows); section->rows = NULL; section->sz_rows = section->num_rows = 0; } return NULL; } section->name = name; geom->num_sections++; return section; } XkbDoodadPtr XkbAddGeomDoodad(XkbGeometryPtr geom, XkbSectionPtr section, Atom name) { XkbDoodadPtr old, doodad; register int i, nDoodads; if ((!geom) || (name == None)) return NULL; if ((section != NULL) && (section->num_doodads > 0)) { old = section->doodads; nDoodads = section->num_doodads; } else { old = geom->doodads; nDoodads = geom->num_doodads; } for (i = 0, doodad = old; i < nDoodads; i++, doodad++) { if (doodad->any.name == name) return doodad; } if (section) { if ((section->num_doodads >= geom->sz_doodads) && (_XkbAllocDoodads(section, 1) != Success)) { return NULL; } doodad = §ion->doodads[section->num_doodads++]; } else { if ((geom->num_doodads >= geom->sz_doodads) && (_XkbAllocDoodads(geom, 1) != Success)) return NULL; doodad = &geom->doodads[geom->num_doodads++]; } bzero(doodad, sizeof(XkbDoodadRec)); doodad->any.name = name; return doodad; } XkbOverlayKeyPtr XkbAddGeomOverlayKey(XkbOverlayPtr overlay, XkbOverlayRowPtr row, char *over, char *under) { register int i; XkbOverlayKeyPtr key; XkbSectionPtr section; XkbRowPtr row_under; Bool found; if ((!overlay) || (!row) || (!over) || (!under)) return NULL; section = overlay->section_under; if (row->row_under >= section->num_rows) return NULL; row_under = §ion->rows[row->row_under]; for (i = 0, found = False; i < row_under->num_keys; i++) { if (strncmp(under, row_under->keys[i].name.name, XkbKeyNameLength) == 0) { found = True; break; } } if (!found) return NULL; if ((row->num_keys >= row->sz_keys) && (_XkbAllocOverlayKeys(row, 1) != Success)) return NULL; key = &row->keys[row->num_keys]; strncpy(key->under.name, under, XkbKeyNameLength); strncpy(key->over.name, over, XkbKeyNameLength); row->num_keys++; return key; } XkbOverlayRowPtr XkbAddGeomOverlayRow(XkbOverlayPtr overlay, int row_under, int sz_keys) { register int i; XkbOverlayRowPtr row; if ((!overlay) || (sz_keys < 0)) return NULL; if (row_under >= overlay->section_under->num_rows) return NULL; for (i = 0; i < overlay->num_rows; i++) { if (overlay->rows[i].row_under == row_under) { row = &overlay->rows[i]; if ((row->sz_keys < sz_keys) && (_XkbAllocOverlayKeys(row, sz_keys) != Success)) { return NULL; } return &overlay->rows[i]; } } if ((overlay->num_rows >= overlay->sz_rows) && (_XkbAllocOverlayRows(overlay, 1) != Success)) return NULL; row = &overlay->rows[overlay->num_rows]; bzero(row, sizeof(XkbOverlayRowRec)); if ((sz_keys > 0) && (_XkbAllocOverlayKeys(row, sz_keys) != Success)) return NULL; row->row_under = row_under; overlay->num_rows++; return row; } XkbOverlayPtr XkbAddGeomOverlay(XkbSectionPtr section, Atom name, int sz_rows) { register int i; XkbOverlayPtr overlay; if ((!section) || (name == None) || (sz_rows == 0)) return NULL; for (i = 0, overlay = section->overlays; i < section->num_overlays; i++, overlay++) { if (overlay->name == name) { if ((sz_rows > 0) && (_XkbAllocOverlayRows(overlay, sz_rows) != Success)) return NULL; return overlay; } } if ((section->num_overlays >= section->sz_overlays) && (_XkbAllocOverlays(section, 1) != Success)) return NULL; overlay = §ion->overlays[section->num_overlays]; if ((sz_rows > 0) && (_XkbAllocOverlayRows(overlay, sz_rows) != Success)) return NULL; overlay->name = name; overlay->section_under = section; section->num_overlays++; return overlay; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBGeom.c0000644000000000000000000005540013614532331015030 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef DEBUG #ifdef HAVE_CONFIG_H #include #endif #include #endif #define NEED_MAP_READERS #include "Xlibint.h" #include #include #include "XKBlibint.h" #ifndef MINSHORT #define MINSHORT -32768 #endif #ifndef MAXSHORT #define MAXSHORT 32767 #endif /***====================================================================***/ static void _XkbCheckBounds(XkbBoundsPtr bounds, int x, int y) { if (x < bounds->x1) bounds->x1 = x; if (x > bounds->x2) bounds->x2 = x; if (y < bounds->y1) bounds->y1 = y; if (y > bounds->y2) bounds->y2 = y; return; } Bool XkbComputeShapeBounds(XkbShapePtr shape) { register int o, p; XkbOutlinePtr outline; XkbPointPtr pt; if ((!shape) || (shape->num_outlines < 1)) return False; shape->bounds.x1 = shape->bounds.y1 = MAXSHORT; shape->bounds.x2 = shape->bounds.y2 = MINSHORT; for (outline = shape->outlines, o = 0; o < shape->num_outlines; o++, outline++) { for (pt = outline->points, p = 0; p < outline->num_points; p++, pt++) { _XkbCheckBounds(&shape->bounds, pt->x, pt->y); } if (outline->num_points < 2) { _XkbCheckBounds(&shape->bounds, 0, 0); } } return True; } Bool XkbComputeShapeTop(XkbShapePtr shape, XkbBoundsPtr bounds) { register int p; XkbOutlinePtr outline; XkbPointPtr pt; if ((!shape) || (shape->num_outlines < 1)) return False; if (shape->approx) outline = shape->approx; else outline = &shape->outlines[shape->num_outlines - 1]; if (outline->num_points < 2) { bounds->x1 = bounds->y1 = 0; bounds->x2 = bounds->y2 = 0; } else { bounds->x1 = bounds->y1 = MAXSHORT; bounds->x2 = bounds->y2 = MINSHORT; } for (pt = outline->points, p = 0; p < outline->num_points; p++, pt++) { _XkbCheckBounds(bounds, pt->x, pt->y); } return True; } Bool XkbComputeRowBounds(XkbGeometryPtr geom, XkbSectionPtr section, XkbRowPtr row) { register int k, pos; XkbKeyPtr key; XkbBoundsPtr bounds, sbounds; if ((!geom) || (!section) || (!row)) return False; bounds = &row->bounds; bzero(bounds, sizeof(XkbBoundsRec)); for (key = row->keys, pos = k = 0; k < row->num_keys; k++, key++) { sbounds = &XkbKeyShape(geom, key)->bounds; _XkbCheckBounds(bounds, pos, 0); if (!row->vertical) { if (key->gap != 0) { pos += key->gap; _XkbCheckBounds(bounds, pos, 0); } _XkbCheckBounds(bounds, pos + sbounds->x1, sbounds->y1); _XkbCheckBounds(bounds, pos + sbounds->x2, sbounds->y2); pos += sbounds->x2; } else { if (key->gap != 0) { pos += key->gap; _XkbCheckBounds(bounds, 0, pos); } _XkbCheckBounds(bounds, pos + sbounds->x1, sbounds->y1); _XkbCheckBounds(bounds, pos + sbounds->x2, sbounds->y2); pos += sbounds->y2; } } return True; } Bool XkbComputeSectionBounds(XkbGeometryPtr geom, XkbSectionPtr section) { register int i; XkbShapePtr shape; XkbRowPtr row; XkbDoodadPtr doodad; XkbBoundsPtr bounds, rbounds; if ((!geom) || (!section)) return False; bounds = §ion->bounds; bzero(bounds, sizeof(XkbBoundsRec)); for (i = 0, row = section->rows; i < section->num_rows; i++, row++) { if (!XkbComputeRowBounds(geom, section, row)) return False; rbounds = &row->bounds; _XkbCheckBounds(bounds, row->left + rbounds->x1, row->top + rbounds->y1); _XkbCheckBounds(bounds, row->left + rbounds->x2, row->top + rbounds->y2); } for (i = 0, doodad = section->doodads; i < section->num_doodads; i++, doodad++) { static XkbBoundsRec tbounds; switch (doodad->any.type) { case XkbOutlineDoodad: case XkbSolidDoodad: shape = XkbShapeDoodadShape(geom, &doodad->shape); rbounds = &shape->bounds; break; case XkbTextDoodad: tbounds.x1 = doodad->text.left; tbounds.y1 = doodad->text.top; tbounds.x2 = tbounds.x1 + doodad->text.width; tbounds.y2 = tbounds.y1 + doodad->text.height; rbounds = &tbounds; break; case XkbIndicatorDoodad: shape = XkbIndicatorDoodadShape(geom, &doodad->indicator); rbounds = &shape->bounds; break; case XkbLogoDoodad: shape = XkbLogoDoodadShape(geom, &doodad->logo); rbounds = &shape->bounds; break; default: tbounds.x1 = tbounds.x2 = doodad->any.left; tbounds.y1 = tbounds.y2 = doodad->any.top; rbounds = &tbounds; break; } _XkbCheckBounds(bounds, rbounds->x1, rbounds->y1); _XkbCheckBounds(bounds, rbounds->x2, rbounds->y2); } return True; } /***====================================================================***/ char * XkbFindOverlayForKey(XkbGeometryPtr geom, XkbSectionPtr wanted, char *under) { int s; XkbSectionPtr section; if ((geom == NULL) || (under == NULL) || (geom->num_sections < 1)) return NULL; if (wanted) section = wanted; else section = geom->sections; for (s = 0; s < geom->num_sections; s++, section++) { XkbOverlayPtr ol; int o; if (section->num_overlays < 1) continue; for (o = 0, ol = section->overlays; o < section->num_overlays; o++, ol++) { XkbOverlayRowPtr row; int r; for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) { XkbOverlayKeyPtr key; int k; for (k = 0, key = row->keys; k < row->num_keys; k++, key++) { if (strncmp(under, key->under.name, XkbKeyNameLength) == 0) return key->over.name; } } } if (wanted != NULL) break; } return NULL; } /***====================================================================***/ static Status _XkbReadGeomProperties(XkbReadBufferPtr buf, XkbGeometryPtr geom, xkbGetGeometryReply *rep) { Status rtrn; if (rep->nProperties < 1) return Success; if ((rtrn = XkbAllocGeomProps(geom, rep->nProperties)) == Success) { register int i; register Bool ok = True; for (i = 0; (i < rep->nProperties) && ok; i++) { char *name = NULL; char *value = NULL; ok = _XkbGetReadBufferCountedString(buf, &name) && ok; ok = _XkbGetReadBufferCountedString(buf, &value) && ok; ok = ok && (XkbAddGeomProperty(geom, name, value) != NULL); _XkbFree(name); _XkbFree(value); } if (ok) rtrn = Success; else rtrn = BadLength; } return rtrn; } static Status _XkbReadGeomKeyAliases(XkbReadBufferPtr buf, XkbGeometryPtr geom, xkbGetGeometryReply *rep) { Status rtrn; if (rep->nKeyAliases < 1) return Success; if ((rtrn = XkbAllocGeomKeyAliases(geom, rep->nKeyAliases)) == Success) { if (!_XkbCopyFromReadBuffer(buf, (char *) geom->key_aliases, (rep->nKeyAliases * XkbKeyNameLength * 2))) return BadLength; geom->num_key_aliases = rep->nKeyAliases; return Success; } else { /* alloc failed, just skip the aliases */ _XkbSkipReadBufferData(buf, (rep->nKeyAliases * XkbKeyNameLength * 2)); } return rtrn; } static Status _XkbReadGeomColors(XkbReadBufferPtr buf, XkbGeometryPtr geom, xkbGetGeometryReply *rep) { Status rtrn; if (rep->nColors < 1) return Success; if ((rtrn = XkbAllocGeomColors(geom, rep->nColors)) == Success) { register int i; for (i = 0; i < rep->nColors; i++) { char *spec = NULL; if (!_XkbGetReadBufferCountedString(buf, &spec)) rtrn = BadLength; else if (XkbAddGeomColor(geom, spec, geom->num_colors) == NULL) rtrn = BadAlloc; _XkbFree(spec); if (rtrn != Success) return rtrn; } return Success; } return rtrn; } static Status _XkbReadGeomShapes(XkbReadBufferPtr buf, XkbGeometryPtr geom, xkbGetGeometryReply *rep) { register int i; Status rtrn; if (rep->nShapes < 1) return Success; if ((rtrn = XkbAllocGeomShapes(geom, rep->nShapes)) != Success) return rtrn; for (i = 0; i < rep->nShapes; i++) { xkbShapeWireDesc *shapeWire; XkbShapePtr shape; register int o; shapeWire = (xkbShapeWireDesc *) _XkbGetReadBufferPtr(buf, SIZEOF(xkbShapeWireDesc)); if (!shapeWire) return BadLength; shape = XkbAddGeomShape(geom, shapeWire->name, shapeWire->nOutlines); if (!shape) return BadAlloc; for (o = 0; o < shapeWire->nOutlines; o++) { xkbOutlineWireDesc *olWire; XkbOutlinePtr ol; register int p; XkbPointPtr pt; olWire = (xkbOutlineWireDesc *) _XkbGetReadBufferPtr(buf, SIZEOF(xkbOutlineWireDesc)); if (!olWire) return BadLength; ol = XkbAddGeomOutline(shape, olWire->nPoints); if (!ol) return BadAlloc; ol->corner_radius = olWire->cornerRadius; for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++) { xkbPointWireDesc *ptWire; ptWire = (xkbPointWireDesc *) _XkbGetReadBufferPtr(buf, SIZEOF(xkbPointWireDesc)); if (!ptWire) return BadLength; pt->x = ptWire->x; pt->y = ptWire->y; } ol->num_points = olWire->nPoints; } if ((shapeWire->primaryNdx != XkbNoShape) && (shapeWire->primaryNdx < shapeWire->nOutlines)) shape->primary = &shape->outlines[shapeWire->primaryNdx]; else shape->primary = NULL; if ((shapeWire->approxNdx != XkbNoShape) && (shapeWire->approxNdx < shapeWire->nOutlines)) shape->approx = &shape->outlines[shapeWire->approxNdx]; else shape->approx = NULL; XkbComputeShapeBounds(shape); } return Success; } static Status _XkbReadGeomDoodad(XkbReadBufferPtr buf, XkbGeometryPtr geom, XkbSectionPtr section) { XkbDoodadPtr doodad; xkbDoodadWireDesc *doodadWire; doodadWire = (xkbDoodadWireDesc *) _XkbGetReadBufferPtr(buf, SIZEOF(xkbDoodadWireDesc)); if (!doodadWire) return BadLength; doodad = XkbAddGeomDoodad(geom, section, doodadWire->any.name); if (!doodad) return BadAlloc; doodad->any.type = doodadWire->any.type; doodad->any.priority = doodadWire->any.priority; doodad->any.top = doodadWire->any.top; doodad->any.left = doodadWire->any.left; doodad->any.angle = doodadWire->any.angle; switch (doodad->any.type) { case XkbOutlineDoodad: case XkbSolidDoodad: doodad->shape.color_ndx = doodadWire->shape.colorNdx; doodad->shape.shape_ndx = doodadWire->shape.shapeNdx; break; case XkbTextDoodad: doodad->text.width = doodadWire->text.width; doodad->text.height = doodadWire->text.height; doodad->text.color_ndx = doodadWire->text.colorNdx; if (!_XkbGetReadBufferCountedString(buf, &doodad->text.text)) return BadLength; if (!_XkbGetReadBufferCountedString(buf, &doodad->text.font)) return BadLength; break; case XkbIndicatorDoodad: doodad->indicator.shape_ndx = doodadWire->indicator.shapeNdx; doodad->indicator.on_color_ndx = doodadWire->indicator.onColorNdx; doodad->indicator.off_color_ndx = doodadWire->indicator.offColorNdx; break; case XkbLogoDoodad: doodad->logo.color_ndx = doodadWire->logo.colorNdx; doodad->logo.shape_ndx = doodadWire->logo.shapeNdx; if (!_XkbGetReadBufferCountedString(buf, &doodad->logo.logo_name)) return BadLength; break; default: return BadValue; } return Success; } static Status _XkbReadGeomOverlay(XkbReadBufferPtr buf, XkbGeometryPtr geom, XkbSectionPtr section) { XkbOverlayPtr ol; xkbOverlayWireDesc *olWire; register int r; olWire = (xkbOverlayWireDesc *) _XkbGetReadBufferPtr(buf, SIZEOF(xkbOverlayWireDesc)); if (olWire == NULL) return BadLength; ol = XkbAddGeomOverlay(section, olWire->name, olWire->nRows); if (ol == NULL) return BadLength; for (r = 0; r < olWire->nRows; r++) { register int k; XkbOverlayRowPtr row; xkbOverlayRowWireDesc *rowWire; xkbOverlayKeyWireDesc *keyWire; rowWire = (xkbOverlayRowWireDesc *) _XkbGetReadBufferPtr(buf, SIZEOF(xkbOverlayRowWireDesc)); if (rowWire == NULL) return BadLength; row = XkbAddGeomOverlayRow(ol, rowWire->rowUnder, rowWire->nKeys); if (!row) return BadAlloc; row->row_under = rowWire->rowUnder; if (rowWire->nKeys < 1) continue; keyWire = (xkbOverlayKeyWireDesc *) _XkbGetReadBufferPtr(buf, SIZEOF(xkbOverlayKeyWireDesc) * rowWire->nKeys); if (keyWire == NULL) return BadLength; for (k = 0; k < rowWire->nKeys; k++, keyWire++, row->num_keys++) { memcpy(row->keys[row->num_keys].over.name, keyWire->over, XkbKeyNameLength); memcpy(row->keys[row->num_keys].under.name, keyWire->under, XkbKeyNameLength); } } return Success; } static Status _XkbReadGeomSections(XkbReadBufferPtr buf, XkbGeometryPtr geom, xkbGetGeometryReply *rep) { register int s; XkbSectionPtr section; xkbSectionWireDesc *sectionWire; Status rtrn; if (rep->nSections < 1) return Success; if ((rtrn = XkbAllocGeomSections(geom, rep->nSections)) != Success) return rtrn; for (s = 0; s < rep->nSections; s++) { sectionWire = (xkbSectionWireDesc *) _XkbGetReadBufferPtr(buf, SIZEOF(xkbSectionWireDesc)); if (!sectionWire) return BadLength; section = XkbAddGeomSection(geom, sectionWire->name, sectionWire->nRows, sectionWire->nDoodads, sectionWire->nOverlays); if (!section) return BadAlloc; section->top = sectionWire->top; section->left = sectionWire->left; section->width = sectionWire->width; section->height = sectionWire->height; section->angle = sectionWire->angle; section->priority = sectionWire->priority; if (sectionWire->nRows > 0) { register int r; for (r = 0; r < sectionWire->nRows; r++) { XkbRowPtr row; xkbRowWireDesc *rowWire; rowWire = (xkbRowWireDesc *) _XkbGetReadBufferPtr(buf, SIZEOF(xkbRowWireDesc)); if (!rowWire) return BadLength; row = XkbAddGeomRow(section, rowWire->nKeys); if (!row) return BadAlloc; row->top = rowWire->top; row->left = rowWire->left; row->vertical = rowWire->vertical; if (rowWire->nKeys > 0) { register int k; for (k = 0; k < rowWire->nKeys; k++) { XkbKeyPtr key; xkbKeyWireDesc *keyWire; keyWire = (xkbKeyWireDesc *) _XkbGetReadBufferPtr(buf, SIZEOF(xkbKeyWireDesc)); if (!keyWire) return BadLength; key = XkbAddGeomKey(row); if (!key) return BadAlloc; memcpy(key->name.name, keyWire->name, XkbKeyNameLength); key->gap = keyWire->gap; key->shape_ndx = keyWire->shapeNdx; key->color_ndx = keyWire->colorNdx; } } } } if (sectionWire->nDoodads > 0) { register int d; for (d = 0; d < sectionWire->nDoodads; d++) { if ((rtrn = _XkbReadGeomDoodad(buf, geom, section)) != Success) return rtrn; } } if (sectionWire->nOverlays > 0) { register int o; for (o = 0; o < sectionWire->nOverlays; o++) { if ((rtrn = _XkbReadGeomOverlay(buf, geom, section)) != Success) return rtrn; } } } return Success; } static Status _XkbReadGeomDoodads(XkbReadBufferPtr buf, XkbGeometryPtr geom, xkbGetGeometryReply *rep) { register int d; Status rtrn; if (rep->nDoodads < 1) return Success; if ((rtrn = XkbAllocGeomDoodads(geom, rep->nDoodads)) != Success) return rtrn; for (d = 0; d < rep->nDoodads; d++) { if ((rtrn = _XkbReadGeomDoodad(buf, geom, NULL)) != Success) return rtrn; } return Success; } Status _XkbReadGetGeometryReply(Display *dpy, xkbGetGeometryReply *rep, XkbDescPtr xkb, int *nread_rtrn) { XkbGeometryPtr geom; geom = _XkbTypedCalloc(1, XkbGeometryRec); if (!geom) return BadAlloc; if (xkb->geom) XkbFreeGeometry(xkb->geom, XkbGeomAllMask, True); xkb->geom = geom; geom->name = rep->name; geom->width_mm = rep->widthMM; geom->height_mm = rep->heightMM; if (rep->length) { XkbReadBufferRec buf; int left; if (_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) { Status status = Success; if (nread_rtrn) *nread_rtrn = (int) rep->length * 4; if (!_XkbGetReadBufferCountedString(&buf, &geom->label_font)) status = BadLength; if (status == Success) status = _XkbReadGeomProperties(&buf, geom, rep); if (status == Success) status = _XkbReadGeomColors(&buf, geom, rep); if (status == Success) status = _XkbReadGeomShapes(&buf, geom, rep); if (status == Success) status = _XkbReadGeomSections(&buf, geom, rep); if (status == Success) status = _XkbReadGeomDoodads(&buf, geom, rep); if (status == Success) status = _XkbReadGeomKeyAliases(&buf, geom, rep); left = _XkbFreeReadBuffer(&buf); if ((rep->baseColorNdx > geom->num_colors) || (rep->labelColorNdx > geom->num_colors)) status = BadLength; if ((status != Success) || left || buf.error) { if (status == Success) status = BadLength; XkbFreeGeometry(geom, XkbGeomAllMask, True); xkb->geom = NULL; return status; } geom->base_color = &geom->colors[rep->baseColorNdx]; geom->label_color = &geom->colors[rep->labelColorNdx]; } else { XkbFreeGeometry(geom, XkbGeomAllMask, True); xkb->geom = NULL; return BadAlloc; } } return Success; } Status XkbGetGeometry(Display *dpy, XkbDescPtr xkb) { xkbGetGeometryReq *req; xkbGetGeometryReply rep; Status status; if ((!xkb) || (dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; LockDisplay(dpy); GetReq(kbGetGeometry, req); req->reqType = dpy->xkb_info->codes->major_opcode; req->xkbReqType = X_kbGetGeometry; req->deviceSpec = xkb->device_spec; req->name = None; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) status = BadImplementation; else if (!rep.found) status = BadName; else status = _XkbReadGetGeometryReply(dpy, &rep, xkb, NULL); UnlockDisplay(dpy); SyncHandle(); return status; } Status XkbGetNamedGeometry(Display *dpy, XkbDescPtr xkb, Atom name) { xkbGetGeometryReq *req; xkbGetGeometryReply rep; Status status; if ((name == None) || (dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; LockDisplay(dpy); GetReq(kbGetGeometry, req); req->reqType = dpy->xkb_info->codes->major_opcode; req->xkbReqType = X_kbGetGeometry; req->deviceSpec = xkb->device_spec; req->name = (CARD32) name; if ((!_XReply(dpy, (xReply *) &rep, 0, xFalse)) || (!rep.found)) status = BadImplementation; else if (!rep.found) status = BadName; else status = _XkbReadGetGeometryReply(dpy, &rep, xkb, NULL); UnlockDisplay(dpy); SyncHandle(); return status; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBGetByName.c0000644000000000000000000001616013614532331015754 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #define NEED_MAP_READERS #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include "XKBlibint.h" /***====================================================================***/ XkbDescPtr XkbGetKeyboardByName(Display *dpy, unsigned deviceSpec, XkbComponentNamesPtr names, unsigned want, unsigned need, Bool load) { register xkbGetKbdByNameReq *req; xkbGetKbdByNameReply rep; int len, extraLen = 0; char *str; XkbDescPtr xkb; int mapLen, codesLen, typesLen, compatLen; int symsLen, geomLen; XkbInfoPtr xkbi; if ((dpy == NULL) || (dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return NULL; xkbi = dpy->xkb_info; xkb = (XkbDescRec *) _XkbCalloc(1, sizeof(XkbDescRec)); if (!xkb) return NULL; xkb->device_spec = deviceSpec; xkb->map = (XkbClientMapRec *) _XkbCalloc(1, sizeof(XkbClientMapRec)); xkb->dpy = dpy; LockDisplay(dpy); GetReq(kbGetKbdByName, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbGetKbdByName; req->deviceSpec = xkb->device_spec; req->want = want; req->need = need; req->load = load; mapLen = codesLen = typesLen = compatLen = symsLen = geomLen = 0; if (names) { if (names->keymap) mapLen = (int) strlen(names->keymap); if (names->keycodes) codesLen = (int) strlen(names->keycodes); if (names->types) typesLen = (int) strlen(names->types); if (names->compat) compatLen = (int) strlen(names->compat); if (names->symbols) symsLen = (int) strlen(names->symbols); if (names->geometry) geomLen = (int) strlen(names->geometry); if (mapLen > 255) mapLen = 255; if (codesLen > 255) codesLen = 255; if (typesLen > 255) typesLen = 255; if (compatLen > 255) compatLen = 255; if (symsLen > 255) symsLen = 255; if (geomLen > 255) geomLen = 255; } else mapLen = codesLen = typesLen = compatLen = symsLen = geomLen = 0; len = mapLen + codesLen + typesLen + compatLen + symsLen + geomLen + 6; len = XkbPaddedSize(len); req->length += len / 4; BufAlloc(char *, str, len); *str++ = mapLen; if (mapLen > 0) { memcpy(str, names->keymap, mapLen); str += mapLen; } *str++ = codesLen; if (codesLen > 0) { memcpy(str, names->keycodes, codesLen); str += codesLen; } *str++ = typesLen; if (typesLen > 0) { memcpy(str, names->types, typesLen); str += typesLen; } *str++ = compatLen; if (compatLen > 0) { memcpy(str, names->compat, compatLen); str += compatLen; } *str++ = symsLen; if (symsLen > 0) { memcpy(str, names->symbols, symsLen); str += symsLen; } *str++ = geomLen; if (geomLen > 0) { memcpy(str, names->geometry, geomLen); str += geomLen; } if ((!_XReply(dpy, (xReply *) &rep, 0, xFalse)) || (!rep.reported)) goto BAILOUT; extraLen = (int) rep.length * 4; xkb->device_spec = rep.deviceID; xkb->min_key_code = rep.minKeyCode; xkb->max_key_code = rep.maxKeyCode; if (rep.reported & (XkbGBN_SymbolsMask | XkbGBN_TypesMask)) { xkbGetMapReply mrep; Status status; int nread = 0; _XRead(dpy, (char *) &mrep, SIZEOF(xkbGetMapReply)); extraLen -= SIZEOF(xkbGetMapReply); status = _XkbReadGetMapReply(dpy, &mrep, xkb, &nread); extraLen -= nread; if (status != Success) goto BAILOUT; } if (rep.reported & XkbGBN_CompatMapMask) { xkbGetCompatMapReply crep; Status status; int nread = 0; _XRead(dpy, (char *) &crep, SIZEOF(xkbGetCompatMapReply)); extraLen -= SIZEOF(xkbGetCompatMapReply); status = _XkbReadGetCompatMapReply(dpy, &crep, xkb, &nread); extraLen -= nread; if (status != Success) goto BAILOUT; } if (rep.reported & XkbGBN_IndicatorMapMask) { xkbGetIndicatorMapReply irep; Status status; int nread = 0; _XRead(dpy, (char *) &irep, SIZEOF(xkbGetIndicatorMapReply)); extraLen -= SIZEOF(xkbGetIndicatorMapReply); status = _XkbReadGetIndicatorMapReply(dpy, &irep, xkb, &nread); extraLen -= nread; if (status != Success) goto BAILOUT; } if (rep.reported & (XkbGBN_KeyNamesMask | XkbGBN_OtherNamesMask)) { xkbGetNamesReply nrep; Status status; int nread = 0; _XRead(dpy, (char *) &nrep, SIZEOF(xkbGetNamesReply)); extraLen -= SIZEOF(xkbGetNamesReply); status = _XkbReadGetNamesReply(dpy, &nrep, xkb, &nread); extraLen -= nread; if (status != Success) goto BAILOUT; } if (rep.reported & XkbGBN_GeometryMask) { xkbGetGeometryReply grep; Status status; int nread = 0; _XRead(dpy, (char *) &grep, SIZEOF(xkbGetGeometryReply)); extraLen -= SIZEOF(xkbGetGeometryReply); status = _XkbReadGetGeometryReply(dpy, &grep, xkb, &nread); extraLen -= nread; if (status != Success) goto BAILOUT; } if (extraLen > 0) goto BAILOUT; UnlockDisplay(dpy); SyncHandle(); return xkb; BAILOUT: if (xkb != NULL) XkbFreeKeyboard(xkb, XkbAllComponentsMask, xTrue); if (extraLen > 0) _XEatData(dpy, extraLen); UnlockDisplay(dpy); SyncHandle(); return NULL; } XkbDescPtr XkbGetKeyboard(Display *dpy, unsigned which, unsigned deviceSpec) { return XkbGetKeyboardByName(dpy, deviceSpec, NULL, which, which, False); } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBGetMap.c0000644000000000000000000006624413614532331015326 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #define NEED_MAP_READERS #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include "XKBlibint.h" static Status _XkbReadKeyTypes(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) { int i, n, lastMapCount; XkbKeyTypePtr type; if (rep->nTypes > 0) { n = rep->firstType + rep->nTypes; if (xkb->map->num_types >= n) n = xkb->map->num_types; else if (XkbAllocClientMap(xkb, XkbKeyTypesMask, n) != Success) return BadAlloc; type = &xkb->map->types[rep->firstType]; for (i = 0; i < (int) rep->nTypes; i++, type++) { xkbKeyTypeWireDesc *desc; register int ndx; ndx = i + rep->firstType; if (ndx >= xkb->map->num_types) xkb->map->num_types = ndx + 1; desc = (xkbKeyTypeWireDesc *) _XkbGetReadBufferPtr(buf, SIZEOF(xkbKeyTypeWireDesc)); if (desc == NULL) return BadLength; lastMapCount = type->map_count; if (desc->nMapEntries > 0) { if ((type->map == NULL) || (desc->nMapEntries > type->map_count)) { XkbKTMapEntryRec *prev_map = type->map; type->map = _XkbTypedRealloc(type->map, desc->nMapEntries, XkbKTMapEntryRec); if (type->map == NULL) { _XkbFree(prev_map); return BadAlloc; } } } else if (type->map != NULL) { Xfree(type->map); type->map_count = 0; type->map = NULL; } if (desc->preserve && (desc->nMapEntries > 0)) { if ((!type->preserve) || (desc->nMapEntries > lastMapCount)) { XkbModsRec *prev_preserve = type->preserve; type->preserve = _XkbTypedRealloc(type->preserve, desc->nMapEntries, XkbModsRec); if (type->preserve == NULL) { _XkbFree(prev_preserve); return BadAlloc; } } } else if (type->preserve != NULL) { Xfree(type->preserve); type->preserve = NULL; } type->mods.mask = desc->mask; type->mods.real_mods = desc->realMods; type->mods.vmods = desc->virtualMods; type->num_levels = desc->numLevels; type->map_count = desc->nMapEntries; if (desc->nMapEntries > 0) { register xkbKTMapEntryWireDesc *wire; register XkbKTMapEntryPtr entry; register int size; size = type->map_count * SIZEOF(xkbKTMapEntryWireDesc); wire = (xkbKTMapEntryWireDesc *) _XkbGetReadBufferPtr(buf, size); if (wire == NULL) return BadLength; entry = type->map; for (n = 0; n < type->map_count; n++, wire++, entry++) { entry->active = wire->active; entry->level = wire->level; entry->mods.mask = wire->mask; entry->mods.real_mods = wire->realMods; entry->mods.vmods = wire->virtualMods; } if (desc->preserve) { register xkbModsWireDesc *pwire; register XkbModsPtr preserve; register int sz; sz = desc->nMapEntries * SIZEOF(xkbModsWireDesc); pwire = (xkbModsWireDesc *) _XkbGetReadBufferPtr(buf, sz); if (pwire == NULL) return BadLength; preserve = type->preserve; for (n = 0; n < desc->nMapEntries; n++, pwire++, preserve++) { preserve->mask = pwire->mask; preserve->vmods = pwire->virtualMods; preserve->real_mods = pwire->realMods; } } } } } return Success; } static Status _XkbReadKeySyms(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) { register int i; XkbClientMapPtr map; int size = xkb->max_key_code + 1; if (((unsigned short) rep->firstKeySym + rep->nKeySyms) > size) return BadLength; map = xkb->map; if (map->key_sym_map == NULL) { register int offset; XkbSymMapPtr oldMap; xkbSymMapWireDesc *newMap; map->key_sym_map = _XkbTypedCalloc(size, XkbSymMapRec); if (map->key_sym_map == NULL) return BadAlloc; if (map->syms == NULL) { int sz; sz = (rep->totalSyms * 12) / 10; sz = ((sz + (unsigned) 128) / 128) * 128; map->syms = _XkbTypedCalloc(sz, KeySym); if (map->syms == NULL) return BadAlloc; map->size_syms = sz; } offset = 1; oldMap = &map->key_sym_map[rep->firstKeySym]; for (i = 0; i < (int) rep->nKeySyms; i++, oldMap++) { newMap = (xkbSymMapWireDesc *) _XkbGetReadBufferPtr(buf, SIZEOF(xkbSymMapWireDesc)); if (newMap == NULL) return BadLength; oldMap->kt_index[0] = newMap->ktIndex[0]; oldMap->kt_index[1] = newMap->ktIndex[1]; oldMap->kt_index[2] = newMap->ktIndex[2]; oldMap->kt_index[3] = newMap->ktIndex[3]; oldMap->group_info = newMap->groupInfo; oldMap->width = newMap->width; oldMap->offset = offset; if (offset + newMap->nSyms >= map->size_syms) { register int sz; KeySym *prev_syms = map->syms; sz = map->size_syms + 128; map->syms = _XkbTypedRealloc(map->syms, sz, KeySym); if (map->syms == NULL) { _XkbFree(prev_syms); map->size_syms = 0; return BadAlloc; } map->size_syms = sz; } if (newMap->nSyms > 0) { _XkbReadBufferCopyKeySyms(buf, (KeySym *) &map->syms[offset], newMap->nSyms); offset += newMap->nSyms; } else { map->syms[offset] = 0; } } map->num_syms = offset; } else { XkbSymMapPtr oldMap = &map->key_sym_map[rep->firstKeySym]; for (i = 0; i < (int) rep->nKeySyms; i++, oldMap++) { xkbSymMapWireDesc *newMap; KeySym *newSyms; int tmp; newMap = (xkbSymMapWireDesc *) _XkbGetReadBufferPtr(buf, SIZEOF(xkbSymMapWireDesc)); if (newMap == NULL) return BadLength; if (newMap->nSyms > 0) tmp = newMap->nSyms; else tmp = 0; newSyms = XkbResizeKeySyms(xkb, i + rep->firstKeySym, tmp); if (newSyms == NULL) return BadAlloc; if (newMap->nSyms > 0) _XkbReadBufferCopyKeySyms(buf, newSyms, newMap->nSyms); else newSyms[0] = NoSymbol; oldMap->kt_index[0] = newMap->ktIndex[0]; oldMap->kt_index[1] = newMap->ktIndex[1]; oldMap->kt_index[2] = newMap->ktIndex[2]; oldMap->kt_index[3] = newMap->ktIndex[3]; oldMap->group_info = newMap->groupInfo; oldMap->width = newMap->width; } } return Success; } static Status _XkbReadKeyActions(XkbReadBufferPtr buf, XkbDescPtr info, xkbGetMapReply *rep) { int i; CARD8 numDescBuf[248]; CARD8 *numDesc = NULL; register int nKeyActs; Status ret = Success; if ((nKeyActs = rep->nKeyActs) > 0) { XkbSymMapPtr symMap; if (nKeyActs < sizeof numDescBuf) numDesc = numDescBuf; else numDesc = Xmalloc(nKeyActs * sizeof(CARD8)); if (!_XkbCopyFromReadBuffer(buf, (char *) numDesc, nKeyActs)) { ret = BadLength; goto done; } i = XkbPaddedSize(nKeyActs) - nKeyActs; if ((i > 0) && (!_XkbSkipReadBufferData(buf, i))) { ret = BadLength; goto done; } symMap = &info->map->key_sym_map[rep->firstKeyAct]; for (i = 0; i < (int) rep->nKeyActs; i++, symMap++) { if (numDesc[i] == 0) { if ((i + rep->firstKeyAct) > (info->max_key_code + 1)) { ret = BadLength; goto done; } info->server->key_acts[i + rep->firstKeyAct] = 0; } else { XkbAction *newActs; /* 8/16/93 (ef) -- XXX! Verify size here (numdesc must be */ /* either zero or XkbKeyNumSyms(info,key) */ newActs = XkbResizeKeyActions(info, i + rep->firstKeyAct, numDesc[i]); if (newActs == NULL) { ret = BadAlloc; goto done; } if (!_XkbCopyFromReadBuffer(buf, (char *) newActs, (int) (numDesc[i] * sizeof(XkbAction)))) { ret = BadLength; goto done; } } } } done: if (numDesc != NULL && numDesc != numDescBuf) Xfree(numDesc); return ret; } static Status _XkbReadKeyBehaviors(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) { register int i; if (rep->totalKeyBehaviors > 0) { int size = xkb->max_key_code + 1; if (((int) rep->firstKeyBehavior + rep->nKeyBehaviors) > size) return BadLength; if (xkb->server->behaviors == NULL) { xkb->server->behaviors = _XkbTypedCalloc(size, XkbBehavior); if (xkb->server->behaviors == NULL) return BadAlloc; } else { bzero(&xkb->server->behaviors[rep->firstKeyBehavior], (rep->nKeyBehaviors * sizeof(XkbBehavior))); } for (i = 0; i < rep->totalKeyBehaviors; i++) { xkbBehaviorWireDesc *wire; wire = (xkbBehaviorWireDesc *) _XkbGetReadBufferPtr(buf, SIZEOF(xkbBehaviorWireDesc)); if (wire == NULL || wire->key >= size) return BadLength; xkb->server->behaviors[wire->key].type = wire->type; xkb->server->behaviors[wire->key].data = wire->data; } } return Success; } static Status _XkbReadVirtualMods(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) { if (rep->virtualMods) { register int i, bit, nVMods; register char *data; for (i = nVMods = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { if (rep->virtualMods & bit) nVMods++; } data = _XkbGetReadBufferPtr(buf, XkbPaddedSize(nVMods)); if (data == NULL) return BadLength; for (i = 0, bit = 1; (i < XkbNumVirtualMods) && (nVMods > 0); i++, bit <<= 1) { if (rep->virtualMods & bit) { xkb->server->vmods[i] = *data++; nVMods--; } } } return Success; } static Status _XkbReadExplicitComponents(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) { register int i; unsigned char *wire; if (rep->totalKeyExplicit > 0) { int size = xkb->max_key_code + 1; if (((int) rep->firstKeyExplicit + rep->nKeyExplicit) > size) return BadLength; if (xkb->server->explicit == NULL) { xkb->server->explicit = _XkbTypedCalloc(size, unsigned char); if (xkb->server->explicit == NULL) return BadAlloc; } else { bzero(&xkb->server->explicit[rep->firstKeyExplicit], rep->nKeyExplicit); } i = XkbPaddedSize(2 * rep->totalKeyExplicit); wire = (unsigned char *) _XkbGetReadBufferPtr(buf, i); if (!wire) return BadLength; for (i = 0; i < rep->totalKeyExplicit; i++, wire += 2) { if (wire[0] > xkb->max_key_code || wire[1] > xkb->max_key_code) return BadLength; xkb->server->explicit[wire[0]] = wire[1]; } } return Success; } static Status _XkbReadModifierMap(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) { register int i; unsigned char *wire; if (rep->totalModMapKeys > 0) { if (((int) rep->firstModMapKey + rep->nModMapKeys) > (xkb->max_key_code + 1)) return BadLength; if ((xkb->map->modmap == NULL) && (XkbAllocClientMap(xkb, XkbModifierMapMask, 0) != Success)) { return BadAlloc; } else { bzero(&xkb->map->modmap[rep->firstModMapKey], rep->nModMapKeys); } i = XkbPaddedSize(2 * rep->totalModMapKeys); wire = (unsigned char *) _XkbGetReadBufferPtr(buf, i); if (!wire) return BadLength; for (i = 0; i < rep->totalModMapKeys; i++, wire += 2) { if (wire[0] > xkb->max_key_code || wire[1] > xkb->max_key_code) return BadLength; xkb->map->modmap[wire[0]] = wire[1]; } } return Success; } static Status _XkbReadVirtualModMap(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) { register int i; xkbVModMapWireDesc *wire; XkbServerMapPtr srv; if (rep->totalVModMapKeys > 0) { if (((int) rep->firstVModMapKey + rep->nVModMapKeys) > xkb->max_key_code + 1) return BadLength; if (((xkb->server == NULL) || (xkb->server->vmodmap == NULL)) && (XkbAllocServerMap(xkb, XkbVirtualModMapMask, 0) != Success)) { return BadAlloc; } else { srv = xkb->server; if (rep->nVModMapKeys > rep->firstVModMapKey) bzero((char *) &srv->vmodmap[rep->firstVModMapKey], (rep->nVModMapKeys - rep->firstVModMapKey) * sizeof(unsigned short)); } srv = xkb->server; i = rep->totalVModMapKeys * SIZEOF(xkbVModMapWireDesc); wire = (xkbVModMapWireDesc *) _XkbGetReadBufferPtr(buf, i); if (!wire) return BadLength; for (i = 0; i < rep->totalVModMapKeys; i++, wire++) { if ((wire->key >= xkb->min_key_code) && (wire->key <= xkb->max_key_code)) srv->vmodmap[wire->key] = wire->vmods; } } return Success; } static xkbGetMapReq * _XkbGetGetMapReq(Display *dpy, XkbDescPtr xkb) { xkbGetMapReq *req; GetReq(kbGetMap, req); req->reqType = dpy->xkb_info->codes->major_opcode; req->xkbReqType = X_kbGetMap; req->deviceSpec = xkb->device_spec; req->full = req->partial = 0; req->firstType = req->nTypes = 0; req->firstKeySym = req->nKeySyms = 0; req->firstKeyAct = req->nKeyActs = 0; req->firstKeyBehavior = req->nKeyBehaviors = 0; req->virtualMods = 0; req->firstKeyExplicit = req->nKeyExplicit = 0; req->firstModMapKey = req->nModMapKeys = 0; req->firstVModMapKey = req->nVModMapKeys = 0; return req; } Status _XkbReadGetMapReply(Display *dpy, xkbGetMapReply *rep, XkbDescPtr xkb, int *nread_rtrn) { int extraData; unsigned mask; if (xkb->device_spec == XkbUseCoreKbd) xkb->device_spec = rep->deviceID; if (rep->maxKeyCode < rep->minKeyCode) return BadImplementation; xkb->min_key_code = rep->minKeyCode; xkb->max_key_code = rep->maxKeyCode; if (!xkb->map) { mask = rep->present & XkbAllClientInfoMask; if (mask && (XkbAllocClientMap(xkb, mask, rep->nTypes) != Success)) return BadAlloc; } if (!xkb->server) { mask = rep->present & XkbAllServerInfoMask; if (mask && (XkbAllocServerMap(xkb, mask, rep->totalActs) != Success)) return BadAlloc; } extraData = (int) (rep->length * 4); extraData -= (SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)); if (rep->length) { XkbReadBufferRec buf; int left; if (_XkbInitReadBuffer(dpy, &buf, extraData)) { Status status = Success; if (nread_rtrn != NULL) *nread_rtrn = extraData; if (status == Success) status = _XkbReadKeyTypes(&buf, xkb, rep); if (status == Success) status = _XkbReadKeySyms(&buf, xkb, rep); if (status == Success) status = _XkbReadKeyActions(&buf, xkb, rep); if (status == Success) status = _XkbReadKeyBehaviors(&buf, xkb, rep); if (status == Success) status = _XkbReadVirtualMods(&buf, xkb, rep); if (status == Success) status = _XkbReadExplicitComponents(&buf, xkb, rep); if (status == Success) status = _XkbReadModifierMap(&buf, xkb, rep); if (status == Success) status = _XkbReadVirtualModMap(&buf, xkb, rep); left = _XkbFreeReadBuffer(&buf); if (status != Success) return status; else if (left || buf.error) return BadLength; } else return BadAlloc; } return Success; } static Status _XkbHandleGetMapReply(Display *dpy, XkbDescPtr xkb) { xkbGetMapReply rep; if (!_XReply(dpy, (xReply *) &rep, ((SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2), xFalse)) { return BadImplementation; } return _XkbReadGetMapReply(dpy, &rep, xkb, NULL); } Status XkbGetUpdatedMap(Display *dpy, unsigned which, XkbDescPtr xkb) { if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; if (which) { register xkbGetMapReq *req; Status status; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->full = which; status = _XkbHandleGetMapReply(dpy, xkb); UnlockDisplay(dpy); SyncHandle(); return status; } return Success; } XkbDescPtr XkbGetMap(Display *dpy, unsigned which, unsigned deviceSpec) { XkbDescPtr xkb; xkb = _XkbTypedCalloc(1, XkbDescRec); if (xkb) { xkb->device_spec = deviceSpec; xkb->map = _XkbTypedCalloc(1, XkbClientMapRec); if ((xkb->map == NULL) || ((which) && (XkbGetUpdatedMap(dpy, which, xkb) != Success))) { if (xkb->map) { Xfree(xkb->map); xkb->map = NULL; } Xfree(xkb); return NULL; } xkb->dpy = dpy; } return xkb; } Status XkbGetKeyTypes(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; if ((num < 1) || (num > XkbMaxKeyTypes)) return BadValue; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->firstType = first; req->nTypes = num; status = _XkbHandleGetMapReply(dpy, xkb); UnlockDisplay(dpy); SyncHandle(); return status; } Status XkbGetKeyActions(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; if ((num < 1) || (num > XkbMaxKeyCount)) return BadValue; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->firstKeyAct = first; req->nKeyActs = num; status = _XkbHandleGetMapReply(dpy, xkb); UnlockDisplay(dpy); SyncHandle(); return status; } Status XkbGetKeySyms(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; if ((num < 1) || (num > XkbMaxKeyCount)) return BadValue; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->firstKeySym = first; req->nKeySyms = num; status = _XkbHandleGetMapReply(dpy, xkb); UnlockDisplay(dpy); SyncHandle(); return status; } Status XkbGetKeyBehaviors(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; if ((num < 1) || (num > XkbMaxKeyCount)) return BadValue; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->firstKeyBehavior = first; req->nKeyBehaviors = num; status = _XkbHandleGetMapReply(dpy, xkb); UnlockDisplay(dpy); SyncHandle(); return status; } Status XkbGetVirtualMods(Display *dpy, unsigned which, XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->virtualMods = which; status = _XkbHandleGetMapReply(dpy, xkb); UnlockDisplay(dpy); SyncHandle(); return status; } Status XkbGetKeyExplicitComponents(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; if ((num < 1) || (num > XkbMaxKeyCount)) return BadValue; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->firstKeyExplicit = first; req->nKeyExplicit = num; if ((xkb != NULL) && (xkb->server != NULL) && (xkb->server->explicit != NULL)) { if ((num > 0) && (first >= xkb->min_key_code) && (first + num <= xkb->max_key_code)) bzero(&xkb->server->explicit[first], num); } if (xkb) status = _XkbHandleGetMapReply(dpy, xkb); else status = BadMatch; UnlockDisplay(dpy); SyncHandle(); return status; } Status XkbGetKeyModifierMap(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; if ((num < 1) || (num > XkbMaxKeyCount)) return BadValue; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->firstModMapKey = first; req->nModMapKeys = num; if ((xkb != NULL) && (xkb->map != NULL) && (xkb->map->modmap != NULL)) { if ((num > 0) && (first >= xkb->min_key_code) && (first + num <= xkb->max_key_code)) bzero(&xkb->map->modmap[first], num); } if (xkb) status = _XkbHandleGetMapReply(dpy, xkb); else status = BadMatch; UnlockDisplay(dpy); SyncHandle(); return status; } Status XkbGetKeyVirtualModMap(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; if ((num < 1) || (num > XkbMaxKeyCount)) return BadValue; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->firstVModMapKey = first; req->nVModMapKeys = num; if ((xkb != NULL) && (xkb->map != NULL) && (xkb->map->modmap != NULL)) { if ((num > 0) && (first >= xkb->min_key_code) && (first + num <= xkb->max_key_code)) bzero(&xkb->server->vmodmap[first], num * sizeof(unsigned short)); } if (xkb) status = _XkbHandleGetMapReply(dpy, xkb); else status = BadMatch; UnlockDisplay(dpy); SyncHandle(); return status; } Status XkbGetMapChanges(Display *dpy, XkbDescPtr xkb, XkbMapChangesPtr changes) { xkbGetMapReq *req; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; LockDisplay(dpy); if (changes->changed) { Status status = Success; req = _XkbGetGetMapReq(dpy, xkb); req->full = 0; req->partial = changes->changed; req->firstType = changes->first_type; req->nTypes = changes->num_types; req->firstKeySym = changes->first_key_sym; req->nKeySyms = changes->num_key_syms; req->firstKeyAct = changes->first_key_act; req->nKeyActs = changes->num_key_acts; req->firstKeyBehavior = changes->first_key_behavior; req->nKeyBehaviors = changes->num_key_behaviors; req->virtualMods = changes->vmods; req->firstKeyExplicit = changes->first_key_explicit; req->nKeyExplicit = changes->num_key_explicit; req->firstModMapKey = changes->first_modmap_key; req->nModMapKeys = changes->num_modmap_keys; req->firstVModMapKey = changes->first_vmodmap_key; req->nVModMapKeys = changes->num_vmodmap_keys; status = _XkbHandleGetMapReply(dpy, xkb); UnlockDisplay(dpy); SyncHandle(); return status; } UnlockDisplay(dpy); return Success; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBleds.c0000644000000000000000000002574213614532331015076 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #define NEED_MAP_READERS #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include "XKBlibint.h" Status XkbGetIndicatorState(Display *dpy, unsigned deviceSpec, unsigned *pStateRtrn) { register xkbGetIndicatorStateReq *req; xkbGetIndicatorStateReply rep; XkbInfoPtr xkbi; Bool ok; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbGetIndicatorState, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbGetIndicatorState; req->deviceSpec = deviceSpec; ok = _XReply(dpy, (xReply *) &rep, 0, xFalse); if (ok && (pStateRtrn != NULL)) *pStateRtrn = rep.state; UnlockDisplay(dpy); SyncHandle(); return (ok ? Success : BadImplementation); } Status _XkbReadGetIndicatorMapReply(Display *dpy, xkbGetIndicatorMapReply *rep, XkbDescPtr xkb, int *nread_rtrn) { XkbIndicatorPtr leds; XkbReadBufferRec buf; if ((!xkb->indicators) && (XkbAllocIndicatorMaps(xkb) != Success)) return BadAlloc; leds = xkb->indicators; leds->phys_indicators = rep->realIndicators; if (rep->length > 0) { register int left; if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) return BadAlloc; if (nread_rtrn) *nread_rtrn = (int) rep->length * 4; if (rep->which) { register int i, bit; left = (int) rep->which; for (i = 0, bit = 1; (i < XkbNumIndicators) && (left); i++, bit <<= 1) { if (left & bit) { xkbIndicatorMapWireDesc *wire; wire = (xkbIndicatorMapWireDesc *) _XkbGetReadBufferPtr(&buf, SIZEOF(xkbIndicatorMapWireDesc)); if (wire == NULL) { _XkbFreeReadBuffer(&buf); return BadAlloc; } leds->maps[i].flags = wire->flags; leds->maps[i].which_groups = wire->whichGroups; leds->maps[i].groups = wire->groups; leds->maps[i].which_mods = wire->whichMods; leds->maps[i].mods.mask = wire->mods; leds->maps[i].mods.real_mods = wire->realMods; leds->maps[i].mods.vmods = wire->virtualMods; leds->maps[i].ctrls = wire->ctrls; left &= ~bit; } } } left = _XkbFreeReadBuffer(&buf); } return Success; } Bool XkbGetIndicatorMap(Display *dpy, unsigned long which, XkbDescPtr xkb) { register xkbGetIndicatorMapReq *req; xkbGetIndicatorMapReply rep; XkbInfoPtr xkbi; Status status; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; if ((!which) || (!xkb)) return BadValue; LockDisplay(dpy); xkbi = dpy->xkb_info; if (!xkb->indicators) { xkb->indicators = _XkbTypedCalloc(1, XkbIndicatorRec); if (!xkb->indicators) { UnlockDisplay(dpy); SyncHandle(); return BadAlloc; } } GetReq(kbGetIndicatorMap, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbGetIndicatorMap; req->deviceSpec = xkb->device_spec; req->which = (CARD32) which; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return BadValue; } status = _XkbReadGetIndicatorMapReply(dpy, &rep, xkb, NULL); UnlockDisplay(dpy); SyncHandle(); return status; } Bool XkbSetIndicatorMap(Display *dpy, unsigned long which, XkbDescPtr xkb) { register xkbSetIndicatorMapReq *req; register int i, bit; int nMaps; xkbIndicatorMapWireDesc *wire; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; if ((!xkb) || (!which) || (!xkb->indicators)) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbSetIndicatorMap, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbSetIndicatorMap; req->deviceSpec = xkb->device_spec; req->which = (CARD32) which; for (i = nMaps = 0, bit = 1; i < 32; i++, bit <<= 1) { if (which & bit) nMaps++; } req->length += (nMaps * sizeof(XkbIndicatorMapRec)) / 4; BufAlloc(xkbIndicatorMapWireDesc *, wire, (nMaps * SIZEOF(xkbIndicatorMapWireDesc))); for (i = 0, bit = 1; i < 32; i++, bit <<= 1) { if (which & bit) { wire->flags = xkb->indicators->maps[i].flags; wire->whichGroups = xkb->indicators->maps[i].which_groups; wire->groups = xkb->indicators->maps[i].groups; wire->whichMods = xkb->indicators->maps[i].which_mods; wire->mods = xkb->indicators->maps[i].mods.real_mods; wire->virtualMods = xkb->indicators->maps[i].mods.vmods; wire->ctrls = xkb->indicators->maps[i].ctrls; wire++; } } UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbGetNamedDeviceIndicator(Display *dpy, unsigned device, unsigned class, unsigned id, Atom name, int *pNdxRtrn, Bool *pStateRtrn, XkbIndicatorMapPtr pMapRtrn, Bool *pRealRtrn) { register xkbGetNamedIndicatorReq *req; xkbGetNamedIndicatorReply rep; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (name == None) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbGetNamedIndicator, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbGetNamedIndicator; req->deviceSpec = device; req->ledClass = class; req->ledID = id; req->indicator = (CARD32) name; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } UnlockDisplay(dpy); SyncHandle(); if ((!rep.found) || (!rep.supported)) return False; if (pNdxRtrn != NULL) *pNdxRtrn = rep.ndx; if (pStateRtrn != NULL) *pStateRtrn = rep.on; if (pMapRtrn != NULL) { pMapRtrn->flags = rep.flags; pMapRtrn->which_groups = rep.whichGroups; pMapRtrn->groups = rep.groups; pMapRtrn->which_mods = rep.whichMods; pMapRtrn->mods.mask = rep.mods; pMapRtrn->mods.real_mods = rep.realMods; pMapRtrn->mods.vmods = rep.virtualMods; pMapRtrn->ctrls = rep.ctrls; } if (pRealRtrn != NULL) *pRealRtrn = rep.realIndicator; return True; } Bool XkbGetNamedIndicator(Display *dpy, Atom name, int *pNdxRtrn, Bool *pStateRtrn, XkbIndicatorMapPtr pMapRtrn, Bool *pRealRtrn) { return XkbGetNamedDeviceIndicator(dpy, XkbUseCoreKbd, XkbDfltXIClass, XkbDfltXIId, name, pNdxRtrn, pStateRtrn, pMapRtrn, pRealRtrn); } Bool XkbSetNamedDeviceIndicator(Display *dpy, unsigned device, unsigned class, unsigned id, Atom name, Bool changeState, Bool state, Bool createNewMap, XkbIndicatorMapPtr pMap) { register xkbSetNamedIndicatorReq *req; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (name == None) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbSetNamedIndicator, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbSetNamedIndicator; req->deviceSpec = device; req->ledClass = class; req->ledID = id; req->indicator = (CARD32) name; req->setState = changeState; if (req->setState) req->on = state; else req->on = False; if (pMap != NULL) { req->setMap = True; req->createMap = createNewMap; req->flags = pMap->flags; req->whichGroups = pMap->which_groups; req->groups = pMap->groups; req->whichMods = pMap->which_mods; req->realMods = pMap->mods.real_mods; req->virtualMods = pMap->mods.vmods; req->ctrls = pMap->ctrls; } else { req->setMap = False; req->createMap = False; req->flags = 0; req->whichGroups = 0; req->groups = 0; req->whichMods = 0; req->realMods = 0; req->virtualMods = 0; req->ctrls = 0; } UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbSetNamedIndicator(Display *dpy, Atom name, Bool changeState, Bool state, Bool createNewMap, XkbIndicatorMapPtr pMap) { return XkbSetNamedDeviceIndicator(dpy, XkbUseCoreKbd, XkbDfltXIClass, XkbDfltXIId, name, changeState, state, createNewMap, pMap); } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBlibint.h0000644000000000000000000002264013614532331015427 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBLIBINT_H_ #define _XKBLIBINT_H_ #include #include #define XkbMapPending (1<<0) #define XkbXlibNewKeyboard (1<<1) typedef int (*XkbKSToMBFunc)( XPointer /* priv */, KeySym /* sym */, char * /* buf */, int /* len */, int * /* extra_rtrn */ ); typedef KeySym (*XkbMBToKSFunc)( XPointer /* priv */, char * /* buf */, int /* len */, Status * /* status */ ); typedef KeySym (*XkbToUpperFunc)( KeySym /* sym */ ); typedef struct _XkbConverters { XkbKSToMBFunc KSToMB; XPointer KSToMBPriv; XkbMBToKSFunc MBToKS; XPointer MBToKSPriv; XkbToUpperFunc KSToUpper; } XkbConverters; extern XkbInternAtomFunc _XkbInternAtomFunc; extern XkbGetAtomNameFunc _XkbGetAtomNameFunc; typedef struct _XkbInfoRec { unsigned flags; unsigned xlib_ctrls; XExtCodes *codes; int srv_major; int srv_minor; unsigned selected_events; unsigned short selected_nkn_details; unsigned short selected_map_details; XkbDescRec *desc; XkbMapChangesRec changes; Atom composeLED; XkbConverters cvt; XkbConverters latin1cvt; } XkbInfoRec, *XkbInfoPtr; #define _XkbUnavailable(d) \ (((d)->flags&XlibDisplayNoXkb) || \ ((!(d)->xkb_info || (!(d)->xkb_info->desc)) && !_XkbLoadDpy(d))) #define _XkbCheckPendingRefresh(d,xi) { \ if ((xi)->flags&XkbXlibNewKeyboard) \ _XkbReloadDpy((d)); \ else if ((xi)->flags&XkbMapPending) { \ if (XkbGetMapChanges((d),(xi)->desc, &(xi)->changes)==Success) { \ LockDisplay((d)); \ (xi)->changes.changed= 0; \ UnlockDisplay((d)); \ } \ } \ } #define _XkbNeedModmap(i) ((!(i)->desc->map)||(!(i)->desc->map->modmap)) /* * mask of the events that the "invisible" XKB support in Xlib needs */ #define XKB_XLIB_MAP_MASK (XkbAllClientInfoMask) /* * Handy helper macros */ typedef struct _XkbReadBuffer { int error; int size; char *start; char *data; } XkbReadBufferRec, *XkbReadBufferPtr; #define _XkbAlloc(s) Xmalloc((s)) #define _XkbCalloc(n,s) Xcalloc((n),(s)) #define _XkbRealloc(o,s) Xrealloc((o),(s)) #define _XkbTypedAlloc(t) ((t *)Xmalloc(sizeof(t))) #define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n),sizeof(t))) #define _XkbTypedRealloc(o,n,t) \ ((o) ? (t *)Xrealloc((o), (n)*sizeof(t)) : _XkbTypedCalloc(n,t)) #define _XkbClearElems(a,f,l,t) bzero(&(a)[f], ((l)-(f)+1) * sizeof(t)) #define _XkbFree(p) Xfree(p) _XFUNCPROTOBEGIN extern void _XkbReloadDpy( Display * /* dpy */ ); extern KeySym _XKeycodeToKeysym( Display * /* display */, #if NeedWidePrototypes unsigned int /* keycode */, #else KeyCode /* keycode */, #endif int /* index */ ); extern KeyCode _XKeysymToKeycode( Display * /* display */, KeySym /* keysym */ ); extern KeySym _XLookupKeysym( XKeyEvent * /* key_event */, int /* index */ ); extern int _XRefreshKeyboardMapping( XMappingEvent * /* event_map */ ); extern unsigned _XKeysymToModifiers( Display * /* dpy */, KeySym /* ks */ ); extern int _XTranslateKey( register Display * /* dpy */, KeyCode /* keycode */, register unsigned int /* modifiers */, unsigned int * /* modifiers_return */, KeySym * /* keysym_return */ ); extern int _XTranslateKeySym( Display * /* dpy */, register KeySym /* symbol */, unsigned int /* modifiers */, char * /* buffer */, int /* nbytes */ ); extern int _XLookupString( register XKeyEvent * /* event */, char * /* buffer */, int /* nbytes */, KeySym * /* keysym */, XComposeStatus * /* status */ ); extern void _XkbNoteCoreMapChanges( XkbMapChangesRec * /* old */, XMappingEvent * /* new */, unsigned int /* wanted */ ); extern int _XkbInitReadBuffer( Display * /* dpy */, XkbReadBufferPtr /* buf */, int /* size */ ); extern int _XkbSkipReadBufferData( XkbReadBufferPtr /* from */, int /* size */ ); extern int _XkbCopyFromReadBuffer( XkbReadBufferPtr /* from */, char * /* to */, int /* size */ ); #ifdef LONG64 extern int _XkbReadCopyData32( int * /* from */, long * /* to */, int /* num_words */ ); extern int _XkbWriteCopyData32( unsigned long * /* from */, CARD32 * /* to */, int /* num_words */ ); extern int _XkbReadBufferCopy32( XkbReadBufferPtr /* from */, long * /* to */, int /* size */ ); #else #define _XkbReadCopyData32(f,t,s) memcpy((char *)(t), (char *)(f), (s)*4) #define _XkbWriteCopyData32(f,t,s) memcpy((char *)(t), (char *)(f), (s)*4) #define _XkbReadBufferCopy32(f,t,s) _XkbCopyFromReadBuffer(f, (char *)t, (s)*4) #endif #ifndef NO_DEC_BINARY_COMPATIBILITY #define XKB_FORCE_INT_KEYSYM 1 #endif #ifdef XKB_FORCE_INT_KEYSYM extern int _XkbReadCopyKeySyms( int * /* from */, KeySym * /* to */, int /* num_words */ ); extern int _XkbWriteCopyKeySyms( KeySym * /* from */, CARD32 * /* to */, int /* num_words */ ); extern int _XkbReadBufferCopyKeySyms( XkbReadBufferPtr /* from */, #ifndef NO_DEC_BUG_FIX KeySym * /* to */, #else long * /* to */, #endif int /* size */ ); #else #define _XkbReadCopyKeySyms(f,t,n) _XkbReadCopyData32(f,t,n) #define _XkbWriteCopyKeySyms(f,t,n) _XkbWriteCopyData32(f,t,n) #define _XkbReadBufferCopyKeySyms(f,t,s) _XkbReadBufferCopy32(f,t,s) #endif extern char *_XkbPeekAtReadBuffer( XkbReadBufferPtr /* from */, int /* size */ ); extern char *_XkbGetReadBufferPtr( XkbReadBufferPtr /* from */, int /* size */ ); #define _XkbGetTypedRdBufPtr(b,n,t) ((t *)_XkbGetReadBufferPtr(b,(n)*SIZEOF(t))) extern int _XkbFreeReadBuffer( XkbReadBufferPtr /* buf */ ); extern Bool _XkbGetReadBufferCountedString( XkbReadBufferPtr /* buf */, char ** /* rtrn */ ); extern char *_XkbGetCharset( void ); extern int _XkbGetConverters( const char * /* encoding_name */, XkbConverters * /* cvt_rtrn */ ); #ifdef NEED_MAP_READERS extern Status _XkbReadGetMapReply( Display * /* dpy */, xkbGetMapReply * /* rep */, XkbDescRec * /* xkb */, int * /* nread_rtrn */ ); extern Status _XkbReadGetCompatMapReply( Display * /* dpy */, xkbGetCompatMapReply * /* rep */, XkbDescPtr /* xkb */, int * /* nread_rtrn */ ); extern Status _XkbReadGetIndicatorMapReply( Display * /* dpy */, xkbGetIndicatorMapReply * /* rep */, XkbDescPtr /* xkb */, int * /* nread_rtrn */ ); extern Status _XkbReadGetNamesReply( Display * /* dpy */, xkbGetNamesReply * /* rep */, XkbDescPtr /* xkb */, int * /* nread_rtrn */ ); extern Status _XkbReadGetGeometryReply( Display * /* dpy */, xkbGetGeometryReply * /* rep */, XkbDescPtr /* xkb */, int * /* nread_rtrn */ ); #endif _XFUNCPROTOEND #endif /* _XKBLIBINT_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBList.c0000644000000000000000000002020313614532331015045 0ustar /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #define NEED_MAP_READERS #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include "XKBlibint.h" /***====================================================================***/ static void _FreeComponentNames(int num, XkbComponentNamePtr names) { int i; XkbComponentNamePtr tmp; if ((num < 1) || (names == NULL)) return; for (i = 0, tmp = names; i < num; i++, tmp++) { if (tmp->name) { _XkbFree(tmp->name); tmp->name = NULL; } } _XkbFree(names); return; } /***====================================================================***/ static XkbComponentNamePtr _ReadListing(XkbReadBufferPtr buf, int count, Status * status_rtrn) { XkbComponentNamePtr first, this; register int i; CARD16 *flags; int slen, wlen; char *str; if (count < 1) return NULL; first = _XkbTypedCalloc(count, XkbComponentNameRec); if (!first) return NULL; for (this = first, i = 0; i < count; i++, this++) { flags = (CARD16 *) _XkbGetReadBufferPtr(buf, 2 * sizeof(CARD16)); if (!flags) goto BAILOUT; this->flags = flags[0]; slen = flags[1]; wlen = ((slen + 1) / 2) * 2; /* pad to 2 byte boundary */ this->name = _XkbTypedCalloc(slen + 1, char); if (!this->name) goto BAILOUT; str = (char *) _XkbGetReadBufferPtr(buf, wlen); if (!str) goto BAILOUT; memcpy(this->name, str, slen); } return first; BAILOUT: *status_rtrn = BadAlloc; _FreeComponentNames(i, first); return NULL; } /***====================================================================***/ XkbComponentListPtr XkbListComponents(Display *dpy, unsigned deviceSpec, XkbComponentNamesPtr ptrns, int *max_inout) { register xkbListComponentsReq *req; xkbListComponentsReply rep; XkbInfoPtr xkbi; XkbComponentListPtr list; XkbReadBufferRec buf; int left; char *str; int extraLen, len, mapLen, codesLen, typesLen, compatLen, symsLen, geomLen; if ((dpy == NULL) || (dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || (ptrns == NULL) || (max_inout == NULL)) return NULL; xkbi = dpy->xkb_info; LockDisplay(dpy); GetReq(kbListComponents, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbListComponents; req->deviceSpec = deviceSpec; req->maxNames = *max_inout; mapLen = codesLen = typesLen = compatLen = symsLen = geomLen = 0; if (ptrns->keymap) mapLen = (int) strlen(ptrns->keymap); if (ptrns->keycodes) codesLen = (int) strlen(ptrns->keycodes); if (ptrns->types) typesLen = (int) strlen(ptrns->types); if (ptrns->compat) compatLen = (int) strlen(ptrns->compat); if (ptrns->symbols) symsLen = (int) strlen(ptrns->symbols); if (ptrns->geometry) geomLen = (int) strlen(ptrns->geometry); if (mapLen > 255) mapLen = 255; if (codesLen > 255) codesLen = 255; if (typesLen > 255) typesLen = 255; if (compatLen > 255) compatLen = 255; if (symsLen > 255) symsLen = 255; if (geomLen > 255) geomLen = 255; len = mapLen + codesLen + typesLen + compatLen + symsLen + geomLen + 6; len = XkbPaddedSize(len); req->length += len / 4; BufAlloc(char *, str, len); *str++ = mapLen; if (mapLen > 0) { memcpy(str, ptrns->keymap, mapLen); str += mapLen; } *str++ = codesLen; if (codesLen > 0) { memcpy(str, ptrns->keycodes, codesLen); str += codesLen; } *str++ = typesLen; if (typesLen > 0) { memcpy(str, ptrns->types, typesLen); str += typesLen; } *str++ = compatLen; if (compatLen > 0) { memcpy(str, ptrns->compat, compatLen); str += compatLen; } *str++ = symsLen; if (symsLen > 0) { memcpy(str, ptrns->symbols, symsLen); str += symsLen; } *str++ = geomLen; if (geomLen > 0) { memcpy(str, ptrns->geometry, geomLen); str += geomLen; } if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) goto BAILOUT; extraLen = (int) rep.length * 4; *max_inout = rep.extra; if (extraLen == 0) { /* no matches, but we don't want to report a failure */ list = _XkbTypedCalloc(1, XkbComponentListRec); UnlockDisplay(dpy); SyncHandle(); return list; } if (_XkbInitReadBuffer(dpy, &buf, extraLen)) { Status status = Success; list = _XkbTypedCalloc(1, XkbComponentListRec); if (!list) { _XkbFreeReadBuffer(&buf); goto BAILOUT; } list->num_keymaps = rep.nKeymaps; list->num_keycodes = rep.nKeycodes; list->num_types = rep.nTypes; list->num_compat = rep.nCompatMaps; list->num_symbols = rep.nSymbols; list->num_geometry = rep.nGeometries; if ((status == Success) && (list->num_keymaps > 0)) list->keymaps = _ReadListing(&buf, list->num_keymaps, &status); if ((status == Success) && (list->num_keycodes > 0)) list->keycodes = _ReadListing(&buf, list->num_keycodes, &status); if ((status == Success) && (list->num_types > 0)) list->types = _ReadListing(&buf, list->num_types, &status); if ((status == Success) && (list->num_compat > 0)) list->compat = _ReadListing(&buf, list->num_compat, &status); if ((status == Success) && (list->num_symbols > 0)) list->symbols = _ReadListing(&buf, list->num_symbols, &status); if ((status == Success) && (list->num_geometry > 0)) list->geometry = _ReadListing(&buf, list->num_geometry, &status); left = _XkbFreeReadBuffer(&buf); if ((status != Success) || (buf.error) || (left > 2)) { XkbFreeComponentList(list); goto BAILOUT; } UnlockDisplay(dpy); SyncHandle(); return list; } BAILOUT: UnlockDisplay(dpy); SyncHandle(); return NULL; } void XkbFreeComponentList(XkbComponentListPtr list) { if (list) { if (list->keymaps) _FreeComponentNames(list->num_keymaps, list->keymaps); if (list->keycodes) _FreeComponentNames(list->num_keycodes, list->keycodes); if (list->types) _FreeComponentNames(list->num_types, list->types); if (list->compat) _FreeComponentNames(list->num_compat, list->compat); if (list->symbols) _FreeComponentNames(list->num_symbols, list->symbols); if (list->geometry) _FreeComponentNames(list->num_geometry, list->geometry); bzero((char *) list, sizeof(XkbComponentListRec)); _XkbFree(list); } return; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBMAlloc.c0000644000000000000000000010571013614532331015310 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include #include #include "XKBlibint.h" /***====================================================================***/ Status XkbAllocClientMap(XkbDescPtr xkb, unsigned which, unsigned nTotalTypes) { register int i; XkbClientMapPtr map; if ((xkb == NULL) || ((nTotalTypes > 0) && (nTotalTypes < XkbNumRequiredTypes))) return BadValue; if ((which & XkbKeySymsMask) && ((!XkbIsLegalKeycode(xkb->min_key_code)) || (!XkbIsLegalKeycode(xkb->max_key_code)) || (xkb->max_key_code < xkb->min_key_code))) { #ifdef DEBUG fprintf(stderr, "bad keycode (%d,%d) in XkbAllocClientMap\n", xkb->min_key_code, xkb->max_key_code); #endif return BadValue; } if (xkb->map == NULL) { map = _XkbTypedCalloc(1, XkbClientMapRec); if (map == NULL) return BadAlloc; xkb->map = map; } else map = xkb->map; if ((which & XkbKeyTypesMask) && (nTotalTypes > 0)) { if (map->types == NULL) { map->types = _XkbTypedCalloc(nTotalTypes, XkbKeyTypeRec); if (map->types == NULL) return BadAlloc; map->num_types = 0; map->size_types = nTotalTypes; } else if (map->size_types < nTotalTypes) { XkbKeyTypeRec *prev_types = map->types; map->types = _XkbTypedRealloc(map->types, nTotalTypes, XkbKeyTypeRec); if (map->types == NULL) { _XkbFree(prev_types); map->num_types = map->size_types = 0; return BadAlloc; } map->size_types = nTotalTypes; bzero(&map->types[map->num_types], ((map->size_types - map->num_types) * sizeof(XkbKeyTypeRec))); } } if (which & XkbKeySymsMask) { int nKeys = XkbNumKeys(xkb); if (map->syms == NULL) { map->size_syms = (nKeys * 15) / 10; map->syms = _XkbTypedCalloc(map->size_syms, KeySym); if (!map->syms) { map->size_syms = 0; return BadAlloc; } map->num_syms = 1; map->syms[0] = NoSymbol; } if (map->key_sym_map == NULL) { i = xkb->max_key_code + 1; map->key_sym_map = _XkbTypedCalloc(i, XkbSymMapRec); if (map->key_sym_map == NULL) return BadAlloc; } } if (which & XkbModifierMapMask) { if ((!XkbIsLegalKeycode(xkb->min_key_code)) || (!XkbIsLegalKeycode(xkb->max_key_code)) || (xkb->max_key_code < xkb->min_key_code)) return BadMatch; if (map->modmap == NULL) { i = xkb->max_key_code + 1; map->modmap = _XkbTypedCalloc(i, unsigned char); if (map->modmap == NULL) return BadAlloc; } } return Success; } Status XkbAllocServerMap(XkbDescPtr xkb, unsigned which, unsigned nNewActions) { register int i; XkbServerMapPtr map; if (xkb == NULL) return BadMatch; if (xkb->server == NULL) { map = _XkbTypedCalloc(1, XkbServerMapRec); if (map == NULL) return BadAlloc; for (i = 0; i < XkbNumVirtualMods; i++) { map->vmods[i] = XkbNoModifierMask; } xkb->server = map; } else map = xkb->server; if (which & XkbExplicitComponentsMask) { if ((!XkbIsLegalKeycode(xkb->min_key_code)) || (!XkbIsLegalKeycode(xkb->max_key_code)) || (xkb->max_key_code < xkb->min_key_code)) return BadMatch; if (map->explicit == NULL) { i = xkb->max_key_code + 1; map->explicit = _XkbTypedCalloc(i, unsigned char); if (map->explicit == NULL) return BadAlloc; } } if (which & XkbKeyActionsMask) { if ((!XkbIsLegalKeycode(xkb->min_key_code)) || (!XkbIsLegalKeycode(xkb->max_key_code)) || (xkb->max_key_code < xkb->min_key_code)) return BadMatch; if (nNewActions < 1) nNewActions = 1; if (map->acts == NULL) { map->acts = _XkbTypedCalloc((nNewActions + 1), XkbAction); if (map->acts == NULL) return BadAlloc; map->num_acts = 1; map->size_acts = nNewActions + 1; } else if ((map->size_acts - map->num_acts) < nNewActions) { unsigned need; XkbAction *prev_acts = map->acts; need = map->num_acts + nNewActions; map->acts = _XkbTypedRealloc(map->acts, need, XkbAction); if (map->acts == NULL) { _XkbFree(prev_acts); map->num_acts = map->size_acts = 0; return BadAlloc; } map->size_acts = need; bzero(&map->acts[map->num_acts], ((map->size_acts - map->num_acts) * sizeof(XkbAction))); } if (map->key_acts == NULL) { i = xkb->max_key_code + 1; map->key_acts = _XkbTypedCalloc(i, unsigned short); if (map->key_acts == NULL) return BadAlloc; } } if (which & XkbKeyBehaviorsMask) { if ((!XkbIsLegalKeycode(xkb->min_key_code)) || (!XkbIsLegalKeycode(xkb->max_key_code)) || (xkb->max_key_code < xkb->min_key_code)) return BadMatch; if (map->behaviors == NULL) { i = xkb->max_key_code + 1; map->behaviors = _XkbTypedCalloc(i, XkbBehavior); if (map->behaviors == NULL) return BadAlloc; } } if (which & XkbVirtualModMapMask) { if ((!XkbIsLegalKeycode(xkb->min_key_code)) || (!XkbIsLegalKeycode(xkb->max_key_code)) || (xkb->max_key_code < xkb->min_key_code)) return BadMatch; if (map->vmodmap == NULL) { i = xkb->max_key_code + 1; map->vmodmap = _XkbTypedCalloc(i, unsigned short); if (map->vmodmap == NULL) return BadAlloc; } } return Success; } /***====================================================================***/ Status XkbCopyKeyType(XkbKeyTypePtr from, XkbKeyTypePtr into) { if ((!from) || (!into)) return BadMatch; _XkbFree(into->map); into->map = NULL; _XkbFree(into->preserve); into->preserve = NULL; _XkbFree(into->level_names); into->level_names = NULL; *into = *from; if ((from->map) && (into->map_count > 0)) { into->map = _XkbTypedCalloc(into->map_count, XkbKTMapEntryRec); if (!into->map) return BadAlloc; memcpy(into->map, from->map, into->map_count * sizeof(XkbKTMapEntryRec)); } if ((from->preserve) && (into->map_count > 0)) { into->preserve = _XkbTypedCalloc(into->map_count, XkbModsRec); if (!into->preserve) return BadAlloc; memcpy(into->preserve, from->preserve, into->map_count * sizeof(XkbModsRec)); } if ((from->level_names) && (into->num_levels > 0)) { into->level_names = _XkbTypedCalloc(into->num_levels, Atom); if (!into->level_names) return BadAlloc; memcpy(into->level_names, from->level_names, into->num_levels * sizeof(Atom)); } return Success; } Status XkbCopyKeyTypes(XkbKeyTypePtr from, XkbKeyTypePtr into, int num_types) { register int i, rtrn; if ((!from) || (!into) || (num_types < 0)) return BadMatch; for (i = 0; i < num_types; i++) { if ((rtrn = XkbCopyKeyType(from++, into++)) != Success) return rtrn; } return Success; } XkbKeyTypePtr XkbAddKeyType(XkbDescPtr xkb, Atom name, int map_count, Bool want_preserve, int num_lvls) { register int i; unsigned tmp; XkbKeyTypePtr type; XkbClientMapPtr map; if ((!xkb) || (num_lvls < 1)) return NULL; map = xkb->map; if ((map) && (map->types)) { for (i = 0; i < map->num_types; i++) { if (map->types[i].name == name) { Status status = XkbResizeKeyType(xkb, i, map_count, want_preserve, num_lvls); return (status == Success ? &map->types[i] : NULL); } } } if ((!map) || (!map->types) || (map->num_types < XkbNumRequiredTypes)) { tmp = XkbNumRequiredTypes + 1; if (XkbAllocClientMap(xkb, XkbKeyTypesMask, tmp) != Success) return NULL; if (!map) map = xkb->map; tmp = 0; if (map->num_types <= XkbKeypadIndex) tmp |= XkbKeypadMask; if (map->num_types <= XkbAlphabeticIndex) tmp |= XkbAlphabeticMask; if (map->num_types <= XkbTwoLevelIndex) tmp |= XkbTwoLevelMask; if (map->num_types <= XkbOneLevelIndex) tmp |= XkbOneLevelMask; if (XkbInitCanonicalKeyTypes(xkb, tmp, XkbNoModifier) == Success) { for (i = 0; i < map->num_types; i++) { Status status; if (map->types[i].name != name) continue; status = XkbResizeKeyType(xkb, i, map_count, want_preserve, num_lvls); return (status == Success ? &map->types[i] : NULL); } } } if ((map->num_types <= map->size_types) && (XkbAllocClientMap(xkb, XkbKeyTypesMask, map->num_types + 1) != Success)) { return NULL; } type = &map->types[map->num_types]; map->num_types++; bzero((char *) type, sizeof(XkbKeyTypeRec)); type->num_levels = num_lvls; type->map_count = map_count; type->name = name; if (map_count > 0) { type->map = _XkbTypedCalloc(map_count, XkbKTMapEntryRec); if (!type->map) { map->num_types--; return NULL; } if (want_preserve) { type->preserve = _XkbTypedCalloc(map_count, XkbModsRec); if (!type->preserve) { _XkbFree(type->map); map->num_types--; return NULL; } } } return type; } Status XkbResizeKeyType(XkbDescPtr xkb, int type_ndx, int map_count, Bool want_preserve, int new_num_lvls) { XkbKeyTypePtr type; KeyCode matchingKeys[XkbMaxKeyCount], nMatchingKeys; if ((type_ndx < 0) || (type_ndx >= xkb->map->num_types) || (map_count < 0) || (new_num_lvls < 1)) return BadValue; switch (type_ndx) { case XkbOneLevelIndex: if (new_num_lvls != 1) return BadMatch; break; case XkbTwoLevelIndex: case XkbAlphabeticIndex: case XkbKeypadIndex: if (new_num_lvls != 2) return BadMatch; break; } type = &xkb->map->types[type_ndx]; if (map_count == 0) { _XkbFree(type->map); type->map = NULL; _XkbFree(type->preserve); type->preserve = NULL; type->map_count = 0; } else { XkbKTMapEntryRec *prev_map = type->map; if ((map_count > type->map_count) || (type->map == NULL)) type->map = _XkbTypedRealloc(type->map, map_count, XkbKTMapEntryRec); if (!type->map) { _XkbFree(prev_map); return BadAlloc; } if (want_preserve) { XkbModsRec *prev_preserve = type->preserve; if ((map_count > type->map_count) || (type->preserve == NULL)) { type->preserve = _XkbTypedRealloc(type->preserve, map_count, XkbModsRec); } if (!type->preserve) { _XkbFree(prev_preserve); return BadAlloc; } } else { _XkbFree(type->preserve); type->preserve = NULL; } type->map_count = map_count; } if ((new_num_lvls > type->num_levels) || (type->level_names == NULL)) { Atom *prev_level_names = type->level_names; type->level_names = _XkbTypedRealloc(type->level_names, new_num_lvls, Atom); if (!type->level_names) { _XkbFree(prev_level_names); return BadAlloc; } } /* * Here's the theory: * If the width of the type changed, we might have to resize the symbol * maps for any keys that use the type for one or more groups. This is * expensive, so we'll try to cull out any keys that are obviously okay: * In any case: * - keys that have a group width <= the old width are okay (because * they could not possibly have been associated with the old type) * If the key type increased in size: * - keys that already have a group width >= to the new width are okay * + keys that have a group width >= the old width but < the new width * might have to be enlarged. * If the key type decreased in size: * - keys that have a group width > the old width don't have to be * resized (because they must have some other wider type associated * with some group). * + keys that have a group width == the old width might have to be * shrunk. * The possibilities marked with '+' require us to examine the key types * associated with each group for the key. */ bzero(matchingKeys, XkbMaxKeyCount * sizeof(KeyCode)); nMatchingKeys = 0; if (new_num_lvls > type->num_levels) { int nTotal; KeySym *newSyms; int width, match, nResize; register int i, g, nSyms; nResize = 0; for (nTotal = 1, i = xkb->min_key_code; i <= xkb->max_key_code; i++) { width = XkbKeyGroupsWidth(xkb, i); if (width < type->num_levels) continue; for (match = 0, g = XkbKeyNumGroups(xkb, i) - 1; (g >= 0) && (!match); g--) { if (XkbKeyKeyTypeIndex(xkb, i, g) == type_ndx) { matchingKeys[nMatchingKeys++] = i; match = 1; } } if ((!match) || (width >= new_num_lvls)) nTotal += XkbKeyNumSyms(xkb, i); else { nTotal += XkbKeyNumGroups(xkb, i) * new_num_lvls; nResize++; } } if (nResize > 0) { int nextMatch; xkb->map->size_syms = (nTotal * 12) / 10; newSyms = _XkbTypedCalloc(xkb->map->size_syms, KeySym); if (newSyms == NULL) return BadAlloc; nextMatch = 0; nSyms = 1; for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) { if (matchingKeys[nextMatch] == i) { KeySym *pOld; nextMatch++; width = XkbKeyGroupsWidth(xkb, i); pOld = XkbKeySymsPtr(xkb, i); for (g = XkbKeyNumGroups(xkb, i) - 1; g >= 0; g--) { memcpy(&newSyms[nSyms + (new_num_lvls * g)], &pOld[width * g], width * sizeof(KeySym)); } xkb->map->key_sym_map[i].offset = nSyms; nSyms += XkbKeyNumGroups(xkb, i) * new_num_lvls; } else { memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i), XkbKeyNumSyms(xkb, i) * sizeof(KeySym)); xkb->map->key_sym_map[i].offset = nSyms; nSyms += XkbKeyNumSyms(xkb, i); } } type->num_levels = new_num_lvls; _XkbFree(xkb->map->syms); xkb->map->syms = newSyms; xkb->map->num_syms = nSyms; return Success; } } else if (new_num_lvls < type->num_levels) { int width, match; register int g, i; for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) { width = XkbKeyGroupsWidth(xkb, i); if (width < type->num_levels) continue; for (match = 0, g = XkbKeyNumGroups(xkb, i) - 1; (g >= 0) && (!match); g--) { if (XkbKeyKeyTypeIndex(xkb, i, g) == type_ndx) { matchingKeys[nMatchingKeys++] = i; match = 1; } } } } if (nMatchingKeys > 0) { int key, firstClear; register int i, g; if (new_num_lvls > type->num_levels) firstClear = type->num_levels; else firstClear = new_num_lvls; for (i = 0; i < nMatchingKeys; i++) { KeySym *pSyms; int width, nClear; key = matchingKeys[i]; width = XkbKeyGroupsWidth(xkb, key); nClear = width - firstClear; pSyms = XkbKeySymsPtr(xkb, key); for (g = XkbKeyNumGroups(xkb, key) - 1; g >= 0; g--) { if (XkbKeyKeyTypeIndex(xkb, key, g) == type_ndx) { if (nClear > 0) bzero(&pSyms[g * width + firstClear], nClear * sizeof(KeySym)); } } } } type->num_levels = new_num_lvls; return Success; } KeySym * XkbResizeKeySyms(XkbDescPtr xkb, int key, int needed) { register int i, nSyms, nKeySyms; unsigned nOldSyms; KeySym *newSyms; if (needed == 0) { xkb->map->key_sym_map[key].offset = 0; return xkb->map->syms; } nOldSyms = XkbKeyNumSyms(xkb, key); if (nOldSyms >= (unsigned) needed) { return XkbKeySymsPtr(xkb, key); } if (xkb->map->size_syms - xkb->map->num_syms >= (unsigned) needed) { if (nOldSyms > 0) { memcpy(&xkb->map->syms[xkb->map->num_syms], XkbKeySymsPtr(xkb, key), nOldSyms * sizeof(KeySym)); } if ((needed - nOldSyms) > 0) { bzero(&xkb->map->syms[xkb->map->num_syms + XkbKeyNumSyms(xkb, key)], (needed - nOldSyms) * sizeof(KeySym)); } xkb->map->key_sym_map[key].offset = xkb->map->num_syms; xkb->map->num_syms += needed; return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; } xkb->map->size_syms += (needed > 32 ? needed : 32); newSyms = _XkbTypedCalloc(xkb->map->size_syms, KeySym); if (newSyms == NULL) return NULL; newSyms[0] = NoSymbol; nSyms = 1; for (i = xkb->min_key_code; i <= (int) xkb->max_key_code; i++) { int nCopy; nCopy = nKeySyms = XkbKeyNumSyms(xkb, i); if ((nKeySyms == 0) && (i != key)) continue; if (i == key) nKeySyms = needed; if (nCopy != 0) memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i), nCopy * sizeof(KeySym)); if (nKeySyms > nCopy) bzero(&newSyms[nSyms + nCopy], (nKeySyms - nCopy) * sizeof(KeySym)); xkb->map->key_sym_map[i].offset = nSyms; nSyms += nKeySyms; } _XkbFree(xkb->map->syms); xkb->map->syms = newSyms; xkb->map->num_syms = nSyms; return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; } static unsigned _ExtendRange(unsigned int old_flags, unsigned int flag, KeyCode newKC, KeyCode *old_min, unsigned char *old_num) { if ((old_flags & flag) == 0) { old_flags |= flag; *old_min = newKC; *old_num = 1; } else { int last = (*old_min) + (*old_num) - 1; if (newKC < *old_min) { *old_min = newKC; *old_num = (last - newKC) + 1; } else if (newKC > last) { *old_num = (newKC - (*old_min)) + 1; } } return old_flags; } Status XkbChangeKeycodeRange(XkbDescPtr xkb, int minKC, int maxKC, XkbChangesPtr changes) { int tmp; if ((!xkb) || (minKC < XkbMinLegalKeyCode) || (maxKC > XkbMaxLegalKeyCode)) return BadValue; if (minKC > maxKC) return BadMatch; if (minKC < xkb->min_key_code) { if (changes) changes->map.min_key_code = minKC; tmp = xkb->min_key_code - minKC; if (xkb->map) { if (xkb->map->key_sym_map) { bzero((char *) &xkb->map->key_sym_map[minKC], tmp * sizeof(XkbSymMapRec)); if (changes) { changes->map.changed = _ExtendRange(changes->map.changed, XkbKeySymsMask, minKC, &changes->map.first_key_sym, &changes->map.num_key_syms); } } if (xkb->map->modmap) { bzero((char *) &xkb->map->modmap[minKC], tmp); if (changes) { changes->map.changed = _ExtendRange(changes->map.changed, XkbModifierMapMask, minKC, &changes->map.first_modmap_key, &changes->map.num_modmap_keys); } } } if (xkb->server) { if (xkb->server->behaviors) { bzero((char *) &xkb->server->behaviors[minKC], tmp * sizeof(XkbBehavior)); if (changes) { changes->map.changed = _ExtendRange(changes->map.changed, XkbKeyBehaviorsMask, minKC, &changes->map.first_key_behavior, &changes->map.num_key_behaviors); } } if (xkb->server->key_acts) { bzero((char *) &xkb->server->key_acts[minKC], tmp * sizeof(unsigned short)); if (changes) { changes->map.changed = _ExtendRange(changes->map.changed, XkbKeyActionsMask, minKC, &changes->map.first_key_act, &changes->map.num_key_acts); } } if (xkb->server->vmodmap) { bzero((char *) &xkb->server->vmodmap[minKC], tmp * sizeof(unsigned short)); if (changes) { changes->map.changed = _ExtendRange(changes->map.changed, XkbVirtualModMapMask, minKC, &changes->map.first_modmap_key, &changes->map.num_vmodmap_keys); } } } if ((xkb->names) && (xkb->names->keys)) { bzero((char *) &xkb->names->keys[minKC], tmp * sizeof(XkbKeyNameRec)); if (changes) { changes->names.changed = _ExtendRange(changes->names.changed, XkbKeyNamesMask, minKC, &changes->names.first_key, &changes->names.num_keys); } } xkb->min_key_code = minKC; } if (maxKC > xkb->max_key_code) { if (changes) changes->map.max_key_code = maxKC; tmp = maxKC - xkb->max_key_code; if (xkb->map) { if (xkb->map->key_sym_map) { XkbSymMapRec *prev_key_sym_map = xkb->map->key_sym_map; xkb->map->key_sym_map = _XkbTypedRealloc(xkb->map->key_sym_map, (maxKC + 1), XkbSymMapRec); if (!xkb->map->key_sym_map) { _XkbFree(prev_key_sym_map); return BadAlloc; } #ifdef NXAGENT_SERVER bzero((char *) &xkb->map->key_sym_map[xkb->max_key_code + 1], tmp * sizeof(XkbSymMapRec)); #else bzero((char *) &xkb->map->key_sym_map[xkb->max_key_code], tmp * sizeof(XkbSymMapRec)); #endif if (changes) { changes->map.changed = _ExtendRange(changes->map.changed, XkbKeySymsMask, maxKC, &changes->map.first_key_sym, &changes->map.num_key_syms); } } if (xkb->map->modmap) { unsigned char *prev_modmap = xkb->map->modmap; xkb->map->modmap = _XkbTypedRealloc(xkb->map->modmap, (maxKC + 1), unsigned char); if (!xkb->map->modmap) { _XkbFree(prev_modmap); return BadAlloc; } #ifdef NXAGENT_SERVER bzero((char *) &xkb->map->modmap[xkb->max_key_code + 1], tmp); #else bzero((char *) &xkb->map->modmap[xkb->max_key_code], tmp); #endif if (changes) { changes->map.changed = _ExtendRange(changes->map.changed, XkbModifierMapMask, maxKC, &changes->map.first_modmap_key, &changes->map.num_modmap_keys); } } } if (xkb->server) { if (xkb->server->behaviors) { XkbBehavior *prev_behaviors = xkb->server->behaviors; xkb->server->behaviors = _XkbTypedRealloc(xkb->server->behaviors, (maxKC + 1), XkbBehavior); if (!xkb->server->behaviors) { _XkbFree(prev_behaviors); return BadAlloc; } #ifdef NXAGENT_SERVER bzero((char *) &xkb->server->behaviors[xkb->max_key_code + 1], tmp * sizeof(XkbBehavior)); #else bzero((char *) &xkb->server->behaviors[xkb->max_key_code], tmp * sizeof(XkbBehavior)); #endif if (changes) { changes->map.changed = _ExtendRange(changes->map.changed, XkbKeyBehaviorsMask, maxKC, &changes->map.first_key_behavior, &changes->map.num_key_behaviors); } } if (xkb->server->key_acts) { unsigned short *prev_key_acts = xkb->server->key_acts; xkb->server->key_acts = _XkbTypedRealloc(xkb->server->key_acts, (maxKC + 1), unsigned short); if (!xkb->server->key_acts) { _XkbFree(prev_key_acts); return BadAlloc; } #ifdef NXAGENT_SERVER bzero((char *) &xkb->server->key_acts[xkb->max_key_code + 1], tmp * sizeof(unsigned short)); #else bzero((char *) &xkb->server->key_acts[xkb->max_key_code], tmp * sizeof(unsigned short)); #endif if (changes) { changes->map.changed = _ExtendRange(changes->map.changed, XkbKeyActionsMask, maxKC, &changes->map.first_key_act, &changes->map.num_key_acts); } } if (xkb->server->vmodmap) { unsigned short *prev_vmodmap = xkb->server->vmodmap; xkb->server->vmodmap = _XkbTypedRealloc(xkb->server->vmodmap, (maxKC + 1), unsigned short); if (!xkb->server->vmodmap) { _XkbFree(prev_vmodmap); return BadAlloc; } #ifdef NXAGENT_SERVER bzero((char *) &xkb->server->vmodmap[xkb->max_key_code + 1], tmp * sizeof(unsigned short)); #else bzero((char *) &xkb->server->vmodmap[xkb->max_key_code], tmp * sizeof(unsigned short)); #endif if (changes) { changes->map.changed = _ExtendRange(changes->map.changed, XkbVirtualModMapMask, maxKC, &changes->map.first_modmap_key, &changes->map.num_vmodmap_keys); } } } if ((xkb->names) && (xkb->names->keys)) { XkbKeyNameRec *prev_keys = xkb->names->keys; xkb->names->keys = _XkbTypedRealloc(xkb->names->keys, (maxKC + 1), XkbKeyNameRec); if (!xkb->names->keys) { _XkbFree(prev_keys); return BadAlloc; } #ifdef NXAGENT_SERVER bzero((char *) &xkb->names->keys[xkb->max_key_code + 1], tmp * sizeof(XkbKeyNameRec)); #else bzero((char *) &xkb->names->keys[xkb->max_key_code], tmp * sizeof(XkbKeyNameRec)); #endif if (changes) { changes->names.changed = _ExtendRange(changes->names.changed, XkbKeyNamesMask, maxKC, &changes->names.first_key, &changes->names.num_keys); } } xkb->max_key_code = maxKC; } return Success; } XkbAction * XkbResizeKeyActions(XkbDescPtr xkb, int key, int needed) { register int i, nActs; XkbAction *newActs; if (needed == 0) { xkb->server->key_acts[key] = 0; return NULL; } if (XkbKeyHasActions(xkb, key) && (XkbKeyNumSyms(xkb, key) >= (unsigned) needed)) return XkbKeyActionsPtr(xkb, key); if (xkb->server->size_acts - xkb->server->num_acts >= (unsigned) needed) { xkb->server->key_acts[key] = xkb->server->num_acts; xkb->server->num_acts += needed; return &xkb->server->acts[xkb->server->key_acts[key]]; } xkb->server->size_acts = xkb->server->num_acts + needed + 8; newActs = _XkbTypedCalloc(xkb->server->size_acts, XkbAction); if (newActs == NULL) return NULL; newActs[0].type = XkbSA_NoAction; nActs = 1; for (i = xkb->min_key_code; i <= (int) xkb->max_key_code; i++) { int nKeyActs, nCopy; if ((xkb->server->key_acts[i] == 0) && (i != key)) continue; nCopy = nKeyActs = XkbKeyNumActions(xkb, i); if (i == key) { nKeyActs = needed; if (needed < nCopy) nCopy = needed; } if (nCopy > 0) memcpy(&newActs[nActs], XkbKeyActionsPtr(xkb, i), nCopy * sizeof(XkbAction)); if (nCopy < nKeyActs) bzero(&newActs[nActs + nCopy], (nKeyActs - nCopy) * sizeof(XkbAction)); xkb->server->key_acts[i] = nActs; nActs += nKeyActs; } _XkbFree(xkb->server->acts); xkb->server->acts = newActs; xkb->server->num_acts = nActs; return &xkb->server->acts[xkb->server->key_acts[key]]; } void XkbFreeClientMap(XkbDescPtr xkb, unsigned what, Bool freeMap) { XkbClientMapPtr map; if ((xkb == NULL) || (xkb->map == NULL)) return; if (freeMap) what = XkbAllClientInfoMask; map = xkb->map; if (what & XkbKeyTypesMask) { if (map->types != NULL) { if (map->num_types > 0) { register int i; XkbKeyTypePtr type; for (i = 0, type = map->types; i < map->num_types; i++, type++) { _XkbFree(type->map); type->map = NULL; _XkbFree(type->preserve); type->preserve = NULL; type->map_count = 0; _XkbFree(type->level_names); type->level_names = NULL; } } _XkbFree(map->types); map->num_types = map->size_types = 0; map->types = NULL; } } if (what & XkbKeySymsMask) { _XkbFree(map->key_sym_map); map->key_sym_map = NULL; _XkbFree(map->syms); map->size_syms = map->num_syms = 0; map->syms = NULL; } if (what & XkbModifierMapMask) { _XkbFree(map->modmap); map->modmap = NULL; } if (freeMap) { _XkbFree(xkb->map); xkb->map = NULL; } return; } void XkbFreeServerMap(XkbDescPtr xkb, unsigned what, Bool freeMap) { XkbServerMapPtr map; if ((xkb == NULL) || (xkb->server == NULL)) return; if (freeMap) what = XkbAllServerInfoMask; map = xkb->server; if (what & XkbExplicitComponentsMask) { _XkbFree(map->explicit); map->explicit = NULL; } if (what & XkbKeyActionsMask) { _XkbFree(map->key_acts); map->key_acts = NULL; _XkbFree(map->acts); map->num_acts = map->size_acts = 0; map->acts = NULL; } if (what & XkbKeyBehaviorsMask) { _XkbFree(map->behaviors); map->behaviors = NULL; } if (what & XkbVirtualModMapMask) { _XkbFree(map->vmodmap); map->vmodmap = NULL; } if (freeMap) { _XkbFree(xkb->server); xkb->server = NULL; } return; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBMisc.c0000644000000000000000000010574613614532331015045 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include #include #include "XKBlibint.h" /***====================================================================***/ #define mapSize(m) (sizeof(m)/sizeof(XkbKTMapEntryRec)) static XkbKTMapEntryRec map2Level[] = { { True, ShiftMask, {1, ShiftMask, 0} } }; static XkbKTMapEntryRec mapAlpha[] = { { True, ShiftMask, {1, ShiftMask, 0} }, { True, LockMask, {0, LockMask, 0} } }; static XkbModsRec preAlpha[] = { { 0, 0, 0 }, { LockMask, LockMask, 0 } }; #define NL_VMOD_MASK 0 static XkbKTMapEntryRec mapKeypad[] = { { True, ShiftMask, { 1, ShiftMask, 0 } }, { False, 0, { 1, 0, NL_VMOD_MASK } } }; static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = { { { 0, 0, 0 }, 1, /* num_levels */ 0, /* map_count */ NULL, NULL, None, NULL }, { { ShiftMask, ShiftMask, 0 }, 2, /* num_levels */ mapSize(map2Level), /* map_count */ map2Level, NULL, None, NULL }, { { ShiftMask|LockMask, ShiftMask|LockMask, 0 }, 2, /* num_levels */ mapSize(mapAlpha), /* map_count */ mapAlpha, preAlpha, None, NULL }, { { ShiftMask, ShiftMask, NL_VMOD_MASK }, 2, /* num_levels */ mapSize(mapKeypad), /* map_count */ mapKeypad, NULL, None, NULL } }; Status XkbInitCanonicalKeyTypes(XkbDescPtr xkb, unsigned which, int keypadVMod) { XkbClientMapPtr map; XkbKeyTypePtr from, to; Status rtrn; if (!xkb) return BadMatch; rtrn = XkbAllocClientMap(xkb, XkbKeyTypesMask, XkbNumRequiredTypes); if (rtrn != Success) return rtrn; map = xkb->map; if ((which & XkbAllRequiredTypes) == 0) return Success; rtrn = Success; from = canonicalTypes; to = map->types; if (which & XkbOneLevelMask) rtrn = XkbCopyKeyType(&from[XkbOneLevelIndex], &to[XkbOneLevelIndex]); if ((which & XkbTwoLevelMask) && (rtrn == Success)) rtrn = XkbCopyKeyType(&from[XkbTwoLevelIndex], &to[XkbTwoLevelIndex]); if ((which & XkbAlphabeticMask) && (rtrn == Success)) rtrn = XkbCopyKeyType(&from[XkbAlphabeticIndex], &to[XkbAlphabeticIndex]); if ((which & XkbKeypadMask) && (rtrn == Success)) { XkbKeyTypePtr type; rtrn = XkbCopyKeyType(&from[XkbKeypadIndex], &to[XkbKeypadIndex]); type = &to[XkbKeypadIndex]; if ((keypadVMod >= 0) && (keypadVMod < XkbNumVirtualMods) && (rtrn == Success)) { type->mods.vmods = (1 << keypadVMod); type->map[0].active = True; type->map[0].mods.mask = ShiftMask; type->map[0].mods.real_mods = ShiftMask; type->map[0].mods.vmods = 0; type->map[0].level = 1; type->map[1].active = False; type->map[1].mods.mask = 0; type->map[1].mods.real_mods = 0; type->map[1].mods.vmods = (1 << keypadVMod); type->map[1].level = 1; } } return Success; } /***====================================================================***/ #define CORE_SYM(i) (imap->num_types)) { nSyms[i] = xkb->map->types[types_inout[i]].num_levels; if (nSyms[i] > groupsWidth) groupsWidth = nSyms[i]; } else { types_inout[i] = XkbTwoLevelIndex; /* don't really know, yet */ nSyms[i] = 2; } } if (nSyms[XkbGroup1Index] < 2) nSyms[XkbGroup1Index] = 2; if (nSyms[XkbGroup2Index] < 2) nSyms[XkbGroup2Index] = 2; /* Step 2: Copy the symbols from the core ordering to XKB ordering */ /* symbols in the core are in the order: */ /* G1L1 G1L2 G2L1 G2L2 [G1L[3-n]] [G2L[3-n]] [G3L*] [G3L*] */ xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index, 0)] = CORE_SYM(0); xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index, 1)] = CORE_SYM(1); for (i = 2; i < nSyms[XkbGroup1Index]; i++) { xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index, i)] = CORE_SYM(2 + i); } xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index, 0)] = CORE_SYM(2); xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index, 1)] = CORE_SYM(3); tmp = 2 + (nSyms[XkbGroup1Index] - 2); /* offset to extra group2 syms */ for (i = 2; i < nSyms[XkbGroup2Index]; i++) { xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index, i)] = CORE_SYM(tmp + i); } tmp = nSyms[XkbGroup1Index] + nSyms[XkbGroup2Index]; if ((tmp >= map_width) && ((protected & (XkbExplicitKeyType3Mask | XkbExplicitKeyType4Mask)) == 0)) { nSyms[XkbGroup3Index] = 0; nSyms[XkbGroup4Index] = 0; nGroups = 2; } else { nGroups = 3; for (i = 0; i < nSyms[XkbGroup3Index]; i++, tmp++) { xkb_syms_rtrn[XKB_OFFSET(XkbGroup3Index, i)] = CORE_SYM(tmp); } if ((tmp < map_width) || (protected & XkbExplicitKeyType4Mask)) { nGroups = 4; for (i = 0; i < nSyms[XkbGroup4Index]; i++, tmp++) { xkb_syms_rtrn[XKB_OFFSET(XkbGroup4Index, i)] = CORE_SYM(tmp); } } else { nSyms[XkbGroup4Index] = 0; } } /* steps 3&4: alphanumeric expansion, assign canonical types */ empty = 0; for (i = 0; i < nGroups; i++) { KeySym *syms; syms = &xkb_syms_rtrn[XKB_OFFSET(i, 0)]; if ((nSyms[i] > 1) && (syms[1] == NoSymbol) && (syms[0] != NoSymbol)) { KeySym upper, lower; XConvertCase(syms[0], &lower, &upper); if (upper != lower) { xkb_syms_rtrn[XKB_OFFSET(i, 0)] = lower; xkb_syms_rtrn[XKB_OFFSET(i, 1)] = upper; if ((protected & (1 << i)) == 0) types_inout[i] = XkbAlphabeticIndex; } else if ((protected & (1 << i)) == 0) { types_inout[i] = XkbOneLevelIndex; /* nSyms[i]= 1; */ } } if (((protected & (1 << i)) == 0) && (types_inout[i] == XkbTwoLevelIndex)) { if (IsKeypadKey(syms[0]) || IsKeypadKey(syms[1])) types_inout[i] = XkbKeypadIndex; else { KeySym upper, lower; XConvertCase(syms[0], &lower, &upper); if ((syms[0] == lower) && (syms[1] == upper)) types_inout[i] = XkbAlphabeticIndex; } } if (syms[0] == NoSymbol) { register int n; Bool found; for (n = 1, found = False; (!found) && (n < nSyms[i]); n++) { found = (syms[n] != NoSymbol); } if (!found) empty |= (1 << i); } } /* step 5: squoosh out empty groups */ if (empty) { for (i = nGroups - 1; i >= 0; i--) { if (((empty & (1 << i)) == 0) || (protected & (1 << i))) break; nGroups--; } } if (nGroups < 1) return 0; /* step 6: replicate group 1 into group two, if necessary */ if ((nGroups > 1) && ((empty & (XkbGroup1Mask | XkbGroup2Mask)) == XkbGroup2Mask)) { if ((protected & (XkbExplicitKeyType1Mask | XkbExplicitKeyType2Mask)) == 0) { nSyms[XkbGroup2Index] = nSyms[XkbGroup1Index]; types_inout[XkbGroup2Index] = types_inout[XkbGroup1Index]; memcpy((char *) &xkb_syms_rtrn[2], (char *) xkb_syms_rtrn, 2 * sizeof(KeySym)); } else if (types_inout[XkbGroup1Index] == types_inout[XkbGroup2Index]) { memcpy((char *) &xkb_syms_rtrn[nSyms[XkbGroup1Index]], (char *) xkb_syms_rtrn, nSyms[XkbGroup1Index] * sizeof(KeySym)); } } /* step 7: check for all groups identical or all width 1 */ if (nGroups > 1) { Bool sameType, allOneLevel; allOneLevel = (xkb->map->types[types_inout[0]].num_levels == 1); for (i = 1, sameType = True; (allOneLevel || sameType) && (i < nGroups); i++) { sameType = (sameType && (types_inout[i] == types_inout[XkbGroup1Index])); if (allOneLevel) allOneLevel = (xkb->map->types[types_inout[i]].num_levels == 1); } if ((sameType) && (!(protected & (XkbExplicitKeyTypesMask & ~XkbExplicitKeyType1Mask)))) { register int s; Bool identical; for (i = 1, identical = True; identical && (i < nGroups); i++) { KeySym *syms; syms = &xkb_syms_rtrn[XKB_OFFSET(i, 0)]; for (s = 0; identical && (s < nSyms[i]); s++) { if (syms[s] != xkb_syms_rtrn[s]) identical = False; } } if (identical) nGroups = 1; } if (allOneLevel && (nGroups > 1)) { KeySym *syms; syms = &xkb_syms_rtrn[nSyms[XkbGroup1Index]]; nSyms[XkbGroup1Index] = 1; for (i = 1; i < nGroups; i++) { xkb_syms_rtrn[i] = syms[0]; syms += nSyms[i]; nSyms[i] = 1; } } } return nGroups; } static XkbSymInterpretPtr _XkbFindMatchingInterp(XkbDescPtr xkb, KeySym sym, unsigned int real_mods, unsigned int level) { register unsigned i; XkbSymInterpretPtr interp, rtrn; CARD8 mods; rtrn = NULL; interp = xkb->compat->sym_interpret; for (i = 0; i < xkb->compat->num_si; i++, interp++) { if ((interp->sym == NoSymbol) || (sym == interp->sym)) { int match; if ((level == 0) || ((interp->match & XkbSI_LevelOneOnly) == 0)) mods = real_mods; else mods = 0; switch (interp->match & XkbSI_OpMask) { case XkbSI_NoneOf: match = ((interp->mods & mods) == 0); break; case XkbSI_AnyOfOrNone: match = ((mods == 0) || ((interp->mods & mods) != 0)); break; case XkbSI_AnyOf: match = ((interp->mods & mods) != 0); break; case XkbSI_AllOf: match = ((interp->mods & mods) == interp->mods); break; case XkbSI_Exactly: match = (interp->mods == mods); break; default: match = 0; break; } if (match) { if (interp->sym != NoSymbol) { return interp; } else if (rtrn == NULL) { rtrn = interp; } } } } return rtrn; } static void _XkbAddKeyChange(KeyCode *pFirst, unsigned char *pNum, KeyCode newKey) { KeyCode last; last = (*pFirst) + (*pNum); if (newKey < *pFirst) { *pFirst = newKey; *pNum = (last - newKey) + 1; } else if (newKey > last) { *pNum = (last - *pFirst) + 1; } return; } static void _XkbSetActionKeyMods(XkbDescPtr xkb, XkbAction *act, unsigned mods) { unsigned tmp; switch (act->type) { case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods: if (act->mods.flags & XkbSA_UseModMapMods) act->mods.real_mods = act->mods.mask = mods; if ((tmp = XkbModActionVMods(&act->mods)) != 0) { XkbVirtualModsToReal(xkb, tmp, &tmp); act->mods.mask |= tmp; } break; case XkbSA_ISOLock: if (act->iso.flags & XkbSA_UseModMapMods) act->iso.real_mods = act->iso.mask = mods; if ((tmp = XkbModActionVMods(&act->iso)) != 0) { XkbVirtualModsToReal(xkb, tmp, &tmp); act->iso.mask |= tmp; } break; } return; } #define IBUF_SIZE 8 Bool XkbApplyCompatMapToKey(XkbDescPtr xkb, KeyCode key, XkbChangesPtr changes) { KeySym *syms; unsigned char explicit, mods; XkbSymInterpretPtr *interps, ibuf[IBUF_SIZE]; int n, nSyms, found; unsigned changed, tmp; if ((!xkb) || (!xkb->map) || (!xkb->map->key_sym_map) || (!xkb->compat) || (!xkb->compat->sym_interpret) || (key < xkb->min_key_code) || (key > xkb->max_key_code)) { return False; } if (((!xkb->server) || (!xkb->server->key_acts)) && (XkbAllocServerMap(xkb, XkbAllServerInfoMask, 0) != Success)) { return False; } changed = 0; /* keeps track of what has changed in _this_ call */ explicit = xkb->server->explicit[key]; if (explicit & XkbExplicitInterpretMask) /* nothing to do */ return True; mods = (xkb->map->modmap ? xkb->map->modmap[key] : 0); nSyms = XkbKeyNumSyms(xkb, key); syms = XkbKeySymsPtr(xkb, key); if (nSyms > IBUF_SIZE) { interps = _XkbTypedCalloc(nSyms, XkbSymInterpretPtr); if (interps == NULL) { interps = ibuf; nSyms = IBUF_SIZE; } } else { interps = ibuf; } found = 0; for (n = 0; n < nSyms; n++) { unsigned level = (n % XkbKeyGroupsWidth(xkb, key)); interps[n] = NULL; if (syms[n] != NoSymbol) { interps[n] = _XkbFindMatchingInterp(xkb, syms[n], mods, level); if (interps[n] && interps[n]->act.type != XkbSA_NoAction) found++; else interps[n] = NULL; } } /* 1/28/96 (ef) -- XXX! WORKING HERE */ if (!found) { if (xkb->server->key_acts[key] != 0) { xkb->server->key_acts[key] = 0; changed |= XkbKeyActionsMask; } } else { XkbAction *pActs; unsigned int new_vmodmask; changed |= XkbKeyActionsMask; pActs = XkbResizeKeyActions(xkb, key, nSyms); if (!pActs) { if (nSyms > IBUF_SIZE) Xfree(interps); return False; } new_vmodmask = 0; for (n = 0; n < nSyms; n++) { if (interps[n]) { unsigned effMods; pActs[n] = *((XkbAction *) &interps[n]->act); if ((n == 0) || ((interps[n]->match & XkbSI_LevelOneOnly) == 0)) { effMods = mods; if (interps[n]->virtual_mod != XkbNoModifier) new_vmodmask |= (1 << interps[n]->virtual_mod); } else effMods = 0; _XkbSetActionKeyMods(xkb, &pActs[n], effMods); } else pActs[n].type = XkbSA_NoAction; } if (((explicit & XkbExplicitVModMapMask) == 0) && (xkb->server->vmodmap[key] != new_vmodmask)) { changed |= XkbVirtualModMapMask; xkb->server->vmodmap[key] = new_vmodmask; } if (interps[0]) { if ((interps[0]->flags & XkbSI_LockingKey) && ((explicit & XkbExplicitBehaviorMask) == 0)) { xkb->server->behaviors[key].type = XkbKB_Lock; changed |= XkbKeyBehaviorsMask; } if (((explicit & XkbExplicitAutoRepeatMask) == 0) && (xkb->ctrls)) { CARD8 old; old = xkb->ctrls->per_key_repeat[key / 8]; if (interps[0]->flags & XkbSI_AutoRepeat) xkb->ctrls->per_key_repeat[key / 8] |= (1 << (key % 8)); else xkb->ctrls->per_key_repeat[key / 8] &= ~(1 << (key % 8)); if (changes && (old != xkb->ctrls->per_key_repeat[key / 8])) changes->ctrls.changed_ctrls |= XkbPerKeyRepeatMask; } } } if ((!found) || (interps[0] == NULL)) { if (((explicit & XkbExplicitAutoRepeatMask) == 0) && (xkb->ctrls)) { CARD8 old; old = xkb->ctrls->per_key_repeat[key / 8]; #ifdef RETURN_SHOULD_REPEAT if (*XkbKeySymsPtr(xkb, key) != XK_Return) #endif xkb->ctrls->per_key_repeat[key / 8] |= (1 << (key % 8)); if (changes && (old != xkb->ctrls->per_key_repeat[key / 8])) changes->ctrls.changed_ctrls |= XkbPerKeyRepeatMask; } if (((explicit & XkbExplicitBehaviorMask) == 0) && (xkb->server->behaviors[key].type == XkbKB_Lock)) { xkb->server->behaviors[key].type = XkbKB_Default; changed |= XkbKeyBehaviorsMask; } } if (changes) { XkbMapChangesPtr mc; mc = &changes->map; tmp = (changed & mc->changed); if (tmp & XkbKeyActionsMask) _XkbAddKeyChange(&mc->first_key_act, &mc->num_key_acts, key); else if (changed & XkbKeyActionsMask) { mc->changed |= XkbKeyActionsMask; mc->first_key_act = key; mc->num_key_acts = 1; } if (tmp & XkbKeyBehaviorsMask) { _XkbAddKeyChange(&mc->first_key_behavior, &mc->num_key_behaviors, key); } else if (changed & XkbKeyBehaviorsMask) { mc->changed |= XkbKeyBehaviorsMask; mc->first_key_behavior = key; mc->num_key_behaviors = 1; } if (tmp & XkbVirtualModMapMask) _XkbAddKeyChange(&mc->first_vmodmap_key, &mc->num_vmodmap_keys, key); else if (changed & XkbVirtualModMapMask) { mc->changed |= XkbVirtualModMapMask; mc->first_vmodmap_key = key; mc->num_vmodmap_keys = 1; } mc->changed |= changed; } if (interps != ibuf) _XkbFree(interps); return True; } Bool XkbUpdateMapFromCore(XkbDescPtr xkb, KeyCode first_key, int num_keys, int map_width, KeySym *core_keysyms, XkbChangesPtr changes) { register int key, last_key; KeySym *syms; syms = &core_keysyms[(first_key - xkb->min_key_code) * map_width]; if (changes) { if (changes->map.changed & XkbKeySymsMask) { _XkbAddKeyChange(&changes->map.first_key_sym, &changes->map.num_key_syms, first_key); if (num_keys > 1) { _XkbAddKeyChange(&changes->map.first_key_sym, &changes->map.num_key_syms, first_key + num_keys - 1); } } else { changes->map.changed |= XkbKeySymsMask; changes->map.first_key_sym = first_key; changes->map.num_key_syms = num_keys; } } last_key = first_key + num_keys - 1; for (key = first_key; key <= last_key; key++, syms += map_width) { XkbMapChangesPtr mc; unsigned explicit; KeySym tsyms[XkbMaxSymsPerKey]; int types[XkbNumKbdGroups]; int nG; explicit = xkb->server->explicit[key] & XkbExplicitKeyTypesMask; types[XkbGroup1Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup1Index); types[XkbGroup2Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup2Index); types[XkbGroup3Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup3Index); types[XkbGroup4Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup4Index); nG = XkbKeyTypesForCoreSymbols(xkb, map_width, syms, explicit, types, tsyms); if (changes) mc = &changes->map; else mc = NULL; XkbChangeTypesOfKey(xkb, key, nG, XkbAllGroupsMask, types, mc); memcpy((char *) XkbKeySymsPtr(xkb, key), (char *) tsyms, XkbKeyNumSyms(xkb, key) * sizeof(KeySym)); XkbApplyCompatMapToKey(xkb, key, changes); } if ((xkb->map->modmap != NULL) && (changes) && (changes->map.changed & (XkbVirtualModMapMask | XkbModifierMapMask))) { unsigned char newVMods[XkbNumVirtualMods]; register unsigned bit, i; unsigned present; bzero(newVMods, XkbNumVirtualMods); present = 0; for (key = xkb->min_key_code; key <= xkb->max_key_code; key++) { if (xkb->server->vmodmap[key] == 0) continue; for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { if (bit & xkb->server->vmodmap[key]) { present |= bit; newVMods[i] |= xkb->map->modmap[key]; } } } for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { if ((bit & present) && (newVMods[i] != xkb->server->vmods[i])) { changes->map.changed |= XkbVirtualModsMask; changes->map.vmods |= bit; xkb->server->vmods[i] = newVMods[i]; } } } if (changes && (changes->map.changed & XkbVirtualModsMask)) XkbApplyVirtualModChanges(xkb, changes->map.vmods, changes); return True; } Status XkbChangeTypesOfKey(XkbDescPtr xkb, int key, int nGroups, unsigned groups, int *newTypesIn, XkbMapChangesPtr changes) { XkbKeyTypePtr pOldType, pNewType; register int i; int width, nOldGroups, oldWidth, newTypes[XkbNumKbdGroups]; if ((!xkb) || (!XkbKeycodeInRange(xkb, key)) || (!xkb->map) || (!xkb->map->types) || ((groups & XkbAllGroupsMask) == 0) || (nGroups > XkbNumKbdGroups)) { return BadMatch; } if (nGroups == 0) { for (i = 0; i < XkbNumKbdGroups; i++) { xkb->map->key_sym_map[key].kt_index[i] = XkbOneLevelIndex; } i = xkb->map->key_sym_map[key].group_info; i = XkbSetNumGroups(i, 0); xkb->map->key_sym_map[key].group_info = i; XkbResizeKeySyms(xkb, key, 0); return Success; } nOldGroups = XkbKeyNumGroups(xkb, key); oldWidth = XkbKeyGroupsWidth(xkb, key); for (width = i = 0; i < nGroups; i++) { if (groups & (1 << i)) newTypes[i] = newTypesIn[i]; else if (i < nOldGroups) newTypes[i] = XkbKeyKeyTypeIndex(xkb, key, i); else if (nOldGroups > 0) newTypes[i] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup1Index); else newTypes[i] = XkbTwoLevelIndex; if (newTypes[i] > xkb->map->num_types) return BadMatch; pNewType = &xkb->map->types[newTypes[i]]; if (pNewType->num_levels > width) width = pNewType->num_levels; } if ((xkb->ctrls) && (nGroups > xkb->ctrls->num_groups)) xkb->ctrls->num_groups = nGroups; if ((width != oldWidth) || (nGroups != nOldGroups)) { KeySym oldSyms[XkbMaxSymsPerKey], *pSyms; int nCopy; if (nOldGroups == 0) { pSyms = XkbResizeKeySyms(xkb, key, width * nGroups); if (pSyms != NULL) { i = xkb->map->key_sym_map[key].group_info; i = XkbSetNumGroups(i, nGroups); xkb->map->key_sym_map[key].group_info = i; xkb->map->key_sym_map[key].width = width; for (i = 0; i < nGroups; i++) { xkb->map->key_sym_map[key].kt_index[i] = newTypes[i]; } return Success; } return BadAlloc; } pSyms = XkbKeySymsPtr(xkb, key); memcpy(oldSyms, pSyms, XkbKeyNumSyms(xkb, key) * sizeof(KeySym)); pSyms = XkbResizeKeySyms(xkb, key, width * nGroups); if (pSyms == NULL) return BadAlloc; bzero(pSyms, width * nGroups * sizeof(KeySym)); for (i = 0; (i < nGroups) && (i < nOldGroups); i++) { pOldType = XkbKeyKeyType(xkb, key, i); pNewType = &xkb->map->types[newTypes[i]]; if (pNewType->num_levels > pOldType->num_levels) nCopy = pOldType->num_levels; else nCopy = pNewType->num_levels; memcpy(&pSyms[i * width], &oldSyms[i * oldWidth], nCopy * sizeof(KeySym)); } if (XkbKeyHasActions(xkb, key)) { XkbAction oldActs[XkbMaxSymsPerKey], *pActs; pActs = XkbKeyActionsPtr(xkb, key); memcpy(oldActs, pActs, XkbKeyNumSyms(xkb, key) * sizeof(XkbAction)); pActs = XkbResizeKeyActions(xkb, key, width * nGroups); if (pActs == NULL) return BadAlloc; bzero(pActs, width * nGroups * sizeof(XkbAction)); for (i = 0; (i < nGroups) && (i < nOldGroups); i++) { pOldType = XkbKeyKeyType(xkb, key, i); pNewType = &xkb->map->types[newTypes[i]]; if (pNewType->num_levels > pOldType->num_levels) nCopy = pOldType->num_levels; else nCopy = pNewType->num_levels; memcpy(&pActs[i * width], &oldActs[i * oldWidth], nCopy * sizeof(XkbAction)); } } i = xkb->map->key_sym_map[key].group_info; i = XkbSetNumGroups(i, nGroups); xkb->map->key_sym_map[key].group_info = i; xkb->map->key_sym_map[key].width = width; } width = 0; for (i = 0; i < nGroups; i++) { xkb->map->key_sym_map[key].kt_index[i] = newTypes[i]; if (xkb->map->types[newTypes[i]].num_levels > width) width = xkb->map->types[newTypes[i]].num_levels; } xkb->map->key_sym_map[key].width = width; if (changes != NULL) { if (changes->changed & XkbKeySymsMask) { _XkbAddKeyChange(&changes->first_key_sym, &changes->num_key_syms, key); } else { changes->changed |= XkbKeySymsMask; changes->first_key_sym = key; changes->num_key_syms = 1; } } return Success; } /***====================================================================***/ Bool XkbVirtualModsToReal(XkbDescPtr xkb, unsigned virtual_mask, unsigned *mask_rtrn) { register int i, bit; register unsigned mask; if (xkb == NULL) return False; if (virtual_mask == 0) { *mask_rtrn = 0; return True; } if (xkb->server == NULL) return False; for (i = mask = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { if (virtual_mask & bit) mask |= xkb->server->vmods[i]; } *mask_rtrn = mask; return True; } /***====================================================================***/ Bool XkbUpdateActionVirtualMods(XkbDescPtr xkb, XkbAction *act, unsigned changed) { unsigned int tmp; switch (act->type) { case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods: if (((tmp = XkbModActionVMods(&act->mods)) & changed) != 0) { XkbVirtualModsToReal(xkb, tmp, &tmp); act->mods.mask = act->mods.real_mods; act->mods.mask |= tmp; return True; } break; case XkbSA_ISOLock: if ((((tmp = XkbModActionVMods(&act->iso)) != 0) & changed) != 0) { XkbVirtualModsToReal(xkb, tmp, &tmp); act->iso.mask = act->iso.real_mods; act->iso.mask |= tmp; return True; } break; } return False; } void XkbUpdateKeyTypeVirtualMods(XkbDescPtr xkb, XkbKeyTypePtr type, unsigned int changed, XkbChangesPtr changes) { register unsigned int i; unsigned int mask = 0; XkbVirtualModsToReal(xkb, type->mods.vmods, &mask); type->mods.mask = type->mods.real_mods | mask; if ((type->map_count > 0) && (type->mods.vmods != 0)) { XkbKTMapEntryPtr entry; for (i = 0, entry = type->map; i < type->map_count; i++, entry++) { if (entry->mods.vmods != 0) { XkbVirtualModsToReal(xkb, entry->mods.vmods, &mask); entry->mods.mask = entry->mods.real_mods | mask; /* entry is active if vmods are bound */ entry->active = (mask != 0); } else entry->active = 1; } } if (changes) { int type_ndx; type_ndx = type - xkb->map->types; if ((type_ndx < 0) || (type_ndx > xkb->map->num_types)) return; if (changes->map.changed & XkbKeyTypesMask) { int last; last = changes->map.first_type + changes->map.num_types - 1; if (type_ndx < changes->map.first_type) { changes->map.first_type = type_ndx; changes->map.num_types = (last - type_ndx) + 1; } else if (type_ndx > last) { changes->map.num_types = (type_ndx - changes->map.first_type) + 1; } } else { changes->map.changed |= XkbKeyTypesMask; changes->map.first_type = type_ndx; changes->map.num_types = 1; } } return; } Bool XkbApplyVirtualModChanges(XkbDescPtr xkb, unsigned changed, XkbChangesPtr changes) { register int i; unsigned int checkState = 0; if ((!xkb) || (!xkb->map) || (changed == 0)) return False; for (i = 0; i < xkb->map->num_types; i++) { if (xkb->map->types[i].mods.vmods & changed) XkbUpdateKeyTypeVirtualMods(xkb, &xkb->map->types[i], changed, changes); } if (changed & xkb->ctrls->internal.vmods) { unsigned int newMask = 0; XkbVirtualModsToReal(xkb, xkb->ctrls->internal.vmods, &newMask); newMask |= xkb->ctrls->internal.real_mods; if (xkb->ctrls->internal.mask != newMask) { xkb->ctrls->internal.mask = newMask; if (changes) { changes->ctrls.changed_ctrls |= XkbInternalModsMask; checkState = True; } } } if (changed & xkb->ctrls->ignore_lock.vmods) { unsigned int newMask = 0; XkbVirtualModsToReal(xkb, xkb->ctrls->ignore_lock.vmods, &newMask); newMask |= xkb->ctrls->ignore_lock.real_mods; if (xkb->ctrls->ignore_lock.mask != newMask) { xkb->ctrls->ignore_lock.mask = newMask; if (changes) { changes->ctrls.changed_ctrls |= XkbIgnoreLockModsMask; checkState = True; } } } if (xkb->indicators != NULL) { XkbIndicatorMapPtr map; map = &xkb->indicators->maps[0]; for (i = 0; i < XkbNumIndicators; i++, map++) { if (map->mods.vmods & changed) { unsigned int newMask = 0; XkbVirtualModsToReal(xkb, map->mods.vmods, &newMask); newMask |= map->mods.real_mods; if (newMask != map->mods.mask) { map->mods.mask = newMask; if (changes) { changes->indicators.map_changes |= (1 << i); checkState = True; } } } } } if (xkb->compat != NULL) { XkbCompatMapPtr compat; compat = xkb->compat; for (i = 0; i < XkbNumKbdGroups; i++) { unsigned int newMask = 0; XkbVirtualModsToReal(xkb, compat->groups[i].vmods, &newMask); newMask |= compat->groups[i].real_mods; if (compat->groups[i].mask != newMask) { compat->groups[i].mask = newMask; if (changes) { changes->compat.changed_groups |= (1 << i); checkState = True; } } } } if (xkb->map && xkb->server) { int highChange = 0, lowChange = -1; for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) { if (XkbKeyHasActions(xkb, i)) { register XkbAction *pAct; register int n; pAct = XkbKeyActionsPtr(xkb, i); for (n = XkbKeyNumActions(xkb, i); n > 0; n--, pAct++) { if ((pAct->type != XkbSA_NoAction) && XkbUpdateActionVirtualMods(xkb, pAct, changed)) { if (lowChange < 0) lowChange = i; highChange = i; } } } } if (changes && (lowChange > 0)) { /* something changed */ if (changes->map.changed & XkbKeyActionsMask) { int last; if (changes->map.first_key_act < lowChange) lowChange = changes->map.first_key_act; last = changes->map.first_key_act + changes->map.num_key_acts - 1; if (last > highChange) highChange = last; } changes->map.changed |= XkbKeyActionsMask; changes->map.first_key_act = lowChange; changes->map.num_key_acts = (highChange - lowChange) + 1; } } return checkState; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBNames.c0000644000000000000000000006667413614532331015223 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #define NEED_MAP_READERS #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include #include "XKBlibint.h" static Status _XkbReadAtoms(XkbReadBufferPtr buf, Atom *atoms, int maxAtoms, CARD32 present) { register int i, bit; for (i = 0, bit = 1; (i < maxAtoms) && (present); i++, bit <<= 1) { if (present & bit) { if (!_XkbReadBufferCopy32(buf, (long *) &atoms[i], 1)) return BadLength; present &= ~bit; } } return Success; } Status _XkbReadGetNamesReply(Display *dpy, xkbGetNamesReply *rep, XkbDescPtr xkb, int *nread_rtrn) { int i, len; XkbReadBufferRec buf; register XkbNamesPtr names; if (xkb->device_spec == XkbUseCoreKbd) xkb->device_spec = rep->deviceID; if ((xkb->names == NULL) && (XkbAllocNames(xkb, rep->which, rep->nRadioGroups, rep->nKeyAliases) != Success)) { return BadAlloc; } names = xkb->names; if (rep->length == 0) return Success; if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) return BadAlloc; if (nread_rtrn) *nread_rtrn = (int) rep->length * 4; if ((rep->which & XkbKeycodesNameMask) && (!_XkbReadBufferCopy32(&buf, (long *) &names->keycodes, 1))) goto BAILOUT; if ((rep->which & XkbGeometryNameMask) && (!_XkbReadBufferCopy32(&buf, (long *) &names->geometry, 1))) goto BAILOUT; if ((rep->which & XkbSymbolsNameMask) && (!_XkbReadBufferCopy32(&buf, (long *) &names->symbols, 1))) goto BAILOUT; if ((rep->which & XkbPhysSymbolsNameMask) && (!_XkbReadBufferCopy32(&buf, (long *) &names->phys_symbols, 1))) goto BAILOUT; if ((rep->which & XkbTypesNameMask) && (!_XkbReadBufferCopy32(&buf, (long *) &names->types, 1))) goto BAILOUT; if ((rep->which & XkbCompatNameMask) && (!_XkbReadBufferCopy32(&buf, (long *) &names->compat, 1))) goto BAILOUT; if (rep->which & XkbKeyTypeNamesMask) { XkbClientMapPtr map = xkb->map; XkbKeyTypePtr type; len = rep->nTypes * 4; if (map != NULL) { type = map->types; for (i = 0; (i < map->num_types) && (i < rep->nTypes); i++, type++) { if (!_XkbReadBufferCopy32(&buf, (long *) &type->name, 1)) goto BAILOUT; len -= 4; } } if ((len > 0) && (!_XkbSkipReadBufferData(&buf, len))) goto BAILOUT; } if (rep->which & XkbKTLevelNamesMask) { CARD8 *nLevels; XkbClientMapPtr map = xkb->map; nLevels = (CARD8 *) _XkbGetReadBufferPtr(&buf, XkbPaddedSize(rep->nTypes)); if (nLevels == NULL) goto BAILOUT; if (map != NULL) { XkbKeyTypePtr type = map->types; for (i = 0; i < (int) rep->nTypes; i++, type++) { if (i >= map->num_types) { if (!_XkbSkipReadBufferData(&buf, nLevels[i] * 4)) goto BAILOUT; continue; } if ((nLevels[i] > 0) && (nLevels[i] != type->num_levels)) { goto BAILOUT; } Xfree(type->level_names); if (nLevels[i] == 0) { type->level_names = NULL; continue; } type->level_names = _XkbTypedCalloc(nLevels[i], Atom); if (type->level_names != NULL) { if (!_XkbReadBufferCopy32(&buf, (long *) type->level_names, nLevels[i])) goto BAILOUT; } else { _XkbSkipReadBufferData(&buf, nLevels[i] * 4); } } } else { for (i = 0; i < (int) rep->nTypes; i++) { _XkbSkipReadBufferData(&buf, nLevels[i] * 4); } } } if (rep->which & XkbIndicatorNamesMask) { if (_XkbReadAtoms(&buf, names->indicators, XkbNumIndicators, rep->indicators) != Success) goto BAILOUT; } if (rep->which & XkbVirtualModNamesMask) { if (_XkbReadAtoms(&buf, names->vmods, XkbNumVirtualMods, (CARD32) rep->virtualMods) != Success) goto BAILOUT; } if (rep->which & XkbGroupNamesMask) { if (_XkbReadAtoms(&buf, names->groups, XkbNumKbdGroups, (CARD32) rep->groupNames) != Success) goto BAILOUT; } if (rep->which & XkbKeyNamesMask) { if (names->keys == NULL) { int nKeys; if (xkb->max_key_code == 0) { xkb->min_key_code = rep->minKeyCode; xkb->max_key_code = rep->maxKeyCode; } nKeys = xkb->max_key_code + 1; names->keys = _XkbTypedCalloc(nKeys, XkbKeyNameRec); } if (((int) rep->firstKey + rep->nKeys) > xkb->max_key_code + 1) goto BAILOUT; if (names->keys != NULL) { if (!_XkbCopyFromReadBuffer(&buf, (char *) &names->keys[rep->firstKey], rep->nKeys * XkbKeyNameLength)) goto BAILOUT; } else _XkbSkipReadBufferData(&buf, rep->nKeys * XkbKeyNameLength); } if (rep->which & XkbKeyAliasesMask && (rep->nKeyAliases > 0)) { if (XkbAllocNames(xkb, XkbKeyAliasesMask, 0, rep->nKeyAliases) != Success) goto BAILOUT; if (!_XkbCopyFromReadBuffer(&buf, (char *) names->key_aliases, rep->nKeyAliases * XkbKeyNameLength * 2)) goto BAILOUT; } if (rep->which & XkbRGNamesMask) { if (rep->nRadioGroups > 0) { Atom *rgNames; if (names->radio_groups == NULL) names->radio_groups = _XkbTypedCalloc(rep->nRadioGroups, Atom); else if (names->num_rg < rep->nRadioGroups) { names->radio_groups = _XkbTypedRealloc(names->radio_groups, rep->nRadioGroups, Atom); } rgNames = names->radio_groups; if (!rgNames) { goto BAILOUT; } if (!_XkbReadBufferCopy32 (&buf, (long *) rgNames, rep->nRadioGroups)) goto BAILOUT; names->num_rg = rep->nRadioGroups; } else if (names->num_rg > 0) { names->num_rg = 0; Xfree(names->radio_groups); } } len = _XkbFreeReadBuffer(&buf); if (len != 0) return BadLength; else return Success; BAILOUT: _XkbFreeReadBuffer(&buf); return BadLength; } Status XkbGetNames(Display *dpy, unsigned which, XkbDescPtr xkb) { register xkbGetNamesReq *req; xkbGetNamesReply rep; Status status; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; LockDisplay(dpy); xkbi = dpy->xkb_info; if (!xkb->names) { xkb->names = _XkbTypedCalloc(1, XkbNamesRec); if (!xkb->names) { UnlockDisplay(dpy); SyncHandle(); return BadAlloc; } } GetReq(kbGetNames, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbGetNames; req->deviceSpec = xkb->device_spec; req->which = which; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return BadImplementation; } status = _XkbReadGetNamesReply(dpy, &rep, xkb, NULL); UnlockDisplay(dpy); SyncHandle(); return status; } /***====================================================================***/ static int _XkbCountBits(int nBitsMax, unsigned long mask) { register unsigned long y, nBits; y = (mask >> 1) & 033333333333; y = mask - y - ((y >> 1) & 033333333333); nBits = ((unsigned int) (((y + (y >> 3)) & 030707070707) % 077)); /* nBitsMax really means max+1 */ return (nBits < nBitsMax) ? nBits : (nBitsMax - 1); } static CARD32 _XkbCountAtoms(Atom *atoms, int maxAtoms, int *count) { register unsigned int i, bit, nAtoms; register CARD32 atomsPresent; for (i = nAtoms = atomsPresent = 0, bit = 1; i < maxAtoms; i++, bit <<= 1) { if (atoms[i] != None) { atomsPresent |= bit; nAtoms++; } } if (count) *count = nAtoms; return atomsPresent; } static void _XkbCopyAtoms(Display *dpy, Atom *atoms, CARD32 mask, int maxAtoms) { register unsigned int i, bit; for (i = 0, bit = 1; i < maxAtoms; i++, bit <<= 1) { if (mask & bit) Data32(dpy, &atoms[i], 4); } return; } Bool XkbSetNames(Display *dpy, unsigned int which, unsigned int firstType, unsigned int nTypes, XkbDescPtr xkb) { register xkbSetNamesReq *req; int nLvlNames = 0; XkbInfoPtr xkbi; XkbNamesPtr names; unsigned firstLvlType, nLvlTypes; int nVMods, nLEDs, nRG, nKA, nGroups; int nKeys = 0, firstKey = 0, nAtoms; CARD32 leds, vmods, groups; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; if ((!xkb) || (!xkb->names)) return False; firstLvlType = firstType; nLvlTypes = nTypes; if (nTypes < 1) which &= ~(XkbKTLevelNamesMask | XkbKeyTypeNamesMask); else if (firstType <= XkbLastRequiredType) { int adjust; adjust = XkbLastRequiredType - firstType + 1; firstType += adjust; nTypes -= adjust; if (nTypes < 1) which &= ~XkbKeyTypeNamesMask; } names = xkb->names; if (which & (XkbKTLevelNamesMask | XkbKeyTypeNamesMask)) { register int i; XkbKeyTypePtr type; if ((xkb->map == NULL) || (xkb->map->types == NULL) || (nTypes == 0) || (firstType + nTypes > xkb->map->num_types) || (firstLvlType + nLvlTypes > xkb->map->num_types)) return False; if (which & XkbKTLevelNamesMask) { type = &xkb->map->types[firstLvlType]; for (i = nLvlNames = 0; i < nLvlTypes; i++, type++) { if (type->level_names != NULL) nLvlNames += type->num_levels; } } } nVMods = nLEDs = nRG = nKA = nAtoms = nGroups = 0; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbSetNames, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbSetNames; req->deviceSpec = xkb->device_spec; req->firstType = firstType; req->nTypes = nTypes; req->firstKey = xkb->min_key_code; req->nKeys = xkb->max_key_code - xkb->min_key_code + 1; if (which & XkbKeycodesNameMask) nAtoms++; if (which & XkbGeometryNameMask) nAtoms++; if (which & XkbSymbolsNameMask) nAtoms++; if (which & XkbPhysSymbolsNameMask) nAtoms++; if (which & XkbTypesNameMask) nAtoms++; if (which & XkbCompatNameMask) nAtoms++; if (which & XkbKeyTypeNamesMask) nAtoms += nTypes; if (which & XkbKTLevelNamesMask) { req->firstKTLevel = firstLvlType; req->nKTLevels = nLvlTypes; req->length += XkbPaddedSize(nLvlTypes) / 4; /* room for group widths */ nAtoms += nLvlNames; } else req->firstKTLevel = req->nKTLevels = 0; if (which & XkbIndicatorNamesMask) { req->indicators = leds = _XkbCountAtoms(names->indicators, XkbNumIndicators, &nLEDs); if (nLEDs > 0) nAtoms += nLEDs; else which &= ~XkbIndicatorNamesMask; } else req->indicators = leds = 0; if (which & XkbVirtualModNamesMask) { vmods = req->virtualMods = (CARD16) _XkbCountAtoms(names->vmods, XkbNumVirtualMods, &nVMods); if (nVMods > 0) nAtoms += nVMods; else which &= ~XkbVirtualModNamesMask; } else vmods = req->virtualMods = 0; if (which & XkbGroupNamesMask) { groups = req->groupNames = (CARD8) _XkbCountAtoms(names->groups, XkbNumKbdGroups, &nGroups); if (nGroups > 0) nAtoms += nGroups; else which &= ~XkbGroupNamesMask; } else groups = req->groupNames = 0; if ((which & XkbKeyNamesMask) && (names->keys != NULL)) { firstKey = req->firstKey; nKeys = req->nKeys; nAtoms += nKeys; /* technically not atoms, but 4 bytes wide */ } else which &= ~XkbKeyNamesMask; if (which & XkbKeyAliasesMask) { nKA = ((names->key_aliases != NULL) ? names->num_key_aliases : 0); if (nKA > 0) { req->nKeyAliases = nKA; nAtoms += nKA * 2; /* not atoms, but 8 bytes on the wire */ } else { which &= ~XkbKeyAliasesMask; req->nKeyAliases = 0; } } else req->nKeyAliases = 0; if (which & XkbRGNamesMask) { nRG = names->num_rg; if (nRG > 0) nAtoms += nRG; else which &= ~XkbRGNamesMask; } req->which = which; req->nRadioGroups = nRG; req->length += (nAtoms * 4) / 4; if (which & XkbKeycodesNameMask) Data32(dpy, (long *) &names->keycodes, 4); if (which & XkbGeometryNameMask) Data32(dpy, (long *) &names->geometry, 4); if (which & XkbSymbolsNameMask) Data32(dpy, (long *) &names->symbols, 4); if (which & XkbPhysSymbolsNameMask) Data32(dpy, (long *) &names->phys_symbols, 4); if (which & XkbTypesNameMask) Data32(dpy, (long *) &names->types, 4); if (which & XkbCompatNameMask) Data32(dpy, (long *) &names->compat, 4); if (which & XkbKeyTypeNamesMask) { register int i; register XkbKeyTypePtr type; type = &xkb->map->types[firstType]; for (i = 0; i < nTypes; i++, type++) { Data32(dpy, (long *) &type->name, 4); } } if (which & XkbKTLevelNamesMask) { XkbKeyTypePtr type; int i; char *tmp; BufAlloc(char *, tmp, XkbPaddedSize(nLvlTypes)); type = &xkb->map->types[firstLvlType]; for (i = 0; i < nLvlTypes; i++, type++) { *tmp++ = type->num_levels; } type = &xkb->map->types[firstLvlType]; for (i = 0; i < nLvlTypes; i++, type++) { if (type->level_names != NULL) Data32(dpy, (long *) type->level_names, type->num_levels * 4); } } if (which & XkbIndicatorNamesMask) _XkbCopyAtoms(dpy, names->indicators, leds, XkbNumIndicators); if (which & XkbVirtualModNamesMask) _XkbCopyAtoms(dpy, names->vmods, vmods, XkbNumVirtualMods); if (which & XkbGroupNamesMask) _XkbCopyAtoms(dpy, names->groups, groups, XkbNumKbdGroups); if (which & XkbKeyNamesMask) { Data(dpy, (char *) &names->keys[firstKey], nKeys * XkbKeyNameLength); } if (which & XkbKeyAliasesMask) { Data(dpy, (char *) names->key_aliases, nKA * XkbKeyNameLength * 2); } if (which & XkbRGNamesMask) { Data32(dpy, (long *) names->radio_groups, nRG * 4); } UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbChangeNames(Display *dpy, XkbDescPtr xkb, XkbNameChangesPtr changes) { register xkbSetNamesReq *req; int nLvlNames = 0; XkbInfoPtr xkbi; XkbNamesPtr names; unsigned which, firstType, nTypes; unsigned firstLvlType, nLvlTypes; int nVMods, nLEDs, nRG, nKA, nGroups; int nKeys = 0, firstKey = 0, nAtoms; CARD32 leds = 0, vmods = 0, groups = 0; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; if ((!xkb) || (!xkb->names) || (!changes)) return False; which = changes->changed; firstType = changes->first_type; nTypes = changes->num_types; firstLvlType = changes->first_lvl; nLvlTypes = changes->num_lvls; if (which & XkbKeyTypeNamesMask) { if (nTypes < 1) which &= ~XkbKeyTypeNamesMask; else if (firstType <= XkbLastRequiredType) { int adjust; adjust = XkbLastRequiredType - firstType + 1; firstType += adjust; nTypes -= adjust; if (nTypes < 1) which &= ~XkbKeyTypeNamesMask; } } else firstType = nTypes = 0; if (which & XkbKTLevelNamesMask) { if (nLvlTypes < 1) which &= ~XkbKTLevelNamesMask; } else firstLvlType = nLvlTypes = 0; names = xkb->names; if (which & (XkbKTLevelNamesMask | XkbKeyTypeNamesMask)) { register int i; if ((xkb->map == NULL) || (xkb->map->types == NULL) || (nTypes == 0) || (firstType + nTypes > xkb->map->num_types) || (firstLvlType + nLvlTypes > xkb->map->num_types)) return False; if (which & XkbKTLevelNamesMask) { XkbKeyTypePtr type = &xkb->map->types[firstLvlType]; for (i = nLvlNames = 0; i < nLvlTypes; i++, type++) { if (type->level_names != NULL) nLvlNames += type->num_levels; } } } if (changes->num_keys < 1) which &= ~XkbKeyNamesMask; if ((which & XkbKeyNamesMask) == 0) changes->first_key = changes->num_keys = 0; else if ((changes->first_key < xkb->min_key_code) || (changes->first_key + changes->num_keys > xkb->max_key_code)) { return False; } if ((which & XkbVirtualModNamesMask) == 0) changes->changed_vmods = 0; else if (changes->changed_vmods == 0) which &= ~XkbVirtualModNamesMask; if ((which & XkbIndicatorNamesMask) == 0) changes->changed_indicators = 0; else if (changes->changed_indicators == 0) which &= ~XkbIndicatorNamesMask; if ((which & XkbGroupNamesMask) == 0) changes->changed_groups = 0; else if (changes->changed_groups == 0) which &= ~XkbGroupNamesMask; nVMods = nLEDs = nRG = nKA = nAtoms = nGroups = 0; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbSetNames, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbSetNames; req->deviceSpec = xkb->device_spec; req->firstType = firstType; req->nTypes = nTypes; req->firstKey = changes->first_key; req->nKeys = changes->num_keys; if (which & XkbKeycodesNameMask) nAtoms++; if (which & XkbGeometryNameMask) nAtoms++; if (which & XkbSymbolsNameMask) nAtoms++; if (which & XkbPhysSymbolsNameMask) nAtoms++; if (which & XkbTypesNameMask) nAtoms++; if (which & XkbCompatNameMask) nAtoms++; if (which & XkbKeyTypeNamesMask) nAtoms += nTypes; if (which & XkbKTLevelNamesMask) { req->firstKTLevel = firstLvlType; req->nKTLevels = nLvlTypes; req->length += XkbPaddedSize(nLvlTypes) / 4; /* room for group widths */ nAtoms += nLvlNames; } else req->firstKTLevel = req->nKTLevels = 0; if (which & XkbIndicatorNamesMask) { leds = req->indicators = (CARD32) changes->changed_indicators; nLEDs = _XkbCountBits(XkbNumIndicators, changes->changed_indicators); if (nLEDs > 0) nAtoms += nLEDs; else which &= ~XkbIndicatorNamesMask; } else req->indicators = 0; if (which & XkbVirtualModNamesMask) { vmods = req->virtualMods = changes->changed_vmods; nVMods = _XkbCountBits(XkbNumVirtualMods, (unsigned long) changes->changed_vmods); if (nVMods > 0) nAtoms += nVMods; else which &= ~XkbVirtualModNamesMask; } else req->virtualMods = 0; if (which & XkbGroupNamesMask) { groups = req->groupNames = changes->changed_groups; nGroups = _XkbCountBits(XkbNumKbdGroups, (unsigned long) changes->changed_groups); if (nGroups > 0) nAtoms += nGroups; else which &= ~XkbGroupNamesMask; } else req->groupNames = 0; if ((which & XkbKeyNamesMask) && (names->keys != NULL)) { firstKey = req->firstKey; nKeys = req->nKeys; nAtoms += nKeys; /* technically not atoms, but 4 bytes wide */ } else which &= ~XkbKeyNamesMask; if (which & XkbKeyAliasesMask) { nKA = ((names->key_aliases != NULL) ? names->num_key_aliases : 0); if (nKA > 0) nAtoms += nKA * 2; /* not atoms, but 8 bytes on the wire */ else which &= ~XkbKeyAliasesMask; } if (which & XkbRGNamesMask) { nRG = names->num_rg; if (nRG > 0) nAtoms += nRG; else which &= ~XkbRGNamesMask; } req->which = which; req->nRadioGroups = nRG; req->length += (nAtoms * 4) / 4; if (which & XkbKeycodesNameMask) Data32(dpy, (long *) &names->keycodes, 4); if (which & XkbGeometryNameMask) Data32(dpy, (long *) &names->geometry, 4); if (which & XkbSymbolsNameMask) Data32(dpy, (long *) &names->symbols, 4); if (which & XkbPhysSymbolsNameMask) Data32(dpy, (long *) &names->phys_symbols, 4); if (which & XkbTypesNameMask) Data32(dpy, (long *) &names->types, 4); if (which & XkbCompatNameMask) Data32(dpy, (long *) &names->compat, 4); if (which & XkbKeyTypeNamesMask) { register int i; register XkbKeyTypePtr type; type = &xkb->map->types[firstType]; for (i = 0; i < nTypes; i++, type++) { Data32(dpy, (long *) &type->name, 4); } } if (which & XkbKTLevelNamesMask) { XkbKeyTypePtr type; int i; char *tmp; BufAlloc(char *, tmp, XkbPaddedSize(nLvlTypes)); type = &xkb->map->types[firstLvlType]; for (i = 0; i < nLvlTypes; i++, type++) { *tmp++ = type->num_levels; } type = &xkb->map->types[firstLvlType]; for (i = 0; i < nLvlTypes; i++, type++) { if (type->level_names != NULL) Data32(dpy, (long *) type->level_names, type->num_levels * 4); } } if (which & XkbIndicatorNamesMask) _XkbCopyAtoms(dpy, names->indicators, leds, XkbNumIndicators); if (which & XkbVirtualModNamesMask) _XkbCopyAtoms(dpy, names->vmods, vmods, XkbNumVirtualMods); if (which & XkbGroupNamesMask) _XkbCopyAtoms(dpy, names->groups, groups, XkbNumKbdGroups); if (which & XkbKeyNamesMask) { Data(dpy, (char *) &names->keys[firstKey], nKeys * XkbKeyNameLength); } if (which & XkbKeyAliasesMask) { Data(dpy, (char *) names->key_aliases, nKA * XkbKeyNameLength * 2); } if (which & XkbRGNamesMask) { Data32(dpy, (long *) names->radio_groups, nRG * 4); } UnlockDisplay(dpy); SyncHandle(); return True; } void XkbNoteNameChanges(XkbNameChangesPtr old, XkbNamesNotifyEvent *new, unsigned int wanted) { int first, last, old_last, new_last; if ((old == NULL) || (new == NULL)) return; wanted &= new->changed; if (wanted == 0) return; if (wanted & XkbKeyTypeNamesMask) { if (old->changed & XkbKeyTypeNamesMask) { new_last = (new->first_type + new->num_types - 1); old_last = (old->first_type + old->num_types - 1); if (new->first_type < old->first_type) first = new->first_type; else first = old->first_type; if (old_last > new_last) last = old_last; else last = new_last; old->first_type = first; old->num_types = (last - first) + 1; } else { old->first_type = new->first_type; old->num_types = new->num_types; } } if (wanted & XkbKTLevelNamesMask) { if (old->changed & XkbKTLevelNamesMask) { new_last = (new->first_lvl + new->num_lvls - 1); old_last = (old->first_lvl + old->num_lvls - 1); if (new->first_lvl < old->first_lvl) first = new->first_lvl; else first = old->first_lvl; if (old_last > new_last) last = old_last; else last = new_last; old->first_lvl = first; old->num_lvls = (last - first) + 1; } else { old->first_lvl = new->first_lvl; old->num_lvls = new->num_lvls; } } if (wanted & XkbIndicatorNamesMask) { if (old->changed & XkbIndicatorNamesMask) old->changed_indicators |= new->changed_indicators; else old->changed_indicators = new->changed_indicators; } if (wanted & XkbKeyNamesMask) { if (old->changed & XkbKeyNamesMask) { new_last = (new->first_key + new->num_keys - 1); old_last = (old->first_key + old->num_keys - 1); first = old->first_key; if (new->first_key < old->first_key) first = new->first_key; if (old_last > new_last) new_last = old_last; old->first_key = first; old->num_keys = (new_last - first) + 1; } else { old->first_key = new->first_key; old->num_keys = new->num_keys; } } if (wanted & XkbVirtualModNamesMask) { if (old->changed & XkbVirtualModNamesMask) old->changed_vmods |= new->changed_vmods; else old->changed_vmods = new->changed_vmods; } if (wanted & XkbGroupNamesMask) { if (old->changed & XkbGroupNamesMask) old->changed_groups |= new->changed_groups; else old->changed_groups = new->changed_groups; } if (wanted & XkbRGNamesMask) old->num_rg = new->num_radio_groups; if (wanted & XkbKeyAliasesMask) old->num_aliases = new->num_aliases; old->changed |= wanted; return; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBRdBuf.c0000644000000000000000000001206113614532331015137 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "XKBlibint.h" #include /***====================================================================***/ int _XkbInitReadBuffer(Display *dpy, XkbReadBufferPtr buf, int size) { if ((dpy != NULL) && (buf != NULL) && (size > 0)) { buf->error = 0; buf->size = size; buf->start = buf->data = _XkbAlloc(size); if (buf->start) { _XRead(dpy, buf->start, size); return 1; } } return 0; } #define _XkbReadBufferDataLeft(b) (((b)->size)-((b)->data-(b)->start)) int _XkbSkipReadBufferData(XkbReadBufferPtr from, int size) { if (size == 0) return 1; if ((from == NULL) || (from->error) || (size < 1) || (_XkbReadBufferDataLeft(from) < size)) return 0; from->data += size; return 1; } int _XkbCopyFromReadBuffer(XkbReadBufferPtr from, char *to, int size) { if (size == 0) return 1; if ((from == NULL) || (from->error) || (to == NULL) || (size < 1) || (_XkbReadBufferDataLeft(from) < size)) return 0; memcpy(to, from->data, size); from->data += size; return 1; } #ifdef XKB_FORCE_INT_KEYSYM int _XkbReadCopyKeySyms(int *wire, KeySym * to, int num_words) { while (num_words-- > 0) { *to++ = *wire++; } return 1; } int _XkbReadBufferCopyKeySyms(XkbReadBufferPtr from, KeySym * to, int num_words) { if ((unsigned) (num_words * 4) > _XkbReadBufferDataLeft(from)) return 0; _XkbReadCopyKeySyms((int *) from->data, to, num_words); from->data += (4 * num_words); return True; } int _XkbWriteCopyKeySyms(register KeySym * from, CARD32 *to, int len) { while (len-- > 0) { *to++ = (CARD32) *from++; } return True; } #endif #ifdef LONG64 int _XkbReadCopyData32(int *wire, long *to, int num_words) { while (num_words-- > 0) { *to++ = *wire++; } return 1; } int _XkbReadBufferCopy32(XkbReadBufferPtr from, long *to, int num_words) { if ((unsigned) (num_words * 4) > _XkbReadBufferDataLeft(from)) return 0; _XkbReadCopyData32((int *) from->data, to, num_words); from->data += (4 * num_words); return True; } int _XkbWriteCopyData32(register unsigned long *from, CARD32 *to, int len) { while (len-- > 0) { *to++ = (CARD32) *from++; } return True; } #endif /* LONG64 */ char * _XkbPeekAtReadBuffer(XkbReadBufferPtr from, int size) { if ((from == NULL) || (from->error) || (size < 1) || (_XkbReadBufferDataLeft(from) < size)) return NULL; return from->data; } char * _XkbGetReadBufferPtr(XkbReadBufferPtr from, int size) { char *ptr; if ((from == NULL) || (from->error) || (size < 1) || (_XkbReadBufferDataLeft(from) < size)) return NULL; ptr = from->data; from->data += size; return ptr; } int _XkbFreeReadBuffer(XkbReadBufferPtr buf) { if ((buf != NULL) && (buf->start != NULL)) { int left; left = (int) _XkbReadBufferDataLeft(buf); Xfree(buf->start); buf->size = 0; buf->start = buf->data = NULL; return left; } return 0; } Bool _XkbGetReadBufferCountedString(XkbReadBufferPtr buf, char **rtrn) { CARD16 len, *pLen; int left; char *str = NULL; if ((buf == NULL) || (buf->error) || ((left = (int) _XkbReadBufferDataLeft(buf)) < 4)) return False; pLen = (CARD16 *) buf->data; len = *pLen; if (len > 0) { if (XkbPaddedSize(len + 2) > left) return False; str = _XkbAlloc(len + 1); if (str) { memcpy(str, &buf->data[2], len); str[len] = '\0'; } } buf->data += XkbPaddedSize(len + 2); *rtrn = str; return True; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBSetGeom.c0000644000000000000000000003544113614532331015507 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef DEBUG #ifdef HAVE_CONFIG_H #include #endif #include #endif #include "Xlibint.h" #include "XKBlibint.h" #include #include #ifndef MINSHORT #define MINSHORT -32768 #endif #ifndef MAXSHORT #define MAXSHORT 32767 #endif /***====================================================================***/ #define _SizeCountedString(s) ((s)?XkbPaddedSize(2+strlen(s)):4) static char * _WriteCountedString(char *wire, char *str) { CARD16 len, *pLen; len = (str ? strlen(str) : 0); pLen = (CARD16 *) wire; *pLen = len; if (len && str) memcpy(&wire[2], str, len); wire += XkbPaddedSize(len + 2); return wire; } static int _SizeGeomProperties(XkbGeometryPtr geom) { register int i, size; XkbPropertyPtr prop; for (size = i = 0, prop = geom->properties; i < geom->num_properties; i++, prop++) { size += _SizeCountedString(prop->name); size += _SizeCountedString(prop->value); } return size; } static int _SizeGeomColors(XkbGeometryPtr geom) { register int i, size; register XkbColorPtr color; for (i = size = 0, color = geom->colors; i < geom->num_colors; i++, color++) { size += _SizeCountedString(color->spec); } return size; } static int _SizeGeomShapes(XkbGeometryPtr geom) { register int i, size; register XkbShapePtr shape; for (i = size = 0, shape = geom->shapes; i < geom->num_shapes; i++, shape++) { register int n; register XkbOutlinePtr ol; size += SIZEOF(xkbShapeWireDesc); for (n = 0, ol = shape->outlines; n < shape->num_outlines; n++, ol++) { size += SIZEOF(xkbOutlineWireDesc); size += ol->num_points * SIZEOF(xkbPointWireDesc); } } return size; } static int _SizeGeomDoodads(int num_doodads, XkbDoodadPtr doodad) { register int i, size; for (i = size = 0; i < num_doodads; i++, doodad++) { size += SIZEOF(xkbAnyDoodadWireDesc); if (doodad->any.type == XkbTextDoodad) { size += _SizeCountedString(doodad->text.text); size += _SizeCountedString(doodad->text.font); } else if (doodad->any.type == XkbLogoDoodad) { size += _SizeCountedString(doodad->logo.logo_name); } } return size; } static int _SizeGeomSections(XkbGeometryPtr geom) { register int i, size; XkbSectionPtr section; for (i = size = 0, section = geom->sections; i < geom->num_sections; i++, section++) { size += SIZEOF(xkbSectionWireDesc); if (section->rows) { int r; XkbRowPtr row; for (r = 0, row = section->rows; r < section->num_rows; row++, r++) { size += SIZEOF(xkbRowWireDesc); size += row->num_keys * SIZEOF(xkbKeyWireDesc); } } if (section->doodads) size += _SizeGeomDoodads(section->num_doodads, section->doodads); if (section->overlays) { int o; XkbOverlayPtr ol; for (o = 0, ol = section->overlays; o < section->num_overlays; o++, ol++) { int r; XkbOverlayRowPtr row; size += SIZEOF(xkbOverlayWireDesc); for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) { size += SIZEOF(xkbOverlayRowWireDesc); size += row->num_keys * SIZEOF(xkbOverlayKeyWireDesc); } } } } return size; } static int _SizeGeomKeyAliases(XkbGeometryPtr geom) { return geom->num_key_aliases * (2 * XkbKeyNameLength); } /***====================================================================***/ static char * _WriteGeomProperties(char *wire, XkbGeometryPtr geom) { register int i; register XkbPropertyPtr prop; for (i = 0, prop = geom->properties; i < geom->num_properties; i++, prop++) { wire = _WriteCountedString(wire, prop->name); wire = _WriteCountedString(wire, prop->value); } return wire; } static char * _WriteGeomColors(char *wire, XkbGeometryPtr geom) { register int i; register XkbColorPtr color; for (i = 0, color = geom->colors; i < geom->num_colors; i++, color++) { wire = _WriteCountedString(wire, color->spec); } return wire; } static char * _WriteGeomShapes(char *wire, XkbGeometryPtr geom) { int i; XkbShapePtr shape; xkbShapeWireDesc *shapeWire; for (i = 0, shape = geom->shapes; i < geom->num_shapes; i++, shape++) { register int o; XkbOutlinePtr ol; xkbOutlineWireDesc *olWire; shapeWire = (xkbShapeWireDesc *) wire; shapeWire->name = shape->name; shapeWire->nOutlines = shape->num_outlines; if (shape->primary != NULL) shapeWire->primaryNdx = XkbOutlineIndex(shape, shape->primary); else shapeWire->primaryNdx = XkbNoShape; if (shape->approx != NULL) shapeWire->approxNdx = XkbOutlineIndex(shape, shape->approx); else shapeWire->approxNdx = XkbNoShape; wire = (char *) &shapeWire[1]; for (o = 0, ol = shape->outlines; o < shape->num_outlines; o++, ol++) { register int p; XkbPointPtr pt; xkbPointWireDesc *ptWire; olWire = (xkbOutlineWireDesc *) wire; olWire->nPoints = ol->num_points; olWire->cornerRadius = ol->corner_radius; wire = (char *) &olWire[1]; ptWire = (xkbPointWireDesc *) wire; for (p = 0, pt = ol->points; p < ol->num_points; p++, pt++) { ptWire[p].x = pt->x; ptWire[p].y = pt->y; } wire = (char *) &ptWire[ol->num_points]; } } return wire; } static char * _WriteGeomDoodads(char *wire, int num_doodads, XkbDoodadPtr doodad) { register int i; for (i = 0; i < num_doodads; i++, doodad++) { xkbDoodadWireDesc *doodadWire = (xkbDoodadWireDesc *) wire; wire = (char *) &doodadWire[1]; bzero(doodadWire, SIZEOF(xkbDoodadWireDesc)); doodadWire->any.name = doodad->any.name; doodadWire->any.type = doodad->any.type; doodadWire->any.priority = doodad->any.priority; doodadWire->any.top = doodad->any.top; doodadWire->any.left = doodad->any.left; doodadWire->any.angle = doodad->any.angle; switch (doodad->any.type) { case XkbOutlineDoodad: case XkbSolidDoodad: doodadWire->shape.colorNdx = doodad->shape.color_ndx; doodadWire->shape.shapeNdx = doodad->shape.shape_ndx; break; case XkbTextDoodad: doodadWire->text.width = doodad->text.width; doodadWire->text.height = doodad->text.height; doodadWire->text.colorNdx = doodad->text.color_ndx; wire = _WriteCountedString(wire, doodad->text.text); wire = _WriteCountedString(wire, doodad->text.font); break; case XkbIndicatorDoodad: doodadWire->indicator.shapeNdx = doodad->indicator.shape_ndx; doodadWire->indicator.onColorNdx = doodad->indicator.on_color_ndx; doodadWire->indicator.offColorNdx = doodad->indicator.off_color_ndx; break; case XkbLogoDoodad: doodadWire->logo.colorNdx = doodad->logo.color_ndx; doodadWire->logo.shapeNdx = doodad->logo.shape_ndx; wire = _WriteCountedString(wire, doodad->logo.logo_name); break; default: break; } } return wire; } static char * _WriteGeomOverlay(char *wire, XkbOverlayPtr ol) { register int r; XkbOverlayRowPtr row; xkbOverlayWireDesc *olWire = (xkbOverlayWireDesc *) wire; olWire->name = ol->name; olWire->nRows = ol->num_rows; wire = (char *) &olWire[1]; for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) { unsigned int k; XkbOverlayKeyPtr key; xkbOverlayRowWireDesc *rowWire = (xkbOverlayRowWireDesc *) wire; rowWire->rowUnder = row->row_under; rowWire->nKeys = row->num_keys; wire = (char *) &rowWire[1]; for (k = 0, key = row->keys; k < row->num_keys; k++, key++) { xkbOverlayKeyWireDesc *keyWire = (xkbOverlayKeyWireDesc *) wire; memcpy(keyWire->over, key->over.name, XkbKeyNameLength); memcpy(keyWire->under, key->under.name, XkbKeyNameLength); wire = (char *) &keyWire[1]; } } return wire; } static char * _WriteGeomSections(char *wire, XkbGeometryPtr geom) { register int i; XkbSectionPtr section; for (i = 0, section = geom->sections; i < geom->num_sections; i++, section++) { xkbSectionWireDesc *sectionWire = (xkbSectionWireDesc *) wire; sectionWire->name = section->name; sectionWire->top = section->top; sectionWire->left = section->left; sectionWire->width = section->width; sectionWire->height = section->height; sectionWire->angle = section->angle; sectionWire->priority = section->priority; sectionWire->nRows = section->num_rows; sectionWire->nDoodads = section->num_doodads; sectionWire->nOverlays = section->num_overlays; sectionWire->pad = 0; wire = (char *) §ionWire[1]; if (section->rows) { int r; XkbRowPtr row; for (r = 0, row = section->rows; r < section->num_rows; r++, row++) { xkbRowWireDesc *rowWire = (xkbRowWireDesc *) wire; rowWire->top = row->top; rowWire->left = row->left; rowWire->nKeys = row->num_keys; rowWire->vertical = row->vertical; rowWire->pad = 0; wire = (char *) &rowWire[1]; if (row->keys) { int k; XkbKeyPtr key; xkbKeyWireDesc *keyWire = (xkbKeyWireDesc *) wire; for (k = 0, key = row->keys; k < row->num_keys; k++, key++) { memcpy(keyWire[k].name, key->name.name, XkbKeyNameLength); keyWire[k].gap = key->gap; keyWire[k].shapeNdx = key->shape_ndx; keyWire[k].colorNdx = key->color_ndx; } wire = (char *) &keyWire[row->num_keys]; } } } if (section->doodads) { wire = _WriteGeomDoodads(wire, section->num_doodads, section->doodads); } if (section->overlays) { register int o; for (o = 0; o < section->num_overlays; o++) { wire = _WriteGeomOverlay(wire, §ion->overlays[o]); } } } return wire; } static char * _WriteGeomKeyAliases(char *wire, XkbGeometryPtr geom) { register int sz; sz = geom->num_key_aliases * (XkbKeyNameLength * 2); if (sz > 0) { memcpy(wire, (char *) geom->key_aliases, sz); wire += sz; } return wire; } /***====================================================================***/ static Status _SendSetGeometry(Display *dpy, XkbGeometryPtr geom, xkbSetGeometryReq *req) { int sz; char *wire, *tbuf; sz = 0; sz += _SizeCountedString(geom->label_font); sz += _SizeGeomProperties(geom); sz += _SizeGeomColors(geom); sz += _SizeGeomShapes(geom); sz += _SizeGeomSections(geom); sz += _SizeGeomDoodads(geom->num_doodads, geom->doodads); sz += _SizeGeomKeyAliases(geom); req->length += (sz / 4); if (sz < (dpy->bufmax - dpy->buffer)) { BufAlloc(char *, wire, sz); tbuf = NULL; } else { tbuf = _XAllocTemp(dpy, sz); if (!tbuf) return BadAlloc; wire = tbuf; } wire = _WriteCountedString(wire, geom->label_font); if (geom->num_properties > 0) wire = _WriteGeomProperties(wire, geom); if (geom->num_colors > 0) wire = _WriteGeomColors(wire, geom); if (geom->num_shapes > 0) wire = _WriteGeomShapes(wire, geom); if (geom->num_sections > 0) wire = _WriteGeomSections(wire, geom); if (geom->num_doodads > 0) wire = _WriteGeomDoodads(wire, geom->num_doodads, geom->doodads); if (geom->num_key_aliases > 0) wire = _WriteGeomKeyAliases(wire, geom); if (tbuf != NULL) { Data(dpy, tbuf, sz); _XFreeTemp(dpy, tbuf, sz); } return Success; } /***====================================================================***/ Status XkbSetGeometry(Display *dpy, unsigned deviceSpec, XkbGeometryPtr geom) { xkbSetGeometryReq *req; Status ret; if ((!geom) || (dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return BadAccess; LockDisplay(dpy); GetReq(kbSetGeometry, req); req->reqType = dpy->xkb_info->codes->major_opcode; req->xkbReqType = X_kbSetGeometry; req->deviceSpec = deviceSpec; req->nShapes = geom->num_shapes; req->nSections = geom->num_sections; req->name = geom->name; req->widthMM = geom->width_mm; req->heightMM = geom->height_mm; req->nProperties = geom->num_properties; req->nColors = geom->num_colors; req->nDoodads = geom->num_doodads; req->nKeyAliases = geom->num_key_aliases; req->baseColorNdx = (geom->base_color - geom->colors); req->labelColorNdx = (geom->label_color - geom->colors); ret = _SendSetGeometry(dpy, geom, req); UnlockDisplay(dpy); SyncHandle(); return ret; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBSetMap.c0000644000000000000000000004542513614532331015340 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include #include "XKBlibint.h" static int _XkbSizeKeyTypes(XkbDescPtr xkb, xkbSetMapReq *req) { XkbKeyTypePtr map; int i, len; if (((req->present & XkbKeyTypesMask) == 0) || (req->nTypes == 0)) { req->present &= ~XkbKeyTypesMask; req->firstType = req->nTypes = 0; return 0; } len = 0; map = &xkb->map->types[req->firstType]; for (i = 0; i < req->nTypes; i++, map++) { len += SIZEOF(xkbKeyTypeWireDesc); len += map->map_count * SIZEOF(xkbKTSetMapEntryWireDesc); if (map->preserve) len += map->map_count * SIZEOF(xkbModsWireDesc); } return len; } static void _XkbWriteKeyTypes(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) { char *buf; XkbKeyTypePtr type; int i, n; xkbKeyTypeWireDesc *desc; if ((req->present & XkbKeyTypesMask) == 0) return; type = &xkb->map->types[req->firstType]; for (i = 0; i < req->nTypes; i++, type++) { int sz = SIZEOF(xkbKeyTypeWireDesc); sz += type->map_count * SIZEOF(xkbKTSetMapEntryWireDesc); if (type->preserve) sz += type->map_count * SIZEOF(xkbModsWireDesc); BufAlloc(xkbKeyTypeWireDesc *, desc, sz); desc->mask = type->mods.mask; desc->realMods = type->mods.real_mods; desc->virtualMods = type->mods.vmods; desc->numLevels = type->num_levels; desc->nMapEntries = type->map_count; desc->preserve = (type->preserve != NULL); buf = (char *) &desc[1]; if (desc->nMapEntries > 0) { xkbKTSetMapEntryWireDesc *wire = (xkbKTSetMapEntryWireDesc *) buf; for (n = 0; n < type->map_count; n++, wire++) { wire->level = type->map[n].level; wire->realMods = type->map[n].mods.real_mods; wire->virtualMods = type->map[n].mods.vmods; } buf = (char *) wire; if (type->preserve) { xkbModsWireDesc *pwire = (xkbModsWireDesc *) buf; for (n = 0; n < type->map_count; n++, pwire++) { pwire->realMods = type->preserve[n].real_mods; pwire->virtualMods = type->preserve[n].vmods; } } } } return; } static int _XkbSizeKeySyms(XkbDescPtr xkb, xkbSetMapReq *req) { int i, len; unsigned nSyms; if (((req->present & XkbKeySymsMask) == 0) || (req->nKeySyms == 0)) { req->present &= ~XkbKeySymsMask; req->firstKeySym = req->nKeySyms = 0; req->totalSyms = 0; return 0; } len = (int) (req->nKeySyms * sizeof(XkbSymMapRec)); for (i = nSyms = 0; i < req->nKeySyms; i++) { nSyms += XkbKeyNumSyms(xkb, i + req->firstKeySym); } len += nSyms * sizeof(CARD32); req->totalSyms = nSyms; return len; } static void _XkbWriteKeySyms(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) { register KeySym *pSym; CARD32 *outSym; XkbSymMapPtr symMap; xkbSymMapWireDesc *desc; register int i; if ((req->present & XkbKeySymsMask) == 0) return; symMap = &xkb->map->key_sym_map[req->firstKeySym]; for (i = 0; i < req->nKeySyms; i++, symMap++) { BufAlloc(xkbSymMapWireDesc *, desc, SIZEOF(xkbSymMapWireDesc) + (XkbKeyNumSyms(xkb, i + req->firstKeySym) * sizeof(CARD32))); desc->ktIndex[0] = symMap->kt_index[0]; desc->ktIndex[1] = symMap->kt_index[1]; desc->ktIndex[2] = symMap->kt_index[2]; desc->ktIndex[3] = symMap->kt_index[3]; desc->groupInfo = symMap->group_info; desc->width = symMap->width; desc->nSyms = XkbKeyNumSyms(xkb, i + req->firstKeySym); outSym = (CARD32 *) &desc[1]; if (desc->nSyms > 0) { pSym = XkbKeySymsPtr(xkb, i + req->firstKeySym); _XkbWriteCopyKeySyms(pSym, outSym, desc->nSyms); } } return; } static int _XkbSizeKeyActions(XkbDescPtr xkb, xkbSetMapReq *req) { int i, len, nActs; if (((req->present & XkbKeyActionsMask) == 0) || (req->nKeyActs == 0)) { req->present &= ~XkbKeyActionsMask; req->firstKeyAct = req->nKeyActs = 0; req->totalActs = 0; return 0; } for (nActs = i = 0; i < req->nKeyActs; i++) { if (xkb->server->key_acts[i + req->firstKeyAct] != 0) nActs += XkbKeyNumActions(xkb, i + req->firstKeyAct); } len = XkbPaddedSize(req->nKeyActs) + (nActs * SIZEOF(xkbActionWireDesc)); req->totalActs = nActs; return len; } static void _XkbWriteKeyActions(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) { register int i; int n; CARD8 *numDesc; XkbAction *actDesc; if ((req->present & XkbKeyActionsMask) == 0) return; n = XkbPaddedSize(req->nKeyActs); n += (req->totalActs * SIZEOF(xkbActionWireDesc)); BufAlloc(CARD8 *, numDesc, n); for (i = 0; i < req->nKeyActs; i++) { if (xkb->server->key_acts[i + req->firstKeyAct] == 0) numDesc[i] = 0; else numDesc[i] = XkbKeyNumActions(xkb, (i + req->firstKeyAct)); } actDesc = (XkbAction *) &numDesc[XkbPaddedSize(req->nKeyActs)]; for (i = 0; i < req->nKeyActs; i++) { if (xkb->server->key_acts[i + req->firstKeyAct] != 0) { n = XkbKeyNumActions(xkb, (i + req->firstKeyAct)); memcpy(actDesc, XkbKeyActionsPtr(xkb, (i + req->firstKeyAct)), n * SIZEOF(xkbActionWireDesc)); actDesc += n; } } return; } static int _XkbSizeKeyBehaviors(XkbDescPtr xkb, xkbSetMapReq *req) { register int i, first, last, nFound; if (((req->present & XkbKeyBehaviorsMask) == 0) || (req->nKeyBehaviors < 1)) { req->present &= ~XkbKeyBehaviorsMask; req->firstKeyBehavior = req->nKeyBehaviors = 0; req->totalKeyBehaviors = 0; return 0; } first = req->firstKeyBehavior; last = first + req->nKeyBehaviors - 1; for (i = first, nFound = 0; i <= last; i++) { if (xkb->server->behaviors[i].type != XkbKB_Default) nFound++; } req->totalKeyBehaviors = nFound; return (nFound * SIZEOF(xkbBehaviorWireDesc)); } static void _XkbWriteKeyBehaviors(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) { register int i, first, last; xkbBehaviorWireDesc *wire; char *buf; if ((req->present & XkbKeyBehaviorsMask) == 0) return; first = req->firstKeyBehavior; last = first + req->nKeyBehaviors - 1; i = req->totalKeyBehaviors * SIZEOF(xkbBehaviorWireDesc); BufAlloc(char *, buf, i); wire = (xkbBehaviorWireDesc *) buf; for (i = first; i <= last; i++) { if (xkb->server->behaviors[i].type != XkbKB_Default) { wire->key = i; wire->type = xkb->server->behaviors[i].type; wire->data = xkb->server->behaviors[i].data; buf += SIZEOF(xkbBehaviorWireDesc); wire = (xkbBehaviorWireDesc *) buf; } } return; } static unsigned _XkbSizeVirtualMods(xkbSetMapReq *req) { register int i, bit, nMods; if (((req->present & XkbVirtualModsMask) == 0) || (req->virtualMods == 0)) { req->present &= ~XkbVirtualModsMask; req->virtualMods = 0; return 0; } for (i = nMods = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { if (req->virtualMods & bit) nMods++; } return XkbPaddedSize(nMods); } static void _XkbWriteVirtualMods(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req, unsigned size) { register int i, bit; CARD8 *vmods; /* This was req->present&XkbVirtualModsMask==0, and '==' beats '&' */ if (((req->present & XkbVirtualModsMask) == 0) || (size < 1)) return; BufAlloc(CARD8 *, vmods, size); for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { if (req->virtualMods & bit) *vmods++ = xkb->server->vmods[i]; } return; } static int _XkbSizeKeyExplicit(XkbDescPtr xkb, xkbSetMapReq *req) { register int i, first, last, nFound; if (((req->present & XkbExplicitComponentsMask) == 0) || (req->nKeyExplicit == 0)) { req->present &= ~XkbExplicitComponentsMask; req->firstKeyExplicit = req->nKeyExplicit = 0; req->totalKeyExplicit = 0; return 0; } first = req->firstKeyExplicit; last = first + req->nKeyExplicit - 1; for (i = first, nFound = 0; i <= last; i++) { if (xkb->server->explicit[i] != 0) nFound++; } req->totalKeyExplicit = nFound; return XkbPaddedSize((nFound * 2)); } static void _XkbWriteKeyExplicit(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) { register int i, first, last; CARD8 *wire; if ((req->present & XkbExplicitComponentsMask) == 0) return; first = req->firstKeyExplicit; last = first + req->nKeyExplicit - 1; i = XkbPaddedSize((req->totalKeyExplicit * 2)); BufAlloc(CARD8 *, wire, i); for (i = first; i <= last; i++) { if (xkb->server->explicit[i] != 0) { wire[0] = i; wire[1] = xkb->server->explicit[i]; wire += 2; } } return; } static int _XkbSizeModifierMap(XkbDescPtr xkb, xkbSetMapReq *req) { register int i, first, last, nFound; if (((req->present & XkbModifierMapMask) == 0) || (req->nModMapKeys == 0)) { req->present &= ~XkbModifierMapMask; req->firstModMapKey = req->nModMapKeys = 0; req->totalModMapKeys = 0; return 0; } first = req->firstModMapKey; last = first + req->nModMapKeys - 1; for (i = first, nFound = 0; i <= last; i++) { if (xkb->map->modmap[i] != 0) nFound++; } req->totalModMapKeys = nFound; return XkbPaddedSize((nFound * 2)); } static void _XkbWriteModifierMap(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) { register int i, first, last; CARD8 *wire; if ((req->present & XkbModifierMapMask) == 0) return; first = req->firstModMapKey; last = first + req->nModMapKeys - 1; if (req->totalModMapKeys > 0) { i = XkbPaddedSize((req->totalModMapKeys * 2)); BufAlloc(CARD8 *, wire, i); for (i = first; i <= last; i++) { if (xkb->map->modmap[i] != 0) { wire[0] = i; wire[1] = xkb->map->modmap[i]; wire += 2; } } } return; } static int _XkbSizeVirtualModMap(XkbDescPtr xkb, xkbSetMapReq *req) { register int i, first, last, nFound; if (((req->present & XkbVirtualModMapMask) == 0) || (req->nVModMapKeys == 0)) { req->present &= ~XkbVirtualModMapMask; req->firstVModMapKey = req->nVModMapKeys = 0; req->totalVModMapKeys = 0; return 0; } first = req->firstVModMapKey; last = first + req->nVModMapKeys - 1; for (i = first, nFound = 0; i <= last; i++) { if (xkb->server->vmodmap[i] != 0) nFound++; } req->totalVModMapKeys = nFound; return nFound * SIZEOF(xkbVModMapWireDesc); } static void _XkbWriteVirtualModMap(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) { register int i, first, last; xkbVModMapWireDesc *wire; if ((req->present & XkbVirtualModMapMask) == 0) return; first = req->firstVModMapKey; last = first + req->nVModMapKeys - 1; if (req->totalVModMapKeys > 0) { i = req->totalVModMapKeys * SIZEOF(xkbVModMapWireDesc); BufAlloc(xkbVModMapWireDesc *, wire, i); for (i = first; i <= last; i++) { if (xkb->server->vmodmap[i] != 0) { wire->key = i; wire->vmods = xkb->server->vmodmap[i]; wire++; } } } return; } static void SendSetMap(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) { xkbSetMapReq tmp; unsigned szMods; req->length += _XkbSizeKeyTypes(xkb, req) / 4; req->length += _XkbSizeKeySyms(xkb, req) / 4; req->length += _XkbSizeKeyActions(xkb, req) / 4; req->length += _XkbSizeKeyBehaviors(xkb, req) / 4; szMods = _XkbSizeVirtualMods(req); req->length += szMods / 4; req->length += _XkbSizeKeyExplicit(xkb, req) / 4; req->length += _XkbSizeModifierMap(xkb, req) / 4; req->length += _XkbSizeVirtualModMap(xkb, req) / 4; tmp = *req; if (tmp.nTypes > 0) _XkbWriteKeyTypes(dpy, xkb, &tmp); if (tmp.nKeySyms > 0) _XkbWriteKeySyms(dpy, xkb, &tmp); if (tmp.nKeyActs) _XkbWriteKeyActions(dpy, xkb, &tmp); if (tmp.totalKeyBehaviors > 0) _XkbWriteKeyBehaviors(dpy, xkb, &tmp); if (tmp.virtualMods) _XkbWriteVirtualMods(dpy, xkb, &tmp, szMods); if (tmp.totalKeyExplicit > 0) _XkbWriteKeyExplicit(dpy, xkb, &tmp); if (tmp.totalModMapKeys > 0) _XkbWriteModifierMap(dpy, xkb, &tmp); if (tmp.totalVModMapKeys > 0) _XkbWriteVirtualModMap(dpy, xkb, &tmp); return; } Bool XkbSetMap(Display *dpy, unsigned which, XkbDescPtr xkb) { register xkbSetMapReq *req; XkbInfoPtr xkbi; XkbServerMapPtr srv; XkbClientMapPtr map; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || (!xkb)) return False; map = xkb->map; srv = xkb->server; if (((which & XkbKeyTypesMask) && ((!map) || (!map->types))) || ((which & XkbKeySymsMask) && ((!map) || (!map->syms) || (!map->key_sym_map))) || ((which & XkbKeyActionsMask) && ((!srv) || (!srv->key_acts))) || ((which & XkbKeyBehaviorsMask) && ((!srv) || (!srv->behaviors))) || ((which & XkbVirtualModsMask) && (!srv)) || ((which & XkbExplicitComponentsMask) && ((!srv) || (!srv->explicit))) || ((which & XkbModifierMapMask) && ((!map) || (!map->modmap))) || ((which & XkbVirtualModMapMask) && ((!srv) || (!srv->vmodmap)))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbSetMap, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbSetMap; req->deviceSpec = xkb->device_spec; req->present = which; req->flags = XkbSetMapAllFlags; req->minKeyCode = xkb->min_key_code; req->maxKeyCode = xkb->max_key_code; req->firstType = 0; if (which & XkbKeyTypesMask) req->nTypes = map->num_types; else req->nTypes = 0; if (which & XkbKeySymsMask) { req->firstKeySym = xkb->min_key_code; req->nKeySyms = XkbNumKeys(xkb); } if (which & XkbKeyActionsMask) { req->firstKeyAct = xkb->min_key_code; req->nKeyActs = XkbNumKeys(xkb); } if (which & XkbKeyBehaviorsMask) { req->firstKeyBehavior = xkb->min_key_code; req->nKeyBehaviors = XkbNumKeys(xkb); } if (which & XkbVirtualModsMask) req->virtualMods = ~0; if (which & XkbExplicitComponentsMask) { req->firstKeyExplicit = xkb->min_key_code; req->nKeyExplicit = XkbNumKeys(xkb); } if (which & XkbModifierMapMask) { req->firstModMapKey = xkb->min_key_code; req->nModMapKeys = XkbNumKeys(xkb); } if (which & XkbVirtualModMapMask) { req->firstVModMapKey = xkb->min_key_code; req->nVModMapKeys = XkbNumKeys(xkb); } SendSetMap(dpy, xkb, req); UnlockDisplay(dpy); SyncHandle(); return True; } Bool XkbChangeMap(Display *dpy, XkbDescPtr xkb, XkbMapChangesPtr changes) { register xkbSetMapReq *req; XkbInfoPtr xkbi; XkbServerMapPtr srv; XkbClientMapPtr map; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || (!xkb) || (!changes)) return False; srv = xkb->server; map = xkb->map; if (((changes->changed & XkbKeyTypesMask) && ((!map) || (!map->types))) || ((changes->changed & XkbKeySymsMask) && ((!map) || (!map->syms) || (!map->key_sym_map))) || ((changes->changed & XkbKeyActionsMask) && ((!srv) || (!srv->key_acts))) || ((changes->changed & XkbKeyBehaviorsMask) && ((!srv) || (!srv->behaviors))) || ((changes->changed & XkbVirtualModsMask) && (!srv)) || ((changes->changed & XkbExplicitComponentsMask) && ((!srv) || (!srv->explicit))) || ((changes->changed & XkbModifierMapMask) && ((!map) || (!map->modmap))) || ((changes->changed & XkbVirtualModMapMask) && ((!srv) || (!srv->vmodmap)))) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbSetMap, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbSetMap; req->deviceSpec = xkb->device_spec; req->present = changes->changed; req->flags = XkbSetMapRecomputeActions; req->minKeyCode = xkb->min_key_code; req->maxKeyCode = xkb->max_key_code; req->firstType = changes->first_type; req->nTypes = changes->num_types; req->firstKeySym = changes->first_key_sym; req->nKeySyms = changes->num_key_syms; req->firstKeyAct = changes->first_key_act; req->nKeyActs = changes->num_key_acts; req->firstKeyBehavior = changes->first_key_behavior; req->nKeyBehaviors = changes->num_key_behaviors; req->virtualMods = changes->vmods; req->firstKeyExplicit = changes->first_key_explicit; req->nKeyExplicit = changes->num_key_explicit; req->firstModMapKey = changes->first_modmap_key; req->nModMapKeys = changes->num_modmap_keys; req->firstVModMapKey = changes->first_vmodmap_key; req->nVModMapKeys = changes->num_vmodmap_keys; SendSetMap(dpy, xkb, req); UnlockDisplay(dpy); SyncHandle(); return True; } nx-libs-3.5.99.23/nx-X11/lib/src/xkb/XKBUse.c0000644000000000000000000007423113614532331014700 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Xlibint.h" #include #include "XKBlibint.h" static Bool _XkbIgnoreExtension = False; void XkbNoteMapChanges(XkbMapChangesPtr old, XkbMapNotifyEvent *new, unsigned wanted) { int first, oldLast, newLast; wanted &= new->changed; if (wanted & XkbKeyTypesMask) { if (old->changed & XkbKeyTypesMask) { first = old->first_type; oldLast = old->first_type + old->num_types - 1; newLast = new->first_type + new->num_types - 1; if (new->first_type < first) first = new->first_type; if (oldLast > newLast) newLast = oldLast; old->first_type = first; old->num_types = newLast - first + 1; } else { old->first_type = new->first_type; old->num_types = new->num_types; } } if (wanted & XkbKeySymsMask) { if (old->changed & XkbKeySymsMask) { first = old->first_key_sym; oldLast = old->first_key_sym + old->num_key_syms - 1; newLast = new->first_key_sym + new->num_key_syms - 1; if (new->first_key_sym < first) first = new->first_key_sym; if (oldLast > newLast) newLast = oldLast; old->first_key_sym = first; old->num_key_syms = newLast - first + 1; } else { old->first_key_sym = new->first_key_sym; old->num_key_syms = new->num_key_syms; } } if (wanted & XkbKeyActionsMask) { if (old->changed & XkbKeyActionsMask) { first = old->first_key_act; oldLast = old->first_key_act + old->num_key_acts - 1; newLast = new->first_key_act + new->num_key_acts - 1; if (new->first_key_act < first) first = new->first_key_act; if (oldLast > newLast) newLast = oldLast; old->first_key_act = first; old->num_key_acts = newLast - first + 1; } else { old->first_key_act = new->first_key_act; old->num_key_acts = new->num_key_acts; } } if (wanted & XkbKeyBehaviorsMask) { if (old->changed & XkbKeyBehaviorsMask) { first = old->first_key_behavior; oldLast = old->first_key_behavior + old->num_key_behaviors - 1; newLast = new->first_key_behavior + new->num_key_behaviors - 1; if (new->first_key_behavior < first) first = new->first_key_behavior; if (oldLast > newLast) newLast = oldLast; old->first_key_behavior = first; old->num_key_behaviors = newLast - first + 1; } else { old->first_key_behavior = new->first_key_behavior; old->num_key_behaviors = new->num_key_behaviors; } } if (wanted & XkbVirtualModsMask) { old->vmods |= new->vmods; } if (wanted & XkbExplicitComponentsMask) { if (old->changed & XkbExplicitComponentsMask) { first = old->first_key_explicit; oldLast = old->first_key_explicit + old->num_key_explicit - 1; newLast = new->first_key_explicit + new->num_key_explicit - 1; if (new->first_key_explicit < first) first = new->first_key_explicit; if (oldLast > newLast) newLast = oldLast; old->first_key_explicit = first; old->num_key_explicit = newLast - first + 1; } else { old->first_key_explicit = new->first_key_explicit; old->num_key_explicit = new->num_key_explicit; } } if (wanted & XkbModifierMapMask) { if (old->changed & XkbModifierMapMask) { first = old->first_modmap_key; oldLast = old->first_modmap_key + old->num_modmap_keys - 1; newLast = new->first_modmap_key + new->num_modmap_keys - 1; if (new->first_modmap_key < first) first = new->first_modmap_key; if (oldLast > newLast) newLast = oldLast; old->first_modmap_key = first; old->num_modmap_keys = newLast - first + 1; } else { old->first_modmap_key = new->first_modmap_key; old->num_modmap_keys = new->num_modmap_keys; } } if (wanted & XkbVirtualModMapMask) { if (old->changed & XkbVirtualModMapMask) { first = old->first_vmodmap_key; oldLast = old->first_vmodmap_key + old->num_vmodmap_keys - 1; newLast = new->first_vmodmap_key + new->num_vmodmap_keys - 1; if (new->first_vmodmap_key < first) first = new->first_vmodmap_key; if (oldLast > newLast) newLast = oldLast; old->first_vmodmap_key = first; old->num_vmodmap_keys = newLast - first + 1; } else { old->first_vmodmap_key = new->first_vmodmap_key; old->num_vmodmap_keys = new->num_vmodmap_keys; } } old->changed |= wanted; return; } void _XkbNoteCoreMapChanges(XkbMapChangesPtr old, XMappingEvent *new, unsigned int wanted) { int first, oldLast, newLast; if ((new->request == MappingKeyboard) && (wanted & XkbKeySymsMask)) { if (old->changed & XkbKeySymsMask) { first = old->first_key_sym; oldLast = old->first_key_sym + old->num_key_syms - 1; newLast = new->first_keycode + new->count - 1; if (new->first_keycode < first) first = new->first_keycode; if (oldLast > newLast) newLast = oldLast; old->first_key_sym = first; old->num_key_syms = newLast - first + 1; } else { old->changed |= XkbKeySymsMask; old->first_key_sym = new->first_keycode; old->num_key_syms = new->count; } } return; } static Bool wire_to_event(Display *dpy, XEvent *re, xEvent *event) { xkbEvent *xkbevent = (xkbEvent *) event; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) return False; xkbi = dpy->xkb_info; if (((event->u.u.type & 0x7f) - xkbi->codes->first_event) != XkbEventCode) return False; switch (xkbevent->u.any.xkbType) { case XkbStateNotify: { xkbStateNotify *sn = (xkbStateNotify *) event; if (xkbi->selected_events & XkbStateNotifyMask) { XkbStateNotifyEvent *sev = (XkbStateNotifyEvent *) re; sev->type = XkbEventCode + xkbi->codes->first_event; sev->xkb_type = XkbStateNotify; sev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); sev->send_event = ((event->u.u.type & 0x80) != 0); sev->display = dpy; sev->time = sn->time; sev->device = sn->deviceID; sev->keycode = sn->keycode; sev->event_type = sn->eventType; sev->req_major = sn->requestMajor; sev->req_minor = sn->requestMinor; sev->changed = sn->changed; sev->group = sn->group; sev->base_group = sn->baseGroup; sev->latched_group = sn->latchedGroup; sev->locked_group = sn->lockedGroup; sev->mods = sn->mods; sev->base_mods = sn->baseMods; sev->latched_mods = sn->latchedMods; sev->locked_mods = sn->lockedMods; sev->compat_state = sn->compatState; sev->grab_mods = sn->grabMods; sev->compat_grab_mods = sn->compatGrabMods; sev->lookup_mods = sn->lookupMods; sev->compat_lookup_mods = sn->compatLookupMods; sev->ptr_buttons = sn->ptrBtnState; return True; } } break; case XkbMapNotify: { xkbMapNotify *mn = (xkbMapNotify *) event; if ((xkbi->selected_events & XkbMapNotifyMask) && (xkbi->selected_map_details & mn->changed)) { XkbMapNotifyEvent *mev = (XkbMapNotifyEvent *) re; mev->type = XkbEventCode + xkbi->codes->first_event; mev->xkb_type = XkbMapNotify; mev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); mev->send_event = ((event->u.u.type & 0x80) != 0); mev->display = dpy; mev->time = mn->time; mev->device = mn->deviceID; mev->changed = mn->changed; mev->min_key_code = mn->minKeyCode; mev->max_key_code = mn->maxKeyCode; mev->first_type = mn->firstType; mev->num_types = mn->nTypes; mev->first_key_sym = mn->firstKeySym; mev->num_key_syms = mn->nKeySyms; mev->first_key_act = mn->firstKeyAct; mev->num_key_acts = mn->nKeyActs; mev->first_key_behavior = mn->firstKeyBehavior; mev->num_key_behaviors = mn->nKeyBehaviors; mev->vmods = mn->virtualMods; mev->first_key_explicit = mn->firstKeyExplicit; mev->num_key_explicit = mn->nKeyExplicit; mev->first_modmap_key = mn->firstModMapKey; mev->num_modmap_keys = mn->nModMapKeys; mev->first_vmodmap_key = mn->firstVModMapKey; mev->num_vmodmap_keys = mn->nVModMapKeys; XkbNoteMapChanges(&xkbi->changes, mev, XKB_XLIB_MAP_MASK); if (xkbi->changes.changed) xkbi->flags |= XkbMapPending; return True; } else if (mn->nKeySyms > 0) { register XMappingEvent *ev = (XMappingEvent *) re; ev->type = MappingNotify; ev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); ev->send_event = ((event->u.u.type & 0x80) != 0); ev->display = dpy; ev->window = 0; ev->first_keycode = mn->firstKeySym; ev->request = MappingKeyboard; ev->count = mn->nKeySyms; _XkbNoteCoreMapChanges(&xkbi->changes, ev, XKB_XLIB_MAP_MASK); if (xkbi->changes.changed) xkbi->flags |= XkbMapPending; return True; } } break; case XkbControlsNotify: { if (xkbi->selected_events & XkbControlsNotifyMask) { xkbControlsNotify *cn = (xkbControlsNotify *) event; XkbControlsNotifyEvent *cev = (XkbControlsNotifyEvent *) re; cev->type = XkbEventCode + xkbi->codes->first_event; cev->xkb_type = XkbControlsNotify; cev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); cev->send_event = ((event->u.u.type & 0x80) != 0); cev->display = dpy; cev->time = cn->time; cev->device = cn->deviceID; cev->changed_ctrls = cn->changedControls; cev->enabled_ctrls = cn->enabledControls; cev->enabled_ctrl_changes = cn->enabledControlChanges; cev->keycode = cn->keycode; cev->num_groups = cn->numGroups; cev->event_type = cn->eventType; cev->req_major = cn->requestMajor; cev->req_minor = cn->requestMinor; return True; } } break; case XkbIndicatorMapNotify: { if (xkbi->selected_events & XkbIndicatorMapNotifyMask) { xkbIndicatorNotify *in = (xkbIndicatorNotify *) event; XkbIndicatorNotifyEvent *iev = (XkbIndicatorNotifyEvent *) re; iev->type = XkbEventCode + xkbi->codes->first_event; iev->xkb_type = XkbIndicatorMapNotify; iev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); iev->send_event = ((event->u.u.type & 0x80) != 0); iev->display = dpy; iev->time = in->time; iev->device = in->deviceID; iev->changed = in->changed; iev->state = in->state; return True; } } break; case XkbIndicatorStateNotify: { if (xkbi->selected_events & XkbIndicatorStateNotifyMask) { xkbIndicatorNotify *in = (xkbIndicatorNotify *) event; XkbIndicatorNotifyEvent *iev = (XkbIndicatorNotifyEvent *) re; iev->type = XkbEventCode + xkbi->codes->first_event; iev->xkb_type = XkbIndicatorStateNotify; iev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); iev->send_event = ((event->u.u.type & 0x80) != 0); iev->display = dpy; iev->time = in->time; iev->device = in->deviceID; iev->changed = in->changed; iev->state = in->state; return True; } } break; case XkbBellNotify: { if (xkbi->selected_events & XkbBellNotifyMask) { xkbBellNotify *bn = (xkbBellNotify *) event; XkbBellNotifyEvent *bev = (XkbBellNotifyEvent *) re; bev->type = XkbEventCode + xkbi->codes->first_event; bev->xkb_type = XkbBellNotify; bev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); bev->send_event = ((event->u.u.type & 0x80) != 0); bev->display = dpy; bev->time = bn->time; bev->device = bn->deviceID; bev->percent = bn->percent; bev->pitch = bn->pitch; bev->duration = bn->duration; bev->bell_class = bn->bellClass; bev->bell_id = bn->bellID; bev->name = bn->name; bev->window = bn->window; bev->event_only = bn->eventOnly; return True; } } break; case XkbAccessXNotify: { if (xkbi->selected_events & XkbAccessXNotifyMask) { xkbAccessXNotify *axn = (xkbAccessXNotify *) event; XkbAccessXNotifyEvent *axev = (XkbAccessXNotifyEvent *) re; axev->type = XkbEventCode + xkbi->codes->first_event; axev->xkb_type = XkbAccessXNotify; axev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); axev->send_event = ((event->u.u.type & 0x80) != 0); axev->display = dpy; axev->time = axn->time; axev->device = axn->deviceID; axev->detail = axn->detail; axev->keycode = axn->keycode; axev->sk_delay = axn->slowKeysDelay; axev->debounce_delay = axn->debounceDelay; return True; } } break; case XkbNamesNotify: { if (xkbi->selected_events & XkbNamesNotifyMask) { xkbNamesNotify *nn = (xkbNamesNotify *) event; XkbNamesNotifyEvent *nev = (XkbNamesNotifyEvent *) re; nev->type = XkbEventCode + xkbi->codes->first_event; nev->xkb_type = XkbNamesNotify; nev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); nev->send_event = ((event->u.u.type & 0x80) != 0); nev->display = dpy; nev->time = nn->time; nev->device = nn->deviceID; nev->changed = nn->changed; nev->first_type = nn->firstType; nev->num_types = nn->nTypes; nev->first_lvl = nn->firstLevelName; nev->num_lvls = nn->nLevelNames; nev->num_aliases = nn->nAliases; nev->num_radio_groups = nn->nRadioGroups; nev->changed_vmods = nn->changedVirtualMods; nev->changed_groups = nn->changedGroupNames; nev->changed_indicators = nn->changedIndicators; nev->first_key = nn->firstKey; nev->num_keys = nn->nKeys; return True; } } break; case XkbCompatMapNotify: { if (xkbi->selected_events & XkbCompatMapNotifyMask) { xkbCompatMapNotify *cmn = (xkbCompatMapNotify *) event; XkbCompatMapNotifyEvent *cmev = (XkbCompatMapNotifyEvent *) re; cmev->type = XkbEventCode + xkbi->codes->first_event; cmev->xkb_type = XkbCompatMapNotify; cmev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); cmev->send_event = ((event->u.u.type & 0x80) != 0); cmev->display = dpy; cmev->time = cmn->time; cmev->device = cmn->deviceID; cmev->changed_groups = cmn->changedGroups; cmev->first_si = cmn->firstSI; cmev->num_si = cmn->nSI; cmev->num_total_si = cmn->nTotalSI; return True; } } break; case XkbActionMessage: { if (xkbi->selected_events & XkbActionMessageMask) { xkbActionMessage *am = (xkbActionMessage *) event; XkbActionMessageEvent *amev = (XkbActionMessageEvent *) re; amev->type = XkbEventCode + xkbi->codes->first_event; amev->xkb_type = XkbActionMessage; amev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); amev->send_event = ((event->u.u.type & 0x80) != 0); amev->display = dpy; amev->time = am->time; amev->device = am->deviceID; amev->keycode = am->keycode; amev->press = am->press; amev->key_event_follows = am->keyEventFollows; amev->group = am->group; amev->mods = am->mods; memcpy(amev->message, am->message, XkbActionMessageLength); amev->message[XkbActionMessageLength] = '\0'; return True; } } break; case XkbExtensionDeviceNotify: { if (xkbi->selected_events & XkbExtensionDeviceNotifyMask) { xkbExtensionDeviceNotify *ed = (xkbExtensionDeviceNotify *) event; XkbExtensionDeviceNotifyEvent *edev = (XkbExtensionDeviceNotifyEvent *) re; edev->type = XkbEventCode + xkbi->codes->first_event; edev->xkb_type = XkbExtensionDeviceNotify; edev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); edev->send_event = ((event->u.u.type & 0x80) != 0); edev->display = dpy; edev->time = ed->time; edev->device = ed->deviceID; edev->led_class = ed->ledClass; edev->led_id = ed->ledID; edev->reason = ed->reason; edev->supported = ed->supported; edev->leds_defined = ed->ledsDefined; edev->led_state = ed->ledState; edev->first_btn = ed->firstBtn; edev->num_btns = ed->nBtns; edev->unsupported = ed->unsupported; return True; } } break; case XkbNewKeyboardNotify: { xkbNewKeyboardNotify *nkn = (xkbNewKeyboardNotify *) event; if ((xkbi->selected_events & XkbNewKeyboardNotifyMask) && (xkbi->selected_nkn_details & nkn->changed)) { XkbNewKeyboardNotifyEvent *nkev = (XkbNewKeyboardNotifyEvent *) re; nkev->type = XkbEventCode + xkbi->codes->first_event; nkev->xkb_type = XkbNewKeyboardNotify; nkev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); nkev->send_event = ((event->u.u.type & 0x80) != 0); nkev->display = dpy; nkev->time = nkn->time; nkev->device = nkn->deviceID; nkev->old_device = nkn->oldDeviceID; nkev->min_key_code = nkn->minKeyCode; nkev->max_key_code = nkn->maxKeyCode; nkev->old_min_key_code = nkn->oldMinKeyCode; nkev->old_max_key_code = nkn->oldMaxKeyCode; nkev->req_major = nkn->requestMajor; nkev->req_minor = nkn->requestMinor; nkev->changed = nkn->changed; if ((xkbi->desc) && (nkev->send_event == 0) && ((xkbi->desc->device_spec == nkev->old_device) || (nkev->device != nkev->old_device))) { xkbi->flags = XkbMapPending | XkbXlibNewKeyboard; } return True; } else if (nkn->changed & (XkbNKN_KeycodesMask | XkbNKN_DeviceIDMask)) { register XMappingEvent *ev = (XMappingEvent *) re; ev->type = MappingNotify; ev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); ev->send_event = ((event->u.u.type & 0x80) != 0); ev->display = dpy; ev->window = 0; ev->first_keycode = dpy->min_keycode; ev->request = MappingKeyboard; ev->count = (dpy->max_keycode - dpy->min_keycode) + 1; if ((xkbi->desc) && (ev->send_event == 0) && ((xkbi->desc->device_spec == nkn->oldDeviceID) || (nkn->deviceID != nkn->oldDeviceID))) { xkbi->flags |= XkbMapPending | XkbXlibNewKeyboard; } return True; } } break; default: #ifdef DEBUG fprintf(stderr, "Got unknown XKEYBOARD event (%d, base=%d)\n", re->type, xkbi->codes->first_event); #endif break; } return False; } Bool XkbIgnoreExtension(Bool ignore) { if (getenv("XKB_FORCE") != NULL) { #ifdef DEBUG fprintf(stderr, "Forcing use of XKEYBOARD (overriding an IgnoreExtensions)\n"); #endif return False; } #ifdef DEBUG else if (getenv("XKB_DEBUG") != NULL) { fprintf(stderr, "Explicitly %signoring XKEYBOARD\n", ignore ? "" : "not "); } #endif _XkbIgnoreExtension = ignore; return True; } static void _XkbFreeInfo(Display *dpy) { XkbInfoPtr xkbi = dpy->xkb_info; if (xkbi) { if (xkbi->desc) XkbFreeKeyboard(xkbi->desc, XkbAllComponentsMask, True); Xfree(xkbi); } } Bool XkbUseExtension(Display *dpy, int *major_rtrn, int *minor_rtrn) { xkbUseExtensionReply rep; register xkbUseExtensionReq *req; XExtCodes *codes; int ev_base, forceIgnore; XkbInfoPtr xkbi; char *str; static int debugMsg; static int been_here = 0; if (dpy->xkb_info && !(dpy->flags & XlibDisplayNoXkb)) { if (major_rtrn) *major_rtrn = dpy->xkb_info->srv_major; if (minor_rtrn) *minor_rtrn = dpy->xkb_info->srv_minor; return True; } if (!been_here) { debugMsg = (getenv("XKB_DEBUG") != NULL); been_here = 1; } if (major_rtrn) *major_rtrn = 0; if (minor_rtrn) *minor_rtrn = 0; if (!dpy->xkb_info) { xkbi = _XkbTypedCalloc(1, XkbInfoRec); if (!xkbi) return False; dpy->xkb_info = xkbi; dpy->free_funcs->xkb = _XkbFreeInfo; xkbi->xlib_ctrls |= (XkbLC_ControlFallback | XkbLC_ConsumeLookupMods); if ((str = getenv("_XKB_OPTIONS_ENABLE")) != NULL) { if ((str = getenv("_XKB_LATIN1_LOOKUP")) != NULL) { if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) xkbi->xlib_ctrls &= ~XkbLC_ForceLatin1Lookup; else xkbi->xlib_ctrls |= XkbLC_ForceLatin1Lookup; } if ((str = getenv("_XKB_CONSUME_LOOKUP_MODS")) != NULL) { if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) xkbi->xlib_ctrls &= ~XkbLC_ConsumeLookupMods; else xkbi->xlib_ctrls |= XkbLC_ConsumeLookupMods; } if ((str = getenv("_XKB_CONSUME_SHIFT_AND_LOCK")) != NULL) { if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) xkbi->xlib_ctrls &= ~XkbLC_AlwaysConsumeShiftAndLock; else xkbi->xlib_ctrls |= XkbLC_AlwaysConsumeShiftAndLock; } if ((str = getenv("_XKB_IGNORE_NEW_KEYBOARDS")) != NULL) { if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) xkbi->xlib_ctrls &= ~XkbLC_IgnoreNewKeyboards; else xkbi->xlib_ctrls |= XkbLC_IgnoreNewKeyboards; } if ((str = getenv("_XKB_CONTROL_FALLBACK")) != NULL) { if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) xkbi->xlib_ctrls &= ~XkbLC_ControlFallback; else xkbi->xlib_ctrls |= XkbLC_ControlFallback; } if ((str = getenv("_XKB_COMP_LED")) != NULL) { if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) xkbi->xlib_ctrls &= ~XkbLC_ComposeLED; else { xkbi->xlib_ctrls |= XkbLC_ComposeLED; if (strlen(str) > 0) xkbi->composeLED = XInternAtom(dpy, str, False); } } if ((str = getenv("_XKB_COMP_FAIL_BEEP")) != NULL) { if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) xkbi->xlib_ctrls &= ~XkbLC_BeepOnComposeFail; else xkbi->xlib_ctrls |= XkbLC_BeepOnComposeFail; } } if ((xkbi->composeLED == None) && ((xkbi->xlib_ctrls & XkbLC_ComposeLED) != 0)) xkbi->composeLED = XInternAtom(dpy, "Compose", False); #ifdef DEBUG if (debugMsg) { register unsigned c = xkbi->xlib_ctrls; fprintf(stderr, "XKEYBOARD compose: beep on failure is %s, LED is %s\n", ((c & XkbLC_BeepOnComposeFail) ? "on" : "off"), ((c & XkbLC_ComposeLED) ? "on" : "off")); fprintf(stderr, "XKEYBOARD XLookupString: %slatin-1, %s lookup modifiers\n", ((c & XkbLC_ForceLatin1Lookup) ? "allow non-" : "force "), ((c & XkbLC_ConsumeLookupMods) ? "consume" : "re-use")); fprintf(stderr, "XKEYBOARD XLookupString: %sconsume shift and lock, %scontrol fallback\n", ((c & XkbLC_AlwaysConsumeShiftAndLock) ? "always " : "don't "), ((c & XkbLC_ControlFallback) ? "" : "no ")); } #endif } else xkbi = dpy->xkb_info; forceIgnore = (dpy->flags & XlibDisplayNoXkb) || dpy->keysyms; forceIgnore = forceIgnore && (major_rtrn == NULL) && (minor_rtrn == NULL); if (forceIgnore || _XkbIgnoreExtension || getenv("XKB_DISABLE")) { LockDisplay(dpy); dpy->flags |= XlibDisplayNoXkb; UnlockDisplay(dpy); if (debugMsg) fprintf(stderr, "XKEYBOARD extension disabled or missing\n"); return False; } if ((codes = XInitExtension(dpy, XkbName)) == NULL) { LockDisplay(dpy); dpy->flags |= XlibDisplayNoXkb; UnlockDisplay(dpy); if (debugMsg) fprintf(stderr, "XKEYBOARD extension not present\n"); return False; } xkbi->codes = codes; LockDisplay(dpy); GetReq(kbUseExtension, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbUseExtension; req->wantedMajor = XkbMajorVersion; req->wantedMinor = XkbMinorVersion; if (!_XReply(dpy, (xReply *) &rep, 0, xFalse) || !rep.supported) { Bool fail = True; if (debugMsg) fprintf(stderr, "XKEYBOARD version mismatch (want %d.%02d, got %d.%02d)\n", XkbMajorVersion, XkbMinorVersion, rep.serverMajor, rep.serverMinor); /* pre-release 0.65 is very close to 1.00 */ if ((rep.serverMajor == 0) && (rep.serverMinor == 65)) { if (debugMsg) fprintf(stderr, "Trying to fall back to version 0.65..."); GetReq(kbUseExtension, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbUseExtension; req->wantedMajor = 0; req->wantedMinor = 65; if (_XReply(dpy, (xReply *) &rep, 0, xFalse) && rep.supported) { if (debugMsg) fprintf(stderr, "succeeded\n"); fail = False; } else if (debugMsg) fprintf(stderr, "failed\n"); } if (fail) { dpy->flags |= XlibDisplayNoXkb; UnlockDisplay(dpy); SyncHandle(); if (major_rtrn) *major_rtrn = rep.serverMajor; if (minor_rtrn) *minor_rtrn = rep.serverMinor; return False; } } #ifdef DEBUG else if (forceIgnore) { fprintf(stderr, "Internal Error! XkbUseExtension succeeded with forceIgnore set\n"); } #endif UnlockDisplay(dpy); xkbi->srv_major = rep.serverMajor; xkbi->srv_minor = rep.serverMinor; if (major_rtrn) *major_rtrn = rep.serverMajor; if (minor_rtrn) *minor_rtrn = rep.serverMinor; if (debugMsg) fprintf(stderr, "XKEYBOARD (version %d.%02d/%d.%02d) OK!\n", XkbMajorVersion, XkbMinorVersion, rep.serverMajor, rep.serverMinor); ev_base = codes->first_event; XESetWireToEvent(dpy, ev_base + XkbEventCode, wire_to_event); SyncHandle(); return True; } nx-libs-3.5.99.23/nx-X11/lib/src/XlibAsync.c0000644000000000000000000001437313614532331014710 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include /*ARGSUSED*/ Bool _XAsyncErrorHandler( register Display *dpy, register xReply *rep, char *buf, int len, XPointer data) { register _XAsyncErrorState *state; state = (_XAsyncErrorState *)data; if (rep->generic.type == X_Error && (!state->error_code || rep->error.errorCode == state->error_code) && (!state->major_opcode || rep->error.majorCode == state->major_opcode) && (!state->minor_opcode || rep->error.minorCode == state->minor_opcode) && (!state->min_sequence_number || (state->min_sequence_number <= dpy->last_request_read)) && (!state->max_sequence_number || (state->max_sequence_number >= dpy->last_request_read))) { state->last_error_received = rep->error.errorCode; state->error_count++; return True; } return False; } void _XDeqAsyncHandler( Display *dpy, register _XAsyncHandler *handler) { register _XAsyncHandler **prev; register _XAsyncHandler *async; for (prev = &dpy->async_handlers; (async = *prev) && (async != handler); prev = &async->next) ; if (async) *prev = async->next; } char * _XGetAsyncReply( register Display *dpy, register char *replbuf, /* data is read into this buffer */ register xReply *rep, /* value passed to calling handler */ char *buf, /* value passed to calling handler */ int len, /* value passed to calling handler */ int extra, /* extra words to read, ala _XReply */ Bool discard) /* discard after extra?, ala _XReply */ { if (extra == 0) { if (discard && (rep->generic.length << 2) > len) _XEatData (dpy, (rep->generic.length << 2) - len); return (char *)rep; } if (extra <= rep->generic.length) { int size = SIZEOF(xReply) + (extra << 2); if (size > len) { memcpy(replbuf, buf, len); _XRead(dpy, replbuf + len, size - len); buf = replbuf; len = size; } if (discard && rep->generic.length > extra && (rep->generic.length << 2) > len) _XEatData (dpy, (rep->generic.length << 2) - len); return buf; } /* *if we get here, then extra > rep->generic.length--meaning we * read a reply that's shorter than we expected. This is an * error, but we still need to figure out how to handle it... */ if ((rep->generic.length << 2) > len) _XEatData (dpy, (rep->generic.length << 2) - len); #ifdef NX_TRANS_SOCKET /* * The original code has provision * for returning already. */ #endif _XIOError (dpy); return (char *)rep; } void _XGetAsyncData( Display *dpy, char *data, /* data is read into this buffer */ char *buf, /* value passed to calling handler */ int len, /* value passed to calling handler */ int skip, /* number of bytes already read in previous _XGetAsyncReply or _XGetAsyncData calls */ int datalen, /* size of data buffer in bytes */ int discardtotal) /* min. bytes to consume (after skip) */ { buf += skip; len -= skip; if (!data) { if (datalen > len) _XEatData(dpy, datalen - len); } else if (datalen <= len) { memcpy(data, buf, datalen); } else { memcpy(data, buf, len); _XRead(dpy, data + len, datalen - len); } if (discardtotal > len) { if (datalen > len) len = datalen; _XEatData(dpy, discardtotal - len); } } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/ICWrap.c0000644000000000000000000002344113614532331015573 0ustar /* * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation, * and Nippon Telegraph and Telephone Corporation * Copyright 1991 by the Open Software Foundation * Copyright 1993 by the FUJITSU LIMITED * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of OMRON, NTT Software, NTT, and * Open Software Foundation not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. OMRON, NTT Software, NTT, and Open Software * Foundation make no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * OMRON, NTT SOFTWARE, NTT, AND OPEN SOFTWARE FOUNDATION * DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT * SHALL OMRON, NTT SOFTWARE, NTT, OR OPEN SOFTWARE FOUNDATION BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Authors: Li Yuhong OMRON Corporation * Tatsuya Kato NTT Software Corporation * Hiroshi Kuribayashi OMRON Coproration * Muneiyoshi Suzuki Nippon Telegraph and Telephone Co. * * M. Collins OSF * Takashi Fujiwara FUJITSU LIMITED */ /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" static int _XIMNestedListToNestedList( XIMArg *nlist, /* This is the new list */ XIMArg *list) /* The original list */ { register XIMArg *ptr = list; while (ptr->name) { if (!strcmp(ptr->name, XNVaNestedList)) { nlist += _XIMNestedListToNestedList(nlist, (XIMArg *)ptr->value); } else { nlist->name = ptr->name; nlist->value = ptr->value; ptr++; nlist++; } } return ptr - list; } static void _XIMCountNestedList( XIMArg *args, int *total_count) { for (; args->name; args++) { if (!strcmp(args->name, XNVaNestedList)) _XIMCountNestedList((XIMArg *)args->value, total_count); else ++(*total_count); } } static void _XIMCountVaList(va_list var, int *total_count) { char *attr; *total_count = 0; for (attr = va_arg(var, char*); attr; attr = va_arg(var, char*)) { if (!strcmp(attr, XNVaNestedList)) { _XIMCountNestedList(va_arg(var, XIMArg*), total_count); } else { (void)va_arg(var, XIMArg*); ++(*total_count); } } } static void _XIMVaToNestedList(va_list var, int max_count, XIMArg **args_return) { XIMArg *args; char *attr; if (max_count <= 0) { *args_return = (XIMArg *)NULL; return; } args = Xmalloc(((unsigned)max_count + 1) * sizeof(XIMArg)); *args_return = args; if (!args) return; for (attr = va_arg(var, char*); attr; attr = va_arg(var, char*)) { if (!strcmp(attr, XNVaNestedList)) { args += _XIMNestedListToNestedList(args, va_arg(var, XIMArg*)); } else { args->name = attr; args->value = va_arg(var, XPointer); args++; } } args->name = (char*)NULL; } /*ARGSUSED*/ XVaNestedList XVaCreateNestedList(int dummy, ...) { va_list var; XIMArg *args = NULL; int total_count; va_start(var, dummy); _XIMCountVaList(var, &total_count); va_end(var); va_start(var, dummy); _XIMVaToNestedList(var, total_count, &args); va_end(var); return (XVaNestedList)args; } char * XSetIMValues(XIM im, ...) { va_list var; int total_count; XIMArg *args; char *ret = NULL; /* * so count the stuff dangling here */ va_start(var, im); _XIMCountVaList(var, &total_count); va_end(var); /* * now package it up so we can send it along */ va_start(var, im); _XIMVaToNestedList(var, total_count, &args); va_end(var); if (im && im->methods) ret = (*im->methods->set_values) (im, args); Xfree(args); return ret; } char * XGetIMValues(XIM im, ...) { va_list var; int total_count; XIMArg *args; char *ret = NULL; /* * so count the stuff dangling here */ va_start(var, im); _XIMCountVaList(var, &total_count); va_end(var); /* * now package it up so we can send it along */ va_start(var, im); _XIMVaToNestedList(var, total_count, &args); va_end(var); if (im && im->methods) ret = (*im->methods->get_values) (im, args); Xfree(args); return ret; } /* * Create an input context within the input method, * and return a pointer to the input context. */ XIC XCreateIC(XIM im, ...) { va_list var; int total_count; XIMArg *args; XIC ic = NULL; /* * so count the stuff dangling here */ va_start(var, im); _XIMCountVaList(var, &total_count); va_end(var); /* * now package it up so we can send it along */ va_start(var, im); _XIMVaToNestedList(var, total_count, &args); va_end(var); if (im && im->methods) ic = (XIC) (*im->methods->create_ic) (im, args); Xfree(args); if (ic) { ic->core.next = im->core.ic_chain; im->core.ic_chain = ic; } return ic; } /* * Free the input context. */ void XDestroyIC(XIC ic) { XIM im = ic->core.im; XIC *prev; (*ic->methods->destroy) (ic); if (im) { for (prev = &im->core.ic_chain; *prev; prev = &(*prev)->core.next) { if (*prev == ic) { *prev = ic->core.next; break; } } } Xfree (ic); } char * XGetICValues(XIC ic, ...) { va_list var; int total_count; XIMArg *args; char *ret; if (!ic->core.im) return (char *) NULL; /* * so count the stuff dangling here */ va_start(var, ic); _XIMCountVaList(var, &total_count); va_end(var); /* * now package it up so we can send it along */ va_start(var, ic); _XIMVaToNestedList(var, total_count, &args); va_end(var); ret = (*ic->methods->get_values) (ic, args); Xfree(args); return ret; } char * XSetICValues(XIC ic, ...) { va_list var; int total_count; XIMArg *args; char *ret; if (!ic->core.im) return (char *) NULL; /* * so count the stuff dangling here */ va_start(var, ic); _XIMCountVaList(var, &total_count); va_end(var); /* * now package it up so we can send it along */ va_start(var, ic); _XIMVaToNestedList(var, total_count, &args); va_end(var); ret = (*ic->methods->set_values) (ic, args); Xfree(args); return ret; } /* * Require the input manager to focus the focus window attached to the ic * argument. */ void XSetICFocus(XIC ic) { if (ic && ic->core.im) (*ic->methods->set_focus) (ic); } /* * Require the input manager to unfocus the focus window attached to the ic * argument. */ void XUnsetICFocus(XIC ic) { if (ic->core.im) (*ic->methods->unset_focus) (ic); } /* * Return the XIM associated with the input context. */ XIM XIMOfIC(XIC ic) { return ic->core.im; } char * XmbResetIC(XIC ic) { if (ic->core.im) return (*ic->methods->mb_reset)(ic); return (char *)NULL; } wchar_t * XwcResetIC(XIC ic) { if (ic->core.im) return (*ic->methods->wc_reset)(ic); return (wchar_t *)NULL; } char * Xutf8ResetIC(XIC ic) { if (ic->core.im) { if (ic->methods->utf8_reset) return (*ic->methods->utf8_reset)(ic); else if (ic->methods->mb_reset) return (*ic->methods->mb_reset)(ic); } return (char *)NULL; } int XmbLookupString(XIC ic, XKeyEvent *ev, char *buffer, int nbytes, KeySym *keysym, Status *status) { if (ic->core.im) return (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes, keysym, status); return XLookupNone; } int XwcLookupString(XIC ic, XKeyEvent *ev, wchar_t *buffer, int nchars, KeySym *keysym, Status *status) { if (ic->core.im) return (*ic->methods->wc_lookup_string) (ic, ev, buffer, nchars, keysym, status); return XLookupNone; } int Xutf8LookupString(XIC ic, XKeyEvent *ev, char *buffer, int nbytes, KeySym *keysym, Status *status) { if (ic->core.im) { if (ic->methods->utf8_lookup_string) return (*ic->methods->utf8_lookup_string) (ic, ev, buffer, nbytes, keysym, status); else if (ic->methods->mb_lookup_string) return (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes, keysym, status); } return XLookupNone; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/imKStoUCS.c0000644000000000000000000005135413614532331016233 0ustar #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Ximint.h" static unsigned short const keysym_to_unicode_1a1_1ff[] = { 0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, /* 0x01a0-0x01a7 */ 0x0000, 0x0160, 0x015e, 0x0164, 0x0179, 0x0000, 0x017d, 0x017b, /* 0x01a8-0x01af */ 0x0000, 0x0105, 0x02db, 0x0142, 0x0000, 0x013e, 0x015b, 0x02c7, /* 0x01b0-0x01b7 */ 0x0000, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, /* 0x01b8-0x01bf */ 0x0154, 0x0000, 0x0000, 0x0102, 0x0000, 0x0139, 0x0106, 0x0000, /* 0x01c0-0x01c7 */ 0x010c, 0x0000, 0x0118, 0x0000, 0x011a, 0x0000, 0x0000, 0x010e, /* 0x01c8-0x01cf */ 0x0110, 0x0143, 0x0147, 0x0000, 0x0000, 0x0150, 0x0000, 0x0000, /* 0x01d0-0x01d7 */ 0x0158, 0x016e, 0x0000, 0x0170, 0x0000, 0x0000, 0x0162, 0x0000, /* 0x01d8-0x01df */ 0x0155, 0x0000, 0x0000, 0x0103, 0x0000, 0x013a, 0x0107, 0x0000, /* 0x01e0-0x01e7 */ 0x010d, 0x0000, 0x0119, 0x0000, 0x011b, 0x0000, 0x0000, 0x010f, /* 0x01e8-0x01ef */ 0x0111, 0x0144, 0x0148, 0x0000, 0x0000, 0x0151, 0x0000, 0x0000, /* 0x01f0-0x01f7 */ 0x0159, 0x016f, 0x0000, 0x0171, 0x0000, 0x0000, 0x0163, 0x02d9 /* 0x01f8-0x01ff */ }; static unsigned short const keysym_to_unicode_2a1_2fe[] = { 0x0126, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0000, /* 0x02a0-0x02a7 */ 0x0000, 0x0130, 0x0000, 0x011e, 0x0134, 0x0000, 0x0000, 0x0000, /* 0x02a8-0x02af */ 0x0000, 0x0127, 0x0000, 0x0000, 0x0000, 0x0000, 0x0125, 0x0000, /* 0x02b0-0x02b7 */ 0x0000, 0x0131, 0x0000, 0x011f, 0x0135, 0x0000, 0x0000, 0x0000, /* 0x02b8-0x02bf */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010a, 0x0108, 0x0000, /* 0x02c0-0x02c7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02c8-0x02cf */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0120, 0x0000, 0x0000, /* 0x02d0-0x02d7 */ 0x011c, 0x0000, 0x0000, 0x0000, 0x0000, 0x016c, 0x015c, 0x0000, /* 0x02d8-0x02df */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010b, 0x0109, 0x0000, /* 0x02e0-0x02e7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02e8-0x02ef */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0121, 0x0000, 0x0000, /* 0x02f0-0x02f7 */ 0x011d, 0x0000, 0x0000, 0x0000, 0x0000, 0x016d, 0x015d /* 0x02f8-0x02ff */ }; static unsigned short const keysym_to_unicode_3a2_3fe[] = { 0x0138, 0x0156, 0x0000, 0x0128, 0x013b, 0x0000, /* 0x03a0-0x03a7 */ 0x0000, 0x0000, 0x0112, 0x0122, 0x0166, 0x0000, 0x0000, 0x0000, /* 0x03a8-0x03af */ 0x0000, 0x0000, 0x0000, 0x0157, 0x0000, 0x0129, 0x013c, 0x0000, /* 0x03b0-0x03b7 */ 0x0000, 0x0000, 0x0113, 0x0123, 0x0167, 0x014a, 0x0000, 0x014b, /* 0x03b8-0x03bf */ 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012e, /* 0x03c0-0x03c7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0116, 0x0000, 0x0000, 0x012a, /* 0x03c8-0x03cf */ 0x0000, 0x0145, 0x014c, 0x0136, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03d0-0x03d7 */ 0x0000, 0x0172, 0x0000, 0x0000, 0x0000, 0x0168, 0x016a, 0x0000, /* 0x03d8-0x03df */ 0x0101, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012f, /* 0x03e0-0x03e7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0117, 0x0000, 0x0000, 0x012b, /* 0x03e8-0x03ef */ 0x0000, 0x0146, 0x014d, 0x0137, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03f0-0x03f7 */ 0x0000, 0x0173, 0x0000, 0x0000, 0x0000, 0x0169, 0x016b /* 0x03f8-0x03ff */ }; static unsigned short const keysym_to_unicode_4a1_4df[] = { 0x3002, 0x3008, 0x3009, 0x3001, 0x30fb, 0x30f2, 0x30a1, /* 0x04a0-0x04a7 */ 0x30a3, 0x30a5, 0x30a7, 0x30a9, 0x30e3, 0x30e5, 0x30e7, 0x30c3, /* 0x04a8-0x04af */ 0x30fc, 0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, /* 0x04b0-0x04b7 */ 0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb, 0x30bd, /* 0x04b8-0x04bf */ 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca, 0x30cb, 0x30cc, /* 0x04c0-0x04c7 */ 0x30cd, 0x30ce, 0x30cf, 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, /* 0x04c8-0x04cf */ 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e4, 0x30e6, 0x30e8, 0x30e9, /* 0x04d0-0x04d7 */ 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef, 0x30f3, 0x309b, 0x309c /* 0x04d8-0x04df */ }; static unsigned short const keysym_to_unicode_590_5fe[] = { 0x06f0, 0x06f1, 0x06f2, 0x06f3, 0x06f4, 0x06f5, 0x06f6, 0x06f7, /* 0x0590-0x0597 */ 0x06f8, 0x06f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x0598-0x059f */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x066a, 0x0670, 0x0679, /* 0x05a0-0x05a7 */ 0x067e, 0x0686, 0x0688, 0x0691, 0x060c, 0x0000, 0x06d4, 0x0000, /* 0x05ac-0x05af */ 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, /* 0x05b0-0x05b7 */ 0x0668, 0x0669, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, /* 0x05b8-0x05bf */ 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, /* 0x05c0-0x05c7 */ 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, /* 0x05c8-0x05cf */ 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, /* 0x05d0-0x05d7 */ 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x05d8-0x05df */ 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, /* 0x05e0-0x05e7 */ 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, /* 0x05e8-0x05ef */ 0x0650, 0x0651, 0x0652, 0x0653, 0x0654, 0x0655, 0x0698, 0x06a4, /* 0x05f0-0x05f7 */ 0x06a9, 0x06af, 0x06ba, 0x06be, 0x06cc, 0x06d2, 0x06c1 /* 0x05f8-0x05fe */ }; static unsigned short keysym_to_unicode_680_6ff[] = { 0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2, /* 0x0680-0x0687 */ 0x04b6, 0x04b8, 0x04ba, 0x0000, 0x04d8, 0x04e2, 0x04e8, 0x04ee, /* 0x0688-0x068f */ 0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3, /* 0x0690-0x0697 */ 0x04b7, 0x04b9, 0x04bb, 0x0000, 0x04d9, 0x04e3, 0x04e9, 0x04ef, /* 0x0698-0x069f */ 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, /* 0x06a0-0x06a7 */ 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0491, 0x045e, 0x045f, /* 0x06a8-0x06af */ 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, /* 0x06b0-0x06b7 */ 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0490, 0x040e, 0x040f, /* 0x06b8-0x06bf */ 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, /* 0x06c0-0x06c7 */ 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0x06c8-0x06cf */ 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, /* 0x06d0-0x06d7 */ 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0x06d8-0x06df */ 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, /* 0x06e0-0x06e7 */ 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0x06e8-0x06ef */ 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, /* 0x06f0-0x06f7 */ 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a /* 0x06f8-0x06ff */ }; static unsigned short const keysym_to_unicode_7a1_7f9[] = { 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, /* 0x07a0-0x07a7 */ 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, /* 0x07a8-0x07af */ 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, /* 0x07b0-0x07b7 */ 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07b8-0x07bf */ 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, /* 0x07c0-0x07c7 */ 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, /* 0x07c8-0x07cf */ 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, /* 0x07d0-0x07d7 */ 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07d8-0x07df */ 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, /* 0x07e0-0x07e7 */ 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, /* 0x07e8-0x07ef */ 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, /* 0x07f0-0x07f7 */ 0x03c8, 0x03c9 /* 0x07f8-0x07ff */ }; static unsigned short const keysym_to_unicode_8a4_8fe[] = { 0x2320, 0x2321, 0x0000, 0x231c, /* 0x08a0-0x08a7 */ 0x231d, 0x231e, 0x231f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08a8-0x08af */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08b0-0x08b7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222b, /* 0x08b8-0x08bf */ 0x2234, 0x0000, 0x221e, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, /* 0x08c0-0x08c7 */ 0x2245, 0x2246, 0x0000, 0x0000, 0x0000, 0x0000, 0x21d2, 0x0000, /* 0x08c8-0x08cf */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221a, 0x0000, /* 0x08d0-0x08d7 */ 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222a, 0x2227, 0x2228, /* 0x08d8-0x08df */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e0-0x08e7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, /* 0x08e8-0x08ef */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, /* 0x08f0-0x08f7 */ 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193 /* 0x08f8-0x08ff */ }; static unsigned short const keysym_to_unicode_9df_9f8[] = { 0x2422, /* 0x09d8-0x09df */ 0x2666, 0x25a6, 0x2409, 0x240c, 0x240d, 0x240a, 0x0000, 0x0000, /* 0x09e0-0x09e7 */ 0x240a, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x2500, /* 0x09e8-0x09ef */ 0x0000, 0x0000, 0x0000, 0x0000, 0x251c, 0x2524, 0x2534, 0x252c, /* 0x09f0-0x09f7 */ 0x2502 /* 0x09f8-0x09ff */ }; static unsigned short const keysym_to_unicode_aa1_afe[] = { 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, /* 0x0aa0-0x0aa7 */ 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, /* 0x0aa8-0x0aaf */ 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, /* 0x0ab0-0x0ab7 */ 0x2105, 0x0000, 0x0000, 0x2012, 0x2039, 0x2024, 0x203a, 0x0000, /* 0x0ab8-0x0abf */ 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, /* 0x0ac0-0x0ac7 */ 0x0000, 0x2122, 0x2120, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25ad, /* 0x0ac8-0x0acf */ 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x2030, 0x2032, 0x2033, /* 0x0ad0-0x0ad7 */ 0x0000, 0x271d, 0x0000, 0x220e, 0x25c2, 0x2023, 0x25cf, 0x25ac, /* 0x0ad8-0x0adf */ 0x25e6, 0x25ab, 0x25ae, 0x25b5, 0x25bf, 0x2606, 0x2022, 0x25aa, /* 0x0ae0-0x0ae7 */ 0x25b4, 0x25be, 0x261a, 0x261b, 0x2663, 0x2666, 0x2665, 0x0000, /* 0x0ae8-0x0aef */ 0x2720, 0x2020, 0x2021, 0x2713, 0x2612, 0x266f, 0x266d, 0x2642, /* 0x0af0-0x0af7 */ 0x2640, 0x2121, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e /* 0x0af8-0x0aff */ }; /* none of the APL keysyms match the Unicode characters */ static unsigned short const keysym_to_unicode_cdf_cfa[] = { 0x2017, /* 0x0cd8-0x0cdf */ 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, /* 0x0ce0-0x0ce7 */ 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, /* 0x0ce8-0x0cef */ 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, /* 0x0cf0-0x0cf7 */ 0x05e8, 0x05e9, 0x05ea /* 0x0cf8-0x0cff */ }; static unsigned short const keysym_to_unicode_da1_df9[] = { 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, /* 0x0da0-0x0da7 */ 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, /* 0x0da8-0x0daf */ 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, /* 0x0db0-0x0db7 */ 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, /* 0x0db8-0x0dbf */ 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, /* 0x0dc0-0x0dc7 */ 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, /* 0x0dc8-0x0dcf */ 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, /* 0x0dd0-0x0dd7 */ 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0e3e, 0x0e3f, /* 0x0dd8-0x0ddf */ 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, /* 0x0de0-0x0de7 */ 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0000, 0x0000, /* 0x0de8-0x0def */ 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, /* 0x0df0-0x0df7 */ 0x0e58, 0x0e59 /* 0x0df8-0x0dff */ }; static unsigned short const keysym_to_unicode_ea0_eff[] = { 0x0000, 0x1101, 0x1101, 0x11aa, 0x1102, 0x11ac, 0x11ad, 0x1103, /* 0x0ea0-0x0ea7 */ 0x1104, 0x1105, 0x11b0, 0x11b1, 0x11b2, 0x11b3, 0x11b4, 0x11b5, /* 0x0ea8-0x0eaf */ 0x11b6, 0x1106, 0x1107, 0x1108, 0x11b9, 0x1109, 0x110a, 0x110b, /* 0x0eb0-0x0eb7 */ 0x110c, 0x110d, 0x110e, 0x110f, 0x1110, 0x1111, 0x1112, 0x1161, /* 0x0eb8-0x0ebf */ 0x1162, 0x1163, 0x1164, 0x1165, 0x1166, 0x1167, 0x1168, 0x1169, /* 0x0ec0-0x0ec7 */ 0x116a, 0x116b, 0x116c, 0x116d, 0x116e, 0x116f, 0x1170, 0x1171, /* 0x0ec8-0x0ecf */ 0x1172, 0x1173, 0x1174, 0x1175, 0x11a8, 0x11a9, 0x11aa, 0x11ab, /* 0x0ed0-0x0ed7 */ 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, /* 0x0ed8-0x0edf */ 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, /* 0x0ee0-0x0ee7 */ 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x0000, /* 0x0ee8-0x0eef */ 0x0000, 0x0000, 0x1140, 0x0000, 0x0000, 0x1159, 0x119e, 0x0000, /* 0x0ef0-0x0ef7 */ 0x11eb, 0x0000, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9, /* 0x0ef8-0x0eff */ }; static unsigned short keysym_to_unicode_12a1_12fe[] = { 0x1e02, 0x1e03, 0x0000, 0x0000, 0x0000, 0x1e0a, 0x0000, /* 0x12a0-0x12a7 */ 0x1e80, 0x0000, 0x1e82, 0x1e0b, 0x1ef2, 0x0000, 0x0000, 0x0000, /* 0x12a8-0x12af */ 0x1e1e, 0x1e1f, 0x0000, 0x0000, 0x1e40, 0x1e41, 0x0000, 0x1e56, /* 0x12b0-0x12b7 */ 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, /* 0x12b8-0x12bf */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c0-0x12c7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c8-0x12cf */ 0x0174, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6a, /* 0x12d0-0x12d7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0176, 0x0000, /* 0x12d8-0x12df */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e0-0x12e7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e8-0x12ef */ 0x0175, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6b, /* 0x12f0-0x12f7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0177 /* 0x12f0-0x12ff */ }; static unsigned short const keysym_to_unicode_13bc_13be[] = { 0x0152, 0x0153, 0x0178 /* 0x13b8-0x13bf */ }; static unsigned short keysym_to_unicode_14a1_14ff[] = { 0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, /* 0x14a0-0x14a7 */ 0x2014, 0x002e, 0x055d, 0x002c, 0x2013, 0x058a, 0x2026, 0x055c, /* 0x14a8-0x14af */ 0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, /* 0x14b0-0x14b7 */ 0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, /* 0x14b8-0x14bf */ 0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, /* 0x14c0-0x14c7 */ 0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, /* 0x14c8-0x14cf */ 0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, /* 0x14d0-0x14d7 */ 0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, /* 0x14d8-0x14df */ 0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, /* 0x14e0-0x14e7 */ 0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, /* 0x14e8-0x14ef */ 0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, /* 0x14f0-0x14f7 */ 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x2019, 0x0027, /* 0x14f8-0x14ff */ }; static unsigned short keysym_to_unicode_15d0_15f6[] = { 0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10d7, /* 0x15d0-0x15d7 */ 0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10dd, 0x10de, 0x10df, /* 0x15d8-0x15df */ 0x10e0, 0x10e1, 0x10e2, 0x10e3, 0x10e4, 0x10e5, 0x10e6, 0x10e7, /* 0x15e0-0x15e7 */ 0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x10ee, 0x10ef, /* 0x15e8-0x15ef */ 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6 /* 0x15f0-0x15f7 */ }; static unsigned short keysym_to_unicode_16a0_16f6[] = { 0x0000, 0x0000, 0xf0a2, 0x1e8a, 0x0000, 0xf0a5, 0x012c, 0xf0a7, /* 0x16a0-0x16a7 */ 0xf0a8, 0x01b5, 0x01e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x019f, /* 0x16a8-0x16af */ 0x0000, 0x0000, 0xf0b2, 0x1e8b, 0x01d1, 0xf0b5, 0x012d, 0xf0b7, /* 0x16b0-0x16b7 */ 0xf0b8, 0x01b6, 0x01e7, 0x0000, 0x0000, 0x01d2, 0x0000, 0x0275, /* 0x16b8-0x16bf */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x018f, 0x0000, /* 0x16c0-0x16c7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16c8-0x16cf */ 0x0000, 0x1e36, 0xf0d2, 0xf0d3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d0-0x16d7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d8-0x16df */ 0x0000, 0x1e37, 0xf0e2, 0xf0e3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e0-0x16e7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e8-0x16ef */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0259 /* 0x16f0-0x16f6 */ }; static unsigned short const keysym_to_unicode_1e9f_1eff[] = { 0x0303, 0x1ea0, 0x1ea1, 0x1ea2, 0x1ea3, 0x1ea4, 0x1ea5, 0x1ea6, 0x1ea7, /* 0x1ea0-0x1ea7 */ 0x1ea8, 0x1ea9, 0x1eaa, 0x1eab, 0x1eac, 0x1ead, 0x1eae, 0x1eaf, /* 0x1ea8-0x1eaf */ 0x1eb0, 0x1eb1, 0x1eb2, 0x1eb3, 0x1eb4, 0x1eb5, 0x1eb6, 0x1eb7, /* 0x1eb0-0x1eb7 */ 0x1eb8, 0x1eb9, 0x1eba, 0x1ebb, 0x1ebc, 0x1ebd, 0x1ebe, 0x1ebf, /* 0x1eb8-0x1ebf */ 0x1ec0, 0x1ec1, 0x1ec2, 0x1ec3, 0x1ec4, 0x1ec5, 0x1ec6, 0x1ec7, /* 0x1ec0-0x1ec7 */ 0x1ec8, 0x1ec9, 0x1eca, 0x1ecb, 0x1ecc, 0x1ecd, 0x1ece, 0x1ecf, /* 0x1ec8-0x1ecf */ 0x1ed0, 0x1ed1, 0x1ed2, 0x1ed3, 0x1ed4, 0x1ed5, 0x1ed6, 0x1ed7, /* 0x1ed0-0x1ed7 */ 0x1ed8, 0x1ed9, 0x1eda, 0x1edb, 0x1edc, 0x1edd, 0x1ede, 0x1edf, /* 0x1ed8-0x1edf */ 0x1ee0, 0x1ee1, 0x1ee2, 0x1ee3, 0x1ee4, 0x1ee5, 0x1ee6, 0x1ee7, /* 0x1ee0-0x1ee7 */ 0x1ee8, 0x1ee9, 0x1eea, 0x1eeb, 0x1eec, 0x1eed, 0x1eee, 0x1eef, /* 0x1ee8-0x1eef */ 0x1ef0, 0x1ef1, 0x0300, 0x0301, 0x1ef4, 0x1ef5, 0x1ef6, 0x1ef7, /* 0x1ef0-0x1ef7 */ 0x1ef8, 0x1ef9, 0x01a0, 0x01a1, 0x01af, 0x01b0, 0x0309, 0x0323 /* 0x1ef8-0x1eff */ }; static unsigned short const keysym_to_unicode_20a0_20ac[] = { 0x20a0, 0x20a1, 0x20a2, 0x20a3, 0x20a4, 0x20a5, 0x20a6, 0x20a7, /* 0x20a0-0x20a7 */ 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */ }; unsigned int KeySymToUcs4(KeySym keysym) { /* 'Unicode keysym' */ if ((keysym & 0xff000000) == 0x01000000) return (keysym & 0x00ffffff); if (keysym > 0 && keysym < 0x100) return keysym; else if (keysym > 0x1a0 && keysym < 0x200) return keysym_to_unicode_1a1_1ff[keysym - 0x1a1]; else if (keysym > 0x2a0 && keysym < 0x2ff) return keysym_to_unicode_2a1_2fe[keysym - 0x2a1]; else if (keysym > 0x3a1 && keysym < 0x3ff) return keysym_to_unicode_3a2_3fe[keysym - 0x3a2]; else if (keysym > 0x4a0 && keysym < 0x4e0) return keysym_to_unicode_4a1_4df[keysym - 0x4a1]; else if (keysym > 0x589 && keysym < 0x5ff) return keysym_to_unicode_590_5fe[keysym - 0x590]; else if (keysym > 0x67f && keysym < 0x700) return keysym_to_unicode_680_6ff[keysym - 0x680]; else if (keysym > 0x7a0 && keysym < 0x7fa) return keysym_to_unicode_7a1_7f9[keysym - 0x7a1]; else if (keysym > 0x8a3 && keysym < 0x8ff) return keysym_to_unicode_8a4_8fe[keysym - 0x8a4]; else if (keysym > 0x9de && keysym < 0x9f9) return keysym_to_unicode_9df_9f8[keysym - 0x9df]; else if (keysym > 0xaa0 && keysym < 0xaff) return keysym_to_unicode_aa1_afe[keysym - 0xaa1]; else if (keysym > 0xcde && keysym < 0xcfb) return keysym_to_unicode_cdf_cfa[keysym - 0xcdf]; else if (keysym > 0xda0 && keysym < 0xdfa) return keysym_to_unicode_da1_df9[keysym - 0xda1]; else if (keysym > 0xe9f && keysym < 0xf00) return keysym_to_unicode_ea0_eff[keysym - 0xea0]; else if (keysym > 0x12a0 && keysym < 0x12ff) return keysym_to_unicode_12a1_12fe[keysym - 0x12a1]; else if (keysym > 0x13bb && keysym < 0x13bf) return keysym_to_unicode_13bc_13be[keysym - 0x13bc]; else if (keysym > 0x14a0 && keysym < 0x1500) return keysym_to_unicode_14a1_14ff[keysym - 0x14a1]; else if (keysym > 0x15cf && keysym < 0x15f7) return keysym_to_unicode_15d0_15f6[keysym - 0x15d0]; else if (keysym > 0x169f && keysym < 0x16f7) return keysym_to_unicode_16a0_16f6[keysym - 0x16a0]; else if (keysym > 0x1e9e && keysym < 0x1f00) return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f]; else if (keysym > 0x209f && keysym < 0x20ad) return keysym_to_unicode_20a0_20ac[keysym - 0x20a0]; else return 0; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/IMWrap.c0000644000000000000000000001343613614532331015610 0ustar /* * Copyright 1991 by the Open Software Foundation * Copyright 1993, 1994 by the Sony Corporation * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of Open Software Foundation and * Sony Corporation not be used in advertising or publicity pertaining to * distribution of the software without specific, written prior permission. * Open Software Foundation and Sony Corporation make no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. * * OPEN SOFTWARE FOUNDATION AND SONY CORPORATION DISCLAIM ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL OPEN * SOFTWARE FOUNDATIONN OR SONY CORPORATION BE LIABLE FOR ANY SPECIAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * M. Collins OSF * Makoto Wakamatsu Sony Corporation */ /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" /* * Compile the resource name. (resource_name ---> xrm_name) */ void _XIMCompileResourceList(XIMResourceList res, unsigned int num_res) { register unsigned int count; for (count = 0; count < num_res; res++, count++) { res->xrm_name = XrmStringToQuark(res->resource_name); } } void _XCopyToArg(XPointer src, XPointer *dst, unsigned int size) { if (!*dst) { union { long longval; #ifdef LONG64 int intval; #endif short shortval; char charval; char* charptr; XPointer ptr; } u; if (size <= sizeof(XPointer)) { memcpy((char *)&u, (char *)src, (int)size); if (size == sizeof(long)) *dst = (XPointer)u.longval; #ifdef LONG64 else if (size == sizeof(int)) *dst = (XPointer)(long)u.intval; #endif else if (size == sizeof(short)) *dst = (XPointer)(long)u.shortval; else if (size == sizeof(char)) *dst = (XPointer)(long)u.charval; else if (size == sizeof(char*)) *dst = (XPointer)u.charptr; else if (size == sizeof(XPointer)) *dst = (XPointer)u.ptr; else memcpy( (char*)dst, (char*)src, (int)size ); } else { memcpy( (char*)dst, (char*)src, (int)size ); } } else { memcpy( (char*)*dst, (char*)src, (int)size ); } } /* * Connects to an input method matching current locale specification, creates * a XIM object and return a pointer the newly created XIM back to the caller. */ XIM XOpenIM(Display *display, XrmDatabase rdb, char *res_name, char *res_class) { XLCd lcd = _XOpenLC( (char *)NULL ); if( !lcd ) return( (XIM)NULL ); return (*lcd->methods->open_im) (lcd, display, rdb, res_name, res_class); } /* * Close the connection to the input manager, and free the XIM structure */ Status XCloseIM(XIM im) { Status s; XIC ic; XLCd lcd = im->core.lcd; s = (im->methods->close) (im); for (ic = im->core.ic_chain; ic; ic = ic->core.next) ic->core.im = (XIM)NULL; Xfree (im); _XCloseLC (lcd); return (s); } /* * Return the Display associated with the input method. */ Display * XDisplayOfIM(XIM im) { return im->core.display; } /* * Return the Locale associated with the input method. */ char * XLocaleOfIM(XIM im) { return im->core.lcd->core->name; } /* * Register to a input method instantiation callback to prepare the * on-demand input method instantiation. */ Bool XRegisterIMInstantiateCallback( Display *display, XrmDatabase rdb, char *res_name, char *res_class, XIDProc callback, XPointer client_data) { XLCd lcd = _XOpenLC( (char *)NULL ); if( !lcd ) return( False ); return( (*lcd->methods->register_callback)( lcd, display, rdb, res_name, res_class, callback, client_data ) ); } /* * Unregister to a input method instantiation callback. */ Bool XUnregisterIMInstantiateCallback( Display *display, XrmDatabase rdb, char *res_name, char *res_class, XIDProc callback, XPointer client_data) { XLCd lcd = _XlcCurrentLC(); if( !lcd ) return( False ); if( lcd->methods->unregister_callback == NULL ) return( False ); return( (*lcd->methods->unregister_callback)( lcd, display, rdb, res_name, res_class, callback, client_data ) ); } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcCharSet.c0000644000000000000000000001505613614532331016321 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "XlcPublic.h" #include "XlcPubI.h" /* The list of all known XlcCharSets. They are identified by their name. */ typedef struct _XlcCharSetListRec { XlcCharSet charset; struct _XlcCharSetListRec *next; } XlcCharSetListRec, *XlcCharSetList; static XlcCharSetList charset_list = NULL; /* Returns the charset with the given name (including side suffix). Returns NULL if not found. */ XlcCharSet _XlcGetCharSet( const char *name) { XlcCharSetList list; XrmQuark xrm_name; xrm_name = XrmStringToQuark(name); for (list = charset_list; list; list = list->next) { if (xrm_name == list->charset->xrm_name) return (XlcCharSet) list->charset; } return (XlcCharSet) NULL; } /* Returns the charset with the given encoding (no side suffix) and responsible for at least the given side (XlcGL or XlcGR). Returns NULL if not found. */ XlcCharSet _XlcGetCharSetWithSide( const char *encoding_name, XlcSide side) { XlcCharSetList list; XrmQuark xrm_encoding_name; xrm_encoding_name = XrmStringToQuark(encoding_name); for (list = charset_list; list; list = list->next) { if (list->charset->xrm_encoding_name == xrm_encoding_name && (list->charset->side == XlcGLGR || list->charset->side == side)) return (XlcCharSet) list->charset; } return (XlcCharSet) NULL; } /* Registers an XlcCharSet in the list of character sets. Returns True if successful. */ Bool _XlcAddCharSet( XlcCharSet charset) { XlcCharSetList list; if (_XlcGetCharSet(charset->name)) return False; list = Xmalloc(sizeof(XlcCharSetListRec)); if (list == NULL) return False; list->charset = charset; list->next = charset_list; charset_list = list; return True; } /* List of resources for XlcCharSet. */ static XlcResource resources[] = { { XlcNName, NULLQUARK, sizeof(char *), XOffsetOf(XlcCharSetRec, name), XlcGetMask }, { XlcNEncodingName, NULLQUARK, sizeof(char *), XOffsetOf(XlcCharSetRec, encoding_name), XlcGetMask }, { XlcNSide, NULLQUARK, sizeof(XlcSide), XOffsetOf(XlcCharSetRec, side), XlcGetMask }, { XlcNCharSize, NULLQUARK, sizeof(int), XOffsetOf(XlcCharSetRec, char_size), XlcGetMask }, { XlcNSetSize, NULLQUARK, sizeof(int), XOffsetOf(XlcCharSetRec, set_size), XlcGetMask }, { XlcNControlSequence, NULLQUARK, sizeof(char *), XOffsetOf(XlcCharSetRec, ct_sequence), XlcGetMask } }; /* Retrieves a number of attributes of an XlcCharSet. Return NULL if successful, otherwise the name of the first argument specifiying a nonexistent attribute. */ static char * get_values( XlcCharSet charset, XlcArgList args, int num_args) { if (resources[0].xrm_name == NULLQUARK) _XlcCompileResourceList(resources, XlcNumber(resources)); return _XlcGetValues((XPointer) charset, resources, XlcNumber(resources), args, num_args, XlcGetMask); } /* Retrieves a number of attributes of an XlcCharSet. Return NULL if successful, otherwise the name of the first argument specifiying a nonexistent attribute. */ char * _XlcGetCSValues(XlcCharSet charset, ...) { va_list var; XlcArgList args; char *ret; int num_args; va_start(var, charset); _XlcCountVaList(var, &num_args); va_end(var); va_start(var, charset); _XlcVaToArgList(var, num_args, &args); va_end(var); if (args == (XlcArgList) NULL) return (char *) NULL; ret = get_values(charset, args, num_args); Xfree(args); return ret; } /* Creates a new XlcCharSet, given its name (including side suffix) and Compound Text ESC sequence (normally at most 4 bytes). */ XlcCharSet _XlcCreateDefaultCharSet( const char *name, const char *ct_sequence) { XlcCharSet charset; int name_len, ct_sequence_len; const char *colon; char *tmp; charset = Xcalloc(1, sizeof(XlcCharSetRec)); if (charset == NULL) return (XlcCharSet) NULL; name_len = strlen(name); ct_sequence_len = strlen(ct_sequence); /* Fill in name and xrm_name. */ tmp = Xmalloc(name_len + 1 + ct_sequence_len + 1); if (tmp == NULL) { Xfree(charset); return (XlcCharSet) NULL; } memcpy(tmp, name, name_len+1); charset->name = tmp; charset->xrm_name = XrmStringToQuark(charset->name); /* Fill in encoding_name and xrm_encoding_name. */ if ((colon = strchr(charset->name, ':')) != NULL) { unsigned int length = colon - charset->name; char *encoding_tmp = Xmalloc(length + 1); if (encoding_tmp == NULL) { Xfree((char *) charset->name); Xfree(charset); return (XlcCharSet) NULL; } memcpy(encoding_tmp, charset->name, length); encoding_tmp[length] = '\0'; charset->encoding_name = encoding_tmp; charset->xrm_encoding_name = XrmStringToQuark(charset->encoding_name); } else { charset->encoding_name = charset->name; charset->xrm_encoding_name = charset->xrm_name; } /* Fill in ct_sequence. */ tmp += name_len + 1; memcpy(tmp, ct_sequence, ct_sequence_len+1); charset->ct_sequence = tmp; /* Fill in side, char_size, set_size. */ if (!_XlcParseCharSet(charset)) /* If ct_sequence is not usable in Compound Text, remove it. */ charset->ct_sequence = ""; return (XlcCharSet) charset; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcConv.c0000644000000000000000000001736113614532331015676 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XlcPubI.h" #include typedef struct _XlcConverterListRec { XLCd from_lcd; const char *from; XrmQuark from_type; XLCd to_lcd; const char *to; XrmQuark to_type; XlcOpenConverterProc converter; struct _XlcConverterListRec *next; } XlcConverterListRec, *XlcConverterList; static XlcConverterList conv_list = NULL; static void close_converter( XlcConv conv) { (*conv->methods->close)(conv); } static XlcConv get_converter( XLCd from_lcd, XrmQuark from_type, XLCd to_lcd, XrmQuark to_type) { XlcConverterList list, prev = NULL; for (list = conv_list; list; list = list->next) { if (list->from_lcd == from_lcd && list->to_lcd == to_lcd && list->from_type == from_type && list->to_type == to_type) { if (prev && prev != conv_list) { /* XXX */ prev->next = list->next; list->next = conv_list; conv_list = list; } return (*list->converter)(from_lcd, list->from, to_lcd, list->to); } prev = list; } return (XlcConv) NULL; } Bool _XlcSetConverter( XLCd from_lcd, const char *from, XLCd to_lcd, const char *to, XlcOpenConverterProc converter) { XlcConverterList list; XrmQuark from_type, to_type; from_type = XrmStringToQuark(from); to_type = XrmStringToQuark(to); for (list = conv_list; list; list = list->next) { if (list->from_lcd == from_lcd && list->to_lcd == to_lcd && list->from_type == from_type && list->to_type == to_type) { list->converter = converter; return True; } } list = Xmalloc(sizeof(XlcConverterListRec)); if (list == NULL) return False; list->from_lcd = from_lcd; list->from = from; list->from_type = from_type; list->to_lcd = to_lcd; list->to = to; list->to_type = to_type; list->converter = converter; list->next = conv_list; conv_list = list; return True; } typedef struct _ConvRec { XlcConv from_conv; XlcConv to_conv; } ConvRec, *Conv; static int indirect_convert( XlcConv lc_conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { Conv conv = (Conv) lc_conv->state; XlcConv from_conv = conv->from_conv; XlcConv to_conv = conv->to_conv; XlcCharSet charset; char buf[BUFSIZ], *cs; XPointer tmp_args[1]; int cs_left, ret, length, unconv_num = 0; if (from == NULL || *from == NULL) { if (from_conv->methods->reset) (*from_conv->methods->reset)(from_conv); if (to_conv->methods->reset) (*to_conv->methods->reset)(to_conv); return 0; } while (*from_left > 0) { cs = buf; cs_left = BUFSIZ; tmp_args[0] = (XPointer) &charset; ret = (*from_conv->methods->convert)(from_conv, from, from_left, &cs, &cs_left, tmp_args, 1); if (ret < 0) break; unconv_num += ret; length = cs - buf; if (length > 0) { cs_left = length; cs = buf; tmp_args[0] = (XPointer) charset; ret = (*to_conv->methods->convert)(to_conv, &cs, &cs_left, to, to_left, tmp_args, 1); if (ret < 0) { unconv_num += length / (charset->char_size > 0 ? charset->char_size : 1); continue; } unconv_num += ret; if (*to_left < 1) break; } } return unconv_num; } static void close_indirect_converter( XlcConv lc_conv) { Conv conv = (Conv) lc_conv->state; if (conv) { if (conv->from_conv) close_converter(conv->from_conv); if (conv->to_conv) close_converter(conv->to_conv); Xfree(conv); } Xfree(lc_conv); } static void reset_indirect_converter( XlcConv lc_conv) { Conv conv = (Conv) lc_conv->state; if (conv) { if (conv->from_conv && conv->from_conv->methods->reset) (*conv->from_conv->methods->reset)(conv->from_conv); if (conv->to_conv && conv->to_conv->methods->reset) (*conv->to_conv->methods->reset)(conv->to_conv); } } static XlcConvMethodsRec conv_methods = { close_indirect_converter, indirect_convert, reset_indirect_converter } ; static XlcConv open_indirect_converter( XLCd from_lcd, const char *from, XLCd to_lcd, const char *to) { XlcConv lc_conv, from_conv, to_conv; Conv conv; XrmQuark from_type, to_type; static XrmQuark QChar, QCharSet, QCTCharSet = (XrmQuark) 0; if (QCTCharSet == (XrmQuark) 0) { QCTCharSet = XrmStringToQuark(XlcNCTCharSet); QCharSet = XrmStringToQuark(XlcNCharSet); QChar = XrmStringToQuark(XlcNChar); } from_type = XrmStringToQuark(from); to_type = XrmStringToQuark(to); if (from_type == QCharSet || from_type == QChar || to_type == QCharSet || to_type == QChar) return (XlcConv) NULL; lc_conv = Xmalloc(sizeof(XlcConvRec)); if (lc_conv == NULL) return (XlcConv) NULL; lc_conv->methods = &conv_methods; lc_conv->state = Xcalloc(1, sizeof(ConvRec)); if (lc_conv->state == NULL) goto err; conv = (Conv) lc_conv->state; from_conv = get_converter(from_lcd, from_type, from_lcd, QCTCharSet); if (from_conv == NULL) from_conv = get_converter(from_lcd, from_type, from_lcd, QCharSet); if (from_conv == NULL) from_conv = get_converter((XLCd)NULL, from_type, (XLCd)NULL, QCharSet); if (from_conv == NULL) from_conv = get_converter(from_lcd, from_type, from_lcd, QChar); if (from_conv == NULL) goto err; conv->from_conv = from_conv; to_conv = get_converter(to_lcd, QCTCharSet, to_lcd, to_type); if (to_conv == NULL) to_conv = get_converter(to_lcd, QCharSet, to_lcd, to_type); if (to_conv == NULL) to_conv = get_converter((XLCd) NULL, QCharSet, (XLCd) NULL, to_type); if (to_conv == NULL) goto err; conv->to_conv = to_conv; return lc_conv; err: close_indirect_converter(lc_conv); return (XlcConv) NULL; } XlcConv _XlcOpenConverter( XLCd from_lcd, const char *from, XLCd to_lcd, const char *to) { XlcConv conv; XrmQuark from_type, to_type; from_type = XrmStringToQuark(from); to_type = XrmStringToQuark(to); if ((conv = get_converter(from_lcd, from_type, to_lcd, to_type))) return conv; return open_indirect_converter(from_lcd, from, to_lcd, to); } void _XlcCloseConverter( XlcConv conv) { close_converter(conv); } int _XlcConvert( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { return (*conv->methods->convert)(conv, from, from_left, to, to_left, args, num_args); } void _XlcResetConverter( XlcConv conv) { if (conv->methods->reset) (*conv->methods->reset)(conv); } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcCT.c0000644000000000000000000011716613614532331015303 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ /* * Copyright 1995 by FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. * * Modifier: Takanori Tateno FUJITSU LIMITED * */ /* * 2000 * Modifier: Ivan Pascal The XFree86 Project * Modifier: Bruno Haible The XFree86 Project */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XlcPubI.h" #include #include /* ====================== Built-in Character Sets ====================== */ /* * Static representation of a character set that can be used in Compound Text. */ typedef struct _CTDataRec { const char name[19]; const char ct_sequence[5]; /* Compound Text encoding, ESC sequence */ } CTDataRec, *CTData; static const CTDataRec default_ct_data[] = { /* */ /* X11 registry name MIME name ISO-IR ESC sequence */ /* */ /* Registered character sets with one byte per character */ { "ISO8859-1:GL", /* US-ASCII 6 */ "\033(B" }, { "ISO8859-1:GR", /* ISO-8859-1 100 */ "\033-A" }, { "ISO8859-2:GR", /* ISO-8859-2 101 */ "\033-B" }, { "ISO8859-3:GR", /* ISO-8859-3 109 */ "\033-C" }, { "ISO8859-4:GR", /* ISO-8859-4 110 */ "\033-D" }, { "ISO8859-5:GR", /* ISO-8859-5 144 */ "\033-L" }, { "ISO8859-6:GR", /* ISO-8859-6 127 */ "\033-G" }, { "ISO8859-7:GR", /* ISO-8859-7 126 */ "\033-F" }, { "ISO8859-8:GR", /* ISO-8859-8 138 */ "\033-H" }, { "ISO8859-9:GR", /* ISO-8859-9 148 */ "\033-M" }, { "ISO8859-10:GR", /* ISO-8859-10 157 */ "\033-V" }, { "ISO8859-11:GR", /* ISO-8859-11 166 */ "\033-T" }, { "ISO8859-13:GR", /* ISO-8859-13 179 */ "\033-Y" }, { "ISO8859-14:GR", /* ISO-8859-14 199 */ "\033-_" }, { "ISO8859-15:GR", /* ISO-8859-15 203 */ "\033-b" }, { "ISO8859-16:GR", /* ISO-8859-16 226 */ "\033-f" }, { "JISX0201.1976-0:GL", /* ISO-646-JP 14 */ "\033(J" }, { "JISX0201.1976-0:GR", "\033)I" }, #if 0 { "TIS620-0:GR", /* TIS-620 166 */ "\033-T" }, #endif /* Registered character sets with two byte per character */ { "GB2312.1980-0:GL", /* GB_2312-80 58 */ "\033$(A" }, { "GB2312.1980-0:GR", /* GB_2312-80 58 */ "\033$)A" }, { "JISX0208.1983-0:GL", /* JIS_X0208-1983 87 */ "\033$(B" }, { "JISX0208.1983-0:GR", /* JIS_X0208-1983 87 */ "\033$)B" }, { "JISX0208.1990-0:GL", /* JIS_X0208-1990 168 */ "\033$(B" }, { "JISX0208.1990-0:GR", /* JIS_X0208-1990 168 */ "\033$)B" }, { "JISX0212.1990-0:GL", /* JIS_X0212-1990 159 */ "\033$(D" }, { "JISX0212.1990-0:GR", /* JIS_X0212-1990 159 */ "\033$)D" }, { "KSC5601.1987-0:GL", /* KS_C_5601-1987 149 */ "\033$(C" }, { "KSC5601.1987-0:GR", /* KS_C_5601-1987 149 */ "\033$)C" }, { "CNS11643.1986-1:GL", /* CNS 11643-1992 pl.1 171 */ "\033$(G" }, { "CNS11643.1986-1:GR", /* CNS 11643-1992 pl.1 171 */ "\033$)G" }, { "CNS11643.1986-2:GL", /* CNS 11643-1992 pl.2 172 */ "\033$(H" }, { "CNS11643.1986-2:GR", /* CNS 11643-1992 pl.2 172 */ "\033$)H" }, { "CNS11643.1992-3:GL", /* CNS 11643-1992 pl.3 183 */ "\033$(I" }, { "CNS11643.1992-3:GR", /* CNS 11643-1992 pl.3 183 */ "\033$)I" }, { "CNS11643.1992-4:GL", /* CNS 11643-1992 pl.4 184 */ "\033$(J" }, { "CNS11643.1992-4:GR", /* CNS 11643-1992 pl.4 184 */ "\033$)J" }, { "CNS11643.1992-5:GL", /* CNS 11643-1992 pl.5 185 */ "\033$(K" }, { "CNS11643.1992-5:GR", /* CNS 11643-1992 pl.5 185 */ "\033$)K" }, { "CNS11643.1992-6:GL", /* CNS 11643-1992 pl.6 186 */ "\033$(L" }, { "CNS11643.1992-6:GR", /* CNS 11643-1992 pl.6 186 */ "\033$)L" }, { "CNS11643.1992-7:GL", /* CNS 11643-1992 pl.7 187 */ "\033$(M" }, { "CNS11643.1992-7:GR", /* CNS 11643-1992 pl.7 187 */ "\033$)M" }, /* Registered encodings with a varying number of bytes per character */ { "ISO10646-1", /* UTF-8 196 */ "\033%G" }, /* Encodings without ISO-IR assigned escape sequence must be defined in XLC_LOCALE files, using "\033%/1" or "\033%/2". */ /* Backward compatibility with XFree86 3.x */ #if 1 { "ISO8859-14:GR", "\033%/1" }, { "ISO8859-15:GR", "\033%/1" }, #endif /* For use by utf8 -> ctext */ { "BIG5-0:GLGR", "\033%/2"}, { "BIG5HKSCS-0:GLGR", "\033%/2"}, { "GBK-0:GLGR", "\033%/2"}, /* used by Emacs, but not backed by ISO-IR */ { "BIG5-E0:GL", "\033$(0" }, { "BIG5-E0:GR", "\033$)0" }, { "BIG5-E1:GL", "\033$(1" }, { "BIG5-E1:GR", "\033$)1" }, }; /* We represent UTF-8 as an XlcGLGR charset, not in extended segments. */ #define UTF8_IN_EXTSEQ 0 /* ======================= Parsing ESC Sequences ======================= */ #define XctC0 0x0000 #define XctHT 0x0009 #define XctNL 0x000a #define XctESC 0x001b #define XctGL 0x0020 #define XctC1 0x0080 #define XctCSI 0x009b #define XctGR 0x00a0 #define XctSTX 0x0002 #define XctCntrlFunc 0x0023 #define XctMB 0x0024 #define XctOtherCoding 0x0025 #define XctGL94 0x0028 #define XctGR94 0x0029 #define XctGR96 0x002d #define XctNonStandard 0x002f #define XctIgnoreExt 0x0030 #define XctNotIgnoreExt 0x0031 #define XctLeftToRight 0x0031 #define XctRightToLeft 0x0032 #define XctDirection 0x005d #define XctDirectionEnd 0x005d #define XctGL94MB 0x2428 #define XctGR94MB 0x2429 #define XctExtSeg 0x252f #define XctReturn 0x2540 /* * Parses the header of a Compound Text segment, i.e. the charset designator. * The string starts at *text and has *length bytes. * Return value is one of: * 0 (no valid charset designator), * XctGL94, XctGR94, XctGR96, XctGL94MB, XctGR94MB, * XctLeftToRight, XctRightToLeft, XctDirectionEnd, * XctExtSeg, XctOtherCoding, XctReturn, XctIgnoreExt, XctNotIgnoreExt. * If the return value is not 0, *text is incremented and *length decremented, * to point past the charset designator. If the return value is one of * XctGL94, XctGR94, XctGR96, XctGL94MB, XctGR94MB, * XctExtSeg, XctOtherCoding, XctIgnoreExt, XctNotIgnoreExt, * *final_byte is set to the "final byte" of the charset designator. */ static unsigned int _XlcParseCT( const char **text, int *length, unsigned char *final_byte) { unsigned int ret = 0; unsigned char ch; const unsigned char *str = (const unsigned char *) *text; *final_byte = 0; if (*length < 1) return 0; switch (ch = *str++) { case XctESC: if (*length < 2) return 0; switch (ch = *str++) { case XctOtherCoding: /* % */ if (*length < 3) return 0; ch = *str++; if (ch == XctNonStandard) { /* / */ if (*length < 4) return 0; ret = XctExtSeg; ch = *str++; } else if (ch == '@') { ret = XctReturn; } else { ret = XctOtherCoding; } *final_byte = ch; break; case XctCntrlFunc: /* # */ if (*length < 4) return 0; *final_byte = *str++; switch (*str++) { case XctIgnoreExt: /* 0 */ ret = XctIgnoreExt; break; case XctNotIgnoreExt: /* 1 */ ret = XctNotIgnoreExt; break; default: ret = 0; break; } break; case XctMB: /* $ */ if (*length < 4) return 0; ch = *str++; switch (ch) { case XctGL94: /* ( */ ret = XctGL94MB; break; case XctGR94: /* ) */ ret = XctGR94MB; break; default: ret = 0; break; } *final_byte = *str++; break; case XctGL94: /* ( */ if (*length < 3) return 0; ret = XctGL94; *final_byte = *str++; break; case XctGR94: /* ) */ if (*length < 3) return 0; ret = XctGR94; *final_byte = *str++; break; case XctGR96: /* - */ if (*length < 3) return 0; ret = XctGR96; *final_byte = *str++; break; } break; case XctCSI: /* direction */ if (*length < 2) return 0; switch (*str++) { case XctLeftToRight: if (*length < 3) return 0; if (*str++ == XctDirection) ret = XctLeftToRight; break; case XctRightToLeft: if (*length < 3) return 0; if (*str++ == XctDirection) ret = XctRightToLeft; break; case XctDirectionEnd: ret = XctDirectionEnd; break; } break; } if (ret) { *length -= (const char *) str - *text; *text = (const char *) str; } return ret; } /* * Fills into a freshly created XlcCharSet the fields that can be inferred * from the ESC sequence. These are side, char_size, set_size. * Returns True if the charset can be used with Compound Text. * * Used by _XlcCreateDefaultCharSet. */ Bool _XlcParseCharSet( XlcCharSet charset) { unsigned int type; unsigned char final_byte; const char *ptr = charset->ct_sequence; int length; int char_size; if (*ptr == '\0') return False; length = strlen(ptr); type = _XlcParseCT(&ptr, &length, &final_byte); /* Check for validity and determine char_size. char_size = 0 means varying number of bytes per character. */ switch (type) { case XctGL94: case XctGR94: case XctGR96: char_size = 1; break; case XctGL94MB: case XctGR94MB: char_size = (final_byte < 0x60 ? 2 : final_byte < 0x70 ? 3 : 4); break; case XctExtSeg: char_size = final_byte - '0'; if (!(char_size >= 0 && char_size <= 4)) return False; break; case XctOtherCoding: char_size = 0; break; default: return False; } charset->char_size = char_size; /* Fill in other values. */ switch (type) { case XctGL94: case XctGL94MB: charset->side = XlcGL; charset->set_size = 94; break; case XctGR94: case XctGR94MB: charset->side = XlcGR; charset->set_size = 94; break; case XctGR96: charset->side = XlcGR; charset->set_size = 96; break; case XctExtSeg: case XctOtherCoding: charset->side = XlcGLGR; charset->set_size = 0; break; } return True; } /* =============== Management of the List of Character Sets =============== */ /* * Representation of a character set that can be used for Compound Text, * at run time. * Note: This information is not contained in the XlcCharSet, because * multiple ESC sequences may be used for the same XlcCharSet. */ typedef struct _CTInfoRec { XlcCharSet charset; const char *ct_sequence; /* Compound Text ESC sequence */ unsigned int type; unsigned char final_byte; /* If type == XctExtSeg: */ const char *ext_segment; /* extended segment name, then '\002' */ int ext_segment_len; /* length of above, including final '\002' */ struct _CTInfoRec *next; } CTInfoRec, *CTInfo; /* * List of character sets that can be used for Compound Text, * Includes all that are listed in default_ct_data, but more can be added * at runtime through _XlcAddCT. */ static CTInfo ct_list = NULL; static CTInfo ct_list_end = NULL; /* * Returns a Compound Text info record for an ESC sequence. * The first part of the ESC sequence has already been parsed into 'type' * and 'final_byte'. The remainder starts at 'text', at least 'text_len' * bytes (only used if type == XctExtSeg). */ static CTInfo _XlcGetCTInfo( unsigned int type, unsigned char final_byte, const char *text, int text_len) { CTInfo ct_info; for (ct_info = ct_list; ct_info; ct_info = ct_info->next) if (ct_info->type == type && ct_info->final_byte == final_byte && (type != XctExtSeg || (text_len >= ct_info->ext_segment_len && memcmp(text, ct_info->ext_segment, ct_info->ext_segment_len) == 0))) return ct_info; return (CTInfo) NULL; } /* Returns the Compound Text info for a given XlcCharSet. Returns NULL if none is found. */ static CTInfo _XlcGetCTInfoFromCharSet( XlcCharSet charset) { CTInfo ct_info; for (ct_info = ct_list; ct_info; ct_info = ct_info->next) if (ct_info->charset == charset) return ct_info; return (CTInfo) NULL; } /* Creates a new XlcCharSet, given its name (including side suffix) and Compound Text ESC sequence (normally at most 4 bytes), and makes it eligible for Compound Text processing. */ XlcCharSet _XlcAddCT( const char *name, const char *ct_sequence) { CTInfo ct_info, existing_info; XlcCharSet charset; const char *ct_ptr; int length; unsigned int type; unsigned char final_byte; charset = _XlcGetCharSet(name); if (charset != NULL) { /* Even if the charset already exists, it is OK to register a second Compound Text sequence for it. */ } else { /* Attempt to create the charset. */ charset = _XlcCreateDefaultCharSet(name, ct_sequence); if (charset == NULL) return (XlcCharSet) NULL; _XlcAddCharSet(charset); } /* Allocate a CTinfo record. */ length = strlen(ct_sequence); ct_info = Xmalloc(sizeof(CTInfoRec) + length+1); if (ct_info == NULL) return charset; ct_info->charset = charset; ct_info->ct_sequence = strcpy((char *) (ct_info + 1), ct_sequence); /* Parse the Compound Text sequence. */ ct_ptr = ct_sequence; type = _XlcParseCT(&ct_ptr, &length, &final_byte); ct_info->type = type; ct_info->final_byte = final_byte; switch (type) { case XctGL94: case XctGR94: case XctGR96: case XctGL94MB: case XctGR94MB: case XctOtherCoding: ct_info->ext_segment = NULL; ct_info->ext_segment_len = 0; break; case XctExtSeg: { /* By convention, the extended segment name is the encoding_name in lowercase. */ const char *q = charset->encoding_name; int n = strlen(q); char *p; /* Ensure ct_info->ext_segment_len <= 0x3fff - 6. */ if (n > 0x3fff - 6 - 1) { Xfree(ct_info); return charset; } p = Xmalloc(n+1); if (p == NULL) { Xfree(ct_info); return charset; } ct_info->ext_segment = p; ct_info->ext_segment_len = n+1; for ( ; n > 0; p++, q++, n--) *p = (*q >= 'A' && *q <= 'Z' ? *q - 'A' + 'a' : *q); *p = XctSTX; break; } default: Xfree(ct_info); return (XlcCharSet) NULL; } /* Insert it into the list, if not already present. */ existing_info = _XlcGetCTInfo(type, ct_info->final_byte, ct_info->ext_segment, ct_info->ext_segment_len); if (existing_info == NULL) { /* Insert it at the end. If there are duplicates CTinfo entries for the same XlcCharSet, we want the first (standard) one to override the second (user defined) one. */ ct_info->next = NULL; if (ct_list_end) ct_list_end->next = ct_info; else ct_list = ct_info; ct_list_end = ct_info; } else { if (existing_info->charset != charset /* We have a conflict, with one exception: JISX0208.1983-0 and JISX0208.1990-0 are the same for all practical purposes. */ && !(strncmp(existing_info->charset->name, "JISX0208", 8) == 0 && strncmp(charset->name, "JISX0208", 8) == 0)) { fprintf(stderr, "Xlib: charsets %s and %s have the same CT sequence\n", charset->name, existing_info->charset->name); if (strcmp(charset->ct_sequence, ct_sequence) == 0) charset->ct_sequence = ""; } Xfree(ct_info); } return charset; } /* ========== Converters String <--> CharSet <--> Compound Text ========== */ /* * Structure representing the parse state of a Compound Text string. */ typedef struct _StateRec { XlcCharSet charset; /* The charset of the current segment */ XlcCharSet GL_charset; /* The charset responsible for 0x00..0x7F */ XlcCharSet GR_charset; /* The charset responsible for 0x80..0xFF */ XlcCharSet Other_charset; /* != NULL if currently in an other segment */ int ext_seg_left; /* > 0 if currently in an extended segment */ } StateRec, *State; /* Subroutine for parsing an ESC sequence. */ typedef enum { resOK, /* Charset saved in 'state', sequence skipped */ resNotInList, /* Charset not found, sequence skipped */ resNotCTSeq /* EscSeq not recognized, pointers not changed */ } CheckResult; static CheckResult _XlcCheckCTSequence( State state, const char **ctext, int *ctext_len) { XlcCharSet charset; CTInfo ct_info; const char *tmp_ctext = *ctext; int tmp_ctext_len = *ctext_len; unsigned int type; unsigned char final_byte; int ext_seg_left = 0; /* Check for validity. */ type = _XlcParseCT(&tmp_ctext, &tmp_ctext_len, &final_byte); switch (type) { case XctGL94: case XctGR94: case XctGR96: case XctGL94MB: case XctGR94MB: case XctOtherCoding: *ctext = tmp_ctext; *ctext_len = tmp_ctext_len; break; case XctReturn: *ctext = tmp_ctext; *ctext_len = tmp_ctext_len; state->Other_charset = NULL; return resOK; case XctExtSeg: if (tmp_ctext_len > 2 && (tmp_ctext[0] & 0x80) && (tmp_ctext[0] & 0x80)) { unsigned int msb = tmp_ctext[0] & 0x7f; unsigned int lsb = tmp_ctext[1] & 0x7f; ext_seg_left = (msb << 7) + lsb; if (ext_seg_left <= tmp_ctext_len - 2) { *ctext = tmp_ctext + 2; *ctext_len = tmp_ctext_len - 2; break; } } return resNotCTSeq; default: return resNotCTSeq; } ct_info = _XlcGetCTInfo(type, final_byte, *ctext, ext_seg_left); if (ct_info) { charset = ct_info->charset; state->ext_seg_left = ext_seg_left; if (type == XctExtSeg) { state->charset = charset; /* Skip past the extended segment name and the separator. */ *ctext += ct_info->ext_segment_len; *ctext_len -= ct_info->ext_segment_len; state->ext_seg_left -= ct_info->ext_segment_len; } else if (type == XctOtherCoding) { state->Other_charset = charset; } else { if (charset->side == XlcGL) { state->GL_charset = charset; } else if (charset->side == XlcGR) { state->GR_charset = charset; } else { state->GL_charset = charset; state->GR_charset = charset; } } return resOK; } else { state->ext_seg_left = 0; if (type == XctExtSeg) { /* Skip the entire extended segment. */ *ctext += ext_seg_left; *ctext_len -= ext_seg_left; } return resNotInList; } } static void init_state( XlcConv conv) { State state = (State) conv->state; static XlcCharSet default_GL_charset = NULL; static XlcCharSet default_GR_charset = NULL; if (default_GL_charset == NULL) { default_GL_charset = _XlcGetCharSet("ISO8859-1:GL"); default_GR_charset = _XlcGetCharSet("ISO8859-1:GR"); } /* The initial state is ISO-8859-1 on both sides. */ state->GL_charset = state->charset = default_GL_charset; state->GR_charset = default_GR_charset; state->Other_charset = NULL; state->ext_seg_left = 0; } /* from XlcNCompoundText to XlcNCharSet */ static int cttocs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; XlcCharSet charset = NULL; const char *ctptr; char *bufptr; int ctext_len, buf_len; int unconv_num = 0; ctptr = (const char *) *from; bufptr = (char *) *to; ctext_len = *from_left; buf_len = *to_left; while (ctext_len > 0 && buf_len > 0) { if (state->ext_seg_left == 0) { /* Not in the middle of an extended segment; look at next byte. */ unsigned char ch = *ctptr; XlcCharSet ch_charset; if (ch == XctESC) { CheckResult ret = _XlcCheckCTSequence(state, &ctptr, &ctext_len); if (ret == resOK) /* state has been modified. */ continue; if (ret == resNotInList) { /* XXX Just continue with previous charset. */ unconv_num++; continue; } } else if (ch == XctCSI) { /* XXX Simply ignore the XctLeftToRight, XctRightToLeft, XctDirectionEnd sequences for the moment. */ unsigned char dummy; if (_XlcParseCT(&ctptr, &ctext_len, &dummy)) { unconv_num++; continue; } } /* Find the charset which is responsible for this byte. */ ch_charset = (state->Other_charset != NULL ? state->Other_charset : (ch & 0x80 ? state->GR_charset : state->GL_charset)); /* Set the charset of this run, or continue the current run, or stop the current run. */ if (charset) { if (charset != ch_charset) break; } else { state->charset = charset = ch_charset; } /* We don't want to split a character into multiple pieces. */ if (buf_len < 6) { if (charset->char_size > 0) { if (buf_len < charset->char_size) break; } else { /* char_size == 0 is tricky. The code here is good only for valid UTF-8 input. */ if (charset->ct_sequence[0] == XctESC && charset->ct_sequence[1] == XctOtherCoding && charset->ct_sequence[2] == 'G') { int char_size = (ch < 0xc0 ? 1 : ch < 0xe0 ? 2 : ch < 0xf0 ? 3 : ch < 0xf8 ? 4 : ch < 0xfc ? 5 : 6); if (buf_len < char_size) break; } } } *bufptr++ = *ctptr++; ctext_len--; buf_len--; } else { /* Copy as much as possible from the current extended segment to the buffer. */ int char_size; /* Set the charset of this run, or continue the current run, or stop the current run. */ if (charset) { if (charset != state->charset) break; } else { charset = state->charset; } char_size = charset->char_size; if (state->ext_seg_left <= buf_len || char_size > 0) { int n = (state->ext_seg_left <= buf_len ? state->ext_seg_left : (buf_len / char_size) * char_size); memcpy(bufptr, ctptr, n); ctptr += n; ctext_len -= n; bufptr += n; buf_len -= n; state->ext_seg_left -= n; } else { #if UTF8_IN_EXTSEQ /* char_size == 0 is tricky. The code here is good only for valid UTF-8 input. */ if (strcmp(charset->name, "ISO10646-1") == 0) { unsigned char ch = *ctptr; int char_size = (ch < 0xc0 ? 1 : ch < 0xe0 ? 2 : ch < 0xf0 ? 3 : ch < 0xf8 ? 4 : ch < 0xfc ? 5 : 6); int i; if (buf_len < char_size) break; /* A small loop is faster than calling memcpy. */ for (i = char_size; i > 0; i--) *bufptr++ = *ctptr++; ctext_len -= char_size; buf_len -= char_size; state->ext_seg_left -= char_size; } else #endif { /* Here ctext_len >= state->ext_seg_left > buf_len. We may be splitting a character into multiple pieces. Oh well. */ int n = buf_len; memcpy(bufptr, ctptr, n); ctptr += n; ctext_len -= n; bufptr += n; buf_len -= n; state->ext_seg_left -= n; } } } } /* 'charset' is the charset for the current run. In some cases, 'state->charset' contains the charset for the next run. Therefore, return 'charset'. 'charset' may still be NULL only if no output was produced. */ if (num_args > 0) *((XlcCharSet *) args[0]) = charset; *from_left -= ctptr - *((const char **) from); *from = (XPointer) ctptr; *to_left -= bufptr - *((char **) to); *to = (XPointer) bufptr; return unconv_num; } /* from XlcNCharSet to XlcNCompoundText */ static int cstoct( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; XlcSide side; unsigned char min_ch = 0, max_ch = 0; int length, unconv_num; CTInfo ct_info; XlcCharSet charset; const char *csptr; char *ctptr; int csstr_len, ct_len; char *ext_segment_start; int char_size; /* One argument is required, of type XlcCharSet. */ if (num_args < 1) return -1; csptr = *((const char **) from); ctptr = *((char **) to); csstr_len = *from_left; ct_len = *to_left; charset = (XlcCharSet) args[0]; ct_info = _XlcGetCTInfoFromCharSet(charset); if (ct_info == NULL) return -1; side = charset->side; length = strlen(ct_info->ct_sequence); ext_segment_start = NULL; if (ct_info->type == XctOtherCoding) { /* Output the Escape sequence for switching to the charset, and reserve room now for the XctReturn sequence at the end. */ if (ct_len < length + 3) return -1; memcpy(ctptr, ct_info->ct_sequence, length); ctptr += length; ct_len -= length + 3; } else /* Test whether the charset is already active. */ if (((side == XlcGR || side == XlcGLGR) && charset != state->GR_charset) || ((side == XlcGL || side == XlcGLGR) && charset != state->GL_charset)) { /* Output the Escape sequence for switching to the charset. */ if (ct_info->type == XctExtSeg) { if (ct_len < length + 2 + ct_info->ext_segment_len) return -1; memcpy(ctptr, ct_info->ct_sequence, length); ctptr += length; ct_len -= length; ctptr += 2; ct_len -= 2; ext_segment_start = ctptr; /* The size of an extended segment must fit in 14 bits. */ if (ct_len > 0x3fff) ct_len = 0x3fff; memcpy(ctptr, ct_info->ext_segment, ct_info->ext_segment_len); ctptr += ct_info->ext_segment_len; ct_len -= ct_info->ext_segment_len; } else { if (ct_len < length) return -1; memcpy(ctptr, ct_info->ct_sequence, length); ctptr += length; ct_len -= length; } } /* If the charset has side GL or GR, prepare remapping the characters to the correct side. */ if (charset->set_size) { min_ch = 0x20; max_ch = 0x7f; if (charset->set_size == 94) { max_ch--; if (charset->char_size > 1 || side == XlcGR) min_ch++; } } /* Actually copy the contents. */ unconv_num = 0; char_size = charset->char_size; if (char_size == 1) { while (csstr_len > 0 && ct_len > 0) { if (charset->set_size) { /* The CompoundText specification says that the only control characters allowed are 0x09, 0x0a, 0x1b, 0x9b. Therefore here we eliminate other control characters. */ unsigned char ch = *((const unsigned char *) csptr) & 0x7f; if (!((ch >= min_ch && ch <= max_ch) || (side == XlcGL && (ch == 0x00 || ch == 0x09 || ch == 0x0a)) || ((side == XlcGL || side == XlcGR) && (ch == 0x1b)))) { csptr++; csstr_len--; unconv_num++; continue; } } if (side == XlcGL) *ctptr++ = *csptr++ & 0x7f; else if (side == XlcGR) *ctptr++ = *csptr++ | 0x80; else *ctptr++ = *csptr++; csstr_len--; ct_len--; } } else if (char_size > 1) { while (csstr_len >= char_size && ct_len >= char_size) { if (side == XlcGL) { int i; for (i = char_size; i > 0; i--) *ctptr++ = *csptr++ & 0x7f; } else if (side == XlcGR) { int i; for (i = char_size; i > 0; i--) *ctptr++ = *csptr++ | 0x80; } else { int i; for (i = char_size; i > 0; i--) *ctptr++ = *csptr++; } csstr_len -= char_size; ct_len -= char_size; } } else { /* char_size = 0. The code here is good only for valid UTF-8 input. */ if ((charset->ct_sequence[0] == XctESC && charset->ct_sequence[1] == XctOtherCoding && charset->ct_sequence[2] == 'G') #if UTF8_IN_EXTSEQ || strcmp(charset->name, "ISO10646-1") == 0 #endif ) { while (csstr_len > 0 && ct_len > 0) { unsigned char ch = * (const unsigned char *) csptr; int ch_size = (ch < 0xc0 ? 1 : ch < 0xe0 ? 2 : ch < 0xf0 ? 3 : ch < 0xf8 ? 4 : ch < 0xfc ? 5 : 6); int i; if (!(csstr_len >= ch_size && ct_len >= ch_size)) break; for (i = ch_size; i > 0; i--) *ctptr++ = *csptr++; csstr_len -= ch_size; ct_len -= ch_size; } } else { while (csstr_len > 0 && ct_len > 0) { *ctptr++ = *csptr++; csstr_len--; ct_len--; } } } if (ct_info->type == XctOtherCoding) { /* Terminate with an XctReturn sequence. */ ctptr[0] = XctESC; ctptr[1] = XctOtherCoding; ctptr[2] = '@'; ctptr += 3; } else if (ext_segment_start != NULL) { /* Backpatch the extended segment's length. */ int ext_segment_length = ctptr - ext_segment_start; *(ext_segment_start - 2) = (ext_segment_length >> 7) | 0x80; *(ext_segment_start - 1) = (ext_segment_length & 0x7f) | 0x80; } else { if (side == XlcGR || side == XlcGLGR) state->GR_charset = charset; if (side == XlcGL || side == XlcGLGR) state->GL_charset = charset; } *from_left -= csptr - *((const char **) from); *from = (XPointer) csptr; *to_left -= ctptr - *((char **) to); *to = (XPointer) ctptr; return 0; } /* from XlcNString to XlcNCharSet */ static int strtocs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; const char *src; char *dst; unsigned char side; int length; src = (const char *) *from; dst = (char *) *to; length = min(*from_left, *to_left); side = *((const unsigned char *) src) & 0x80; while (side == (*((const unsigned char *) src) & 0x80) && length-- > 0) *dst++ = *src++; *from_left -= src - (const char *) *from; *from = (XPointer) src; *to_left -= dst - (char *) *to; *to = (XPointer) dst; if (num_args > 0) *((XlcCharSet *)args[0]) = (side ? state->GR_charset : state->GL_charset); return 0; } /* from XlcNCharSet to XlcNString */ static int cstostr( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { State state = (State) conv->state; const char *csptr; char *string_ptr; int csstr_len, str_len; unsigned char ch; int unconv_num = 0; /* This converter can only convert from ISO8859-1:GL and ISO8859-1:GR. */ if (num_args < 1 || !((XlcCharSet) args[0] == state->GL_charset || (XlcCharSet) args[0] == state->GR_charset)) return -1; csptr = *((const char **) from); string_ptr = *((char **) to); csstr_len = *from_left; str_len = *to_left; while (csstr_len > 0 && str_len > 0) { ch = *((const unsigned char *) csptr++); csstr_len--; /* Citing ICCCM: "STRING as a type specifies the ISO Latin-1 character set plus the control characters TAB and NEWLINE." */ if ((ch < 0x20 && ch != 0x00 && ch != 0x09 && ch != 0x0a) || (ch >= 0x7f && ch < 0xa0)) { unconv_num++; continue; } *((unsigned char *) string_ptr++) = ch; str_len--; } *from_left -= csptr - *((const char **) from); *from = (XPointer) csptr; *to_left -= string_ptr - *((char **) to); *to = (XPointer) string_ptr; return unconv_num; } static XlcConv create_conv( XlcConvMethods methods) { XlcConv conv; conv = Xmalloc(sizeof(XlcConvRec) + sizeof(StateRec)); if (conv == NULL) return (XlcConv) NULL; conv->state = (XPointer) &conv[1]; conv->methods = methods; init_state(conv); return conv; } static void close_converter( XlcConv conv) { /* conv->state is allocated together with conv, free both at once. */ Xfree(conv); } static XlcConvMethodsRec cttocs_methods = { close_converter, cttocs, init_state }; static XlcConv open_cttocs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(&cttocs_methods); } static XlcConvMethodsRec cstoct_methods = { close_converter, cstoct, init_state }; static XlcConv open_cstoct( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(&cstoct_methods); } static XlcConvMethodsRec strtocs_methods = { close_converter, strtocs, init_state }; static XlcConv open_strtocs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(&strtocs_methods); } static XlcConvMethodsRec cstostr_methods = { close_converter, cstostr, init_state }; static XlcConv open_cstostr( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(&cstostr_methods); } /* =========================== Initialization =========================== */ Bool _XlcInitCTInfo(void) { if (ct_list == NULL) { const CTDataRec *ct_data; int num; XlcCharSet charset; /* Initialize ct_list. */ num = sizeof(default_ct_data) / sizeof(CTDataRec); for (ct_data = default_ct_data; num > 0; ct_data++, num--) { charset = _XlcAddCT(ct_data->name, ct_data->ct_sequence); if (charset == NULL) continue; if (strncmp(charset->ct_sequence, "\x1b\x25\x2f", 3) != 0) charset->source = CSsrcStd; else charset->source = CSsrcXLC; } /* Register CompoundText and CharSet converters. */ _XlcSetConverter((XLCd) NULL, XlcNCompoundText, (XLCd) NULL, XlcNCharSet, open_cttocs); _XlcSetConverter((XLCd) NULL, XlcNString, (XLCd) NULL, XlcNCharSet, open_strtocs); _XlcSetConverter((XLCd) NULL, XlcNCharSet, (XLCd) NULL, XlcNCompoundText, open_cstoct); _XlcSetConverter((XLCd) NULL, XlcNCharSet, (XLCd) NULL, XlcNString, open_cstostr); } return True; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcDB.c0000644000000000000000000007002313614532331015250 0ustar /* * * Copyright IBM Corporation 1993 * * All Rights Reserved * * License to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and that * both that copyright notice and this permission notice appear in * supporting documentation, and that the name of IBM not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. * * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND * NONINFRINGEMENT OF THIRD PARTY RIGHTS, IN NO EVENT SHALL * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * */ /* * (c) Copyright 1995 FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. */ #ifndef NOT_X_ENV #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Xlibint.h" #include "XlcPubI.h" #else /* NOT_X_ENV */ #define Xmalloc malloc #define Xrealloc realloc #define Xfree free #endif /* NOT_X_ENV */ /* specifying NOT_X_ENV allows users to just use the database parsing routine. */ /* For UDC/VW */ #ifndef BUFSIZE #define BUFSIZE 2048 #endif #ifdef COMMENT #ifdef BUFSIZE #undef BUFSIZE #endif #define BUFSIZE 6144 /* 2048*3 */ #endif #include typedef struct _DatabaseRec { char *category; char *name; char **value; int value_num; struct _DatabaseRec *next; } DatabaseRec, *Database; typedef enum { S_NULL, /* outside category */ S_CATEGORY, /* inside category */ S_NAME, /* has name, expecting values */ S_VALUE } ParseState; typedef enum { T_NEWLINE, T_COMMENT, T_SEMICOLON, T_DOUBLE_QUOTE, T_LEFT_BRACE, T_RIGHT_BRACE, T_SPACE, T_TAB, T_BACKSLASH, T_NUMERIC_HEX, T_NUMERIC_DEC, T_NUMERIC_OCT, T_DEFAULT } Token; typedef struct { Token token; /* token id */ int len; /* length of token sequence */ } TokenTable; static int f_newline (const char *str, Token token, Database *db); static int f_comment (const char *str, Token token, Database *db); static int f_semicolon (const char *str, Token token, Database *db); static int f_double_quote (const char *str, Token token, Database *db); static int f_left_brace (const char *str, Token token, Database *db); static int f_right_brace (const char *str, Token token, Database *db); static int f_white (const char *str, Token token, Database *db); static int f_backslash (const char *str, Token token, Database *db); static int f_numeric (const char *str, Token token, Database *db); static int f_default (const char *str, Token token, Database *db); static const TokenTable token_tbl[] = { { T_NEWLINE, 1 }, { T_COMMENT, 1 }, { T_SEMICOLON, 1 }, { T_DOUBLE_QUOTE, 1 }, { T_LEFT_BRACE, 1 }, { T_RIGHT_BRACE, 1 }, { T_SPACE, 1 }, { T_TAB, 1 }, { T_BACKSLASH, 1 }, { T_NUMERIC_HEX, 2 }, { T_NUMERIC_DEC, 2 }, { T_NUMERIC_OCT, 2 }, { T_DEFAULT, 1 } /* any character */ }; #define SYM_CR '\r' #define SYM_NEWLINE '\n' #define SYM_COMMENT '#' #define SYM_SEMICOLON ';' #define SYM_DOUBLE_QUOTE '"' #define SYM_LEFT_BRACE '{' #define SYM_RIGHT_BRACE '}' #define SYM_SPACE ' ' #define SYM_TAB '\t' #define SYM_BACKSLASH '\\' /************************************************************************/ #define MAX_NAME_NEST 64 typedef struct { ParseState pre_state; char *category; char *name[MAX_NAME_NEST]; int nest_depth; char **value; int value_len; int value_num; int bufsize; /* bufMaxSize >= bufsize >= 0 */ int bufMaxSize; /* default : BUFSIZE */ char *buf; } DBParseInfo; static DBParseInfo parse_info; static void init_parse_info (void) { static int allocated /* = 0 */; char *ptr; int size; if (!allocated) { bzero(&parse_info, sizeof(DBParseInfo)); parse_info.buf = Xmalloc(BUFSIZE); parse_info.bufMaxSize = BUFSIZE; allocated = 1; return; } ptr = parse_info.buf; size = parse_info.bufMaxSize; bzero(&parse_info, sizeof(DBParseInfo)); parse_info.buf = ptr; parse_info.bufMaxSize = size; } static void clear_parse_info (void) { int i; char *ptr; int size; parse_info.pre_state = S_NULL; if (parse_info.category != NULL) { Xfree(parse_info.category); } for (i = 0; i <= parse_info.nest_depth; ++i) { if (parse_info.name[i]) { Xfree(parse_info.name[i]); } } if (parse_info.value) { if (*parse_info.value) { Xfree(*parse_info.value); } Xfree(parse_info.value); } ptr = parse_info.buf; size = parse_info.bufMaxSize; bzero(&parse_info, sizeof(DBParseInfo)); parse_info.buf = ptr; parse_info.bufMaxSize = size; } static Bool realloc_parse_info( int len) { char *p; int newsize = BUFSIZE * ((parse_info.bufsize + len)/BUFSIZE + 1); p = Xrealloc(parse_info.buf, newsize); if (p == NULL) return False; parse_info.bufMaxSize = newsize; parse_info.buf = p; return True; } /************************************************************************/ typedef struct _Line { char *str; int cursize; int maxsize; int seq; } Line; static void free_line( Line *line) { if (line->str != NULL) { Xfree(line->str); } bzero(line, sizeof(Line)); } static int realloc_line( Line *line, int size) { char *str = line->str; if (str != NULL) { str = Xrealloc(str, size); } else { str = Xmalloc(size); } if (str == NULL) { /* malloc error */ if (line->str != NULL) { Xfree(line->str); } bzero(line, sizeof(Line)); return 0; } line->str = str; line->maxsize = size; return 1; } #define iswhite(ch) ((ch) == SYM_SPACE || (ch) == SYM_TAB) static void zap_comment( char *str, int *quoted) { char *p = str; #ifdef never *quoted = 0; if (*p == SYM_COMMENT) { int len = strlen(str); if (p[len - 1] == SYM_NEWLINE || p[len - 1] == SYM_CR) { *p++ = SYM_NEWLINE; } *p = '\0'; } #else while (*p) { if (*p == SYM_DOUBLE_QUOTE) { if (p == str || p[-1] != SYM_BACKSLASH) { /* unescaped double quote changes quoted state. */ *quoted = *quoted ? 0 : 1; } } if (*p == SYM_COMMENT && !*quoted) { int pos = p - str; if (pos == 0 || (iswhite(p[-1]) && (pos == 1 || p[-2] != SYM_BACKSLASH))) { int len = strlen(p); if (len > 0 && (p[len - 1] == SYM_NEWLINE || p[len-1] == SYM_CR)) { /* newline is the identifier for finding end of value. therefore, it should not be removed. */ *p++ = SYM_NEWLINE; } *p = '\0'; break; } } ++p; } #endif } static int read_line( FILE *fd, Line *line) { char buf[BUFSIZE], *p; int len; int quoted = 0; /* quoted by double quote? */ char *str; int cur; str = line->str; cur = line->cursize = 0; while ((p = fgets(buf, BUFSIZE, fd)) != NULL) { ++line->seq; zap_comment(p, "ed); /* remove comment line */ len = strlen(p); if (len == 0) { if (cur > 0) { break; } continue; } if (cur + len + 1 > line->maxsize) { /* need to reallocate buffer. */ if (! realloc_line(line, line->maxsize + BUFSIZE)) { return -1; /* realloc error. */ } str = line->str; } strncpy(str + cur, p, len); cur += len; str[cur] = '\0'; if (!quoted && cur > 1 && str[cur - 2] == SYM_BACKSLASH && (str[cur - 1] == SYM_NEWLINE || str[cur-1] == SYM_CR)) { /* the line is ended backslash followed by newline. need to concatinate the next line. */ cur -= 2; str[cur] = '\0'; } else if (len < BUFSIZE - 1 || buf[len - 1] == SYM_NEWLINE || buf[len - 1] == SYM_CR) { /* the line is shorter than BUFSIZE. */ break; } } if (quoted) { /* error. still in quoted state. */ return -1; } return line->cursize = cur; } /************************************************************************/ static Token get_token( const char *str) { switch (*str) { case SYM_NEWLINE: case SYM_CR: return T_NEWLINE; case SYM_COMMENT: return T_COMMENT; case SYM_SEMICOLON: return T_SEMICOLON; case SYM_DOUBLE_QUOTE: return T_DOUBLE_QUOTE; case SYM_LEFT_BRACE: return T_LEFT_BRACE; case SYM_RIGHT_BRACE: return T_RIGHT_BRACE; case SYM_SPACE: return T_SPACE; case SYM_TAB: return T_TAB; case SYM_BACKSLASH: switch (str[1]) { case 'x': return T_NUMERIC_HEX; case 'd': return T_NUMERIC_DEC; case 'o': return T_NUMERIC_OCT; } return T_BACKSLASH; default: return T_DEFAULT; } } static int get_word( const char *str, char *word) { const char *p = str; char *w = word; Token token; int token_len; while (*p != '\0') { token = get_token(p); token_len = token_tbl[token].len; if (token == T_BACKSLASH) { p += token_len; if (*p == '\0') break; token = get_token(p); token_len = token_tbl[token].len; } else if (token != T_COMMENT && token != T_DEFAULT) { break; } strncpy(w, p, token_len); p += token_len; w += token_len; } *w = '\0'; return p - str; /* return number of scanned chars */ } static int get_quoted_word( const char *str, char *word) { const char *p = str; char *w = word; Token token; int token_len; if (*p == SYM_DOUBLE_QUOTE) { ++p; } while (*p != '\0') { token = get_token(p); token_len = token_tbl[token].len; if (token == T_DOUBLE_QUOTE) { p += token_len; goto found; } if (token == T_BACKSLASH) { p += token_len; if (*p == '\0') { break; } token = get_token(p); token_len = token_tbl[token].len; } strncpy(w, p, token_len); p += token_len; w += token_len; } /* error. cannot detect next double quote */ return 0; found:; *w = '\0'; return p - str; } /************************************************************************/ static int append_value_list (void) { char **value_list = parse_info.value; char *value; int value_num = parse_info.value_num; int value_len = parse_info.value_len; char *str = parse_info.buf; int len = parse_info.bufsize; char *p; if (len < 1) { return 1; /* return with no error */ } if (value_list == (char **)NULL) { value_list = Xmalloc(sizeof(char *) * 2); *value_list = NULL; } else { char **prev_list = value_list; value_list = (char **) Xrealloc(value_list, sizeof(char *) * (value_num + 2)); if (value_list == NULL) { Xfree(prev_list); } } if (value_list == (char **)NULL) goto err2; value = *value_list; if (value == NULL) { value = Xmalloc(value_len + len + 1); } else { char *prev_value = value; value = Xrealloc(value, value_len + len + 1); if (value == NULL) { Xfree(prev_value); } } if (value == NULL) { goto err1; } if (value != *value_list) { int i; ssize_t delta; delta = value - *value_list; *value_list = value; for (i = 1; i < value_num; ++i) { value_list[i] += delta; } } value_list[value_num] = p = &value[value_len]; value_list[value_num + 1] = NULL; strncpy(p, str, len); p[len] = 0; parse_info.value = value_list; parse_info.value_num = value_num + 1; parse_info.value_len = value_len + len + 1; parse_info.bufsize = 0; return 1; err1: if (value_list) { Xfree((char **)value_list); } if (value) { Xfree(value); } err2: parse_info.value = (char **)NULL; parse_info.value_num = 0; parse_info.value_len = 0; parse_info.bufsize = 0; return 0; } static int construct_name( char *name, int size) { int i; int len = 0; char *p = name; for (i = 0; i <= parse_info.nest_depth; ++i) { len += strlen(parse_info.name[i]) + 1; } if (len >= size) return 0; strcpy(p, parse_info.name[0]); p += strlen(parse_info.name[0]); for (i = 1; i <= parse_info.nest_depth; ++i) { *p++ = '.'; strcpy(p, parse_info.name[i]); p += strlen(parse_info.name[i]); } return *name != '\0'; } static int store_to_database( Database *db) { Database new = (Database)NULL; char name[BUFSIZE]; if (parse_info.pre_state == S_VALUE) { if (! append_value_list()) { goto err; } } if (parse_info.name[parse_info.nest_depth] == NULL) { goto err; } new = Xcalloc(1, sizeof(DatabaseRec)); if (new == (Database)NULL) { goto err; } new->category = strdup(parse_info.category); if (new->category == NULL) { goto err; } if (! construct_name(name, sizeof(name))) { goto err; } new->name = strdup(name); if (new->name == NULL) { goto err; } new->next = *db; new->value = parse_info.value; new->value_num = parse_info.value_num; *db = new; Xfree(parse_info.name[parse_info.nest_depth]); parse_info.name[parse_info.nest_depth] = NULL; parse_info.value = (char **)NULL; parse_info.value_num = 0; parse_info.value_len = 0; return 1; err: if (new) { if (new->category) { Xfree(new->category); } if (new->name) { Xfree(new->name); } Xfree(new); } if (parse_info.value) { if (*parse_info.value) { Xfree(*parse_info.value); } Xfree((char **)parse_info.value); parse_info.value = (char **)NULL; parse_info.value_num = 0; parse_info.value_len = 0; } return 0; } #define END_MARK "END" #define END_MARK_LEN 3 /*strlen(END_MARK)*/ static int check_category_end( const char *str) { const char *p; int len; p = str; if (strncmp(p, END_MARK, END_MARK_LEN)) { return 0; } p += END_MARK_LEN; while (iswhite(*p)) { ++p; } len = strlen(parse_info.category); if (strncmp(p, parse_info.category, len)) { return 0; } p += len; return p - str; } /************************************************************************/ static int f_newline( const char *str, Token token, Database *db) { switch (parse_info.pre_state) { case S_NULL: case S_CATEGORY: break; case S_NAME: return 0; /* no value */ case S_VALUE: if (!store_to_database(db)) return 0; parse_info.pre_state = S_CATEGORY; break; default: return 0; } return token_tbl[token].len; } static int f_comment( const char *str, Token token, Database *db) { /* NOTE: comment is already handled in read_line(), so this function is not necessary. */ const char *p = str; while (*p != SYM_NEWLINE && *p != SYM_CR && *p != '\0') { ++p; /* zap to the end of line */ } return p - str; } static int f_white( const char *str, Token token, Database *db) { const char *p = str; while (iswhite(*p)) { ++p; } return p - str; } static int f_semicolon( const char *str, Token token, Database *db) { switch (parse_info.pre_state) { case S_NULL: case S_CATEGORY: case S_NAME: return 0; case S_VALUE: if (! append_value_list()) return 0; parse_info.pre_state = S_VALUE; break; default: return 0; } return token_tbl[token].len; } static int f_left_brace( const char *str, Token token, Database *db) { switch (parse_info.pre_state) { case S_NULL: case S_CATEGORY: case S_VALUE: return 0; case S_NAME: if (parse_info.name[parse_info.nest_depth] == NULL || parse_info.nest_depth + 1 > MAX_NAME_NEST) return 0; ++parse_info.nest_depth; parse_info.pre_state = S_CATEGORY; break; default: return 0; } return token_tbl[token].len; } static int f_right_brace( const char *str, Token token, Database *db) { if (parse_info.nest_depth < 1) return 0; switch (parse_info.pre_state) { case S_NULL: case S_NAME: return 0; case S_VALUE: if (! store_to_database(db)) return 0; /* fall through - to next case */ case S_CATEGORY: if (parse_info.name[parse_info.nest_depth] != NULL) { Xfree(parse_info.name[parse_info.nest_depth]); parse_info.name[parse_info.nest_depth] = NULL; } --parse_info.nest_depth; parse_info.pre_state = S_CATEGORY; break; default: return 0; } return token_tbl[token].len; } static int f_double_quote( const char *str, Token token, Database *db) { char word[BUFSIZE]; char* wordp; int len; if ((len = strlen (str)) < sizeof word) wordp = word; else wordp = Xmalloc (len + 1); if (wordp == NULL) return 0; len = 0; switch (parse_info.pre_state) { case S_NULL: case S_CATEGORY: goto err; case S_NAME: case S_VALUE: len = get_quoted_word(str, wordp); if (len < 1) goto err; if ((parse_info.bufsize + (int)strlen(wordp) + 1) >= parse_info.bufMaxSize) { if (realloc_parse_info(strlen(wordp)+1) == False) { goto err; } } strcpy(&parse_info.buf[parse_info.bufsize], wordp); parse_info.bufsize += strlen(wordp); parse_info.pre_state = S_VALUE; break; default: goto err; } if (wordp != word) Xfree (wordp); return len; /* including length of token */ err: if (wordp != word) Xfree (wordp); return 0; } static int f_backslash( const char *str, Token token, Database *db) { return f_default(str, token, db); } static int f_numeric( const char *str, Token token, Database *db) { char word[BUFSIZE]; const char *p; char* wordp; int len; int token_len; if ((len = strlen (str)) < sizeof word) wordp = word; else wordp = Xmalloc (len + 1); if (wordp == NULL) return 0; switch (parse_info.pre_state) { case S_NULL: case S_CATEGORY: goto err; case S_NAME: case S_VALUE: token_len = token_tbl[token].len; p = str + token_len; len = get_word(p, wordp); if (len < 1) goto err; if ((parse_info.bufsize + token_len + (int)strlen(wordp) + 1) >= parse_info.bufMaxSize) { if (realloc_parse_info(token_len + strlen(wordp) + 1) == False) goto err; } strncpy(&parse_info.buf[parse_info.bufsize], str, token_len); strcpy(&parse_info.buf[parse_info.bufsize + token_len], wordp); parse_info.bufsize += token_len + strlen(wordp); parse_info.pre_state = S_VALUE; break; default: goto err; } if (wordp != word) Xfree (wordp); return len + token_len; err: if (wordp != word) Xfree (wordp); return 0; } static int f_default( const char *str, Token token, Database *db) { char word[BUFSIZE], *p; char* wordp; int len; if ((len = strlen (str)) < sizeof word) wordp = word; else wordp = Xmalloc (len + 1); if (wordp == NULL) return 0; len = get_word(str, wordp); if (len < 1) goto err; switch (parse_info.pre_state) { case S_NULL: if (parse_info.category != NULL) goto err; p = strdup(wordp); if (p == NULL) goto err; parse_info.category = p; parse_info.pre_state = S_CATEGORY; break; case S_CATEGORY: if (parse_info.nest_depth == 0) { if (check_category_end(str)) { /* end of category is detected. clear context and zap to end of this line */ clear_parse_info(); len = strlen(str); break; } } p = strdup(wordp); if (p == NULL) goto err; if (parse_info.name[parse_info.nest_depth] != NULL) { Xfree(parse_info.name[parse_info.nest_depth]); } parse_info.name[parse_info.nest_depth] = p; parse_info.pre_state = S_NAME; break; case S_NAME: case S_VALUE: if ((parse_info.bufsize + (int)strlen(wordp) + 1) >= parse_info.bufMaxSize) { if (realloc_parse_info(strlen(wordp) + 1) == False) goto err; } strcpy(&parse_info.buf[parse_info.bufsize], wordp); parse_info.bufsize += strlen(wordp); parse_info.pre_state = S_VALUE; break; default: goto err; } if (wordp != word) Xfree (wordp); return len; err: if (wordp != word) Xfree (wordp); return 0; } /************************************************************************/ #ifdef DEBUG static void PrintDatabase( Database db) { Database p = db; int i = 0, j; printf("***\n*** BEGIN Database\n***\n"); while (p) { printf("%3d: ", i++); printf("%s, %s, ", p->category, p->name); printf("\t[%d: ", p->value_num); for (j = 0; j < p->value_num; ++j) { printf("%s, ", p->value[j]); } printf("]\n"); p = p->next; } printf("***\n*** END Database\n***\n"); } #endif static void DestroyDatabase( Database db) { Database p = db; while (p) { if (p->category != NULL) { Xfree(p->category); } if (p->name != NULL) { Xfree(p->name); } if (p->value != (char **)NULL) { if (*p->value != NULL) { Xfree(*p->value); } Xfree(p->value); } db = p->next; Xfree(p); p = db; } } static int CountDatabase( Database db) { Database p = db; int cnt = 0; while (p) { ++cnt; p = p->next; } return cnt; } static Database CreateDatabase( char *dbfile) { Database db = (Database)NULL; FILE *fd; Line line; char *p; Token token; int len; int error = 0; fd = _XFopenFile(dbfile, "r"); if (fd == (FILE *)NULL) return NULL; bzero(&line, sizeof(Line)); init_parse_info(); do { int rc = read_line(fd, &line); if (rc < 0) { error = 1; break; } else if (rc == 0) { break; } p = line.str; while (*p) { int (*parse_proc)(const char *str, Token token, Database *db) = NULL; token = get_token(p); switch (token_tbl[token].token) { case T_NEWLINE: parse_proc = f_newline; break; case T_COMMENT: parse_proc = f_comment; break; case T_SEMICOLON: parse_proc = f_semicolon; break; case T_DOUBLE_QUOTE: parse_proc = f_double_quote; break; case T_LEFT_BRACE: parse_proc = f_left_brace; break; case T_RIGHT_BRACE: parse_proc = f_right_brace; break; case T_SPACE: case T_TAB: parse_proc = f_white; break; case T_BACKSLASH: parse_proc = f_backslash; break; case T_NUMERIC_HEX: case T_NUMERIC_DEC: case T_NUMERIC_OCT: parse_proc = f_numeric; break; case T_DEFAULT: parse_proc = f_default; break; } len = parse_proc(p, token, &db); if (len < 1) { error = 1; break; } p += len; } } while (!error); if (parse_info.pre_state != S_NULL) { clear_parse_info(); error = 1; } if (error) { #ifdef DEBUG fprintf(stderr, "database format error at line %d.\n", line.seq); #endif DestroyDatabase(db); db = (Database)NULL; } fclose(fd); free_line(&line); #ifdef DEBUG PrintDatabase(db); #endif return db; } /************************************************************************/ #ifndef NOT_X_ENV /* locale framework functions */ typedef struct _XlcDatabaseRec { XrmQuark category_q; XrmQuark name_q; Database db; struct _XlcDatabaseRec *next; } XlcDatabaseRec, *XlcDatabase; typedef struct _XlcDatabaseListRec { XrmQuark name_q; XlcDatabase lc_db; Database database; int ref_count; struct _XlcDatabaseListRec *next; } XlcDatabaseListRec, *XlcDatabaseList; /* database cache list (per file) */ static XlcDatabaseList _db_list = (XlcDatabaseList)NULL; /************************************************************************/ /* _XlcGetResource(lcd, category, class, value, count) */ /*----------------------------------------------------------------------*/ /* This function retrieves XLocale database information. */ /************************************************************************/ void _XlcGetResource( XLCd lcd, const char *category, const char *class, char ***value, int *count) { XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd); (*methods->get_resource)(lcd, category, class, value, count); return; } /************************************************************************/ /* _XlcGetLocaleDataBase(lcd, category, class, value, count) */ /*----------------------------------------------------------------------*/ /* This function retrieves XLocale database information. */ /************************************************************************/ void _XlcGetLocaleDataBase( XLCd lcd, const char *category, const char *name, char ***value, int *count) { XlcDatabase lc_db = (XlcDatabase)XLC_PUBLIC(lcd, xlocale_db); XrmQuark category_q, name_q; category_q = XrmStringToQuark(category); name_q = XrmStringToQuark(name); for (; lc_db->db; ++lc_db) { if (category_q == lc_db->category_q && name_q == lc_db->name_q) { *value = lc_db->db->value; *count = lc_db->db->value_num; return; } } *value = (char **)NULL; *count = 0; } /************************************************************************/ /* _XlcDestroyLocaleDataBase(lcd) */ /*----------------------------------------------------------------------*/ /* This function destroy the XLocale Database that bound to the */ /* specified lcd. If the XLocale Database is refered from some */ /* other lcd, this function just decreases reference count of */ /* the database. If no locale refers the database, this function */ /* remove it from the cache list and free work area. */ /************************************************************************/ void _XlcDestroyLocaleDataBase( XLCd lcd) { XlcDatabase lc_db = (XlcDatabase)XLC_PUBLIC(lcd, xlocale_db); XlcDatabaseList p, prev; for (p = _db_list, prev = (XlcDatabaseList)NULL; p; prev = p, p = p->next) { if (p->lc_db == lc_db) { if ((-- p->ref_count) < 1) { if (p->lc_db != (XlcDatabase)NULL) { Xfree(p->lc_db); } DestroyDatabase(p->database); if (prev == (XlcDatabaseList)NULL) { _db_list = p->next; } else { prev->next = p->next; } Xfree((char*)p); } break; } } XLC_PUBLIC(lcd, xlocale_db) = (XPointer)NULL; } /************************************************************************/ /* _XlcCreateLocaleDataBase(lcd) */ /*----------------------------------------------------------------------*/ /* This function create an XLocale database which correspond to */ /* the specified XLCd. */ /************************************************************************/ XPointer _XlcCreateLocaleDataBase( XLCd lcd) { XlcDatabaseList list, new; Database p, database = (Database)NULL; XlcDatabase lc_db = (XlcDatabase)NULL; XrmQuark name_q; char *name; int i, n; name = _XlcFileName(lcd, "locale"); if (name == NULL) return (XPointer)NULL; name_q = XrmStringToQuark(name); for (list = _db_list; list; list = list->next) { if (name_q == list->name_q) { list->ref_count++; Xfree (name); return XLC_PUBLIC(lcd, xlocale_db) = (XPointer)list->lc_db; } } database = CreateDatabase(name); if (database == (Database)NULL) { Xfree (name); return (XPointer)NULL; } n = CountDatabase(database); lc_db = Xcalloc(n + 1, sizeof(XlcDatabaseRec)); if (lc_db == (XlcDatabase)NULL) goto err; for (p = database, i = 0; p && i < n; p = p->next, ++i) { lc_db[i].category_q = XrmStringToQuark(p->category); lc_db[i].name_q = XrmStringToQuark(p->name); lc_db[i].db = p; } new = Xmalloc(sizeof(XlcDatabaseListRec)); if (new == (XlcDatabaseList)NULL) { goto err; } new->name_q = name_q; new->lc_db = lc_db; new->database = database; new->ref_count = 1; new->next = _db_list; _db_list = new; Xfree (name); return XLC_PUBLIC(lcd, xlocale_db) = (XPointer)lc_db; err: DestroyDatabase(database); if (lc_db != (XlcDatabase)NULL) { Xfree(lc_db); } Xfree (name); return (XPointer)NULL; } #endif /* NOT_X_ENV */ nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcFile.c0000644000000000000000000003753413614532331015654 0ustar /* * * Copyright IBM Corporation 1993 * * All Rights Reserved * * License to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and that * both that copyright notice and this permission notice appear in * supporting documentation, and that the name of IBM not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. * * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND * NONINFRINGEMENT OF THIRD PARTY RIGHTS, IN NO EVENT SHALL * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "Xlibint.h" #include "XlcPubI.h" #include #include /************************************************************************/ #define iscomment(ch) ((ch) == '#' || (ch) == '\0') #if defined(WIN32) #define isreadable(f) (_XAccessFile(f)) #else #define isreadable(f) ((access((f), R_OK) != -1) ? 1 : 0) #endif #define LC_PATHDELIM ':' #define XLC_BUFSIZE 256 #include "pathmax.h" #define NUM_LOCALEDIR 64 /* Splits a NUL terminated line into constituents, at colons and newline characters. Leading whitespace is removed from constituents. The constituents are stored at argv[0..argsize-1]. The number of stored constituents (<= argsize) is returned. The line is destructively modified. */ static int parse_line( char *line, char **argv, int argsize) { int argc = 0; char *p = line; while (argc < argsize) { while (isspace(*p)) { ++p; } if (*p == '\0') { break; } argv[argc++] = p; while (*p != ':' && *p != '\n' && *p != '\0') { ++p; } if (*p == '\0') { break; } *p++ = '\0'; } return argc; } #if defined(WIN32) /* this is parse_line but skips drive letters at the beginning of the entry */ static int parse_line1( char *line, char **argv, int argsize) { int argc = 0; char *p = line; while (argc < argsize) { while (isspace(*p)) { ++p; } if (*p == '\0') { break; } argv[argc++] = p; if (isalpha(*p) && p[1] == ':') { p+= 2; /* skip drive letters */ } while (*p != ':' && *p != '\n' && *p != '\0') { ++p; } if (*p == '\0') { break; } *p++ = '\0'; } return argc; } #endif /* WIN32 */ /* Splits a colon separated list of directories, and returns the constituent paths (without trailing slash). At most argsize constituents are stored at argv[0..argsize-1]. The number of stored constituents is returned. */ static int _XlcParsePath( char *path, char **argv, int argsize) { char *p = path; int n, i; #if !defined(WIN32) n = parse_line(path, argv, argsize); #else n = parse_line1(path, argv, argsize); #endif for (i = 0; i < n; ++i) { int len; p = argv[i]; len = strlen(p); if (len > 0 && p[len - 1] == '/') { /* eliminate trailing slash */ p[len - 1] = '\0'; } } return n; } #ifndef XLOCALEDIR #define XLOCALEDIR "/usr/lib/X11/locale" #endif void xlocaledir( char *buf, int buf_len) { char *p = buf; int len = 0; #ifndef NO_XLOCALEDIR char *dir; int priv = 1; dir = getenv("XLOCALEDIR"); if (dir) { #ifndef WIN32 /* * Only use the user-supplied path if the process isn't priviledged. */ if (getuid() == geteuid() && getgid() == getegid()) { #if defined(HASSETUGID) priv = issetugid(); #elif defined(HASGETRESUID) { uid_t ruid, euid, suid; gid_t rgid, egid, sgid; if ((getresuid(&ruid, &euid, &suid) == 0) && (getresgid(&rgid, &egid, &sgid) == 0)) priv = (euid != suid) || (egid != sgid); } #else /* * If there are saved ID's the process might still be priviledged * even though the above test succeeded. If issetugid() and * getresgid() aren't available, test this by trying to set * euid to 0. * * Note: this only protects setuid-root clients. It doesn't * protect other setuid or any setgid clients. If this tradeoff * isn't acceptable, set DisableXLocaleDirEnv to YES in host.def. */ unsigned int oldeuid; oldeuid = geteuid(); if (seteuid(0) != 0) { priv = 0; } else { if (seteuid(oldeuid) == -1) { /* XXX ouch, coudn't get back to original uid what can we do ??? */ _exit(127); } priv = 1; } #endif } #else priv = 0; #endif if (!priv) { len = strlen(dir); strncpy(p, dir, buf_len); if (len < buf_len) { p[len++] = LC_PATHDELIM; p += len; } } } #endif /* NO_XLOCALEDIR */ if (len < buf_len) strncpy(p, XLOCALEDIR, buf_len - len); buf[buf_len-1] = '\0'; } static void xlocalelibdir( char *buf, int buf_len) { char *p = buf; int len = 0; #ifndef NO_XLOCALEDIR char *dir; int priv = 1; dir = getenv("XLOCALELIBDIR"); if (dir) { #ifndef WIN32 /* * Only use the user-supplied path if the process isn't priviledged. */ if (getuid() == geteuid() && getgid() == getegid()) { #if defined(HASSETUGID) priv = issetugid(); #elif defined(HASGETRESUID) { uid_t ruid, euid, suid; gid_t rgid, egid, sgid; if ((getresuid(&ruid, &euid, &suid) == 0) && (getresgid(&rgid, &egid, &sgid) == 0)) priv = (euid != suid) || (egid != sgid); } #else /* * If there are saved ID's the process might still be priviledged * even though the above test succeeded. If issetugid() and * getresgid() aren't available, test this by trying to set * euid to 0. * * Note: this only protects setuid-root clients. It doesn't * protect other setuid or any setgid clients. If this tradeoff * isn't acceptable, set DisableXLocaleDirEnv to YES in host.def. */ unsigned int oldeuid; oldeuid = geteuid(); if (seteuid(0) != 0) { priv = 0; } else { if (seteuid(oldeuid) == -1) { /* XXX ouch, coudn't get back to original uid what can we do ??? */ _exit(127); } priv = 1; } #endif } #else priv = 0; #endif if (!priv) { len = strlen(dir); strncpy(p, dir, buf_len); if (len < buf_len) { p[len++] = LC_PATHDELIM; p += len; } } } #endif /* NO_XLOCALEDIR */ if (len < buf_len) strncpy(p, XLOCALELIBDIR, buf_len - len); buf[buf_len-1] = '\0'; } /* Mapping direction */ typedef enum { LtoR, /* Map first field to second field */ RtoL /* Map second field to first field */ } MapDirection; static char * resolve_name( const char *lc_name, char *file_name, MapDirection direction) { FILE *fp; char buf[XLC_BUFSIZE], *name = NULL; fp = _XFopenFile (file_name, "r"); if (fp == NULL) return NULL; while (fgets(buf, XLC_BUFSIZE, fp) != NULL) { char *p = buf; int n; char *args[2], *from, *to; while (isspace(*p)) { ++p; } if (iscomment(*p)) { continue; } n = parse_line(p, args, 2); /* get first 2 fields */ if (n != 2) { continue; } if (direction == LtoR) { from = args[0], to = args[1]; /* left to right */ } else { from = args[1], to = args[0]; /* right to left */ } if (! strcmp(from, lc_name)) { name = strdup(to); break; } } fclose(fp); return name; } #define c_tolower(ch) ((ch) >= 'A' && (ch) <= 'Z' ? (ch) - 'A' + 'a' : (ch)) static char * lowercase( char *dst, const char *src) { const char *s; char *t; for (s = src, t = dst; *s; ++s, ++t) *t = c_tolower(*s); *t = '\0'; return dst; } /* * normalize_lcname(): remove any '_' and '-' and convert any character * to lower case after the _ part. If result is identical * to argument, free result and * return NULL. */ static char * normalize_lcname (const char *name) { char *p, *ret; const char *tmp = name; p = ret = Xmalloc(strlen(name) + 1); if (!p) return NULL; if (tmp) { while (*tmp && *tmp != '.' && *tmp != '@') *p++ = *tmp++; while (*tmp) { if (*tmp != '-') *p++ = c_tolower(*tmp); tmp++; } } *p = '\0'; if (strcmp(ret, name) == 0) { Xfree(ret); return NULL; } return ret; } /************************************************************************/ char * _XlcFileName( XLCd lcd, const char *category) { char *siname; char cat[XLC_BUFSIZE], dir[XLC_BUFSIZE]; int i, n; char *args[NUM_LOCALEDIR]; char *file_name = NULL; if (lcd == (XLCd)NULL) return NULL; siname = XLC_PUBLIC(lcd, siname); if (category) lowercase(cat, category); else cat[0] = '\0'; xlocaledir(dir,XLC_BUFSIZE); n = _XlcParsePath(dir, args, NUM_LOCALEDIR); for (i = 0; i < n; ++i) { char buf[PATH_MAX], *name; if (args[i] == NULL) continue; name = NULL; if (snprintf(buf, PATH_MAX, "%s/%s.dir", args[i], cat) < PATH_MAX) { name = resolve_name(siname, buf, RtoL); } if (name == NULL) { continue; } if (*name == '/') { /* supposed to be absolute path name */ file_name = name; } else { if (snprintf(buf, PATH_MAX, "%s/%s", args[i], name) < PATH_MAX) file_name = strdup(buf); else file_name = NULL; Xfree(name); } if (file_name && isreadable(file_name)) { break; } Xfree(file_name); file_name = NULL; /* Then, try with next dir */ } return file_name; } /************************************************************************/ #ifndef LOCALE_ALIAS #define LOCALE_ALIAS "locale.alias" #endif int _XlcResolveLocaleName( const char* lc_name, XLCdPublicPart* pub) { char dir[PATH_MAX], buf[PATH_MAX], *name = NULL; char *dst; int i, n, sinamelen; char *args[NUM_LOCALEDIR]; static const char locale_alias[] = LOCALE_ALIAS; char *tmp_siname; char *nlc_name = NULL; xlocaledir (dir, PATH_MAX); n = _XlcParsePath(dir, args, NUM_LOCALEDIR); for (i = 0; i < n; ++i) { if (args[i] == NULL) continue; if (snprintf (buf, PATH_MAX, "%s/%s", args[i], locale_alias) < PATH_MAX) { name = resolve_name (lc_name, buf, LtoR); if (!name) { if (!nlc_name) nlc_name = normalize_lcname(lc_name); if (nlc_name) name = resolve_name (nlc_name, buf, LtoR); } } if (name != NULL) { break; } } Xfree(nlc_name); if (name == NULL) { /* vendor locale name == Xlocale name, no expansion of alias */ pub->siname = strdup (lc_name); } else { pub->siname = name; } sinamelen = strlen (pub->siname); if (sinamelen == 1 && pub->siname[0] == 'C') { pub->language = pub->siname; pub->territory = pub->codeset = NULL; return 1; } /* * pub->siname is in the format _., typical would * be "en_US.ISO8859-1", "en_US.utf8", "ru_RU.KOI-8", or ja_JP.SJIS, * although it could be ja.SJIS too. */ tmp_siname = Xrealloc (pub->siname, 2 * (sinamelen + 1)); if (tmp_siname == NULL) { return 0; } pub->siname = tmp_siname; /* language */ dst = &pub->siname[sinamelen + 1]; strcpy (dst, pub->siname); pub->language = dst; /* territory */ dst = strchr (dst, '_'); if (dst) { *dst = '\0'; pub->territory = ++dst; } else dst = &pub->siname[sinamelen + 1]; /* codeset */ dst = strchr (dst, '.'); if (dst) { *dst = '\0'; pub->codeset = ++dst; } return (pub->siname[0] != '\0') ? 1 : 0; } /************************************************************************/ int _XlcResolveI18NPath(char *buf, int buf_len) { if (buf != NULL) { xlocaledir(buf, buf_len); } return 1; } char * _XlcLocaleDirName(char *dir_name, size_t dir_len, const char *lc_name) { char dir[PATH_MAX], buf[PATH_MAX]; int i, n; char *args[NUM_LOCALEDIR]; static char locale_alias[] = LOCALE_ALIAS; char *target_name = NULL; char *target_dir = NULL; char *nlc_name = NULL; static char* last_dir_name = 0; static size_t last_dir_len = 0; static char* last_lc_name = 0; if (last_lc_name != 0 && strcmp (last_lc_name, lc_name) == 0 && dir_len >= last_dir_len) { strcpy (dir_name, last_dir_name); return dir_name; } xlocaledir (dir, PATH_MAX); n = _XlcParsePath(dir, args, NUM_LOCALEDIR); for (i = 0; i < n; ++i) { char *name = NULL; if (args[i] == NULL) continue; if (snprintf (buf, PATH_MAX, "%s/%s", args[i], locale_alias) < PATH_MAX) { name = resolve_name(lc_name, buf, LtoR); if (!name) { if (!nlc_name) nlc_name = normalize_lcname(lc_name); if (nlc_name) name = resolve_name (nlc_name, buf, LtoR); } } /* look at locale.dir */ target_dir = args[i]; if (snprintf(buf, PATH_MAX, "%s/locale.dir", target_dir) < PATH_MAX) { /* If name is not an alias, use lc_name for locale.dir search */ target_name = resolve_name(name ? name : lc_name, buf, RtoL); } Xfree(name); name = NULL; if (target_name != NULL) { char *p = 0; if ((p = strstr(target_name, "/XLC_LOCALE"))) { *p = '\0'; break; } Xfree(target_name); target_name = NULL; } } Xfree(nlc_name); if (target_name == NULL) /* vendor locale name == Xlocale name, no expansion of alias */ snprintf(dir_name, dir_len, "%s/%s", args[0], lc_name); else snprintf(dir_name, dir_len, "%s/%s", target_dir, target_name); Xfree(target_name); Xfree (last_dir_name); Xfree (last_lc_name); last_dir_len = strlen (dir_name) + 1; last_dir_name = Xmalloc (last_dir_len); strcpy (last_dir_name, dir_name); last_lc_name = strdup (lc_name); return dir_name; } char * _XlcLocaleLibDirName(char *dir_name, size_t dir_len, const char *lc_name) { char dir[PATH_MAX], buf[PATH_MAX]; int i, n; char *args[NUM_LOCALEDIR]; static char locale_alias[] = LOCALE_ALIAS; char *target_name = NULL; char *target_dir = NULL; char *nlc_name = NULL; static char* last_dir_name = 0; static size_t last_dir_len = 0; static char* last_lc_name = 0; if (last_lc_name != 0 && strcmp (last_lc_name, lc_name) == 0 && dir_len >= last_dir_len) { strcpy (dir_name, last_dir_name); return dir_name; } xlocalelibdir (dir, PATH_MAX); n = _XlcParsePath(dir, args, NUM_LOCALEDIR); for (i = 0; i < n; ++i) { char *name = NULL; if (args[i] == NULL) continue; if (snprintf (buf, PATH_MAX, "%s/%s", args[i], locale_alias) < PATH_MAX) { name = resolve_name(lc_name, buf, LtoR); if (!name) { if (!nlc_name) nlc_name = normalize_lcname(lc_name); if (nlc_name) name = resolve_name (nlc_name, buf, LtoR); } } /* look at locale.dir */ target_dir = args[i]; if (snprintf(buf, PATH_MAX, "%s/locale.dir", target_dir) < PATH_MAX) { /* If name is not an alias, use lc_name for locale.dir search */ target_name = resolve_name(name ? name : lc_name, buf, RtoL); } Xfree(name); name = NULL; if (target_name != NULL) { char *p = 0; if ((p = strstr(target_name, "/XLC_LOCALE"))) { *p = '\0'; break; } Xfree(target_name); target_name = NULL; } } Xfree(nlc_name); if (target_name == NULL) /* vendor locale name == Xlocale name, no expansion of alias */ snprintf(dir_name, dir_len, "%s/%s", args[0], lc_name); else snprintf(dir_name, dir_len, "%s/%s", target_dir, target_name); Xfree(target_name); Xfree (last_dir_name); Xfree (last_lc_name); last_dir_len = strlen (dir_name) + 1; last_dir_name = Xmalloc (last_dir_len); strcpy (last_dir_name, dir_name); last_lc_name = strdup (lc_name); return dir_name; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcGeneric.c0000644000000000000000000007222413614532331016344 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ /* * (c) Copyright 1995 FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "XlcGeneric.h" static XLCd create (const char *name, XLCdMethods methods); static Bool initialize (XLCd lcd); static void destroy (XLCd lcd); static XLCdPublicMethodsRec genericMethods = { { NULL }, /* use default methods */ { NULL, create, initialize, destroy, NULL } }; XLCdMethods _XlcGenericMethods = (XLCdMethods) &genericMethods; static XLCd create( const char *name, XLCdMethods methods) { XLCd lcd; XLCdPublicMethods new; lcd = Xcalloc(1, sizeof(XLCdRec)); if (lcd == NULL) return (XLCd) NULL; lcd->core = Xcalloc(1, sizeof(XLCdGenericRec)); if (lcd->core == NULL) goto err; new = Xmalloc(sizeof(XLCdPublicMethodsRec)); if (new == NULL) goto err; memcpy(new,methods,sizeof(XLCdPublicMethodsRec)); lcd->methods = (XLCdMethods) new; return lcd; err: Xfree(lcd->core); Xfree(lcd); return (XLCd) NULL; } static Bool string_to_encoding( const char *str, char *encoding) { char *next; long value; int base; while (*str) { if (*str == '\\') { switch (*(str + 1)) { case 'x': case 'X': base = 16; break; default: base = 8; break; } value = strtol(str + 2, &next, base); if (str + 2 != next) { *((unsigned char *) encoding++) = (unsigned char) value; str = next; continue; } } *encoding++ = *str++; } *encoding = '\0'; return True; } static Bool string_to_ulong( const char *str, unsigned long *value) { const char *tmp1 = str; int base; if (*tmp1++ != '\\') { tmp1--; base = 10; } else { switch (*tmp1++) { case 'x': base = 16; break; case 'o': base = 8; break; case 'd': base = 10; break; default: return(False); } } *value = (unsigned long) strtol(tmp1, NULL, base); return(True); } static Bool add_charset( CodeSet codeset, XlcCharSet charset) { XlcCharSet *new_list; int num; if ((num = codeset->num_charsets)) new_list = Xrealloc(codeset->charset_list, (num + 1) * sizeof(XlcCharSet)); else new_list = Xmalloc(sizeof(XlcCharSet)); if (new_list == NULL) return False; new_list[num] = charset; codeset->charset_list = new_list; codeset->num_charsets = num + 1; return True; } static CodeSet add_codeset( XLCdGenericPart *gen) { CodeSet new, *new_list; int num; new = Xcalloc(1, sizeof(CodeSetRec)); if (new == NULL) return NULL; if ((num = gen->codeset_num)) new_list = Xrealloc(gen->codeset_list, (num + 1) * sizeof(CodeSet)); else new_list = Xmalloc(sizeof(CodeSet)); if (new_list == NULL) goto err; new_list[num] = new; gen->codeset_list = new_list; gen->codeset_num = num + 1; return new; err: Xfree(new); return NULL; } static Bool add_parse_list( XLCdGenericPart *gen, EncodingType type, const char *encoding, CodeSet codeset) { ParseInfo new, *new_list; char *str; unsigned char ch; int num; str = strdup(encoding); if (str == NULL) return False; new = Xcalloc(1, sizeof(ParseInfoRec)); if (new == NULL) goto err; if (gen->mb_parse_table == NULL) { gen->mb_parse_table = Xcalloc(1, 256); /* 2^8 */ if (gen->mb_parse_table == NULL) goto err; } if ((num = gen->mb_parse_list_num)) new_list = Xrealloc(gen->mb_parse_list, (num + 2) * sizeof(ParseInfo)); else { new_list = Xmalloc(2 * sizeof(ParseInfo)); } if (new_list == NULL) goto err; new_list[num] = new; new_list[num + 1] = NULL; gen->mb_parse_list = new_list; gen->mb_parse_list_num = num + 1; ch = (unsigned char) *str; if (gen->mb_parse_table[ch] == 0) gen->mb_parse_table[ch] = num + 1; new->type = type; new->encoding = str; new->codeset = codeset; if (codeset->parse_info == NULL) codeset->parse_info = new; return True; err: Xfree(str); Xfree(new); return False; } static void free_charset( XLCd lcd) { XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); ParseInfo *parse_info; int num; Xfree(gen->mb_parse_table); if ((num = gen->mb_parse_list_num) > 0) { for (parse_info = gen->mb_parse_list; num-- > 0; parse_info++) { Xfree((*parse_info)->encoding); Xfree(*parse_info); } Xfree(gen->mb_parse_list); } if ((num = gen->codeset_num) > 0) Xfree(gen->codeset_list); } /* For VW/UDC */ #define FORWARD (unsigned long)'+' #define BACKWARD (unsigned long)'-' static const char * getscope( const char *str, FontScope scp) { unsigned long start = 0; unsigned long end = 0; unsigned long dest = 0; unsigned long shift = 0; unsigned long direction = 0; sscanf(str,"[\\x%lx,\\x%lx]->\\x%lx", &start, &end, &dest); if (dest) { if (dest >= start) { shift = dest - start; direction = FORWARD ; } else { shift = start - dest; direction = BACKWARD; } } scp->start = start ; scp->end = end ; scp->shift = shift ; scp->shift_direction = direction ; /* .......... */ while (*str) { if (*str == ',' && *(str+1) == '[') break; str++; } return str+1; } static int count_scopemap( const char *str) { const char *ptr; int num=0; for (ptr=str; *ptr; ptr++) { if (*ptr == ']') { num++; } } return num; } FontScope _XlcParse_scopemaps( const char *str, int *size) { int num=0,i; FontScope scope,sc_ptr; const char *str_sc; num = count_scopemap(str); scope = Xmalloc(num * sizeof(FontScopeRec)); if (scope == NULL) return NULL; for (i=0, str_sc=str, sc_ptr=scope; i < num; i++, sc_ptr++) { str_sc = getscope(str_sc, sc_ptr); } *size = num; return scope; } void _XlcDbg_printValue( const char *str, char **value, int num) { /* int i; for (i = 0; i < num; i++) fprintf(stderr, "%s value[%d] = %s\n", str, i, value[i]); */ } static void dmpscope( const char* name, FontScope sc, int num) { /* int i; fprintf(stderr, "dmpscope %s\n", name); for (i=0; isource = CSsrcXLC; } return charset; } static void read_charset_define( XLCd lcd, XLCdGenericPart *gen) { int i; char csd[16], cset_name[256]; char name[BUFSIZ]; XlcCharSet charsetd; char **value; int num, new = 0; XlcSide side = XlcUnknown; char *tmp; for (i=0; ; i++) { /* loop start */ charsetd = 0; snprintf(csd, sizeof(csd), "csd%d", i); /* charset_name */ snprintf(name, sizeof(name), "%s.%s", csd, "charset_name"); _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); _XlcDbg_printValue(name,value,num); if (num > 0) { /* hackers will get truncated -- C'est la vie */ strncpy(cset_name,value[0], sizeof cset_name - 1); cset_name[(sizeof cset_name) - 1] = '\0'; snprintf(name, sizeof(name), "%s.%s", csd , "side"); _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); if (num > 0) { _XlcDbg_printValue(name,value,num); if (!_XlcNCompareISOLatin1(value[0], "none", 4)) { side = XlcGLGR; } else if (!_XlcNCompareISOLatin1(value[0], "GL", 2)) { side = XlcGL; strcat(cset_name,":GL"); } else { side = XlcGR; strcat(cset_name,":GR"); } if (charsetd == NULL && (charsetd = srch_charset_define(cset_name,&new)) == NULL) return; } } else { if (i == 0) continue; else break; } if (new) { tmp = strdup(cset_name); if (tmp == NULL) return; charsetd->name = tmp; } /* side */ charsetd->side = side ; /* length */ snprintf(name, sizeof(name), "%s.%s", csd, "length"); _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); if (num > 0) { _XlcDbg_printValue(name,value,num); charsetd->char_size = atoi(value[0]); } /* gc_number */ snprintf(name, sizeof(name), "%s.%s", csd, "gc_number"); _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); if (num > 0) { _XlcDbg_printValue(name,value,num); charsetd->set_size = atoi(value[0]); } /* string_encoding */ snprintf(name, sizeof(name), "%s.%s", csd, "string_encoding"); _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); if (num > 0) { _XlcDbg_printValue(name,value,num); if (!strcmp("False",value[0])) { charsetd->string_encoding = False; } else { charsetd->string_encoding = True; } } /* sequence */ snprintf(name, sizeof(name), "%s.%s", csd, "sequence"); _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); if (num > 0) { _XlcDbg_printValue(name,value,num); /* if (charsetd->ct_sequence) { Xfree(charsetd->ct_sequence); } */ tmp = Xmalloc(strlen(value[0])+1); if (tmp == NULL) return; charsetd->ct_sequence = tmp; string_to_encoding(value[0],tmp); } /* encoding_name */ snprintf(name, sizeof(name), "%s.%s", csd, "encoding_name"); _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); if (num > 0) { _XlcDbg_printValue(name,value,num); /* if (charsetd->encoding_name) { Xfree(charsetd->encoding_name); } */ tmp = strdup(value[0]); charsetd->encoding_name = tmp; charsetd->xrm_encoding_name = XrmStringToQuark(tmp); } _XlcAddCT(charsetd->name, charsetd->ct_sequence); } } static SegConv add_conversion( XLCdGenericPart *gen) { SegConv new_list; int num; if ((num = gen->segment_conv_num) > 0) { new_list = Xrealloc(gen->segment_conv, (num + 1) * sizeof(SegConvRec)); } else { new_list = Xmalloc(sizeof(SegConvRec)); } if (new_list == NULL) return NULL; gen->segment_conv = new_list; gen->segment_conv_num = num + 1; return &new_list[num]; } static void read_segmentconversion( XLCd lcd, XLCdGenericPart *gen) { int i; char conv[16]; char name[BUFSIZ]; char **value; int num,new; SegConv conversion; for (i=0 ; ; i++) { /* loop start */ conversion = 0; snprintf(conv, sizeof(conv), "conv%d", i); /* length */ snprintf(name, sizeof(name), "%s.%s", conv, "length"); _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); if (num > 0) { if (conversion == NULL && (conversion = add_conversion(gen)) == NULL) { return; } _XlcDbg_printValue(name,value,num); } else { if (i == 0) continue; else break; } conversion->length = atoi(value[0]); /* source_encoding */ snprintf(name, sizeof(name), "%s.%s", conv, "source_encoding"); _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); if (num > 0) { char *tmp; _XlcDbg_printValue(name,value,num); tmp = strdup(value[0]); if (tmp == NULL) return; conversion->source_encoding = tmp; conversion->source = srch_charset_define(tmp,&new); } /* destination_encoding */ snprintf(name, sizeof(name), "%s.%s", conv, "destination_encoding"); _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); if (num > 0) { char *tmp; _XlcDbg_printValue(name,value,num); tmp = strdup(value[0]); if (tmp == NULL) return; conversion->destination_encoding = tmp; conversion->dest = srch_charset_define(tmp,&new); } /* range */ snprintf(name, sizeof(name), "%s.%s", conv, "range"); _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); if (num > 0) { _XlcDbg_printValue(name,value,num); sscanf(value[0],"\\x%lx,\\x%lx", &(conversion->range.start), &(conversion->range.end)); } /* conversion */ snprintf(name, sizeof(name), "%s.%s", conv, "conversion"); _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); if (num > 0) { _XlcDbg_printValue(name,value,num); conversion->conv = _XlcParse_scopemaps(value[0],&conversion->conv_num); } } /* loop end */ } static ExtdSegment create_ctextseg( char **value, int num) { ExtdSegment ret; char* ptr; char* cset_name = NULL; size_t cset_len; int i,new; FontScope scope; ret = Xmalloc(sizeof(ExtdSegmentRec)); if (ret == NULL) return NULL; ret->name = strdup(value[0]); if (ret->name == NULL) { Xfree (ret); return NULL; } cset_len = strlen(ret->name) + 1; cset_name = Xmalloc (cset_len); if (cset_name == NULL) { Xfree (ret->name); Xfree (ret); return NULL; } if (strchr(value[0],':')) { ptr = strchr(ret->name,':'); *ptr = '\0'; ptr++; if (!_XlcNCompareISOLatin1(ptr, "GL", 2)) { ret->side = XlcGL; snprintf(cset_name, cset_len, "%s:%s", ret->name, "GL"); } else { ret->side = XlcGR; snprintf(cset_name, cset_len, "%s:%s", ret->name, "GR"); } } else { ret->side = XlcGLGR; strcpy(cset_name,ret->name); } ret->area = Xmalloc((num - 1)*sizeof(FontScopeRec)); if (ret->area == NULL) { Xfree (cset_name); Xfree (ret->name); Xfree (ret); return NULL; } ret->area_num = num - 1; scope = ret->area ; for (i = 1; i < num; i++) { sscanf(value[i],"\\x%lx,\\x%lx", &scope[i-1].start, &scope[i-1].end); } ret->charset = srch_charset_define(cset_name,&new); Xfree (cset_name); return ret; } /* For VW/UDC end */ static Bool load_generic( XLCd lcd) { XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); char **value; int num; unsigned long l; int i; int M,ii; XlcCharSet charset; gen->codeset_num = 0; /***** wc_encoding_mask *****/ _XlcGetResource(lcd, "XLC_XLOCALE", "wc_encoding_mask", &value, &num); if (num > 0) { if (string_to_ulong(value[0], &l) == False) goto err; gen->wc_encode_mask = l; } /***** wc_shift_bits *****/ _XlcGetResource(lcd, "XLC_XLOCALE", "wc_shift_bits", &value, &num); if (num > 0) gen->wc_shift_bits = atoi(value[0]); if (gen->wc_shift_bits < 1) gen->wc_shift_bits = 8; /***** use_stdc_env *****/ _XlcGetResource(lcd, "XLC_XLOCALE", "use_stdc_env", &value, &num); if (num > 0 && !_XlcCompareISOLatin1(value[0], "True")) gen->use_stdc_env = True; else gen->use_stdc_env = False; /***** force_convert_to_mb *****/ _XlcGetResource(lcd, "XLC_XLOCALE", "force_convert_to_mb", &value, &num); if (num > 0 && !_XlcCompareISOLatin1(value[0], "True")) gen->force_convert_to_mb = True; else gen->force_convert_to_mb = False; for (i = 0; ; i++) { CodeSetRec *codeset = NULL; char cs[16]; char name[BUFSIZ]; snprintf(cs, sizeof(cs), "cs%d", i); /***** codeset.side *****/ snprintf(name, sizeof(name), "%s.%s", cs , "side"); _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); if (num > 0) { char *tmp; if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) goto err; /* 3.4.1 side */ if (!_XlcNCompareISOLatin1(value[0], "none", 4)) { codeset->side = XlcNONE; } else if (!_XlcNCompareISOLatin1(value[0], "GL", 2)) { codeset->side = XlcGL; } else { codeset->side = XlcGR; } tmp = strrchr(value[0], ':'); if (tmp != NULL && !_XlcCompareISOLatin1(tmp + 1, "Default")) { if (codeset->side == XlcGR) gen->initial_state_GR = codeset; else gen->initial_state_GL = codeset; } } /***** codeset.length *****/ snprintf(name, sizeof(name), "%s.%s", cs , "length"); _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); if (num > 0) { if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) goto err; codeset->length = atoi(value[0]); if (codeset->length < 1) codeset->length = 1; } /***** codeset.mb_encoding *****/ snprintf(name, sizeof(name), "%s.%s", cs, "mb_encoding"); _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); if (num > 0) { static struct { const char *str; EncodingType type; } shifts[] = { {"", E_SS}, {"", E_LSL}, {"", E_LSR}, {0} }; int j; if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) goto err; for ( ; num-- > 0; value++) { char encoding[256]; char *tmp = *value; EncodingType type = E_SS; /* for BC */ for (j = 0; shifts[j].str; j++) { if (!_XlcNCompareISOLatin1(tmp, shifts[j].str, strlen(shifts[j].str))) { type = shifts[j].type; tmp += strlen(shifts[j].str); break; } } if (strlen (tmp) > sizeof encoding || string_to_encoding(tmp, encoding) == False) goto err; add_parse_list(gen, type, encoding, codeset); } } /***** codeset.wc_encoding *****/ snprintf(name, sizeof(name), "%s.%s", cs, "wc_encoding"); _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); if (num > 0) { if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) goto err; if (string_to_ulong(value[0], &l) == False) goto err; codeset->wc_encoding = l; } /***** codeset.ct_encoding *****/ snprintf(name, sizeof(name), "%s.%s", cs, "ct_encoding"); _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); if (num > 0) { char *encoding; if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) goto err; for ( ; num-- > 0; value++) { if (strlen (*value) > sizeof name) goto err; string_to_encoding(*value, name); charset = NULL; if ((encoding = strchr(name, ':')) && (encoding = strchr(encoding + 1, ':'))) { *encoding++ = '\0'; charset = _XlcAddCT(name, encoding); } if (charset == NULL) { charset = _XlcGetCharSet(name); if (charset == NULL && (charset = _XlcCreateDefaultCharSet(name, ""))) { charset->side = codeset->side; charset->char_size = codeset->length; _XlcAddCharSet(charset); } } if (charset) { if (add_charset(codeset, charset) == False) goto err; } } } if (codeset == NULL) break; codeset->cs_num = i; /* For VW/UDC */ /***** 3.4.2 byteM (1 <= M <= length)*****/ for (M=1; M-1 < codeset->length; M++) { unsigned long start,end; ByteInfo tmpb; snprintf(name, sizeof(name),"%s.%s%d",cs,"byte",M); _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); if (M == 1) { if (num < 1) { codeset->byteM = NULL; break ; } codeset->byteM = Xmalloc( (codeset->length)*sizeof(ByteInfoListRec)); if (codeset->byteM == NULL) { goto err; } } if (num > 0) { _XlcDbg_printValue(name,value,num); (codeset->byteM)[M-1].M = M; (codeset->byteM)[M-1].byteinfo_num = num; (codeset->byteM)[M-1].byteinfo = Xmalloc(num * sizeof(ByteInfoRec)); for (ii = 0 ; ii < num ; ii++) { tmpb = (codeset->byteM)[M-1].byteinfo ; /* default 0x00 - 0xff */ sscanf(value[ii],"\\x%lx,\\x%lx",&start,&end); tmpb[ii].start = (unsigned char)start; tmpb[ii].end = (unsigned char)end; } } /* .... */ } /***** codeset.mb_conversion *****/ snprintf(name, sizeof(name), "%s.%s", cs, "mb_conversion"); _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); if (num > 0) { _XlcDbg_printValue(name,value,num); codeset->mbconv = Xmalloc(sizeof(ConversionRec)); codeset->mbconv->convlist = _XlcParse_scopemaps(value[0],&(codeset->mbconv->conv_num)); dmpscope("mb_conv",codeset->mbconv->convlist, codeset->mbconv->conv_num); /* [\x%x,\x%x]->\x%x,... */ } /***** codeset.ct_conversion *****/ snprintf(name, sizeof(name), "%s.%s", cs, "ct_conversion"); _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); if (num > 0) { _XlcDbg_printValue(name,value,num); codeset->ctconv = Xmalloc(sizeof(ConversionRec)); codeset->ctconv->convlist = _XlcParse_scopemaps(value[0],&(codeset->ctconv->conv_num)); dmpscope("ctconv",codeset->ctconv->convlist, codeset->ctconv->conv_num); /* [\x%x,\x%x]->\x%x,... */ } /***** codeset.ct_conversion_file *****/ snprintf(name, sizeof(name), "%s.%s", cs, "ct_conversion_file"); _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); if (num > 0) { _XlcDbg_printValue(name,value,num); /* [\x%x,\x%x]->\x%x,... */ } /***** codeset.ct_extended_segment *****/ snprintf(name, sizeof(name), "%s.%s", cs, "ct_extended_segment"); _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); if (num > 0) { _XlcDbg_printValue(name,value,num); codeset->ctextseg = create_ctextseg(value,num); /* [\x%x,\x%x]->\x%x,... */ } /* For VW/UDC end */ } read_charset_define(lcd,gen); /* For VW/UDC */ read_segmentconversion(lcd,gen); /* For VW/UDC */ if (gen->initial_state_GL == NULL) { CodeSetRec *codeset; for (i = 0; i < gen->codeset_num; i++) { codeset = gen->codeset_list[i]; if (codeset->side == XlcGL) gen->initial_state_GL = codeset; } } if (gen->initial_state_GR == NULL) { CodeSetRec *codeset; for (i = 0; i < gen->codeset_num; i++) { codeset = gen->codeset_list[i]; if (codeset->side == XlcGR) gen->initial_state_GR = codeset; } } for (i = 0; i < gen->codeset_num; i++) { CodeSetRec *codeset = gen->codeset_list[i]; for (ii = 0; ii < codeset->num_charsets; ii++) { charset = codeset->charset_list[ii]; if (! strcmp(charset->encoding_name, "ISO8859-1")) charset->string_encoding = True; if ( charset->string_encoding ) codeset->string_encoding = True; } } return True; err: free_charset(lcd); return False; } #ifdef USE_DYNAMIC_LC /* override the open_om and open_im methods which were set by super_class's initialize method() */ static Bool initialize_core( XLCd lcd) { _XInitDynamicOM(lcd); _XInitDynamicIM(lcd); return True; } #endif static Bool initialize(XLCd lcd) { XLCdPublicMethods superclass = (XLCdPublicMethods) _XlcPublicMethods; XLC_PUBLIC_METHODS(lcd)->superclass = superclass; if (superclass->pub.initialize) { if ((*superclass->pub.initialize)(lcd) == False) return False; } #ifdef USE_DYNAMIC_LC if (initialize_core(lcd) == False) return False; #endif if (load_generic(lcd) == False) return False; return True; } /* VW/UDC start 95.01.08 */ static void freeByteM( CodeSet codeset) { int i; ByteInfoList blst; if (codeset->byteM == NULL) { return ; } blst = codeset->byteM; for (i = 0; i < codeset->length; i++) { Xfree(blst[i].byteinfo); blst[i].byteinfo = NULL; } Xfree(codeset->byteM); codeset->byteM = NULL; } static void freeConversion( CodeSet codeset) { Conversion mbconv,ctconv; if (codeset->mbconv) { mbconv = codeset->mbconv; /* ... */ Xfree(mbconv->convlist); mbconv->convlist = NULL; Xfree(mbconv); codeset->mbconv = NULL; } if (codeset->ctconv) { ctconv = codeset->ctconv; /* ... */ Xfree(ctconv->convlist); ctconv->convlist = NULL; Xfree(ctconv); codeset->ctconv = NULL; } } static void freeExtdSegment( CodeSet codeset) { ExtdSegment ctextseg; if (codeset->ctextseg == NULL) { return; } ctextseg = codeset->ctextseg; Xfree(ctextseg->name); ctextseg->name = NULL; Xfree(ctextseg->area); ctextseg->area = NULL; Xfree(codeset->ctextseg); codeset->ctextseg = NULL; } static void freeParseInfo( CodeSet codeset) { ParseInfo parse_info; if (codeset->parse_info == NULL) { return; } parse_info = codeset->parse_info; Xfree(parse_info->encoding); parse_info->encoding = NULL; Xfree(codeset->parse_info); codeset->parse_info = NULL; } static void destroy_CodeSetList( XLCdGenericPart *gen) { CodeSet *codeset = gen->codeset_list; int i; if (gen->codeset_num == 0) { return; } for (i=0;icodeset_num;i++) { freeByteM(codeset[i]); freeConversion(codeset[i]); freeExtdSegment(codeset[i]); freeParseInfo(codeset[i]); Xfree(codeset[i]->charset_list); codeset[i]->charset_list = NULL; Xfree(codeset[i]); codeset[i]=NULL; } Xfree(codeset); gen->codeset_list = NULL; } static void destroy_SegConv( XLCdGenericPart *gen) { SegConv seg = gen->segment_conv; int i; if (gen->segment_conv_num == 0) { return; } for (i=0;isegment_conv_num;i++) { Xfree(seg[i].source_encoding); seg[i].source_encoding = NULL; Xfree(seg[i].destination_encoding); seg[i].destination_encoding = NULL; Xfree(seg[i].conv); seg[i].conv = NULL; } Xfree(seg); gen->segment_conv = NULL; } static void destroy_gen( XLCd lcd) { XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); destroy_SegConv(gen); destroy_CodeSetList(gen); Xfree(gen->mb_parse_table); gen->mb_parse_table = NULL; Xfree(gen->mb_parse_list); gen->mb_parse_list = NULL; } /* VW/UDC end 95.01.08 */ static void destroy( XLCd lcd) { XLCdPublicMethods superclass = XLC_PUBLIC_METHODS(lcd)->superclass; destroy_gen(lcd); /* ADD 1996.01.08 */ if (superclass && superclass->pub.destroy) (*superclass->pub.destroy)(lcd); } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcInit.c0000644000000000000000000001316113614532331015666 0ustar /* Copyright 1985, 1986, 1987, 1991, 1998 The Open Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE EVEN IF ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. X Window System is a trademark of The Open Group OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF logo, LBX, X Window System, and Xinerama are trademarks of the Open Group. All other trademarks and registered trademarks mentioned herein are the property of their respective owners. No right, title or interest in or to any trademark, service mark, logo or trade name of Sun Microsystems, Inc. or its licensors is granted. */ /* * Copyright 2000 Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ /* * (c) Copyright 1995 FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. * * Modifier: Masayoshi Shimamura FUJITSU LIMITED * */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" #ifdef USE_DYNAMIC_LC #undef USE_DEFAULT_LOADER #undef USE_GENERIC_LOADER #undef USE_UTF8_LOADER #else #define USE_GENERIC_LOADER #define USE_DEFAULT_LOADER #define USE_UTF8_LOADER #endif /* * The _XlcInitLoader function initializes the locale object loader list * with vendor specific manner. */ void _XlcInitLoader(void) { #ifdef USE_DYNAMIC_LC _XlcAddLoader(_XlcDynamicLoad, XlcHead); #else /* USE_DYNAMIC_LC */ #ifdef USE_GENERIC_LOADER _XlcAddLoader(_XlcGenericLoader, XlcHead); #endif #ifdef USE_DEFAULT_LOADER _XlcAddLoader(_XlcDefaultLoader, XlcHead); #endif #ifdef USE_UTF8_LOADER _XlcAddLoader(_XlcUtf8Loader, XlcHead); #endif #ifdef USE_DYNAMIC_LOADER _XlcAddLoader(_XlcDynamicLoader, XlcHead); #endif #endif /* USE_DYNAMIC_LC */ } void _XlcDeInitLoader(void) { #ifdef USE_DYNAMIC_LC _XlcRemoveLoader(_XlcDynamicLoad); #else /* USE_DYNAMIC_LC */ #ifdef USE_GENERIC_LOADER _XlcRemoveLoader(_XlcGenericLoader); #endif #ifdef USE_DEFAULT_LOADER _XlcRemoveLoader(_XlcDefaultLoader); #endif #ifdef USE_UTF8_LOADER _XlcRemoveLoader(_XlcUtf8Loader); #endif #ifdef USE_DYNAMIC_LOADER _XlcRemoveLoader(_XlcDynamicLoader); #endif #endif /* USE_DYNAMIC_LC */ } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcPrTxt.c0000644000000000000000000001537313614532331016053 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XlcPubI.h" #include #include static XPointer * alloc_list( Bool is_wide_char, int count, int nitems) { if (is_wide_char) { wchar_t **wstr_list; wstr_list = Xmalloc(count * sizeof(wchar_t *)); if (wstr_list == NULL) return (XPointer *) NULL; *wstr_list = Xmalloc(nitems * sizeof(wchar_t)); if (*wstr_list == NULL) { Xfree(wstr_list); return (XPointer *) NULL; } return (XPointer *) wstr_list; } else { char **str_list; str_list = Xmalloc(count * sizeof(char *)); if (str_list == NULL) return (XPointer *) NULL; *str_list = Xmalloc(nitems); if (*str_list == NULL) { Xfree(str_list); return (XPointer *) NULL; } return (XPointer *) str_list; } } static void copy_list( Bool is_wide_char, XPointer text, XPointer *list, int count) { int length; if (is_wide_char) { wchar_t *wc_text, *wstr, **wstr_list; wc_text = (wchar_t *) text; wstr_list = (wchar_t **) list; for (wstr = *wstr_list; count > 0; count--, wstr_list++) { _Xwcscpy(wstr, wc_text); *wstr_list = wstr; length = _Xwcslen(wstr) + 1; wstr += length; wc_text += length; } } else { char *mb_text, *str, **str_list; mb_text = (char *) text; str_list = (char **) list; for (str = *str_list; count > 0; count--, str_list++) { strcpy(str, mb_text); *str_list = str; length = strlen(str) + 1; str += length; mb_text += length; } } } static int _XTextPropertyToTextList( XLCd lcd, Display *dpy, const XTextProperty *text_prop, const char *to_type, XPointer **list_ret, int *count_ret) { XlcConv conv = NULL; const char *from_type; XPointer from, to, buf; char *str_ptr, *last_ptr; Atom encoding; int from_left, to_left, buf_len, ret, len; int unconv_num, nitems = text_prop->nitems; Bool is_wide_char = False, do_strcpy = False; if (strcmp(XlcNWideChar, to_type) == 0) is_wide_char = True; if (nitems <= 0) { *list_ret = NULL; *count_ret = 0; return Success; } if (text_prop->format != 8) return XConverterNotFound; encoding = text_prop->encoding; if (encoding == XA_STRING) from_type = XlcNString; else if (encoding == XInternAtom(dpy, "UTF8_STRING", False)) from_type = XlcNUtf8String; else if (encoding == XInternAtom(dpy, "COMPOUND_TEXT", False)) from_type = XlcNCompoundText; else if (encoding == XInternAtom(dpy, XLC_PUBLIC(lcd, encoding_name), False)) from_type = XlcNMultiByte; else return XConverterNotFound; if (is_wide_char) { buf_len = (text_prop->nitems + 1) * sizeof(wchar_t); } else { if (strcmp(to_type, XlcNUtf8String) == 0) buf_len = text_prop->nitems * 6 + 1; else buf_len = text_prop->nitems * XLC_PUBLIC(lcd, mb_cur_max) + 1; } buf = Xmalloc(buf_len); if (buf == NULL) return XNoMemory; to = buf; to_left = buf_len; /* can be XlcNMultiByte to XlcNMultiByte, or XlcNUtf8String to XlcNUtf8String */ if (!strcmp(from_type, to_type)) { do_strcpy = True; } else { conv = _XlcOpenConverter(lcd, from_type, lcd, to_type); if (conv == NULL) { Xfree(buf); return XConverterNotFound; } } last_ptr = str_ptr = (char *) text_prop->value; unconv_num = *count_ret = 0; while (1) { if (nitems == 0 || *str_ptr == 0) { from = (XPointer) last_ptr; from_left = str_ptr - last_ptr; last_ptr = str_ptr; if (do_strcpy) { len = min(from_left, to_left); strncpy(to, from, len); from += len; to += len; from_left -= len; to_left -= len; ret = 0; } else { ret = _XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0); } if (ret < 0) continue; unconv_num += ret; (*count_ret)++; if (nitems == 0) break; last_ptr = ++str_ptr; if (is_wide_char) { *((wchar_t *)to) = (wchar_t) 0; to += sizeof(wchar_t); to_left -= sizeof(wchar_t); } else { *((char *)to) = '\0'; to++; to_left--; } if (! do_strcpy) _XlcResetConverter(conv); } else str_ptr++; nitems--; } if (! do_strcpy) _XlcCloseConverter(conv); if (is_wide_char) { *((wchar_t *) to) = (wchar_t) 0; to_left -= sizeof(wchar_t); } else { *((char *) to) = '\0'; to_left--; } *list_ret = alloc_list(is_wide_char, *count_ret, buf_len - to_left); if (*list_ret) copy_list(is_wide_char, buf, *list_ret, *count_ret); Xfree(buf); return unconv_num; } int _XmbTextPropertyToTextList( XLCd lcd, Display *dpy, const XTextProperty *text_prop, char ***list_ret, int *count_ret) { return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNMultiByte, (XPointer **) list_ret, count_ret); } int _XwcTextPropertyToTextList( XLCd lcd, Display *dpy, const XTextProperty *text_prop, wchar_t ***list_ret, int *count_ret) { return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNWideChar, (XPointer **) list_ret, count_ret); } int _Xutf8TextPropertyToTextList( XLCd lcd, Display *dpy, const XTextProperty *text_prop, char ***list_ret, int *count_ret) { return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNUtf8String, (XPointer **) list_ret, count_ret); } void _XwcFreeStringList( XLCd lcd, wchar_t **list) { if (list) { Xfree(*list); Xfree(list); } } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcPublic.c0000644000000000000000000001744513614532331016212 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "XlcPubI.h" static const char * default_string( XLCd lcd) { return XLC_PUBLIC(lcd, default_string); } static XLCd create (const char *name, XLCdMethods methods); static Bool initialize (XLCd lcd); static void destroy (XLCd lcd); static char *get_values (XLCd lcd, XlcArgList args, int num_args); static XLCdPublicMethodsRec publicMethods = { { destroy, _XlcDefaultMapModifiers, NULL, NULL, _XrmDefaultInitParseInfo, _XmbTextPropertyToTextList, _XwcTextPropertyToTextList, _Xutf8TextPropertyToTextList, _XmbTextListToTextProperty, _XwcTextListToTextProperty, _Xutf8TextListToTextProperty, _XwcFreeStringList, default_string, NULL, NULL }, { NULL, create, initialize, destroy, get_values, _XlcGetLocaleDataBase } }; XLCdMethods _XlcPublicMethods = (XLCdMethods) &publicMethods; static XLCd create( const char *name, XLCdMethods methods) { XLCd lcd; XLCdPublicMethods new; lcd = Xcalloc(1, sizeof(XLCdRec)); if (lcd == NULL) return (XLCd) NULL; lcd->core = Xcalloc(1, sizeof(XLCdPublicRec)); if (lcd->core == NULL) goto err; new = Xmalloc(sizeof(XLCdPublicMethodsRec)); if (new == NULL) goto err; memcpy(new,methods,sizeof(XLCdPublicMethodsRec)); lcd->methods = (XLCdMethods) new; return lcd; err: Xfree(lcd->core); Xfree(lcd); return (XLCd) NULL; } static Bool load_public( XLCd lcd) { XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd); char **values; const char *str; int num; if(_XlcCreateLocaleDataBase(lcd) == NULL) return False; _XlcGetResource(lcd, "XLC_XLOCALE", "mb_cur_max", &values, &num); if (num > 0) { pub->mb_cur_max = atoi(values[0]); if (pub->mb_cur_max < 1) pub->mb_cur_max = 1; } else pub->mb_cur_max = 1; _XlcGetResource(lcd, "XLC_XLOCALE", "state_depend_encoding", &values, &num); if (num > 0 && !_XlcCompareISOLatin1(values[0], "True")) pub->is_state_depend = True; else pub->is_state_depend = False; _XlcGetResource(lcd, "XLC_XLOCALE", "encoding_name", &values, &num); str = (num > 0) ? values[0] : "STRING"; pub->encoding_name = strdup(str); if (pub->encoding_name == NULL) return False; return True; } static Bool initialize_core( XLCd lcd) { XLCdMethods methods = lcd->methods; XLCdMethods core = &publicMethods.core; if (methods->close == NULL) methods->close = core->close; if (methods->map_modifiers == NULL) methods->map_modifiers = core->map_modifiers; if (methods->open_om == NULL) #ifdef USE_DYNAMIC_LC _XInitDefaultOM(lcd); #else _XInitOM(lcd); #endif if (methods->open_im == NULL) #ifdef USE_DYNAMIC_LC _XInitDefaultIM(lcd); #else _XInitIM(lcd); #endif if (methods->init_parse_info == NULL) methods->init_parse_info = core->init_parse_info; if (methods->mb_text_prop_to_list == NULL) methods->mb_text_prop_to_list = core->mb_text_prop_to_list; if (methods->wc_text_prop_to_list == NULL) methods->wc_text_prop_to_list = core->wc_text_prop_to_list; if (methods->utf8_text_prop_to_list == NULL) methods->utf8_text_prop_to_list = core->utf8_text_prop_to_list; if (methods->mb_text_list_to_prop == NULL) methods->mb_text_list_to_prop = core->mb_text_list_to_prop; if (methods->wc_text_list_to_prop == NULL) methods->wc_text_list_to_prop = core->wc_text_list_to_prop; if (methods->utf8_text_list_to_prop == NULL) methods->utf8_text_list_to_prop = core->utf8_text_list_to_prop; if (methods->wc_free_string_list == NULL) methods->wc_free_string_list = core->wc_free_string_list; if (methods->default_string == NULL) methods->default_string = core->default_string; return True; } static Bool initialize( XLCd lcd) { XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd); XLCdPublicMethodsPart *pub_methods = &publicMethods.pub; XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd); char *name; #if !defined(X_LOCALE) int len; char sinamebuf[256]; char* siname; #endif _XlcInitCTInfo(); if (initialize_core(lcd) == False) return False; name = lcd->core->name; #if !defined(X_LOCALE) /* * _XlMapOSLocaleName will return the same string or a substring * of name, so strlen(name) is okay */ if ((len = strlen(name)) < sizeof sinamebuf) siname = sinamebuf; else siname = Xmalloc (len + 1); if (siname == NULL) return False; name = _XlcMapOSLocaleName(name, siname); #endif /* _XlcResolveLocaleName will lookup the SI's name for the locale */ if (_XlcResolveLocaleName(name, pub) == 0) { #if !defined(X_LOCALE) if (siname != sinamebuf) Xfree (siname); #endif return False; } #if !defined(X_LOCALE) if (siname != sinamebuf) Xfree (siname); #endif if (pub->default_string == NULL) pub->default_string = ""; if (methods->get_values == NULL) methods->get_values = pub_methods->get_values; if (methods->get_resource == NULL) methods->get_resource = pub_methods->get_resource; return load_public(lcd); } static void destroy_core( XLCd lcd) { if (lcd) { if (lcd->core) { Xfree(lcd->core->name); Xfree(lcd->core); } Xfree(lcd->methods); Xfree(lcd); } } static void destroy( XLCd lcd) { XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd); _XlcDestroyLocaleDataBase(lcd); Xfree(pub->siname); Xfree(pub->encoding_name); destroy_core(lcd); } static XlcResource resources[] = { { XlcNCodeset, NULLQUARK, sizeof(char *), XOffsetOf(XLCdPublicRec, pub.codeset), XlcGetMask }, { XlcNDefaultString, NULLQUARK, sizeof(char *), XOffsetOf(XLCdPublicRec, pub.default_string), XlcGetMask }, { XlcNEncodingName, NULLQUARK, sizeof(char *), XOffsetOf(XLCdPublicRec, pub.encoding_name), XlcGetMask }, { XlcNLanguage, NULLQUARK, sizeof(char *), XOffsetOf(XLCdPublicRec, pub.language), XlcGetMask }, { XlcNMbCurMax, NULLQUARK, sizeof(int), XOffsetOf(XLCdPublicRec, pub.mb_cur_max), XlcGetMask }, { XlcNStateDependentEncoding, NULLQUARK, sizeof(Bool), XOffsetOf(XLCdPublicRec, pub.is_state_depend), XlcGetMask }, { XlcNTerritory, NULLQUARK, sizeof(char *), XOffsetOf(XLCdPublicRec, pub.territory), XlcGetMask } }; static char * get_values( XLCd lcd, XlcArgList args, int num_args) { XLCdPublic pub = (XLCdPublic) lcd->core; if (resources[0].xrm_name == NULLQUARK) _XlcCompileResourceList(resources, XlcNumber(resources)); return _XlcGetValues((XPointer) pub, resources, XlcNumber(resources), args, num_args, XlcGetMask); } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcPubWrap.c0000644000000000000000000000470013614532331016342 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XlcPubI.h" char * _XGetLCValues(XLCd lcd, ...) { va_list var; XlcArgList args; char *ret; int num_args; XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd); va_start(var, lcd); _XlcCountVaList(var, &num_args); va_end(var); va_start(var, lcd); _XlcVaToArgList(var, num_args, &args); va_end(var); if (args == (XlcArgList) NULL) return (char *) NULL; ret = (*methods->get_values)(lcd, args, num_args); Xfree(args); return ret; } void _XlcDestroyLC( XLCd lcd) { XLCdPublicMethods methods = (XLCdPublicMethods) lcd->methods; (*methods->pub.destroy)(lcd); } XLCd _XlcCreateLC( const char *name, XLCdMethods methods) { XLCdPublicMethods pub_methods = (XLCdPublicMethods) methods; XLCd lcd; lcd = (*pub_methods->pub.create)(name, methods); if (lcd == NULL) return (XLCd) NULL; if (lcd->core->name == NULL) { lcd->core->name = strdup(name); if (lcd->core->name == NULL) goto err; } if (lcd->methods == NULL) lcd->methods = methods; if ((*pub_methods->pub.initialize)(lcd) == False) goto err; return lcd; err: _XlcDestroyLC(lcd); return (XLCd) NULL; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcRM.c0000644000000000000000000001257013614532331015304 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp * Bug fixes: Bruno Haible XFree86 Inc. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XlcPubI.h" #include /* * Default implementation of methods for Xrm parsing. */ /* ======================= Unibyte implementation ======================= */ /* Only for efficiency, to speed up things. */ /* This implementation must keep the locale, for lcname. */ typedef struct _UbStateRec { XLCd lcd; } UbStateRec, *UbState; /* Sets the state to the initial state. Initiates a sequence of calls to mbchar. */ static void ub_mbinit( XPointer state) { } /* Transforms one multibyte character, and return a 'char' in the same parsing class. Returns the number of consumed bytes in *lenp. */ static char ub_mbchar( XPointer state, const char *str, int *lenp) { *lenp = 1; return *str; } /* Terminates a sequence of calls to mbchar. */ static void ub_mbfinish( XPointer state) { } /* Returns the name of the state's locale, as a static string. */ static const char * ub_lcname( XPointer state) { return ((UbState) state)->lcd->core->name; } /* Frees the state, which was allocated by _XrmDefaultInitParseInfo. */ static void ub_destroy( XPointer state) { _XCloseLC(((UbState) state)->lcd); Xfree(state); } static const XrmMethodsRec ub_methods = { ub_mbinit, ub_mbchar, ub_mbfinish, ub_lcname, ub_destroy }; /* ======================= Multibyte implementation ======================= */ /* This implementation uses an XlcConv from XlcNMultiByte to XlcNWideChar. */ typedef struct _MbStateRec { XLCd lcd; XlcConv conv; } MbStateRec, *MbState; /* Sets the state to the initial state. Initiates a sequence of calls to mbchar. */ static void mb_mbinit( XPointer state) { _XlcResetConverter(((MbState) state)->conv); } /* Transforms one multibyte character, and return a 'char' in the same parsing class. Returns the number of consumed bytes in *lenp. */ static char mb_mbchar( XPointer state, const char *str, int *lenp) { XlcConv conv = ((MbState) state)->conv; const char *from; wchar_t *to, wc; int cur_max, i, from_left, to_left, ret; cur_max = XLC_PUBLIC(((MbState) state)->lcd, mb_cur_max); from = str; /* Determine from_left. Avoid overrun error which could occur if from_left > strlen(str). */ from_left = cur_max; for (i = 0; i < cur_max; i++) if (str[i] == '\0') { from_left = i; break; } *lenp = from_left; to = &wc; to_left = 1; ret = _XlcConvert(conv, (XPointer *) &from, &from_left, (XPointer *) &to, &to_left, NULL, 0); *lenp -= from_left; if (ret < 0 || to_left > 0) { /* Invalid or incomplete multibyte character seen. */ *lenp = 1; return 0x7f; } /* Return a 'char' equivalent to wc. */ return (wc >= 0 && wc <= 0x7f ? wc : 0x7f); } /* Terminates a sequence of calls to mbchar. */ static void mb_mbfinish( XPointer state) { } /* Returns the name of the state's locale, as a static string. */ static const char * mb_lcname( XPointer state) { return ((MbState) state)->lcd->core->name; } /* Frees the state, which was allocated by _XrmDefaultInitParseInfo. */ static void mb_destroy( XPointer state) { _XlcCloseConverter(((MbState) state)->conv); _XCloseLC(((MbState) state)->lcd); Xfree(state); } static const XrmMethodsRec mb_methods = { mb_mbinit, mb_mbchar, mb_mbfinish, mb_lcname, mb_destroy }; /* ======================= Exported function ======================= */ XrmMethods _XrmDefaultInitParseInfo( XLCd lcd, XPointer *rm_state) { if (XLC_PUBLIC(lcd, mb_cur_max) == 1) { /* Unibyte case. */ UbState state = Xmalloc(sizeof(UbStateRec)); if (state == NULL) return (XrmMethods) NULL; state->lcd = lcd; *rm_state = (XPointer) state; return &ub_methods; } else { /* Multibyte case. */ MbState state = Xmalloc(sizeof(MbStateRec)); if (state == NULL) return (XrmMethods) NULL; state->lcd = lcd; state->conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar); if (state->conv == NULL) { Xfree(state); return (XrmMethods) NULL; } *rm_state = (XPointer) state; return &mb_methods; } } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcStd.c0000644000000000000000000001507613614532331015524 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XlcPubI.h" int _Xlcmbtowc( XLCd lcd, wchar_t *wstr, char *str, int len) { static XLCd last_lcd = NULL; static XlcConv conv = NULL; XPointer from, to; int from_left, to_left; wchar_t tmp_wc; if (lcd == NULL) { lcd = _XlcCurrentLC(); if (lcd == NULL) return -1; } if (str == NULL) return XLC_PUBLIC(lcd, is_state_depend); if (conv && lcd != last_lcd) { _XlcCloseConverter(conv); conv = NULL; } last_lcd = lcd; if (conv == NULL) { conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar); if (conv == NULL) return -1; } from = (XPointer) str; from_left = len; to = (XPointer) (wstr ? wstr : &tmp_wc); to_left = 1; if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) return -1; return (len - from_left); } int _Xlcwctomb( XLCd lcd, char *str, wchar_t wc) { static XLCd last_lcd = NULL; static XlcConv conv = NULL; XPointer from, to; int from_left, to_left, length; if (lcd == NULL) { lcd = _XlcCurrentLC(); if (lcd == NULL) return -1; } if (str == NULL) return XLC_PUBLIC(lcd, is_state_depend); if (conv && lcd != last_lcd) { _XlcCloseConverter(conv); conv = NULL; } last_lcd = lcd; if (conv == NULL) { conv = _XlcOpenConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte); if (conv == NULL) return -1; } from = (XPointer) &wc; from_left = 1; to = (XPointer) str; length = to_left = XLC_PUBLIC(lcd, mb_cur_max); if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) return -1; return (length - to_left); } int _Xlcmbstowcs( XLCd lcd, wchar_t *wstr, char *str, int len) { XlcConv conv; XPointer from, to; int from_left, to_left, ret; if (lcd == NULL) { lcd = _XlcCurrentLC(); if (lcd == NULL) return -1; } conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar); if (conv == NULL) return -1; from = (XPointer) str; from_left = strlen(str); to = (XPointer) wstr; to_left = len; if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) ret = -1; else { ret = len - to_left; if (wstr && to_left > 0) wstr[ret] = (wchar_t) 0; } _XlcCloseConverter(conv); return ret; } int _Xlcwcstombs( XLCd lcd, char *str, wchar_t *wstr, int len) { XlcConv conv; XPointer from, to; int from_left, to_left, ret; if (lcd == NULL) { lcd = _XlcCurrentLC(); if (lcd == NULL) return -1; } conv = _XlcOpenConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte); if (conv == NULL) return -1; from = (XPointer) wstr; from_left = _Xwcslen(wstr); to = (XPointer) str; to_left = len; if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) ret = -1; else { ret = len - to_left; if (str && to_left > 0) str[ret] = '\0'; } _XlcCloseConverter(conv); return ret; } int _Xmbtowc( wchar_t *wstr, char *str, int len ) { return _Xlcmbtowc((XLCd) NULL, wstr, str, len); } int _Xmblen( char *str, int len ) { return _Xmbtowc((wchar_t *) NULL, str, len); } int _Xwctomb( char *str, wchar_t wc) { return _Xlcwctomb((XLCd) NULL, str, wc); } int _Xmbstowcs( wchar_t *wstr, char *str, int len) { return _Xlcmbstowcs((XLCd) NULL, wstr, str, len); } int _Xwcstombs( char *str, wchar_t *wstr, int len) { return _Xlcwcstombs((XLCd) NULL, str, wstr, len); } wchar_t * _Xwcscpy( register wchar_t *wstr1, register wchar_t *wstr2) { wchar_t *wstr_tmp = wstr1; while ((*wstr1++ = *wstr2++)) ; return wstr_tmp; } wchar_t * _Xwcsncpy( register wchar_t *wstr1, register wchar_t *wstr2, register int len) { wchar_t *wstr_tmp = wstr1; while (len-- > 0) if (!(*wstr1++ = *wstr2++)) break; while (len-- > 0) *wstr1++ = (wchar_t) 0; return wstr_tmp; } int _Xwcslen( register wchar_t *wstr) { register wchar_t *wstr_ptr = wstr; while (*wstr_ptr) wstr_ptr++; return wstr_ptr - wstr; } int _Xwcscmp( register wchar_t *wstr1, register wchar_t *wstr2) { for ( ; *wstr1 && *wstr2; wstr1++, wstr2++) if (*wstr1 != *wstr2) break; return *wstr1 - *wstr2; } int _Xwcsncmp( register wchar_t *wstr1, register wchar_t *wstr2, register int len) { for ( ; *wstr1 && *wstr2 && len > 0; wstr1++, wstr2++, len--) if (*wstr1 != *wstr2) break; if (len <= 0) return 0; return *wstr1 - *wstr2; } int _Xlcmbstoutf8( XLCd lcd, char *ustr, const char *str, int len) { XlcConv conv; XPointer from, to; int from_left, to_left, ret; if (lcd == NULL) { lcd = _XlcCurrentLC(); if (lcd == NULL) return -1; } conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNUtf8String); if (conv == NULL) return -1; from = (XPointer) str; from_left = strlen(str); to = (XPointer) ustr; to_left = len; if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) ret = -1; else { ret = len - to_left; if (ustr && to_left > 0) ustr[ret] = '\0'; } _XlcCloseConverter(conv); return ret; } int _Xmbstoutf8( char *ustr, const char *str, int len) { return _Xlcmbstoutf8((XLCd) NULL, ustr, str, len); } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcTxtPr.c0000644000000000000000000001340613614532331016046 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "XlcPubI.h" #include #include #include static int get_buf_size( Bool is_wide_char, XPointer list, int count) { int length = 0; char **mb_list; wchar_t **wc_list; if (list == NULL) return 0; if (is_wide_char) { wc_list = (wchar_t **) list; for ( ; count-- > 0; wc_list++) { if (*wc_list) length += _Xwcslen(*wc_list) + 1; } length *= 5; /* XXX */ } else { mb_list = (char **) list; for ( ; count-- > 0; mb_list++) { if (*mb_list) length += strlen(*mb_list) + 1; } length *= 3; /* XXX */ } length = (length / BUFSIZ + 1) * BUFSIZ; /* XXX */ return length; } static int _XTextListToTextProperty( XLCd lcd, Display *dpy, const char *from_type, XPointer list, int count, XICCEncodingStyle style, XTextProperty *text_prop) { Atom encoding; XlcConv conv; const char *to_type; char **mb_list = NULL; wchar_t **wc_list = NULL; XPointer from; char *to, *buf, *value; int from_left, to_left, buf_len, nitems, unconv_num = 0, ret, i; Bool is_wide_char = False; if (strcmp(XlcNWideChar, from_type) == 0) is_wide_char = True; buf_len = get_buf_size(is_wide_char, list, count); if ((buf = Xmalloc(buf_len)) == NULL) return XNoMemory; switch (style) { case XStringStyle: case XStdICCTextStyle: encoding = XA_STRING; to_type = XlcNString; break; case XUTF8StringStyle: encoding = XInternAtom(dpy, "UTF8_STRING", False); to_type = XlcNUtf8String; break; case XCompoundTextStyle: encoding = XInternAtom(dpy, "COMPOUND_TEXT", False); to_type = XlcNCompoundText; break; case XTextStyle: encoding = XInternAtom(dpy, XLC_PUBLIC(lcd, encoding_name), False); to_type = XlcNMultiByte; if (is_wide_char == False) { nitems = 0; mb_list = (char **) list; to = buf; for (i = 0; i < count && buf_len > 0; i++) { if (*mb_list) strcpy(to, *mb_list); else *to = '\0'; from_left = (*mb_list ? strlen(*mb_list) : 0) + 1; nitems += from_left; to += from_left; mb_list++; } unconv_num = 0; goto done; } break; default: Xfree(buf); return XConverterNotFound; } if (count < 1) { nitems = 0; goto done; } retry: conv = _XlcOpenConverter(lcd, from_type, lcd, to_type); if (conv == NULL) { Xfree(buf); return XConverterNotFound; } if (is_wide_char) wc_list = (wchar_t **) list; else mb_list = (char **) list; to = buf; to_left = buf_len; unconv_num = 0; for (i = 1; to_left > 0; i++) { if (is_wide_char) { from = (XPointer) *wc_list; from_left = _Xwcslen(*wc_list); wc_list++; } else { from = (XPointer) *mb_list; from_left = (*mb_list ? strlen(*mb_list) : 0); mb_list++; } ret = _XlcConvert(conv, &from, &from_left, (XPointer *) &to, &to_left, NULL, 0); if (ret < 0) continue; if (ret > 0 && style == XStdICCTextStyle && encoding == XA_STRING) { _XlcCloseConverter(conv); encoding = XInternAtom(dpy, "COMPOUND_TEXT", False); to_type = XlcNCompoundText; goto retry; } unconv_num += ret; *to++ = '\0'; to_left--; if (i >= count) break; _XlcResetConverter(conv); } _XlcCloseConverter(conv); nitems = to - buf; done: if (nitems <= 0) nitems = 1; value = Xmalloc(nitems); if (value == NULL) { Xfree(buf); return XNoMemory; } if (nitems == 1) *value = 0; else memcpy(value, buf, nitems); nitems--; Xfree(buf); text_prop->value = (unsigned char *) value; text_prop->encoding = encoding; text_prop->format = 8; text_prop->nitems = nitems; return unconv_num; } int _XmbTextListToTextProperty( XLCd lcd, Display *dpy, char **list, int count, XICCEncodingStyle style, XTextProperty *text_prop) { return _XTextListToTextProperty(lcd, dpy, XlcNMultiByte, (XPointer) list, count, style, text_prop); } int _XwcTextListToTextProperty( XLCd lcd, Display *dpy, wchar_t **list, int count, XICCEncodingStyle style, XTextProperty *text_prop) { return _XTextListToTextProperty(lcd, dpy, XlcNWideChar, (XPointer) list, count, style, text_prop); } int _Xutf8TextListToTextProperty( XLCd lcd, Display *dpy, char **list, int count, XICCEncodingStyle style, XTextProperty *text_prop) { return _XTextListToTextProperty(lcd, dpy, XlcNUtf8String, (XPointer) list, count, style, text_prop); } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/armscii_8.h0000644000000000000000000000651113614532331020230 0ustar /* * ARMSCII-8 */ static const unsigned short armscii_8_2uni[96] = { /* 0xa0 */ 0x00a0, 0xfffd, 0x0587, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, 0x2014, 0x002e, 0x055d, 0x002c, 0x002d, 0x058a, 0x2026, 0x055c, /* 0xb0 */ 0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, 0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, /* 0xc0 */ 0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, 0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, /* 0xd0 */ 0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, 0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, /* 0xe0 */ 0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, 0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, /* 0xf0 */ 0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x055a, 0xfffd, }; static int armscii_8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0xa0) { *pwc = (ucs4_t) c; return 1; } else { unsigned short wc = armscii_8_2uni[c-0xa0]; if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 1; } } return RET_ILSEQ; } static const unsigned char armscii_8_page00[8] = { 0xa5, 0xa4, 0x2a, 0x2b, 0xab, 0xac, 0xa9, 0x2f, /* 0x28-0x2f */ }; static const unsigned char armscii_8_page00_1[32] = { 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ }; static const unsigned char armscii_8_page05[96] = { 0x00, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, /* 0x30-0x37 */ 0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, /* 0x38-0x3f */ 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, /* 0x40-0x47 */ 0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, /* 0x48-0x4f */ 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0xfe, 0xb0, 0xaf, 0xaa, 0xb1, 0x00, /* 0x58-0x5f */ 0x00, 0xb3, 0xb5, 0xb7, 0xb9, 0xbb, 0xbd, 0xbf, /* 0x60-0x67 */ 0xc1, 0xc3, 0xc5, 0xc7, 0xc9, 0xcb, 0xcd, 0xcf, /* 0x68-0x6f */ 0xd1, 0xd3, 0xd5, 0xd7, 0xd9, 0xdb, 0xdd, 0xdf, /* 0x70-0x77 */ 0xe1, 0xe3, 0xe5, 0xe7, 0xe9, 0xeb, 0xed, 0xef, /* 0x78-0x7f */ 0xf1, 0xf3, 0xf5, 0xf7, 0xf9, 0xfb, 0xfd, 0xa2, /* 0x80-0x87 */ 0x00, 0xa3, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ }; static const unsigned char armscii_8_page20[24] = { 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0x00, /* 0x20-0x27 */ }; static int armscii_8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x0028) { *r = wc; return 1; } else if (wc >= 0x0028 && wc < 0x0030) c = armscii_8_page00[wc-0x0028]; else if (wc >= 0x0030 && wc < 0x00a0) c = wc; else if (wc >= 0x00a0 && wc < 0x00c0) c = armscii_8_page00_1[wc-0x00a0]; else if (wc >= 0x0530 && wc < 0x0590) c = armscii_8_page05[wc-0x0530]; else if (wc >= 0x2010 && wc < 0x2028) c = armscii_8_page20[wc-0x2010]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/big5_emacs.h0000644000000000000000000001107213614532331020346 0ustar /* * BIG5-0 and BIG5-1 */ /* BIG5 with its 13494 characters doesn't fit in a single 94x94 or 96x96 block. Therefore Emacs/Mule developers, in a typically Japanese way of thinking, have developed an alternative encoding of BIG5 in two 94x94 planes, very similar to the SHIFT_JIS encoding for JISX0208. Conversion between BIG5 codes (s1,s2) and BIG5-0 codes (c1,c2): Example. (s1,s2) = 0xA140, (c1,c2) = 0x2121. 0xA1 <= s1 <= 0xC7, 0x40 <= s2 <= 0x7E || 0xA1 <= s2 <= 0xFE, 0x21 <= c1 <= 0x62, 0x21 <= c2 <= 0x7E. Invariant: 157*(s1-0xA1) + (s2 < 0x80 ? s2-0x40 : s2-0x62) = 94*(c1-0x21)+(c2-0x21) Conversion (s1,s2) -> (c1,c2): t := 157*(s1-0xA1) + (s2 < 0x80 ? s2-0x40 : s2-0x62) c1 := (t div 94) + 0x21 c2 := (t mod 94) + 0x21 Conversion (c1,c2) -> (s1,s2): t := 94*(c1-0x21)+(c2-0x21) t2 := t mod 157 s1 := (t div 157) + 0xA1 s2 := (t2 < 0x3F ? t2+0x40 : t2+0x62) Conversion between BIG5 codes (s1,s2) and BIG5-1 codes (c1,c2): Example. (s1,s2) = 0xC940, (c1,c2) = 0x2121. 0xC9 <= s1 <= 0xF9, 0x40 <= s2 <= 0x7E || 0xA1 <= s2 <= 0xFE, 0x21 <= c1 <= 0x72, 0x21 <= c2 <= 0x7E. Invariant: 157*(s1-0xC9) + (s2 < 0x80 ? s2-0x40 : s2-0x62) = 94*(c1-0x21)+(c2-0x21) Conversion (s1,s2) -> (c1,c2): t := 157*(s1-0xC9) + (s2 < 0x80 ? s2-0x40 : s2-0x62) c1 := (t div 94) + 0x21 c2 := (t mod 94) + 0x21 Conversion (c1,c2) -> (s1,s2): t := 94*(c1-0x21)+(c2-0x21) t2 := t mod 157 s1 := (t div 157) + 0xC9 s2 := (t2 < 0x3F ? t2+0x40 : t2+0x62) */ static int big5_0_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c1 = s[0]; if (c1 >= 0x21 && c1 <= 0x62) { if (n >= 2) { unsigned char c2 = s[1]; if (c2 >= 0x21 && c2 <= 0x7e) { unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); if (0) { /* Unoptimized. */ unsigned char buf[2]; buf[0] = (i / 157) + 0xa1; i = i % 157; buf[1] = i + (i < 0x3f ? 0x40 : 0x62); return big5_mbtowc(conv,pwc,buf,2); } else { /* Inline the implementation of big5_mbtowc. */ if (i < 6121) { unsigned short wc = big5_2uni_pagea1[i]; if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 2; } } } } return RET_ILSEQ; } return RET_TOOFEW(0); } return RET_ILSEQ; } static int big5_1_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c1 = s[0]; if (c1 >= 0x21 && c1 <= 0x72) { if (n >= 2) { unsigned char c2 = s[1]; if (c2 >= 0x21 && c2 <= 0x7e) { unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); if (0) { /* Unoptimized. */ unsigned char buf[2]; buf[0] = (i / 157) + 0xc9; i = i % 157; buf[1] = i + (i < 0x3f ? 0x40 : 0x62); return big5_mbtowc(conv,pwc,buf,2); } else { /* Inline the implementation of big5_mbtowc. */ if (i < 7652) { unsigned short wc = big5_2uni_pagec9[i]; if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 2; } } } } return RET_ILSEQ; } return RET_TOOFEW(0); } return RET_ILSEQ; } static int big5_0_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { if (n >= 2) { unsigned char buf[2]; int ret = big5_wctomb(conv,buf,wc,2); if (ret != RET_ILSEQ) { unsigned char s1, s2; if (ret != 2) abort(); s1 = buf[0]; s2 = buf[1]; if (!(s1 >= 0xa1)) abort(); if (!((s2 >= 0x40 && s2 <= 0x7e) || (s2 >= 0xa1 && s2 <= 0xfe))) abort(); if (s1 < 0xc9) { unsigned int t = 157 * (s1 - 0xa1) + s2 - (s2 < 0x80 ? 0x40 : 0x62); r[0] = (t / 94) + 0x21; r[1] = (t % 94) + 0x21; return 2; } } return RET_ILSEQ; } return RET_TOOSMALL; } static int big5_1_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { if (n >= 2) { unsigned char buf[2]; int ret = big5_wctomb(conv,buf,wc,2); if (ret != RET_ILSEQ) { unsigned char s1, s2; if (ret != 2) abort(); s1 = buf[0]; s2 = buf[1]; if (!(s1 <= 0xf9)) abort(); if (!((s2 >= 0x40 && s2 <= 0x7e) || (s2 >= 0xa1 && s2 <= 0xfe))) abort(); if (s1 >= 0xc9) { unsigned int t = 157 * (s1 - 0xc9) + s2 - (s2 < 0x80 ? 0x40 : 0x62); r[0] = (t / 94) + 0x21; r[1] = (t % 94) + 0x21; return 2; } } return RET_ILSEQ; } return RET_TOOSMALL; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/big5.h0000644000000000000000000077570113614532331017216 0ustar /* * BIG5 */ static const unsigned short big5_2uni_pagea1[6121] = { /* 0xa1 */ 0x3000, 0xff0c, 0x3001, 0x3002, 0xff0e, 0x2022, 0xff1b, 0xff1a, 0xff1f, 0xff01, 0xfe30, 0x2026, 0x2025, 0xfe50, 0xff64, 0xfe52, 0x00b7, 0xfe54, 0xfe55, 0xfe56, 0xfe57, 0xff5c, 0x2013, 0xfe31, 0x2014, 0xfe33, 0xfffd, 0xfe34, 0xfe4f, 0xff08, 0xff09, 0xfe35, 0xfe36, 0xff5b, 0xff5d, 0xfe37, 0xfe38, 0x3014, 0x3015, 0xfe39, 0xfe3a, 0x3010, 0x3011, 0xfe3b, 0xfe3c, 0x300a, 0x300b, 0xfe3d, 0xfe3e, 0x3008, 0x3009, 0xfe3f, 0xfe40, 0x300c, 0x300d, 0xfe41, 0xfe42, 0x300e, 0x300f, 0xfe43, 0xfe44, 0xfe59, 0xfe5a, 0xfe5b, 0xfe5c, 0xfe5d, 0xfe5e, 0x2018, 0x2019, 0x201c, 0x201d, 0x301d, 0x301e, 0x2035, 0x2032, 0xff03, 0xff06, 0xff0a, 0x203b, 0x00a7, 0x3003, 0x25cb, 0x25cf, 0x25b3, 0x25b2, 0x25ce, 0x2606, 0x2605, 0x25c7, 0x25c6, 0x25a1, 0x25a0, 0x25bd, 0x25bc, 0x32a3, 0x2105, 0x203e, 0xfffd, 0xff3f, 0xfffd, 0xfe49, 0xfe4a, 0xfe4d, 0xfe4e, 0xfe4b, 0xfe4c, 0xfe5f, 0xfe60, 0xfe61, 0xff0b, 0xff0d, 0x00d7, 0x00f7, 0x00b1, 0x221a, 0xff1c, 0xff1e, 0xff1d, 0x2266, 0x2267, 0x2260, 0x221e, 0x2252, 0x2261, 0xfe62, 0xfe63, 0xfe64, 0xfe65, 0xfe66, 0x223c, 0x2229, 0x222a, 0x22a5, 0x2220, 0x221f, 0x22bf, 0x33d2, 0x33d1, 0x222b, 0x222e, 0x2235, 0x2234, 0x2640, 0x2642, 0x2641, 0x2609, 0x2191, 0x2193, 0x2190, 0x2192, 0x2196, 0x2197, 0x2199, 0x2198, 0x2225, 0x2223, 0xfffd, /* 0xa2 */ 0xfffd, 0xff0f, 0xff3c, 0xff04, 0x00a5, 0x3012, 0x00a2, 0x00a3, 0xff05, 0xff20, 0x2103, 0x2109, 0xfe69, 0xfe6a, 0xfe6b, 0x33d5, 0x339c, 0x339d, 0x339e, 0x33ce, 0x33a1, 0x338e, 0x338f, 0x33c4, 0x00b0, 0x5159, 0x515b, 0x515e, 0x515d, 0x5161, 0x5163, 0x55e7, 0x74e9, 0x7cce, 0x2581, 0x2582, 0x2583, 0x2584, 0x2585, 0x2586, 0x2587, 0x2588, 0x258f, 0x258e, 0x258d, 0x258c, 0x258b, 0x258a, 0x2589, 0x253c, 0x2534, 0x252c, 0x2524, 0x251c, 0x2594, 0x2500, 0x2502, 0x2595, 0x250c, 0x2510, 0x2514, 0x2518, 0x256d, 0x256e, 0x2570, 0x256f, 0x2550, 0x255e, 0x256a, 0x2561, 0x25e2, 0x25e3, 0x25e5, 0x25e4, 0x2571, 0x2572, 0x2573, 0xff10, 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, 0xff19, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027, 0x3028, 0x3029, 0xfffd, 0x5344, 0xfffd, 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, /* 0xa3 */ 0xff57, 0xff58, 0xff59, 0xff5a, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x3105, 0x3106, 0x3107, 0x3108, 0x3109, 0x310a, 0x310b, 0x310c, 0x310d, 0x310e, 0x310f, 0x3110, 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, 0x3117, 0x3118, 0x3119, 0x311a, 0x311b, 0x311c, 0x311d, 0x311e, 0x311f, 0x3120, 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, 0x3129, 0x02d9, 0x02c9, 0x02ca, 0x02c7, 0x02cb, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xa4 */ 0x4e00, 0x4e59, 0x4e01, 0x4e03, 0x4e43, 0x4e5d, 0x4e86, 0x4e8c, 0x4eba, 0x513f, 0x5165, 0x516b, 0x51e0, 0x5200, 0x5201, 0x529b, 0x5315, 0x5341, 0x535c, 0x53c8, 0x4e09, 0x4e0b, 0x4e08, 0x4e0a, 0x4e2b, 0x4e38, 0x51e1, 0x4e45, 0x4e48, 0x4e5f, 0x4e5e, 0x4e8e, 0x4ea1, 0x5140, 0x5203, 0x52fa, 0x5343, 0x53c9, 0x53e3, 0x571f, 0x58eb, 0x5915, 0x5927, 0x5973, 0x5b50, 0x5b51, 0x5b53, 0x5bf8, 0x5c0f, 0x5c22, 0x5c38, 0x5c71, 0x5ddd, 0x5de5, 0x5df1, 0x5df2, 0x5df3, 0x5dfe, 0x5e72, 0x5efe, 0x5f0b, 0x5f13, 0x624d, 0x4e11, 0x4e10, 0x4e0d, 0x4e2d, 0x4e30, 0x4e39, 0x4e4b, 0x5c39, 0x4e88, 0x4e91, 0x4e95, 0x4e92, 0x4e94, 0x4ea2, 0x4ec1, 0x4ec0, 0x4ec3, 0x4ec6, 0x4ec7, 0x4ecd, 0x4eca, 0x4ecb, 0x4ec4, 0x5143, 0x5141, 0x5167, 0x516d, 0x516e, 0x516c, 0x5197, 0x51f6, 0x5206, 0x5207, 0x5208, 0x52fb, 0x52fe, 0x52ff, 0x5316, 0x5339, 0x5348, 0x5347, 0x5345, 0x535e, 0x5384, 0x53cb, 0x53ca, 0x53cd, 0x58ec, 0x5929, 0x592b, 0x592a, 0x592d, 0x5b54, 0x5c11, 0x5c24, 0x5c3a, 0x5c6f, 0x5df4, 0x5e7b, 0x5eff, 0x5f14, 0x5f15, 0x5fc3, 0x6208, 0x6236, 0x624b, 0x624e, 0x652f, 0x6587, 0x6597, 0x65a4, 0x65b9, 0x65e5, 0x66f0, 0x6708, 0x6728, 0x6b20, 0x6b62, 0x6b79, 0x6bcb, 0x6bd4, 0x6bdb, 0x6c0f, 0x6c34, 0x706b, 0x722a, 0x7236, 0x723b, 0x7247, 0x7259, 0x725b, 0x72ac, 0x738b, 0x4e19, /* 0xa5 */ 0x4e16, 0x4e15, 0x4e14, 0x4e18, 0x4e3b, 0x4e4d, 0x4e4f, 0x4e4e, 0x4ee5, 0x4ed8, 0x4ed4, 0x4ed5, 0x4ed6, 0x4ed7, 0x4ee3, 0x4ee4, 0x4ed9, 0x4ede, 0x5145, 0x5144, 0x5189, 0x518a, 0x51ac, 0x51f9, 0x51fa, 0x51f8, 0x520a, 0x52a0, 0x529f, 0x5305, 0x5306, 0x5317, 0x531d, 0x4edf, 0x534a, 0x5349, 0x5361, 0x5360, 0x536f, 0x536e, 0x53bb, 0x53ef, 0x53e4, 0x53f3, 0x53ec, 0x53ee, 0x53e9, 0x53e8, 0x53fc, 0x53f8, 0x53f5, 0x53eb, 0x53e6, 0x53ea, 0x53f2, 0x53f1, 0x53f0, 0x53e5, 0x53ed, 0x53fb, 0x56db, 0x56da, 0x5916, 0x592e, 0x5931, 0x5974, 0x5976, 0x5b55, 0x5b83, 0x5c3c, 0x5de8, 0x5de7, 0x5de6, 0x5e02, 0x5e03, 0x5e73, 0x5e7c, 0x5f01, 0x5f18, 0x5f17, 0x5fc5, 0x620a, 0x6253, 0x6254, 0x6252, 0x6251, 0x65a5, 0x65e6, 0x672e, 0x672c, 0x672a, 0x672b, 0x672d, 0x6b63, 0x6bcd, 0x6c11, 0x6c10, 0x6c38, 0x6c41, 0x6c40, 0x6c3e, 0x72af, 0x7384, 0x7389, 0x74dc, 0x74e6, 0x7518, 0x751f, 0x7528, 0x7529, 0x7530, 0x7531, 0x7532, 0x7533, 0x758b, 0x767d, 0x76ae, 0x76bf, 0x76ee, 0x77db, 0x77e2, 0x77f3, 0x793a, 0x79be, 0x7a74, 0x7acb, 0x4e1e, 0x4e1f, 0x4e52, 0x4e53, 0x4e69, 0x4e99, 0x4ea4, 0x4ea6, 0x4ea5, 0x4eff, 0x4f09, 0x4f19, 0x4f0a, 0x4f15, 0x4f0d, 0x4f10, 0x4f11, 0x4f0f, 0x4ef2, 0x4ef6, 0x4efb, 0x4ef0, 0x4ef3, 0x4efd, 0x4f01, 0x4f0b, 0x5149, 0x5147, 0x5146, 0x5148, 0x5168, /* 0xa6 */ 0x5171, 0x518d, 0x51b0, 0x5217, 0x5211, 0x5212, 0x520e, 0x5216, 0x52a3, 0x5308, 0x5321, 0x5320, 0x5370, 0x5371, 0x5409, 0x540f, 0x540c, 0x540a, 0x5410, 0x5401, 0x540b, 0x5404, 0x5411, 0x540d, 0x5408, 0x5403, 0x540e, 0x5406, 0x5412, 0x56e0, 0x56de, 0x56dd, 0x5733, 0x5730, 0x5728, 0x572d, 0x572c, 0x572f, 0x5729, 0x5919, 0x591a, 0x5937, 0x5938, 0x5984, 0x5978, 0x5983, 0x597d, 0x5979, 0x5982, 0x5981, 0x5b57, 0x5b58, 0x5b87, 0x5b88, 0x5b85, 0x5b89, 0x5bfa, 0x5c16, 0x5c79, 0x5dde, 0x5e06, 0x5e76, 0x5e74, 0x5f0f, 0x5f1b, 0x5fd9, 0x5fd6, 0x620e, 0x620c, 0x620d, 0x6210, 0x6263, 0x625b, 0x6258, 0x6536, 0x65e9, 0x65e8, 0x65ec, 0x65ed, 0x66f2, 0x66f3, 0x6709, 0x673d, 0x6734, 0x6731, 0x6735, 0x6b21, 0x6b64, 0x6b7b, 0x6c16, 0x6c5d, 0x6c57, 0x6c59, 0x6c5f, 0x6c60, 0x6c50, 0x6c55, 0x6c61, 0x6c5b, 0x6c4d, 0x6c4e, 0x7070, 0x725f, 0x725d, 0x767e, 0x7af9, 0x7c73, 0x7cf8, 0x7f36, 0x7f8a, 0x7fbd, 0x8001, 0x8003, 0x800c, 0x8012, 0x8033, 0x807f, 0x8089, 0x808b, 0x808c, 0x81e3, 0x81ea, 0x81f3, 0x81fc, 0x820c, 0x821b, 0x821f, 0x826e, 0x8272, 0x827e, 0x866b, 0x8840, 0x884c, 0x8863, 0x897f, 0x9621, 0x4e32, 0x4ea8, 0x4f4d, 0x4f4f, 0x4f47, 0x4f57, 0x4f5e, 0x4f34, 0x4f5b, 0x4f55, 0x4f30, 0x4f50, 0x4f51, 0x4f3d, 0x4f3a, 0x4f38, 0x4f43, 0x4f54, 0x4f3c, 0x4f46, 0x4f63, /* 0xa7 */ 0x4f5c, 0x4f60, 0x4f2f, 0x4f4e, 0x4f36, 0x4f59, 0x4f5d, 0x4f48, 0x4f5a, 0x514c, 0x514b, 0x514d, 0x5175, 0x51b6, 0x51b7, 0x5225, 0x5224, 0x5229, 0x522a, 0x5228, 0x52ab, 0x52a9, 0x52aa, 0x52ac, 0x5323, 0x5373, 0x5375, 0x541d, 0x542d, 0x541e, 0x543e, 0x5426, 0x544e, 0x5427, 0x5446, 0x5443, 0x5433, 0x5448, 0x5442, 0x541b, 0x5429, 0x544a, 0x5439, 0x543b, 0x5438, 0x542e, 0x5435, 0x5436, 0x5420, 0x543c, 0x5440, 0x5431, 0x542b, 0x541f, 0x542c, 0x56ea, 0x56f0, 0x56e4, 0x56eb, 0x574a, 0x5751, 0x5740, 0x574d, 0x5747, 0x574e, 0x573e, 0x5750, 0x574f, 0x573b, 0x58ef, 0x593e, 0x599d, 0x5992, 0x59a8, 0x599e, 0x59a3, 0x5999, 0x5996, 0x598d, 0x59a4, 0x5993, 0x598a, 0x59a5, 0x5b5d, 0x5b5c, 0x5b5a, 0x5b5b, 0x5b8c, 0x5b8b, 0x5b8f, 0x5c2c, 0x5c40, 0x5c41, 0x5c3f, 0x5c3e, 0x5c90, 0x5c91, 0x5c94, 0x5c8c, 0x5deb, 0x5e0c, 0x5e8f, 0x5e87, 0x5e8a, 0x5ef7, 0x5f04, 0x5f1f, 0x5f64, 0x5f62, 0x5f77, 0x5f79, 0x5fd8, 0x5fcc, 0x5fd7, 0x5fcd, 0x5ff1, 0x5feb, 0x5ff8, 0x5fea, 0x6212, 0x6211, 0x6284, 0x6297, 0x6296, 0x6280, 0x6276, 0x6289, 0x626d, 0x628a, 0x627c, 0x627e, 0x6279, 0x6273, 0x6292, 0x626f, 0x6298, 0x626e, 0x6295, 0x6293, 0x6291, 0x6286, 0x6539, 0x653b, 0x6538, 0x65f1, 0x66f4, 0x675f, 0x674e, 0x674f, 0x6750, 0x6751, 0x675c, 0x6756, 0x675e, 0x6749, 0x6746, 0x6760, /* 0xa8 */ 0x6753, 0x6757, 0x6b65, 0x6bcf, 0x6c42, 0x6c5e, 0x6c99, 0x6c81, 0x6c88, 0x6c89, 0x6c85, 0x6c9b, 0x6c6a, 0x6c7a, 0x6c90, 0x6c70, 0x6c8c, 0x6c68, 0x6c96, 0x6c92, 0x6c7d, 0x6c83, 0x6c72, 0x6c7e, 0x6c74, 0x6c86, 0x6c76, 0x6c8d, 0x6c94, 0x6c98, 0x6c82, 0x7076, 0x707c, 0x707d, 0x7078, 0x7262, 0x7261, 0x7260, 0x72c4, 0x72c2, 0x7396, 0x752c, 0x752b, 0x7537, 0x7538, 0x7682, 0x76ef, 0x77e3, 0x79c1, 0x79c0, 0x79bf, 0x7a76, 0x7cfb, 0x7f55, 0x8096, 0x8093, 0x809d, 0x8098, 0x809b, 0x809a, 0x80b2, 0x826f, 0x8292, 0x828b, 0x828d, 0x898b, 0x89d2, 0x8a00, 0x8c37, 0x8c46, 0x8c55, 0x8c9d, 0x8d64, 0x8d70, 0x8db3, 0x8eab, 0x8eca, 0x8f9b, 0x8fb0, 0x8fc2, 0x8fc6, 0x8fc5, 0x8fc4, 0x5de1, 0x9091, 0x90a2, 0x90aa, 0x90a6, 0x90a3, 0x9149, 0x91c6, 0x91cc, 0x9632, 0x962e, 0x9631, 0x962a, 0x962c, 0x4e26, 0x4e56, 0x4e73, 0x4e8b, 0x4e9b, 0x4e9e, 0x4eab, 0x4eac, 0x4f6f, 0x4f9d, 0x4f8d, 0x4f73, 0x4f7f, 0x4f6c, 0x4f9b, 0x4f8b, 0x4f86, 0x4f83, 0x4f70, 0x4f75, 0x4f88, 0x4f69, 0x4f7b, 0x4f96, 0x4f7e, 0x4f8f, 0x4f91, 0x4f7a, 0x5154, 0x5152, 0x5155, 0x5169, 0x5177, 0x5176, 0x5178, 0x51bd, 0x51fd, 0x523b, 0x5238, 0x5237, 0x523a, 0x5230, 0x522e, 0x5236, 0x5241, 0x52be, 0x52bb, 0x5352, 0x5354, 0x5353, 0x5351, 0x5366, 0x5377, 0x5378, 0x5379, 0x53d6, 0x53d4, 0x53d7, 0x5473, 0x5475, /* 0xa9 */ 0x5496, 0x5478, 0x5495, 0x5480, 0x547b, 0x5477, 0x5484, 0x5492, 0x5486, 0x547c, 0x5490, 0x5471, 0x5476, 0x548c, 0x549a, 0x5462, 0x5468, 0x548b, 0x547d, 0x548e, 0x56fa, 0x5783, 0x5777, 0x576a, 0x5769, 0x5761, 0x5766, 0x5764, 0x577c, 0x591c, 0x5949, 0x5947, 0x5948, 0x5944, 0x5954, 0x59be, 0x59bb, 0x59d4, 0x59b9, 0x59ae, 0x59d1, 0x59c6, 0x59d0, 0x59cd, 0x59cb, 0x59d3, 0x59ca, 0x59af, 0x59b3, 0x59d2, 0x59c5, 0x5b5f, 0x5b64, 0x5b63, 0x5b97, 0x5b9a, 0x5b98, 0x5b9c, 0x5b99, 0x5b9b, 0x5c1a, 0x5c48, 0x5c45, 0x5c46, 0x5cb7, 0x5ca1, 0x5cb8, 0x5ca9, 0x5cab, 0x5cb1, 0x5cb3, 0x5e18, 0x5e1a, 0x5e16, 0x5e15, 0x5e1b, 0x5e11, 0x5e78, 0x5e9a, 0x5e97, 0x5e9c, 0x5e95, 0x5e96, 0x5ef6, 0x5f26, 0x5f27, 0x5f29, 0x5f80, 0x5f81, 0x5f7f, 0x5f7c, 0x5fdd, 0x5fe0, 0x5ffd, 0x5ff5, 0x5fff, 0x600f, 0x6014, 0x602f, 0x6035, 0x6016, 0x602a, 0x6015, 0x6021, 0x6027, 0x6029, 0x602b, 0x601b, 0x6216, 0x6215, 0x623f, 0x623e, 0x6240, 0x627f, 0x62c9, 0x62cc, 0x62c4, 0x62bf, 0x62c2, 0x62b9, 0x62d2, 0x62db, 0x62ab, 0x62d3, 0x62d4, 0x62cb, 0x62c8, 0x62a8, 0x62bd, 0x62bc, 0x62d0, 0x62d9, 0x62c7, 0x62cd, 0x62b5, 0x62da, 0x62b1, 0x62d8, 0x62d6, 0x62d7, 0x62c6, 0x62ac, 0x62ce, 0x653e, 0x65a7, 0x65bc, 0x65fa, 0x6614, 0x6613, 0x660c, 0x6606, 0x6602, 0x660e, 0x6600, 0x660f, 0x6615, 0x660a, /* 0xaa */ 0x6607, 0x670d, 0x670b, 0x676d, 0x678b, 0x6795, 0x6771, 0x679c, 0x6773, 0x6777, 0x6787, 0x679d, 0x6797, 0x676f, 0x6770, 0x677f, 0x6789, 0x677e, 0x6790, 0x6775, 0x679a, 0x6793, 0x677c, 0x676a, 0x6772, 0x6b23, 0x6b66, 0x6b67, 0x6b7f, 0x6c13, 0x6c1b, 0x6ce3, 0x6ce8, 0x6cf3, 0x6cb1, 0x6ccc, 0x6ce5, 0x6cb3, 0x6cbd, 0x6cbe, 0x6cbc, 0x6ce2, 0x6cab, 0x6cd5, 0x6cd3, 0x6cb8, 0x6cc4, 0x6cb9, 0x6cc1, 0x6cae, 0x6cd7, 0x6cc5, 0x6cf1, 0x6cbf, 0x6cbb, 0x6ce1, 0x6cdb, 0x6cca, 0x6cac, 0x6cef, 0x6cdc, 0x6cd6, 0x6ce0, 0x7095, 0x708e, 0x7092, 0x708a, 0x7099, 0x722c, 0x722d, 0x7238, 0x7248, 0x7267, 0x7269, 0x72c0, 0x72ce, 0x72d9, 0x72d7, 0x72d0, 0x73a9, 0x73a8, 0x739f, 0x73ab, 0x73a5, 0x753d, 0x759d, 0x7599, 0x759a, 0x7684, 0x76c2, 0x76f2, 0x76f4, 0x77e5, 0x77fd, 0x793e, 0x7940, 0x7941, 0x79c9, 0x79c8, 0x7a7a, 0x7a79, 0x7afa, 0x7cfe, 0x7f54, 0x7f8c, 0x7f8b, 0x8005, 0x80ba, 0x80a5, 0x80a2, 0x80b1, 0x80a1, 0x80ab, 0x80a9, 0x80b4, 0x80aa, 0x80af, 0x81e5, 0x81fe, 0x820d, 0x82b3, 0x829d, 0x8299, 0x82ad, 0x82bd, 0x829f, 0x82b9, 0x82b1, 0x82ac, 0x82a5, 0x82af, 0x82b8, 0x82a3, 0x82b0, 0x82be, 0x82b7, 0x864e, 0x8671, 0x521d, 0x8868, 0x8ecb, 0x8fce, 0x8fd4, 0x8fd1, 0x90b5, 0x90b8, 0x90b1, 0x90b6, 0x91c7, 0x91d1, 0x9577, 0x9580, 0x961c, 0x9640, 0x963f, 0x963b, 0x9644, /* 0xab */ 0x9642, 0x96b9, 0x96e8, 0x9752, 0x975e, 0x4e9f, 0x4ead, 0x4eae, 0x4fe1, 0x4fb5, 0x4faf, 0x4fbf, 0x4fe0, 0x4fd1, 0x4fcf, 0x4fdd, 0x4fc3, 0x4fb6, 0x4fd8, 0x4fdf, 0x4fca, 0x4fd7, 0x4fae, 0x4fd0, 0x4fc4, 0x4fc2, 0x4fda, 0x4fce, 0x4fde, 0x4fb7, 0x5157, 0x5192, 0x5191, 0x51a0, 0x524e, 0x5243, 0x524a, 0x524d, 0x524c, 0x524b, 0x5247, 0x52c7, 0x52c9, 0x52c3, 0x52c1, 0x530d, 0x5357, 0x537b, 0x539a, 0x53db, 0x54ac, 0x54c0, 0x54a8, 0x54ce, 0x54c9, 0x54b8, 0x54a6, 0x54b3, 0x54c7, 0x54c2, 0x54bd, 0x54aa, 0x54c1, 0x54c4, 0x54c8, 0x54af, 0x54ab, 0x54b1, 0x54bb, 0x54a9, 0x54a7, 0x54bf, 0x56ff, 0x5782, 0x578b, 0x57a0, 0x57a3, 0x57a2, 0x57ce, 0x57ae, 0x5793, 0x5955, 0x5951, 0x594f, 0x594e, 0x5950, 0x59dc, 0x59d8, 0x59ff, 0x59e3, 0x59e8, 0x5a03, 0x59e5, 0x59ea, 0x59da, 0x59e6, 0x5a01, 0x59fb, 0x5b69, 0x5ba3, 0x5ba6, 0x5ba4, 0x5ba2, 0x5ba5, 0x5c01, 0x5c4e, 0x5c4f, 0x5c4d, 0x5c4b, 0x5cd9, 0x5cd2, 0x5df7, 0x5e1d, 0x5e25, 0x5e1f, 0x5e7d, 0x5ea0, 0x5ea6, 0x5efa, 0x5f08, 0x5f2d, 0x5f65, 0x5f88, 0x5f85, 0x5f8a, 0x5f8b, 0x5f87, 0x5f8c, 0x5f89, 0x6012, 0x601d, 0x6020, 0x6025, 0x600e, 0x6028, 0x604d, 0x6070, 0x6068, 0x6062, 0x6046, 0x6043, 0x606c, 0x606b, 0x606a, 0x6064, 0x6241, 0x62dc, 0x6316, 0x6309, 0x62fc, 0x62ed, 0x6301, 0x62ee, 0x62fd, 0x6307, 0x62f1, 0x62f7, /* 0xac */ 0x62ef, 0x62ec, 0x62fe, 0x62f4, 0x6311, 0x6302, 0x653f, 0x6545, 0x65ab, 0x65bd, 0x65e2, 0x6625, 0x662d, 0x6620, 0x6627, 0x662f, 0x661f, 0x6628, 0x6631, 0x6624, 0x66f7, 0x67ff, 0x67d3, 0x67f1, 0x67d4, 0x67d0, 0x67ec, 0x67b6, 0x67af, 0x67f5, 0x67e9, 0x67ef, 0x67c4, 0x67d1, 0x67b4, 0x67da, 0x67e5, 0x67b8, 0x67cf, 0x67de, 0x67f3, 0x67b0, 0x67d9, 0x67e2, 0x67dd, 0x67d2, 0x6b6a, 0x6b83, 0x6b86, 0x6bb5, 0x6bd2, 0x6bd7, 0x6c1f, 0x6cc9, 0x6d0b, 0x6d32, 0x6d2a, 0x6d41, 0x6d25, 0x6d0c, 0x6d31, 0x6d1e, 0x6d17, 0x6d3b, 0x6d3d, 0x6d3e, 0x6d36, 0x6d1b, 0x6cf5, 0x6d39, 0x6d27, 0x6d38, 0x6d29, 0x6d2e, 0x6d35, 0x6d0e, 0x6d2b, 0x70ab, 0x70ba, 0x70b3, 0x70ac, 0x70af, 0x70ad, 0x70b8, 0x70ae, 0x70a4, 0x7230, 0x7272, 0x726f, 0x7274, 0x72e9, 0x72e0, 0x72e1, 0x73b7, 0x73ca, 0x73bb, 0x73b2, 0x73cd, 0x73c0, 0x73b3, 0x751a, 0x752d, 0x754f, 0x754c, 0x754e, 0x754b, 0x75ab, 0x75a4, 0x75a5, 0x75a2, 0x75a3, 0x7678, 0x7686, 0x7687, 0x7688, 0x76c8, 0x76c6, 0x76c3, 0x76c5, 0x7701, 0x76f9, 0x76f8, 0x7709, 0x770b, 0x76fe, 0x76fc, 0x7707, 0x77dc, 0x7802, 0x7814, 0x780c, 0x780d, 0x7946, 0x7949, 0x7948, 0x7947, 0x79b9, 0x79ba, 0x79d1, 0x79d2, 0x79cb, 0x7a7f, 0x7a81, 0x7aff, 0x7afd, 0x7c7d, 0x7d02, 0x7d05, 0x7d00, 0x7d09, 0x7d07, 0x7d04, 0x7d06, 0x7f38, 0x7f8e, 0x7fbf, 0x8004, /* 0xad */ 0x8010, 0x800d, 0x8011, 0x8036, 0x80d6, 0x80e5, 0x80da, 0x80c3, 0x80c4, 0x80cc, 0x80e1, 0x80db, 0x80ce, 0x80de, 0x80e4, 0x80dd, 0x81f4, 0x8222, 0x82e7, 0x8303, 0x8305, 0x82e3, 0x82db, 0x82e6, 0x8304, 0x82e5, 0x8302, 0x8309, 0x82d2, 0x82d7, 0x82f1, 0x8301, 0x82dc, 0x82d4, 0x82d1, 0x82de, 0x82d3, 0x82df, 0x82ef, 0x8306, 0x8650, 0x8679, 0x867b, 0x867a, 0x884d, 0x886b, 0x8981, 0x89d4, 0x8a08, 0x8a02, 0x8a03, 0x8c9e, 0x8ca0, 0x8d74, 0x8d73, 0x8db4, 0x8ecd, 0x8ecc, 0x8ff0, 0x8fe6, 0x8fe2, 0x8fea, 0x8fe5, 0x8fed, 0x8feb, 0x8fe4, 0x8fe8, 0x90ca, 0x90ce, 0x90c1, 0x90c3, 0x914b, 0x914a, 0x91cd, 0x9582, 0x9650, 0x964b, 0x964c, 0x964d, 0x9762, 0x9769, 0x97cb, 0x97ed, 0x97f3, 0x9801, 0x98a8, 0x98db, 0x98df, 0x9996, 0x9999, 0x4e58, 0x4eb3, 0x500c, 0x500d, 0x5023, 0x4fef, 0x5026, 0x5025, 0x4ff8, 0x5029, 0x5016, 0x5006, 0x503c, 0x501f, 0x501a, 0x5012, 0x5011, 0x4ffa, 0x5000, 0x5014, 0x5028, 0x4ff1, 0x5021, 0x500b, 0x5019, 0x5018, 0x4ff3, 0x4fee, 0x502d, 0x502a, 0x4ffe, 0x502b, 0x5009, 0x517c, 0x51a4, 0x51a5, 0x51a2, 0x51cd, 0x51cc, 0x51c6, 0x51cb, 0x5256, 0x525c, 0x5254, 0x525b, 0x525d, 0x532a, 0x537f, 0x539f, 0x539d, 0x53df, 0x54e8, 0x5510, 0x5501, 0x5537, 0x54fc, 0x54e5, 0x54f2, 0x5506, 0x54fa, 0x5514, 0x54e9, 0x54ed, 0x54e1, 0x5509, 0x54ee, 0x54ea, /* 0xae */ 0x54e6, 0x5527, 0x5507, 0x54fd, 0x550f, 0x5703, 0x5704, 0x57c2, 0x57d4, 0x57cb, 0x57c3, 0x5809, 0x590f, 0x5957, 0x5958, 0x595a, 0x5a11, 0x5a18, 0x5a1c, 0x5a1f, 0x5a1b, 0x5a13, 0x59ec, 0x5a20, 0x5a23, 0x5a29, 0x5a25, 0x5a0c, 0x5a09, 0x5b6b, 0x5c58, 0x5bb0, 0x5bb3, 0x5bb6, 0x5bb4, 0x5bae, 0x5bb5, 0x5bb9, 0x5bb8, 0x5c04, 0x5c51, 0x5c55, 0x5c50, 0x5ced, 0x5cfd, 0x5cfb, 0x5cea, 0x5ce8, 0x5cf0, 0x5cf6, 0x5d01, 0x5cf4, 0x5dee, 0x5e2d, 0x5e2b, 0x5eab, 0x5ead, 0x5ea7, 0x5f31, 0x5f92, 0x5f91, 0x5f90, 0x6059, 0x6063, 0x6065, 0x6050, 0x6055, 0x606d, 0x6069, 0x606f, 0x6084, 0x609f, 0x609a, 0x608d, 0x6094, 0x608c, 0x6085, 0x6096, 0x6247, 0x62f3, 0x6308, 0x62ff, 0x634e, 0x633e, 0x632f, 0x6355, 0x6342, 0x6346, 0x634f, 0x6349, 0x633a, 0x6350, 0x633d, 0x632a, 0x632b, 0x6328, 0x634d, 0x634c, 0x6548, 0x6549, 0x6599, 0x65c1, 0x65c5, 0x6642, 0x6649, 0x664f, 0x6643, 0x6652, 0x664c, 0x6645, 0x6641, 0x66f8, 0x6714, 0x6715, 0x6717, 0x6821, 0x6838, 0x6848, 0x6846, 0x6853, 0x6839, 0x6842, 0x6854, 0x6829, 0x68b3, 0x6817, 0x684c, 0x6851, 0x683d, 0x67f4, 0x6850, 0x6840, 0x683c, 0x6843, 0x682a, 0x6845, 0x6813, 0x6818, 0x6841, 0x6b8a, 0x6b89, 0x6bb7, 0x6c23, 0x6c27, 0x6c28, 0x6c26, 0x6c24, 0x6cf0, 0x6d6a, 0x6d95, 0x6d88, 0x6d87, 0x6d66, 0x6d78, 0x6d77, 0x6d59, 0x6d93, /* 0xaf */ 0x6d6c, 0x6d89, 0x6d6e, 0x6d5a, 0x6d74, 0x6d69, 0x6d8c, 0x6d8a, 0x6d79, 0x6d85, 0x6d65, 0x6d94, 0x70ca, 0x70d8, 0x70e4, 0x70d9, 0x70c8, 0x70cf, 0x7239, 0x7279, 0x72fc, 0x72f9, 0x72fd, 0x72f8, 0x72f7, 0x7386, 0x73ed, 0x7409, 0x73ee, 0x73e0, 0x73ea, 0x73de, 0x7554, 0x755d, 0x755c, 0x755a, 0x7559, 0x75be, 0x75c5, 0x75c7, 0x75b2, 0x75b3, 0x75bd, 0x75bc, 0x75b9, 0x75c2, 0x75b8, 0x768b, 0x76b0, 0x76ca, 0x76cd, 0x76ce, 0x7729, 0x771f, 0x7720, 0x7728, 0x77e9, 0x7830, 0x7827, 0x7838, 0x781d, 0x7834, 0x7837, 0x7825, 0x782d, 0x7820, 0x781f, 0x7832, 0x7955, 0x7950, 0x7960, 0x795f, 0x7956, 0x795e, 0x795d, 0x7957, 0x795a, 0x79e4, 0x79e3, 0x79e7, 0x79df, 0x79e6, 0x79e9, 0x79d8, 0x7a84, 0x7a88, 0x7ad9, 0x7b06, 0x7b11, 0x7c89, 0x7d21, 0x7d17, 0x7d0b, 0x7d0a, 0x7d20, 0x7d22, 0x7d14, 0x7d10, 0x7d15, 0x7d1a, 0x7d1c, 0x7d0d, 0x7d19, 0x7d1b, 0x7f3a, 0x7f5f, 0x7f94, 0x7fc5, 0x7fc1, 0x8006, 0x8018, 0x8015, 0x8019, 0x8017, 0x803d, 0x803f, 0x80f1, 0x8102, 0x80f0, 0x8105, 0x80ed, 0x80f4, 0x8106, 0x80f8, 0x80f3, 0x8108, 0x80fd, 0x810a, 0x80fc, 0x80ef, 0x81ed, 0x81ec, 0x8200, 0x8210, 0x822a, 0x822b, 0x8228, 0x822c, 0x82bb, 0x832b, 0x8352, 0x8354, 0x834a, 0x8338, 0x8350, 0x8349, 0x8335, 0x8334, 0x834f, 0x8332, 0x8339, 0x8336, 0x8317, 0x8340, 0x8331, 0x8328, 0x8343, /* 0xb0 */ 0x8654, 0x868a, 0x86aa, 0x8693, 0x86a4, 0x86a9, 0x868c, 0x86a3, 0x869c, 0x8870, 0x8877, 0x8881, 0x8882, 0x887d, 0x8879, 0x8a18, 0x8a10, 0x8a0e, 0x8a0c, 0x8a15, 0x8a0a, 0x8a17, 0x8a13, 0x8a16, 0x8a0f, 0x8a11, 0x8c48, 0x8c7a, 0x8c79, 0x8ca1, 0x8ca2, 0x8d77, 0x8eac, 0x8ed2, 0x8ed4, 0x8ecf, 0x8fb1, 0x9001, 0x9006, 0x8ff7, 0x9000, 0x8ffa, 0x8ff4, 0x9003, 0x8ffd, 0x9005, 0x8ff8, 0x9095, 0x90e1, 0x90dd, 0x90e2, 0x9152, 0x914d, 0x914c, 0x91d8, 0x91dd, 0x91d7, 0x91dc, 0x91d9, 0x9583, 0x9662, 0x9663, 0x9661, 0x965b, 0x965d, 0x9664, 0x9658, 0x965e, 0x96bb, 0x98e2, 0x99ac, 0x9aa8, 0x9ad8, 0x9b25, 0x9b32, 0x9b3c, 0x4e7e, 0x507a, 0x507d, 0x505c, 0x5047, 0x5043, 0x504c, 0x505a, 0x5049, 0x5065, 0x5076, 0x504e, 0x5055, 0x5075, 0x5074, 0x5077, 0x504f, 0x500f, 0x506f, 0x506d, 0x515c, 0x5195, 0x51f0, 0x526a, 0x526f, 0x52d2, 0x52d9, 0x52d8, 0x52d5, 0x5310, 0x530f, 0x5319, 0x533f, 0x5340, 0x533e, 0x53c3, 0x66fc, 0x5546, 0x556a, 0x5566, 0x5544, 0x555e, 0x5561, 0x5543, 0x554a, 0x5531, 0x5556, 0x554f, 0x5555, 0x552f, 0x5564, 0x5538, 0x552e, 0x555c, 0x552c, 0x5563, 0x5533, 0x5541, 0x5557, 0x5708, 0x570b, 0x5709, 0x57df, 0x5805, 0x580a, 0x5806, 0x57e0, 0x57e4, 0x57fa, 0x5802, 0x5835, 0x57f7, 0x57f9, 0x5920, 0x5962, 0x5a36, 0x5a41, 0x5a49, 0x5a66, 0x5a6a, 0x5a40, /* 0xb1 */ 0x5a3c, 0x5a62, 0x5a5a, 0x5a46, 0x5a4a, 0x5b70, 0x5bc7, 0x5bc5, 0x5bc4, 0x5bc2, 0x5bbf, 0x5bc6, 0x5c09, 0x5c08, 0x5c07, 0x5c60, 0x5c5c, 0x5c5d, 0x5d07, 0x5d06, 0x5d0e, 0x5d1b, 0x5d16, 0x5d22, 0x5d11, 0x5d29, 0x5d14, 0x5d19, 0x5d24, 0x5d27, 0x5d17, 0x5de2, 0x5e38, 0x5e36, 0x5e33, 0x5e37, 0x5eb7, 0x5eb8, 0x5eb6, 0x5eb5, 0x5ebe, 0x5f35, 0x5f37, 0x5f57, 0x5f6c, 0x5f69, 0x5f6b, 0x5f97, 0x5f99, 0x5f9e, 0x5f98, 0x5fa1, 0x5fa0, 0x5f9c, 0x607f, 0x60a3, 0x6089, 0x60a0, 0x60a8, 0x60cb, 0x60b4, 0x60e6, 0x60bd, 0x60c5, 0x60bb, 0x60b5, 0x60dc, 0x60bc, 0x60d8, 0x60d5, 0x60c6, 0x60df, 0x60b8, 0x60da, 0x60c7, 0x621a, 0x621b, 0x6248, 0x63a0, 0x63a7, 0x6372, 0x6396, 0x63a2, 0x63a5, 0x6377, 0x6367, 0x6398, 0x63aa, 0x6371, 0x63a9, 0x6389, 0x6383, 0x639b, 0x636b, 0x63a8, 0x6384, 0x6388, 0x6399, 0x63a1, 0x63ac, 0x6392, 0x638f, 0x6380, 0x637b, 0x6369, 0x6368, 0x637a, 0x655d, 0x6556, 0x6551, 0x6559, 0x6557, 0x555f, 0x654f, 0x6558, 0x6555, 0x6554, 0x659c, 0x659b, 0x65ac, 0x65cf, 0x65cb, 0x65cc, 0x65ce, 0x665d, 0x665a, 0x6664, 0x6668, 0x6666, 0x665e, 0x66f9, 0x52d7, 0x671b, 0x6881, 0x68af, 0x68a2, 0x6893, 0x68b5, 0x687f, 0x6876, 0x68b1, 0x68a7, 0x6897, 0x68b0, 0x6883, 0x68c4, 0x68ad, 0x6886, 0x6885, 0x6894, 0x689d, 0x68a8, 0x689f, 0x68a1, 0x6882, 0x6b32, 0x6bba, /* 0xb2 */ 0x6beb, 0x6bec, 0x6c2b, 0x6d8e, 0x6dbc, 0x6df3, 0x6dd9, 0x6db2, 0x6de1, 0x6dcc, 0x6de4, 0x6dfb, 0x6dfa, 0x6e05, 0x6dc7, 0x6dcb, 0x6daf, 0x6dd1, 0x6dae, 0x6dde, 0x6df9, 0x6db8, 0x6df7, 0x6df5, 0x6dc5, 0x6dd2, 0x6e1a, 0x6db5, 0x6dda, 0x6deb, 0x6dd8, 0x6dea, 0x6df1, 0x6dee, 0x6de8, 0x6dc6, 0x6dc4, 0x6daa, 0x6dec, 0x6dbf, 0x6de6, 0x70f9, 0x7109, 0x710a, 0x70fd, 0x70ef, 0x723d, 0x727d, 0x7281, 0x731c, 0x731b, 0x7316, 0x7313, 0x7319, 0x7387, 0x7405, 0x740a, 0x7403, 0x7406, 0x73fe, 0x740d, 0x74e0, 0x74f6, 0x74f7, 0x751c, 0x7522, 0x7565, 0x7566, 0x7562, 0x7570, 0x758f, 0x75d4, 0x75d5, 0x75b5, 0x75ca, 0x75cd, 0x768e, 0x76d4, 0x76d2, 0x76db, 0x7737, 0x773e, 0x773c, 0x7736, 0x7738, 0x773a, 0x786b, 0x7843, 0x784e, 0x7965, 0x7968, 0x796d, 0x79fb, 0x7a92, 0x7a95, 0x7b20, 0x7b28, 0x7b1b, 0x7b2c, 0x7b26, 0x7b19, 0x7b1e, 0x7b2e, 0x7c92, 0x7c97, 0x7c95, 0x7d46, 0x7d43, 0x7d71, 0x7d2e, 0x7d39, 0x7d3c, 0x7d40, 0x7d30, 0x7d33, 0x7d44, 0x7d2f, 0x7d42, 0x7d32, 0x7d31, 0x7f3d, 0x7f9e, 0x7f9a, 0x7fcc, 0x7fce, 0x7fd2, 0x801c, 0x804a, 0x8046, 0x812f, 0x8116, 0x8123, 0x812b, 0x8129, 0x8130, 0x8124, 0x8202, 0x8235, 0x8237, 0x8236, 0x8239, 0x838e, 0x839e, 0x8398, 0x8378, 0x83a2, 0x8396, 0x83bd, 0x83ab, 0x8392, 0x838a, 0x8393, 0x8389, 0x83a0, 0x8377, 0x837b, 0x837c, /* 0xb3 */ 0x8386, 0x83a7, 0x8655, 0x5f6a, 0x86c7, 0x86c0, 0x86b6, 0x86c4, 0x86b5, 0x86c6, 0x86cb, 0x86b1, 0x86af, 0x86c9, 0x8853, 0x889e, 0x8888, 0x88ab, 0x8892, 0x8896, 0x888d, 0x888b, 0x8993, 0x898f, 0x8a2a, 0x8a1d, 0x8a23, 0x8a25, 0x8a31, 0x8a2d, 0x8a1f, 0x8a1b, 0x8a22, 0x8c49, 0x8c5a, 0x8ca9, 0x8cac, 0x8cab, 0x8ca8, 0x8caa, 0x8ca7, 0x8d67, 0x8d66, 0x8dbe, 0x8dba, 0x8edb, 0x8edf, 0x9019, 0x900d, 0x901a, 0x9017, 0x9023, 0x901f, 0x901d, 0x9010, 0x9015, 0x901e, 0x9020, 0x900f, 0x9022, 0x9016, 0x901b, 0x9014, 0x90e8, 0x90ed, 0x90fd, 0x9157, 0x91ce, 0x91f5, 0x91e6, 0x91e3, 0x91e7, 0x91ed, 0x91e9, 0x9589, 0x966a, 0x9675, 0x9673, 0x9678, 0x9670, 0x9674, 0x9676, 0x9677, 0x966c, 0x96c0, 0x96ea, 0x96e9, 0x7ae0, 0x7adf, 0x9802, 0x9803, 0x9b5a, 0x9ce5, 0x9e75, 0x9e7f, 0x9ea5, 0x9ebb, 0x50a2, 0x508d, 0x5085, 0x5099, 0x5091, 0x5080, 0x5096, 0x5098, 0x509a, 0x6700, 0x51f1, 0x5272, 0x5274, 0x5275, 0x5269, 0x52de, 0x52dd, 0x52db, 0x535a, 0x53a5, 0x557b, 0x5580, 0x55a7, 0x557c, 0x558a, 0x559d, 0x5598, 0x5582, 0x559c, 0x55aa, 0x5594, 0x5587, 0x558b, 0x5583, 0x55b3, 0x55ae, 0x559f, 0x553e, 0x55b2, 0x559a, 0x55bb, 0x55ac, 0x55b1, 0x557e, 0x5589, 0x55ab, 0x5599, 0x570d, 0x582f, 0x582a, 0x5834, 0x5824, 0x5830, 0x5831, 0x5821, 0x581d, 0x5820, 0x58f9, 0x58fa, 0x5960, /* 0xb4 */ 0x5a77, 0x5a9a, 0x5a7f, 0x5a92, 0x5a9b, 0x5aa7, 0x5b73, 0x5b71, 0x5bd2, 0x5bcc, 0x5bd3, 0x5bd0, 0x5c0a, 0x5c0b, 0x5c31, 0x5d4c, 0x5d50, 0x5d34, 0x5d47, 0x5dfd, 0x5e45, 0x5e3d, 0x5e40, 0x5e43, 0x5e7e, 0x5eca, 0x5ec1, 0x5ec2, 0x5ec4, 0x5f3c, 0x5f6d, 0x5fa9, 0x5faa, 0x5fa8, 0x60d1, 0x60e1, 0x60b2, 0x60b6, 0x60e0, 0x611c, 0x6123, 0x60fa, 0x6115, 0x60f0, 0x60fb, 0x60f4, 0x6168, 0x60f1, 0x610e, 0x60f6, 0x6109, 0x6100, 0x6112, 0x621f, 0x6249, 0x63a3, 0x638c, 0x63cf, 0x63c0, 0x63e9, 0x63c9, 0x63c6, 0x63cd, 0x63d2, 0x63e3, 0x63d0, 0x63e1, 0x63d6, 0x63ed, 0x63ee, 0x6376, 0x63f4, 0x63ea, 0x63db, 0x6452, 0x63da, 0x63f9, 0x655e, 0x6566, 0x6562, 0x6563, 0x6591, 0x6590, 0x65af, 0x666e, 0x6670, 0x6674, 0x6676, 0x666f, 0x6691, 0x667a, 0x667e, 0x6677, 0x66fe, 0x66ff, 0x671f, 0x671d, 0x68fa, 0x68d5, 0x68e0, 0x68d8, 0x68d7, 0x6905, 0x68df, 0x68f5, 0x68ee, 0x68e7, 0x68f9, 0x68d2, 0x68f2, 0x68e3, 0x68cb, 0x68cd, 0x690d, 0x6912, 0x690e, 0x68c9, 0x68da, 0x696e, 0x68fb, 0x6b3e, 0x6b3a, 0x6b3d, 0x6b98, 0x6b96, 0x6bbc, 0x6bef, 0x6c2e, 0x6c2f, 0x6c2c, 0x6e2f, 0x6e38, 0x6e54, 0x6e21, 0x6e32, 0x6e67, 0x6e4a, 0x6e20, 0x6e25, 0x6e23, 0x6e1b, 0x6e5b, 0x6e58, 0x6e24, 0x6e56, 0x6e6e, 0x6e2d, 0x6e26, 0x6e6f, 0x6e34, 0x6e4d, 0x6e3a, 0x6e2c, 0x6e43, 0x6e1d, 0x6e3e, 0x6ecb, /* 0xb5 */ 0x6e89, 0x6e19, 0x6e4e, 0x6e63, 0x6e44, 0x6e72, 0x6e69, 0x6e5f, 0x7119, 0x711a, 0x7126, 0x7130, 0x7121, 0x7136, 0x716e, 0x711c, 0x724c, 0x7284, 0x7280, 0x7336, 0x7325, 0x7334, 0x7329, 0x743a, 0x742a, 0x7433, 0x7422, 0x7425, 0x7435, 0x7436, 0x7434, 0x742f, 0x741b, 0x7426, 0x7428, 0x7525, 0x7526, 0x756b, 0x756a, 0x75e2, 0x75db, 0x75e3, 0x75d9, 0x75d8, 0x75de, 0x75e0, 0x767b, 0x767c, 0x7696, 0x7693, 0x76b4, 0x76dc, 0x774f, 0x77ed, 0x785d, 0x786c, 0x786f, 0x7a0d, 0x7a08, 0x7a0b, 0x7a05, 0x7a00, 0x7a98, 0x7a97, 0x7a96, 0x7ae5, 0x7ae3, 0x7b49, 0x7b56, 0x7b46, 0x7b50, 0x7b52, 0x7b54, 0x7b4d, 0x7b4b, 0x7b4f, 0x7b51, 0x7c9f, 0x7ca5, 0x7d5e, 0x7d50, 0x7d68, 0x7d55, 0x7d2b, 0x7d6e, 0x7d72, 0x7d61, 0x7d66, 0x7d62, 0x7d70, 0x7d73, 0x5584, 0x7fd4, 0x7fd5, 0x800b, 0x8052, 0x8085, 0x8155, 0x8154, 0x814b, 0x8151, 0x814e, 0x8139, 0x8146, 0x813e, 0x814c, 0x8153, 0x8174, 0x8212, 0x821c, 0x83e9, 0x8403, 0x83f8, 0x840d, 0x83e0, 0x83c5, 0x840b, 0x83c1, 0x83ef, 0x83f1, 0x83f4, 0x8457, 0x840a, 0x83f0, 0x840c, 0x83cc, 0x83fd, 0x83f2, 0x83ca, 0x8438, 0x840e, 0x8404, 0x83dc, 0x8407, 0x83d4, 0x83df, 0x865b, 0x86df, 0x86d9, 0x86ed, 0x86d4, 0x86db, 0x86e4, 0x86d0, 0x86de, 0x8857, 0x88c1, 0x88c2, 0x88b1, 0x8983, 0x8996, 0x8a3b, 0x8a60, 0x8a55, 0x8a5e, 0x8a3c, 0x8a41, /* 0xb6 */ 0x8a54, 0x8a5b, 0x8a50, 0x8a46, 0x8a34, 0x8a3a, 0x8a36, 0x8a56, 0x8c61, 0x8c82, 0x8caf, 0x8cbc, 0x8cb3, 0x8cbd, 0x8cc1, 0x8cbb, 0x8cc0, 0x8cb4, 0x8cb7, 0x8cb6, 0x8cbf, 0x8cb8, 0x8d8a, 0x8d85, 0x8d81, 0x8dce, 0x8ddd, 0x8dcb, 0x8dda, 0x8dd1, 0x8dcc, 0x8ddb, 0x8dc6, 0x8efb, 0x8ef8, 0x8efc, 0x8f9c, 0x902e, 0x9035, 0x9031, 0x9038, 0x9032, 0x9036, 0x9102, 0x90f5, 0x9109, 0x90fe, 0x9163, 0x9165, 0x91cf, 0x9214, 0x9215, 0x9223, 0x9209, 0x921e, 0x920d, 0x9210, 0x9207, 0x9211, 0x9594, 0x958f, 0x958b, 0x9591, 0x9593, 0x9592, 0x958e, 0x968a, 0x968e, 0x968b, 0x967d, 0x9685, 0x9686, 0x968d, 0x9672, 0x9684, 0x96c1, 0x96c5, 0x96c4, 0x96c6, 0x96c7, 0x96ef, 0x96f2, 0x97cc, 0x9805, 0x9806, 0x9808, 0x98e7, 0x98ea, 0x98ef, 0x98e9, 0x98f2, 0x98ed, 0x99ae, 0x99ad, 0x9ec3, 0x9ecd, 0x9ed1, 0x4e82, 0x50ad, 0x50b5, 0x50b2, 0x50b3, 0x50c5, 0x50be, 0x50ac, 0x50b7, 0x50bb, 0x50af, 0x50c7, 0x527f, 0x5277, 0x527d, 0x52df, 0x52e6, 0x52e4, 0x52e2, 0x52e3, 0x532f, 0x55df, 0x55e8, 0x55d3, 0x55e6, 0x55ce, 0x55dc, 0x55c7, 0x55d1, 0x55e3, 0x55e4, 0x55ef, 0x55da, 0x55e1, 0x55c5, 0x55c6, 0x55e5, 0x55c9, 0x5712, 0x5713, 0x585e, 0x5851, 0x5858, 0x5857, 0x585a, 0x5854, 0x586b, 0x584c, 0x586d, 0x584a, 0x5862, 0x5852, 0x584b, 0x5967, 0x5ac1, 0x5ac9, 0x5acc, 0x5abe, 0x5abd, 0x5abc, /* 0xb7 */ 0x5ab3, 0x5ac2, 0x5ab2, 0x5d69, 0x5d6f, 0x5e4c, 0x5e79, 0x5ec9, 0x5ec8, 0x5f12, 0x5f59, 0x5fac, 0x5fae, 0x611a, 0x610f, 0x6148, 0x611f, 0x60f3, 0x611b, 0x60f9, 0x6101, 0x6108, 0x614e, 0x614c, 0x6144, 0x614d, 0x613e, 0x6134, 0x6127, 0x610d, 0x6106, 0x6137, 0x6221, 0x6222, 0x6413, 0x643e, 0x641e, 0x642a, 0x642d, 0x643d, 0x642c, 0x640f, 0x641c, 0x6414, 0x640d, 0x6436, 0x6416, 0x6417, 0x6406, 0x656c, 0x659f, 0x65b0, 0x6697, 0x6689, 0x6687, 0x6688, 0x6696, 0x6684, 0x6698, 0x668d, 0x6703, 0x6994, 0x696d, 0x695a, 0x6977, 0x6960, 0x6954, 0x6975, 0x6930, 0x6982, 0x694a, 0x6968, 0x696b, 0x695e, 0x6953, 0x6979, 0x6986, 0x695d, 0x6963, 0x695b, 0x6b47, 0x6b72, 0x6bc0, 0x6bbf, 0x6bd3, 0x6bfd, 0x6ea2, 0x6eaf, 0x6ed3, 0x6eb6, 0x6ec2, 0x6e90, 0x6e9d, 0x6ec7, 0x6ec5, 0x6ea5, 0x6e98, 0x6ebc, 0x6eba, 0x6eab, 0x6ed1, 0x6e96, 0x6e9c, 0x6ec4, 0x6ed4, 0x6eaa, 0x6ea7, 0x6eb4, 0x714e, 0x7159, 0x7169, 0x7164, 0x7149, 0x7167, 0x715c, 0x716c, 0x7166, 0x714c, 0x7165, 0x715e, 0x7146, 0x7168, 0x7156, 0x723a, 0x7252, 0x7337, 0x7345, 0x733f, 0x733e, 0x746f, 0x745a, 0x7455, 0x745f, 0x745e, 0x7441, 0x743f, 0x7459, 0x745b, 0x745c, 0x7576, 0x7578, 0x7600, 0x75f0, 0x7601, 0x75f2, 0x75f1, 0x75fa, 0x75ff, 0x75f4, 0x75f3, 0x76de, 0x76df, 0x775b, 0x776b, 0x7766, 0x775e, 0x7763, /* 0xb8 */ 0x7779, 0x776a, 0x776c, 0x775c, 0x7765, 0x7768, 0x7762, 0x77ee, 0x788e, 0x78b0, 0x7897, 0x7898, 0x788c, 0x7889, 0x787c, 0x7891, 0x7893, 0x787f, 0x797a, 0x797f, 0x7981, 0x842c, 0x79bd, 0x7a1c, 0x7a1a, 0x7a20, 0x7a14, 0x7a1f, 0x7a1e, 0x7a9f, 0x7aa0, 0x7b77, 0x7bc0, 0x7b60, 0x7b6e, 0x7b67, 0x7cb1, 0x7cb3, 0x7cb5, 0x7d93, 0x7d79, 0x7d91, 0x7d81, 0x7d8f, 0x7d5b, 0x7f6e, 0x7f69, 0x7f6a, 0x7f72, 0x7fa9, 0x7fa8, 0x7fa4, 0x8056, 0x8058, 0x8086, 0x8084, 0x8171, 0x8170, 0x8178, 0x8165, 0x816e, 0x8173, 0x816b, 0x8179, 0x817a, 0x8166, 0x8205, 0x8247, 0x8482, 0x8477, 0x843d, 0x8431, 0x8475, 0x8466, 0x846b, 0x8449, 0x846c, 0x845b, 0x843c, 0x8435, 0x8461, 0x8463, 0x8469, 0x846d, 0x8446, 0x865e, 0x865c, 0x865f, 0x86f9, 0x8713, 0x8708, 0x8707, 0x8700, 0x86fe, 0x86fb, 0x8702, 0x8703, 0x8706, 0x870a, 0x8859, 0x88df, 0x88d4, 0x88d9, 0x88dc, 0x88d8, 0x88dd, 0x88e1, 0x88ca, 0x88d5, 0x88d2, 0x899c, 0x89e3, 0x8a6b, 0x8a72, 0x8a73, 0x8a66, 0x8a69, 0x8a70, 0x8a87, 0x8a7c, 0x8a63, 0x8aa0, 0x8a71, 0x8a85, 0x8a6d, 0x8a62, 0x8a6e, 0x8a6c, 0x8a79, 0x8a7b, 0x8a3e, 0x8a68, 0x8c62, 0x8c8a, 0x8c89, 0x8cca, 0x8cc7, 0x8cc8, 0x8cc4, 0x8cb2, 0x8cc3, 0x8cc2, 0x8cc5, 0x8de1, 0x8ddf, 0x8de8, 0x8def, 0x8df3, 0x8dfa, 0x8dea, 0x8de4, 0x8de6, 0x8eb2, 0x8f03, 0x8f09, 0x8efe, 0x8f0a, /* 0xb9 */ 0x8f9f, 0x8fb2, 0x904b, 0x904a, 0x9053, 0x9042, 0x9054, 0x903c, 0x9055, 0x9050, 0x9047, 0x904f, 0x904e, 0x904d, 0x9051, 0x903e, 0x9041, 0x9112, 0x9117, 0x916c, 0x916a, 0x9169, 0x91c9, 0x9237, 0x9257, 0x9238, 0x923d, 0x9240, 0x923e, 0x925b, 0x924b, 0x9264, 0x9251, 0x9234, 0x9249, 0x924d, 0x9245, 0x9239, 0x923f, 0x925a, 0x9598, 0x9698, 0x9694, 0x9695, 0x96cd, 0x96cb, 0x96c9, 0x96ca, 0x96f7, 0x96fb, 0x96f9, 0x96f6, 0x9756, 0x9774, 0x9776, 0x9810, 0x9811, 0x9813, 0x980a, 0x9812, 0x980c, 0x98fc, 0x98f4, 0x98fd, 0x98fe, 0x99b3, 0x99b1, 0x99b4, 0x9ae1, 0x9ce9, 0x9e82, 0x9f0e, 0x9f13, 0x9f20, 0x50e7, 0x50ee, 0x50e5, 0x50d6, 0x50ed, 0x50da, 0x50d5, 0x50cf, 0x50d1, 0x50f1, 0x50ce, 0x50e9, 0x5162, 0x51f3, 0x5283, 0x5282, 0x5331, 0x53ad, 0x55fe, 0x5600, 0x561b, 0x5617, 0x55fd, 0x5614, 0x5606, 0x5609, 0x560d, 0x560e, 0x55f7, 0x5616, 0x561f, 0x5608, 0x5610, 0x55f6, 0x5718, 0x5716, 0x5875, 0x587e, 0x5883, 0x5893, 0x588a, 0x5879, 0x5885, 0x587d, 0x58fd, 0x5925, 0x5922, 0x5924, 0x596a, 0x5969, 0x5ae1, 0x5ae6, 0x5ae9, 0x5ad7, 0x5ad6, 0x5ad8, 0x5ae3, 0x5b75, 0x5bde, 0x5be7, 0x5be1, 0x5be5, 0x5be6, 0x5be8, 0x5be2, 0x5be4, 0x5bdf, 0x5c0d, 0x5c62, 0x5d84, 0x5d87, 0x5e5b, 0x5e63, 0x5e55, 0x5e57, 0x5e54, 0x5ed3, 0x5ed6, 0x5f0a, 0x5f46, 0x5f70, 0x5fb9, 0x6147, /* 0xba */ 0x613f, 0x614b, 0x6177, 0x6162, 0x6163, 0x615f, 0x615a, 0x6158, 0x6175, 0x622a, 0x6487, 0x6458, 0x6454, 0x64a4, 0x6478, 0x645f, 0x647a, 0x6451, 0x6467, 0x6434, 0x646d, 0x647b, 0x6572, 0x65a1, 0x65d7, 0x65d6, 0x66a2, 0x66a8, 0x669d, 0x699c, 0x69a8, 0x6995, 0x69c1, 0x69ae, 0x69d3, 0x69cb, 0x699b, 0x69b7, 0x69bb, 0x69ab, 0x69b4, 0x69d0, 0x69cd, 0x69ad, 0x69cc, 0x69a6, 0x69c3, 0x69a3, 0x6b49, 0x6b4c, 0x6c33, 0x6f33, 0x6f14, 0x6efe, 0x6f13, 0x6ef4, 0x6f29, 0x6f3e, 0x6f20, 0x6f2c, 0x6f0f, 0x6f02, 0x6f22, 0x6eff, 0x6eef, 0x6f06, 0x6f31, 0x6f38, 0x6f32, 0x6f23, 0x6f15, 0x6f2b, 0x6f2f, 0x6f88, 0x6f2a, 0x6eec, 0x6f01, 0x6ef2, 0x6ecc, 0x6ef7, 0x7194, 0x7199, 0x717d, 0x718a, 0x7184, 0x7192, 0x723e, 0x7292, 0x7296, 0x7344, 0x7350, 0x7464, 0x7463, 0x746a, 0x7470, 0x746d, 0x7504, 0x7591, 0x7627, 0x760d, 0x760b, 0x7609, 0x7613, 0x76e1, 0x76e3, 0x7784, 0x777d, 0x777f, 0x7761, 0x78c1, 0x789f, 0x78a7, 0x78b3, 0x78a9, 0x78a3, 0x798e, 0x798f, 0x798d, 0x7a2e, 0x7a31, 0x7aaa, 0x7aa9, 0x7aed, 0x7aef, 0x7ba1, 0x7b95, 0x7b8b, 0x7b75, 0x7b97, 0x7b9d, 0x7b94, 0x7b8f, 0x7bb8, 0x7b87, 0x7b84, 0x7cb9, 0x7cbd, 0x7cbe, 0x7dbb, 0x7db0, 0x7d9c, 0x7dbd, 0x7dbe, 0x7da0, 0x7dca, 0x7db4, 0x7db2, 0x7db1, 0x7dba, 0x7da2, 0x7dbf, 0x7db5, 0x7db8, 0x7dad, 0x7dd2, 0x7dc7, 0x7dac, /* 0xbb */ 0x7f70, 0x7fe0, 0x7fe1, 0x7fdf, 0x805e, 0x805a, 0x8087, 0x8150, 0x8180, 0x818f, 0x8188, 0x818a, 0x817f, 0x8182, 0x81e7, 0x81fa, 0x8207, 0x8214, 0x821e, 0x824b, 0x84c9, 0x84bf, 0x84c6, 0x84c4, 0x8499, 0x849e, 0x84b2, 0x849c, 0x84cb, 0x84b8, 0x84c0, 0x84d3, 0x8490, 0x84bc, 0x84d1, 0x84ca, 0x873f, 0x871c, 0x873b, 0x8722, 0x8725, 0x8734, 0x8718, 0x8755, 0x8737, 0x8729, 0x88f3, 0x8902, 0x88f4, 0x88f9, 0x88f8, 0x88fd, 0x88e8, 0x891a, 0x88ef, 0x8aa6, 0x8a8c, 0x8a9e, 0x8aa3, 0x8a8d, 0x8aa1, 0x8a93, 0x8aa4, 0x8aaa, 0x8aa5, 0x8aa8, 0x8a98, 0x8a91, 0x8a9a, 0x8aa7, 0x8c6a, 0x8c8d, 0x8c8c, 0x8cd3, 0x8cd1, 0x8cd2, 0x8d6b, 0x8d99, 0x8d95, 0x8dfc, 0x8f14, 0x8f12, 0x8f15, 0x8f13, 0x8fa3, 0x9060, 0x9058, 0x905c, 0x9063, 0x9059, 0x905e, 0x9062, 0x905d, 0x905b, 0x9119, 0x9118, 0x911e, 0x9175, 0x9178, 0x9177, 0x9174, 0x9278, 0x9280, 0x9285, 0x9298, 0x9296, 0x927b, 0x9293, 0x929c, 0x92a8, 0x927c, 0x9291, 0x95a1, 0x95a8, 0x95a9, 0x95a3, 0x95a5, 0x95a4, 0x9699, 0x969c, 0x969b, 0x96cc, 0x96d2, 0x9700, 0x977c, 0x9785, 0x97f6, 0x9817, 0x9818, 0x98af, 0x98b1, 0x9903, 0x9905, 0x990c, 0x9909, 0x99c1, 0x9aaf, 0x9ab0, 0x9ae6, 0x9b41, 0x9b42, 0x9cf4, 0x9cf6, 0x9cf3, 0x9ebc, 0x9f3b, 0x9f4a, 0x5104, 0x5100, 0x50fb, 0x50f5, 0x50f9, 0x5102, 0x5108, 0x5109, 0x5105, 0x51dc, /* 0xbc */ 0x5287, 0x5288, 0x5289, 0x528d, 0x528a, 0x52f0, 0x53b2, 0x562e, 0x563b, 0x5639, 0x5632, 0x563f, 0x5634, 0x5629, 0x5653, 0x564e, 0x5657, 0x5674, 0x5636, 0x562f, 0x5630, 0x5880, 0x589f, 0x589e, 0x58b3, 0x589c, 0x58ae, 0x58a9, 0x58a6, 0x596d, 0x5b09, 0x5afb, 0x5b0b, 0x5af5, 0x5b0c, 0x5b08, 0x5bee, 0x5bec, 0x5be9, 0x5beb, 0x5c64, 0x5c65, 0x5d9d, 0x5d94, 0x5e62, 0x5e5f, 0x5e61, 0x5ee2, 0x5eda, 0x5edf, 0x5edd, 0x5ee3, 0x5ee0, 0x5f48, 0x5f71, 0x5fb7, 0x5fb5, 0x6176, 0x6167, 0x616e, 0x615d, 0x6155, 0x6182, 0x617c, 0x6170, 0x616b, 0x617e, 0x61a7, 0x6190, 0x61ab, 0x618e, 0x61ac, 0x619a, 0x61a4, 0x6194, 0x61ae, 0x622e, 0x6469, 0x646f, 0x6479, 0x649e, 0x64b2, 0x6488, 0x6490, 0x64b0, 0x64a5, 0x6493, 0x6495, 0x64a9, 0x6492, 0x64ae, 0x64ad, 0x64ab, 0x649a, 0x64ac, 0x6499, 0x64a2, 0x64b3, 0x6575, 0x6577, 0x6578, 0x66ae, 0x66ab, 0x66b4, 0x66b1, 0x6a23, 0x6a1f, 0x69e8, 0x6a01, 0x6a1e, 0x6a19, 0x69fd, 0x6a21, 0x6a13, 0x6a0a, 0x69f3, 0x6a02, 0x6a05, 0x69ed, 0x6a11, 0x6b50, 0x6b4e, 0x6ba4, 0x6bc5, 0x6bc6, 0x6f3f, 0x6f7c, 0x6f84, 0x6f51, 0x6f66, 0x6f54, 0x6f86, 0x6f6d, 0x6f5b, 0x6f78, 0x6f6e, 0x6f8e, 0x6f7a, 0x6f70, 0x6f64, 0x6f97, 0x6f58, 0x6ed5, 0x6f6f, 0x6f60, 0x6f5f, 0x719f, 0x71ac, 0x71b1, 0x71a8, 0x7256, 0x729b, 0x734e, 0x7357, 0x7469, 0x748b, 0x7483, /* 0xbd */ 0x747e, 0x7480, 0x757f, 0x7620, 0x7629, 0x761f, 0x7624, 0x7626, 0x7621, 0x7622, 0x769a, 0x76ba, 0x76e4, 0x778e, 0x7787, 0x778c, 0x7791, 0x778b, 0x78cb, 0x78c5, 0x78ba, 0x78ca, 0x78be, 0x78d5, 0x78bc, 0x78d0, 0x7a3f, 0x7a3c, 0x7a40, 0x7a3d, 0x7a37, 0x7a3b, 0x7aaf, 0x7aae, 0x7bad, 0x7bb1, 0x7bc4, 0x7bb4, 0x7bc6, 0x7bc7, 0x7bc1, 0x7ba0, 0x7bcc, 0x7cca, 0x7de0, 0x7df4, 0x7def, 0x7dfb, 0x7dd8, 0x7dec, 0x7ddd, 0x7de8, 0x7de3, 0x7dda, 0x7dde, 0x7de9, 0x7d9e, 0x7dd9, 0x7df2, 0x7df9, 0x7f75, 0x7f77, 0x7faf, 0x7fe9, 0x8026, 0x819b, 0x819c, 0x819d, 0x81a0, 0x819a, 0x8198, 0x8517, 0x853d, 0x851a, 0x84ee, 0x852c, 0x852d, 0x8513, 0x8511, 0x8523, 0x8521, 0x8514, 0x84ec, 0x8525, 0x84ff, 0x8506, 0x8782, 0x8774, 0x8776, 0x8760, 0x8766, 0x8778, 0x8768, 0x8759, 0x8757, 0x874c, 0x8753, 0x885b, 0x885d, 0x8910, 0x8907, 0x8912, 0x8913, 0x8915, 0x890a, 0x8abc, 0x8ad2, 0x8ac7, 0x8ac4, 0x8a95, 0x8acb, 0x8af8, 0x8ab2, 0x8ac9, 0x8ac2, 0x8abf, 0x8ab0, 0x8ad6, 0x8acd, 0x8ab6, 0x8ab9, 0x8adb, 0x8c4c, 0x8c4e, 0x8c6c, 0x8ce0, 0x8cde, 0x8ce6, 0x8ce4, 0x8cec, 0x8ced, 0x8ce2, 0x8ce3, 0x8cdc, 0x8cea, 0x8ce1, 0x8d6d, 0x8d9f, 0x8da3, 0x8e2b, 0x8e10, 0x8e1d, 0x8e22, 0x8e0f, 0x8e29, 0x8e1f, 0x8e21, 0x8e1e, 0x8eba, 0x8f1d, 0x8f1b, 0x8f1f, 0x8f29, 0x8f26, 0x8f2a, 0x8f1c, 0x8f1e, /* 0xbe */ 0x8f25, 0x9069, 0x906e, 0x9068, 0x906d, 0x9077, 0x9130, 0x912d, 0x9127, 0x9131, 0x9187, 0x9189, 0x918b, 0x9183, 0x92c5, 0x92bb, 0x92b7, 0x92ea, 0x92ac, 0x92e4, 0x92c1, 0x92b3, 0x92bc, 0x92d2, 0x92c7, 0x92f0, 0x92b2, 0x95ad, 0x95b1, 0x9704, 0x9706, 0x9707, 0x9709, 0x9760, 0x978d, 0x978b, 0x978f, 0x9821, 0x982b, 0x981c, 0x98b3, 0x990a, 0x9913, 0x9912, 0x9918, 0x99dd, 0x99d0, 0x99df, 0x99db, 0x99d1, 0x99d5, 0x99d2, 0x99d9, 0x9ab7, 0x9aee, 0x9aef, 0x9b27, 0x9b45, 0x9b44, 0x9b77, 0x9b6f, 0x9d06, 0x9d09, 0x9d03, 0x9ea9, 0x9ebe, 0x9ece, 0x58a8, 0x9f52, 0x5112, 0x5118, 0x5114, 0x5110, 0x5115, 0x5180, 0x51aa, 0x51dd, 0x5291, 0x5293, 0x52f3, 0x5659, 0x566b, 0x5679, 0x5669, 0x5664, 0x5678, 0x566a, 0x5668, 0x5665, 0x5671, 0x566f, 0x566c, 0x5662, 0x5676, 0x58c1, 0x58be, 0x58c7, 0x58c5, 0x596e, 0x5b1d, 0x5b34, 0x5b78, 0x5bf0, 0x5c0e, 0x5f4a, 0x61b2, 0x6191, 0x61a9, 0x618a, 0x61cd, 0x61b6, 0x61be, 0x61ca, 0x61c8, 0x6230, 0x64c5, 0x64c1, 0x64cb, 0x64bb, 0x64bc, 0x64da, 0x64c4, 0x64c7, 0x64c2, 0x64cd, 0x64bf, 0x64d2, 0x64d4, 0x64be, 0x6574, 0x66c6, 0x66c9, 0x66b9, 0x66c4, 0x66c7, 0x66b8, 0x6a3d, 0x6a38, 0x6a3a, 0x6a59, 0x6a6b, 0x6a58, 0x6a39, 0x6a44, 0x6a62, 0x6a61, 0x6a4b, 0x6a47, 0x6a35, 0x6a5f, 0x6a48, 0x6b59, 0x6b77, 0x6c05, 0x6fc2, 0x6fb1, 0x6fa1, /* 0xbf */ 0x6fc3, 0x6fa4, 0x6fc1, 0x6fa7, 0x6fb3, 0x6fc0, 0x6fb9, 0x6fb6, 0x6fa6, 0x6fa0, 0x6fb4, 0x71be, 0x71c9, 0x71d0, 0x71d2, 0x71c8, 0x71d5, 0x71b9, 0x71ce, 0x71d9, 0x71dc, 0x71c3, 0x71c4, 0x7368, 0x749c, 0x74a3, 0x7498, 0x749f, 0x749e, 0x74e2, 0x750c, 0x750d, 0x7634, 0x7638, 0x763a, 0x76e7, 0x76e5, 0x77a0, 0x779e, 0x779f, 0x77a5, 0x78e8, 0x78da, 0x78ec, 0x78e7, 0x79a6, 0x7a4d, 0x7a4e, 0x7a46, 0x7a4c, 0x7a4b, 0x7aba, 0x7bd9, 0x7c11, 0x7bc9, 0x7be4, 0x7bdb, 0x7be1, 0x7be9, 0x7be6, 0x7cd5, 0x7cd6, 0x7e0a, 0x7e11, 0x7e08, 0x7e1b, 0x7e23, 0x7e1e, 0x7e1d, 0x7e09, 0x7e10, 0x7f79, 0x7fb2, 0x7ff0, 0x7ff1, 0x7fee, 0x8028, 0x81b3, 0x81a9, 0x81a8, 0x81fb, 0x8208, 0x8258, 0x8259, 0x854a, 0x8559, 0x8548, 0x8568, 0x8569, 0x8543, 0x8549, 0x856d, 0x856a, 0x855e, 0x8783, 0x879f, 0x879e, 0x87a2, 0x878d, 0x8861, 0x892a, 0x8932, 0x8925, 0x892b, 0x8921, 0x89aa, 0x89a6, 0x8ae6, 0x8afa, 0x8aeb, 0x8af1, 0x8b00, 0x8adc, 0x8ae7, 0x8aee, 0x8afe, 0x8b01, 0x8b02, 0x8af7, 0x8aed, 0x8af3, 0x8af6, 0x8afc, 0x8c6b, 0x8c6d, 0x8c93, 0x8cf4, 0x8e44, 0x8e31, 0x8e34, 0x8e42, 0x8e39, 0x8e35, 0x8f3b, 0x8f2f, 0x8f38, 0x8f33, 0x8fa8, 0x8fa6, 0x9075, 0x9074, 0x9078, 0x9072, 0x907c, 0x907a, 0x9134, 0x9192, 0x9320, 0x9336, 0x92f8, 0x9333, 0x932f, 0x9322, 0x92fc, 0x932b, 0x9304, 0x931a, /* 0xc0 */ 0x9310, 0x9326, 0x9321, 0x9315, 0x932e, 0x9319, 0x95bb, 0x96a7, 0x96a8, 0x96aa, 0x96d5, 0x970e, 0x9711, 0x9716, 0x970d, 0x9713, 0x970f, 0x975b, 0x975c, 0x9766, 0x9798, 0x9830, 0x9838, 0x983b, 0x9837, 0x982d, 0x9839, 0x9824, 0x9910, 0x9928, 0x991e, 0x991b, 0x9921, 0x991a, 0x99ed, 0x99e2, 0x99f1, 0x9ab8, 0x9abc, 0x9afb, 0x9aed, 0x9b28, 0x9b91, 0x9d15, 0x9d23, 0x9d26, 0x9d28, 0x9d12, 0x9d1b, 0x9ed8, 0x9ed4, 0x9f8d, 0x9f9c, 0x512a, 0x511f, 0x5121, 0x5132, 0x52f5, 0x568e, 0x5680, 0x5690, 0x5685, 0x5687, 0x568f, 0x58d5, 0x58d3, 0x58d1, 0x58ce, 0x5b30, 0x5b2a, 0x5b24, 0x5b7a, 0x5c37, 0x5c68, 0x5dbc, 0x5dba, 0x5dbd, 0x5db8, 0x5e6b, 0x5f4c, 0x5fbd, 0x61c9, 0x61c2, 0x61c7, 0x61e6, 0x61cb, 0x6232, 0x6234, 0x64ce, 0x64ca, 0x64d8, 0x64e0, 0x64f0, 0x64e6, 0x64ec, 0x64f1, 0x64e2, 0x64ed, 0x6582, 0x6583, 0x66d9, 0x66d6, 0x6a80, 0x6a94, 0x6a84, 0x6aa2, 0x6a9c, 0x6adb, 0x6aa3, 0x6a7e, 0x6a97, 0x6a90, 0x6aa0, 0x6b5c, 0x6bae, 0x6bda, 0x6c08, 0x6fd8, 0x6ff1, 0x6fdf, 0x6fe0, 0x6fdb, 0x6fe4, 0x6feb, 0x6fef, 0x6f80, 0x6fec, 0x6fe1, 0x6fe9, 0x6fd5, 0x6fee, 0x6ff0, 0x71e7, 0x71df, 0x71ee, 0x71e6, 0x71e5, 0x71ed, 0x71ec, 0x71f4, 0x71e0, 0x7235, 0x7246, 0x7370, 0x7372, 0x74a9, 0x74b0, 0x74a6, 0x74a8, 0x7646, 0x7642, 0x764c, 0x76ea, 0x77b3, 0x77aa, 0x77b0, 0x77ac, /* 0xc1 */ 0x77a7, 0x77ad, 0x77ef, 0x78f7, 0x78fa, 0x78f4, 0x78ef, 0x7901, 0x79a7, 0x79aa, 0x7a57, 0x7abf, 0x7c07, 0x7c0d, 0x7bfe, 0x7bf7, 0x7c0c, 0x7be0, 0x7ce0, 0x7cdc, 0x7cde, 0x7ce2, 0x7cdf, 0x7cd9, 0x7cdd, 0x7e2e, 0x7e3e, 0x7e46, 0x7e37, 0x7e32, 0x7e43, 0x7e2b, 0x7e3d, 0x7e31, 0x7e45, 0x7e41, 0x7e34, 0x7e39, 0x7e48, 0x7e35, 0x7e3f, 0x7e2f, 0x7f44, 0x7ff3, 0x7ffc, 0x8071, 0x8072, 0x8070, 0x806f, 0x8073, 0x81c6, 0x81c3, 0x81ba, 0x81c2, 0x81c0, 0x81bf, 0x81bd, 0x81c9, 0x81be, 0x81e8, 0x8209, 0x8271, 0x85aa, 0x8584, 0x857e, 0x859c, 0x8591, 0x8594, 0x85af, 0x859b, 0x8587, 0x85a8, 0x858a, 0x8667, 0x87c0, 0x87d1, 0x87b3, 0x87d2, 0x87c6, 0x87ab, 0x87bb, 0x87ba, 0x87c8, 0x87cb, 0x893b, 0x8936, 0x8944, 0x8938, 0x893d, 0x89ac, 0x8b0e, 0x8b17, 0x8b19, 0x8b1b, 0x8b0a, 0x8b20, 0x8b1d, 0x8b04, 0x8b10, 0x8c41, 0x8c3f, 0x8c73, 0x8cfa, 0x8cfd, 0x8cfc, 0x8cf8, 0x8cfb, 0x8da8, 0x8e49, 0x8e4b, 0x8e48, 0x8e4a, 0x8f44, 0x8f3e, 0x8f42, 0x8f45, 0x8f3f, 0x907f, 0x907d, 0x9084, 0x9081, 0x9082, 0x9080, 0x9139, 0x91a3, 0x919e, 0x919c, 0x934d, 0x9382, 0x9328, 0x9375, 0x934a, 0x9365, 0x934b, 0x9318, 0x937e, 0x936c, 0x935b, 0x9370, 0x935a, 0x9354, 0x95ca, 0x95cb, 0x95cc, 0x95c8, 0x95c6, 0x96b1, 0x96b8, 0x96d6, 0x971c, 0x971e, 0x97a0, 0x97d3, 0x9846, 0x98b6, 0x9935, 0x9a01, /* 0xc2 */ 0x99ff, 0x9bae, 0x9bab, 0x9baa, 0x9bad, 0x9d3b, 0x9d3f, 0x9e8b, 0x9ecf, 0x9ede, 0x9edc, 0x9edd, 0x9edb, 0x9f3e, 0x9f4b, 0x53e2, 0x5695, 0x56ae, 0x58d9, 0x58d8, 0x5b38, 0x5f5d, 0x61e3, 0x6233, 0x64f4, 0x64f2, 0x64fe, 0x6506, 0x64fa, 0x64fb, 0x64f7, 0x65b7, 0x66dc, 0x6726, 0x6ab3, 0x6aac, 0x6ac3, 0x6abb, 0x6ab8, 0x6ac2, 0x6aae, 0x6aaf, 0x6b5f, 0x6b78, 0x6baf, 0x7009, 0x700b, 0x6ffe, 0x7006, 0x6ffa, 0x7011, 0x700f, 0x71fb, 0x71fc, 0x71fe, 0x71f8, 0x7377, 0x7375, 0x74a7, 0x74bf, 0x7515, 0x7656, 0x7658, 0x7652, 0x77bd, 0x77bf, 0x77bb, 0x77bc, 0x790e, 0x79ae, 0x7a61, 0x7a62, 0x7a60, 0x7ac4, 0x7ac5, 0x7c2b, 0x7c27, 0x7c2a, 0x7c1e, 0x7c23, 0x7c21, 0x7ce7, 0x7e54, 0x7e55, 0x7e5e, 0x7e5a, 0x7e61, 0x7e52, 0x7e59, 0x7f48, 0x7ff9, 0x7ffb, 0x8077, 0x8076, 0x81cd, 0x81cf, 0x820a, 0x85cf, 0x85a9, 0x85cd, 0x85d0, 0x85c9, 0x85b0, 0x85ba, 0x85b9, 0x85a6, 0x87ef, 0x87ec, 0x87f2, 0x87e0, 0x8986, 0x89b2, 0x89f4, 0x8b28, 0x8b39, 0x8b2c, 0x8b2b, 0x8c50, 0x8d05, 0x8e59, 0x8e63, 0x8e66, 0x8e64, 0x8e5f, 0x8e55, 0x8ec0, 0x8f49, 0x8f4d, 0x9087, 0x9083, 0x9088, 0x91ab, 0x91ac, 0x91d0, 0x9394, 0x938a, 0x9396, 0x93a2, 0x93b3, 0x93ae, 0x93ac, 0x93b0, 0x9398, 0x939a, 0x9397, 0x95d4, 0x95d6, 0x95d0, 0x95d5, 0x96e2, 0x96dc, 0x96d9, 0x96db, 0x96de, 0x9724, 0x97a3, 0x97a6, /* 0xc3 */ 0x97ad, 0x97f9, 0x984d, 0x984f, 0x984c, 0x984e, 0x9853, 0x98ba, 0x993e, 0x993f, 0x993d, 0x992e, 0x99a5, 0x9a0e, 0x9ac1, 0x9b03, 0x9b06, 0x9b4f, 0x9b4e, 0x9b4d, 0x9bca, 0x9bc9, 0x9bfd, 0x9bc8, 0x9bc0, 0x9d51, 0x9d5d, 0x9d60, 0x9ee0, 0x9f15, 0x9f2c, 0x5133, 0x56a5, 0x58de, 0x58df, 0x58e2, 0x5bf5, 0x9f90, 0x5eec, 0x61f2, 0x61f7, 0x61f6, 0x61f5, 0x6500, 0x650f, 0x66e0, 0x66dd, 0x6ae5, 0x6add, 0x6ada, 0x6ad3, 0x701b, 0x701f, 0x7028, 0x701a, 0x701d, 0x7015, 0x7018, 0x7206, 0x720d, 0x7258, 0x72a2, 0x7378, 0x737a, 0x74bd, 0x74ca, 0x74e3, 0x7587, 0x7586, 0x765f, 0x7661, 0x77c7, 0x7919, 0x79b1, 0x7a6b, 0x7a69, 0x7c3e, 0x7c3f, 0x7c38, 0x7c3d, 0x7c37, 0x7c40, 0x7e6b, 0x7e6d, 0x7e79, 0x7e69, 0x7e6a, 0x7f85, 0x7e73, 0x7fb6, 0x7fb9, 0x7fb8, 0x81d8, 0x85e9, 0x85dd, 0x85ea, 0x85d5, 0x85e4, 0x85e5, 0x85f7, 0x87fb, 0x8805, 0x880d, 0x87f9, 0x87fe, 0x8960, 0x895f, 0x8956, 0x895e, 0x8b41, 0x8b5c, 0x8b58, 0x8b49, 0x8b5a, 0x8b4e, 0x8b4f, 0x8b46, 0x8b59, 0x8d08, 0x8d0a, 0x8e7c, 0x8e72, 0x8e87, 0x8e76, 0x8e6c, 0x8e7a, 0x8e74, 0x8f54, 0x8f4e, 0x8fad, 0x908a, 0x908b, 0x91b1, 0x91ae, 0x93e1, 0x93d1, 0x93df, 0x93c3, 0x93c8, 0x93dc, 0x93dd, 0x93d6, 0x93e2, 0x93cd, 0x93d8, 0x93e4, 0x93d7, 0x93e8, 0x95dc, 0x96b4, 0x96e3, 0x972a, 0x9727, 0x9761, 0x97dc, 0x97fb, 0x985e, /* 0xc4 */ 0x9858, 0x985b, 0x98bc, 0x9945, 0x9949, 0x9a16, 0x9a19, 0x9b0d, 0x9be8, 0x9be7, 0x9bd6, 0x9bdb, 0x9d89, 0x9d61, 0x9d72, 0x9d6a, 0x9d6c, 0x9e92, 0x9e97, 0x9e93, 0x9eb4, 0x52f8, 0x56a8, 0x56b7, 0x56b6, 0x56b4, 0x56bc, 0x58e4, 0x5b40, 0x5b43, 0x5b7d, 0x5bf6, 0x5dc9, 0x61f8, 0x61fa, 0x6518, 0x6514, 0x6519, 0x66e6, 0x6727, 0x6aec, 0x703e, 0x7030, 0x7032, 0x7210, 0x737b, 0x74cf, 0x7662, 0x7665, 0x7926, 0x792a, 0x792c, 0x792b, 0x7ac7, 0x7af6, 0x7c4c, 0x7c43, 0x7c4d, 0x7cef, 0x7cf0, 0x8fae, 0x7e7d, 0x7e7c, 0x7e82, 0x7f4c, 0x8000, 0x81da, 0x8266, 0x85fb, 0x85f9, 0x8611, 0x85fa, 0x8606, 0x860b, 0x8607, 0x860a, 0x8814, 0x8815, 0x8964, 0x89ba, 0x89f8, 0x8b70, 0x8b6c, 0x8b66, 0x8b6f, 0x8b5f, 0x8b6b, 0x8d0f, 0x8d0d, 0x8e89, 0x8e81, 0x8e85, 0x8e82, 0x91b4, 0x91cb, 0x9418, 0x9403, 0x93fd, 0x95e1, 0x9730, 0x98c4, 0x9952, 0x9951, 0x99a8, 0x9a2b, 0x9a30, 0x9a37, 0x9a35, 0x9c13, 0x9c0d, 0x9e79, 0x9eb5, 0x9ee8, 0x9f2f, 0x9f5f, 0x9f63, 0x9f61, 0x5137, 0x5138, 0x56c1, 0x56c0, 0x56c2, 0x5914, 0x5c6c, 0x5dcd, 0x61fc, 0x61fe, 0x651d, 0x651c, 0x6595, 0x66e9, 0x6afb, 0x6b04, 0x6afa, 0x6bb2, 0x704c, 0x721b, 0x72a7, 0x74d6, 0x74d4, 0x7669, 0x77d3, 0x7c50, 0x7e8f, 0x7e8c, 0x7fbc, 0x8617, 0x862d, 0x861a, 0x8823, 0x8822, 0x8821, 0x881f, 0x896a, 0x896c, 0x89bd, 0x8b74, /* 0xc5 */ 0x8b77, 0x8b7d, 0x8d13, 0x8e8a, 0x8e8d, 0x8e8b, 0x8f5f, 0x8faf, 0x91ba, 0x942e, 0x9433, 0x9435, 0x943a, 0x9438, 0x9432, 0x942b, 0x95e2, 0x9738, 0x9739, 0x9732, 0x97ff, 0x9867, 0x9865, 0x9957, 0x9a45, 0x9a43, 0x9a40, 0x9a3e, 0x9acf, 0x9b54, 0x9b51, 0x9c2d, 0x9c25, 0x9daf, 0x9db4, 0x9dc2, 0x9db8, 0x9e9d, 0x9eef, 0x9f19, 0x9f5c, 0x9f66, 0x9f67, 0x513c, 0x513b, 0x56c8, 0x56ca, 0x56c9, 0x5b7f, 0x5dd4, 0x5dd2, 0x5f4e, 0x61ff, 0x6524, 0x6b0a, 0x6b61, 0x7051, 0x7058, 0x7380, 0x74e4, 0x758a, 0x766e, 0x766c, 0x79b3, 0x7c60, 0x7c5f, 0x807e, 0x807d, 0x81df, 0x8972, 0x896f, 0x89fc, 0x8b80, 0x8d16, 0x8d17, 0x8e91, 0x8e93, 0x8f61, 0x9148, 0x9444, 0x9451, 0x9452, 0x973d, 0x973e, 0x97c3, 0x97c1, 0x986b, 0x9955, 0x9a55, 0x9a4d, 0x9ad2, 0x9b1a, 0x9c49, 0x9c31, 0x9c3e, 0x9c3b, 0x9dd3, 0x9dd7, 0x9f34, 0x9f6c, 0x9f6a, 0x9f94, 0x56cc, 0x5dd6, 0x6200, 0x6523, 0x652b, 0x652a, 0x66ec, 0x6b10, 0x74da, 0x7aca, 0x7c64, 0x7c63, 0x7c65, 0x7e93, 0x7e96, 0x7e94, 0x81e2, 0x8638, 0x863f, 0x8831, 0x8b8a, 0x9090, 0x908f, 0x9463, 0x9460, 0x9464, 0x9768, 0x986f, 0x995c, 0x9a5a, 0x9a5b, 0x9a57, 0x9ad3, 0x9ad4, 0x9ad1, 0x9c54, 0x9c57, 0x9c56, 0x9de5, 0x9e9f, 0x9ef4, 0x56d1, 0x58e9, 0x652c, 0x705e, 0x7671, 0x7672, 0x77d7, 0x7f50, 0x7f88, 0x8836, 0x8839, 0x8862, 0x8b93, 0x8b92, /* 0xc6 */ 0x8b96, 0x8277, 0x8d1b, 0x91c0, 0x946a, 0x9742, 0x9748, 0x9744, 0x97c6, 0x9870, 0x9a5f, 0x9b22, 0x9b58, 0x9c5f, 0x9df9, 0x9dfa, 0x9e7c, 0x9e7d, 0x9f07, 0x9f77, 0x9f72, 0x5ef3, 0x6b16, 0x7063, 0x7c6c, 0x7c6e, 0x883b, 0x89c0, 0x8ea1, 0x91c1, 0x9472, 0x9470, 0x9871, 0x995e, 0x9ad6, 0x9b23, 0x9ecc, 0x7064, 0x77da, 0x8b9a, 0x9477, 0x97c9, 0x9a62, 0x9a65, 0x7e9c, 0x8b9c, 0x8eaa, 0x91c5, 0x947d, 0x947e, 0x947c, 0x9c77, 0x9c78, 0x9ef7, 0x8c54, 0x947f, 0x9e1a, 0x7228, 0x9a6a, 0x9b31, 0x9e1b, 0x9e1e, 0x7c72, 0x30fe, 0x309d, 0x309e, 0x3005, 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, 0x3091, 0x3092, 0x3093, 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, /* 0xc7 */ 0x30a8, 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8, 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0, 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8, 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0, 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0x0414, 0x0415, 0x0401, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, 0x247b, 0x247c, 0x247d, }; static const unsigned short big5_2uni_pagec9[7652] = { /* 0xc9 */ 0x4e42, 0x4e5c, 0x51f5, 0x531a, 0x5382, 0x4e07, 0x4e0c, 0x4e47, 0x4e8d, 0x56d7, 0xfa0c, 0x5c6e, 0x5f73, 0x4e0f, 0x5187, 0x4e0e, 0x4e2e, 0x4e93, 0x4ec2, 0x4ec9, 0x4ec8, 0x5198, 0x52fc, 0x536c, 0x53b9, 0x5720, 0x5903, 0x592c, 0x5c10, 0x5dff, 0x65e1, 0x6bb3, 0x6bcc, 0x6c14, 0x723f, 0x4e31, 0x4e3c, 0x4ee8, 0x4edc, 0x4ee9, 0x4ee1, 0x4edd, 0x4eda, 0x520c, 0x531c, 0x534c, 0x5722, 0x5723, 0x5917, 0x592f, 0x5b81, 0x5b84, 0x5c12, 0x5c3b, 0x5c74, 0x5c73, 0x5e04, 0x5e80, 0x5e82, 0x5fc9, 0x6209, 0x6250, 0x6c15, 0x6c36, 0x6c43, 0x6c3f, 0x6c3b, 0x72ae, 0x72b0, 0x738a, 0x79b8, 0x808a, 0x961e, 0x4f0e, 0x4f18, 0x4f2c, 0x4ef5, 0x4f14, 0x4ef1, 0x4f00, 0x4ef7, 0x4f08, 0x4f1d, 0x4f02, 0x4f05, 0x4f22, 0x4f13, 0x4f04, 0x4ef4, 0x4f12, 0x51b1, 0x5213, 0x5209, 0x5210, 0x52a6, 0x5322, 0x531f, 0x534d, 0x538a, 0x5407, 0x56e1, 0x56df, 0x572e, 0x572a, 0x5734, 0x593c, 0x5980, 0x597c, 0x5985, 0x597b, 0x597e, 0x5977, 0x597f, 0x5b56, 0x5c15, 0x5c25, 0x5c7c, 0x5c7a, 0x5c7b, 0x5c7e, 0x5ddf, 0x5e75, 0x5e84, 0x5f02, 0x5f1a, 0x5f74, 0x5fd5, 0x5fd4, 0x5fcf, 0x625c, 0x625e, 0x6264, 0x6261, 0x6266, 0x6262, 0x6259, 0x6260, 0x625a, 0x6265, 0x65ef, 0x65ee, 0x673e, 0x6739, 0x6738, 0x673b, 0x673a, 0x673f, 0x673c, 0x6733, 0x6c18, 0x6c46, 0x6c52, 0x6c5c, 0x6c4f, 0x6c4a, 0x6c54, 0x6c4b, /* 0xca */ 0x6c4c, 0x7071, 0x725e, 0x72b4, 0x72b5, 0x738e, 0x752a, 0x767f, 0x7a75, 0x7f51, 0x8278, 0x827c, 0x8280, 0x827d, 0x827f, 0x864d, 0x897e, 0x9099, 0x9097, 0x9098, 0x909b, 0x9094, 0x9622, 0x9624, 0x9620, 0x9623, 0x4f56, 0x4f3b, 0x4f62, 0x4f49, 0x4f53, 0x4f64, 0x4f3e, 0x4f67, 0x4f52, 0x4f5f, 0x4f41, 0x4f58, 0x4f2d, 0x4f33, 0x4f3f, 0x4f61, 0x518f, 0x51b9, 0x521c, 0x521e, 0x5221, 0x52ad, 0x52ae, 0x5309, 0x5363, 0x5372, 0x538e, 0x538f, 0x5430, 0x5437, 0x542a, 0x5454, 0x5445, 0x5419, 0x541c, 0x5425, 0x5418, 0x543d, 0x544f, 0x5441, 0x5428, 0x5424, 0x5447, 0x56ee, 0x56e7, 0x56e5, 0x5741, 0x5745, 0x574c, 0x5749, 0x574b, 0x5752, 0x5906, 0x5940, 0x59a6, 0x5998, 0x59a0, 0x5997, 0x598e, 0x59a2, 0x5990, 0x598f, 0x59a7, 0x59a1, 0x5b8e, 0x5b92, 0x5c28, 0x5c2a, 0x5c8d, 0x5c8f, 0x5c88, 0x5c8b, 0x5c89, 0x5c92, 0x5c8a, 0x5c86, 0x5c93, 0x5c95, 0x5de0, 0x5e0a, 0x5e0e, 0x5e8b, 0x5e89, 0x5e8c, 0x5e88, 0x5e8d, 0x5f05, 0x5f1d, 0x5f78, 0x5f76, 0x5fd2, 0x5fd1, 0x5fd0, 0x5fed, 0x5fe8, 0x5fee, 0x5ff3, 0x5fe1, 0x5fe4, 0x5fe3, 0x5ffa, 0x5fef, 0x5ff7, 0x5ffb, 0x6000, 0x5ff4, 0x623a, 0x6283, 0x628c, 0x628e, 0x628f, 0x6294, 0x6287, 0x6271, 0x627b, 0x627a, 0x6270, 0x6281, 0x6288, 0x6277, 0x627d, 0x6272, 0x6274, 0x6537, 0x65f0, 0x65f4, 0x65f3, 0x65f2, 0x65f5, 0x6745, 0x6747, /* 0xcb */ 0x6759, 0x6755, 0x674c, 0x6748, 0x675d, 0x674d, 0x675a, 0x674b, 0x6bd0, 0x6c19, 0x6c1a, 0x6c78, 0x6c67, 0x6c6b, 0x6c84, 0x6c8b, 0x6c8f, 0x6c71, 0x6c6f, 0x6c69, 0x6c9a, 0x6c6d, 0x6c87, 0x6c95, 0x6c9c, 0x6c66, 0x6c73, 0x6c65, 0x6c7b, 0x6c8e, 0x7074, 0x707a, 0x7263, 0x72bf, 0x72bd, 0x72c3, 0x72c6, 0x72c1, 0x72ba, 0x72c5, 0x7395, 0x7397, 0x7393, 0x7394, 0x7392, 0x753a, 0x7539, 0x7594, 0x7595, 0x7681, 0x793d, 0x8034, 0x8095, 0x8099, 0x8090, 0x8092, 0x809c, 0x8290, 0x828f, 0x8285, 0x828e, 0x8291, 0x8293, 0x828a, 0x8283, 0x8284, 0x8c78, 0x8fc9, 0x8fbf, 0x909f, 0x90a1, 0x90a5, 0x909e, 0x90a7, 0x90a0, 0x9630, 0x9628, 0x962f, 0x962d, 0x4e33, 0x4f98, 0x4f7c, 0x4f85, 0x4f7d, 0x4f80, 0x4f87, 0x4f76, 0x4f74, 0x4f89, 0x4f84, 0x4f77, 0x4f4c, 0x4f97, 0x4f6a, 0x4f9a, 0x4f79, 0x4f81, 0x4f78, 0x4f90, 0x4f9c, 0x4f94, 0x4f9e, 0x4f92, 0x4f82, 0x4f95, 0x4f6b, 0x4f6e, 0x519e, 0x51bc, 0x51be, 0x5235, 0x5232, 0x5233, 0x5246, 0x5231, 0x52bc, 0x530a, 0x530b, 0x533c, 0x5392, 0x5394, 0x5487, 0x547f, 0x5481, 0x5491, 0x5482, 0x5488, 0x546b, 0x547a, 0x547e, 0x5465, 0x546c, 0x5474, 0x5466, 0x548d, 0x546f, 0x5461, 0x5460, 0x5498, 0x5463, 0x5467, 0x5464, 0x56f7, 0x56f9, 0x576f, 0x5772, 0x576d, 0x576b, 0x5771, 0x5770, 0x5776, 0x5780, 0x5775, 0x577b, 0x5773, 0x5774, 0x5762, /* 0xcc */ 0x5768, 0x577d, 0x590c, 0x5945, 0x59b5, 0x59ba, 0x59cf, 0x59ce, 0x59b2, 0x59cc, 0x59c1, 0x59b6, 0x59bc, 0x59c3, 0x59d6, 0x59b1, 0x59bd, 0x59c0, 0x59c8, 0x59b4, 0x59c7, 0x5b62, 0x5b65, 0x5b93, 0x5b95, 0x5c44, 0x5c47, 0x5cae, 0x5ca4, 0x5ca0, 0x5cb5, 0x5caf, 0x5ca8, 0x5cac, 0x5c9f, 0x5ca3, 0x5cad, 0x5ca2, 0x5caa, 0x5ca7, 0x5c9d, 0x5ca5, 0x5cb6, 0x5cb0, 0x5ca6, 0x5e17, 0x5e14, 0x5e19, 0x5f28, 0x5f22, 0x5f23, 0x5f24, 0x5f54, 0x5f82, 0x5f7e, 0x5f7d, 0x5fde, 0x5fe5, 0x602d, 0x6026, 0x6019, 0x6032, 0x600b, 0x6034, 0x600a, 0x6017, 0x6033, 0x601a, 0x601e, 0x602c, 0x6022, 0x600d, 0x6010, 0x602e, 0x6013, 0x6011, 0x600c, 0x6009, 0x601c, 0x6214, 0x623d, 0x62ad, 0x62b4, 0x62d1, 0x62be, 0x62aa, 0x62b6, 0x62ca, 0x62ae, 0x62b3, 0x62af, 0x62bb, 0x62a9, 0x62b0, 0x62b8, 0x653d, 0x65a8, 0x65bb, 0x6609, 0x65fc, 0x6604, 0x6612, 0x6608, 0x65fb, 0x6603, 0x660b, 0x660d, 0x6605, 0x65fd, 0x6611, 0x6610, 0x66f6, 0x670a, 0x6785, 0x676c, 0x678e, 0x6792, 0x6776, 0x677b, 0x6798, 0x6786, 0x6784, 0x6774, 0x678d, 0x678c, 0x677a, 0x679f, 0x6791, 0x6799, 0x6783, 0x677d, 0x6781, 0x6778, 0x6779, 0x6794, 0x6b25, 0x6b80, 0x6b7e, 0x6bde, 0x6c1d, 0x6c93, 0x6cec, 0x6ceb, 0x6cee, 0x6cd9, 0x6cb6, 0x6cd4, 0x6cad, 0x6ce7, 0x6cb7, 0x6cd0, 0x6cc2, 0x6cba, 0x6cc3, 0x6cc6, 0x6ced, 0x6cf2, /* 0xcd */ 0x6cd2, 0x6cdd, 0x6cb4, 0x6c8a, 0x6c9d, 0x6c80, 0x6cde, 0x6cc0, 0x6d30, 0x6ccd, 0x6cc7, 0x6cb0, 0x6cf9, 0x6ccf, 0x6ce9, 0x6cd1, 0x7094, 0x7098, 0x7085, 0x7093, 0x7086, 0x7084, 0x7091, 0x7096, 0x7082, 0x709a, 0x7083, 0x726a, 0x72d6, 0x72cb, 0x72d8, 0x72c9, 0x72dc, 0x72d2, 0x72d4, 0x72da, 0x72cc, 0x72d1, 0x73a4, 0x73a1, 0x73ad, 0x73a6, 0x73a2, 0x73a0, 0x73ac, 0x739d, 0x74dd, 0x74e8, 0x753f, 0x7540, 0x753e, 0x758c, 0x7598, 0x76af, 0x76f3, 0x76f1, 0x76f0, 0x76f5, 0x77f8, 0x77fc, 0x77f9, 0x77fb, 0x77fa, 0x77f7, 0x7942, 0x793f, 0x79c5, 0x7a78, 0x7a7b, 0x7afb, 0x7c75, 0x7cfd, 0x8035, 0x808f, 0x80ae, 0x80a3, 0x80b8, 0x80b5, 0x80ad, 0x8220, 0x82a0, 0x82c0, 0x82ab, 0x829a, 0x8298, 0x829b, 0x82b5, 0x82a7, 0x82ae, 0x82bc, 0x829e, 0x82ba, 0x82b4, 0x82a8, 0x82a1, 0x82a9, 0x82c2, 0x82a4, 0x82c3, 0x82b6, 0x82a2, 0x8670, 0x866f, 0x866d, 0x866e, 0x8c56, 0x8fd2, 0x8fcb, 0x8fd3, 0x8fcd, 0x8fd6, 0x8fd5, 0x8fd7, 0x90b2, 0x90b4, 0x90af, 0x90b3, 0x90b0, 0x9639, 0x963d, 0x963c, 0x963a, 0x9643, 0x4fcd, 0x4fc5, 0x4fd3, 0x4fb2, 0x4fc9, 0x4fcb, 0x4fc1, 0x4fd4, 0x4fdc, 0x4fd9, 0x4fbb, 0x4fb3, 0x4fdb, 0x4fc7, 0x4fd6, 0x4fba, 0x4fc0, 0x4fb9, 0x4fec, 0x5244, 0x5249, 0x52c0, 0x52c2, 0x533d, 0x537c, 0x5397, 0x5396, 0x5399, 0x5398, 0x54ba, 0x54a1, 0x54ad, 0x54a5, 0x54cf, /* 0xce */ 0x54c3, 0x830d, 0x54b7, 0x54ae, 0x54d6, 0x54b6, 0x54c5, 0x54c6, 0x54a0, 0x5470, 0x54bc, 0x54a2, 0x54be, 0x5472, 0x54de, 0x54b0, 0x57b5, 0x579e, 0x579f, 0x57a4, 0x578c, 0x5797, 0x579d, 0x579b, 0x5794, 0x5798, 0x578f, 0x5799, 0x57a5, 0x579a, 0x5795, 0x58f4, 0x590d, 0x5953, 0x59e1, 0x59de, 0x59ee, 0x5a00, 0x59f1, 0x59dd, 0x59fa, 0x59fd, 0x59fc, 0x59f6, 0x59e4, 0x59f2, 0x59f7, 0x59db, 0x59e9, 0x59f3, 0x59f5, 0x59e0, 0x59fe, 0x59f4, 0x59ed, 0x5ba8, 0x5c4c, 0x5cd0, 0x5cd8, 0x5ccc, 0x5cd7, 0x5ccb, 0x5cdb, 0x5cde, 0x5cda, 0x5cc9, 0x5cc7, 0x5cca, 0x5cd6, 0x5cd3, 0x5cd4, 0x5ccf, 0x5cc8, 0x5cc6, 0x5cce, 0x5cdf, 0x5cf8, 0x5df9, 0x5e21, 0x5e22, 0x5e23, 0x5e20, 0x5e24, 0x5eb0, 0x5ea4, 0x5ea2, 0x5e9b, 0x5ea3, 0x5ea5, 0x5f07, 0x5f2e, 0x5f56, 0x5f86, 0x6037, 0x6039, 0x6054, 0x6072, 0x605e, 0x6045, 0x6053, 0x6047, 0x6049, 0x605b, 0x604c, 0x6040, 0x6042, 0x605f, 0x6024, 0x6044, 0x6058, 0x6066, 0x606e, 0x6242, 0x6243, 0x62cf, 0x630d, 0x630b, 0x62f5, 0x630e, 0x6303, 0x62eb, 0x62f9, 0x630f, 0x630c, 0x62f8, 0x62f6, 0x6300, 0x6313, 0x6314, 0x62fa, 0x6315, 0x62fb, 0x62f0, 0x6541, 0x6543, 0x65aa, 0x65bf, 0x6636, 0x6621, 0x6632, 0x6635, 0x661c, 0x6626, 0x6622, 0x6633, 0x662b, 0x663a, 0x661d, 0x6634, 0x6639, 0x662e, 0x670f, 0x6710, 0x67c1, 0x67f2, 0x67c8, 0x67ba, /* 0xcf */ 0x67dc, 0x67bb, 0x67f8, 0x67d8, 0x67c0, 0x67b7, 0x67c5, 0x67eb, 0x67e4, 0x67df, 0x67b5, 0x67cd, 0x67b3, 0x67f7, 0x67f6, 0x67ee, 0x67e3, 0x67c2, 0x67b9, 0x67ce, 0x67e7, 0x67f0, 0x67b2, 0x67fc, 0x67c6, 0x67ed, 0x67cc, 0x67ae, 0x67e6, 0x67db, 0x67fa, 0x67c9, 0x67ca, 0x67c3, 0x67ea, 0x67cb, 0x6b28, 0x6b82, 0x6b84, 0x6bb6, 0x6bd6, 0x6bd8, 0x6be0, 0x6c20, 0x6c21, 0x6d28, 0x6d34, 0x6d2d, 0x6d1f, 0x6d3c, 0x6d3f, 0x6d12, 0x6d0a, 0x6cda, 0x6d33, 0x6d04, 0x6d19, 0x6d3a, 0x6d1a, 0x6d11, 0x6d00, 0x6d1d, 0x6d42, 0x6d01, 0x6d18, 0x6d37, 0x6d03, 0x6d0f, 0x6d40, 0x6d07, 0x6d20, 0x6d2c, 0x6d08, 0x6d22, 0x6d09, 0x6d10, 0x70b7, 0x709f, 0x70be, 0x70b1, 0x70b0, 0x70a1, 0x70b4, 0x70b5, 0x70a9, 0x7241, 0x7249, 0x724a, 0x726c, 0x7270, 0x7273, 0x726e, 0x72ca, 0x72e4, 0x72e8, 0x72eb, 0x72df, 0x72ea, 0x72e6, 0x72e3, 0x7385, 0x73cc, 0x73c2, 0x73c8, 0x73c5, 0x73b9, 0x73b6, 0x73b5, 0x73b4, 0x73eb, 0x73bf, 0x73c7, 0x73be, 0x73c3, 0x73c6, 0x73b8, 0x73cb, 0x74ec, 0x74ee, 0x752e, 0x7547, 0x7548, 0x75a7, 0x75aa, 0x7679, 0x76c4, 0x7708, 0x7703, 0x7704, 0x7705, 0x770a, 0x76f7, 0x76fb, 0x76fa, 0x77e7, 0x77e8, 0x7806, 0x7811, 0x7812, 0x7805, 0x7810, 0x780f, 0x780e, 0x7809, 0x7803, 0x7813, 0x794a, 0x794c, 0x794b, 0x7945, 0x7944, 0x79d5, 0x79cd, 0x79cf, 0x79d6, 0x79ce, 0x7a80, /* 0xd0 */ 0x7a7e, 0x7ad1, 0x7b00, 0x7b01, 0x7c7a, 0x7c78, 0x7c79, 0x7c7f, 0x7c80, 0x7c81, 0x7d03, 0x7d08, 0x7d01, 0x7f58, 0x7f91, 0x7f8d, 0x7fbe, 0x8007, 0x800e, 0x800f, 0x8014, 0x8037, 0x80d8, 0x80c7, 0x80e0, 0x80d1, 0x80c8, 0x80c2, 0x80d0, 0x80c5, 0x80e3, 0x80d9, 0x80dc, 0x80ca, 0x80d5, 0x80c9, 0x80cf, 0x80d7, 0x80e6, 0x80cd, 0x81ff, 0x8221, 0x8294, 0x82d9, 0x82fe, 0x82f9, 0x8307, 0x82e8, 0x8300, 0x82d5, 0x833a, 0x82eb, 0x82d6, 0x82f4, 0x82ec, 0x82e1, 0x82f2, 0x82f5, 0x830c, 0x82fb, 0x82f6, 0x82f0, 0x82ea, 0x82e4, 0x82e0, 0x82fa, 0x82f3, 0x82ed, 0x8677, 0x8674, 0x867c, 0x8673, 0x8841, 0x884e, 0x8867, 0x886a, 0x8869, 0x89d3, 0x8a04, 0x8a07, 0x8d72, 0x8fe3, 0x8fe1, 0x8fee, 0x8fe0, 0x90f1, 0x90bd, 0x90bf, 0x90d5, 0x90c5, 0x90be, 0x90c7, 0x90cb, 0x90c8, 0x91d4, 0x91d3, 0x9654, 0x964f, 0x9651, 0x9653, 0x964a, 0x964e, 0x501e, 0x5005, 0x5007, 0x5013, 0x5022, 0x5030, 0x501b, 0x4ff5, 0x4ff4, 0x5033, 0x5037, 0x502c, 0x4ff6, 0x4ff7, 0x5017, 0x501c, 0x5020, 0x5027, 0x5035, 0x502f, 0x5031, 0x500e, 0x515a, 0x5194, 0x5193, 0x51ca, 0x51c4, 0x51c5, 0x51c8, 0x51ce, 0x5261, 0x525a, 0x5252, 0x525e, 0x525f, 0x5255, 0x5262, 0x52cd, 0x530e, 0x539e, 0x5526, 0x54e2, 0x5517, 0x5512, 0x54e7, 0x54f3, 0x54e4, 0x551a, 0x54ff, 0x5504, 0x5508, 0x54eb, 0x5511, 0x5505, 0x54f1, /* 0xd1 */ 0x550a, 0x54fb, 0x54f7, 0x54f8, 0x54e0, 0x550e, 0x5503, 0x550b, 0x5701, 0x5702, 0x57cc, 0x5832, 0x57d5, 0x57d2, 0x57ba, 0x57c6, 0x57bd, 0x57bc, 0x57b8, 0x57b6, 0x57bf, 0x57c7, 0x57d0, 0x57b9, 0x57c1, 0x590e, 0x594a, 0x5a19, 0x5a16, 0x5a2d, 0x5a2e, 0x5a15, 0x5a0f, 0x5a17, 0x5a0a, 0x5a1e, 0x5a33, 0x5b6c, 0x5ba7, 0x5bad, 0x5bac, 0x5c03, 0x5c56, 0x5c54, 0x5cec, 0x5cff, 0x5cee, 0x5cf1, 0x5cf7, 0x5d00, 0x5cf9, 0x5e29, 0x5e28, 0x5ea8, 0x5eae, 0x5eaa, 0x5eac, 0x5f33, 0x5f30, 0x5f67, 0x605d, 0x605a, 0x6067, 0x6041, 0x60a2, 0x6088, 0x6080, 0x6092, 0x6081, 0x609d, 0x6083, 0x6095, 0x609b, 0x6097, 0x6087, 0x609c, 0x608e, 0x6219, 0x6246, 0x62f2, 0x6310, 0x6356, 0x632c, 0x6344, 0x6345, 0x6336, 0x6343, 0x63e4, 0x6339, 0x634b, 0x634a, 0x633c, 0x6329, 0x6341, 0x6334, 0x6358, 0x6354, 0x6359, 0x632d, 0x6347, 0x6333, 0x635a, 0x6351, 0x6338, 0x6357, 0x6340, 0x6348, 0x654a, 0x6546, 0x65c6, 0x65c3, 0x65c4, 0x65c2, 0x664a, 0x665f, 0x6647, 0x6651, 0x6712, 0x6713, 0x681f, 0x681a, 0x6849, 0x6832, 0x6833, 0x683b, 0x684b, 0x684f, 0x6816, 0x6831, 0x681c, 0x6835, 0x682b, 0x682d, 0x682f, 0x684e, 0x6844, 0x6834, 0x681d, 0x6812, 0x6814, 0x6826, 0x6828, 0x682e, 0x684d, 0x683a, 0x6825, 0x6820, 0x6b2c, 0x6b2f, 0x6b2d, 0x6b31, 0x6b34, 0x6b6d, 0x8082, 0x6b88, 0x6be6, 0x6be4, /* 0xd2 */ 0x6be8, 0x6be3, 0x6be2, 0x6be7, 0x6c25, 0x6d7a, 0x6d63, 0x6d64, 0x6d76, 0x6d0d, 0x6d61, 0x6d92, 0x6d58, 0x6d62, 0x6d6d, 0x6d6f, 0x6d91, 0x6d8d, 0x6def, 0x6d7f, 0x6d86, 0x6d5e, 0x6d67, 0x6d60, 0x6d97, 0x6d70, 0x6d7c, 0x6d5f, 0x6d82, 0x6d98, 0x6d2f, 0x6d68, 0x6d8b, 0x6d7e, 0x6d80, 0x6d84, 0x6d16, 0x6d83, 0x6d7b, 0x6d7d, 0x6d75, 0x6d90, 0x70dc, 0x70d3, 0x70d1, 0x70dd, 0x70cb, 0x7f39, 0x70e2, 0x70d7, 0x70d2, 0x70de, 0x70e0, 0x70d4, 0x70cd, 0x70c5, 0x70c6, 0x70c7, 0x70da, 0x70ce, 0x70e1, 0x7242, 0x7278, 0x7277, 0x7276, 0x7300, 0x72fa, 0x72f4, 0x72fe, 0x72f6, 0x72f3, 0x72fb, 0x7301, 0x73d3, 0x73d9, 0x73e5, 0x73d6, 0x73bc, 0x73e7, 0x73e3, 0x73e9, 0x73dc, 0x73d2, 0x73db, 0x73d4, 0x73dd, 0x73da, 0x73d7, 0x73d8, 0x73e8, 0x74de, 0x74df, 0x74f4, 0x74f5, 0x7521, 0x755b, 0x755f, 0x75b0, 0x75c1, 0x75bb, 0x75c4, 0x75c0, 0x75bf, 0x75b6, 0x75ba, 0x768a, 0x76c9, 0x771d, 0x771b, 0x7710, 0x7713, 0x7712, 0x7723, 0x7711, 0x7715, 0x7719, 0x771a, 0x7722, 0x7727, 0x7823, 0x782c, 0x7822, 0x7835, 0x782f, 0x7828, 0x782e, 0x782b, 0x7821, 0x7829, 0x7833, 0x782a, 0x7831, 0x7954, 0x795b, 0x794f, 0x795c, 0x7953, 0x7952, 0x7951, 0x79eb, 0x79ec, 0x79e0, 0x79ee, 0x79ed, 0x79ea, 0x79dc, 0x79de, 0x79dd, 0x7a86, 0x7a89, 0x7a85, 0x7a8b, 0x7a8c, 0x7a8a, 0x7a87, 0x7ad8, 0x7b10, /* 0xd3 */ 0x7b04, 0x7b13, 0x7b05, 0x7b0f, 0x7b08, 0x7b0a, 0x7b0e, 0x7b09, 0x7b12, 0x7c84, 0x7c91, 0x7c8a, 0x7c8c, 0x7c88, 0x7c8d, 0x7c85, 0x7d1e, 0x7d1d, 0x7d11, 0x7d0e, 0x7d18, 0x7d16, 0x7d13, 0x7d1f, 0x7d12, 0x7d0f, 0x7d0c, 0x7f5c, 0x7f61, 0x7f5e, 0x7f60, 0x7f5d, 0x7f5b, 0x7f96, 0x7f92, 0x7fc3, 0x7fc2, 0x7fc0, 0x8016, 0x803e, 0x8039, 0x80fa, 0x80f2, 0x80f9, 0x80f5, 0x8101, 0x80fb, 0x8100, 0x8201, 0x822f, 0x8225, 0x8333, 0x832d, 0x8344, 0x8319, 0x8351, 0x8325, 0x8356, 0x833f, 0x8341, 0x8326, 0x831c, 0x8322, 0x8342, 0x834e, 0x831b, 0x832a, 0x8308, 0x833c, 0x834d, 0x8316, 0x8324, 0x8320, 0x8337, 0x832f, 0x8329, 0x8347, 0x8345, 0x834c, 0x8353, 0x831e, 0x832c, 0x834b, 0x8327, 0x8348, 0x8653, 0x8652, 0x86a2, 0x86a8, 0x8696, 0x868d, 0x8691, 0x869e, 0x8687, 0x8697, 0x8686, 0x868b, 0x869a, 0x8685, 0x86a5, 0x8699, 0x86a1, 0x86a7, 0x8695, 0x8698, 0x868e, 0x869d, 0x8690, 0x8694, 0x8843, 0x8844, 0x886d, 0x8875, 0x8876, 0x8872, 0x8880, 0x8871, 0x887f, 0x886f, 0x8883, 0x887e, 0x8874, 0x887c, 0x8a12, 0x8c47, 0x8c57, 0x8c7b, 0x8ca4, 0x8ca3, 0x8d76, 0x8d78, 0x8db5, 0x8db7, 0x8db6, 0x8ed1, 0x8ed3, 0x8ffe, 0x8ff5, 0x9002, 0x8fff, 0x8ffb, 0x9004, 0x8ffc, 0x8ff6, 0x90d6, 0x90e0, 0x90d9, 0x90da, 0x90e3, 0x90df, 0x90e5, 0x90d8, 0x90db, 0x90d7, 0x90dc, 0x90e4, 0x9150, /* 0xd4 */ 0x914e, 0x914f, 0x91d5, 0x91e2, 0x91da, 0x965c, 0x965f, 0x96bc, 0x98e3, 0x9adf, 0x9b2f, 0x4e7f, 0x5070, 0x506a, 0x5061, 0x505e, 0x5060, 0x5053, 0x504b, 0x505d, 0x5072, 0x5048, 0x504d, 0x5041, 0x505b, 0x504a, 0x5062, 0x5015, 0x5045, 0x505f, 0x5069, 0x506b, 0x5063, 0x5064, 0x5046, 0x5040, 0x506e, 0x5073, 0x5057, 0x5051, 0x51d0, 0x526b, 0x526d, 0x526c, 0x526e, 0x52d6, 0x52d3, 0x532d, 0x539c, 0x5575, 0x5576, 0x553c, 0x554d, 0x5550, 0x5534, 0x552a, 0x5551, 0x5562, 0x5536, 0x5535, 0x5530, 0x5552, 0x5545, 0x550c, 0x5532, 0x5565, 0x554e, 0x5539, 0x5548, 0x552d, 0x553b, 0x5540, 0x554b, 0x570a, 0x5707, 0x57fb, 0x5814, 0x57e2, 0x57f6, 0x57dc, 0x57f4, 0x5800, 0x57ed, 0x57fd, 0x5808, 0x57f8, 0x580b, 0x57f3, 0x57cf, 0x5807, 0x57ee, 0x57e3, 0x57f2, 0x57e5, 0x57ec, 0x57e1, 0x580e, 0x57fc, 0x5810, 0x57e7, 0x5801, 0x580c, 0x57f1, 0x57e9, 0x57f0, 0x580d, 0x5804, 0x595c, 0x5a60, 0x5a58, 0x5a55, 0x5a67, 0x5a5e, 0x5a38, 0x5a35, 0x5a6d, 0x5a50, 0x5a5f, 0x5a65, 0x5a6c, 0x5a53, 0x5a64, 0x5a57, 0x5a43, 0x5a5d, 0x5a52, 0x5a44, 0x5a5b, 0x5a48, 0x5a8e, 0x5a3e, 0x5a4d, 0x5a39, 0x5a4c, 0x5a70, 0x5a69, 0x5a47, 0x5a51, 0x5a56, 0x5a42, 0x5a5c, 0x5b72, 0x5b6e, 0x5bc1, 0x5bc0, 0x5c59, 0x5d1e, 0x5d0b, 0x5d1d, 0x5d1a, 0x5d20, 0x5d0c, 0x5d28, 0x5d0d, 0x5d26, 0x5d25, 0x5d0f, /* 0xd5 */ 0x5d30, 0x5d12, 0x5d23, 0x5d1f, 0x5d2e, 0x5e3e, 0x5e34, 0x5eb1, 0x5eb4, 0x5eb9, 0x5eb2, 0x5eb3, 0x5f36, 0x5f38, 0x5f9b, 0x5f96, 0x5f9f, 0x608a, 0x6090, 0x6086, 0x60be, 0x60b0, 0x60ba, 0x60d3, 0x60d4, 0x60cf, 0x60e4, 0x60d9, 0x60dd, 0x60c8, 0x60b1, 0x60db, 0x60b7, 0x60ca, 0x60bf, 0x60c3, 0x60cd, 0x60c0, 0x6332, 0x6365, 0x638a, 0x6382, 0x637d, 0x63bd, 0x639e, 0x63ad, 0x639d, 0x6397, 0x63ab, 0x638e, 0x636f, 0x6387, 0x6390, 0x636e, 0x63af, 0x6375, 0x639c, 0x636d, 0x63ae, 0x637c, 0x63a4, 0x633b, 0x639f, 0x6378, 0x6385, 0x6381, 0x6391, 0x638d, 0x6370, 0x6553, 0x65cd, 0x6665, 0x6661, 0x665b, 0x6659, 0x665c, 0x6662, 0x6718, 0x6879, 0x6887, 0x6890, 0x689c, 0x686d, 0x686e, 0x68ae, 0x68ab, 0x6956, 0x686f, 0x68a3, 0x68ac, 0x68a9, 0x6875, 0x6874, 0x68b2, 0x688f, 0x6877, 0x6892, 0x687c, 0x686b, 0x6872, 0x68aa, 0x6880, 0x6871, 0x687e, 0x689b, 0x6896, 0x688b, 0x68a0, 0x6889, 0x68a4, 0x6878, 0x687b, 0x6891, 0x688c, 0x688a, 0x687d, 0x6b36, 0x6b33, 0x6b37, 0x6b38, 0x6b91, 0x6b8f, 0x6b8d, 0x6b8e, 0x6b8c, 0x6c2a, 0x6dc0, 0x6dab, 0x6db4, 0x6db3, 0x6e74, 0x6dac, 0x6de9, 0x6de2, 0x6db7, 0x6df6, 0x6dd4, 0x6e00, 0x6dc8, 0x6de0, 0x6ddf, 0x6dd6, 0x6dbe, 0x6de5, 0x6ddc, 0x6ddd, 0x6ddb, 0x6df4, 0x6dca, 0x6dbd, 0x6ded, 0x6df0, 0x6dba, 0x6dd5, 0x6dc2, 0x6dcf, 0x6dc9, /* 0xd6 */ 0x6dd0, 0x6df2, 0x6dd3, 0x6dfd, 0x6dd7, 0x6dcd, 0x6de3, 0x6dbb, 0x70fa, 0x710d, 0x70f7, 0x7117, 0x70f4, 0x710c, 0x70f0, 0x7104, 0x70f3, 0x7110, 0x70fc, 0x70ff, 0x7106, 0x7113, 0x7100, 0x70f8, 0x70f6, 0x710b, 0x7102, 0x710e, 0x727e, 0x727b, 0x727c, 0x727f, 0x731d, 0x7317, 0x7307, 0x7311, 0x7318, 0x730a, 0x7308, 0x72ff, 0x730f, 0x731e, 0x7388, 0x73f6, 0x73f8, 0x73f5, 0x7404, 0x7401, 0x73fd, 0x7407, 0x7400, 0x73fa, 0x73fc, 0x73ff, 0x740c, 0x740b, 0x73f4, 0x7408, 0x7564, 0x7563, 0x75ce, 0x75d2, 0x75cf, 0x75cb, 0x75cc, 0x75d1, 0x75d0, 0x768f, 0x7689, 0x76d3, 0x7739, 0x772f, 0x772d, 0x7731, 0x7732, 0x7734, 0x7733, 0x773d, 0x7725, 0x773b, 0x7735, 0x7848, 0x7852, 0x7849, 0x784d, 0x784a, 0x784c, 0x7826, 0x7845, 0x7850, 0x7964, 0x7967, 0x7969, 0x796a, 0x7963, 0x796b, 0x7961, 0x79bb, 0x79fa, 0x79f8, 0x79f6, 0x79f7, 0x7a8f, 0x7a94, 0x7a90, 0x7b35, 0x7b47, 0x7b34, 0x7b25, 0x7b30, 0x7b22, 0x7b24, 0x7b33, 0x7b18, 0x7b2a, 0x7b1d, 0x7b31, 0x7b2b, 0x7b2d, 0x7b2f, 0x7b32, 0x7b38, 0x7b1a, 0x7b23, 0x7c94, 0x7c98, 0x7c96, 0x7ca3, 0x7d35, 0x7d3d, 0x7d38, 0x7d36, 0x7d3a, 0x7d45, 0x7d2c, 0x7d29, 0x7d41, 0x7d47, 0x7d3e, 0x7d3f, 0x7d4a, 0x7d3b, 0x7d28, 0x7f63, 0x7f95, 0x7f9c, 0x7f9d, 0x7f9b, 0x7fca, 0x7fcb, 0x7fcd, 0x7fd0, 0x7fd1, 0x7fc7, 0x7fcf, 0x7fc9, 0x801f, /* 0xd7 */ 0x801e, 0x801b, 0x8047, 0x8043, 0x8048, 0x8118, 0x8125, 0x8119, 0x811b, 0x812d, 0x811f, 0x812c, 0x811e, 0x8121, 0x8115, 0x8127, 0x811d, 0x8122, 0x8211, 0x8238, 0x8233, 0x823a, 0x8234, 0x8232, 0x8274, 0x8390, 0x83a3, 0x83a8, 0x838d, 0x837a, 0x8373, 0x83a4, 0x8374, 0x838f, 0x8381, 0x8395, 0x8399, 0x8375, 0x8394, 0x83a9, 0x837d, 0x8383, 0x838c, 0x839d, 0x839b, 0x83aa, 0x838b, 0x837e, 0x83a5, 0x83af, 0x8388, 0x8397, 0x83b0, 0x837f, 0x83a6, 0x8387, 0x83ae, 0x8376, 0x839a, 0x8659, 0x8656, 0x86bf, 0x86b7, 0x86c2, 0x86c1, 0x86c5, 0x86ba, 0x86b0, 0x86c8, 0x86b9, 0x86b3, 0x86b8, 0x86cc, 0x86b4, 0x86bb, 0x86bc, 0x86c3, 0x86bd, 0x86be, 0x8852, 0x8889, 0x8895, 0x88a8, 0x88a2, 0x88aa, 0x889a, 0x8891, 0x88a1, 0x889f, 0x8898, 0x88a7, 0x8899, 0x889b, 0x8897, 0x88a4, 0x88ac, 0x888c, 0x8893, 0x888e, 0x8982, 0x89d6, 0x89d9, 0x89d5, 0x8a30, 0x8a27, 0x8a2c, 0x8a1e, 0x8c39, 0x8c3b, 0x8c5c, 0x8c5d, 0x8c7d, 0x8ca5, 0x8d7d, 0x8d7b, 0x8d79, 0x8dbc, 0x8dc2, 0x8db9, 0x8dbf, 0x8dc1, 0x8ed8, 0x8ede, 0x8edd, 0x8edc, 0x8ed7, 0x8ee0, 0x8ee1, 0x9024, 0x900b, 0x9011, 0x901c, 0x900c, 0x9021, 0x90ef, 0x90ea, 0x90f0, 0x90f4, 0x90f2, 0x90f3, 0x90d4, 0x90eb, 0x90ec, 0x90e9, 0x9156, 0x9158, 0x915a, 0x9153, 0x9155, 0x91ec, 0x91f4, 0x91f1, 0x91f3, 0x91f8, 0x91e4, 0x91f9, 0x91ea, /* 0xd8 */ 0x91eb, 0x91f7, 0x91e8, 0x91ee, 0x957a, 0x9586, 0x9588, 0x967c, 0x966d, 0x966b, 0x9671, 0x966f, 0x96bf, 0x976a, 0x9804, 0x98e5, 0x9997, 0x509b, 0x5095, 0x5094, 0x509e, 0x508b, 0x50a3, 0x5083, 0x508c, 0x508e, 0x509d, 0x5068, 0x509c, 0x5092, 0x5082, 0x5087, 0x515f, 0x51d4, 0x5312, 0x5311, 0x53a4, 0x53a7, 0x5591, 0x55a8, 0x55a5, 0x55ad, 0x5577, 0x5645, 0x55a2, 0x5593, 0x5588, 0x558f, 0x55b5, 0x5581, 0x55a3, 0x5592, 0x55a4, 0x557d, 0x558c, 0x55a6, 0x557f, 0x5595, 0x55a1, 0x558e, 0x570c, 0x5829, 0x5837, 0x5819, 0x581e, 0x5827, 0x5823, 0x5828, 0x57f5, 0x5848, 0x5825, 0x581c, 0x581b, 0x5833, 0x583f, 0x5836, 0x582e, 0x5839, 0x5838, 0x582d, 0x582c, 0x583b, 0x5961, 0x5aaf, 0x5a94, 0x5a9f, 0x5a7a, 0x5aa2, 0x5a9e, 0x5a78, 0x5aa6, 0x5a7c, 0x5aa5, 0x5aac, 0x5a95, 0x5aae, 0x5a37, 0x5a84, 0x5a8a, 0x5a97, 0x5a83, 0x5a8b, 0x5aa9, 0x5a7b, 0x5a7d, 0x5a8c, 0x5a9c, 0x5a8f, 0x5a93, 0x5a9d, 0x5bea, 0x5bcd, 0x5bcb, 0x5bd4, 0x5bd1, 0x5bca, 0x5bce, 0x5c0c, 0x5c30, 0x5d37, 0x5d43, 0x5d6b, 0x5d41, 0x5d4b, 0x5d3f, 0x5d35, 0x5d51, 0x5d4e, 0x5d55, 0x5d33, 0x5d3a, 0x5d52, 0x5d3d, 0x5d31, 0x5d59, 0x5d42, 0x5d39, 0x5d49, 0x5d38, 0x5d3c, 0x5d32, 0x5d36, 0x5d40, 0x5d45, 0x5e44, 0x5e41, 0x5f58, 0x5fa6, 0x5fa5, 0x5fab, 0x60c9, 0x60b9, 0x60cc, 0x60e2, 0x60ce, 0x60c4, 0x6114, /* 0xd9 */ 0x60f2, 0x610a, 0x6116, 0x6105, 0x60f5, 0x6113, 0x60f8, 0x60fc, 0x60fe, 0x60c1, 0x6103, 0x6118, 0x611d, 0x6110, 0x60ff, 0x6104, 0x610b, 0x624a, 0x6394, 0x63b1, 0x63b0, 0x63ce, 0x63e5, 0x63e8, 0x63ef, 0x63c3, 0x649d, 0x63f3, 0x63ca, 0x63e0, 0x63f6, 0x63d5, 0x63f2, 0x63f5, 0x6461, 0x63df, 0x63be, 0x63dd, 0x63dc, 0x63c4, 0x63d8, 0x63d3, 0x63c2, 0x63c7, 0x63cc, 0x63cb, 0x63c8, 0x63f0, 0x63d7, 0x63d9, 0x6532, 0x6567, 0x656a, 0x6564, 0x655c, 0x6568, 0x6565, 0x658c, 0x659d, 0x659e, 0x65ae, 0x65d0, 0x65d2, 0x667c, 0x666c, 0x667b, 0x6680, 0x6671, 0x6679, 0x666a, 0x6672, 0x6701, 0x690c, 0x68d3, 0x6904, 0x68dc, 0x692a, 0x68ec, 0x68ea, 0x68f1, 0x690f, 0x68d6, 0x68f7, 0x68eb, 0x68e4, 0x68f6, 0x6913, 0x6910, 0x68f3, 0x68e1, 0x6907, 0x68cc, 0x6908, 0x6970, 0x68b4, 0x6911, 0x68ef, 0x68c6, 0x6914, 0x68f8, 0x68d0, 0x68fd, 0x68fc, 0x68e8, 0x690b, 0x690a, 0x6917, 0x68ce, 0x68c8, 0x68dd, 0x68de, 0x68e6, 0x68f4, 0x68d1, 0x6906, 0x68d4, 0x68e9, 0x6915, 0x6925, 0x68c7, 0x6b39, 0x6b3b, 0x6b3f, 0x6b3c, 0x6b94, 0x6b97, 0x6b99, 0x6b95, 0x6bbd, 0x6bf0, 0x6bf2, 0x6bf3, 0x6c30, 0x6dfc, 0x6e46, 0x6e47, 0x6e1f, 0x6e49, 0x6e88, 0x6e3c, 0x6e3d, 0x6e45, 0x6e62, 0x6e2b, 0x6e3f, 0x6e41, 0x6e5d, 0x6e73, 0x6e1c, 0x6e33, 0x6e4b, 0x6e40, 0x6e51, 0x6e3b, 0x6e03, 0x6e2e, 0x6e5e, /* 0xda */ 0x6e68, 0x6e5c, 0x6e61, 0x6e31, 0x6e28, 0x6e60, 0x6e71, 0x6e6b, 0x6e39, 0x6e22, 0x6e30, 0x6e53, 0x6e65, 0x6e27, 0x6e78, 0x6e64, 0x6e77, 0x6e55, 0x6e79, 0x6e52, 0x6e66, 0x6e35, 0x6e36, 0x6e5a, 0x7120, 0x711e, 0x712f, 0x70fb, 0x712e, 0x7131, 0x7123, 0x7125, 0x7122, 0x7132, 0x711f, 0x7128, 0x713a, 0x711b, 0x724b, 0x725a, 0x7288, 0x7289, 0x7286, 0x7285, 0x728b, 0x7312, 0x730b, 0x7330, 0x7322, 0x7331, 0x7333, 0x7327, 0x7332, 0x732d, 0x7326, 0x7323, 0x7335, 0x730c, 0x742e, 0x742c, 0x7430, 0x742b, 0x7416, 0x741a, 0x7421, 0x742d, 0x7431, 0x7424, 0x7423, 0x741d, 0x7429, 0x7420, 0x7432, 0x74fb, 0x752f, 0x756f, 0x756c, 0x75e7, 0x75da, 0x75e1, 0x75e6, 0x75dd, 0x75df, 0x75e4, 0x75d7, 0x7695, 0x7692, 0x76da, 0x7746, 0x7747, 0x7744, 0x774d, 0x7745, 0x774a, 0x774e, 0x774b, 0x774c, 0x77de, 0x77ec, 0x7860, 0x7864, 0x7865, 0x785c, 0x786d, 0x7871, 0x786a, 0x786e, 0x7870, 0x7869, 0x7868, 0x785e, 0x7862, 0x7974, 0x7973, 0x7972, 0x7970, 0x7a02, 0x7a0a, 0x7a03, 0x7a0c, 0x7a04, 0x7a99, 0x7ae6, 0x7ae4, 0x7b4a, 0x7b3b, 0x7b44, 0x7b48, 0x7b4c, 0x7b4e, 0x7b40, 0x7b58, 0x7b45, 0x7ca2, 0x7c9e, 0x7ca8, 0x7ca1, 0x7d58, 0x7d6f, 0x7d63, 0x7d53, 0x7d56, 0x7d67, 0x7d6a, 0x7d4f, 0x7d6d, 0x7d5c, 0x7d6b, 0x7d52, 0x7d54, 0x7d69, 0x7d51, 0x7d5f, 0x7d4e, 0x7f3e, 0x7f3f, 0x7f65, /* 0xdb */ 0x7f66, 0x7fa2, 0x7fa0, 0x7fa1, 0x7fd7, 0x8051, 0x804f, 0x8050, 0x80fe, 0x80d4, 0x8143, 0x814a, 0x8152, 0x814f, 0x8147, 0x813d, 0x814d, 0x813a, 0x81e6, 0x81ee, 0x81f7, 0x81f8, 0x81f9, 0x8204, 0x823c, 0x823d, 0x823f, 0x8275, 0x833b, 0x83cf, 0x83f9, 0x8423, 0x83c0, 0x83e8, 0x8412, 0x83e7, 0x83e4, 0x83fc, 0x83f6, 0x8410, 0x83c6, 0x83c8, 0x83eb, 0x83e3, 0x83bf, 0x8401, 0x83dd, 0x83e5, 0x83d8, 0x83ff, 0x83e1, 0x83cb, 0x83ce, 0x83d6, 0x83f5, 0x83c9, 0x8409, 0x840f, 0x83de, 0x8411, 0x8406, 0x83c2, 0x83f3, 0x83d5, 0x83fa, 0x83c7, 0x83d1, 0x83ea, 0x8413, 0x83c3, 0x83ec, 0x83ee, 0x83c4, 0x83fb, 0x83d7, 0x83e2, 0x841b, 0x83db, 0x83fe, 0x86d8, 0x86e2, 0x86e6, 0x86d3, 0x86e3, 0x86da, 0x86ea, 0x86dd, 0x86eb, 0x86dc, 0x86ec, 0x86e9, 0x86d7, 0x86e8, 0x86d1, 0x8848, 0x8856, 0x8855, 0x88ba, 0x88d7, 0x88b9, 0x88b8, 0x88c0, 0x88be, 0x88b6, 0x88bc, 0x88b7, 0x88bd, 0x88b2, 0x8901, 0x88c9, 0x8995, 0x8998, 0x8997, 0x89dd, 0x89da, 0x89db, 0x8a4e, 0x8a4d, 0x8a39, 0x8a59, 0x8a40, 0x8a57, 0x8a58, 0x8a44, 0x8a45, 0x8a52, 0x8a48, 0x8a51, 0x8a4a, 0x8a4c, 0x8a4f, 0x8c5f, 0x8c81, 0x8c80, 0x8cba, 0x8cbe, 0x8cb0, 0x8cb9, 0x8cb5, 0x8d84, 0x8d80, 0x8d89, 0x8dd8, 0x8dd3, 0x8dcd, 0x8dc7, 0x8dd6, 0x8ddc, 0x8dcf, 0x8dd5, 0x8dd9, 0x8dc8, 0x8dd7, 0x8dc5, 0x8eef, 0x8ef7, 0x8efa, /* 0xdc */ 0x8ef9, 0x8ee6, 0x8eee, 0x8ee5, 0x8ef5, 0x8ee7, 0x8ee8, 0x8ef6, 0x8eeb, 0x8ef1, 0x8eec, 0x8ef4, 0x8ee9, 0x902d, 0x9034, 0x902f, 0x9106, 0x912c, 0x9104, 0x90ff, 0x90fc, 0x9108, 0x90f9, 0x90fb, 0x9101, 0x9100, 0x9107, 0x9105, 0x9103, 0x9161, 0x9164, 0x915f, 0x9162, 0x9160, 0x9201, 0x920a, 0x9225, 0x9203, 0x921a, 0x9226, 0x920f, 0x920c, 0x9200, 0x9212, 0x91ff, 0x91fd, 0x9206, 0x9204, 0x9227, 0x9202, 0x921c, 0x9224, 0x9219, 0x9217, 0x9205, 0x9216, 0x957b, 0x958d, 0x958c, 0x9590, 0x9687, 0x967e, 0x9688, 0x9689, 0x9683, 0x9680, 0x96c2, 0x96c8, 0x96c3, 0x96f1, 0x96f0, 0x976c, 0x9770, 0x976e, 0x9807, 0x98a9, 0x98eb, 0x9ce6, 0x9ef9, 0x4e83, 0x4e84, 0x4eb6, 0x50bd, 0x50bf, 0x50c6, 0x50ae, 0x50c4, 0x50ca, 0x50b4, 0x50c8, 0x50c2, 0x50b0, 0x50c1, 0x50ba, 0x50b1, 0x50cb, 0x50c9, 0x50b6, 0x50b8, 0x51d7, 0x527a, 0x5278, 0x527b, 0x527c, 0x55c3, 0x55db, 0x55cc, 0x55d0, 0x55cb, 0x55ca, 0x55dd, 0x55c0, 0x55d4, 0x55c4, 0x55e9, 0x55bf, 0x55d2, 0x558d, 0x55cf, 0x55d5, 0x55e2, 0x55d6, 0x55c8, 0x55f2, 0x55cd, 0x55d9, 0x55c2, 0x5714, 0x5853, 0x5868, 0x5864, 0x584f, 0x584d, 0x5849, 0x586f, 0x5855, 0x584e, 0x585d, 0x5859, 0x5865, 0x585b, 0x583d, 0x5863, 0x5871, 0x58fc, 0x5ac7, 0x5ac4, 0x5acb, 0x5aba, 0x5ab8, 0x5ab1, 0x5ab5, 0x5ab0, 0x5abf, 0x5ac8, 0x5abb, 0x5ac6, /* 0xdd */ 0x5ab7, 0x5ac0, 0x5aca, 0x5ab4, 0x5ab6, 0x5acd, 0x5ab9, 0x5a90, 0x5bd6, 0x5bd8, 0x5bd9, 0x5c1f, 0x5c33, 0x5d71, 0x5d63, 0x5d4a, 0x5d65, 0x5d72, 0x5d6c, 0x5d5e, 0x5d68, 0x5d67, 0x5d62, 0x5df0, 0x5e4f, 0x5e4e, 0x5e4a, 0x5e4d, 0x5e4b, 0x5ec5, 0x5ecc, 0x5ec6, 0x5ecb, 0x5ec7, 0x5f40, 0x5faf, 0x5fad, 0x60f7, 0x6149, 0x614a, 0x612b, 0x6145, 0x6136, 0x6132, 0x612e, 0x6146, 0x612f, 0x614f, 0x6129, 0x6140, 0x6220, 0x9168, 0x6223, 0x6225, 0x6224, 0x63c5, 0x63f1, 0x63eb, 0x6410, 0x6412, 0x6409, 0x6420, 0x6424, 0x6433, 0x6443, 0x641f, 0x6415, 0x6418, 0x6439, 0x6437, 0x6422, 0x6423, 0x640c, 0x6426, 0x6430, 0x6428, 0x6441, 0x6435, 0x642f, 0x640a, 0x641a, 0x6440, 0x6425, 0x6427, 0x640b, 0x63e7, 0x641b, 0x642e, 0x6421, 0x640e, 0x656f, 0x6592, 0x65d3, 0x6686, 0x668c, 0x6695, 0x6690, 0x668b, 0x668a, 0x6699, 0x6694, 0x6678, 0x6720, 0x6966, 0x695f, 0x6938, 0x694e, 0x6962, 0x6971, 0x693f, 0x6945, 0x696a, 0x6939, 0x6942, 0x6957, 0x6959, 0x697a, 0x6948, 0x6949, 0x6935, 0x696c, 0x6933, 0x693d, 0x6965, 0x68f0, 0x6978, 0x6934, 0x6969, 0x6940, 0x696f, 0x6944, 0x6976, 0x6958, 0x6941, 0x6974, 0x694c, 0x693b, 0x694b, 0x6937, 0x695c, 0x694f, 0x6951, 0x6932, 0x6952, 0x692f, 0x697b, 0x693c, 0x6b46, 0x6b45, 0x6b43, 0x6b42, 0x6b48, 0x6b41, 0x6b9b, 0xfa0d, 0x6bfb, 0x6bfc, /* 0xde */ 0x6bf9, 0x6bf7, 0x6bf8, 0x6e9b, 0x6ed6, 0x6ec8, 0x6e8f, 0x6ec0, 0x6e9f, 0x6e93, 0x6e94, 0x6ea0, 0x6eb1, 0x6eb9, 0x6ec6, 0x6ed2, 0x6ebd, 0x6ec1, 0x6e9e, 0x6ec9, 0x6eb7, 0x6eb0, 0x6ecd, 0x6ea6, 0x6ecf, 0x6eb2, 0x6ebe, 0x6ec3, 0x6edc, 0x6ed8, 0x6e99, 0x6e92, 0x6e8e, 0x6e8d, 0x6ea4, 0x6ea1, 0x6ebf, 0x6eb3, 0x6ed0, 0x6eca, 0x6e97, 0x6eae, 0x6ea3, 0x7147, 0x7154, 0x7152, 0x7163, 0x7160, 0x7141, 0x715d, 0x7162, 0x7172, 0x7178, 0x716a, 0x7161, 0x7142, 0x7158, 0x7143, 0x714b, 0x7170, 0x715f, 0x7150, 0x7153, 0x7144, 0x714d, 0x715a, 0x724f, 0x728d, 0x728c, 0x7291, 0x7290, 0x728e, 0x733c, 0x7342, 0x733b, 0x733a, 0x7340, 0x734a, 0x7349, 0x7444, 0x744a, 0x744b, 0x7452, 0x7451, 0x7457, 0x7440, 0x744f, 0x7450, 0x744e, 0x7442, 0x7446, 0x744d, 0x7454, 0x74e1, 0x74ff, 0x74fe, 0x74fd, 0x751d, 0x7579, 0x7577, 0x6983, 0x75ef, 0x760f, 0x7603, 0x75f7, 0x75fe, 0x75fc, 0x75f9, 0x75f8, 0x7610, 0x75fb, 0x75f6, 0x75ed, 0x75f5, 0x75fd, 0x7699, 0x76b5, 0x76dd, 0x7755, 0x775f, 0x7760, 0x7752, 0x7756, 0x775a, 0x7769, 0x7767, 0x7754, 0x7759, 0x776d, 0x77e0, 0x7887, 0x789a, 0x7894, 0x788f, 0x7884, 0x7895, 0x7885, 0x7886, 0x78a1, 0x7883, 0x7879, 0x7899, 0x7880, 0x7896, 0x787b, 0x797c, 0x7982, 0x797d, 0x7979, 0x7a11, 0x7a18, 0x7a19, 0x7a12, 0x7a17, 0x7a15, 0x7a22, 0x7a13, /* 0xdf */ 0x7a1b, 0x7a10, 0x7aa3, 0x7aa2, 0x7a9e, 0x7aeb, 0x7b66, 0x7b64, 0x7b6d, 0x7b74, 0x7b69, 0x7b72, 0x7b65, 0x7b73, 0x7b71, 0x7b70, 0x7b61, 0x7b78, 0x7b76, 0x7b63, 0x7cb2, 0x7cb4, 0x7caf, 0x7d88, 0x7d86, 0x7d80, 0x7d8d, 0x7d7f, 0x7d85, 0x7d7a, 0x7d8e, 0x7d7b, 0x7d83, 0x7d7c, 0x7d8c, 0x7d94, 0x7d84, 0x7d7d, 0x7d92, 0x7f6d, 0x7f6b, 0x7f67, 0x7f68, 0x7f6c, 0x7fa6, 0x7fa5, 0x7fa7, 0x7fdb, 0x7fdc, 0x8021, 0x8164, 0x8160, 0x8177, 0x815c, 0x8169, 0x815b, 0x8162, 0x8172, 0x6721, 0x815e, 0x8176, 0x8167, 0x816f, 0x8144, 0x8161, 0x821d, 0x8249, 0x8244, 0x8240, 0x8242, 0x8245, 0x84f1, 0x843f, 0x8456, 0x8476, 0x8479, 0x848f, 0x848d, 0x8465, 0x8451, 0x8440, 0x8486, 0x8467, 0x8430, 0x844d, 0x847d, 0x845a, 0x8459, 0x8474, 0x8473, 0x845d, 0x8507, 0x845e, 0x8437, 0x843a, 0x8434, 0x847a, 0x8443, 0x8478, 0x8432, 0x8445, 0x8429, 0x83d9, 0x844b, 0x842f, 0x8442, 0x842d, 0x845f, 0x8470, 0x8439, 0x844e, 0x844c, 0x8452, 0x846f, 0x84c5, 0x848e, 0x843b, 0x8447, 0x8436, 0x8433, 0x8468, 0x847e, 0x8444, 0x842b, 0x8460, 0x8454, 0x846e, 0x8450, 0x870b, 0x8704, 0x86f7, 0x870c, 0x86fa, 0x86d6, 0x86f5, 0x874d, 0x86f8, 0x870e, 0x8709, 0x8701, 0x86f6, 0x870d, 0x8705, 0x88d6, 0x88cb, 0x88cd, 0x88ce, 0x88de, 0x88db, 0x88da, 0x88cc, 0x88d0, 0x8985, 0x899b, 0x89df, 0x89e5, 0x89e4, /* 0xe0 */ 0x89e1, 0x89e0, 0x89e2, 0x89dc, 0x89e6, 0x8a76, 0x8a86, 0x8a7f, 0x8a61, 0x8a3f, 0x8a77, 0x8a82, 0x8a84, 0x8a75, 0x8a83, 0x8a81, 0x8a74, 0x8a7a, 0x8c3c, 0x8c4b, 0x8c4a, 0x8c65, 0x8c64, 0x8c66, 0x8c86, 0x8c84, 0x8c85, 0x8ccc, 0x8d68, 0x8d69, 0x8d91, 0x8d8c, 0x8d8e, 0x8d8f, 0x8d8d, 0x8d93, 0x8d94, 0x8d90, 0x8d92, 0x8df0, 0x8de0, 0x8dec, 0x8df1, 0x8dee, 0x8dd0, 0x8de9, 0x8de3, 0x8de2, 0x8de7, 0x8df2, 0x8deb, 0x8df4, 0x8f06, 0x8eff, 0x8f01, 0x8f00, 0x8f05, 0x8f07, 0x8f08, 0x8f02, 0x8f0b, 0x9052, 0x903f, 0x9044, 0x9049, 0x903d, 0x9110, 0x910d, 0x910f, 0x9111, 0x9116, 0x9114, 0x910b, 0x910e, 0x916e, 0x916f, 0x9248, 0x9252, 0x9230, 0x923a, 0x9266, 0x9233, 0x9265, 0x925e, 0x9283, 0x922e, 0x924a, 0x9246, 0x926d, 0x926c, 0x924f, 0x9260, 0x9267, 0x926f, 0x9236, 0x9261, 0x9270, 0x9231, 0x9254, 0x9263, 0x9250, 0x9272, 0x924e, 0x9253, 0x924c, 0x9256, 0x9232, 0x959f, 0x959c, 0x959e, 0x959b, 0x9692, 0x9693, 0x9691, 0x9697, 0x96ce, 0x96fa, 0x96fd, 0x96f8, 0x96f5, 0x9773, 0x9777, 0x9778, 0x9772, 0x980f, 0x980d, 0x980e, 0x98ac, 0x98f6, 0x98f9, 0x99af, 0x99b2, 0x99b0, 0x99b5, 0x9aad, 0x9aab, 0x9b5b, 0x9cea, 0x9ced, 0x9ce7, 0x9e80, 0x9efd, 0x50e6, 0x50d4, 0x50d7, 0x50e8, 0x50f3, 0x50db, 0x50ea, 0x50dd, 0x50e4, 0x50d3, 0x50ec, 0x50f0, 0x50ef, 0x50e3, 0x50e0, /* 0xe1 */ 0x51d8, 0x5280, 0x5281, 0x52e9, 0x52eb, 0x5330, 0x53ac, 0x5627, 0x5615, 0x560c, 0x5612, 0x55fc, 0x560f, 0x561c, 0x5601, 0x5613, 0x5602, 0x55fa, 0x561d, 0x5604, 0x55ff, 0x55f9, 0x5889, 0x587c, 0x5890, 0x5898, 0x5886, 0x5881, 0x587f, 0x5874, 0x588b, 0x587a, 0x5887, 0x5891, 0x588e, 0x5876, 0x5882, 0x5888, 0x587b, 0x5894, 0x588f, 0x58fe, 0x596b, 0x5adc, 0x5aee, 0x5ae5, 0x5ad5, 0x5aea, 0x5ada, 0x5aed, 0x5aeb, 0x5af3, 0x5ae2, 0x5ae0, 0x5adb, 0x5aec, 0x5ade, 0x5add, 0x5ad9, 0x5ae8, 0x5adf, 0x5b77, 0x5be0, 0x5be3, 0x5c63, 0x5d82, 0x5d80, 0x5d7d, 0x5d86, 0x5d7a, 0x5d81, 0x5d77, 0x5d8a, 0x5d89, 0x5d88, 0x5d7e, 0x5d7c, 0x5d8d, 0x5d79, 0x5d7f, 0x5e58, 0x5e59, 0x5e53, 0x5ed8, 0x5ed1, 0x5ed7, 0x5ece, 0x5edc, 0x5ed5, 0x5ed9, 0x5ed2, 0x5ed4, 0x5f44, 0x5f43, 0x5f6f, 0x5fb6, 0x612c, 0x6128, 0x6141, 0x615e, 0x6171, 0x6173, 0x6152, 0x6153, 0x6172, 0x616c, 0x6180, 0x6174, 0x6154, 0x617a, 0x615b, 0x6165, 0x613b, 0x616a, 0x6161, 0x6156, 0x6229, 0x6227, 0x622b, 0x642b, 0x644d, 0x645b, 0x645d, 0x6474, 0x6476, 0x6472, 0x6473, 0x647d, 0x6475, 0x6466, 0x64a6, 0x644e, 0x6482, 0x645e, 0x645c, 0x644b, 0x6453, 0x6460, 0x6450, 0x647f, 0x643f, 0x646c, 0x646b, 0x6459, 0x6465, 0x6477, 0x6573, 0x65a0, 0x66a1, 0x66a0, 0x669f, 0x6705, 0x6704, 0x6722, 0x69b1, 0x69b6, 0x69c9, /* 0xe2 */ 0x69a0, 0x69ce, 0x6996, 0x69b0, 0x69ac, 0x69bc, 0x6991, 0x6999, 0x698e, 0x69a7, 0x698d, 0x69a9, 0x69be, 0x69af, 0x69bf, 0x69c4, 0x69bd, 0x69a4, 0x69d4, 0x69b9, 0x69ca, 0x699a, 0x69cf, 0x69b3, 0x6993, 0x69aa, 0x69a1, 0x699e, 0x69d9, 0x6997, 0x6990, 0x69c2, 0x69b5, 0x69a5, 0x69c6, 0x6b4a, 0x6b4d, 0x6b4b, 0x6b9e, 0x6b9f, 0x6ba0, 0x6bc3, 0x6bc4, 0x6bfe, 0x6ece, 0x6ef5, 0x6ef1, 0x6f03, 0x6f25, 0x6ef8, 0x6f37, 0x6efb, 0x6f2e, 0x6f09, 0x6f4e, 0x6f19, 0x6f1a, 0x6f27, 0x6f18, 0x6f3b, 0x6f12, 0x6eed, 0x6f0a, 0x6f36, 0x6f73, 0x6ef9, 0x6eee, 0x6f2d, 0x6f40, 0x6f30, 0x6f3c, 0x6f35, 0x6eeb, 0x6f07, 0x6f0e, 0x6f43, 0x6f05, 0x6efd, 0x6ef6, 0x6f39, 0x6f1c, 0x6efc, 0x6f3a, 0x6f1f, 0x6f0d, 0x6f1e, 0x6f08, 0x6f21, 0x7187, 0x7190, 0x7189, 0x7180, 0x7185, 0x7182, 0x718f, 0x717b, 0x7186, 0x7181, 0x7197, 0x7244, 0x7253, 0x7297, 0x7295, 0x7293, 0x7343, 0x734d, 0x7351, 0x734c, 0x7462, 0x7473, 0x7471, 0x7475, 0x7472, 0x7467, 0x746e, 0x7500, 0x7502, 0x7503, 0x757d, 0x7590, 0x7616, 0x7608, 0x760c, 0x7615, 0x7611, 0x760a, 0x7614, 0x76b8, 0x7781, 0x777c, 0x7785, 0x7782, 0x776e, 0x7780, 0x776f, 0x777e, 0x7783, 0x78b2, 0x78aa, 0x78b4, 0x78ad, 0x78a8, 0x787e, 0x78ab, 0x789e, 0x78a5, 0x78a0, 0x78ac, 0x78a2, 0x78a4, 0x7998, 0x798a, 0x798b, 0x7996, 0x7995, 0x7994, 0x7993, /* 0xe3 */ 0x7997, 0x7988, 0x7992, 0x7990, 0x7a2b, 0x7a4a, 0x7a30, 0x7a2f, 0x7a28, 0x7a26, 0x7aa8, 0x7aab, 0x7aac, 0x7aee, 0x7b88, 0x7b9c, 0x7b8a, 0x7b91, 0x7b90, 0x7b96, 0x7b8d, 0x7b8c, 0x7b9b, 0x7b8e, 0x7b85, 0x7b98, 0x5284, 0x7b99, 0x7ba4, 0x7b82, 0x7cbb, 0x7cbf, 0x7cbc, 0x7cba, 0x7da7, 0x7db7, 0x7dc2, 0x7da3, 0x7daa, 0x7dc1, 0x7dc0, 0x7dc5, 0x7d9d, 0x7dce, 0x7dc4, 0x7dc6, 0x7dcb, 0x7dcc, 0x7daf, 0x7db9, 0x7d96, 0x7dbc, 0x7d9f, 0x7da6, 0x7dae, 0x7da9, 0x7da1, 0x7dc9, 0x7f73, 0x7fe2, 0x7fe3, 0x7fe5, 0x7fde, 0x8024, 0x805d, 0x805c, 0x8189, 0x8186, 0x8183, 0x8187, 0x818d, 0x818c, 0x818b, 0x8215, 0x8497, 0x84a4, 0x84a1, 0x849f, 0x84ba, 0x84ce, 0x84c2, 0x84ac, 0x84ae, 0x84ab, 0x84b9, 0x84b4, 0x84c1, 0x84cd, 0x84aa, 0x849a, 0x84b1, 0x84d0, 0x849d, 0x84a7, 0x84bb, 0x84a2, 0x8494, 0x84c7, 0x84cc, 0x849b, 0x84a9, 0x84af, 0x84a8, 0x84d6, 0x8498, 0x84b6, 0x84cf, 0x84a0, 0x84d7, 0x84d4, 0x84d2, 0x84db, 0x84b0, 0x8491, 0x8661, 0x8733, 0x8723, 0x8728, 0x876b, 0x8740, 0x872e, 0x871e, 0x8721, 0x8719, 0x871b, 0x8743, 0x872c, 0x8741, 0x873e, 0x8746, 0x8720, 0x8732, 0x872a, 0x872d, 0x873c, 0x8712, 0x873a, 0x8731, 0x8735, 0x8742, 0x8726, 0x8727, 0x8738, 0x8724, 0x871a, 0x8730, 0x8711, 0x88f7, 0x88e7, 0x88f1, 0x88f2, 0x88fa, 0x88fe, 0x88ee, 0x88fc, 0x88f6, 0x88fb, /* 0xe4 */ 0x88f0, 0x88ec, 0x88eb, 0x899d, 0x89a1, 0x899f, 0x899e, 0x89e9, 0x89eb, 0x89e8, 0x8aab, 0x8a99, 0x8a8b, 0x8a92, 0x8a8f, 0x8a96, 0x8c3d, 0x8c68, 0x8c69, 0x8cd5, 0x8ccf, 0x8cd7, 0x8d96, 0x8e09, 0x8e02, 0x8dff, 0x8e0d, 0x8dfd, 0x8e0a, 0x8e03, 0x8e07, 0x8e06, 0x8e05, 0x8dfe, 0x8e00, 0x8e04, 0x8f10, 0x8f11, 0x8f0e, 0x8f0d, 0x9123, 0x911c, 0x9120, 0x9122, 0x911f, 0x911d, 0x911a, 0x9124, 0x9121, 0x911b, 0x917a, 0x9172, 0x9179, 0x9173, 0x92a5, 0x92a4, 0x9276, 0x929b, 0x927a, 0x92a0, 0x9294, 0x92aa, 0x928d, 0x92a6, 0x929a, 0x92ab, 0x9279, 0x9297, 0x927f, 0x92a3, 0x92ee, 0x928e, 0x9282, 0x9295, 0x92a2, 0x927d, 0x9288, 0x92a1, 0x928a, 0x9286, 0x928c, 0x9299, 0x92a7, 0x927e, 0x9287, 0x92a9, 0x929d, 0x928b, 0x922d, 0x969e, 0x96a1, 0x96ff, 0x9758, 0x977d, 0x977a, 0x977e, 0x9783, 0x9780, 0x9782, 0x977b, 0x9784, 0x9781, 0x977f, 0x97ce, 0x97cd, 0x9816, 0x98ad, 0x98ae, 0x9902, 0x9900, 0x9907, 0x999d, 0x999c, 0x99c3, 0x99b9, 0x99bb, 0x99ba, 0x99c2, 0x99bd, 0x99c7, 0x9ab1, 0x9ae3, 0x9ae7, 0x9b3e, 0x9b3f, 0x9b60, 0x9b61, 0x9b5f, 0x9cf1, 0x9cf2, 0x9cf5, 0x9ea7, 0x50ff, 0x5103, 0x5130, 0x50f8, 0x5106, 0x5107, 0x50f6, 0x50fe, 0x510b, 0x510c, 0x50fd, 0x510a, 0x528b, 0x528c, 0x52f1, 0x52ef, 0x5648, 0x5642, 0x564c, 0x5635, 0x5641, 0x564a, 0x5649, 0x5646, 0x5658, /* 0xe5 */ 0x565a, 0x5640, 0x5633, 0x563d, 0x562c, 0x563e, 0x5638, 0x562a, 0x563a, 0x571a, 0x58ab, 0x589d, 0x58b1, 0x58a0, 0x58a3, 0x58af, 0x58ac, 0x58a5, 0x58a1, 0x58ff, 0x5aff, 0x5af4, 0x5afd, 0x5af7, 0x5af6, 0x5b03, 0x5af8, 0x5b02, 0x5af9, 0x5b01, 0x5b07, 0x5b05, 0x5b0f, 0x5c67, 0x5d99, 0x5d97, 0x5d9f, 0x5d92, 0x5da2, 0x5d93, 0x5d95, 0x5da0, 0x5d9c, 0x5da1, 0x5d9a, 0x5d9e, 0x5e69, 0x5e5d, 0x5e60, 0x5e5c, 0x7df3, 0x5edb, 0x5ede, 0x5ee1, 0x5f49, 0x5fb2, 0x618b, 0x6183, 0x6179, 0x61b1, 0x61b0, 0x61a2, 0x6189, 0x619b, 0x6193, 0x61af, 0x61ad, 0x619f, 0x6192, 0x61aa, 0x61a1, 0x618d, 0x6166, 0x61b3, 0x622d, 0x646e, 0x6470, 0x6496, 0x64a0, 0x6485, 0x6497, 0x649c, 0x648f, 0x648b, 0x648a, 0x648c, 0x64a3, 0x649f, 0x6468, 0x64b1, 0x6498, 0x6576, 0x657a, 0x6579, 0x657b, 0x65b2, 0x65b3, 0x66b5, 0x66b0, 0x66a9, 0x66b2, 0x66b7, 0x66aa, 0x66af, 0x6a00, 0x6a06, 0x6a17, 0x69e5, 0x69f8, 0x6a15, 0x69f1, 0x69e4, 0x6a20, 0x69ff, 0x69ec, 0x69e2, 0x6a1b, 0x6a1d, 0x69fe, 0x6a27, 0x69f2, 0x69ee, 0x6a14, 0x69f7, 0x69e7, 0x6a40, 0x6a08, 0x69e6, 0x69fb, 0x6a0d, 0x69fc, 0x69eb, 0x6a09, 0x6a04, 0x6a18, 0x6a25, 0x6a0f, 0x69f6, 0x6a26, 0x6a07, 0x69f4, 0x6a16, 0x6b51, 0x6ba5, 0x6ba3, 0x6ba2, 0x6ba6, 0x6c01, 0x6c00, 0x6bff, 0x6c02, 0x6f41, 0x6f26, 0x6f7e, 0x6f87, 0x6fc6, 0x6f92, /* 0xe6 */ 0x6f8d, 0x6f89, 0x6f8c, 0x6f62, 0x6f4f, 0x6f85, 0x6f5a, 0x6f96, 0x6f76, 0x6f6c, 0x6f82, 0x6f55, 0x6f72, 0x6f52, 0x6f50, 0x6f57, 0x6f94, 0x6f93, 0x6f5d, 0x6f00, 0x6f61, 0x6f6b, 0x6f7d, 0x6f67, 0x6f90, 0x6f53, 0x6f8b, 0x6f69, 0x6f7f, 0x6f95, 0x6f63, 0x6f77, 0x6f6a, 0x6f7b, 0x71b2, 0x71af, 0x719b, 0x71b0, 0x71a0, 0x719a, 0x71a9, 0x71b5, 0x719d, 0x71a5, 0x719e, 0x71a4, 0x71a1, 0x71aa, 0x719c, 0x71a7, 0x71b3, 0x7298, 0x729a, 0x7358, 0x7352, 0x735e, 0x735f, 0x7360, 0x735d, 0x735b, 0x7361, 0x735a, 0x7359, 0x7362, 0x7487, 0x7489, 0x748a, 0x7486, 0x7481, 0x747d, 0x7485, 0x7488, 0x747c, 0x7479, 0x7508, 0x7507, 0x757e, 0x7625, 0x761e, 0x7619, 0x761d, 0x761c, 0x7623, 0x761a, 0x7628, 0x761b, 0x769c, 0x769d, 0x769e, 0x769b, 0x778d, 0x778f, 0x7789, 0x7788, 0x78cd, 0x78bb, 0x78cf, 0x78cc, 0x78d1, 0x78ce, 0x78d4, 0x78c8, 0x78c3, 0x78c4, 0x78c9, 0x799a, 0x79a1, 0x79a0, 0x799c, 0x79a2, 0x799b, 0x6b76, 0x7a39, 0x7ab2, 0x7ab4, 0x7ab3, 0x7bb7, 0x7bcb, 0x7bbe, 0x7bac, 0x7bce, 0x7baf, 0x7bb9, 0x7bca, 0x7bb5, 0x7cc5, 0x7cc8, 0x7ccc, 0x7ccb, 0x7df7, 0x7ddb, 0x7dea, 0x7de7, 0x7dd7, 0x7de1, 0x7e03, 0x7dfa, 0x7de6, 0x7df6, 0x7df1, 0x7df0, 0x7dee, 0x7ddf, 0x7f76, 0x7fac, 0x7fb0, 0x7fad, 0x7fed, 0x7feb, 0x7fea, 0x7fec, 0x7fe6, 0x7fe8, 0x8064, 0x8067, 0x81a3, 0x819f, /* 0xe7 */ 0x819e, 0x8195, 0x81a2, 0x8199, 0x8197, 0x8216, 0x824f, 0x8253, 0x8252, 0x8250, 0x824e, 0x8251, 0x8524, 0x853b, 0x850f, 0x8500, 0x8529, 0x850e, 0x8509, 0x850d, 0x851f, 0x850a, 0x8527, 0x851c, 0x84fb, 0x852b, 0x84fa, 0x8508, 0x850c, 0x84f4, 0x852a, 0x84f2, 0x8515, 0x84f7, 0x84eb, 0x84f3, 0x84fc, 0x8512, 0x84ea, 0x84e9, 0x8516, 0x84fe, 0x8528, 0x851d, 0x852e, 0x8502, 0x84fd, 0x851e, 0x84f6, 0x8531, 0x8526, 0x84e7, 0x84e8, 0x84f0, 0x84ef, 0x84f9, 0x8518, 0x8520, 0x8530, 0x850b, 0x8519, 0x852f, 0x8662, 0x8756, 0x8763, 0x8764, 0x8777, 0x87e1, 0x8773, 0x8758, 0x8754, 0x875b, 0x8752, 0x8761, 0x875a, 0x8751, 0x875e, 0x876d, 0x876a, 0x8750, 0x874e, 0x875f, 0x875d, 0x876f, 0x876c, 0x877a, 0x876e, 0x875c, 0x8765, 0x874f, 0x877b, 0x8775, 0x8762, 0x8767, 0x8769, 0x885a, 0x8905, 0x890c, 0x8914, 0x890b, 0x8917, 0x8918, 0x8919, 0x8906, 0x8916, 0x8911, 0x890e, 0x8909, 0x89a2, 0x89a4, 0x89a3, 0x89ed, 0x89f0, 0x89ec, 0x8acf, 0x8ac6, 0x8ab8, 0x8ad3, 0x8ad1, 0x8ad4, 0x8ad5, 0x8abb, 0x8ad7, 0x8abe, 0x8ac0, 0x8ac5, 0x8ad8, 0x8ac3, 0x8aba, 0x8abd, 0x8ad9, 0x8c3e, 0x8c4d, 0x8c8f, 0x8ce5, 0x8cdf, 0x8cd9, 0x8ce8, 0x8cda, 0x8cdd, 0x8ce7, 0x8da0, 0x8d9c, 0x8da1, 0x8d9b, 0x8e20, 0x8e23, 0x8e25, 0x8e24, 0x8e2e, 0x8e15, 0x8e1b, 0x8e16, 0x8e11, 0x8e19, 0x8e26, 0x8e27, /* 0xe8 */ 0x8e14, 0x8e12, 0x8e18, 0x8e13, 0x8e1c, 0x8e17, 0x8e1a, 0x8f2c, 0x8f24, 0x8f18, 0x8f1a, 0x8f20, 0x8f23, 0x8f16, 0x8f17, 0x9073, 0x9070, 0x906f, 0x9067, 0x906b, 0x912f, 0x912b, 0x9129, 0x912a, 0x9132, 0x9126, 0x912e, 0x9185, 0x9186, 0x918a, 0x9181, 0x9182, 0x9184, 0x9180, 0x92d0, 0x92c3, 0x92c4, 0x92c0, 0x92d9, 0x92b6, 0x92cf, 0x92f1, 0x92df, 0x92d8, 0x92e9, 0x92d7, 0x92dd, 0x92cc, 0x92ef, 0x92c2, 0x92e8, 0x92ca, 0x92c8, 0x92ce, 0x92e6, 0x92cd, 0x92d5, 0x92c9, 0x92e0, 0x92de, 0x92e7, 0x92d1, 0x92d3, 0x92b5, 0x92e1, 0x92c6, 0x92b4, 0x957c, 0x95ac, 0x95ab, 0x95ae, 0x95b0, 0x96a4, 0x96a2, 0x96d3, 0x9705, 0x9708, 0x9702, 0x975a, 0x978a, 0x978e, 0x9788, 0x97d0, 0x97cf, 0x981e, 0x981d, 0x9826, 0x9829, 0x9828, 0x9820, 0x981b, 0x9827, 0x98b2, 0x9908, 0x98fa, 0x9911, 0x9914, 0x9916, 0x9917, 0x9915, 0x99dc, 0x99cd, 0x99cf, 0x99d3, 0x99d4, 0x99ce, 0x99c9, 0x99d6, 0x99d8, 0x99cb, 0x99d7, 0x99cc, 0x9ab3, 0x9aec, 0x9aeb, 0x9af3, 0x9af2, 0x9af1, 0x9b46, 0x9b43, 0x9b67, 0x9b74, 0x9b71, 0x9b66, 0x9b76, 0x9b75, 0x9b70, 0x9b68, 0x9b64, 0x9b6c, 0x9cfc, 0x9cfa, 0x9cfd, 0x9cff, 0x9cf7, 0x9d07, 0x9d00, 0x9cf9, 0x9cfb, 0x9d08, 0x9d05, 0x9d04, 0x9e83, 0x9ed3, 0x9f0f, 0x9f10, 0x511c, 0x5113, 0x5117, 0x511a, 0x5111, 0x51de, 0x5334, 0x53e1, 0x5670, 0x5660, 0x566e, /* 0xe9 */ 0x5673, 0x5666, 0x5663, 0x566d, 0x5672, 0x565e, 0x5677, 0x571c, 0x571b, 0x58c8, 0x58bd, 0x58c9, 0x58bf, 0x58ba, 0x58c2, 0x58bc, 0x58c6, 0x5b17, 0x5b19, 0x5b1b, 0x5b21, 0x5b14, 0x5b13, 0x5b10, 0x5b16, 0x5b28, 0x5b1a, 0x5b20, 0x5b1e, 0x5bef, 0x5dac, 0x5db1, 0x5da9, 0x5da7, 0x5db5, 0x5db0, 0x5dae, 0x5daa, 0x5da8, 0x5db2, 0x5dad, 0x5daf, 0x5db4, 0x5e67, 0x5e68, 0x5e66, 0x5e6f, 0x5ee9, 0x5ee7, 0x5ee6, 0x5ee8, 0x5ee5, 0x5f4b, 0x5fbc, 0x619d, 0x61a8, 0x6196, 0x61c5, 0x61b4, 0x61c6, 0x61c1, 0x61cc, 0x61ba, 0x61bf, 0x61b8, 0x618c, 0x64d7, 0x64d6, 0x64d0, 0x64cf, 0x64c9, 0x64bd, 0x6489, 0x64c3, 0x64db, 0x64f3, 0x64d9, 0x6533, 0x657f, 0x657c, 0x65a2, 0x66c8, 0x66be, 0x66c0, 0x66ca, 0x66cb, 0x66cf, 0x66bd, 0x66bb, 0x66ba, 0x66cc, 0x6723, 0x6a34, 0x6a66, 0x6a49, 0x6a67, 0x6a32, 0x6a68, 0x6a3e, 0x6a5d, 0x6a6d, 0x6a76, 0x6a5b, 0x6a51, 0x6a28, 0x6a5a, 0x6a3b, 0x6a3f, 0x6a41, 0x6a6a, 0x6a64, 0x6a50, 0x6a4f, 0x6a54, 0x6a6f, 0x6a69, 0x6a60, 0x6a3c, 0x6a5e, 0x6a56, 0x6a55, 0x6a4d, 0x6a4e, 0x6a46, 0x6b55, 0x6b54, 0x6b56, 0x6ba7, 0x6baa, 0x6bab, 0x6bc8, 0x6bc7, 0x6c04, 0x6c03, 0x6c06, 0x6fad, 0x6fcb, 0x6fa3, 0x6fc7, 0x6fbc, 0x6fce, 0x6fc8, 0x6f5e, 0x6fc4, 0x6fbd, 0x6f9e, 0x6fca, 0x6fa8, 0x7004, 0x6fa5, 0x6fae, 0x6fba, 0x6fac, 0x6faa, 0x6fcf, 0x6fbf, 0x6fb8, /* 0xea */ 0x6fa2, 0x6fc9, 0x6fab, 0x6fcd, 0x6faf, 0x6fb2, 0x6fb0, 0x71c5, 0x71c2, 0x71bf, 0x71b8, 0x71d6, 0x71c0, 0x71c1, 0x71cb, 0x71d4, 0x71ca, 0x71c7, 0x71cf, 0x71bd, 0x71d8, 0x71bc, 0x71c6, 0x71da, 0x71db, 0x729d, 0x729e, 0x7369, 0x7366, 0x7367, 0x736c, 0x7365, 0x736b, 0x736a, 0x747f, 0x749a, 0x74a0, 0x7494, 0x7492, 0x7495, 0x74a1, 0x750b, 0x7580, 0x762f, 0x762d, 0x7631, 0x763d, 0x7633, 0x763c, 0x7635, 0x7632, 0x7630, 0x76bb, 0x76e6, 0x779a, 0x779d, 0x77a1, 0x779c, 0x779b, 0x77a2, 0x77a3, 0x7795, 0x7799, 0x7797, 0x78dd, 0x78e9, 0x78e5, 0x78ea, 0x78de, 0x78e3, 0x78db, 0x78e1, 0x78e2, 0x78ed, 0x78df, 0x78e0, 0x79a4, 0x7a44, 0x7a48, 0x7a47, 0x7ab6, 0x7ab8, 0x7ab5, 0x7ab1, 0x7ab7, 0x7bde, 0x7be3, 0x7be7, 0x7bdd, 0x7bd5, 0x7be5, 0x7bda, 0x7be8, 0x7bf9, 0x7bd4, 0x7bea, 0x7be2, 0x7bdc, 0x7beb, 0x7bd8, 0x7bdf, 0x7cd2, 0x7cd4, 0x7cd7, 0x7cd0, 0x7cd1, 0x7e12, 0x7e21, 0x7e17, 0x7e0c, 0x7e1f, 0x7e20, 0x7e13, 0x7e0e, 0x7e1c, 0x7e15, 0x7e1a, 0x7e22, 0x7e0b, 0x7e0f, 0x7e16, 0x7e0d, 0x7e14, 0x7e25, 0x7e24, 0x7f43, 0x7f7b, 0x7f7c, 0x7f7a, 0x7fb1, 0x7fef, 0x802a, 0x8029, 0x806c, 0x81b1, 0x81a6, 0x81ae, 0x81b9, 0x81b5, 0x81ab, 0x81b0, 0x81ac, 0x81b4, 0x81b2, 0x81b7, 0x81a7, 0x81f2, 0x8255, 0x8256, 0x8257, 0x8556, 0x8545, 0x856b, 0x854d, 0x8553, 0x8561, 0x8558, /* 0xeb */ 0x8540, 0x8546, 0x8564, 0x8541, 0x8562, 0x8544, 0x8551, 0x8547, 0x8563, 0x853e, 0x855b, 0x8571, 0x854e, 0x856e, 0x8575, 0x8555, 0x8567, 0x8560, 0x858c, 0x8566, 0x855d, 0x8554, 0x8565, 0x856c, 0x8663, 0x8665, 0x8664, 0x879b, 0x878f, 0x8797, 0x8793, 0x8792, 0x8788, 0x8781, 0x8796, 0x8798, 0x8779, 0x8787, 0x87a3, 0x8785, 0x8790, 0x8791, 0x879d, 0x8784, 0x8794, 0x879c, 0x879a, 0x8789, 0x891e, 0x8926, 0x8930, 0x892d, 0x892e, 0x8927, 0x8931, 0x8922, 0x8929, 0x8923, 0x892f, 0x892c, 0x891f, 0x89f1, 0x8ae0, 0x8ae2, 0x8af2, 0x8af4, 0x8af5, 0x8add, 0x8b14, 0x8ae4, 0x8adf, 0x8af0, 0x8ac8, 0x8ade, 0x8ae1, 0x8ae8, 0x8aff, 0x8aef, 0x8afb, 0x8c91, 0x8c92, 0x8c90, 0x8cf5, 0x8cee, 0x8cf1, 0x8cf0, 0x8cf3, 0x8d6c, 0x8d6e, 0x8da5, 0x8da7, 0x8e33, 0x8e3e, 0x8e38, 0x8e40, 0x8e45, 0x8e36, 0x8e3c, 0x8e3d, 0x8e41, 0x8e30, 0x8e3f, 0x8ebd, 0x8f36, 0x8f2e, 0x8f35, 0x8f32, 0x8f39, 0x8f37, 0x8f34, 0x9076, 0x9079, 0x907b, 0x9086, 0x90fa, 0x9133, 0x9135, 0x9136, 0x9193, 0x9190, 0x9191, 0x918d, 0x918f, 0x9327, 0x931e, 0x9308, 0x931f, 0x9306, 0x930f, 0x937a, 0x9338, 0x933c, 0x931b, 0x9323, 0x9312, 0x9301, 0x9346, 0x932d, 0x930e, 0x930d, 0x92cb, 0x931d, 0x92fa, 0x9325, 0x9313, 0x92f9, 0x92f7, 0x9334, 0x9302, 0x9324, 0x92ff, 0x9329, 0x9339, 0x9335, 0x932a, 0x9314, 0x930c, /* 0xec */ 0x930b, 0x92fe, 0x9309, 0x9300, 0x92fb, 0x9316, 0x95bc, 0x95cd, 0x95be, 0x95b9, 0x95ba, 0x95b6, 0x95bf, 0x95b5, 0x95bd, 0x96a9, 0x96d4, 0x970b, 0x9712, 0x9710, 0x9799, 0x9797, 0x9794, 0x97f0, 0x97f8, 0x9835, 0x982f, 0x9832, 0x9924, 0x991f, 0x9927, 0x9929, 0x999e, 0x99ee, 0x99ec, 0x99e5, 0x99e4, 0x99f0, 0x99e3, 0x99ea, 0x99e9, 0x99e7, 0x9ab9, 0x9abf, 0x9ab4, 0x9abb, 0x9af6, 0x9afa, 0x9af9, 0x9af7, 0x9b33, 0x9b80, 0x9b85, 0x9b87, 0x9b7c, 0x9b7e, 0x9b7b, 0x9b82, 0x9b93, 0x9b92, 0x9b90, 0x9b7a, 0x9b95, 0x9b7d, 0x9b88, 0x9d25, 0x9d17, 0x9d20, 0x9d1e, 0x9d14, 0x9d29, 0x9d1d, 0x9d18, 0x9d22, 0x9d10, 0x9d19, 0x9d1f, 0x9e88, 0x9e86, 0x9e87, 0x9eae, 0x9ead, 0x9ed5, 0x9ed6, 0x9efa, 0x9f12, 0x9f3d, 0x5126, 0x5125, 0x5122, 0x5124, 0x5120, 0x5129, 0x52f4, 0x5693, 0x568c, 0x568d, 0x5686, 0x5684, 0x5683, 0x567e, 0x5682, 0x567f, 0x5681, 0x58d6, 0x58d4, 0x58cf, 0x58d2, 0x5b2d, 0x5b25, 0x5b32, 0x5b23, 0x5b2c, 0x5b27, 0x5b26, 0x5b2f, 0x5b2e, 0x5b7b, 0x5bf1, 0x5bf2, 0x5db7, 0x5e6c, 0x5e6a, 0x5fbe, 0x5fbb, 0x61c3, 0x61b5, 0x61bc, 0x61e7, 0x61e0, 0x61e5, 0x61e4, 0x61e8, 0x61de, 0x64ef, 0x64e9, 0x64e3, 0x64eb, 0x64e4, 0x64e8, 0x6581, 0x6580, 0x65b6, 0x65da, 0x66d2, 0x6a8d, 0x6a96, 0x6a81, 0x6aa5, 0x6a89, 0x6a9f, 0x6a9b, 0x6aa1, 0x6a9e, 0x6a87, 0x6a93, 0x6a8e, /* 0xed */ 0x6a95, 0x6a83, 0x6aa8, 0x6aa4, 0x6a91, 0x6a7f, 0x6aa6, 0x6a9a, 0x6a85, 0x6a8c, 0x6a92, 0x6b5b, 0x6bad, 0x6c09, 0x6fcc, 0x6fa9, 0x6ff4, 0x6fd4, 0x6fe3, 0x6fdc, 0x6fed, 0x6fe7, 0x6fe6, 0x6fde, 0x6ff2, 0x6fdd, 0x6fe2, 0x6fe8, 0x71e1, 0x71f1, 0x71e8, 0x71f2, 0x71e4, 0x71f0, 0x71e2, 0x7373, 0x736e, 0x736f, 0x7497, 0x74b2, 0x74ab, 0x7490, 0x74aa, 0x74ad, 0x74b1, 0x74a5, 0x74af, 0x7510, 0x7511, 0x7512, 0x750f, 0x7584, 0x7643, 0x7648, 0x7649, 0x7647, 0x76a4, 0x76e9, 0x77b5, 0x77ab, 0x77b2, 0x77b7, 0x77b6, 0x77b4, 0x77b1, 0x77a8, 0x77f0, 0x78f3, 0x78fd, 0x7902, 0x78fb, 0x78fc, 0x78f2, 0x7905, 0x78f9, 0x78fe, 0x7904, 0x79ab, 0x79a8, 0x7a5c, 0x7a5b, 0x7a56, 0x7a58, 0x7a54, 0x7a5a, 0x7abe, 0x7ac0, 0x7ac1, 0x7c05, 0x7c0f, 0x7bf2, 0x7c00, 0x7bff, 0x7bfb, 0x7c0e, 0x7bf4, 0x7c0b, 0x7bf3, 0x7c02, 0x7c09, 0x7c03, 0x7c01, 0x7bf8, 0x7bfd, 0x7c06, 0x7bf0, 0x7bf1, 0x7c10, 0x7c0a, 0x7ce8, 0x7e2d, 0x7e3c, 0x7e42, 0x7e33, 0x9848, 0x7e38, 0x7e2a, 0x7e49, 0x7e40, 0x7e47, 0x7e29, 0x7e4c, 0x7e30, 0x7e3b, 0x7e36, 0x7e44, 0x7e3a, 0x7f45, 0x7f7f, 0x7f7e, 0x7f7d, 0x7ff4, 0x7ff2, 0x802c, 0x81bb, 0x81c4, 0x81cc, 0x81ca, 0x81c5, 0x81c7, 0x81bc, 0x81e9, 0x825b, 0x825a, 0x825c, 0x8583, 0x8580, 0x858f, 0x85a7, 0x8595, 0x85a0, 0x858b, 0x85a3, 0x857b, 0x85a4, 0x859a, 0x859e, /* 0xee */ 0x8577, 0x857c, 0x8589, 0x85a1, 0x857a, 0x8578, 0x8557, 0x858e, 0x8596, 0x8586, 0x858d, 0x8599, 0x859d, 0x8581, 0x85a2, 0x8582, 0x8588, 0x8585, 0x8579, 0x8576, 0x8598, 0x8590, 0x859f, 0x8668, 0x87be, 0x87aa, 0x87ad, 0x87c5, 0x87b0, 0x87ac, 0x87b9, 0x87b5, 0x87bc, 0x87ae, 0x87c9, 0x87c3, 0x87c2, 0x87cc, 0x87b7, 0x87af, 0x87c4, 0x87ca, 0x87b4, 0x87b6, 0x87bf, 0x87b8, 0x87bd, 0x87de, 0x87b2, 0x8935, 0x8933, 0x893c, 0x893e, 0x8941, 0x8952, 0x8937, 0x8942, 0x89ad, 0x89af, 0x89ae, 0x89f2, 0x89f3, 0x8b1e, 0x8b18, 0x8b16, 0x8b11, 0x8b05, 0x8b0b, 0x8b22, 0x8b0f, 0x8b12, 0x8b15, 0x8b07, 0x8b0d, 0x8b08, 0x8b06, 0x8b1c, 0x8b13, 0x8b1a, 0x8c4f, 0x8c70, 0x8c72, 0x8c71, 0x8c6f, 0x8c95, 0x8c94, 0x8cf9, 0x8d6f, 0x8e4e, 0x8e4d, 0x8e53, 0x8e50, 0x8e4c, 0x8e47, 0x8f43, 0x8f40, 0x9085, 0x907e, 0x9138, 0x919a, 0x91a2, 0x919b, 0x9199, 0x919f, 0x91a1, 0x919d, 0x91a0, 0x93a1, 0x9383, 0x93af, 0x9364, 0x9356, 0x9347, 0x937c, 0x9358, 0x935c, 0x9376, 0x9349, 0x9350, 0x9351, 0x9360, 0x936d, 0x938f, 0x934c, 0x936a, 0x9379, 0x9357, 0x9355, 0x9352, 0x934f, 0x9371, 0x9377, 0x937b, 0x9361, 0x935e, 0x9363, 0x9367, 0x9380, 0x934e, 0x9359, 0x95c7, 0x95c0, 0x95c9, 0x95c3, 0x95c5, 0x95b7, 0x96ae, 0x96b0, 0x96ac, 0x9720, 0x971f, 0x9718, 0x971d, 0x9719, 0x979a, 0x97a1, 0x979c, /* 0xef */ 0x979e, 0x979d, 0x97d5, 0x97d4, 0x97f1, 0x9841, 0x9844, 0x984a, 0x9849, 0x9845, 0x9843, 0x9925, 0x992b, 0x992c, 0x992a, 0x9933, 0x9932, 0x992f, 0x992d, 0x9931, 0x9930, 0x9998, 0x99a3, 0x99a1, 0x9a02, 0x99fa, 0x99f4, 0x99f7, 0x99f9, 0x99f8, 0x99f6, 0x99fb, 0x99fd, 0x99fe, 0x99fc, 0x9a03, 0x9abe, 0x9afe, 0x9afd, 0x9b01, 0x9afc, 0x9b48, 0x9b9a, 0x9ba8, 0x9b9e, 0x9b9b, 0x9ba6, 0x9ba1, 0x9ba5, 0x9ba4, 0x9b86, 0x9ba2, 0x9ba0, 0x9baf, 0x9d33, 0x9d41, 0x9d67, 0x9d36, 0x9d2e, 0x9d2f, 0x9d31, 0x9d38, 0x9d30, 0x9d45, 0x9d42, 0x9d43, 0x9d3e, 0x9d37, 0x9d40, 0x9d3d, 0x7ff5, 0x9d2d, 0x9e8a, 0x9e89, 0x9e8d, 0x9eb0, 0x9ec8, 0x9eda, 0x9efb, 0x9eff, 0x9f24, 0x9f23, 0x9f22, 0x9f54, 0x9fa0, 0x5131, 0x512d, 0x512e, 0x5698, 0x569c, 0x5697, 0x569a, 0x569d, 0x5699, 0x5970, 0x5b3c, 0x5c69, 0x5c6a, 0x5dc0, 0x5e6d, 0x5e6e, 0x61d8, 0x61df, 0x61ed, 0x61ee, 0x61f1, 0x61ea, 0x61f0, 0x61eb, 0x61d6, 0x61e9, 0x64ff, 0x6504, 0x64fd, 0x64f8, 0x6501, 0x6503, 0x64fc, 0x6594, 0x65db, 0x66da, 0x66db, 0x66d8, 0x6ac5, 0x6ab9, 0x6abd, 0x6ae1, 0x6ac6, 0x6aba, 0x6ab6, 0x6ab7, 0x6ac7, 0x6ab4, 0x6aad, 0x6b5e, 0x6bc9, 0x6c0b, 0x7007, 0x700c, 0x700d, 0x7001, 0x7005, 0x7014, 0x700e, 0x6fff, 0x7000, 0x6ffb, 0x7026, 0x6ffc, 0x6ff7, 0x700a, 0x7201, 0x71ff, 0x71f9, 0x7203, 0x71fd, 0x7376, /* 0xf0 */ 0x74b8, 0x74c0, 0x74b5, 0x74c1, 0x74be, 0x74b6, 0x74bb, 0x74c2, 0x7514, 0x7513, 0x765c, 0x7664, 0x7659, 0x7650, 0x7653, 0x7657, 0x765a, 0x76a6, 0x76bd, 0x76ec, 0x77c2, 0x77ba, 0x78ff, 0x790c, 0x7913, 0x7914, 0x7909, 0x7910, 0x7912, 0x7911, 0x79ad, 0x79ac, 0x7a5f, 0x7c1c, 0x7c29, 0x7c19, 0x7c20, 0x7c1f, 0x7c2d, 0x7c1d, 0x7c26, 0x7c28, 0x7c22, 0x7c25, 0x7c30, 0x7e5c, 0x7e50, 0x7e56, 0x7e63, 0x7e58, 0x7e62, 0x7e5f, 0x7e51, 0x7e60, 0x7e57, 0x7e53, 0x7fb5, 0x7fb3, 0x7ff7, 0x7ff8, 0x8075, 0x81d1, 0x81d2, 0x81d0, 0x825f, 0x825e, 0x85b4, 0x85c6, 0x85c0, 0x85c3, 0x85c2, 0x85b3, 0x85b5, 0x85bd, 0x85c7, 0x85c4, 0x85bf, 0x85cb, 0x85ce, 0x85c8, 0x85c5, 0x85b1, 0x85b6, 0x85d2, 0x8624, 0x85b8, 0x85b7, 0x85be, 0x8669, 0x87e7, 0x87e6, 0x87e2, 0x87db, 0x87eb, 0x87ea, 0x87e5, 0x87df, 0x87f3, 0x87e4, 0x87d4, 0x87dc, 0x87d3, 0x87ed, 0x87d8, 0x87e3, 0x87a4, 0x87d7, 0x87d9, 0x8801, 0x87f4, 0x87e8, 0x87dd, 0x8953, 0x894b, 0x894f, 0x894c, 0x8946, 0x8950, 0x8951, 0x8949, 0x8b2a, 0x8b27, 0x8b23, 0x8b33, 0x8b30, 0x8b35, 0x8b47, 0x8b2f, 0x8b3c, 0x8b3e, 0x8b31, 0x8b25, 0x8b37, 0x8b26, 0x8b36, 0x8b2e, 0x8b24, 0x8b3b, 0x8b3d, 0x8b3a, 0x8c42, 0x8c75, 0x8c99, 0x8c98, 0x8c97, 0x8cfe, 0x8d04, 0x8d02, 0x8d00, 0x8e5c, 0x8e62, 0x8e60, 0x8e57, 0x8e56, 0x8e5e, 0x8e65, 0x8e67, /* 0xf1 */ 0x8e5b, 0x8e5a, 0x8e61, 0x8e5d, 0x8e69, 0x8e54, 0x8f46, 0x8f47, 0x8f48, 0x8f4b, 0x9128, 0x913a, 0x913b, 0x913e, 0x91a8, 0x91a5, 0x91a7, 0x91af, 0x91aa, 0x93b5, 0x938c, 0x9392, 0x93b7, 0x939b, 0x939d, 0x9389, 0x93a7, 0x938e, 0x93aa, 0x939e, 0x93a6, 0x9395, 0x9388, 0x9399, 0x939f, 0x938d, 0x93b1, 0x9391, 0x93b2, 0x93a4, 0x93a8, 0x93b4, 0x93a3, 0x93a5, 0x95d2, 0x95d3, 0x95d1, 0x96b3, 0x96d7, 0x96da, 0x5dc2, 0x96df, 0x96d8, 0x96dd, 0x9723, 0x9722, 0x9725, 0x97ac, 0x97ae, 0x97a8, 0x97ab, 0x97a4, 0x97aa, 0x97a2, 0x97a5, 0x97d7, 0x97d9, 0x97d6, 0x97d8, 0x97fa, 0x9850, 0x9851, 0x9852, 0x98b8, 0x9941, 0x993c, 0x993a, 0x9a0f, 0x9a0b, 0x9a09, 0x9a0d, 0x9a04, 0x9a11, 0x9a0a, 0x9a05, 0x9a07, 0x9a06, 0x9ac0, 0x9adc, 0x9b08, 0x9b04, 0x9b05, 0x9b29, 0x9b35, 0x9b4a, 0x9b4c, 0x9b4b, 0x9bc7, 0x9bc6, 0x9bc3, 0x9bbf, 0x9bc1, 0x9bb5, 0x9bb8, 0x9bd3, 0x9bb6, 0x9bc4, 0x9bb9, 0x9bbd, 0x9d5c, 0x9d53, 0x9d4f, 0x9d4a, 0x9d5b, 0x9d4b, 0x9d59, 0x9d56, 0x9d4c, 0x9d57, 0x9d52, 0x9d54, 0x9d5f, 0x9d58, 0x9d5a, 0x9e8e, 0x9e8c, 0x9edf, 0x9f01, 0x9f00, 0x9f16, 0x9f25, 0x9f2b, 0x9f2a, 0x9f29, 0x9f28, 0x9f4c, 0x9f55, 0x5134, 0x5135, 0x5296, 0x52f7, 0x53b4, 0x56ab, 0x56ad, 0x56a6, 0x56a7, 0x56aa, 0x56ac, 0x58da, 0x58dd, 0x58db, 0x5912, 0x5b3d, 0x5b3e, 0x5b3f, 0x5dc3, 0x5e70, /* 0xf2 */ 0x5fbf, 0x61fb, 0x6507, 0x6510, 0x650d, 0x6509, 0x650c, 0x650e, 0x6584, 0x65de, 0x65dd, 0x66de, 0x6ae7, 0x6ae0, 0x6acc, 0x6ad1, 0x6ad9, 0x6acb, 0x6adf, 0x6adc, 0x6ad0, 0x6aeb, 0x6acf, 0x6acd, 0x6ade, 0x6b60, 0x6bb0, 0x6c0c, 0x7019, 0x7027, 0x7020, 0x7016, 0x702b, 0x7021, 0x7022, 0x7023, 0x7029, 0x7017, 0x7024, 0x701c, 0x702a, 0x720c, 0x720a, 0x7207, 0x7202, 0x7205, 0x72a5, 0x72a6, 0x72a4, 0x72a3, 0x72a1, 0x74cb, 0x74c5, 0x74b7, 0x74c3, 0x7516, 0x7660, 0x77c9, 0x77ca, 0x77c4, 0x77f1, 0x791d, 0x791b, 0x7921, 0x791c, 0x7917, 0x791e, 0x79b0, 0x7a67, 0x7a68, 0x7c33, 0x7c3c, 0x7c39, 0x7c2c, 0x7c3b, 0x7cec, 0x7cea, 0x7e76, 0x7e75, 0x7e78, 0x7e70, 0x7e77, 0x7e6f, 0x7e7a, 0x7e72, 0x7e74, 0x7e68, 0x7f4b, 0x7f4a, 0x7f83, 0x7f86, 0x7fb7, 0x7ffd, 0x7ffe, 0x8078, 0x81d7, 0x81d5, 0x8264, 0x8261, 0x8263, 0x85eb, 0x85f1, 0x85ed, 0x85d9, 0x85e1, 0x85e8, 0x85da, 0x85d7, 0x85ec, 0x85f2, 0x85f8, 0x85d8, 0x85df, 0x85e3, 0x85dc, 0x85d1, 0x85f0, 0x85e6, 0x85ef, 0x85de, 0x85e2, 0x8800, 0x87fa, 0x8803, 0x87f6, 0x87f7, 0x8809, 0x880c, 0x880b, 0x8806, 0x87fc, 0x8808, 0x87ff, 0x880a, 0x8802, 0x8962, 0x895a, 0x895b, 0x8957, 0x8961, 0x895c, 0x8958, 0x895d, 0x8959, 0x8988, 0x89b7, 0x89b6, 0x89f6, 0x8b50, 0x8b48, 0x8b4a, 0x8b40, 0x8b53, 0x8b56, 0x8b54, 0x8b4b, 0x8b55, /* 0xf3 */ 0x8b51, 0x8b42, 0x8b52, 0x8b57, 0x8c43, 0x8c77, 0x8c76, 0x8c9a, 0x8d06, 0x8d07, 0x8d09, 0x8dac, 0x8daa, 0x8dad, 0x8dab, 0x8e6d, 0x8e78, 0x8e73, 0x8e6a, 0x8e6f, 0x8e7b, 0x8ec2, 0x8f52, 0x8f51, 0x8f4f, 0x8f50, 0x8f53, 0x8fb4, 0x9140, 0x913f, 0x91b0, 0x91ad, 0x93de, 0x93c7, 0x93cf, 0x93c2, 0x93da, 0x93d0, 0x93f9, 0x93ec, 0x93cc, 0x93d9, 0x93a9, 0x93e6, 0x93ca, 0x93d4, 0x93ee, 0x93e3, 0x93d5, 0x93c4, 0x93ce, 0x93c0, 0x93d2, 0x93e7, 0x957d, 0x95da, 0x95db, 0x96e1, 0x9729, 0x972b, 0x972c, 0x9728, 0x9726, 0x97b3, 0x97b7, 0x97b6, 0x97dd, 0x97de, 0x97df, 0x985c, 0x9859, 0x985d, 0x9857, 0x98bf, 0x98bd, 0x98bb, 0x98be, 0x9948, 0x9947, 0x9943, 0x99a6, 0x99a7, 0x9a1a, 0x9a15, 0x9a25, 0x9a1d, 0x9a24, 0x9a1b, 0x9a22, 0x9a20, 0x9a27, 0x9a23, 0x9a1e, 0x9a1c, 0x9a14, 0x9ac2, 0x9b0b, 0x9b0a, 0x9b0e, 0x9b0c, 0x9b37, 0x9bea, 0x9beb, 0x9be0, 0x9bde, 0x9be4, 0x9be6, 0x9be2, 0x9bf0, 0x9bd4, 0x9bd7, 0x9bec, 0x9bdc, 0x9bd9, 0x9be5, 0x9bd5, 0x9be1, 0x9bda, 0x9d77, 0x9d81, 0x9d8a, 0x9d84, 0x9d88, 0x9d71, 0x9d80, 0x9d78, 0x9d86, 0x9d8b, 0x9d8c, 0x9d7d, 0x9d6b, 0x9d74, 0x9d75, 0x9d70, 0x9d69, 0x9d85, 0x9d73, 0x9d7b, 0x9d82, 0x9d6f, 0x9d79, 0x9d7f, 0x9d87, 0x9d68, 0x9e94, 0x9e91, 0x9ec0, 0x9efc, 0x9f2d, 0x9f40, 0x9f41, 0x9f4d, 0x9f56, 0x9f57, 0x9f58, 0x5337, 0x56b2, /* 0xf4 */ 0x56b5, 0x56b3, 0x58e3, 0x5b45, 0x5dc6, 0x5dc7, 0x5eee, 0x5eef, 0x5fc0, 0x5fc1, 0x61f9, 0x6517, 0x6516, 0x6515, 0x6513, 0x65df, 0x66e8, 0x66e3, 0x66e4, 0x6af3, 0x6af0, 0x6aea, 0x6ae8, 0x6af9, 0x6af1, 0x6aee, 0x6aef, 0x703c, 0x7035, 0x702f, 0x7037, 0x7034, 0x7031, 0x7042, 0x7038, 0x703f, 0x703a, 0x7039, 0x7040, 0x703b, 0x7033, 0x7041, 0x7213, 0x7214, 0x72a8, 0x737d, 0x737c, 0x74ba, 0x76ab, 0x76aa, 0x76be, 0x76ed, 0x77cc, 0x77ce, 0x77cf, 0x77cd, 0x77f2, 0x7925, 0x7923, 0x7927, 0x7928, 0x7924, 0x7929, 0x79b2, 0x7a6e, 0x7a6c, 0x7a6d, 0x7af7, 0x7c49, 0x7c48, 0x7c4a, 0x7c47, 0x7c45, 0x7cee, 0x7e7b, 0x7e7e, 0x7e81, 0x7e80, 0x7fba, 0x7fff, 0x8079, 0x81db, 0x81d9, 0x820b, 0x8268, 0x8269, 0x8622, 0x85ff, 0x8601, 0x85fe, 0x861b, 0x8600, 0x85f6, 0x8604, 0x8609, 0x8605, 0x860c, 0x85fd, 0x8819, 0x8810, 0x8811, 0x8817, 0x8813, 0x8816, 0x8963, 0x8966, 0x89b9, 0x89f7, 0x8b60, 0x8b6a, 0x8b5d, 0x8b68, 0x8b63, 0x8b65, 0x8b67, 0x8b6d, 0x8dae, 0x8e86, 0x8e88, 0x8e84, 0x8f59, 0x8f56, 0x8f57, 0x8f55, 0x8f58, 0x8f5a, 0x908d, 0x9143, 0x9141, 0x91b7, 0x91b5, 0x91b2, 0x91b3, 0x940b, 0x9413, 0x93fb, 0x9420, 0x940f, 0x9414, 0x93fe, 0x9415, 0x9410, 0x9428, 0x9419, 0x940d, 0x93f5, 0x9400, 0x93f7, 0x9407, 0x940e, 0x9416, 0x9412, 0x93fa, 0x9409, 0x93f8, 0x940a, 0x93ff, /* 0xf5 */ 0x93fc, 0x940c, 0x93f6, 0x9411, 0x9406, 0x95de, 0x95e0, 0x95df, 0x972e, 0x972f, 0x97b9, 0x97bb, 0x97fd, 0x97fe, 0x9860, 0x9862, 0x9863, 0x985f, 0x98c1, 0x98c2, 0x9950, 0x994e, 0x9959, 0x994c, 0x994b, 0x9953, 0x9a32, 0x9a34, 0x9a31, 0x9a2c, 0x9a2a, 0x9a36, 0x9a29, 0x9a2e, 0x9a38, 0x9a2d, 0x9ac7, 0x9aca, 0x9ac6, 0x9b10, 0x9b12, 0x9b11, 0x9c0b, 0x9c08, 0x9bf7, 0x9c05, 0x9c12, 0x9bf8, 0x9c40, 0x9c07, 0x9c0e, 0x9c06, 0x9c17, 0x9c14, 0x9c09, 0x9d9f, 0x9d99, 0x9da4, 0x9d9d, 0x9d92, 0x9d98, 0x9d90, 0x9d9b, 0x9da0, 0x9d94, 0x9d9c, 0x9daa, 0x9d97, 0x9da1, 0x9d9a, 0x9da2, 0x9da8, 0x9d9e, 0x9da3, 0x9dbf, 0x9da9, 0x9d96, 0x9da6, 0x9da7, 0x9e99, 0x9e9b, 0x9e9a, 0x9ee5, 0x9ee4, 0x9ee7, 0x9ee6, 0x9f30, 0x9f2e, 0x9f5b, 0x9f60, 0x9f5e, 0x9f5d, 0x9f59, 0x9f91, 0x513a, 0x5139, 0x5298, 0x5297, 0x56c3, 0x56bd, 0x56be, 0x5b48, 0x5b47, 0x5dcb, 0x5dcf, 0x5ef1, 0x61fd, 0x651b, 0x6b02, 0x6afc, 0x6b03, 0x6af8, 0x6b00, 0x7043, 0x7044, 0x704a, 0x7048, 0x7049, 0x7045, 0x7046, 0x721d, 0x721a, 0x7219, 0x737e, 0x7517, 0x766a, 0x77d0, 0x792d, 0x7931, 0x792f, 0x7c54, 0x7c53, 0x7cf2, 0x7e8a, 0x7e87, 0x7e88, 0x7e8b, 0x7e86, 0x7e8d, 0x7f4d, 0x7fbb, 0x8030, 0x81dd, 0x8618, 0x862a, 0x8626, 0x861f, 0x8623, 0x861c, 0x8619, 0x8627, 0x862e, 0x8621, 0x8620, 0x8629, 0x861e, 0x8625, /* 0xf6 */ 0x8829, 0x881d, 0x881b, 0x8820, 0x8824, 0x881c, 0x882b, 0x884a, 0x896d, 0x8969, 0x896e, 0x896b, 0x89fa, 0x8b79, 0x8b78, 0x8b45, 0x8b7a, 0x8b7b, 0x8d10, 0x8d14, 0x8daf, 0x8e8e, 0x8e8c, 0x8f5e, 0x8f5b, 0x8f5d, 0x9146, 0x9144, 0x9145, 0x91b9, 0x943f, 0x943b, 0x9436, 0x9429, 0x943d, 0x943c, 0x9430, 0x9439, 0x942a, 0x9437, 0x942c, 0x9440, 0x9431, 0x95e5, 0x95e4, 0x95e3, 0x9735, 0x973a, 0x97bf, 0x97e1, 0x9864, 0x98c9, 0x98c6, 0x98c0, 0x9958, 0x9956, 0x9a39, 0x9a3d, 0x9a46, 0x9a44, 0x9a42, 0x9a41, 0x9a3a, 0x9a3f, 0x9acd, 0x9b15, 0x9b17, 0x9b18, 0x9b16, 0x9b3a, 0x9b52, 0x9c2b, 0x9c1d, 0x9c1c, 0x9c2c, 0x9c23, 0x9c28, 0x9c29, 0x9c24, 0x9c21, 0x9db7, 0x9db6, 0x9dbc, 0x9dc1, 0x9dc7, 0x9dca, 0x9dcf, 0x9dbe, 0x9dc5, 0x9dc3, 0x9dbb, 0x9db5, 0x9dce, 0x9db9, 0x9dba, 0x9dac, 0x9dc8, 0x9db1, 0x9dad, 0x9dcc, 0x9db3, 0x9dcd, 0x9db2, 0x9e7a, 0x9e9c, 0x9eeb, 0x9eee, 0x9eed, 0x9f1b, 0x9f18, 0x9f1a, 0x9f31, 0x9f4e, 0x9f65, 0x9f64, 0x9f92, 0x4eb9, 0x56c6, 0x56c5, 0x56cb, 0x5971, 0x5b4b, 0x5b4c, 0x5dd5, 0x5dd1, 0x5ef2, 0x6521, 0x6520, 0x6526, 0x6522, 0x6b0b, 0x6b08, 0x6b09, 0x6c0d, 0x7055, 0x7056, 0x7057, 0x7052, 0x721e, 0x721f, 0x72a9, 0x737f, 0x74d8, 0x74d5, 0x74d9, 0x74d7, 0x766d, 0x76ad, 0x7935, 0x79b4, 0x7a70, 0x7a71, 0x7c57, 0x7c5c, 0x7c59, 0x7c5b, 0x7c5a, /* 0xf7 */ 0x7cf4, 0x7cf1, 0x7e91, 0x7f4f, 0x7f87, 0x81de, 0x826b, 0x8634, 0x8635, 0x8633, 0x862c, 0x8632, 0x8636, 0x882c, 0x8828, 0x8826, 0x882a, 0x8825, 0x8971, 0x89bf, 0x89be, 0x89fb, 0x8b7e, 0x8b84, 0x8b82, 0x8b86, 0x8b85, 0x8b7f, 0x8d15, 0x8e95, 0x8e94, 0x8e9a, 0x8e92, 0x8e90, 0x8e96, 0x8e97, 0x8f60, 0x8f62, 0x9147, 0x944c, 0x9450, 0x944a, 0x944b, 0x944f, 0x9447, 0x9445, 0x9448, 0x9449, 0x9446, 0x973f, 0x97e3, 0x986a, 0x9869, 0x98cb, 0x9954, 0x995b, 0x9a4e, 0x9a53, 0x9a54, 0x9a4c, 0x9a4f, 0x9a48, 0x9a4a, 0x9a49, 0x9a52, 0x9a50, 0x9ad0, 0x9b19, 0x9b2b, 0x9b3b, 0x9b56, 0x9b55, 0x9c46, 0x9c48, 0x9c3f, 0x9c44, 0x9c39, 0x9c33, 0x9c41, 0x9c3c, 0x9c37, 0x9c34, 0x9c32, 0x9c3d, 0x9c36, 0x9ddb, 0x9dd2, 0x9dde, 0x9dda, 0x9dcb, 0x9dd0, 0x9ddc, 0x9dd1, 0x9ddf, 0x9de9, 0x9dd9, 0x9dd8, 0x9dd6, 0x9df5, 0x9dd5, 0x9ddd, 0x9eb6, 0x9ef0, 0x9f35, 0x9f33, 0x9f32, 0x9f42, 0x9f6b, 0x9f95, 0x9fa2, 0x513d, 0x5299, 0x58e8, 0x58e7, 0x5972, 0x5b4d, 0x5dd8, 0x882f, 0x5f4f, 0x6201, 0x6203, 0x6204, 0x6529, 0x6525, 0x6596, 0x66eb, 0x6b11, 0x6b12, 0x6b0f, 0x6bca, 0x705b, 0x705a, 0x7222, 0x7382, 0x7381, 0x7383, 0x7670, 0x77d4, 0x7c67, 0x7c66, 0x7e95, 0x826c, 0x863a, 0x8640, 0x8639, 0x863c, 0x8631, 0x863b, 0x863e, 0x8830, 0x8832, 0x882e, 0x8833, 0x8976, 0x8974, 0x8973, 0x89fe, /* 0xf8 */ 0x8b8c, 0x8b8e, 0x8b8b, 0x8b88, 0x8c45, 0x8d19, 0x8e98, 0x8f64, 0x8f63, 0x91bc, 0x9462, 0x9455, 0x945d, 0x9457, 0x945e, 0x97c4, 0x97c5, 0x9800, 0x9a56, 0x9a59, 0x9b1e, 0x9b1f, 0x9b20, 0x9c52, 0x9c58, 0x9c50, 0x9c4a, 0x9c4d, 0x9c4b, 0x9c55, 0x9c59, 0x9c4c, 0x9c4e, 0x9dfb, 0x9df7, 0x9def, 0x9de3, 0x9deb, 0x9df8, 0x9de4, 0x9df6, 0x9de1, 0x9dee, 0x9de6, 0x9df2, 0x9df0, 0x9de2, 0x9dec, 0x9df4, 0x9df3, 0x9de8, 0x9ded, 0x9ec2, 0x9ed0, 0x9ef2, 0x9ef3, 0x9f06, 0x9f1c, 0x9f38, 0x9f37, 0x9f36, 0x9f43, 0x9f4f, 0x9f71, 0x9f70, 0x9f6e, 0x9f6f, 0x56d3, 0x56cd, 0x5b4e, 0x5c6d, 0x652d, 0x66ed, 0x66ee, 0x6b13, 0x705f, 0x7061, 0x705d, 0x7060, 0x7223, 0x74db, 0x74e5, 0x77d5, 0x7938, 0x79b7, 0x79b6, 0x7c6a, 0x7e97, 0x7f89, 0x826d, 0x8643, 0x8838, 0x8837, 0x8835, 0x884b, 0x8b94, 0x8b95, 0x8e9e, 0x8e9f, 0x8ea0, 0x8e9d, 0x91be, 0x91bd, 0x91c2, 0x946b, 0x9468, 0x9469, 0x96e5, 0x9746, 0x9743, 0x9747, 0x97c7, 0x97e5, 0x9a5e, 0x9ad5, 0x9b59, 0x9c63, 0x9c67, 0x9c66, 0x9c62, 0x9c5e, 0x9c60, 0x9e02, 0x9dfe, 0x9e07, 0x9e03, 0x9e06, 0x9e05, 0x9e00, 0x9e01, 0x9e09, 0x9dff, 0x9dfd, 0x9e04, 0x9ea0, 0x9f1e, 0x9f46, 0x9f74, 0x9f75, 0x9f76, 0x56d4, 0x652e, 0x65b8, 0x6b18, 0x6b19, 0x6b17, 0x6b1a, 0x7062, 0x7226, 0x72aa, 0x77d8, 0x77d9, 0x7939, 0x7c69, 0x7c6b, 0x7cf6, 0x7e9a, /* 0xf9 */ 0x7e98, 0x7e9b, 0x7e99, 0x81e0, 0x81e1, 0x8646, 0x8647, 0x8648, 0x8979, 0x897a, 0x897c, 0x897b, 0x89ff, 0x8b98, 0x8b99, 0x8ea5, 0x8ea4, 0x8ea3, 0x946e, 0x946d, 0x946f, 0x9471, 0x9473, 0x9749, 0x9872, 0x995f, 0x9c68, 0x9c6e, 0x9c6d, 0x9e0b, 0x9e0d, 0x9e10, 0x9e0f, 0x9e12, 0x9e11, 0x9ea1, 0x9ef5, 0x9f09, 0x9f47, 0x9f78, 0x9f7b, 0x9f7a, 0x9f79, 0x571e, 0x7066, 0x7c6f, 0x883c, 0x8db2, 0x8ea6, 0x91c3, 0x9474, 0x9478, 0x9476, 0x9475, 0x9a60, 0x9c74, 0x9c73, 0x9c71, 0x9c75, 0x9e14, 0x9e13, 0x9ef6, 0x9f0a, 0x9fa4, 0x7068, 0x7065, 0x7cf7, 0x866a, 0x883e, 0x883d, 0x883f, 0x8b9e, 0x8c9c, 0x8ea9, 0x8ec9, 0x974b, 0x9873, 0x9874, 0x98cc, 0x9961, 0x99ab, 0x9a64, 0x9a66, 0x9a67, 0x9b24, 0x9e15, 0x9e17, 0x9f48, 0x6207, 0x6b1e, 0x7227, 0x864c, 0x8ea8, 0x9482, 0x9480, 0x9481, 0x9a69, 0x9a68, 0x9b2e, 0x9e19, 0x7229, 0x864b, 0x8b9f, 0x9483, 0x9c79, 0x9eb7, 0x7675, 0x9a6b, 0x9c7a, 0x9e1d, 0x7069, 0x706a, 0x9ea4, 0x9f7e, 0x9f49, 0x9f98, }; static int big5_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c1 = s[0]; if ((c1 >= 0xa1 && c1 <= 0xc7) || (c1 >= 0xc9 && c1 <= 0xf9)) { if (n >= 2) { unsigned char c2 = s[1]; if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) { unsigned int i = 157 * (c1 - 0xa1) + (c2 - (c2 >= 0xa1 ? 0x62 : 0x40)); unsigned short wc = 0xfffd; if (i < 6280) { if (i < 6121) wc = big5_2uni_pagea1[i]; } else { if (i < 13932) wc = big5_2uni_pagec9[i-6280]; } if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 2; } } return RET_ILSEQ; } return RET_TOOFEW(0); } return RET_ILSEQ; } static const unsigned short big5_2charset[13703] = { 0xa246, 0xa247, 0xa244, 0xa1b1, 0xa258, 0xa1d3, 0xa150, 0xa1d1, 0xa1d2, 0xa3be, 0xa3bc, 0xa3bd, 0xa3bf, 0xa3bb, 0xa344, 0xa345, 0xa346, 0xa347, 0xa348, 0xa349, 0xa34a, 0xa34b, 0xa34c, 0xa34d, 0xa34e, 0xa34f, 0xa350, 0xa351, 0xa352, 0xa353, 0xa354, 0xa355, 0xa356, 0xa357, 0xa358, 0xa359, 0xa35a, 0xa35b, 0xa35c, 0xa35d, 0xa35e, 0xa35f, 0xa360, 0xa361, 0xa362, 0xa363, 0xa364, 0xa365, 0xa366, 0xa367, 0xa368, 0xa369, 0xa36a, 0xa36b, 0xa36c, 0xa36d, 0xa36e, 0xa36f, 0xa370, 0xa371, 0xa372, 0xa373, 0xc7b3, 0xc7b1, 0xc7b2, 0xc7b4, 0xc7b5, 0xc7b6, 0xc7b7, 0xc7b8, 0xc7b9, 0xc7ba, 0xc7bb, 0xc7bc, 0xc7bd, 0xc7be, 0xc7bf, 0xc7c0, 0xc7c1, 0xc7c2, 0xc7c3, 0xc7c4, 0xc7c5, 0xc7c6, 0xc7c7, 0xc7c8, 0xc7c9, 0xc7ca, 0xc7cb, 0xc7cc, 0xc7cd, 0xc7cf, 0xc7d0, 0xc7d1, 0xc7d2, 0xc7d3, 0xc7d4, 0xc7d5, 0xc7d6, 0xc7d7, 0xc7d8, 0xc7d9, 0xc7da, 0xc7db, 0xc7dc, 0xc7dd, 0xc7de, 0xc7df, 0xc7e0, 0xc7e1, 0xc7e2, 0xc7e3, 0xc7e4, 0xc7e5, 0xc7e6, 0xc7e7, 0xc7e8, 0xc7ce, 0xa156, 0xa158, 0xa1a5, 0xa1a6, 0xa1a7, 0xa1a8, 0xa145, 0xa14c, 0xa14b, 0xa1ac, 0xa1ab, 0xa1b0, 0xa1c2, 0xa24a, 0xa1c1, 0xa24b, 0xa2b9, 0xa2ba, 0xa2bb, 0xa2bc, 0xa2bd, 0xa2be, 0xa2bf, 0xa2c0, 0xa2c1, 0xa2c2, 0xa1f6, 0xa1f4, 0xa1f7, 0xa1f5, 0xa1f8, 0xa1f9, 0xa1fb, 0xa1fa, 0xa1d4, 0xa1db, 0xa1e8, 0xa1e7, 0xa1fd, 0xa1fc, 0xa1e4, 0xa1e5, 0xa1ec, 0xa1ed, 0xa1ef, 0xa1ee, 0xa1e3, 0xa1dc, 0xa1da, 0xa1dd, 0xa1d8, 0xa1d9, 0xa1e6, 0xa1e9, 0xc7e9, 0xc7ea, 0xc7eb, 0xc7ec, 0xc7ed, 0xc7ee, 0xc7ef, 0xc7f0, 0xc7f1, 0xc7f2, 0xc7f3, 0xc7f4, 0xc7f5, 0xc7f6, 0xc7f7, 0xc7f8, 0xc7f9, 0xc7fa, 0xc7fb, 0xc7fc, 0xa277, 0xa278, 0xa27a, 0xa27b, 0xa27c, 0xa27d, 0xa275, 0xa274, 0xa273, 0xa272, 0xa271, 0xa2a4, 0xa2a5, 0xa2a7, 0xa2a6, 0xa27e, 0xa2a1, 0xa2a3, 0xa2a2, 0xa2ac, 0xa2ad, 0xa2ae, 0xa262, 0xa263, 0xa264, 0xa265, 0xa266, 0xa267, 0xa268, 0xa269, 0xa270, 0xa26f, 0xa26e, 0xa26d, 0xa26c, 0xa26b, 0xa26a, 0xa276, 0xa279, 0xa1bd, 0xa1bc, 0xa1b6, 0xa1b5, 0xa1bf, 0xa1be, 0xa1bb, 0xa1ba, 0xa1b3, 0xa1b7, 0xa1b4, 0xa2a8, 0xa2a9, 0xa2ab, 0xa2aa, 0xa1b9, 0xa1b8, 0xa1f3, 0xa1f0, 0xa1f2, 0xa1f1, 0xa140, 0xa142, 0xa143, 0xa1b2, 0xc6a4, 0xa171, 0xa172, 0xa16d, 0xa16e, 0xa175, 0xa176, 0xa179, 0xa17a, 0xa169, 0xa16a, 0xa245, 0xa165, 0xa166, 0xa1a9, 0xa1aa, 0xa2c3, 0xa2c4, 0xa2c5, 0xa2c6, 0xa2c7, 0xa2c8, 0xa2c9, 0xa2ca, 0xa2cb, 0xc6a5, 0xc6a6, 0xc6a7, 0xc6a8, 0xc6a9, 0xc6aa, 0xc6ab, 0xc6ac, 0xc6ad, 0xc6ae, 0xc6af, 0xc6b0, 0xc6b1, 0xc6b2, 0xc6b3, 0xc6b4, 0xc6b5, 0xc6b6, 0xc6b7, 0xc6b8, 0xc6b9, 0xc6ba, 0xc6bb, 0xc6bc, 0xc6bd, 0xc6be, 0xc6bf, 0xc6c0, 0xc6c1, 0xc6c2, 0xc6c3, 0xc6c4, 0xc6c5, 0xc6c6, 0xc6c7, 0xc6c8, 0xc6c9, 0xc6ca, 0xc6cb, 0xc6cc, 0xc6cd, 0xc6ce, 0xc6cf, 0xc6d0, 0xc6d1, 0xc6d2, 0xc6d3, 0xc6d4, 0xc6d5, 0xc6d6, 0xc6d7, 0xc6d8, 0xc6d9, 0xc6da, 0xc6db, 0xc6dc, 0xc6dd, 0xc6de, 0xc6df, 0xc6e0, 0xc6e1, 0xc6e2, 0xc6e3, 0xc6e4, 0xc6e5, 0xc6e6, 0xc6e7, 0xc6e8, 0xc6e9, 0xc6ea, 0xc6eb, 0xc6ec, 0xc6ed, 0xc6ee, 0xc6ef, 0xc6f0, 0xc6f1, 0xc6f2, 0xc6f3, 0xc6f4, 0xc6f5, 0xc6f6, 0xc6f7, 0xc6a2, 0xc6a3, 0xc6f8, 0xc6f9, 0xc6fa, 0xc6fb, 0xc6fc, 0xc6fd, 0xc6fe, 0xc740, 0xc741, 0xc742, 0xc743, 0xc744, 0xc745, 0xc746, 0xc747, 0xc748, 0xc749, 0xc74a, 0xc74b, 0xc74c, 0xc74d, 0xc74e, 0xc74f, 0xc750, 0xc751, 0xc752, 0xc753, 0xc754, 0xc755, 0xc756, 0xc757, 0xc758, 0xc759, 0xc75a, 0xc75b, 0xc75c, 0xc75d, 0xc75e, 0xc75f, 0xc760, 0xc761, 0xc762, 0xc763, 0xc764, 0xc765, 0xc766, 0xc767, 0xc768, 0xc769, 0xc76a, 0xc76b, 0xc76c, 0xc76d, 0xc76e, 0xc76f, 0xc770, 0xc771, 0xc772, 0xc773, 0xc774, 0xc775, 0xc776, 0xc777, 0xc778, 0xc779, 0xc77a, 0xc77b, 0xc77c, 0xc77d, 0xc77e, 0xc7a1, 0xc7a2, 0xc7a3, 0xc7a4, 0xc7a5, 0xc7a6, 0xc7a7, 0xc7a8, 0xc7a9, 0xc7aa, 0xc7ab, 0xc7ac, 0xc7ad, 0xc7ae, 0xc7af, 0xc7b0, 0xc6a1, 0xa374, 0xa375, 0xa376, 0xa377, 0xa378, 0xa379, 0xa37a, 0xa37b, 0xa37c, 0xa37d, 0xa37e, 0xa3a1, 0xa3a2, 0xa3a3, 0xa3a4, 0xa3a5, 0xa3a6, 0xa3a7, 0xa3a8, 0xa3a9, 0xa3aa, 0xa3ab, 0xa3ac, 0xa3ad, 0xa3ae, 0xa3af, 0xa3b0, 0xa3b1, 0xa3b2, 0xa3b3, 0xa3b4, 0xa3b5, 0xa3b6, 0xa3b7, 0xa3b8, 0xa3b9, 0xa3ba, 0xa1c0, 0xa255, 0xa256, 0xa250, 0xa251, 0xa252, 0xa254, 0xa257, 0xa253, 0xa1eb, 0xa1ea, 0xa24f, 0xa440, 0xa442, 0xa443, 0xc945, 0xa456, 0xa454, 0xa457, 0xa455, 0xc946, 0xa4a3, 0xc94f, 0xc94d, 0xa4a2, 0xa4a1, 0xa542, 0xa541, 0xa540, 0xa543, 0xa4fe, 0xa5e0, 0xa5e1, 0xa8c3, 0xa458, 0xa4a4, 0xc950, 0xa4a5, 0xc963, 0xa6ea, 0xcbb1, 0xa459, 0xa4a6, 0xa544, 0xc964, 0xc940, 0xa444, 0xa45b, 0xc947, 0xa45c, 0xa4a7, 0xa545, 0xa547, 0xa546, 0xa5e2, 0xa5e3, 0xa8c4, 0xadbc, 0xa441, 0xc941, 0xa445, 0xa45e, 0xa45d, 0xa5e4, 0xa8c5, 0xb0ae, 0xd44b, 0xb6c3, 0xdcb1, 0xdcb2, 0xa446, 0xa4a9, 0xa8c6, 0xa447, 0xc948, 0xa45f, 0xa4aa, 0xa4ac, 0xc951, 0xa4ad, 0xa4ab, 0xa5e5, 0xa8c7, 0xa8c8, 0xab45, 0xa460, 0xa4ae, 0xa5e6, 0xa5e8, 0xa5e7, 0xa6eb, 0xa8c9, 0xa8ca, 0xab46, 0xab47, 0xadbd, 0xdcb3, 0xf6d6, 0xa448, 0xa4b0, 0xa4af, 0xc952, 0xa4b1, 0xa4b7, 0xa4b2, 0xa4b3, 0xc954, 0xc953, 0xa4b5, 0xa4b6, 0xa4b4, 0xa54a, 0xa54b, 0xa54c, 0xa54d, 0xa549, 0xa550, 0xc96a, 0xc966, 0xc969, 0xa551, 0xa561, 0xc968, 0xa54e, 0xa54f, 0xa548, 0xc965, 0xc967, 0xa5f5, 0xc9b0, 0xa5f2, 0xa5f6, 0xc9ba, 0xc9ae, 0xa5f3, 0xc9b2, 0xa5f4, 0xa5f7, 0xa5e9, 0xc9b1, 0xa5f8, 0xc9b5, 0xc9b9, 0xc9b6, 0xc9b3, 0xa5ea, 0xa5ec, 0xa5f9, 0xa5ee, 0xc9ab, 0xa5f1, 0xa5ef, 0xa5f0, 0xc9bb, 0xc9b8, 0xc9af, 0xa5ed, 0xc9ac, 0xa5eb, 0xc9b4, 0xc9b7, 0xc9ad, 0xca66, 0xa742, 0xa6f4, 0xca67, 0xa6f1, 0xa744, 0xa6f9, 0xa6f8, 0xca5b, 0xa6fc, 0xa6f7, 0xca60, 0xca68, 0xca64, 0xa6fa, 0xa6fd, 0xa6ee, 0xa747, 0xca5d, 0xcbbd, 0xa6ec, 0xa743, 0xa6ed, 0xa6f5, 0xa6f6, 0xca62, 0xca5e, 0xa6fb, 0xa6f3, 0xca5a, 0xa6ef, 0xca65, 0xa745, 0xa748, 0xa6f2, 0xa740, 0xa746, 0xa6f0, 0xca63, 0xa741, 0xca69, 0xca5c, 0xa6fe, 0xca5f, 0xca61, 0xa8d8, 0xcbbf, 0xcbcb, 0xa8d0, 0xcbcc, 0xa8cb, 0xa8d5, 0xa8ce, 0xcbb9, 0xa8d6, 0xcbb8, 0xcbbc, 0xcbc3, 0xcbc1, 0xa8de, 0xa8d9, 0xcbb3, 0xcbb5, 0xa8db, 0xa8cf, 0xcbb6, 0xcbc2, 0xcbc9, 0xa8d4, 0xcbbb, 0xcbb4, 0xa8d3, 0xcbb7, 0xa8d7, 0xcbba, 0xa8d2, 0xa8cd, 0xa8dc, 0xcbc4, 0xa8dd, 0xcbc8, 0xcbc6, 0xcbca, 0xa8da, 0xcbbe, 0xcbb2, 0xcbc0, 0xa8d1, 0xcbc5, 0xa8cc, 0xcbc7, 0xab56, 0xab4a, 0xcde0, 0xcde8, 0xab49, 0xab51, 0xab5d, 0xcdee, 0xcdec, 0xcde7, 0xab4b, 0xcded, 0xcde3, 0xab59, 0xab50, 0xab58, 0xcdde, 0xcdea, 0xcde1, 0xab54, 0xcde2, 0xcddd, 0xab5b, 0xab4e, 0xab57, 0xab4d, 0xcddf, 0xcde4, 0xcdeb, 0xab55, 0xab52, 0xcde6, 0xab5a, 0xcde9, 0xcde5, 0xab4f, 0xab5c, 0xab53, 0xab4c, 0xab48, 0xcdef, 0xadd7, 0xadc1, 0xadd1, 0xadd6, 0xd0d0, 0xd0cf, 0xd0d4, 0xd0d5, 0xadc4, 0xadcd, 0xadda, 0xadce, 0xd0c9, 0xadc7, 0xd0ca, 0xaddc, 0xadd3, 0xadbe, 0xadbf, 0xd0dd, 0xb0bf, 0xadcc, 0xadcb, 0xd0cb, 0xadcf, 0xd45b, 0xadc6, 0xd0d6, 0xadd5, 0xadd4, 0xadca, 0xd0ce, 0xd0d7, 0xd0c8, 0xadc9, 0xd0d8, 0xadd2, 0xd0cc, 0xadc0, 0xadc3, 0xadc2, 0xd0d9, 0xadd0, 0xadc5, 0xadd9, 0xaddb, 0xd0d3, 0xadd8, 0xd0db, 0xd0cd, 0xd0dc, 0xd0d1, 0xd0da, 0xd0d2, 0xadc8, 0xd463, 0xd457, 0xb0b3, 0xd45c, 0xd462, 0xb0b2, 0xd455, 0xb0b6, 0xd459, 0xd452, 0xb0b4, 0xd456, 0xb0b9, 0xb0be, 0xd467, 0xd451, 0xb0ba, 0xd466, 0xb0b5, 0xd458, 0xb0b1, 0xd453, 0xd44f, 0xd45d, 0xd450, 0xd44e, 0xd45a, 0xd460, 0xd461, 0xb0b7, 0xd85b, 0xd45e, 0xd44d, 0xd45f, 0xb0c1, 0xd464, 0xb0c0, 0xd44c, 0xd454, 0xd465, 0xb0bc, 0xb0bb, 0xb0b8, 0xb0bd, 0xb0af, 0xb0b0, 0xb3c8, 0xd85e, 0xd857, 0xb3c5, 0xd85f, 0xd855, 0xd858, 0xb3c4, 0xd859, 0xb3c7, 0xd85d, 0xd853, 0xd852, 0xb3c9, 0xb3ca, 0xb3c6, 0xb3cb, 0xd851, 0xd85c, 0xd85a, 0xd854, 0xb3c3, 0xd856, 0xb6ca, 0xb6c4, 0xdcb7, 0xb6cd, 0xdcbd, 0xdcc0, 0xb6c6, 0xb6c7, 0xdcba, 0xb6c5, 0xdcc3, 0xb6cb, 0xdcc4, 0xdcbf, 0xb6cc, 0xdcb4, 0xb6c9, 0xdcb5, 0xdcbe, 0xdcbc, 0xdcb8, 0xb6c8, 0xdcb6, 0xb6ce, 0xdcbb, 0xdcc2, 0xdcb9, 0xdcc1, 0xb9b6, 0xb9b3, 0xb9b4, 0xe0f9, 0xe0f1, 0xb9b2, 0xb9af, 0xe0f2, 0xb9b1, 0xe0f5, 0xe0f7, 0xe0fe, 0xe0fd, 0xe0f8, 0xb9ae, 0xe0f0, 0xb9ac, 0xe0f3, 0xb9b7, 0xe0f6, 0xe0fa, 0xb9b0, 0xb9ad, 0xe0fc, 0xe0fb, 0xb9b5, 0xe0f4, 0xbbf8, 0xe4ec, 0xe4e9, 0xbbf9, 0xbbf7, 0xe4f0, 0xe4ed, 0xe4e6, 0xbbf6, 0xbbfa, 0xe4e7, 0xbbf5, 0xbbfd, 0xe4ea, 0xe4eb, 0xbbfb, 0xbbfc, 0xe4f1, 0xe4ee, 0xe4ef, 0xbeaa, 0xe8f8, 0xbea7, 0xe8f5, 0xbea9, 0xbeab, 0xe8f6, 0xbea8, 0xe8f7, 0xe8f4, 0xc076, 0xecbd, 0xc077, 0xecbb, 0xecbc, 0xecba, 0xecb9, 0xecbe, 0xc075, 0xefb8, 0xefb9, 0xe4e8, 0xefb7, 0xc078, 0xc35f, 0xf1eb, 0xf1ec, 0xc4d7, 0xc4d8, 0xf5c1, 0xf5c0, 0xc56c, 0xc56b, 0xf7d0, 0xa449, 0xa461, 0xa4b9, 0xa4b8, 0xa553, 0xa552, 0xa5fc, 0xa5fb, 0xa5fd, 0xa5fa, 0xa74a, 0xa749, 0xa74b, 0xa8e0, 0xa8df, 0xa8e1, 0xab5e, 0xa259, 0xd0de, 0xa25a, 0xb0c2, 0xa25c, 0xa25b, 0xd860, 0xa25d, 0xb9b8, 0xa25e, 0xa44a, 0xa4ba, 0xa5fe, 0xa8e2, 0xa44b, 0xa4bd, 0xa4bb, 0xa4bc, 0xa640, 0xa74c, 0xa8e4, 0xa8e3, 0xa8e5, 0xaddd, 0xbeac, 0xc94e, 0xa554, 0xa555, 0xa641, 0xca6a, 0xab60, 0xab5f, 0xd0e0, 0xd0df, 0xb0c3, 0xa4be, 0xc955, 0xcbcd, 0xab61, 0xade0, 0xadde, 0xaddf, 0xbead, 0xa556, 0xa642, 0xc9bc, 0xa74d, 0xa74e, 0xca6b, 0xcbce, 0xa8e6, 0xcbcf, 0xd0e2, 0xd0e3, 0xade3, 0xd0e4, 0xd0e1, 0xade4, 0xade2, 0xade1, 0xd0e5, 0xd468, 0xd861, 0xdcc5, 0xe140, 0xbbfe, 0xbeae, 0xe8f9, 0xa44c, 0xa45a, 0xb0c4, 0xb3cd, 0xb9b9, 0xc942, 0xa4bf, 0xa559, 0xa557, 0xa558, 0xa8e7, 0xa44d, 0xa44e, 0xa462, 0xa4c0, 0xa4c1, 0xa4c2, 0xc9be, 0xa55a, 0xc96b, 0xa646, 0xc9bf, 0xa644, 0xa645, 0xc9bd, 0xa647, 0xa643, 0xca6c, 0xaaec, 0xca6d, 0xca6e, 0xa750, 0xa74f, 0xa753, 0xa751, 0xa752, 0xa8ed, 0xa8ec, 0xcbd4, 0xcbd1, 0xcbd2, 0xcbd0, 0xa8ee, 0xa8ea, 0xa8e9, 0xa8eb, 0xa8e8, 0xa8ef, 0xab63, 0xcdf0, 0xcbd3, 0xab68, 0xcdf1, 0xab64, 0xab67, 0xab66, 0xab65, 0xab62, 0xd0e8, 0xade7, 0xd0eb, 0xade5, 0xd0e7, 0xade8, 0xade6, 0xade9, 0xd0e9, 0xd0ea, 0xd0e6, 0xd0ec, 0xb3d1, 0xb0c5, 0xd469, 0xd46b, 0xd46a, 0xd46c, 0xb0c6, 0xb3ce, 0xb3cf, 0xb3d0, 0xb6d0, 0xdcc7, 0xdcc6, 0xdcc8, 0xdcc9, 0xb6d1, 0xb6cf, 0xe141, 0xe142, 0xb9bb, 0xb9ba, 0xe35a, 0xbc40, 0xbc41, 0xbc42, 0xbc44, 0xe4f2, 0xe4f3, 0xbc43, 0xbeaf, 0xbeb0, 0xf1ed, 0xf5c3, 0xf5c2, 0xf7d1, 0xa44f, 0xa55c, 0xa55b, 0xa648, 0xc9c0, 0xa755, 0xa756, 0xa754, 0xa757, 0xca6f, 0xca70, 0xa8f1, 0xcbd5, 0xa8f0, 0xcdf2, 0xab6c, 0xcdf3, 0xab6b, 0xab69, 0xab6a, 0xd0ed, 0xb0c7, 0xd46e, 0xb0ca, 0xd46d, 0xb1e5, 0xb0c9, 0xb0c8, 0xb3d4, 0xb3d3, 0xb3d2, 0xb6d2, 0xb6d5, 0xb6d6, 0xb6d4, 0xb6d3, 0xe143, 0xe144, 0xe4f5, 0xbc45, 0xe4f4, 0xbeb1, 0xecbf, 0xc079, 0xf1ee, 0xc455, 0xa463, 0xa4c3, 0xc956, 0xa4c4, 0xa4c5, 0xa55d, 0xa55e, 0xa649, 0xca71, 0xcbd6, 0xcbd7, 0xab6d, 0xd0ee, 0xb0cc, 0xb0cb, 0xd863, 0xd862, 0xa450, 0xa4c6, 0xa55f, 0xb0cd, 0xc943, 0xc96c, 0xa560, 0xc9c2, 0xa64b, 0xa64a, 0xc9c1, 0xa758, 0xadea, 0xd46f, 0xb6d7, 0xe145, 0xb9bc, 0xe8fa, 0xf3fd, 0xa4c7, 0xcbd8, 0xcdf4, 0xb0d0, 0xb0ce, 0xb0cf, 0xa451, 0xa464, 0xa2cd, 0xa4ca, 0xa4c9, 0xa4c8, 0xa563, 0xa562, 0xc96d, 0xc9c3, 0xa8f5, 0xa8f2, 0xa8f4, 0xa8f3, 0xab6e, 0xb3d5, 0xa452, 0xa4cb, 0xa565, 0xa564, 0xca72, 0xa8f6, 0xc957, 0xa567, 0xa566, 0xa64c, 0xa64d, 0xca73, 0xa759, 0xa75a, 0xa8f7, 0xa8f8, 0xa8f9, 0xab6f, 0xcdf5, 0xadeb, 0xc944, 0xa4cc, 0xc9c4, 0xca74, 0xca75, 0xcbd9, 0xcbda, 0xcdf7, 0xcdf6, 0xcdf9, 0xcdf8, 0xab70, 0xd470, 0xaded, 0xd0ef, 0xadec, 0xd864, 0xb3d6, 0xd865, 0xe146, 0xb9bd, 0xbc46, 0xf1ef, 0xc958, 0xa568, 0xb0d1, 0xa453, 0xa465, 0xa4ce, 0xa4cd, 0xa4cf, 0xa8fb, 0xa8fa, 0xa8fc, 0xab71, 0xadee, 0xe8fb, 0xc24f, 0xa466, 0xa56a, 0xa579, 0xa574, 0xa56f, 0xa56e, 0xa575, 0xa573, 0xa56c, 0xa57a, 0xa56d, 0xa569, 0xa578, 0xa577, 0xa576, 0xa56b, 0xa572, 0xa571, 0xa57b, 0xa570, 0xa653, 0xa659, 0xa655, 0xa65b, 0xc9c5, 0xa658, 0xa64e, 0xa651, 0xa654, 0xa650, 0xa657, 0xa65a, 0xa64f, 0xa652, 0xa656, 0xa65c, 0xca7e, 0xca7b, 0xa767, 0xca7c, 0xa75b, 0xa75d, 0xa775, 0xa770, 0xcaa5, 0xca7d, 0xa75f, 0xa761, 0xcaa4, 0xa768, 0xca78, 0xa774, 0xa776, 0xa75c, 0xa76d, 0xca76, 0xa773, 0xa764, 0xa76e, 0xa76f, 0xca77, 0xa76c, 0xa76a, 0xa76b, 0xa771, 0xcaa1, 0xa75e, 0xa772, 0xcaa3, 0xa766, 0xa763, 0xca7a, 0xa762, 0xcaa6, 0xa765, 0xa769, 0xa760, 0xcaa2, 0xca79, 0xcbeb, 0xcbea, 0xa94f, 0xcbed, 0xcbef, 0xcbe4, 0xcbe7, 0xcbee, 0xa950, 0xcbe1, 0xcbe5, 0xcbe9, 0xce49, 0xa94b, 0xce4d, 0xa8fd, 0xcbe6, 0xa8fe, 0xa94c, 0xa945, 0xa941, 0xcbe2, 0xa944, 0xa949, 0xa952, 0xcbe3, 0xcbdc, 0xa943, 0xcbdd, 0xcbdf, 0xa946, 0xa948, 0xcbdb, 0xcbe0, 0xa951, 0xa94d, 0xcbe8, 0xa953, 0xa94a, 0xcbde, 0xa947, 0xa942, 0xa940, 0xcbec, 0xa94e, 0xce48, 0xcdfb, 0xce4b, 0xcdfd, 0xab78, 0xaba8, 0xab74, 0xaba7, 0xab7d, 0xaba4, 0xab72, 0xcdfc, 0xce43, 0xaba3, 0xce4f, 0xaba5, 0xab79, 0xce45, 0xce42, 0xab77, 0xcdfa, 0xaba6, 0xce4a, 0xab7c, 0xce4c, 0xaba9, 0xab73, 0xab7e, 0xab7b, 0xce40, 0xaba1, 0xce46, 0xce47, 0xab7a, 0xaba2, 0xab76, 0xab75, 0xcdfe, 0xce44, 0xce4e, 0xd144, 0xadfb, 0xd0f1, 0xd0f6, 0xadf4, 0xae40, 0xd0f4, 0xadef, 0xadf9, 0xadfe, 0xd0fb, 0xadfa, 0xadfd, 0xd0fe, 0xadf5, 0xd0f5, 0xd142, 0xd143, 0xadf7, 0xd141, 0xadf3, 0xae43, 0xd0f8, 0xadf1, 0xd146, 0xd0f9, 0xd0fd, 0xadf6, 0xae42, 0xd0fa, 0xadfc, 0xd140, 0xd147, 0xd4a1, 0xd145, 0xae44, 0xadf0, 0xd0fc, 0xd0f3, 0xadf8, 0xd0f2, 0xd0f7, 0xd0f0, 0xae41, 0xd477, 0xb0e4, 0xd4a7, 0xb0e2, 0xb0df, 0xd47c, 0xb0db, 0xd4a2, 0xb0e6, 0xd476, 0xd47b, 0xd47a, 0xadf2, 0xb0e1, 0xd4a5, 0xd4a8, 0xd473, 0xb3e8, 0xd4a9, 0xb0e7, 0xb0d9, 0xb0d6, 0xd47e, 0xb0d3, 0xd4a6, 0xb0da, 0xd4aa, 0xd474, 0xd4a4, 0xb0dd, 0xd475, 0xd478, 0xd47d, 0xb0de, 0xb0dc, 0xb0e8, 0xb0e3, 0xb0d7, 0xb1d2, 0xb0d8, 0xd479, 0xb0e5, 0xb0e0, 0xd4a3, 0xb0d5, 0xb0d4, 0xd471, 0xd472, 0xd86a, 0xb3d7, 0xb3da, 0xd875, 0xb3ee, 0xd878, 0xb3d8, 0xd871, 0xb3de, 0xb3e4, 0xb5bd, 0xb3e2, 0xd86e, 0xb3ef, 0xb3db, 0xb3e3, 0xd876, 0xdcd7, 0xd87b, 0xd86f, 0xd866, 0xd873, 0xd86d, 0xb3e1, 0xd879, 0xb3dd, 0xb3f1, 0xb3ea, 0xb3df, 0xb3dc, 0xb3e7, 0xd87a, 0xd86c, 0xd872, 0xd874, 0xd868, 0xd877, 0xb3d9, 0xd867, 0xb3e0, 0xb3f0, 0xb3ec, 0xd869, 0xb3e6, 0xb3ed, 0xb3e9, 0xb3e5, 0xd870, 0xb3eb, 0xdcd5, 0xdcd1, 0xdce0, 0xdcca, 0xdcd3, 0xb6e5, 0xb6e6, 0xb6de, 0xdcdc, 0xb6e8, 0xdccf, 0xdcce, 0xdccc, 0xdcde, 0xb6dc, 0xdcd8, 0xdccd, 0xb6df, 0xdcd6, 0xb6da, 0xdcd2, 0xdcd9, 0xdcdb, 0xdcdf, 0xb6e3, 0xdccb, 0xb6dd, 0xdcd0, 0xb6d8, 0xb6e4, 0xdcda, 0xb6e0, 0xb6e1, 0xb6e7, 0xb6db, 0xa25f, 0xb6d9, 0xdcd4, 0xb6e2, 0xdcdd, 0xb9cd, 0xb9c8, 0xe155, 0xe151, 0xe14b, 0xb9c2, 0xb9be, 0xe154, 0xb9bf, 0xe14e, 0xe150, 0xe153, 0xb9c4, 0xb9cb, 0xb9c5, 0xe149, 0xb9c6, 0xb9c7, 0xe14c, 0xb9cc, 0xe14a, 0xe14f, 0xb9c3, 0xe148, 0xb9c9, 0xb9c1, 0xb9c0, 0xe14d, 0xe152, 0xb9ca, 0xe147, 0xbc4d, 0xe547, 0xe544, 0xbc47, 0xbc53, 0xbc54, 0xbc4a, 0xe542, 0xbc4c, 0xe4f9, 0xbc52, 0xe546, 0xbc49, 0xe548, 0xbc48, 0xe543, 0xe545, 0xbc4b, 0xe541, 0xe4fa, 0xe4f7, 0xd86b, 0xe4fd, 0xe4f6, 0xe4fc, 0xe4fb, 0xe4f8, 0xbc4f, 0xbc4e, 0xbc50, 0xe4fe, 0xbeb2, 0xe540, 0xe945, 0xe8fd, 0xbebe, 0xe942, 0xbeb6, 0xbeba, 0xe941, 0xbeb9, 0xbeb5, 0xbeb8, 0xbeb3, 0xbebd, 0xe943, 0xe8fe, 0xbebc, 0xe8fc, 0xbebb, 0xe944, 0xe940, 0xbc51, 0xbebf, 0xe946, 0xbeb7, 0xbeb4, 0xecc6, 0xecc8, 0xc07b, 0xecc9, 0xecc7, 0xecc5, 0xecc4, 0xc07d, 0xecc3, 0xc07e, 0xecc1, 0xecc2, 0xc07a, 0xc0a1, 0xc07c, 0xecc0, 0xc250, 0xefbc, 0xefba, 0xefbf, 0xefbd, 0xefbb, 0xefbe, 0xc360, 0xf1f2, 0xf1f3, 0xc456, 0xf1f4, 0xf1f0, 0xf1f5, 0xf1f1, 0xc251, 0xf3fe, 0xf441, 0xc459, 0xf440, 0xc458, 0xc457, 0xc45a, 0xf5c5, 0xf5c6, 0xc4da, 0xc4d9, 0xc4db, 0xf5c4, 0xf6d8, 0xf6d7, 0xc56d, 0xc56f, 0xc56e, 0xf6d9, 0xc5c8, 0xf8a6, 0xc5f1, 0xf8a5, 0xf8ee, 0xc949, 0xa57d, 0xa57c, 0xa65f, 0xa65e, 0xc9c7, 0xa65d, 0xc9c6, 0xa779, 0xcaa9, 0xcaa8, 0xa777, 0xa77a, 0xcaa7, 0xa778, 0xcbf0, 0xcbf1, 0xa954, 0xabaa, 0xd148, 0xd149, 0xae45, 0xae46, 0xd4ac, 0xb0e9, 0xb0eb, 0xd4ab, 0xb0ea, 0xd87c, 0xb3f2, 0xb6e9, 0xb6ea, 0xdce1, 0xb9cf, 0xb9ce, 0xe549, 0xe948, 0xe947, 0xf96b, 0xa467, 0xc959, 0xc96e, 0xc96f, 0xa662, 0xa666, 0xc9c9, 0xa664, 0xa663, 0xc9c8, 0xa665, 0xa661, 0xa660, 0xc9ca, 0xa7a6, 0xa7a3, 0xa77d, 0xcaaa, 0xcaab, 0xa7a1, 0xcaad, 0xa77b, 0xcaae, 0xcaac, 0xa77e, 0xa7a2, 0xa7a5, 0xa7a4, 0xa77c, 0xcaaf, 0xa959, 0xcbfe, 0xa95b, 0xa95a, 0xcc40, 0xa958, 0xa957, 0xcbf5, 0xcbf4, 0xcbf2, 0xcbf7, 0xcbf6, 0xcbf3, 0xcbfc, 0xcbfd, 0xcbfa, 0xcbf8, 0xa956, 0xcbfb, 0xa95c, 0xcc41, 0xcbf9, 0xabab, 0xa955, 0xabac, 0xce54, 0xce5a, 0xabb2, 0xce58, 0xce5e, 0xce55, 0xce59, 0xce5b, 0xce5d, 0xce57, 0xce56, 0xce51, 0xce52, 0xabad, 0xabaf, 0xabae, 0xce53, 0xce5c, 0xabb1, 0xce50, 0xd153, 0xd152, 0xd157, 0xd14e, 0xd151, 0xd150, 0xd154, 0xd158, 0xae47, 0xae4a, 0xd14f, 0xd155, 0xae49, 0xd14a, 0xabb0, 0xd4ba, 0xd156, 0xd14d, 0xae48, 0xd14c, 0xd4b1, 0xb0ec, 0xb0f0, 0xd4c1, 0xd4af, 0xd4bd, 0xb0f1, 0xd4bf, 0xd4c5, 0xd4c9, 0xd4c0, 0xd4b4, 0xd4bc, 0xd4ca, 0xd4c8, 0xd4be, 0xd4b9, 0xd4b2, 0xd8a6, 0xd4b0, 0xb0f5, 0xd4b7, 0xb0f6, 0xb0f2, 0xd4ad, 0xd4c3, 0xd4b5, 0xd4b3, 0xd4c6, 0xb0f3, 0xd4cc, 0xb0ed, 0xb0ef, 0xd4bb, 0xd4b6, 0xae4b, 0xb0ee, 0xd4b8, 0xd4c7, 0xd4cb, 0xd4c2, 0xd4c4, 0xd4ae, 0xd8a1, 0xd8aa, 0xd8a9, 0xb3fa, 0xd8a2, 0xb3fb, 0xb3f9, 0xd8a4, 0xb3f6, 0xd8a8, 0xd8a3, 0xd8a5, 0xd87d, 0xb3f4, 0xd8b2, 0xd8b1, 0xd8ae, 0xb3f3, 0xb3f7, 0xb3f8, 0xd14b, 0xd8ab, 0xb3f5, 0xb0f4, 0xd8ad, 0xd87e, 0xd8b0, 0xd8af, 0xd8b3, 0xdcef, 0xd8ac, 0xd8a7, 0xdce7, 0xb6f4, 0xb6f7, 0xb6f2, 0xdce6, 0xdcea, 0xdce5, 0xb6ec, 0xb6f6, 0xdce2, 0xb6f0, 0xdce9, 0xb6ee, 0xb6ed, 0xdcec, 0xb6ef, 0xdcee, 0xdceb, 0xb6eb, 0xb6f5, 0xdcf0, 0xdce4, 0xdced, 0xdce3, 0xb6f1, 0xb6f3, 0xdce8, 0xdcf1, 0xe15d, 0xb9d0, 0xe163, 0xb9d5, 0xe15f, 0xe166, 0xe157, 0xb9d7, 0xb9d1, 0xe15c, 0xbc55, 0xe15b, 0xe164, 0xb9d2, 0xb9d6, 0xe15a, 0xe160, 0xe165, 0xe156, 0xb9d4, 0xe15e, 0xe162, 0xe168, 0xe158, 0xe161, 0xb9d3, 0xe167, 0xe159, 0xbc59, 0xe54b, 0xbc57, 0xbc56, 0xe54d, 0xe552, 0xe54e, 0xe551, 0xbc5c, 0xbea5, 0xbc5b, 0xe54a, 0xe550, 0xbc5a, 0xe54f, 0xe54c, 0xbc58, 0xe94d, 0xe94f, 0xe94a, 0xbec1, 0xe94c, 0xbec0, 0xe94e, 0xbec3, 0xe950, 0xbec2, 0xe949, 0xe94b, 0xc0a5, 0xeccc, 0xc0a4, 0xeccd, 0xc0a3, 0xeccb, 0xc0a2, 0xecca, 0xc253, 0xc252, 0xf1f6, 0xf1f8, 0xf1f7, 0xc361, 0xc362, 0xc363, 0xf442, 0xc45b, 0xf7d3, 0xf7d2, 0xc5f2, 0xa468, 0xa4d0, 0xa7a7, 0xce5f, 0xb3fc, 0xb3fd, 0xdcf2, 0xb9d8, 0xe169, 0xe553, 0xc95a, 0xcab0, 0xcc42, 0xce60, 0xd159, 0xae4c, 0xf1f9, 0xc4dc, 0xa469, 0xa57e, 0xc970, 0xa667, 0xa668, 0xa95d, 0xb0f7, 0xb9da, 0xb9db, 0xb9d9, 0xa46a, 0xa4d1, 0xa4d3, 0xa4d2, 0xc95b, 0xa4d4, 0xa5a1, 0xc971, 0xa5a2, 0xa669, 0xa66a, 0xc9cb, 0xa7a8, 0xcab1, 0xa961, 0xcc43, 0xa95f, 0xa960, 0xa95e, 0xd15a, 0xabb6, 0xabb5, 0xabb7, 0xabb4, 0xce61, 0xa962, 0xabb3, 0xae4d, 0xae4e, 0xae4f, 0xd4cd, 0xb3fe, 0xd8b4, 0xb0f8, 0xb6f8, 0xb9dd, 0xb9dc, 0xe16a, 0xbc5d, 0xbec4, 0xefc0, 0xf6da, 0xf7d4, 0xa46b, 0xa5a3, 0xa5a4, 0xc9d1, 0xa66c, 0xa66f, 0xc9cf, 0xc9cd, 0xa66e, 0xc9d0, 0xc9d2, 0xc9cc, 0xa671, 0xa670, 0xa66d, 0xa66b, 0xc9ce, 0xa7b3, 0xa7b0, 0xcab6, 0xcab9, 0xcab8, 0xa7aa, 0xa7b2, 0xa7af, 0xcab5, 0xcab3, 0xa7ae, 0xa7a9, 0xa7ac, 0xcab4, 0xcabb, 0xcab7, 0xa7ad, 0xa7b1, 0xa7b4, 0xcab2, 0xcaba, 0xa7ab, 0xa967, 0xa96f, 0xcc4f, 0xcc48, 0xa970, 0xcc53, 0xcc44, 0xcc4b, 0xa966, 0xcc45, 0xa964, 0xcc4c, 0xcc50, 0xa963, 0xcc51, 0xcc4a, 0xcc4d, 0xa972, 0xa969, 0xcc54, 0xcc52, 0xa96e, 0xa96c, 0xcc49, 0xa96b, 0xcc47, 0xcc46, 0xa96a, 0xa968, 0xa971, 0xa96d, 0xa965, 0xcc4e, 0xabb9, 0xabc0, 0xce6f, 0xabb8, 0xce67, 0xce63, 0xce73, 0xce62, 0xabbb, 0xce6c, 0xabbe, 0xabc1, 0xabbc, 0xce70, 0xabbf, 0xae56, 0xce76, 0xce64, 0xce66, 0xce6d, 0xce71, 0xce75, 0xce72, 0xce6b, 0xce6e, 0xce68, 0xabc3, 0xce6a, 0xce69, 0xce74, 0xabba, 0xce65, 0xabc2, 0xabbd, 0xae5c, 0xd162, 0xae5b, 0xd160, 0xae50, 0xae55, 0xd15f, 0xd15c, 0xd161, 0xae51, 0xd15b, 0xae54, 0xae52, 0xd163, 0xae53, 0xae57, 0xae58, 0xae5a, 0xae59, 0xd15d, 0xd15e, 0xd164, 0xd4d4, 0xb0f9, 0xd8c2, 0xd4d3, 0xd4e6, 0xb140, 0xd4e4, 0xb0fe, 0xb0fa, 0xd4ed, 0xd4dd, 0xd4e0, 0xb143, 0xd4ea, 0xd4e2, 0xb0fb, 0xb144, 0xd4e7, 0xd4e5, 0xd4d6, 0xd4eb, 0xd4df, 0xd4da, 0xd4d0, 0xd4ec, 0xd4dc, 0xd4cf, 0xb142, 0xd4e1, 0xd4ee, 0xd4de, 0xd4d2, 0xd4d7, 0xd4ce, 0xb141, 0xd4db, 0xd4d8, 0xb0fc, 0xd4d1, 0xd4e9, 0xb0fd, 0xd4d9, 0xd4d5, 0xd4e8, 0xb440, 0xd8bb, 0xd8b8, 0xd8c9, 0xd8bd, 0xd8ca, 0xb442, 0xd8c6, 0xd8c3, 0xd8c4, 0xd8c7, 0xd8cb, 0xd4e3, 0xd8cd, 0xdd47, 0xb443, 0xd8ce, 0xd8b6, 0xd8c0, 0xd8c5, 0xb441, 0xb444, 0xd8cc, 0xd8cf, 0xd8ba, 0xd8b7, 0xd8b9, 0xd8be, 0xd8bc, 0xb445, 0xd8c8, 0xd8bf, 0xd8c1, 0xd8b5, 0xdcfa, 0xdcf8, 0xb742, 0xb740, 0xdd43, 0xdcf9, 0xdd44, 0xdd40, 0xdcf7, 0xdd46, 0xdcf6, 0xdcfd, 0xb6fe, 0xb6fd, 0xb6fc, 0xdcfb, 0xdd41, 0xb6f9, 0xb741, 0xdcf4, 0xdcfe, 0xdcf3, 0xdcfc, 0xb6fa, 0xdd42, 0xdcf5, 0xb6fb, 0xdd45, 0xe16e, 0xb9e2, 0xb9e1, 0xb9e3, 0xe17a, 0xe170, 0xe176, 0xe16b, 0xe179, 0xe178, 0xe17c, 0xe175, 0xb9de, 0xe174, 0xb9e4, 0xe16d, 0xb9df, 0xe17b, 0xb9e0, 0xe16f, 0xe172, 0xe177, 0xe171, 0xe16c, 0xe173, 0xe555, 0xbc61, 0xe558, 0xe557, 0xe55a, 0xe55c, 0xbc5f, 0xe556, 0xe554, 0xe55d, 0xe55b, 0xe559, 0xe55f, 0xe55e, 0xbc63, 0xbc5e, 0xbc60, 0xbc62, 0xe560, 0xe957, 0xe956, 0xe955, 0xe958, 0xe951, 0xe952, 0xe95a, 0xe953, 0xbec5, 0xe95c, 0xe95b, 0xe954, 0xecd1, 0xc0a8, 0xeccf, 0xecd4, 0xecd3, 0xe959, 0xc0a7, 0xecd2, 0xecce, 0xecd6, 0xecd5, 0xc0a6, 0xecd0, 0xbec6, 0xc254, 0xefc1, 0xf1fa, 0xf1fb, 0xf1fc, 0xc45c, 0xc45d, 0xf443, 0xf5c8, 0xf5c7, 0xf6db, 0xf6dc, 0xf7d5, 0xf8a7, 0xa46c, 0xa46d, 0xa46e, 0xa4d5, 0xa5a5, 0xc9d3, 0xa672, 0xa673, 0xa7b7, 0xa7b8, 0xa7b6, 0xa7b5, 0xa973, 0xcc55, 0xa975, 0xa974, 0xcc56, 0xabc4, 0xae5d, 0xd165, 0xd4f0, 0xb145, 0xb447, 0xd4ef, 0xb446, 0xb9e5, 0xe17d, 0xbec7, 0xc0a9, 0xecd7, 0xc45e, 0xc570, 0xc972, 0xa5a6, 0xc973, 0xa676, 0xa674, 0xa675, 0xa677, 0xa7ba, 0xa7b9, 0xcabc, 0xa7bb, 0xcabd, 0xcc57, 0xcc58, 0xa976, 0xa978, 0xa97a, 0xa977, 0xa97b, 0xa979, 0xabc8, 0xabc5, 0xabc7, 0xabc9, 0xabc6, 0xd166, 0xce77, 0xd168, 0xd167, 0xae63, 0xae5f, 0xae60, 0xae62, 0xae64, 0xae61, 0xae66, 0xae65, 0xb14a, 0xd4f2, 0xd4f1, 0xb149, 0xb148, 0xb147, 0xb14b, 0xb146, 0xd8d5, 0xd8d2, 0xb449, 0xd8d1, 0xd8d6, 0xb44b, 0xd8d4, 0xb448, 0xb44a, 0xd8d3, 0xdd48, 0xdd49, 0xdd4a, 0xb9e6, 0xb9ee, 0xe17e, 0xb9e8, 0xb9ec, 0xe1a1, 0xb9ed, 0xb9e9, 0xb9ea, 0xb9e7, 0xb9eb, 0xbc66, 0xd8d0, 0xbc67, 0xbc65, 0xbc64, 0xe95d, 0xbec8, 0xecd8, 0xecd9, 0xc364, 0xc45f, 0xa46f, 0xa678, 0xabca, 0xd169, 0xae67, 0xb14e, 0xb14d, 0xb14c, 0xb44c, 0xb44d, 0xd8d7, 0xb9ef, 0xbec9, 0xa470, 0xc95c, 0xa4d6, 0xc974, 0xc9d4, 0xa679, 0xa97c, 0xdd4b, 0xa471, 0xa4d7, 0xc9d5, 0xcabe, 0xcabf, 0xa7bc, 0xd8d8, 0xb44e, 0xdd4c, 0xc0aa, 0xa472, 0xa4a8, 0xa4d8, 0xc975, 0xa5a7, 0xa7c0, 0xa7bf, 0xa7bd, 0xa7be, 0xcc59, 0xa97e, 0xa9a1, 0xcc5a, 0xa97d, 0xabce, 0xce78, 0xabcd, 0xabcb, 0xabcc, 0xae6a, 0xae68, 0xd16b, 0xae69, 0xd16a, 0xae5e, 0xd4f3, 0xb150, 0xb151, 0xb14f, 0xb9f0, 0xe1a2, 0xbc68, 0xbc69, 0xe561, 0xc0ab, 0xefc2, 0xefc3, 0xc4dd, 0xf8a8, 0xc94b, 0xa4d9, 0xa473, 0xc977, 0xc976, 0xa67a, 0xc9d7, 0xc9d8, 0xc9d6, 0xc9d9, 0xcac7, 0xcac2, 0xcac4, 0xcac6, 0xcac3, 0xa7c4, 0xcac0, 0xcac1, 0xa7c1, 0xa7c2, 0xcac5, 0xcac8, 0xa7c3, 0xcac9, 0xcc68, 0xcc62, 0xcc5d, 0xa9a3, 0xcc65, 0xcc63, 0xcc5c, 0xcc69, 0xcc6c, 0xcc67, 0xcc60, 0xa9a5, 0xcc66, 0xa9a6, 0xcc61, 0xcc64, 0xcc5b, 0xcc5f, 0xcc6b, 0xa9a7, 0xa9a8, 0xcc5e, 0xcc6a, 0xa9a2, 0xa9a4, 0xceab, 0xcea4, 0xceaa, 0xcea3, 0xcea5, 0xce7d, 0xce7b, 0xceac, 0xcea9, 0xce79, 0xabd0, 0xcea7, 0xcea8, 0xcea6, 0xce7c, 0xce7a, 0xabcf, 0xcea2, 0xce7e, 0xcea1, 0xcead, 0xae6f, 0xae6e, 0xd16c, 0xae6b, 0xd16e, 0xae70, 0xd16f, 0xae73, 0xae71, 0xd170, 0xceae, 0xd172, 0xae6d, 0xae6c, 0xd16d, 0xd171, 0xae72, 0xb153, 0xb152, 0xd4f5, 0xd4f9, 0xd4fb, 0xb154, 0xd4fe, 0xb158, 0xd541, 0xb15a, 0xb156, 0xb15e, 0xb15b, 0xd4f7, 0xb155, 0xd4f6, 0xd4f4, 0xd543, 0xd4f8, 0xb157, 0xd542, 0xb15c, 0xd4fd, 0xd4fc, 0xb15d, 0xd4fa, 0xb159, 0xd544, 0xd540, 0xd8e7, 0xd8ee, 0xd8e3, 0xb451, 0xd8df, 0xd8ef, 0xd8d9, 0xd8ec, 0xd8ea, 0xd8e4, 0xd8ed, 0xd8e6, 0xd8de, 0xd8f0, 0xd8dc, 0xd8e9, 0xd8da, 0xd8f1, 0xb452, 0xd8eb, 0xdd4f, 0xd8dd, 0xb44f, 0xd8e1, 0xb450, 0xd8e0, 0xd8e5, 0xd8e2, 0xd8e8, 0xdd53, 0xdd56, 0xdd4e, 0xdd50, 0xdd55, 0xdd54, 0xb743, 0xd8db, 0xdd52, 0xb744, 0xdd4d, 0xdd51, 0xe1a9, 0xe1b0, 0xe1a7, 0xe1ae, 0xe1a5, 0xe1ad, 0xe1b1, 0xe1a4, 0xe1a8, 0xe1a3, 0xb9f1, 0xe1a6, 0xb9f2, 0xe1ac, 0xe1ab, 0xe1aa, 0xe1af, 0xe565, 0xe567, 0xbc6b, 0xe568, 0xe563, 0xe562, 0xe56c, 0xe56a, 0xbc6a, 0xe56d, 0xe564, 0xe569, 0xe56b, 0xe566, 0xe961, 0xe966, 0xe960, 0xe965, 0xe95e, 0xe968, 0xe964, 0xe969, 0xe963, 0xe95f, 0xe967, 0xe96a, 0xe962, 0xecda, 0xc0af, 0xc0ad, 0xc0ac, 0xc0ae, 0xefc4, 0xf172, 0xf1fd, 0xf444, 0xf445, 0xc460, 0xf5c9, 0xc4de, 0xf5ca, 0xf6de, 0xc572, 0xc571, 0xf6dd, 0xc5c9, 0xf7d6, 0xa474, 0xa67b, 0xc9da, 0xcaca, 0xa8b5, 0xb15f, 0xa475, 0xa5aa, 0xa5a9, 0xa5a8, 0xa7c5, 0xae74, 0xdd57, 0xa476, 0xa477, 0xa478, 0xa4da, 0xabd1, 0xceaf, 0xb453, 0xa479, 0xc95d, 0xa5ab, 0xa5ac, 0xc978, 0xa67c, 0xcacb, 0xa7c6, 0xcacc, 0xa9ae, 0xcc6e, 0xa9ac, 0xa9ab, 0xcc6d, 0xa9a9, 0xcc6f, 0xa9aa, 0xa9ad, 0xabd2, 0xabd4, 0xceb3, 0xceb0, 0xceb1, 0xceb2, 0xceb4, 0xabd3, 0xd174, 0xd173, 0xae76, 0xae75, 0xb162, 0xd546, 0xb161, 0xb163, 0xb160, 0xb455, 0xd545, 0xb456, 0xd8f3, 0xb457, 0xd8f2, 0xb454, 0xdd5a, 0xdd5c, 0xb745, 0xdd5b, 0xdd59, 0xdd58, 0xe1b4, 0xb9f7, 0xb9f5, 0xb9f6, 0xe1b2, 0xe1b3, 0xb9f3, 0xe571, 0xe56f, 0xbc6d, 0xe570, 0xbc6e, 0xbc6c, 0xb9f4, 0xe96d, 0xe96b, 0xe96c, 0xe56e, 0xecdc, 0xc0b0, 0xecdb, 0xefc5, 0xefc6, 0xe96e, 0xf1fe, 0xa47a, 0xa5ad, 0xa67e, 0xc9db, 0xa67d, 0xa9af, 0xb746, 0xa4db, 0xa5ae, 0xabd5, 0xb458, 0xc979, 0xc97a, 0xc9dc, 0xa7c8, 0xcad0, 0xcace, 0xa7c9, 0xcacd, 0xcacf, 0xcad1, 0xa7c7, 0xa9b3, 0xa9b4, 0xa9b1, 0xa9b0, 0xceb8, 0xa9b2, 0xabd6, 0xceb7, 0xceb9, 0xceb6, 0xceba, 0xabd7, 0xae79, 0xd175, 0xd177, 0xae77, 0xd178, 0xae78, 0xd176, 0xceb5, 0xd547, 0xd54a, 0xd54b, 0xd548, 0xb167, 0xb166, 0xb164, 0xb165, 0xd549, 0xb168, 0xb45a, 0xb45b, 0xb45c, 0xdd5d, 0xdd5f, 0xdd61, 0xb748, 0xb747, 0xb459, 0xdd60, 0xdd5e, 0xe1b8, 0xe1b6, 0xe1bc, 0xb9f8, 0xe1bd, 0xe1ba, 0xb9f9, 0xe1b7, 0xe1b5, 0xe1bb, 0xbc70, 0xe573, 0xe1b9, 0xbc72, 0xe574, 0xbc71, 0xbc74, 0xe575, 0xbc6f, 0xbc73, 0xe973, 0xe971, 0xe970, 0xe972, 0xe96f, 0xc366, 0xf446, 0xf447, 0xf5cb, 0xf6df, 0xc655, 0xa9b5, 0xa7ca, 0xabd8, 0xa47b, 0xa4dc, 0xa5af, 0xc9dd, 0xa7cb, 0xcad2, 0xcebb, 0xabd9, 0xb9fa, 0xa47c, 0xa6a1, 0xb749, 0xa47d, 0xa4dd, 0xa4de, 0xa5b1, 0xa5b0, 0xc9de, 0xa6a2, 0xcad3, 0xa7cc, 0xcc71, 0xcc72, 0xcc73, 0xa9b6, 0xa9b7, 0xcc70, 0xa9b8, 0xabda, 0xcebc, 0xd17a, 0xae7a, 0xd179, 0xb169, 0xd54c, 0xb16a, 0xd54d, 0xb45d, 0xdd62, 0xe1bf, 0xe1be, 0xb9fb, 0xbc75, 0xe576, 0xbeca, 0xe974, 0xc0b1, 0xc573, 0xf7d8, 0xcc74, 0xcebd, 0xb16b, 0xd8f4, 0xb74a, 0xc255, 0xa7ce, 0xa7cd, 0xabdb, 0xd17b, 0xb16d, 0xb343, 0xb16e, 0xb16c, 0xb45e, 0xe1c0, 0xb9fc, 0xbc76, 0xc94c, 0xc9df, 0xcad5, 0xa7cf, 0xcad4, 0xa7d0, 0xa9bc, 0xcc77, 0xcc76, 0xa9bb, 0xa9b9, 0xa9ba, 0xcc75, 0xabdd, 0xcebe, 0xabe0, 0xabdc, 0xabe2, 0xabde, 0xabdf, 0xabe1, 0xae7d, 0xae7c, 0xae7b, 0xd54f, 0xb16f, 0xb172, 0xb170, 0xd54e, 0xb175, 0xb171, 0xd550, 0xb174, 0xb173, 0xd8f6, 0xd8f5, 0xb461, 0xb45f, 0xb460, 0xd8f7, 0xb74b, 0xdd64, 0xb74c, 0xdd63, 0xe577, 0xbc78, 0xe1c1, 0xbc77, 0xb9fd, 0xecde, 0xe975, 0xc0b2, 0xecdd, 0xf240, 0xf448, 0xf449, 0xa4df, 0xa5b2, 0xc97b, 0xa7d2, 0xa7d4, 0xc9e2, 0xcad8, 0xcad7, 0xcad6, 0xc9e1, 0xc9e0, 0xa6a4, 0xa7d3, 0xa7d1, 0xa6a3, 0xa9bd, 0xcc78, 0xa9be, 0xcadd, 0xcadf, 0xcade, 0xcc79, 0xcada, 0xa7d8, 0xa7d6, 0xcad9, 0xcadb, 0xcae1, 0xa7d5, 0xcadc, 0xcae5, 0xa9c0, 0xcae2, 0xa7d7, 0xcae0, 0xcae3, 0xa9bf, 0xa9c1, 0xcae4, 0xccaf, 0xcca2, 0xcc7e, 0xccae, 0xcca9, 0xabe7, 0xa9c2, 0xccaa, 0xccad, 0xabe3, 0xccac, 0xa9c3, 0xa9c8, 0xa9c6, 0xcca3, 0xcc7c, 0xcca5, 0xa9cd, 0xccb0, 0xabe4, 0xcca6, 0xabe5, 0xa9c9, 0xcca8, 0xcecd, 0xabe6, 0xcc7b, 0xa9ca, 0xabe8, 0xa9cb, 0xa9c7, 0xa9cc, 0xcca7, 0xcc7a, 0xccab, 0xa9c4, 0xcc7d, 0xcca4, 0xcca1, 0xa9c5, 0xcebf, 0xcec0, 0xceca, 0xd1a1, 0xcecb, 0xabee, 0xcece, 0xcec4, 0xabed, 0xcec6, 0xcec7, 0xcec9, 0xabe9, 0xaea3, 0xcec5, 0xcec1, 0xaea4, 0xcecf, 0xae7e, 0xd17d, 0xcec8, 0xd17c, 0xcec3, 0xcecc, 0xabec, 0xaea1, 0xabf2, 0xaea2, 0xced0, 0xd17e, 0xabeb, 0xaea6, 0xabf1, 0xabf0, 0xabef, 0xaea5, 0xced1, 0xaea7, 0xabea, 0xcec2, 0xb176, 0xd1a4, 0xd1a6, 0xd1a8, 0xaea8, 0xaeae, 0xd553, 0xd1ac, 0xd1a3, 0xb178, 0xd551, 0xaead, 0xaeab, 0xd1ae, 0xd552, 0xd1a5, 0xaeac, 0xd1a9, 0xaeaf, 0xd1ab, 0xaeaa, 0xd1aa, 0xd1ad, 0xd1a7, 0xaea9, 0xb179, 0xd1a2, 0xb177, 0xb17a, 0xd555, 0xd55e, 0xb464, 0xb17c, 0xb1a3, 0xb465, 0xd560, 0xb1aa, 0xd8f9, 0xd556, 0xb1a2, 0xb1a5, 0xb17e, 0xd554, 0xd562, 0xd565, 0xd949, 0xd563, 0xd8fd, 0xb1a1, 0xb1a8, 0xb1ac, 0xd55d, 0xd8f8, 0xd561, 0xb17b, 0xd8fa, 0xd564, 0xd8fc, 0xd559, 0xb462, 0xd557, 0xd558, 0xb1a7, 0xb1a6, 0xd55b, 0xb1ab, 0xd55f, 0xb1a4, 0xd55c, 0xb1a9, 0xb466, 0xb463, 0xd8fb, 0xd55a, 0xb17d, 0xb46b, 0xb46f, 0xd940, 0xb751, 0xb46d, 0xd944, 0xb471, 0xdd65, 0xd946, 0xb753, 0xb469, 0xb46c, 0xd947, 0xd948, 0xd94e, 0xb473, 0xb754, 0xd94a, 0xd94f, 0xd943, 0xb75e, 0xb755, 0xb472, 0xd941, 0xd950, 0xb75d, 0xb470, 0xb74e, 0xd94d, 0xb474, 0xd945, 0xd8fe, 0xb46a, 0xd942, 0xd94b, 0xb74d, 0xb752, 0xb467, 0xd94c, 0xb750, 0xb468, 0xb75c, 0xe1c3, 0xdd70, 0xdd68, 0xe1c2, 0xdd6c, 0xdd6e, 0xdd6b, 0xb75b, 0xdd6a, 0xb75f, 0xe1d2, 0xb75a, 0xba40, 0xdd71, 0xe1c4, 0xb758, 0xdd69, 0xdd6d, 0xb9fe, 0xb74f, 0xdd66, 0xdd67, 0xba41, 0xb757, 0xb759, 0xb756, 0xdd6f, 0xe1c8, 0xe1c9, 0xe1ce, 0xbc7d, 0xe1d5, 0xba47, 0xba46, 0xe1d0, 0xbc7c, 0xe1c5, 0xba45, 0xe1d4, 0xba43, 0xba44, 0xe1d1, 0xe5aa, 0xbc7a, 0xb46e, 0xe1d3, 0xbca3, 0xe1cb, 0xbc7b, 0xbca2, 0xe1c6, 0xe1ca, 0xe1c7, 0xe1cd, 0xba48, 0xbc79, 0xba42, 0xe57a, 0xe1cf, 0xbca1, 0xbca4, 0xe1cc, 0xbc7e, 0xe579, 0xe57e, 0xbece, 0xe578, 0xe9a3, 0xe5a9, 0xbca8, 0xbca6, 0xbecc, 0xe5a6, 0xe5a2, 0xbcac, 0xe978, 0xbcaa, 0xe5a1, 0xe976, 0xe5a5, 0xe5a8, 0xe57d, 0xbcab, 0xbca5, 0xe977, 0xbecd, 0xe5a7, 0xbca7, 0xbca9, 0xe5a4, 0xbcad, 0xe5a3, 0xe57c, 0xe57b, 0xbecb, 0xe5ab, 0xe97a, 0xece0, 0xbed0, 0xe9a2, 0xe97e, 0xece1, 0xbed1, 0xe9a1, 0xe97c, 0xc0b4, 0xecdf, 0xe979, 0xe97b, 0xc0b5, 0xbed3, 0xc0b3, 0xbed2, 0xc0b7, 0xe97d, 0xbecf, 0xefcf, 0xefc7, 0xece7, 0xefc8, 0xece3, 0xc256, 0xece5, 0xece4, 0xc0b6, 0xece2, 0xece6, 0xefd0, 0xefcc, 0xefce, 0xefc9, 0xefca, 0xefcd, 0xefcb, 0xc367, 0xc36a, 0xc369, 0xc368, 0xc461, 0xf44a, 0xc462, 0xf241, 0xc4df, 0xf5cc, 0xc4e0, 0xc574, 0xc5ca, 0xf7d9, 0xf7da, 0xf7db, 0xf9ba, 0xa4e0, 0xc97c, 0xa5b3, 0xa6a6, 0xa6a7, 0xa6a5, 0xa6a8, 0xa7da, 0xa7d9, 0xccb1, 0xa9cf, 0xa9ce, 0xd1af, 0xb1ad, 0xb1ae, 0xb475, 0xdd72, 0xb760, 0xb761, 0xdd74, 0xdd76, 0xdd75, 0xe1d7, 0xe1d6, 0xba49, 0xe1d8, 0xe5ac, 0xbcae, 0xbed4, 0xc0b8, 0xc257, 0xc0b9, 0xa4e1, 0xcae6, 0xccb2, 0xa9d1, 0xa9d0, 0xa9d2, 0xabf3, 0xced2, 0xced3, 0xd1b0, 0xaeb0, 0xb1af, 0xb476, 0xd951, 0xa4e2, 0xa47e, 0xa4e3, 0xc97d, 0xa5b7, 0xa5b6, 0xa5b4, 0xa5b5, 0xa6ab, 0xc9e9, 0xc9eb, 0xa6aa, 0xc9e3, 0xc9e4, 0xc9ea, 0xc9e6, 0xc9e8, 0xa6a9, 0xc9e5, 0xc9ec, 0xc9e7, 0xa7e1, 0xa7ea, 0xa7e8, 0xcaf0, 0xcaed, 0xcaf5, 0xa7e6, 0xcaf6, 0xa7df, 0xcaf3, 0xa7e5, 0xcaef, 0xcaee, 0xa7e3, 0xcaf4, 0xa7e4, 0xa9d3, 0xa7de, 0xcaf1, 0xcae7, 0xa7db, 0xa7ee, 0xcaec, 0xcaf2, 0xa7e0, 0xa7e2, 0xcae8, 0xcae9, 0xcaea, 0xa7ed, 0xa7e7, 0xa7ec, 0xcaeb, 0xa7eb, 0xa7dd, 0xa7dc, 0xa7e9, 0xa9e1, 0xccbe, 0xccb7, 0xa9dc, 0xa9ef, 0xccb3, 0xccba, 0xccbc, 0xccbf, 0xa9ea, 0xccbb, 0xccb4, 0xa9e8, 0xccb8, 0xccc0, 0xa9d9, 0xccbd, 0xa9e3, 0xa9e2, 0xccb6, 0xa9d7, 0xa9d8, 0xa9d6, 0xa9ee, 0xa9e6, 0xa9e0, 0xa9d4, 0xccb9, 0xa9df, 0xa9d5, 0xa9e7, 0xa9f0, 0xced4, 0xa9e4, 0xccb5, 0xa9da, 0xa9dd, 0xa9de, 0xa9ec, 0xa9ed, 0xa9eb, 0xa9e5, 0xa9e9, 0xa9db, 0xabf4, 0xceda, 0xac41, 0xabf8, 0xabfa, 0xac40, 0xcee6, 0xabfd, 0xd1b1, 0xaeb1, 0xac43, 0xced7, 0xcedf, 0xabfe, 0xcede, 0xcedb, 0xcee3, 0xcee5, 0xabf7, 0xabfb, 0xac42, 0xaeb3, 0xcee0, 0xabf9, 0xac45, 0xced9, 0xabfc, 0xaeb2, 0xabf6, 0xced6, 0xcedd, 0xced5, 0xced8, 0xcedc, 0xd1b2, 0xac44, 0xcee1, 0xcee2, 0xcee4, 0xabf5, 0xaec1, 0xd1be, 0xaebf, 0xaec0, 0xd1b4, 0xd1c4, 0xaeb6, 0xd566, 0xd1c6, 0xd1c0, 0xd1b7, 0xd1c9, 0xd1ba, 0xaebc, 0xd57d, 0xd1bd, 0xaebe, 0xaeb5, 0xd1cb, 0xd1bf, 0xaeb8, 0xd1b8, 0xd1b5, 0xd1b6, 0xaeb9, 0xd1c5, 0xd1cc, 0xaebb, 0xd1bc, 0xd1bb, 0xaec3, 0xaec2, 0xaeb4, 0xaeba, 0xaebd, 0xd1c8, 0xd1c2, 0xaeb7, 0xd1b3, 0xd1ca, 0xd1c1, 0xd1c3, 0xd1c7, 0xd567, 0xb1b7, 0xb1cb, 0xb1ca, 0xb1bf, 0xd579, 0xd575, 0xd572, 0xd5a6, 0xb1ba, 0xb1b2, 0xd577, 0xb4a8, 0xb1b6, 0xd5a1, 0xb1cc, 0xb1c9, 0xd57b, 0xd56a, 0xb1c8, 0xd5a3, 0xd569, 0xb1bd, 0xb1c1, 0xd5a2, 0xd573, 0xb1c2, 0xb1bc, 0xd568, 0xb478, 0xd5a5, 0xd571, 0xb1c7, 0xd574, 0xd5a4, 0xb1c6, 0xd952, 0xb1b3, 0xd56f, 0xb1b8, 0xb1c3, 0xb1be, 0xd578, 0xd56e, 0xd56c, 0xd57e, 0xb1b0, 0xb1c4, 0xb1b4, 0xb477, 0xd57c, 0xb1b5, 0xb1b1, 0xb1c0, 0xb1bb, 0xb1b9, 0xd570, 0xb1c5, 0xd56d, 0xd57a, 0xd576, 0xd954, 0xd953, 0xd56b, 0xd964, 0xb47a, 0xd96a, 0xd959, 0xd967, 0xdd77, 0xb47d, 0xd96b, 0xd96e, 0xb47c, 0xd95c, 0xd96d, 0xd96c, 0xb47e, 0xd955, 0xb479, 0xb4a3, 0xb4a1, 0xd969, 0xd95f, 0xb4a5, 0xd970, 0xd968, 0xd971, 0xb4ad, 0xb4ab, 0xd966, 0xd965, 0xd963, 0xd95d, 0xb4a4, 0xb4a2, 0xd1b9, 0xd956, 0xddb7, 0xd957, 0xb47b, 0xb4aa, 0xdd79, 0xb4a6, 0xb4a7, 0xd958, 0xd96f, 0xdd78, 0xd960, 0xd95b, 0xb4a9, 0xd961, 0xd95e, 0xb4ae, 0xb770, 0xdd7c, 0xddb1, 0xddb6, 0xddaa, 0xb76c, 0xddbb, 0xb769, 0xdd7a, 0xdd7b, 0xb762, 0xb76b, 0xdda4, 0xb76e, 0xb76f, 0xdda5, 0xddb2, 0xddb8, 0xb76a, 0xb764, 0xdda3, 0xdd7d, 0xddba, 0xdda8, 0xdda9, 0xdd7e, 0xddb4, 0xddab, 0xddb5, 0xddad, 0xb765, 0xe1d9, 0xb768, 0xb766, 0xddb9, 0xddb0, 0xddac, 0xdda1, 0xba53, 0xddaf, 0xb76d, 0xdda7, 0xdda6, 0xb767, 0xb763, 0xe1ee, 0xddb3, 0xddae, 0xdda2, 0xe1e9, 0xe1da, 0xe1e5, 0xe1ec, 0xba51, 0xb4ac, 0xe1ea, 0xba4c, 0xba4b, 0xe1f1, 0xe1db, 0xe1e8, 0xe1dc, 0xe1e7, 0xba4f, 0xe1eb, 0xd962, 0xe1f2, 0xe1e3, 0xba52, 0xe5ba, 0xbcaf, 0xe1f0, 0xe1ef, 0xba54, 0xe5ad, 0xbcb0, 0xe5ae, 0xe1df, 0xe1e0, 0xe1dd, 0xe1e2, 0xe1de, 0xe1f3, 0xba4e, 0xbcb1, 0xba50, 0xba55, 0xe1e1, 0xe1ed, 0xe1e6, 0xe5b1, 0xba4a, 0xbcb4, 0xe9aa, 0xe5b6, 0xe5b5, 0xe5b7, 0xe5b4, 0xbcb5, 0xbcbb, 0xbcb8, 0xbcb9, 0xe5af, 0xe5b2, 0xe5bc, 0xbcc1, 0xbcbf, 0xe5b3, 0xd95a, 0xbcb2, 0xe5b9, 0xe5b0, 0xbcc2, 0xe5b8, 0xba4d, 0xbcb7, 0xe1e4, 0xbcba, 0xbcbe, 0xbcc0, 0xbcbd, 0xbcbc, 0xbcb6, 0xe5bb, 0xbcb3, 0xbcc3, 0xbed8, 0xbed9, 0xe9a9, 0xbee2, 0xbedf, 0xbed6, 0xbedd, 0xe9ab, 0xbedb, 0xbed5, 0xbedc, 0xe9a8, 0xc0bb, 0xbed7, 0xbede, 0xc0ba, 0xe9a7, 0xe9a6, 0xbee0, 0xbee1, 0xe9a5, 0xe9a4, 0xc0bc, 0xe9ae, 0xbeda, 0xe9ac, 0xc0bd, 0xc0c2, 0xecea, 0xecec, 0xc0bf, 0xeced, 0xece9, 0xeceb, 0xc0c0, 0xc0c3, 0xece8, 0xc0be, 0xc0c1, 0xc259, 0xe9ad, 0xc258, 0xc25e, 0xefd4, 0xc25c, 0xc25d, 0xefd7, 0xefd3, 0xc25a, 0xefd1, 0xc36b, 0xefd5, 0xefd6, 0xefd2, 0xc25b, 0xf242, 0xf245, 0xf246, 0xf244, 0xf247, 0xc36c, 0xf243, 0xf44e, 0xc464, 0xf44d, 0xf44c, 0xf44b, 0xc463, 0xc465, 0xf5cd, 0xc4e2, 0xc4e1, 0xf6e1, 0xf6e0, 0xf6e3, 0xc5cb, 0xc575, 0xf7dd, 0xf6e2, 0xf7dc, 0xc5cd, 0xc5cc, 0xc5f3, 0xf8a9, 0xf8ef, 0xa4e4, 0xd972, 0xe9af, 0xa6ac, 0xcaf7, 0xa7f1, 0xa7ef, 0xa7f0, 0xccc1, 0xa9f1, 0xac46, 0xcee7, 0xcee8, 0xac47, 0xd1ce, 0xaec4, 0xaec5, 0xd1cd, 0xb1d3, 0xb1cf, 0xd5a7, 0xb1d6, 0xb1d5, 0xb1ce, 0xb1d1, 0xb1d4, 0xb1d0, 0xd976, 0xb1cd, 0xb4af, 0xb4b1, 0xb4b2, 0xd975, 0xd978, 0xb4b0, 0xd973, 0xd977, 0xd974, 0xb771, 0xddbc, 0xba56, 0xe1f4, 0xbee3, 0xbcc4, 0xe5bd, 0xbcc5, 0xbcc6, 0xe5bf, 0xe5be, 0xe5c0, 0xe9b1, 0xe9b0, 0xecef, 0xecee, 0xc0c4, 0xc0c5, 0xf248, 0xa4e5, 0xd979, 0xb4b4, 0xb4b3, 0xddbd, 0xefd8, 0xc4e3, 0xf7de, 0xa4e6, 0xaec6, 0xb1d8, 0xb1d7, 0xd97a, 0xd97b, 0xb772, 0xe1f5, 0xba57, 0xe9b2, 0xa4e7, 0xa5b8, 0xa9f2, 0xccc2, 0xcee9, 0xac48, 0xb1d9, 0xd97c, 0xb4b5, 0xb773, 0xe5c1, 0xe5c2, 0xecf0, 0xc25f, 0xf8f0, 0xa4e8, 0xccc3, 0xa9f3, 0xac49, 0xceea, 0xaec7, 0xd1d2, 0xd1d0, 0xd1d1, 0xaec8, 0xd1cf, 0xb1db, 0xb1dc, 0xd5a8, 0xb1dd, 0xb1da, 0xd97d, 0xd97e, 0xddbe, 0xba59, 0xba58, 0xecf1, 0xefd9, 0xf24a, 0xf249, 0xf44f, 0xc95e, 0xac4a, 0xa4e9, 0xa5b9, 0xa6ae, 0xa6ad, 0xa6af, 0xa6b0, 0xc9ee, 0xc9ed, 0xcaf8, 0xa7f2, 0xcafb, 0xcafa, 0xcaf9, 0xcafc, 0xa9f4, 0xccc9, 0xccc5, 0xccce, 0xa9fb, 0xa9f9, 0xccca, 0xccc6, 0xcccd, 0xa9f8, 0xaa40, 0xccc8, 0xccc4, 0xa9fe, 0xcccb, 0xa9f7, 0xcccc, 0xa9fa, 0xa9fc, 0xccd0, 0xcccf, 0xccc7, 0xa9f6, 0xa9f5, 0xa9fd, 0xceef, 0xcef5, 0xac50, 0xac4d, 0xceec, 0xcef1, 0xac53, 0xac4b, 0xcef0, 0xac4e, 0xac51, 0xcef3, 0xac4c, 0xcef8, 0xac4f, 0xac52, 0xceed, 0xcef2, 0xcef6, 0xceee, 0xceeb, 0xcef7, 0xcef4, 0xaed0, 0xaec9, 0xaecc, 0xaecf, 0xd1d5, 0xaeca, 0xd1d3, 0xaece, 0xaecb, 0xd1d6, 0xaecd, 0xd5ac, 0xb1df, 0xd5ab, 0xd5ad, 0xb1de, 0xb1e3, 0xd1d4, 0xd5aa, 0xd5ae, 0xb1e0, 0xd5a9, 0xb1e2, 0xb1e1, 0xd9a7, 0xd9a2, 0xb4b6, 0xb4ba, 0xb4b7, 0xd9a5, 0xd9a8, 0xb4b8, 0xb4b9, 0xb4be, 0xddc7, 0xd9a6, 0xb4bc, 0xd9a3, 0xd9a1, 0xb4bd, 0xd9a4, 0xb779, 0xddbf, 0xb776, 0xb777, 0xb775, 0xddc4, 0xddc3, 0xddc0, 0xb77b, 0xddc2, 0xb4bb, 0xddc6, 0xddc1, 0xb778, 0xb774, 0xb77a, 0xddc5, 0xba5c, 0xe1f8, 0xe1f7, 0xe1f6, 0xba5a, 0xba5b, 0xe5c5, 0xe5c8, 0xbcc8, 0xbcc7, 0xe5c9, 0xe5c4, 0xbcca, 0xe5c6, 0xbcc9, 0xe5c3, 0xe5c7, 0xbee9, 0xbee6, 0xe9bb, 0xe9ba, 0xe9b9, 0xe9b4, 0xe9b5, 0xbee7, 0xbee4, 0xbee8, 0xe9b3, 0xbee5, 0xe9b6, 0xe9b7, 0xe9bc, 0xe9b8, 0xecf2, 0xc0c7, 0xefdc, 0xc0c6, 0xefda, 0xefdb, 0xc260, 0xc36e, 0xf24b, 0xc36d, 0xf451, 0xf452, 0xc466, 0xf450, 0xc4e4, 0xf7df, 0xc5ce, 0xf8aa, 0xf8ab, 0xa4ea, 0xa6b1, 0xa6b2, 0xa7f3, 0xccd1, 0xac54, 0xaed1, 0xb1e4, 0xb0d2, 0xb4bf, 0xb4c0, 0xb3cc, 0xd9a9, 0xb77c, 0xe1fa, 0xe1f9, 0xa4eb, 0xa6b3, 0xccd2, 0xaa42, 0xaa41, 0xcef9, 0xcefa, 0xd1d7, 0xd1d8, 0xaed2, 0xaed3, 0xaed4, 0xd5af, 0xb1e6, 0xb4c2, 0xb4c1, 0xddc8, 0xdf7a, 0xe1fb, 0xe9bd, 0xc261, 0xc467, 0xa4ec, 0xa5bc, 0xa5bd, 0xa5bb, 0xa5be, 0xa5ba, 0xa6b6, 0xc9f6, 0xa6b5, 0xa6b7, 0xc9f1, 0xc9f0, 0xc9f3, 0xc9f2, 0xc9f5, 0xa6b4, 0xc9ef, 0xc9f4, 0xcafd, 0xa7fd, 0xcafe, 0xcb43, 0xa7fc, 0xcb47, 0xcb42, 0xcb45, 0xa7f5, 0xa7f6, 0xa7f7, 0xa7f8, 0xa840, 0xcb41, 0xa7fa, 0xa841, 0xcb40, 0xcb46, 0xa7f9, 0xcb44, 0xa7fb, 0xa7f4, 0xa7fe, 0xaa57, 0xccd4, 0xaa43, 0xaa4d, 0xaa4e, 0xaa46, 0xaa58, 0xaa48, 0xccdc, 0xaa53, 0xccd7, 0xaa49, 0xcce6, 0xcce7, 0xccdf, 0xccd8, 0xaa56, 0xcce4, 0xaa51, 0xaa4f, 0xcce5, 0xcce3, 0xccdb, 0xccd3, 0xccda, 0xaa4a, 0xaa50, 0xaa44, 0xccde, 0xccdd, 0xccd5, 0xaa52, 0xcce1, 0xccd6, 0xaa55, 0xcce8, 0xaa45, 0xaa4c, 0xccd9, 0xcce2, 0xaa54, 0xaa47, 0xaa4b, 0xcce0, 0xcf5b, 0xac5c, 0xac69, 0xcf56, 0xcf4c, 0xac62, 0xcf4a, 0xac5b, 0xcf45, 0xac65, 0xcf52, 0xcefe, 0xcf41, 0xcf44, 0xcefb, 0xcf51, 0xcf61, 0xac60, 0xcf46, 0xcf58, 0xcefd, 0xcf5f, 0xcf60, 0xcf63, 0xcf5a, 0xcf4b, 0xcf53, 0xac66, 0xac59, 0xac61, 0xac6d, 0xac56, 0xac58, 0xcf43, 0xac6a, 0xac63, 0xcf5d, 0xcf40, 0xac6c, 0xac67, 0xcf49, 0xac6b, 0xcf50, 0xcf48, 0xac64, 0xcf5c, 0xcf54, 0xac5e, 0xcf62, 0xcf47, 0xac5a, 0xcf59, 0xcf4f, 0xac5f, 0xcf55, 0xac57, 0xcefc, 0xac68, 0xaee3, 0xac5d, 0xcf4e, 0xcf4d, 0xcf42, 0xcf5e, 0xcf57, 0xac55, 0xd1ec, 0xaeea, 0xd1ed, 0xd1e1, 0xaedf, 0xaeeb, 0xd1da, 0xd1e3, 0xd1eb, 0xd1d9, 0xd1f4, 0xaed5, 0xd1f3, 0xd1ee, 0xd1ef, 0xaedd, 0xaee8, 0xd1e5, 0xd1e6, 0xd1f0, 0xd1e7, 0xd1e2, 0xd1dc, 0xd1dd, 0xd1ea, 0xd1e4, 0xaed6, 0xaeda, 0xd1f2, 0xd1de, 0xaee6, 0xaee2, 0xaee5, 0xaeec, 0xaedb, 0xaee7, 0xd1e9, 0xaee9, 0xaed8, 0xaed7, 0xd1db, 0xd1df, 0xaee0, 0xd1f1, 0xd1e8, 0xd1e0, 0xaee4, 0xaee1, 0xaed9, 0xaedc, 0xd5c4, 0xd5b4, 0xd5b5, 0xd5b9, 0xd5c8, 0xd5c5, 0xd5be, 0xd5bd, 0xb1ed, 0xd5c1, 0xd5d0, 0xd5b0, 0xd5d1, 0xd5c3, 0xd5d5, 0xd5c9, 0xb1ec, 0xd5c7, 0xb1e7, 0xb1fc, 0xb1f2, 0xb1f6, 0xb1f5, 0xd5b1, 0xd5ce, 0xd5d4, 0xd5cc, 0xd5d3, 0xd5c0, 0xd5b2, 0xd5d2, 0xd5c2, 0xb1ea, 0xb1f7, 0xd5cb, 0xb1f0, 0xd5ca, 0xd5b3, 0xb1f8, 0xb1fa, 0xd5cd, 0xb1fb, 0xb1e9, 0xd5ba, 0xd5cf, 0xb1ef, 0xb1f9, 0xd5bc, 0xd5c6, 0xd5b7, 0xd5bb, 0xb1f4, 0xd5b6, 0xb1e8, 0xb1f1, 0xb1ee, 0xd5bf, 0xaede, 0xd9c0, 0xb1eb, 0xb1f3, 0xd9c3, 0xd9d9, 0xd9ce, 0xb4d6, 0xb4d1, 0xd9bd, 0xb4d2, 0xd9cd, 0xd9c6, 0xd9d3, 0xb4ce, 0xd9ab, 0xd9d5, 0xb4c4, 0xd9b3, 0xb4c7, 0xb4c6, 0xb4d7, 0xd9ad, 0xd9cf, 0xd9d0, 0xb4c9, 0xb4c5, 0xd9bb, 0xb4d0, 0xd9b6, 0xd9d1, 0xb4cc, 0xd9c9, 0xd9d6, 0xd9b0, 0xd9b5, 0xd9af, 0xb4cb, 0xd9c2, 0xddde, 0xd9b1, 0xb4cf, 0xd9ba, 0xd9d2, 0xb4ca, 0xd9b7, 0xd9b4, 0xd9c5, 0xb4cd, 0xb4c3, 0xb4d9, 0xd9c8, 0xd9c7, 0xd9ac, 0xb4c8, 0xd9d4, 0xd9bc, 0xd9be, 0xd9cb, 0xd9ca, 0xd9aa, 0xb4d3, 0xb4d5, 0xd9b2, 0xd9b9, 0xd9c1, 0xb4d4, 0xd9b8, 0xd9c4, 0xd9d7, 0xd9cc, 0xd9d8, 0xd9ae, 0xddf2, 0xb7a6, 0xddf0, 0xdddb, 0xdde0, 0xddd9, 0xddec, 0xddcb, 0xddd2, 0xddea, 0xddf4, 0xdddc, 0xddcf, 0xdde2, 0xdde7, 0xddd3, 0xdde4, 0xddd0, 0xddd7, 0xddd8, 0xb7a8, 0xddeb, 0xdde9, 0xddcc, 0xddee, 0xddef, 0xddf1, 0xb7ac, 0xb7a4, 0xd5b8, 0xddd4, 0xdde6, 0xddd5, 0xb7a1, 0xb7b1, 0xdded, 0xb7af, 0xb7ab, 0xddca, 0xb7a3, 0xddcd, 0xb7b0, 0xdddd, 0xddc9, 0xb7a9, 0xdde1, 0xddd1, 0xb7aa, 0xddda, 0xb77e, 0xb4d8, 0xdde3, 0xd9bf, 0xddce, 0xdde8, 0xb7a5, 0xdde5, 0xb7a2, 0xdddf, 0xb7ad, 0xddd6, 0xddf3, 0xb7a7, 0xdec6, 0xb7ae, 0xe24a, 0xe248, 0xe25e, 0xe246, 0xe258, 0xb77d, 0xba5f, 0xe242, 0xe25d, 0xe247, 0xe255, 0xba64, 0xba5d, 0xe25b, 0xe240, 0xe25a, 0xba6f, 0xe251, 0xe261, 0xba6d, 0xe249, 0xba5e, 0xe24b, 0xe259, 0xba67, 0xe244, 0xba6b, 0xba61, 0xe24d, 0xe243, 0xe1fc, 0xe257, 0xba68, 0xe260, 0xe1fd, 0xba65, 0xe253, 0xba66, 0xe245, 0xe250, 0xe24c, 0xe24e, 0xba60, 0xe25f, 0xba6e, 0xe24f, 0xe262, 0xe1fe, 0xe254, 0xba63, 0xba6c, 0xba6a, 0xe241, 0xe256, 0xba69, 0xba62, 0xe252, 0xe25c, 0xe5d5, 0xe5d1, 0xe5cd, 0xe5e1, 0xe5de, 0xbccd, 0xe5e5, 0xe5d4, 0xbcd8, 0xe5db, 0xe5d0, 0xe5da, 0xbcd5, 0xe5ee, 0xe5eb, 0xe5dd, 0xe5ce, 0xe5e2, 0xe5e4, 0xbcd1, 0xe5d8, 0xe5d3, 0xe5ca, 0xbcce, 0xbcd6, 0xe5e7, 0xbcd7, 0xe5cb, 0xe5ed, 0xe5e0, 0xe5e6, 0xbcd4, 0xe5e3, 0xe5ea, 0xbcd9, 0xbcd3, 0xe5dc, 0xe5cf, 0xe5ef, 0xe5cc, 0xe5e8, 0xbcd0, 0xe5d6, 0xe5d7, 0xbccf, 0xbccc, 0xe5d2, 0xbcd2, 0xbccb, 0xe5e9, 0xe5ec, 0xe5d9, 0xe9ca, 0xe9c2, 0xe9be, 0xbef6, 0xbeeb, 0xbef0, 0xbeec, 0xe9cc, 0xe9d7, 0xbeea, 0xe9c4, 0xe9cd, 0xe5df, 0xe9ce, 0xbef1, 0xe9dd, 0xbef5, 0xbef8, 0xe9c0, 0xbef4, 0xe9db, 0xe9dc, 0xe9d2, 0xe9d1, 0xe9c9, 0xe9d3, 0xe9da, 0xe9d9, 0xbeef, 0xbeed, 0xe9cb, 0xe9c8, 0xe9c5, 0xe9d8, 0xbef7, 0xe9d6, 0xbef3, 0xbef2, 0xe9d0, 0xe9bf, 0xe9c1, 0xe9c3, 0xe9d5, 0xe9cf, 0xbeee, 0xe9c6, 0xe9d4, 0xe9c7, 0xc0cf, 0xed45, 0xc0c8, 0xecf5, 0xed41, 0xc0ca, 0xed48, 0xecfc, 0xecf7, 0xed49, 0xecf3, 0xecfe, 0xc0d1, 0xed44, 0xed4a, 0xecfd, 0xc0c9, 0xed40, 0xecf4, 0xc0d0, 0xed47, 0xecf9, 0xc0cc, 0xecfb, 0xecf8, 0xc0d2, 0xecfa, 0xc0cb, 0xc0ce, 0xed43, 0xecf6, 0xed46, 0xed42, 0xc263, 0xefe7, 0xc268, 0xc269, 0xc262, 0xefe6, 0xefe3, 0xefe4, 0xc266, 0xefde, 0xefe2, 0xc265, 0xefdf, 0xc267, 0xc264, 0xefdd, 0xefe1, 0xefe5, 0xf251, 0xf24e, 0xf257, 0xf256, 0xf254, 0xf24f, 0xc372, 0xf250, 0xc371, 0xc0cd, 0xf253, 0xc370, 0xf258, 0xf252, 0xf24d, 0xefe0, 0xc36f, 0xf24c, 0xf456, 0xf455, 0xf255, 0xc468, 0xf459, 0xf45a, 0xf454, 0xf458, 0xf453, 0xf5d1, 0xf457, 0xc4e7, 0xc4e5, 0xf5cf, 0xf5d2, 0xf5ce, 0xf5d0, 0xc4e6, 0xf6e5, 0xf6e6, 0xc576, 0xf6e4, 0xf7e2, 0xc5cf, 0xf7e0, 0xf7e1, 0xf8ac, 0xc656, 0xf8f3, 0xf8f1, 0xf8f2, 0xf8f4, 0xf9bb, 0xa4ed, 0xa6b8, 0xaa59, 0xcce9, 0xcf64, 0xd1f5, 0xd1f7, 0xd1f6, 0xd1f8, 0xb1fd, 0xd5d7, 0xd1f9, 0xd5d6, 0xd5d8, 0xd5d9, 0xd9da, 0xb4db, 0xd9db, 0xd9dd, 0xb4dc, 0xb4da, 0xd9dc, 0xddfa, 0xddf8, 0xddf7, 0xddf6, 0xddf5, 0xb7b2, 0xddf9, 0xba70, 0xe263, 0xe265, 0xba71, 0xe264, 0xbcdb, 0xbcda, 0xe5f0, 0xe9df, 0xe9de, 0xe9e0, 0xbef9, 0xed4b, 0xc0d3, 0xefe8, 0xc26a, 0xf259, 0xc577, 0xa4ee, 0xa5bf, 0xa6b9, 0xa842, 0xaa5a, 0xaa5b, 0xac6e, 0xd1fa, 0xb7b3, 0xe6d1, 0xbefa, 0xc26b, 0xa4ef, 0xa6ba, 0xcceb, 0xaa5c, 0xccea, 0xcf65, 0xac6f, 0xcf66, 0xac70, 0xd1fc, 0xaeee, 0xaeed, 0xd5de, 0xd5dc, 0xd5dd, 0xd5db, 0xd5da, 0xd9de, 0xd9e1, 0xb4de, 0xd9df, 0xb4dd, 0xd9e0, 0xddfb, 0xe266, 0xe267, 0xe268, 0xe5f3, 0xe5f2, 0xbcdc, 0xe5f1, 0xe5f4, 0xe9e1, 0xe9e2, 0xe9e3, 0xed4c, 0xc0d4, 0xc26c, 0xf25a, 0xc4e8, 0xc95f, 0xac71, 0xcf67, 0xaeef, 0xb1fe, 0xb4df, 0xd9e2, 0xb7b5, 0xb7b4, 0xe269, 0xe26a, 0xbcdd, 0xbcde, 0xe9e5, 0xe9e4, 0xefe9, 0xf7e3, 0xa4f0, 0xc960, 0xa5c0, 0xa843, 0xcb48, 0xac72, 0xb7b6, 0xa4f1, 0xcf68, 0xac73, 0xcf69, 0xc0d5, 0xa4f2, 0xccec, 0xcf6a, 0xd242, 0xd241, 0xd1fe, 0xd1fd, 0xd243, 0xd240, 0xb240, 0xb241, 0xb4e0, 0xd9e3, 0xd9e4, 0xd9e5, 0xde41, 0xde42, 0xde40, 0xddfd, 0xddfe, 0xb7b7, 0xe26b, 0xe5f7, 0xe5f6, 0xe5f5, 0xe5f8, 0xe9e7, 0xe9e6, 0xbefb, 0xe9e8, 0xc0d6, 0xed4d, 0xefea, 0xf25b, 0xf6e7, 0xa4f3, 0xa5c2, 0xa5c1, 0xaa5d, 0xc961, 0xc97e, 0xa6bb, 0xc9f7, 0xcb49, 0xcb4a, 0xaa5e, 0xcced, 0xac74, 0xcf6b, 0xcf6c, 0xaef0, 0xaef4, 0xd244, 0xaef3, 0xaef1, 0xaef2, 0xd5df, 0xb242, 0xb4e3, 0xb4e1, 0xb4e2, 0xd9e6, 0xba72, 0xa4f4, 0xc9a1, 0xa5c3, 0xc9a4, 0xa5c6, 0xc9a3, 0xa5c5, 0xa5c4, 0xa844, 0xc9a2, 0xc9f8, 0xc9fc, 0xc9fe, 0xca40, 0xa6c5, 0xa6c6, 0xc9fb, 0xa6c1, 0xc9f9, 0xc9fd, 0xa6c2, 0xa6bd, 0xa6be, 0xa6c4, 0xc9fa, 0xa6bc, 0xa845, 0xa6bf, 0xa6c0, 0xa6c3, 0xcb5b, 0xcb59, 0xcb4c, 0xa851, 0xcb53, 0xa84c, 0xcb4d, 0xcb55, 0xcb52, 0xa84f, 0xcb51, 0xa856, 0xcb5a, 0xa858, 0xa85a, 0xcb4b, 0xa84d, 0xcb5c, 0xa854, 0xa857, 0xcd45, 0xa847, 0xa85e, 0xa855, 0xcb4e, 0xa84a, 0xa859, 0xcb56, 0xa848, 0xa849, 0xcd43, 0xcb4f, 0xa850, 0xa85b, 0xcb5d, 0xcb50, 0xa84e, 0xa853, 0xccee, 0xa85c, 0xcb57, 0xa852, 0xa85d, 0xa846, 0xcb54, 0xa84b, 0xcb58, 0xcd44, 0xaa6a, 0xaa7a, 0xccf5, 0xaa71, 0xcd4b, 0xaa62, 0xaa65, 0xcd42, 0xccf3, 0xccf7, 0xaa6d, 0xaa6f, 0xccfa, 0xaa76, 0xaa68, 0xaa66, 0xaa67, 0xaa75, 0xcd47, 0xaa70, 0xccf9, 0xccfb, 0xaa6e, 0xaa73, 0xccfc, 0xcd4a, 0xac75, 0xaa79, 0xaa63, 0xcd49, 0xcd4d, 0xccf8, 0xcd4f, 0xcd40, 0xaa6c, 0xccf4, 0xaa6b, 0xaa7d, 0xaa72, 0xccf2, 0xcf75, 0xaa78, 0xaa7c, 0xcd41, 0xcd46, 0xaa7e, 0xaa77, 0xaa69, 0xaa5f, 0xaa64, 0xccf6, 0xaa60, 0xcd4e, 0xccf0, 0xccef, 0xccfd, 0xccf1, 0xaa7b, 0xaef5, 0xaa74, 0xccfe, 0xaa61, 0xaca6, 0xcd4c, 0xcf7c, 0xcfa1, 0xcfa4, 0xcf77, 0xcfa7, 0xcfaa, 0xcfac, 0xcf74, 0xac76, 0xac7b, 0xd249, 0xacad, 0xcfa5, 0xcfad, 0xcf7b, 0xcf73, 0xd264, 0xac7e, 0xcfa2, 0xcf78, 0xcf7a, 0xaca5, 0xcf7d, 0xac7d, 0xcf70, 0xcfa8, 0xcfab, 0xac7a, 0xaca8, 0xcf6d, 0xacaa, 0xac78, 0xacae, 0xcfa9, 0xcf6f, 0xacab, 0xd25e, 0xcd48, 0xac7c, 0xac77, 0xcf76, 0xcf6e, 0xacac, 0xaca4, 0xcfa3, 0xaca9, 0xaca7, 0xcf79, 0xaca1, 0xcf71, 0xaca2, 0xaca3, 0xcf72, 0xcfa6, 0xac79, 0xcf7e, 0xd24c, 0xaefd, 0xaf43, 0xd255, 0xd25b, 0xd257, 0xd24a, 0xd24d, 0xd246, 0xd247, 0xaf4a, 0xaefa, 0xd256, 0xd25f, 0xaf45, 0xaef6, 0xaf40, 0xd24e, 0xaf42, 0xd24f, 0xd259, 0xaf44, 0xd268, 0xd248, 0xaefc, 0xaefb, 0xaf48, 0xd245, 0xd266, 0xd25a, 0xd267, 0xd261, 0xd253, 0xd262, 0xd25c, 0xd265, 0xd263, 0xaf49, 0xd254, 0xaef9, 0xaef8, 0xaf41, 0xaf47, 0xd260, 0xaf46, 0xd251, 0xb243, 0xd269, 0xd250, 0xd24b, 0xaefe, 0xaf4b, 0xaef7, 0xd258, 0xd25d, 0xb265, 0xd5e1, 0xd5e5, 0xb252, 0xb250, 0xb247, 0xd5e3, 0xd5e2, 0xb25b, 0xd5e8, 0xb255, 0xd5fa, 0xd647, 0xb244, 0xd5f7, 0xd5f0, 0xb267, 0xd5e0, 0xd5fc, 0xb264, 0xb258, 0xb263, 0xb24e, 0xd5ec, 0xd5fe, 0xd5f6, 0xb24f, 0xb249, 0xd645, 0xd5fd, 0xd640, 0xb251, 0xb259, 0xd642, 0xd5ea, 0xd5fb, 0xd5ef, 0xd644, 0xb25e, 0xb246, 0xb25c, 0xd5f4, 0xd5f2, 0xd5f3, 0xb253, 0xd5ee, 0xd5ed, 0xb248, 0xd5e7, 0xd646, 0xb24a, 0xd5f1, 0xb268, 0xb262, 0xd5e6, 0xb25f, 0xb25d, 0xb266, 0xd5f8, 0xb261, 0xd252, 0xd5f9, 0xb260, 0xd641, 0xb245, 0xd5f5, 0xb257, 0xd5e9, 0xb256, 0xb254, 0xb24c, 0xb24b, 0xd9e7, 0xd643, 0xd5eb, 0xd9fc, 0xb24d, 0xb541, 0xb25a, 0xb4ee, 0xd9f6, 0xb4fc, 0xd9ea, 0xb4eb, 0xb4e7, 0xda49, 0xb4ed, 0xb4f1, 0xb4ec, 0xb4f5, 0xda4d, 0xda44, 0xd9f1, 0xb4fa, 0xb4f4, 0xd9fd, 0xb4e4, 0xda4a, 0xda43, 0xb4e8, 0xd9f7, 0xb4f7, 0xda55, 0xda56, 0xb4e5, 0xda48, 0xb4f9, 0xd9fb, 0xd9ed, 0xd9ee, 0xb4fd, 0xd9f2, 0xd9f9, 0xd9f3, 0xb4fb, 0xb544, 0xd9ef, 0xd9e8, 0xd9e9, 0xd9eb, 0xb4ea, 0xd9f8, 0xb4f8, 0xb542, 0xd9fa, 0xda53, 0xda4b, 0xb4e6, 0xda51, 0xb4f2, 0xb4f0, 0xda57, 0xb4ef, 0xda41, 0xd9f4, 0xd9fe, 0xb547, 0xda45, 0xda42, 0xd9f0, 0xb543, 0xda4f, 0xda4c, 0xda54, 0xb4e9, 0xda40, 0xb546, 0xda47, 0xb4f3, 0xb4f6, 0xda46, 0xb545, 0xd9f5, 0xd5e4, 0xda50, 0xda4e, 0xda52, 0xd9ec, 0xb540, 0xde61, 0xde60, 0xde46, 0xb7bd, 0xde5f, 0xde49, 0xde4a, 0xb7c7, 0xde68, 0xb7c2, 0xde5e, 0xde43, 0xb7c8, 0xb7be, 0xde52, 0xde48, 0xde4b, 0xde63, 0xb7b8, 0xde6a, 0xde62, 0xb7c1, 0xde57, 0xb7cc, 0xb7cb, 0xb7c5, 0xde69, 0xb7b9, 0xde55, 0xde4c, 0xde59, 0xde65, 0xb7cd, 0xb7bb, 0xde54, 0xde4d, 0xb7c4, 0xb7c3, 0xde50, 0xde5a, 0xde64, 0xde47, 0xde51, 0xb7bc, 0xde5b, 0xb7c9, 0xb7c0, 0xde4e, 0xb7bf, 0xde45, 0xde53, 0xde67, 0xb4fe, 0xbab0, 0xde56, 0xe26c, 0xde58, 0xde66, 0xb7c6, 0xde4f, 0xb7ba, 0xb7ca, 0xbcf0, 0xde44, 0xde5d, 0xde5c, 0xe2aa, 0xbaad, 0xe27d, 0xe2a4, 0xbaa2, 0xe26e, 0xbaaf, 0xba77, 0xe26d, 0xe2b0, 0xbab1, 0xe271, 0xe2a3, 0xe273, 0xe2b3, 0xe2af, 0xba75, 0xbaa1, 0xe653, 0xbaae, 0xba7d, 0xe26f, 0xe2ae, 0xbaa3, 0xe2ab, 0xe2b8, 0xe275, 0xe27e, 0xe2b6, 0xe2ac, 0xba7c, 0xe27c, 0xba76, 0xba74, 0xbaa8, 0xe27a, 0xe277, 0xe278, 0xe2b2, 0xe2b7, 0xe2b5, 0xba7a, 0xe2b9, 0xba7e, 0xbaa7, 0xe270, 0xe5fa, 0xe279, 0xba78, 0xbaac, 0xbaa9, 0xba7b, 0xe2a5, 0xe274, 0xbaaa, 0xe2a7, 0xbaa4, 0xbaa6, 0xba73, 0xe2a9, 0xe2a1, 0xe272, 0xbaa5, 0xe2b1, 0xe2b4, 0xe27b, 0xe2a8, 0xba79, 0xbcdf, 0xe2a6, 0xe5f9, 0xe2ad, 0xe276, 0xe644, 0xe64e, 0xbce2, 0xe64d, 0xe659, 0xbce4, 0xe64b, 0xe64f, 0xbcef, 0xe646, 0xbce7, 0xe652, 0xe9f0, 0xbcf3, 0xbcf2, 0xe654, 0xe643, 0xe65e, 0xbced, 0xbce3, 0xe657, 0xe65b, 0xe660, 0xe655, 0xe649, 0xbce6, 0xbce9, 0xbcf1, 0xbcec, 0xe64c, 0xe2a2, 0xe648, 0xe65f, 0xbce8, 0xbceb, 0xe661, 0xbce0, 0xe656, 0xe5fb, 0xe65c, 0xc0df, 0xe64a, 0xbce1, 0xe645, 0xbce5, 0xe5fc, 0xbaab, 0xe641, 0xe65a, 0xe642, 0xe640, 0xbcea, 0xe658, 0xe5fe, 0xe651, 0xe650, 0xe65d, 0xe647, 0xbcee, 0xe9f3, 0xbf49, 0xbefe, 0xea40, 0xe9eb, 0xbf41, 0xe9f7, 0xbf48, 0xbf43, 0xe9f5, 0xed4f, 0xe9fb, 0xea42, 0xe9fa, 0xe9e9, 0xe9f8, 0xea44, 0xea46, 0xbefd, 0xea45, 0xbf44, 0xbf4a, 0xbf47, 0xe9fe, 0xbf46, 0xe9f9, 0xe9ed, 0xe9f2, 0xe9fd, 0xbf45, 0xbf42, 0xbefc, 0xbf40, 0xe9f1, 0xe5fd, 0xe9ec, 0xe9ef, 0xea41, 0xe9f4, 0xe9ea, 0xed4e, 0xea43, 0xe9ee, 0xe9fc, 0xed51, 0xc0e3, 0xc0d7, 0xc0db, 0xed53, 0xed59, 0xed57, 0xc0d9, 0xc0da, 0xc0e1, 0xed5a, 0xed52, 0xc0dc, 0xed56, 0xed55, 0xed5b, 0xc0e2, 0xc0dd, 0xc0e0, 0xed54, 0xc0e4, 0xc0de, 0xc0e5, 0xc0d8, 0xed58, 0xed50, 0xeff7, 0xc271, 0xeff4, 0xeff6, 0xc26f, 0xeff2, 0xeff3, 0xefee, 0xe9f6, 0xefef, 0xc270, 0xefeb, 0xc26d, 0xeff8, 0xc26e, 0xefec, 0xefed, 0xeff1, 0xc273, 0xc272, 0xeff0, 0xc378, 0xf25f, 0xf265, 0xc379, 0xf25c, 0xc376, 0xc373, 0xf267, 0xc377, 0xc374, 0xf25e, 0xf261, 0xf262, 0xf263, 0xf266, 0xeff5, 0xf25d, 0xc375, 0xf264, 0xf268, 0xf260, 0xf45d, 0xc46a, 0xf460, 0xc46b, 0xf468, 0xf45f, 0xf45c, 0xf45e, 0xf462, 0xf465, 0xf464, 0xf467, 0xf45b, 0xc469, 0xf463, 0xf466, 0xf469, 0xf461, 0xf5d3, 0xf5d4, 0xf5d8, 0xf5d9, 0xf5d6, 0xf5d7, 0xf5d5, 0xc4e9, 0xc578, 0xf6eb, 0xf6e8, 0xf6e9, 0xf6ea, 0xc579, 0xf7e5, 0xf7e4, 0xf8af, 0xc5f4, 0xf8ad, 0xf8b0, 0xf8ae, 0xf8f5, 0xc657, 0xc665, 0xf9a3, 0xf96c, 0xf9a2, 0xf9d0, 0xf9d1, 0xa4f5, 0xa6c7, 0xca41, 0xcb5e, 0xa85f, 0xa862, 0xcb5f, 0xa860, 0xa861, 0xcd58, 0xcd5a, 0xcd55, 0xcd52, 0xcd54, 0xaaa4, 0xaaa2, 0xcd56, 0xaaa3, 0xcd53, 0xcd50, 0xaaa1, 0xcd57, 0xcd51, 0xaaa5, 0xcd59, 0xcfaf, 0xcfb3, 0xacb7, 0xcfb6, 0xacaf, 0xacb2, 0xacb4, 0xacb6, 0xacb3, 0xcfb2, 0xcfb1, 0xacb1, 0xcfb4, 0xcfb5, 0xcfae, 0xacb5, 0xacb0, 0xcfb0, 0xd277, 0xd278, 0xd279, 0xaf50, 0xaf4c, 0xd26e, 0xd276, 0xd27b, 0xaf51, 0xd26c, 0xd272, 0xd26b, 0xd275, 0xd271, 0xaf4d, 0xaf4f, 0xd27a, 0xd26a, 0xd26d, 0xd273, 0xd274, 0xd27c, 0xd270, 0xaf4e, 0xb26d, 0xd64e, 0xd650, 0xd64c, 0xd658, 0xd64a, 0xd657, 0xb269, 0xd648, 0xda5b, 0xd652, 0xb26c, 0xd653, 0xd656, 0xd65a, 0xd64f, 0xd654, 0xb26a, 0xb26b, 0xd659, 0xd64d, 0xd649, 0xd65b, 0xd651, 0xd655, 0xd64b, 0xb548, 0xb549, 0xda65, 0xb54f, 0xda59, 0xda62, 0xda58, 0xb54c, 0xda60, 0xda5e, 0xda5f, 0xb54a, 0xda63, 0xda5c, 0xda5a, 0xb54b, 0xda5d, 0xda61, 0xb54d, 0xda64, 0xde70, 0xde77, 0xde79, 0xdea1, 0xb7da, 0xde6b, 0xb7d2, 0xde7a, 0xb7d7, 0xdea2, 0xb7ce, 0xde7d, 0xde6d, 0xde7e, 0xde6c, 0xb7dc, 0xde78, 0xb7cf, 0xdea3, 0xb7d4, 0xde71, 0xb7d9, 0xde7c, 0xde6f, 0xde76, 0xde72, 0xde6e, 0xb7d1, 0xb7d8, 0xb7d6, 0xb7d3, 0xb7db, 0xb7d0, 0xde75, 0xb7d5, 0xb54e, 0xde7b, 0xde73, 0xde74, 0xe2c1, 0xbab4, 0xe2bd, 0xe2c3, 0xe2bf, 0xbab6, 0xe2be, 0xe2c2, 0xe2ba, 0xe2bc, 0xbab5, 0xe2c0, 0xe2bb, 0xbab7, 0xbab2, 0xe2c4, 0xbab3, 0xe667, 0xe664, 0xe670, 0xe66a, 0xe66c, 0xbcf4, 0xe666, 0xe66e, 0xe66d, 0xe66b, 0xe671, 0xbcf7, 0xe668, 0xe66f, 0xbcf5, 0xe663, 0xe665, 0xbcf6, 0xe662, 0xe672, 0xe669, 0xea4a, 0xbf51, 0xea55, 0xea53, 0xbf4b, 0xea49, 0xea4c, 0xea4d, 0xea48, 0xbf55, 0xbf56, 0xea47, 0xea56, 0xea51, 0xbf4f, 0xbf4c, 0xea50, 0xea4e, 0xbf52, 0xea52, 0xbf4d, 0xbf4e, 0xea4f, 0xbf50, 0xea4b, 0xea54, 0xbf53, 0xea57, 0xea58, 0xbf54, 0xc0e7, 0xc0ee, 0xed5c, 0xed62, 0xed60, 0xc0ea, 0xc0e9, 0xc0e6, 0xed5e, 0xc0ec, 0xc0eb, 0xc0e8, 0xed61, 0xed5d, 0xed5f, 0xc0ed, 0xc277, 0xeffb, 0xc274, 0xc275, 0xeffd, 0xc276, 0xeffa, 0xeff9, 0xf26c, 0xeffc, 0xf26d, 0xc37a, 0xf26b, 0xf26a, 0xf269, 0xc37b, 0xc46c, 0xf46a, 0xf46b, 0xf5dc, 0xf5db, 0xc4ea, 0xf5da, 0xf6ec, 0xf6ed, 0xf7e6, 0xf8b1, 0xf8f6, 0xf9bc, 0xc679, 0xf9c6, 0xa4f6, 0xaaa6, 0xaaa7, 0xacb8, 0xc0ef, 0xa4f7, 0xaaa8, 0xaf52, 0xb7dd, 0xa4f8, 0xb26e, 0xbab8, 0xc962, 0xcfb7, 0xd27d, 0xe2c5, 0xc0f0, 0xa4f9, 0xaaa9, 0xcfb8, 0xcfb9, 0xda66, 0xb550, 0xdea4, 0xb7de, 0xe2c6, 0xbcf8, 0xc37c, 0xa4fa, 0xda67, 0xa4fb, 0xa6c9, 0xca42, 0xa6c8, 0xa865, 0xa864, 0xa863, 0xcb60, 0xaaaa, 0xaaab, 0xcd5b, 0xcfba, 0xcfbd, 0xacba, 0xcfbb, 0xacb9, 0xcfbc, 0xacbb, 0xd2a2, 0xd2a1, 0xd27e, 0xaf53, 0xd65d, 0xd65e, 0xb26f, 0xd65c, 0xd65f, 0xb552, 0xb270, 0xb551, 0xda6b, 0xda6a, 0xda68, 0xda69, 0xda6c, 0xdea6, 0xdea5, 0xdea9, 0xdea8, 0xdea7, 0xbab9, 0xe2c9, 0xe2c8, 0xbaba, 0xe2c7, 0xe673, 0xe674, 0xbcf9, 0xea59, 0xea5a, 0xf272, 0xc37d, 0xf271, 0xf270, 0xf26e, 0xf26f, 0xc4eb, 0xf46c, 0xf6ee, 0xf8f7, 0xa4fc, 0xc9a5, 0xa5c7, 0xc9a6, 0xca43, 0xca44, 0xcb66, 0xcb62, 0xcb61, 0xaaac, 0xcb65, 0xa867, 0xcb63, 0xa866, 0xcb67, 0xcb64, 0xcd5f, 0xcfbe, 0xcd5d, 0xcd64, 0xaaad, 0xaab0, 0xcd65, 0xcd61, 0xcd62, 0xcd5c, 0xaaaf, 0xcd5e, 0xaaae, 0xcd63, 0xcd60, 0xcfc2, 0xacbd, 0xacbe, 0xcfc5, 0xcfbf, 0xcfc4, 0xcfc0, 0xacbc, 0xcfc3, 0xcfc1, 0xd2a8, 0xd2a5, 0xd2a7, 0xaf58, 0xaf57, 0xaf55, 0xd2a4, 0xd2a9, 0xaf54, 0xaf56, 0xd2a6, 0xd667, 0xd2a3, 0xd2aa, 0xd662, 0xd666, 0xd665, 0xda6e, 0xda79, 0xd668, 0xd663, 0xda6d, 0xb274, 0xb273, 0xd661, 0xd664, 0xb275, 0xb272, 0xb271, 0xd660, 0xd669, 0xda70, 0xda77, 0xb554, 0xda76, 0xda73, 0xb556, 0xda75, 0xda6f, 0xda71, 0xda74, 0xda72, 0xb555, 0xda78, 0xb553, 0xb7df, 0xdead, 0xdeac, 0xdeaa, 0xb7e2, 0xb7e1, 0xdeae, 0xdeab, 0xe2ca, 0xbabb, 0xb7e0, 0xdeb0, 0xdeaf, 0xe2cd, 0xe2cb, 0xbcfa, 0xbabc, 0xe2cc, 0xe676, 0xbcfb, 0xe675, 0xe67e, 0xe67d, 0xe67b, 0xe67a, 0xe677, 0xe678, 0xe679, 0xe67c, 0xe6a1, 0xea5f, 0xea5c, 0xea5d, 0xbf57, 0xea5b, 0xea61, 0xea60, 0xea5e, 0xed64, 0xed65, 0xc0f1, 0xc0f2, 0xed63, 0xc279, 0xeffe, 0xc278, 0xc37e, 0xc3a1, 0xc46d, 0xf46e, 0xf46d, 0xf5dd, 0xf6ef, 0xc57a, 0xf7e8, 0xf7e7, 0xf7e9, 0xa5c8, 0xcfc6, 0xaf59, 0xb276, 0xd66a, 0xa5c9, 0xc9a7, 0xa4fd, 0xca45, 0xcb6c, 0xcb6a, 0xcb6b, 0xcb68, 0xa868, 0xcb69, 0xcd6d, 0xaab3, 0xcd6b, 0xcd67, 0xcd6a, 0xcd66, 0xaab5, 0xcd69, 0xaab2, 0xaab1, 0xaab4, 0xcd6c, 0xcd68, 0xacc2, 0xacc5, 0xcfce, 0xcfcd, 0xcfcc, 0xacbf, 0xcfd5, 0xcfcb, 0xacc1, 0xd2af, 0xcfd2, 0xcfd0, 0xacc4, 0xcfc8, 0xcfd3, 0xcfca, 0xcfd4, 0xcfd1, 0xcfc9, 0xacc0, 0xcfd6, 0xcfc7, 0xacc3, 0xd2b4, 0xd2ab, 0xd2b6, 0xd2ae, 0xd2b9, 0xd2ba, 0xd2ac, 0xd2b8, 0xd2b5, 0xd2b3, 0xd2b7, 0xaf5f, 0xaf5d, 0xd2b1, 0xd2ad, 0xd2b0, 0xd2bb, 0xd2b2, 0xaf5e, 0xcfcf, 0xaf5a, 0xaf5c, 0xd678, 0xd66d, 0xd66b, 0xd66c, 0xd673, 0xd674, 0xd670, 0xb27b, 0xd675, 0xd672, 0xd66f, 0xb279, 0xd66e, 0xb277, 0xb27a, 0xd671, 0xd679, 0xaf5b, 0xb278, 0xd677, 0xd676, 0xb27c, 0xda7e, 0xdaa1, 0xb560, 0xdaa7, 0xdaa9, 0xdaa2, 0xb55a, 0xdaa6, 0xdaa5, 0xb55b, 0xb561, 0xb562, 0xdaa8, 0xb558, 0xda7d, 0xda7b, 0xdaa3, 0xda7a, 0xb55f, 0xda7c, 0xdaa4, 0xdaaa, 0xb559, 0xb55e, 0xb55c, 0xb55d, 0xb557, 0xb7e9, 0xdeb7, 0xb7e8, 0xdebb, 0xdeb1, 0xdebc, 0xdeb2, 0xdeb3, 0xdebd, 0xdeba, 0xdeb8, 0xdeb9, 0xdeb5, 0xdeb4, 0xdebe, 0xb7e5, 0xdeb6, 0xb7ea, 0xb7e4, 0xb7eb, 0xb7ec, 0xb7e7, 0xb7e6, 0xe2ce, 0xbabe, 0xbabd, 0xe2d3, 0xbcfc, 0xbabf, 0xbac1, 0xe2d4, 0xb7e3, 0xbac0, 0xe2d0, 0xe2d2, 0xe2cf, 0xe2d1, 0xe6ab, 0xe6aa, 0xe6a7, 0xbd40, 0xea62, 0xbd41, 0xe6a6, 0xbcfe, 0xe6a8, 0xe6a5, 0xe6a2, 0xe6a9, 0xe6a3, 0xe6a4, 0xbcfd, 0xed69, 0xea66, 0xea65, 0xea67, 0xed66, 0xbf5a, 0xea63, 0xbf58, 0xbf5c, 0xbf5b, 0xea64, 0xea68, 0xbf59, 0xed6d, 0xc0f5, 0xc27a, 0xc0f6, 0xc0f3, 0xed6a, 0xed68, 0xed6b, 0xed6e, 0xc0f4, 0xed6c, 0xed67, 0xf042, 0xf045, 0xf275, 0xf040, 0xf46f, 0xf046, 0xc3a2, 0xf044, 0xc27b, 0xf041, 0xf043, 0xf047, 0xf276, 0xf274, 0xc3a3, 0xf273, 0xc46e, 0xc4ed, 0xf6f1, 0xc4ec, 0xf6f3, 0xf6f0, 0xf6f2, 0xc5d0, 0xf8b2, 0xa5ca, 0xcd6e, 0xd2bc, 0xd2bd, 0xb27d, 0xdebf, 0xbf5d, 0xc3a4, 0xc57b, 0xf8b3, 0xa5cb, 0xcd6f, 0xa260, 0xcfd7, 0xcfd8, 0xd2be, 0xd2bf, 0xb27e, 0xb2a1, 0xdaab, 0xdec2, 0xdec1, 0xdec0, 0xe2d5, 0xe2d6, 0xe2d7, 0xbac2, 0xe6ad, 0xe6ac, 0xea69, 0xbf5e, 0xbf5f, 0xed72, 0xed6f, 0xed70, 0xed71, 0xf049, 0xf048, 0xc27c, 0xf277, 0xf5de, 0xa5cc, 0xacc6, 0xb2a2, 0xdec3, 0xa5cd, 0xd2c0, 0xb2a3, 0xb563, 0xb564, 0xa5ce, 0xa5cf, 0xca46, 0xa86a, 0xa869, 0xacc7, 0xcfd9, 0xdaac, 0xa5d0, 0xa5d1, 0xa5d2, 0xa5d3, 0xa86b, 0xa86c, 0xcb6e, 0xcb6d, 0xaab6, 0xcd72, 0xcd70, 0xcd71, 0xcfda, 0xcfdb, 0xaccb, 0xacc9, 0xacca, 0xacc8, 0xaf60, 0xaf64, 0xaf63, 0xd2c1, 0xaf62, 0xaf61, 0xd2c2, 0xb2a6, 0xd67b, 0xd67a, 0xb2a4, 0xb2a5, 0xb566, 0xb565, 0xdaae, 0xdaad, 0xb2a7, 0xb7ed, 0xdec5, 0xb7ee, 0xdec4, 0xe2d8, 0xe6ae, 0xbd42, 0xea6a, 0xed73, 0xc3a6, 0xc3a5, 0xc57c, 0xa5d4, 0xcd73, 0xb2a8, 0xe2d9, 0xbac3, 0xcb6f, 0xcb70, 0xcd74, 0xaab8, 0xaab9, 0xaab7, 0xaccf, 0xacd0, 0xaccd, 0xacce, 0xcfdc, 0xcfdd, 0xaccc, 0xd2c3, 0xaf68, 0xaf69, 0xb2ab, 0xd2c9, 0xaf6e, 0xaf6c, 0xd2ca, 0xd2c5, 0xaf6b, 0xaf6a, 0xaf65, 0xd2c8, 0xd2c7, 0xd2c4, 0xaf6d, 0xd2c6, 0xaf66, 0xaf67, 0xb2ac, 0xd6a1, 0xd6a2, 0xb2ad, 0xd67c, 0xd67e, 0xd6a4, 0xd6a3, 0xd67d, 0xb2a9, 0xb2aa, 0xdab6, 0xb56b, 0xb56a, 0xdab0, 0xb568, 0xdab3, 0xb56c, 0xdab4, 0xb56d, 0xdab1, 0xb567, 0xb569, 0xdab5, 0xdab2, 0xdaaf, 0xded2, 0xdec7, 0xb7f0, 0xb7f3, 0xb7f2, 0xb7f7, 0xb7f6, 0xded3, 0xded1, 0xdeca, 0xdece, 0xdecd, 0xb7f4, 0xded0, 0xdecc, 0xded4, 0xdecb, 0xb7f5, 0xb7ef, 0xb7f1, 0xdec9, 0xe2db, 0xbac7, 0xe2df, 0xbac6, 0xe2dc, 0xbac5, 0xdec8, 0xdecf, 0xe2de, 0xbac8, 0xe2e0, 0xe2dd, 0xe2da, 0xe6b1, 0xe6b5, 0xe6b7, 0xe6b3, 0xe6b2, 0xe6b0, 0xbd45, 0xbd43, 0xbd48, 0xbd49, 0xe6b4, 0xbd46, 0xe6af, 0xbd47, 0xbac4, 0xe6b6, 0xbd44, 0xea6c, 0xea6b, 0xea73, 0xea6d, 0xea72, 0xea6f, 0xbf60, 0xea71, 0xbf61, 0xbf62, 0xea70, 0xea6e, 0xc0f8, 0xed74, 0xc0f7, 0xed77, 0xed75, 0xed76, 0xc0f9, 0xf04d, 0xc2a1, 0xf04e, 0xc27d, 0xf04f, 0xc27e, 0xf04c, 0xf050, 0xf04a, 0xc3a7, 0xf278, 0xc3a8, 0xc46f, 0xf04b, 0xc470, 0xc4ee, 0xf5df, 0xc57e, 0xf6f4, 0xc57d, 0xf7ea, 0xc5f5, 0xc5f6, 0xf9cc, 0xacd1, 0xcfde, 0xb56e, 0xb56f, 0xa5d5, 0xa6ca, 0xca47, 0xcb71, 0xa86d, 0xaaba, 0xacd2, 0xacd3, 0xacd4, 0xd6a6, 0xd2cb, 0xaf6f, 0xb2ae, 0xd6a5, 0xdab8, 0xb571, 0xdab7, 0xb570, 0xded5, 0xbd4a, 0xe6bb, 0xe6b8, 0xe6b9, 0xe6ba, 0xed78, 0xf051, 0xf471, 0xf470, 0xf6f5, 0xa5d6, 0xcd75, 0xaf70, 0xb572, 0xded6, 0xe2e1, 0xbd4b, 0xea74, 0xf052, 0xf472, 0xa5d7, 0xaabb, 0xacd7, 0xcfdf, 0xacd8, 0xacd6, 0xacd5, 0xd2cc, 0xaf71, 0xaf72, 0xaf73, 0xb2b0, 0xd6a7, 0xb2af, 0xdab9, 0xb2b1, 0xb573, 0xded7, 0xb7f8, 0xb7f9, 0xbac9, 0xbaca, 0xbd4c, 0xbf64, 0xea75, 0xbf63, 0xed79, 0xc0fa, 0xf053, 0xf473, 0xa5d8, 0xa86e, 0xcd78, 0xcd77, 0xaabc, 0xcd76, 0xaabd, 0xcd79, 0xcfe5, 0xacdb, 0xacda, 0xcfe7, 0xcfe6, 0xacdf, 0xacde, 0xacd9, 0xcfe1, 0xcfe2, 0xcfe3, 0xace0, 0xcfe0, 0xacdc, 0xcfe4, 0xacdd, 0xd2cf, 0xd2d3, 0xd2d1, 0xd2d0, 0xd2d4, 0xd2d5, 0xd2d6, 0xd2ce, 0xd2cd, 0xaf75, 0xaf76, 0xd2d7, 0xd2d2, 0xd6b0, 0xd2d8, 0xaf77, 0xaf74, 0xd6aa, 0xd6a9, 0xd6ab, 0xd6ac, 0xd6ae, 0xd6ad, 0xd6b2, 0xb2b5, 0xb2b2, 0xb2b6, 0xd6a8, 0xb2b7, 0xd6b1, 0xb2b4, 0xd6af, 0xb2b3, 0xdabc, 0xdabe, 0xdaba, 0xdabb, 0xdabf, 0xdac1, 0xdac2, 0xdabd, 0xdac0, 0xb574, 0xdedb, 0xdee0, 0xded8, 0xdedc, 0xdee1, 0xdedd, 0xb7fa, 0xb843, 0xb7fd, 0xded9, 0xdeda, 0xbace, 0xb846, 0xb7fe, 0xb844, 0xb7fc, 0xdedf, 0xb845, 0xdede, 0xb841, 0xb7fb, 0xb842, 0xdee2, 0xe2e6, 0xe2e8, 0xb840, 0xe2e3, 0xbacc, 0xe2e9, 0xbacd, 0xe2e7, 0xe2e2, 0xe2e5, 0xe2ea, 0xbacb, 0xe2e4, 0xbd4e, 0xe6bf, 0xe6be, 0xbd51, 0xbd4f, 0xe6bc, 0xbd4d, 0xe6bd, 0xbd50, 0xea7d, 0xeaa1, 0xea7e, 0xea76, 0xea7a, 0xea79, 0xea77, 0xbf66, 0xbf67, 0xbf65, 0xea78, 0xea7b, 0xea7c, 0xbf68, 0xc140, 0xeda3, 0xc0fc, 0xed7b, 0xc0fe, 0xc141, 0xc0fd, 0xeda2, 0xed7c, 0xc0fb, 0xeda1, 0xed7a, 0xed7e, 0xed7d, 0xf055, 0xc2a4, 0xc2a5, 0xc2a2, 0xc2a3, 0xf054, 0xf27b, 0xc3a9, 0xf279, 0xf27a, 0xf474, 0xf477, 0xf475, 0xf476, 0xf5e0, 0xc4ef, 0xf7eb, 0xf8b4, 0xc5f7, 0xf8f8, 0xf8f9, 0xc666, 0xa5d9, 0xace1, 0xdac3, 0xdee3, 0xa5da, 0xa86f, 0xaabe, 0xcfe8, 0xcfe9, 0xaf78, 0xdac4, 0xb575, 0xb847, 0xc142, 0xeda4, 0xf27c, 0xf478, 0xa5db, 0xcda1, 0xcd7a, 0xcd7c, 0xcd7e, 0xcd7d, 0xcd7b, 0xaabf, 0xace2, 0xcff2, 0xcfed, 0xcfea, 0xcff1, 0xace4, 0xace5, 0xcff0, 0xcfef, 0xcfee, 0xcfeb, 0xcfec, 0xcff3, 0xace3, 0xaf7c, 0xafa4, 0xafa3, 0xd2e1, 0xd2db, 0xd2d9, 0xafa1, 0xd6b9, 0xaf7a, 0xd2de, 0xd2e2, 0xd2e4, 0xd2e0, 0xd2da, 0xafa2, 0xd2df, 0xd2dd, 0xaf79, 0xd2e5, 0xafa5, 0xd2e3, 0xaf7d, 0xd2dc, 0xaf7e, 0xaf7b, 0xb2b9, 0xd6ba, 0xd6b3, 0xd6b5, 0xd6b7, 0xd6b8, 0xd6b6, 0xb2ba, 0xd6bb, 0xd6b4, 0xdac8, 0xb576, 0xdad0, 0xdac5, 0xdad1, 0xdac6, 0xdac7, 0xdacf, 0xdace, 0xdacb, 0xb2b8, 0xb577, 0xdac9, 0xdacc, 0xb578, 0xdacd, 0xdaca, 0xdeee, 0xdef2, 0xb84e, 0xe2f0, 0xb851, 0xdef0, 0xdeed, 0xdee8, 0xdeea, 0xdeeb, 0xdee4, 0xb84d, 0xb84c, 0xb848, 0xdee7, 0xb84f, 0xb850, 0xdee6, 0xdee9, 0xdef1, 0xb84a, 0xb84b, 0xdeef, 0xdee5, 0xe2f2, 0xbad0, 0xe2f4, 0xdeec, 0xe2f6, 0xbad4, 0xe2f7, 0xe2f3, 0xbad1, 0xe2ef, 0xbad3, 0xe2ec, 0xe2f1, 0xe2f5, 0xe2ee, 0xb849, 0xe2eb, 0xbad2, 0xe2ed, 0xbd54, 0xe6c1, 0xbd58, 0xbd56, 0xbacf, 0xe6c8, 0xe6c9, 0xbd53, 0xe6c7, 0xe6ca, 0xbd55, 0xbd52, 0xe6c3, 0xe6c0, 0xe6c5, 0xe6c2, 0xbd59, 0xe6c4, 0xe6c6, 0xbd57, 0xbf6a, 0xeaa8, 0xeaa2, 0xeaa6, 0xeaac, 0xeaad, 0xeaa9, 0xeaaa, 0xeaa7, 0xeaa4, 0xbf6c, 0xbf69, 0xeaa3, 0xeaa5, 0xbf6b, 0xeaab, 0xc146, 0xedaa, 0xeda5, 0xc145, 0xc143, 0xedac, 0xc144, 0xeda8, 0xeda9, 0xeda6, 0xedad, 0xf056, 0xc147, 0xeda7, 0xedae, 0xedab, 0xf05a, 0xf057, 0xc2a6, 0xf05b, 0xf05d, 0xf05c, 0xf058, 0xf059, 0xf2a3, 0xc3aa, 0xf27e, 0xf2a2, 0xf27d, 0xf2a4, 0xf2a1, 0xf47a, 0xf47d, 0xf479, 0xc471, 0xf47b, 0xf47c, 0xf47e, 0xc472, 0xc474, 0xc473, 0xf5e1, 0xf5e3, 0xf5e2, 0xf6f6, 0xf8b5, 0xf8fa, 0xa5dc, 0xcb72, 0xaac0, 0xcda3, 0xaac1, 0xaac2, 0xcda2, 0xcff8, 0xcff7, 0xace6, 0xace9, 0xace8, 0xace7, 0xcff4, 0xcff6, 0xcff5, 0xd2e8, 0xafa7, 0xd2ec, 0xd2eb, 0xd2ea, 0xd2e6, 0xafa6, 0xafaa, 0xafad, 0xafae, 0xd2e7, 0xd2e9, 0xafac, 0xafab, 0xafa9, 0xafa8, 0xd6c2, 0xd6c0, 0xd6bc, 0xb2bb, 0xd6bd, 0xb2bc, 0xd6be, 0xd6bf, 0xd6c1, 0xb2bd, 0xdad5, 0xdad4, 0xdad3, 0xdad2, 0xdef6, 0xb852, 0xdef3, 0xdef5, 0xb853, 0xb854, 0xdef4, 0xe341, 0xe2f9, 0xe2fa, 0xbad7, 0xbad5, 0xbad6, 0xe343, 0xe342, 0xe2fe, 0xe2fd, 0xe2fc, 0xe2fb, 0xe340, 0xe2f8, 0xe6cb, 0xe6d0, 0xe6ce, 0xe6cd, 0xe6cc, 0xe6cf, 0xeaae, 0xbf6d, 0xc148, 0xedb0, 0xc149, 0xedaf, 0xf05f, 0xf05e, 0xc2a7, 0xf2a5, 0xc3ab, 0xf4a1, 0xc5a1, 0xf6f7, 0xf8b7, 0xf8b6, 0xc9a8, 0xacea, 0xaceb, 0xd6c3, 0xb856, 0xa5dd, 0xa872, 0xa871, 0xa870, 0xcda4, 0xaac4, 0xaac3, 0xacee, 0xcffa, 0xcffd, 0xcffb, 0xacec, 0xaced, 0xcff9, 0xcffc, 0xafb5, 0xd2f3, 0xd2f5, 0xd2f4, 0xafb2, 0xd2ef, 0xafb0, 0xafaf, 0xafb3, 0xafb1, 0xafb4, 0xd2f2, 0xd2ed, 0xd2ee, 0xd2f1, 0xd2f0, 0xd6c6, 0xd6c7, 0xd6c5, 0xd6c4, 0xb2be, 0xb57d, 0xdad6, 0xdad8, 0xdada, 0xb57c, 0xb57a, 0xdad7, 0xb57b, 0xdad9, 0xb579, 0xdf41, 0xdef7, 0xdefa, 0xdefe, 0xb85a, 0xdefc, 0xdefb, 0xdef8, 0xdef9, 0xb858, 0xdf40, 0xb857, 0xb85c, 0xb85b, 0xb859, 0xdefd, 0xe349, 0xe348, 0xe344, 0xbad8, 0xe347, 0xe346, 0xbad9, 0xbd5e, 0xe6d2, 0xbd5f, 0xbd5b, 0xbd5d, 0xbd5a, 0xbd5c, 0xeaaf, 0xbf70, 0xeab1, 0xeab0, 0xe345, 0xbf72, 0xbf71, 0xbf6e, 0xbf6f, 0xedb5, 0xedb3, 0xc14a, 0xedb4, 0xedb6, 0xedb2, 0xedb1, 0xf060, 0xc2aa, 0xc2a8, 0xc2a9, 0xf2a6, 0xf2a7, 0xc3ad, 0xc3ac, 0xf4a3, 0xf4a4, 0xf4a2, 0xf6f8, 0xf6f9, 0xa5de, 0xca48, 0xa873, 0xcda5, 0xaac6, 0xaac5, 0xcda6, 0xd040, 0xacef, 0xcffe, 0xacf0, 0xafb6, 0xd2f8, 0xd2f6, 0xd2fc, 0xafb7, 0xd2f7, 0xd2fb, 0xd2f9, 0xd2fa, 0xd6c8, 0xd6ca, 0xb2bf, 0xd6c9, 0xb2c0, 0xb5a2, 0xb5a1, 0xb57e, 0xdadb, 0xdf44, 0xb85d, 0xb85e, 0xdf43, 0xdf42, 0xe34a, 0xbadb, 0xbada, 0xe34b, 0xe34c, 0xbd61, 0xbd60, 0xeab5, 0xe6d3, 0xe6d5, 0xe6d4, 0xeab4, 0xeab2, 0xeab6, 0xeab3, 0xbf73, 0xedb7, 0xc14b, 0xedb8, 0xedb9, 0xc2ab, 0xc2ac, 0xc475, 0xc5d1, 0xa5df, 0xd041, 0xd2fd, 0xafb8, 0xb3ba, 0xb3b9, 0xb5a4, 0xdadd, 0xb5a3, 0xdadc, 0xdf45, 0xbadc, 0xe34d, 0xbadd, 0xc476, 0xf4a5, 0xa6cb, 0xaac7, 0xcda7, 0xacf2, 0xacf1, 0xd042, 0xd043, 0xd340, 0xd342, 0xafb9, 0xd344, 0xd347, 0xd345, 0xd346, 0xd343, 0xd2fe, 0xafba, 0xd348, 0xd341, 0xd6d3, 0xb2c6, 0xd6dc, 0xb2c3, 0xd6d5, 0xb2c7, 0xb2c1, 0xd6d0, 0xd6dd, 0xd6d1, 0xd6ce, 0xb2c5, 0xb2c2, 0xd6d4, 0xd6d7, 0xb2c4, 0xd6d8, 0xb2c8, 0xd6d9, 0xd6cf, 0xd6d6, 0xd6da, 0xd6d2, 0xd6cd, 0xd6cb, 0xd6db, 0xdadf, 0xdae4, 0xdae0, 0xdae6, 0xb5a7, 0xd6cc, 0xdae1, 0xb5a5, 0xdade, 0xb5ac, 0xdae2, 0xb5ab, 0xdae3, 0xb5ad, 0xb5a8, 0xb5ae, 0xb5a9, 0xb5aa, 0xb5a6, 0xdae5, 0xb861, 0xdf50, 0xdf53, 0xdf47, 0xdf4c, 0xdf46, 0xb863, 0xdf4a, 0xdf48, 0xb862, 0xdf4f, 0xdf4e, 0xdf4b, 0xdf4d, 0xdf49, 0xbae1, 0xdf52, 0xb85f, 0xdf51, 0xe35d, 0xbae8, 0xe358, 0xbae7, 0xe34e, 0xe350, 0xbae0, 0xe355, 0xe354, 0xe357, 0xbae5, 0xe352, 0xe351, 0xbae4, 0xbadf, 0xe353, 0xbae2, 0xe359, 0xe35b, 0xe356, 0xe34f, 0xbae3, 0xbd69, 0xbade, 0xe35c, 0xe6d9, 0xbd62, 0xe6db, 0xbd63, 0xbd65, 0xe6de, 0xe6d6, 0xbae6, 0xe6dc, 0xe6d8, 0xb860, 0xbd68, 0xbd64, 0xbd66, 0xbd67, 0xbf76, 0xe6dd, 0xe6d7, 0xbd6a, 0xe6da, 0xeac0, 0xeabb, 0xeac5, 0xbf74, 0xeabd, 0xbf78, 0xeac3, 0xeaba, 0xeab7, 0xeac6, 0xc151, 0xbf79, 0xeac2, 0xeab8, 0xbf77, 0xeabc, 0xbf7b, 0xeab9, 0xeabe, 0xbf7a, 0xeac1, 0xeac4, 0xedcb, 0xedcc, 0xedbc, 0xedc3, 0xedc1, 0xc14f, 0xedc8, 0xeabf, 0xedbf, 0xedc9, 0xc14e, 0xedbe, 0xedbd, 0xedc7, 0xedc4, 0xedc6, 0xedba, 0xedca, 0xc14c, 0xedc5, 0xedce, 0xedc2, 0xc150, 0xc14d, 0xedc0, 0xedbb, 0xedcd, 0xbf75, 0xf063, 0xf061, 0xf067, 0xc2b0, 0xf065, 0xf064, 0xc2b2, 0xf06a, 0xc2b1, 0xf06b, 0xf068, 0xc2ae, 0xf069, 0xf062, 0xc2af, 0xc2ad, 0xf2ab, 0xf066, 0xf06c, 0xf2a8, 0xc3b2, 0xc3b0, 0xf2aa, 0xf2ac, 0xf2a9, 0xc3b1, 0xc3ae, 0xc3af, 0xc3b3, 0xc478, 0xf4aa, 0xf4a9, 0xf4a7, 0xf4a6, 0xf4a8, 0xc477, 0xc479, 0xc4f0, 0xf5e5, 0xf5e4, 0xf6fa, 0xf6fc, 0xf6fe, 0xf6fd, 0xf6fb, 0xc5a3, 0xc5a2, 0xc5d3, 0xc5d2, 0xc5d4, 0xf7ed, 0xf7ec, 0xf8fb, 0xf8b8, 0xf8fc, 0xc658, 0xc659, 0xf96d, 0xc67e, 0xa6cc, 0xcda8, 0xd045, 0xd046, 0xd044, 0xacf3, 0xd047, 0xd048, 0xd049, 0xd349, 0xd34f, 0xd34d, 0xafbb, 0xd34b, 0xd34c, 0xd34e, 0xd34a, 0xb2c9, 0xd6de, 0xb2cb, 0xd6e0, 0xb2ca, 0xd6df, 0xdae8, 0xb5af, 0xdaea, 0xdae7, 0xd6e1, 0xb5b0, 0xdae9, 0xdf56, 0xb864, 0xdf54, 0xb865, 0xdf55, 0xb866, 0xbae9, 0xe361, 0xe35e, 0xe360, 0xbaea, 0xbaeb, 0xe35f, 0xe6df, 0xe6e0, 0xbd6b, 0xe6e2, 0xe6e1, 0xa261, 0xeaca, 0xeacb, 0xeac7, 0xeac8, 0xbf7c, 0xbf7d, 0xeac9, 0xc157, 0xc153, 0xc158, 0xc154, 0xc156, 0xc152, 0xc155, 0xc2b3, 0xedcf, 0xf2ae, 0xf2ad, 0xf4ab, 0xc47a, 0xc47b, 0xf741, 0xf5e6, 0xf740, 0xf8fd, 0xf9a4, 0xa6cd, 0xa874, 0xcda9, 0xaac8, 0xacf6, 0xd04c, 0xacf4, 0xd04a, 0xacf9, 0xacf5, 0xacfa, 0xacf8, 0xd04b, 0xacf7, 0xafbf, 0xafbe, 0xd35a, 0xafc7, 0xd353, 0xd359, 0xafc3, 0xd352, 0xd358, 0xd356, 0xafc2, 0xafc4, 0xd355, 0xafbd, 0xd354, 0xafc8, 0xafc5, 0xafc9, 0xafc6, 0xd351, 0xd350, 0xd357, 0xafc0, 0xafbc, 0xafc1, 0xd6f0, 0xd6e9, 0xb5b5, 0xd6e8, 0xb2cf, 0xb2d6, 0xb2d3, 0xb2d9, 0xb2d8, 0xb2d4, 0xd6e2, 0xd6e5, 0xd6e4, 0xb2d0, 0xd6e6, 0xd6ef, 0xb2d1, 0xd6e3, 0xd6ec, 0xd6ed, 0xb2d2, 0xd6ea, 0xb2d7, 0xb2cd, 0xb2d5, 0xd6e7, 0xb2cc, 0xd6eb, 0xd6ee, 0xdafb, 0xdaf2, 0xb5b2, 0xdaf9, 0xdaf6, 0xdaee, 0xdaf7, 0xb5b4, 0xdaef, 0xdaeb, 0xb86c, 0xdaf4, 0xb5b1, 0xdafa, 0xb5b8, 0xb5ba, 0xdaed, 0xb5b9, 0xdaf0, 0xb5b3, 0xdaf8, 0xdaf1, 0xdaf5, 0xdaf3, 0xb5b6, 0xdaec, 0xb5bb, 0xb2ce, 0xb5b7, 0xb5bc, 0xb868, 0xdf5d, 0xdf5f, 0xdf61, 0xdf65, 0xdf5b, 0xdf59, 0xb86a, 0xdf60, 0xdf64, 0xdf5c, 0xdf58, 0xdf57, 0xdf62, 0xdf5a, 0xdf5e, 0xb86b, 0xb869, 0xdf66, 0xb867, 0xdf63, 0xe372, 0xbaee, 0xe36a, 0xbd78, 0xe374, 0xbaf1, 0xe378, 0xbaf7, 0xe365, 0xe375, 0xe362, 0xe377, 0xe366, 0xbafe, 0xbafb, 0xe376, 0xe370, 0xbaed, 0xbaf5, 0xbaf4, 0xbaf3, 0xbaf9, 0xe363, 0xbafa, 0xe371, 0xbaf6, 0xbaec, 0xe373, 0xbaef, 0xbaf0, 0xbaf8, 0xe368, 0xe367, 0xe364, 0xe36c, 0xe369, 0xe36d, 0xbafd, 0xe379, 0xbaf2, 0xe36e, 0xe36f, 0xe36b, 0xbafc, 0xe6e7, 0xbd70, 0xbd79, 0xbd75, 0xe6e4, 0xbd72, 0xbd76, 0xe6f0, 0xbd6c, 0xe6e8, 0xbd74, 0xe6eb, 0xe6e6, 0xbd73, 0xbd77, 0xe6e5, 0xbd71, 0xe6ef, 0xbd6e, 0xe6ee, 0xe6ed, 0xbd7a, 0xe572, 0xbd6d, 0xe6ec, 0xe6e3, 0xbd7b, 0xe6ea, 0xbd6f, 0xe6e9, 0xbfa2, 0xbfa7, 0xbf7e, 0xead8, 0xeacf, 0xeadb, 0xead3, 0xead9, 0xbfa8, 0xbfa1, 0xeacc, 0xead2, 0xeadc, 0xead5, 0xeada, 0xeace, 0xead6, 0xbfa3, 0xead4, 0xbfa6, 0xbfa5, 0xead0, 0xead1, 0xeacd, 0xead7, 0xbfa4, 0xeade, 0xeadd, 0xedda, 0xedd6, 0xc15f, 0xedd0, 0xc159, 0xc169, 0xeddc, 0xc161, 0xc15d, 0xedd3, 0xc164, 0xc167, 0xedde, 0xc15c, 0xedd5, 0xc165, 0xede0, 0xeddd, 0xedd1, 0xc160, 0xc15a, 0xc168, 0xedd8, 0xc163, 0xedd2, 0xc15e, 0xeddf, 0xc162, 0xc15b, 0xedd9, 0xc166, 0xedd7, 0xeddb, 0xf06e, 0xf074, 0xc2b9, 0xf077, 0xc2b4, 0xc2b5, 0xf06f, 0xf076, 0xf071, 0xc2ba, 0xc2b7, 0xf06d, 0xc2b6, 0xf073, 0xf075, 0xc2b8, 0xf072, 0xf070, 0xf2b8, 0xc3b7, 0xc3b8, 0xc3b4, 0xc3b5, 0xf2b4, 0xf2b2, 0xf2b6, 0xc3ba, 0xf2b7, 0xf2b0, 0xf2af, 0xf2b3, 0xf2b1, 0xc3b6, 0xf2b5, 0xf4ac, 0xc47e, 0xc47d, 0xf4ad, 0xf4af, 0xf4ae, 0xc4a1, 0xf5eb, 0xf5e8, 0xf5e9, 0xf5e7, 0xf5ea, 0xc4f2, 0xf5ec, 0xc4f1, 0xf742, 0xc5d5, 0xc5d7, 0xf7ee, 0xc5d6, 0xf8b9, 0xf940, 0xf942, 0xf8fe, 0xf941, 0xc66c, 0xa6ce, 0xacfb, 0xd26f, 0xafca, 0xb2da, 0xdafc, 0xdafd, 0xeadf, 0xc16a, 0xede1, 0xc2bb, 0xf2ba, 0xf2b9, 0xc4a2, 0xf5ed, 0xf743, 0xc5f8, 0xca49, 0xaac9, 0xa875, 0xd04d, 0xd360, 0xd35b, 0xd35f, 0xd35d, 0xafcb, 0xd35e, 0xd35c, 0xd6f1, 0xdafe, 0xdb40, 0xdf69, 0xdf6a, 0xb86e, 0xb86f, 0xdf68, 0xdf6b, 0xdf67, 0xb86d, 0xbb40, 0xb870, 0xe37a, 0xbd7c, 0xe6f1, 0xbd7d, 0xbfa9, 0xeae2, 0xeae0, 0xeae1, 0xede4, 0xede3, 0xede2, 0xf2bb, 0xc3b9, 0xf2bc, 0xf744, 0xc5f9, 0xf8ba, 0xa6cf, 0xaacb, 0xaaca, 0xd04f, 0xacfc, 0xd04e, 0xd362, 0xafcc, 0xd6f2, 0xd361, 0xb2dc, 0xd6f5, 0xd6f3, 0xd6f4, 0xb2db, 0xdb42, 0xdb43, 0xdb41, 0xb873, 0xdf6d, 0xdf6c, 0xdf6e, 0xb872, 0xb871, 0xe6f2, 0xe6f4, 0xbd7e, 0xe6f3, 0xeae3, 0xbfaa, 0xf079, 0xf078, 0xc3bb, 0xf2bd, 0xc3bd, 0xc3bc, 0xf4b0, 0xf5ee, 0xc4f3, 0xa6d0, 0xd050, 0xacfd, 0xd365, 0xafce, 0xd364, 0xd363, 0xafcd, 0xd6fb, 0xd6fd, 0xd6f6, 0xd6f7, 0xb2dd, 0xd6f8, 0xb2de, 0xd6fc, 0xd6f9, 0xd6fa, 0xb2df, 0xb5be, 0xb5bf, 0xdb44, 0xdf6f, 0xdf70, 0xe37e, 0xbb43, 0xbb41, 0xbb42, 0xe37b, 0xe37c, 0xe37d, 0xe6f9, 0xe6fa, 0xbda1, 0xe6f7, 0xe6f6, 0xe6f8, 0xe6f5, 0xbfad, 0xeae4, 0xbfab, 0xbfac, 0xede6, 0xc16b, 0xede5, 0xefa8, 0xf07a, 0xf07b, 0xc2bc, 0xc2bd, 0xc16c, 0xf2be, 0xf2bf, 0xf4b1, 0xc4a3, 0xa6d1, 0xa6d2, 0xacfe, 0xaacc, 0xafcf, 0xd051, 0xb5c0, 0xa6d3, 0xad41, 0xd052, 0xd053, 0xad40, 0xad42, 0xa6d4, 0xd054, 0xafd1, 0xd366, 0xafd3, 0xafd0, 0xafd2, 0xd741, 0xb2e0, 0xd740, 0xd6fe, 0xdf71, 0xe3a1, 0xbda2, 0xbfae, 0xeae6, 0xeae5, 0xede7, 0xf5ef, 0xa6d5, 0xcb73, 0xcdaa, 0xad43, 0xd055, 0xd368, 0xafd4, 0xd367, 0xafd5, 0xd743, 0xb2e2, 0xd742, 0xd744, 0xb2e1, 0xdb46, 0xdb47, 0xdb45, 0xb5c1, 0xb874, 0xb875, 0xbb45, 0xe3a3, 0xe3a2, 0xbb44, 0xe6fb, 0xe6fc, 0xeae7, 0xc170, 0xc16f, 0xc16d, 0xc16e, 0xc171, 0xf07c, 0xc2bf, 0xc2be, 0xf2c0, 0xf4b2, 0xc5a5, 0xc5a4, 0xa6d6, 0xd1fb, 0xb877, 0xb5c2, 0xb876, 0xbb46, 0xa6d7, 0xc9a9, 0xa6d8, 0xa6d9, 0xcdab, 0xcb76, 0xcb77, 0xa877, 0xcb74, 0xa876, 0xa879, 0xcb75, 0xa87b, 0xa87a, 0xcb78, 0xa878, 0xaad1, 0xaacf, 0xcdad, 0xaace, 0xaad3, 0xaad5, 0xaad2, 0xcdb0, 0xcdac, 0xaad6, 0xaad0, 0xa87c, 0xaad4, 0xcdaf, 0xcdae, 0xaacd, 0xd05b, 0xad47, 0xad48, 0xd05d, 0xd057, 0xd05a, 0xd063, 0xd061, 0xad49, 0xd067, 0xad4c, 0xd064, 0xd05c, 0xd059, 0xdb49, 0xd062, 0xad44, 0xd065, 0xd056, 0xd05f, 0xad46, 0xad4b, 0xd060, 0xad4f, 0xad4d, 0xd058, 0xad4a, 0xd05e, 0xad4e, 0xad45, 0xd066, 0xafda, 0xafe3, 0xafd8, 0xafd6, 0xd36a, 0xafde, 0xafdb, 0xd36c, 0xafdd, 0xd36b, 0xd369, 0xd36e, 0xafe2, 0xafe0, 0xdb48, 0xd36f, 0xd36d, 0xafd7, 0xafd9, 0xafdc, 0xafdf, 0xafe1, 0xd74e, 0xb2e4, 0xd745, 0xd747, 0xd748, 0xd750, 0xd74c, 0xd74a, 0xd74d, 0xd751, 0xb2e5, 0xb2e9, 0xd746, 0xd74f, 0xb2e7, 0xb2e6, 0xd74b, 0xd749, 0xb2e3, 0xb2e8, 0xb5c8, 0xdb51, 0xdb4f, 0xb5ca, 0xdb4a, 0xdfa1, 0xb5c9, 0xdb4e, 0xdb4b, 0xb5c5, 0xb5cb, 0xdb50, 0xb5c7, 0xdb4d, 0xbb47, 0xb5c6, 0xdb4c, 0xb5cc, 0xb5c4, 0xb5c3, 0xdf77, 0xdf75, 0xdf7b, 0xdf73, 0xdfa2, 0xdf78, 0xdf72, 0xb87b, 0xb8a3, 0xdf7d, 0xdf76, 0xb87e, 0xb87c, 0xdf7e, 0xb879, 0xb878, 0xdf79, 0xb87d, 0xb5cd, 0xdf7c, 0xdf74, 0xb87a, 0xb8a1, 0xb8a2, 0xbb4c, 0xbb48, 0xbb4d, 0xe3a6, 0xe3a5, 0xe3a7, 0xbb4a, 0xe3a4, 0xbb4b, 0xe3aa, 0xe3a9, 0xe3a8, 0xbb49, 0xe741, 0xe744, 0xbda8, 0xe743, 0xbda7, 0xbda3, 0xbda4, 0xbda5, 0xe740, 0xe6fe, 0xbda6, 0xe742, 0xe6fd, 0xeae9, 0xeaf3, 0xbfb1, 0xbfb0, 0xeaed, 0xeaef, 0xeaea, 0xeaee, 0xeae8, 0xeaf1, 0xbfaf, 0xeaf0, 0xeaec, 0xeaf2, 0xeaeb, 0xc174, 0xede8, 0xedee, 0xc178, 0xc17a, 0xc177, 0xc176, 0xc175, 0xc173, 0xede9, 0xedec, 0xc172, 0xeded, 0xc179, 0xedeb, 0xedea, 0xc2c0, 0xc2c1, 0xf0a1, 0xf07d, 0xf07e, 0xf2c2, 0xf2c1, 0xc3be, 0xf4b4, 0xc4a4, 0xf4b3, 0xf5f0, 0xf745, 0xc5a6, 0xf943, 0xf944, 0xc5d8, 0xa6da, 0xaad7, 0xdb52, 0xbb4e, 0xc17b, 0xedef, 0xa6db, 0xafe5, 0xafe4, 0xdb53, 0xeaf4, 0xa6dc, 0xad50, 0xdb54, 0xdb55, 0xdb56, 0xbb4f, 0xbfb2, 0xa6dd, 0xaad8, 0xd068, 0xafe6, 0xd370, 0xb2ea, 0xdb57, 0xb8a4, 0xbb50, 0xbfb3, 0xc17c, 0xc2c2, 0xf4b5, 0xa6de, 0xaad9, 0xafe7, 0xd752, 0xb5ce, 0xbb51, 0xe3ab, 0xe745, 0xa6df, 0xb5cf, 0xdfa3, 0xbb52, 0xa6e0, 0xcdb1, 0xd069, 0xad51, 0xd372, 0xafea, 0xafe8, 0xafe9, 0xafeb, 0xd371, 0xd757, 0xd754, 0xd756, 0xb2eb, 0xb2ed, 0xb2ec, 0xd753, 0xb2ee, 0xd755, 0xdb58, 0xdb59, 0xdb5a, 0xdfa6, 0xdfa7, 0xdfa5, 0xdfa8, 0xb8a5, 0xdfa4, 0xbb53, 0xe74a, 0xe746, 0xe749, 0xe74b, 0xe748, 0xe747, 0xeaf5, 0xeaf6, 0xeaf7, 0xbfb4, 0xbfb5, 0xedf1, 0xedf0, 0xedf2, 0xf0a3, 0xf0a2, 0xf2c4, 0xf2c5, 0xf2c3, 0xc4a5, 0xf4b6, 0xf4b7, 0xf746, 0xf7ef, 0xf8bb, 0xa6e1, 0xa87d, 0xc17d, 0xa6e2, 0xd758, 0xdb5b, 0xc641, 0xca4a, 0xca4b, 0xca4d, 0xa6e3, 0xca4e, 0xca4c, 0xcba2, 0xcba3, 0xcb7b, 0xcba1, 0xa8a1, 0xa8a2, 0xcb7c, 0xcb7a, 0xcb79, 0xcb7d, 0xa87e, 0xcb7e, 0xd06a, 0xcdb6, 0xaadc, 0xcdb5, 0xcdb7, 0xaadb, 0xcdbc, 0xaadf, 0xcdb2, 0xcdc0, 0xcdc6, 0xaae6, 0xcdc3, 0xaae3, 0xcdb9, 0xcdbf, 0xcdc1, 0xcdb4, 0xaae2, 0xaadd, 0xcdba, 0xaae4, 0xaae7, 0xaae1, 0xaada, 0xcdbe, 0xcdb8, 0xcdc5, 0xaae9, 0xaae5, 0xaae0, 0xcdbd, 0xafec, 0xcdbb, 0xaade, 0xaae8, 0xcdb3, 0xcdc2, 0xcdc4, 0xad62, 0xad5c, 0xad64, 0xad61, 0xd071, 0xd074, 0xad5d, 0xd06b, 0xad56, 0xad60, 0xad63, 0xad65, 0xd0a2, 0xd077, 0xad55, 0xd0a1, 0xad59, 0xad57, 0xad52, 0xd06f, 0xd07e, 0xd073, 0xd076, 0xd0a5, 0xad66, 0xd07d, 0xad5e, 0xd078, 0xd0a4, 0xd075, 0xd079, 0xd07c, 0xd06d, 0xd0a3, 0xd07b, 0xd06c, 0xd070, 0xad5f, 0xad5a, 0xad53, 0xad58, 0xad54, 0xad67, 0xd06e, 0xd3a5, 0xad5b, 0xd07a, 0xce41, 0xd3a8, 0xaffa, 0xd376, 0xd3a3, 0xd37d, 0xd3b2, 0xd3aa, 0xd37e, 0xd3a9, 0xd378, 0xd37c, 0xd3b5, 0xaffd, 0xd3ad, 0xd3a4, 0xafed, 0xd3b3, 0xd374, 0xd3ac, 0xaffc, 0xaff7, 0xd373, 0xaff5, 0xaff4, 0xaff9, 0xd3ab, 0xaff1, 0xaff8, 0xd072, 0xdb5c, 0xd3a6, 0xd37a, 0xaffb, 0xd37b, 0xd3a1, 0xaffe, 0xd375, 0xd3af, 0xd3ae, 0xd3b6, 0xaff3, 0xaff0, 0xd3b4, 0xd3b0, 0xd3a7, 0xd3a2, 0xaff6, 0xaff2, 0xd377, 0xafee, 0xd3b1, 0xafef, 0xd379, 0xd75e, 0xd760, 0xd765, 0xd779, 0xb2fc, 0xb2f2, 0xd75d, 0xb2fd, 0xb2fe, 0xd768, 0xd76f, 0xd775, 0xd762, 0xd769, 0xb340, 0xd777, 0xd772, 0xb2fa, 0xb2f8, 0xd76e, 0xd76a, 0xd75c, 0xb2ef, 0xd761, 0xd759, 0xb2f7, 0xb2f9, 0xd766, 0xd763, 0xb2f4, 0xd773, 0xb2f1, 0xd764, 0xd77a, 0xd76c, 0xd76b, 0xb2f0, 0xb2fb, 0xb2f3, 0xd75a, 0xd75f, 0xd770, 0xd776, 0xb341, 0xd75b, 0xd767, 0xd76d, 0xb2f6, 0xd778, 0xd771, 0xd774, 0xb2f5, 0xdb6c, 0xdb60, 0xb5d7, 0xdb7d, 0xdba7, 0xdbaa, 0xb5d5, 0xdb68, 0xdba3, 0xdb69, 0xdb77, 0xb5e2, 0xdb73, 0xb5df, 0xdb74, 0xdb5d, 0xdba4, 0xb5e8, 0xdba1, 0xdb75, 0xdbac, 0xdb70, 0xdfc8, 0xdbaf, 0xb5e6, 0xdb6e, 0xdb7a, 0xb5e9, 0xb5d4, 0xdb72, 0xdbad, 0xdb6b, 0xdb64, 0xdb6f, 0xdb63, 0xdb61, 0xb5d0, 0xdba5, 0xdb6a, 0xdba8, 0xdba9, 0xb5d8, 0xb5dd, 0xb5d9, 0xb5e1, 0xdb7e, 0xb5da, 0xdb76, 0xdb66, 0xb5d2, 0xdb5e, 0xdba2, 0xdbab, 0xdb65, 0xb5e0, 0xdbb0, 0xdb71, 0xdb6d, 0xb5d1, 0xb5e5, 0xdb7c, 0xb5e7, 0xdb78, 0xb5dc, 0xb5d6, 0xb5de, 0xb5d3, 0xb5e4, 0xdb79, 0xdb67, 0xdb7b, 0xdb62, 0xdba6, 0xdbae, 0xdb5f, 0xdfc7, 0xdfdd, 0xb855, 0xdfcc, 0xdfca, 0xdfb5, 0xb8a9, 0xdfc5, 0xdfd9, 0xdfc1, 0xb8b1, 0xdfd8, 0xdfbf, 0xb5e3, 0xdfcf, 0xdfc0, 0xdfd6, 0xb8b0, 0xb8a8, 0xdfaa, 0xdfb2, 0xdfcb, 0xdfc3, 0xdfdc, 0xdfc6, 0xb8b6, 0xdfd7, 0xb8ad, 0xdfc9, 0xdfd1, 0xdfb6, 0xdfd0, 0xdfe1, 0xdfb1, 0xdfd2, 0xdfdf, 0xdfab, 0xb5db, 0xdfb9, 0xdfb8, 0xb8af, 0xdfbc, 0xdfbe, 0xdfcd, 0xdfde, 0xb8b2, 0xb8b3, 0xdfb0, 0xb8ab, 0xdfb4, 0xdfda, 0xb8b4, 0xb8ac, 0xb8ae, 0xb8b5, 0xdfe0, 0xdfd3, 0xdfce, 0xdfbb, 0xdfba, 0xb8aa, 0xdfac, 0xb8a7, 0xdfc4, 0xdfad, 0xdfc2, 0xdfb7, 0xdfdb, 0xb8a6, 0xdfb3, 0xdfaf, 0xdfd5, 0xdfae, 0xbb60, 0xe3d3, 0xe3c2, 0xe3ac, 0xe3ca, 0xbb58, 0xe3bb, 0xe3c5, 0xbb5b, 0xe3be, 0xbb59, 0xe3af, 0xe3cd, 0xe3ae, 0xe3c1, 0xe3ad, 0xe3bf, 0xe3c8, 0xe3c6, 0xe3ba, 0xe3b5, 0xe3b3, 0xe3b4, 0xe3c7, 0xe3d2, 0xe3bc, 0xbb5a, 0xe3b7, 0xe3cb, 0xbb5d, 0xe3b6, 0xe3b0, 0xe3c0, 0xbb61, 0xbb55, 0xbb5e, 0xe3b8, 0xe3b2, 0xbb57, 0xdfd4, 0xbb56, 0xe3c3, 0xbb54, 0xbb63, 0xbb5c, 0xe3c4, 0xe3b9, 0xe3b1, 0xe3cc, 0xe3bd, 0xbb62, 0xe3d0, 0xbb5f, 0xe3cf, 0xe3c9, 0xe3ce, 0xe3d1, 0xe773, 0xe774, 0xe767, 0xe766, 0xe762, 0xbdb4, 0xbdac, 0xe776, 0xe775, 0xdfa9, 0xe75f, 0xe763, 0xe75d, 0xe770, 0xe761, 0xe777, 0xe75a, 0xe758, 0xe764, 0xe76e, 0xe769, 0xbdb6, 0xe74f, 0xe76d, 0xbdb7, 0xdfbd, 0xe75b, 0xe752, 0xe755, 0xe77b, 0xe75c, 0xe753, 0xe751, 0xe74e, 0xbdb0, 0xe765, 0xbdaf, 0xbdb3, 0xe760, 0xe768, 0xbda9, 0xe778, 0xe77c, 0xbdab, 0xe757, 0xe76b, 0xe76f, 0xe754, 0xe779, 0xbdb2, 0xbdb1, 0xe74c, 0xbdb5, 0xe772, 0xe756, 0xe76a, 0xe750, 0xe75e, 0xe759, 0xbdad, 0xbdae, 0xe76c, 0xe77d, 0xe77a, 0xe771, 0xe74d, 0xbdaa, 0xeb49, 0xeb40, 0xeb43, 0xbfbb, 0xeb45, 0xeaf9, 0xeb41, 0xeb47, 0xbfb8, 0xbfbc, 0xbfb6, 0xeafb, 0xeb4c, 0xeb46, 0xeafc, 0xeb55, 0xeb4f, 0xeaf8, 0xee46, 0xeafe, 0xbfb7, 0xeb4a, 0xeb54, 0xbfbf, 0xeb51, 0xeafd, 0xeb44, 0xeb48, 0xeb42, 0xeb56, 0xeb53, 0xeb50, 0xbfb9, 0xbfba, 0xbfbe, 0xeafa, 0xeb57, 0xbfbd, 0xeb4d, 0xeb4b, 0xeb4e, 0xee53, 0xee40, 0xee45, 0xee52, 0xee44, 0xedfb, 0xee41, 0xc1a2, 0xedf4, 0xee4d, 0xee4f, 0xedf3, 0xc1a1, 0xee51, 0xee49, 0xc1a8, 0xee50, 0xee42, 0xc1aa, 0xedf9, 0xeb52, 0xee4a, 0xee47, 0xedf5, 0xee55, 0xc1a4, 0xc1a5, 0xedf7, 0xee48, 0xee54, 0xee4b, 0xedfd, 0xc1a7, 0xc1a3, 0xee4c, 0xedfe, 0xee56, 0xedf8, 0xee43, 0xee4e, 0xedfa, 0xedfc, 0xc2cb, 0xedf6, 0xc1a9, 0xc2c4, 0xc17e, 0xc1a6, 0xc2c8, 0xf0b3, 0xf0a9, 0xf0a4, 0xf0aa, 0xf0b4, 0xf0b8, 0xf0b7, 0xc2ca, 0xc2c9, 0xf0ab, 0xf0b9, 0xf0ae, 0xf0a6, 0xf0a8, 0xf0a7, 0xf0ad, 0xf0b2, 0xf0a5, 0xf0ac, 0xf0b1, 0xc2c7, 0xf0af, 0xc2c5, 0xf0b0, 0xc2c3, 0xc2c6, 0xf2d5, 0xf0b5, 0xc3c2, 0xf2cd, 0xf2d1, 0xf2c9, 0xf2cc, 0xf2d4, 0xc3c0, 0xf2d9, 0xf2d2, 0xf2ca, 0xf2da, 0xf2d3, 0xc3c3, 0xc3c4, 0xf2d7, 0xf2cb, 0xc3bf, 0xc3c1, 0xf2c6, 0xf2ce, 0xf2c8, 0xf2d8, 0xf2d6, 0xf2c7, 0xf2cf, 0xf4be, 0xc3c5, 0xf2d0, 0xc4a7, 0xc4a9, 0xc4a6, 0xf4c3, 0xf4bb, 0xf4b9, 0xf4bd, 0xf4ba, 0xf4bf, 0xf4c1, 0xc4aa, 0xc4ac, 0xf4c0, 0xc4ad, 0xc4ab, 0xf4c2, 0xc4a8, 0xc4f4, 0xf5f1, 0xf5f7, 0xc4f6, 0xf4bc, 0xf5f6, 0xf5fd, 0xf5f4, 0xf5fb, 0xf5fa, 0xf4b8, 0xf5f5, 0xf0b6, 0xf5fe, 0xf5f3, 0xf5f8, 0xf5fc, 0xf5f2, 0xf74a, 0xc4f5, 0xf5f9, 0xf7f4, 0xf74b, 0xf749, 0xf747, 0xf748, 0xf74c, 0xc5d9, 0xf7f2, 0xf7f0, 0xf7f5, 0xf7f3, 0xf7f6, 0xc5da, 0xf7f1, 0xf8bc, 0xf945, 0xf946, 0xf947, 0xf9c7, 0xf9bd, 0xca4f, 0xaaea, 0xad68, 0xd3b8, 0xd3b7, 0xb040, 0xb342, 0xd77c, 0xd77b, 0xb5ea, 0xb8b8, 0xb8b7, 0xb8b9, 0xe3d4, 0xe77e, 0xeb58, 0xeb5a, 0xeb59, 0xc1ab, 0xee57, 0xf0ba, 0xf9a5, 0xa6e4, 0xcdc9, 0xcdca, 0xcdc8, 0xcdc7, 0xaaeb, 0xd0a9, 0xd0a7, 0xd0a6, 0xad69, 0xad6b, 0xad6a, 0xd0a8, 0xd3c4, 0xd3c1, 0xd3bf, 0xb041, 0xd3c2, 0xb046, 0xd3bc, 0xd3cb, 0xd3cd, 0xd3bd, 0xb043, 0xd3ce, 0xd3c9, 0xd3bb, 0xd3c0, 0xd3ca, 0xd3c6, 0xd3c3, 0xb048, 0xd3cc, 0xd3be, 0xd3c7, 0xd3b9, 0xb047, 0xb044, 0xd3c5, 0xd3c8, 0xd3ba, 0xb045, 0xb042, 0xb34c, 0xd7a5, 0xb34b, 0xd7a8, 0xd7ab, 0xb348, 0xb346, 0xd77e, 0xd7a9, 0xd7a7, 0xd7a4, 0xd7ac, 0xd7ad, 0xd7af, 0xd7b0, 0xd77d, 0xb345, 0xd7a2, 0xd7a1, 0xd7ae, 0xb347, 0xd7a3, 0xb349, 0xb344, 0xd7a6, 0xb34d, 0xb34a, 0xd7aa, 0xb5f1, 0xdbbf, 0xdbb4, 0xb5ee, 0xdfe7, 0xdbbd, 0xdbb1, 0xb5ec, 0xdbb6, 0xb5ef, 0xdbba, 0xdbb8, 0xb5f2, 0xb5eb, 0xdbb2, 0xdbb5, 0xb5f0, 0xdbb3, 0xdbbe, 0xdbbc, 0xdbb7, 0xdbb9, 0xdbbb, 0xb5ed, 0xdfe8, 0xdfee, 0xdfe4, 0xdfea, 0xb8ba, 0xdfe6, 0xb8c0, 0xb8bf, 0xb8be, 0xdfed, 0xb8c1, 0xb8c2, 0xdfe3, 0xdff0, 0xb8c3, 0xb8bd, 0xb8bc, 0xdfec, 0xb8c4, 0xdfe2, 0xdfe5, 0xdfef, 0xdfeb, 0xe3f4, 0xe3e9, 0xb8bb, 0xbb6a, 0xe3dd, 0xe3f2, 0xe3de, 0xbb65, 0xe3db, 0xe3e4, 0xe3dc, 0xbb67, 0xe3d6, 0xe3f1, 0xbb68, 0xe3ee, 0xe3ef, 0xe3d7, 0xbb6d, 0xe3e6, 0xe3e0, 0xe3e7, 0xe3da, 0xe3f3, 0xe3eb, 0xe3e5, 0xe3d5, 0xbb69, 0xe3ec, 0xbb6c, 0xe3f0, 0xe3ea, 0xbb66, 0xe3e8, 0xe3e2, 0xbb64, 0xe3d9, 0xe3e1, 0xe3ed, 0xe3df, 0xe3e3, 0xbdc1, 0xdfe9, 0xe7b2, 0xe7bb, 0xe7b1, 0xe7ad, 0xe7aa, 0xbdc2, 0xe7a8, 0xbb6b, 0xe7a1, 0xbdc0, 0xe7a7, 0xbdbf, 0xe7ac, 0xe7a9, 0xe7b9, 0xe7b4, 0xe7ae, 0xe7b3, 0xbdbb, 0xe7ab, 0xe7be, 0xe7a2, 0xe7a3, 0xe7ba, 0xbdbc, 0xe7bf, 0xbdbe, 0xe7c0, 0xe7b0, 0xe3d8, 0xe7b6, 0xe7af, 0xe7b8, 0xe7b5, 0xe7a6, 0xbdb9, 0xe7bd, 0xbdba, 0xe7a4, 0xbdbd, 0xeb64, 0xe7b7, 0xe7bc, 0xeb61, 0xbdb8, 0xbfc0, 0xeb6b, 0xeb67, 0xeb65, 0xeb60, 0xeb6f, 0xbfc4, 0xeb5c, 0xeb68, 0xeb69, 0xeb5f, 0xeb5e, 0xeb6c, 0xeb62, 0xeb5d, 0xeb63, 0xeb6e, 0xeb5b, 0xeb6d, 0xeb6a, 0xbfc2, 0xbfc1, 0xbfc3, 0xeb66, 0xf0cb, 0xee59, 0xc1b1, 0xee5d, 0xee5a, 0xee61, 0xee67, 0xee5c, 0xee70, 0xc1ae, 0xee6a, 0xee5f, 0xee6b, 0xee66, 0xee6d, 0xee5e, 0xc1b3, 0xc1b2, 0xee60, 0xee6e, 0xee58, 0xee6c, 0xc1ac, 0xee64, 0xee63, 0xee68, 0xee5b, 0xc1b0, 0xc1b4, 0xee62, 0xee69, 0xc1b5, 0xee65, 0xc1ad, 0xc1af, 0xf0c7, 0xf0c5, 0xf0cc, 0xf0c9, 0xf0cd, 0xf0be, 0xf0c6, 0xf0d1, 0xee6f, 0xf0c2, 0xc2cf, 0xe7a5, 0xf0bd, 0xf0ca, 0xf0c4, 0xf0c1, 0xf0bc, 0xf0bb, 0xf0d0, 0xf0c0, 0xf0bf, 0xc2cd, 0xf0c8, 0xc2cc, 0xc2ce, 0xf0c3, 0xf0cf, 0xf2de, 0xf2df, 0xc3c9, 0xf2dc, 0xc3c6, 0xf2e4, 0xc3ca, 0xf2e6, 0xf2db, 0xf0ce, 0xf2e8, 0xf2dd, 0xc3c7, 0xf2e3, 0xf2e5, 0xf2e0, 0xf2e7, 0xf2e2, 0xf2e1, 0xc3c8, 0xf4c5, 0xf4c6, 0xf4c8, 0xc4ae, 0xc4af, 0xf4c9, 0xf4c7, 0xf4c4, 0xf642, 0xf645, 0xf641, 0xc4fa, 0xf643, 0xc4f9, 0xc4f8, 0xc4f7, 0xf644, 0xf751, 0xf74f, 0xf74e, 0xf640, 0xf750, 0xf646, 0xf74d, 0xf7f9, 0xf7d7, 0xf7f7, 0xc5db, 0xf7f8, 0xf7fa, 0xf8bf, 0xc5fa, 0xf8be, 0xf8bd, 0xc5fb, 0xc65a, 0xf96e, 0xf9a7, 0xf9a6, 0xf9a8, 0xa6e5, 0xd0aa, 0xd3cf, 0xd3d0, 0xdbc0, 0xf647, 0xf8c0, 0xa6e6, 0xad6c, 0xd0ab, 0xd7b1, 0xb34e, 0xdbc2, 0xdbc1, 0xb5f3, 0xb8c5, 0xe7c1, 0xbdc3, 0xbdc4, 0xbfc5, 0xc5fc, 0xa6e7, 0xd0ac, 0xaaed, 0xd0ae, 0xd0ad, 0xad6d, 0xd3d1, 0xd3d8, 0xb049, 0xd3d6, 0xd3d4, 0xd3db, 0xd3d2, 0xd3d3, 0xb04a, 0xb04e, 0xd3dc, 0xb04d, 0xd3da, 0xd3d7, 0xd3d5, 0xb04b, 0xb04c, 0xd3d9, 0xb350, 0xd7b2, 0xb355, 0xd7c2, 0xb354, 0xd7c4, 0xd7b8, 0xb352, 0xd7c3, 0xd7b3, 0xb353, 0xd7bf, 0xd7bb, 0xd7bd, 0xd7b7, 0xd7be, 0xb34f, 0xd7ba, 0xd7b9, 0xd7b5, 0xd7c0, 0xd7bc, 0xd7b4, 0xd7b6, 0xb351, 0xd7c1, 0xb5f6, 0xdbcd, 0xdbc9, 0xdbcb, 0xdbc6, 0xdbc5, 0xdbc3, 0xdbca, 0xdbcc, 0xdbc8, 0xdbc7, 0xb5f4, 0xb5f5, 0xdbcf, 0xb8cd, 0xdff2, 0xdff8, 0xdff3, 0xdff4, 0xdff9, 0xb8cf, 0xb8c7, 0xb8ce, 0xdff1, 0xdbc4, 0xb8ca, 0xb8c8, 0xdff7, 0xdff6, 0xb8c9, 0xb8cb, 0xdff5, 0xb8c6, 0xb8cc, 0xe3f6, 0xbb74, 0xe442, 0xe441, 0xe3fb, 0xbb76, 0xe440, 0xe3f7, 0xe3f8, 0xbb6e, 0xbb70, 0xe3fd, 0xe3f5, 0xbb72, 0xbb71, 0xe3f9, 0xe3fe, 0xe3fc, 0xbb73, 0xe3fa, 0xdbce, 0xbb6f, 0xe7c2, 0xe7c9, 0xbdc6, 0xe7cd, 0xbdca, 0xe7c5, 0xe7c3, 0xe7cc, 0xbdc5, 0xe7cb, 0xbdc7, 0xbdc8, 0xe7c4, 0xbdc9, 0xe7ca, 0xe7c6, 0xe7c7, 0xe7c8, 0xbb75, 0xeb70, 0xeb7c, 0xbfca, 0xeb77, 0xeb79, 0xbfc8, 0xeb71, 0xeb75, 0xeb78, 0xbfc6, 0xbfc9, 0xeb7b, 0xeb73, 0xeb74, 0xeb7a, 0xeb72, 0xeb76, 0xbfc7, 0xee72, 0xee71, 0xc1b7, 0xee77, 0xc1b9, 0xc1b6, 0xee73, 0xc1ba, 0xee74, 0xee75, 0xee78, 0xc1b8, 0xf0d6, 0xf0d9, 0xf0d3, 0xf0d5, 0xf0d4, 0xf0d7, 0xf0d8, 0xee76, 0xf0d2, 0xc3cd, 0xf2ec, 0xf2ef, 0xf2f1, 0xf2ea, 0xf2eb, 0xf2ee, 0xf2f0, 0xc3ce, 0xc3cc, 0xc3cb, 0xf2ed, 0xf2e9, 0xf4ca, 0xc4b0, 0xf4cb, 0xf649, 0xc4fb, 0xf64b, 0xc4fc, 0xf648, 0xf64a, 0xc5a8, 0xf752, 0xc5a7, 0xf7fd, 0xf7fc, 0xf7fb, 0xf948, 0xf949, 0xf94b, 0xf94a, 0xca50, 0xa6e8, 0xad6e, 0xd7c5, 0xb5f7, 0xdffa, 0xc2d0, 0xf2f2, 0xa8a3, 0xb357, 0xb356, 0xdbd0, 0xb5f8, 0xdbd2, 0xdbd1, 0xdffb, 0xb8d0, 0xe443, 0xe446, 0xe445, 0xe444, 0xe7ce, 0xe7d0, 0xe7cf, 0xbfcc, 0xbfcb, 0xc1bb, 0xee79, 0xee7b, 0xee7a, 0xc2d1, 0xf2f4, 0xf2f3, 0xf4cc, 0xc4b1, 0xc4fd, 0xf754, 0xf753, 0xc65b, 0xa8a4, 0xd0af, 0xad6f, 0xd7c8, 0xd7c6, 0xd7c7, 0xdbd4, 0xdbd5, 0xe043, 0xdbd3, 0xdffc, 0xe041, 0xe040, 0xe042, 0xb8d1, 0xdffe, 0xdffd, 0xe044, 0xe449, 0xe447, 0xe448, 0xe7d3, 0xe7d1, 0xe7d2, 0xeb7d, 0xee7c, 0xee7d, 0xc2d2, 0xf2f5, 0xf4cd, 0xc4b2, 0xf64c, 0xf755, 0xc5a9, 0xf7fe, 0xf94c, 0xa8a5, 0xad71, 0xad72, 0xd0b0, 0xd0b1, 0xad70, 0xb054, 0xb052, 0xb051, 0xb058, 0xb050, 0xb059, 0xd3dd, 0xb056, 0xb053, 0xb057, 0xb055, 0xb04f, 0xb35f, 0xb359, 0xd7cc, 0xb35e, 0xb360, 0xb35a, 0xb35b, 0xd7ca, 0xb358, 0xd7cb, 0xb35d, 0xd7c9, 0xb35c, 0xb644, 0xb646, 0xdbd8, 0xb645, 0xb5f9, 0xb5fd, 0xb8e4, 0xe049, 0xdbda, 0xb5fe, 0xdbdd, 0xdbde, 0xb643, 0xdbe0, 0xdbe2, 0xdbe3, 0xdbd7, 0xdbd6, 0xdbe4, 0xb642, 0xdbe1, 0xdbdf, 0xb640, 0xb5fb, 0xb647, 0xdbdb, 0xdbdc, 0xdbd9, 0xb641, 0xb5fc, 0xb5fa, 0xe048, 0xb8df, 0xb8da, 0xb8d5, 0xb8e5, 0xb8d6, 0xb8d2, 0xb8e1, 0xb8de, 0xb8e0, 0xb8d7, 0xb8dc, 0xb8d3, 0xb8d4, 0xe050, 0xe04d, 0xe045, 0xe04a, 0xb8e2, 0xe051, 0xb8e3, 0xb8d9, 0xe047, 0xe04f, 0xe04b, 0xe04e, 0xe04c, 0xb8dd, 0xe046, 0xb8d8, 0xe44c, 0xbb78, 0xbb7b, 0xe44e, 0xbba5, 0xe44d, 0xbb7d, 0xbdcf, 0xe44f, 0xbba4, 0xe44b, 0xbba6, 0xbb79, 0xb8db, 0xbb7c, 0xbb7a, 0xbb7e, 0xbba2, 0xbb77, 0xbba7, 0xbba3, 0xbba1, 0xe44a, 0xbdd6, 0xbdd2, 0xbdd9, 0xe7d6, 0xbdda, 0xe7e2, 0xe7db, 0xbdcb, 0xe7e3, 0xe7dd, 0xbdd5, 0xe7de, 0xbdd4, 0xe7e1, 0xbdce, 0xe7df, 0xe7d5, 0xbdcd, 0xebaa, 0xbdd3, 0xbdd0, 0xbdd8, 0xe7d4, 0xe7d8, 0xbdcc, 0xe7d7, 0xe7d9, 0xe7da, 0xbdd7, 0xe7dc, 0xe7e0, 0xe7e4, 0xbddb, 0xbfd2, 0xeba5, 0xebab, 0xeba8, 0xeb7e, 0xebac, 0xeba1, 0xeba7, 0xbfcd, 0xbfd3, 0xebad, 0xbfcf, 0xbfd9, 0xbfd4, 0xebaf, 0xeba9, 0xbfd0, 0xeba2, 0xbfda, 0xeba3, 0xeba4, 0xbfdb, 0xbfd8, 0xbdd1, 0xbfce, 0xebb0, 0xbfdc, 0xbfd5, 0xebae, 0xbfd1, 0xbfd6, 0xbfd7, 0xc1c3, 0xeea4, 0xeead, 0xeeaa, 0xeeac, 0xc1c0, 0xeea5, 0xeeab, 0xc1bc, 0xeea7, 0xc1c4, 0xeea3, 0xeea8, 0xeeaf, 0xeba6, 0xeea9, 0xeea2, 0xc1bd, 0xeea1, 0xc1be, 0xeeb0, 0xc1bf, 0xeeae, 0xc1c2, 0xee7e, 0xc1c1, 0xeea6, 0xf0dc, 0xf0ea, 0xf0e5, 0xf0e7, 0xf0db, 0xc2d3, 0xf0da, 0xc2d6, 0xc2d5, 0xf0e9, 0xf0e1, 0xf0de, 0xf0e4, 0xf0dd, 0xf0df, 0xf0e8, 0xf0e6, 0xc2d4, 0xf0ed, 0xf0eb, 0xf0e2, 0xf0ec, 0xf0e3, 0xf2f9, 0xc3cf, 0xf341, 0xf64f, 0xc3d6, 0xf0e0, 0xf2f7, 0xc3d2, 0xf2f8, 0xf2fd, 0xc3d4, 0xc3d5, 0xf2f6, 0xf340, 0xf342, 0xf2fa, 0xf2fc, 0xf2fe, 0xf2fb, 0xf343, 0xc3d1, 0xc3d7, 0xc3d3, 0xc3d0, 0xf4d0, 0xc4b7, 0xf4ce, 0xf4d2, 0xf4d3, 0xc4b5, 0xf4d4, 0xf4d1, 0xf4cf, 0xc4b8, 0xc4b4, 0xf4d5, 0xc4b6, 0xc4b3, 0xc4fe, 0xc540, 0xf64e, 0xf64d, 0xf650, 0xf651, 0xc541, 0xf756, 0xf75b, 0xc5aa, 0xf758, 0xf757, 0xf75a, 0xf759, 0xf843, 0xc5dc, 0xf842, 0xf840, 0xf841, 0xc5fe, 0xc5fd, 0xf8c1, 0xf8c2, 0xc640, 0xf94d, 0xf94e, 0xc667, 0xc66d, 0xf9a9, 0xf9c8, 0xa8a6, 0xd7cd, 0xd7ce, 0xe052, 0xe450, 0xe7e5, 0xc1c6, 0xc1c5, 0xf0ee, 0xf344, 0xf844, 0xa8a7, 0xd3de, 0xb05a, 0xb361, 0xe054, 0xe053, 0xbddc, 0xe7e6, 0xbddd, 0xeeb1, 0xc2d7, 0xc676, 0xa8a8, 0xcdcb, 0xd3df, 0xb362, 0xd7cf, 0xd7d0, 0xdbe5, 0xb648, 0xb8e6, 0xe056, 0xe055, 0xe057, 0xe451, 0xe452, 0xbba8, 0xbfdd, 0xbdde, 0xbfde, 0xeeb5, 0xeeb2, 0xeeb4, 0xeeb3, 0xc1c7, 0xf0ef, 0xf346, 0xf345, 0xcba4, 0xb05c, 0xb05b, 0xd3e0, 0xd7d1, 0xdbe7, 0xdbe6, 0xb649, 0xe059, 0xe05a, 0xe058, 0xb8e8, 0xb8e7, 0xbbaa, 0xbba9, 0xe7e7, 0xebb3, 0xebb1, 0xebb2, 0xbfdf, 0xeeb7, 0xeeb6, 0xf0f2, 0xf0f1, 0xf0f0, 0xf347, 0xf9aa, 0xa8a9, 0xad73, 0xad74, 0xb05d, 0xb05e, 0xd3e2, 0xd3e1, 0xd7d2, 0xb368, 0xb366, 0xb363, 0xb367, 0xb365, 0xb364, 0xb64a, 0xdbea, 0xb8ed, 0xb64c, 0xb651, 0xdbec, 0xb653, 0xb652, 0xb655, 0xdbeb, 0xdbe8, 0xb64f, 0xb64b, 0xb64d, 0xdbe9, 0xb654, 0xb650, 0xb64e, 0xb8ef, 0xb8ee, 0xb8ec, 0xb8f0, 0xb8ea, 0xb8eb, 0xb8e9, 0xe05b, 0xe454, 0xbbac, 0xbbad, 0xbbab, 0xe453, 0xe455, 0xe7ea, 0xe7ec, 0xbde7, 0xe7ed, 0xbde0, 0xe7e9, 0xbddf, 0xbde9, 0xbde5, 0xbde6, 0xbde2, 0xe7e8, 0xbde1, 0xe7ee, 0xe7eb, 0xbde8, 0xbde3, 0xbde4, 0xebb5, 0xebb7, 0xebb6, 0xebb8, 0xbfe0, 0xebb4, 0xc1cb, 0xeeb8, 0xc1c8, 0xc1cc, 0xc1ca, 0xc1c9, 0xf0f3, 0xf0f6, 0xf0f5, 0xf0f4, 0xc2d8, 0xf348, 0xf349, 0xc3d8, 0xf34a, 0xc3d9, 0xc4ba, 0xc4b9, 0xf652, 0xc542, 0xf653, 0xf75c, 0xc5ab, 0xc5ac, 0xf845, 0xc642, 0xa8aa, 0xb36a, 0xb369, 0xe05c, 0xe05d, 0xbbae, 0xebb9, 0xbdea, 0xebba, 0xeeb9, 0xa8ab, 0xd0b2, 0xad76, 0xad75, 0xd3e3, 0xb05f, 0xd3e4, 0xd7d5, 0xd7d4, 0xd7d3, 0xdbee, 0xb658, 0xdbed, 0xb657, 0xdbef, 0xb656, 0xe05f, 0xe062, 0xe060, 0xe061, 0xe065, 0xe05e, 0xe066, 0xe063, 0xe064, 0xbbb0, 0xe456, 0xbbaf, 0xe7f2, 0xe7f0, 0xbdeb, 0xe7ef, 0xe7f1, 0xbdec, 0xebbb, 0xebbc, 0xc1cd, 0xf34c, 0xf34e, 0xf34b, 0xf34d, 0xf4d6, 0xf654, 0xf96f, 0xa8ac, 0xad77, 0xd3e5, 0xd3e7, 0xd3e6, 0xd7d8, 0xb36c, 0xd7d6, 0xb36b, 0xd7d9, 0xd7da, 0xd7d7, 0xdbfb, 0xb660, 0xdbf3, 0xdbf9, 0xb65b, 0xb65e, 0xdbf2, 0xb659, 0xdbf6, 0xe06c, 0xb65d, 0xdbf1, 0xdbf7, 0xdbf4, 0xdbfa, 0xdbf0, 0xdbf8, 0xb65c, 0xb65f, 0xdbf5, 0xb65a, 0xb8f2, 0xe068, 0xb8f1, 0xe06f, 0xe06e, 0xb8f8, 0xb8f9, 0xe070, 0xb8f3, 0xe06d, 0xb8f7, 0xe072, 0xe069, 0xe06b, 0xb8f4, 0xe067, 0xe06a, 0xe071, 0xb8f5, 0xe073, 0xb8f6, 0xbbb1, 0xe45b, 0xe461, 0xe459, 0xe462, 0xe458, 0xe45d, 0xe463, 0xe460, 0xe45f, 0xe45e, 0xe457, 0xe45c, 0xe45a, 0xbdf1, 0xbdee, 0xe7fb, 0xe841, 0xe843, 0xe840, 0xe7f8, 0xe7fa, 0xe845, 0xe842, 0xe7fc, 0xe846, 0xe7f9, 0xe844, 0xbdef, 0xbdf5, 0xbdf3, 0xe7f3, 0xbdf4, 0xbdf0, 0xe7f4, 0xe7f6, 0xe7f5, 0xe7fd, 0xe7fe, 0xbdf2, 0xbded, 0xe7f7, 0xebc6, 0xbfe2, 0xebbd, 0xbfe3, 0xbfe6, 0xebc2, 0xebbf, 0xbfe5, 0xebc3, 0xebc4, 0xebbe, 0xebc7, 0xebc0, 0xebc5, 0xbfe4, 0xbfe1, 0xebc1, 0xeebf, 0xc1d0, 0xc1ce, 0xc1d1, 0xc1cf, 0xeebe, 0xeebb, 0xeeba, 0xeebd, 0xeebc, 0xf145, 0xc2de, 0xf0fb, 0xf0fa, 0xc2d9, 0xf141, 0xf140, 0xf0f7, 0xf143, 0xf0fc, 0xc2dd, 0xf0f9, 0xf142, 0xf0f8, 0xc2da, 0xc2dc, 0xf0fd, 0xc2db, 0xf0fe, 0xf144, 0xf352, 0xc3de, 0xf34f, 0xf353, 0xc3db, 0xf351, 0xc3e0, 0xc3dd, 0xf350, 0xc3df, 0xf354, 0xc3da, 0xc4bc, 0xc4be, 0xf4d9, 0xc4bd, 0xf4d7, 0xc3dc, 0xf4d8, 0xc4bb, 0xc543, 0xc545, 0xf656, 0xc544, 0xf655, 0xf761, 0xc5ad, 0xf760, 0xc5ae, 0xf75e, 0xf75d, 0xf762, 0xf763, 0xf846, 0xf75f, 0xf8c6, 0xf8c3, 0xf8c4, 0xf8c5, 0xc65c, 0xf951, 0xf950, 0xf94f, 0xf970, 0xf9be, 0xf9ab, 0xc66e, 0xa8ad, 0xb060, 0xb8fa, 0xbdf6, 0xebc8, 0xc2df, 0xf355, 0xf9ac, 0xa8ae, 0xaaee, 0xad79, 0xad78, 0xb063, 0xd3e8, 0xb061, 0xd3e9, 0xb062, 0xd7df, 0xd7db, 0xb36d, 0xd7de, 0xd7dd, 0xd7dc, 0xb36e, 0xd7e0, 0xd7e1, 0xdc43, 0xdc41, 0xdc45, 0xdc46, 0xdc4c, 0xdc48, 0xdc4a, 0xdc42, 0xdbfc, 0xdc49, 0xdc4b, 0xdc44, 0xdc47, 0xdbfd, 0xb662, 0xdc40, 0xdbfe, 0xb661, 0xb663, 0xb8fd, 0xe075, 0xe077, 0xe076, 0xe07b, 0xb8fb, 0xe078, 0xe074, 0xe079, 0xe07a, 0xb8fc, 0xb8fe, 0xe07c, 0xe467, 0xe466, 0xe464, 0xe465, 0xbbb3, 0xbbb5, 0xbbb2, 0xbbb4, 0xe84d, 0xe84e, 0xe849, 0xe84a, 0xbdf8, 0xbdfd, 0xbdf7, 0xbdfe, 0xbdf9, 0xe84b, 0xe84c, 0xe848, 0xbe40, 0xbdfb, 0xbdfa, 0xbdfc, 0xe847, 0xebca, 0xbfe8, 0xebcc, 0xbfea, 0xebcf, 0xebcb, 0xebc9, 0xebce, 0xbfe9, 0xebcd, 0xbfe7, 0xc1d3, 0xc1d6, 0xeec1, 0xc1d4, 0xeec0, 0xc1d2, 0xc1d5, 0xf146, 0xf147, 0xf148, 0xc2e0, 0xf149, 0xc2e1, 0xc3e2, 0xf358, 0xf359, 0xf357, 0xf356, 0xf35a, 0xc3e1, 0xf4dd, 0xf4db, 0xf4dc, 0xf4de, 0xf4da, 0xf4df, 0xf658, 0xf659, 0xf657, 0xc546, 0xf764, 0xc5af, 0xf765, 0xf848, 0xf847, 0xa8af, 0xb664, 0xb940, 0xbbb6, 0xbfec, 0xbfeb, 0xc3e3, 0xc47c, 0xc547, 0xa8b0, 0xb064, 0xb941, 0xf35b, 0xcba6, 0xa8b1, 0xa8b4, 0xa8b3, 0xa8b2, 0xcba5, 0xcdcd, 0xcdcf, 0xaaef, 0xaaf1, 0xcdcc, 0xcdce, 0xaaf0, 0xcdd1, 0xcdd0, 0xcdd2, 0xd0b6, 0xd0b4, 0xad7c, 0xd0b3, 0xada3, 0xad7e, 0xad7b, 0xada4, 0xad7d, 0xada2, 0xada1, 0xd0b5, 0xad7a, 0xb06a, 0xd3eb, 0xd3f1, 0xb067, 0xb06e, 0xb069, 0xd3ee, 0xd3f0, 0xb06c, 0xd3ea, 0xd3ed, 0xb068, 0xb065, 0xd3ec, 0xb06b, 0xd3ef, 0xb06d, 0xb066, 0xd7e3, 0xd7e6, 0xb370, 0xb37a, 0xb376, 0xd7e4, 0xb37e, 0xb377, 0xb37c, 0xb372, 0xb36f, 0xb371, 0xb37d, 0xd7e5, 0xb375, 0xb378, 0xb374, 0xb379, 0xd7e7, 0xb37b, 0xb373, 0xd7e2, 0xdc4d, 0xb665, 0xdc4f, 0xb667, 0xb669, 0xdc4e, 0xb666, 0xb66a, 0xb668, 0xb947, 0xe0a3, 0xb94f, 0xe07e, 0xb950, 0xb945, 0xe0a1, 0xb94a, 0xe0a2, 0xb943, 0xb942, 0xb94d, 0xb94c, 0xb94b, 0xb949, 0xb94e, 0xe07d, 0xb944, 0xb946, 0xb948, 0xbbb8, 0xbbbb, 0xbbbf, 0xbbb9, 0xbbbe, 0xbbbc, 0xbbb7, 0xbbbd, 0xbbba, 0xe852, 0xbe43, 0xbe41, 0xe853, 0xbe44, 0xbe42, 0xe851, 0xe850, 0xbff0, 0xe84f, 0xbfee, 0xbfed, 0xebd0, 0xbe45, 0xbfef, 0xebd1, 0xbff2, 0xebd2, 0xbff1, 0xc1d8, 0xeec3, 0xc1d7, 0xc1dc, 0xc1da, 0xc1db, 0xc2e3, 0xc1d9, 0xeec2, 0xebd3, 0xc2e2, 0xc2e4, 0xc3e4, 0xc3e5, 0xf4e0, 0xc5de, 0xc5dd, 0xa8b6, 0xca55, 0xb06f, 0xca52, 0xca53, 0xca51, 0xca54, 0xcbaa, 0xcba7, 0xcbac, 0xcba8, 0xa8b7, 0xa8ba, 0xcba9, 0xa8b9, 0xcbab, 0xa8b8, 0xcdd5, 0xcdd7, 0xaaf4, 0xcdd3, 0xcdd6, 0xcdd4, 0xaaf2, 0xaaf5, 0xaaf3, 0xd0b8, 0xd0bc, 0xd0b9, 0xada7, 0xada8, 0xd0bb, 0xd0bd, 0xd0bf, 0xada5, 0xd0be, 0xada6, 0xd7ee, 0xd0ba, 0xd3f2, 0xd3fb, 0xd3f9, 0xd3f4, 0xd3f5, 0xd3fa, 0xd3fc, 0xb071, 0xd3f7, 0xd3f3, 0xb070, 0xb072, 0xd3f6, 0xd3fd, 0xd3f8, 0xb3a1, 0xd7f1, 0xd7e9, 0xd7ef, 0xd7f0, 0xb3a2, 0xd7e8, 0xd7ea, 0xd0b7, 0xd7ec, 0xd7ed, 0xd7eb, 0xb66c, 0xdc56, 0xebd4, 0xdc57, 0xdc54, 0xb3a3, 0xb66e, 0xdc53, 0xdc59, 0xdc58, 0xb66b, 0xdc5c, 0xdc52, 0xdc5b, 0xdc50, 0xdc5a, 0xdc55, 0xb66d, 0xe0aa, 0xe0a5, 0xe0ab, 0xe0a6, 0xe0a4, 0xe0a7, 0xb951, 0xe0a9, 0xe0a8, 0xb952, 0xbbc1, 0xbbc0, 0xe46e, 0xe471, 0xe469, 0xe46d, 0xbbc2, 0xe46c, 0xe46a, 0xe470, 0xe46b, 0xe468, 0xe46f, 0xe859, 0xbe48, 0xf14a, 0xe856, 0xe857, 0xe855, 0xdc51, 0xbe47, 0xe85a, 0xe854, 0xbe46, 0xbe49, 0xe858, 0xebd5, 0xbff3, 0xebd6, 0xebd7, 0xeec4, 0xc1dd, 0xf14b, 0xf14c, 0xf14d, 0xf35d, 0xf35c, 0xf4e2, 0xf4e1, 0xf65b, 0xf65c, 0xf65a, 0xf766, 0xc5b0, 0xa8bb, 0xadaa, 0xada9, 0xb075, 0xb074, 0xd440, 0xd441, 0xd3fe, 0xb073, 0xd7f5, 0xd7f6, 0xd7f2, 0xb3a4, 0xd7f3, 0xd7f4, 0xdc5f, 0xdc61, 0xdc5d, 0xdc60, 0xb66f, 0xdc5e, 0xb670, 0xdd73, 0xb955, 0xb954, 0xb953, 0xe0ac, 0xe0ad, 0xe473, 0xe475, 0xbbc6, 0xbbc3, 0xbbc5, 0xbbc4, 0xe474, 0xe472, 0xe861, 0xe85e, 0xe85f, 0xbe4d, 0xe860, 0xe85b, 0xe85c, 0xbe4a, 0xbe4b, 0xe85d, 0xbe4c, 0xebdb, 0xebdc, 0xebd9, 0xebda, 0xbff4, 0xebd8, 0xeec8, 0xeec5, 0xeec7, 0xc1e0, 0xeecb, 0xc1df, 0xeec9, 0xeecc, 0xeeca, 0xeec6, 0xc1de, 0xf14f, 0xf150, 0xf14e, 0xf152, 0xc2e5, 0xc2e6, 0xf35f, 0xc3e7, 0xf151, 0xf35e, 0xc3e6, 0xf4e5, 0xf4e6, 0xc4bf, 0xf4e4, 0xf4e3, 0xf65d, 0xc548, 0xf849, 0xf8c8, 0xf8c7, 0xc643, 0xc65d, 0xf8c9, 0xf971, 0xc66f, 0xa8bc, 0xaaf6, 0xb956, 0xc4c0, 0xa8bd, 0xadab, 0xb3a5, 0xb671, 0xc2e7, 0xaaf7, 0xd0c1, 0xd0c0, 0xd442, 0xb078, 0xb076, 0xb07a, 0xd444, 0xb079, 0xb077, 0xd443, 0xb3a8, 0xd7fc, 0xb3a7, 0xb3a9, 0xd842, 0xb3ab, 0xd7fe, 0xd840, 0xd7f7, 0xb3aa, 0xd843, 0xd7f9, 0xd7fa, 0xd7f8, 0xb3a6, 0xd841, 0xd7fb, 0xd7fd, 0xdc6d, 0xdc6c, 0xdc6a, 0xdc62, 0xdc71, 0xdc65, 0xdc6f, 0xdc76, 0xdc6e, 0xb679, 0xb675, 0xdc63, 0xdc69, 0xb677, 0xdc68, 0xb678, 0xb67a, 0xdc6b, 0xb672, 0xb673, 0xdc77, 0xdc75, 0xdc74, 0xdc66, 0xdc72, 0xb676, 0xb674, 0xdc73, 0xdc64, 0xdc67, 0xdc70, 0xe4ba, 0xe0b7, 0xe0b0, 0xe0c3, 0xe0cc, 0xe0b3, 0xb961, 0xe0c0, 0xb957, 0xb959, 0xb965, 0xe0b1, 0xb95a, 0xb95c, 0xb966, 0xb95b, 0xb964, 0xe0b9, 0xe0ae, 0xb962, 0xe0b8, 0xb95e, 0xe0ca, 0xb963, 0xe0c8, 0xe0bc, 0xe0c6, 0xb960, 0xe0af, 0xe0c9, 0xe0c4, 0xe0cb, 0xb958, 0xb967, 0xb95d, 0xe0b5, 0xe0bd, 0xe0c1, 0xe0c5, 0xb95f, 0xe0b4, 0xe0b2, 0xe0be, 0xe0bb, 0xe0ba, 0xe0bf, 0xe0c2, 0xe0c7, 0xe478, 0xbbc7, 0xe4a4, 0xe47a, 0xbbcc, 0xbbd0, 0xe4ad, 0xe4b5, 0xe4a6, 0xbbc8, 0xe4aa, 0xe0b6, 0xbbc9, 0xe4b1, 0xe4b6, 0xe4ae, 0xe4b0, 0xe4b9, 0xe4b2, 0xe47e, 0xe4a9, 0xbbd1, 0xbbcd, 0xe47c, 0xe4ab, 0xbbcb, 0xe4a5, 0xbbca, 0xe4b3, 0xe4a2, 0xe479, 0xbbce, 0xe4b8, 0xe47b, 0xe4af, 0xe4ac, 0xe4a7, 0xe477, 0xe476, 0xe4a1, 0xe4b4, 0xbbcf, 0xe4b7, 0xe47d, 0xe4a3, 0xbe52, 0xbe5a, 0xbe55, 0xe8a4, 0xe8a1, 0xe867, 0xbe50, 0xbe4f, 0xbe56, 0xe865, 0xbe54, 0xe871, 0xe863, 0xe864, 0xbe4e, 0xe8a3, 0xbe58, 0xe874, 0xe879, 0xe873, 0xebee, 0xe86f, 0xe877, 0xe875, 0xe868, 0xe862, 0xe87d, 0xbe57, 0xe87e, 0xe878, 0xe86d, 0xe86b, 0xe866, 0xe86e, 0xe87b, 0xe86a, 0xe87a, 0xe8a2, 0xbe53, 0xe876, 0xe87c, 0xe872, 0xe86c, 0xbe51, 0xe4a8, 0xe870, 0xbe59, 0xe869, 0xebf4, 0xbff7, 0xebf3, 0xebf0, 0xec44, 0xbffb, 0xec41, 0xebf8, 0xec43, 0xebe9, 0xebf6, 0xbffd, 0xebe1, 0xebdf, 0xec42, 0xec40, 0xebfe, 0xebed, 0xebec, 0xebe2, 0xc040, 0xebe8, 0xebf2, 0xebfd, 0xc043, 0xec45, 0xc1e8, 0xc045, 0xbffe, 0xebe6, 0xebef, 0xebde, 0xebe0, 0xbff5, 0xc042, 0xbffa, 0xebe7, 0xebf7, 0xebf1, 0xc041, 0xebdd, 0xc1e3, 0xebf9, 0xebfc, 0xbffc, 0xebeb, 0xc044, 0xbff9, 0xbff8, 0xebf5, 0xebfb, 0xbff6, 0xebe4, 0xebfa, 0xebe5, 0xebea, 0xeed2, 0xeed7, 0xc1e5, 0xc1e7, 0xeedd, 0xc1e1, 0xeeec, 0xeee3, 0xeed8, 0xeed9, 0xeee2, 0xc1ee, 0xeee1, 0xeed1, 0xeee0, 0xeed4, 0xeeed, 0xc1ed, 0xc1eb, 0xeed5, 0xeee8, 0xeeda, 0xeee7, 0xeee9, 0xeed0, 0xc1e6, 0xeeea, 0xeede, 0xc1ea, 0xeedb, 0xc1ec, 0xeee4, 0xc1e4, 0xeed6, 0xeee5, 0xeedf, 0xebe3, 0xeee6, 0xeed3, 0xc1e9, 0xeeeb, 0xc1e2, 0xeece, 0xf160, 0xf159, 0xc2e9, 0xf154, 0xf163, 0xf15b, 0xeedc, 0xf165, 0xf155, 0xc2e8, 0xf15f, 0xc2ea, 0xc2f2, 0xc2f0, 0xf161, 0xc2f1, 0xf157, 0xf158, 0xf15d, 0xf162, 0xeecd, 0xc2eb, 0xf16a, 0xf167, 0xf16b, 0xf15e, 0xf15a, 0xf168, 0xf36a, 0xf15c, 0xc2ee, 0xc2ed, 0xeecf, 0xc2ef, 0xf164, 0xf166, 0xc2ec, 0xf169, 0xf153, 0xf156, 0xf373, 0xf363, 0xc3eb, 0xf371, 0xf361, 0xc3ec, 0xf36c, 0xf368, 0xc3f1, 0xf372, 0xf362, 0xf365, 0xc3e9, 0xf374, 0xf36d, 0xf370, 0xc3ef, 0xc3f4, 0xc3f2, 0xf369, 0xf364, 0xc3ed, 0xc3ee, 0xf360, 0xc3ea, 0xc3e8, 0xc3f0, 0xf36f, 0xc3f3, 0xf36b, 0xf375, 0xc3f5, 0xf367, 0xf36e, 0xf4f3, 0xf542, 0xf4f5, 0xf4fc, 0xf366, 0xf4fa, 0xf4e9, 0xf540, 0xc4c3, 0xf4ed, 0xf4fe, 0xf4f4, 0xc4c2, 0xf544, 0xf4f6, 0xf4fb, 0xf4fd, 0xf4e7, 0xf541, 0xf4f2, 0xf4f7, 0xf4eb, 0xf4ef, 0xf543, 0xf4f9, 0xf4e8, 0xf4ec, 0xf4ee, 0xf4f8, 0xc4c1, 0xf4f1, 0xf4ea, 0xf4f0, 0xf661, 0xf666, 0xc54f, 0xf668, 0xc549, 0xf664, 0xf66a, 0xc54e, 0xc54a, 0xc54b, 0xf660, 0xf667, 0xc54d, 0xf665, 0xc54c, 0xf65f, 0xf663, 0xf662, 0xf65e, 0xf669, 0xc5b1, 0xf76d, 0xf770, 0xf76c, 0xf76e, 0xf76f, 0xf769, 0xf76a, 0xf767, 0xf76b, 0xf768, 0xc5b2, 0xc5b3, 0xf84b, 0xf84d, 0xf84c, 0xf84e, 0xc5e0, 0xf84a, 0xc5df, 0xc5e1, 0xf8cb, 0xf8cc, 0xc644, 0xf8ca, 0xf953, 0xf952, 0xf954, 0xc65f, 0xf955, 0xc65e, 0xf956, 0xf972, 0xf975, 0xf974, 0xc668, 0xf973, 0xc672, 0xc670, 0xc671, 0xc677, 0xf9c0, 0xf9c1, 0xf9bf, 0xf9c9, 0xaaf8, 0xd844, 0xdc78, 0xe8a5, 0xf376, 0xaaf9, 0xadac, 0xb07b, 0xd845, 0xd846, 0xb3ac, 0xb67d, 0xdc7a, 0xdc79, 0xb6a3, 0xb67c, 0xdc7b, 0xb67e, 0xb6a2, 0xb6a1, 0xb67b, 0xb968, 0xe0d0, 0xe0ce, 0xe0cf, 0xe0cd, 0xbbd2, 0xbbd5, 0xbbd7, 0xbbd6, 0xbbd3, 0xbbd4, 0xe8a7, 0xe8a6, 0xbe5b, 0xe8a8, 0xe8a9, 0xbe5c, 0xec4d, 0xec4b, 0xeef3, 0xec49, 0xec4a, 0xc046, 0xec46, 0xec4e, 0xec48, 0xec4c, 0xeeef, 0xeef1, 0xeef2, 0xc1f3, 0xeeee, 0xc1f2, 0xeef0, 0xc1ef, 0xc1f0, 0xc1f1, 0xec47, 0xc2f5, 0xf16e, 0xf16c, 0xf16d, 0xc2f3, 0xc2f6, 0xc2f4, 0xf377, 0xf378, 0xc3f6, 0xf545, 0xf547, 0xf546, 0xc4c4, 0xc550, 0xf66d, 0xf66c, 0xf66b, 0xaafa, 0xc9aa, 0xca58, 0xa6e9, 0xca56, 0xca59, 0xca57, 0xcbae, 0xa8c1, 0xa8c2, 0xcbb0, 0xa8bf, 0xcbaf, 0xcbad, 0xa8c0, 0xa8be, 0xcdd8, 0xcddb, 0xaafd, 0xcdda, 0xcdd9, 0xaafc, 0xaafb, 0xab40, 0xcddc, 0xaafe, 0xd0c6, 0xadae, 0xadaf, 0xadb0, 0xd0c7, 0xd0c3, 0xadad, 0xd0c4, 0xd0c5, 0xd0c2, 0xb0a4, 0xb0a1, 0xd445, 0xb0a2, 0xb0a5, 0xd446, 0xb07e, 0xb07c, 0xb07d, 0xb0a3, 0xb3ad, 0xd849, 0xb3b5, 0xd848, 0xd84b, 0xb3b1, 0xd84a, 0xb6ab, 0xb3af, 0xb3b2, 0xb3ae, 0xb3b3, 0xb3b4, 0xb3b0, 0xd847, 0xb6a7, 0xdc7d, 0xdca3, 0xdca2, 0xb6ac, 0xb6a8, 0xb6a9, 0xdc7c, 0xdc7e, 0xdca1, 0xb6a4, 0xb6a6, 0xb6aa, 0xb6a5, 0xe0d3, 0xe0d1, 0xe0d2, 0xb96a, 0xb96b, 0xe0d4, 0xb969, 0xbbd8, 0xbbda, 0xbbd9, 0xe4bb, 0xe4bc, 0xe8ab, 0xe8aa, 0xc047, 0xc048, 0xec4f, 0xc049, 0xeef6, 0xeef4, 0xeef5, 0xc1f4, 0xf16f, 0xc3f7, 0xc1f5, 0xab41, 0xb0a6, 0xd447, 0xd84c, 0xb3b6, 0xb6ad, 0xdca4, 0xdca6, 0xb6af, 0xb6ae, 0xb6b0, 0xb6b1, 0xdca5, 0xb96e, 0xb96f, 0xb96d, 0xbbdb, 0xb96c, 0xe0d5, 0xbbdc, 0xe8ac, 0xec50, 0xc04a, 0xc1f6, 0xf170, 0xf174, 0xc2f9, 0xf171, 0xc2fa, 0xc2f8, 0xf175, 0xc2fb, 0xf173, 0xf379, 0xc2f7, 0xc3f8, 0xf8cd, 0xab42, 0xb3b8, 0xb3b7, 0xb6b2, 0xdca8, 0xdca7, 0xb6b3, 0xe0d9, 0xb973, 0xb970, 0xe0d8, 0xb972, 0xe0d6, 0xb971, 0xe0d7, 0xe4bd, 0xbbdd, 0xe8af, 0xbe5d, 0xe8ad, 0xbe5e, 0xbe5f, 0xe8ae, 0xbe60, 0xec51, 0xc04e, 0xc04b, 0xc050, 0xec53, 0xc04c, 0xec52, 0xc04f, 0xc04d, 0xeef9, 0xeefb, 0xc1f7, 0xeefa, 0xc1f8, 0xeef8, 0xeef7, 0xf177, 0xf176, 0xc2fc, 0xf178, 0xf37e, 0xc3fa, 0xf37d, 0xf37a, 0xc3f9, 0xf37b, 0xf37c, 0xf548, 0xf549, 0xc4c5, 0xc553, 0xf66e, 0xc551, 0xc552, 0xf66f, 0xc5b4, 0xc5b5, 0xf771, 0xc645, 0xf8cf, 0xc647, 0xf8ce, 0xf8d0, 0xc646, 0xf957, 0xf9ad, 0xab43, 0xb974, 0xe4be, 0xe8b0, 0xc051, 0xc052, 0xab44, 0xbe61, 0xc3fb, 0xadb1, 0xc053, 0xc5e2, 0xadb2, 0xd84d, 0xdca9, 0xdcab, 0xdcaa, 0xe0dd, 0xe0da, 0xb975, 0xb976, 0xe0db, 0xe0dc, 0xe4c0, 0xe4c5, 0xbbde, 0xe4bf, 0xe4c1, 0xe4c8, 0xe4c3, 0xe4c7, 0xe4c4, 0xe4c2, 0xe4c6, 0xbbdf, 0xe8b3, 0xe8b1, 0xbe63, 0xbe62, 0xe8b2, 0xbe64, 0xec56, 0xec55, 0xc054, 0xec54, 0xeefc, 0xeefe, 0xef41, 0xef40, 0xc1f9, 0xeefd, 0xf1a1, 0xc2fd, 0xf17d, 0xf1a2, 0xc2fe, 0xf17b, 0xf17e, 0xf17c, 0xf179, 0xc340, 0xf17a, 0xf3a1, 0xf3a3, 0xf3a2, 0xf54a, 0xf54b, 0xf670, 0xc5b7, 0xc5b6, 0xf84f, 0xf850, 0xc648, 0xf8d1, 0xc669, 0xadb3, 0xb6b4, 0xe4ca, 0xe4c9, 0xe8b5, 0xe8b4, 0xc1fa, 0xef43, 0xef42, 0xf1a5, 0xf1a3, 0xf1a6, 0xf1a4, 0xc3fc, 0xf3a4, 0xf3a5, 0xf3a6, 0xf671, 0xf772, 0xf8d2, 0xadb4, 0xec57, 0xef44, 0xadb5, 0xbbe0, 0xec58, 0xc341, 0xf1a7, 0xc3fd, 0xf54c, 0xf54d, 0xc554, 0xf851, 0xadb6, 0xb3bb, 0xb3bc, 0xd84e, 0xb6b5, 0xb6b6, 0xdcac, 0xb6b7, 0xb97a, 0xb97c, 0xe0df, 0xe0e0, 0xe0de, 0xb977, 0xb978, 0xb97b, 0xb979, 0xe4cb, 0xbbe1, 0xbbe2, 0xe8bc, 0xbe67, 0xe8b7, 0xe8b6, 0xe8bb, 0xbe65, 0xc05b, 0xe8b8, 0xe8bd, 0xe8ba, 0xe8b9, 0xbe66, 0xc059, 0xec5a, 0xc055, 0xec5b, 0xec59, 0xc058, 0xc056, 0xc05a, 0xc057, 0xef45, 0xef4a, 0xef46, 0xef49, 0xc1fb, 0xedd4, 0xef48, 0xef47, 0xc344, 0xc342, 0xc345, 0xc343, 0xf1a8, 0xf1a9, 0xf1aa, 0xc346, 0xf3aa, 0xc440, 0xf3a8, 0xc441, 0xf3a7, 0xf3a9, 0xc3fe, 0xf551, 0xf54e, 0xf54f, 0xf550, 0xf672, 0xc556, 0xc555, 0xf774, 0xf773, 0xc5b8, 0xc5e3, 0xc649, 0xc660, 0xf958, 0xf9ae, 0xf9af, 0xadb7, 0xdcad, 0xe0e1, 0xe4cc, 0xe4cd, 0xbbe3, 0xbbe4, 0xe8be, 0xbe68, 0xc1fc, 0xf1ab, 0xc347, 0xf3ad, 0xc442, 0xf3ac, 0xf3ae, 0xf3ab, 0xf675, 0xf552, 0xf553, 0xc4c6, 0xf674, 0xf673, 0xf775, 0xf9b0, 0xadb8, 0xadb9, 0xb0a7, 0xd448, 0xd84f, 0xb6b8, 0xb6bb, 0xb6b9, 0xdcae, 0xb6bd, 0xb6ba, 0xb6bc, 0xb97e, 0xe0e2, 0xe0e3, 0xe8c0, 0xb97d, 0xb9a1, 0xb9a2, 0xe4cf, 0xe4ce, 0xbbe5, 0xbbe6, 0xe4d0, 0xe8bf, 0xbbe8, 0xbe69, 0xbbe7, 0xc05c, 0xe8c1, 0xbe6b, 0xbe6a, 0xe8c2, 0xe8c5, 0xe8c3, 0xe8c4, 0xbe6c, 0xc061, 0xc05f, 0xc05e, 0xec5d, 0xc060, 0xec5c, 0xef4b, 0xec5e, 0xc05d, 0xec5f, 0xef4e, 0xef4c, 0xef4d, 0xef52, 0xc34b, 0xef51, 0xef54, 0xef53, 0xef50, 0xef4f, 0xc1fd, 0xf1ae, 0xf1ad, 0xc34a, 0xc348, 0xc349, 0xf1ac, 0xf3b1, 0xc443, 0xf3b0, 0xf3af, 0xc444, 0xf558, 0xf557, 0xf555, 0xf554, 0xc4c8, 0xc4c7, 0xf559, 0xf776, 0xc5b9, 0xf677, 0xc557, 0xf676, 0xf556, 0xf777, 0xc5e4, 0xc661, 0xf959, 0xf9b1, 0xadba, 0xd850, 0xef55, 0xadbb, 0xe4d2, 0xe4d1, 0xec60, 0xef57, 0xef56, 0xc34c, 0xf3b2, 0xf3b3, 0xc4c9, 0xf9b2, 0xb0a8, 0xb6bf, 0xb6be, 0xe0e4, 0xe0e6, 0xb9a4, 0xe0e5, 0xb9a3, 0xb9a5, 0xe0e7, 0xe4d4, 0xe4d6, 0xe4d5, 0xe4d8, 0xbbe9, 0xe4d7, 0xe4d3, 0xe4d9, 0xe8cc, 0xe8cf, 0xe8d1, 0xe8c7, 0xe8cb, 0xe8c8, 0xbe6e, 0xbe71, 0xbe73, 0xe8c9, 0xe8ca, 0xbe72, 0xe8cd, 0xe8d0, 0xe8ce, 0xbe74, 0xbe70, 0xe8c6, 0xbe6d, 0xbe6f, 0xc063, 0xec66, 0xec64, 0xec63, 0xec69, 0xec68, 0xec67, 0xec62, 0xc062, 0xec61, 0xec65, 0xc064, 0xef5a, 0xef5e, 0xef5b, 0xef5d, 0xef5c, 0xef59, 0xef5f, 0xef62, 0xef60, 0xef61, 0xc240, 0xc1fe, 0xef58, 0xef63, 0xf1b3, 0xf1b6, 0xf1b8, 0xf1b7, 0xf1b1, 0xf1b5, 0xf1b0, 0xf1b2, 0xc34d, 0xf1af, 0xf1b4, 0xf3c0, 0xf3b5, 0xc445, 0xc446, 0xf3b4, 0xf3b9, 0xf3bf, 0xf3b7, 0xf3be, 0xf3bb, 0xf3ba, 0xf3bd, 0xf3b8, 0xf3b6, 0xf3bc, 0xf560, 0xf55e, 0xc4ca, 0xf55d, 0xf563, 0xf561, 0xc4cb, 0xf55c, 0xf55a, 0xf55b, 0xc4cd, 0xf55f, 0xc4cc, 0xf562, 0xf678, 0xf67e, 0xf679, 0xc55b, 0xf6a1, 0xc55a, 0xf67d, 0xf67c, 0xc559, 0xf67b, 0xc558, 0xf67a, 0xf77d, 0xf7a1, 0xf77e, 0xf77b, 0xc5bb, 0xf778, 0xf77c, 0xf7a3, 0xf7a2, 0xf779, 0xf77a, 0xc5ba, 0xf852, 0xc5e7, 0xf853, 0xc5e5, 0xc5e6, 0xf8d3, 0xc64a, 0xf976, 0xc66a, 0xf9b3, 0xc66b, 0xf9b4, 0xf9b5, 0xf9c3, 0xf9c2, 0xc67a, 0xf9cd, 0xb0a9, 0xe0e9, 0xe0e8, 0xbbea, 0xbbeb, 0xe4da, 0xe8d2, 0xec6c, 0xbe75, 0xc065, 0xec6a, 0xec6d, 0xc066, 0xef64, 0xec6b, 0xf1b9, 0xc34e, 0xf3c1, 0xf566, 0xf564, 0xf565, 0xf6a2, 0xc55c, 0xf7a4, 0xc5ea, 0xc5bc, 0xc5e8, 0xc5e9, 0xf8d4, 0xc662, 0xb0aa, 0xf1ba, 0xd449, 0xb9a6, 0xe4db, 0xbbec, 0xe4dc, 0xe8d4, 0xe8d3, 0xc068, 0xbe76, 0xbe77, 0xe8d7, 0xe8d6, 0xe8d5, 0xec6e, 0xec71, 0xec70, 0xec6f, 0xc067, 0xef68, 0xef66, 0xef65, 0xef67, 0xc34f, 0xf1bc, 0xf1bd, 0xc350, 0xf1bb, 0xf3c3, 0xf3c2, 0xf3c5, 0xc447, 0xf3c4, 0xf567, 0xf569, 0xf568, 0xf6a3, 0xf6a6, 0xf6a4, 0xf6a5, 0xf7a5, 0xc5bd, 0xf854, 0xf855, 0xf856, 0xc64b, 0xc663, 0xf9b6, 0xb0ab, 0xbe78, 0xc069, 0xf1be, 0xf7a6, 0xf9c4, 0xd44a, 0xc67b, 0xb0ac, 0xec72, 0xf1bf, 0xf3c6, 0xf6a7, 0xf7a7, 0xb0ad, 0xe4dd, 0xe4de, 0xbbed, 0xbbee, 0xe8d9, 0xbe7a, 0xbe79, 0xe8d8, 0xef69, 0xf1c0, 0xf1c2, 0xf1c1, 0xc353, 0xc352, 0xc351, 0xc55e, 0xf6a8, 0xc55d, 0xf7a9, 0xf7a8, 0xc64c, 0xf8d5, 0xb3bd, 0xe0ea, 0xe4e1, 0xe4df, 0xe4e0, 0xe8e2, 0xe8dd, 0xe8da, 0xe8e1, 0xe8e3, 0xbe7c, 0xe8e0, 0xe8dc, 0xe8db, 0xe8df, 0xe8de, 0xbe7b, 0xec7d, 0xec78, 0xec76, 0xeca1, 0xec77, 0xec73, 0xec79, 0xec74, 0xef72, 0xec75, 0xeca2, 0xec7c, 0xc06a, 0xec7b, 0xec7a, 0xec7e, 0xef6a, 0xef6d, 0xef6c, 0xef74, 0xef6f, 0xef73, 0xef71, 0xef70, 0xef6e, 0xef6b, 0xc243, 0xc242, 0xc244, 0xc241, 0xef75, 0xf1c8, 0xf1cb, 0xf1c9, 0xf1cd, 0xf1ce, 0xf1c6, 0xc358, 0xf1c7, 0xf1c5, 0xf1cc, 0xf1c4, 0xf1c3, 0xc357, 0xc355, 0xc354, 0xf1ca, 0xf3cf, 0xf3d5, 0xc44a, 0xf3d0, 0xf3d3, 0xf3d7, 0xc44b, 0xf3d2, 0xf3ca, 0xf3c9, 0xf3d6, 0xf3cd, 0xf3cb, 0xf3d4, 0xf3cc, 0xc449, 0xc448, 0xf3c7, 0xf3c8, 0xf3d1, 0xf3ce, 0xf56c, 0xf56f, 0xc356, 0xf56d, 0xf573, 0xf571, 0xf56b, 0xf576, 0xf56a, 0xc4cf, 0xf572, 0xf56e, 0xc4ce, 0xf575, 0xf574, 0xf6ab, 0xf6aa, 0xf6b1, 0xf6ad, 0xf6b0, 0xc560, 0xf6ae, 0xf6af, 0xf6a9, 0xf6ac, 0xc55f, 0xc5bf, 0xf7b4, 0xf7af, 0xf7b3, 0xf7b6, 0xf7b2, 0xf7ae, 0xc5c1, 0xf7b1, 0xf7b5, 0xc5c0, 0xf7ac, 0xf570, 0xf7b0, 0xf7ad, 0xf7aa, 0xf7ab, 0xc5be, 0xf85a, 0xf85c, 0xf85f, 0xf85b, 0xf860, 0xf859, 0xf857, 0xc5eb, 0xf85d, 0xc5ed, 0xc5ec, 0xf858, 0xf85e, 0xf8da, 0xc64d, 0xf8db, 0xf8d9, 0xf8d6, 0xf8d8, 0xf8d7, 0xf95a, 0xf95c, 0xf95b, 0xf979, 0xf978, 0xf977, 0xf97a, 0xc673, 0xc674, 0xf9ca, 0xf9ce, 0xb3be, 0xdcaf, 0xe0ed, 0xb9a7, 0xe0eb, 0xe0ec, 0xe4e2, 0xe4e3, 0xbbf1, 0xbbef, 0xe4e4, 0xbbf0, 0xe8e8, 0xe8eb, 0xe8e5, 0xe8ec, 0xe8e4, 0xe8e6, 0xe8e7, 0xe8ea, 0xbea1, 0xe8ef, 0xe8ee, 0xbe7d, 0xe8e9, 0xe8ed, 0xbe7e, 0xecac, 0xc06f, 0xeca7, 0xc06b, 0xeca4, 0xecaa, 0xecad, 0xc070, 0xeca9, 0xeca6, 0xecae, 0xeca5, 0xecab, 0xc06c, 0xeca3, 0xc06d, 0xc06e, 0xeca8, 0xefa9, 0xef7a, 0xef7b, 0xef7e, 0xef7c, 0xef76, 0xef79, 0xefa5, 0xef7d, 0xc245, 0xefa7, 0xefa4, 0xc246, 0xefa6, 0xef77, 0xefa2, 0xefa3, 0xefa1, 0xf1d2, 0xf1d4, 0xf1d7, 0xf1d1, 0xc359, 0xf1d9, 0xf1d0, 0xf1da, 0xf1d6, 0xf1d8, 0xf1dc, 0xf1d5, 0xf1dd, 0xf1d3, 0xf1cf, 0xc35a, 0xf1db, 0xc35b, 0xc44d, 0xef78, 0xf3f1, 0xf3e8, 0xc44f, 0xf3e4, 0xc450, 0xf3ed, 0xf3e7, 0xf3dd, 0xc44e, 0xf3ea, 0xf3e5, 0xf3e6, 0xf3d8, 0xf3df, 0xf3ee, 0xf3eb, 0xf3e3, 0xf3ef, 0xf3de, 0xf3d9, 0xf3ec, 0xf3db, 0xf3e9, 0xf3e0, 0xf3f0, 0xf3dc, 0xc44c, 0xf3da, 0xf3e1, 0xf3e2, 0xf57d, 0xf57b, 0xf5a2, 0xf5ae, 0xf5a5, 0xf57c, 0xf578, 0xf5a7, 0xf57e, 0xf5a3, 0xf57a, 0xf5aa, 0xf577, 0xf5a1, 0xf5a6, 0xf5a8, 0xf5ab, 0xf579, 0xf5af, 0xf5b0, 0xf5a9, 0xf5ad, 0xf5a4, 0xf6c1, 0xf6c4, 0xc561, 0xf6c3, 0xf6c8, 0xf6c6, 0xc562, 0xf6bd, 0xf6b3, 0xf6b2, 0xc564, 0xf6bf, 0xf6c0, 0xf6bc, 0xf6b4, 0xf6b9, 0xf5ac, 0xf6b5, 0xc563, 0xf6bb, 0xf6ba, 0xf6b6, 0xf6c2, 0xf6b7, 0xf7bb, 0xf6c5, 0xf6c7, 0xf6be, 0xf6b8, 0xf7bc, 0xf7be, 0xf7b8, 0xc5c2, 0xf7c5, 0xf7c3, 0xc5c3, 0xf7c2, 0xf7c1, 0xf7ba, 0xf7b7, 0xf7bd, 0xf7c6, 0xf7b9, 0xf7bf, 0xf869, 0xf86e, 0xf864, 0xf867, 0xc5ee, 0xf86b, 0xf872, 0xf7c0, 0xf865, 0xf86f, 0xf873, 0xf86a, 0xf863, 0xf86d, 0xf86c, 0xf871, 0xf870, 0xf7c4, 0xf868, 0xf862, 0xf866, 0xc64e, 0xc64f, 0xf861, 0xf8e6, 0xf8dd, 0xf8e5, 0xf8e2, 0xf8e3, 0xf8dc, 0xf8df, 0xf8e7, 0xf8e1, 0xf8e0, 0xf8de, 0xf8e4, 0xf95d, 0xf95e, 0xf960, 0xf95f, 0xf962, 0xf961, 0xf97c, 0xf97b, 0xf9b7, 0xf9b8, 0xf9c5, 0xc678, 0xc67c, 0xf9cf, 0xc67d, 0xb3bf, 0xc4d0, 0xf6c9, 0xc650, 0xc651, 0xb3c0, 0xe0ee, 0xb9a8, 0xe8f0, 0xecb0, 0xecb1, 0xecaf, 0xefab, 0xefaa, 0xc247, 0xf1df, 0xefac, 0xf1de, 0xf3f3, 0xc451, 0xc453, 0xf3f2, 0xc452, 0xf5b1, 0xf5b3, 0xf5b2, 0xf6ca, 0xc565, 0xc5ef, 0xf8e8, 0xf963, 0xf9d2, 0xb3c1, 0xe4e5, 0xbea2, 0xecb3, 0xecb2, 0xefad, 0xc454, 0xc4d1, 0xf7c7, 0xf9cb, 0xb3c2, 0xbbf2, 0xbea3, 0xf3f4, 0xf874, 0xb6c0, 0xefae, 0xc664, 0xb6c1, 0xbea4, 0xc248, 0xf875, 0xb6c2, 0xe8f1, 0xc072, 0xecb4, 0xecb5, 0xc071, 0xefaf, 0xc24c, 0xc24a, 0xc24b, 0xc249, 0xf1e0, 0xc35c, 0xf5b5, 0xf5b4, 0xf5b7, 0xf5b6, 0xc4d2, 0xf6cb, 0xf6cd, 0xf6cc, 0xc566, 0xf7c8, 0xf876, 0xf877, 0xc5f0, 0xf964, 0xf97d, 0xc675, 0xdcb0, 0xecb6, 0xefb0, 0xf3f5, 0xe0ef, 0xefb1, 0xf1e2, 0xf1e1, 0xf878, 0xc652, 0xf965, 0xf97e, 0xb9a9, 0xe8f2, 0xe8f3, 0xecb7, 0xb9aa, 0xc35d, 0xf1e3, 0xf6cf, 0xc567, 0xf6d0, 0xf6ce, 0xf879, 0xf8e9, 0xb9ab, 0xefb4, 0xefb3, 0xefb2, 0xf1e4, 0xf1e8, 0xf1e7, 0xf1e6, 0xf1e5, 0xc35e, 0xf3f6, 0xf5b9, 0xc4d3, 0xf5b8, 0xf6d1, 0xf7cb, 0xf7ca, 0xc5c4, 0xf7c9, 0xf87c, 0xf87b, 0xf87a, 0xbbf3, 0xecb8, 0xc24d, 0xf3f7, 0xf3f8, 0xf7cc, 0xf87d, 0xf8ea, 0xf966, 0xf9b9, 0xf9d4, 0xbbf4, 0xc24e, 0xf1e9, 0xf3f9, 0xf6d2, 0xf87e, 0xbea6, 0xefb5, 0xf1ea, 0xf3fa, 0xf3fb, 0xf3fc, 0xf5be, 0xf5ba, 0xc568, 0xf5bd, 0xf5bc, 0xc4d4, 0xf5bb, 0xc4d6, 0xc4d5, 0xf6d4, 0xf6d3, 0xc569, 0xc56a, 0xc5c6, 0xf7cd, 0xc5c5, 0xf8a3, 0xf8a4, 0xf8a2, 0xf8a1, 0xc654, 0xf8eb, 0xf8ec, 0xf8ed, 0xc653, 0xf967, 0xf96a, 0xf969, 0xf968, 0xf9d3, 0xc073, 0xc365, 0xf5bf, 0xf6d5, 0xc5c7, 0xf7ce, 0xf9d5, 0xc074, 0xefb6, 0xf7cf, 0xf9a1, 0xc94a, 0xddfc, 0xa14a, 0xa157, 0xa159, 0xa15b, 0xa15f, 0xa160, 0xa163, 0xa164, 0xa167, 0xa168, 0xa16b, 0xa16c, 0xa16f, 0xa170, 0xa173, 0xa174, 0xa177, 0xa178, 0xa17b, 0xa17c, 0xa1c6, 0xa1c7, 0xa1ca, 0xa1cb, 0xa1c8, 0xa1c9, 0xa15c, 0xa14d, 0xa14f, 0xa151, 0xa152, 0xa153, 0xa154, 0xa17d, 0xa17e, 0xa1a1, 0xa1a2, 0xa1a3, 0xa1a4, 0xa1cc, 0xa1cd, 0xa1ce, 0xa1de, 0xa1df, 0xa1e0, 0xa1e1, 0xa1e2, 0xa24c, 0xa24d, 0xa24e, 0xa149, 0xa1ad, 0xa243, 0xa248, 0xa1ae, 0xa15d, 0xa15e, 0xa1af, 0xa1cf, 0xa141, 0xa1d0, 0xa144, 0xa241, 0xa2af, 0xa2b0, 0xa2b1, 0xa2b2, 0xa2b3, 0xa2b4, 0xa2b5, 0xa2b6, 0xa2b7, 0xa2b8, 0xa147, 0xa146, 0xa1d5, 0xa1d7, 0xa1d6, 0xa148, 0xa249, 0xa2cf, 0xa2d0, 0xa2d1, 0xa2d2, 0xa2d3, 0xa2d4, 0xa2d5, 0xa2d6, 0xa2d7, 0xa2d8, 0xa2d9, 0xa2da, 0xa2db, 0xa2dc, 0xa2dd, 0xa2de, 0xa2df, 0xa2e0, 0xa2e1, 0xa2e2, 0xa2e3, 0xa2e4, 0xa2e5, 0xa2e6, 0xa2e7, 0xa2e8, 0xa242, 0xa1c4, 0xa2e9, 0xa2ea, 0xa2eb, 0xa2ec, 0xa2ed, 0xa2ee, 0xa2ef, 0xa2f0, 0xa2f1, 0xa2f2, 0xa2f3, 0xa2f4, 0xa2f5, 0xa2f6, 0xa2f7, 0xa2f8, 0xa2f9, 0xa2fa, 0xa2fb, 0xa2fc, 0xa2fd, 0xa2fe, 0xa340, 0xa341, 0xa342, 0xa343, 0xa161, 0xa155, 0xa162, 0xa14e, }; static const Summary16 big5_uni2indx_page00[16] = { /* 0x0000 */ { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x00ac }, { 4, 0x0083 }, { 7, 0x0000 }, { 7, 0x0080 }, { 8, 0x0000 }, { 8, 0x0080 }, }; static const Summary16 big5_uni2indx_page02[38] = { /* 0x0200 */ { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0e80 }, { 13, 0x0200 }, { 14, 0x0000 }, { 14, 0x0000 }, /* 0x0300 */ { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0xfffe }, { 29, 0x03fb }, { 38, 0xfffe }, { 53, 0x03fb }, { 62, 0x0000 }, { 62, 0x0000 }, { 62, 0x0000 }, /* 0x0400 */ { 62, 0x0002 }, { 63, 0x1ff0 }, { 72, 0xfff8 }, { 85, 0xffff }, { 101, 0xffff }, { 117, 0x0002 }, }; static const Summary16 big5_uni2indx_page20[44] = { /* 0x2000 */ { 118, 0x0000 }, { 118, 0x3318 }, { 124, 0x0064 }, { 127, 0x4824 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, /* 0x2100 */ { 131, 0x0228 }, { 134, 0x0000 }, { 134, 0x0000 }, { 134, 0x0000 }, { 134, 0x0000 }, { 134, 0x0000 }, { 134, 0x03ff }, { 144, 0x0000 }, { 144, 0x0000 }, { 144, 0x03cf }, { 152, 0x0000 }, { 152, 0x0000 }, { 152, 0x0000 }, { 152, 0x0000 }, { 152, 0x0000 }, { 152, 0x0000 }, /* 0x2200 */ { 152, 0x0000 }, { 152, 0xc400 }, { 155, 0x4e29 }, { 162, 0x1030 }, { 165, 0x0000 }, { 165, 0x0004 }, { 166, 0x00c3 }, { 170, 0x0000 }, { 170, 0x0000 }, { 170, 0x0000 }, { 170, 0x0020 }, { 171, 0x8000 }, }; static const Summary16 big5_uni2indx_page24[37] = { /* 0x2400 */ { 172, 0x0000 }, { 172, 0x0000 }, { 172, 0x0000 }, { 172, 0x0000 }, { 172, 0x0000 }, { 172, 0x0000 }, { 172, 0x03ff }, { 182, 0x3ff0 }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, /* 0x2500 */ { 192, 0x1005 }, { 195, 0x1111 }, { 199, 0x1010 }, { 201, 0x1010 }, { 203, 0x0000 }, { 203, 0x4001 }, { 205, 0xe402 }, { 210, 0x000f }, { 214, 0xfffe }, { 229, 0x0030 }, { 231, 0x0003 }, { 233, 0x300c }, { 237, 0xc8c0 }, { 242, 0x0000 }, { 242, 0x003c }, { 246, 0x0000 }, /* 0x2600 */ { 246, 0x0260 }, { 249, 0x0000 }, { 249, 0x0000 }, { 249, 0x0000 }, { 249, 0x0007 }, }; static const Summary16 big5_uni2indx_page30[62] = { /* 0x3000 */ { 252, 0xff2f }, { 265, 0x6037 }, { 272, 0x03fe }, { 281, 0x0000 }, { 281, 0xfffe }, { 296, 0xffff }, { 312, 0xffff }, { 328, 0xffff }, { 344, 0xffff }, { 360, 0x600f }, { 366, 0xfffe }, { 381, 0xffff }, { 397, 0xffff }, { 413, 0xffff }, { 429, 0xffff }, { 445, 0x407f }, /* 0x3100 */ { 453, 0xffe0 }, { 464, 0xffff }, { 480, 0x03ff }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, /* 0x3200 */ { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0008 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, /* 0x3300 */ { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0xc000 }, { 493, 0x7000 }, { 496, 0x0002 }, { 497, 0x0000 }, { 497, 0x4010 }, { 499, 0x0026 }, }; static const Summary16 big5_uni2indx_page4e[1307] = { /* 0x4e00 */ { 502, 0xff8b }, { 514, 0xc373 }, { 523, 0x6840 }, { 527, 0x1b0f }, { 535, 0xe9ac }, { 544, 0xf34c }, { 553, 0x0200 }, { 554, 0xc008 }, { 557, 0x795c }, { 566, 0xca3e }, { 575, 0x7976 }, { 585, 0x0648 }, { 589, 0x2fdf }, { 601, 0xf7f0 }, { 612, 0x033a }, { 618, 0xa8ff }, /* 0x4f00 */ { 629, 0xef37 }, { 641, 0x233f }, { 650, 0xb004 }, { 654, 0xfd59 }, { 665, 0xf3ca }, { 675, 0xffff }, { 691, 0xde9f }, { 703, 0xfff9 }, { 717, 0xabff }, { 730, 0x7df7 }, { 743, 0xc000 }, { 745, 0x8eec }, { 754, 0xeebf }, { 767, 0xffdb }, { 781, 0xd003 }, { 786, 0x45fa }, /* 0x5000 */ { 795, 0xfae1 }, { 805, 0xdffe }, { 819, 0xbfef }, { 833, 0x10ab }, { 839, 0xffeb }, { 853, 0xfcaa }, { 863, 0xef3f }, { 876, 0x24fd }, { 885, 0x78ad }, { 894, 0x7f76 }, { 906, 0xf00c }, { 912, 0xedff }, { 926, 0xcff6 }, { 938, 0x2cfa }, { 947, 0xf7f9 }, { 960, 0xeb6b }, /* 0x5100 */ { 971, 0x1ffd }, { 983, 0x95bf }, { 994, 0x6677 }, { 1004, 0xbfbf }, { 1018, 0x3bfb }, { 1030, 0xfeb4 }, { 1041, 0x7bae }, { 1052, 0x11e2 }, { 1058, 0xa681 }, { 1064, 0x41be }, { 1072, 0x1435 }, { 1078, 0x72c3 }, { 1086, 0x7d70 }, { 1095, 0x7191 }, { 1102, 0x0003 }, { 1104, 0x276b }, /* 0x5200 */ { 1113, 0x57cb }, { 1123, 0x70cf }, { 1132, 0x4732 }, { 1139, 0x0def }, { 1149, 0x7eda }, { 1160, 0xfc74 }, { 1170, 0xfe06 }, { 1179, 0xbdb4 }, { 1189, 0x3f9f }, { 1201, 0x8bca }, { 1209, 0x7e49 }, { 1218, 0x5800 }, { 1221, 0x228f }, { 1228, 0xebec }, { 1239, 0x8a5c }, { 1246, 0xddbb }, /* 0x5300 */ { 1258, 0xef60 }, { 1267, 0xb6e7 }, { 1278, 0xa40f }, { 1285, 0xf293 }, { 1294, 0x37bb }, { 1305, 0x549e }, { 1313, 0xd04b }, { 1320, 0x9baf }, { 1331, 0xc414 }, { 1336, 0xf7d4 }, { 1347, 0x30b0 }, { 1352, 0x0a14 }, { 1356, 0x2f08 }, { 1362, 0x88d0 }, { 1367, 0xff7e }, { 1381, 0x192f }, /* 0x5400 */ { 1389, 0xffda }, { 1402, 0xfb07 }, { 1412, 0x7ff1 }, { 1424, 0x7beb }, { 1436, 0xc5ef }, { 1447, 0x0010 }, { 1448, 0x99ff }, { 1460, 0xfdff }, { 1475, 0x79d7 }, { 1486, 0x0567 }, { 1493, 0xffe7 }, { 1507, 0xfdcb }, { 1519, 0xc3ff }, { 1531, 0x4040 }, { 1533, 0x6ff7 }, { 1546, 0xbd8e }, /* 0x5500 */ { 1556, 0xdffa }, { 1569, 0x0497 }, { 1575, 0xf4c0 }, { 1582, 0x5bff }, { 1595, 0xed7b }, { 1607, 0xd0e7 }, { 1616, 0x047e }, { 1623, 0xf8e0 }, { 1631, 0xff9f }, { 1645, 0xb73e }, { 1656, 0x7dfe }, { 1669, 0x882e }, { 1675, 0xfffd }, { 1690, 0xbe7f }, { 1703, 0x83fe }, { 1713, 0xf6c4 }, /* 0x5600 */ { 1722, 0xf357 }, { 1733, 0xb8fd }, { 1744, 0xd680 }, { 1750, 0xef7d }, { 1763, 0x5767 }, { 1773, 0x4788 }, { 1779, 0xff7d }, { 1793, 0xc3df }, { 1804, 0xf0ff }, { 1816, 0x37a9 }, { 1825, 0x7de0 }, { 1834, 0x70fc }, { 1843, 0x3f6f }, { 1855, 0xec9a }, { 1864, 0x4cb3 }, { 1872, 0x8681 }, /* 0x5700 */ { 1877, 0x3f9e }, { 1888, 0xdd5c }, { 1898, 0xf70d }, { 1908, 0x4819 }, { 1913, 0xfea3 }, { 1924, 0x0007 }, { 1927, 0xaf56 }, { 1937, 0x38ff }, { 1948, 0x980d }, { 1954, 0xefb8 }, { 1965, 0x403d }, { 1971, 0xb760 }, { 1979, 0xd8ce }, { 1988, 0x9035 }, { 1994, 0x72bf }, { 2005, 0x3fff }, /* 0x5800 */ { 2019, 0x7ff7 }, { 2033, 0x7a11 }, { 2040, 0xf7bb }, { 2053, 0xabff }, { 2066, 0xff00 }, { 2074, 0x6fbe }, { 2086, 0xa93c }, { 2094, 0xfe72 }, { 2105, 0xcfef }, { 2118, 0xf11b }, { 2127, 0xdb6b }, { 2138, 0xf40a }, { 2145, 0xc3e6 }, { 2154, 0xef7e }, { 2167, 0x9b9c }, { 2176, 0xf610 }, /* 0x5900 */ { 2183, 0xf048 }, { 2189, 0x16f4 }, { 2197, 0xfeb5 }, { 2209, 0x5182 }, { 2214, 0xc7b1 }, { 2223, 0x15bb }, { 2232, 0x6e87 }, { 2241, 0xfbdf }, { 2255, 0xe43f }, { 2265, 0x63cd }, { 2274, 0xc1ff }, { 2285, 0x7e7e }, { 2297, 0xfdeb }, { 2310, 0x7d5f }, { 2322, 0x777b }, { 2334, 0xfcfe }, /* 0x5a00 */ { 2347, 0x960b }, { 2354, 0xdbea }, { 2365, 0x6229 }, { 2371, 0x53e8 }, { 2379, 0x37df }, { 2391, 0xfdef }, { 2405, 0x36f5 }, { 2415, 0xbd81 }, { 2423, 0xdc18 }, { 2430, 0xfcbd }, { 2442, 0xd2e4 }, { 2450, 0xffff }, { 2466, 0x3fd7 }, { 2478, 0xffe0 }, { 2489, 0x7f6f }, { 2502, 0xabf8 }, /* 0x5b00 */ { 2512, 0x9bae }, { 2522, 0x6ed9 }, { 2532, 0xf5fb }, { 2545, 0xf115 }, { 2553, 0x79a9 }, { 2562, 0xbdfb }, { 2575, 0x5a3c }, { 2583, 0xadaf }, { 2594, 0xdbba }, { 2605, 0x1fac }, { 2614, 0x71fc }, { 2624, 0x8379 }, { 2632, 0x7cf7 }, { 2644, 0xc35f }, { 2654, 0xdfff }, { 2669, 0x0567 }, /* 0x5c00 */ { 2676, 0xff9a }, { 2688, 0x8467 }, { 2695, 0x1534 }, { 2701, 0xdf8b }, { 2712, 0xf9f3 }, { 2724, 0x3373 }, { 2733, 0xf7bd }, { 2746, 0x5e1a }, { 2754, 0xbf40 }, { 2762, 0xa03f }, { 2770, 0xffff }, { 2786, 0x01eb }, { 2793, 0xdfc0 }, { 2802, 0xcfdd }, { 2814, 0x7500 }, { 2819, 0xabd3 }, /* 0x5d00 */ { 2829, 0xf8c3 }, { 2838, 0xeed6 }, { 2849, 0x43fd }, { 2859, 0xb7ff }, { 2873, 0x5eaf }, { 2884, 0x4227 }, { 2890, 0x9bac }, { 2899, 0xf686 }, { 2908, 0x27d7 }, { 2918, 0xf6bc }, { 2929, 0xf787 }, { 2940, 0x35b7 }, { 2950, 0xaacd }, { 2959, 0xe176 }, { 2968, 0x49e7 }, { 2977, 0xe29f }, /* 0x5e00 */ { 2987, 0x545c }, { 2994, 0xaff2 }, { 3005, 0x2b3f }, { 3015, 0x61d8 }, { 3022, 0xfc3b }, { 3033, 0xbbb8 }, { 3043, 0xffcf }, { 3057, 0x7b7d }, { 3069, 0xbf95 }, { 3080, 0x1ce0 }, { 3086, 0x7dfd }, { 3099, 0x43ff }, { 3110, 0x5ff6 }, { 3122, 0xfffe }, { 3137, 0xd3ef }, { 3149, 0xc4ce }, /* 0x5f00 */ { 3157, 0x8db6 }, { 3166, 0xadbc }, { 3176, 0x63dc }, { 3185, 0x11eb }, { 3193, 0xdf59 }, { 3204, 0x23d0 }, { 3210, 0xbeb4 }, { 3220, 0xf3db }, { 3232, 0x1fe7 }, { 3243, 0xdbc7 }, { 3254, 0xff63 }, { 3266, 0xfae4 }, { 3276, 0xb22b }, { 3284, 0x63f7 }, { 3295, 0xed3b }, { 3306, 0xadba }, /* 0x6000 */ { 3316, 0xfe01 }, { 3324, 0x7eff }, { 3338, 0xfff7 }, { 3353, 0x02bc }, { 3359, 0x32ff }, { 3370, 0xef39 }, { 3381, 0xfffc }, { 3395, 0x8005 }, { 3398, 0x77fb }, { 3411, 0xbcf5 }, { 3422, 0x010d }, { 3426, 0xfff7 }, { 3441, 0xfffb }, { 3456, 0xbf3a }, { 3467, 0x0057 }, { 3472, 0xdfff }, /* 0x6100 */ { 3487, 0xef7b }, { 3500, 0xbd7d }, { 3512, 0xdb88 }, { 3520, 0xc8d4 }, { 3527, 0xfff3 }, { 3541, 0xed7c }, { 3552, 0x5dee }, { 3563, 0x56ff }, { 3575, 0x7e0d }, { 3584, 0xac5f }, { 3594, 0xff96 }, { 3606, 0xd57f }, { 3618, 0x3fee }, { 3630, 0xc140 }, { 3634, 0x6ff9 }, { 3646, 0xffe7 }, /* 0x6200 */ { 3660, 0x779b }, { 3671, 0x8e77 }, { 3681, 0x6ebf }, { 3693, 0xe45d }, { 3702, 0x6fcf }, { 3714, 0x5f1f }, { 3725, 0xe07f }, { 3735, 0xfedf }, { 3749, 0xd7db }, { 3761, 0x01fe }, { 3769, 0xff00 }, { 3777, 0xfb7b }, { 3790, 0xffd4 }, { 3802, 0x1fdf }, { 3814, 0xf800 }, { 3819, 0xffff }, /* 0x6300 */ { 3835, 0xfb8f }, { 3847, 0x007b }, { 3853, 0xbf00 }, { 3860, 0x7f5c }, { 3871, 0xffff }, { 3887, 0x07f3 }, { 3896, 0xeba0 }, { 3904, 0x3de7 }, { 3915, 0xf7bf }, { 3929, 0xfbd7 }, { 3942, 0xffbf }, { 3957, 0x6003 }, { 3961, 0xfffd }, { 3976, 0xbfed }, { 3989, 0xefbb }, { 4002, 0x027f }, /* 0x6400 */ { 4010, 0xfe40 }, { 4018, 0xddfd }, { 4031, 0xfdff }, { 4046, 0xe2f9 }, { 4056, 0x680b }, { 4062, 0xfb1f }, { 4074, 0xfbe3 }, { 4086, 0xaffd }, { 4099, 0x9fa4 }, { 4108, 0xf7ed }, { 4121, 0x7a7d }, { 4132, 0xf80f }, { 4141, 0xeebe }, { 4153, 0x0fd5 }, { 4162, 0xbb5d }, { 4173, 0xfd9f }, /* 0x6500 */ { 4186, 0xf2db }, { 4197, 0x3bf9 }, { 4208, 0xfe7f }, { 4222, 0xebcc }, { 4232, 0x876a }, { 4240, 0x73fa }, { 4251, 0x95fc }, { 4261, 0x9ffc }, { 4273, 0x109f }, { 4280, 0xfaf7 }, { 4293, 0xddb7 }, { 4305, 0xbbcd }, { 4316, 0xf87e }, { 4327, 0xeccd }, { 4337, 0xf366 }, { 4347, 0x3c3f }, /* 0x6600 */ { 4357, 0xfffd }, { 4372, 0xb03f }, { 4381, 0xe9f7 }, { 4393, 0x067e }, { 4401, 0x96ae }, { 4410, 0xfe06 }, { 4419, 0xd576 }, { 4429, 0x5fd7 }, { 4441, 0x3fd1 }, { 4451, 0xa3f3 }, { 4461, 0xcf07 }, { 4470, 0x6fb7 }, { 4482, 0x9fd1 }, { 4492, 0x7f44 }, { 4501, 0x7b59 }, { 4511, 0xd3dd }, /* 0x6700 */ { 4522, 0xaf3b }, { 4533, 0xa9bd }, { 4543, 0x7dcf }, { 4555, 0xff3a }, { 4567, 0xfbe0 }, { 4577, 0xf6eb }, { 4589, 0xb401 }, { 4594, 0xffff }, { 4610, 0x7afa }, { 4621, 0xb7bf }, { 4634, 0xc000 }, { 4636, 0x0ffd }, { 4647, 0xff7f }, { 4662, 0xff1f }, { 4675, 0xfefc }, { 4688, 0x95ff }, /* 0x6800 */ { 4700, 0x0000 }, { 4700, 0xb5dc }, { 4710, 0xef63 }, { 4721, 0x3f3e }, { 4732, 0xfb7f }, { 4746, 0x001b }, { 4750, 0xe800 }, { 4754, 0xfbf6 }, { 4767, 0x9eef }, { 4779, 0xb8df }, { 4790, 0xff9f }, { 4804, 0x003f }, { 4810, 0x7bd0 }, { 4819, 0xf5ff }, { 4833, 0xdfdb }, { 4846, 0x3fff }, /* 0x6900 */ { 4860, 0xfdf0 }, { 4871, 0x00bf }, { 4878, 0x8420 }, { 4881, 0xbbbd }, { 4893, 0xdf37 }, { 4905, 0xffde }, { 4919, 0xff6d }, { 4932, 0x0ff3 }, { 4942, 0x604c }, { 4947, 0x5efb }, { 4959, 0xfffb }, { 4974, 0xfafb }, { 4987, 0xfe5e }, { 4999, 0x0219 }, { 5003, 0x79f4 }, { 5013, 0xf9de }, /* 0x6a00 */ { 5025, 0xa7f7 }, { 5037, 0xebfa }, { 5049, 0x01eb }, { 5056, 0xff34 }, { 5067, 0xebd3 }, { 5078, 0xef73 }, { 5090, 0xafd7 }, { 5102, 0xc040 }, { 5105, 0x72bb }, { 5115, 0xdcff }, { 5128, 0xf17f }, { 5140, 0x2fd8 }, { 5149, 0xb8ec }, { 5158, 0xfe0b }, { 5168, 0xdda3 }, { 5178, 0x1f0b }, /* 0x6b00 */ { 5186, 0x8f1d }, { 5195, 0x47cf }, { 5205, 0xb12b }, { 5213, 0xffde }, { 5227, 0x7fee }, { 5240, 0xda73 }, { 5250, 0x24ff }, { 5260, 0xcbc4 }, { 5268, 0xf75d }, { 5280, 0xcbf2 }, { 5290, 0xecfd }, { 5302, 0xb4ed }, { 5312, 0xbff9 }, { 5325, 0x4ddd }, { 5335, 0x99dd }, { 5345, 0xfb8d }, /* 0x6c00 */ { 5356, 0xbb7f }, { 5369, 0xaf7b }, { 5381, 0xddfb }, { 5394, 0xc959 }, { 5402, 0xfc4f }, { 5413, 0xfab5 }, { 5424, 0xafe3 }, { 5435, 0x6d5f }, { 5446, 0xffff }, { 5462, 0x3f7d }, { 5474, 0x7800 }, { 5478, 0xffdb }, { 5492, 0xb6ff }, { 5505, 0x7eff }, { 5519, 0xfbaf }, { 5532, 0x022f }, /* 0x6d00 */ { 5538, 0xff9b }, { 5551, 0xefc7 }, { 5563, 0xffa5 }, { 5575, 0xffff }, { 5591, 0x0007 }, { 5594, 0xc700 }, { 5599, 0xf7ff }, { 5614, 0xfff1 }, { 5627, 0x7ffd }, { 5641, 0x01bf }, { 5649, 0xdc00 }, { 5654, 0xfdbc }, { 5666, 0xbff5 }, { 5679, 0xffff }, { 5695, 0xff7f }, { 5710, 0x3eff }, /* 0x6e00 */ { 5723, 0x0029 }, { 5726, 0xbe00 }, { 5732, 0xf9ff }, { 5746, 0xff7f }, { 5761, 0x6efb }, { 5773, 0xfd7e }, { 5786, 0xcbff }, { 5799, 0x039e }, { 5806, 0xe300 }, { 5811, 0xfbdd }, { 5824, 0xccff }, { 5836, 0xf6df }, { 5849, 0xffff }, { 5865, 0x117f }, { 5874, 0xf800 }, { 5879, 0xfbf6 }, /* 0x6f00 */ { 5892, 0xe7ef }, { 5905, 0xd73c }, { 5915, 0xfeef }, { 5929, 0xdfef }, { 5943, 0xc00b }, { 5948, 0xedbf }, { 5961, 0xfedf }, { 5975, 0xfdcd }, { 5987, 0x7bf5 }, { 5999, 0x40fd }, { 6007, 0xffff }, { 6023, 0xb75f }, { 6035, 0xffdf }, { 6050, 0xf930 }, { 6058, 0xfbdf }, { 6072, 0xdc97 }, /* 0x7000 */ { 6082, 0xfef3 }, { 6095, 0xbff2 }, { 6107, 0x8fdf }, { 6119, 0xdfbf }, { 6133, 0x177f }, { 6144, 0xede6 }, { 6155, 0x0f7f }, { 6166, 0x3553 }, { 6174, 0x447c }, { 6181, 0x877e }, { 6191, 0xfa12 }, { 6199, 0x45bb }, { 6208, 0xede0 }, { 6217, 0x779e }, { 6228, 0x8017 }, { 6233, 0xbfd9 }, /* 0x7100 */ { 6245, 0x7e55 }, { 6255, 0xde89 }, { 6264, 0xc16f }, { 6273, 0x0447 }, { 6278, 0x7ade }, { 6289, 0xf75d }, { 6301, 0x57ff }, { 6314, 0x2905 }, { 6319, 0x86f7 }, { 6329, 0xfe95 }, { 6340, 0x97b3 }, { 6350, 0xf32f }, { 6361, 0xcfff }, { 6375, 0x9f75 }, { 6386, 0x71f7 }, { 6397, 0xfb17 }, /* 0x7200 */ { 6408, 0x34ee }, { 6417, 0xee19 }, { 6426, 0x37cc }, { 6435, 0xef61 }, { 6445, 0x9fd6 }, { 6456, 0xef4c }, { 6466, 0xd68f }, { 6476, 0xfbdd }, { 6489, 0x7b73 }, { 6500, 0x6def }, { 6512, 0xd7fe }, { 6525, 0xa431 }, { 6531, 0x5e7f }, { 6543, 0x97d7 }, { 6554, 0x0f5b }, { 6563, 0xffd8 }, /* 0x7300 */ { 6575, 0x9d83 }, { 6583, 0x7bce }, { 6594, 0x22ec }, { 6601, 0xdcff }, { 6614, 0x763d }, { 6624, 0xef87 }, { 6635, 0xdfe7 }, { 6648, 0xfded }, { 6661, 0x4fff }, { 6674, 0xa0fc }, { 6682, 0x3b77 }, { 6693, 0xdbfc }, { 6705, 0x3ded }, { 6716, 0x7fdc }, { 6728, 0x6fa9 }, { 6738, 0xf570 }, /* 0x7400 */ { 6747, 0x3ffb }, { 6760, 0x2c40 }, { 6764, 0xff7f }, { 6779, 0x847f }, { 6788, 0xec57 }, { 6798, 0xdeb7 }, { 6810, 0xe69c }, { 6819, 0xf22f }, { 6829, 0x0feb }, { 6839, 0xd5b5 }, { 6849, 0xafeb }, { 6861, 0xede7 }, { 6873, 0x8c2f }, { 6881, 0xfff0 }, { 6893, 0x537f }, { 6904, 0xe8f0 }, /* 0x7500 */ { 6912, 0xb99d }, { 6922, 0xb5ff }, { 6935, 0xff66 }, { 6947, 0xe78f }, { 6958, 0xd981 }, { 6965, 0xbe10 }, { 6972, 0x9c7c }, { 6981, 0xe3c1 }, { 6989, 0x9cd1 }, { 6997, 0x2733 }, { 7005, 0x0cbc }, { 7012, 0xff6d }, { 7025, 0xfcb7 }, { 7037, 0xefb7 }, { 7050, 0xa0df }, { 7059, 0xffff }, /* 0x7600 */ { 7075, 0xbf0b }, { 7085, 0xfe7b }, { 7098, 0xa3ff }, { 7110, 0x353f }, { 7120, 0x13cc }, { 7127, 0x97cd }, { 7137, 0x7637 }, { 7147, 0xfb27 }, { 7158, 0xcfd6 }, { 7169, 0x7e6c }, { 7179, 0xec50 }, { 7186, 0xed31 }, { 7195, 0x677c }, { 7205, 0xfc1c }, { 7214, 0xf6fa }, { 7226, 0x5fbf }, /* 0x7700 */ { 7239, 0x0fba }, { 7248, 0xae2f }, { 7258, 0xa3ad }, { 7267, 0x7ffe }, { 7281, 0xfcf0 }, { 7291, 0xde74 }, { 7301, 0xffef }, { 7316, 0xf200 }, { 7321, 0xfbbf }, { 7335, 0xfea2 }, { 7345, 0x3daf }, { 7356, 0xbcff }, { 7369, 0xf694 }, { 7378, 0x5fb9 }, { 7389, 0xf3ad }, { 7400, 0x3f8f }, /* 0x7800 */ { 7411, 0xf26c }, { 7420, 0xa01f }, { 7427, 0xffef }, { 7442, 0x01bf }, { 7450, 0x7728 }, { 7458, 0x7005 }, { 7463, 0xff35 }, { 7475, 0xda03 }, { 7482, 0xd2f9 }, { 7492, 0xc7fa }, { 7503, 0x3fbf }, { 7516, 0x5c1d }, { 7524, 0xff3a }, { 7536, 0xec33 }, { 7545, 0xb7af }, { 7557, 0xfe9c }, /* 0x7900 */ { 7568, 0x5236 }, { 7575, 0x7a9f }, { 7586, 0xbffa }, { 7599, 0xe722 }, { 7607, 0x9ff7 }, { 7620, 0xfcff }, { 7634, 0x2fbb }, { 7645, 0xb61d }, { 7654, 0xed06 }, { 7662, 0x1dfd }, { 7673, 0x7dd7 }, { 7685, 0xefdf }, { 7699, 0xeb23 }, { 7708, 0xf166 }, { 7717, 0x7ed9 }, { 7728, 0x0dc0 }, /* 0x7a00 */ { 7733, 0x3d3d }, { 7743, 0xdfbf }, { 7757, 0xc945 }, { 7764, 0xba83 }, { 7772, 0x7dd1 }, { 7782, 0x9dd0 }, { 7790, 0x7b87 }, { 7800, 0xcf73 }, { 7811, 0x9ff3 }, { 7823, 0xc3f5 }, { 7833, 0xdf0d }, { 7843, 0xc5fe }, { 7854, 0x0cb3 }, { 7861, 0x8302 }, { 7865, 0xe879 }, { 7874, 0xaec0 }, /* 0x7b00 */ { 7881, 0xc773 }, { 7891, 0x6f0f }, { 7901, 0xfd7d }, { 7914, 0x093f }, { 7922, 0xfff1 }, { 7935, 0x0157 }, { 7941, 0x62fb }, { 7951, 0x01ff }, { 7960, 0xfdb4 }, { 7971, 0x3bf3 }, { 7982, 0xb013 }, { 7988, 0x43b2 }, { 7995, 0x5ed3 }, { 8005, 0xff30 }, { 8015, 0x0fff }, { 8027, 0xeb9f }, /* 0x7c00 */ { 8039, 0xfeef }, { 8053, 0xf203 }, { 8060, 0x3fef }, { 8073, 0xfb89 }, { 8083, 0x37a9 }, { 8092, 0x9e99 }, { 8101, 0xdef9 }, { 8113, 0xa72c }, { 8121, 0x3733 }, { 8130, 0xc1f6 }, { 8139, 0x812e }, { 8145, 0xfe3e }, { 8157, 0x5d20 }, { 8163, 0xf2f7 }, { 8175, 0xd585 }, { 8183, 0x69d7 }, /* 0x7d00 */ { 8193, 0xffff }, { 8209, 0xffff }, { 8225, 0xdb07 }, { 8234, 0xff6f }, { 8248, 0xc4ff }, { 8259, 0xd97f }, { 8271, 0xefce }, { 8283, 0xbe0f }, { 8293, 0xf17b }, { 8304, 0xf05e }, { 8313, 0xf6cf }, { 8325, 0xffb7 }, { 8339, 0x5ef7 }, { 8351, 0xef84 }, { 8360, 0xd7cb }, { 8371, 0x0edf }, /* 0x7e00 */ { 8381, 0xff08 }, { 8390, 0xfcff }, { 8404, 0xee3f }, { 8416, 0xffff }, { 8432, 0x13ff }, { 8443, 0xd7ff }, { 8457, 0xaf0f }, { 8467, 0x7ffd }, { 8481, 0xbdc7 }, { 8492, 0x1ffa }, { 8503, 0x0000 }, { 8503, 0x0000 }, { 8503, 0x0000 }, { 8503, 0x0000 }, { 8503, 0x0000 }, { 8503, 0x0000 }, /* 0x7f00 */ { 8503, 0x0000 }, { 8503, 0x0000 }, { 8503, 0x0000 }, { 8503, 0xe740 }, { 8510, 0xbd38 }, { 8519, 0xf933 }, { 8529, 0x7feb }, { 8542, 0xfeed }, { 8555, 0x7fe8 }, { 8566, 0x7c76 }, { 8576, 0xb3f7 }, { 8588, 0xffef }, { 8603, 0xfeaf }, { 8616, 0xd8b7 }, { 8626, 0xff6f }, { 8640, 0xfbbf }, /* 0x8000 */ { 8654, 0xf8fb }, { 8666, 0xdbf7 }, { 8679, 0x1752 }, { 8686, 0xe2f9 }, { 8696, 0x85c8 }, { 8702, 0x7547 }, { 8711, 0x9090 }, { 8715, 0xe3ef }, { 8727, 0x9ef4 }, { 8737, 0x3f6d }, { 8748, 0xee2e }, { 8758, 0x0536 }, { 8764, 0xf7bc }, { 8776, 0x7ff3 }, { 8789, 0xa07b }, { 8797, 0x7f3f }, /* 0x8100 */ { 8810, 0x0567 }, { 8817, 0xeb60 }, { 8825, 0xbabe }, { 8836, 0x6601 }, { 8841, 0xfcd8 }, { 8851, 0x583f }, { 8860, 0xcaf7 }, { 8871, 0x87df }, { 8882, 0xbfcd }, { 8894, 0xffa0 }, { 8904, 0x5bcd }, { 8914, 0xfebf }, { 8928, 0xb6fd }, { 8940, 0xefa7 }, { 8952, 0x77ef }, { 8965, 0xdf9c }, /* 0x8200 */ { 8976, 0x3fb7 }, { 8988, 0xf877 }, { 8999, 0x9d27 }, { 9008, 0xb7fc }, { 9020, 0xcab5 }, { 9029, 0xdfef }, { 9043, 0xfb5a }, { 9054, 0xf1b6 }, { 9064, 0xec39 }, { 9073, 0xef1f }, { 9085, 0xfbbf }, { 9099, 0x7ffb }, { 9113, 0x000d }, { 9116, 0xdafe }, { 9128, 0xbdfb }, { 9141, 0x4e7f }, /* 0x8300 */ { 9152, 0x33ff }, { 9164, 0x5ac0 }, { 9170, 0xbff5 }, { 9183, 0x9ffe }, { 9196, 0xffbf }, { 9211, 0x005f }, { 9217, 0x0000 }, { 9217, 0xfdf8 }, { 9229, 0xffca }, { 9241, 0x6ffd }, { 9254, 0xcffd }, { 9267, 0xa001 }, { 9270, 0xdfff }, { 9285, 0xfbf2 }, { 9297, 0xdfbf }, { 9311, 0xff7f }, /* 0x8400 */ { 9326, 0xfeda }, { 9338, 0x080f }, { 9343, 0xba08 }, { 9349, 0xbfff }, { 9364, 0x7afd }, { 9376, 0xeed7 }, { 9388, 0xfbeb }, { 9401, 0x67f9 }, { 9412, 0xe044 }, { 9417, 0xff93 }, { 9429, 0xdf97 }, { 9441, 0x9f57 }, { 9452, 0xfef7 }, { 9466, 0x08df }, { 9474, 0xdf80 }, { 9482, 0xfedf }, /* 0x8500 */ { 9496, 0xffc5 }, { 9508, 0xf7fe }, { 9522, 0xfffb }, { 9537, 0x6803 }, { 9542, 0x67fb }, { 9554, 0x6bfa }, { 9565, 0x7fff }, { 9580, 0x5fe2 }, { 9590, 0xffff }, { 9606, 0xff73 }, { 9619, 0x87df }, { 9630, 0xe7fb }, { 9643, 0xebfd }, { 9656, 0xf7a7 }, { 9668, 0xbf7e }, { 9681, 0xefc7 }, /* 0x8600 */ { 9693, 0x1ef3 }, { 9703, 0xdf82 }, { 9712, 0x76ff }, { 9725, 0xdf7e }, { 9738, 0x79c9 }, { 9747, 0xda7d }, { 9758, 0xefbe }, { 9771, 0x1e9b }, { 9780, 0x7ce0 }, { 9788, 0x77fb }, { 9801, 0x87be }, { 9811, 0xfffb }, { 9826, 0x1bff }, { 9838, 0xffdb }, { 9852, 0x3f5c }, { 9862, 0x4fe0 }, /* 0x8700 */ { 9870, 0x7fff }, { 9885, 0x5f0e }, { 9894, 0x77ff }, { 9908, 0xddbf }, { 9921, 0xf04f }, { 9930, 0xffff }, { 9946, 0xffff }, { 9962, 0x0ff8 }, { 9971, 0xa3be }, { 9981, 0xfddf }, { 9995, 0xfc1c }, { 10004, 0xfffd }, { 10019, 0x1f7d }, { 10030, 0xfb9e }, { 10042, 0xbdff }, { 10056, 0xdedc }, /* 0x8800 */ { 10067, 0x3f6f }, { 10079, 0xbafb }, { 10091, 0xdf7f }, { 10105, 0xfbef }, { 10119, 0x7d1b }, { 10129, 0x2eec }, { 10138, 0xaf8e }, { 10148, 0xf2f7 }, { 10160, 0x7b0f }, { 10170, 0xcfee }, { 10182, 0x1d96 }, { 10190, 0x77c6 }, { 10200, 0x7e07 }, { 10209, 0xfff5 }, { 10223, 0xd982 }, { 10230, 0x7fdf }, /* 0x8900 */ { 10244, 0x5ee6 }, { 10254, 0xc7ff }, { 10267, 0xfeee }, { 10280, 0x79ef }, { 10292, 0x9a56 }, { 10300, 0xffcf }, { 10314, 0xfe5f }, { 10327, 0xde5e }, { 10338, 0x896e }, { 10346, 0xf9e8 }, { 10356, 0xf45e }, { 10366, 0xe6c4 }, { 10374, 0x0001 }, { 10375, 0xbe7c }, { 10386, 0x3b7f }, { 10398, 0xdddf }, /* 0x8a00 */ { 10411, 0xd59d }, { 10421, 0xe9ef }, { 10433, 0x34ac }, { 10440, 0xde53 }, { 10450, 0xf573 }, { 10461, 0x4bf7 }, { 10472, 0x7b4f }, { 10483, 0x9eff }, { 10496, 0xb8fe }, { 10507, 0x476e }, { 10516, 0x0dfb }, { 10526, 0xff45 }, { 10537, 0xabfd }, { 10549, 0xfbfe }, { 10563, 0xe9d7 }, { 10574, 0xddff }, /* 0x8b00 */ { 10588, 0xedf7 }, { 10601, 0x7fff }, { 10616, 0xddfd }, { 10629, 0x7eeb }, { 10641, 0xcfe7 }, { 10653, 0xb7ff }, { 10667, 0xbde9 }, { 10678, 0xef91 }, { 10688, 0x5d75 }, { 10698, 0xd77c }, { 10709, 0x0000 }, { 10709, 0x0000 }, { 10709, 0x0000 }, { 10709, 0x0000 }, { 10709, 0x0000 }, { 10709, 0x0000 }, /* 0x8c00 */ { 10709, 0x0000 }, { 10709, 0x0000 }, { 10709, 0x0000 }, { 10709, 0xfa80 }, { 10716, 0xffee }, { 10730, 0xb4f1 }, { 10739, 0xbf76 }, { 10751, 0x2fef }, { 10763, 0xb677 }, { 10774, 0x77bf }, { 10787, 0x9fbf }, { 10800, 0xfffd }, { 10815, 0x95bf }, { 10826, 0xf6ae }, { 10837, 0x75ff }, { 10850, 0x7f3b }, /* 0x8d00 */ { 10862, 0xa7f5 }, { 10873, 0x0af9 }, { 10881, 0x0000 }, { 10881, 0x0000 }, { 10881, 0x0000 }, { 10881, 0x0000 }, { 10881, 0xfbd0 }, { 10891, 0x2bdd }, { 10901, 0xf633 }, { 10911, 0x9a7f }, { 10922, 0xfdab }, { 10934, 0xd6fc }, { 10945, 0xf9e6 }, { 10956, 0xbfeb }, { 10969, 0xdfdf }, { 10983, 0xf41f }, /* 0x8e00 */ { 10993, 0xa6fd }, { 11004, 0xffff }, { 11020, 0x4aff }, { 11031, 0xf37b }, { 11043, 0x7fb7 }, { 11056, 0xfef9 }, { 11069, 0xb6ff }, { 11082, 0x1d5c }, { 11090, 0x7ff6 }, { 11103, 0xe5ff }, { 11116, 0x1f7b }, { 11127, 0x2404 }, { 11130, 0xbe05 }, { 11138, 0xf99e }, { 11149, 0xdbe3 }, { 11160, 0xdff2 }, /* 0x8f00 */ { 11172, 0x6fef }, { 11185, 0xfdff }, { 11200, 0xd679 }, { 11210, 0xcbfc }, { 11221, 0xebfd }, { 11234, 0xefff }, { 11249, 0x001f }, { 11254, 0x0000 }, { 11254, 0x0000 }, { 11254, 0x9800 }, { 11257, 0xe148 }, { 11263, 0x8017 }, { 11268, 0x6a74 }, { 11276, 0x00fe }, { 11283, 0x6d7f }, { 11295, 0xfdf1 }, /* 0x9000 */ { 11307, 0xb87f }, { 11318, 0xfef3 }, { 11331, 0xe01f }, { 11339, 0xf176 }, { 11349, 0xee96 }, { 11359, 0x7b3f }, { 11371, 0xeb8d }, { 11381, 0xfffd }, { 11396, 0xadff }, { 11409, 0xcbb3 }, { 11419, 0x84ef }, { 11428, 0xe17f }, { 11439, 0x4daa }, { 11447, 0xbff0 }, { 11458, 0xbf3f }, { 11471, 0xfe3f }, /* 0x9100 */ { 11484, 0xebff }, { 11498, 0xffd7 }, { 11512, 0xffdf }, { 11527, 0xcf7f }, { 11540, 0xfffb }, { 11555, 0x85ed }, { 11564, 0xd73f }, { 11576, 0x07bc }, { 11584, 0xaeff }, { 11597, 0xfe0f }, { 11608, 0xfdaf }, { 11621, 0x76bf }, { 11633, 0xfaef }, { 11646, 0x37bb }, { 11657, 0x7fdc }, { 11669, 0xa3ba }, /* 0x9200 */ { 11678, 0xb6ff }, { 11691, 0x56f7 }, { 11702, 0x60f8 }, { 11709, 0xe7df }, { 11722, 0xff61 }, { 11733, 0x4cdf }, { 11743, 0xb0fb }, { 11753, 0xff45 }, { 11764, 0x7ded }, { 11776, 0x3ffa }, { 11788, 0x1fff }, { 11801, 0x18fc }, { 11809, 0xffff }, { 11825, 0xe3af }, { 11836, 0xc7d3 }, { 11846, 0xdf83 }, /* 0x9300 */ { 11856, 0xfb57 }, { 11868, 0xef7d }, { 11881, 0xefff }, { 11896, 0x1378 }, { 11903, 0xfec0 }, { 11912, 0x5ff7 }, { 11925, 0x34bb }, { 11934, 0x5ee3 }, { 11944, 0xf70d }, { 11954, 0xeff6 }, { 11967, 0xd7fe }, { 11980, 0x00bf }, { 11987, 0xf59d }, { 11998, 0xf7f7 }, { 12012, 0x51de }, { 12021, 0xffe0 }, /* 0x9400 */ { 12032, 0xfec9 }, { 12043, 0x037f }, { 12052, 0x5f01 }, { 12059, 0xbfef }, { 12073, 0x9ff1 }, { 12084, 0x60a7 }, { 12091, 0xef1d }, { 12102, 0xf1ff }, { 12115, 0x000f }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, /* 0x9500 */ { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x3c80 }, { 12124, 0xfb4d }, { 12135, 0xd91f }, { 12145, 0x7b3a }, { 12155, 0xfee3 }, { 12167, 0x3fe9 }, { 12178, 0xdc7f }, { 12190, 0x003f }, { 12196, 0x0000 }, /* 0x9600 */ { 12196, 0x0000 }, { 12196, 0x5000 }, { 12198, 0xf51f }, { 12209, 0xbe07 }, { 12218, 0xfc1d }, { 12228, 0xf91b }, { 12238, 0xbc1e }, { 12247, 0x71ff }, { 12259, 0x6ff9 }, { 12271, 0x5bbe }, { 12282, 0x5796 }, { 12291, 0x9b1b }, { 12300, 0x7fff }, { 12315, 0xfffc }, { 12329, 0x872e }, { 12337, 0xafe7 }, /* 0x9700 */ { 12349, 0xebf5 }, { 12361, 0xf34f }, { 12372, 0xdffd }, { 12386, 0xe725 }, { 12395, 0x0bdc }, { 12403, 0x5d44 }, { 12410, 0x5747 }, { 12419, 0xfddd }, { 12432, 0xed3f }, { 12444, 0x7790 }, { 12452, 0x7d7f }, { 12465, 0x8ac8 }, { 12471, 0xfafa }, { 12483, 0xf3f9 }, { 12495, 0x202a }, { 12499, 0xef4b }, /* 0x9800 */ { 12510, 0xf5ff }, { 12524, 0x79cf }, { 12535, 0xabd3 }, { 12545, 0x0ba5 }, { 12552, 0xf77a }, { 12564, 0xfb8f }, { 12576, 0x8ebd }, { 12586, 0x001f }, { 12591, 0x0000 }, { 12591, 0x0000 }, { 12591, 0xf300 }, { 12597, 0xfd4e }, { 12608, 0x1a57 }, { 12616, 0x8800 }, { 12618, 0xaeac }, { 12627, 0x7654 }, /* 0x9900 */ { 12635, 0x17ad }, { 12644, 0xcdff }, { 12657, 0xffb2 }, { 12669, 0xf42f }, { 12679, 0x5baa }, { 12688, 0xdbff }, { 12702, 0x0002 }, { 12703, 0x0000 }, { 12703, 0x0000 }, { 12703, 0x73c0 }, { 12710, 0xf9ea }, { 12721, 0x2e3f }, { 12731, 0xfa8e }, { 12741, 0xbbff }, { 12755, 0x76bc }, { 12765, 0xffd3 }, /* 0x9a00 */ { 12778, 0xeefe }, { 12791, 0x7e72 }, { 12801, 0x7ebd }, { 12813, 0xe7f7 }, { 12826, 0xf77f }, { 12840, 0xcefd }, { 12852, 0x0ff5 }, { 12862, 0x0000 }, { 12862, 0x0000 }, { 12862, 0x0000 }, { 12862, 0xa900 }, { 12866, 0xdb9b }, { 12877, 0xa4c7 }, { 12885, 0x917f }, { 12895, 0xf8ca }, { 12904, 0x7ece }, /* 0x9b00 */ { 12915, 0x7d7a }, { 12926, 0xc7e7 }, { 12937, 0xcbbd }, { 12948, 0xdcae }, { 12958, 0xfd7e }, { 12971, 0x8f76 }, { 12981, 0x91d3 }, { 12989, 0x7cf3 }, { 13000, 0x01e5 }, { 13006, 0x4c2f }, { 13014, 0xed77 }, { 13026, 0xa360 }, { 13032, 0x07db }, { 13041, 0x5ef8 }, { 13051, 0x1df7 }, { 13062, 0x2181 }, /* 0x9c00 */ { 13066, 0x6be0 }, { 13074, 0x309c }, { 13080, 0x3b3a }, { 13089, 0xfade }, { 13101, 0x7f53 }, { 13112, 0xc3f5 }, { 13122, 0x61cd }, { 13130, 0x07ba }, { 13138, 0x0000 }, { 13138, 0x0000 }, { 13138, 0x0000 }, { 13138, 0x0000 }, { 13138, 0x0000 }, { 13138, 0x0000 }, { 13138, 0x26e0 }, { 13144, 0xbefe }, /* 0x9d00 */ { 13157, 0x03f9 }, { 13165, 0xebb5 }, { 13176, 0xe36d }, { 13186, 0xe9cb }, { 13196, 0x9c2f }, { 13205, 0xbfde }, { 13218, 0x9f83 }, { 13227, 0xabbf }, { 13239, 0x1ff7 }, { 13251, 0xffd5 }, { 13264, 0xb7df }, { 13277, 0xdffe }, { 13291, 0xfdae }, { 13303, 0xffef }, { 13318, 0xfb7e }, { 13331, 0xeffd }, /* 0x9e00 */ { 13345, 0xaaff }, { 13357, 0x6ebf }, { 13369, 0x0000 }, { 13369, 0x0000 }, { 13369, 0x0000 }, { 13369, 0x0000 }, { 13369, 0x0000 }, { 13369, 0xb620 }, { 13375, 0x7fcd }, { 13387, 0xbe9e }, { 13398, 0x62b3 }, { 13406, 0x58f1 }, { 13414, 0xf10d }, { 13422, 0xfd7b }, { 13435, 0xe9f1 }, { 13445, 0xbefd }, /* 0x9f00 */ { 13458, 0xc6c3 }, { 13466, 0x5f6d }, { 13477, 0xff3d }, { 13490, 0x69ff }, { 13502, 0xffcf }, { 13516, 0xfbf4 }, { 13528, 0xdcfb }, { 13540, 0x4ff7 }, { 13552, 0x2000 }, { 13553, 0x1137 }, { 13560, 0x0015 }, }; static const Summary16 big5_uni2indx_pagefa[1] = { /* 0xfa00 */ { 13563, 0x3000 }, }; static const Summary16 big5_uni2indx_pagefe[23] = { /* 0xfe00 */ { 13565, 0x0000 }, { 13565, 0x0000 }, { 13565, 0x0000 }, { 13565, 0xfffb }, { 13580, 0xfe1f }, { 13592, 0xfef5 }, { 13605, 0x0e7f }, { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, /* 0xff00 */ { 13615, 0xff7a }, { 13628, 0xffff }, { 13644, 0xffff }, { 13660, 0x97ff }, { 13673, 0xfffe }, { 13688, 0x3fff }, { 13702, 0x0010 }, }; static int big5_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { if (n >= 2) { const Summary16 *summary = NULL; if (wc < 0x0100) summary = &big5_uni2indx_page00[(wc>>4)]; else if (wc >= 0x0200 && wc < 0x0460) summary = &big5_uni2indx_page02[(wc>>4)-0x020]; else if (wc >= 0x2000 && wc < 0x22c0) summary = &big5_uni2indx_page20[(wc>>4)-0x200]; else if (wc >= 0x2400 && wc < 0x2650) summary = &big5_uni2indx_page24[(wc>>4)-0x240]; else if (wc >= 0x3000 && wc < 0x33e0) summary = &big5_uni2indx_page30[(wc>>4)-0x300]; else if (wc >= 0x4e00 && wc < 0x9fb0) summary = &big5_uni2indx_page4e[(wc>>4)-0x4e0]; else if (wc >= 0xfa00 && wc < 0xfa10) summary = &big5_uni2indx_pagefa[(wc>>4)-0xfa0]; else if (wc >= 0xfe00 && wc < 0xff70) summary = &big5_uni2indx_pagefe[(wc>>4)-0xfe0]; if (summary) { unsigned short used = summary->used; unsigned int i = wc & 0x0f; if (used & ((unsigned short) 1 << i)) { unsigned short c; /* Keep in `used' only the bits 0..i-1. */ used &= ((unsigned short) 1 << i) - 1; /* Add `summary->indx' and the number of bits set in `used'. */ used = (used & 0x5555) + ((used & 0xaaaa) >> 1); used = (used & 0x3333) + ((used & 0xcccc) >> 2); used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); used = (used & 0x00ff) + (used >> 8); c = big5_2charset[summary->indx + used]; r[0] = (c >> 8); r[1] = (c & 0xff); return 2; } } return RET_ILSEQ; } return RET_TOOSMALL; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/big5hkscs.h0000644000000000000000000141106313614532331020237 0ustar /* * BIG5-HKSCS */ static const unsigned short big5hkscs_2uni_page81[19782] = { /* 0x81 */ 0xeeb8, 0xeeb9, 0xeeba, 0xeebb, 0xeebc, 0xeebd, 0xeebe, 0xeebf, 0xeec0, 0xeec1, 0xeec2, 0xeec3, 0xeec4, 0xeec5, 0xeec6, 0xeec7, 0xeec8, 0xeec9, 0xeeca, 0xeecb, 0xeecc, 0xeecd, 0xeece, 0xeecf, 0xeed0, 0xeed1, 0xeed2, 0xeed3, 0xeed4, 0xeed5, 0xeed6, 0xeed7, 0xeed8, 0xeed9, 0xeeda, 0xeedb, 0xeedc, 0xeedd, 0xeede, 0xeedf, 0xeee0, 0xeee1, 0xeee2, 0xeee3, 0xeee4, 0xeee5, 0xeee6, 0xeee7, 0xeee8, 0xeee9, 0xeeea, 0xeeeb, 0xeeec, 0xeeed, 0xeeee, 0xeeef, 0xeef0, 0xeef1, 0xeef2, 0xeef3, 0xeef4, 0xeef5, 0xeef6, 0xeef7, 0xeef8, 0xeef9, 0xeefa, 0xeefb, 0xeefc, 0xeefd, 0xeefe, 0xeeff, 0xef00, 0xef01, 0xef02, 0xef03, 0xef04, 0xef05, 0xef06, 0xef07, 0xef08, 0xef09, 0xef0a, 0xef0b, 0xef0c, 0xef0d, 0xef0e, 0xef0f, 0xef10, 0xef11, 0xef12, 0xef13, 0xef14, 0xef15, 0xef16, 0xef17, 0xef18, 0xef19, 0xef1a, 0xef1b, 0xef1c, 0xef1d, 0xef1e, 0xef1f, 0xef20, 0xef21, 0xef22, 0xef23, 0xef24, 0xef25, 0xef26, 0xef27, 0xef28, 0xef29, 0xef2a, 0xef2b, 0xef2c, 0xef2d, 0xef2e, 0xef2f, 0xef30, 0xef31, 0xef32, 0xef33, 0xef34, 0xef35, 0xef36, 0xef37, 0xef38, 0xef39, 0xef3a, 0xef3b, 0xef3c, 0xef3d, 0xef3e, 0xef3f, 0xef40, 0xef41, 0xef42, 0xef43, 0xef44, 0xef45, 0xef46, 0xef47, 0xef48, 0xef49, 0xef4a, 0xef4b, 0xef4c, 0xef4d, 0xef4e, 0xef4f, 0xef50, 0xef51, 0xef52, 0xef53, 0xef54, /* 0x82 */ 0xef55, 0xef56, 0xef57, 0xef58, 0xef59, 0xef5a, 0xef5b, 0xef5c, 0xef5d, 0xef5e, 0xef5f, 0xef60, 0xef61, 0xef62, 0xef63, 0xef64, 0xef65, 0xef66, 0xef67, 0xef68, 0xef69, 0xef6a, 0xef6b, 0xef6c, 0xef6d, 0xef6e, 0xef6f, 0xef70, 0xef71, 0xef72, 0xef73, 0xef74, 0xef75, 0xef76, 0xef77, 0xef78, 0xef79, 0xef7a, 0xef7b, 0xef7c, 0xef7d, 0xef7e, 0xef7f, 0xef80, 0xef81, 0xef82, 0xef83, 0xef84, 0xef85, 0xef86, 0xef87, 0xef88, 0xef89, 0xef8a, 0xef8b, 0xef8c, 0xef8d, 0xef8e, 0xef8f, 0xef90, 0xef91, 0xef92, 0xef93, 0xef94, 0xef95, 0xef96, 0xef97, 0xef98, 0xef99, 0xef9a, 0xef9b, 0xef9c, 0xef9d, 0xef9e, 0xef9f, 0xefa0, 0xefa1, 0xefa2, 0xefa3, 0xefa4, 0xefa5, 0xefa6, 0xefa7, 0xefa8, 0xefa9, 0xefaa, 0xefab, 0xefac, 0xefad, 0xefae, 0xefaf, 0xefb0, 0xefb1, 0xefb2, 0xefb3, 0xefb4, 0xefb5, 0xefb6, 0xefb7, 0xefb8, 0xefb9, 0xefba, 0xefbb, 0xefbc, 0xefbd, 0xefbe, 0xefbf, 0xefc0, 0xefc1, 0xefc2, 0xefc3, 0xefc4, 0xefc5, 0xefc6, 0xefc7, 0xefc8, 0xefc9, 0xefca, 0xefcb, 0xefcc, 0xefcd, 0xefce, 0xefcf, 0xefd0, 0xefd1, 0xefd2, 0xefd3, 0xefd4, 0xefd5, 0xefd6, 0xefd7, 0xefd8, 0xefd9, 0xefda, 0xefdb, 0xefdc, 0xefdd, 0xefde, 0xefdf, 0xefe0, 0xefe1, 0xefe2, 0xefe3, 0xefe4, 0xefe5, 0xefe6, 0xefe7, 0xefe8, 0xefe9, 0xefea, 0xefeb, 0xefec, 0xefed, 0xefee, 0xefef, 0xeff0, 0xeff1, /* 0x83 */ 0xeff2, 0xeff3, 0xeff4, 0xeff5, 0xeff6, 0xeff7, 0xeff8, 0xeff9, 0xeffa, 0xeffb, 0xeffc, 0xeffd, 0xeffe, 0xefff, 0xf000, 0xf001, 0xf002, 0xf003, 0xf004, 0xf005, 0xf006, 0xf007, 0xf008, 0xf009, 0xf00a, 0xf00b, 0xf00c, 0xf00d, 0xf00e, 0xf00f, 0xf010, 0xf011, 0xf012, 0xf013, 0xf014, 0xf015, 0xf016, 0xf017, 0xf018, 0xf019, 0xf01a, 0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f, 0xf020, 0xf021, 0xf022, 0xf023, 0xf024, 0xf025, 0xf026, 0xf027, 0xf028, 0xf029, 0xf02a, 0xf02b, 0xf02c, 0xf02d, 0xf02e, 0xf02f, 0xf030, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf03a, 0xf03b, 0xf03c, 0xf03d, 0xf03e, 0xf03f, 0xf040, 0xf041, 0xf042, 0xf043, 0xf044, 0xf045, 0xf046, 0xf047, 0xf048, 0xf049, 0xf04a, 0xf04b, 0xf04c, 0xf04d, 0xf04e, 0xf04f, 0xf050, 0xf051, 0xf052, 0xf053, 0xf054, 0xf055, 0xf056, 0xf057, 0xf058, 0xf059, 0xf05a, 0xf05b, 0xf05c, 0xf05d, 0xf05e, 0xf05f, 0xf060, 0xf061, 0xf062, 0xf063, 0xf064, 0xf065, 0xf066, 0xf067, 0xf068, 0xf069, 0xf06a, 0xf06b, 0xf06c, 0xf06d, 0xf06e, 0xf06f, 0xf070, 0xf071, 0xf072, 0xf073, 0xf074, 0xf075, 0xf076, 0xf077, 0xf078, 0xf079, 0xf07a, 0xf07b, 0xf07c, 0xf07d, 0xf07e, 0xf07f, 0xf080, 0xf081, 0xf082, 0xf083, 0xf084, 0xf085, 0xf086, 0xf087, 0xf088, 0xf089, 0xf08a, 0xf08b, 0xf08c, 0xf08d, 0xf08e, /* 0x84 */ 0xf08f, 0xf090, 0xf091, 0xf092, 0xf093, 0xf094, 0xf095, 0xf096, 0xf097, 0xf098, 0xf099, 0xf09a, 0xf09b, 0xf09c, 0xf09d, 0xf09e, 0xf09f, 0xf0a0, 0xf0a1, 0xf0a2, 0xf0a3, 0xf0a4, 0xf0a5, 0xf0a6, 0xf0a7, 0xf0a8, 0xf0a9, 0xf0aa, 0xf0ab, 0xf0ac, 0xf0ad, 0xf0ae, 0xf0af, 0xf0b0, 0xf0b1, 0xf0b2, 0xf0b3, 0xf0b4, 0xf0b5, 0xf0b6, 0xf0b7, 0xf0b8, 0xf0b9, 0xf0ba, 0xf0bb, 0xf0bc, 0xf0bd, 0xf0be, 0xf0bf, 0xf0c0, 0xf0c1, 0xf0c2, 0xf0c3, 0xf0c4, 0xf0c5, 0xf0c6, 0xf0c7, 0xf0c8, 0xf0c9, 0xf0ca, 0xf0cb, 0xf0cc, 0xf0cd, 0xf0ce, 0xf0cf, 0xf0d0, 0xf0d1, 0xf0d2, 0xf0d3, 0xf0d4, 0xf0d5, 0xf0d6, 0xf0d7, 0xf0d8, 0xf0d9, 0xf0da, 0xf0db, 0xf0dc, 0xf0dd, 0xf0de, 0xf0df, 0xf0e0, 0xf0e1, 0xf0e2, 0xf0e3, 0xf0e4, 0xf0e5, 0xf0e6, 0xf0e7, 0xf0e8, 0xf0e9, 0xf0ea, 0xf0eb, 0xf0ec, 0xf0ed, 0xf0ee, 0xf0ef, 0xf0f0, 0xf0f1, 0xf0f2, 0xf0f3, 0xf0f4, 0xf0f5, 0xf0f6, 0xf0f7, 0xf0f8, 0xf0f9, 0xf0fa, 0xf0fb, 0xf0fc, 0xf0fd, 0xf0fe, 0xf0ff, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, 0xf111, 0xf112, 0xf113, 0xf114, 0xf115, 0xf116, 0xf117, 0xf118, 0xf119, 0xf11a, 0xf11b, 0xf11c, 0xf11d, 0xf11e, 0xf11f, 0xf120, 0xf121, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, /* 0x85 */ 0xf12c, 0xf12d, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf138, 0xf139, 0xf13a, 0xf13b, 0xf13c, 0xf13d, 0xf13e, 0xf13f, 0xf140, 0xf141, 0xf142, 0xf143, 0xf144, 0xf145, 0xf146, 0xf147, 0xf148, 0xf149, 0xf14a, 0xf14b, 0xf14c, 0xf14d, 0xf14e, 0xf14f, 0xf150, 0xf151, 0xf152, 0xf153, 0xf154, 0xf155, 0xf156, 0xf157, 0xf158, 0xf159, 0xf15a, 0xf15b, 0xf15c, 0xf15d, 0xf15e, 0xf15f, 0xf160, 0xf161, 0xf162, 0xf163, 0xf164, 0xf165, 0xf166, 0xf167, 0xf168, 0xf169, 0xf16a, 0xf16b, 0xf16c, 0xf16d, 0xf16e, 0xf16f, 0xf170, 0xf171, 0xf172, 0xf173, 0xf174, 0xf175, 0xf176, 0xf177, 0xf178, 0xf179, 0xf17a, 0xf17b, 0xf17c, 0xf17d, 0xf17e, 0xf17f, 0xf180, 0xf181, 0xf182, 0xf183, 0xf184, 0xf185, 0xf186, 0xf187, 0xf188, 0xf189, 0xf18a, 0xf18b, 0xf18c, 0xf18d, 0xf18e, 0xf18f, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf195, 0xf196, 0xf197, 0xf198, 0xf199, 0xf19a, 0xf19b, 0xf19c, 0xf19d, 0xf19e, 0xf19f, 0xf1a0, 0xf1a1, 0xf1a2, 0xf1a3, 0xf1a4, 0xf1a5, 0xf1a6, 0xf1a7, 0xf1a8, 0xf1a9, 0xf1aa, 0xf1ab, 0xf1ac, 0xf1ad, 0xf1ae, 0xf1af, 0xf1b0, 0xf1b1, 0xf1b2, 0xf1b3, 0xf1b4, 0xf1b5, 0xf1b6, 0xf1b7, 0xf1b8, 0xf1b9, 0xf1ba, 0xf1bb, 0xf1bc, 0xf1bd, 0xf1be, 0xf1bf, 0xf1c0, 0xf1c1, 0xf1c2, 0xf1c3, 0xf1c4, 0xf1c5, 0xf1c6, 0xf1c7, 0xf1c8, /* 0x86 */ 0xf1c9, 0xf1ca, 0xf1cb, 0xf1cc, 0xf1cd, 0xf1ce, 0xf1cf, 0xf1d0, 0xf1d1, 0xf1d2, 0xf1d3, 0xf1d4, 0xf1d5, 0xf1d6, 0xf1d7, 0xf1d8, 0xf1d9, 0xf1da, 0xf1db, 0xf1dc, 0xf1dd, 0xf1de, 0xf1df, 0xf1e0, 0xf1e1, 0xf1e2, 0xf1e3, 0xf1e4, 0xf1e5, 0xf1e6, 0xf1e7, 0xf1e8, 0xf1e9, 0xf1ea, 0xf1eb, 0xf1ec, 0xf1ed, 0xf1ee, 0xf1ef, 0xf1f0, 0xf1f1, 0xf1f2, 0xf1f3, 0xf1f4, 0xf1f5, 0xf1f6, 0xf1f7, 0xf1f8, 0xf1f9, 0xf1fa, 0xf1fb, 0xf1fc, 0xf1fd, 0xf1fe, 0xf1ff, 0xf200, 0xf201, 0xf202, 0xf203, 0xf204, 0xf205, 0xf206, 0xf207, 0xf208, 0xf209, 0xf20a, 0xf20b, 0xf20c, 0xf20d, 0xf20e, 0xf20f, 0xf210, 0xf211, 0xf212, 0xf213, 0xf214, 0xf215, 0xf216, 0xf217, 0xf218, 0xf219, 0xf21a, 0xf21b, 0xf21c, 0xf21d, 0xf21e, 0xf21f, 0xf220, 0xf221, 0xf222, 0xf223, 0xf224, 0xf225, 0xf226, 0xf227, 0xf228, 0xf229, 0xf22a, 0xf22b, 0xf22c, 0xf22d, 0xf22e, 0xf22f, 0xf230, 0xf231, 0xf232, 0xf233, 0xf234, 0xf235, 0xf236, 0xf237, 0xf238, 0xf239, 0xf23a, 0xf23b, 0xf23c, 0xf23d, 0xf23e, 0xf23f, 0xf240, 0xf241, 0xf242, 0xf243, 0xf244, 0xf245, 0xf246, 0xf247, 0xf248, 0xf249, 0xf24a, 0xf24b, 0xf24c, 0xf24d, 0xf24e, 0xf24f, 0xf250, 0xf251, 0xf252, 0xf253, 0xf254, 0xf255, 0xf256, 0xf257, 0xf258, 0xf259, 0xf25a, 0xf25b, 0xf25c, 0xf25d, 0xf25e, 0xf25f, 0xf260, 0xf261, 0xf262, 0xf263, 0xf264, 0xf265, /* 0x87 */ 0xf266, 0xf267, 0xf268, 0xf269, 0xf26a, 0xf26b, 0xf26c, 0xf26d, 0xf26e, 0xf26f, 0xf270, 0xf271, 0xf272, 0xf273, 0xf274, 0xf275, 0xf276, 0xf277, 0xf278, 0xf279, 0xf27a, 0xf27b, 0xf27c, 0xf27d, 0xf27e, 0xf27f, 0xf280, 0xf281, 0xf282, 0xf283, 0xf284, 0xf285, 0xf286, 0xf287, 0xf288, 0xf289, 0xf28a, 0xf28b, 0xf28c, 0xf28d, 0xf28e, 0xf28f, 0xf290, 0xf291, 0xf292, 0xf293, 0xf294, 0xf295, 0xf296, 0xf297, 0xf298, 0xf299, 0xf29a, 0xf29b, 0xf29c, 0xf29d, 0xf29e, 0xf29f, 0xf2a0, 0xf2a1, 0xf2a2, 0xf2a3, 0xf2a4, 0xf2a5, 0xf2a6, 0xf2a7, 0xf2a8, 0xf2a9, 0xf2aa, 0xf2ab, 0xf2ac, 0xf2ad, 0xf2ae, 0xf2af, 0xf2b0, 0xf2b1, 0xf2b2, 0xf2b3, 0xf2b4, 0xf2b5, 0xf2b6, 0xf2b7, 0xf2b8, 0xf2b9, 0xf2ba, 0xf2bb, 0xf2bc, 0xf2bd, 0xf2be, 0xf2bf, 0xf2c0, 0xf2c1, 0xf2c2, 0xf2c3, 0xf2c4, 0xf2c5, 0xf2c6, 0xf2c7, 0xf2c8, 0xf2c9, 0xf2ca, 0xf2cb, 0xf2cc, 0xf2cd, 0xf2ce, 0xf2cf, 0xf2d0, 0xf2d1, 0xf2d2, 0xf2d3, 0xf2d4, 0xf2d5, 0xf2d6, 0xf2d7, 0xf2d8, 0xf2d9, 0xf2da, 0xf2db, 0xf2dc, 0xf2dd, 0xf2de, 0xf2df, 0xf2e0, 0xf2e1, 0xf2e2, 0xf2e3, 0xf2e4, 0xf2e5, 0xf2e6, 0xf2e7, 0xf2e8, 0xf2e9, 0xf2ea, 0xf2eb, 0xf2ec, 0xf2ed, 0xf2ee, 0xf2ef, 0xf2f0, 0xf2f1, 0xf2f2, 0xf2f3, 0xf2f4, 0xf2f5, 0xf2f6, 0xf2f7, 0xf2f8, 0xf2f9, 0xf2fa, 0xf2fb, 0xf2fc, 0xf2fd, 0xf2fe, 0xf2ff, 0xf300, 0xf301, 0xf302, /* 0x88 */ 0xf303, 0xf304, 0xf305, 0xf306, 0xf307, 0xf308, 0xf309, 0xf30a, 0xf30b, 0xf30c, 0xf30d, 0xf30e, 0xf30f, 0xf310, 0xf311, 0xf312, 0xf313, 0xf314, 0xf315, 0xf316, 0xf317, 0xf318, 0x0100, 0x00c1, 0x01cd, 0x00c0, 0x0112, 0x00c9, 0x011a, 0x00c8, 0x014c, 0x00d3, 0x01d1, 0x00d2, 0xf325, 0x1ebe, 0xf327, 0x1ec0, 0x00ca, 0x0101, 0x00e1, 0x01ce, 0x00e0, 0x0251, 0x0113, 0x00e9, 0x011b, 0x00e8, 0x012b, 0x00ed, 0x01d0, 0x00ec, 0x014d, 0x00f3, 0x01d2, 0x00f2, 0x016b, 0x00fa, 0x01d4, 0x00f9, 0x01d6, 0x01d8, 0x01da, 0x01dc, 0x00fc, 0xf344, 0x1ebf, 0xf346, 0x1ec1, 0x00ea, 0x0261, 0xf34a, 0xf34b, 0xf34c, 0xf34d, 0xf34e, 0xf34f, 0xf350, 0xf351, 0xf352, 0xf353, 0xf354, 0xf355, 0xf356, 0xf357, 0xf358, 0xf359, 0xf35a, 0xf35b, 0xf35c, 0xf35d, 0xf35e, 0xf35f, 0xf360, 0xf361, 0xf362, 0xf363, 0xf364, 0xf365, 0xf366, 0xf367, 0xf368, 0xf369, 0xf36a, 0xf36b, 0xf36c, 0xf36d, 0xf36e, 0xf36f, 0xf370, 0xf371, 0xf372, 0xf373, 0xf374, 0xf375, 0xf376, 0xf377, 0xf378, 0xf379, 0xf37a, 0xf37b, 0xf37c, 0xf37d, 0xf37e, 0xf37f, 0xf380, 0xf381, 0xf382, 0xf383, 0xf384, 0xf385, 0xf386, 0xf387, 0xf388, 0xf389, 0xf38a, 0xf38b, 0xf38c, 0xf38d, 0xf38e, 0xf38f, 0xf390, 0xf391, 0xf392, 0xf393, 0xf394, 0xf395, 0xf396, 0xf397, 0xf398, 0xf399, 0xf39a, 0xf39b, 0xf39c, 0xf39d, 0xf39e, 0xf39f, /* 0x89 */ 0xf3a0, 0xf3a1, 0xf3a2, 0x650a, 0xf3a4, 0xf3a5, 0x4e3d, 0x6edd, 0x9d4e, 0x91df, 0xf3aa, 0xf3ab, 0xf3ac, 0x6491, 0x4f1a, 0x4f28, 0x4fa8, 0x5156, 0x5174, 0x519c, 0x51e4, 0x52a1, 0x52a8, 0x533b, 0x534e, 0x53d1, 0x53d8, 0x56e2, 0x58f0, 0x5904, 0x5907, 0x5932, 0x5934, 0x5b66, 0x5b9e, 0x5b9f, 0x5c9a, 0x5e86, 0x603b, 0x6589, 0x67fe, 0x6804, 0x6865, 0x6d4e, 0x70bc, 0x7535, 0x7ea4, 0x7eac, 0x7eba, 0x7ec7, 0x7ecf, 0x7edf, 0x7f06, 0x7f37, 0x827a, 0x82cf, 0x836f, 0x89c6, 0x8bbe, 0x8be2, 0x8f66, 0x8f67, 0x8f6e, 0x7411, 0x7cfc, 0x7dcd, 0x6946, 0x7ac9, 0x5227, 0xf3e5, 0xf3e6, 0xf3e7, 0xf3e8, 0x918c, 0x78b8, 0x915e, 0x80bc, 0xf3ed, 0x8d0b, 0x80f6, 0xf3f0, 0xf3f1, 0xf3f2, 0x809f, 0x9ec7, 0x4ccd, 0x9dc9, 0x9e0c, 0x4c3e, 0xf3f9, 0xf3fa, 0x9e0a, 0xf3fc, 0x35c1, 0xf3fe, 0x6e9a, 0x823e, 0x7519, 0xf402, 0x4911, 0x9a6c, 0x9a8f, 0x9f99, 0x7987, 0xf408, 0xf409, 0xf40a, 0xf40b, 0x4e24, 0x4e81, 0x4e80, 0x4e87, 0x4ebf, 0x4eeb, 0x4f37, 0x344c, 0x4fbd, 0x3e48, 0x5003, 0x5088, 0x347d, 0x3493, 0x34a5, 0x5186, 0x5905, 0x51db, 0x51fc, 0x5205, 0x4e89, 0x5279, 0x5290, 0x5327, 0x35c7, 0x53a9, 0x3551, 0x53b0, 0x3553, 0x53c2, 0x5423, 0x356d, 0x3572, 0x3681, 0x5493, 0x54a3, 0x54b4, 0x54b9, 0x54d0, 0x54ef, 0x5518, 0x5523, 0x5528, 0x3598, 0x553f, 0x35a5, 0x35bf, 0x55d7, 0x35c5, /* 0x8a */ 0xf43d, 0x5525, 0xf43f, 0xf440, 0xf441, 0xf442, 0x5590, 0xf444, 0x39ec, 0xf446, 0x8e46, 0xf448, 0xf449, 0x4053, 0xf44b, 0x777a, 0xf44d, 0x3a34, 0x47d5, 0xf450, 0xf451, 0xf452, 0x64dd, 0xf454, 0xf455, 0xf456, 0xf457, 0x648d, 0x8e7e, 0xf45a, 0xf45b, 0xf45c, 0xf45d, 0xf45e, 0xf45f, 0xf460, 0xf461, 0xf462, 0xf463, 0x47f4, 0xf465, 0xf466, 0x9ab2, 0x3a67, 0xf469, 0x3fed, 0x3506, 0xf46c, 0xf46d, 0xf46e, 0xf46f, 0x9d6e, 0x9815, 0xf472, 0x43d9, 0xf474, 0x64b4, 0x54e3, 0xf477, 0xf478, 0xf479, 0x39fb, 0xf47b, 0xf47c, 0xf47d, 0xf47e, 0x64ea, 0xf480, 0xf481, 0x8e68, 0xf483, 0xf484, 0xf485, 0xf486, 0x480b, 0xf488, 0x3ffa, 0x5873, 0xf48b, 0xf48c, 0xf48d, 0xf48e, 0xf48f, 0xf490, 0xf491, 0x5579, 0x40bb, 0x43ba, 0xf495, 0x4ab4, 0xf497, 0xf498, 0x81aa, 0x98f5, 0xf49b, 0x6379, 0x39fe, 0xf49e, 0x8dc0, 0x56a1, 0x647c, 0x3e43, 0xf4a3, 0xf4a4, 0xf4a5, 0xf4a6, 0xf4a7, 0xf4a8, 0xf4a9, 0xf4aa, 0x3992, 0x3a06, 0xf4ad, 0x3578, 0xf4af, 0xf4b0, 0x5652, 0xf4b2, 0xf4b3, 0xf4b4, 0x34bc, 0x6c3d, 0xf4b7, 0xf4b8, 0xf4b9, 0xf4ba, 0xf4bb, 0xf4bc, 0xf4bd, 0xf4be, 0xf4bf, 0xf4c0, 0xf4c1, 0x7f93, 0xf4c3, 0xf4c4, 0xf4c5, 0x35fb, 0xf4c7, 0xf4c8, 0xf4c9, 0xf4ca, 0x3f93, 0xf4cc, 0xf4cd, 0xf4ce, 0xf4cf, 0xf4d0, 0xf4d1, 0xf4d2, 0xf4d3, 0xf4d4, 0xf4d5, 0x3ff9, 0xf4d7, 0x6432, 0xf4d9, /* 0x8b */ 0xf4da, 0xf4db, 0xf4dc, 0xf4dd, 0xf4de, 0xf4df, 0xf4e0, 0x3a18, 0xf4e2, 0xf4e3, 0xf4e4, 0xf4e5, 0xf4e6, 0xf4e7, 0xf4e8, 0xf4e9, 0x95aa, 0x54cc, 0x82c4, 0x55b9, 0xf4ee, 0xf4ef, 0x9c26, 0x9ab6, 0xf4f2, 0xf4f3, 0x7140, 0x816d, 0x80ec, 0x5c1c, 0xf4f8, 0x8134, 0x3797, 0x535f, 0xf4fc, 0x91b6, 0xf4fe, 0xf4ff, 0xf500, 0xf501, 0x35dd, 0xf503, 0x3609, 0xf505, 0x56af, 0xf507, 0xf508, 0xf509, 0xf50a, 0xf50b, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0x5a54, 0xf513, 0xf514, 0xf515, 0xf516, 0x579c, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0x3703, 0xf51f, 0xf520, 0xf521, 0xf522, 0xf523, 0xf524, 0xf525, 0xf526, 0x5899, 0x5268, 0x361a, 0xf52a, 0x7bb2, 0x5b68, 0x4800, 0x4b2c, 0x9f27, 0x49e7, 0x9c1f, 0x9b8d, 0xf533, 0xf534, 0x55fb, 0x35f2, 0x5689, 0x4e28, 0x5902, 0xf53a, 0xf53b, 0x9751, 0xf53d, 0x4e5b, 0x4ebb, 0x353e, 0x5c23, 0x5f51, 0x5fc4, 0x38fa, 0x624c, 0x6535, 0x6b7a, 0x6c35, 0x6c3a, 0x706c, 0x722b, 0x4e2c, 0x72ad, 0xf54e, 0x7f52, 0x793b, 0x7cf9, 0x7f53, 0xf553, 0x34c1, 0xf555, 0xf556, 0x8002, 0x8080, 0xf559, 0xf55a, 0x535d, 0x8864, 0x89c1, 0xf55e, 0x8ba0, 0x8d1d, 0x9485, 0x9578, 0x957f, 0x95e8, 0xf565, 0x97e6, 0x9875, 0x98ce, 0x98de, 0x9963, 0xf56b, 0x9c7c, 0x9e1f, 0x9ec4, 0x6b6f, 0xf907, 0x4e37, 0xf572, 0x961d, 0x6237, 0x94a2, 0xf576, /* 0x8c */ 0x503b, 0x6dfe, 0xf579, 0xf57a, 0x3dc9, 0x888f, 0xf57d, 0x7077, 0x5cf5, 0x4b20, 0xf581, 0x3559, 0xf583, 0x6122, 0xf585, 0x8fa7, 0x91f6, 0x7191, 0x6719, 0x73ba, 0xf58b, 0xf58c, 0x3c8b, 0xf58e, 0x4b10, 0x78e4, 0x7402, 0x51ae, 0xf593, 0x4009, 0x6a63, 0xf596, 0x4223, 0x860f, 0xf599, 0x7a2a, 0xf59b, 0xf59c, 0x9755, 0x704d, 0x5324, 0xf5a0, 0x93f4, 0x76d9, 0xf5a3, 0xf5a4, 0x77dd, 0x4ea3, 0x4ff0, 0x50bc, 0x4e2f, 0x4f17, 0xf5ab, 0x5434, 0x7d8b, 0x5892, 0x58d0, 0xf5b0, 0x5e92, 0x5e99, 0x5fc2, 0xf5b4, 0x658b, 0xf5b6, 0x6919, 0x6a43, 0xf5b9, 0x6cff, 0xf5bb, 0x7200, 0xf5bd, 0x738c, 0x3edb, 0xf5c0, 0x5b15, 0x74b9, 0x8b83, 0xf5c4, 0xf5c5, 0x7a93, 0x7bec, 0x7cc3, 0x7e6c, 0x82f8, 0x8597, 0xf5cc, 0x8890, 0xf5ce, 0x8eb9, 0xf5d0, 0x8fcf, 0x855f, 0x99e0, 0x9221, 0xf5d5, 0xf5d6, 0xf5d7, 0x4071, 0x42a2, 0x5a1a, 0xf5db, 0xf5dc, 0xf5dd, 0x9868, 0x676b, 0x4276, 0x573d, 0xf5e2, 0x85d6, 0xf5e4, 0x82bf, 0xf5e6, 0x4c81, 0xf5e8, 0x5d7b, 0xf5ea, 0xf5eb, 0xf5ec, 0xf5ed, 0x5b96, 0xf5ef, 0xf5f0, 0x7e5b, 0xf5f2, 0xf5f3, 0xf5f4, 0xf5f5, 0xf5f6, 0xf5f7, 0xf5f8, 0xf5f9, 0xf5fa, 0xf5fb, 0xf5fc, 0xf5fd, 0xf5fe, 0xf5ff, 0xf600, 0xf601, 0xf602, 0xf603, 0xf604, 0xf605, 0xf606, 0xf607, 0xf608, 0xf609, 0xf60a, 0xf60b, 0xf60c, 0xf60d, 0xf60e, 0xf60f, 0xf610, 0xf611, 0xf612, 0xf613, /* 0x8d */ 0xf614, 0xf615, 0xf616, 0xf617, 0xf618, 0xf619, 0xf61a, 0xf61b, 0xf61c, 0xf61d, 0xf61e, 0xf61f, 0xf620, 0xf621, 0xf622, 0xf623, 0xf624, 0xf625, 0xf626, 0xf627, 0xf628, 0xf629, 0xf62a, 0xf62b, 0xf62c, 0xf62d, 0xf62e, 0xf62f, 0xf630, 0xf631, 0xf632, 0xf633, 0x5d3e, 0x5d48, 0x5d56, 0x3dfc, 0x380f, 0x5da4, 0x5db9, 0x3820, 0x3838, 0x5e42, 0x5ebd, 0x5f25, 0x5f83, 0x3908, 0x3914, 0x393f, 0x394d, 0x60d7, 0x613d, 0x5ce5, 0x3989, 0x61b7, 0x61b9, 0x61cf, 0x39b8, 0x622c, 0x6290, 0x62e5, 0x6318, 0x39f8, 0x56b1, 0x3a03, 0x63e2, 0x63fb, 0x6407, 0x645a, 0x3a4b, 0x64c0, 0x5d15, 0x5621, 0x9f9f, 0x3a97, 0x6586, 0x3abd, 0x65ff, 0x6653, 0x3af2, 0x6692, 0x3b22, 0x6716, 0x3b42, 0x67a4, 0x6800, 0x3b58, 0x684a, 0x6884, 0x3b72, 0x3b71, 0x3b7b, 0x6909, 0x6943, 0x725c, 0x6964, 0x699f, 0x6985, 0x3bbc, 0x69d6, 0x3bdd, 0x6a65, 0x6a74, 0x6a71, 0x6a82, 0x3bec, 0x6a99, 0x3bf2, 0x6aab, 0x6ab5, 0x6ad4, 0x6af6, 0x6b81, 0x6bc1, 0x6bea, 0x6c75, 0x6caa, 0x3ccb, 0x6d02, 0x6d06, 0x6d26, 0x6d81, 0x3cef, 0x6da4, 0x6db1, 0x6e15, 0x6e18, 0x6e29, 0x6e86, 0xf694, 0x6ebb, 0x6ee2, 0x6eda, 0x9f7f, 0x6ee8, 0x6ee9, 0x6f24, 0x6f34, 0x3d46, 0xf69e, 0x6f81, 0x6fbe, 0x3d6a, 0x3d75, 0x71b7, 0x5c99, 0x3d8a, 0x702c, 0x3d91, 0x7050, 0x7054, 0x706f, 0x707f, 0x7089, 0xf6ad, 0x43c1, 0x35f1, 0xf6b0, /* 0x8e */ 0xe311, 0x57be, 0xe313, 0x713e, 0xe315, 0x364e, 0x69a2, 0xe318, 0x5b74, 0x7a49, 0xe31b, 0xe31c, 0x7a65, 0x7a7d, 0xe31f, 0x7abb, 0x7ab0, 0x7ac2, 0x7ac3, 0x71d1, 0xe325, 0x41ca, 0x7ada, 0x7add, 0x7aea, 0x41ef, 0x54b2, 0xe32c, 0x7b0b, 0x7b55, 0x7b29, 0xe330, 0xe331, 0x7ba2, 0x7b6f, 0x839c, 0xe335, 0xe336, 0x7bd0, 0x8421, 0x7b92, 0x7bb8, 0xe33b, 0x3dad, 0xe33d, 0x8492, 0x7bfa, 0x7c06, 0x7c35, 0xe342, 0x7c44, 0x7c83, 0xe345, 0x7ca6, 0x667d, 0xe348, 0x7cc9, 0x7cc7, 0x7ce6, 0x7c74, 0x7cf3, 0x7cf5, 0x7cce, 0x7e67, 0x451d, 0xe352, 0x7d5d, 0xe354, 0x748d, 0x7d89, 0x7dab, 0x7135, 0x7db3, 0x7dd2, 0xe35b, 0xe35c, 0x7de4, 0x3d13, 0x7df5, 0xe360, 0x7de5, 0xe362, 0x7e1d, 0xe364, 0xe365, 0x7e6e, 0x7e92, 0x432b, 0x946c, 0x7e27, 0x7f40, 0x7f41, 0x7f47, 0x7936, 0xe36f, 0x99e1, 0x7f97, 0xe372, 0x7fa3, 0xe374, 0xe375, 0x455c, 0xe377, 0x4503, 0xe379, 0x7ffa, 0xe37b, 0x8005, 0x8008, 0x801d, 0x8028, 0x802f, 0xe381, 0xe382, 0x803b, 0x803c, 0x8061, 0xe386, 0x4989, 0xe388, 0xe389, 0xe38a, 0x6725, 0x80a7, 0xe38d, 0x8107, 0x811a, 0x58b0, 0xe391, 0x6c7f, 0xe393, 0xe394, 0x64e7, 0xe396, 0x8218, 0xe398, 0x6a53, 0xe39a, 0xe39b, 0x447a, 0x8229, 0xe39e, 0xe39f, 0xe3a0, 0x4ff9, 0xe3a2, 0x84e2, 0x8362, 0xe3a5, 0xe3a6, 0xe3a7, 0xe3a8, 0xe3a9, 0x82aa, 0x691b, 0xe3ac, 0x41db, /* 0x8f */ 0x854b, 0x82d0, 0x831a, 0xe3b1, 0xe3b2, 0x36c1, 0xe3b4, 0xe3b5, 0x827b, 0x82e2, 0x8318, 0xe3b9, 0xe3ba, 0xe3bb, 0xe3bc, 0xe3bd, 0x3dbf, 0x831d, 0x55ec, 0x8385, 0x450b, 0xe3c3, 0x83ac, 0x83c1, 0x83d3, 0x347e, 0xe3c8, 0x6a57, 0x855a, 0x3496, 0xe3cc, 0xe3cd, 0x8458, 0xe3cf, 0x8471, 0x3dd3, 0x44e4, 0x6aa7, 0x844a, 0xe3d5, 0x7958, 0x84a8, 0xe3d8, 0xe3d9, 0xe3da, 0x84de, 0x840f, 0x8391, 0x44a0, 0x8493, 0x84e4, 0xe3e1, 0x4240, 0xe3e3, 0x4543, 0x8534, 0x5af2, 0xe3e7, 0x4527, 0x8573, 0x4516, 0x67bf, 0x8616, 0xe3ed, 0xe3ee, 0x85c1, 0xe3f0, 0x8602, 0xe3f2, 0xe3f3, 0xe3f4, 0x456a, 0x8628, 0x3648, 0xe3f8, 0x53f7, 0xe3fa, 0x867e, 0x8771, 0xe3fd, 0x87ee, 0xe3ff, 0x87b1, 0x87da, 0x880f, 0x5661, 0x866c, 0x6856, 0x460f, 0x8845, 0x8846, 0xe409, 0xe40a, 0xe40b, 0x885e, 0x889c, 0x465b, 0x88b4, 0x88b5, 0x63c1, 0x88c5, 0x7777, 0xe414, 0x8987, 0x898a, 0x89a6, 0x89a9, 0x89a7, 0x89bc, 0xe41b, 0x89e7, 0xe41d, 0xe41e, 0x8a9c, 0x7793, 0x91fe, 0x8a90, 0xe423, 0x7ae9, 0xe425, 0xe426, 0x4713, 0xe428, 0x717c, 0x8b0c, 0x8b1f, 0xe42c, 0xe42d, 0x8b3f, 0x8b4c, 0x8b4d, 0x8aa9, 0xe432, 0x8b90, 0x8b9b, 0x8aaf, 0xe436, 0x4615, 0x884f, 0x8c9b, 0xe43a, 0xe43b, 0xe43c, 0x3725, 0xe43e, 0x8cd6, 0xe440, 0xe441, 0x8d12, 0x8d03, 0xe444, 0x8cdb, 0x705c, 0x8d11, 0xe448, 0x3ed0, 0x8d77, /* 0x90 */ 0x8da9, 0xe44c, 0xe44d, 0xe44e, 0x3b7c, 0xe450, 0xe451, 0x7ae7, 0x8ead, 0x8eb6, 0x8ec3, 0x92d4, 0x8f19, 0x8f2d, 0xe459, 0xe45a, 0x8fa5, 0x9303, 0xe45d, 0xe45e, 0x8fb3, 0x492a, 0xe461, 0xe462, 0xe463, 0x5ef8, 0xe465, 0x8ff9, 0xe467, 0xe468, 0xe469, 0xe46a, 0x3980, 0xe46c, 0x9037, 0xe46e, 0xe46f, 0x9061, 0xe471, 0xe472, 0x90a8, 0xe474, 0x90c4, 0xe476, 0x90ae, 0x90fd, 0x9167, 0x3af0, 0x91a9, 0x91c4, 0x7cac, 0xe47e, 0xe47f, 0x920e, 0x6c9f, 0x9241, 0x9262, 0xe484, 0x92b9, 0xe486, 0xe487, 0xe488, 0xe489, 0xe48a, 0x932c, 0x936b, 0xe48d, 0xe48e, 0x708f, 0x5ac3, 0xe491, 0xe492, 0x4965, 0x9244, 0xe495, 0xe496, 0xe497, 0x9373, 0x945b, 0x8ebc, 0x9585, 0x95a6, 0x9426, 0x95a0, 0x6ff6, 0x42b9, 0xe4a1, 0xe4a2, 0xe4a3, 0xe4a4, 0x49df, 0x6c1c, 0x967b, 0x9696, 0x416c, 0x96a3, 0xe4ab, 0x61da, 0x96b6, 0x78f5, 0xe4af, 0x96bd, 0x53cc, 0x49a1, 0xe4b3, 0xe4b4, 0xe4b5, 0xe4b6, 0xe4b7, 0xe4b8, 0xe4b9, 0xe4ba, 0x9731, 0x8642, 0x9736, 0x4a0f, 0x453d, 0x4585, 0xe4c1, 0x7075, 0x5b41, 0x971b, 0x975c, 0xe4c6, 0x9757, 0x5b4a, 0xe4c9, 0x975f, 0x9425, 0x50d0, 0xe4cd, 0xe4ce, 0x9789, 0x979f, 0x97b1, 0x97be, 0x97c0, 0x97d2, 0x97e0, 0xe4d6, 0x97ee, 0x741c, 0xe4d9, 0x97ff, 0x97f5, 0xe4dc, 0xe4dd, 0x4ad1, 0x9834, 0x9833, 0x984b, 0x9866, 0x3b0e, 0xe4e4, 0x3d51, 0xe4e6, 0xe4e7, /* 0x91 */ 0xe4e8, 0x98ca, 0x98b7, 0x98c8, 0x98c7, 0x4aff, 0xe4ee, 0xe4ef, 0x55b0, 0x98e1, 0x98e6, 0x98ec, 0x9378, 0x9939, 0xe4f6, 0x4b72, 0xe4f8, 0xe4f9, 0x99f5, 0x9a0c, 0x9a3b, 0x9a10, 0x9a58, 0xe4ff, 0x36c4, 0xe501, 0xe502, 0x9ae0, 0x9ae2, 0xe505, 0x9af4, 0x4c0e, 0x9b14, 0x9b2d, 0xe50a, 0x5034, 0x9b34, 0xe50d, 0x38c3, 0xe50f, 0x9b50, 0x9b40, 0xe512, 0x5a45, 0xe514, 0x9b8e, 0xe516, 0x9c02, 0x9bff, 0x9c0c, 0xe51a, 0x9dd4, 0xe51c, 0xe51d, 0xe51e, 0xe51f, 0xe520, 0xe521, 0x9d7e, 0x9d83, 0xe524, 0x9e0e, 0x6888, 0x9dc4, 0xe528, 0xe529, 0xe52a, 0xe52b, 0xe52c, 0x9d39, 0xe52e, 0xe52f, 0x9e90, 0x9e95, 0x9e9e, 0x9ea2, 0x4d34, 0x9eaa, 0x9eaf, 0xe537, 0x9ec1, 0x3b60, 0x39e5, 0x3d1d, 0x4f32, 0x37be, 0xe53e, 0x9f02, 0x9f08, 0x4b96, 0x9424, 0xe543, 0x9f17, 0x9f16, 0x9f39, 0x569f, 0x568a, 0x9f45, 0x99b8, 0xe54b, 0x97f2, 0x847f, 0x9f62, 0x9f69, 0x7adc, 0x9f8e, 0x7216, 0x4bbe, 0xe554, 0xe555, 0x7177, 0xe557, 0xe558, 0xe559, 0x739e, 0xe55b, 0xe55c, 0x799f, 0xe55e, 0xe55f, 0x9369, 0x93f3, 0xe562, 0x92ec, 0x9381, 0x93cb, 0xe566, 0xe567, 0x7217, 0x3eeb, 0x7772, 0x7a43, 0x70d0, 0xe56d, 0xe56e, 0x717e, 0xe570, 0x70a3, 0xe572, 0xe573, 0x3ec7, 0xe575, 0xe576, 0xe577, 0x3722, 0xe579, 0xe57a, 0x36e1, 0xe57c, 0xe57d, 0xe57e, 0x3723, 0xe580, 0x575b, 0xe582, 0xe583, 0xe584, /* 0x92 */ 0xe585, 0xe586, 0x8503, 0xe588, 0x8503, 0x8455, 0xe58b, 0xe58c, 0xe58d, 0xe58e, 0xe58f, 0xe590, 0x44f4, 0xe592, 0xe593, 0xe594, 0x67f9, 0x3733, 0x3c15, 0x3de7, 0x586c, 0xe59a, 0x6810, 0x4057, 0xe59d, 0xe59e, 0xe59f, 0xe5a0, 0xe5a1, 0x54cb, 0x569e, 0xe5a4, 0x5692, 0xe5a6, 0xe5a7, 0xe5a8, 0x93c6, 0xe5aa, 0x939c, 0x4ef8, 0x512b, 0x3819, 0xe5af, 0x4ebc, 0xe5b1, 0xe5b2, 0x4f4b, 0x4f8a, 0xe5b5, 0x5a68, 0xe5b7, 0xe5b8, 0x3999, 0xe5ba, 0xe5bb, 0x3435, 0x4f29, 0xe5be, 0xe5bf, 0xe5c0, 0x8ada, 0xe5c2, 0x4e98, 0x50cd, 0x510d, 0x4fa2, 0x4f03, 0xe5c8, 0xe5c9, 0x4f42, 0x502e, 0x506c, 0x5081, 0x4fcc, 0x4fe5, 0x5058, 0x50fc, 0x5159, 0x515b, 0x515d, 0x515e, 0x6e76, 0xe5d7, 0xe5d8, 0xe5d9, 0x6d72, 0xe5db, 0xe5dc, 0x51a8, 0x51c3, 0xe5df, 0x44dd, 0xe5e1, 0xe5e2, 0xe5e3, 0x8d7a, 0xe5e5, 0xe5e6, 0x5259, 0x52a4, 0xe5e9, 0x52e1, 0x936e, 0x467a, 0x718c, 0xe5ee, 0xe5ef, 0xe5f0, 0xe5f1, 0x69d1, 0xe5f3, 0x7479, 0x3ede, 0x7499, 0x7414, 0x7456, 0x7398, 0x4b8e, 0xe5fb, 0xe5fc, 0x53d0, 0x3584, 0x720f, 0xe600, 0x55b4, 0xe602, 0x54cd, 0xe604, 0x571d, 0x925d, 0x96f4, 0x9366, 0x57dd, 0x578d, 0x577f, 0x363e, 0x58cb, 0x5a99, 0xe60f, 0xe610, 0xe611, 0xe612, 0x5a2c, 0x59b8, 0x928f, 0x5a7e, 0x5acf, 0x5a12, 0xe619, 0xe61a, 0xe61b, 0xe61c, 0x36f5, 0x6d05, 0x7443, 0x5a21, 0xe621, /* 0x93 */ 0x5a81, 0xe623, 0xe624, 0x93e0, 0x748c, 0xe627, 0x7105, 0x4972, 0x9408, 0xe62b, 0x93bd, 0x37a0, 0x5c1e, 0x5c9e, 0x5e5e, 0x5e48, 0xe632, 0xe633, 0xe634, 0x5ecd, 0x5b4f, 0xe637, 0xe638, 0x3701, 0xe63a, 0x36dd, 0xe63c, 0x36d3, 0x812a, 0xe63f, 0xe640, 0xe641, 0xe642, 0x5f0c, 0x5f0e, 0xe645, 0xe646, 0x5a6b, 0xe648, 0x5b44, 0x8614, 0xe64b, 0x8860, 0x607e, 0xe64e, 0xe64f, 0x5fdb, 0x3eb8, 0xe652, 0xe653, 0xe654, 0xe655, 0x61c0, 0xe657, 0xe658, 0xe659, 0x6199, 0x6198, 0x6075, 0xe65d, 0xe65e, 0xe65f, 0xe660, 0x6471, 0xe662, 0xe663, 0x3a29, 0xe665, 0xe666, 0xe667, 0xe668, 0x6337, 0xe66a, 0x64b6, 0x6331, 0x63d1, 0xe66e, 0xe66f, 0x62a4, 0xe671, 0x643b, 0x656b, 0x6972, 0x3bf4, 0xe676, 0xe677, 0xe678, 0xe679, 0x550d, 0xe67b, 0xe67c, 0xe67d, 0x66ce, 0xe67f, 0xe680, 0x3ae0, 0x4190, 0xe683, 0xe684, 0xe685, 0xe686, 0xe687, 0xe688, 0x78ee, 0xe68a, 0xe68b, 0xe68c, 0x3464, 0xe68e, 0xe68f, 0xe690, 0x668e, 0xe692, 0x666b, 0x4b93, 0x6630, 0xe696, 0xe697, 0x6663, 0xe699, 0xe69a, 0x661e, 0xe69c, 0x38d1, 0xe69e, 0xe69f, 0x3b99, 0xe6a1, 0xe6a2, 0x74d0, 0x3b96, 0x678f, 0xe6a6, 0x68b6, 0x681e, 0x3bc4, 0x6abe, 0x3863, 0xe6ac, 0xe6ad, 0x6a33, 0x6a52, 0x6ac9, 0x6b05, 0xe6b2, 0x6511, 0x6898, 0x6a4c, 0x3bd7, 0x6a7a, 0x6b57, 0xe6b9, 0xe6ba, 0x93a0, 0x92f2, 0xe6bd, 0xe6be, /* 0x94 */ 0x9289, 0xe6c0, 0xe6c1, 0x9467, 0x6da5, 0x6f0b, 0xe6c5, 0x6d67, 0xe6c7, 0x3d8f, 0x6e04, 0xe6ca, 0x5a3d, 0x6e0a, 0x5847, 0x6d24, 0x7842, 0x713b, 0xe6d1, 0xe6d2, 0x70f1, 0x7250, 0x7287, 0x7294, 0xe6d7, 0xe6d8, 0x5179, 0xe6da, 0xe6db, 0x747a, 0xe6dd, 0xe6de, 0xe6df, 0xe6e0, 0xe6e1, 0x3f06, 0x3eb1, 0xe6e4, 0xe6e5, 0xe6e6, 0x60a7, 0x3ef3, 0x74cc, 0x743c, 0x9387, 0x7437, 0x449f, 0xe6ee, 0x4551, 0x7583, 0x3f63, 0xe6f2, 0xe6f3, 0x3f58, 0x7555, 0x7673, 0xe6f7, 0x3b19, 0x7468, 0xe6fa, 0xe6fb, 0xe6fc, 0x3afb, 0x3dcd, 0xe6ff, 0x3eff, 0xe701, 0xe702, 0x91fa, 0x5732, 0x9342, 0xe706, 0xe707, 0x50df, 0xe709, 0xe70a, 0x7778, 0xe70c, 0x770e, 0x770f, 0x777b, 0xe710, 0xe711, 0x3a5e, 0xe713, 0x7438, 0x749b, 0x3ebf, 0xe717, 0xe718, 0x40c8, 0xe71a, 0xe71b, 0x9307, 0xe71d, 0x781e, 0x788d, 0x7888, 0x78d2, 0x73d0, 0x7959, 0xe724, 0xe725, 0x410e, 0x799b, 0x8496, 0x79a5, 0x6a2d, 0xe72b, 0x7a3a, 0x79f4, 0x416e, 0xe72f, 0x4132, 0x9235, 0x79f1, 0xe733, 0xe734, 0xe735, 0xe736, 0xe737, 0x3597, 0x556b, 0x3570, 0x36aa, 0xe73c, 0xe73d, 0x7ae2, 0x5a59, 0xe740, 0xe741, 0xe742, 0x5a0d, 0xe744, 0x78f0, 0x5a2a, 0xe747, 0x7afe, 0x41f9, 0x7c5d, 0x7c6d, 0x4211, 0xe74d, 0xe74e, 0xe74f, 0x7ccd, 0xe751, 0xe752, 0x7c8e, 0x7c7c, 0x7cae, 0x6ab2, 0x7ddc, 0x7e07, 0x7dd3, 0x7f4e, 0xe75b, /* 0x95 */ 0xe75c, 0xe75d, 0x7d97, 0xe75f, 0x426a, 0xe761, 0xe762, 0x67d6, 0xe764, 0xe765, 0x57c4, 0xe767, 0xe768, 0xe769, 0x7fdd, 0x7b27, 0xe76c, 0xe76d, 0xe76e, 0x7b0c, 0xe770, 0x99e6, 0x8645, 0x9a63, 0x6a1c, 0xe775, 0x39e2, 0xe777, 0xe778, 0x9a1f, 0xe77a, 0x8480, 0xe77c, 0xe77d, 0x44ea, 0x8137, 0x4402, 0x80c6, 0x8109, 0x8142, 0xe784, 0x98c3, 0xe786, 0x8262, 0x8265, 0xe789, 0x8453, 0xe78b, 0x8610, 0xe78d, 0x5a86, 0x417f, 0xe790, 0x5b2b, 0xe792, 0x5ae4, 0xe794, 0x86a0, 0xe796, 0xe797, 0x882d, 0xe799, 0x5a02, 0x886e, 0x4f45, 0x8887, 0x88bf, 0x88e6, 0x8965, 0x894d, 0xe7a2, 0x8954, 0xe7a4, 0xe7a5, 0xe7a6, 0xe7a7, 0xe7a8, 0xe7a9, 0x3ead, 0x84a3, 0x46f5, 0x46cf, 0x37f2, 0x8a3d, 0x8a1c, 0xe7b1, 0x5f4d, 0x922b, 0xe7b4, 0x65d4, 0x7129, 0x70c4, 0xe7b8, 0x9d6d, 0x8c9f, 0x8ce9, 0xe7bc, 0x599a, 0x77c3, 0x59f0, 0x436e, 0x36d4, 0x8e2a, 0x8ea7, 0xe7c4, 0x8f30, 0x8f4a, 0x42f4, 0x6c58, 0x6fbb, 0xe7ca, 0x489b, 0x6f79, 0x6e8b, 0xe7ce, 0x9be9, 0x36b5, 0xe7d1, 0x90bb, 0x9097, 0x5571, 0x4906, 0x91bb, 0x9404, 0xe7d8, 0x4062, 0xe7da, 0x9427, 0xe7dc, 0xe7dd, 0x84e5, 0x8a2b, 0x9599, 0x95a7, 0x9597, 0x9596, 0xe7e4, 0x7445, 0x3ec2, 0xe7e7, 0xe7e8, 0xe7e9, 0x3ee7, 0xe7eb, 0x968f, 0xe7ed, 0xe7ee, 0xe7ef, 0x3ecc, 0xe7f1, 0xe7f2, 0xe7f3, 0x7412, 0x746b, 0x3efc, 0x9741, 0xe7f8, /* 0x96 */ 0x6847, 0x4a1d, 0xe7fb, 0xe7fc, 0x975d, 0x9368, 0xe7ff, 0xe800, 0xe801, 0xe802, 0x92ba, 0x5b11, 0x8b69, 0x493c, 0x73f9, 0xe808, 0x979b, 0x9771, 0x9938, 0xe80c, 0x5dc1, 0xe80e, 0xe80f, 0x981f, 0xe811, 0x92f6, 0xe813, 0x91e5, 0x44c0, 0xe816, 0xe817, 0xe818, 0x98dc, 0xe81a, 0x3f00, 0x922a, 0x4925, 0x8414, 0x993b, 0x994d, 0xe821, 0x3dfd, 0x999b, 0x4b6f, 0x99aa, 0x9a5c, 0xe827, 0xe828, 0x6a8f, 0x9a21, 0x5afe, 0x9a2f, 0xe82d, 0x4b90, 0xe82f, 0x99bc, 0x4bbd, 0x4b97, 0x937d, 0x5872, 0xe835, 0x5822, 0xe837, 0xe838, 0x7844, 0xe83a, 0xe83b, 0x68c5, 0x3d7d, 0x9458, 0x3927, 0x6150, 0xe841, 0xe842, 0x6107, 0x9c4f, 0x9c53, 0x9c7b, 0x9c35, 0x9c10, 0x9b7f, 0x9bcf, 0xe84b, 0x9b9f, 0xe84d, 0xe84e, 0x9d21, 0x4cae, 0xe851, 0x9e18, 0x4cb0, 0x9d0c, 0xe855, 0xe856, 0xe857, 0xe858, 0x9da5, 0x84bd, 0xe85b, 0xe85c, 0xe85d, 0x85fc, 0x4533, 0xe860, 0xe861, 0xe862, 0x8420, 0x85ee, 0xe865, 0xe866, 0xe867, 0x79e2, 0xe869, 0xe86a, 0x492d, 0xe86c, 0x3d62, 0x93db, 0x92be, 0x9348, 0xe871, 0x78b9, 0x9277, 0x944d, 0x4fe4, 0x3440, 0x9064, 0xe878, 0x783d, 0x7854, 0x78b6, 0x784b, 0xe87d, 0xe87e, 0xe87f, 0x369a, 0x4f72, 0x6fda, 0x6fd9, 0x701e, 0x701e, 0x5414, 0xe887, 0x57bb, 0x58f3, 0x578a, 0x9d16, 0x57d7, 0x7134, 0x34af, 0xe88f, 0x71eb, 0xe891, 0xe892, 0x5b28, 0xe894, 0xe895, /* 0x97 */ 0x610c, 0x5ace, 0x5a0b, 0x42bc, 0xe89a, 0x372c, 0x4b7b, 0xe89d, 0x93bb, 0x93b8, 0xe8a0, 0xe8a1, 0x8472, 0xe8a3, 0xe8a4, 0xe8a5, 0xe8a6, 0xe8a7, 0x5994, 0xe8a9, 0xe8aa, 0x7da8, 0xe8ac, 0xe8ad, 0xe8ae, 0xe8af, 0xe8b0, 0x92e5, 0x73e2, 0x3ee9, 0x74b4, 0xe8b5, 0xe8b6, 0x3ee1, 0xe8b8, 0x6ad8, 0x73f3, 0x73fb, 0x3ed6, 0xe8bd, 0xe8be, 0xe8bf, 0xe8c0, 0xe8c1, 0xe8c2, 0xe8c3, 0x7448, 0xe8c5, 0x70a5, 0xe8c7, 0x9284, 0x73e6, 0x935f, 0xe8cb, 0x9331, 0xe8cd, 0xe8ce, 0x9386, 0xe8d0, 0xe8d1, 0x4935, 0xe8d3, 0x716b, 0xe8d5, 0xe8d6, 0x56a4, 0xe8d8, 0xe8d9, 0xe8da, 0x5502, 0x79c4, 0xe8dd, 0x7dfe, 0xe8df, 0xe8e0, 0xe8e1, 0x452e, 0x9401, 0x370a, 0xe8e5, 0xe8e6, 0x59b0, 0xe8e8, 0xe8e9, 0xe8ea, 0x5aa1, 0x36e2, 0xe8ed, 0x36b0, 0x925f, 0x5a79, 0xe8f1, 0xe8f2, 0x9374, 0x3ccd, 0xe8f5, 0x4a96, 0x398a, 0x50f4, 0x3d69, 0x3d4c, 0xe8fb, 0x7175, 0x42fb, 0xe8fe, 0x6e0f, 0xe900, 0x44eb, 0x6d57, 0xe903, 0x7067, 0x6caf, 0x3cd6, 0xe907, 0xe908, 0x6e02, 0x6f0c, 0x3d6f, 0xe90c, 0x7551, 0x36bc, 0x34c8, 0x4680, 0x3eda, 0x4871, 0x59c4, 0x926e, 0x493e, 0x8f41, 0xe917, 0xe918, 0x5812, 0x57c8, 0x36d6, 0xe91c, 0x70fe, 0xe91e, 0xe91f, 0xe920, 0xe921, 0xe922, 0x68b9, 0x6967, 0xe925, 0xe926, 0xe927, 0xe928, 0xe929, 0xe92a, 0xe92b, 0xe92c, 0x6a1a, 0xe92e, 0xe92f, 0x843e, 0x44df, 0x44ce, /* 0x98 */ 0xe933, 0xe934, 0xe935, 0xe936, 0x6f17, 0xe938, 0x833d, 0xe93a, 0x83ed, 0xe93c, 0xe93d, 0xe93e, 0x5989, 0x5a82, 0xe941, 0x5a61, 0x5a71, 0xe944, 0xe945, 0x372d, 0x59ef, 0xe948, 0x36c7, 0x718e, 0x9390, 0x669a, 0xe94d, 0x5a6e, 0x5a2b, 0xe950, 0x6a2b, 0xe952, 0xe953, 0xe954, 0xe955, 0x711d, 0xe957, 0xe958, 0x4fb0, 0xe95a, 0x5cc2, 0xe95c, 0xe95d, 0xe95e, 0x6a0c, 0xe960, 0xe961, 0x70a6, 0x7133, 0xe964, 0x3da5, 0x6cdf, 0xe967, 0xe968, 0x7e65, 0x59eb, 0x5d2f, 0x3df3, 0x5f5c, 0xe96e, 0xe96f, 0x7da4, 0x8426, 0x5485, 0xe973, 0xe974, 0xe975, 0x577e, 0xe977, 0xe978, 0x3fe5, 0xe97a, 0xe97b, 0x7003, 0xe97d, 0x5d70, 0x738f, 0x7cd3, 0xe981, 0xe982, 0x4fc8, 0x7fe7, 0x72cd, 0x7310, 0xe987, 0x7338, 0x7339, 0xe98a, 0x7341, 0x7348, 0x3ea9, 0xe98e, 0x906c, 0x71f5, 0xe991, 0x73e1, 0x81f6, 0x3eca, 0x770c, 0x3ed1, 0x6ca2, 0x56fd, 0x7419, 0x741e, 0x741f, 0x3ee2, 0x3ef0, 0x3ef4, 0x3efa, 0x74d3, 0x3f0e, 0x3f53, 0x7542, 0x756d, 0x7572, 0x758d, 0x3f7c, 0x75c8, 0x75dc, 0x3fc0, 0x764d, 0x3fd7, 0x7674, 0x3fdc, 0x767a, 0xe9b0, 0x7188, 0x5623, 0x8980, 0x5869, 0x401d, 0x7743, 0x4039, 0x6761, 0x4045, 0x35db, 0x7798, 0x406a, 0x406f, 0x5c5e, 0x77be, 0x77cb, 0x58f2, 0x7818, 0x70b9, 0x781c, 0x40a8, 0x7839, 0x7847, 0x7851, 0x7866, 0x8448, 0xe9cb, 0x7933, 0x6803, 0x7932, 0x4103, /* 0x99 */ 0x4109, 0x7991, 0x7999, 0x8fbb, 0x7a06, 0x8fbc, 0x4167, 0x7a91, 0x41b2, 0x7abc, 0x8279, 0x41c4, 0x7acf, 0x7adb, 0x41cf, 0x4e21, 0x7b62, 0x7b6c, 0x7b7b, 0x7c12, 0x7c1b, 0x4260, 0x427a, 0x7c7b, 0x7c9c, 0x428c, 0x7cb8, 0x4294, 0x7ced, 0x8f93, 0x70c0, 0xe9ef, 0x7dcf, 0x7dd4, 0x7dd0, 0x7dfd, 0x7fae, 0x7fb4, 0x729f, 0x4397, 0x8020, 0x8025, 0x7b39, 0x802e, 0x8031, 0x8054, 0x3dcc, 0x57b4, 0x70a0, 0x80b7, 0x80e9, 0x43ed, 0x810c, 0x732a, 0x810e, 0x8112, 0x7560, 0x8114, 0x4401, 0x3b39, 0x8156, 0x8159, 0x815a, 0x4413, 0x583a, 0x817c, 0x8184, 0x4425, 0x8193, 0x442d, 0x81a5, 0x57ef, 0x81c1, 0x81e4, 0x8254, 0x448f, 0x82a6, 0x8276, 0x82ca, 0x82d8, 0x82ff, 0x44b0, 0x8357, 0x9669, 0x698a, 0x8405, 0x70f5, 0x8464, 0x60e3, 0x8488, 0x4504, 0x84be, 0x84e1, 0x84f8, 0x8510, 0x8538, 0x8552, 0x453b, 0x856f, 0x8570, 0x85e0, 0x4577, 0x8672, 0x8692, 0x86b2, 0x86ef, 0x9645, 0x878b, 0x4606, 0x4617, 0x88ae, 0x88ff, 0x8924, 0x8947, 0x8991, 0xea43, 0x8a29, 0x8a38, 0x8a94, 0x8ab4, 0x8c51, 0x8cd4, 0x8cf2, 0x8d1c, 0x4798, 0x585f, 0x8dc3, 0x47ed, 0x4eee, 0x8e3a, 0x55d8, 0x5754, 0x8e71, 0x55f5, 0x8eb0, 0x4837, 0x8ece, 0x8ee2, 0x8ee4, 0x8eed, 0x8ef2, 0x8fb7, 0x8fc1, 0x8fca, 0x8fcc, 0x9033, 0x99c4, 0x48ad, 0x98e0, 0x9213, 0x491e, 0x9228, 0x9258, 0x926b, 0x92b1, 0x92ae, 0x92bf, /* 0x9a */ 0x92e3, 0x92eb, 0x92f3, 0x92f4, 0x92fd, 0x9343, 0x9384, 0x93ad, 0x4945, 0x4951, 0x9ebf, 0x9417, 0x5301, 0x941d, 0x942d, 0x943e, 0x496a, 0x9454, 0x9479, 0x952d, 0x95a2, 0x49a7, 0x95f4, 0x9633, 0x49e5, 0x67a0, 0x4a24, 0x9740, 0x4a35, 0x97b2, 0x97c2, 0x5654, 0x4ae4, 0x60e8, 0x98b9, 0x4b19, 0x98f1, 0x5844, 0x990e, 0x9919, 0x51b4, 0x991c, 0x9937, 0x9942, 0x995d, 0x9962, 0x4b70, 0x99c5, 0x4b9d, 0x9a3c, 0x9b0f, 0x7a83, 0x9b69, 0x9b81, 0x9bdd, 0x9bf1, 0x9bf4, 0x4c6d, 0x9c20, 0x376f, 0xeaa9, 0x9d49, 0x9c3a, 0x9efe, 0x5650, 0x9d93, 0x9dbd, 0x9dc0, 0x9dfc, 0x94f6, 0x8fb6, 0x9e7b, 0x9eac, 0x9eb1, 0x9ebd, 0x9ec6, 0x94dc, 0x9ee2, 0x9ef1, 0x9ef8, 0x7ac8, 0x9f44, 0xeabf, 0xeac0, 0xeac1, 0x691a, 0x94c3, 0x59ac, 0xeac5, 0x5840, 0x94c1, 0x37b9, 0xeac9, 0xeaca, 0xeacb, 0xeacc, 0x5757, 0x7173, 0xeacf, 0xead0, 0xead1, 0x546a, 0xead3, 0xead4, 0x549e, 0xead6, 0xead7, 0xead8, 0xead9, 0xeada, 0x60e7, 0xeadc, 0x567a, 0xeade, 0xeadf, 0xeae0, 0xeae1, 0xeae2, 0xeae3, 0x6955, 0x9c2f, 0x87a5, 0xeae7, 0xeae8, 0xeae9, 0xeaea, 0xeaeb, 0xeaec, 0x5c20, 0xeaee, 0x5e0b, 0xeaf0, 0xeaf1, 0xeaf2, 0x671e, 0xeaf4, 0xeaf5, 0xeaf6, 0x3647, 0xeaf8, 0xeaf9, 0xeafa, 0xeafb, 0x5364, 0x84ad, 0xeafe, 0xeaff, 0xeb00, 0x8b81, 0xeb02, 0xeb03, 0xeb04, 0xeb05, 0x4e78, 0x70bb, 0xeb08, 0xeb09, /* 0x9b */ 0xeb0a, 0xeb0b, 0xeb0c, 0xeb0d, 0xeb0e, 0xeb0f, 0x62c3, 0xeb11, 0xeb12, 0x7198, 0x6855, 0xeb15, 0x69e9, 0x36c8, 0xeb18, 0xeb19, 0xeb1a, 0xeb1b, 0xeb1c, 0xeb1d, 0x82fd, 0xeb1f, 0xeb20, 0xeb21, 0x89a5, 0xeb23, 0x8fa0, 0xeb25, 0x97b8, 0xeb27, 0x9847, 0x9abd, 0xeb2a, 0xeb2b, 0xeb2c, 0xeb2d, 0xeb2e, 0xeb2f, 0xeb30, 0xeb31, 0xeb32, 0xeb33, 0xeb34, 0xeb35, 0xeb36, 0xeb37, 0xeb38, 0xeb39, 0x5fb1, 0x6648, 0x66bf, 0xeb3d, 0xeb3e, 0xeb3f, 0x7201, 0xeb41, 0x77d7, 0xeb43, 0xeb44, 0x7e87, 0xeb46, 0x58b5, 0x670e, 0x6918, 0xeb4a, 0xeb4b, 0xeb4c, 0xeb4d, 0xeb4e, 0xeb4f, 0xeb50, 0x48d0, 0x4ab8, 0xeb53, 0xeb54, 0xeb55, 0xeb56, 0xeb57, 0xeb58, 0xeb59, 0xeb5a, 0xeb5b, 0x51d2, 0xeb5d, 0x599f, 0xeb5f, 0x3bbe, 0xeb61, 0xeb62, 0xeb63, 0x5788, 0xeb65, 0x399b, 0xeb67, 0xeb68, 0xeb69, 0x3762, 0xeb6b, 0x8b5e, 0xeb6d, 0x99d6, 0xeb6f, 0xeb70, 0xeb71, 0x7209, 0xeb73, 0xeb74, 0x5965, 0xeb76, 0xeb77, 0xeb78, 0x8eda, 0xeb7a, 0x528f, 0x573f, 0x7171, 0xeb7e, 0xeb7f, 0xeb80, 0xeb81, 0x55bc, 0xeb83, 0xeb84, 0xeb85, 0x91d4, 0x3473, 0xeb88, 0xeb89, 0xeb8a, 0x4718, 0xeb8c, 0xeb8d, 0xeb8e, 0xeb8f, 0xeb90, 0x5066, 0x34fb, 0xeb93, 0x60de, 0xeb95, 0x477c, 0xeb97, 0xeb98, 0xeb99, 0xeb9a, 0xeb9b, 0x57a1, 0x7151, 0x6fb6, 0xeb9f, 0xeba0, 0x9056, 0xeba2, 0xeba3, 0x8b62, 0xeba5, 0xeba6, /* 0x9c */ 0x5d5b, 0xeba8, 0x8f36, 0xebaa, 0xebab, 0x8aea, 0xebad, 0xebae, 0xebaf, 0xebb0, 0x4bc0, 0xebb2, 0xebb3, 0xebb4, 0x9465, 0xebb6, 0x6195, 0x5a27, 0xebb9, 0x4fbb, 0x56b9, 0xebbc, 0xebbd, 0x4e6a, 0xebbf, 0x9656, 0x6d8f, 0xebc2, 0x3618, 0x8977, 0xebc5, 0xebc6, 0xebc7, 0xebc8, 0x71df, 0xebca, 0x7b42, 0xebcc, 0xebcd, 0xebce, 0x9104, 0xebd0, 0x7a45, 0x9df0, 0xebd3, 0x9a26, 0xebd5, 0x365f, 0xebd7, 0xebd8, 0x7983, 0xebda, 0xebdb, 0x5d2c, 0xebdd, 0x83cf, 0xebdf, 0x46d0, 0xebe1, 0x753b, 0x8865, 0xebe4, 0x58b6, 0x371c, 0xebe7, 0xebe8, 0xebe9, 0x3c54, 0xebeb, 0xebec, 0x9281, 0xebee, 0xebef, 0x9330, 0xebf1, 0xebf2, 0x6c39, 0x949f, 0xebf5, 0xebf6, 0x8827, 0x88f5, 0xebf9, 0xebfa, 0xebfb, 0x6eb8, 0xebfd, 0xebfe, 0x39a4, 0x36b9, 0x5c10, 0x79e3, 0x453f, 0x66b6, 0xec05, 0xec06, 0x8943, 0xec08, 0xec09, 0x56d6, 0x40df, 0xec0c, 0x39a1, 0xec0e, 0xec0f, 0xec10, 0x71ad, 0x8366, 0xec13, 0xec14, 0x5a67, 0x4cb7, 0xec17, 0xec18, 0xec19, 0xec1a, 0xec1b, 0xec1c, 0xec1d, 0x7b43, 0x797e, 0xec20, 0x6fb5, 0xec22, 0x6a03, 0xec24, 0x53a2, 0xec26, 0x93bf, 0x6836, 0x975d, 0xec2a, 0xec2b, 0xec2c, 0xec2d, 0xec2e, 0xec2f, 0x5d85, 0xec31, 0xec32, 0x5715, 0x9823, 0xec35, 0x5dab, 0xec37, 0x65be, 0x69d5, 0x53d2, 0xec3b, 0xec3c, 0x3c11, 0x6736, 0xec3f, 0xec40, 0xec41, 0xec42, 0xec43, /* 0x9d */ 0xec44, 0xec45, 0xec46, 0xec47, 0xec48, 0xec49, 0x35ca, 0xec4b, 0xec4c, 0x48fa, 0x63e6, 0xec4f, 0x7808, 0x9255, 0xec52, 0x43f2, 0xec54, 0x43df, 0xec56, 0xec57, 0xec58, 0x59f8, 0xec5a, 0x8f0b, 0xec5c, 0xec5d, 0x7b51, 0xec5f, 0xec60, 0x3df7, 0xec62, 0xec63, 0x8fd0, 0x728f, 0x568b, 0xec67, 0xec68, 0xec69, 0xec6a, 0xec6b, 0xec6c, 0xec6d, 0xec6e, 0xec6f, 0xec70, 0xec71, 0xec72, 0xec73, 0x7e9f, 0xec75, 0xec76, 0x4ca4, 0x9547, 0xec79, 0x71a2, 0xec7b, 0x4d91, 0x9012, 0xec7e, 0x4d9c, 0xec80, 0x8fbe, 0x55c1, 0x8fba, 0xec84, 0x8fb9, 0xec86, 0x4509, 0x7e7f, 0x6f56, 0x6ab1, 0x4eea, 0x34e4, 0xec8d, 0xec8e, 0x373a, 0x8e80, 0xec91, 0xec92, 0xec93, 0xec94, 0xec95, 0xec96, 0x3deb, 0xec98, 0xec99, 0xec9a, 0xec9b, 0x4e9a, 0xec9d, 0xec9e, 0x56bf, 0xeca0, 0x8e0e, 0x5b6d, 0xeca3, 0xeca4, 0x63de, 0x62d0, 0xeca7, 0xeca8, 0x6530, 0x562d, 0xecab, 0x541a, 0xecad, 0x3dc6, 0xecaf, 0x4c7d, 0x5622, 0x561e, 0x7f49, 0xecb4, 0x5975, 0xecb6, 0x8770, 0x4e1c, 0xecb9, 0xecba, 0xecbb, 0x8117, 0x9d5e, 0x8d18, 0x763b, 0x9c45, 0x764e, 0x77b9, 0x9345, 0x5432, 0x8148, 0x82f7, 0x5625, 0x8132, 0x8418, 0x80bd, 0x55ea, 0x7962, 0x5643, 0x5416, 0xeccf, 0x35ce, 0x5605, 0x55f1, 0x66f1, 0xecd4, 0x362d, 0x7534, 0x55f0, 0x55ba, 0x5497, 0x5572, 0xecdb, 0xecdc, 0x5ed0, 0xecde, 0xecdf, 0xece0, /* 0x9e */ 0xece1, 0x9eab, 0x7d5a, 0x55de, 0xece5, 0x629d, 0x976d, 0x5494, 0x8ccd, 0x71f6, 0x9176, 0x63fc, 0x63b9, 0x63fe, 0x5569, 0xecf0, 0x9c72, 0xecf2, 0x519a, 0x34df, 0xecf5, 0x51a7, 0x544d, 0x551e, 0x5513, 0x7666, 0x8e2d, 0xecfc, 0x75b1, 0x80b6, 0x8804, 0x8786, 0x88c7, 0x81b6, 0x841c, 0xed04, 0x44ec, 0x7304, 0xed07, 0x5b90, 0x830b, 0xed0a, 0x567b, 0xed0c, 0xed0d, 0xed0e, 0xed0f, 0xed10, 0xed11, 0x9170, 0xed13, 0x9208, 0xed15, 0xed16, 0xed17, 0xed18, 0x7266, 0xed1a, 0x474e, 0xed1c, 0xed1d, 0xed1e, 0x40fa, 0x9c5d, 0x651f, 0xed22, 0x48f3, 0xed24, 0xed25, 0xed26, 0xed27, 0x6062, 0xed29, 0xed2a, 0xed2b, 0xed2c, 0xed2d, 0x71a3, 0x7e8e, 0x9d50, 0x4e1a, 0x4e04, 0x3577, 0x5b0d, 0x6cb2, 0x5367, 0x36ac, 0x39dc, 0x537d, 0x36a5, 0xed3b, 0x589a, 0xed3d, 0x822d, 0x544b, 0x57aa, 0xed41, 0xed42, 0xed43, 0x3a52, 0xed45, 0x7374, 0xed47, 0x4d09, 0x9bed, 0xed4a, 0xed4b, 0x4c5b, 0xed4d, 0xed4e, 0xed4f, 0x845c, 0xed51, 0xed52, 0xed53, 0xed54, 0x632e, 0x7d25, 0xed57, 0xed58, 0x3a2a, 0x9008, 0x52cc, 0x3e74, 0x367a, 0x45e9, 0xed5f, 0x7640, 0x5af0, 0xed62, 0x787a, 0x47b6, 0x58a7, 0x40bf, 0x567c, 0x9b8b, 0x5d74, 0x7654, 0xed6b, 0x9e85, 0x4ce1, 0x75f9, 0x37fb, 0x6119, 0xed71, 0xed72, 0xed73, 0x565d, 0xed75, 0x57a7, 0xed77, 0xed78, 0x5234, 0xed7a, 0x35ad, 0x6c4a, 0x9d7c, /* 0x9f */ 0x7c56, 0x9b39, 0x57de, 0xed81, 0x5c53, 0x64d3, 0xed84, 0xed85, 0xed86, 0x86ad, 0xed88, 0xed89, 0xed8a, 0xed8b, 0xed8c, 0x51fe, 0xed8e, 0x5d8e, 0x9703, 0xed91, 0x9e81, 0x904c, 0x7b1f, 0x9b02, 0x5cd1, 0x7ba3, 0x6268, 0x6335, 0x9aff, 0x7bcf, 0x9b2a, 0x7c7e, 0x9b2e, 0x7c42, 0x7c86, 0x9c15, 0x7bfc, 0x9b09, 0x9f17, 0x9c1b, 0xeda6, 0x9f5a, 0x5573, 0x5bc3, 0x4ffd, 0x9e98, 0x4ff2, 0x5260, 0x3e06, 0x52d1, 0x5767, 0x5056, 0x59b7, 0x5e12, 0x97c8, 0x9dab, 0x8f5c, 0x5469, 0x97b4, 0x9940, 0x97ba, 0x532c, 0x6130, 0x692c, 0x53da, 0x9c0a, 0x9d02, 0x4c3b, 0x9641, 0x6980, 0x50a6, 0x7546, 0xedc6, 0x99da, 0x5273, 0xedc9, 0x9159, 0x9681, 0x915c, 0xedcd, 0x9151, 0xedcf, 0x637f, 0xedd1, 0x6aca, 0x5611, 0x918e, 0x757a, 0x6285, 0xedd7, 0x734f, 0x7c70, 0xedda, 0xeddb, 0xeddc, 0xeddd, 0x76d6, 0x9b9d, 0x4e2a, 0xede1, 0x83be, 0x8842, 0xede4, 0x5c4a, 0x69c0, 0x50ed, 0x577a, 0x521f, 0x5df5, 0x4ece, 0x6c31, 0xeded, 0x4f39, 0x549c, 0x54da, 0x529a, 0x8d82, 0x35fe, 0x5f0c, 0x35f3, 0xedf6, 0x6b52, 0x917c, 0x9fa5, 0x9b97, 0x982e, 0x98b4, 0x9aba, 0x9ea8, 0x9e84, 0x717a, 0x7b14, 0xee02, 0x6bfa, 0x8818, 0x7f78, 0xee06, 0x5620, 0xee08, 0x8e77, 0x9f53, 0xee0b, 0x8dd4, 0x8e4f, 0x9e1c, 0x8e01, 0x6282, 0xee11, 0x8e28, 0x8e75, 0x7ad3, 0xee15, 0x7a3e, 0x78d8, 0x6cea, 0x8a67, 0x7607, /* 0xa0 */ 0xee1b, 0x9f26, 0x6cce, 0x87d6, 0x75c3, 0xee20, 0x7853, 0xee22, 0x8d0c, 0x72e2, 0x7371, 0x8b2d, 0x7302, 0x74f1, 0x8ceb, 0xee2a, 0x862f, 0x5fba, 0x88a0, 0x44b7, 0xee2f, 0xee30, 0xee31, 0xee32, 0x8a7e, 0xee34, 0xee35, 0x60fd, 0x7667, 0x9ad7, 0x9d44, 0x936e, 0x9b8f, 0x87f5, 0xee3d, 0x880f, 0x8cf7, 0x732c, 0x9721, 0x9bb0, 0x35d6, 0x72b2, 0x4c07, 0x7c51, 0x994a, 0xee48, 0x6159, 0x4c04, 0x9e96, 0x617d, 0xee4d, 0x575f, 0x616f, 0x62a6, 0x6239, 0x62ce, 0x3a5c, 0x61e2, 0x53aa, 0xee56, 0x6364, 0x6802, 0x35d2, 0x5d57, 0xee5b, 0x8fda, 0xee5d, 0xee5e, 0x50d9, 0xee60, 0x7906, 0x5332, 0x9638, 0xee64, 0x4065, 0xee66, 0x77fe, 0xee68, 0x7cc2, 0xee6a, 0x7cda, 0x7a2d, 0x8066, 0x8063, 0x7d4d, 0x7505, 0x74f2, 0x8994, 0x821a, 0x670c, 0x8062, 0xee76, 0x805b, 0x74f0, 0x8103, 0x7724, 0x8989, 0xee7c, 0x7553, 0xee7e, 0x87a9, 0x87ce, 0x81c8, 0x878c, 0x8a49, 0x8cad, 0x8b43, 0x772b, 0x74f8, 0x84da, 0x3635, 0x69b2, 0x8da6, 0xee8c, 0x89a9, 0x7468, 0x6db9, 0x87c1, 0xee91, 0x74e7, 0x3ddb, 0x7176, 0x60a4, 0x619c, 0x3cd1, 0x7162, 0x6077, 0xee9a, 0x7f71, 0xee9c, 0x7250, 0x60e9, 0x4b7e, 0x5220, 0x3c18, 0xeea2, 0xeea3, 0xeea4, 0xeea5, 0xeea6, 0xeea7, 0xeea8, 0xeea9, 0xeeaa, 0x5cc1, 0xeeac, 0xeead, 0xeeae, 0xeeaf, 0xeeb0, 0xeeb1, 0x4562, 0x5b1f, 0xeeb4, 0x9f50, 0x9ea6, 0xeeb7, /* 0xa1 */ 0x3000, 0xff0c, 0x3001, 0x3002, 0xff0e, 0x2027, 0xff1b, 0xff1a, 0xff1f, 0xff01, 0xfe30, 0x2026, 0x2025, 0xfe50, 0xfe51, 0xfe52, 0x00b7, 0xfe54, 0xfe55, 0xfe56, 0xfe57, 0xff5c, 0x2013, 0xfe31, 0x2014, 0xfe33, 0x2574, 0xfe34, 0xfe4f, 0xff08, 0xff09, 0xfe35, 0xfe36, 0xff5b, 0xff5d, 0xfe37, 0xfe38, 0x3014, 0x3015, 0xfe39, 0xfe3a, 0x3010, 0x3011, 0xfe3b, 0xfe3c, 0x300a, 0x300b, 0xfe3d, 0xfe3e, 0x3008, 0x3009, 0xfe3f, 0xfe40, 0x300c, 0x300d, 0xfe41, 0xfe42, 0x300e, 0x300f, 0xfe43, 0xfe44, 0xfe59, 0xfe5a, 0xfe5b, 0xfe5c, 0xfe5d, 0xfe5e, 0x2018, 0x2019, 0x201c, 0x201d, 0x301d, 0x301e, 0x2035, 0x2032, 0xff03, 0xff06, 0xff0a, 0x203b, 0x00a7, 0x3003, 0x25cb, 0x25cf, 0x25b3, 0x25b2, 0x25ce, 0x2606, 0x2605, 0x25c7, 0x25c6, 0x25a1, 0x25a0, 0x25bd, 0x25bc, 0x32a3, 0x2105, 0x00af, 0xffe3, 0xff3f, 0x02cd, 0xfe49, 0xfe4a, 0xfe4d, 0xfe4e, 0xfe4b, 0xfe4c, 0xfe5f, 0xfe60, 0xfe61, 0xff0b, 0xff0d, 0x00d7, 0x00f7, 0x00b1, 0x221a, 0xff1c, 0xff1e, 0xff1d, 0x2266, 0x2267, 0x2260, 0x221e, 0x2252, 0x2261, 0xfe62, 0xfe63, 0xfe64, 0xfe65, 0xfe66, 0xff5e, 0x2229, 0x222a, 0x22a5, 0x2220, 0x221f, 0x22bf, 0x33d2, 0x33d1, 0x222b, 0x222e, 0x2235, 0x2234, 0x2640, 0x2642, 0x2295, 0x2299, 0x2191, 0x2193, 0x2190, 0x2192, 0x2196, 0x2197, 0x2199, 0x2198, 0x2225, 0x2223, 0xff0f, /* 0xa2 */ 0xff3c, 0x2215, 0xfe68, 0xff04, 0xffe5, 0x3012, 0xffe0, 0xffe1, 0xff05, 0xff20, 0x2103, 0x2109, 0xfe69, 0xfe6a, 0xfe6b, 0x33d5, 0x339c, 0x339d, 0x339e, 0x33ce, 0x33a1, 0x338e, 0x338f, 0x33c4, 0x00b0, 0x5159, 0x515b, 0x515e, 0x515d, 0x5161, 0x5163, 0x55e7, 0x74e9, 0x7cce, 0x2581, 0x2582, 0x2583, 0x2584, 0x2585, 0x2586, 0x2587, 0x2588, 0x258f, 0x258e, 0x258d, 0x258c, 0x258b, 0x258a, 0x2589, 0x253c, 0x2534, 0x252c, 0x2524, 0x251c, 0x2594, 0x2500, 0x2502, 0x2595, 0x250c, 0x2510, 0x2514, 0x2518, 0x256d, 0x256e, 0x2570, 0x256f, 0x2550, 0x255e, 0x256a, 0x2561, 0x25e2, 0x25e3, 0x25e5, 0x25e4, 0x2571, 0x2572, 0x2573, 0xff10, 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, 0xff19, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027, 0x3028, 0x3029, 0x5341, 0x5344, 0x5345, 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, /* 0xa3 */ 0xff57, 0xff58, 0xff59, 0xff5a, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x3105, 0x3106, 0x3107, 0x3108, 0x3109, 0x310a, 0x310b, 0x310c, 0x310d, 0x310e, 0x310f, 0x3110, 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, 0x3117, 0x3118, 0x3119, 0x311a, 0x311b, 0x311c, 0x311d, 0x311e, 0x311f, 0x3120, 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, 0x3129, 0x02d9, 0x02c9, 0x02ca, 0x02c7, 0x02cb, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xa4 */ 0x4e00, 0x4e59, 0x4e01, 0x4e03, 0x4e43, 0x4e5d, 0x4e86, 0x4e8c, 0x4eba, 0x513f, 0x5165, 0x516b, 0x51e0, 0x5200, 0x5201, 0x529b, 0x5315, 0x5341, 0x535c, 0x53c8, 0x4e09, 0x4e0b, 0x4e08, 0x4e0a, 0x4e2b, 0x4e38, 0x51e1, 0x4e45, 0x4e48, 0x4e5f, 0x4e5e, 0x4e8e, 0x4ea1, 0x5140, 0x5203, 0x52fa, 0x5343, 0x53c9, 0x53e3, 0x571f, 0x58eb, 0x5915, 0x5927, 0x5973, 0x5b50, 0x5b51, 0x5b53, 0x5bf8, 0x5c0f, 0x5c22, 0x5c38, 0x5c71, 0x5ddd, 0x5de5, 0x5df1, 0x5df2, 0x5df3, 0x5dfe, 0x5e72, 0x5efe, 0x5f0b, 0x5f13, 0x624d, 0x4e11, 0x4e10, 0x4e0d, 0x4e2d, 0x4e30, 0x4e39, 0x4e4b, 0x5c39, 0x4e88, 0x4e91, 0x4e95, 0x4e92, 0x4e94, 0x4ea2, 0x4ec1, 0x4ec0, 0x4ec3, 0x4ec6, 0x4ec7, 0x4ecd, 0x4eca, 0x4ecb, 0x4ec4, 0x5143, 0x5141, 0x5167, 0x516d, 0x516e, 0x516c, 0x5197, 0x51f6, 0x5206, 0x5207, 0x5208, 0x52fb, 0x52fe, 0x52ff, 0x5316, 0x5339, 0x5348, 0x5347, 0x5345, 0x535e, 0x5384, 0x53cb, 0x53ca, 0x53cd, 0x58ec, 0x5929, 0x592b, 0x592a, 0x592d, 0x5b54, 0x5c11, 0x5c24, 0x5c3a, 0x5c6f, 0x5df4, 0x5e7b, 0x5eff, 0x5f14, 0x5f15, 0x5fc3, 0x6208, 0x6236, 0x624b, 0x624e, 0x652f, 0x6587, 0x6597, 0x65a4, 0x65b9, 0x65e5, 0x66f0, 0x6708, 0x6728, 0x6b20, 0x6b62, 0x6b79, 0x6bcb, 0x6bd4, 0x6bdb, 0x6c0f, 0x6c34, 0x706b, 0x722a, 0x7236, 0x723b, 0x7247, 0x7259, 0x725b, 0x72ac, 0x738b, 0x4e19, /* 0xa5 */ 0x4e16, 0x4e15, 0x4e14, 0x4e18, 0x4e3b, 0x4e4d, 0x4e4f, 0x4e4e, 0x4ee5, 0x4ed8, 0x4ed4, 0x4ed5, 0x4ed6, 0x4ed7, 0x4ee3, 0x4ee4, 0x4ed9, 0x4ede, 0x5145, 0x5144, 0x5189, 0x518a, 0x51ac, 0x51f9, 0x51fa, 0x51f8, 0x520a, 0x52a0, 0x529f, 0x5305, 0x5306, 0x5317, 0x531d, 0x4edf, 0x534a, 0x5349, 0x5361, 0x5360, 0x536f, 0x536e, 0x53bb, 0x53ef, 0x53e4, 0x53f3, 0x53ec, 0x53ee, 0x53e9, 0x53e8, 0x53fc, 0x53f8, 0x53f5, 0x53eb, 0x53e6, 0x53ea, 0x53f2, 0x53f1, 0x53f0, 0x53e5, 0x53ed, 0x53fb, 0x56db, 0x56da, 0x5916, 0x592e, 0x5931, 0x5974, 0x5976, 0x5b55, 0x5b83, 0x5c3c, 0x5de8, 0x5de7, 0x5de6, 0x5e02, 0x5e03, 0x5e73, 0x5e7c, 0x5f01, 0x5f18, 0x5f17, 0x5fc5, 0x620a, 0x6253, 0x6254, 0x6252, 0x6251, 0x65a5, 0x65e6, 0x672e, 0x672c, 0x672a, 0x672b, 0x672d, 0x6b63, 0x6bcd, 0x6c11, 0x6c10, 0x6c38, 0x6c41, 0x6c40, 0x6c3e, 0x72af, 0x7384, 0x7389, 0x74dc, 0x74e6, 0x7518, 0x751f, 0x7528, 0x7529, 0x7530, 0x7531, 0x7532, 0x7533, 0x758b, 0x767d, 0x76ae, 0x76bf, 0x76ee, 0x77db, 0x77e2, 0x77f3, 0x793a, 0x79be, 0x7a74, 0x7acb, 0x4e1e, 0x4e1f, 0x4e52, 0x4e53, 0x4e69, 0x4e99, 0x4ea4, 0x4ea6, 0x4ea5, 0x4eff, 0x4f09, 0x4f19, 0x4f0a, 0x4f15, 0x4f0d, 0x4f10, 0x4f11, 0x4f0f, 0x4ef2, 0x4ef6, 0x4efb, 0x4ef0, 0x4ef3, 0x4efd, 0x4f01, 0x4f0b, 0x5149, 0x5147, 0x5146, 0x5148, 0x5168, /* 0xa6 */ 0x5171, 0x518d, 0x51b0, 0x5217, 0x5211, 0x5212, 0x520e, 0x5216, 0x52a3, 0x5308, 0x5321, 0x5320, 0x5370, 0x5371, 0x5409, 0x540f, 0x540c, 0x540a, 0x5410, 0x5401, 0x540b, 0x5404, 0x5411, 0x540d, 0x5408, 0x5403, 0x540e, 0x5406, 0x5412, 0x56e0, 0x56de, 0x56dd, 0x5733, 0x5730, 0x5728, 0x572d, 0x572c, 0x572f, 0x5729, 0x5919, 0x591a, 0x5937, 0x5938, 0x5984, 0x5978, 0x5983, 0x597d, 0x5979, 0x5982, 0x5981, 0x5b57, 0x5b58, 0x5b87, 0x5b88, 0x5b85, 0x5b89, 0x5bfa, 0x5c16, 0x5c79, 0x5dde, 0x5e06, 0x5e76, 0x5e74, 0x5f0f, 0x5f1b, 0x5fd9, 0x5fd6, 0x620e, 0x620c, 0x620d, 0x6210, 0x6263, 0x625b, 0x6258, 0x6536, 0x65e9, 0x65e8, 0x65ec, 0x65ed, 0x66f2, 0x66f3, 0x6709, 0x673d, 0x6734, 0x6731, 0x6735, 0x6b21, 0x6b64, 0x6b7b, 0x6c16, 0x6c5d, 0x6c57, 0x6c59, 0x6c5f, 0x6c60, 0x6c50, 0x6c55, 0x6c61, 0x6c5b, 0x6c4d, 0x6c4e, 0x7070, 0x725f, 0x725d, 0x767e, 0x7af9, 0x7c73, 0x7cf8, 0x7f36, 0x7f8a, 0x7fbd, 0x8001, 0x8003, 0x800c, 0x8012, 0x8033, 0x807f, 0x8089, 0x808b, 0x808c, 0x81e3, 0x81ea, 0x81f3, 0x81fc, 0x820c, 0x821b, 0x821f, 0x826e, 0x8272, 0x827e, 0x866b, 0x8840, 0x884c, 0x8863, 0x897f, 0x9621, 0x4e32, 0x4ea8, 0x4f4d, 0x4f4f, 0x4f47, 0x4f57, 0x4f5e, 0x4f34, 0x4f5b, 0x4f55, 0x4f30, 0x4f50, 0x4f51, 0x4f3d, 0x4f3a, 0x4f38, 0x4f43, 0x4f54, 0x4f3c, 0x4f46, 0x4f63, /* 0xa7 */ 0x4f5c, 0x4f60, 0x4f2f, 0x4f4e, 0x4f36, 0x4f59, 0x4f5d, 0x4f48, 0x4f5a, 0x514c, 0x514b, 0x514d, 0x5175, 0x51b6, 0x51b7, 0x5225, 0x5224, 0x5229, 0x522a, 0x5228, 0x52ab, 0x52a9, 0x52aa, 0x52ac, 0x5323, 0x5373, 0x5375, 0x541d, 0x542d, 0x541e, 0x543e, 0x5426, 0x544e, 0x5427, 0x5446, 0x5443, 0x5433, 0x5448, 0x5442, 0x541b, 0x5429, 0x544a, 0x5439, 0x543b, 0x5438, 0x542e, 0x5435, 0x5436, 0x5420, 0x543c, 0x5440, 0x5431, 0x542b, 0x541f, 0x542c, 0x56ea, 0x56f0, 0x56e4, 0x56eb, 0x574a, 0x5751, 0x5740, 0x574d, 0x5747, 0x574e, 0x573e, 0x5750, 0x574f, 0x573b, 0x58ef, 0x593e, 0x599d, 0x5992, 0x59a8, 0x599e, 0x59a3, 0x5999, 0x5996, 0x598d, 0x59a4, 0x5993, 0x598a, 0x59a5, 0x5b5d, 0x5b5c, 0x5b5a, 0x5b5b, 0x5b8c, 0x5b8b, 0x5b8f, 0x5c2c, 0x5c40, 0x5c41, 0x5c3f, 0x5c3e, 0x5c90, 0x5c91, 0x5c94, 0x5c8c, 0x5deb, 0x5e0c, 0x5e8f, 0x5e87, 0x5e8a, 0x5ef7, 0x5f04, 0x5f1f, 0x5f64, 0x5f62, 0x5f77, 0x5f79, 0x5fd8, 0x5fcc, 0x5fd7, 0x5fcd, 0x5ff1, 0x5feb, 0x5ff8, 0x5fea, 0x6212, 0x6211, 0x6284, 0x6297, 0x6296, 0x6280, 0x6276, 0x6289, 0x626d, 0x628a, 0x627c, 0x627e, 0x6279, 0x6273, 0x6292, 0x626f, 0x6298, 0x626e, 0x6295, 0x6293, 0x6291, 0x6286, 0x6539, 0x653b, 0x6538, 0x65f1, 0x66f4, 0x675f, 0x674e, 0x674f, 0x6750, 0x6751, 0x675c, 0x6756, 0x675e, 0x6749, 0x6746, 0x6760, /* 0xa8 */ 0x6753, 0x6757, 0x6b65, 0x6bcf, 0x6c42, 0x6c5e, 0x6c99, 0x6c81, 0x6c88, 0x6c89, 0x6c85, 0x6c9b, 0x6c6a, 0x6c7a, 0x6c90, 0x6c70, 0x6c8c, 0x6c68, 0x6c96, 0x6c92, 0x6c7d, 0x6c83, 0x6c72, 0x6c7e, 0x6c74, 0x6c86, 0x6c76, 0x6c8d, 0x6c94, 0x6c98, 0x6c82, 0x7076, 0x707c, 0x707d, 0x7078, 0x7262, 0x7261, 0x7260, 0x72c4, 0x72c2, 0x7396, 0x752c, 0x752b, 0x7537, 0x7538, 0x7682, 0x76ef, 0x77e3, 0x79c1, 0x79c0, 0x79bf, 0x7a76, 0x7cfb, 0x7f55, 0x8096, 0x8093, 0x809d, 0x8098, 0x809b, 0x809a, 0x80b2, 0x826f, 0x8292, 0x828b, 0x828d, 0x898b, 0x89d2, 0x8a00, 0x8c37, 0x8c46, 0x8c55, 0x8c9d, 0x8d64, 0x8d70, 0x8db3, 0x8eab, 0x8eca, 0x8f9b, 0x8fb0, 0x8fc2, 0x8fc6, 0x8fc5, 0x8fc4, 0x5de1, 0x9091, 0x90a2, 0x90aa, 0x90a6, 0x90a3, 0x9149, 0x91c6, 0x91cc, 0x9632, 0x962e, 0x9631, 0x962a, 0x962c, 0x4e26, 0x4e56, 0x4e73, 0x4e8b, 0x4e9b, 0x4e9e, 0x4eab, 0x4eac, 0x4f6f, 0x4f9d, 0x4f8d, 0x4f73, 0x4f7f, 0x4f6c, 0x4f9b, 0x4f8b, 0x4f86, 0x4f83, 0x4f70, 0x4f75, 0x4f88, 0x4f69, 0x4f7b, 0x4f96, 0x4f7e, 0x4f8f, 0x4f91, 0x4f7a, 0x5154, 0x5152, 0x5155, 0x5169, 0x5177, 0x5176, 0x5178, 0x51bd, 0x51fd, 0x523b, 0x5238, 0x5237, 0x523a, 0x5230, 0x522e, 0x5236, 0x5241, 0x52be, 0x52bb, 0x5352, 0x5354, 0x5353, 0x5351, 0x5366, 0x5377, 0x5378, 0x5379, 0x53d6, 0x53d4, 0x53d7, 0x5473, 0x5475, /* 0xa9 */ 0x5496, 0x5478, 0x5495, 0x5480, 0x547b, 0x5477, 0x5484, 0x5492, 0x5486, 0x547c, 0x5490, 0x5471, 0x5476, 0x548c, 0x549a, 0x5462, 0x5468, 0x548b, 0x547d, 0x548e, 0x56fa, 0x5783, 0x5777, 0x576a, 0x5769, 0x5761, 0x5766, 0x5764, 0x577c, 0x591c, 0x5949, 0x5947, 0x5948, 0x5944, 0x5954, 0x59be, 0x59bb, 0x59d4, 0x59b9, 0x59ae, 0x59d1, 0x59c6, 0x59d0, 0x59cd, 0x59cb, 0x59d3, 0x59ca, 0x59af, 0x59b3, 0x59d2, 0x59c5, 0x5b5f, 0x5b64, 0x5b63, 0x5b97, 0x5b9a, 0x5b98, 0x5b9c, 0x5b99, 0x5b9b, 0x5c1a, 0x5c48, 0x5c45, 0x5c46, 0x5cb7, 0x5ca1, 0x5cb8, 0x5ca9, 0x5cab, 0x5cb1, 0x5cb3, 0x5e18, 0x5e1a, 0x5e16, 0x5e15, 0x5e1b, 0x5e11, 0x5e78, 0x5e9a, 0x5e97, 0x5e9c, 0x5e95, 0x5e96, 0x5ef6, 0x5f26, 0x5f27, 0x5f29, 0x5f80, 0x5f81, 0x5f7f, 0x5f7c, 0x5fdd, 0x5fe0, 0x5ffd, 0x5ff5, 0x5fff, 0x600f, 0x6014, 0x602f, 0x6035, 0x6016, 0x602a, 0x6015, 0x6021, 0x6027, 0x6029, 0x602b, 0x601b, 0x6216, 0x6215, 0x623f, 0x623e, 0x6240, 0x627f, 0x62c9, 0x62cc, 0x62c4, 0x62bf, 0x62c2, 0x62b9, 0x62d2, 0x62db, 0x62ab, 0x62d3, 0x62d4, 0x62cb, 0x62c8, 0x62a8, 0x62bd, 0x62bc, 0x62d0, 0x62d9, 0x62c7, 0x62cd, 0x62b5, 0x62da, 0x62b1, 0x62d8, 0x62d6, 0x62d7, 0x62c6, 0x62ac, 0x62ce, 0x653e, 0x65a7, 0x65bc, 0x65fa, 0x6614, 0x6613, 0x660c, 0x6606, 0x6602, 0x660e, 0x6600, 0x660f, 0x6615, 0x660a, /* 0xaa */ 0x6607, 0x670d, 0x670b, 0x676d, 0x678b, 0x6795, 0x6771, 0x679c, 0x6773, 0x6777, 0x6787, 0x679d, 0x6797, 0x676f, 0x6770, 0x677f, 0x6789, 0x677e, 0x6790, 0x6775, 0x679a, 0x6793, 0x677c, 0x676a, 0x6772, 0x6b23, 0x6b66, 0x6b67, 0x6b7f, 0x6c13, 0x6c1b, 0x6ce3, 0x6ce8, 0x6cf3, 0x6cb1, 0x6ccc, 0x6ce5, 0x6cb3, 0x6cbd, 0x6cbe, 0x6cbc, 0x6ce2, 0x6cab, 0x6cd5, 0x6cd3, 0x6cb8, 0x6cc4, 0x6cb9, 0x6cc1, 0x6cae, 0x6cd7, 0x6cc5, 0x6cf1, 0x6cbf, 0x6cbb, 0x6ce1, 0x6cdb, 0x6cca, 0x6cac, 0x6cef, 0x6cdc, 0x6cd6, 0x6ce0, 0x7095, 0x708e, 0x7092, 0x708a, 0x7099, 0x722c, 0x722d, 0x7238, 0x7248, 0x7267, 0x7269, 0x72c0, 0x72ce, 0x72d9, 0x72d7, 0x72d0, 0x73a9, 0x73a8, 0x739f, 0x73ab, 0x73a5, 0x753d, 0x759d, 0x7599, 0x759a, 0x7684, 0x76c2, 0x76f2, 0x76f4, 0x77e5, 0x77fd, 0x793e, 0x7940, 0x7941, 0x79c9, 0x79c8, 0x7a7a, 0x7a79, 0x7afa, 0x7cfe, 0x7f54, 0x7f8c, 0x7f8b, 0x8005, 0x80ba, 0x80a5, 0x80a2, 0x80b1, 0x80a1, 0x80ab, 0x80a9, 0x80b4, 0x80aa, 0x80af, 0x81e5, 0x81fe, 0x820d, 0x82b3, 0x829d, 0x8299, 0x82ad, 0x82bd, 0x829f, 0x82b9, 0x82b1, 0x82ac, 0x82a5, 0x82af, 0x82b8, 0x82a3, 0x82b0, 0x82be, 0x82b7, 0x864e, 0x8671, 0x521d, 0x8868, 0x8ecb, 0x8fce, 0x8fd4, 0x8fd1, 0x90b5, 0x90b8, 0x90b1, 0x90b6, 0x91c7, 0x91d1, 0x9577, 0x9580, 0x961c, 0x9640, 0x963f, 0x963b, 0x9644, /* 0xab */ 0x9642, 0x96b9, 0x96e8, 0x9752, 0x975e, 0x4e9f, 0x4ead, 0x4eae, 0x4fe1, 0x4fb5, 0x4faf, 0x4fbf, 0x4fe0, 0x4fd1, 0x4fcf, 0x4fdd, 0x4fc3, 0x4fb6, 0x4fd8, 0x4fdf, 0x4fca, 0x4fd7, 0x4fae, 0x4fd0, 0x4fc4, 0x4fc2, 0x4fda, 0x4fce, 0x4fde, 0x4fb7, 0x5157, 0x5192, 0x5191, 0x51a0, 0x524e, 0x5243, 0x524a, 0x524d, 0x524c, 0x524b, 0x5247, 0x52c7, 0x52c9, 0x52c3, 0x52c1, 0x530d, 0x5357, 0x537b, 0x539a, 0x53db, 0x54ac, 0x54c0, 0x54a8, 0x54ce, 0x54c9, 0x54b8, 0x54a6, 0x54b3, 0x54c7, 0x54c2, 0x54bd, 0x54aa, 0x54c1, 0x54c4, 0x54c8, 0x54af, 0x54ab, 0x54b1, 0x54bb, 0x54a9, 0x54a7, 0x54bf, 0x56ff, 0x5782, 0x578b, 0x57a0, 0x57a3, 0x57a2, 0x57ce, 0x57ae, 0x5793, 0x5955, 0x5951, 0x594f, 0x594e, 0x5950, 0x59dc, 0x59d8, 0x59ff, 0x59e3, 0x59e8, 0x5a03, 0x59e5, 0x59ea, 0x59da, 0x59e6, 0x5a01, 0x59fb, 0x5b69, 0x5ba3, 0x5ba6, 0x5ba4, 0x5ba2, 0x5ba5, 0x5c01, 0x5c4e, 0x5c4f, 0x5c4d, 0x5c4b, 0x5cd9, 0x5cd2, 0x5df7, 0x5e1d, 0x5e25, 0x5e1f, 0x5e7d, 0x5ea0, 0x5ea6, 0x5efa, 0x5f08, 0x5f2d, 0x5f65, 0x5f88, 0x5f85, 0x5f8a, 0x5f8b, 0x5f87, 0x5f8c, 0x5f89, 0x6012, 0x601d, 0x6020, 0x6025, 0x600e, 0x6028, 0x604d, 0x6070, 0x6068, 0x6062, 0x6046, 0x6043, 0x606c, 0x606b, 0x606a, 0x6064, 0x6241, 0x62dc, 0x6316, 0x6309, 0x62fc, 0x62ed, 0x6301, 0x62ee, 0x62fd, 0x6307, 0x62f1, 0x62f7, /* 0xac */ 0x62ef, 0x62ec, 0x62fe, 0x62f4, 0x6311, 0x6302, 0x653f, 0x6545, 0x65ab, 0x65bd, 0x65e2, 0x6625, 0x662d, 0x6620, 0x6627, 0x662f, 0x661f, 0x6628, 0x6631, 0x6624, 0x66f7, 0x67ff, 0x67d3, 0x67f1, 0x67d4, 0x67d0, 0x67ec, 0x67b6, 0x67af, 0x67f5, 0x67e9, 0x67ef, 0x67c4, 0x67d1, 0x67b4, 0x67da, 0x67e5, 0x67b8, 0x67cf, 0x67de, 0x67f3, 0x67b0, 0x67d9, 0x67e2, 0x67dd, 0x67d2, 0x6b6a, 0x6b83, 0x6b86, 0x6bb5, 0x6bd2, 0x6bd7, 0x6c1f, 0x6cc9, 0x6d0b, 0x6d32, 0x6d2a, 0x6d41, 0x6d25, 0x6d0c, 0x6d31, 0x6d1e, 0x6d17, 0x6d3b, 0x6d3d, 0x6d3e, 0x6d36, 0x6d1b, 0x6cf5, 0x6d39, 0x6d27, 0x6d38, 0x6d29, 0x6d2e, 0x6d35, 0x6d0e, 0x6d2b, 0x70ab, 0x70ba, 0x70b3, 0x70ac, 0x70af, 0x70ad, 0x70b8, 0x70ae, 0x70a4, 0x7230, 0x7272, 0x726f, 0x7274, 0x72e9, 0x72e0, 0x72e1, 0x73b7, 0x73ca, 0x73bb, 0x73b2, 0x73cd, 0x73c0, 0x73b3, 0x751a, 0x752d, 0x754f, 0x754c, 0x754e, 0x754b, 0x75ab, 0x75a4, 0x75a5, 0x75a2, 0x75a3, 0x7678, 0x7686, 0x7687, 0x7688, 0x76c8, 0x76c6, 0x76c3, 0x76c5, 0x7701, 0x76f9, 0x76f8, 0x7709, 0x770b, 0x76fe, 0x76fc, 0x7707, 0x77dc, 0x7802, 0x7814, 0x780c, 0x780d, 0x7946, 0x7949, 0x7948, 0x7947, 0x79b9, 0x79ba, 0x79d1, 0x79d2, 0x79cb, 0x7a7f, 0x7a81, 0x7aff, 0x7afd, 0x7c7d, 0x7d02, 0x7d05, 0x7d00, 0x7d09, 0x7d07, 0x7d04, 0x7d06, 0x7f38, 0x7f8e, 0x7fbf, 0x8004, /* 0xad */ 0x8010, 0x800d, 0x8011, 0x8036, 0x80d6, 0x80e5, 0x80da, 0x80c3, 0x80c4, 0x80cc, 0x80e1, 0x80db, 0x80ce, 0x80de, 0x80e4, 0x80dd, 0x81f4, 0x8222, 0x82e7, 0x8303, 0x8305, 0x82e3, 0x82db, 0x82e6, 0x8304, 0x82e5, 0x8302, 0x8309, 0x82d2, 0x82d7, 0x82f1, 0x8301, 0x82dc, 0x82d4, 0x82d1, 0x82de, 0x82d3, 0x82df, 0x82ef, 0x8306, 0x8650, 0x8679, 0x867b, 0x867a, 0x884d, 0x886b, 0x8981, 0x89d4, 0x8a08, 0x8a02, 0x8a03, 0x8c9e, 0x8ca0, 0x8d74, 0x8d73, 0x8db4, 0x8ecd, 0x8ecc, 0x8ff0, 0x8fe6, 0x8fe2, 0x8fea, 0x8fe5, 0x8fed, 0x8feb, 0x8fe4, 0x8fe8, 0x90ca, 0x90ce, 0x90c1, 0x90c3, 0x914b, 0x914a, 0x91cd, 0x9582, 0x9650, 0x964b, 0x964c, 0x964d, 0x9762, 0x9769, 0x97cb, 0x97ed, 0x97f3, 0x9801, 0x98a8, 0x98db, 0x98df, 0x9996, 0x9999, 0x4e58, 0x4eb3, 0x500c, 0x500d, 0x5023, 0x4fef, 0x5026, 0x5025, 0x4ff8, 0x5029, 0x5016, 0x5006, 0x503c, 0x501f, 0x501a, 0x5012, 0x5011, 0x4ffa, 0x5000, 0x5014, 0x5028, 0x4ff1, 0x5021, 0x500b, 0x5019, 0x5018, 0x4ff3, 0x4fee, 0x502d, 0x502a, 0x4ffe, 0x502b, 0x5009, 0x517c, 0x51a4, 0x51a5, 0x51a2, 0x51cd, 0x51cc, 0x51c6, 0x51cb, 0x5256, 0x525c, 0x5254, 0x525b, 0x525d, 0x532a, 0x537f, 0x539f, 0x539d, 0x53df, 0x54e8, 0x5510, 0x5501, 0x5537, 0x54fc, 0x54e5, 0x54f2, 0x5506, 0x54fa, 0x5514, 0x54e9, 0x54ed, 0x54e1, 0x5509, 0x54ee, 0x54ea, /* 0xae */ 0x54e6, 0x5527, 0x5507, 0x54fd, 0x550f, 0x5703, 0x5704, 0x57c2, 0x57d4, 0x57cb, 0x57c3, 0x5809, 0x590f, 0x5957, 0x5958, 0x595a, 0x5a11, 0x5a18, 0x5a1c, 0x5a1f, 0x5a1b, 0x5a13, 0x59ec, 0x5a20, 0x5a23, 0x5a29, 0x5a25, 0x5a0c, 0x5a09, 0x5b6b, 0x5c58, 0x5bb0, 0x5bb3, 0x5bb6, 0x5bb4, 0x5bae, 0x5bb5, 0x5bb9, 0x5bb8, 0x5c04, 0x5c51, 0x5c55, 0x5c50, 0x5ced, 0x5cfd, 0x5cfb, 0x5cea, 0x5ce8, 0x5cf0, 0x5cf6, 0x5d01, 0x5cf4, 0x5dee, 0x5e2d, 0x5e2b, 0x5eab, 0x5ead, 0x5ea7, 0x5f31, 0x5f92, 0x5f91, 0x5f90, 0x6059, 0x6063, 0x6065, 0x6050, 0x6055, 0x606d, 0x6069, 0x606f, 0x6084, 0x609f, 0x609a, 0x608d, 0x6094, 0x608c, 0x6085, 0x6096, 0x6247, 0x62f3, 0x6308, 0x62ff, 0x634e, 0x633e, 0x632f, 0x6355, 0x6342, 0x6346, 0x634f, 0x6349, 0x633a, 0x6350, 0x633d, 0x632a, 0x632b, 0x6328, 0x634d, 0x634c, 0x6548, 0x6549, 0x6599, 0x65c1, 0x65c5, 0x6642, 0x6649, 0x664f, 0x6643, 0x6652, 0x664c, 0x6645, 0x6641, 0x66f8, 0x6714, 0x6715, 0x6717, 0x6821, 0x6838, 0x6848, 0x6846, 0x6853, 0x6839, 0x6842, 0x6854, 0x6829, 0x68b3, 0x6817, 0x684c, 0x6851, 0x683d, 0x67f4, 0x6850, 0x6840, 0x683c, 0x6843, 0x682a, 0x6845, 0x6813, 0x6818, 0x6841, 0x6b8a, 0x6b89, 0x6bb7, 0x6c23, 0x6c27, 0x6c28, 0x6c26, 0x6c24, 0x6cf0, 0x6d6a, 0x6d95, 0x6d88, 0x6d87, 0x6d66, 0x6d78, 0x6d77, 0x6d59, 0x6d93, /* 0xaf */ 0x6d6c, 0x6d89, 0x6d6e, 0x6d5a, 0x6d74, 0x6d69, 0x6d8c, 0x6d8a, 0x6d79, 0x6d85, 0x6d65, 0x6d94, 0x70ca, 0x70d8, 0x70e4, 0x70d9, 0x70c8, 0x70cf, 0x7239, 0x7279, 0x72fc, 0x72f9, 0x72fd, 0x72f8, 0x72f7, 0x7386, 0x73ed, 0x7409, 0x73ee, 0x73e0, 0x73ea, 0x73de, 0x7554, 0x755d, 0x755c, 0x755a, 0x7559, 0x75be, 0x75c5, 0x75c7, 0x75b2, 0x75b3, 0x75bd, 0x75bc, 0x75b9, 0x75c2, 0x75b8, 0x768b, 0x76b0, 0x76ca, 0x76cd, 0x76ce, 0x7729, 0x771f, 0x7720, 0x7728, 0x77e9, 0x7830, 0x7827, 0x7838, 0x781d, 0x7834, 0x7837, 0x7825, 0x782d, 0x7820, 0x781f, 0x7832, 0x7955, 0x7950, 0x7960, 0x795f, 0x7956, 0x795e, 0x795d, 0x7957, 0x795a, 0x79e4, 0x79e3, 0x79e7, 0x79df, 0x79e6, 0x79e9, 0x79d8, 0x7a84, 0x7a88, 0x7ad9, 0x7b06, 0x7b11, 0x7c89, 0x7d21, 0x7d17, 0x7d0b, 0x7d0a, 0x7d20, 0x7d22, 0x7d14, 0x7d10, 0x7d15, 0x7d1a, 0x7d1c, 0x7d0d, 0x7d19, 0x7d1b, 0x7f3a, 0x7f5f, 0x7f94, 0x7fc5, 0x7fc1, 0x8006, 0x8018, 0x8015, 0x8019, 0x8017, 0x803d, 0x803f, 0x80f1, 0x8102, 0x80f0, 0x8105, 0x80ed, 0x80f4, 0x8106, 0x80f8, 0x80f3, 0x8108, 0x80fd, 0x810a, 0x80fc, 0x80ef, 0x81ed, 0x81ec, 0x8200, 0x8210, 0x822a, 0x822b, 0x8228, 0x822c, 0x82bb, 0x832b, 0x8352, 0x8354, 0x834a, 0x8338, 0x8350, 0x8349, 0x8335, 0x8334, 0x834f, 0x8332, 0x8339, 0x8336, 0x8317, 0x8340, 0x8331, 0x8328, 0x8343, /* 0xb0 */ 0x8654, 0x868a, 0x86aa, 0x8693, 0x86a4, 0x86a9, 0x868c, 0x86a3, 0x869c, 0x8870, 0x8877, 0x8881, 0x8882, 0x887d, 0x8879, 0x8a18, 0x8a10, 0x8a0e, 0x8a0c, 0x8a15, 0x8a0a, 0x8a17, 0x8a13, 0x8a16, 0x8a0f, 0x8a11, 0x8c48, 0x8c7a, 0x8c79, 0x8ca1, 0x8ca2, 0x8d77, 0x8eac, 0x8ed2, 0x8ed4, 0x8ecf, 0x8fb1, 0x9001, 0x9006, 0x8ff7, 0x9000, 0x8ffa, 0x8ff4, 0x9003, 0x8ffd, 0x9005, 0x8ff8, 0x9095, 0x90e1, 0x90dd, 0x90e2, 0x9152, 0x914d, 0x914c, 0x91d8, 0x91dd, 0x91d7, 0x91dc, 0x91d9, 0x9583, 0x9662, 0x9663, 0x9661, 0x965b, 0x965d, 0x9664, 0x9658, 0x965e, 0x96bb, 0x98e2, 0x99ac, 0x9aa8, 0x9ad8, 0x9b25, 0x9b32, 0x9b3c, 0x4e7e, 0x507a, 0x507d, 0x505c, 0x5047, 0x5043, 0x504c, 0x505a, 0x5049, 0x5065, 0x5076, 0x504e, 0x5055, 0x5075, 0x5074, 0x5077, 0x504f, 0x500f, 0x506f, 0x506d, 0x515c, 0x5195, 0x51f0, 0x526a, 0x526f, 0x52d2, 0x52d9, 0x52d8, 0x52d5, 0x5310, 0x530f, 0x5319, 0x533f, 0x5340, 0x533e, 0x53c3, 0x66fc, 0x5546, 0x556a, 0x5566, 0x5544, 0x555e, 0x5561, 0x5543, 0x554a, 0x5531, 0x5556, 0x554f, 0x5555, 0x552f, 0x5564, 0x5538, 0x552e, 0x555c, 0x552c, 0x5563, 0x5533, 0x5541, 0x5557, 0x5708, 0x570b, 0x5709, 0x57df, 0x5805, 0x580a, 0x5806, 0x57e0, 0x57e4, 0x57fa, 0x5802, 0x5835, 0x57f7, 0x57f9, 0x5920, 0x5962, 0x5a36, 0x5a41, 0x5a49, 0x5a66, 0x5a6a, 0x5a40, /* 0xb1 */ 0x5a3c, 0x5a62, 0x5a5a, 0x5a46, 0x5a4a, 0x5b70, 0x5bc7, 0x5bc5, 0x5bc4, 0x5bc2, 0x5bbf, 0x5bc6, 0x5c09, 0x5c08, 0x5c07, 0x5c60, 0x5c5c, 0x5c5d, 0x5d07, 0x5d06, 0x5d0e, 0x5d1b, 0x5d16, 0x5d22, 0x5d11, 0x5d29, 0x5d14, 0x5d19, 0x5d24, 0x5d27, 0x5d17, 0x5de2, 0x5e38, 0x5e36, 0x5e33, 0x5e37, 0x5eb7, 0x5eb8, 0x5eb6, 0x5eb5, 0x5ebe, 0x5f35, 0x5f37, 0x5f57, 0x5f6c, 0x5f69, 0x5f6b, 0x5f97, 0x5f99, 0x5f9e, 0x5f98, 0x5fa1, 0x5fa0, 0x5f9c, 0x607f, 0x60a3, 0x6089, 0x60a0, 0x60a8, 0x60cb, 0x60b4, 0x60e6, 0x60bd, 0x60c5, 0x60bb, 0x60b5, 0x60dc, 0x60bc, 0x60d8, 0x60d5, 0x60c6, 0x60df, 0x60b8, 0x60da, 0x60c7, 0x621a, 0x621b, 0x6248, 0x63a0, 0x63a7, 0x6372, 0x6396, 0x63a2, 0x63a5, 0x6377, 0x6367, 0x6398, 0x63aa, 0x6371, 0x63a9, 0x6389, 0x6383, 0x639b, 0x636b, 0x63a8, 0x6384, 0x6388, 0x6399, 0x63a1, 0x63ac, 0x6392, 0x638f, 0x6380, 0x637b, 0x6369, 0x6368, 0x637a, 0x655d, 0x6556, 0x6551, 0x6559, 0x6557, 0x555f, 0x654f, 0x6558, 0x6555, 0x6554, 0x659c, 0x659b, 0x65ac, 0x65cf, 0x65cb, 0x65cc, 0x65ce, 0x665d, 0x665a, 0x6664, 0x6668, 0x6666, 0x665e, 0x66f9, 0x52d7, 0x671b, 0x6881, 0x68af, 0x68a2, 0x6893, 0x68b5, 0x687f, 0x6876, 0x68b1, 0x68a7, 0x6897, 0x68b0, 0x6883, 0x68c4, 0x68ad, 0x6886, 0x6885, 0x6894, 0x689d, 0x68a8, 0x689f, 0x68a1, 0x6882, 0x6b32, 0x6bba, /* 0xb2 */ 0x6beb, 0x6bec, 0x6c2b, 0x6d8e, 0x6dbc, 0x6df3, 0x6dd9, 0x6db2, 0x6de1, 0x6dcc, 0x6de4, 0x6dfb, 0x6dfa, 0x6e05, 0x6dc7, 0x6dcb, 0x6daf, 0x6dd1, 0x6dae, 0x6dde, 0x6df9, 0x6db8, 0x6df7, 0x6df5, 0x6dc5, 0x6dd2, 0x6e1a, 0x6db5, 0x6dda, 0x6deb, 0x6dd8, 0x6dea, 0x6df1, 0x6dee, 0x6de8, 0x6dc6, 0x6dc4, 0x6daa, 0x6dec, 0x6dbf, 0x6de6, 0x70f9, 0x7109, 0x710a, 0x70fd, 0x70ef, 0x723d, 0x727d, 0x7281, 0x731c, 0x731b, 0x7316, 0x7313, 0x7319, 0x7387, 0x7405, 0x740a, 0x7403, 0x7406, 0x73fe, 0x740d, 0x74e0, 0x74f6, 0x74f7, 0x751c, 0x7522, 0x7565, 0x7566, 0x7562, 0x7570, 0x758f, 0x75d4, 0x75d5, 0x75b5, 0x75ca, 0x75cd, 0x768e, 0x76d4, 0x76d2, 0x76db, 0x7737, 0x773e, 0x773c, 0x7736, 0x7738, 0x773a, 0x786b, 0x7843, 0x784e, 0x7965, 0x7968, 0x796d, 0x79fb, 0x7a92, 0x7a95, 0x7b20, 0x7b28, 0x7b1b, 0x7b2c, 0x7b26, 0x7b19, 0x7b1e, 0x7b2e, 0x7c92, 0x7c97, 0x7c95, 0x7d46, 0x7d43, 0x7d71, 0x7d2e, 0x7d39, 0x7d3c, 0x7d40, 0x7d30, 0x7d33, 0x7d44, 0x7d2f, 0x7d42, 0x7d32, 0x7d31, 0x7f3d, 0x7f9e, 0x7f9a, 0x7fcc, 0x7fce, 0x7fd2, 0x801c, 0x804a, 0x8046, 0x812f, 0x8116, 0x8123, 0x812b, 0x8129, 0x8130, 0x8124, 0x8202, 0x8235, 0x8237, 0x8236, 0x8239, 0x838e, 0x839e, 0x8398, 0x8378, 0x83a2, 0x8396, 0x83bd, 0x83ab, 0x8392, 0x838a, 0x8393, 0x8389, 0x83a0, 0x8377, 0x837b, 0x837c, /* 0xb3 */ 0x8386, 0x83a7, 0x8655, 0x5f6a, 0x86c7, 0x86c0, 0x86b6, 0x86c4, 0x86b5, 0x86c6, 0x86cb, 0x86b1, 0x86af, 0x86c9, 0x8853, 0x889e, 0x8888, 0x88ab, 0x8892, 0x8896, 0x888d, 0x888b, 0x8993, 0x898f, 0x8a2a, 0x8a1d, 0x8a23, 0x8a25, 0x8a31, 0x8a2d, 0x8a1f, 0x8a1b, 0x8a22, 0x8c49, 0x8c5a, 0x8ca9, 0x8cac, 0x8cab, 0x8ca8, 0x8caa, 0x8ca7, 0x8d67, 0x8d66, 0x8dbe, 0x8dba, 0x8edb, 0x8edf, 0x9019, 0x900d, 0x901a, 0x9017, 0x9023, 0x901f, 0x901d, 0x9010, 0x9015, 0x901e, 0x9020, 0x900f, 0x9022, 0x9016, 0x901b, 0x9014, 0x90e8, 0x90ed, 0x90fd, 0x9157, 0x91ce, 0x91f5, 0x91e6, 0x91e3, 0x91e7, 0x91ed, 0x91e9, 0x9589, 0x966a, 0x9675, 0x9673, 0x9678, 0x9670, 0x9674, 0x9676, 0x9677, 0x966c, 0x96c0, 0x96ea, 0x96e9, 0x7ae0, 0x7adf, 0x9802, 0x9803, 0x9b5a, 0x9ce5, 0x9e75, 0x9e7f, 0x9ea5, 0x9ebb, 0x50a2, 0x508d, 0x5085, 0x5099, 0x5091, 0x5080, 0x5096, 0x5098, 0x509a, 0x6700, 0x51f1, 0x5272, 0x5274, 0x5275, 0x5269, 0x52de, 0x52dd, 0x52db, 0x535a, 0x53a5, 0x557b, 0x5580, 0x55a7, 0x557c, 0x558a, 0x559d, 0x5598, 0x5582, 0x559c, 0x55aa, 0x5594, 0x5587, 0x558b, 0x5583, 0x55b3, 0x55ae, 0x559f, 0x553e, 0x55b2, 0x559a, 0x55bb, 0x55ac, 0x55b1, 0x557e, 0x5589, 0x55ab, 0x5599, 0x570d, 0x582f, 0x582a, 0x5834, 0x5824, 0x5830, 0x5831, 0x5821, 0x581d, 0x5820, 0x58f9, 0x58fa, 0x5960, /* 0xb4 */ 0x5a77, 0x5a9a, 0x5a7f, 0x5a92, 0x5a9b, 0x5aa7, 0x5b73, 0x5b71, 0x5bd2, 0x5bcc, 0x5bd3, 0x5bd0, 0x5c0a, 0x5c0b, 0x5c31, 0x5d4c, 0x5d50, 0x5d34, 0x5d47, 0x5dfd, 0x5e45, 0x5e3d, 0x5e40, 0x5e43, 0x5e7e, 0x5eca, 0x5ec1, 0x5ec2, 0x5ec4, 0x5f3c, 0x5f6d, 0x5fa9, 0x5faa, 0x5fa8, 0x60d1, 0x60e1, 0x60b2, 0x60b6, 0x60e0, 0x611c, 0x6123, 0x60fa, 0x6115, 0x60f0, 0x60fb, 0x60f4, 0x6168, 0x60f1, 0x610e, 0x60f6, 0x6109, 0x6100, 0x6112, 0x621f, 0x6249, 0x63a3, 0x638c, 0x63cf, 0x63c0, 0x63e9, 0x63c9, 0x63c6, 0x63cd, 0x63d2, 0x63e3, 0x63d0, 0x63e1, 0x63d6, 0x63ed, 0x63ee, 0x6376, 0x63f4, 0x63ea, 0x63db, 0x6452, 0x63da, 0x63f9, 0x655e, 0x6566, 0x6562, 0x6563, 0x6591, 0x6590, 0x65af, 0x666e, 0x6670, 0x6674, 0x6676, 0x666f, 0x6691, 0x667a, 0x667e, 0x6677, 0x66fe, 0x66ff, 0x671f, 0x671d, 0x68fa, 0x68d5, 0x68e0, 0x68d8, 0x68d7, 0x6905, 0x68df, 0x68f5, 0x68ee, 0x68e7, 0x68f9, 0x68d2, 0x68f2, 0x68e3, 0x68cb, 0x68cd, 0x690d, 0x6912, 0x690e, 0x68c9, 0x68da, 0x696e, 0x68fb, 0x6b3e, 0x6b3a, 0x6b3d, 0x6b98, 0x6b96, 0x6bbc, 0x6bef, 0x6c2e, 0x6c2f, 0x6c2c, 0x6e2f, 0x6e38, 0x6e54, 0x6e21, 0x6e32, 0x6e67, 0x6e4a, 0x6e20, 0x6e25, 0x6e23, 0x6e1b, 0x6e5b, 0x6e58, 0x6e24, 0x6e56, 0x6e6e, 0x6e2d, 0x6e26, 0x6e6f, 0x6e34, 0x6e4d, 0x6e3a, 0x6e2c, 0x6e43, 0x6e1d, 0x6e3e, 0x6ecb, /* 0xb5 */ 0x6e89, 0x6e19, 0x6e4e, 0x6e63, 0x6e44, 0x6e72, 0x6e69, 0x6e5f, 0x7119, 0x711a, 0x7126, 0x7130, 0x7121, 0x7136, 0x716e, 0x711c, 0x724c, 0x7284, 0x7280, 0x7336, 0x7325, 0x7334, 0x7329, 0x743a, 0x742a, 0x7433, 0x7422, 0x7425, 0x7435, 0x7436, 0x7434, 0x742f, 0x741b, 0x7426, 0x7428, 0x7525, 0x7526, 0x756b, 0x756a, 0x75e2, 0x75db, 0x75e3, 0x75d9, 0x75d8, 0x75de, 0x75e0, 0x767b, 0x767c, 0x7696, 0x7693, 0x76b4, 0x76dc, 0x774f, 0x77ed, 0x785d, 0x786c, 0x786f, 0x7a0d, 0x7a08, 0x7a0b, 0x7a05, 0x7a00, 0x7a98, 0x7a97, 0x7a96, 0x7ae5, 0x7ae3, 0x7b49, 0x7b56, 0x7b46, 0x7b50, 0x7b52, 0x7b54, 0x7b4d, 0x7b4b, 0x7b4f, 0x7b51, 0x7c9f, 0x7ca5, 0x7d5e, 0x7d50, 0x7d68, 0x7d55, 0x7d2b, 0x7d6e, 0x7d72, 0x7d61, 0x7d66, 0x7d62, 0x7d70, 0x7d73, 0x5584, 0x7fd4, 0x7fd5, 0x800b, 0x8052, 0x8085, 0x8155, 0x8154, 0x814b, 0x8151, 0x814e, 0x8139, 0x8146, 0x813e, 0x814c, 0x8153, 0x8174, 0x8212, 0x821c, 0x83e9, 0x8403, 0x83f8, 0x840d, 0x83e0, 0x83c5, 0x840b, 0x83c1, 0x83ef, 0x83f1, 0x83f4, 0x8457, 0x840a, 0x83f0, 0x840c, 0x83cc, 0x83fd, 0x83f2, 0x83ca, 0x8438, 0x840e, 0x8404, 0x83dc, 0x8407, 0x83d4, 0x83df, 0x865b, 0x86df, 0x86d9, 0x86ed, 0x86d4, 0x86db, 0x86e4, 0x86d0, 0x86de, 0x8857, 0x88c1, 0x88c2, 0x88b1, 0x8983, 0x8996, 0x8a3b, 0x8a60, 0x8a55, 0x8a5e, 0x8a3c, 0x8a41, /* 0xb6 */ 0x8a54, 0x8a5b, 0x8a50, 0x8a46, 0x8a34, 0x8a3a, 0x8a36, 0x8a56, 0x8c61, 0x8c82, 0x8caf, 0x8cbc, 0x8cb3, 0x8cbd, 0x8cc1, 0x8cbb, 0x8cc0, 0x8cb4, 0x8cb7, 0x8cb6, 0x8cbf, 0x8cb8, 0x8d8a, 0x8d85, 0x8d81, 0x8dce, 0x8ddd, 0x8dcb, 0x8dda, 0x8dd1, 0x8dcc, 0x8ddb, 0x8dc6, 0x8efb, 0x8ef8, 0x8efc, 0x8f9c, 0x902e, 0x9035, 0x9031, 0x9038, 0x9032, 0x9036, 0x9102, 0x90f5, 0x9109, 0x90fe, 0x9163, 0x9165, 0x91cf, 0x9214, 0x9215, 0x9223, 0x9209, 0x921e, 0x920d, 0x9210, 0x9207, 0x9211, 0x9594, 0x958f, 0x958b, 0x9591, 0x9593, 0x9592, 0x958e, 0x968a, 0x968e, 0x968b, 0x967d, 0x9685, 0x9686, 0x968d, 0x9672, 0x9684, 0x96c1, 0x96c5, 0x96c4, 0x96c6, 0x96c7, 0x96ef, 0x96f2, 0x97cc, 0x9805, 0x9806, 0x9808, 0x98e7, 0x98ea, 0x98ef, 0x98e9, 0x98f2, 0x98ed, 0x99ae, 0x99ad, 0x9ec3, 0x9ecd, 0x9ed1, 0x4e82, 0x50ad, 0x50b5, 0x50b2, 0x50b3, 0x50c5, 0x50be, 0x50ac, 0x50b7, 0x50bb, 0x50af, 0x50c7, 0x527f, 0x5277, 0x527d, 0x52df, 0x52e6, 0x52e4, 0x52e2, 0x52e3, 0x532f, 0x55df, 0x55e8, 0x55d3, 0x55e6, 0x55ce, 0x55dc, 0x55c7, 0x55d1, 0x55e3, 0x55e4, 0x55ef, 0x55da, 0x55e1, 0x55c5, 0x55c6, 0x55e5, 0x55c9, 0x5712, 0x5713, 0x585e, 0x5851, 0x5858, 0x5857, 0x585a, 0x5854, 0x586b, 0x584c, 0x586d, 0x584a, 0x5862, 0x5852, 0x584b, 0x5967, 0x5ac1, 0x5ac9, 0x5acc, 0x5abe, 0x5abd, 0x5abc, /* 0xb7 */ 0x5ab3, 0x5ac2, 0x5ab2, 0x5d69, 0x5d6f, 0x5e4c, 0x5e79, 0x5ec9, 0x5ec8, 0x5f12, 0x5f59, 0x5fac, 0x5fae, 0x611a, 0x610f, 0x6148, 0x611f, 0x60f3, 0x611b, 0x60f9, 0x6101, 0x6108, 0x614e, 0x614c, 0x6144, 0x614d, 0x613e, 0x6134, 0x6127, 0x610d, 0x6106, 0x6137, 0x6221, 0x6222, 0x6413, 0x643e, 0x641e, 0x642a, 0x642d, 0x643d, 0x642c, 0x640f, 0x641c, 0x6414, 0x640d, 0x6436, 0x6416, 0x6417, 0x6406, 0x656c, 0x659f, 0x65b0, 0x6697, 0x6689, 0x6687, 0x6688, 0x6696, 0x6684, 0x6698, 0x668d, 0x6703, 0x6994, 0x696d, 0x695a, 0x6977, 0x6960, 0x6954, 0x6975, 0x6930, 0x6982, 0x694a, 0x6968, 0x696b, 0x695e, 0x6953, 0x6979, 0x6986, 0x695d, 0x6963, 0x695b, 0x6b47, 0x6b72, 0x6bc0, 0x6bbf, 0x6bd3, 0x6bfd, 0x6ea2, 0x6eaf, 0x6ed3, 0x6eb6, 0x6ec2, 0x6e90, 0x6e9d, 0x6ec7, 0x6ec5, 0x6ea5, 0x6e98, 0x6ebc, 0x6eba, 0x6eab, 0x6ed1, 0x6e96, 0x6e9c, 0x6ec4, 0x6ed4, 0x6eaa, 0x6ea7, 0x6eb4, 0x714e, 0x7159, 0x7169, 0x7164, 0x7149, 0x7167, 0x715c, 0x716c, 0x7166, 0x714c, 0x7165, 0x715e, 0x7146, 0x7168, 0x7156, 0x723a, 0x7252, 0x7337, 0x7345, 0x733f, 0x733e, 0x746f, 0x745a, 0x7455, 0x745f, 0x745e, 0x7441, 0x743f, 0x7459, 0x745b, 0x745c, 0x7576, 0x7578, 0x7600, 0x75f0, 0x7601, 0x75f2, 0x75f1, 0x75fa, 0x75ff, 0x75f4, 0x75f3, 0x76de, 0x76df, 0x775b, 0x776b, 0x7766, 0x775e, 0x7763, /* 0xb8 */ 0x7779, 0x776a, 0x776c, 0x775c, 0x7765, 0x7768, 0x7762, 0x77ee, 0x788e, 0x78b0, 0x7897, 0x7898, 0x788c, 0x7889, 0x787c, 0x7891, 0x7893, 0x787f, 0x797a, 0x797f, 0x7981, 0x842c, 0x79bd, 0x7a1c, 0x7a1a, 0x7a20, 0x7a14, 0x7a1f, 0x7a1e, 0x7a9f, 0x7aa0, 0x7b77, 0x7bc0, 0x7b60, 0x7b6e, 0x7b67, 0x7cb1, 0x7cb3, 0x7cb5, 0x7d93, 0x7d79, 0x7d91, 0x7d81, 0x7d8f, 0x7d5b, 0x7f6e, 0x7f69, 0x7f6a, 0x7f72, 0x7fa9, 0x7fa8, 0x7fa4, 0x8056, 0x8058, 0x8086, 0x8084, 0x8171, 0x8170, 0x8178, 0x8165, 0x816e, 0x8173, 0x816b, 0x8179, 0x817a, 0x8166, 0x8205, 0x8247, 0x8482, 0x8477, 0x843d, 0x8431, 0x8475, 0x8466, 0x846b, 0x8449, 0x846c, 0x845b, 0x843c, 0x8435, 0x8461, 0x8463, 0x8469, 0x846d, 0x8446, 0x865e, 0x865c, 0x865f, 0x86f9, 0x8713, 0x8708, 0x8707, 0x8700, 0x86fe, 0x86fb, 0x8702, 0x8703, 0x8706, 0x870a, 0x8859, 0x88df, 0x88d4, 0x88d9, 0x88dc, 0x88d8, 0x88dd, 0x88e1, 0x88ca, 0x88d5, 0x88d2, 0x899c, 0x89e3, 0x8a6b, 0x8a72, 0x8a73, 0x8a66, 0x8a69, 0x8a70, 0x8a87, 0x8a7c, 0x8a63, 0x8aa0, 0x8a71, 0x8a85, 0x8a6d, 0x8a62, 0x8a6e, 0x8a6c, 0x8a79, 0x8a7b, 0x8a3e, 0x8a68, 0x8c62, 0x8c8a, 0x8c89, 0x8cca, 0x8cc7, 0x8cc8, 0x8cc4, 0x8cb2, 0x8cc3, 0x8cc2, 0x8cc5, 0x8de1, 0x8ddf, 0x8de8, 0x8def, 0x8df3, 0x8dfa, 0x8dea, 0x8de4, 0x8de6, 0x8eb2, 0x8f03, 0x8f09, 0x8efe, 0x8f0a, /* 0xb9 */ 0x8f9f, 0x8fb2, 0x904b, 0x904a, 0x9053, 0x9042, 0x9054, 0x903c, 0x9055, 0x9050, 0x9047, 0x904f, 0x904e, 0x904d, 0x9051, 0x903e, 0x9041, 0x9112, 0x9117, 0x916c, 0x916a, 0x9169, 0x91c9, 0x9237, 0x9257, 0x9238, 0x923d, 0x9240, 0x923e, 0x925b, 0x924b, 0x9264, 0x9251, 0x9234, 0x9249, 0x924d, 0x9245, 0x9239, 0x923f, 0x925a, 0x9598, 0x9698, 0x9694, 0x9695, 0x96cd, 0x96cb, 0x96c9, 0x96ca, 0x96f7, 0x96fb, 0x96f9, 0x96f6, 0x9756, 0x9774, 0x9776, 0x9810, 0x9811, 0x9813, 0x980a, 0x9812, 0x980c, 0x98fc, 0x98f4, 0x98fd, 0x98fe, 0x99b3, 0x99b1, 0x99b4, 0x9ae1, 0x9ce9, 0x9e82, 0x9f0e, 0x9f13, 0x9f20, 0x50e7, 0x50ee, 0x50e5, 0x50d6, 0x50ed, 0x50da, 0x50d5, 0x50cf, 0x50d1, 0x50f1, 0x50ce, 0x50e9, 0x5162, 0x51f3, 0x5283, 0x5282, 0x5331, 0x53ad, 0x55fe, 0x5600, 0x561b, 0x5617, 0x55fd, 0x5614, 0x5606, 0x5609, 0x560d, 0x560e, 0x55f7, 0x5616, 0x561f, 0x5608, 0x5610, 0x55f6, 0x5718, 0x5716, 0x5875, 0x587e, 0x5883, 0x5893, 0x588a, 0x5879, 0x5885, 0x587d, 0x58fd, 0x5925, 0x5922, 0x5924, 0x596a, 0x5969, 0x5ae1, 0x5ae6, 0x5ae9, 0x5ad7, 0x5ad6, 0x5ad8, 0x5ae3, 0x5b75, 0x5bde, 0x5be7, 0x5be1, 0x5be5, 0x5be6, 0x5be8, 0x5be2, 0x5be4, 0x5bdf, 0x5c0d, 0x5c62, 0x5d84, 0x5d87, 0x5e5b, 0x5e63, 0x5e55, 0x5e57, 0x5e54, 0x5ed3, 0x5ed6, 0x5f0a, 0x5f46, 0x5f70, 0x5fb9, 0x6147, /* 0xba */ 0x613f, 0x614b, 0x6177, 0x6162, 0x6163, 0x615f, 0x615a, 0x6158, 0x6175, 0x622a, 0x6487, 0x6458, 0x6454, 0x64a4, 0x6478, 0x645f, 0x647a, 0x6451, 0x6467, 0x6434, 0x646d, 0x647b, 0x6572, 0x65a1, 0x65d7, 0x65d6, 0x66a2, 0x66a8, 0x669d, 0x699c, 0x69a8, 0x6995, 0x69c1, 0x69ae, 0x69d3, 0x69cb, 0x699b, 0x69b7, 0x69bb, 0x69ab, 0x69b4, 0x69d0, 0x69cd, 0x69ad, 0x69cc, 0x69a6, 0x69c3, 0x69a3, 0x6b49, 0x6b4c, 0x6c33, 0x6f33, 0x6f14, 0x6efe, 0x6f13, 0x6ef4, 0x6f29, 0x6f3e, 0x6f20, 0x6f2c, 0x6f0f, 0x6f02, 0x6f22, 0x6eff, 0x6eef, 0x6f06, 0x6f31, 0x6f38, 0x6f32, 0x6f23, 0x6f15, 0x6f2b, 0x6f2f, 0x6f88, 0x6f2a, 0x6eec, 0x6f01, 0x6ef2, 0x6ecc, 0x6ef7, 0x7194, 0x7199, 0x717d, 0x718a, 0x7184, 0x7192, 0x723e, 0x7292, 0x7296, 0x7344, 0x7350, 0x7464, 0x7463, 0x746a, 0x7470, 0x746d, 0x7504, 0x7591, 0x7627, 0x760d, 0x760b, 0x7609, 0x7613, 0x76e1, 0x76e3, 0x7784, 0x777d, 0x777f, 0x7761, 0x78c1, 0x789f, 0x78a7, 0x78b3, 0x78a9, 0x78a3, 0x798e, 0x798f, 0x798d, 0x7a2e, 0x7a31, 0x7aaa, 0x7aa9, 0x7aed, 0x7aef, 0x7ba1, 0x7b95, 0x7b8b, 0x7b75, 0x7b97, 0x7b9d, 0x7b94, 0x7b8f, 0x7bb8, 0x7b87, 0x7b84, 0x7cb9, 0x7cbd, 0x7cbe, 0x7dbb, 0x7db0, 0x7d9c, 0x7dbd, 0x7dbe, 0x7da0, 0x7dca, 0x7db4, 0x7db2, 0x7db1, 0x7dba, 0x7da2, 0x7dbf, 0x7db5, 0x7db8, 0x7dad, 0x7dd2, 0x7dc7, 0x7dac, /* 0xbb */ 0x7f70, 0x7fe0, 0x7fe1, 0x7fdf, 0x805e, 0x805a, 0x8087, 0x8150, 0x8180, 0x818f, 0x8188, 0x818a, 0x817f, 0x8182, 0x81e7, 0x81fa, 0x8207, 0x8214, 0x821e, 0x824b, 0x84c9, 0x84bf, 0x84c6, 0x84c4, 0x8499, 0x849e, 0x84b2, 0x849c, 0x84cb, 0x84b8, 0x84c0, 0x84d3, 0x8490, 0x84bc, 0x84d1, 0x84ca, 0x873f, 0x871c, 0x873b, 0x8722, 0x8725, 0x8734, 0x8718, 0x8755, 0x8737, 0x8729, 0x88f3, 0x8902, 0x88f4, 0x88f9, 0x88f8, 0x88fd, 0x88e8, 0x891a, 0x88ef, 0x8aa6, 0x8a8c, 0x8a9e, 0x8aa3, 0x8a8d, 0x8aa1, 0x8a93, 0x8aa4, 0x8aaa, 0x8aa5, 0x8aa8, 0x8a98, 0x8a91, 0x8a9a, 0x8aa7, 0x8c6a, 0x8c8d, 0x8c8c, 0x8cd3, 0x8cd1, 0x8cd2, 0x8d6b, 0x8d99, 0x8d95, 0x8dfc, 0x8f14, 0x8f12, 0x8f15, 0x8f13, 0x8fa3, 0x9060, 0x9058, 0x905c, 0x9063, 0x9059, 0x905e, 0x9062, 0x905d, 0x905b, 0x9119, 0x9118, 0x911e, 0x9175, 0x9178, 0x9177, 0x9174, 0x9278, 0x9280, 0x9285, 0x9298, 0x9296, 0x927b, 0x9293, 0x929c, 0x92a8, 0x927c, 0x9291, 0x95a1, 0x95a8, 0x95a9, 0x95a3, 0x95a5, 0x95a4, 0x9699, 0x969c, 0x969b, 0x96cc, 0x96d2, 0x9700, 0x977c, 0x9785, 0x97f6, 0x9817, 0x9818, 0x98af, 0x98b1, 0x9903, 0x9905, 0x990c, 0x9909, 0x99c1, 0x9aaf, 0x9ab0, 0x9ae6, 0x9b41, 0x9b42, 0x9cf4, 0x9cf6, 0x9cf3, 0x9ebc, 0x9f3b, 0x9f4a, 0x5104, 0x5100, 0x50fb, 0x50f5, 0x50f9, 0x5102, 0x5108, 0x5109, 0x5105, 0x51dc, /* 0xbc */ 0x5287, 0x5288, 0x5289, 0x528d, 0x528a, 0x52f0, 0x53b2, 0x562e, 0x563b, 0x5639, 0x5632, 0x563f, 0x5634, 0x5629, 0x5653, 0x564e, 0x5657, 0x5674, 0x5636, 0x562f, 0x5630, 0x5880, 0x589f, 0x589e, 0x58b3, 0x589c, 0x58ae, 0x58a9, 0x58a6, 0x596d, 0x5b09, 0x5afb, 0x5b0b, 0x5af5, 0x5b0c, 0x5b08, 0x5bee, 0x5bec, 0x5be9, 0x5beb, 0x5c64, 0x5c65, 0x5d9d, 0x5d94, 0x5e62, 0x5e5f, 0x5e61, 0x5ee2, 0x5eda, 0x5edf, 0x5edd, 0x5ee3, 0x5ee0, 0x5f48, 0x5f71, 0x5fb7, 0x5fb5, 0x6176, 0x6167, 0x616e, 0x615d, 0x6155, 0x6182, 0x617c, 0x6170, 0x616b, 0x617e, 0x61a7, 0x6190, 0x61ab, 0x618e, 0x61ac, 0x619a, 0x61a4, 0x6194, 0x61ae, 0x622e, 0x6469, 0x646f, 0x6479, 0x649e, 0x64b2, 0x6488, 0x6490, 0x64b0, 0x64a5, 0x6493, 0x6495, 0x64a9, 0x6492, 0x64ae, 0x64ad, 0x64ab, 0x649a, 0x64ac, 0x6499, 0x64a2, 0x64b3, 0x6575, 0x6577, 0x6578, 0x66ae, 0x66ab, 0x66b4, 0x66b1, 0x6a23, 0x6a1f, 0x69e8, 0x6a01, 0x6a1e, 0x6a19, 0x69fd, 0x6a21, 0x6a13, 0x6a0a, 0x69f3, 0x6a02, 0x6a05, 0x69ed, 0x6a11, 0x6b50, 0x6b4e, 0x6ba4, 0x6bc5, 0x6bc6, 0x6f3f, 0x6f7c, 0x6f84, 0x6f51, 0x6f66, 0x6f54, 0x6f86, 0x6f6d, 0x6f5b, 0x6f78, 0x6f6e, 0x6f8e, 0x6f7a, 0x6f70, 0x6f64, 0x6f97, 0x6f58, 0x6ed5, 0x6f6f, 0x6f60, 0x6f5f, 0x719f, 0x71ac, 0x71b1, 0x71a8, 0x7256, 0x729b, 0x734e, 0x7357, 0x7469, 0x748b, 0x7483, /* 0xbd */ 0x747e, 0x7480, 0x757f, 0x7620, 0x7629, 0x761f, 0x7624, 0x7626, 0x7621, 0x7622, 0x769a, 0x76ba, 0x76e4, 0x778e, 0x7787, 0x778c, 0x7791, 0x778b, 0x78cb, 0x78c5, 0x78ba, 0x78ca, 0x78be, 0x78d5, 0x78bc, 0x78d0, 0x7a3f, 0x7a3c, 0x7a40, 0x7a3d, 0x7a37, 0x7a3b, 0x7aaf, 0x7aae, 0x7bad, 0x7bb1, 0x7bc4, 0x7bb4, 0x7bc6, 0x7bc7, 0x7bc1, 0x7ba0, 0x7bcc, 0x7cca, 0x7de0, 0x7df4, 0x7def, 0x7dfb, 0x7dd8, 0x7dec, 0x7ddd, 0x7de8, 0x7de3, 0x7dda, 0x7dde, 0x7de9, 0x7d9e, 0x7dd9, 0x7df2, 0x7df9, 0x7f75, 0x7f77, 0x7faf, 0x7fe9, 0x8026, 0x819b, 0x819c, 0x819d, 0x81a0, 0x819a, 0x8198, 0x8517, 0x853d, 0x851a, 0x84ee, 0x852c, 0x852d, 0x8513, 0x8511, 0x8523, 0x8521, 0x8514, 0x84ec, 0x8525, 0x84ff, 0x8506, 0x8782, 0x8774, 0x8776, 0x8760, 0x8766, 0x8778, 0x8768, 0x8759, 0x8757, 0x874c, 0x8753, 0x885b, 0x885d, 0x8910, 0x8907, 0x8912, 0x8913, 0x8915, 0x890a, 0x8abc, 0x8ad2, 0x8ac7, 0x8ac4, 0x8a95, 0x8acb, 0x8af8, 0x8ab2, 0x8ac9, 0x8ac2, 0x8abf, 0x8ab0, 0x8ad6, 0x8acd, 0x8ab6, 0x8ab9, 0x8adb, 0x8c4c, 0x8c4e, 0x8c6c, 0x8ce0, 0x8cde, 0x8ce6, 0x8ce4, 0x8cec, 0x8ced, 0x8ce2, 0x8ce3, 0x8cdc, 0x8cea, 0x8ce1, 0x8d6d, 0x8d9f, 0x8da3, 0x8e2b, 0x8e10, 0x8e1d, 0x8e22, 0x8e0f, 0x8e29, 0x8e1f, 0x8e21, 0x8e1e, 0x8eba, 0x8f1d, 0x8f1b, 0x8f1f, 0x8f29, 0x8f26, 0x8f2a, 0x8f1c, 0x8f1e, /* 0xbe */ 0x8f25, 0x9069, 0x906e, 0x9068, 0x906d, 0x9077, 0x9130, 0x912d, 0x9127, 0x9131, 0x9187, 0x9189, 0x918b, 0x9183, 0x92c5, 0x92bb, 0x92b7, 0x92ea, 0x92ac, 0x92e4, 0x92c1, 0x92b3, 0x92bc, 0x92d2, 0x92c7, 0x92f0, 0x92b2, 0x95ad, 0x95b1, 0x9704, 0x9706, 0x9707, 0x9709, 0x9760, 0x978d, 0x978b, 0x978f, 0x9821, 0x982b, 0x981c, 0x98b3, 0x990a, 0x9913, 0x9912, 0x9918, 0x99dd, 0x99d0, 0x99df, 0x99db, 0x99d1, 0x99d5, 0x99d2, 0x99d9, 0x9ab7, 0x9aee, 0x9aef, 0x9b27, 0x9b45, 0x9b44, 0x9b77, 0x9b6f, 0x9d06, 0x9d09, 0x9d03, 0x9ea9, 0x9ebe, 0x9ece, 0x58a8, 0x9f52, 0x5112, 0x5118, 0x5114, 0x5110, 0x5115, 0x5180, 0x51aa, 0x51dd, 0x5291, 0x5293, 0x52f3, 0x5659, 0x566b, 0x5679, 0x5669, 0x5664, 0x5678, 0x566a, 0x5668, 0x5665, 0x5671, 0x566f, 0x566c, 0x5662, 0x5676, 0x58c1, 0x58be, 0x58c7, 0x58c5, 0x596e, 0x5b1d, 0x5b34, 0x5b78, 0x5bf0, 0x5c0e, 0x5f4a, 0x61b2, 0x6191, 0x61a9, 0x618a, 0x61cd, 0x61b6, 0x61be, 0x61ca, 0x61c8, 0x6230, 0x64c5, 0x64c1, 0x64cb, 0x64bb, 0x64bc, 0x64da, 0x64c4, 0x64c7, 0x64c2, 0x64cd, 0x64bf, 0x64d2, 0x64d4, 0x64be, 0x6574, 0x66c6, 0x66c9, 0x66b9, 0x66c4, 0x66c7, 0x66b8, 0x6a3d, 0x6a38, 0x6a3a, 0x6a59, 0x6a6b, 0x6a58, 0x6a39, 0x6a44, 0x6a62, 0x6a61, 0x6a4b, 0x6a47, 0x6a35, 0x6a5f, 0x6a48, 0x6b59, 0x6b77, 0x6c05, 0x6fc2, 0x6fb1, 0x6fa1, /* 0xbf */ 0x6fc3, 0x6fa4, 0x6fc1, 0x6fa7, 0x6fb3, 0x6fc0, 0x6fb9, 0x6fb6, 0x6fa6, 0x6fa0, 0x6fb4, 0x71be, 0x71c9, 0x71d0, 0x71d2, 0x71c8, 0x71d5, 0x71b9, 0x71ce, 0x71d9, 0x71dc, 0x71c3, 0x71c4, 0x7368, 0x749c, 0x74a3, 0x7498, 0x749f, 0x749e, 0x74e2, 0x750c, 0x750d, 0x7634, 0x7638, 0x763a, 0x76e7, 0x76e5, 0x77a0, 0x779e, 0x779f, 0x77a5, 0x78e8, 0x78da, 0x78ec, 0x78e7, 0x79a6, 0x7a4d, 0x7a4e, 0x7a46, 0x7a4c, 0x7a4b, 0x7aba, 0x7bd9, 0x7c11, 0x7bc9, 0x7be4, 0x7bdb, 0x7be1, 0x7be9, 0x7be6, 0x7cd5, 0x7cd6, 0x7e0a, 0x7e11, 0x7e08, 0x7e1b, 0x7e23, 0x7e1e, 0x7e1d, 0x7e09, 0x7e10, 0x7f79, 0x7fb2, 0x7ff0, 0x7ff1, 0x7fee, 0x8028, 0x81b3, 0x81a9, 0x81a8, 0x81fb, 0x8208, 0x8258, 0x8259, 0x854a, 0x8559, 0x8548, 0x8568, 0x8569, 0x8543, 0x8549, 0x856d, 0x856a, 0x855e, 0x8783, 0x879f, 0x879e, 0x87a2, 0x878d, 0x8861, 0x892a, 0x8932, 0x8925, 0x892b, 0x8921, 0x89aa, 0x89a6, 0x8ae6, 0x8afa, 0x8aeb, 0x8af1, 0x8b00, 0x8adc, 0x8ae7, 0x8aee, 0x8afe, 0x8b01, 0x8b02, 0x8af7, 0x8aed, 0x8af3, 0x8af6, 0x8afc, 0x8c6b, 0x8c6d, 0x8c93, 0x8cf4, 0x8e44, 0x8e31, 0x8e34, 0x8e42, 0x8e39, 0x8e35, 0x8f3b, 0x8f2f, 0x8f38, 0x8f33, 0x8fa8, 0x8fa6, 0x9075, 0x9074, 0x9078, 0x9072, 0x907c, 0x907a, 0x9134, 0x9192, 0x9320, 0x9336, 0x92f8, 0x9333, 0x932f, 0x9322, 0x92fc, 0x932b, 0x9304, 0x931a, /* 0xc0 */ 0x9310, 0x9326, 0x9321, 0x9315, 0x932e, 0x9319, 0x95bb, 0x96a7, 0x96a8, 0x96aa, 0x96d5, 0x970e, 0x9711, 0x9716, 0x970d, 0x9713, 0x970f, 0x975b, 0x975c, 0x9766, 0x9798, 0x9830, 0x9838, 0x983b, 0x9837, 0x982d, 0x9839, 0x9824, 0x9910, 0x9928, 0x991e, 0x991b, 0x9921, 0x991a, 0x99ed, 0x99e2, 0x99f1, 0x9ab8, 0x9abc, 0x9afb, 0x9aed, 0x9b28, 0x9b91, 0x9d15, 0x9d23, 0x9d26, 0x9d28, 0x9d12, 0x9d1b, 0x9ed8, 0x9ed4, 0x9f8d, 0x9f9c, 0x512a, 0x511f, 0x5121, 0x5132, 0x52f5, 0x568e, 0x5680, 0x5690, 0x5685, 0x5687, 0x568f, 0x58d5, 0x58d3, 0x58d1, 0x58ce, 0x5b30, 0x5b2a, 0x5b24, 0x5b7a, 0x5c37, 0x5c68, 0x5dbc, 0x5dba, 0x5dbd, 0x5db8, 0x5e6b, 0x5f4c, 0x5fbd, 0x61c9, 0x61c2, 0x61c7, 0x61e6, 0x61cb, 0x6232, 0x6234, 0x64ce, 0x64ca, 0x64d8, 0x64e0, 0x64f0, 0x64e6, 0x64ec, 0x64f1, 0x64e2, 0x64ed, 0x6582, 0x6583, 0x66d9, 0x66d6, 0x6a80, 0x6a94, 0x6a84, 0x6aa2, 0x6a9c, 0x6adb, 0x6aa3, 0x6a7e, 0x6a97, 0x6a90, 0x6aa0, 0x6b5c, 0x6bae, 0x6bda, 0x6c08, 0x6fd8, 0x6ff1, 0x6fdf, 0x6fe0, 0x6fdb, 0x6fe4, 0x6feb, 0x6fef, 0x6f80, 0x6fec, 0x6fe1, 0x6fe9, 0x6fd5, 0x6fee, 0x6ff0, 0x71e7, 0x71df, 0x71ee, 0x71e6, 0x71e5, 0x71ed, 0x71ec, 0x71f4, 0x71e0, 0x7235, 0x7246, 0x7370, 0x7372, 0x74a9, 0x74b0, 0x74a6, 0x74a8, 0x7646, 0x7642, 0x764c, 0x76ea, 0x77b3, 0x77aa, 0x77b0, 0x77ac, /* 0xc1 */ 0x77a7, 0x77ad, 0x77ef, 0x78f7, 0x78fa, 0x78f4, 0x78ef, 0x7901, 0x79a7, 0x79aa, 0x7a57, 0x7abf, 0x7c07, 0x7c0d, 0x7bfe, 0x7bf7, 0x7c0c, 0x7be0, 0x7ce0, 0x7cdc, 0x7cde, 0x7ce2, 0x7cdf, 0x7cd9, 0x7cdd, 0x7e2e, 0x7e3e, 0x7e46, 0x7e37, 0x7e32, 0x7e43, 0x7e2b, 0x7e3d, 0x7e31, 0x7e45, 0x7e41, 0x7e34, 0x7e39, 0x7e48, 0x7e35, 0x7e3f, 0x7e2f, 0x7f44, 0x7ff3, 0x7ffc, 0x8071, 0x8072, 0x8070, 0x806f, 0x8073, 0x81c6, 0x81c3, 0x81ba, 0x81c2, 0x81c0, 0x81bf, 0x81bd, 0x81c9, 0x81be, 0x81e8, 0x8209, 0x8271, 0x85aa, 0x8584, 0x857e, 0x859c, 0x8591, 0x8594, 0x85af, 0x859b, 0x8587, 0x85a8, 0x858a, 0x8667, 0x87c0, 0x87d1, 0x87b3, 0x87d2, 0x87c6, 0x87ab, 0x87bb, 0x87ba, 0x87c8, 0x87cb, 0x893b, 0x8936, 0x8944, 0x8938, 0x893d, 0x89ac, 0x8b0e, 0x8b17, 0x8b19, 0x8b1b, 0x8b0a, 0x8b20, 0x8b1d, 0x8b04, 0x8b10, 0x8c41, 0x8c3f, 0x8c73, 0x8cfa, 0x8cfd, 0x8cfc, 0x8cf8, 0x8cfb, 0x8da8, 0x8e49, 0x8e4b, 0x8e48, 0x8e4a, 0x8f44, 0x8f3e, 0x8f42, 0x8f45, 0x8f3f, 0x907f, 0x907d, 0x9084, 0x9081, 0x9082, 0x9080, 0x9139, 0x91a3, 0x919e, 0x919c, 0x934d, 0x9382, 0x9328, 0x9375, 0x934a, 0x9365, 0x934b, 0x9318, 0x937e, 0x936c, 0x935b, 0x9370, 0x935a, 0x9354, 0x95ca, 0x95cb, 0x95cc, 0x95c8, 0x95c6, 0x96b1, 0x96b8, 0x96d6, 0x971c, 0x971e, 0x97a0, 0x97d3, 0x9846, 0x98b6, 0x9935, 0x9a01, /* 0xc2 */ 0x99ff, 0x9bae, 0x9bab, 0x9baa, 0x9bad, 0x9d3b, 0x9d3f, 0x9e8b, 0x9ecf, 0x9ede, 0x9edc, 0x9edd, 0x9edb, 0x9f3e, 0x9f4b, 0x53e2, 0x5695, 0x56ae, 0x58d9, 0x58d8, 0x5b38, 0x5f5d, 0x61e3, 0x6233, 0x64f4, 0x64f2, 0x64fe, 0x6506, 0x64fa, 0x64fb, 0x64f7, 0x65b7, 0x66dc, 0x6726, 0x6ab3, 0x6aac, 0x6ac3, 0x6abb, 0x6ab8, 0x6ac2, 0x6aae, 0x6aaf, 0x6b5f, 0x6b78, 0x6baf, 0x7009, 0x700b, 0x6ffe, 0x7006, 0x6ffa, 0x7011, 0x700f, 0x71fb, 0x71fc, 0x71fe, 0x71f8, 0x7377, 0x7375, 0x74a7, 0x74bf, 0x7515, 0x7656, 0x7658, 0x7652, 0x77bd, 0x77bf, 0x77bb, 0x77bc, 0x790e, 0x79ae, 0x7a61, 0x7a62, 0x7a60, 0x7ac4, 0x7ac5, 0x7c2b, 0x7c27, 0x7c2a, 0x7c1e, 0x7c23, 0x7c21, 0x7ce7, 0x7e54, 0x7e55, 0x7e5e, 0x7e5a, 0x7e61, 0x7e52, 0x7e59, 0x7f48, 0x7ff9, 0x7ffb, 0x8077, 0x8076, 0x81cd, 0x81cf, 0x820a, 0x85cf, 0x85a9, 0x85cd, 0x85d0, 0x85c9, 0x85b0, 0x85ba, 0x85b9, 0x85a6, 0x87ef, 0x87ec, 0x87f2, 0x87e0, 0x8986, 0x89b2, 0x89f4, 0x8b28, 0x8b39, 0x8b2c, 0x8b2b, 0x8c50, 0x8d05, 0x8e59, 0x8e63, 0x8e66, 0x8e64, 0x8e5f, 0x8e55, 0x8ec0, 0x8f49, 0x8f4d, 0x9087, 0x9083, 0x9088, 0x91ab, 0x91ac, 0x91d0, 0x9394, 0x938a, 0x9396, 0x93a2, 0x93b3, 0x93ae, 0x93ac, 0x93b0, 0x9398, 0x939a, 0x9397, 0x95d4, 0x95d6, 0x95d0, 0x95d5, 0x96e2, 0x96dc, 0x96d9, 0x96db, 0x96de, 0x9724, 0x97a3, 0x97a6, /* 0xc3 */ 0x97ad, 0x97f9, 0x984d, 0x984f, 0x984c, 0x984e, 0x9853, 0x98ba, 0x993e, 0x993f, 0x993d, 0x992e, 0x99a5, 0x9a0e, 0x9ac1, 0x9b03, 0x9b06, 0x9b4f, 0x9b4e, 0x9b4d, 0x9bca, 0x9bc9, 0x9bfd, 0x9bc8, 0x9bc0, 0x9d51, 0x9d5d, 0x9d60, 0x9ee0, 0x9f15, 0x9f2c, 0x5133, 0x56a5, 0x58de, 0x58df, 0x58e2, 0x5bf5, 0x9f90, 0x5eec, 0x61f2, 0x61f7, 0x61f6, 0x61f5, 0x6500, 0x650f, 0x66e0, 0x66dd, 0x6ae5, 0x6add, 0x6ada, 0x6ad3, 0x701b, 0x701f, 0x7028, 0x701a, 0x701d, 0x7015, 0x7018, 0x7206, 0x720d, 0x7258, 0x72a2, 0x7378, 0x737a, 0x74bd, 0x74ca, 0x74e3, 0x7587, 0x7586, 0x765f, 0x7661, 0x77c7, 0x7919, 0x79b1, 0x7a6b, 0x7a69, 0x7c3e, 0x7c3f, 0x7c38, 0x7c3d, 0x7c37, 0x7c40, 0x7e6b, 0x7e6d, 0x7e79, 0x7e69, 0x7e6a, 0x7f85, 0x7e73, 0x7fb6, 0x7fb9, 0x7fb8, 0x81d8, 0x85e9, 0x85dd, 0x85ea, 0x85d5, 0x85e4, 0x85e5, 0x85f7, 0x87fb, 0x8805, 0x880d, 0x87f9, 0x87fe, 0x8960, 0x895f, 0x8956, 0x895e, 0x8b41, 0x8b5c, 0x8b58, 0x8b49, 0x8b5a, 0x8b4e, 0x8b4f, 0x8b46, 0x8b59, 0x8d08, 0x8d0a, 0x8e7c, 0x8e72, 0x8e87, 0x8e76, 0x8e6c, 0x8e7a, 0x8e74, 0x8f54, 0x8f4e, 0x8fad, 0x908a, 0x908b, 0x91b1, 0x91ae, 0x93e1, 0x93d1, 0x93df, 0x93c3, 0x93c8, 0x93dc, 0x93dd, 0x93d6, 0x93e2, 0x93cd, 0x93d8, 0x93e4, 0x93d7, 0x93e8, 0x95dc, 0x96b4, 0x96e3, 0x972a, 0x9727, 0x9761, 0x97dc, 0x97fb, 0x985e, /* 0xc4 */ 0x9858, 0x985b, 0x98bc, 0x9945, 0x9949, 0x9a16, 0x9a19, 0x9b0d, 0x9be8, 0x9be7, 0x9bd6, 0x9bdb, 0x9d89, 0x9d61, 0x9d72, 0x9d6a, 0x9d6c, 0x9e92, 0x9e97, 0x9e93, 0x9eb4, 0x52f8, 0x56a8, 0x56b7, 0x56b6, 0x56b4, 0x56bc, 0x58e4, 0x5b40, 0x5b43, 0x5b7d, 0x5bf6, 0x5dc9, 0x61f8, 0x61fa, 0x6518, 0x6514, 0x6519, 0x66e6, 0x6727, 0x6aec, 0x703e, 0x7030, 0x7032, 0x7210, 0x737b, 0x74cf, 0x7662, 0x7665, 0x7926, 0x792a, 0x792c, 0x792b, 0x7ac7, 0x7af6, 0x7c4c, 0x7c43, 0x7c4d, 0x7cef, 0x7cf0, 0x8fae, 0x7e7d, 0x7e7c, 0x7e82, 0x7f4c, 0x8000, 0x81da, 0x8266, 0x85fb, 0x85f9, 0x8611, 0x85fa, 0x8606, 0x860b, 0x8607, 0x860a, 0x8814, 0x8815, 0x8964, 0x89ba, 0x89f8, 0x8b70, 0x8b6c, 0x8b66, 0x8b6f, 0x8b5f, 0x8b6b, 0x8d0f, 0x8d0d, 0x8e89, 0x8e81, 0x8e85, 0x8e82, 0x91b4, 0x91cb, 0x9418, 0x9403, 0x93fd, 0x95e1, 0x9730, 0x98c4, 0x9952, 0x9951, 0x99a8, 0x9a2b, 0x9a30, 0x9a37, 0x9a35, 0x9c13, 0x9c0d, 0x9e79, 0x9eb5, 0x9ee8, 0x9f2f, 0x9f5f, 0x9f63, 0x9f61, 0x5137, 0x5138, 0x56c1, 0x56c0, 0x56c2, 0x5914, 0x5c6c, 0x5dcd, 0x61fc, 0x61fe, 0x651d, 0x651c, 0x6595, 0x66e9, 0x6afb, 0x6b04, 0x6afa, 0x6bb2, 0x704c, 0x721b, 0x72a7, 0x74d6, 0x74d4, 0x7669, 0x77d3, 0x7c50, 0x7e8f, 0x7e8c, 0x7fbc, 0x8617, 0x862d, 0x861a, 0x8823, 0x8822, 0x8821, 0x881f, 0x896a, 0x896c, 0x89bd, 0x8b74, /* 0xc5 */ 0x8b77, 0x8b7d, 0x8d13, 0x8e8a, 0x8e8d, 0x8e8b, 0x8f5f, 0x8faf, 0x91ba, 0x942e, 0x9433, 0x9435, 0x943a, 0x9438, 0x9432, 0x942b, 0x95e2, 0x9738, 0x9739, 0x9732, 0x97ff, 0x9867, 0x9865, 0x9957, 0x9a45, 0x9a43, 0x9a40, 0x9a3e, 0x9acf, 0x9b54, 0x9b51, 0x9c2d, 0x9c25, 0x9daf, 0x9db4, 0x9dc2, 0x9db8, 0x9e9d, 0x9eef, 0x9f19, 0x9f5c, 0x9f66, 0x9f67, 0x513c, 0x513b, 0x56c8, 0x56ca, 0x56c9, 0x5b7f, 0x5dd4, 0x5dd2, 0x5f4e, 0x61ff, 0x6524, 0x6b0a, 0x6b61, 0x7051, 0x7058, 0x7380, 0x74e4, 0x758a, 0x766e, 0x766c, 0x79b3, 0x7c60, 0x7c5f, 0x807e, 0x807d, 0x81df, 0x8972, 0x896f, 0x89fc, 0x8b80, 0x8d16, 0x8d17, 0x8e91, 0x8e93, 0x8f61, 0x9148, 0x9444, 0x9451, 0x9452, 0x973d, 0x973e, 0x97c3, 0x97c1, 0x986b, 0x9955, 0x9a55, 0x9a4d, 0x9ad2, 0x9b1a, 0x9c49, 0x9c31, 0x9c3e, 0x9c3b, 0x9dd3, 0x9dd7, 0x9f34, 0x9f6c, 0x9f6a, 0x9f94, 0x56cc, 0x5dd6, 0x6200, 0x6523, 0x652b, 0x652a, 0x66ec, 0x6b10, 0x74da, 0x7aca, 0x7c64, 0x7c63, 0x7c65, 0x7e93, 0x7e96, 0x7e94, 0x81e2, 0x8638, 0x863f, 0x8831, 0x8b8a, 0x9090, 0x908f, 0x9463, 0x9460, 0x9464, 0x9768, 0x986f, 0x995c, 0x9a5a, 0x9a5b, 0x9a57, 0x9ad3, 0x9ad4, 0x9ad1, 0x9c54, 0x9c57, 0x9c56, 0x9de5, 0x9e9f, 0x9ef4, 0x56d1, 0x58e9, 0x652c, 0x705e, 0x7671, 0x7672, 0x77d7, 0x7f50, 0x7f88, 0x8836, 0x8839, 0x8862, 0x8b93, 0x8b92, /* 0xc6 */ 0x8b96, 0x8277, 0x8d1b, 0x91c0, 0x946a, 0x9742, 0x9748, 0x9744, 0x97c6, 0x9870, 0x9a5f, 0x9b22, 0x9b58, 0x9c5f, 0x9df9, 0x9dfa, 0x9e7c, 0x9e7d, 0x9f07, 0x9f77, 0x9f72, 0x5ef3, 0x6b16, 0x7063, 0x7c6c, 0x7c6e, 0x883b, 0x89c0, 0x8ea1, 0x91c1, 0x9472, 0x9470, 0x9871, 0x995e, 0x9ad6, 0x9b23, 0x9ecc, 0x7064, 0x77da, 0x8b9a, 0x9477, 0x97c9, 0x9a62, 0x9a65, 0x7e9c, 0x8b9c, 0x8eaa, 0x91c5, 0x947d, 0x947e, 0x947c, 0x9c77, 0x9c78, 0x9ef7, 0x8c54, 0x947f, 0x9e1a, 0x7228, 0x9a6a, 0x9b31, 0x9e1b, 0x9e1e, 0x7c72, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, 0x247b, 0x247c, 0x247d, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x4e36, 0x4e3f, 0x4e85, 0x4ea0, 0x5182, 0x5196, 0x51ab, 0x52f9, 0x5338, 0x5369, 0x53b6, 0x590a, 0x5b80, 0x5ddb, 0x2f33, 0x5e7f, 0xf6df, 0x5f50, 0x5f61, 0x6534, 0xf6e3, 0x7592, 0xf6e5, 0x8fb5, 0xf6e7, 0x00a8, 0x02c6, 0x30fd, 0x30fe, 0x309d, 0x309e, 0xf6ee, 0xf6ef, 0x3005, 0x3006, 0x3007, 0x30fc, 0xff3b, 0xff3d, 0x273d, 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, /* 0xc7 */ 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, 0x3091, 0x3092, 0x3093, 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8, 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8, 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0, 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8, 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0, 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, /* 0xc8 */ 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, 0x21e7, 0x21b8, 0x21b9, 0xf7e5, 0xf7e6, 0x4e5a, 0xf7e8, 0x5202, 0xf7ea, 0xf7eb, 0x5188, 0xf7ed, 0xf7ee, 0xf7ef, 0xf7f0, 0xf7f1, 0xf7f2, 0xf7f3, 0xf7f4, 0xf7f5, 0xf7f6, 0xf7f7, 0xf7f8, 0xf7f9, 0xf7fa, 0xf7fb, 0xf7fc, 0xf7fd, 0xf7fe, 0xf7ff, 0xf800, 0xf801, 0xf802, 0xf803, 0xf804, 0xf805, 0xf806, 0xf807, 0xf808, 0xf809, 0xf80a, 0xf80b, 0xf80c, 0xf80d, 0xf80e, 0xf80f, 0xf810, 0xf811, 0xf812, 0xf813, 0xf814, 0xf815, 0xf816, 0xffe2, 0xffe4, 0xff07, 0xff02, 0x3231, 0x2116, 0x2121, 0x309b, 0x309c, 0x2e80, 0x2e84, 0x2e86, 0x2e87, 0x2e88, 0x2e8a, 0x2e8c, 0x2e8d, 0x2e95, 0x2e9c, 0x2e9d, 0x2ea5, 0x2ea7, 0x2eaa, 0x2eac, 0x2eae, 0x2eb6, 0x2ebc, 0x2ebe, 0x2ec6, 0x2eca, 0x2ecc, 0x2ecd, 0x2ecf, 0x2ed6, 0x2ed7, 0x2ede, 0x2ee3, 0xf83c, 0xf83d, 0xf83e, 0x0283, 0x0250, 0x025b, 0x0254, 0x0275, 0x0153, 0x00f8, 0x014b, 0x028a, 0x026a, /* 0xc9 */ 0x4e42, 0x4e5c, 0x51f5, 0x531a, 0x5382, 0x4e07, 0x4e0c, 0x4e47, 0x4e8d, 0x56d7, 0xfa0c, 0x5c6e, 0x5f73, 0x4e0f, 0x5187, 0x4e0e, 0x4e2e, 0x4e93, 0x4ec2, 0x4ec9, 0x4ec8, 0x5198, 0x52fc, 0x536c, 0x53b9, 0x5720, 0x5903, 0x592c, 0x5c10, 0x5dff, 0x65e1, 0x6bb3, 0x6bcc, 0x6c14, 0x723f, 0x4e31, 0x4e3c, 0x4ee8, 0x4edc, 0x4ee9, 0x4ee1, 0x4edd, 0x4eda, 0x520c, 0x531c, 0x534c, 0x5722, 0x5723, 0x5917, 0x592f, 0x5b81, 0x5b84, 0x5c12, 0x5c3b, 0x5c74, 0x5c73, 0x5e04, 0x5e80, 0x5e82, 0x5fc9, 0x6209, 0x6250, 0x6c15, 0x6c36, 0x6c43, 0x6c3f, 0x6c3b, 0x72ae, 0x72b0, 0x738a, 0x79b8, 0x808a, 0x961e, 0x4f0e, 0x4f18, 0x4f2c, 0x4ef5, 0x4f14, 0x4ef1, 0x4f00, 0x4ef7, 0x4f08, 0x4f1d, 0x4f02, 0x4f05, 0x4f22, 0x4f13, 0x4f04, 0x4ef4, 0x4f12, 0x51b1, 0x5213, 0x5209, 0x5210, 0x52a6, 0x5322, 0x531f, 0x534d, 0x538a, 0x5407, 0x56e1, 0x56df, 0x572e, 0x572a, 0x5734, 0x593c, 0x5980, 0x597c, 0x5985, 0x597b, 0x597e, 0x5977, 0x597f, 0x5b56, 0x5c15, 0x5c25, 0x5c7c, 0x5c7a, 0x5c7b, 0x5c7e, 0x5ddf, 0x5e75, 0x5e84, 0x5f02, 0x5f1a, 0x5f74, 0x5fd5, 0x5fd4, 0x5fcf, 0x625c, 0x625e, 0x6264, 0x6261, 0x6266, 0x6262, 0x6259, 0x6260, 0x625a, 0x6265, 0x65ef, 0x65ee, 0x673e, 0x6739, 0x6738, 0x673b, 0x673a, 0x673f, 0x673c, 0x6733, 0x6c18, 0x6c46, 0x6c52, 0x6c5c, 0x6c4f, 0x6c4a, 0x6c54, 0x6c4b, /* 0xca */ 0x6c4c, 0x7071, 0x725e, 0x72b4, 0x72b5, 0x738e, 0x752a, 0x767f, 0x7a75, 0x7f51, 0x8278, 0x827c, 0x8280, 0x827d, 0x827f, 0x864d, 0x897e, 0x9099, 0x9097, 0x9098, 0x909b, 0x9094, 0x9622, 0x9624, 0x9620, 0x9623, 0x4f56, 0x4f3b, 0x4f62, 0x4f49, 0x4f53, 0x4f64, 0x4f3e, 0x4f67, 0x4f52, 0x4f5f, 0x4f41, 0x4f58, 0x4f2d, 0x4f33, 0x4f3f, 0x4f61, 0x518f, 0x51b9, 0x521c, 0x521e, 0x5221, 0x52ad, 0x52ae, 0x5309, 0x5363, 0x5372, 0x538e, 0x538f, 0x5430, 0x5437, 0x542a, 0x5454, 0x5445, 0x5419, 0x541c, 0x5425, 0x5418, 0x543d, 0x544f, 0x5441, 0x5428, 0x5424, 0x5447, 0x56ee, 0x56e7, 0x56e5, 0x5741, 0x5745, 0x574c, 0x5749, 0x574b, 0x5752, 0x5906, 0x5940, 0x59a6, 0x5998, 0x59a0, 0x5997, 0x598e, 0x59a2, 0x5990, 0x598f, 0x59a7, 0x59a1, 0x5b8e, 0x5b92, 0x5c28, 0x5c2a, 0x5c8d, 0x5c8f, 0x5c88, 0x5c8b, 0x5c89, 0x5c92, 0x5c8a, 0x5c86, 0x5c93, 0x5c95, 0x5de0, 0x5e0a, 0x5e0e, 0x5e8b, 0x5e89, 0x5e8c, 0x5e88, 0x5e8d, 0x5f05, 0x5f1d, 0x5f78, 0x5f76, 0x5fd2, 0x5fd1, 0x5fd0, 0x5fed, 0x5fe8, 0x5fee, 0x5ff3, 0x5fe1, 0x5fe4, 0x5fe3, 0x5ffa, 0x5fef, 0x5ff7, 0x5ffb, 0x6000, 0x5ff4, 0x623a, 0x6283, 0x628c, 0x628e, 0x628f, 0x6294, 0x6287, 0x6271, 0x627b, 0x627a, 0x6270, 0x6281, 0x6288, 0x6277, 0x627d, 0x6272, 0x6274, 0x6537, 0x65f0, 0x65f4, 0x65f3, 0x65f2, 0x65f5, 0x6745, 0x6747, /* 0xcb */ 0x6759, 0x6755, 0x674c, 0x6748, 0x675d, 0x674d, 0x675a, 0x674b, 0x6bd0, 0x6c19, 0x6c1a, 0x6c78, 0x6c67, 0x6c6b, 0x6c84, 0x6c8b, 0x6c8f, 0x6c71, 0x6c6f, 0x6c69, 0x6c9a, 0x6c6d, 0x6c87, 0x6c95, 0x6c9c, 0x6c66, 0x6c73, 0x6c65, 0x6c7b, 0x6c8e, 0x7074, 0x707a, 0x7263, 0x72bf, 0x72bd, 0x72c3, 0x72c6, 0x72c1, 0x72ba, 0x72c5, 0x7395, 0x7397, 0x7393, 0x7394, 0x7392, 0x753a, 0x7539, 0x7594, 0x7595, 0x7681, 0x793d, 0x8034, 0x8095, 0x8099, 0x8090, 0x8092, 0x809c, 0x8290, 0x828f, 0x8285, 0x828e, 0x8291, 0x8293, 0x828a, 0x8283, 0x8284, 0x8c78, 0x8fc9, 0x8fbf, 0x909f, 0x90a1, 0x90a5, 0x909e, 0x90a7, 0x90a0, 0x9630, 0x9628, 0x962f, 0x962d, 0x4e33, 0x4f98, 0x4f7c, 0x4f85, 0x4f7d, 0x4f80, 0x4f87, 0x4f76, 0x4f74, 0x4f89, 0x4f84, 0x4f77, 0x4f4c, 0x4f97, 0x4f6a, 0x4f9a, 0x4f79, 0x4f81, 0x4f78, 0x4f90, 0x4f9c, 0x4f94, 0x4f9e, 0x4f92, 0x4f82, 0x4f95, 0x4f6b, 0x4f6e, 0x519e, 0x51bc, 0x51be, 0x5235, 0x5232, 0x5233, 0x5246, 0x5231, 0x52bc, 0x530a, 0x530b, 0x533c, 0x5392, 0x5394, 0x5487, 0x547f, 0x5481, 0x5491, 0x5482, 0x5488, 0x546b, 0x547a, 0x547e, 0x5465, 0x546c, 0x5474, 0x5466, 0x548d, 0x546f, 0x5461, 0x5460, 0x5498, 0x5463, 0x5467, 0x5464, 0x56f7, 0x56f9, 0x576f, 0x5772, 0x576d, 0x576b, 0x5771, 0x5770, 0x5776, 0x5780, 0x5775, 0x577b, 0x5773, 0x5774, 0x5762, /* 0xcc */ 0x5768, 0x577d, 0x590c, 0x5945, 0x59b5, 0x59ba, 0x59cf, 0x59ce, 0x59b2, 0x59cc, 0x59c1, 0x59b6, 0x59bc, 0x59c3, 0x59d6, 0x59b1, 0x59bd, 0x59c0, 0x59c8, 0x59b4, 0x59c7, 0x5b62, 0x5b65, 0x5b93, 0x5b95, 0x5c44, 0x5c47, 0x5cae, 0x5ca4, 0x5ca0, 0x5cb5, 0x5caf, 0x5ca8, 0x5cac, 0x5c9f, 0x5ca3, 0x5cad, 0x5ca2, 0x5caa, 0x5ca7, 0x5c9d, 0x5ca5, 0x5cb6, 0x5cb0, 0x5ca6, 0x5e17, 0x5e14, 0x5e19, 0x5f28, 0x5f22, 0x5f23, 0x5f24, 0x5f54, 0x5f82, 0x5f7e, 0x5f7d, 0x5fde, 0x5fe5, 0x602d, 0x6026, 0x6019, 0x6032, 0x600b, 0x6034, 0x600a, 0x6017, 0x6033, 0x601a, 0x601e, 0x602c, 0x6022, 0x600d, 0x6010, 0x602e, 0x6013, 0x6011, 0x600c, 0x6009, 0x601c, 0x6214, 0x623d, 0x62ad, 0x62b4, 0x62d1, 0x62be, 0x62aa, 0x62b6, 0x62ca, 0x62ae, 0x62b3, 0x62af, 0x62bb, 0x62a9, 0x62b0, 0x62b8, 0x653d, 0x65a8, 0x65bb, 0x6609, 0x65fc, 0x6604, 0x6612, 0x6608, 0x65fb, 0x6603, 0x660b, 0x660d, 0x6605, 0x65fd, 0x6611, 0x6610, 0x66f6, 0x670a, 0x6785, 0x676c, 0x678e, 0x6792, 0x6776, 0x677b, 0x6798, 0x6786, 0x6784, 0x6774, 0x678d, 0x678c, 0x677a, 0x679f, 0x6791, 0x6799, 0x6783, 0x677d, 0x6781, 0x6778, 0x6779, 0x6794, 0x6b25, 0x6b80, 0x6b7e, 0x6bde, 0x6c1d, 0x6c93, 0x6cec, 0x6ceb, 0x6cee, 0x6cd9, 0x6cb6, 0x6cd4, 0x6cad, 0x6ce7, 0x6cb7, 0x6cd0, 0x6cc2, 0x6cba, 0x6cc3, 0x6cc6, 0x6ced, 0x6cf2, /* 0xcd */ 0x6cd2, 0x6cdd, 0x6cb4, 0x6c8a, 0x6c9d, 0x6c80, 0x6cde, 0x6cc0, 0x6d30, 0x6ccd, 0x6cc7, 0x6cb0, 0x6cf9, 0x6ccf, 0x6ce9, 0x6cd1, 0x7094, 0x7098, 0x7085, 0x7093, 0x7086, 0x7084, 0x7091, 0x7096, 0x7082, 0x709a, 0x7083, 0x726a, 0x72d6, 0x72cb, 0x72d8, 0x72c9, 0x72dc, 0x72d2, 0x72d4, 0x72da, 0x72cc, 0x72d1, 0x73a4, 0x73a1, 0x73ad, 0x73a6, 0x73a2, 0x73a0, 0x73ac, 0x739d, 0x74dd, 0x74e8, 0x753f, 0x7540, 0x753e, 0x758c, 0x7598, 0x76af, 0x76f3, 0x76f1, 0x76f0, 0x76f5, 0x77f8, 0x77fc, 0x77f9, 0x77fb, 0x77fa, 0x77f7, 0x7942, 0x793f, 0x79c5, 0x7a78, 0x7a7b, 0x7afb, 0x7c75, 0x7cfd, 0x8035, 0x808f, 0x80ae, 0x80a3, 0x80b8, 0x80b5, 0x80ad, 0x8220, 0x82a0, 0x82c0, 0x82ab, 0x829a, 0x8298, 0x829b, 0x82b5, 0x82a7, 0x82ae, 0x82bc, 0x829e, 0x82ba, 0x82b4, 0x82a8, 0x82a1, 0x82a9, 0x82c2, 0x82a4, 0x82c3, 0x82b6, 0x82a2, 0x8670, 0x866f, 0x866d, 0x866e, 0x8c56, 0x8fd2, 0x8fcb, 0x8fd3, 0x8fcd, 0x8fd6, 0x8fd5, 0x8fd7, 0x90b2, 0x90b4, 0x90af, 0x90b3, 0x90b0, 0x9639, 0x963d, 0x963c, 0x963a, 0x9643, 0x4fcd, 0x4fc5, 0x4fd3, 0x4fb2, 0x4fc9, 0x4fcb, 0x4fc1, 0x4fd4, 0x4fdc, 0x4fd9, 0x4fbb, 0x4fb3, 0x4fdb, 0x4fc7, 0x4fd6, 0x4fba, 0x4fc0, 0x4fb9, 0x4fec, 0x5244, 0x5249, 0x52c0, 0x52c2, 0x533d, 0x537c, 0x5397, 0x5396, 0x5399, 0x5398, 0x54ba, 0x54a1, 0x54ad, 0x54a5, 0x54cf, /* 0xce */ 0x54c3, 0x830d, 0x54b7, 0x54ae, 0x54d6, 0x54b6, 0x54c5, 0x54c6, 0x54a0, 0x5470, 0x54bc, 0x54a2, 0x54be, 0x5472, 0x54de, 0x54b0, 0x57b5, 0x579e, 0x579f, 0x57a4, 0x578c, 0x5797, 0x579d, 0x579b, 0x5794, 0x5798, 0x578f, 0x5799, 0x57a5, 0x579a, 0x5795, 0x58f4, 0x590d, 0x5953, 0x59e1, 0x59de, 0x59ee, 0x5a00, 0x59f1, 0x59dd, 0x59fa, 0x59fd, 0x59fc, 0x59f6, 0x59e4, 0x59f2, 0x59f7, 0x59db, 0x59e9, 0x59f3, 0x59f5, 0x59e0, 0x59fe, 0x59f4, 0x59ed, 0x5ba8, 0x5c4c, 0x5cd0, 0x5cd8, 0x5ccc, 0x5cd7, 0x5ccb, 0x5cdb, 0x5cde, 0x5cda, 0x5cc9, 0x5cc7, 0x5cca, 0x5cd6, 0x5cd3, 0x5cd4, 0x5ccf, 0x5cc8, 0x5cc6, 0x5cce, 0x5cdf, 0x5cf8, 0x5df9, 0x5e21, 0x5e22, 0x5e23, 0x5e20, 0x5e24, 0x5eb0, 0x5ea4, 0x5ea2, 0x5e9b, 0x5ea3, 0x5ea5, 0x5f07, 0x5f2e, 0x5f56, 0x5f86, 0x6037, 0x6039, 0x6054, 0x6072, 0x605e, 0x6045, 0x6053, 0x6047, 0x6049, 0x605b, 0x604c, 0x6040, 0x6042, 0x605f, 0x6024, 0x6044, 0x6058, 0x6066, 0x606e, 0x6242, 0x6243, 0x62cf, 0x630d, 0x630b, 0x62f5, 0x630e, 0x6303, 0x62eb, 0x62f9, 0x630f, 0x630c, 0x62f8, 0x62f6, 0x6300, 0x6313, 0x6314, 0x62fa, 0x6315, 0x62fb, 0x62f0, 0x6541, 0x6543, 0x65aa, 0x65bf, 0x6636, 0x6621, 0x6632, 0x6635, 0x661c, 0x6626, 0x6622, 0x6633, 0x662b, 0x663a, 0x661d, 0x6634, 0x6639, 0x662e, 0x670f, 0x6710, 0x67c1, 0x67f2, 0x67c8, 0x67ba, /* 0xcf */ 0x67dc, 0x67bb, 0x67f8, 0x67d8, 0x67c0, 0x67b7, 0x67c5, 0x67eb, 0x67e4, 0x67df, 0x67b5, 0x67cd, 0x67b3, 0x67f7, 0x67f6, 0x67ee, 0x67e3, 0x67c2, 0x67b9, 0x67ce, 0x67e7, 0x67f0, 0x67b2, 0x67fc, 0x67c6, 0x67ed, 0x67cc, 0x67ae, 0x67e6, 0x67db, 0x67fa, 0x67c9, 0x67ca, 0x67c3, 0x67ea, 0x67cb, 0x6b28, 0x6b82, 0x6b84, 0x6bb6, 0x6bd6, 0x6bd8, 0x6be0, 0x6c20, 0x6c21, 0x6d28, 0x6d34, 0x6d2d, 0x6d1f, 0x6d3c, 0x6d3f, 0x6d12, 0x6d0a, 0x6cda, 0x6d33, 0x6d04, 0x6d19, 0x6d3a, 0x6d1a, 0x6d11, 0x6d00, 0x6d1d, 0x6d42, 0x6d01, 0x6d18, 0x6d37, 0x6d03, 0x6d0f, 0x6d40, 0x6d07, 0x6d20, 0x6d2c, 0x6d08, 0x6d22, 0x6d09, 0x6d10, 0x70b7, 0x709f, 0x70be, 0x70b1, 0x70b0, 0x70a1, 0x70b4, 0x70b5, 0x70a9, 0x7241, 0x7249, 0x724a, 0x726c, 0x7270, 0x7273, 0x726e, 0x72ca, 0x72e4, 0x72e8, 0x72eb, 0x72df, 0x72ea, 0x72e6, 0x72e3, 0x7385, 0x73cc, 0x73c2, 0x73c8, 0x73c5, 0x73b9, 0x73b6, 0x73b5, 0x73b4, 0x73eb, 0x73bf, 0x73c7, 0x73be, 0x73c3, 0x73c6, 0x73b8, 0x73cb, 0x74ec, 0x74ee, 0x752e, 0x7547, 0x7548, 0x75a7, 0x75aa, 0x7679, 0x76c4, 0x7708, 0x7703, 0x7704, 0x7705, 0x770a, 0x76f7, 0x76fb, 0x76fa, 0x77e7, 0x77e8, 0x7806, 0x7811, 0x7812, 0x7805, 0x7810, 0x780f, 0x780e, 0x7809, 0x7803, 0x7813, 0x794a, 0x794c, 0x794b, 0x7945, 0x7944, 0x79d5, 0x79cd, 0x79cf, 0x79d6, 0x79ce, 0x7a80, /* 0xd0 */ 0x7a7e, 0x7ad1, 0x7b00, 0x7b01, 0x7c7a, 0x7c78, 0x7c79, 0x7c7f, 0x7c80, 0x7c81, 0x7d03, 0x7d08, 0x7d01, 0x7f58, 0x7f91, 0x7f8d, 0x7fbe, 0x8007, 0x800e, 0x800f, 0x8014, 0x8037, 0x80d8, 0x80c7, 0x80e0, 0x80d1, 0x80c8, 0x80c2, 0x80d0, 0x80c5, 0x80e3, 0x80d9, 0x80dc, 0x80ca, 0x80d5, 0x80c9, 0x80cf, 0x80d7, 0x80e6, 0x80cd, 0x81ff, 0x8221, 0x8294, 0x82d9, 0x82fe, 0x82f9, 0x8307, 0x82e8, 0x8300, 0x82d5, 0x833a, 0x82eb, 0x82d6, 0x82f4, 0x82ec, 0x82e1, 0x82f2, 0x82f5, 0x830c, 0x82fb, 0x82f6, 0x82f0, 0x82ea, 0x82e4, 0x82e0, 0x82fa, 0x82f3, 0x82ed, 0x8677, 0x8674, 0x867c, 0x8673, 0x8841, 0x884e, 0x8867, 0x886a, 0x8869, 0x89d3, 0x8a04, 0x8a07, 0x8d72, 0x8fe3, 0x8fe1, 0x8fee, 0x8fe0, 0x90f1, 0x90bd, 0x90bf, 0x90d5, 0x90c5, 0x90be, 0x90c7, 0x90cb, 0x90c8, 0x91d4, 0x91d3, 0x9654, 0x964f, 0x9651, 0x9653, 0x964a, 0x964e, 0x501e, 0x5005, 0x5007, 0x5013, 0x5022, 0x5030, 0x501b, 0x4ff5, 0x4ff4, 0x5033, 0x5037, 0x502c, 0x4ff6, 0x4ff7, 0x5017, 0x501c, 0x5020, 0x5027, 0x5035, 0x502f, 0x5031, 0x500e, 0x515a, 0x5194, 0x5193, 0x51ca, 0x51c4, 0x51c5, 0x51c8, 0x51ce, 0x5261, 0x525a, 0x5252, 0x525e, 0x525f, 0x5255, 0x5262, 0x52cd, 0x530e, 0x539e, 0x5526, 0x54e2, 0x5517, 0x5512, 0x54e7, 0x54f3, 0x54e4, 0x551a, 0x54ff, 0x5504, 0x5508, 0x54eb, 0x5511, 0x5505, 0x54f1, /* 0xd1 */ 0x550a, 0x54fb, 0x54f7, 0x54f8, 0x54e0, 0x550e, 0x5503, 0x550b, 0x5701, 0x5702, 0x57cc, 0x5832, 0x57d5, 0x57d2, 0x57ba, 0x57c6, 0x57bd, 0x57bc, 0x57b8, 0x57b6, 0x57bf, 0x57c7, 0x57d0, 0x57b9, 0x57c1, 0x590e, 0x594a, 0x5a19, 0x5a16, 0x5a2d, 0x5a2e, 0x5a15, 0x5a0f, 0x5a17, 0x5a0a, 0x5a1e, 0x5a33, 0x5b6c, 0x5ba7, 0x5bad, 0x5bac, 0x5c03, 0x5c56, 0x5c54, 0x5cec, 0x5cff, 0x5cee, 0x5cf1, 0x5cf7, 0x5d00, 0x5cf9, 0x5e29, 0x5e28, 0x5ea8, 0x5eae, 0x5eaa, 0x5eac, 0x5f33, 0x5f30, 0x5f67, 0x605d, 0x605a, 0x6067, 0x6041, 0x60a2, 0x6088, 0x6080, 0x6092, 0x6081, 0x609d, 0x6083, 0x6095, 0x609b, 0x6097, 0x6087, 0x609c, 0x608e, 0x6219, 0x6246, 0x62f2, 0x6310, 0x6356, 0x632c, 0x6344, 0x6345, 0x6336, 0x6343, 0x63e4, 0x6339, 0x634b, 0x634a, 0x633c, 0x6329, 0x6341, 0x6334, 0x6358, 0x6354, 0x6359, 0x632d, 0x6347, 0x6333, 0x635a, 0x6351, 0x6338, 0x6357, 0x6340, 0x6348, 0x654a, 0x6546, 0x65c6, 0x65c3, 0x65c4, 0x65c2, 0x664a, 0x665f, 0x6647, 0x6651, 0x6712, 0x6713, 0x681f, 0x681a, 0x6849, 0x6832, 0x6833, 0x683b, 0x684b, 0x684f, 0x6816, 0x6831, 0x681c, 0x6835, 0x682b, 0x682d, 0x682f, 0x684e, 0x6844, 0x6834, 0x681d, 0x6812, 0x6814, 0x6826, 0x6828, 0x682e, 0x684d, 0x683a, 0x6825, 0x6820, 0x6b2c, 0x6b2f, 0x6b2d, 0x6b31, 0x6b34, 0x6b6d, 0x8082, 0x6b88, 0x6be6, 0x6be4, /* 0xd2 */ 0x6be8, 0x6be3, 0x6be2, 0x6be7, 0x6c25, 0x6d7a, 0x6d63, 0x6d64, 0x6d76, 0x6d0d, 0x6d61, 0x6d92, 0x6d58, 0x6d62, 0x6d6d, 0x6d6f, 0x6d91, 0x6d8d, 0x6def, 0x6d7f, 0x6d86, 0x6d5e, 0x6d67, 0x6d60, 0x6d97, 0x6d70, 0x6d7c, 0x6d5f, 0x6d82, 0x6d98, 0x6d2f, 0x6d68, 0x6d8b, 0x6d7e, 0x6d80, 0x6d84, 0x6d16, 0x6d83, 0x6d7b, 0x6d7d, 0x6d75, 0x6d90, 0x70dc, 0x70d3, 0x70d1, 0x70dd, 0x70cb, 0x7f39, 0x70e2, 0x70d7, 0x70d2, 0x70de, 0x70e0, 0x70d4, 0x70cd, 0x70c5, 0x70c6, 0x70c7, 0x70da, 0x70ce, 0x70e1, 0x7242, 0x7278, 0x7277, 0x7276, 0x7300, 0x72fa, 0x72f4, 0x72fe, 0x72f6, 0x72f3, 0x72fb, 0x7301, 0x73d3, 0x73d9, 0x73e5, 0x73d6, 0x73bc, 0x73e7, 0x73e3, 0x73e9, 0x73dc, 0x73d2, 0x73db, 0x73d4, 0x73dd, 0x73da, 0x73d7, 0x73d8, 0x73e8, 0x74de, 0x74df, 0x74f4, 0x74f5, 0x7521, 0x755b, 0x755f, 0x75b0, 0x75c1, 0x75bb, 0x75c4, 0x75c0, 0x75bf, 0x75b6, 0x75ba, 0x768a, 0x76c9, 0x771d, 0x771b, 0x7710, 0x7713, 0x7712, 0x7723, 0x7711, 0x7715, 0x7719, 0x771a, 0x7722, 0x7727, 0x7823, 0x782c, 0x7822, 0x7835, 0x782f, 0x7828, 0x782e, 0x782b, 0x7821, 0x7829, 0x7833, 0x782a, 0x7831, 0x7954, 0x795b, 0x794f, 0x795c, 0x7953, 0x7952, 0x7951, 0x79eb, 0x79ec, 0x79e0, 0x79ee, 0x79ed, 0x79ea, 0x79dc, 0x79de, 0x79dd, 0x7a86, 0x7a89, 0x7a85, 0x7a8b, 0x7a8c, 0x7a8a, 0x7a87, 0x7ad8, 0x7b10, /* 0xd3 */ 0x7b04, 0x7b13, 0x7b05, 0x7b0f, 0x7b08, 0x7b0a, 0x7b0e, 0x7b09, 0x7b12, 0x7c84, 0x7c91, 0x7c8a, 0x7c8c, 0x7c88, 0x7c8d, 0x7c85, 0x7d1e, 0x7d1d, 0x7d11, 0x7d0e, 0x7d18, 0x7d16, 0x7d13, 0x7d1f, 0x7d12, 0x7d0f, 0x7d0c, 0x7f5c, 0x7f61, 0x7f5e, 0x7f60, 0x7f5d, 0x7f5b, 0x7f96, 0x7f92, 0x7fc3, 0x7fc2, 0x7fc0, 0x8016, 0x803e, 0x8039, 0x80fa, 0x80f2, 0x80f9, 0x80f5, 0x8101, 0x80fb, 0x8100, 0x8201, 0x822f, 0x8225, 0x8333, 0x832d, 0x8344, 0x8319, 0x8351, 0x8325, 0x8356, 0x833f, 0x8341, 0x8326, 0x831c, 0x8322, 0x8342, 0x834e, 0x831b, 0x832a, 0x8308, 0x833c, 0x834d, 0x8316, 0x8324, 0x8320, 0x8337, 0x832f, 0x8329, 0x8347, 0x8345, 0x834c, 0x8353, 0x831e, 0x832c, 0x834b, 0x8327, 0x8348, 0x8653, 0x8652, 0x86a2, 0x86a8, 0x8696, 0x868d, 0x8691, 0x869e, 0x8687, 0x8697, 0x8686, 0x868b, 0x869a, 0x8685, 0x86a5, 0x8699, 0x86a1, 0x86a7, 0x8695, 0x8698, 0x868e, 0x869d, 0x8690, 0x8694, 0x8843, 0x8844, 0x886d, 0x8875, 0x8876, 0x8872, 0x8880, 0x8871, 0x887f, 0x886f, 0x8883, 0x887e, 0x8874, 0x887c, 0x8a12, 0x8c47, 0x8c57, 0x8c7b, 0x8ca4, 0x8ca3, 0x8d76, 0x8d78, 0x8db5, 0x8db7, 0x8db6, 0x8ed1, 0x8ed3, 0x8ffe, 0x8ff5, 0x9002, 0x8fff, 0x8ffb, 0x9004, 0x8ffc, 0x8ff6, 0x90d6, 0x90e0, 0x90d9, 0x90da, 0x90e3, 0x90df, 0x90e5, 0x90d8, 0x90db, 0x90d7, 0x90dc, 0x90e4, 0x9150, /* 0xd4 */ 0x914e, 0x914f, 0x91d5, 0x91e2, 0x91da, 0x965c, 0x965f, 0x96bc, 0x98e3, 0x9adf, 0x9b2f, 0x4e7f, 0x5070, 0x506a, 0x5061, 0x505e, 0x5060, 0x5053, 0x504b, 0x505d, 0x5072, 0x5048, 0x504d, 0x5041, 0x505b, 0x504a, 0x5062, 0x5015, 0x5045, 0x505f, 0x5069, 0x506b, 0x5063, 0x5064, 0x5046, 0x5040, 0x506e, 0x5073, 0x5057, 0x5051, 0x51d0, 0x526b, 0x526d, 0x526c, 0x526e, 0x52d6, 0x52d3, 0x532d, 0x539c, 0x5575, 0x5576, 0x553c, 0x554d, 0x5550, 0x5534, 0x552a, 0x5551, 0x5562, 0x5536, 0x5535, 0x5530, 0x5552, 0x5545, 0x550c, 0x5532, 0x5565, 0x554e, 0x5539, 0x5548, 0x552d, 0x553b, 0x5540, 0x554b, 0x570a, 0x5707, 0x57fb, 0x5814, 0x57e2, 0x57f6, 0x57dc, 0x57f4, 0x5800, 0x57ed, 0x57fd, 0x5808, 0x57f8, 0x580b, 0x57f3, 0x57cf, 0x5807, 0x57ee, 0x57e3, 0x57f2, 0x57e5, 0x57ec, 0x57e1, 0x580e, 0x57fc, 0x5810, 0x57e7, 0x5801, 0x580c, 0x57f1, 0x57e9, 0x57f0, 0x580d, 0x5804, 0x595c, 0x5a60, 0x5a58, 0x5a55, 0x5a67, 0x5a5e, 0x5a38, 0x5a35, 0x5a6d, 0x5a50, 0x5a5f, 0x5a65, 0x5a6c, 0x5a53, 0x5a64, 0x5a57, 0x5a43, 0x5a5d, 0x5a52, 0x5a44, 0x5a5b, 0x5a48, 0x5a8e, 0x5a3e, 0x5a4d, 0x5a39, 0x5a4c, 0x5a70, 0x5a69, 0x5a47, 0x5a51, 0x5a56, 0x5a42, 0x5a5c, 0x5b72, 0x5b6e, 0x5bc1, 0x5bc0, 0x5c59, 0x5d1e, 0x5d0b, 0x5d1d, 0x5d1a, 0x5d20, 0x5d0c, 0x5d28, 0x5d0d, 0x5d26, 0x5d25, 0x5d0f, /* 0xd5 */ 0x5d30, 0x5d12, 0x5d23, 0x5d1f, 0x5d2e, 0x5e3e, 0x5e34, 0x5eb1, 0x5eb4, 0x5eb9, 0x5eb2, 0x5eb3, 0x5f36, 0x5f38, 0x5f9b, 0x5f96, 0x5f9f, 0x608a, 0x6090, 0x6086, 0x60be, 0x60b0, 0x60ba, 0x60d3, 0x60d4, 0x60cf, 0x60e4, 0x60d9, 0x60dd, 0x60c8, 0x60b1, 0x60db, 0x60b7, 0x60ca, 0x60bf, 0x60c3, 0x60cd, 0x60c0, 0x6332, 0x6365, 0x638a, 0x6382, 0x637d, 0x63bd, 0x639e, 0x63ad, 0x639d, 0x6397, 0x63ab, 0x638e, 0x636f, 0x6387, 0x6390, 0x636e, 0x63af, 0x6375, 0x639c, 0x636d, 0x63ae, 0x637c, 0x63a4, 0x633b, 0x639f, 0x6378, 0x6385, 0x6381, 0x6391, 0x638d, 0x6370, 0x6553, 0x65cd, 0x6665, 0x6661, 0x665b, 0x6659, 0x665c, 0x6662, 0x6718, 0x6879, 0x6887, 0x6890, 0x689c, 0x686d, 0x686e, 0x68ae, 0x68ab, 0x6956, 0x686f, 0x68a3, 0x68ac, 0x68a9, 0x6875, 0x6874, 0x68b2, 0x688f, 0x6877, 0x6892, 0x687c, 0x686b, 0x6872, 0x68aa, 0x6880, 0x6871, 0x687e, 0x689b, 0x6896, 0x688b, 0x68a0, 0x6889, 0x68a4, 0x6878, 0x687b, 0x6891, 0x688c, 0x688a, 0x687d, 0x6b36, 0x6b33, 0x6b37, 0x6b38, 0x6b91, 0x6b8f, 0x6b8d, 0x6b8e, 0x6b8c, 0x6c2a, 0x6dc0, 0x6dab, 0x6db4, 0x6db3, 0x6e74, 0x6dac, 0x6de9, 0x6de2, 0x6db7, 0x6df6, 0x6dd4, 0x6e00, 0x6dc8, 0x6de0, 0x6ddf, 0x6dd6, 0x6dbe, 0x6de5, 0x6ddc, 0x6ddd, 0x6ddb, 0x6df4, 0x6dca, 0x6dbd, 0x6ded, 0x6df0, 0x6dba, 0x6dd5, 0x6dc2, 0x6dcf, 0x6dc9, /* 0xd6 */ 0x6dd0, 0x6df2, 0x6dd3, 0x6dfd, 0x6dd7, 0x6dcd, 0x6de3, 0x6dbb, 0x70fa, 0x710d, 0x70f7, 0x7117, 0x70f4, 0x710c, 0x70f0, 0x7104, 0x70f3, 0x7110, 0x70fc, 0x70ff, 0x7106, 0x7113, 0x7100, 0x70f8, 0x70f6, 0x710b, 0x7102, 0x710e, 0x727e, 0x727b, 0x727c, 0x727f, 0x731d, 0x7317, 0x7307, 0x7311, 0x7318, 0x730a, 0x7308, 0x72ff, 0x730f, 0x731e, 0x7388, 0x73f6, 0x73f8, 0x73f5, 0x7404, 0x7401, 0x73fd, 0x7407, 0x7400, 0x73fa, 0x73fc, 0x73ff, 0x740c, 0x740b, 0x73f4, 0x7408, 0x7564, 0x7563, 0x75ce, 0x75d2, 0x75cf, 0x75cb, 0x75cc, 0x75d1, 0x75d0, 0x768f, 0x7689, 0x76d3, 0x7739, 0x772f, 0x772d, 0x7731, 0x7732, 0x7734, 0x7733, 0x773d, 0x7725, 0x773b, 0x7735, 0x7848, 0x7852, 0x7849, 0x784d, 0x784a, 0x784c, 0x7826, 0x7845, 0x7850, 0x7964, 0x7967, 0x7969, 0x796a, 0x7963, 0x796b, 0x7961, 0x79bb, 0x79fa, 0x79f8, 0x79f6, 0x79f7, 0x7a8f, 0x7a94, 0x7a90, 0x7b35, 0x7b47, 0x7b34, 0x7b25, 0x7b30, 0x7b22, 0x7b24, 0x7b33, 0x7b18, 0x7b2a, 0x7b1d, 0x7b31, 0x7b2b, 0x7b2d, 0x7b2f, 0x7b32, 0x7b38, 0x7b1a, 0x7b23, 0x7c94, 0x7c98, 0x7c96, 0x7ca3, 0x7d35, 0x7d3d, 0x7d38, 0x7d36, 0x7d3a, 0x7d45, 0x7d2c, 0x7d29, 0x7d41, 0x7d47, 0x7d3e, 0x7d3f, 0x7d4a, 0x7d3b, 0x7d28, 0x7f63, 0x7f95, 0x7f9c, 0x7f9d, 0x7f9b, 0x7fca, 0x7fcb, 0x7fcd, 0x7fd0, 0x7fd1, 0x7fc7, 0x7fcf, 0x7fc9, 0x801f, /* 0xd7 */ 0x801e, 0x801b, 0x8047, 0x8043, 0x8048, 0x8118, 0x8125, 0x8119, 0x811b, 0x812d, 0x811f, 0x812c, 0x811e, 0x8121, 0x8115, 0x8127, 0x811d, 0x8122, 0x8211, 0x8238, 0x8233, 0x823a, 0x8234, 0x8232, 0x8274, 0x8390, 0x83a3, 0x83a8, 0x838d, 0x837a, 0x8373, 0x83a4, 0x8374, 0x838f, 0x8381, 0x8395, 0x8399, 0x8375, 0x8394, 0x83a9, 0x837d, 0x8383, 0x838c, 0x839d, 0x839b, 0x83aa, 0x838b, 0x837e, 0x83a5, 0x83af, 0x8388, 0x8397, 0x83b0, 0x837f, 0x83a6, 0x8387, 0x83ae, 0x8376, 0x839a, 0x8659, 0x8656, 0x86bf, 0x86b7, 0x86c2, 0x86c1, 0x86c5, 0x86ba, 0x86b0, 0x86c8, 0x86b9, 0x86b3, 0x86b8, 0x86cc, 0x86b4, 0x86bb, 0x86bc, 0x86c3, 0x86bd, 0x86be, 0x8852, 0x8889, 0x8895, 0x88a8, 0x88a2, 0x88aa, 0x889a, 0x8891, 0x88a1, 0x889f, 0x8898, 0x88a7, 0x8899, 0x889b, 0x8897, 0x88a4, 0x88ac, 0x888c, 0x8893, 0x888e, 0x8982, 0x89d6, 0x89d9, 0x89d5, 0x8a30, 0x8a27, 0x8a2c, 0x8a1e, 0x8c39, 0x8c3b, 0x8c5c, 0x8c5d, 0x8c7d, 0x8ca5, 0x8d7d, 0x8d7b, 0x8d79, 0x8dbc, 0x8dc2, 0x8db9, 0x8dbf, 0x8dc1, 0x8ed8, 0x8ede, 0x8edd, 0x8edc, 0x8ed7, 0x8ee0, 0x8ee1, 0x9024, 0x900b, 0x9011, 0x901c, 0x900c, 0x9021, 0x90ef, 0x90ea, 0x90f0, 0x90f4, 0x90f2, 0x90f3, 0x90d4, 0x90eb, 0x90ec, 0x90e9, 0x9156, 0x9158, 0x915a, 0x9153, 0x9155, 0x91ec, 0x91f4, 0x91f1, 0x91f3, 0x91f8, 0x91e4, 0x91f9, 0x91ea, /* 0xd8 */ 0x91eb, 0x91f7, 0x91e8, 0x91ee, 0x957a, 0x9586, 0x9588, 0x967c, 0x966d, 0x966b, 0x9671, 0x966f, 0x96bf, 0x976a, 0x9804, 0x98e5, 0x9997, 0x509b, 0x5095, 0x5094, 0x509e, 0x508b, 0x50a3, 0x5083, 0x508c, 0x508e, 0x509d, 0x5068, 0x509c, 0x5092, 0x5082, 0x5087, 0x515f, 0x51d4, 0x5312, 0x5311, 0x53a4, 0x53a7, 0x5591, 0x55a8, 0x55a5, 0x55ad, 0x5577, 0x5645, 0x55a2, 0x5593, 0x5588, 0x558f, 0x55b5, 0x5581, 0x55a3, 0x5592, 0x55a4, 0x557d, 0x558c, 0x55a6, 0x557f, 0x5595, 0x55a1, 0x558e, 0x570c, 0x5829, 0x5837, 0x5819, 0x581e, 0x5827, 0x5823, 0x5828, 0x57f5, 0x5848, 0x5825, 0x581c, 0x581b, 0x5833, 0x583f, 0x5836, 0x582e, 0x5839, 0x5838, 0x582d, 0x582c, 0x583b, 0x5961, 0x5aaf, 0x5a94, 0x5a9f, 0x5a7a, 0x5aa2, 0x5a9e, 0x5a78, 0x5aa6, 0x5a7c, 0x5aa5, 0x5aac, 0x5a95, 0x5aae, 0x5a37, 0x5a84, 0x5a8a, 0x5a97, 0x5a83, 0x5a8b, 0x5aa9, 0x5a7b, 0x5a7d, 0x5a8c, 0x5a9c, 0x5a8f, 0x5a93, 0x5a9d, 0x5bea, 0x5bcd, 0x5bcb, 0x5bd4, 0x5bd1, 0x5bca, 0x5bce, 0x5c0c, 0x5c30, 0x5d37, 0x5d43, 0x5d6b, 0x5d41, 0x5d4b, 0x5d3f, 0x5d35, 0x5d51, 0x5d4e, 0x5d55, 0x5d33, 0x5d3a, 0x5d52, 0x5d3d, 0x5d31, 0x5d59, 0x5d42, 0x5d39, 0x5d49, 0x5d38, 0x5d3c, 0x5d32, 0x5d36, 0x5d40, 0x5d45, 0x5e44, 0x5e41, 0x5f58, 0x5fa6, 0x5fa5, 0x5fab, 0x60c9, 0x60b9, 0x60cc, 0x60e2, 0x60ce, 0x60c4, 0x6114, /* 0xd9 */ 0x60f2, 0x610a, 0x6116, 0x6105, 0x60f5, 0x6113, 0x60f8, 0x60fc, 0x60fe, 0x60c1, 0x6103, 0x6118, 0x611d, 0x6110, 0x60ff, 0x6104, 0x610b, 0x624a, 0x6394, 0x63b1, 0x63b0, 0x63ce, 0x63e5, 0x63e8, 0x63ef, 0x63c3, 0x649d, 0x63f3, 0x63ca, 0x63e0, 0x63f6, 0x63d5, 0x63f2, 0x63f5, 0x6461, 0x63df, 0x63be, 0x63dd, 0x63dc, 0x63c4, 0x63d8, 0x63d3, 0x63c2, 0x63c7, 0x63cc, 0x63cb, 0x63c8, 0x63f0, 0x63d7, 0x63d9, 0x6532, 0x6567, 0x656a, 0x6564, 0x655c, 0x6568, 0x6565, 0x658c, 0x659d, 0x659e, 0x65ae, 0x65d0, 0x65d2, 0x667c, 0x666c, 0x667b, 0x6680, 0x6671, 0x6679, 0x666a, 0x6672, 0x6701, 0x690c, 0x68d3, 0x6904, 0x68dc, 0x692a, 0x68ec, 0x68ea, 0x68f1, 0x690f, 0x68d6, 0x68f7, 0x68eb, 0x68e4, 0x68f6, 0x6913, 0x6910, 0x68f3, 0x68e1, 0x6907, 0x68cc, 0x6908, 0x6970, 0x68b4, 0x6911, 0x68ef, 0x68c6, 0x6914, 0x68f8, 0x68d0, 0x68fd, 0x68fc, 0x68e8, 0x690b, 0x690a, 0x6917, 0x68ce, 0x68c8, 0x68dd, 0x68de, 0x68e6, 0x68f4, 0x68d1, 0x6906, 0x68d4, 0x68e9, 0x6915, 0x6925, 0x68c7, 0x6b39, 0x6b3b, 0x6b3f, 0x6b3c, 0x6b94, 0x6b97, 0x6b99, 0x6b95, 0x6bbd, 0x6bf0, 0x6bf2, 0x6bf3, 0x6c30, 0x6dfc, 0x6e46, 0x6e47, 0x6e1f, 0x6e49, 0x6e88, 0x6e3c, 0x6e3d, 0x6e45, 0x6e62, 0x6e2b, 0x6e3f, 0x6e41, 0x6e5d, 0x6e73, 0x6e1c, 0x6e33, 0x6e4b, 0x6e40, 0x6e51, 0x6e3b, 0x6e03, 0x6e2e, 0x6e5e, /* 0xda */ 0x6e68, 0x6e5c, 0x6e61, 0x6e31, 0x6e28, 0x6e60, 0x6e71, 0x6e6b, 0x6e39, 0x6e22, 0x6e30, 0x6e53, 0x6e65, 0x6e27, 0x6e78, 0x6e64, 0x6e77, 0x6e55, 0x6e79, 0x6e52, 0x6e66, 0x6e35, 0x6e36, 0x6e5a, 0x7120, 0x711e, 0x712f, 0x70fb, 0x712e, 0x7131, 0x7123, 0x7125, 0x7122, 0x7132, 0x711f, 0x7128, 0x713a, 0x711b, 0x724b, 0x725a, 0x7288, 0x7289, 0x7286, 0x7285, 0x728b, 0x7312, 0x730b, 0x7330, 0x7322, 0x7331, 0x7333, 0x7327, 0x7332, 0x732d, 0x7326, 0x7323, 0x7335, 0x730c, 0x742e, 0x742c, 0x7430, 0x742b, 0x7416, 0x741a, 0x7421, 0x742d, 0x7431, 0x7424, 0x7423, 0x741d, 0x7429, 0x7420, 0x7432, 0x74fb, 0x752f, 0x756f, 0x756c, 0x75e7, 0x75da, 0x75e1, 0x75e6, 0x75dd, 0x75df, 0x75e4, 0x75d7, 0x7695, 0x7692, 0x76da, 0x7746, 0x7747, 0x7744, 0x774d, 0x7745, 0x774a, 0x774e, 0x774b, 0x774c, 0x77de, 0x77ec, 0x7860, 0x7864, 0x7865, 0x785c, 0x786d, 0x7871, 0x786a, 0x786e, 0x7870, 0x7869, 0x7868, 0x785e, 0x7862, 0x7974, 0x7973, 0x7972, 0x7970, 0x7a02, 0x7a0a, 0x7a03, 0x7a0c, 0x7a04, 0x7a99, 0x7ae6, 0x7ae4, 0x7b4a, 0x7b3b, 0x7b44, 0x7b48, 0x7b4c, 0x7b4e, 0x7b40, 0x7b58, 0x7b45, 0x7ca2, 0x7c9e, 0x7ca8, 0x7ca1, 0x7d58, 0x7d6f, 0x7d63, 0x7d53, 0x7d56, 0x7d67, 0x7d6a, 0x7d4f, 0x7d6d, 0x7d5c, 0x7d6b, 0x7d52, 0x7d54, 0x7d69, 0x7d51, 0x7d5f, 0x7d4e, 0x7f3e, 0x7f3f, 0x7f65, /* 0xdb */ 0x7f66, 0x7fa2, 0x7fa0, 0x7fa1, 0x7fd7, 0x8051, 0x804f, 0x8050, 0x80fe, 0x80d4, 0x8143, 0x814a, 0x8152, 0x814f, 0x8147, 0x813d, 0x814d, 0x813a, 0x81e6, 0x81ee, 0x81f7, 0x81f8, 0x81f9, 0x8204, 0x823c, 0x823d, 0x823f, 0x8275, 0x833b, 0x83cf, 0x83f9, 0x8423, 0x83c0, 0x83e8, 0x8412, 0x83e7, 0x83e4, 0x83fc, 0x83f6, 0x8410, 0x83c6, 0x83c8, 0x83eb, 0x83e3, 0x83bf, 0x8401, 0x83dd, 0x83e5, 0x83d8, 0x83ff, 0x83e1, 0x83cb, 0x83ce, 0x83d6, 0x83f5, 0x83c9, 0x8409, 0x840f, 0x83de, 0x8411, 0x8406, 0x83c2, 0x83f3, 0x83d5, 0x83fa, 0x83c7, 0x83d1, 0x83ea, 0x8413, 0x83c3, 0x83ec, 0x83ee, 0x83c4, 0x83fb, 0x83d7, 0x83e2, 0x841b, 0x83db, 0x83fe, 0x86d8, 0x86e2, 0x86e6, 0x86d3, 0x86e3, 0x86da, 0x86ea, 0x86dd, 0x86eb, 0x86dc, 0x86ec, 0x86e9, 0x86d7, 0x86e8, 0x86d1, 0x8848, 0x8856, 0x8855, 0x88ba, 0x88d7, 0x88b9, 0x88b8, 0x88c0, 0x88be, 0x88b6, 0x88bc, 0x88b7, 0x88bd, 0x88b2, 0x8901, 0x88c9, 0x8995, 0x8998, 0x8997, 0x89dd, 0x89da, 0x89db, 0x8a4e, 0x8a4d, 0x8a39, 0x8a59, 0x8a40, 0x8a57, 0x8a58, 0x8a44, 0x8a45, 0x8a52, 0x8a48, 0x8a51, 0x8a4a, 0x8a4c, 0x8a4f, 0x8c5f, 0x8c81, 0x8c80, 0x8cba, 0x8cbe, 0x8cb0, 0x8cb9, 0x8cb5, 0x8d84, 0x8d80, 0x8d89, 0x8dd8, 0x8dd3, 0x8dcd, 0x8dc7, 0x8dd6, 0x8ddc, 0x8dcf, 0x8dd5, 0x8dd9, 0x8dc8, 0x8dd7, 0x8dc5, 0x8eef, 0x8ef7, 0x8efa, /* 0xdc */ 0x8ef9, 0x8ee6, 0x8eee, 0x8ee5, 0x8ef5, 0x8ee7, 0x8ee8, 0x8ef6, 0x8eeb, 0x8ef1, 0x8eec, 0x8ef4, 0x8ee9, 0x902d, 0x9034, 0x902f, 0x9106, 0x912c, 0x9104, 0x90ff, 0x90fc, 0x9108, 0x90f9, 0x90fb, 0x9101, 0x9100, 0x9107, 0x9105, 0x9103, 0x9161, 0x9164, 0x915f, 0x9162, 0x9160, 0x9201, 0x920a, 0x9225, 0x9203, 0x921a, 0x9226, 0x920f, 0x920c, 0x9200, 0x9212, 0x91ff, 0x91fd, 0x9206, 0x9204, 0x9227, 0x9202, 0x921c, 0x9224, 0x9219, 0x9217, 0x9205, 0x9216, 0x957b, 0x958d, 0x958c, 0x9590, 0x9687, 0x967e, 0x9688, 0x9689, 0x9683, 0x9680, 0x96c2, 0x96c8, 0x96c3, 0x96f1, 0x96f0, 0x976c, 0x9770, 0x976e, 0x9807, 0x98a9, 0x98eb, 0x9ce6, 0x9ef9, 0x4e83, 0x4e84, 0x4eb6, 0x50bd, 0x50bf, 0x50c6, 0x50ae, 0x50c4, 0x50ca, 0x50b4, 0x50c8, 0x50c2, 0x50b0, 0x50c1, 0x50ba, 0x50b1, 0x50cb, 0x50c9, 0x50b6, 0x50b8, 0x51d7, 0x527a, 0x5278, 0x527b, 0x527c, 0x55c3, 0x55db, 0x55cc, 0x55d0, 0x55cb, 0x55ca, 0x55dd, 0x55c0, 0x55d4, 0x55c4, 0x55e9, 0x55bf, 0x55d2, 0x558d, 0x55cf, 0x55d5, 0x55e2, 0x55d6, 0x55c8, 0x55f2, 0x55cd, 0x55d9, 0x55c2, 0x5714, 0x5853, 0x5868, 0x5864, 0x584f, 0x584d, 0x5849, 0x586f, 0x5855, 0x584e, 0x585d, 0x5859, 0x5865, 0x585b, 0x583d, 0x5863, 0x5871, 0x58fc, 0x5ac7, 0x5ac4, 0x5acb, 0x5aba, 0x5ab8, 0x5ab1, 0x5ab5, 0x5ab0, 0x5abf, 0x5ac8, 0x5abb, 0x5ac6, /* 0xdd */ 0x5ab7, 0x5ac0, 0x5aca, 0x5ab4, 0x5ab6, 0x5acd, 0x5ab9, 0x5a90, 0x5bd6, 0x5bd8, 0x5bd9, 0x5c1f, 0x5c33, 0x5d71, 0x5d63, 0x5d4a, 0x5d65, 0x5d72, 0x5d6c, 0x5d5e, 0x5d68, 0x5d67, 0x5d62, 0x5df0, 0x5e4f, 0x5e4e, 0x5e4a, 0x5e4d, 0x5e4b, 0x5ec5, 0x5ecc, 0x5ec6, 0x5ecb, 0x5ec7, 0x5f40, 0x5faf, 0x5fad, 0x60f7, 0x6149, 0x614a, 0x612b, 0x6145, 0x6136, 0x6132, 0x612e, 0x6146, 0x612f, 0x614f, 0x6129, 0x6140, 0x6220, 0x9168, 0x6223, 0x6225, 0x6224, 0x63c5, 0x63f1, 0x63eb, 0x6410, 0x6412, 0x6409, 0x6420, 0x6424, 0x6433, 0x6443, 0x641f, 0x6415, 0x6418, 0x6439, 0x6437, 0x6422, 0x6423, 0x640c, 0x6426, 0x6430, 0x6428, 0x6441, 0x6435, 0x642f, 0x640a, 0x641a, 0x6440, 0x6425, 0x6427, 0x640b, 0x63e7, 0x641b, 0x642e, 0x6421, 0x640e, 0x656f, 0x6592, 0x65d3, 0x6686, 0x668c, 0x6695, 0x6690, 0x668b, 0x668a, 0x6699, 0x6694, 0x6678, 0x6720, 0x6966, 0x695f, 0x6938, 0x694e, 0x6962, 0x6971, 0x693f, 0x6945, 0x696a, 0x6939, 0x6942, 0x6957, 0x6959, 0x697a, 0x6948, 0x6949, 0x6935, 0x696c, 0x6933, 0x693d, 0x6965, 0x68f0, 0x6978, 0x6934, 0x6969, 0x6940, 0x696f, 0x6944, 0x6976, 0x6958, 0x6941, 0x6974, 0x694c, 0x693b, 0x694b, 0x6937, 0x695c, 0x694f, 0x6951, 0x6932, 0x6952, 0x692f, 0x697b, 0x693c, 0x6b46, 0x6b45, 0x6b43, 0x6b42, 0x6b48, 0x6b41, 0x6b9b, 0xfa0d, 0x6bfb, 0x6bfc, /* 0xde */ 0x6bf9, 0x6bf7, 0x6bf8, 0x6e9b, 0x6ed6, 0x6ec8, 0x6e8f, 0x6ec0, 0x6e9f, 0x6e93, 0x6e94, 0x6ea0, 0x6eb1, 0x6eb9, 0x6ec6, 0x6ed2, 0x6ebd, 0x6ec1, 0x6e9e, 0x6ec9, 0x6eb7, 0x6eb0, 0x6ecd, 0x6ea6, 0x6ecf, 0x6eb2, 0x6ebe, 0x6ec3, 0x6edc, 0x6ed8, 0x6e99, 0x6e92, 0x6e8e, 0x6e8d, 0x6ea4, 0x6ea1, 0x6ebf, 0x6eb3, 0x6ed0, 0x6eca, 0x6e97, 0x6eae, 0x6ea3, 0x7147, 0x7154, 0x7152, 0x7163, 0x7160, 0x7141, 0x715d, 0x7162, 0x7172, 0x7178, 0x716a, 0x7161, 0x7142, 0x7158, 0x7143, 0x714b, 0x7170, 0x715f, 0x7150, 0x7153, 0x7144, 0x714d, 0x715a, 0x724f, 0x728d, 0x728c, 0x7291, 0x7290, 0x728e, 0x733c, 0x7342, 0x733b, 0x733a, 0x7340, 0x734a, 0x7349, 0x7444, 0x744a, 0x744b, 0x7452, 0x7451, 0x7457, 0x7440, 0x744f, 0x7450, 0x744e, 0x7442, 0x7446, 0x744d, 0x7454, 0x74e1, 0x74ff, 0x74fe, 0x74fd, 0x751d, 0x7579, 0x7577, 0x6983, 0x75ef, 0x760f, 0x7603, 0x75f7, 0x75fe, 0x75fc, 0x75f9, 0x75f8, 0x7610, 0x75fb, 0x75f6, 0x75ed, 0x75f5, 0x75fd, 0x7699, 0x76b5, 0x76dd, 0x7755, 0x775f, 0x7760, 0x7752, 0x7756, 0x775a, 0x7769, 0x7767, 0x7754, 0x7759, 0x776d, 0x77e0, 0x7887, 0x789a, 0x7894, 0x788f, 0x7884, 0x7895, 0x7885, 0x7886, 0x78a1, 0x7883, 0x7879, 0x7899, 0x7880, 0x7896, 0x787b, 0x797c, 0x7982, 0x797d, 0x7979, 0x7a11, 0x7a18, 0x7a19, 0x7a12, 0x7a17, 0x7a15, 0x7a22, 0x7a13, /* 0xdf */ 0x7a1b, 0x7a10, 0x7aa3, 0x7aa2, 0x7a9e, 0x7aeb, 0x7b66, 0x7b64, 0x7b6d, 0x7b74, 0x7b69, 0x7b72, 0x7b65, 0x7b73, 0x7b71, 0x7b70, 0x7b61, 0x7b78, 0x7b76, 0x7b63, 0x7cb2, 0x7cb4, 0x7caf, 0x7d88, 0x7d86, 0x7d80, 0x7d8d, 0x7d7f, 0x7d85, 0x7d7a, 0x7d8e, 0x7d7b, 0x7d83, 0x7d7c, 0x7d8c, 0x7d94, 0x7d84, 0x7d7d, 0x7d92, 0x7f6d, 0x7f6b, 0x7f67, 0x7f68, 0x7f6c, 0x7fa6, 0x7fa5, 0x7fa7, 0x7fdb, 0x7fdc, 0x8021, 0x8164, 0x8160, 0x8177, 0x815c, 0x8169, 0x815b, 0x8162, 0x8172, 0x6721, 0x815e, 0x8176, 0x8167, 0x816f, 0x8144, 0x8161, 0x821d, 0x8249, 0x8244, 0x8240, 0x8242, 0x8245, 0x84f1, 0x843f, 0x8456, 0x8476, 0x8479, 0x848f, 0x848d, 0x8465, 0x8451, 0x8440, 0x8486, 0x8467, 0x8430, 0x844d, 0x847d, 0x845a, 0x8459, 0x8474, 0x8473, 0x845d, 0x8507, 0x845e, 0x8437, 0x843a, 0x8434, 0x847a, 0x8443, 0x8478, 0x8432, 0x8445, 0x8429, 0x83d9, 0x844b, 0x842f, 0x8442, 0x842d, 0x845f, 0x8470, 0x8439, 0x844e, 0x844c, 0x8452, 0x846f, 0x84c5, 0x848e, 0x843b, 0x8447, 0x8436, 0x8433, 0x8468, 0x847e, 0x8444, 0x842b, 0x8460, 0x8454, 0x846e, 0x8450, 0x870b, 0x8704, 0x86f7, 0x870c, 0x86fa, 0x86d6, 0x86f5, 0x874d, 0x86f8, 0x870e, 0x8709, 0x8701, 0x86f6, 0x870d, 0x8705, 0x88d6, 0x88cb, 0x88cd, 0x88ce, 0x88de, 0x88db, 0x88da, 0x88cc, 0x88d0, 0x8985, 0x899b, 0x89df, 0x89e5, 0x89e4, /* 0xe0 */ 0x89e1, 0x89e0, 0x89e2, 0x89dc, 0x89e6, 0x8a76, 0x8a86, 0x8a7f, 0x8a61, 0x8a3f, 0x8a77, 0x8a82, 0x8a84, 0x8a75, 0x8a83, 0x8a81, 0x8a74, 0x8a7a, 0x8c3c, 0x8c4b, 0x8c4a, 0x8c65, 0x8c64, 0x8c66, 0x8c86, 0x8c84, 0x8c85, 0x8ccc, 0x8d68, 0x8d69, 0x8d91, 0x8d8c, 0x8d8e, 0x8d8f, 0x8d8d, 0x8d93, 0x8d94, 0x8d90, 0x8d92, 0x8df0, 0x8de0, 0x8dec, 0x8df1, 0x8dee, 0x8dd0, 0x8de9, 0x8de3, 0x8de2, 0x8de7, 0x8df2, 0x8deb, 0x8df4, 0x8f06, 0x8eff, 0x8f01, 0x8f00, 0x8f05, 0x8f07, 0x8f08, 0x8f02, 0x8f0b, 0x9052, 0x903f, 0x9044, 0x9049, 0x903d, 0x9110, 0x910d, 0x910f, 0x9111, 0x9116, 0x9114, 0x910b, 0x910e, 0x916e, 0x916f, 0x9248, 0x9252, 0x9230, 0x923a, 0x9266, 0x9233, 0x9265, 0x925e, 0x9283, 0x922e, 0x924a, 0x9246, 0x926d, 0x926c, 0x924f, 0x9260, 0x9267, 0x926f, 0x9236, 0x9261, 0x9270, 0x9231, 0x9254, 0x9263, 0x9250, 0x9272, 0x924e, 0x9253, 0x924c, 0x9256, 0x9232, 0x959f, 0x959c, 0x959e, 0x959b, 0x9692, 0x9693, 0x9691, 0x9697, 0x96ce, 0x96fa, 0x96fd, 0x96f8, 0x96f5, 0x9773, 0x9777, 0x9778, 0x9772, 0x980f, 0x980d, 0x980e, 0x98ac, 0x98f6, 0x98f9, 0x99af, 0x99b2, 0x99b0, 0x99b5, 0x9aad, 0x9aab, 0x9b5b, 0x9cea, 0x9ced, 0x9ce7, 0x9e80, 0x9efd, 0x50e6, 0x50d4, 0x50d7, 0x50e8, 0x50f3, 0x50db, 0x50ea, 0x50dd, 0x50e4, 0x50d3, 0x50ec, 0x50f0, 0x50ef, 0x50e3, 0x50e0, /* 0xe1 */ 0x51d8, 0x5280, 0x5281, 0x52e9, 0x52eb, 0x5330, 0x53ac, 0x5627, 0x5615, 0x560c, 0x5612, 0x55fc, 0x560f, 0x561c, 0x5601, 0x5613, 0x5602, 0x55fa, 0x561d, 0x5604, 0x55ff, 0x55f9, 0x5889, 0x587c, 0x5890, 0x5898, 0x5886, 0x5881, 0x587f, 0x5874, 0x588b, 0x587a, 0x5887, 0x5891, 0x588e, 0x5876, 0x5882, 0x5888, 0x587b, 0x5894, 0x588f, 0x58fe, 0x596b, 0x5adc, 0x5aee, 0x5ae5, 0x5ad5, 0x5aea, 0x5ada, 0x5aed, 0x5aeb, 0x5af3, 0x5ae2, 0x5ae0, 0x5adb, 0x5aec, 0x5ade, 0x5add, 0x5ad9, 0x5ae8, 0x5adf, 0x5b77, 0x5be0, 0x5be3, 0x5c63, 0x5d82, 0x5d80, 0x5d7d, 0x5d86, 0x5d7a, 0x5d81, 0x5d77, 0x5d8a, 0x5d89, 0x5d88, 0x5d7e, 0x5d7c, 0x5d8d, 0x5d79, 0x5d7f, 0x5e58, 0x5e59, 0x5e53, 0x5ed8, 0x5ed1, 0x5ed7, 0x5ece, 0x5edc, 0x5ed5, 0x5ed9, 0x5ed2, 0x5ed4, 0x5f44, 0x5f43, 0x5f6f, 0x5fb6, 0x612c, 0x6128, 0x6141, 0x615e, 0x6171, 0x6173, 0x6152, 0x6153, 0x6172, 0x616c, 0x6180, 0x6174, 0x6154, 0x617a, 0x615b, 0x6165, 0x613b, 0x616a, 0x6161, 0x6156, 0x6229, 0x6227, 0x622b, 0x642b, 0x644d, 0x645b, 0x645d, 0x6474, 0x6476, 0x6472, 0x6473, 0x647d, 0x6475, 0x6466, 0x64a6, 0x644e, 0x6482, 0x645e, 0x645c, 0x644b, 0x6453, 0x6460, 0x6450, 0x647f, 0x643f, 0x646c, 0x646b, 0x6459, 0x6465, 0x6477, 0x6573, 0x65a0, 0x66a1, 0x66a0, 0x669f, 0x6705, 0x6704, 0x6722, 0x69b1, 0x69b6, 0x69c9, /* 0xe2 */ 0x69a0, 0x69ce, 0x6996, 0x69b0, 0x69ac, 0x69bc, 0x6991, 0x6999, 0x698e, 0x69a7, 0x698d, 0x69a9, 0x69be, 0x69af, 0x69bf, 0x69c4, 0x69bd, 0x69a4, 0x69d4, 0x69b9, 0x69ca, 0x699a, 0x69cf, 0x69b3, 0x6993, 0x69aa, 0x69a1, 0x699e, 0x69d9, 0x6997, 0x6990, 0x69c2, 0x69b5, 0x69a5, 0x69c6, 0x6b4a, 0x6b4d, 0x6b4b, 0x6b9e, 0x6b9f, 0x6ba0, 0x6bc3, 0x6bc4, 0x6bfe, 0x6ece, 0x6ef5, 0x6ef1, 0x6f03, 0x6f25, 0x6ef8, 0x6f37, 0x6efb, 0x6f2e, 0x6f09, 0x6f4e, 0x6f19, 0x6f1a, 0x6f27, 0x6f18, 0x6f3b, 0x6f12, 0x6eed, 0x6f0a, 0x6f36, 0x6f73, 0x6ef9, 0x6eee, 0x6f2d, 0x6f40, 0x6f30, 0x6f3c, 0x6f35, 0x6eeb, 0x6f07, 0x6f0e, 0x6f43, 0x6f05, 0x6efd, 0x6ef6, 0x6f39, 0x6f1c, 0x6efc, 0x6f3a, 0x6f1f, 0x6f0d, 0x6f1e, 0x6f08, 0x6f21, 0x7187, 0x7190, 0x7189, 0x7180, 0x7185, 0x7182, 0x718f, 0x717b, 0x7186, 0x7181, 0x7197, 0x7244, 0x7253, 0x7297, 0x7295, 0x7293, 0x7343, 0x734d, 0x7351, 0x734c, 0x7462, 0x7473, 0x7471, 0x7475, 0x7472, 0x7467, 0x746e, 0x7500, 0x7502, 0x7503, 0x757d, 0x7590, 0x7616, 0x7608, 0x760c, 0x7615, 0x7611, 0x760a, 0x7614, 0x76b8, 0x7781, 0x777c, 0x7785, 0x7782, 0x776e, 0x7780, 0x776f, 0x777e, 0x7783, 0x78b2, 0x78aa, 0x78b4, 0x78ad, 0x78a8, 0x787e, 0x78ab, 0x789e, 0x78a5, 0x78a0, 0x78ac, 0x78a2, 0x78a4, 0x7998, 0x798a, 0x798b, 0x7996, 0x7995, 0x7994, 0x7993, /* 0xe3 */ 0x7997, 0x7988, 0x7992, 0x7990, 0x7a2b, 0x7a4a, 0x7a30, 0x7a2f, 0x7a28, 0x7a26, 0x7aa8, 0x7aab, 0x7aac, 0x7aee, 0x7b88, 0x7b9c, 0x7b8a, 0x7b91, 0x7b90, 0x7b96, 0x7b8d, 0x7b8c, 0x7b9b, 0x7b8e, 0x7b85, 0x7b98, 0x5284, 0x7b99, 0x7ba4, 0x7b82, 0x7cbb, 0x7cbf, 0x7cbc, 0x7cba, 0x7da7, 0x7db7, 0x7dc2, 0x7da3, 0x7daa, 0x7dc1, 0x7dc0, 0x7dc5, 0x7d9d, 0x7dce, 0x7dc4, 0x7dc6, 0x7dcb, 0x7dcc, 0x7daf, 0x7db9, 0x7d96, 0x7dbc, 0x7d9f, 0x7da6, 0x7dae, 0x7da9, 0x7da1, 0x7dc9, 0x7f73, 0x7fe2, 0x7fe3, 0x7fe5, 0x7fde, 0x8024, 0x805d, 0x805c, 0x8189, 0x8186, 0x8183, 0x8187, 0x818d, 0x818c, 0x818b, 0x8215, 0x8497, 0x84a4, 0x84a1, 0x849f, 0x84ba, 0x84ce, 0x84c2, 0x84ac, 0x84ae, 0x84ab, 0x84b9, 0x84b4, 0x84c1, 0x84cd, 0x84aa, 0x849a, 0x84b1, 0x84d0, 0x849d, 0x84a7, 0x84bb, 0x84a2, 0x8494, 0x84c7, 0x84cc, 0x849b, 0x84a9, 0x84af, 0x84a8, 0x84d6, 0x8498, 0x84b6, 0x84cf, 0x84a0, 0x84d7, 0x84d4, 0x84d2, 0x84db, 0x84b0, 0x8491, 0x8661, 0x8733, 0x8723, 0x8728, 0x876b, 0x8740, 0x872e, 0x871e, 0x8721, 0x8719, 0x871b, 0x8743, 0x872c, 0x8741, 0x873e, 0x8746, 0x8720, 0x8732, 0x872a, 0x872d, 0x873c, 0x8712, 0x873a, 0x8731, 0x8735, 0x8742, 0x8726, 0x8727, 0x8738, 0x8724, 0x871a, 0x8730, 0x8711, 0x88f7, 0x88e7, 0x88f1, 0x88f2, 0x88fa, 0x88fe, 0x88ee, 0x88fc, 0x88f6, 0x88fb, /* 0xe4 */ 0x88f0, 0x88ec, 0x88eb, 0x899d, 0x89a1, 0x899f, 0x899e, 0x89e9, 0x89eb, 0x89e8, 0x8aab, 0x8a99, 0x8a8b, 0x8a92, 0x8a8f, 0x8a96, 0x8c3d, 0x8c68, 0x8c69, 0x8cd5, 0x8ccf, 0x8cd7, 0x8d96, 0x8e09, 0x8e02, 0x8dff, 0x8e0d, 0x8dfd, 0x8e0a, 0x8e03, 0x8e07, 0x8e06, 0x8e05, 0x8dfe, 0x8e00, 0x8e04, 0x8f10, 0x8f11, 0x8f0e, 0x8f0d, 0x9123, 0x911c, 0x9120, 0x9122, 0x911f, 0x911d, 0x911a, 0x9124, 0x9121, 0x911b, 0x917a, 0x9172, 0x9179, 0x9173, 0x92a5, 0x92a4, 0x9276, 0x929b, 0x927a, 0x92a0, 0x9294, 0x92aa, 0x928d, 0x92a6, 0x929a, 0x92ab, 0x9279, 0x9297, 0x927f, 0x92a3, 0x92ee, 0x928e, 0x9282, 0x9295, 0x92a2, 0x927d, 0x9288, 0x92a1, 0x928a, 0x9286, 0x928c, 0x9299, 0x92a7, 0x927e, 0x9287, 0x92a9, 0x929d, 0x928b, 0x922d, 0x969e, 0x96a1, 0x96ff, 0x9758, 0x977d, 0x977a, 0x977e, 0x9783, 0x9780, 0x9782, 0x977b, 0x9784, 0x9781, 0x977f, 0x97ce, 0x97cd, 0x9816, 0x98ad, 0x98ae, 0x9902, 0x9900, 0x9907, 0x999d, 0x999c, 0x99c3, 0x99b9, 0x99bb, 0x99ba, 0x99c2, 0x99bd, 0x99c7, 0x9ab1, 0x9ae3, 0x9ae7, 0x9b3e, 0x9b3f, 0x9b60, 0x9b61, 0x9b5f, 0x9cf1, 0x9cf2, 0x9cf5, 0x9ea7, 0x50ff, 0x5103, 0x5130, 0x50f8, 0x5106, 0x5107, 0x50f6, 0x50fe, 0x510b, 0x510c, 0x50fd, 0x510a, 0x528b, 0x528c, 0x52f1, 0x52ef, 0x5648, 0x5642, 0x564c, 0x5635, 0x5641, 0x564a, 0x5649, 0x5646, 0x5658, /* 0xe5 */ 0x565a, 0x5640, 0x5633, 0x563d, 0x562c, 0x563e, 0x5638, 0x562a, 0x563a, 0x571a, 0x58ab, 0x589d, 0x58b1, 0x58a0, 0x58a3, 0x58af, 0x58ac, 0x58a5, 0x58a1, 0x58ff, 0x5aff, 0x5af4, 0x5afd, 0x5af7, 0x5af6, 0x5b03, 0x5af8, 0x5b02, 0x5af9, 0x5b01, 0x5b07, 0x5b05, 0x5b0f, 0x5c67, 0x5d99, 0x5d97, 0x5d9f, 0x5d92, 0x5da2, 0x5d93, 0x5d95, 0x5da0, 0x5d9c, 0x5da1, 0x5d9a, 0x5d9e, 0x5e69, 0x5e5d, 0x5e60, 0x5e5c, 0x7df3, 0x5edb, 0x5ede, 0x5ee1, 0x5f49, 0x5fb2, 0x618b, 0x6183, 0x6179, 0x61b1, 0x61b0, 0x61a2, 0x6189, 0x619b, 0x6193, 0x61af, 0x61ad, 0x619f, 0x6192, 0x61aa, 0x61a1, 0x618d, 0x6166, 0x61b3, 0x622d, 0x646e, 0x6470, 0x6496, 0x64a0, 0x6485, 0x6497, 0x649c, 0x648f, 0x648b, 0x648a, 0x648c, 0x64a3, 0x649f, 0x6468, 0x64b1, 0x6498, 0x6576, 0x657a, 0x6579, 0x657b, 0x65b2, 0x65b3, 0x66b5, 0x66b0, 0x66a9, 0x66b2, 0x66b7, 0x66aa, 0x66af, 0x6a00, 0x6a06, 0x6a17, 0x69e5, 0x69f8, 0x6a15, 0x69f1, 0x69e4, 0x6a20, 0x69ff, 0x69ec, 0x69e2, 0x6a1b, 0x6a1d, 0x69fe, 0x6a27, 0x69f2, 0x69ee, 0x6a14, 0x69f7, 0x69e7, 0x6a40, 0x6a08, 0x69e6, 0x69fb, 0x6a0d, 0x69fc, 0x69eb, 0x6a09, 0x6a04, 0x6a18, 0x6a25, 0x6a0f, 0x69f6, 0x6a26, 0x6a07, 0x69f4, 0x6a16, 0x6b51, 0x6ba5, 0x6ba3, 0x6ba2, 0x6ba6, 0x6c01, 0x6c00, 0x6bff, 0x6c02, 0x6f41, 0x6f26, 0x6f7e, 0x6f87, 0x6fc6, 0x6f92, /* 0xe6 */ 0x6f8d, 0x6f89, 0x6f8c, 0x6f62, 0x6f4f, 0x6f85, 0x6f5a, 0x6f96, 0x6f76, 0x6f6c, 0x6f82, 0x6f55, 0x6f72, 0x6f52, 0x6f50, 0x6f57, 0x6f94, 0x6f93, 0x6f5d, 0x6f00, 0x6f61, 0x6f6b, 0x6f7d, 0x6f67, 0x6f90, 0x6f53, 0x6f8b, 0x6f69, 0x6f7f, 0x6f95, 0x6f63, 0x6f77, 0x6f6a, 0x6f7b, 0x71b2, 0x71af, 0x719b, 0x71b0, 0x71a0, 0x719a, 0x71a9, 0x71b5, 0x719d, 0x71a5, 0x719e, 0x71a4, 0x71a1, 0x71aa, 0x719c, 0x71a7, 0x71b3, 0x7298, 0x729a, 0x7358, 0x7352, 0x735e, 0x735f, 0x7360, 0x735d, 0x735b, 0x7361, 0x735a, 0x7359, 0x7362, 0x7487, 0x7489, 0x748a, 0x7486, 0x7481, 0x747d, 0x7485, 0x7488, 0x747c, 0x7479, 0x7508, 0x7507, 0x757e, 0x7625, 0x761e, 0x7619, 0x761d, 0x761c, 0x7623, 0x761a, 0x7628, 0x761b, 0x769c, 0x769d, 0x769e, 0x769b, 0x778d, 0x778f, 0x7789, 0x7788, 0x78cd, 0x78bb, 0x78cf, 0x78cc, 0x78d1, 0x78ce, 0x78d4, 0x78c8, 0x78c3, 0x78c4, 0x78c9, 0x799a, 0x79a1, 0x79a0, 0x799c, 0x79a2, 0x799b, 0x6b76, 0x7a39, 0x7ab2, 0x7ab4, 0x7ab3, 0x7bb7, 0x7bcb, 0x7bbe, 0x7bac, 0x7bce, 0x7baf, 0x7bb9, 0x7bca, 0x7bb5, 0x7cc5, 0x7cc8, 0x7ccc, 0x7ccb, 0x7df7, 0x7ddb, 0x7dea, 0x7de7, 0x7dd7, 0x7de1, 0x7e03, 0x7dfa, 0x7de6, 0x7df6, 0x7df1, 0x7df0, 0x7dee, 0x7ddf, 0x7f76, 0x7fac, 0x7fb0, 0x7fad, 0x7fed, 0x7feb, 0x7fea, 0x7fec, 0x7fe6, 0x7fe8, 0x8064, 0x8067, 0x81a3, 0x819f, /* 0xe7 */ 0x819e, 0x8195, 0x81a2, 0x8199, 0x8197, 0x8216, 0x824f, 0x8253, 0x8252, 0x8250, 0x824e, 0x8251, 0x8524, 0x853b, 0x850f, 0x8500, 0x8529, 0x850e, 0x8509, 0x850d, 0x851f, 0x850a, 0x8527, 0x851c, 0x84fb, 0x852b, 0x84fa, 0x8508, 0x850c, 0x84f4, 0x852a, 0x84f2, 0x8515, 0x84f7, 0x84eb, 0x84f3, 0x84fc, 0x8512, 0x84ea, 0x84e9, 0x8516, 0x84fe, 0x8528, 0x851d, 0x852e, 0x8502, 0x84fd, 0x851e, 0x84f6, 0x8531, 0x8526, 0x84e7, 0x84e8, 0x84f0, 0x84ef, 0x84f9, 0x8518, 0x8520, 0x8530, 0x850b, 0x8519, 0x852f, 0x8662, 0x8756, 0x8763, 0x8764, 0x8777, 0x87e1, 0x8773, 0x8758, 0x8754, 0x875b, 0x8752, 0x8761, 0x875a, 0x8751, 0x875e, 0x876d, 0x876a, 0x8750, 0x874e, 0x875f, 0x875d, 0x876f, 0x876c, 0x877a, 0x876e, 0x875c, 0x8765, 0x874f, 0x877b, 0x8775, 0x8762, 0x8767, 0x8769, 0x885a, 0x8905, 0x890c, 0x8914, 0x890b, 0x8917, 0x8918, 0x8919, 0x8906, 0x8916, 0x8911, 0x890e, 0x8909, 0x89a2, 0x89a4, 0x89a3, 0x89ed, 0x89f0, 0x89ec, 0x8acf, 0x8ac6, 0x8ab8, 0x8ad3, 0x8ad1, 0x8ad4, 0x8ad5, 0x8abb, 0x8ad7, 0x8abe, 0x8ac0, 0x8ac5, 0x8ad8, 0x8ac3, 0x8aba, 0x8abd, 0x8ad9, 0x8c3e, 0x8c4d, 0x8c8f, 0x8ce5, 0x8cdf, 0x8cd9, 0x8ce8, 0x8cda, 0x8cdd, 0x8ce7, 0x8da0, 0x8d9c, 0x8da1, 0x8d9b, 0x8e20, 0x8e23, 0x8e25, 0x8e24, 0x8e2e, 0x8e15, 0x8e1b, 0x8e16, 0x8e11, 0x8e19, 0x8e26, 0x8e27, /* 0xe8 */ 0x8e14, 0x8e12, 0x8e18, 0x8e13, 0x8e1c, 0x8e17, 0x8e1a, 0x8f2c, 0x8f24, 0x8f18, 0x8f1a, 0x8f20, 0x8f23, 0x8f16, 0x8f17, 0x9073, 0x9070, 0x906f, 0x9067, 0x906b, 0x912f, 0x912b, 0x9129, 0x912a, 0x9132, 0x9126, 0x912e, 0x9185, 0x9186, 0x918a, 0x9181, 0x9182, 0x9184, 0x9180, 0x92d0, 0x92c3, 0x92c4, 0x92c0, 0x92d9, 0x92b6, 0x92cf, 0x92f1, 0x92df, 0x92d8, 0x92e9, 0x92d7, 0x92dd, 0x92cc, 0x92ef, 0x92c2, 0x92e8, 0x92ca, 0x92c8, 0x92ce, 0x92e6, 0x92cd, 0x92d5, 0x92c9, 0x92e0, 0x92de, 0x92e7, 0x92d1, 0x92d3, 0x92b5, 0x92e1, 0x92c6, 0x92b4, 0x957c, 0x95ac, 0x95ab, 0x95ae, 0x95b0, 0x96a4, 0x96a2, 0x96d3, 0x9705, 0x9708, 0x9702, 0x975a, 0x978a, 0x978e, 0x9788, 0x97d0, 0x97cf, 0x981e, 0x981d, 0x9826, 0x9829, 0x9828, 0x9820, 0x981b, 0x9827, 0x98b2, 0x9908, 0x98fa, 0x9911, 0x9914, 0x9916, 0x9917, 0x9915, 0x99dc, 0x99cd, 0x99cf, 0x99d3, 0x99d4, 0x99ce, 0x99c9, 0x99d6, 0x99d8, 0x99cb, 0x99d7, 0x99cc, 0x9ab3, 0x9aec, 0x9aeb, 0x9af3, 0x9af2, 0x9af1, 0x9b46, 0x9b43, 0x9b67, 0x9b74, 0x9b71, 0x9b66, 0x9b76, 0x9b75, 0x9b70, 0x9b68, 0x9b64, 0x9b6c, 0x9cfc, 0x9cfa, 0x9cfd, 0x9cff, 0x9cf7, 0x9d07, 0x9d00, 0x9cf9, 0x9cfb, 0x9d08, 0x9d05, 0x9d04, 0x9e83, 0x9ed3, 0x9f0f, 0x9f10, 0x511c, 0x5113, 0x5117, 0x511a, 0x5111, 0x51de, 0x5334, 0x53e1, 0x5670, 0x5660, 0x566e, /* 0xe9 */ 0x5673, 0x5666, 0x5663, 0x566d, 0x5672, 0x565e, 0x5677, 0x571c, 0x571b, 0x58c8, 0x58bd, 0x58c9, 0x58bf, 0x58ba, 0x58c2, 0x58bc, 0x58c6, 0x5b17, 0x5b19, 0x5b1b, 0x5b21, 0x5b14, 0x5b13, 0x5b10, 0x5b16, 0x5b28, 0x5b1a, 0x5b20, 0x5b1e, 0x5bef, 0x5dac, 0x5db1, 0x5da9, 0x5da7, 0x5db5, 0x5db0, 0x5dae, 0x5daa, 0x5da8, 0x5db2, 0x5dad, 0x5daf, 0x5db4, 0x5e67, 0x5e68, 0x5e66, 0x5e6f, 0x5ee9, 0x5ee7, 0x5ee6, 0x5ee8, 0x5ee5, 0x5f4b, 0x5fbc, 0x619d, 0x61a8, 0x6196, 0x61c5, 0x61b4, 0x61c6, 0x61c1, 0x61cc, 0x61ba, 0x61bf, 0x61b8, 0x618c, 0x64d7, 0x64d6, 0x64d0, 0x64cf, 0x64c9, 0x64bd, 0x6489, 0x64c3, 0x64db, 0x64f3, 0x64d9, 0x6533, 0x657f, 0x657c, 0x65a2, 0x66c8, 0x66be, 0x66c0, 0x66ca, 0x66cb, 0x66cf, 0x66bd, 0x66bb, 0x66ba, 0x66cc, 0x6723, 0x6a34, 0x6a66, 0x6a49, 0x6a67, 0x6a32, 0x6a68, 0x6a3e, 0x6a5d, 0x6a6d, 0x6a76, 0x6a5b, 0x6a51, 0x6a28, 0x6a5a, 0x6a3b, 0x6a3f, 0x6a41, 0x6a6a, 0x6a64, 0x6a50, 0x6a4f, 0x6a54, 0x6a6f, 0x6a69, 0x6a60, 0x6a3c, 0x6a5e, 0x6a56, 0x6a55, 0x6a4d, 0x6a4e, 0x6a46, 0x6b55, 0x6b54, 0x6b56, 0x6ba7, 0x6baa, 0x6bab, 0x6bc8, 0x6bc7, 0x6c04, 0x6c03, 0x6c06, 0x6fad, 0x6fcb, 0x6fa3, 0x6fc7, 0x6fbc, 0x6fce, 0x6fc8, 0x6f5e, 0x6fc4, 0x6fbd, 0x6f9e, 0x6fca, 0x6fa8, 0x7004, 0x6fa5, 0x6fae, 0x6fba, 0x6fac, 0x6faa, 0x6fcf, 0x6fbf, 0x6fb8, /* 0xea */ 0x6fa2, 0x6fc9, 0x6fab, 0x6fcd, 0x6faf, 0x6fb2, 0x6fb0, 0x71c5, 0x71c2, 0x71bf, 0x71b8, 0x71d6, 0x71c0, 0x71c1, 0x71cb, 0x71d4, 0x71ca, 0x71c7, 0x71cf, 0x71bd, 0x71d8, 0x71bc, 0x71c6, 0x71da, 0x71db, 0x729d, 0x729e, 0x7369, 0x7366, 0x7367, 0x736c, 0x7365, 0x736b, 0x736a, 0x747f, 0x749a, 0x74a0, 0x7494, 0x7492, 0x7495, 0x74a1, 0x750b, 0x7580, 0x762f, 0x762d, 0x7631, 0x763d, 0x7633, 0x763c, 0x7635, 0x7632, 0x7630, 0x76bb, 0x76e6, 0x779a, 0x779d, 0x77a1, 0x779c, 0x779b, 0x77a2, 0x77a3, 0x7795, 0x7799, 0x7797, 0x78dd, 0x78e9, 0x78e5, 0x78ea, 0x78de, 0x78e3, 0x78db, 0x78e1, 0x78e2, 0x78ed, 0x78df, 0x78e0, 0x79a4, 0x7a44, 0x7a48, 0x7a47, 0x7ab6, 0x7ab8, 0x7ab5, 0x7ab1, 0x7ab7, 0x7bde, 0x7be3, 0x7be7, 0x7bdd, 0x7bd5, 0x7be5, 0x7bda, 0x7be8, 0x7bf9, 0x7bd4, 0x7bea, 0x7be2, 0x7bdc, 0x7beb, 0x7bd8, 0x7bdf, 0x7cd2, 0x7cd4, 0x7cd7, 0x7cd0, 0x7cd1, 0x7e12, 0x7e21, 0x7e17, 0x7e0c, 0x7e1f, 0x7e20, 0x7e13, 0x7e0e, 0x7e1c, 0x7e15, 0x7e1a, 0x7e22, 0x7e0b, 0x7e0f, 0x7e16, 0x7e0d, 0x7e14, 0x7e25, 0x7e24, 0x7f43, 0x7f7b, 0x7f7c, 0x7f7a, 0x7fb1, 0x7fef, 0x802a, 0x8029, 0x806c, 0x81b1, 0x81a6, 0x81ae, 0x81b9, 0x81b5, 0x81ab, 0x81b0, 0x81ac, 0x81b4, 0x81b2, 0x81b7, 0x81a7, 0x81f2, 0x8255, 0x8256, 0x8257, 0x8556, 0x8545, 0x856b, 0x854d, 0x8553, 0x8561, 0x8558, /* 0xeb */ 0x8540, 0x8546, 0x8564, 0x8541, 0x8562, 0x8544, 0x8551, 0x8547, 0x8563, 0x853e, 0x855b, 0x8571, 0x854e, 0x856e, 0x8575, 0x8555, 0x8567, 0x8560, 0x858c, 0x8566, 0x855d, 0x8554, 0x8565, 0x856c, 0x8663, 0x8665, 0x8664, 0x879b, 0x878f, 0x8797, 0x8793, 0x8792, 0x8788, 0x8781, 0x8796, 0x8798, 0x8779, 0x8787, 0x87a3, 0x8785, 0x8790, 0x8791, 0x879d, 0x8784, 0x8794, 0x879c, 0x879a, 0x8789, 0x891e, 0x8926, 0x8930, 0x892d, 0x892e, 0x8927, 0x8931, 0x8922, 0x8929, 0x8923, 0x892f, 0x892c, 0x891f, 0x89f1, 0x8ae0, 0x8ae2, 0x8af2, 0x8af4, 0x8af5, 0x8add, 0x8b14, 0x8ae4, 0x8adf, 0x8af0, 0x8ac8, 0x8ade, 0x8ae1, 0x8ae8, 0x8aff, 0x8aef, 0x8afb, 0x8c91, 0x8c92, 0x8c90, 0x8cf5, 0x8cee, 0x8cf1, 0x8cf0, 0x8cf3, 0x8d6c, 0x8d6e, 0x8da5, 0x8da7, 0x8e33, 0x8e3e, 0x8e38, 0x8e40, 0x8e45, 0x8e36, 0x8e3c, 0x8e3d, 0x8e41, 0x8e30, 0x8e3f, 0x8ebd, 0x8f36, 0x8f2e, 0x8f35, 0x8f32, 0x8f39, 0x8f37, 0x8f34, 0x9076, 0x9079, 0x907b, 0x9086, 0x90fa, 0x9133, 0x9135, 0x9136, 0x9193, 0x9190, 0x9191, 0x918d, 0x918f, 0x9327, 0x931e, 0x9308, 0x931f, 0x9306, 0x930f, 0x937a, 0x9338, 0x933c, 0x931b, 0x9323, 0x9312, 0x9301, 0x9346, 0x932d, 0x930e, 0x930d, 0x92cb, 0x931d, 0x92fa, 0x9325, 0x9313, 0x92f9, 0x92f7, 0x9334, 0x9302, 0x9324, 0x92ff, 0x9329, 0x9339, 0x9335, 0x932a, 0x9314, 0x930c, /* 0xec */ 0x930b, 0x92fe, 0x9309, 0x9300, 0x92fb, 0x9316, 0x95bc, 0x95cd, 0x95be, 0x95b9, 0x95ba, 0x95b6, 0x95bf, 0x95b5, 0x95bd, 0x96a9, 0x96d4, 0x970b, 0x9712, 0x9710, 0x9799, 0x9797, 0x9794, 0x97f0, 0x97f8, 0x9835, 0x982f, 0x9832, 0x9924, 0x991f, 0x9927, 0x9929, 0x999e, 0x99ee, 0x99ec, 0x99e5, 0x99e4, 0x99f0, 0x99e3, 0x99ea, 0x99e9, 0x99e7, 0x9ab9, 0x9abf, 0x9ab4, 0x9abb, 0x9af6, 0x9afa, 0x9af9, 0x9af7, 0x9b33, 0x9b80, 0x9b85, 0x9b87, 0x9b7c, 0x9b7e, 0x9b7b, 0x9b82, 0x9b93, 0x9b92, 0x9b90, 0x9b7a, 0x9b95, 0x9b7d, 0x9b88, 0x9d25, 0x9d17, 0x9d20, 0x9d1e, 0x9d14, 0x9d29, 0x9d1d, 0x9d18, 0x9d22, 0x9d10, 0x9d19, 0x9d1f, 0x9e88, 0x9e86, 0x9e87, 0x9eae, 0x9ead, 0x9ed5, 0x9ed6, 0x9efa, 0x9f12, 0x9f3d, 0x5126, 0x5125, 0x5122, 0x5124, 0x5120, 0x5129, 0x52f4, 0x5693, 0x568c, 0x568d, 0x5686, 0x5684, 0x5683, 0x567e, 0x5682, 0x567f, 0x5681, 0x58d6, 0x58d4, 0x58cf, 0x58d2, 0x5b2d, 0x5b25, 0x5b32, 0x5b23, 0x5b2c, 0x5b27, 0x5b26, 0x5b2f, 0x5b2e, 0x5b7b, 0x5bf1, 0x5bf2, 0x5db7, 0x5e6c, 0x5e6a, 0x5fbe, 0x5fbb, 0x61c3, 0x61b5, 0x61bc, 0x61e7, 0x61e0, 0x61e5, 0x61e4, 0x61e8, 0x61de, 0x64ef, 0x64e9, 0x64e3, 0x64eb, 0x64e4, 0x64e8, 0x6581, 0x6580, 0x65b6, 0x65da, 0x66d2, 0x6a8d, 0x6a96, 0x6a81, 0x6aa5, 0x6a89, 0x6a9f, 0x6a9b, 0x6aa1, 0x6a9e, 0x6a87, 0x6a93, 0x6a8e, /* 0xed */ 0x6a95, 0x6a83, 0x6aa8, 0x6aa4, 0x6a91, 0x6a7f, 0x6aa6, 0x6a9a, 0x6a85, 0x6a8c, 0x6a92, 0x6b5b, 0x6bad, 0x6c09, 0x6fcc, 0x6fa9, 0x6ff4, 0x6fd4, 0x6fe3, 0x6fdc, 0x6fed, 0x6fe7, 0x6fe6, 0x6fde, 0x6ff2, 0x6fdd, 0x6fe2, 0x6fe8, 0x71e1, 0x71f1, 0x71e8, 0x71f2, 0x71e4, 0x71f0, 0x71e2, 0x7373, 0x736e, 0x736f, 0x7497, 0x74b2, 0x74ab, 0x7490, 0x74aa, 0x74ad, 0x74b1, 0x74a5, 0x74af, 0x7510, 0x7511, 0x7512, 0x750f, 0x7584, 0x7643, 0x7648, 0x7649, 0x7647, 0x76a4, 0x76e9, 0x77b5, 0x77ab, 0x77b2, 0x77b7, 0x77b6, 0x77b4, 0x77b1, 0x77a8, 0x77f0, 0x78f3, 0x78fd, 0x7902, 0x78fb, 0x78fc, 0x78f2, 0x7905, 0x78f9, 0x78fe, 0x7904, 0x79ab, 0x79a8, 0x7a5c, 0x7a5b, 0x7a56, 0x7a58, 0x7a54, 0x7a5a, 0x7abe, 0x7ac0, 0x7ac1, 0x7c05, 0x7c0f, 0x7bf2, 0x7c00, 0x7bff, 0x7bfb, 0x7c0e, 0x7bf4, 0x7c0b, 0x7bf3, 0x7c02, 0x7c09, 0x7c03, 0x7c01, 0x7bf8, 0x7bfd, 0x7c06, 0x7bf0, 0x7bf1, 0x7c10, 0x7c0a, 0x7ce8, 0x7e2d, 0x7e3c, 0x7e42, 0x7e33, 0x9848, 0x7e38, 0x7e2a, 0x7e49, 0x7e40, 0x7e47, 0x7e29, 0x7e4c, 0x7e30, 0x7e3b, 0x7e36, 0x7e44, 0x7e3a, 0x7f45, 0x7f7f, 0x7f7e, 0x7f7d, 0x7ff4, 0x7ff2, 0x802c, 0x81bb, 0x81c4, 0x81cc, 0x81ca, 0x81c5, 0x81c7, 0x81bc, 0x81e9, 0x825b, 0x825a, 0x825c, 0x8583, 0x8580, 0x858f, 0x85a7, 0x8595, 0x85a0, 0x858b, 0x85a3, 0x857b, 0x85a4, 0x859a, 0x859e, /* 0xee */ 0x8577, 0x857c, 0x8589, 0x85a1, 0x857a, 0x8578, 0x8557, 0x858e, 0x8596, 0x8586, 0x858d, 0x8599, 0x859d, 0x8581, 0x85a2, 0x8582, 0x8588, 0x8585, 0x8579, 0x8576, 0x8598, 0x8590, 0x859f, 0x8668, 0x87be, 0x87aa, 0x87ad, 0x87c5, 0x87b0, 0x87ac, 0x87b9, 0x87b5, 0x87bc, 0x87ae, 0x87c9, 0x87c3, 0x87c2, 0x87cc, 0x87b7, 0x87af, 0x87c4, 0x87ca, 0x87b4, 0x87b6, 0x87bf, 0x87b8, 0x87bd, 0x87de, 0x87b2, 0x8935, 0x8933, 0x893c, 0x893e, 0x8941, 0x8952, 0x8937, 0x8942, 0x89ad, 0x89af, 0x89ae, 0x89f2, 0x89f3, 0x8b1e, 0x8b18, 0x8b16, 0x8b11, 0x8b05, 0x8b0b, 0x8b22, 0x8b0f, 0x8b12, 0x8b15, 0x8b07, 0x8b0d, 0x8b08, 0x8b06, 0x8b1c, 0x8b13, 0x8b1a, 0x8c4f, 0x8c70, 0x8c72, 0x8c71, 0x8c6f, 0x8c95, 0x8c94, 0x8cf9, 0x8d6f, 0x8e4e, 0x8e4d, 0x8e53, 0x8e50, 0x8e4c, 0x8e47, 0x8f43, 0x8f40, 0x9085, 0x907e, 0x9138, 0x919a, 0x91a2, 0x919b, 0x9199, 0x919f, 0x91a1, 0x919d, 0x91a0, 0x93a1, 0x9383, 0x93af, 0x9364, 0x9356, 0x9347, 0x937c, 0x9358, 0x935c, 0x9376, 0x9349, 0x9350, 0x9351, 0x9360, 0x936d, 0x938f, 0x934c, 0x936a, 0x9379, 0x9357, 0x9355, 0x9352, 0x934f, 0x9371, 0x9377, 0x937b, 0x9361, 0x935e, 0x9363, 0x9367, 0x9380, 0x934e, 0x9359, 0x95c7, 0x95c0, 0x95c9, 0x95c3, 0x95c5, 0x95b7, 0x96ae, 0x96b0, 0x96ac, 0x9720, 0x971f, 0x9718, 0x971d, 0x9719, 0x979a, 0x97a1, 0x979c, /* 0xef */ 0x979e, 0x979d, 0x97d5, 0x97d4, 0x97f1, 0x9841, 0x9844, 0x984a, 0x9849, 0x9845, 0x9843, 0x9925, 0x992b, 0x992c, 0x992a, 0x9933, 0x9932, 0x992f, 0x992d, 0x9931, 0x9930, 0x9998, 0x99a3, 0x99a1, 0x9a02, 0x99fa, 0x99f4, 0x99f7, 0x99f9, 0x99f8, 0x99f6, 0x99fb, 0x99fd, 0x99fe, 0x99fc, 0x9a03, 0x9abe, 0x9afe, 0x9afd, 0x9b01, 0x9afc, 0x9b48, 0x9b9a, 0x9ba8, 0x9b9e, 0x9b9b, 0x9ba6, 0x9ba1, 0x9ba5, 0x9ba4, 0x9b86, 0x9ba2, 0x9ba0, 0x9baf, 0x9d33, 0x9d41, 0x9d67, 0x9d36, 0x9d2e, 0x9d2f, 0x9d31, 0x9d38, 0x9d30, 0x9d45, 0x9d42, 0x9d43, 0x9d3e, 0x9d37, 0x9d40, 0x9d3d, 0x7ff5, 0x9d2d, 0x9e8a, 0x9e89, 0x9e8d, 0x9eb0, 0x9ec8, 0x9eda, 0x9efb, 0x9eff, 0x9f24, 0x9f23, 0x9f22, 0x9f54, 0x9fa0, 0x5131, 0x512d, 0x512e, 0x5698, 0x569c, 0x5697, 0x569a, 0x569d, 0x5699, 0x5970, 0x5b3c, 0x5c69, 0x5c6a, 0x5dc0, 0x5e6d, 0x5e6e, 0x61d8, 0x61df, 0x61ed, 0x61ee, 0x61f1, 0x61ea, 0x61f0, 0x61eb, 0x61d6, 0x61e9, 0x64ff, 0x6504, 0x64fd, 0x64f8, 0x6501, 0x6503, 0x64fc, 0x6594, 0x65db, 0x66da, 0x66db, 0x66d8, 0x6ac5, 0x6ab9, 0x6abd, 0x6ae1, 0x6ac6, 0x6aba, 0x6ab6, 0x6ab7, 0x6ac7, 0x6ab4, 0x6aad, 0x6b5e, 0x6bc9, 0x6c0b, 0x7007, 0x700c, 0x700d, 0x7001, 0x7005, 0x7014, 0x700e, 0x6fff, 0x7000, 0x6ffb, 0x7026, 0x6ffc, 0x6ff7, 0x700a, 0x7201, 0x71ff, 0x71f9, 0x7203, 0x71fd, 0x7376, /* 0xf0 */ 0x74b8, 0x74c0, 0x74b5, 0x74c1, 0x74be, 0x74b6, 0x74bb, 0x74c2, 0x7514, 0x7513, 0x765c, 0x7664, 0x7659, 0x7650, 0x7653, 0x7657, 0x765a, 0x76a6, 0x76bd, 0x76ec, 0x77c2, 0x77ba, 0x78ff, 0x790c, 0x7913, 0x7914, 0x7909, 0x7910, 0x7912, 0x7911, 0x79ad, 0x79ac, 0x7a5f, 0x7c1c, 0x7c29, 0x7c19, 0x7c20, 0x7c1f, 0x7c2d, 0x7c1d, 0x7c26, 0x7c28, 0x7c22, 0x7c25, 0x7c30, 0x7e5c, 0x7e50, 0x7e56, 0x7e63, 0x7e58, 0x7e62, 0x7e5f, 0x7e51, 0x7e60, 0x7e57, 0x7e53, 0x7fb5, 0x7fb3, 0x7ff7, 0x7ff8, 0x8075, 0x81d1, 0x81d2, 0x81d0, 0x825f, 0x825e, 0x85b4, 0x85c6, 0x85c0, 0x85c3, 0x85c2, 0x85b3, 0x85b5, 0x85bd, 0x85c7, 0x85c4, 0x85bf, 0x85cb, 0x85ce, 0x85c8, 0x85c5, 0x85b1, 0x85b6, 0x85d2, 0x8624, 0x85b8, 0x85b7, 0x85be, 0x8669, 0x87e7, 0x87e6, 0x87e2, 0x87db, 0x87eb, 0x87ea, 0x87e5, 0x87df, 0x87f3, 0x87e4, 0x87d4, 0x87dc, 0x87d3, 0x87ed, 0x87d8, 0x87e3, 0x87a4, 0x87d7, 0x87d9, 0x8801, 0x87f4, 0x87e8, 0x87dd, 0x8953, 0x894b, 0x894f, 0x894c, 0x8946, 0x8950, 0x8951, 0x8949, 0x8b2a, 0x8b27, 0x8b23, 0x8b33, 0x8b30, 0x8b35, 0x8b47, 0x8b2f, 0x8b3c, 0x8b3e, 0x8b31, 0x8b25, 0x8b37, 0x8b26, 0x8b36, 0x8b2e, 0x8b24, 0x8b3b, 0x8b3d, 0x8b3a, 0x8c42, 0x8c75, 0x8c99, 0x8c98, 0x8c97, 0x8cfe, 0x8d04, 0x8d02, 0x8d00, 0x8e5c, 0x8e62, 0x8e60, 0x8e57, 0x8e56, 0x8e5e, 0x8e65, 0x8e67, /* 0xf1 */ 0x8e5b, 0x8e5a, 0x8e61, 0x8e5d, 0x8e69, 0x8e54, 0x8f46, 0x8f47, 0x8f48, 0x8f4b, 0x9128, 0x913a, 0x913b, 0x913e, 0x91a8, 0x91a5, 0x91a7, 0x91af, 0x91aa, 0x93b5, 0x938c, 0x9392, 0x93b7, 0x939b, 0x939d, 0x9389, 0x93a7, 0x938e, 0x93aa, 0x939e, 0x93a6, 0x9395, 0x9388, 0x9399, 0x939f, 0x938d, 0x93b1, 0x9391, 0x93b2, 0x93a4, 0x93a8, 0x93b4, 0x93a3, 0x93a5, 0x95d2, 0x95d3, 0x95d1, 0x96b3, 0x96d7, 0x96da, 0x5dc2, 0x96df, 0x96d8, 0x96dd, 0x9723, 0x9722, 0x9725, 0x97ac, 0x97ae, 0x97a8, 0x97ab, 0x97a4, 0x97aa, 0x97a2, 0x97a5, 0x97d7, 0x97d9, 0x97d6, 0x97d8, 0x97fa, 0x9850, 0x9851, 0x9852, 0x98b8, 0x9941, 0x993c, 0x993a, 0x9a0f, 0x9a0b, 0x9a09, 0x9a0d, 0x9a04, 0x9a11, 0x9a0a, 0x9a05, 0x9a07, 0x9a06, 0x9ac0, 0x9adc, 0x9b08, 0x9b04, 0x9b05, 0x9b29, 0x9b35, 0x9b4a, 0x9b4c, 0x9b4b, 0x9bc7, 0x9bc6, 0x9bc3, 0x9bbf, 0x9bc1, 0x9bb5, 0x9bb8, 0x9bd3, 0x9bb6, 0x9bc4, 0x9bb9, 0x9bbd, 0x9d5c, 0x9d53, 0x9d4f, 0x9d4a, 0x9d5b, 0x9d4b, 0x9d59, 0x9d56, 0x9d4c, 0x9d57, 0x9d52, 0x9d54, 0x9d5f, 0x9d58, 0x9d5a, 0x9e8e, 0x9e8c, 0x9edf, 0x9f01, 0x9f00, 0x9f16, 0x9f25, 0x9f2b, 0x9f2a, 0x9f29, 0x9f28, 0x9f4c, 0x9f55, 0x5134, 0x5135, 0x5296, 0x52f7, 0x53b4, 0x56ab, 0x56ad, 0x56a6, 0x56a7, 0x56aa, 0x56ac, 0x58da, 0x58dd, 0x58db, 0x5912, 0x5b3d, 0x5b3e, 0x5b3f, 0x5dc3, 0x5e70, /* 0xf2 */ 0x5fbf, 0x61fb, 0x6507, 0x6510, 0x650d, 0x6509, 0x650c, 0x650e, 0x6584, 0x65de, 0x65dd, 0x66de, 0x6ae7, 0x6ae0, 0x6acc, 0x6ad1, 0x6ad9, 0x6acb, 0x6adf, 0x6adc, 0x6ad0, 0x6aeb, 0x6acf, 0x6acd, 0x6ade, 0x6b60, 0x6bb0, 0x6c0c, 0x7019, 0x7027, 0x7020, 0x7016, 0x702b, 0x7021, 0x7022, 0x7023, 0x7029, 0x7017, 0x7024, 0x701c, 0x702a, 0x720c, 0x720a, 0x7207, 0x7202, 0x7205, 0x72a5, 0x72a6, 0x72a4, 0x72a3, 0x72a1, 0x74cb, 0x74c5, 0x74b7, 0x74c3, 0x7516, 0x7660, 0x77c9, 0x77ca, 0x77c4, 0x77f1, 0x791d, 0x791b, 0x7921, 0x791c, 0x7917, 0x791e, 0x79b0, 0x7a67, 0x7a68, 0x7c33, 0x7c3c, 0x7c39, 0x7c2c, 0x7c3b, 0x7cec, 0x7cea, 0x7e76, 0x7e75, 0x7e78, 0x7e70, 0x7e77, 0x7e6f, 0x7e7a, 0x7e72, 0x7e74, 0x7e68, 0x7f4b, 0x7f4a, 0x7f83, 0x7f86, 0x7fb7, 0x7ffd, 0x7ffe, 0x8078, 0x81d7, 0x81d5, 0x8264, 0x8261, 0x8263, 0x85eb, 0x85f1, 0x85ed, 0x85d9, 0x85e1, 0x85e8, 0x85da, 0x85d7, 0x85ec, 0x85f2, 0x85f8, 0x85d8, 0x85df, 0x85e3, 0x85dc, 0x85d1, 0x85f0, 0x85e6, 0x85ef, 0x85de, 0x85e2, 0x8800, 0x87fa, 0x8803, 0x87f6, 0x87f7, 0x8809, 0x880c, 0x880b, 0x8806, 0x87fc, 0x8808, 0x87ff, 0x880a, 0x8802, 0x8962, 0x895a, 0x895b, 0x8957, 0x8961, 0x895c, 0x8958, 0x895d, 0x8959, 0x8988, 0x89b7, 0x89b6, 0x89f6, 0x8b50, 0x8b48, 0x8b4a, 0x8b40, 0x8b53, 0x8b56, 0x8b54, 0x8b4b, 0x8b55, /* 0xf3 */ 0x8b51, 0x8b42, 0x8b52, 0x8b57, 0x8c43, 0x8c77, 0x8c76, 0x8c9a, 0x8d06, 0x8d07, 0x8d09, 0x8dac, 0x8daa, 0x8dad, 0x8dab, 0x8e6d, 0x8e78, 0x8e73, 0x8e6a, 0x8e6f, 0x8e7b, 0x8ec2, 0x8f52, 0x8f51, 0x8f4f, 0x8f50, 0x8f53, 0x8fb4, 0x9140, 0x913f, 0x91b0, 0x91ad, 0x93de, 0x93c7, 0x93cf, 0x93c2, 0x93da, 0x93d0, 0x93f9, 0x93ec, 0x93cc, 0x93d9, 0x93a9, 0x93e6, 0x93ca, 0x93d4, 0x93ee, 0x93e3, 0x93d5, 0x93c4, 0x93ce, 0x93c0, 0x93d2, 0x93e7, 0x957d, 0x95da, 0x95db, 0x96e1, 0x9729, 0x972b, 0x972c, 0x9728, 0x9726, 0x97b3, 0x97b7, 0x97b6, 0x97dd, 0x97de, 0x97df, 0x985c, 0x9859, 0x985d, 0x9857, 0x98bf, 0x98bd, 0x98bb, 0x98be, 0x9948, 0x9947, 0x9943, 0x99a6, 0x99a7, 0x9a1a, 0x9a15, 0x9a25, 0x9a1d, 0x9a24, 0x9a1b, 0x9a22, 0x9a20, 0x9a27, 0x9a23, 0x9a1e, 0x9a1c, 0x9a14, 0x9ac2, 0x9b0b, 0x9b0a, 0x9b0e, 0x9b0c, 0x9b37, 0x9bea, 0x9beb, 0x9be0, 0x9bde, 0x9be4, 0x9be6, 0x9be2, 0x9bf0, 0x9bd4, 0x9bd7, 0x9bec, 0x9bdc, 0x9bd9, 0x9be5, 0x9bd5, 0x9be1, 0x9bda, 0x9d77, 0x9d81, 0x9d8a, 0x9d84, 0x9d88, 0x9d71, 0x9d80, 0x9d78, 0x9d86, 0x9d8b, 0x9d8c, 0x9d7d, 0x9d6b, 0x9d74, 0x9d75, 0x9d70, 0x9d69, 0x9d85, 0x9d73, 0x9d7b, 0x9d82, 0x9d6f, 0x9d79, 0x9d7f, 0x9d87, 0x9d68, 0x9e94, 0x9e91, 0x9ec0, 0x9efc, 0x9f2d, 0x9f40, 0x9f41, 0x9f4d, 0x9f56, 0x9f57, 0x9f58, 0x5337, 0x56b2, /* 0xf4 */ 0x56b5, 0x56b3, 0x58e3, 0x5b45, 0x5dc6, 0x5dc7, 0x5eee, 0x5eef, 0x5fc0, 0x5fc1, 0x61f9, 0x6517, 0x6516, 0x6515, 0x6513, 0x65df, 0x66e8, 0x66e3, 0x66e4, 0x6af3, 0x6af0, 0x6aea, 0x6ae8, 0x6af9, 0x6af1, 0x6aee, 0x6aef, 0x703c, 0x7035, 0x702f, 0x7037, 0x7034, 0x7031, 0x7042, 0x7038, 0x703f, 0x703a, 0x7039, 0x7040, 0x703b, 0x7033, 0x7041, 0x7213, 0x7214, 0x72a8, 0x737d, 0x737c, 0x74ba, 0x76ab, 0x76aa, 0x76be, 0x76ed, 0x77cc, 0x77ce, 0x77cf, 0x77cd, 0x77f2, 0x7925, 0x7923, 0x7927, 0x7928, 0x7924, 0x7929, 0x79b2, 0x7a6e, 0x7a6c, 0x7a6d, 0x7af7, 0x7c49, 0x7c48, 0x7c4a, 0x7c47, 0x7c45, 0x7cee, 0x7e7b, 0x7e7e, 0x7e81, 0x7e80, 0x7fba, 0x7fff, 0x8079, 0x81db, 0x81d9, 0x820b, 0x8268, 0x8269, 0x8622, 0x85ff, 0x8601, 0x85fe, 0x861b, 0x8600, 0x85f6, 0x8604, 0x8609, 0x8605, 0x860c, 0x85fd, 0x8819, 0x8810, 0x8811, 0x8817, 0x8813, 0x8816, 0x8963, 0x8966, 0x89b9, 0x89f7, 0x8b60, 0x8b6a, 0x8b5d, 0x8b68, 0x8b63, 0x8b65, 0x8b67, 0x8b6d, 0x8dae, 0x8e86, 0x8e88, 0x8e84, 0x8f59, 0x8f56, 0x8f57, 0x8f55, 0x8f58, 0x8f5a, 0x908d, 0x9143, 0x9141, 0x91b7, 0x91b5, 0x91b2, 0x91b3, 0x940b, 0x9413, 0x93fb, 0x9420, 0x940f, 0x9414, 0x93fe, 0x9415, 0x9410, 0x9428, 0x9419, 0x940d, 0x93f5, 0x9400, 0x93f7, 0x9407, 0x940e, 0x9416, 0x9412, 0x93fa, 0x9409, 0x93f8, 0x940a, 0x93ff, /* 0xf5 */ 0x93fc, 0x940c, 0x93f6, 0x9411, 0x9406, 0x95de, 0x95e0, 0x95df, 0x972e, 0x972f, 0x97b9, 0x97bb, 0x97fd, 0x97fe, 0x9860, 0x9862, 0x9863, 0x985f, 0x98c1, 0x98c2, 0x9950, 0x994e, 0x9959, 0x994c, 0x994b, 0x9953, 0x9a32, 0x9a34, 0x9a31, 0x9a2c, 0x9a2a, 0x9a36, 0x9a29, 0x9a2e, 0x9a38, 0x9a2d, 0x9ac7, 0x9aca, 0x9ac6, 0x9b10, 0x9b12, 0x9b11, 0x9c0b, 0x9c08, 0x9bf7, 0x9c05, 0x9c12, 0x9bf8, 0x9c40, 0x9c07, 0x9c0e, 0x9c06, 0x9c17, 0x9c14, 0x9c09, 0x9d9f, 0x9d99, 0x9da4, 0x9d9d, 0x9d92, 0x9d98, 0x9d90, 0x9d9b, 0x9da0, 0x9d94, 0x9d9c, 0x9daa, 0x9d97, 0x9da1, 0x9d9a, 0x9da2, 0x9da8, 0x9d9e, 0x9da3, 0x9dbf, 0x9da9, 0x9d96, 0x9da6, 0x9da7, 0x9e99, 0x9e9b, 0x9e9a, 0x9ee5, 0x9ee4, 0x9ee7, 0x9ee6, 0x9f30, 0x9f2e, 0x9f5b, 0x9f60, 0x9f5e, 0x9f5d, 0x9f59, 0x9f91, 0x513a, 0x5139, 0x5298, 0x5297, 0x56c3, 0x56bd, 0x56be, 0x5b48, 0x5b47, 0x5dcb, 0x5dcf, 0x5ef1, 0x61fd, 0x651b, 0x6b02, 0x6afc, 0x6b03, 0x6af8, 0x6b00, 0x7043, 0x7044, 0x704a, 0x7048, 0x7049, 0x7045, 0x7046, 0x721d, 0x721a, 0x7219, 0x737e, 0x7517, 0x766a, 0x77d0, 0x792d, 0x7931, 0x792f, 0x7c54, 0x7c53, 0x7cf2, 0x7e8a, 0x7e87, 0x7e88, 0x7e8b, 0x7e86, 0x7e8d, 0x7f4d, 0x7fbb, 0x8030, 0x81dd, 0x8618, 0x862a, 0x8626, 0x861f, 0x8623, 0x861c, 0x8619, 0x8627, 0x862e, 0x8621, 0x8620, 0x8629, 0x861e, 0x8625, /* 0xf6 */ 0x8829, 0x881d, 0x881b, 0x8820, 0x8824, 0x881c, 0x882b, 0x884a, 0x896d, 0x8969, 0x896e, 0x896b, 0x89fa, 0x8b79, 0x8b78, 0x8b45, 0x8b7a, 0x8b7b, 0x8d10, 0x8d14, 0x8daf, 0x8e8e, 0x8e8c, 0x8f5e, 0x8f5b, 0x8f5d, 0x9146, 0x9144, 0x9145, 0x91b9, 0x943f, 0x943b, 0x9436, 0x9429, 0x943d, 0x943c, 0x9430, 0x9439, 0x942a, 0x9437, 0x942c, 0x9440, 0x9431, 0x95e5, 0x95e4, 0x95e3, 0x9735, 0x973a, 0x97bf, 0x97e1, 0x9864, 0x98c9, 0x98c6, 0x98c0, 0x9958, 0x9956, 0x9a39, 0x9a3d, 0x9a46, 0x9a44, 0x9a42, 0x9a41, 0x9a3a, 0x9a3f, 0x9acd, 0x9b15, 0x9b17, 0x9b18, 0x9b16, 0x9b3a, 0x9b52, 0x9c2b, 0x9c1d, 0x9c1c, 0x9c2c, 0x9c23, 0x9c28, 0x9c29, 0x9c24, 0x9c21, 0x9db7, 0x9db6, 0x9dbc, 0x9dc1, 0x9dc7, 0x9dca, 0x9dcf, 0x9dbe, 0x9dc5, 0x9dc3, 0x9dbb, 0x9db5, 0x9dce, 0x9db9, 0x9dba, 0x9dac, 0x9dc8, 0x9db1, 0x9dad, 0x9dcc, 0x9db3, 0x9dcd, 0x9db2, 0x9e7a, 0x9e9c, 0x9eeb, 0x9eee, 0x9eed, 0x9f1b, 0x9f18, 0x9f1a, 0x9f31, 0x9f4e, 0x9f65, 0x9f64, 0x9f92, 0x4eb9, 0x56c6, 0x56c5, 0x56cb, 0x5971, 0x5b4b, 0x5b4c, 0x5dd5, 0x5dd1, 0x5ef2, 0x6521, 0x6520, 0x6526, 0x6522, 0x6b0b, 0x6b08, 0x6b09, 0x6c0d, 0x7055, 0x7056, 0x7057, 0x7052, 0x721e, 0x721f, 0x72a9, 0x737f, 0x74d8, 0x74d5, 0x74d9, 0x74d7, 0x766d, 0x76ad, 0x7935, 0x79b4, 0x7a70, 0x7a71, 0x7c57, 0x7c5c, 0x7c59, 0x7c5b, 0x7c5a, /* 0xf7 */ 0x7cf4, 0x7cf1, 0x7e91, 0x7f4f, 0x7f87, 0x81de, 0x826b, 0x8634, 0x8635, 0x8633, 0x862c, 0x8632, 0x8636, 0x882c, 0x8828, 0x8826, 0x882a, 0x8825, 0x8971, 0x89bf, 0x89be, 0x89fb, 0x8b7e, 0x8b84, 0x8b82, 0x8b86, 0x8b85, 0x8b7f, 0x8d15, 0x8e95, 0x8e94, 0x8e9a, 0x8e92, 0x8e90, 0x8e96, 0x8e97, 0x8f60, 0x8f62, 0x9147, 0x944c, 0x9450, 0x944a, 0x944b, 0x944f, 0x9447, 0x9445, 0x9448, 0x9449, 0x9446, 0x973f, 0x97e3, 0x986a, 0x9869, 0x98cb, 0x9954, 0x995b, 0x9a4e, 0x9a53, 0x9a54, 0x9a4c, 0x9a4f, 0x9a48, 0x9a4a, 0x9a49, 0x9a52, 0x9a50, 0x9ad0, 0x9b19, 0x9b2b, 0x9b3b, 0x9b56, 0x9b55, 0x9c46, 0x9c48, 0x9c3f, 0x9c44, 0x9c39, 0x9c33, 0x9c41, 0x9c3c, 0x9c37, 0x9c34, 0x9c32, 0x9c3d, 0x9c36, 0x9ddb, 0x9dd2, 0x9dde, 0x9dda, 0x9dcb, 0x9dd0, 0x9ddc, 0x9dd1, 0x9ddf, 0x9de9, 0x9dd9, 0x9dd8, 0x9dd6, 0x9df5, 0x9dd5, 0x9ddd, 0x9eb6, 0x9ef0, 0x9f35, 0x9f33, 0x9f32, 0x9f42, 0x9f6b, 0x9f95, 0x9fa2, 0x513d, 0x5299, 0x58e8, 0x58e7, 0x5972, 0x5b4d, 0x5dd8, 0x882f, 0x5f4f, 0x6201, 0x6203, 0x6204, 0x6529, 0x6525, 0x6596, 0x66eb, 0x6b11, 0x6b12, 0x6b0f, 0x6bca, 0x705b, 0x705a, 0x7222, 0x7382, 0x7381, 0x7383, 0x7670, 0x77d4, 0x7c67, 0x7c66, 0x7e95, 0x826c, 0x863a, 0x8640, 0x8639, 0x863c, 0x8631, 0x863b, 0x863e, 0x8830, 0x8832, 0x882e, 0x8833, 0x8976, 0x8974, 0x8973, 0x89fe, /* 0xf8 */ 0x8b8c, 0x8b8e, 0x8b8b, 0x8b88, 0x8c45, 0x8d19, 0x8e98, 0x8f64, 0x8f63, 0x91bc, 0x9462, 0x9455, 0x945d, 0x9457, 0x945e, 0x97c4, 0x97c5, 0x9800, 0x9a56, 0x9a59, 0x9b1e, 0x9b1f, 0x9b20, 0x9c52, 0x9c58, 0x9c50, 0x9c4a, 0x9c4d, 0x9c4b, 0x9c55, 0x9c59, 0x9c4c, 0x9c4e, 0x9dfb, 0x9df7, 0x9def, 0x9de3, 0x9deb, 0x9df8, 0x9de4, 0x9df6, 0x9de1, 0x9dee, 0x9de6, 0x9df2, 0x9df0, 0x9de2, 0x9dec, 0x9df4, 0x9df3, 0x9de8, 0x9ded, 0x9ec2, 0x9ed0, 0x9ef2, 0x9ef3, 0x9f06, 0x9f1c, 0x9f38, 0x9f37, 0x9f36, 0x9f43, 0x9f4f, 0x9f71, 0x9f70, 0x9f6e, 0x9f6f, 0x56d3, 0x56cd, 0x5b4e, 0x5c6d, 0x652d, 0x66ed, 0x66ee, 0x6b13, 0x705f, 0x7061, 0x705d, 0x7060, 0x7223, 0x74db, 0x74e5, 0x77d5, 0x7938, 0x79b7, 0x79b6, 0x7c6a, 0x7e97, 0x7f89, 0x826d, 0x8643, 0x8838, 0x8837, 0x8835, 0x884b, 0x8b94, 0x8b95, 0x8e9e, 0x8e9f, 0x8ea0, 0x8e9d, 0x91be, 0x91bd, 0x91c2, 0x946b, 0x9468, 0x9469, 0x96e5, 0x9746, 0x9743, 0x9747, 0x97c7, 0x97e5, 0x9a5e, 0x9ad5, 0x9b59, 0x9c63, 0x9c67, 0x9c66, 0x9c62, 0x9c5e, 0x9c60, 0x9e02, 0x9dfe, 0x9e07, 0x9e03, 0x9e06, 0x9e05, 0x9e00, 0x9e01, 0x9e09, 0x9dff, 0x9dfd, 0x9e04, 0x9ea0, 0x9f1e, 0x9f46, 0x9f74, 0x9f75, 0x9f76, 0x56d4, 0x652e, 0x65b8, 0x6b18, 0x6b19, 0x6b17, 0x6b1a, 0x7062, 0x7226, 0x72aa, 0x77d8, 0x77d9, 0x7939, 0x7c69, 0x7c6b, 0x7cf6, 0x7e9a, /* 0xf9 */ 0x7e98, 0x7e9b, 0x7e99, 0x81e0, 0x81e1, 0x8646, 0x8647, 0x8648, 0x8979, 0x897a, 0x897c, 0x897b, 0x89ff, 0x8b98, 0x8b99, 0x8ea5, 0x8ea4, 0x8ea3, 0x946e, 0x946d, 0x946f, 0x9471, 0x9473, 0x9749, 0x9872, 0x995f, 0x9c68, 0x9c6e, 0x9c6d, 0x9e0b, 0x9e0d, 0x9e10, 0x9e0f, 0x9e12, 0x9e11, 0x9ea1, 0x9ef5, 0x9f09, 0x9f47, 0x9f78, 0x9f7b, 0x9f7a, 0x9f79, 0x571e, 0x7066, 0x7c6f, 0x883c, 0x8db2, 0x8ea6, 0x91c3, 0x9474, 0x9478, 0x9476, 0x9475, 0x9a60, 0x9c74, 0x9c73, 0x9c71, 0x9c75, 0x9e14, 0x9e13, 0x9ef6, 0x9f0a, 0x9fa4, 0x7068, 0x7065, 0x7cf7, 0x866a, 0x883e, 0x883d, 0x883f, 0x8b9e, 0x8c9c, 0x8ea9, 0x8ec9, 0x974b, 0x9873, 0x9874, 0x98cc, 0x9961, 0x99ab, 0x9a64, 0x9a66, 0x9a67, 0x9b24, 0x9e15, 0x9e17, 0x9f48, 0x6207, 0x6b1e, 0x7227, 0x864c, 0x8ea8, 0x9482, 0x9480, 0x9481, 0x9a69, 0x9a68, 0x9b2e, 0x9e19, 0x7229, 0x864b, 0x8b9f, 0x9483, 0x9c79, 0x9eb7, 0x7675, 0x9a6b, 0x9c7a, 0x9e1d, 0x7069, 0x706a, 0x9ea4, 0x9f7e, 0x9f49, 0x9f98, 0x7881, 0x92b9, 0x88cf, 0x58bb, 0x6052, 0x7ca7, 0x5afa, 0x2554, 0x2566, 0x2557, 0x2560, 0x256c, 0x2563, 0x255a, 0x2569, 0x255d, 0x2552, 0x2564, 0x2555, 0x255e, 0x256a, 0x2561, 0x2558, 0x2567, 0x255b, 0x2553, 0x2565, 0x2556, 0x255f, 0x256b, 0x2562, 0x2559, 0x2568, 0x255c, 0x2551, 0x2550, 0x256d, 0x256e, 0x2570, 0x256f, 0xffed, /* 0xfa */ 0xe000, 0x92db, 0xe002, 0xe003, 0x854c, 0x42b5, 0x73ef, 0x51b5, 0x3649, 0xe009, 0xe00a, 0x9344, 0xe00c, 0x82ee, 0xe00e, 0x783c, 0x6744, 0x62df, 0xe012, 0xe013, 0xe014, 0xe015, 0xe016, 0x4fab, 0xe018, 0x5008, 0xe01a, 0xe01b, 0xe01c, 0xe01d, 0xe01e, 0x5029, 0xe020, 0x5fa4, 0xe022, 0xe023, 0x6edb, 0xe025, 0x507d, 0x5101, 0x347a, 0x510e, 0x986c, 0x3743, 0x8416, 0xe02d, 0xe02e, 0x5160, 0xe030, 0x516a, 0xe032, 0xe033, 0xe034, 0xe035, 0xe036, 0xe037, 0xe038, 0x5b82, 0x877d, 0xe03b, 0xe03c, 0x51b2, 0x51b8, 0x9d34, 0x51c9, 0x51cf, 0x51d1, 0x3cdc, 0x51d3, 0xe045, 0x51b3, 0x51e2, 0x5342, 0x51ed, 0x83cd, 0x693e, 0xe04c, 0x5f7b, 0x520b, 0x5226, 0x523c, 0x52b5, 0x5257, 0x5294, 0x52b9, 0x52c5, 0x7c15, 0x8542, 0x52e0, 0x860d, 0xe05a, 0x5305, 0xe05c, 0x5549, 0x6ed9, 0xe05f, 0xe060, 0xe061, 0x5333, 0x5344, 0xe064, 0x6ccb, 0xe066, 0x681b, 0x73d5, 0x604a, 0x3eaa, 0x38cc, 0xe06c, 0x71dd, 0x44a2, 0x536d, 0x5374, 0xe071, 0x537e, 0x537f, 0xe074, 0xe075, 0x77e6, 0x5393, 0xe078, 0x53a0, 0x53ab, 0x53ae, 0x73a7, 0xe07d, 0x3f59, 0x739c, 0x53c1, 0x53c5, 0x6c49, 0x4e49, 0x57fe, 0x53d9, 0x3aab, 0xe087, 0x53e0, 0xe089, 0xe08a, 0x53f6, 0xe08c, 0x5413, 0x7079, 0x552b, 0x6657, 0x6d5b, 0x546d, 0xe093, 0xe094, 0x555d, 0x548f, 0x54a4, 0x47a6, 0xe099, 0xe09a, 0x3db4, 0xe09c, /* 0xfb */ 0xe09d, 0xe09e, 0x5547, 0x4ced, 0x542f, 0x7417, 0x5586, 0x55a9, 0x5605, 0xe0a6, 0xe0a7, 0x4552, 0xe0a9, 0x66b3, 0xe0ab, 0x5637, 0x66cd, 0xe0ae, 0x66a4, 0x66ad, 0x564d, 0x564f, 0x78f1, 0x56f1, 0x9787, 0x53fe, 0x5700, 0x56ef, 0x56ed, 0xe0ba, 0x3623, 0xe0bc, 0x5746, 0xe0be, 0x6c6e, 0x708b, 0x5742, 0x36b1, 0xe0c3, 0x57e6, 0xe0c5, 0x5803, 0xe0c7, 0xe0c8, 0x5826, 0xe0ca, 0x585c, 0x58aa, 0x3561, 0x58e0, 0x58dc, 0xe0d0, 0x58fb, 0x5bff, 0x5743, 0xe0d4, 0xe0d5, 0x93d3, 0x35a1, 0x591f, 0x68a6, 0x36c3, 0x6e59, 0xe0dc, 0x5a24, 0x5553, 0xe0df, 0x8505, 0x59c9, 0xe0e2, 0xe0e3, 0xe0e4, 0xe0e5, 0x59d9, 0xe0e7, 0xe0e8, 0xe0e9, 0x6d71, 0xe0eb, 0xe0ec, 0x59f9, 0xe0ee, 0x5aab, 0x5a63, 0x36e6, 0xe0f2, 0x5a77, 0x3708, 0x5a96, 0x7465, 0x5ad3, 0xe0f8, 0xe0f9, 0x3d85, 0xe0fb, 0x3732, 0xe0fd, 0x5e83, 0x52d0, 0x5b76, 0x6588, 0x5b7c, 0xe103, 0x4004, 0x485d, 0xe106, 0x5bd5, 0x6160, 0xe109, 0xe10a, 0xe10b, 0x5bf3, 0x5b9d, 0x4d10, 0x5c05, 0xe110, 0x5c13, 0x73ce, 0x5c14, 0xe114, 0xe115, 0x5c49, 0x48dd, 0x5c85, 0x5ce9, 0x5cef, 0x5d8b, 0xe11c, 0xe11d, 0x5d10, 0x5d18, 0x5d46, 0xe121, 0x5cba, 0x5dd7, 0x82fc, 0x382d, 0xe126, 0xe127, 0xe128, 0x8287, 0x3836, 0x3bc2, 0x5e2e, 0x6a8a, 0x5e75, 0x5e7a, 0xe130, 0xe131, 0x53a6, 0x4eb7, 0x5ed0, 0x53a8, 0xe136, 0x5e09, 0x5ef4, 0xe139, /* 0xfc */ 0x5ef9, 0x5efb, 0x38a0, 0x5efc, 0x683e, 0x941b, 0x5f0d, 0xe141, 0xe142, 0x3ade, 0x48ae, 0xe145, 0x5f3a, 0xe147, 0xe148, 0x5f58, 0xe14a, 0x5f63, 0x97bd, 0xe14d, 0x5f72, 0x9340, 0xe150, 0x5fa7, 0x5db6, 0x3d5f, 0xe154, 0xe155, 0xe156, 0xe157, 0x91d6, 0xe159, 0xe15a, 0x6031, 0x6685, 0xe15d, 0x3963, 0x3dc7, 0x3639, 0x5790, 0xe162, 0x7971, 0x3e40, 0x609e, 0x60a4, 0x60b3, 0xe168, 0xe169, 0xe16a, 0x74a4, 0x50e1, 0x5aa0, 0x6164, 0x8424, 0x6142, 0xe171, 0xe172, 0x6181, 0x51f4, 0xe175, 0x6187, 0x5baa, 0xe178, 0xe179, 0x61d3, 0xe17b, 0xe17c, 0x61d0, 0x3932, 0xe17f, 0xe180, 0x6023, 0x615c, 0x651e, 0x638b, 0xe185, 0x62c5, 0xe187, 0x62d5, 0xe189, 0x636c, 0xe18b, 0x3a17, 0x6438, 0x63f8, 0xe18f, 0xe190, 0x6490, 0x6f8a, 0xe193, 0x9814, 0xe195, 0xe196, 0x64e1, 0x64e5, 0x947b, 0x3a66, 0x643a, 0x3a57, 0x654d, 0x6f16, 0xe19f, 0xe1a0, 0x6585, 0x656d, 0x655f, 0xe1a4, 0x65b5, 0xe1a6, 0x4b37, 0x65d1, 0x40d8, 0xe1aa, 0x65e0, 0x65e3, 0x5fdf, 0xe1ae, 0x6618, 0xe1b0, 0xe1b1, 0x6644, 0xe1b3, 0xe1b4, 0x664b, 0xe1b6, 0x6667, 0xe1b8, 0x6673, 0x6674, 0xe1bb, 0xe1bc, 0xe1bd, 0xe1be, 0xe1bf, 0x77c5, 0xe1c1, 0x99a4, 0x6702, 0xe1c4, 0xe1c5, 0x3b2b, 0x69fa, 0xe1c8, 0x675e, 0x6767, 0x6762, 0xe1cc, 0xe1cd, 0x67d7, 0x44e9, 0x6822, 0x6e50, 0x923c, 0x6801, 0xe1d4, 0xe1d5, 0x685d, /* 0xfd */ 0xe1d7, 0x69e1, 0x6a0b, 0xe1da, 0x6973, 0x68c3, 0xe1dd, 0x6901, 0x6900, 0x3d32, 0x3a01, 0xe1e2, 0x3b80, 0x67ac, 0x6961, 0xe1e6, 0x42fc, 0x6936, 0x6998, 0x3ba1, 0xe1eb, 0x8363, 0x5090, 0x69f9, 0xe1ef, 0xe1f0, 0x6a45, 0xe1f2, 0x6a9d, 0x3bf3, 0x67b1, 0x6ac8, 0xe1f7, 0x3c0d, 0x6b1d, 0xe1fa, 0x60de, 0x6b35, 0x6b74, 0xe1fe, 0x6eb5, 0xe200, 0xe201, 0xe202, 0x3740, 0x5421, 0xe205, 0x6be1, 0xe207, 0x6bdc, 0x6c37, 0xe20a, 0xe20b, 0xe20c, 0x6c5a, 0x8226, 0x6c79, 0xe210, 0x44c5, 0xe212, 0xe213, 0xe214, 0xe215, 0xe216, 0x36e5, 0x3ceb, 0xe219, 0x9b83, 0xe21b, 0xe21c, 0x7f8f, 0x6837, 0xe21f, 0xe220, 0xe221, 0x6d96, 0x6d5c, 0x6e7c, 0x6f04, 0xe226, 0xe227, 0xe228, 0x8533, 0xe22a, 0x51c7, 0x6c9c, 0x6e1d, 0x842e, 0xe22f, 0x6e2f, 0xe231, 0x7453, 0xe233, 0x79cc, 0x6e4f, 0x5a91, 0xe237, 0x6ff8, 0x370d, 0x6f9d, 0xe23b, 0x6efa, 0xe23d, 0xe23e, 0x4555, 0x93f0, 0x6f44, 0x6f5c, 0x3d4e, 0x6f74, 0xe245, 0x3d3b, 0x6f9f, 0xe248, 0x6fd3, 0xe24a, 0xe24b, 0xe24c, 0xe24d, 0xe24e, 0xe24f, 0x51df, 0xe251, 0xe252, 0xe253, 0xe254, 0x704b, 0x707e, 0x70a7, 0x7081, 0x70cc, 0x70d5, 0x70d6, 0x70df, 0x4104, 0x3de8, 0x71b4, 0x7196, 0xe261, 0x712b, 0x7145, 0x5a88, 0x714a, 0x716e, 0x5c9c, 0xe268, 0x714f, 0x9362, 0xe26b, 0x712c, 0xe26d, 0xe26e, 0xe26f, 0x71ba, 0xe271, 0x70bd, 0x720e, /* 0xfe */ 0x9442, 0x7215, 0x5911, 0x9443, 0x7224, 0x9341, 0xe27a, 0x722e, 0x7240, 0xe27d, 0x68bd, 0x7255, 0x7257, 0x3e55, 0xe282, 0x680d, 0x6f3d, 0x7282, 0x732a, 0x732b, 0xe288, 0xe289, 0x48ed, 0xe28b, 0x7328, 0x732e, 0x73cf, 0x73aa, 0xe290, 0xe291, 0x73c9, 0x7449, 0xe294, 0xe295, 0xe296, 0x6623, 0x36c5, 0xe299, 0xe29a, 0xe29b, 0x73f7, 0x7415, 0x6903, 0xe29f, 0x7439, 0xe2a1, 0x3ed7, 0x745c, 0xe2a4, 0x7460, 0xe2a6, 0x7447, 0x73e4, 0x7476, 0x83b9, 0x746c, 0x3730, 0x7474, 0x93f1, 0x6a2c, 0x7482, 0x4953, 0xe2b2, 0xe2b3, 0xe2b4, 0xe2b5, 0x5b46, 0xe2b7, 0xe2b8, 0x74c8, 0xe2ba, 0x750e, 0x74e9, 0x751e, 0xe2be, 0xe2bf, 0x5bd7, 0xe2c1, 0x9385, 0x754d, 0x754a, 0x7567, 0x756e, 0xe2c7, 0x3f04, 0xe2c9, 0x758e, 0x745d, 0x759e, 0x75b4, 0x7602, 0x762c, 0x7651, 0x764f, 0x766f, 0x7676, 0xe2d4, 0x7690, 0x81ef, 0x37f8, 0xe2d8, 0xe2d9, 0x76a1, 0x76a5, 0x76b7, 0x76cc, 0xe2de, 0x8462, 0xe2e0, 0xe2e1, 0xe2e2, 0x771e, 0x7726, 0x7740, 0x64af, 0xe2e7, 0x7758, 0xe2e9, 0x77af, 0xe2eb, 0xe2ec, 0xe2ed, 0x77f4, 0x7809, 0xe2f0, 0xe2f1, 0x68ca, 0x78af, 0x78c7, 0x78d3, 0x96a5, 0x792e, 0xe2f8, 0x78d7, 0x7934, 0x78b1, 0xe2fc, 0x8fb8, 0x8884, 0xe2ff, 0xe300, 0xe301, 0x7986, 0x8900, 0x6902, 0x7980, 0xe306, 0x799d, 0xe308, 0x793c, 0x79a9, 0x6e2a, 0xe30c, 0x3ea8, 0x79c6, 0xe30f, 0x79d4, }; static int big5hkscs_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c1 = s[0]; if ((c1 >= 0x81 && c1 <= 0xfe)) { if (n >= 2) { unsigned char c2 = s[1]; if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) { unsigned int i = 157 * (c1 - 0x81) + (c2 - (c2 >= 0xa1 ? 0x62 : 0x40)); unsigned short wc = 0xfffd; { if (i < 19782) wc = big5hkscs_2uni_page81[i]; } if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 2; } } return RET_ILSEQ; } return RET_TOOFEW(0); } return RET_ILSEQ; } static const unsigned short big5hkscs_2charset[23202] = { 0xa246, 0xa247, 0xa244, 0xa1b1, 0xc6d8, 0xa1c2, 0xa258, 0xa1d3, 0xa1a6, 0xa367, 0xa150, 0xa14d, 0x8859, 0x8857, 0x885d, 0x885b, 0x8866, 0x8861, 0x885f, 0xa1d1, 0x886a, 0x8868, 0x886f, 0x886d, 0x88a7, 0x8873, 0x8871, 0x8877, 0x8875, 0xa1d2, 0xc8fb, 0x887b, 0x8879, 0x88a2, 0x8856, 0x8867, 0x885a, 0x886c, 0x885c, 0x886e, 0x8870, 0xc8fc, 0x885e, 0x8874, 0xc8fa, 0x8878, 0x8858, 0x8869, 0x8872, 0x8860, 0x8876, 0x887a, 0x887c, 0x887d, 0x887e, 0x88a1, 0xc8f6, 0x886b, 0xc8f8, 0xc8f7, 0x88a8, 0xc8fe, 0xc8f9, 0xc8f5, 0xc8fd, 0xc6d9, 0xa3be, 0xa3bc, 0xa3bd, 0xa3bf, 0xa1c5, 0xa3bb, 0xa1c2, 0xa344, 0xa345, 0xa346, 0xa347, 0xa348, 0xa349, 0xa34a, 0xa34b, 0xa34c, 0xa34d, 0xa34e, 0xa34f, 0xa350, 0xa351, 0xa352, 0xa353, 0xa354, 0xa355, 0xa356, 0xa357, 0xa358, 0xa359, 0xa35a, 0xa35b, 0xa35c, 0xa35d, 0xa35e, 0xa35f, 0xa360, 0xa361, 0xa362, 0xa363, 0xa364, 0xa365, 0xa366, 0xa367, 0xa368, 0xa369, 0xa36a, 0xa36b, 0xa36c, 0xa36d, 0xa36e, 0xa36f, 0xa370, 0xa371, 0xa372, 0xa373, 0xc7f9, 0xc7f3, 0xc7f4, 0xc7f5, 0xc7f6, 0xc7f7, 0xc7f8, 0xc7fa, 0xc7fb, 0xc7fc, 0xc7fd, 0xc7fe, 0xc840, 0xc841, 0xc842, 0xc843, 0xc844, 0xc845, 0xc846, 0xc847, 0xc848, 0xc849, 0xc84a, 0xc84b, 0xc84c, 0xc84d, 0xc84e, 0xc84f, 0xc850, 0xc851, 0xc852, 0xc853, 0xc854, 0xc855, 0xc856, 0xc857, 0xc858, 0xc859, 0xc85a, 0xc85c, 0xc85d, 0xc85e, 0xc85f, 0xc860, 0xc861, 0xc862, 0xc863, 0xc864, 0xc865, 0xc866, 0xc867, 0xc868, 0xc869, 0xc86a, 0xc86b, 0xc86c, 0xc86d, 0xc86e, 0xc86f, 0xc870, 0xc871, 0xc872, 0xc873, 0xc874, 0xc875, 0xc85b, 0x8863, 0x88a4, 0x8865, 0x88a6, 0xa156, 0xa158, 0xa277, 0xa1fc, 0xa1a5, 0xa1a6, 0xa1a7, 0xa1a8, 0xa145, 0xa3bb, 0xa14c, 0xa14b, 0xa145, 0xa1ac, 0xa1b2, 0xa1ab, 0xa1b0, 0xa1c3, 0xa24a, 0xa1c1, 0xa24b, 0xc8d2, 0xc8d3, 0xa2b9, 0xa2ba, 0xa2bb, 0xa2bc, 0xa2bd, 0xa2be, 0xa2bf, 0xa2c0, 0xa2c1, 0xa2c2, 0xc6b5, 0xc6b6, 0xc6b7, 0xc6b8, 0xc6b9, 0xc6ba, 0xc6bb, 0xc6bc, 0xc6bd, 0xc6be, 0xa1f6, 0xa1f4, 0xa1f7, 0xa1f5, 0xa1f8, 0xa1f9, 0xa1fb, 0xa1fa, 0xc877, 0xc878, 0xc876, 0xa241, 0xa242, 0xa258, 0xa1d4, 0xa1db, 0xa1e8, 0xa1e7, 0xa1fd, 0xa1fc, 0xa1e4, 0xa1e5, 0xa1ec, 0xa1ed, 0xa1ef, 0xa1ee, 0xa1dc, 0xa1da, 0xa1dd, 0xa1dd, 0xa1d8, 0xa1d9, 0xa1f2, 0xa1f3, 0xa1e6, 0xa1e9, 0xa15b, 0xc6a1, 0xc6a2, 0xc6a3, 0xc6a4, 0xc6a5, 0xc6a6, 0xc6a7, 0xc6a8, 0xc6a9, 0xc6aa, 0xc6ab, 0xc6ac, 0xc6ad, 0xc6ae, 0xc6af, 0xc6b0, 0xc6b1, 0xc6b2, 0xc6b3, 0xc6b4, 0xa277, 0xa278, 0xa27a, 0xa27b, 0xa27c, 0xa27d, 0xa275, 0xa274, 0xa273, 0xa272, 0xa271, 0xf9f9, 0xf9f8, 0xf9e6, 0xf9ef, 0xf9dd, 0xf9e8, 0xf9f1, 0xf9df, 0xf9ec, 0xf9f5, 0xf9e3, 0xf9ee, 0xf9f7, 0xf9e5, 0xf9e9, 0xf9f2, 0xf9e0, 0xf9eb, 0xf9f4, 0xf9e2, 0xf9e7, 0xf9f0, 0xf9de, 0xf9ed, 0xf9f6, 0xf9e4, 0xf9ea, 0xf9f3, 0xf9e1, 0xf9fa, 0xf9fb, 0xf9fd, 0xf9fc, 0xa2ac, 0xa2ad, 0xa2ae, 0xa15a, 0xa262, 0xa263, 0xa264, 0xa265, 0xa266, 0xa267, 0xa268, 0xa269, 0xa270, 0xa26f, 0xa26e, 0xa26d, 0xa26c, 0xa26b, 0xa26a, 0xf9fe, 0xa276, 0xa279, 0xa1bd, 0xa1bc, 0xa1b6, 0xa1b5, 0xa1bf, 0xa1be, 0xa1bb, 0xa1ba, 0xa1b3, 0xa1b7, 0xa1b4, 0xa2a8, 0xa2a9, 0xa2ab, 0xa2aa, 0xa1b9, 0xa1b8, 0xa1f3, 0xa1f0, 0xa1f2, 0xa1f1, 0xc6e6, 0xc8d6, 0xc8d7, 0xc8d8, 0xc8d9, 0xc8da, 0xc8db, 0xc8dc, 0xc8dd, 0xc8de, 0xc8df, 0xc8e0, 0xc8e1, 0xc8e2, 0xc8e3, 0xc8e4, 0xc8e5, 0xc8e6, 0xc8e7, 0xc8e8, 0xc8e9, 0xc8ea, 0xc8eb, 0xc8ec, 0xc8ed, 0xc8ee, 0xc8ef, 0xc8f0, 0xc8f1, 0xc6cd, 0xa140, 0xa142, 0xa143, 0xa1b2, 0xc6e0, 0xc6e1, 0xc6e2, 0xa171, 0xa172, 0xa16d, 0xa16e, 0xa175, 0xa176, 0xa179, 0xa17a, 0xa169, 0xa16a, 0xa245, 0xa165, 0xa166, 0xa1e3, 0xa1a9, 0xa1aa, 0xa2c3, 0xa2c4, 0xa2c5, 0xa2c6, 0xa2c7, 0xa2c8, 0xa2c9, 0xa2ca, 0xa2cb, 0xa1ca, 0xc6e7, 0xc6e8, 0xc6e9, 0xc6ea, 0xc6eb, 0xc6ec, 0xc6ed, 0xc6ee, 0xc6ef, 0xc6f0, 0xc6f1, 0xc6f2, 0xc6f3, 0xc6f4, 0xc6f5, 0xc6f6, 0xc6f7, 0xc6f8, 0xc6f9, 0xc6fa, 0xc6fb, 0xc6fc, 0xc6fd, 0xc6fe, 0xc740, 0xc741, 0xc742, 0xc743, 0xc744, 0xc745, 0xc746, 0xc747, 0xc748, 0xc749, 0xc74a, 0xc74b, 0xc74c, 0xc74d, 0xc74e, 0xc74f, 0xc750, 0xc751, 0xc752, 0xc753, 0xc754, 0xc755, 0xc756, 0xc757, 0xc758, 0xc759, 0xc75a, 0xc75b, 0xc75c, 0xc75d, 0xc75e, 0xc75f, 0xc760, 0xc761, 0xc762, 0xc763, 0xc764, 0xc765, 0xc766, 0xc767, 0xc768, 0xc769, 0xc76a, 0xc76b, 0xc76c, 0xc76d, 0xc76e, 0xc76f, 0xc770, 0xc771, 0xc772, 0xc773, 0xc774, 0xc775, 0xc776, 0xc777, 0xc778, 0xc779, 0xc77a, 0xc8d4, 0xc8d5, 0xc6dc, 0xc6dd, 0xc77b, 0xc77c, 0xc77d, 0xc77e, 0xc7a1, 0xc7a2, 0xc7a3, 0xc7a4, 0xc7a5, 0xc7a6, 0xc7a7, 0xc7a8, 0xc7a9, 0xc7aa, 0xc7ab, 0xc7ac, 0xc7ad, 0xc7ae, 0xc7af, 0xc7b0, 0xc7b1, 0xc7b2, 0xc7b3, 0xc7b4, 0xc7b5, 0xc7b6, 0xc7b7, 0xc7b8, 0xc7b9, 0xc7ba, 0xc7bb, 0xc7bc, 0xc7bd, 0xc7be, 0xc7bf, 0xc7c0, 0xc7c1, 0xc7c2, 0xc7c3, 0xc7c4, 0xc7c5, 0xc7c6, 0xc7c7, 0xc7c8, 0xc7c9, 0xc7ca, 0xc7cb, 0xc7cc, 0xc7cd, 0xc7ce, 0xc7cf, 0xc7d0, 0xc7d1, 0xc7d2, 0xc7d3, 0xc7d4, 0xc7d5, 0xc7d6, 0xc7d7, 0xc7d8, 0xc7d9, 0xc7da, 0xc7db, 0xc7dc, 0xc7dd, 0xc7de, 0xc7df, 0xc7e0, 0xc7e1, 0xc7e2, 0xc7e3, 0xc7e4, 0xc7e5, 0xc7e6, 0xc7e7, 0xc7e8, 0xc7e9, 0xc7ea, 0xc7eb, 0xc7ec, 0xc7ed, 0xc7ee, 0xc7ef, 0xc7f0, 0xc7f1, 0xc7f2, 0xc6e3, 0xc6da, 0xc6db, 0xa374, 0xa375, 0xa376, 0xa377, 0xa378, 0xa379, 0xa37a, 0xa37b, 0xa37c, 0xa37d, 0xa37e, 0xa3a1, 0xa3a2, 0xa3a3, 0xa3a4, 0xa3a5, 0xa3a6, 0xa3a7, 0xa3a8, 0xa3a9, 0xa3aa, 0xa3ab, 0xa3ac, 0xa3ad, 0xa3ae, 0xa3af, 0xa3b0, 0xa3b1, 0xa3b2, 0xa3b3, 0xa3b4, 0xa3b5, 0xa3b6, 0xa3b7, 0xa3b8, 0xa3b9, 0xa3ba, 0xa440, 0xa447, 0xa454, 0xa57c, 0xa457, 0xa4a4, 0xa455, 0xa5d2, 0xa441, 0xa4fe, 0xa442, 0xa4d1, 0xa661, 0xa448, 0xa440, 0xa447, 0xa454, 0xa57c, 0xa4ad, 0xa4bb, 0xa443, 0xa44b, 0xa445, 0xa451, 0xa4eb, 0xa4f5, 0xa4f4, 0xa4ec, 0xaaf7, 0xa467, 0xa4e9, 0xc8d1, 0xa6b3, 0xaac0, 0xa657, 0xaf53, 0xb05d, 0xafac, 0xb3d2, 0xa54e, 0xa949, 0xbec7, 0xbaca, 0xa5f8, 0xb8ea, 0xa8f3, 0xb2bd, 0xa5f0, 0xa6db, 0xa6dc, 0xa440, 0xa447, 0xa454, 0xa57c, 0xa4ad, 0xa4bb, 0xa443, 0xa44b, 0xa445, 0xa451, 0xa4eb, 0xa4f5, 0xa4f4, 0xa4ec, 0xaaf7, 0xa467, 0xa4e9, 0xaee8, 0xa6b3, 0xaac0, 0xa657, 0xaf53, 0xb05d, 0xafac, 0xb3d2, 0xafb5, 0xa86b, 0xa46b, 0xbe41, 0xc075, 0xa64c, 0xaa60, 0xb6b5, 0xa5f0, 0xbc67, 0xa1c0, 0xa457, 0xa4a4, 0xa455, 0xa5aa, 0xa56b, 0xc2e5, 0xa976, 0xbec7, 0xbaca, 0xa5f8, 0xb8ea, 0xa8f3, 0xa95d, 0xa255, 0xa256, 0xa250, 0xa251, 0xa252, 0xa254, 0xa257, 0xa253, 0xa1eb, 0xa1ea, 0xa24f, 0x9277, 0x96df, 0x89d5, 0x93cd, 0x9bdf, 0xfa68, 0x89da, 0x8f59, 0x89db, 0x8f5d, 0x89dc, 0x96f7, 0x8ada, 0x8bdc, 0x97db, 0x9e53, 0x9daa, 0x9bea, 0x8a6e, 0x8bc8, 0x89e8, 0x89ea, 0x8c4b, 0xfb70, 0x89ed, 0x94dd, 0x89ee, 0x9eb4, 0x8ad3, 0x92db, 0x94db, 0x89f9, 0xfb7a, 0x89fb, 0x9efc, 0x89fc, 0x89bf, 0x89fe, 0x89e6, 0x9d46, 0x9dee, 0xa07e, 0xa068, 0x98e9, 0x8b68, 0x8dfd, 0x8bbe, 0x9fd9, 0x8aeb, 0x9fd7, 0x8b6a, 0x9c5c, 0x8bb1, 0xfb5e, 0x9df3, 0xa0d0, 0xfc66, 0x92e9, 0x9aec, 0x8fab, 0xfa48, 0x8e45, 0x9c6f, 0x9ede, 0x89ef, 0x96e9, 0x9ebb, 0x94de, 0x9eb8, 0x97ba, 0xfb65, 0x95d6, 0x9cbb, 0x97da, 0x8f45, 0xfb7d, 0x9158, 0xfe64, 0x9856, 0x9b4d, 0x935b, 0x95c7, 0x97e7, 0x9359, 0x91f5, 0x97b8, 0xfda2, 0xfbb6, 0x92fa, 0x9357, 0x8ba6, 0xfbb9, 0x97b0, 0xfdc4, 0x9ca1, 0x91f2, 0x91f9, 0x8ff1, 0x9745, 0x9853, 0xfe78, 0xfbc1, 0x9251, 0x9dad, 0xfd6c, 0xfa6b, 0x9bc2, 0x9a7b, 0x8b60, 0x934b, 0x9abd, 0x91b7, 0x95b4, 0xfec5, 0x9ef0, 0x8d64, 0x9269, 0x8d67, 0xfbea, 0xfbef, 0x8d68, 0x93eb, 0xfc42, 0x9166, 0xfacd, 0x93dd, 0x8bcc, 0x8d6d, 0x8d6e, 0x96a8, 0xfca6, 0x8d6f, 0x8d70, 0xfc64, 0x9060, 0x8d74, 0x97c3, 0x8ad0, 0x9274, 0x9bbe, 0x9cc8, 0x9cba, 0x8d78, 0x9eb9, 0x955a, 0x91b4, 0x8a48, 0x8d7d, 0x8a7d, 0x8ac2, 0xfd4a, 0x8da1, 0x8ad1, 0xfcb4, 0x8b47, 0x93a4, 0x9eda, 0x8a51, 0x8da6, 0x9ec5, 0xfcc4, 0xa078, 0x94b5, 0xfcc2, 0x8a6b, 0x8dab, 0xfae8, 0x8dad, 0xfc49, 0x93c1, 0x906f, 0x8db0, 0x947e, 0x90fa, 0x9479, 0x8db2, 0xfcee, 0x997b, 0x8db4, 0x8db7, 0x91b3, 0x8dbb, 0x8dba, 0x8dbc, 0x9044, 0xfd4c, 0x93e4, 0x93e0, 0xfd53, 0x8dc3, 0x9bb8, 0xfbf0, 0x93e9, 0x93f6, 0x8dc5, 0x8dca, 0x8dcc, 0xfd5d, 0x93b5, 0xfd61, 0x9cf8, 0x9252, 0xa0e8, 0x9ca5, 0x8c56, 0x8dd6, 0x97c0, 0xa0de, 0x97d2, 0xfaa5, 0xfda3, 0x8ddb, 0x8eaf, 0x91b5, 0xfd49, 0xfdd1, 0x8deb, 0x97c6, 0xfdce, 0x90fc, 0xfc59, 0x96d6, 0x97c5, 0x8def, 0x97d7, 0x8df0, 0x96a6, 0xfbbf, 0x8df3, 0x9449, 0x8df5, 0x9872, 0x8e6b, 0xfafd, 0x8f50, 0x9dcc, 0xfc65, 0x8c44, 0x996e, 0x94a1, 0x8f63, 0xa0da, 0x9253, 0xfde9, 0x9db5, 0x9879, 0x9d5d, 0x8d63, 0x9669, 0x9f70, 0xfc6a, 0x8ac7, 0x89d7, 0xfe4d, 0x9edd, 0xfefb, 0x98bc, 0xfacc, 0x95b0, 0x9464, 0x936f, 0x94b9, 0x95ec, 0x91ee, 0x98c3, 0x95f6, 0x8ffd, 0x98c5, 0x9766, 0xfe6e, 0x97dd, 0x8caa, 0x92d2, 0x9761, 0x98cb, 0x95f0, 0x975d, 0x91e3, 0x98cc, 0x9469, 0x98cd, 0x98ce, 0x95fc, 0x94a3, 0x9662, 0xfeb6, 0x9463, 0x98d0, 0x98d1, 0x9475, 0xfae0, 0x9472, 0x98d6, 0x8af0, 0x98d9, 0x98db, 0x98dd, 0x98a8, 0x8a6d, 0x8afb, 0x8aae, 0xfbc9, 0x8c5d, 0x98e4, 0x98e6, 0x98e8, 0x8a4d, 0x9257, 0x95df, 0xa0ac, 0x98eb, 0x98ec, 0x8cc3, 0x98f4, 0x8ab8, 0x9ee7, 0x94bc, 0xfcd1, 0x9cc6, 0x9e7e, 0x98fe, 0xfde8, 0x9940, 0x94c9, 0x94d3, 0x9946, 0x90c0, 0x94d1, 0x9573, 0x93c2, 0x9948, 0x994b, 0x8e55, 0x994e, 0x8efe, 0x8e59, 0x94ec, 0x94ef, 0x8c60, 0x8f74, 0x9955, 0x9544, 0x8ccb, 0x9956, 0x9959, 0x995b, 0x8cc4, 0xfa45, 0x90b7, 0x9743, 0x95cd, 0x97c9, 0xfd50, 0x8eb9, 0x95c6, 0x9967, 0x8ab9, 0x8dfc, 0x8a76, 0x9d51, 0x9973, 0x9d4f, 0x997a, 0x9564, 0x99a1, 0x99a5, 0x99a7, 0x8eed, 0x99ad, 0x946e, 0x8f70, 0xfad0, 0x99b3, 0xa053, 0x965c, 0xfd7a, 0x97fe, 0x92bd, 0x97fd, 0x8f64, 0xfcf7, 0x9562, 0x97cd, 0x9e64, 0x924c, 0x8ec9, 0x99bc, 0x9da5, 0x8f54, 0x8f7c, 0x8ea2, 0x8f7a, 0x97ae, 0x96c8, 0x99c3, 0x90d6, 0x9cbe, 0x8f76, 0x9470, 0xfb4b, 0xfdca, 0x8ec7, 0xa0f9, 0x8fa9, 0x99c7, 0x90d7, 0x9edf, 0x99ce, 0x8fba, 0x8feb, 0x99cf, 0x8fc2, 0x92c9, 0x97dc, 0x95b3, 0x9c79, 0x95b2, 0x8fdb, 0x9be3, 0x9e7a, 0x9bee, 0x99de, 0xfafa, 0x9ee5, 0x8a52, 0x99e1, 0x8a67, 0x8bb5, 0x8aac, 0x99e9, 0xfbca, 0x97de, 0x95d1, 0x99f5, 0xfc4a, 0x9ba9, 0xfbdc, 0xfe56, 0x9ea4, 0x9d49, 0x95db, 0x89c5, 0x99f8, 0x9664, 0x9055, 0x96d4, 0x977c, 0x964d, 0x97e1, 0x9a48, 0x9a49, 0xfe7d, 0x90aa, 0x9a50, 0x9347, 0x8ed8, 0x90c9, 0x9a55, 0x90bc, 0x9a58, 0x8bb8, 0x90d5, 0x9641, 0x9a5a, 0x9a5c, 0x97c2, 0x8abb, 0x9baa, 0x90f5, 0x9a60, 0x9145, 0x8c58, 0x9a63, 0x8c49, 0x8bb6, 0xfccf, 0x966b, 0x9a6e, 0x914f, 0x9746, 0xa0e6, 0x92d7, 0x9675, 0x93d4, 0x91bb, 0x9679, 0x9a70, 0x9678, 0x91cd, 0x9c4a, 0xa06f, 0xa06a, 0x915f, 0x9fa5, 0x89ba, 0x9ecd, 0x9a79, 0x9dce, 0x8cd2, 0x9d73, 0x96b9, 0x96bc, 0x9cd1, 0x89b7, 0x9eee, 0xfb43, 0x9ec9, 0xfbd3, 0x91ae, 0x9d78, 0x9d7b, 0xa440, 0xa442, 0xa443, 0x9eb3, 0xc945, 0xa456, 0xa454, 0xa457, 0xa455, 0xc946, 0xa4a3, 0xc94f, 0xc94d, 0xa4a2, 0xa4a1, 0xa542, 0xa541, 0xa540, 0xa543, 0xa4fe, 0x9eb2, 0x9dd6, 0xa5e0, 0xa5e1, 0x994f, 0x89ce, 0xa8c3, 0x8bc0, 0x9fc4, 0xa458, 0x8bd4, 0xa4a4, 0xc950, 0x8c72, 0xa4a5, 0xc963, 0xa6ea, 0xcbb1, 0xc6bf, 0x8bf9, 0xa459, 0xa4a6, 0xa544, 0xc964, 0x8946, 0xc6c0, 0xc940, 0xa444, 0xa45b, 0xc947, 0xa45c, 0xfae5, 0xa4a7, 0xa545, 0xa547, 0xa546, 0xa5e2, 0xa5e3, 0xa8c4, 0xadbc, 0xa441, 0xc87b, 0x8bc6, 0xc941, 0xa445, 0xa45e, 0xa45d, 0xa5e4, 0x9c57, 0xa8c5, 0x9afb, 0xb0ae, 0xd44b, 0x89d0, 0x89cf, 0xb6c3, 0xdcb1, 0xdcb2, 0xc6c1, 0xa446, 0x89d1, 0xa4a9, 0x89e2, 0xa8c6, 0xa447, 0xc948, 0xa45f, 0xa4aa, 0xa4ac, 0xc951, 0xa4ad, 0xa4ab, 0x927e, 0xa5e5, 0x9dba, 0xa8c7, 0xa8c8, 0xab45, 0xc6c2, 0xa460, 0xa4ae, 0x8c6f, 0xa5e6, 0xa5e8, 0xa5e7, 0xa6eb, 0xa8c9, 0xa8ca, 0xab46, 0xab47, 0xadbd, 0xdcb3, 0xfbf8, 0xf6d6, 0xa448, 0x8bc7, 0x926b, 0x89d2, 0xa4b0, 0xa4af, 0xc952, 0xa4b1, 0xa4b7, 0xa4b2, 0xa4b3, 0xc954, 0xc953, 0xa4b5, 0xa4b6, 0xa4b4, 0x9fcf, 0xa54a, 0xa54b, 0xa54c, 0xa54d, 0xa549, 0xa550, 0xc96a, 0xc966, 0xc969, 0xa551, 0xa561, 0xc968, 0xa54e, 0xa54f, 0xa548, 0xc965, 0xc967, 0x9da9, 0x89d3, 0x99e2, 0xa5f5, 0xc9b0, 0xa5f2, 0xa5f6, 0xc9ba, 0xc9ae, 0xa5f3, 0xc9b2, 0x9267, 0xa5f4, 0xa5f7, 0xa5e9, 0xc9b1, 0xa5f8, 0xc9b5, 0x92a4, 0xc9b9, 0xc9b6, 0xc9b3, 0xa5ea, 0xa5ec, 0xa5f9, 0xa5ee, 0xc9ab, 0xa5f1, 0xa5ef, 0xa5f0, 0xc9bb, 0xc9b8, 0xc9af, 0xa5ed, 0x8c73, 0xc9ac, 0xa5eb, 0x894e, 0xc9b4, 0xc9b7, 0x894f, 0x9278, 0xc9ad, 0xca66, 0xa742, 0xa6f4, 0x91b6, 0xca67, 0xa6f1, 0xa744, 0x89d4, 0xa6f9, 0x9fd2, 0xa6f8, 0xca5b, 0xa6fc, 0xa6f7, 0xca60, 0xca68, 0xca64, 0x92a7, 0xa6fa, 0x95a2, 0xa6fd, 0xa6ee, 0xa747, 0xca5d, 0x926e, 0xcbbd, 0xa6ec, 0xa743, 0xa6ed, 0xa6f5, 0xa6f6, 0xca62, 0xca5e, 0xa6fb, 0xa6f3, 0xca5a, 0xa6ef, 0xca65, 0xa745, 0xa748, 0xa6f2, 0xa740, 0xa746, 0xa6f0, 0xca63, 0xa741, 0xca69, 0xca5c, 0xa6fe, 0xca5f, 0xca61, 0xa8d8, 0xcbbf, 0xcbcb, 0xa8d0, 0xcbcc, 0xa8cb, 0xa8d5, 0x96ea, 0xa8ce, 0xcbb9, 0xa8d6, 0xcbb8, 0xcbbc, 0xcbc3, 0xcbc1, 0xa8de, 0xa8d9, 0xcbb3, 0xcbb5, 0xa8db, 0xa8cf, 0xcbb6, 0xcbc2, 0xcbc9, 0xa8d4, 0xcbbb, 0xcbb4, 0xa8d3, 0xcbb7, 0xa8d7, 0xcbba, 0x926f, 0xa8d2, 0xa8cd, 0xa8dc, 0xcbc4, 0xa8dd, 0xcbc8, 0xcbc6, 0xcbca, 0xa8da, 0xcbbe, 0xcbb2, 0xcbc0, 0xa8d1, 0xcbc5, 0xa8cc, 0xcbc7, 0x92a3, 0x8950, 0xfa57, 0xab56, 0xab4a, 0x9866, 0xcde0, 0xcde8, 0xab49, 0xab51, 0xab5d, 0xcdee, 0xcdec, 0xcde7, 0x89d6, 0xab4b, 0xcded, 0xcde3, 0xab59, 0xab50, 0xab58, 0xcdde, 0xcdea, 0x98b2, 0xcde1, 0xab54, 0xcde2, 0x92ab, 0xcddd, 0xab5b, 0xab4e, 0xab57, 0xab4d, 0xcddf, 0xcde4, 0xcdeb, 0xab55, 0xab52, 0xcde6, 0xab5a, 0xcde9, 0xcde5, 0xab4f, 0xab5c, 0xab53, 0xab4c, 0xab48, 0x96de, 0x92ac, 0xcdef, 0xadd7, 0xadc1, 0x8c70, 0xadd1, 0x9f6e, 0xadd6, 0xd0d0, 0xd0cf, 0xd0d4, 0xd0d5, 0xadc4, 0x8ef2, 0xadcd, 0x9f6c, 0xadda, 0xadce, 0x89d8, 0xd0c9, 0xadc7, 0xd0ca, 0xfa59, 0xaddc, 0xadd3, 0xadbe, 0xadbf, 0xd0dd, 0xb0bf, 0xadcc, 0xadcb, 0xd0cb, 0xadcf, 0xd45b, 0xadc6, 0xd0d6, 0xadd5, 0xadd4, 0xadca, 0xd0ce, 0xd0d7, 0xd0c8, 0xadc9, 0xd0d8, 0xadd2, 0xd0cc, 0xadc0, 0xadc3, 0xadc2, 0xd0d9, 0xadd0, 0xadc5, 0xadd9, 0xaddb, 0xd0d3, 0xadd8, 0x92a8, 0xd0db, 0xd0cd, 0xd0dc, 0xd0d1, 0x9163, 0xd0da, 0xd0d2, 0x8c40, 0xadc8, 0xd463, 0xd457, 0xb0b3, 0xd45c, 0xd462, 0xb0b2, 0xd455, 0xb0b6, 0xd459, 0xd452, 0xb0b4, 0xd456, 0xb0b9, 0xb0be, 0xd467, 0xd451, 0xb0ba, 0x9f73, 0xd466, 0x92ad, 0xb0b5, 0xd458, 0xb0b1, 0xd453, 0xd44f, 0xd45d, 0xd450, 0xd44e, 0xd45a, 0xd460, 0xd461, 0xb0b7, 0x9be9, 0xd85b, 0xd45e, 0xd44d, 0xd45f, 0x92a9, 0xb0c1, 0xd464, 0xb0c0, 0xd44c, 0xd454, 0xd465, 0xb0bc, 0xb0bb, 0xb0b8, 0xb0bd, 0xb0af, 0xb0b0, 0xb3c8, 0x92aa, 0xd85e, 0xd857, 0xb3c5, 0xd85f, 0x89d9, 0xd855, 0xd858, 0xb3c4, 0xd859, 0xfd56, 0xb3c7, 0xd85d, 0xd853, 0xd852, 0xb3c9, 0xb3ca, 0xb3c6, 0xb3cb, 0xd851, 0xd85c, 0xd85a, 0xd854, 0xb3c3, 0xd856, 0x9fa8, 0xb6ca, 0xb6c4, 0xdcb7, 0xb6cd, 0xdcbd, 0xdcc0, 0xb6c6, 0xb6c7, 0xdcba, 0xb6c5, 0xdcc3, 0xb6cb, 0xdcc4, 0xdcbf, 0xb6cc, 0x8c71, 0xdcb4, 0xb6c9, 0xdcb5, 0xdcbe, 0xdcbc, 0xdcb8, 0xb6c8, 0xdcb6, 0xb6ce, 0xdcbb, 0xdcc2, 0xdcb9, 0xdcc1, 0x92a1, 0xb9b6, 0xb9b3, 0x90e3, 0xb9b4, 0xe0f9, 0xe0f1, 0xb9b2, 0xb9af, 0xe0f2, 0xa0a6, 0xb9b1, 0xe0f5, 0xe0f7, 0x94ab, 0xe0fe, 0xfc72, 0xe0fd, 0xe0f8, 0xb9ae, 0xe0f0, 0xb9ac, 0xe0f3, 0xb9b7, 0xe0f6, 0xe0fa, 0xb9b0, 0xb9ad, 0xe0fc, 0xe0fb, 0xb9b5, 0xe0f4, 0x97c4, 0xbbf8, 0xe4ec, 0xe4e9, 0xbbf9, 0xbbf7, 0x92ae, 0xe4f0, 0xe4ed, 0xe4e6, 0xbbf6, 0xfa67, 0xbbfa, 0xe4e7, 0xbbf5, 0xbbfd, 0xe4ea, 0xe4eb, 0xbbfb, 0xbbfc, 0xe4f1, 0xe4ee, 0xe4ef, 0x92a2, 0xfa69, 0xbeaa, 0xe8f8, 0xbea7, 0xe8f5, 0xbea9, 0xbeab, 0xe8f6, 0xbea8, 0xe8f7, 0xe8f4, 0xc076, 0xecbd, 0xc077, 0xecbb, 0xecbc, 0xecba, 0xecb9, 0xecbe, 0xc075, 0x9268, 0xefb8, 0xefb9, 0xe4e8, 0xefb7, 0xc078, 0xc35f, 0xf1eb, 0xf1ec, 0xc4d7, 0xc4d8, 0xf5c1, 0xf5c0, 0xc56c, 0xc56b, 0xf7d0, 0xa449, 0xa461, 0xa4b9, 0xa4b8, 0xa553, 0xa552, 0xa5fc, 0xa5fb, 0xa5fd, 0xa5fa, 0xa74a, 0xa749, 0xa74b, 0xa8e0, 0xa8df, 0xa8e1, 0x8951, 0xab5e, 0xa259, 0xd0de, 0xa25a, 0xb0c2, 0xa25c, 0xa25b, 0xd860, 0xfa6f, 0xa25d, 0xb9b8, 0xa25e, 0xa44a, 0xa4ba, 0xa5fe, 0xa8e2, 0xfa71, 0xa44b, 0xa4bd, 0xa4bb, 0xa4bc, 0xa640, 0x8952, 0xa74c, 0xa8e4, 0xa8e3, 0xa8e5, 0x945a, 0xaddd, 0xbeac, 0xc6c3, 0x89dd, 0xc94e, 0xc8a2, 0xa554, 0xa555, 0xa641, 0xca6a, 0xab60, 0xab5f, 0xd0e0, 0xd0df, 0xb0c3, 0xc6c4, 0xa4be, 0xc955, 0x9e52, 0x8953, 0xcbcd, 0xab61, 0xade0, 0xadde, 0xaddf, 0x9e55, 0x92ba, 0xbead, 0xc6c5, 0xa556, 0x8c5b, 0xa642, 0xc9bc, 0xfa7d, 0xfaa8, 0x9a68, 0xfa47, 0xa74d, 0xa74e, 0xfa7e, 0xca6b, 0xcbce, 0xa8e6, 0xcbcf, 0x92bb, 0xd0e2, 0xd0e3, 0xade3, 0xfdb6, 0xd0e4, 0xfaa2, 0xd0e1, 0xade4, 0xade2, 0xade1, 0xd0e5, 0xfaa3, 0xd468, 0xfaa4, 0x9bb4, 0xfaa6, 0xd861, 0xdcc5, 0xe140, 0x89df, 0xbbfe, 0xbeae, 0xe8f9, 0xfddb, 0xa44c, 0xa45a, 0xfaa9, 0x8954, 0xfaab, 0xb0c4, 0xb3cd, 0xb9b9, 0xfc7a, 0xc942, 0xa4bf, 0xa559, 0xa557, 0xa558, 0x89e0, 0xa8e7, 0x9f4f, 0xa44d, 0xa44e, 0xc87d, 0xa462, 0x89e1, 0xa4c0, 0xa4c1, 0xa4c2, 0xc9be, 0xa55a, 0xfab0, 0xc96b, 0xa646, 0xc9bf, 0xa644, 0xa645, 0xc9bd, 0xa647, 0xa643, 0xca6c, 0xaaec, 0xca6d, 0x9fcd, 0xa0e7, 0xca6e, 0xa750, 0xa74f, 0xfab1, 0x89a6, 0xa753, 0xa751, 0xa752, 0xa8ed, 0xa8ec, 0xcbd4, 0xcbd1, 0xcbd2, 0x9efa, 0xcbd0, 0xa8ee, 0xa8ea, 0xa8e9, 0xa8eb, 0xa8e8, 0xfab2, 0xa8ef, 0xab63, 0xcdf0, 0xcbd3, 0xab68, 0xcdf1, 0xab64, 0xab67, 0xab66, 0xab65, 0xab62, 0xd0e8, 0xade7, 0xd0eb, 0xade5, 0xfab4, 0x92c4, 0xd0e7, 0xade8, 0xade6, 0xade9, 0xd0e9, 0xd0ea, 0x9f6f, 0xd0e6, 0xd0ec, 0x8bb0, 0xb3d1, 0xb0c5, 0xd469, 0xd46b, 0xd46a, 0xd46c, 0xb0c6, 0xb3ce, 0x9fac, 0xb3cf, 0xb3d0, 0xb6d0, 0xdcc7, 0x89e3, 0xdcc6, 0xdcc8, 0xdcc9, 0xb6d1, 0xb6cf, 0xe141, 0xe142, 0xb9bb, 0xb9ba, 0xe35a, 0xbc40, 0xbc41, 0xbc42, 0xbc44, 0xe4f2, 0xe4f3, 0xbc43, 0x9bd3, 0x89e4, 0xbeaf, 0xbeb0, 0xfab5, 0xf1ed, 0xf5c3, 0xf5c2, 0xf7d1, 0x9fd5, 0xa44f, 0xa55c, 0xa55b, 0x8955, 0xa648, 0x92c5, 0xc9c0, 0x8956, 0xa755, 0xa756, 0xa754, 0xa757, 0xca6f, 0xca70, 0xfab3, 0xfab6, 0xa8f1, 0xcbd5, 0xa8f0, 0xcdf2, 0xab6c, 0xcdf3, 0xab6b, 0xfab7, 0xab69, 0xab6a, 0x9edc, 0xd0ed, 0xfbc4, 0x9f71, 0xb0c7, 0xd46e, 0xb0ca, 0xd46d, 0xb1e5, 0xb0c9, 0xb0c8, 0xb3d4, 0xb3d3, 0xb3d2, 0xb6d2, 0xfaba, 0x92c7, 0xb6d5, 0xb6d6, 0xb6d4, 0xb6d3, 0xe143, 0xe144, 0xe4f5, 0xbc45, 0xe4f4, 0xbeb1, 0xecbf, 0xc079, 0xf1ee, 0xc455, 0xc6c6, 0xa463, 0xa4c3, 0xc956, 0xa4c4, 0xa4c5, 0x9a4c, 0xa55d, 0xa55e, 0xa649, 0xca71, 0xcbd6, 0xcbd7, 0xab6d, 0xd0ee, 0xb0cc, 0xb0cb, 0xd863, 0xd862, 0xa450, 0xa4c6, 0xa55f, 0xb0cd, 0xc943, 0xc96c, 0xa560, 0xc9c2, 0xa64b, 0xa64a, 0xc9c1, 0xa758, 0x8c68, 0x89e5, 0xadea, 0x9f7d, 0xd46f, 0xb6d7, 0xe145, 0xb9bc, 0xa0a9, 0xfac4, 0xe8fa, 0xf3fd, 0xc6c7, 0xa4c7, 0x8957, 0xcbd8, 0xcdf4, 0xb0d0, 0xb0ce, 0xb0cf, 0xa451, 0xfaaa, 0xa464, 0xa2cd, 0xa4ca, 0xa4c9, 0xa4c8, 0xa563, 0xa562, 0xc96d, 0xc9c3, 0x8958, 0xa8f5, 0xa8f2, 0xa8f4, 0xa8f3, 0xab6e, 0xb3d5, 0xa452, 0x8be3, 0xa4cb, 0x8b61, 0xa565, 0xa564, 0xca72, 0x9af1, 0xa8f6, 0x9eb7, 0xc6c8, 0xc957, 0xfad1, 0xa567, 0xa566, 0xa64c, 0xa64d, 0xca73, 0xa759, 0xfad2, 0xa75a, 0xa8f7, 0xa8f8, 0xa8f9, 0xab6f, 0xcdf5, 0x9eba, 0xfad4, 0xadeb, 0xc944, 0xa4cc, 0xc9c4, 0xca74, 0xca75, 0xcbd9, 0xfad9, 0xcbda, 0xcdf7, 0xcdf6, 0xcdf9, 0xcdf8, 0xab70, 0xd470, 0xaded, 0xd0ef, 0xadec, 0xfadb, 0x9ce0, 0xd864, 0xb3d6, 0xfbf7, 0xd865, 0xfbfa, 0x89e7, 0xa07a, 0xfadc, 0xe146, 0xb9bd, 0xfadd, 0x89e9, 0xbc46, 0xf1ef, 0xc6c9, 0xc958, 0xa568, 0xfae2, 0x89eb, 0xb0d1, 0xfae3, 0xa453, 0xa465, 0xa4ce, 0xa4cd, 0x90c8, 0xa4cf, 0x92da, 0x8959, 0x9cf5, 0xa8fb, 0xa8fa, 0xa8fc, 0x895a, 0xfae7, 0x9fa2, 0xab71, 0xadee, 0xfaea, 0xe8fb, 0xc24f, 0xa466, 0xa56a, 0xa579, 0xa574, 0xa56f, 0xa56e, 0xa575, 0xa573, 0xa56c, 0xa57a, 0xa56d, 0xa569, 0xa578, 0xa577, 0xa576, 0xa56b, 0xa572, 0xfaed, 0x8fad, 0xa571, 0xa57b, 0xa570, 0xfb59, 0xa653, 0xa659, 0xa655, 0xa65b, 0xc9c5, 0xa658, 0xa64e, 0xa651, 0xa654, 0xa650, 0xa657, 0xa65a, 0xa64f, 0xa652, 0xa656, 0xa65c, 0xfaef, 0x96ef, 0x9dec, 0xca7e, 0xca7b, 0x9dca, 0xa767, 0xca7c, 0xa75b, 0xa75d, 0xa775, 0xa770, 0xfd6d, 0x89ec, 0xcaa5, 0xca7d, 0xa75f, 0xa761, 0xcaa4, 0xa768, 0xca78, 0xa774, 0xa776, 0xa75c, 0xa76d, 0xfb44, 0xca76, 0xa773, 0x9de2, 0xa764, 0x8c75, 0xa76e, 0xa76f, 0xca77, 0xa76c, 0xa76a, 0xa76b, 0xa771, 0xcaa1, 0xa75e, 0xa772, 0xcaa3, 0xa766, 0xa763, 0xca7a, 0xa762, 0xcaa6, 0xa765, 0xa769, 0x9ec0, 0x9e56, 0xa760, 0xcaa2, 0xca79, 0xcbeb, 0xcbea, 0xa94f, 0xcbed, 0xcbef, 0xcbe4, 0xcbe7, 0xcbee, 0xa950, 0x9f79, 0x9ac7, 0xcbe1, 0xcbe5, 0xfaf4, 0xcbe9, 0xce49, 0xa94b, 0xce4d, 0xa8fd, 0xcbe6, 0xa8fe, 0xa94c, 0xa945, 0xa941, 0xcbe2, 0xa944, 0xa949, 0xa952, 0xcbe3, 0xcbdc, 0xa943, 0xcbdd, 0xcbdf, 0xa946, 0x98a1, 0xa948, 0xcbdb, 0xcbe0, 0xa951, 0xa94d, 0xcbe8, 0xa953, 0xfaf8, 0xa94a, 0xcbde, 0xa947, 0x89f0, 0x9e47, 0xa942, 0xa940, 0x9df7, 0xcbec, 0xa94e, 0x9fd3, 0x9aca, 0xce48, 0xcdfb, 0xce4b, 0x89f1, 0xfaf9, 0xcdfd, 0xab78, 0xaba8, 0xab74, 0xaba7, 0xab7d, 0xaba4, 0xab72, 0xcdfc, 0xce43, 0xaba3, 0xce4f, 0xaba5, 0x8e5a, 0xab79, 0x89f2, 0xce45, 0xce42, 0xab77, 0x89f3, 0xcdfa, 0xaba6, 0xce4a, 0xab7c, 0xce4c, 0xaba9, 0xab73, 0xab7e, 0xab7b, 0xce40, 0xaba1, 0xce46, 0xce47, 0xab7a, 0xaba2, 0xab76, 0x925d, 0x8b51, 0x92e0, 0xab75, 0xcdfe, 0x89f4, 0xce44, 0x9fd4, 0xce4e, 0xd144, 0xadfb, 0xd0f1, 0x8a79, 0xd0f6, 0xadf4, 0xae40, 0xd0f4, 0xadef, 0xadf9, 0xadfe, 0xd0fb, 0xadfa, 0xadfd, 0x89f5, 0xd0fe, 0xadf5, 0xd0f5, 0xd142, 0xd143, 0xadf7, 0xd141, 0xadf3, 0xae43, 0xd0f8, 0xadf1, 0x97a7, 0xd146, 0xd0f9, 0xd0fd, 0xadf6, 0xae42, 0xd0fa, 0xadfc, 0xd140, 0xd147, 0xd4a1, 0x93ba, 0xd145, 0xae44, 0xadf0, 0xd0fc, 0xd0f3, 0x9e58, 0xadf8, 0xd0f2, 0x89f6, 0xd0f7, 0x9e57, 0x89f7, 0x8a41, 0xd0f0, 0xae41, 0x89f8, 0xd477, 0xfaf1, 0xb0e4, 0xd4a7, 0xb0e2, 0xb0df, 0xd47c, 0xb0db, 0xd4a2, 0xb0e6, 0xd476, 0xd47b, 0xd47a, 0xadf2, 0xb0e1, 0xd4a5, 0xd4a8, 0xd473, 0xb3e8, 0x89fa, 0xd4a9, 0xb0e7, 0xb0d9, 0xb0d6, 0xd47e, 0xb0d3, 0xfb42, 0xd4a6, 0xfabf, 0xb0da, 0xd4aa, 0xd474, 0xd4a4, 0xb0dd, 0xd475, 0xd478, 0xd47d, 0xfba3, 0xb0de, 0xb0dc, 0xb0e8, 0xb0e3, 0xfaf7, 0xb0d7, 0xb1d2, 0xb0d8, 0xd479, 0xb0e5, 0xb0e0, 0xd4a3, 0xb0d5, 0x9e4e, 0xb0d4, 0x94dc, 0x95da, 0x9df8, 0x9f6a, 0xd471, 0xd472, 0xd86a, 0x8ab7, 0xb3d7, 0xb3da, 0xd875, 0xb3ee, 0xd878, 0xb3d8, 0xd871, 0xb3de, 0xb3e4, 0xb5bd, 0xfb46, 0xb3e2, 0xd86e, 0xb3ef, 0xb3db, 0xb3e3, 0xd876, 0xdcd7, 0xd87b, 0xd86f, 0x8a46, 0xd866, 0xd873, 0xd86d, 0xb3e1, 0xd879, 0xb3dd, 0xb3f1, 0xb3ea, 0xb3df, 0xb3dc, 0xb3e7, 0xd87a, 0xd86c, 0xd872, 0xd874, 0xd868, 0xd877, 0xb3d9, 0xd867, 0xfb47, 0xb3e0, 0xb3f0, 0xb3ec, 0xd869, 0xb3e6, 0x9148, 0xb3ed, 0xb3e9, 0xb3e5, 0x92de, 0xd870, 0x8b53, 0x9df6, 0xb3eb, 0x9bda, 0xdcd5, 0xdcd1, 0x9d7e, 0xdce0, 0xdcca, 0xdcd3, 0xb6e5, 0xb6e6, 0xb6de, 0xdcdc, 0xb6e8, 0xdccf, 0xdcce, 0xdccc, 0xdcde, 0xb6dc, 0xdcd8, 0xdccd, 0xb6df, 0xdcd6, 0xb6da, 0xdcd2, 0xdcd9, 0xdcdb, 0x89fd, 0x99e4, 0xdcdf, 0xb6e3, 0xdccb, 0xb6dd, 0xdcd0, 0x9e43, 0xb6d8, 0xb6e4, 0xdcda, 0xb6e0, 0xb6e1, 0xb6e7, 0xb6db, 0xa25f, 0xb6d9, 0xdcd4, 0x9de9, 0x8f52, 0xb6e2, 0x9df5, 0x9df0, 0xdcdd, 0x99e7, 0xb9cd, 0xb9c8, 0xe155, 0xe151, 0x8bbd, 0xe14b, 0xb9c2, 0xb9be, 0xe154, 0xb9bf, 0xe14e, 0xe150, 0xe153, 0x9def, 0xb9c4, 0xb9cb, 0xb9c5, 0xe149, 0xb9c6, 0xb9c7, 0xe14c, 0xb9cc, 0x9fb7, 0xe14a, 0xe14f, 0xb9c3, 0xe148, 0xb9c9, 0xb9c1, 0xb9c0, 0xe14d, 0xe152, 0x9dd0, 0xb9ca, 0x9feb, 0x8da9, 0x9dcf, 0x98e1, 0x9de5, 0xe147, 0xbc4d, 0xe547, 0xe544, 0x9dc8, 0xbc47, 0xbc53, 0xbc54, 0xbc4a, 0xe542, 0xbc4c, 0xe4f9, 0xbc52, 0xfb4f, 0xe546, 0xbc49, 0xe548, 0xbc48, 0xe543, 0xe545, 0xbc4b, 0xe541, 0xe4fa, 0xe4f7, 0x9deb, 0xd86b, 0xe4fd, 0xe4f6, 0xe4fc, 0xe4fb, 0xe4f8, 0xfb54, 0xbc4f, 0xfb55, 0x9aa2, 0x8ad6, 0xbc4e, 0x9a5f, 0xbc50, 0xe4fe, 0xbeb2, 0xe540, 0x9ef5, 0xe945, 0xe8fd, 0x8fb7, 0xbebe, 0xe942, 0xbeb6, 0xbeba, 0xe941, 0xbeb9, 0xbeb5, 0xbeb8, 0xbeb3, 0xbebd, 0xe943, 0xe8fe, 0xbebc, 0xe8fc, 0xbebb, 0xe944, 0xe940, 0xbc51, 0xbebf, 0xe946, 0xbeb7, 0xbeb4, 0x9ad2, 0x9e6a, 0x9ee8, 0xecc6, 0xecc8, 0xc07b, 0xecc9, 0xecc7, 0xecc5, 0xecc4, 0xc07d, 0xecc3, 0xc07e, 0x8bbf, 0x91c2, 0x9d62, 0xecc1, 0xecc2, 0xc07a, 0xc0a1, 0xc07c, 0x9260, 0xecc0, 0xc250, 0xefbc, 0xefba, 0xefbf, 0xefbd, 0xefbb, 0xefbe, 0x925e, 0x91c1, 0x8ac5, 0x97a3, 0xc360, 0xf1f2, 0xf1f3, 0xc456, 0xf1f4, 0xf1f0, 0xf1f5, 0xf1f1, 0xc251, 0x8b6c, 0x8d7e, 0xf3fe, 0xf441, 0xc459, 0xf440, 0xc458, 0xc457, 0x9c54, 0xc45a, 0xf5c5, 0xf5c6, 0x9dbd, 0xc4da, 0xc4d9, 0xc4db, 0xf5c4, 0xf6d8, 0xf6d7, 0xc56d, 0xc56f, 0xc56e, 0xf6d9, 0xc5c8, 0xf8a6, 0xc5f1, 0xf8a5, 0xf8ee, 0x9cc5, 0xc949, 0xa57d, 0xa57c, 0xa65f, 0xa65e, 0xc9c7, 0xa65d, 0xc9c6, 0x895b, 0xa779, 0xcaa9, 0xcaa8, 0xa777, 0xa77a, 0xfb5c, 0xcaa7, 0xfb5b, 0xa778, 0xfb57, 0xcbf0, 0xcbf1, 0xa954, 0x98c7, 0xabaa, 0xfb5a, 0xd148, 0xd149, 0xae45, 0xae46, 0xd4ac, 0xb0e9, 0xb0eb, 0xd4ab, 0xb0ea, 0xd87c, 0xb3f2, 0xb6e9, 0xb6ea, 0xdce1, 0x9cee, 0xb9cf, 0xb9ce, 0xe549, 0xe948, 0xe947, 0x92e2, 0xf96b, 0xa467, 0xc959, 0xc96e, 0xc96f, 0xa662, 0xa666, 0xc9c9, 0xa664, 0xa663, 0xc9c8, 0xa665, 0xa661, 0x94a7, 0xa660, 0xc9ca, 0xa7a6, 0x8ccc, 0xa7a3, 0x9bd4, 0xa77d, 0xcaaa, 0xfb64, 0xfb76, 0xcaab, 0xfb60, 0xa7a1, 0xcaad, 0xa77b, 0xcaae, 0xcaac, 0xa77e, 0xa7a2, 0xa7a5, 0xa7a4, 0xa77c, 0xcaaf, 0x99e5, 0x9ac2, 0x91fb, 0xa073, 0xa959, 0xcbfe, 0xa95b, 0xa95a, 0x9f72, 0xcc40, 0xa958, 0xa957, 0xcbf5, 0xcbf4, 0xcbf2, 0xcbf7, 0xcbf6, 0xcbf3, 0xcbfc, 0xcbfd, 0xcbfa, 0xcbf8, 0xa956, 0x9fcc, 0xcbfb, 0xa95c, 0xcc41, 0x98a5, 0x92e8, 0xcbf9, 0xabab, 0xa955, 0x9bbc, 0x96f3, 0xabac, 0xce54, 0x92e7, 0xce5a, 0xfc67, 0xabb2, 0xce58, 0xce5e, 0xce55, 0xce59, 0xce5b, 0xce5d, 0xce57, 0x8b7d, 0xce56, 0xce51, 0xce52, 0xabad, 0x9bf4, 0xabaf, 0xabae, 0xce53, 0xce5c, 0x9ef7, 0x9ec1, 0xabb1, 0x996f, 0xce50, 0xd153, 0xd152, 0xd157, 0xd14e, 0x96f1, 0xd151, 0xd150, 0x8e41, 0xd154, 0xd158, 0xae47, 0xae4a, 0x954a, 0xd14f, 0xd155, 0x97e6, 0xae49, 0xd14a, 0xabb0, 0xd4ba, 0xd156, 0xd14d, 0xae48, 0xd14c, 0x96f5, 0xd4b1, 0x92e6, 0x9f42, 0xb0ec, 0xb0f0, 0xd4c1, 0xd4af, 0xd4bd, 0xb0f1, 0xd4bf, 0xfb67, 0xd4c5, 0xd4c9, 0xd4c0, 0xd4b4, 0xd4bc, 0x99a9, 0xd4ca, 0xd4c8, 0xd4be, 0xd4b9, 0xd4b2, 0xd8a6, 0xd4b0, 0xb0f5, 0xd4b7, 0xb0f6, 0xb0f2, 0xd4ad, 0xd4c3, 0xd4b5, 0xfae6, 0xd4b3, 0xd4c6, 0xb0f3, 0xfb69, 0xd4cc, 0xb0ed, 0xb0ef, 0xd4bb, 0xd4b6, 0xae4b, 0xb0ee, 0xd4b8, 0xd4c7, 0xd4cb, 0xd4c2, 0xd4c4, 0x97e5, 0xd4ae, 0xd8a1, 0xd8aa, 0xd8a9, 0xb3fa, 0xd8a2, 0xb3fb, 0xb3f9, 0x967d, 0xd8a4, 0xb3f6, 0xd8a8, 0xfb6c, 0xd8a3, 0xd8a5, 0xd87d, 0xb3f4, 0xd8b2, 0xd8b1, 0xd8ae, 0xb3f3, 0xb3f7, 0xb3f8, 0xd14b, 0xd8ab, 0xb3f5, 0xb0f4, 0xd8ad, 0xd87e, 0xd8b0, 0xd8af, 0x99a2, 0xd8b3, 0xdcef, 0xd8ac, 0x9abb, 0x9a65, 0x944e, 0xd8a7, 0xdce7, 0xb6f4, 0xb6f7, 0xb6f2, 0xdce6, 0xdcea, 0xdce5, 0xb6ec, 0xb6f6, 0xdce2, 0xb6f0, 0xdce9, 0xb6ee, 0xb6ed, 0xdcec, 0xb6ef, 0xdcee, 0xfb6e, 0xdceb, 0xb6eb, 0x99df, 0xb6f5, 0xdcf0, 0xdce4, 0xdced, 0xdce3, 0x98e3, 0xb6f1, 0x9254, 0xb6f3, 0xdce8, 0xdcf1, 0x967b, 0x8aaf, 0xe15d, 0xb9d0, 0xe163, 0xb9d5, 0xe15f, 0xe166, 0xe157, 0xb9d7, 0xb9d1, 0xe15c, 0xbc55, 0xe15b, 0xe164, 0xb9d2, 0xb9d6, 0xe15a, 0xe160, 0xe165, 0xe156, 0xb9d4, 0xe15e, 0xe162, 0xe168, 0xe158, 0xe161, 0x8c77, 0xb9d3, 0xe167, 0xe159, 0x8baf, 0x9ebd, 0xbc59, 0xe54b, 0xbc57, 0xbc56, 0xe54d, 0xe552, 0xe54e, 0xe551, 0xbc5c, 0x9ee6, 0xbea5, 0xbc5b, 0xfb6f, 0xe54a, 0xe550, 0xbc5a, 0xe54f, 0x8ee1, 0xe54c, 0xbc58, 0x9b7d, 0x9c7e, 0xe94d, 0xf9d9, 0xe94f, 0xe94a, 0xbec1, 0xe94c, 0xbec0, 0xe94e, 0xbec3, 0xe950, 0xbec2, 0xe949, 0xe94b, 0x92ea, 0xc0a5, 0xeccc, 0x8c78, 0xc0a4, 0xeccd, 0xc0a3, 0xeccb, 0xc0a2, 0xecca, 0xc253, 0xc252, 0xf1f6, 0xf1f8, 0xfb72, 0xf1f7, 0xc361, 0xc362, 0xfb71, 0xc363, 0xf442, 0xc45b, 0xf7d3, 0xf7d2, 0xc5f2, 0xa468, 0xa4d0, 0xa7a7, 0x895c, 0x98f0, 0x96f2, 0xce5f, 0xb3fc, 0xb3fd, 0xfb74, 0xdcf2, 0xb9d8, 0xe169, 0xe553, 0x8bc1, 0xc95a, 0x895d, 0x89de, 0xcab0, 0x895e, 0xc6ca, 0xcc42, 0xce60, 0xd159, 0xae4c, 0xfe42, 0xf1f9, 0xc4dc, 0xa469, 0xa57e, 0xc970, 0xa667, 0xa668, 0xa95d, 0xfb7b, 0xb0f7, 0xb9da, 0xb9db, 0xb9d9, 0xa46a, 0xa4d1, 0xa4d3, 0xa4d2, 0xc95b, 0xa4d4, 0xa5a1, 0xc971, 0xa5a2, 0x895f, 0x8960, 0xa669, 0xa66a, 0xc9cb, 0xa7a8, 0xcab1, 0xa961, 0xcc43, 0xa95f, 0xa960, 0xa95e, 0xd15a, 0xabb6, 0xabb5, 0xabb7, 0xabb4, 0xce61, 0xa962, 0xabb3, 0xae4d, 0xae4e, 0xae4f, 0xd4cd, 0xb3fe, 0xd8b4, 0xb0f8, 0x9bcd, 0xb6f8, 0xb9dd, 0xb9dc, 0xe16a, 0xbc5d, 0xbec4, 0xefc0, 0xf6da, 0xf7d4, 0xa46b, 0xa5a3, 0x9dd3, 0xa5a4, 0xc9d1, 0xa66c, 0xa66f, 0xc9cf, 0xc9cd, 0xa66e, 0xc9d0, 0xc9d2, 0xc9cc, 0xa671, 0xa670, 0xa66d, 0xa66b, 0xc9ce, 0x984c, 0xa7b3, 0xa7b0, 0xcab6, 0xcab9, 0xcab8, 0xa7aa, 0xa7b2, 0x9752, 0xa7af, 0xcab5, 0xcab3, 0xa7ae, 0x95c3, 0xa7a9, 0xa7ac, 0x9bb6, 0xcab4, 0xcabb, 0xcab7, 0xa7ad, 0xa7b1, 0xa7b4, 0xcab2, 0xcaba, 0xa7ab, 0x9ab9, 0xa967, 0xa96f, 0x97b3, 0xcc4f, 0xcc48, 0xa970, 0xcc53, 0xcc44, 0xcc4b, 0x9f74, 0x92f1, 0xa966, 0xcc45, 0xa964, 0xcc4c, 0xcc50, 0xa963, 0xcc51, 0xcc4a, 0xcc4d, 0x97df, 0xa972, 0xa969, 0xcc54, 0xcc52, 0xfba6, 0xa96e, 0xa96c, 0xcc49, 0xa96b, 0xcc47, 0xcc46, 0xa96a, 0xa968, 0xa971, 0xa96d, 0xa965, 0xcc4e, 0xabb9, 0xfbab, 0xabc0, 0xce6f, 0xabb8, 0xce67, 0xce63, 0xce73, 0xce62, 0xabbb, 0xce6c, 0xabbe, 0xabc1, 0xabbc, 0xce70, 0xabbf, 0x9877, 0xae56, 0xce76, 0xce64, 0x9854, 0x95c5, 0xce66, 0xce6d, 0xce71, 0xce75, 0xce72, 0xce6b, 0xce6e, 0x9d55, 0xfbb2, 0xce68, 0xabc3, 0xce6a, 0xce69, 0xce74, 0xabba, 0xce65, 0xabc2, 0x957e, 0xabbd, 0xae5c, 0xd162, 0x9742, 0xae5b, 0x94e6, 0xd160, 0xae50, 0x92f5, 0xae55, 0xd15f, 0xd15c, 0xd161, 0xae51, 0xd15b, 0x8cc5, 0xae54, 0xae52, 0xd163, 0xae53, 0xae57, 0x92fd, 0xae58, 0xfba2, 0xae5a, 0x9c51, 0xae59, 0x94e9, 0x985c, 0x92f0, 0xd15d, 0xd15e, 0xd164, 0xd4d4, 0xb0f9, 0xd8c2, 0xd4d3, 0xd4e6, 0xb140, 0x944c, 0xd4e4, 0xb0fe, 0xb0fa, 0xd4ed, 0xd4dd, 0xd4e0, 0x916b, 0xb143, 0xd4ea, 0xd4e2, 0xb0fb, 0xb144, 0xd4e7, 0xd4e5, 0xd4d6, 0xd4eb, 0xd4df, 0xd4da, 0x8b78, 0xd4d0, 0xd4ec, 0xd4dc, 0xd4cf, 0x94e2, 0xb142, 0xd4e1, 0xd4ee, 0xd4de, 0xd4d2, 0xd4d7, 0xd4ce, 0x984f, 0xb141, 0xfbb5, 0xd4db, 0xd4d8, 0xb0fc, 0xd4d1, 0x9271, 0xd4e9, 0xb0fd, 0x9365, 0xd4d9, 0xd4d5, 0x985b, 0xd4e8, 0x9850, 0xb440, 0xd8bb, 0x97bc, 0xd8b8, 0xd8c9, 0xd8bd, 0xd8ca, 0x92f3, 0xb442, 0x9340, 0x984d, 0xd8c6, 0xd8c3, 0x9572, 0xfdef, 0xd8c4, 0xd8c7, 0xd8cb, 0xd4e3, 0xd8cd, 0xdd47, 0xfdc1, 0xb443, 0xd8ce, 0xd8b6, 0xd8c0, 0xfbba, 0xd8c5, 0x92eb, 0xb441, 0xb444, 0xd8cc, 0xd8cf, 0xd8ba, 0xd8b7, 0xfc73, 0x97b7, 0xd8b9, 0xd8be, 0xd8bc, 0xb445, 0xd8c8, 0xfbb4, 0xd8bf, 0xd8c1, 0xd8b5, 0xdcfa, 0xdcf8, 0xb742, 0xb740, 0xdd43, 0xdcf9, 0xdd44, 0xdd40, 0xdcf7, 0xdd46, 0xdcf6, 0xdcfd, 0xb6fe, 0xb6fd, 0xb6fc, 0xdcfb, 0xdd41, 0xb6f9, 0xb741, 0x90a7, 0xdcf4, 0xdcfe, 0xdcf3, 0xdcfc, 0xb6fa, 0xdd42, 0xdcf5, 0xb6fb, 0xdd45, 0x9741, 0x92f4, 0xfbbc, 0xe16e, 0xb9e2, 0xb9e1, 0xb9e3, 0xe17a, 0xe170, 0xe176, 0xe16b, 0xe179, 0xe178, 0xe17c, 0xe175, 0xb9de, 0xe174, 0xb9e4, 0x9577, 0xe16d, 0xb9df, 0xe17b, 0xb9e0, 0xe16f, 0xe172, 0xe177, 0xe171, 0xe16c, 0x9ee2, 0x8f78, 0xe173, 0xe555, 0xbc61, 0xe558, 0xe557, 0xe55a, 0xe55c, 0xf9dc, 0xbc5f, 0xe556, 0x9672, 0xe554, 0xe55d, 0xe55b, 0xe559, 0xe55f, 0xe55e, 0xbc63, 0xbc5e, 0xbc60, 0xbc62, 0x9eb5, 0xe560, 0xe957, 0x964b, 0xe956, 0xe955, 0x8cac, 0xe958, 0xe951, 0xe952, 0xe95a, 0xe953, 0xbec5, 0xe95c, 0xa0fa, 0xe95b, 0xe954, 0xecd1, 0xc0a8, 0xeccf, 0xecd4, 0xecd3, 0xe959, 0xc0a7, 0x9575, 0xecd2, 0xecce, 0xecd6, 0xecd5, 0xc0a6, 0xecd0, 0xbec6, 0xc254, 0xefc1, 0xf1fa, 0xf1fb, 0xf1fc, 0xc45c, 0x90da, 0xc45d, 0x9367, 0xf443, 0xfea4, 0xf5c8, 0xf5c7, 0x90df, 0xf6db, 0xf6dc, 0xf7d5, 0xf8a7, 0x9354, 0xa46c, 0xa46d, 0xa46e, 0xa4d5, 0xa5a5, 0xc9d3, 0xa672, 0xa673, 0xa7b7, 0xa7b8, 0xa7b6, 0xa7b5, 0xa973, 0xcc55, 0xa975, 0xa974, 0xcc56, 0x8961, 0x8bb4, 0xabc4, 0xae5d, 0xd165, 0x9dc0, 0xd4f0, 0xb145, 0xb447, 0xd4ef, 0xb446, 0x8e48, 0xb9e5, 0xfbc5, 0xe17d, 0xbec7, 0xc0a9, 0xecd7, 0xfbc7, 0xc45e, 0xc570, 0xc6cb, 0xc972, 0xfa79, 0xa5a6, 0xc973, 0xa676, 0xa674, 0xa675, 0xa677, 0xa7ba, 0xa7b9, 0xcabc, 0xa7bb, 0x9e67, 0xcabd, 0xcc57, 0xcc58, 0x8cd9, 0xa976, 0xa978, 0xa97a, 0xa977, 0xa97b, 0xa979, 0xfbd2, 0x8962, 0x8963, 0xabc8, 0xabc5, 0xabc7, 0xabc9, 0xabc6, 0xd166, 0xce77, 0xfc7d, 0xd168, 0xd167, 0xae63, 0xae5f, 0xae60, 0xae62, 0xae64, 0xae61, 0xae66, 0xae65, 0xb14a, 0xd4f2, 0xd4f1, 0xb149, 0x9f6b, 0xb148, 0xb147, 0xb14b, 0xb146, 0xd8d5, 0xd8d2, 0xb449, 0xd8d1, 0xd8d6, 0xb44b, 0xd8d4, 0xb448, 0xb44a, 0xd8d3, 0xfbcc, 0xdd48, 0xfeae, 0xdd49, 0xdd4a, 0xb9e6, 0xb9ee, 0xe17e, 0xb9e8, 0xb9ec, 0xe1a1, 0xb9ed, 0xb9e9, 0xb9ea, 0xb9e7, 0xb9eb, 0xbc66, 0xd8d0, 0xbc67, 0xbc65, 0xbc64, 0xe95d, 0xbec8, 0xecd8, 0xecd9, 0xfbd1, 0xc364, 0xc45f, 0xa46f, 0xa678, 0xfb75, 0xabca, 0xd169, 0xae67, 0xfbd4, 0xb14e, 0xb14d, 0xb14c, 0xb44c, 0xb44d, 0xd8d7, 0xb9ef, 0xbec9, 0xa470, 0xc95c, 0xa4d6, 0xc974, 0xfbd6, 0xfbd8, 0xc9d4, 0xa679, 0xa97c, 0x8b5d, 0x934c, 0xdd4b, 0x9ae2, 0xa471, 0x8bc9, 0xa4d7, 0xc9d5, 0xcabe, 0xcabf, 0xa7bc, 0xd8d8, 0xb44e, 0xdd4c, 0xc0aa, 0xa472, 0xa4a8, 0xa4d8, 0xc975, 0xa5a7, 0xa7c0, 0xa7bf, 0xa7bd, 0xa7be, 0xcc59, 0xa97e, 0xa9a1, 0xcc5a, 0xa97d, 0xfbdb, 0x9fc9, 0xabce, 0xce78, 0xabcd, 0xabcb, 0xabcc, 0xae6a, 0xae68, 0x9f44, 0xd16b, 0xae69, 0xd16a, 0xae5e, 0xd4f3, 0xb150, 0xb151, 0x98ed, 0xb14f, 0xb9f0, 0xe1a2, 0xbc68, 0xbc69, 0xe561, 0xc0ab, 0xefc2, 0xefc3, 0xc4dd, 0xf8a8, 0xc94b, 0xa4d9, 0xa473, 0xc977, 0xc976, 0xa67a, 0xc9d7, 0xc9d8, 0xc9d6, 0xc9d9, 0xfbdd, 0xcac7, 0xcac2, 0xcac4, 0xcac6, 0xcac3, 0xa7c4, 0xcac0, 0xcac1, 0xa7c1, 0xa7c2, 0xcac5, 0xcac8, 0xa7c3, 0xcac9, 0x8df2, 0x8964, 0xfdf2, 0xcc68, 0x934d, 0xcc62, 0xcc5d, 0xa9a3, 0xcc65, 0xcc63, 0xcc5c, 0xcc69, 0xcc6c, 0xcc67, 0xcc60, 0xa9a5, 0xcc66, 0xa9a6, 0xcc61, 0xcc64, 0xcc5b, 0xcc5f, 0xcc6b, 0xa9a7, 0xa9a8, 0xcc5e, 0xcc6a, 0xa9a2, 0xa9a4, 0xfbe7, 0xa0f2, 0x9868, 0xceab, 0xcea4, 0xceaa, 0xcea3, 0xcea5, 0xce7d, 0xce7b, 0xceac, 0xcea9, 0xce79, 0x9f58, 0xabd0, 0xcea7, 0xcea8, 0xcea6, 0xce7c, 0xce7a, 0xabcf, 0xcea2, 0xce7e, 0xcea1, 0xcead, 0x8d73, 0xae6f, 0xfbde, 0xae6e, 0xd16c, 0xae6b, 0xd16e, 0xfbdf, 0xae70, 0xd16f, 0xae73, 0x8c48, 0xae71, 0xd170, 0xceae, 0xd172, 0xae6d, 0xae6c, 0xd16d, 0xd171, 0xae72, 0xb153, 0xb152, 0xd4f5, 0xd4f9, 0xd4fb, 0xb154, 0xd4fe, 0xfbe3, 0xb158, 0xd541, 0xb15a, 0x8da8, 0xb156, 0xb15e, 0xfbe4, 0xb15b, 0xd4f7, 0xb155, 0xd4f6, 0xd4f4, 0xd543, 0xd4f8, 0xb157, 0xd542, 0xb15c, 0xd4fd, 0xd4fc, 0xb15d, 0xd4fa, 0xb159, 0x9c75, 0xd544, 0x9878, 0xd540, 0xd8e7, 0xd8ee, 0xd8e3, 0xb451, 0xd8df, 0xd8ef, 0xd8d9, 0xd8ec, 0xd8ea, 0xd8e4, 0xd8ed, 0xd8e6, 0x8d60, 0xd8de, 0xd8f0, 0xd8dc, 0xd8e9, 0xd8da, 0xd8f1, 0xfbe5, 0xb452, 0x8d61, 0xd8eb, 0xdd4f, 0xd8dd, 0xb44f, 0xd8e1, 0xb450, 0xd8e0, 0xd8e5, 0xd8e2, 0x8d62, 0xa0a1, 0xd8e8, 0x9c40, 0xdd53, 0xdd56, 0xdd4e, 0xdd50, 0xdd55, 0xdd54, 0xb743, 0xd8db, 0xdd52, 0xb744, 0x98ad, 0xdd4d, 0xdd51, 0x9eea, 0xe1a9, 0xe1b0, 0xe1a7, 0x8cd4, 0xe1ae, 0xe1a5, 0xe1ad, 0xe1b1, 0xe1a4, 0xe1a8, 0xe1a3, 0xb9f1, 0x9ceb, 0xe1a6, 0xb9f2, 0xe1ac, 0xe1ab, 0xe1aa, 0xfbe0, 0xe1af, 0x9f51, 0xe565, 0xe567, 0xbc6b, 0xe568, 0xe563, 0xe562, 0xe56c, 0xe56a, 0xbc6a, 0xe56d, 0xe564, 0xe569, 0xe56b, 0xe566, 0x8d65, 0xe961, 0xe966, 0xe960, 0xe965, 0x9cf1, 0xe95e, 0xe968, 0xe964, 0xe969, 0xe963, 0xe95f, 0xe967, 0xe96a, 0xe962, 0xfc58, 0xecda, 0xc0af, 0x8d66, 0xc0ad, 0xc0ac, 0xc0ae, 0xefc4, 0x9654, 0xf172, 0xf1fd, 0xf444, 0xf445, 0xc460, 0xf5c9, 0xc4de, 0xf5ca, 0xf6de, 0xc572, 0xc571, 0xf6dd, 0xc5c9, 0xfbe8, 0xf7d6, 0xc6cc, 0xa474, 0xa67b, 0xc9da, 0xcaca, 0xa8b5, 0xb15f, 0xa475, 0xa5aa, 0xa5a9, 0xa5a8, 0xa7c5, 0xae74, 0xdd57, 0xa476, 0xa477, 0xa478, 0xa4da, 0x9fce, 0xabd1, 0xceaf, 0xb453, 0xa479, 0xc95d, 0xa5ab, 0xa5ac, 0xc978, 0xa67c, 0xfbfc, 0xcacb, 0x9ae4, 0xa7c6, 0xcacc, 0xa9ae, 0x9f75, 0xcc6e, 0xa9ac, 0xa9ab, 0xcc6d, 0xa9a9, 0xcc6f, 0xa9aa, 0xa9ad, 0xabd2, 0xabd4, 0xceb3, 0xceb0, 0xceb1, 0xceb2, 0xceb4, 0xabd3, 0xd174, 0xd173, 0xae76, 0xae75, 0xfbf1, 0xb162, 0xd546, 0xb161, 0xb163, 0xb160, 0xb455, 0xd545, 0xb456, 0xd8f3, 0x8d69, 0xb457, 0xd8f2, 0xb454, 0x934f, 0xdd5a, 0xdd5c, 0xb745, 0xdd5b, 0xdd59, 0xdd58, 0xe1b4, 0xb9f7, 0xb9f5, 0xb9f6, 0xe1b2, 0xe1b3, 0xb9f3, 0xe571, 0xe56f, 0x934e, 0xbc6d, 0xe570, 0xbc6e, 0xbc6c, 0xb9f4, 0xe96d, 0xe96b, 0xe96c, 0xe56e, 0xecdc, 0xc0b0, 0xecdb, 0xefc5, 0xefc6, 0xe96e, 0xf1fe, 0xa47a, 0xa5ad, 0xa67e, 0xc9db, 0xa67d, 0xa9af, 0xb746, 0xfbf4, 0xa4db, 0xa5ae, 0xabd5, 0xb458, 0xc6ce, 0xc979, 0xc97a, 0xfbc3, 0xc9dc, 0x8965, 0xa7c8, 0xcad0, 0xcace, 0xa7c9, 0xcacd, 0xcacf, 0xcad1, 0xa7c7, 0x8c7a, 0xa9b3, 0xa9b4, 0xa9b1, 0x8c7b, 0xa9b0, 0xceb8, 0xa9b2, 0xabd6, 0xceb7, 0xceb9, 0xceb6, 0xceba, 0xabd7, 0xae79, 0xd175, 0xd177, 0xae77, 0xd178, 0xae78, 0xd176, 0xceb5, 0xd547, 0xd54a, 0xd54b, 0xd548, 0xb167, 0xb166, 0xb164, 0xb165, 0xd549, 0x8d6a, 0xb168, 0xb45a, 0xb45b, 0xb45c, 0xdd5d, 0xdd5f, 0xdd61, 0xb748, 0xb747, 0xb459, 0xdd60, 0xdd5e, 0x9353, 0xe1b8, 0x9dfb, 0xe1b6, 0xe1bc, 0xb9f8, 0xe1bd, 0xe1ba, 0xb9f9, 0xe1b7, 0xe1b5, 0xe1bb, 0xbc70, 0xe573, 0xe1b9, 0xbc72, 0xe574, 0xbc71, 0xbc74, 0xe575, 0xbc6f, 0xbc73, 0xe973, 0xe971, 0xe970, 0xe972, 0xe96f, 0xc366, 0xf446, 0xf447, 0xf5cb, 0xf6df, 0xc655, 0xfbfd, 0xa9b5, 0xa7ca, 0x9059, 0xfc40, 0xabd8, 0xfc41, 0xfc43, 0xa47b, 0xa4dc, 0xa5af, 0xc9dd, 0xa7cb, 0xcad2, 0xcebb, 0xabd9, 0xb9fa, 0xa47c, 0x9361, 0xfc46, 0x9362, 0xa6a1, 0xb749, 0xa47d, 0xa4dd, 0xa4de, 0xa5b1, 0xa5b0, 0xc9de, 0xa6a2, 0xcad3, 0xa7cc, 0xcc71, 0xcc72, 0xcc73, 0x8d6b, 0xa9b6, 0xa9b7, 0xcc70, 0xa9b8, 0xabda, 0xcebc, 0xd17a, 0xae7a, 0xd179, 0xb169, 0xd54c, 0xb16a, 0xd54d, 0xfc4c, 0xb45d, 0xdd62, 0xe1bf, 0xe1be, 0xb9fb, 0xbc75, 0xe576, 0xbeca, 0xe974, 0xc0b1, 0x95b8, 0xc573, 0xf7d8, 0xc6d0, 0x8bca, 0xcc74, 0xcebd, 0xb16b, 0xd8f4, 0xb74a, 0x987a, 0xc255, 0xc6d1, 0xa7ce, 0xfc51, 0xa7cd, 0xabdb, 0xd17b, 0xb16d, 0xb343, 0xb16e, 0xb16c, 0xb45e, 0xe1c0, 0xb9fc, 0xbc76, 0xfc54, 0xc94c, 0xc9df, 0xcad5, 0xa7cf, 0xcad4, 0xa7d0, 0xfaaf, 0xa9bc, 0xcc77, 0xcc76, 0xa9bb, 0xa9b9, 0xa9ba, 0xcc75, 0x8d6c, 0xabdd, 0xcebe, 0xabe0, 0xabdc, 0xabe2, 0xabde, 0xabdf, 0xabe1, 0xae7d, 0xae7c, 0xae7b, 0xd54f, 0xb16f, 0xb172, 0xb170, 0xd54e, 0xb175, 0xb171, 0xd550, 0xb174, 0xb173, 0xfa61, 0xd8f6, 0xd8f5, 0xfc57, 0xb461, 0xb45f, 0xb460, 0xd8f7, 0xb74b, 0xdd64, 0xb74c, 0xdd63, 0x9b70, 0xe577, 0xbc78, 0xe1c1, 0xbc77, 0xb9fd, 0xa051, 0xecde, 0xe975, 0xc0b2, 0xecdd, 0xf240, 0xf448, 0xf449, 0x8c7c, 0xa4df, 0x8bcb, 0xa5b2, 0xc97b, 0xa7d2, 0xa7d4, 0xc9e2, 0xcad8, 0xcad7, 0xcad6, 0xc9e1, 0xc9e0, 0xa6a4, 0xa7d3, 0xa7d1, 0xa6a3, 0x936e, 0xa9bd, 0xcc78, 0xfcd5, 0xa9be, 0xcadd, 0xcadf, 0xcade, 0xcc79, 0xcada, 0xa7d8, 0xa7d6, 0xcad9, 0xcadb, 0xcae1, 0xa7d5, 0xcadc, 0xcae5, 0xa9c0, 0xcae2, 0xa7d7, 0xcae0, 0xcae3, 0xa9bf, 0xa9c1, 0xcae4, 0xccaf, 0xcca2, 0xcc7e, 0xccae, 0xcca9, 0xabe7, 0xa9c2, 0xccaa, 0xccad, 0xabe3, 0xccac, 0xa9c3, 0xa9c8, 0xa9c6, 0xcca3, 0xcc7c, 0xcca5, 0xa9cd, 0xccb0, 0xabe4, 0xcca6, 0xabe5, 0xa9c9, 0xcca8, 0xfca9, 0xcecd, 0xabe6, 0xcc7b, 0xa9ca, 0xabe8, 0xa9cb, 0xa9c7, 0xa9cc, 0xcca7, 0xcc7a, 0xccab, 0xa9c4, 0xfc61, 0xcc7d, 0xcca4, 0xcca1, 0xa9c5, 0xcebf, 0xcec0, 0x8966, 0xceca, 0xd1a1, 0xcecb, 0xabee, 0xcece, 0xcec4, 0xabed, 0xcec6, 0xcec7, 0xfacb, 0xcec9, 0xabe9, 0xaea3, 0xf9da, 0xcec5, 0xcec1, 0xaea4, 0xcecf, 0xae7e, 0xd17d, 0xcec8, 0xd17c, 0xcec3, 0xcecc, 0xabec, 0xaea1, 0xabf2, 0xaea2, 0xced0, 0xd17e, 0xabeb, 0xaea6, 0xabf1, 0xabf0, 0xabef, 0xaea5, 0xced1, 0xaea7, 0xabea, 0xcec2, 0x937a, 0xa0e0, 0x936b, 0xb176, 0xd1a4, 0xd1a6, 0xd1a8, 0xaea8, 0xaeae, 0xd553, 0xd1ac, 0xd1a3, 0xb178, 0xd551, 0xaead, 0xaeab, 0xd1ae, 0xd552, 0xd1a5, 0xaeac, 0xd1a9, 0xaeaf, 0xd1ab, 0xaeaa, 0xd1aa, 0xd1ad, 0xd1a7, 0xfc6b, 0xaea9, 0xb179, 0xd1a2, 0xb177, 0xa0dc, 0x9468, 0xb17a, 0xd555, 0xd55e, 0xb464, 0xfc6d, 0xb17c, 0xb1a3, 0xb465, 0xd560, 0xb1aa, 0xd8f9, 0xd556, 0xb1a2, 0xb1a5, 0xb17e, 0xd554, 0xd562, 0xd565, 0xd949, 0xd563, 0xd8fd, 0xb1a1, 0xb1a8, 0xb1ac, 0xd55d, 0xd8f8, 0xd561, 0xb17b, 0xd8fa, 0xd564, 0xd8fc, 0xd559, 0xb462, 0xd557, 0xd558, 0xb1a7, 0x8d71, 0xb1a6, 0xd55b, 0xb1ab, 0xd55f, 0xb1a4, 0xd55c, 0xfd64, 0xb1a9, 0xb466, 0xb463, 0xd8fb, 0x99ba, 0xd55a, 0xb17d, 0x9ad0, 0x9a61, 0xa0e5, 0xb46b, 0xb46f, 0xd940, 0xb751, 0xb46d, 0xd944, 0xb471, 0xdd65, 0xd946, 0xb753, 0xb469, 0xb46c, 0xd947, 0xa05b, 0xd948, 0xd94e, 0xb473, 0xb754, 0xd94a, 0xd94f, 0xd943, 0xb75e, 0x96ac, 0xb755, 0xb472, 0xd941, 0xd950, 0x9740, 0xb75d, 0xb470, 0xb74e, 0xd94d, 0xb474, 0xd945, 0xd8fe, 0xb46a, 0xd942, 0xd94b, 0x9ef1, 0xb74d, 0xb752, 0xb467, 0xd94c, 0xb750, 0x8c4d, 0xb468, 0xb75c, 0xe1c3, 0xdd70, 0xdd68, 0xe1c2, 0xdd6c, 0xdd6e, 0x9f7e, 0xdd6b, 0xb75b, 0xdd6a, 0xb75f, 0xe1d2, 0x8d72, 0xb75a, 0xba40, 0xdd71, 0xe1c4, 0xfc76, 0xb758, 0xdd69, 0xdd6d, 0xb9fe, 0xb74f, 0xdd66, 0xdd67, 0xba41, 0xb757, 0xb759, 0xb756, 0xdd6f, 0x96a9, 0xe1c8, 0xe1c9, 0xe1ce, 0xbc7d, 0xe1d5, 0xba47, 0xa06e, 0xba46, 0xe1d0, 0xfcaa, 0xbc7c, 0xe1c5, 0xba45, 0xfbcd, 0xe1d4, 0xba43, 0xba44, 0xfc74, 0xe1d1, 0xe5aa, 0xbc7a, 0xb46e, 0xe1d3, 0xbca3, 0xe1cb, 0xbc7b, 0xa074, 0xbca2, 0xe1c6, 0xe1ca, 0xe1c7, 0xe1cd, 0xba48, 0xbc79, 0xba42, 0xe57a, 0xe1cf, 0xbca1, 0xa071, 0xbca4, 0xe1cc, 0xfc79, 0xbc7e, 0xe579, 0xfc7c, 0xe57e, 0xbece, 0xe578, 0xe9a3, 0xe5a9, 0xbca8, 0xbca6, 0xbecc, 0xe5a6, 0xe5a2, 0xbcac, 0x9c50, 0xe978, 0x9379, 0x9378, 0xbcaa, 0xe5a1, 0xa0dd, 0xe976, 0xe5a5, 0xe5a8, 0xe57d, 0xbcab, 0xbca5, 0xe977, 0xbecd, 0xe5a7, 0xbca7, 0xbca9, 0xe5a4, 0xbcad, 0xe5a3, 0xe57c, 0xe57b, 0xbecb, 0xe5ab, 0xe97a, 0xece0, 0xbed0, 0x8d75, 0xe9a2, 0x8d76, 0xe97e, 0xece1, 0xbed1, 0xe9a1, 0x9374, 0xe97c, 0xc0b4, 0xecdf, 0xe979, 0xe97b, 0xc0b5, 0xbed3, 0xc0b3, 0xbed2, 0xc0b7, 0xe97d, 0xbecf, 0x8d77, 0xfca5, 0xfca2, 0xefcf, 0xefc7, 0x90c3, 0xece7, 0xefc8, 0xece3, 0xa079, 0xc256, 0xece5, 0xece4, 0xc0b6, 0xece2, 0xece6, 0xefd0, 0xefcc, 0xefce, 0xefc9, 0xefca, 0xefcd, 0xefcb, 0xc367, 0xc36a, 0xc369, 0xc368, 0xc461, 0xf44a, 0xc462, 0xf241, 0xc4df, 0xf5cc, 0xc4e0, 0xc574, 0xc5ca, 0xf7d9, 0xf7da, 0xf7db, 0xf9ba, 0xa4e0, 0xc97c, 0xa5b3, 0xa6a6, 0xa6a7, 0xa6a5, 0xa6a8, 0xa7da, 0xa7d9, 0xccb1, 0xa9cf, 0xa9ce, 0xd1af, 0xb1ad, 0xb1ae, 0xb475, 0xdd72, 0xb760, 0xb761, 0xdd74, 0xdd76, 0xdd75, 0xe1d7, 0xe1d6, 0xba49, 0xe1d8, 0x8d79, 0xe5ac, 0xbcae, 0xbed4, 0xc0b8, 0xc257, 0xc0b9, 0xa4e1, 0x8bfc, 0xa076, 0xcae6, 0xccb2, 0xa9d1, 0xa9d0, 0xa9d2, 0xabf3, 0xced2, 0xced3, 0xd1b0, 0xaeb0, 0xb1af, 0xb476, 0xd951, 0xa4e2, 0x8bcd, 0xa47e, 0xa4e3, 0xc97d, 0xa5b7, 0xa5b6, 0xa5b4, 0xa5b5, 0xa6ab, 0xc9e9, 0xc9eb, 0xa6aa, 0xc9e3, 0xc9e4, 0xc9ea, 0xc9e6, 0xc9e8, 0xa6a9, 0xc9e5, 0xc9ec, 0xc9e7, 0x9f5a, 0xa7e1, 0xa7ea, 0xa7e8, 0xcaf0, 0xcaed, 0xcaf5, 0xa7e6, 0xcaf6, 0xa7df, 0xcaf3, 0xa7e5, 0xcaef, 0xcaee, 0xa7e3, 0xcaf4, 0xa7e4, 0xa9d3, 0xa7de, 0xcaf1, 0x9ff4, 0xcae7, 0xa7db, 0x9fba, 0xa7ee, 0xcaec, 0xcaf2, 0xa7e0, 0xa7e2, 0xcae8, 0xcae9, 0xcaea, 0x8d7a, 0xa7ed, 0xa7e7, 0xa7ec, 0xcaeb, 0xa7eb, 0xa7dd, 0xa7dc, 0xa7e9, 0x9e45, 0x93b0, 0xa075, 0xa9e1, 0xccbe, 0xccb7, 0xa9dc, 0xa9ef, 0xccb3, 0xccba, 0xccbc, 0xccbf, 0xa9ea, 0xccbb, 0xccb4, 0xa9e8, 0xccb8, 0xccc0, 0xa9d9, 0xccbd, 0xa9e3, 0xa9e2, 0xccb6, 0xa9d7, 0xa9d8, 0x9b46, 0xa9d6, 0xfcae, 0xa9ee, 0xa9e6, 0xa9e0, 0xa9d4, 0xccb9, 0xa9df, 0xa9d5, 0xa9e7, 0xa9f0, 0xced4, 0xa9e4, 0xccb5, 0xa9da, 0xa9dd, 0xa9de, 0xfcb0, 0xa9ec, 0xa9ed, 0xa9eb, 0xa9e5, 0xa9e9, 0xa9db, 0xabf4, 0xfa51, 0x8d7b, 0xceda, 0xac41, 0xabf8, 0xabfa, 0xac40, 0xcee6, 0xabfd, 0xd1b1, 0xaeb1, 0xac43, 0xced7, 0xcedf, 0xabfe, 0xcede, 0xcedb, 0xcee3, 0xcee5, 0xabf7, 0xabfb, 0xac42, 0xaeb3, 0xcee0, 0xabf9, 0xac45, 0xced9, 0xabfc, 0xaeb2, 0xabf6, 0xced6, 0xcedd, 0xced5, 0xced8, 0xcedc, 0xd1b2, 0xac44, 0xcee1, 0xcee2, 0xcee4, 0xabf5, 0x8d7c, 0xaec1, 0xd1be, 0xaebf, 0xaec0, 0xd1b4, 0xd1c4, 0x9ed6, 0xaeb6, 0x93ac, 0xd566, 0xd1c6, 0xd1c0, 0x9f5b, 0xd1b7, 0x93a9, 0xd1c9, 0xd1ba, 0xaebc, 0xd57d, 0xd1bd, 0xaebe, 0xaeb5, 0xd1cb, 0xd1bf, 0xaeb8, 0xd1b8, 0xd1b5, 0xd1b6, 0xaeb9, 0xd1c5, 0xd1cc, 0xaebb, 0xd1bc, 0xd1bb, 0xaec3, 0xaec2, 0xaeb4, 0xaeba, 0xaebd, 0xd1c8, 0xd1c2, 0xaeb7, 0xd1b3, 0xd1ca, 0xd1c1, 0xd1c3, 0xd1c7, 0xa07c, 0xd567, 0xb1b7, 0xb1cb, 0xb1ca, 0xb1bf, 0xfcb2, 0xd579, 0xd575, 0xd572, 0xd5a6, 0xb1ba, 0xb1b2, 0xd577, 0xb4a8, 0xb1b6, 0xd5a1, 0x8ac1, 0xb1cc, 0xb1c9, 0xd57b, 0xd56a, 0x9fb4, 0xb1c8, 0xd5a3, 0xd569, 0xb1bd, 0xb1c1, 0xd5a2, 0xd573, 0xb1c2, 0xb1bc, 0xd568, 0xfcac, 0xb478, 0xd5a5, 0xd571, 0xb1c7, 0xd574, 0xd5a4, 0xb1c6, 0xd952, 0xb1b3, 0xd56f, 0xb1b8, 0xb1c3, 0xb1be, 0xd578, 0xd56e, 0xd56c, 0xd57e, 0xb1b0, 0xb1c4, 0xb1b4, 0xb477, 0xd57c, 0xb1b5, 0xb1b1, 0xb1c0, 0xb1bb, 0xb1b9, 0xd570, 0xb1c5, 0xd56d, 0xd57a, 0xd576, 0xd954, 0xd953, 0x9e4c, 0xd56b, 0xd964, 0xb47a, 0x8fc5, 0xd96a, 0xd959, 0xd967, 0xdd77, 0xb47d, 0xd96b, 0xd96e, 0xb47c, 0xd95c, 0xd96d, 0xd96c, 0xb47e, 0xd955, 0xb479, 0xb4a3, 0x93ad, 0xb4a1, 0xd969, 0xd95f, 0xb4a5, 0xd970, 0xd968, 0xd971, 0xb4ad, 0xb4ab, 0xd966, 0xd965, 0x9dc3, 0xd963, 0xd95d, 0xb4a4, 0x8da2, 0xb4a2, 0xd1b9, 0xd956, 0x9d4a, 0xddb7, 0xd957, 0xb47b, 0xb4aa, 0xdd79, 0xb4a6, 0xb4a7, 0xd958, 0xd96f, 0xdd78, 0xd960, 0xd95b, 0xb4a9, 0xd961, 0xd95e, 0xfcb6, 0xb4ae, 0x8da3, 0x9e4b, 0x9e4d, 0xb770, 0x8da4, 0xdd7c, 0xddb1, 0xddb6, 0xddaa, 0xb76c, 0xddbb, 0xb769, 0xdd7a, 0xdd7b, 0xb762, 0xb76b, 0xdda4, 0xb76e, 0xb76f, 0xdda5, 0xddb2, 0xddb8, 0xb76a, 0xb764, 0xdda3, 0xdd7d, 0xddba, 0xdda8, 0xdda9, 0xdd7e, 0xddb4, 0xddab, 0xddb5, 0xddad, 0xb765, 0xe1d9, 0xb768, 0xb766, 0xddb9, 0xddb0, 0xddac, 0x8afd, 0xdda1, 0xba53, 0xddaf, 0xb76d, 0xdda7, 0xfcb5, 0xdda6, 0xfcc3, 0x93b2, 0xb767, 0xb763, 0xe1ee, 0xddb3, 0xddae, 0xdda2, 0xe1e9, 0xe1da, 0xe1e5, 0xe1ec, 0xba51, 0xb4ac, 0xe1ea, 0xba4c, 0xba4b, 0xe1f1, 0x8da5, 0xe1db, 0xe1e8, 0xe1dc, 0xe1e7, 0xba4f, 0xe1eb, 0xd962, 0xe1f2, 0xe1e3, 0xba52, 0xe5ba, 0xbcaf, 0xe1f0, 0xe1ef, 0xba54, 0xe5ad, 0xbcb0, 0xe5ae, 0x93a1, 0xe1df, 0xe1e0, 0xe1dd, 0xe1e2, 0xe1de, 0xe1f3, 0xba4e, 0xbcb1, 0xba50, 0xba55, 0x8ac6, 0xe1e1, 0xe1ed, 0xe1e6, 0xe5b1, 0xba4a, 0xbcb4, 0xe9aa, 0xe5b6, 0xe5b5, 0xe5b7, 0x8a5b, 0xe5b4, 0xbcb5, 0x894d, 0xbcbb, 0xbcb8, 0xbcb9, 0xe5af, 0xe5b2, 0xe5bc, 0xbcc1, 0xbcbf, 0xe5b3, 0xd95a, 0xbcb2, 0xe5b9, 0xe5b0, 0xbcc2, 0xe5b8, 0xba4d, 0xbcb7, 0xe1e4, 0xbcba, 0xbcbe, 0xbcc0, 0xbcbd, 0xbcbc, 0xfed4, 0xbcb6, 0xe5bb, 0xbcb3, 0xbcc3, 0x8a78, 0x93ab, 0xbed8, 0xbed9, 0xe9a9, 0xbee2, 0xbedf, 0x8da7, 0xbed6, 0xbedd, 0xe9ab, 0xbedb, 0xbed5, 0xbedc, 0xe9a8, 0xc0bb, 0xbed7, 0xbede, 0xc0ba, 0xe9a7, 0xe9a6, 0xbee0, 0x9f45, 0xbee1, 0xe9a5, 0xe9a4, 0xc0bc, 0xe9ae, 0xbeda, 0xe9ac, 0x8a56, 0xc0bd, 0xfcbf, 0xc0c2, 0xecea, 0xecec, 0xfcc0, 0xc0bf, 0x8ee6, 0xeced, 0xece9, 0x8aa4, 0xeceb, 0xc0c0, 0xc0c3, 0xece8, 0xc0be, 0xc0c1, 0xc259, 0xe9ad, 0xc258, 0xc25e, 0xefd4, 0xc25c, 0xc25d, 0xefd7, 0xefd3, 0xc25a, 0xefd1, 0xc36b, 0xefd5, 0xefd6, 0xefd2, 0xc25b, 0xf242, 0xf245, 0x8943, 0xf246, 0xf244, 0xf247, 0xc36c, 0xf243, 0x93f3, 0xf44e, 0xc464, 0xf44d, 0xf44c, 0xf44b, 0xc463, 0xc465, 0xf5cd, 0xc4e2, 0xc4e1, 0xfcab, 0x9ea2, 0xf6e1, 0xf6e0, 0xf6e3, 0xc5cb, 0xc575, 0xf7dd, 0xf6e2, 0xf7dc, 0xc5cd, 0xc5cc, 0xc5f3, 0xf8a9, 0xf8ef, 0xa4e4, 0x9dc7, 0xd972, 0xe9af, 0xc6d2, 0x8bce, 0xa6ac, 0xcaf7, 0xa7f1, 0xa7ef, 0xa7f0, 0xccc1, 0xa9f1, 0xac46, 0xcee7, 0xcee8, 0xac47, 0xd1ce, 0xaec4, 0xaec5, 0xd1cd, 0xfcc5, 0xb1d3, 0xb1cf, 0xd5a7, 0xb1d6, 0xb1d5, 0xb1ce, 0xb1d1, 0xb1d4, 0xb1d0, 0xd976, 0xb1cd, 0xb4af, 0xfccb, 0xb4b1, 0xb4b2, 0xd975, 0xd978, 0xb4b0, 0xd973, 0xd977, 0xd974, 0x93b3, 0xb771, 0xfcca, 0xddbc, 0xba56, 0xe1f4, 0xbee3, 0xbcc4, 0xe5bd, 0xbcc5, 0xbcc6, 0xe5bf, 0xe5be, 0xe5c0, 0xe9b1, 0xe9b0, 0xecef, 0xecee, 0xc0c4, 0xc0c5, 0xf248, 0xfcc9, 0x8dac, 0xa4e5, 0xfbc6, 0x8967, 0x8c7e, 0xd979, 0xb4b4, 0xb4b3, 0xddbd, 0xefd8, 0xc4e3, 0xf7de, 0xa4e6, 0xaec6, 0xb1d8, 0xb1d7, 0xd97a, 0xd97b, 0xb772, 0xe1f5, 0xba57, 0xe9b2, 0xa4e7, 0xa5b8, 0xa9f2, 0xccc2, 0xcee9, 0xac48, 0xb1d9, 0xd97c, 0xb4b5, 0xb773, 0xe5c1, 0xe5c2, 0xfccd, 0xecf0, 0xc25f, 0xf8f0, 0xa4e8, 0xccc3, 0xa9f3, 0xac49, 0x9cf3, 0xceea, 0xaec7, 0xd1d2, 0xd1d0, 0xd1d1, 0xaec8, 0xd1cf, 0xb1db, 0xb1dc, 0xd5a8, 0xb1dd, 0xb1da, 0xd97d, 0xfcd0, 0xd97e, 0xddbe, 0x95bb, 0xba59, 0xba58, 0xecf1, 0xefd9, 0xf24a, 0xf249, 0xf44f, 0xfcd3, 0xc95e, 0xac4a, 0xfcd4, 0xa4e9, 0xa5b9, 0xa6ae, 0xa6ad, 0xa6af, 0xa6b0, 0xc9ee, 0xc9ed, 0xcaf8, 0xa7f2, 0xcafb, 0xcafa, 0xcaf9, 0xcafc, 0xa9f4, 0xccc9, 0xccc5, 0xccce, 0x8dae, 0xa9fb, 0xa9f9, 0xccca, 0xccc6, 0xcccd, 0xa9f8, 0xaa40, 0xccc8, 0xccc4, 0xa9fe, 0xcccb, 0xa9f7, 0xcccc, 0xa9fa, 0xa9fc, 0xccd0, 0xcccf, 0xccc7, 0xa9f6, 0xa9f5, 0xa9fd, 0xfcd7, 0xceef, 0xcef5, 0x93db, 0xac50, 0xac4d, 0xceec, 0xcef1, 0xfe63, 0xac53, 0xac4b, 0xcef0, 0xac4e, 0xac51, 0xcef3, 0xac4c, 0xcef8, 0xac4f, 0x93d5, 0xac52, 0xceed, 0xcef2, 0xcef6, 0xceee, 0xceeb, 0xcef7, 0xcef4, 0xaed0, 0xaec9, 0xaecc, 0xfcda, 0xaecf, 0xd1d5, 0x9b71, 0xaeca, 0xd1d3, 0xfcdd, 0xaece, 0xaecb, 0xd1d6, 0xaecd, 0x8daf, 0xfaf2, 0xd5ac, 0xb1df, 0xd5ab, 0xd5ad, 0xb1de, 0xb1e3, 0xd1d4, 0xd5aa, 0xd5ae, 0x93d8, 0xb1e0, 0xd5a9, 0xb1e2, 0xfcdf, 0xb1e1, 0xd9a7, 0x93d3, 0xd9a2, 0xb4b6, 0xb4ba, 0xb4b7, 0xd9a5, 0xd9a8, 0xfce1, 0xb4b8, 0xb4b9, 0xb4be, 0xddc7, 0xd9a6, 0xb4bc, 0xd9a3, 0xd9a1, 0x8e76, 0xb4bd, 0xd9a4, 0xb779, 0xfc62, 0xddbf, 0xb776, 0xb777, 0xb775, 0xddc4, 0xddc3, 0xddc0, 0xb77b, 0x93d1, 0xddc2, 0xb4bb, 0x8db1, 0xddc6, 0xddc1, 0xb778, 0xb774, 0xb77a, 0xddc5, 0x9859, 0xba5c, 0xe1f8, 0xe1f7, 0xe1f6, 0xba5a, 0xfb52, 0xba5b, 0xe5c5, 0xe5c8, 0xbcc8, 0xfb53, 0xbcc7, 0xe5c9, 0xe5c4, 0xbcca, 0xe5c6, 0xfb4d, 0xbcc9, 0xe5c3, 0x9cbf, 0xe5c7, 0xbee9, 0xbee6, 0xe9bb, 0xe9ba, 0xe9b9, 0xe9b4, 0x9b72, 0xe9b5, 0xbee7, 0xbee4, 0xbee8, 0xe9b3, 0xbee5, 0xe9b6, 0xe9b7, 0xe9bc, 0xfb50, 0x93be, 0xe9b8, 0xecf2, 0xc0c7, 0xefdc, 0xc0c6, 0xefda, 0xefdb, 0xc260, 0xc36e, 0xf24b, 0xc36d, 0xf451, 0xf452, 0xc466, 0xf450, 0xc4e4, 0xf7df, 0xc5ce, 0xf8aa, 0xf8ab, 0xa4ea, 0x9df1, 0xa6b1, 0xa6b2, 0xa7f3, 0xccd1, 0xac54, 0xaed1, 0xb1e4, 0xb0d2, 0xb4bf, 0xb4c0, 0xb3cc, 0xd9a9, 0xfceb, 0xb77c, 0xe1fa, 0xe1f9, 0xa4eb, 0xa6b3, 0xccd2, 0xaa42, 0xa0bb, 0xaa41, 0x9b7e, 0xcef9, 0xcefa, 0xd1d7, 0xd1d8, 0xaed2, 0xaed3, 0x8db3, 0xaed4, 0xd5af, 0x8c52, 0xb1e6, 0xb4c2, 0x9ae8, 0xb4c1, 0xddc8, 0xdf7a, 0xe1fb, 0xe9bd, 0x8edc, 0xc261, 0xc467, 0xa4ec, 0xa5bc, 0xa5bd, 0xa5bb, 0xa5be, 0xa5ba, 0xa6b6, 0xc9f6, 0xa6b5, 0xa6b7, 0x9cf9, 0xc9f1, 0xc9f0, 0xc9f3, 0xc9f2, 0xc9f5, 0xa6b4, 0xc9ef, 0xc9f4, 0xfa50, 0xcafd, 0xa7fd, 0xcafe, 0xcb43, 0xa7fc, 0xcb47, 0xcb42, 0xcb45, 0xa7f5, 0xa7f6, 0xa7f7, 0xa7f8, 0xa840, 0xcb41, 0xa7fa, 0xa841, 0xcb40, 0xcb46, 0xa7f9, 0xcb44, 0xa7fb, 0xa7f4, 0xa7fe, 0x98e7, 0xfcf3, 0xfcf2, 0xaa57, 0x8cca, 0xccd4, 0xaa43, 0xaa4d, 0xaa4e, 0xaa46, 0xaa58, 0xaa48, 0xccdc, 0xaa53, 0xccd7, 0xaa49, 0xcce6, 0xcce7, 0xccdf, 0xccd8, 0xaa56, 0xcce4, 0xaa51, 0xaa4f, 0xcce5, 0xcce3, 0xccdb, 0xccd3, 0xccda, 0xaa4a, 0xaa50, 0xaa44, 0xccde, 0xccdd, 0xccd5, 0x93e5, 0xaa52, 0xcce1, 0xccd6, 0xaa55, 0xcce8, 0xaa45, 0xaa4c, 0xccd9, 0xcce2, 0xaa54, 0xaa47, 0xaa4b, 0xcce0, 0x9a59, 0x8db5, 0xfd4d, 0xcf5b, 0xac5c, 0xac69, 0xfd5e, 0xcf56, 0xcf4c, 0xac62, 0xcf4a, 0xac5b, 0xcf45, 0xac65, 0xcf52, 0xcefe, 0xcf41, 0x8f7d, 0xcf44, 0xcefb, 0xcf51, 0xcf61, 0xac60, 0xcf46, 0xcf58, 0xcefd, 0xcf5f, 0xcf60, 0xcf63, 0xcf5a, 0xcf4b, 0xcf53, 0xac66, 0xac59, 0xac61, 0xac6d, 0xac56, 0xac58, 0x9547, 0xfcf6, 0xcf43, 0xac6a, 0xac63, 0xcf5d, 0xcf40, 0xac6c, 0xac67, 0xcf49, 0xac6b, 0xcf50, 0xcf48, 0xac64, 0xcf5c, 0xcf54, 0xac5e, 0xcf62, 0xcf47, 0xac5a, 0xcf59, 0xcf4f, 0xac5f, 0xcf55, 0xac57, 0xcefc, 0xac68, 0xaee3, 0xac5d, 0xcf4e, 0xcf4d, 0xcf42, 0x9250, 0xcf5e, 0xcf57, 0x8968, 0xac55, 0x8db6, 0xfcfb, 0xa07d, 0x98fc, 0x8969, 0xfe4f, 0x9256, 0xd1ec, 0xaeea, 0xd1ed, 0xd1e1, 0xaedf, 0xaeeb, 0xd1da, 0xfac9, 0xd1e3, 0xd1eb, 0x93e8, 0xd1d9, 0xd1f4, 0xaed5, 0xfcf8, 0xd1f3, 0xd1ee, 0xd1ef, 0xaedd, 0xaee8, 0xd1e5, 0xd1e6, 0xd1f0, 0xd1e7, 0xd1e2, 0xd1dc, 0xd1dd, 0xd1ea, 0xd1e4, 0x9ce3, 0xfda9, 0xaed6, 0xaeda, 0xd1f2, 0xd1de, 0xaee6, 0xaee2, 0xfc44, 0xaee5, 0xaeec, 0xaedb, 0xaee7, 0xd1e9, 0xaee9, 0xaed8, 0x9640, 0xaed7, 0xd1db, 0x8db8, 0xd1df, 0xaee0, 0xd1f1, 0xd1e8, 0xd1e0, 0xaee4, 0xaee1, 0xaed9, 0xaedc, 0x9b4a, 0x8fb9, 0xfcfe, 0x896a, 0xd5c4, 0xd5b4, 0xd5b5, 0xd5b9, 0xd5c8, 0xd5c5, 0xd5be, 0xd5bd, 0xb1ed, 0xd5c1, 0xd5d0, 0xd5b0, 0xd5d1, 0xd5c3, 0xd5d5, 0xd5c9, 0xb1ec, 0xd5c7, 0xb1e7, 0xb1fc, 0xb1f2, 0x8db9, 0xb1f6, 0xb1f5, 0xd5b1, 0x917e, 0xd5ce, 0xd5d4, 0xd5cc, 0xd5d3, 0xd5c0, 0xd5b2, 0xd5d2, 0xd5c2, 0xb1ea, 0xb1f7, 0xd5cb, 0xb1f0, 0x93f4, 0xd5ca, 0xd5b3, 0xb1f8, 0xb1fa, 0xd5cd, 0xb1fb, 0xb1e9, 0xd5ba, 0xd5cf, 0xfb7c, 0xb1ef, 0xb1f9, 0xd5bc, 0xd5c6, 0xd5b7, 0xd5bb, 0xb1f4, 0xd5b6, 0xb1e8, 0xb1f1, 0xb1ee, 0xd5bf, 0xaede, 0xd9c0, 0xb1eb, 0x93e7, 0x97ef, 0xfe4a, 0xfd45, 0xb1f3, 0x96a5, 0xd9c3, 0xd9d9, 0xd9ce, 0xb4d6, 0xfee0, 0xb4d1, 0xd9bd, 0xb4d2, 0xd9cd, 0xd9c6, 0xd9d3, 0xb4ce, 0xd9ab, 0xd9d5, 0xb4c4, 0xd9b3, 0xb4c7, 0xb4c6, 0xb4d7, 0xd9ad, 0xd9cf, 0xd9d0, 0xb4c9, 0xb4c5, 0xd9bb, 0xb4d0, 0xd9b6, 0xd9d1, 0xb4cc, 0xd9c9, 0xd9d6, 0xd9b0, 0xd9b5, 0xd9af, 0xb4cb, 0xd9c2, 0xddde, 0xd9b1, 0xb4cf, 0xd9ba, 0xd9d2, 0xb4ca, 0xd9b7, 0xd9b4, 0xd9c5, 0xb4cd, 0xb4c3, 0xb4d9, 0xd9c8, 0xd9c7, 0xfd48, 0xfd47, 0xfef2, 0xfe6a, 0xd9ac, 0xb4c8, 0xd9d4, 0xd9bc, 0xd9be, 0x8dbd, 0xd9cb, 0xd9ca, 0xd9aa, 0xb4d3, 0xb4d5, 0xd9b2, 0xd9b9, 0xd9c1, 0xb4d4, 0xd9b8, 0xd9c4, 0xd9d7, 0xd9cc, 0x9ba1, 0x8ca2, 0x9ab7, 0x8efc, 0xd9d8, 0xd9ae, 0x9fa1, 0xddf2, 0xb7a6, 0xddf0, 0xdddb, 0xdde0, 0xddd9, 0xfd51, 0xddec, 0xddcb, 0xddd2, 0xddea, 0xddf4, 0xdddc, 0xfaad, 0xddcf, 0xdde2, 0xdde7, 0xddd3, 0x8dbe, 0xdde4, 0xddd0, 0x89a4, 0xddd7, 0xddd8, 0xb7a8, 0xddeb, 0xdde9, 0xddcc, 0xddee, 0xddef, 0xddf1, 0xb7ac, 0xb7a4, 0x9ad9, 0xd5b8, 0xddd4, 0xdde6, 0xddd5, 0xb7a1, 0xb7b1, 0xdded, 0xb7af, 0xb7ab, 0xddca, 0xb7a3, 0xfd4e, 0xddcd, 0xb7b0, 0x8dc0, 0xdddd, 0xddc9, 0x97f0, 0xb7a9, 0xdde1, 0xddd1, 0xb7aa, 0xddda, 0xb77e, 0xb4d8, 0xdde3, 0xd9bf, 0xddce, 0x93b4, 0xfd44, 0xdde8, 0xb7a5, 0xdde5, 0xb7a2, 0xdddf, 0xb7ad, 0xddd6, 0xddf3, 0x9fa7, 0xb7a7, 0xdec6, 0x8dc2, 0xb7ae, 0x99b6, 0xe24a, 0xe248, 0xe25e, 0xe246, 0xe258, 0xb77d, 0xba5f, 0xe242, 0xe25d, 0xfd52, 0xe247, 0xe255, 0xba64, 0xba5d, 0xe25b, 0x8dc1, 0xe240, 0xe25a, 0x8e46, 0xba6f, 0xe251, 0xe261, 0xba6d, 0xe249, 0xba5e, 0xe24b, 0xe259, 0xba67, 0xe244, 0xba6b, 0xba61, 0xe24d, 0xe243, 0xe1fc, 0xa0d1, 0xe257, 0xba68, 0xe260, 0xe1fd, 0xba65, 0xe253, 0xba66, 0xe245, 0xe250, 0xe24c, 0xe24e, 0x9fca, 0xba60, 0xe25f, 0xba6e, 0xe24f, 0xe262, 0xe1fe, 0xe254, 0xba63, 0xba6c, 0xba6a, 0xe241, 0xe256, 0xba69, 0x92cf, 0xba62, 0xe252, 0x9cf4, 0x8dc4, 0xe25c, 0xfd41, 0xe5d5, 0xe5d1, 0xe5cd, 0xe5e1, 0xe5de, 0xbccd, 0x9b4c, 0xe5e5, 0xe5d4, 0xbcd8, 0xe5db, 0xe5d0, 0xe5da, 0xbcd5, 0xe5ee, 0xe5eb, 0xe5dd, 0xe5ce, 0xfd57, 0xfcef, 0xe5e2, 0xe5e4, 0xbcd1, 0xe5d8, 0xe5d3, 0xe5ca, 0xbcce, 0xbcd6, 0x9cde, 0xe5e7, 0xbcd7, 0xe5cb, 0xe5ed, 0xe5e0, 0xe5e6, 0xbcd4, 0xfd42, 0x986c, 0xe5e3, 0xe5ea, 0xbcd9, 0xbcd3, 0xe5dc, 0xe5cf, 0xe5ef, 0xe5cc, 0xe5e8, 0xbcd0, 0x97f9, 0xe5d6, 0x9558, 0xe5d7, 0xbccf, 0xbccc, 0xe5d2, 0xbcd2, 0xbccb, 0xe5e9, 0xe5ec, 0xe5d9, 0xe9ca, 0x985e, 0xfe7b, 0x94cd, 0xe9c2, 0x93ee, 0xe9be, 0xbef6, 0xbeeb, 0xbef0, 0xbeec, 0xe9cc, 0xe9d7, 0xbeea, 0xe9c4, 0xe9cd, 0xe5df, 0xe9ce, 0x8ca3, 0xbef1, 0xfd5a, 0xe9dd, 0xbef5, 0xbef8, 0xe9c0, 0xbef4, 0x93f5, 0xe9db, 0xe9dc, 0xe9d2, 0xe9d1, 0xe9c9, 0x93ef, 0x8eea, 0xe9d3, 0xe9da, 0xe9d9, 0x8f5b, 0xbeef, 0xbeed, 0xe9cb, 0xe9c8, 0xe9c5, 0xe9d8, 0xbef7, 0xe9d6, 0xbef3, 0xbef2, 0x8c5e, 0xe9d0, 0x8dc6, 0xe9bf, 0xe9c1, 0xe9c3, 0xe9d5, 0xe9cf, 0xbeee, 0xe9c6, 0xe9d4, 0x8dc8, 0x8dc7, 0xe9c7, 0x93f7, 0xc0cf, 0xed45, 0xc0c8, 0xecf5, 0x8dc9, 0xed41, 0xc0ca, 0xed48, 0xecfc, 0xecf7, 0xfbf2, 0xed49, 0xecf3, 0xecfe, 0x9670, 0xc0d1, 0xed44, 0xed4a, 0xecfd, 0xc0c9, 0xed40, 0xecf4, 0xc0d0, 0x8dcb, 0xed47, 0xecf9, 0xc0cc, 0xfd5c, 0xecfb, 0xecf8, 0xc0d2, 0xecfa, 0xc0cb, 0xc0ce, 0xed43, 0xecf6, 0xed46, 0x8f65, 0xed42, 0x8dcd, 0xc263, 0xefe7, 0xc268, 0xc269, 0x9da8, 0x94f9, 0xc262, 0xefe6, 0x8dce, 0xefe3, 0xefe4, 0xc266, 0xefde, 0xefe2, 0xc265, 0xefdf, 0x93ea, 0xc267, 0xc264, 0xefdd, 0xefe1, 0xefe5, 0xfd5f, 0x93f0, 0x9fb6, 0xf251, 0xf24e, 0xf257, 0xf256, 0xf254, 0xf24f, 0xc372, 0x8dcf, 0x9763, 0xf250, 0xc371, 0xc0cd, 0xf253, 0xc370, 0xf258, 0xf252, 0xf24d, 0xefe0, 0xc36f, 0xf24c, 0xf456, 0xf455, 0xf255, 0xc468, 0xf459, 0xf45a, 0xf454, 0xf458, 0xf453, 0x8dd0, 0xf5d1, 0xf457, 0xc4e7, 0xc4e5, 0xf5cf, 0xf5d2, 0xf5ce, 0xf5d0, 0xc4e6, 0x93f1, 0xf6e5, 0xf6e6, 0xc576, 0xf6e4, 0xf7e2, 0xc5cf, 0xf7e0, 0xf7e1, 0xf8ac, 0xc656, 0xf8f3, 0xf8f1, 0xf8f2, 0xf8f4, 0xfd62, 0xf9bb, 0xa4ed, 0xa6b8, 0xaa59, 0xcce9, 0xcf64, 0xd1f5, 0xd1f7, 0xd1f6, 0xd1f8, 0xb1fd, 0xd5d7, 0xd1f9, 0xfd65, 0xd5d6, 0xd5d8, 0xd5d9, 0xd9da, 0xb4db, 0xd9db, 0xd9dd, 0xb4dc, 0xb4da, 0xd9dc, 0xddfa, 0xddf8, 0xddf7, 0xddf6, 0xddf5, 0xb7b2, 0xddf9, 0xba70, 0xe263, 0xe265, 0xba71, 0xe264, 0xbcdb, 0xbcda, 0xe5f0, 0x9fdb, 0xe9df, 0xe9de, 0xe9e0, 0x93f8, 0xbef9, 0xed4b, 0xc0d3, 0xefe8, 0xc26a, 0xf259, 0xc577, 0xa4ee, 0xa5bf, 0xa6b9, 0xa842, 0xaa5a, 0xaa5b, 0xac6e, 0xd1fa, 0x8bf7, 0xb7b3, 0xfd66, 0xe6d1, 0xbefa, 0xc26b, 0xa4ef, 0x8bcf, 0xa6ba, 0xcceb, 0xaa5c, 0xccea, 0x8dd1, 0xcf65, 0xac6f, 0xcf66, 0xac70, 0xd1fc, 0xaeee, 0xaeed, 0xd5de, 0xd5dc, 0xd5dd, 0xd5db, 0xd5da, 0xd9de, 0xd9e1, 0xb4de, 0xd9df, 0xb4dd, 0xd9e0, 0xddfb, 0xe266, 0xe267, 0xe268, 0xe5f3, 0xe5f2, 0xbcdc, 0xe5f1, 0xe5f4, 0xe9e1, 0xe9e2, 0xe9e3, 0xed4c, 0xc0d4, 0xc26c, 0xf25a, 0xc4e8, 0xc95f, 0xac71, 0xcf67, 0xaeef, 0xb1fe, 0xb4df, 0xd9e2, 0xb7b5, 0xb7b4, 0x8dd2, 0xe269, 0xe26a, 0xbcdd, 0xbcde, 0xe9e5, 0xe9e4, 0xefe9, 0xf7e3, 0xa4f0, 0xc960, 0xa5c0, 0xa843, 0xcb48, 0xac72, 0xb7b6, 0xa4f1, 0xcf68, 0xac73, 0xcf69, 0xc0d5, 0xa4f2, 0xfd71, 0xccec, 0xcf6a, 0xfd6f, 0xd242, 0xd241, 0xd1fe, 0xd1fd, 0xd243, 0xd240, 0x8dd3, 0xb240, 0xb241, 0xb4e0, 0xd9e3, 0xd9e4, 0xd9e5, 0xde41, 0xde42, 0xde40, 0x9fe7, 0xddfd, 0xddfe, 0xb7b7, 0xe26b, 0xe5f7, 0xe5f6, 0xe5f5, 0xe5f8, 0xe9e7, 0xe9e6, 0xbefb, 0xe9e8, 0xc0d6, 0xed4d, 0xefea, 0xf25b, 0xf6e7, 0xa4f3, 0xa5c2, 0xa5c1, 0xaa5d, 0xc961, 0xc97e, 0xa6bb, 0xc9f7, 0xcb49, 0xcb4a, 0xaa5e, 0x90bd, 0xcced, 0xac74, 0xcf6b, 0xcf6c, 0xaef0, 0xaef4, 0xd244, 0xaef3, 0xaef1, 0xaef2, 0xd5df, 0xb242, 0xb4e3, 0xb4e1, 0xb4e2, 0xd9e6, 0x9fd0, 0xba72, 0xa4f4, 0x8bd0, 0xc9a1, 0xfd72, 0xa5c3, 0x9cae, 0x8bd1, 0xc9a4, 0x8adb, 0xa5c6, 0xc9a3, 0xa5c5, 0xa5c4, 0xa844, 0xc9a2, 0xc9f8, 0xfae4, 0xc9fc, 0xc9fe, 0xca40, 0xa6c5, 0xa6c6, 0xc9fb, 0xa6c1, 0xc9f9, 0xc9fd, 0xa6c2, 0xa6bd, 0x95ce, 0xa6be, 0xfd76, 0xa6c4, 0xc9fa, 0xa6bc, 0xa845, 0xa6bf, 0xa6c0, 0xa6c3, 0xcb5b, 0xcb59, 0xcb4c, 0xa851, 0xcb53, 0xa84c, 0xcb4d, 0xcb55, 0xfb62, 0xcb52, 0xa84f, 0xcb51, 0xa856, 0xcb5a, 0xa858, 0x8dd4, 0xa85a, 0xcb4b, 0xfd78, 0xa84d, 0xcb5c, 0xa854, 0xa857, 0x8ee3, 0xcd45, 0xa847, 0xa85e, 0xa855, 0xcb4e, 0xa84a, 0xa859, 0xcb56, 0xa848, 0xa849, 0xcd43, 0xcb4f, 0xa850, 0xa85b, 0xcb5d, 0xcb50, 0xa84e, 0xa853, 0xccee, 0xa85c, 0xcb57, 0xa852, 0xa85d, 0xa846, 0xcb54, 0xa84b, 0xcb58, 0xcd44, 0x9076, 0x98c6, 0x8dd5, 0xaa6a, 0xaa7a, 0xccf5, 0xaa71, 0x97d1, 0xcd4b, 0xaa62, 0x9eb6, 0xaa65, 0xcd42, 0xccf3, 0xccf7, 0xaa6d, 0xaa6f, 0xccfa, 0xaa76, 0xaa68, 0xaa66, 0xaa67, 0xaa75, 0xcd47, 0xaa70, 0xccf9, 0xccfb, 0xaa6e, 0xaa73, 0xccfc, 0xcd4a, 0xac75, 0xaa79, 0xfac7, 0xaa63, 0xcd49, 0xa042, 0xcd4d, 0xccf8, 0xcd4f, 0xcd40, 0xaa6c, 0xccf4, 0xaa6b, 0xaa7d, 0xaa72, 0xccf2, 0xcf75, 0xaa78, 0xaa7c, 0xcd41, 0xcd46, 0x9873, 0xaa7e, 0xaa77, 0xaa69, 0xaa5f, 0xaa64, 0xccf6, 0xaa60, 0xcd4e, 0x9ffc, 0xccf0, 0xccef, 0xccfd, 0xccf1, 0xaa7b, 0xaef5, 0xaa74, 0xccfe, 0xaa61, 0xaca6, 0xcd4c, 0x8ca5, 0xcf7c, 0xcfa1, 0x8dd7, 0xcfa4, 0xcf77, 0x92fb, 0x8dd8, 0xcfa7, 0xcfaa, 0xcfac, 0xcf74, 0xac76, 0xac7b, 0xd249, 0xacad, 0xcfa5, 0xcfad, 0xcf7b, 0xcf73, 0xd264, 0xac7e, 0xcfa2, 0xcf78, 0xcf7a, 0xaca5, 0xcf7d, 0xac7d, 0xcf70, 0xcfa8, 0xcfab, 0x944f, 0xac7a, 0x8dd9, 0xaca8, 0xcf6d, 0xacaa, 0xac78, 0xacae, 0xcfa9, 0xcf6f, 0xacab, 0xd25e, 0xcd48, 0xac7c, 0xac77, 0xcf76, 0xcf6e, 0xacac, 0xaca4, 0xcfa3, 0xaca9, 0xaca7, 0xcf79, 0xaca1, 0xcf71, 0xaca2, 0xaca3, 0xcf72, 0xcfa6, 0xac79, 0xcf7e, 0x896b, 0x97ce, 0xd24c, 0xaefd, 0xaf43, 0xfaf3, 0xfdae, 0xd255, 0xd25b, 0xd257, 0xd24a, 0xd24d, 0xd246, 0xd247, 0xaf4a, 0xaefa, 0xd256, 0xd25f, 0xaf45, 0xaef6, 0xaf40, 0xd24e, 0xaf42, 0xd24f, 0xd259, 0xfbaf, 0x92b7, 0xaf44, 0xd268, 0xd248, 0xaefc, 0xaefb, 0xaf48, 0xd245, 0xd266, 0xd25a, 0xd267, 0xd261, 0xd253, 0xd262, 0x8dda, 0xd25c, 0xd265, 0xd263, 0xaf49, 0xd254, 0xaef9, 0xaef8, 0xaf41, 0xaf47, 0xd260, 0xaf46, 0xd251, 0xb243, 0x9c5a, 0xd269, 0xd250, 0xd24b, 0xaefe, 0xaf4b, 0xaef7, 0xfdad, 0xd258, 0xd25d, 0x8ddc, 0x9444, 0xb265, 0xd5e1, 0xd5e5, 0xb252, 0xb250, 0x8ddd, 0xb247, 0xd5e3, 0xd5e2, 0xb25b, 0xd5e8, 0xb255, 0xa0d6, 0xd5fa, 0xd647, 0xb244, 0xd5f7, 0xd5f0, 0xb267, 0xd5e0, 0xd5fc, 0xb264, 0xb258, 0xb263, 0xb24e, 0xd5ec, 0xd5fe, 0xd5f6, 0xb24f, 0xb249, 0xd645, 0xd5fd, 0xd640, 0xb251, 0xb259, 0xd642, 0xd5ea, 0xd5fb, 0xd5ef, 0xd644, 0xb25e, 0xb246, 0xb25c, 0xd5f4, 0xd5f2, 0xd5f3, 0xb253, 0xd5ee, 0xd5ed, 0xb248, 0xd5e7, 0xd646, 0xb24a, 0xd5f1, 0xb268, 0xb262, 0xd5e6, 0xb25f, 0xb25d, 0xb266, 0xd5f8, 0xb261, 0xd252, 0xd5f9, 0xb260, 0xd641, 0xb245, 0xd5f5, 0xb257, 0xd5e9, 0xb256, 0xb254, 0xb24c, 0xb24b, 0xd9e7, 0xd643, 0x8c41, 0xd5eb, 0x97d5, 0xd9fc, 0x944a, 0xb24d, 0x944d, 0x97cb, 0x8dde, 0x8ddf, 0xb541, 0xb25a, 0xb4ee, 0xd9f6, 0xb4fc, 0xd9ea, 0xb4eb, 0xb4e7, 0xda49, 0xb4ed, 0xb4f1, 0xb4ec, 0xb4f5, 0xda4d, 0xda44, 0x8de0, 0xfef9, 0xd9f1, 0xb4fa, 0xb4f4, 0xd9fd, 0xb4e4, 0xda4a, 0xda43, 0xb4e8, 0xd9f7, 0xb4f7, 0xda55, 0xda56, 0xb4e5, 0xda48, 0xb4f9, 0xd9fb, 0xd9ed, 0xd9ee, 0xb4fd, 0xd9f2, 0xd9f9, 0xd9f3, 0xb4fb, 0xb544, 0xd9ef, 0xd9e8, 0xd9e9, 0xd9eb, 0xb4ea, 0xd9f8, 0xb4f8, 0xb542, 0xfdc0, 0xfcf9, 0xd9fa, 0xda53, 0xda4b, 0xb4e6, 0xda51, 0xb4f2, 0xb4f0, 0xfb7e, 0xda57, 0xb4ef, 0xda41, 0xd9f4, 0xd9fe, 0xb547, 0xda45, 0xda42, 0xd9f0, 0xb543, 0xda4f, 0xda4c, 0xda54, 0xb4e9, 0xda40, 0xb546, 0xda47, 0xb4f3, 0xb4f6, 0xda46, 0xb545, 0xd9f5, 0xd5e4, 0x92b3, 0xda50, 0xda4e, 0xda52, 0xfdaf, 0x8de1, 0xd9ec, 0xb540, 0x95d3, 0xde61, 0xde60, 0xde46, 0xb7bd, 0xde5f, 0xde49, 0xde4a, 0xb7c7, 0xde68, 0xb7c2, 0xde5e, 0x89c1, 0xde43, 0xb7c8, 0xb7be, 0xde52, 0xde48, 0xde4b, 0xde63, 0xb7b8, 0xde6a, 0xde62, 0xb7c1, 0xde57, 0xb7cc, 0xb7cb, 0xb7c5, 0xde69, 0xb7b9, 0xde55, 0xde4c, 0xde59, 0xde65, 0xb7cd, 0xfd68, 0xb7bb, 0xde54, 0x9cb7, 0xde4d, 0xb7c4, 0x8de3, 0xb7c3, 0xde50, 0xde5a, 0xde64, 0xde47, 0xde51, 0xb7bc, 0xde5b, 0xb7c9, 0xb7c0, 0xde4e, 0xb7bf, 0xde45, 0xde53, 0xde67, 0xb4fe, 0xbab0, 0xde56, 0xe26c, 0xde58, 0xde66, 0xb7c6, 0xde4f, 0xb7ba, 0xb7ca, 0xbcf0, 0xde44, 0xde5d, 0xfac0, 0x8de5, 0xfa64, 0xde5c, 0x8947, 0x8de4, 0x8de7, 0x8de8, 0xe2aa, 0xbaad, 0xe27d, 0xe2a4, 0xbaa2, 0xe26e, 0xbaaf, 0xba77, 0xe26d, 0xe2b0, 0xbab1, 0xe271, 0xe2a3, 0xfdc7, 0xe273, 0xe2b3, 0xe2af, 0xba75, 0xbaa1, 0xe653, 0xbaae, 0xba7d, 0xe26f, 0xfdb0, 0xe2ae, 0xbaa3, 0xe2ab, 0xe2b8, 0xe275, 0xe27e, 0x9445, 0x97d6, 0xe2b6, 0xe2ac, 0xba7c, 0xe27c, 0xba76, 0xba74, 0xbaa8, 0xfcc6, 0x9844, 0xe27a, 0xe277, 0xe278, 0xe2b2, 0xe2b7, 0xe2b5, 0xba7a, 0xe2b9, 0xba7e, 0xbaa7, 0x8de9, 0xe270, 0xe5fa, 0xe279, 0xba78, 0xbaac, 0xbaa9, 0xba7b, 0xe2a5, 0xe274, 0xbaaa, 0xe2a7, 0xbaa4, 0xbaa6, 0xba73, 0x8dea, 0xe2a9, 0xe2a1, 0xe272, 0xbaa5, 0xe2b1, 0xe2b4, 0xe27b, 0xe2a8, 0xfe50, 0xba79, 0xbcdf, 0xe2a6, 0xe5f9, 0xe2ad, 0xfdcc, 0xe276, 0xe644, 0xe64e, 0xbce2, 0xe64d, 0xe659, 0xbce4, 0xe64b, 0x9da7, 0xe64f, 0xbcef, 0xe646, 0xbce7, 0xfdcd, 0xe652, 0xe9f0, 0xbcf3, 0xbcf2, 0xe654, 0xe643, 0xe65e, 0xbced, 0xbce3, 0xe657, 0xe65b, 0xe660, 0xe655, 0xe649, 0xbce6, 0xbce9, 0xbcf1, 0xbcec, 0xe64c, 0xe2a2, 0xfdcf, 0xe648, 0xe65f, 0xbce8, 0x95d2, 0xbceb, 0xe661, 0xbce0, 0xe656, 0xe5fb, 0xe65c, 0xc0df, 0x8ded, 0xe64a, 0xbce1, 0xe645, 0xbce5, 0xe5fc, 0xbaab, 0xe641, 0xfcba, 0xe65a, 0xe642, 0xe640, 0xbcea, 0xe658, 0xe5fe, 0xe651, 0xe650, 0xe65d, 0xe647, 0xbcee, 0xfdc5, 0xe9f3, 0xfdd2, 0xbf49, 0xbefe, 0xea40, 0xe9eb, 0xbf41, 0xe9f7, 0xbf48, 0xbf43, 0xe9f5, 0xed4f, 0xe9fb, 0xea42, 0xe9fa, 0xe9e9, 0xe9f8, 0xea44, 0xea46, 0xbefd, 0xea45, 0xbf44, 0xbf4a, 0x9cdc, 0xbf47, 0xe9fe, 0xbf46, 0xe9f9, 0x95cf, 0xe9ed, 0xe9f2, 0x8dee, 0xe9fd, 0xbf45, 0xbf42, 0xbefc, 0xbf40, 0xe9f1, 0xe5fd, 0xe9ec, 0xe9ef, 0xea41, 0xe9f4, 0xe9ea, 0xed4e, 0xea43, 0xe9ee, 0xe9fc, 0xfdd4, 0xed51, 0xc0e3, 0xc0d7, 0x96ec, 0x96eb, 0xc0db, 0xed53, 0xed59, 0xed57, 0xc0d9, 0xc0da, 0xc0e1, 0xed5a, 0xed52, 0xc0dc, 0xed56, 0xed55, 0xed5b, 0xc0e2, 0xc0dd, 0xc0e0, 0xed54, 0xc0e4, 0xc0de, 0xc0e5, 0xc0d8, 0xed58, 0xed50, 0x90b6, 0xeff7, 0xfdc3, 0xc271, 0xeff4, 0xeff6, 0xc26f, 0xeff2, 0xeff3, 0xefee, 0x98ab, 0xe9f6, 0xefef, 0xc270, 0xefeb, 0xc26d, 0xeff8, 0xc26e, 0xefec, 0xefed, 0xeff1, 0xc273, 0xc272, 0xeff0, 0xc378, 0xf25f, 0xf265, 0xc379, 0xf25c, 0xc376, 0xc373, 0xf267, 0xc377, 0x96ee, 0xc374, 0xf25e, 0xf261, 0xf262, 0xf263, 0xf266, 0xeff5, 0xf25d, 0xc375, 0xf264, 0xf268, 0xf260, 0x8df4, 0xf45d, 0xc46a, 0xf460, 0xc46b, 0xf468, 0xf45f, 0xf45c, 0xf45e, 0xf462, 0xf465, 0xf464, 0xf467, 0xf45b, 0xc469, 0xf463, 0xf466, 0xf469, 0xf461, 0xf5d3, 0xf5d4, 0xf5d8, 0xf5d9, 0xf5d6, 0xf5d7, 0xf5d5, 0xfde0, 0xc4e9, 0x8c67, 0x8df6, 0xc578, 0xf6eb, 0x8df7, 0xf6e8, 0xf6e9, 0xf6ea, 0xc579, 0xf7e5, 0xf7e4, 0x8ffa, 0xf8af, 0xc5f4, 0xf8ad, 0xf8b0, 0xf8ae, 0xf8f5, 0xc657, 0xc665, 0xf9a3, 0xf96c, 0x97d0, 0xf9a2, 0xf9d0, 0xf9d1, 0xa4f5, 0x8bd2, 0x8df8, 0xa6c7, 0xca41, 0xcb5e, 0x90d9, 0xa85f, 0x8c47, 0xa862, 0xfaf0, 0xcb5f, 0xa860, 0xa861, 0xfde1, 0x8df9, 0xfde3, 0xcd58, 0xcd5a, 0xcd55, 0xcd52, 0xcd54, 0x8dfa, 0xaaa4, 0xfb63, 0xaaa2, 0x90a6, 0xcd56, 0xaaa3, 0xcd53, 0xcd50, 0xaaa1, 0xcd57, 0xcd51, 0xaaa5, 0xcd59, 0xcfaf, 0x9970, 0xcfb3, 0x91eb, 0xacb7, 0x9770, 0x986f, 0xfde2, 0xcfb6, 0xacaf, 0xacb2, 0xacb4, 0xacb6, 0xacb3, 0xcfb2, 0xcfb1, 0xacb1, 0xcfb4, 0xcfb5, 0xcfae, 0xacb5, 0x98f2, 0xacb0, 0x9afc, 0x896c, 0xfdfd, 0xcfb0, 0x995e, 0x95bd, 0xd277, 0xd278, 0xd279, 0xaf50, 0xaf4c, 0xd26e, 0xfde4, 0xd276, 0xd27b, 0xaf51, 0x91e6, 0xd26c, 0xd272, 0xd26b, 0xd275, 0xfde5, 0xfde6, 0xd271, 0xaf4d, 0xaf4f, 0xd27a, 0xd26a, 0xd26d, 0xd273, 0xfde7, 0xd274, 0xd27c, 0xd270, 0xaf4e, 0xb26d, 0xd64e, 0x9454, 0xd650, 0xd64c, 0x99b8, 0xd658, 0xd64a, 0xd657, 0xb269, 0xd648, 0xda5b, 0xd652, 0xb26c, 0x97e9, 0xd653, 0xd656, 0xd65a, 0xd64f, 0x9346, 0xd654, 0xb26a, 0xb26b, 0xd659, 0xd64d, 0xd649, 0xd65b, 0xd651, 0xd655, 0xd64b, 0xb548, 0xb549, 0xda65, 0xb54f, 0x9863, 0xda59, 0xda62, 0xda58, 0xb54c, 0xda60, 0xda5e, 0xda5f, 0xb54a, 0xda63, 0x95bc, 0xfded, 0xfdf7, 0xda5c, 0xda5a, 0xb54b, 0xda5d, 0xda61, 0x9870, 0x96f6, 0x8ea9, 0xb54d, 0xda64, 0x9451, 0x8e43, 0x8b5a, 0xde70, 0xde77, 0xde79, 0xdea1, 0xfdee, 0xb7da, 0xde6b, 0xb7d2, 0xfdf0, 0xde7a, 0xb7d7, 0xdea2, 0xb7ce, 0xfdf4, 0xde7d, 0x9bf5, 0xde6d, 0xde7e, 0xde6c, 0xb7dc, 0xde78, 0xb7cf, 0xdea3, 0xb7d4, 0xde71, 0xb7d9, 0xde7c, 0xde6f, 0xde76, 0xde72, 0xde6e, 0xb7d1, 0xb7d8, 0xb7d6, 0xb7d3, 0xb7db, 0xb7d0, 0xde75, 0x977e, 0xb7d5, 0xb54e, 0xde7b, 0x9bd5, 0xde73, 0x9ac3, 0x97c8, 0xa0db, 0x91d0, 0xde74, 0x9fe4, 0xe2c1, 0x8fdd, 0xbab4, 0x91e9, 0xe2bd, 0xe2c3, 0xe2bf, 0xbab6, 0xe2be, 0xe2c2, 0xe2ba, 0x98e0, 0xe2bc, 0xbab5, 0x92ca, 0x9857, 0xe2c0, 0xe2bb, 0x8c51, 0xbab7, 0xbab2, 0xfdeb, 0xe2c4, 0x9b49, 0xbab3, 0xe667, 0xe664, 0xe670, 0xe66a, 0xe66c, 0xbcf4, 0xe666, 0xe66e, 0x9d76, 0x9eaf, 0xe66d, 0xe66b, 0xe671, 0xbcf7, 0xe668, 0xe66f, 0xbcf5, 0x9ccc, 0xe663, 0xe665, 0xbcf6, 0xe662, 0xe672, 0xfdea, 0xe669, 0x8df1, 0xea4a, 0xbf51, 0xfdfb, 0xea55, 0xea53, 0xbf4b, 0xea49, 0xea4c, 0xea4d, 0xea48, 0xbf55, 0xbf56, 0xea47, 0xea56, 0xea51, 0xbf4f, 0xbf4c, 0xea50, 0xea4e, 0xbf52, 0xea52, 0xbf4d, 0x8e53, 0xbf4e, 0xea4f, 0xbf50, 0xea4b, 0xea54, 0xbf53, 0xea57, 0xea58, 0xbf54, 0xfacf, 0xc0e7, 0xc0ee, 0xed5c, 0xed62, 0xed60, 0xc0ea, 0xc0e9, 0xc0e6, 0xed5e, 0x96f9, 0xc0ec, 0xc0eb, 0xc0e8, 0xed61, 0xed5d, 0xed5f, 0xc0ed, 0x98bf, 0x9e49, 0xc277, 0xeffb, 0xc274, 0xc275, 0xeffd, 0xc276, 0xeffa, 0x8ca7, 0xeff9, 0xf26c, 0xeffc, 0xf26d, 0xc37a, 0xf26b, 0x9bca, 0xf26a, 0xf269, 0xc37b, 0xfdfe, 0x92dc, 0xc46c, 0xf46a, 0xf46b, 0xfe41, 0x91cc, 0x91e2, 0xf5dc, 0xf5db, 0xc4ea, 0xf5da, 0xf6ec, 0xf6ed, 0xf7e6, 0xf8b1, 0xfe44, 0xf8f6, 0xf9bc, 0xc679, 0xf9c6, 0xa4f6, 0x8bd3, 0xaaa6, 0xaaa7, 0xfe47, 0xacb8, 0xc0ef, 0xa4f7, 0xaaa8, 0xaf52, 0xb7dd, 0xa4f8, 0xb26e, 0xbab8, 0xc962, 0xfe48, 0xcfb7, 0xd27d, 0xe2c5, 0xc0f0, 0xa4f9, 0xaaa9, 0xcfb8, 0xcfb9, 0xda66, 0xb550, 0xdea4, 0x9455, 0xb7de, 0xe2c6, 0xfe4b, 0xbcf8, 0xfe4c, 0xc37c, 0xa4fa, 0xda67, 0xa4fb, 0x8dbf, 0xa6c9, 0xca42, 0xa6c8, 0xa865, 0xa864, 0xa863, 0xcb60, 0x9e78, 0xaaaa, 0xaaab, 0xcd5b, 0xcfba, 0xcfbd, 0xacba, 0xcfbb, 0xacb9, 0xcfbc, 0xacbb, 0xd2a2, 0xd2a1, 0xd27e, 0xaf53, 0xd65d, 0xd65e, 0xb26f, 0xd65c, 0xd65f, 0xb552, 0xb270, 0xfe51, 0xb551, 0xda6b, 0xda6a, 0x9456, 0xda68, 0xda69, 0xda6c, 0xdea6, 0xdea5, 0xdea9, 0x9d61, 0xdea8, 0xdea7, 0xbab9, 0xe2c9, 0x9457, 0xe2c8, 0xbaba, 0xe2c7, 0xe673, 0xe674, 0xbcf9, 0xea59, 0xea5a, 0x9966, 0xf272, 0xc37d, 0xf271, 0xf270, 0xf26e, 0xf26f, 0xc4eb, 0xf46c, 0xf6ee, 0xf8f7, 0xa4fc, 0x8bd5, 0xc9a5, 0xa5c7, 0xc9a6, 0xa069, 0xca43, 0xca44, 0xcb66, 0xcb62, 0xcb61, 0xaaac, 0xcb65, 0xa867, 0xcb63, 0xa866, 0xcb67, 0xcb64, 0xcd5f, 0xcfbe, 0xcd5d, 0xcd64, 0x98b4, 0xaaad, 0xaab0, 0xcd65, 0xcd61, 0xcd62, 0xcd5c, 0xaaaf, 0xcd5e, 0xaaae, 0xcd63, 0xcd60, 0xcfc2, 0xacbd, 0xacbe, 0xa049, 0xcfc5, 0xcfbf, 0xcfc4, 0xcfc0, 0xacbc, 0xcfc3, 0xcfc1, 0xd2a8, 0xd2a5, 0xd2a7, 0xaf58, 0xaf57, 0xaf55, 0xd2a4, 0xd2a9, 0xaf54, 0xaf56, 0xd2a6, 0xd667, 0xd2a3, 0xd2aa, 0xa04c, 0x9e65, 0xd662, 0xd666, 0xd665, 0xda6e, 0xda79, 0xd668, 0x98b5, 0xd663, 0xda6d, 0xb274, 0xb273, 0xd661, 0xd664, 0xb275, 0xb272, 0xb271, 0xd660, 0xd669, 0xda70, 0xda77, 0xb554, 0xda76, 0xda73, 0xfe58, 0xb556, 0x9975, 0xfe53, 0xa065, 0xda75, 0xfe59, 0xda6f, 0xda71, 0xda74, 0xda72, 0xb555, 0xda78, 0xb553, 0xb7df, 0x98b7, 0x98b8, 0xdead, 0xdeac, 0xdeaa, 0xb7e2, 0xb7e1, 0xdeae, 0x98ba, 0xdeab, 0xe2ca, 0xbabb, 0xb7e0, 0x98bb, 0xdeb0, 0xdeaf, 0xe2cd, 0xe2cb, 0xbcfa, 0x9fbc, 0xbabc, 0xe2cc, 0xe676, 0xbcfb, 0xe675, 0xe67e, 0xe67d, 0xe67b, 0xe67a, 0xe677, 0xe678, 0xe679, 0xe67c, 0xe6a1, 0xea5f, 0xea5c, 0xea5d, 0xbf57, 0xea5b, 0xea61, 0xea60, 0xea5e, 0xed64, 0xed65, 0xc0f1, 0xa04a, 0xc0f2, 0xed63, 0x9ec7, 0xc279, 0xeffe, 0xc278, 0xc37e, 0xc3a1, 0xc46d, 0xf46e, 0xf46d, 0xf5dd, 0xf6ef, 0xc57a, 0xf7e8, 0xf7e7, 0xf7e9, 0xa5c8, 0xcfc6, 0xaf59, 0xb276, 0xd66a, 0xa5c9, 0xc9a7, 0xa4fd, 0x8ca9, 0xca45, 0x98ae, 0xcb6c, 0xcb6a, 0xcb6b, 0xcb68, 0xa868, 0xcb69, 0x92d6, 0xfae1, 0xcd6d, 0x91d4, 0xaab3, 0xcd6b, 0xcd67, 0xcd6a, 0xcd66, 0xaab5, 0xcd69, 0xfade, 0xaab2, 0xaab1, 0xfe5b, 0xaab4, 0xcd6c, 0xcd68, 0xacc2, 0xacc5, 0xcfce, 0xcfcd, 0xcfcc, 0xacbf, 0xcfd5, 0xcfcb, 0x8c53, 0xacc1, 0xd2af, 0xcfd2, 0xcfd0, 0xacc4, 0xcfc8, 0xcfd3, 0xcfca, 0xcfd4, 0xcfd1, 0xcfc9, 0xfe5e, 0xacc0, 0xcfd6, 0xcfc7, 0xacc3, 0xfbd7, 0xfe5a, 0x94c5, 0xd2b4, 0xd2ab, 0xd2b6, 0xfaca, 0xd2ae, 0xd2b9, 0xd2ba, 0xd2ac, 0xd2b8, 0xd2b5, 0xd2b3, 0xd2b7, 0xaf5f, 0xaf5d, 0x98c1, 0x975c, 0xd2b1, 0xfe74, 0xd2ad, 0x9773, 0xd2b0, 0xd2bb, 0xd2b2, 0xaf5e, 0xcfcf, 0xaf5a, 0xaf5c, 0xfa46, 0x9764, 0xd678, 0xd66d, 0xd66b, 0xfe68, 0xd66c, 0x964e, 0xd673, 0x9765, 0xd674, 0xd670, 0xb27b, 0xd675, 0xd672, 0xd66f, 0x8c5a, 0xb279, 0xd66e, 0xb277, 0xb27a, 0xd671, 0xd679, 0xaf5b, 0xb278, 0xd677, 0xd676, 0xb27c, 0x89a1, 0x95fa, 0x92d4, 0xfe69, 0xda7e, 0xfb45, 0x98c8, 0xdaa1, 0xb560, 0x90ef, 0xdaa7, 0x98c9, 0x98ca, 0xdaa9, 0xdaa2, 0xb55a, 0xdaa6, 0xdaa5, 0xb55b, 0xb561, 0xb562, 0xdaa8, 0xb558, 0xda7d, 0xda7b, 0xdaa3, 0xda7a, 0xb55f, 0xda7c, 0xdaa4, 0xdaaa, 0xb559, 0xb55e, 0xb55c, 0xb55d, 0x946d, 0x94b7, 0xfe6c, 0xb557, 0x946b, 0xb7e9, 0xdeb7, 0xb7e8, 0xdebb, 0x92fc, 0xdeb1, 0x95eb, 0xdebc, 0xfe73, 0x976e, 0xfe5f, 0xdeb2, 0xdeb3, 0xdebd, 0xdeba, 0xdeb8, 0xdeb9, 0xdeb5, 0xdeb4, 0xfdbd, 0xdebe, 0xb7e5, 0x92d5, 0xdeb6, 0xb7ea, 0xb7e4, 0xb7eb, 0xb7ec, 0xfeb9, 0xb7e7, 0xb7e6, 0xfe71, 0xe2ce, 0xbabe, 0xbabd, 0xfbbb, 0xe2d3, 0x947a, 0xbcfc, 0xbabf, 0x95fb, 0xfe77, 0xbac1, 0xe2d4, 0xb7e3, 0xbac0, 0xe2d0, 0xe2d2, 0xe2cf, 0xfe79, 0xe2d1, 0xfe75, 0xe6ab, 0x945d, 0xe6aa, 0xe6a7, 0xbd40, 0xea62, 0xbd41, 0xe6a6, 0xfe7c, 0xbcfe, 0xe6a8, 0xe6a5, 0xe6a2, 0xe6a9, 0xe6a3, 0xe6a4, 0xbcfd, 0x9344, 0x8ea6, 0xed69, 0xea66, 0xea65, 0xea67, 0xed66, 0xbf5a, 0x92d3, 0xea63, 0x94b8, 0xbf58, 0xbf5c, 0xbf5b, 0xea64, 0xea68, 0xbf59, 0xfc71, 0xed6d, 0xc0f5, 0xc27a, 0xc0f6, 0xc0f3, 0xed6a, 0xed68, 0xed6b, 0xed6e, 0xc0f4, 0xed6c, 0xed67, 0x975e, 0xf042, 0xf045, 0xf275, 0xf040, 0x8cad, 0xf46f, 0xf046, 0xc3a2, 0xf044, 0xc27b, 0xf041, 0xf043, 0xf047, 0xf276, 0xf274, 0xfea7, 0xc3a3, 0xf273, 0x946a, 0xc46e, 0x93e3, 0x98cf, 0xc4ed, 0xf6f1, 0xc4ec, 0xf6f3, 0xf6f0, 0xf6f2, 0xc5d0, 0xf8b2, 0xa5ca, 0xcd6e, 0xd2bc, 0xd2bd, 0xb27d, 0xdebf, 0xbf5d, 0xc3a4, 0xc57b, 0xf8b3, 0xa5cb, 0xa0d9, 0xcd6f, 0xa260, 0xcfd7, 0xcfd8, 0xa0bf, 0xa04d, 0xa0b8, 0xd2be, 0xd2bf, 0xb27e, 0xb2a1, 0xa0ce, 0xdaab, 0xdec2, 0xdec1, 0xdec0, 0xe2d5, 0xe2d6, 0xe2d7, 0xbac2, 0xa0b7, 0xe6ad, 0xe6ac, 0xea69, 0xbf5e, 0xbf5f, 0xfea9, 0xed72, 0xed6f, 0xed70, 0xed71, 0xf049, 0xf048, 0xc27c, 0xf277, 0xf5de, 0xa5cc, 0x89c3, 0xacc6, 0xb2a2, 0xdec3, 0xfeab, 0xa5cd, 0xd2c0, 0xb2a3, 0xb563, 0xb564, 0xa5ce, 0xa5cf, 0xca46, 0xa86a, 0xa869, 0xacc7, 0xcfd9, 0xdaac, 0xa5d0, 0xa5d1, 0xa5d2, 0xa5d3, 0x9df4, 0x896d, 0xa86b, 0xa86c, 0xcb6e, 0xcb6d, 0x9c7b, 0xaab6, 0xcd72, 0xcd70, 0xcd71, 0x98d2, 0x9fa9, 0xcfda, 0xcfdb, 0xfeb2, 0xaccb, 0xacc9, 0xfeb1, 0xacca, 0xacc8, 0x97d9, 0xa0c4, 0xaf60, 0x9476, 0xaf64, 0xaf63, 0xd2c1, 0xaf62, 0xaf61, 0xd2c2, 0x9978, 0xb2a6, 0xd67b, 0xd67a, 0xb2a4, 0xb2a5, 0xfeb3, 0xb566, 0xb565, 0xdaae, 0x98d3, 0xfeb4, 0xdaad, 0xb2a7, 0x98d4, 0xb7ed, 0xdec5, 0xb7ee, 0xdec4, 0x9fb9, 0xe2d8, 0xe6ae, 0xbd42, 0xea6a, 0x9471, 0xed73, 0xc3a6, 0xc3a5, 0xc57c, 0xa5d4, 0xcd73, 0x98d5, 0xfeb8, 0xb2a8, 0xe2d9, 0xbac3, 0xc6d4, 0xcb6f, 0xcb70, 0xcd74, 0xaab8, 0xaab9, 0xaab7, 0xfeba, 0xaccf, 0xacd0, 0xaccd, 0xacce, 0xcfdc, 0xcfdd, 0xaccc, 0xd2c3, 0x9e5c, 0xaf68, 0xaf69, 0xfebb, 0xb2ab, 0xd2c9, 0xaf6e, 0xaf6c, 0xd2ca, 0xd2c5, 0xaf6b, 0xaf6a, 0xaf65, 0xd2c8, 0xd2c7, 0xd2c4, 0xaf6d, 0xa044, 0xd2c6, 0xaf66, 0xaf67, 0x98d7, 0xb2ac, 0xd6a1, 0xd6a2, 0xb2ad, 0xd67c, 0xd67e, 0xd6a4, 0xd6a3, 0xd67d, 0xb2a9, 0xb2aa, 0xdab6, 0xb56b, 0xb56a, 0xdab0, 0xb568, 0x98d8, 0xdab3, 0xb56c, 0xdab4, 0xb56d, 0xdab1, 0xb567, 0xb569, 0xdab5, 0xdab2, 0xdaaf, 0xded2, 0xdec7, 0xb7f0, 0xb7f3, 0xb7f2, 0xb7f7, 0xb7f6, 0xded3, 0xded1, 0xdeca, 0xdece, 0xdecd, 0xb7f4, 0xded0, 0xdecc, 0xded4, 0xdecb, 0xb7f5, 0xb7ef, 0xb7f1, 0xfebc, 0xdec9, 0x9ffe, 0xe2db, 0xbac7, 0xe2df, 0xbac6, 0xe2dc, 0xbac5, 0xdec8, 0xdecf, 0xe2de, 0xbac8, 0xe2e0, 0xe2dd, 0xe2da, 0xe6b1, 0xe6b5, 0xe6b7, 0xe6b3, 0xe6b2, 0xe6b0, 0xbd45, 0xbd43, 0xbd48, 0xbd49, 0xe6b4, 0xbd46, 0xe6af, 0xbd47, 0xbac4, 0xe6b6, 0xbd44, 0xfebd, 0xea6c, 0xea6b, 0xea73, 0xea6d, 0xea72, 0xea6f, 0xbf60, 0xea71, 0xbf61, 0xbf62, 0x9ddd, 0xea70, 0xea6e, 0x9ee1, 0xc0f8, 0xed74, 0xc0f7, 0xed77, 0xed75, 0xed76, 0xc0f9, 0x98da, 0x9ddf, 0xfebf, 0xf04d, 0xfebe, 0xc2a1, 0xf04e, 0x9eeb, 0xc27d, 0xf04f, 0xc27e, 0xf04c, 0xf050, 0xf04a, 0xc3a7, 0xf278, 0xc3a8, 0xc46f, 0xf04b, 0xc470, 0x9e59, 0xa05c, 0xc4ee, 0xf5df, 0xc57e, 0xf6f4, 0xc57d, 0xfec0, 0xf7ea, 0xc5f5, 0xc5f6, 0x9477, 0x98dc, 0xf9cc, 0xfec1, 0xacd1, 0xcfde, 0x98de, 0xb56e, 0xb56f, 0xa5d5, 0xa6ca, 0xca47, 0xcb71, 0xa86d, 0xaaba, 0xacd2, 0xacd3, 0xacd4, 0xd6a6, 0xd2cb, 0xaf6f, 0xb2ae, 0xd6a5, 0xfec3, 0xdab8, 0xb571, 0xdab7, 0xb570, 0xded5, 0xbd4a, 0xe6bb, 0xe6b8, 0xe6b9, 0xe6ba, 0xfec8, 0xed78, 0xfec9, 0xf051, 0xf471, 0xf470, 0xf6f5, 0xa5d6, 0xcd75, 0xaf70, 0xb572, 0xded6, 0xfeca, 0xe2e1, 0xbd4b, 0xea74, 0xf052, 0xf472, 0xa5d7, 0xaabb, 0xacd7, 0xcfdf, 0xacd8, 0xacd6, 0xacd5, 0xd2cc, 0xaf71, 0xfecb, 0xaf72, 0xaf73, 0xb2b0, 0xd6a7, 0xb2af, 0x9fc2, 0x8c6b, 0xdab9, 0xb2b1, 0xb573, 0xded7, 0xb7f8, 0xb7f9, 0xbac9, 0xbaca, 0xbd4c, 0xbf64, 0xea75, 0xbf63, 0xed79, 0xc0fa, 0xf053, 0xf473, 0xa5d8, 0xa86e, 0xcd78, 0xcd77, 0xaabc, 0xcd76, 0xaabd, 0xcd79, 0xcfe5, 0xacdb, 0xacda, 0xcfe7, 0xcfe6, 0xacdf, 0xacde, 0xacd9, 0xcfe1, 0xcfe2, 0xcfe3, 0xace0, 0xcfe0, 0xacdc, 0xcfe4, 0xacdd, 0x98c4, 0x94b0, 0x94b1, 0xd2cf, 0xd2d3, 0xd2d1, 0xd2d0, 0xd2d4, 0xd2d5, 0xd2d6, 0xd2ce, 0xd2cd, 0xfed1, 0xaf75, 0xaf76, 0xd2d7, 0xd2d2, 0xa0c1, 0xd6b0, 0xfed2, 0xd2d8, 0xaf77, 0xaf74, 0xa0cd, 0xd6aa, 0xd6a9, 0xd6ab, 0xd6ac, 0xd6ae, 0xd6ad, 0xd6b2, 0xb2b5, 0xb2b2, 0xb2b6, 0xd6a8, 0xb2b7, 0xd6b1, 0xb2b4, 0xd6af, 0xb2b3, 0xfed3, 0x98e5, 0xdabc, 0xdabe, 0xdaba, 0xdabb, 0xdabf, 0xdac1, 0xdac2, 0xdabd, 0xdac0, 0xb574, 0xdedb, 0xdee0, 0xded8, 0xdedc, 0xfed6, 0xdee1, 0xdedd, 0xb7fa, 0xb843, 0xb7fd, 0xded9, 0xdeda, 0xbace, 0xb846, 0xb7fe, 0xb844, 0xb7fc, 0xdedf, 0xb845, 0xdede, 0xb841, 0xb7fb, 0xb842, 0xdee2, 0xe2e6, 0xe2e8, 0x91e4, 0x8fc7, 0x94ae, 0xb840, 0x8a4f, 0x94b2, 0xe2e3, 0xbacc, 0xe2e9, 0xbacd, 0xe2e7, 0xe2e2, 0xe2e5, 0xe2ea, 0xbacb, 0xe2e4, 0xbd4e, 0xe6bf, 0xe6be, 0xbd51, 0xbd4f, 0xe6bc, 0xbd4d, 0xe6bd, 0xbd50, 0x8fd4, 0xea7d, 0xeaa1, 0x98ea, 0xea7e, 0xea76, 0xea7a, 0xea79, 0xea77, 0xbf66, 0xbf67, 0xbf65, 0xea78, 0xea7b, 0xea7c, 0xbf68, 0xc140, 0xeda3, 0xc0fc, 0xed7b, 0xc0fe, 0xc141, 0xfed8, 0xc0fd, 0xeda2, 0xed7c, 0xc0fb, 0xeda1, 0xed7a, 0xed7e, 0xed7d, 0x9de0, 0xf055, 0xc2a4, 0xc2a5, 0xc2a2, 0x98ee, 0xc2a3, 0xf054, 0x95c4, 0xf27b, 0xfce8, 0xc3a9, 0xf279, 0xf27a, 0x98ef, 0xf474, 0xf477, 0xf475, 0xf476, 0xf5e0, 0xc4ef, 0xf7eb, 0xf8b4, 0xc5f7, 0xf8f8, 0xf8f9, 0xc666, 0xa5d9, 0xace1, 0x8c6e, 0xdac3, 0xdee3, 0xa5da, 0xa86f, 0xaabe, 0xfad8, 0xcfe8, 0xcfe9, 0xaf78, 0xdac4, 0xb575, 0xb847, 0xc142, 0xeda4, 0xf27c, 0xf478, 0xa5db, 0xfedc, 0xcda1, 0xcd7a, 0xcd7c, 0xcd7e, 0xcd7d, 0xcd7b, 0xaabf, 0xa0ae, 0xace2, 0xcff2, 0xcfed, 0xcfea, 0x9d4c, 0xcff1, 0xace4, 0xace5, 0xcff0, 0xcfef, 0xcfee, 0xcfeb, 0xcfec, 0xcff3, 0xace3, 0x98f1, 0x98f3, 0xaf7c, 0x94c1, 0xafa4, 0xafa3, 0xd2e1, 0xd2db, 0xd2d9, 0xafa1, 0xd6b9, 0xaf7a, 0xd2de, 0xd2e2, 0xd2e4, 0xd2e0, 0xd2da, 0xafa2, 0xd2df, 0xd2dd, 0xaf79, 0xd2e5, 0xafa5, 0xd2e3, 0xaf7d, 0xd2dc, 0xaf7e, 0xaf7b, 0x98f5, 0xfa4f, 0x96e2, 0x9450, 0xb2b9, 0x96a2, 0xd6ba, 0x98f6, 0xd6b3, 0xd6b5, 0xd6b7, 0x96e5, 0xd6b8, 0xd6b6, 0xb2ba, 0xd6bb, 0x98f7, 0xd6b4, 0xa046, 0x96e3, 0xdac8, 0xb576, 0xdad0, 0xdac5, 0xdad1, 0xdac6, 0xdac7, 0x98f8, 0xdacf, 0xdace, 0xdacb, 0xb2b8, 0xb577, 0xdac9, 0xdacc, 0xb578, 0xdacd, 0xdaca, 0xdeee, 0x9ee4, 0xdef2, 0xb84e, 0xe2f0, 0xb851, 0xdef0, 0xf9d6, 0xdeed, 0xdee8, 0xdeea, 0xdeeb, 0xdee4, 0x94c3, 0xb84d, 0xb84c, 0x94c2, 0xb848, 0xdee7, 0xb84f, 0xb850, 0xdee6, 0xdee9, 0xdef1, 0xb84a, 0xb84b, 0xdeef, 0xdee5, 0xe2f2, 0xbad0, 0xe2f4, 0xdeec, 0xe2f6, 0xbad4, 0xe2f7, 0xe2f3, 0xbad1, 0xe2ef, 0xbad3, 0xe2ec, 0xe2f1, 0xe2f5, 0xe2ee, 0xfee1, 0xb849, 0xfee9, 0xe2eb, 0xbad2, 0xe2ed, 0x96e4, 0x89ac, 0x96db, 0xbd54, 0xe6c1, 0xbd58, 0xbd56, 0xbacf, 0xe6c8, 0xe6c9, 0xbd53, 0xfee2, 0xe6c7, 0xe6ca, 0xbd55, 0xbd52, 0xe6c3, 0xe6c0, 0xe6c5, 0xe6c2, 0xbd59, 0xe6c4, 0x94c4, 0xfee3, 0xe6c6, 0xbd57, 0xfee7, 0x9ffb, 0xbf6a, 0xeaa8, 0xeaa2, 0xeaa6, 0xeaac, 0xeaad, 0xeaa9, 0xeaaa, 0xeaa7, 0x8c59, 0xeaa4, 0xbf6c, 0xbf69, 0xeaa3, 0xeaa5, 0xbf6b, 0xeaab, 0x93c9, 0xc146, 0x94e8, 0xfb56, 0xedaa, 0xeda5, 0xc145, 0x90c5, 0xc143, 0xedac, 0xc144, 0xeda8, 0xeda9, 0xeda6, 0xedad, 0xf056, 0xc147, 0xeda7, 0xedae, 0xedab, 0xa0a8, 0xf05a, 0xf057, 0xc2a6, 0xf05b, 0xf05d, 0xf05c, 0xf058, 0xf059, 0xf2a3, 0xc3aa, 0xf27e, 0xf2a2, 0xf27d, 0xf2a4, 0xf2a1, 0xf47a, 0xf47d, 0xf479, 0xc471, 0xf47b, 0xf47c, 0xf47e, 0xc472, 0xc474, 0xc473, 0xf5e1, 0xfee5, 0xf5e3, 0xf5e2, 0x98fd, 0x98fb, 0xfee8, 0xf6f6, 0x8ebf, 0xf8b5, 0xf8fa, 0xa5dc, 0x8bd8, 0xfef7, 0xcb72, 0xaac0, 0xcda3, 0xaac1, 0xaac2, 0xcda2, 0xcff8, 0xcff7, 0xace6, 0xace9, 0xace8, 0xace7, 0xcff4, 0xcff6, 0xcff5, 0xd2e8, 0xafa7, 0xd2ec, 0xd2eb, 0xd2ea, 0xd2e6, 0xafa6, 0xafaa, 0xafad, 0x8f68, 0x94c6, 0xafae, 0xd2e7, 0xd2e9, 0xafac, 0xafab, 0xafa9, 0xafa8, 0xd6c2, 0x9dea, 0xd6c0, 0xd6bc, 0xb2bb, 0xd6bd, 0xb2bc, 0xd6be, 0xd6bf, 0xd6c1, 0xb2bd, 0xdad5, 0xfc69, 0xdad4, 0xdad3, 0xdad2, 0xdef6, 0xb852, 0xdef3, 0xdef5, 0x9cda, 0xb853, 0xfef3, 0xb854, 0xdef4, 0x9c72, 0xfef0, 0x89c9, 0xe341, 0xe2f9, 0xe2fa, 0xbad7, 0xbad5, 0xbad6, 0xe343, 0x9941, 0xe342, 0xe2fe, 0xe2fd, 0xe2fc, 0xe2fb, 0xe340, 0xe2f8, 0x9942, 0xe6cb, 0xe6d0, 0xe6ce, 0xfef5, 0x91d7, 0xe6cd, 0xe6cc, 0xe6cf, 0xeaae, 0x94cc, 0xbf6d, 0xc148, 0xedb0, 0xfef8, 0xc149, 0xedaf, 0xf05f, 0xf05e, 0xc2a7, 0xf2a5, 0xc3ab, 0xf4a1, 0xc5a1, 0xf6f7, 0xf8b7, 0xf8b6, 0xc9a8, 0xacea, 0xaceb, 0xd6c3, 0xb856, 0xa5dd, 0xa872, 0xa871, 0xa870, 0x97a8, 0xcda4, 0xfefc, 0xaac4, 0xaac3, 0xacee, 0xfdbf, 0xcffa, 0xcffd, 0xcffb, 0xacec, 0xaced, 0xfefe, 0xcff9, 0xcffc, 0xafb5, 0xd2f3, 0xd2f5, 0xd2f4, 0xafb2, 0xd2ef, 0x96d1, 0xafb0, 0xafaf, 0xafb3, 0xafb1, 0xafb4, 0xd2f2, 0xd2ed, 0xd2ee, 0xd2f1, 0xd2f0, 0x94d5, 0x94d0, 0xd6c6, 0xd6c7, 0xd6c5, 0xd6c4, 0xb2be, 0xb57d, 0xdad6, 0xdad8, 0xdada, 0xb57c, 0x9944, 0xb57a, 0xdad7, 0xb57b, 0xdad9, 0xb579, 0xdf41, 0xdef7, 0xdefa, 0xdefe, 0xb85a, 0xdefc, 0xdefb, 0xdef8, 0xdef9, 0xb858, 0xdf40, 0xb857, 0xb85c, 0xb85b, 0xb859, 0xdefd, 0xe349, 0xe348, 0x8c63, 0xe344, 0xa0b3, 0xbad8, 0xe347, 0xe346, 0xbad9, 0xbd5e, 0xe6d2, 0x94cf, 0xbd5f, 0xbd5b, 0xbd5d, 0x9ffa, 0xbd5a, 0xbd5c, 0x91e5, 0xeaaf, 0x9c6a, 0xbf70, 0xeab1, 0xeab0, 0x8e49, 0xe345, 0xbf72, 0xbf71, 0xbf6e, 0xbf6f, 0xedb5, 0xedb3, 0xc14a, 0xedb4, 0xedb6, 0xedb2, 0xedb1, 0xf060, 0xc2aa, 0xc2a8, 0xc2a9, 0x8e4c, 0xf2a6, 0xf2a7, 0xc3ad, 0xc3ac, 0xf4a3, 0xf4a4, 0xf4a2, 0xf6f8, 0xf6f9, 0xa5de, 0xca48, 0xa873, 0xcda5, 0xaac6, 0xaac5, 0xcda6, 0x8e4d, 0xd040, 0xacef, 0xcffe, 0xacf0, 0x9a73, 0xafb6, 0xd2f8, 0xd2f6, 0xd2fc, 0xafb7, 0xd2f7, 0xd2fb, 0xd2f9, 0xd2fa, 0xd6c8, 0xd6ca, 0x9947, 0xb2bf, 0x8cb1, 0xd6c9, 0xb2c0, 0xb5a2, 0xb5a1, 0xb57e, 0xdadb, 0xdf44, 0xb85d, 0xb85e, 0xdf43, 0xdf42, 0xe34a, 0xbadb, 0xbada, 0xe34b, 0xe34c, 0xbd61, 0xbd60, 0x8e50, 0xeab5, 0xe6d3, 0xe6d5, 0xe6d4, 0xeab4, 0xeab2, 0xeab6, 0xeab3, 0xbf73, 0x8e4f, 0x9949, 0xedb7, 0xc14b, 0xedb8, 0xedb9, 0x8e51, 0x8e52, 0xc2ab, 0xc2ac, 0xc475, 0x9ab2, 0x89a5, 0xc5d1, 0xa5df, 0x994c, 0xd041, 0x9ff8, 0xd2fd, 0xafb8, 0x8e56, 0x994d, 0x91ca, 0x8e57, 0xb3ba, 0xb3b9, 0x94e1, 0xb5a4, 0xdadd, 0xb5a3, 0xdadc, 0x9047, 0x8fd8, 0x8e58, 0xdf45, 0xbadc, 0xe34d, 0xbadd, 0xc476, 0xf4a5, 0xa6cb, 0xaac7, 0xcda7, 0xacf2, 0x94eb, 0xacf1, 0xd042, 0xd043, 0xd340, 0xd342, 0xafb9, 0xd344, 0xd347, 0xd345, 0x8e5c, 0x9553, 0xd346, 0xd343, 0xd2fe, 0xafba, 0xd348, 0xd341, 0x9fe5, 0xd6d3, 0xb2c6, 0xd6dc, 0xb2c3, 0xd6d5, 0xb2c7, 0x9f56, 0xb2c1, 0xd6d0, 0xd6dd, 0xd6d1, 0xd6ce, 0xb2c5, 0x954f, 0xb2c2, 0x8e5e, 0xd6d4, 0xd6d7, 0xb2c4, 0xd6d8, 0xb2c8, 0xd6d9, 0xd6cf, 0xd6d6, 0xd6da, 0xd6d2, 0xd6cd, 0xd6cb, 0xd6db, 0x996a, 0xdadf, 0xdae4, 0x9c64, 0x9cd9, 0xdae0, 0xdae6, 0xb5a7, 0xd6cc, 0xdae1, 0xb5a5, 0xdade, 0xb5ac, 0xdae2, 0xb5ab, 0xdae3, 0xb5ad, 0xb5a8, 0xb5ae, 0xb5a9, 0xb5aa, 0x8e5d, 0xb5a6, 0xdae5, 0xb861, 0xdf50, 0x9950, 0xdf53, 0xdf47, 0xdf4c, 0xdf46, 0xb863, 0xdf4a, 0x9951, 0xdf48, 0xb862, 0x8e62, 0xdf4f, 0xdf4e, 0xdf4b, 0xdf4d, 0xdf49, 0xbae1, 0xdf52, 0xb85f, 0xdf51, 0x9952, 0xe35d, 0xbae8, 0xe358, 0xbae7, 0xe34e, 0xe350, 0xbae0, 0xe355, 0xe354, 0xe357, 0xbae5, 0xe352, 0xe351, 0x8e68, 0xbae4, 0xbadf, 0xe353, 0xbae2, 0xe359, 0xe35b, 0xe356, 0xe34f, 0xbae3, 0xbd69, 0xbade, 0x8e61, 0x9f59, 0xe35c, 0xe6d9, 0xbd62, 0xe6db, 0xbd63, 0x8bb3, 0xbd65, 0xe6de, 0xe6d6, 0xbae6, 0xe6dc, 0xe6d8, 0xb860, 0xbd68, 0xbd64, 0xbd66, 0xbd67, 0xbf76, 0xe6dd, 0xe6d7, 0xbd6a, 0xe6da, 0x9f5d, 0x8e66, 0xeac0, 0xeabb, 0xeac5, 0xbf74, 0xeabd, 0xbf78, 0xeac3, 0xeaba, 0xeab7, 0xeac6, 0xc151, 0xbf79, 0xeac2, 0xeab8, 0xbf77, 0xeabc, 0xbf7b, 0xeab9, 0xeabe, 0xbf7a, 0xeac1, 0xeac4, 0x8cb2, 0xedcb, 0xedcc, 0xedbc, 0xedc3, 0xedc1, 0xc14f, 0xedc8, 0xeabf, 0x8e6e, 0xedbf, 0x9f64, 0xedc9, 0xc14e, 0xedbe, 0xedbd, 0xedc7, 0xedc4, 0xedc6, 0xedba, 0xedca, 0xc14c, 0xedc5, 0xedce, 0xedc2, 0xc150, 0xc14d, 0xedc0, 0xedbb, 0xedcd, 0xbf75, 0x9953, 0xfab8, 0xf063, 0x9954, 0xf061, 0xf067, 0xc2b0, 0xf065, 0xf064, 0xc2b2, 0xf06a, 0xc2b1, 0xf06b, 0xf068, 0xc2ae, 0xf069, 0xf062, 0xc2af, 0xc2ad, 0xf2ab, 0xf066, 0xf06c, 0xf2a8, 0x8e70, 0xc3b2, 0xc3b0, 0xf2aa, 0xf2ac, 0xf2a9, 0xc3b1, 0xc3ae, 0xc3af, 0xc3b3, 0x9f61, 0xc478, 0x8e72, 0xf4aa, 0xf4a9, 0xf4a7, 0xf4a6, 0xf4a8, 0xc477, 0xc479, 0xc4f0, 0xa06b, 0xf5e5, 0xf5e4, 0x9f40, 0xf6fa, 0xf6fc, 0xf6fe, 0xf6fd, 0xf6fb, 0x94ed, 0xc5a3, 0xc5a2, 0xc5d3, 0xc5d2, 0xc5d4, 0xf7ed, 0xf7ec, 0xf8fb, 0xf8b8, 0xf8fc, 0xc658, 0x94ee, 0xc659, 0xf96d, 0x9fbd, 0xc67e, 0xa6cc, 0x8e7b, 0xcda8, 0xd045, 0xd046, 0xd044, 0x9957, 0x94f7, 0xacf3, 0x9f5f, 0xd047, 0xd048, 0xd049, 0x8e73, 0xd349, 0xd34f, 0x9f62, 0xd34d, 0xafbb, 0xd34b, 0xd34c, 0xd34e, 0x94f6, 0xd34a, 0xb2c9, 0xd6de, 0xb2cb, 0xd6e0, 0xb2ca, 0xd6df, 0x9958, 0xdae8, 0xb5af, 0xdaea, 0xdae7, 0xd6e1, 0xb5b0, 0x8e75, 0xf9db, 0xdae9, 0x9072, 0x94f8, 0xdf56, 0xb864, 0xdf54, 0xb865, 0xdf55, 0xb866, 0x995a, 0xbae9, 0xe361, 0xe35e, 0xe360, 0xbaea, 0xbaeb, 0xe35f, 0xa0b0, 0x8cb3, 0xe6df, 0x8e79, 0xe6e0, 0x8e78, 0xbd6b, 0xe6e2, 0xe6e1, 0x94f3, 0xa261, 0xeaca, 0xeacb, 0xeac7, 0x98af, 0xeac8, 0xbf7c, 0xbf7d, 0xeac9, 0xc157, 0xa0b2, 0xc153, 0xc158, 0xc154, 0xc156, 0xc152, 0xc155, 0x8e7a, 0xc2b3, 0xedcf, 0xf2ae, 0xf2ad, 0x995c, 0xf4ab, 0xc47a, 0xc47b, 0xf741, 0xf5e6, 0x8e7c, 0xf740, 0x8e7d, 0xf8fd, 0xf9a4, 0xa6cd, 0x8bd9, 0xa874, 0x89a2, 0xcda9, 0xaac8, 0xacf6, 0xd04c, 0xacf4, 0xd04a, 0xacf9, 0xacf5, 0xacfa, 0xacf8, 0xd04b, 0xacf7, 0xafbf, 0xafbe, 0xd35a, 0xafc7, 0xd353, 0xd359, 0xafc3, 0xd352, 0xd358, 0xd356, 0xafc2, 0xafc4, 0xd355, 0xafbd, 0xd354, 0xafc8, 0xafc5, 0xafc9, 0xafc6, 0xd351, 0xd350, 0xd357, 0xafc0, 0xafbc, 0xafc1, 0x9ed7, 0xd6f0, 0xd6e9, 0xb5b5, 0xd6e8, 0xb2cf, 0xb2d6, 0xb2d3, 0xb2d9, 0xb2d8, 0xb2d4, 0xd6e2, 0xd6e5, 0xd6e4, 0xb2d0, 0xd6e6, 0xd6ef, 0xb2d1, 0xd6e3, 0xd6ec, 0xd6ed, 0xb2d2, 0xd6ea, 0xb2d7, 0xb2cd, 0xb2d5, 0xd6e7, 0xb2cc, 0xd6eb, 0xd6ee, 0xa0b6, 0xdafb, 0xdaf2, 0xb5b2, 0xdaf9, 0xdaf6, 0xdaee, 0xdaf7, 0xb5b4, 0xdaef, 0xdaeb, 0x9e42, 0xb86c, 0xdaf4, 0x8ea4, 0xb5b1, 0xdafa, 0xb5b8, 0xb5ba, 0xdaed, 0xb5b9, 0xdaf0, 0xb5b3, 0xdaf8, 0xdaf1, 0xdaf5, 0xdaf3, 0xb5b6, 0xdaec, 0xb5bb, 0xb2ce, 0xb5b7, 0xb5bc, 0xb868, 0xdf5d, 0xdf5f, 0xdf61, 0xdf65, 0xdf5b, 0xdf59, 0xb86a, 0xdf60, 0xdf64, 0xdf5c, 0xdf58, 0xdf57, 0x8ea7, 0x8c76, 0xdf62, 0xdf5a, 0xdf5e, 0xb86b, 0xb869, 0xdf66, 0xb867, 0xdf63, 0xe372, 0x9542, 0xbaee, 0xe36a, 0xbd78, 0xe374, 0xbaf1, 0xe378, 0xbaf7, 0xe365, 0x987d, 0xe375, 0xe362, 0x9755, 0xe377, 0xe366, 0x8ea8, 0xbafe, 0xbafb, 0xe376, 0xe370, 0xbaed, 0xbaf5, 0xbaf4, 0x8eaa, 0xbaf3, 0xbaf9, 0xe363, 0xbafa, 0xe371, 0xbaf6, 0xbaec, 0xe373, 0xbaef, 0xbaf0, 0xbaf8, 0xe368, 0xe367, 0xe364, 0xe36c, 0xe369, 0xe36d, 0xbafd, 0xe379, 0xbaf2, 0xe36e, 0xe36f, 0x89a3, 0xe36b, 0x9960, 0x9962, 0xbafc, 0x94fc, 0x9961, 0xe6e7, 0xbd70, 0xbd79, 0xbd75, 0xe6e4, 0x94fa, 0xbd72, 0xbd76, 0xe6f0, 0xbd6c, 0xe6e8, 0xbd74, 0x8eae, 0x8eb2, 0xe6eb, 0xe6e6, 0xbd73, 0xbd77, 0xe6e5, 0xbd71, 0xe6ef, 0xbd6e, 0xe6ee, 0xe6ed, 0xbd7a, 0xe572, 0xbd6d, 0x8eb0, 0xe6ec, 0xe6e3, 0xbd7b, 0xe6ea, 0xbd6f, 0x9963, 0x97aa, 0xe6e9, 0x94fb, 0xbfa2, 0xbfa7, 0xbf7e, 0xead8, 0xeacf, 0xeadb, 0xead3, 0xead9, 0xbfa8, 0xbfa1, 0xeacc, 0xead2, 0xeadc, 0xead5, 0xeada, 0xeace, 0xead6, 0xbfa3, 0xead4, 0xbfa6, 0xbfa5, 0xead0, 0xead1, 0xeacd, 0xead7, 0xbfa4, 0xeade, 0xeadd, 0x8ebb, 0xedda, 0xedd6, 0xc15f, 0xedd0, 0xc159, 0xc169, 0xeddc, 0xc161, 0xc15d, 0xedd3, 0xc164, 0xc167, 0xedde, 0xc15c, 0xedd5, 0xc165, 0xede0, 0xeddd, 0xedd1, 0xc160, 0xc15a, 0xc168, 0xedd8, 0xc163, 0xedd2, 0xc15e, 0xeddf, 0xc162, 0xc15b, 0xedd9, 0xc166, 0xedd7, 0xeddb, 0xf06e, 0xf074, 0xc2b9, 0xf077, 0xc2b4, 0xc2b5, 0xf06f, 0xf076, 0xf071, 0xc2ba, 0xc2b7, 0x8cdc, 0xf06d, 0xc2b6, 0xf073, 0xf075, 0xc2b8, 0xf072, 0xf070, 0x9876, 0x8ea1, 0xf2b8, 0xc3b7, 0xc3b8, 0xc3b4, 0x8cb4, 0xc3b5, 0x8eb7, 0xf2b4, 0xf2b2, 0xf2b6, 0xc3ba, 0xf2b7, 0xf2b0, 0xf2af, 0xf2b3, 0xf2b1, 0xc3b6, 0xf2b5, 0xf4ac, 0xc47e, 0xc47d, 0xf4ad, 0x9da6, 0xf4af, 0xf4ae, 0xc4a1, 0xf5eb, 0xf5e8, 0xf5e9, 0xf5e7, 0xf5ea, 0xc4f2, 0xf5ec, 0x9eb0, 0xc4f1, 0xf742, 0x8eb8, 0xc5d5, 0xc5d7, 0xf7ee, 0xc5d6, 0xf8b9, 0xf940, 0xf942, 0xf8fe, 0xf941, 0xc66c, 0x9d70, 0x896e, 0x896f, 0x8970, 0x8971, 0x8972, 0x8973, 0x8974, 0xa6ce, 0x8975, 0xacfb, 0xd26f, 0xafca, 0xb2da, 0xdafc, 0xdafd, 0x8ebc, 0x8ebd, 0xeadf, 0xc16a, 0xede1, 0x8ebe, 0xc2bb, 0x9dd1, 0xf2ba, 0xf2b9, 0xc4a2, 0xf5ed, 0x94fd, 0xf743, 0xc5f8, 0xca49, 0x8bd7, 0x8bda, 0xaac9, 0xa875, 0xd04d, 0xd360, 0xd35b, 0xd35f, 0xd35d, 0xafcb, 0xd35e, 0xd35c, 0xd6f1, 0xdafe, 0xdb40, 0xdf69, 0xdf6a, 0xb86e, 0xb86f, 0xdf68, 0xdf6b, 0xdf67, 0xb86d, 0xbb40, 0xa0e2, 0xb870, 0xe37a, 0xbd7c, 0xe6f1, 0xbd7d, 0x9fe9, 0xbfa9, 0xeae2, 0xeae0, 0xeae1, 0xede4, 0xede3, 0xede2, 0xf2bb, 0xc3b9, 0xf2bc, 0xf744, 0xc5f9, 0xf8ba, 0xa6cf, 0xaacb, 0xaaca, 0xd04f, 0xacfc, 0xfda8, 0xd04e, 0xd362, 0x8ae7, 0xafcc, 0xd6f2, 0xd361, 0x8ec2, 0xb2dc, 0xd6f5, 0xd6f3, 0xd6f4, 0xb2db, 0xdb42, 0xdb43, 0xdb41, 0x8ec4, 0xb873, 0xdf6d, 0xdf6c, 0xdf6e, 0xb872, 0xb871, 0xe6f2, 0xe6f4, 0x9964, 0xbd7e, 0xe6f3, 0xeae3, 0xbfaa, 0xf079, 0x9965, 0xf078, 0xc3bb, 0xf2bd, 0xc3bd, 0xc3bc, 0xf4b0, 0xf5ee, 0xc4f3, 0xa6d0, 0xd050, 0xacfd, 0xd365, 0xafce, 0xd364, 0xd363, 0xafcd, 0xd6fb, 0xd6fd, 0xd6f6, 0xd6f7, 0xb2dd, 0xd6f8, 0xb2de, 0xd6fc, 0xd6f9, 0xd6fa, 0xb2df, 0xb5be, 0xb5bf, 0xdb44, 0xdf6f, 0xdf70, 0x954e, 0xe37e, 0xbb43, 0xbb41, 0xbb42, 0xe37b, 0xe37c, 0xe37d, 0xe6f9, 0x98b3, 0xe6fa, 0xbda1, 0xe6f7, 0xe6f6, 0xe6f8, 0xe6f5, 0xbfad, 0xeae4, 0xbfab, 0xbfac, 0xede6, 0xc16b, 0xede5, 0xefa8, 0xf07a, 0xf07b, 0xc2bc, 0x8ecb, 0xc2bd, 0xc16c, 0xf2be, 0xf2bf, 0xf4b1, 0xc4a3, 0xa6d1, 0x8bdf, 0xa6d2, 0xacfe, 0xaacc, 0xafcf, 0xd051, 0x8ece, 0xb5c0, 0xa6d3, 0xad41, 0xd052, 0xd053, 0xad40, 0xad42, 0xa6d4, 0xd054, 0xafd1, 0xd366, 0xafd3, 0xafd0, 0xafd2, 0xd741, 0xb2e0, 0x8ecf, 0xd740, 0xd6fe, 0x9968, 0xdf71, 0xe3a1, 0x9969, 0xbda2, 0xbfae, 0xeae6, 0xeae5, 0xede7, 0x996b, 0x8ed1, 0xf5ef, 0x996c, 0xa6d5, 0xcb73, 0xcdaa, 0xad43, 0xd055, 0xd368, 0x8ed4, 0x8ed5, 0xafd4, 0xd367, 0xafd5, 0xd743, 0xb2e2, 0xd742, 0xd744, 0xb2e1, 0xdb46, 0xdb47, 0xdb45, 0xb5c1, 0x996d, 0xb874, 0xb875, 0xbb45, 0xa0be, 0xe3a3, 0xe3a2, 0xbb44, 0x8ed6, 0xa0bc, 0xa0b5, 0xe6fb, 0xa0b4, 0xe6fc, 0xeae7, 0xc170, 0xc16f, 0xc16d, 0xc16e, 0xc171, 0xf07c, 0xc2bf, 0xc2be, 0xf2c0, 0xf4b2, 0xc5a5, 0xc5a4, 0xa6d6, 0x8be0, 0xd1fb, 0xb877, 0xb5c2, 0xb876, 0xbb46, 0xa6d7, 0xc9a9, 0xa6d8, 0xa6d9, 0xcdab, 0xcb76, 0xcb77, 0xa877, 0xcb74, 0xa876, 0xa879, 0xcb75, 0xa87b, 0xa87a, 0xcb78, 0xa878, 0x89b5, 0xaad1, 0xaacf, 0xcdad, 0xaace, 0x8edd, 0xaad3, 0xaad5, 0xaad2, 0xcdb0, 0xcdac, 0xaad6, 0xaad0, 0xa87c, 0xaad4, 0xcdaf, 0x9e5d, 0x9971, 0xcdae, 0xaacd, 0x89ae, 0x9de8, 0xd05b, 0xad47, 0xad48, 0xd05d, 0x9565, 0xd057, 0xd05a, 0xd063, 0xd061, 0xad49, 0xd067, 0xad4c, 0xd064, 0xd05c, 0xd059, 0xdb49, 0xd062, 0xad44, 0xd065, 0xd056, 0xd05f, 0xad46, 0xad4b, 0xd060, 0xad4f, 0xad4d, 0xd058, 0xad4a, 0xd05e, 0xad4e, 0xad45, 0xd066, 0x9972, 0x8b5c, 0xafda, 0xafe3, 0xafd8, 0xafd6, 0xd36a, 0xafde, 0xafdb, 0xd36c, 0x89b1, 0xafdd, 0xd36b, 0xd369, 0xd36e, 0xafe2, 0xafe0, 0xdb48, 0xd36f, 0xd36d, 0xafd7, 0xa0c0, 0xafd9, 0xafdc, 0x8edf, 0xafdf, 0x9566, 0xafe1, 0x9974, 0x9976, 0x9977, 0x9979, 0xd74e, 0xb2e4, 0x9dda, 0xd745, 0xd747, 0x8ee0, 0xd748, 0xd750, 0xd74c, 0xd74a, 0xd74d, 0xd751, 0xb2e5, 0xb2e9, 0xd746, 0xd74f, 0xb2e7, 0x935c, 0xb2e6, 0xd74b, 0xd749, 0xb2e3, 0xb2e8, 0x9de6, 0x8b5f, 0x9563, 0xb5c8, 0xdb51, 0xdb4f, 0xb5ca, 0x9567, 0xdb4a, 0xdfa1, 0xb5c9, 0xdb4e, 0x9de3, 0xdb4b, 0xb5c5, 0xb5cb, 0xdb50, 0xb5c7, 0xdb4d, 0xbb47, 0xb5c6, 0xdb4c, 0xb5cc, 0xb5c4, 0xb5c3, 0x997c, 0x997d, 0x997e, 0xdf77, 0xdf75, 0xdf7b, 0xdf73, 0xdfa2, 0xdf78, 0xdf72, 0xb87b, 0xb8a3, 0xdf7d, 0xdf76, 0xb87e, 0x8b5b, 0xb87c, 0xdf7e, 0xb879, 0xb878, 0xdf79, 0xb87d, 0xb5cd, 0xdf7c, 0xdf74, 0xb87a, 0xb8a1, 0xb8a2, 0x99a3, 0xbb4c, 0xbb48, 0xbb4d, 0xe3a6, 0x99a4, 0xe3a5, 0xe3a7, 0xbb4a, 0xe3a4, 0xbb4b, 0xe3aa, 0xe3a9, 0xe3a8, 0xbb49, 0x99a6, 0xe741, 0xe744, 0xbda8, 0xe743, 0xbda7, 0xbda3, 0xbda4, 0xbda5, 0xe740, 0xe6fe, 0xbda6, 0xe742, 0xe6fd, 0x99a8, 0xeae9, 0xeaf3, 0xbfb1, 0xbfb0, 0x8abe, 0xeaed, 0xeaef, 0xeaea, 0xeaee, 0xeae8, 0xeaf1, 0xbfaf, 0xeaf0, 0xeaec, 0x9e61, 0xeaf2, 0xeaeb, 0xc174, 0xede8, 0xedee, 0xc178, 0xc17a, 0xc177, 0xc176, 0x99aa, 0xc175, 0xc173, 0xede9, 0xedec, 0xc172, 0xeded, 0xa0c8, 0xc179, 0xedeb, 0xedea, 0xc2c0, 0xc2c1, 0xf0a1, 0xf07d, 0xf07e, 0xf2c2, 0xf2c1, 0xc3be, 0xf4b4, 0xc4a4, 0xf4b3, 0xf5f0, 0xf745, 0xc5a6, 0xf943, 0xf944, 0xc5d8, 0xa6da, 0x99ab, 0xaad7, 0xdb52, 0xbb4e, 0xc17b, 0xedef, 0xa6db, 0xafe5, 0xafe4, 0xdb53, 0xfec4, 0xeaf4, 0xa6dc, 0xad50, 0x98c2, 0xdb54, 0xdb55, 0xdb56, 0xbb4f, 0xbfb2, 0xa6dd, 0xaad8, 0xd068, 0xafe6, 0xd370, 0xb2ea, 0xdb57, 0xb8a4, 0xbb50, 0xbfb3, 0xc17c, 0xc2c2, 0xf4b5, 0xa6de, 0xaad9, 0xafe7, 0xd752, 0xb5ce, 0xbb51, 0xe3ab, 0xe745, 0x8ee8, 0xa0ba, 0xa6df, 0xb5cf, 0xdfa3, 0xbb52, 0xa6e0, 0xcdb1, 0xd069, 0xad51, 0xd372, 0xfd77, 0xafea, 0x8eee, 0xafe8, 0xafe9, 0xafeb, 0x9ebf, 0xd371, 0xd757, 0xd754, 0xd756, 0xb2eb, 0xb2ed, 0xb2ec, 0xd753, 0xb2ee, 0xd755, 0xdb58, 0xdb59, 0x89c2, 0xdb5a, 0xdfa6, 0xdfa7, 0xdfa5, 0xdfa8, 0xb8a5, 0xdfa4, 0xbb53, 0xe74a, 0xe746, 0xe749, 0xe74b, 0xe748, 0xe747, 0x99ac, 0xeaf5, 0xeaf6, 0xeaf7, 0xbfb4, 0xbfb5, 0xedf1, 0xedf0, 0xedf2, 0xf0a3, 0xf0a2, 0xf2c4, 0x956b, 0xf2c5, 0xf2c3, 0x956c, 0xc4a5, 0xf4b6, 0xf4b7, 0xf746, 0xf7ef, 0xf8bb, 0xa6e1, 0xa87d, 0xc17d, 0xa6e2, 0xd758, 0xdb5b, 0x99af, 0xc641, 0xca4a, 0x994a, 0x8976, 0x8f48, 0xca4b, 0xca4d, 0xa6e3, 0xca4e, 0xca4c, 0xcba2, 0xcba3, 0xcb7b, 0xfbee, 0xcba1, 0xa8a1, 0xa8a2, 0xcb7c, 0xcb7a, 0xcb79, 0xcb7d, 0xa87e, 0xcb7e, 0xd06a, 0xcdb6, 0xaadc, 0xcdb5, 0xcdb7, 0xaadb, 0xcdbc, 0xaadf, 0xcdb2, 0xcdc0, 0xcdc6, 0xaae6, 0xcdc3, 0xaae3, 0x99ae, 0xcdb9, 0xcdbf, 0xcdc1, 0x8efb, 0xcdb4, 0xaae2, 0xaadd, 0xcdba, 0xaae4, 0xaae7, 0xaae1, 0xaada, 0xcdbe, 0xcdb8, 0xcdc5, 0xaae9, 0xaae5, 0xaae0, 0xcdbd, 0xafec, 0xcdbb, 0xaade, 0xaae8, 0x8cd0, 0xcdb3, 0xcdc2, 0xcdc4, 0x8b52, 0x99b0, 0x8977, 0x8f41, 0xad62, 0xad5c, 0xad64, 0xad61, 0xd071, 0xd074, 0xad5d, 0x99b1, 0xd06b, 0xad56, 0xad60, 0xad63, 0xad65, 0xd0a2, 0xd077, 0x8f49, 0xad55, 0xd0a1, 0xad59, 0xad57, 0xad52, 0xd06f, 0xd07e, 0xd073, 0xd076, 0xd0a5, 0xfa4d, 0xad66, 0xd07d, 0xad5e, 0xd078, 0xd0a4, 0xd075, 0xd079, 0xd07c, 0x9de4, 0x8cb5, 0xd06d, 0xd0a3, 0xd07b, 0xfbe9, 0x9b54, 0xd06c, 0x99b2, 0xd070, 0xad5f, 0xad5a, 0xad53, 0xad58, 0xad54, 0xad67, 0xd06e, 0xd3a5, 0xad5b, 0x9e68, 0xd07a, 0xce41, 0xd3a8, 0xaffa, 0x8f4a, 0xd376, 0x8f42, 0xd3a3, 0xd37d, 0x8f51, 0xd3b2, 0xd3aa, 0xd37e, 0xd3a9, 0xd378, 0xd37c, 0xd3b5, 0xaffd, 0xd3ad, 0xd3a4, 0xafed, 0xd3b3, 0xd374, 0xd3ac, 0xaffc, 0xaff7, 0xd373, 0xaff5, 0xaff4, 0xaff9, 0xd3ab, 0xaff1, 0xaff8, 0xd072, 0xdb5c, 0xd3a6, 0x9846, 0xd37a, 0xaffb, 0xd37b, 0xd3a1, 0xaffe, 0xd375, 0xd3af, 0xd3ae, 0xd3b6, 0xaff3, 0xaff0, 0xd3b4, 0xd3b0, 0xd3a7, 0xd3a2, 0xaff6, 0xaff2, 0xd377, 0xafee, 0xd3b1, 0xafef, 0xd379, 0x99b4, 0x8ef5, 0xfd55, 0x9ccd, 0x8978, 0xd75e, 0xd760, 0xd765, 0xd779, 0xb2fc, 0xb2f2, 0xd75d, 0xb2fd, 0xb2fe, 0xd768, 0xd76f, 0xd775, 0xd762, 0xd769, 0x8f53, 0xb340, 0xd777, 0xd772, 0xb2fa, 0xb2f8, 0xd76e, 0xd76a, 0xd75c, 0xb2ef, 0xd761, 0xd759, 0x8f6f, 0xb2f7, 0xb2f9, 0xd766, 0xd763, 0xb2f4, 0xd773, 0xb2f1, 0xd764, 0xd77a, 0xd76c, 0x8e63, 0xd76b, 0xb2f0, 0xb2fb, 0xb2f3, 0xd75a, 0xd75f, 0xd770, 0xd776, 0xb341, 0xd75b, 0xd767, 0xd76d, 0xb2f6, 0x8f56, 0xd778, 0xd771, 0xd774, 0xfe76, 0xb2f5, 0x9fc6, 0xdb6c, 0xdb60, 0xb5d7, 0xdb7d, 0xdba7, 0xdbaa, 0xb5d5, 0xdb68, 0xdba3, 0xdb69, 0xdb77, 0xb5e2, 0xdb73, 0xb5df, 0xfaac, 0xdb74, 0xdb5d, 0xdba4, 0x8f58, 0xb5e8, 0xdba1, 0xdb75, 0xdbac, 0xdb70, 0xdfc8, 0xdbaf, 0xb5e6, 0xdb6e, 0xdb7a, 0xb5e9, 0xb5d4, 0xdb72, 0xdbad, 0xdb6b, 0xdb64, 0xdb6f, 0xdb63, 0xdb61, 0xb5d0, 0xdba5, 0xdb6a, 0xdba8, 0x9848, 0xdba9, 0xb5d8, 0xb5dd, 0xb5d9, 0xb5e1, 0xdb7e, 0xb5da, 0xdb76, 0xdb66, 0xb5d2, 0xdb5e, 0xdba2, 0xdbab, 0xdb65, 0xb5e0, 0xdbb0, 0xdb71, 0xdb6d, 0xb5d1, 0xb5e5, 0x99b7, 0xdb7c, 0xb5e7, 0xdb78, 0xb5dc, 0xb5d6, 0xb5de, 0xb5d3, 0xb5e4, 0xdb79, 0xdb67, 0xdb7b, 0xdb62, 0xdba6, 0x9665, 0xfa6c, 0x9de7, 0xdbae, 0x9e62, 0x96cc, 0x8e67, 0xdb5f, 0xfc75, 0x987e, 0xdfc7, 0xdfdd, 0xb855, 0xdfcc, 0xfdb9, 0xdfca, 0xdfb5, 0xb8a9, 0xdfc5, 0xdfd9, 0xdfc1, 0xb8b1, 0xdfd8, 0xdfbf, 0xb5e3, 0xdfcf, 0xdfc0, 0xdfd6, 0xb8b0, 0xb8a8, 0x97fc, 0xdfaa, 0xdfb2, 0xdfcb, 0xdfc3, 0xdfdc, 0xdfc6, 0xb8b6, 0xdfd7, 0x98f9, 0xb8ad, 0x8f66, 0xdfc9, 0xdfd1, 0xdfb6, 0xdfd0, 0xdfe1, 0xdfb1, 0xdfd2, 0x956e, 0xdfdf, 0x9245, 0xdfab, 0xb5db, 0x8f60, 0xdfb9, 0xdfb8, 0xb8af, 0x9ed1, 0xdfbc, 0xdfbe, 0xdfcd, 0xdfde, 0xb8b2, 0xfecd, 0xb8b3, 0x99b9, 0xdfb0, 0xb8ab, 0xdfb4, 0xdfda, 0xb8b4, 0xb8ac, 0xb8ae, 0xb8b5, 0xdfe0, 0xdfd3, 0xdfce, 0x8f62, 0x974c, 0xdfbb, 0xdfba, 0xb8aa, 0xdfac, 0xb8a7, 0xdfc4, 0xdfad, 0xdfc2, 0xdfb7, 0xdfdb, 0x91c7, 0x955f, 0xb8a6, 0xdfb3, 0x99bb, 0xdfaf, 0xdfd5, 0xdfae, 0xbb60, 0xe3d3, 0x8e6d, 0x8f71, 0xe3c2, 0x94cb, 0xe3ac, 0xe3ca, 0xbb58, 0xe3bb, 0xe3c5, 0xbb5b, 0xe3be, 0xbb59, 0xe3af, 0xe3cd, 0xe3ae, 0xe3c1, 0x95b1, 0xe3ad, 0xe3bf, 0xe3c8, 0xe3c6, 0xe3ba, 0xe3b5, 0xe3b3, 0x9af2, 0xe3b4, 0xe3c7, 0xe3d2, 0xe3bc, 0xbb5a, 0xe3b7, 0xe3cb, 0xbb5d, 0xe3b6, 0xe3b0, 0xe3c0, 0xbb61, 0x96c3, 0x99bd, 0xbb55, 0xbb5e, 0xe3b8, 0xe3b2, 0xbb57, 0xdfd4, 0xbb56, 0xe3c3, 0xbb54, 0xbb63, 0xbb5c, 0xe3c4, 0xe3b9, 0xe3b1, 0xe3cc, 0xe3bd, 0xbb62, 0xe3d0, 0xbb5f, 0xe3cf, 0xe3c9, 0xe3ce, 0xa0cf, 0xe3d1, 0x8f6d, 0x99be, 0x8ef4, 0x8f72, 0x95e4, 0xe773, 0xe774, 0xe767, 0xe766, 0xe762, 0xbdb4, 0xbdac, 0xe776, 0xe775, 0xdfa9, 0xe75f, 0xe763, 0xe75d, 0xe770, 0xe761, 0x99bf, 0xe777, 0xe75a, 0xe758, 0xe764, 0xe76e, 0xe769, 0xbdb6, 0xe74f, 0xe76d, 0x9242, 0xfba5, 0xbdb7, 0xdfbd, 0xe75b, 0xe752, 0xe755, 0xe77b, 0xe75c, 0xe753, 0xe751, 0xe74e, 0x99c0, 0xbdb0, 0xe765, 0xbdaf, 0xbdb3, 0xe760, 0xe768, 0xbda9, 0xe778, 0xe77c, 0xbdab, 0xe757, 0xe76b, 0xe76f, 0xe754, 0xe779, 0xbdb2, 0xbdb1, 0xe74c, 0xbdb5, 0xe772, 0xe756, 0xe76a, 0xe750, 0xe75e, 0xe759, 0xbdad, 0xbdae, 0xe76c, 0xe77d, 0xe77a, 0xe771, 0xfdb4, 0x8f77, 0x99c1, 0xe74d, 0xbdaa, 0xeb49, 0xeb40, 0xeb43, 0xfab9, 0xbfbb, 0xeb45, 0xeaf9, 0xeb41, 0xeb47, 0xbfb8, 0xbfbc, 0xbfb6, 0x8f40, 0xfa44, 0xeafb, 0xeb4c, 0xeb46, 0x99c2, 0xeafc, 0xeb55, 0xeb4f, 0xeaf8, 0xee46, 0xeafe, 0xbfb7, 0x8f5c, 0xeb4a, 0xeb54, 0xbfbf, 0x8cbd, 0xeb51, 0xeafd, 0xeb44, 0xeb48, 0xeb42, 0xeb56, 0xeb53, 0xeb50, 0xbfb9, 0xbfba, 0xbfbe, 0xeafa, 0xeb57, 0xbfbd, 0xeb4d, 0x99c4, 0x99c5, 0xeb4b, 0x8f7b, 0xeb4e, 0xee53, 0xee40, 0xee45, 0xee52, 0xee44, 0xedfb, 0xee41, 0xc1a2, 0xedf4, 0xee4d, 0xee4f, 0xedf3, 0xc1a1, 0xee51, 0xee49, 0xc1a8, 0xee50, 0xee42, 0xc1aa, 0xedf9, 0xeb52, 0xee4a, 0xee47, 0xedf5, 0xee55, 0xc1a4, 0xc1a5, 0xedf7, 0xee48, 0x8cb6, 0xee54, 0xee4b, 0xedfd, 0xc1a7, 0xc1a3, 0xee4c, 0xedfe, 0xee56, 0xedf8, 0xee43, 0xee4e, 0xedfa, 0xedfc, 0xc2cb, 0xedf6, 0xc1a9, 0xc2c4, 0xc17e, 0xc1a6, 0xc2c8, 0xf0b3, 0xf0a9, 0xf0a4, 0xf0aa, 0xf0b4, 0xf0b8, 0xf0b7, 0xc2ca, 0xc2c9, 0xf0ab, 0xf0b9, 0xf0ae, 0xf0a6, 0x8fa3, 0xf0a8, 0xf0a7, 0xf0ad, 0xf0b2, 0xf0a5, 0xf0ac, 0xf0b1, 0xc2c7, 0xf0af, 0xc2c5, 0xf0b0, 0xc2c3, 0xc2c6, 0xf2d5, 0xf0b5, 0xc3c2, 0x8cce, 0xf2cd, 0xf2d1, 0xf2c9, 0xf2cc, 0xf2d4, 0xc3c0, 0xf2d9, 0xf2d2, 0x99c6, 0xf2ca, 0xf2da, 0xf2d3, 0xc3c3, 0xc3c4, 0xf2d7, 0xf2cb, 0xc3bf, 0xc3c1, 0xf2c6, 0xf2ce, 0xf2c8, 0x96cd, 0xf2d8, 0xf2d6, 0xf2c7, 0xf2cf, 0xf4be, 0xc3c5, 0xf2d0, 0xc4a7, 0xc4a9, 0xc4a6, 0x96c7, 0xf4c3, 0xf4bb, 0xf4b9, 0xf4bd, 0xf4ba, 0x8fa5, 0xf4bf, 0xf4c1, 0xc4aa, 0xc4ac, 0xf4c0, 0xc4ad, 0xc4ab, 0xf4c2, 0xfabb, 0x8c61, 0x9570, 0xc4a8, 0x9368, 0x8f7e, 0xc4f4, 0xf5f1, 0xf5f7, 0xc4f6, 0xf4bc, 0xf5f6, 0xf5fd, 0xf5f4, 0xf5fb, 0xf5fa, 0xf4b8, 0xf5f5, 0xf0b6, 0xf5fe, 0xf5f3, 0xf5f8, 0x8faa, 0xf5fc, 0xf5f2, 0xf74a, 0xc4f5, 0xf5f9, 0xa050, 0xf7f4, 0xf74b, 0xf749, 0xf747, 0xf748, 0xf74c, 0xc5d9, 0xf7f2, 0xf7f0, 0xf7f5, 0xf7f3, 0xf7f6, 0xc5da, 0xf7f1, 0x90d3, 0xf8bc, 0x9556, 0xf945, 0xf946, 0xf947, 0xf9c7, 0xf9bd, 0xca4f, 0xaaea, 0xad68, 0xd3b8, 0xd3b7, 0xb040, 0xb342, 0xd77c, 0xd77b, 0xb5ea, 0xb8b8, 0xb8b7, 0xb8b9, 0xe3d4, 0xe77e, 0xeb58, 0xeb5a, 0xeb59, 0xc1ab, 0xee57, 0xf0ba, 0xf9a5, 0xa6e4, 0x8fb8, 0xcdc9, 0xcdca, 0xcdc8, 0xcdc7, 0xaaeb, 0x99c8, 0xd0a9, 0xd0a7, 0xd0a6, 0xad69, 0xad6b, 0xad6a, 0xd0a8, 0x8faf, 0xd3c4, 0xd3c1, 0xd3bf, 0xb041, 0xd3c2, 0xb046, 0xd3bc, 0xd3cb, 0xd3cd, 0xd3bd, 0x99c9, 0xb043, 0xd3ce, 0xd3c9, 0xd3bb, 0xd3c0, 0xd3ca, 0xd3c6, 0xd3c3, 0xb048, 0xd3cc, 0xd3be, 0x9579, 0xd3c7, 0xd3b9, 0xb047, 0xb044, 0xd3c5, 0xd3c8, 0xd3ba, 0xb045, 0xb042, 0x9f49, 0xb34c, 0xd7a5, 0xb34b, 0x99ca, 0xd7a8, 0xd7ab, 0xb348, 0xb346, 0xd77e, 0xd7a9, 0xd7a7, 0xd7a4, 0xd7ac, 0xd7ad, 0xd7af, 0xd7b0, 0xd77d, 0xb345, 0xd7a2, 0xd7a1, 0xd7ae, 0xb347, 0xd7a3, 0xb349, 0xb344, 0xd7a6, 0xb34d, 0xb34a, 0xd7aa, 0xb5f1, 0xdbbf, 0xdbb4, 0xb5ee, 0xdfe7, 0xdbbd, 0xdbb1, 0xb5ec, 0xdbb6, 0xb5ef, 0xdbba, 0xdbb8, 0xb5f2, 0xb5eb, 0xdbb2, 0xdbb5, 0xb5f0, 0xdbb3, 0xdbbe, 0xdbbc, 0xdbb7, 0xdbb9, 0xdbbb, 0xb5ed, 0x99cb, 0xdfe8, 0xdfee, 0xdfe4, 0xdfea, 0xb8ba, 0xdfe6, 0xb8c0, 0xb8bf, 0xb8be, 0xdfed, 0xb8c1, 0xb8c2, 0xdfe3, 0xdff0, 0xb8c3, 0xb8bd, 0xb8bc, 0xdfec, 0xb8c4, 0xdfe2, 0xdfe5, 0xdfef, 0xdfeb, 0xe3f4, 0xe3e9, 0xb8bb, 0xbb6a, 0xe3dd, 0xe3f2, 0xe3de, 0xbb65, 0xe3db, 0xe3e4, 0xe3dc, 0xbb67, 0xe3d6, 0xe3f1, 0xbb68, 0xe3ee, 0xe3ef, 0xe3d7, 0xbb6d, 0xe3e6, 0xe3e0, 0xe3e7, 0xe3da, 0xe3f3, 0xe3eb, 0xe3e5, 0xe3d5, 0xbb69, 0xe3ec, 0xbb6c, 0xe3f0, 0xe3ea, 0xbb66, 0xe3e8, 0xe3e2, 0xbb64, 0xe3d9, 0xe3e1, 0xe3ed, 0xe3df, 0xe3e3, 0xbdc1, 0xdfe9, 0xe7b2, 0xe7bb, 0xe7b1, 0xe7ad, 0xe7aa, 0xbdc2, 0xe7a8, 0xbb6b, 0xe7a1, 0xbdc0, 0xe7a7, 0xbdbf, 0xe7ac, 0xe7a9, 0xe7b9, 0xe7b4, 0xe7ae, 0xe7b3, 0xbdbb, 0xe7ab, 0xe7be, 0xe7a2, 0xe7a3, 0xe7ba, 0xbdbc, 0xe7bf, 0xbdbe, 0xe7c0, 0xe7b0, 0xe3d8, 0xe7b6, 0xe7af, 0xe7b8, 0xe7b5, 0x9dd5, 0x8fb0, 0xe7a6, 0xbdb9, 0xe7bd, 0xbdba, 0xe7a4, 0xbdbd, 0xeb64, 0xe7b7, 0xe7bc, 0xfa7a, 0xeb61, 0xbdb8, 0xbfc0, 0xeb6b, 0xeb67, 0x9e5f, 0xeb65, 0xeb60, 0xeb6f, 0x99cd, 0xa0c9, 0xbfc4, 0xeb5c, 0xeb68, 0xeb69, 0xeb5f, 0xeb5e, 0xeb6c, 0xeb62, 0xeb5d, 0xeb63, 0xeb6e, 0xeb5b, 0xeb6d, 0xeb6a, 0xbfc2, 0xbfc1, 0xbfc3, 0xeb66, 0xf0cb, 0x9adb, 0xa0c6, 0xee59, 0xc1b1, 0xee5d, 0xee5a, 0xee61, 0xee67, 0xee5c, 0x8fb4, 0xee70, 0xc1ae, 0xee6a, 0xee5f, 0xee6b, 0xee66, 0xee6d, 0xee5e, 0xc1b3, 0xc1b2, 0xee60, 0xee6e, 0xee58, 0xee6c, 0xc1ac, 0xa0d7, 0xee64, 0xee63, 0xee68, 0xee5b, 0xc1b0, 0xc1b4, 0xee62, 0xee69, 0xc1b5, 0xee65, 0xa0c7, 0xc1ad, 0xc1af, 0xf0c7, 0xf0c5, 0xa043, 0xf0cc, 0xf0c9, 0xf0cd, 0x8fb5, 0xf0be, 0xf0c6, 0xf0d1, 0xee6f, 0xf0c2, 0xc2cf, 0xe7a5, 0xf0bd, 0xf0ca, 0xf0c4, 0xf0c1, 0xf0bc, 0xf0bb, 0xf0d0, 0xf0c0, 0xf0bf, 0xc2cd, 0xf0c8, 0x8fb2, 0xc2cc, 0xc2ce, 0xf0c3, 0xf0cf, 0xa061, 0xf2de, 0xf2df, 0xc3c9, 0xf2dc, 0xc3c6, 0xf2e4, 0xc3ca, 0xf2e6, 0xf2db, 0xf0ce, 0xf2e8, 0xf2dd, 0x9e5e, 0xc3c7, 0xf2e3, 0xf2e5, 0xf2e0, 0xf2e7, 0xf2e2, 0xf2e1, 0xc3c8, 0x8fb6, 0xf4c5, 0xf4c6, 0xf4c8, 0xc4ae, 0xc4af, 0xf4c9, 0xf4c7, 0x9fe8, 0xf4c4, 0xf642, 0xf645, 0xf641, 0xc4fa, 0xf643, 0xc4f9, 0xc4f8, 0xc4f7, 0xf644, 0xf751, 0xf74f, 0x9cb2, 0xf74e, 0xf640, 0xf750, 0xf646, 0xf74d, 0x957c, 0xf7f9, 0xf7d7, 0xf7f7, 0xc5db, 0xf7f8, 0xf7fa, 0xf8bf, 0xc5fa, 0xf8be, 0xf8bd, 0xc5fb, 0xc65a, 0xf96e, 0xf9a7, 0xf9a6, 0xf9a8, 0xa6e5, 0xd0aa, 0x9fc7, 0xd3cf, 0xd3d0, 0x8fbb, 0x8fbc, 0xdbc0, 0xf647, 0xf8c0, 0xa6e6, 0xad6c, 0xd0ab, 0x8fec, 0xd7b1, 0xb34e, 0xdbc2, 0xdbc1, 0xb5f3, 0xb8c5, 0xe7c1, 0xbdc3, 0xbdc4, 0x8fc0, 0x936a, 0xbfc5, 0xc5fc, 0xa6e7, 0x8be4, 0x9c7c, 0xd0ac, 0xaaed, 0xd0ae, 0xd0ad, 0xad6d, 0xd3d1, 0x95a1, 0xd3d8, 0xb049, 0xd3d6, 0xd3d4, 0xd3db, 0xd3d2, 0xd3d3, 0xb04a, 0xb04e, 0xd3dc, 0xb04d, 0xd3da, 0xd3d7, 0xd3d5, 0xb04b, 0xb04c, 0xd3d9, 0xfeec, 0x95a3, 0xb350, 0xd7b2, 0xb355, 0xd7c2, 0xb354, 0xd7c4, 0x8c45, 0x8cb8, 0xd7b8, 0xb352, 0xd7c3, 0xd7b3, 0xb353, 0xd7bf, 0xd7bb, 0xd7bd, 0xd7b7, 0xd7be, 0x8fc1, 0xb34f, 0xd7ba, 0xa052, 0xd7b9, 0xd7b5, 0xd7c0, 0xd7bc, 0xd7b4, 0xd7b6, 0xb351, 0xd7c1, 0x99d0, 0xb5f6, 0xdbcd, 0x8fc3, 0x8fc4, 0xdbc9, 0xdbcb, 0xdbc6, 0xdbc5, 0xdbc3, 0xdbca, 0xdbcc, 0xdbc8, 0x95a4, 0xdbc7, 0xb5f4, 0xb5f5, 0x8fc6, 0x9e60, 0xdbcf, 0xb8cd, 0xdff2, 0xdff8, 0xdff3, 0xdff4, 0xf9d8, 0xdff9, 0xb8cf, 0xb8c7, 0xb8ce, 0xdff1, 0xdbc4, 0xb8ca, 0xb8c8, 0xdff7, 0xdff6, 0xb8c9, 0xb8cb, 0xdff5, 0xb8c6, 0xb8cc, 0x95a5, 0xe3f6, 0xbb74, 0xe442, 0xe441, 0xe3fb, 0xbb76, 0xe440, 0xe3f7, 0xe3f8, 0xbb6e, 0xbb70, 0x9cb3, 0xe3fd, 0xe3f5, 0xbb72, 0xbb71, 0xe3f9, 0xe3fe, 0xe3fc, 0xbb73, 0xe3fa, 0x99d1, 0xfef1, 0xdbce, 0xbb6f, 0xe7c2, 0xe7c9, 0xbdc6, 0xe7cd, 0xbdca, 0xe7c5, 0xe7c3, 0xe7cc, 0xbdc5, 0xe7cb, 0xbdc7, 0xbdc8, 0xe7c4, 0xbdc9, 0xe7ca, 0xe7c6, 0xe7c7, 0xe7c8, 0xbb75, 0xeb70, 0xeb7c, 0xbfca, 0xeb77, 0xeb79, 0x99d2, 0xbfc8, 0xeb71, 0xeb75, 0xeb78, 0xbfc6, 0xbfc9, 0xeb7b, 0xeb73, 0xeb74, 0xeb7a, 0xeb72, 0xeb76, 0xbfc7, 0xee72, 0xee71, 0xc1b7, 0xee77, 0xc1b9, 0xc1b6, 0xee73, 0xc1ba, 0xee74, 0xee75, 0xee78, 0x9cc2, 0xc1b8, 0xf0d6, 0x99d3, 0xf0d9, 0xf0d3, 0xf0d5, 0x95a7, 0xf0d4, 0xf0d7, 0xf0d8, 0xee76, 0xf0d2, 0x95a9, 0xc3cd, 0xf2ec, 0xf2ef, 0xf2f1, 0xf2ea, 0xf2eb, 0xf2ee, 0xf2f0, 0xc3ce, 0xc3cc, 0xc3cb, 0xf2ed, 0xf2e9, 0xf4ca, 0xc4b0, 0x95a6, 0xf4cb, 0xf649, 0xc4fb, 0xf64b, 0xc4fc, 0xf648, 0xf64a, 0xc5a8, 0xf752, 0xc5a7, 0xf7fd, 0xf7fc, 0xf7fb, 0x9c5d, 0xf948, 0xf949, 0xf94b, 0xf94a, 0xca50, 0xa6e8, 0x98e2, 0xad6e, 0xd7c5, 0xb5f7, 0xdffa, 0xc2d0, 0x8fc9, 0xf2f2, 0xa0c2, 0x8fca, 0xa8a3, 0xb357, 0x99d4, 0xb356, 0xa0b9, 0xdbd0, 0xb5f8, 0xdbd2, 0xdbd1, 0xdffb, 0xb8d0, 0xe443, 0xe446, 0xe445, 0xe444, 0xe7ce, 0xe7d0, 0xe7cf, 0x9b58, 0xbfcc, 0x8fcd, 0xa0d4, 0xbfcb, 0xc1bb, 0xee79, 0xee7b, 0xee7a, 0xc2d1, 0xf2f4, 0xf2f3, 0xf4cc, 0xc4b1, 0x8fce, 0xc4fd, 0xf754, 0xf753, 0xc65b, 0x8be5, 0x8979, 0xa8a4, 0xd0af, 0xad6f, 0xd7c8, 0xd7c6, 0xd7c7, 0xdbd4, 0xdbd5, 0xe043, 0xdbd3, 0xdffc, 0xe041, 0xe040, 0xe042, 0xb8d1, 0xdffe, 0xdffd, 0xe044, 0x8fd0, 0xe449, 0xe447, 0xe448, 0xe7d3, 0xe7d1, 0xe7d2, 0xeb7d, 0xee7c, 0xee7d, 0xc2d2, 0xf2f5, 0xf4cd, 0xc4b2, 0xf64c, 0xf755, 0xc5a9, 0xf7fe, 0xf94c, 0xa8a5, 0xad71, 0xad72, 0xd0b0, 0xd0b1, 0xad70, 0xb054, 0xb052, 0xb051, 0xb058, 0xb050, 0xb059, 0xd3dd, 0xb056, 0xb053, 0xb057, 0xb055, 0xb04f, 0xb35f, 0x95b6, 0xb359, 0xd7cc, 0xb35e, 0xb360, 0xb35a, 0xb35b, 0xd7ca, 0x99d6, 0xb358, 0x95e5, 0xd7cb, 0xb35d, 0xd7c9, 0xb35c, 0xb644, 0xb646, 0x99d7, 0xdbd8, 0xb645, 0xb5f9, 0xb5fd, 0x95b5, 0xb8e4, 0xe049, 0xdbda, 0xb5fe, 0xdbdd, 0xdbde, 0xb643, 0xdbe0, 0xa0ca, 0xdbe2, 0xdbe3, 0xdbd7, 0xdbd6, 0xdbe4, 0xb642, 0xdbe1, 0xdbdf, 0xb640, 0xb5fb, 0xb647, 0xdbdb, 0xdbdc, 0xdbd9, 0xb641, 0xb5fc, 0xb5fa, 0xe048, 0xb8df, 0xb8da, 0xb8d5, 0x9ffd, 0xb8e5, 0xb8d6, 0xb8d2, 0xb8e1, 0xb8de, 0xb8e0, 0xb8d7, 0xb8dc, 0xb8d3, 0xb8d4, 0xe050, 0xe04d, 0xe045, 0xe04a, 0xb8e2, 0xe051, 0xb8e3, 0xb8d9, 0xa058, 0xe047, 0xe04f, 0xe04b, 0xe04e, 0xe04c, 0xb8dd, 0xe046, 0xb8d8, 0xe44c, 0xbb78, 0xbb7b, 0xe44e, 0x8fd6, 0xbba5, 0xe44d, 0xbb7d, 0x99d8, 0xbdcf, 0xe44f, 0xbba4, 0xe44b, 0xbba6, 0x8fd3, 0xbb79, 0xb8db, 0xbb7c, 0xbb7a, 0xbb7e, 0xbba2, 0xbb77, 0xbba7, 0xbba3, 0x8fe5, 0xbba1, 0xe44a, 0x8fe9, 0xbdd6, 0xbdd2, 0x99d9, 0xbdd9, 0xe7d6, 0xbdda, 0xe7e2, 0xe7db, 0xbdcb, 0xe7e3, 0xe7dd, 0xbdd5, 0xe7de, 0xbdd4, 0xe7e1, 0xbdce, 0xe7df, 0xe7d5, 0xbdcd, 0xebaa, 0xbdd3, 0xbdd0, 0xbdd8, 0xe7d4, 0xe7d8, 0xbdcc, 0xe7d7, 0xe7d9, 0xe7da, 0xbdd7, 0xe7dc, 0xe7e0, 0xe7e4, 0x927c, 0xbddb, 0xbfd2, 0xeba5, 0xebab, 0xeba8, 0xeb7e, 0xebac, 0xeba1, 0xeba7, 0xbfcd, 0xbfd3, 0xebad, 0x9c45, 0xbfcf, 0xbfd9, 0xbfd4, 0xebaf, 0xeba9, 0xbfd0, 0xeba2, 0xbfda, 0xeba3, 0xeba4, 0xbfdb, 0xbfd8, 0xbdd1, 0xbfce, 0xebb0, 0xbfdc, 0xbfd5, 0xebae, 0xbfd1, 0xbfd6, 0xbfd7, 0xc1c3, 0xeea4, 0xeead, 0xeeaa, 0xeeac, 0xc1c0, 0xeea5, 0x8fde, 0xeeab, 0xc1bc, 0xeea7, 0xc1c4, 0xeea3, 0xeea8, 0xeeaf, 0xeba6, 0xeea9, 0xeea2, 0xc1bd, 0xeea1, 0xc1be, 0xeeb0, 0xc1bf, 0xeeae, 0xc1c2, 0xee7e, 0x8fdf, 0xc1c1, 0xeea6, 0xf0dc, 0xf0ea, 0xf0e5, 0xf0e7, 0xf0db, 0xc2d3, 0xf0da, 0xc2d6, 0xc2d5, 0xa04b, 0xf0e9, 0xf0e1, 0xf0de, 0xf0e4, 0xf0dd, 0xf0df, 0xf0e8, 0xf0e6, 0xc2d4, 0xf0ed, 0xf0eb, 0xf0e2, 0xf0ec, 0xf0e3, 0x8fe2, 0xf2f9, 0xc3cf, 0xf341, 0xa0cc, 0xf64f, 0xc3d6, 0xf0e0, 0xf2f7, 0xc3d2, 0xf2f8, 0xf2fd, 0x8fe3, 0x8fe4, 0xc3d4, 0xc3d5, 0xf2f6, 0xf340, 0xf342, 0xf2fa, 0xf2fc, 0xf2fe, 0xf2fb, 0xf343, 0xc3d1, 0xc3d7, 0xc3d3, 0xc3d0, 0xf4d0, 0x9bc4, 0xc4b7, 0xf4ce, 0x9bfc, 0xf4d2, 0xf4d3, 0xc4b5, 0xf4d4, 0xf4d1, 0x964c, 0xf4cf, 0xc4b8, 0xc4b4, 0xf4d5, 0xc4b6, 0xc4b3, 0xc4fe, 0xc540, 0xf64e, 0xf64d, 0xf650, 0xf651, 0xc541, 0xf756, 0xf75b, 0xc5aa, 0x9af6, 0xf758, 0x8cae, 0xf757, 0xf75a, 0xf759, 0xf843, 0xc5dc, 0xf842, 0xf840, 0xf841, 0x8fe7, 0xc5fe, 0xc5fd, 0xf8c1, 0xf8c2, 0xc640, 0xf94d, 0xf94e, 0xc667, 0x8fe8, 0xc66d, 0xf9a9, 0xf9c8, 0x8be7, 0x897a, 0x897b, 0xa8a6, 0xd7cd, 0xd7ce, 0xe052, 0xe450, 0xe7e5, 0xc1c6, 0xc1c5, 0xf0ee, 0xf344, 0xf844, 0xa8a7, 0xd3de, 0xb05a, 0xb361, 0xe054, 0xe053, 0xbddc, 0xe7e6, 0xbddd, 0xeeb1, 0xc2d7, 0x99da, 0xc676, 0xa8a8, 0xcdcb, 0xd3df, 0xb362, 0xd7cf, 0xd7d0, 0xdbe5, 0xb648, 0xb8e6, 0xe056, 0xe055, 0xe057, 0xe451, 0xe452, 0xbba8, 0xbfdd, 0xbdde, 0xbfde, 0xeeb5, 0xeeb2, 0xeeb4, 0xeeb3, 0xc1c7, 0xf0ef, 0xf346, 0xf345, 0xcba4, 0xb05c, 0xb05b, 0xd3e0, 0xd7d1, 0xdbe7, 0xdbe6, 0xb649, 0xe059, 0xe05a, 0xe058, 0xb8e8, 0xb8e7, 0xbbaa, 0xbba9, 0xe7e7, 0xebb3, 0xebb1, 0xebb2, 0xbfdf, 0xeeb7, 0xeeb6, 0xf0f2, 0xf0f1, 0xf0f0, 0xf347, 0x8fed, 0xf9aa, 0xa8a9, 0xad73, 0x95c0, 0xad74, 0xb05d, 0xb05e, 0xd3e2, 0xd3e1, 0xd7d2, 0xb368, 0xb366, 0xb363, 0xb367, 0xb365, 0xb364, 0xa0cb, 0xb64a, 0xdbea, 0xb8ed, 0xb64c, 0xb651, 0xdbec, 0xb653, 0xb652, 0xb655, 0xdbeb, 0xdbe8, 0xb64f, 0xb64b, 0xb64d, 0xdbe9, 0xb654, 0xb650, 0xb64e, 0xb8ef, 0xb8ee, 0xb8ec, 0xb8f0, 0xb8ea, 0xb8eb, 0xb8e9, 0xe05b, 0x9e48, 0xe454, 0xbbac, 0xbbad, 0xbbab, 0x99db, 0xe453, 0x8ff3, 0xe455, 0xe7ea, 0xe7ec, 0x8ff9, 0xbde7, 0xe7ed, 0xbde0, 0xe7e9, 0xbddf, 0xbde9, 0xbde5, 0xbde6, 0xbde2, 0xe7e8, 0xbde1, 0xe7ee, 0xe7eb, 0x95c1, 0xbde8, 0xa04e, 0xbde3, 0xbde4, 0xebb5, 0xebb7, 0xebb6, 0x99dc, 0xebb8, 0xbfe0, 0xebb4, 0xa064, 0xc1cb, 0xeeb8, 0xc1c8, 0xc1cc, 0xc1ca, 0xc1c9, 0xf0f3, 0xf0f6, 0xf0f5, 0x8ff7, 0xf0f4, 0xc2d8, 0xf348, 0xf349, 0xc3d8, 0xf34a, 0xc3d9, 0x89b0, 0xa048, 0xc4ba, 0xc4b9, 0xf652, 0x8ffb, 0x8ff6, 0xc542, 0xf653, 0xf75c, 0xc5ab, 0xc5ac, 0x9ddc, 0xf845, 0xc642, 0x99dd, 0x8be8, 0xa8aa, 0xb36a, 0xb369, 0xe05c, 0xe05d, 0xbbae, 0xebb9, 0xbdea, 0xebba, 0xeeb9, 0xa8ab, 0xd0b2, 0xad76, 0xad75, 0xd3e3, 0xb05f, 0xd3e4, 0xd7d5, 0x92c1, 0xd7d4, 0xd7d3, 0xdbee, 0xb658, 0x9fd6, 0xdbed, 0xb657, 0xdbef, 0xb656, 0xe05f, 0xe062, 0xe060, 0xe061, 0xe065, 0xe05e, 0xe066, 0xe063, 0xe064, 0xbbb0, 0xe456, 0xbbaf, 0xe7f2, 0xe7f0, 0xbdeb, 0xe7ef, 0xe7f1, 0xbdec, 0xebbb, 0xa0d2, 0xebbc, 0xc1cd, 0x9040, 0xf34c, 0xf34e, 0xf34b, 0xf34d, 0xf4d6, 0xf654, 0xf96f, 0xa8ac, 0xad77, 0xd3e5, 0xd3e7, 0xd3e6, 0xd7d8, 0xb36c, 0xd7d6, 0xb36b, 0xd7d9, 0x8ac4, 0xd7da, 0xd7d7, 0x99e0, 0xdbfb, 0xb660, 0xdbf3, 0xdbf9, 0xb65b, 0xb65e, 0xdbf2, 0xb659, 0xdbf6, 0xe06c, 0xb65d, 0xdbf1, 0x9ff0, 0xdbf7, 0xdbf4, 0xdbfa, 0xdbf0, 0xdbf8, 0xb65c, 0xb65f, 0xdbf5, 0xb65a, 0xb8f2, 0xe068, 0xb8f1, 0xe06f, 0xe06e, 0xb8f8, 0xb8f9, 0xe070, 0xb8f3, 0xe06d, 0xb8f7, 0xe072, 0xe069, 0xe06b, 0xb8f4, 0xe067, 0xe06a, 0xe071, 0xb8f5, 0xe073, 0xb8f6, 0xbbb1, 0xe45b, 0xe461, 0xe459, 0xe462, 0x9ff3, 0xe458, 0xe45d, 0xe463, 0xe460, 0xe45f, 0xe45e, 0xe457, 0xe45c, 0xe45a, 0x9dbf, 0xbdf1, 0xbdee, 0xe7fb, 0xe841, 0xe843, 0xe840, 0xe7f8, 0xe7fa, 0xe845, 0xe842, 0xe7fc, 0xe846, 0xe7f9, 0xe844, 0xbdef, 0xbdf5, 0xbdf3, 0xe7f3, 0xbdf4, 0xbdf0, 0xe7f4, 0xe7f6, 0xe7f5, 0xe7fd, 0xe7fe, 0x9ff6, 0xbdf2, 0x95c8, 0xbded, 0x9e5a, 0xe7f7, 0xebc6, 0xbfe2, 0xebbd, 0xbfe3, 0xbfe6, 0xebc2, 0xebbf, 0xbfe5, 0x99e3, 0xebc3, 0xebc4, 0xebbe, 0xebc7, 0xebc0, 0xebc5, 0xbfe4, 0xbfe1, 0xebc1, 0x8a4a, 0xeebf, 0xc1d0, 0xc1ce, 0xc1d1, 0xc1cf, 0xeebe, 0xeebb, 0xeeba, 0x9ff1, 0xeebd, 0xeebc, 0xf145, 0xc2de, 0xf0fb, 0xf0fa, 0xc2d9, 0xf141, 0xf140, 0xf0f7, 0xf143, 0xf0fc, 0xc2dd, 0xf0f9, 0xf142, 0xf0f8, 0xc2da, 0xc2dc, 0xf0fd, 0xc2db, 0xf0fe, 0x8aa7, 0xf144, 0xf352, 0xc3de, 0xf34f, 0xf353, 0x99e6, 0xc3db, 0xf351, 0xc3e0, 0x9ff7, 0xc3dd, 0x9fed, 0xf350, 0xc3df, 0xf354, 0xc3da, 0x8a5c, 0x9dae, 0xc4bc, 0xc4be, 0xf4d9, 0xc4bd, 0xf4d7, 0xc3dc, 0xf4d8, 0xc4bb, 0xc543, 0xc545, 0xf656, 0xc544, 0xf655, 0xf761, 0xc5ad, 0xf760, 0xc5ae, 0xf75e, 0xf75d, 0xf762, 0xf763, 0xf846, 0xf75f, 0xf8c6, 0xf8c3, 0xf8c4, 0xf8c5, 0xc65c, 0xf951, 0xf950, 0xf94f, 0xf970, 0x95c9, 0xf9be, 0xf9ab, 0xc66e, 0xa8ad, 0xb060, 0x9048, 0x99e8, 0xb8fa, 0x9049, 0x8cba, 0xbdf6, 0x90b1, 0xebc8, 0xc2df, 0xf355, 0x904a, 0xf9ac, 0xa8ae, 0xaaee, 0xad79, 0xad78, 0x99ea, 0xb063, 0xd3e8, 0xb061, 0xd3e9, 0xb062, 0xd7df, 0xd7db, 0x9bd1, 0xb36d, 0xd7de, 0xd7dd, 0xd7dc, 0xb36e, 0xd7e0, 0xd7e1, 0x99eb, 0x99ec, 0xdc43, 0xdc41, 0xdc45, 0xdc46, 0xdc4c, 0xdc48, 0xdc4a, 0x99ed, 0xdc42, 0xdbfc, 0xdc49, 0x99ee, 0xdc4b, 0xdc44, 0xdc47, 0xdbfd, 0xb662, 0xdc40, 0xdbfe, 0xb661, 0xb663, 0xb8fd, 0xe075, 0xe077, 0xe076, 0xe07b, 0xb8fb, 0xe078, 0xe074, 0xe079, 0xe07a, 0xb8fc, 0xb8fe, 0xe07c, 0xe467, 0xe466, 0xe464, 0xe465, 0xbbb3, 0xbbb5, 0xbbb2, 0xbbb4, 0xe84d, 0xe84e, 0xe849, 0x904c, 0xe84a, 0xbdf8, 0xbdfd, 0xbdf7, 0xbdfe, 0xbdf9, 0xe84b, 0xe84c, 0xe848, 0xbe40, 0xbdfb, 0xbdfa, 0xbdfc, 0xe847, 0x904d, 0xebca, 0xbfe8, 0x95cb, 0xebcc, 0xbfea, 0xebcf, 0xebcb, 0xebc9, 0xebce, 0xbfe9, 0xebcd, 0xbfe7, 0xc1d3, 0xc1d6, 0xeec1, 0x97e2, 0xc1d4, 0xeec0, 0xc1d2, 0xc1d5, 0xf146, 0xf147, 0xf148, 0xc2e0, 0x95cc, 0xf149, 0xc2e1, 0xc3e2, 0xf358, 0xf359, 0xf357, 0xf356, 0xf35a, 0xc3e1, 0xf4dd, 0xf4db, 0xf4dc, 0xf4de, 0xf4da, 0xf4df, 0xf658, 0x9f78, 0xf659, 0xf657, 0xc546, 0xf764, 0xc5af, 0xf765, 0xf848, 0xf847, 0x897c, 0x897d, 0x897e, 0x995d, 0xa8af, 0xb664, 0xb940, 0x9b5a, 0xbbb6, 0x9050, 0xbfec, 0x8c4f, 0xbfeb, 0xc3e3, 0xc47c, 0xc547, 0xa8b0, 0xb064, 0xb941, 0x9054, 0xf35b, 0xc6d6, 0x9aa8, 0x99ef, 0xfeeb, 0x9da3, 0x9da1, 0x9943, 0x9945, 0x9d7d, 0xcba6, 0x99f0, 0xa8b1, 0xa8b4, 0xa8b3, 0xa8b2, 0xcba5, 0x99f1, 0xcdcd, 0x99f2, 0xcdcf, 0xaaef, 0x8cbc, 0x9d60, 0xaaf1, 0xcdcc, 0xcdce, 0xaaf0, 0xcdd1, 0xcdd0, 0xcdd2, 0xa0a3, 0xd0b6, 0xd0b4, 0xad7c, 0xd0b3, 0xada3, 0xad7e, 0xad7b, 0xada4, 0xad7d, 0xada2, 0xada1, 0xd0b5, 0xad7a, 0xb06a, 0xd3eb, 0xd3f1, 0xb067, 0xb06e, 0x905b, 0xb069, 0xd3ee, 0xd3f0, 0xb06c, 0xd3ea, 0xd3ed, 0xb068, 0xb065, 0xd3ec, 0xb06b, 0xd3ef, 0xb06d, 0xb066, 0x9edb, 0xd7e3, 0xd7e6, 0xb370, 0xb37a, 0xb376, 0xd7e4, 0x9d79, 0xb37e, 0xb377, 0xb37c, 0xb372, 0xb36f, 0xb371, 0xb37d, 0xd7e5, 0xb375, 0xb378, 0xb374, 0xb379, 0xd7e7, 0xb37b, 0xb373, 0xd7e2, 0xdc4d, 0xb665, 0xdc4f, 0xb667, 0xb669, 0x99f3, 0xdc4e, 0xb666, 0xb66a, 0x9062, 0xb668, 0xb947, 0xe0a3, 0xb94f, 0xe07e, 0xb950, 0xb945, 0xe0a1, 0xb94a, 0xe0a2, 0xb943, 0xb942, 0x9f55, 0xb94d, 0xb94c, 0xb94b, 0xb949, 0xb94e, 0xe07d, 0xb944, 0xb946, 0xb948, 0x9bf9, 0xbbb8, 0xbbbb, 0xbbbf, 0xbbb9, 0xbbbe, 0xbbbc, 0xbbb7, 0x9065, 0xbbbd, 0xbbba, 0x96e0, 0xe852, 0xbe43, 0xbe41, 0xe853, 0x98be, 0xbe44, 0xbe42, 0xe851, 0xe850, 0xbff0, 0xe84f, 0xbfee, 0xbfed, 0xebd0, 0xbe45, 0xbfef, 0xebd1, 0xbff2, 0xebd2, 0xbff1, 0xc1d8, 0xeec3, 0xc1d7, 0xc1dc, 0xc1da, 0xc1db, 0xc2e3, 0xc1d9, 0xeec2, 0xebd3, 0xc2e2, 0xc2e4, 0xc3e4, 0xc3e5, 0xf4e0, 0xc5de, 0xc5dd, 0xa8b6, 0xca55, 0xb06f, 0xca52, 0xca53, 0xca51, 0xca54, 0xcbaa, 0xcba7, 0xcbac, 0xcba8, 0xa8b7, 0xa8ba, 0xcba9, 0xa8b9, 0xcbab, 0x9068, 0xa8b8, 0x906c, 0xcdd5, 0xcdd7, 0xaaf4, 0xcdd3, 0xcdd6, 0xcdd4, 0xaaf2, 0xaaf5, 0xaaf3, 0x95d8, 0xd0b8, 0xd0bc, 0xd0b9, 0xada7, 0xada8, 0x906a, 0xd0bb, 0xd0bd, 0xd0bf, 0xada5, 0xd0be, 0xada6, 0xd7ee, 0xd0ba, 0xd3f2, 0xd3fb, 0xd3f9, 0xd3f4, 0xd3f5, 0xd3fa, 0xd3fc, 0xb071, 0xd3f7, 0xd3f3, 0xb070, 0xb072, 0xd3f6, 0xd3fd, 0xd3f8, 0xb3a1, 0xd7f1, 0xd7e9, 0xd7ef, 0xd7f0, 0xb3a2, 0xd7e8, 0xd7ea, 0xd0b7, 0xd7ec, 0xd7ed, 0xd7eb, 0xb66c, 0xdc56, 0xebd4, 0xdc57, 0xdc54, 0xb3a3, 0xb66e, 0xdc53, 0xdc59, 0xdc58, 0xb66b, 0xdc5c, 0xdc52, 0xdc5b, 0xdc50, 0xdc5a, 0xdc55, 0xb66d, 0xe0aa, 0xe0a5, 0xe0ab, 0xe0a6, 0xe0a4, 0xe0a7, 0xb951, 0xe0a9, 0xe0a8, 0xb952, 0xbbc1, 0xbbc0, 0xe46e, 0xe471, 0xe469, 0xe46d, 0xbbc2, 0xe46c, 0xe46a, 0xe470, 0xe46b, 0xe468, 0xe46f, 0xe859, 0xbe48, 0xf14a, 0xe856, 0xe857, 0xe855, 0xdc51, 0xbe47, 0xe85a, 0xe854, 0xbe46, 0xbe49, 0xe858, 0xebd5, 0xbff3, 0xebd6, 0xebd7, 0xeec4, 0xc1dd, 0xf14b, 0xf14c, 0xf14d, 0xf35d, 0xf35c, 0xf4e2, 0xf4e1, 0xf65b, 0xf65c, 0xf65a, 0xf766, 0xc5b0, 0xa8bb, 0xadaa, 0xada9, 0xb075, 0xb074, 0xd440, 0xd441, 0xd3fe, 0x9fb2, 0xb073, 0xd7f5, 0xd7f6, 0xd7f2, 0xb3a4, 0xd7f3, 0x9fae, 0xd7f4, 0x9fb0, 0x89ad, 0xdc5f, 0xdc61, 0xdc5d, 0xdc60, 0xb66f, 0xdc5e, 0xb670, 0x906e, 0xdd73, 0xb955, 0xb954, 0xb953, 0xe0ac, 0xe0ad, 0x9e71, 0xe473, 0xe475, 0xbbc6, 0xbbc3, 0x9e4a, 0xbbc5, 0xbbc4, 0xe474, 0xe472, 0x9fdc, 0xe861, 0xe85e, 0xe85f, 0xbe4d, 0xe860, 0xe85b, 0xe85c, 0xbe4a, 0xbe4b, 0xe85d, 0xbe4c, 0x89ab, 0xebdb, 0x9fb8, 0xebdc, 0xebd9, 0xebda, 0xbff4, 0xebd8, 0xeec8, 0xeec5, 0xeec7, 0xc1e0, 0xeecb, 0xc1df, 0xeec9, 0xeecc, 0xeeca, 0xeec6, 0xc1de, 0xf14f, 0xf150, 0xf14e, 0x9070, 0xf152, 0xc2e5, 0xc2e6, 0xf35f, 0xc3e7, 0xf151, 0xf35e, 0xc3e6, 0xf4e5, 0xf4e6, 0xc4bf, 0xf4e4, 0x8b63, 0xf4e3, 0xf65d, 0xc548, 0x95dc, 0xf849, 0xf8c8, 0xf8c7, 0xc643, 0xc65d, 0xf8c9, 0xf971, 0x9071, 0xc66f, 0xa8bc, 0xaaf6, 0xb956, 0xc4c0, 0xa8bd, 0xadab, 0xb3a5, 0xb671, 0xc2e7, 0xaaf7, 0xd0c1, 0xd0c0, 0xd442, 0xfc5e, 0xb078, 0xb076, 0xb07a, 0xd444, 0xb079, 0xb077, 0x8949, 0xd443, 0xb3a8, 0xd7fc, 0x965b, 0xb3a7, 0xb3a9, 0xd842, 0xb3ab, 0xd7fe, 0xd840, 0xd7f7, 0xb3aa, 0xd843, 0xd7f9, 0xd7fa, 0xd7f8, 0xb3a6, 0x8c50, 0xd841, 0xd7fb, 0xd7fd, 0x94a6, 0xdc6d, 0x8fd5, 0xdc6c, 0xdc6a, 0xdc62, 0xdc71, 0xdc65, 0xdc6f, 0xdc76, 0xdc6e, 0xb679, 0x9e73, 0xb675, 0xdc63, 0xdc69, 0xb677, 0x9075, 0xdc68, 0xb678, 0xb67a, 0xdc6b, 0x99f7, 0xb672, 0xb673, 0xdc77, 0xdc75, 0xdc74, 0xdc66, 0xdc72, 0xb676, 0x8cbf, 0xb674, 0xdc73, 0xdc64, 0xdc67, 0xdc70, 0x99f9, 0x9663, 0x95b9, 0xe4ba, 0xe0b7, 0xe0b0, 0xe0c3, 0xe0cc, 0xe0b3, 0xb961, 0x94d4, 0xe0c0, 0xb957, 0xb959, 0xb965, 0xe0b1, 0xfcfa, 0xb95a, 0xb95c, 0xb966, 0xb95b, 0x9077, 0x90ab, 0xb964, 0xe0b9, 0xe0ae, 0xb962, 0xe0b8, 0xb95e, 0xe0ca, 0xb963, 0xe0c8, 0xe0bc, 0xe0c6, 0xb960, 0xe0af, 0xe0c9, 0xe0c4, 0x9d4d, 0xe0cb, 0xb958, 0x99fa, 0xb967, 0xb95d, 0x92e3, 0xe0b5, 0x97bb, 0xe0bd, 0xe0c1, 0x9078, 0xe0c5, 0xb95f, 0xe0b4, 0xe0b2, 0xe0be, 0x99fb, 0xe0bb, 0xe0ba, 0x97e0, 0xe0bf, 0xe0c2, 0xe0c7, 0xe478, 0x96dc, 0xbbc7, 0xe4a4, 0xe47a, 0xbbcc, 0xbbd0, 0xe4ad, 0xe4b5, 0xe4a6, 0xbbc8, 0x9ca8, 0xe4aa, 0xe0b6, 0x9772, 0xbbc9, 0xe4b1, 0xe4b6, 0xe4ae, 0x9440, 0xe4b0, 0xe4b9, 0xe4b2, 0xe47e, 0xe4a9, 0x92f2, 0xbbd1, 0xbbcd, 0xe47c, 0xe4ab, 0xbbcb, 0xe4a5, 0xbbca, 0xe4b3, 0xe4a2, 0xe479, 0xbbce, 0xe4b8, 0xe47b, 0xe4af, 0xe4ac, 0xe4a7, 0xe477, 0xe476, 0xe4a1, 0xe4b4, 0xbbcf, 0xe4b7, 0xe47d, 0xe4a3, 0xbe52, 0x99fd, 0x99fc, 0xbe5a, 0xbe55, 0xe8a4, 0xe8a1, 0xe867, 0xbe50, 0xf9d7, 0x964a, 0xbe4f, 0xbe56, 0x96d8, 0x99fe, 0xe865, 0xbe54, 0xe871, 0xe863, 0xe864, 0xbe4e, 0xe8a3, 0xbe58, 0xe874, 0xe879, 0xe873, 0xebee, 0xe86f, 0xe877, 0xe875, 0xe868, 0xe862, 0xe87d, 0xbe57, 0xe87e, 0x904b, 0xe878, 0xe86d, 0xe86b, 0xe866, 0xfa41, 0xe86e, 0xe87b, 0xe86a, 0xe87a, 0xe8a2, 0x9a40, 0xbe53, 0x975b, 0xe876, 0xe87c, 0xe872, 0xe86c, 0xbe51, 0x9a41, 0x91dd, 0xe4a8, 0xe870, 0xbe59, 0xe869, 0x93fc, 0x9a42, 0x9a43, 0x9659, 0xebf4, 0xbff7, 0xebf3, 0xebf0, 0xec44, 0xbffb, 0x9a44, 0xec41, 0xebf8, 0xec43, 0xebe9, 0xebf6, 0x9051, 0xbffd, 0xebe1, 0x94bf, 0xebdf, 0xec42, 0xec40, 0xebfe, 0xebed, 0xebec, 0xebe2, 0xc040, 0xebe8, 0xebf2, 0xebfd, 0xc043, 0xec45, 0xc1e8, 0xc045, 0xbffe, 0xebe6, 0xebef, 0xebde, 0xebe0, 0xbff5, 0xc042, 0xbffa, 0xebe7, 0xebf7, 0xebf1, 0xc041, 0xebdd, 0xc1e3, 0xebf9, 0xebfc, 0xbffc, 0x90a2, 0xebeb, 0xc044, 0xbff9, 0x9cab, 0x9776, 0xbff8, 0xebf5, 0xebfb, 0xbff6, 0xebe4, 0xebfa, 0xebe5, 0xfc55, 0xfe45, 0x94a8, 0x9a45, 0xfa4b, 0x9de1, 0xebea, 0xeed2, 0x96d9, 0xeed7, 0xc1e5, 0xc1e7, 0xeedd, 0xc1e1, 0xeeec, 0xeee3, 0xeed8, 0xeed9, 0xeee2, 0xc1ee, 0xeee1, 0xeed1, 0xeee0, 0xeed4, 0xeeed, 0xc1ed, 0xc1eb, 0xeed5, 0xeee8, 0x9774, 0xeeda, 0xeee7, 0xfdf5, 0xeee9, 0xeed0, 0xc1e6, 0x92e5, 0xeeea, 0x9645, 0x91da, 0xeede, 0x90a3, 0xc1ea, 0xeedb, 0xa05f, 0xc1ec, 0xeee4, 0x90af, 0x97bf, 0xc1e4, 0xeed6, 0xeee5, 0x914c, 0xeedf, 0xebe3, 0xeee6, 0xeed3, 0x967a, 0xc1e9, 0xeeeb, 0x91de, 0xc1e2, 0xeece, 0x9a46, 0xfeb0, 0x9779, 0x946c, 0xf160, 0xf159, 0xc2e9, 0xf154, 0xf163, 0xf15b, 0xeedc, 0x9858, 0xf165, 0xf155, 0xc2e8, 0xf15f, 0xc2ea, 0xc2f2, 0xc2f0, 0xf161, 0xc2f1, 0xf157, 0x9266, 0xf158, 0xf15d, 0xf162, 0x93fb, 0xeecd, 0xc2eb, 0xf16a, 0xf167, 0xf16b, 0xf15e, 0xf15a, 0xf168, 0xf36a, 0xf15c, 0xc2ee, 0x9a47, 0xc2ed, 0xeecf, 0xc2ef, 0xf164, 0xf166, 0xc2ec, 0xf169, 0xf153, 0xf156, 0x9749, 0x9748, 0x934a, 0x9ce2, 0xf373, 0xf363, 0xc3eb, 0xf371, 0x9264, 0xf361, 0xc3ec, 0xf36c, 0x91df, 0xf368, 0xc3f1, 0xf372, 0xf362, 0xf365, 0xc3e9, 0xf374, 0xfb79, 0xf36d, 0xf370, 0xc3ef, 0xc3f4, 0xc3f2, 0xf369, 0xf364, 0x96d7, 0xc3ed, 0xc3ee, 0xf360, 0xc3ea, 0x9343, 0xc3e8, 0xc3f0, 0xf36f, 0xc3f3, 0xf36b, 0xf375, 0xc3f5, 0xf367, 0xf36e, 0xfdcb, 0xfe7a, 0x91db, 0x8c6a, 0xf4f3, 0xf542, 0xf4f5, 0xf4fc, 0xf366, 0xf4fa, 0xf4e9, 0xf540, 0xc4c3, 0xf4ed, 0xf4fe, 0xf4f4, 0x97af, 0xc4c2, 0x95dd, 0xf544, 0xf4f6, 0x9348, 0xf4fb, 0xf4fd, 0xf4e7, 0xf541, 0xf4f2, 0xf4f7, 0xf4eb, 0xf4ef, 0xf543, 0xf4f9, 0xf4e8, 0xf4ec, 0xf4ee, 0xf4f8, 0x9a4b, 0xc4c1, 0xf4f1, 0xfc45, 0x9a4d, 0xf4ea, 0x91bc, 0x90e2, 0x90b4, 0x95e1, 0xf4f0, 0xf661, 0xf666, 0xc54f, 0xf668, 0x9a4e, 0xc549, 0xf664, 0xf66a, 0xc54e, 0xc54a, 0xc54b, 0xf660, 0xf667, 0xc54d, 0xf665, 0xc54c, 0xf65f, 0xf663, 0xf662, 0x9a4f, 0xf65e, 0xf669, 0xfe40, 0xfe43, 0xc5b1, 0xf76d, 0xf770, 0xf76c, 0xf76e, 0xf76f, 0xf769, 0xf76a, 0xf767, 0x96dd, 0xf76b, 0xf768, 0xc5b2, 0xc5b3, 0x9a51, 0xf84b, 0xf84d, 0x96a7, 0x90b0, 0xf84c, 0xf84e, 0xc5e0, 0xf84a, 0xc5df, 0xc5e1, 0x9c4e, 0x9443, 0xf8cb, 0xf8cc, 0xc644, 0xf8ca, 0x8eba, 0xf953, 0xf952, 0xf954, 0xc65f, 0xf955, 0xc65e, 0xf956, 0xf972, 0xf975, 0xf974, 0xc668, 0xf973, 0x9a52, 0xfcc1, 0xc672, 0xc670, 0xc671, 0xc677, 0xf9c0, 0xf9c1, 0xf9bf, 0xf9c9, 0x8be9, 0x9caf, 0x8bfd, 0x9abc, 0x9ab8, 0x9aae, 0x9aa7, 0x9a53, 0x9d74, 0xaaf8, 0x8bea, 0xd844, 0xdc78, 0xe8a5, 0xf376, 0x8beb, 0xaaf9, 0xadac, 0xb07b, 0x90b2, 0xd845, 0xd846, 0xb3ac, 0xb67d, 0xdc7a, 0xdc79, 0xb6a3, 0xb67c, 0xdc7b, 0xb67e, 0xb6a2, 0xb6a1, 0xb67b, 0x95e9, 0x95e8, 0xb968, 0x95e6, 0xe0d0, 0xe0ce, 0xe0cf, 0xe0cd, 0x90b5, 0xbbd2, 0x9a54, 0xbbd5, 0xbbd7, 0xbbd6, 0x90b3, 0x95e7, 0xbbd3, 0xbbd4, 0x8b50, 0xe8a7, 0xe8a6, 0xbe5b, 0xe8a8, 0xe8a9, 0xbe5c, 0xec4d, 0xec4b, 0xeef3, 0xec49, 0xec4a, 0xc046, 0xec46, 0xec4e, 0xec48, 0xec4c, 0xeeef, 0xeef1, 0xeef2, 0xc1f3, 0xeeee, 0xc1f2, 0xeef0, 0xc1ef, 0xc1f0, 0xc1f1, 0xec47, 0xc2f5, 0xf16e, 0xf16c, 0xf16d, 0xc2f3, 0xc2f6, 0xc2f4, 0xf377, 0xf378, 0xc3f6, 0xf545, 0xf547, 0xf546, 0xc4c4, 0xc550, 0xf66d, 0xf66c, 0xf66b, 0x8bec, 0x9a56, 0xaafa, 0x8bfb, 0xc9aa, 0xca58, 0xa6e9, 0xca56, 0xca59, 0xca57, 0xcbae, 0xa8c1, 0xa8c2, 0xcbb0, 0xa8bf, 0xcbaf, 0xcbad, 0xa8c0, 0xa8be, 0x9a57, 0xa0aa, 0xcdd8, 0xcddb, 0xaafd, 0xcdda, 0xcdd9, 0xaafc, 0xaafb, 0x9fa6, 0xab40, 0xcddc, 0xaafe, 0x99cc, 0xd0c6, 0xadae, 0xadaf, 0xadb0, 0xd0c7, 0xd0c3, 0xadad, 0xd0c4, 0xd0c5, 0xd0c2, 0x9c59, 0xb0a4, 0xb0a1, 0xd445, 0xb0a2, 0xb0a5, 0xd446, 0xb07e, 0xb07c, 0xb07d, 0xb0a3, 0x99b5, 0xb3ad, 0xd849, 0xb3b5, 0xd848, 0xd84b, 0xb3b1, 0xd84a, 0xb6ab, 0xb3af, 0xb3b2, 0xb3ae, 0xb3b3, 0xb3b4, 0xb3b0, 0x90be, 0xd847, 0xb6a7, 0xdc7d, 0xdca3, 0x9faf, 0xdca2, 0xb6ac, 0xb6a8, 0xb6a9, 0xdc7c, 0xdc7e, 0xdca1, 0xb6a4, 0xb6a6, 0xb6aa, 0xb6a5, 0x95f2, 0xe0d3, 0xe0d1, 0xe0d2, 0xb96a, 0xb96b, 0x90bf, 0xe0d4, 0xb969, 0xbbd8, 0xbbda, 0xbbd9, 0xe4bb, 0xe4bc, 0xe8ab, 0x90c1, 0xe8aa, 0xfee4, 0xc047, 0xc048, 0xec4f, 0xc049, 0xeef6, 0xeef4, 0xeef5, 0xc1f4, 0xf16f, 0xc3f7, 0x90c4, 0xc1f5, 0xab41, 0xb0a6, 0xd447, 0x90c7, 0xd84c, 0xb3b6, 0xb6ad, 0xdca4, 0xdca6, 0xb6af, 0xb6ae, 0xb6b0, 0xb6b1, 0xdca5, 0xb96e, 0xb96f, 0xb96d, 0xbbdb, 0xb96c, 0xe0d5, 0xbbdc, 0xe8ac, 0xec50, 0xc04a, 0xc1f6, 0xf170, 0xf174, 0xc2f9, 0xf171, 0xc2fa, 0xc2f8, 0xf175, 0xc2fb, 0xf173, 0xf379, 0xc2f7, 0xc3f8, 0xf8cd, 0xab42, 0xb3b8, 0xb3b7, 0xb6b2, 0xdca8, 0xdca7, 0xb6b3, 0x92e4, 0xe0d9, 0xb973, 0xb970, 0xe0d8, 0xb972, 0xe0d6, 0xb971, 0xe0d7, 0xe4bd, 0xbbdd, 0xe8af, 0x9f52, 0xbe5d, 0xe8ad, 0xbe5e, 0xbe5f, 0xe8ae, 0xbe60, 0xec51, 0xc04e, 0xc04b, 0xc050, 0xec53, 0xc04c, 0xec52, 0xc04f, 0xc04d, 0xeef9, 0xeefb, 0x90db, 0xc1f7, 0xeefa, 0xc1f8, 0xeef8, 0xeef7, 0xa066, 0xf177, 0xf176, 0xc2fc, 0xf178, 0xf37e, 0xc3fa, 0xf37d, 0xf37a, 0xc3f9, 0xf37b, 0xf37c, 0xf548, 0xf549, 0xc4c5, 0x90d2, 0xc553, 0xf66e, 0x90d4, 0xc551, 0xc552, 0xf66f, 0xc5b4, 0xc5b5, 0xf771, 0x9a5b, 0x95fd, 0xc645, 0xf8cf, 0xc647, 0xf8ce, 0xf8d0, 0xc646, 0xf957, 0xf9ad, 0x8bc4, 0xab43, 0x8c66, 0xb974, 0x90de, 0xe4be, 0xe8b0, 0xc051, 0xc052, 0x9ce4, 0xab44, 0x90e1, 0xbe61, 0xc3fb, 0xadb1, 0xc053, 0xc5e2, 0xadb2, 0xd84d, 0xdca9, 0x9e46, 0xdcab, 0xdcaa, 0x9651, 0xe0dd, 0xe0da, 0xb975, 0xb976, 0xe0db, 0xe0dc, 0xe4c0, 0xe4c5, 0xbbde, 0xe4bf, 0xe4c1, 0xe4c8, 0xe4c3, 0xe4c7, 0xe4c4, 0xe4c2, 0xe4c6, 0xbbdf, 0xfb58, 0xe8b3, 0x90e6, 0xe8b1, 0xbe63, 0xbe62, 0xe8b2, 0xbe64, 0xec56, 0xec55, 0xc054, 0xec54, 0xeefc, 0x9650, 0xeefe, 0xef41, 0xef40, 0x90e7, 0xc1f9, 0xeefd, 0xf1a1, 0xc2fd, 0xf17d, 0xf1a2, 0xc2fe, 0xf17b, 0xf17e, 0xf17c, 0xf179, 0xc340, 0xf17a, 0x90e8, 0x9a5d, 0xf3a1, 0x9f7a, 0xf3a3, 0xf3a2, 0x9b5c, 0xf54a, 0x9f7c, 0xf54b, 0xfc52, 0x90e9, 0xf670, 0x90ea, 0xc5b7, 0x9a5e, 0xc5b6, 0xf84f, 0xf850, 0xc648, 0xf8d1, 0x9f76, 0xc669, 0xadb3, 0xb6b4, 0xe4ca, 0xe4c9, 0xe8b5, 0xe8b4, 0x90eb, 0xc1fa, 0xef43, 0xef42, 0xf1a5, 0xf1a3, 0xf1a6, 0xf1a4, 0xc3fc, 0xf3a4, 0xf3a5, 0xf3a6, 0x90ec, 0xf671, 0xf772, 0xf8d2, 0x8bee, 0xadb4, 0x90ee, 0xec57, 0xef44, 0x91c6, 0xadb5, 0x90f2, 0xbbe0, 0xec58, 0xc341, 0xf1a7, 0xc3fd, 0xf54c, 0xf54d, 0xc554, 0xf851, 0xadb6, 0xb3bb, 0xb3bc, 0xd84e, 0xb6b5, 0xb6b6, 0xdcac, 0xb6b7, 0xb97a, 0xb97c, 0xe0df, 0xe0e0, 0xe0de, 0xb977, 0xb978, 0xb97b, 0xb979, 0xfcbc, 0x8a74, 0xe4cb, 0xbbe1, 0xbbe2, 0xe8bc, 0xbe67, 0xe8b7, 0xe8b6, 0x9657, 0xe8bb, 0xbe65, 0x9cef, 0xc05b, 0xe8b8, 0xe8bd, 0xe8ba, 0xe8b9, 0xbe66, 0xc059, 0x9fdf, 0xec5a, 0xc055, 0xec5b, 0x90f7, 0x90f6, 0xec59, 0xc058, 0xc056, 0xc05a, 0xc057, 0xef45, 0xef4a, 0xef46, 0xef49, 0xc1fb, 0x9b5e, 0xedd4, 0xef48, 0xef47, 0x90f8, 0xc344, 0xc342, 0xc345, 0xc343, 0xf1a8, 0xf1a9, 0xf1aa, 0xc346, 0xf3aa, 0xc440, 0xf3a8, 0xc441, 0xf3a7, 0xf3a9, 0xc3fe, 0xf551, 0xf54e, 0xf54f, 0xf550, 0xf672, 0xc556, 0x90f9, 0xc555, 0x8cc9, 0xf774, 0xf773, 0xc5b8, 0xfa6a, 0xc5e3, 0xc649, 0xc660, 0xf958, 0xf9ae, 0xf9af, 0x8bef, 0xadb7, 0xdcad, 0xe0e1, 0xe4cc, 0xe4cd, 0xbbe3, 0xbbe4, 0xe8be, 0xbe68, 0x9fe0, 0xc1fc, 0x9142, 0xf1ab, 0x9a62, 0xc347, 0xf3ad, 0xc442, 0xf3ac, 0xf3ae, 0xf3ab, 0xf675, 0xf552, 0xf553, 0x9569, 0xc4c6, 0xf674, 0x9144, 0x9143, 0xf673, 0x9141, 0xf775, 0xf9b0, 0x8bf0, 0xadb8, 0x9660, 0x8bf1, 0xadb9, 0x99f6, 0x9149, 0xb0a7, 0xd448, 0xd84f, 0x914a, 0xb6b8, 0xb6bb, 0xb6b9, 0xdcae, 0x914b, 0xb6bd, 0xb6ba, 0x9a64, 0xb6bc, 0xb97e, 0x8abf, 0xe0e2, 0xe0e3, 0xe8c0, 0xb97d, 0xb9a1, 0xb9a2, 0xe4cf, 0xe4ce, 0xbbe5, 0xbbe6, 0xe4d0, 0xe8bf, 0xbbe8, 0xbe69, 0xbbe7, 0x9a66, 0xc05c, 0xe8c1, 0xbe6b, 0xbe6a, 0xe8c2, 0xe8c5, 0xe8c3, 0xe8c4, 0xbe6c, 0x9a67, 0xc061, 0xc05f, 0x9a69, 0xc05e, 0xec5d, 0xc060, 0xec5c, 0xef4b, 0xec5e, 0xc05d, 0xec5f, 0xef4e, 0xef4c, 0xef4d, 0xef52, 0xc34b, 0xef51, 0xef54, 0xef53, 0xef50, 0xef4f, 0xc1fd, 0x9a6a, 0x9652, 0x914d, 0xf1ae, 0x9666, 0xf1ad, 0xc34a, 0xc348, 0xc349, 0x9f7b, 0xf1ac, 0x9a6b, 0xf3b1, 0xc443, 0xf3b0, 0xf3af, 0xc444, 0xa06c, 0xf558, 0xf557, 0x9667, 0xf555, 0xf554, 0xc4c8, 0xc4c7, 0xf559, 0xf776, 0xc5b9, 0xf677, 0xc557, 0xf676, 0xf556, 0xf777, 0xc5e4, 0x9a6c, 0xc661, 0xf959, 0xf9b1, 0x9a6d, 0x8bf2, 0xadba, 0xd850, 0xef55, 0xadbb, 0x966a, 0xe4d2, 0xe4d1, 0xec60, 0xef57, 0xef56, 0xfcea, 0xc34c, 0xf3b2, 0xf3b3, 0xc4c9, 0x966c, 0xf9b2, 0xb0a8, 0xb6bf, 0xb6be, 0xe0e4, 0xe0e6, 0xb9a4, 0xe0e5, 0xb9a3, 0xb9a5, 0xe0e7, 0x91c4, 0xe4d4, 0xe4d6, 0xe4d5, 0x9677, 0xe4d8, 0xbbe9, 0xe4d7, 0xe4d3, 0x99f4, 0x9a6f, 0xe4d9, 0xe8cc, 0xe8cf, 0xe8d1, 0xe8c7, 0xe8cb, 0xe8c8, 0xbe6e, 0xbe71, 0xbe73, 0xe8c9, 0xe8ca, 0xbe72, 0xe8cd, 0xe8d0, 0xe8ce, 0xbe74, 0x9fab, 0xbe70, 0xe8c6, 0xbe6d, 0xbe6f, 0x8cbe, 0x8ec1, 0xc063, 0xec66, 0xec64, 0xec63, 0x9555, 0xec69, 0xec68, 0xec67, 0xec62, 0xc062, 0xec61, 0xec65, 0xc064, 0xef5a, 0x9152, 0xef5e, 0xef5b, 0xef5d, 0xef5c, 0xef59, 0xef5f, 0xef62, 0xef60, 0xef61, 0xc240, 0xc1fe, 0xef58, 0xef63, 0xf1b3, 0xf1b6, 0xf1b8, 0xf1b7, 0xf1b1, 0xf1b5, 0xf1b0, 0x9153, 0xf1b2, 0xc34d, 0xf1af, 0x9155, 0xf1b4, 0xf3c0, 0xf3b5, 0xc445, 0xc446, 0xf3b4, 0xf3b9, 0xf3bf, 0xf3b7, 0xf3be, 0x955d, 0xf3bb, 0x9671, 0xf3ba, 0xf3bd, 0xf3b8, 0xf3b6, 0x9c6d, 0xf3bc, 0xf560, 0xf55e, 0xc4ca, 0xf55d, 0xf563, 0xf561, 0x9673, 0xc4cb, 0xf55c, 0xf55a, 0xf55b, 0xc4cd, 0xf55f, 0xc4cc, 0xf562, 0xf678, 0xf67e, 0x9154, 0x9a71, 0xf679, 0xc55b, 0xf6a1, 0xc55a, 0xf67d, 0xf67c, 0xc559, 0xf67b, 0xc558, 0xf67a, 0xf77d, 0xf7a1, 0xf77e, 0xf77b, 0xc5bb, 0xf778, 0xf77c, 0xf7a3, 0xf7a2, 0xf779, 0xf77a, 0xc5ba, 0xf852, 0xc5e7, 0x9156, 0xf853, 0xc5e5, 0xc5e6, 0x966d, 0xf8d3, 0xc64a, 0xf976, 0xc66a, 0x9557, 0xf9b3, 0xc66b, 0xf9b4, 0xf9b5, 0xf9c3, 0xf9c2, 0xc67a, 0xf9cd, 0x89c6, 0x89c7, 0xb0a9, 0xe0e9, 0xe0e8, 0xbbea, 0xbbeb, 0xe4da, 0x8a6a, 0xe8d2, 0xec6c, 0x8b57, 0xbe75, 0xc065, 0xec6a, 0x9fe1, 0xec6d, 0xc066, 0x9b5f, 0xef64, 0xec6b, 0xf1b9, 0xc34e, 0xf3c1, 0xf566, 0xf564, 0xf565, 0xf6a2, 0xc55c, 0xf7a4, 0xc5ea, 0xc5bc, 0xc5e8, 0xc5e9, 0xf8d4, 0xc662, 0xa05d, 0xb0aa, 0xf1ba, 0xd449, 0x915b, 0xb9a6, 0x915c, 0xe4db, 0xbbec, 0xe4dc, 0xe8d4, 0xe8d3, 0xc068, 0xbe76, 0xbe77, 0xe8d7, 0xe8d6, 0xe8d5, 0x915e, 0xec6e, 0xec71, 0xec70, 0xec6f, 0xc067, 0xef68, 0xef66, 0xef65, 0x9f5c, 0xef67, 0x9f57, 0xc34f, 0xf1bc, 0xf1bd, 0xc350, 0xf1bb, 0x9f65, 0xf3c3, 0xf3c2, 0xf3c5, 0xc447, 0xf3c4, 0x9a72, 0xf567, 0xf569, 0xf568, 0x9160, 0xf6a3, 0xf6a6, 0xf6a4, 0xf6a5, 0xf7a5, 0xc5bd, 0xf854, 0xf855, 0xf856, 0xc64b, 0xc663, 0xf9b6, 0xb0ab, 0xbe78, 0xc069, 0xf1be, 0x9f5e, 0xf7a6, 0x9161, 0xf9c4, 0xd44a, 0xc67b, 0xb0ac, 0xec72, 0x9164, 0xf1bf, 0xf3c6, 0x9f41, 0xf6a7, 0xf7a7, 0xb0ad, 0xe4dd, 0xe4de, 0x9169, 0xbbed, 0xbbee, 0xe8d9, 0xbe7a, 0xbe79, 0xe8d8, 0xef69, 0xf1c0, 0xf1c2, 0xf1c1, 0xc353, 0xc352, 0xc351, 0x9168, 0xc55e, 0xf6a8, 0xc55d, 0xf7a9, 0xf7a8, 0xc64c, 0xf8d5, 0xb3bd, 0xe0ea, 0xe4e1, 0xe4df, 0xe4e0, 0xe8e2, 0xe8dd, 0xe8da, 0xe8e1, 0x9a74, 0xe8e3, 0xbe7c, 0xe8e0, 0xe8dc, 0xe8db, 0xe8df, 0xe8de, 0xbe7b, 0xec7d, 0xec78, 0xec76, 0xeca1, 0xec77, 0x96b2, 0xec73, 0x9a75, 0xec79, 0xfda5, 0xec74, 0xef72, 0xec75, 0xeca2, 0x9ee9, 0x8bba, 0x916d, 0xa060, 0xec7c, 0xc06a, 0xec7b, 0xec7a, 0xec7e, 0x9fde, 0xef6a, 0xef6d, 0x9fc3, 0xef6c, 0x96b5, 0xef74, 0xef6f, 0xef73, 0xef71, 0xef70, 0xef6e, 0xef6b, 0xc243, 0xc242, 0xc244, 0xc241, 0xef75, 0xa067, 0xf1c8, 0xf1cb, 0xf1c9, 0xf1cd, 0xf1ce, 0xf1c6, 0xc358, 0xf1c7, 0xf1c5, 0xf1cc, 0xf1c4, 0xf1c3, 0xc357, 0xc355, 0xc354, 0x96b3, 0xf1ca, 0xf3cf, 0xf3d5, 0xc44a, 0xf3d0, 0xf3d3, 0xf3d7, 0xc44b, 0xf3d2, 0x9a76, 0xf3ca, 0xf3c9, 0xf3d6, 0xf3cd, 0xf3cb, 0xf3d4, 0xf3cc, 0xc449, 0xc448, 0x95d5, 0xf3c7, 0xf3c8, 0xf3d1, 0x9eca, 0xf3ce, 0x9a77, 0x9a78, 0xf56c, 0xf56f, 0xc356, 0x9170, 0x916f, 0xf56d, 0xf573, 0xf571, 0xf56b, 0xf576, 0x9fa3, 0xf56a, 0x9171, 0xc4cf, 0xf572, 0x96b1, 0xf56e, 0xc4ce, 0xf575, 0x9f63, 0xf574, 0x9f67, 0xf6ab, 0xf6aa, 0x8bb9, 0x9a7a, 0xf6b1, 0xf6ad, 0xf6b0, 0xc560, 0x8b56, 0xf6ae, 0xf6af, 0xf6a9, 0xf6ac, 0xc55f, 0x9ada, 0xc5bf, 0xf7b4, 0xf7af, 0xf7b3, 0x96b0, 0xf7b6, 0xf7b2, 0xf7ae, 0x9a7e, 0xc5c1, 0xf7b1, 0xf7b5, 0xc5c0, 0xf7ac, 0xf570, 0xf7b0, 0xf7ad, 0x9dde, 0xf7aa, 0xf7ab, 0xc5be, 0xf85a, 0xf85c, 0xf85f, 0xf85b, 0xf860, 0x96ad, 0xf859, 0xf857, 0x96ae, 0xc5eb, 0xf85d, 0xc5ed, 0xc5ec, 0xf858, 0xf85e, 0x9ea1, 0xf8da, 0xc64d, 0xf8db, 0xf8d9, 0xf8d6, 0xf8d8, 0xf8d7, 0xf95a, 0xf95c, 0xf95b, 0xf979, 0x9e50, 0xf978, 0xf977, 0xf97a, 0xc673, 0xc674, 0xf9ca, 0xf9ce, 0x96af, 0x8bf4, 0xb3be, 0xdcaf, 0xe0ed, 0xb9a7, 0xe0eb, 0xe0ec, 0xe4e2, 0xe4e3, 0xbbf1, 0xbbef, 0xe4e4, 0xbbf0, 0xe8e8, 0xe8eb, 0xe8e5, 0xe8ec, 0xe8e4, 0xe8e6, 0xe8e7, 0xe8ea, 0x9fa4, 0xbea1, 0xe8ef, 0xe8ee, 0xbe7d, 0xe8e9, 0xe8ed, 0xbe7e, 0x96bd, 0xecac, 0xc06f, 0xeca7, 0xc06b, 0x96f4, 0xeca4, 0xecaa, 0xecad, 0xc070, 0xeca9, 0xeca6, 0xecae, 0xeca5, 0x96b8, 0xecab, 0xc06c, 0xeca3, 0xc06d, 0xc06e, 0xeca8, 0xefa9, 0xef7a, 0xef7b, 0xef7e, 0xef7c, 0xef76, 0xfaa1, 0xef79, 0xefa5, 0xef7d, 0x91a7, 0xc245, 0xefa7, 0xefa4, 0xc246, 0xefa6, 0xef77, 0xefa2, 0xefa3, 0xa05e, 0xefa1, 0x9a7d, 0xf1d2, 0xf1d4, 0xf1d7, 0x8948, 0xf1d1, 0x9eb1, 0xc359, 0xf1d9, 0xf1d0, 0xf1da, 0xf1d6, 0xf1d8, 0xf1dc, 0xf1d5, 0xf1dd, 0xf1d3, 0xf1cf, 0xc35a, 0x9ddb, 0xf1db, 0xc35b, 0xc44d, 0xef78, 0xf3f1, 0xf3e8, 0xc44f, 0xf3e4, 0xc450, 0x95bf, 0x8a73, 0xf3ed, 0xf3e7, 0xf3dd, 0xc44e, 0xf3ea, 0xf3e5, 0xf3e6, 0xf3d8, 0xf3df, 0xf3ee, 0xf3eb, 0x9efe, 0xf3e3, 0x917a, 0xf3ef, 0xf3de, 0xf3d9, 0xf3ec, 0x917b, 0xf3db, 0xf3e9, 0xf3e0, 0xf3f0, 0xf3dc, 0xc44c, 0xf3da, 0xf3e1, 0xf3e2, 0xf57d, 0xf57b, 0x9aa3, 0xf5a2, 0xf5ae, 0xf5a5, 0xf57c, 0xf578, 0xf5a7, 0xf57e, 0xf5a3, 0xf57a, 0xf5aa, 0xf577, 0xf5a1, 0xf5a6, 0xf5a8, 0xf5ab, 0xf579, 0x96c2, 0xf5af, 0xf5b0, 0xf5a9, 0xf5ad, 0xf5a4, 0x9f77, 0xf6c1, 0xf6c4, 0xc561, 0xf6c3, 0xf6c8, 0xf6c6, 0xc562, 0xf6bd, 0xf6b3, 0xf6b2, 0xc564, 0xf6bf, 0xf6c0, 0xf6bc, 0xf6b4, 0x9aa4, 0xf6b9, 0xf5ac, 0x9aa5, 0xf6b5, 0xc563, 0xf6bb, 0x91a1, 0xf6ba, 0xf6b6, 0xf6c2, 0x89b8, 0xf6b7, 0xf7bb, 0xf6c5, 0xf6c7, 0xf6be, 0xf6b8, 0xf7bc, 0xf7be, 0xf7b8, 0xc5c2, 0x9173, 0xf7c5, 0xf7c3, 0xc5c3, 0xf7c2, 0xf7c1, 0xf7ba, 0xf7b7, 0xf7bd, 0xf7c6, 0xf7b9, 0xf7bf, 0xf869, 0xf86e, 0xf864, 0xf867, 0xc5ee, 0xf86b, 0xf872, 0xf7c0, 0xf865, 0xf86f, 0xf873, 0xf86a, 0xf863, 0xf86d, 0xf86c, 0xf871, 0xf870, 0xf7c4, 0xf868, 0xf862, 0xf866, 0xc64e, 0xc64f, 0xf861, 0x9aa6, 0xf8e6, 0xf8dd, 0xf8e5, 0xf8e2, 0xf8e3, 0xf8dc, 0xf8df, 0xf8e7, 0xf8e1, 0xf8e0, 0xf8de, 0xf8e4, 0x89bd, 0xf95d, 0x89b9, 0xf95e, 0x917d, 0xf960, 0xf95f, 0xf962, 0xf961, 0xf97c, 0xf97b, 0xf9b7, 0xf9b8, 0x96bb, 0xf9c5, 0xc678, 0xc67c, 0x9ff2, 0xf9cf, 0xc67d, 0x8bf5, 0xb3bf, 0xc4d0, 0xf6c9, 0x9aa9, 0xc650, 0xc651, 0xb3c0, 0xe0ee, 0x9f54, 0xb9a8, 0xe8f0, 0x9fe3, 0x9eed, 0xecb0, 0xecb1, 0xecaf, 0xefab, 0xefaa, 0xc247, 0xf1df, 0xefac, 0xf1de, 0x91aa, 0xf3f3, 0xc451, 0xc453, 0xf3f2, 0x91ab, 0xa070, 0xc452, 0x9f6d, 0xf5b1, 0xf5b3, 0xf5b2, 0xf6ca, 0xc565, 0x91ac, 0xc5ef, 0xf8e8, 0xf963, 0x91ad, 0xf9d2, 0xb3c1, 0xa0fd, 0xe4e5, 0x9fe2, 0xbea2, 0x91af, 0x9e41, 0x9aaa, 0xecb3, 0xecb2, 0x91b0, 0xefad, 0x9aab, 0xc454, 0xc4d1, 0xf7c7, 0xf9cb, 0xb3c2, 0xbbf2, 0x9aac, 0xbea3, 0x9a4a, 0xf3f4, 0x91b2, 0xf874, 0xb6c0, 0x8bf6, 0x9aad, 0x89b6, 0xefae, 0xc664, 0xb6c1, 0xbea4, 0xc248, 0xf875, 0xb6c2, 0xe8f1, 0xc072, 0xecb4, 0xecb5, 0xc071, 0xefaf, 0xc24c, 0xc24a, 0xc24b, 0xc249, 0xf1e0, 0xc35c, 0x9aaf, 0xf5b5, 0xf5b4, 0xf5b7, 0xf5b6, 0xc4d2, 0xf6cb, 0xf6cd, 0xf6cc, 0xc566, 0xf7c8, 0x9ab0, 0xf876, 0xf877, 0xc5f0, 0xf964, 0xf97d, 0xc675, 0x9ab1, 0xdcb0, 0xecb6, 0xefb0, 0xf3f5, 0xe0ef, 0x9aa1, 0xefb1, 0xf1e2, 0xf1e1, 0x91b9, 0xf878, 0xc652, 0x91ba, 0xf965, 0xf97e, 0xb9a9, 0xe8f2, 0xe8f3, 0xecb7, 0xb9aa, 0xc35d, 0xf1e3, 0x91be, 0xf6cf, 0xc567, 0xf6d0, 0xf6ce, 0xf879, 0xf8e9, 0xb9ab, 0xefb4, 0xefb3, 0xefb2, 0xf1e4, 0xa041, 0x8bb7, 0xf1e8, 0xf1e7, 0xf1e6, 0xf1e5, 0xc35e, 0xf3f6, 0xf5b9, 0xc4d3, 0xf5b8, 0xf6d1, 0xf7cb, 0xf7ca, 0xc5c4, 0xf7c9, 0xf87c, 0xf87b, 0xf87a, 0x91c0, 0xbbf3, 0xecb8, 0xc24d, 0xf3f7, 0xf3f8, 0xf7cc, 0xf87d, 0x9ab3, 0x91c3, 0xf8ea, 0xf966, 0xf9b9, 0xf9d4, 0xbbf4, 0xc24e, 0xf1e9, 0xf3f9, 0xf6d2, 0xf87e, 0xa0fc, 0xbea6, 0x9fee, 0xefb5, 0xf1ea, 0xf3fa, 0xf3fb, 0xf3fc, 0xf5be, 0x9f69, 0xf5ba, 0xc568, 0xf5bd, 0xf5bc, 0xc4d4, 0xf5bb, 0xc4d6, 0x91c8, 0xc4d5, 0xf6d4, 0xf6d3, 0xc569, 0xc56a, 0x91c9, 0xc5c6, 0xf7cd, 0xc5c5, 0xf8a3, 0xf8a4, 0xf8a2, 0xf8a1, 0xc654, 0xf8eb, 0xf8ec, 0xf8ed, 0xc653, 0xf967, 0xf96a, 0xf969, 0xf968, 0xf9d3, 0x8de6, 0xc073, 0x91cb, 0xc365, 0xf5bf, 0xf6d5, 0xc5c7, 0xf7ce, 0xf9d5, 0x89c8, 0xc074, 0x8daa, 0xefb6, 0xf7cf, 0xf9a1, 0x9fdd, 0xfa40, 0xfa41, 0xfa42, 0xfa43, 0xfa44, 0xfa45, 0xfa46, 0xfa47, 0xfa48, 0xfa49, 0xfa4a, 0xfa4b, 0xfa4c, 0xfa4d, 0xfa4e, 0xfa4f, 0xfa50, 0xfa51, 0xfa52, 0xfa53, 0xfa54, 0xfa55, 0xfa56, 0xfa57, 0xfa58, 0xfa59, 0xfa5a, 0xfa5b, 0xfa5c, 0xfa5d, 0xfa5e, 0xadc5, 0xfa60, 0xfa61, 0xfa62, 0xfa63, 0xfa64, 0xfa65, 0xb0b0, 0xfa67, 0xfa68, 0xfa69, 0xfa6a, 0xfa6b, 0xfa6c, 0xfa6d, 0xfa6e, 0xfa6f, 0xfa70, 0xfa71, 0xfa72, 0xfa73, 0xfa74, 0xfa75, 0xfa76, 0xfa77, 0xfa78, 0xfa79, 0xfa7a, 0xfa7b, 0xfa7c, 0xfa7d, 0xfa7e, 0xfaa1, 0xfaa2, 0xfaa3, 0xfaa4, 0xfaa5, 0xfaa6, 0xfaa7, 0xfaa8, 0xfaa9, 0xfaaa, 0xfaab, 0xfaac, 0xfaad, 0xfaae, 0xfaaf, 0xfab0, 0xfab1, 0xfab2, 0xfab3, 0xfab4, 0xfab5, 0xfab6, 0xfab7, 0xfab8, 0xfab9, 0xfaba, 0xfabb, 0xfabc, 0xa55d, 0xfabe, 0xfabf, 0xfac0, 0xfac1, 0xfac2, 0xfac3, 0xfac4, 0xa2cd, 0xfac6, 0xfac7, 0xfac8, 0xfac9, 0xfaca, 0xfacb, 0xfacc, 0xfacd, 0xface, 0xfacf, 0xfad0, 0xfad1, 0xfad2, 0xfad3, 0xfad4, 0xadeb, 0xfad6, 0xfad7, 0xfad8, 0xfad9, 0xfada, 0xfadb, 0xfadc, 0xfadd, 0xfade, 0xfadf, 0xfae0, 0xfae1, 0xfae2, 0xfae3, 0xfae4, 0xfae5, 0xfae6, 0xfae7, 0xfae8, 0xfae9, 0xfaea, 0xfaeb, 0xfaec, 0xfaed, 0xfaee, 0xfaef, 0xfaf0, 0xfaf1, 0xfaf2, 0xfaf3, 0xfaf4, 0xfaf5, 0xfaf6, 0xfaf7, 0xfaf8, 0xfaf9, 0xfafa, 0xfafb, 0xfafc, 0xfafd, 0xfafe, 0xfb40, 0xfb41, 0xfb42, 0xfb43, 0xfb44, 0xfb45, 0xfb46, 0xfb47, 0x9def, 0xfb49, 0xfb4a, 0xfb4b, 0xfb4c, 0xfb4d, 0xfb4e, 0xfb4f, 0xfb50, 0xfb51, 0xfb52, 0xfb53, 0xfb54, 0xfb55, 0xfb56, 0xfb57, 0xfb58, 0xfb59, 0xfb5a, 0xfb5b, 0xfb5c, 0xfb5d, 0xfb5e, 0xfb5f, 0xfb60, 0xfb61, 0xfb62, 0xfb63, 0xfb64, 0xfb65, 0xfb66, 0xfb67, 0xfb68, 0xfb69, 0xfb6a, 0xfb6b, 0xfb6c, 0xfb6d, 0xfb6e, 0xfb6f, 0xfb70, 0xfb71, 0xfb72, 0xfb73, 0xfb74, 0xfb75, 0xfb76, 0xfb77, 0xfb78, 0xfb79, 0xfb7a, 0xfb7b, 0xfb7c, 0xfb7d, 0xfb7e, 0xfba1, 0xfba2, 0xfba3, 0xfba4, 0xfba5, 0xfba6, 0xfba7, 0xfba8, 0xfba9, 0xfbaa, 0xfbab, 0xfbac, 0xfbad, 0xfbae, 0xfbaf, 0xfbb0, 0xfbb1, 0xfbb2, 0xfbb3, 0xfbb4, 0xfbb5, 0xfbb6, 0xfbb7, 0xb440, 0xfbb9, 0xfbba, 0xfbbb, 0xfbbc, 0xfbbd, 0xfbbe, 0xfbbf, 0xfbc0, 0xfbc1, 0xfbc2, 0xfbc3, 0xfbc4, 0xfbc5, 0xfbc6, 0xfbc7, 0xfbc8, 0xfbc9, 0xfbca, 0xfbcb, 0xfbcc, 0xfbcd, 0xfbce, 0xfbcf, 0xfbd0, 0xfbd1, 0xfbd2, 0xfbd3, 0xfbd4, 0xfbd5, 0xfbd6, 0xfbd7, 0xfbd8, 0xfbd9, 0xfbda, 0xfbdb, 0xfbdc, 0xfbdd, 0xfbde, 0xfbdf, 0xfbe0, 0xfbe1, 0xfbe2, 0xfbe3, 0xfbe4, 0xfbe5, 0xfbe6, 0xfbe7, 0xfbe8, 0xfbe9, 0xfbea, 0xfbeb, 0xfbec, 0xfbed, 0xfbee, 0xfbef, 0xfbf0, 0xfbf1, 0xfbf2, 0xc9db, 0xfbf4, 0xfbf5, 0xfbf6, 0xfbf7, 0xfbf8, 0x9dfb, 0xfbfa, 0xfbfb, 0xfbfc, 0xfbfd, 0xfbfe, 0xfc40, 0xfc41, 0xfc42, 0xfc43, 0xfc44, 0xfc45, 0xfc46, 0xfc47, 0xfc48, 0xfc49, 0xfc4a, 0xfc4b, 0xfc4c, 0xfc4d, 0xfc4e, 0xd8f4, 0xfc50, 0xfc51, 0xfc52, 0xfc53, 0xfc54, 0xfc55, 0xfc56, 0xfc57, 0xfc58, 0xfc59, 0xfc5a, 0xfc5b, 0xfc5c, 0xfc5d, 0xfc5e, 0xfc5f, 0xfc60, 0xfc61, 0xfc62, 0xfc63, 0xfc64, 0xfc65, 0xfc66, 0xfc67, 0xfc68, 0xfc69, 0xfc6a, 0xfc6b, 0xa0dc, 0xfc6d, 0xfc6e, 0xfc6f, 0xfc70, 0xfc71, 0xfc72, 0xfc73, 0xfc74, 0xfc75, 0xfc76, 0xfc77, 0xfc78, 0xfc79, 0xfc7a, 0xfc7b, 0xfc7c, 0xfc7d, 0xfc7e, 0xfca1, 0xfca2, 0xfca3, 0xfca4, 0xfca5, 0xfca6, 0xfca7, 0xfca8, 0xfca9, 0xfcaa, 0xfcab, 0xfcac, 0xfcad, 0xfcae, 0xfcaf, 0xfcb0, 0xfcb1, 0xfcb2, 0xfcb3, 0xfcb4, 0xfcb5, 0xfcb6, 0xfcb7, 0xfcb8, 0xbcb5, 0xfcba, 0xfcbb, 0xfcbc, 0xfcbd, 0xfcbe, 0xfcbf, 0xfcc0, 0xfcc1, 0xfcc2, 0xfcc3, 0xfcc4, 0xfcc5, 0xfcc6, 0xfcc7, 0xfcc8, 0xfcc9, 0xfcca, 0xfccb, 0xfccc, 0xfccd, 0xfcce, 0xfccf, 0xfcd0, 0xfcd1, 0xfcd2, 0xfcd3, 0xfcd4, 0xfcd5, 0xfcd6, 0xfcd7, 0xfcd8, 0xfcd9, 0xfcda, 0xfcdb, 0xfcdc, 0xfcdd, 0xfcde, 0xfcdf, 0xfce0, 0xfce1, 0xb4b8, 0xfce3, 0xfce4, 0xfce5, 0xfce6, 0xfce7, 0xfce8, 0xfce9, 0xfcea, 0xfceb, 0xfcec, 0xfced, 0xfcee, 0xfcef, 0xfcf0, 0xa7fb, 0xfcf2, 0xfcf3, 0xfcf4, 0xfcf5, 0xfcf6, 0xfcf7, 0xfcf8, 0xfcf9, 0xfcfa, 0xfcfb, 0xfcfc, 0xfcfd, 0xfcfe, 0xfd40, 0xfd41, 0xfd42, 0xfd43, 0xfd44, 0xfd45, 0xfd46, 0xfd47, 0xfd48, 0xfd49, 0xfd4a, 0xfd4b, 0xfd4c, 0xfd4d, 0xfd4e, 0xfd4f, 0xfd50, 0xfd51, 0xfd52, 0xfd53, 0xfd54, 0xfd55, 0xfd56, 0xfd57, 0xfd58, 0xfd59, 0xfd5a, 0xfd5b, 0xfd5c, 0xfd5d, 0xfd5e, 0xfd5f, 0xfd60, 0xfd61, 0xfd62, 0xfd63, 0xfd64, 0xfd65, 0xfd66, 0xfd67, 0xfd68, 0xfd69, 0xfd6a, 0xfd6b, 0xfd6c, 0xfd6d, 0xfd6e, 0xfd6f, 0xfd70, 0xfd71, 0xfd72, 0xfd73, 0xfd74, 0xfd75, 0xfd76, 0xfd77, 0xfd78, 0xfd79, 0xfd7a, 0xfd7b, 0xfd7c, 0xfd7d, 0xfd7e, 0xfda1, 0xfda2, 0xfda3, 0xfda4, 0xfda5, 0xfda6, 0xfda7, 0xfda8, 0xfda9, 0xfdaa, 0xfdab, 0xfdac, 0xfdad, 0xfdae, 0xfdaf, 0xfdb0, 0xfdb1, 0xfdb2, 0xfdb3, 0xfdb4, 0xfdb5, 0xfdb6, 0xcb58, 0xb4fc, 0xfdb9, 0xfdba, 0xb4e4, 0xfdbc, 0xfdbd, 0xfdbe, 0xfdbf, 0xfdc0, 0xfdc1, 0xfdc2, 0xfdc3, 0xfdc4, 0xfdc5, 0xfdc6, 0xfdc7, 0xfdc8, 0xfdc9, 0xfdca, 0xfdcb, 0xfdcc, 0xfdcd, 0xfdce, 0xfdcf, 0xfdd0, 0xfdd1, 0xfdd2, 0xfdd3, 0xfdd4, 0xfdd5, 0xfdd6, 0xfdd7, 0xfdd8, 0xfdd9, 0xfdda, 0xfddb, 0xfddc, 0xfddd, 0xfdde, 0xfddf, 0xfde0, 0xfde1, 0xfde2, 0xfde3, 0xfde4, 0xfde5, 0xfde6, 0xfde7, 0xfde8, 0xfde9, 0xfdea, 0xfdeb, 0xfdec, 0xfded, 0xfdee, 0xfdef, 0xfdf0, 0xb54e, 0xfdf2, 0xfdf3, 0xfdf4, 0xfdf5, 0xfdf6, 0xfdf7, 0xfdf8, 0xfdf9, 0xfdfa, 0xfdfb, 0xfdfc, 0xfdfd, 0xfdfe, 0xfe40, 0xfe41, 0xfe42, 0xfe43, 0xfe44, 0xfe45, 0xfe46, 0xfe47, 0xfe48, 0xfe49, 0xfe4a, 0xfe4b, 0xfe4c, 0xfe4d, 0xfe4e, 0xfe4f, 0xfe50, 0xfe51, 0x9975, 0xfe53, 0xfe54, 0xfe55, 0xfe56, 0xfe57, 0xfe58, 0xfe59, 0xfe5a, 0xfe5b, 0xfe5c, 0xfe5d, 0xfe5e, 0xfe5f, 0xfe60, 0xfe61, 0xfe62, 0xfe63, 0xfe64, 0xfe65, 0xfe66, 0xfe67, 0xfe68, 0xfe69, 0xfe6a, 0xfe6b, 0xfe6c, 0xfe6d, 0xfe6e, 0xb7ec, 0xfe70, 0xfe71, 0xfe72, 0xfe73, 0xfe74, 0xfe75, 0xfe76, 0xfe77, 0xfe78, 0xfe79, 0xfe7a, 0xfe7b, 0xfe7c, 0xfe7d, 0xfe7e, 0xfea1, 0xfea2, 0xfea3, 0xfea4, 0xfea5, 0xfea6, 0xfea7, 0xfea8, 0xfea9, 0xa260, 0xfeab, 0xfeac, 0xfead, 0xfeae, 0xfeaf, 0xfeb0, 0xfeb1, 0xfeb2, 0xfeb3, 0xfeb4, 0xfeb5, 0xfeb6, 0xfeb7, 0xfeb8, 0xfeb9, 0xfeba, 0xfebb, 0xfebc, 0xfebd, 0xfebe, 0xfebf, 0xfec0, 0xfec1, 0xfec2, 0xfec3, 0xfec4, 0xfec5, 0xfec6, 0xfec7, 0xfec8, 0xfec9, 0xfeca, 0xfecb, 0xfecc, 0xfecd, 0xfece, 0xfecf, 0xfed0, 0xfed1, 0xfed2, 0xfed3, 0xfed4, 0xfed5, 0xfed6, 0xfed7, 0xfed8, 0xfed9, 0xfeda, 0xfedb, 0xfedc, 0xcff1, 0xfede, 0xfedf, 0xfee0, 0xfee1, 0xfee2, 0xfee3, 0xfee4, 0xfee5, 0xfee6, 0xfee7, 0xfee8, 0xfee9, 0xfeea, 0xfeeb, 0xfeec, 0xfeed, 0xfeee, 0xfeef, 0xfef0, 0xfef1, 0xfef2, 0xfef3, 0xfef4, 0xfef5, 0xfef6, 0xfef7, 0xfef8, 0xfef9, 0xfefa, 0xfefb, 0xfefc, 0xfefd, 0xfefe, 0x8e40, 0x8e41, 0x8e42, 0x8e43, 0x8e44, 0x8e45, 0x8e46, 0x8e47, 0x8e48, 0x8e49, 0x8e4a, 0x8e4b, 0x8e4c, 0x8e4d, 0x8e4e, 0x8e4f, 0x8e50, 0x8e51, 0x8e52, 0x8e53, 0x8e54, 0x8e55, 0x8e56, 0x8e57, 0x8e58, 0x8e59, 0x8e5a, 0x8e5b, 0x8e5c, 0x8e5d, 0x8e5e, 0x8e5f, 0x8e60, 0x8e61, 0x8e62, 0x8e63, 0x8e64, 0x8e65, 0x8e66, 0x8e67, 0x8e68, 0xbae6, 0x8e6a, 0x8e6b, 0x8e6c, 0x8e6d, 0x8e6e, 0xedca, 0x8e70, 0x8e71, 0x8e72, 0x8e73, 0x8e74, 0x8e75, 0x8e76, 0x8e77, 0x8e78, 0x8e79, 0x8e7a, 0x8e7b, 0x8e7c, 0x8e7d, 0xa261, 0x8ea1, 0x8ea2, 0x8ea3, 0x8ea4, 0x8ea5, 0x8ea6, 0x8ea7, 0x8ea8, 0x8ea9, 0x8eaa, 0xbafc, 0x8eac, 0x8ead, 0x8eae, 0x8eaf, 0x8eb0, 0x8eb1, 0x8eb2, 0x8eb3, 0xbfa6, 0x8eb5, 0x8eb6, 0x8eb7, 0x8eb8, 0x8eb9, 0x8eba, 0x8ebb, 0x8ebc, 0x8ebd, 0x8ebe, 0x8ebf, 0x8ec0, 0x8ec1, 0x8ec2, 0x8ec3, 0x8ec4, 0x8ec5, 0x8ec6, 0x8ec7, 0x8ec8, 0x8ec9, 0x8eca, 0x8ecb, 0x8ecc, 0xaacc, 0x8ece, 0x8ecf, 0xbfae, 0x8ed1, 0x8ed2, 0x8ed3, 0x8ed4, 0x8ed5, 0x8ed6, 0x8ed7, 0x8ed8, 0x8ed9, 0x8eda, 0x8edb, 0x8edc, 0x8edd, 0x8ede, 0x8edf, 0x8ee0, 0x8ee1, 0x8ee2, 0x8ee3, 0x8ee4, 0x8ee5, 0x8ee6, 0x8ee7, 0x8ee8, 0x8ee9, 0x8eea, 0x8eeb, 0x8eec, 0x8eed, 0x8eee, 0x8eef, 0x8ef0, 0x8ef1, 0x8ef2, 0x8ef3, 0x8ef4, 0x8ef5, 0x8ef6, 0x8ef7, 0x8ef8, 0x8ef9, 0x8efa, 0x8efb, 0x8efc, 0x8efd, 0x8efe, 0x8f40, 0x8f41, 0x8f42, 0x8f43, 0x8f44, 0x8f45, 0x8f46, 0x8f47, 0x8f48, 0x8f49, 0x8f4a, 0x8f4b, 0x8f4c, 0x8f4d, 0x8f4e, 0x8f4f, 0x8f50, 0x8f51, 0x8f52, 0x8f53, 0x8f54, 0x8f55, 0x8f56, 0xb5d7, 0x8f58, 0x8f59, 0x8f5a, 0x8f5b, 0x8f5c, 0x8f5d, 0x8f5e, 0x8f5f, 0x8f60, 0x8f61, 0x8f62, 0x8f63, 0x8f64, 0x8f65, 0x8f66, 0x8f67, 0x8f68, 0xe3c8, 0x8f6a, 0x8f6b, 0x8f6c, 0x8f6d, 0xdb79, 0x8f6f, 0x8f70, 0x8f71, 0x8f72, 0x8f73, 0x8f74, 0x8f75, 0x8f76, 0x8f77, 0x8f78, 0x8f79, 0x8f7a, 0x8f7b, 0x8f7c, 0x8f7d, 0x8f7e, 0x8fa1, 0x8fa2, 0x8fa3, 0x8fa4, 0x8fa5, 0x8fa6, 0x8fa7, 0x8fa8, 0x8fa9, 0x8faa, 0x8fab, 0x8fac, 0x8fad, 0x8fae, 0x8faf, 0x8fb0, 0x8fb1, 0x8fb2, 0x8fb3, 0x8fb4, 0x8fb5, 0x8fb6, 0x8fb7, 0x8fb8, 0x8fb9, 0x8fba, 0x8fbb, 0x8fbc, 0x8fbd, 0x8fbe, 0x8fbf, 0x8fc0, 0x8fc1, 0x8fc2, 0x8fc3, 0x8fc4, 0x8fc5, 0x8fc6, 0x8fc7, 0x8fc8, 0x8fc9, 0x8fca, 0xbfcc, 0xa0d4, 0x8fcd, 0x8fce, 0x8fcf, 0x8fd0, 0x8fd1, 0x8fd2, 0x8fd3, 0x8fd4, 0x8fd5, 0x8fd6, 0x8fd7, 0x8fd8, 0x8fd9, 0x8fda, 0x8fdb, 0x8fdc, 0x8fdd, 0x8fde, 0x8fdf, 0x8fe0, 0x8fe1, 0x8fe2, 0x8fe3, 0x8fe4, 0x8fe5, 0x8fe6, 0x8fe7, 0x8fe8, 0x8fe9, 0x8fea, 0x8feb, 0x8fec, 0x8fed, 0x8fee, 0x8fef, 0x8ff0, 0x8ff1, 0x8ff2, 0x8ff3, 0x8ff4, 0x8ff5, 0x8ff6, 0x8ff7, 0x8ff8, 0x8ff9, 0x8ffa, 0x8ffb, 0x8ffc, 0x8ffd, 0xb05f, 0x9040, 0x9041, 0x9042, 0x9043, 0x9044, 0x9045, 0x9046, 0x9047, 0x9048, 0x9049, 0x904a, 0x904b, 0x904c, 0x904d, 0x904e, 0x904f, 0x9050, 0x9051, 0x9052, 0x9053, 0x9054, 0x9055, 0x9056, 0x9057, 0x9058, 0x9059, 0x905a, 0x905b, 0x905c, 0x905d, 0x905e, 0x905f, 0x9060, 0x9061, 0x9062, 0x9063, 0x9064, 0x9065, 0x9066, 0x9067, 0x9068, 0x9069, 0x906a, 0x906b, 0x906c, 0xb3a3, 0x906e, 0x906f, 0x9070, 0x9071, 0x9072, 0x9073, 0x9074, 0x9075, 0x9076, 0x9077, 0x9078, 0x9079, 0xf9d7, 0x907b, 0x907c, 0x907d, 0x907e, 0x90a1, 0x90a2, 0x90a3, 0x90a4, 0x90a5, 0x90a6, 0x90a7, 0x90a8, 0x90a9, 0x90aa, 0x90ab, 0x90ac, 0x90ad, 0x90ae, 0x90af, 0x90b0, 0x90b1, 0x90b2, 0x90b3, 0x90b4, 0x90b5, 0x90b6, 0x90b7, 0x90b8, 0x90b9, 0x90ba, 0x90bb, 0x90bc, 0x90bd, 0x90be, 0x90bf, 0x90c0, 0x90c1, 0x90c2, 0x90c3, 0x90c4, 0x90c5, 0x90c6, 0x90c7, 0x90c8, 0x90c9, 0x90ca, 0x90cb, 0x90cc, 0x90cd, 0x90ce, 0x90cf, 0x90d0, 0x90d1, 0x90d2, 0x90d3, 0x90d4, 0x90d5, 0x90d6, 0x90d7, 0x90d8, 0x90d9, 0x90da, 0x90db, 0xc052, 0x90dd, 0x90de, 0x90df, 0x90e0, 0x90e1, 0x90e2, 0x90e3, 0x90e4, 0x90e5, 0x90e6, 0x90e7, 0x90e8, 0x90e9, 0x90ea, 0x90eb, 0x90ec, 0x90ed, 0x90ee, 0x90ef, 0x90f0, 0xc554, 0x90f2, 0x90f3, 0x90f4, 0x90f5, 0x90f6, 0x90f7, 0x90f8, 0x90f9, 0x90fa, 0x90fb, 0x90fc, 0x90fd, 0x90fe, 0x9140, 0x9141, 0x9142, 0x9143, 0x9144, 0x9145, 0x9146, 0x9147, 0x9148, 0x9149, 0x914a, 0x914b, 0x914c, 0x914d, 0x914e, 0x914f, 0x9150, 0x9151, 0x9152, 0x9153, 0x9154, 0x9155, 0x9156, 0x9157, 0x9158, 0x9159, 0x915a, 0x915b, 0x915c, 0x915d, 0x915e, 0x915f, 0x9160, 0x9161, 0x9162, 0x9163, 0x9164, 0x9165, 0x9166, 0x9167, 0x9168, 0x9169, 0x916a, 0x916b, 0x916c, 0x916d, 0x916e, 0x916f, 0x9170, 0x9171, 0x9172, 0x9173, 0x9174, 0x9175, 0x9176, 0x9177, 0x9178, 0x9179, 0x917a, 0x917b, 0x917c, 0x917d, 0x917e, 0x91a1, 0x91a2, 0x91a3, 0x91a4, 0x91a5, 0x91a6, 0x91a7, 0x91a8, 0x91a9, 0x91aa, 0x91ab, 0x91ac, 0x91ad, 0x91ae, 0x91af, 0x91b0, 0x91b1, 0x91b2, 0x91b3, 0x91b4, 0x91b5, 0x91b6, 0x91b7, 0x91b8, 0x91b9, 0x91ba, 0x91bb, 0x91bc, 0x91bd, 0x91be, 0xf1e3, 0x91c0, 0x91c1, 0x91c2, 0x91c3, 0x91c4, 0x91c5, 0x91c6, 0x91c7, 0x91c8, 0x91c9, 0x91ca, 0x91cb, 0x91cc, 0x91cd, 0x91ce, 0x91cf, 0x91d0, 0x91d1, 0x91d2, 0x91d3, 0x91d4, 0x91d5, 0x91d6, 0x91d7, 0x91d8, 0x91d9, 0x91da, 0x91db, 0x91dc, 0x91dd, 0x91de, 0x91df, 0x91e0, 0x91e1, 0x91e2, 0x91e3, 0x91e4, 0x91e5, 0x91e6, 0x91e7, 0x91e8, 0x91e9, 0x91ea, 0x91eb, 0x91ec, 0x91ed, 0x91ee, 0x91ef, 0x91f0, 0x91f1, 0x91f2, 0x91f3, 0x91f4, 0x91f5, 0x91f6, 0x91f7, 0x91f8, 0x91f9, 0x91fa, 0x91fb, 0x91fc, 0x91fd, 0x91fe, 0x9240, 0x9241, 0x9242, 0x9243, 0x9242, 0x9245, 0x9246, 0x9247, 0x9248, 0x9249, 0x924a, 0x924b, 0x924c, 0x924d, 0x924e, 0x924f, 0x9250, 0x9251, 0x9252, 0x9253, 0x9254, 0x9255, 0x9256, 0x9257, 0x9258, 0x9259, 0x925a, 0x925b, 0x925c, 0x925d, 0x925e, 0x925f, 0x9260, 0x9261, 0x9262, 0x9263, 0x9264, 0x9265, 0x9266, 0x9267, 0x9268, 0x9269, 0x926a, 0x926b, 0x926c, 0x926d, 0x926e, 0x926f, 0x9270, 0x9271, 0x9272, 0x9273, 0x9274, 0x9275, 0x9276, 0x9277, 0x9278, 0x9279, 0x927a, 0x927b, 0x927c, 0x927d, 0x927e, 0x92a1, 0x92a2, 0x92a3, 0x92a4, 0x92a5, 0x92a6, 0x92a7, 0x92a8, 0x92a9, 0x92aa, 0x92ab, 0x92ac, 0x92ad, 0x92ae, 0xa259, 0xa25a, 0xa25c, 0xa25b, 0x92b3, 0x92b4, 0x92b5, 0x92b6, 0x92b7, 0x92b8, 0x92b9, 0x92ba, 0x92bb, 0x92bc, 0x92bd, 0x92be, 0x92bf, 0x92c0, 0x92c1, 0x92c2, 0x92c3, 0x92c4, 0x92c5, 0x92c6, 0x92c7, 0xa05f, 0x92c9, 0x92ca, 0x92cb, 0x92cc, 0x92cd, 0x92ce, 0x92cf, 0x92d0, 0xe6ab, 0x92d2, 0x92d3, 0x92d4, 0x92d5, 0x92d6, 0x92d7, 0x92d8, 0x92d9, 0x92da, 0x92db, 0x92dc, 0x92dd, 0x92de, 0x92df, 0x92e0, 0x92e1, 0x92e2, 0x92e3, 0x92e4, 0x92e5, 0x92e6, 0x92e7, 0x92e8, 0x92e9, 0x92ea, 0x92eb, 0x92ec, 0x92ed, 0x92ee, 0x92ef, 0x92f0, 0x92f1, 0x92f2, 0x92f3, 0x92f4, 0x92f5, 0x92f6, 0x92f7, 0x92f8, 0x92f9, 0x92fa, 0x92fb, 0x92fc, 0x92fd, 0x92fe, 0x9340, 0x9341, 0x9342, 0x9343, 0x9344, 0x9345, 0x9346, 0x9347, 0x9348, 0x9349, 0x934a, 0x934b, 0x934c, 0x934d, 0x934e, 0x934f, 0x9350, 0x9351, 0x9352, 0x9353, 0x9354, 0x9355, 0x9356, 0x9357, 0x9358, 0x9359, 0x935a, 0x935b, 0x935c, 0x935d, 0x935e, 0x935f, 0x9360, 0x9361, 0x9362, 0x9363, 0x9364, 0x9365, 0x9366, 0x9367, 0x9368, 0x9369, 0x936a, 0x936b, 0x936c, 0x936d, 0x936e, 0x936f, 0x9370, 0x9371, 0x9372, 0x9373, 0x9374, 0x9375, 0x9376, 0x9377, 0x9378, 0x9379, 0x937a, 0x937b, 0x937c, 0x937d, 0x937e, 0x93a1, 0x93a2, 0x93a3, 0x93a4, 0x93a5, 0x93a6, 0x93a7, 0x93a8, 0x93a9, 0x93aa, 0x93ab, 0x93ac, 0x93ad, 0x93ae, 0x93af, 0x93b0, 0x93b1, 0x93b2, 0x93b3, 0x93b4, 0x93b5, 0x93b6, 0x93b7, 0x93b8, 0x93b9, 0x93ba, 0x93bb, 0x93bc, 0x93bd, 0x93be, 0x93bf, 0x93c0, 0x93c1, 0x93c2, 0x93c3, 0x93c4, 0x93c5, 0x93c6, 0x93c7, 0x93c8, 0x93c9, 0x93ca, 0x93cb, 0x93cc, 0x93cd, 0x93ce, 0x93cf, 0x93d0, 0x93d1, 0x93d2, 0x93d3, 0x93d4, 0x93d5, 0x93d6, 0x93d7, 0x93d8, 0x93d9, 0x93da, 0x93db, 0x93dc, 0x93dd, 0x93de, 0x93df, 0x93e0, 0x93e1, 0x93e2, 0x93e3, 0x93e4, 0x93e5, 0x93e6, 0x93e7, 0x93e8, 0x93e9, 0x93ea, 0x93eb, 0x93ec, 0x93ed, 0x93ee, 0x93ef, 0x93f0, 0x93f1, 0x93f2, 0x93f3, 0x93f4, 0x93f5, 0x93f6, 0x93f7, 0x93f8, 0x93f9, 0x93fa, 0x93fb, 0x93fc, 0x93fd, 0x93fe, 0x9440, 0x9441, 0x9442, 0x9443, 0x9444, 0x9445, 0x9446, 0xd256, 0x9448, 0x9449, 0x944a, 0x944b, 0x944c, 0x944d, 0x944e, 0x944f, 0x9450, 0x9451, 0x9452, 0x9453, 0x9454, 0x9455, 0x9456, 0x9457, 0x9458, 0x9459, 0x945a, 0x945b, 0x945c, 0x945d, 0x945e, 0x945f, 0x9460, 0x9461, 0x9462, 0x9463, 0x9464, 0x9465, 0x9466, 0x9467, 0x9468, 0x9469, 0x946a, 0x946b, 0x946c, 0x946d, 0x946e, 0x946f, 0x9470, 0x9471, 0x9472, 0x9473, 0x9474, 0x9475, 0x9476, 0x9477, 0x9478, 0x9479, 0x947a, 0x947b, 0x947c, 0x947d, 0x947e, 0x94a1, 0x94a2, 0x94a3, 0x94a4, 0x94a5, 0x94a6, 0x94a7, 0x94a8, 0x94a9, 0x94aa, 0x94ab, 0x94ac, 0x94ad, 0x94ae, 0x94af, 0x94b0, 0x94b1, 0x94b2, 0x94b3, 0x94b4, 0x94b5, 0x94b6, 0x94b7, 0x94b8, 0x94b9, 0x94ba, 0x94bb, 0x94bc, 0x94bd, 0x94be, 0x94bf, 0x94c0, 0x94c1, 0x94c2, 0x94c3, 0x94c4, 0x94c5, 0x94c6, 0x94c7, 0x94c8, 0x94c9, 0xe6d0, 0x94cb, 0x94cc, 0x94cd, 0x94ce, 0x94cf, 0x94d0, 0x94d1, 0x94d2, 0x94d3, 0x94d4, 0x94d5, 0x94d6, 0x94d7, 0x94d8, 0x94d9, 0x94da, 0x94db, 0x94dc, 0x94dd, 0x94de, 0x94df, 0x94e0, 0x94e1, 0x94e2, 0x94e3, 0x94e4, 0x94e5, 0x94e6, 0x94e7, 0x94e8, 0x94e9, 0x94ea, 0x94eb, 0x94ec, 0x94ed, 0x94ee, 0x94ef, 0x94f0, 0x94f1, 0x94f2, 0x94f3, 0x94f4, 0x94f5, 0x94f6, 0x94f7, 0x94f8, 0x94f9, 0x94fa, 0x94fb, 0x94fc, 0x94fd, 0x94fe, 0x9540, 0x9541, 0x9542, 0x9543, 0x9544, 0x9545, 0x9546, 0x9547, 0x9548, 0x9549, 0x954a, 0x954b, 0x954c, 0x954d, 0x954e, 0x954f, 0x9550, 0x9551, 0x9552, 0x9553, 0x9554, 0x9555, 0x9556, 0x9557, 0x9558, 0x9559, 0x955a, 0x955b, 0x955c, 0x955d, 0x955e, 0x955f, 0x9560, 0x9561, 0x9562, 0x9563, 0x9564, 0x9565, 0x9566, 0x9567, 0x9568, 0x9569, 0x956a, 0x956b, 0x956c, 0x956d, 0x956e, 0x956f, 0x9570, 0x9571, 0x9572, 0x9573, 0x9574, 0x9575, 0x9576, 0x9577, 0x9578, 0x9579, 0x957a, 0x957b, 0x957c, 0x957d, 0x957e, 0x95a1, 0x95a2, 0x95a3, 0x95a4, 0x95a5, 0x95a6, 0x95a7, 0x95a8, 0x95a9, 0x95aa, 0x95ab, 0x95ac, 0x95ad, 0x95ae, 0x95af, 0x95b0, 0x95b1, 0x95b2, 0x95b3, 0x95b4, 0x95b5, 0x95b6, 0x95b7, 0x95b8, 0x95b9, 0x95ba, 0x95bb, 0x95bc, 0x95bd, 0x95be, 0x95bf, 0x95c0, 0x95c1, 0x95c2, 0x95c3, 0x95c4, 0x95c5, 0x95c6, 0x95c7, 0x95c8, 0x95c9, 0x95ca, 0x95cb, 0x95cc, 0x95cd, 0x95ce, 0x95cf, 0x95d0, 0x95d1, 0x95d2, 0x95d3, 0x95d4, 0x95d5, 0x95d6, 0x95d7, 0x95d8, 0xca52, 0x95da, 0x95db, 0x95dc, 0x95dd, 0x95de, 0x95df, 0x95e0, 0x95e1, 0x95e2, 0x95e3, 0x95e4, 0x95e5, 0x95e6, 0x95e7, 0x95e8, 0x95e9, 0x95ea, 0x95eb, 0x95ec, 0x95ed, 0x95ee, 0x95ef, 0x95f0, 0x95f1, 0x95f2, 0x95f3, 0x95f4, 0x95f5, 0x95f6, 0x95f7, 0x95f8, 0x95f9, 0x95fa, 0x95fb, 0x95fc, 0x95fd, 0x95fe, 0x9640, 0x9641, 0x9642, 0x9643, 0x9ce4, 0x9645, 0x9646, 0x9647, 0x9648, 0x9649, 0x964a, 0x964b, 0x964c, 0x964d, 0x964e, 0x964f, 0x9650, 0x9651, 0x9652, 0x9653, 0x9654, 0x9655, 0x9656, 0x9657, 0x9658, 0x9659, 0x965a, 0x965b, 0x965c, 0x965d, 0x965e, 0x965f, 0x9660, 0x9661, 0x9662, 0x9663, 0x9664, 0x9665, 0x9666, 0x9667, 0x9668, 0x9669, 0x966a, 0x966b, 0x966c, 0x966d, 0x966e, 0x966f, 0x9670, 0x9671, 0x9672, 0x9673, 0x9674, 0x9675, 0x9676, 0x9677, 0x9678, 0x9679, 0x967a, 0x967b, 0x967c, 0x967d, 0x967e, 0x96a1, 0x96a2, 0x96a3, 0x96a4, 0x96a5, 0x96a6, 0x96a7, 0x96a8, 0x96a9, 0x96aa, 0x96ab, 0x96ac, 0x96ad, 0x96ae, 0x96af, 0x96b0, 0x96b1, 0x96b2, 0x96b3, 0x96b4, 0x96b5, 0x96b6, 0x96b7, 0x96b8, 0x96b9, 0x96ba, 0x96bb, 0x96bc, 0x96bd, 0x96be, 0x96bf, 0x96c0, 0x96c1, 0x96c2, 0x96c3, 0x96c4, 0x96c5, 0x96c6, 0x96c7, 0x96c8, 0x96c9, 0x96ca, 0x96cb, 0x96cc, 0x96cd, 0x96ce, 0x96cf, 0x96d0, 0x96d1, 0x96d2, 0x96d3, 0x96d4, 0x96d5, 0x96d6, 0x96d7, 0x96d8, 0x96d9, 0x96da, 0x96db, 0x96dc, 0x96dd, 0x96de, 0x96df, 0x96e0, 0x96e1, 0x96e2, 0x96e3, 0x96e4, 0x96e5, 0x96e6, 0x96e7, 0x96e8, 0x96e9, 0x96ea, 0x96eb, 0x96ec, 0x96ee, 0x96ee, 0x96ef, 0x96f0, 0x96f1, 0x96f2, 0x96f3, 0x96f4, 0x96f5, 0x96f6, 0x96f7, 0x96f8, 0x96f9, 0x96fa, 0x96fb, 0xe959, 0x96fd, 0x96fe, 0x9740, 0x9741, 0x9742, 0x9743, 0x9744, 0x9745, 0x9746, 0x9747, 0x9748, 0x9749, 0x974a, 0x974b, 0x974c, 0x974d, 0x974e, 0x974f, 0x9750, 0x9751, 0x9752, 0x9753, 0x9754, 0x9755, 0x9756, 0x9757, 0x9758, 0x9759, 0x975a, 0x975b, 0x975c, 0x975d, 0x975e, 0x975f, 0x9760, 0x9761, 0x9762, 0x9763, 0x9764, 0x9765, 0x9766, 0x9767, 0x9768, 0x9769, 0x976a, 0x976b, 0x976c, 0x976d, 0x976e, 0x976f, 0x9770, 0x9771, 0x9772, 0x9773, 0x9774, 0x9775, 0x9776, 0x9777, 0x9778, 0x9779, 0x977a, 0x977b, 0x977c, 0x977d, 0x977e, 0x97a1, 0x97a2, 0x97a3, 0x97a4, 0x97a5, 0x97a6, 0x97a7, 0x97a8, 0x97a9, 0x97aa, 0x97ab, 0x97ac, 0x97ad, 0x97ae, 0x97af, 0x97b0, 0x97b1, 0x97b2, 0x97b3, 0x97b4, 0x97b5, 0x97b6, 0x97b7, 0x97b8, 0x97b9, 0x97ba, 0x97bb, 0x97bc, 0x97bd, 0x97be, 0x97bf, 0x97c0, 0x97c1, 0x97c2, 0x97c3, 0x97c4, 0x97c5, 0x97c6, 0x97c7, 0x97c8, 0x97c9, 0x97ca, 0x97cb, 0x97cc, 0x97cd, 0x97ce, 0x97cf, 0x97d0, 0x97d1, 0x97d2, 0x97d3, 0x97d4, 0x97d5, 0x97d6, 0x97d7, 0x97d8, 0x97d9, 0x97da, 0x97db, 0x97dc, 0x97dd, 0x97de, 0x97df, 0x97e0, 0x97e1, 0x97e2, 0x97e3, 0x97e4, 0x97e5, 0x97e6, 0x97e7, 0x97e8, 0x97e9, 0x97ea, 0x97eb, 0x97ec, 0x97ed, 0x97ee, 0x97ef, 0x97f0, 0x97f1, 0x97f2, 0x97f3, 0x97f4, 0x97f5, 0x97f6, 0x97f7, 0x97f8, 0x97f9, 0x97fa, 0x97fb, 0x97fc, 0x97fd, 0x97fe, 0x9840, 0x9841, 0x9842, 0x9843, 0x9844, 0x9845, 0x9846, 0x9847, 0x9848, 0x9849, 0x984a, 0x984b, 0x984c, 0x984d, 0x984e, 0x984f, 0x9850, 0x9851, 0x9852, 0x9853, 0x9854, 0x9855, 0x9856, 0x9857, 0x9858, 0x9859, 0x985a, 0x985b, 0x985c, 0x985d, 0x985e, 0x985f, 0x9860, 0x9861, 0x9862, 0x9863, 0x9864, 0x9865, 0x9866, 0x9867, 0x9868, 0x9869, 0x986a, 0x986b, 0x986c, 0x986d, 0x986e, 0x986f, 0x9870, 0x9871, 0x9872, 0x9873, 0x9874, 0x9875, 0x9876, 0x9877, 0x9878, 0x9879, 0x987a, 0x987b, 0x987c, 0x987d, 0x987e, 0x98a1, 0x98a2, 0x98a3, 0x98a4, 0x98a5, 0x98a6, 0x98a7, 0x98a8, 0x98a9, 0x98aa, 0x98ab, 0x98ac, 0x98ad, 0x98ae, 0x98af, 0x98b0, 0x98b1, 0x98b2, 0x98b3, 0x98b4, 0x98b5, 0x98b6, 0x98b7, 0x98b8, 0x98b9, 0x98ba, 0x98bb, 0x98bc, 0x98bd, 0x98be, 0x98bf, 0x98c0, 0x98c1, 0x98c2, 0x98c3, 0x98c4, 0x98c5, 0x98c6, 0x98c7, 0x98c8, 0x98c9, 0x98ca, 0x98cb, 0x98cc, 0x98cd, 0x98ce, 0x98cf, 0x98d0, 0x98d1, 0x98d2, 0x98d3, 0x98d4, 0x98d5, 0x98d6, 0x98d7, 0x98d8, 0x98d9, 0x98da, 0x98db, 0x98dc, 0x98dd, 0x98de, 0x98df, 0x98e0, 0x98e1, 0x98e2, 0x98e3, 0x98e4, 0x98e5, 0x98e6, 0x98e7, 0x98e8, 0x98e9, 0x98ea, 0x98eb, 0x98ec, 0x98ed, 0x98ee, 0x98ef, 0x98f0, 0x98f1, 0x98f2, 0x98f3, 0x98f4, 0x98f5, 0x98f6, 0x98f7, 0x98f8, 0x98f9, 0x98fa, 0x98fb, 0x98fc, 0x98fd, 0x98fe, 0x9940, 0x9941, 0x9942, 0x9943, 0x9944, 0x9945, 0x9946, 0x9947, 0x9948, 0x9949, 0x994a, 0x994b, 0x994c, 0x994d, 0x994e, 0x994f, 0x9950, 0x9951, 0x9952, 0x9953, 0x9954, 0x9955, 0x9956, 0x9957, 0x9958, 0x9959, 0x995a, 0x995b, 0x995c, 0x995d, 0x995e, 0x995f, 0x9960, 0x9961, 0x9962, 0x9963, 0x9964, 0x9965, 0x9966, 0x9967, 0x9968, 0x9969, 0x996a, 0x996b, 0x996c, 0x996d, 0x996e, 0x996f, 0x9970, 0x9971, 0x9972, 0x9973, 0x9974, 0x9975, 0x9976, 0x9977, 0x9978, 0x9979, 0x997a, 0x997b, 0x997c, 0x997d, 0x997e, 0x99a1, 0x99a2, 0x99a3, 0x99a4, 0x99a5, 0x99a6, 0x99a7, 0x99a8, 0x99a9, 0x99aa, 0x99ab, 0x99ac, 0x99ad, 0x99ae, 0x99af, 0x99b0, 0x99b1, 0x99b2, 0x99b3, 0x99b4, 0x99b5, 0x99b6, 0x99b7, 0x99b8, 0x99b9, 0x99ba, 0x99bb, 0x99bc, 0x99bd, 0x99be, 0x99bf, 0x99c0, 0x99c1, 0x99c2, 0x99c3, 0x99c4, 0x99c5, 0x99c6, 0x99c7, 0x99c8, 0x99c9, 0x99ca, 0x99cb, 0x99cc, 0x99cd, 0x99ce, 0x99cf, 0x99d0, 0x99d1, 0x99d2, 0x99d3, 0x99d4, 0x99d5, 0x99d6, 0x99d7, 0x99d8, 0x99d9, 0x99da, 0x99db, 0x99dc, 0x99dd, 0x99de, 0x99df, 0x99e0, 0x99e1, 0x99e2, 0x99e3, 0x99e4, 0x99e5, 0x99e6, 0x99e7, 0x99e8, 0x99e9, 0x99ea, 0x99eb, 0x99ec, 0x99ed, 0x99ee, 0x99ef, 0x99f0, 0x99f1, 0x99f2, 0x99f3, 0x99f4, 0x99f5, 0x99f6, 0x99f7, 0x99f8, 0x99f9, 0x99fa, 0x99fb, 0x99fc, 0x99fd, 0x99fe, 0x9a40, 0x9a41, 0x9a42, 0x9a43, 0x9a44, 0x9a45, 0x9a46, 0x9a47, 0x9a48, 0x9a49, 0x9a4a, 0x9a4b, 0x9a4c, 0x9a4d, 0x9a4e, 0x9a4f, 0x9a50, 0x9a51, 0x9a52, 0x9a53, 0x9a54, 0x9a55, 0x9a56, 0x9a57, 0x9a58, 0x9a59, 0x9a5a, 0x9a5b, 0x9a5c, 0x9a5d, 0x9a5e, 0x9a5f, 0x9a60, 0x9a61, 0x9a62, 0x9a63, 0x9a64, 0x9a65, 0x9a66, 0x9a67, 0x9a68, 0x9a69, 0x9a6a, 0x9a6b, 0x9a6c, 0x9a6d, 0x9a6e, 0x9a6f, 0x9a70, 0x9a71, 0x9a72, 0x9a73, 0x9a74, 0x9a75, 0x9a76, 0x9a77, 0x9a78, 0x9a79, 0x9a7a, 0x9a7b, 0x9a7c, 0x9a7d, 0x9a7e, 0x9aa1, 0x9aa2, 0x9aa3, 0x9aa4, 0x9aa5, 0x9aa6, 0x9aa7, 0x9aa8, 0x9aa9, 0x9aaa, 0x9aab, 0x9aac, 0x9aad, 0x9aae, 0x9aaf, 0x9ab0, 0x9ab1, 0x9ab2, 0x9ab3, 0x9ab4, 0x9ab5, 0x9ab6, 0x9ab7, 0x9ab8, 0x9ab9, 0x9aba, 0x9abb, 0x9abc, 0x9abd, 0x9abe, 0x9abf, 0x9ac0, 0x9ac1, 0x9ac2, 0x9ac3, 0x9ac4, 0x9ac5, 0x9ac6, 0x9ac7, 0x9ac8, 0x9ac9, 0x9aca, 0x9acb, 0x9acc, 0x9acd, 0x9ace, 0x9acf, 0x9ad0, 0x9ad1, 0x9ad2, 0x9ad3, 0x9ad4, 0x9ad5, 0x9ad6, 0x9ad7, 0x9ad8, 0x9ad9, 0x9ada, 0x9adb, 0x9adc, 0x9add, 0x9ade, 0x9adf, 0x9ae0, 0x9ae1, 0x9ae2, 0x9ae3, 0x9ae4, 0x9ae5, 0x9ae6, 0x9ae7, 0x9ae8, 0x9ae9, 0x9aea, 0x9aeb, 0x9aec, 0x9aed, 0x9aee, 0x9aef, 0x9af0, 0x9af1, 0x9af2, 0x9af3, 0x9af4, 0x9af5, 0x9af6, 0x9af7, 0x9af8, 0x9af9, 0x9afa, 0x9afb, 0x9afc, 0x9afd, 0x9afe, 0x9b40, 0x9b41, 0x9b42, 0x9b43, 0x9b44, 0x9b45, 0x9b46, 0x9b47, 0x9b48, 0x9b49, 0x9b4a, 0x9b4b, 0x9b4c, 0x9b4d, 0x9b4e, 0x9b4f, 0x9b50, 0x9b51, 0x9b52, 0x9b53, 0x9b54, 0x9b55, 0x9b56, 0x9b57, 0x9b58, 0x9b59, 0x9b5a, 0x9b5b, 0x9b5c, 0x9b5d, 0x9b5e, 0x9b5f, 0x9b60, 0x9b61, 0x9b62, 0x9b63, 0x9b64, 0x9b65, 0x9b66, 0x9b67, 0x9b68, 0x9b69, 0x9b6a, 0x9b6b, 0x9b6c, 0x9b6d, 0x9b6e, 0x9b6f, 0x9b70, 0x9b71, 0x9b72, 0x9b73, 0x9b74, 0x9b75, 0xeff9, 0x9b77, 0xc5f7, 0x9b79, 0x9b7a, 0xf5e8, 0x9b7c, 0x9b7d, 0x9b7e, 0x9ba1, 0x9ba2, 0x9ba3, 0x9ba4, 0x9ba5, 0x9ba6, 0x9ba7, 0x9ba8, 0x9ba9, 0x9baa, 0x9bab, 0x9bac, 0x9bad, 0x9bae, 0x9baf, 0x9bb0, 0x9bb1, 0x9bb2, 0x9bb3, 0x9bb4, 0x9bb5, 0x9bb6, 0x9bb7, 0x9bb8, 0x9bb9, 0x9bba, 0x9bbb, 0x9bbc, 0x9bbd, 0x9bbe, 0x9bbf, 0x9bc0, 0x9bc1, 0x9bc2, 0x9bc3, 0x9bc4, 0x9bc5, 0xe8cd, 0x9bc7, 0x9bc8, 0x9bc9, 0x9bca, 0x9bcb, 0x9bcc, 0x9bcd, 0x9bce, 0x9bcf, 0x9bd0, 0x9bd1, 0x9bd2, 0x9bd3, 0x9bd4, 0x9bd5, 0x9bd6, 0x9bd7, 0x9bd8, 0x9bd9, 0x9bda, 0x9bdb, 0x9bdc, 0x9bdd, 0xd0c0, 0x9bdf, 0x9be0, 0x9be1, 0x9be2, 0x9be3, 0x9be4, 0x9be5, 0x9be6, 0x9be7, 0x9be8, 0x9be9, 0x9bea, 0x9beb, 0xfd64, 0x9bed, 0x9bee, 0x9bef, 0x9bf0, 0x9bf1, 0x9bf2, 0x9bf3, 0x9bf4, 0x9bf5, 0xbf47, 0x9bf7, 0x9bf8, 0x9bf9, 0x9bfa, 0x9bfb, 0x9bfc, 0x9bfd, 0x9bfe, 0x9c40, 0x9c41, 0xebc9, 0x9c43, 0x9c44, 0x9c45, 0x9c46, 0x9c47, 0x9c48, 0x9c49, 0x9c4a, 0x9c4b, 0x9c4c, 0x9c4d, 0x9c4e, 0x9c4f, 0x9c50, 0x9c51, 0x9c52, 0xcde7, 0x9c54, 0x9c55, 0x9c56, 0x9c57, 0x9c58, 0x9c59, 0x9c5a, 0x9c5b, 0x9c5c, 0x9c5d, 0x9c5e, 0x9c5f, 0x9c60, 0x9c61, 0xc0e7, 0x9c63, 0x9c64, 0x9c65, 0x9c66, 0x9c67, 0xdc52, 0x9c69, 0x9c6a, 0xf86d, 0x9c6c, 0x9c6d, 0x9c6e, 0x9c6f, 0x9c70, 0x9c71, 0x9c72, 0x9c73, 0x9c74, 0x9c75, 0x9c76, 0xdb5d, 0x9c78, 0x9c79, 0x9c7a, 0x9c7b, 0x9c7c, 0x9c7d, 0x9c7e, 0x9ca1, 0x9ca2, 0x9ca3, 0x9ca4, 0x9ca5, 0x9ca6, 0x9ca7, 0x9ca8, 0x9ca9, 0x9caa, 0x9cab, 0x9cac, 0x9cad, 0x9cae, 0x9caf, 0x9cb0, 0x9cb1, 0x9cb2, 0x9cb3, 0x9cb4, 0x9cb5, 0x9cb6, 0x9cb7, 0x9cb8, 0x9cb9, 0x9cba, 0x9cbb, 0xc95c, 0xafb0, 0x9cbe, 0x9cbf, 0x9cc0, 0x9cc1, 0x9cc2, 0x9cc3, 0x9cc4, 0x9cc5, 0x9cc6, 0x9cc7, 0x9cc8, 0x9cc9, 0x9cca, 0x9ccb, 0x9ccc, 0x9ccd, 0x9cce, 0x9ccf, 0xd4d1, 0x9cd1, 0x9cd2, 0x9cd3, 0x9cd4, 0x9cd5, 0x9cd6, 0x9cd7, 0x9cd8, 0x9cd9, 0x9cda, 0x9cdb, 0x9cdc, 0x9cdd, 0x9cde, 0x9cdf, 0x9ce0, 0x9ce1, 0x9ce2, 0x9ce3, 0x9ce4, 0x9ce5, 0x9ce6, 0x9ce7, 0x9ce8, 0x9ce9, 0x9cea, 0x9ceb, 0x9cec, 0x9ced, 0x9cee, 0x9cef, 0x9cf0, 0x9cf1, 0x9cf2, 0x9cf3, 0x9cf4, 0x9cf5, 0x9cf6, 0x9cf7, 0x9cf8, 0x9cf9, 0x9cfa, 0x9cfb, 0x9cfc, 0x9cfd, 0x9cfe, 0x9d40, 0x9d41, 0x9d42, 0x9d43, 0x9d44, 0x9d45, 0x9d46, 0x9d47, 0x9d48, 0x9d49, 0x9d4a, 0x9d4b, 0x9d4c, 0x9d4d, 0x9d4e, 0x9d4f, 0x9d50, 0x9d51, 0x9d52, 0x9d53, 0x9d54, 0x9d55, 0x9d56, 0xe07c, 0x9d58, 0x9d59, 0xb5ae, 0x9d5b, 0x9d5c, 0x9d5d, 0x9d5e, 0x9d5f, 0x9d60, 0x9d61, 0x9d62, 0x9d63, 0x9d64, 0x9d65, 0x9d66, 0x9d67, 0x9d68, 0x9d69, 0x9d6a, 0x9d6b, 0x9d6c, 0x9d6d, 0x9d6e, 0x9d6f, 0x9d70, 0x9d71, 0x9d72, 0x9d73, 0x9d74, 0x9d75, 0x9d76, 0x9d77, 0x9d78, 0x9d79, 0x9d7a, 0x9d7b, 0x9d7c, 0x9d7d, 0x9d7e, 0x9da1, 0x9da2, 0x9da3, 0x9da4, 0x9da5, 0x9da6, 0x9da7, 0x9da8, 0x9da9, 0x9daa, 0x9dab, 0x9dac, 0x9dad, 0x9dae, 0x9daf, 0x9db0, 0x9db1, 0x9db2, 0x9db3, 0x9db4, 0x9db5, 0x9db6, 0x9db7, 0x9db8, 0x9db9, 0x9dba, 0x9dbb, 0x9dbc, 0x9dbd, 0x9dbe, 0x9dbf, 0x9dc0, 0x9dc1, 0x9dc2, 0x9dc3, 0xa9e4, 0x9dc5, 0x9dc6, 0x9dc7, 0x9dc8, 0x9dc9, 0x9dca, 0x9dcb, 0x9dcc, 0x9dcd, 0x9dce, 0x9dcf, 0x9dd0, 0x9dd1, 0x9dd2, 0x9dd3, 0x9dd4, 0x9dd5, 0x9dd6, 0x9dd7, 0x9dd8, 0x9dd9, 0x9dda, 0x9ddb, 0x9ddc, 0x9ddd, 0x9dde, 0x9ddf, 0x9de0, 0x9de1, 0x9de2, 0x9de3, 0x9de4, 0x9de5, 0x9de6, 0x9de7, 0x9de8, 0x9de9, 0x9dea, 0x9deb, 0x9dec, 0x9ded, 0x9dee, 0x9def, 0x9df0, 0x9df1, 0x9df2, 0x9df3, 0x9df4, 0x9df5, 0x9df6, 0x9df7, 0x9df8, 0x9df9, 0x9dfa, 0x9dfb, 0x9dfc, 0x9dfd, 0x9dfe, 0x9e40, 0x9e41, 0x9e42, 0x9e43, 0x9e44, 0x9e45, 0x9e46, 0x9e47, 0x9e48, 0x9e49, 0x9e4a, 0x9e4b, 0x9e4c, 0x9e4d, 0x9e4e, 0x9e4f, 0x9e50, 0x9e51, 0x9e52, 0x9e53, 0x9e54, 0x9e55, 0x9e56, 0x9e57, 0x9e58, 0x9e59, 0x9e5a, 0x9e5b, 0x9e5c, 0x9e5d, 0x9e5e, 0x9e5f, 0x9e60, 0x9e61, 0x9e62, 0x9e63, 0x9e64, 0x9e65, 0x9e66, 0x9e67, 0x9e68, 0x9e69, 0x9e6a, 0x9e6b, 0x9e6c, 0x9e6d, 0x9e6e, 0x9e6f, 0x9e70, 0x9e71, 0x9e72, 0x9e73, 0x9e74, 0x9e75, 0x9e76, 0x9e77, 0x9e78, 0x9e79, 0x9e7a, 0x9e7b, 0x9e7c, 0x9e7d, 0x9e7e, 0x9ea1, 0x9ea2, 0x9ea3, 0x9ea4, 0x9ea5, 0x9ea6, 0x9ea7, 0x9ea8, 0xabec, 0x9eaa, 0x9eab, 0x9eac, 0x9ead, 0x9eae, 0x9eaf, 0x9eb0, 0x9eb1, 0x9eb2, 0x9eb3, 0x9eb4, 0x9eb5, 0x9eb6, 0x9eb7, 0x9eb8, 0x9eb9, 0x9eba, 0x9ebb, 0x9ebc, 0x9ebd, 0x9ebe, 0x9ebf, 0x9ec0, 0x9ec1, 0x9ec2, 0x9ec3, 0x9ec4, 0x9ec5, 0x9ec6, 0x9ec7, 0x9ec8, 0x9ec9, 0x9eca, 0x9ecb, 0x9ecc, 0x9ecd, 0x9ece, 0x9ecf, 0x9ed0, 0x9ed1, 0x9ed2, 0x9ed3, 0x9ed4, 0x9ed5, 0x9ed6, 0x9ed7, 0x9ed8, 0x9ed9, 0x9eda, 0x9edb, 0x9edc, 0x9edd, 0x9ede, 0x9edf, 0x9ee0, 0x9ee1, 0x9ee2, 0x9ee3, 0x9ee4, 0x9ee5, 0x9ee6, 0x9ee7, 0x9ee8, 0x9ee9, 0x9eea, 0x9eeb, 0x9eec, 0x9eed, 0x9eee, 0xdecd, 0x9ef0, 0x9ef1, 0x9ef2, 0x9ef3, 0x9ef4, 0x9ef5, 0x9ef6, 0x9ef7, 0x9ef8, 0x9ef9, 0x9efa, 0x9efb, 0x9efc, 0xc9fc, 0x9efe, 0x9f40, 0x9f41, 0x9f42, 0x9f43, 0x9f44, 0x9f45, 0x9f46, 0x9f47, 0x9f48, 0x9f49, 0x9f4a, 0x9f4b, 0x9f4c, 0x9f4d, 0x9f4e, 0x9f4f, 0x9f50, 0x9f51, 0x9f52, 0x9f53, 0x9f54, 0x9f55, 0x9f56, 0x9f57, 0x9f58, 0x9f59, 0x9f5a, 0x9f5b, 0x9f5c, 0x9f5d, 0x9f5e, 0x9f5f, 0xf9c4, 0x9f61, 0x9f62, 0x9f63, 0x9f64, 0x9f65, 0x91be, 0x9f67, 0x9f68, 0x9f69, 0x9f6a, 0x9f6b, 0x9f6c, 0x9f6d, 0x9f6e, 0x9f6f, 0x9f70, 0x9f71, 0x9f72, 0x9f73, 0x9f74, 0x9f75, 0x9f76, 0x9f77, 0x9f78, 0x9f79, 0x9f7a, 0x9f7b, 0x9f7c, 0x9f7d, 0x9f7e, 0x9fa1, 0x9fa2, 0x9fa3, 0x9fa4, 0x9fa5, 0x9fa6, 0x9fa7, 0x9fa8, 0x9fa9, 0x9faa, 0x9fab, 0x9fac, 0x9fad, 0x9fae, 0x9faf, 0x9fb0, 0x9fb1, 0x9fb2, 0x9fb3, 0x9fb4, 0x9fb5, 0x9fb6, 0x9fb7, 0x9fb8, 0x9fb9, 0x9fba, 0x9fbb, 0x9fbc, 0x9fbd, 0x9fbe, 0x9fbf, 0x9fc0, 0x9fc1, 0x9fc2, 0x9fc3, 0x9fc4, 0x9fc5, 0x9fc6, 0x9fc7, 0x9fc8, 0x9fc9, 0x9fca, 0xb9b0, 0x9fcc, 0x9fcd, 0x9fce, 0x9fcf, 0x9fd0, 0x9fd1, 0x9fd2, 0x9fd3, 0x9fd4, 0x9fd5, 0x9fd6, 0x9fd7, 0x9361, 0x9fd9, 0x9fda, 0x9fdb, 0x9fdc, 0x9fdd, 0x9fde, 0x9fdf, 0x9fe0, 0x9fe1, 0x9fe2, 0x9fe3, 0x9fe4, 0x9fe5, 0x9fe6, 0x9fe7, 0x9fe8, 0x9fe9, 0x9fea, 0x9feb, 0x9fec, 0x9fed, 0x9fee, 0x9fef, 0x9ff0, 0x9ff1, 0x9ff2, 0x9ff3, 0x9ff4, 0x9ff5, 0x9ff6, 0x9ff7, 0x9ff8, 0x9ff9, 0x9ffa, 0x9ffb, 0x9ffc, 0x9ffd, 0x9ffe, 0xa040, 0xa041, 0xa042, 0xa043, 0xa044, 0xa045, 0xa046, 0xa047, 0xa048, 0xa049, 0xa04a, 0xa04b, 0xa04c, 0xa04d, 0xa04e, 0xa04f, 0xa050, 0xa051, 0xa052, 0xa053, 0xa054, 0xa055, 0xa056, 0xa057, 0xa058, 0xa059, 0xa05a, 0xa05b, 0xa05c, 0xa05d, 0xa05e, 0xa05f, 0xa060, 0xa061, 0xa062, 0x8fb6, 0xa064, 0xa065, 0xa066, 0xa067, 0xa068, 0xa069, 0xa06a, 0xa06b, 0xa06c, 0xa06d, 0xa06e, 0xa06f, 0xa070, 0xa071, 0xa072, 0xa073, 0xa074, 0xa075, 0xa076, 0xa9f0, 0xa078, 0xa079, 0xa07a, 0xa07b, 0xa07c, 0xa07d, 0xa07e, 0xa0a1, 0xa0a2, 0xa0a3, 0xa0a4, 0xa0a5, 0xa0a6, 0xa0a7, 0xa0a8, 0xa0a9, 0xa0aa, 0xa0ab, 0xa0ac, 0xa0ad, 0xa0ae, 0xa0af, 0xa0b0, 0xa0b1, 0xa0b2, 0xa0b3, 0xa0b4, 0xa0b5, 0xa0b6, 0xa0b7, 0xa0b8, 0xa0b9, 0xa0ba, 0xa0bb, 0xa0bc, 0xa0bd, 0xa0be, 0xa0bf, 0xa0c0, 0xa0c1, 0xa0c2, 0xa0c3, 0xa0c4, 0xa0c5, 0xa0c6, 0xa0c7, 0xa0c8, 0xa0c9, 0xa0ca, 0xa0cb, 0xa0cc, 0xa0cd, 0xa0ce, 0xa0cf, 0xa0d0, 0xa0d1, 0xa0d2, 0xa0d3, 0xa0d4, 0x947a, 0xa0d6, 0xa0d7, 0xa0d8, 0xa0d9, 0xa0da, 0xa0db, 0xa0dc, 0xa0dd, 0xa0de, 0xde72, 0xa0e0, 0xa0e1, 0xa0e2, 0xa0e3, 0x9455, 0xa0e5, 0xa0e6, 0xa0e7, 0xa0e8, 0xa0e9, 0xa0ea, 0xa0eb, 0xa0ec, 0xa0ed, 0xa0ee, 0xa0ef, 0xa0f0, 0xa0f1, 0xa0f2, 0xa0f3, 0xa0f4, 0xa0f5, 0xa0f6, 0xa0f7, 0xa0f8, 0xa0f9, 0xa0fa, 0xa0fb, 0xa0fc, 0xa0fd, 0xa0fe, 0x8140, 0x8141, 0x8142, 0x8143, 0x8144, 0x8145, 0x8146, 0x8147, 0x8148, 0x8149, 0x814a, 0x814b, 0x814c, 0x814d, 0x814e, 0x814f, 0x8150, 0x8151, 0x8152, 0x8153, 0x8154, 0x8155, 0x8156, 0x8157, 0x8158, 0x8159, 0x815a, 0x815b, 0x815c, 0x815d, 0x815e, 0x815f, 0x8160, 0x8161, 0x8162, 0x8163, 0x8164, 0x8165, 0x8166, 0x8167, 0x8168, 0x8169, 0x816a, 0x816b, 0x816c, 0x816d, 0x816e, 0x816f, 0x8170, 0x8171, 0x8172, 0x8173, 0x8174, 0x8175, 0x8176, 0x8177, 0x8178, 0x8179, 0x817a, 0x817b, 0x817c, 0x817d, 0x817e, 0x81a1, 0x81a2, 0x81a3, 0x81a4, 0x81a5, 0x81a6, 0x81a7, 0x81a8, 0x81a9, 0x81aa, 0x81ab, 0x81ac, 0x81ad, 0x81ae, 0x81af, 0x81b0, 0x81b1, 0x81b2, 0x81b3, 0x81b4, 0x81b5, 0x81b6, 0x81b7, 0x81b8, 0x81b9, 0x81ba, 0x81bb, 0x81bc, 0x81bd, 0x81be, 0x81bf, 0x81c0, 0x81c1, 0x81c2, 0x81c3, 0x81c4, 0x81c5, 0x81c6, 0x81c7, 0x81c8, 0x81c9, 0x81ca, 0x81cb, 0x81cc, 0x81cd, 0x81ce, 0x81cf, 0x81d0, 0x81d1, 0x81d2, 0x81d3, 0x81d4, 0x81d5, 0x81d6, 0x81d7, 0x81d8, 0x81d9, 0x81da, 0x81db, 0x81dc, 0x81dd, 0x81de, 0x81df, 0x81e0, 0x81e1, 0x81e2, 0x81e3, 0x81e4, 0x81e5, 0x81e6, 0x81e7, 0x81e8, 0x81e9, 0x81ea, 0x81eb, 0x81ec, 0x81ed, 0x81ee, 0x81ef, 0x81f0, 0x81f1, 0x81f2, 0x81f3, 0x81f4, 0x81f5, 0x81f6, 0x81f7, 0x81f8, 0x81f9, 0x81fa, 0x81fb, 0x81fc, 0x81fd, 0x81fe, 0x8240, 0x8241, 0x8242, 0x8243, 0x8244, 0x8245, 0x8246, 0x8247, 0x8248, 0x8249, 0x824a, 0x824b, 0x824c, 0x824d, 0x824e, 0x824f, 0x8250, 0x8251, 0x8252, 0x8253, 0x8254, 0x8255, 0x8256, 0x8257, 0x8258, 0x8259, 0x825a, 0x825b, 0x825c, 0x825d, 0x825e, 0x825f, 0x8260, 0x8261, 0x8262, 0x8263, 0x8264, 0x8265, 0x8266, 0x8267, 0x8268, 0x8269, 0x826a, 0x826b, 0x826c, 0x826d, 0x826e, 0x826f, 0x8270, 0x8271, 0x8272, 0x8273, 0x8274, 0x8275, 0x8276, 0x8277, 0x8278, 0x8279, 0x827a, 0x827b, 0x827c, 0x827d, 0x827e, 0x82a1, 0x82a2, 0x82a3, 0x82a4, 0x82a5, 0x82a6, 0x82a7, 0x82a8, 0x82a9, 0x82aa, 0x82ab, 0x82ac, 0x82ad, 0x82ae, 0x82af, 0x82b0, 0x82b1, 0x82b2, 0x82b3, 0x82b4, 0x82b5, 0x82b6, 0x82b7, 0x82b8, 0x82b9, 0x82ba, 0x82bb, 0x82bc, 0x82bd, 0x82be, 0x82bf, 0x82c0, 0x82c1, 0x82c2, 0x82c3, 0x82c4, 0x82c5, 0x82c6, 0x82c7, 0x82c8, 0x82c9, 0x82ca, 0x82cb, 0x82cc, 0x82cd, 0x82ce, 0x82cf, 0x82d0, 0x82d1, 0x82d2, 0x82d3, 0x82d4, 0x82d5, 0x82d6, 0x82d7, 0x82d8, 0x82d9, 0x82da, 0x82db, 0x82dc, 0x82dd, 0x82de, 0x82df, 0x82e0, 0x82e1, 0x82e2, 0x82e3, 0x82e4, 0x82e5, 0x82e6, 0x82e7, 0x82e8, 0x82e9, 0x82ea, 0x82eb, 0x82ec, 0x82ed, 0x82ee, 0x82ef, 0x82f0, 0x82f1, 0x82f2, 0x82f3, 0x82f4, 0x82f5, 0x82f6, 0x82f7, 0x82f8, 0x82f9, 0x82fa, 0x82fb, 0x82fc, 0x82fd, 0x82fe, 0x8340, 0x8341, 0x8342, 0x8343, 0x8344, 0x8345, 0x8346, 0x8347, 0x8348, 0x8349, 0x834a, 0x834b, 0x834c, 0x834d, 0x834e, 0x834f, 0x8350, 0x8351, 0x8352, 0x8353, 0x8354, 0x8355, 0x8356, 0x8357, 0x8358, 0x8359, 0x835a, 0x835b, 0x835c, 0x835d, 0x835e, 0x835f, 0x8360, 0x8361, 0x8362, 0x8363, 0x8364, 0x8365, 0x8366, 0x8367, 0x8368, 0x8369, 0x836a, 0x836b, 0x836c, 0x836d, 0x836e, 0x836f, 0x8370, 0x8371, 0x8372, 0x8373, 0x8374, 0x8375, 0x8376, 0x8377, 0x8378, 0x8379, 0x837a, 0x837b, 0x837c, 0x837d, 0x837e, 0x83a1, 0x83a2, 0x83a3, 0x83a4, 0x83a5, 0x83a6, 0x83a7, 0x83a8, 0x83a9, 0x83aa, 0x83ab, 0x83ac, 0x83ad, 0x83ae, 0x83af, 0x83b0, 0x83b1, 0x83b2, 0x83b3, 0x83b4, 0x83b5, 0x83b6, 0x83b7, 0x83b8, 0x83b9, 0x83ba, 0x83bb, 0x83bc, 0x83bd, 0x83be, 0x83bf, 0x83c0, 0x83c1, 0x83c2, 0x83c3, 0x83c4, 0x83c5, 0x83c6, 0x83c7, 0x83c8, 0x83c9, 0x83ca, 0x83cb, 0x83cc, 0x83cd, 0x83ce, 0x83cf, 0x83d0, 0x83d1, 0x83d2, 0x83d3, 0x83d4, 0x83d5, 0x83d6, 0x83d7, 0x83d8, 0x83d9, 0x83da, 0x83db, 0x83dc, 0x83dd, 0x83de, 0x83df, 0x83e0, 0x83e1, 0x83e2, 0x83e3, 0x83e4, 0x83e5, 0x83e6, 0x83e7, 0x83e8, 0x83e9, 0x83ea, 0x83eb, 0x83ec, 0x83ed, 0x83ee, 0x83ef, 0x83f0, 0x83f1, 0x83f2, 0x83f3, 0x83f4, 0x83f5, 0x83f6, 0x83f7, 0x83f8, 0x83f9, 0x83fa, 0x83fb, 0x83fc, 0x83fd, 0x83fe, 0x8440, 0x8441, 0x8442, 0x8443, 0x8444, 0x8445, 0x8446, 0x8447, 0x8448, 0x8449, 0x844a, 0x844b, 0x844c, 0x844d, 0x844e, 0x844f, 0x8450, 0x8451, 0x8452, 0x8453, 0x8454, 0x8455, 0x8456, 0x8457, 0x8458, 0x8459, 0x845a, 0x845b, 0x845c, 0x845d, 0x845e, 0x845f, 0x8460, 0x8461, 0x8462, 0x8463, 0x8464, 0x8465, 0x8466, 0x8467, 0x8468, 0x8469, 0x846a, 0x846b, 0x846c, 0x846d, 0x846e, 0x846f, 0x8470, 0x8471, 0x8472, 0x8473, 0x8474, 0x8475, 0x8476, 0x8477, 0x8478, 0x8479, 0x847a, 0x847b, 0x847c, 0x847d, 0x847e, 0x84a1, 0x84a2, 0x84a3, 0x84a4, 0x84a5, 0x84a6, 0x84a7, 0x84a8, 0x84a9, 0x84aa, 0x84ab, 0x84ac, 0x84ad, 0x84ae, 0x84af, 0x84b0, 0x84b1, 0x84b2, 0x84b3, 0x84b4, 0x84b5, 0x84b6, 0x84b7, 0x84b8, 0x84b9, 0x84ba, 0x84bb, 0x84bc, 0x84bd, 0x84be, 0x84bf, 0x84c0, 0x84c1, 0x84c2, 0x84c3, 0x84c4, 0x84c5, 0x84c6, 0x84c7, 0x84c8, 0x84c9, 0x84ca, 0x84cb, 0x84cc, 0x84cd, 0x84ce, 0x84cf, 0x84d0, 0x84d1, 0x84d2, 0x84d3, 0x84d4, 0x84d5, 0x84d6, 0x84d7, 0x84d8, 0x84d9, 0x84da, 0x84db, 0x84dc, 0x84dd, 0x84de, 0x84df, 0x84e0, 0x84e1, 0x84e2, 0x84e3, 0x84e4, 0x84e5, 0x84e6, 0x84e7, 0x84e8, 0x84e9, 0x84ea, 0x84eb, 0x84ec, 0x84ed, 0x84ee, 0x84ef, 0x84f0, 0x84f1, 0x84f2, 0x84f3, 0x84f4, 0x84f5, 0x84f6, 0x84f7, 0x84f8, 0x84f9, 0x84fa, 0x84fb, 0x84fc, 0x84fd, 0x84fe, 0x8540, 0x8541, 0x8542, 0x8543, 0x8544, 0x8545, 0x8546, 0x8547, 0x8548, 0x8549, 0x854a, 0x854b, 0x854c, 0x854d, 0x854e, 0x854f, 0x8550, 0x8551, 0x8552, 0x8553, 0x8554, 0x8555, 0x8556, 0x8557, 0x8558, 0x8559, 0x855a, 0x855b, 0x855c, 0x855d, 0x855e, 0x855f, 0x8560, 0x8561, 0x8562, 0x8563, 0x8564, 0x8565, 0x8566, 0x8567, 0x8568, 0x8569, 0x856a, 0x856b, 0x856c, 0x856d, 0x856e, 0x856f, 0x8570, 0x8571, 0x8572, 0x8573, 0x8574, 0x8575, 0x8576, 0x8577, 0x8578, 0x8579, 0x857a, 0x857b, 0x857c, 0x857d, 0x857e, 0x85a1, 0x85a2, 0x85a3, 0x85a4, 0x85a5, 0x85a6, 0x85a7, 0x85a8, 0x85a9, 0x85aa, 0x85ab, 0x85ac, 0x85ad, 0x85ae, 0x85af, 0x85b0, 0x85b1, 0x85b2, 0x85b3, 0x85b4, 0x85b5, 0x85b6, 0x85b7, 0x85b8, 0x85b9, 0x85ba, 0x85bb, 0x85bc, 0x85bd, 0x85be, 0x85bf, 0x85c0, 0x85c1, 0x85c2, 0x85c3, 0x85c4, 0x85c5, 0x85c6, 0x85c7, 0x85c8, 0x85c9, 0x85ca, 0x85cb, 0x85cc, 0x85cd, 0x85ce, 0x85cf, 0x85d0, 0x85d1, 0x85d2, 0x85d3, 0x85d4, 0x85d5, 0x85d6, 0x85d7, 0x85d8, 0x85d9, 0x85da, 0x85db, 0x85dc, 0x85dd, 0x85de, 0x85df, 0x85e0, 0x85e1, 0x85e2, 0x85e3, 0x85e4, 0x85e5, 0x85e6, 0x85e7, 0x85e8, 0x85e9, 0x85ea, 0x85eb, 0x85ec, 0x85ed, 0x85ee, 0x85ef, 0x85f0, 0x85f1, 0x85f2, 0x85f3, 0x85f4, 0x85f5, 0x85f6, 0x85f7, 0x85f8, 0x85f9, 0x85fa, 0x85fb, 0x85fc, 0x85fd, 0x85fe, 0x8640, 0x8641, 0x8642, 0x8643, 0x8644, 0x8645, 0x8646, 0x8647, 0x8648, 0x8649, 0x864a, 0x864b, 0x864c, 0x864d, 0x864e, 0x864f, 0x8650, 0x8651, 0x8652, 0x8653, 0x8654, 0x8655, 0x8656, 0x8657, 0x8658, 0x8659, 0x865a, 0x865b, 0x865c, 0x865d, 0x865e, 0x865f, 0x8660, 0x8661, 0x8662, 0x8663, 0x8664, 0x8665, 0x8666, 0x8667, 0x8668, 0x8669, 0x866a, 0x866b, 0x866c, 0x866d, 0x866e, 0x866f, 0x8670, 0x8671, 0x8672, 0x8673, 0x8674, 0x8675, 0x8676, 0x8677, 0x8678, 0x8679, 0x867a, 0x867b, 0x867c, 0x867d, 0x867e, 0x86a1, 0x86a2, 0x86a3, 0x86a4, 0x86a5, 0x86a6, 0x86a7, 0x86a8, 0x86a9, 0x86aa, 0x86ab, 0x86ac, 0x86ad, 0x86ae, 0x86af, 0x86b0, 0x86b1, 0x86b2, 0x86b3, 0x86b4, 0x86b5, 0x86b6, 0x86b7, 0x86b8, 0x86b9, 0x86ba, 0x86bb, 0x86bc, 0x86bd, 0x86be, 0x86bf, 0x86c0, 0x86c1, 0x86c2, 0x86c3, 0x86c4, 0x86c5, 0x86c6, 0x86c7, 0x86c8, 0x86c9, 0x86ca, 0x86cb, 0x86cc, 0x86cd, 0x86ce, 0x86cf, 0x86d0, 0x86d1, 0x86d2, 0x86d3, 0x86d4, 0x86d5, 0x86d6, 0x86d7, 0x86d8, 0x86d9, 0x86da, 0x86db, 0x86dc, 0x86dd, 0x86de, 0x86df, 0x86e0, 0x86e1, 0x86e2, 0x86e3, 0x86e4, 0x86e5, 0x86e6, 0x86e7, 0x86e8, 0x86e9, 0x86ea, 0x86eb, 0x86ec, 0x86ed, 0x86ee, 0x86ef, 0x86f0, 0x86f1, 0x86f2, 0x86f3, 0x86f4, 0x86f5, 0x86f6, 0x86f7, 0x86f8, 0x86f9, 0x86fa, 0x86fb, 0x86fc, 0x86fd, 0x86fe, 0x8740, 0x8741, 0x8742, 0x8743, 0x8744, 0x8745, 0x8746, 0x8747, 0x8748, 0x8749, 0x874a, 0x874b, 0x874c, 0x874d, 0x874e, 0x874f, 0x8750, 0x8751, 0x8752, 0x8753, 0x8754, 0x8755, 0x8756, 0x8757, 0x8758, 0x8759, 0x875a, 0x875b, 0x875c, 0x875d, 0x875e, 0x875f, 0x8760, 0x8761, 0x8762, 0x8763, 0x8764, 0x8765, 0x8766, 0x8767, 0x8768, 0x8769, 0x876a, 0x876b, 0x876c, 0x876d, 0x876e, 0x876f, 0x8770, 0x8771, 0x8772, 0x8773, 0x8774, 0x8775, 0x8776, 0x8777, 0x8778, 0x8779, 0x877a, 0x877b, 0x877c, 0x877d, 0x877e, 0x87a1, 0x87a2, 0x87a3, 0x87a4, 0x87a5, 0x87a6, 0x87a7, 0x87a8, 0x87a9, 0x87aa, 0x87ab, 0x87ac, 0x87ad, 0x87ae, 0x87af, 0x87b0, 0x87b1, 0x87b2, 0x87b3, 0x87b4, 0x87b5, 0x87b6, 0x87b7, 0x87b8, 0x87b9, 0x87ba, 0x87bb, 0x87bc, 0x87bd, 0x87be, 0x87bf, 0x87c0, 0x87c1, 0x87c2, 0x87c3, 0x87c4, 0x87c5, 0x87c6, 0x87c7, 0x87c8, 0x87c9, 0x87ca, 0x87cb, 0x87cc, 0x87cd, 0x87ce, 0x87cf, 0x87d0, 0x87d1, 0x87d2, 0x87d3, 0x87d4, 0x87d5, 0x87d6, 0x87d7, 0x87d8, 0x87d9, 0x87da, 0x87db, 0x87dc, 0x87dd, 0x87de, 0x87df, 0x87e0, 0x87e1, 0x87e2, 0x87e3, 0x87e4, 0x87e5, 0x87e6, 0x87e7, 0x87e8, 0x87e9, 0x87ea, 0x87eb, 0x87ec, 0x87ed, 0x87ee, 0x87ef, 0x87f0, 0x87f1, 0x87f2, 0x87f3, 0x87f4, 0x87f5, 0x87f6, 0x87f7, 0x87f8, 0x87f9, 0x87fa, 0x87fb, 0x87fc, 0x87fd, 0x87fe, 0x8840, 0x8841, 0x8842, 0x8843, 0x8844, 0x8845, 0x8846, 0x8847, 0x8848, 0x8849, 0x884a, 0x884b, 0x884c, 0x884d, 0x884e, 0x884f, 0x8850, 0x8851, 0x8852, 0x8853, 0x8854, 0x8855, 0x8856, 0x8857, 0x8858, 0x8859, 0x885a, 0x885b, 0x885c, 0x885d, 0x885e, 0x885f, 0x8860, 0x8861, 0x8862, 0x8863, 0x8864, 0x8865, 0x8866, 0x8867, 0x8868, 0x8869, 0x886a, 0x886b, 0x886c, 0x886d, 0x886e, 0x886f, 0x8870, 0x8871, 0x8872, 0x8873, 0x8874, 0x8875, 0x8876, 0x8877, 0x8878, 0x8879, 0x887a, 0x887b, 0x887c, 0x887d, 0x887e, 0x88a1, 0x88a2, 0x88a3, 0x88a4, 0x88a5, 0x88a6, 0x88a7, 0x88a8, 0x88a9, 0x88aa, 0x88ab, 0x88ac, 0x88ad, 0x88ae, 0x88af, 0x88b0, 0x88b1, 0x88b2, 0x88b3, 0x88b4, 0x88b5, 0x88b6, 0x88b7, 0x88b8, 0x88b9, 0x88ba, 0x88bb, 0x88bc, 0x88bd, 0x88be, 0x88bf, 0x88c0, 0x88c1, 0x88c2, 0x88c3, 0x88c4, 0x88c5, 0x88c6, 0x88c7, 0x88c8, 0x88c9, 0x88ca, 0x88cb, 0x88cc, 0x88cd, 0x88ce, 0x88cf, 0x88d0, 0x88d1, 0x88d2, 0x88d3, 0x88d4, 0x88d5, 0x88d6, 0x88d7, 0x88d8, 0x88d9, 0x88da, 0x88db, 0x88dc, 0x88dd, 0x88de, 0x88df, 0x88e0, 0x88e1, 0x88e2, 0x88e3, 0x88e4, 0x88e5, 0x88e6, 0x88e7, 0x88e8, 0x88e9, 0x88ea, 0x88eb, 0x88ec, 0x88ed, 0x88ee, 0x88ef, 0x88f0, 0x88f1, 0x88f2, 0x88f3, 0x88f4, 0x88f5, 0x88f6, 0x88f7, 0x88f8, 0x88f9, 0x88fa, 0x88fb, 0x88fc, 0x88fd, 0x88fe, 0x8940, 0x8941, 0x8942, 0x8943, 0x8944, 0x8945, 0x8946, 0x8947, 0x8948, 0x8949, 0x894a, 0x894b, 0x894c, 0x894d, 0x894e, 0x894f, 0x8950, 0x8951, 0x8952, 0x8953, 0x8954, 0x8955, 0x8956, 0x8957, 0x8958, 0x8959, 0x895a, 0x895b, 0x895c, 0x895d, 0x895e, 0x895f, 0x8960, 0x8961, 0x8962, 0x8963, 0x8964, 0x8965, 0x8966, 0x8967, 0x8968, 0x8969, 0x896a, 0x896b, 0x896c, 0x896d, 0x896e, 0x896f, 0x8970, 0x8971, 0x8972, 0x8973, 0x8974, 0x8975, 0x8976, 0x8977, 0x8978, 0x8979, 0x897a, 0x897b, 0x897c, 0x897d, 0x897e, 0x89a1, 0x89a2, 0x89a3, 0x89a4, 0x89a5, 0x89a6, 0x89a7, 0x89a8, 0x89a9, 0x89aa, 0x89ab, 0x89ac, 0x89ad, 0x89ae, 0x89af, 0x89b0, 0x89b1, 0x89b2, 0x89b3, 0x89b4, 0x89b5, 0x89b6, 0x89b7, 0x89b8, 0x89b9, 0x89ba, 0x89bb, 0x89bc, 0x89bd, 0x89be, 0x89bf, 0x89c0, 0x89c1, 0x89c2, 0x89c3, 0x89c4, 0x89c5, 0x89c6, 0x89c7, 0x89c8, 0x89c9, 0x89ca, 0x89cb, 0x89cc, 0x89cd, 0x89ce, 0x89cf, 0x89d0, 0x89d1, 0x89d2, 0x89d3, 0x89d4, 0x89d5, 0x89d6, 0x89d7, 0x89d8, 0x89d9, 0x89da, 0x89db, 0x89dc, 0x89dd, 0x89de, 0x89df, 0x89e0, 0x89e1, 0x89e2, 0x89e3, 0x89e4, 0x89e5, 0x89e6, 0x89e7, 0x89e8, 0x89e9, 0x89ea, 0x89eb, 0x89ec, 0x89ed, 0x89ee, 0x89ef, 0x89f0, 0x89f1, 0x89f2, 0x89f3, 0x89f4, 0x89f5, 0x89f6, 0x89f7, 0x89f8, 0x89f9, 0x89fa, 0x89fb, 0x89fc, 0x89fd, 0x89fe, 0x8a40, 0x8a41, 0x8a42, 0x8a43, 0x8a44, 0x8a45, 0x8a46, 0x8a47, 0x8a48, 0x8a49, 0x8a4a, 0x8a4b, 0x8a4c, 0x8a4d, 0x8a4e, 0x8a4f, 0x8a50, 0x8a51, 0x8a52, 0x8a53, 0x8a54, 0x8a55, 0x8a56, 0x8a57, 0x8a58, 0x8a59, 0x8a5a, 0x8a5b, 0x8a5c, 0x8a5d, 0x8a5e, 0x8a5f, 0x8a60, 0x8a61, 0x8a62, 0x8a63, 0x8a64, 0x8a65, 0x8a66, 0x8a67, 0x8a68, 0x8a69, 0x8a6a, 0x8a6b, 0x8a6c, 0x8a6d, 0x8a6e, 0x8a6f, 0x8a70, 0x8a71, 0x8a72, 0x8a73, 0x8a74, 0x8a75, 0x8a76, 0x8a77, 0x8a78, 0x8a79, 0x8a7a, 0x8a7b, 0x8a7c, 0x8a7d, 0x8a7e, 0x8aa1, 0x8aa2, 0x8aa3, 0x8aa4, 0x8aa5, 0x8aa6, 0x8aa7, 0x8aa8, 0x8aa9, 0x8aaa, 0x8aab, 0x8aac, 0x8aad, 0x8aae, 0x8aaf, 0x8ab0, 0x8ab1, 0x8ab2, 0x8ab3, 0x8ab4, 0x8ab5, 0x8ab6, 0x8ab7, 0x8ab8, 0x8ab9, 0x8aba, 0x8abb, 0x8abc, 0x8abd, 0x8abe, 0x8abf, 0x8ac0, 0x8ac1, 0x8ac2, 0x8ac3, 0x8ac4, 0x8ac5, 0x8ac6, 0x8ac7, 0x8ac8, 0x8ac9, 0x8aca, 0x8acb, 0x8acc, 0x8acd, 0x8ace, 0x8acf, 0x8ad0, 0x8ad1, 0x8ad2, 0x8ad3, 0x8ad4, 0x8ad5, 0x8ad6, 0x8ad7, 0x8ad8, 0x8ad9, 0x8ada, 0x8adb, 0x8adc, 0x8add, 0x8ade, 0x8adf, 0x8ae0, 0x8ae1, 0x8ae2, 0x8ae3, 0x8ae4, 0x8ae5, 0x8ae6, 0x8ae7, 0x8ae8, 0x8ae9, 0x8aea, 0x8aeb, 0x8aec, 0x8aed, 0x8aee, 0x8aef, 0x8af0, 0x8af1, 0x8af2, 0x8af3, 0x8af4, 0x8af5, 0x8af6, 0x8af7, 0x8af8, 0x8af9, 0x8afa, 0x8afb, 0x8afc, 0x8afd, 0x8afe, 0x8b40, 0x8b41, 0x8b42, 0x8b43, 0x8b44, 0x8b45, 0x8b46, 0x8b47, 0x8b48, 0x8b49, 0x8b4a, 0x8b4b, 0x8b4c, 0x8b4d, 0x8b4e, 0x8b4f, 0x8b50, 0x8b51, 0x8b52, 0x8b53, 0x8b54, 0x8b55, 0x8b56, 0x8b57, 0x8b58, 0x8b59, 0x8b5a, 0x8b5b, 0x8b5c, 0x8b5d, 0x8b5e, 0x8b5f, 0x8b60, 0x8b61, 0x8b62, 0x8b63, 0x8b64, 0x8b65, 0x8b66, 0x8b67, 0x8b68, 0x8b69, 0x8b6a, 0x8b6b, 0x8b6c, 0x8b6d, 0x8b6e, 0x8b6f, 0x8b70, 0x8b71, 0x8b72, 0x8b73, 0x8b74, 0x8b75, 0x8b76, 0x8b77, 0x8b78, 0x8b79, 0x8b7a, 0x8b7b, 0x8b7c, 0x8b7d, 0x8b7e, 0x8ba1, 0x8ba2, 0x8ba3, 0x8ba4, 0x8ba5, 0x8ba6, 0x8ba7, 0x8ba8, 0x8ba9, 0x8baa, 0x8bab, 0x8bac, 0x8bad, 0x8bae, 0x8baf, 0x8bb0, 0x8bb1, 0x8bb2, 0x8bb3, 0x8bb4, 0x8bb5, 0x8bb6, 0x8bb7, 0x8bb8, 0x8bb9, 0x8bba, 0x8bbb, 0x8bbc, 0x8bbd, 0x8bbe, 0x8bbf, 0x8bc0, 0x8bc1, 0x8bc2, 0x8bc3, 0x8bc4, 0x8bc5, 0x8bc6, 0x8bc7, 0x8bc8, 0x8bc9, 0x8bca, 0x8bcb, 0x8bcc, 0x8bcd, 0x8bce, 0x8bcf, 0x8bd0, 0x8bd1, 0x8bd2, 0x8bd3, 0x8bd4, 0x8bd5, 0x8bd6, 0x8bd7, 0x8bd8, 0x8bd9, 0x8bda, 0x8bdb, 0x8bdc, 0x8bdd, 0x8bde, 0x8bdf, 0x8be0, 0x8be1, 0x8be2, 0x8be3, 0x8be4, 0x8be5, 0x8be6, 0x8be7, 0x8be8, 0x8be9, 0x8bea, 0x8beb, 0x8bec, 0x8bed, 0x8bee, 0x8bef, 0x8bf0, 0x8bf1, 0x8bf2, 0x8bf3, 0x8bf4, 0x8bf5, 0x8bf6, 0x8bf7, 0x8bf8, 0x8bf9, 0x8bfa, 0x8bfb, 0x8bfc, 0x8bfd, 0x8bfe, 0x8c40, 0x8c41, 0x8c42, 0x8c43, 0x8c44, 0x8c45, 0x8c46, 0x8c47, 0x8c48, 0x8c49, 0x8c4a, 0x8c4b, 0x8c4c, 0x8c4d, 0x8c4e, 0x8c4f, 0x8c50, 0x8c51, 0x8c52, 0x8c53, 0x8c54, 0x8c55, 0x8c56, 0x8c57, 0x8c58, 0x8c59, 0x8c5a, 0x8c5b, 0x8c5c, 0x8c5d, 0x8c5e, 0x8c5f, 0x8c60, 0x8c61, 0x8c62, 0x8c63, 0x8c64, 0x8c65, 0x8c66, 0x8c67, 0x8c68, 0x8c69, 0x8c6a, 0x8c6b, 0x8c6c, 0x8c6d, 0x8c6e, 0x8c6f, 0x8c70, 0x8c71, 0x8c72, 0x8c73, 0x8c74, 0x8c75, 0x8c76, 0x8c77, 0x8c78, 0x8c79, 0x8c7a, 0x8c7b, 0x8c7c, 0x8c7d, 0x8c7e, 0x8ca1, 0x8ca2, 0x8ca3, 0x8ca4, 0x8ca5, 0x8ca6, 0x8ca7, 0x8ca8, 0x8ca9, 0x8caa, 0x8cab, 0x8cac, 0x8cad, 0x8cae, 0x8caf, 0x8cb0, 0x8cb1, 0x8cb2, 0x8cb3, 0x8cb4, 0x8cb5, 0x8cb6, 0x8cb7, 0x8cb8, 0x8cb9, 0x8cba, 0x8cbb, 0x8cbc, 0x8cbd, 0x8cbe, 0x8cbf, 0x8cc0, 0x8cc1, 0x8cc2, 0x8cc3, 0x8cc4, 0x8cc5, 0x8cc6, 0x8cc7, 0x8cc8, 0x8cc9, 0x8cca, 0x8ccb, 0x8ccc, 0x8ccd, 0x8cce, 0x8ccf, 0x8cd0, 0x8cd1, 0x8cd2, 0x8cd3, 0x8cd4, 0x8cd5, 0x8cd6, 0x8cd7, 0x8cd8, 0x8cd9, 0x8cda, 0x8cdb, 0x8cdc, 0x8cdd, 0x8cde, 0x8cdf, 0x8ce0, 0x8ce1, 0x8ce2, 0x8ce3, 0x8ce4, 0x8ce5, 0x8ce6, 0x8ce7, 0x8ce8, 0x8ce9, 0x8cea, 0x8ceb, 0x8cec, 0x8ced, 0x8cee, 0x8cef, 0x8cf0, 0x8cf1, 0x8cf2, 0x8cf3, 0x8cf4, 0x8cf5, 0x8cf6, 0x8cf7, 0x8cf8, 0x8cf9, 0x8cfa, 0x8cfb, 0x8cfc, 0x8cfd, 0x8cfe, 0x8d40, 0x8d41, 0x8d42, 0x8d43, 0x8d44, 0x8d45, 0x8d46, 0x8d47, 0x8d48, 0x8d49, 0x8d4a, 0x8d4b, 0x8d4c, 0x8d4d, 0x8d4e, 0x8d4f, 0x8d50, 0x8d51, 0x8d52, 0x8d53, 0x8d54, 0x8d55, 0x8d56, 0x8d57, 0x8d58, 0x8d59, 0x8d5a, 0x8d5b, 0x8d5c, 0x8d5d, 0x8d5e, 0x8d5f, 0x8d60, 0x8d61, 0x8d62, 0x8d63, 0x8d64, 0x8d65, 0x8d66, 0x8d67, 0x8d68, 0x8d69, 0x8d6a, 0x8d6b, 0x8d6c, 0x8d6d, 0x8d6e, 0x8d6f, 0x8d70, 0x8d71, 0x8d72, 0x8d73, 0x8d74, 0x8d75, 0x8d76, 0x8d77, 0x8d78, 0x8d79, 0x8d7a, 0x8d7b, 0x8d7c, 0x8d7d, 0x8d7e, 0x8da1, 0x8da2, 0x8da3, 0x8da4, 0x8da5, 0x8da6, 0x8da7, 0x8da8, 0x8da9, 0x8daa, 0x8dab, 0x8dac, 0x8dad, 0x8dae, 0x8daf, 0x8db0, 0x8db1, 0x8db2, 0x8db3, 0x8db4, 0x8db5, 0x8db6, 0x8db7, 0x8db8, 0x8db9, 0x8dba, 0x8dbb, 0x8dbc, 0x8dbd, 0x8dbe, 0x8dbf, 0x8dc0, 0x8dc1, 0x8dc2, 0x8dc3, 0x8dc4, 0x8dc5, 0x8dc6, 0x8dc7, 0x8dc8, 0x8dc9, 0x8dca, 0x8dcb, 0x8dcc, 0x8dcd, 0x8dce, 0x8dcf, 0x8dd0, 0x8dd1, 0x8dd2, 0x8dd3, 0x8dd4, 0x8dd5, 0x8dd6, 0x8dd7, 0x8dd8, 0x8dd9, 0x8dda, 0x8ddb, 0x8ddc, 0x8ddd, 0x8dde, 0x8ddf, 0x8de0, 0x8de1, 0x8de2, 0x8de3, 0x8de4, 0x8de5, 0x8de6, 0x8de7, 0x8de8, 0x8de9, 0x8dea, 0x8deb, 0x8dec, 0x8ded, 0x8dee, 0x8def, 0x8df0, 0x8df1, 0x8df2, 0x8df3, 0x8df4, 0x8df5, 0x8df6, 0x8df7, 0x8df8, 0x8df9, 0x8dfa, 0x8dfb, 0x8dfc, 0x8dfd, 0x8dfe, 0xc6a1, 0xc6a2, 0xc6a3, 0xc6a4, 0xc6a5, 0xc6a6, 0xc6a7, 0xc6a8, 0xc6a9, 0xc6aa, 0xc6ab, 0xc6ac, 0xc6ad, 0xc6ae, 0xc6af, 0xc6b0, 0xc6b1, 0xc6b2, 0xc6b3, 0xc6b4, 0xc6b5, 0xc6b6, 0xc6b7, 0xc6b8, 0xc6b9, 0xc6ba, 0xc6bb, 0xc6bc, 0xc6bd, 0xc6be, 0xc6bf, 0xc6c0, 0xc6c1, 0xc6c2, 0xc6c3, 0xc6c4, 0xc6c5, 0xc6c6, 0xc6c7, 0xc6c8, 0xc6c9, 0xc6ca, 0xc6cb, 0xc6cc, 0xc6cd, 0xc6ce, 0xc6cf, 0xc6d0, 0xc6d1, 0xc6d2, 0xc6d3, 0xc6d4, 0xc6d5, 0xc6d6, 0xc6d7, 0xc6d8, 0xc6d9, 0xc6da, 0xc6db, 0xc6dc, 0xc6dd, 0xc6de, 0xc6df, 0xc6e0, 0xc6e1, 0xc6e2, 0xc6e3, 0xc6e4, 0xc6e5, 0xc6e6, 0xc6e7, 0xc6e8, 0xc6e9, 0xc6ea, 0xc6eb, 0xc6ec, 0xc6ed, 0xc6ee, 0xc6ef, 0xc6f0, 0xc6f1, 0xc6f2, 0xc6f3, 0xc6f4, 0xc6f5, 0xc6f6, 0xc6f7, 0xc6f8, 0xc6f9, 0xc6fa, 0xc6fb, 0xc6fc, 0xc6fd, 0xc6fe, 0xc740, 0xc741, 0xc742, 0xc743, 0xc744, 0xc745, 0xc746, 0xc747, 0xc748, 0xc749, 0xc74a, 0xc74b, 0xc74c, 0xc74d, 0xc74e, 0xc74f, 0xc750, 0xc751, 0xc752, 0xc753, 0xc754, 0xc755, 0xc756, 0xc757, 0xc758, 0xc759, 0xc75a, 0xc75b, 0xc75c, 0xc75d, 0xc75e, 0xc75f, 0xc760, 0xc761, 0xc762, 0xc763, 0xc764, 0xc765, 0xc766, 0xc767, 0xc768, 0xc769, 0xc76a, 0xc76b, 0xc76c, 0xc76d, 0xc76e, 0xc76f, 0xc770, 0xc771, 0xc772, 0xc773, 0xc774, 0xc775, 0xc776, 0xc777, 0xc778, 0xc779, 0xc77a, 0xc77b, 0xc77c, 0xc77d, 0xc77e, 0xc7a1, 0xc7a2, 0xc7a3, 0xc7a4, 0xc7a5, 0xc7a6, 0xc7a7, 0xc7a8, 0xc7a9, 0xc7aa, 0xc7ab, 0xc7ac, 0xc7ad, 0xc7ae, 0xc7af, 0xc7b0, 0xc7b1, 0xc7b2, 0xc7b3, 0xc7b4, 0xc7b5, 0xc7b6, 0xc7b7, 0xc7b8, 0xc7b9, 0xc7ba, 0xc7bb, 0xc7bc, 0xc7bd, 0xc7be, 0xc7bf, 0xc7c0, 0xc7c1, 0xc7c2, 0xc7c3, 0xc7c4, 0xc7c5, 0xc7c6, 0xc7c7, 0xc7c8, 0xc7c9, 0xc7ca, 0xc7cb, 0xc7cc, 0xc7cd, 0xc7ce, 0xc7cf, 0xc7d0, 0xc7d1, 0xc7d2, 0xc7d3, 0xc7d4, 0xc7d5, 0xc7d6, 0xc7d7, 0xc7d8, 0xc7d9, 0xc7da, 0xc7db, 0xc7dc, 0xc7dd, 0xc7de, 0xc7df, 0xc7e0, 0xc7e1, 0xc7e2, 0xc7e3, 0xc7e4, 0xc7e5, 0xc7e6, 0xc7e7, 0xc7e8, 0xc7e9, 0xc7ea, 0xc7eb, 0xc7ec, 0xc7ed, 0xc7ee, 0xc7ef, 0xc7f0, 0xc7f1, 0xc7f2, 0xc7f3, 0xc7f4, 0xc7f5, 0xc7f6, 0xc7f7, 0xc7f8, 0xc7f9, 0xc7fa, 0xc7fb, 0xc7fc, 0xc7fd, 0xc7fe, 0xc840, 0xc841, 0xc842, 0xc843, 0xc844, 0xc845, 0xc846, 0xc847, 0xc848, 0xc849, 0xc84a, 0xc84b, 0xc84c, 0xc84d, 0xc84e, 0xc84f, 0xc850, 0xc851, 0xc852, 0xc853, 0xc854, 0xc855, 0xc856, 0xc857, 0xc858, 0xc859, 0xc85a, 0xc85b, 0xc85c, 0xc85d, 0xc85e, 0xc85f, 0xc860, 0xc861, 0xc862, 0xc863, 0xc864, 0xc865, 0xc866, 0xc867, 0xc868, 0xc869, 0xc86a, 0xc86b, 0xc86c, 0xc86d, 0xc86e, 0xc86f, 0xc870, 0xc871, 0xc872, 0xc873, 0xc874, 0xc875, 0xc876, 0xc877, 0xc878, 0xc879, 0xc87a, 0xc87b, 0xc87c, 0xc87d, 0xc87e, 0xc8a1, 0xc8a2, 0xc8a3, 0xc8a4, 0xc8a5, 0xc8a6, 0xc8a7, 0xc8a8, 0xc8a9, 0xc8aa, 0xc8ab, 0xc8ac, 0xc8ad, 0xc8ae, 0xc8af, 0xc8b0, 0xc8b1, 0xc8b2, 0xc8b3, 0xc8b4, 0xc8b5, 0xc8b6, 0xc8b7, 0xc8b8, 0xc8b9, 0xc8ba, 0xc8bb, 0xc8bc, 0xc8bd, 0xc8be, 0xc8bf, 0xc8c0, 0xc8c1, 0xc8c2, 0xc8c3, 0xc8c4, 0xc8c5, 0xc8c6, 0xc8c7, 0xc8c8, 0xc8c9, 0xc8ca, 0xc8cb, 0xc8cc, 0xc8cd, 0xc8ce, 0xc8cf, 0xc8d0, 0xc8d1, 0xc8d2, 0xc8d3, 0xc8d4, 0xc8d5, 0xc8d6, 0xc8d7, 0xc8d8, 0xc8d9, 0xc8da, 0xc8db, 0xc8dc, 0xc8dd, 0xc8de, 0xc8df, 0xc8e0, 0xc8e1, 0xc8e2, 0xc8e3, 0xc8e4, 0xc8e5, 0xc8e6, 0xc8e7, 0xc8e8, 0xc8e9, 0xc8ea, 0xc8eb, 0xc8ec, 0xc8ed, 0xc8ee, 0xc8ef, 0xc8f0, 0xc8f1, 0xc8f2, 0xc8f3, 0xc8f4, 0xc8f5, 0xc8f6, 0xc8f7, 0xc8f8, 0xc8f9, 0xc8fa, 0xc8fb, 0xc8fc, 0xc8fd, 0xc8fe, 0xb05a, 0xa7f3, 0xa8ae, 0xb8eb, 0xb7c6, 0xa6ea, 0xa579, 0x8bf8, 0xc074, 0xabb4, 0xaaf7, 0xb3e2, 0xa960, 0xc369, 0xc4ee, 0xc3b9, 0xc5da, 0xc1b3, 0xbb72, 0xc5de, 0xbcd6, 0xaca5, 0xaf4f, 0xaf5f, 0xb8a8, 0xb954, 0xc064, 0xb6c3, 0xa75a, 0xc4e6, 0xc4ea, 0xc4f5, 0xc67d, 0xb450, 0xc0dd, 0xc2c5, 0xc4b0, 0xa9d4, 0xc3be, 0xc4fa, 0xb459, 0xaed4, 0xaef6, 0xaf54, 0xa8d3, 0xa74e, 0xb3d2, 0xbedb, 0xc372, 0xc46c, 0xbf63, 0xa6d1, 0xc4aa, 0xb8b8, 0xb8f4, 0xc553, 0xbe7c, 0xc64f, 0xb84c, 0xb853, 0xbaf1, 0xdb77, 0xbffd, 0xb3c0, 0xbdd7, 0xc362, 0xa7cb, 0xc5a2, 0xc5a4, 0xa863, 0xbd55, 0xb8ef, 0xb970, 0xc253, 0xb9f0, 0xbcd3, 0xb25c, 0xba7c, 0xb2d6, 0xc15c, 0xadae, 0xb0c7, 0xa6d8, 0xbbfe, 0xade2, 0xb857, 0xbaf0, 0xb5d9, 0xb3ae, 0xc5aa, 0xced4, 0xbcd6, 0xbfd5, 0xa4a6, 0xb9e7, 0xabe3, 0xb276, 0xb2a7, 0xa55f, 0xeda8, 0xab4b, 0xb45f, 0xa4a3, 0xaa63, 0xbcc6, 0xafc1, 0xb0d1, 0xb6eb, 0xacd9, 0xb8ad, 0xbba1, 0xb1fe, 0xa8b0, 0xa848, 0xac42, 0xad59, 0xb1b0, 0xb2a4, 0xab47, 0xa8e2, 0xb1e7, 0xc2b3, 0xa87d, 0xbdcc, 0xb671, 0xc079, 0xa766, 0xa46b, 0xc366, 0xaec8, 0xc26f, 0xc472, 0xbe5b, 0xc67a, 0xc452, 0xbea4, 0xa44f, 0xbee4, 0xbefa, 0xf765, 0xa67e, 0xbca6, 0xc5ca, 0xbcbf, 0xbaa7, 0xb7d2, 0xe6a3, 0xbd6d, 0xc170, 0xbdfb, 0xbdac, 0xb373, 0xc1e5, 0xa643, 0xa648, 0xab7c, 0xaf50, 0xb5f5, 0xbba1, 0xb747, 0xa9c0, 0xb1c9, 0xc0d4, 0xc3ae, 0xc279, 0xa54f, 0xcbf1, 0xb9e7, 0xc0ad, 0xccb0, 0xacc2, 0xbcfc, 0xb2dc, 0xb2e2, 0xb961, 0xb973, 0xc646, 0xbbe2, 0xa8d2, 0xc2a7, 0xc4bf, 0xc1f5, 0xb463, 0xa446, 0xb9b1, 0xbc64, 0xa7bf, 0xaec6, 0xbcd6, 0xbf52, 0xc0f8, 0xe764, 0xbff1, 0xc073, 0xb777, 0xa8bf, 0xbc42, 0xccd8, 0xac68, 0xac79, 0xb7c8, 0xaf5b, 0xaf64, 0xb2b8, 0xafc3, 0xc3fe, 0xa4bb, 0xbcae, 0xb3b0, 0xaddb, 0xb15b, 0xb25f, 0xbdfc, 0xabdf, 0xb758, 0xaedf, 0xb276, 0xb6a9, 0xa751, 0xa64f, 0xbc69, 0xa9f6, 0xa7f5, 0xb1f9, 0xaa64, 0xb27a, 0xb567, 0xbfa9, 0xb8cc, 0xa8bd, 0xc2f7, 0xb0ce, 0xb7c4, 0xa75b, 0xbf4d, 0xbf5a, 0xc4a9, 0xc5ec, 0xc5ef, 0xaa4c, 0xb24f, 0xc17b, 0xa5df, 0xb2c1, 0xb2c9, 0xaaac, 0xaaa5, 0xc3d1, 0xa4b0, 0xaff9, 0xa8eb, 0xa4c1, 0xabd7, 0xa9dd, 0xbf7d, 0xa676, 0xac7d, 0xbcc9, 0xbfe7, 0xa6e6, 0xadb0, 0xa8a3, 0xb9f8, 0xc94a, 0xddfc, 0xb6ef, 0xb4b8, 0xe8f9, 0xbdde, 0xaf71, 0xafab, 0xb2bb, 0xbad6, 0xb974, 0xbaeb, 0xa6d0, 0xbdd1, 0xb668, 0xb3a3, 0xb6ba, 0xb97d, 0xc05d, 0xc562, 0xa14a, 0xa157, 0xa159, 0xa15b, 0xa15f, 0xa160, 0xa163, 0xa164, 0xa167, 0xa168, 0xa16b, 0xa16c, 0xa16f, 0xa170, 0xa173, 0xa174, 0xa177, 0xa178, 0xa17b, 0xa17c, 0xa1c6, 0xa1c7, 0xa1ca, 0xa1cb, 0xa1c8, 0xa1c9, 0xa15c, 0xa14d, 0xa14e, 0xa14f, 0xa151, 0xa152, 0xa153, 0xa154, 0xa17d, 0xa17e, 0xa1a1, 0xa1a2, 0xa1a3, 0xa1a4, 0xa1cc, 0xa1cd, 0xa1ce, 0xa1de, 0xa1df, 0xa1e0, 0xa1e1, 0xa1e2, 0xa242, 0xa24c, 0xa24d, 0xa24e, 0xa149, 0xc8d0, 0xa1ad, 0xa243, 0xa248, 0xa1ae, 0xc8cf, 0xa15d, 0xa15e, 0xa1af, 0xa1cf, 0xa141, 0xa1d0, 0xa144, 0xa1fe, 0xa2af, 0xa2b0, 0xa2b1, 0xa2b2, 0xa2b3, 0xa2b4, 0xa2b5, 0xa2b6, 0xa2b7, 0xa2b8, 0xa147, 0xa146, 0xa1d5, 0xa1d7, 0xa1d6, 0xa148, 0xa249, 0xa2cf, 0xa2d0, 0xa2d1, 0xa2d2, 0xa2d3, 0xa2d4, 0xa2d5, 0xa2d6, 0xa2d7, 0xa2d8, 0xa2d9, 0xa2da, 0xa2db, 0xa2dc, 0xa2dd, 0xa2de, 0xa2df, 0xa2e0, 0xa2e1, 0xa2e2, 0xa2e3, 0xa2e4, 0xa2e5, 0xa2e6, 0xa2e7, 0xa2e8, 0xc6e4, 0xa240, 0xc6e5, 0xa173, 0xa1c4, 0xa1a5, 0xa2e9, 0xa2ea, 0xa2eb, 0xa2ec, 0xa2ed, 0xa2ee, 0xa2ef, 0xa2f0, 0xa2f1, 0xa2f2, 0xa2f3, 0xa2f4, 0xa2f5, 0xa2f6, 0xa2f7, 0xa2f8, 0xa2f9, 0xa2fa, 0xa2fb, 0xa2fc, 0xa2fd, 0xa2fe, 0xa340, 0xa341, 0xa342, 0xa343, 0xa161, 0xa155, 0xa162, 0xa1e3, 0xa14e, 0xa246, 0xa247, 0xc8cd, 0xa1c3, 0xc8ce, 0xa244, 0xf9fe, }; static const Summary16 big5hkscs_uni2indx_page00[16] = { /* 0x0000 */ { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x81ac }, { 6, 0x01b3 }, { 12, 0x0703 }, { 17, 0x008c }, { 20, 0x3703 }, { 27, 0x178c }, }; static const Summary16 big5hkscs_uni2indx_page02[29] = { /* 0x0200 */ { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0813 }, { 60, 0x0402 }, { 62, 0x0020 }, { 63, 0x0408 }, { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x2ec0 }, { 71, 0x0200 }, { 72, 0x0000 }, { 72, 0x0000 }, /* 0x0300 */ { 72, 0x0020 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0xfffe }, { 88, 0x03fb }, { 97, 0xfffe }, { 112, 0x03fb }, }; static const Summary16 big5hkscs_uni2indx_page20[44] = { /* 0x2000 */ { 191, 0x0000 }, { 191, 0x3378 }, { 199, 0x00f4 }, { 204, 0x482c }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, /* 0x2100 */ { 209, 0x0228 }, { 212, 0x0040 }, { 213, 0x0002 }, { 214, 0x0000 }, { 214, 0x0000 }, { 214, 0x0000 }, { 214, 0x03ff }, { 224, 0x03ff }, { 234, 0x0000 }, { 234, 0x03cf }, { 242, 0x0000 }, { 242, 0x0300 }, { 244, 0x0000 }, { 244, 0x0000 }, { 244, 0x0080 }, { 245, 0x0000 }, /* 0x2200 */ { 245, 0x0000 }, { 245, 0xc560 }, { 251, 0x4e29 }, { 258, 0x0030 }, { 260, 0x0000 }, { 260, 0x0004 }, { 261, 0x00cb }, { 266, 0x0000 }, { 266, 0x0000 }, { 266, 0x0220 }, { 268, 0x0020 }, { 269, 0x8000 }, }; static const Summary16 big5hkscs_uni2indx_page25[21] = { /* 0x2500 */ { 291, 0x1005 }, { 294, 0x1111 }, { 298, 0x1010 }, { 300, 0x1010 }, { 302, 0x0000 }, { 302, 0xffff }, { 318, 0xffff }, { 334, 0x001f }, { 339, 0xfffe }, { 354, 0x0038 }, { 357, 0x0003 }, { 359, 0x300c }, { 363, 0xc8c0 }, { 368, 0x0000 }, { 368, 0x003c }, { 372, 0x0000 }, /* 0x2600 */ { 372, 0x0260 }, { 375, 0x0000 }, { 375, 0x0000 }, { 375, 0x0000 }, { 375, 0x0007 }, }; static const Summary16 big5hkscs_uni2indx_page30[62] = { /* 0x3000 */ { 408, 0xffef }, { 423, 0x7037 }, { 431, 0x03fe }, { 440, 0x0001 }, { 441, 0xfffe }, { 456, 0xffff }, { 472, 0xffff }, { 488, 0xffff }, { 504, 0xffff }, { 520, 0x780f }, { 528, 0xfffe }, { 543, 0xffff }, { 559, 0xffff }, { 575, 0xffff }, { 591, 0xffff }, { 607, 0x707f }, /* 0x3100 */ { 617, 0xffe0 }, { 628, 0xffff }, { 644, 0x03ff }, { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0xfffc }, { 668, 0x0000 }, { 668, 0x0000 }, { 668, 0x0000 }, { 668, 0x0000 }, { 668, 0x0000 }, { 668, 0x0000 }, /* 0x3200 */ { 668, 0x0000 }, { 668, 0x0000 }, { 668, 0xffff }, { 684, 0xffff }, { 700, 0x000f }, { 704, 0x0000 }, { 704, 0x0000 }, { 704, 0x0000 }, { 704, 0xffff }, { 720, 0xffff }, { 736, 0xffff }, { 752, 0x0001 }, { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, /* 0x3300 */ { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0xc000 }, { 755, 0x7000 }, { 758, 0x0002 }, { 759, 0x0000 }, { 759, 0x4010 }, { 761, 0x0026 }, }; static const Summary16 big5hkscs_uni2indx_page4e[1307] = { /* 0x4e00 */ { 1275, 0xff9b }, { 1288, 0xd773 }, { 1299, 0xfd52 }, { 1309, 0xbbcf }, { 1321, 0xebac }, { 1331, 0xff4c }, { 1342, 0x0600 }, { 1344, 0xc108 }, { 1348, 0x7bff }, { 1362, 0xcf3e }, { 1373, 0x797f }, { 1385, 0x9ec8 }, { 1393, 0x6fdf }, { 1406, 0xf7f0 }, { 1417, 0x4f3a }, { 1426, 0xa9ff }, /* 0x4f00 */ { 1438, 0xef3f }, { 1451, 0x27bf }, { 1462, 0xb304 }, { 1468, 0xffdd }, { 1482, 0xfbee }, { 1495, 0xffff }, { 1511, 0xde9f }, { 1523, 0xfffd }, { 1538, 0xafff }, { 1552, 0x7df7 }, { 1565, 0xc904 }, { 1570, 0xaeed }, { 1581, 0xffbf }, { 1596, 0xffdb }, { 1610, 0xd033 }, { 1617, 0x67ff }, /* 0x5000 */ { 1630, 0xfbe9 }, { 1642, 0xdffe }, { 1656, 0xffef }, { 1671, 0x18bb }, { 1679, 0xffeb }, { 1693, 0xfdea }, { 1705, 0xff7f }, { 1720, 0x24fd }, { 1729, 0x79af }, { 1740, 0x7f77 }, { 1753, 0xf04c }, { 1760, 0xfdff }, { 1775, 0xeff6 }, { 1788, 0xaefb }, { 1800, 0xf7fb }, { 1814, 0xfb7b }, /* 0x5100 */ { 1827, 0x7fff }, { 1842, 0x95bf }, { 1853, 0x6e77 }, { 1864, 0xbfbf }, { 1878, 0x3bfb }, { 1890, 0xfef4 }, { 1902, 0x7faf }, { 1915, 0x13f2 }, { 1923, 0xa7c5 }, { 1932, 0x55fe }, { 1943, 0x5db5 }, { 1953, 0x73ff }, { 1966, 0xfff8 }, { 1979, 0xf99f }, { 1991, 0x2017 }, { 1996, 0x777b }, /* 0x5200 */ { 2008, 0x5fef }, { 2021, 0xf0cf }, { 2031, 0x47f3 }, { 2041, 0x1dff }, { 2053, 0x7eda }, { 2064, 0xfef4 }, { 2076, 0xff07 }, { 2087, 0xbfbc }, { 2099, 0xbf9f }, { 2112, 0x8fdb }, { 2123, 0x7f5b }, { 2135, 0x5a20 }, { 2140, 0x32af }, { 2149, 0xebef }, { 2162, 0x8a5f }, { 2171, 0xdfbb }, /* 0x5300 */ { 2184, 0xef62 }, { 2194, 0xb6e7 }, { 2205, 0xb49f }, { 2215, 0xfb9f }, { 2228, 0x77bf }, { 2241, 0xf49e }, { 2251, 0xf2db }, { 2262, 0xfbbf }, { 2276, 0xc414 }, { 2281, 0xf7dc }, { 2293, 0x7ff5 }, { 2306, 0x0a55 }, { 2312, 0x3f2e }, { 2322, 0x8fd7 }, { 2333, 0xff7f }, { 2348, 0x59ef }, /* 0x5400 */ { 2359, 0xffda }, { 2372, 0xff5f }, { 2386, 0xfffb }, { 2401, 0x7bff }, { 2415, 0xedef }, { 2428, 0x0010 }, { 2429, 0xbfff }, { 2444, 0xfdff }, { 2459, 0xf9f7 }, { 2472, 0x55ff }, { 2484, 0xffff }, { 2500, 0xffdf }, { 2515, 0xfbff }, { 2530, 0x4441 }, { 2534, 0xefff }, { 2549, 0xbd8e }, /* 0x5500 */ { 2559, 0xfffe }, { 2574, 0x459f }, { 2583, 0xfde8 }, { 2594, 0xdbff }, { 2608, 0xeffb }, { 2622, 0xf0ef }, { 2633, 0x0e7e }, { 2642, 0xfaee }, { 2654, 0xffdf }, { 2669, 0xb73f }, { 2681, 0x7ffe }, { 2695, 0x9e3f }, { 2706, 0xffff }, { 2722, 0xffff }, { 2738, 0x97fe }, { 2750, 0xfee7 }, /* 0x5600 */ { 2763, 0xf377 }, { 2775, 0xf8ff }, { 2788, 0xf6af }, { 2800, 0xeffd }, { 2814, 0xf76f }, { 2827, 0x679d }, { 2837, 0xff7f }, { 2852, 0xdfdf }, { 2866, 0xfeff }, { 2881, 0xf7ad }, { 2893, 0xfdf2 }, { 2905, 0xf2fe }, { 2917, 0x3f6f }, { 2929, 0xecda }, { 2939, 0xecb7 }, { 2950, 0xa683 }, /* 0x5700 */ { 2957, 0x3f9f }, { 2969, 0xfd7c }, { 2981, 0xf70d }, { 2991, 0xe81d }, { 2999, 0xfeef }, { 3013, 0x8897 }, { 3020, 0xafd6 }, { 3031, 0xfcff }, { 3045, 0xbd0d }, { 3054, 0xffb9 }, { 3067, 0x44bf }, { 3076, 0xff70 }, { 3087, 0xd9de }, { 3098, 0xf0b5 }, { 3107, 0xf2ff }, { 3120, 0x7fff }, /* 0x5800 */ { 3135, 0x7fff }, { 3150, 0x7a15 }, { 3158, 0xf7ff }, { 3173, 0xafff }, { 3187, 0xff91 }, { 3198, 0xffbe }, { 3212, 0xbb3c }, { 3222, 0xfe7e }, { 3235, 0xcfef }, { 3248, 0xf71f }, { 3260, 0xdfeb }, { 3273, 0xfc6b }, { 3284, 0xcbe6 }, { 3294, 0xff7f }, { 3309, 0x9b9d }, { 3319, 0xfe1d }, /* 0x5900 */ { 3330, 0xf4fc }, { 3341, 0x96f6 }, { 3351, 0xfeb5 }, { 3363, 0x5196 }, { 3370, 0xc7b1 }, { 3379, 0x15bb }, { 3388, 0x6ea7 }, { 3398, 0xfbff }, { 3413, 0xe63f }, { 3424, 0xe7dd }, { 3436, 0xd1ff }, { 3448, 0x7fff }, { 3463, 0xfffb }, { 3478, 0x7f5f }, { 3491, 0xff7b }, { 3505, 0xffff }, /* 0x5a00 */ { 3521, 0xbe0f }, { 3531, 0xdfee }, { 3544, 0x7ebb }, { 3556, 0x73e8 }, { 3565, 0x37ff }, { 3578, 0xffff }, { 3594, 0x7fff }, { 3609, 0xff83 }, { 3620, 0xdd5e }, { 3631, 0xfeff }, { 3646, 0xdae7 }, { 3657, 0xffff }, { 3673, 0xffdf }, { 3688, 0xffe8 }, { 3700, 0x7f7f }, { 3714, 0xeffd }, /* 0x5b00 */ { 3728, 0xbbae }, { 3739, 0xeefb }, { 3752, 0xfdfb }, { 3766, 0xf115 }, { 3774, 0xfdfb }, { 3788, 0xbdfb }, { 3801, 0x7b7c }, { 3812, 0xbdff }, { 3826, 0xdbbf }, { 3839, 0xffed }, { 3853, 0x75fc }, { 3864, 0x8379 }, { 3872, 0x7cff }, { 3885, 0xc3ff }, { 3897, 0xdfff }, { 3912, 0x856f }, /* 0x5c00 */ { 3921, 0xffba }, { 3934, 0xd47f }, { 3945, 0x153d }, { 3953, 0xdf8b }, { 3964, 0xfff3 }, { 3978, 0x737b }, { 3989, 0xf7bd }, { 4002, 0x5e1a }, { 4010, 0xbf60 }, { 4019, 0xf63f }, { 4031, 0xffff }, { 4047, 0x05eb }, { 4055, 0xdfc6 }, { 4066, 0xcfdf }, { 4079, 0xf720 }, { 4087, 0xabf3 }, /* 0x5d00 */ { 4098, 0xf8c3 }, { 4107, 0xeff7 }, { 4121, 0xd3fd }, { 4133, 0xf7ff }, { 4148, 0x5fef }, { 4161, 0x4ae7 }, { 4170, 0x9bac }, { 4179, 0xfe97 }, { 4191, 0x6ff7 }, { 4204, 0xf6bc }, { 4215, 0xff97 }, { 4228, 0x37f7 }, { 4240, 0xaacf }, { 4250, 0xe9f6 }, { 4261, 0x49e7 }, { 4270, 0xe2bf }, /* 0x5e00 */ { 4281, 0x5e5c }, { 4290, 0xaff6 }, { 4302, 0x6b3f }, { 4313, 0x61d8 }, { 4320, 0xfd3f }, { 4333, 0xfbb8 }, { 4344, 0xffcf }, { 4358, 0xff7d }, { 4372, 0xbfdd }, { 4385, 0x1ee4 }, { 4393, 0x7dfd }, { 4406, 0x63ff }, { 4418, 0x7ff6 }, { 4431, 0xffff }, { 4447, 0xd3ef }, { 4459, 0xdfde }, /* 0x5f00 */ { 4472, 0xfdb6 }, { 4484, 0xadbc }, { 4494, 0x63fc }, { 4504, 0x15eb }, { 4513, 0xff59 }, { 4525, 0x33d3 }, { 4534, 0xbebe }, { 4546, 0xfbdf }, { 4560, 0x1fef }, { 4572, 0xdbc7 }, { 4583, 0xfff3 }, { 4597, 0xfee6 }, { 4609, 0xb23f }, { 4619, 0xebf7 }, { 4632, 0xed3b }, { 4643, 0xadba }, /* 0x6000 */ { 4653, 0xfe01 }, { 4661, 0x7eff }, { 4675, 0xffff }, { 4691, 0x0abe }, { 4699, 0x36ff }, { 4711, 0xef3d }, { 4723, 0xfffc }, { 4737, 0xc0a5 }, { 4743, 0x77fb }, { 4756, 0xfcf5 }, { 4768, 0x019d }, { 4774, 0xffff }, { 4790, 0xfffb }, { 4805, 0xffba }, { 4818, 0x03df }, { 4827, 0xffff }, /* 0x6100 */ { 4843, 0xfffb }, { 4858, 0xbf7d }, { 4871, 0xdb8c }, { 4880, 0xe8d5 }, { 4889, 0xfff7 }, { 4904, 0xff7d }, { 4918, 0xddff }, { 4932, 0x76ff }, { 4945, 0x7e8f }, { 4956, 0xbf7f }, { 4970, 0xff96 }, { 4982, 0xd7ff }, { 4996, 0xbfef }, { 5010, 0xc549 }, { 5017, 0x6ffd }, { 5030, 0xffe7 }, /* 0x6200 */ { 5044, 0x779b }, { 5055, 0x8e77 }, { 5065, 0x7ebf }, { 5078, 0xe6dd }, { 5089, 0x7fcf }, { 5102, 0x5f1f }, { 5113, 0xe17f }, { 5124, 0xfedf }, { 5138, 0xd7ff }, { 5152, 0x21ff }, { 5162, 0xff50 }, { 5172, 0xfb7b }, { 5185, 0xfffc }, { 5199, 0x9fff }, { 5213, 0xf820 }, { 5219, 0xffff }, /* 0x6300 */ { 5235, 0xfb8f }, { 5247, 0x017b }, { 5254, 0xff00 }, { 5262, 0x7ffe }, { 5276, 0xffff }, { 5292, 0x07f3 }, { 5301, 0xfbb0 }, { 5311, 0xbfe7 }, { 5324, 0xffbf }, { 5339, 0xfbd7 }, { 5352, 0xffbf }, { 5367, 0x6203 }, { 5372, 0xffff }, { 5388, 0xffef }, { 5403, 0xefff }, { 5418, 0x5b7f }, /* 0x6400 */ { 5430, 0xfec0 }, { 5439, 0xddfd }, { 5452, 0xfdff }, { 5467, 0xeffd }, { 5481, 0x680b }, { 5487, 0xff1f }, { 5500, 0xfbe3 }, { 5512, 0xbfff }, { 5527, 0xbfa4 }, { 5537, 0xf7ef }, { 5551, 0xfa7d }, { 5563, 0xf85f }, { 5574, 0xeebf }, { 5587, 0x2fdd }, { 5598, 0xbfff }, { 5613, 0xfd9f }, /* 0x6500 */ { 5626, 0xf6db }, { 5638, 0xfbfb }, { 5652, 0xfe7f }, { 5666, 0xebfd }, { 5679, 0xa76a }, { 5688, 0xf3fa }, { 5700, 0xbdfc }, { 5712, 0x9ffc }, { 5724, 0x1bff }, { 5736, 0xfaf7 }, { 5749, 0xddb7 }, { 5761, 0xfbed }, { 5774, 0xf87e }, { 5785, 0xecdf }, { 5797, 0xf36f }, { 5809, 0xbc3f }, /* 0x6600 */ { 5820, 0xfffd }, { 5835, 0xf13f }, { 5846, 0xe9ff }, { 5859, 0x067f }, { 5868, 0x9fbe }, { 5880, 0xfe8e }, { 5891, 0xddfe }, { 5904, 0x7fdf }, { 5918, 0x7ff1 }, { 5930, 0xa7f7 }, { 5942, 0xef17 }, { 5953, 0xefff }, { 5968, 0xffd1 }, { 5980, 0x7f44 }, { 5989, 0x7b59 }, { 5999, 0xd3df }, /* 0x6700 */ { 6011, 0xff3f }, { 6025, 0xebfd }, { 6038, 0x7def }, { 6051, 0xff7a }, { 6064, 0xfbf0 }, { 6075, 0xf6eb }, { 6087, 0xbc87 }, { 6096, 0xffff }, { 6112, 0xfafa }, { 6124, 0xb7bf }, { 6137, 0xd011 }, { 6142, 0x8fff }, { 6155, 0xff7f }, { 6170, 0xffdf }, { 6185, 0xfefc }, { 6198, 0xd7ff }, /* 0x6800 */ { 6212, 0x201f }, { 6218, 0xfddd }, { 6231, 0xef67 }, { 6243, 0x7ffe }, { 6257, 0xffff }, { 6273, 0x207b }, { 6280, 0xe820 }, { 6285, 0xfbf6 }, { 6298, 0x9fff }, { 6312, 0xb9df }, { 6324, 0xffdf }, { 6339, 0x227f }, { 6348, 0x7ff8 }, { 6360, 0xf5ff }, { 6374, 0xdfdb }, { 6387, 0x3fff }, /* 0x6900 */ { 6401, 0xffff }, { 6417, 0x0fbf }, { 6428, 0x9420 }, { 6432, 0xfbfd }, { 6446, 0xdf7f }, { 6460, 0xfffe }, { 6475, 0xffff }, { 6491, 0x0fff }, { 6503, 0x646d }, { 6511, 0xdffb }, { 6525, 0xffff }, { 6541, 0xfaff }, { 6555, 0xfe5f }, { 6568, 0x027b }, { 6575, 0x7bf6 }, { 6587, 0xffde }, /* 0x6a00 */ { 6601, 0xbfff }, { 6616, 0xfffa }, { 6630, 0x39eb }, { 6640, 0xff3c }, { 6652, 0xfbfb }, { 6666, 0xefff }, { 6681, 0xafff }, { 6695, 0xc452 }, { 6701, 0xf6bf }, { 6714, 0xfeff }, { 6729, 0xf9ff }, { 6743, 0x6ffe }, { 6756, 0xbfec }, { 6768, 0xff1b }, { 6780, 0xdda3 }, { 6790, 0x1f4b }, /* 0x6b00 */ { 6799, 0x8f3d }, { 6809, 0x67cf }, { 6820, 0xb12b }, { 6828, 0xfffe }, { 6843, 0x7fee }, { 6856, 0xdaf7 }, { 6868, 0xa4ff }, { 6879, 0xcfd4 }, { 6889, 0xf75f }, { 6902, 0xcbf2 }, { 6912, 0xecfd }, { 6924, 0xb4ed }, { 6934, 0xbffb }, { 6948, 0x5ddd }, { 6959, 0x9ddf }, { 6971, 0xff8d }, /* 0x6c00 */ { 6983, 0xbb7f }, { 6996, 0xbf7b }, { 7009, 0xddfb }, { 7022, 0xeffb }, { 7036, 0xfe4f }, { 7048, 0xffb5 }, { 7061, 0xefe3 }, { 7073, 0xef7f }, { 7087, 0xffff }, { 7103, 0xbf7d }, { 7116, 0xfc04 }, { 7123, 0xffdf }, { 7138, 0xfeff }, { 7153, 0xfeff }, { 7168, 0xffaf }, { 7182, 0x822f }, /* 0x6d00 */ { 7189, 0xffff }, { 7205, 0xefc7 }, { 7217, 0xfff5 }, { 7231, 0xffff }, { 7247, 0x4007 }, { 7251, 0xdf80 }, { 7259, 0xf7ff }, { 7274, 0xfff7 }, { 7289, 0xffff }, { 7305, 0x01ff }, { 7314, 0xdc30 }, { 7321, 0xffbe }, { 7335, 0xbff5 }, { 7348, 0xffff }, { 7364, 0xff7f }, { 7379, 0x7eff }, /* 0x6e00 */ { 7393, 0x843d }, { 7400, 0xbf20 }, { 7408, 0xffff }, { 7424, 0xff7f }, { 7439, 0xeefb }, { 7452, 0xff7f }, { 7467, 0xcbff }, { 7480, 0x13de }, { 7489, 0xeb40 }, { 7496, 0xffdd }, { 7510, 0xccff }, { 7522, 0xffff }, { 7538, 0xffff }, { 7554, 0x3f7f }, { 7567, 0xfb04 }, { 7575, 0xfff6 }, /* 0x6f00 */ { 7589, 0xffff }, { 7605, 0xd7fc }, { 7617, 0xfeff }, { 7632, 0xffff }, { 7648, 0xc01b }, { 7654, 0xfdff }, { 7669, 0xfedf }, { 7683, 0xffdd }, { 7697, 0x7ff7 }, { 7711, 0xe0fd }, { 7721, 0xffff }, { 7737, 0xff7f }, { 7752, 0xffdf }, { 7767, 0xff38 }, { 7778, 0xfbdf }, { 7792, 0xddd7 }, /* 0x7000 */ { 7804, 0xfefb }, { 7818, 0xfff2 }, { 7831, 0x9fdf }, { 7844, 0xdfbf }, { 7858, 0x3f7f }, { 7871, 0xfdf7 }, { 7885, 0x9fff }, { 7899, 0xf7f3 }, { 7912, 0xce7e }, { 7923, 0x877e }, { 7933, 0xfafb }, { 7946, 0x7fbb }, { 7959, 0xfdf1 }, { 7971, 0xf7ff }, { 7986, 0x8017 }, { 7991, 0xfffb }, /* 0x7100 */ { 8006, 0x7e75 }, { 8017, 0xfe89 }, { 8027, 0xdb6f }, { 8039, 0x4c7f }, { 8049, 0xfeff }, { 8064, 0xf75f }, { 8077, 0x5fff }, { 8091, 0x7def }, { 8104, 0xd7f7 }, { 8117, 0xffd7 }, { 8131, 0xb7bf }, { 8144, 0xf7bf }, { 8158, 0xcfff }, { 8172, 0xbf77 }, { 8185, 0x79f7 }, { 8197, 0xfb77 }, /* 0x7200 */ { 8210, 0xf6ef }, { 8223, 0xeef9 }, { 8235, 0x7fdc }, { 8247, 0xef61 }, { 8257, 0x9fd7 }, { 8269, 0xffed }, { 8283, 0xd6cf }, { 8294, 0xfbdd }, { 8307, 0xfbf7 }, { 8321, 0xedff }, { 8335, 0xf7fe }, { 8349, 0xa435 }, { 8356, 0x7e7f }, { 8369, 0x97d7 }, { 8380, 0x0f5f }, { 8390, 0xffd8 }, /* 0x7300 */ { 8402, 0x9d97 }, { 8412, 0x7bcf }, { 8424, 0x7fec }, { 8436, 0xdfff }, { 8451, 0xf73f }, { 8464, 0xef87 }, { 8475, 0xdfe7 }, { 8488, 0xfdff }, { 8503, 0xdfff }, { 8518, 0xf1fc }, { 8529, 0x3ff7 }, { 8542, 0xdffc }, { 8555, 0xffed }, { 8569, 0x7ffd }, { 8583, 0xefff }, { 8598, 0xfff8 }, /* 0x7400 */ { 8611, 0x3fff }, { 8625, 0xfef6 }, { 8638, 0xff7f }, { 8653, 0x97ff }, { 8666, 0xefff }, { 8681, 0xfeff }, { 8696, 0xffbd }, { 8710, 0xf67f }, { 8723, 0x3fef }, { 8736, 0xdfb5 }, { 8748, 0xaffb }, { 8761, 0xeff7 }, { 8775, 0x9d2f }, { 8785, 0xfff9 }, { 8799, 0x53ff }, { 8811, 0xe9f7 }, /* 0x7500 */ { 8823, 0xf9bd }, { 8835, 0xf7ff }, { 8850, 0xff66 }, { 8862, 0xefbf }, { 8876, 0xfdc5 }, { 8887, 0xbe3a }, { 8897, 0xfcfd }, { 8910, 0xe7c5 }, { 8920, 0xfcd9 }, { 8931, 0x6737 }, { 8941, 0x0cbc }, { 8948, 0xff7f }, { 8963, 0xfdbf }, { 8977, 0xffb7 }, { 8991, 0xa0df }, { 9000, 0xffff }, /* 0x7600 */ { 9016, 0xbf8f }, { 9028, 0xfe7b }, { 9041, 0xb3ff }, { 9054, 0x3d3f }, { 9065, 0xf3cd }, { 9076, 0x97df }, { 9088, 0xf6f7 }, { 9101, 0xff7f }, { 9116, 0xcfd6 }, { 9127, 0x7e6d }, { 9138, 0xec72 }, { 9147, 0xedb1 }, { 9157, 0x777c }, { 9168, 0xfe5c }, { 9179, 0xf6fa }, { 9191, 0x5fbf }, /* 0x7700 */ { 9204, 0xdfba }, { 9216, 0xee2f }, { 9227, 0xabfd }, { 9239, 0x7ffe }, { 9253, 0xfcf9 }, { 9265, 0xdf74 }, { 9276, 0xffef }, { 9291, 0xff84 }, { 9301, 0xfbbf }, { 9315, 0xffaa }, { 9327, 0xbdaf }, { 9339, 0xfeff }, { 9354, 0xfebc }, { 9366, 0x7fb9 }, { 9378, 0xf3ed }, { 9390, 0x7f9f }, /* 0x7800 */ { 9403, 0xf36c }, { 9413, 0xf11f }, { 9423, 0xffef }, { 9438, 0x33bf }, { 9449, 0x7fbc }, { 9461, 0x701f }, { 9469, 0xff75 }, { 9482, 0xde03 }, { 9490, 0xf3fb }, { 9503, 0xc7fa }, { 9514, 0xbfbf }, { 9528, 0x5f5f }, { 9540, 0xffba }, { 9553, 0xedbf }, { 9566, 0xf7bf }, { 9580, 0xfebf }, /* 0x7900 */ { 9594, 0x5276 }, { 9602, 0x7a9f }, { 9613, 0xfffa }, { 9627, 0xff7e }, { 9641, 0x9ff7 }, { 9654, 0xffff }, { 9670, 0x2fbf }, { 9682, 0xf61f }, { 9693, 0xedcf }, { 9705, 0xbfff }, { 9720, 0x7ff7 }, { 9734, 0xefdf }, { 9748, 0xfb73 }, { 9760, 0xf176 }, { 9770, 0x7edd }, { 9782, 0x0dd2 }, /* 0x7a00 */ { 9789, 0x3d7d }, { 9800, 0xdfbf }, { 9814, 0xed45 }, { 9823, 0xfe83 }, { 9833, 0x7ff9 }, { 9846, 0x9dd0 }, { 9854, 0x7ba7 }, { 9865, 0xef73 }, { 9877, 0x9ffb }, { 9890, 0xc3ff }, { 9902, 0xdf0d }, { 9912, 0xddff }, { 9926, 0x8fbf }, { 9938, 0xbf0a }, { 9947, 0xeefd }, { 9960, 0xeec0 }, /* 0x7b00 */ { 9968, 0xdf73 }, { 9980, 0xef1f }, { 9992, 0xfffd }, { 10007, 0x0b3f }, { 10016, 0xfffd }, { 10031, 0x0177 }, { 10038, 0xf2ff }, { 10051, 0x09ff }, { 10061, 0xfdb4 }, { 10072, 0x3bf7 }, { 10084, 0xb01f }, { 10092, 0x43b6 }, { 10100, 0xded3 }, { 10111, 0xff31 }, { 10122, 0x1fff }, { 10135, 0xff9f }, /* 0x7c00 */ { 10149, 0xfeef }, { 10163, 0xfa27 }, { 10173, 0x3fef }, { 10186, 0xfba9 }, { 10197, 0x37bd }, { 10208, 0xbedb }, { 10220, 0xfef9 }, { 10233, 0xff3d }, { 10246, 0x777b }, { 10258, 0xd1f6 }, { 10268, 0xd1ee }, { 10278, 0xff3e }, { 10291, 0x7fac }, { 10302, 0xf6ff }, { 10316, 0xf5c5 }, { 10326, 0x7bff }, /* 0x7d00 */ { 10340, 0xffff }, { 10356, 0xffff }, { 10372, 0xdb27 }, { 10382, 0xff6f }, { 10396, 0xe4ff }, { 10408, 0xfd7f }, { 10422, 0xefce }, { 10434, 0xbe0f }, { 10444, 0xfb7b }, { 10457, 0xf0de }, { 10467, 0xffdf }, { 10482, 0xffbf }, { 10497, 0xfef7 }, { 10511, 0xff9d }, { 10524, 0xd7fb }, { 10537, 0x6eff }, /* 0x7e00 */ { 10550, 0xff88 }, { 10560, 0xfcff }, { 10574, 0xeebf }, { 10587, 0xffff }, { 10603, 0x13ff }, { 10614, 0xdfff }, { 10629, 0xffaf }, { 10643, 0xfffd }, { 10658, 0xfdc7 }, { 10670, 0x9ffe }, { 10683, 0x1010 }, { 10685, 0x0400 }, { 10686, 0x8080 }, { 10688, 0x8000 }, { 10689, 0x0000 }, { 10689, 0x0000 }, /* 0x7f00 */ { 10689, 0x0040 }, { 10690, 0x0000 }, { 10690, 0x0000 }, { 10690, 0xe7c0 }, { 10698, 0xffbb }, { 10712, 0xf93f }, { 10724, 0x7feb }, { 10737, 0xffef }, { 10752, 0xffe8 }, { 10764, 0x7cfe }, { 10776, 0xf3ff }, { 10790, 0xffff }, { 10806, 0xfeaf }, { 10819, 0xf8b7 }, { 10830, 0xffef }, { 10845, 0xffbf }, /* 0x8000 */ { 10860, 0xf9ff }, { 10874, 0xfbf7 }, { 10888, 0xd773 }, { 10899, 0xfafb }, { 10912, 0x85c8 }, { 10918, 0x7d57 }, { 10929, 0x90de }, { 10937, 0xe3ef }, { 10949, 0x9ef5 }, { 10960, 0xbf6d }, { 10972, 0xeeae }, { 10983, 0x35f6 }, { 10993, 0xf7fc }, { 11006, 0x7ff3 }, { 11019, 0xb27b }, { 11029, 0x7f7f }, /* 0x8100 */ { 11043, 0x57ef }, { 11055, 0xeff4 }, { 11067, 0xbebe }, { 11079, 0x6695 }, { 11087, 0xfddc }, { 11099, 0x5e7f }, { 11111, 0xeaf7 }, { 11123, 0x97df }, { 11135, 0xbfdd }, { 11148, 0xffa8 }, { 11159, 0x5fed }, { 11171, 0xfeff }, { 11186, 0xb7ff }, { 11200, 0xefa7 }, { 11212, 0xf7ff }, { 11227, 0xdfdc }, /* 0x8200 */ { 11239, 0x3fb7 }, { 11251, 0xfd77 }, { 11264, 0xbf67 }, { 11276, 0xf7fc }, { 11289, 0xcab5 }, { 11298, 0xdfff }, { 11313, 0xfb7e }, { 11326, 0xfff6 }, { 11340, 0xecb9 }, { 11350, 0xef1f }, { 11362, 0xffff }, { 11378, 0xfffb }, { 11393, 0x841d }, { 11399, 0xdbff }, { 11413, 0xfdff }, { 11428, 0xffff }, /* 0x8300 */ { 11444, 0x3bff }, { 11457, 0x7fc0 }, { 11466, 0xbff5 }, { 11479, 0xbffe }, { 11493, 0xffbf }, { 11508, 0x00df }, { 11515, 0x804c }, { 11519, 0xfdf8 }, { 11531, 0xffea }, { 11544, 0x7fff }, { 11559, 0xdffd }, { 11573, 0xe201 }, { 11578, 0xffff }, { 11594, 0xfbfa }, { 11607, 0xffbf }, { 11622, 0xff7f }, /* 0x8400 */ { 11637, 0xfefa }, { 11650, 0x195f }, { 11659, 0xfa5b }, { 11670, 0xffff }, { 11686, 0x7ffd }, { 11700, 0xffff }, { 11716, 0xfbff }, { 11731, 0xe7ff }, { 11745, 0xe145 }, { 11752, 0xffdf }, { 11767, 0xff9f }, { 11781, 0xff57 }, { 11794, 0xfef7 }, { 11808, 0x4cdf }, { 11818, 0xdfb6 }, { 11830, 0xffdf }, /* 0x8500 */ { 11845, 0xffed }, { 11859, 0xf7ff }, { 11874, 0xfffb }, { 11889, 0x691b }, { 11897, 0x7fff }, { 11912, 0xeffe }, { 11926, 0xffff }, { 11942, 0x5feb }, { 11954, 0xffff }, { 11970, 0xfff3 }, { 11984, 0x87df }, { 11995, 0xe7fb }, { 12008, 0xebff }, { 12022, 0xf7e7 }, { 12035, 0xff7f }, { 12050, 0xffc7 }, /* 0x8600 */ { 12063, 0xbef7 }, { 12076, 0xdfd3 }, { 12088, 0xf7ff }, { 12103, 0xdf7e }, { 12116, 0x79ed }, { 12127, 0xda7d }, { 12138, 0xffbe }, { 12152, 0x5e9f }, { 12163, 0x7ce0 }, { 12171, 0x77ff }, { 12185, 0xa7bf }, { 12197, 0xffff }, { 12213, 0x1bff }, { 12225, 0xffdb }, { 12239, 0xbf5c }, { 12250, 0x4fe0 }, /* 0x8700 */ { 12258, 0x7fff }, { 12273, 0x5f0e }, { 12282, 0x77ff }, { 12296, 0xddbf }, { 12309, 0xf04f }, { 12318, 0xffff }, { 12334, 0xffff }, { 12350, 0x2ffb }, { 12362, 0xbbfe }, { 12375, 0xfddf }, { 12389, 0xfe3c }, { 12400, 0xffff }, { 12416, 0x5f7f }, { 12429, 0xffde }, { 12443, 0xfdff }, { 12458, 0xdefc }, /* 0x8800 */ { 12470, 0xbf7f }, { 12484, 0xbbfb }, { 12497, 0xffff }, { 12513, 0xfbef }, { 12527, 0xfd7f }, { 12541, 0x6eec }, { 12551, 0xefbf }, { 12565, 0xf2f7 }, { 12577, 0xfb9f }, { 12590, 0xdfef }, { 12604, 0x5d97 }, { 12614, 0xf7f6 }, { 12627, 0xfea7 }, { 12639, 0xfff5 }, { 12653, 0xd9c2 }, { 12661, 0xffff }, /* 0x8900 */ { 12677, 0x5ee7 }, { 12688, 0xc7ff }, { 12701, 0xfefe }, { 12715, 0x79ef }, { 12727, 0xbade }, { 12738, 0xffdf }, { 12753, 0xfe7f }, { 12767, 0xdede }, { 12779, 0x8fef }, { 12791, 0xf9fa }, { 12803, 0xf6fe }, { 12816, 0xf6c4 }, { 12825, 0x0043 }, { 12828, 0xbe7c }, { 12839, 0x3bff }, { 12852, 0xdddf }, /* 0x8a00 */ { 12865, 0xd59d }, { 12875, 0xf9ef }, { 12888, 0x3eac }, { 12897, 0xff53 }, { 12909, 0xf773 }, { 12921, 0x4bf7 }, { 12932, 0x7bcf }, { 12944, 0xdeff }, { 12958, 0xb8fe }, { 12969, 0x577f }, { 12981, 0x8ffb }, { 12993, 0xff55 }, { 13005, 0xabfd }, { 13017, 0xfffe }, { 13032, 0xedd7 }, { 13044, 0xddff }, /* 0x8b00 */ { 13058, 0xfdf7 }, { 13072, 0xffff }, { 13088, 0xfdfd }, { 13102, 0xfeeb }, { 13115, 0xffef }, { 13130, 0xf7ff }, { 13145, 0xbfed }, { 13158, 0xef91 }, { 13168, 0x5d7f }, { 13180, 0xdf7d }, { 13193, 0x0001 }, { 13194, 0x4000 }, { 13195, 0x0000 }, { 13195, 0x0000 }, { 13195, 0x0004 }, { 13196, 0x0000 }, /* 0x8c00 */ { 13196, 0x0000 }, { 13196, 0x0000 }, { 13196, 0x0000 }, { 13196, 0xfa80 }, { 13203, 0xffee }, { 13217, 0xb4f3 }, { 13227, 0xbf76 }, { 13239, 0x2fef }, { 13251, 0xb677 }, { 13262, 0xffbf }, { 13277, 0xbfbf }, { 13291, 0xfffd }, { 13306, 0xb5bf }, { 13318, 0xfefe }, { 13332, 0x7fff }, { 13347, 0x7fbf }, /* 0x8d00 */ { 13361, 0xbffd }, { 13375, 0x3bff }, { 13388, 0x0000 }, { 13388, 0x0000 }, { 13388, 0x0000 }, { 13388, 0x0000 }, { 13388, 0xfbd0 }, { 13398, 0x2fdd }, { 13409, 0xf637 }, { 13420, 0x9a7f }, { 13431, 0xffeb }, { 13445, 0xd6fc }, { 13456, 0xf9ef }, { 13469, 0xbffb }, { 13483, 0xdfdf }, { 13497, 0xf41f }, /* 0x8e00 */ { 13507, 0xe6ff }, { 13520, 0xffff }, { 13536, 0x6fff }, { 13550, 0xf77b }, { 13563, 0xfff7 }, { 13578, 0xfef9 }, { 13591, 0xb7ff }, { 13605, 0x5dfe }, { 13617, 0x7ff7 }, { 13631, 0xe5ff }, { 13644, 0x3ffb }, { 13657, 0x3645 }, { 13664, 0xfe0d }, { 13674, 0xfd9e }, { 13686, 0xfbf7 }, { 13700, 0xdff6 }, /* 0x8f00 */ { 13713, 0x6fef }, { 13726, 0xffff }, { 13742, 0xf679 }, { 13753, 0xcbfd }, { 13765, 0xefff }, { 13780, 0xffff }, { 13796, 0x40df }, { 13804, 0x0000 }, { 13804, 0x0000 }, { 13804, 0x9808 }, { 13808, 0xe1e9 }, { 13817, 0xdfff }, { 13832, 0xfe76 }, { 13844, 0x04ff }, { 13853, 0x6d7f }, { 13865, 0xfff1 }, /* 0x9000 */ { 13878, 0xb97f }, { 13890, 0xfef7 }, { 13904, 0xe01f }, { 13912, 0xf1fe }, { 13924, 0xfe96 }, { 13935, 0x7b7f }, { 13948, 0xfb9f }, { 13961, 0xfffd }, { 13976, 0xadff }, { 13989, 0xcbb3 }, { 13999, 0xc5ef }, { 14010, 0xe97f }, { 14022, 0x4dba }, { 14031, 0xbff0 }, { 14042, 0xbf3f }, { 14055, 0xfe3f }, /* 0x9100 */ { 14068, 0xebff }, { 14082, 0xffd7 }, { 14096, 0xffdf }, { 14111, 0xcf7f }, { 14124, 0xfffb }, { 14139, 0xd7ef }, { 14152, 0xd7bf }, { 14165, 0x17fd }, { 14176, 0xfeff }, { 14191, 0xfe0f }, { 14202, 0xffaf }, { 14216, 0x7eff }, { 14230, 0xfaff }, { 14244, 0xb7fb }, { 14257, 0x7ffc }, { 14270, 0xe7fa }, /* 0x9200 */ { 14282, 0xf7ff }, { 14297, 0x56ff }, { 14309, 0x6dfa }, { 14320, 0xf7ff }, { 14335, 0xff73 }, { 14348, 0xedff }, { 14362, 0xf8ff }, { 14375, 0xffc5 }, { 14387, 0xffff }, { 14403, 0x3ffa }, { 14415, 0x5fff }, { 14429, 0xdefe }, { 14442, 0xffff }, { 14458, 0xebbf }, { 14471, 0xdffb }, { 14485, 0xffdf }, /* 0x9300 */ { 14500, 0xfbdf }, { 14514, 0xef7d }, { 14527, 0xffff }, { 14543, 0x137b }, { 14552, 0xffff }, { 14568, 0xdff7 }, { 14582, 0x7fff }, { 14597, 0x7ffb }, { 14611, 0xf7ff }, { 14626, 0xfff7 }, { 14641, 0xf7ff }, { 14656, 0xa9bf }, { 14667, 0xfddd }, { 14680, 0xffff }, { 14696, 0x51df }, { 14706, 0xfffb }, /* 0x9400 */ { 14721, 0xffdb }, { 14735, 0x2bff }, { 14747, 0x7ff1 }, { 14759, 0xffef }, { 14774, 0xbffd }, { 14788, 0x69b7 }, { 14798, 0xffbd }, { 14812, 0xfbff }, { 14827, 0x002f }, { 14832, 0x8000 }, { 14833, 0x0004 }, { 14834, 0x0000 }, { 14834, 0x000a }, { 14836, 0x1000 }, { 14837, 0x0000 }, { 14837, 0x0040 }, /* 0x9500 */ { 14838, 0x0000 }, { 14838, 0x0000 }, { 14838, 0x2000 }, { 14839, 0x0000 }, { 14839, 0x0080 }, { 14840, 0x0000 }, { 14840, 0x0000 }, { 14840, 0xbd80 }, { 14847, 0xfb6d }, { 14859, 0xdbdf }, { 14872, 0x7fff }, { 14887, 0xfee3 }, { 14899, 0x3fe9 }, { 14910, 0xdc7f }, { 14922, 0x013f }, { 14929, 0x0010 }, /* 0x9600 */ { 14930, 0x0000 }, { 14930, 0x7000 }, { 14933, 0xf51f }, { 14944, 0xbf0f }, { 14955, 0xfc3f }, { 14967, 0xf95b }, { 14978, 0xbe1e }, { 14988, 0x79ff }, { 15001, 0xeffb }, { 15015, 0x5bfe }, { 15027, 0x57be }, { 15038, 0xbb5b }, { 15049, 0x7fff }, { 15064, 0xfffc }, { 15078, 0x872e }, { 15086, 0xaff7 }, /* 0x9700 */ { 15099, 0xebfd }, { 15112, 0xfb4f }, { 15124, 0xdfff }, { 15139, 0xe767 }, { 15150, 0x0bdf }, { 15160, 0xfde6 }, { 15172, 0x7747 }, { 15182, 0xfddf }, { 15196, 0xefbf }, { 15210, 0xff90 }, { 15220, 0x7d7f }, { 15233, 0xefde }, { 15246, 0xfbff }, { 15261, 0xf3fd }, { 15274, 0x606b }, { 15281, 0xef6f }, /* 0x9800 */ { 15294, 0xf5ff }, { 15308, 0xf9ff }, { 15322, 0xebdb }, { 15334, 0x0bbd }, { 15343, 0xfffa }, { 15357, 0xfb8f }, { 15369, 0x9ffd }, { 15382, 0x003f }, { 15388, 0x0000 }, { 15388, 0x0000 }, { 15388, 0xf300 }, { 15394, 0xffde }, { 15408, 0x5fdf }, { 15421, 0xd800 }, { 15425, 0xbeef }, { 15438, 0x7676 }, /* 0x9900 */ { 15448, 0x57ad }, { 15458, 0xdfff }, { 15473, 0xffb2 }, { 15485, 0xffaf }, { 15499, 0x7faf }, { 15512, 0xfbff }, { 15527, 0x000e }, { 15530, 0x0000 }, { 15530, 0x0000 }, { 15530, 0x7bc0 }, { 15538, 0xfdfa }, { 15551, 0x3f3f }, { 15563, 0xfabe }, { 15575, 0xbfff }, { 15590, 0x76ff }, { 15603, 0xfff3 }, /* 0x9a00 */ { 15617, 0xfefe }, { 15631, 0xfe73 }, { 15643, 0xfeff }, { 15658, 0xfff7 }, { 15673, 0xf77f }, { 15687, 0xdffd }, { 15701, 0x1ffd }, { 15713, 0x0000 }, { 15713, 0x8000 }, { 15714, 0x0000 }, { 15714, 0xa900 }, { 15718, 0xffdf }, { 15733, 0xa4c7 }, { 15741, 0x91ff }, { 15752, 0xf8cf }, { 15763, 0xfede }, /* 0x9b00 */ { 15776, 0xff7e }, { 15790, 0xc7f7 }, { 15802, 0xefbd }, { 15815, 0xdebe }, { 15827, 0xfd7f }, { 15841, 0x8f77 }, { 15852, 0x93d3 }, { 15861, 0xfcf3 }, { 15873, 0xe9ef }, { 15885, 0xecaf }, { 15896, 0xed77 }, { 15908, 0xa361 }, { 15915, 0x87db }, { 15925, 0x7ef8 }, { 15936, 0x3ff7 }, { 15949, 0xa193 }, /* 0x9c00 */ { 15956, 0x7fe4 }, { 15967, 0xb8bd }, { 15977, 0xbb7b }, { 15989, 0xfefe }, { 16003, 0xff73 }, { 16016, 0xe3fd }, { 16028, 0x61cd }, { 16036, 0x1fbe }, { 16047, 0x0000 }, { 16047, 0x0000 }, { 16047, 0x0000 }, { 16047, 0x0000 }, { 16047, 0x0000 }, { 16047, 0x0000 }, { 16047, 0x26e0 }, { 16053, 0xbefe }, /* 0x9d00 */ { 16066, 0x13fd }, { 16076, 0xebf5 }, { 16088, 0xe36f }, { 16099, 0xebdb }, { 16111, 0xde3f }, { 16123, 0xffdf }, { 16138, 0xff83 }, { 16149, 0xfbbf }, { 16163, 0x1fff }, { 16176, 0xffdd }, { 16190, 0xbfff }, { 16205, 0xfffe }, { 16220, 0xffbf }, { 16235, 0xffff }, { 16251, 0xfb7e }, { 16264, 0xfffd }, /* 0x9e00 */ { 16279, 0xfeff }, { 16294, 0xffbf }, { 16309, 0x0000 }, { 16309, 0x0000 }, { 16309, 0x0000 }, { 16309, 0x0000 }, { 16309, 0x0000 }, { 16309, 0xbe20 }, { 16316, 0x7fff }, { 16331, 0xffff }, { 16347, 0xfff7 }, { 16362, 0xf8f3 }, { 16373, 0xf1df }, { 16385, 0xfd7b }, { 16398, 0xe9f5 }, { 16409, 0xffff }, /* 0x9f00 */ { 16425, 0xc7c7 }, { 16435, 0x5fed }, { 16447, 0xfffd }, { 16462, 0x6bff }, { 16475, 0xffff }, { 16491, 0xfffd }, { 16506, 0xdeff }, { 16520, 0xcff7 }, { 16533, 0x6000 }, { 16535, 0x9337 }, { 16544, 0x0035 }, }; static const Summary16 big5hkscs_uni2indx_pagee0[419] = { /* 0xe000 */ { 16548, 0xffff }, { 16564, 0xffff }, { 16580, 0xffff }, { 16596, 0xffff }, { 16612, 0xffff }, { 16628, 0xffff }, { 16644, 0xffff }, { 16660, 0xffff }, { 16676, 0xffff }, { 16692, 0xffff }, { 16708, 0xffff }, { 16724, 0xffff }, { 16740, 0xffff }, { 16756, 0xffff }, { 16772, 0xffff }, { 16788, 0xffff }, /* 0xe100 */ { 16804, 0xffff }, { 16820, 0xffff }, { 16836, 0xffff }, { 16852, 0xffff }, { 16868, 0xffff }, { 16884, 0xffff }, { 16900, 0xffff }, { 16916, 0xffff }, { 16932, 0xffff }, { 16948, 0xffff }, { 16964, 0xffff }, { 16980, 0xffff }, { 16996, 0xffff }, { 17012, 0xffff }, { 17028, 0xffff }, { 17044, 0xffff }, /* 0xe200 */ { 17060, 0xffff }, { 17076, 0xffff }, { 17092, 0xffff }, { 17108, 0xffff }, { 17124, 0xffff }, { 17140, 0xffff }, { 17156, 0xffff }, { 17172, 0xffff }, { 17188, 0xffff }, { 17204, 0xffff }, { 17220, 0xffff }, { 17236, 0xffff }, { 17252, 0xffff }, { 17268, 0xffff }, { 17284, 0xffff }, { 17300, 0xffff }, /* 0xe300 */ { 17316, 0xffff }, { 17332, 0xffff }, { 17348, 0xffff }, { 17364, 0xffff }, { 17380, 0xffff }, { 17396, 0xffff }, { 17412, 0xffff }, { 17428, 0xffff }, { 17444, 0xffff }, { 17460, 0xffff }, { 17476, 0xffff }, { 17492, 0xffff }, { 17508, 0xffff }, { 17524, 0xffff }, { 17540, 0xffff }, { 17556, 0xffff }, /* 0xe400 */ { 17572, 0xffff }, { 17588, 0xffff }, { 17604, 0xffff }, { 17620, 0xffff }, { 17636, 0xffff }, { 17652, 0xffff }, { 17668, 0xffff }, { 17684, 0xffff }, { 17700, 0xffff }, { 17716, 0xffff }, { 17732, 0xffff }, { 17748, 0xffff }, { 17764, 0xffff }, { 17780, 0xffff }, { 17796, 0xffff }, { 17812, 0xffff }, /* 0xe500 */ { 17828, 0xffff }, { 17844, 0xffff }, { 17860, 0xffff }, { 17876, 0xffff }, { 17892, 0xffff }, { 17908, 0xffff }, { 17924, 0xffff }, { 17940, 0xffff }, { 17956, 0xffff }, { 17972, 0xffff }, { 17988, 0xffff }, { 18004, 0xffff }, { 18020, 0xffff }, { 18036, 0xffff }, { 18052, 0xffff }, { 18068, 0xffff }, /* 0xe600 */ { 18084, 0xffff }, { 18100, 0xffff }, { 18116, 0xffff }, { 18132, 0xffff }, { 18148, 0xffff }, { 18164, 0xffff }, { 18180, 0xffff }, { 18196, 0xffff }, { 18212, 0xffff }, { 18228, 0xffff }, { 18244, 0xffff }, { 18260, 0xffff }, { 18276, 0xffff }, { 18292, 0xffff }, { 18308, 0xffff }, { 18324, 0xffff }, /* 0xe700 */ { 18340, 0xffff }, { 18356, 0xffff }, { 18372, 0xffff }, { 18388, 0xffff }, { 18404, 0xffff }, { 18420, 0xffff }, { 18436, 0xffff }, { 18452, 0xffff }, { 18468, 0xffff }, { 18484, 0xffff }, { 18500, 0xffff }, { 18516, 0xffff }, { 18532, 0xffff }, { 18548, 0xffff }, { 18564, 0xffff }, { 18580, 0xffff }, /* 0xe800 */ { 18596, 0xffff }, { 18612, 0xffff }, { 18628, 0xffff }, { 18644, 0xffff }, { 18660, 0xffff }, { 18676, 0xffff }, { 18692, 0xffff }, { 18708, 0xffff }, { 18724, 0xffff }, { 18740, 0xffff }, { 18756, 0xffff }, { 18772, 0xffff }, { 18788, 0xffff }, { 18804, 0xffff }, { 18820, 0xffff }, { 18836, 0xffff }, /* 0xe900 */ { 18852, 0xffff }, { 18868, 0xffff }, { 18884, 0xffff }, { 18900, 0xffff }, { 18916, 0xffff }, { 18932, 0xffff }, { 18948, 0xffff }, { 18964, 0xffff }, { 18980, 0xffff }, { 18996, 0xffff }, { 19012, 0xffff }, { 19028, 0xffff }, { 19044, 0xffff }, { 19060, 0xffff }, { 19076, 0xffff }, { 19092, 0xffff }, /* 0xea00 */ { 19108, 0xffff }, { 19124, 0xffff }, { 19140, 0xffff }, { 19156, 0xffff }, { 19172, 0xffff }, { 19188, 0xffff }, { 19204, 0xffff }, { 19220, 0xffff }, { 19236, 0xffff }, { 19252, 0xffff }, { 19268, 0xffff }, { 19284, 0xffff }, { 19300, 0xffff }, { 19316, 0xffff }, { 19332, 0xffff }, { 19348, 0xffff }, /* 0xeb00 */ { 19364, 0xffff }, { 19380, 0xffff }, { 19396, 0xffff }, { 19412, 0xffff }, { 19428, 0xffff }, { 19444, 0xffff }, { 19460, 0xffff }, { 19476, 0xffff }, { 19492, 0xffff }, { 19508, 0xffff }, { 19524, 0xffff }, { 19540, 0xffff }, { 19556, 0xffff }, { 19572, 0xffff }, { 19588, 0xffff }, { 19604, 0xffff }, /* 0xec00 */ { 19620, 0xffff }, { 19636, 0xffff }, { 19652, 0xffff }, { 19668, 0xffff }, { 19684, 0xffff }, { 19700, 0xffff }, { 19716, 0xffff }, { 19732, 0xffff }, { 19748, 0xffff }, { 19764, 0xffff }, { 19780, 0xffff }, { 19796, 0xffff }, { 19812, 0xffff }, { 19828, 0xffff }, { 19844, 0xffff }, { 19860, 0xffff }, /* 0xed00 */ { 19876, 0xffff }, { 19892, 0xffff }, { 19908, 0xffff }, { 19924, 0xffff }, { 19940, 0xffff }, { 19956, 0xffff }, { 19972, 0xffff }, { 19988, 0xffff }, { 20004, 0xffff }, { 20020, 0xffff }, { 20036, 0xffff }, { 20052, 0xffff }, { 20068, 0xffff }, { 20084, 0xffff }, { 20100, 0xffff }, { 20116, 0xffff }, /* 0xee00 */ { 20132, 0xffff }, { 20148, 0xffff }, { 20164, 0xffff }, { 20180, 0xffff }, { 20196, 0xffff }, { 20212, 0xffff }, { 20228, 0xffff }, { 20244, 0xffff }, { 20260, 0xffff }, { 20276, 0xffff }, { 20292, 0xffff }, { 20308, 0xffff }, { 20324, 0xffff }, { 20340, 0xffff }, { 20356, 0xffff }, { 20372, 0xffff }, /* 0xef00 */ { 20388, 0xffff }, { 20404, 0xffff }, { 20420, 0xffff }, { 20436, 0xffff }, { 20452, 0xffff }, { 20468, 0xffff }, { 20484, 0xffff }, { 20500, 0xffff }, { 20516, 0xffff }, { 20532, 0xffff }, { 20548, 0xffff }, { 20564, 0xffff }, { 20580, 0xffff }, { 20596, 0xffff }, { 20612, 0xffff }, { 20628, 0xffff }, /* 0xf000 */ { 20644, 0xffff }, { 20660, 0xffff }, { 20676, 0xffff }, { 20692, 0xffff }, { 20708, 0xffff }, { 20724, 0xffff }, { 20740, 0xffff }, { 20756, 0xffff }, { 20772, 0xffff }, { 20788, 0xffff }, { 20804, 0xffff }, { 20820, 0xffff }, { 20836, 0xffff }, { 20852, 0xffff }, { 20868, 0xffff }, { 20884, 0xffff }, /* 0xf100 */ { 20900, 0xffff }, { 20916, 0xffff }, { 20932, 0xffff }, { 20948, 0xffff }, { 20964, 0xffff }, { 20980, 0xffff }, { 20996, 0xffff }, { 21012, 0xffff }, { 21028, 0xffff }, { 21044, 0xffff }, { 21060, 0xffff }, { 21076, 0xffff }, { 21092, 0xffff }, { 21108, 0xffff }, { 21124, 0xffff }, { 21140, 0xffff }, /* 0xf200 */ { 21156, 0xffff }, { 21172, 0xffff }, { 21188, 0xffff }, { 21204, 0xffff }, { 21220, 0xffff }, { 21236, 0xffff }, { 21252, 0xffff }, { 21268, 0xffff }, { 21284, 0xffff }, { 21300, 0xffff }, { 21316, 0xffff }, { 21332, 0xffff }, { 21348, 0xffff }, { 21364, 0xffff }, { 21380, 0xffff }, { 21396, 0xffff }, /* 0xf300 */ { 21412, 0xffff }, { 21428, 0xffff }, { 21444, 0xffff }, { 21460, 0xffff }, { 21476, 0xffff }, { 21492, 0xffff }, { 21508, 0xffff }, { 21524, 0xffff }, { 21540, 0xffff }, { 21556, 0xffff }, { 21572, 0xffff }, { 21588, 0xffff }, { 21604, 0xffff }, { 21620, 0xffff }, { 21636, 0xffff }, { 21652, 0xffff }, /* 0xf400 */ { 21668, 0xffff }, { 21684, 0xffff }, { 21700, 0xffff }, { 21716, 0xffff }, { 21732, 0xffff }, { 21748, 0xffff }, { 21764, 0xffff }, { 21780, 0xffff }, { 21796, 0xffff }, { 21812, 0xffff }, { 21828, 0xffff }, { 21844, 0xffff }, { 21860, 0xffff }, { 21876, 0xffff }, { 21892, 0xffff }, { 21908, 0xffff }, /* 0xf500 */ { 21924, 0xffff }, { 21940, 0xffff }, { 21956, 0xffff }, { 21972, 0xffff }, { 21988, 0xffff }, { 22004, 0xffff }, { 22020, 0xffff }, { 22036, 0xffff }, { 22052, 0xffff }, { 22068, 0xffff }, { 22084, 0xffff }, { 22100, 0xffff }, { 22116, 0xffff }, { 22132, 0xffff }, { 22148, 0xffff }, { 22164, 0xffff }, /* 0xf600 */ { 22180, 0xffff }, { 22196, 0xffff }, { 22212, 0xffff }, { 22228, 0xffff }, { 22244, 0xffff }, { 22260, 0xffff }, { 22276, 0xffff }, { 22292, 0xffff }, { 22308, 0xffff }, { 22324, 0xffff }, { 22340, 0xffff }, { 22356, 0xffff }, { 22372, 0xffff }, { 22388, 0xffff }, { 22404, 0xffff }, { 22420, 0xffff }, /* 0xf700 */ { 22436, 0xffff }, { 22452, 0xffff }, { 22468, 0xffff }, { 22484, 0xffff }, { 22500, 0xffff }, { 22516, 0xffff }, { 22532, 0xffff }, { 22548, 0xffff }, { 22564, 0xffff }, { 22580, 0xffff }, { 22596, 0xffff }, { 22612, 0xffff }, { 22628, 0xffff }, { 22644, 0xffff }, { 22660, 0xffff }, { 22676, 0xffff }, /* 0xf800 */ { 22692, 0xffff }, { 22708, 0xffff }, { 22724, 0xffff }, { 22740, 0xffff }, { 22756, 0x01ff }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, /* 0xf900 */ { 22765, 0xffff }, { 22781, 0xffff }, { 22797, 0xefff }, { 22812, 0xffff }, { 22828, 0xffff }, { 22844, 0xffff }, { 22860, 0xffff }, { 22876, 0xfdff }, { 22891, 0xffff }, { 22907, 0xffdf }, { 22922, 0xffff }, { 22938, 0xffff }, { 22954, 0xffff }, { 22970, 0xffff }, { 22986, 0xff7f }, { 23001, 0xfffd }, /* 0xfa00 */ { 23016, 0x3fff }, { 23030, 0x7ee5 }, { 23041, 0x3c64 }, }; static const Summary16 big5hkscs_uni2indx_pagefe[31] = { /* 0xfe00 */ { 23048, 0x0000 }, { 23048, 0x0000 }, { 23048, 0x0000 }, { 23048, 0xfffb }, { 23063, 0xfe1f }, { 23075, 0xfef7 }, { 23089, 0x0f7f }, { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, /* 0xff00 */ { 23100, 0xfffe }, { 23115, 0xffff }, { 23131, 0xffff }, { 23147, 0xffff }, { 23163, 0xffff }, { 23179, 0x7fff }, { 23194, 0x0010 }, { 23195, 0x0000 }, { 23195, 0x0000 }, { 23195, 0x0000 }, { 23195, 0x0000 }, { 23195, 0x0000 }, { 23195, 0x0000 }, { 23195, 0x0000 }, { 23195, 0x203f }, }; static int big5hkscs_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { if (n >= 2) { const Summary16 *summary = NULL; if (wc >= 0x0000 && wc < 0x0100) summary = &big5hkscs_uni2indx_page00[(wc>>4)]; else if (wc >= 0x0200 && wc < 0x03d0) summary = &big5hkscs_uni2indx_page02[(wc>>4)-0x020]; else if (wc >= 0x2000 && wc < 0x22c0) summary = &big5hkscs_uni2indx_page20[(wc>>4)-0x200]; else if (wc >= 0x2500 && wc < 0x2650) summary = &big5hkscs_uni2indx_page25[(wc>>4)-0x250]; else if (wc >= 0x3000 && wc < 0x33e0) summary = &big5hkscs_uni2indx_page30[(wc>>4)-0x300]; else if (wc >= 0x4e00 && wc < 0x9fb0) summary = &big5hkscs_uni2indx_page4e[(wc>>4)-0x4e0]; else if (wc >= 0xe000 && wc < 0xfa30) summary = &big5hkscs_uni2indx_pagee0[(wc>>4)-0xe00]; else if (wc >= 0xfe00 && wc < 0xfff0) summary = &big5hkscs_uni2indx_pagefe[(wc>>4)-0xfe0]; if (summary) { unsigned short used = summary->used; unsigned int i = wc & 0x0f; if (used & ((unsigned short) 1 << i)) { unsigned short c; /* Keep in `used' only the bits 0..i-1. */ used &= ((unsigned short) 1 << i) - 1; /* Add `summary->indx' and the number of bits set in `used'. */ used = (used & 0x5555) + ((used & 0xaaaa) >> 1); used = (used & 0x3333) + ((used & 0xcccc) >> 2); used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); used = (used & 0x00ff) + (used >> 8); c = big5hkscs_2charset[summary->indx + used]; r[0] = (c >> 8); r[1] = (c & 0xff); return 2; } } return RET_ILSEQ; } return RET_TOOSMALL; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/cp1133.h0000644000000000000000000000534313614532331017266 0ustar /* * IBM-CP1133 */ static const unsigned short cp1133_2uni_1[64] = { /* 0xa0 */ 0x00a0, 0x0e81, 0x0e82, 0x0e84, 0x0e87, 0x0e88, 0x0eaa, 0x0e8a, 0x0e8d, 0x0e94, 0x0e95, 0x0e96, 0x0e97, 0x0e99, 0x0e9a, 0x0e9b, /* 0xb0 */ 0x0e9c, 0x0e9d, 0x0e9e, 0x0e9f, 0x0ea1, 0x0ea2, 0x0ea3, 0x0ea5, 0x0ea7, 0x0eab, 0x0ead, 0x0eae, 0xfffd, 0xfffd, 0xfffd, 0x0eaf, /* 0xc0 */ 0x0eb0, 0x0eb2, 0x0eb3, 0x0eb4, 0x0eb5, 0x0eb6, 0x0eb7, 0x0eb8, 0x0eb9, 0x0ebc, 0x0eb1, 0x0ebb, 0x0ebd, 0xfffd, 0xfffd, 0xfffd, /* 0xd0 */ 0x0ec0, 0x0ec1, 0x0ec2, 0x0ec3, 0x0ec4, 0x0ec8, 0x0ec9, 0x0eca, 0x0ecb, 0x0ecc, 0x0ecd, 0x0ec6, 0xfffd, 0x0edc, 0x0edd, 0x20ad, }; static const unsigned short cp1133_2uni_2[16] = { /* 0xf0 */ 0x0ed0, 0x0ed1, 0x0ed2, 0x0ed3, 0x0ed4, 0x0ed5, 0x0ed6, 0x0ed7, 0x0ed8, 0x0ed9, 0xfffd, 0xfffd, 0x00a2, 0x00ac, 0x00a6, 0xfffd, }; static int cp1133_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0xa0) { *pwc = (ucs4_t) c; return 1; } else if (c < 0xe0) { unsigned short wc = cp1133_2uni_1[c-0xa0]; if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 1; } } else if (c < 0xf0) { } else { unsigned short wc = cp1133_2uni_2[c-0xf0]; if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 1; } } return RET_ILSEQ; } static const unsigned char cp1133_page00[16] = { 0xa0, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfe, 0x00, /* 0xa0-0xa7 */ 0x00, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ }; static const unsigned char cp1133_page0e[96] = { 0x00, 0xa1, 0xa2, 0x00, 0xa3, 0x00, 0x00, 0xa4, /* 0x80-0x87 */ 0xa5, 0x00, 0xa7, 0x00, 0x00, 0xa8, 0x00, 0x00, /* 0x88-0x8f */ 0x00, 0x00, 0x00, 0x00, 0xa9, 0xaa, 0xab, 0xac, /* 0x90-0x97 */ 0x00, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, /* 0x98-0x9f */ 0x00, 0xb4, 0xb5, 0xb6, 0x00, 0xb7, 0x00, 0xb8, /* 0xa0-0xa7 */ 0x00, 0x00, 0xa6, 0xb9, 0x00, 0xba, 0xbb, 0xbf, /* 0xa8-0xaf */ 0xc0, 0xca, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, /* 0xb0-0xb7 */ 0xc7, 0xc8, 0x00, 0xcb, 0xc9, 0xcc, 0x00, 0x00, /* 0xb8-0xbf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0x00, 0xdb, 0x00, /* 0xc0-0xc7 */ 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0x00, 0x00, /* 0xc8-0xcf */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */ 0xf8, 0xf9, 0x00, 0x00, 0xdd, 0xde, 0x00, 0x00, /* 0xd8-0xdf */ }; static int cp1133_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x00b0) c = cp1133_page00[wc-0x00a0]; else if (wc >= 0x0e80 && wc < 0x0ee0) c = cp1133_page0e[wc-0x0e80]; else if (wc == 0x20ad) c = 0xdf; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/cp1251.h0000644000000000000000000001013013614532331017255 0ustar /* * CP1251 */ static const unsigned short cp1251_2uni[128] = { /* 0x80 */ 0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f, /* 0x90 */ 0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0xfffd, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f, /* 0xa0 */ 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, /* 0xb0 */ 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, /* 0xc0 */ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, /* 0xd0 */ 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, /* 0xe0 */ 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, /* 0xf0 */ 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, }; static int cp1251_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0x80) { *pwc = (ucs4_t) c; return 1; } else { unsigned short wc = cp1251_2uni[c-0x80]; if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 1; } } return RET_ILSEQ; } static const unsigned char cp1251_page00[32] = { 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0x00, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ 0xb0, 0xb1, 0x00, 0x00, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ }; static const unsigned char cp1251_page04[152] = { 0x00, 0xa8, 0x80, 0x81, 0xaa, 0xbd, 0xb2, 0xaf, /* 0x00-0x07 */ 0xa3, 0x8a, 0x8c, 0x8e, 0x8d, 0x00, 0xa1, 0x8f, /* 0x08-0x0f */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x10-0x17 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x18-0x1f */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x20-0x27 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x28-0x2f */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x30-0x37 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x38-0x3f */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x40-0x47 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0x48-0x4f */ 0x00, 0xb8, 0x90, 0x83, 0xba, 0xbe, 0xb3, 0xbf, /* 0x50-0x57 */ 0xbc, 0x9a, 0x9c, 0x9e, 0x9d, 0x00, 0xa2, 0x9f, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0xa5, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ }; static const unsigned char cp1251_page20[48] = { 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ }; static int cp1251_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x0080) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x00c0) c = cp1251_page00[wc-0x00a0]; else if (wc >= 0x0400 && wc < 0x0498) c = cp1251_page04[wc-0x0400]; else if (wc >= 0x2010 && wc < 0x2040) c = cp1251_page20[wc-0x2010]; else if (wc == 0x20ac) c = 0x88; else if (wc == 0x2116) c = 0xb9; else if (wc == 0x2122) c = 0x99; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/cp1255.h0000644000000000000000000001060013614532331017263 0ustar /* * CP1255 */ static const unsigned short cp1255_2uni[128] = { /* 0x80 */ 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, 0x02c6, 0x2030, 0xfffd, 0x2039, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x90 */ 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x02dc, 0x2122, 0xfffd, 0x203a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xa0 */ 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20aa, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, /* 0xb0 */ 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, /* 0xc0 */ 0x05b0, 0x05b1, 0x05b2, 0x05b3, 0x05b4, 0x05b5, 0x05b6, 0x05b7, 0x05b8, 0x05b9, 0xfffd, 0x05bb, 0x05bc, 0x05bd, 0x05be, 0x05bf, /* 0xd0 */ 0x05c0, 0x05c1, 0x05c2, 0x05c3, 0x05f0, 0x05f1, 0x05f2, 0x05f3, 0x05f4, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xe0 */ 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, /* 0xf0 */ 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, 0x05e8, 0x05e9, 0x05ea, 0xfffd, 0xfffd, 0x200e, 0x200f, 0xfffd, }; static int cp1255_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0x80) { *pwc = (ucs4_t) c; return 1; } else { unsigned short wc = cp1255_2uni[c-0x80]; if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 1; } } return RET_ILSEQ; } static const unsigned char cp1255_page00[88] = { 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, /* 0xd0-0xd7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, /* 0xf0-0xf7 */ }; static const unsigned char cp1255_page02[32] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ }; static const unsigned char cp1255_page05[72] = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xb0-0xb7 */ 0xc8, 0xc9, 0x00, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xb8-0xbf */ 0xd0, 0xd1, 0xd2, 0xd3, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xd0-0xd7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xd8-0xdf */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xe0-0xe7 */ 0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */ }; static const unsigned char cp1255_page20[56] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ }; static int cp1255_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x0080) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x00f8) c = cp1255_page00[wc-0x00a0]; else if (wc == 0x0192) c = 0x83; else if (wc >= 0x02c0 && wc < 0x02e0) c = cp1255_page02[wc-0x02c0]; else if (wc >= 0x05b0 && wc < 0x05f8) c = cp1255_page05[wc-0x05b0]; else if (wc >= 0x2008 && wc < 0x2040) c = cp1255_page20[wc-0x2008]; else if (wc == 0x20aa) c = 0xa4; else if (wc == 0x20ac) c = 0x80; else if (wc == 0x2122) c = 0x99; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/cp1256.h0000644000000000000000000001333213614532331017271 0ustar /* * CP1256 */ static const unsigned short cp1256_2uni[128] = { /* 0x80 */ 0x20ac, 0x067e, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, 0x02c6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, /* 0x90 */ 0x06af, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x06a9, 0x2122, 0x0691, 0x203a, 0x0153, 0x200c, 0x200d, 0x06ba, /* 0xa0 */ 0x00a0, 0x060c, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x06be, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, /* 0xb0 */ 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x061b, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x061f, /* 0xc0 */ 0x06c1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, /* 0xd0 */ 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00d7, 0x0637, 0x0638, 0x0639, 0x063a, 0x0640, 0x0641, 0x0642, 0x0643, /* 0xe0 */ 0x00e0, 0x0644, 0x00e2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x0649, 0x064a, 0x00ee, 0x00ef, /* 0xf0 */ 0x064b, 0x064c, 0x064d, 0x064e, 0x00f4, 0x064f, 0x0650, 0x00f7, 0x0651, 0x00f9, 0x0652, 0x00fb, 0x00fc, 0x200e, 0x200f, 0x06d2, }; static int cp1256_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0x80) *pwc = (ucs4_t) c; else *pwc = (ucs4_t) cp1256_2uni[c-0x80]; return 1; } static const unsigned char cp1256_page00[96] = { 0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7, /* 0xd0-0xd7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 0xe0, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */ 0xe8, 0xe9, 0xea, 0xeb, 0x00, 0x00, 0xee, 0xef, /* 0xe8-0xef */ 0x00, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */ 0x00, 0xf9, 0x00, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ }; static const unsigned char cp1256_page01[72] = { 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ }; static const unsigned char cp1256_page06[208] = { 0x00, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0xbf, /* 0x18-0x1f */ 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd8, /* 0x30-0x37 */ 0xd9, 0xda, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0xdc, 0xdd, 0xde, 0xdf, 0xe1, 0xe3, 0xe4, 0xe5, /* 0x40-0x47 */ 0xe6, 0xec, 0xed, 0xf0, 0xf1, 0xf2, 0xf3, 0xf5, /* 0x48-0x4f */ 0xf6, 0xf8, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x00, /* 0x80-0x87 */ 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, /* 0xa8-0xaf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0xaa, 0x00, /* 0xb8-0xbf */ 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ }; static const unsigned char cp1256_page20[56] = { 0x00, 0x00, 0x00, 0x00, 0x9d, 0x9e, 0xfd, 0xfe, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ }; static int cp1256_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x0080) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x0100) c = cp1256_page00[wc-0x00a0]; else if (wc >= 0x0150 && wc < 0x0198) c = cp1256_page01[wc-0x0150]; else if (wc == 0x02c6) c = 0x88; else if (wc >= 0x0608 && wc < 0x06d8) c = cp1256_page06[wc-0x0608]; else if (wc >= 0x2008 && wc < 0x2040) c = cp1256_page20[wc-0x2008]; else if (wc == 0x20ac) c = 0x80; else if (wc == 0x2122) c = 0x99; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/gb2312.h0000644000000000000000000046322313614532331017261 0ustar /* * GB2312.1980-0 */ static const unsigned short gb2312_2uni_page21[831] = { /* 0x21 */ 0x3000, 0x3001, 0x3002, 0x30fb, 0x02c9, 0x02c7, 0x00a8, 0x3003, 0x3005, 0x2015, 0xff5e, 0x2016, 0x2026, 0x2018, 0x2019, 0x201c, 0x201d, 0x3014, 0x3015, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, 0x300d, 0x300e, 0x300f, 0x3016, 0x3017, 0x3010, 0x3011, 0x00b1, 0x00d7, 0x00f7, 0x2236, 0x2227, 0x2228, 0x2211, 0x220f, 0x222a, 0x2229, 0x2208, 0x2237, 0x221a, 0x22a5, 0x2225, 0x2220, 0x2312, 0x2299, 0x222b, 0x222e, 0x2261, 0x224c, 0x2248, 0x223d, 0x221d, 0x2260, 0x226e, 0x226f, 0x2264, 0x2265, 0x221e, 0x2235, 0x2234, 0x2642, 0x2640, 0x00b0, 0x2032, 0x2033, 0x2103, 0xff04, 0x00a4, 0xffe0, 0xffe1, 0x2030, 0x00a7, 0x2116, 0x2606, 0x2605, 0x25cb, 0x25cf, 0x25ce, 0x25c7, 0x25c6, 0x25a1, 0x25a0, 0x25b3, 0x25b2, 0x203b, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, /* 0x22 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2488, 0x2489, 0x248a, 0x248b, 0x248c, 0x248d, 0x248e, 0x248f, 0x2490, 0x2491, 0x2492, 0x2493, 0x2494, 0x2495, 0x2496, 0x2497, 0x2498, 0x2499, 0x249a, 0x249b, 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, 0x247b, 0x247c, 0x247d, 0x247e, 0x247f, 0x2480, 0x2481, 0x2482, 0x2483, 0x2484, 0x2485, 0x2486, 0x2487, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0xfffd, 0xfffd, 0x3220, 0x3221, 0x3222, 0x3223, 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, 0xfffd, 0xfffd, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0x216a, 0x216b, 0xfffd, 0xfffd, /* 0x23 */ 0xff01, 0xff02, 0xff03, 0xffe5, 0xff05, 0xff06, 0xff07, 0xff08, 0xff09, 0xff0a, 0xff0b, 0xff0c, 0xff0d, 0xff0e, 0xff0f, 0xff10, 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, 0xff19, 0xff1a, 0xff1b, 0xff1c, 0xff1d, 0xff1e, 0xff1f, 0xff20, 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0xff3b, 0xff3c, 0xff3d, 0xff3e, 0xff3f, 0xff40, 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58, 0xff59, 0xff5a, 0xff5b, 0xff5c, 0xff5d, 0xffe3, /* 0x24 */ 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, 0x3091, 0x3092, 0x3093, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x25 */ 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8, 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8, 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0, 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8, 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0, 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x26 */ 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x27 */ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x28 */ 0x0101, 0x00e1, 0x01ce, 0x00e0, 0x0113, 0x00e9, 0x011b, 0x00e8, 0x012b, 0x00ed, 0x01d0, 0x00ec, 0x014d, 0x00f3, 0x01d2, 0x00f2, 0x016b, 0x00fa, 0x01d4, 0x00f9, 0x01d6, 0x01d8, 0x01da, 0x01dc, 0x00fc, 0x00ea, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x3105, 0x3106, 0x3107, 0x3108, 0x3109, 0x310a, 0x310b, 0x310c, 0x310d, 0x310e, 0x310f, 0x3110, 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, 0x3117, 0x3118, 0x3119, 0x311a, 0x311b, 0x311c, 0x311d, 0x311e, 0x311f, 0x3120, 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, 0x3129, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x29 */ 0xfffd, 0xfffd, 0xfffd, 0x2500, 0x2501, 0x2502, 0x2503, 0x2504, 0x2505, 0x2506, 0x2507, 0x2508, 0x2509, 0x250a, 0x250b, 0x250c, 0x250d, 0x250e, 0x250f, 0x2510, 0x2511, 0x2512, 0x2513, 0x2514, 0x2515, 0x2516, 0x2517, 0x2518, 0x2519, 0x251a, 0x251b, 0x251c, 0x251d, 0x251e, 0x251f, 0x2520, 0x2521, 0x2522, 0x2523, 0x2524, 0x2525, 0x2526, 0x2527, 0x2528, 0x2529, 0x252a, 0x252b, 0x252c, 0x252d, 0x252e, 0x252f, 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, 0x2535, 0x2536, 0x2537, 0x2538, 0x2539, 0x253a, 0x253b, 0x253c, 0x253d, 0x253e, 0x253f, 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, }; static const unsigned short gb2312_2uni_page30[6768] = { /* 0x30 */ 0x554a, 0x963f, 0x57c3, 0x6328, 0x54ce, 0x5509, 0x54c0, 0x7691, 0x764c, 0x853c, 0x77ee, 0x827e, 0x788d, 0x7231, 0x9698, 0x978d, 0x6c28, 0x5b89, 0x4ffa, 0x6309, 0x6697, 0x5cb8, 0x80fa, 0x6848, 0x80ae, 0x6602, 0x76ce, 0x51f9, 0x6556, 0x71ac, 0x7ff1, 0x8884, 0x50b2, 0x5965, 0x61ca, 0x6fb3, 0x82ad, 0x634c, 0x6252, 0x53ed, 0x5427, 0x7b06, 0x516b, 0x75a4, 0x5df4, 0x62d4, 0x8dcb, 0x9776, 0x628a, 0x8019, 0x575d, 0x9738, 0x7f62, 0x7238, 0x767d, 0x67cf, 0x767e, 0x6446, 0x4f70, 0x8d25, 0x62dc, 0x7a17, 0x6591, 0x73ed, 0x642c, 0x6273, 0x822c, 0x9881, 0x677f, 0x7248, 0x626e, 0x62cc, 0x4f34, 0x74e3, 0x534a, 0x529e, 0x7eca, 0x90a6, 0x5e2e, 0x6886, 0x699c, 0x8180, 0x7ed1, 0x68d2, 0x78c5, 0x868c, 0x9551, 0x508d, 0x8c24, 0x82de, 0x80de, 0x5305, 0x8912, 0x5265, /* 0x31 */ 0x8584, 0x96f9, 0x4fdd, 0x5821, 0x9971, 0x5b9d, 0x62b1, 0x62a5, 0x66b4, 0x8c79, 0x9c8d, 0x7206, 0x676f, 0x7891, 0x60b2, 0x5351, 0x5317, 0x8f88, 0x80cc, 0x8d1d, 0x94a1, 0x500d, 0x72c8, 0x5907, 0x60eb, 0x7119, 0x88ab, 0x5954, 0x82ef, 0x672c, 0x7b28, 0x5d29, 0x7ef7, 0x752d, 0x6cf5, 0x8e66, 0x8ff8, 0x903c, 0x9f3b, 0x6bd4, 0x9119, 0x7b14, 0x5f7c, 0x78a7, 0x84d6, 0x853d, 0x6bd5, 0x6bd9, 0x6bd6, 0x5e01, 0x5e87, 0x75f9, 0x95ed, 0x655d, 0x5f0a, 0x5fc5, 0x8f9f, 0x58c1, 0x81c2, 0x907f, 0x965b, 0x97ad, 0x8fb9, 0x7f16, 0x8d2c, 0x6241, 0x4fbf, 0x53d8, 0x535e, 0x8fa8, 0x8fa9, 0x8fab, 0x904d, 0x6807, 0x5f6a, 0x8198, 0x8868, 0x9cd6, 0x618b, 0x522b, 0x762a, 0x5f6c, 0x658c, 0x6fd2, 0x6ee8, 0x5bbe, 0x6448, 0x5175, 0x51b0, 0x67c4, 0x4e19, 0x79c9, 0x997c, 0x70b3, /* 0x32 */ 0x75c5, 0x5e76, 0x73bb, 0x83e0, 0x64ad, 0x62e8, 0x94b5, 0x6ce2, 0x535a, 0x52c3, 0x640f, 0x94c2, 0x7b94, 0x4f2f, 0x5e1b, 0x8236, 0x8116, 0x818a, 0x6e24, 0x6cca, 0x9a73, 0x6355, 0x535c, 0x54fa, 0x8865, 0x57e0, 0x4e0d, 0x5e03, 0x6b65, 0x7c3f, 0x90e8, 0x6016, 0x64e6, 0x731c, 0x88c1, 0x6750, 0x624d, 0x8d22, 0x776c, 0x8e29, 0x91c7, 0x5f69, 0x83dc, 0x8521, 0x9910, 0x53c2, 0x8695, 0x6b8b, 0x60ed, 0x60e8, 0x707f, 0x82cd, 0x8231, 0x4ed3, 0x6ca7, 0x85cf, 0x64cd, 0x7cd9, 0x69fd, 0x66f9, 0x8349, 0x5395, 0x7b56, 0x4fa7, 0x518c, 0x6d4b, 0x5c42, 0x8e6d, 0x63d2, 0x53c9, 0x832c, 0x8336, 0x67e5, 0x78b4, 0x643d, 0x5bdf, 0x5c94, 0x5dee, 0x8be7, 0x62c6, 0x67f4, 0x8c7a, 0x6400, 0x63ba, 0x8749, 0x998b, 0x8c17, 0x7f20, 0x94f2, 0x4ea7, 0x9610, 0x98a4, 0x660c, 0x7316, /* 0x33 */ 0x573a, 0x5c1d, 0x5e38, 0x957f, 0x507f, 0x80a0, 0x5382, 0x655e, 0x7545, 0x5531, 0x5021, 0x8d85, 0x6284, 0x949e, 0x671d, 0x5632, 0x6f6e, 0x5de2, 0x5435, 0x7092, 0x8f66, 0x626f, 0x64a4, 0x63a3, 0x5f7b, 0x6f88, 0x90f4, 0x81e3, 0x8fb0, 0x5c18, 0x6668, 0x5ff1, 0x6c89, 0x9648, 0x8d81, 0x886c, 0x6491, 0x79f0, 0x57ce, 0x6a59, 0x6210, 0x5448, 0x4e58, 0x7a0b, 0x60e9, 0x6f84, 0x8bda, 0x627f, 0x901e, 0x9a8b, 0x79e4, 0x5403, 0x75f4, 0x6301, 0x5319, 0x6c60, 0x8fdf, 0x5f1b, 0x9a70, 0x803b, 0x9f7f, 0x4f88, 0x5c3a, 0x8d64, 0x7fc5, 0x65a5, 0x70bd, 0x5145, 0x51b2, 0x866b, 0x5d07, 0x5ba0, 0x62bd, 0x916c, 0x7574, 0x8e0c, 0x7a20, 0x6101, 0x7b79, 0x4ec7, 0x7ef8, 0x7785, 0x4e11, 0x81ed, 0x521d, 0x51fa, 0x6a71, 0x53a8, 0x8e87, 0x9504, 0x96cf, 0x6ec1, 0x9664, 0x695a, /* 0x34 */ 0x7840, 0x50a8, 0x77d7, 0x6410, 0x89e6, 0x5904, 0x63e3, 0x5ddd, 0x7a7f, 0x693d, 0x4f20, 0x8239, 0x5598, 0x4e32, 0x75ae, 0x7a97, 0x5e62, 0x5e8a, 0x95ef, 0x521b, 0x5439, 0x708a, 0x6376, 0x9524, 0x5782, 0x6625, 0x693f, 0x9187, 0x5507, 0x6df3, 0x7eaf, 0x8822, 0x6233, 0x7ef0, 0x75b5, 0x8328, 0x78c1, 0x96cc, 0x8f9e, 0x6148, 0x74f7, 0x8bcd, 0x6b64, 0x523a, 0x8d50, 0x6b21, 0x806a, 0x8471, 0x56f1, 0x5306, 0x4ece, 0x4e1b, 0x51d1, 0x7c97, 0x918b, 0x7c07, 0x4fc3, 0x8e7f, 0x7be1, 0x7a9c, 0x6467, 0x5d14, 0x50ac, 0x8106, 0x7601, 0x7cb9, 0x6dec, 0x7fe0, 0x6751, 0x5b58, 0x5bf8, 0x78cb, 0x64ae, 0x6413, 0x63aa, 0x632b, 0x9519, 0x642d, 0x8fbe, 0x7b54, 0x7629, 0x6253, 0x5927, 0x5446, 0x6b79, 0x50a3, 0x6234, 0x5e26, 0x6b86, 0x4ee3, 0x8d37, 0x888b, 0x5f85, 0x902e, /* 0x35 */ 0x6020, 0x803d, 0x62c5, 0x4e39, 0x5355, 0x90f8, 0x63b8, 0x80c6, 0x65e6, 0x6c2e, 0x4f46, 0x60ee, 0x6de1, 0x8bde, 0x5f39, 0x86cb, 0x5f53, 0x6321, 0x515a, 0x8361, 0x6863, 0x5200, 0x6363, 0x8e48, 0x5012, 0x5c9b, 0x7977, 0x5bfc, 0x5230, 0x7a3b, 0x60bc, 0x9053, 0x76d7, 0x5fb7, 0x5f97, 0x7684, 0x8e6c, 0x706f, 0x767b, 0x7b49, 0x77aa, 0x51f3, 0x9093, 0x5824, 0x4f4e, 0x6ef4, 0x8fea, 0x654c, 0x7b1b, 0x72c4, 0x6da4, 0x7fdf, 0x5ae1, 0x62b5, 0x5e95, 0x5730, 0x8482, 0x7b2c, 0x5e1d, 0x5f1f, 0x9012, 0x7f14, 0x98a0, 0x6382, 0x6ec7, 0x7898, 0x70b9, 0x5178, 0x975b, 0x57ab, 0x7535, 0x4f43, 0x7538, 0x5e97, 0x60e6, 0x5960, 0x6dc0, 0x6bbf, 0x7889, 0x53fc, 0x96d5, 0x51cb, 0x5201, 0x6389, 0x540a, 0x9493, 0x8c03, 0x8dcc, 0x7239, 0x789f, 0x8776, 0x8fed, 0x8c0d, 0x53e0, /* 0x36 */ 0x4e01, 0x76ef, 0x53ee, 0x9489, 0x9876, 0x9f0e, 0x952d, 0x5b9a, 0x8ba2, 0x4e22, 0x4e1c, 0x51ac, 0x8463, 0x61c2, 0x52a8, 0x680b, 0x4f97, 0x606b, 0x51bb, 0x6d1e, 0x515c, 0x6296, 0x6597, 0x9661, 0x8c46, 0x9017, 0x75d8, 0x90fd, 0x7763, 0x6bd2, 0x728a, 0x72ec, 0x8bfb, 0x5835, 0x7779, 0x8d4c, 0x675c, 0x9540, 0x809a, 0x5ea6, 0x6e21, 0x5992, 0x7aef, 0x77ed, 0x953b, 0x6bb5, 0x65ad, 0x7f0e, 0x5806, 0x5151, 0x961f, 0x5bf9, 0x58a9, 0x5428, 0x8e72, 0x6566, 0x987f, 0x56e4, 0x949d, 0x76fe, 0x9041, 0x6387, 0x54c6, 0x591a, 0x593a, 0x579b, 0x8eb2, 0x6735, 0x8dfa, 0x8235, 0x5241, 0x60f0, 0x5815, 0x86fe, 0x5ce8, 0x9e45, 0x4fc4, 0x989d, 0x8bb9, 0x5a25, 0x6076, 0x5384, 0x627c, 0x904f, 0x9102, 0x997f, 0x6069, 0x800c, 0x513f, 0x8033, 0x5c14, 0x9975, 0x6d31, 0x4e8c, /* 0x37 */ 0x8d30, 0x53d1, 0x7f5a, 0x7b4f, 0x4f10, 0x4e4f, 0x9600, 0x6cd5, 0x73d0, 0x85e9, 0x5e06, 0x756a, 0x7ffb, 0x6a0a, 0x77fe, 0x9492, 0x7e41, 0x51e1, 0x70e6, 0x53cd, 0x8fd4, 0x8303, 0x8d29, 0x72af, 0x996d, 0x6cdb, 0x574a, 0x82b3, 0x65b9, 0x80aa, 0x623f, 0x9632, 0x59a8, 0x4eff, 0x8bbf, 0x7eba, 0x653e, 0x83f2, 0x975e, 0x5561, 0x98de, 0x80a5, 0x532a, 0x8bfd, 0x5420, 0x80ba, 0x5e9f, 0x6cb8, 0x8d39, 0x82ac, 0x915a, 0x5429, 0x6c1b, 0x5206, 0x7eb7, 0x575f, 0x711a, 0x6c7e, 0x7c89, 0x594b, 0x4efd, 0x5fff, 0x6124, 0x7caa, 0x4e30, 0x5c01, 0x67ab, 0x8702, 0x5cf0, 0x950b, 0x98ce, 0x75af, 0x70fd, 0x9022, 0x51af, 0x7f1d, 0x8bbd, 0x5949, 0x51e4, 0x4f5b, 0x5426, 0x592b, 0x6577, 0x80a4, 0x5b75, 0x6276, 0x62c2, 0x8f90, 0x5e45, 0x6c1f, 0x7b26, 0x4f0f, 0x4fd8, 0x670d, /* 0x38 */ 0x6d6e, 0x6daa, 0x798f, 0x88b1, 0x5f17, 0x752b, 0x629a, 0x8f85, 0x4fef, 0x91dc, 0x65a7, 0x812f, 0x8151, 0x5e9c, 0x8150, 0x8d74, 0x526f, 0x8986, 0x8d4b, 0x590d, 0x5085, 0x4ed8, 0x961c, 0x7236, 0x8179, 0x8d1f, 0x5bcc, 0x8ba3, 0x9644, 0x5987, 0x7f1a, 0x5490, 0x5676, 0x560e, 0x8be5, 0x6539, 0x6982, 0x9499, 0x76d6, 0x6e89, 0x5e72, 0x7518, 0x6746, 0x67d1, 0x7aff, 0x809d, 0x8d76, 0x611f, 0x79c6, 0x6562, 0x8d63, 0x5188, 0x521a, 0x94a2, 0x7f38, 0x809b, 0x7eb2, 0x5c97, 0x6e2f, 0x6760, 0x7bd9, 0x768b, 0x9ad8, 0x818f, 0x7f94, 0x7cd5, 0x641e, 0x9550, 0x7a3f, 0x544a, 0x54e5, 0x6b4c, 0x6401, 0x6208, 0x9e3d, 0x80f3, 0x7599, 0x5272, 0x9769, 0x845b, 0x683c, 0x86e4, 0x9601, 0x9694, 0x94ec, 0x4e2a, 0x5404, 0x7ed9, 0x6839, 0x8ddf, 0x8015, 0x66f4, 0x5e9a, 0x7fb9, /* 0x39 */ 0x57c2, 0x803f, 0x6897, 0x5de5, 0x653b, 0x529f, 0x606d, 0x9f9a, 0x4f9b, 0x8eac, 0x516c, 0x5bab, 0x5f13, 0x5de9, 0x6c5e, 0x62f1, 0x8d21, 0x5171, 0x94a9, 0x52fe, 0x6c9f, 0x82df, 0x72d7, 0x57a2, 0x6784, 0x8d2d, 0x591f, 0x8f9c, 0x83c7, 0x5495, 0x7b8d, 0x4f30, 0x6cbd, 0x5b64, 0x59d1, 0x9f13, 0x53e4, 0x86ca, 0x9aa8, 0x8c37, 0x80a1, 0x6545, 0x987e, 0x56fa, 0x96c7, 0x522e, 0x74dc, 0x5250, 0x5be1, 0x6302, 0x8902, 0x4e56, 0x62d0, 0x602a, 0x68fa, 0x5173, 0x5b98, 0x51a0, 0x89c2, 0x7ba1, 0x9986, 0x7f50, 0x60ef, 0x704c, 0x8d2f, 0x5149, 0x5e7f, 0x901b, 0x7470, 0x89c4, 0x572d, 0x7845, 0x5f52, 0x9f9f, 0x95fa, 0x8f68, 0x9b3c, 0x8be1, 0x7678, 0x6842, 0x67dc, 0x8dea, 0x8d35, 0x523d, 0x8f8a, 0x6eda, 0x68cd, 0x9505, 0x90ed, 0x56fd, 0x679c, 0x88f9, 0x8fc7, 0x54c8, /* 0x3a */ 0x9ab8, 0x5b69, 0x6d77, 0x6c26, 0x4ea5, 0x5bb3, 0x9a87, 0x9163, 0x61a8, 0x90af, 0x97e9, 0x542b, 0x6db5, 0x5bd2, 0x51fd, 0x558a, 0x7f55, 0x7ff0, 0x64bc, 0x634d, 0x65f1, 0x61be, 0x608d, 0x710a, 0x6c57, 0x6c49, 0x592f, 0x676d, 0x822a, 0x58d5, 0x568e, 0x8c6a, 0x6beb, 0x90dd, 0x597d, 0x8017, 0x53f7, 0x6d69, 0x5475, 0x559d, 0x8377, 0x83cf, 0x6838, 0x79be, 0x548c, 0x4f55, 0x5408, 0x76d2, 0x8c89, 0x9602, 0x6cb3, 0x6db8, 0x8d6b, 0x8910, 0x9e64, 0x8d3a, 0x563f, 0x9ed1, 0x75d5, 0x5f88, 0x72e0, 0x6068, 0x54fc, 0x4ea8, 0x6a2a, 0x8861, 0x6052, 0x8f70, 0x54c4, 0x70d8, 0x8679, 0x9e3f, 0x6d2a, 0x5b8f, 0x5f18, 0x7ea2, 0x5589, 0x4faf, 0x7334, 0x543c, 0x539a, 0x5019, 0x540e, 0x547c, 0x4e4e, 0x5ffd, 0x745a, 0x58f6, 0x846b, 0x80e1, 0x8774, 0x72d0, 0x7cca, 0x6e56, /* 0x3b */ 0x5f27, 0x864e, 0x552c, 0x62a4, 0x4e92, 0x6caa, 0x6237, 0x82b1, 0x54d7, 0x534e, 0x733e, 0x6ed1, 0x753b, 0x5212, 0x5316, 0x8bdd, 0x69d0, 0x5f8a, 0x6000, 0x6dee, 0x574f, 0x6b22, 0x73af, 0x6853, 0x8fd8, 0x7f13, 0x6362, 0x60a3, 0x5524, 0x75ea, 0x8c62, 0x7115, 0x6da3, 0x5ba6, 0x5e7b, 0x8352, 0x614c, 0x9ec4, 0x78fa, 0x8757, 0x7c27, 0x7687, 0x51f0, 0x60f6, 0x714c, 0x6643, 0x5e4c, 0x604d, 0x8c0e, 0x7070, 0x6325, 0x8f89, 0x5fbd, 0x6062, 0x86d4, 0x56de, 0x6bc1, 0x6094, 0x6167, 0x5349, 0x60e0, 0x6666, 0x8d3f, 0x79fd, 0x4f1a, 0x70e9, 0x6c47, 0x8bb3, 0x8bf2, 0x7ed8, 0x8364, 0x660f, 0x5a5a, 0x9b42, 0x6d51, 0x6df7, 0x8c41, 0x6d3b, 0x4f19, 0x706b, 0x83b7, 0x6216, 0x60d1, 0x970d, 0x8d27, 0x7978, 0x51fb, 0x573e, 0x57fa, 0x673a, 0x7578, 0x7a3d, 0x79ef, 0x7b95, /* 0x3c */ 0x808c, 0x9965, 0x8ff9, 0x6fc0, 0x8ba5, 0x9e21, 0x59ec, 0x7ee9, 0x7f09, 0x5409, 0x6781, 0x68d8, 0x8f91, 0x7c4d, 0x96c6, 0x53ca, 0x6025, 0x75be, 0x6c72, 0x5373, 0x5ac9, 0x7ea7, 0x6324, 0x51e0, 0x810a, 0x5df1, 0x84df, 0x6280, 0x5180, 0x5b63, 0x4f0e, 0x796d, 0x5242, 0x60b8, 0x6d4e, 0x5bc4, 0x5bc2, 0x8ba1, 0x8bb0, 0x65e2, 0x5fcc, 0x9645, 0x5993, 0x7ee7, 0x7eaa, 0x5609, 0x67b7, 0x5939, 0x4f73, 0x5bb6, 0x52a0, 0x835a, 0x988a, 0x8d3e, 0x7532, 0x94be, 0x5047, 0x7a3c, 0x4ef7, 0x67b6, 0x9a7e, 0x5ac1, 0x6b7c, 0x76d1, 0x575a, 0x5c16, 0x7b3a, 0x95f4, 0x714e, 0x517c, 0x80a9, 0x8270, 0x5978, 0x7f04, 0x8327, 0x68c0, 0x67ec, 0x78b1, 0x7877, 0x62e3, 0x6361, 0x7b80, 0x4fed, 0x526a, 0x51cf, 0x8350, 0x69db, 0x9274, 0x8df5, 0x8d31, 0x89c1, 0x952e, 0x7bad, 0x4ef6, /* 0x3d */ 0x5065, 0x8230, 0x5251, 0x996f, 0x6e10, 0x6e85, 0x6da7, 0x5efa, 0x50f5, 0x59dc, 0x5c06, 0x6d46, 0x6c5f, 0x7586, 0x848b, 0x6868, 0x5956, 0x8bb2, 0x5320, 0x9171, 0x964d, 0x8549, 0x6912, 0x7901, 0x7126, 0x80f6, 0x4ea4, 0x90ca, 0x6d47, 0x9a84, 0x5a07, 0x56bc, 0x6405, 0x94f0, 0x77eb, 0x4fa5, 0x811a, 0x72e1, 0x89d2, 0x997a, 0x7f34, 0x7ede, 0x527f, 0x6559, 0x9175, 0x8f7f, 0x8f83, 0x53eb, 0x7a96, 0x63ed, 0x63a5, 0x7686, 0x79f8, 0x8857, 0x9636, 0x622a, 0x52ab, 0x8282, 0x6854, 0x6770, 0x6377, 0x776b, 0x7aed, 0x6d01, 0x7ed3, 0x89e3, 0x59d0, 0x6212, 0x85c9, 0x82a5, 0x754c, 0x501f, 0x4ecb, 0x75a5, 0x8beb, 0x5c4a, 0x5dfe, 0x7b4b, 0x65a4, 0x91d1, 0x4eca, 0x6d25, 0x895f, 0x7d27, 0x9526, 0x4ec5, 0x8c28, 0x8fdb, 0x9773, 0x664b, 0x7981, 0x8fd1, 0x70ec, 0x6d78, /* 0x3e */ 0x5c3d, 0x52b2, 0x8346, 0x5162, 0x830e, 0x775b, 0x6676, 0x9cb8, 0x4eac, 0x60ca, 0x7cbe, 0x7cb3, 0x7ecf, 0x4e95, 0x8b66, 0x666f, 0x9888, 0x9759, 0x5883, 0x656c, 0x955c, 0x5f84, 0x75c9, 0x9756, 0x7adf, 0x7ade, 0x51c0, 0x70af, 0x7a98, 0x63ea, 0x7a76, 0x7ea0, 0x7396, 0x97ed, 0x4e45, 0x7078, 0x4e5d, 0x9152, 0x53a9, 0x6551, 0x65e7, 0x81fc, 0x8205, 0x548e, 0x5c31, 0x759a, 0x97a0, 0x62d8, 0x72d9, 0x75bd, 0x5c45, 0x9a79, 0x83ca, 0x5c40, 0x5480, 0x77e9, 0x4e3e, 0x6cae, 0x805a, 0x62d2, 0x636e, 0x5de8, 0x5177, 0x8ddd, 0x8e1e, 0x952f, 0x4ff1, 0x53e5, 0x60e7, 0x70ac, 0x5267, 0x6350, 0x9e43, 0x5a1f, 0x5026, 0x7737, 0x5377, 0x7ee2, 0x6485, 0x652b, 0x6289, 0x6398, 0x5014, 0x7235, 0x89c9, 0x51b3, 0x8bc0, 0x7edd, 0x5747, 0x83cc, 0x94a7, 0x519b, 0x541b, 0x5cfb, /* 0x3f */ 0x4fca, 0x7ae3, 0x6d5a, 0x90e1, 0x9a8f, 0x5580, 0x5496, 0x5361, 0x54af, 0x5f00, 0x63e9, 0x6977, 0x51ef, 0x6168, 0x520a, 0x582a, 0x52d8, 0x574e, 0x780d, 0x770b, 0x5eb7, 0x6177, 0x7ce0, 0x625b, 0x6297, 0x4ea2, 0x7095, 0x8003, 0x62f7, 0x70e4, 0x9760, 0x5777, 0x82db, 0x67ef, 0x68f5, 0x78d5, 0x9897, 0x79d1, 0x58f3, 0x54b3, 0x53ef, 0x6e34, 0x514b, 0x523b, 0x5ba2, 0x8bfe, 0x80af, 0x5543, 0x57a6, 0x6073, 0x5751, 0x542d, 0x7a7a, 0x6050, 0x5b54, 0x63a7, 0x62a0, 0x53e3, 0x6263, 0x5bc7, 0x67af, 0x54ed, 0x7a9f, 0x82e6, 0x9177, 0x5e93, 0x88e4, 0x5938, 0x57ae, 0x630e, 0x8de8, 0x80ef, 0x5757, 0x7b77, 0x4fa9, 0x5feb, 0x5bbd, 0x6b3e, 0x5321, 0x7b50, 0x72c2, 0x6846, 0x77ff, 0x7736, 0x65f7, 0x51b5, 0x4e8f, 0x76d4, 0x5cbf, 0x7aa5, 0x8475, 0x594e, 0x9b41, 0x5080, /* 0x40 */ 0x9988, 0x6127, 0x6e83, 0x5764, 0x6606, 0x6346, 0x56f0, 0x62ec, 0x6269, 0x5ed3, 0x9614, 0x5783, 0x62c9, 0x5587, 0x8721, 0x814a, 0x8fa3, 0x5566, 0x83b1, 0x6765, 0x8d56, 0x84dd, 0x5a6a, 0x680f, 0x62e6, 0x7bee, 0x9611, 0x5170, 0x6f9c, 0x8c30, 0x63fd, 0x89c8, 0x61d2, 0x7f06, 0x70c2, 0x6ee5, 0x7405, 0x6994, 0x72fc, 0x5eca, 0x90ce, 0x6717, 0x6d6a, 0x635e, 0x52b3, 0x7262, 0x8001, 0x4f6c, 0x59e5, 0x916a, 0x70d9, 0x6d9d, 0x52d2, 0x4e50, 0x96f7, 0x956d, 0x857e, 0x78ca, 0x7d2f, 0x5121, 0x5792, 0x64c2, 0x808b, 0x7c7b, 0x6cea, 0x68f1, 0x695e, 0x51b7, 0x5398, 0x68a8, 0x7281, 0x9ece, 0x7bf1, 0x72f8, 0x79bb, 0x6f13, 0x7406, 0x674e, 0x91cc, 0x9ca4, 0x793c, 0x8389, 0x8354, 0x540f, 0x6817, 0x4e3d, 0x5389, 0x52b1, 0x783e, 0x5386, 0x5229, 0x5088, 0x4f8b, 0x4fd0, /* 0x41 */ 0x75e2, 0x7acb, 0x7c92, 0x6ca5, 0x96b6, 0x529b, 0x7483, 0x54e9, 0x4fe9, 0x8054, 0x83b2, 0x8fde, 0x9570, 0x5ec9, 0x601c, 0x6d9f, 0x5e18, 0x655b, 0x8138, 0x94fe, 0x604b, 0x70bc, 0x7ec3, 0x7cae, 0x51c9, 0x6881, 0x7cb1, 0x826f, 0x4e24, 0x8f86, 0x91cf, 0x667e, 0x4eae, 0x8c05, 0x64a9, 0x804a, 0x50da, 0x7597, 0x71ce, 0x5be5, 0x8fbd, 0x6f66, 0x4e86, 0x6482, 0x9563, 0x5ed6, 0x6599, 0x5217, 0x88c2, 0x70c8, 0x52a3, 0x730e, 0x7433, 0x6797, 0x78f7, 0x9716, 0x4e34, 0x90bb, 0x9cde, 0x6dcb, 0x51db, 0x8d41, 0x541d, 0x62ce, 0x73b2, 0x83f1, 0x96f6, 0x9f84, 0x94c3, 0x4f36, 0x7f9a, 0x51cc, 0x7075, 0x9675, 0x5cad, 0x9886, 0x53e6, 0x4ee4, 0x6e9c, 0x7409, 0x69b4, 0x786b, 0x998f, 0x7559, 0x5218, 0x7624, 0x6d41, 0x67f3, 0x516d, 0x9f99, 0x804b, 0x5499, 0x7b3c, 0x7abf, /* 0x42 */ 0x9686, 0x5784, 0x62e2, 0x9647, 0x697c, 0x5a04, 0x6402, 0x7bd3, 0x6f0f, 0x964b, 0x82a6, 0x5362, 0x9885, 0x5e90, 0x7089, 0x63b3, 0x5364, 0x864f, 0x9c81, 0x9e93, 0x788c, 0x9732, 0x8def, 0x8d42, 0x9e7f, 0x6f5e, 0x7984, 0x5f55, 0x9646, 0x622e, 0x9a74, 0x5415, 0x94dd, 0x4fa3, 0x65c5, 0x5c65, 0x5c61, 0x7f15, 0x8651, 0x6c2f, 0x5f8b, 0x7387, 0x6ee4, 0x7eff, 0x5ce6, 0x631b, 0x5b6a, 0x6ee6, 0x5375, 0x4e71, 0x63a0, 0x7565, 0x62a1, 0x8f6e, 0x4f26, 0x4ed1, 0x6ca6, 0x7eb6, 0x8bba, 0x841d, 0x87ba, 0x7f57, 0x903b, 0x9523, 0x7ba9, 0x9aa1, 0x88f8, 0x843d, 0x6d1b, 0x9a86, 0x7edc, 0x5988, 0x9ebb, 0x739b, 0x7801, 0x8682, 0x9a6c, 0x9a82, 0x561b, 0x5417, 0x57cb, 0x4e70, 0x9ea6, 0x5356, 0x8fc8, 0x8109, 0x7792, 0x9992, 0x86ee, 0x6ee1, 0x8513, 0x66fc, 0x6162, 0x6f2b, /* 0x43 */ 0x8c29, 0x8292, 0x832b, 0x76f2, 0x6c13, 0x5fd9, 0x83bd, 0x732b, 0x8305, 0x951a, 0x6bdb, 0x77db, 0x94c6, 0x536f, 0x8302, 0x5192, 0x5e3d, 0x8c8c, 0x8d38, 0x4e48, 0x73ab, 0x679a, 0x6885, 0x9176, 0x9709, 0x7164, 0x6ca1, 0x7709, 0x5a92, 0x9541, 0x6bcf, 0x7f8e, 0x6627, 0x5bd0, 0x59b9, 0x5a9a, 0x95e8, 0x95f7, 0x4eec, 0x840c, 0x8499, 0x6aac, 0x76df, 0x9530, 0x731b, 0x68a6, 0x5b5f, 0x772f, 0x919a, 0x9761, 0x7cdc, 0x8ff7, 0x8c1c, 0x5f25, 0x7c73, 0x79d8, 0x89c5, 0x6ccc, 0x871c, 0x5bc6, 0x5e42, 0x68c9, 0x7720, 0x7ef5, 0x5195, 0x514d, 0x52c9, 0x5a29, 0x7f05, 0x9762, 0x82d7, 0x63cf, 0x7784, 0x85d0, 0x79d2, 0x6e3a, 0x5e99, 0x5999, 0x8511, 0x706d, 0x6c11, 0x62bf, 0x76bf, 0x654f, 0x60af, 0x95fd, 0x660e, 0x879f, 0x9e23, 0x94ed, 0x540d, 0x547d, 0x8c2c, 0x6478, /* 0x44 */ 0x6479, 0x8611, 0x6a21, 0x819c, 0x78e8, 0x6469, 0x9b54, 0x62b9, 0x672b, 0x83ab, 0x58a8, 0x9ed8, 0x6cab, 0x6f20, 0x5bde, 0x964c, 0x8c0b, 0x725f, 0x67d0, 0x62c7, 0x7261, 0x4ea9, 0x59c6, 0x6bcd, 0x5893, 0x66ae, 0x5e55, 0x52df, 0x6155, 0x6728, 0x76ee, 0x7766, 0x7267, 0x7a46, 0x62ff, 0x54ea, 0x5450, 0x94a0, 0x90a3, 0x5a1c, 0x7eb3, 0x6c16, 0x4e43, 0x5976, 0x8010, 0x5948, 0x5357, 0x7537, 0x96be, 0x56ca, 0x6320, 0x8111, 0x607c, 0x95f9, 0x6dd6, 0x5462, 0x9981, 0x5185, 0x5ae9, 0x80fd, 0x59ae, 0x9713, 0x502a, 0x6ce5, 0x5c3c, 0x62df, 0x4f60, 0x533f, 0x817b, 0x9006, 0x6eba, 0x852b, 0x62c8, 0x5e74, 0x78be, 0x64b5, 0x637b, 0x5ff5, 0x5a18, 0x917f, 0x9e1f, 0x5c3f, 0x634f, 0x8042, 0x5b7d, 0x556e, 0x954a, 0x954d, 0x6d85, 0x60a8, 0x67e0, 0x72de, 0x51dd, 0x5b81, /* 0x45 */ 0x62e7, 0x6cde, 0x725b, 0x626d, 0x94ae, 0x7ebd, 0x8113, 0x6d53, 0x519c, 0x5f04, 0x5974, 0x52aa, 0x6012, 0x5973, 0x6696, 0x8650, 0x759f, 0x632a, 0x61e6, 0x7cef, 0x8bfa, 0x54e6, 0x6b27, 0x9e25, 0x6bb4, 0x85d5, 0x5455, 0x5076, 0x6ca4, 0x556a, 0x8db4, 0x722c, 0x5e15, 0x6015, 0x7436, 0x62cd, 0x6392, 0x724c, 0x5f98, 0x6e43, 0x6d3e, 0x6500, 0x6f58, 0x76d8, 0x78d0, 0x76fc, 0x7554, 0x5224, 0x53db, 0x4e53, 0x5e9e, 0x65c1, 0x802a, 0x80d6, 0x629b, 0x5486, 0x5228, 0x70ae, 0x888d, 0x8dd1, 0x6ce1, 0x5478, 0x80da, 0x57f9, 0x88f4, 0x8d54, 0x966a, 0x914d, 0x4f69, 0x6c9b, 0x55b7, 0x76c6, 0x7830, 0x62a8, 0x70f9, 0x6f8e, 0x5f6d, 0x84ec, 0x68da, 0x787c, 0x7bf7, 0x81a8, 0x670b, 0x9e4f, 0x6367, 0x78b0, 0x576f, 0x7812, 0x9739, 0x6279, 0x62ab, 0x5288, 0x7435, 0x6bd7, /* 0x46 */ 0x5564, 0x813e, 0x75b2, 0x76ae, 0x5339, 0x75de, 0x50fb, 0x5c41, 0x8b6c, 0x7bc7, 0x504f, 0x7247, 0x9a97, 0x98d8, 0x6f02, 0x74e2, 0x7968, 0x6487, 0x77a5, 0x62fc, 0x9891, 0x8d2b, 0x54c1, 0x8058, 0x4e52, 0x576a, 0x82f9, 0x840d, 0x5e73, 0x51ed, 0x74f6, 0x8bc4, 0x5c4f, 0x5761, 0x6cfc, 0x9887, 0x5a46, 0x7834, 0x9b44, 0x8feb, 0x7c95, 0x5256, 0x6251, 0x94fa, 0x4ec6, 0x8386, 0x8461, 0x83e9, 0x84b2, 0x57d4, 0x6734, 0x5703, 0x666e, 0x6d66, 0x8c31, 0x66dd, 0x7011, 0x671f, 0x6b3a, 0x6816, 0x621a, 0x59bb, 0x4e03, 0x51c4, 0x6f06, 0x67d2, 0x6c8f, 0x5176, 0x68cb, 0x5947, 0x6b67, 0x7566, 0x5d0e, 0x8110, 0x9f50, 0x65d7, 0x7948, 0x7941, 0x9a91, 0x8d77, 0x5c82, 0x4e5e, 0x4f01, 0x542f, 0x5951, 0x780c, 0x5668, 0x6c14, 0x8fc4, 0x5f03, 0x6c7d, 0x6ce3, 0x8bab, 0x6390, /* 0x47 */ 0x6070, 0x6d3d, 0x7275, 0x6266, 0x948e, 0x94c5, 0x5343, 0x8fc1, 0x7b7e, 0x4edf, 0x8c26, 0x4e7e, 0x9ed4, 0x94b1, 0x94b3, 0x524d, 0x6f5c, 0x9063, 0x6d45, 0x8c34, 0x5811, 0x5d4c, 0x6b20, 0x6b49, 0x67aa, 0x545b, 0x8154, 0x7f8c, 0x5899, 0x8537, 0x5f3a, 0x62a2, 0x6a47, 0x9539, 0x6572, 0x6084, 0x6865, 0x77a7, 0x4e54, 0x4fa8, 0x5de7, 0x9798, 0x64ac, 0x7fd8, 0x5ced, 0x4fcf, 0x7a8d, 0x5207, 0x8304, 0x4e14, 0x602f, 0x7a83, 0x94a6, 0x4fb5, 0x4eb2, 0x79e6, 0x7434, 0x52e4, 0x82b9, 0x64d2, 0x79bd, 0x5bdd, 0x6c81, 0x9752, 0x8f7b, 0x6c22, 0x503e, 0x537f, 0x6e05, 0x64ce, 0x6674, 0x6c30, 0x60c5, 0x9877, 0x8bf7, 0x5e86, 0x743c, 0x7a77, 0x79cb, 0x4e18, 0x90b1, 0x7403, 0x6c42, 0x56da, 0x914b, 0x6cc5, 0x8d8b, 0x533a, 0x86c6, 0x66f2, 0x8eaf, 0x5c48, 0x9a71, 0x6e20, /* 0x48 */ 0x53d6, 0x5a36, 0x9f8b, 0x8da3, 0x53bb, 0x5708, 0x98a7, 0x6743, 0x919b, 0x6cc9, 0x5168, 0x75ca, 0x62f3, 0x72ac, 0x5238, 0x529d, 0x7f3a, 0x7094, 0x7638, 0x5374, 0x9e4a, 0x69b7, 0x786e, 0x96c0, 0x88d9, 0x7fa4, 0x7136, 0x71c3, 0x5189, 0x67d3, 0x74e4, 0x58e4, 0x6518, 0x56b7, 0x8ba9, 0x9976, 0x6270, 0x7ed5, 0x60f9, 0x70ed, 0x58ec, 0x4ec1, 0x4eba, 0x5fcd, 0x97e7, 0x4efb, 0x8ba4, 0x5203, 0x598a, 0x7eab, 0x6254, 0x4ecd, 0x65e5, 0x620e, 0x8338, 0x84c9, 0x8363, 0x878d, 0x7194, 0x6eb6, 0x5bb9, 0x7ed2, 0x5197, 0x63c9, 0x67d4, 0x8089, 0x8339, 0x8815, 0x5112, 0x5b7a, 0x5982, 0x8fb1, 0x4e73, 0x6c5d, 0x5165, 0x8925, 0x8f6f, 0x962e, 0x854a, 0x745e, 0x9510, 0x95f0, 0x6da6, 0x82e5, 0x5f31, 0x6492, 0x6d12, 0x8428, 0x816e, 0x9cc3, 0x585e, 0x8d5b, 0x4e09, 0x53c1, /* 0x49 */ 0x4f1e, 0x6563, 0x6851, 0x55d3, 0x4e27, 0x6414, 0x9a9a, 0x626b, 0x5ac2, 0x745f, 0x8272, 0x6da9, 0x68ee, 0x50e7, 0x838e, 0x7802, 0x6740, 0x5239, 0x6c99, 0x7eb1, 0x50bb, 0x5565, 0x715e, 0x7b5b, 0x6652, 0x73ca, 0x82eb, 0x6749, 0x5c71, 0x5220, 0x717d, 0x886b, 0x95ea, 0x9655, 0x64c5, 0x8d61, 0x81b3, 0x5584, 0x6c55, 0x6247, 0x7f2e, 0x5892, 0x4f24, 0x5546, 0x8d4f, 0x664c, 0x4e0a, 0x5c1a, 0x88f3, 0x68a2, 0x634e, 0x7a0d, 0x70e7, 0x828d, 0x52fa, 0x97f6, 0x5c11, 0x54e8, 0x90b5, 0x7ecd, 0x5962, 0x8d4a, 0x86c7, 0x820c, 0x820d, 0x8d66, 0x6444, 0x5c04, 0x6151, 0x6d89, 0x793e, 0x8bbe, 0x7837, 0x7533, 0x547b, 0x4f38, 0x8eab, 0x6df1, 0x5a20, 0x7ec5, 0x795e, 0x6c88, 0x5ba1, 0x5a76, 0x751a, 0x80be, 0x614e, 0x6e17, 0x58f0, 0x751f, 0x7525, 0x7272, 0x5347, 0x7ef3, /* 0x4a */ 0x7701, 0x76db, 0x5269, 0x80dc, 0x5723, 0x5e08, 0x5931, 0x72ee, 0x65bd, 0x6e7f, 0x8bd7, 0x5c38, 0x8671, 0x5341, 0x77f3, 0x62fe, 0x65f6, 0x4ec0, 0x98df, 0x8680, 0x5b9e, 0x8bc6, 0x53f2, 0x77e2, 0x4f7f, 0x5c4e, 0x9a76, 0x59cb, 0x5f0f, 0x793a, 0x58eb, 0x4e16, 0x67ff, 0x4e8b, 0x62ed, 0x8a93, 0x901d, 0x52bf, 0x662f, 0x55dc, 0x566c, 0x9002, 0x4ed5, 0x4f8d, 0x91ca, 0x9970, 0x6c0f, 0x5e02, 0x6043, 0x5ba4, 0x89c6, 0x8bd5, 0x6536, 0x624b, 0x9996, 0x5b88, 0x5bff, 0x6388, 0x552e, 0x53d7, 0x7626, 0x517d, 0x852c, 0x67a2, 0x68b3, 0x6b8a, 0x6292, 0x8f93, 0x53d4, 0x8212, 0x6dd1, 0x758f, 0x4e66, 0x8d4e, 0x5b70, 0x719f, 0x85af, 0x6691, 0x66d9, 0x7f72, 0x8700, 0x9ecd, 0x9f20, 0x5c5e, 0x672f, 0x8ff0, 0x6811, 0x675f, 0x620d, 0x7ad6, 0x5885, 0x5eb6, 0x6570, 0x6f31, /* 0x4b */ 0x6055, 0x5237, 0x800d, 0x6454, 0x8870, 0x7529, 0x5e05, 0x6813, 0x62f4, 0x971c, 0x53cc, 0x723d, 0x8c01, 0x6c34, 0x7761, 0x7a0e, 0x542e, 0x77ac, 0x987a, 0x821c, 0x8bf4, 0x7855, 0x6714, 0x70c1, 0x65af, 0x6495, 0x5636, 0x601d, 0x79c1, 0x53f8, 0x4e1d, 0x6b7b, 0x8086, 0x5bfa, 0x55e3, 0x56db, 0x4f3a, 0x4f3c, 0x9972, 0x5df3, 0x677e, 0x8038, 0x6002, 0x9882, 0x9001, 0x5b8b, 0x8bbc, 0x8bf5, 0x641c, 0x8258, 0x64de, 0x55fd, 0x82cf, 0x9165, 0x4fd7, 0x7d20, 0x901f, 0x7c9f, 0x50f3, 0x5851, 0x6eaf, 0x5bbf, 0x8bc9, 0x8083, 0x9178, 0x849c, 0x7b97, 0x867d, 0x968b, 0x968f, 0x7ee5, 0x9ad3, 0x788e, 0x5c81, 0x7a57, 0x9042, 0x96a7, 0x795f, 0x5b59, 0x635f, 0x7b0b, 0x84d1, 0x68ad, 0x5506, 0x7f29, 0x7410, 0x7d22, 0x9501, 0x6240, 0x584c, 0x4ed6, 0x5b83, 0x5979, 0x5854, /* 0x4c */ 0x736d, 0x631e, 0x8e4b, 0x8e0f, 0x80ce, 0x82d4, 0x62ac, 0x53f0, 0x6cf0, 0x915e, 0x592a, 0x6001, 0x6c70, 0x574d, 0x644a, 0x8d2a, 0x762b, 0x6ee9, 0x575b, 0x6a80, 0x75f0, 0x6f6d, 0x8c2d, 0x8c08, 0x5766, 0x6bef, 0x8892, 0x78b3, 0x63a2, 0x53f9, 0x70ad, 0x6c64, 0x5858, 0x642a, 0x5802, 0x68e0, 0x819b, 0x5510, 0x7cd6, 0x5018, 0x8eba, 0x6dcc, 0x8d9f, 0x70eb, 0x638f, 0x6d9b, 0x6ed4, 0x7ee6, 0x8404, 0x6843, 0x9003, 0x6dd8, 0x9676, 0x8ba8, 0x5957, 0x7279, 0x85e4, 0x817e, 0x75bc, 0x8a8a, 0x68af, 0x5254, 0x8e22, 0x9511, 0x63d0, 0x9898, 0x8e44, 0x557c, 0x4f53, 0x66ff, 0x568f, 0x60d5, 0x6d95, 0x5243, 0x5c49, 0x5929, 0x6dfb, 0x586b, 0x7530, 0x751c, 0x606c, 0x8214, 0x8146, 0x6311, 0x6761, 0x8fe2, 0x773a, 0x8df3, 0x8d34, 0x94c1, 0x5e16, 0x5385, 0x542c, 0x70c3, /* 0x4d */ 0x6c40, 0x5ef7, 0x505c, 0x4ead, 0x5ead, 0x633a, 0x8247, 0x901a, 0x6850, 0x916e, 0x77b3, 0x540c, 0x94dc, 0x5f64, 0x7ae5, 0x6876, 0x6345, 0x7b52, 0x7edf, 0x75db, 0x5077, 0x6295, 0x5934, 0x900f, 0x51f8, 0x79c3, 0x7a81, 0x56fe, 0x5f92, 0x9014, 0x6d82, 0x5c60, 0x571f, 0x5410, 0x5154, 0x6e4d, 0x56e2, 0x63a8, 0x9893, 0x817f, 0x8715, 0x892a, 0x9000, 0x541e, 0x5c6f, 0x81c0, 0x62d6, 0x6258, 0x8131, 0x9e35, 0x9640, 0x9a6e, 0x9a7c, 0x692d, 0x59a5, 0x62d3, 0x553e, 0x6316, 0x54c7, 0x86d9, 0x6d3c, 0x5a03, 0x74e6, 0x889c, 0x6b6a, 0x5916, 0x8c4c, 0x5f2f, 0x6e7e, 0x73a9, 0x987d, 0x4e38, 0x70f7, 0x5b8c, 0x7897, 0x633d, 0x665a, 0x7696, 0x60cb, 0x5b9b, 0x5a49, 0x4e07, 0x8155, 0x6c6a, 0x738b, 0x4ea1, 0x6789, 0x7f51, 0x5f80, 0x65fa, 0x671b, 0x5fd8, 0x5984, 0x5a01, /* 0x4e */ 0x5dcd, 0x5fae, 0x5371, 0x97e6, 0x8fdd, 0x6845, 0x56f4, 0x552f, 0x60df, 0x4e3a, 0x6f4d, 0x7ef4, 0x82c7, 0x840e, 0x59d4, 0x4f1f, 0x4f2a, 0x5c3e, 0x7eac, 0x672a, 0x851a, 0x5473, 0x754f, 0x80c3, 0x5582, 0x9b4f, 0x4f4d, 0x6e2d, 0x8c13, 0x5c09, 0x6170, 0x536b, 0x761f, 0x6e29, 0x868a, 0x6587, 0x95fb, 0x7eb9, 0x543b, 0x7a33, 0x7d0a, 0x95ee, 0x55e1, 0x7fc1, 0x74ee, 0x631d, 0x8717, 0x6da1, 0x7a9d, 0x6211, 0x65a1, 0x5367, 0x63e1, 0x6c83, 0x5deb, 0x545c, 0x94a8, 0x4e4c, 0x6c61, 0x8bec, 0x5c4b, 0x65e0, 0x829c, 0x68a7, 0x543e, 0x5434, 0x6bcb, 0x6b66, 0x4e94, 0x6342, 0x5348, 0x821e, 0x4f0d, 0x4fae, 0x575e, 0x620a, 0x96fe, 0x6664, 0x7269, 0x52ff, 0x52a1, 0x609f, 0x8bef, 0x6614, 0x7199, 0x6790, 0x897f, 0x7852, 0x77fd, 0x6670, 0x563b, 0x5438, 0x9521, 0x727a, /* 0x4f */ 0x7a00, 0x606f, 0x5e0c, 0x6089, 0x819d, 0x5915, 0x60dc, 0x7184, 0x70ef, 0x6eaa, 0x6c50, 0x7280, 0x6a84, 0x88ad, 0x5e2d, 0x4e60, 0x5ab3, 0x559c, 0x94e3, 0x6d17, 0x7cfb, 0x9699, 0x620f, 0x7ec6, 0x778e, 0x867e, 0x5323, 0x971e, 0x8f96, 0x6687, 0x5ce1, 0x4fa0, 0x72ed, 0x4e0b, 0x53a6, 0x590f, 0x5413, 0x6380, 0x9528, 0x5148, 0x4ed9, 0x9c9c, 0x7ea4, 0x54b8, 0x8d24, 0x8854, 0x8237, 0x95f2, 0x6d8e, 0x5f26, 0x5acc, 0x663e, 0x9669, 0x73b0, 0x732e, 0x53bf, 0x817a, 0x9985, 0x7fa1, 0x5baa, 0x9677, 0x9650, 0x7ebf, 0x76f8, 0x53a2, 0x9576, 0x9999, 0x7bb1, 0x8944, 0x6e58, 0x4e61, 0x7fd4, 0x7965, 0x8be6, 0x60f3, 0x54cd, 0x4eab, 0x9879, 0x5df7, 0x6a61, 0x50cf, 0x5411, 0x8c61, 0x8427, 0x785d, 0x9704, 0x524a, 0x54ee, 0x56a3, 0x9500, 0x6d88, 0x5bb5, 0x6dc6, 0x6653, /* 0x50 */ 0x5c0f, 0x5b5d, 0x6821, 0x8096, 0x5578, 0x7b11, 0x6548, 0x6954, 0x4e9b, 0x6b47, 0x874e, 0x978b, 0x534f, 0x631f, 0x643a, 0x90aa, 0x659c, 0x80c1, 0x8c10, 0x5199, 0x68b0, 0x5378, 0x87f9, 0x61c8, 0x6cc4, 0x6cfb, 0x8c22, 0x5c51, 0x85aa, 0x82af, 0x950c, 0x6b23, 0x8f9b, 0x65b0, 0x5ffb, 0x5fc3, 0x4fe1, 0x8845, 0x661f, 0x8165, 0x7329, 0x60fa, 0x5174, 0x5211, 0x578b, 0x5f62, 0x90a2, 0x884c, 0x9192, 0x5e78, 0x674f, 0x6027, 0x59d3, 0x5144, 0x51f6, 0x80f8, 0x5308, 0x6c79, 0x96c4, 0x718a, 0x4f11, 0x4fee, 0x7f9e, 0x673d, 0x55c5, 0x9508, 0x79c0, 0x8896, 0x7ee3, 0x589f, 0x620c, 0x9700, 0x865a, 0x5618, 0x987b, 0x5f90, 0x8bb8, 0x84c4, 0x9157, 0x53d9, 0x65ed, 0x5e8f, 0x755c, 0x6064, 0x7d6e, 0x5a7f, 0x7eea, 0x7eed, 0x8f69, 0x55a7, 0x5ba3, 0x60ac, 0x65cb, 0x7384, /* 0x51 */ 0x9009, 0x7663, 0x7729, 0x7eda, 0x9774, 0x859b, 0x5b66, 0x7a74, 0x96ea, 0x8840, 0x52cb, 0x718f, 0x5faa, 0x65ec, 0x8be2, 0x5bfb, 0x9a6f, 0x5de1, 0x6b89, 0x6c5b, 0x8bad, 0x8baf, 0x900a, 0x8fc5, 0x538b, 0x62bc, 0x9e26, 0x9e2d, 0x5440, 0x4e2b, 0x82bd, 0x7259, 0x869c, 0x5d16, 0x8859, 0x6daf, 0x96c5, 0x54d1, 0x4e9a, 0x8bb6, 0x7109, 0x54bd, 0x9609, 0x70df, 0x6df9, 0x76d0, 0x4e25, 0x7814, 0x8712, 0x5ca9, 0x5ef6, 0x8a00, 0x989c, 0x960e, 0x708e, 0x6cbf, 0x5944, 0x63a9, 0x773c, 0x884d, 0x6f14, 0x8273, 0x5830, 0x71d5, 0x538c, 0x781a, 0x96c1, 0x5501, 0x5f66, 0x7130, 0x5bb4, 0x8c1a, 0x9a8c, 0x6b83, 0x592e, 0x9e2f, 0x79e7, 0x6768, 0x626c, 0x4f6f, 0x75a1, 0x7f8a, 0x6d0b, 0x9633, 0x6c27, 0x4ef0, 0x75d2, 0x517b, 0x6837, 0x6f3e, 0x9080, 0x8170, 0x5996, 0x7476, /* 0x52 */ 0x6447, 0x5c27, 0x9065, 0x7a91, 0x8c23, 0x59da, 0x54ac, 0x8200, 0x836f, 0x8981, 0x8000, 0x6930, 0x564e, 0x8036, 0x7237, 0x91ce, 0x51b6, 0x4e5f, 0x9875, 0x6396, 0x4e1a, 0x53f6, 0x66f3, 0x814b, 0x591c, 0x6db2, 0x4e00, 0x58f9, 0x533b, 0x63d6, 0x94f1, 0x4f9d, 0x4f0a, 0x8863, 0x9890, 0x5937, 0x9057, 0x79fb, 0x4eea, 0x80f0, 0x7591, 0x6c82, 0x5b9c, 0x59e8, 0x5f5d, 0x6905, 0x8681, 0x501a, 0x5df2, 0x4e59, 0x77e3, 0x4ee5, 0x827a, 0x6291, 0x6613, 0x9091, 0x5c79, 0x4ebf, 0x5f79, 0x81c6, 0x9038, 0x8084, 0x75ab, 0x4ea6, 0x88d4, 0x610f, 0x6bc5, 0x5fc6, 0x4e49, 0x76ca, 0x6ea2, 0x8be3, 0x8bae, 0x8c0a, 0x8bd1, 0x5f02, 0x7ffc, 0x7fcc, 0x7ece, 0x8335, 0x836b, 0x56e0, 0x6bb7, 0x97f3, 0x9634, 0x59fb, 0x541f, 0x94f6, 0x6deb, 0x5bc5, 0x996e, 0x5c39, 0x5f15, 0x9690, /* 0x53 */ 0x5370, 0x82f1, 0x6a31, 0x5a74, 0x9e70, 0x5e94, 0x7f28, 0x83b9, 0x8424, 0x8425, 0x8367, 0x8747, 0x8fce, 0x8d62, 0x76c8, 0x5f71, 0x9896, 0x786c, 0x6620, 0x54df, 0x62e5, 0x4f63, 0x81c3, 0x75c8, 0x5eb8, 0x96cd, 0x8e0a, 0x86f9, 0x548f, 0x6cf3, 0x6d8c, 0x6c38, 0x607f, 0x52c7, 0x7528, 0x5e7d, 0x4f18, 0x60a0, 0x5fe7, 0x5c24, 0x7531, 0x90ae, 0x94c0, 0x72b9, 0x6cb9, 0x6e38, 0x9149, 0x6709, 0x53cb, 0x53f3, 0x4f51, 0x91c9, 0x8bf1, 0x53c8, 0x5e7c, 0x8fc2, 0x6de4, 0x4e8e, 0x76c2, 0x6986, 0x865e, 0x611a, 0x8206, 0x4f59, 0x4fde, 0x903e, 0x9c7c, 0x6109, 0x6e1d, 0x6e14, 0x9685, 0x4e88, 0x5a31, 0x96e8, 0x4e0e, 0x5c7f, 0x79b9, 0x5b87, 0x8bed, 0x7fbd, 0x7389, 0x57df, 0x828b, 0x90c1, 0x5401, 0x9047, 0x55bb, 0x5cea, 0x5fa1, 0x6108, 0x6b32, 0x72f1, 0x80b2, 0x8a89, /* 0x54 */ 0x6d74, 0x5bd3, 0x88d5, 0x9884, 0x8c6b, 0x9a6d, 0x9e33, 0x6e0a, 0x51a4, 0x5143, 0x57a3, 0x8881, 0x539f, 0x63f4, 0x8f95, 0x56ed, 0x5458, 0x5706, 0x733f, 0x6e90, 0x7f18, 0x8fdc, 0x82d1, 0x613f, 0x6028, 0x9662, 0x66f0, 0x7ea6, 0x8d8a, 0x8dc3, 0x94a5, 0x5cb3, 0x7ca4, 0x6708, 0x60a6, 0x9605, 0x8018, 0x4e91, 0x90e7, 0x5300, 0x9668, 0x5141, 0x8fd0, 0x8574, 0x915d, 0x6655, 0x97f5, 0x5b55, 0x531d, 0x7838, 0x6742, 0x683d, 0x54c9, 0x707e, 0x5bb0, 0x8f7d, 0x518d, 0x5728, 0x54b1, 0x6512, 0x6682, 0x8d5e, 0x8d43, 0x810f, 0x846c, 0x906d, 0x7cdf, 0x51ff, 0x85fb, 0x67a3, 0x65e9, 0x6fa1, 0x86a4, 0x8e81, 0x566a, 0x9020, 0x7682, 0x7076, 0x71e5, 0x8d23, 0x62e9, 0x5219, 0x6cfd, 0x8d3c, 0x600e, 0x589e, 0x618e, 0x66fe, 0x8d60, 0x624e, 0x55b3, 0x6e23, 0x672d, 0x8f67, /* 0x55 */ 0x94e1, 0x95f8, 0x7728, 0x6805, 0x69a8, 0x548b, 0x4e4d, 0x70b8, 0x8bc8, 0x6458, 0x658b, 0x5b85, 0x7a84, 0x503a, 0x5be8, 0x77bb, 0x6be1, 0x8a79, 0x7c98, 0x6cbe, 0x76cf, 0x65a9, 0x8f97, 0x5d2d, 0x5c55, 0x8638, 0x6808, 0x5360, 0x6218, 0x7ad9, 0x6e5b, 0x7efd, 0x6a1f, 0x7ae0, 0x5f70, 0x6f33, 0x5f20, 0x638c, 0x6da8, 0x6756, 0x4e08, 0x5e10, 0x8d26, 0x4ed7, 0x80c0, 0x7634, 0x969c, 0x62db, 0x662d, 0x627e, 0x6cbc, 0x8d75, 0x7167, 0x7f69, 0x5146, 0x8087, 0x53ec, 0x906e, 0x6298, 0x54f2, 0x86f0, 0x8f99, 0x8005, 0x9517, 0x8517, 0x8fd9, 0x6d59, 0x73cd, 0x659f, 0x771f, 0x7504, 0x7827, 0x81fb, 0x8d1e, 0x9488, 0x4fa6, 0x6795, 0x75b9, 0x8bca, 0x9707, 0x632f, 0x9547, 0x9635, 0x84b8, 0x6323, 0x7741, 0x5f81, 0x72f0, 0x4e89, 0x6014, 0x6574, 0x62ef, 0x6b63, 0x653f, /* 0x56 */ 0x5e27, 0x75c7, 0x90d1, 0x8bc1, 0x829d, 0x679d, 0x652f, 0x5431, 0x8718, 0x77e5, 0x80a2, 0x8102, 0x6c41, 0x4e4b, 0x7ec7, 0x804c, 0x76f4, 0x690d, 0x6b96, 0x6267, 0x503c, 0x4f84, 0x5740, 0x6307, 0x6b62, 0x8dbe, 0x53ea, 0x65e8, 0x7eb8, 0x5fd7, 0x631a, 0x63b7, 0x81f3, 0x81f4, 0x7f6e, 0x5e1c, 0x5cd9, 0x5236, 0x667a, 0x79e9, 0x7a1a, 0x8d28, 0x7099, 0x75d4, 0x6ede, 0x6cbb, 0x7a92, 0x4e2d, 0x76c5, 0x5fe0, 0x949f, 0x8877, 0x7ec8, 0x79cd, 0x80bf, 0x91cd, 0x4ef2, 0x4f17, 0x821f, 0x5468, 0x5dde, 0x6d32, 0x8bcc, 0x7ca5, 0x8f74, 0x8098, 0x5e1a, 0x5492, 0x76b1, 0x5b99, 0x663c, 0x9aa4, 0x73e0, 0x682a, 0x86db, 0x6731, 0x732a, 0x8bf8, 0x8bdb, 0x9010, 0x7af9, 0x70db, 0x716e, 0x62c4, 0x77a9, 0x5631, 0x4e3b, 0x8457, 0x67f1, 0x52a9, 0x86c0, 0x8d2e, 0x94f8, 0x7b51, /* 0x57 */ 0x4f4f, 0x6ce8, 0x795d, 0x9a7b, 0x6293, 0x722a, 0x62fd, 0x4e13, 0x7816, 0x8f6c, 0x64b0, 0x8d5a, 0x7bc6, 0x6869, 0x5e84, 0x88c5, 0x5986, 0x649e, 0x58ee, 0x72b6, 0x690e, 0x9525, 0x8ffd, 0x8d58, 0x5760, 0x7f00, 0x8c06, 0x51c6, 0x6349, 0x62d9, 0x5353, 0x684c, 0x7422, 0x8301, 0x914c, 0x5544, 0x7740, 0x707c, 0x6d4a, 0x5179, 0x54a8, 0x8d44, 0x59ff, 0x6ecb, 0x6dc4, 0x5b5c, 0x7d2b, 0x4ed4, 0x7c7d, 0x6ed3, 0x5b50, 0x81ea, 0x6e0d, 0x5b57, 0x9b03, 0x68d5, 0x8e2a, 0x5b97, 0x7efc, 0x603b, 0x7eb5, 0x90b9, 0x8d70, 0x594f, 0x63cd, 0x79df, 0x8db3, 0x5352, 0x65cf, 0x7956, 0x8bc5, 0x963b, 0x7ec4, 0x94bb, 0x7e82, 0x5634, 0x9189, 0x6700, 0x7f6a, 0x5c0a, 0x9075, 0x6628, 0x5de6, 0x4f50, 0x67de, 0x505a, 0x4f5c, 0x5750, 0x5ea7, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x58 */ 0x4e8d, 0x4e0c, 0x5140, 0x4e10, 0x5eff, 0x5345, 0x4e15, 0x4e98, 0x4e1e, 0x9b32, 0x5b6c, 0x5669, 0x4e28, 0x79ba, 0x4e3f, 0x5315, 0x4e47, 0x592d, 0x723b, 0x536e, 0x6c10, 0x56df, 0x80e4, 0x9997, 0x6bd3, 0x777e, 0x9f17, 0x4e36, 0x4e9f, 0x9f10, 0x4e5c, 0x4e69, 0x4e93, 0x8288, 0x5b5b, 0x556c, 0x560f, 0x4ec4, 0x538d, 0x539d, 0x53a3, 0x53a5, 0x53ae, 0x9765, 0x8d5d, 0x531a, 0x53f5, 0x5326, 0x532e, 0x533e, 0x8d5c, 0x5366, 0x5363, 0x5202, 0x5208, 0x520e, 0x522d, 0x5233, 0x523f, 0x5240, 0x524c, 0x525e, 0x5261, 0x525c, 0x84af, 0x527d, 0x5282, 0x5281, 0x5290, 0x5293, 0x5182, 0x7f54, 0x4ebb, 0x4ec3, 0x4ec9, 0x4ec2, 0x4ee8, 0x4ee1, 0x4eeb, 0x4ede, 0x4f1b, 0x4ef3, 0x4f22, 0x4f64, 0x4ef5, 0x4f25, 0x4f27, 0x4f09, 0x4f2b, 0x4f5e, 0x4f67, 0x6538, 0x4f5a, 0x4f5d, /* 0x59 */ 0x4f5f, 0x4f57, 0x4f32, 0x4f3d, 0x4f76, 0x4f74, 0x4f91, 0x4f89, 0x4f83, 0x4f8f, 0x4f7e, 0x4f7b, 0x4faa, 0x4f7c, 0x4fac, 0x4f94, 0x4fe6, 0x4fe8, 0x4fea, 0x4fc5, 0x4fda, 0x4fe3, 0x4fdc, 0x4fd1, 0x4fdf, 0x4ff8, 0x5029, 0x504c, 0x4ff3, 0x502c, 0x500f, 0x502e, 0x502d, 0x4ffe, 0x501c, 0x500c, 0x5025, 0x5028, 0x507e, 0x5043, 0x5055, 0x5048, 0x504e, 0x506c, 0x507b, 0x50a5, 0x50a7, 0x50a9, 0x50ba, 0x50d6, 0x5106, 0x50ed, 0x50ec, 0x50e6, 0x50ee, 0x5107, 0x510b, 0x4edd, 0x6c3d, 0x4f58, 0x4f65, 0x4fce, 0x9fa0, 0x6c46, 0x7c74, 0x516e, 0x5dfd, 0x9ec9, 0x9998, 0x5181, 0x5914, 0x52f9, 0x530d, 0x8a07, 0x5310, 0x51eb, 0x5919, 0x5155, 0x4ea0, 0x5156, 0x4eb3, 0x886e, 0x88a4, 0x4eb5, 0x8114, 0x88d2, 0x7980, 0x5b34, 0x8803, 0x7fb8, 0x51ab, 0x51b1, 0x51bd, 0x51bc, /* 0x5a */ 0x51c7, 0x5196, 0x51a2, 0x51a5, 0x8ba0, 0x8ba6, 0x8ba7, 0x8baa, 0x8bb4, 0x8bb5, 0x8bb7, 0x8bc2, 0x8bc3, 0x8bcb, 0x8bcf, 0x8bce, 0x8bd2, 0x8bd3, 0x8bd4, 0x8bd6, 0x8bd8, 0x8bd9, 0x8bdc, 0x8bdf, 0x8be0, 0x8be4, 0x8be8, 0x8be9, 0x8bee, 0x8bf0, 0x8bf3, 0x8bf6, 0x8bf9, 0x8bfc, 0x8bff, 0x8c00, 0x8c02, 0x8c04, 0x8c07, 0x8c0c, 0x8c0f, 0x8c11, 0x8c12, 0x8c14, 0x8c15, 0x8c16, 0x8c19, 0x8c1b, 0x8c18, 0x8c1d, 0x8c1f, 0x8c20, 0x8c21, 0x8c25, 0x8c27, 0x8c2a, 0x8c2b, 0x8c2e, 0x8c2f, 0x8c32, 0x8c33, 0x8c35, 0x8c36, 0x5369, 0x537a, 0x961d, 0x9622, 0x9621, 0x9631, 0x962a, 0x963d, 0x963c, 0x9642, 0x9649, 0x9654, 0x965f, 0x9667, 0x966c, 0x9672, 0x9674, 0x9688, 0x968d, 0x9697, 0x96b0, 0x9097, 0x909b, 0x909d, 0x9099, 0x90ac, 0x90a1, 0x90b4, 0x90b3, 0x90b6, 0x90ba, /* 0x5b */ 0x90b8, 0x90b0, 0x90cf, 0x90c5, 0x90be, 0x90d0, 0x90c4, 0x90c7, 0x90d3, 0x90e6, 0x90e2, 0x90dc, 0x90d7, 0x90db, 0x90eb, 0x90ef, 0x90fe, 0x9104, 0x9122, 0x911e, 0x9123, 0x9131, 0x912f, 0x9139, 0x9143, 0x9146, 0x520d, 0x5942, 0x52a2, 0x52ac, 0x52ad, 0x52be, 0x54ff, 0x52d0, 0x52d6, 0x52f0, 0x53df, 0x71ee, 0x77cd, 0x5ef4, 0x51f5, 0x51fc, 0x9b2f, 0x53b6, 0x5f01, 0x755a, 0x5def, 0x574c, 0x57a9, 0x57a1, 0x587e, 0x58bc, 0x58c5, 0x58d1, 0x5729, 0x572c, 0x572a, 0x5733, 0x5739, 0x572e, 0x572f, 0x575c, 0x573b, 0x5742, 0x5769, 0x5785, 0x576b, 0x5786, 0x577c, 0x577b, 0x5768, 0x576d, 0x5776, 0x5773, 0x57ad, 0x57a4, 0x578c, 0x57b2, 0x57cf, 0x57a7, 0x57b4, 0x5793, 0x57a0, 0x57d5, 0x57d8, 0x57da, 0x57d9, 0x57d2, 0x57b8, 0x57f4, 0x57ef, 0x57f8, 0x57e4, 0x57dd, /* 0x5c */ 0x580b, 0x580d, 0x57fd, 0x57ed, 0x5800, 0x581e, 0x5819, 0x5844, 0x5820, 0x5865, 0x586c, 0x5881, 0x5889, 0x589a, 0x5880, 0x99a8, 0x9f19, 0x61ff, 0x8279, 0x827d, 0x827f, 0x828f, 0x828a, 0x82a8, 0x8284, 0x828e, 0x8291, 0x8297, 0x8299, 0x82ab, 0x82b8, 0x82be, 0x82b0, 0x82c8, 0x82ca, 0x82e3, 0x8298, 0x82b7, 0x82ae, 0x82cb, 0x82cc, 0x82c1, 0x82a9, 0x82b4, 0x82a1, 0x82aa, 0x829f, 0x82c4, 0x82ce, 0x82a4, 0x82e1, 0x8309, 0x82f7, 0x82e4, 0x830f, 0x8307, 0x82dc, 0x82f4, 0x82d2, 0x82d8, 0x830c, 0x82fb, 0x82d3, 0x8311, 0x831a, 0x8306, 0x8314, 0x8315, 0x82e0, 0x82d5, 0x831c, 0x8351, 0x835b, 0x835c, 0x8308, 0x8392, 0x833c, 0x8334, 0x8331, 0x839b, 0x835e, 0x832f, 0x834f, 0x8347, 0x8343, 0x835f, 0x8340, 0x8317, 0x8360, 0x832d, 0x833a, 0x8333, 0x8366, 0x8365, /* 0x5d */ 0x8368, 0x831b, 0x8369, 0x836c, 0x836a, 0x836d, 0x836e, 0x83b0, 0x8378, 0x83b3, 0x83b4, 0x83a0, 0x83aa, 0x8393, 0x839c, 0x8385, 0x837c, 0x83b6, 0x83a9, 0x837d, 0x83b8, 0x837b, 0x8398, 0x839e, 0x83a8, 0x83ba, 0x83bc, 0x83c1, 0x8401, 0x83e5, 0x83d8, 0x5807, 0x8418, 0x840b, 0x83dd, 0x83fd, 0x83d6, 0x841c, 0x8438, 0x8411, 0x8406, 0x83d4, 0x83df, 0x840f, 0x8403, 0x83f8, 0x83f9, 0x83ea, 0x83c5, 0x83c0, 0x8426, 0x83f0, 0x83e1, 0x845c, 0x8451, 0x845a, 0x8459, 0x8473, 0x8487, 0x8488, 0x847a, 0x8489, 0x8478, 0x843c, 0x8446, 0x8469, 0x8476, 0x848c, 0x848e, 0x8431, 0x846d, 0x84c1, 0x84cd, 0x84d0, 0x84e6, 0x84bd, 0x84d3, 0x84ca, 0x84bf, 0x84ba, 0x84e0, 0x84a1, 0x84b9, 0x84b4, 0x8497, 0x84e5, 0x84e3, 0x850c, 0x750d, 0x8538, 0x84f0, 0x8539, 0x851f, 0x853a, /* 0x5e */ 0x8556, 0x853b, 0x84ff, 0x84fc, 0x8559, 0x8548, 0x8568, 0x8564, 0x855e, 0x857a, 0x77a2, 0x8543, 0x8572, 0x857b, 0x85a4, 0x85a8, 0x8587, 0x858f, 0x8579, 0x85ae, 0x859c, 0x8585, 0x85b9, 0x85b7, 0x85b0, 0x85d3, 0x85c1, 0x85dc, 0x85ff, 0x8627, 0x8605, 0x8629, 0x8616, 0x863c, 0x5efe, 0x5f08, 0x593c, 0x5941, 0x8037, 0x5955, 0x595a, 0x5958, 0x530f, 0x5c22, 0x5c25, 0x5c2c, 0x5c34, 0x624c, 0x626a, 0x629f, 0x62bb, 0x62ca, 0x62da, 0x62d7, 0x62ee, 0x6322, 0x62f6, 0x6339, 0x634b, 0x6343, 0x63ad, 0x63f6, 0x6371, 0x637a, 0x638e, 0x63b4, 0x636d, 0x63ac, 0x638a, 0x6369, 0x63ae, 0x63bc, 0x63f2, 0x63f8, 0x63e0, 0x63ff, 0x63c4, 0x63de, 0x63ce, 0x6452, 0x63c6, 0x63be, 0x6445, 0x6441, 0x640b, 0x641b, 0x6420, 0x640c, 0x6426, 0x6421, 0x645e, 0x6484, 0x646d, 0x6496, /* 0x5f */ 0x647a, 0x64b7, 0x64b8, 0x6499, 0x64ba, 0x64c0, 0x64d0, 0x64d7, 0x64e4, 0x64e2, 0x6509, 0x6525, 0x652e, 0x5f0b, 0x5fd2, 0x7519, 0x5f11, 0x535f, 0x53f1, 0x53fd, 0x53e9, 0x53e8, 0x53fb, 0x5412, 0x5416, 0x5406, 0x544b, 0x5452, 0x5453, 0x5454, 0x5456, 0x5443, 0x5421, 0x5457, 0x5459, 0x5423, 0x5432, 0x5482, 0x5494, 0x5477, 0x5471, 0x5464, 0x549a, 0x549b, 0x5484, 0x5476, 0x5466, 0x549d, 0x54d0, 0x54ad, 0x54c2, 0x54b4, 0x54d2, 0x54a7, 0x54a6, 0x54d3, 0x54d4, 0x5472, 0x54a3, 0x54d5, 0x54bb, 0x54bf, 0x54cc, 0x54d9, 0x54da, 0x54dc, 0x54a9, 0x54aa, 0x54a4, 0x54dd, 0x54cf, 0x54de, 0x551b, 0x54e7, 0x5520, 0x54fd, 0x5514, 0x54f3, 0x5522, 0x5523, 0x550f, 0x5511, 0x5527, 0x552a, 0x5567, 0x558f, 0x55b5, 0x5549, 0x556d, 0x5541, 0x5555, 0x553f, 0x5550, 0x553c, /* 0x60 */ 0x5537, 0x5556, 0x5575, 0x5576, 0x5577, 0x5533, 0x5530, 0x555c, 0x558b, 0x55d2, 0x5583, 0x55b1, 0x55b9, 0x5588, 0x5581, 0x559f, 0x557e, 0x55d6, 0x5591, 0x557b, 0x55df, 0x55bd, 0x55be, 0x5594, 0x5599, 0x55ea, 0x55f7, 0x55c9, 0x561f, 0x55d1, 0x55eb, 0x55ec, 0x55d4, 0x55e6, 0x55dd, 0x55c4, 0x55ef, 0x55e5, 0x55f2, 0x55f3, 0x55cc, 0x55cd, 0x55e8, 0x55f5, 0x55e4, 0x8f94, 0x561e, 0x5608, 0x560c, 0x5601, 0x5624, 0x5623, 0x55fe, 0x5600, 0x5627, 0x562d, 0x5658, 0x5639, 0x5657, 0x562c, 0x564d, 0x5662, 0x5659, 0x565c, 0x564c, 0x5654, 0x5686, 0x5664, 0x5671, 0x566b, 0x567b, 0x567c, 0x5685, 0x5693, 0x56af, 0x56d4, 0x56d7, 0x56dd, 0x56e1, 0x56f5, 0x56eb, 0x56f9, 0x56ff, 0x5704, 0x570a, 0x5709, 0x571c, 0x5e0f, 0x5e19, 0x5e14, 0x5e11, 0x5e31, 0x5e3b, 0x5e3c, /* 0x61 */ 0x5e37, 0x5e44, 0x5e54, 0x5e5b, 0x5e5e, 0x5e61, 0x5c8c, 0x5c7a, 0x5c8d, 0x5c90, 0x5c96, 0x5c88, 0x5c98, 0x5c99, 0x5c91, 0x5c9a, 0x5c9c, 0x5cb5, 0x5ca2, 0x5cbd, 0x5cac, 0x5cab, 0x5cb1, 0x5ca3, 0x5cc1, 0x5cb7, 0x5cc4, 0x5cd2, 0x5ce4, 0x5ccb, 0x5ce5, 0x5d02, 0x5d03, 0x5d27, 0x5d26, 0x5d2e, 0x5d24, 0x5d1e, 0x5d06, 0x5d1b, 0x5d58, 0x5d3e, 0x5d34, 0x5d3d, 0x5d6c, 0x5d5b, 0x5d6f, 0x5d5d, 0x5d6b, 0x5d4b, 0x5d4a, 0x5d69, 0x5d74, 0x5d82, 0x5d99, 0x5d9d, 0x8c73, 0x5db7, 0x5dc5, 0x5f73, 0x5f77, 0x5f82, 0x5f87, 0x5f89, 0x5f8c, 0x5f95, 0x5f99, 0x5f9c, 0x5fa8, 0x5fad, 0x5fb5, 0x5fbc, 0x8862, 0x5f61, 0x72ad, 0x72b0, 0x72b4, 0x72b7, 0x72b8, 0x72c3, 0x72c1, 0x72ce, 0x72cd, 0x72d2, 0x72e8, 0x72ef, 0x72e9, 0x72f2, 0x72f4, 0x72f7, 0x7301, 0x72f3, 0x7303, 0x72fa, /* 0x62 */ 0x72fb, 0x7317, 0x7313, 0x7321, 0x730a, 0x731e, 0x731d, 0x7315, 0x7322, 0x7339, 0x7325, 0x732c, 0x7338, 0x7331, 0x7350, 0x734d, 0x7357, 0x7360, 0x736c, 0x736f, 0x737e, 0x821b, 0x5925, 0x98e7, 0x5924, 0x5902, 0x9963, 0x9967, 0x9968, 0x9969, 0x996a, 0x996b, 0x996c, 0x9974, 0x9977, 0x997d, 0x9980, 0x9984, 0x9987, 0x998a, 0x998d, 0x9990, 0x9991, 0x9993, 0x9994, 0x9995, 0x5e80, 0x5e91, 0x5e8b, 0x5e96, 0x5ea5, 0x5ea0, 0x5eb9, 0x5eb5, 0x5ebe, 0x5eb3, 0x8d53, 0x5ed2, 0x5ed1, 0x5edb, 0x5ee8, 0x5eea, 0x81ba, 0x5fc4, 0x5fc9, 0x5fd6, 0x5fcf, 0x6003, 0x5fee, 0x6004, 0x5fe1, 0x5fe4, 0x5ffe, 0x6005, 0x6006, 0x5fea, 0x5fed, 0x5ff8, 0x6019, 0x6035, 0x6026, 0x601b, 0x600f, 0x600d, 0x6029, 0x602b, 0x600a, 0x603f, 0x6021, 0x6078, 0x6079, 0x607b, 0x607a, 0x6042, /* 0x63 */ 0x606a, 0x607d, 0x6096, 0x609a, 0x60ad, 0x609d, 0x6083, 0x6092, 0x608c, 0x609b, 0x60ec, 0x60bb, 0x60b1, 0x60dd, 0x60d8, 0x60c6, 0x60da, 0x60b4, 0x6120, 0x6126, 0x6115, 0x6123, 0x60f4, 0x6100, 0x610e, 0x612b, 0x614a, 0x6175, 0x61ac, 0x6194, 0x61a7, 0x61b7, 0x61d4, 0x61f5, 0x5fdd, 0x96b3, 0x95e9, 0x95eb, 0x95f1, 0x95f3, 0x95f5, 0x95f6, 0x95fc, 0x95fe, 0x9603, 0x9604, 0x9606, 0x9608, 0x960a, 0x960b, 0x960c, 0x960d, 0x960f, 0x9612, 0x9615, 0x9616, 0x9617, 0x9619, 0x961a, 0x4e2c, 0x723f, 0x6215, 0x6c35, 0x6c54, 0x6c5c, 0x6c4a, 0x6ca3, 0x6c85, 0x6c90, 0x6c94, 0x6c8c, 0x6c68, 0x6c69, 0x6c74, 0x6c76, 0x6c86, 0x6ca9, 0x6cd0, 0x6cd4, 0x6cad, 0x6cf7, 0x6cf8, 0x6cf1, 0x6cd7, 0x6cb2, 0x6ce0, 0x6cd6, 0x6cfa, 0x6ceb, 0x6cee, 0x6cb1, 0x6cd3, 0x6cef, 0x6cfe, /* 0x64 */ 0x6d39, 0x6d27, 0x6d0c, 0x6d43, 0x6d48, 0x6d07, 0x6d04, 0x6d19, 0x6d0e, 0x6d2b, 0x6d4d, 0x6d2e, 0x6d35, 0x6d1a, 0x6d4f, 0x6d52, 0x6d54, 0x6d33, 0x6d91, 0x6d6f, 0x6d9e, 0x6da0, 0x6d5e, 0x6d93, 0x6d94, 0x6d5c, 0x6d60, 0x6d7c, 0x6d63, 0x6e1a, 0x6dc7, 0x6dc5, 0x6dde, 0x6e0e, 0x6dbf, 0x6de0, 0x6e11, 0x6de6, 0x6ddd, 0x6dd9, 0x6e16, 0x6dab, 0x6e0c, 0x6dae, 0x6e2b, 0x6e6e, 0x6e4e, 0x6e6b, 0x6eb2, 0x6e5f, 0x6e86, 0x6e53, 0x6e54, 0x6e32, 0x6e25, 0x6e44, 0x6edf, 0x6eb1, 0x6e98, 0x6ee0, 0x6f2d, 0x6ee2, 0x6ea5, 0x6ea7, 0x6ebd, 0x6ebb, 0x6eb7, 0x6ed7, 0x6eb4, 0x6ecf, 0x6e8f, 0x6ec2, 0x6e9f, 0x6f62, 0x6f46, 0x6f47, 0x6f24, 0x6f15, 0x6ef9, 0x6f2f, 0x6f36, 0x6f4b, 0x6f74, 0x6f2a, 0x6f09, 0x6f29, 0x6f89, 0x6f8d, 0x6f8c, 0x6f78, 0x6f72, 0x6f7c, 0x6f7a, 0x6fd1, /* 0x65 */ 0x6fc9, 0x6fa7, 0x6fb9, 0x6fb6, 0x6fc2, 0x6fe1, 0x6fee, 0x6fde, 0x6fe0, 0x6fef, 0x701a, 0x7023, 0x701b, 0x7039, 0x7035, 0x704f, 0x705e, 0x5b80, 0x5b84, 0x5b95, 0x5b93, 0x5ba5, 0x5bb8, 0x752f, 0x9a9e, 0x6434, 0x5be4, 0x5bee, 0x8930, 0x5bf0, 0x8e47, 0x8b07, 0x8fb6, 0x8fd3, 0x8fd5, 0x8fe5, 0x8fee, 0x8fe4, 0x8fe9, 0x8fe6, 0x8ff3, 0x8fe8, 0x9005, 0x9004, 0x900b, 0x9026, 0x9011, 0x900d, 0x9016, 0x9021, 0x9035, 0x9036, 0x902d, 0x902f, 0x9044, 0x9051, 0x9052, 0x9050, 0x9068, 0x9058, 0x9062, 0x905b, 0x66b9, 0x9074, 0x907d, 0x9082, 0x9088, 0x9083, 0x908b, 0x5f50, 0x5f57, 0x5f56, 0x5f58, 0x5c3b, 0x54ab, 0x5c50, 0x5c59, 0x5b71, 0x5c63, 0x5c66, 0x7fbc, 0x5f2a, 0x5f29, 0x5f2d, 0x8274, 0x5f3c, 0x9b3b, 0x5c6e, 0x5981, 0x5983, 0x598d, 0x59a9, 0x59aa, 0x59a3, /* 0x66 */ 0x5997, 0x59ca, 0x59ab, 0x599e, 0x59a4, 0x59d2, 0x59b2, 0x59af, 0x59d7, 0x59be, 0x5a05, 0x5a06, 0x59dd, 0x5a08, 0x59e3, 0x59d8, 0x59f9, 0x5a0c, 0x5a09, 0x5a32, 0x5a34, 0x5a11, 0x5a23, 0x5a13, 0x5a40, 0x5a67, 0x5a4a, 0x5a55, 0x5a3c, 0x5a62, 0x5a75, 0x80ec, 0x5aaa, 0x5a9b, 0x5a77, 0x5a7a, 0x5abe, 0x5aeb, 0x5ab2, 0x5ad2, 0x5ad4, 0x5ab8, 0x5ae0, 0x5ae3, 0x5af1, 0x5ad6, 0x5ae6, 0x5ad8, 0x5adc, 0x5b09, 0x5b17, 0x5b16, 0x5b32, 0x5b37, 0x5b40, 0x5c15, 0x5c1c, 0x5b5a, 0x5b65, 0x5b73, 0x5b51, 0x5b53, 0x5b62, 0x9a75, 0x9a77, 0x9a78, 0x9a7a, 0x9a7f, 0x9a7d, 0x9a80, 0x9a81, 0x9a85, 0x9a88, 0x9a8a, 0x9a90, 0x9a92, 0x9a93, 0x9a96, 0x9a98, 0x9a9b, 0x9a9c, 0x9a9d, 0x9a9f, 0x9aa0, 0x9aa2, 0x9aa3, 0x9aa5, 0x9aa7, 0x7e9f, 0x7ea1, 0x7ea3, 0x7ea5, 0x7ea8, 0x7ea9, /* 0x67 */ 0x7ead, 0x7eb0, 0x7ebe, 0x7ec0, 0x7ec1, 0x7ec2, 0x7ec9, 0x7ecb, 0x7ecc, 0x7ed0, 0x7ed4, 0x7ed7, 0x7edb, 0x7ee0, 0x7ee1, 0x7ee8, 0x7eeb, 0x7eee, 0x7eef, 0x7ef1, 0x7ef2, 0x7f0d, 0x7ef6, 0x7efa, 0x7efb, 0x7efe, 0x7f01, 0x7f02, 0x7f03, 0x7f07, 0x7f08, 0x7f0b, 0x7f0c, 0x7f0f, 0x7f11, 0x7f12, 0x7f17, 0x7f19, 0x7f1c, 0x7f1b, 0x7f1f, 0x7f21, 0x7f22, 0x7f23, 0x7f24, 0x7f25, 0x7f26, 0x7f27, 0x7f2a, 0x7f2b, 0x7f2c, 0x7f2d, 0x7f2f, 0x7f30, 0x7f31, 0x7f32, 0x7f33, 0x7f35, 0x5e7a, 0x757f, 0x5ddb, 0x753e, 0x9095, 0x738e, 0x7391, 0x73ae, 0x73a2, 0x739f, 0x73cf, 0x73c2, 0x73d1, 0x73b7, 0x73b3, 0x73c0, 0x73c9, 0x73c8, 0x73e5, 0x73d9, 0x987c, 0x740a, 0x73e9, 0x73e7, 0x73de, 0x73ba, 0x73f2, 0x740f, 0x742a, 0x745b, 0x7426, 0x7425, 0x7428, 0x7430, 0x742e, 0x742c, /* 0x68 */ 0x741b, 0x741a, 0x7441, 0x745c, 0x7457, 0x7455, 0x7459, 0x7477, 0x746d, 0x747e, 0x749c, 0x748e, 0x7480, 0x7481, 0x7487, 0x748b, 0x749e, 0x74a8, 0x74a9, 0x7490, 0x74a7, 0x74d2, 0x74ba, 0x97ea, 0x97eb, 0x97ec, 0x674c, 0x6753, 0x675e, 0x6748, 0x6769, 0x67a5, 0x6787, 0x676a, 0x6773, 0x6798, 0x67a7, 0x6775, 0x67a8, 0x679e, 0x67ad, 0x678b, 0x6777, 0x677c, 0x67f0, 0x6809, 0x67d8, 0x680a, 0x67e9, 0x67b0, 0x680c, 0x67d9, 0x67b5, 0x67da, 0x67b3, 0x67dd, 0x6800, 0x67c3, 0x67b8, 0x67e2, 0x680e, 0x67c1, 0x67fd, 0x6832, 0x6833, 0x6860, 0x6861, 0x684e, 0x6862, 0x6844, 0x6864, 0x6883, 0x681d, 0x6855, 0x6866, 0x6841, 0x6867, 0x6840, 0x683e, 0x684a, 0x6849, 0x6829, 0x68b5, 0x688f, 0x6874, 0x6877, 0x6893, 0x686b, 0x68c2, 0x696e, 0x68fc, 0x691f, 0x6920, 0x68f9, /* 0x69 */ 0x6924, 0x68f0, 0x690b, 0x6901, 0x6957, 0x68e3, 0x6910, 0x6971, 0x6939, 0x6960, 0x6942, 0x695d, 0x6984, 0x696b, 0x6980, 0x6998, 0x6978, 0x6934, 0x69cc, 0x6987, 0x6988, 0x69ce, 0x6989, 0x6966, 0x6963, 0x6979, 0x699b, 0x69a7, 0x69bb, 0x69ab, 0x69ad, 0x69d4, 0x69b1, 0x69c1, 0x69ca, 0x69df, 0x6995, 0x69e0, 0x698d, 0x69ff, 0x6a2f, 0x69ed, 0x6a17, 0x6a18, 0x6a65, 0x69f2, 0x6a44, 0x6a3e, 0x6aa0, 0x6a50, 0x6a5b, 0x6a35, 0x6a8e, 0x6a79, 0x6a3d, 0x6a28, 0x6a58, 0x6a7c, 0x6a91, 0x6a90, 0x6aa9, 0x6a97, 0x6aab, 0x7337, 0x7352, 0x6b81, 0x6b82, 0x6b87, 0x6b84, 0x6b92, 0x6b93, 0x6b8d, 0x6b9a, 0x6b9b, 0x6ba1, 0x6baa, 0x8f6b, 0x8f6d, 0x8f71, 0x8f72, 0x8f73, 0x8f75, 0x8f76, 0x8f78, 0x8f77, 0x8f79, 0x8f7a, 0x8f7c, 0x8f7e, 0x8f81, 0x8f82, 0x8f84, 0x8f87, 0x8f8b, /* 0x6a */ 0x8f8d, 0x8f8e, 0x8f8f, 0x8f98, 0x8f9a, 0x8ece, 0x620b, 0x6217, 0x621b, 0x621f, 0x6222, 0x6221, 0x6225, 0x6224, 0x622c, 0x81e7, 0x74ef, 0x74f4, 0x74ff, 0x750f, 0x7511, 0x7513, 0x6534, 0x65ee, 0x65ef, 0x65f0, 0x660a, 0x6619, 0x6772, 0x6603, 0x6615, 0x6600, 0x7085, 0x66f7, 0x661d, 0x6634, 0x6631, 0x6636, 0x6635, 0x8006, 0x665f, 0x6654, 0x6641, 0x664f, 0x6656, 0x6661, 0x6657, 0x6677, 0x6684, 0x668c, 0x66a7, 0x669d, 0x66be, 0x66db, 0x66dc, 0x66e6, 0x66e9, 0x8d32, 0x8d33, 0x8d36, 0x8d3b, 0x8d3d, 0x8d40, 0x8d45, 0x8d46, 0x8d48, 0x8d49, 0x8d47, 0x8d4d, 0x8d55, 0x8d59, 0x89c7, 0x89ca, 0x89cb, 0x89cc, 0x89ce, 0x89cf, 0x89d0, 0x89d1, 0x726e, 0x729f, 0x725d, 0x7266, 0x726f, 0x727e, 0x727f, 0x7284, 0x728b, 0x728d, 0x728f, 0x7292, 0x6308, 0x6332, 0x63b0, /* 0x6b */ 0x643f, 0x64d8, 0x8004, 0x6bea, 0x6bf3, 0x6bfd, 0x6bf5, 0x6bf9, 0x6c05, 0x6c07, 0x6c06, 0x6c0d, 0x6c15, 0x6c18, 0x6c19, 0x6c1a, 0x6c21, 0x6c29, 0x6c24, 0x6c2a, 0x6c32, 0x6535, 0x6555, 0x656b, 0x724d, 0x7252, 0x7256, 0x7230, 0x8662, 0x5216, 0x809f, 0x809c, 0x8093, 0x80bc, 0x670a, 0x80bd, 0x80b1, 0x80ab, 0x80ad, 0x80b4, 0x80b7, 0x80e7, 0x80e8, 0x80e9, 0x80ea, 0x80db, 0x80c2, 0x80c4, 0x80d9, 0x80cd, 0x80d7, 0x6710, 0x80dd, 0x80eb, 0x80f1, 0x80f4, 0x80ed, 0x810d, 0x810e, 0x80f2, 0x80fc, 0x6715, 0x8112, 0x8c5a, 0x8136, 0x811e, 0x812c, 0x8118, 0x8132, 0x8148, 0x814c, 0x8153, 0x8174, 0x8159, 0x815a, 0x8171, 0x8160, 0x8169, 0x817c, 0x817d, 0x816d, 0x8167, 0x584d, 0x5ab5, 0x8188, 0x8182, 0x8191, 0x6ed5, 0x81a3, 0x81aa, 0x81cc, 0x6726, 0x81ca, 0x81bb, /* 0x6c */ 0x81c1, 0x81a6, 0x6b24, 0x6b37, 0x6b39, 0x6b43, 0x6b46, 0x6b59, 0x98d1, 0x98d2, 0x98d3, 0x98d5, 0x98d9, 0x98da, 0x6bb3, 0x5f40, 0x6bc2, 0x89f3, 0x6590, 0x9f51, 0x6593, 0x65bc, 0x65c6, 0x65c4, 0x65c3, 0x65cc, 0x65ce, 0x65d2, 0x65d6, 0x7080, 0x709c, 0x7096, 0x709d, 0x70bb, 0x70c0, 0x70b7, 0x70ab, 0x70b1, 0x70e8, 0x70ca, 0x7110, 0x7113, 0x7116, 0x712f, 0x7131, 0x7173, 0x715c, 0x7168, 0x7145, 0x7172, 0x714a, 0x7178, 0x717a, 0x7198, 0x71b3, 0x71b5, 0x71a8, 0x71a0, 0x71e0, 0x71d4, 0x71e7, 0x71f9, 0x721d, 0x7228, 0x706c, 0x7118, 0x7166, 0x71b9, 0x623e, 0x623d, 0x6243, 0x6248, 0x6249, 0x793b, 0x7940, 0x7946, 0x7949, 0x795b, 0x795c, 0x7953, 0x795a, 0x7962, 0x7957, 0x7960, 0x796f, 0x7967, 0x797a, 0x7985, 0x798a, 0x799a, 0x79a7, 0x79b3, 0x5fd1, 0x5fd0, /* 0x6d */ 0x603c, 0x605d, 0x605a, 0x6067, 0x6041, 0x6059, 0x6063, 0x60ab, 0x6106, 0x610d, 0x615d, 0x61a9, 0x619d, 0x61cb, 0x61d1, 0x6206, 0x8080, 0x807f, 0x6c93, 0x6cf6, 0x6dfc, 0x77f6, 0x77f8, 0x7800, 0x7809, 0x7817, 0x7818, 0x7811, 0x65ab, 0x782d, 0x781c, 0x781d, 0x7839, 0x783a, 0x783b, 0x781f, 0x783c, 0x7825, 0x782c, 0x7823, 0x7829, 0x784e, 0x786d, 0x7856, 0x7857, 0x7826, 0x7850, 0x7847, 0x784c, 0x786a, 0x789b, 0x7893, 0x789a, 0x7887, 0x789c, 0x78a1, 0x78a3, 0x78b2, 0x78b9, 0x78a5, 0x78d4, 0x78d9, 0x78c9, 0x78ec, 0x78f2, 0x7905, 0x78f4, 0x7913, 0x7924, 0x791e, 0x7934, 0x9f9b, 0x9ef9, 0x9efb, 0x9efc, 0x76f1, 0x7704, 0x770d, 0x76f9, 0x7707, 0x7708, 0x771a, 0x7722, 0x7719, 0x772d, 0x7726, 0x7735, 0x7738, 0x7750, 0x7751, 0x7747, 0x7743, 0x775a, 0x7768, /* 0x6e */ 0x7762, 0x7765, 0x777f, 0x778d, 0x777d, 0x7780, 0x778c, 0x7791, 0x779f, 0x77a0, 0x77b0, 0x77b5, 0x77bd, 0x753a, 0x7540, 0x754e, 0x754b, 0x7548, 0x755b, 0x7572, 0x7579, 0x7583, 0x7f58, 0x7f61, 0x7f5f, 0x8a48, 0x7f68, 0x7f74, 0x7f71, 0x7f79, 0x7f81, 0x7f7e, 0x76cd, 0x76e5, 0x8832, 0x9485, 0x9486, 0x9487, 0x948b, 0x948a, 0x948c, 0x948d, 0x948f, 0x9490, 0x9494, 0x9497, 0x9495, 0x949a, 0x949b, 0x949c, 0x94a3, 0x94a4, 0x94ab, 0x94aa, 0x94ad, 0x94ac, 0x94af, 0x94b0, 0x94b2, 0x94b4, 0x94b6, 0x94b7, 0x94b8, 0x94b9, 0x94ba, 0x94bc, 0x94bd, 0x94bf, 0x94c4, 0x94c8, 0x94c9, 0x94ca, 0x94cb, 0x94cc, 0x94cd, 0x94ce, 0x94d0, 0x94d1, 0x94d2, 0x94d5, 0x94d6, 0x94d7, 0x94d9, 0x94d8, 0x94db, 0x94de, 0x94df, 0x94e0, 0x94e2, 0x94e4, 0x94e5, 0x94e7, 0x94e8, 0x94ea, /* 0x6f */ 0x94e9, 0x94eb, 0x94ee, 0x94ef, 0x94f3, 0x94f4, 0x94f5, 0x94f7, 0x94f9, 0x94fc, 0x94fd, 0x94ff, 0x9503, 0x9502, 0x9506, 0x9507, 0x9509, 0x950a, 0x950d, 0x950e, 0x950f, 0x9512, 0x9513, 0x9514, 0x9515, 0x9516, 0x9518, 0x951b, 0x951d, 0x951e, 0x951f, 0x9522, 0x952a, 0x952b, 0x9529, 0x952c, 0x9531, 0x9532, 0x9534, 0x9536, 0x9537, 0x9538, 0x953c, 0x953e, 0x953f, 0x9542, 0x9535, 0x9544, 0x9545, 0x9546, 0x9549, 0x954c, 0x954e, 0x954f, 0x9552, 0x9553, 0x9554, 0x9556, 0x9557, 0x9558, 0x9559, 0x955b, 0x955e, 0x955f, 0x955d, 0x9561, 0x9562, 0x9564, 0x9565, 0x9566, 0x9567, 0x9568, 0x9569, 0x956a, 0x956b, 0x956c, 0x956f, 0x9571, 0x9572, 0x9573, 0x953a, 0x77e7, 0x77ec, 0x96c9, 0x79d5, 0x79ed, 0x79e3, 0x79eb, 0x7a06, 0x5d47, 0x7a03, 0x7a02, 0x7a1e, 0x7a14, /* 0x70 */ 0x7a39, 0x7a37, 0x7a51, 0x9ecf, 0x99a5, 0x7a70, 0x7688, 0x768e, 0x7693, 0x7699, 0x76a4, 0x74de, 0x74e0, 0x752c, 0x9e20, 0x9e22, 0x9e28, 0x9e29, 0x9e2a, 0x9e2b, 0x9e2c, 0x9e32, 0x9e31, 0x9e36, 0x9e38, 0x9e37, 0x9e39, 0x9e3a, 0x9e3e, 0x9e41, 0x9e42, 0x9e44, 0x9e46, 0x9e47, 0x9e48, 0x9e49, 0x9e4b, 0x9e4c, 0x9e4e, 0x9e51, 0x9e55, 0x9e57, 0x9e5a, 0x9e5b, 0x9e5c, 0x9e5e, 0x9e63, 0x9e66, 0x9e67, 0x9e68, 0x9e69, 0x9e6a, 0x9e6b, 0x9e6c, 0x9e71, 0x9e6d, 0x9e73, 0x7592, 0x7594, 0x7596, 0x75a0, 0x759d, 0x75ac, 0x75a3, 0x75b3, 0x75b4, 0x75b8, 0x75c4, 0x75b1, 0x75b0, 0x75c3, 0x75c2, 0x75d6, 0x75cd, 0x75e3, 0x75e8, 0x75e6, 0x75e4, 0x75eb, 0x75e7, 0x7603, 0x75f1, 0x75fc, 0x75ff, 0x7610, 0x7600, 0x7605, 0x760c, 0x7617, 0x760a, 0x7625, 0x7618, 0x7615, 0x7619, /* 0x71 */ 0x761b, 0x763c, 0x7622, 0x7620, 0x7640, 0x762d, 0x7630, 0x763f, 0x7635, 0x7643, 0x763e, 0x7633, 0x764d, 0x765e, 0x7654, 0x765c, 0x7656, 0x766b, 0x766f, 0x7fca, 0x7ae6, 0x7a78, 0x7a79, 0x7a80, 0x7a86, 0x7a88, 0x7a95, 0x7aa6, 0x7aa0, 0x7aac, 0x7aa8, 0x7aad, 0x7ab3, 0x8864, 0x8869, 0x8872, 0x887d, 0x887f, 0x8882, 0x88a2, 0x88c6, 0x88b7, 0x88bc, 0x88c9, 0x88e2, 0x88ce, 0x88e3, 0x88e5, 0x88f1, 0x891a, 0x88fc, 0x88e8, 0x88fe, 0x88f0, 0x8921, 0x8919, 0x8913, 0x891b, 0x890a, 0x8934, 0x892b, 0x8936, 0x8941, 0x8966, 0x897b, 0x758b, 0x80e5, 0x76b2, 0x76b4, 0x77dc, 0x8012, 0x8014, 0x8016, 0x801c, 0x8020, 0x8022, 0x8025, 0x8026, 0x8027, 0x8029, 0x8028, 0x8031, 0x800b, 0x8035, 0x8043, 0x8046, 0x804d, 0x8052, 0x8069, 0x8071, 0x8983, 0x9878, 0x9880, 0x9883, /* 0x72 */ 0x9889, 0x988c, 0x988d, 0x988f, 0x9894, 0x989a, 0x989b, 0x989e, 0x989f, 0x98a1, 0x98a2, 0x98a5, 0x98a6, 0x864d, 0x8654, 0x866c, 0x866e, 0x867f, 0x867a, 0x867c, 0x867b, 0x86a8, 0x868d, 0x868b, 0x86ac, 0x869d, 0x86a7, 0x86a3, 0x86aa, 0x8693, 0x86a9, 0x86b6, 0x86c4, 0x86b5, 0x86ce, 0x86b0, 0x86ba, 0x86b1, 0x86af, 0x86c9, 0x86cf, 0x86b4, 0x86e9, 0x86f1, 0x86f2, 0x86ed, 0x86f3, 0x86d0, 0x8713, 0x86de, 0x86f4, 0x86df, 0x86d8, 0x86d1, 0x8703, 0x8707, 0x86f8, 0x8708, 0x870a, 0x870d, 0x8709, 0x8723, 0x873b, 0x871e, 0x8725, 0x872e, 0x871a, 0x873e, 0x8748, 0x8734, 0x8731, 0x8729, 0x8737, 0x873f, 0x8782, 0x8722, 0x877d, 0x877e, 0x877b, 0x8760, 0x8770, 0x874c, 0x876e, 0x878b, 0x8753, 0x8763, 0x877c, 0x8764, 0x8759, 0x8765, 0x8793, 0x87af, 0x87a8, 0x87d2, /* 0x73 */ 0x87c6, 0x8788, 0x8785, 0x87ad, 0x8797, 0x8783, 0x87ab, 0x87e5, 0x87ac, 0x87b5, 0x87b3, 0x87cb, 0x87d3, 0x87bd, 0x87d1, 0x87c0, 0x87ca, 0x87db, 0x87ea, 0x87e0, 0x87ee, 0x8816, 0x8813, 0x87fe, 0x880a, 0x881b, 0x8821, 0x8839, 0x883c, 0x7f36, 0x7f42, 0x7f44, 0x7f45, 0x8210, 0x7afa, 0x7afd, 0x7b08, 0x7b03, 0x7b04, 0x7b15, 0x7b0a, 0x7b2b, 0x7b0f, 0x7b47, 0x7b38, 0x7b2a, 0x7b19, 0x7b2e, 0x7b31, 0x7b20, 0x7b25, 0x7b24, 0x7b33, 0x7b3e, 0x7b1e, 0x7b58, 0x7b5a, 0x7b45, 0x7b75, 0x7b4c, 0x7b5d, 0x7b60, 0x7b6e, 0x7b7b, 0x7b62, 0x7b72, 0x7b71, 0x7b90, 0x7ba6, 0x7ba7, 0x7bb8, 0x7bac, 0x7b9d, 0x7ba8, 0x7b85, 0x7baa, 0x7b9c, 0x7ba2, 0x7bab, 0x7bb4, 0x7bd1, 0x7bc1, 0x7bcc, 0x7bdd, 0x7bda, 0x7be5, 0x7be6, 0x7bea, 0x7c0c, 0x7bfe, 0x7bfc, 0x7c0f, 0x7c16, 0x7c0b, /* 0x74 */ 0x7c1f, 0x7c2a, 0x7c26, 0x7c38, 0x7c41, 0x7c40, 0x81fe, 0x8201, 0x8202, 0x8204, 0x81ec, 0x8844, 0x8221, 0x8222, 0x8223, 0x822d, 0x822f, 0x8228, 0x822b, 0x8238, 0x823b, 0x8233, 0x8234, 0x823e, 0x8244, 0x8249, 0x824b, 0x824f, 0x825a, 0x825f, 0x8268, 0x887e, 0x8885, 0x8888, 0x88d8, 0x88df, 0x895e, 0x7f9d, 0x7f9f, 0x7fa7, 0x7faf, 0x7fb0, 0x7fb2, 0x7c7c, 0x6549, 0x7c91, 0x7c9d, 0x7c9c, 0x7c9e, 0x7ca2, 0x7cb2, 0x7cbc, 0x7cbd, 0x7cc1, 0x7cc7, 0x7ccc, 0x7ccd, 0x7cc8, 0x7cc5, 0x7cd7, 0x7ce8, 0x826e, 0x66a8, 0x7fbf, 0x7fce, 0x7fd5, 0x7fe5, 0x7fe1, 0x7fe6, 0x7fe9, 0x7fee, 0x7ff3, 0x7cf8, 0x7d77, 0x7da6, 0x7dae, 0x7e47, 0x7e9b, 0x9eb8, 0x9eb4, 0x8d73, 0x8d84, 0x8d94, 0x8d91, 0x8db1, 0x8d67, 0x8d6d, 0x8c47, 0x8c49, 0x914a, 0x9150, 0x914e, 0x914f, 0x9164, /* 0x75 */ 0x9162, 0x9161, 0x9170, 0x9169, 0x916f, 0x917d, 0x917e, 0x9172, 0x9174, 0x9179, 0x918c, 0x9185, 0x9190, 0x918d, 0x9191, 0x91a2, 0x91a3, 0x91aa, 0x91ad, 0x91ae, 0x91af, 0x91b5, 0x91b4, 0x91ba, 0x8c55, 0x9e7e, 0x8db8, 0x8deb, 0x8e05, 0x8e59, 0x8e69, 0x8db5, 0x8dbf, 0x8dbc, 0x8dba, 0x8dc4, 0x8dd6, 0x8dd7, 0x8dda, 0x8dde, 0x8dce, 0x8dcf, 0x8ddb, 0x8dc6, 0x8dec, 0x8df7, 0x8df8, 0x8de3, 0x8df9, 0x8dfb, 0x8de4, 0x8e09, 0x8dfd, 0x8e14, 0x8e1d, 0x8e1f, 0x8e2c, 0x8e2e, 0x8e23, 0x8e2f, 0x8e3a, 0x8e40, 0x8e39, 0x8e35, 0x8e3d, 0x8e31, 0x8e49, 0x8e41, 0x8e42, 0x8e51, 0x8e52, 0x8e4a, 0x8e70, 0x8e76, 0x8e7c, 0x8e6f, 0x8e74, 0x8e85, 0x8e8f, 0x8e94, 0x8e90, 0x8e9c, 0x8e9e, 0x8c78, 0x8c82, 0x8c8a, 0x8c85, 0x8c98, 0x8c94, 0x659b, 0x89d6, 0x89de, 0x89da, 0x89dc, /* 0x76 */ 0x89e5, 0x89eb, 0x89ef, 0x8a3e, 0x8b26, 0x9753, 0x96e9, 0x96f3, 0x96ef, 0x9706, 0x9701, 0x9708, 0x970f, 0x970e, 0x972a, 0x972d, 0x9730, 0x973e, 0x9f80, 0x9f83, 0x9f85, 0x9f86, 0x9f87, 0x9f88, 0x9f89, 0x9f8a, 0x9f8c, 0x9efe, 0x9f0b, 0x9f0d, 0x96b9, 0x96bc, 0x96bd, 0x96ce, 0x96d2, 0x77bf, 0x96e0, 0x928e, 0x92ae, 0x92c8, 0x933e, 0x936a, 0x93ca, 0x938f, 0x943e, 0x946b, 0x9c7f, 0x9c82, 0x9c85, 0x9c86, 0x9c87, 0x9c88, 0x7a23, 0x9c8b, 0x9c8e, 0x9c90, 0x9c91, 0x9c92, 0x9c94, 0x9c95, 0x9c9a, 0x9c9b, 0x9c9e, 0x9c9f, 0x9ca0, 0x9ca1, 0x9ca2, 0x9ca3, 0x9ca5, 0x9ca6, 0x9ca7, 0x9ca8, 0x9ca9, 0x9cab, 0x9cad, 0x9cae, 0x9cb0, 0x9cb1, 0x9cb2, 0x9cb3, 0x9cb4, 0x9cb5, 0x9cb6, 0x9cb7, 0x9cba, 0x9cbb, 0x9cbc, 0x9cbd, 0x9cc4, 0x9cc5, 0x9cc6, 0x9cc7, 0x9cca, 0x9ccb, /* 0x77 */ 0x9ccc, 0x9ccd, 0x9cce, 0x9ccf, 0x9cd0, 0x9cd3, 0x9cd4, 0x9cd5, 0x9cd7, 0x9cd8, 0x9cd9, 0x9cdc, 0x9cdd, 0x9cdf, 0x9ce2, 0x977c, 0x9785, 0x9791, 0x9792, 0x9794, 0x97af, 0x97ab, 0x97a3, 0x97b2, 0x97b4, 0x9ab1, 0x9ab0, 0x9ab7, 0x9e58, 0x9ab6, 0x9aba, 0x9abc, 0x9ac1, 0x9ac0, 0x9ac5, 0x9ac2, 0x9acb, 0x9acc, 0x9ad1, 0x9b45, 0x9b43, 0x9b47, 0x9b49, 0x9b48, 0x9b4d, 0x9b51, 0x98e8, 0x990d, 0x992e, 0x9955, 0x9954, 0x9adf, 0x9ae1, 0x9ae6, 0x9aef, 0x9aeb, 0x9afb, 0x9aed, 0x9af9, 0x9b08, 0x9b0f, 0x9b13, 0x9b1f, 0x9b23, 0x9ebd, 0x9ebe, 0x7e3b, 0x9e82, 0x9e87, 0x9e88, 0x9e8b, 0x9e92, 0x93d6, 0x9e9d, 0x9e9f, 0x9edb, 0x9edc, 0x9edd, 0x9ee0, 0x9edf, 0x9ee2, 0x9ee9, 0x9ee7, 0x9ee5, 0x9eea, 0x9eef, 0x9f22, 0x9f2c, 0x9f2f, 0x9f39, 0x9f37, 0x9f3d, 0x9f3e, 0x9f44, }; static int gb2312_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c1 = (s[0] & 0x7F); if ((c1 >= 0x21 && c1 <= 0x29) || (c1 >= 0x30 && c1 <= 0x77)) { if (n >= 2) { unsigned char c2 = (s[1] & 0x7F); if (c2 >= 0x21 && c2 < 0x7f) { unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); unsigned short wc = 0xfffd; if (i < 1410) { if (i < 831) wc = gb2312_2uni_page21[i]; } else { if (i < 8178) wc = gb2312_2uni_page30[i-1410]; } if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 2; } } return RET_ILSEQ; } return RET_TOOFEW(0); } return RET_ILSEQ; } static const unsigned short gb2312_2charset[7445] = { 0x2168, 0x216c, 0x2127, 0x2163, 0x2140, 0x2141, 0x2824, 0x2822, 0x2828, 0x2826, 0x283a, 0x282c, 0x282a, 0x2830, 0x282e, 0x2142, 0x2834, 0x2832, 0x2839, 0x2821, 0x2825, 0x2827, 0x2829, 0x282d, 0x2831, 0x2823, 0x282b, 0x282f, 0x2833, 0x2835, 0x2836, 0x2837, 0x2838, 0x2126, 0x2125, 0x2621, 0x2622, 0x2623, 0x2624, 0x2625, 0x2626, 0x2627, 0x2628, 0x2629, 0x262a, 0x262b, 0x262c, 0x262d, 0x262e, 0x262f, 0x2630, 0x2631, 0x2632, 0x2633, 0x2634, 0x2635, 0x2636, 0x2637, 0x2638, 0x2641, 0x2642, 0x2643, 0x2644, 0x2645, 0x2646, 0x2647, 0x2648, 0x2649, 0x264a, 0x264b, 0x264c, 0x264d, 0x264e, 0x264f, 0x2650, 0x2651, 0x2652, 0x2653, 0x2654, 0x2655, 0x2656, 0x2657, 0x2658, 0x2727, 0x2721, 0x2722, 0x2723, 0x2724, 0x2725, 0x2726, 0x2728, 0x2729, 0x272a, 0x272b, 0x272c, 0x272d, 0x272e, 0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, 0x2738, 0x2739, 0x273a, 0x273b, 0x273c, 0x273d, 0x273e, 0x273f, 0x2740, 0x2741, 0x2751, 0x2752, 0x2753, 0x2754, 0x2755, 0x2756, 0x2758, 0x2759, 0x275a, 0x275b, 0x275c, 0x275d, 0x275e, 0x275f, 0x2760, 0x2761, 0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x2768, 0x2769, 0x276a, 0x276b, 0x276c, 0x276d, 0x276e, 0x276f, 0x2770, 0x2771, 0x2757, 0x212a, 0x212c, 0x212e, 0x212f, 0x2130, 0x2131, 0x212d, 0x216b, 0x2164, 0x2165, 0x2179, 0x2166, 0x216d, 0x2271, 0x2272, 0x2273, 0x2274, 0x2275, 0x2276, 0x2277, 0x2278, 0x2279, 0x227a, 0x227b, 0x227c, 0x217b, 0x217c, 0x217a, 0x217d, 0x214a, 0x2147, 0x2146, 0x214c, 0x2158, 0x215e, 0x214f, 0x214e, 0x2144, 0x2145, 0x2149, 0x2148, 0x2152, 0x2153, 0x2160, 0x215f, 0x2143, 0x214b, 0x2157, 0x2156, 0x2155, 0x2159, 0x2154, 0x215c, 0x215d, 0x215a, 0x215b, 0x2151, 0x214d, 0x2150, 0x2259, 0x225a, 0x225b, 0x225c, 0x225d, 0x225e, 0x225f, 0x2260, 0x2261, 0x2262, 0x2245, 0x2246, 0x2247, 0x2248, 0x2249, 0x224a, 0x224b, 0x224c, 0x224d, 0x224e, 0x224f, 0x2250, 0x2251, 0x2252, 0x2253, 0x2254, 0x2255, 0x2256, 0x2257, 0x2258, 0x2231, 0x2232, 0x2233, 0x2234, 0x2235, 0x2236, 0x2237, 0x2238, 0x2239, 0x223a, 0x223b, 0x223c, 0x223d, 0x223e, 0x223f, 0x2240, 0x2241, 0x2242, 0x2243, 0x2244, 0x2924, 0x2925, 0x2926, 0x2927, 0x2928, 0x2929, 0x292a, 0x292b, 0x292c, 0x292d, 0x292e, 0x292f, 0x2930, 0x2931, 0x2932, 0x2933, 0x2934, 0x2935, 0x2936, 0x2937, 0x2938, 0x2939, 0x293a, 0x293b, 0x293c, 0x293d, 0x293e, 0x293f, 0x2940, 0x2941, 0x2942, 0x2943, 0x2944, 0x2945, 0x2946, 0x2947, 0x2948, 0x2949, 0x294a, 0x294b, 0x294c, 0x294d, 0x294e, 0x294f, 0x2950, 0x2951, 0x2952, 0x2953, 0x2954, 0x2955, 0x2956, 0x2957, 0x2958, 0x2959, 0x295a, 0x295b, 0x295c, 0x295d, 0x295e, 0x295f, 0x2960, 0x2961, 0x2962, 0x2963, 0x2964, 0x2965, 0x2966, 0x2967, 0x2968, 0x2969, 0x296a, 0x296b, 0x296c, 0x296d, 0x296e, 0x296f, 0x2176, 0x2175, 0x2178, 0x2177, 0x2174, 0x2173, 0x2170, 0x2172, 0x2171, 0x216f, 0x216e, 0x2162, 0x2161, 0x2121, 0x2122, 0x2123, 0x2128, 0x2129, 0x2134, 0x2135, 0x2136, 0x2137, 0x2138, 0x2139, 0x213a, 0x213b, 0x213e, 0x213f, 0x217e, 0x2132, 0x2133, 0x213c, 0x213d, 0x2421, 0x2422, 0x2423, 0x2424, 0x2425, 0x2426, 0x2427, 0x2428, 0x2429, 0x242a, 0x242b, 0x242c, 0x242d, 0x242e, 0x242f, 0x2430, 0x2431, 0x2432, 0x2433, 0x2434, 0x2435, 0x2436, 0x2437, 0x2438, 0x2439, 0x243a, 0x243b, 0x243c, 0x243d, 0x243e, 0x243f, 0x2440, 0x2441, 0x2442, 0x2443, 0x2444, 0x2445, 0x2446, 0x2447, 0x2448, 0x2449, 0x244a, 0x244b, 0x244c, 0x244d, 0x244e, 0x244f, 0x2450, 0x2451, 0x2452, 0x2453, 0x2454, 0x2455, 0x2456, 0x2457, 0x2458, 0x2459, 0x245a, 0x245b, 0x245c, 0x245d, 0x245e, 0x245f, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, 0x2472, 0x2473, 0x2521, 0x2522, 0x2523, 0x2524, 0x2525, 0x2526, 0x2527, 0x2528, 0x2529, 0x252a, 0x252b, 0x252c, 0x252d, 0x252e, 0x252f, 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, 0x2535, 0x2536, 0x2537, 0x2538, 0x2539, 0x253a, 0x253b, 0x253c, 0x253d, 0x253e, 0x253f, 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, 0x254c, 0x254d, 0x254e, 0x254f, 0x2550, 0x2551, 0x2552, 0x2553, 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, 0x255e, 0x255f, 0x2560, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x256d, 0x256e, 0x256f, 0x2570, 0x2571, 0x2572, 0x2573, 0x2574, 0x2575, 0x2576, 0x2124, 0x2845, 0x2846, 0x2847, 0x2848, 0x2849, 0x284a, 0x284b, 0x284c, 0x284d, 0x284e, 0x284f, 0x2850, 0x2851, 0x2852, 0x2853, 0x2854, 0x2855, 0x2856, 0x2857, 0x2858, 0x2859, 0x285a, 0x285b, 0x285c, 0x285d, 0x285e, 0x285f, 0x2860, 0x2861, 0x2862, 0x2863, 0x2864, 0x2865, 0x2866, 0x2867, 0x2868, 0x2869, 0x2265, 0x2266, 0x2267, 0x2268, 0x2269, 0x226a, 0x226b, 0x226c, 0x226d, 0x226e, 0x523b, 0x3621, 0x465f, 0x4d72, 0x5549, 0x487d, 0x494f, 0x4f42, 0x5822, 0x323b, 0x536b, 0x5824, 0x3373, 0x5728, 0x4752, 0x5827, 0x4a40, 0x4770, 0x317b, 0x5235, 0x3454, 0x362b, 0x4b3f, 0x5829, 0x362a, 0x413d, 0x514f, 0x4925, 0x582d, 0x3876, 0x513e, 0x635c, 0x5650, 0x3761, 0x342e, 0x4159, 0x583c, 0x4d68, 0x3524, 0x4e2a, 0x5677, 0x4076, 0x3e59, 0x582f, 0x444b, 0x3e43, 0x5831, 0x4334, 0x5265, 0x562e, 0x4e5a, 0x5527, 0x3a75, 0x3726, 0x4056, 0x4639, 0x4552, 0x4747, 0x3954, 0x334b, 0x5252, 0x583f, 0x3e45, 0x4672, 0x5232, 0x4f30, 0x4f67, 0x4a69, 0x5840, 0x4272, 0x4252, 0x4869, 0x472c, 0x414b, 0x5368, 0x5579, 0x4a42, 0x367e, 0x5821, 0x535a, 0x3f77, 0x5446, 0x3b25, 0x5841, 0x4e65, 0x3e2e, 0x5828, 0x5147, 0x5029, 0x583d, 0x596f, 0x4d76, 0x3f3a, 0x3d3b, 0x3a25, 0x5260, 0x327a, 0x3a60, 0x4436, 0x4f6d, 0x3e29, 0x4d24, 0x4141, 0x4757, 0x5971, 0x5974, 0x484b, 0x5869, 0x525a, 0x4a32, 0x484a, 0x586c, 0x586a, 0x5846, 0x3d76, 0x464d, 0x3370, 0x586b, 0x3d71, 0x3d69, 0x4854, 0x3453, 0x4258, 0x3256, 0x5750, 0x4a4b, 0x4b7b, 0x554c, 0x3836, 0x4f49, 0x595a, 0x5870, 0x472a, 0x586e, 0x347a, 0x416e, 0x5254, 0x586d, 0x5247, 0x586f, 0x4347, 0x5176, 0x5659, 0x5872, 0x5875, 0x3c7e, 0x3c5b, 0x484e, 0x375d, 0x3742, 0x4673, 0x5878, 0x5241, 0x4e69, 0x3c3f, 0x377c, 0x3725, 0x505d, 0x565a, 0x5345, 0x3b6f, 0x3b61, 0x5871, 0x4921, 0x4e30, 0x342b, 0x5873, 0x494b, 0x5876, 0x4257, 0x5877, 0x4e31, 0x5879, 0x322e, 0x3940, 0x5923, 0x3069, 0x4166, 0x496c, 0x4b45, 0x4b46, 0x5924, 0x3568, 0x352b, 0x4e3b, 0x354d, 0x5721, 0x5774, 0x5353, 0x4c65, 0x3a4e, 0x5922, 0x595c, 0x5360, 0x587d, 0x3770, 0x5777, 0x587e, 0x587a, 0x5921, 0x4463, 0x5336, 0x5874, 0x595d, 0x587b, 0x4565, 0x4050, 0x5170, 0x305b, 0x3c51, 0x5926, 0x5925, 0x592c, 0x592e, 0x592b, 0x4a39, 0x5929, 0x5636, 0x335e, 0x5928, 0x407d, 0x4a4c, 0x592a, 0x5927, 0x5930, 0x3631, 0x3929, 0x5240, 0x4f40, 0x4242, 0x3d44, 0x556c, 0x3260, 0x4748, 0x3f6b, 0x592d, 0x592f, 0x4e6a, 0x3a6e, 0x4756, 0x3163, 0x3459, 0x366d, 0x5934, 0x3f21, 0x595e, 0x474e, 0x407e, 0x5938, 0x4b57, 0x377d, 0x5935, 0x5937, 0x3123, 0x5361, 0x5939, 0x5045, 0x5936, 0x5931, 0x5932, 0x4129, 0x5933, 0x3c73, 0x505e, 0x3829, 0x3e63, 0x593d, 0x593a, 0x3033, 0x5942, 0x5944, 0x3136, 0x593f, 0x3539, 0x3e73, 0x4c48, 0x3a72, 0x5250, 0x5943, 0x3d68, 0x332b, 0x5945, 0x3e6b, 0x5946, 0x593b, 0x445f, 0x593e, 0x5941, 0x5940, 0x552e, 0x5635, 0x4763, 0x5948, 0x3c59, 0x594a, 0x593c, 0x594b, 0x462b, 0x5949, 0x5776, 0x4d23, 0x3d21, 0x594c, 0x453c, 0x4d35, 0x594d, 0x5947, 0x3325, 0x3f7e, 0x3835, 0x407c, 0x3078, 0x3476, 0x594e, 0x594f, 0x3422, 0x5950, 0x345f, 0x3041, 0x5951, 0x4935, 0x4f71, 0x5952, 0x4145, 0x5956, 0x492e, 0x5955, 0x5954, 0x5957, 0x4b5b, 0x3d29, 0x4627, 0x5953, 0x5958, 0x5959, 0x4865, 0x405c, 0x3679, 0x5823, 0x544a, 0x542a, 0x5056, 0x3364, 0x5557, 0x4f48, 0x3962, 0x3f4b, 0x4362, 0x3652, 0x4d43, 0x596e, 0x5970, 0x3533, 0x3635, 0x3e24, 0x486b, 0x482b, 0x304b, 0x392b, 0x4179, 0x5962, 0x403c, 0x3932, 0x3958, 0x504b, 0x3178, 0x4664, 0x3e5f, 0x3564, 0x5748, 0x5178, 0x3c66, 0x4a5e, 0x3c3d, 0x5966, 0x5867, 0x445a, 0x3854, 0x483d, 0x3261, 0x5459, 0x4330, 0x4361, 0x5a22, 0x485f, 0x5034, 0x3e7c, 0x4529, 0x395a, 0x5a23, 0x5429, 0x5a24, 0x597b, 0x362c, 0x376b, 0x3179, 0x597c, 0x3365, 0x3e76, 0x3f76, 0x5231, 0x4064, 0x3633, 0x597e, 0x597d, 0x3e3b, 0x4660, 0x573c, 0x5a21, 0x4139, 0x3572, 0x4168, 0x3c75, 0x3455, 0x415d, 0x447d, 0x3c38, 0x3732, 0x376f, 0x596c, 0x463e, 0x3f2d, 0x3b4b, 0x354a, 0x5b49, 0x5057, 0x4d39, 0x303c, 0x3376, 0x3b77, 0x5b4a, 0x3a2f, 0x5464, 0x3536, 0x3573, 0x5856, 0x4850, 0x3756, 0x4750, 0x5857, 0x3f2f, 0x5b3b, 0x5858, 0x504c, 0x3b2e, 0x6b3e, 0x4150, 0x4175, 0x5472, 0x3855, 0x3434, 0x3375, 0x493e, 0x4550, 0x4559, 0x407b, 0x3170, 0x5859, 0x394e, 0x353d, 0x585a, 0x5646, 0x4b22, 0x482f, 0x4932, 0x344c, 0x3f4c, 0x3974, 0x585b, 0x585c, 0x3667, 0x3c41, 0x4c6a, 0x4f77, 0x585d, 0x4730, 0x3950, 0x3d23, 0x4c5e, 0x464a, 0x5860, 0x585e, 0x585f, 0x307e, 0x3e67, 0x4a23, 0x3c74, 0x3831, 0x386e, 0x5862, 0x3d4b, 0x5864, 0x5863, 0x457c, 0x5865, 0x5866, 0x4126, 0x4830, 0x306c, 0x3926, 0x3c53, 0x4e71, 0x5b3d, 0x4153, 0x362f, 0x567a, 0x452c, 0x3d59, 0x5b3e, 0x5b3f, 0x4078, 0x3e22, 0x404d, 0x5b40, 0x4a46, 0x322a, 0x5342, 0x4363, 0x512b, 0x5b42, 0x4055, 0x5b43, 0x3f31, 0x443c, 0x475a, 0x5b44, 0x5968, 0x4957, 0x3934, 0x4e70, 0x5448, 0x307c, 0x3452, 0x5059, 0x5969, 0x5e4b, 0x596b, 0x5830, 0x3b2f, 0x3131, 0x3357, 0x584e, 0x5451, 0x3d33, 0x3f6f, 0x4f3b, 0x5850, 0x374b, 0x5851, 0x4625, 0x4778, 0x523d, 0x5852, 0x4464, 0x4a2e, 0x4727, 0x5826, 0x497d, 0x4e67, 0x3b5c, 0x306b, 0x3b2a, 0x502d, 0x3130, 0x5764, 0x573f, 0x3525, 0x4274, 0x444f, 0x3229, 0x3237, 0x3165, 0x5f32, 0x553c, 0x3f28, 0x422c, 0x5855, 0x4231, 0x5854, 0x4e54, 0x5a60, 0x4e40, 0x5834, 0x432e, 0x5321, 0x4e23, 0x3c34, 0x4834, 0x4251, 0x3e6d, 0x5036, 0x5a61, 0x4764, 0x3327, 0x3672, 0x4c7c, 0x407a, 0x4077, 0x5139, 0x5161, 0x5847, 0x325e, 0x4065, 0x3a71, 0x5848, 0x542d, 0x4f61, 0x5849, 0x584a, 0x4f43, 0x3378, 0x3e47, 0x584b, 0x5b4c, 0x4825, 0x4f58, 0x487e, 0x324e, 0x5356, 0x3266, 0x3c30, 0x5351, 0x4b2b, 0x3734, 0x3722, 0x4a65, 0x4821, 0x4a5c, 0x3164, 0x5070, 0x4551, 0x5b45, 0x357e, 0x3f5a, 0x3945, 0x3e64, 0x416d, 0x5f36, 0x5f35, 0x563b, 0x3d50, 0x5559, 0x3048, 0x3623, 0x3f49, 0x4c28, 0x5f33, 0x4a37, 0x5352, 0x584f, 0x5236, 0x3a45, 0x4b3e, 0x4c3e, 0x5f37, 0x3570, 0x5f34, 0x5375, 0x3354, 0x3877, 0x5f3a, 0x3a4f, 0x3c2a, 0x3575, 0x4d2c, 0x437b, 0x3a73, 0x4074, 0x4d42, 0x4f72, 0x5f38, 0x4f45, 0x4240, 0x5f39, 0x4270, 0x3e7d, 0x415f, 0x4d4c, 0x5277, 0x374d, 0x5f41, 0x5f44, 0x3771, 0x3049, 0x3656, 0x3754, 0x3a2c, 0x4c7d, 0x3f54, 0x4b31, 0x4674, 0x5628, 0x5f45, 0x4e62, 0x3333, 0x4e7c, 0x3435, 0x4e47, 0x3a70, 0x4e61, 0x513d, 0x5f40, 0x3474, 0x334a, 0x3866, 0x5f3b, 0x4445, 0x5f3c, 0x5f3d, 0x5f3e, 0x453b, 0x5f3f, 0x5f42, 0x5431, 0x5f43, 0x473a, 0x4e58, 0x4458, 0x5f4a, 0x5f4f, 0x565c, 0x5f49, 0x5f5a, 0x4e36, 0x3a47, 0x5f4e, 0x5f48, 0x455e, 0x496b, 0x3a74, 0x437c, 0x3e57, 0x5f46, 0x5f4d, 0x4558, 0x5526, 0x3a4d, 0x3e4c, 0x533d, 0x3840, 0x5664, 0x5f47, 0x393e, 0x3f27, 0x417c, 0x5f4b, 0x5f4c, 0x5f50, 0x5f5b, 0x5f65, 0x5f57, 0x5f56, 0x5749, 0x5f63, 0x5f64, 0x656b, 0x5227, 0x5f52, 0x3f29, 0x545b, 0x3f48, 0x5f54, 0x4f4c, 0x5f5d, 0x514a, 0x5f5e, 0x3027, 0x4637, 0x5f53, 0x3a65, 0x365f, 0x4d5b, 0x397e, 0x5455, 0x5f5f, 0x4f6c, 0x3025, 0x5f67, 0x5f51, 0x5146, 0x5f55, 0x5f58, 0x5f59, 0x5f5c, 0x3b29, 0x5f60, 0x5f61, 0x5f62, 0x5f66, 0x5f68, 0x5334, 0x3867, 0x4536, 0x5f6a, 0x495a, 0x4128, 0x4444, 0x3f5e, 0x4f78, 0x555c, 0x5f6e, 0x3238, 0x3a5f, 0x5f6c, 0x5b41, 0x5164, 0x4b74, 0x343d, 0x3026, 0x5f71, 0x4c46, 0x5f72, 0x5f6d, 0x5f69, 0x5f6b, 0x5f6f, 0x5f70, 0x3b3d, 0x5f73, 0x5f74, 0x3b23, 0x4a5b, 0x4e28, 0x6027, 0x332a, 0x6026, 0x6021, 0x5f7e, 0x4d59, 0x5f7c, 0x5f7a, 0x3f50, 0x5744, 0x494c, 0x5f78, 0x3021, 0x5f7d, 0x5f7b, 0x6022, 0x6028, 0x3748, 0x4621, 0x4936, 0x4032, 0x5f75, 0x453e, 0x5844, 0x5f79, 0x4476, 0x6023, 0x6024, 0x6025, 0x5025, 0x6034, 0x4c64, 0x6031, 0x3f26, 0x602f, 0x4e39, 0x602b, 0x4946, 0x402e, 0x602e, 0x3a6d, 0x3a30, 0x6029, 0x5f76, 0x6033, 0x6038, 0x342d, 0x6039, 0x4f32, 0x3a48, 0x6030, 0x507a, 0x602c, 0x547b, 0x5f77, 0x4567, 0x602d, 0x5377, 0x6036, 0x6037, 0x6044, 0x5061, 0x603c, 0x6049, 0x604a, 0x603e, 0x602a, 0x4924, 0x6041, 0x6032, 0x4a48, 0x6043, 0x6035, 0x4e4b, 0x4b43, 0x604d, 0x6046, 0x6042, 0x604b, 0x603a, 0x603f, 0x6040, 0x6045, 0x6047, 0x6048, 0x604c, 0x603b, 0x4b54, 0x6055, 0x6056, 0x6052, 0x6050, 0x3c4e, 0x6051, 0x3842, 0x5845, 0x506a, 0x426f, 0x604f, 0x603d, 0x6054, 0x6053, 0x6057, 0x605c, 0x6058, 0x5676, 0x3330, 0x576c, 0x4b3b, 0x605a, 0x4e7b, 0x3a59, 0x6061, 0x605d, 0x522d, 0x6062, 0x605b, 0x6059, 0x605f, 0x6060, 0x605e, 0x6064, 0x4677, 0x582c, 0x546b, 0x6066, 0x4a49, 0x6065, 0x3841, 0x6067, 0x6068, 0x6069, 0x6063, 0x3a3f, 0x4c67, 0x606a, 0x4f79, 0x606b, 0x4842, 0x3d40, 0x4452, 0x606c, 0x606d, 0x4774, 0x4b44, 0x606e, 0x3b58, 0x5836, 0x5272, 0x606f, 0x4d45, 0x365a, 0x6071, 0x5430, 0x4027, 0x3451, 0x4e27, 0x6070, 0x6072, 0x394c, 0x397a, 0x4d3c, 0x6073, 0x4654, 0x6074, 0x5432, 0x4826, 0x6076, 0x6075, 0x6077, 0x4d41, 0x4a25, 0x545a, 0x5b57, 0x5b59, 0x5b58, 0x3967, 0x5b5c, 0x5b5d, 0x3558, 0x5b5a, 0x5b5b, 0x3321, 0x5b5f, 0x3b78, 0x5637, 0x5b60, 0x3e79, 0x373b, 0x5b50, 0x4c2e, 0x3f32, 0x3b35, 0x5778, 0x3f53, 0x3f69, 0x3c61, 0x4c33, 0x5b5e, 0x3053, 0x4e6b, 0x3758, 0x5739, 0x4642, 0x4024, 0x4c39, 0x5b67, 0x5b61, 0x463a, 0x5b63, 0x5b68, 0x4577, 0x5b6a, 0x5b69, 0x3f40, 0x5b66, 0x5b65, 0x3439, 0x402c, 0x4222, 0x5b62, 0x5b64, 0x504d, 0x5b6d, 0x405d, 0x5b72, 0x3662, 0x5b73, 0x5b52, 0x3938, 0x542b, 0x5b6c, 0x3f51, 0x5b70, 0x5b51, 0x3566, 0x5b6b, 0x3f65, 0x5b6e, 0x5b71, 0x5b79, 0x3921, 0x3023, 0x4271, 0x3347, 0x5b6f, 0x5b78, 0x4652, 0x5b74, 0x5b75, 0x5b77, 0x5b76, 0x5b7e, 0x5372, 0x323a, 0x5b7d, 0x5c24, 0x5b7b, 0x5b7a, 0x5b7c, 0x4560, 0x3b79, 0x5c23, 0x5c25, 0x4c43, 0x3651, 0x5d40, 0x5c21, 0x5c22, 0x4735, 0x3669, 0x5c27, 0x5c26, 0x5c29, 0x3124, 0x354c, 0x3f30, 0x515f, 0x3642, 0x5c28, 0x4b7a, 0x6b73, 0x4b5c, 0x4b7e, 0x4c41, 0x487b, 0x5c2a, 0x4c6e, 0x5c2b, 0x5b53, 0x5c2f, 0x5c2c, 0x3e33, 0x4a7b, 0x5c2d, 0x494a, 0x4439, 0x473d, 0x5c2e, 0x5476, 0x5066, 0x442b, 0x3655, 0x5b54, 0x315a, 0x5b55, 0x5b56, 0x3a3e, 0x4840, 0x4a3f, 0x4849, 0x5733, 0x4979, 0x3f47, 0x3a78, 0x523c, 0x623a, 0x3426, 0x3138, 0x3834, 0x4f44, 0x5967, 0x4f26, 0x4d62, 0x596d, 0x3660, 0x5239, 0x393b, 0x6239, 0x6237, 0x3473, 0x4c6c, 0x4c2b, 0x3772, 0x5832, 0x516b, 0x3a3b, 0x4a27, 0x4d37, 0x5244, 0x3f64, 0x3c50, 0x3661, 0x5e45, 0x5e46, 0x5b3c, 0x5159, 0x4666, 0x444e, 0x376e, 0x375c, 0x3f7c, 0x5760, 0x4675, 0x313c, 0x5e48, 0x3d31, 0x4c57, 0x5e4a, 0x5e49, 0x356c, 0x495d, 0x3042, 0x452e, 0x452b, 0x444c, 0x3c69, 0x4b7d, 0x3a43, 0x6579, 0x4867, 0x657a, 0x4d7d, 0x5731, 0x383e, 0x4268, 0x4851, 0x657b, 0x364a, 0x3c4b, 0x517d, 0x6621, 0x436e, 0x6624, 0x657e, 0x6625, 0x4d57, 0x3741, 0x657c, 0x657d, 0x6623, 0x445d, 0x6628, 0x6627, 0x4343, 0x465e, 0x662a, 0x4437, 0x6622, 0x4a3c, 0x3d63, 0x3943, 0x6626, 0x5055, 0x4e2f, 0x6629, 0x6630, 0x5226, 0x3d2a, 0x662d, 0x662f, 0x4051, 0x524c, 0x3c27, 0x6631, 0x5276, 0x574b, 0x4d7e, 0x4d5e, 0x4226, 0x662b, 0x662c, 0x3d3f, 0x662e, 0x6633, 0x6632, 0x6636, 0x6638, 0x446f, 0x4448, 0x3e6a, 0x496f, 0x6637, 0x3670, 0x4364, 0x5369, 0x6634, 0x6635, 0x4822, 0x663d, 0x6639, 0x4645, 0x4d71, 0x663b, 0x663c, 0x3b69, 0x663e, 0x663a, 0x4037, 0x5324, 0x663f, 0x4974, 0x6643, 0x6644, 0x5076, 0x433d, 0x4344, 0x6642, 0x6641, 0x6647, 0x4f31, 0x6b74, 0x664a, 0x6645, 0x3c5e, 0x4929, 0x3c35, 0x4f53, 0x6648, 0x6649, 0x664e, 0x6650, 0x6651, 0x664b, 0x3555, 0x664c, 0x664f, 0x445b, 0x6646, 0x664d, 0x6652, 0x6654, 0x6653, 0x6655, 0x5978, 0x6656, 0x6657, 0x5753, 0x665d, 0x665e, 0x3f57, 0x5450, 0x5756, 0x3466, 0x4b6f, 0x665a, 0x5843, 0x574e, 0x5022, 0x434f, 0x665f, 0x3c3e, 0x3942, 0x665b, 0x5127, 0x3a22, 0x424f, 0x582b, 0x4a6b, 0x656e, 0x665c, 0x3775, 0x4866, 0x4475, 0x6532, 0x447e, 0x4b7c, 0x6533, 0x552c, 0x536e, 0x4a58, 0x3032, 0x4b4e, 0x4d6a, 0x3a6a, 0x6535, 0x6534, 0x575a, 0x3959, 0x5666, 0x3628, 0x4d70, 0x524b, 0x3126, 0x4a35, 0x3368, 0x4973, 0x3f4d, 0x507b, 0x4a52, 0x6536, 0x3b42, 0x4f5c, 0x392c, 0x5457, 0x3a26, 0x5167, 0x4f7c, 0x3c52, 0x6537, 0x485d, 0x3f6d, 0x3176, 0x4b5e, 0x3c45, 0x3c44, 0x527a, 0x435c, 0x3f5c, 0x383b, 0x4342, 0x3a2e, 0x5422, 0x475e, 0x442f, 0x326c, 0x3951, 0x653b, 0x4148, 0x552f, 0x653c, 0x653e, 0x3467, 0x3654, 0x4b42, 0x5130, 0x353c, 0x4a59, 0x3762, 0x4964, 0x3d2b, 0x4e3e, 0x5770, 0x5021, 0x4959, 0x367b, 0x6658, 0x3c62, 0x333e, 0x4950, 0x6659, 0x3322, 0x5e4c, 0x5348, 0x5e4d, 0x5222, 0x5e4e, 0x3e4d, 0x5e4f, 0x4a2c, 0x527c, 0x335f, 0x656a, 0x4461, 0x3e21, 0x4e32, 0x4472, 0x3e56, 0x4628, 0x3263, 0x3e53, 0x477c, 0x4c6b, 0x3d6c, 0x4e5d, 0x4a3a, 0x4641, 0x656c, 0x503c, 0x5539, 0x656d, 0x4a74, 0x4d40, 0x4245, 0x656f, 0x4244, 0x6570, 0x6578, 0x4d4d, 0x493d, 0x5259, 0x6128, 0x536c, 0x4b6a, 0x4671, 0x612c, 0x6127, 0x6129, 0x612a, 0x612f, 0x326d, 0x612b, 0x385a, 0x612d, 0x612e, 0x6130, 0x353a, 0x6131, 0x6133, 0x6138, 0x5152, 0x6136, 0x6135, 0x416b, 0x6137, 0x5440, 0x6132, 0x613a, 0x3036, 0x6134, 0x3f79, 0x6139, 0x613b, 0x613e, 0x613c, 0x5645, 0x4f3f, 0x613d, 0x613f, 0x424d, 0x366b, 0x5378, 0x474d, 0x3765, 0x3e7e, 0x6140, 0x6141, 0x6147, 0x3367, 0x4669, 0x345e, 0x5142, 0x6148, 0x6146, 0x6145, 0x6143, 0x6142, 0x3140, 0x5538, 0x6144, 0x614b, 0x614c, 0x614a, 0x6f7a, 0x6153, 0x6152, 0x4736, 0x6149, 0x614e, 0x6150, 0x6154, 0x6151, 0x614d, 0x614f, 0x6155, 0x6156, 0x6157, 0x6158, 0x615a, 0x615b, 0x4e21, 0x675d, 0x3428, 0x565d, 0x5132, 0x3332, 0x3924, 0x5773, 0x4749, 0x3e5e, 0x392e, 0x4e57, 0x326e, 0x5b4f, 0x3c3a, 0x5251, 0x4b48, 0x304d, 0x4f6f, 0x5963, 0x3d6d, 0x3152, 0x4a50, 0x323c, 0x4b27, 0x372b, 0x4a26, 0x4f23, 0x6078, 0x554a, 0x607b, 0x607a, 0x4541, 0x4c7b, 0x4131, 0x6079, 0x5663, 0x322f, 0x5644, 0x355b, 0x3478, 0x5621, 0x4f2f, 0x306f, 0x607c, 0x6121, 0x3323, 0x607d, 0x607e, 0x4331, 0x435d, 0x6122, 0x3779, 0x3b4f, 0x6123, 0x443b, 0x6124, 0x6125, 0x6126, 0x3431, 0x3849, 0x463d, 0x446a, 0x3222, 0x5052, 0x675b, 0x3b43, 0x5357, 0x5344, 0x3963, 0x624f, 0x572f, 0x476c, 0x3153, 0x3432, 0x6251, 0x5072, 0x422e, 0x6250, 0x3f62, 0x5326, 0x3557, 0x6252, 0x356a, 0x436d, 0x387d, 0x382e, 0x4553, 0x374f, 0x6254, 0x6253, 0x3648, 0x5779, 0x4d25, 0x6258, 0x6256, 0x4a7c, 0x3f35, 0x5339, 0x6255, 0x6257, 0x412e, 0x4048, 0x625b, 0x625a, 0x402a, 0x414e, 0x625c, 0x625d, 0x625e, 0x5b48, 0x5153, 0x4d22, 0x3d28, 0x5e43, 0x5825, 0x3f2a, 0x5b4d, 0x526c, 0x467a, 0x452a, 0x5e44, 0x3157, 0x5f2e, 0x4a3d, 0x5f31, 0x392d, 0x527d, 0x3825, 0x3a6b, 0x335a, 0x355c, 0x5545, 0x4356, 0x4f52, 0x3b21, 0x6573, 0x6572, 0x6574, 0x4d64, 0x4875, 0x352f, 0x473f, 0x6576, 0x6c30, 0x6566, 0x3969, 0x3531, 0x423c, 0x6568, 0x6567, 0x6569, 0x524d, 0x616a, 0x504e, 0x4d2e, 0x5165, 0x324a, 0x316b, 0x3172, 0x456d, 0x5543, 0x5330, 0x615c, 0x615d, 0x525b, 0x3339, 0x314b, 0x4d79, 0x5577, 0x615e, 0x3e36, 0x347d, 0x615f, 0x3a5c, 0x6160, 0x3b32, 0x4249, 0x6161, 0x506c, 0x4d3d, 0x6162, 0x3543, 0x4547, 0x6163, 0x6164, 0x5379, 0x6165, 0x512d, 0x6166, 0x4e22, 0x6167, 0x3542, 0x6168, 0x3b55, 0x5044, 0x6260, 0x3158, 0x5264, 0x6261, 0x3c49, 0x484c, 0x6263, 0x6c7e, 0x6c7d, 0x5f2f, 0x6262, 0x563e, 0x4d7c, 0x4326, 0x6343, 0x5652, 0x6267, 0x6268, 0x5347, 0x626c, 0x3f6c, 0x626d, 0x6265, 0x3340, 0x446e, 0x626e, 0x5043, 0x3a76, 0x6269, 0x375e, 0x3b33, 0x4c2c, 0x4b4b, 0x6264, 0x6266, 0x626a, 0x626b, 0x6277, 0x6274, 0x5475, 0x6273, 0x452d, 0x557a, 0x4542, 0x3240, 0x626f, 0x6272, 0x412f, 0x4b3c, 0x3521, 0x6279, 0x3c31, 0x6271, 0x5054, 0x5439, 0x6275, 0x3956, 0x6276, 0x4753, 0x6270, 0x575c, 0x6d21, 0x6278, 0x6d25, 0x627e, 0x4a51, 0x4135, 0x3b50, 0x3f56, 0x3a63, 0x4b21, 0x6d26, 0x6d23, 0x6d22, 0x3b56, 0x6d27, 0x5074, 0x6d24, 0x3a5e, 0x3677, 0x6321, 0x3632, 0x4c71, 0x3927, 0x4f22, 0x4721, 0x3f52, 0x3671, 0x627a, 0x627b, 0x627d, 0x627c, 0x4455, 0x6322, 0x5341, 0x6327, 0x4744, 0x4f24, 0x6329, 0x3a37, 0x6328, 0x3b5a, 0x6323, 0x6324, 0x632a, 0x6326, 0x4e72, 0x5346, 0x3b3c, 0x5443, 0x447a, 0x6d28, 0x507c, 0x6325, 0x4375, 0x632d, 0x312f, 0x6332, 0x3c42, 0x632c, 0x353f, 0x4769, 0x6330, 0x3e2a, 0x4d6f, 0x3b73, 0x4c68, 0x632f, 0x6331, 0x4f27, 0x632e, 0x4e29, 0x3b5d, 0x356b, 0x3e65, 0x3252, 0x334d, 0x3139, 0x632b, 0x3251, 0x352c, 0x395f, 0x3668, 0x4f6b, 0x6337, 0x3b4c, 0x4847, 0x504a, 0x6338, 0x336e, 0x6d29, 0x537a, 0x5364, 0x6d2a, 0x6339, 0x5262, 0x6335, 0x535e, 0x3850, 0x6333, 0x6336, 0x375f, 0x6334, 0x4022, 0x633a, 0x5438, 0x3448, 0x633b, 0x3b45, 0x4977, 0x4965, 0x443d, 0x6d2b, 0x427d, 0x3b5b, 0x3f2e, 0x4e3f, 0x633c, 0x3f36, 0x316f, 0x5477, 0x633e, 0x6d2d, 0x633f, 0x3a29, 0x6d2c, 0x633d, 0x6340, 0x3a36, 0x362e, 0x5038, 0x3043, 0x6d2e, 0x6d2f, 0x4041, 0x6341, 0x4533, 0x6342, 0x5c32, 0x6d30, 0x386a, 0x4e6c, 0x6a27, 0x5067, 0x4a79, 0x4856, 0x4f37, 0x3349, 0x4e52, 0x3d64, 0x635e, 0x3b72, 0x6a28, 0x553d, 0x465d, 0x6a29, 0x6a2a, 0x6a2c, 0x6a2b, 0x6a2e, 0x6a2d, 0x3d58, 0x6a2f, 0x423e, 0x3441, 0x3477, 0x3b27, 0x6c66, 0x6c65, 0x373f, 0x4b79, 0x3162, 0x6c67, 0x4948, 0x6c68, 0x6c69, 0x4a56, 0x5e50, 0x3245, 0x547a, 0x464b, 0x3047, 0x3472, 0x4853, 0x4d50, 0x3f38, 0x3f5b, 0x4724, 0x5634, 0x4029, 0x5e51, 0x4928, 0x516f, 0x4524, 0x3067, 0x3336, 0x4845, 0x3062, 0x3776, 0x457a, 0x3673, 0x5552, 0x3350, 0x3c3c, 0x332d, 0x3e71, 0x3051, 0x5256, 0x4a63, 0x5725, 0x4d36, 0x3636, 0x3f39, 0x555b, 0x3827, 0x4557, 0x5e52, 0x3f59, 0x4255, 0x4740, 0x3b24, 0x3128, 0x456a, 0x457b, 0x4c27, 0x3127, 0x3556, 0x4428, 0x5e53, 0x513a, 0x3369, 0x4372, 0x3777, 0x5674, 0x3523, 0x3270, 0x4434, 0x4469, 0x402d, 0x5e54, 0x3068, 0x4544, 0x4160, 0x3955, 0x3e5c, 0x4d58, 0x304e, 0x4d4f, 0x5e56, 0x3e50, 0x573e, 0x5e55, 0x5550, 0x305d, 0x4462, 0x4223, 0x3c70, 0x5335, 0x4039, 0x4521, 0x3226, 0x5471, 0x4028, 0x4a43, 0x5e57, 0x557c, 0x3930, 0x482d, 0x4b29, 0x5e59, 0x3f3d, 0x4634, 0x5727, 0x4a30, 0x4443, 0x3356, 0x3952, 0x5638, 0x6a7c, 0x3034, 0x3f66, 0x4c74, 0x4d5a, 0x563f, 0x424e, 0x4e4e, 0x4c22, 0x502e, 0x4453, 0x3532, 0x5e58, 0x5575, 0x3c37, 0x3b53, 0x3024, 0x4532, 0x346c, 0x5571, 0x6a7d, 0x5e5a, 0x4d26, 0x4d6c, 0x4e66, 0x5e5c, 0x4d31, 0x4026, 0x573d, 0x5e5b, 0x3046, 0x3a34, 0x4953, 0x4473, 0x3e68, 0x3236, 0x404c, 0x4b70, 0x3c71, 0x3b3b, 0x3537, 0x4575, 0x5e66, 0x5e63, 0x3e5d, 0x5e5f, 0x3437, 0x3d5d, 0x5e60, 0x446d, 0x4f46, 0x3560, 0x365e, 0x4a5a, 0x3574, 0x5e65, 0x5546, 0x5e61, 0x4c4d, 0x467e, 0x4545, 0x5234, 0x3e72, 0x4253, 0x4c3d, 0x3338, 0x3d53, 0x3f58, 0x4d46, 0x515a, 0x346b, 0x5e64, 0x5e5d, 0x5e67, 0x6a7e, 0x4230, 0x5e62, 0x5640, 0x3527, 0x3274, 0x5e68, 0x5e72, 0x5e6d, 0x5e71, 0x4860, 0x5761, 0x5e6f, 0x4368, 0x4c61, 0x3265, 0x523e, 0x5e6e, 0x5e6b, 0x4e55, 0x3427, 0x3f2b, 0x3e3e, 0x3d52, 0x5e69, 0x542e, 0x5e5e, 0x5e6a, 0x403f, 0x5e6c, 0x3273, 0x3869, 0x4227, 0x3d41, 0x5e75, 0x5e78, 0x322b, 0x3424, 0x346a, 0x4926, 0x5e76, 0x4b51, 0x3863, 0x5e77, 0x5e7a, 0x5e79, 0x4c42, 0x3061, 0x346e, 0x653a, 0x502f, 0x326b, 0x6b21, 0x5e74, 0x4963, 0x5e73, 0x305a, 0x5221, 0x3177, 0x4c2f, 0x5e70, 0x4b24, 0x552a, 0x5e7b, 0x345d, 0x4426, 0x5e7d, 0x437e, 0x4421, 0x5f21, 0x414c, 0x5e7c, 0x3e6f, 0x4632, 0x3345, 0x4876, 0x4b3a, 0x5e7e, 0x5f24, 0x5732, 0x3337, 0x4143, 0x474b, 0x3225, 0x3469, 0x572b, 0x446c, 0x5f22, 0x5f23, 0x5f25, 0x3a33, 0x5f26, 0x405e, 0x4943, 0x3259, 0x4766, 0x5f27, 0x475c, 0x5f28, 0x6b22, 0x4b53, 0x5f2a, 0x5f29, 0x3241, 0x454a, 0x5f2b, 0x545c, 0x4841, 0x5f2c, 0x3e70, 0x5f2d, 0x5627, 0x6a37, 0x6b36, 0x4a55, 0x587c, 0x3844, 0x3925, 0x3745, 0x557e, 0x394a, 0x5027, 0x744d, 0x3550, 0x4374, 0x3e48, 0x6b37, 0x303d, 0x3d4c, 0x4132, 0x3156, 0x3328, 0x3852, 0x4922, 0x3658, 0x6b38, 0x3e34, 0x4a7d, 0x4743, 0x557b, 0x3773, 0x4e44, 0x552b, 0x3173, 0x6c33, 0x305f, 0x6c35, 0x3637, 0x414f, 0x757a, 0x5031, 0x5565, 0x4e53, 0x3d6f, 0x3362, 0x382b, 0x5536, 0x6d3d, 0x364f, 0x4b39, 0x5042, 0x373d, 0x6c36, 0x4a29, 0x4554, 0x6c39, 0x6c38, 0x4243, 0x6c37, 0x507d, 0x6c3a, 0x6c3b, 0x5765, 0x6c3c, 0x6c3d, 0x466c, 0x4e5e, 0x3c48, 0x4855, 0x3529, 0x3e49, 0x563c, 0x5467, 0x512e, 0x5071, 0x6a38, 0x6a39, 0x6a3a, 0x3a35, 0x4a31, 0x3f75, 0x4d7a, 0x6a40, 0x303a, 0x6a3e, 0x4025, 0x6a3b, 0x327d, 0x4377, 0x3b68, 0x5257, 0x4e74, 0x6a3f, 0x6a3c, 0x6a43, 0x5047, 0x5333, 0x343a, 0x4341, 0x5772, 0x5551, 0x4a47, 0x6a45, 0x6a44, 0x6a47, 0x6a46, 0x5667, 0x4f54, 0x6a4b, 0x3b4e, 0x3d7a, 0x494e, 0x6a4c, 0x4939, 0x4f7e, 0x6a4a, 0x544e, 0x6a4d, 0x6a4f, 0x4d6d, 0x6a49, 0x6a4e, 0x4e6e, 0x3b5e, 0x333f, 0x4655, 0x3e30, 0x4e7a, 0x4767, 0x3e27, 0x6a50, 0x5647, 0x4140, 0x545d, 0x6a51, 0x4f3e, 0x6a52, 0x4a6e, 0x452f, 0x3035, 0x6a54, 0x6a53, 0x745f, 0x443a, 0x3129, 0x655f, 0x6a55, 0x4a6f, 0x6a56, 0x6a57, 0x4658, 0x6a58, 0x6a59, 0x543b, 0x477a, 0x5237, 0x387c, 0x6a42, 0x325c, 0x427c, 0x5478, 0x4c66, 0x576e, 0x5442, 0x5350, 0x6b43, 0x4573, 0x377e, 0x6b54, 0x4b37, 0x6b5e, 0x404a, 0x4d7b, 0x332f, 0x465a, 0x6b7c, 0x443e, 0x4e34, 0x4429, 0x313e, 0x547d, 0x4a75, 0x566c, 0x4653, 0x3664, 0x3b7a, 0x5060, 0x4931, 0x5453, 0x4828, 0x384b, 0x683e, 0x493c, 0x683b, 0x406e, 0x5053, 0x3244, 0x3465, 0x683c, 0x5548, 0x3645, 0x683d, 0x4a78, 0x385c, 0x4c75, 0x4034, 0x516e, 0x683f, 0x6842, 0x3a3c, 0x312d, 0x3d5c, 0x6a3d, 0x6843, 0x6846, 0x684b, 0x684c, 0x4b49, 0x3065, 0x3c2b, 0x3939, 0x6841, 0x4d77, 0x684a, 0x4e76, 0x556d, 0x4156, 0x6844, 0x4336, 0x397b, 0x5626, 0x6848, 0x4a60, 0x5466, 0x6840, 0x6845, 0x6847, 0x4739, 0x3763, 0x6849, 0x3f5d, 0x6852, 0x6857, 0x6855, 0x3c5c, 0x3c4f, 0x685b, 0x685e, 0x685a, 0x317a, 0x3058, 0x4433, 0x384c, 0x4662, 0x483e, 0x4861, 0x684f, 0x6854, 0x6856, 0x3971, 0x6858, 0x5775, 0x447b, 0x685c, 0x3269, 0x6851, 0x3c6d, 0x3f42, 0x684d, 0x5679, 0x4178, 0x3271, 0x685f, 0x4a41, 0x6859, 0x5524, 0x316a, 0x553b, 0x684e, 0x6850, 0x3630, 0x6853, 0x685d, 0x4038, 0x4a77, 0x4b28, 0x465c, 0x4075, 0x6869, 0x5023, 0x6872, 0x566a, 0x6860, 0x6861, 0x5179, 0x3a4b, 0x3879, 0x3871, 0x5454, 0x686f, 0x686e, 0x686c, 0x3970, 0x4c52, 0x6866, 0x4e26, 0x3f72, 0x3038, 0x6871, 0x6870, 0x5740, 0x6864, 0x4d29, 0x4923, 0x3b38, 0x3d5b, 0x686a, 0x6862, 0x6863, 0x6865, 0x3535, 0x6867, 0x4745, 0x686b, 0x686d, 0x3d30, 0x572e, 0x6878, 0x6875, 0x4d30, 0x6876, 0x413a, 0x6868, 0x4337, 0x3070, 0x6874, 0x6877, 0x3923, 0x4952, 0x434e, 0x4e60, 0x4066, 0x4b73, 0x4c5d, 0x5035, 0x4a61, 0x6873, 0x3c6c, 0x6879, 0x435e, 0x4665, 0x3977, 0x3074, 0x5758, 0x3c2c, 0x456f, 0x4c44, 0x6926, 0x492d, 0x6922, 0x4062, 0x3f43, 0x687e, 0x3957, 0x687b, 0x6924, 0x524e, 0x6923, 0x5632, 0x5735, 0x6927, 0x3d37, 0x687c, 0x687d, 0x6921, 0x4d56, 0x522c, 0x6932, 0x6929, 0x342a, 0x343b, 0x692b, 0x5028, 0x6925, 0x337e, 0x692c, 0x4063, 0x692a, 0x6939, 0x6938, 0x692e, 0x687a, 0x6928, 0x3f2c, 0x6931, 0x693a, 0x4225, 0x692f, 0x3845, 0x692d, 0x535c, 0x6934, 0x6935, 0x6937, 0x6947, 0x4046, 0x6945, 0x6930, 0x693b, 0x3071, 0x693c, 0x5525, 0x693e, 0x693f, 0x6941, 0x4171, 0x4836, 0x693d, 0x6942, 0x6943, 0x6933, 0x6936, 0x3b31, 0x6940, 0x3c77, 0x6944, 0x6946, 0x694a, 0x694e, 0x325b, 0x6948, 0x372e, 0x694b, 0x694c, 0x5541, 0x4423, 0x6958, 0x3a61, 0x6949, 0x5323, 0x6954, 0x6957, 0x6950, 0x694f, 0x4741, 0x6952, 0x6959, 0x3348, 0x6953, 0x4f70, 0x694d, 0x3377, 0x6956, 0x695a, 0x4c34, 0x4f2d, 0x6955, 0x695c, 0x695b, 0x695e, 0x6951, 0x695d, 0x695f, 0x434a, 0x4737, 0x344e, 0x3b36, 0x5040, 0x6c23, 0x4537, 0x537b, 0x6c24, 0x6c25, 0x465b, 0x3f6e, 0x6c26, 0x6c27, 0x502a, 0x4738, 0x3868, 0x6c28, 0x5639, 0x557d, 0x344b, 0x323d, 0x4e64, 0x4667, 0x4d61, 0x3475, 0x4b40, 0x3c5f, 0x6962, 0x6963, 0x516a, 0x6965, 0x3479, 0x6964, 0x5133, 0x4a62, 0x3250, 0x6968, 0x6966, 0x6967, 0x5633, 0x6969, 0x696a, 0x696b, 0x696c, 0x6c2f, 0x4539, 0x364e, 0x5273, 0x356e, 0x3b59, 0x6c31, 0x5263, 0x4e63, 0x4438, 0x433f, 0x363e, 0x5839, 0x3148, 0x314f, 0x3151, 0x457e, 0x3150, 0x432b, 0x5531, 0x6b24, 0x3a41, 0x4c3a, 0x6b25, 0x6b27, 0x6b28, 0x6b26, 0x6b29, 0x6b2b, 0x6b2a, 0x6b2c, 0x4a4f, 0x5835, 0x4371, 0x4325, 0x4678, 0x6b2d, 0x444a, 0x6b2e, 0x6b2f, 0x6b30, 0x3755, 0x377a, 0x6b31, 0x4762, 0x6b33, 0x3a24, 0x5175, 0x3031, 0x6b32, 0x6b34, 0x352a, 0x4248, 0x4768, 0x6b35, 0x4b2e, 0x635f, 0x5340, 0x595b, 0x4d21, 0x562d, 0x4773, 0x5960, 0x3b63, 0x3a3a, 0x6362, 0x4f2b, 0x6360, 0x4947, 0x3a39, 0x5134, 0x6361, 0x486a, 0x392f, 0x3d2d, 0x3358, 0x4e5b, 0x4c40, 0x6368, 0x6369, 0x4d74, 0x4c2d, 0x3c33, 0x636a, 0x636b, 0x505a, 0x467b, 0x375a, 0x475f, 0x524a, 0x4e56, 0x6364, 0x636c, 0x4972, 0x3341, 0x6367, 0x4663, 0x6365, 0x6d33, 0x6366, 0x4933, 0x4566, 0x3935, 0x433b, 0x6363, 0x453d, 0x4124, 0x4259, 0x3257, 0x636d, 0x3b26, 0x442d, 0x6370, 0x3e5a, 0x637b, 0x6375, 0x3a53, 0x3750, 0x534d, 0x564e, 0x5553, 0x3941, 0x5534, 0x5158, 0x5039, 0x4776, 0x482a, 0x3234, 0x435a, 0x636e, 0x637c, 0x636f, 0x3728, 0x6377, 0x6374, 0x373a, 0x4522, 0x6376, 0x455d, 0x3228, 0x467c, 0x4460, 0x5722, 0x4061, 0x6379, 0x637a, 0x637d, 0x4c29, 0x6373, 0x533e, 0x3143, 0x6d34, 0x6371, 0x6372, 0x6378, 0x503a, 0x4643, 0x5473, 0x637e, 0x3d60, 0x6427, 0x6426, 0x5173, 0x6423, 0x6429, 0x4877, 0x4f34, 0x6428, 0x642e, 0x4265, 0x3634, 0x3d72, 0x6422, 0x3a69, 0x642a, 0x642c, 0x367d, 0x565e, 0x6432, 0x642d, 0x6421, 0x3b6e, 0x4d5d, 0x4722, 0x4549, 0x4177, 0x6424, 0x4733, 0x3d2c, 0x3d3d, 0x6425, 0x5747, 0x3262, 0x642b, 0x3c43, 0x642f, 0x3b6b, 0x6430, 0x4528, 0x6431, 0x5563, 0x3f23, 0x643a, 0x6437, 0x643b, 0x643d, 0x4656, 0x3a46, 0x404b, 0x3821, 0x6434, 0x5421, 0x3a23, 0x3d7e, 0x643c, 0x4d3f, 0x4479, 0x4f7b, 0x4966, 0x533f, 0x4f51, 0x6433, 0x6438, 0x6439, 0x4c69, 0x4c4e, 0x4054, 0x6435, 0x4130, 0x6436, 0x4e50, 0x3b41, 0x3553, 0x4873, 0x3d27, 0x5547, 0x492c, 0x3822, 0x644a, 0x644c, 0x5144, 0x523a, 0x3a2d, 0x3a54, 0x6443, 0x356d, 0x574d, 0x6440, 0x4f7d, 0x643f, 0x415c, 0x4c4a, 0x4a67, 0x4457, 0x4c54, 0x6448, 0x6447, 0x6441, 0x6444, 0x352d, 0x5359, 0x6446, 0x5279, 0x3463, 0x3b34, 0x496e, 0x343e, 0x3b6c, 0x514d, 0x4c6d, 0x6d35, 0x4765, 0x5428, 0x644b, 0x5755, 0x6442, 0x3d25, 0x6445, 0x5366, 0x6449, 0x4978, 0x643e, 0x5365, 0x477e, 0x3649, 0x547c, 0x3233, 0x6457, 0x4e42, 0x644d, 0x4e3c, 0x385b, 0x6456, 0x3f4a, 0x534e, 0x436c, 0x4548, 0x6458, 0x4d44, 0x644f, 0x6454, 0x6455, 0x3a7e, 0x4f66, 0x553f, 0x6452, 0x6450, 0x644e, 0x4d65, 0x4a2a, 0x4023, 0x3d26, 0x6453, 0x3848, 0x6467, 0x5434, 0x645b, 0x416f, 0x6469, 0x5267, 0x645f, 0x6460, 0x4f2a, 0x4b5d, 0x645a, 0x6451, 0x6465, 0x485c, 0x6463, 0x4467, 0x6462, 0x6461, 0x337c, 0x6468, 0x3561, 0x574c, 0x6466, 0x3b2c, 0x5752, 0x4c4f, 0x6b78, 0x6464, 0x3976, 0x564d, 0x6459, 0x645c, 0x427a, 0x645e, 0x424b, 0x4044, 0x4250, 0x3175, 0x4c32, 0x354e, 0x646f, 0x462f, 0x4661, 0x6475, 0x4229, 0x406c, 0x515d, 0x646e, 0x442e, 0x646d, 0x6476, 0x6474, 0x427e, 0x645d, 0x6470, 0x4a7e, 0x5544, 0x6471, 0x517a, 0x646b, 0x646c, 0x6472, 0x4e2b, 0x454b, 0x4731, 0x423a, 0x646a, 0x414a, 0x4c36, 0x3331, 0x647b, 0x6473, 0x647a, 0x647d, 0x647c, 0x334e, 0x333a, 0x6477, 0x6479, 0x6478, 0x456c, 0x403d, 0x5468, 0x6522, 0x3044, 0x6524, 0x6523, 0x3c24, 0x6525, 0x6521, 0x647e, 0x3174, 0x6528, 0x6529, 0x6526, 0x6527, 0x652a, 0x4659, 0x652b, 0x652d, 0x652c, 0x652f, 0x652e, 0x3960, 0x6530, 0x6531, 0x3b70, 0x6c61, 0x4370, 0x3546, 0x3b52, 0x4169, 0x546e, 0x3e44, 0x5746, 0x5456, 0x3253, 0x6c3e, 0x6a41, 0x422f, 0x3436, 0x5157, 0x3334, 0x4832, 0x3f3b, 0x6c40, 0x564b, 0x6c3f, 0x6c41, 0x6c45, 0x3e66, 0x4c3f, 0x455a, 0x3e3c, 0x6c46, 0x317e, 0x6c44, 0x5528, 0x3563, 0x6c42, 0x4136, 0x3363, 0x6c43, 0x4b38, 0x4043, 0x4c7e, 0x4152, 0x6c48, 0x3a66, 0x4053, 0x5672, 0x514c, 0x3f3e, 0x3733, 0x4955, 0x6c47, 0x3b62, 0x4c4c, 0x3d7d, 0x4848, 0x4f29, 0x4d69, 0x456b, 0x3769, 0x5149, 0x3a38, 0x6c49, 0x6c4a, 0x3b40, 0x6c4b, 0x6c62, 0x313a, 0x3759, 0x3d39, 0x6c4c, 0x5166, 0x6c4d, 0x483b, 0x6c51, 0x6c53, 0x3b4d, 0x3c65, 0x6c4f, 0x4937, 0x433a, 0x6c63, 0x5555, 0x6c50, 0x5673, 0x6c52, 0x6c4e, 0x6c54, 0x6c55, 0x493f, 0x4f28, 0x505c, 0x512c, 0x485b, 0x6c56, 0x4e75, 0x4a6c, 0x6c5a, 0x6c59, 0x303e, 0x6c57, 0x6c58, 0x6c64, 0x483c, 0x4147, 0x6c5c, 0x5160, 0x6c5b, 0x546f, 0x6c5d, 0x5b46, 0x6c5e, 0x312c, 0x6c5f, 0x6c60, 0x5726, 0x4540, 0x6b3c, 0x302e, 0x3e74, 0x3838, 0x522f, 0x3056, 0x3579, 0x5833, 0x4b2c, 0x635d, 0x462c, 0x3066, 0x4546, 0x6b39, 0x6b3a, 0x6b3b, 0x5140, 0x4523, 0x6a72, 0x4432, 0x4435, 0x404e, 0x6a73, 0x4441, 0x4e6f, 0x6a70, 0x6a74, 0x497c, 0x4723, 0x4c58, 0x4e7e, 0x6a75, 0x6a76, 0x4f2c, 0x4067, 0x6a77, 0x363f, 0x6a78, 0x6a79, 0x6a7a, 0x6a7b, 0x6a71, 0x482e, 0x616b, 0x3738, 0x616c, 0x616d, 0x5734, 0x616e, 0x616f, 0x534c, 0x6171, 0x3f71, 0x6170, 0x3552, 0x3137, 0x6173, 0x6172, 0x3a7c, 0x6174, 0x3937, 0x3e51, 0x447c, 0x3a5d, 0x3d46, 0x6175, 0x6177, 0x3640, 0x4f41, 0x4a28, 0x6176, 0x5578, 0x537c, 0x6178, 0x617c, 0x6179, 0x617a, 0x406a, 0x617e, 0x6221, 0x4047, 0x617b, 0x617d, 0x6225, 0x4154, 0x6223, 0x6228, 0x327e, 0x6222, 0x434d, 0x3242, 0x6227, 0x6226, 0x6224, 0x6229, 0x622b, 0x5049, 0x566d, 0x4328, 0x622c, 0x4f57, 0x622e, 0x3a6f, 0x6960, 0x622d, 0x622a, 0x3b2b, 0x5433, 0x6230, 0x622f, 0x6961, 0x6231, 0x6232, 0x6233, 0x4c21, 0x6234, 0x6235, 0x507e, 0x424a, 0x5371, 0x4d75, 0x6760, 0x6761, 0x3e41, 0x426a, 0x6764, 0x6763, 0x4d66, 0x4335, 0x6762, 0x3b37, 0x4f56, 0x4161, 0x6769, 0x6768, 0x6774, 0x3223, 0x676a, 0x6766, 0x676c, 0x676b, 0x493a, 0x5564, 0x6765, 0x3729, 0x6767, 0x676e, 0x6773, 0x5669, 0x676d, 0x6772, 0x6771, 0x3060, 0x6775, 0x4772, 0x4045, 0x406d, 0x4170, 0x6770, 0x6776, 0x4b76, 0x6822, 0x6821, 0x5741, 0x677a, 0x6779, 0x677b, 0x6777, 0x677e, 0x677d, 0x677c, 0x4155, 0x4759, 0x457d, 0x4543, 0x476d, 0x6823, 0x6826, 0x6825, 0x6827, 0x3a77, 0x6778, 0x6824, 0x4870, 0x492a, 0x6829, 0x3965, 0x517e, 0x6828, 0x682a, 0x682d, 0x682e, 0x4127, 0x682f, 0x6830, 0x682c, 0x6834, 0x682b, 0x6831, 0x6835, 0x6832, 0x6833, 0x6837, 0x6836, 0x394f, 0x702c, 0x702d, 0x4630, 0x306a, 0x483f, 0x4d5f, 0x4e4d, 0x6a31, 0x6a32, 0x463f, 0x3449, 0x6a33, 0x5567, 0x5d79, 0x6a34, 0x6a35, 0x6a36, 0x384a, 0x5f30, 0x4975, 0x4c70, 0x497a, 0x497b, 0x5343, 0x4b26, 0x3826, 0x702e, 0x3142, 0x6538, 0x4c6f, 0x5349, 0x3c57, 0x496a, 0x3567, 0x4450, 0x3569, 0x6e2e, 0x3b2d, 0x675e, 0x6e2f, 0x3329, 0x6e32, 0x6e31, 0x3d67, 0x6e30, 0x4e37, 0x454f, 0x4174, 0x5b4e, 0x6e33, 0x5073, 0x4254, 0x4668, 0x372c, 0x6e34, 0x336b, 0x3b7b, 0x6e35, 0x675c, 0x6e36, 0x3d2e, 0x7162, 0x4a68, 0x5249, 0x705a, 0x705b, 0x705c, 0x4146, 0x386d, 0x3e4e, 0x705e, 0x4531, 0x705d, 0x5171, 0x7060, 0x304c, 0x3d6a, 0x525f, 0x705f, 0x342f, 0x3768, 0x7066, 0x7065, 0x4623, 0x7061, 0x7062, 0x3443, 0x7063, 0x556e, 0x4c5b, 0x3e52, 0x3c32, 0x7068, 0x7067, 0x7064, 0x3221, 0x5622, 0x5338, 0x3e37, 0x482c, 0x706a, 0x5177, 0x564c, 0x3a5b, 0x7069, 0x363b, 0x4d34, 0x4626, 0x4121, 0x706b, 0x706e, 0x706d, 0x7070, 0x706c, 0x3b3e, 0x706f, 0x4c35, 0x7072, 0x3355, 0x3154, 0x7073, 0x7074, 0x7076, 0x3461, 0x7071, 0x7077, 0x707a, 0x7078, 0x7075, 0x707d, 0x7079, 0x707c, 0x707e, 0x7121, 0x4e41, 0x7124, 0x7123, 0x4176, 0x707b, 0x4a5d, 0x3471, 0x3171, 0x4c31, 0x7126, 0x7127, 0x712c, 0x554e, 0x7129, 0x4833, 0x7122, 0x712b, 0x7128, 0x7125, 0x712a, 0x3029, 0x712d, 0x712f, 0x7131, 0x7130, 0x712e, 0x5122, 0x7132, 0x7133, 0x396f, 0x3547, 0x3057, 0x3059, 0x546d, 0x3544, 0x3d54, 0x3b4a, 0x7027, 0x385e, 0x7028, 0x3028, 0x7029, 0x4d6e, 0x702a, 0x702b, 0x4624, 0x5665, 0x7164, 0x7165, 0x4373, 0x535b, 0x5651, 0x4568, 0x532f, 0x5266, 0x6e41, 0x303b, 0x5535, 0x514e, 0x3c60, 0x3a50, 0x3f78, 0x3847, 0x3541, 0x454c, 0x4a22, 0x434b, 0x6e42, 0x443f, 0x3622, 0x6d6c, 0x4324, 0x5631, 0x4f60, 0x6d6f, 0x454e, 0x365c, 0x4a21, 0x6d6d, 0x6d70, 0x6d71, 0x433c, 0x3f34, 0x6d6e, 0x6d74, 0x6d72, 0x5566, 0x435f, 0x6d73, 0x6d76, 0x5523, 0x5123, 0x6d75, 0x4350, 0x6d77, 0x3f74, 0x3e6c, 0x6d78, 0x4c77, 0x515b, 0x5745, 0x5576, 0x6d7c, 0x6d7b, 0x6d79, 0x6d7a, 0x6d7d, 0x3e26, 0x4b2f, 0x6e21, 0x363d, 0x6e22, 0x4440, 0x6d7e, 0x3d5e, 0x3247, 0x3643, 0x6e25, 0x583a, 0x6e23, 0x6e26, 0x4369, 0x3372, 0x6e27, 0x6e24, 0x4f39, 0x6e28, 0x4277, 0x6e29, 0x6e2a, 0x5e2b, 0x4633, 0x4746, 0x5675, 0x3549, 0x4b32, 0x6e2b, 0x4d2b, 0x6e2c, 0x5530, 0x6e2d, 0x7644, 0x5b47, 0x3423, 0x432c, 0x7166, 0x4a38, 0x5253, 0x562a, 0x6f72, 0x3e58, 0x3d43, 0x6f73, 0x364c, 0x302b, 0x4a2f, 0x6d36, 0x6d37, 0x4e79, 0x372f, 0x3f73, 0x6d38, 0x426b, 0x4930, 0x6d39, 0x4676, 0x3f33, 0x6d3c, 0x4578, 0x5150, 0x5729, 0x6d3a, 0x6d3b, 0x5162, 0x6d3f, 0x6d40, 0x6d44, 0x6d48, 0x6d46, 0x6d4e, 0x5568, 0x6d49, 0x6d47, 0x6d3e, 0x4569, 0x4646, 0x4969, 0x5452, 0x6d41, 0x6d42, 0x6d43, 0x6d45, 0x4079, 0x3421, 0x3968, 0x6d50, 0x6d51, 0x6d4a, 0x6d4f, 0x4e78, 0x4b36, 0x6d4c, 0x6d4d, 0x4f75, 0x6d52, 0x4172, 0x5332, 0x6d4b, 0x4837, 0x3c6f, 0x4570, 0x6d56, 0x356f, 0x4235, 0x302d, 0x4b69, 0x312e, 0x6d54, 0x4d6b, 0x3562, 0x6d55, 0x6d53, 0x6d57, 0x357a, 0x6d58, 0x6d59, 0x6d5c, 0x314c, 0x4576, 0x3c6e, 0x6d5a, 0x4c3c, 0x326a, 0x6d5b, 0x446b, 0x3445, 0x3075, 0x6d5f, 0x405a, 0x3468, 0x454d, 0x6d5d, 0x3f44, 0x6d5e, 0x4425, 0x6d60, 0x6d61, 0x6d63, 0x4157, 0x3b47, 0x3d38, 0x6d62, 0x6d64, 0x6d66, 0x6d65, 0x6d67, 0x4a3e, 0x6c6a, 0x4071, 0x4967, 0x6c6b, 0x466e, 0x6c6c, 0x466d, 0x6c6d, 0x6c70, 0x5766, 0x6c73, 0x6c71, 0x6c6e, 0x6c6f, 0x5723, 0x4971, 0x4b6e, 0x6c74, 0x6c72, 0x4f69, 0x6c76, 0x4631, 0x3c40, 0x6c75, 0x353b, 0x3b76, 0x6c77, 0x5977, 0x3d7b, 0x423b, 0x6c78, 0x6c79, 0x3823, 0x6c7a, 0x6c7b, 0x6c7c, 0x536d, 0x582e, 0x406b, 0x475d, 0x3a4c, 0x5063, 0x4b3d, 0x4d3a, 0x3851, 0x317c, 0x476f, 0x5656, 0x3f46, 0x436b, 0x6f75, 0x4358, 0x5762, 0x6f77, 0x3353, 0x4758, 0x516d, 0x5648, 0x6f78, 0x6f76, 0x3b7d, 0x3346, 0x3d55, 0x5246, 0x3b60, 0x4f21, 0x6f7c, 0x6f7b, 0x6f79, 0x334c, 0x4954, 0x4b30, 0x6f7e, 0x305e, 0x5649, 0x6f7d, 0x336d, 0x7655, 0x4e48, 0x7022, 0x7021, 0x353e, 0x3c5a, 0x3b7c, 0x3865, 0x4442, 0x7023, 0x4b6b, 0x7026, 0x5128, 0x3e3f, 0x476e, 0x7136, 0x7137, 0x3f55, 0x3429, 0x7138, 0x4d3b, 0x4754, 0x552d, 0x7139, 0x713a, 0x474f, 0x5224, 0x564f, 0x713b, 0x3d51, 0x3430, 0x3e3d, 0x345c, 0x4e51, 0x3f5f, 0x713d, 0x3f7a, 0x713c, 0x713f, 0x713e, 0x7140, 0x7141, 0x417e, 0x4122, 0x4a7a, 0x553e, 0x3e3a, 0x3e39, 0x5542, 0x3f22, 0x4d2f, 0x7135, 0x3d5f, 0x364b, 0x5671, 0x7343, 0x7344, 0x384d, 0x7346, 0x7347, 0x304a, 0x7345, 0x7349, 0x4b71, 0x734b, 0x5026, 0x314a, 0x7348, 0x734f, 0x3551, 0x7357, 0x7352, 0x7354, 0x7353, 0x377b, 0x313f, 0x734e, 0x734a, 0x355a, 0x7350, 0x7351, 0x7355, 0x734d, 0x3c63, 0x417d, 0x7356, 0x735a, 0x734c, 0x3548, 0x3d6e, 0x735c, 0x3724, 0x3f70, 0x567e, 0x4d32, 0x3470, 0x325f, 0x7358, 0x7359, 0x4938, 0x735d, 0x735e, 0x7361, 0x735f, 0x7363, 0x7362, 0x735b, 0x3f6a, 0x336f, 0x7360, 0x4729, 0x3c72, 0x736b, 0x393f, 0x7364, 0x322d, 0x3b7e, 0x4b63, 0x736d, 0x7369, 0x395c, 0x736e, 0x7365, 0x7366, 0x736a, 0x4261, 0x736c, 0x736f, 0x7368, 0x3c7d, 0x4f64, 0x7370, 0x7367, 0x7372, 0x572d, 0x462a, 0x7373, 0x7371, 0x4228, 0x385d, 0x7375, 0x7374, 0x345b, 0x7376, 0x7377, 0x7378, 0x403a, 0x4069, 0x4571, 0x737b, 0x737a, 0x3458, 0x737e, 0x7379, 0x737c, 0x737d, 0x7421, 0x7423, 0x3b49, 0x7422, 0x7424, 0x323e, 0x7426, 0x7425, 0x3c2e, 0x4357, 0x5961, 0x4060, 0x744c, 0x5751, 0x375b, 0x744e, 0x4123, 0x4649, 0x3456, 0x5533, 0x7450, 0x744f, 0x7451, 0x4b5a, 0x7452, 0x5441, 0x5660, 0x3760, 0x4138, 0x413b, 0x7453, 0x3e2c, 0x3462, 0x7454, 0x7455, 0x3e2b, 0x7456, 0x745b, 0x7457, 0x745a, 0x3a7d, 0x7458, 0x7459, 0x3862, 0x4c47, 0x745c, 0x325a, 0x4353, 0x5463, 0x3f37, 0x745d, 0x4534, 0x7469, 0x4f35, 0x4e49, 0x4b58, 0x4b77, 0x3d74, 0x574f, 0x405b, 0x5075, 0x746a, 0x746b, 0x746c, 0x7763, 0x3731, 0x746d, 0x576b, 0x746e, 0x6679, 0x3e40, 0x667a, 0x3a6c, 0x667b, 0x4f4b, 0x667c, 0x543c, 0x3c36, 0x667d, 0x667e, 0x3c4d, 0x4852, 0x4e33, 0x6721, 0x343f, 0x6722, 0x4934, 0x3859, 0x4449, 0x575d, 0x425a, 0x3757, 0x563d, 0x4e46, 0x3744, 0x4526, 0x6723, 0x4f5f, 0x6724, 0x6725, 0x6726, 0x4137, 0x5769, 0x4970, 0x4f38, 0x562f, 0x5655, 0x6727, 0x306d, 0x6728, 0x6729, 0x495c, 0x526f, 0x3e2d, 0x672a, 0x3073, 0x485e, 0x3d61, 0x672b, 0x4846, 0x672c, 0x3b66, 0x3878, 0x5124, 0x672d, 0x4267, 0x3e78, 0x3d4a, 0x4d33, 0x672e, 0x672f, 0x3e6e, 0x5065, 0x4b67, 0x4c50, 0x3c4c, 0x6730, 0x3c28, 0x5077, 0x6731, 0x5078, 0x6732, 0x6733, 0x3442, 0x6734, 0x6735, 0x497e, 0x4e2c, 0x4360, 0x6737, 0x3141, 0x3371, 0x6738, 0x6739, 0x575b, 0x5540, 0x673a, 0x424c, 0x573a, 0x673b, 0x673c, 0x673d, 0x3c6a, 0x4365, 0x4042, 0x673e, 0x673f, 0x3c29, 0x6740, 0x6741, 0x6736, 0x3650, 0x6742, 0x6743, 0x6744, 0x3b3a, 0x355e, 0x4246, 0x3160, 0x6745, 0x5435, 0x6746, 0x383f, 0x6748, 0x6747, 0x376c, 0x6749, 0x3278, 0x674a, 0x674b, 0x674c, 0x674d, 0x674e, 0x674f, 0x6750, 0x5327, 0x4b75, 0x6751, 0x6752, 0x6753, 0x6754, 0x4949, 0x6755, 0x6756, 0x6757, 0x6758, 0x6759, 0x3d49, 0x675a, 0x733e, 0x3857, 0x4831, 0x733f, 0x7340, 0x7341, 0x395e, 0x4d78, 0x5868, 0x3a31, 0x425e, 0x6e37, 0x3723, 0x6e39, 0x6e38, 0x3055, 0x6e3b, 0x5556, 0x576f, 0x5643, 0x6e3d, 0x4a70, 0x6e3c, 0x6e3e, 0x6e40, 0x6e3f, 0x5172, 0x473c, 0x4340, 0x3861, 0x4167, 0x7446, 0x505f, 0x7447, 0x4f5b, 0x483a, 0x7448, 0x7449, 0x744a, 0x744b, 0x597a, 0x387e, 0x6571, 0x5370, 0x7460, 0x4e4c, 0x3361, 0x7134, 0x526e, 0x7461, 0x4f68, 0x7462, 0x474c, 0x3554, 0x3464, 0x7464, 0x7463, 0x7465, 0x7466, 0x7467, 0x3a32, 0x303f, 0x7468, 0x372d, 0x526d, 0x522b, 0x404f, 0x3f3c, 0x6b23, 0x555f, 0x6a48, 0x7173, 0x3678, 0x4b23, 0x444d, 0x7167, 0x7168, 0x387b, 0x7169, 0x3a44, 0x5445, 0x3052, 0x716a, 0x716b, 0x716c, 0x716d, 0x716e, 0x716f, 0x7171, 0x7170, 0x4555, 0x7172, 0x367a, 0x7174, 0x522e, 0x5e47, 0x4b4a, 0x335c, 0x3522, 0x3922, 0x4474, 0x7175, 0x7176, 0x4144, 0x417b, 0x5630, 0x7177, 0x7178, 0x412a, 0x4638, 0x3e5b, 0x7179, 0x344f, 0x717a, 0x6d32, 0x6d31, 0x4b60, 0x525e, 0x4b41, 0x5558, 0x4862, 0x405f, 0x3c21, 0x6b41, 0x5024, 0x5662, 0x3647, 0x3858, 0x6b40, 0x384e, 0x6b3f, 0x3326, 0x3949, 0x562b, 0x3774, 0x374a, 0x3c67, 0x373e, 0x6b46, 0x6b47, 0x3039, 0x3f4f, 0x6b45, 0x537d, 0x6b48, 0x6b49, 0x374e, 0x6b42, 0x6b44, 0x4976, 0x5657, 0x554d, 0x5032, 0x6b4f, 0x4e38, 0x6b50, 0x3528, 0x3133, 0x6b52, 0x4c25, 0x4556, 0x6b53, 0x6b51, 0x455f, 0x6b4e, 0x4a24, 0x6b55, 0x307b, 0x3a7a, 0x5837, 0x7163, 0x6b4a, 0x6b4b, 0x6b4c, 0x6b4d, 0x6b56, 0x6640, 0x6b59, 0x3f68, 0x5248, 0x6b57, 0x6b5c, 0x386c, 0x6b58, 0x3d3a, 0x5058, 0x3037, 0x6b5d, 0x445c, 0x562c, 0x3460, 0x4276, 0x3c39, 0x6b5a, 0x6b5b, 0x5460, 0x466a, 0x4454, 0x6b5f, 0x4527, 0x5975, 0x3231, 0x6b64, 0x3d45, 0x6b62, 0x6b63, 0x382c, 0x4d51, 0x6b65, 0x6b61, 0x4133, 0x4622, 0x4c73, 0x6b66, 0x4030, 0x5238, 0x6b67, 0x382f, 0x382d, 0x6b68, 0x473b, 0x4d73, 0x6b6a, 0x6b6b, 0x6b6d, 0x5048, 0x6b72, 0x6b6e, 0x6b71, 0x4879, 0x517c, 0x6b6c, 0x6b69, 0x3839, 0x4f59, 0x4465, 0x6b6f, 0x6b70, 0x4c5a, 0x4d48, 0x3072, 0x6b76, 0x6b75, 0x3232, 0x3860, 0x6b77, 0x316c, 0x4c45, 0x4424, 0x4f25, 0x6b79, 0x6c22, 0x4572, 0x6b7a, 0x4945, 0x625f, 0x6b7e, 0x4d4e, 0x6c21, 0x315b, 0x5337, 0x525c, 0x6b7d, 0x6b7b, 0x333c, 0x6a30, 0x5754, 0x742b, 0x3374, 0x5641, 0x5642, 0x5569, 0x3e4a, 0x7427, 0x5228, 0x7428, 0x7429, 0x742a, 0x3e4b, 0x535f, 0x4960, 0x4961, 0x7342, 0x4a66, 0x4c72, 0x6236, 0x4b34, 0x4e68, 0x565b, 0x742d, 0x742e, 0x742f, 0x7432, 0x3a3d, 0x7433, 0x3063, 0x7430, 0x7431, 0x3d22, 0x3255, 0x7436, 0x7437, 0x3666, 0x3230, 0x4f4f, 0x7434, 0x342c, 0x7435, 0x7438, 0x7439, 0x4d27, 0x743a, 0x743b, 0x743c, 0x4b52, 0x743d, 0x743e, 0x743f, 0x745e, 0x413c, 0x3c68, 0x492b, 0x515e, 0x6575, 0x5c33, 0x5255, 0x5c34, 0x302c, 0x5c35, 0x3d5a, 0x5c39, 0x5842, 0x5c37, 0x5373, 0x4956, 0x5c3a, 0x5c36, 0x5c3b, 0x4322, 0x5c3c, 0x5c45, 0x5c3d, 0x4e5f, 0x5625, 0x5c4f, 0x5c4d, 0x5c52, 0x3d66, 0x422b, 0x5c38, 0x5c4b, 0x5c4e, 0x5c3e, 0x3752, 0x3045, 0x5c47, 0x503e, 0x5c41, 0x3b28, 0x373c, 0x5c4c, 0x5c46, 0x5c3f, 0x475b, 0x513f, 0x5c40, 0x5c4a, 0x5c50, 0x4e2d, 0x5c42, 0x5c43, 0x5c48, 0x5c49, 0x3254, 0x5c51, 0x4b55, 0x5437, 0x5c5b, 0x5c5f, 0x4c26, 0x5c66, 0x4367, 0x5c5c, 0x3f41, 0x5c59, 0x307a, 0x3936, 0x5c65, 0x5c53, 0x5c44, 0x5c56, 0x4874, 0x3f60, 0x493b, 0x313d, 0x5322, 0x5c5a, 0x5c55, 0x463b, 0x5c5e, 0x5742, 0x432f, 0x3736, 0x4751, 0x4329, 0x5c62, 0x5c58, 0x5c6b, 0x5c54, 0x5c5d, 0x3e25, 0x5c57, 0x5c60, 0x5c63, 0x5c64, 0x5c78, 0x5c61, 0x5d22, 0x5c67, 0x3c6b, 0x3444, 0x4323, 0x3267, 0x5c7a, 0x5c72, 0x5c6f, 0x5c7c, 0x5c6e, 0x5270, 0x3268, 0x4857, 0x4863, 0x5c7b, 0x5c6d, 0x5c77, 0x5c75, 0x3e23, 0x5c74, 0x325d, 0x5c73, 0x3c76, 0x5c68, 0x3b44, 0x4073, 0x3c54, 0x5c69, 0x5c6a, 0x5c71, 0x5c76, 0x5c79, 0x3534, 0x4859, 0x3b67, 0x5c7e, 0x5c7d, 0x532b, 0x5d21, 0x5d23, 0x5d25, 0x5271, 0x5d24, 0x5d26, 0x5d27, 0x5229, 0x3a49, 0x5d29, 0x5d36, 0x5d31, 0x5d34, 0x5d30, 0x464e, 0x4072, 0x492f, 0x5c6c, 0x5d2e, 0x5d37, 0x5c70, 0x5d2f, 0x5d38, 0x5d2c, 0x5d39, 0x5d33, 0x5d2d, 0x442a, 0x5d28, 0x4033, 0x412b, 0x5d2a, 0x5d2b, 0x5d32, 0x3b71, 0x5d35, 0x5328, 0x5d3a, 0x5d3b, 0x4327, 0x5d52, 0x5d3c, 0x5d51, 0x393d, 0x3e55, 0x3e7a, 0x3a4a, 0x5d4a, 0x5d45, 0x5d3f, 0x324b, 0x5d43, 0x5d4b, 0x3224, 0x5d55, 0x5d3e, 0x4650, 0x5d50, 0x5d54, 0x4162, 0x3746, 0x5d4e, 0x5d4f, 0x5d44, 0x5d3d, 0x5d4d, 0x4c51, 0x5d49, 0x5d42, 0x4348, 0x463c, 0x4e2e, 0x5d4c, 0x5d48, 0x5d41, 0x5d46, 0x425c, 0x5329, 0x532a, 0x5d53, 0x4f74, 0x4878, 0x5d66, 0x5d47, 0x5d60, 0x4264, 0x5d61, 0x5d57, 0x5678, 0x5d59, 0x5d58, 0x3870, 0x5d56, 0x464f, 0x362d, 0x5d62, 0x3a79, 0x5461, 0x5d67, 0x3450, 0x5d5a, 0x3f7b, 0x5d63, 0x5d5f, 0x5d5d, 0x3559, 0x5d5b, 0x5d5c, 0x5d5e, 0x3d2f, 0x5d64, 0x5d65, 0x5d75, 0x4349, 0x4b62, 0x5d72, 0x5861, 0x4651, 0x5d74, 0x5574, 0x5d73, 0x5d70, 0x5d6c, 0x5d6f, 0x5d68, 0x506e, 0x4858, 0x5d6e, 0x5d69, 0x5d6a, 0x4b72, 0x5d6d, 0x314d, 0x4036, 0x3c3b, 0x5d71, 0x5d77, 0x5d76, 0x5d6b, 0x456e, 0x5d7b, 0x5e24, 0x5e23, 0x5d78, 0x436f, 0x427b, 0x5561, 0x4e35, 0x5d7d, 0x324c, 0x4468, 0x4a5f, 0x473e, 0x5d7a, 0x5d7c, 0x5d7e, 0x5e22, 0x302a, 0x314e, 0x5e2c, 0x5e26, 0x3d36, 0x486f, 0x5e21, 0x5e25, 0x5e29, 0x5e28, 0x5e27, 0x5e2d, 0x544c, 0x5e33, 0x5e2a, 0x5e2e, 0x4059, 0x3121, 0x5e36, 0x5e31, 0x5e32, 0x5126, 0x5e35, 0x5e2f, 0x5e30, 0x503d, 0x5e34, 0x4a6d, 0x5e39, 0x5e38, 0x5e37, 0x5e3b, 0x3d65, 0x3258, 0x436a, 0x5e3a, 0x453a, 0x5e3c, 0x4c59, 0x372a, 0x5465, 0x5e3d, 0x5e3f, 0x4422, 0x5e41, 0x5e3e, 0x5e40, 0x553a, 0x5e42, 0x722e, 0x3b22, 0x4232, 0x4530, 0x4247, 0x722f, 0x5069, 0x535d, 0x6b3d, 0x3366, 0x7230, 0x7231, 0x4a2d, 0x3a67, 0x7233, 0x7235, 0x7234, 0x4b64, 0x4f3a, 0x7232, 0x4a34, 0x524f, 0x426c, 0x4e43, 0x7238, 0x3076, 0x7237, 0x723e, 0x324f, 0x5141, 0x723a, 0x723c, 0x5469, 0x723b, 0x7236, 0x723f, 0x723d, 0x7239, 0x7247, 0x7244, 0x7246, 0x724a, 0x7242, 0x7240, 0x7245, 0x567b, 0x7241, 0x4779, 0x495f, 0x7248, 0x3946, 0x3530, 0x7243, 0x7249, 0x7250, 0x7256, 0x3b57, 0x7255, 0x4d5c, 0x566b, 0x7252, 0x7254, 0x3872, 0x724b, 0x724e, 0x4279, 0x555d, 0x724c, 0x724d, 0x724f, 0x7253, 0x7259, 0x533c, 0x366a, 0x4a71, 0x3764, 0x7257, 0x7258, 0x725a, 0x725d, 0x725b, 0x725c, 0x5151, 0x7251, 0x4d49, 0x4e4f, 0x5629, 0x7263, 0x435b, 0x7260, 0x402f, 0x726c, 0x725e, 0x7261, 0x7268, 0x7262, 0x7267, 0x7266, 0x7269, 0x725f, 0x7264, 0x726a, 0x532c, 0x7265, 0x3275, 0x7272, 0x502b, 0x7275, 0x3b48, 0x7279, 0x7270, 0x7276, 0x7278, 0x727a, 0x7273, 0x7271, 0x3a7b, 0x357b, 0x726f, 0x7277, 0x726d, 0x726e, 0x726b, 0x7326, 0x7323, 0x7322, 0x7274, 0x485a, 0x727b, 0x7325, 0x4378, 0x727d, 0x7327, 0x7329, 0x7324, 0x727c, 0x732b, 0x732a, 0x425d, 0x732e, 0x7330, 0x7321, 0x7331, 0x732c, 0x732f, 0x727e, 0x732d, 0x7332, 0x7334, 0x7328, 0x7333, 0x7335, 0x5037, 0x7338, 0x5979, 0x7339, 0x7337, 0x4864, 0x7336, 0x733a, 0x733b, 0x3440, 0x6e43, 0x733c, 0x733d, 0x512a, 0x742c, 0x5046, 0x5050, 0x515c, 0x4f4e, 0x3d56, 0x5143, 0x3a62, 0x6169, 0x5242, 0x7142, 0x3239, 0x316d, 0x7143, 0x4940, 0x3344, 0x5972, 0x4b25, 0x7144, 0x5654, 0x7145, 0x7440, 0x7146, 0x542c, 0x7147, 0x3040, 0x7441, 0x7442, 0x347c, 0x455b, 0x4c3b, 0x5064, 0x4d60, 0x7148, 0x5973, 0x313b, 0x4f2e, 0x3824, 0x714a, 0x714b, 0x3243, 0x4151, 0x5730, 0x7149, 0x714c, 0x714e, 0x5976, 0x5261, 0x5423, 0x7443, 0x4839, 0x7444, 0x714d, 0x714f, 0x3f63, 0x7150, 0x7154, 0x7156, 0x7151, 0x4951, 0x4561, 0x4263, 0x397c, 0x7153, 0x7155, 0x3953, 0x715b, 0x3a56, 0x307d, 0x7159, 0x7158, 0x7152, 0x715a, 0x7157, 0x486c, 0x4d4a, 0x715d, 0x653d, 0x715c, 0x715e, 0x715f, 0x4f65, 0x7445, 0x3d73, 0x7160, 0x7161, 0x4e77, 0x522a, 0x717b, 0x3832, 0x3c7b, 0x395b, 0x3966, 0x4359, 0x4a53, 0x6a68, 0x4040, 0x3e75, 0x6a69, 0x6a6a, 0x6a6b, 0x6a6c, 0x6a6d, 0x6a6e, 0x6a6f, 0x3d47, 0x757b, 0x757d, 0x757e, 0x757c, 0x3d62, 0x7621, 0x3425, 0x7622, 0x7623, 0x6c32, 0x5154, 0x596a, 0x7624, 0x6e3a, 0x5532, 0x537e, 0x4c5c, 0x4a44, 0x6540, 0x7625, 0x3e2f, 0x4629, 0x5a25, 0x3c46, 0x3629, 0x383c, 0x484f, 0x3c25, 0x5a26, 0x5a27, 0x4c56, 0x4843, 0x5a28, 0x467d, 0x5135, 0x5269, 0x5136, 0x3c47, 0x3d32, 0x3b64, 0x5a29, 0x5a2a, 0x5148, 0x5a2b, 0x506d, 0x366f, 0x425b, 0x4b4f, 0x376d, 0x4968, 0x3743, 0x3e77, 0x5624, 0x5a2c, 0x5a2d, 0x4640, 0x5767, 0x4a36, 0x5529, 0x4b5f, 0x556f, 0x5a2e, 0x565f, 0x344a, 0x5a30, 0x5a2f, 0x526b, 0x5a31, 0x5a32, 0x5a33, 0x4a54, 0x5a34, 0x4a2b, 0x5a35, 0x5a36, 0x334f, 0x566f, 0x5a37, 0x3b30, 0x352e, 0x5a38, 0x5a39, 0x396e, 0x512f, 0x5268, 0x5a3a, 0x3843, 0x4f6a, 0x326f, 0x5a3b, 0x5a3c, 0x3d6b, 0x4e5c, 0x536f, 0x5a3d, 0x4e73, 0x5a3e, 0x5355, 0x3b65, 0x5a3f, 0x4b35, 0x4b50, 0x5a40, 0x476b, 0x566e, 0x5a41, 0x4535, 0x3641, 0x5a42, 0x374c, 0x3f4e, 0x5a43, 0x5a44, 0x4b2d, 0x5a45, 0x3577, 0x5a46, 0x4142, 0x573b, 0x5a47, 0x4c38, 0x526a, 0x4431, 0x5a48, 0x357d, 0x3b51, 0x5a49, 0x5033, 0x5a4a, 0x5a4b, 0x4e3d, 0x5a4c, 0x5a4d, 0x5a4e, 0x3277, 0x5a51, 0x5a4f, 0x5168, 0x5a50, 0x4355, 0x5a52, 0x5a53, 0x5a54, 0x5a55, 0x503b, 0x5225, 0x3079, 0x5a56, 0x472b, 0x5a57, 0x3d77, 0x4321, 0x5a58, 0x5a59, 0x437d, 0x4c37, 0x5a5a, 0x5a5b, 0x403e, 0x4657, 0x5a5c, 0x5a5d, 0x4734, 0x5a5e, 0x5a5f, 0x3948, 0x3b6d, 0x3639, 0x7478, 0x7479, 0x4d63, 0x7539, 0x6b60, 0x4f73, 0x3b3f, 0x3a40, 0x5425, 0x6159, 0x7574, 0x312a, 0x3272, 0x7575, 0x7577, 0x3a51, 0x7576, 0x4332, 0x7579, 0x7578, 0x3134, 0x556a, 0x383a, 0x3931, 0x3246, 0x5470, 0x4f4d, 0x305c, 0x554b, 0x3b75, 0x564a, 0x3737, 0x4c30, 0x4636, 0x3161, 0x393a, 0x567c, 0x3961, 0x3721, 0x3c7a, 0x6a5a, 0x6a5b, 0x4c79, 0x3973, 0x6a5c, 0x347b, 0x4333, 0x3751, 0x3a58, 0x6a5d, 0x5474, 0x6a5e, 0x3c56, 0x3b5f, 0x6a5f, 0x415e, 0x4238, 0x545f, 0x574a, 0x6a60, 0x6a61, 0x6a64, 0x6a62, 0x6a63, 0x495e, 0x3833, 0x3644, 0x6a65, 0x4a6a, 0x494d, 0x344d, 0x6259, 0x4562, 0x6a66, 0x4035, 0x5738, 0x6a67, 0x572c, 0x487c, 0x5853, 0x584d, 0x545e, 0x5479, 0x4944, 0x532e, 0x3853, 0x3360, 0x4962, 0x7476, 0x3a55, 0x7477, 0x575f, 0x7471, 0x3830, 0x5554, 0x384f, 0x4670, 0x3343, 0x7472, 0x332c, 0x543d, 0x4777, 0x7474, 0x7473, 0x4c4b, 0x4824, 0x7475, 0x5763, 0x453f, 0x7540, 0x753b, 0x7543, 0x7542, 0x563a, 0x7541, 0x543e, 0x7544, 0x754c, 0x304f, 0x3578, 0x7549, 0x754a, 0x455c, 0x7545, 0x7546, 0x7547, 0x754b, 0x3e60, 0x7548, 0x387a, 0x7550, 0x7553, 0x3f67, 0x3972, 0x753c, 0x754d, 0x4237, 0x4c78, 0x3c79, 0x754e, 0x754f, 0x7551, 0x3665, 0x7552, 0x7555, 0x753d, 0x7554, 0x533b, 0x336c, 0x4c24, 0x7556, 0x7557, 0x3e61, 0x7558, 0x4c5f, 0x755b, 0x3248, 0x5759, 0x7559, 0x755a, 0x755c, 0x7562, 0x7560, 0x755f, 0x755d, 0x7561, 0x755e, 0x7564, 0x7565, 0x4c63, 0x653f, 0x3538, 0x7563, 0x7568, 0x4c23, 0x7566, 0x7567, 0x753e, 0x3144, 0x753f, 0x3545, 0x3264, 0x756c, 0x7569, 0x3657, 0x756d, 0x756a, 0x756b, 0x345a, 0x546a, 0x756e, 0x3379, 0x756f, 0x7571, 0x7570, 0x7572, 0x7573, 0x496d, 0x392a, 0x477b, 0x3663, 0x4c49, 0x6a26, 0x3335, 0x547e, 0x396c, 0x5079, 0x696d, 0x572a, 0x696e, 0x4256, 0x486d, 0x3a64, 0x696f, 0x6970, 0x6971, 0x5661, 0x6972, 0x6973, 0x6975, 0x6974, 0x6976, 0x6977, 0x4761, 0x6978, 0x5458, 0x6979, 0x3d4e, 0x697a, 0x697b, 0x3d4f, 0x697c, 0x3828, 0x413e, 0x697d, 0x3132, 0x3b54, 0x3975, 0x697e, 0x6a21, 0x6a22, 0x6a23, 0x3778, 0x3c2d, 0x4a64, 0x604e, 0x542f, 0x4f3d, 0x5537, 0x6a24, 0x555e, 0x6a25, 0x5041, 0x393c, 0x3447, 0x3159, 0x4031, 0x3166, 0x3167, 0x3168, 0x333d, 0x4868, 0x6541, 0x315f, 0x4149, 0x346f, 0x4728, 0x5358, 0x4679, 0x5138, 0x397d, 0x4275, 0x532d, 0x544b, 0x3d7c, 0x6542, 0x3735, 0x6543, 0x3b39, 0x5562, 0x3d78, 0x5436, 0x4e25, 0x412c, 0x3359, 0x4c76, 0x6546, 0x6544, 0x6548, 0x654a, 0x6547, 0x354f, 0x4648, 0x357c, 0x6545, 0x4a76, 0x6549, 0x4354, 0x3145, 0x3c23, 0x5737, 0x4d4b, 0x4b4d, 0x4a4a, 0x4c53, 0x654c, 0x654b, 0x4466, 0x5121, 0x5137, 0x654d, 0x6550, 0x4d38, 0x5670, 0x654f, 0x355d, 0x4d3e, 0x6551, 0x363a, 0x4d28, 0x3964, 0x4a45, 0x3351, 0x4b59, 0x546c, 0x6552, 0x376a, 0x654e, 0x6555, 0x347e, 0x6556, 0x6553, 0x6554, 0x525d, 0x425f, 0x3146, 0x5362, 0x365d, 0x4b6c, 0x6557, 0x5376, 0x3169, 0x3674, 0x655a, 0x6558, 0x6559, 0x3540, 0x5245, 0x655c, 0x655e, 0x655d, 0x4732, 0x5223, 0x655b, 0x5462, 0x555a, 0x6560, 0x5771, 0x6561, 0x315c, 0x517b, 0x6562, 0x6564, 0x6563, 0x6565, 0x5258, 0x354b, 0x675f, 0x5a75, 0x5a78, 0x5a76, 0x5a77, 0x5a7a, 0x504f, 0x4447, 0x306e, 0x5030, 0x5a79, 0x534a, 0x3a2a, 0x5b22, 0x4771, 0x5a7c, 0x5a7b, 0x495b, 0x5a7d, 0x5b21, 0x575e, 0x5a7e, 0x415a, 0x5b25, 0x5374, 0x5b27, 0x5b24, 0x5b28, 0x3d3c, 0x4049, 0x5b23, 0x5b26, 0x5623, 0x5b29, 0x5b2d, 0x5b2e, 0x5b2c, 0x3a42, 0x3f24, 0x5b2b, 0x5b2a, 0x5447, 0x323f, 0x5b2f, 0x3979, 0x5b30, 0x333b, 0x3526, 0x363c, 0x5b31, 0x3675, 0x5b32, 0x3149, 0x5b34, 0x5b33, 0x5b35, 0x5b37, 0x5b36, 0x5b38, 0x5b39, 0x5b3a, 0x534f, 0x747a, 0x4775, 0x5743, 0x4564, 0x747c, 0x747d, 0x747b, 0x3e46, 0x506f, 0x3753, 0x544d, 0x4c2a, 0x7522, 0x7521, 0x3a28, 0x747e, 0x4b56, 0x7524, 0x4052, 0x336a, 0x4d2a, 0x7525, 0x7523, 0x3d34, 0x7528, 0x7529, 0x3d4d, 0x4338, 0x3f61, 0x4b61, 0x752a, 0x7526, 0x7527, 0x4470, 0x752c, 0x343c, 0x576d, 0x3457, 0x752b, 0x752e, 0x752d, 0x752f, 0x5051, 0x4351, 0x4829, 0x7530, 0x7531, 0x7532, 0x7533, 0x7534, 0x7535, 0x7537, 0x7536, 0x7538, 0x3249, 0x5354, 0x4a4d, 0x406f, 0x5658, 0x5230, 0x413f, 0x3d70, 0x382a, 0x3c78, 0x7646, 0x7647, 0x7648, 0x7649, 0x764a, 0x764c, 0x764b, 0x7769, 0x764d, 0x764e, 0x6e44, 0x6e45, 0x6e46, 0x556b, 0x3624, 0x6e48, 0x6e47, 0x6e49, 0x6e4a, 0x4725, 0x6e4b, 0x6e4c, 0x3730, 0x3576, 0x6e4d, 0x6e4f, 0x6e4e, 0x3846, 0x6e50, 0x6e51, 0x6e52, 0x365b, 0x332e, 0x5653, 0x4446, 0x3135, 0x3856, 0x6e53, 0x6e54, 0x543f, 0x4755, 0x3e7b, 0x4e59, 0x3933, 0x6e56, 0x6e55, 0x6e58, 0x6e57, 0x4525, 0x6e59, 0x6e5a, 0x472e, 0x6e5b, 0x472f, 0x6e5c, 0x3227, 0x6e5d, 0x6e5e, 0x6e5f, 0x6e60, 0x6e61, 0x576a, 0x6e62, 0x6e63, 0x3c58, 0x6e64, 0x534b, 0x4c7a, 0x322c, 0x4165, 0x6e65, 0x4726, 0x432d, 0x6e66, 0x6e67, 0x6e68, 0x6e69, 0x6e6a, 0x6e6b, 0x6e6c, 0x6e6d, 0x6e6e, 0x6e6f, 0x6e70, 0x6e71, 0x6e72, 0x6e74, 0x6e73, 0x6e75, 0x4d2d, 0x4241, 0x6e76, 0x6e77, 0x6e78, 0x5521, 0x6e79, 0x4f33, 0x6e7a, 0x6e7b, 0x6e7c, 0x6e7d, 0x6f21, 0x6e7e, 0x6f22, 0x3875, 0x437a, 0x6f23, 0x6f24, 0x3d42, 0x523f, 0x3279, 0x6f25, 0x6f26, 0x6f27, 0x5278, 0x6f28, 0x567d, 0x6f29, 0x464c, 0x6f2a, 0x6f2b, 0x4134, 0x6f2c, 0x4f7a, 0x4b78, 0x6f2e, 0x6f2d, 0x337a, 0x3978, 0x6f2f, 0x6f30, 0x5062, 0x6f31, 0x6f32, 0x3766, 0x503f, 0x6f33, 0x6f34, 0x6f35, 0x4871, 0x4c60, 0x6f36, 0x6f37, 0x6f38, 0x6f39, 0x6f3a, 0x5560, 0x6f3b, 0x346d, 0x432a, 0x6f3c, 0x6f3d, 0x6f3e, 0x6f3f, 0x4e7d, 0x6f40, 0x4260, 0x3438, 0x5736, 0x3d75, 0x4f47, 0x6f43, 0x6f41, 0x6f42, 0x6f44, 0x3627, 0x3c7c, 0x3e62, 0x434c, 0x6f45, 0x6f46, 0x6f47, 0x6f4f, 0x6f48, 0x6f49, 0x6f4a, 0x4742, 0x6f71, 0x364d, 0x6f4b, 0x6f4c, 0x6f4d, 0x3646, 0x433e, 0x6f4e, 0x6f50, 0x6f51, 0x6f52, 0x5572, 0x6f53, 0x4477, 0x6f54, 0x4478, 0x6f55, 0x6f56, 0x3864, 0x3077, 0x6f57, 0x6f58, 0x6f59, 0x6f5a, 0x6f5b, 0x6f5c, 0x6f5d, 0x6f5e, 0x3e35, 0x6f61, 0x6f5f, 0x6f60, 0x6f62, 0x6f63, 0x414d, 0x6f64, 0x6f65, 0x6f66, 0x6f67, 0x6f68, 0x6f69, 0x6f6a, 0x6f6b, 0x6f6c, 0x4058, 0x6f6d, 0x412d, 0x6f6e, 0x6f6f, 0x6f70, 0x4f62, 0x3324, 0x4345, 0x6345, 0x4941, 0x6346, 0x3155, 0x4e4a, 0x3433, 0x4872, 0x6347, 0x4f50, 0x6348, 0x3c64, 0x6349, 0x634a, 0x4346, 0x5522, 0x4456, 0x396b, 0x4e45, 0x634b, 0x4376, 0x634c, 0x3727, 0x3873, 0x3a52, 0x634d, 0x634e, 0x5444, 0x634f, 0x6350, 0x514b, 0x6351, 0x6352, 0x6353, 0x6354, 0x5156, 0x6355, 0x327b, 0x403b, 0x6356, 0x402b, 0x6357, 0x6358, 0x6359, 0x635a, 0x635b, 0x3837, 0x5a62, 0x3653, 0x5a64, 0x5a63, 0x5a66, 0x486e, 0x5a65, 0x3740, 0x5174, 0x5275, 0x5573, 0x3d57, 0x5768, 0x5a68, 0x5a67, 0x3022, 0x4d53, 0x5a69, 0x383d, 0x3c4a, 0x423d, 0x4224, 0x3342, 0x5a6a, 0x422a, 0x4430, 0x3d35, 0x4f5e, 0x5a6b, 0x4942, 0x315d, 0x5a6c, 0x3638, 0x543a, 0x337d, 0x5a6d, 0x5449, 0x4f55, 0x4563, 0x5a6e, 0x5a6f, 0x5a70, 0x416a, 0x4c55, 0x4f5d, 0x5367, 0x4221, 0x5a71, 0x4b65, 0x5a72, 0x4b66, 0x527e, 0x3874, 0x5a73, 0x302f, 0x4f36, 0x554f, 0x4b6d, 0x5a74, 0x6344, 0x4125, 0x763f, 0x7640, 0x7641, 0x4451, 0x4838, 0x5163, 0x505b, 0x5145, 0x3c2f, 0x394d, 0x6f74, 0x3446, 0x533a, 0x7642, 0x337b, 0x7643, 0x3571, 0x7645, 0x536a, 0x7627, 0x5129, 0x7629, 0x7628, 0x4163, 0x4057, 0x3122, 0x4e6d, 0x5068, 0x762b, 0x4f76, 0x762a, 0x5570, 0x762c, 0x4339, 0x3b74, 0x762e, 0x762d, 0x445e, 0x4158, 0x4b2a, 0x4f3c, 0x762f, 0x7630, 0x7631, 0x4236, 0x3054, 0x4579, 0x7632, 0x4760, 0x7626, 0x3e38, 0x3e32, 0x3565, 0x3747, 0x3f3f, 0x4352, 0x4366, 0x584c, 0x386f, 0x3d79, 0x5125, 0x3050, 0x7730, 0x7731, 0x502c, 0x3030, 0x7732, 0x7733, 0x7734, 0x474a, 0x3e4f, 0x7737, 0x7736, 0x315e, 0x7735, 0x7738, 0x7739, 0x4e24, 0x484d, 0x3a2b, 0x6838, 0x6839, 0x683a, 0x3e42, 0x5274, 0x544f, 0x4958, 0x5233, 0x3625, 0x476a, 0x717c, 0x4f6e, 0x4b33, 0x506b, 0x676f, 0x4d67, 0x394b, 0x3659, 0x717d, 0x3064, 0x4b4c, 0x717e, 0x5424, 0x422d, 0x416c, 0x4644, 0x3e31, 0x7221, 0x3c55, 0x7222, 0x7223, 0x7224, 0x5243, 0x4635, 0x4d47, 0x7225, 0x5331, 0x3f45, 0x4c62, 0x7226, 0x7227, 0x5155, 0x366e, 0x7228, 0x7229, 0x355f, 0x722a, 0x722b, 0x327c, 0x722c, 0x722d, 0x4827, 0x3767, 0x6c29, 0x6c2a, 0x6c2b, 0x6c2c, 0x462e, 0x6c2d, 0x6c2e, 0x3749, 0x4a33, 0x6238, 0x774f, 0x7750, 0x324d, 0x7751, 0x7753, 0x7752, 0x623b, 0x3c22, 0x623c, 0x623d, 0x623e, 0x623f, 0x6240, 0x6241, 0x3739, 0x527b, 0x3d24, 0x4a4e, 0x3125, 0x4b47, 0x6242, 0x367c, 0x4844, 0x6243, 0x3d48, 0x317d, 0x6244, 0x3676, 0x6245, 0x4459, 0x6246, 0x4f5a, 0x395d, 0x6247, 0x4021, 0x6248, 0x3276, 0x6249, 0x4173, 0x624a, 0x624b, 0x4278, 0x624c, 0x624d, 0x624e, 0x4a57, 0x5838, 0x5965, 0x4f63, 0x7025, 0x5c30, 0x426d, 0x5426, 0x4d54, 0x5131, 0x335b, 0x477d, 0x3235, 0x423f, 0x6660, 0x4a3b, 0x6661, 0x6662, 0x3e54, 0x6663, 0x5724, 0x4d55, 0x6665, 0x3c5d, 0x6664, 0x6666, 0x6667, 0x426e, 0x3d3e, 0x6668, 0x4266, 0x3a27, 0x6669, 0x666a, 0x3352, 0x5169, 0x3f25, 0x666b, 0x466f, 0x666c, 0x666d, 0x666e, 0x462d, 0x666f, 0x4927, 0x6670, 0x6671, 0x6672, 0x6539, 0x6673, 0x6674, 0x4262, 0x6675, 0x6676, 0x5668, 0x6677, 0x6678, 0x3947, 0x773b, 0x773a, 0x773e, 0x773c, 0x3a21, 0x773f, 0x7740, 0x7742, 0x7741, 0x7744, 0x7743, 0x7745, 0x7746, 0x7747, 0x4b68, 0x385f, 0x7754, 0x7755, 0x7756, 0x7758, 0x775a, 0x7757, 0x775b, 0x7759, 0x5757, 0x775c, 0x775d, 0x775e, 0x775f, 0x7760, 0x5b4b, 0x582a, 0x6577, 0x396d, 0x3f7d, 0x3b6a, 0x7749, 0x4647, 0x7748, 0x774a, 0x774c, 0x774b, 0x774d, 0x4e3a, 0x774e, 0x4427, 0x5363, 0x764f, 0x4233, 0x7650, 0x7651, 0x7652, 0x7653, 0x7654, 0x7656, 0x312b, 0x7657, 0x7658, 0x7659, 0x765a, 0x765b, 0x765c, 0x765d, 0x765e, 0x4f4a, 0x765f, 0x7660, 0x7661, 0x7662, 0x7663, 0x7664, 0x4070, 0x7665, 0x7666, 0x7667, 0x7668, 0x7669, 0x766a, 0x766b, 0x766c, 0x766d, 0x766e, 0x766f, 0x7670, 0x7671, 0x7672, 0x7673, 0x7674, 0x3e28, 0x7675, 0x7676, 0x7677, 0x7678, 0x487a, 0x7679, 0x767a, 0x767b, 0x767c, 0x767d, 0x767e, 0x7721, 0x7722, 0x7723, 0x7724, 0x7725, 0x7726, 0x7727, 0x7728, 0x316e, 0x7729, 0x772a, 0x772b, 0x772c, 0x772d, 0x415b, 0x772e, 0x772f, 0x4471, 0x702f, 0x3c26, 0x7030, 0x4379, 0x4538, 0x513b, 0x7031, 0x7032, 0x7033, 0x7034, 0x7035, 0x513c, 0x516c, 0x7037, 0x7036, 0x5427, 0x4d52, 0x7038, 0x703a, 0x7039, 0x703b, 0x703c, 0x386b, 0x703d, 0x3a68, 0x703e, 0x703f, 0x3e69, 0x7040, 0x366c, 0x7041, 0x7042, 0x7043, 0x7044, 0x4835, 0x7045, 0x7046, 0x7047, 0x4574, 0x7048, 0x7049, 0x704a, 0x773d, 0x704b, 0x704c, 0x704d, 0x704e, 0x704f, 0x3a57, 0x7050, 0x7051, 0x7052, 0x7053, 0x7054, 0x7055, 0x7056, 0x7058, 0x5325, 0x7057, 0x7059, 0x753a, 0x4239, 0x7764, 0x7765, 0x7766, 0x7767, 0x7768, 0x4234, 0x776a, 0x776b, 0x4273, 0x7470, 0x746f, 0x4269, 0x7761, 0x7762, 0x3b46, 0x5964, 0x4a72, 0x4068, 0x7024, 0x3a5a, 0x472d, 0x442c, 0x776c, 0x776d, 0x776e, 0x7770, 0x776f, 0x7771, 0x7774, 0x7773, 0x7772, 0x7775, 0x7776, 0x6d69, 0x6d6a, 0x6d6b, 0x763c, 0x763d, 0x763e, 0x3626, 0x583e, 0x3944, 0x583b, 0x5c31, 0x4a73, 0x7777, 0x7778, 0x7779, 0x777b, 0x777a, 0x3147, 0x777c, 0x777d, 0x777e, 0x466b, 0x6c34, 0x335d, 0x7633, 0x7634, 0x4164, 0x7635, 0x7636, 0x7637, 0x7638, 0x7639, 0x763a, 0x4823, 0x763b, 0x417a, 0x3928, 0x6d68, 0x396a, 0x595f, 0x2321, 0x2322, 0x2323, 0x2167, 0x2325, 0x2326, 0x2327, 0x2328, 0x2329, 0x232a, 0x232b, 0x232c, 0x232d, 0x232e, 0x232f, 0x2330, 0x2331, 0x2332, 0x2333, 0x2334, 0x2335, 0x2336, 0x2337, 0x2338, 0x2339, 0x233a, 0x233b, 0x233c, 0x233d, 0x233e, 0x233f, 0x2340, 0x2341, 0x2342, 0x2343, 0x2344, 0x2345, 0x2346, 0x2347, 0x2348, 0x2349, 0x234a, 0x234b, 0x234c, 0x234d, 0x234e, 0x234f, 0x2350, 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, 0x2356, 0x2357, 0x2358, 0x2359, 0x235a, 0x235b, 0x235c, 0x235d, 0x235e, 0x235f, 0x2360, 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, 0x2366, 0x2367, 0x2368, 0x2369, 0x236a, 0x236b, 0x236c, 0x236d, 0x236e, 0x236f, 0x2370, 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, 0x2376, 0x2377, 0x2378, 0x2379, 0x237a, 0x237b, 0x237c, 0x237d, 0x212b, 0x2169, 0x216a, 0x237e, 0x2324, }; static const Summary16 gb2312_uni2indx_page00[70] = { /* 0x0000 */ { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0190 }, { 3, 0x0003 }, { 5, 0x0000 }, { 5, 0x0080 }, { 6, 0x3703 }, { 13, 0x168c }, /* 0x0100 */ { 19, 0x0002 }, { 20, 0x0808 }, { 22, 0x0800 }, { 23, 0x0000 }, { 23, 0x2000 }, { 24, 0x0000 }, { 24, 0x0800 }, { 25, 0x0000 }, { 25, 0x0000 }, { 25, 0x0000 }, { 25, 0x0000 }, { 25, 0x0000 }, { 25, 0x4000 }, { 26, 0x1555 }, { 33, 0x0000 }, { 33, 0x0000 }, /* 0x0200 */ { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0280 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, /* 0x0300 */ { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0xfffe }, { 50, 0x03fb }, { 59, 0xfffe }, { 74, 0x03fb }, { 83, 0x0000 }, { 83, 0x0000 }, { 83, 0x0000 }, /* 0x0400 */ { 83, 0x0002 }, { 84, 0xffff }, { 100, 0xffff }, { 116, 0xffff }, { 132, 0xffff }, { 148, 0x0002 }, }; static const Summary16 gb2312_uni2indx_page20[101] = { /* 0x2000 */ { 149, 0x0000 }, { 149, 0x3360 }, { 155, 0x0040 }, { 156, 0x080d }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, /* 0x2100 */ { 160, 0x0008 }, { 161, 0x0040 }, { 162, 0x0000 }, { 162, 0x0000 }, { 162, 0x0000 }, { 162, 0x0000 }, { 162, 0x0fff }, { 174, 0x0000 }, { 174, 0x0000 }, { 174, 0x000f }, { 178, 0x0000 }, { 178, 0x0000 }, { 178, 0x0000 }, { 178, 0x0000 }, { 178, 0x0000 }, { 178, 0x0000 }, /* 0x2200 */ { 178, 0x8100 }, { 180, 0x6402 }, { 184, 0x4fa1 }, { 192, 0x20f0 }, { 197, 0x1100 }, { 199, 0x0000 }, { 199, 0xc033 }, { 205, 0x0000 }, { 205, 0x0000 }, { 205, 0x0200 }, { 206, 0x0020 }, { 207, 0x0000 }, { 207, 0x0000 }, { 207, 0x0000 }, { 207, 0x0000 }, { 207, 0x0000 }, /* 0x2300 */ { 207, 0x0000 }, { 207, 0x0004 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, /* 0x2400 */ { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x03ff }, { 218, 0xfff0 }, { 230, 0xffff }, { 246, 0x0fff }, { 258, 0x0000 }, { 258, 0x0000 }, { 258, 0x0000 }, { 258, 0x0000 }, { 258, 0x0000 }, { 258, 0x0000 }, /* 0x2500 */ { 258, 0xffff }, { 274, 0xffff }, { 290, 0xffff }, { 306, 0xffff }, { 322, 0x0fff }, { 334, 0x0000 }, { 334, 0x0000 }, { 334, 0x0000 }, { 334, 0x0000 }, { 334, 0x0000 }, { 334, 0x0003 }, { 336, 0x000c }, { 338, 0xc8c0 }, { 343, 0x0000 }, { 343, 0x0000 }, { 343, 0x0000 }, /* 0x2600 */ { 343, 0x0060 }, { 345, 0x0000 }, { 345, 0x0000 }, { 345, 0x0000 }, { 345, 0x0005 }, }; static const Summary16 gb2312_uni2indx_page30[35] = { /* 0x3000 */ { 347, 0xff2f }, { 360, 0x00fb }, { 367, 0x0000 }, { 367, 0x0000 }, { 367, 0xfffe }, { 382, 0xffff }, { 398, 0xffff }, { 414, 0xffff }, { 430, 0xffff }, { 446, 0x000f }, { 450, 0xfffe }, { 465, 0xffff }, { 481, 0xffff }, { 497, 0xffff }, { 513, 0xffff }, { 529, 0x087f }, /* 0x3100 */ { 537, 0xffe0 }, { 548, 0xffff }, { 564, 0x03ff }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, /* 0x3200 */ { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x03ff }, }; static const Summary16 gb2312_uni2indx_page4e[1263] = { /* 0x4e00 */ { 584, 0x7f8b }, { 595, 0x7f7b }, { 608, 0x3db4 }, { 617, 0xef55 }, { 628, 0xfba8 }, { 638, 0xf35d }, { 649, 0x0243 }, { 653, 0x400b }, { 657, 0xfb40 }, { 665, 0x8d3e }, { 674, 0x7bf7 }, { 687, 0x8c2c }, { 693, 0x6eff }, { 706, 0xe3fa }, { 717, 0x1d3a }, { 725, 0xa8ed }, /* 0x4f00 */ { 734, 0xe602 }, { 740, 0xcf83 }, { 749, 0x8cf5 }, { 758, 0x3555 }, { 766, 0xe048 }, { 771, 0xffab }, { 784, 0x92b9 }, { 792, 0xd859 }, { 800, 0xab18 }, { 807, 0x2892 }, { 812, 0xd7e9 }, { 823, 0x8020 }, { 825, 0xc438 }, { 831, 0xf583 }, { 840, 0xe74a }, { 849, 0x450a }, /* 0x5000 */ { 854, 0xb000 }, { 857, 0x9714 }, { 864, 0x7762 }, { 873, 0x5400 }, { 876, 0xd188 }, { 882, 0x1420 }, { 885, 0x1020 }, { 887, 0xc8c0 }, { 892, 0x2121 }, { 896, 0x0000 }, { 896, 0x13a8 }, { 902, 0x0c04 }, { 905, 0x8000 }, { 906, 0x0440 }, { 908, 0x70c0 }, { 913, 0x0828 }, /* 0x5100 */ { 916, 0x08c0 }, { 919, 0x0004 }, { 920, 0x0002 }, { 921, 0x8000 }, { 922, 0x2b7b }, { 932, 0x1472 }, { 938, 0x7924 }, { 945, 0x3bfb }, { 957, 0x3327 }, { 965, 0x1ae4 }, { 972, 0x9835 }, { 979, 0x38ef }, { 989, 0x9ad1 }, { 997, 0x2802 }, { 1000, 0xa813 }, { 1006, 0xbf69 }, /* 0x5200 */ { 1017, 0x65cf }, { 1027, 0x2fc6 }, { 1036, 0x6b11 }, { 1043, 0xafc9 }, { 1053, 0x340f }, { 1060, 0x5053 }, { 1066, 0x86a2 }, { 1072, 0xa004 }, { 1075, 0x0106 }, { 1078, 0xe809 }, { 1084, 0x3f0f }, { 1094, 0xc00e }, { 1099, 0x0a88 }, { 1103, 0x8145 }, { 1108, 0x0010 }, { 1109, 0xc601 }, /* 0x5300 */ { 1114, 0xa161 }, { 1120, 0x26e1 }, { 1127, 0x444b }, { 1133, 0xce00 }, { 1138, 0xc7aa }, { 1147, 0xd4ee }, { 1157, 0xcadf }, { 1168, 0x85bb }, { 1177, 0x3a74 }, { 1185, 0xa520 }, { 1190, 0x436c }, { 1197, 0x8840 }, { 1200, 0x3f06 }, { 1208, 0x8bd2 }, { 1216, 0xff79 }, { 1229, 0x3bef }, /* 0x5400 */ { 1241, 0xf75a }, { 1252, 0xe8ef }, { 1263, 0xfbcb }, { 1275, 0x5b36 }, { 1284, 0x0d49 }, { 1290, 0x1bfd }, { 1301, 0x0154 }, { 1305, 0x39ee }, { 1315, 0xd855 }, { 1323, 0x2e75 }, { 1332, 0xbfd8 }, { 1343, 0xa91a }, { 1350, 0xf3d7 }, { 1362, 0xf6bf }, { 1375, 0x67e0 }, { 1383, 0xb40c }, /* 0x5500 */ { 1389, 0x82c2 }, { 1394, 0x0813 }, { 1398, 0xd49d }, { 1407, 0xd08b }, { 1414, 0x065a }, { 1420, 0x1061 }, { 1424, 0x74f2 }, { 1433, 0x59e0 }, { 1440, 0x8f9f }, { 1451, 0xb312 }, { 1458, 0x0080 }, { 1459, 0x6aaa }, { 1467, 0x3230 }, { 1472, 0xb05e }, { 1480, 0x9d7a }, { 1490, 0x60ac }, /* 0x5600 */ { 1496, 0xd303 }, { 1503, 0xc900 }, { 1507, 0x3098 }, { 1512, 0x8a56 }, { 1519, 0x7000 }, { 1522, 0x1390 }, { 1527, 0x1f14 }, { 1534, 0x1842 }, { 1538, 0xc060 }, { 1542, 0x0008 }, { 1543, 0x8008 }, { 1545, 0x1080 }, { 1547, 0x0400 }, { 1548, 0xec90 }, { 1555, 0x2817 }, { 1561, 0xe633 }, /* 0x5700 */ { 1570, 0x0758 }, { 1576, 0x9000 }, { 1578, 0xf708 }, { 1586, 0x4e09 }, { 1592, 0xf485 }, { 1600, 0xfc83 }, { 1609, 0xaf53 }, { 1619, 0x18c8 }, { 1624, 0x187c }, { 1631, 0x080c }, { 1634, 0x6adf }, { 1645, 0x0114 }, { 1648, 0xc80c }, { 1653, 0xa734 }, { 1661, 0xa011 }, { 1665, 0x2710 }, /* 0x5800 */ { 1670, 0x28c5 }, { 1676, 0x4222 }, { 1680, 0x0413 }, { 1684, 0x0021 }, { 1686, 0x3010 }, { 1689, 0x4112 }, { 1693, 0x1820 }, { 1696, 0x4000 }, { 1697, 0x022b }, { 1702, 0xc60c }, { 1708, 0x0300 }, { 1710, 0x1000 }, { 1711, 0x0022 }, { 1713, 0x0022 }, { 1715, 0x5810 }, { 1719, 0x0249 }, /* 0x5900 */ { 1723, 0xa094 }, { 1728, 0x9670 }, { 1735, 0xeeb0 }, { 1744, 0x1792 }, { 1751, 0xcb96 }, { 1760, 0x05f2 }, { 1767, 0x0025 }, { 1770, 0x2358 }, { 1776, 0x25de }, { 1785, 0x42cc }, { 1791, 0xcf38 }, { 1800, 0x4a04 }, { 1804, 0x0c40 }, { 1807, 0x359f }, { 1817, 0x1128 }, { 1821, 0x8a00 }, /* 0x5a00 */ { 1824, 0x13fa }, { 1833, 0x910a }, { 1838, 0x0229 }, { 1842, 0x1056 }, { 1847, 0x0641 }, { 1851, 0x0420 }, { 1853, 0x0484 }, { 1856, 0x84f0 }, { 1862, 0x0000 }, { 1862, 0x0c04 }, { 1865, 0x0400 }, { 1866, 0x412c }, { 1871, 0x1206 }, { 1875, 0x1154 }, { 1880, 0x0a4b }, { 1886, 0x0002 }, /* 0x5b00 */ { 1887, 0x0200 }, { 1888, 0x00c0 }, { 1890, 0x0000 }, { 1890, 0x0094 }, { 1893, 0x0001 }, { 1894, 0xbfbb }, { 1907, 0x167c }, { 1915, 0x242b }, { 1921, 0x9bbb }, { 1932, 0x7fa8 }, { 1942, 0x0c7f }, { 1951, 0xe379 }, { 1961, 0x10f4 }, { 1967, 0xe00d }, { 1973, 0x4132 }, { 1978, 0x9f01 }, /* 0x5c00 */ { 1985, 0x8652 }, { 1991, 0x3572 }, { 1999, 0x10b4 }, { 2004, 0xff12 }, { 2014, 0xcf27 }, { 2024, 0x4223 }, { 2029, 0xc06b }, { 2036, 0x8602 }, { 2040, 0x3106 }, { 2045, 0x1fd3 }, { 2055, 0x3a0c }, { 2061, 0xa1aa }, { 2068, 0x0812 }, { 2071, 0x0204 }, { 2073, 0x2572 }, { 2080, 0x0801 }, /* 0x5d00 */ { 2082, 0x40cc }, { 2087, 0x4850 }, { 2091, 0x62d0 }, { 2097, 0x6010 }, { 2100, 0x1c80 }, { 2104, 0x2900 }, { 2107, 0x9a00 }, { 2111, 0x0010 }, { 2112, 0x0004 }, { 2113, 0x2200 }, { 2115, 0x0000 }, { 2115, 0x0080 }, { 2116, 0x2020 }, { 2118, 0x6800 }, { 2121, 0xcbe6 }, { 2131, 0x609e }, /* 0x5e00 */ { 2138, 0x916e }, { 2146, 0x3f73 }, { 2157, 0x60c0 }, { 2161, 0x3982 }, { 2167, 0x1034 }, { 2171, 0x4830 }, { 2175, 0x0006 }, { 2177, 0xbd5c }, { 2187, 0x8cd1 }, { 2194, 0xd6fb }, { 2206, 0x20e1 }, { 2211, 0x43e8 }, { 2218, 0x0600 }, { 2220, 0x084e }, { 2225, 0x0500 }, { 2227, 0xc4d0 }, /* 0x5f00 */ { 2233, 0x8d1f }, { 2242, 0x89aa }, { 2249, 0xa6e1 }, { 2257, 0x1602 }, { 2261, 0x0001 }, { 2262, 0x21ed }, { 2270, 0x3656 }, { 2278, 0x1a8b }, { 2285, 0x1fb7 }, { 2296, 0x13a5 }, { 2303, 0x6502 }, { 2308, 0x30a0 }, { 2312, 0xb278 }, { 2320, 0x23c7 }, { 2328, 0x6c93 }, { 2336, 0xe922 }, /* 0x6000 */ { 2343, 0xe47f }, { 2354, 0x3a74 }, { 2362, 0x8fe3 }, { 2372, 0x9820 }, { 2376, 0x280e }, { 2381, 0x2625 }, { 2387, 0xbf9c }, { 2398, 0xbf49 }, { 2408, 0x3218 }, { 2413, 0xac54 }, { 2420, 0xb949 }, { 2428, 0x1916 }, { 2434, 0x0c60 }, { 2438, 0xb522 }, { 2445, 0xfbc1 }, { 2455, 0x0659 }, /* 0x6100 */ { 2461, 0xe343 }, { 2469, 0x8420 }, { 2472, 0x08d9 }, { 2478, 0x8000 }, { 2479, 0x5500 }, { 2483, 0x2022 }, { 2486, 0x0184 }, { 2489, 0x00a1 }, { 2492, 0x4800 }, { 2494, 0x2010 }, { 2496, 0x1380 }, { 2500, 0x4080 }, { 2502, 0x0d04 }, { 2506, 0x0016 }, { 2509, 0x0040 }, { 2510, 0x8020 }, /* 0x6200 */ { 2512, 0xfd40 }, { 2520, 0x8de7 }, { 2530, 0x5436 }, { 2537, 0xe098 }, { 2543, 0x7b8b }, { 2553, 0x091e }, { 2559, 0xfec8 }, { 2569, 0xd249 }, { 2576, 0x0611 }, { 2580, 0x8dee }, { 2590, 0x1937 }, { 2598, 0xba22 }, { 2605, 0x77f4 }, { 2616, 0x9fdd }, { 2628, 0xf3ec }, { 2639, 0xf0da }, /* 0x6300 */ { 2648, 0x4386 }, { 2654, 0xec42 }, { 2661, 0x8d3f }, { 2671, 0x2604 }, { 2675, 0xfa6c }, { 2685, 0xc021 }, { 2689, 0x628e }, { 2696, 0x0cc2 }, { 2701, 0xd785 }, { 2710, 0x0145 }, { 2714, 0x77ad }, { 2725, 0x5599 }, { 2733, 0xe250 }, { 2739, 0x4045 }, { 2743, 0x260b }, { 2749, 0xa154 }, /* 0x6400 */ { 2755, 0x9827 }, { 2762, 0x5819 }, { 2768, 0x3443 }, { 2774, 0xa410 }, { 2778, 0x05f2 }, { 2785, 0x4114 }, { 2789, 0x2280 }, { 2792, 0x0700 }, { 2795, 0x00b4 }, { 2799, 0x4266 }, { 2805, 0x7210 }, { 2810, 0x15a1 }, { 2816, 0x6025 }, { 2821, 0x4185 }, { 2826, 0x0054 }, { 2829, 0x0000 }, /* 0x6500 */ { 2829, 0x0201 }, { 2831, 0x0104 }, { 2833, 0xc820 }, { 2837, 0xcb70 }, { 2845, 0x9320 }, { 2850, 0x6a62 }, { 2857, 0x184c }, { 2862, 0x0095 }, { 2866, 0x1880 }, { 2869, 0x9a8b }, { 2877, 0xaab2 }, { 2885, 0x3201 }, { 2889, 0xd87a }, { 2898, 0x00c4 }, { 2901, 0xf3e5 }, { 2912, 0x04c3 }, /* 0x6600 */ { 2917, 0xd44d }, { 2925, 0xa238 }, { 2931, 0xa1a1 }, { 2937, 0x5072 }, { 2943, 0x980a }, { 2948, 0x84fc }, { 2956, 0xc152 }, { 2962, 0x44d1 }, { 2968, 0x1094 }, { 2972, 0x20c2 }, { 2976, 0x4180 }, { 2979, 0x4210 }, { 2982, 0x0000 }, { 2982, 0x3a00 }, { 2986, 0x0240 }, { 2988, 0xd29d }, /* 0x6700 */ { 2997, 0x2f01 }, { 3003, 0xa8b1 }, { 3010, 0xbd40 }, { 3017, 0x2432 }, { 3022, 0xd34d }, { 3031, 0xd04b }, { 3038, 0xa723 }, { 3046, 0xd0ad }, { 3054, 0x0a92 }, { 3059, 0x75a1 }, { 3067, 0xadac }, { 3076, 0x01e9 }, { 3082, 0x801a }, { 3086, 0x771f }, { 3097, 0x9225 }, { 3103, 0xa01b }, /* 0x6800 */ { 3109, 0xdfa1 }, { 3119, 0x20ca }, { 3124, 0x0602 }, { 3127, 0x738c }, { 3135, 0x577f }, { 3147, 0x003b }, { 3152, 0x0bff }, { 3163, 0x00d0 }, { 3166, 0x806a }, { 3171, 0x0088 }, { 3173, 0xa1c4 }, { 3179, 0x0029 }, { 3182, 0x2a05 }, { 3187, 0x0524 }, { 3191, 0x4009 }, { 3194, 0x1623 }, /* 0x6900 */ { 3200, 0x6822 }, { 3205, 0x8005 }, { 3208, 0x2011 }, { 3211, 0xa211 }, { 3216, 0x0004 }, { 3217, 0x6490 }, { 3222, 0x4849 }, { 3227, 0x1382 }, { 3232, 0x23d5 }, { 3240, 0x1930 }, { 3245, 0x2980 }, { 3249, 0x0892 }, { 3253, 0x5402 }, { 3257, 0x8811 }, { 3261, 0x2001 }, { 3263, 0xa004 }, /* 0x6a00 */ { 3266, 0x0400 }, { 3267, 0x8180 }, { 3270, 0x8502 }, { 3274, 0x6022 }, { 3278, 0x0090 }, { 3280, 0x0b01 }, { 3284, 0x0022 }, { 3286, 0x1202 }, { 3289, 0x4011 }, { 3292, 0x0083 }, { 3295, 0x1a01 }, { 3299, 0x0000 }, { 3299, 0x0000 }, { 3299, 0x0000 }, { 3299, 0x0000 }, { 3299, 0x0000 }, /* 0x6b00 */ { 3299, 0x0000 }, { 3299, 0x0000 }, { 3299, 0x009f }, { 3305, 0x4684 }, { 3310, 0x12c8 }, { 3315, 0x0200 }, { 3316, 0x04fc }, { 3323, 0x1a00 }, { 3326, 0x2ede }, { 3336, 0x0c4c }, { 3341, 0x0402 }, { 3343, 0x80b8 }, { 3348, 0xa826 }, { 3354, 0x0afc }, { 3362, 0x8c02 }, { 3366, 0x2228 }, /* 0x6c00 */ { 3370, 0xa0e0 }, { 3375, 0x8f7b }, { 3386, 0xc7d6 }, { 3396, 0x2135 }, { 3402, 0x06c7 }, { 3409, 0xf8b1 }, { 3418, 0x0713 }, { 3424, 0x6255 }, { 3431, 0x936e }, { 3440, 0x8a19 }, { 3446, 0x6efa }, { 3457, 0xfb0e }, { 3467, 0x1630 }, { 3472, 0x48f9 }, { 3480, 0xcd2f }, { 3490, 0x7deb }, /* 0x6d00 */ { 3502, 0x5892 }, { 3508, 0x4e84 }, { 3514, 0x4ca0 }, { 3519, 0x7a2e }, { 3528, 0xedea }, { 3539, 0x561e }, { 3547, 0xc649 }, { 3554, 0x1190 }, { 3558, 0x5324 }, { 3564, 0xe83a }, { 3572, 0xcfdb }, { 3584, 0x8124 }, { 3588, 0x18f1 }, { 3595, 0x6342 }, { 3601, 0x5853 }, { 3608, 0x1a8a }, /* 0x6e00 */ { 3614, 0x7420 }, { 3619, 0x24d3 }, { 3626, 0xaa3b }, { 3635, 0x0514 }, { 3639, 0x6018 }, { 3643, 0x8958 }, { 3649, 0x4800 }, { 3651, 0xc000 }, { 3653, 0x8268 }, { 3658, 0x9101 }, { 3662, 0x84a4 }, { 3667, 0x2cd6 }, { 3675, 0x8886 }, { 3680, 0xc4ba }, { 3688, 0x0377 }, { 3696, 0x0210 }, /* 0x6f00 */ { 3698, 0x8244 }, { 3702, 0x0038 }, { 3705, 0xae11 }, { 3712, 0x404a }, { 3716, 0x28c0 }, { 3720, 0x5100 }, { 3723, 0x6044 }, { 3727, 0x1514 }, { 3732, 0x7310 }, { 3738, 0x1000 }, { 3739, 0x0082 }, { 3741, 0x0248 }, { 3744, 0x0205 }, { 3747, 0x4006 }, { 3750, 0xc003 }, { 3754, 0x0000 }, /* 0x7000 */ { 3754, 0x0000 }, { 3754, 0x0c02 }, { 3757, 0x0008 }, { 3758, 0x0220 }, { 3760, 0x9000 }, { 3762, 0x4000 }, { 3763, 0xb800 }, { 3767, 0xd161 }, { 3774, 0x4621 }, { 3779, 0x3274 }, { 3786, 0xf800 }, { 3791, 0x3b8a }, { 3799, 0x050f }, { 3805, 0x8b00 }, { 3809, 0xbbd0 }, { 3818, 0x2280 }, /* 0x7100 */ { 3821, 0x0600 }, { 3823, 0x0769 }, { 3830, 0x8040 }, { 3832, 0x0043 }, { 3835, 0x5420 }, { 3839, 0x5000 }, { 3841, 0x41d0 }, { 3846, 0x250c }, { 3851, 0x8410 }, { 3854, 0x8310 }, { 3858, 0x1101 }, { 3861, 0x0228 }, { 3864, 0x4008 }, { 3866, 0x0030 }, { 3868, 0x40a1 }, { 3872, 0x0200 }, /* 0x7200 */ { 3873, 0x0040 }, { 3874, 0x2000 }, { 3875, 0x1500 }, { 3878, 0xabe3 }, { 3888, 0x3180 }, { 3892, 0xaa44 }, { 3898, 0xc2c6 }, { 3905, 0xc624 }, { 3911, 0xac13 }, { 3918, 0x8004 }, { 3920, 0xb000 }, { 3923, 0x03d1 }, { 3929, 0x611e }, { 3936, 0x4285 }, { 3941, 0xf303 }, { 3949, 0x1d9f }, /* 0x7300 */ { 3959, 0x440a }, { 3963, 0x78e8 }, { 3971, 0x5e26 }, { 3979, 0xc392 }, { 3986, 0x2000 }, { 3987, 0x0085 }, { 3990, 0xb001 }, { 3994, 0x4000 }, { 3995, 0x4a90 }, { 4000, 0x8842 }, { 4004, 0xca04 }, { 4009, 0x0c8d }, { 4015, 0xa705 }, { 4022, 0x4203 }, { 4026, 0x22a1 }, { 4031, 0x0004 }, /* 0x7400 */ { 4032, 0x8668 }, { 4038, 0x0c01 }, { 4041, 0x5564 }, { 4048, 0x1079 }, { 4054, 0x0002 }, { 4055, 0xdea0 }, { 4063, 0x2000 }, { 4064, 0x40c1 }, { 4068, 0x488b }, { 4074, 0x5001 }, { 4077, 0x0380 }, { 4080, 0x0400 }, { 4081, 0x0000 }, { 4081, 0x5004 }, { 4084, 0xc05d }, { 4091, 0x80d0 }, /* 0x7500 */ { 4095, 0xa010 }, { 4098, 0x970a }, { 4105, 0xbb20 }, { 4112, 0x4daf }, { 4122, 0xd921 }, { 4129, 0x1e10 }, { 4134, 0x0460 }, { 4137, 0x8314 }, { 4142, 0x8848 }, { 4146, 0xa6d6 }, { 4155, 0xd83b }, { 4164, 0x733f }, { 4175, 0x27bc }, { 4184, 0x4974 }, { 4191, 0x0ddc }, { 4199, 0x9213 }, /* 0x7600 */ { 4205, 0x142b }, { 4211, 0x8ba1 }, { 4218, 0x2e75 }, { 4227, 0xd139 }, { 4235, 0x3009 }, { 4239, 0x5050 }, { 4243, 0x8808 }, { 4246, 0x6900 }, { 4250, 0x49d4 }, { 4257, 0x024a }, { 4261, 0x4010 }, { 4263, 0x8016 }, { 4267, 0xe564 }, { 4275, 0x89d7 }, { 4284, 0xc020 }, { 4287, 0x5316 }, /* 0x7700 */ { 4294, 0x2b92 }, { 4301, 0x8600 }, { 4304, 0xa345 }, { 4311, 0x15e0 }, { 4317, 0x008b }, { 4321, 0x0c03 }, { 4325, 0x196e }, { 4333, 0xe200 }, { 4337, 0x7031 }, { 4343, 0x8006 }, { 4346, 0x16a5 }, { 4353, 0xa829 }, { 4359, 0x2000 }, { 4360, 0x1880 }, { 4363, 0x7aac }, { 4372, 0xe148 }, /* 0x7800 */ { 4378, 0x3207 }, { 4384, 0xb5d6 }, { 4394, 0x32e8 }, { 4401, 0x5f91 }, { 4410, 0x50a1 }, { 4415, 0x20e5 }, { 4421, 0x7c00 }, { 4426, 0x1080 }, { 4428, 0x7280 }, { 4433, 0x9d8a }, { 4441, 0x00aa }, { 4445, 0x421f }, { 4452, 0x0e22 }, { 4457, 0x0231 }, { 4461, 0x1100 }, { 4463, 0x0494 }, /* 0x7900 */ { 4467, 0x0022 }, { 4469, 0x4008 }, { 4471, 0x0010 }, { 4472, 0x5c10 }, { 4477, 0x0343 }, { 4482, 0xfcc8 }, { 4491, 0xa1a5 }, { 4498, 0x0580 }, { 4501, 0x8433 }, { 4507, 0x0400 }, { 4508, 0x0080 }, { 4509, 0x6e08 }, { 4515, 0x2a4b }, { 4522, 0x8126 }, { 4527, 0xaad8 }, { 4535, 0x2901 }, /* 0x7a00 */ { 4539, 0x684d }, { 4546, 0x4490 }, { 4550, 0x0009 }, { 4552, 0xba88 }, { 4559, 0x0040 }, { 4560, 0x0082 }, { 4562, 0x0000 }, { 4562, 0x87d1 }, { 4570, 0x215b }, { 4577, 0xb1e6 }, { 4586, 0x3161 }, { 4592, 0x8008 }, { 4594, 0x0800 }, { 4595, 0xc240 }, { 4599, 0xa069 }, { 4605, 0xa600 }, /* 0x7b00 */ { 4609, 0x8d58 }, { 4616, 0x4a32 }, { 4622, 0x5d71 }, { 4631, 0x550a }, { 4637, 0x9aa0 }, { 4643, 0x2d57 }, { 4652, 0x4005 }, { 4655, 0x4aa6 }, { 4662, 0x2021 }, { 4665, 0x30b1 }, { 4671, 0x3fc6 }, { 4681, 0x0112 }, { 4684, 0x10c2 }, { 4688, 0x260a }, { 4693, 0x4462 }, { 4698, 0x5082 }, /* 0x7c00 */ { 4702, 0x9880 }, { 4706, 0x8040 }, { 4708, 0x04c0 }, { 4711, 0x8100 }, { 4713, 0x2003 }, { 4716, 0x0000 }, { 4716, 0x0000 }, { 4716, 0x3818 }, { 4721, 0x0200 }, { 4722, 0xf1a6 }, { 4731, 0x4434 }, { 4736, 0x720e }, { 4743, 0x35a2 }, { 4750, 0x92e0 }, { 4756, 0x8101 }, { 4759, 0x0900 }, /* 0x7d00 */ { 4761, 0x0400 }, { 4762, 0x0000 }, { 4762, 0x8885 }, { 4767, 0x0000 }, { 4767, 0x0000 }, { 4767, 0x0000 }, { 4767, 0x4000 }, { 4768, 0x0080 }, { 4769, 0x0000 }, { 4769, 0x0000 }, { 4769, 0x4040 }, { 4771, 0x0000 }, { 4771, 0x0000 }, { 4771, 0x0000 }, { 4771, 0x0000 }, { 4771, 0x0000 }, /* 0x7e00 */ { 4771, 0x0000 }, { 4771, 0x0000 }, { 4771, 0x0000 }, { 4771, 0x0800 }, { 4772, 0x0082 }, { 4774, 0x0000 }, { 4774, 0x0000 }, { 4774, 0x0000 }, { 4774, 0x0004 }, { 4775, 0x8800 }, { 4777, 0xbfff }, { 4792, 0xe7ef }, { 4805, 0xffff }, { 4821, 0xffbf }, { 4836, 0xefef }, { 4850, 0xfdff }, /* 0x7f00 */ { 4865, 0xfbff }, { 4880, 0xbffe }, { 4894, 0xffff }, { 4910, 0x057f }, { 4919, 0x0034 }, { 4922, 0x85b3 }, { 4930, 0x4706 }, { 4936, 0x4216 }, { 4941, 0x5402 }, { 4945, 0xe410 }, { 4950, 0x8092 }, { 4954, 0xb305 }, { 4961, 0x5422 }, { 4966, 0x8130 }, { 4970, 0x4263 }, { 4976, 0x180b }, /* 0x8000 */ { 4981, 0x387b }, { 4990, 0x13f5 }, { 4999, 0x07e5 }, { 5007, 0xa9ea }, { 5016, 0x3c4c }, { 5023, 0x0514 }, { 5027, 0x0600 }, { 5029, 0x8002 }, { 5031, 0x1ad9 }, { 5039, 0xbd48 }, { 5047, 0xee37 }, { 5058, 0xf496 }, { 5067, 0x705f }, { 5076, 0x7ec0 }, { 5084, 0xbfb2 }, { 5095, 0x355f }, /* 0x8100 */ { 5105, 0xe644 }, { 5112, 0x455f }, { 5121, 0x9000 }, { 5123, 0x4146 }, { 5128, 0x1d40 }, { 5133, 0x063b }, { 5140, 0x62a1 }, { 5146, 0xfe13 }, { 5156, 0x8505 }, { 5161, 0x3902 }, { 5166, 0x0548 }, { 5170, 0x0c08 }, { 5173, 0x144f }, { 5180, 0x0000 }, { 5180, 0x3488 }, { 5185, 0x5818 }, /* 0x8200 */ { 5190, 0x3077 }, { 5198, 0xd815 }, { 5205, 0xbd0e }, { 5214, 0x4bfb }, { 5225, 0x8a90 }, { 5230, 0x8500 }, { 5233, 0xc100 }, { 5236, 0xe61d }, { 5245, 0xed14 }, { 5253, 0xb386 }, { 5261, 0xff72 }, { 5273, 0x639b }, { 5282, 0xfd92 }, { 5292, 0xd9be }, { 5303, 0x887b }, { 5311, 0x0a92 }, /* 0x8300 */ { 5316, 0xd3fe }, { 5328, 0x1cb2 }, { 5335, 0xb980 }, { 5341, 0x177a }, { 5350, 0x82c9 }, { 5356, 0xdc17 }, { 5365, 0xfffb }, { 5380, 0x3980 }, { 5385, 0x4260 }, { 5389, 0x590c }, { 5395, 0x0f01 }, { 5400, 0x37df }, { 5412, 0x94a3 }, { 5419, 0xb150 }, { 5425, 0x0623 }, { 5430, 0x2307 }, /* 0x8400 */ { 5436, 0xf85a }, { 5445, 0x3102 }, { 5449, 0x01f0 }, { 5454, 0x3102 }, { 5458, 0x0040 }, { 5459, 0x1e82 }, { 5465, 0x3a0a }, { 5471, 0x056a }, { 5477, 0x5b84 }, { 5484, 0x1280 }, { 5487, 0x8002 }, { 5489, 0xa714 }, { 5496, 0x2612 }, { 5501, 0xa04b }, { 5507, 0x1069 }, { 5512, 0x9001 }, /* 0x8500 */ { 5515, 0x1000 }, { 5516, 0x848a }, { 5521, 0x1802 }, { 5524, 0x3f80 }, { 5531, 0x0708 }, { 5535, 0x4240 }, { 5538, 0x0110 }, { 5540, 0x4e14 }, { 5546, 0x80b0 }, { 5550, 0x1800 }, { 5552, 0xc510 }, { 5557, 0x0281 }, { 5560, 0x8202 }, { 5563, 0x1029 }, { 5567, 0x0210 }, { 5569, 0x8800 }, /* 0x8600 */ { 5571, 0x0020 }, { 5572, 0x0042 }, { 5574, 0x0280 }, { 5576, 0x1100 }, { 5578, 0xe000 }, { 5581, 0x4413 }, { 5586, 0x5804 }, { 5590, 0xfe02 }, { 5598, 0x3c07 }, { 5605, 0x3028 }, { 5609, 0x9798 }, { 5617, 0x0473 }, { 5623, 0xced1 }, { 5632, 0xcb13 }, { 5640, 0x6210 }, { 5644, 0x431f }, /* 0x8700 */ { 5652, 0x278d }, { 5660, 0x55ac }, { 5668, 0x422e }, { 5674, 0xc892 }, { 5680, 0x5380 }, { 5685, 0x0288 }, { 5688, 0x4039 }, { 5693, 0x7851 }, { 5700, 0x292c }, { 5706, 0x8088 }, { 5709, 0xb900 }, { 5714, 0x2428 }, { 5718, 0x0c41 }, { 5722, 0x080e }, { 5726, 0x4421 }, { 5730, 0x4200 }, /* 0x8800 */ { 5732, 0x0408 }, { 5734, 0x0868 }, { 5738, 0x0006 }, { 5740, 0x1204 }, { 5743, 0x3031 }, { 5748, 0x0290 }, { 5751, 0x5b3e }, { 5761, 0xe085 }, { 5767, 0x2936 }, { 5774, 0x1044 }, { 5777, 0x2814 }, { 5781, 0x1082 }, { 5784, 0x4266 }, { 5790, 0x8334 }, { 5796, 0x013c }, { 5801, 0x531b }, /* 0x8900 */ { 5809, 0x0404 }, { 5811, 0x0e0d }, { 5817, 0x0c22 }, { 5821, 0x0051 }, { 5824, 0x0012 }, { 5826, 0xc000 }, { 5828, 0x0040 }, { 5829, 0x8800 }, { 5831, 0x004a }, { 5834, 0x0000 }, { 5834, 0x0000 }, { 5834, 0x0000 }, { 5834, 0xdff6 }, { 5847, 0x5447 }, { 5854, 0x8868 }, { 5859, 0x0008 }, /* 0x8a00 */ { 5860, 0x0081 }, { 5862, 0x0000 }, { 5862, 0x0000 }, { 5862, 0x4000 }, { 5863, 0x0100 }, { 5864, 0x0000 }, { 5864, 0x0000 }, { 5864, 0x0200 }, { 5865, 0x0600 }, { 5867, 0x0008 }, { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, /* 0x8b00 */ { 5868, 0x0080 }, { 5869, 0x0000 }, { 5869, 0x0040 }, { 5870, 0x0000 }, { 5870, 0x0000 }, { 5870, 0x0000 }, { 5870, 0x1040 }, { 5872, 0x0000 }, { 5872, 0x0000 }, { 5872, 0x0000 }, { 5872, 0xefff }, { 5887, 0xf7fd }, { 5901, 0xff7f }, { 5916, 0xfffe }, { 5931, 0xfbff }, { 5946, 0xffff }, /* 0x8c00 */ { 5962, 0xfdff }, { 5977, 0xbfff }, { 5992, 0xffff }, { 6008, 0x00ff }, { 6016, 0x12c2 }, { 6021, 0x0420 }, { 6023, 0x0c06 }, { 6027, 0x0708 }, { 6031, 0x1624 }, { 6036, 0x0110 }, { 6038, 0x0000 }, { 6038, 0x0000 }, { 6038, 0x0000 }, { 6038, 0x0000 }, { 6038, 0x0000 }, { 6038, 0x0000 }, /* 0x8d00 */ { 6038, 0x0000 }, { 6038, 0xe000 }, { 6041, 0xfffe }, { 6056, 0xffff }, { 6072, 0xffff }, { 6088, 0x7f79 }, { 6100, 0x28df }, { 6109, 0x00f9 }, { 6115, 0x0c32 }, { 6120, 0x8012 }, { 6123, 0x0008 }, { 6124, 0xd53a }, { 6133, 0xd858 }, { 6140, 0xecc2 }, { 6148, 0x9d18 }, { 6155, 0x2fa8 }, /* 0x8e00 */ { 6163, 0x9620 }, { 6168, 0xe010 }, { 6172, 0xd60c }, { 6179, 0x2622 }, { 6184, 0x0f97 }, { 6193, 0x0206 }, { 6196, 0xb240 }, { 6201, 0x9055 }, { 6207, 0x80a2 }, { 6211, 0x5011 }, { 6215, 0x9800 }, { 6218, 0x0404 }, { 6220, 0x4000 }, { 6221, 0x0000 }, { 6221, 0x0000 }, { 6221, 0x0000 }, /* 0x8f00 */ { 6221, 0x0000 }, { 6221, 0x0000 }, { 6221, 0x0000 }, { 6221, 0x0000 }, { 6221, 0x0000 }, { 6221, 0x0000 }, { 6221, 0xfbc0 }, { 6230, 0xffff }, { 6246, 0xeffe }, { 6260, 0xdffb }, { 6274, 0x0b08 }, { 6278, 0x6243 }, { 6284, 0x41b6 }, { 6291, 0xfb3b }, { 6303, 0x6f74 }, { 6313, 0x2389 }, /* 0x9000 */ { 6319, 0xae7f }, { 6331, 0xecd7 }, { 6342, 0xe047 }, { 6349, 0x5960 }, { 6355, 0xa096 }, { 6361, 0x098f }, { 6368, 0x612c }, { 6374, 0xa030 }, { 6378, 0x090d }, { 6383, 0x2aaa }, { 6390, 0xd44e }, { 6398, 0x4f7b }, { 6409, 0xc4b2 }, { 6416, 0x388b }, { 6423, 0xa9c6 }, { 6431, 0x6110 }, /* 0x9100 */ { 6435, 0x0014 }, { 6437, 0x4200 }, { 6439, 0x800c }, { 6442, 0x0202 }, { 6444, 0xfe48 }, { 6453, 0x6485 }, { 6459, 0xd63e }, { 6469, 0xe3f7 }, { 6481, 0x3aa0 }, { 6487, 0x0c07 }, { 6492, 0xe40c }, { 6498, 0x0430 }, { 6501, 0xf680 }, { 6508, 0x1002 }, { 6510, 0x0000 }, { 6510, 0x0000 }, /* 0x9200 */ { 6510, 0x0000 }, { 6510, 0x0000 }, { 6510, 0x0000 }, { 6510, 0x0000 }, { 6510, 0x0000 }, { 6510, 0x0000 }, { 6510, 0x0000 }, { 6510, 0x0010 }, { 6511, 0x4000 }, { 6512, 0x0000 }, { 6512, 0x4000 }, { 6513, 0x0000 }, { 6513, 0x0100 }, { 6514, 0x0000 }, { 6514, 0x0000 }, { 6514, 0x0000 }, /* 0x9300 */ { 6514, 0x0000 }, { 6514, 0x0000 }, { 6514, 0x0000 }, { 6514, 0x4000 }, { 6515, 0x0000 }, { 6515, 0x0000 }, { 6515, 0x0400 }, { 6516, 0x0000 }, { 6516, 0x8000 }, { 6517, 0x0000 }, { 6517, 0x0000 }, { 6517, 0x0000 }, { 6517, 0x0400 }, { 6518, 0x0040 }, { 6519, 0x0000 }, { 6519, 0x0000 }, /* 0x9400 */ { 6519, 0x0000 }, { 6519, 0x0000 }, { 6519, 0x0000 }, { 6519, 0x4000 }, { 6520, 0x0000 }, { 6520, 0x0000 }, { 6520, 0x0800 }, { 6521, 0x0000 }, { 6521, 0xffe0 }, { 6532, 0xfebd }, { 6545, 0xffff }, { 6561, 0xffff }, { 6577, 0x7f7f }, { 6591, 0xfbe7 }, { 6604, 0xffbf }, { 6619, 0xf7ff }, /* 0x9500 */ { 6634, 0xffff }, { 6650, 0xefff }, { 6665, 0xff7e }, { 6679, 0xdff7 }, { 6693, 0xf6f7 }, { 6706, 0xfbdf }, { 6720, 0xbffe }, { 6734, 0x804f }, { 6740, 0x0000 }, { 6740, 0x0000 }, { 6740, 0x0000 }, { 6740, 0x0000 }, { 6740, 0x0000 }, { 6740, 0x0000 }, { 6740, 0xef00 }, { 6747, 0x7fff }, /* 0x9600 */ { 6762, 0xff7f }, { 6777, 0xb6f7 }, { 6789, 0x4406 }, { 6793, 0xb87e }, { 6803, 0x3bf5 }, { 6814, 0x8831 }, { 6819, 0x1796 }, { 6827, 0x00f4 }, { 6832, 0xa960 }, { 6838, 0x1391 }, { 6844, 0x0080 }, { 6845, 0x7249 }, { 6852, 0xf2f3 }, { 6863, 0x0024 }, { 6865, 0x8701 }, { 6870, 0x42c8 }, /* 0x9700 */ { 6875, 0xe3d3 }, { 6885, 0x5048 }, { 6889, 0x2400 }, { 6891, 0x4305 }, { 6896, 0x0000 }, { 6896, 0x4a4c }, { 6902, 0x0227 }, { 6907, 0x1058 }, { 6911, 0x2820 }, { 6914, 0x0116 }, { 6918, 0xa809 }, { 6923, 0x0014 }, { 6925, 0x0000 }, { 6925, 0x0000 }, { 6925, 0x3ec0 }, { 6932, 0x0068 }, /* 0x9800 */ { 6935, 0x0000 }, { 6935, 0x0000 }, { 6935, 0x0000 }, { 6935, 0x0000 }, { 6935, 0x0000 }, { 6935, 0x0000 }, { 6935, 0x0000 }, { 6935, 0xffe0 }, { 6946, 0xb7ff }, { 6960, 0xfddb }, { 6973, 0x00f7 }, { 6980, 0x0000 }, { 6980, 0x4000 }, { 6981, 0xc72e }, { 6990, 0x0180 }, { 6992, 0x0000 }, /* 0x9900 */ { 6992, 0x2000 }, { 6993, 0x0001 }, { 6994, 0x4000 }, { 6995, 0x0000 }, { 6995, 0x0000 }, { 6995, 0x0030 }, { 6997, 0xffa8 }, { 7008, 0xb4f7 }, { 7019, 0xadf3 }, { 7030, 0x03ff }, { 7040, 0x0120 }, { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, /* 0x9a00 */ { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0xf000 }, { 7046, 0xfffb }, { 7061, 0x9df7 }, { 7073, 0xfdcf }, { 7086, 0x01bf }, { 7094, 0x15c3 }, { 7101, 0x1827 }, { 7107, 0x810a }, { 7111, 0xa842 }, { 7116, 0x0a00 }, /* 0x9b00 */ { 7118, 0x8108 }, { 7121, 0x8008 }, { 7123, 0x8008 }, { 7125, 0x1804 }, { 7128, 0xa3be }, { 7138, 0x0012 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, /* 0x9c00 */ { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x9000 }, { 7142, 0x69e6 }, { 7151, 0xdc37 }, { 7161, 0x6bff }, { 7174, 0x3dff }, { 7187, 0xfcf8 }, { 7198, 0xf3f9 }, { 7210, 0x0004 }, }; static const Summary16 gb2312_uni2indx_page9e[27] = { /* 0x9e00 */ { 7211, 0x0000 }, { 7211, 0x8000 }, { 7212, 0xbf6f }, { 7225, 0xe7ee }, { 7237, 0xdffe }, { 7251, 0x5da2 }, { 7259, 0x3fd8 }, { 7269, 0xc00b }, { 7274, 0x0984 }, { 7278, 0xa00c }, { 7282, 0x0040 }, { 7283, 0x6910 }, { 7288, 0xe210 }, { 7293, 0xb912 }, { 7300, 0x86a5 }, { 7307, 0x5a00 }, /* 0x9f00 */ { 7311, 0x6800 }, { 7314, 0x0289 }, { 7318, 0x9005 }, { 7322, 0x6a80 }, { 7327, 0x0010 }, { 7328, 0x0003 }, { 7330, 0x0000 }, { 7330, 0x8000 }, { 7331, 0x1ff9 }, { 7342, 0x8e00 }, { 7346, 0x0001 }, }; static const Summary16 gb2312_uni2indx_pageff[15] = { /* 0xff00 */ { 7347, 0xfffe }, { 7362, 0xffff }, { 7378, 0xffff }, { 7394, 0xffff }, { 7410, 0xffff }, { 7426, 0x7fff }, { 7441, 0x0000 }, { 7441, 0x0000 }, { 7441, 0x0000 }, { 7441, 0x0000 }, { 7441, 0x0000 }, { 7441, 0x0000 }, { 7441, 0x0000 }, { 7441, 0x0000 }, { 7441, 0x002b }, }; static int gb2312_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { if (n >= 2) { const Summary16 *summary = NULL; if (wc < 0x0460) summary = &gb2312_uni2indx_page00[(wc>>4)]; else if (wc >= 0x2000 && wc < 0x2650) summary = &gb2312_uni2indx_page20[(wc>>4)-0x200]; else if (wc >= 0x3000 && wc < 0x3230) summary = &gb2312_uni2indx_page30[(wc>>4)-0x300]; else if (wc >= 0x4e00 && wc < 0x9cf0) summary = &gb2312_uni2indx_page4e[(wc>>4)-0x4e0]; else if (wc >= 0x9e00 && wc < 0x9fb0) summary = &gb2312_uni2indx_page9e[(wc>>4)-0x9e0]; else if (wc >= 0xff00 && wc < 0xfff0) summary = &gb2312_uni2indx_pageff[(wc>>4)-0xff0]; if (summary) { unsigned short used = summary->used; unsigned int i = wc & 0x0f; if (used & ((unsigned short) 1 << i)) { unsigned short c; /* Keep in `used' only the bits 0..i-1. */ used &= ((unsigned short) 1 << i) - 1; /* Add `summary->indx' and the number of bits set in `used'. */ used = (used & 0x5555) + ((used & 0xaaaa) >> 1); used = (used & 0x3333) + ((used & 0xcccc) >> 2); used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); used = (used & 0x00ff) + (used >> 8); c = gb2312_2charset[summary->indx + used]; r[0] = (c >> 8); r[1] = (c & 0xff); return 2; } } return RET_ILSEQ; } return RET_TOOSMALL; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/gbk.h0000644000000000000000000151106013614532331017116 0ustar /* * GBK-0 */ static const unsigned short gbk_2uni_page81[23766] = { /* 0x81 */ 0x4e02, 0x4e04, 0x4e05, 0x4e06, 0x4e0f, 0x4e12, 0x4e17, 0x4e1f, 0x4e20, 0x4e21, 0x4e23, 0x4e26, 0x4e29, 0x4e2e, 0x4e2f, 0x4e31, 0x4e33, 0x4e35, 0x4e37, 0x4e3c, 0x4e40, 0x4e41, 0x4e42, 0x4e44, 0x4e46, 0x4e4a, 0x4e51, 0x4e55, 0x4e57, 0x4e5a, 0x4e5b, 0x4e62, 0x4e63, 0x4e64, 0x4e65, 0x4e67, 0x4e68, 0x4e6a, 0x4e6b, 0x4e6c, 0x4e6d, 0x4e6e, 0x4e6f, 0x4e72, 0x4e74, 0x4e75, 0x4e76, 0x4e77, 0x4e78, 0x4e79, 0x4e7a, 0x4e7b, 0x4e7c, 0x4e7d, 0x4e7f, 0x4e80, 0x4e81, 0x4e82, 0x4e83, 0x4e84, 0x4e85, 0x4e87, 0x4e8a, 0x4e90, 0x4e96, 0x4e97, 0x4e99, 0x4e9c, 0x4e9d, 0x4e9e, 0x4ea3, 0x4eaa, 0x4eaf, 0x4eb0, 0x4eb1, 0x4eb4, 0x4eb6, 0x4eb7, 0x4eb8, 0x4eb9, 0x4ebc, 0x4ebd, 0x4ebe, 0x4ec8, 0x4ecc, 0x4ecf, 0x4ed0, 0x4ed2, 0x4eda, 0x4edb, 0x4edc, 0x4ee0, 0x4ee2, 0x4ee6, 0x4ee7, 0x4ee9, 0x4eed, 0x4eee, 0x4eef, 0x4ef1, 0x4ef4, 0x4ef8, 0x4ef9, 0x4efa, 0x4efc, 0x4efe, 0x4f00, 0x4f02, 0x4f03, 0x4f04, 0x4f05, 0x4f06, 0x4f07, 0x4f08, 0x4f0b, 0x4f0c, 0x4f12, 0x4f13, 0x4f14, 0x4f15, 0x4f16, 0x4f1c, 0x4f1d, 0x4f21, 0x4f23, 0x4f28, 0x4f29, 0x4f2c, 0x4f2d, 0x4f2e, 0x4f31, 0x4f33, 0x4f35, 0x4f37, 0x4f39, 0x4f3b, 0x4f3e, 0x4f3f, 0x4f40, 0x4f41, 0x4f42, 0x4f44, 0x4f45, 0x4f47, 0x4f48, 0x4f49, 0x4f4a, 0x4f4b, 0x4f4c, 0x4f52, 0x4f54, 0x4f56, 0x4f61, 0x4f62, 0x4f66, 0x4f68, 0x4f6a, 0x4f6b, 0x4f6d, 0x4f6e, 0x4f71, 0x4f72, 0x4f75, 0x4f77, 0x4f78, 0x4f79, 0x4f7a, 0x4f7d, 0x4f80, 0x4f81, 0x4f82, 0x4f85, 0x4f86, 0x4f87, 0x4f8a, 0x4f8c, 0x4f8e, 0x4f90, 0x4f92, 0x4f93, 0x4f95, 0x4f96, 0x4f98, 0x4f99, 0x4f9a, 0x4f9c, 0x4f9e, 0x4f9f, 0x4fa1, 0x4fa2, /* 0x82 */ 0x4fa4, 0x4fab, 0x4fad, 0x4fb0, 0x4fb1, 0x4fb2, 0x4fb3, 0x4fb4, 0x4fb6, 0x4fb7, 0x4fb8, 0x4fb9, 0x4fba, 0x4fbb, 0x4fbc, 0x4fbd, 0x4fbe, 0x4fc0, 0x4fc1, 0x4fc2, 0x4fc6, 0x4fc7, 0x4fc8, 0x4fc9, 0x4fcb, 0x4fcc, 0x4fcd, 0x4fd2, 0x4fd3, 0x4fd4, 0x4fd5, 0x4fd6, 0x4fd9, 0x4fdb, 0x4fe0, 0x4fe2, 0x4fe4, 0x4fe5, 0x4fe7, 0x4feb, 0x4fec, 0x4ff0, 0x4ff2, 0x4ff4, 0x4ff5, 0x4ff6, 0x4ff7, 0x4ff9, 0x4ffb, 0x4ffc, 0x4ffd, 0x4fff, 0x5000, 0x5001, 0x5002, 0x5003, 0x5004, 0x5005, 0x5006, 0x5007, 0x5008, 0x5009, 0x500a, 0x500b, 0x500e, 0x5010, 0x5011, 0x5013, 0x5015, 0x5016, 0x5017, 0x501b, 0x501d, 0x501e, 0x5020, 0x5022, 0x5023, 0x5024, 0x5027, 0x502b, 0x502f, 0x5030, 0x5031, 0x5032, 0x5033, 0x5034, 0x5035, 0x5036, 0x5037, 0x5038, 0x5039, 0x503b, 0x503d, 0x503f, 0x5040, 0x5041, 0x5042, 0x5044, 0x5045, 0x5046, 0x5049, 0x504a, 0x504b, 0x504d, 0x5050, 0x5051, 0x5052, 0x5053, 0x5054, 0x5056, 0x5057, 0x5058, 0x5059, 0x505b, 0x505d, 0x505e, 0x505f, 0x5060, 0x5061, 0x5062, 0x5063, 0x5064, 0x5066, 0x5067, 0x5068, 0x5069, 0x506a, 0x506b, 0x506d, 0x506e, 0x506f, 0x5070, 0x5071, 0x5072, 0x5073, 0x5074, 0x5075, 0x5078, 0x5079, 0x507a, 0x507c, 0x507d, 0x5081, 0x5082, 0x5083, 0x5084, 0x5086, 0x5087, 0x5089, 0x508a, 0x508b, 0x508c, 0x508e, 0x508f, 0x5090, 0x5091, 0x5092, 0x5093, 0x5094, 0x5095, 0x5096, 0x5097, 0x5098, 0x5099, 0x509a, 0x509b, 0x509c, 0x509d, 0x509e, 0x509f, 0x50a0, 0x50a1, 0x50a2, 0x50a4, 0x50a6, 0x50aa, 0x50ab, 0x50ad, 0x50ae, 0x50af, 0x50b0, 0x50b1, 0x50b3, 0x50b4, 0x50b5, 0x50b6, 0x50b7, 0x50b8, 0x50b9, 0x50bc, /* 0x83 */ 0x50bd, 0x50be, 0x50bf, 0x50c0, 0x50c1, 0x50c2, 0x50c3, 0x50c4, 0x50c5, 0x50c6, 0x50c7, 0x50c8, 0x50c9, 0x50ca, 0x50cb, 0x50cc, 0x50cd, 0x50ce, 0x50d0, 0x50d1, 0x50d2, 0x50d3, 0x50d4, 0x50d5, 0x50d7, 0x50d8, 0x50d9, 0x50db, 0x50dc, 0x50dd, 0x50de, 0x50df, 0x50e0, 0x50e1, 0x50e2, 0x50e3, 0x50e4, 0x50e5, 0x50e8, 0x50e9, 0x50ea, 0x50eb, 0x50ef, 0x50f0, 0x50f1, 0x50f2, 0x50f4, 0x50f6, 0x50f7, 0x50f8, 0x50f9, 0x50fa, 0x50fc, 0x50fd, 0x50fe, 0x50ff, 0x5100, 0x5101, 0x5102, 0x5103, 0x5104, 0x5105, 0x5108, 0x5109, 0x510a, 0x510c, 0x510d, 0x510e, 0x510f, 0x5110, 0x5111, 0x5113, 0x5114, 0x5115, 0x5116, 0x5117, 0x5118, 0x5119, 0x511a, 0x511b, 0x511c, 0x511d, 0x511e, 0x511f, 0x5120, 0x5122, 0x5123, 0x5124, 0x5125, 0x5126, 0x5127, 0x5128, 0x5129, 0x512a, 0x512b, 0x512c, 0x512d, 0x512e, 0x512f, 0x5130, 0x5131, 0x5132, 0x5133, 0x5134, 0x5135, 0x5136, 0x5137, 0x5138, 0x5139, 0x513a, 0x513b, 0x513c, 0x513d, 0x513e, 0x5142, 0x5147, 0x514a, 0x514c, 0x514e, 0x514f, 0x5150, 0x5152, 0x5153, 0x5157, 0x5158, 0x5159, 0x515b, 0x515d, 0x515e, 0x515f, 0x5160, 0x5161, 0x5163, 0x5164, 0x5166, 0x5167, 0x5169, 0x516a, 0x516f, 0x5172, 0x517a, 0x517e, 0x517f, 0x5183, 0x5184, 0x5186, 0x5187, 0x518a, 0x518b, 0x518e, 0x518f, 0x5190, 0x5191, 0x5193, 0x5194, 0x5198, 0x519a, 0x519d, 0x519e, 0x519f, 0x51a1, 0x51a3, 0x51a6, 0x51a7, 0x51a8, 0x51a9, 0x51aa, 0x51ad, 0x51ae, 0x51b4, 0x51b8, 0x51b9, 0x51ba, 0x51be, 0x51bf, 0x51c1, 0x51c2, 0x51c3, 0x51c5, 0x51c8, 0x51ca, 0x51cd, 0x51ce, 0x51d0, 0x51d2, 0x51d3, 0x51d4, 0x51d5, 0x51d6, 0x51d7, /* 0x84 */ 0x51d8, 0x51d9, 0x51da, 0x51dc, 0x51de, 0x51df, 0x51e2, 0x51e3, 0x51e5, 0x51e6, 0x51e7, 0x51e8, 0x51e9, 0x51ea, 0x51ec, 0x51ee, 0x51f1, 0x51f2, 0x51f4, 0x51f7, 0x51fe, 0x5204, 0x5205, 0x5209, 0x520b, 0x520c, 0x520f, 0x5210, 0x5213, 0x5214, 0x5215, 0x521c, 0x521e, 0x521f, 0x5221, 0x5222, 0x5223, 0x5225, 0x5226, 0x5227, 0x522a, 0x522c, 0x522f, 0x5231, 0x5232, 0x5234, 0x5235, 0x523c, 0x523e, 0x5244, 0x5245, 0x5246, 0x5247, 0x5248, 0x5249, 0x524b, 0x524e, 0x524f, 0x5252, 0x5253, 0x5255, 0x5257, 0x5258, 0x5259, 0x525a, 0x525b, 0x525d, 0x525f, 0x5260, 0x5262, 0x5263, 0x5264, 0x5266, 0x5268, 0x526b, 0x526c, 0x526d, 0x526e, 0x5270, 0x5271, 0x5273, 0x5274, 0x5275, 0x5276, 0x5277, 0x5278, 0x5279, 0x527a, 0x527b, 0x527c, 0x527e, 0x5280, 0x5283, 0x5284, 0x5285, 0x5286, 0x5287, 0x5289, 0x528a, 0x528b, 0x528c, 0x528d, 0x528e, 0x528f, 0x5291, 0x5292, 0x5294, 0x5295, 0x5296, 0x5297, 0x5298, 0x5299, 0x529a, 0x529c, 0x52a4, 0x52a5, 0x52a6, 0x52a7, 0x52ae, 0x52af, 0x52b0, 0x52b4, 0x52b5, 0x52b6, 0x52b7, 0x52b8, 0x52b9, 0x52ba, 0x52bb, 0x52bc, 0x52bd, 0x52c0, 0x52c1, 0x52c2, 0x52c4, 0x52c5, 0x52c6, 0x52c8, 0x52ca, 0x52cc, 0x52cd, 0x52ce, 0x52cf, 0x52d1, 0x52d3, 0x52d4, 0x52d5, 0x52d7, 0x52d9, 0x52da, 0x52db, 0x52dc, 0x52dd, 0x52de, 0x52e0, 0x52e1, 0x52e2, 0x52e3, 0x52e5, 0x52e6, 0x52e7, 0x52e8, 0x52e9, 0x52ea, 0x52eb, 0x52ec, 0x52ed, 0x52ee, 0x52ef, 0x52f1, 0x52f2, 0x52f3, 0x52f4, 0x52f5, 0x52f6, 0x52f7, 0x52f8, 0x52fb, 0x52fc, 0x52fd, 0x5301, 0x5302, 0x5303, 0x5304, 0x5307, 0x5309, 0x530a, 0x530b, 0x530c, 0x530e, /* 0x85 */ 0x5311, 0x5312, 0x5313, 0x5314, 0x5318, 0x531b, 0x531c, 0x531e, 0x531f, 0x5322, 0x5324, 0x5325, 0x5327, 0x5328, 0x5329, 0x532b, 0x532c, 0x532d, 0x532f, 0x5330, 0x5331, 0x5332, 0x5333, 0x5334, 0x5335, 0x5336, 0x5337, 0x5338, 0x533c, 0x533d, 0x5340, 0x5342, 0x5344, 0x5346, 0x534b, 0x534c, 0x534d, 0x5350, 0x5354, 0x5358, 0x5359, 0x535b, 0x535d, 0x5365, 0x5368, 0x536a, 0x536c, 0x536d, 0x5372, 0x5376, 0x5379, 0x537b, 0x537c, 0x537d, 0x537e, 0x5380, 0x5381, 0x5383, 0x5387, 0x5388, 0x538a, 0x538e, 0x538f, 0x5390, 0x5391, 0x5392, 0x5393, 0x5394, 0x5396, 0x5397, 0x5399, 0x539b, 0x539c, 0x539e, 0x53a0, 0x53a1, 0x53a4, 0x53a7, 0x53aa, 0x53ab, 0x53ac, 0x53ad, 0x53af, 0x53b0, 0x53b1, 0x53b2, 0x53b3, 0x53b4, 0x53b5, 0x53b7, 0x53b8, 0x53b9, 0x53ba, 0x53bc, 0x53bd, 0x53be, 0x53c0, 0x53c3, 0x53c4, 0x53c5, 0x53c6, 0x53c7, 0x53ce, 0x53cf, 0x53d0, 0x53d2, 0x53d3, 0x53d5, 0x53da, 0x53dc, 0x53dd, 0x53de, 0x53e1, 0x53e2, 0x53e7, 0x53f4, 0x53fa, 0x53fe, 0x53ff, 0x5400, 0x5402, 0x5405, 0x5407, 0x540b, 0x5414, 0x5418, 0x5419, 0x541a, 0x541c, 0x5422, 0x5424, 0x5425, 0x542a, 0x5430, 0x5433, 0x5436, 0x5437, 0x543a, 0x543d, 0x543f, 0x5441, 0x5442, 0x5444, 0x5445, 0x5447, 0x5449, 0x544c, 0x544d, 0x544e, 0x544f, 0x5451, 0x545a, 0x545d, 0x545e, 0x545f, 0x5460, 0x5461, 0x5463, 0x5465, 0x5467, 0x5469, 0x546a, 0x546b, 0x546c, 0x546d, 0x546e, 0x546f, 0x5470, 0x5474, 0x5479, 0x547a, 0x547e, 0x547f, 0x5481, 0x5483, 0x5485, 0x5487, 0x5488, 0x5489, 0x548a, 0x548d, 0x5491, 0x5493, 0x5497, 0x5498, 0x549c, 0x549e, 0x549f, 0x54a0, 0x54a1, /* 0x86 */ 0x54a2, 0x54a5, 0x54ae, 0x54b0, 0x54b2, 0x54b5, 0x54b6, 0x54b7, 0x54b9, 0x54ba, 0x54bc, 0x54be, 0x54c3, 0x54c5, 0x54ca, 0x54cb, 0x54d6, 0x54d8, 0x54db, 0x54e0, 0x54e1, 0x54e2, 0x54e3, 0x54e4, 0x54eb, 0x54ec, 0x54ef, 0x54f0, 0x54f1, 0x54f4, 0x54f5, 0x54f6, 0x54f7, 0x54f8, 0x54f9, 0x54fb, 0x54fe, 0x5500, 0x5502, 0x5503, 0x5504, 0x5505, 0x5508, 0x550a, 0x550b, 0x550c, 0x550d, 0x550e, 0x5512, 0x5513, 0x5515, 0x5516, 0x5517, 0x5518, 0x5519, 0x551a, 0x551c, 0x551d, 0x551e, 0x551f, 0x5521, 0x5525, 0x5526, 0x5528, 0x5529, 0x552b, 0x552d, 0x5532, 0x5534, 0x5535, 0x5536, 0x5538, 0x5539, 0x553a, 0x553b, 0x553d, 0x5540, 0x5542, 0x5545, 0x5547, 0x5548, 0x554b, 0x554c, 0x554d, 0x554e, 0x554f, 0x5551, 0x5552, 0x5553, 0x5554, 0x5557, 0x5558, 0x5559, 0x555a, 0x555b, 0x555d, 0x555e, 0x555f, 0x5560, 0x5562, 0x5563, 0x5568, 0x5569, 0x556b, 0x556f, 0x5570, 0x5571, 0x5572, 0x5573, 0x5574, 0x5579, 0x557a, 0x557d, 0x557f, 0x5585, 0x5586, 0x558c, 0x558d, 0x558e, 0x5590, 0x5592, 0x5593, 0x5595, 0x5596, 0x5597, 0x559a, 0x559b, 0x559e, 0x55a0, 0x55a1, 0x55a2, 0x55a3, 0x55a4, 0x55a5, 0x55a6, 0x55a8, 0x55a9, 0x55aa, 0x55ab, 0x55ac, 0x55ad, 0x55ae, 0x55af, 0x55b0, 0x55b2, 0x55b4, 0x55b6, 0x55b8, 0x55ba, 0x55bc, 0x55bf, 0x55c0, 0x55c1, 0x55c2, 0x55c3, 0x55c6, 0x55c7, 0x55c8, 0x55ca, 0x55cb, 0x55ce, 0x55cf, 0x55d0, 0x55d5, 0x55d7, 0x55d8, 0x55d9, 0x55da, 0x55db, 0x55de, 0x55e0, 0x55e2, 0x55e7, 0x55e9, 0x55ed, 0x55ee, 0x55f0, 0x55f1, 0x55f4, 0x55f6, 0x55f8, 0x55f9, 0x55fa, 0x55fb, 0x55fc, 0x55ff, 0x5602, 0x5603, 0x5604, 0x5605, /* 0x87 */ 0x5606, 0x5607, 0x560a, 0x560b, 0x560d, 0x5610, 0x5611, 0x5612, 0x5613, 0x5614, 0x5615, 0x5616, 0x5617, 0x5619, 0x561a, 0x561c, 0x561d, 0x5620, 0x5621, 0x5622, 0x5625, 0x5626, 0x5628, 0x5629, 0x562a, 0x562b, 0x562e, 0x562f, 0x5630, 0x5633, 0x5635, 0x5637, 0x5638, 0x563a, 0x563c, 0x563d, 0x563e, 0x5640, 0x5641, 0x5642, 0x5643, 0x5644, 0x5645, 0x5646, 0x5647, 0x5648, 0x5649, 0x564a, 0x564b, 0x564f, 0x5650, 0x5651, 0x5652, 0x5653, 0x5655, 0x5656, 0x565a, 0x565b, 0x565d, 0x565e, 0x565f, 0x5660, 0x5661, 0x5663, 0x5665, 0x5666, 0x5667, 0x566d, 0x566e, 0x566f, 0x5670, 0x5672, 0x5673, 0x5674, 0x5675, 0x5677, 0x5678, 0x5679, 0x567a, 0x567d, 0x567e, 0x567f, 0x5680, 0x5681, 0x5682, 0x5683, 0x5684, 0x5687, 0x5688, 0x5689, 0x568a, 0x568b, 0x568c, 0x568d, 0x5690, 0x5691, 0x5692, 0x5694, 0x5695, 0x5696, 0x5697, 0x5698, 0x5699, 0x569a, 0x569b, 0x569c, 0x569d, 0x569e, 0x569f, 0x56a0, 0x56a1, 0x56a2, 0x56a4, 0x56a5, 0x56a6, 0x56a7, 0x56a8, 0x56a9, 0x56aa, 0x56ab, 0x56ac, 0x56ad, 0x56ae, 0x56b0, 0x56b1, 0x56b2, 0x56b3, 0x56b4, 0x56b5, 0x56b6, 0x56b8, 0x56b9, 0x56ba, 0x56bb, 0x56bd, 0x56be, 0x56bf, 0x56c0, 0x56c1, 0x56c2, 0x56c3, 0x56c4, 0x56c5, 0x56c6, 0x56c7, 0x56c8, 0x56c9, 0x56cb, 0x56cc, 0x56cd, 0x56ce, 0x56cf, 0x56d0, 0x56d1, 0x56d2, 0x56d3, 0x56d5, 0x56d6, 0x56d8, 0x56d9, 0x56dc, 0x56e3, 0x56e5, 0x56e6, 0x56e7, 0x56e8, 0x56e9, 0x56ea, 0x56ec, 0x56ee, 0x56ef, 0x56f2, 0x56f3, 0x56f6, 0x56f7, 0x56f8, 0x56fb, 0x56fc, 0x5700, 0x5701, 0x5702, 0x5705, 0x5707, 0x570b, 0x570c, 0x570d, 0x570e, 0x570f, 0x5710, 0x5711, /* 0x88 */ 0x5712, 0x5713, 0x5714, 0x5715, 0x5716, 0x5717, 0x5718, 0x5719, 0x571a, 0x571b, 0x571d, 0x571e, 0x5720, 0x5721, 0x5722, 0x5724, 0x5725, 0x5726, 0x5727, 0x572b, 0x5731, 0x5732, 0x5734, 0x5735, 0x5736, 0x5737, 0x5738, 0x573c, 0x573d, 0x573f, 0x5741, 0x5743, 0x5744, 0x5745, 0x5746, 0x5748, 0x5749, 0x574b, 0x5752, 0x5753, 0x5754, 0x5755, 0x5756, 0x5758, 0x5759, 0x5762, 0x5763, 0x5765, 0x5767, 0x576c, 0x576e, 0x5770, 0x5771, 0x5772, 0x5774, 0x5775, 0x5778, 0x5779, 0x577a, 0x577d, 0x577e, 0x577f, 0x5780, 0x5781, 0x5787, 0x5788, 0x5789, 0x578a, 0x578d, 0x578e, 0x578f, 0x5790, 0x5791, 0x5794, 0x5795, 0x5796, 0x5797, 0x5798, 0x5799, 0x579a, 0x579c, 0x579d, 0x579e, 0x579f, 0x57a5, 0x57a8, 0x57aa, 0x57ac, 0x57af, 0x57b0, 0x57b1, 0x57b3, 0x57b5, 0x57b6, 0x57b7, 0x57b9, 0x57ba, 0x57bb, 0x57bc, 0x57bd, 0x57be, 0x57bf, 0x57c0, 0x57c1, 0x57c4, 0x57c5, 0x57c6, 0x57c7, 0x57c8, 0x57c9, 0x57ca, 0x57cc, 0x57cd, 0x57d0, 0x57d1, 0x57d3, 0x57d6, 0x57d7, 0x57db, 0x57dc, 0x57de, 0x57e1, 0x57e2, 0x57e3, 0x57e5, 0x57e6, 0x57e7, 0x57e8, 0x57e9, 0x57ea, 0x57eb, 0x57ec, 0x57ee, 0x57f0, 0x57f1, 0x57f2, 0x57f3, 0x57f5, 0x57f6, 0x57f7, 0x57fb, 0x57fc, 0x57fe, 0x57ff, 0x5801, 0x5803, 0x5804, 0x5805, 0x5808, 0x5809, 0x580a, 0x580c, 0x580e, 0x580f, 0x5810, 0x5812, 0x5813, 0x5814, 0x5816, 0x5817, 0x5818, 0x581a, 0x581b, 0x581c, 0x581d, 0x581f, 0x5822, 0x5823, 0x5825, 0x5826, 0x5827, 0x5828, 0x5829, 0x582b, 0x582c, 0x582d, 0x582e, 0x582f, 0x5831, 0x5832, 0x5833, 0x5834, 0x5836, 0x5837, 0x5838, 0x5839, 0x583a, 0x583b, 0x583c, 0x583d, /* 0x89 */ 0x583e, 0x583f, 0x5840, 0x5841, 0x5842, 0x5843, 0x5845, 0x5846, 0x5847, 0x5848, 0x5849, 0x584a, 0x584b, 0x584e, 0x584f, 0x5850, 0x5852, 0x5853, 0x5855, 0x5856, 0x5857, 0x5859, 0x585a, 0x585b, 0x585c, 0x585d, 0x585f, 0x5860, 0x5861, 0x5862, 0x5863, 0x5864, 0x5866, 0x5867, 0x5868, 0x5869, 0x586a, 0x586d, 0x586e, 0x586f, 0x5870, 0x5871, 0x5872, 0x5873, 0x5874, 0x5875, 0x5876, 0x5877, 0x5878, 0x5879, 0x587a, 0x587b, 0x587c, 0x587d, 0x587f, 0x5882, 0x5884, 0x5886, 0x5887, 0x5888, 0x588a, 0x588b, 0x588c, 0x588d, 0x588e, 0x588f, 0x5890, 0x5891, 0x5894, 0x5895, 0x5896, 0x5897, 0x5898, 0x589b, 0x589c, 0x589d, 0x58a0, 0x58a1, 0x58a2, 0x58a3, 0x58a4, 0x58a5, 0x58a6, 0x58a7, 0x58aa, 0x58ab, 0x58ac, 0x58ad, 0x58ae, 0x58af, 0x58b0, 0x58b1, 0x58b2, 0x58b3, 0x58b4, 0x58b5, 0x58b6, 0x58b7, 0x58b8, 0x58b9, 0x58ba, 0x58bb, 0x58bd, 0x58be, 0x58bf, 0x58c0, 0x58c2, 0x58c3, 0x58c4, 0x58c6, 0x58c7, 0x58c8, 0x58c9, 0x58ca, 0x58cb, 0x58cc, 0x58cd, 0x58ce, 0x58cf, 0x58d0, 0x58d2, 0x58d3, 0x58d4, 0x58d6, 0x58d7, 0x58d8, 0x58d9, 0x58da, 0x58db, 0x58dc, 0x58dd, 0x58de, 0x58df, 0x58e0, 0x58e1, 0x58e2, 0x58e3, 0x58e5, 0x58e6, 0x58e7, 0x58e8, 0x58e9, 0x58ea, 0x58ed, 0x58ef, 0x58f1, 0x58f2, 0x58f4, 0x58f5, 0x58f7, 0x58f8, 0x58fa, 0x58fb, 0x58fc, 0x58fd, 0x58fe, 0x58ff, 0x5900, 0x5901, 0x5903, 0x5905, 0x5906, 0x5908, 0x5909, 0x590a, 0x590b, 0x590c, 0x590e, 0x5910, 0x5911, 0x5912, 0x5913, 0x5917, 0x5918, 0x591b, 0x591d, 0x591e, 0x5920, 0x5921, 0x5922, 0x5923, 0x5926, 0x5928, 0x592c, 0x5930, 0x5932, 0x5933, 0x5935, 0x5936, 0x593b, /* 0x8a */ 0x593d, 0x593e, 0x593f, 0x5940, 0x5943, 0x5945, 0x5946, 0x594a, 0x594c, 0x594d, 0x5950, 0x5952, 0x5953, 0x5959, 0x595b, 0x595c, 0x595d, 0x595e, 0x595f, 0x5961, 0x5963, 0x5964, 0x5966, 0x5967, 0x5968, 0x5969, 0x596a, 0x596b, 0x596c, 0x596d, 0x596e, 0x596f, 0x5970, 0x5971, 0x5972, 0x5975, 0x5977, 0x597a, 0x597b, 0x597c, 0x597e, 0x597f, 0x5980, 0x5985, 0x5989, 0x598b, 0x598c, 0x598e, 0x598f, 0x5990, 0x5991, 0x5994, 0x5995, 0x5998, 0x599a, 0x599b, 0x599c, 0x599d, 0x599f, 0x59a0, 0x59a1, 0x59a2, 0x59a6, 0x59a7, 0x59ac, 0x59ad, 0x59b0, 0x59b1, 0x59b3, 0x59b4, 0x59b5, 0x59b6, 0x59b7, 0x59b8, 0x59ba, 0x59bc, 0x59bd, 0x59bf, 0x59c0, 0x59c1, 0x59c2, 0x59c3, 0x59c4, 0x59c5, 0x59c7, 0x59c8, 0x59c9, 0x59cc, 0x59cd, 0x59ce, 0x59cf, 0x59d5, 0x59d6, 0x59d9, 0x59db, 0x59de, 0x59df, 0x59e0, 0x59e1, 0x59e2, 0x59e4, 0x59e6, 0x59e7, 0x59e9, 0x59ea, 0x59eb, 0x59ed, 0x59ee, 0x59ef, 0x59f0, 0x59f1, 0x59f2, 0x59f3, 0x59f4, 0x59f5, 0x59f6, 0x59f7, 0x59f8, 0x59fa, 0x59fc, 0x59fd, 0x59fe, 0x5a00, 0x5a02, 0x5a0a, 0x5a0b, 0x5a0d, 0x5a0e, 0x5a0f, 0x5a10, 0x5a12, 0x5a14, 0x5a15, 0x5a16, 0x5a17, 0x5a19, 0x5a1a, 0x5a1b, 0x5a1d, 0x5a1e, 0x5a21, 0x5a22, 0x5a24, 0x5a26, 0x5a27, 0x5a28, 0x5a2a, 0x5a2b, 0x5a2c, 0x5a2d, 0x5a2e, 0x5a2f, 0x5a30, 0x5a33, 0x5a35, 0x5a37, 0x5a38, 0x5a39, 0x5a3a, 0x5a3b, 0x5a3d, 0x5a3e, 0x5a3f, 0x5a41, 0x5a42, 0x5a43, 0x5a44, 0x5a45, 0x5a47, 0x5a48, 0x5a4b, 0x5a4c, 0x5a4d, 0x5a4e, 0x5a4f, 0x5a50, 0x5a51, 0x5a52, 0x5a53, 0x5a54, 0x5a56, 0x5a57, 0x5a58, 0x5a59, 0x5a5b, 0x5a5c, 0x5a5d, 0x5a5e, 0x5a5f, 0x5a60, /* 0x8b */ 0x5a61, 0x5a63, 0x5a64, 0x5a65, 0x5a66, 0x5a68, 0x5a69, 0x5a6b, 0x5a6c, 0x5a6d, 0x5a6e, 0x5a6f, 0x5a70, 0x5a71, 0x5a72, 0x5a73, 0x5a78, 0x5a79, 0x5a7b, 0x5a7c, 0x5a7d, 0x5a7e, 0x5a80, 0x5a81, 0x5a82, 0x5a83, 0x5a84, 0x5a85, 0x5a86, 0x5a87, 0x5a88, 0x5a89, 0x5a8a, 0x5a8b, 0x5a8c, 0x5a8d, 0x5a8e, 0x5a8f, 0x5a90, 0x5a91, 0x5a93, 0x5a94, 0x5a95, 0x5a96, 0x5a97, 0x5a98, 0x5a99, 0x5a9c, 0x5a9d, 0x5a9e, 0x5a9f, 0x5aa0, 0x5aa1, 0x5aa2, 0x5aa3, 0x5aa4, 0x5aa5, 0x5aa6, 0x5aa7, 0x5aa8, 0x5aa9, 0x5aab, 0x5aac, 0x5aad, 0x5aae, 0x5aaf, 0x5ab0, 0x5ab1, 0x5ab4, 0x5ab6, 0x5ab7, 0x5ab9, 0x5aba, 0x5abb, 0x5abc, 0x5abd, 0x5abf, 0x5ac0, 0x5ac3, 0x5ac4, 0x5ac5, 0x5ac6, 0x5ac7, 0x5ac8, 0x5aca, 0x5acb, 0x5acd, 0x5ace, 0x5acf, 0x5ad0, 0x5ad1, 0x5ad3, 0x5ad5, 0x5ad7, 0x5ad9, 0x5ada, 0x5adb, 0x5add, 0x5ade, 0x5adf, 0x5ae2, 0x5ae4, 0x5ae5, 0x5ae7, 0x5ae8, 0x5aea, 0x5aec, 0x5aed, 0x5aee, 0x5aef, 0x5af0, 0x5af2, 0x5af3, 0x5af4, 0x5af5, 0x5af6, 0x5af7, 0x5af8, 0x5af9, 0x5afa, 0x5afb, 0x5afc, 0x5afd, 0x5afe, 0x5aff, 0x5b00, 0x5b01, 0x5b02, 0x5b03, 0x5b04, 0x5b05, 0x5b06, 0x5b07, 0x5b08, 0x5b0a, 0x5b0b, 0x5b0c, 0x5b0d, 0x5b0e, 0x5b0f, 0x5b10, 0x5b11, 0x5b12, 0x5b13, 0x5b14, 0x5b15, 0x5b18, 0x5b19, 0x5b1a, 0x5b1b, 0x5b1c, 0x5b1d, 0x5b1e, 0x5b1f, 0x5b20, 0x5b21, 0x5b22, 0x5b23, 0x5b24, 0x5b25, 0x5b26, 0x5b27, 0x5b28, 0x5b29, 0x5b2a, 0x5b2b, 0x5b2c, 0x5b2d, 0x5b2e, 0x5b2f, 0x5b30, 0x5b31, 0x5b33, 0x5b35, 0x5b36, 0x5b38, 0x5b39, 0x5b3a, 0x5b3b, 0x5b3c, 0x5b3d, 0x5b3e, 0x5b3f, 0x5b41, 0x5b42, 0x5b43, 0x5b44, 0x5b45, 0x5b46, 0x5b47, /* 0x8c */ 0x5b48, 0x5b49, 0x5b4a, 0x5b4b, 0x5b4c, 0x5b4d, 0x5b4e, 0x5b4f, 0x5b52, 0x5b56, 0x5b5e, 0x5b60, 0x5b61, 0x5b67, 0x5b68, 0x5b6b, 0x5b6d, 0x5b6e, 0x5b6f, 0x5b72, 0x5b74, 0x5b76, 0x5b77, 0x5b78, 0x5b79, 0x5b7b, 0x5b7c, 0x5b7e, 0x5b7f, 0x5b82, 0x5b86, 0x5b8a, 0x5b8d, 0x5b8e, 0x5b90, 0x5b91, 0x5b92, 0x5b94, 0x5b96, 0x5b9f, 0x5ba7, 0x5ba8, 0x5ba9, 0x5bac, 0x5bad, 0x5bae, 0x5baf, 0x5bb1, 0x5bb2, 0x5bb7, 0x5bba, 0x5bbb, 0x5bbc, 0x5bc0, 0x5bc1, 0x5bc3, 0x5bc8, 0x5bc9, 0x5bca, 0x5bcb, 0x5bcd, 0x5bce, 0x5bcf, 0x5bd1, 0x5bd4, 0x5bd5, 0x5bd6, 0x5bd7, 0x5bd8, 0x5bd9, 0x5bda, 0x5bdb, 0x5bdc, 0x5be0, 0x5be2, 0x5be3, 0x5be6, 0x5be7, 0x5be9, 0x5bea, 0x5beb, 0x5bec, 0x5bed, 0x5bef, 0x5bf1, 0x5bf2, 0x5bf3, 0x5bf4, 0x5bf5, 0x5bf6, 0x5bf7, 0x5bfd, 0x5bfe, 0x5c00, 0x5c02, 0x5c03, 0x5c05, 0x5c07, 0x5c08, 0x5c0b, 0x5c0c, 0x5c0d, 0x5c0e, 0x5c10, 0x5c12, 0x5c13, 0x5c17, 0x5c19, 0x5c1b, 0x5c1e, 0x5c1f, 0x5c20, 0x5c21, 0x5c23, 0x5c26, 0x5c28, 0x5c29, 0x5c2a, 0x5c2b, 0x5c2d, 0x5c2e, 0x5c2f, 0x5c30, 0x5c32, 0x5c33, 0x5c35, 0x5c36, 0x5c37, 0x5c43, 0x5c44, 0x5c46, 0x5c47, 0x5c4c, 0x5c4d, 0x5c52, 0x5c53, 0x5c54, 0x5c56, 0x5c57, 0x5c58, 0x5c5a, 0x5c5b, 0x5c5c, 0x5c5d, 0x5c5f, 0x5c62, 0x5c64, 0x5c67, 0x5c68, 0x5c69, 0x5c6a, 0x5c6b, 0x5c6c, 0x5c6d, 0x5c70, 0x5c72, 0x5c73, 0x5c74, 0x5c75, 0x5c76, 0x5c77, 0x5c78, 0x5c7b, 0x5c7c, 0x5c7d, 0x5c7e, 0x5c80, 0x5c83, 0x5c84, 0x5c85, 0x5c86, 0x5c87, 0x5c89, 0x5c8a, 0x5c8b, 0x5c8e, 0x5c8f, 0x5c92, 0x5c93, 0x5c95, 0x5c9d, 0x5c9e, 0x5c9f, 0x5ca0, 0x5ca1, 0x5ca4, 0x5ca5, 0x5ca6, 0x5ca7, 0x5ca8, /* 0x8d */ 0x5caa, 0x5cae, 0x5caf, 0x5cb0, 0x5cb2, 0x5cb4, 0x5cb6, 0x5cb9, 0x5cba, 0x5cbb, 0x5cbc, 0x5cbe, 0x5cc0, 0x5cc2, 0x5cc3, 0x5cc5, 0x5cc6, 0x5cc7, 0x5cc8, 0x5cc9, 0x5cca, 0x5ccc, 0x5ccd, 0x5cce, 0x5ccf, 0x5cd0, 0x5cd1, 0x5cd3, 0x5cd4, 0x5cd5, 0x5cd6, 0x5cd7, 0x5cd8, 0x5cda, 0x5cdb, 0x5cdc, 0x5cdd, 0x5cde, 0x5cdf, 0x5ce0, 0x5ce2, 0x5ce3, 0x5ce7, 0x5ce9, 0x5ceb, 0x5cec, 0x5cee, 0x5cef, 0x5cf1, 0x5cf2, 0x5cf3, 0x5cf4, 0x5cf5, 0x5cf6, 0x5cf7, 0x5cf8, 0x5cf9, 0x5cfa, 0x5cfc, 0x5cfd, 0x5cfe, 0x5cff, 0x5d00, 0x5d01, 0x5d04, 0x5d05, 0x5d08, 0x5d09, 0x5d0a, 0x5d0b, 0x5d0c, 0x5d0d, 0x5d0f, 0x5d10, 0x5d11, 0x5d12, 0x5d13, 0x5d15, 0x5d17, 0x5d18, 0x5d19, 0x5d1a, 0x5d1c, 0x5d1d, 0x5d1f, 0x5d20, 0x5d21, 0x5d22, 0x5d23, 0x5d25, 0x5d28, 0x5d2a, 0x5d2b, 0x5d2c, 0x5d2f, 0x5d30, 0x5d31, 0x5d32, 0x5d33, 0x5d35, 0x5d36, 0x5d37, 0x5d38, 0x5d39, 0x5d3a, 0x5d3b, 0x5d3c, 0x5d3f, 0x5d40, 0x5d41, 0x5d42, 0x5d43, 0x5d44, 0x5d45, 0x5d46, 0x5d48, 0x5d49, 0x5d4d, 0x5d4e, 0x5d4f, 0x5d50, 0x5d51, 0x5d52, 0x5d53, 0x5d54, 0x5d55, 0x5d56, 0x5d57, 0x5d59, 0x5d5a, 0x5d5c, 0x5d5e, 0x5d5f, 0x5d60, 0x5d61, 0x5d62, 0x5d63, 0x5d64, 0x5d65, 0x5d66, 0x5d67, 0x5d68, 0x5d6a, 0x5d6d, 0x5d6e, 0x5d70, 0x5d71, 0x5d72, 0x5d73, 0x5d75, 0x5d76, 0x5d77, 0x5d78, 0x5d79, 0x5d7a, 0x5d7b, 0x5d7c, 0x5d7d, 0x5d7e, 0x5d7f, 0x5d80, 0x5d81, 0x5d83, 0x5d84, 0x5d85, 0x5d86, 0x5d87, 0x5d88, 0x5d89, 0x5d8a, 0x5d8b, 0x5d8c, 0x5d8d, 0x5d8e, 0x5d8f, 0x5d90, 0x5d91, 0x5d92, 0x5d93, 0x5d94, 0x5d95, 0x5d96, 0x5d97, 0x5d98, 0x5d9a, 0x5d9b, 0x5d9c, 0x5d9e, 0x5d9f, 0x5da0, /* 0x8e */ 0x5da1, 0x5da2, 0x5da3, 0x5da4, 0x5da5, 0x5da6, 0x5da7, 0x5da8, 0x5da9, 0x5daa, 0x5dab, 0x5dac, 0x5dad, 0x5dae, 0x5daf, 0x5db0, 0x5db1, 0x5db2, 0x5db3, 0x5db4, 0x5db5, 0x5db6, 0x5db8, 0x5db9, 0x5dba, 0x5dbb, 0x5dbc, 0x5dbd, 0x5dbe, 0x5dbf, 0x5dc0, 0x5dc1, 0x5dc2, 0x5dc3, 0x5dc4, 0x5dc6, 0x5dc7, 0x5dc8, 0x5dc9, 0x5dca, 0x5dcb, 0x5dcc, 0x5dce, 0x5dcf, 0x5dd0, 0x5dd1, 0x5dd2, 0x5dd3, 0x5dd4, 0x5dd5, 0x5dd6, 0x5dd7, 0x5dd8, 0x5dd9, 0x5dda, 0x5ddc, 0x5ddf, 0x5de0, 0x5de3, 0x5de4, 0x5dea, 0x5dec, 0x5ded, 0x5df0, 0x5df5, 0x5df6, 0x5df8, 0x5df9, 0x5dfa, 0x5dfb, 0x5dfc, 0x5dff, 0x5e00, 0x5e04, 0x5e07, 0x5e09, 0x5e0a, 0x5e0b, 0x5e0d, 0x5e0e, 0x5e12, 0x5e13, 0x5e17, 0x5e1e, 0x5e1f, 0x5e20, 0x5e21, 0x5e22, 0x5e23, 0x5e24, 0x5e25, 0x5e28, 0x5e29, 0x5e2a, 0x5e2b, 0x5e2c, 0x5e2f, 0x5e30, 0x5e32, 0x5e33, 0x5e34, 0x5e35, 0x5e36, 0x5e39, 0x5e3a, 0x5e3e, 0x5e3f, 0x5e40, 0x5e41, 0x5e43, 0x5e46, 0x5e47, 0x5e48, 0x5e49, 0x5e4a, 0x5e4b, 0x5e4d, 0x5e4e, 0x5e4f, 0x5e50, 0x5e51, 0x5e52, 0x5e53, 0x5e56, 0x5e57, 0x5e58, 0x5e59, 0x5e5a, 0x5e5c, 0x5e5d, 0x5e5f, 0x5e60, 0x5e63, 0x5e64, 0x5e65, 0x5e66, 0x5e67, 0x5e68, 0x5e69, 0x5e6a, 0x5e6b, 0x5e6c, 0x5e6d, 0x5e6e, 0x5e6f, 0x5e70, 0x5e71, 0x5e75, 0x5e77, 0x5e79, 0x5e7e, 0x5e81, 0x5e82, 0x5e83, 0x5e85, 0x5e88, 0x5e89, 0x5e8c, 0x5e8d, 0x5e8e, 0x5e92, 0x5e98, 0x5e9b, 0x5e9d, 0x5ea1, 0x5ea2, 0x5ea3, 0x5ea4, 0x5ea8, 0x5ea9, 0x5eaa, 0x5eab, 0x5eac, 0x5eae, 0x5eaf, 0x5eb0, 0x5eb1, 0x5eb2, 0x5eb4, 0x5eba, 0x5ebb, 0x5ebc, 0x5ebd, 0x5ebf, 0x5ec0, 0x5ec1, 0x5ec2, 0x5ec3, 0x5ec4, 0x5ec5, /* 0x8f */ 0x5ec6, 0x5ec7, 0x5ec8, 0x5ecb, 0x5ecc, 0x5ecd, 0x5ece, 0x5ecf, 0x5ed0, 0x5ed4, 0x5ed5, 0x5ed7, 0x5ed8, 0x5ed9, 0x5eda, 0x5edc, 0x5edd, 0x5ede, 0x5edf, 0x5ee0, 0x5ee1, 0x5ee2, 0x5ee3, 0x5ee4, 0x5ee5, 0x5ee6, 0x5ee7, 0x5ee9, 0x5eeb, 0x5eec, 0x5eed, 0x5eee, 0x5eef, 0x5ef0, 0x5ef1, 0x5ef2, 0x5ef3, 0x5ef5, 0x5ef8, 0x5ef9, 0x5efb, 0x5efc, 0x5efd, 0x5f05, 0x5f06, 0x5f07, 0x5f09, 0x5f0c, 0x5f0d, 0x5f0e, 0x5f10, 0x5f12, 0x5f14, 0x5f16, 0x5f19, 0x5f1a, 0x5f1c, 0x5f1d, 0x5f1e, 0x5f21, 0x5f22, 0x5f23, 0x5f24, 0x5f28, 0x5f2b, 0x5f2c, 0x5f2e, 0x5f30, 0x5f32, 0x5f33, 0x5f34, 0x5f35, 0x5f36, 0x5f37, 0x5f38, 0x5f3b, 0x5f3d, 0x5f3e, 0x5f3f, 0x5f41, 0x5f42, 0x5f43, 0x5f44, 0x5f45, 0x5f46, 0x5f47, 0x5f48, 0x5f49, 0x5f4a, 0x5f4b, 0x5f4c, 0x5f4d, 0x5f4e, 0x5f4f, 0x5f51, 0x5f54, 0x5f59, 0x5f5a, 0x5f5b, 0x5f5c, 0x5f5e, 0x5f5f, 0x5f60, 0x5f63, 0x5f65, 0x5f67, 0x5f68, 0x5f6b, 0x5f6e, 0x5f6f, 0x5f72, 0x5f74, 0x5f75, 0x5f76, 0x5f78, 0x5f7a, 0x5f7d, 0x5f7e, 0x5f7f, 0x5f83, 0x5f86, 0x5f8d, 0x5f8e, 0x5f8f, 0x5f91, 0x5f93, 0x5f94, 0x5f96, 0x5f9a, 0x5f9b, 0x5f9d, 0x5f9e, 0x5f9f, 0x5fa0, 0x5fa2, 0x5fa3, 0x5fa4, 0x5fa5, 0x5fa6, 0x5fa7, 0x5fa9, 0x5fab, 0x5fac, 0x5faf, 0x5fb0, 0x5fb1, 0x5fb2, 0x5fb3, 0x5fb4, 0x5fb6, 0x5fb8, 0x5fb9, 0x5fba, 0x5fbb, 0x5fbe, 0x5fbf, 0x5fc0, 0x5fc1, 0x5fc2, 0x5fc7, 0x5fc8, 0x5fca, 0x5fcb, 0x5fce, 0x5fd3, 0x5fd4, 0x5fd5, 0x5fda, 0x5fdb, 0x5fdc, 0x5fde, 0x5fdf, 0x5fe2, 0x5fe3, 0x5fe5, 0x5fe6, 0x5fe8, 0x5fe9, 0x5fec, 0x5fef, 0x5ff0, 0x5ff2, 0x5ff3, 0x5ff4, 0x5ff6, 0x5ff7, 0x5ff9, 0x5ffa, 0x5ffc, 0x6007, /* 0x90 */ 0x6008, 0x6009, 0x600b, 0x600c, 0x6010, 0x6011, 0x6013, 0x6017, 0x6018, 0x601a, 0x601e, 0x601f, 0x6022, 0x6023, 0x6024, 0x602c, 0x602d, 0x602e, 0x6030, 0x6031, 0x6032, 0x6033, 0x6034, 0x6036, 0x6037, 0x6038, 0x6039, 0x603a, 0x603d, 0x603e, 0x6040, 0x6044, 0x6045, 0x6046, 0x6047, 0x6048, 0x6049, 0x604a, 0x604c, 0x604e, 0x604f, 0x6051, 0x6053, 0x6054, 0x6056, 0x6057, 0x6058, 0x605b, 0x605c, 0x605e, 0x605f, 0x6060, 0x6061, 0x6065, 0x6066, 0x606e, 0x6071, 0x6072, 0x6074, 0x6075, 0x6077, 0x607e, 0x6080, 0x6081, 0x6082, 0x6085, 0x6086, 0x6087, 0x6088, 0x608a, 0x608b, 0x608e, 0x608f, 0x6090, 0x6091, 0x6093, 0x6095, 0x6097, 0x6098, 0x6099, 0x609c, 0x609e, 0x60a1, 0x60a2, 0x60a4, 0x60a5, 0x60a7, 0x60a9, 0x60aa, 0x60ae, 0x60b0, 0x60b3, 0x60b5, 0x60b6, 0x60b7, 0x60b9, 0x60ba, 0x60bd, 0x60be, 0x60bf, 0x60c0, 0x60c1, 0x60c2, 0x60c3, 0x60c4, 0x60c7, 0x60c8, 0x60c9, 0x60cc, 0x60cd, 0x60ce, 0x60cf, 0x60d0, 0x60d2, 0x60d3, 0x60d4, 0x60d6, 0x60d7, 0x60d9, 0x60db, 0x60de, 0x60e1, 0x60e2, 0x60e3, 0x60e4, 0x60e5, 0x60ea, 0x60f1, 0x60f2, 0x60f5, 0x60f7, 0x60f8, 0x60fb, 0x60fc, 0x60fd, 0x60fe, 0x60ff, 0x6102, 0x6103, 0x6104, 0x6105, 0x6107, 0x610a, 0x610b, 0x610c, 0x6110, 0x6111, 0x6112, 0x6113, 0x6114, 0x6116, 0x6117, 0x6118, 0x6119, 0x611b, 0x611c, 0x611d, 0x611e, 0x6121, 0x6122, 0x6125, 0x6128, 0x6129, 0x612a, 0x612c, 0x612d, 0x612e, 0x612f, 0x6130, 0x6131, 0x6132, 0x6133, 0x6134, 0x6135, 0x6136, 0x6137, 0x6138, 0x6139, 0x613a, 0x613b, 0x613c, 0x613d, 0x613e, 0x6140, 0x6141, 0x6142, 0x6143, 0x6144, 0x6145, 0x6146, /* 0x91 */ 0x6147, 0x6149, 0x614b, 0x614d, 0x614f, 0x6150, 0x6152, 0x6153, 0x6154, 0x6156, 0x6157, 0x6158, 0x6159, 0x615a, 0x615b, 0x615c, 0x615e, 0x615f, 0x6160, 0x6161, 0x6163, 0x6164, 0x6165, 0x6166, 0x6169, 0x616a, 0x616b, 0x616c, 0x616d, 0x616e, 0x616f, 0x6171, 0x6172, 0x6173, 0x6174, 0x6176, 0x6178, 0x6179, 0x617a, 0x617b, 0x617c, 0x617d, 0x617e, 0x617f, 0x6180, 0x6181, 0x6182, 0x6183, 0x6184, 0x6185, 0x6186, 0x6187, 0x6188, 0x6189, 0x618a, 0x618c, 0x618d, 0x618f, 0x6190, 0x6191, 0x6192, 0x6193, 0x6195, 0x6196, 0x6197, 0x6198, 0x6199, 0x619a, 0x619b, 0x619c, 0x619e, 0x619f, 0x61a0, 0x61a1, 0x61a2, 0x61a3, 0x61a4, 0x61a5, 0x61a6, 0x61aa, 0x61ab, 0x61ad, 0x61ae, 0x61af, 0x61b0, 0x61b1, 0x61b2, 0x61b3, 0x61b4, 0x61b5, 0x61b6, 0x61b8, 0x61b9, 0x61ba, 0x61bb, 0x61bc, 0x61bd, 0x61bf, 0x61c0, 0x61c1, 0x61c3, 0x61c4, 0x61c5, 0x61c6, 0x61c7, 0x61c9, 0x61cc, 0x61cd, 0x61ce, 0x61cf, 0x61d0, 0x61d3, 0x61d5, 0x61d6, 0x61d7, 0x61d8, 0x61d9, 0x61da, 0x61db, 0x61dc, 0x61dd, 0x61de, 0x61df, 0x61e0, 0x61e1, 0x61e2, 0x61e3, 0x61e4, 0x61e5, 0x61e7, 0x61e8, 0x61e9, 0x61ea, 0x61eb, 0x61ec, 0x61ed, 0x61ee, 0x61ef, 0x61f0, 0x61f1, 0x61f2, 0x61f3, 0x61f4, 0x61f6, 0x61f7, 0x61f8, 0x61f9, 0x61fa, 0x61fb, 0x61fc, 0x61fd, 0x61fe, 0x6200, 0x6201, 0x6202, 0x6203, 0x6204, 0x6205, 0x6207, 0x6209, 0x6213, 0x6214, 0x6219, 0x621c, 0x621d, 0x621e, 0x6220, 0x6223, 0x6226, 0x6227, 0x6228, 0x6229, 0x622b, 0x622d, 0x622f, 0x6230, 0x6231, 0x6232, 0x6235, 0x6236, 0x6238, 0x6239, 0x623a, 0x623b, 0x623c, 0x6242, 0x6244, 0x6245, 0x6246, 0x624a, /* 0x92 */ 0x624f, 0x6250, 0x6255, 0x6256, 0x6257, 0x6259, 0x625a, 0x625c, 0x625d, 0x625e, 0x625f, 0x6260, 0x6261, 0x6262, 0x6264, 0x6265, 0x6268, 0x6271, 0x6272, 0x6274, 0x6275, 0x6277, 0x6278, 0x627a, 0x627b, 0x627d, 0x6281, 0x6282, 0x6283, 0x6285, 0x6286, 0x6287, 0x6288, 0x628b, 0x628c, 0x628d, 0x628e, 0x628f, 0x6290, 0x6294, 0x6299, 0x629c, 0x629d, 0x629e, 0x62a3, 0x62a6, 0x62a7, 0x62a9, 0x62aa, 0x62ad, 0x62ae, 0x62af, 0x62b0, 0x62b2, 0x62b3, 0x62b4, 0x62b6, 0x62b7, 0x62b8, 0x62ba, 0x62be, 0x62c0, 0x62c1, 0x62c3, 0x62cb, 0x62cf, 0x62d1, 0x62d5, 0x62dd, 0x62de, 0x62e0, 0x62e1, 0x62e4, 0x62ea, 0x62eb, 0x62f0, 0x62f2, 0x62f5, 0x62f8, 0x62f9, 0x62fa, 0x62fb, 0x6300, 0x6303, 0x6304, 0x6305, 0x6306, 0x630a, 0x630b, 0x630c, 0x630d, 0x630f, 0x6310, 0x6312, 0x6313, 0x6314, 0x6315, 0x6317, 0x6318, 0x6319, 0x631c, 0x6326, 0x6327, 0x6329, 0x632c, 0x632d, 0x632e, 0x6330, 0x6331, 0x6333, 0x6334, 0x6335, 0x6336, 0x6337, 0x6338, 0x633b, 0x633c, 0x633e, 0x633f, 0x6340, 0x6341, 0x6344, 0x6347, 0x6348, 0x634a, 0x6351, 0x6352, 0x6353, 0x6354, 0x6356, 0x6357, 0x6358, 0x6359, 0x635a, 0x635b, 0x635c, 0x635d, 0x6360, 0x6364, 0x6365, 0x6366, 0x6368, 0x636a, 0x636b, 0x636c, 0x636f, 0x6370, 0x6372, 0x6373, 0x6374, 0x6375, 0x6378, 0x6379, 0x637c, 0x637d, 0x637e, 0x637f, 0x6381, 0x6383, 0x6384, 0x6385, 0x6386, 0x638b, 0x638d, 0x6391, 0x6393, 0x6394, 0x6395, 0x6397, 0x6399, 0x639a, 0x639b, 0x639c, 0x639d, 0x639e, 0x639f, 0x63a1, 0x63a4, 0x63a6, 0x63ab, 0x63af, 0x63b1, 0x63b2, 0x63b5, 0x63b6, 0x63b9, 0x63bb, 0x63bd, 0x63bf, 0x63c0, /* 0x93 */ 0x63c1, 0x63c2, 0x63c3, 0x63c5, 0x63c7, 0x63c8, 0x63ca, 0x63cb, 0x63cc, 0x63d1, 0x63d3, 0x63d4, 0x63d5, 0x63d7, 0x63d8, 0x63d9, 0x63da, 0x63db, 0x63dc, 0x63dd, 0x63df, 0x63e2, 0x63e4, 0x63e5, 0x63e6, 0x63e7, 0x63e8, 0x63eb, 0x63ec, 0x63ee, 0x63ef, 0x63f0, 0x63f1, 0x63f3, 0x63f5, 0x63f7, 0x63f9, 0x63fa, 0x63fb, 0x63fc, 0x63fe, 0x6403, 0x6404, 0x6406, 0x6407, 0x6408, 0x6409, 0x640a, 0x640d, 0x640e, 0x6411, 0x6412, 0x6415, 0x6416, 0x6417, 0x6418, 0x6419, 0x641a, 0x641d, 0x641f, 0x6422, 0x6423, 0x6424, 0x6425, 0x6427, 0x6428, 0x6429, 0x642b, 0x642e, 0x642f, 0x6430, 0x6431, 0x6432, 0x6433, 0x6435, 0x6436, 0x6437, 0x6438, 0x6439, 0x643b, 0x643c, 0x643e, 0x6440, 0x6442, 0x6443, 0x6449, 0x644b, 0x644c, 0x644d, 0x644e, 0x644f, 0x6450, 0x6451, 0x6453, 0x6455, 0x6456, 0x6457, 0x6459, 0x645a, 0x645b, 0x645c, 0x645d, 0x645f, 0x6460, 0x6461, 0x6462, 0x6463, 0x6464, 0x6465, 0x6466, 0x6468, 0x646a, 0x646b, 0x646c, 0x646e, 0x646f, 0x6470, 0x6471, 0x6472, 0x6473, 0x6474, 0x6475, 0x6476, 0x6477, 0x647b, 0x647c, 0x647d, 0x647e, 0x647f, 0x6480, 0x6481, 0x6483, 0x6486, 0x6488, 0x6489, 0x648a, 0x648b, 0x648c, 0x648d, 0x648e, 0x648f, 0x6490, 0x6493, 0x6494, 0x6497, 0x6498, 0x649a, 0x649b, 0x649c, 0x649d, 0x649f, 0x64a0, 0x64a1, 0x64a2, 0x64a3, 0x64a5, 0x64a6, 0x64a7, 0x64a8, 0x64aa, 0x64ab, 0x64af, 0x64b1, 0x64b2, 0x64b3, 0x64b4, 0x64b6, 0x64b9, 0x64bb, 0x64bd, 0x64be, 0x64bf, 0x64c1, 0x64c3, 0x64c4, 0x64c6, 0x64c7, 0x64c8, 0x64c9, 0x64ca, 0x64cb, 0x64cc, 0x64cf, 0x64d1, 0x64d3, 0x64d4, 0x64d5, 0x64d6, 0x64d9, 0x64da, /* 0x94 */ 0x64db, 0x64dc, 0x64dd, 0x64df, 0x64e0, 0x64e1, 0x64e3, 0x64e5, 0x64e7, 0x64e8, 0x64e9, 0x64ea, 0x64eb, 0x64ec, 0x64ed, 0x64ee, 0x64ef, 0x64f0, 0x64f1, 0x64f2, 0x64f3, 0x64f4, 0x64f5, 0x64f6, 0x64f7, 0x64f8, 0x64f9, 0x64fa, 0x64fb, 0x64fc, 0x64fd, 0x64fe, 0x64ff, 0x6501, 0x6502, 0x6503, 0x6504, 0x6505, 0x6506, 0x6507, 0x6508, 0x650a, 0x650b, 0x650c, 0x650d, 0x650e, 0x650f, 0x6510, 0x6511, 0x6513, 0x6514, 0x6515, 0x6516, 0x6517, 0x6519, 0x651a, 0x651b, 0x651c, 0x651d, 0x651e, 0x651f, 0x6520, 0x6521, 0x6522, 0x6523, 0x6524, 0x6526, 0x6527, 0x6528, 0x6529, 0x652a, 0x652c, 0x652d, 0x6530, 0x6531, 0x6532, 0x6533, 0x6537, 0x653a, 0x653c, 0x653d, 0x6540, 0x6541, 0x6542, 0x6543, 0x6544, 0x6546, 0x6547, 0x654a, 0x654b, 0x654d, 0x654e, 0x6550, 0x6552, 0x6553, 0x6554, 0x6557, 0x6558, 0x655a, 0x655c, 0x655f, 0x6560, 0x6561, 0x6564, 0x6565, 0x6567, 0x6568, 0x6569, 0x656a, 0x656d, 0x656e, 0x656f, 0x6571, 0x6573, 0x6575, 0x6576, 0x6578, 0x6579, 0x657a, 0x657b, 0x657c, 0x657d, 0x657e, 0x657f, 0x6580, 0x6581, 0x6582, 0x6583, 0x6584, 0x6585, 0x6586, 0x6588, 0x6589, 0x658a, 0x658d, 0x658e, 0x658f, 0x6592, 0x6594, 0x6595, 0x6596, 0x6598, 0x659a, 0x659d, 0x659e, 0x65a0, 0x65a2, 0x65a3, 0x65a6, 0x65a8, 0x65aa, 0x65ac, 0x65ae, 0x65b1, 0x65b2, 0x65b3, 0x65b4, 0x65b5, 0x65b6, 0x65b7, 0x65b8, 0x65ba, 0x65bb, 0x65be, 0x65bf, 0x65c0, 0x65c2, 0x65c7, 0x65c8, 0x65c9, 0x65ca, 0x65cd, 0x65d0, 0x65d1, 0x65d3, 0x65d4, 0x65d5, 0x65d8, 0x65d9, 0x65da, 0x65db, 0x65dc, 0x65dd, 0x65de, 0x65df, 0x65e1, 0x65e3, 0x65e4, 0x65ea, 0x65eb, /* 0x95 */ 0x65f2, 0x65f3, 0x65f4, 0x65f5, 0x65f8, 0x65f9, 0x65fb, 0x65fc, 0x65fd, 0x65fe, 0x65ff, 0x6601, 0x6604, 0x6605, 0x6607, 0x6608, 0x6609, 0x660b, 0x660d, 0x6610, 0x6611, 0x6612, 0x6616, 0x6617, 0x6618, 0x661a, 0x661b, 0x661c, 0x661e, 0x6621, 0x6622, 0x6623, 0x6624, 0x6626, 0x6629, 0x662a, 0x662b, 0x662c, 0x662e, 0x6630, 0x6632, 0x6633, 0x6637, 0x6638, 0x6639, 0x663a, 0x663b, 0x663d, 0x663f, 0x6640, 0x6642, 0x6644, 0x6645, 0x6646, 0x6647, 0x6648, 0x6649, 0x664a, 0x664d, 0x664e, 0x6650, 0x6651, 0x6658, 0x6659, 0x665b, 0x665c, 0x665d, 0x665e, 0x6660, 0x6662, 0x6663, 0x6665, 0x6667, 0x6669, 0x666a, 0x666b, 0x666c, 0x666d, 0x6671, 0x6672, 0x6673, 0x6675, 0x6678, 0x6679, 0x667b, 0x667c, 0x667d, 0x667f, 0x6680, 0x6681, 0x6683, 0x6685, 0x6686, 0x6688, 0x6689, 0x668a, 0x668b, 0x668d, 0x668e, 0x668f, 0x6690, 0x6692, 0x6693, 0x6694, 0x6695, 0x6698, 0x6699, 0x669a, 0x669b, 0x669c, 0x669e, 0x669f, 0x66a0, 0x66a1, 0x66a2, 0x66a3, 0x66a4, 0x66a5, 0x66a6, 0x66a9, 0x66aa, 0x66ab, 0x66ac, 0x66ad, 0x66af, 0x66b0, 0x66b1, 0x66b2, 0x66b3, 0x66b5, 0x66b6, 0x66b7, 0x66b8, 0x66ba, 0x66bb, 0x66bc, 0x66bd, 0x66bf, 0x66c0, 0x66c1, 0x66c2, 0x66c3, 0x66c4, 0x66c5, 0x66c6, 0x66c7, 0x66c8, 0x66c9, 0x66ca, 0x66cb, 0x66cc, 0x66cd, 0x66ce, 0x66cf, 0x66d0, 0x66d1, 0x66d2, 0x66d3, 0x66d4, 0x66d5, 0x66d6, 0x66d7, 0x66d8, 0x66da, 0x66de, 0x66df, 0x66e0, 0x66e1, 0x66e2, 0x66e3, 0x66e4, 0x66e5, 0x66e7, 0x66e8, 0x66ea, 0x66eb, 0x66ec, 0x66ed, 0x66ee, 0x66ef, 0x66f1, 0x66f5, 0x66f6, 0x66f8, 0x66fa, 0x66fb, 0x66fd, 0x6701, 0x6702, 0x6703, /* 0x96 */ 0x6704, 0x6705, 0x6706, 0x6707, 0x670c, 0x670e, 0x670f, 0x6711, 0x6712, 0x6713, 0x6716, 0x6718, 0x6719, 0x671a, 0x671c, 0x671e, 0x6720, 0x6721, 0x6722, 0x6723, 0x6724, 0x6725, 0x6727, 0x6729, 0x672e, 0x6730, 0x6732, 0x6733, 0x6736, 0x6737, 0x6738, 0x6739, 0x673b, 0x673c, 0x673e, 0x673f, 0x6741, 0x6744, 0x6745, 0x6747, 0x674a, 0x674b, 0x674d, 0x6752, 0x6754, 0x6755, 0x6757, 0x6758, 0x6759, 0x675a, 0x675b, 0x675d, 0x6762, 0x6763, 0x6764, 0x6766, 0x6767, 0x676b, 0x676c, 0x676e, 0x6771, 0x6774, 0x6776, 0x6778, 0x6779, 0x677a, 0x677b, 0x677d, 0x6780, 0x6782, 0x6783, 0x6785, 0x6786, 0x6788, 0x678a, 0x678c, 0x678d, 0x678e, 0x678f, 0x6791, 0x6792, 0x6793, 0x6794, 0x6796, 0x6799, 0x679b, 0x679f, 0x67a0, 0x67a1, 0x67a4, 0x67a6, 0x67a9, 0x67ac, 0x67ae, 0x67b1, 0x67b2, 0x67b4, 0x67b9, 0x67ba, 0x67bb, 0x67bc, 0x67bd, 0x67be, 0x67bf, 0x67c0, 0x67c2, 0x67c5, 0x67c6, 0x67c7, 0x67c8, 0x67c9, 0x67ca, 0x67cb, 0x67cc, 0x67cd, 0x67ce, 0x67d5, 0x67d6, 0x67d7, 0x67db, 0x67df, 0x67e1, 0x67e3, 0x67e4, 0x67e6, 0x67e7, 0x67e8, 0x67ea, 0x67eb, 0x67ed, 0x67ee, 0x67f2, 0x67f5, 0x67f6, 0x67f7, 0x67f8, 0x67f9, 0x67fa, 0x67fb, 0x67fc, 0x67fe, 0x6801, 0x6802, 0x6803, 0x6804, 0x6806, 0x680d, 0x6810, 0x6812, 0x6814, 0x6815, 0x6818, 0x6819, 0x681a, 0x681b, 0x681c, 0x681e, 0x681f, 0x6820, 0x6822, 0x6823, 0x6824, 0x6825, 0x6826, 0x6827, 0x6828, 0x682b, 0x682c, 0x682d, 0x682e, 0x682f, 0x6830, 0x6831, 0x6834, 0x6835, 0x6836, 0x683a, 0x683b, 0x683f, 0x6847, 0x684b, 0x684d, 0x684f, 0x6852, 0x6856, 0x6857, 0x6858, 0x6859, 0x685a, 0x685b, /* 0x97 */ 0x685c, 0x685d, 0x685e, 0x685f, 0x686a, 0x686c, 0x686d, 0x686e, 0x686f, 0x6870, 0x6871, 0x6872, 0x6873, 0x6875, 0x6878, 0x6879, 0x687a, 0x687b, 0x687c, 0x687d, 0x687e, 0x687f, 0x6880, 0x6882, 0x6884, 0x6887, 0x6888, 0x6889, 0x688a, 0x688b, 0x688c, 0x688d, 0x688e, 0x6890, 0x6891, 0x6892, 0x6894, 0x6895, 0x6896, 0x6898, 0x6899, 0x689a, 0x689b, 0x689c, 0x689d, 0x689e, 0x689f, 0x68a0, 0x68a1, 0x68a3, 0x68a4, 0x68a5, 0x68a9, 0x68aa, 0x68ab, 0x68ac, 0x68ae, 0x68b1, 0x68b2, 0x68b4, 0x68b6, 0x68b7, 0x68b8, 0x68b9, 0x68ba, 0x68bb, 0x68bc, 0x68bd, 0x68be, 0x68bf, 0x68c1, 0x68c3, 0x68c4, 0x68c5, 0x68c6, 0x68c7, 0x68c8, 0x68ca, 0x68cc, 0x68ce, 0x68cf, 0x68d0, 0x68d1, 0x68d3, 0x68d4, 0x68d6, 0x68d7, 0x68d9, 0x68db, 0x68dc, 0x68dd, 0x68de, 0x68df, 0x68e1, 0x68e2, 0x68e4, 0x68e5, 0x68e6, 0x68e7, 0x68e8, 0x68e9, 0x68ea, 0x68eb, 0x68ec, 0x68ed, 0x68ef, 0x68f2, 0x68f3, 0x68f4, 0x68f6, 0x68f7, 0x68f8, 0x68fb, 0x68fd, 0x68fe, 0x68ff, 0x6900, 0x6902, 0x6903, 0x6904, 0x6906, 0x6907, 0x6908, 0x6909, 0x690a, 0x690c, 0x690f, 0x6911, 0x6913, 0x6914, 0x6915, 0x6916, 0x6917, 0x6918, 0x6919, 0x691a, 0x691b, 0x691c, 0x691d, 0x691e, 0x6921, 0x6922, 0x6923, 0x6925, 0x6926, 0x6927, 0x6928, 0x6929, 0x692a, 0x692b, 0x692c, 0x692e, 0x692f, 0x6931, 0x6932, 0x6933, 0x6935, 0x6936, 0x6937, 0x6938, 0x693a, 0x693b, 0x693c, 0x693e, 0x6940, 0x6941, 0x6943, 0x6944, 0x6945, 0x6946, 0x6947, 0x6948, 0x6949, 0x694a, 0x694b, 0x694c, 0x694d, 0x694e, 0x694f, 0x6950, 0x6951, 0x6952, 0x6953, 0x6955, 0x6956, 0x6958, 0x6959, 0x695b, 0x695c, 0x695f, /* 0x98 */ 0x6961, 0x6962, 0x6964, 0x6965, 0x6967, 0x6968, 0x6969, 0x696a, 0x696c, 0x696d, 0x696f, 0x6970, 0x6972, 0x6973, 0x6974, 0x6975, 0x6976, 0x697a, 0x697b, 0x697d, 0x697e, 0x697f, 0x6981, 0x6983, 0x6985, 0x698a, 0x698b, 0x698c, 0x698e, 0x698f, 0x6990, 0x6991, 0x6992, 0x6993, 0x6996, 0x6997, 0x6999, 0x699a, 0x699d, 0x699e, 0x699f, 0x69a0, 0x69a1, 0x69a2, 0x69a3, 0x69a4, 0x69a5, 0x69a6, 0x69a9, 0x69aa, 0x69ac, 0x69ae, 0x69af, 0x69b0, 0x69b2, 0x69b3, 0x69b5, 0x69b6, 0x69b8, 0x69b9, 0x69ba, 0x69bc, 0x69bd, 0x69be, 0x69bf, 0x69c0, 0x69c2, 0x69c3, 0x69c4, 0x69c5, 0x69c6, 0x69c7, 0x69c8, 0x69c9, 0x69cb, 0x69cd, 0x69cf, 0x69d1, 0x69d2, 0x69d3, 0x69d5, 0x69d6, 0x69d7, 0x69d8, 0x69d9, 0x69da, 0x69dc, 0x69dd, 0x69de, 0x69e1, 0x69e2, 0x69e3, 0x69e4, 0x69e5, 0x69e6, 0x69e7, 0x69e8, 0x69e9, 0x69ea, 0x69eb, 0x69ec, 0x69ee, 0x69ef, 0x69f0, 0x69f1, 0x69f3, 0x69f4, 0x69f5, 0x69f6, 0x69f7, 0x69f8, 0x69f9, 0x69fa, 0x69fb, 0x69fc, 0x69fe, 0x6a00, 0x6a01, 0x6a02, 0x6a03, 0x6a04, 0x6a05, 0x6a06, 0x6a07, 0x6a08, 0x6a09, 0x6a0b, 0x6a0c, 0x6a0d, 0x6a0e, 0x6a0f, 0x6a10, 0x6a11, 0x6a12, 0x6a13, 0x6a14, 0x6a15, 0x6a16, 0x6a19, 0x6a1a, 0x6a1b, 0x6a1c, 0x6a1d, 0x6a1e, 0x6a20, 0x6a22, 0x6a23, 0x6a24, 0x6a25, 0x6a26, 0x6a27, 0x6a29, 0x6a2b, 0x6a2c, 0x6a2d, 0x6a2e, 0x6a30, 0x6a32, 0x6a33, 0x6a34, 0x6a36, 0x6a37, 0x6a38, 0x6a39, 0x6a3a, 0x6a3b, 0x6a3c, 0x6a3f, 0x6a40, 0x6a41, 0x6a42, 0x6a43, 0x6a45, 0x6a46, 0x6a48, 0x6a49, 0x6a4a, 0x6a4b, 0x6a4c, 0x6a4d, 0x6a4e, 0x6a4f, 0x6a51, 0x6a52, 0x6a53, 0x6a54, 0x6a55, 0x6a56, 0x6a57, 0x6a5a, /* 0x99 */ 0x6a5c, 0x6a5d, 0x6a5e, 0x6a5f, 0x6a60, 0x6a62, 0x6a63, 0x6a64, 0x6a66, 0x6a67, 0x6a68, 0x6a69, 0x6a6a, 0x6a6b, 0x6a6c, 0x6a6d, 0x6a6e, 0x6a6f, 0x6a70, 0x6a72, 0x6a73, 0x6a74, 0x6a75, 0x6a76, 0x6a77, 0x6a78, 0x6a7a, 0x6a7b, 0x6a7d, 0x6a7e, 0x6a7f, 0x6a81, 0x6a82, 0x6a83, 0x6a85, 0x6a86, 0x6a87, 0x6a88, 0x6a89, 0x6a8a, 0x6a8b, 0x6a8c, 0x6a8d, 0x6a8f, 0x6a92, 0x6a93, 0x6a94, 0x6a95, 0x6a96, 0x6a98, 0x6a99, 0x6a9a, 0x6a9b, 0x6a9c, 0x6a9d, 0x6a9e, 0x6a9f, 0x6aa1, 0x6aa2, 0x6aa3, 0x6aa4, 0x6aa5, 0x6aa6, 0x6aa7, 0x6aa8, 0x6aaa, 0x6aad, 0x6aae, 0x6aaf, 0x6ab0, 0x6ab1, 0x6ab2, 0x6ab3, 0x6ab4, 0x6ab5, 0x6ab6, 0x6ab7, 0x6ab8, 0x6ab9, 0x6aba, 0x6abb, 0x6abc, 0x6abd, 0x6abe, 0x6abf, 0x6ac0, 0x6ac1, 0x6ac2, 0x6ac3, 0x6ac4, 0x6ac5, 0x6ac6, 0x6ac7, 0x6ac8, 0x6ac9, 0x6aca, 0x6acb, 0x6acc, 0x6acd, 0x6ace, 0x6acf, 0x6ad0, 0x6ad1, 0x6ad2, 0x6ad3, 0x6ad4, 0x6ad5, 0x6ad6, 0x6ad7, 0x6ad8, 0x6ad9, 0x6ada, 0x6adb, 0x6adc, 0x6add, 0x6ade, 0x6adf, 0x6ae0, 0x6ae1, 0x6ae2, 0x6ae3, 0x6ae4, 0x6ae5, 0x6ae6, 0x6ae7, 0x6ae8, 0x6ae9, 0x6aea, 0x6aeb, 0x6aec, 0x6aed, 0x6aee, 0x6aef, 0x6af0, 0x6af1, 0x6af2, 0x6af3, 0x6af4, 0x6af5, 0x6af6, 0x6af7, 0x6af8, 0x6af9, 0x6afa, 0x6afb, 0x6afc, 0x6afd, 0x6afe, 0x6aff, 0x6b00, 0x6b01, 0x6b02, 0x6b03, 0x6b04, 0x6b05, 0x6b06, 0x6b07, 0x6b08, 0x6b09, 0x6b0a, 0x6b0b, 0x6b0c, 0x6b0d, 0x6b0e, 0x6b0f, 0x6b10, 0x6b11, 0x6b12, 0x6b13, 0x6b14, 0x6b15, 0x6b16, 0x6b17, 0x6b18, 0x6b19, 0x6b1a, 0x6b1b, 0x6b1c, 0x6b1d, 0x6b1e, 0x6b1f, 0x6b25, 0x6b26, 0x6b28, 0x6b29, 0x6b2a, 0x6b2b, 0x6b2c, 0x6b2d, 0x6b2e, /* 0x9a */ 0x6b2f, 0x6b30, 0x6b31, 0x6b33, 0x6b34, 0x6b35, 0x6b36, 0x6b38, 0x6b3b, 0x6b3c, 0x6b3d, 0x6b3f, 0x6b40, 0x6b41, 0x6b42, 0x6b44, 0x6b45, 0x6b48, 0x6b4a, 0x6b4b, 0x6b4d, 0x6b4e, 0x6b4f, 0x6b50, 0x6b51, 0x6b52, 0x6b53, 0x6b54, 0x6b55, 0x6b56, 0x6b57, 0x6b58, 0x6b5a, 0x6b5b, 0x6b5c, 0x6b5d, 0x6b5e, 0x6b5f, 0x6b60, 0x6b61, 0x6b68, 0x6b69, 0x6b6b, 0x6b6c, 0x6b6d, 0x6b6e, 0x6b6f, 0x6b70, 0x6b71, 0x6b72, 0x6b73, 0x6b74, 0x6b75, 0x6b76, 0x6b77, 0x6b78, 0x6b7a, 0x6b7d, 0x6b7e, 0x6b7f, 0x6b80, 0x6b85, 0x6b88, 0x6b8c, 0x6b8e, 0x6b8f, 0x6b90, 0x6b91, 0x6b94, 0x6b95, 0x6b97, 0x6b98, 0x6b99, 0x6b9c, 0x6b9d, 0x6b9e, 0x6b9f, 0x6ba0, 0x6ba2, 0x6ba3, 0x6ba4, 0x6ba5, 0x6ba6, 0x6ba7, 0x6ba8, 0x6ba9, 0x6bab, 0x6bac, 0x6bad, 0x6bae, 0x6baf, 0x6bb0, 0x6bb1, 0x6bb2, 0x6bb6, 0x6bb8, 0x6bb9, 0x6bba, 0x6bbb, 0x6bbc, 0x6bbd, 0x6bbe, 0x6bc0, 0x6bc3, 0x6bc4, 0x6bc6, 0x6bc7, 0x6bc8, 0x6bc9, 0x6bca, 0x6bcc, 0x6bce, 0x6bd0, 0x6bd1, 0x6bd8, 0x6bda, 0x6bdc, 0x6bdd, 0x6bde, 0x6bdf, 0x6be0, 0x6be2, 0x6be3, 0x6be4, 0x6be5, 0x6be6, 0x6be7, 0x6be8, 0x6be9, 0x6bec, 0x6bed, 0x6bee, 0x6bf0, 0x6bf1, 0x6bf2, 0x6bf4, 0x6bf6, 0x6bf7, 0x6bf8, 0x6bfa, 0x6bfb, 0x6bfc, 0x6bfe, 0x6bff, 0x6c00, 0x6c01, 0x6c02, 0x6c03, 0x6c04, 0x6c08, 0x6c09, 0x6c0a, 0x6c0b, 0x6c0c, 0x6c0e, 0x6c12, 0x6c17, 0x6c1c, 0x6c1d, 0x6c1e, 0x6c20, 0x6c23, 0x6c25, 0x6c2b, 0x6c2c, 0x6c2d, 0x6c31, 0x6c33, 0x6c36, 0x6c37, 0x6c39, 0x6c3a, 0x6c3b, 0x6c3c, 0x6c3e, 0x6c3f, 0x6c43, 0x6c44, 0x6c45, 0x6c48, 0x6c4b, 0x6c4c, 0x6c4d, 0x6c4e, 0x6c4f, 0x6c51, 0x6c52, 0x6c53, 0x6c56, 0x6c58, /* 0x9b */ 0x6c59, 0x6c5a, 0x6c62, 0x6c63, 0x6c65, 0x6c66, 0x6c67, 0x6c6b, 0x6c6c, 0x6c6d, 0x6c6e, 0x6c6f, 0x6c71, 0x6c73, 0x6c75, 0x6c77, 0x6c78, 0x6c7a, 0x6c7b, 0x6c7c, 0x6c7f, 0x6c80, 0x6c84, 0x6c87, 0x6c8a, 0x6c8b, 0x6c8d, 0x6c8e, 0x6c91, 0x6c92, 0x6c95, 0x6c96, 0x6c97, 0x6c98, 0x6c9a, 0x6c9c, 0x6c9d, 0x6c9e, 0x6ca0, 0x6ca2, 0x6ca8, 0x6cac, 0x6caf, 0x6cb0, 0x6cb4, 0x6cb5, 0x6cb6, 0x6cb7, 0x6cba, 0x6cc0, 0x6cc1, 0x6cc2, 0x6cc3, 0x6cc6, 0x6cc7, 0x6cc8, 0x6ccb, 0x6ccd, 0x6cce, 0x6ccf, 0x6cd1, 0x6cd2, 0x6cd8, 0x6cd9, 0x6cda, 0x6cdc, 0x6cdd, 0x6cdf, 0x6ce4, 0x6ce6, 0x6ce7, 0x6ce9, 0x6cec, 0x6ced, 0x6cf2, 0x6cf4, 0x6cf9, 0x6cff, 0x6d00, 0x6d02, 0x6d03, 0x6d05, 0x6d06, 0x6d08, 0x6d09, 0x6d0a, 0x6d0d, 0x6d0f, 0x6d10, 0x6d11, 0x6d13, 0x6d14, 0x6d15, 0x6d16, 0x6d18, 0x6d1c, 0x6d1d, 0x6d1f, 0x6d20, 0x6d21, 0x6d22, 0x6d23, 0x6d24, 0x6d26, 0x6d28, 0x6d29, 0x6d2c, 0x6d2d, 0x6d2f, 0x6d30, 0x6d34, 0x6d36, 0x6d37, 0x6d38, 0x6d3a, 0x6d3f, 0x6d40, 0x6d42, 0x6d44, 0x6d49, 0x6d4c, 0x6d50, 0x6d55, 0x6d56, 0x6d57, 0x6d58, 0x6d5b, 0x6d5d, 0x6d5f, 0x6d61, 0x6d62, 0x6d64, 0x6d65, 0x6d67, 0x6d68, 0x6d6b, 0x6d6c, 0x6d6d, 0x6d70, 0x6d71, 0x6d72, 0x6d73, 0x6d75, 0x6d76, 0x6d79, 0x6d7a, 0x6d7b, 0x6d7d, 0x6d7e, 0x6d7f, 0x6d80, 0x6d81, 0x6d83, 0x6d84, 0x6d86, 0x6d87, 0x6d8a, 0x6d8b, 0x6d8d, 0x6d8f, 0x6d90, 0x6d92, 0x6d96, 0x6d97, 0x6d98, 0x6d99, 0x6d9a, 0x6d9c, 0x6da2, 0x6da5, 0x6dac, 0x6dad, 0x6db0, 0x6db1, 0x6db3, 0x6db4, 0x6db6, 0x6db7, 0x6db9, 0x6dba, 0x6dbb, 0x6dbc, 0x6dbd, 0x6dbe, 0x6dc1, 0x6dc2, 0x6dc3, 0x6dc8, 0x6dc9, 0x6dca, /* 0x9c */ 0x6dcd, 0x6dce, 0x6dcf, 0x6dd0, 0x6dd2, 0x6dd3, 0x6dd4, 0x6dd5, 0x6dd7, 0x6dda, 0x6ddb, 0x6ddc, 0x6ddf, 0x6de2, 0x6de3, 0x6de5, 0x6de7, 0x6de8, 0x6de9, 0x6dea, 0x6ded, 0x6def, 0x6df0, 0x6df2, 0x6df4, 0x6df5, 0x6df6, 0x6df8, 0x6dfa, 0x6dfd, 0x6dfe, 0x6dff, 0x6e00, 0x6e01, 0x6e02, 0x6e03, 0x6e04, 0x6e06, 0x6e07, 0x6e08, 0x6e09, 0x6e0b, 0x6e0f, 0x6e12, 0x6e13, 0x6e15, 0x6e18, 0x6e19, 0x6e1b, 0x6e1c, 0x6e1e, 0x6e1f, 0x6e22, 0x6e26, 0x6e27, 0x6e28, 0x6e2a, 0x6e2c, 0x6e2e, 0x6e30, 0x6e31, 0x6e33, 0x6e35, 0x6e36, 0x6e37, 0x6e39, 0x6e3b, 0x6e3c, 0x6e3d, 0x6e3e, 0x6e3f, 0x6e40, 0x6e41, 0x6e42, 0x6e45, 0x6e46, 0x6e47, 0x6e48, 0x6e49, 0x6e4a, 0x6e4b, 0x6e4c, 0x6e4f, 0x6e50, 0x6e51, 0x6e52, 0x6e55, 0x6e57, 0x6e59, 0x6e5a, 0x6e5c, 0x6e5d, 0x6e5e, 0x6e60, 0x6e61, 0x6e62, 0x6e63, 0x6e64, 0x6e65, 0x6e66, 0x6e67, 0x6e68, 0x6e69, 0x6e6a, 0x6e6c, 0x6e6d, 0x6e6f, 0x6e70, 0x6e71, 0x6e72, 0x6e73, 0x6e74, 0x6e75, 0x6e76, 0x6e77, 0x6e78, 0x6e79, 0x6e7a, 0x6e7b, 0x6e7c, 0x6e7d, 0x6e80, 0x6e81, 0x6e82, 0x6e84, 0x6e87, 0x6e88, 0x6e8a, 0x6e8b, 0x6e8c, 0x6e8d, 0x6e8e, 0x6e91, 0x6e92, 0x6e93, 0x6e94, 0x6e95, 0x6e96, 0x6e97, 0x6e99, 0x6e9a, 0x6e9b, 0x6e9d, 0x6e9e, 0x6ea0, 0x6ea1, 0x6ea3, 0x6ea4, 0x6ea6, 0x6ea8, 0x6ea9, 0x6eab, 0x6eac, 0x6ead, 0x6eae, 0x6eb0, 0x6eb3, 0x6eb5, 0x6eb8, 0x6eb9, 0x6ebc, 0x6ebe, 0x6ebf, 0x6ec0, 0x6ec3, 0x6ec4, 0x6ec5, 0x6ec6, 0x6ec8, 0x6ec9, 0x6eca, 0x6ecc, 0x6ecd, 0x6ece, 0x6ed0, 0x6ed2, 0x6ed6, 0x6ed8, 0x6ed9, 0x6edb, 0x6edc, 0x6edd, 0x6ee3, 0x6ee7, 0x6eea, 0x6eeb, 0x6eec, 0x6eed, 0x6eee, 0x6eef, /* 0x9d */ 0x6ef0, 0x6ef1, 0x6ef2, 0x6ef3, 0x6ef5, 0x6ef6, 0x6ef7, 0x6ef8, 0x6efa, 0x6efb, 0x6efc, 0x6efd, 0x6efe, 0x6eff, 0x6f00, 0x6f01, 0x6f03, 0x6f04, 0x6f05, 0x6f07, 0x6f08, 0x6f0a, 0x6f0b, 0x6f0c, 0x6f0d, 0x6f0e, 0x6f10, 0x6f11, 0x6f12, 0x6f16, 0x6f17, 0x6f18, 0x6f19, 0x6f1a, 0x6f1b, 0x6f1c, 0x6f1d, 0x6f1e, 0x6f1f, 0x6f21, 0x6f22, 0x6f23, 0x6f25, 0x6f26, 0x6f27, 0x6f28, 0x6f2c, 0x6f2e, 0x6f30, 0x6f32, 0x6f34, 0x6f35, 0x6f37, 0x6f38, 0x6f39, 0x6f3a, 0x6f3b, 0x6f3c, 0x6f3d, 0x6f3f, 0x6f40, 0x6f41, 0x6f42, 0x6f43, 0x6f44, 0x6f45, 0x6f48, 0x6f49, 0x6f4a, 0x6f4c, 0x6f4e, 0x6f4f, 0x6f50, 0x6f51, 0x6f52, 0x6f53, 0x6f54, 0x6f55, 0x6f56, 0x6f57, 0x6f59, 0x6f5a, 0x6f5b, 0x6f5d, 0x6f5f, 0x6f60, 0x6f61, 0x6f63, 0x6f64, 0x6f65, 0x6f67, 0x6f68, 0x6f69, 0x6f6a, 0x6f6b, 0x6f6c, 0x6f6f, 0x6f70, 0x6f71, 0x6f73, 0x6f75, 0x6f76, 0x6f77, 0x6f79, 0x6f7b, 0x6f7d, 0x6f7e, 0x6f7f, 0x6f80, 0x6f81, 0x6f82, 0x6f83, 0x6f85, 0x6f86, 0x6f87, 0x6f8a, 0x6f8b, 0x6f8f, 0x6f90, 0x6f91, 0x6f92, 0x6f93, 0x6f94, 0x6f95, 0x6f96, 0x6f97, 0x6f98, 0x6f99, 0x6f9a, 0x6f9b, 0x6f9d, 0x6f9e, 0x6f9f, 0x6fa0, 0x6fa2, 0x6fa3, 0x6fa4, 0x6fa5, 0x6fa6, 0x6fa8, 0x6fa9, 0x6faa, 0x6fab, 0x6fac, 0x6fad, 0x6fae, 0x6faf, 0x6fb0, 0x6fb1, 0x6fb2, 0x6fb4, 0x6fb5, 0x6fb7, 0x6fb8, 0x6fba, 0x6fbb, 0x6fbc, 0x6fbd, 0x6fbe, 0x6fbf, 0x6fc1, 0x6fc3, 0x6fc4, 0x6fc5, 0x6fc6, 0x6fc7, 0x6fc8, 0x6fca, 0x6fcb, 0x6fcc, 0x6fcd, 0x6fce, 0x6fcf, 0x6fd0, 0x6fd3, 0x6fd4, 0x6fd5, 0x6fd6, 0x6fd7, 0x6fd8, 0x6fd9, 0x6fda, 0x6fdb, 0x6fdc, 0x6fdd, 0x6fdf, 0x6fe2, 0x6fe3, 0x6fe4, 0x6fe5, /* 0x9e */ 0x6fe6, 0x6fe7, 0x6fe8, 0x6fe9, 0x6fea, 0x6feb, 0x6fec, 0x6fed, 0x6ff0, 0x6ff1, 0x6ff2, 0x6ff3, 0x6ff4, 0x6ff5, 0x6ff6, 0x6ff7, 0x6ff8, 0x6ff9, 0x6ffa, 0x6ffb, 0x6ffc, 0x6ffd, 0x6ffe, 0x6fff, 0x7000, 0x7001, 0x7002, 0x7003, 0x7004, 0x7005, 0x7006, 0x7007, 0x7008, 0x7009, 0x700a, 0x700b, 0x700c, 0x700d, 0x700e, 0x700f, 0x7010, 0x7012, 0x7013, 0x7014, 0x7015, 0x7016, 0x7017, 0x7018, 0x7019, 0x701c, 0x701d, 0x701e, 0x701f, 0x7020, 0x7021, 0x7022, 0x7024, 0x7025, 0x7026, 0x7027, 0x7028, 0x7029, 0x702a, 0x702b, 0x702c, 0x702d, 0x702e, 0x702f, 0x7030, 0x7031, 0x7032, 0x7033, 0x7034, 0x7036, 0x7037, 0x7038, 0x703a, 0x703b, 0x703c, 0x703d, 0x703e, 0x703f, 0x7040, 0x7041, 0x7042, 0x7043, 0x7044, 0x7045, 0x7046, 0x7047, 0x7048, 0x7049, 0x704a, 0x704b, 0x704d, 0x704e, 0x7050, 0x7051, 0x7052, 0x7053, 0x7054, 0x7055, 0x7056, 0x7057, 0x7058, 0x7059, 0x705a, 0x705b, 0x705c, 0x705d, 0x705f, 0x7060, 0x7061, 0x7062, 0x7063, 0x7064, 0x7065, 0x7066, 0x7067, 0x7068, 0x7069, 0x706a, 0x706e, 0x7071, 0x7072, 0x7073, 0x7074, 0x7077, 0x7079, 0x707a, 0x707b, 0x707d, 0x7081, 0x7082, 0x7083, 0x7084, 0x7086, 0x7087, 0x7088, 0x708b, 0x708c, 0x708d, 0x708f, 0x7090, 0x7091, 0x7093, 0x7097, 0x7098, 0x709a, 0x709b, 0x709e, 0x709f, 0x70a0, 0x70a1, 0x70a2, 0x70a3, 0x70a4, 0x70a5, 0x70a6, 0x70a7, 0x70a8, 0x70a9, 0x70aa, 0x70b0, 0x70b2, 0x70b4, 0x70b5, 0x70b6, 0x70ba, 0x70be, 0x70bf, 0x70c4, 0x70c5, 0x70c6, 0x70c7, 0x70c9, 0x70cb, 0x70cc, 0x70cd, 0x70ce, 0x70cf, 0x70d0, 0x70d1, 0x70d2, 0x70d3, 0x70d4, 0x70d5, 0x70d6, 0x70d7, 0x70da, /* 0x9f */ 0x70dc, 0x70dd, 0x70de, 0x70e0, 0x70e1, 0x70e2, 0x70e3, 0x70e5, 0x70ea, 0x70ee, 0x70f0, 0x70f1, 0x70f2, 0x70f3, 0x70f4, 0x70f5, 0x70f6, 0x70f8, 0x70fa, 0x70fb, 0x70fc, 0x70fe, 0x70ff, 0x7100, 0x7101, 0x7102, 0x7103, 0x7104, 0x7105, 0x7106, 0x7107, 0x7108, 0x710b, 0x710c, 0x710d, 0x710e, 0x710f, 0x7111, 0x7112, 0x7114, 0x7117, 0x711b, 0x711c, 0x711d, 0x711e, 0x711f, 0x7120, 0x7121, 0x7122, 0x7123, 0x7124, 0x7125, 0x7127, 0x7128, 0x7129, 0x712a, 0x712b, 0x712c, 0x712d, 0x712e, 0x7132, 0x7133, 0x7134, 0x7135, 0x7137, 0x7138, 0x7139, 0x713a, 0x713b, 0x713c, 0x713d, 0x713e, 0x713f, 0x7140, 0x7141, 0x7142, 0x7143, 0x7144, 0x7146, 0x7147, 0x7148, 0x7149, 0x714b, 0x714d, 0x714f, 0x7150, 0x7151, 0x7152, 0x7153, 0x7154, 0x7155, 0x7156, 0x7157, 0x7158, 0x7159, 0x715a, 0x715b, 0x715d, 0x715f, 0x7160, 0x7161, 0x7162, 0x7163, 0x7165, 0x7169, 0x716a, 0x716b, 0x716c, 0x716d, 0x716f, 0x7170, 0x7171, 0x7174, 0x7175, 0x7176, 0x7177, 0x7179, 0x717b, 0x717c, 0x717e, 0x717f, 0x7180, 0x7181, 0x7182, 0x7183, 0x7185, 0x7186, 0x7187, 0x7188, 0x7189, 0x718b, 0x718c, 0x718d, 0x718e, 0x7190, 0x7191, 0x7192, 0x7193, 0x7195, 0x7196, 0x7197, 0x719a, 0x719b, 0x719c, 0x719d, 0x719e, 0x71a1, 0x71a2, 0x71a3, 0x71a4, 0x71a5, 0x71a6, 0x71a7, 0x71a9, 0x71aa, 0x71ab, 0x71ad, 0x71ae, 0x71af, 0x71b0, 0x71b1, 0x71b2, 0x71b4, 0x71b6, 0x71b7, 0x71b8, 0x71ba, 0x71bb, 0x71bc, 0x71bd, 0x71be, 0x71bf, 0x71c0, 0x71c1, 0x71c2, 0x71c4, 0x71c5, 0x71c6, 0x71c7, 0x71c8, 0x71c9, 0x71ca, 0x71cb, 0x71cc, 0x71cd, 0x71cf, 0x71d0, 0x71d1, 0x71d2, 0x71d3, /* 0xa0 */ 0x71d6, 0x71d7, 0x71d8, 0x71d9, 0x71da, 0x71db, 0x71dc, 0x71dd, 0x71de, 0x71df, 0x71e1, 0x71e2, 0x71e3, 0x71e4, 0x71e6, 0x71e8, 0x71e9, 0x71ea, 0x71eb, 0x71ec, 0x71ed, 0x71ef, 0x71f0, 0x71f1, 0x71f2, 0x71f3, 0x71f4, 0x71f5, 0x71f6, 0x71f7, 0x71f8, 0x71fa, 0x71fb, 0x71fc, 0x71fd, 0x71fe, 0x71ff, 0x7200, 0x7201, 0x7202, 0x7203, 0x7204, 0x7205, 0x7207, 0x7208, 0x7209, 0x720a, 0x720b, 0x720c, 0x720d, 0x720e, 0x720f, 0x7210, 0x7211, 0x7212, 0x7213, 0x7214, 0x7215, 0x7216, 0x7217, 0x7218, 0x7219, 0x721a, 0x721b, 0x721c, 0x721e, 0x721f, 0x7220, 0x7221, 0x7222, 0x7223, 0x7224, 0x7225, 0x7226, 0x7227, 0x7229, 0x722b, 0x722d, 0x722e, 0x722f, 0x7232, 0x7233, 0x7234, 0x723a, 0x723c, 0x723e, 0x7240, 0x7241, 0x7242, 0x7243, 0x7244, 0x7245, 0x7246, 0x7249, 0x724a, 0x724b, 0x724e, 0x724f, 0x7250, 0x7251, 0x7253, 0x7254, 0x7255, 0x7257, 0x7258, 0x725a, 0x725c, 0x725e, 0x7260, 0x7263, 0x7264, 0x7265, 0x7268, 0x726a, 0x726b, 0x726c, 0x726d, 0x7270, 0x7271, 0x7273, 0x7274, 0x7276, 0x7277, 0x7278, 0x727b, 0x727c, 0x727d, 0x7282, 0x7283, 0x7285, 0x7286, 0x7287, 0x7288, 0x7289, 0x728c, 0x728e, 0x7290, 0x7291, 0x7293, 0x7294, 0x7295, 0x7296, 0x7297, 0x7298, 0x7299, 0x729a, 0x729b, 0x729c, 0x729d, 0x729e, 0x72a0, 0x72a1, 0x72a2, 0x72a3, 0x72a4, 0x72a5, 0x72a6, 0x72a7, 0x72a8, 0x72a9, 0x72aa, 0x72ab, 0x72ae, 0x72b1, 0x72b2, 0x72b3, 0x72b5, 0x72ba, 0x72bb, 0x72bc, 0x72bd, 0x72be, 0x72bf, 0x72c0, 0x72c5, 0x72c6, 0x72c7, 0x72c9, 0x72ca, 0x72cb, 0x72cc, 0x72cf, 0x72d1, 0x72d3, 0x72d4, 0x72d5, 0x72d6, 0x72d8, 0x72da, 0x72db, /* 0xa1 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x3000, 0x3001, 0x3002, 0x00b7, 0x02c9, 0x02c7, 0x00a8, 0x3003, 0x3005, 0x2014, 0xff5e, 0x2016, 0x2026, 0x2018, 0x2019, 0x201c, 0x201d, 0x3014, 0x3015, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, 0x300d, 0x300e, 0x300f, 0x3016, 0x3017, 0x3010, 0x3011, 0x00b1, 0x00d7, 0x00f7, 0x2236, 0x2227, 0x2228, 0x2211, 0x220f, 0x222a, 0x2229, 0x2208, 0x2237, 0x221a, 0x22a5, 0x2225, 0x2220, 0x2312, 0x2299, 0x222b, 0x222e, 0x2261, 0x224c, 0x2248, 0x223d, 0x221d, 0x2260, 0x226e, 0x226f, 0x2264, 0x2265, 0x221e, 0x2235, 0x2234, 0x2642, 0x2640, 0x00b0, 0x2032, 0x2033, 0x2103, 0xff04, 0x00a4, 0xffe0, 0xffe1, 0x2030, 0x00a7, 0x2116, 0x2606, 0x2605, 0x25cb, 0x25cf, 0x25ce, 0x25c7, 0x25c6, 0x25a1, 0x25a0, 0x25b3, 0x25b2, 0x203b, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, /* 0xa2 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2488, 0x2489, 0x248a, 0x248b, 0x248c, 0x248d, 0x248e, 0x248f, 0x2490, 0x2491, 0x2492, 0x2493, 0x2494, 0x2495, 0x2496, 0x2497, 0x2498, 0x2499, 0x249a, 0x249b, 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, 0x247b, 0x247c, 0x247d, 0x247e, 0x247f, 0x2480, 0x2481, 0x2482, 0x2483, 0x2484, 0x2485, 0x2486, 0x2487, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0xfffd, 0xfffd, 0x3220, 0x3221, 0x3222, 0x3223, 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, 0xfffd, 0xfffd, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0x216a, 0x216b, 0xfffd, 0xfffd, /* 0xa3 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xff01, 0xff02, 0xff03, 0xffe5, 0xff05, 0xff06, 0xff07, 0xff08, 0xff09, 0xff0a, 0xff0b, 0xff0c, 0xff0d, 0xff0e, 0xff0f, 0xff10, 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, 0xff19, 0xff1a, 0xff1b, 0xff1c, 0xff1d, 0xff1e, 0xff1f, 0xff20, 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0xff3b, 0xff3c, 0xff3d, 0xff3e, 0xff3f, 0xff40, 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58, 0xff59, 0xff5a, 0xff5b, 0xff5c, 0xff5d, 0xffe3, /* 0xa4 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, 0x3091, 0x3092, 0x3093, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xa5 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8, 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8, 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0, 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8, 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0, 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xa6 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfe35, 0xfe36, 0xfe39, 0xfe3a, 0xfe3f, 0xfe40, 0xfe3d, 0xfe3e, 0xfe41, 0xfe42, 0xfe43, 0xfe44, 0xfffd, 0xfffd, 0xfe3b, 0xfe3c, 0xfe37, 0xfe38, 0xfe31, 0xfffd, 0xfe33, 0xfe34, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xa7 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xa8 */ 0x02ca, 0x02cb, 0x02d9, 0x2013, 0x2015, 0x2025, 0x2035, 0x2105, 0x2109, 0x2196, 0x2197, 0x2198, 0x2199, 0x2215, 0x221f, 0x2223, 0x2252, 0x2266, 0x2267, 0x22bf, 0x2550, 0x2551, 0x2552, 0x2553, 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, 0x255e, 0x255f, 0x2560, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x256d, 0x256e, 0x256f, 0x2570, 0x2571, 0x2572, 0x2573, 0x2581, 0x2582, 0x2583, 0x2584, 0x2585, 0x2586, 0x2587, 0x2588, 0x2589, 0x258a, 0x258b, 0x258c, 0x258d, 0x258e, 0x258f, 0x2593, 0x2594, 0x2595, 0x25bc, 0x25bd, 0x25e2, 0x25e3, 0x25e4, 0x25e5, 0x2609, 0x2295, 0x3012, 0x301d, 0x301e, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0101, 0x00e1, 0x01ce, 0x00e0, 0x0113, 0x00e9, 0x011b, 0x00e8, 0x012b, 0x00ed, 0x01d0, 0x00ec, 0x014d, 0x00f3, 0x01d2, 0x00f2, 0x016b, 0x00fa, 0x01d4, 0x00f9, 0x01d6, 0x01d8, 0x01da, 0x01dc, 0x00fc, 0x00ea, 0x0251, 0xfffd, 0x0144, 0x0148, 0xfffd, 0x0261, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x3105, 0x3106, 0x3107, 0x3108, 0x3109, 0x310a, 0x310b, 0x310c, 0x310d, 0x310e, 0x310f, 0x3110, 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, 0x3117, 0x3118, 0x3119, 0x311a, 0x311b, 0x311c, 0x311d, 0x311e, 0x311f, 0x3120, 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, 0x3129, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xa9 */ 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027, 0x3028, 0x3029, 0x32a3, 0x338e, 0x338f, 0x339c, 0x339d, 0x339e, 0x33a1, 0x33c4, 0x33ce, 0x33d1, 0x33d2, 0x33d5, 0xfe30, 0xffe2, 0xffe4, 0xfffd, 0x2121, 0x3231, 0xfffd, 0x2010, 0xfffd, 0xfffd, 0xfffd, 0x30fc, 0x309b, 0x309c, 0x30fd, 0x30fe, 0x3006, 0x309d, 0x309e, 0xfe49, 0xfe4a, 0xfe4b, 0xfe4c, 0xfe4d, 0xfe4e, 0xfe4f, 0xfe50, 0xfe51, 0xfe52, 0xfe54, 0xfe55, 0xfe56, 0xfe57, 0xfe59, 0xfe5a, 0xfe5b, 0xfe5c, 0xfe5d, 0xfe5e, 0xfe5f, 0xfe60, 0xfe61, 0xfe62, 0xfe63, 0xfe64, 0xfe65, 0xfe66, 0xfe68, 0xfe69, 0xfe6a, 0xfe6b, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x3007, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2500, 0x2501, 0x2502, 0x2503, 0x2504, 0x2505, 0x2506, 0x2507, 0x2508, 0x2509, 0x250a, 0x250b, 0x250c, 0x250d, 0x250e, 0x250f, 0x2510, 0x2511, 0x2512, 0x2513, 0x2514, 0x2515, 0x2516, 0x2517, 0x2518, 0x2519, 0x251a, 0x251b, 0x251c, 0x251d, 0x251e, 0x251f, 0x2520, 0x2521, 0x2522, 0x2523, 0x2524, 0x2525, 0x2526, 0x2527, 0x2528, 0x2529, 0x252a, 0x252b, 0x252c, 0x252d, 0x252e, 0x252f, 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, 0x2535, 0x2536, 0x2537, 0x2538, 0x2539, 0x253a, 0x253b, 0x253c, 0x253d, 0x253e, 0x253f, 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xaa */ 0x72dc, 0x72dd, 0x72df, 0x72e2, 0x72e3, 0x72e4, 0x72e5, 0x72e6, 0x72e7, 0x72ea, 0x72eb, 0x72f5, 0x72f6, 0x72f9, 0x72fd, 0x72fe, 0x72ff, 0x7300, 0x7302, 0x7304, 0x7305, 0x7306, 0x7307, 0x7308, 0x7309, 0x730b, 0x730c, 0x730d, 0x730f, 0x7310, 0x7311, 0x7312, 0x7314, 0x7318, 0x7319, 0x731a, 0x731f, 0x7320, 0x7323, 0x7324, 0x7326, 0x7327, 0x7328, 0x732d, 0x732f, 0x7330, 0x7332, 0x7333, 0x7335, 0x7336, 0x733a, 0x733b, 0x733c, 0x733d, 0x7340, 0x7341, 0x7342, 0x7343, 0x7344, 0x7345, 0x7346, 0x7347, 0x7348, 0x7349, 0x734a, 0x734b, 0x734c, 0x734e, 0x734f, 0x7351, 0x7353, 0x7354, 0x7355, 0x7356, 0x7358, 0x7359, 0x735a, 0x735b, 0x735c, 0x735d, 0x735e, 0x735f, 0x7361, 0x7362, 0x7363, 0x7364, 0x7365, 0x7366, 0x7367, 0x7368, 0x7369, 0x736a, 0x736b, 0x736e, 0x7370, 0x7371, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xab */ 0x7372, 0x7373, 0x7374, 0x7375, 0x7376, 0x7377, 0x7378, 0x7379, 0x737a, 0x737b, 0x737c, 0x737d, 0x737f, 0x7380, 0x7381, 0x7382, 0x7383, 0x7385, 0x7386, 0x7388, 0x738a, 0x738c, 0x738d, 0x738f, 0x7390, 0x7392, 0x7393, 0x7394, 0x7395, 0x7397, 0x7398, 0x7399, 0x739a, 0x739c, 0x739d, 0x739e, 0x73a0, 0x73a1, 0x73a3, 0x73a4, 0x73a5, 0x73a6, 0x73a7, 0x73a8, 0x73aa, 0x73ac, 0x73ad, 0x73b1, 0x73b4, 0x73b5, 0x73b6, 0x73b8, 0x73b9, 0x73bc, 0x73bd, 0x73be, 0x73bf, 0x73c1, 0x73c3, 0x73c4, 0x73c5, 0x73c6, 0x73c7, 0x73cb, 0x73cc, 0x73ce, 0x73d2, 0x73d3, 0x73d4, 0x73d5, 0x73d6, 0x73d7, 0x73d8, 0x73da, 0x73db, 0x73dc, 0x73dd, 0x73df, 0x73e1, 0x73e2, 0x73e3, 0x73e4, 0x73e6, 0x73e8, 0x73ea, 0x73eb, 0x73ec, 0x73ee, 0x73ef, 0x73f0, 0x73f1, 0x73f3, 0x73f4, 0x73f5, 0x73f6, 0x73f7, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xac */ 0x73f8, 0x73f9, 0x73fa, 0x73fb, 0x73fc, 0x73fd, 0x73fe, 0x73ff, 0x7400, 0x7401, 0x7402, 0x7404, 0x7407, 0x7408, 0x740b, 0x740c, 0x740d, 0x740e, 0x7411, 0x7412, 0x7413, 0x7414, 0x7415, 0x7416, 0x7417, 0x7418, 0x7419, 0x741c, 0x741d, 0x741e, 0x741f, 0x7420, 0x7421, 0x7423, 0x7424, 0x7427, 0x7429, 0x742b, 0x742d, 0x742f, 0x7431, 0x7432, 0x7437, 0x7438, 0x7439, 0x743a, 0x743b, 0x743d, 0x743e, 0x743f, 0x7440, 0x7442, 0x7443, 0x7444, 0x7445, 0x7446, 0x7447, 0x7448, 0x7449, 0x744a, 0x744b, 0x744c, 0x744d, 0x744e, 0x744f, 0x7450, 0x7451, 0x7452, 0x7453, 0x7454, 0x7456, 0x7458, 0x745d, 0x7460, 0x7461, 0x7462, 0x7463, 0x7464, 0x7465, 0x7466, 0x7467, 0x7468, 0x7469, 0x746a, 0x746b, 0x746c, 0x746e, 0x746f, 0x7471, 0x7472, 0x7473, 0x7474, 0x7475, 0x7478, 0x7479, 0x747a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xad */ 0x747b, 0x747c, 0x747d, 0x747f, 0x7482, 0x7484, 0x7485, 0x7486, 0x7488, 0x7489, 0x748a, 0x748c, 0x748d, 0x748f, 0x7491, 0x7492, 0x7493, 0x7494, 0x7495, 0x7496, 0x7497, 0x7498, 0x7499, 0x749a, 0x749b, 0x749d, 0x749f, 0x74a0, 0x74a1, 0x74a2, 0x74a3, 0x74a4, 0x74a5, 0x74a6, 0x74aa, 0x74ab, 0x74ac, 0x74ad, 0x74ae, 0x74af, 0x74b0, 0x74b1, 0x74b2, 0x74b3, 0x74b4, 0x74b5, 0x74b6, 0x74b7, 0x74b8, 0x74b9, 0x74bb, 0x74bc, 0x74bd, 0x74be, 0x74bf, 0x74c0, 0x74c1, 0x74c2, 0x74c3, 0x74c4, 0x74c5, 0x74c6, 0x74c7, 0x74c8, 0x74c9, 0x74ca, 0x74cb, 0x74cc, 0x74cd, 0x74ce, 0x74cf, 0x74d0, 0x74d1, 0x74d3, 0x74d4, 0x74d5, 0x74d6, 0x74d7, 0x74d8, 0x74d9, 0x74da, 0x74db, 0x74dd, 0x74df, 0x74e1, 0x74e5, 0x74e7, 0x74e8, 0x74e9, 0x74ea, 0x74eb, 0x74ec, 0x74ed, 0x74f0, 0x74f1, 0x74f2, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xae */ 0x74f3, 0x74f5, 0x74f8, 0x74f9, 0x74fa, 0x74fb, 0x74fc, 0x74fd, 0x74fe, 0x7500, 0x7501, 0x7502, 0x7503, 0x7505, 0x7506, 0x7507, 0x7508, 0x7509, 0x750a, 0x750b, 0x750c, 0x750e, 0x7510, 0x7512, 0x7514, 0x7515, 0x7516, 0x7517, 0x751b, 0x751d, 0x751e, 0x7520, 0x7521, 0x7522, 0x7523, 0x7524, 0x7526, 0x7527, 0x752a, 0x752e, 0x7534, 0x7536, 0x7539, 0x753c, 0x753d, 0x753f, 0x7541, 0x7542, 0x7543, 0x7544, 0x7546, 0x7547, 0x7549, 0x754a, 0x754d, 0x7550, 0x7551, 0x7552, 0x7553, 0x7555, 0x7556, 0x7557, 0x7558, 0x755d, 0x755e, 0x755f, 0x7560, 0x7561, 0x7562, 0x7563, 0x7564, 0x7567, 0x7568, 0x7569, 0x756b, 0x756c, 0x756d, 0x756e, 0x756f, 0x7570, 0x7571, 0x7573, 0x7575, 0x7576, 0x7577, 0x757a, 0x757b, 0x757c, 0x757d, 0x757e, 0x7580, 0x7581, 0x7582, 0x7584, 0x7585, 0x7587, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xaf */ 0x7588, 0x7589, 0x758a, 0x758c, 0x758d, 0x758e, 0x7590, 0x7593, 0x7595, 0x7598, 0x759b, 0x759c, 0x759e, 0x75a2, 0x75a6, 0x75a7, 0x75a8, 0x75a9, 0x75aa, 0x75ad, 0x75b6, 0x75b7, 0x75ba, 0x75bb, 0x75bf, 0x75c0, 0x75c1, 0x75c6, 0x75cb, 0x75cc, 0x75ce, 0x75cf, 0x75d0, 0x75d1, 0x75d3, 0x75d7, 0x75d9, 0x75da, 0x75dc, 0x75dd, 0x75df, 0x75e0, 0x75e1, 0x75e5, 0x75e9, 0x75ec, 0x75ed, 0x75ee, 0x75ef, 0x75f2, 0x75f3, 0x75f5, 0x75f6, 0x75f7, 0x75f8, 0x75fa, 0x75fb, 0x75fd, 0x75fe, 0x7602, 0x7604, 0x7606, 0x7607, 0x7608, 0x7609, 0x760b, 0x760d, 0x760e, 0x760f, 0x7611, 0x7612, 0x7613, 0x7614, 0x7616, 0x761a, 0x761c, 0x761d, 0x761e, 0x7621, 0x7623, 0x7627, 0x7628, 0x762c, 0x762e, 0x762f, 0x7631, 0x7632, 0x7636, 0x7637, 0x7639, 0x763a, 0x763b, 0x763d, 0x7641, 0x7642, 0x7644, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xb0 */ 0x7645, 0x7646, 0x7647, 0x7648, 0x7649, 0x764a, 0x764b, 0x764e, 0x764f, 0x7650, 0x7651, 0x7652, 0x7653, 0x7655, 0x7657, 0x7658, 0x7659, 0x765a, 0x765b, 0x765d, 0x765f, 0x7660, 0x7661, 0x7662, 0x7664, 0x7665, 0x7666, 0x7667, 0x7668, 0x7669, 0x766a, 0x766c, 0x766d, 0x766e, 0x7670, 0x7671, 0x7672, 0x7673, 0x7674, 0x7675, 0x7676, 0x7677, 0x7679, 0x767a, 0x767c, 0x767f, 0x7680, 0x7681, 0x7683, 0x7685, 0x7689, 0x768a, 0x768c, 0x768d, 0x768f, 0x7690, 0x7692, 0x7694, 0x7695, 0x7697, 0x7698, 0x769a, 0x769b, 0x769c, 0x769d, 0x769e, 0x769f, 0x76a0, 0x76a1, 0x76a2, 0x76a3, 0x76a5, 0x76a6, 0x76a7, 0x76a8, 0x76a9, 0x76aa, 0x76ab, 0x76ac, 0x76ad, 0x76af, 0x76b0, 0x76b3, 0x76b5, 0x76b6, 0x76b7, 0x76b8, 0x76b9, 0x76ba, 0x76bb, 0x76bc, 0x76bd, 0x76be, 0x76c0, 0x76c1, 0x76c3, 0x554a, 0x963f, 0x57c3, 0x6328, 0x54ce, 0x5509, 0x54c0, 0x7691, 0x764c, 0x853c, 0x77ee, 0x827e, 0x788d, 0x7231, 0x9698, 0x978d, 0x6c28, 0x5b89, 0x4ffa, 0x6309, 0x6697, 0x5cb8, 0x80fa, 0x6848, 0x80ae, 0x6602, 0x76ce, 0x51f9, 0x6556, 0x71ac, 0x7ff1, 0x8884, 0x50b2, 0x5965, 0x61ca, 0x6fb3, 0x82ad, 0x634c, 0x6252, 0x53ed, 0x5427, 0x7b06, 0x516b, 0x75a4, 0x5df4, 0x62d4, 0x8dcb, 0x9776, 0x628a, 0x8019, 0x575d, 0x9738, 0x7f62, 0x7238, 0x767d, 0x67cf, 0x767e, 0x6446, 0x4f70, 0x8d25, 0x62dc, 0x7a17, 0x6591, 0x73ed, 0x642c, 0x6273, 0x822c, 0x9881, 0x677f, 0x7248, 0x626e, 0x62cc, 0x4f34, 0x74e3, 0x534a, 0x529e, 0x7eca, 0x90a6, 0x5e2e, 0x6886, 0x699c, 0x8180, 0x7ed1, 0x68d2, 0x78c5, 0x868c, 0x9551, 0x508d, 0x8c24, 0x82de, 0x80de, 0x5305, 0x8912, 0x5265, /* 0xb1 */ 0x76c4, 0x76c7, 0x76c9, 0x76cb, 0x76cc, 0x76d3, 0x76d5, 0x76d9, 0x76da, 0x76dc, 0x76dd, 0x76de, 0x76e0, 0x76e1, 0x76e2, 0x76e3, 0x76e4, 0x76e6, 0x76e7, 0x76e8, 0x76e9, 0x76ea, 0x76eb, 0x76ec, 0x76ed, 0x76f0, 0x76f3, 0x76f5, 0x76f6, 0x76f7, 0x76fa, 0x76fb, 0x76fd, 0x76ff, 0x7700, 0x7702, 0x7703, 0x7705, 0x7706, 0x770a, 0x770c, 0x770e, 0x770f, 0x7710, 0x7711, 0x7712, 0x7713, 0x7714, 0x7715, 0x7716, 0x7717, 0x7718, 0x771b, 0x771c, 0x771d, 0x771e, 0x7721, 0x7723, 0x7724, 0x7725, 0x7727, 0x772a, 0x772b, 0x772c, 0x772e, 0x7730, 0x7731, 0x7732, 0x7733, 0x7734, 0x7739, 0x773b, 0x773d, 0x773e, 0x773f, 0x7742, 0x7744, 0x7745, 0x7746, 0x7748, 0x7749, 0x774a, 0x774b, 0x774c, 0x774d, 0x774e, 0x774f, 0x7752, 0x7753, 0x7754, 0x7755, 0x7756, 0x7757, 0x7758, 0x7759, 0x775c, 0x8584, 0x96f9, 0x4fdd, 0x5821, 0x9971, 0x5b9d, 0x62b1, 0x62a5, 0x66b4, 0x8c79, 0x9c8d, 0x7206, 0x676f, 0x7891, 0x60b2, 0x5351, 0x5317, 0x8f88, 0x80cc, 0x8d1d, 0x94a1, 0x500d, 0x72c8, 0x5907, 0x60eb, 0x7119, 0x88ab, 0x5954, 0x82ef, 0x672c, 0x7b28, 0x5d29, 0x7ef7, 0x752d, 0x6cf5, 0x8e66, 0x8ff8, 0x903c, 0x9f3b, 0x6bd4, 0x9119, 0x7b14, 0x5f7c, 0x78a7, 0x84d6, 0x853d, 0x6bd5, 0x6bd9, 0x6bd6, 0x5e01, 0x5e87, 0x75f9, 0x95ed, 0x655d, 0x5f0a, 0x5fc5, 0x8f9f, 0x58c1, 0x81c2, 0x907f, 0x965b, 0x97ad, 0x8fb9, 0x7f16, 0x8d2c, 0x6241, 0x4fbf, 0x53d8, 0x535e, 0x8fa8, 0x8fa9, 0x8fab, 0x904d, 0x6807, 0x5f6a, 0x8198, 0x8868, 0x9cd6, 0x618b, 0x522b, 0x762a, 0x5f6c, 0x658c, 0x6fd2, 0x6ee8, 0x5bbe, 0x6448, 0x5175, 0x51b0, 0x67c4, 0x4e19, 0x79c9, 0x997c, 0x70b3, /* 0xb2 */ 0x775d, 0x775e, 0x775f, 0x7760, 0x7764, 0x7767, 0x7769, 0x776a, 0x776d, 0x776e, 0x776f, 0x7770, 0x7771, 0x7772, 0x7773, 0x7774, 0x7775, 0x7776, 0x7777, 0x7778, 0x777a, 0x777b, 0x777c, 0x7781, 0x7782, 0x7783, 0x7786, 0x7787, 0x7788, 0x7789, 0x778a, 0x778b, 0x778f, 0x7790, 0x7793, 0x7794, 0x7795, 0x7796, 0x7797, 0x7798, 0x7799, 0x779a, 0x779b, 0x779c, 0x779d, 0x779e, 0x77a1, 0x77a3, 0x77a4, 0x77a6, 0x77a8, 0x77ab, 0x77ad, 0x77ae, 0x77af, 0x77b1, 0x77b2, 0x77b4, 0x77b6, 0x77b7, 0x77b8, 0x77b9, 0x77ba, 0x77bc, 0x77be, 0x77c0, 0x77c1, 0x77c2, 0x77c3, 0x77c4, 0x77c5, 0x77c6, 0x77c7, 0x77c8, 0x77c9, 0x77ca, 0x77cb, 0x77cc, 0x77ce, 0x77cf, 0x77d0, 0x77d1, 0x77d2, 0x77d3, 0x77d4, 0x77d5, 0x77d6, 0x77d8, 0x77d9, 0x77da, 0x77dd, 0x77de, 0x77df, 0x77e0, 0x77e1, 0x77e4, 0x75c5, 0x5e76, 0x73bb, 0x83e0, 0x64ad, 0x62e8, 0x94b5, 0x6ce2, 0x535a, 0x52c3, 0x640f, 0x94c2, 0x7b94, 0x4f2f, 0x5e1b, 0x8236, 0x8116, 0x818a, 0x6e24, 0x6cca, 0x9a73, 0x6355, 0x535c, 0x54fa, 0x8865, 0x57e0, 0x4e0d, 0x5e03, 0x6b65, 0x7c3f, 0x90e8, 0x6016, 0x64e6, 0x731c, 0x88c1, 0x6750, 0x624d, 0x8d22, 0x776c, 0x8e29, 0x91c7, 0x5f69, 0x83dc, 0x8521, 0x9910, 0x53c2, 0x8695, 0x6b8b, 0x60ed, 0x60e8, 0x707f, 0x82cd, 0x8231, 0x4ed3, 0x6ca7, 0x85cf, 0x64cd, 0x7cd9, 0x69fd, 0x66f9, 0x8349, 0x5395, 0x7b56, 0x4fa7, 0x518c, 0x6d4b, 0x5c42, 0x8e6d, 0x63d2, 0x53c9, 0x832c, 0x8336, 0x67e5, 0x78b4, 0x643d, 0x5bdf, 0x5c94, 0x5dee, 0x8be7, 0x62c6, 0x67f4, 0x8c7a, 0x6400, 0x63ba, 0x8749, 0x998b, 0x8c17, 0x7f20, 0x94f2, 0x4ea7, 0x9610, 0x98a4, 0x660c, 0x7316, /* 0xb3 */ 0x77e6, 0x77e8, 0x77ea, 0x77ef, 0x77f0, 0x77f1, 0x77f2, 0x77f4, 0x77f5, 0x77f7, 0x77f9, 0x77fa, 0x77fb, 0x77fc, 0x7803, 0x7804, 0x7805, 0x7806, 0x7807, 0x7808, 0x780a, 0x780b, 0x780e, 0x780f, 0x7810, 0x7813, 0x7815, 0x7819, 0x781b, 0x781e, 0x7820, 0x7821, 0x7822, 0x7824, 0x7828, 0x782a, 0x782b, 0x782e, 0x782f, 0x7831, 0x7832, 0x7833, 0x7835, 0x7836, 0x783d, 0x783f, 0x7841, 0x7842, 0x7843, 0x7844, 0x7846, 0x7848, 0x7849, 0x784a, 0x784b, 0x784d, 0x784f, 0x7851, 0x7853, 0x7854, 0x7858, 0x7859, 0x785a, 0x785b, 0x785c, 0x785e, 0x785f, 0x7860, 0x7861, 0x7862, 0x7863, 0x7864, 0x7865, 0x7866, 0x7867, 0x7868, 0x7869, 0x786f, 0x7870, 0x7871, 0x7872, 0x7873, 0x7874, 0x7875, 0x7876, 0x7878, 0x7879, 0x787a, 0x787b, 0x787d, 0x787e, 0x787f, 0x7880, 0x7881, 0x7882, 0x7883, 0x573a, 0x5c1d, 0x5e38, 0x957f, 0x507f, 0x80a0, 0x5382, 0x655e, 0x7545, 0x5531, 0x5021, 0x8d85, 0x6284, 0x949e, 0x671d, 0x5632, 0x6f6e, 0x5de2, 0x5435, 0x7092, 0x8f66, 0x626f, 0x64a4, 0x63a3, 0x5f7b, 0x6f88, 0x90f4, 0x81e3, 0x8fb0, 0x5c18, 0x6668, 0x5ff1, 0x6c89, 0x9648, 0x8d81, 0x886c, 0x6491, 0x79f0, 0x57ce, 0x6a59, 0x6210, 0x5448, 0x4e58, 0x7a0b, 0x60e9, 0x6f84, 0x8bda, 0x627f, 0x901e, 0x9a8b, 0x79e4, 0x5403, 0x75f4, 0x6301, 0x5319, 0x6c60, 0x8fdf, 0x5f1b, 0x9a70, 0x803b, 0x9f7f, 0x4f88, 0x5c3a, 0x8d64, 0x7fc5, 0x65a5, 0x70bd, 0x5145, 0x51b2, 0x866b, 0x5d07, 0x5ba0, 0x62bd, 0x916c, 0x7574, 0x8e0c, 0x7a20, 0x6101, 0x7b79, 0x4ec7, 0x7ef8, 0x7785, 0x4e11, 0x81ed, 0x521d, 0x51fa, 0x6a71, 0x53a8, 0x8e87, 0x9504, 0x96cf, 0x6ec1, 0x9664, 0x695a, /* 0xb4 */ 0x7884, 0x7885, 0x7886, 0x7888, 0x788a, 0x788b, 0x788f, 0x7890, 0x7892, 0x7894, 0x7895, 0x7896, 0x7899, 0x789d, 0x789e, 0x78a0, 0x78a2, 0x78a4, 0x78a6, 0x78a8, 0x78a9, 0x78aa, 0x78ab, 0x78ac, 0x78ad, 0x78ae, 0x78af, 0x78b5, 0x78b6, 0x78b7, 0x78b8, 0x78ba, 0x78bb, 0x78bc, 0x78bd, 0x78bf, 0x78c0, 0x78c2, 0x78c3, 0x78c4, 0x78c6, 0x78c7, 0x78c8, 0x78cc, 0x78cd, 0x78ce, 0x78cf, 0x78d1, 0x78d2, 0x78d3, 0x78d6, 0x78d7, 0x78d8, 0x78da, 0x78db, 0x78dc, 0x78dd, 0x78de, 0x78df, 0x78e0, 0x78e1, 0x78e2, 0x78e3, 0x78e4, 0x78e5, 0x78e6, 0x78e7, 0x78e9, 0x78ea, 0x78eb, 0x78ed, 0x78ee, 0x78ef, 0x78f0, 0x78f1, 0x78f3, 0x78f5, 0x78f6, 0x78f8, 0x78f9, 0x78fb, 0x78fc, 0x78fd, 0x78fe, 0x78ff, 0x7900, 0x7902, 0x7903, 0x7904, 0x7906, 0x7907, 0x7908, 0x7909, 0x790a, 0x790b, 0x790c, 0x7840, 0x50a8, 0x77d7, 0x6410, 0x89e6, 0x5904, 0x63e3, 0x5ddd, 0x7a7f, 0x693d, 0x4f20, 0x8239, 0x5598, 0x4e32, 0x75ae, 0x7a97, 0x5e62, 0x5e8a, 0x95ef, 0x521b, 0x5439, 0x708a, 0x6376, 0x9524, 0x5782, 0x6625, 0x693f, 0x9187, 0x5507, 0x6df3, 0x7eaf, 0x8822, 0x6233, 0x7ef0, 0x75b5, 0x8328, 0x78c1, 0x96cc, 0x8f9e, 0x6148, 0x74f7, 0x8bcd, 0x6b64, 0x523a, 0x8d50, 0x6b21, 0x806a, 0x8471, 0x56f1, 0x5306, 0x4ece, 0x4e1b, 0x51d1, 0x7c97, 0x918b, 0x7c07, 0x4fc3, 0x8e7f, 0x7be1, 0x7a9c, 0x6467, 0x5d14, 0x50ac, 0x8106, 0x7601, 0x7cb9, 0x6dec, 0x7fe0, 0x6751, 0x5b58, 0x5bf8, 0x78cb, 0x64ae, 0x6413, 0x63aa, 0x632b, 0x9519, 0x642d, 0x8fbe, 0x7b54, 0x7629, 0x6253, 0x5927, 0x5446, 0x6b79, 0x50a3, 0x6234, 0x5e26, 0x6b86, 0x4ee3, 0x8d37, 0x888b, 0x5f85, 0x902e, /* 0xb5 */ 0x790d, 0x790e, 0x790f, 0x7910, 0x7911, 0x7912, 0x7914, 0x7915, 0x7916, 0x7917, 0x7918, 0x7919, 0x791a, 0x791b, 0x791c, 0x791d, 0x791f, 0x7920, 0x7921, 0x7922, 0x7923, 0x7925, 0x7926, 0x7927, 0x7928, 0x7929, 0x792a, 0x792b, 0x792c, 0x792d, 0x792e, 0x792f, 0x7930, 0x7931, 0x7932, 0x7933, 0x7935, 0x7936, 0x7937, 0x7938, 0x7939, 0x793d, 0x793f, 0x7942, 0x7943, 0x7944, 0x7945, 0x7947, 0x794a, 0x794b, 0x794c, 0x794d, 0x794e, 0x794f, 0x7950, 0x7951, 0x7952, 0x7954, 0x7955, 0x7958, 0x7959, 0x7961, 0x7963, 0x7964, 0x7966, 0x7969, 0x796a, 0x796b, 0x796c, 0x796e, 0x7970, 0x7971, 0x7972, 0x7973, 0x7974, 0x7975, 0x7976, 0x7979, 0x797b, 0x797c, 0x797d, 0x797e, 0x797f, 0x7982, 0x7983, 0x7986, 0x7987, 0x7988, 0x7989, 0x798b, 0x798c, 0x798d, 0x798e, 0x7990, 0x7991, 0x7992, 0x6020, 0x803d, 0x62c5, 0x4e39, 0x5355, 0x90f8, 0x63b8, 0x80c6, 0x65e6, 0x6c2e, 0x4f46, 0x60ee, 0x6de1, 0x8bde, 0x5f39, 0x86cb, 0x5f53, 0x6321, 0x515a, 0x8361, 0x6863, 0x5200, 0x6363, 0x8e48, 0x5012, 0x5c9b, 0x7977, 0x5bfc, 0x5230, 0x7a3b, 0x60bc, 0x9053, 0x76d7, 0x5fb7, 0x5f97, 0x7684, 0x8e6c, 0x706f, 0x767b, 0x7b49, 0x77aa, 0x51f3, 0x9093, 0x5824, 0x4f4e, 0x6ef4, 0x8fea, 0x654c, 0x7b1b, 0x72c4, 0x6da4, 0x7fdf, 0x5ae1, 0x62b5, 0x5e95, 0x5730, 0x8482, 0x7b2c, 0x5e1d, 0x5f1f, 0x9012, 0x7f14, 0x98a0, 0x6382, 0x6ec7, 0x7898, 0x70b9, 0x5178, 0x975b, 0x57ab, 0x7535, 0x4f43, 0x7538, 0x5e97, 0x60e6, 0x5960, 0x6dc0, 0x6bbf, 0x7889, 0x53fc, 0x96d5, 0x51cb, 0x5201, 0x6389, 0x540a, 0x9493, 0x8c03, 0x8dcc, 0x7239, 0x789f, 0x8776, 0x8fed, 0x8c0d, 0x53e0, /* 0xb6 */ 0x7993, 0x7994, 0x7995, 0x7996, 0x7997, 0x7998, 0x7999, 0x799b, 0x799c, 0x799d, 0x799e, 0x799f, 0x79a0, 0x79a1, 0x79a2, 0x79a3, 0x79a4, 0x79a5, 0x79a6, 0x79a8, 0x79a9, 0x79aa, 0x79ab, 0x79ac, 0x79ad, 0x79ae, 0x79af, 0x79b0, 0x79b1, 0x79b2, 0x79b4, 0x79b5, 0x79b6, 0x79b7, 0x79b8, 0x79bc, 0x79bf, 0x79c2, 0x79c4, 0x79c5, 0x79c7, 0x79c8, 0x79ca, 0x79cc, 0x79ce, 0x79cf, 0x79d0, 0x79d3, 0x79d4, 0x79d6, 0x79d7, 0x79d9, 0x79da, 0x79db, 0x79dc, 0x79dd, 0x79de, 0x79e0, 0x79e1, 0x79e2, 0x79e5, 0x79e8, 0x79ea, 0x79ec, 0x79ee, 0x79f1, 0x79f2, 0x79f3, 0x79f4, 0x79f5, 0x79f6, 0x79f7, 0x79f9, 0x79fa, 0x79fc, 0x79fe, 0x79ff, 0x7a01, 0x7a04, 0x7a05, 0x7a07, 0x7a08, 0x7a09, 0x7a0a, 0x7a0c, 0x7a0f, 0x7a10, 0x7a11, 0x7a12, 0x7a13, 0x7a15, 0x7a16, 0x7a18, 0x7a19, 0x7a1b, 0x7a1c, 0x4e01, 0x76ef, 0x53ee, 0x9489, 0x9876, 0x9f0e, 0x952d, 0x5b9a, 0x8ba2, 0x4e22, 0x4e1c, 0x51ac, 0x8463, 0x61c2, 0x52a8, 0x680b, 0x4f97, 0x606b, 0x51bb, 0x6d1e, 0x515c, 0x6296, 0x6597, 0x9661, 0x8c46, 0x9017, 0x75d8, 0x90fd, 0x7763, 0x6bd2, 0x728a, 0x72ec, 0x8bfb, 0x5835, 0x7779, 0x8d4c, 0x675c, 0x9540, 0x809a, 0x5ea6, 0x6e21, 0x5992, 0x7aef, 0x77ed, 0x953b, 0x6bb5, 0x65ad, 0x7f0e, 0x5806, 0x5151, 0x961f, 0x5bf9, 0x58a9, 0x5428, 0x8e72, 0x6566, 0x987f, 0x56e4, 0x949d, 0x76fe, 0x9041, 0x6387, 0x54c6, 0x591a, 0x593a, 0x579b, 0x8eb2, 0x6735, 0x8dfa, 0x8235, 0x5241, 0x60f0, 0x5815, 0x86fe, 0x5ce8, 0x9e45, 0x4fc4, 0x989d, 0x8bb9, 0x5a25, 0x6076, 0x5384, 0x627c, 0x904f, 0x9102, 0x997f, 0x6069, 0x800c, 0x513f, 0x8033, 0x5c14, 0x9975, 0x6d31, 0x4e8c, /* 0xb7 */ 0x7a1d, 0x7a1f, 0x7a21, 0x7a22, 0x7a24, 0x7a25, 0x7a26, 0x7a27, 0x7a28, 0x7a29, 0x7a2a, 0x7a2b, 0x7a2c, 0x7a2d, 0x7a2e, 0x7a2f, 0x7a30, 0x7a31, 0x7a32, 0x7a34, 0x7a35, 0x7a36, 0x7a38, 0x7a3a, 0x7a3e, 0x7a40, 0x7a41, 0x7a42, 0x7a43, 0x7a44, 0x7a45, 0x7a47, 0x7a48, 0x7a49, 0x7a4a, 0x7a4b, 0x7a4c, 0x7a4d, 0x7a4e, 0x7a4f, 0x7a50, 0x7a52, 0x7a53, 0x7a54, 0x7a55, 0x7a56, 0x7a58, 0x7a59, 0x7a5a, 0x7a5b, 0x7a5c, 0x7a5d, 0x7a5e, 0x7a5f, 0x7a60, 0x7a61, 0x7a62, 0x7a63, 0x7a64, 0x7a65, 0x7a66, 0x7a67, 0x7a68, 0x7a69, 0x7a6a, 0x7a6b, 0x7a6c, 0x7a6d, 0x7a6e, 0x7a6f, 0x7a71, 0x7a72, 0x7a73, 0x7a75, 0x7a7b, 0x7a7c, 0x7a7d, 0x7a7e, 0x7a82, 0x7a85, 0x7a87, 0x7a89, 0x7a8a, 0x7a8b, 0x7a8c, 0x7a8e, 0x7a8f, 0x7a90, 0x7a93, 0x7a94, 0x7a99, 0x7a9a, 0x7a9b, 0x7a9e, 0x7aa1, 0x7aa2, 0x8d30, 0x53d1, 0x7f5a, 0x7b4f, 0x4f10, 0x4e4f, 0x9600, 0x6cd5, 0x73d0, 0x85e9, 0x5e06, 0x756a, 0x7ffb, 0x6a0a, 0x77fe, 0x9492, 0x7e41, 0x51e1, 0x70e6, 0x53cd, 0x8fd4, 0x8303, 0x8d29, 0x72af, 0x996d, 0x6cdb, 0x574a, 0x82b3, 0x65b9, 0x80aa, 0x623f, 0x9632, 0x59a8, 0x4eff, 0x8bbf, 0x7eba, 0x653e, 0x83f2, 0x975e, 0x5561, 0x98de, 0x80a5, 0x532a, 0x8bfd, 0x5420, 0x80ba, 0x5e9f, 0x6cb8, 0x8d39, 0x82ac, 0x915a, 0x5429, 0x6c1b, 0x5206, 0x7eb7, 0x575f, 0x711a, 0x6c7e, 0x7c89, 0x594b, 0x4efd, 0x5fff, 0x6124, 0x7caa, 0x4e30, 0x5c01, 0x67ab, 0x8702, 0x5cf0, 0x950b, 0x98ce, 0x75af, 0x70fd, 0x9022, 0x51af, 0x7f1d, 0x8bbd, 0x5949, 0x51e4, 0x4f5b, 0x5426, 0x592b, 0x6577, 0x80a4, 0x5b75, 0x6276, 0x62c2, 0x8f90, 0x5e45, 0x6c1f, 0x7b26, 0x4f0f, 0x4fd8, 0x670d, /* 0xb8 */ 0x7aa3, 0x7aa4, 0x7aa7, 0x7aa9, 0x7aaa, 0x7aab, 0x7aae, 0x7aaf, 0x7ab0, 0x7ab1, 0x7ab2, 0x7ab4, 0x7ab5, 0x7ab6, 0x7ab7, 0x7ab8, 0x7ab9, 0x7aba, 0x7abb, 0x7abc, 0x7abd, 0x7abe, 0x7ac0, 0x7ac1, 0x7ac2, 0x7ac3, 0x7ac4, 0x7ac5, 0x7ac6, 0x7ac7, 0x7ac8, 0x7ac9, 0x7aca, 0x7acc, 0x7acd, 0x7ace, 0x7acf, 0x7ad0, 0x7ad1, 0x7ad2, 0x7ad3, 0x7ad4, 0x7ad5, 0x7ad7, 0x7ad8, 0x7ada, 0x7adb, 0x7adc, 0x7add, 0x7ae1, 0x7ae2, 0x7ae4, 0x7ae7, 0x7ae8, 0x7ae9, 0x7aea, 0x7aeb, 0x7aec, 0x7aee, 0x7af0, 0x7af1, 0x7af2, 0x7af3, 0x7af4, 0x7af5, 0x7af6, 0x7af7, 0x7af8, 0x7afb, 0x7afc, 0x7afe, 0x7b00, 0x7b01, 0x7b02, 0x7b05, 0x7b07, 0x7b09, 0x7b0c, 0x7b0d, 0x7b0e, 0x7b10, 0x7b12, 0x7b13, 0x7b16, 0x7b17, 0x7b18, 0x7b1a, 0x7b1c, 0x7b1d, 0x7b1f, 0x7b21, 0x7b22, 0x7b23, 0x7b27, 0x7b29, 0x7b2d, 0x6d6e, 0x6daa, 0x798f, 0x88b1, 0x5f17, 0x752b, 0x629a, 0x8f85, 0x4fef, 0x91dc, 0x65a7, 0x812f, 0x8151, 0x5e9c, 0x8150, 0x8d74, 0x526f, 0x8986, 0x8d4b, 0x590d, 0x5085, 0x4ed8, 0x961c, 0x7236, 0x8179, 0x8d1f, 0x5bcc, 0x8ba3, 0x9644, 0x5987, 0x7f1a, 0x5490, 0x5676, 0x560e, 0x8be5, 0x6539, 0x6982, 0x9499, 0x76d6, 0x6e89, 0x5e72, 0x7518, 0x6746, 0x67d1, 0x7aff, 0x809d, 0x8d76, 0x611f, 0x79c6, 0x6562, 0x8d63, 0x5188, 0x521a, 0x94a2, 0x7f38, 0x809b, 0x7eb2, 0x5c97, 0x6e2f, 0x6760, 0x7bd9, 0x768b, 0x9ad8, 0x818f, 0x7f94, 0x7cd5, 0x641e, 0x9550, 0x7a3f, 0x544a, 0x54e5, 0x6b4c, 0x6401, 0x6208, 0x9e3d, 0x80f3, 0x7599, 0x5272, 0x9769, 0x845b, 0x683c, 0x86e4, 0x9601, 0x9694, 0x94ec, 0x4e2a, 0x5404, 0x7ed9, 0x6839, 0x8ddf, 0x8015, 0x66f4, 0x5e9a, 0x7fb9, /* 0xb9 */ 0x7b2f, 0x7b30, 0x7b32, 0x7b34, 0x7b35, 0x7b36, 0x7b37, 0x7b39, 0x7b3b, 0x7b3d, 0x7b3f, 0x7b40, 0x7b41, 0x7b42, 0x7b43, 0x7b44, 0x7b46, 0x7b48, 0x7b4a, 0x7b4d, 0x7b4e, 0x7b53, 0x7b55, 0x7b57, 0x7b59, 0x7b5c, 0x7b5e, 0x7b5f, 0x7b61, 0x7b63, 0x7b64, 0x7b65, 0x7b66, 0x7b67, 0x7b68, 0x7b69, 0x7b6a, 0x7b6b, 0x7b6c, 0x7b6d, 0x7b6f, 0x7b70, 0x7b73, 0x7b74, 0x7b76, 0x7b78, 0x7b7a, 0x7b7c, 0x7b7d, 0x7b7f, 0x7b81, 0x7b82, 0x7b83, 0x7b84, 0x7b86, 0x7b87, 0x7b88, 0x7b89, 0x7b8a, 0x7b8b, 0x7b8c, 0x7b8e, 0x7b8f, 0x7b91, 0x7b92, 0x7b93, 0x7b96, 0x7b98, 0x7b99, 0x7b9a, 0x7b9b, 0x7b9e, 0x7b9f, 0x7ba0, 0x7ba3, 0x7ba4, 0x7ba5, 0x7bae, 0x7baf, 0x7bb0, 0x7bb2, 0x7bb3, 0x7bb5, 0x7bb6, 0x7bb7, 0x7bb9, 0x7bba, 0x7bbb, 0x7bbc, 0x7bbd, 0x7bbe, 0x7bbf, 0x7bc0, 0x7bc2, 0x7bc3, 0x7bc4, 0x57c2, 0x803f, 0x6897, 0x5de5, 0x653b, 0x529f, 0x606d, 0x9f9a, 0x4f9b, 0x8eac, 0x516c, 0x5bab, 0x5f13, 0x5de9, 0x6c5e, 0x62f1, 0x8d21, 0x5171, 0x94a9, 0x52fe, 0x6c9f, 0x82df, 0x72d7, 0x57a2, 0x6784, 0x8d2d, 0x591f, 0x8f9c, 0x83c7, 0x5495, 0x7b8d, 0x4f30, 0x6cbd, 0x5b64, 0x59d1, 0x9f13, 0x53e4, 0x86ca, 0x9aa8, 0x8c37, 0x80a1, 0x6545, 0x987e, 0x56fa, 0x96c7, 0x522e, 0x74dc, 0x5250, 0x5be1, 0x6302, 0x8902, 0x4e56, 0x62d0, 0x602a, 0x68fa, 0x5173, 0x5b98, 0x51a0, 0x89c2, 0x7ba1, 0x9986, 0x7f50, 0x60ef, 0x704c, 0x8d2f, 0x5149, 0x5e7f, 0x901b, 0x7470, 0x89c4, 0x572d, 0x7845, 0x5f52, 0x9f9f, 0x95fa, 0x8f68, 0x9b3c, 0x8be1, 0x7678, 0x6842, 0x67dc, 0x8dea, 0x8d35, 0x523d, 0x8f8a, 0x6eda, 0x68cd, 0x9505, 0x90ed, 0x56fd, 0x679c, 0x88f9, 0x8fc7, 0x54c8, /* 0xba */ 0x7bc5, 0x7bc8, 0x7bc9, 0x7bca, 0x7bcb, 0x7bcd, 0x7bce, 0x7bcf, 0x7bd0, 0x7bd2, 0x7bd4, 0x7bd5, 0x7bd6, 0x7bd7, 0x7bd8, 0x7bdb, 0x7bdc, 0x7bde, 0x7bdf, 0x7be0, 0x7be2, 0x7be3, 0x7be4, 0x7be7, 0x7be8, 0x7be9, 0x7beb, 0x7bec, 0x7bed, 0x7bef, 0x7bf0, 0x7bf2, 0x7bf3, 0x7bf4, 0x7bf5, 0x7bf6, 0x7bf8, 0x7bf9, 0x7bfa, 0x7bfb, 0x7bfd, 0x7bff, 0x7c00, 0x7c01, 0x7c02, 0x7c03, 0x7c04, 0x7c05, 0x7c06, 0x7c08, 0x7c09, 0x7c0a, 0x7c0d, 0x7c0e, 0x7c10, 0x7c11, 0x7c12, 0x7c13, 0x7c14, 0x7c15, 0x7c17, 0x7c18, 0x7c19, 0x7c1a, 0x7c1b, 0x7c1c, 0x7c1d, 0x7c1e, 0x7c20, 0x7c21, 0x7c22, 0x7c23, 0x7c24, 0x7c25, 0x7c28, 0x7c29, 0x7c2b, 0x7c2c, 0x7c2d, 0x7c2e, 0x7c2f, 0x7c30, 0x7c31, 0x7c32, 0x7c33, 0x7c34, 0x7c35, 0x7c36, 0x7c37, 0x7c39, 0x7c3a, 0x7c3b, 0x7c3c, 0x7c3d, 0x7c3e, 0x7c42, 0x9ab8, 0x5b69, 0x6d77, 0x6c26, 0x4ea5, 0x5bb3, 0x9a87, 0x9163, 0x61a8, 0x90af, 0x97e9, 0x542b, 0x6db5, 0x5bd2, 0x51fd, 0x558a, 0x7f55, 0x7ff0, 0x64bc, 0x634d, 0x65f1, 0x61be, 0x608d, 0x710a, 0x6c57, 0x6c49, 0x592f, 0x676d, 0x822a, 0x58d5, 0x568e, 0x8c6a, 0x6beb, 0x90dd, 0x597d, 0x8017, 0x53f7, 0x6d69, 0x5475, 0x559d, 0x8377, 0x83cf, 0x6838, 0x79be, 0x548c, 0x4f55, 0x5408, 0x76d2, 0x8c89, 0x9602, 0x6cb3, 0x6db8, 0x8d6b, 0x8910, 0x9e64, 0x8d3a, 0x563f, 0x9ed1, 0x75d5, 0x5f88, 0x72e0, 0x6068, 0x54fc, 0x4ea8, 0x6a2a, 0x8861, 0x6052, 0x8f70, 0x54c4, 0x70d8, 0x8679, 0x9e3f, 0x6d2a, 0x5b8f, 0x5f18, 0x7ea2, 0x5589, 0x4faf, 0x7334, 0x543c, 0x539a, 0x5019, 0x540e, 0x547c, 0x4e4e, 0x5ffd, 0x745a, 0x58f6, 0x846b, 0x80e1, 0x8774, 0x72d0, 0x7cca, 0x6e56, /* 0xbb */ 0x7c43, 0x7c44, 0x7c45, 0x7c46, 0x7c47, 0x7c48, 0x7c49, 0x7c4a, 0x7c4b, 0x7c4c, 0x7c4e, 0x7c4f, 0x7c50, 0x7c51, 0x7c52, 0x7c53, 0x7c54, 0x7c55, 0x7c56, 0x7c57, 0x7c58, 0x7c59, 0x7c5a, 0x7c5b, 0x7c5c, 0x7c5d, 0x7c5e, 0x7c5f, 0x7c60, 0x7c61, 0x7c62, 0x7c63, 0x7c64, 0x7c65, 0x7c66, 0x7c67, 0x7c68, 0x7c69, 0x7c6a, 0x7c6b, 0x7c6c, 0x7c6d, 0x7c6e, 0x7c6f, 0x7c70, 0x7c71, 0x7c72, 0x7c75, 0x7c76, 0x7c77, 0x7c78, 0x7c79, 0x7c7a, 0x7c7e, 0x7c7f, 0x7c80, 0x7c81, 0x7c82, 0x7c83, 0x7c84, 0x7c85, 0x7c86, 0x7c87, 0x7c88, 0x7c8a, 0x7c8b, 0x7c8c, 0x7c8d, 0x7c8e, 0x7c8f, 0x7c90, 0x7c93, 0x7c94, 0x7c96, 0x7c99, 0x7c9a, 0x7c9b, 0x7ca0, 0x7ca1, 0x7ca3, 0x7ca6, 0x7ca7, 0x7ca8, 0x7ca9, 0x7cab, 0x7cac, 0x7cad, 0x7caf, 0x7cb0, 0x7cb4, 0x7cb5, 0x7cb6, 0x7cb7, 0x7cb8, 0x7cba, 0x7cbb, 0x5f27, 0x864e, 0x552c, 0x62a4, 0x4e92, 0x6caa, 0x6237, 0x82b1, 0x54d7, 0x534e, 0x733e, 0x6ed1, 0x753b, 0x5212, 0x5316, 0x8bdd, 0x69d0, 0x5f8a, 0x6000, 0x6dee, 0x574f, 0x6b22, 0x73af, 0x6853, 0x8fd8, 0x7f13, 0x6362, 0x60a3, 0x5524, 0x75ea, 0x8c62, 0x7115, 0x6da3, 0x5ba6, 0x5e7b, 0x8352, 0x614c, 0x9ec4, 0x78fa, 0x8757, 0x7c27, 0x7687, 0x51f0, 0x60f6, 0x714c, 0x6643, 0x5e4c, 0x604d, 0x8c0e, 0x7070, 0x6325, 0x8f89, 0x5fbd, 0x6062, 0x86d4, 0x56de, 0x6bc1, 0x6094, 0x6167, 0x5349, 0x60e0, 0x6666, 0x8d3f, 0x79fd, 0x4f1a, 0x70e9, 0x6c47, 0x8bb3, 0x8bf2, 0x7ed8, 0x8364, 0x660f, 0x5a5a, 0x9b42, 0x6d51, 0x6df7, 0x8c41, 0x6d3b, 0x4f19, 0x706b, 0x83b7, 0x6216, 0x60d1, 0x970d, 0x8d27, 0x7978, 0x51fb, 0x573e, 0x57fa, 0x673a, 0x7578, 0x7a3d, 0x79ef, 0x7b95, /* 0xbc */ 0x7cbf, 0x7cc0, 0x7cc2, 0x7cc3, 0x7cc4, 0x7cc6, 0x7cc9, 0x7ccb, 0x7cce, 0x7ccf, 0x7cd0, 0x7cd1, 0x7cd2, 0x7cd3, 0x7cd4, 0x7cd8, 0x7cda, 0x7cdb, 0x7cdd, 0x7cde, 0x7ce1, 0x7ce2, 0x7ce3, 0x7ce4, 0x7ce5, 0x7ce6, 0x7ce7, 0x7ce9, 0x7cea, 0x7ceb, 0x7cec, 0x7ced, 0x7cee, 0x7cf0, 0x7cf1, 0x7cf2, 0x7cf3, 0x7cf4, 0x7cf5, 0x7cf6, 0x7cf7, 0x7cf9, 0x7cfa, 0x7cfc, 0x7cfd, 0x7cfe, 0x7cff, 0x7d00, 0x7d01, 0x7d02, 0x7d03, 0x7d04, 0x7d05, 0x7d06, 0x7d07, 0x7d08, 0x7d09, 0x7d0b, 0x7d0c, 0x7d0d, 0x7d0e, 0x7d0f, 0x7d10, 0x7d11, 0x7d12, 0x7d13, 0x7d14, 0x7d15, 0x7d16, 0x7d17, 0x7d18, 0x7d19, 0x7d1a, 0x7d1b, 0x7d1c, 0x7d1d, 0x7d1e, 0x7d1f, 0x7d21, 0x7d23, 0x7d24, 0x7d25, 0x7d26, 0x7d28, 0x7d29, 0x7d2a, 0x7d2c, 0x7d2d, 0x7d2e, 0x7d30, 0x7d31, 0x7d32, 0x7d33, 0x7d34, 0x7d35, 0x7d36, 0x808c, 0x9965, 0x8ff9, 0x6fc0, 0x8ba5, 0x9e21, 0x59ec, 0x7ee9, 0x7f09, 0x5409, 0x6781, 0x68d8, 0x8f91, 0x7c4d, 0x96c6, 0x53ca, 0x6025, 0x75be, 0x6c72, 0x5373, 0x5ac9, 0x7ea7, 0x6324, 0x51e0, 0x810a, 0x5df1, 0x84df, 0x6280, 0x5180, 0x5b63, 0x4f0e, 0x796d, 0x5242, 0x60b8, 0x6d4e, 0x5bc4, 0x5bc2, 0x8ba1, 0x8bb0, 0x65e2, 0x5fcc, 0x9645, 0x5993, 0x7ee7, 0x7eaa, 0x5609, 0x67b7, 0x5939, 0x4f73, 0x5bb6, 0x52a0, 0x835a, 0x988a, 0x8d3e, 0x7532, 0x94be, 0x5047, 0x7a3c, 0x4ef7, 0x67b6, 0x9a7e, 0x5ac1, 0x6b7c, 0x76d1, 0x575a, 0x5c16, 0x7b3a, 0x95f4, 0x714e, 0x517c, 0x80a9, 0x8270, 0x5978, 0x7f04, 0x8327, 0x68c0, 0x67ec, 0x78b1, 0x7877, 0x62e3, 0x6361, 0x7b80, 0x4fed, 0x526a, 0x51cf, 0x8350, 0x69db, 0x9274, 0x8df5, 0x8d31, 0x89c1, 0x952e, 0x7bad, 0x4ef6, /* 0xbd */ 0x7d37, 0x7d38, 0x7d39, 0x7d3a, 0x7d3b, 0x7d3c, 0x7d3d, 0x7d3e, 0x7d3f, 0x7d40, 0x7d41, 0x7d42, 0x7d43, 0x7d44, 0x7d45, 0x7d46, 0x7d47, 0x7d48, 0x7d49, 0x7d4a, 0x7d4b, 0x7d4c, 0x7d4d, 0x7d4e, 0x7d4f, 0x7d50, 0x7d51, 0x7d52, 0x7d53, 0x7d54, 0x7d55, 0x7d56, 0x7d57, 0x7d58, 0x7d59, 0x7d5a, 0x7d5b, 0x7d5c, 0x7d5d, 0x7d5e, 0x7d5f, 0x7d60, 0x7d61, 0x7d62, 0x7d63, 0x7d64, 0x7d65, 0x7d66, 0x7d67, 0x7d68, 0x7d69, 0x7d6a, 0x7d6b, 0x7d6c, 0x7d6d, 0x7d6f, 0x7d70, 0x7d71, 0x7d72, 0x7d73, 0x7d74, 0x7d75, 0x7d76, 0x7d78, 0x7d79, 0x7d7a, 0x7d7b, 0x7d7c, 0x7d7d, 0x7d7e, 0x7d7f, 0x7d80, 0x7d81, 0x7d82, 0x7d83, 0x7d84, 0x7d85, 0x7d86, 0x7d87, 0x7d88, 0x7d89, 0x7d8a, 0x7d8b, 0x7d8c, 0x7d8d, 0x7d8e, 0x7d8f, 0x7d90, 0x7d91, 0x7d92, 0x7d93, 0x7d94, 0x7d95, 0x7d96, 0x7d97, 0x7d98, 0x5065, 0x8230, 0x5251, 0x996f, 0x6e10, 0x6e85, 0x6da7, 0x5efa, 0x50f5, 0x59dc, 0x5c06, 0x6d46, 0x6c5f, 0x7586, 0x848b, 0x6868, 0x5956, 0x8bb2, 0x5320, 0x9171, 0x964d, 0x8549, 0x6912, 0x7901, 0x7126, 0x80f6, 0x4ea4, 0x90ca, 0x6d47, 0x9a84, 0x5a07, 0x56bc, 0x6405, 0x94f0, 0x77eb, 0x4fa5, 0x811a, 0x72e1, 0x89d2, 0x997a, 0x7f34, 0x7ede, 0x527f, 0x6559, 0x9175, 0x8f7f, 0x8f83, 0x53eb, 0x7a96, 0x63ed, 0x63a5, 0x7686, 0x79f8, 0x8857, 0x9636, 0x622a, 0x52ab, 0x8282, 0x6854, 0x6770, 0x6377, 0x776b, 0x7aed, 0x6d01, 0x7ed3, 0x89e3, 0x59d0, 0x6212, 0x85c9, 0x82a5, 0x754c, 0x501f, 0x4ecb, 0x75a5, 0x8beb, 0x5c4a, 0x5dfe, 0x7b4b, 0x65a4, 0x91d1, 0x4eca, 0x6d25, 0x895f, 0x7d27, 0x9526, 0x4ec5, 0x8c28, 0x8fdb, 0x9773, 0x664b, 0x7981, 0x8fd1, 0x70ec, 0x6d78, /* 0xbe */ 0x7d99, 0x7d9a, 0x7d9b, 0x7d9c, 0x7d9d, 0x7d9e, 0x7d9f, 0x7da0, 0x7da1, 0x7da2, 0x7da3, 0x7da4, 0x7da5, 0x7da7, 0x7da8, 0x7da9, 0x7daa, 0x7dab, 0x7dac, 0x7dad, 0x7daf, 0x7db0, 0x7db1, 0x7db2, 0x7db3, 0x7db4, 0x7db5, 0x7db6, 0x7db7, 0x7db8, 0x7db9, 0x7dba, 0x7dbb, 0x7dbc, 0x7dbd, 0x7dbe, 0x7dbf, 0x7dc0, 0x7dc1, 0x7dc2, 0x7dc3, 0x7dc4, 0x7dc5, 0x7dc6, 0x7dc7, 0x7dc8, 0x7dc9, 0x7dca, 0x7dcb, 0x7dcc, 0x7dcd, 0x7dce, 0x7dcf, 0x7dd0, 0x7dd1, 0x7dd2, 0x7dd3, 0x7dd4, 0x7dd5, 0x7dd6, 0x7dd7, 0x7dd8, 0x7dd9, 0x7dda, 0x7ddb, 0x7ddc, 0x7ddd, 0x7dde, 0x7ddf, 0x7de0, 0x7de1, 0x7de2, 0x7de3, 0x7de4, 0x7de5, 0x7de6, 0x7de7, 0x7de8, 0x7de9, 0x7dea, 0x7deb, 0x7dec, 0x7ded, 0x7dee, 0x7def, 0x7df0, 0x7df1, 0x7df2, 0x7df3, 0x7df4, 0x7df5, 0x7df6, 0x7df7, 0x7df8, 0x7df9, 0x7dfa, 0x5c3d, 0x52b2, 0x8346, 0x5162, 0x830e, 0x775b, 0x6676, 0x9cb8, 0x4eac, 0x60ca, 0x7cbe, 0x7cb3, 0x7ecf, 0x4e95, 0x8b66, 0x666f, 0x9888, 0x9759, 0x5883, 0x656c, 0x955c, 0x5f84, 0x75c9, 0x9756, 0x7adf, 0x7ade, 0x51c0, 0x70af, 0x7a98, 0x63ea, 0x7a76, 0x7ea0, 0x7396, 0x97ed, 0x4e45, 0x7078, 0x4e5d, 0x9152, 0x53a9, 0x6551, 0x65e7, 0x81fc, 0x8205, 0x548e, 0x5c31, 0x759a, 0x97a0, 0x62d8, 0x72d9, 0x75bd, 0x5c45, 0x9a79, 0x83ca, 0x5c40, 0x5480, 0x77e9, 0x4e3e, 0x6cae, 0x805a, 0x62d2, 0x636e, 0x5de8, 0x5177, 0x8ddd, 0x8e1e, 0x952f, 0x4ff1, 0x53e5, 0x60e7, 0x70ac, 0x5267, 0x6350, 0x9e43, 0x5a1f, 0x5026, 0x7737, 0x5377, 0x7ee2, 0x6485, 0x652b, 0x6289, 0x6398, 0x5014, 0x7235, 0x89c9, 0x51b3, 0x8bc0, 0x7edd, 0x5747, 0x83cc, 0x94a7, 0x519b, 0x541b, 0x5cfb, /* 0xbf */ 0x7dfb, 0x7dfc, 0x7dfd, 0x7dfe, 0x7dff, 0x7e00, 0x7e01, 0x7e02, 0x7e03, 0x7e04, 0x7e05, 0x7e06, 0x7e07, 0x7e08, 0x7e09, 0x7e0a, 0x7e0b, 0x7e0c, 0x7e0d, 0x7e0e, 0x7e0f, 0x7e10, 0x7e11, 0x7e12, 0x7e13, 0x7e14, 0x7e15, 0x7e16, 0x7e17, 0x7e18, 0x7e19, 0x7e1a, 0x7e1b, 0x7e1c, 0x7e1d, 0x7e1e, 0x7e1f, 0x7e20, 0x7e21, 0x7e22, 0x7e23, 0x7e24, 0x7e25, 0x7e26, 0x7e27, 0x7e28, 0x7e29, 0x7e2a, 0x7e2b, 0x7e2c, 0x7e2d, 0x7e2e, 0x7e2f, 0x7e30, 0x7e31, 0x7e32, 0x7e33, 0x7e34, 0x7e35, 0x7e36, 0x7e37, 0x7e38, 0x7e39, 0x7e3a, 0x7e3c, 0x7e3d, 0x7e3e, 0x7e3f, 0x7e40, 0x7e42, 0x7e43, 0x7e44, 0x7e45, 0x7e46, 0x7e48, 0x7e49, 0x7e4a, 0x7e4b, 0x7e4c, 0x7e4d, 0x7e4e, 0x7e4f, 0x7e50, 0x7e51, 0x7e52, 0x7e53, 0x7e54, 0x7e55, 0x7e56, 0x7e57, 0x7e58, 0x7e59, 0x7e5a, 0x7e5b, 0x7e5c, 0x7e5d, 0x4fca, 0x7ae3, 0x6d5a, 0x90e1, 0x9a8f, 0x5580, 0x5496, 0x5361, 0x54af, 0x5f00, 0x63e9, 0x6977, 0x51ef, 0x6168, 0x520a, 0x582a, 0x52d8, 0x574e, 0x780d, 0x770b, 0x5eb7, 0x6177, 0x7ce0, 0x625b, 0x6297, 0x4ea2, 0x7095, 0x8003, 0x62f7, 0x70e4, 0x9760, 0x5777, 0x82db, 0x67ef, 0x68f5, 0x78d5, 0x9897, 0x79d1, 0x58f3, 0x54b3, 0x53ef, 0x6e34, 0x514b, 0x523b, 0x5ba2, 0x8bfe, 0x80af, 0x5543, 0x57a6, 0x6073, 0x5751, 0x542d, 0x7a7a, 0x6050, 0x5b54, 0x63a7, 0x62a0, 0x53e3, 0x6263, 0x5bc7, 0x67af, 0x54ed, 0x7a9f, 0x82e6, 0x9177, 0x5e93, 0x88e4, 0x5938, 0x57ae, 0x630e, 0x8de8, 0x80ef, 0x5757, 0x7b77, 0x4fa9, 0x5feb, 0x5bbd, 0x6b3e, 0x5321, 0x7b50, 0x72c2, 0x6846, 0x77ff, 0x7736, 0x65f7, 0x51b5, 0x4e8f, 0x76d4, 0x5cbf, 0x7aa5, 0x8475, 0x594e, 0x9b41, 0x5080, /* 0xc0 */ 0x7e5e, 0x7e5f, 0x7e60, 0x7e61, 0x7e62, 0x7e63, 0x7e64, 0x7e65, 0x7e66, 0x7e67, 0x7e68, 0x7e69, 0x7e6a, 0x7e6b, 0x7e6c, 0x7e6d, 0x7e6e, 0x7e6f, 0x7e70, 0x7e71, 0x7e72, 0x7e73, 0x7e74, 0x7e75, 0x7e76, 0x7e77, 0x7e78, 0x7e79, 0x7e7a, 0x7e7b, 0x7e7c, 0x7e7d, 0x7e7e, 0x7e7f, 0x7e80, 0x7e81, 0x7e83, 0x7e84, 0x7e85, 0x7e86, 0x7e87, 0x7e88, 0x7e89, 0x7e8a, 0x7e8b, 0x7e8c, 0x7e8d, 0x7e8e, 0x7e8f, 0x7e90, 0x7e91, 0x7e92, 0x7e93, 0x7e94, 0x7e95, 0x7e96, 0x7e97, 0x7e98, 0x7e99, 0x7e9a, 0x7e9c, 0x7e9d, 0x7e9e, 0x7eae, 0x7eb4, 0x7ebb, 0x7ebc, 0x7ed6, 0x7ee4, 0x7eec, 0x7ef9, 0x7f0a, 0x7f10, 0x7f1e, 0x7f37, 0x7f39, 0x7f3b, 0x7f3c, 0x7f3d, 0x7f3e, 0x7f3f, 0x7f40, 0x7f41, 0x7f43, 0x7f46, 0x7f47, 0x7f48, 0x7f49, 0x7f4a, 0x7f4b, 0x7f4c, 0x7f4d, 0x7f4e, 0x7f4f, 0x7f52, 0x7f53, 0x9988, 0x6127, 0x6e83, 0x5764, 0x6606, 0x6346, 0x56f0, 0x62ec, 0x6269, 0x5ed3, 0x9614, 0x5783, 0x62c9, 0x5587, 0x8721, 0x814a, 0x8fa3, 0x5566, 0x83b1, 0x6765, 0x8d56, 0x84dd, 0x5a6a, 0x680f, 0x62e6, 0x7bee, 0x9611, 0x5170, 0x6f9c, 0x8c30, 0x63fd, 0x89c8, 0x61d2, 0x7f06, 0x70c2, 0x6ee5, 0x7405, 0x6994, 0x72fc, 0x5eca, 0x90ce, 0x6717, 0x6d6a, 0x635e, 0x52b3, 0x7262, 0x8001, 0x4f6c, 0x59e5, 0x916a, 0x70d9, 0x6d9d, 0x52d2, 0x4e50, 0x96f7, 0x956d, 0x857e, 0x78ca, 0x7d2f, 0x5121, 0x5792, 0x64c2, 0x808b, 0x7c7b, 0x6cea, 0x68f1, 0x695e, 0x51b7, 0x5398, 0x68a8, 0x7281, 0x9ece, 0x7bf1, 0x72f8, 0x79bb, 0x6f13, 0x7406, 0x674e, 0x91cc, 0x9ca4, 0x793c, 0x8389, 0x8354, 0x540f, 0x6817, 0x4e3d, 0x5389, 0x52b1, 0x783e, 0x5386, 0x5229, 0x5088, 0x4f8b, 0x4fd0, /* 0xc1 */ 0x7f56, 0x7f59, 0x7f5b, 0x7f5c, 0x7f5d, 0x7f5e, 0x7f60, 0x7f63, 0x7f64, 0x7f65, 0x7f66, 0x7f67, 0x7f6b, 0x7f6c, 0x7f6d, 0x7f6f, 0x7f70, 0x7f73, 0x7f75, 0x7f76, 0x7f77, 0x7f78, 0x7f7a, 0x7f7b, 0x7f7c, 0x7f7d, 0x7f7f, 0x7f80, 0x7f82, 0x7f83, 0x7f84, 0x7f85, 0x7f86, 0x7f87, 0x7f88, 0x7f89, 0x7f8b, 0x7f8d, 0x7f8f, 0x7f90, 0x7f91, 0x7f92, 0x7f93, 0x7f95, 0x7f96, 0x7f97, 0x7f98, 0x7f99, 0x7f9b, 0x7f9c, 0x7fa0, 0x7fa2, 0x7fa3, 0x7fa5, 0x7fa6, 0x7fa8, 0x7fa9, 0x7faa, 0x7fab, 0x7fac, 0x7fad, 0x7fae, 0x7fb1, 0x7fb3, 0x7fb4, 0x7fb5, 0x7fb6, 0x7fb7, 0x7fba, 0x7fbb, 0x7fbe, 0x7fc0, 0x7fc2, 0x7fc3, 0x7fc4, 0x7fc6, 0x7fc7, 0x7fc8, 0x7fc9, 0x7fcb, 0x7fcd, 0x7fcf, 0x7fd0, 0x7fd1, 0x7fd2, 0x7fd3, 0x7fd6, 0x7fd7, 0x7fd9, 0x7fda, 0x7fdb, 0x7fdc, 0x7fdd, 0x7fde, 0x7fe2, 0x7fe3, 0x75e2, 0x7acb, 0x7c92, 0x6ca5, 0x96b6, 0x529b, 0x7483, 0x54e9, 0x4fe9, 0x8054, 0x83b2, 0x8fde, 0x9570, 0x5ec9, 0x601c, 0x6d9f, 0x5e18, 0x655b, 0x8138, 0x94fe, 0x604b, 0x70bc, 0x7ec3, 0x7cae, 0x51c9, 0x6881, 0x7cb1, 0x826f, 0x4e24, 0x8f86, 0x91cf, 0x667e, 0x4eae, 0x8c05, 0x64a9, 0x804a, 0x50da, 0x7597, 0x71ce, 0x5be5, 0x8fbd, 0x6f66, 0x4e86, 0x6482, 0x9563, 0x5ed6, 0x6599, 0x5217, 0x88c2, 0x70c8, 0x52a3, 0x730e, 0x7433, 0x6797, 0x78f7, 0x9716, 0x4e34, 0x90bb, 0x9cde, 0x6dcb, 0x51db, 0x8d41, 0x541d, 0x62ce, 0x73b2, 0x83f1, 0x96f6, 0x9f84, 0x94c3, 0x4f36, 0x7f9a, 0x51cc, 0x7075, 0x9675, 0x5cad, 0x9886, 0x53e6, 0x4ee4, 0x6e9c, 0x7409, 0x69b4, 0x786b, 0x998f, 0x7559, 0x5218, 0x7624, 0x6d41, 0x67f3, 0x516d, 0x9f99, 0x804b, 0x5499, 0x7b3c, 0x7abf, /* 0xc2 */ 0x7fe4, 0x7fe7, 0x7fe8, 0x7fea, 0x7feb, 0x7fec, 0x7fed, 0x7fef, 0x7ff2, 0x7ff4, 0x7ff5, 0x7ff6, 0x7ff7, 0x7ff8, 0x7ff9, 0x7ffa, 0x7ffd, 0x7ffe, 0x7fff, 0x8002, 0x8007, 0x8008, 0x8009, 0x800a, 0x800e, 0x800f, 0x8011, 0x8013, 0x801a, 0x801b, 0x801d, 0x801e, 0x801f, 0x8021, 0x8023, 0x8024, 0x802b, 0x802c, 0x802d, 0x802e, 0x802f, 0x8030, 0x8032, 0x8034, 0x8039, 0x803a, 0x803c, 0x803e, 0x8040, 0x8041, 0x8044, 0x8045, 0x8047, 0x8048, 0x8049, 0x804e, 0x804f, 0x8050, 0x8051, 0x8053, 0x8055, 0x8056, 0x8057, 0x8059, 0x805b, 0x805c, 0x805d, 0x805e, 0x805f, 0x8060, 0x8061, 0x8062, 0x8063, 0x8064, 0x8065, 0x8066, 0x8067, 0x8068, 0x806b, 0x806c, 0x806d, 0x806e, 0x806f, 0x8070, 0x8072, 0x8073, 0x8074, 0x8075, 0x8076, 0x8077, 0x8078, 0x8079, 0x807a, 0x807b, 0x807c, 0x807d, 0x9686, 0x5784, 0x62e2, 0x9647, 0x697c, 0x5a04, 0x6402, 0x7bd3, 0x6f0f, 0x964b, 0x82a6, 0x5362, 0x9885, 0x5e90, 0x7089, 0x63b3, 0x5364, 0x864f, 0x9c81, 0x9e93, 0x788c, 0x9732, 0x8def, 0x8d42, 0x9e7f, 0x6f5e, 0x7984, 0x5f55, 0x9646, 0x622e, 0x9a74, 0x5415, 0x94dd, 0x4fa3, 0x65c5, 0x5c65, 0x5c61, 0x7f15, 0x8651, 0x6c2f, 0x5f8b, 0x7387, 0x6ee4, 0x7eff, 0x5ce6, 0x631b, 0x5b6a, 0x6ee6, 0x5375, 0x4e71, 0x63a0, 0x7565, 0x62a1, 0x8f6e, 0x4f26, 0x4ed1, 0x6ca6, 0x7eb6, 0x8bba, 0x841d, 0x87ba, 0x7f57, 0x903b, 0x9523, 0x7ba9, 0x9aa1, 0x88f8, 0x843d, 0x6d1b, 0x9a86, 0x7edc, 0x5988, 0x9ebb, 0x739b, 0x7801, 0x8682, 0x9a6c, 0x9a82, 0x561b, 0x5417, 0x57cb, 0x4e70, 0x9ea6, 0x5356, 0x8fc8, 0x8109, 0x7792, 0x9992, 0x86ee, 0x6ee1, 0x8513, 0x66fc, 0x6162, 0x6f2b, /* 0xc3 */ 0x807e, 0x8081, 0x8082, 0x8085, 0x8088, 0x808a, 0x808d, 0x808e, 0x808f, 0x8090, 0x8091, 0x8092, 0x8094, 0x8095, 0x8097, 0x8099, 0x809e, 0x80a3, 0x80a6, 0x80a7, 0x80a8, 0x80ac, 0x80b0, 0x80b3, 0x80b5, 0x80b6, 0x80b8, 0x80b9, 0x80bb, 0x80c5, 0x80c7, 0x80c8, 0x80c9, 0x80ca, 0x80cb, 0x80cf, 0x80d0, 0x80d1, 0x80d2, 0x80d3, 0x80d4, 0x80d5, 0x80d8, 0x80df, 0x80e0, 0x80e2, 0x80e3, 0x80e6, 0x80ee, 0x80f5, 0x80f7, 0x80f9, 0x80fb, 0x80fe, 0x80ff, 0x8100, 0x8101, 0x8103, 0x8104, 0x8105, 0x8107, 0x8108, 0x810b, 0x810c, 0x8115, 0x8117, 0x8119, 0x811b, 0x811c, 0x811d, 0x811f, 0x8120, 0x8121, 0x8122, 0x8123, 0x8124, 0x8125, 0x8126, 0x8127, 0x8128, 0x8129, 0x812a, 0x812b, 0x812d, 0x812e, 0x8130, 0x8133, 0x8134, 0x8135, 0x8137, 0x8139, 0x813a, 0x813b, 0x813c, 0x813d, 0x813f, 0x8c29, 0x8292, 0x832b, 0x76f2, 0x6c13, 0x5fd9, 0x83bd, 0x732b, 0x8305, 0x951a, 0x6bdb, 0x77db, 0x94c6, 0x536f, 0x8302, 0x5192, 0x5e3d, 0x8c8c, 0x8d38, 0x4e48, 0x73ab, 0x679a, 0x6885, 0x9176, 0x9709, 0x7164, 0x6ca1, 0x7709, 0x5a92, 0x9541, 0x6bcf, 0x7f8e, 0x6627, 0x5bd0, 0x59b9, 0x5a9a, 0x95e8, 0x95f7, 0x4eec, 0x840c, 0x8499, 0x6aac, 0x76df, 0x9530, 0x731b, 0x68a6, 0x5b5f, 0x772f, 0x919a, 0x9761, 0x7cdc, 0x8ff7, 0x8c1c, 0x5f25, 0x7c73, 0x79d8, 0x89c5, 0x6ccc, 0x871c, 0x5bc6, 0x5e42, 0x68c9, 0x7720, 0x7ef5, 0x5195, 0x514d, 0x52c9, 0x5a29, 0x7f05, 0x9762, 0x82d7, 0x63cf, 0x7784, 0x85d0, 0x79d2, 0x6e3a, 0x5e99, 0x5999, 0x8511, 0x706d, 0x6c11, 0x62bf, 0x76bf, 0x654f, 0x60af, 0x95fd, 0x660e, 0x879f, 0x9e23, 0x94ed, 0x540d, 0x547d, 0x8c2c, 0x6478, /* 0xc4 */ 0x8140, 0x8141, 0x8142, 0x8143, 0x8144, 0x8145, 0x8147, 0x8149, 0x814d, 0x814e, 0x814f, 0x8152, 0x8156, 0x8157, 0x8158, 0x815b, 0x815c, 0x815d, 0x815e, 0x815f, 0x8161, 0x8162, 0x8163, 0x8164, 0x8166, 0x8168, 0x816a, 0x816b, 0x816c, 0x816f, 0x8172, 0x8173, 0x8175, 0x8176, 0x8177, 0x8178, 0x8181, 0x8183, 0x8184, 0x8185, 0x8186, 0x8187, 0x8189, 0x818b, 0x818c, 0x818d, 0x818e, 0x8190, 0x8192, 0x8193, 0x8194, 0x8195, 0x8196, 0x8197, 0x8199, 0x819a, 0x819e, 0x819f, 0x81a0, 0x81a1, 0x81a2, 0x81a4, 0x81a5, 0x81a7, 0x81a9, 0x81ab, 0x81ac, 0x81ad, 0x81ae, 0x81af, 0x81b0, 0x81b1, 0x81b2, 0x81b4, 0x81b5, 0x81b6, 0x81b7, 0x81b8, 0x81b9, 0x81bc, 0x81bd, 0x81be, 0x81bf, 0x81c4, 0x81c5, 0x81c7, 0x81c8, 0x81c9, 0x81cb, 0x81cd, 0x81ce, 0x81cf, 0x81d0, 0x81d1, 0x81d2, 0x81d3, 0x6479, 0x8611, 0x6a21, 0x819c, 0x78e8, 0x6469, 0x9b54, 0x62b9, 0x672b, 0x83ab, 0x58a8, 0x9ed8, 0x6cab, 0x6f20, 0x5bde, 0x964c, 0x8c0b, 0x725f, 0x67d0, 0x62c7, 0x7261, 0x4ea9, 0x59c6, 0x6bcd, 0x5893, 0x66ae, 0x5e55, 0x52df, 0x6155, 0x6728, 0x76ee, 0x7766, 0x7267, 0x7a46, 0x62ff, 0x54ea, 0x5450, 0x94a0, 0x90a3, 0x5a1c, 0x7eb3, 0x6c16, 0x4e43, 0x5976, 0x8010, 0x5948, 0x5357, 0x7537, 0x96be, 0x56ca, 0x6320, 0x8111, 0x607c, 0x95f9, 0x6dd6, 0x5462, 0x9981, 0x5185, 0x5ae9, 0x80fd, 0x59ae, 0x9713, 0x502a, 0x6ce5, 0x5c3c, 0x62df, 0x4f60, 0x533f, 0x817b, 0x9006, 0x6eba, 0x852b, 0x62c8, 0x5e74, 0x78be, 0x64b5, 0x637b, 0x5ff5, 0x5a18, 0x917f, 0x9e1f, 0x5c3f, 0x634f, 0x8042, 0x5b7d, 0x556e, 0x954a, 0x954d, 0x6d85, 0x60a8, 0x67e0, 0x72de, 0x51dd, 0x5b81, /* 0xc5 */ 0x81d4, 0x81d5, 0x81d6, 0x81d7, 0x81d8, 0x81d9, 0x81da, 0x81db, 0x81dc, 0x81dd, 0x81de, 0x81df, 0x81e0, 0x81e1, 0x81e2, 0x81e4, 0x81e5, 0x81e6, 0x81e8, 0x81e9, 0x81eb, 0x81ee, 0x81ef, 0x81f0, 0x81f1, 0x81f2, 0x81f5, 0x81f6, 0x81f7, 0x81f8, 0x81f9, 0x81fa, 0x81fd, 0x81ff, 0x8203, 0x8207, 0x8208, 0x8209, 0x820a, 0x820b, 0x820e, 0x820f, 0x8211, 0x8213, 0x8215, 0x8216, 0x8217, 0x8218, 0x8219, 0x821a, 0x821d, 0x8220, 0x8224, 0x8225, 0x8226, 0x8227, 0x8229, 0x822e, 0x8232, 0x823a, 0x823c, 0x823d, 0x823f, 0x8240, 0x8241, 0x8242, 0x8243, 0x8245, 0x8246, 0x8248, 0x824a, 0x824c, 0x824d, 0x824e, 0x8250, 0x8251, 0x8252, 0x8253, 0x8254, 0x8255, 0x8256, 0x8257, 0x8259, 0x825b, 0x825c, 0x825d, 0x825e, 0x8260, 0x8261, 0x8262, 0x8263, 0x8264, 0x8265, 0x8266, 0x8267, 0x8269, 0x62e7, 0x6cde, 0x725b, 0x626d, 0x94ae, 0x7ebd, 0x8113, 0x6d53, 0x519c, 0x5f04, 0x5974, 0x52aa, 0x6012, 0x5973, 0x6696, 0x8650, 0x759f, 0x632a, 0x61e6, 0x7cef, 0x8bfa, 0x54e6, 0x6b27, 0x9e25, 0x6bb4, 0x85d5, 0x5455, 0x5076, 0x6ca4, 0x556a, 0x8db4, 0x722c, 0x5e15, 0x6015, 0x7436, 0x62cd, 0x6392, 0x724c, 0x5f98, 0x6e43, 0x6d3e, 0x6500, 0x6f58, 0x76d8, 0x78d0, 0x76fc, 0x7554, 0x5224, 0x53db, 0x4e53, 0x5e9e, 0x65c1, 0x802a, 0x80d6, 0x629b, 0x5486, 0x5228, 0x70ae, 0x888d, 0x8dd1, 0x6ce1, 0x5478, 0x80da, 0x57f9, 0x88f4, 0x8d54, 0x966a, 0x914d, 0x4f69, 0x6c9b, 0x55b7, 0x76c6, 0x7830, 0x62a8, 0x70f9, 0x6f8e, 0x5f6d, 0x84ec, 0x68da, 0x787c, 0x7bf7, 0x81a8, 0x670b, 0x9e4f, 0x6367, 0x78b0, 0x576f, 0x7812, 0x9739, 0x6279, 0x62ab, 0x5288, 0x7435, 0x6bd7, /* 0xc6 */ 0x826a, 0x826b, 0x826c, 0x826d, 0x8271, 0x8275, 0x8276, 0x8277, 0x8278, 0x827b, 0x827c, 0x8280, 0x8281, 0x8283, 0x8285, 0x8286, 0x8287, 0x8289, 0x828c, 0x8290, 0x8293, 0x8294, 0x8295, 0x8296, 0x829a, 0x829b, 0x829e, 0x82a0, 0x82a2, 0x82a3, 0x82a7, 0x82b2, 0x82b5, 0x82b6, 0x82ba, 0x82bb, 0x82bc, 0x82bf, 0x82c0, 0x82c2, 0x82c3, 0x82c5, 0x82c6, 0x82c9, 0x82d0, 0x82d6, 0x82d9, 0x82da, 0x82dd, 0x82e2, 0x82e7, 0x82e8, 0x82e9, 0x82ea, 0x82ec, 0x82ed, 0x82ee, 0x82f0, 0x82f2, 0x82f3, 0x82f5, 0x82f6, 0x82f8, 0x82fa, 0x82fc, 0x82fd, 0x82fe, 0x82ff, 0x8300, 0x830a, 0x830b, 0x830d, 0x8310, 0x8312, 0x8313, 0x8316, 0x8318, 0x8319, 0x831d, 0x831e, 0x831f, 0x8320, 0x8321, 0x8322, 0x8323, 0x8324, 0x8325, 0x8326, 0x8329, 0x832a, 0x832e, 0x8330, 0x8332, 0x8337, 0x833b, 0x833d, 0x5564, 0x813e, 0x75b2, 0x76ae, 0x5339, 0x75de, 0x50fb, 0x5c41, 0x8b6c, 0x7bc7, 0x504f, 0x7247, 0x9a97, 0x98d8, 0x6f02, 0x74e2, 0x7968, 0x6487, 0x77a5, 0x62fc, 0x9891, 0x8d2b, 0x54c1, 0x8058, 0x4e52, 0x576a, 0x82f9, 0x840d, 0x5e73, 0x51ed, 0x74f6, 0x8bc4, 0x5c4f, 0x5761, 0x6cfc, 0x9887, 0x5a46, 0x7834, 0x9b44, 0x8feb, 0x7c95, 0x5256, 0x6251, 0x94fa, 0x4ec6, 0x8386, 0x8461, 0x83e9, 0x84b2, 0x57d4, 0x6734, 0x5703, 0x666e, 0x6d66, 0x8c31, 0x66dd, 0x7011, 0x671f, 0x6b3a, 0x6816, 0x621a, 0x59bb, 0x4e03, 0x51c4, 0x6f06, 0x67d2, 0x6c8f, 0x5176, 0x68cb, 0x5947, 0x6b67, 0x7566, 0x5d0e, 0x8110, 0x9f50, 0x65d7, 0x7948, 0x7941, 0x9a91, 0x8d77, 0x5c82, 0x4e5e, 0x4f01, 0x542f, 0x5951, 0x780c, 0x5668, 0x6c14, 0x8fc4, 0x5f03, 0x6c7d, 0x6ce3, 0x8bab, 0x6390, /* 0xc7 */ 0x833e, 0x833f, 0x8341, 0x8342, 0x8344, 0x8345, 0x8348, 0x834a, 0x834b, 0x834c, 0x834d, 0x834e, 0x8353, 0x8355, 0x8356, 0x8357, 0x8358, 0x8359, 0x835d, 0x8362, 0x8370, 0x8371, 0x8372, 0x8373, 0x8374, 0x8375, 0x8376, 0x8379, 0x837a, 0x837e, 0x837f, 0x8380, 0x8381, 0x8382, 0x8383, 0x8384, 0x8387, 0x8388, 0x838a, 0x838b, 0x838c, 0x838d, 0x838f, 0x8390, 0x8391, 0x8394, 0x8395, 0x8396, 0x8397, 0x8399, 0x839a, 0x839d, 0x839f, 0x83a1, 0x83a2, 0x83a3, 0x83a4, 0x83a5, 0x83a6, 0x83a7, 0x83ac, 0x83ad, 0x83ae, 0x83af, 0x83b5, 0x83bb, 0x83be, 0x83bf, 0x83c2, 0x83c3, 0x83c4, 0x83c6, 0x83c8, 0x83c9, 0x83cb, 0x83cd, 0x83ce, 0x83d0, 0x83d1, 0x83d2, 0x83d3, 0x83d5, 0x83d7, 0x83d9, 0x83da, 0x83db, 0x83de, 0x83e2, 0x83e3, 0x83e4, 0x83e6, 0x83e7, 0x83e8, 0x83eb, 0x83ec, 0x83ed, 0x6070, 0x6d3d, 0x7275, 0x6266, 0x948e, 0x94c5, 0x5343, 0x8fc1, 0x7b7e, 0x4edf, 0x8c26, 0x4e7e, 0x9ed4, 0x94b1, 0x94b3, 0x524d, 0x6f5c, 0x9063, 0x6d45, 0x8c34, 0x5811, 0x5d4c, 0x6b20, 0x6b49, 0x67aa, 0x545b, 0x8154, 0x7f8c, 0x5899, 0x8537, 0x5f3a, 0x62a2, 0x6a47, 0x9539, 0x6572, 0x6084, 0x6865, 0x77a7, 0x4e54, 0x4fa8, 0x5de7, 0x9798, 0x64ac, 0x7fd8, 0x5ced, 0x4fcf, 0x7a8d, 0x5207, 0x8304, 0x4e14, 0x602f, 0x7a83, 0x94a6, 0x4fb5, 0x4eb2, 0x79e6, 0x7434, 0x52e4, 0x82b9, 0x64d2, 0x79bd, 0x5bdd, 0x6c81, 0x9752, 0x8f7b, 0x6c22, 0x503e, 0x537f, 0x6e05, 0x64ce, 0x6674, 0x6c30, 0x60c5, 0x9877, 0x8bf7, 0x5e86, 0x743c, 0x7a77, 0x79cb, 0x4e18, 0x90b1, 0x7403, 0x6c42, 0x56da, 0x914b, 0x6cc5, 0x8d8b, 0x533a, 0x86c6, 0x66f2, 0x8eaf, 0x5c48, 0x9a71, 0x6e20, /* 0xc8 */ 0x83ee, 0x83ef, 0x83f3, 0x83f4, 0x83f5, 0x83f6, 0x83f7, 0x83fa, 0x83fb, 0x83fc, 0x83fe, 0x83ff, 0x8400, 0x8402, 0x8405, 0x8407, 0x8408, 0x8409, 0x840a, 0x8410, 0x8412, 0x8413, 0x8414, 0x8415, 0x8416, 0x8417, 0x8419, 0x841a, 0x841b, 0x841e, 0x841f, 0x8420, 0x8421, 0x8422, 0x8423, 0x8429, 0x842a, 0x842b, 0x842c, 0x842d, 0x842e, 0x842f, 0x8430, 0x8432, 0x8433, 0x8434, 0x8435, 0x8436, 0x8437, 0x8439, 0x843a, 0x843b, 0x843e, 0x843f, 0x8440, 0x8441, 0x8442, 0x8443, 0x8444, 0x8445, 0x8447, 0x8448, 0x8449, 0x844a, 0x844b, 0x844c, 0x844d, 0x844e, 0x844f, 0x8450, 0x8452, 0x8453, 0x8454, 0x8455, 0x8456, 0x8458, 0x845d, 0x845e, 0x845f, 0x8460, 0x8462, 0x8464, 0x8465, 0x8466, 0x8467, 0x8468, 0x846a, 0x846e, 0x846f, 0x8470, 0x8472, 0x8474, 0x8477, 0x8479, 0x847b, 0x847c, 0x53d6, 0x5a36, 0x9f8b, 0x8da3, 0x53bb, 0x5708, 0x98a7, 0x6743, 0x919b, 0x6cc9, 0x5168, 0x75ca, 0x62f3, 0x72ac, 0x5238, 0x529d, 0x7f3a, 0x7094, 0x7638, 0x5374, 0x9e4a, 0x69b7, 0x786e, 0x96c0, 0x88d9, 0x7fa4, 0x7136, 0x71c3, 0x5189, 0x67d3, 0x74e4, 0x58e4, 0x6518, 0x56b7, 0x8ba9, 0x9976, 0x6270, 0x7ed5, 0x60f9, 0x70ed, 0x58ec, 0x4ec1, 0x4eba, 0x5fcd, 0x97e7, 0x4efb, 0x8ba4, 0x5203, 0x598a, 0x7eab, 0x6254, 0x4ecd, 0x65e5, 0x620e, 0x8338, 0x84c9, 0x8363, 0x878d, 0x7194, 0x6eb6, 0x5bb9, 0x7ed2, 0x5197, 0x63c9, 0x67d4, 0x8089, 0x8339, 0x8815, 0x5112, 0x5b7a, 0x5982, 0x8fb1, 0x4e73, 0x6c5d, 0x5165, 0x8925, 0x8f6f, 0x962e, 0x854a, 0x745e, 0x9510, 0x95f0, 0x6da6, 0x82e5, 0x5f31, 0x6492, 0x6d12, 0x8428, 0x816e, 0x9cc3, 0x585e, 0x8d5b, 0x4e09, 0x53c1, /* 0xc9 */ 0x847d, 0x847e, 0x847f, 0x8480, 0x8481, 0x8483, 0x8484, 0x8485, 0x8486, 0x848a, 0x848d, 0x848f, 0x8490, 0x8491, 0x8492, 0x8493, 0x8494, 0x8495, 0x8496, 0x8498, 0x849a, 0x849b, 0x849d, 0x849e, 0x849f, 0x84a0, 0x84a2, 0x84a3, 0x84a4, 0x84a5, 0x84a6, 0x84a7, 0x84a8, 0x84a9, 0x84aa, 0x84ab, 0x84ac, 0x84ad, 0x84ae, 0x84b0, 0x84b1, 0x84b3, 0x84b5, 0x84b6, 0x84b7, 0x84bb, 0x84bc, 0x84be, 0x84c0, 0x84c2, 0x84c3, 0x84c5, 0x84c6, 0x84c7, 0x84c8, 0x84cb, 0x84cc, 0x84ce, 0x84cf, 0x84d2, 0x84d4, 0x84d5, 0x84d7, 0x84d8, 0x84d9, 0x84da, 0x84db, 0x84dc, 0x84de, 0x84e1, 0x84e2, 0x84e4, 0x84e7, 0x84e8, 0x84e9, 0x84ea, 0x84eb, 0x84ed, 0x84ee, 0x84ef, 0x84f1, 0x84f2, 0x84f3, 0x84f4, 0x84f5, 0x84f6, 0x84f7, 0x84f8, 0x84f9, 0x84fa, 0x84fb, 0x84fd, 0x84fe, 0x8500, 0x8501, 0x8502, 0x4f1e, 0x6563, 0x6851, 0x55d3, 0x4e27, 0x6414, 0x9a9a, 0x626b, 0x5ac2, 0x745f, 0x8272, 0x6da9, 0x68ee, 0x50e7, 0x838e, 0x7802, 0x6740, 0x5239, 0x6c99, 0x7eb1, 0x50bb, 0x5565, 0x715e, 0x7b5b, 0x6652, 0x73ca, 0x82eb, 0x6749, 0x5c71, 0x5220, 0x717d, 0x886b, 0x95ea, 0x9655, 0x64c5, 0x8d61, 0x81b3, 0x5584, 0x6c55, 0x6247, 0x7f2e, 0x5892, 0x4f24, 0x5546, 0x8d4f, 0x664c, 0x4e0a, 0x5c1a, 0x88f3, 0x68a2, 0x634e, 0x7a0d, 0x70e7, 0x828d, 0x52fa, 0x97f6, 0x5c11, 0x54e8, 0x90b5, 0x7ecd, 0x5962, 0x8d4a, 0x86c7, 0x820c, 0x820d, 0x8d66, 0x6444, 0x5c04, 0x6151, 0x6d89, 0x793e, 0x8bbe, 0x7837, 0x7533, 0x547b, 0x4f38, 0x8eab, 0x6df1, 0x5a20, 0x7ec5, 0x795e, 0x6c88, 0x5ba1, 0x5a76, 0x751a, 0x80be, 0x614e, 0x6e17, 0x58f0, 0x751f, 0x7525, 0x7272, 0x5347, 0x7ef3, /* 0xca */ 0x8503, 0x8504, 0x8505, 0x8506, 0x8507, 0x8508, 0x8509, 0x850a, 0x850b, 0x850d, 0x850e, 0x850f, 0x8510, 0x8512, 0x8514, 0x8515, 0x8516, 0x8518, 0x8519, 0x851b, 0x851c, 0x851d, 0x851e, 0x8520, 0x8522, 0x8523, 0x8524, 0x8525, 0x8526, 0x8527, 0x8528, 0x8529, 0x852a, 0x852d, 0x852e, 0x852f, 0x8530, 0x8531, 0x8532, 0x8533, 0x8534, 0x8535, 0x8536, 0x853e, 0x853f, 0x8540, 0x8541, 0x8542, 0x8544, 0x8545, 0x8546, 0x8547, 0x854b, 0x854c, 0x854d, 0x854e, 0x854f, 0x8550, 0x8551, 0x8552, 0x8553, 0x8554, 0x8555, 0x8557, 0x8558, 0x855a, 0x855b, 0x855c, 0x855d, 0x855f, 0x8560, 0x8561, 0x8562, 0x8563, 0x8565, 0x8566, 0x8567, 0x8569, 0x856a, 0x856b, 0x856c, 0x856d, 0x856e, 0x856f, 0x8570, 0x8571, 0x8573, 0x8575, 0x8576, 0x8577, 0x8578, 0x857c, 0x857d, 0x857f, 0x8580, 0x8581, 0x7701, 0x76db, 0x5269, 0x80dc, 0x5723, 0x5e08, 0x5931, 0x72ee, 0x65bd, 0x6e7f, 0x8bd7, 0x5c38, 0x8671, 0x5341, 0x77f3, 0x62fe, 0x65f6, 0x4ec0, 0x98df, 0x8680, 0x5b9e, 0x8bc6, 0x53f2, 0x77e2, 0x4f7f, 0x5c4e, 0x9a76, 0x59cb, 0x5f0f, 0x793a, 0x58eb, 0x4e16, 0x67ff, 0x4e8b, 0x62ed, 0x8a93, 0x901d, 0x52bf, 0x662f, 0x55dc, 0x566c, 0x9002, 0x4ed5, 0x4f8d, 0x91ca, 0x9970, 0x6c0f, 0x5e02, 0x6043, 0x5ba4, 0x89c6, 0x8bd5, 0x6536, 0x624b, 0x9996, 0x5b88, 0x5bff, 0x6388, 0x552e, 0x53d7, 0x7626, 0x517d, 0x852c, 0x67a2, 0x68b3, 0x6b8a, 0x6292, 0x8f93, 0x53d4, 0x8212, 0x6dd1, 0x758f, 0x4e66, 0x8d4e, 0x5b70, 0x719f, 0x85af, 0x6691, 0x66d9, 0x7f72, 0x8700, 0x9ecd, 0x9f20, 0x5c5e, 0x672f, 0x8ff0, 0x6811, 0x675f, 0x620d, 0x7ad6, 0x5885, 0x5eb6, 0x6570, 0x6f31, /* 0xcb */ 0x8582, 0x8583, 0x8586, 0x8588, 0x8589, 0x858a, 0x858b, 0x858c, 0x858d, 0x858e, 0x8590, 0x8591, 0x8592, 0x8593, 0x8594, 0x8595, 0x8596, 0x8597, 0x8598, 0x8599, 0x859a, 0x859d, 0x859e, 0x859f, 0x85a0, 0x85a1, 0x85a2, 0x85a3, 0x85a5, 0x85a6, 0x85a7, 0x85a9, 0x85ab, 0x85ac, 0x85ad, 0x85b1, 0x85b2, 0x85b3, 0x85b4, 0x85b5, 0x85b6, 0x85b8, 0x85ba, 0x85bb, 0x85bc, 0x85bd, 0x85be, 0x85bf, 0x85c0, 0x85c2, 0x85c3, 0x85c4, 0x85c5, 0x85c6, 0x85c7, 0x85c8, 0x85ca, 0x85cb, 0x85cc, 0x85cd, 0x85ce, 0x85d1, 0x85d2, 0x85d4, 0x85d6, 0x85d7, 0x85d8, 0x85d9, 0x85da, 0x85db, 0x85dd, 0x85de, 0x85df, 0x85e0, 0x85e1, 0x85e2, 0x85e3, 0x85e5, 0x85e6, 0x85e7, 0x85e8, 0x85ea, 0x85eb, 0x85ec, 0x85ed, 0x85ee, 0x85ef, 0x85f0, 0x85f1, 0x85f2, 0x85f3, 0x85f4, 0x85f5, 0x85f6, 0x85f7, 0x85f8, 0x6055, 0x5237, 0x800d, 0x6454, 0x8870, 0x7529, 0x5e05, 0x6813, 0x62f4, 0x971c, 0x53cc, 0x723d, 0x8c01, 0x6c34, 0x7761, 0x7a0e, 0x542e, 0x77ac, 0x987a, 0x821c, 0x8bf4, 0x7855, 0x6714, 0x70c1, 0x65af, 0x6495, 0x5636, 0x601d, 0x79c1, 0x53f8, 0x4e1d, 0x6b7b, 0x8086, 0x5bfa, 0x55e3, 0x56db, 0x4f3a, 0x4f3c, 0x9972, 0x5df3, 0x677e, 0x8038, 0x6002, 0x9882, 0x9001, 0x5b8b, 0x8bbc, 0x8bf5, 0x641c, 0x8258, 0x64de, 0x55fd, 0x82cf, 0x9165, 0x4fd7, 0x7d20, 0x901f, 0x7c9f, 0x50f3, 0x5851, 0x6eaf, 0x5bbf, 0x8bc9, 0x8083, 0x9178, 0x849c, 0x7b97, 0x867d, 0x968b, 0x968f, 0x7ee5, 0x9ad3, 0x788e, 0x5c81, 0x7a57, 0x9042, 0x96a7, 0x795f, 0x5b59, 0x635f, 0x7b0b, 0x84d1, 0x68ad, 0x5506, 0x7f29, 0x7410, 0x7d22, 0x9501, 0x6240, 0x584c, 0x4ed6, 0x5b83, 0x5979, 0x5854, /* 0xcc */ 0x85f9, 0x85fa, 0x85fc, 0x85fd, 0x85fe, 0x8600, 0x8601, 0x8602, 0x8603, 0x8604, 0x8606, 0x8607, 0x8608, 0x8609, 0x860a, 0x860b, 0x860c, 0x860d, 0x860e, 0x860f, 0x8610, 0x8612, 0x8613, 0x8614, 0x8615, 0x8617, 0x8618, 0x8619, 0x861a, 0x861b, 0x861c, 0x861d, 0x861e, 0x861f, 0x8620, 0x8621, 0x8622, 0x8623, 0x8624, 0x8625, 0x8626, 0x8628, 0x862a, 0x862b, 0x862c, 0x862d, 0x862e, 0x862f, 0x8630, 0x8631, 0x8632, 0x8633, 0x8634, 0x8635, 0x8636, 0x8637, 0x8639, 0x863a, 0x863b, 0x863d, 0x863e, 0x863f, 0x8640, 0x8641, 0x8642, 0x8643, 0x8644, 0x8645, 0x8646, 0x8647, 0x8648, 0x8649, 0x864a, 0x864b, 0x864c, 0x8652, 0x8653, 0x8655, 0x8656, 0x8657, 0x8658, 0x8659, 0x865b, 0x865c, 0x865d, 0x865f, 0x8660, 0x8661, 0x8663, 0x8664, 0x8665, 0x8666, 0x8667, 0x8668, 0x8669, 0x866a, 0x736d, 0x631e, 0x8e4b, 0x8e0f, 0x80ce, 0x82d4, 0x62ac, 0x53f0, 0x6cf0, 0x915e, 0x592a, 0x6001, 0x6c70, 0x574d, 0x644a, 0x8d2a, 0x762b, 0x6ee9, 0x575b, 0x6a80, 0x75f0, 0x6f6d, 0x8c2d, 0x8c08, 0x5766, 0x6bef, 0x8892, 0x78b3, 0x63a2, 0x53f9, 0x70ad, 0x6c64, 0x5858, 0x642a, 0x5802, 0x68e0, 0x819b, 0x5510, 0x7cd6, 0x5018, 0x8eba, 0x6dcc, 0x8d9f, 0x70eb, 0x638f, 0x6d9b, 0x6ed4, 0x7ee6, 0x8404, 0x6843, 0x9003, 0x6dd8, 0x9676, 0x8ba8, 0x5957, 0x7279, 0x85e4, 0x817e, 0x75bc, 0x8a8a, 0x68af, 0x5254, 0x8e22, 0x9511, 0x63d0, 0x9898, 0x8e44, 0x557c, 0x4f53, 0x66ff, 0x568f, 0x60d5, 0x6d95, 0x5243, 0x5c49, 0x5929, 0x6dfb, 0x586b, 0x7530, 0x751c, 0x606c, 0x8214, 0x8146, 0x6311, 0x6761, 0x8fe2, 0x773a, 0x8df3, 0x8d34, 0x94c1, 0x5e16, 0x5385, 0x542c, 0x70c3, /* 0xcd */ 0x866d, 0x866f, 0x8670, 0x8672, 0x8673, 0x8674, 0x8675, 0x8676, 0x8677, 0x8678, 0x8683, 0x8684, 0x8685, 0x8686, 0x8687, 0x8688, 0x8689, 0x868e, 0x868f, 0x8690, 0x8691, 0x8692, 0x8694, 0x8696, 0x8697, 0x8698, 0x8699, 0x869a, 0x869b, 0x869e, 0x869f, 0x86a0, 0x86a1, 0x86a2, 0x86a5, 0x86a6, 0x86ab, 0x86ad, 0x86ae, 0x86b2, 0x86b3, 0x86b7, 0x86b8, 0x86b9, 0x86bb, 0x86bc, 0x86bd, 0x86be, 0x86bf, 0x86c1, 0x86c2, 0x86c3, 0x86c5, 0x86c8, 0x86cc, 0x86cd, 0x86d2, 0x86d3, 0x86d5, 0x86d6, 0x86d7, 0x86da, 0x86dc, 0x86dd, 0x86e0, 0x86e1, 0x86e2, 0x86e3, 0x86e5, 0x86e6, 0x86e7, 0x86e8, 0x86ea, 0x86eb, 0x86ec, 0x86ef, 0x86f5, 0x86f6, 0x86f7, 0x86fa, 0x86fb, 0x86fc, 0x86fd, 0x86ff, 0x8701, 0x8704, 0x8705, 0x8706, 0x870b, 0x870c, 0x870e, 0x870f, 0x8710, 0x8711, 0x8714, 0x8716, 0x6c40, 0x5ef7, 0x505c, 0x4ead, 0x5ead, 0x633a, 0x8247, 0x901a, 0x6850, 0x916e, 0x77b3, 0x540c, 0x94dc, 0x5f64, 0x7ae5, 0x6876, 0x6345, 0x7b52, 0x7edf, 0x75db, 0x5077, 0x6295, 0x5934, 0x900f, 0x51f8, 0x79c3, 0x7a81, 0x56fe, 0x5f92, 0x9014, 0x6d82, 0x5c60, 0x571f, 0x5410, 0x5154, 0x6e4d, 0x56e2, 0x63a8, 0x9893, 0x817f, 0x8715, 0x892a, 0x9000, 0x541e, 0x5c6f, 0x81c0, 0x62d6, 0x6258, 0x8131, 0x9e35, 0x9640, 0x9a6e, 0x9a7c, 0x692d, 0x59a5, 0x62d3, 0x553e, 0x6316, 0x54c7, 0x86d9, 0x6d3c, 0x5a03, 0x74e6, 0x889c, 0x6b6a, 0x5916, 0x8c4c, 0x5f2f, 0x6e7e, 0x73a9, 0x987d, 0x4e38, 0x70f7, 0x5b8c, 0x7897, 0x633d, 0x665a, 0x7696, 0x60cb, 0x5b9b, 0x5a49, 0x4e07, 0x8155, 0x6c6a, 0x738b, 0x4ea1, 0x6789, 0x7f51, 0x5f80, 0x65fa, 0x671b, 0x5fd8, 0x5984, 0x5a01, /* 0xce */ 0x8719, 0x871b, 0x871d, 0x871f, 0x8720, 0x8724, 0x8726, 0x8727, 0x8728, 0x872a, 0x872b, 0x872c, 0x872d, 0x872f, 0x8730, 0x8732, 0x8733, 0x8735, 0x8736, 0x8738, 0x8739, 0x873a, 0x873c, 0x873d, 0x8740, 0x8741, 0x8742, 0x8743, 0x8744, 0x8745, 0x8746, 0x874a, 0x874b, 0x874d, 0x874f, 0x8750, 0x8751, 0x8752, 0x8754, 0x8755, 0x8756, 0x8758, 0x875a, 0x875b, 0x875c, 0x875d, 0x875e, 0x875f, 0x8761, 0x8762, 0x8766, 0x8767, 0x8768, 0x8769, 0x876a, 0x876b, 0x876c, 0x876d, 0x876f, 0x8771, 0x8772, 0x8773, 0x8775, 0x8777, 0x8778, 0x8779, 0x877a, 0x877f, 0x8780, 0x8781, 0x8784, 0x8786, 0x8787, 0x8789, 0x878a, 0x878c, 0x878e, 0x878f, 0x8790, 0x8791, 0x8792, 0x8794, 0x8795, 0x8796, 0x8798, 0x8799, 0x879a, 0x879b, 0x879c, 0x879d, 0x879e, 0x87a0, 0x87a1, 0x87a2, 0x87a3, 0x87a4, 0x5dcd, 0x5fae, 0x5371, 0x97e6, 0x8fdd, 0x6845, 0x56f4, 0x552f, 0x60df, 0x4e3a, 0x6f4d, 0x7ef4, 0x82c7, 0x840e, 0x59d4, 0x4f1f, 0x4f2a, 0x5c3e, 0x7eac, 0x672a, 0x851a, 0x5473, 0x754f, 0x80c3, 0x5582, 0x9b4f, 0x4f4d, 0x6e2d, 0x8c13, 0x5c09, 0x6170, 0x536b, 0x761f, 0x6e29, 0x868a, 0x6587, 0x95fb, 0x7eb9, 0x543b, 0x7a33, 0x7d0a, 0x95ee, 0x55e1, 0x7fc1, 0x74ee, 0x631d, 0x8717, 0x6da1, 0x7a9d, 0x6211, 0x65a1, 0x5367, 0x63e1, 0x6c83, 0x5deb, 0x545c, 0x94a8, 0x4e4c, 0x6c61, 0x8bec, 0x5c4b, 0x65e0, 0x829c, 0x68a7, 0x543e, 0x5434, 0x6bcb, 0x6b66, 0x4e94, 0x6342, 0x5348, 0x821e, 0x4f0d, 0x4fae, 0x575e, 0x620a, 0x96fe, 0x6664, 0x7269, 0x52ff, 0x52a1, 0x609f, 0x8bef, 0x6614, 0x7199, 0x6790, 0x897f, 0x7852, 0x77fd, 0x6670, 0x563b, 0x5438, 0x9521, 0x727a, /* 0xcf */ 0x87a5, 0x87a6, 0x87a7, 0x87a9, 0x87aa, 0x87ae, 0x87b0, 0x87b1, 0x87b2, 0x87b4, 0x87b6, 0x87b7, 0x87b8, 0x87b9, 0x87bb, 0x87bc, 0x87be, 0x87bf, 0x87c1, 0x87c2, 0x87c3, 0x87c4, 0x87c5, 0x87c7, 0x87c8, 0x87c9, 0x87cc, 0x87cd, 0x87ce, 0x87cf, 0x87d0, 0x87d4, 0x87d5, 0x87d6, 0x87d7, 0x87d8, 0x87d9, 0x87da, 0x87dc, 0x87dd, 0x87de, 0x87df, 0x87e1, 0x87e2, 0x87e3, 0x87e4, 0x87e6, 0x87e7, 0x87e8, 0x87e9, 0x87eb, 0x87ec, 0x87ed, 0x87ef, 0x87f0, 0x87f1, 0x87f2, 0x87f3, 0x87f4, 0x87f5, 0x87f6, 0x87f7, 0x87f8, 0x87fa, 0x87fb, 0x87fc, 0x87fd, 0x87ff, 0x8800, 0x8801, 0x8802, 0x8804, 0x8805, 0x8806, 0x8807, 0x8808, 0x8809, 0x880b, 0x880c, 0x880d, 0x880e, 0x880f, 0x8810, 0x8811, 0x8812, 0x8814, 0x8817, 0x8818, 0x8819, 0x881a, 0x881c, 0x881d, 0x881e, 0x881f, 0x8820, 0x8823, 0x7a00, 0x606f, 0x5e0c, 0x6089, 0x819d, 0x5915, 0x60dc, 0x7184, 0x70ef, 0x6eaa, 0x6c50, 0x7280, 0x6a84, 0x88ad, 0x5e2d, 0x4e60, 0x5ab3, 0x559c, 0x94e3, 0x6d17, 0x7cfb, 0x9699, 0x620f, 0x7ec6, 0x778e, 0x867e, 0x5323, 0x971e, 0x8f96, 0x6687, 0x5ce1, 0x4fa0, 0x72ed, 0x4e0b, 0x53a6, 0x590f, 0x5413, 0x6380, 0x9528, 0x5148, 0x4ed9, 0x9c9c, 0x7ea4, 0x54b8, 0x8d24, 0x8854, 0x8237, 0x95f2, 0x6d8e, 0x5f26, 0x5acc, 0x663e, 0x9669, 0x73b0, 0x732e, 0x53bf, 0x817a, 0x9985, 0x7fa1, 0x5baa, 0x9677, 0x9650, 0x7ebf, 0x76f8, 0x53a2, 0x9576, 0x9999, 0x7bb1, 0x8944, 0x6e58, 0x4e61, 0x7fd4, 0x7965, 0x8be6, 0x60f3, 0x54cd, 0x4eab, 0x9879, 0x5df7, 0x6a61, 0x50cf, 0x5411, 0x8c61, 0x8427, 0x785d, 0x9704, 0x524a, 0x54ee, 0x56a3, 0x9500, 0x6d88, 0x5bb5, 0x6dc6, 0x6653, /* 0xd0 */ 0x8824, 0x8825, 0x8826, 0x8827, 0x8828, 0x8829, 0x882a, 0x882b, 0x882c, 0x882d, 0x882e, 0x882f, 0x8830, 0x8831, 0x8833, 0x8834, 0x8835, 0x8836, 0x8837, 0x8838, 0x883a, 0x883b, 0x883d, 0x883e, 0x883f, 0x8841, 0x8842, 0x8843, 0x8846, 0x8847, 0x8848, 0x8849, 0x884a, 0x884b, 0x884e, 0x884f, 0x8850, 0x8851, 0x8852, 0x8853, 0x8855, 0x8856, 0x8858, 0x885a, 0x885b, 0x885c, 0x885d, 0x885e, 0x885f, 0x8860, 0x8866, 0x8867, 0x886a, 0x886d, 0x886f, 0x8871, 0x8873, 0x8874, 0x8875, 0x8876, 0x8878, 0x8879, 0x887a, 0x887b, 0x887c, 0x8880, 0x8883, 0x8886, 0x8887, 0x8889, 0x888a, 0x888c, 0x888e, 0x888f, 0x8890, 0x8891, 0x8893, 0x8894, 0x8895, 0x8897, 0x8898, 0x8899, 0x889a, 0x889b, 0x889d, 0x889e, 0x889f, 0x88a0, 0x88a1, 0x88a3, 0x88a5, 0x88a6, 0x88a7, 0x88a8, 0x88a9, 0x88aa, 0x5c0f, 0x5b5d, 0x6821, 0x8096, 0x5578, 0x7b11, 0x6548, 0x6954, 0x4e9b, 0x6b47, 0x874e, 0x978b, 0x534f, 0x631f, 0x643a, 0x90aa, 0x659c, 0x80c1, 0x8c10, 0x5199, 0x68b0, 0x5378, 0x87f9, 0x61c8, 0x6cc4, 0x6cfb, 0x8c22, 0x5c51, 0x85aa, 0x82af, 0x950c, 0x6b23, 0x8f9b, 0x65b0, 0x5ffb, 0x5fc3, 0x4fe1, 0x8845, 0x661f, 0x8165, 0x7329, 0x60fa, 0x5174, 0x5211, 0x578b, 0x5f62, 0x90a2, 0x884c, 0x9192, 0x5e78, 0x674f, 0x6027, 0x59d3, 0x5144, 0x51f6, 0x80f8, 0x5308, 0x6c79, 0x96c4, 0x718a, 0x4f11, 0x4fee, 0x7f9e, 0x673d, 0x55c5, 0x9508, 0x79c0, 0x8896, 0x7ee3, 0x589f, 0x620c, 0x9700, 0x865a, 0x5618, 0x987b, 0x5f90, 0x8bb8, 0x84c4, 0x9157, 0x53d9, 0x65ed, 0x5e8f, 0x755c, 0x6064, 0x7d6e, 0x5a7f, 0x7eea, 0x7eed, 0x8f69, 0x55a7, 0x5ba3, 0x60ac, 0x65cb, 0x7384, /* 0xd1 */ 0x88ac, 0x88ae, 0x88af, 0x88b0, 0x88b2, 0x88b3, 0x88b4, 0x88b5, 0x88b6, 0x88b8, 0x88b9, 0x88ba, 0x88bb, 0x88bd, 0x88be, 0x88bf, 0x88c0, 0x88c3, 0x88c4, 0x88c7, 0x88c8, 0x88ca, 0x88cb, 0x88cc, 0x88cd, 0x88cf, 0x88d0, 0x88d1, 0x88d3, 0x88d6, 0x88d7, 0x88da, 0x88db, 0x88dc, 0x88dd, 0x88de, 0x88e0, 0x88e1, 0x88e6, 0x88e7, 0x88e9, 0x88ea, 0x88eb, 0x88ec, 0x88ed, 0x88ee, 0x88ef, 0x88f2, 0x88f5, 0x88f6, 0x88f7, 0x88fa, 0x88fb, 0x88fd, 0x88ff, 0x8900, 0x8901, 0x8903, 0x8904, 0x8905, 0x8906, 0x8907, 0x8908, 0x8909, 0x890b, 0x890c, 0x890d, 0x890e, 0x890f, 0x8911, 0x8914, 0x8915, 0x8916, 0x8917, 0x8918, 0x891c, 0x891d, 0x891e, 0x891f, 0x8920, 0x8922, 0x8923, 0x8924, 0x8926, 0x8927, 0x8928, 0x8929, 0x892c, 0x892d, 0x892e, 0x892f, 0x8931, 0x8932, 0x8933, 0x8935, 0x8937, 0x9009, 0x7663, 0x7729, 0x7eda, 0x9774, 0x859b, 0x5b66, 0x7a74, 0x96ea, 0x8840, 0x52cb, 0x718f, 0x5faa, 0x65ec, 0x8be2, 0x5bfb, 0x9a6f, 0x5de1, 0x6b89, 0x6c5b, 0x8bad, 0x8baf, 0x900a, 0x8fc5, 0x538b, 0x62bc, 0x9e26, 0x9e2d, 0x5440, 0x4e2b, 0x82bd, 0x7259, 0x869c, 0x5d16, 0x8859, 0x6daf, 0x96c5, 0x54d1, 0x4e9a, 0x8bb6, 0x7109, 0x54bd, 0x9609, 0x70df, 0x6df9, 0x76d0, 0x4e25, 0x7814, 0x8712, 0x5ca9, 0x5ef6, 0x8a00, 0x989c, 0x960e, 0x708e, 0x6cbf, 0x5944, 0x63a9, 0x773c, 0x884d, 0x6f14, 0x8273, 0x5830, 0x71d5, 0x538c, 0x781a, 0x96c1, 0x5501, 0x5f66, 0x7130, 0x5bb4, 0x8c1a, 0x9a8c, 0x6b83, 0x592e, 0x9e2f, 0x79e7, 0x6768, 0x626c, 0x4f6f, 0x75a1, 0x7f8a, 0x6d0b, 0x9633, 0x6c27, 0x4ef0, 0x75d2, 0x517b, 0x6837, 0x6f3e, 0x9080, 0x8170, 0x5996, 0x7476, /* 0xd2 */ 0x8938, 0x8939, 0x893a, 0x893b, 0x893c, 0x893d, 0x893e, 0x893f, 0x8940, 0x8942, 0x8943, 0x8945, 0x8946, 0x8947, 0x8948, 0x8949, 0x894a, 0x894b, 0x894c, 0x894d, 0x894e, 0x894f, 0x8950, 0x8951, 0x8952, 0x8953, 0x8954, 0x8955, 0x8956, 0x8957, 0x8958, 0x8959, 0x895a, 0x895b, 0x895c, 0x895d, 0x8960, 0x8961, 0x8962, 0x8963, 0x8964, 0x8965, 0x8967, 0x8968, 0x8969, 0x896a, 0x896b, 0x896c, 0x896d, 0x896e, 0x896f, 0x8970, 0x8971, 0x8972, 0x8973, 0x8974, 0x8975, 0x8976, 0x8977, 0x8978, 0x8979, 0x897a, 0x897c, 0x897d, 0x897e, 0x8980, 0x8982, 0x8984, 0x8985, 0x8987, 0x8988, 0x8989, 0x898a, 0x898b, 0x898c, 0x898d, 0x898e, 0x898f, 0x8990, 0x8991, 0x8992, 0x8993, 0x8994, 0x8995, 0x8996, 0x8997, 0x8998, 0x8999, 0x899a, 0x899b, 0x899c, 0x899d, 0x899e, 0x899f, 0x89a0, 0x89a1, 0x6447, 0x5c27, 0x9065, 0x7a91, 0x8c23, 0x59da, 0x54ac, 0x8200, 0x836f, 0x8981, 0x8000, 0x6930, 0x564e, 0x8036, 0x7237, 0x91ce, 0x51b6, 0x4e5f, 0x9875, 0x6396, 0x4e1a, 0x53f6, 0x66f3, 0x814b, 0x591c, 0x6db2, 0x4e00, 0x58f9, 0x533b, 0x63d6, 0x94f1, 0x4f9d, 0x4f0a, 0x8863, 0x9890, 0x5937, 0x9057, 0x79fb, 0x4eea, 0x80f0, 0x7591, 0x6c82, 0x5b9c, 0x59e8, 0x5f5d, 0x6905, 0x8681, 0x501a, 0x5df2, 0x4e59, 0x77e3, 0x4ee5, 0x827a, 0x6291, 0x6613, 0x9091, 0x5c79, 0x4ebf, 0x5f79, 0x81c6, 0x9038, 0x8084, 0x75ab, 0x4ea6, 0x88d4, 0x610f, 0x6bc5, 0x5fc6, 0x4e49, 0x76ca, 0x6ea2, 0x8be3, 0x8bae, 0x8c0a, 0x8bd1, 0x5f02, 0x7ffc, 0x7fcc, 0x7ece, 0x8335, 0x836b, 0x56e0, 0x6bb7, 0x97f3, 0x9634, 0x59fb, 0x541f, 0x94f6, 0x6deb, 0x5bc5, 0x996e, 0x5c39, 0x5f15, 0x9690, /* 0xd3 */ 0x89a2, 0x89a3, 0x89a4, 0x89a5, 0x89a6, 0x89a7, 0x89a8, 0x89a9, 0x89aa, 0x89ab, 0x89ac, 0x89ad, 0x89ae, 0x89af, 0x89b0, 0x89b1, 0x89b2, 0x89b3, 0x89b4, 0x89b5, 0x89b6, 0x89b7, 0x89b8, 0x89b9, 0x89ba, 0x89bb, 0x89bc, 0x89bd, 0x89be, 0x89bf, 0x89c0, 0x89c3, 0x89cd, 0x89d3, 0x89d4, 0x89d5, 0x89d7, 0x89d8, 0x89d9, 0x89db, 0x89dd, 0x89df, 0x89e0, 0x89e1, 0x89e2, 0x89e4, 0x89e7, 0x89e8, 0x89e9, 0x89ea, 0x89ec, 0x89ed, 0x89ee, 0x89f0, 0x89f1, 0x89f2, 0x89f4, 0x89f5, 0x89f6, 0x89f7, 0x89f8, 0x89f9, 0x89fa, 0x89fb, 0x89fc, 0x89fd, 0x89fe, 0x89ff, 0x8a01, 0x8a02, 0x8a03, 0x8a04, 0x8a05, 0x8a06, 0x8a08, 0x8a09, 0x8a0a, 0x8a0b, 0x8a0c, 0x8a0d, 0x8a0e, 0x8a0f, 0x8a10, 0x8a11, 0x8a12, 0x8a13, 0x8a14, 0x8a15, 0x8a16, 0x8a17, 0x8a18, 0x8a19, 0x8a1a, 0x8a1b, 0x8a1c, 0x8a1d, 0x5370, 0x82f1, 0x6a31, 0x5a74, 0x9e70, 0x5e94, 0x7f28, 0x83b9, 0x8424, 0x8425, 0x8367, 0x8747, 0x8fce, 0x8d62, 0x76c8, 0x5f71, 0x9896, 0x786c, 0x6620, 0x54df, 0x62e5, 0x4f63, 0x81c3, 0x75c8, 0x5eb8, 0x96cd, 0x8e0a, 0x86f9, 0x548f, 0x6cf3, 0x6d8c, 0x6c38, 0x607f, 0x52c7, 0x7528, 0x5e7d, 0x4f18, 0x60a0, 0x5fe7, 0x5c24, 0x7531, 0x90ae, 0x94c0, 0x72b9, 0x6cb9, 0x6e38, 0x9149, 0x6709, 0x53cb, 0x53f3, 0x4f51, 0x91c9, 0x8bf1, 0x53c8, 0x5e7c, 0x8fc2, 0x6de4, 0x4e8e, 0x76c2, 0x6986, 0x865e, 0x611a, 0x8206, 0x4f59, 0x4fde, 0x903e, 0x9c7c, 0x6109, 0x6e1d, 0x6e14, 0x9685, 0x4e88, 0x5a31, 0x96e8, 0x4e0e, 0x5c7f, 0x79b9, 0x5b87, 0x8bed, 0x7fbd, 0x7389, 0x57df, 0x828b, 0x90c1, 0x5401, 0x9047, 0x55bb, 0x5cea, 0x5fa1, 0x6108, 0x6b32, 0x72f1, 0x80b2, 0x8a89, /* 0xd4 */ 0x8a1e, 0x8a1f, 0x8a20, 0x8a21, 0x8a22, 0x8a23, 0x8a24, 0x8a25, 0x8a26, 0x8a27, 0x8a28, 0x8a29, 0x8a2a, 0x8a2b, 0x8a2c, 0x8a2d, 0x8a2e, 0x8a2f, 0x8a30, 0x8a31, 0x8a32, 0x8a33, 0x8a34, 0x8a35, 0x8a36, 0x8a37, 0x8a38, 0x8a39, 0x8a3a, 0x8a3b, 0x8a3c, 0x8a3d, 0x8a3f, 0x8a40, 0x8a41, 0x8a42, 0x8a43, 0x8a44, 0x8a45, 0x8a46, 0x8a47, 0x8a49, 0x8a4a, 0x8a4b, 0x8a4c, 0x8a4d, 0x8a4e, 0x8a4f, 0x8a50, 0x8a51, 0x8a52, 0x8a53, 0x8a54, 0x8a55, 0x8a56, 0x8a57, 0x8a58, 0x8a59, 0x8a5a, 0x8a5b, 0x8a5c, 0x8a5d, 0x8a5e, 0x8a5f, 0x8a60, 0x8a61, 0x8a62, 0x8a63, 0x8a64, 0x8a65, 0x8a66, 0x8a67, 0x8a68, 0x8a69, 0x8a6a, 0x8a6b, 0x8a6c, 0x8a6d, 0x8a6e, 0x8a6f, 0x8a70, 0x8a71, 0x8a72, 0x8a73, 0x8a74, 0x8a75, 0x8a76, 0x8a77, 0x8a78, 0x8a7a, 0x8a7b, 0x8a7c, 0x8a7d, 0x8a7e, 0x8a7f, 0x8a80, 0x6d74, 0x5bd3, 0x88d5, 0x9884, 0x8c6b, 0x9a6d, 0x9e33, 0x6e0a, 0x51a4, 0x5143, 0x57a3, 0x8881, 0x539f, 0x63f4, 0x8f95, 0x56ed, 0x5458, 0x5706, 0x733f, 0x6e90, 0x7f18, 0x8fdc, 0x82d1, 0x613f, 0x6028, 0x9662, 0x66f0, 0x7ea6, 0x8d8a, 0x8dc3, 0x94a5, 0x5cb3, 0x7ca4, 0x6708, 0x60a6, 0x9605, 0x8018, 0x4e91, 0x90e7, 0x5300, 0x9668, 0x5141, 0x8fd0, 0x8574, 0x915d, 0x6655, 0x97f5, 0x5b55, 0x531d, 0x7838, 0x6742, 0x683d, 0x54c9, 0x707e, 0x5bb0, 0x8f7d, 0x518d, 0x5728, 0x54b1, 0x6512, 0x6682, 0x8d5e, 0x8d43, 0x810f, 0x846c, 0x906d, 0x7cdf, 0x51ff, 0x85fb, 0x67a3, 0x65e9, 0x6fa1, 0x86a4, 0x8e81, 0x566a, 0x9020, 0x7682, 0x7076, 0x71e5, 0x8d23, 0x62e9, 0x5219, 0x6cfd, 0x8d3c, 0x600e, 0x589e, 0x618e, 0x66fe, 0x8d60, 0x624e, 0x55b3, 0x6e23, 0x672d, 0x8f67, /* 0xd5 */ 0x8a81, 0x8a82, 0x8a83, 0x8a84, 0x8a85, 0x8a86, 0x8a87, 0x8a88, 0x8a8b, 0x8a8c, 0x8a8d, 0x8a8e, 0x8a8f, 0x8a90, 0x8a91, 0x8a92, 0x8a94, 0x8a95, 0x8a96, 0x8a97, 0x8a98, 0x8a99, 0x8a9a, 0x8a9b, 0x8a9c, 0x8a9d, 0x8a9e, 0x8a9f, 0x8aa0, 0x8aa1, 0x8aa2, 0x8aa3, 0x8aa4, 0x8aa5, 0x8aa6, 0x8aa7, 0x8aa8, 0x8aa9, 0x8aaa, 0x8aab, 0x8aac, 0x8aad, 0x8aae, 0x8aaf, 0x8ab0, 0x8ab1, 0x8ab2, 0x8ab3, 0x8ab4, 0x8ab5, 0x8ab6, 0x8ab7, 0x8ab8, 0x8ab9, 0x8aba, 0x8abb, 0x8abc, 0x8abd, 0x8abe, 0x8abf, 0x8ac0, 0x8ac1, 0x8ac2, 0x8ac3, 0x8ac4, 0x8ac5, 0x8ac6, 0x8ac7, 0x8ac8, 0x8ac9, 0x8aca, 0x8acb, 0x8acc, 0x8acd, 0x8ace, 0x8acf, 0x8ad0, 0x8ad1, 0x8ad2, 0x8ad3, 0x8ad4, 0x8ad5, 0x8ad6, 0x8ad7, 0x8ad8, 0x8ad9, 0x8ada, 0x8adb, 0x8adc, 0x8add, 0x8ade, 0x8adf, 0x8ae0, 0x8ae1, 0x8ae2, 0x8ae3, 0x94e1, 0x95f8, 0x7728, 0x6805, 0x69a8, 0x548b, 0x4e4d, 0x70b8, 0x8bc8, 0x6458, 0x658b, 0x5b85, 0x7a84, 0x503a, 0x5be8, 0x77bb, 0x6be1, 0x8a79, 0x7c98, 0x6cbe, 0x76cf, 0x65a9, 0x8f97, 0x5d2d, 0x5c55, 0x8638, 0x6808, 0x5360, 0x6218, 0x7ad9, 0x6e5b, 0x7efd, 0x6a1f, 0x7ae0, 0x5f70, 0x6f33, 0x5f20, 0x638c, 0x6da8, 0x6756, 0x4e08, 0x5e10, 0x8d26, 0x4ed7, 0x80c0, 0x7634, 0x969c, 0x62db, 0x662d, 0x627e, 0x6cbc, 0x8d75, 0x7167, 0x7f69, 0x5146, 0x8087, 0x53ec, 0x906e, 0x6298, 0x54f2, 0x86f0, 0x8f99, 0x8005, 0x9517, 0x8517, 0x8fd9, 0x6d59, 0x73cd, 0x659f, 0x771f, 0x7504, 0x7827, 0x81fb, 0x8d1e, 0x9488, 0x4fa6, 0x6795, 0x75b9, 0x8bca, 0x9707, 0x632f, 0x9547, 0x9635, 0x84b8, 0x6323, 0x7741, 0x5f81, 0x72f0, 0x4e89, 0x6014, 0x6574, 0x62ef, 0x6b63, 0x653f, /* 0xd6 */ 0x8ae4, 0x8ae5, 0x8ae6, 0x8ae7, 0x8ae8, 0x8ae9, 0x8aea, 0x8aeb, 0x8aec, 0x8aed, 0x8aee, 0x8aef, 0x8af0, 0x8af1, 0x8af2, 0x8af3, 0x8af4, 0x8af5, 0x8af6, 0x8af7, 0x8af8, 0x8af9, 0x8afa, 0x8afb, 0x8afc, 0x8afd, 0x8afe, 0x8aff, 0x8b00, 0x8b01, 0x8b02, 0x8b03, 0x8b04, 0x8b05, 0x8b06, 0x8b08, 0x8b09, 0x8b0a, 0x8b0b, 0x8b0c, 0x8b0d, 0x8b0e, 0x8b0f, 0x8b10, 0x8b11, 0x8b12, 0x8b13, 0x8b14, 0x8b15, 0x8b16, 0x8b17, 0x8b18, 0x8b19, 0x8b1a, 0x8b1b, 0x8b1c, 0x8b1d, 0x8b1e, 0x8b1f, 0x8b20, 0x8b21, 0x8b22, 0x8b23, 0x8b24, 0x8b25, 0x8b27, 0x8b28, 0x8b29, 0x8b2a, 0x8b2b, 0x8b2c, 0x8b2d, 0x8b2e, 0x8b2f, 0x8b30, 0x8b31, 0x8b32, 0x8b33, 0x8b34, 0x8b35, 0x8b36, 0x8b37, 0x8b38, 0x8b39, 0x8b3a, 0x8b3b, 0x8b3c, 0x8b3d, 0x8b3e, 0x8b3f, 0x8b40, 0x8b41, 0x8b42, 0x8b43, 0x8b44, 0x8b45, 0x5e27, 0x75c7, 0x90d1, 0x8bc1, 0x829d, 0x679d, 0x652f, 0x5431, 0x8718, 0x77e5, 0x80a2, 0x8102, 0x6c41, 0x4e4b, 0x7ec7, 0x804c, 0x76f4, 0x690d, 0x6b96, 0x6267, 0x503c, 0x4f84, 0x5740, 0x6307, 0x6b62, 0x8dbe, 0x53ea, 0x65e8, 0x7eb8, 0x5fd7, 0x631a, 0x63b7, 0x81f3, 0x81f4, 0x7f6e, 0x5e1c, 0x5cd9, 0x5236, 0x667a, 0x79e9, 0x7a1a, 0x8d28, 0x7099, 0x75d4, 0x6ede, 0x6cbb, 0x7a92, 0x4e2d, 0x76c5, 0x5fe0, 0x949f, 0x8877, 0x7ec8, 0x79cd, 0x80bf, 0x91cd, 0x4ef2, 0x4f17, 0x821f, 0x5468, 0x5dde, 0x6d32, 0x8bcc, 0x7ca5, 0x8f74, 0x8098, 0x5e1a, 0x5492, 0x76b1, 0x5b99, 0x663c, 0x9aa4, 0x73e0, 0x682a, 0x86db, 0x6731, 0x732a, 0x8bf8, 0x8bdb, 0x9010, 0x7af9, 0x70db, 0x716e, 0x62c4, 0x77a9, 0x5631, 0x4e3b, 0x8457, 0x67f1, 0x52a9, 0x86c0, 0x8d2e, 0x94f8, 0x7b51, /* 0xd7 */ 0x8b46, 0x8b47, 0x8b48, 0x8b49, 0x8b4a, 0x8b4b, 0x8b4c, 0x8b4d, 0x8b4e, 0x8b4f, 0x8b50, 0x8b51, 0x8b52, 0x8b53, 0x8b54, 0x8b55, 0x8b56, 0x8b57, 0x8b58, 0x8b59, 0x8b5a, 0x8b5b, 0x8b5c, 0x8b5d, 0x8b5e, 0x8b5f, 0x8b60, 0x8b61, 0x8b62, 0x8b63, 0x8b64, 0x8b65, 0x8b67, 0x8b68, 0x8b69, 0x8b6a, 0x8b6b, 0x8b6d, 0x8b6e, 0x8b6f, 0x8b70, 0x8b71, 0x8b72, 0x8b73, 0x8b74, 0x8b75, 0x8b76, 0x8b77, 0x8b78, 0x8b79, 0x8b7a, 0x8b7b, 0x8b7c, 0x8b7d, 0x8b7e, 0x8b7f, 0x8b80, 0x8b81, 0x8b82, 0x8b83, 0x8b84, 0x8b85, 0x8b86, 0x8b87, 0x8b88, 0x8b89, 0x8b8a, 0x8b8b, 0x8b8c, 0x8b8d, 0x8b8e, 0x8b8f, 0x8b90, 0x8b91, 0x8b92, 0x8b93, 0x8b94, 0x8b95, 0x8b96, 0x8b97, 0x8b98, 0x8b99, 0x8b9a, 0x8b9b, 0x8b9c, 0x8b9d, 0x8b9e, 0x8b9f, 0x8bac, 0x8bb1, 0x8bbb, 0x8bc7, 0x8bd0, 0x8bea, 0x8c09, 0x8c1e, 0x4f4f, 0x6ce8, 0x795d, 0x9a7b, 0x6293, 0x722a, 0x62fd, 0x4e13, 0x7816, 0x8f6c, 0x64b0, 0x8d5a, 0x7bc6, 0x6869, 0x5e84, 0x88c5, 0x5986, 0x649e, 0x58ee, 0x72b6, 0x690e, 0x9525, 0x8ffd, 0x8d58, 0x5760, 0x7f00, 0x8c06, 0x51c6, 0x6349, 0x62d9, 0x5353, 0x684c, 0x7422, 0x8301, 0x914c, 0x5544, 0x7740, 0x707c, 0x6d4a, 0x5179, 0x54a8, 0x8d44, 0x59ff, 0x6ecb, 0x6dc4, 0x5b5c, 0x7d2b, 0x4ed4, 0x7c7d, 0x6ed3, 0x5b50, 0x81ea, 0x6e0d, 0x5b57, 0x9b03, 0x68d5, 0x8e2a, 0x5b97, 0x7efc, 0x603b, 0x7eb5, 0x90b9, 0x8d70, 0x594f, 0x63cd, 0x79df, 0x8db3, 0x5352, 0x65cf, 0x7956, 0x8bc5, 0x963b, 0x7ec4, 0x94bb, 0x7e82, 0x5634, 0x9189, 0x6700, 0x7f6a, 0x5c0a, 0x9075, 0x6628, 0x5de6, 0x4f50, 0x67de, 0x505a, 0x4f5c, 0x5750, 0x5ea7, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xd8 */ 0x8c38, 0x8c39, 0x8c3a, 0x8c3b, 0x8c3c, 0x8c3d, 0x8c3e, 0x8c3f, 0x8c40, 0x8c42, 0x8c43, 0x8c44, 0x8c45, 0x8c48, 0x8c4a, 0x8c4b, 0x8c4d, 0x8c4e, 0x8c4f, 0x8c50, 0x8c51, 0x8c52, 0x8c53, 0x8c54, 0x8c56, 0x8c57, 0x8c58, 0x8c59, 0x8c5b, 0x8c5c, 0x8c5d, 0x8c5e, 0x8c5f, 0x8c60, 0x8c63, 0x8c64, 0x8c65, 0x8c66, 0x8c67, 0x8c68, 0x8c69, 0x8c6c, 0x8c6d, 0x8c6e, 0x8c6f, 0x8c70, 0x8c71, 0x8c72, 0x8c74, 0x8c75, 0x8c76, 0x8c77, 0x8c7b, 0x8c7c, 0x8c7d, 0x8c7e, 0x8c7f, 0x8c80, 0x8c81, 0x8c83, 0x8c84, 0x8c86, 0x8c87, 0x8c88, 0x8c8b, 0x8c8d, 0x8c8e, 0x8c8f, 0x8c90, 0x8c91, 0x8c92, 0x8c93, 0x8c95, 0x8c96, 0x8c97, 0x8c99, 0x8c9a, 0x8c9b, 0x8c9c, 0x8c9d, 0x8c9e, 0x8c9f, 0x8ca0, 0x8ca1, 0x8ca2, 0x8ca3, 0x8ca4, 0x8ca5, 0x8ca6, 0x8ca7, 0x8ca8, 0x8ca9, 0x8caa, 0x8cab, 0x8cac, 0x8cad, 0x4e8d, 0x4e0c, 0x5140, 0x4e10, 0x5eff, 0x5345, 0x4e15, 0x4e98, 0x4e1e, 0x9b32, 0x5b6c, 0x5669, 0x4e28, 0x79ba, 0x4e3f, 0x5315, 0x4e47, 0x592d, 0x723b, 0x536e, 0x6c10, 0x56df, 0x80e4, 0x9997, 0x6bd3, 0x777e, 0x9f17, 0x4e36, 0x4e9f, 0x9f10, 0x4e5c, 0x4e69, 0x4e93, 0x8288, 0x5b5b, 0x556c, 0x560f, 0x4ec4, 0x538d, 0x539d, 0x53a3, 0x53a5, 0x53ae, 0x9765, 0x8d5d, 0x531a, 0x53f5, 0x5326, 0x532e, 0x533e, 0x8d5c, 0x5366, 0x5363, 0x5202, 0x5208, 0x520e, 0x522d, 0x5233, 0x523f, 0x5240, 0x524c, 0x525e, 0x5261, 0x525c, 0x84af, 0x527d, 0x5282, 0x5281, 0x5290, 0x5293, 0x5182, 0x7f54, 0x4ebb, 0x4ec3, 0x4ec9, 0x4ec2, 0x4ee8, 0x4ee1, 0x4eeb, 0x4ede, 0x4f1b, 0x4ef3, 0x4f22, 0x4f64, 0x4ef5, 0x4f25, 0x4f27, 0x4f09, 0x4f2b, 0x4f5e, 0x4f67, 0x6538, 0x4f5a, 0x4f5d, /* 0xd9 */ 0x8cae, 0x8caf, 0x8cb0, 0x8cb1, 0x8cb2, 0x8cb3, 0x8cb4, 0x8cb5, 0x8cb6, 0x8cb7, 0x8cb8, 0x8cb9, 0x8cba, 0x8cbb, 0x8cbc, 0x8cbd, 0x8cbe, 0x8cbf, 0x8cc0, 0x8cc1, 0x8cc2, 0x8cc3, 0x8cc4, 0x8cc5, 0x8cc6, 0x8cc7, 0x8cc8, 0x8cc9, 0x8cca, 0x8ccb, 0x8ccc, 0x8ccd, 0x8cce, 0x8ccf, 0x8cd0, 0x8cd1, 0x8cd2, 0x8cd3, 0x8cd4, 0x8cd5, 0x8cd6, 0x8cd7, 0x8cd8, 0x8cd9, 0x8cda, 0x8cdb, 0x8cdc, 0x8cdd, 0x8cde, 0x8cdf, 0x8ce0, 0x8ce1, 0x8ce2, 0x8ce3, 0x8ce4, 0x8ce5, 0x8ce6, 0x8ce7, 0x8ce8, 0x8ce9, 0x8cea, 0x8ceb, 0x8cec, 0x8ced, 0x8cee, 0x8cef, 0x8cf0, 0x8cf1, 0x8cf2, 0x8cf3, 0x8cf4, 0x8cf5, 0x8cf6, 0x8cf7, 0x8cf8, 0x8cf9, 0x8cfa, 0x8cfb, 0x8cfc, 0x8cfd, 0x8cfe, 0x8cff, 0x8d00, 0x8d01, 0x8d02, 0x8d03, 0x8d04, 0x8d05, 0x8d06, 0x8d07, 0x8d08, 0x8d09, 0x8d0a, 0x8d0b, 0x8d0c, 0x8d0d, 0x4f5f, 0x4f57, 0x4f32, 0x4f3d, 0x4f76, 0x4f74, 0x4f91, 0x4f89, 0x4f83, 0x4f8f, 0x4f7e, 0x4f7b, 0x4faa, 0x4f7c, 0x4fac, 0x4f94, 0x4fe6, 0x4fe8, 0x4fea, 0x4fc5, 0x4fda, 0x4fe3, 0x4fdc, 0x4fd1, 0x4fdf, 0x4ff8, 0x5029, 0x504c, 0x4ff3, 0x502c, 0x500f, 0x502e, 0x502d, 0x4ffe, 0x501c, 0x500c, 0x5025, 0x5028, 0x507e, 0x5043, 0x5055, 0x5048, 0x504e, 0x506c, 0x507b, 0x50a5, 0x50a7, 0x50a9, 0x50ba, 0x50d6, 0x5106, 0x50ed, 0x50ec, 0x50e6, 0x50ee, 0x5107, 0x510b, 0x4edd, 0x6c3d, 0x4f58, 0x4f65, 0x4fce, 0x9fa0, 0x6c46, 0x7c74, 0x516e, 0x5dfd, 0x9ec9, 0x9998, 0x5181, 0x5914, 0x52f9, 0x530d, 0x8a07, 0x5310, 0x51eb, 0x5919, 0x5155, 0x4ea0, 0x5156, 0x4eb3, 0x886e, 0x88a4, 0x4eb5, 0x8114, 0x88d2, 0x7980, 0x5b34, 0x8803, 0x7fb8, 0x51ab, 0x51b1, 0x51bd, 0x51bc, /* 0xda */ 0x8d0e, 0x8d0f, 0x8d10, 0x8d11, 0x8d12, 0x8d13, 0x8d14, 0x8d15, 0x8d16, 0x8d17, 0x8d18, 0x8d19, 0x8d1a, 0x8d1b, 0x8d1c, 0x8d20, 0x8d51, 0x8d52, 0x8d57, 0x8d5f, 0x8d65, 0x8d68, 0x8d69, 0x8d6a, 0x8d6c, 0x8d6e, 0x8d6f, 0x8d71, 0x8d72, 0x8d78, 0x8d79, 0x8d7a, 0x8d7b, 0x8d7c, 0x8d7d, 0x8d7e, 0x8d7f, 0x8d80, 0x8d82, 0x8d83, 0x8d86, 0x8d87, 0x8d88, 0x8d89, 0x8d8c, 0x8d8d, 0x8d8e, 0x8d8f, 0x8d90, 0x8d92, 0x8d93, 0x8d95, 0x8d96, 0x8d97, 0x8d98, 0x8d99, 0x8d9a, 0x8d9b, 0x8d9c, 0x8d9d, 0x8d9e, 0x8da0, 0x8da1, 0x8da2, 0x8da4, 0x8da5, 0x8da6, 0x8da7, 0x8da8, 0x8da9, 0x8daa, 0x8dab, 0x8dac, 0x8dad, 0x8dae, 0x8daf, 0x8db0, 0x8db2, 0x8db6, 0x8db7, 0x8db9, 0x8dbb, 0x8dbd, 0x8dc0, 0x8dc1, 0x8dc2, 0x8dc5, 0x8dc7, 0x8dc8, 0x8dc9, 0x8dca, 0x8dcd, 0x8dd0, 0x8dd2, 0x8dd3, 0x8dd4, 0x51c7, 0x5196, 0x51a2, 0x51a5, 0x8ba0, 0x8ba6, 0x8ba7, 0x8baa, 0x8bb4, 0x8bb5, 0x8bb7, 0x8bc2, 0x8bc3, 0x8bcb, 0x8bcf, 0x8bce, 0x8bd2, 0x8bd3, 0x8bd4, 0x8bd6, 0x8bd8, 0x8bd9, 0x8bdc, 0x8bdf, 0x8be0, 0x8be4, 0x8be8, 0x8be9, 0x8bee, 0x8bf0, 0x8bf3, 0x8bf6, 0x8bf9, 0x8bfc, 0x8bff, 0x8c00, 0x8c02, 0x8c04, 0x8c07, 0x8c0c, 0x8c0f, 0x8c11, 0x8c12, 0x8c14, 0x8c15, 0x8c16, 0x8c19, 0x8c1b, 0x8c18, 0x8c1d, 0x8c1f, 0x8c20, 0x8c21, 0x8c25, 0x8c27, 0x8c2a, 0x8c2b, 0x8c2e, 0x8c2f, 0x8c32, 0x8c33, 0x8c35, 0x8c36, 0x5369, 0x537a, 0x961d, 0x9622, 0x9621, 0x9631, 0x962a, 0x963d, 0x963c, 0x9642, 0x9649, 0x9654, 0x965f, 0x9667, 0x966c, 0x9672, 0x9674, 0x9688, 0x968d, 0x9697, 0x96b0, 0x9097, 0x909b, 0x909d, 0x9099, 0x90ac, 0x90a1, 0x90b4, 0x90b3, 0x90b6, 0x90ba, /* 0xdb */ 0x8dd5, 0x8dd8, 0x8dd9, 0x8ddc, 0x8de0, 0x8de1, 0x8de2, 0x8de5, 0x8de6, 0x8de7, 0x8de9, 0x8ded, 0x8dee, 0x8df0, 0x8df1, 0x8df2, 0x8df4, 0x8df6, 0x8dfc, 0x8dfe, 0x8dff, 0x8e00, 0x8e01, 0x8e02, 0x8e03, 0x8e04, 0x8e06, 0x8e07, 0x8e08, 0x8e0b, 0x8e0d, 0x8e0e, 0x8e10, 0x8e11, 0x8e12, 0x8e13, 0x8e15, 0x8e16, 0x8e17, 0x8e18, 0x8e19, 0x8e1a, 0x8e1b, 0x8e1c, 0x8e20, 0x8e21, 0x8e24, 0x8e25, 0x8e26, 0x8e27, 0x8e28, 0x8e2b, 0x8e2d, 0x8e30, 0x8e32, 0x8e33, 0x8e34, 0x8e36, 0x8e37, 0x8e38, 0x8e3b, 0x8e3c, 0x8e3e, 0x8e3f, 0x8e43, 0x8e45, 0x8e46, 0x8e4c, 0x8e4d, 0x8e4e, 0x8e4f, 0x8e50, 0x8e53, 0x8e54, 0x8e55, 0x8e56, 0x8e57, 0x8e58, 0x8e5a, 0x8e5b, 0x8e5c, 0x8e5d, 0x8e5e, 0x8e5f, 0x8e60, 0x8e61, 0x8e62, 0x8e63, 0x8e64, 0x8e65, 0x8e67, 0x8e68, 0x8e6a, 0x8e6b, 0x8e6e, 0x8e71, 0x90b8, 0x90b0, 0x90cf, 0x90c5, 0x90be, 0x90d0, 0x90c4, 0x90c7, 0x90d3, 0x90e6, 0x90e2, 0x90dc, 0x90d7, 0x90db, 0x90eb, 0x90ef, 0x90fe, 0x9104, 0x9122, 0x911e, 0x9123, 0x9131, 0x912f, 0x9139, 0x9143, 0x9146, 0x520d, 0x5942, 0x52a2, 0x52ac, 0x52ad, 0x52be, 0x54ff, 0x52d0, 0x52d6, 0x52f0, 0x53df, 0x71ee, 0x77cd, 0x5ef4, 0x51f5, 0x51fc, 0x9b2f, 0x53b6, 0x5f01, 0x755a, 0x5def, 0x574c, 0x57a9, 0x57a1, 0x587e, 0x58bc, 0x58c5, 0x58d1, 0x5729, 0x572c, 0x572a, 0x5733, 0x5739, 0x572e, 0x572f, 0x575c, 0x573b, 0x5742, 0x5769, 0x5785, 0x576b, 0x5786, 0x577c, 0x577b, 0x5768, 0x576d, 0x5776, 0x5773, 0x57ad, 0x57a4, 0x578c, 0x57b2, 0x57cf, 0x57a7, 0x57b4, 0x5793, 0x57a0, 0x57d5, 0x57d8, 0x57da, 0x57d9, 0x57d2, 0x57b8, 0x57f4, 0x57ef, 0x57f8, 0x57e4, 0x57dd, /* 0xdc */ 0x8e73, 0x8e75, 0x8e77, 0x8e78, 0x8e79, 0x8e7a, 0x8e7b, 0x8e7d, 0x8e7e, 0x8e80, 0x8e82, 0x8e83, 0x8e84, 0x8e86, 0x8e88, 0x8e89, 0x8e8a, 0x8e8b, 0x8e8c, 0x8e8d, 0x8e8e, 0x8e91, 0x8e92, 0x8e93, 0x8e95, 0x8e96, 0x8e97, 0x8e98, 0x8e99, 0x8e9a, 0x8e9b, 0x8e9d, 0x8e9f, 0x8ea0, 0x8ea1, 0x8ea2, 0x8ea3, 0x8ea4, 0x8ea5, 0x8ea6, 0x8ea7, 0x8ea8, 0x8ea9, 0x8eaa, 0x8ead, 0x8eae, 0x8eb0, 0x8eb1, 0x8eb3, 0x8eb4, 0x8eb5, 0x8eb6, 0x8eb7, 0x8eb8, 0x8eb9, 0x8ebb, 0x8ebc, 0x8ebd, 0x8ebe, 0x8ebf, 0x8ec0, 0x8ec1, 0x8ec2, 0x8ec3, 0x8ec4, 0x8ec5, 0x8ec6, 0x8ec7, 0x8ec8, 0x8ec9, 0x8eca, 0x8ecb, 0x8ecc, 0x8ecd, 0x8ecf, 0x8ed0, 0x8ed1, 0x8ed2, 0x8ed3, 0x8ed4, 0x8ed5, 0x8ed6, 0x8ed7, 0x8ed8, 0x8ed9, 0x8eda, 0x8edb, 0x8edc, 0x8edd, 0x8ede, 0x8edf, 0x8ee0, 0x8ee1, 0x8ee2, 0x8ee3, 0x8ee4, 0x580b, 0x580d, 0x57fd, 0x57ed, 0x5800, 0x581e, 0x5819, 0x5844, 0x5820, 0x5865, 0x586c, 0x5881, 0x5889, 0x589a, 0x5880, 0x99a8, 0x9f19, 0x61ff, 0x8279, 0x827d, 0x827f, 0x828f, 0x828a, 0x82a8, 0x8284, 0x828e, 0x8291, 0x8297, 0x8299, 0x82ab, 0x82b8, 0x82be, 0x82b0, 0x82c8, 0x82ca, 0x82e3, 0x8298, 0x82b7, 0x82ae, 0x82cb, 0x82cc, 0x82c1, 0x82a9, 0x82b4, 0x82a1, 0x82aa, 0x829f, 0x82c4, 0x82ce, 0x82a4, 0x82e1, 0x8309, 0x82f7, 0x82e4, 0x830f, 0x8307, 0x82dc, 0x82f4, 0x82d2, 0x82d8, 0x830c, 0x82fb, 0x82d3, 0x8311, 0x831a, 0x8306, 0x8314, 0x8315, 0x82e0, 0x82d5, 0x831c, 0x8351, 0x835b, 0x835c, 0x8308, 0x8392, 0x833c, 0x8334, 0x8331, 0x839b, 0x835e, 0x832f, 0x834f, 0x8347, 0x8343, 0x835f, 0x8340, 0x8317, 0x8360, 0x832d, 0x833a, 0x8333, 0x8366, 0x8365, /* 0xdd */ 0x8ee5, 0x8ee6, 0x8ee7, 0x8ee8, 0x8ee9, 0x8eea, 0x8eeb, 0x8eec, 0x8eed, 0x8eee, 0x8eef, 0x8ef0, 0x8ef1, 0x8ef2, 0x8ef3, 0x8ef4, 0x8ef5, 0x8ef6, 0x8ef7, 0x8ef8, 0x8ef9, 0x8efa, 0x8efb, 0x8efc, 0x8efd, 0x8efe, 0x8eff, 0x8f00, 0x8f01, 0x8f02, 0x8f03, 0x8f04, 0x8f05, 0x8f06, 0x8f07, 0x8f08, 0x8f09, 0x8f0a, 0x8f0b, 0x8f0c, 0x8f0d, 0x8f0e, 0x8f0f, 0x8f10, 0x8f11, 0x8f12, 0x8f13, 0x8f14, 0x8f15, 0x8f16, 0x8f17, 0x8f18, 0x8f19, 0x8f1a, 0x8f1b, 0x8f1c, 0x8f1d, 0x8f1e, 0x8f1f, 0x8f20, 0x8f21, 0x8f22, 0x8f23, 0x8f24, 0x8f25, 0x8f26, 0x8f27, 0x8f28, 0x8f29, 0x8f2a, 0x8f2b, 0x8f2c, 0x8f2d, 0x8f2e, 0x8f2f, 0x8f30, 0x8f31, 0x8f32, 0x8f33, 0x8f34, 0x8f35, 0x8f36, 0x8f37, 0x8f38, 0x8f39, 0x8f3a, 0x8f3b, 0x8f3c, 0x8f3d, 0x8f3e, 0x8f3f, 0x8f40, 0x8f41, 0x8f42, 0x8f43, 0x8f44, 0x8368, 0x831b, 0x8369, 0x836c, 0x836a, 0x836d, 0x836e, 0x83b0, 0x8378, 0x83b3, 0x83b4, 0x83a0, 0x83aa, 0x8393, 0x839c, 0x8385, 0x837c, 0x83b6, 0x83a9, 0x837d, 0x83b8, 0x837b, 0x8398, 0x839e, 0x83a8, 0x83ba, 0x83bc, 0x83c1, 0x8401, 0x83e5, 0x83d8, 0x5807, 0x8418, 0x840b, 0x83dd, 0x83fd, 0x83d6, 0x841c, 0x8438, 0x8411, 0x8406, 0x83d4, 0x83df, 0x840f, 0x8403, 0x83f8, 0x83f9, 0x83ea, 0x83c5, 0x83c0, 0x8426, 0x83f0, 0x83e1, 0x845c, 0x8451, 0x845a, 0x8459, 0x8473, 0x8487, 0x8488, 0x847a, 0x8489, 0x8478, 0x843c, 0x8446, 0x8469, 0x8476, 0x848c, 0x848e, 0x8431, 0x846d, 0x84c1, 0x84cd, 0x84d0, 0x84e6, 0x84bd, 0x84d3, 0x84ca, 0x84bf, 0x84ba, 0x84e0, 0x84a1, 0x84b9, 0x84b4, 0x8497, 0x84e5, 0x84e3, 0x850c, 0x750d, 0x8538, 0x84f0, 0x8539, 0x851f, 0x853a, /* 0xde */ 0x8f45, 0x8f46, 0x8f47, 0x8f48, 0x8f49, 0x8f4a, 0x8f4b, 0x8f4c, 0x8f4d, 0x8f4e, 0x8f4f, 0x8f50, 0x8f51, 0x8f52, 0x8f53, 0x8f54, 0x8f55, 0x8f56, 0x8f57, 0x8f58, 0x8f59, 0x8f5a, 0x8f5b, 0x8f5c, 0x8f5d, 0x8f5e, 0x8f5f, 0x8f60, 0x8f61, 0x8f62, 0x8f63, 0x8f64, 0x8f65, 0x8f6a, 0x8f80, 0x8f8c, 0x8f92, 0x8f9d, 0x8fa0, 0x8fa1, 0x8fa2, 0x8fa4, 0x8fa5, 0x8fa6, 0x8fa7, 0x8faa, 0x8fac, 0x8fad, 0x8fae, 0x8faf, 0x8fb2, 0x8fb3, 0x8fb4, 0x8fb5, 0x8fb7, 0x8fb8, 0x8fba, 0x8fbb, 0x8fbc, 0x8fbf, 0x8fc0, 0x8fc3, 0x8fc6, 0x8fc9, 0x8fca, 0x8fcb, 0x8fcc, 0x8fcd, 0x8fcf, 0x8fd2, 0x8fd6, 0x8fd7, 0x8fda, 0x8fe0, 0x8fe1, 0x8fe3, 0x8fe7, 0x8fec, 0x8fef, 0x8ff1, 0x8ff2, 0x8ff4, 0x8ff5, 0x8ff6, 0x8ffa, 0x8ffb, 0x8ffc, 0x8ffe, 0x8fff, 0x9007, 0x9008, 0x900c, 0x900e, 0x9013, 0x9015, 0x9018, 0x8556, 0x853b, 0x84ff, 0x84fc, 0x8559, 0x8548, 0x8568, 0x8564, 0x855e, 0x857a, 0x77a2, 0x8543, 0x8572, 0x857b, 0x85a4, 0x85a8, 0x8587, 0x858f, 0x8579, 0x85ae, 0x859c, 0x8585, 0x85b9, 0x85b7, 0x85b0, 0x85d3, 0x85c1, 0x85dc, 0x85ff, 0x8627, 0x8605, 0x8629, 0x8616, 0x863c, 0x5efe, 0x5f08, 0x593c, 0x5941, 0x8037, 0x5955, 0x595a, 0x5958, 0x530f, 0x5c22, 0x5c25, 0x5c2c, 0x5c34, 0x624c, 0x626a, 0x629f, 0x62bb, 0x62ca, 0x62da, 0x62d7, 0x62ee, 0x6322, 0x62f6, 0x6339, 0x634b, 0x6343, 0x63ad, 0x63f6, 0x6371, 0x637a, 0x638e, 0x63b4, 0x636d, 0x63ac, 0x638a, 0x6369, 0x63ae, 0x63bc, 0x63f2, 0x63f8, 0x63e0, 0x63ff, 0x63c4, 0x63de, 0x63ce, 0x6452, 0x63c6, 0x63be, 0x6445, 0x6441, 0x640b, 0x641b, 0x6420, 0x640c, 0x6426, 0x6421, 0x645e, 0x6484, 0x646d, 0x6496, /* 0xdf */ 0x9019, 0x901c, 0x9023, 0x9024, 0x9025, 0x9027, 0x9028, 0x9029, 0x902a, 0x902b, 0x902c, 0x9030, 0x9031, 0x9032, 0x9033, 0x9034, 0x9037, 0x9039, 0x903a, 0x903d, 0x903f, 0x9040, 0x9043, 0x9045, 0x9046, 0x9048, 0x9049, 0x904a, 0x904b, 0x904c, 0x904e, 0x9054, 0x9055, 0x9056, 0x9059, 0x905a, 0x905c, 0x905d, 0x905e, 0x905f, 0x9060, 0x9061, 0x9064, 0x9066, 0x9067, 0x9069, 0x906a, 0x906b, 0x906c, 0x906f, 0x9070, 0x9071, 0x9072, 0x9073, 0x9076, 0x9077, 0x9078, 0x9079, 0x907a, 0x907b, 0x907c, 0x907e, 0x9081, 0x9084, 0x9085, 0x9086, 0x9087, 0x9089, 0x908a, 0x908c, 0x908d, 0x908e, 0x908f, 0x9090, 0x9092, 0x9094, 0x9096, 0x9098, 0x909a, 0x909c, 0x909e, 0x909f, 0x90a0, 0x90a4, 0x90a5, 0x90a7, 0x90a8, 0x90a9, 0x90ab, 0x90ad, 0x90b2, 0x90b7, 0x90bc, 0x90bd, 0x90bf, 0x90c0, 0x647a, 0x64b7, 0x64b8, 0x6499, 0x64ba, 0x64c0, 0x64d0, 0x64d7, 0x64e4, 0x64e2, 0x6509, 0x6525, 0x652e, 0x5f0b, 0x5fd2, 0x7519, 0x5f11, 0x535f, 0x53f1, 0x53fd, 0x53e9, 0x53e8, 0x53fb, 0x5412, 0x5416, 0x5406, 0x544b, 0x5452, 0x5453, 0x5454, 0x5456, 0x5443, 0x5421, 0x5457, 0x5459, 0x5423, 0x5432, 0x5482, 0x5494, 0x5477, 0x5471, 0x5464, 0x549a, 0x549b, 0x5484, 0x5476, 0x5466, 0x549d, 0x54d0, 0x54ad, 0x54c2, 0x54b4, 0x54d2, 0x54a7, 0x54a6, 0x54d3, 0x54d4, 0x5472, 0x54a3, 0x54d5, 0x54bb, 0x54bf, 0x54cc, 0x54d9, 0x54da, 0x54dc, 0x54a9, 0x54aa, 0x54a4, 0x54dd, 0x54cf, 0x54de, 0x551b, 0x54e7, 0x5520, 0x54fd, 0x5514, 0x54f3, 0x5522, 0x5523, 0x550f, 0x5511, 0x5527, 0x552a, 0x5567, 0x558f, 0x55b5, 0x5549, 0x556d, 0x5541, 0x5555, 0x553f, 0x5550, 0x553c, /* 0xe0 */ 0x90c2, 0x90c3, 0x90c6, 0x90c8, 0x90c9, 0x90cb, 0x90cc, 0x90cd, 0x90d2, 0x90d4, 0x90d5, 0x90d6, 0x90d8, 0x90d9, 0x90da, 0x90de, 0x90df, 0x90e0, 0x90e3, 0x90e4, 0x90e5, 0x90e9, 0x90ea, 0x90ec, 0x90ee, 0x90f0, 0x90f1, 0x90f2, 0x90f3, 0x90f5, 0x90f6, 0x90f7, 0x90f9, 0x90fa, 0x90fb, 0x90fc, 0x90ff, 0x9100, 0x9101, 0x9103, 0x9105, 0x9106, 0x9107, 0x9108, 0x9109, 0x910a, 0x910b, 0x910c, 0x910d, 0x910e, 0x910f, 0x9110, 0x9111, 0x9112, 0x9113, 0x9114, 0x9115, 0x9116, 0x9117, 0x9118, 0x911a, 0x911b, 0x911c, 0x911d, 0x911f, 0x9120, 0x9121, 0x9124, 0x9125, 0x9126, 0x9127, 0x9128, 0x9129, 0x912a, 0x912b, 0x912c, 0x912d, 0x912e, 0x9130, 0x9132, 0x9133, 0x9134, 0x9135, 0x9136, 0x9137, 0x9138, 0x913a, 0x913b, 0x913c, 0x913d, 0x913e, 0x913f, 0x9140, 0x9141, 0x9142, 0x9144, 0x5537, 0x5556, 0x5575, 0x5576, 0x5577, 0x5533, 0x5530, 0x555c, 0x558b, 0x55d2, 0x5583, 0x55b1, 0x55b9, 0x5588, 0x5581, 0x559f, 0x557e, 0x55d6, 0x5591, 0x557b, 0x55df, 0x55bd, 0x55be, 0x5594, 0x5599, 0x55ea, 0x55f7, 0x55c9, 0x561f, 0x55d1, 0x55eb, 0x55ec, 0x55d4, 0x55e6, 0x55dd, 0x55c4, 0x55ef, 0x55e5, 0x55f2, 0x55f3, 0x55cc, 0x55cd, 0x55e8, 0x55f5, 0x55e4, 0x8f94, 0x561e, 0x5608, 0x560c, 0x5601, 0x5624, 0x5623, 0x55fe, 0x5600, 0x5627, 0x562d, 0x5658, 0x5639, 0x5657, 0x562c, 0x564d, 0x5662, 0x5659, 0x565c, 0x564c, 0x5654, 0x5686, 0x5664, 0x5671, 0x566b, 0x567b, 0x567c, 0x5685, 0x5693, 0x56af, 0x56d4, 0x56d7, 0x56dd, 0x56e1, 0x56f5, 0x56eb, 0x56f9, 0x56ff, 0x5704, 0x570a, 0x5709, 0x571c, 0x5e0f, 0x5e19, 0x5e14, 0x5e11, 0x5e31, 0x5e3b, 0x5e3c, /* 0xe1 */ 0x9145, 0x9147, 0x9148, 0x9151, 0x9153, 0x9154, 0x9155, 0x9156, 0x9158, 0x9159, 0x915b, 0x915c, 0x915f, 0x9160, 0x9166, 0x9167, 0x9168, 0x916b, 0x916d, 0x9173, 0x917a, 0x917b, 0x917c, 0x9180, 0x9181, 0x9182, 0x9183, 0x9184, 0x9186, 0x9188, 0x918a, 0x918e, 0x918f, 0x9193, 0x9194, 0x9195, 0x9196, 0x9197, 0x9198, 0x9199, 0x919c, 0x919d, 0x919e, 0x919f, 0x91a0, 0x91a1, 0x91a4, 0x91a5, 0x91a6, 0x91a7, 0x91a8, 0x91a9, 0x91ab, 0x91ac, 0x91b0, 0x91b1, 0x91b2, 0x91b3, 0x91b6, 0x91b7, 0x91b8, 0x91b9, 0x91bb, 0x91bc, 0x91bd, 0x91be, 0x91bf, 0x91c0, 0x91c1, 0x91c2, 0x91c3, 0x91c4, 0x91c5, 0x91c6, 0x91c8, 0x91cb, 0x91d0, 0x91d2, 0x91d3, 0x91d4, 0x91d5, 0x91d6, 0x91d7, 0x91d8, 0x91d9, 0x91da, 0x91db, 0x91dd, 0x91de, 0x91df, 0x91e0, 0x91e1, 0x91e2, 0x91e3, 0x91e4, 0x91e5, 0x5e37, 0x5e44, 0x5e54, 0x5e5b, 0x5e5e, 0x5e61, 0x5c8c, 0x5c7a, 0x5c8d, 0x5c90, 0x5c96, 0x5c88, 0x5c98, 0x5c99, 0x5c91, 0x5c9a, 0x5c9c, 0x5cb5, 0x5ca2, 0x5cbd, 0x5cac, 0x5cab, 0x5cb1, 0x5ca3, 0x5cc1, 0x5cb7, 0x5cc4, 0x5cd2, 0x5ce4, 0x5ccb, 0x5ce5, 0x5d02, 0x5d03, 0x5d27, 0x5d26, 0x5d2e, 0x5d24, 0x5d1e, 0x5d06, 0x5d1b, 0x5d58, 0x5d3e, 0x5d34, 0x5d3d, 0x5d6c, 0x5d5b, 0x5d6f, 0x5d5d, 0x5d6b, 0x5d4b, 0x5d4a, 0x5d69, 0x5d74, 0x5d82, 0x5d99, 0x5d9d, 0x8c73, 0x5db7, 0x5dc5, 0x5f73, 0x5f77, 0x5f82, 0x5f87, 0x5f89, 0x5f8c, 0x5f95, 0x5f99, 0x5f9c, 0x5fa8, 0x5fad, 0x5fb5, 0x5fbc, 0x8862, 0x5f61, 0x72ad, 0x72b0, 0x72b4, 0x72b7, 0x72b8, 0x72c3, 0x72c1, 0x72ce, 0x72cd, 0x72d2, 0x72e8, 0x72ef, 0x72e9, 0x72f2, 0x72f4, 0x72f7, 0x7301, 0x72f3, 0x7303, 0x72fa, /* 0xe2 */ 0x91e6, 0x91e7, 0x91e8, 0x91e9, 0x91ea, 0x91eb, 0x91ec, 0x91ed, 0x91ee, 0x91ef, 0x91f0, 0x91f1, 0x91f2, 0x91f3, 0x91f4, 0x91f5, 0x91f6, 0x91f7, 0x91f8, 0x91f9, 0x91fa, 0x91fb, 0x91fc, 0x91fd, 0x91fe, 0x91ff, 0x9200, 0x9201, 0x9202, 0x9203, 0x9204, 0x9205, 0x9206, 0x9207, 0x9208, 0x9209, 0x920a, 0x920b, 0x920c, 0x920d, 0x920e, 0x920f, 0x9210, 0x9211, 0x9212, 0x9213, 0x9214, 0x9215, 0x9216, 0x9217, 0x9218, 0x9219, 0x921a, 0x921b, 0x921c, 0x921d, 0x921e, 0x921f, 0x9220, 0x9221, 0x9222, 0x9223, 0x9224, 0x9225, 0x9226, 0x9227, 0x9228, 0x9229, 0x922a, 0x922b, 0x922c, 0x922d, 0x922e, 0x922f, 0x9230, 0x9231, 0x9232, 0x9233, 0x9234, 0x9235, 0x9236, 0x9237, 0x9238, 0x9239, 0x923a, 0x923b, 0x923c, 0x923d, 0x923e, 0x923f, 0x9240, 0x9241, 0x9242, 0x9243, 0x9244, 0x9245, 0x72fb, 0x7317, 0x7313, 0x7321, 0x730a, 0x731e, 0x731d, 0x7315, 0x7322, 0x7339, 0x7325, 0x732c, 0x7338, 0x7331, 0x7350, 0x734d, 0x7357, 0x7360, 0x736c, 0x736f, 0x737e, 0x821b, 0x5925, 0x98e7, 0x5924, 0x5902, 0x9963, 0x9967, 0x9968, 0x9969, 0x996a, 0x996b, 0x996c, 0x9974, 0x9977, 0x997d, 0x9980, 0x9984, 0x9987, 0x998a, 0x998d, 0x9990, 0x9991, 0x9993, 0x9994, 0x9995, 0x5e80, 0x5e91, 0x5e8b, 0x5e96, 0x5ea5, 0x5ea0, 0x5eb9, 0x5eb5, 0x5ebe, 0x5eb3, 0x8d53, 0x5ed2, 0x5ed1, 0x5edb, 0x5ee8, 0x5eea, 0x81ba, 0x5fc4, 0x5fc9, 0x5fd6, 0x5fcf, 0x6003, 0x5fee, 0x6004, 0x5fe1, 0x5fe4, 0x5ffe, 0x6005, 0x6006, 0x5fea, 0x5fed, 0x5ff8, 0x6019, 0x6035, 0x6026, 0x601b, 0x600f, 0x600d, 0x6029, 0x602b, 0x600a, 0x603f, 0x6021, 0x6078, 0x6079, 0x607b, 0x607a, 0x6042, /* 0xe3 */ 0x9246, 0x9247, 0x9248, 0x9249, 0x924a, 0x924b, 0x924c, 0x924d, 0x924e, 0x924f, 0x9250, 0x9251, 0x9252, 0x9253, 0x9254, 0x9255, 0x9256, 0x9257, 0x9258, 0x9259, 0x925a, 0x925b, 0x925c, 0x925d, 0x925e, 0x925f, 0x9260, 0x9261, 0x9262, 0x9263, 0x9264, 0x9265, 0x9266, 0x9267, 0x9268, 0x9269, 0x926a, 0x926b, 0x926c, 0x926d, 0x926e, 0x926f, 0x9270, 0x9271, 0x9272, 0x9273, 0x9275, 0x9276, 0x9277, 0x9278, 0x9279, 0x927a, 0x927b, 0x927c, 0x927d, 0x927e, 0x927f, 0x9280, 0x9281, 0x9282, 0x9283, 0x9284, 0x9285, 0x9286, 0x9287, 0x9288, 0x9289, 0x928a, 0x928b, 0x928c, 0x928d, 0x928f, 0x9290, 0x9291, 0x9292, 0x9293, 0x9294, 0x9295, 0x9296, 0x9297, 0x9298, 0x9299, 0x929a, 0x929b, 0x929c, 0x929d, 0x929e, 0x929f, 0x92a0, 0x92a1, 0x92a2, 0x92a3, 0x92a4, 0x92a5, 0x92a6, 0x92a7, 0x606a, 0x607d, 0x6096, 0x609a, 0x60ad, 0x609d, 0x6083, 0x6092, 0x608c, 0x609b, 0x60ec, 0x60bb, 0x60b1, 0x60dd, 0x60d8, 0x60c6, 0x60da, 0x60b4, 0x6120, 0x6126, 0x6115, 0x6123, 0x60f4, 0x6100, 0x610e, 0x612b, 0x614a, 0x6175, 0x61ac, 0x6194, 0x61a7, 0x61b7, 0x61d4, 0x61f5, 0x5fdd, 0x96b3, 0x95e9, 0x95eb, 0x95f1, 0x95f3, 0x95f5, 0x95f6, 0x95fc, 0x95fe, 0x9603, 0x9604, 0x9606, 0x9608, 0x960a, 0x960b, 0x960c, 0x960d, 0x960f, 0x9612, 0x9615, 0x9616, 0x9617, 0x9619, 0x961a, 0x4e2c, 0x723f, 0x6215, 0x6c35, 0x6c54, 0x6c5c, 0x6c4a, 0x6ca3, 0x6c85, 0x6c90, 0x6c94, 0x6c8c, 0x6c68, 0x6c69, 0x6c74, 0x6c76, 0x6c86, 0x6ca9, 0x6cd0, 0x6cd4, 0x6cad, 0x6cf7, 0x6cf8, 0x6cf1, 0x6cd7, 0x6cb2, 0x6ce0, 0x6cd6, 0x6cfa, 0x6ceb, 0x6cee, 0x6cb1, 0x6cd3, 0x6cef, 0x6cfe, /* 0xe4 */ 0x92a8, 0x92a9, 0x92aa, 0x92ab, 0x92ac, 0x92ad, 0x92af, 0x92b0, 0x92b1, 0x92b2, 0x92b3, 0x92b4, 0x92b5, 0x92b6, 0x92b7, 0x92b8, 0x92b9, 0x92ba, 0x92bb, 0x92bc, 0x92bd, 0x92be, 0x92bf, 0x92c0, 0x92c1, 0x92c2, 0x92c3, 0x92c4, 0x92c5, 0x92c6, 0x92c7, 0x92c9, 0x92ca, 0x92cb, 0x92cc, 0x92cd, 0x92ce, 0x92cf, 0x92d0, 0x92d1, 0x92d2, 0x92d3, 0x92d4, 0x92d5, 0x92d6, 0x92d7, 0x92d8, 0x92d9, 0x92da, 0x92db, 0x92dc, 0x92dd, 0x92de, 0x92df, 0x92e0, 0x92e1, 0x92e2, 0x92e3, 0x92e4, 0x92e5, 0x92e6, 0x92e7, 0x92e8, 0x92e9, 0x92ea, 0x92eb, 0x92ec, 0x92ed, 0x92ee, 0x92ef, 0x92f0, 0x92f1, 0x92f2, 0x92f3, 0x92f4, 0x92f5, 0x92f6, 0x92f7, 0x92f8, 0x92f9, 0x92fa, 0x92fb, 0x92fc, 0x92fd, 0x92fe, 0x92ff, 0x9300, 0x9301, 0x9302, 0x9303, 0x9304, 0x9305, 0x9306, 0x9307, 0x9308, 0x9309, 0x6d39, 0x6d27, 0x6d0c, 0x6d43, 0x6d48, 0x6d07, 0x6d04, 0x6d19, 0x6d0e, 0x6d2b, 0x6d4d, 0x6d2e, 0x6d35, 0x6d1a, 0x6d4f, 0x6d52, 0x6d54, 0x6d33, 0x6d91, 0x6d6f, 0x6d9e, 0x6da0, 0x6d5e, 0x6d93, 0x6d94, 0x6d5c, 0x6d60, 0x6d7c, 0x6d63, 0x6e1a, 0x6dc7, 0x6dc5, 0x6dde, 0x6e0e, 0x6dbf, 0x6de0, 0x6e11, 0x6de6, 0x6ddd, 0x6dd9, 0x6e16, 0x6dab, 0x6e0c, 0x6dae, 0x6e2b, 0x6e6e, 0x6e4e, 0x6e6b, 0x6eb2, 0x6e5f, 0x6e86, 0x6e53, 0x6e54, 0x6e32, 0x6e25, 0x6e44, 0x6edf, 0x6eb1, 0x6e98, 0x6ee0, 0x6f2d, 0x6ee2, 0x6ea5, 0x6ea7, 0x6ebd, 0x6ebb, 0x6eb7, 0x6ed7, 0x6eb4, 0x6ecf, 0x6e8f, 0x6ec2, 0x6e9f, 0x6f62, 0x6f46, 0x6f47, 0x6f24, 0x6f15, 0x6ef9, 0x6f2f, 0x6f36, 0x6f4b, 0x6f74, 0x6f2a, 0x6f09, 0x6f29, 0x6f89, 0x6f8d, 0x6f8c, 0x6f78, 0x6f72, 0x6f7c, 0x6f7a, 0x6fd1, /* 0xe5 */ 0x930a, 0x930b, 0x930c, 0x930d, 0x930e, 0x930f, 0x9310, 0x9311, 0x9312, 0x9313, 0x9314, 0x9315, 0x9316, 0x9317, 0x9318, 0x9319, 0x931a, 0x931b, 0x931c, 0x931d, 0x931e, 0x931f, 0x9320, 0x9321, 0x9322, 0x9323, 0x9324, 0x9325, 0x9326, 0x9327, 0x9328, 0x9329, 0x932a, 0x932b, 0x932c, 0x932d, 0x932e, 0x932f, 0x9330, 0x9331, 0x9332, 0x9333, 0x9334, 0x9335, 0x9336, 0x9337, 0x9338, 0x9339, 0x933a, 0x933b, 0x933c, 0x933d, 0x933f, 0x9340, 0x9341, 0x9342, 0x9343, 0x9344, 0x9345, 0x9346, 0x9347, 0x9348, 0x9349, 0x934a, 0x934b, 0x934c, 0x934d, 0x934e, 0x934f, 0x9350, 0x9351, 0x9352, 0x9353, 0x9354, 0x9355, 0x9356, 0x9357, 0x9358, 0x9359, 0x935a, 0x935b, 0x935c, 0x935d, 0x935e, 0x935f, 0x9360, 0x9361, 0x9362, 0x9363, 0x9364, 0x9365, 0x9366, 0x9367, 0x9368, 0x9369, 0x936b, 0x6fc9, 0x6fa7, 0x6fb9, 0x6fb6, 0x6fc2, 0x6fe1, 0x6fee, 0x6fde, 0x6fe0, 0x6fef, 0x701a, 0x7023, 0x701b, 0x7039, 0x7035, 0x704f, 0x705e, 0x5b80, 0x5b84, 0x5b95, 0x5b93, 0x5ba5, 0x5bb8, 0x752f, 0x9a9e, 0x6434, 0x5be4, 0x5bee, 0x8930, 0x5bf0, 0x8e47, 0x8b07, 0x8fb6, 0x8fd3, 0x8fd5, 0x8fe5, 0x8fee, 0x8fe4, 0x8fe9, 0x8fe6, 0x8ff3, 0x8fe8, 0x9005, 0x9004, 0x900b, 0x9026, 0x9011, 0x900d, 0x9016, 0x9021, 0x9035, 0x9036, 0x902d, 0x902f, 0x9044, 0x9051, 0x9052, 0x9050, 0x9068, 0x9058, 0x9062, 0x905b, 0x66b9, 0x9074, 0x907d, 0x9082, 0x9088, 0x9083, 0x908b, 0x5f50, 0x5f57, 0x5f56, 0x5f58, 0x5c3b, 0x54ab, 0x5c50, 0x5c59, 0x5b71, 0x5c63, 0x5c66, 0x7fbc, 0x5f2a, 0x5f29, 0x5f2d, 0x8274, 0x5f3c, 0x9b3b, 0x5c6e, 0x5981, 0x5983, 0x598d, 0x59a9, 0x59aa, 0x59a3, /* 0xe6 */ 0x936c, 0x936d, 0x936e, 0x936f, 0x9370, 0x9371, 0x9372, 0x9373, 0x9374, 0x9375, 0x9376, 0x9377, 0x9378, 0x9379, 0x937a, 0x937b, 0x937c, 0x937d, 0x937e, 0x937f, 0x9380, 0x9381, 0x9382, 0x9383, 0x9384, 0x9385, 0x9386, 0x9387, 0x9388, 0x9389, 0x938a, 0x938b, 0x938c, 0x938d, 0x938e, 0x9390, 0x9391, 0x9392, 0x9393, 0x9394, 0x9395, 0x9396, 0x9397, 0x9398, 0x9399, 0x939a, 0x939b, 0x939c, 0x939d, 0x939e, 0x939f, 0x93a0, 0x93a1, 0x93a2, 0x93a3, 0x93a4, 0x93a5, 0x93a6, 0x93a7, 0x93a8, 0x93a9, 0x93aa, 0x93ab, 0x93ac, 0x93ad, 0x93ae, 0x93af, 0x93b0, 0x93b1, 0x93b2, 0x93b3, 0x93b4, 0x93b5, 0x93b6, 0x93b7, 0x93b8, 0x93b9, 0x93ba, 0x93bb, 0x93bc, 0x93bd, 0x93be, 0x93bf, 0x93c0, 0x93c1, 0x93c2, 0x93c3, 0x93c4, 0x93c5, 0x93c6, 0x93c7, 0x93c8, 0x93c9, 0x93cb, 0x93cc, 0x93cd, 0x5997, 0x59ca, 0x59ab, 0x599e, 0x59a4, 0x59d2, 0x59b2, 0x59af, 0x59d7, 0x59be, 0x5a05, 0x5a06, 0x59dd, 0x5a08, 0x59e3, 0x59d8, 0x59f9, 0x5a0c, 0x5a09, 0x5a32, 0x5a34, 0x5a11, 0x5a23, 0x5a13, 0x5a40, 0x5a67, 0x5a4a, 0x5a55, 0x5a3c, 0x5a62, 0x5a75, 0x80ec, 0x5aaa, 0x5a9b, 0x5a77, 0x5a7a, 0x5abe, 0x5aeb, 0x5ab2, 0x5ad2, 0x5ad4, 0x5ab8, 0x5ae0, 0x5ae3, 0x5af1, 0x5ad6, 0x5ae6, 0x5ad8, 0x5adc, 0x5b09, 0x5b17, 0x5b16, 0x5b32, 0x5b37, 0x5b40, 0x5c15, 0x5c1c, 0x5b5a, 0x5b65, 0x5b73, 0x5b51, 0x5b53, 0x5b62, 0x9a75, 0x9a77, 0x9a78, 0x9a7a, 0x9a7f, 0x9a7d, 0x9a80, 0x9a81, 0x9a85, 0x9a88, 0x9a8a, 0x9a90, 0x9a92, 0x9a93, 0x9a96, 0x9a98, 0x9a9b, 0x9a9c, 0x9a9d, 0x9a9f, 0x9aa0, 0x9aa2, 0x9aa3, 0x9aa5, 0x9aa7, 0x7e9f, 0x7ea1, 0x7ea3, 0x7ea5, 0x7ea8, 0x7ea9, /* 0xe7 */ 0x93ce, 0x93cf, 0x93d0, 0x93d1, 0x93d2, 0x93d3, 0x93d4, 0x93d5, 0x93d7, 0x93d8, 0x93d9, 0x93da, 0x93db, 0x93dc, 0x93dd, 0x93de, 0x93df, 0x93e0, 0x93e1, 0x93e2, 0x93e3, 0x93e4, 0x93e5, 0x93e6, 0x93e7, 0x93e8, 0x93e9, 0x93ea, 0x93eb, 0x93ec, 0x93ed, 0x93ee, 0x93ef, 0x93f0, 0x93f1, 0x93f2, 0x93f3, 0x93f4, 0x93f5, 0x93f6, 0x93f7, 0x93f8, 0x93f9, 0x93fa, 0x93fb, 0x93fc, 0x93fd, 0x93fe, 0x93ff, 0x9400, 0x9401, 0x9402, 0x9403, 0x9404, 0x9405, 0x9406, 0x9407, 0x9408, 0x9409, 0x940a, 0x940b, 0x940c, 0x940d, 0x940e, 0x940f, 0x9410, 0x9411, 0x9412, 0x9413, 0x9414, 0x9415, 0x9416, 0x9417, 0x9418, 0x9419, 0x941a, 0x941b, 0x941c, 0x941d, 0x941e, 0x941f, 0x9420, 0x9421, 0x9422, 0x9423, 0x9424, 0x9425, 0x9426, 0x9427, 0x9428, 0x9429, 0x942a, 0x942b, 0x942c, 0x942d, 0x942e, 0x7ead, 0x7eb0, 0x7ebe, 0x7ec0, 0x7ec1, 0x7ec2, 0x7ec9, 0x7ecb, 0x7ecc, 0x7ed0, 0x7ed4, 0x7ed7, 0x7edb, 0x7ee0, 0x7ee1, 0x7ee8, 0x7eeb, 0x7eee, 0x7eef, 0x7ef1, 0x7ef2, 0x7f0d, 0x7ef6, 0x7efa, 0x7efb, 0x7efe, 0x7f01, 0x7f02, 0x7f03, 0x7f07, 0x7f08, 0x7f0b, 0x7f0c, 0x7f0f, 0x7f11, 0x7f12, 0x7f17, 0x7f19, 0x7f1c, 0x7f1b, 0x7f1f, 0x7f21, 0x7f22, 0x7f23, 0x7f24, 0x7f25, 0x7f26, 0x7f27, 0x7f2a, 0x7f2b, 0x7f2c, 0x7f2d, 0x7f2f, 0x7f30, 0x7f31, 0x7f32, 0x7f33, 0x7f35, 0x5e7a, 0x757f, 0x5ddb, 0x753e, 0x9095, 0x738e, 0x7391, 0x73ae, 0x73a2, 0x739f, 0x73cf, 0x73c2, 0x73d1, 0x73b7, 0x73b3, 0x73c0, 0x73c9, 0x73c8, 0x73e5, 0x73d9, 0x987c, 0x740a, 0x73e9, 0x73e7, 0x73de, 0x73ba, 0x73f2, 0x740f, 0x742a, 0x745b, 0x7426, 0x7425, 0x7428, 0x7430, 0x742e, 0x742c, /* 0xe8 */ 0x942f, 0x9430, 0x9431, 0x9432, 0x9433, 0x9434, 0x9435, 0x9436, 0x9437, 0x9438, 0x9439, 0x943a, 0x943b, 0x943c, 0x943d, 0x943f, 0x9440, 0x9441, 0x9442, 0x9443, 0x9444, 0x9445, 0x9446, 0x9447, 0x9448, 0x9449, 0x944a, 0x944b, 0x944c, 0x944d, 0x944e, 0x944f, 0x9450, 0x9451, 0x9452, 0x9453, 0x9454, 0x9455, 0x9456, 0x9457, 0x9458, 0x9459, 0x945a, 0x945b, 0x945c, 0x945d, 0x945e, 0x945f, 0x9460, 0x9461, 0x9462, 0x9463, 0x9464, 0x9465, 0x9466, 0x9467, 0x9468, 0x9469, 0x946a, 0x946c, 0x946d, 0x946e, 0x946f, 0x9470, 0x9471, 0x9472, 0x9473, 0x9474, 0x9475, 0x9476, 0x9477, 0x9478, 0x9479, 0x947a, 0x947b, 0x947c, 0x947d, 0x947e, 0x947f, 0x9480, 0x9481, 0x9482, 0x9483, 0x9484, 0x9491, 0x9496, 0x9498, 0x94c7, 0x94cf, 0x94d3, 0x94d4, 0x94da, 0x94e6, 0x94fb, 0x951c, 0x9520, 0x741b, 0x741a, 0x7441, 0x745c, 0x7457, 0x7455, 0x7459, 0x7477, 0x746d, 0x747e, 0x749c, 0x748e, 0x7480, 0x7481, 0x7487, 0x748b, 0x749e, 0x74a8, 0x74a9, 0x7490, 0x74a7, 0x74d2, 0x74ba, 0x97ea, 0x97eb, 0x97ec, 0x674c, 0x6753, 0x675e, 0x6748, 0x6769, 0x67a5, 0x6787, 0x676a, 0x6773, 0x6798, 0x67a7, 0x6775, 0x67a8, 0x679e, 0x67ad, 0x678b, 0x6777, 0x677c, 0x67f0, 0x6809, 0x67d8, 0x680a, 0x67e9, 0x67b0, 0x680c, 0x67d9, 0x67b5, 0x67da, 0x67b3, 0x67dd, 0x6800, 0x67c3, 0x67b8, 0x67e2, 0x680e, 0x67c1, 0x67fd, 0x6832, 0x6833, 0x6860, 0x6861, 0x684e, 0x6862, 0x6844, 0x6864, 0x6883, 0x681d, 0x6855, 0x6866, 0x6841, 0x6867, 0x6840, 0x683e, 0x684a, 0x6849, 0x6829, 0x68b5, 0x688f, 0x6874, 0x6877, 0x6893, 0x686b, 0x68c2, 0x696e, 0x68fc, 0x691f, 0x6920, 0x68f9, /* 0xe9 */ 0x9527, 0x9533, 0x953d, 0x9543, 0x9548, 0x954b, 0x9555, 0x955a, 0x9560, 0x956e, 0x9574, 0x9575, 0x9577, 0x9578, 0x9579, 0x957a, 0x957b, 0x957c, 0x957d, 0x957e, 0x9580, 0x9581, 0x9582, 0x9583, 0x9584, 0x9585, 0x9586, 0x9587, 0x9588, 0x9589, 0x958a, 0x958b, 0x958c, 0x958d, 0x958e, 0x958f, 0x9590, 0x9591, 0x9592, 0x9593, 0x9594, 0x9595, 0x9596, 0x9597, 0x9598, 0x9599, 0x959a, 0x959b, 0x959c, 0x959d, 0x959e, 0x959f, 0x95a0, 0x95a1, 0x95a2, 0x95a3, 0x95a4, 0x95a5, 0x95a6, 0x95a7, 0x95a8, 0x95a9, 0x95aa, 0x95ab, 0x95ac, 0x95ad, 0x95ae, 0x95af, 0x95b0, 0x95b1, 0x95b2, 0x95b3, 0x95b4, 0x95b5, 0x95b6, 0x95b7, 0x95b8, 0x95b9, 0x95ba, 0x95bb, 0x95bc, 0x95bd, 0x95be, 0x95bf, 0x95c0, 0x95c1, 0x95c2, 0x95c3, 0x95c4, 0x95c5, 0x95c6, 0x95c7, 0x95c8, 0x95c9, 0x95ca, 0x95cb, 0x6924, 0x68f0, 0x690b, 0x6901, 0x6957, 0x68e3, 0x6910, 0x6971, 0x6939, 0x6960, 0x6942, 0x695d, 0x6984, 0x696b, 0x6980, 0x6998, 0x6978, 0x6934, 0x69cc, 0x6987, 0x6988, 0x69ce, 0x6989, 0x6966, 0x6963, 0x6979, 0x699b, 0x69a7, 0x69bb, 0x69ab, 0x69ad, 0x69d4, 0x69b1, 0x69c1, 0x69ca, 0x69df, 0x6995, 0x69e0, 0x698d, 0x69ff, 0x6a2f, 0x69ed, 0x6a17, 0x6a18, 0x6a65, 0x69f2, 0x6a44, 0x6a3e, 0x6aa0, 0x6a50, 0x6a5b, 0x6a35, 0x6a8e, 0x6a79, 0x6a3d, 0x6a28, 0x6a58, 0x6a7c, 0x6a91, 0x6a90, 0x6aa9, 0x6a97, 0x6aab, 0x7337, 0x7352, 0x6b81, 0x6b82, 0x6b87, 0x6b84, 0x6b92, 0x6b93, 0x6b8d, 0x6b9a, 0x6b9b, 0x6ba1, 0x6baa, 0x8f6b, 0x8f6d, 0x8f71, 0x8f72, 0x8f73, 0x8f75, 0x8f76, 0x8f78, 0x8f77, 0x8f79, 0x8f7a, 0x8f7c, 0x8f7e, 0x8f81, 0x8f82, 0x8f84, 0x8f87, 0x8f8b, /* 0xea */ 0x95cc, 0x95cd, 0x95ce, 0x95cf, 0x95d0, 0x95d1, 0x95d2, 0x95d3, 0x95d4, 0x95d5, 0x95d6, 0x95d7, 0x95d8, 0x95d9, 0x95da, 0x95db, 0x95dc, 0x95dd, 0x95de, 0x95df, 0x95e0, 0x95e1, 0x95e2, 0x95e3, 0x95e4, 0x95e5, 0x95e6, 0x95e7, 0x95ec, 0x95ff, 0x9607, 0x9613, 0x9618, 0x961b, 0x961e, 0x9620, 0x9623, 0x9624, 0x9625, 0x9626, 0x9627, 0x9628, 0x9629, 0x962b, 0x962c, 0x962d, 0x962f, 0x9630, 0x9637, 0x9638, 0x9639, 0x963a, 0x963e, 0x9641, 0x9643, 0x964a, 0x964e, 0x964f, 0x9651, 0x9652, 0x9653, 0x9656, 0x9657, 0x9658, 0x9659, 0x965a, 0x965c, 0x965d, 0x965e, 0x9660, 0x9663, 0x9665, 0x9666, 0x966b, 0x966d, 0x966e, 0x966f, 0x9670, 0x9671, 0x9673, 0x9678, 0x9679, 0x967a, 0x967b, 0x967c, 0x967d, 0x967e, 0x967f, 0x9680, 0x9681, 0x9682, 0x9683, 0x9684, 0x9687, 0x9689, 0x968a, 0x8f8d, 0x8f8e, 0x8f8f, 0x8f98, 0x8f9a, 0x8ece, 0x620b, 0x6217, 0x621b, 0x621f, 0x6222, 0x6221, 0x6225, 0x6224, 0x622c, 0x81e7, 0x74ef, 0x74f4, 0x74ff, 0x750f, 0x7511, 0x7513, 0x6534, 0x65ee, 0x65ef, 0x65f0, 0x660a, 0x6619, 0x6772, 0x6603, 0x6615, 0x6600, 0x7085, 0x66f7, 0x661d, 0x6634, 0x6631, 0x6636, 0x6635, 0x8006, 0x665f, 0x6654, 0x6641, 0x664f, 0x6656, 0x6661, 0x6657, 0x6677, 0x6684, 0x668c, 0x66a7, 0x669d, 0x66be, 0x66db, 0x66dc, 0x66e6, 0x66e9, 0x8d32, 0x8d33, 0x8d36, 0x8d3b, 0x8d3d, 0x8d40, 0x8d45, 0x8d46, 0x8d48, 0x8d49, 0x8d47, 0x8d4d, 0x8d55, 0x8d59, 0x89c7, 0x89ca, 0x89cb, 0x89cc, 0x89ce, 0x89cf, 0x89d0, 0x89d1, 0x726e, 0x729f, 0x725d, 0x7266, 0x726f, 0x727e, 0x727f, 0x7284, 0x728b, 0x728d, 0x728f, 0x7292, 0x6308, 0x6332, 0x63b0, /* 0xeb */ 0x968c, 0x968e, 0x9691, 0x9692, 0x9693, 0x9695, 0x9696, 0x969a, 0x969b, 0x969d, 0x969e, 0x969f, 0x96a0, 0x96a1, 0x96a2, 0x96a3, 0x96a4, 0x96a5, 0x96a6, 0x96a8, 0x96a9, 0x96aa, 0x96ab, 0x96ac, 0x96ad, 0x96ae, 0x96af, 0x96b1, 0x96b2, 0x96b4, 0x96b5, 0x96b7, 0x96b8, 0x96ba, 0x96bb, 0x96bf, 0x96c2, 0x96c3, 0x96c8, 0x96ca, 0x96cb, 0x96d0, 0x96d1, 0x96d3, 0x96d4, 0x96d6, 0x96d7, 0x96d8, 0x96d9, 0x96da, 0x96db, 0x96dc, 0x96dd, 0x96de, 0x96df, 0x96e1, 0x96e2, 0x96e3, 0x96e4, 0x96e5, 0x96e6, 0x96e7, 0x96eb, 0x96ec, 0x96ed, 0x96ee, 0x96f0, 0x96f1, 0x96f2, 0x96f4, 0x96f5, 0x96f8, 0x96fa, 0x96fb, 0x96fc, 0x96fd, 0x96ff, 0x9702, 0x9703, 0x9705, 0x970a, 0x970b, 0x970c, 0x9710, 0x9711, 0x9712, 0x9714, 0x9715, 0x9717, 0x9718, 0x9719, 0x971a, 0x971b, 0x971d, 0x971f, 0x9720, 0x643f, 0x64d8, 0x8004, 0x6bea, 0x6bf3, 0x6bfd, 0x6bf5, 0x6bf9, 0x6c05, 0x6c07, 0x6c06, 0x6c0d, 0x6c15, 0x6c18, 0x6c19, 0x6c1a, 0x6c21, 0x6c29, 0x6c24, 0x6c2a, 0x6c32, 0x6535, 0x6555, 0x656b, 0x724d, 0x7252, 0x7256, 0x7230, 0x8662, 0x5216, 0x809f, 0x809c, 0x8093, 0x80bc, 0x670a, 0x80bd, 0x80b1, 0x80ab, 0x80ad, 0x80b4, 0x80b7, 0x80e7, 0x80e8, 0x80e9, 0x80ea, 0x80db, 0x80c2, 0x80c4, 0x80d9, 0x80cd, 0x80d7, 0x6710, 0x80dd, 0x80eb, 0x80f1, 0x80f4, 0x80ed, 0x810d, 0x810e, 0x80f2, 0x80fc, 0x6715, 0x8112, 0x8c5a, 0x8136, 0x811e, 0x812c, 0x8118, 0x8132, 0x8148, 0x814c, 0x8153, 0x8174, 0x8159, 0x815a, 0x8171, 0x8160, 0x8169, 0x817c, 0x817d, 0x816d, 0x8167, 0x584d, 0x5ab5, 0x8188, 0x8182, 0x8191, 0x6ed5, 0x81a3, 0x81aa, 0x81cc, 0x6726, 0x81ca, 0x81bb, /* 0xec */ 0x9721, 0x9722, 0x9723, 0x9724, 0x9725, 0x9726, 0x9727, 0x9728, 0x9729, 0x972b, 0x972c, 0x972e, 0x972f, 0x9731, 0x9733, 0x9734, 0x9735, 0x9736, 0x9737, 0x973a, 0x973b, 0x973c, 0x973d, 0x973f, 0x9740, 0x9741, 0x9742, 0x9743, 0x9744, 0x9745, 0x9746, 0x9747, 0x9748, 0x9749, 0x974a, 0x974b, 0x974c, 0x974d, 0x974e, 0x974f, 0x9750, 0x9751, 0x9754, 0x9755, 0x9757, 0x9758, 0x975a, 0x975c, 0x975d, 0x975f, 0x9763, 0x9764, 0x9766, 0x9767, 0x9768, 0x976a, 0x976b, 0x976c, 0x976d, 0x976e, 0x976f, 0x9770, 0x9771, 0x9772, 0x9775, 0x9777, 0x9778, 0x9779, 0x977a, 0x977b, 0x977d, 0x977e, 0x977f, 0x9780, 0x9781, 0x9782, 0x9783, 0x9784, 0x9786, 0x9787, 0x9788, 0x9789, 0x978a, 0x978c, 0x978e, 0x978f, 0x9790, 0x9793, 0x9795, 0x9796, 0x9797, 0x9799, 0x979a, 0x979b, 0x979c, 0x979d, 0x81c1, 0x81a6, 0x6b24, 0x6b37, 0x6b39, 0x6b43, 0x6b46, 0x6b59, 0x98d1, 0x98d2, 0x98d3, 0x98d5, 0x98d9, 0x98da, 0x6bb3, 0x5f40, 0x6bc2, 0x89f3, 0x6590, 0x9f51, 0x6593, 0x65bc, 0x65c6, 0x65c4, 0x65c3, 0x65cc, 0x65ce, 0x65d2, 0x65d6, 0x7080, 0x709c, 0x7096, 0x709d, 0x70bb, 0x70c0, 0x70b7, 0x70ab, 0x70b1, 0x70e8, 0x70ca, 0x7110, 0x7113, 0x7116, 0x712f, 0x7131, 0x7173, 0x715c, 0x7168, 0x7145, 0x7172, 0x714a, 0x7178, 0x717a, 0x7198, 0x71b3, 0x71b5, 0x71a8, 0x71a0, 0x71e0, 0x71d4, 0x71e7, 0x71f9, 0x721d, 0x7228, 0x706c, 0x7118, 0x7166, 0x71b9, 0x623e, 0x623d, 0x6243, 0x6248, 0x6249, 0x793b, 0x7940, 0x7946, 0x7949, 0x795b, 0x795c, 0x7953, 0x795a, 0x7962, 0x7957, 0x7960, 0x796f, 0x7967, 0x797a, 0x7985, 0x798a, 0x799a, 0x79a7, 0x79b3, 0x5fd1, 0x5fd0, /* 0xed */ 0x979e, 0x979f, 0x97a1, 0x97a2, 0x97a4, 0x97a5, 0x97a6, 0x97a7, 0x97a8, 0x97a9, 0x97aa, 0x97ac, 0x97ae, 0x97b0, 0x97b1, 0x97b3, 0x97b5, 0x97b6, 0x97b7, 0x97b8, 0x97b9, 0x97ba, 0x97bb, 0x97bc, 0x97bd, 0x97be, 0x97bf, 0x97c0, 0x97c1, 0x97c2, 0x97c3, 0x97c4, 0x97c5, 0x97c6, 0x97c7, 0x97c8, 0x97c9, 0x97ca, 0x97cb, 0x97cc, 0x97cd, 0x97ce, 0x97cf, 0x97d0, 0x97d1, 0x97d2, 0x97d3, 0x97d4, 0x97d5, 0x97d6, 0x97d7, 0x97d8, 0x97d9, 0x97da, 0x97db, 0x97dc, 0x97dd, 0x97de, 0x97df, 0x97e0, 0x97e1, 0x97e2, 0x97e3, 0x97e4, 0x97e5, 0x97e8, 0x97ee, 0x97ef, 0x97f0, 0x97f1, 0x97f2, 0x97f4, 0x97f7, 0x97f8, 0x97f9, 0x97fa, 0x97fb, 0x97fc, 0x97fd, 0x97fe, 0x97ff, 0x9800, 0x9801, 0x9802, 0x9803, 0x9804, 0x9805, 0x9806, 0x9807, 0x9808, 0x9809, 0x980a, 0x980b, 0x980c, 0x980d, 0x980e, 0x603c, 0x605d, 0x605a, 0x6067, 0x6041, 0x6059, 0x6063, 0x60ab, 0x6106, 0x610d, 0x615d, 0x61a9, 0x619d, 0x61cb, 0x61d1, 0x6206, 0x8080, 0x807f, 0x6c93, 0x6cf6, 0x6dfc, 0x77f6, 0x77f8, 0x7800, 0x7809, 0x7817, 0x7818, 0x7811, 0x65ab, 0x782d, 0x781c, 0x781d, 0x7839, 0x783a, 0x783b, 0x781f, 0x783c, 0x7825, 0x782c, 0x7823, 0x7829, 0x784e, 0x786d, 0x7856, 0x7857, 0x7826, 0x7850, 0x7847, 0x784c, 0x786a, 0x789b, 0x7893, 0x789a, 0x7887, 0x789c, 0x78a1, 0x78a3, 0x78b2, 0x78b9, 0x78a5, 0x78d4, 0x78d9, 0x78c9, 0x78ec, 0x78f2, 0x7905, 0x78f4, 0x7913, 0x7924, 0x791e, 0x7934, 0x9f9b, 0x9ef9, 0x9efb, 0x9efc, 0x76f1, 0x7704, 0x770d, 0x76f9, 0x7707, 0x7708, 0x771a, 0x7722, 0x7719, 0x772d, 0x7726, 0x7735, 0x7738, 0x7750, 0x7751, 0x7747, 0x7743, 0x775a, 0x7768, /* 0xee */ 0x980f, 0x9810, 0x9811, 0x9812, 0x9813, 0x9814, 0x9815, 0x9816, 0x9817, 0x9818, 0x9819, 0x981a, 0x981b, 0x981c, 0x981d, 0x981e, 0x981f, 0x9820, 0x9821, 0x9822, 0x9823, 0x9824, 0x9825, 0x9826, 0x9827, 0x9828, 0x9829, 0x982a, 0x982b, 0x982c, 0x982d, 0x982e, 0x982f, 0x9830, 0x9831, 0x9832, 0x9833, 0x9834, 0x9835, 0x9836, 0x9837, 0x9838, 0x9839, 0x983a, 0x983b, 0x983c, 0x983d, 0x983e, 0x983f, 0x9840, 0x9841, 0x9842, 0x9843, 0x9844, 0x9845, 0x9846, 0x9847, 0x9848, 0x9849, 0x984a, 0x984b, 0x984c, 0x984d, 0x984e, 0x984f, 0x9850, 0x9851, 0x9852, 0x9853, 0x9854, 0x9855, 0x9856, 0x9857, 0x9858, 0x9859, 0x985a, 0x985b, 0x985c, 0x985d, 0x985e, 0x985f, 0x9860, 0x9861, 0x9862, 0x9863, 0x9864, 0x9865, 0x9866, 0x9867, 0x9868, 0x9869, 0x986a, 0x986b, 0x986c, 0x986d, 0x986e, 0x7762, 0x7765, 0x777f, 0x778d, 0x777d, 0x7780, 0x778c, 0x7791, 0x779f, 0x77a0, 0x77b0, 0x77b5, 0x77bd, 0x753a, 0x7540, 0x754e, 0x754b, 0x7548, 0x755b, 0x7572, 0x7579, 0x7583, 0x7f58, 0x7f61, 0x7f5f, 0x8a48, 0x7f68, 0x7f74, 0x7f71, 0x7f79, 0x7f81, 0x7f7e, 0x76cd, 0x76e5, 0x8832, 0x9485, 0x9486, 0x9487, 0x948b, 0x948a, 0x948c, 0x948d, 0x948f, 0x9490, 0x9494, 0x9497, 0x9495, 0x949a, 0x949b, 0x949c, 0x94a3, 0x94a4, 0x94ab, 0x94aa, 0x94ad, 0x94ac, 0x94af, 0x94b0, 0x94b2, 0x94b4, 0x94b6, 0x94b7, 0x94b8, 0x94b9, 0x94ba, 0x94bc, 0x94bd, 0x94bf, 0x94c4, 0x94c8, 0x94c9, 0x94ca, 0x94cb, 0x94cc, 0x94cd, 0x94ce, 0x94d0, 0x94d1, 0x94d2, 0x94d5, 0x94d6, 0x94d7, 0x94d9, 0x94d8, 0x94db, 0x94de, 0x94df, 0x94e0, 0x94e2, 0x94e4, 0x94e5, 0x94e7, 0x94e8, 0x94ea, /* 0xef */ 0x986f, 0x9870, 0x9871, 0x9872, 0x9873, 0x9874, 0x988b, 0x988e, 0x9892, 0x9895, 0x9899, 0x98a3, 0x98a8, 0x98a9, 0x98aa, 0x98ab, 0x98ac, 0x98ad, 0x98ae, 0x98af, 0x98b0, 0x98b1, 0x98b2, 0x98b3, 0x98b4, 0x98b5, 0x98b6, 0x98b7, 0x98b8, 0x98b9, 0x98ba, 0x98bb, 0x98bc, 0x98bd, 0x98be, 0x98bf, 0x98c0, 0x98c1, 0x98c2, 0x98c3, 0x98c4, 0x98c5, 0x98c6, 0x98c7, 0x98c8, 0x98c9, 0x98ca, 0x98cb, 0x98cc, 0x98cd, 0x98cf, 0x98d0, 0x98d4, 0x98d6, 0x98d7, 0x98db, 0x98dc, 0x98dd, 0x98e0, 0x98e1, 0x98e2, 0x98e3, 0x98e4, 0x98e5, 0x98e6, 0x98e9, 0x98ea, 0x98eb, 0x98ec, 0x98ed, 0x98ee, 0x98ef, 0x98f0, 0x98f1, 0x98f2, 0x98f3, 0x98f4, 0x98f5, 0x98f6, 0x98f7, 0x98f8, 0x98f9, 0x98fa, 0x98fb, 0x98fc, 0x98fd, 0x98fe, 0x98ff, 0x9900, 0x9901, 0x9902, 0x9903, 0x9904, 0x9905, 0x9906, 0x9907, 0x94e9, 0x94eb, 0x94ee, 0x94ef, 0x94f3, 0x94f4, 0x94f5, 0x94f7, 0x94f9, 0x94fc, 0x94fd, 0x94ff, 0x9503, 0x9502, 0x9506, 0x9507, 0x9509, 0x950a, 0x950d, 0x950e, 0x950f, 0x9512, 0x9513, 0x9514, 0x9515, 0x9516, 0x9518, 0x951b, 0x951d, 0x951e, 0x951f, 0x9522, 0x952a, 0x952b, 0x9529, 0x952c, 0x9531, 0x9532, 0x9534, 0x9536, 0x9537, 0x9538, 0x953c, 0x953e, 0x953f, 0x9542, 0x9535, 0x9544, 0x9545, 0x9546, 0x9549, 0x954c, 0x954e, 0x954f, 0x9552, 0x9553, 0x9554, 0x9556, 0x9557, 0x9558, 0x9559, 0x955b, 0x955e, 0x955f, 0x955d, 0x9561, 0x9562, 0x9564, 0x9565, 0x9566, 0x9567, 0x9568, 0x9569, 0x956a, 0x956b, 0x956c, 0x956f, 0x9571, 0x9572, 0x9573, 0x953a, 0x77e7, 0x77ec, 0x96c9, 0x79d5, 0x79ed, 0x79e3, 0x79eb, 0x7a06, 0x5d47, 0x7a03, 0x7a02, 0x7a1e, 0x7a14, /* 0xf0 */ 0x9908, 0x9909, 0x990a, 0x990b, 0x990c, 0x990e, 0x990f, 0x9911, 0x9912, 0x9913, 0x9914, 0x9915, 0x9916, 0x9917, 0x9918, 0x9919, 0x991a, 0x991b, 0x991c, 0x991d, 0x991e, 0x991f, 0x9920, 0x9921, 0x9922, 0x9923, 0x9924, 0x9925, 0x9926, 0x9927, 0x9928, 0x9929, 0x992a, 0x992b, 0x992c, 0x992d, 0x992f, 0x9930, 0x9931, 0x9932, 0x9933, 0x9934, 0x9935, 0x9936, 0x9937, 0x9938, 0x9939, 0x993a, 0x993b, 0x993c, 0x993d, 0x993e, 0x993f, 0x9940, 0x9941, 0x9942, 0x9943, 0x9944, 0x9945, 0x9946, 0x9947, 0x9948, 0x9949, 0x994a, 0x994b, 0x994c, 0x994d, 0x994e, 0x994f, 0x9950, 0x9951, 0x9952, 0x9953, 0x9956, 0x9957, 0x9958, 0x9959, 0x995a, 0x995b, 0x995c, 0x995d, 0x995e, 0x995f, 0x9960, 0x9961, 0x9962, 0x9964, 0x9966, 0x9973, 0x9978, 0x9979, 0x997b, 0x997e, 0x9982, 0x9983, 0x9989, 0x7a39, 0x7a37, 0x7a51, 0x9ecf, 0x99a5, 0x7a70, 0x7688, 0x768e, 0x7693, 0x7699, 0x76a4, 0x74de, 0x74e0, 0x752c, 0x9e20, 0x9e22, 0x9e28, 0x9e29, 0x9e2a, 0x9e2b, 0x9e2c, 0x9e32, 0x9e31, 0x9e36, 0x9e38, 0x9e37, 0x9e39, 0x9e3a, 0x9e3e, 0x9e41, 0x9e42, 0x9e44, 0x9e46, 0x9e47, 0x9e48, 0x9e49, 0x9e4b, 0x9e4c, 0x9e4e, 0x9e51, 0x9e55, 0x9e57, 0x9e5a, 0x9e5b, 0x9e5c, 0x9e5e, 0x9e63, 0x9e66, 0x9e67, 0x9e68, 0x9e69, 0x9e6a, 0x9e6b, 0x9e6c, 0x9e71, 0x9e6d, 0x9e73, 0x7592, 0x7594, 0x7596, 0x75a0, 0x759d, 0x75ac, 0x75a3, 0x75b3, 0x75b4, 0x75b8, 0x75c4, 0x75b1, 0x75b0, 0x75c3, 0x75c2, 0x75d6, 0x75cd, 0x75e3, 0x75e8, 0x75e6, 0x75e4, 0x75eb, 0x75e7, 0x7603, 0x75f1, 0x75fc, 0x75ff, 0x7610, 0x7600, 0x7605, 0x760c, 0x7617, 0x760a, 0x7625, 0x7618, 0x7615, 0x7619, /* 0xf1 */ 0x998c, 0x998e, 0x999a, 0x999b, 0x999c, 0x999d, 0x999e, 0x999f, 0x99a0, 0x99a1, 0x99a2, 0x99a3, 0x99a4, 0x99a6, 0x99a7, 0x99a9, 0x99aa, 0x99ab, 0x99ac, 0x99ad, 0x99ae, 0x99af, 0x99b0, 0x99b1, 0x99b2, 0x99b3, 0x99b4, 0x99b5, 0x99b6, 0x99b7, 0x99b8, 0x99b9, 0x99ba, 0x99bb, 0x99bc, 0x99bd, 0x99be, 0x99bf, 0x99c0, 0x99c1, 0x99c2, 0x99c3, 0x99c4, 0x99c5, 0x99c6, 0x99c7, 0x99c8, 0x99c9, 0x99ca, 0x99cb, 0x99cc, 0x99cd, 0x99ce, 0x99cf, 0x99d0, 0x99d1, 0x99d2, 0x99d3, 0x99d4, 0x99d5, 0x99d6, 0x99d7, 0x99d8, 0x99d9, 0x99da, 0x99db, 0x99dc, 0x99dd, 0x99de, 0x99df, 0x99e0, 0x99e1, 0x99e2, 0x99e3, 0x99e4, 0x99e5, 0x99e6, 0x99e7, 0x99e8, 0x99e9, 0x99ea, 0x99eb, 0x99ec, 0x99ed, 0x99ee, 0x99ef, 0x99f0, 0x99f1, 0x99f2, 0x99f3, 0x99f4, 0x99f5, 0x99f6, 0x99f7, 0x99f8, 0x99f9, 0x761b, 0x763c, 0x7622, 0x7620, 0x7640, 0x762d, 0x7630, 0x763f, 0x7635, 0x7643, 0x763e, 0x7633, 0x764d, 0x765e, 0x7654, 0x765c, 0x7656, 0x766b, 0x766f, 0x7fca, 0x7ae6, 0x7a78, 0x7a79, 0x7a80, 0x7a86, 0x7a88, 0x7a95, 0x7aa6, 0x7aa0, 0x7aac, 0x7aa8, 0x7aad, 0x7ab3, 0x8864, 0x8869, 0x8872, 0x887d, 0x887f, 0x8882, 0x88a2, 0x88c6, 0x88b7, 0x88bc, 0x88c9, 0x88e2, 0x88ce, 0x88e3, 0x88e5, 0x88f1, 0x891a, 0x88fc, 0x88e8, 0x88fe, 0x88f0, 0x8921, 0x8919, 0x8913, 0x891b, 0x890a, 0x8934, 0x892b, 0x8936, 0x8941, 0x8966, 0x897b, 0x758b, 0x80e5, 0x76b2, 0x76b4, 0x77dc, 0x8012, 0x8014, 0x8016, 0x801c, 0x8020, 0x8022, 0x8025, 0x8026, 0x8027, 0x8029, 0x8028, 0x8031, 0x800b, 0x8035, 0x8043, 0x8046, 0x804d, 0x8052, 0x8069, 0x8071, 0x8983, 0x9878, 0x9880, 0x9883, /* 0xf2 */ 0x99fa, 0x99fb, 0x99fc, 0x99fd, 0x99fe, 0x99ff, 0x9a00, 0x9a01, 0x9a02, 0x9a03, 0x9a04, 0x9a05, 0x9a06, 0x9a07, 0x9a08, 0x9a09, 0x9a0a, 0x9a0b, 0x9a0c, 0x9a0d, 0x9a0e, 0x9a0f, 0x9a10, 0x9a11, 0x9a12, 0x9a13, 0x9a14, 0x9a15, 0x9a16, 0x9a17, 0x9a18, 0x9a19, 0x9a1a, 0x9a1b, 0x9a1c, 0x9a1d, 0x9a1e, 0x9a1f, 0x9a20, 0x9a21, 0x9a22, 0x9a23, 0x9a24, 0x9a25, 0x9a26, 0x9a27, 0x9a28, 0x9a29, 0x9a2a, 0x9a2b, 0x9a2c, 0x9a2d, 0x9a2e, 0x9a2f, 0x9a30, 0x9a31, 0x9a32, 0x9a33, 0x9a34, 0x9a35, 0x9a36, 0x9a37, 0x9a38, 0x9a39, 0x9a3a, 0x9a3b, 0x9a3c, 0x9a3d, 0x9a3e, 0x9a3f, 0x9a40, 0x9a41, 0x9a42, 0x9a43, 0x9a44, 0x9a45, 0x9a46, 0x9a47, 0x9a48, 0x9a49, 0x9a4a, 0x9a4b, 0x9a4c, 0x9a4d, 0x9a4e, 0x9a4f, 0x9a50, 0x9a51, 0x9a52, 0x9a53, 0x9a54, 0x9a55, 0x9a56, 0x9a57, 0x9a58, 0x9a59, 0x9889, 0x988c, 0x988d, 0x988f, 0x9894, 0x989a, 0x989b, 0x989e, 0x989f, 0x98a1, 0x98a2, 0x98a5, 0x98a6, 0x864d, 0x8654, 0x866c, 0x866e, 0x867f, 0x867a, 0x867c, 0x867b, 0x86a8, 0x868d, 0x868b, 0x86ac, 0x869d, 0x86a7, 0x86a3, 0x86aa, 0x8693, 0x86a9, 0x86b6, 0x86c4, 0x86b5, 0x86ce, 0x86b0, 0x86ba, 0x86b1, 0x86af, 0x86c9, 0x86cf, 0x86b4, 0x86e9, 0x86f1, 0x86f2, 0x86ed, 0x86f3, 0x86d0, 0x8713, 0x86de, 0x86f4, 0x86df, 0x86d8, 0x86d1, 0x8703, 0x8707, 0x86f8, 0x8708, 0x870a, 0x870d, 0x8709, 0x8723, 0x873b, 0x871e, 0x8725, 0x872e, 0x871a, 0x873e, 0x8748, 0x8734, 0x8731, 0x8729, 0x8737, 0x873f, 0x8782, 0x8722, 0x877d, 0x877e, 0x877b, 0x8760, 0x8770, 0x874c, 0x876e, 0x878b, 0x8753, 0x8763, 0x877c, 0x8764, 0x8759, 0x8765, 0x8793, 0x87af, 0x87a8, 0x87d2, /* 0xf3 */ 0x9a5a, 0x9a5b, 0x9a5c, 0x9a5d, 0x9a5e, 0x9a5f, 0x9a60, 0x9a61, 0x9a62, 0x9a63, 0x9a64, 0x9a65, 0x9a66, 0x9a67, 0x9a68, 0x9a69, 0x9a6a, 0x9a6b, 0x9a72, 0x9a83, 0x9a89, 0x9a8d, 0x9a8e, 0x9a94, 0x9a95, 0x9a99, 0x9aa6, 0x9aa9, 0x9aaa, 0x9aab, 0x9aac, 0x9aad, 0x9aae, 0x9aaf, 0x9ab2, 0x9ab3, 0x9ab4, 0x9ab5, 0x9ab9, 0x9abb, 0x9abd, 0x9abe, 0x9abf, 0x9ac3, 0x9ac4, 0x9ac6, 0x9ac7, 0x9ac8, 0x9ac9, 0x9aca, 0x9acd, 0x9ace, 0x9acf, 0x9ad0, 0x9ad2, 0x9ad4, 0x9ad5, 0x9ad6, 0x9ad7, 0x9ad9, 0x9ada, 0x9adb, 0x9adc, 0x9add, 0x9ade, 0x9ae0, 0x9ae2, 0x9ae3, 0x9ae4, 0x9ae5, 0x9ae7, 0x9ae8, 0x9ae9, 0x9aea, 0x9aec, 0x9aee, 0x9af0, 0x9af1, 0x9af2, 0x9af3, 0x9af4, 0x9af5, 0x9af6, 0x9af7, 0x9af8, 0x9afa, 0x9afc, 0x9afd, 0x9afe, 0x9aff, 0x9b00, 0x9b01, 0x9b02, 0x9b04, 0x9b05, 0x9b06, 0x87c6, 0x8788, 0x8785, 0x87ad, 0x8797, 0x8783, 0x87ab, 0x87e5, 0x87ac, 0x87b5, 0x87b3, 0x87cb, 0x87d3, 0x87bd, 0x87d1, 0x87c0, 0x87ca, 0x87db, 0x87ea, 0x87e0, 0x87ee, 0x8816, 0x8813, 0x87fe, 0x880a, 0x881b, 0x8821, 0x8839, 0x883c, 0x7f36, 0x7f42, 0x7f44, 0x7f45, 0x8210, 0x7afa, 0x7afd, 0x7b08, 0x7b03, 0x7b04, 0x7b15, 0x7b0a, 0x7b2b, 0x7b0f, 0x7b47, 0x7b38, 0x7b2a, 0x7b19, 0x7b2e, 0x7b31, 0x7b20, 0x7b25, 0x7b24, 0x7b33, 0x7b3e, 0x7b1e, 0x7b58, 0x7b5a, 0x7b45, 0x7b75, 0x7b4c, 0x7b5d, 0x7b60, 0x7b6e, 0x7b7b, 0x7b62, 0x7b72, 0x7b71, 0x7b90, 0x7ba6, 0x7ba7, 0x7bb8, 0x7bac, 0x7b9d, 0x7ba8, 0x7b85, 0x7baa, 0x7b9c, 0x7ba2, 0x7bab, 0x7bb4, 0x7bd1, 0x7bc1, 0x7bcc, 0x7bdd, 0x7bda, 0x7be5, 0x7be6, 0x7bea, 0x7c0c, 0x7bfe, 0x7bfc, 0x7c0f, 0x7c16, 0x7c0b, /* 0xf4 */ 0x9b07, 0x9b09, 0x9b0a, 0x9b0b, 0x9b0c, 0x9b0d, 0x9b0e, 0x9b10, 0x9b11, 0x9b12, 0x9b14, 0x9b15, 0x9b16, 0x9b17, 0x9b18, 0x9b19, 0x9b1a, 0x9b1b, 0x9b1c, 0x9b1d, 0x9b1e, 0x9b20, 0x9b21, 0x9b22, 0x9b24, 0x9b25, 0x9b26, 0x9b27, 0x9b28, 0x9b29, 0x9b2a, 0x9b2b, 0x9b2c, 0x9b2d, 0x9b2e, 0x9b30, 0x9b31, 0x9b33, 0x9b34, 0x9b35, 0x9b36, 0x9b37, 0x9b38, 0x9b39, 0x9b3a, 0x9b3d, 0x9b3e, 0x9b3f, 0x9b40, 0x9b46, 0x9b4a, 0x9b4b, 0x9b4c, 0x9b4e, 0x9b50, 0x9b52, 0x9b53, 0x9b55, 0x9b56, 0x9b57, 0x9b58, 0x9b59, 0x9b5a, 0x9b5b, 0x9b5c, 0x9b5d, 0x9b5e, 0x9b5f, 0x9b60, 0x9b61, 0x9b62, 0x9b63, 0x9b64, 0x9b65, 0x9b66, 0x9b67, 0x9b68, 0x9b69, 0x9b6a, 0x9b6b, 0x9b6c, 0x9b6d, 0x9b6e, 0x9b6f, 0x9b70, 0x9b71, 0x9b72, 0x9b73, 0x9b74, 0x9b75, 0x9b76, 0x9b77, 0x9b78, 0x9b79, 0x9b7a, 0x9b7b, 0x7c1f, 0x7c2a, 0x7c26, 0x7c38, 0x7c41, 0x7c40, 0x81fe, 0x8201, 0x8202, 0x8204, 0x81ec, 0x8844, 0x8221, 0x8222, 0x8223, 0x822d, 0x822f, 0x8228, 0x822b, 0x8238, 0x823b, 0x8233, 0x8234, 0x823e, 0x8244, 0x8249, 0x824b, 0x824f, 0x825a, 0x825f, 0x8268, 0x887e, 0x8885, 0x8888, 0x88d8, 0x88df, 0x895e, 0x7f9d, 0x7f9f, 0x7fa7, 0x7faf, 0x7fb0, 0x7fb2, 0x7c7c, 0x6549, 0x7c91, 0x7c9d, 0x7c9c, 0x7c9e, 0x7ca2, 0x7cb2, 0x7cbc, 0x7cbd, 0x7cc1, 0x7cc7, 0x7ccc, 0x7ccd, 0x7cc8, 0x7cc5, 0x7cd7, 0x7ce8, 0x826e, 0x66a8, 0x7fbf, 0x7fce, 0x7fd5, 0x7fe5, 0x7fe1, 0x7fe6, 0x7fe9, 0x7fee, 0x7ff3, 0x7cf8, 0x7d77, 0x7da6, 0x7dae, 0x7e47, 0x7e9b, 0x9eb8, 0x9eb4, 0x8d73, 0x8d84, 0x8d94, 0x8d91, 0x8db1, 0x8d67, 0x8d6d, 0x8c47, 0x8c49, 0x914a, 0x9150, 0x914e, 0x914f, 0x9164, /* 0xf5 */ 0x9b7c, 0x9b7d, 0x9b7e, 0x9b7f, 0x9b80, 0x9b81, 0x9b82, 0x9b83, 0x9b84, 0x9b85, 0x9b86, 0x9b87, 0x9b88, 0x9b89, 0x9b8a, 0x9b8b, 0x9b8c, 0x9b8d, 0x9b8e, 0x9b8f, 0x9b90, 0x9b91, 0x9b92, 0x9b93, 0x9b94, 0x9b95, 0x9b96, 0x9b97, 0x9b98, 0x9b99, 0x9b9a, 0x9b9b, 0x9b9c, 0x9b9d, 0x9b9e, 0x9b9f, 0x9ba0, 0x9ba1, 0x9ba2, 0x9ba3, 0x9ba4, 0x9ba5, 0x9ba6, 0x9ba7, 0x9ba8, 0x9ba9, 0x9baa, 0x9bab, 0x9bac, 0x9bad, 0x9bae, 0x9baf, 0x9bb0, 0x9bb1, 0x9bb2, 0x9bb3, 0x9bb4, 0x9bb5, 0x9bb6, 0x9bb7, 0x9bb8, 0x9bb9, 0x9bba, 0x9bbb, 0x9bbc, 0x9bbd, 0x9bbe, 0x9bbf, 0x9bc0, 0x9bc1, 0x9bc2, 0x9bc3, 0x9bc4, 0x9bc5, 0x9bc6, 0x9bc7, 0x9bc8, 0x9bc9, 0x9bca, 0x9bcb, 0x9bcc, 0x9bcd, 0x9bce, 0x9bcf, 0x9bd0, 0x9bd1, 0x9bd2, 0x9bd3, 0x9bd4, 0x9bd5, 0x9bd6, 0x9bd7, 0x9bd8, 0x9bd9, 0x9bda, 0x9bdb, 0x9162, 0x9161, 0x9170, 0x9169, 0x916f, 0x917d, 0x917e, 0x9172, 0x9174, 0x9179, 0x918c, 0x9185, 0x9190, 0x918d, 0x9191, 0x91a2, 0x91a3, 0x91aa, 0x91ad, 0x91ae, 0x91af, 0x91b5, 0x91b4, 0x91ba, 0x8c55, 0x9e7e, 0x8db8, 0x8deb, 0x8e05, 0x8e59, 0x8e69, 0x8db5, 0x8dbf, 0x8dbc, 0x8dba, 0x8dc4, 0x8dd6, 0x8dd7, 0x8dda, 0x8dde, 0x8dce, 0x8dcf, 0x8ddb, 0x8dc6, 0x8dec, 0x8df7, 0x8df8, 0x8de3, 0x8df9, 0x8dfb, 0x8de4, 0x8e09, 0x8dfd, 0x8e14, 0x8e1d, 0x8e1f, 0x8e2c, 0x8e2e, 0x8e23, 0x8e2f, 0x8e3a, 0x8e40, 0x8e39, 0x8e35, 0x8e3d, 0x8e31, 0x8e49, 0x8e41, 0x8e42, 0x8e51, 0x8e52, 0x8e4a, 0x8e70, 0x8e76, 0x8e7c, 0x8e6f, 0x8e74, 0x8e85, 0x8e8f, 0x8e94, 0x8e90, 0x8e9c, 0x8e9e, 0x8c78, 0x8c82, 0x8c8a, 0x8c85, 0x8c98, 0x8c94, 0x659b, 0x89d6, 0x89de, 0x89da, 0x89dc, /* 0xf6 */ 0x9bdc, 0x9bdd, 0x9bde, 0x9bdf, 0x9be0, 0x9be1, 0x9be2, 0x9be3, 0x9be4, 0x9be5, 0x9be6, 0x9be7, 0x9be8, 0x9be9, 0x9bea, 0x9beb, 0x9bec, 0x9bed, 0x9bee, 0x9bef, 0x9bf0, 0x9bf1, 0x9bf2, 0x9bf3, 0x9bf4, 0x9bf5, 0x9bf6, 0x9bf7, 0x9bf8, 0x9bf9, 0x9bfa, 0x9bfb, 0x9bfc, 0x9bfd, 0x9bfe, 0x9bff, 0x9c00, 0x9c01, 0x9c02, 0x9c03, 0x9c04, 0x9c05, 0x9c06, 0x9c07, 0x9c08, 0x9c09, 0x9c0a, 0x9c0b, 0x9c0c, 0x9c0d, 0x9c0e, 0x9c0f, 0x9c10, 0x9c11, 0x9c12, 0x9c13, 0x9c14, 0x9c15, 0x9c16, 0x9c17, 0x9c18, 0x9c19, 0x9c1a, 0x9c1b, 0x9c1c, 0x9c1d, 0x9c1e, 0x9c1f, 0x9c20, 0x9c21, 0x9c22, 0x9c23, 0x9c24, 0x9c25, 0x9c26, 0x9c27, 0x9c28, 0x9c29, 0x9c2a, 0x9c2b, 0x9c2c, 0x9c2d, 0x9c2e, 0x9c2f, 0x9c30, 0x9c31, 0x9c32, 0x9c33, 0x9c34, 0x9c35, 0x9c36, 0x9c37, 0x9c38, 0x9c39, 0x9c3a, 0x9c3b, 0x89e5, 0x89eb, 0x89ef, 0x8a3e, 0x8b26, 0x9753, 0x96e9, 0x96f3, 0x96ef, 0x9706, 0x9701, 0x9708, 0x970f, 0x970e, 0x972a, 0x972d, 0x9730, 0x973e, 0x9f80, 0x9f83, 0x9f85, 0x9f86, 0x9f87, 0x9f88, 0x9f89, 0x9f8a, 0x9f8c, 0x9efe, 0x9f0b, 0x9f0d, 0x96b9, 0x96bc, 0x96bd, 0x96ce, 0x96d2, 0x77bf, 0x96e0, 0x928e, 0x92ae, 0x92c8, 0x933e, 0x936a, 0x93ca, 0x938f, 0x943e, 0x946b, 0x9c7f, 0x9c82, 0x9c85, 0x9c86, 0x9c87, 0x9c88, 0x7a23, 0x9c8b, 0x9c8e, 0x9c90, 0x9c91, 0x9c92, 0x9c94, 0x9c95, 0x9c9a, 0x9c9b, 0x9c9e, 0x9c9f, 0x9ca0, 0x9ca1, 0x9ca2, 0x9ca3, 0x9ca5, 0x9ca6, 0x9ca7, 0x9ca8, 0x9ca9, 0x9cab, 0x9cad, 0x9cae, 0x9cb0, 0x9cb1, 0x9cb2, 0x9cb3, 0x9cb4, 0x9cb5, 0x9cb6, 0x9cb7, 0x9cba, 0x9cbb, 0x9cbc, 0x9cbd, 0x9cc4, 0x9cc5, 0x9cc6, 0x9cc7, 0x9cca, 0x9ccb, /* 0xf7 */ 0x9c3c, 0x9c3d, 0x9c3e, 0x9c3f, 0x9c40, 0x9c41, 0x9c42, 0x9c43, 0x9c44, 0x9c45, 0x9c46, 0x9c47, 0x9c48, 0x9c49, 0x9c4a, 0x9c4b, 0x9c4c, 0x9c4d, 0x9c4e, 0x9c4f, 0x9c50, 0x9c51, 0x9c52, 0x9c53, 0x9c54, 0x9c55, 0x9c56, 0x9c57, 0x9c58, 0x9c59, 0x9c5a, 0x9c5b, 0x9c5c, 0x9c5d, 0x9c5e, 0x9c5f, 0x9c60, 0x9c61, 0x9c62, 0x9c63, 0x9c64, 0x9c65, 0x9c66, 0x9c67, 0x9c68, 0x9c69, 0x9c6a, 0x9c6b, 0x9c6c, 0x9c6d, 0x9c6e, 0x9c6f, 0x9c70, 0x9c71, 0x9c72, 0x9c73, 0x9c74, 0x9c75, 0x9c76, 0x9c77, 0x9c78, 0x9c79, 0x9c7a, 0x9c7b, 0x9c7d, 0x9c7e, 0x9c80, 0x9c83, 0x9c84, 0x9c89, 0x9c8a, 0x9c8c, 0x9c8f, 0x9c93, 0x9c96, 0x9c97, 0x9c98, 0x9c99, 0x9c9d, 0x9caa, 0x9cac, 0x9caf, 0x9cb9, 0x9cbe, 0x9cbf, 0x9cc0, 0x9cc1, 0x9cc2, 0x9cc8, 0x9cc9, 0x9cd1, 0x9cd2, 0x9cda, 0x9cdb, 0x9ce0, 0x9ce1, 0x9ccc, 0x9ccd, 0x9cce, 0x9ccf, 0x9cd0, 0x9cd3, 0x9cd4, 0x9cd5, 0x9cd7, 0x9cd8, 0x9cd9, 0x9cdc, 0x9cdd, 0x9cdf, 0x9ce2, 0x977c, 0x9785, 0x9791, 0x9792, 0x9794, 0x97af, 0x97ab, 0x97a3, 0x97b2, 0x97b4, 0x9ab1, 0x9ab0, 0x9ab7, 0x9e58, 0x9ab6, 0x9aba, 0x9abc, 0x9ac1, 0x9ac0, 0x9ac5, 0x9ac2, 0x9acb, 0x9acc, 0x9ad1, 0x9b45, 0x9b43, 0x9b47, 0x9b49, 0x9b48, 0x9b4d, 0x9b51, 0x98e8, 0x990d, 0x992e, 0x9955, 0x9954, 0x9adf, 0x9ae1, 0x9ae6, 0x9aef, 0x9aeb, 0x9afb, 0x9aed, 0x9af9, 0x9b08, 0x9b0f, 0x9b13, 0x9b1f, 0x9b23, 0x9ebd, 0x9ebe, 0x7e3b, 0x9e82, 0x9e87, 0x9e88, 0x9e8b, 0x9e92, 0x93d6, 0x9e9d, 0x9e9f, 0x9edb, 0x9edc, 0x9edd, 0x9ee0, 0x9edf, 0x9ee2, 0x9ee9, 0x9ee7, 0x9ee5, 0x9eea, 0x9eef, 0x9f22, 0x9f2c, 0x9f2f, 0x9f39, 0x9f37, 0x9f3d, 0x9f3e, 0x9f44, /* 0xf8 */ 0x9ce3, 0x9ce4, 0x9ce5, 0x9ce6, 0x9ce7, 0x9ce8, 0x9ce9, 0x9cea, 0x9ceb, 0x9cec, 0x9ced, 0x9cee, 0x9cef, 0x9cf0, 0x9cf1, 0x9cf2, 0x9cf3, 0x9cf4, 0x9cf5, 0x9cf6, 0x9cf7, 0x9cf8, 0x9cf9, 0x9cfa, 0x9cfb, 0x9cfc, 0x9cfd, 0x9cfe, 0x9cff, 0x9d00, 0x9d01, 0x9d02, 0x9d03, 0x9d04, 0x9d05, 0x9d06, 0x9d07, 0x9d08, 0x9d09, 0x9d0a, 0x9d0b, 0x9d0c, 0x9d0d, 0x9d0e, 0x9d0f, 0x9d10, 0x9d11, 0x9d12, 0x9d13, 0x9d14, 0x9d15, 0x9d16, 0x9d17, 0x9d18, 0x9d19, 0x9d1a, 0x9d1b, 0x9d1c, 0x9d1d, 0x9d1e, 0x9d1f, 0x9d20, 0x9d21, 0x9d22, 0x9d23, 0x9d24, 0x9d25, 0x9d26, 0x9d27, 0x9d28, 0x9d29, 0x9d2a, 0x9d2b, 0x9d2c, 0x9d2d, 0x9d2e, 0x9d2f, 0x9d30, 0x9d31, 0x9d32, 0x9d33, 0x9d34, 0x9d35, 0x9d36, 0x9d37, 0x9d38, 0x9d39, 0x9d3a, 0x9d3b, 0x9d3c, 0x9d3d, 0x9d3e, 0x9d3f, 0x9d40, 0x9d41, 0x9d42, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xf9 */ 0x9d43, 0x9d44, 0x9d45, 0x9d46, 0x9d47, 0x9d48, 0x9d49, 0x9d4a, 0x9d4b, 0x9d4c, 0x9d4d, 0x9d4e, 0x9d4f, 0x9d50, 0x9d51, 0x9d52, 0x9d53, 0x9d54, 0x9d55, 0x9d56, 0x9d57, 0x9d58, 0x9d59, 0x9d5a, 0x9d5b, 0x9d5c, 0x9d5d, 0x9d5e, 0x9d5f, 0x9d60, 0x9d61, 0x9d62, 0x9d63, 0x9d64, 0x9d65, 0x9d66, 0x9d67, 0x9d68, 0x9d69, 0x9d6a, 0x9d6b, 0x9d6c, 0x9d6d, 0x9d6e, 0x9d6f, 0x9d70, 0x9d71, 0x9d72, 0x9d73, 0x9d74, 0x9d75, 0x9d76, 0x9d77, 0x9d78, 0x9d79, 0x9d7a, 0x9d7b, 0x9d7c, 0x9d7d, 0x9d7e, 0x9d7f, 0x9d80, 0x9d81, 0x9d82, 0x9d83, 0x9d84, 0x9d85, 0x9d86, 0x9d87, 0x9d88, 0x9d89, 0x9d8a, 0x9d8b, 0x9d8c, 0x9d8d, 0x9d8e, 0x9d8f, 0x9d90, 0x9d91, 0x9d92, 0x9d93, 0x9d94, 0x9d95, 0x9d96, 0x9d97, 0x9d98, 0x9d99, 0x9d9a, 0x9d9b, 0x9d9c, 0x9d9d, 0x9d9e, 0x9d9f, 0x9da0, 0x9da1, 0x9da2, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xfa */ 0x9da3, 0x9da4, 0x9da5, 0x9da6, 0x9da7, 0x9da8, 0x9da9, 0x9daa, 0x9dab, 0x9dac, 0x9dad, 0x9dae, 0x9daf, 0x9db0, 0x9db1, 0x9db2, 0x9db3, 0x9db4, 0x9db5, 0x9db6, 0x9db7, 0x9db8, 0x9db9, 0x9dba, 0x9dbb, 0x9dbc, 0x9dbd, 0x9dbe, 0x9dbf, 0x9dc0, 0x9dc1, 0x9dc2, 0x9dc3, 0x9dc4, 0x9dc5, 0x9dc6, 0x9dc7, 0x9dc8, 0x9dc9, 0x9dca, 0x9dcb, 0x9dcc, 0x9dcd, 0x9dce, 0x9dcf, 0x9dd0, 0x9dd1, 0x9dd2, 0x9dd3, 0x9dd4, 0x9dd5, 0x9dd6, 0x9dd7, 0x9dd8, 0x9dd9, 0x9dda, 0x9ddb, 0x9ddc, 0x9ddd, 0x9dde, 0x9ddf, 0x9de0, 0x9de1, 0x9de2, 0x9de3, 0x9de4, 0x9de5, 0x9de6, 0x9de7, 0x9de8, 0x9de9, 0x9dea, 0x9deb, 0x9dec, 0x9ded, 0x9dee, 0x9def, 0x9df0, 0x9df1, 0x9df2, 0x9df3, 0x9df4, 0x9df5, 0x9df6, 0x9df7, 0x9df8, 0x9df9, 0x9dfa, 0x9dfb, 0x9dfc, 0x9dfd, 0x9dfe, 0x9dff, 0x9e00, 0x9e01, 0x9e02, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xfb */ 0x9e03, 0x9e04, 0x9e05, 0x9e06, 0x9e07, 0x9e08, 0x9e09, 0x9e0a, 0x9e0b, 0x9e0c, 0x9e0d, 0x9e0e, 0x9e0f, 0x9e10, 0x9e11, 0x9e12, 0x9e13, 0x9e14, 0x9e15, 0x9e16, 0x9e17, 0x9e18, 0x9e19, 0x9e1a, 0x9e1b, 0x9e1c, 0x9e1d, 0x9e1e, 0x9e24, 0x9e27, 0x9e2e, 0x9e30, 0x9e34, 0x9e3b, 0x9e3c, 0x9e40, 0x9e4d, 0x9e50, 0x9e52, 0x9e53, 0x9e54, 0x9e56, 0x9e59, 0x9e5d, 0x9e5f, 0x9e60, 0x9e61, 0x9e62, 0x9e65, 0x9e6e, 0x9e6f, 0x9e72, 0x9e74, 0x9e75, 0x9e76, 0x9e77, 0x9e78, 0x9e79, 0x9e7a, 0x9e7b, 0x9e7c, 0x9e7d, 0x9e80, 0x9e81, 0x9e83, 0x9e84, 0x9e85, 0x9e86, 0x9e89, 0x9e8a, 0x9e8c, 0x9e8d, 0x9e8e, 0x9e8f, 0x9e90, 0x9e91, 0x9e94, 0x9e95, 0x9e96, 0x9e97, 0x9e98, 0x9e99, 0x9e9a, 0x9e9b, 0x9e9c, 0x9e9e, 0x9ea0, 0x9ea1, 0x9ea2, 0x9ea3, 0x9ea4, 0x9ea5, 0x9ea7, 0x9ea8, 0x9ea9, 0x9eaa, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xfc */ 0x9eab, 0x9eac, 0x9ead, 0x9eae, 0x9eaf, 0x9eb0, 0x9eb1, 0x9eb2, 0x9eb3, 0x9eb5, 0x9eb6, 0x9eb7, 0x9eb9, 0x9eba, 0x9ebc, 0x9ebf, 0x9ec0, 0x9ec1, 0x9ec2, 0x9ec3, 0x9ec5, 0x9ec6, 0x9ec7, 0x9ec8, 0x9eca, 0x9ecb, 0x9ecc, 0x9ed0, 0x9ed2, 0x9ed3, 0x9ed5, 0x9ed6, 0x9ed7, 0x9ed9, 0x9eda, 0x9ede, 0x9ee1, 0x9ee3, 0x9ee4, 0x9ee6, 0x9ee8, 0x9eeb, 0x9eec, 0x9eed, 0x9eee, 0x9ef0, 0x9ef1, 0x9ef2, 0x9ef3, 0x9ef4, 0x9ef5, 0x9ef6, 0x9ef7, 0x9ef8, 0x9efa, 0x9efd, 0x9eff, 0x9f00, 0x9f01, 0x9f02, 0x9f03, 0x9f04, 0x9f05, 0x9f06, 0x9f07, 0x9f08, 0x9f09, 0x9f0a, 0x9f0c, 0x9f0f, 0x9f11, 0x9f12, 0x9f14, 0x9f15, 0x9f16, 0x9f18, 0x9f1a, 0x9f1b, 0x9f1c, 0x9f1d, 0x9f1e, 0x9f1f, 0x9f21, 0x9f23, 0x9f24, 0x9f25, 0x9f26, 0x9f27, 0x9f28, 0x9f29, 0x9f2a, 0x9f2b, 0x9f2d, 0x9f2e, 0x9f30, 0x9f31, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xfd */ 0x9f32, 0x9f33, 0x9f34, 0x9f35, 0x9f36, 0x9f38, 0x9f3a, 0x9f3c, 0x9f3f, 0x9f40, 0x9f41, 0x9f42, 0x9f43, 0x9f45, 0x9f46, 0x9f47, 0x9f48, 0x9f49, 0x9f4a, 0x9f4b, 0x9f4c, 0x9f4d, 0x9f4e, 0x9f4f, 0x9f52, 0x9f53, 0x9f54, 0x9f55, 0x9f56, 0x9f57, 0x9f58, 0x9f59, 0x9f5a, 0x9f5b, 0x9f5c, 0x9f5d, 0x9f5e, 0x9f5f, 0x9f60, 0x9f61, 0x9f62, 0x9f63, 0x9f64, 0x9f65, 0x9f66, 0x9f67, 0x9f68, 0x9f69, 0x9f6a, 0x9f6b, 0x9f6c, 0x9f6d, 0x9f6e, 0x9f6f, 0x9f70, 0x9f71, 0x9f72, 0x9f73, 0x9f74, 0x9f75, 0x9f76, 0x9f77, 0x9f78, 0x9f79, 0x9f7a, 0x9f7b, 0x9f7c, 0x9f7d, 0x9f7e, 0x9f81, 0x9f82, 0x9f8d, 0x9f8e, 0x9f8f, 0x9f90, 0x9f91, 0x9f92, 0x9f93, 0x9f94, 0x9f95, 0x9f96, 0x9f97, 0x9f98, 0x9f9c, 0x9f9d, 0x9f9e, 0x9fa1, 0x9fa2, 0x9fa3, 0x9fa4, 0x9fa5, 0xf92c, 0xf979, 0xf995, 0xf9e7, 0xf9f1, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xfe */ 0xfa0c, 0xfa0d, 0xfa0e, 0xfa0f, 0xfa11, 0xfa13, 0xfa14, 0xfa18, 0xfa1f, 0xfa20, 0xfa21, 0xfa23, 0xfa24, 0xfa27, 0xfa28, 0xfa29, }; static int gbk_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c1 = s[0]; if ((c1 >= 0x81 && c1 <= 0xfe)) { if (n >= 2) { unsigned char c2 = s[1]; if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0x80 && c2 < 0xff)) { unsigned int i = 190 * (c1 - 0x81) + (c2 - (c2 >= 0x80 ? 0x41 : 0x40)); unsigned short wc = 0xfffd; { if (i < 23766) wc = gbk_2uni_page81[i]; } if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 2; } } return RET_ILSEQ; } return RET_TOOFEW(0); } return RET_ILSEQ; } static const unsigned short gbk_page00[208] = { 0x0000, 0x0000, 0x0000, 0x0000, 0xa1e8, 0x0000, 0x0000, 0xa1ec, /*0xa0-0xa7*/ 0xa1a7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ 0xa1e3, 0xa1c0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1a4, /*0xb0-0xb7*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb8-0xbf*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc0-0xc7*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc8-0xcf*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1c1, /*0xd0-0xd7*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd8-0xdf*/ 0xa8a4, 0xa8a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xe0-0xe7*/ 0xa8a8, 0xa8a6, 0xa8ba, 0x0000, 0xa8ac, 0xa8aa, 0x0000, 0x0000, /*0xe8-0xef*/ 0x0000, 0x0000, 0xa8b0, 0xa8ae, 0x0000, 0x0000, 0x0000, 0xa1c2, /*0xf0-0xf7*/ 0x0000, 0xa8b4, 0xa8b2, 0x0000, 0xa8b9, 0x0000, 0x0000, 0x0000, /*0xf8-0xff*/ /* 0x0100 */ 0x0000, 0xa8a1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x00-0x07*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x08-0x0f*/ 0x0000, 0x0000, 0x0000, 0xa8a5, 0x0000, 0x0000, 0x0000, 0x0000, /*0x10-0x17*/ 0x0000, 0x0000, 0x0000, 0xa8a7, 0x0000, 0x0000, 0x0000, 0x0000, /*0x18-0x1f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x20-0x27*/ 0x0000, 0x0000, 0x0000, 0xa8a9, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0xa8bd, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ 0xa8be, 0x0000, 0x0000, 0x0000, 0x0000, 0xa8ad, 0x0000, 0x0000, /*0x48-0x4f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x60-0x67*/ 0x0000, 0x0000, 0x0000, 0xa8b1, 0x0000, 0x0000, 0x0000, 0x0000, /*0x68-0x6f*/ }; static const unsigned short gbk_page01[24] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa8a3, 0x0000, /*0xc8-0xcf*/ 0xa8ab, 0x0000, 0xa8af, 0x0000, 0xa8b3, 0x0000, 0xa8b5, 0x0000, /*0xd0-0xd7*/ 0xa8b6, 0x0000, 0xa8b7, 0x0000, 0xa8b8, 0x0000, 0x0000, 0x0000, /*0xd8-0xdf*/ }; static const unsigned short gbk_page02a[24] = { 0x0000, 0xa8bb, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/ 0x0000, 0xa8c0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x60-0x67*/ }; static const unsigned short gbk_page02b[32] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1a6, /*0xc0-0xc7*/ 0x0000, 0xa1a5, 0xa840, 0xa841, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc8-0xcf*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd0-0xd7*/ 0x0000, 0xa842, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd8-0xdf*/ }; static const unsigned short gbk_page03[64] = { 0x0000, 0xa6a1, 0xa6a2, 0xa6a3, 0xa6a4, 0xa6a5, 0xa6a6, 0xa6a7, /*0x90-0x97*/ 0xa6a8, 0xa6a9, 0xa6aa, 0xa6ab, 0xa6ac, 0xa6ad, 0xa6ae, 0xa6af, /*0x98-0x9f*/ 0xa6b0, 0xa6b1, 0x0000, 0xa6b2, 0xa6b3, 0xa6b4, 0xa6b5, 0xa6b6, /*0xa0-0xa7*/ 0xa6b7, 0xa6b8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ 0x0000, 0xa6c1, 0xa6c2, 0xa6c3, 0xa6c4, 0xa6c5, 0xa6c6, 0xa6c7, /*0xb0-0xb7*/ 0xa6c8, 0xa6c9, 0xa6ca, 0xa6cb, 0xa6cc, 0xa6cd, 0xa6ce, 0xa6cf, /*0xb8-0xbf*/ 0xa6d0, 0xa6d1, 0x0000, 0xa6d2, 0xa6d3, 0xa6d4, 0xa6d5, 0xa6d6, /*0xc0-0xc7*/ 0xa6d7, 0xa6d8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc8-0xcf*/ }; static const unsigned short gbk_page04[88] = { 0x0000, 0xa7a7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x00-0x07*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x08-0x0f*/ 0xa7a1, 0xa7a2, 0xa7a3, 0xa7a4, 0xa7a5, 0xa7a6, 0xa7a8, 0xa7a9, /*0x10-0x17*/ 0xa7aa, 0xa7ab, 0xa7ac, 0xa7ad, 0xa7ae, 0xa7af, 0xa7b0, 0xa7b1, /*0x18-0x1f*/ 0xa7b2, 0xa7b3, 0xa7b4, 0xa7b5, 0xa7b6, 0xa7b7, 0xa7b8, 0xa7b9, /*0x20-0x27*/ 0xa7ba, 0xa7bb, 0xa7bc, 0xa7bd, 0xa7be, 0xa7bf, 0xa7c0, 0xa7c1, /*0x28-0x2f*/ 0xa7d1, 0xa7d2, 0xa7d3, 0xa7d4, 0xa7d5, 0xa7d6, 0xa7d8, 0xa7d9, /*0x30-0x37*/ 0xa7da, 0xa7db, 0xa7dc, 0xa7dd, 0xa7de, 0xa7df, 0xa7e0, 0xa7e1, /*0x38-0x3f*/ 0xa7e2, 0xa7e3, 0xa7e4, 0xa7e5, 0xa7e6, 0xa7e7, 0xa7e8, 0xa7e9, /*0x40-0x47*/ 0xa7ea, 0xa7eb, 0xa7ec, 0xa7ed, 0xa7ee, 0xa7ef, 0xa7f0, 0xa7f1, /*0x48-0x4f*/ 0x0000, 0xa7d7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ }; static const unsigned short gbk_page20[48] = { 0xa95c, 0x0000, 0x0000, 0xa843, 0xa1aa, 0xa844, 0xa1ac, 0x0000, /*0x10-0x17*/ 0xa1ae, 0xa1af, 0x0000, 0x0000, 0xa1b0, 0xa1b1, 0x0000, 0x0000, /*0x18-0x1f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa845, 0xa1ad, 0x0000, /*0x20-0x27*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ 0xa1eb, 0x0000, 0xa1e4, 0xa1e5, 0x0000, 0xa846, 0x0000, 0x0000, /*0x30-0x37*/ 0x0000, 0x0000, 0x0000, 0xa1f9, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ }; static const unsigned short gbk_page21[160] = { 0x0000, 0x0000, 0x0000, 0xa1e6, 0x0000, 0xa847, 0x0000, 0x0000, /*0x00-0x07*/ 0x0000, 0xa848, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x08-0x0f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1ed, 0x0000, /*0x10-0x17*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x18-0x1f*/ 0x0000, 0xa959, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x20-0x27*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x48-0x4f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/ 0xa2f1, 0xa2f2, 0xa2f3, 0xa2f4, 0xa2f5, 0xa2f6, 0xa2f7, 0xa2f8, /*0x60-0x67*/ 0xa2f9, 0xa2fa, 0xa2fb, 0xa2fc, 0x0000, 0x0000, 0x0000, 0x0000, /*0x68-0x6f*/ 0xa2a1, 0xa2a2, 0xa2a3, 0xa2a4, 0xa2a5, 0xa2a6, 0xa2a7, 0xa2a8, /*0x70-0x77*/ 0xa2a9, 0xa2aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x78-0x7f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x80-0x87*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x88-0x8f*/ 0xa1fb, 0xa1fc, 0xa1fa, 0xa1fd, 0x0000, 0x0000, 0xa849, 0xa84a, /*0x90-0x97*/ 0xa84b, 0xa84c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x98-0x9f*/ }; static const unsigned short gbk_page22[184] = { 0xa1ca, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1c7, /*0x08-0x0f*/ 0x0000, 0xa1c6, 0x0000, 0x0000, 0x0000, 0xa84d, 0x0000, 0x0000, /*0x10-0x17*/ 0x0000, 0x0000, 0xa1cc, 0x0000, 0x0000, 0xa1d8, 0xa1de, 0xa84e, /*0x18-0x1f*/ 0xa1cf, 0x0000, 0x0000, 0xa84f, 0x0000, 0xa1ce, 0x0000, 0xa1c4, /*0x20-0x27*/ 0xa1c5, 0xa1c9, 0xa1c8, 0xa1d2, 0x0000, 0x0000, 0xa1d3, 0x0000, /*0x28-0x2f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0xa1e0, 0xa1df, 0xa1c3, 0xa1cb, /*0x30-0x37*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1d7, 0x0000, 0x0000, /*0x38-0x3f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ 0xa1d6, 0x0000, 0x0000, 0x0000, 0xa1d5, 0x0000, 0x0000, 0x0000, /*0x48-0x4f*/ 0x0000, 0x0000, 0xa850, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/ 0xa1d9, 0xa1d4, 0x0000, 0x0000, 0xa1dc, 0xa1dd, 0xa851, 0xa852, /*0x60-0x67*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1da, 0xa1db, /*0x68-0x6f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x70-0x77*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x78-0x7f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x80-0x87*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x88-0x8f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa892, 0x0000, 0x0000, /*0x90-0x97*/ 0x0000, 0xa1d1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x98-0x9f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1cd, 0x0000, 0x0000, /*0xa0-0xa7*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb0-0xb7*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa853, /*0xb8-0xbf*/ }; static const unsigned short gbk_page24[64] = { 0xa2d9, 0xa2da, 0xa2db, 0xa2dc, 0xa2dd, 0xa2de, 0xa2df, 0xa2e0, /*0x60-0x67*/ 0xa2e1, 0xa2e2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x68-0x6f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0xa2c5, 0xa2c6, 0xa2c7, 0xa2c8, /*0x70-0x77*/ 0xa2c9, 0xa2ca, 0xa2cb, 0xa2cc, 0xa2cd, 0xa2ce, 0xa2cf, 0xa2d0, /*0x78-0x7f*/ 0xa2d1, 0xa2d2, 0xa2d3, 0xa2d4, 0xa2d5, 0xa2d6, 0xa2d7, 0xa2d8, /*0x80-0x87*/ 0xa2b1, 0xa2b2, 0xa2b3, 0xa2b4, 0xa2b5, 0xa2b6, 0xa2b7, 0xa2b8, /*0x88-0x8f*/ 0xa2b9, 0xa2ba, 0xa2bb, 0xa2bc, 0xa2bd, 0xa2be, 0xa2bf, 0xa2c0, /*0x90-0x97*/ 0xa2c1, 0xa2c2, 0xa2c3, 0xa2c4, 0x0000, 0x0000, 0x0000, 0x0000, /*0x98-0x9f*/ }; static const unsigned short gbk_page25[232] = { 0xa9a4, 0xa9a5, 0xa9a6, 0xa9a7, 0xa9a8, 0xa9a9, 0xa9aa, 0xa9ab, /*0x00-0x07*/ 0xa9ac, 0xa9ad, 0xa9ae, 0xa9af, 0xa9b0, 0xa9b1, 0xa9b2, 0xa9b3, /*0x08-0x0f*/ 0xa9b4, 0xa9b5, 0xa9b6, 0xa9b7, 0xa9b8, 0xa9b9, 0xa9ba, 0xa9bb, /*0x10-0x17*/ 0xa9bc, 0xa9bd, 0xa9be, 0xa9bf, 0xa9c0, 0xa9c1, 0xa9c2, 0xa9c3, /*0x18-0x1f*/ 0xa9c4, 0xa9c5, 0xa9c6, 0xa9c7, 0xa9c8, 0xa9c9, 0xa9ca, 0xa9cb, /*0x20-0x27*/ 0xa9cc, 0xa9cd, 0xa9ce, 0xa9cf, 0xa9d0, 0xa9d1, 0xa9d2, 0xa9d3, /*0x28-0x2f*/ 0xa9d4, 0xa9d5, 0xa9d6, 0xa9d7, 0xa9d8, 0xa9d9, 0xa9da, 0xa9db, /*0x30-0x37*/ 0xa9dc, 0xa9dd, 0xa9de, 0xa9df, 0xa9e0, 0xa9e1, 0xa9e2, 0xa9e3, /*0x38-0x3f*/ 0xa9e4, 0xa9e5, 0xa9e6, 0xa9e7, 0xa9e8, 0xa9e9, 0xa9ea, 0xa9eb, /*0x40-0x47*/ 0xa9ec, 0xa9ed, 0xa9ee, 0xa9ef, 0x0000, 0x0000, 0x0000, 0x0000, /*0x48-0x4f*/ 0xa854, 0xa855, 0xa856, 0xa857, 0xa858, 0xa859, 0xa85a, 0xa85b, /*0x50-0x57*/ 0xa85c, 0xa85d, 0xa85e, 0xa85f, 0xa860, 0xa861, 0xa862, 0xa863, /*0x58-0x5f*/ 0xa864, 0xa865, 0xa866, 0xa867, 0xa868, 0xa869, 0xa86a, 0xa86b, /*0x60-0x67*/ 0xa86c, 0xa86d, 0xa86e, 0xa86f, 0xa870, 0xa871, 0xa872, 0xa873, /*0x68-0x6f*/ 0xa874, 0xa875, 0xa876, 0xa877, 0x0000, 0x0000, 0x0000, 0x0000, /*0x70-0x77*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x78-0x7f*/ 0x0000, 0xa878, 0xa879, 0xa87a, 0xa87b, 0xa87c, 0xa87d, 0xa87e, /*0x80-0x87*/ 0xa880, 0xa881, 0xa882, 0xa883, 0xa884, 0xa885, 0xa886, 0xa887, /*0x88-0x8f*/ 0x0000, 0x0000, 0x0000, 0xa888, 0xa889, 0xa88a, 0x0000, 0x0000, /*0x90-0x97*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x98-0x9f*/ 0xa1f6, 0xa1f5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa0-0xa7*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ 0x0000, 0x0000, 0xa1f8, 0xa1f7, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb0-0xb7*/ 0x0000, 0x0000, 0x0000, 0x0000, 0xa88b, 0xa88c, 0x0000, 0x0000, /*0xb8-0xbf*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1f4, 0xa1f3, /*0xc0-0xc7*/ 0x0000, 0x0000, 0x0000, 0xa1f0, 0x0000, 0x0000, 0xa1f2, 0xa1f1, /*0xc8-0xcf*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd0-0xd7*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd8-0xdf*/ 0x0000, 0x0000, 0xa88d, 0xa88e, 0xa88f, 0xa890, 0x0000, 0x0000, /*0xe0-0xe7*/ }; static const unsigned short gbk_page26[72] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1ef, 0xa1ee, 0x0000, /*0x00-0x07*/ 0x0000, 0xa891, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x08-0x0f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x10-0x17*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x18-0x1f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x20-0x27*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ 0xa1e2, 0x0000, 0xa1e1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ }; static const unsigned short gbk_page30[304] = { 0xa1a1, 0xa1a2, 0xa1a3, 0xa1a8, 0x0000, 0xa1a9, 0xa965, 0xa996, /*0x00-0x07*/ 0xa1b4, 0xa1b5, 0xa1b6, 0xa1b7, 0xa1b8, 0xa1b9, 0xa1ba, 0xa1bb, /*0x08-0x0f*/ 0xa1be, 0xa1bf, 0xa893, 0xa1fe, 0xa1b2, 0xa1b3, 0xa1bc, 0xa1bd, /*0x10-0x17*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa894, 0xa895, 0x0000, /*0x18-0x1f*/ 0x0000, 0xa940, 0xa941, 0xa942, 0xa943, 0xa944, 0xa945, 0xa946, /*0x20-0x27*/ 0xa947, 0xa948, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ 0x0000, 0xa4a1, 0xa4a2, 0xa4a3, 0xa4a4, 0xa4a5, 0xa4a6, 0xa4a7, /*0x40-0x47*/ 0xa4a8, 0xa4a9, 0xa4aa, 0xa4ab, 0xa4ac, 0xa4ad, 0xa4ae, 0xa4af, /*0x48-0x4f*/ 0xa4b0, 0xa4b1, 0xa4b2, 0xa4b3, 0xa4b4, 0xa4b5, 0xa4b6, 0xa4b7, /*0x50-0x57*/ 0xa4b8, 0xa4b9, 0xa4ba, 0xa4bb, 0xa4bc, 0xa4bd, 0xa4be, 0xa4bf, /*0x58-0x5f*/ 0xa4c0, 0xa4c1, 0xa4c2, 0xa4c3, 0xa4c4, 0xa4c5, 0xa4c6, 0xa4c7, /*0x60-0x67*/ 0xa4c8, 0xa4c9, 0xa4ca, 0xa4cb, 0xa4cc, 0xa4cd, 0xa4ce, 0xa4cf, /*0x68-0x6f*/ 0xa4d0, 0xa4d1, 0xa4d2, 0xa4d3, 0xa4d4, 0xa4d5, 0xa4d6, 0xa4d7, /*0x70-0x77*/ 0xa4d8, 0xa4d9, 0xa4da, 0xa4db, 0xa4dc, 0xa4dd, 0xa4de, 0xa4df, /*0x78-0x7f*/ 0xa4e0, 0xa4e1, 0xa4e2, 0xa4e3, 0xa4e4, 0xa4e5, 0xa4e6, 0xa4e7, /*0x80-0x87*/ 0xa4e8, 0xa4e9, 0xa4ea, 0xa4eb, 0xa4ec, 0xa4ed, 0xa4ee, 0xa4ef, /*0x88-0x8f*/ 0xa4f0, 0xa4f1, 0xa4f2, 0xa4f3, 0x0000, 0x0000, 0x0000, 0x0000, /*0x90-0x97*/ 0x0000, 0x0000, 0x0000, 0xa961, 0xa962, 0xa966, 0xa967, 0x0000, /*0x98-0x9f*/ 0x0000, 0xa5a1, 0xa5a2, 0xa5a3, 0xa5a4, 0xa5a5, 0xa5a6, 0xa5a7, /*0xa0-0xa7*/ 0xa5a8, 0xa5a9, 0xa5aa, 0xa5ab, 0xa5ac, 0xa5ad, 0xa5ae, 0xa5af, /*0xa8-0xaf*/ 0xa5b0, 0xa5b1, 0xa5b2, 0xa5b3, 0xa5b4, 0xa5b5, 0xa5b6, 0xa5b7, /*0xb0-0xb7*/ 0xa5b8, 0xa5b9, 0xa5ba, 0xa5bb, 0xa5bc, 0xa5bd, 0xa5be, 0xa5bf, /*0xb8-0xbf*/ 0xa5c0, 0xa5c1, 0xa5c2, 0xa5c3, 0xa5c4, 0xa5c5, 0xa5c6, 0xa5c7, /*0xc0-0xc7*/ 0xa5c8, 0xa5c9, 0xa5ca, 0xa5cb, 0xa5cc, 0xa5cd, 0xa5ce, 0xa5cf, /*0xc8-0xcf*/ 0xa5d0, 0xa5d1, 0xa5d2, 0xa5d3, 0xa5d4, 0xa5d5, 0xa5d6, 0xa5d7, /*0xd0-0xd7*/ 0xa5d8, 0xa5d9, 0xa5da, 0xa5db, 0xa5dc, 0xa5dd, 0xa5de, 0xa5df, /*0xd8-0xdf*/ 0xa5e0, 0xa5e1, 0xa5e2, 0xa5e3, 0xa5e4, 0xa5e5, 0xa5e6, 0xa5e7, /*0xe0-0xe7*/ 0xa5e8, 0xa5e9, 0xa5ea, 0xa5eb, 0xa5ec, 0xa5ed, 0xa5ee, 0xa5ef, /*0xe8-0xef*/ 0xa5f0, 0xa5f1, 0xa5f2, 0xa5f3, 0xa5f4, 0xa5f5, 0xa5f6, 0x0000, /*0xf0-0xf7*/ 0x0000, 0x0000, 0x0000, 0x0000, 0xa960, 0xa963, 0xa964, 0x0000, /*0xf8-0xff*/ /* 0x3100 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa8c5, 0xa8c6, 0xa8c7, /*0x00-0x07*/ 0xa8c8, 0xa8c9, 0xa8ca, 0xa8cb, 0xa8cc, 0xa8cd, 0xa8ce, 0xa8cf, /*0x08-0x0f*/ 0xa8d0, 0xa8d1, 0xa8d2, 0xa8d3, 0xa8d4, 0xa8d5, 0xa8d6, 0xa8d7, /*0x10-0x17*/ 0xa8d8, 0xa8d9, 0xa8da, 0xa8db, 0xa8dc, 0xa8dd, 0xa8de, 0xa8df, /*0x18-0x1f*/ 0xa8e0, 0xa8e1, 0xa8e2, 0xa8e3, 0xa8e4, 0xa8e5, 0xa8e6, 0xa8e7, /*0x20-0x27*/ 0xa8e8, 0xa8e9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ }; static const unsigned short gbk_page32[24] = { 0xa2e5, 0xa2e6, 0xa2e7, 0xa2e8, 0xa2e9, 0xa2ea, 0xa2eb, 0xa2ec, /*0x20-0x27*/ 0xa2ed, 0xa2ee, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ 0x0000, 0xa95a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ }; static const unsigned short gbk_page33[80] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa94a, 0xa94b, /*0x88-0x8f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x90-0x97*/ 0x0000, 0x0000, 0x0000, 0x0000, 0xa94c, 0xa94d, 0xa94e, 0x0000, /*0x98-0x9f*/ 0x0000, 0xa94f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa0-0xa7*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb0-0xb7*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb8-0xbf*/ 0x0000, 0x0000, 0x0000, 0x0000, 0xa950, 0x0000, 0x0000, 0x0000, /*0xc0-0xc7*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa951, 0x0000, /*0xc8-0xcf*/ 0x0000, 0xa952, 0xa953, 0x0000, 0x0000, 0xa954, 0x0000, 0x0000, /*0xd0-0xd7*/ }; static const unsigned short gbk_page4e[20904] = { 0xd2bb, 0xb6a1, 0x8140, 0xc6df, 0x8141, 0x8142, 0x8143, 0xcdf2, /*0x00-0x07*/ 0xd5c9, 0xc8fd, 0xc9cf, 0xcfc2, 0xd8a2, 0xb2bb, 0xd3eb, 0x8144, /*0x08-0x0f*/ 0xd8a4, 0xb3f3, 0x8145, 0xd7a8, 0xc7d2, 0xd8a7, 0xcac0, 0x8146, /*0x10-0x17*/ 0xc7f0, 0xb1fb, 0xd2b5, 0xb4d4, 0xb6ab, 0xcbbf, 0xd8a9, 0x8147, /*0x18-0x1f*/ 0x8148, 0x8149, 0xb6aa, 0x814a, 0xc1bd, 0xd1cf, 0x814b, 0xc9a5, /*0x20-0x27*/ 0xd8ad, 0x814c, 0xb8f6, 0xd1be, 0xe3dc, 0xd6d0, 0x814d, 0x814e, /*0x28-0x2f*/ 0xb7e1, 0x814f, 0xb4ae, 0x8150, 0xc1d9, 0x8151, 0xd8bc, 0x8152, /*0x30-0x37*/ 0xcde8, 0xb5a4, 0xceaa, 0xd6f7, 0x8153, 0xc0f6, 0xbed9, 0xd8af, /*0x38-0x3f*/ 0x8154, 0x8155, 0x8156, 0xc4cb, 0x8157, 0xbec3, 0x8158, 0xd8b1, /*0x40-0x47*/ 0xc3b4, 0xd2e5, 0x8159, 0xd6ae, 0xceda, 0xd5a7, 0xbaf5, 0xb7a6, /*0x48-0x4f*/ 0xc0d6, 0x815a, 0xc6b9, 0xc5d2, 0xc7c7, 0x815b, 0xb9d4, 0x815c, /*0x50-0x57*/ 0xb3cb, 0xd2d2, 0x815d, 0x815e, 0xd8bf, 0xbec5, 0xc6f2, 0xd2b2, /*0x58-0x5f*/ 0xcfb0, 0xcfe7, 0x815f, 0x8160, 0x8161, 0x8162, 0xcae9, 0x8163, /*0x60-0x67*/ 0x8164, 0xd8c0, 0x8165, 0x8166, 0x8167, 0x8168, 0x8169, 0x816a, /*0x68-0x6f*/ 0xc2f2, 0xc2d2, 0x816b, 0xc8e9, 0x816c, 0x816d, 0x816e, 0x816f, /*0x70-0x77*/ 0x8170, 0x8171, 0x8172, 0x8173, 0x8174, 0x8175, 0xc7ac, 0x8176, /*0x78-0x7f*/ 0x8177, 0x8178, 0x8179, 0x817a, 0x817b, 0x817c, 0xc1cb, 0x817d, /*0x80-0x87*/ 0xd3e8, 0xd5f9, 0x817e, 0xcac2, 0xb6fe, 0xd8a1, 0xd3da, 0xbff7, /*0x88-0x8f*/ 0x8180, 0xd4c6, 0xbba5, 0xd8c1, 0xcee5, 0xbeae, 0x8181, 0x8182, /*0x90-0x97*/ 0xd8a8, 0x8183, 0xd1c7, 0xd0a9, 0x8184, 0x8185, 0x8186, 0xd8bd, /*0x98-0x9f*/ 0xd9ef, 0xcdf6, 0xbfba, 0x8187, 0xbdbb, 0xbaa5, 0xd2e0, 0xb2fa, /*0xa0-0xa7*/ 0xbae0, 0xc4b6, 0x8188, 0xcfed, 0xbea9, 0xcda4, 0xc1c1, 0x8189, /*0xa8-0xaf*/ 0x818a, 0x818b, 0xc7d7, 0xd9f1, 0x818c, 0xd9f4, 0x818d, 0x818e, /*0xb0-0xb7*/ 0x818f, 0x8190, 0xc8cb, 0xd8e9, 0x8191, 0x8192, 0x8193, 0xd2da, /*0xb8-0xbf*/ 0xcab2, 0xc8ca, 0xd8ec, 0xd8ea, 0xd8c6, 0xbdf6, 0xc6cd, 0xb3f0, /*0xc0-0xc7*/ 0x8194, 0xd8eb, 0xbdf1, 0xbde9, 0x8195, 0xc8d4, 0xb4d3, 0x8196, /*0xc8-0xcf*/ 0x8197, 0xc2d8, 0x8198, 0xb2d6, 0xd7d0, 0xcacb, 0xcbfb, 0xd5cc, /*0xd0-0xd7*/ 0xb8b6, 0xcfc9, 0x8199, 0x819a, 0x819b, 0xd9da, 0xd8f0, 0xc7aa, /*0xd8-0xdf*/ 0x819c, 0xd8ee, 0x819d, 0xb4fa, 0xc1ee, 0xd2d4, 0x819e, 0x819f, /*0xe0-0xe7*/ 0xd8ed, 0x81a0, 0xd2c7, 0xd8ef, 0xc3c7, 0x81a1, 0x81a2, 0x81a3, /*0xe8-0xef*/ 0xd1f6, 0x81a4, 0xd6d9, 0xd8f2, 0x81a5, 0xd8f5, 0xbcfe, 0xbcdb, /*0xf0-0xf7*/ 0x81a6, 0x81a7, 0x81a8, 0xc8ce, 0x81a9, 0xb7dd, 0x81aa, 0xb7c2, /*0xf8-0xff*/ /* 0x4f00 */ 0x81ab, 0xc6f3, 0x81ac, 0x81ad, 0x81ae, 0x81af, 0x81b0, 0x81b1, /*0x00-0x07*/ 0x81b2, 0xd8f8, 0xd2c1, 0x81b3, 0x81b4, 0xcee9, 0xbcbf, 0xb7fc, /*0x08-0x0f*/ 0xb7a5, 0xd0dd, 0x81b5, 0x81b6, 0x81b7, 0x81b8, 0x81b9, 0xd6da, /*0x10-0x17*/ 0xd3c5, 0xbbef, 0xbbe1, 0xd8f1, 0x81ba, 0x81bb, 0xc9a1, 0xceb0, /*0x18-0x1f*/ 0xb4ab, 0x81bc, 0xd8f3, 0x81bd, 0xc9cb, 0xd8f6, 0xc2d7, 0xd8f7, /*0x20-0x27*/ 0x81be, 0x81bf, 0xceb1, 0xd8f9, 0x81c0, 0x81c1, 0x81c2, 0xb2ae, /*0x28-0x2f*/ 0xb9c0, 0x81c3, 0xd9a3, 0x81c4, 0xb0e9, 0x81c5, 0xc1e6, 0x81c6, /*0x30-0x37*/ 0xc9ec, 0x81c7, 0xcbc5, 0x81c8, 0xcbc6, 0xd9a4, 0x81c9, 0x81ca, /*0x38-0x3f*/ 0x81cb, 0x81cc, 0x81cd, 0xb5e8, 0x81ce, 0x81cf, 0xb5ab, 0x81d0, /*0x40-0x47*/ 0x81d1, 0x81d2, 0x81d3, 0x81d4, 0x81d5, 0xcebb, 0xb5cd, 0xd7a1, /*0x48-0x4f*/ 0xd7f4, 0xd3d3, 0x81d6, 0xcce5, 0x81d7, 0xbace, 0x81d8, 0xd9a2, /*0x50-0x57*/ 0xd9dc, 0xd3e0, 0xd8fd, 0xb7f0, 0xd7f7, 0xd8fe, 0xd8fa, 0xd9a1, /*0x58-0x5f*/ 0xc4e3, 0x81d9, 0x81da, 0xd3b6, 0xd8f4, 0xd9dd, 0x81db, 0xd8fb, /*0x60-0x67*/ 0x81dc, 0xc5e5, 0x81dd, 0x81de, 0xc0d0, 0x81df, 0x81e0, 0xd1f0, /*0x68-0x6f*/ 0xb0db, 0x81e1, 0x81e2, 0xbcd1, 0xd9a6, 0x81e3, 0xd9a5, 0x81e4, /*0x70-0x77*/ 0x81e5, 0x81e6, 0x81e7, 0xd9ac, 0xd9ae, 0x81e8, 0xd9ab, 0xcab9, /*0x78-0x7f*/ 0x81e9, 0x81ea, 0x81eb, 0xd9a9, 0xd6b6, 0x81ec, 0x81ed, 0x81ee, /*0x80-0x87*/ 0xb3de, 0xd9a8, 0x81ef, 0xc0fd, 0x81f0, 0xcacc, 0x81f1, 0xd9aa, /*0x88-0x8f*/ 0x81f2, 0xd9a7, 0x81f3, 0x81f4, 0xd9b0, 0x81f5, 0x81f6, 0xb6b1, /*0x90-0x97*/ 0x81f7, 0x81f8, 0x81f9, 0xb9a9, 0x81fa, 0xd2c0, 0x81fb, 0x81fc, /*0x98-0x9f*/ 0xcfc0, 0x81fd, 0x81fe, 0xc2c2, 0x8240, 0xbdc4, 0xd5ec, 0xb2e0, /*0xa0-0xa7*/ 0xc7c8, 0xbfeb, 0xd9ad, 0x8241, 0xd9af, 0x8242, 0xceea, 0xbaee, /*0xa8-0xaf*/ 0x8243, 0x8244, 0x8245, 0x8246, 0x8247, 0xc7d6, 0x8248, 0x8249, /*0xb0-0xb7*/ 0x824a, 0x824b, 0x824c, 0x824d, 0x824e, 0x824f, 0x8250, 0xb1e3, /*0xb8-0xbf*/ 0x8251, 0x8252, 0x8253, 0xb4d9, 0xb6ed, 0xd9b4, 0x8254, 0x8255, /*0xc0-0xc7*/ 0x8256, 0x8257, 0xbfa1, 0x8258, 0x8259, 0x825a, 0xd9de, 0xc7ce, /*0xc8-0xcf*/ 0xc0fe, 0xd9b8, 0x825b, 0x825c, 0x825d, 0x825e, 0x825f, 0xcbd7, /*0xd0-0xd7*/ 0xb7fd, 0x8260, 0xd9b5, 0x8261, 0xd9b7, 0xb1a3, 0xd3e1, 0xd9b9, /*0xd8-0xdf*/ 0x8262, 0xd0c5, 0x8263, 0xd9b6, 0x8264, 0x8265, 0xd9b1, 0x8266, /*0xe0-0xe7*/ 0xd9b2, 0xc1a9, 0xd9b3, 0x8267, 0x8268, 0xbcf3, 0xd0de, 0xb8a9, /*0xe8-0xef*/ 0x8269, 0xbee3, 0x826a, 0xd9bd, 0x826b, 0x826c, 0x826d, 0x826e, /*0xf0-0xf7*/ 0xd9ba, 0x826f, 0xb0b3, 0x8270, 0x8271, 0x8272, 0xd9c2, 0x8273, /*0xf8-0xff*/ /* 0x5000 */ 0x8274, 0x8275, 0x8276, 0x8277, 0x8278, 0x8279, 0x827a, 0x827b, /*0x00-0x07*/ 0x827c, 0x827d, 0x827e, 0x8280, 0xd9c4, 0xb1b6, 0x8281, 0xd9bf, /*0x08-0x0f*/ 0x8282, 0x8283, 0xb5b9, 0x8284, 0xbef3, 0x8285, 0x8286, 0x8287, /*0x10-0x17*/ 0xccc8, 0xbaf2, 0xd2d0, 0x8288, 0xd9c3, 0x8289, 0x828a, 0xbde8, /*0x18-0x1f*/ 0x828b, 0xb3ab, 0x828c, 0x828d, 0x828e, 0xd9c5, 0xbeeb, 0x828f, /*0x20-0x27*/ 0xd9c6, 0xd9bb, 0xc4df, 0x8290, 0xd9be, 0xd9c1, 0xd9c0, 0x8291, /*0x28-0x2f*/ 0x8292, 0x8293, 0x8294, 0x8295, 0x8296, 0x8297, 0x8298, 0x8299, /*0x30-0x37*/ 0x829a, 0x829b, 0xd5ae, 0x829c, 0xd6b5, 0x829d, 0xc7e3, 0x829e, /*0x38-0x3f*/ 0x829f, 0x82a0, 0x82a1, 0xd9c8, 0x82a2, 0x82a3, 0x82a4, 0xbcd9, /*0x40-0x47*/ 0xd9ca, 0x82a5, 0x82a6, 0x82a7, 0xd9bc, 0x82a8, 0xd9cb, 0xc6ab, /*0x48-0x4f*/ 0x82a9, 0x82aa, 0x82ab, 0x82ac, 0x82ad, 0xd9c9, 0x82ae, 0x82af, /*0x50-0x57*/ 0x82b0, 0x82b1, 0xd7f6, 0x82b2, 0xcda3, 0x82b3, 0x82b4, 0x82b5, /*0x58-0x5f*/ 0x82b6, 0x82b7, 0x82b8, 0x82b9, 0x82ba, 0xbda1, 0x82bb, 0x82bc, /*0x60-0x67*/ 0x82bd, 0x82be, 0x82bf, 0x82c0, 0xd9cc, 0x82c1, 0x82c2, 0x82c3, /*0x68-0x6f*/ 0x82c4, 0x82c5, 0x82c6, 0x82c7, 0x82c8, 0x82c9, 0xc5bc, 0xcdb5, /*0x70-0x77*/ 0x82ca, 0x82cb, 0x82cc, 0xd9cd, 0x82cd, 0x82ce, 0xd9c7, 0xb3a5, /*0x78-0x7f*/ 0xbffe, 0x82cf, 0x82d0, 0x82d1, 0x82d2, 0xb8b5, 0x82d3, 0x82d4, /*0x80-0x87*/ 0xc0fc, 0x82d5, 0x82d6, 0x82d7, 0x82d8, 0xb0f8, 0x82d9, 0x82da, /*0x88-0x8f*/ 0x82db, 0x82dc, 0x82dd, 0x82de, 0x82df, 0x82e0, 0x82e1, 0x82e2, /*0x90-0x97*/ 0x82e3, 0x82e4, 0x82e5, 0x82e6, 0x82e7, 0x82e8, 0x82e9, 0x82ea, /*0x98-0x9f*/ 0x82eb, 0x82ec, 0x82ed, 0xb4f6, 0x82ee, 0xd9ce, 0x82ef, 0xd9cf, /*0xa0-0xa7*/ 0xb4a2, 0xd9d0, 0x82f0, 0x82f1, 0xb4df, 0x82f2, 0x82f3, 0x82f4, /*0xa8-0xaf*/ 0x82f5, 0x82f6, 0xb0c1, 0x82f7, 0x82f8, 0x82f9, 0x82fa, 0x82fb, /*0xb0-0xb7*/ 0x82fc, 0x82fd, 0xd9d1, 0xc9b5, 0x82fe, 0x8340, 0x8341, 0x8342, /*0xb8-0xbf*/ 0x8343, 0x8344, 0x8345, 0x8346, 0x8347, 0x8348, 0x8349, 0x834a, /*0xc0-0xc7*/ 0x834b, 0x834c, 0x834d, 0x834e, 0x834f, 0x8350, 0x8351, 0xcff1, /*0xc8-0xcf*/ 0x8352, 0x8353, 0x8354, 0x8355, 0x8356, 0x8357, 0xd9d2, 0x8358, /*0xd0-0xd7*/ 0x8359, 0x835a, 0xc1c5, 0x835b, 0x835c, 0x835d, 0x835e, 0x835f, /*0xd8-0xdf*/ 0x8360, 0x8361, 0x8362, 0x8363, 0x8364, 0x8365, 0xd9d6, 0xc9ae, /*0xe0-0xe7*/ 0x8366, 0x8367, 0x8368, 0x8369, 0xd9d5, 0xd9d4, 0xd9d7, 0x836a, /*0xe8-0xef*/ 0x836b, 0x836c, 0x836d, 0xcbdb, 0x836e, 0xbda9, 0x836f, 0x8370, /*0xf0-0xf7*/ 0x8371, 0x8372, 0x8373, 0xc6a7, 0x8374, 0x8375, 0x8376, 0x8377, /*0xf8-0xff*/ /* 0x5100 */ 0x8378, 0x8379, 0x837a, 0x837b, 0x837c, 0x837d, 0xd9d3, 0xd9d8, /*0x00-0x07*/ 0x837e, 0x8380, 0x8381, 0xd9d9, 0x8382, 0x8383, 0x8384, 0x8385, /*0x08-0x0f*/ 0x8386, 0x8387, 0xc8e5, 0x8388, 0x8389, 0x838a, 0x838b, 0x838c, /*0x10-0x17*/ 0x838d, 0x838e, 0x838f, 0x8390, 0x8391, 0x8392, 0x8393, 0x8394, /*0x18-0x1f*/ 0x8395, 0xc0dc, 0x8396, 0x8397, 0x8398, 0x8399, 0x839a, 0x839b, /*0x20-0x27*/ 0x839c, 0x839d, 0x839e, 0x839f, 0x83a0, 0x83a1, 0x83a2, 0x83a3, /*0x28-0x2f*/ 0x83a4, 0x83a5, 0x83a6, 0x83a7, 0x83a8, 0x83a9, 0x83aa, 0x83ab, /*0x30-0x37*/ 0x83ac, 0x83ad, 0x83ae, 0x83af, 0x83b0, 0x83b1, 0x83b2, 0xb6f9, /*0x38-0x3f*/ 0xd8a3, 0xd4ca, 0x83b3, 0xd4aa, 0xd0d6, 0xb3e4, 0xd5d7, 0x83b4, /*0x40-0x47*/ 0xcfc8, 0xb9e2, 0x83b5, 0xbfcb, 0x83b6, 0xc3e2, 0x83b7, 0x83b8, /*0x48-0x4f*/ 0x83b9, 0xb6d2, 0x83ba, 0x83bb, 0xcdc3, 0xd9ee, 0xd9f0, 0x83bc, /*0x50-0x57*/ 0x83bd, 0x83be, 0xb5b3, 0x83bf, 0xb6b5, 0x83c0, 0x83c1, 0x83c2, /*0x58-0x5f*/ 0x83c3, 0x83c4, 0xbea4, 0x83c5, 0x83c6, 0xc8eb, 0x83c7, 0x83c8, /*0x60-0x67*/ 0xc8ab, 0x83c9, 0x83ca, 0xb0cb, 0xb9ab, 0xc1f9, 0xd9e2, 0x83cb, /*0x68-0x6f*/ 0xc0bc, 0xb9b2, 0x83cc, 0xb9d8, 0xd0cb, 0xb1f8, 0xc6e4, 0xbedf, /*0x70-0x77*/ 0xb5e4, 0xd7c8, 0x83cd, 0xd1f8, 0xbce6, 0xcade, 0x83ce, 0x83cf, /*0x78-0x7f*/ 0xbcbd, 0xd9e6, 0xd8e7, 0x83d0, 0x83d1, 0xc4da, 0x83d2, 0x83d3, /*0x80-0x87*/ 0xb8d4, 0xc8bd, 0x83d4, 0x83d5, 0xb2e1, 0xd4d9, 0x83d6, 0x83d7, /*0x88-0x8f*/ 0x83d8, 0x83d9, 0xc3b0, 0x83da, 0x83db, 0xc3e1, 0xdaa2, 0xc8df, /*0x90-0x97*/ 0x83dc, 0xd0b4, 0x83dd, 0xbefc, 0xc5a9, 0x83de, 0x83df, 0x83e0, /*0x98-0x9f*/ 0xb9da, 0x83e1, 0xdaa3, 0x83e2, 0xd4a9, 0xdaa4, 0x83e3, 0x83e4, /*0xa0-0xa7*/ 0x83e5, 0x83e6, 0x83e7, 0xd9fb, 0xb6ac, 0x83e8, 0x83e9, 0xb7eb, /*0xa8-0xaf*/ 0xb1f9, 0xd9fc, 0xb3e5, 0xbef6, 0x83ea, 0xbff6, 0xd2b1, 0xc0e4, /*0xb0-0xb7*/ 0x83eb, 0x83ec, 0x83ed, 0xb6b3, 0xd9fe, 0xd9fd, 0x83ee, 0x83ef, /*0xb8-0xbf*/ 0xbebb, 0x83f0, 0x83f1, 0x83f2, 0xc6e0, 0x83f3, 0xd7bc, 0xdaa1, /*0xc0-0xc7*/ 0x83f4, 0xc1b9, 0x83f5, 0xb5f2, 0xc1e8, 0x83f6, 0x83f7, 0xbcf5, /*0xc8-0xcf*/ 0x83f8, 0xb4d5, 0x83f9, 0x83fa, 0x83fb, 0x83fc, 0x83fd, 0x83fe, /*0xd0-0xd7*/ 0x8440, 0x8441, 0x8442, 0xc1dd, 0x8443, 0xc4fd, 0x8444, 0x8445, /*0xd8-0xdf*/ 0xbcb8, 0xb7b2, 0x8446, 0x8447, 0xb7ef, 0x8448, 0x8449, 0x844a, /*0xe0-0xe7*/ 0x844b, 0x844c, 0x844d, 0xd9ec, 0x844e, 0xc6be, 0x844f, 0xbfad, /*0xe8-0xef*/ 0xbbcb, 0x8450, 0x8451, 0xb5ca, 0x8452, 0xdbc9, 0xd0d7, 0x8453, /*0xf0-0xf7*/ 0xcdb9, 0xb0bc, 0xb3f6, 0xbbf7, 0xdbca, 0xbaaf, 0x8454, 0xd4e4, /*0xf8-0xff*/ /* 0x5200 */ 0xb5b6, 0xb5f3, 0xd8d6, 0xc8d0, 0x8455, 0x8456, 0xb7d6, 0xc7d0, /*0x00-0x07*/ 0xd8d7, 0x8457, 0xbfaf, 0x8458, 0x8459, 0xdbbb, 0xd8d8, 0x845a, /*0x08-0x0f*/ 0x845b, 0xd0cc, 0xbbae, 0x845c, 0x845d, 0x845e, 0xebbe, 0xc1d0, /*0x10-0x17*/ 0xc1f5, 0xd4f2, 0xb8d5, 0xb4b4, 0x845f, 0xb3f5, 0x8460, 0x8461, /*0x18-0x1f*/ 0xc9be, 0x8462, 0x8463, 0x8464, 0xc5d0, 0x8465, 0x8466, 0x8467, /*0x20-0x27*/ 0xc5d9, 0xc0fb, 0x8468, 0xb1f0, 0x8469, 0xd8d9, 0xb9ce, 0x846a, /*0x28-0x2f*/ 0xb5bd, 0x846b, 0x846c, 0xd8da, 0x846d, 0x846e, 0xd6c6, 0xcba2, /*0x30-0x37*/ 0xc8af, 0xc9b2, 0xb4cc, 0xbfcc, 0x846f, 0xb9f4, 0x8470, 0xd8db, /*0x38-0x3f*/ 0xd8dc, 0xb6e7, 0xbcc1, 0xccea, 0x8471, 0x8472, 0x8473, 0x8474, /*0x40-0x47*/ 0x8475, 0x8476, 0xcff7, 0x8477, 0xd8dd, 0xc7b0, 0x8478, 0x8479, /*0x48-0x4f*/ 0xb9d0, 0xbda3, 0x847a, 0x847b, 0xccde, 0x847c, 0xc6ca, 0x847d, /*0x50-0x57*/ 0x847e, 0x8480, 0x8481, 0x8482, 0xd8e0, 0x8483, 0xd8de, 0x8484, /*0x58-0x5f*/ 0x8485, 0xd8df, 0x8486, 0x8487, 0x8488, 0xb0fe, 0x8489, 0xbee7, /*0x60-0x67*/ 0x848a, 0xcaa3, 0xbcf4, 0x848b, 0x848c, 0x848d, 0x848e, 0xb8b1, /*0x68-0x6f*/ 0x848f, 0x8490, 0xb8ee, 0x8491, 0x8492, 0x8493, 0x8494, 0x8495, /*0x70-0x77*/ 0x8496, 0x8497, 0x8498, 0x8499, 0x849a, 0xd8e2, 0x849b, 0xbdcb, /*0x78-0x7f*/ 0x849c, 0xd8e4, 0xd8e3, 0x849d, 0x849e, 0x849f, 0x84a0, 0x84a1, /*0x80-0x87*/ 0xc5fc, 0x84a2, 0x84a3, 0x84a4, 0x84a5, 0x84a6, 0x84a7, 0x84a8, /*0x88-0x8f*/ 0xd8e5, 0x84a9, 0x84aa, 0xd8e6, 0x84ab, 0x84ac, 0x84ad, 0x84ae, /*0x90-0x97*/ 0x84af, 0x84b0, 0x84b1, 0xc1a6, 0x84b2, 0xc8b0, 0xb0ec, 0xb9a6, /*0x98-0x9f*/ 0xbcd3, 0xcef1, 0xdbbd, 0xc1d3, 0x84b3, 0x84b4, 0x84b5, 0x84b6, /*0xa0-0xa7*/ 0xb6af, 0xd6fa, 0xc5ac, 0xbdd9, 0xdbbe, 0xdbbf, 0x84b7, 0x84b8, /*0xa8-0xaf*/ 0x84b9, 0xc0f8, 0xbea2, 0xc0cd, 0x84ba, 0x84bb, 0x84bc, 0x84bd, /*0xb0-0xb7*/ 0x84be, 0x84bf, 0x84c0, 0x84c1, 0x84c2, 0x84c3, 0xdbc0, 0xcac6, /*0xb8-0xbf*/ 0x84c4, 0x84c5, 0x84c6, 0xb2aa, 0x84c7, 0x84c8, 0x84c9, 0xd3c2, /*0xc0-0xc7*/ 0x84ca, 0xc3e3, 0x84cb, 0xd1ab, 0x84cc, 0x84cd, 0x84ce, 0x84cf, /*0xc8-0xcf*/ 0xdbc2, 0x84d0, 0xc0d5, 0x84d1, 0x84d2, 0x84d3, 0xdbc3, 0x84d4, /*0xd0-0xd7*/ 0xbfb1, 0x84d5, 0x84d6, 0x84d7, 0x84d8, 0x84d9, 0x84da, 0xc4bc, /*0xd8-0xdf*/ 0x84db, 0x84dc, 0x84dd, 0x84de, 0xc7da, 0x84df, 0x84e0, 0x84e1, /*0xe0-0xe7*/ 0x84e2, 0x84e3, 0x84e4, 0x84e5, 0x84e6, 0x84e7, 0x84e8, 0x84e9, /*0xe8-0xef*/ 0xdbc4, 0x84ea, 0x84eb, 0x84ec, 0x84ed, 0x84ee, 0x84ef, 0x84f0, /*0xf0-0xf7*/ 0x84f1, 0xd9e8, 0xc9d7, 0x84f2, 0x84f3, 0x84f4, 0xb9b4, 0xcef0, /*0xf8-0xff*/ /* 0x5300 */ 0xd4c8, 0x84f5, 0x84f6, 0x84f7, 0x84f8, 0xb0fc, 0xb4d2, 0x84f9, /*0x00-0x07*/ 0xd0d9, 0x84fa, 0x84fb, 0x84fc, 0x84fd, 0xd9e9, 0x84fe, 0xdecb, /*0x08-0x0f*/ 0xd9eb, 0x8540, 0x8541, 0x8542, 0x8543, 0xd8b0, 0xbbaf, 0xb1b1, /*0x10-0x17*/ 0x8544, 0xb3d7, 0xd8ce, 0x8545, 0x8546, 0xd4d1, 0x8547, 0x8548, /*0x18-0x1f*/ 0xbdb3, 0xbfef, 0x8549, 0xcfbb, 0x854a, 0x854b, 0xd8d0, 0x854c, /*0x20-0x27*/ 0x854d, 0x854e, 0xb7cb, 0x854f, 0x8550, 0x8551, 0xd8d1, 0x8552, /*0x28-0x2f*/ 0x8553, 0x8554, 0x8555, 0x8556, 0x8557, 0x8558, 0x8559, 0x855a, /*0x30-0x37*/ 0x855b, 0xc6a5, 0xc7f8, 0xd2bd, 0x855c, 0x855d, 0xd8d2, 0xc4e4, /*0x38-0x3f*/ 0x855e, 0xcaae, 0x855f, 0xc7a7, 0x8560, 0xd8a6, 0x8561, 0xc9fd, /*0x40-0x47*/ 0xcee7, 0xbbdc, 0xb0eb, 0x8562, 0x8563, 0x8564, 0xbbaa, 0xd0ad, /*0x48-0x4f*/ 0x8565, 0xb1b0, 0xd7e4, 0xd7bf, 0x8566, 0xb5a5, 0xc2f4, 0xc4cf, /*0x50-0x57*/ 0x8567, 0x8568, 0xb2a9, 0x8569, 0xb2b7, 0x856a, 0xb1e5, 0xdfb2, /*0x58-0x5f*/ 0xd5bc, 0xbfa8, 0xc2ac, 0xd8d5, 0xc2b1, 0x856b, 0xd8d4, 0xced4, /*0x60-0x67*/ 0x856c, 0xdae0, 0x856d, 0xcec0, 0x856e, 0x856f, 0xd8b4, 0xc3ae, /*0x68-0x6f*/ 0xd3a1, 0xcea3, 0x8570, 0xbcb4, 0xc8b4, 0xc2d1, 0x8571, 0xbeed, /*0x70-0x77*/ 0xd0b6, 0x8572, 0xdae1, 0x8573, 0x8574, 0x8575, 0x8576, 0xc7e4, /*0x78-0x7f*/ 0x8577, 0x8578, 0xb3a7, 0x8579, 0xb6f2, 0xccfc, 0xc0fa, 0x857a, /*0x80-0x87*/ 0x857b, 0xc0f7, 0x857c, 0xd1b9, 0xd1e1, 0xd8c7, 0x857d, 0x857e, /*0x88-0x8f*/ 0x8580, 0x8581, 0x8582, 0x8583, 0x8584, 0xb2de, 0x8585, 0x8586, /*0x90-0x97*/ 0xc0e5, 0x8587, 0xbaf1, 0x8588, 0x8589, 0xd8c8, 0x858a, 0xd4ad, /*0x98-0x9f*/ 0x858b, 0x858c, 0xcfe1, 0xd8c9, 0x858d, 0xd8ca, 0xcfc3, 0x858e, /*0xa0-0xa7*/ 0xb3f8, 0xbec7, 0x858f, 0x8590, 0x8591, 0x8592, 0xd8cb, 0x8593, /*0xa8-0xaf*/ 0x8594, 0x8595, 0x8596, 0x8597, 0x8598, 0x8599, 0xdbcc, 0x859a, /*0xb0-0xb7*/ 0x859b, 0x859c, 0x859d, 0xc8a5, 0x859e, 0x859f, 0x85a0, 0xcfd8, /*0xb8-0xbf*/ 0x85a1, 0xc8fe, 0xb2ce, 0x85a2, 0x85a3, 0x85a4, 0x85a5, 0x85a6, /*0xc0-0xc7*/ 0xd3d6, 0xb2e6, 0xbcb0, 0xd3d1, 0xcbab, 0xb7b4, 0x85a7, 0x85a8, /*0xc8-0xcf*/ 0x85a9, 0xb7a2, 0x85aa, 0x85ab, 0xcae5, 0x85ac, 0xc8a1, 0xcadc, /*0xd0-0xd7*/ 0xb1e4, 0xd0f0, 0x85ad, 0xc5d1, 0x85ae, 0x85af, 0x85b0, 0xdbc5, /*0xd8-0xdf*/ 0xb5fe, 0x85b1, 0x85b2, 0xbfda, 0xb9c5, 0xbee4, 0xc1ed, 0x85b3, /*0xe0-0xe7*/ 0xdfb6, 0xdfb5, 0xd6bb, 0xbdd0, 0xd5d9, 0xb0c8, 0xb6a3, 0xbfc9, /*0xe8-0xef*/ 0xcca8, 0xdfb3, 0xcab7, 0xd3d2, 0x85b4, 0xd8cf, 0xd2b6, 0xbac5, /*0xf0-0xf7*/ 0xcbbe, 0xccbe, 0x85b5, 0xdfb7, 0xb5f0, 0xdfb4, 0x85b6, 0x85b7, /*0xf8-0xff*/ /* 0x5400 */ 0x85b8, 0xd3f5, 0x85b9, 0xb3d4, 0xb8f7, 0x85ba, 0xdfba, 0x85bb, /*0x00-0x07*/ 0xbacf, 0xbcaa, 0xb5f5, 0x85bc, 0xcdac, 0xc3fb, 0xbaf3, 0xc0f4, /*0x08-0x0f*/ 0xcdc2, 0xcff2, 0xdfb8, 0xcfc5, 0x85bd, 0xc2c0, 0xdfb9, 0xc2f0, /*0x10-0x17*/ 0x85be, 0x85bf, 0x85c0, 0xbefd, 0x85c1, 0xc1df, 0xcdcc, 0xd2f7, /*0x18-0x1f*/ 0xb7cd, 0xdfc1, 0x85c2, 0xdfc4, 0x85c3, 0x85c4, 0xb7f1, 0xb0c9, /*0x20-0x27*/ 0xb6d6, 0xb7d4, 0x85c5, 0xbaac, 0xccfd, 0xbfd4, 0xcbb1, 0xc6f4, /*0x28-0x2f*/ 0x85c6, 0xd6a8, 0xdfc5, 0x85c7, 0xcee2, 0xb3b3, 0x85c8, 0x85c9, /*0x30-0x37*/ 0xcefc, 0xb4b5, 0x85ca, 0xcec7, 0xbaf0, 0x85cb, 0xcee1, 0x85cc, /*0x38-0x3f*/ 0xd1bd, 0x85cd, 0x85ce, 0xdfc0, 0x85cf, 0x85d0, 0xb4f4, 0x85d1, /*0x40-0x47*/ 0xb3ca, 0x85d2, 0xb8e6, 0xdfbb, 0x85d3, 0x85d4, 0x85d5, 0x85d6, /*0x48-0x4f*/ 0xc4c5, 0x85d7, 0xdfbc, 0xdfbd, 0xdfbe, 0xc5bb, 0xdfbf, 0xdfc2, /*0x50-0x57*/ 0xd4b1, 0xdfc3, 0x85d8, 0xc7ba, 0xced8, 0x85d9, 0x85da, 0x85db, /*0x58-0x5f*/ 0x85dc, 0x85dd, 0xc4d8, 0x85de, 0xdfca, 0x85df, 0xdfcf, 0x85e0, /*0x60-0x67*/ 0xd6dc, 0x85e1, 0x85e2, 0x85e3, 0x85e4, 0x85e5, 0x85e6, 0x85e7, /*0x68-0x6f*/ 0x85e8, 0xdfc9, 0xdfda, 0xceb6, 0x85e9, 0xbac7, 0xdfce, 0xdfc8, /*0x70-0x77*/ 0xc5de, 0x85ea, 0x85eb, 0xc9eb, 0xbaf4, 0xc3fc, 0x85ec, 0x85ed, /*0x78-0x7f*/ 0xbed7, 0x85ee, 0xdfc6, 0x85ef, 0xdfcd, 0x85f0, 0xc5d8, 0x85f1, /*0x80-0x87*/ 0x85f2, 0x85f3, 0x85f4, 0xd5a6, 0xbacd, 0x85f5, 0xbecc, 0xd3bd, /*0x88-0x8f*/ 0xb8c0, 0x85f6, 0xd6e4, 0x85f7, 0xdfc7, 0xb9be, 0xbfa7, 0x85f8, /*0x90-0x97*/ 0x85f9, 0xc1fc, 0xdfcb, 0xdfcc, 0x85fa, 0xdfd0, 0x85fb, 0x85fc, /*0x98-0x9f*/ 0x85fd, 0x85fe, 0x8640, 0xdfdb, 0xdfe5, 0x8641, 0xdfd7, 0xdfd6, /*0xa0-0xa7*/ 0xd7c9, 0xdfe3, 0xdfe4, 0xe5eb, 0xd2a7, 0xdfd2, 0x8642, 0xbfa9, /*0xa8-0xaf*/ 0x8643, 0xd4db, 0x8644, 0xbfc8, 0xdfd4, 0x8645, 0x8646, 0x8647, /*0xb0-0xb7*/ 0xcfcc, 0x8648, 0x8649, 0xdfdd, 0x864a, 0xd1ca, 0x864b, 0xdfde, /*0xb8-0xbf*/ 0xb0a7, 0xc6b7, 0xdfd3, 0x864c, 0xbae5, 0x864d, 0xb6df, 0xcddb, /*0xc0-0xc7*/ 0xb9fe, 0xd4d5, 0x864e, 0x864f, 0xdfdf, 0xcfec, 0xb0a5, 0xdfe7, /*0xc8-0xcf*/ 0xdfd1, 0xd1c6, 0xdfd5, 0xdfd8, 0xdfd9, 0xdfdc, 0x8650, 0xbba9, /*0xd0-0xd7*/ 0x8651, 0xdfe0, 0xdfe1, 0x8652, 0xdfe2, 0xdfe6, 0xdfe8, 0xd3b4, /*0xd8-0xdf*/ 0x8653, 0x8654, 0x8655, 0x8656, 0x8657, 0xb8e7, 0xc5b6, 0xdfea, /*0xe0-0xe7*/ 0xc9da, 0xc1a8, 0xc4c4, 0x8658, 0x8659, 0xbfde, 0xcff8, 0x865a, /*0xe8-0xef*/ 0x865b, 0x865c, 0xd5dc, 0xdfee, 0x865d, 0x865e, 0x865f, 0x8660, /*0xf0-0xf7*/ 0x8661, 0x8662, 0xb2b8, 0x8663, 0xbadf, 0xdfec, 0x8664, 0xdbc1, /*0xf8-0xff*/ /* 0x5500 */ 0x8665, 0xd1e4, 0x8666, 0x8667, 0x8668, 0x8669, 0xcbf4, 0xb4bd, /*0x00-0x07*/ 0x866a, 0xb0a6, 0x866b, 0x866c, 0x866d, 0x866e, 0x866f, 0xdff1, /*0x08-0x0f*/ 0xccc6, 0xdff2, 0x8670, 0x8671, 0xdfed, 0x8672, 0x8673, 0x8674, /*0x10-0x17*/ 0x8675, 0x8676, 0x8677, 0xdfe9, 0x8678, 0x8679, 0x867a, 0x867b, /*0x18-0x1f*/ 0xdfeb, 0x867c, 0xdfef, 0xdff0, 0xbbbd, 0x867d, 0x867e, 0xdff3, /*0x20-0x27*/ 0x8680, 0x8681, 0xdff4, 0x8682, 0xbba3, 0x8683, 0xcadb, 0xcea8, /*0x28-0x2f*/ 0xe0a7, 0xb3aa, 0x8684, 0xe0a6, 0x8685, 0x8686, 0x8687, 0xe0a1, /*0x30-0x37*/ 0x8688, 0x8689, 0x868a, 0x868b, 0xdffe, 0x868c, 0xcdd9, 0xdffc, /*0x38-0x3f*/ 0x868d, 0xdffa, 0x868e, 0xbfd0, 0xd7c4, 0x868f, 0xc9cc, 0x8690, /*0x40-0x47*/ 0x8691, 0xdff8, 0xb0a1, 0x8692, 0x8693, 0x8694, 0x8695, 0x8696, /*0x48-0x4f*/ 0xdffd, 0x8697, 0x8698, 0x8699, 0x869a, 0xdffb, 0xe0a2, 0x869b, /*0x50-0x57*/ 0x869c, 0x869d, 0x869e, 0x869f, 0xe0a8, 0x86a0, 0x86a1, 0x86a2, /*0x58-0x5f*/ 0x86a3, 0xb7c8, 0x86a4, 0x86a5, 0xc6a1, 0xc9b6, 0xc0b2, 0xdff5, /*0x60-0x67*/ 0x86a6, 0x86a7, 0xc5be, 0x86a8, 0xd8c4, 0xdff9, 0xc4f6, 0x86a9, /*0x68-0x6f*/ 0x86aa, 0x86ab, 0x86ac, 0x86ad, 0x86ae, 0xe0a3, 0xe0a4, 0xe0a5, /*0x70-0x77*/ 0xd0a5, 0x86af, 0x86b0, 0xe0b4, 0xcce4, 0x86b1, 0xe0b1, 0x86b2, /*0x78-0x7f*/ 0xbfa6, 0xe0af, 0xceb9, 0xe0ab, 0xc9c6, 0x86b3, 0x86b4, 0xc0ae, /*0x80-0x87*/ 0xe0ae, 0xbaed, 0xbab0, 0xe0a9, 0x86b5, 0x86b6, 0x86b7, 0xdff6, /*0x88-0x8f*/ 0x86b8, 0xe0b3, 0x86b9, 0x86ba, 0xe0b8, 0x86bb, 0x86bc, 0x86bd, /*0x90-0x97*/ 0xb4ad, 0xe0b9, 0x86be, 0x86bf, 0xcfb2, 0xbac8, 0x86c0, 0xe0b0, /*0x98-0x9f*/ 0x86c1, 0x86c2, 0x86c3, 0x86c4, 0x86c5, 0x86c6, 0x86c7, 0xd0fa, /*0xa0-0xa7*/ 0x86c8, 0x86c9, 0x86ca, 0x86cb, 0x86cc, 0x86cd, 0x86ce, 0x86cf, /*0xa8-0xaf*/ 0x86d0, 0xe0ac, 0x86d1, 0xd4fb, 0x86d2, 0xdff7, 0x86d3, 0xc5e7, /*0xb0-0xb7*/ 0x86d4, 0xe0ad, 0x86d5, 0xd3f7, 0x86d6, 0xe0b6, 0xe0b7, 0x86d7, /*0xb8-0xbf*/ 0x86d8, 0x86d9, 0x86da, 0x86db, 0xe0c4, 0xd0e1, 0x86dc, 0x86dd, /*0xc0-0xc7*/ 0x86de, 0xe0bc, 0x86df, 0x86e0, 0xe0c9, 0xe0ca, 0x86e1, 0x86e2, /*0xc8-0xcf*/ 0x86e3, 0xe0be, 0xe0aa, 0xc9a4, 0xe0c1, 0x86e4, 0xe0b2, 0x86e5, /*0xd0-0xd7*/ 0x86e6, 0x86e7, 0x86e8, 0x86e9, 0xcac8, 0xe0c3, 0x86ea, 0xe0b5, /*0xd8-0xdf*/ 0x86eb, 0xcecb, 0x86ec, 0xcbc3, 0xe0cd, 0xe0c6, 0xe0c2, 0x86ed, /*0xe0-0xe7*/ 0xe0cb, 0x86ee, 0xe0ba, 0xe0bf, 0xe0c0, 0x86ef, 0x86f0, 0xe0c5, /*0xe8-0xef*/ 0x86f1, 0x86f2, 0xe0c7, 0xe0c8, 0x86f3, 0xe0cc, 0x86f4, 0xe0bb, /*0xf0-0xf7*/ 0x86f5, 0x86f6, 0x86f7, 0x86f8, 0x86f9, 0xcbd4, 0xe0d5, 0x86fa, /*0xf8-0xff*/ /* 0x5600 */ 0xe0d6, 0xe0d2, 0x86fb, 0x86fc, 0x86fd, 0x86fe, 0x8740, 0x8741, /*0x00-0x07*/ 0xe0d0, 0xbcce, 0x8742, 0x8743, 0xe0d1, 0x8744, 0xb8c2, 0xd8c5, /*0x08-0x0f*/ 0x8745, 0x8746, 0x8747, 0x8748, 0x8749, 0x874a, 0x874b, 0x874c, /*0x10-0x17*/ 0xd0ea, 0x874d, 0x874e, 0xc2ef, 0x874f, 0x8750, 0xe0cf, 0xe0bd, /*0x18-0x1f*/ 0x8751, 0x8752, 0x8753, 0xe0d4, 0xe0d3, 0x8754, 0x8755, 0xe0d7, /*0x20-0x27*/ 0x8756, 0x8757, 0x8758, 0x8759, 0xe0dc, 0xe0d8, 0x875a, 0x875b, /*0x28-0x2f*/ 0x875c, 0xd6f6, 0xb3b0, 0x875d, 0xd7ec, 0x875e, 0xcbbb, 0x875f, /*0x30-0x37*/ 0x8760, 0xe0da, 0x8761, 0xcefb, 0x8762, 0x8763, 0x8764, 0xbad9, /*0x38-0x3f*/ 0x8765, 0x8766, 0x8767, 0x8768, 0x8769, 0x876a, 0x876b, 0x876c, /*0x40-0x47*/ 0x876d, 0x876e, 0x876f, 0x8770, 0xe0e1, 0xe0dd, 0xd2ad, 0x8771, /*0x48-0x4f*/ 0x8772, 0x8773, 0x8774, 0x8775, 0xe0e2, 0x8776, 0x8777, 0xe0db, /*0x50-0x57*/ 0xe0d9, 0xe0df, 0x8778, 0x8779, 0xe0e0, 0x877a, 0x877b, 0x877c, /*0x58-0x5f*/ 0x877d, 0x877e, 0xe0de, 0x8780, 0xe0e4, 0x8781, 0x8782, 0x8783, /*0x60-0x67*/ 0xc6f7, 0xd8ac, 0xd4eb, 0xe0e6, 0xcac9, 0x8784, 0x8785, 0x8786, /*0x68-0x6f*/ 0x8787, 0xe0e5, 0x8788, 0x8789, 0x878a, 0x878b, 0xb8c1, 0x878c, /*0x70-0x77*/ 0x878d, 0x878e, 0x878f, 0xe0e7, 0xe0e8, 0x8790, 0x8791, 0x8792, /*0x78-0x7f*/ 0x8793, 0x8794, 0x8795, 0x8796, 0x8797, 0xe0e9, 0xe0e3, 0x8798, /*0x80-0x87*/ 0x8799, 0x879a, 0x879b, 0x879c, 0x879d, 0x879e, 0xbabf, 0xcce7, /*0x88-0x8f*/ 0x879f, 0x87a0, 0x87a1, 0xe0ea, 0x87a2, 0x87a3, 0x87a4, 0x87a5, /*0x90-0x97*/ 0x87a6, 0x87a7, 0x87a8, 0x87a9, 0x87aa, 0x87ab, 0x87ac, 0x87ad, /*0x98-0x9f*/ 0x87ae, 0x87af, 0x87b0, 0xcff9, 0x87b1, 0x87b2, 0x87b3, 0x87b4, /*0xa0-0xa7*/ 0x87b5, 0x87b6, 0x87b7, 0x87b8, 0x87b9, 0x87ba, 0x87bb, 0xe0eb, /*0xa8-0xaf*/ 0x87bc, 0x87bd, 0x87be, 0x87bf, 0x87c0, 0x87c1, 0x87c2, 0xc8c2, /*0xb0-0xb7*/ 0x87c3, 0x87c4, 0x87c5, 0x87c6, 0xbdc0, 0x87c7, 0x87c8, 0x87c9, /*0xb8-0xbf*/ 0x87ca, 0x87cb, 0x87cc, 0x87cd, 0x87ce, 0x87cf, 0x87d0, 0x87d1, /*0xc0-0xc7*/ 0x87d2, 0x87d3, 0xc4d2, 0x87d4, 0x87d5, 0x87d6, 0x87d7, 0x87d8, /*0xc8-0xcf*/ 0x87d9, 0x87da, 0x87db, 0x87dc, 0xe0ec, 0x87dd, 0x87de, 0xe0ed, /*0xd0-0xd7*/ 0x87df, 0x87e0, 0xc7f4, 0xcbc4, 0x87e1, 0xe0ee, 0xbbd8, 0xd8b6, /*0xd8-0xdf*/ 0xd2f2, 0xe0ef, 0xcdc5, 0x87e2, 0xb6da, 0x87e3, 0x87e4, 0x87e5, /*0xe0-0xe7*/ 0x87e6, 0x87e7, 0x87e8, 0xe0f1, 0x87e9, 0xd4b0, 0x87ea, 0x87eb, /*0xe8-0xef*/ 0xc0a7, 0xb4d1, 0x87ec, 0x87ed, 0xcea7, 0xe0f0, 0x87ee, 0x87ef, /*0xf0-0xf7*/ 0x87f0, 0xe0f2, 0xb9cc, 0x87f1, 0x87f2, 0xb9fa, 0xcdbc, 0xe0f3, /*0xf8-0xff*/ /* 0x5700 */ 0x87f3, 0x87f4, 0x87f5, 0xc6d4, 0xe0f4, 0x87f6, 0xd4b2, 0x87f7, /*0x00-0x07*/ 0xc8a6, 0xe0f6, 0xe0f5, 0x87f8, 0x87f9, 0x87fa, 0x87fb, 0x87fc, /*0x08-0x0f*/ 0x87fd, 0x87fe, 0x8840, 0x8841, 0x8842, 0x8843, 0x8844, 0x8845, /*0x10-0x17*/ 0x8846, 0x8847, 0x8848, 0x8849, 0xe0f7, 0x884a, 0x884b, 0xcdc1, /*0x18-0x1f*/ 0x884c, 0x884d, 0x884e, 0xcaa5, 0x884f, 0x8850, 0x8851, 0x8852, /*0x20-0x27*/ 0xd4da, 0xdbd7, 0xdbd9, 0x8853, 0xdbd8, 0xb9e7, 0xdbdc, 0xdbdd, /*0x28-0x2f*/ 0xb5d8, 0x8854, 0x8855, 0xdbda, 0x8856, 0x8857, 0x8858, 0x8859, /*0x30-0x37*/ 0x885a, 0xdbdb, 0xb3a1, 0xdbdf, 0x885b, 0x885c, 0xbbf8, 0x885d, /*0x38-0x3f*/ 0xd6b7, 0x885e, 0xdbe0, 0x885f, 0x8860, 0x8861, 0x8862, 0xbef9, /*0x40-0x47*/ 0x8863, 0x8864, 0xb7bb, 0x8865, 0xdbd0, 0xccae, 0xbfb2, 0xbbb5, /*0x48-0x4f*/ 0xd7f8, 0xbfd3, 0x8866, 0x8867, 0x8868, 0x8869, 0x886a, 0xbfe9, /*0x50-0x57*/ 0x886b, 0x886c, 0xbce1, 0xccb3, 0xdbde, 0xb0d3, 0xceeb, 0xb7d8, /*0x58-0x5f*/ 0xd7b9, 0xc6c2, 0x886d, 0x886e, 0xc0a4, 0x886f, 0xccb9, 0x8870, /*0x60-0x67*/ 0xdbe7, 0xdbe1, 0xc6ba, 0xdbe3, 0x8871, 0xdbe8, 0x8872, 0xc5f7, /*0x68-0x6f*/ 0x8873, 0x8874, 0x8875, 0xdbea, 0x8876, 0x8877, 0xdbe9, 0xbfc0, /*0x70-0x77*/ 0x8878, 0x8879, 0x887a, 0xdbe6, 0xdbe5, 0x887b, 0x887c, 0x887d, /*0x78-0x7f*/ 0x887e, 0x8880, 0xb4b9, 0xc0ac, 0xc2a2, 0xdbe2, 0xdbe4, 0x8881, /*0x80-0x87*/ 0x8882, 0x8883, 0x8884, 0xd0cd, 0xdbed, 0x8885, 0x8886, 0x8887, /*0x88-0x8f*/ 0x8888, 0x8889, 0xc0dd, 0xdbf2, 0x888a, 0x888b, 0x888c, 0x888d, /*0x90-0x97*/ 0x888e, 0x888f, 0x8890, 0xb6e2, 0x8891, 0x8892, 0x8893, 0x8894, /*0x98-0x9f*/ 0xdbf3, 0xdbd2, 0xb9b8, 0xd4ab, 0xdbec, 0x8895, 0xbfd1, 0xdbf0, /*0xa0-0xa7*/ 0x8896, 0xdbd1, 0x8897, 0xb5e6, 0x8898, 0xdbeb, 0xbfe5, 0x8899, /*0xa8-0xaf*/ 0x889a, 0x889b, 0xdbee, 0x889c, 0xdbf1, 0x889d, 0x889e, 0x889f, /*0xb0-0xb7*/ 0xdbf9, 0x88a0, 0x88a1, 0x88a2, 0x88a3, 0x88a4, 0x88a5, 0x88a6, /*0xb8-0xbf*/ 0x88a7, 0x88a8, 0xb9a1, 0xb0a3, 0x88a9, 0x88aa, 0x88ab, 0x88ac, /*0xc0-0xc7*/ 0x88ad, 0x88ae, 0x88af, 0xc2f1, 0x88b0, 0x88b1, 0xb3c7, 0xdbef, /*0xc8-0xcf*/ 0x88b2, 0x88b3, 0xdbf8, 0x88b4, 0xc6d2, 0xdbf4, 0x88b5, 0x88b6, /*0xd0-0xd7*/ 0xdbf5, 0xdbf7, 0xdbf6, 0x88b7, 0x88b8, 0xdbfe, 0x88b9, 0xd3f2, /*0xd8-0xdf*/ 0xb2ba, 0x88ba, 0x88bb, 0x88bc, 0xdbfd, 0x88bd, 0x88be, 0x88bf, /*0xe0-0xe7*/ 0x88c0, 0x88c1, 0x88c2, 0x88c3, 0x88c4, 0xdca4, 0x88c5, 0xdbfb, /*0xe8-0xef*/ 0x88c6, 0x88c7, 0x88c8, 0x88c9, 0xdbfa, 0x88ca, 0x88cb, 0x88cc, /*0xf0-0xf7*/ 0xdbfc, 0xc5e0, 0xbbf9, 0x88cd, 0x88ce, 0xdca3, 0x88cf, 0x88d0, /*0xf8-0xff*/ /* 0x5800 */ 0xdca5, 0x88d1, 0xccc3, 0x88d2, 0x88d3, 0x88d4, 0xb6d1, 0xddc0, /*0x00-0x07*/ 0x88d5, 0x88d6, 0x88d7, 0xdca1, 0x88d8, 0xdca2, 0x88d9, 0x88da, /*0x08-0x0f*/ 0x88db, 0xc7b5, 0x88dc, 0x88dd, 0x88de, 0xb6e9, 0x88df, 0x88e0, /*0x10-0x17*/ 0x88e1, 0xdca7, 0x88e2, 0x88e3, 0x88e4, 0x88e5, 0xdca6, 0x88e6, /*0x18-0x1f*/ 0xdca9, 0xb1a4, 0x88e7, 0x88e8, 0xb5cc, 0x88e9, 0x88ea, 0x88eb, /*0x20-0x27*/ 0x88ec, 0x88ed, 0xbfb0, 0x88ee, 0x88ef, 0x88f0, 0x88f1, 0x88f2, /*0x28-0x2f*/ 0xd1df, 0x88f3, 0x88f4, 0x88f5, 0x88f6, 0xb6c2, 0x88f7, 0x88f8, /*0x30-0x37*/ 0x88f9, 0x88fa, 0x88fb, 0x88fc, 0x88fd, 0x88fe, 0x8940, 0x8941, /*0x38-0x3f*/ 0x8942, 0x8943, 0x8944, 0x8945, 0xdca8, 0x8946, 0x8947, 0x8948, /*0x40-0x47*/ 0x8949, 0x894a, 0x894b, 0x894c, 0xcbfa, 0xebf3, 0x894d, 0x894e, /*0x48-0x4f*/ 0x894f, 0xcbdc, 0x8950, 0x8951, 0xcbfe, 0x8952, 0x8953, 0x8954, /*0x50-0x57*/ 0xccc1, 0x8955, 0x8956, 0x8957, 0x8958, 0x8959, 0xc8fb, 0x895a, /*0x58-0x5f*/ 0x895b, 0x895c, 0x895d, 0x895e, 0x895f, 0xdcaa, 0x8960, 0x8961, /*0x60-0x67*/ 0x8962, 0x8963, 0x8964, 0xccee, 0xdcab, 0x8965, 0x8966, 0x8967, /*0x68-0x6f*/ 0x8968, 0x8969, 0x896a, 0x896b, 0x896c, 0x896d, 0x896e, 0x896f, /*0x70-0x77*/ 0x8970, 0x8971, 0x8972, 0x8973, 0x8974, 0x8975, 0xdbd3, 0x8976, /*0x78-0x7f*/ 0xdcaf, 0xdcac, 0x8977, 0xbeb3, 0x8978, 0xcafb, 0x8979, 0x897a, /*0x80-0x87*/ 0x897b, 0xdcad, 0x897c, 0x897d, 0x897e, 0x8980, 0x8981, 0x8982, /*0x88-0x8f*/ 0x8983, 0x8984, 0xc9ca, 0xc4b9, 0x8985, 0x8986, 0x8987, 0x8988, /*0x90-0x97*/ 0x8989, 0xc7bd, 0xdcae, 0x898a, 0x898b, 0x898c, 0xd4f6, 0xd0e6, /*0x98-0x9f*/ 0x898d, 0x898e, 0x898f, 0x8990, 0x8991, 0x8992, 0x8993, 0x8994, /*0xa0-0xa7*/ 0xc4ab, 0xb6d5, 0x8995, 0x8996, 0x8997, 0x8998, 0x8999, 0x899a, /*0xa8-0xaf*/ 0x899b, 0x899c, 0x899d, 0x899e, 0x899f, 0x89a0, 0x89a1, 0x89a2, /*0xb0-0xb7*/ 0x89a3, 0x89a4, 0x89a5, 0x89a6, 0xdbd4, 0x89a7, 0x89a8, 0x89a9, /*0xb8-0xbf*/ 0x89aa, 0xb1da, 0x89ab, 0x89ac, 0x89ad, 0xdbd5, 0x89ae, 0x89af, /*0xc0-0xc7*/ 0x89b0, 0x89b1, 0x89b2, 0x89b3, 0x89b4, 0x89b5, 0x89b6, 0x89b7, /*0xc8-0xcf*/ 0x89b8, 0xdbd6, 0x89b9, 0x89ba, 0x89bb, 0xbabe, 0x89bc, 0x89bd, /*0xd0-0xd7*/ 0x89be, 0x89bf, 0x89c0, 0x89c1, 0x89c2, 0x89c3, 0x89c4, 0x89c5, /*0xd8-0xdf*/ 0x89c6, 0x89c7, 0x89c8, 0x89c9, 0xc8c0, 0x89ca, 0x89cb, 0x89cc, /*0xe0-0xe7*/ 0x89cd, 0x89ce, 0x89cf, 0xcabf, 0xc8c9, 0x89d0, 0xd7b3, 0x89d1, /*0xe8-0xef*/ 0xc9f9, 0x89d2, 0x89d3, 0xbfc7, 0x89d4, 0x89d5, 0xbaf8, 0x89d6, /*0xf0-0xf7*/ 0x89d7, 0xd2bc, 0x89d8, 0x89d9, 0x89da, 0x89db, 0x89dc, 0x89dd, /*0xf8-0xff*/ /* 0x5900 */ 0x89de, 0x89df, 0xe2ba, 0x89e0, 0xb4a6, 0x89e1, 0x89e2, 0xb1b8, /*0x00-0x07*/ 0x89e3, 0x89e4, 0x89e5, 0x89e6, 0x89e7, 0xb8b4, 0x89e8, 0xcfc4, /*0x08-0x0f*/ 0x89e9, 0x89ea, 0x89eb, 0x89ec, 0xd9e7, 0xcfa6, 0xcde2, 0x89ed, /*0x10-0x17*/ 0x89ee, 0xd9ed, 0xb6e0, 0x89ef, 0xd2b9, 0x89f0, 0x89f1, 0xb9bb, /*0x18-0x1f*/ 0x89f2, 0x89f3, 0x89f4, 0x89f5, 0xe2b9, 0xe2b7, 0x89f6, 0xb4f3, /*0x20-0x27*/ 0x89f7, 0xccec, 0xccab, 0xb7f2, 0x89f8, 0xd8b2, 0xd1eb, 0xbabb, /*0x28-0x2f*/ 0x89f9, 0xcaa7, 0x89fa, 0x89fb, 0xcdb7, 0x89fc, 0x89fd, 0xd2c4, /*0x30-0x37*/ 0xbfe4, 0xbcd0, 0xb6e1, 0x89fe, 0xdec5, 0x8a40, 0x8a41, 0x8a42, /*0x38-0x3f*/ 0x8a43, 0xdec6, 0xdbbc, 0x8a44, 0xd1d9, 0x8a45, 0x8a46, 0xc6e6, /*0x40-0x47*/ 0xc4ce, 0xb7ee, 0x8a47, 0xb7dc, 0x8a48, 0x8a49, 0xbffc, 0xd7e0, /*0x48-0x4f*/ 0x8a4a, 0xc6f5, 0x8a4b, 0x8a4c, 0xb1bc, 0xdec8, 0xbdb1, 0xccd7, /*0x50-0x57*/ 0xdeca, 0x8a4d, 0xdec9, 0x8a4e, 0x8a4f, 0x8a50, 0x8a51, 0x8a52, /*0x58-0x5f*/ 0xb5ec, 0x8a53, 0xc9dd, 0x8a54, 0x8a55, 0xb0c2, 0x8a56, 0x8a57, /*0x60-0x67*/ 0x8a58, 0x8a59, 0x8a5a, 0x8a5b, 0x8a5c, 0x8a5d, 0x8a5e, 0x8a5f, /*0x68-0x6f*/ 0x8a60, 0x8a61, 0x8a62, 0xc5ae, 0xc5ab, 0x8a63, 0xc4cc, 0x8a64, /*0x70-0x77*/ 0xbce9, 0xcbfd, 0x8a65, 0x8a66, 0x8a67, 0xbac3, 0x8a68, 0x8a69, /*0x78-0x7f*/ 0x8a6a, 0xe5f9, 0xc8e7, 0xe5fa, 0xcdfd, 0x8a6b, 0xd7b1, 0xb8be, /*0x80-0x87*/ 0xc2e8, 0x8a6c, 0xc8d1, 0x8a6d, 0x8a6e, 0xe5fb, 0x8a6f, 0x8a70, /*0x88-0x8f*/ 0x8a71, 0x8a72, 0xb6ca, 0xbccb, 0x8a73, 0x8a74, 0xd1fd, 0xe6a1, /*0x90-0x97*/ 0x8a75, 0xc3ee, 0x8a76, 0x8a77, 0x8a78, 0x8a79, 0xe6a4, 0x8a7a, /*0x98-0x9f*/ 0x8a7b, 0x8a7c, 0x8a7d, 0xe5fe, 0xe6a5, 0xcdd7, 0x8a7e, 0x8a80, /*0xa0-0xa7*/ 0xb7c1, 0xe5fc, 0xe5fd, 0xe6a3, 0x8a81, 0x8a82, 0xc4dd, 0xe6a8, /*0xa8-0xaf*/ 0x8a83, 0x8a84, 0xe6a7, 0x8a85, 0x8a86, 0x8a87, 0x8a88, 0x8a89, /*0xb0-0xb7*/ 0x8a8a, 0xc3c3, 0x8a8b, 0xc6de, 0x8a8c, 0x8a8d, 0xe6aa, 0x8a8e, /*0xb8-0xbf*/ 0x8a8f, 0x8a90, 0x8a91, 0x8a92, 0x8a93, 0x8a94, 0xc4b7, 0x8a95, /*0xc0-0xc7*/ 0x8a96, 0x8a97, 0xe6a2, 0xcabc, 0x8a98, 0x8a99, 0x8a9a, 0x8a9b, /*0xc8-0xcf*/ 0xbde3, 0xb9c3, 0xe6a6, 0xd0d5, 0xceaf, 0x8a9c, 0x8a9d, 0xe6a9, /*0xd0-0xd7*/ 0xe6b0, 0x8a9e, 0xd2a6, 0x8a9f, 0xbdaa, 0xe6ad, 0x8aa0, 0x8aa1, /*0xd8-0xdf*/ 0x8aa2, 0x8aa3, 0x8aa4, 0xe6af, 0x8aa5, 0xc0d1, 0x8aa6, 0x8aa7, /*0xe0-0xe7*/ 0xd2cc, 0x8aa8, 0x8aa9, 0x8aaa, 0xbca7, 0x8aab, 0x8aac, 0x8aad, /*0xe8-0xef*/ 0x8aae, 0x8aaf, 0x8ab0, 0x8ab1, 0x8ab2, 0x8ab3, 0x8ab4, 0x8ab5, /*0xf0-0xf7*/ 0x8ab6, 0xe6b1, 0x8ab7, 0xd2f6, 0x8ab8, 0x8ab9, 0x8aba, 0xd7cb, /*0xf8-0xff*/ /* 0x5a00 */ 0x8abb, 0xcdfe, 0x8abc, 0xcdde, 0xc2a6, 0xe6ab, 0xe6ac, 0xbdbf, /*0x00-0x07*/ 0xe6ae, 0xe6b3, 0x8abd, 0x8abe, 0xe6b2, 0x8abf, 0x8ac0, 0x8ac1, /*0x08-0x0f*/ 0x8ac2, 0xe6b6, 0x8ac3, 0xe6b8, 0x8ac4, 0x8ac5, 0x8ac6, 0x8ac7, /*0x10-0x17*/ 0xc4ef, 0x8ac8, 0x8ac9, 0x8aca, 0xc4c8, 0x8acb, 0x8acc, 0xbeea, /*0x18-0x1f*/ 0xc9ef, 0x8acd, 0x8ace, 0xe6b7, 0x8acf, 0xb6f0, 0x8ad0, 0x8ad1, /*0x20-0x27*/ 0x8ad2, 0xc3e4, 0x8ad3, 0x8ad4, 0x8ad5, 0x8ad6, 0x8ad7, 0x8ad8, /*0x28-0x2f*/ 0x8ad9, 0xd3e9, 0xe6b4, 0x8ada, 0xe6b5, 0x8adb, 0xc8a2, 0x8adc, /*0x30-0x37*/ 0x8add, 0x8ade, 0x8adf, 0x8ae0, 0xe6bd, 0x8ae1, 0x8ae2, 0x8ae3, /*0x38-0x3f*/ 0xe6b9, 0x8ae4, 0x8ae5, 0x8ae6, 0x8ae7, 0x8ae8, 0xc6c5, 0x8ae9, /*0x40-0x47*/ 0x8aea, 0xcdf1, 0xe6bb, 0x8aeb, 0x8aec, 0x8aed, 0x8aee, 0x8aef, /*0x48-0x4f*/ 0x8af0, 0x8af1, 0x8af2, 0x8af3, 0x8af4, 0xe6bc, 0x8af5, 0x8af6, /*0x50-0x57*/ 0x8af7, 0x8af8, 0xbbe9, 0x8af9, 0x8afa, 0x8afb, 0x8afc, 0x8afd, /*0x58-0x5f*/ 0x8afe, 0x8b40, 0xe6be, 0x8b41, 0x8b42, 0x8b43, 0x8b44, 0xe6ba, /*0x60-0x67*/ 0x8b45, 0x8b46, 0xc0b7, 0x8b47, 0x8b48, 0x8b49, 0x8b4a, 0x8b4b, /*0x68-0x6f*/ 0x8b4c, 0x8b4d, 0x8b4e, 0x8b4f, 0xd3a4, 0xe6bf, 0xc9f4, 0xe6c3, /*0x70-0x77*/ 0x8b50, 0x8b51, 0xe6c4, 0x8b52, 0x8b53, 0x8b54, 0x8b55, 0xd0f6, /*0x78-0x7f*/ 0x8b56, 0x8b57, 0x8b58, 0x8b59, 0x8b5a, 0x8b5b, 0x8b5c, 0x8b5d, /*0x80-0x87*/ 0x8b5e, 0x8b5f, 0x8b60, 0x8b61, 0x8b62, 0x8b63, 0x8b64, 0x8b65, /*0x88-0x8f*/ 0x8b66, 0x8b67, 0xc3bd, 0x8b68, 0x8b69, 0x8b6a, 0x8b6b, 0x8b6c, /*0x90-0x97*/ 0x8b6d, 0x8b6e, 0xc3c4, 0xe6c2, 0x8b6f, 0x8b70, 0x8b71, 0x8b72, /*0x98-0x9f*/ 0x8b73, 0x8b74, 0x8b75, 0x8b76, 0x8b77, 0x8b78, 0x8b79, 0x8b7a, /*0xa0-0xa7*/ 0x8b7b, 0x8b7c, 0xe6c1, 0x8b7d, 0x8b7e, 0x8b80, 0x8b81, 0x8b82, /*0xa8-0xaf*/ 0x8b83, 0x8b84, 0xe6c7, 0xcfb1, 0x8b85, 0xebf4, 0x8b86, 0x8b87, /*0xb0-0xb7*/ 0xe6ca, 0x8b88, 0x8b89, 0x8b8a, 0x8b8b, 0x8b8c, 0xe6c5, 0x8b8d, /*0xb8-0xbf*/ 0x8b8e, 0xbcde, 0xc9a9, 0x8b8f, 0x8b90, 0x8b91, 0x8b92, 0x8b93, /*0xc0-0xc7*/ 0x8b94, 0xbcb5, 0x8b95, 0x8b96, 0xcfd3, 0x8b97, 0x8b98, 0x8b99, /*0xc8-0xcf*/ 0x8b9a, 0x8b9b, 0xe6c8, 0x8b9c, 0xe6c9, 0x8b9d, 0xe6ce, 0x8b9e, /*0xd0-0xd7*/ 0xe6d0, 0x8b9f, 0x8ba0, 0x8ba1, 0xe6d1, 0x8ba2, 0x8ba3, 0x8ba4, /*0xd8-0xdf*/ 0xe6cb, 0xb5d5, 0x8ba5, 0xe6cc, 0x8ba6, 0x8ba7, 0xe6cf, 0x8ba8, /*0xe0-0xe7*/ 0x8ba9, 0xc4db, 0x8baa, 0xe6c6, 0x8bab, 0x8bac, 0x8bad, 0x8bae, /*0xe8-0xef*/ 0x8baf, 0xe6cd, 0x8bb0, 0x8bb1, 0x8bb2, 0x8bb3, 0x8bb4, 0x8bb5, /*0xf0-0xf7*/ 0x8bb6, 0x8bb7, 0x8bb8, 0x8bb9, 0x8bba, 0x8bbb, 0x8bbc, 0x8bbd, /*0xf8-0xff*/ /* 0x5b00 */ 0x8bbe, 0x8bbf, 0x8bc0, 0x8bc1, 0x8bc2, 0x8bc3, 0x8bc4, 0x8bc5, /*0x00-0x07*/ 0x8bc6, 0xe6d2, 0x8bc7, 0x8bc8, 0x8bc9, 0x8bca, 0x8bcb, 0x8bcc, /*0x08-0x0f*/ 0x8bcd, 0x8bce, 0x8bcf, 0x8bd0, 0x8bd1, 0x8bd2, 0xe6d4, 0xe6d3, /*0x10-0x17*/ 0x8bd3, 0x8bd4, 0x8bd5, 0x8bd6, 0x8bd7, 0x8bd8, 0x8bd9, 0x8bda, /*0x18-0x1f*/ 0x8bdb, 0x8bdc, 0x8bdd, 0x8bde, 0x8bdf, 0x8be0, 0x8be1, 0x8be2, /*0x20-0x27*/ 0x8be3, 0x8be4, 0x8be5, 0x8be6, 0x8be7, 0x8be8, 0x8be9, 0x8bea, /*0x28-0x2f*/ 0x8beb, 0x8bec, 0xe6d5, 0x8bed, 0xd9f8, 0x8bee, 0x8bef, 0xe6d6, /*0x30-0x37*/ 0x8bf0, 0x8bf1, 0x8bf2, 0x8bf3, 0x8bf4, 0x8bf5, 0x8bf6, 0x8bf7, /*0x38-0x3f*/ 0xe6d7, 0x8bf8, 0x8bf9, 0x8bfa, 0x8bfb, 0x8bfc, 0x8bfd, 0x8bfe, /*0x40-0x47*/ 0x8c40, 0x8c41, 0x8c42, 0x8c43, 0x8c44, 0x8c45, 0x8c46, 0x8c47, /*0x48-0x4f*/ 0xd7d3, 0xe6dd, 0x8c48, 0xe6de, 0xbfd7, 0xd4d0, 0x8c49, 0xd7d6, /*0x50-0x57*/ 0xb4e6, 0xcbef, 0xe6da, 0xd8c3, 0xd7ce, 0xd0a2, 0x8c4a, 0xc3cf, /*0x58-0x5f*/ 0x8c4b, 0x8c4c, 0xe6df, 0xbcbe, 0xb9c2, 0xe6db, 0xd1a7, 0x8c4d, /*0x60-0x67*/ 0x8c4e, 0xbaa2, 0xc2cf, 0x8c4f, 0xd8ab, 0x8c50, 0x8c51, 0x8c52, /*0x68-0x6f*/ 0xcaeb, 0xe5ee, 0x8c53, 0xe6dc, 0x8c54, 0xb7f5, 0x8c55, 0x8c56, /*0x70-0x77*/ 0x8c57, 0x8c58, 0xc8e6, 0x8c59, 0x8c5a, 0xc4f5, 0x8c5b, 0x8c5c, /*0x78-0x7f*/ 0xe5b2, 0xc4fe, 0x8c5d, 0xcbfc, 0xe5b3, 0xd5ac, 0x8c5e, 0xd3ee, /*0x80-0x87*/ 0xcad8, 0xb0b2, 0x8c5f, 0xcbce, 0xcdea, 0x8c60, 0x8c61, 0xbaea, /*0x88-0x8f*/ 0x8c62, 0x8c63, 0x8c64, 0xe5b5, 0x8c65, 0xe5b4, 0x8c66, 0xd7da, /*0x90-0x97*/ 0xb9d9, 0xd6e6, 0xb6a8, 0xcdf0, 0xd2cb, 0xb1a6, 0xcab5, 0x8c67, /*0x98-0x9f*/ 0xb3e8, 0xc9f3, 0xbfcd, 0xd0fb, 0xcad2, 0xe5b6, 0xbbc2, 0x8c68, /*0xa0-0xa7*/ 0x8c69, 0x8c6a, 0xcfdc, 0xb9ac, 0x8c6b, 0x8c6c, 0x8c6d, 0x8c6e, /*0xa8-0xaf*/ 0xd4d7, 0x8c6f, 0x8c70, 0xbaa6, 0xd1e7, 0xcffc, 0xbcd2, 0x8c71, /*0xb0-0xb7*/ 0xe5b7, 0xc8dd, 0x8c72, 0x8c73, 0x8c74, 0xbfed, 0xb1f6, 0xcbde, /*0xb8-0xbf*/ 0x8c75, 0x8c76, 0xbcc5, 0x8c77, 0xbcc4, 0xd2fa, 0xc3dc, 0xbfdc, /*0xc0-0xc7*/ 0x8c78, 0x8c79, 0x8c7a, 0x8c7b, 0xb8bb, 0x8c7c, 0x8c7d, 0x8c7e, /*0xc8-0xcf*/ 0xc3c2, 0x8c80, 0xbaae, 0xd4a2, 0x8c81, 0x8c82, 0x8c83, 0x8c84, /*0xd0-0xd7*/ 0x8c85, 0x8c86, 0x8c87, 0x8c88, 0x8c89, 0xc7de, 0xc4af, 0xb2ec, /*0xd8-0xdf*/ 0x8c8a, 0xb9d1, 0x8c8b, 0x8c8c, 0xe5bb, 0xc1c8, 0x8c8d, 0x8c8e, /*0xe0-0xe7*/ 0xd5af, 0x8c8f, 0x8c90, 0x8c91, 0x8c92, 0x8c93, 0xe5bc, 0x8c94, /*0xe8-0xef*/ 0xe5be, 0x8c95, 0x8c96, 0x8c97, 0x8c98, 0x8c99, 0x8c9a, 0x8c9b, /*0xf0-0xf7*/ 0xb4e7, 0xb6d4, 0xcbc2, 0xd1b0, 0xb5bc, 0x8c9c, 0x8c9d, 0xcad9, /*0xf8-0xff*/ /* 0x5c00 */ 0x8c9e, 0xb7e2, 0x8c9f, 0x8ca0, 0xc9e4, 0x8ca1, 0xbdab, 0x8ca2, /*0x00-0x07*/ 0x8ca3, 0xcebe, 0xd7f0, 0x8ca4, 0x8ca5, 0x8ca6, 0x8ca7, 0xd0a1, /*0x08-0x0f*/ 0x8ca8, 0xc9d9, 0x8ca9, 0x8caa, 0xb6fb, 0xe6d8, 0xbce2, 0x8cab, /*0x10-0x17*/ 0xb3be, 0x8cac, 0xc9d0, 0x8cad, 0xe6d9, 0xb3a2, 0x8cae, 0x8caf, /*0x18-0x1f*/ 0x8cb0, 0x8cb1, 0xdecc, 0x8cb2, 0xd3c8, 0xdecd, 0x8cb3, 0xd2a2, /*0x20-0x27*/ 0x8cb4, 0x8cb5, 0x8cb6, 0x8cb7, 0xdece, 0x8cb8, 0x8cb9, 0x8cba, /*0x28-0x2f*/ 0x8cbb, 0xbecd, 0x8cbc, 0x8cbd, 0xdecf, 0x8cbe, 0x8cbf, 0x8cc0, /*0x30-0x37*/ 0xcaac, 0xd2fc, 0xb3df, 0xe5ea, 0xc4e1, 0xbea1, 0xceb2, 0xc4f2, /*0x38-0x3f*/ 0xbed6, 0xc6a8, 0xb2e3, 0x8cc1, 0x8cc2, 0xbed3, 0x8cc3, 0x8cc4, /*0x40-0x47*/ 0xc7fc, 0xcceb, 0xbdec, 0xcedd, 0x8cc5, 0x8cc6, 0xcaba, 0xc6c1, /*0x48-0x4f*/ 0xe5ec, 0xd0bc, 0x8cc7, 0x8cc8, 0x8cc9, 0xd5b9, 0x8cca, 0x8ccb, /*0x50-0x57*/ 0x8ccc, 0xe5ed, 0x8ccd, 0x8cce, 0x8ccf, 0x8cd0, 0xcaf4, 0x8cd1, /*0x58-0x5f*/ 0xcdc0, 0xc2c5, 0x8cd2, 0xe5ef, 0x8cd3, 0xc2c4, 0xe5f0, 0x8cd4, /*0x60-0x67*/ 0x8cd5, 0x8cd6, 0x8cd7, 0x8cd8, 0x8cd9, 0x8cda, 0xe5f8, 0xcdcd, /*0x68-0x6f*/ 0x8cdb, 0xc9bd, 0x8cdc, 0x8cdd, 0x8cde, 0x8cdf, 0x8ce0, 0x8ce1, /*0x70-0x77*/ 0x8ce2, 0xd2d9, 0xe1a8, 0x8ce3, 0x8ce4, 0x8ce5, 0x8ce6, 0xd3ec, /*0x78-0x7f*/ 0x8ce7, 0xcbea, 0xc6f1, 0x8ce8, 0x8ce9, 0x8cea, 0x8ceb, 0x8cec, /*0x80-0x87*/ 0xe1ac, 0x8ced, 0x8cee, 0x8cef, 0xe1a7, 0xe1a9, 0x8cf0, 0x8cf1, /*0x88-0x8f*/ 0xe1aa, 0xe1af, 0x8cf2, 0x8cf3, 0xb2ed, 0x8cf4, 0xe1ab, 0xb8da, /*0x90-0x97*/ 0xe1ad, 0xe1ae, 0xe1b0, 0xb5ba, 0xe1b1, 0x8cf5, 0x8cf6, 0x8cf7, /*0x98-0x9f*/ 0x8cf8, 0x8cf9, 0xe1b3, 0xe1b8, 0x8cfa, 0x8cfb, 0x8cfc, 0x8cfd, /*0xa0-0xa7*/ 0x8cfe, 0xd1d2, 0x8d40, 0xe1b6, 0xe1b5, 0xc1eb, 0x8d41, 0x8d42, /*0xa8-0xaf*/ 0x8d43, 0xe1b7, 0x8d44, 0xd4c0, 0x8d45, 0xe1b2, 0x8d46, 0xe1ba, /*0xb0-0xb7*/ 0xb0b6, 0x8d47, 0x8d48, 0x8d49, 0x8d4a, 0xe1b4, 0x8d4b, 0xbff9, /*0xb8-0xbf*/ 0x8d4c, 0xe1b9, 0x8d4d, 0x8d4e, 0xe1bb, 0x8d4f, 0x8d50, 0x8d51, /*0xc0-0xc7*/ 0x8d52, 0x8d53, 0x8d54, 0xe1be, 0x8d55, 0x8d56, 0x8d57, 0x8d58, /*0xc8-0xcf*/ 0x8d59, 0x8d5a, 0xe1bc, 0x8d5b, 0x8d5c, 0x8d5d, 0x8d5e, 0x8d5f, /*0xd0-0xd7*/ 0x8d60, 0xd6c5, 0x8d61, 0x8d62, 0x8d63, 0x8d64, 0x8d65, 0x8d66, /*0xd8-0xdf*/ 0x8d67, 0xcfbf, 0x8d68, 0x8d69, 0xe1bd, 0xe1bf, 0xc2cd, 0x8d6a, /*0xe0-0xe7*/ 0xb6eb, 0x8d6b, 0xd3f8, 0x8d6c, 0x8d6d, 0xc7cd, 0x8d6e, 0x8d6f, /*0xe8-0xef*/ 0xb7e5, 0x8d70, 0x8d71, 0x8d72, 0x8d73, 0x8d74, 0x8d75, 0x8d76, /*0xf0-0xf7*/ 0x8d77, 0x8d78, 0x8d79, 0xbefe, 0x8d7a, 0x8d7b, 0x8d7c, 0x8d7d, /*0xf8-0xff*/ /* 0x5d00 */ 0x8d7e, 0x8d80, 0xe1c0, 0xe1c1, 0x8d81, 0x8d82, 0xe1c7, 0xb3e7, /*0x00-0x07*/ 0x8d83, 0x8d84, 0x8d85, 0x8d86, 0x8d87, 0x8d88, 0xc6e9, 0x8d89, /*0x08-0x0f*/ 0x8d8a, 0x8d8b, 0x8d8c, 0x8d8d, 0xb4de, 0x8d8e, 0xd1c2, 0x8d8f, /*0x10-0x17*/ 0x8d90, 0x8d91, 0x8d92, 0xe1c8, 0x8d93, 0x8d94, 0xe1c6, 0x8d95, /*0x18-0x1f*/ 0x8d96, 0x8d97, 0x8d98, 0x8d99, 0xe1c5, 0x8d9a, 0xe1c3, 0xe1c2, /*0x20-0x27*/ 0x8d9b, 0xb1c0, 0x8d9c, 0x8d9d, 0x8d9e, 0xd5b8, 0xe1c4, 0x8d9f, /*0x28-0x2f*/ 0x8da0, 0x8da1, 0x8da2, 0x8da3, 0xe1cb, 0x8da4, 0x8da5, 0x8da6, /*0x30-0x37*/ 0x8da7, 0x8da8, 0x8da9, 0x8daa, 0x8dab, 0xe1cc, 0xe1ca, 0x8dac, /*0x38-0x3f*/ 0x8dad, 0x8dae, 0x8daf, 0x8db0, 0x8db1, 0x8db2, 0x8db3, 0xeffa, /*0x40-0x47*/ 0x8db4, 0x8db5, 0xe1d3, 0xe1d2, 0xc7b6, 0x8db6, 0x8db7, 0x8db8, /*0x48-0x4f*/ 0x8db9, 0x8dba, 0x8dbb, 0x8dbc, 0x8dbd, 0x8dbe, 0x8dbf, 0x8dc0, /*0x50-0x57*/ 0xe1c9, 0x8dc1, 0x8dc2, 0xe1ce, 0x8dc3, 0xe1d0, 0x8dc4, 0x8dc5, /*0x58-0x5f*/ 0x8dc6, 0x8dc7, 0x8dc8, 0x8dc9, 0x8dca, 0x8dcb, 0x8dcc, 0x8dcd, /*0x60-0x67*/ 0x8dce, 0xe1d4, 0x8dcf, 0xe1d1, 0xe1cd, 0x8dd0, 0x8dd1, 0xe1cf, /*0x68-0x6f*/ 0x8dd2, 0x8dd3, 0x8dd4, 0x8dd5, 0xe1d5, 0x8dd6, 0x8dd7, 0x8dd8, /*0x70-0x77*/ 0x8dd9, 0x8dda, 0x8ddb, 0x8ddc, 0x8ddd, 0x8dde, 0x8ddf, 0x8de0, /*0x78-0x7f*/ 0x8de1, 0x8de2, 0xe1d6, 0x8de3, 0x8de4, 0x8de5, 0x8de6, 0x8de7, /*0x80-0x87*/ 0x8de8, 0x8de9, 0x8dea, 0x8deb, 0x8dec, 0x8ded, 0x8dee, 0x8def, /*0x88-0x8f*/ 0x8df0, 0x8df1, 0x8df2, 0x8df3, 0x8df4, 0x8df5, 0x8df6, 0x8df7, /*0x90-0x97*/ 0x8df8, 0xe1d7, 0x8df9, 0x8dfa, 0x8dfb, 0xe1d8, 0x8dfc, 0x8dfd, /*0x98-0x9f*/ 0x8dfe, 0x8e40, 0x8e41, 0x8e42, 0x8e43, 0x8e44, 0x8e45, 0x8e46, /*0xa0-0xa7*/ 0x8e47, 0x8e48, 0x8e49, 0x8e4a, 0x8e4b, 0x8e4c, 0x8e4d, 0x8e4e, /*0xa8-0xaf*/ 0x8e4f, 0x8e50, 0x8e51, 0x8e52, 0x8e53, 0x8e54, 0x8e55, 0xe1da, /*0xb0-0xb7*/ 0x8e56, 0x8e57, 0x8e58, 0x8e59, 0x8e5a, 0x8e5b, 0x8e5c, 0x8e5d, /*0xb8-0xbf*/ 0x8e5e, 0x8e5f, 0x8e60, 0x8e61, 0x8e62, 0xe1db, 0x8e63, 0x8e64, /*0xc0-0xc7*/ 0x8e65, 0x8e66, 0x8e67, 0x8e68, 0x8e69, 0xcea1, 0x8e6a, 0x8e6b, /*0xc8-0xcf*/ 0x8e6c, 0x8e6d, 0x8e6e, 0x8e6f, 0x8e70, 0x8e71, 0x8e72, 0x8e73, /*0xd0-0xd7*/ 0x8e74, 0x8e75, 0x8e76, 0xe7dd, 0x8e77, 0xb4a8, 0xd6dd, 0x8e78, /*0xd8-0xdf*/ 0x8e79, 0xd1b2, 0xb3b2, 0x8e7a, 0x8e7b, 0xb9a4, 0xd7f3, 0xc7c9, /*0xe0-0xe7*/ 0xbede, 0xb9ae, 0x8e7c, 0xced7, 0x8e7d, 0x8e7e, 0xb2ee, 0xdbcf, /*0xe8-0xef*/ 0x8e80, 0xbcba, 0xd2d1, 0xcbc8, 0xb0cd, 0x8e81, 0x8e82, 0xcfef, /*0xf0-0xf7*/ 0x8e83, 0x8e84, 0x8e85, 0x8e86, 0x8e87, 0xd9e3, 0xbded, 0x8e88, /*0xf8-0xff*/ /* 0x5e00 */ 0x8e89, 0xb1d2, 0xcad0, 0xb2bc, 0x8e8a, 0xcba7, 0xb7ab, 0x8e8b, /*0x00-0x07*/ 0xcaa6, 0x8e8c, 0x8e8d, 0x8e8e, 0xcfa3, 0x8e8f, 0x8e90, 0xe0f8, /*0x08-0x0f*/ 0xd5ca, 0xe0fb, 0x8e91, 0x8e92, 0xe0fa, 0xc5c1, 0xccfb, 0x8e93, /*0x10-0x17*/ 0xc1b1, 0xe0f9, 0xd6e3, 0xb2af, 0xd6c4, 0xb5db, 0x8e94, 0x8e95, /*0x18-0x1f*/ 0x8e96, 0x8e97, 0x8e98, 0x8e99, 0x8e9a, 0x8e9b, 0xb4f8, 0xd6a1, /*0x20-0x27*/ 0x8e9c, 0x8e9d, 0x8e9e, 0x8e9f, 0x8ea0, 0xcfaf, 0xb0ef, 0x8ea1, /*0x28-0x2f*/ 0x8ea2, 0xe0fc, 0x8ea3, 0x8ea4, 0x8ea5, 0x8ea6, 0x8ea7, 0xe1a1, /*0x30-0x37*/ 0xb3a3, 0x8ea8, 0x8ea9, 0xe0fd, 0xe0fe, 0xc3b1, 0x8eaa, 0x8eab, /*0x38-0x3f*/ 0x8eac, 0x8ead, 0xc3dd, 0x8eae, 0xe1a2, 0xb7f9, 0x8eaf, 0x8eb0, /*0x40-0x47*/ 0x8eb1, 0x8eb2, 0x8eb3, 0x8eb4, 0xbbcf, 0x8eb5, 0x8eb6, 0x8eb7, /*0x48-0x4f*/ 0x8eb8, 0x8eb9, 0x8eba, 0x8ebb, 0xe1a3, 0xc4bb, 0x8ebc, 0x8ebd, /*0x50-0x57*/ 0x8ebe, 0x8ebf, 0x8ec0, 0xe1a4, 0x8ec1, 0x8ec2, 0xe1a5, 0x8ec3, /*0x58-0x5f*/ 0x8ec4, 0xe1a6, 0xb4b1, 0x8ec5, 0x8ec6, 0x8ec7, 0x8ec8, 0x8ec9, /*0x60-0x67*/ 0x8eca, 0x8ecb, 0x8ecc, 0x8ecd, 0x8ece, 0x8ecf, 0x8ed0, 0x8ed1, /*0x68-0x6f*/ 0x8ed2, 0x8ed3, 0xb8c9, 0xc6bd, 0xc4ea, 0x8ed4, 0xb2a2, 0x8ed5, /*0x70-0x77*/ 0xd0d2, 0x8ed6, 0xe7db, 0xbbc3, 0xd3d7, 0xd3c4, 0x8ed7, 0xb9e3, /*0x78-0x7f*/ 0xe2cf, 0x8ed8, 0x8ed9, 0x8eda, 0xd7af, 0x8edb, 0xc7ec, 0xb1d3, /*0x80-0x87*/ 0x8edc, 0x8edd, 0xb4b2, 0xe2d1, 0x8ede, 0x8edf, 0x8ee0, 0xd0f2, /*0x88-0x8f*/ 0xc2ae, 0xe2d0, 0x8ee1, 0xbfe2, 0xd3a6, 0xb5d7, 0xe2d2, 0xb5ea, /*0x90-0x97*/ 0x8ee2, 0xc3ed, 0xb8fd, 0x8ee3, 0xb8ae, 0x8ee4, 0xc5d3, 0xb7cf, /*0x98-0x9f*/ 0xe2d4, 0x8ee5, 0x8ee6, 0x8ee7, 0x8ee8, 0xe2d3, 0xb6c8, 0xd7f9, /*0xa0-0xa7*/ 0x8ee9, 0x8eea, 0x8eeb, 0x8eec, 0x8eed, 0xcda5, 0x8eee, 0x8eef, /*0xa8-0xaf*/ 0x8ef0, 0x8ef1, 0x8ef2, 0xe2d8, 0x8ef3, 0xe2d6, 0xcafc, 0xbfb5, /*0xb0-0xb7*/ 0xd3b9, 0xe2d5, 0x8ef4, 0x8ef5, 0x8ef6, 0x8ef7, 0xe2d7, 0x8ef8, /*0xb8-0xbf*/ 0x8ef9, 0x8efa, 0x8efb, 0x8efc, 0x8efd, 0x8efe, 0x8f40, 0x8f41, /*0xc0-0xc7*/ 0x8f42, 0xc1ae, 0xc0c8, 0x8f43, 0x8f44, 0x8f45, 0x8f46, 0x8f47, /*0xc8-0xcf*/ 0x8f48, 0xe2db, 0xe2da, 0xc0aa, 0x8f49, 0x8f4a, 0xc1ce, 0x8f4b, /*0xd0-0xd7*/ 0x8f4c, 0x8f4d, 0x8f4e, 0xe2dc, 0x8f4f, 0x8f50, 0x8f51, 0x8f52, /*0xd8-0xdf*/ 0x8f53, 0x8f54, 0x8f55, 0x8f56, 0x8f57, 0x8f58, 0x8f59, 0x8f5a, /*0xe0-0xe7*/ 0xe2dd, 0x8f5b, 0xe2de, 0x8f5c, 0x8f5d, 0x8f5e, 0x8f5f, 0x8f60, /*0xe8-0xef*/ 0x8f61, 0x8f62, 0x8f63, 0x8f64, 0xdbc8, 0x8f65, 0xd1d3, 0xcda2, /*0xf0-0xf7*/ 0x8f66, 0x8f67, 0xbda8, 0x8f68, 0x8f69, 0x8f6a, 0xdec3, 0xd8a5, /*0xf8-0xff*/ /* 0x5f00 */ 0xbfaa, 0xdbcd, 0xd2ec, 0xc6fa, 0xc5aa, 0x8f6b, 0x8f6c, 0x8f6d, /*0x00-0x07*/ 0xdec4, 0x8f6e, 0xb1d7, 0xdfae, 0x8f6f, 0x8f70, 0x8f71, 0xcabd, /*0x08-0x0f*/ 0x8f72, 0xdfb1, 0x8f73, 0xb9ad, 0x8f74, 0xd2fd, 0x8f75, 0xb8a5, /*0x10-0x17*/ 0xbaeb, 0x8f76, 0x8f77, 0xb3da, 0x8f78, 0x8f79, 0x8f7a, 0xb5dc, /*0x18-0x1f*/ 0xd5c5, 0x8f7b, 0x8f7c, 0x8f7d, 0x8f7e, 0xc3d6, 0xcfd2, 0xbba1, /*0x20-0x27*/ 0x8f80, 0xe5f3, 0xe5f2, 0x8f81, 0x8f82, 0xe5f4, 0x8f83, 0xcde4, /*0x28-0x2f*/ 0x8f84, 0xc8f5, 0x8f85, 0x8f86, 0x8f87, 0x8f88, 0x8f89, 0x8f8a, /*0x30-0x37*/ 0x8f8b, 0xb5af, 0xc7bf, 0x8f8c, 0xe5f6, 0x8f8d, 0x8f8e, 0x8f8f, /*0x38-0x3f*/ 0xecb0, 0x8f90, 0x8f91, 0x8f92, 0x8f93, 0x8f94, 0x8f95, 0x8f96, /*0x40-0x47*/ 0x8f97, 0x8f98, 0x8f99, 0x8f9a, 0x8f9b, 0x8f9c, 0x8f9d, 0x8f9e, /*0x48-0x4f*/ 0xe5e6, 0x8f9f, 0xb9e9, 0xb5b1, 0x8fa0, 0xc2bc, 0xe5e8, 0xe5e7, /*0x50-0x57*/ 0xe5e9, 0x8fa1, 0x8fa2, 0x8fa3, 0x8fa4, 0xd2cd, 0x8fa5, 0x8fa6, /*0x58-0x5f*/ 0x8fa7, 0xe1ea, 0xd0ce, 0x8fa8, 0xcdae, 0x8fa9, 0xd1e5, 0x8faa, /*0x60-0x67*/ 0x8fab, 0xb2ca, 0xb1eb, 0x8fac, 0xb1f2, 0xc5ed, 0x8fad, 0x8fae, /*0x68-0x6f*/ 0xd5c3, 0xd3b0, 0x8faf, 0xe1dc, 0x8fb0, 0x8fb1, 0x8fb2, 0xe1dd, /*0x70-0x77*/ 0x8fb3, 0xd2db, 0x8fb4, 0xb3b9, 0xb1cb, 0x8fb5, 0x8fb6, 0x8fb7, /*0x78-0x7f*/ 0xcdf9, 0xd5f7, 0xe1de, 0x8fb8, 0xbeb6, 0xb4fd, 0x8fb9, 0xe1df, /*0x80-0x87*/ 0xbadc, 0xe1e0, 0xbbb2, 0xc2c9, 0xe1e1, 0x8fba, 0x8fbb, 0x8fbc, /*0x88-0x8f*/ 0xd0ec, 0x8fbd, 0xcdbd, 0x8fbe, 0x8fbf, 0xe1e2, 0x8fc0, 0xb5c3, /*0x90-0x97*/ 0xc5c7, 0xe1e3, 0x8fc1, 0x8fc2, 0xe1e4, 0x8fc3, 0x8fc4, 0x8fc5, /*0x98-0x9f*/ 0x8fc6, 0xd3f9, 0x8fc7, 0x8fc8, 0x8fc9, 0x8fca, 0x8fcb, 0x8fcc, /*0xa0-0xa7*/ 0xe1e5, 0x8fcd, 0xd1ad, 0x8fce, 0x8fcf, 0xe1e6, 0xcea2, 0x8fd0, /*0xa8-0xaf*/ 0x8fd1, 0x8fd2, 0x8fd3, 0x8fd4, 0x8fd5, 0xe1e7, 0x8fd6, 0xb5c2, /*0xb0-0xb7*/ 0x8fd7, 0x8fd8, 0x8fd9, 0x8fda, 0xe1e8, 0xbbd5, 0x8fdb, 0x8fdc, /*0xb8-0xbf*/ 0x8fdd, 0x8fde, 0x8fdf, 0xd0c4, 0xe2e0, 0xb1d8, 0xd2e4, 0x8fe0, /*0xc0-0xc7*/ 0x8fe1, 0xe2e1, 0x8fe2, 0x8fe3, 0xbcc9, 0xc8cc, 0x8fe4, 0xe2e3, /*0xc8-0xcf*/ 0xecfe, 0xecfd, 0xdfaf, 0x8fe5, 0x8fe6, 0x8fe7, 0xe2e2, 0xd6be, /*0xd0-0xd7*/ 0xcdfc, 0xc3a6, 0x8fe8, 0x8fe9, 0x8fea, 0xe3c3, 0x8feb, 0x8fec, /*0xd8-0xdf*/ 0xd6d2, 0xe2e7, 0x8fed, 0x8fee, 0xe2e8, 0x8fef, 0x8ff0, 0xd3c7, /*0xe0-0xe7*/ 0x8ff1, 0x8ff2, 0xe2ec, 0xbfec, 0x8ff3, 0xe2ed, 0xe2e5, 0x8ff4, /*0xe8-0xef*/ 0x8ff5, 0xb3c0, 0x8ff6, 0x8ff7, 0x8ff8, 0xc4ee, 0x8ff9, 0x8ffa, /*0xf0-0xf7*/ 0xe2ee, 0x8ffb, 0x8ffc, 0xd0c3, 0x8ffd, 0xbaf6, 0xe2e9, 0xb7de, /*0xf8-0xff*/ /* 0x6000 */ 0xbbb3, 0xccac, 0xcbcb, 0xe2e4, 0xe2e6, 0xe2ea, 0xe2eb, 0x8ffe, /*0x00-0x07*/ 0x9040, 0x9041, 0xe2f7, 0x9042, 0x9043, 0xe2f4, 0xd4f5, 0xe2f3, /*0x08-0x0f*/ 0x9044, 0x9045, 0xc5ad, 0x9046, 0xd5fa, 0xc5c2, 0xb2c0, 0x9047, /*0x10-0x17*/ 0x9048, 0xe2ef, 0x9049, 0xe2f2, 0xc1af, 0xcbbc, 0x904a, 0x904b, /*0x18-0x1f*/ 0xb5a1, 0xe2f9, 0x904c, 0x904d, 0x904e, 0xbcb1, 0xe2f1, 0xd0d4, /*0x20-0x27*/ 0xd4b9, 0xe2f5, 0xb9d6, 0xe2f6, 0x904f, 0x9050, 0x9051, 0xc7d3, /*0x28-0x2f*/ 0x9052, 0x9053, 0x9054, 0x9055, 0x9056, 0xe2f0, 0x9057, 0x9058, /*0x30-0x37*/ 0x9059, 0x905a, 0x905b, 0xd7dc, 0xeda1, 0x905c, 0x905d, 0xe2f8, /*0x38-0x3f*/ 0x905e, 0xeda5, 0xe2fe, 0xcad1, 0x905f, 0x9060, 0x9061, 0x9062, /*0x40-0x47*/ 0x9063, 0x9064, 0x9065, 0xc1b5, 0x9066, 0xbbd0, 0x9067, 0x9068, /*0x48-0x4f*/ 0xbfd6, 0x9069, 0xbae3, 0x906a, 0x906b, 0xcba1, 0x906c, 0x906d, /*0x50-0x57*/ 0x906e, 0xeda6, 0xeda3, 0x906f, 0x9070, 0xeda2, 0x9071, 0x9072, /*0x58-0x5f*/ 0x9073, 0x9074, 0xbbd6, 0xeda7, 0xd0f4, 0x9075, 0x9076, 0xeda4, /*0x60-0x67*/ 0xbade, 0xb6f7, 0xe3a1, 0xb6b2, 0xccf1, 0xb9a7, 0x9077, 0xcfa2, /*0x68-0x6f*/ 0xc7a1, 0x9078, 0x9079, 0xbfd2, 0x907a, 0x907b, 0xb6f1, 0x907c, /*0x70-0x77*/ 0xe2fa, 0xe2fb, 0xe2fd, 0xe2fc, 0xc4d5, 0xe3a2, 0x907d, 0xd3c1, /*0x78-0x7f*/ 0x907e, 0x9080, 0x9081, 0xe3a7, 0xc7c4, 0x9082, 0x9083, 0x9084, /*0x80-0x87*/ 0x9085, 0xcfa4, 0x9086, 0x9087, 0xe3a9, 0xbab7, 0x9088, 0x9089, /*0x88-0x8f*/ 0x908a, 0x908b, 0xe3a8, 0x908c, 0xbbda, 0x908d, 0xe3a3, 0x908e, /*0x90-0x97*/ 0x908f, 0x9090, 0xe3a4, 0xe3aa, 0x9091, 0xe3a6, 0x9092, 0xcef2, /*0x98-0x9f*/ 0xd3c6, 0x9093, 0x9094, 0xbbbc, 0x9095, 0x9096, 0xd4c3, 0x9097, /*0xa0-0xa7*/ 0xc4fa, 0x9098, 0x9099, 0xeda8, 0xd0fc, 0xe3a5, 0x909a, 0xc3f5, /*0xa8-0xaf*/ 0x909b, 0xe3ad, 0xb1af, 0x909c, 0xe3b2, 0x909d, 0x909e, 0x909f, /*0xb0-0xb7*/ 0xbcc2, 0x90a0, 0x90a1, 0xe3ac, 0xb5bf, 0x90a2, 0x90a3, 0x90a4, /*0xb8-0xbf*/ 0x90a5, 0x90a6, 0x90a7, 0x90a8, 0x90a9, 0xc7e9, 0xe3b0, 0x90aa, /*0xc0-0xc7*/ 0x90ab, 0x90ac, 0xbeaa, 0xcdef, 0x90ad, 0x90ae, 0x90af, 0x90b0, /*0xc8-0xcf*/ 0x90b1, 0xbbf3, 0x90b2, 0x90b3, 0x90b4, 0xcce8, 0x90b5, 0x90b6, /*0xd0-0xd7*/ 0xe3af, 0x90b7, 0xe3b1, 0x90b8, 0xcfa7, 0xe3ae, 0x90b9, 0xcea9, /*0xd8-0xdf*/ 0xbbdd, 0x90ba, 0x90bb, 0x90bc, 0x90bd, 0x90be, 0xb5eb, 0xbee5, /*0xe0-0xe7*/ 0xb2d2, 0xb3cd, 0x90bf, 0xb1b9, 0xe3ab, 0xb2d1, 0xb5ac, 0xb9df, /*0xe8-0xef*/ 0xb6e8, 0x90c0, 0x90c1, 0xcfeb, 0xe3b7, 0x90c2, 0xbbcc, 0x90c3, /*0xf0-0xf7*/ 0x90c4, 0xc8c7, 0xd0ca, 0x90c5, 0x90c6, 0x90c7, 0x90c8, 0x90c9, /*0xf8-0xff*/ /* 0x6100 */ 0xe3b8, 0xb3ee, 0x90ca, 0x90cb, 0x90cc, 0x90cd, 0xeda9, 0x90ce, /*0x00-0x07*/ 0xd3fa, 0xd3e4, 0x90cf, 0x90d0, 0x90d1, 0xedaa, 0xe3b9, 0xd2e2, /*0x08-0x0f*/ 0x90d2, 0x90d3, 0x90d4, 0x90d5, 0x90d6, 0xe3b5, 0x90d7, 0x90d8, /*0x10-0x17*/ 0x90d9, 0x90da, 0xd3de, 0x90db, 0x90dc, 0x90dd, 0x90de, 0xb8d0, /*0x18-0x1f*/ 0xe3b3, 0x90df, 0x90e0, 0xe3b6, 0xb7df, 0x90e1, 0xe3b4, 0xc0a2, /*0x20-0x27*/ 0x90e2, 0x90e3, 0x90e4, 0xe3ba, 0x90e5, 0x90e6, 0x90e7, 0x90e8, /*0x28-0x2f*/ 0x90e9, 0x90ea, 0x90eb, 0x90ec, 0x90ed, 0x90ee, 0x90ef, 0x90f0, /*0x30-0x37*/ 0x90f1, 0x90f2, 0x90f3, 0x90f4, 0x90f5, 0x90f6, 0x90f7, 0xd4b8, /*0x38-0x3f*/ 0x90f8, 0x90f9, 0x90fa, 0x90fb, 0x90fc, 0x90fd, 0x90fe, 0x9140, /*0x40-0x47*/ 0xb4c8, 0x9141, 0xe3bb, 0x9142, 0xbbc5, 0x9143, 0xc9f7, 0x9144, /*0x48-0x4f*/ 0x9145, 0xc9e5, 0x9146, 0x9147, 0x9148, 0xc4bd, 0x9149, 0x914a, /*0x50-0x57*/ 0x914b, 0x914c, 0x914d, 0x914e, 0x914f, 0xedab, 0x9150, 0x9151, /*0x58-0x5f*/ 0x9152, 0x9153, 0xc2fd, 0x9154, 0x9155, 0x9156, 0x9157, 0xbbdb, /*0x60-0x67*/ 0xbfae, 0x9158, 0x9159, 0x915a, 0x915b, 0x915c, 0x915d, 0x915e, /*0x68-0x6f*/ 0xcebf, 0x915f, 0x9160, 0x9161, 0x9162, 0xe3bc, 0x9163, 0xbfb6, /*0x70-0x77*/ 0x9164, 0x9165, 0x9166, 0x9167, 0x9168, 0x9169, 0x916a, 0x916b, /*0x78-0x7f*/ 0x916c, 0x916d, 0x916e, 0x916f, 0x9170, 0x9171, 0x9172, 0x9173, /*0x80-0x87*/ 0x9174, 0x9175, 0x9176, 0xb1ef, 0x9177, 0x9178, 0xd4f7, 0x9179, /*0x88-0x8f*/ 0x917a, 0x917b, 0x917c, 0x917d, 0xe3be, 0x917e, 0x9180, 0x9181, /*0x90-0x97*/ 0x9182, 0x9183, 0x9184, 0x9185, 0x9186, 0xedad, 0x9187, 0x9188, /*0x98-0x9f*/ 0x9189, 0x918a, 0x918b, 0x918c, 0x918d, 0x918e, 0x918f, 0xe3bf, /*0xa0-0xa7*/ 0xbaa9, 0xedac, 0x9190, 0x9191, 0xe3bd, 0x9192, 0x9193, 0x9194, /*0xa8-0xaf*/ 0x9195, 0x9196, 0x9197, 0x9198, 0x9199, 0x919a, 0x919b, 0xe3c0, /*0xb0-0xb7*/ 0x919c, 0x919d, 0x919e, 0x919f, 0x91a0, 0x91a1, 0xbab6, 0x91a2, /*0xb8-0xbf*/ 0x91a3, 0x91a4, 0xb6ae, 0x91a5, 0x91a6, 0x91a7, 0x91a8, 0x91a9, /*0xc0-0xc7*/ 0xd0b8, 0x91aa, 0xb0c3, 0xedae, 0x91ab, 0x91ac, 0x91ad, 0x91ae, /*0xc8-0xcf*/ 0x91af, 0xedaf, 0xc0c1, 0x91b0, 0xe3c1, 0x91b1, 0x91b2, 0x91b3, /*0xd0-0xd7*/ 0x91b4, 0x91b5, 0x91b6, 0x91b7, 0x91b8, 0x91b9, 0x91ba, 0x91bb, /*0xd8-0xdf*/ 0x91bc, 0x91bd, 0x91be, 0x91bf, 0x91c0, 0x91c1, 0xc5b3, 0x91c2, /*0xe0-0xe7*/ 0x91c3, 0x91c4, 0x91c5, 0x91c6, 0x91c7, 0x91c8, 0x91c9, 0x91ca, /*0xe8-0xef*/ 0x91cb, 0x91cc, 0x91cd, 0x91ce, 0x91cf, 0xe3c2, 0x91d0, 0x91d1, /*0xf0-0xf7*/ 0x91d2, 0x91d3, 0x91d4, 0x91d5, 0x91d6, 0x91d7, 0x91d8, 0xdcb2, /*0xf8-0xff*/ /* 0x6200 */ 0x91d9, 0x91da, 0x91db, 0x91dc, 0x91dd, 0x91de, 0xedb0, 0x91df, /*0x00-0x07*/ 0xb8ea, 0x91e0, 0xceec, 0xeaa7, 0xd0e7, 0xcaf9, 0xc8d6, 0xcfb7, /*0x08-0x0f*/ 0xb3c9, 0xced2, 0xbde4, 0x91e1, 0x91e2, 0xe3de, 0xbbf2, 0xeaa8, /*0x10-0x17*/ 0xd5bd, 0x91e3, 0xc6dd, 0xeaa9, 0x91e4, 0x91e5, 0x91e6, 0xeaaa, /*0x18-0x1f*/ 0x91e7, 0xeaac, 0xeaab, 0x91e8, 0xeaae, 0xeaad, 0x91e9, 0x91ea, /*0x20-0x27*/ 0x91eb, 0x91ec, 0xbdd8, 0x91ed, 0xeaaf, 0x91ee, 0xc2be, 0x91ef, /*0x28-0x2f*/ 0x91f0, 0x91f1, 0x91f2, 0xb4c1, 0xb4f7, 0x91f3, 0x91f4, 0xbba7, /*0x30-0x37*/ 0x91f5, 0x91f6, 0x91f7, 0x91f8, 0x91f9, 0xece6, 0xece5, 0xb7bf, /*0x38-0x3f*/ 0xcbf9, 0xb1e2, 0x91fa, 0xece7, 0x91fb, 0x91fc, 0x91fd, 0xc9c8, /*0x40-0x47*/ 0xece8, 0xece9, 0x91fe, 0xcad6, 0xded0, 0xb2c5, 0xd4fa, 0x9240, /*0x48-0x4f*/ 0x9241, 0xc6cb, 0xb0c7, 0xb4f2, 0xc8d3, 0x9242, 0x9243, 0x9244, /*0x50-0x57*/ 0xcdd0, 0x9245, 0x9246, 0xbfb8, 0x9247, 0x9248, 0x9249, 0x924a, /*0x58-0x5f*/ 0x924b, 0x924c, 0x924d, 0xbfdb, 0x924e, 0x924f, 0xc7a4, 0xd6b4, /*0x60-0x67*/ 0x9250, 0xc0a9, 0xded1, 0xc9a8, 0xd1ef, 0xc5a4, 0xb0e7, 0xb3b6, /*0x68-0x6f*/ 0xc8c5, 0x9251, 0x9252, 0xb0e2, 0x9253, 0x9254, 0xb7f6, 0x9255, /*0x70-0x77*/ 0x9256, 0xc5fa, 0x9257, 0x9258, 0xb6f3, 0x9259, 0xd5d2, 0xb3d0, /*0x78-0x7f*/ 0xbcbc, 0x925a, 0x925b, 0x925c, 0xb3ad, 0x925d, 0x925e, 0x925f, /*0x80-0x87*/ 0x9260, 0xbef1, 0xb0d1, 0x9261, 0x9262, 0x9263, 0x9264, 0x9265, /*0x88-0x8f*/ 0x9266, 0xd2d6, 0xcae3, 0xd7a5, 0x9267, 0xcdb6, 0xb6b6, 0xbfb9, /*0x90-0x97*/ 0xd5db, 0x9268, 0xb8a7, 0xc5d7, 0x9269, 0x926a, 0x926b, 0xded2, /*0x98-0x9f*/ 0xbfd9, 0xc2d5, 0xc7c0, 0x926c, 0xbba4, 0xb1a8, 0x926d, 0x926e, /*0xa0-0xa7*/ 0xc5ea, 0x926f, 0x9270, 0xc5fb, 0xcca7, 0x9271, 0x9272, 0x9273, /*0xa8-0xaf*/ 0x9274, 0xb1a7, 0x9275, 0x9276, 0x9277, 0xb5d6, 0x9278, 0x9279, /*0xb0-0xb7*/ 0x927a, 0xc4a8, 0x927b, 0xded3, 0xd1ba, 0xb3e9, 0x927c, 0xc3f2, /*0xb8-0xbf*/ 0x927d, 0x927e, 0xb7f7, 0x9280, 0xd6f4, 0xb5a3, 0xb2f0, 0xc4b4, /*0xc0-0xc7*/ 0xc4e9, 0xc0ad, 0xded4, 0x9281, 0xb0e8, 0xc5c4, 0xc1e0, 0x9282, /*0xc8-0xcf*/ 0xb9d5, 0x9283, 0xbedc, 0xcdd8, 0xb0ce, 0x9284, 0xcdcf, 0xded6, /*0xd0-0xd7*/ 0xbed0, 0xd7be, 0xded5, 0xd5d0, 0xb0dd, 0x9285, 0x9286, 0xc4e2, /*0xd8-0xdf*/ 0x9287, 0x9288, 0xc2a3, 0xbcf0, 0x9289, 0xd3b5, 0xc0b9, 0xc5a1, /*0xe0-0xe7*/ 0xb2a6, 0xd4f1, 0x928a, 0x928b, 0xc0a8, 0xcac3, 0xded7, 0xd5fc, /*0xe8-0xef*/ 0x928c, 0xb9b0, 0x928d, 0xc8ad, 0xcba9, 0x928e, 0xded9, 0xbfbd, /*0xf0-0xf7*/ 0x928f, 0x9290, 0x9291, 0x9292, 0xc6b4, 0xd7a7, 0xcab0, 0xc4c3, /*0xf8-0xff*/ /* 0x6300 */ 0x9293, 0xb3d6, 0xb9d2, 0x9294, 0x9295, 0x9296, 0x9297, 0xd6b8, /*0x00-0x07*/ 0xeafc, 0xb0b4, 0x9298, 0x9299, 0x929a, 0x929b, 0xbfe6, 0x929c, /*0x08-0x0f*/ 0x929d, 0xccf4, 0x929e, 0x929f, 0x92a0, 0x92a1, 0xcdda, 0x92a2, /*0x10-0x17*/ 0x92a3, 0x92a4, 0xd6bf, 0xc2ce, 0x92a5, 0xcece, 0xcca2, 0xd0ae, /*0x18-0x1f*/ 0xc4d3, 0xb5b2, 0xded8, 0xd5f5, 0xbcb7, 0xbbd3, 0x92a6, 0x92a7, /*0x20-0x27*/ 0xb0a4, 0x92a8, 0xc5b2, 0xb4ec, 0x92a9, 0x92aa, 0x92ab, 0xd5f1, /*0x28-0x2f*/ 0x92ac, 0x92ad, 0xeafd, 0x92ae, 0x92af, 0x92b0, 0x92b1, 0x92b2, /*0x30-0x37*/ 0x92b3, 0xdeda, 0xcda6, 0x92b4, 0x92b5, 0xcdec, 0x92b6, 0x92b7, /*0x38-0x3f*/ 0x92b8, 0x92b9, 0xcee6, 0xdedc, 0x92ba, 0xcdb1, 0xc0a6, 0x92bb, /*0x40-0x47*/ 0x92bc, 0xd7bd, 0x92bd, 0xdedb, 0xb0c6, 0xbab4, 0xc9d3, 0xc4f3, /*0x48-0x4f*/ 0xbee8, 0x92be, 0x92bf, 0x92c0, 0x92c1, 0xb2b6, 0x92c2, 0x92c3, /*0x50-0x57*/ 0x92c4, 0x92c5, 0x92c6, 0x92c7, 0x92c8, 0x92c9, 0xc0cc, 0xcbf0, /*0x58-0x5f*/ 0x92ca, 0xbcf1, 0xbbbb, 0xb5b7, 0x92cb, 0x92cc, 0x92cd, 0xc5f5, /*0x60-0x67*/ 0x92ce, 0xdee6, 0x92cf, 0x92d0, 0x92d1, 0xdee3, 0xbedd, 0x92d2, /*0x68-0x6f*/ 0x92d3, 0xdedf, 0x92d4, 0x92d5, 0x92d6, 0x92d7, 0xb4b7, 0xbddd, /*0x70-0x77*/ 0x92d8, 0x92d9, 0xdee0, 0xc4ed, 0x92da, 0x92db, 0x92dc, 0x92dd, /*0x78-0x7f*/ 0xcfc6, 0x92de, 0xb5e0, 0x92df, 0x92e0, 0x92e1, 0x92e2, 0xb6de, /*0x80-0x87*/ 0xcada, 0xb5f4, 0xdee5, 0x92e3, 0xd5c6, 0x92e4, 0xdee1, 0xcccd, /*0x88-0x8f*/ 0xc6fe, 0x92e5, 0xc5c5, 0x92e6, 0x92e7, 0x92e8, 0xd2b4, 0x92e9, /*0x90-0x97*/ 0xbef2, 0x92ea, 0x92eb, 0x92ec, 0x92ed, 0x92ee, 0x92ef, 0x92f0, /*0x98-0x9f*/ 0xc2d3, 0x92f1, 0xccbd, 0xb3b8, 0x92f2, 0xbdd3, 0x92f3, 0xbfd8, /*0xa0-0xa7*/ 0xcdc6, 0xd1da, 0xb4eb, 0x92f4, 0xdee4, 0xdedd, 0xdee7, 0x92f5, /*0xa8-0xaf*/ 0xeafe, 0x92f6, 0x92f7, 0xc2b0, 0xdee2, 0x92f8, 0x92f9, 0xd6c0, /*0xb0-0xb7*/ 0xb5a7, 0x92fa, 0xb2f4, 0x92fb, 0xdee8, 0x92fc, 0xdef2, 0x92fd, /*0xb8-0xbf*/ 0x92fe, 0x9340, 0x9341, 0x9342, 0xdeed, 0x9343, 0xdef1, 0x9344, /*0xc0-0xc7*/ 0x9345, 0xc8e0, 0x9346, 0x9347, 0x9348, 0xd7e1, 0xdeef, 0xc3e8, /*0xc8-0xcf*/ 0xcce1, 0x9349, 0xb2e5, 0x934a, 0x934b, 0x934c, 0xd2be, 0x934d, /*0xd0-0xd7*/ 0x934e, 0x934f, 0x9350, 0x9351, 0x9352, 0x9353, 0xdeee, 0x9354, /*0xd8-0xdf*/ 0xdeeb, 0xced5, 0x9355, 0xb4a7, 0x9356, 0x9357, 0x9358, 0x9359, /*0xe0-0xe7*/ 0x935a, 0xbfab, 0xbebe, 0x935b, 0x935c, 0xbdd2, 0x935d, 0x935e, /*0xe8-0xef*/ 0x935f, 0x9360, 0xdee9, 0x9361, 0xd4ae, 0x9362, 0xdede, 0x9363, /*0xf0-0xf7*/ 0xdeea, 0x9364, 0x9365, 0x9366, 0x9367, 0xc0bf, 0x9368, 0xdeec, /*0xf8-0xff*/ /* 0x6400 */ 0xb2f3, 0xb8e9, 0xc2a7, 0x9369, 0x936a, 0xbdc1, 0x936b, 0x936c, /*0x00-0x07*/ 0x936d, 0x936e, 0x936f, 0xdef5, 0xdef8, 0x9370, 0x9371, 0xb2ab, /*0x08-0x0f*/ 0xb4a4, 0x9372, 0x9373, 0xb4ea, 0xc9a6, 0x9374, 0x9375, 0x9376, /*0x10-0x17*/ 0x9377, 0x9378, 0x9379, 0xdef6, 0xcbd1, 0x937a, 0xb8e3, 0x937b, /*0x18-0x1f*/ 0xdef7, 0xdefa, 0x937c, 0x937d, 0x937e, 0x9380, 0xdef9, 0x9381, /*0x20-0x27*/ 0x9382, 0x9383, 0xccc2, 0x9384, 0xb0e1, 0xb4ee, 0x9385, 0x9386, /*0x28-0x2f*/ 0x9387, 0x9388, 0x9389, 0x938a, 0xe5ba, 0x938b, 0x938c, 0x938d, /*0x30-0x37*/ 0x938e, 0x938f, 0xd0af, 0x9390, 0x9391, 0xb2eb, 0x9392, 0xeba1, /*0x38-0x3f*/ 0x9393, 0xdef4, 0x9394, 0x9395, 0xc9e3, 0xdef3, 0xb0da, 0xd2a1, /*0x40-0x47*/ 0xb1f7, 0x9396, 0xccaf, 0x9397, 0x9398, 0x9399, 0x939a, 0x939b, /*0x48-0x4f*/ 0x939c, 0x939d, 0xdef0, 0x939e, 0xcba4, 0x939f, 0x93a0, 0x93a1, /*0x50-0x57*/ 0xd5aa, 0x93a2, 0x93a3, 0x93a4, 0x93a5, 0x93a6, 0xdefb, 0x93a7, /*0x58-0x5f*/ 0x93a8, 0x93a9, 0x93aa, 0x93ab, 0x93ac, 0x93ad, 0x93ae, 0xb4dd, /*0x60-0x67*/ 0x93af, 0xc4a6, 0x93b0, 0x93b1, 0x93b2, 0xdefd, 0x93b3, 0x93b4, /*0x68-0x6f*/ 0x93b5, 0x93b6, 0x93b7, 0x93b8, 0x93b9, 0x93ba, 0x93bb, 0x93bc, /*0x70-0x77*/ 0xc3fe, 0xc4a1, 0xdfa1, 0x93bd, 0x93be, 0x93bf, 0x93c0, 0x93c1, /*0x78-0x7f*/ 0x93c2, 0x93c3, 0xc1cc, 0x93c4, 0xdefc, 0xbeef, 0x93c5, 0xc6b2, /*0x80-0x87*/ 0x93c6, 0x93c7, 0x93c8, 0x93c9, 0x93ca, 0x93cb, 0x93cc, 0x93cd, /*0x88-0x8f*/ 0x93ce, 0xb3c5, 0xc8f6, 0x93cf, 0x93d0, 0xcbba, 0xdefe, 0x93d1, /*0x90-0x97*/ 0x93d2, 0xdfa4, 0x93d3, 0x93d4, 0x93d5, 0x93d6, 0xd7b2, 0x93d7, /*0x98-0x9f*/ 0x93d8, 0x93d9, 0x93da, 0x93db, 0xb3b7, 0x93dc, 0x93dd, 0x93de, /*0xa0-0xa7*/ 0x93df, 0xc1c3, 0x93e0, 0x93e1, 0xc7cb, 0xb2a5, 0xb4e9, 0x93e2, /*0xa8-0xaf*/ 0xd7ab, 0x93e3, 0x93e4, 0x93e5, 0x93e6, 0xc4ec, 0x93e7, 0xdfa2, /*0xb0-0xb7*/ 0xdfa3, 0x93e8, 0xdfa5, 0x93e9, 0xbab3, 0x93ea, 0x93eb, 0x93ec, /*0xb8-0xbf*/ 0xdfa6, 0x93ed, 0xc0de, 0x93ee, 0x93ef, 0xc9c3, 0x93f0, 0x93f1, /*0xc0-0xc7*/ 0x93f2, 0x93f3, 0x93f4, 0x93f5, 0x93f6, 0xb2d9, 0xc7e6, 0x93f7, /*0xc8-0xcf*/ 0xdfa7, 0x93f8, 0xc7dc, 0x93f9, 0x93fa, 0x93fb, 0x93fc, 0xdfa8, /*0xd0-0xd7*/ 0xeba2, 0x93fd, 0x93fe, 0x9440, 0x9441, 0x9442, 0xcbd3, 0x9443, /*0xd8-0xdf*/ 0x9444, 0x9445, 0xdfaa, 0x9446, 0xdfa9, 0x9447, 0xb2c1, 0x9448, /*0xe0-0xe7*/ 0x9449, 0x944a, 0x944b, 0x944c, 0x944d, 0x944e, 0x944f, 0x9450, /*0xe8-0xef*/ 0x9451, 0x9452, 0x9453, 0x9454, 0x9455, 0x9456, 0x9457, 0x9458, /*0xf0-0xf7*/ 0x9459, 0x945a, 0x945b, 0x945c, 0x945d, 0x945e, 0x945f, 0x9460, /*0xf8-0xff*/ /* 0x6500 */ 0xc5ca, 0x9461, 0x9462, 0x9463, 0x9464, 0x9465, 0x9466, 0x9467, /*0x00-0x07*/ 0x9468, 0xdfab, 0x9469, 0x946a, 0x946b, 0x946c, 0x946d, 0x946e, /*0x08-0x0f*/ 0x946f, 0x9470, 0xd4dc, 0x9471, 0x9472, 0x9473, 0x9474, 0x9475, /*0x10-0x17*/ 0xc8c1, 0x9476, 0x9477, 0x9478, 0x9479, 0x947a, 0x947b, 0x947c, /*0x18-0x1f*/ 0x947d, 0x947e, 0x9480, 0x9481, 0x9482, 0xdfac, 0x9483, 0x9484, /*0x20-0x27*/ 0x9485, 0x9486, 0x9487, 0xbef0, 0x9488, 0x9489, 0xdfad, 0xd6a7, /*0x28-0x2f*/ 0x948a, 0x948b, 0x948c, 0x948d, 0xeab7, 0xebb6, 0xcad5, 0x948e, /*0x30-0x37*/ 0xd8fc, 0xb8c4, 0x948f, 0xb9a5, 0x9490, 0x9491, 0xb7c5, 0xd5fe, /*0x38-0x3f*/ 0x9492, 0x9493, 0x9494, 0x9495, 0x9496, 0xb9ca, 0x9497, 0x9498, /*0x40-0x47*/ 0xd0a7, 0xf4cd, 0x9499, 0x949a, 0xb5d0, 0x949b, 0x949c, 0xc3f4, /*0x48-0x4f*/ 0x949d, 0xbec8, 0x949e, 0x949f, 0x94a0, 0xebb7, 0xb0bd, 0x94a1, /*0x50-0x57*/ 0x94a2, 0xbdcc, 0x94a3, 0xc1b2, 0x94a4, 0xb1d6, 0xb3a8, 0x94a5, /*0x58-0x5f*/ 0x94a6, 0x94a7, 0xb8d2, 0xc9a2, 0x94a8, 0x94a9, 0xb6d8, 0x94aa, /*0x60-0x67*/ 0x94ab, 0x94ac, 0x94ad, 0xebb8, 0xbeb4, 0x94ae, 0x94af, 0x94b0, /*0x68-0x6f*/ 0xcafd, 0x94b1, 0xc7c3, 0x94b2, 0xd5fb, 0x94b3, 0x94b4, 0xb7f3, /*0x70-0x77*/ 0x94b5, 0x94b6, 0x94b7, 0x94b8, 0x94b9, 0x94ba, 0x94bb, 0x94bc, /*0x78-0x7f*/ 0x94bd, 0x94be, 0x94bf, 0x94c0, 0x94c1, 0x94c2, 0x94c3, 0xcec4, /*0x80-0x87*/ 0x94c4, 0x94c5, 0x94c6, 0xd5ab, 0xb1f3, 0x94c7, 0x94c8, 0x94c9, /*0x88-0x8f*/ 0xecb3, 0xb0df, 0x94ca, 0xecb5, 0x94cb, 0x94cc, 0x94cd, 0xb6b7, /*0x90-0x97*/ 0x94ce, 0xc1cf, 0x94cf, 0xf5fa, 0xd0b1, 0x94d0, 0x94d1, 0xd5e5, /*0x98-0x9f*/ 0x94d2, 0xced3, 0x94d3, 0x94d4, 0xbdef, 0xb3e2, 0x94d5, 0xb8ab, /*0xa0-0xa7*/ 0x94d6, 0xd5b6, 0x94d7, 0xedbd, 0x94d8, 0xb6cf, 0x94d9, 0xcbb9, /*0xa8-0xaf*/ 0xd0c2, 0x94da, 0x94db, 0x94dc, 0x94dd, 0x94de, 0x94df, 0x94e0, /*0xb0-0xb7*/ 0x94e1, 0xb7bd, 0x94e2, 0x94e3, 0xecb6, 0xcaa9, 0x94e4, 0x94e5, /*0xb8-0xbf*/ 0x94e6, 0xc5d4, 0x94e7, 0xecb9, 0xecb8, 0xc2c3, 0xecb7, 0x94e8, /*0xc0-0xc7*/ 0x94e9, 0x94ea, 0x94eb, 0xd0fd, 0xecba, 0x94ec, 0xecbb, 0xd7e5, /*0xc8-0xcf*/ 0x94ed, 0x94ee, 0xecbc, 0x94ef, 0x94f0, 0x94f1, 0xecbd, 0xc6ec, /*0xd0-0xd7*/ 0x94f2, 0x94f3, 0x94f4, 0x94f5, 0x94f6, 0x94f7, 0x94f8, 0x94f9, /*0xd8-0xdf*/ 0xcede, 0x94fa, 0xbcc8, 0x94fb, 0x94fc, 0xc8d5, 0xb5a9, 0xbec9, /*0xe0-0xe7*/ 0xd6bc, 0xd4e7, 0x94fd, 0x94fe, 0xd1ae, 0xd0f1, 0xeab8, 0xeab9, /*0xe8-0xef*/ 0xeaba, 0xbab5, 0x9540, 0x9541, 0x9542, 0x9543, 0xcab1, 0xbff5, /*0xf0-0xf7*/ 0x9544, 0x9545, 0xcdfa, 0x9546, 0x9547, 0x9548, 0x9549, 0x954a, /*0xf8-0xff*/ /* 0x6600 */ 0xeac0, 0x954b, 0xb0ba, 0xeabe, 0x954c, 0x954d, 0xc0a5, 0x954e, /*0x00-0x07*/ 0x954f, 0x9550, 0xeabb, 0x9551, 0xb2fd, 0x9552, 0xc3f7, 0xbbe8, /*0x08-0x0f*/ 0x9553, 0x9554, 0x9555, 0xd2d7, 0xcef4, 0xeabf, 0x9556, 0x9557, /*0x10-0x17*/ 0x9558, 0xeabc, 0x9559, 0x955a, 0x955b, 0xeac3, 0x955c, 0xd0c7, /*0x18-0x1f*/ 0xd3b3, 0x955d, 0x955e, 0x955f, 0x9560, 0xb4ba, 0x9561, 0xc3c1, /*0x20-0x27*/ 0xd7f2, 0x9562, 0x9563, 0x9564, 0x9565, 0xd5d1, 0x9566, 0xcac7, /*0x28-0x2f*/ 0x9567, 0xeac5, 0x9568, 0x9569, 0xeac4, 0xeac7, 0xeac6, 0x956a, /*0x30-0x37*/ 0x956b, 0x956c, 0x956d, 0x956e, 0xd6e7, 0x956f, 0xcfd4, 0x9570, /*0x38-0x3f*/ 0x9571, 0xeacb, 0x9572, 0xbbce, 0x9573, 0x9574, 0x9575, 0x9576, /*0x40-0x47*/ 0x9577, 0x9578, 0x9579, 0xbdfa, 0xc9ce, 0x957a, 0x957b, 0xeacc, /*0x48-0x4f*/ 0x957c, 0x957d, 0xc9b9, 0xcffe, 0xeaca, 0xd4ce, 0xeacd, 0xeacf, /*0x50-0x57*/ 0x957e, 0x9580, 0xcded, 0x9581, 0x9582, 0x9583, 0x9584, 0xeac9, /*0x58-0x5f*/ 0x9585, 0xeace, 0x9586, 0x9587, 0xceee, 0x9588, 0xbbde, 0x9589, /*0x60-0x67*/ 0xb3bf, 0x958a, 0x958b, 0x958c, 0x958d, 0x958e, 0xc6d5, 0xbeb0, /*0x68-0x6f*/ 0xcefa, 0x958f, 0x9590, 0x9591, 0xc7e7, 0x9592, 0xbea7, 0xead0, /*0x70-0x77*/ 0x9593, 0x9594, 0xd6c7, 0x9595, 0x9596, 0x9597, 0xc1c0, 0x9598, /*0x78-0x7f*/ 0x9599, 0x959a, 0xd4dd, 0x959b, 0xead1, 0x959c, 0x959d, 0xcfbe, /*0x80-0x87*/ 0x959e, 0x959f, 0x95a0, 0x95a1, 0xead2, 0x95a2, 0x95a3, 0x95a4, /*0x88-0x8f*/ 0x95a5, 0xcaee, 0x95a6, 0x95a7, 0x95a8, 0x95a9, 0xc5af, 0xb0b5, /*0x90-0x97*/ 0x95aa, 0x95ab, 0x95ac, 0x95ad, 0x95ae, 0xead4, 0x95af, 0x95b0, /*0x98-0x9f*/ 0x95b1, 0x95b2, 0x95b3, 0x95b4, 0x95b5, 0x95b6, 0x95b7, 0xead3, /*0xa0-0xa7*/ 0xf4df, 0x95b8, 0x95b9, 0x95ba, 0x95bb, 0x95bc, 0xc4ba, 0x95bd, /*0xa8-0xaf*/ 0x95be, 0x95bf, 0x95c0, 0x95c1, 0xb1a9, 0x95c2, 0x95c3, 0x95c4, /*0xb0-0xb7*/ 0x95c5, 0xe5df, 0x95c6, 0x95c7, 0x95c8, 0x95c9, 0xead5, 0x95ca, /*0xb8-0xbf*/ 0x95cb, 0x95cc, 0x95cd, 0x95ce, 0x95cf, 0x95d0, 0x95d1, 0x95d2, /*0xc0-0xc7*/ 0x95d3, 0x95d4, 0x95d5, 0x95d6, 0x95d7, 0x95d8, 0x95d9, 0x95da, /*0xc8-0xcf*/ 0x95db, 0x95dc, 0x95dd, 0x95de, 0x95df, 0x95e0, 0x95e1, 0x95e2, /*0xd0-0xd7*/ 0x95e3, 0xcaef, 0x95e4, 0xead6, 0xead7, 0xc6d8, 0x95e5, 0x95e6, /*0xd8-0xdf*/ 0x95e7, 0x95e8, 0x95e9, 0x95ea, 0x95eb, 0x95ec, 0xead8, 0x95ed, /*0xe0-0xe7*/ 0x95ee, 0xead9, 0x95ef, 0x95f0, 0x95f1, 0x95f2, 0x95f3, 0x95f4, /*0xe8-0xef*/ 0xd4bb, 0x95f5, 0xc7fa, 0xd2b7, 0xb8fc, 0x95f6, 0x95f7, 0xeac2, /*0xf0-0xf7*/ 0x95f8, 0xb2dc, 0x95f9, 0x95fa, 0xc2fc, 0x95fb, 0xd4f8, 0xcce6, /*0xf8-0xff*/ /* 0x6700 */ 0xd7ee, 0x95fc, 0x95fd, 0x95fe, 0x9640, 0x9641, 0x9642, 0x9643, /*0x00-0x07*/ 0xd4c2, 0xd3d0, 0xebc3, 0xc5f3, 0x9644, 0xb7fe, 0x9645, 0x9646, /*0x08-0x0f*/ 0xebd4, 0x9647, 0x9648, 0x9649, 0xcbb7, 0xebde, 0x964a, 0xc0ca, /*0x10-0x17*/ 0x964b, 0x964c, 0x964d, 0xcdfb, 0x964e, 0xb3af, 0x964f, 0xc6da, /*0x18-0x1f*/ 0x9650, 0x9651, 0x9652, 0x9653, 0x9654, 0x9655, 0xebfc, 0x9656, /*0x20-0x27*/ 0xc4be, 0x9657, 0xceb4, 0xc4a9, 0xb1be, 0xd4fd, 0x9658, 0xcaf5, /*0x28-0x2f*/ 0x9659, 0xd6ec, 0x965a, 0x965b, 0xc6d3, 0xb6e4, 0x965c, 0x965d, /*0x30-0x37*/ 0x965e, 0x965f, 0xbbfa, 0x9660, 0x9661, 0xd0e0, 0x9662, 0x9663, /*0x38-0x3f*/ 0xc9b1, 0x9664, 0xd4d3, 0xc8a8, 0x9665, 0x9666, 0xb8cb, 0x9667, /*0x40-0x47*/ 0xe8be, 0xc9bc, 0x9668, 0x9669, 0xe8bb, 0x966a, 0xc0ee, 0xd0d3, /*0x48-0x4f*/ 0xb2c4, 0xb4e5, 0x966b, 0xe8bc, 0x966c, 0x966d, 0xd5c8, 0x966e, /*0x50-0x57*/ 0x966f, 0x9670, 0x9671, 0x9672, 0xb6c5, 0x9673, 0xe8bd, 0xcaf8, /*0x58-0x5f*/ 0xb8dc, 0xccf5, 0x9674, 0x9675, 0x9676, 0xc0b4, 0x9677, 0x9678, /*0x60-0x67*/ 0xd1ee, 0xe8bf, 0xe8c2, 0x9679, 0x967a, 0xbabc, 0x967b, 0xb1ad, /*0x68-0x6f*/ 0xbddc, 0x967c, 0xeabd, 0xe8c3, 0x967d, 0xe8c6, 0x967e, 0xe8cb, /*0x70-0x77*/ 0x9680, 0x9681, 0x9682, 0x9683, 0xe8cc, 0x9684, 0xcbc9, 0xb0e5, /*0x78-0x7f*/ 0x9685, 0xbcab, 0x9686, 0x9687, 0xb9b9, 0x9688, 0x9689, 0xe8c1, /*0x80-0x87*/ 0x968a, 0xcdf7, 0x968b, 0xe8ca, 0x968c, 0x968d, 0x968e, 0x968f, /*0x88-0x8f*/ 0xcef6, 0x9690, 0x9691, 0x9692, 0x9693, 0xd5ed, 0x9694, 0xc1d6, /*0x90-0x97*/ 0xe8c4, 0x9695, 0xc3b6, 0x9696, 0xb9fb, 0xd6a6, 0xe8c8, 0x9697, /*0x98-0x9f*/ 0x9698, 0x9699, 0xcae0, 0xd4e6, 0x969a, 0xe8c0, 0x969b, 0xe8c5, /*0xa0-0xa7*/ 0xe8c7, 0x969c, 0xc7b9, 0xb7e3, 0x969d, 0xe8c9, 0x969e, 0xbfdd, /*0xa8-0xaf*/ 0xe8d2, 0x969f, 0x96a0, 0xe8d7, 0x96a1, 0xe8d5, 0xbcdc, 0xbccf, /*0xb0-0xb7*/ 0xe8db, 0x96a2, 0x96a3, 0x96a4, 0x96a5, 0x96a6, 0x96a7, 0x96a8, /*0xb8-0xbf*/ 0x96a9, 0xe8de, 0x96aa, 0xe8da, 0xb1fa, 0x96ab, 0x96ac, 0x96ad, /*0xc0-0xc7*/ 0x96ae, 0x96af, 0x96b0, 0x96b1, 0x96b2, 0x96b3, 0x96b4, 0xb0d8, /*0xc8-0xcf*/ 0xc4b3, 0xb8cc, 0xc6e2, 0xc8be, 0xc8e1, 0x96b5, 0x96b6, 0x96b7, /*0xd0-0xd7*/ 0xe8cf, 0xe8d4, 0xe8d6, 0x96b8, 0xb9f1, 0xe8d8, 0xd7f5, 0x96b9, /*0xd8-0xdf*/ 0xc4fb, 0x96ba, 0xe8dc, 0x96bb, 0x96bc, 0xb2e9, 0x96bd, 0x96be, /*0xe0-0xe7*/ 0x96bf, 0xe8d1, 0x96c0, 0x96c1, 0xbced, 0x96c2, 0x96c3, 0xbfc2, /*0xe8-0xef*/ 0xe8cd, 0xd6f9, 0x96c4, 0xc1f8, 0xb2f1, 0x96c5, 0x96c6, 0x96c7, /*0xf0-0xf7*/ 0x96c8, 0x96c9, 0x96ca, 0x96cb, 0x96cc, 0xe8df, 0x96cd, 0xcac1, /*0xf8-0xff*/ /* 0x6800 */ 0xe8d9, 0x96ce, 0x96cf, 0x96d0, 0x96d1, 0xd5a4, 0x96d2, 0xb1ea, /*0x00-0x07*/ 0xd5bb, 0xe8ce, 0xe8d0, 0xb6b0, 0xe8d3, 0x96d3, 0xe8dd, 0xc0b8, /*0x08-0x0f*/ 0x96d4, 0xcaf7, 0x96d5, 0xcba8, 0x96d6, 0x96d7, 0xc6dc, 0xc0f5, /*0x10-0x17*/ 0x96d8, 0x96d9, 0x96da, 0x96db, 0x96dc, 0xe8e9, 0x96dd, 0x96de, /*0x18-0x1f*/ 0x96df, 0xd0a3, 0x96e0, 0x96e1, 0x96e2, 0x96e3, 0x96e4, 0x96e5, /*0x20-0x27*/ 0x96e6, 0xe8f2, 0xd6ea, 0x96e7, 0x96e8, 0x96e9, 0x96ea, 0x96eb, /*0x28-0x2f*/ 0x96ec, 0x96ed, 0xe8e0, 0xe8e1, 0x96ee, 0x96ef, 0x96f0, 0xd1f9, /*0x30-0x37*/ 0xbacb, 0xb8f9, 0x96f1, 0x96f2, 0xb8f1, 0xd4d4, 0xe8ef, 0x96f3, /*0x38-0x3f*/ 0xe8ee, 0xe8ec, 0xb9f0, 0xccd2, 0xe8e6, 0xcea6, 0xbff2, 0x96f4, /*0x40-0x47*/ 0xb0b8, 0xe8f1, 0xe8f0, 0x96f5, 0xd7c0, 0x96f6, 0xe8e4, 0x96f7, /*0x48-0x4f*/ 0xcda9, 0xc9a3, 0x96f8, 0xbbb8, 0xbddb, 0xe8ea, 0x96f9, 0x96fa, /*0x50-0x57*/ 0x96fb, 0x96fc, 0x96fd, 0x96fe, 0x9740, 0x9741, 0x9742, 0x9743, /*0x58-0x5f*/ 0xe8e2, 0xe8e3, 0xe8e5, 0xb5b5, 0xe8e7, 0xc7c5, 0xe8eb, 0xe8ed, /*0x60-0x67*/ 0xbdb0, 0xd7ae, 0x9744, 0xe8f8, 0x9745, 0x9746, 0x9747, 0x9748, /*0x68-0x6f*/ 0x9749, 0x974a, 0x974b, 0x974c, 0xe8f5, 0x974d, 0xcdb0, 0xe8f6, /*0x70-0x77*/ 0x974e, 0x974f, 0x9750, 0x9751, 0x9752, 0x9753, 0x9754, 0x9755, /*0x78-0x7f*/ 0x9756, 0xc1ba, 0x9757, 0xe8e8, 0x9758, 0xc3b7, 0xb0f0, 0x9759, /*0x80-0x87*/ 0x975a, 0x975b, 0x975c, 0x975d, 0x975e, 0x975f, 0x9760, 0xe8f4, /*0x88-0x8f*/ 0x9761, 0x9762, 0x9763, 0xe8f7, 0x9764, 0x9765, 0x9766, 0xb9a3, /*0x90-0x97*/ 0x9767, 0x9768, 0x9769, 0x976a, 0x976b, 0x976c, 0x976d, 0x976e, /*0x98-0x9f*/ 0x976f, 0x9770, 0xc9d2, 0x9771, 0x9772, 0x9773, 0xc3ce, 0xcee0, /*0xa0-0xa7*/ 0xc0e6, 0x9774, 0x9775, 0x9776, 0x9777, 0xcbf3, 0x9778, 0xccdd, /*0xa8-0xaf*/ 0xd0b5, 0x9779, 0x977a, 0xcae1, 0x977b, 0xe8f3, 0x977c, 0x977d, /*0xb0-0xb7*/ 0x977e, 0x9780, 0x9781, 0x9782, 0x9783, 0x9784, 0x9785, 0x9786, /*0xb8-0xbf*/ 0xbcec, 0x9787, 0xe8f9, 0x9788, 0x9789, 0x978a, 0x978b, 0x978c, /*0xc0-0xc7*/ 0x978d, 0xc3de, 0x978e, 0xc6e5, 0x978f, 0xb9f7, 0x9790, 0x9791, /*0xc8-0xcf*/ 0x9792, 0x9793, 0xb0f4, 0x9794, 0x9795, 0xd7d8, 0x9796, 0x9797, /*0xd0-0xd7*/ 0xbcac, 0x9798, 0xc5ef, 0x9799, 0x979a, 0x979b, 0x979c, 0x979d, /*0xd8-0xdf*/ 0xccc4, 0x979e, 0x979f, 0xe9a6, 0x97a0, 0x97a1, 0x97a2, 0x97a3, /*0xe0-0xe7*/ 0x97a4, 0x97a5, 0x97a6, 0x97a7, 0x97a8, 0x97a9, 0xc9ad, 0x97aa, /*0xe8-0xef*/ 0xe9a2, 0xc0e2, 0x97ab, 0x97ac, 0x97ad, 0xbfc3, 0x97ae, 0x97af, /*0xf0-0xf7*/ 0x97b0, 0xe8fe, 0xb9d7, 0x97b1, 0xe8fb, 0x97b2, 0x97b3, 0x97b4, /*0xf8-0xff*/ /* 0x6900 */ 0x97b5, 0xe9a4, 0x97b6, 0x97b7, 0x97b8, 0xd2ce, 0x97b9, 0x97ba, /*0x00-0x07*/ 0x97bb, 0x97bc, 0x97bd, 0xe9a3, 0x97be, 0xd6b2, 0xd7b5, 0x97bf, /*0x08-0x0f*/ 0xe9a7, 0x97c0, 0xbdb7, 0x97c1, 0x97c2, 0x97c3, 0x97c4, 0x97c5, /*0x10-0x17*/ 0x97c6, 0x97c7, 0x97c8, 0x97c9, 0x97ca, 0x97cb, 0x97cc, 0xe8fc, /*0x18-0x1f*/ 0xe8fd, 0x97cd, 0x97ce, 0x97cf, 0xe9a1, 0x97d0, 0x97d1, 0x97d2, /*0x20-0x27*/ 0x97d3, 0x97d4, 0x97d5, 0x97d6, 0x97d7, 0xcdd6, 0x97d8, 0x97d9, /*0x28-0x2f*/ 0xd2ac, 0x97da, 0x97db, 0x97dc, 0xe9b2, 0x97dd, 0x97de, 0x97df, /*0x30-0x37*/ 0x97e0, 0xe9a9, 0x97e1, 0x97e2, 0x97e3, 0xb4aa, 0x97e4, 0xb4bb, /*0x38-0x3f*/ 0x97e5, 0x97e6, 0xe9ab, 0x97e7, 0x97e8, 0x97e9, 0x97ea, 0x97eb, /*0x40-0x47*/ 0x97ec, 0x97ed, 0x97ee, 0x97ef, 0x97f0, 0x97f1, 0x97f2, 0x97f3, /*0x48-0x4f*/ 0x97f4, 0x97f5, 0x97f6, 0x97f7, 0xd0a8, 0x97f8, 0x97f9, 0xe9a5, /*0x50-0x57*/ 0x97fa, 0x97fb, 0xb3fe, 0x97fc, 0x97fd, 0xe9ac, 0xc0e3, 0x97fe, /*0x58-0x5f*/ 0xe9aa, 0x9840, 0x9841, 0xe9b9, 0x9842, 0x9843, 0xe9b8, 0x9844, /*0x60-0x67*/ 0x9845, 0x9846, 0x9847, 0xe9ae, 0x9848, 0x9849, 0xe8fa, 0x984a, /*0x68-0x6f*/ 0x984b, 0xe9a8, 0x984c, 0x984d, 0x984e, 0x984f, 0x9850, 0xbfac, /*0x70-0x77*/ 0xe9b1, 0xe9ba, 0x9851, 0x9852, 0xc2a5, 0x9853, 0x9854, 0x9855, /*0x78-0x7f*/ 0xe9af, 0x9856, 0xb8c5, 0x9857, 0xe9ad, 0x9858, 0xd3dc, 0xe9b4, /*0x80-0x87*/ 0xe9b5, 0xe9b7, 0x9859, 0x985a, 0x985b, 0xe9c7, 0x985c, 0x985d, /*0x88-0x8f*/ 0x985e, 0x985f, 0x9860, 0x9861, 0xc0c6, 0xe9c5, 0x9862, 0x9863, /*0x90-0x97*/ 0xe9b0, 0x9864, 0x9865, 0xe9bb, 0xb0f1, 0x9866, 0x9867, 0x9868, /*0x98-0x9f*/ 0x9869, 0x986a, 0x986b, 0x986c, 0x986d, 0x986e, 0x986f, 0xe9bc, /*0xa0-0xa7*/ 0xd5a5, 0x9870, 0x9871, 0xe9be, 0x9872, 0xe9bf, 0x9873, 0x9874, /*0xa8-0xaf*/ 0x9875, 0xe9c1, 0x9876, 0x9877, 0xc1f1, 0x9878, 0x9879, 0xc8b6, /*0xb0-0xb7*/ 0x987a, 0x987b, 0x987c, 0xe9bd, 0x987d, 0x987e, 0x9880, 0x9881, /*0xb8-0xbf*/ 0x9882, 0xe9c2, 0x9883, 0x9884, 0x9885, 0x9886, 0x9887, 0x9888, /*0xc0-0xc7*/ 0x9889, 0x988a, 0xe9c3, 0x988b, 0xe9b3, 0x988c, 0xe9b6, 0x988d, /*0xc8-0xcf*/ 0xbbb1, 0x988e, 0x988f, 0x9890, 0xe9c0, 0x9891, 0x9892, 0x9893, /*0xd0-0xd7*/ 0x9894, 0x9895, 0x9896, 0xbcf7, 0x9897, 0x9898, 0x9899, 0xe9c4, /*0xd8-0xdf*/ 0xe9c6, 0x989a, 0x989b, 0x989c, 0x989d, 0x989e, 0x989f, 0x98a0, /*0xe0-0xe7*/ 0x98a1, 0x98a2, 0x98a3, 0x98a4, 0x98a5, 0xe9ca, 0x98a6, 0x98a7, /*0xe8-0xef*/ 0x98a8, 0x98a9, 0xe9ce, 0x98aa, 0x98ab, 0x98ac, 0x98ad, 0x98ae, /*0xf0-0xf7*/ 0x98af, 0x98b0, 0x98b1, 0x98b2, 0x98b3, 0xb2db, 0x98b4, 0xe9c8, /*0xf8-0xff*/ /* 0x6a00 */ 0x98b5, 0x98b6, 0x98b7, 0x98b8, 0x98b9, 0x98ba, 0x98bb, 0x98bc, /*0x00-0x07*/ 0x98bd, 0x98be, 0xb7ae, 0x98bf, 0x98c0, 0x98c1, 0x98c2, 0x98c3, /*0x08-0x0f*/ 0x98c4, 0x98c5, 0x98c6, 0x98c7, 0x98c8, 0x98c9, 0x98ca, 0xe9cb, /*0x10-0x17*/ 0xe9cc, 0x98cb, 0x98cc, 0x98cd, 0x98ce, 0x98cf, 0x98d0, 0xd5c1, /*0x18-0x1f*/ 0x98d1, 0xc4a3, 0x98d2, 0x98d3, 0x98d4, 0x98d5, 0x98d6, 0x98d7, /*0x20-0x27*/ 0xe9d8, 0x98d8, 0xbae1, 0x98d9, 0x98da, 0x98db, 0x98dc, 0xe9c9, /*0x28-0x2f*/ 0x98dd, 0xd3a3, 0x98de, 0x98df, 0x98e0, 0xe9d4, 0x98e1, 0x98e2, /*0x30-0x37*/ 0x98e3, 0x98e4, 0x98e5, 0x98e6, 0x98e7, 0xe9d7, 0xe9d0, 0x98e8, /*0x38-0x3f*/ 0x98e9, 0x98ea, 0x98eb, 0x98ec, 0xe9cf, 0x98ed, 0x98ee, 0xc7c1, /*0x40-0x47*/ 0x98ef, 0x98f0, 0x98f1, 0x98f2, 0x98f3, 0x98f4, 0x98f5, 0x98f6, /*0x48-0x4f*/ 0xe9d2, 0x98f7, 0x98f8, 0x98f9, 0x98fa, 0x98fb, 0x98fc, 0x98fd, /*0x50-0x57*/ 0xe9d9, 0xb3c8, 0x98fe, 0xe9d3, 0x9940, 0x9941, 0x9942, 0x9943, /*0x58-0x5f*/ 0x9944, 0xcff0, 0x9945, 0x9946, 0x9947, 0xe9cd, 0x9948, 0x9949, /*0x60-0x67*/ 0x994a, 0x994b, 0x994c, 0x994d, 0x994e, 0x994f, 0x9950, 0x9951, /*0x68-0x6f*/ 0x9952, 0xb3f7, 0x9953, 0x9954, 0x9955, 0x9956, 0x9957, 0x9958, /*0x70-0x77*/ 0x9959, 0xe9d6, 0x995a, 0x995b, 0xe9da, 0x995c, 0x995d, 0x995e, /*0x78-0x7f*/ 0xccb4, 0x995f, 0x9960, 0x9961, 0xcfad, 0x9962, 0x9963, 0x9964, /*0x80-0x87*/ 0x9965, 0x9966, 0x9967, 0x9968, 0x9969, 0x996a, 0xe9d5, 0x996b, /*0x88-0x8f*/ 0xe9dc, 0xe9db, 0x996c, 0x996d, 0x996e, 0x996f, 0x9970, 0xe9de, /*0x90-0x97*/ 0x9971, 0x9972, 0x9973, 0x9974, 0x9975, 0x9976, 0x9977, 0x9978, /*0x98-0x9f*/ 0xe9d1, 0x9979, 0x997a, 0x997b, 0x997c, 0x997d, 0x997e, 0x9980, /*0xa0-0xa7*/ 0x9981, 0xe9dd, 0x9982, 0xe9df, 0xc3ca, 0x9983, 0x9984, 0x9985, /*0xa8-0xaf*/ 0x9986, 0x9987, 0x9988, 0x9989, 0x998a, 0x998b, 0x998c, 0x998d, /*0xb0-0xb7*/ 0x998e, 0x998f, 0x9990, 0x9991, 0x9992, 0x9993, 0x9994, 0x9995, /*0xb8-0xbf*/ 0x9996, 0x9997, 0x9998, 0x9999, 0x999a, 0x999b, 0x999c, 0x999d, /*0xc0-0xc7*/ 0x999e, 0x999f, 0x99a0, 0x99a1, 0x99a2, 0x99a3, 0x99a4, 0x99a5, /*0xc8-0xcf*/ 0x99a6, 0x99a7, 0x99a8, 0x99a9, 0x99aa, 0x99ab, 0x99ac, 0x99ad, /*0xd0-0xd7*/ 0x99ae, 0x99af, 0x99b0, 0x99b1, 0x99b2, 0x99b3, 0x99b4, 0x99b5, /*0xd8-0xdf*/ 0x99b6, 0x99b7, 0x99b8, 0x99b9, 0x99ba, 0x99bb, 0x99bc, 0x99bd, /*0xe0-0xe7*/ 0x99be, 0x99bf, 0x99c0, 0x99c1, 0x99c2, 0x99c3, 0x99c4, 0x99c5, /*0xe8-0xef*/ 0x99c6, 0x99c7, 0x99c8, 0x99c9, 0x99ca, 0x99cb, 0x99cc, 0x99cd, /*0xf0-0xf7*/ 0x99ce, 0x99cf, 0x99d0, 0x99d1, 0x99d2, 0x99d3, 0x99d4, 0x99d5, /*0xf8-0xff*/ /* 0x6b00 */ 0x99d6, 0x99d7, 0x99d8, 0x99d9, 0x99da, 0x99db, 0x99dc, 0x99dd, /*0x00-0x07*/ 0x99de, 0x99df, 0x99e0, 0x99e1, 0x99e2, 0x99e3, 0x99e4, 0x99e5, /*0x08-0x0f*/ 0x99e6, 0x99e7, 0x99e8, 0x99e9, 0x99ea, 0x99eb, 0x99ec, 0x99ed, /*0x10-0x17*/ 0x99ee, 0x99ef, 0x99f0, 0x99f1, 0x99f2, 0x99f3, 0x99f4, 0x99f5, /*0x18-0x1f*/ 0xc7b7, 0xb4ce, 0xbbb6, 0xd0c0, 0xeca3, 0x99f6, 0x99f7, 0xc5b7, /*0x20-0x27*/ 0x99f8, 0x99f9, 0x99fa, 0x99fb, 0x99fc, 0x99fd, 0x99fe, 0x9a40, /*0x28-0x2f*/ 0x9a41, 0x9a42, 0xd3fb, 0x9a43, 0x9a44, 0x9a45, 0x9a46, 0xeca4, /*0x30-0x37*/ 0x9a47, 0xeca5, 0xc6db, 0x9a48, 0x9a49, 0x9a4a, 0xbfee, 0x9a4b, /*0x38-0x3f*/ 0x9a4c, 0x9a4d, 0x9a4e, 0xeca6, 0x9a4f, 0x9a50, 0xeca7, 0xd0aa, /*0x40-0x47*/ 0x9a51, 0xc7b8, 0x9a52, 0x9a53, 0xb8e8, 0x9a54, 0x9a55, 0x9a56, /*0x48-0x4f*/ 0x9a57, 0x9a58, 0x9a59, 0x9a5a, 0x9a5b, 0x9a5c, 0x9a5d, 0x9a5e, /*0x50-0x57*/ 0x9a5f, 0xeca8, 0x9a60, 0x9a61, 0x9a62, 0x9a63, 0x9a64, 0x9a65, /*0x58-0x5f*/ 0x9a66, 0x9a67, 0xd6b9, 0xd5fd, 0xb4cb, 0xb2bd, 0xcee4, 0xc6e7, /*0x60-0x67*/ 0x9a68, 0x9a69, 0xcde1, 0x9a6a, 0x9a6b, 0x9a6c, 0x9a6d, 0x9a6e, /*0x68-0x6f*/ 0x9a6f, 0x9a70, 0x9a71, 0x9a72, 0x9a73, 0x9a74, 0x9a75, 0x9a76, /*0x70-0x77*/ 0x9a77, 0xb4f5, 0x9a78, 0xcbc0, 0xbcdf, 0x9a79, 0x9a7a, 0x9a7b, /*0x78-0x7f*/ 0x9a7c, 0xe9e2, 0xe9e3, 0xd1ea, 0xe9e5, 0x9a7d, 0xb4f9, 0xe9e4, /*0x80-0x87*/ 0x9a7e, 0xd1b3, 0xcae2, 0xb2d0, 0x9a80, 0xe9e8, 0x9a81, 0x9a82, /*0x88-0x8f*/ 0x9a83, 0x9a84, 0xe9e6, 0xe9e7, 0x9a85, 0x9a86, 0xd6b3, 0x9a87, /*0x90-0x97*/ 0x9a88, 0x9a89, 0xe9e9, 0xe9ea, 0x9a8a, 0x9a8b, 0x9a8c, 0x9a8d, /*0x98-0x9f*/ 0x9a8e, 0xe9eb, 0x9a8f, 0x9a90, 0x9a91, 0x9a92, 0x9a93, 0x9a94, /*0xa0-0xa7*/ 0x9a95, 0x9a96, 0xe9ec, 0x9a97, 0x9a98, 0x9a99, 0x9a9a, 0x9a9b, /*0xa8-0xaf*/ 0x9a9c, 0x9a9d, 0x9a9e, 0xecaf, 0xc5b9, 0xb6ce, 0x9a9f, 0xd2f3, /*0xb0-0xb7*/ 0x9aa0, 0x9aa1, 0x9aa2, 0x9aa3, 0x9aa4, 0x9aa5, 0x9aa6, 0xb5ee, /*0xb8-0xbf*/ 0x9aa7, 0xbbd9, 0xecb1, 0x9aa8, 0x9aa9, 0xd2e3, 0x9aaa, 0x9aab, /*0xc0-0xc7*/ 0x9aac, 0x9aad, 0x9aae, 0xcee3, 0x9aaf, 0xc4b8, 0x9ab0, 0xc3bf, /*0xc8-0xcf*/ 0x9ab1, 0x9ab2, 0xb6be, 0xd8b9, 0xb1c8, 0xb1cf, 0xb1d1, 0xc5fe, /*0xd0-0xd7*/ 0x9ab3, 0xb1d0, 0x9ab4, 0xc3ab, 0x9ab5, 0x9ab6, 0x9ab7, 0x9ab8, /*0xd8-0xdf*/ 0x9ab9, 0xd5b1, 0x9aba, 0x9abb, 0x9abc, 0x9abd, 0x9abe, 0x9abf, /*0xe0-0xe7*/ 0x9ac0, 0x9ac1, 0xeba4, 0xbac1, 0x9ac2, 0x9ac3, 0x9ac4, 0xccba, /*0xe8-0xef*/ 0x9ac5, 0x9ac6, 0x9ac7, 0xeba5, 0x9ac8, 0xeba7, 0x9ac9, 0x9aca, /*0xf0-0xf7*/ 0x9acb, 0xeba8, 0x9acc, 0x9acd, 0x9ace, 0xeba6, 0x9acf, 0x9ad0, /*0xf8-0xff*/ /* 0x6c00 */ 0x9ad1, 0x9ad2, 0x9ad3, 0x9ad4, 0x9ad5, 0xeba9, 0xebab, 0xebaa, /*0x00-0x07*/ 0x9ad6, 0x9ad7, 0x9ad8, 0x9ad9, 0x9ada, 0xebac, 0x9adb, 0xcacf, /*0x08-0x0f*/ 0xd8b5, 0xc3f1, 0x9adc, 0xc3a5, 0xc6f8, 0xebad, 0xc4ca, 0x9add, /*0x10-0x17*/ 0xebae, 0xebaf, 0xebb0, 0xb7d5, 0x9ade, 0x9adf, 0x9ae0, 0xb7fa, /*0x18-0x1f*/ 0x9ae1, 0xebb1, 0xc7e2, 0x9ae2, 0xebb3, 0x9ae3, 0xbaa4, 0xd1f5, /*0x20-0x27*/ 0xb0b1, 0xebb2, 0xebb4, 0x9ae4, 0x9ae5, 0x9ae6, 0xb5aa, 0xc2c8, /*0x28-0x2f*/ 0xc7e8, 0x9ae7, 0xebb5, 0x9ae8, 0xcbae, 0xe3df, 0x9ae9, 0x9aea, /*0x30-0x37*/ 0xd3c0, 0x9aeb, 0x9aec, 0x9aed, 0x9aee, 0xd9db, 0x9aef, 0x9af0, /*0x38-0x3f*/ 0xcda1, 0xd6ad, 0xc7f3, 0x9af1, 0x9af2, 0x9af3, 0xd9e0, 0xbbe3, /*0x40-0x47*/ 0x9af4, 0xbaba, 0xe3e2, 0x9af5, 0x9af6, 0x9af7, 0x9af8, 0x9af9, /*0x48-0x4f*/ 0xcfab, 0x9afa, 0x9afb, 0x9afc, 0xe3e0, 0xc9c7, 0x9afd, 0xbab9, /*0x50-0x57*/ 0x9afe, 0x9b40, 0x9b41, 0xd1b4, 0xe3e1, 0xc8ea, 0xb9af, 0xbdad, /*0x58-0x5f*/ 0xb3d8, 0xcedb, 0x9b42, 0x9b43, 0xccc0, 0x9b44, 0x9b45, 0x9b46, /*0x60-0x67*/ 0xe3e8, 0xe3e9, 0xcdf4, 0x9b47, 0x9b48, 0x9b49, 0x9b4a, 0x9b4b, /*0x68-0x6f*/ 0xccad, 0x9b4c, 0xbcb3, 0x9b4d, 0xe3ea, 0x9b4e, 0xe3eb, 0x9b4f, /*0x70-0x77*/ 0x9b50, 0xd0da, 0x9b51, 0x9b52, 0x9b53, 0xc6fb, 0xb7da, 0x9b54, /*0x78-0x7f*/ 0x9b55, 0xc7df, 0xd2ca, 0xced6, 0x9b56, 0xe3e4, 0xe3ec, 0x9b57, /*0x80-0x87*/ 0xc9f2, 0xb3c1, 0x9b58, 0x9b59, 0xe3e7, 0x9b5a, 0x9b5b, 0xc6e3, /*0x88-0x8f*/ 0xe3e5, 0x9b5c, 0x9b5d, 0xedb3, 0xe3e6, 0x9b5e, 0x9b5f, 0x9b60, /*0x90-0x97*/ 0x9b61, 0xc9b3, 0x9b62, 0xc5e6, 0x9b63, 0x9b64, 0x9b65, 0xb9b5, /*0x98-0x9f*/ 0x9b66, 0xc3bb, 0x9b67, 0xe3e3, 0xc5bd, 0xc1a4, 0xc2d9, 0xb2d7, /*0xa0-0xa7*/ 0x9b68, 0xe3ed, 0xbba6, 0xc4ad, 0x9b69, 0xe3f0, 0xbeda, 0x9b6a, /*0xa8-0xaf*/ 0x9b6b, 0xe3fb, 0xe3f5, 0xbad3, 0x9b6c, 0x9b6d, 0x9b6e, 0x9b6f, /*0xb0-0xb7*/ 0xb7d0, 0xd3cd, 0x9b70, 0xd6ce, 0xd5d3, 0xb9c1, 0xd5b4, 0xd1d8, /*0xb8-0xbf*/ 0x9b71, 0x9b72, 0x9b73, 0x9b74, 0xd0b9, 0xc7f6, 0x9b75, 0x9b76, /*0xc0-0xc7*/ 0x9b77, 0xc8aa, 0xb2b4, 0x9b78, 0xc3da, 0x9b79, 0x9b7a, 0x9b7b, /*0xc8-0xcf*/ 0xe3ee, 0x9b7c, 0x9b7d, 0xe3fc, 0xe3ef, 0xb7a8, 0xe3f7, 0xe3f4, /*0xd0-0xd7*/ 0x9b7e, 0x9b80, 0x9b81, 0xb7ba, 0x9b82, 0x9b83, 0xc5a2, 0x9b84, /*0xd8-0xdf*/ 0xe3f6, 0xc5dd, 0xb2a8, 0xc6fc, 0x9b85, 0xc4e0, 0x9b86, 0x9b87, /*0xe0-0xe7*/ 0xd7a2, 0x9b88, 0xc0e1, 0xe3f9, 0x9b89, 0x9b8a, 0xe3fa, 0xe3fd, /*0xe8-0xef*/ 0xcca9, 0xe3f3, 0x9b8b, 0xd3be, 0x9b8c, 0xb1c3, 0xedb4, 0xe3f1, /*0xf0-0xf7*/ 0xe3f2, 0x9b8d, 0xe3f8, 0xd0ba, 0xc6c3, 0xd4f3, 0xe3fe, 0x9b8e, /*0xf8-0xff*/ /* 0x6d00 */ 0x9b8f, 0xbde0, 0x9b90, 0x9b91, 0xe4a7, 0x9b92, 0x9b93, 0xe4a6, /*0x00-0x07*/ 0x9b94, 0x9b95, 0x9b96, 0xd1f3, 0xe4a3, 0x9b97, 0xe4a9, 0x9b98, /*0x08-0x0f*/ 0x9b99, 0x9b9a, 0xc8f7, 0x9b9b, 0x9b9c, 0x9b9d, 0x9b9e, 0xcfb4, /*0x10-0x17*/ 0x9b9f, 0xe4a8, 0xe4ae, 0xc2e5, 0x9ba0, 0x9ba1, 0xb6b4, 0x9ba2, /*0x18-0x1f*/ 0x9ba3, 0x9ba4, 0x9ba5, 0x9ba6, 0x9ba7, 0xbdf2, 0x9ba8, 0xe4a2, /*0x20-0x27*/ 0x9ba9, 0x9baa, 0xbae9, 0xe4aa, 0x9bab, 0x9bac, 0xe4ac, 0x9bad, /*0x28-0x2f*/ 0x9bae, 0xb6fd, 0xd6de, 0xe4b2, 0x9baf, 0xe4ad, 0x9bb0, 0x9bb1, /*0x30-0x37*/ 0x9bb2, 0xe4a1, 0x9bb3, 0xbbee, 0xcddd, 0xc7a2, 0xc5c9, 0x9bb4, /*0x38-0x3f*/ 0x9bb5, 0xc1f7, 0x9bb6, 0xe4a4, 0x9bb7, 0xc7b3, 0xbdac, 0xbdbd, /*0x40-0x47*/ 0xe4a5, 0x9bb8, 0xd7c7, 0xb2e2, 0x9bb9, 0xe4ab, 0xbcc3, 0xe4af, /*0x48-0x4f*/ 0x9bba, 0xbbeb, 0xe4b0, 0xc5a8, 0xe4b1, 0x9bbb, 0x9bbc, 0x9bbd, /*0x50-0x57*/ 0x9bbe, 0xd5e3, 0xbfa3, 0x9bbf, 0xe4ba, 0x9bc0, 0xe4b7, 0x9bc1, /*0x58-0x5f*/ 0xe4bb, 0x9bc2, 0x9bc3, 0xe4bd, 0x9bc4, 0x9bc5, 0xc6d6, 0x9bc6, /*0x60-0x67*/ 0x9bc7, 0xbac6, 0xc0cb, 0x9bc8, 0x9bc9, 0x9bca, 0xb8a1, 0xe4b4, /*0x68-0x6f*/ 0x9bcb, 0x9bcc, 0x9bcd, 0x9bce, 0xd4a1, 0x9bcf, 0x9bd0, 0xbaa3, /*0x70-0x77*/ 0xbdfe, 0x9bd1, 0x9bd2, 0x9bd3, 0xe4bc, 0x9bd4, 0x9bd5, 0x9bd6, /*0x78-0x7f*/ 0x9bd7, 0x9bd8, 0xcdbf, 0x9bd9, 0x9bda, 0xc4f9, 0x9bdb, 0x9bdc, /*0x80-0x87*/ 0xcffb, 0xc9e6, 0x9bdd, 0x9bde, 0xd3bf, 0x9bdf, 0xcfd1, 0x9be0, /*0x88-0x8f*/ 0x9be1, 0xe4b3, 0x9be2, 0xe4b8, 0xe4b9, 0xcce9, 0x9be3, 0x9be4, /*0x90-0x97*/ 0x9be5, 0x9be6, 0x9be7, 0xccce, 0x9be8, 0xc0d4, 0xe4b5, 0xc1b0, /*0x98-0x9f*/ 0xe4b6, 0xced0, 0x9be9, 0xbbc1, 0xb5d3, 0x9bea, 0xc8f3, 0xbda7, /*0xa0-0xa7*/ 0xd5c7, 0xc9ac, 0xb8a2, 0xe4ca, 0x9beb, 0x9bec, 0xe4cc, 0xd1c4, /*0xa8-0xaf*/ 0x9bed, 0x9bee, 0xd2ba, 0x9bef, 0x9bf0, 0xbaad, 0x9bf1, 0x9bf2, /*0xb0-0xb7*/ 0xbad4, 0x9bf3, 0x9bf4, 0x9bf5, 0x9bf6, 0x9bf7, 0x9bf8, 0xe4c3, /*0xb8-0xbf*/ 0xb5ed, 0x9bf9, 0x9bfa, 0x9bfb, 0xd7cd, 0xe4c0, 0xcffd, 0xe4bf, /*0xc0-0xc7*/ 0x9bfc, 0x9bfd, 0x9bfe, 0xc1dc, 0xccca, 0x9c40, 0x9c41, 0x9c42, /*0xc8-0xcf*/ 0x9c43, 0xcae7, 0x9c44, 0x9c45, 0x9c46, 0x9c47, 0xc4d7, 0x9c48, /*0xd0-0xd7*/ 0xccd4, 0xe4c8, 0x9c49, 0x9c4a, 0x9c4b, 0xe4c7, 0xe4c1, 0x9c4c, /*0xd8-0xdf*/ 0xe4c4, 0xb5ad, 0x9c4d, 0x9c4e, 0xd3d9, 0x9c4f, 0xe4c6, 0x9c50, /*0xe0-0xe7*/ 0x9c51, 0x9c52, 0x9c53, 0xd2f9, 0xb4e3, 0x9c54, 0xbbb4, 0x9c55, /*0xe8-0xef*/ 0x9c56, 0xc9ee, 0x9c57, 0xb4be, 0x9c58, 0x9c59, 0x9c5a, 0xbbec, /*0xf0-0xf7*/ 0x9c5b, 0xd1cd, 0x9c5c, 0xcced, 0xedb5, 0x9c5d, 0x9c5e, 0x9c5f, /*0xf8-0xff*/ /* 0x6e00 */ 0x9c60, 0x9c61, 0x9c62, 0x9c63, 0x9c64, 0xc7e5, 0x9c65, 0x9c66, /*0x00-0x07*/ 0x9c67, 0x9c68, 0xd4a8, 0x9c69, 0xe4cb, 0xd7d5, 0xe4c2, 0x9c6a, /*0x08-0x0f*/ 0xbda5, 0xe4c5, 0x9c6b, 0x9c6c, 0xd3e6, 0x9c6d, 0xe4c9, 0xc9f8, /*0x10-0x17*/ 0x9c6e, 0x9c6f, 0xe4be, 0x9c70, 0x9c71, 0xd3e5, 0x9c72, 0x9c73, /*0x18-0x1f*/ 0xc7fe, 0xb6c9, 0x9c74, 0xd4fc, 0xb2b3, 0xe4d7, 0x9c75, 0x9c76, /*0x20-0x27*/ 0x9c77, 0xcec2, 0x9c78, 0xe4cd, 0x9c79, 0xcebc, 0x9c7a, 0xb8db, /*0x28-0x2f*/ 0x9c7b, 0x9c7c, 0xe4d6, 0x9c7d, 0xbfca, 0x9c7e, 0x9c80, 0x9c81, /*0x30-0x37*/ 0xd3ce, 0x9c82, 0xc3ec, 0x9c83, 0x9c84, 0x9c85, 0x9c86, 0x9c87, /*0x38-0x3f*/ 0x9c88, 0x9c89, 0x9c8a, 0xc5c8, 0xe4d8, 0x9c8b, 0x9c8c, 0x9c8d, /*0x40-0x47*/ 0x9c8e, 0x9c8f, 0x9c90, 0x9c91, 0x9c92, 0xcdc4, 0xe4cf, 0x9c93, /*0x48-0x4f*/ 0x9c94, 0x9c95, 0x9c96, 0xe4d4, 0xe4d5, 0x9c97, 0xbafe, 0x9c98, /*0x50-0x57*/ 0xcfe6, 0x9c99, 0x9c9a, 0xd5bf, 0x9c9b, 0x9c9c, 0x9c9d, 0xe4d2, /*0x58-0x5f*/ 0x9c9e, 0x9c9f, 0x9ca0, 0x9ca1, 0x9ca2, 0x9ca3, 0x9ca4, 0x9ca5, /*0x60-0x67*/ 0x9ca6, 0x9ca7, 0x9ca8, 0xe4d0, 0x9ca9, 0x9caa, 0xe4ce, 0x9cab, /*0x68-0x6f*/ 0x9cac, 0x9cad, 0x9cae, 0x9caf, 0x9cb0, 0x9cb1, 0x9cb2, 0x9cb3, /*0x70-0x77*/ 0x9cb4, 0x9cb5, 0x9cb6, 0x9cb7, 0x9cb8, 0x9cb9, 0xcde5, 0xcaaa, /*0x78-0x7f*/ 0x9cba, 0x9cbb, 0x9cbc, 0xc0a3, 0x9cbd, 0xbda6, 0xe4d3, 0x9cbe, /*0x80-0x87*/ 0x9cbf, 0xb8c8, 0x9cc0, 0x9cc1, 0x9cc2, 0x9cc3, 0x9cc4, 0xe4e7, /*0x88-0x8f*/ 0xd4b4, 0x9cc5, 0x9cc6, 0x9cc7, 0x9cc8, 0x9cc9, 0x9cca, 0x9ccb, /*0x90-0x97*/ 0xe4db, 0x9ccc, 0x9ccd, 0x9cce, 0xc1ef, 0x9ccf, 0x9cd0, 0xe4e9, /*0x98-0x9f*/ 0x9cd1, 0x9cd2, 0xd2e7, 0x9cd3, 0x9cd4, 0xe4df, 0x9cd5, 0xe4e0, /*0xa0-0xa7*/ 0x9cd6, 0x9cd7, 0xcfaa, 0x9cd8, 0x9cd9, 0x9cda, 0x9cdb, 0xcbdd, /*0xa8-0xaf*/ 0x9cdc, 0xe4da, 0xe4d1, 0x9cdd, 0xe4e5, 0x9cde, 0xc8dc, 0xe4e3, /*0xb0-0xb7*/ 0x9cdf, 0x9ce0, 0xc4e7, 0xe4e2, 0x9ce1, 0xe4e1, 0x9ce2, 0x9ce3, /*0xb8-0xbf*/ 0x9ce4, 0xb3fc, 0xe4e8, 0x9ce5, 0x9ce6, 0x9ce7, 0x9ce8, 0xb5e1, /*0xc0-0xc7*/ 0x9ce9, 0x9cea, 0x9ceb, 0xd7cc, 0x9cec, 0x9ced, 0x9cee, 0xe4e6, /*0xc8-0xcf*/ 0x9cef, 0xbbac, 0x9cf0, 0xd7d2, 0xcccf, 0xebf8, 0x9cf1, 0xe4e4, /*0xd0-0xd7*/ 0x9cf2, 0x9cf3, 0xb9f6, 0x9cf4, 0x9cf5, 0x9cf6, 0xd6cd, 0xe4d9, /*0xd8-0xdf*/ 0xe4dc, 0xc2fa, 0xe4de, 0x9cf7, 0xc2cb, 0xc0c4, 0xc2d0, 0x9cf8, /*0xe0-0xe7*/ 0xb1f5, 0xccb2, 0x9cf9, 0x9cfa, 0x9cfb, 0x9cfc, 0x9cfd, 0x9cfe, /*0xe8-0xef*/ 0x9d40, 0x9d41, 0x9d42, 0x9d43, 0xb5ce, 0x9d44, 0x9d45, 0x9d46, /*0xf0-0xf7*/ 0x9d47, 0xe4ef, 0x9d48, 0x9d49, 0x9d4a, 0x9d4b, 0x9d4c, 0x9d4d, /*0xf8-0xff*/ /* 0x6f00 */ 0x9d4e, 0x9d4f, 0xc6af, 0x9d50, 0x9d51, 0x9d52, 0xc6e1, 0x9d53, /*0x00-0x07*/ 0x9d54, 0xe4f5, 0x9d55, 0x9d56, 0x9d57, 0x9d58, 0x9d59, 0xc2a9, /*0x08-0x0f*/ 0x9d5a, 0x9d5b, 0x9d5c, 0xc0ec, 0xd1dd, 0xe4ee, 0x9d5d, 0x9d5e, /*0x10-0x17*/ 0x9d5f, 0x9d60, 0x9d61, 0x9d62, 0x9d63, 0x9d64, 0x9d65, 0x9d66, /*0x18-0x1f*/ 0xc4ae, 0x9d67, 0x9d68, 0x9d69, 0xe4ed, 0x9d6a, 0x9d6b, 0x9d6c, /*0x20-0x27*/ 0x9d6d, 0xe4f6, 0xe4f4, 0xc2fe, 0x9d6e, 0xe4dd, 0x9d6f, 0xe4f0, /*0x28-0x2f*/ 0x9d70, 0xcafe, 0x9d71, 0xd5c4, 0x9d72, 0x9d73, 0xe4f1, 0x9d74, /*0x30-0x37*/ 0x9d75, 0x9d76, 0x9d77, 0x9d78, 0x9d79, 0x9d7a, 0xd1fa, 0x9d7b, /*0x38-0x3f*/ 0x9d7c, 0x9d7d, 0x9d7e, 0x9d80, 0x9d81, 0x9d82, 0xe4eb, 0xe4ec, /*0x40-0x47*/ 0x9d83, 0x9d84, 0x9d85, 0xe4f2, 0x9d86, 0xceab, 0x9d87, 0x9d88, /*0x48-0x4f*/ 0x9d89, 0x9d8a, 0x9d8b, 0x9d8c, 0x9d8d, 0x9d8e, 0x9d8f, 0x9d90, /*0x50-0x57*/ 0xc5cb, 0x9d91, 0x9d92, 0x9d93, 0xc7b1, 0x9d94, 0xc2ba, 0x9d95, /*0x58-0x5f*/ 0x9d96, 0x9d97, 0xe4ea, 0x9d98, 0x9d99, 0x9d9a, 0xc1ca, 0x9d9b, /*0x60-0x67*/ 0x9d9c, 0x9d9d, 0x9d9e, 0x9d9f, 0x9da0, 0xccb6, 0xb3b1, 0x9da1, /*0x68-0x6f*/ 0x9da2, 0x9da3, 0xe4fb, 0x9da4, 0xe4f3, 0x9da5, 0x9da6, 0x9da7, /*0x70-0x77*/ 0xe4fa, 0x9da8, 0xe4fd, 0x9da9, 0xe4fc, 0x9daa, 0x9dab, 0x9dac, /*0x78-0x7f*/ 0x9dad, 0x9dae, 0x9daf, 0x9db0, 0xb3ce, 0x9db1, 0x9db2, 0x9db3, /*0x80-0x87*/ 0xb3ba, 0xe4f7, 0x9db4, 0x9db5, 0xe4f9, 0xe4f8, 0xc5ec, 0x9db6, /*0x88-0x8f*/ 0x9db7, 0x9db8, 0x9db9, 0x9dba, 0x9dbb, 0x9dbc, 0x9dbd, 0x9dbe, /*0x90-0x97*/ 0x9dbf, 0x9dc0, 0x9dc1, 0x9dc2, 0xc0bd, 0x9dc3, 0x9dc4, 0x9dc5, /*0x98-0x9f*/ 0x9dc6, 0xd4e8, 0x9dc7, 0x9dc8, 0x9dc9, 0x9dca, 0x9dcb, 0xe5a2, /*0xa0-0xa7*/ 0x9dcc, 0x9dcd, 0x9dce, 0x9dcf, 0x9dd0, 0x9dd1, 0x9dd2, 0x9dd3, /*0xa8-0xaf*/ 0x9dd4, 0x9dd5, 0x9dd6, 0xb0c4, 0x9dd7, 0x9dd8, 0xe5a4, 0x9dd9, /*0xb0-0xb7*/ 0x9dda, 0xe5a3, 0x9ddb, 0x9ddc, 0x9ddd, 0x9dde, 0x9ddf, 0x9de0, /*0xb8-0xbf*/ 0xbca4, 0x9de1, 0xe5a5, 0x9de2, 0x9de3, 0x9de4, 0x9de5, 0x9de6, /*0xc0-0xc7*/ 0x9de7, 0xe5a1, 0x9de8, 0x9de9, 0x9dea, 0x9deb, 0x9dec, 0x9ded, /*0xc8-0xcf*/ 0x9dee, 0xe4fe, 0xb1f4, 0x9def, 0x9df0, 0x9df1, 0x9df2, 0x9df3, /*0xd0-0xd7*/ 0x9df4, 0x9df5, 0x9df6, 0x9df7, 0x9df8, 0x9df9, 0xe5a8, 0x9dfa, /*0xd8-0xdf*/ 0xe5a9, 0xe5a6, 0x9dfb, 0x9dfc, 0x9dfd, 0x9dfe, 0x9e40, 0x9e41, /*0xe0-0xe7*/ 0x9e42, 0x9e43, 0x9e44, 0x9e45, 0x9e46, 0x9e47, 0xe5a7, 0xe5aa, /*0xe8-0xef*/ 0x9e48, 0x9e49, 0x9e4a, 0x9e4b, 0x9e4c, 0x9e4d, 0x9e4e, 0x9e4f, /*0xf0-0xf7*/ 0x9e50, 0x9e51, 0x9e52, 0x9e53, 0x9e54, 0x9e55, 0x9e56, 0x9e57, /*0xf8-0xff*/ /* 0x7000 */ 0x9e58, 0x9e59, 0x9e5a, 0x9e5b, 0x9e5c, 0x9e5d, 0x9e5e, 0x9e5f, /*0x00-0x07*/ 0x9e60, 0x9e61, 0x9e62, 0x9e63, 0x9e64, 0x9e65, 0x9e66, 0x9e67, /*0x08-0x0f*/ 0x9e68, 0xc6d9, 0x9e69, 0x9e6a, 0x9e6b, 0x9e6c, 0x9e6d, 0x9e6e, /*0x10-0x17*/ 0x9e6f, 0x9e70, 0xe5ab, 0xe5ad, 0x9e71, 0x9e72, 0x9e73, 0x9e74, /*0x18-0x1f*/ 0x9e75, 0x9e76, 0x9e77, 0xe5ac, 0x9e78, 0x9e79, 0x9e7a, 0x9e7b, /*0x20-0x27*/ 0x9e7c, 0x9e7d, 0x9e7e, 0x9e80, 0x9e81, 0x9e82, 0x9e83, 0x9e84, /*0x28-0x2f*/ 0x9e85, 0x9e86, 0x9e87, 0x9e88, 0x9e89, 0xe5af, 0x9e8a, 0x9e8b, /*0x30-0x37*/ 0x9e8c, 0xe5ae, 0x9e8d, 0x9e8e, 0x9e8f, 0x9e90, 0x9e91, 0x9e92, /*0x38-0x3f*/ 0x9e93, 0x9e94, 0x9e95, 0x9e96, 0x9e97, 0x9e98, 0x9e99, 0x9e9a, /*0x40-0x47*/ 0x9e9b, 0x9e9c, 0x9e9d, 0x9e9e, 0xb9e0, 0x9e9f, 0x9ea0, 0xe5b0, /*0x48-0x4f*/ 0x9ea1, 0x9ea2, 0x9ea3, 0x9ea4, 0x9ea5, 0x9ea6, 0x9ea7, 0x9ea8, /*0x50-0x57*/ 0x9ea9, 0x9eaa, 0x9eab, 0x9eac, 0x9ead, 0x9eae, 0xe5b1, 0x9eaf, /*0x58-0x5f*/ 0x9eb0, 0x9eb1, 0x9eb2, 0x9eb3, 0x9eb4, 0x9eb5, 0x9eb6, 0x9eb7, /*0x60-0x67*/ 0x9eb8, 0x9eb9, 0x9eba, 0xbbf0, 0xece1, 0xc3f0, 0x9ebb, 0xb5c6, /*0x68-0x6f*/ 0xbbd2, 0x9ebc, 0x9ebd, 0x9ebe, 0x9ebf, 0xc1e9, 0xd4ee, 0x9ec0, /*0x70-0x77*/ 0xbec4, 0x9ec1, 0x9ec2, 0x9ec3, 0xd7c6, 0x9ec4, 0xd4d6, 0xb2d3, /*0x78-0x7f*/ 0xecbe, 0x9ec5, 0x9ec6, 0x9ec7, 0x9ec8, 0xeac1, 0x9ec9, 0x9eca, /*0x80-0x87*/ 0x9ecb, 0xc2af, 0xb4b6, 0x9ecc, 0x9ecd, 0x9ece, 0xd1d7, 0x9ecf, /*0x88-0x8f*/ 0x9ed0, 0x9ed1, 0xb3b4, 0x9ed2, 0xc8b2, 0xbfbb, 0xecc0, 0x9ed3, /*0x90-0x97*/ 0x9ed4, 0xd6cb, 0x9ed5, 0x9ed6, 0xecbf, 0xecc1, 0x9ed7, 0x9ed8, /*0x98-0x9f*/ 0x9ed9, 0x9eda, 0x9edb, 0x9edc, 0x9edd, 0x9ede, 0x9edf, 0x9ee0, /*0xa0-0xa7*/ 0x9ee1, 0x9ee2, 0x9ee3, 0xecc5, 0xbee6, 0xccbf, 0xc5da, 0xbebc, /*0xa8-0xaf*/ 0x9ee4, 0xecc6, 0x9ee5, 0xb1fe, 0x9ee6, 0x9ee7, 0x9ee8, 0xecc4, /*0xb0-0xb7*/ 0xd5a8, 0xb5e3, 0x9ee9, 0xecc2, 0xc1b6, 0xb3e3, 0x9eea, 0x9eeb, /*0xb8-0xbf*/ 0xecc3, 0xcbb8, 0xc0c3, 0xccfe, 0x9eec, 0x9eed, 0x9eee, 0x9eef, /*0xc0-0xc7*/ 0xc1d2, 0x9ef0, 0xecc8, 0x9ef1, 0x9ef2, 0x9ef3, 0x9ef4, 0x9ef5, /*0xc8-0xcf*/ 0x9ef6, 0x9ef7, 0x9ef8, 0x9ef9, 0x9efa, 0x9efb, 0x9efc, 0x9efd, /*0xd0-0xd7*/ 0xbae6, 0xc0d3, 0x9efe, 0xd6f2, 0x9f40, 0x9f41, 0x9f42, 0xd1cc, /*0xd8-0xdf*/ 0x9f43, 0x9f44, 0x9f45, 0x9f46, 0xbfbe, 0x9f47, 0xb7b3, 0xc9d5, /*0xe0-0xe7*/ 0xecc7, 0xbbe2, 0x9f48, 0xcccc, 0xbdfd, 0xc8c8, 0x9f49, 0xcfa9, /*0xe8-0xef*/ 0x9f4a, 0x9f4b, 0x9f4c, 0x9f4d, 0x9f4e, 0x9f4f, 0x9f50, 0xcde9, /*0xf0-0xf7*/ 0x9f51, 0xc5eb, 0x9f52, 0x9f53, 0x9f54, 0xb7e9, 0x9f55, 0x9f56, /*0xf8-0xff*/ /* 0x7100 */ 0x9f57, 0x9f58, 0x9f59, 0x9f5a, 0x9f5b, 0x9f5c, 0x9f5d, 0x9f5e, /*0x00-0x07*/ 0x9f5f, 0xd1c9, 0xbab8, 0x9f60, 0x9f61, 0x9f62, 0x9f63, 0x9f64, /*0x08-0x0f*/ 0xecc9, 0x9f65, 0x9f66, 0xecca, 0x9f67, 0xbbc0, 0xeccb, 0x9f68, /*0x10-0x17*/ 0xece2, 0xb1ba, 0xb7d9, 0x9f69, 0x9f6a, 0x9f6b, 0x9f6c, 0x9f6d, /*0x18-0x1f*/ 0x9f6e, 0x9f6f, 0x9f70, 0x9f71, 0x9f72, 0x9f73, 0xbdb9, 0x9f74, /*0x20-0x27*/ 0x9f75, 0x9f76, 0x9f77, 0x9f78, 0x9f79, 0x9f7a, 0x9f7b, 0xeccc, /*0x28-0x2f*/ 0xd1e6, 0xeccd, 0x9f7c, 0x9f7d, 0x9f7e, 0x9f80, 0xc8bb, 0x9f81, /*0x30-0x37*/ 0x9f82, 0x9f83, 0x9f84, 0x9f85, 0x9f86, 0x9f87, 0x9f88, 0x9f89, /*0x38-0x3f*/ 0x9f8a, 0x9f8b, 0x9f8c, 0x9f8d, 0x9f8e, 0xecd1, 0x9f8f, 0x9f90, /*0x40-0x47*/ 0x9f91, 0x9f92, 0xecd3, 0x9f93, 0xbbcd, 0x9f94, 0xbce5, 0x9f95, /*0x48-0x4f*/ 0x9f96, 0x9f97, 0x9f98, 0x9f99, 0x9f9a, 0x9f9b, 0x9f9c, 0x9f9d, /*0x50-0x57*/ 0x9f9e, 0x9f9f, 0x9fa0, 0x9fa1, 0xeccf, 0x9fa2, 0xc9b7, 0x9fa3, /*0x58-0x5f*/ 0x9fa4, 0x9fa5, 0x9fa6, 0x9fa7, 0xc3ba, 0x9fa8, 0xece3, 0xd5d5, /*0x60-0x67*/ 0xecd0, 0x9fa9, 0x9faa, 0x9fab, 0x9fac, 0x9fad, 0xd6f3, 0x9fae, /*0x68-0x6f*/ 0x9faf, 0x9fb0, 0xecd2, 0xecce, 0x9fb1, 0x9fb2, 0x9fb3, 0x9fb4, /*0x70-0x77*/ 0xecd4, 0x9fb5, 0xecd5, 0x9fb6, 0x9fb7, 0xc9bf, 0x9fb8, 0x9fb9, /*0x78-0x7f*/ 0x9fba, 0x9fbb, 0x9fbc, 0x9fbd, 0xcfa8, 0x9fbe, 0x9fbf, 0x9fc0, /*0x80-0x87*/ 0x9fc1, 0x9fc2, 0xd0dc, 0x9fc3, 0x9fc4, 0x9fc5, 0x9fc6, 0xd1ac, /*0x88-0x8f*/ 0x9fc7, 0x9fc8, 0x9fc9, 0x9fca, 0xc8db, 0x9fcb, 0x9fcc, 0x9fcd, /*0x90-0x97*/ 0xecd6, 0xcef5, 0x9fce, 0x9fcf, 0x9fd0, 0x9fd1, 0x9fd2, 0xcaec, /*0x98-0x9f*/ 0xecda, 0x9fd3, 0x9fd4, 0x9fd5, 0x9fd6, 0x9fd7, 0x9fd8, 0x9fd9, /*0xa0-0xa7*/ 0xecd9, 0x9fda, 0x9fdb, 0x9fdc, 0xb0be, 0x9fdd, 0x9fde, 0x9fdf, /*0xa8-0xaf*/ 0x9fe0, 0x9fe1, 0x9fe2, 0xecd7, 0x9fe3, 0xecd8, 0x9fe4, 0x9fe5, /*0xb0-0xb7*/ 0x9fe6, 0xece4, 0x9fe7, 0x9fe8, 0x9fe9, 0x9fea, 0x9feb, 0x9fec, /*0xb8-0xbf*/ 0x9fed, 0x9fee, 0x9fef, 0xc8bc, 0x9ff0, 0x9ff1, 0x9ff2, 0x9ff3, /*0xc0-0xc7*/ 0x9ff4, 0x9ff5, 0x9ff6, 0x9ff7, 0x9ff8, 0x9ff9, 0xc1c7, 0x9ffa, /*0xc8-0xcf*/ 0x9ffb, 0x9ffc, 0x9ffd, 0x9ffe, 0xecdc, 0xd1e0, 0xa040, 0xa041, /*0xd0-0xd7*/ 0xa042, 0xa043, 0xa044, 0xa045, 0xa046, 0xa047, 0xa048, 0xa049, /*0xd8-0xdf*/ 0xecdb, 0xa04a, 0xa04b, 0xa04c, 0xa04d, 0xd4ef, 0xa04e, 0xecdd, /*0xe0-0xe7*/ 0xa04f, 0xa050, 0xa051, 0xa052, 0xa053, 0xa054, 0xdbc6, 0xa055, /*0xe8-0xef*/ 0xa056, 0xa057, 0xa058, 0xa059, 0xa05a, 0xa05b, 0xa05c, 0xa05d, /*0xf0-0xf7*/ 0xa05e, 0xecde, 0xa05f, 0xa060, 0xa061, 0xa062, 0xa063, 0xa064, /*0xf8-0xff*/ /* 0x7200 */ 0xa065, 0xa066, 0xa067, 0xa068, 0xa069, 0xa06a, 0xb1ac, 0xa06b, /*0x00-0x07*/ 0xa06c, 0xa06d, 0xa06e, 0xa06f, 0xa070, 0xa071, 0xa072, 0xa073, /*0x08-0x0f*/ 0xa074, 0xa075, 0xa076, 0xa077, 0xa078, 0xa079, 0xa07a, 0xa07b, /*0x10-0x17*/ 0xa07c, 0xa07d, 0xa07e, 0xa080, 0xa081, 0xecdf, 0xa082, 0xa083, /*0x18-0x1f*/ 0xa084, 0xa085, 0xa086, 0xa087, 0xa088, 0xa089, 0xa08a, 0xa08b, /*0x20-0x27*/ 0xece0, 0xa08c, 0xd7a6, 0xa08d, 0xc5c0, 0xa08e, 0xa08f, 0xa090, /*0x28-0x2f*/ 0xebbc, 0xb0ae, 0xa091, 0xa092, 0xa093, 0xbef4, 0xb8b8, 0xd2af, /*0x30-0x37*/ 0xb0d6, 0xb5f9, 0xa094, 0xd8b3, 0xa095, 0xcbac, 0xa096, 0xe3dd, /*0x38-0x3f*/ 0xa097, 0xa098, 0xa099, 0xa09a, 0xa09b, 0xa09c, 0xa09d, 0xc6ac, /*0x40-0x47*/ 0xb0e6, 0xa09e, 0xa09f, 0xa0a0, 0xc5c6, 0xebb9, 0xa0a1, 0xa0a2, /*0x48-0x4f*/ 0xa0a3, 0xa0a4, 0xebba, 0xa0a5, 0xa0a6, 0xa0a7, 0xebbb, 0xa0a8, /*0x50-0x57*/ 0xa0a9, 0xd1c0, 0xa0aa, 0xc5a3, 0xa0ab, 0xeaf2, 0xa0ac, 0xc4b2, /*0x58-0x5f*/ 0xa0ad, 0xc4b5, 0xc0ce, 0xa0ae, 0xa0af, 0xa0b0, 0xeaf3, 0xc4c1, /*0x60-0x67*/ 0xa0b1, 0xceef, 0xa0b2, 0xa0b3, 0xa0b4, 0xa0b5, 0xeaf0, 0xeaf4, /*0x68-0x6f*/ 0xa0b6, 0xa0b7, 0xc9fc, 0xa0b8, 0xa0b9, 0xc7a3, 0xa0ba, 0xa0bb, /*0x70-0x77*/ 0xa0bc, 0xccd8, 0xcefe, 0xa0bd, 0xa0be, 0xa0bf, 0xeaf5, 0xeaf6, /*0x78-0x7f*/ 0xcfac, 0xc0e7, 0xa0c0, 0xa0c1, 0xeaf7, 0xa0c2, 0xa0c3, 0xa0c4, /*0x80-0x87*/ 0xa0c5, 0xa0c6, 0xb6bf, 0xeaf8, 0xa0c7, 0xeaf9, 0xa0c8, 0xeafa, /*0x88-0x8f*/ 0xa0c9, 0xa0ca, 0xeafb, 0xa0cb, 0xa0cc, 0xa0cd, 0xa0ce, 0xa0cf, /*0x90-0x97*/ 0xa0d0, 0xa0d1, 0xa0d2, 0xa0d3, 0xa0d4, 0xa0d5, 0xa0d6, 0xeaf1, /*0x98-0x9f*/ 0xa0d7, 0xa0d8, 0xa0d9, 0xa0da, 0xa0db, 0xa0dc, 0xa0dd, 0xa0de, /*0xa0-0xa7*/ 0xa0df, 0xa0e0, 0xa0e1, 0xa0e2, 0xc8ae, 0xe1eb, 0xa0e3, 0xb7b8, /*0xa8-0xaf*/ 0xe1ec, 0xa0e4, 0xa0e5, 0xa0e6, 0xe1ed, 0xa0e7, 0xd7b4, 0xe1ee, /*0xb0-0xb7*/ 0xe1ef, 0xd3cc, 0xa0e8, 0xa0e9, 0xa0ea, 0xa0eb, 0xa0ec, 0xa0ed, /*0xb8-0xbf*/ 0xa0ee, 0xe1f1, 0xbff1, 0xe1f0, 0xb5d2, 0xa0ef, 0xa0f0, 0xa0f1, /*0xc0-0xc7*/ 0xb1b7, 0xa0f2, 0xa0f3, 0xa0f4, 0xa0f5, 0xe1f3, 0xe1f2, 0xa0f6, /*0xc8-0xcf*/ 0xbafc, 0xa0f7, 0xe1f4, 0xa0f8, 0xa0f9, 0xa0fa, 0xa0fb, 0xb9b7, /*0xd0-0xd7*/ 0xa0fc, 0xbed1, 0xa0fd, 0xa0fe, 0xaa40, 0xaa41, 0xc4fc, 0xaa42, /*0xd8-0xdf*/ 0xbadd, 0xbdc6, 0xaa43, 0xaa44, 0xaa45, 0xaa46, 0xaa47, 0xaa48, /*0xe0-0xe7*/ 0xe1f5, 0xe1f7, 0xaa49, 0xaa4a, 0xb6c0, 0xcfc1, 0xcaa8, 0xe1f6, /*0xe8-0xef*/ 0xd5f8, 0xd3fc, 0xe1f8, 0xe1fc, 0xe1f9, 0xaa4b, 0xaa4c, 0xe1fa, /*0xf0-0xf7*/ 0xc0ea, 0xaa4d, 0xe1fe, 0xe2a1, 0xc0c7, 0xaa4e, 0xaa4f, 0xaa50, /*0xf8-0xff*/ /* 0x7300 */ 0xaa51, 0xe1fb, 0xaa52, 0xe1fd, 0xaa53, 0xaa54, 0xaa55, 0xaa56, /*0x00-0x07*/ 0xaa57, 0xaa58, 0xe2a5, 0xaa59, 0xaa5a, 0xaa5b, 0xc1d4, 0xaa5c, /*0x08-0x0f*/ 0xaa5d, 0xaa5e, 0xaa5f, 0xe2a3, 0xaa60, 0xe2a8, 0xb2fe, 0xe2a2, /*0x10-0x17*/ 0xaa61, 0xaa62, 0xaa63, 0xc3cd, 0xb2c2, 0xe2a7, 0xe2a6, 0xaa64, /*0x18-0x1f*/ 0xaa65, 0xe2a4, 0xe2a9, 0xaa66, 0xaa67, 0xe2ab, 0xaa68, 0xaa69, /*0x20-0x27*/ 0xaa6a, 0xd0c9, 0xd6ed, 0xc3a8, 0xe2ac, 0xaa6b, 0xcfd7, 0xaa6c, /*0x28-0x2f*/ 0xaa6d, 0xe2ae, 0xaa6e, 0xaa6f, 0xbaef, 0xaa70, 0xaa71, 0xe9e0, /*0x30-0x37*/ 0xe2ad, 0xe2aa, 0xaa72, 0xaa73, 0xaa74, 0xaa75, 0xbbab, 0xd4b3, /*0x38-0x3f*/ 0xaa76, 0xaa77, 0xaa78, 0xaa79, 0xaa7a, 0xaa7b, 0xaa7c, 0xaa7d, /*0x40-0x47*/ 0xaa7e, 0xaa80, 0xaa81, 0xaa82, 0xaa83, 0xe2b0, 0xaa84, 0xaa85, /*0x48-0x4f*/ 0xe2af, 0xaa86, 0xe9e1, 0xaa87, 0xaa88, 0xaa89, 0xaa8a, 0xe2b1, /*0x50-0x57*/ 0xaa8b, 0xaa8c, 0xaa8d, 0xaa8e, 0xaa8f, 0xaa90, 0xaa91, 0xaa92, /*0x58-0x5f*/ 0xe2b2, 0xaa93, 0xaa94, 0xaa95, 0xaa96, 0xaa97, 0xaa98, 0xaa99, /*0x60-0x67*/ 0xaa9a, 0xaa9b, 0xaa9c, 0xaa9d, 0xe2b3, 0xcca1, 0xaa9e, 0xe2b4, /*0x68-0x6f*/ 0xaa9f, 0xaaa0, 0xab40, 0xab41, 0xab42, 0xab43, 0xab44, 0xab45, /*0x70-0x77*/ 0xab46, 0xab47, 0xab48, 0xab49, 0xab4a, 0xab4b, 0xe2b5, 0xab4c, /*0x78-0x7f*/ 0xab4d, 0xab4e, 0xab4f, 0xab50, 0xd0fe, 0xab51, 0xab52, 0xc2ca, /*0x80-0x87*/ 0xab53, 0xd3f1, 0xab54, 0xcdf5, 0xab55, 0xab56, 0xe7e0, 0xab57, /*0x88-0x8f*/ 0xab58, 0xe7e1, 0xab59, 0xab5a, 0xab5b, 0xab5c, 0xbec1, 0xab5d, /*0x90-0x97*/ 0xab5e, 0xab5f, 0xab60, 0xc2ea, 0xab61, 0xab62, 0xab63, 0xe7e4, /*0x98-0x9f*/ 0xab64, 0xab65, 0xe7e3, 0xab66, 0xab67, 0xab68, 0xab69, 0xab6a, /*0xa0-0xa7*/ 0xab6b, 0xcde6, 0xab6c, 0xc3b5, 0xab6d, 0xab6e, 0xe7e2, 0xbbb7, /*0xa8-0xaf*/ 0xcfd6, 0xab6f, 0xc1e1, 0xe7e9, 0xab70, 0xab71, 0xab72, 0xe7e8, /*0xb0-0xb7*/ 0xab73, 0xab74, 0xe7f4, 0xb2a3, 0xab75, 0xab76, 0xab77, 0xab78, /*0xb8-0xbf*/ 0xe7ea, 0xab79, 0xe7e6, 0xab7a, 0xab7b, 0xab7c, 0xab7d, 0xab7e, /*0xc0-0xc7*/ 0xe7ec, 0xe7eb, 0xc9ba, 0xab80, 0xab81, 0xd5e4, 0xab82, 0xe7e5, /*0xc8-0xcf*/ 0xb7a9, 0xe7e7, 0xab83, 0xab84, 0xab85, 0xab86, 0xab87, 0xab88, /*0xd0-0xd7*/ 0xab89, 0xe7ee, 0xab8a, 0xab8b, 0xab8c, 0xab8d, 0xe7f3, 0xab8e, /*0xd8-0xdf*/ 0xd6e9, 0xab8f, 0xab90, 0xab91, 0xab92, 0xe7ed, 0xab93, 0xe7f2, /*0xe0-0xe7*/ 0xab94, 0xe7f1, 0xab95, 0xab96, 0xab97, 0xb0e0, 0xab98, 0xab99, /*0xe8-0xef*/ 0xab9a, 0xab9b, 0xe7f5, 0xab9c, 0xab9d, 0xab9e, 0xab9f, 0xaba0, /*0xf0-0xf7*/ 0xac40, 0xac41, 0xac42, 0xac43, 0xac44, 0xac45, 0xac46, 0xac47, /*0xf8-0xff*/ /* 0x7400 */ 0xac48, 0xac49, 0xac4a, 0xc7f2, 0xac4b, 0xc0c5, 0xc0ed, 0xac4c, /*0x00-0x07*/ 0xac4d, 0xc1f0, 0xe7f0, 0xac4e, 0xac4f, 0xac50, 0xac51, 0xe7f6, /*0x08-0x0f*/ 0xcbf6, 0xac52, 0xac53, 0xac54, 0xac55, 0xac56, 0xac57, 0xac58, /*0x10-0x17*/ 0xac59, 0xac5a, 0xe8a2, 0xe8a1, 0xac5b, 0xac5c, 0xac5d, 0xac5e, /*0x18-0x1f*/ 0xac5f, 0xac60, 0xd7c1, 0xac61, 0xac62, 0xe7fa, 0xe7f9, 0xac63, /*0x20-0x27*/ 0xe7fb, 0xac64, 0xe7f7, 0xac65, 0xe7fe, 0xac66, 0xe7fd, 0xac67, /*0x28-0x2f*/ 0xe7fc, 0xac68, 0xac69, 0xc1d5, 0xc7d9, 0xc5fd, 0xc5c3, 0xac6a, /*0x30-0x37*/ 0xac6b, 0xac6c, 0xac6d, 0xac6e, 0xc7ed, 0xac6f, 0xac70, 0xac71, /*0x38-0x3f*/ 0xac72, 0xe8a3, 0xac73, 0xac74, 0xac75, 0xac76, 0xac77, 0xac78, /*0x40-0x47*/ 0xac79, 0xac7a, 0xac7b, 0xac7c, 0xac7d, 0xac7e, 0xac80, 0xac81, /*0x48-0x4f*/ 0xac82, 0xac83, 0xac84, 0xac85, 0xac86, 0xe8a6, 0xac87, 0xe8a5, /*0x50-0x57*/ 0xac88, 0xe8a7, 0xbaf7, 0xe7f8, 0xe8a4, 0xac89, 0xc8f0, 0xc9aa, /*0x58-0x5f*/ 0xac8a, 0xac8b, 0xac8c, 0xac8d, 0xac8e, 0xac8f, 0xac90, 0xac91, /*0x60-0x67*/ 0xac92, 0xac93, 0xac94, 0xac95, 0xac96, 0xe8a9, 0xac97, 0xac98, /*0x68-0x6f*/ 0xb9e5, 0xac99, 0xac9a, 0xac9b, 0xac9c, 0xac9d, 0xd1fe, 0xe8a8, /*0x70-0x77*/ 0xac9e, 0xac9f, 0xaca0, 0xad40, 0xad41, 0xad42, 0xe8aa, 0xad43, /*0x78-0x7f*/ 0xe8ad, 0xe8ae, 0xad44, 0xc1a7, 0xad45, 0xad46, 0xad47, 0xe8af, /*0x80-0x87*/ 0xad48, 0xad49, 0xad4a, 0xe8b0, 0xad4b, 0xad4c, 0xe8ac, 0xad4d, /*0x88-0x8f*/ 0xe8b4, 0xad4e, 0xad4f, 0xad50, 0xad51, 0xad52, 0xad53, 0xad54, /*0x90-0x97*/ 0xad55, 0xad56, 0xad57, 0xad58, 0xe8ab, 0xad59, 0xe8b1, 0xad5a, /*0x98-0x9f*/ 0xad5b, 0xad5c, 0xad5d, 0xad5e, 0xad5f, 0xad60, 0xad61, 0xe8b5, /*0xa0-0xa7*/ 0xe8b2, 0xe8b3, 0xad62, 0xad63, 0xad64, 0xad65, 0xad66, 0xad67, /*0xa8-0xaf*/ 0xad68, 0xad69, 0xad6a, 0xad6b, 0xad6c, 0xad6d, 0xad6e, 0xad6f, /*0xb0-0xb7*/ 0xad70, 0xad71, 0xe8b7, 0xad72, 0xad73, 0xad74, 0xad75, 0xad76, /*0xb8-0xbf*/ 0xad77, 0xad78, 0xad79, 0xad7a, 0xad7b, 0xad7c, 0xad7d, 0xad7e, /*0xc0-0xc7*/ 0xad80, 0xad81, 0xad82, 0xad83, 0xad84, 0xad85, 0xad86, 0xad87, /*0xc8-0xcf*/ 0xad88, 0xad89, 0xe8b6, 0xad8a, 0xad8b, 0xad8c, 0xad8d, 0xad8e, /*0xd0-0xd7*/ 0xad8f, 0xad90, 0xad91, 0xad92, 0xb9cf, 0xad93, 0xf0ac, 0xad94, /*0xd8-0xdf*/ 0xf0ad, 0xad95, 0xc6b0, 0xb0ea, 0xc8bf, 0xad96, 0xcddf, 0xad97, /*0xe0-0xe7*/ 0xad98, 0xad99, 0xad9a, 0xad9b, 0xad9c, 0xad9d, 0xcecd, 0xeab1, /*0xe8-0xef*/ 0xad9e, 0xad9f, 0xada0, 0xae40, 0xeab2, 0xae41, 0xc6bf, 0xb4c9, /*0xf0-0xf7*/ 0xae42, 0xae43, 0xae44, 0xae45, 0xae46, 0xae47, 0xae48, 0xeab3, /*0xf8-0xff*/ /* 0x7500 */ 0xae49, 0xae4a, 0xae4b, 0xae4c, 0xd5e7, 0xae4d, 0xae4e, 0xae4f, /*0x00-0x07*/ 0xae50, 0xae51, 0xae52, 0xae53, 0xae54, 0xddf9, 0xae55, 0xeab4, /*0x08-0x0f*/ 0xae56, 0xeab5, 0xae57, 0xeab6, 0xae58, 0xae59, 0xae5a, 0xae5b, /*0x10-0x17*/ 0xb8ca, 0xdfb0, 0xc9f5, 0xae5c, 0xccf0, 0xae5d, 0xae5e, 0xc9fa, /*0x18-0x1f*/ 0xae5f, 0xae60, 0xae61, 0xae62, 0xae63, 0xc9fb, 0xae64, 0xae65, /*0x20-0x27*/ 0xd3c3, 0xcba6, 0xae66, 0xb8a6, 0xf0ae, 0xb1c2, 0xae67, 0xe5b8, /*0x28-0x2f*/ 0xccef, 0xd3c9, 0xbcd7, 0xc9ea, 0xae68, 0xb5e7, 0xae69, 0xc4d0, /*0x30-0x37*/ 0xb5e9, 0xae6a, 0xeeae, 0xbbad, 0xae6b, 0xae6c, 0xe7de, 0xae6d, /*0x38-0x3f*/ 0xeeaf, 0xae6e, 0xae6f, 0xae70, 0xae71, 0xb3a9, 0xae72, 0xae73, /*0x40-0x47*/ 0xeeb2, 0xae74, 0xae75, 0xeeb1, 0xbde7, 0xae76, 0xeeb0, 0xceb7, /*0x48-0x4f*/ 0xae77, 0xae78, 0xae79, 0xae7a, 0xc5cf, 0xae7b, 0xae7c, 0xae7d, /*0x50-0x57*/ 0xae7e, 0xc1f4, 0xdbce, 0xeeb3, 0xd0f3, 0xae80, 0xae81, 0xae82, /*0x58-0x5f*/ 0xae83, 0xae84, 0xae85, 0xae86, 0xae87, 0xc2d4, 0xc6e8, 0xae88, /*0x60-0x67*/ 0xae89, 0xae8a, 0xb7ac, 0xae8b, 0xae8c, 0xae8d, 0xae8e, 0xae8f, /*0x68-0x6f*/ 0xae90, 0xae91, 0xeeb4, 0xae92, 0xb3eb, 0xae93, 0xae94, 0xae95, /*0x70-0x77*/ 0xbbfb, 0xeeb5, 0xae96, 0xae97, 0xae98, 0xae99, 0xae9a, 0xe7dc, /*0x78-0x7f*/ 0xae9b, 0xae9c, 0xae9d, 0xeeb6, 0xae9e, 0xae9f, 0xbdae, 0xaea0, /*0x80-0x87*/ 0xaf40, 0xaf41, 0xaf42, 0xf1e2, 0xaf43, 0xaf44, 0xaf45, 0xcae8, /*0x88-0x8f*/ 0xaf46, 0xd2c9, 0xf0da, 0xaf47, 0xf0db, 0xaf48, 0xf0dc, 0xc1c6, /*0x90-0x97*/ 0xaf49, 0xb8ed, 0xbece, 0xaf4a, 0xaf4b, 0xf0de, 0xaf4c, 0xc5b1, /*0x98-0x9f*/ 0xf0dd, 0xd1f1, 0xaf4d, 0xf0e0, 0xb0cc, 0xbdea, 0xaf4e, 0xaf4f, /*0xa0-0xa7*/ 0xaf50, 0xaf51, 0xaf52, 0xd2df, 0xf0df, 0xaf53, 0xb4af, 0xb7e8, /*0xa8-0xaf*/ 0xf0e6, 0xf0e5, 0xc6a3, 0xf0e1, 0xf0e2, 0xb4c3, 0xaf54, 0xaf55, /*0xb0-0xb7*/ 0xf0e3, 0xd5ee, 0xaf56, 0xaf57, 0xccdb, 0xbed2, 0xbcb2, 0xaf58, /*0xb8-0xbf*/ 0xaf59, 0xaf5a, 0xf0e8, 0xf0e7, 0xf0e4, 0xb2a1, 0xaf5b, 0xd6a2, /*0xc0-0xc7*/ 0xd3b8, 0xbeb7, 0xc8ac, 0xaf5c, 0xaf5d, 0xf0ea, 0xaf5e, 0xaf5f, /*0xc8-0xcf*/ 0xaf60, 0xaf61, 0xd1f7, 0xaf62, 0xd6cc, 0xbadb, 0xf0e9, 0xaf63, /*0xd0-0xd7*/ 0xb6bb, 0xaf64, 0xaf65, 0xcdb4, 0xaf66, 0xaf67, 0xc6a6, 0xaf68, /*0xd8-0xdf*/ 0xaf69, 0xaf6a, 0xc1a1, 0xf0eb, 0xf0ee, 0xaf6b, 0xf0ed, 0xf0f0, /*0xe0-0xe7*/ 0xf0ec, 0xaf6c, 0xbbbe, 0xf0ef, 0xaf6d, 0xaf6e, 0xaf6f, 0xaf70, /*0xe8-0xef*/ 0xccb5, 0xf0f2, 0xaf71, 0xaf72, 0xb3d5, 0xaf73, 0xaf74, 0xaf75, /*0xf0-0xf7*/ 0xaf76, 0xb1d4, 0xaf77, 0xaf78, 0xf0f3, 0xaf79, 0xaf7a, 0xf0f4, /*0xf8-0xff*/ /* 0x7600 */ 0xf0f6, 0xb4e1, 0xaf7b, 0xf0f1, 0xaf7c, 0xf0f7, 0xaf7d, 0xaf7e, /*0x00-0x07*/ 0xaf80, 0xaf81, 0xf0fa, 0xaf82, 0xf0f8, 0xaf83, 0xaf84, 0xaf85, /*0x08-0x0f*/ 0xf0f5, 0xaf86, 0xaf87, 0xaf88, 0xaf89, 0xf0fd, 0xaf8a, 0xf0f9, /*0x10-0x17*/ 0xf0fc, 0xf0fe, 0xaf8b, 0xf1a1, 0xaf8c, 0xaf8d, 0xaf8e, 0xcec1, /*0x18-0x1f*/ 0xf1a4, 0xaf8f, 0xf1a3, 0xaf90, 0xc1f6, 0xf0fb, 0xcadd, 0xaf91, /*0x20-0x27*/ 0xaf92, 0xb4f1, 0xb1f1, 0xccb1, 0xaf93, 0xf1a6, 0xaf94, 0xaf95, /*0x28-0x2f*/ 0xf1a7, 0xaf96, 0xaf97, 0xf1ac, 0xd5ce, 0xf1a9, 0xaf98, 0xaf99, /*0x30-0x37*/ 0xc8b3, 0xaf9a, 0xaf9b, 0xaf9c, 0xf1a2, 0xaf9d, 0xf1ab, 0xf1a8, /*0x38-0x3f*/ 0xf1a5, 0xaf9e, 0xaf9f, 0xf1aa, 0xafa0, 0xb040, 0xb041, 0xb042, /*0x40-0x47*/ 0xb043, 0xb044, 0xb045, 0xb046, 0xb0a9, 0xf1ad, 0xb047, 0xb048, /*0x48-0x4f*/ 0xb049, 0xb04a, 0xb04b, 0xb04c, 0xf1af, 0xb04d, 0xf1b1, 0xb04e, /*0x50-0x57*/ 0xb04f, 0xb050, 0xb051, 0xb052, 0xf1b0, 0xb053, 0xf1ae, 0xb054, /*0x58-0x5f*/ 0xb055, 0xb056, 0xb057, 0xd1a2, 0xb058, 0xb059, 0xb05a, 0xb05b, /*0x60-0x67*/ 0xb05c, 0xb05d, 0xb05e, 0xf1b2, 0xb05f, 0xb060, 0xb061, 0xf1b3, /*0x68-0x6f*/ 0xb062, 0xb063, 0xb064, 0xb065, 0xb066, 0xb067, 0xb068, 0xb069, /*0x70-0x77*/ 0xb9ef, 0xb06a, 0xb06b, 0xb5c7, 0xb06c, 0xb0d7, 0xb0d9, 0xb06d, /*0x78-0x7f*/ 0xb06e, 0xb06f, 0xd4ed, 0xb070, 0xb5c4, 0xb071, 0xbdd4, 0xbbca, /*0x80-0x87*/ 0xf0a7, 0xb072, 0xb073, 0xb8de, 0xb074, 0xb075, 0xf0a8, 0xb076, /*0x88-0x8f*/ 0xb077, 0xb0a8, 0xb078, 0xf0a9, 0xb079, 0xb07a, 0xcdee, 0xb07b, /*0x90-0x97*/ 0xb07c, 0xf0aa, 0xb07d, 0xb07e, 0xb080, 0xb081, 0xb082, 0xb083, /*0x98-0x9f*/ 0xb084, 0xb085, 0xb086, 0xb087, 0xf0ab, 0xb088, 0xb089, 0xb08a, /*0xa0-0xa7*/ 0xb08b, 0xb08c, 0xb08d, 0xb08e, 0xb08f, 0xb090, 0xc6a4, 0xb091, /*0xa8-0xaf*/ 0xb092, 0xd6e5, 0xf1e4, 0xb093, 0xf1e5, 0xb094, 0xb095, 0xb096, /*0xb0-0xb7*/ 0xb097, 0xb098, 0xb099, 0xb09a, 0xb09b, 0xb09c, 0xb09d, 0xc3f3, /*0xb8-0xbf*/ 0xb09e, 0xb09f, 0xd3db, 0xb0a0, 0xb140, 0xd6d1, 0xc5e8, 0xb141, /*0xc0-0xc7*/ 0xd3af, 0xb142, 0xd2e6, 0xb143, 0xb144, 0xeec1, 0xb0bb, 0xd5b5, /*0xc8-0xcf*/ 0xd1ce, 0xbce0, 0xbad0, 0xb145, 0xbff8, 0xb146, 0xb8c7, 0xb5c1, /*0xd0-0xd7*/ 0xc5cc, 0xb147, 0xb148, 0xcaa2, 0xb149, 0xb14a, 0xb14b, 0xc3cb, /*0xd8-0xdf*/ 0xb14c, 0xb14d, 0xb14e, 0xb14f, 0xb150, 0xeec2, 0xb151, 0xb152, /*0xe0-0xe7*/ 0xb153, 0xb154, 0xb155, 0xb156, 0xb157, 0xb158, 0xc4bf, 0xb6a2, /*0xe8-0xef*/ 0xb159, 0xedec, 0xc3a4, 0xb15a, 0xd6b1, 0xb15b, 0xb15c, 0xb15d, /*0xf0-0xf7*/ 0xcfe0, 0xedef, 0xb15e, 0xb15f, 0xc5ce, 0xb160, 0xb6dc, 0xb161, /*0xf8-0xff*/ /* 0x7700 */ 0xb162, 0xcaa1, 0xb163, 0xb164, 0xeded, 0xb165, 0xb166, 0xedf0, /*0x00-0x07*/ 0xedf1, 0xc3bc, 0xb167, 0xbfb4, 0xb168, 0xedee, 0xb169, 0xb16a, /*0x08-0x0f*/ 0xb16b, 0xb16c, 0xb16d, 0xb16e, 0xb16f, 0xb170, 0xb171, 0xb172, /*0x10-0x17*/ 0xb173, 0xedf4, 0xedf2, 0xb174, 0xb175, 0xb176, 0xb177, 0xd5e6, /*0x18-0x1f*/ 0xc3df, 0xb178, 0xedf3, 0xb179, 0xb17a, 0xb17b, 0xedf6, 0xb17c, /*0x20-0x27*/ 0xd5a3, 0xd1a3, 0xb17d, 0xb17e, 0xb180, 0xedf5, 0xb181, 0xc3d0, /*0x28-0x2f*/ 0xb182, 0xb183, 0xb184, 0xb185, 0xb186, 0xedf7, 0xbff4, 0xbeec, /*0x30-0x37*/ 0xedf8, 0xb187, 0xccf7, 0xb188, 0xd1db, 0xb189, 0xb18a, 0xb18b, /*0x38-0x3f*/ 0xd7c5, 0xd5f6, 0xb18c, 0xedfc, 0xb18d, 0xb18e, 0xb18f, 0xedfb, /*0x40-0x47*/ 0xb190, 0xb191, 0xb192, 0xb193, 0xb194, 0xb195, 0xb196, 0xb197, /*0x48-0x4f*/ 0xedf9, 0xedfa, 0xb198, 0xb199, 0xb19a, 0xb19b, 0xb19c, 0xb19d, /*0x50-0x57*/ 0xb19e, 0xb19f, 0xedfd, 0xbea6, 0xb1a0, 0xb240, 0xb241, 0xb242, /*0x58-0x5f*/ 0xb243, 0xcbaf, 0xeea1, 0xb6bd, 0xb244, 0xeea2, 0xc4c0, 0xb245, /*0x60-0x67*/ 0xedfe, 0xb246, 0xb247, 0xbdde, 0xb2c7, 0xb248, 0xb249, 0xb24a, /*0x68-0x6f*/ 0xb24b, 0xb24c, 0xb24d, 0xb24e, 0xb24f, 0xb250, 0xb251, 0xb252, /*0x70-0x77*/ 0xb253, 0xb6c3, 0xb254, 0xb255, 0xb256, 0xeea5, 0xd8ba, 0xeea3, /*0x78-0x7f*/ 0xeea6, 0xb257, 0xb258, 0xb259, 0xc3e9, 0xb3f2, 0xb25a, 0xb25b, /*0x80-0x87*/ 0xb25c, 0xb25d, 0xb25e, 0xb25f, 0xeea7, 0xeea4, 0xcfb9, 0xb260, /*0x88-0x8f*/ 0xb261, 0xeea8, 0xc2f7, 0xb262, 0xb263, 0xb264, 0xb265, 0xb266, /*0x90-0x97*/ 0xb267, 0xb268, 0xb269, 0xb26a, 0xb26b, 0xb26c, 0xb26d, 0xeea9, /*0x98-0x9f*/ 0xeeaa, 0xb26e, 0xdeab, 0xb26f, 0xb270, 0xc6b3, 0xb271, 0xc7c6, /*0xa0-0xa7*/ 0xb272, 0xd6f5, 0xb5c9, 0xb273, 0xcbb2, 0xb274, 0xb275, 0xb276, /*0xa8-0xaf*/ 0xeeab, 0xb277, 0xb278, 0xcdab, 0xb279, 0xeeac, 0xb27a, 0xb27b, /*0xb0-0xb7*/ 0xb27c, 0xb27d, 0xb27e, 0xd5b0, 0xb280, 0xeead, 0xb281, 0xf6c4, /*0xb8-0xbf*/ 0xb282, 0xb283, 0xb284, 0xb285, 0xb286, 0xb287, 0xb288, 0xb289, /*0xc0-0xc7*/ 0xb28a, 0xb28b, 0xb28c, 0xb28d, 0xb28e, 0xdbc7, 0xb28f, 0xb290, /*0xc8-0xcf*/ 0xb291, 0xb292, 0xb293, 0xb294, 0xb295, 0xb296, 0xb297, 0xb4a3, /*0xd0-0xd7*/ 0xb298, 0xb299, 0xb29a, 0xc3ac, 0xf1e6, 0xb29b, 0xb29c, 0xb29d, /*0xd8-0xdf*/ 0xb29e, 0xb29f, 0xcab8, 0xd2d3, 0xb2a0, 0xd6aa, 0xb340, 0xeff2, /*0xe0-0xe7*/ 0xb341, 0xbed8, 0xb342, 0xbdc3, 0xeff3, 0xb6cc, 0xb0ab, 0xb343, /*0xe8-0xef*/ 0xb344, 0xb345, 0xb346, 0xcaaf, 0xb347, 0xb348, 0xedb6, 0xb349, /*0xf0-0xf7*/ 0xedb7, 0xb34a, 0xb34b, 0xb34c, 0xb34d, 0xcef9, 0xb7af, 0xbff3, /*0xf8-0xff*/ /* 0x7800 */ 0xedb8, 0xc2eb, 0xc9b0, 0xb34e, 0xb34f, 0xb350, 0xb351, 0xb352, /*0x00-0x07*/ 0xb353, 0xedb9, 0xb354, 0xb355, 0xc6f6, 0xbfb3, 0xb356, 0xb357, /*0x08-0x0f*/ 0xb358, 0xedbc, 0xc5f8, 0xb359, 0xd1d0, 0xb35a, 0xd7a9, 0xedba, /*0x10-0x17*/ 0xedbb, 0xb35b, 0xd1e2, 0xb35c, 0xedbf, 0xedc0, 0xb35d, 0xedc4, /*0x18-0x1f*/ 0xb35e, 0xb35f, 0xb360, 0xedc8, 0xb361, 0xedc6, 0xedce, 0xd5e8, /*0x20-0x27*/ 0xb362, 0xedc9, 0xb363, 0xb364, 0xedc7, 0xedbe, 0xb365, 0xb366, /*0x28-0x2f*/ 0xc5e9, 0xb367, 0xb368, 0xb369, 0xc6c6, 0xb36a, 0xb36b, 0xc9e9, /*0x30-0x37*/ 0xd4d2, 0xedc1, 0xedc2, 0xedc3, 0xedc5, 0xb36c, 0xc0f9, 0xb36d, /*0x38-0x3f*/ 0xb4a1, 0xb36e, 0xb36f, 0xb370, 0xb371, 0xb9e8, 0xb372, 0xedd0, /*0x40-0x47*/ 0xb373, 0xb374, 0xb375, 0xb376, 0xedd1, 0xb377, 0xedca, 0xb378, /*0x48-0x4f*/ 0xedcf, 0xb379, 0xcef8, 0xb37a, 0xb37b, 0xcbb6, 0xedcc, 0xedcd, /*0x50-0x57*/ 0xb37c, 0xb37d, 0xb37e, 0xb380, 0xb381, 0xcff5, 0xb382, 0xb383, /*0x58-0x5f*/ 0xb384, 0xb385, 0xb386, 0xb387, 0xb388, 0xb389, 0xb38a, 0xb38b, /*0x60-0x67*/ 0xb38c, 0xb38d, 0xedd2, 0xc1f2, 0xd3b2, 0xedcb, 0xc8b7, 0xb38e, /*0x68-0x6f*/ 0xb38f, 0xb390, 0xb391, 0xb392, 0xb393, 0xb394, 0xb395, 0xbcef, /*0x70-0x77*/ 0xb396, 0xb397, 0xb398, 0xb399, 0xc5f0, 0xb39a, 0xb39b, 0xb39c, /*0x78-0x7f*/ 0xb39d, 0xb39e, 0xb39f, 0xb3a0, 0xb440, 0xb441, 0xb442, 0xedd6, /*0x80-0x87*/ 0xb443, 0xb5ef, 0xb444, 0xb445, 0xc2b5, 0xb0ad, 0xcbe9, 0xb446, /*0x88-0x8f*/ 0xb447, 0xb1ae, 0xb448, 0xedd4, 0xb449, 0xb44a, 0xb44b, 0xcdeb, /*0x90-0x97*/ 0xb5e2, 0xb44c, 0xedd5, 0xedd3, 0xedd7, 0xb44d, 0xb44e, 0xb5fa, /*0x98-0x9f*/ 0xb44f, 0xedd8, 0xb450, 0xedd9, 0xb451, 0xeddc, 0xb452, 0xb1cc, /*0xa0-0xa7*/ 0xb453, 0xb454, 0xb455, 0xb456, 0xb457, 0xb458, 0xb459, 0xb45a, /*0xa8-0xaf*/ 0xc5f6, 0xbcee, 0xedda, 0xccbc, 0xb2ea, 0xb45b, 0xb45c, 0xb45d, /*0xb0-0xb7*/ 0xb45e, 0xeddb, 0xb45f, 0xb460, 0xb461, 0xb462, 0xc4eb, 0xb463, /*0xb8-0xbf*/ 0xb464, 0xb4c5, 0xb465, 0xb466, 0xb467, 0xb0f5, 0xb468, 0xb469, /*0xc0-0xc7*/ 0xb46a, 0xeddf, 0xc0da, 0xb4e8, 0xb46b, 0xb46c, 0xb46d, 0xb46e, /*0xc8-0xcf*/ 0xc5cd, 0xb46f, 0xb470, 0xb471, 0xeddd, 0xbfc4, 0xb472, 0xb473, /*0xd0-0xd7*/ 0xb474, 0xedde, 0xb475, 0xb476, 0xb477, 0xb478, 0xb479, 0xb47a, /*0xd8-0xdf*/ 0xb47b, 0xb47c, 0xb47d, 0xb47e, 0xb480, 0xb481, 0xb482, 0xb483, /*0xe0-0xe7*/ 0xc4a5, 0xb484, 0xb485, 0xb486, 0xede0, 0xb487, 0xb488, 0xb489, /*0xe8-0xef*/ 0xb48a, 0xb48b, 0xede1, 0xb48c, 0xede3, 0xb48d, 0xb48e, 0xc1d7, /*0xf0-0xf7*/ 0xb48f, 0xb490, 0xbbc7, 0xb491, 0xb492, 0xb493, 0xb494, 0xb495, /*0xf8-0xff*/ /* 0x7900 */ 0xb496, 0xbdb8, 0xb497, 0xb498, 0xb499, 0xede2, 0xb49a, 0xb49b, /*0x00-0x07*/ 0xb49c, 0xb49d, 0xb49e, 0xb49f, 0xb4a0, 0xb540, 0xb541, 0xb542, /*0x08-0x0f*/ 0xb543, 0xb544, 0xb545, 0xede4, 0xb546, 0xb547, 0xb548, 0xb549, /*0x10-0x17*/ 0xb54a, 0xb54b, 0xb54c, 0xb54d, 0xb54e, 0xb54f, 0xede6, 0xb550, /*0x18-0x1f*/ 0xb551, 0xb552, 0xb553, 0xb554, 0xede5, 0xb555, 0xb556, 0xb557, /*0x20-0x27*/ 0xb558, 0xb559, 0xb55a, 0xb55b, 0xb55c, 0xb55d, 0xb55e, 0xb55f, /*0x28-0x2f*/ 0xb560, 0xb561, 0xb562, 0xb563, 0xede7, 0xb564, 0xb565, 0xb566, /*0x30-0x37*/ 0xb567, 0xb568, 0xcabe, 0xecea, 0xc0f1, 0xb569, 0xc9e7, 0xb56a, /*0x38-0x3f*/ 0xeceb, 0xc6ee, 0xb56b, 0xb56c, 0xb56d, 0xb56e, 0xecec, 0xb56f, /*0x40-0x47*/ 0xc6ed, 0xeced, 0xb570, 0xb571, 0xb572, 0xb573, 0xb574, 0xb575, /*0x48-0x4f*/ 0xb576, 0xb577, 0xb578, 0xecf0, 0xb579, 0xb57a, 0xd7e6, 0xecf3, /*0x50-0x57*/ 0xb57b, 0xb57c, 0xecf1, 0xecee, 0xecef, 0xd7a3, 0xc9f1, 0xcbee, /*0x58-0x5f*/ 0xecf4, 0xb57d, 0xecf2, 0xb57e, 0xb580, 0xcfe9, 0xb581, 0xecf6, /*0x60-0x67*/ 0xc6b1, 0xb582, 0xb583, 0xb584, 0xb585, 0xbcc0, 0xb586, 0xecf5, /*0x68-0x6f*/ 0xb587, 0xb588, 0xb589, 0xb58a, 0xb58b, 0xb58c, 0xb58d, 0xb5bb, /*0x70-0x77*/ 0xbbf6, 0xb58e, 0xecf7, 0xb58f, 0xb590, 0xb591, 0xb592, 0xb593, /*0x78-0x7f*/ 0xd9f7, 0xbdfb, 0xb594, 0xb595, 0xc2bb, 0xecf8, 0xb596, 0xb597, /*0x80-0x87*/ 0xb598, 0xb599, 0xecf9, 0xb59a, 0xb59b, 0xb59c, 0xb59d, 0xb8a3, /*0x88-0x8f*/ 0xb59e, 0xb59f, 0xb5a0, 0xb640, 0xb641, 0xb642, 0xb643, 0xb644, /*0x90-0x97*/ 0xb645, 0xb646, 0xecfa, 0xb647, 0xb648, 0xb649, 0xb64a, 0xb64b, /*0x98-0x9f*/ 0xb64c, 0xb64d, 0xb64e, 0xb64f, 0xb650, 0xb651, 0xb652, 0xecfb, /*0xa0-0xa7*/ 0xb653, 0xb654, 0xb655, 0xb656, 0xb657, 0xb658, 0xb659, 0xb65a, /*0xa8-0xaf*/ 0xb65b, 0xb65c, 0xb65d, 0xecfc, 0xb65e, 0xb65f, 0xb660, 0xb661, /*0xb0-0xb7*/ 0xb662, 0xd3ed, 0xd8ae, 0xc0eb, 0xb663, 0xc7dd, 0xbacc, 0xb664, /*0xb8-0xbf*/ 0xd0e3, 0xcbbd, 0xb665, 0xcdba, 0xb666, 0xb667, 0xb8d1, 0xb668, /*0xc0-0xc7*/ 0xb669, 0xb1fc, 0xb66a, 0xc7ef, 0xb66b, 0xd6d6, 0xb66c, 0xb66d, /*0xc8-0xcf*/ 0xb66e, 0xbfc6, 0xc3eb, 0xb66f, 0xb670, 0xeff5, 0xb671, 0xb672, /*0xd0-0xd7*/ 0xc3d8, 0xb673, 0xb674, 0xb675, 0xb676, 0xb677, 0xb678, 0xd7e2, /*0xd8-0xdf*/ 0xb679, 0xb67a, 0xb67b, 0xeff7, 0xb3d3, 0xb67c, 0xc7d8, 0xd1ed, /*0xe0-0xe7*/ 0xb67d, 0xd6c8, 0xb67e, 0xeff8, 0xb680, 0xeff6, 0xb681, 0xbbfd, /*0xe8-0xef*/ 0xb3c6, 0xb682, 0xb683, 0xb684, 0xb685, 0xb686, 0xb687, 0xb688, /*0xf0-0xf7*/ 0xbdd5, 0xb689, 0xb68a, 0xd2c6, 0xb68b, 0xbbe0, 0xb68c, 0xb68d, /*0xf8-0xff*/ /* 0x7a00 */ 0xcfa1, 0xb68e, 0xeffc, 0xeffb, 0xb68f, 0xb690, 0xeff9, 0xb691, /*0x00-0x07*/ 0xb692, 0xb693, 0xb694, 0xb3cc, 0xb695, 0xc9d4, 0xcbb0, 0xb696, /*0x08-0x0f*/ 0xb697, 0xb698, 0xb699, 0xb69a, 0xeffe, 0xb69b, 0xb69c, 0xb0de, /*0x10-0x17*/ 0xb69d, 0xb69e, 0xd6c9, 0xb69f, 0xb6a0, 0xb740, 0xeffd, 0xb741, /*0x18-0x1f*/ 0xb3ed, 0xb742, 0xb743, 0xf6d5, 0xb744, 0xb745, 0xb746, 0xb747, /*0x20-0x27*/ 0xb748, 0xb749, 0xb74a, 0xb74b, 0xb74c, 0xb74d, 0xb74e, 0xb74f, /*0x28-0x2f*/ 0xb750, 0xb751, 0xb752, 0xcec8, 0xb753, 0xb754, 0xb755, 0xf0a2, /*0x30-0x37*/ 0xb756, 0xf0a1, 0xb757, 0xb5be, 0xbcda, 0xbbfc, 0xb758, 0xb8e5, /*0x38-0x3f*/ 0xb759, 0xb75a, 0xb75b, 0xb75c, 0xb75d, 0xb75e, 0xc4c2, 0xb75f, /*0x40-0x47*/ 0xb760, 0xb761, 0xb762, 0xb763, 0xb764, 0xb765, 0xb766, 0xb767, /*0x48-0x4f*/ 0xb768, 0xf0a3, 0xb769, 0xb76a, 0xb76b, 0xb76c, 0xb76d, 0xcbeb, /*0x50-0x57*/ 0xb76e, 0xb76f, 0xb770, 0xb771, 0xb772, 0xb773, 0xb774, 0xb775, /*0x58-0x5f*/ 0xb776, 0xb777, 0xb778, 0xb779, 0xb77a, 0xb77b, 0xb77c, 0xb77d, /*0x60-0x67*/ 0xb77e, 0xb780, 0xb781, 0xb782, 0xb783, 0xb784, 0xb785, 0xb786, /*0x68-0x6f*/ 0xf0a6, 0xb787, 0xb788, 0xb789, 0xd1a8, 0xb78a, 0xbebf, 0xc7ee, /*0x70-0x77*/ 0xf1b6, 0xf1b7, 0xbfd5, 0xb78b, 0xb78c, 0xb78d, 0xb78e, 0xb4a9, /*0x78-0x7f*/ 0xf1b8, 0xcdbb, 0xb78f, 0xc7d4, 0xd5ad, 0xb790, 0xf1b9, 0xb791, /*0x80-0x87*/ 0xf1ba, 0xb792, 0xb793, 0xb794, 0xb795, 0xc7cf, 0xb796, 0xb797, /*0x88-0x8f*/ 0xb798, 0xd2a4, 0xd6cf, 0xb799, 0xb79a, 0xf1bb, 0xbdd1, 0xb4b0, /*0x90-0x97*/ 0xbebd, 0xb79b, 0xb79c, 0xb79d, 0xb4dc, 0xced1, 0xb79e, 0xbfdf, /*0x98-0x9f*/ 0xf1bd, 0xb79f, 0xb7a0, 0xb840, 0xb841, 0xbffa, 0xf1bc, 0xb842, /*0xa0-0xa7*/ 0xf1bf, 0xb843, 0xb844, 0xb845, 0xf1be, 0xf1c0, 0xb846, 0xb847, /*0xa8-0xaf*/ 0xb848, 0xb849, 0xb84a, 0xf1c1, 0xb84b, 0xb84c, 0xb84d, 0xb84e, /*0xb0-0xb7*/ 0xb84f, 0xb850, 0xb851, 0xb852, 0xb853, 0xb854, 0xb855, 0xc1fe, /*0xb8-0xbf*/ 0xb856, 0xb857, 0xb858, 0xb859, 0xb85a, 0xb85b, 0xb85c, 0xb85d, /*0xc0-0xc7*/ 0xb85e, 0xb85f, 0xb860, 0xc1a2, 0xb861, 0xb862, 0xb863, 0xb864, /*0xc8-0xcf*/ 0xb865, 0xb866, 0xb867, 0xb868, 0xb869, 0xb86a, 0xcafa, 0xb86b, /*0xd0-0xd7*/ 0xb86c, 0xd5be, 0xb86d, 0xb86e, 0xb86f, 0xb870, 0xbeba, 0xbeb9, /*0xd8-0xdf*/ 0xd5c2, 0xb871, 0xb872, 0xbfa2, 0xb873, 0xcdaf, 0xf1b5, 0xb874, /*0xe0-0xe7*/ 0xb875, 0xb876, 0xb877, 0xb878, 0xb879, 0xbddf, 0xb87a, 0xb6cb, /*0xe8-0xef*/ 0xb87b, 0xb87c, 0xb87d, 0xb87e, 0xb880, 0xb881, 0xb882, 0xb883, /*0xf0-0xf7*/ 0xb884, 0xd6f1, 0xf3c3, 0xb885, 0xb886, 0xf3c4, 0xb887, 0xb8cd, /*0xf8-0xff*/ /* 0x7b00 */ 0xb888, 0xb889, 0xb88a, 0xf3c6, 0xf3c7, 0xb88b, 0xb0ca, 0xb88c, /*0x00-0x07*/ 0xf3c5, 0xb88d, 0xf3c9, 0xcbf1, 0xb88e, 0xb88f, 0xb890, 0xf3cb, /*0x08-0x0f*/ 0xb891, 0xd0a6, 0xb892, 0xb893, 0xb1ca, 0xf3c8, 0xb894, 0xb895, /*0x10-0x17*/ 0xb896, 0xf3cf, 0xb897, 0xb5d1, 0xb898, 0xb899, 0xf3d7, 0xb89a, /*0x18-0x1f*/ 0xf3d2, 0xb89b, 0xb89c, 0xb89d, 0xf3d4, 0xf3d3, 0xb7fb, 0xb89e, /*0x20-0x27*/ 0xb1bf, 0xb89f, 0xf3ce, 0xf3ca, 0xb5da, 0xb8a0, 0xf3d0, 0xb940, /*0x28-0x2f*/ 0xb941, 0xf3d1, 0xb942, 0xf3d5, 0xb943, 0xb944, 0xb945, 0xb946, /*0x30-0x37*/ 0xf3cd, 0xb947, 0xbce3, 0xb948, 0xc1fd, 0xb949, 0xf3d6, 0xb94a, /*0x38-0x3f*/ 0xb94b, 0xb94c, 0xb94d, 0xb94e, 0xb94f, 0xf3da, 0xb950, 0xf3cc, /*0x40-0x47*/ 0xb951, 0xb5c8, 0xb952, 0xbdee, 0xf3dc, 0xb953, 0xb954, 0xb7a4, /*0x48-0x4f*/ 0xbff0, 0xd6fe, 0xcdb2, 0xb955, 0xb4f0, 0xb956, 0xb2df, 0xb957, /*0x50-0x57*/ 0xf3d8, 0xb958, 0xf3d9, 0xc9b8, 0xb959, 0xf3dd, 0xb95a, 0xb95b, /*0x58-0x5f*/ 0xf3de, 0xb95c, 0xf3e1, 0xb95d, 0xb95e, 0xb95f, 0xb960, 0xb961, /*0x60-0x67*/ 0xb962, 0xb963, 0xb964, 0xb965, 0xb966, 0xb967, 0xf3df, 0xb968, /*0x68-0x6f*/ 0xb969, 0xf3e3, 0xf3e2, 0xb96a, 0xb96b, 0xf3db, 0xb96c, 0xbfea, /*0x70-0x77*/ 0xb96d, 0xb3ef, 0xb96e, 0xf3e0, 0xb96f, 0xb970, 0xc7a9, 0xb971, /*0x78-0x7f*/ 0xbcf2, 0xb972, 0xb973, 0xb974, 0xb975, 0xf3eb, 0xb976, 0xb977, /*0x80-0x87*/ 0xb978, 0xb979, 0xb97a, 0xb97b, 0xb97c, 0xb9bf, 0xb97d, 0xb97e, /*0x88-0x8f*/ 0xf3e4, 0xb980, 0xb981, 0xb982, 0xb2ad, 0xbbfe, 0xb983, 0xcbe3, /*0x90-0x97*/ 0xb984, 0xb985, 0xb986, 0xb987, 0xf3ed, 0xf3e9, 0xb988, 0xb989, /*0x98-0x9f*/ 0xb98a, 0xb9dc, 0xf3ee, 0xb98b, 0xb98c, 0xb98d, 0xf3e5, 0xf3e6, /*0xa0-0xa7*/ 0xf3ea, 0xc2e1, 0xf3ec, 0xf3ef, 0xf3e8, 0xbcfd, 0xb98e, 0xb98f, /*0xa8-0xaf*/ 0xb990, 0xcfe4, 0xb991, 0xb992, 0xf3f0, 0xb993, 0xb994, 0xb995, /*0xb0-0xb7*/ 0xf3e7, 0xb996, 0xb997, 0xb998, 0xb999, 0xb99a, 0xb99b, 0xb99c, /*0xb8-0xbf*/ 0xb99d, 0xf3f2, 0xb99e, 0xb99f, 0xb9a0, 0xba40, 0xd7ad, 0xc6aa, /*0xc0-0xc7*/ 0xba41, 0xba42, 0xba43, 0xba44, 0xf3f3, 0xba45, 0xba46, 0xba47, /*0xc8-0xcf*/ 0xba48, 0xf3f1, 0xba49, 0xc2a8, 0xba4a, 0xba4b, 0xba4c, 0xba4d, /*0xd0-0xd7*/ 0xba4e, 0xb8dd, 0xf3f5, 0xba4f, 0xba50, 0xf3f4, 0xba51, 0xba52, /*0xd8-0xdf*/ 0xba53, 0xb4db, 0xba54, 0xba55, 0xba56, 0xf3f6, 0xf3f7, 0xba57, /*0xe0-0xe7*/ 0xba58, 0xba59, 0xf3f8, 0xba5a, 0xba5b, 0xba5c, 0xc0ba, 0xba5d, /*0xe8-0xef*/ 0xba5e, 0xc0e9, 0xba5f, 0xba60, 0xba61, 0xba62, 0xba63, 0xc5f1, /*0xf0-0xf7*/ 0xba64, 0xba65, 0xba66, 0xba67, 0xf3fb, 0xba68, 0xf3fa, 0xba69, /*0xf8-0xff*/ /* 0x7c00 */ 0xba6a, 0xba6b, 0xba6c, 0xba6d, 0xba6e, 0xba6f, 0xba70, 0xb4d8, /*0x00-0x07*/ 0xba71, 0xba72, 0xba73, 0xf3fe, 0xf3f9, 0xba74, 0xba75, 0xf3fc, /*0x08-0x0f*/ 0xba76, 0xba77, 0xba78, 0xba79, 0xba7a, 0xba7b, 0xf3fd, 0xba7c, /*0x10-0x17*/ 0xba7d, 0xba7e, 0xba80, 0xba81, 0xba82, 0xba83, 0xba84, 0xf4a1, /*0x18-0x1f*/ 0xba85, 0xba86, 0xba87, 0xba88, 0xba89, 0xba8a, 0xf4a3, 0xbbc9, /*0x20-0x27*/ 0xba8b, 0xba8c, 0xf4a2, 0xba8d, 0xba8e, 0xba8f, 0xba90, 0xba91, /*0x28-0x2f*/ 0xba92, 0xba93, 0xba94, 0xba95, 0xba96, 0xba97, 0xba98, 0xba99, /*0x30-0x37*/ 0xf4a4, 0xba9a, 0xba9b, 0xba9c, 0xba9d, 0xba9e, 0xba9f, 0xb2be, /*0x38-0x3f*/ 0xf4a6, 0xf4a5, 0xbaa0, 0xbb40, 0xbb41, 0xbb42, 0xbb43, 0xbb44, /*0x40-0x47*/ 0xbb45, 0xbb46, 0xbb47, 0xbb48, 0xbb49, 0xbcae, 0xbb4a, 0xbb4b, /*0x48-0x4f*/ 0xbb4c, 0xbb4d, 0xbb4e, 0xbb4f, 0xbb50, 0xbb51, 0xbb52, 0xbb53, /*0x50-0x57*/ 0xbb54, 0xbb55, 0xbb56, 0xbb57, 0xbb58, 0xbb59, 0xbb5a, 0xbb5b, /*0x58-0x5f*/ 0xbb5c, 0xbb5d, 0xbb5e, 0xbb5f, 0xbb60, 0xbb61, 0xbb62, 0xbb63, /*0x60-0x67*/ 0xbb64, 0xbb65, 0xbb66, 0xbb67, 0xbb68, 0xbb69, 0xbb6a, 0xbb6b, /*0x68-0x6f*/ 0xbb6c, 0xbb6d, 0xbb6e, 0xc3d7, 0xd9e1, 0xbb6f, 0xbb70, 0xbb71, /*0x70-0x77*/ 0xbb72, 0xbb73, 0xbb74, 0xc0e0, 0xf4cc, 0xd7d1, 0xbb75, 0xbb76, /*0x78-0x7f*/ 0xbb77, 0xbb78, 0xbb79, 0xbb7a, 0xbb7b, 0xbb7c, 0xbb7d, 0xbb7e, /*0x80-0x87*/ 0xbb80, 0xb7db, 0xbb81, 0xbb82, 0xbb83, 0xbb84, 0xbb85, 0xbb86, /*0x88-0x8f*/ 0xbb87, 0xf4ce, 0xc1a3, 0xbb88, 0xbb89, 0xc6c9, 0xbb8a, 0xb4d6, /*0x90-0x97*/ 0xd5b3, 0xbb8b, 0xbb8c, 0xbb8d, 0xf4d0, 0xf4cf, 0xf4d1, 0xcbda, /*0x98-0x9f*/ 0xbb8e, 0xbb8f, 0xf4d2, 0xbb90, 0xd4c1, 0xd6e0, 0xbb91, 0xbb92, /*0xa0-0xa7*/ 0xbb93, 0xbb94, 0xb7e0, 0xbb95, 0xbb96, 0xbb97, 0xc1b8, 0xbb98, /*0xa8-0xaf*/ 0xbb99, 0xc1bb, 0xf4d3, 0xbeac, 0xbb9a, 0xbb9b, 0xbb9c, 0xbb9d, /*0xb0-0xb7*/ 0xbb9e, 0xb4e2, 0xbb9f, 0xbba0, 0xf4d4, 0xf4d5, 0xbeab, 0xbc40, /*0xb8-0xbf*/ 0xbc41, 0xf4d6, 0xbc42, 0xbc43, 0xbc44, 0xf4db, 0xbc45, 0xf4d7, /*0xc0-0xc7*/ 0xf4da, 0xbc46, 0xbafd, 0xbc47, 0xf4d8, 0xf4d9, 0xbc48, 0xbc49, /*0xc8-0xcf*/ 0xbc4a, 0xbc4b, 0xbc4c, 0xbc4d, 0xbc4e, 0xb8e2, 0xccc7, 0xf4dc, /*0xd0-0xd7*/ 0xbc4f, 0xb2da, 0xbc50, 0xbc51, 0xc3d3, 0xbc52, 0xbc53, 0xd4e3, /*0xd8-0xdf*/ 0xbfb7, 0xbc54, 0xbc55, 0xbc56, 0xbc57, 0xbc58, 0xbc59, 0xbc5a, /*0xe0-0xe7*/ 0xf4dd, 0xbc5b, 0xbc5c, 0xbc5d, 0xbc5e, 0xbc5f, 0xbc60, 0xc5b4, /*0xe8-0xef*/ 0xbc61, 0xbc62, 0xbc63, 0xbc64, 0xbc65, 0xbc66, 0xbc67, 0xbc68, /*0xf0-0xf7*/ 0xf4e9, 0xbc69, 0xbc6a, 0xcfb5, 0xbc6b, 0xbc6c, 0xbc6d, 0xbc6e, /*0xf8-0xff*/ /* 0x7d00 */ 0xbc6f, 0xbc70, 0xbc71, 0xbc72, 0xbc73, 0xbc74, 0xbc75, 0xbc76, /*0x00-0x07*/ 0xbc77, 0xbc78, 0xcec9, 0xbc79, 0xbc7a, 0xbc7b, 0xbc7c, 0xbc7d, /*0x08-0x0f*/ 0xbc7e, 0xbc80, 0xbc81, 0xbc82, 0xbc83, 0xbc84, 0xbc85, 0xbc86, /*0x10-0x17*/ 0xbc87, 0xbc88, 0xbc89, 0xbc8a, 0xbc8b, 0xbc8c, 0xbc8d, 0xbc8e, /*0x18-0x1f*/ 0xcbd8, 0xbc8f, 0xcbf7, 0xbc90, 0xbc91, 0xbc92, 0xbc93, 0xbdf4, /*0x20-0x27*/ 0xbc94, 0xbc95, 0xbc96, 0xd7cf, 0xbc97, 0xbc98, 0xbc99, 0xc0db, /*0x28-0x2f*/ 0xbc9a, 0xbc9b, 0xbc9c, 0xbc9d, 0xbc9e, 0xbc9f, 0xbca0, 0xbd40, /*0x30-0x37*/ 0xbd41, 0xbd42, 0xbd43, 0xbd44, 0xbd45, 0xbd46, 0xbd47, 0xbd48, /*0x38-0x3f*/ 0xbd49, 0xbd4a, 0xbd4b, 0xbd4c, 0xbd4d, 0xbd4e, 0xbd4f, 0xbd50, /*0x40-0x47*/ 0xbd51, 0xbd52, 0xbd53, 0xbd54, 0xbd55, 0xbd56, 0xbd57, 0xbd58, /*0x48-0x4f*/ 0xbd59, 0xbd5a, 0xbd5b, 0xbd5c, 0xbd5d, 0xbd5e, 0xbd5f, 0xbd60, /*0x50-0x57*/ 0xbd61, 0xbd62, 0xbd63, 0xbd64, 0xbd65, 0xbd66, 0xbd67, 0xbd68, /*0x58-0x5f*/ 0xbd69, 0xbd6a, 0xbd6b, 0xbd6c, 0xbd6d, 0xbd6e, 0xbd6f, 0xbd70, /*0x60-0x67*/ 0xbd71, 0xbd72, 0xbd73, 0xbd74, 0xbd75, 0xbd76, 0xd0f5, 0xbd77, /*0x68-0x6f*/ 0xbd78, 0xbd79, 0xbd7a, 0xbd7b, 0xbd7c, 0xbd7d, 0xbd7e, 0xf4ea, /*0x70-0x77*/ 0xbd80, 0xbd81, 0xbd82, 0xbd83, 0xbd84, 0xbd85, 0xbd86, 0xbd87, /*0x78-0x7f*/ 0xbd88, 0xbd89, 0xbd8a, 0xbd8b, 0xbd8c, 0xbd8d, 0xbd8e, 0xbd8f, /*0x80-0x87*/ 0xbd90, 0xbd91, 0xbd92, 0xbd93, 0xbd94, 0xbd95, 0xbd96, 0xbd97, /*0x88-0x8f*/ 0xbd98, 0xbd99, 0xbd9a, 0xbd9b, 0xbd9c, 0xbd9d, 0xbd9e, 0xbd9f, /*0x90-0x97*/ 0xbda0, 0xbe40, 0xbe41, 0xbe42, 0xbe43, 0xbe44, 0xbe45, 0xbe46, /*0x98-0x9f*/ 0xbe47, 0xbe48, 0xbe49, 0xbe4a, 0xbe4b, 0xbe4c, 0xf4eb, 0xbe4d, /*0xa0-0xa7*/ 0xbe4e, 0xbe4f, 0xbe50, 0xbe51, 0xbe52, 0xbe53, 0xf4ec, 0xbe54, /*0xa8-0xaf*/ 0xbe55, 0xbe56, 0xbe57, 0xbe58, 0xbe59, 0xbe5a, 0xbe5b, 0xbe5c, /*0xb0-0xb7*/ 0xbe5d, 0xbe5e, 0xbe5f, 0xbe60, 0xbe61, 0xbe62, 0xbe63, 0xbe64, /*0xb8-0xbf*/ 0xbe65, 0xbe66, 0xbe67, 0xbe68, 0xbe69, 0xbe6a, 0xbe6b, 0xbe6c, /*0xc0-0xc7*/ 0xbe6d, 0xbe6e, 0xbe6f, 0xbe70, 0xbe71, 0xbe72, 0xbe73, 0xbe74, /*0xc8-0xcf*/ 0xbe75, 0xbe76, 0xbe77, 0xbe78, 0xbe79, 0xbe7a, 0xbe7b, 0xbe7c, /*0xd0-0xd7*/ 0xbe7d, 0xbe7e, 0xbe80, 0xbe81, 0xbe82, 0xbe83, 0xbe84, 0xbe85, /*0xd8-0xdf*/ 0xbe86, 0xbe87, 0xbe88, 0xbe89, 0xbe8a, 0xbe8b, 0xbe8c, 0xbe8d, /*0xe0-0xe7*/ 0xbe8e, 0xbe8f, 0xbe90, 0xbe91, 0xbe92, 0xbe93, 0xbe94, 0xbe95, /*0xe8-0xef*/ 0xbe96, 0xbe97, 0xbe98, 0xbe99, 0xbe9a, 0xbe9b, 0xbe9c, 0xbe9d, /*0xf0-0xf7*/ 0xbe9e, 0xbe9f, 0xbea0, 0xbf40, 0xbf41, 0xbf42, 0xbf43, 0xbf44, /*0xf8-0xff*/ /* 0x7e00 */ 0xbf45, 0xbf46, 0xbf47, 0xbf48, 0xbf49, 0xbf4a, 0xbf4b, 0xbf4c, /*0x00-0x07*/ 0xbf4d, 0xbf4e, 0xbf4f, 0xbf50, 0xbf51, 0xbf52, 0xbf53, 0xbf54, /*0x08-0x0f*/ 0xbf55, 0xbf56, 0xbf57, 0xbf58, 0xbf59, 0xbf5a, 0xbf5b, 0xbf5c, /*0x10-0x17*/ 0xbf5d, 0xbf5e, 0xbf5f, 0xbf60, 0xbf61, 0xbf62, 0xbf63, 0xbf64, /*0x18-0x1f*/ 0xbf65, 0xbf66, 0xbf67, 0xbf68, 0xbf69, 0xbf6a, 0xbf6b, 0xbf6c, /*0x20-0x27*/ 0xbf6d, 0xbf6e, 0xbf6f, 0xbf70, 0xbf71, 0xbf72, 0xbf73, 0xbf74, /*0x28-0x2f*/ 0xbf75, 0xbf76, 0xbf77, 0xbf78, 0xbf79, 0xbf7a, 0xbf7b, 0xbf7c, /*0x30-0x37*/ 0xbf7d, 0xbf7e, 0xbf80, 0xf7e3, 0xbf81, 0xbf82, 0xbf83, 0xbf84, /*0x38-0x3f*/ 0xbf85, 0xb7b1, 0xbf86, 0xbf87, 0xbf88, 0xbf89, 0xbf8a, 0xf4ed, /*0x40-0x47*/ 0xbf8b, 0xbf8c, 0xbf8d, 0xbf8e, 0xbf8f, 0xbf90, 0xbf91, 0xbf92, /*0x48-0x4f*/ 0xbf93, 0xbf94, 0xbf95, 0xbf96, 0xbf97, 0xbf98, 0xbf99, 0xbf9a, /*0x50-0x57*/ 0xbf9b, 0xbf9c, 0xbf9d, 0xbf9e, 0xbf9f, 0xbfa0, 0xc040, 0xc041, /*0x58-0x5f*/ 0xc042, 0xc043, 0xc044, 0xc045, 0xc046, 0xc047, 0xc048, 0xc049, /*0x60-0x67*/ 0xc04a, 0xc04b, 0xc04c, 0xc04d, 0xc04e, 0xc04f, 0xc050, 0xc051, /*0x68-0x6f*/ 0xc052, 0xc053, 0xc054, 0xc055, 0xc056, 0xc057, 0xc058, 0xc059, /*0x70-0x77*/ 0xc05a, 0xc05b, 0xc05c, 0xc05d, 0xc05e, 0xc05f, 0xc060, 0xc061, /*0x78-0x7f*/ 0xc062, 0xc063, 0xd7eb, 0xc064, 0xc065, 0xc066, 0xc067, 0xc068, /*0x80-0x87*/ 0xc069, 0xc06a, 0xc06b, 0xc06c, 0xc06d, 0xc06e, 0xc06f, 0xc070, /*0x88-0x8f*/ 0xc071, 0xc072, 0xc073, 0xc074, 0xc075, 0xc076, 0xc077, 0xc078, /*0x90-0x97*/ 0xc079, 0xc07a, 0xc07b, 0xf4ee, 0xc07c, 0xc07d, 0xc07e, 0xe6f9, /*0x98-0x9f*/ 0xbec0, 0xe6fa, 0xbaec, 0xe6fb, 0xcfcb, 0xe6fc, 0xd4bc, 0xbcb6, /*0xa0-0xa7*/ 0xe6fd, 0xe6fe, 0xbccd, 0xc8d2, 0xceb3, 0xe7a1, 0xc080, 0xb4bf, /*0xa8-0xaf*/ 0xe7a2, 0xc9b4, 0xb8d9, 0xc4c9, 0xc081, 0xd7dd, 0xc2da, 0xb7d7, /*0xb0-0xb7*/ 0xd6bd, 0xcec6, 0xb7c4, 0xc082, 0xc083, 0xc5a6, 0xe7a3, 0xcfdf, /*0xb8-0xbf*/ 0xe7a4, 0xe7a5, 0xe7a6, 0xc1b7, 0xd7e9, 0xc9f0, 0xcfb8, 0xd6af, /*0xc0-0xc7*/ 0xd6d5, 0xe7a7, 0xb0ed, 0xe7a8, 0xe7a9, 0xc9dc, 0xd2ef, 0xbead, /*0xc8-0xcf*/ 0xe7aa, 0xb0f3, 0xc8de, 0xbde1, 0xe7ab, 0xc8c6, 0xc084, 0xe7ac, /*0xd0-0xd7*/ 0xbbe6, 0xb8f8, 0xd1a4, 0xe7ad, 0xc2e7, 0xbef8, 0xbdca, 0xcdb3, /*0xd8-0xdf*/ 0xe7ae, 0xe7af, 0xbeee, 0xd0e5, 0xc085, 0xcbe7, 0xccd0, 0xbccc, /*0xe0-0xe7*/ 0xe7b0, 0xbca8, 0xd0f7, 0xe7b1, 0xc086, 0xd0f8, 0xe7b2, 0xe7b3, /*0xe8-0xef*/ 0xb4c2, 0xe7b4, 0xe7b5, 0xc9fe, 0xceac, 0xc3e0, 0xe7b7, 0xb1c1, /*0xf0-0xf7*/ 0xb3f1, 0xc087, 0xe7b8, 0xe7b9, 0xd7db, 0xd5c0, 0xe7ba, 0xc2cc, /*0xf8-0xff*/ /* 0x7f00 */ 0xd7ba, 0xe7bb, 0xe7bc, 0xe7bd, 0xbcea, 0xc3e5, 0xc0c2, 0xe7be, /*0x00-0x07*/ 0xe7bf, 0xbca9, 0xc088, 0xe7c0, 0xe7c1, 0xe7b6, 0xb6d0, 0xe7c2, /*0x08-0x0f*/ 0xc089, 0xe7c3, 0xe7c4, 0xbbba, 0xb5de, 0xc2c6, 0xb1e0, 0xe7c5, /*0x10-0x17*/ 0xd4b5, 0xe7c6, 0xb8bf, 0xe7c8, 0xe7c7, 0xb7ec, 0xc08a, 0xe7c9, /*0x18-0x1f*/ 0xb2f8, 0xe7ca, 0xe7cb, 0xe7cc, 0xe7cd, 0xe7ce, 0xe7cf, 0xe7d0, /*0x20-0x27*/ 0xd3a7, 0xcbf5, 0xe7d1, 0xe7d2, 0xe7d3, 0xe7d4, 0xc9c9, 0xe7d5, /*0x28-0x2f*/ 0xe7d6, 0xe7d7, 0xe7d8, 0xe7d9, 0xbdc9, 0xe7da, 0xf3be, 0xc08b, /*0x30-0x37*/ 0xb8d7, 0xc08c, 0xc8b1, 0xc08d, 0xc08e, 0xc08f, 0xc090, 0xc091, /*0x38-0x3f*/ 0xc092, 0xc093, 0xf3bf, 0xc094, 0xf3c0, 0xf3c1, 0xc095, 0xc096, /*0x40-0x47*/ 0xc097, 0xc098, 0xc099, 0xc09a, 0xc09b, 0xc09c, 0xc09d, 0xc09e, /*0x48-0x4f*/ 0xb9de, 0xcdf8, 0xc09f, 0xc0a0, 0xd8e8, 0xbab1, 0xc140, 0xc2de, /*0x50-0x57*/ 0xeeb7, 0xc141, 0xb7a3, 0xc142, 0xc143, 0xc144, 0xc145, 0xeeb9, /*0x58-0x5f*/ 0xc146, 0xeeb8, 0xb0d5, 0xc147, 0xc148, 0xc149, 0xc14a, 0xc14b, /*0x60-0x67*/ 0xeebb, 0xd5d6, 0xd7ef, 0xc14c, 0xc14d, 0xc14e, 0xd6c3, 0xc14f, /*0x68-0x6f*/ 0xc150, 0xeebd, 0xcaf0, 0xc151, 0xeebc, 0xc152, 0xc153, 0xc154, /*0x70-0x77*/ 0xc155, 0xeebe, 0xc156, 0xc157, 0xc158, 0xc159, 0xeec0, 0xc15a, /*0x78-0x7f*/ 0xc15b, 0xeebf, 0xc15c, 0xc15d, 0xc15e, 0xc15f, 0xc160, 0xc161, /*0x80-0x87*/ 0xc162, 0xc163, 0xd1f2, 0xc164, 0xc7bc, 0xc165, 0xc3c0, 0xc166, /*0x88-0x8f*/ 0xc167, 0xc168, 0xc169, 0xc16a, 0xb8e1, 0xc16b, 0xc16c, 0xc16d, /*0x90-0x97*/ 0xc16e, 0xc16f, 0xc1e7, 0xc170, 0xc171, 0xf4c6, 0xd0df, 0xf4c7, /*0x98-0x9f*/ 0xc172, 0xcfdb, 0xc173, 0xc174, 0xc8ba, 0xc175, 0xc176, 0xf4c8, /*0xa0-0xa7*/ 0xc177, 0xc178, 0xc179, 0xc17a, 0xc17b, 0xc17c, 0xc17d, 0xf4c9, /*0xa8-0xaf*/ 0xf4ca, 0xc17e, 0xf4cb, 0xc180, 0xc181, 0xc182, 0xc183, 0xc184, /*0xb0-0xb7*/ 0xd9fa, 0xb8fe, 0xc185, 0xc186, 0xe5f1, 0xd3f0, 0xc187, 0xf4e0, /*0xb8-0xbf*/ 0xc188, 0xcecc, 0xc189, 0xc18a, 0xc18b, 0xb3e1, 0xc18c, 0xc18d, /*0xc0-0xc7*/ 0xc18e, 0xc18f, 0xf1b4, 0xc190, 0xd2ee, 0xc191, 0xf4e1, 0xc192, /*0xc8-0xcf*/ 0xc193, 0xc194, 0xc195, 0xc196, 0xcfe8, 0xf4e2, 0xc197, 0xc198, /*0xd0-0xd7*/ 0xc7cc, 0xc199, 0xc19a, 0xc19b, 0xc19c, 0xc19d, 0xc19e, 0xb5d4, /*0xd8-0xdf*/ 0xb4e4, 0xf4e4, 0xc19f, 0xc1a0, 0xc240, 0xf4e3, 0xf4e5, 0xc241, /*0xe0-0xe7*/ 0xc242, 0xf4e6, 0xc243, 0xc244, 0xc245, 0xc246, 0xf4e7, 0xc247, /*0xe8-0xef*/ 0xbab2, 0xb0bf, 0xc248, 0xf4e8, 0xc249, 0xc24a, 0xc24b, 0xc24c, /*0xf0-0xf7*/ 0xc24d, 0xc24e, 0xc24f, 0xb7ad, 0xd2ed, 0xc250, 0xc251, 0xc252, /*0xf8-0xff*/ /* 0x8000 */ 0xd2ab, 0xc0cf, 0xc253, 0xbfbc, 0xeba3, 0xd5df, 0xeac8, 0xc254, /*0x00-0x07*/ 0xc255, 0xc256, 0xc257, 0xf1f3, 0xb6f8, 0xcba3, 0xc258, 0xc259, /*0x08-0x0f*/ 0xc4cd, 0xc25a, 0xf1e7, 0xc25b, 0xf1e8, 0xb8fb, 0xf1e9, 0xbac4, /*0x10-0x17*/ 0xd4c5, 0xb0d2, 0xc25c, 0xc25d, 0xf1ea, 0xc25e, 0xc25f, 0xc260, /*0x18-0x1f*/ 0xf1eb, 0xc261, 0xf1ec, 0xc262, 0xc263, 0xf1ed, 0xf1ee, 0xf1ef, /*0x20-0x27*/ 0xf1f1, 0xf1f0, 0xc5d5, 0xc264, 0xc265, 0xc266, 0xc267, 0xc268, /*0x28-0x2f*/ 0xc269, 0xf1f2, 0xc26a, 0xb6fa, 0xc26b, 0xf1f4, 0xd2ae, 0xdec7, /*0x30-0x37*/ 0xcbca, 0xc26c, 0xc26d, 0xb3dc, 0xc26e, 0xb5a2, 0xc26f, 0xb9a2, /*0x38-0x3f*/ 0xc270, 0xc271, 0xc4f4, 0xf1f5, 0xc272, 0xc273, 0xf1f6, 0xc274, /*0x40-0x47*/ 0xc275, 0xc276, 0xc1c4, 0xc1fb, 0xd6b0, 0xf1f7, 0xc277, 0xc278, /*0x48-0x4f*/ 0xc279, 0xc27a, 0xf1f8, 0xc27b, 0xc1aa, 0xc27c, 0xc27d, 0xc27e, /*0x50-0x57*/ 0xc6b8, 0xc280, 0xbedb, 0xc281, 0xc282, 0xc283, 0xc284, 0xc285, /*0x58-0x5f*/ 0xc286, 0xc287, 0xc288, 0xc289, 0xc28a, 0xc28b, 0xc28c, 0xc28d, /*0x60-0x67*/ 0xc28e, 0xf1f9, 0xb4cf, 0xc28f, 0xc290, 0xc291, 0xc292, 0xc293, /*0x68-0x6f*/ 0xc294, 0xf1fa, 0xc295, 0xc296, 0xc297, 0xc298, 0xc299, 0xc29a, /*0x70-0x77*/ 0xc29b, 0xc29c, 0xc29d, 0xc29e, 0xc29f, 0xc2a0, 0xc340, 0xedb2, /*0x78-0x7f*/ 0xedb1, 0xc341, 0xc342, 0xcbe0, 0xd2de, 0xc343, 0xcbc1, 0xd5d8, /*0x80-0x87*/ 0xc344, 0xc8e2, 0xc345, 0xc0df, 0xbca1, 0xc346, 0xc347, 0xc348, /*0x88-0x8f*/ 0xc349, 0xc34a, 0xc34b, 0xebc1, 0xc34c, 0xc34d, 0xd0a4, 0xc34e, /*0x90-0x97*/ 0xd6e2, 0xc34f, 0xb6c7, 0xb8d8, 0xebc0, 0xb8ce, 0xc350, 0xebbf, /*0x98-0x9f*/ 0xb3a6, 0xb9c9, 0xd6ab, 0xc351, 0xb7f4, 0xb7ca, 0xc352, 0xc353, /*0xa0-0xa7*/ 0xc354, 0xbce7, 0xb7be, 0xebc6, 0xc355, 0xebc7, 0xb0b9, 0xbfcf, /*0xa8-0xaf*/ 0xc356, 0xebc5, 0xd3fd, 0xc357, 0xebc8, 0xc358, 0xc359, 0xebc9, /*0xb0-0xb7*/ 0xc35a, 0xc35b, 0xb7ce, 0xc35c, 0xebc2, 0xebc4, 0xc9f6, 0xd6d7, /*0xb8-0xbf*/ 0xd5cd, 0xd0b2, 0xebcf, 0xceb8, 0xebd0, 0xc35d, 0xb5a8, 0xc35e, /*0xc0-0xc7*/ 0xc35f, 0xc360, 0xc361, 0xc362, 0xb1b3, 0xebd2, 0xcca5, 0xc363, /*0xc8-0xcf*/ 0xc364, 0xc365, 0xc366, 0xc367, 0xc368, 0xc369, 0xc5d6, 0xebd3, /*0xd0-0xd7*/ 0xc36a, 0xebd1, 0xc5df, 0xebce, 0xcaa4, 0xebd5, 0xb0fb, 0xc36b, /*0xd8-0xdf*/ 0xc36c, 0xbafa, 0xc36d, 0xc36e, 0xd8b7, 0xf1e3, 0xc36f, 0xebca, /*0xe0-0xe7*/ 0xebcb, 0xebcc, 0xebcd, 0xebd6, 0xe6c0, 0xebd9, 0xc370, 0xbfe8, /*0xe8-0xef*/ 0xd2c8, 0xebd7, 0xebdc, 0xb8ec, 0xebd8, 0xc371, 0xbdba, 0xc372, /*0xf0-0xf7*/ 0xd0d8, 0xc373, 0xb0b7, 0xc374, 0xebdd, 0xc4dc, 0xc375, 0xc376, /*0xf8-0xff*/ /* 0x8100 */ 0xc377, 0xc378, 0xd6ac, 0xc379, 0xc37a, 0xc37b, 0xb4e0, 0xc37c, /*0x00-0x07*/ 0xc37d, 0xc2f6, 0xbcb9, 0xc37e, 0xc380, 0xebda, 0xebdb, 0xd4e0, /*0x08-0x0f*/ 0xc6ea, 0xc4d4, 0xebdf, 0xc5a7, 0xd9f5, 0xc381, 0xb2b1, 0xc382, /*0x10-0x17*/ 0xebe4, 0xc383, 0xbdc5, 0xc384, 0xc385, 0xc386, 0xebe2, 0xc387, /*0x18-0x1f*/ 0xc388, 0xc389, 0xc38a, 0xc38b, 0xc38c, 0xc38d, 0xc38e, 0xc38f, /*0x20-0x27*/ 0xc390, 0xc391, 0xc392, 0xc393, 0xebe3, 0xc394, 0xc395, 0xb8ac, /*0x28-0x2f*/ 0xc396, 0xcdd1, 0xebe5, 0xc397, 0xc398, 0xc399, 0xebe1, 0xc39a, /*0x30-0x37*/ 0xc1b3, 0xc39b, 0xc39c, 0xc39d, 0xc39e, 0xc39f, 0xc6a2, 0xc3a0, /*0x38-0x3f*/ 0xc440, 0xc441, 0xc442, 0xc443, 0xc444, 0xc445, 0xccf3, 0xc446, /*0x40-0x47*/ 0xebe6, 0xc447, 0xc0b0, 0xd2b8, 0xebe7, 0xc448, 0xc449, 0xc44a, /*0x48-0x4f*/ 0xb8af, 0xb8ad, 0xc44b, 0xebe8, 0xc7bb, 0xcdf3, 0xc44c, 0xc44d, /*0x50-0x57*/ 0xc44e, 0xebea, 0xebeb, 0xc44f, 0xc450, 0xc451, 0xc452, 0xc453, /*0x58-0x5f*/ 0xebed, 0xc454, 0xc455, 0xc456, 0xc457, 0xd0c8, 0xc458, 0xebf2, /*0x60-0x67*/ 0xc459, 0xebee, 0xc45a, 0xc45b, 0xc45c, 0xebf1, 0xc8f9, 0xc45d, /*0x68-0x6f*/ 0xd1fc, 0xebec, 0xc45e, 0xc45f, 0xebe9, 0xc460, 0xc461, 0xc462, /*0x70-0x77*/ 0xc463, 0xb8b9, 0xcfd9, 0xc4e5, 0xebef, 0xebf0, 0xccda, 0xcdc8, /*0x78-0x7f*/ 0xb0f2, 0xc464, 0xebf6, 0xc465, 0xc466, 0xc467, 0xc468, 0xc469, /*0x80-0x87*/ 0xebf5, 0xc46a, 0xb2b2, 0xc46b, 0xc46c, 0xc46d, 0xc46e, 0xb8e0, /*0x88-0x8f*/ 0xc46f, 0xebf7, 0xc470, 0xc471, 0xc472, 0xc473, 0xc474, 0xc475, /*0x90-0x97*/ 0xb1ec, 0xc476, 0xc477, 0xccc5, 0xc4a4, 0xcfa5, 0xc478, 0xc479, /*0x98-0x9f*/ 0xc47a, 0xc47b, 0xc47c, 0xebf9, 0xc47d, 0xc47e, 0xeca2, 0xc480, /*0xa0-0xa7*/ 0xc5f2, 0xc481, 0xebfa, 0xc482, 0xc483, 0xc484, 0xc485, 0xc486, /*0xa8-0xaf*/ 0xc487, 0xc488, 0xc489, 0xc9c5, 0xc48a, 0xc48b, 0xc48c, 0xc48d, /*0xb0-0xb7*/ 0xc48e, 0xc48f, 0xe2df, 0xebfe, 0xc490, 0xc491, 0xc492, 0xc493, /*0xb8-0xbf*/ 0xcdce, 0xeca1, 0xb1db, 0xd3b7, 0xc494, 0xc495, 0xd2dc, 0xc496, /*0xc0-0xc7*/ 0xc497, 0xc498, 0xebfd, 0xc499, 0xebfb, 0xc49a, 0xc49b, 0xc49c, /*0xc8-0xcf*/ 0xc49d, 0xc49e, 0xc49f, 0xc4a0, 0xc540, 0xc541, 0xc542, 0xc543, /*0xd0-0xd7*/ 0xc544, 0xc545, 0xc546, 0xc547, 0xc548, 0xc549, 0xc54a, 0xc54b, /*0xd8-0xdf*/ 0xc54c, 0xc54d, 0xc54e, 0xb3bc, 0xc54f, 0xc550, 0xc551, 0xeab0, /*0xe0-0xe7*/ 0xc552, 0xc553, 0xd7d4, 0xc554, 0xf4ab, 0xb3f4, 0xc555, 0xc556, /*0xe8-0xef*/ 0xc557, 0xc558, 0xc559, 0xd6c1, 0xd6c2, 0xc55a, 0xc55b, 0xc55c, /*0xf0-0xf7*/ 0xc55d, 0xc55e, 0xc55f, 0xd5e9, 0xbeca, 0xc560, 0xf4a7, 0xc561, /*0xf8-0xff*/ /* 0x8200 */ 0xd2a8, 0xf4a8, 0xf4a9, 0xc562, 0xf4aa, 0xbecb, 0xd3df, 0xc563, /*0x00-0x07*/ 0xc564, 0xc565, 0xc566, 0xc567, 0xc9e0, 0xc9e1, 0xc568, 0xc569, /*0x08-0x0f*/ 0xf3c2, 0xc56a, 0xcae6, 0xc56b, 0xccf2, 0xc56c, 0xc56d, 0xc56e, /*0x10-0x17*/ 0xc56f, 0xc570, 0xc571, 0xe2b6, 0xcbb4, 0xc572, 0xcee8, 0xd6db, /*0x18-0x1f*/ 0xc573, 0xf4ad, 0xf4ae, 0xf4af, 0xc574, 0xc575, 0xc576, 0xc577, /*0x20-0x27*/ 0xf4b2, 0xc578, 0xbabd, 0xf4b3, 0xb0e3, 0xf4b0, 0xc579, 0xf4b1, /*0x28-0x2f*/ 0xbda2, 0xb2d5, 0xc57a, 0xf4b6, 0xf4b7, 0xb6e6, 0xb2b0, 0xcfcf, /*0x30-0x37*/ 0xf4b4, 0xb4ac, 0xc57b, 0xf4b5, 0xc57c, 0xc57d, 0xf4b8, 0xc57e, /*0x38-0x3f*/ 0xc580, 0xc581, 0xc582, 0xc583, 0xf4b9, 0xc584, 0xc585, 0xcda7, /*0x40-0x47*/ 0xc586, 0xf4ba, 0xc587, 0xf4bb, 0xc588, 0xc589, 0xc58a, 0xf4bc, /*0x48-0x4f*/ 0xc58b, 0xc58c, 0xc58d, 0xc58e, 0xc58f, 0xc590, 0xc591, 0xc592, /*0x50-0x57*/ 0xcbd2, 0xc593, 0xf4bd, 0xc594, 0xc595, 0xc596, 0xc597, 0xf4be, /*0x58-0x5f*/ 0xc598, 0xc599, 0xc59a, 0xc59b, 0xc59c, 0xc59d, 0xc59e, 0xc59f, /*0x60-0x67*/ 0xf4bf, 0xc5a0, 0xc640, 0xc641, 0xc642, 0xc643, 0xf4de, 0xc1bc, /*0x68-0x6f*/ 0xbce8, 0xc644, 0xc9ab, 0xd1de, 0xe5f5, 0xc645, 0xc646, 0xc647, /*0x70-0x77*/ 0xc648, 0xdcb3, 0xd2d5, 0xc649, 0xc64a, 0xdcb4, 0xb0ac, 0xdcb5, /*0x78-0x7f*/ 0xc64b, 0xc64c, 0xbdda, 0xc64d, 0xdcb9, 0xc64e, 0xc64f, 0xc650, /*0x80-0x87*/ 0xd8c2, 0xc651, 0xdcb7, 0xd3f3, 0xc652, 0xc9d6, 0xdcba, 0xdcb6, /*0x88-0x8f*/ 0xc653, 0xdcbb, 0xc3a2, 0xc654, 0xc655, 0xc656, 0xc657, 0xdcbc, /*0x90-0x97*/ 0xdcc5, 0xdcbd, 0xc658, 0xc659, 0xcedf, 0xd6a5, 0xc65a, 0xdccf, /*0x98-0x9f*/ 0xc65b, 0xdccd, 0xc65c, 0xc65d, 0xdcd2, 0xbde6, 0xc2ab, 0xc65e, /*0xa0-0xa7*/ 0xdcb8, 0xdccb, 0xdcce, 0xdcbe, 0xb7d2, 0xb0c5, 0xdcc7, 0xd0be, /*0xa8-0xaf*/ 0xdcc1, 0xbba8, 0xc65f, 0xb7bc, 0xdccc, 0xc660, 0xc661, 0xdcc6, /*0xb0-0xb7*/ 0xdcbf, 0xc7db, 0xc662, 0xc663, 0xc664, 0xd1bf, 0xdcc0, 0xc665, /*0xb8-0xbf*/ 0xc666, 0xdcca, 0xc667, 0xc668, 0xdcd0, 0xc669, 0xc66a, 0xcead, /*0xc0-0xc7*/ 0xdcc2, 0xc66b, 0xdcc3, 0xdcc8, 0xdcc9, 0xb2d4, 0xdcd1, 0xcbd5, /*0xc8-0xcf*/ 0xc66c, 0xd4b7, 0xdcdb, 0xdcdf, 0xcca6, 0xdce6, 0xc66d, 0xc3e7, /*0xd0-0xd7*/ 0xdcdc, 0xc66e, 0xc66f, 0xbfc1, 0xdcd9, 0xc670, 0xb0fa, 0xb9b6, /*0xd8-0xdf*/ 0xdce5, 0xdcd3, 0xc671, 0xdcc4, 0xdcd6, 0xc8f4, 0xbfe0, 0xc672, /*0xe0-0xe7*/ 0xc673, 0xc674, 0xc675, 0xc9bb, 0xc676, 0xc677, 0xc678, 0xb1bd, /*0xe8-0xef*/ 0xc679, 0xd3a2, 0xc67a, 0xc67b, 0xdcda, 0xc67c, 0xc67d, 0xdcd5, /*0xf0-0xf7*/ 0xc67e, 0xc6bb, 0xc680, 0xdcde, 0xc681, 0xc682, 0xc683, 0xc684, /*0xf8-0xff*/ /* 0x8300 */ 0xc685, 0xd7c2, 0xc3af, 0xb7b6, 0xc7d1, 0xc3a9, 0xdce2, 0xdcd8, /*0x00-0x07*/ 0xdceb, 0xdcd4, 0xc686, 0xc687, 0xdcdd, 0xc688, 0xbea5, 0xdcd7, /*0x08-0x0f*/ 0xc689, 0xdce0, 0xc68a, 0xc68b, 0xdce3, 0xdce4, 0xc68c, 0xdcf8, /*0x10-0x17*/ 0xc68d, 0xc68e, 0xdce1, 0xdda2, 0xdce7, 0xc68f, 0xc690, 0xc691, /*0x18-0x1f*/ 0xc692, 0xc693, 0xc694, 0xc695, 0xc696, 0xc697, 0xc698, 0xbceb, /*0x20-0x27*/ 0xb4c4, 0xc699, 0xc69a, 0xc3a3, 0xb2e7, 0xdcfa, 0xc69b, 0xdcf2, /*0x28-0x2f*/ 0xc69c, 0xdcef, 0xc69d, 0xdcfc, 0xdcee, 0xd2f0, 0xb2e8, 0xc69e, /*0x30-0x37*/ 0xc8d7, 0xc8e3, 0xdcfb, 0xc69f, 0xdced, 0xc6a0, 0xc740, 0xc741, /*0x38-0x3f*/ 0xdcf7, 0xc742, 0xc743, 0xdcf5, 0xc744, 0xc745, 0xbea3, 0xdcf4, /*0x40-0x47*/ 0xc746, 0xb2dd, 0xc747, 0xc748, 0xc749, 0xc74a, 0xc74b, 0xdcf3, /*0x48-0x4f*/ 0xbcf6, 0xdce8, 0xbbc4, 0xc74c, 0xc0f3, 0xc74d, 0xc74e, 0xc74f, /*0x50-0x57*/ 0xc750, 0xc751, 0xbcd4, 0xdce9, 0xdcea, 0xc752, 0xdcf1, 0xdcf6, /*0x58-0x5f*/ 0xdcf9, 0xb5b4, 0xc753, 0xc8d9, 0xbbe7, 0xdcfe, 0xdcfd, 0xd3ab, /*0x60-0x67*/ 0xdda1, 0xdda3, 0xdda5, 0xd2f1, 0xdda4, 0xdda6, 0xdda7, 0xd2a9, /*0x68-0x6f*/ 0xc754, 0xc755, 0xc756, 0xc757, 0xc758, 0xc759, 0xc75a, 0xbac9, /*0x70-0x77*/ 0xdda9, 0xc75b, 0xc75c, 0xddb6, 0xddb1, 0xddb4, 0xc75d, 0xc75e, /*0x78-0x7f*/ 0xc75f, 0xc760, 0xc761, 0xc762, 0xc763, 0xddb0, 0xc6ce, 0xc764, /*0x80-0x87*/ 0xc765, 0xc0f2, 0xc766, 0xc767, 0xc768, 0xc769, 0xc9af, 0xc76a, /*0x88-0x8f*/ 0xc76b, 0xc76c, 0xdcec, 0xddae, 0xc76d, 0xc76e, 0xc76f, 0xc770, /*0x90-0x97*/ 0xddb7, 0xc771, 0xc772, 0xdcf0, 0xddaf, 0xc773, 0xddb8, 0xc774, /*0x98-0x9f*/ 0xddac, 0xc775, 0xc776, 0xc777, 0xc778, 0xc779, 0xc77a, 0xc77b, /*0xa0-0xa7*/ 0xddb9, 0xddb3, 0xddad, 0xc4aa, 0xc77c, 0xc77d, 0xc77e, 0xc780, /*0xa8-0xaf*/ 0xdda8, 0xc0b3, 0xc1ab, 0xddaa, 0xddab, 0xc781, 0xddb2, 0xbbf1, /*0xb0-0xb7*/ 0xddb5, 0xd3a8, 0xddba, 0xc782, 0xddbb, 0xc3a7, 0xc783, 0xc784, /*0xb8-0xbf*/ 0xddd2, 0xddbc, 0xc785, 0xc786, 0xc787, 0xddd1, 0xc788, 0xb9bd, /*0xc0-0xc7*/ 0xc789, 0xc78a, 0xbed5, 0xc78b, 0xbefa, 0xc78c, 0xc78d, 0xbaca, /*0xc8-0xcf*/ 0xc78e, 0xc78f, 0xc790, 0xc791, 0xddca, 0xc792, 0xddc5, 0xc793, /*0xd0-0xd7*/ 0xddbf, 0xc794, 0xc795, 0xc796, 0xb2cb, 0xddc3, 0xc797, 0xddcb, /*0xd8-0xdf*/ 0xb2a4, 0xddd5, 0xc798, 0xc799, 0xc79a, 0xddbe, 0xc79b, 0xc79c, /*0xe0-0xe7*/ 0xc79d, 0xc6d0, 0xddd0, 0xc79e, 0xc79f, 0xc7a0, 0xc840, 0xc841, /*0xe8-0xef*/ 0xddd4, 0xc1e2, 0xb7c6, 0xc842, 0xc843, 0xc844, 0xc845, 0xc846, /*0xf0-0xf7*/ 0xddce, 0xddcf, 0xc847, 0xc848, 0xc849, 0xddc4, 0xc84a, 0xc84b, /*0xf8-0xff*/ /* 0x8400 */ 0xc84c, 0xddbd, 0xc84d, 0xddcd, 0xccd1, 0xc84e, 0xddc9, 0xc84f, /*0x00-0x07*/ 0xc850, 0xc851, 0xc852, 0xddc2, 0xc3c8, 0xc6bc, 0xceae, 0xddcc, /*0x08-0x0f*/ 0xc853, 0xddc8, 0xc854, 0xc855, 0xc856, 0xc857, 0xc858, 0xc859, /*0x10-0x17*/ 0xddc1, 0xc85a, 0xc85b, 0xc85c, 0xddc6, 0xc2dc, 0xc85d, 0xc85e, /*0x18-0x1f*/ 0xc85f, 0xc860, 0xc861, 0xc862, 0xd3a9, 0xd3aa, 0xddd3, 0xcff4, /*0x20-0x27*/ 0xc8f8, 0xc863, 0xc864, 0xc865, 0xc866, 0xc867, 0xc868, 0xc869, /*0x28-0x2f*/ 0xc86a, 0xdde6, 0xc86b, 0xc86c, 0xc86d, 0xc86e, 0xc86f, 0xc870, /*0x30-0x37*/ 0xddc7, 0xc871, 0xc872, 0xc873, 0xdde0, 0xc2e4, 0xc874, 0xc875, /*0x38-0x3f*/ 0xc876, 0xc877, 0xc878, 0xc879, 0xc87a, 0xc87b, 0xdde1, 0xc87c, /*0x40-0x47*/ 0xc87d, 0xc87e, 0xc880, 0xc881, 0xc882, 0xc883, 0xc884, 0xc885, /*0x48-0x4f*/ 0xc886, 0xddd7, 0xc887, 0xc888, 0xc889, 0xc88a, 0xc88b, 0xd6f8, /*0x50-0x57*/ 0xc88c, 0xddd9, 0xddd8, 0xb8f0, 0xddd6, 0xc88d, 0xc88e, 0xc88f, /*0x58-0x5f*/ 0xc890, 0xc6cf, 0xc891, 0xb6ad, 0xc892, 0xc893, 0xc894, 0xc895, /*0x60-0x67*/ 0xc896, 0xdde2, 0xc897, 0xbaf9, 0xd4e1, 0xdde7, 0xc898, 0xc899, /*0x68-0x6f*/ 0xc89a, 0xb4d0, 0xc89b, 0xddda, 0xc89c, 0xbffb, 0xdde3, 0xc89d, /*0x70-0x77*/ 0xdddf, 0xc89e, 0xdddd, 0xc89f, 0xc8a0, 0xc940, 0xc941, 0xc942, /*0x78-0x7f*/ 0xc943, 0xc944, 0xb5d9, 0xc945, 0xc946, 0xc947, 0xc948, 0xdddb, /*0x80-0x87*/ 0xdddc, 0xddde, 0xc949, 0xbdaf, 0xdde4, 0xc94a, 0xdde5, 0xc94b, /*0x88-0x8f*/ 0xc94c, 0xc94d, 0xc94e, 0xc94f, 0xc950, 0xc951, 0xc952, 0xddf5, /*0x90-0x97*/ 0xc953, 0xc3c9, 0xc954, 0xc955, 0xcbe2, 0xc956, 0xc957, 0xc958, /*0x98-0x9f*/ 0xc959, 0xddf2, 0xc95a, 0xc95b, 0xc95c, 0xc95d, 0xc95e, 0xc95f, /*0xa0-0xa7*/ 0xc960, 0xc961, 0xc962, 0xc963, 0xc964, 0xc965, 0xc966, 0xd8e1, /*0xa8-0xaf*/ 0xc967, 0xc968, 0xc6d1, 0xc969, 0xddf4, 0xc96a, 0xc96b, 0xc96c, /*0xb0-0xb7*/ 0xd5f4, 0xddf3, 0xddf0, 0xc96d, 0xc96e, 0xddec, 0xc96f, 0xddef, /*0xb8-0xbf*/ 0xc970, 0xdde8, 0xc971, 0xc972, 0xd0ee, 0xc973, 0xc974, 0xc975, /*0xc0-0xc7*/ 0xc976, 0xc8d8, 0xddee, 0xc977, 0xc978, 0xdde9, 0xc979, 0xc97a, /*0xc8-0xcf*/ 0xddea, 0xcbf2, 0xc97b, 0xdded, 0xc97c, 0xc97d, 0xb1cd, 0xc97e, /*0xd0-0xd7*/ 0xc980, 0xc981, 0xc982, 0xc983, 0xc984, 0xc0b6, 0xc985, 0xbcbb, /*0xd8-0xdf*/ 0xddf1, 0xc986, 0xc987, 0xddf7, 0xc988, 0xddf6, 0xddeb, 0xc989, /*0xe0-0xe7*/ 0xc98a, 0xc98b, 0xc98c, 0xc98d, 0xc5ee, 0xc98e, 0xc98f, 0xc990, /*0xe8-0xef*/ 0xddfb, 0xc991, 0xc992, 0xc993, 0xc994, 0xc995, 0xc996, 0xc997, /*0xf0-0xf7*/ 0xc998, 0xc999, 0xc99a, 0xc99b, 0xdea4, 0xc99c, 0xc99d, 0xdea3, /*0xf8-0xff*/ /* 0x8500 */ 0xc99e, 0xc99f, 0xc9a0, 0xca40, 0xca41, 0xca42, 0xca43, 0xca44, /*0x00-0x07*/ 0xca45, 0xca46, 0xca47, 0xca48, 0xddf8, 0xca49, 0xca4a, 0xca4b, /*0x08-0x0f*/ 0xca4c, 0xc3ef, 0xca4d, 0xc2fb, 0xca4e, 0xca4f, 0xca50, 0xd5e1, /*0x10-0x17*/ 0xca51, 0xca52, 0xceb5, 0xca53, 0xca54, 0xca55, 0xca56, 0xddfd, /*0x18-0x1f*/ 0xca57, 0xb2cc, 0xca58, 0xca59, 0xca5a, 0xca5b, 0xca5c, 0xca5d, /*0x20-0x27*/ 0xca5e, 0xca5f, 0xca60, 0xc4e8, 0xcadf, 0xca61, 0xca62, 0xca63, /*0x28-0x2f*/ 0xca64, 0xca65, 0xca66, 0xca67, 0xca68, 0xca69, 0xca6a, 0xc7be, /*0x30-0x37*/ 0xddfa, 0xddfc, 0xddfe, 0xdea2, 0xb0aa, 0xb1ce, 0xca6b, 0xca6c, /*0x38-0x3f*/ 0xca6d, 0xca6e, 0xca6f, 0xdeac, 0xca70, 0xca71, 0xca72, 0xca73, /*0x40-0x47*/ 0xdea6, 0xbdb6, 0xc8ef, 0xca74, 0xca75, 0xca76, 0xca77, 0xca78, /*0x48-0x4f*/ 0xca79, 0xca7a, 0xca7b, 0xca7c, 0xca7d, 0xca7e, 0xdea1, 0xca80, /*0x50-0x57*/ 0xca81, 0xdea5, 0xca82, 0xca83, 0xca84, 0xca85, 0xdea9, 0xca86, /*0x58-0x5f*/ 0xca87, 0xca88, 0xca89, 0xca8a, 0xdea8, 0xca8b, 0xca8c, 0xca8d, /*0x60-0x67*/ 0xdea7, 0xca8e, 0xca8f, 0xca90, 0xca91, 0xca92, 0xca93, 0xca94, /*0x68-0x6f*/ 0xca95, 0xca96, 0xdead, 0xca97, 0xd4cc, 0xca98, 0xca99, 0xca9a, /*0x70-0x77*/ 0xca9b, 0xdeb3, 0xdeaa, 0xdeae, 0xca9c, 0xca9d, 0xc0d9, 0xca9e, /*0x78-0x7f*/ 0xca9f, 0xcaa0, 0xcb40, 0xcb41, 0xb1a1, 0xdeb6, 0xcb42, 0xdeb1, /*0x80-0x87*/ 0xcb43, 0xcb44, 0xcb45, 0xcb46, 0xcb47, 0xcb48, 0xcb49, 0xdeb2, /*0x88-0x8f*/ 0xcb4a, 0xcb4b, 0xcb4c, 0xcb4d, 0xcb4e, 0xcb4f, 0xcb50, 0xcb51, /*0x90-0x97*/ 0xcb52, 0xcb53, 0xcb54, 0xd1a6, 0xdeb5, 0xcb55, 0xcb56, 0xcb57, /*0x98-0x9f*/ 0xcb58, 0xcb59, 0xcb5a, 0xcb5b, 0xdeaf, 0xcb5c, 0xcb5d, 0xcb5e, /*0xa0-0xa7*/ 0xdeb0, 0xcb5f, 0xd0bd, 0xcb60, 0xcb61, 0xcb62, 0xdeb4, 0xcaed, /*0xa8-0xaf*/ 0xdeb9, 0xcb63, 0xcb64, 0xcb65, 0xcb66, 0xcb67, 0xcb68, 0xdeb8, /*0xb0-0xb7*/ 0xcb69, 0xdeb7, 0xcb6a, 0xcb6b, 0xcb6c, 0xcb6d, 0xcb6e, 0xcb6f, /*0xb8-0xbf*/ 0xcb70, 0xdebb, 0xcb71, 0xcb72, 0xcb73, 0xcb74, 0xcb75, 0xcb76, /*0xc0-0xc7*/ 0xcb77, 0xbde5, 0xcb78, 0xcb79, 0xcb7a, 0xcb7b, 0xcb7c, 0xb2d8, /*0xc8-0xcf*/ 0xc3ea, 0xcb7d, 0xcb7e, 0xdeba, 0xcb80, 0xc5ba, 0xcb81, 0xcb82, /*0xd0-0xd7*/ 0xcb83, 0xcb84, 0xcb85, 0xcb86, 0xdebc, 0xcb87, 0xcb88, 0xcb89, /*0xd8-0xdf*/ 0xcb8a, 0xcb8b, 0xcb8c, 0xcb8d, 0xccd9, 0xcb8e, 0xcb8f, 0xcb90, /*0xe0-0xe7*/ 0xcb91, 0xb7aa, 0xcb92, 0xcb93, 0xcb94, 0xcb95, 0xcb96, 0xcb97, /*0xe8-0xef*/ 0xcb98, 0xcb99, 0xcb9a, 0xcb9b, 0xcb9c, 0xcb9d, 0xcb9e, 0xcb9f, /*0xf0-0xf7*/ 0xcba0, 0xcc40, 0xcc41, 0xd4e5, 0xcc42, 0xcc43, 0xcc44, 0xdebd, /*0xf8-0xff*/ /* 0x8600 */ 0xcc45, 0xcc46, 0xcc47, 0xcc48, 0xcc49, 0xdebf, 0xcc4a, 0xcc4b, /*0x00-0x07*/ 0xcc4c, 0xcc4d, 0xcc4e, 0xcc4f, 0xcc50, 0xcc51, 0xcc52, 0xcc53, /*0x08-0x0f*/ 0xcc54, 0xc4a2, 0xcc55, 0xcc56, 0xcc57, 0xcc58, 0xdec1, 0xcc59, /*0x10-0x17*/ 0xcc5a, 0xcc5b, 0xcc5c, 0xcc5d, 0xcc5e, 0xcc5f, 0xcc60, 0xcc61, /*0x18-0x1f*/ 0xcc62, 0xcc63, 0xcc64, 0xcc65, 0xcc66, 0xcc67, 0xcc68, 0xdebe, /*0x20-0x27*/ 0xcc69, 0xdec0, 0xcc6a, 0xcc6b, 0xcc6c, 0xcc6d, 0xcc6e, 0xcc6f, /*0x28-0x2f*/ 0xcc70, 0xcc71, 0xcc72, 0xcc73, 0xcc74, 0xcc75, 0xcc76, 0xcc77, /*0x30-0x37*/ 0xd5ba, 0xcc78, 0xcc79, 0xcc7a, 0xdec2, 0xcc7b, 0xcc7c, 0xcc7d, /*0x38-0x3f*/ 0xcc7e, 0xcc80, 0xcc81, 0xcc82, 0xcc83, 0xcc84, 0xcc85, 0xcc86, /*0x40-0x47*/ 0xcc87, 0xcc88, 0xcc89, 0xcc8a, 0xcc8b, 0xf2ae, 0xbba2, 0xc2b2, /*0x48-0x4f*/ 0xc5b0, 0xc2c7, 0xcc8c, 0xcc8d, 0xf2af, 0xcc8e, 0xcc8f, 0xcc90, /*0x50-0x57*/ 0xcc91, 0xcc92, 0xd0e9, 0xcc93, 0xcc94, 0xcc95, 0xd3dd, 0xcc96, /*0x58-0x5f*/ 0xcc97, 0xcc98, 0xebbd, 0xcc99, 0xcc9a, 0xcc9b, 0xcc9c, 0xcc9d, /*0x60-0x67*/ 0xcc9e, 0xcc9f, 0xcca0, 0xb3e6, 0xf2b0, 0xcd40, 0xf2b1, 0xcd41, /*0x68-0x6f*/ 0xcd42, 0xcaad, 0xcd43, 0xcd44, 0xcd45, 0xcd46, 0xcd47, 0xcd48, /*0x70-0x77*/ 0xcd49, 0xbae7, 0xf2b3, 0xf2b5, 0xf2b4, 0xcbe4, 0xcfba, 0xf2b2, /*0x78-0x7f*/ 0xcab4, 0xd2cf, 0xc2ec, 0xcd4a, 0xcd4b, 0xcd4c, 0xcd4d, 0xcd4e, /*0x80-0x87*/ 0xcd4f, 0xcd50, 0xcec3, 0xf2b8, 0xb0f6, 0xf2b7, 0xcd51, 0xcd52, /*0x88-0x8f*/ 0xcd53, 0xcd54, 0xcd55, 0xf2be, 0xcd56, 0xb2cf, 0xcd57, 0xcd58, /*0x90-0x97*/ 0xcd59, 0xcd5a, 0xcd5b, 0xcd5c, 0xd1c1, 0xf2ba, 0xcd5d, 0xcd5e, /*0x98-0x9f*/ 0xcd5f, 0xcd60, 0xcd61, 0xf2bc, 0xd4e9, 0xcd62, 0xcd63, 0xf2bb, /*0xa0-0xa7*/ 0xf2b6, 0xf2bf, 0xf2bd, 0xcd64, 0xf2b9, 0xcd65, 0xcd66, 0xf2c7, /*0xa8-0xaf*/ 0xf2c4, 0xf2c6, 0xcd67, 0xcd68, 0xf2ca, 0xf2c2, 0xf2c0, 0xcd69, /*0xb0-0xb7*/ 0xcd6a, 0xcd6b, 0xf2c5, 0xcd6c, 0xcd6d, 0xcd6e, 0xcd6f, 0xcd70, /*0xb8-0xbf*/ 0xd6fb, 0xcd71, 0xcd72, 0xcd73, 0xf2c1, 0xcd74, 0xc7f9, 0xc9df, /*0xc0-0xc7*/ 0xcd75, 0xf2c8, 0xb9c6, 0xb5b0, 0xcd76, 0xcd77, 0xf2c3, 0xf2c9, /*0xc8-0xcf*/ 0xf2d0, 0xf2d6, 0xcd78, 0xcd79, 0xbbd7, 0xcd7a, 0xcd7b, 0xcd7c, /*0xd0-0xd7*/ 0xf2d5, 0xcddc, 0xcd7d, 0xd6eb, 0xcd7e, 0xcd80, 0xf2d2, 0xf2d4, /*0xd8-0xdf*/ 0xcd81, 0xcd82, 0xcd83, 0xcd84, 0xb8f2, 0xcd85, 0xcd86, 0xcd87, /*0xe0-0xe7*/ 0xcd88, 0xf2cb, 0xcd89, 0xcd8a, 0xcd8b, 0xf2ce, 0xc2f9, 0xcd8c, /*0xe8-0xef*/ 0xd5dd, 0xf2cc, 0xf2cd, 0xf2cf, 0xf2d3, 0xcd8d, 0xcd8e, 0xcd8f, /*0xf0-0xf7*/ 0xf2d9, 0xd3bc, 0xcd90, 0xcd91, 0xcd92, 0xcd93, 0xb6ea, 0xcd94, /*0xf8-0xff*/ /* 0x8700 */ 0xcaf1, 0xcd95, 0xb7e4, 0xf2d7, 0xcd96, 0xcd97, 0xcd98, 0xf2d8, /*0x00-0x07*/ 0xf2da, 0xf2dd, 0xf2db, 0xcd99, 0xcd9a, 0xf2dc, 0xcd9b, 0xcd9c, /*0x08-0x0f*/ 0xcd9d, 0xcd9e, 0xd1d1, 0xf2d1, 0xcd9f, 0xcdc9, 0xcda0, 0xcecf, /*0x10-0x17*/ 0xd6a9, 0xce40, 0xf2e3, 0xce41, 0xc3db, 0xce42, 0xf2e0, 0xce43, /*0x18-0x1f*/ 0xce44, 0xc0af, 0xf2ec, 0xf2de, 0xce45, 0xf2e1, 0xce46, 0xce47, /*0x20-0x27*/ 0xce48, 0xf2e8, 0xce49, 0xce4a, 0xce4b, 0xce4c, 0xf2e2, 0xce4d, /*0x28-0x2f*/ 0xce4e, 0xf2e7, 0xce4f, 0xce50, 0xf2e6, 0xce51, 0xce52, 0xf2e9, /*0x30-0x37*/ 0xce53, 0xce54, 0xce55, 0xf2df, 0xce56, 0xce57, 0xf2e4, 0xf2ea, /*0x38-0x3f*/ 0xce58, 0xce59, 0xce5a, 0xce5b, 0xce5c, 0xce5d, 0xce5e, 0xd3ac, /*0x40-0x47*/ 0xf2e5, 0xb2f5, 0xce5f, 0xce60, 0xf2f2, 0xce61, 0xd0ab, 0xce62, /*0x48-0x4f*/ 0xce63, 0xce64, 0xce65, 0xf2f5, 0xce66, 0xce67, 0xce68, 0xbbc8, /*0x50-0x57*/ 0xce69, 0xf2f9, 0xce6a, 0xce6b, 0xce6c, 0xce6d, 0xce6e, 0xce6f, /*0x58-0x5f*/ 0xf2f0, 0xce70, 0xce71, 0xf2f6, 0xf2f8, 0xf2fa, 0xce72, 0xce73, /*0x60-0x67*/ 0xce74, 0xce75, 0xce76, 0xce77, 0xce78, 0xce79, 0xf2f3, 0xce7a, /*0x68-0x6f*/ 0xf2f1, 0xce7b, 0xce7c, 0xce7d, 0xbafb, 0xce7e, 0xb5fb, 0xce80, /*0x70-0x77*/ 0xce81, 0xce82, 0xce83, 0xf2ef, 0xf2f7, 0xf2ed, 0xf2ee, 0xce84, /*0x78-0x7f*/ 0xce85, 0xce86, 0xf2eb, 0xf3a6, 0xce87, 0xf3a3, 0xce88, 0xce89, /*0x80-0x87*/ 0xf3a2, 0xce8a, 0xce8b, 0xf2f4, 0xce8c, 0xc8da, 0xce8d, 0xce8e, /*0x88-0x8f*/ 0xce8f, 0xce90, 0xce91, 0xf2fb, 0xce92, 0xce93, 0xce94, 0xf3a5, /*0x90-0x97*/ 0xce95, 0xce96, 0xce97, 0xce98, 0xce99, 0xce9a, 0xce9b, 0xc3f8, /*0x98-0x9f*/ 0xce9c, 0xce9d, 0xce9e, 0xce9f, 0xcea0, 0xcf40, 0xcf41, 0xcf42, /*0xa0-0xa7*/ 0xf2fd, 0xcf43, 0xcf44, 0xf3a7, 0xf3a9, 0xf3a4, 0xcf45, 0xf2fc, /*0xa8-0xaf*/ 0xcf46, 0xcf47, 0xcf48, 0xf3ab, 0xcf49, 0xf3aa, 0xcf4a, 0xcf4b, /*0xb0-0xb7*/ 0xcf4c, 0xcf4d, 0xc2dd, 0xcf4e, 0xcf4f, 0xf3ae, 0xcf50, 0xcf51, /*0xb8-0xbf*/ 0xf3b0, 0xcf52, 0xcf53, 0xcf54, 0xcf55, 0xcf56, 0xf3a1, 0xcf57, /*0xc0-0xc7*/ 0xcf58, 0xcf59, 0xf3b1, 0xf3ac, 0xcf5a, 0xcf5b, 0xcf5c, 0xcf5d, /*0xc8-0xcf*/ 0xcf5e, 0xf3af, 0xf2fe, 0xf3ad, 0xcf5f, 0xcf60, 0xcf61, 0xcf62, /*0xd0-0xd7*/ 0xcf63, 0xcf64, 0xcf65, 0xf3b2, 0xcf66, 0xcf67, 0xcf68, 0xcf69, /*0xd8-0xdf*/ 0xf3b4, 0xcf6a, 0xcf6b, 0xcf6c, 0xcf6d, 0xf3a8, 0xcf6e, 0xcf6f, /*0xe0-0xe7*/ 0xcf70, 0xcf71, 0xf3b3, 0xcf72, 0xcf73, 0xcf74, 0xf3b5, 0xcf75, /*0xe8-0xef*/ 0xcf76, 0xcf77, 0xcf78, 0xcf79, 0xcf7a, 0xcf7b, 0xcf7c, 0xcf7d, /*0xf0-0xf7*/ 0xcf7e, 0xd0b7, 0xcf80, 0xcf81, 0xcf82, 0xcf83, 0xf3b8, 0xcf84, /*0xf8-0xff*/ /* 0x8800 */ 0xcf85, 0xcf86, 0xcf87, 0xd9f9, 0xcf88, 0xcf89, 0xcf8a, 0xcf8b, /*0x00-0x07*/ 0xcf8c, 0xcf8d, 0xf3b9, 0xcf8e, 0xcf8f, 0xcf90, 0xcf91, 0xcf92, /*0x08-0x0f*/ 0xcf93, 0xcf94, 0xcf95, 0xf3b7, 0xcf96, 0xc8e4, 0xf3b6, 0xcf97, /*0x10-0x17*/ 0xcf98, 0xcf99, 0xcf9a, 0xf3ba, 0xcf9b, 0xcf9c, 0xcf9d, 0xcf9e, /*0x18-0x1f*/ 0xcf9f, 0xf3bb, 0xb4c0, 0xcfa0, 0xd040, 0xd041, 0xd042, 0xd043, /*0x20-0x27*/ 0xd044, 0xd045, 0xd046, 0xd047, 0xd048, 0xd049, 0xd04a, 0xd04b, /*0x28-0x2f*/ 0xd04c, 0xd04d, 0xeec3, 0xd04e, 0xd04f, 0xd050, 0xd051, 0xd052, /*0x30-0x37*/ 0xd053, 0xf3bc, 0xd054, 0xd055, 0xf3bd, 0xd056, 0xd057, 0xd058, /*0x38-0x3f*/ 0xd1aa, 0xd059, 0xd05a, 0xd05b, 0xf4ac, 0xd0c6, 0xd05c, 0xd05d, /*0x40-0x47*/ 0xd05e, 0xd05f, 0xd060, 0xd061, 0xd0d0, 0xd1dc, 0xd062, 0xd063, /*0x48-0x4f*/ 0xd064, 0xd065, 0xd066, 0xd067, 0xcfce, 0xd068, 0xd069, 0xbdd6, /*0x50-0x57*/ 0xd06a, 0xd1c3, 0xd06b, 0xd06c, 0xd06d, 0xd06e, 0xd06f, 0xd070, /*0x58-0x5f*/ 0xd071, 0xbae2, 0xe1e9, 0xd2c2, 0xf1c2, 0xb2b9, 0xd072, 0xd073, /*0x60-0x67*/ 0xb1ed, 0xf1c3, 0xd074, 0xc9c0, 0xb3c4, 0xd075, 0xd9f2, 0xd076, /*0x68-0x6f*/ 0xcba5, 0xd077, 0xf1c4, 0xd078, 0xd079, 0xd07a, 0xd07b, 0xd6d4, /*0x70-0x77*/ 0xd07c, 0xd07d, 0xd07e, 0xd080, 0xd081, 0xf1c5, 0xf4c0, 0xf1c6, /*0x78-0x7f*/ 0xd082, 0xd4ac, 0xf1c7, 0xd083, 0xb0c0, 0xf4c1, 0xd084, 0xd085, /*0x80-0x87*/ 0xf4c2, 0xd086, 0xd087, 0xb4fc, 0xd088, 0xc5db, 0xd089, 0xd08a, /*0x88-0x8f*/ 0xd08b, 0xd08c, 0xccbb, 0xd08d, 0xd08e, 0xd08f, 0xd0e4, 0xd090, /*0x90-0x97*/ 0xd091, 0xd092, 0xd093, 0xd094, 0xcde0, 0xd095, 0xd096, 0xd097, /*0x98-0x9f*/ 0xd098, 0xd099, 0xf1c8, 0xd09a, 0xd9f3, 0xd09b, 0xd09c, 0xd09d, /*0xa0-0xa7*/ 0xd09e, 0xd09f, 0xd0a0, 0xb1bb, 0xd140, 0xcfae, 0xd141, 0xd142, /*0xa8-0xaf*/ 0xd143, 0xb8a4, 0xd144, 0xd145, 0xd146, 0xd147, 0xd148, 0xf1ca, /*0xb0-0xb7*/ 0xd149, 0xd14a, 0xd14b, 0xd14c, 0xf1cb, 0xd14d, 0xd14e, 0xd14f, /*0xb8-0xbf*/ 0xd150, 0xb2c3, 0xc1d1, 0xd151, 0xd152, 0xd7b0, 0xf1c9, 0xd153, /*0xc0-0xc7*/ 0xd154, 0xf1cc, 0xd155, 0xd156, 0xd157, 0xd158, 0xf1ce, 0xd159, /*0xc8-0xcf*/ 0xd15a, 0xd15b, 0xd9f6, 0xd15c, 0xd2e1, 0xd4a3, 0xd15d, 0xd15e, /*0xd0-0xd7*/ 0xf4c3, 0xc8b9, 0xd15f, 0xd160, 0xd161, 0xd162, 0xd163, 0xf4c4, /*0xd8-0xdf*/ 0xd164, 0xd165, 0xf1cd, 0xf1cf, 0xbfe3, 0xf1d0, 0xd166, 0xd167, /*0xe0-0xe7*/ 0xf1d4, 0xd168, 0xd169, 0xd16a, 0xd16b, 0xd16c, 0xd16d, 0xd16e, /*0xe8-0xef*/ 0xf1d6, 0xf1d1, 0xd16f, 0xc9d1, 0xc5e1, 0xd170, 0xd171, 0xd172, /*0xf0-0xf7*/ 0xc2e3, 0xb9fc, 0xd173, 0xd174, 0xf1d3, 0xd175, 0xf1d5, 0xd176, /*0xf8-0xff*/ /* 0x8900 */ 0xd177, 0xd178, 0xb9d3, 0xd179, 0xd17a, 0xd17b, 0xd17c, 0xd17d, /*0x00-0x07*/ 0xd17e, 0xd180, 0xf1db, 0xd181, 0xd182, 0xd183, 0xd184, 0xd185, /*0x08-0x0f*/ 0xbad6, 0xd186, 0xb0fd, 0xf1d9, 0xd187, 0xd188, 0xd189, 0xd18a, /*0x10-0x17*/ 0xd18b, 0xf1d8, 0xf1d2, 0xf1da, 0xd18c, 0xd18d, 0xd18e, 0xd18f, /*0x18-0x1f*/ 0xd190, 0xf1d7, 0xd191, 0xd192, 0xd193, 0xc8ec, 0xd194, 0xd195, /*0x20-0x27*/ 0xd196, 0xd197, 0xcdca, 0xf1dd, 0xd198, 0xd199, 0xd19a, 0xd19b, /*0x28-0x2f*/ 0xe5bd, 0xd19c, 0xd19d, 0xd19e, 0xf1dc, 0xd19f, 0xf1de, 0xd1a0, /*0x30-0x37*/ 0xd240, 0xd241, 0xd242, 0xd243, 0xd244, 0xd245, 0xd246, 0xd247, /*0x38-0x3f*/ 0xd248, 0xf1df, 0xd249, 0xd24a, 0xcfe5, 0xd24b, 0xd24c, 0xd24d, /*0x40-0x47*/ 0xd24e, 0xd24f, 0xd250, 0xd251, 0xd252, 0xd253, 0xd254, 0xd255, /*0x48-0x4f*/ 0xd256, 0xd257, 0xd258, 0xd259, 0xd25a, 0xd25b, 0xd25c, 0xd25d, /*0x50-0x57*/ 0xd25e, 0xd25f, 0xd260, 0xd261, 0xd262, 0xd263, 0xf4c5, 0xbdf3, /*0x58-0x5f*/ 0xd264, 0xd265, 0xd266, 0xd267, 0xd268, 0xd269, 0xf1e0, 0xd26a, /*0x60-0x67*/ 0xd26b, 0xd26c, 0xd26d, 0xd26e, 0xd26f, 0xd270, 0xd271, 0xd272, /*0x68-0x6f*/ 0xd273, 0xd274, 0xd275, 0xd276, 0xd277, 0xd278, 0xd279, 0xd27a, /*0x70-0x77*/ 0xd27b, 0xd27c, 0xd27d, 0xf1e1, 0xd27e, 0xd280, 0xd281, 0xcef7, /*0x78-0x7f*/ 0xd282, 0xd2aa, 0xd283, 0xf1fb, 0xd284, 0xd285, 0xb8b2, 0xd286, /*0x80-0x87*/ 0xd287, 0xd288, 0xd289, 0xd28a, 0xd28b, 0xd28c, 0xd28d, 0xd28e, /*0x88-0x8f*/ 0xd28f, 0xd290, 0xd291, 0xd292, 0xd293, 0xd294, 0xd295, 0xd296, /*0x90-0x97*/ 0xd297, 0xd298, 0xd299, 0xd29a, 0xd29b, 0xd29c, 0xd29d, 0xd29e, /*0x98-0x9f*/ 0xd29f, 0xd2a0, 0xd340, 0xd341, 0xd342, 0xd343, 0xd344, 0xd345, /*0xa0-0xa7*/ 0xd346, 0xd347, 0xd348, 0xd349, 0xd34a, 0xd34b, 0xd34c, 0xd34d, /*0xa8-0xaf*/ 0xd34e, 0xd34f, 0xd350, 0xd351, 0xd352, 0xd353, 0xd354, 0xd355, /*0xb0-0xb7*/ 0xd356, 0xd357, 0xd358, 0xd359, 0xd35a, 0xd35b, 0xd35c, 0xd35d, /*0xb8-0xbf*/ 0xd35e, 0xbcfb, 0xb9db, 0xd35f, 0xb9e6, 0xc3d9, 0xcad3, 0xeae8, /*0xc0-0xc7*/ 0xc0c0, 0xbef5, 0xeae9, 0xeaea, 0xeaeb, 0xd360, 0xeaec, 0xeaed, /*0xc8-0xcf*/ 0xeaee, 0xeaef, 0xbdc7, 0xd361, 0xd362, 0xd363, 0xf5fb, 0xd364, /*0xd0-0xd7*/ 0xd365, 0xd366, 0xf5fd, 0xd367, 0xf5fe, 0xd368, 0xf5fc, 0xd369, /*0xd8-0xdf*/ 0xd36a, 0xd36b, 0xd36c, 0xbde2, 0xd36d, 0xf6a1, 0xb4a5, 0xd36e, /*0xe0-0xe7*/ 0xd36f, 0xd370, 0xd371, 0xf6a2, 0xd372, 0xd373, 0xd374, 0xf6a3, /*0xe8-0xef*/ 0xd375, 0xd376, 0xd377, 0xecb2, 0xd378, 0xd379, 0xd37a, 0xd37b, /*0xf0-0xf7*/ 0xd37c, 0xd37d, 0xd37e, 0xd380, 0xd381, 0xd382, 0xd383, 0xd384, /*0xf8-0xff*/ /* 0x8a00 */ 0xd1d4, 0xd385, 0xd386, 0xd387, 0xd388, 0xd389, 0xd38a, 0xd9ea, /*0x00-0x07*/ 0xd38b, 0xd38c, 0xd38d, 0xd38e, 0xd38f, 0xd390, 0xd391, 0xd392, /*0x08-0x0f*/ 0xd393, 0xd394, 0xd395, 0xd396, 0xd397, 0xd398, 0xd399, 0xd39a, /*0x10-0x17*/ 0xd39b, 0xd39c, 0xd39d, 0xd39e, 0xd39f, 0xd3a0, 0xd440, 0xd441, /*0x18-0x1f*/ 0xd442, 0xd443, 0xd444, 0xd445, 0xd446, 0xd447, 0xd448, 0xd449, /*0x20-0x27*/ 0xd44a, 0xd44b, 0xd44c, 0xd44d, 0xd44e, 0xd44f, 0xd450, 0xd451, /*0x28-0x2f*/ 0xd452, 0xd453, 0xd454, 0xd455, 0xd456, 0xd457, 0xd458, 0xd459, /*0x30-0x37*/ 0xd45a, 0xd45b, 0xd45c, 0xd45d, 0xd45e, 0xd45f, 0xf6a4, 0xd460, /*0x38-0x3f*/ 0xd461, 0xd462, 0xd463, 0xd464, 0xd465, 0xd466, 0xd467, 0xd468, /*0x40-0x47*/ 0xeeba, 0xd469, 0xd46a, 0xd46b, 0xd46c, 0xd46d, 0xd46e, 0xd46f, /*0x48-0x4f*/ 0xd470, 0xd471, 0xd472, 0xd473, 0xd474, 0xd475, 0xd476, 0xd477, /*0x50-0x57*/ 0xd478, 0xd479, 0xd47a, 0xd47b, 0xd47c, 0xd47d, 0xd47e, 0xd480, /*0x58-0x5f*/ 0xd481, 0xd482, 0xd483, 0xd484, 0xd485, 0xd486, 0xd487, 0xd488, /*0x60-0x67*/ 0xd489, 0xd48a, 0xd48b, 0xd48c, 0xd48d, 0xd48e, 0xd48f, 0xd490, /*0x68-0x6f*/ 0xd491, 0xd492, 0xd493, 0xd494, 0xd495, 0xd496, 0xd497, 0xd498, /*0x70-0x77*/ 0xd499, 0xd5b2, 0xd49a, 0xd49b, 0xd49c, 0xd49d, 0xd49e, 0xd49f, /*0x78-0x7f*/ 0xd4a0, 0xd540, 0xd541, 0xd542, 0xd543, 0xd544, 0xd545, 0xd546, /*0x80-0x87*/ 0xd547, 0xd3fe, 0xccdc, 0xd548, 0xd549, 0xd54a, 0xd54b, 0xd54c, /*0x88-0x8f*/ 0xd54d, 0xd54e, 0xd54f, 0xcac4, 0xd550, 0xd551, 0xd552, 0xd553, /*0x90-0x97*/ 0xd554, 0xd555, 0xd556, 0xd557, 0xd558, 0xd559, 0xd55a, 0xd55b, /*0x98-0x9f*/ 0xd55c, 0xd55d, 0xd55e, 0xd55f, 0xd560, 0xd561, 0xd562, 0xd563, /*0xa0-0xa7*/ 0xd564, 0xd565, 0xd566, 0xd567, 0xd568, 0xd569, 0xd56a, 0xd56b, /*0xa8-0xaf*/ 0xd56c, 0xd56d, 0xd56e, 0xd56f, 0xd570, 0xd571, 0xd572, 0xd573, /*0xb0-0xb7*/ 0xd574, 0xd575, 0xd576, 0xd577, 0xd578, 0xd579, 0xd57a, 0xd57b, /*0xb8-0xbf*/ 0xd57c, 0xd57d, 0xd57e, 0xd580, 0xd581, 0xd582, 0xd583, 0xd584, /*0xc0-0xc7*/ 0xd585, 0xd586, 0xd587, 0xd588, 0xd589, 0xd58a, 0xd58b, 0xd58c, /*0xc8-0xcf*/ 0xd58d, 0xd58e, 0xd58f, 0xd590, 0xd591, 0xd592, 0xd593, 0xd594, /*0xd0-0xd7*/ 0xd595, 0xd596, 0xd597, 0xd598, 0xd599, 0xd59a, 0xd59b, 0xd59c, /*0xd8-0xdf*/ 0xd59d, 0xd59e, 0xd59f, 0xd5a0, 0xd640, 0xd641, 0xd642, 0xd643, /*0xe0-0xe7*/ 0xd644, 0xd645, 0xd646, 0xd647, 0xd648, 0xd649, 0xd64a, 0xd64b, /*0xe8-0xef*/ 0xd64c, 0xd64d, 0xd64e, 0xd64f, 0xd650, 0xd651, 0xd652, 0xd653, /*0xf0-0xf7*/ 0xd654, 0xd655, 0xd656, 0xd657, 0xd658, 0xd659, 0xd65a, 0xd65b, /*0xf8-0xff*/ /* 0x8b00 */ 0xd65c, 0xd65d, 0xd65e, 0xd65f, 0xd660, 0xd661, 0xd662, 0xe5c0, /*0x00-0x07*/ 0xd663, 0xd664, 0xd665, 0xd666, 0xd667, 0xd668, 0xd669, 0xd66a, /*0x08-0x0f*/ 0xd66b, 0xd66c, 0xd66d, 0xd66e, 0xd66f, 0xd670, 0xd671, 0xd672, /*0x10-0x17*/ 0xd673, 0xd674, 0xd675, 0xd676, 0xd677, 0xd678, 0xd679, 0xd67a, /*0x18-0x1f*/ 0xd67b, 0xd67c, 0xd67d, 0xd67e, 0xd680, 0xd681, 0xf6a5, 0xd682, /*0x20-0x27*/ 0xd683, 0xd684, 0xd685, 0xd686, 0xd687, 0xd688, 0xd689, 0xd68a, /*0x28-0x2f*/ 0xd68b, 0xd68c, 0xd68d, 0xd68e, 0xd68f, 0xd690, 0xd691, 0xd692, /*0x30-0x37*/ 0xd693, 0xd694, 0xd695, 0xd696, 0xd697, 0xd698, 0xd699, 0xd69a, /*0x38-0x3f*/ 0xd69b, 0xd69c, 0xd69d, 0xd69e, 0xd69f, 0xd6a0, 0xd740, 0xd741, /*0x40-0x47*/ 0xd742, 0xd743, 0xd744, 0xd745, 0xd746, 0xd747, 0xd748, 0xd749, /*0x48-0x4f*/ 0xd74a, 0xd74b, 0xd74c, 0xd74d, 0xd74e, 0xd74f, 0xd750, 0xd751, /*0x50-0x57*/ 0xd752, 0xd753, 0xd754, 0xd755, 0xd756, 0xd757, 0xd758, 0xd759, /*0x58-0x5f*/ 0xd75a, 0xd75b, 0xd75c, 0xd75d, 0xd75e, 0xd75f, 0xbeaf, 0xd760, /*0x60-0x67*/ 0xd761, 0xd762, 0xd763, 0xd764, 0xc6a9, 0xd765, 0xd766, 0xd767, /*0x68-0x6f*/ 0xd768, 0xd769, 0xd76a, 0xd76b, 0xd76c, 0xd76d, 0xd76e, 0xd76f, /*0x70-0x77*/ 0xd770, 0xd771, 0xd772, 0xd773, 0xd774, 0xd775, 0xd776, 0xd777, /*0x78-0x7f*/ 0xd778, 0xd779, 0xd77a, 0xd77b, 0xd77c, 0xd77d, 0xd77e, 0xd780, /*0x80-0x87*/ 0xd781, 0xd782, 0xd783, 0xd784, 0xd785, 0xd786, 0xd787, 0xd788, /*0x88-0x8f*/ 0xd789, 0xd78a, 0xd78b, 0xd78c, 0xd78d, 0xd78e, 0xd78f, 0xd790, /*0x90-0x97*/ 0xd791, 0xd792, 0xd793, 0xd794, 0xd795, 0xd796, 0xd797, 0xd798, /*0x98-0x9f*/ 0xdaa5, 0xbcc6, 0xb6a9, 0xb8bc, 0xc8cf, 0xbca5, 0xdaa6, 0xdaa7, /*0xa0-0xa7*/ 0xccd6, 0xc8c3, 0xdaa8, 0xc6fd, 0xd799, 0xd1b5, 0xd2e9, 0xd1b6, /*0xa8-0xaf*/ 0xbcc7, 0xd79a, 0xbdb2, 0xbbe4, 0xdaa9, 0xdaaa, 0xd1c8, 0xdaab, /*0xb0-0xb7*/ 0xd0ed, 0xb6ef, 0xc2db, 0xd79b, 0xcbcf, 0xb7ed, 0xc9e8, 0xb7c3, /*0xb8-0xbf*/ 0xbef7, 0xd6a4, 0xdaac, 0xdaad, 0xc6c0, 0xd7e7, 0xcab6, 0xd79c, /*0xc0-0xc7*/ 0xd5a9, 0xcbdf, 0xd5ef, 0xdaae, 0xd6df, 0xb4ca, 0xdab0, 0xdaaf, /*0xc8-0xcf*/ 0xd79d, 0xd2eb, 0xdab1, 0xdab2, 0xdab3, 0xcad4, 0xdab4, 0xcaab, /*0xd0-0xd7*/ 0xdab5, 0xdab6, 0xb3cf, 0xd6ef, 0xdab7, 0xbbb0, 0xb5ae, 0xdab8, /*0xd8-0xdf*/ 0xdab9, 0xb9ee, 0xd1af, 0xd2e8, 0xdaba, 0xb8c3, 0xcfea, 0xb2ef, /*0xe0-0xe7*/ 0xdabb, 0xdabc, 0xd79e, 0xbdeb, 0xcedc, 0xd3ef, 0xdabd, 0xcef3, /*0xe8-0xef*/ 0xdabe, 0xd3d5, 0xbbe5, 0xdabf, 0xcbb5, 0xcbd0, 0xdac0, 0xc7eb, /*0xf0-0xf7*/ 0xd6ee, 0xdac1, 0xc5b5, 0xb6c1, 0xdac2, 0xb7cc, 0xbfce, 0xdac3, /*0xf8-0xff*/ /* 0x8c00 */ 0xdac4, 0xcbad, 0xdac5, 0xb5f7, 0xdac6, 0xc1c2, 0xd7bb, 0xdac7, /*0x00-0x07*/ 0xccb8, 0xd79f, 0xd2ea, 0xc4b1, 0xdac8, 0xb5fd, 0xbbd1, 0xdac9, /*0x08-0x0f*/ 0xd0b3, 0xdaca, 0xdacb, 0xcebd, 0xdacc, 0xdacd, 0xdace, 0xb2f7, /*0x10-0x17*/ 0xdad1, 0xdacf, 0xd1e8, 0xdad0, 0xc3d5, 0xdad2, 0xd7a0, 0xdad3, /*0x18-0x1f*/ 0xdad4, 0xdad5, 0xd0bb, 0xd2a5, 0xb0f9, 0xdad6, 0xc7ab, 0xdad7, /*0x20-0x27*/ 0xbdf7, 0xc3a1, 0xdad8, 0xdad9, 0xc3fd, 0xccb7, 0xdada, 0xdadb, /*0x28-0x2f*/ 0xc0be, 0xc6d7, 0xdadc, 0xdadd, 0xc7b4, 0xdade, 0xdadf, 0xb9c8, /*0x30-0x37*/ 0xd840, 0xd841, 0xd842, 0xd843, 0xd844, 0xd845, 0xd846, 0xd847, /*0x38-0x3f*/ 0xd848, 0xbbed, 0xd849, 0xd84a, 0xd84b, 0xd84c, 0xb6b9, 0xf4f8, /*0x40-0x47*/ 0xd84d, 0xf4f9, 0xd84e, 0xd84f, 0xcde3, 0xd850, 0xd851, 0xd852, /*0x48-0x4f*/ 0xd853, 0xd854, 0xd855, 0xd856, 0xd857, 0xf5b9, 0xd858, 0xd859, /*0x50-0x57*/ 0xd85a, 0xd85b, 0xebe0, 0xd85c, 0xd85d, 0xd85e, 0xd85f, 0xd860, /*0x58-0x5f*/ 0xd861, 0xcff3, 0xbbbf, 0xd862, 0xd863, 0xd864, 0xd865, 0xd866, /*0x60-0x67*/ 0xd867, 0xd868, 0xbac0, 0xd4a5, 0xd869, 0xd86a, 0xd86b, 0xd86c, /*0x68-0x6f*/ 0xd86d, 0xd86e, 0xd86f, 0xe1d9, 0xd870, 0xd871, 0xd872, 0xd873, /*0x70-0x77*/ 0xf5f4, 0xb1aa, 0xb2f2, 0xd874, 0xd875, 0xd876, 0xd877, 0xd878, /*0x78-0x7f*/ 0xd879, 0xd87a, 0xf5f5, 0xd87b, 0xd87c, 0xf5f7, 0xd87d, 0xd87e, /*0x80-0x87*/ 0xd880, 0xbad1, 0xf5f6, 0xd881, 0xc3b2, 0xd882, 0xd883, 0xd884, /*0x88-0x8f*/ 0xd885, 0xd886, 0xd887, 0xd888, 0xf5f9, 0xd889, 0xd88a, 0xd88b, /*0x90-0x97*/ 0xf5f8, 0xd88c, 0xd88d, 0xd88e, 0xd88f, 0xd890, 0xd891, 0xd892, /*0x98-0x9f*/ 0xd893, 0xd894, 0xd895, 0xd896, 0xd897, 0xd898, 0xd899, 0xd89a, /*0xa0-0xa7*/ 0xd89b, 0xd89c, 0xd89d, 0xd89e, 0xd89f, 0xd8a0, 0xd940, 0xd941, /*0xa8-0xaf*/ 0xd942, 0xd943, 0xd944, 0xd945, 0xd946, 0xd947, 0xd948, 0xd949, /*0xb0-0xb7*/ 0xd94a, 0xd94b, 0xd94c, 0xd94d, 0xd94e, 0xd94f, 0xd950, 0xd951, /*0xb8-0xbf*/ 0xd952, 0xd953, 0xd954, 0xd955, 0xd956, 0xd957, 0xd958, 0xd959, /*0xc0-0xc7*/ 0xd95a, 0xd95b, 0xd95c, 0xd95d, 0xd95e, 0xd95f, 0xd960, 0xd961, /*0xc8-0xcf*/ 0xd962, 0xd963, 0xd964, 0xd965, 0xd966, 0xd967, 0xd968, 0xd969, /*0xd0-0xd7*/ 0xd96a, 0xd96b, 0xd96c, 0xd96d, 0xd96e, 0xd96f, 0xd970, 0xd971, /*0xd8-0xdf*/ 0xd972, 0xd973, 0xd974, 0xd975, 0xd976, 0xd977, 0xd978, 0xd979, /*0xe0-0xe7*/ 0xd97a, 0xd97b, 0xd97c, 0xd97d, 0xd97e, 0xd980, 0xd981, 0xd982, /*0xe8-0xef*/ 0xd983, 0xd984, 0xd985, 0xd986, 0xd987, 0xd988, 0xd989, 0xd98a, /*0xf0-0xf7*/ 0xd98b, 0xd98c, 0xd98d, 0xd98e, 0xd98f, 0xd990, 0xd991, 0xd992, /*0xf8-0xff*/ /* 0x8d00 */ 0xd993, 0xd994, 0xd995, 0xd996, 0xd997, 0xd998, 0xd999, 0xd99a, /*0x00-0x07*/ 0xd99b, 0xd99c, 0xd99d, 0xd99e, 0xd99f, 0xd9a0, 0xda40, 0xda41, /*0x08-0x0f*/ 0xda42, 0xda43, 0xda44, 0xda45, 0xda46, 0xda47, 0xda48, 0xda49, /*0x10-0x17*/ 0xda4a, 0xda4b, 0xda4c, 0xda4d, 0xda4e, 0xb1b4, 0xd5ea, 0xb8ba, /*0x18-0x1f*/ 0xda4f, 0xb9b1, 0xb2c6, 0xd4f0, 0xcfcd, 0xb0dc, 0xd5cb, 0xbbf5, /*0x20-0x27*/ 0xd6ca, 0xb7b7, 0xccb0, 0xc6b6, 0xb1e1, 0xb9ba, 0xd6fc, 0xb9e1, /*0x28-0x2f*/ 0xb7a1, 0xbcfa, 0xeada, 0xeadb, 0xccf9, 0xb9f3, 0xeadc, 0xb4fb, /*0x30-0x37*/ 0xc3b3, 0xb7d1, 0xbad8, 0xeadd, 0xd4f4, 0xeade, 0xbcd6, 0xbbdf, /*0x38-0x3f*/ 0xeadf, 0xc1de, 0xc2b8, 0xd4df, 0xd7ca, 0xeae0, 0xeae1, 0xeae4, /*0x40-0x47*/ 0xeae2, 0xeae3, 0xc9de, 0xb8b3, 0xb6c4, 0xeae5, 0xcaea, 0xc9cd, /*0x48-0x4f*/ 0xb4cd, 0xda50, 0xda51, 0xe2d9, 0xc5e2, 0xeae6, 0xc0b5, 0xda52, /*0x50-0x57*/ 0xd7b8, 0xeae7, 0xd7ac, 0xc8fc, 0xd8d3, 0xd8cd, 0xd4de, 0xda53, /*0x58-0x5f*/ 0xd4f9, 0xc9c4, 0xd3ae, 0xb8d3, 0xb3e0, 0xda54, 0xc9e2, 0xf4f6, /*0x60-0x67*/ 0xda55, 0xda56, 0xda57, 0xbad5, 0xda58, 0xf4f7, 0xda59, 0xda5a, /*0x68-0x6f*/ 0xd7df, 0xda5b, 0xda5c, 0xf4f1, 0xb8b0, 0xd5d4, 0xb8cf, 0xc6f0, /*0x70-0x77*/ 0xda5d, 0xda5e, 0xda5f, 0xda60, 0xda61, 0xda62, 0xda63, 0xda64, /*0x78-0x7f*/ 0xda65, 0xb3c3, 0xda66, 0xda67, 0xf4f2, 0xb3ac, 0xda68, 0xda69, /*0x80-0x87*/ 0xda6a, 0xda6b, 0xd4bd, 0xc7f7, 0xda6c, 0xda6d, 0xda6e, 0xda6f, /*0x88-0x8f*/ 0xda70, 0xf4f4, 0xda71, 0xda72, 0xf4f3, 0xda73, 0xda74, 0xda75, /*0x90-0x97*/ 0xda76, 0xda77, 0xda78, 0xda79, 0xda7a, 0xda7b, 0xda7c, 0xcccb, /*0x98-0x9f*/ 0xda7d, 0xda7e, 0xda80, 0xc8a4, 0xda81, 0xda82, 0xda83, 0xda84, /*0xa0-0xa7*/ 0xda85, 0xda86, 0xda87, 0xda88, 0xda89, 0xda8a, 0xda8b, 0xda8c, /*0xa8-0xaf*/ 0xda8d, 0xf4f5, 0xda8e, 0xd7e3, 0xc5bf, 0xf5c0, 0xda8f, 0xda90, /*0xb0-0xb7*/ 0xf5bb, 0xda91, 0xf5c3, 0xda92, 0xf5c2, 0xda93, 0xd6ba, 0xf5c1, /*0xb8-0xbf*/ 0xda94, 0xda95, 0xda96, 0xd4be, 0xf5c4, 0xda97, 0xf5cc, 0xda98, /*0xc0-0xc7*/ 0xda99, 0xda9a, 0xda9b, 0xb0cf, 0xb5f8, 0xda9c, 0xf5c9, 0xf5ca, /*0xc8-0xcf*/ 0xda9d, 0xc5dc, 0xda9e, 0xda9f, 0xdaa0, 0xdb40, 0xf5c5, 0xf5c6, /*0xd0-0xd7*/ 0xdb41, 0xdb42, 0xf5c7, 0xf5cb, 0xdb43, 0xbee0, 0xf5c8, 0xb8fa, /*0xd8-0xdf*/ 0xdb44, 0xdb45, 0xdb46, 0xf5d0, 0xf5d3, 0xdb47, 0xdb48, 0xdb49, /*0xe0-0xe7*/ 0xbfe7, 0xdb4a, 0xb9f2, 0xf5bc, 0xf5cd, 0xdb4b, 0xdb4c, 0xc2b7, /*0xe8-0xef*/ 0xdb4d, 0xdb4e, 0xdb4f, 0xccf8, 0xdb50, 0xbcf9, 0xdb51, 0xf5ce, /*0xf0-0xf7*/ 0xf5cf, 0xf5d1, 0xb6e5, 0xf5d2, 0xdb52, 0xf5d5, 0xdb53, 0xdb54, /*0xf8-0xff*/ /* 0x8e00 */ 0xdb55, 0xdb56, 0xdb57, 0xdb58, 0xdb59, 0xf5bd, 0xdb5a, 0xdb5b, /*0x00-0x07*/ 0xdb5c, 0xf5d4, 0xd3bb, 0xdb5d, 0xb3ec, 0xdb5e, 0xdb5f, 0xcca4, /*0x08-0x0f*/ 0xdb60, 0xdb61, 0xdb62, 0xdb63, 0xf5d6, 0xdb64, 0xdb65, 0xdb66, /*0x10-0x17*/ 0xdb67, 0xdb68, 0xdb69, 0xdb6a, 0xdb6b, 0xf5d7, 0xbee1, 0xf5d8, /*0x18-0x1f*/ 0xdb6c, 0xdb6d, 0xccdf, 0xf5db, 0xdb6e, 0xdb6f, 0xdb70, 0xdb71, /*0x20-0x27*/ 0xdb72, 0xb2c8, 0xd7d9, 0xdb73, 0xf5d9, 0xdb74, 0xf5da, 0xf5dc, /*0x28-0x2f*/ 0xdb75, 0xf5e2, 0xdb76, 0xdb77, 0xdb78, 0xf5e0, 0xdb79, 0xdb7a, /*0x30-0x37*/ 0xdb7b, 0xf5df, 0xf5dd, 0xdb7c, 0xdb7d, 0xf5e1, 0xdb7e, 0xdb80, /*0x38-0x3f*/ 0xf5de, 0xf5e4, 0xf5e5, 0xdb81, 0xcce3, 0xdb82, 0xdb83, 0xe5bf, /*0x40-0x47*/ 0xb5b8, 0xf5e3, 0xf5e8, 0xcca3, 0xdb84, 0xdb85, 0xdb86, 0xdb87, /*0x48-0x4f*/ 0xdb88, 0xf5e6, 0xf5e7, 0xdb89, 0xdb8a, 0xdb8b, 0xdb8c, 0xdb8d, /*0x50-0x57*/ 0xdb8e, 0xf5be, 0xdb8f, 0xdb90, 0xdb91, 0xdb92, 0xdb93, 0xdb94, /*0x58-0x5f*/ 0xdb95, 0xdb96, 0xdb97, 0xdb98, 0xdb99, 0xdb9a, 0xb1c4, 0xdb9b, /*0x60-0x67*/ 0xdb9c, 0xf5bf, 0xdb9d, 0xdb9e, 0xb5c5, 0xb2e4, 0xdb9f, 0xf5ec, /*0x68-0x6f*/ 0xf5e9, 0xdba0, 0xb6d7, 0xdc40, 0xf5ed, 0xdc41, 0xf5ea, 0xdc42, /*0x70-0x77*/ 0xdc43, 0xdc44, 0xdc45, 0xdc46, 0xf5eb, 0xdc47, 0xdc48, 0xb4da, /*0x78-0x7f*/ 0xdc49, 0xd4ea, 0xdc4a, 0xdc4b, 0xdc4c, 0xf5ee, 0xdc4d, 0xb3f9, /*0x80-0x87*/ 0xdc4e, 0xdc4f, 0xdc50, 0xdc51, 0xdc52, 0xdc53, 0xdc54, 0xf5ef, /*0x88-0x8f*/ 0xf5f1, 0xdc55, 0xdc56, 0xdc57, 0xf5f0, 0xdc58, 0xdc59, 0xdc5a, /*0x90-0x97*/ 0xdc5b, 0xdc5c, 0xdc5d, 0xdc5e, 0xf5f2, 0xdc5f, 0xf5f3, 0xdc60, /*0x98-0x9f*/ 0xdc61, 0xdc62, 0xdc63, 0xdc64, 0xdc65, 0xdc66, 0xdc67, 0xdc68, /*0xa0-0xa7*/ 0xdc69, 0xdc6a, 0xdc6b, 0xc9ed, 0xb9aa, 0xdc6c, 0xdc6d, 0xc7fb, /*0xa8-0xaf*/ 0xdc6e, 0xdc6f, 0xb6e3, 0xdc70, 0xdc71, 0xdc72, 0xdc73, 0xdc74, /*0xb0-0xb7*/ 0xdc75, 0xdc76, 0xccc9, 0xdc77, 0xdc78, 0xdc79, 0xdc7a, 0xdc7b, /*0xb8-0xbf*/ 0xdc7c, 0xdc7d, 0xdc7e, 0xdc80, 0xdc81, 0xdc82, 0xdc83, 0xdc84, /*0xc0-0xc7*/ 0xdc85, 0xdc86, 0xdc87, 0xdc88, 0xdc89, 0xdc8a, 0xeaa6, 0xdc8b, /*0xc8-0xcf*/ 0xdc8c, 0xdc8d, 0xdc8e, 0xdc8f, 0xdc90, 0xdc91, 0xdc92, 0xdc93, /*0xd0-0xd7*/ 0xdc94, 0xdc95, 0xdc96, 0xdc97, 0xdc98, 0xdc99, 0xdc9a, 0xdc9b, /*0xd8-0xdf*/ 0xdc9c, 0xdc9d, 0xdc9e, 0xdc9f, 0xdca0, 0xdd40, 0xdd41, 0xdd42, /*0xe0-0xe7*/ 0xdd43, 0xdd44, 0xdd45, 0xdd46, 0xdd47, 0xdd48, 0xdd49, 0xdd4a, /*0xe8-0xef*/ 0xdd4b, 0xdd4c, 0xdd4d, 0xdd4e, 0xdd4f, 0xdd50, 0xdd51, 0xdd52, /*0xf0-0xf7*/ 0xdd53, 0xdd54, 0xdd55, 0xdd56, 0xdd57, 0xdd58, 0xdd59, 0xdd5a, /*0xf8-0xff*/ /* 0x8f00 */ 0xdd5b, 0xdd5c, 0xdd5d, 0xdd5e, 0xdd5f, 0xdd60, 0xdd61, 0xdd62, /*0x00-0x07*/ 0xdd63, 0xdd64, 0xdd65, 0xdd66, 0xdd67, 0xdd68, 0xdd69, 0xdd6a, /*0x08-0x0f*/ 0xdd6b, 0xdd6c, 0xdd6d, 0xdd6e, 0xdd6f, 0xdd70, 0xdd71, 0xdd72, /*0x10-0x17*/ 0xdd73, 0xdd74, 0xdd75, 0xdd76, 0xdd77, 0xdd78, 0xdd79, 0xdd7a, /*0x18-0x1f*/ 0xdd7b, 0xdd7c, 0xdd7d, 0xdd7e, 0xdd80, 0xdd81, 0xdd82, 0xdd83, /*0x20-0x27*/ 0xdd84, 0xdd85, 0xdd86, 0xdd87, 0xdd88, 0xdd89, 0xdd8a, 0xdd8b, /*0x28-0x2f*/ 0xdd8c, 0xdd8d, 0xdd8e, 0xdd8f, 0xdd90, 0xdd91, 0xdd92, 0xdd93, /*0x30-0x37*/ 0xdd94, 0xdd95, 0xdd96, 0xdd97, 0xdd98, 0xdd99, 0xdd9a, 0xdd9b, /*0x38-0x3f*/ 0xdd9c, 0xdd9d, 0xdd9e, 0xdd9f, 0xdda0, 0xde40, 0xde41, 0xde42, /*0x40-0x47*/ 0xde43, 0xde44, 0xde45, 0xde46, 0xde47, 0xde48, 0xde49, 0xde4a, /*0x48-0x4f*/ 0xde4b, 0xde4c, 0xde4d, 0xde4e, 0xde4f, 0xde50, 0xde51, 0xde52, /*0x50-0x57*/ 0xde53, 0xde54, 0xde55, 0xde56, 0xde57, 0xde58, 0xde59, 0xde5a, /*0x58-0x5f*/ 0xde5b, 0xde5c, 0xde5d, 0xde5e, 0xde5f, 0xde60, 0xb3b5, 0xd4fe, /*0x60-0x67*/ 0xb9ec, 0xd0f9, 0xde61, 0xe9ed, 0xd7aa, 0xe9ee, 0xc2d6, 0xc8ed, /*0x68-0x6f*/ 0xbae4, 0xe9ef, 0xe9f0, 0xe9f1, 0xd6e1, 0xe9f2, 0xe9f3, 0xe9f5, /*0x70-0x77*/ 0xe9f4, 0xe9f6, 0xe9f7, 0xc7e1, 0xe9f8, 0xd4d8, 0xe9f9, 0xbdce, /*0x78-0x7f*/ 0xde62, 0xe9fa, 0xe9fb, 0xbdcf, 0xe9fc, 0xb8a8, 0xc1be, 0xe9fd, /*0x80-0x87*/ 0xb1b2, 0xbbd4, 0xb9f5, 0xe9fe, 0xde63, 0xeaa1, 0xeaa2, 0xeaa3, /*0x88-0x8f*/ 0xb7f8, 0xbcad, 0xde64, 0xcae4, 0xe0ce, 0xd4af, 0xcfbd, 0xd5b7, /*0x90-0x97*/ 0xeaa4, 0xd5de, 0xeaa5, 0xd0c1, 0xb9bc, 0xde65, 0xb4c7, 0xb1d9, /*0x98-0x9f*/ 0xde66, 0xde67, 0xde68, 0xc0b1, 0xde69, 0xde6a, 0xde6b, 0xde6c, /*0xa0-0xa7*/ 0xb1e6, 0xb1e7, 0xde6d, 0xb1e8, 0xde6e, 0xde6f, 0xde70, 0xde71, /*0xa8-0xaf*/ 0xb3bd, 0xc8e8, 0xde72, 0xde73, 0xde74, 0xde75, 0xe5c1, 0xde76, /*0xb0-0xb7*/ 0xde77, 0xb1df, 0xde78, 0xde79, 0xde7a, 0xc1c9, 0xb4ef, 0xde7b, /*0xb8-0xbf*/ 0xde7c, 0xc7a8, 0xd3d8, 0xde7d, 0xc6f9, 0xd1b8, 0xde7e, 0xb9fd, /*0xc0-0xc7*/ 0xc2f5, 0xde80, 0xde81, 0xde82, 0xde83, 0xde84, 0xd3ad, 0xde85, /*0xc8-0xcf*/ 0xd4cb, 0xbdfc, 0xde86, 0xe5c2, 0xb7b5, 0xe5c3, 0xde87, 0xde88, /*0xd0-0xd7*/ 0xbbb9, 0xd5e2, 0xde89, 0xbdf8, 0xd4b6, 0xcea5, 0xc1ac, 0xb3d9, /*0xd8-0xdf*/ 0xde8a, 0xde8b, 0xccf6, 0xde8c, 0xe5c6, 0xe5c4, 0xe5c8, 0xde8d, /*0xe0-0xe7*/ 0xe5ca, 0xe5c7, 0xb5cf, 0xc6c8, 0xde8e, 0xb5fc, 0xe5c5, 0xde8f, /*0xe8-0xef*/ 0xcaf6, 0xde90, 0xde91, 0xe5c9, 0xde92, 0xde93, 0xde94, 0xc3d4, /*0xf0-0xf7*/ 0xb1c5, 0xbca3, 0xde95, 0xde96, 0xde97, 0xd7b7, 0xde98, 0xde99, /*0xf8-0xff*/ /* 0x9000 */ 0xcdcb, 0xcbcd, 0xcaca, 0xccd3, 0xe5cc, 0xe5cb, 0xc4e6, 0xde9a, /*0x00-0x07*/ 0xde9b, 0xd1a1, 0xd1b7, 0xe5cd, 0xde9c, 0xe5d0, 0xde9d, 0xcdb8, /*0x08-0x0f*/ 0xd6f0, 0xe5cf, 0xb5dd, 0xde9e, 0xcdbe, 0xde9f, 0xe5d1, 0xb6ba, /*0x10-0x17*/ 0xdea0, 0xdf40, 0xcda8, 0xb9e4, 0xdf41, 0xcac5, 0xb3d1, 0xcbd9, /*0x18-0x1f*/ 0xd4ec, 0xe5d2, 0xb7ea, 0xdf42, 0xdf43, 0xdf44, 0xe5ce, 0xdf45, /*0x20-0x27*/ 0xdf46, 0xdf47, 0xdf48, 0xdf49, 0xdf4a, 0xe5d5, 0xb4fe, 0xe5d6, /*0x28-0x2f*/ 0xdf4b, 0xdf4c, 0xdf4d, 0xdf4e, 0xdf4f, 0xe5d3, 0xe5d4, 0xdf50, /*0x30-0x37*/ 0xd2dd, 0xdf51, 0xdf52, 0xc2df, 0xb1c6, 0xdf53, 0xd3e2, 0xdf54, /*0x38-0x3f*/ 0xdf55, 0xb6dd, 0xcbec, 0xdf56, 0xe5d7, 0xdf57, 0xdf58, 0xd3f6, /*0x40-0x47*/ 0xdf59, 0xdf5a, 0xdf5b, 0xdf5c, 0xdf5d, 0xb1e9, 0xdf5e, 0xb6f4, /*0x48-0x4f*/ 0xe5da, 0xe5d8, 0xe5d9, 0xb5c0, 0xdf5f, 0xdf60, 0xdf61, 0xd2c5, /*0x50-0x57*/ 0xe5dc, 0xdf62, 0xdf63, 0xe5de, 0xdf64, 0xdf65, 0xdf66, 0xdf67, /*0x58-0x5f*/ 0xdf68, 0xdf69, 0xe5dd, 0xc7b2, 0xdf6a, 0xd2a3, 0xdf6b, 0xdf6c, /*0x60-0x67*/ 0xe5db, 0xdf6d, 0xdf6e, 0xdf6f, 0xdf70, 0xd4e2, 0xd5da, 0xdf71, /*0x68-0x6f*/ 0xdf72, 0xdf73, 0xdf74, 0xdf75, 0xe5e0, 0xd7f1, 0xdf76, 0xdf77, /*0x70-0x77*/ 0xdf78, 0xdf79, 0xdf7a, 0xdf7b, 0xdf7c, 0xe5e1, 0xdf7d, 0xb1dc, /*0x78-0x7f*/ 0xd1fb, 0xdf7e, 0xe5e2, 0xe5e4, 0xdf80, 0xdf81, 0xdf82, 0xdf83, /*0x80-0x87*/ 0xe5e3, 0xdf84, 0xdf85, 0xe5e5, 0xdf86, 0xdf87, 0xdf88, 0xdf89, /*0x88-0x8f*/ 0xdf8a, 0xd2d8, 0xdf8b, 0xb5cb, 0xdf8c, 0xe7df, 0xdf8d, 0xdaf5, /*0x90-0x97*/ 0xdf8e, 0xdaf8, 0xdf8f, 0xdaf6, 0xdf90, 0xdaf7, 0xdf91, 0xdf92, /*0x98-0x9f*/ 0xdf93, 0xdafa, 0xd0cf, 0xc4c7, 0xdf94, 0xdf95, 0xb0ee, 0xdf96, /*0xa0-0xa7*/ 0xdf97, 0xdf98, 0xd0b0, 0xdf99, 0xdaf9, 0xdf9a, 0xd3ca, 0xbaaa, /*0xa8-0xaf*/ 0xdba2, 0xc7f1, 0xdf9b, 0xdafc, 0xdafb, 0xc9db, 0xdafd, 0xdf9c, /*0xb0-0xb7*/ 0xdba1, 0xd7de, 0xdafe, 0xc1da, 0xdf9d, 0xdf9e, 0xdba5, 0xdf9f, /*0xb8-0xbf*/ 0xdfa0, 0xd3f4, 0xe040, 0xe041, 0xdba7, 0xdba4, 0xe042, 0xdba8, /*0xc0-0xc7*/ 0xe043, 0xe044, 0xbdbc, 0xe045, 0xe046, 0xe047, 0xc0c9, 0xdba3, /*0xc8-0xcf*/ 0xdba6, 0xd6a3, 0xe048, 0xdba9, 0xe049, 0xe04a, 0xe04b, 0xdbad, /*0xd0-0xd7*/ 0xe04c, 0xe04d, 0xe04e, 0xdbae, 0xdbac, 0xbac2, 0xe04f, 0xe050, /*0xd8-0xdf*/ 0xe051, 0xbfa4, 0xdbab, 0xe052, 0xe053, 0xe054, 0xdbaa, 0xd4c7, /*0xe0-0xe7*/ 0xb2bf, 0xe055, 0xe056, 0xdbaf, 0xe057, 0xb9f9, 0xe058, 0xdbb0, /*0xe8-0xef*/ 0xe059, 0xe05a, 0xe05b, 0xe05c, 0xb3bb, 0xe05d, 0xe05e, 0xe05f, /*0xf0-0xf7*/ 0xb5a6, 0xe060, 0xe061, 0xe062, 0xe063, 0xb6bc, 0xdbb1, 0xe064, /*0xf8-0xff*/ /* 0x9100 */ 0xe065, 0xe066, 0xb6f5, 0xe067, 0xdbb2, 0xe068, 0xe069, 0xe06a, /*0x00-0x07*/ 0xe06b, 0xe06c, 0xe06d, 0xe06e, 0xe06f, 0xe070, 0xe071, 0xe072, /*0x08-0x0f*/ 0xe073, 0xe074, 0xe075, 0xe076, 0xe077, 0xe078, 0xe079, 0xe07a, /*0x10-0x17*/ 0xe07b, 0xb1c9, 0xe07c, 0xe07d, 0xe07e, 0xe080, 0xdbb4, 0xe081, /*0x18-0x1f*/ 0xe082, 0xe083, 0xdbb3, 0xdbb5, 0xe084, 0xe085, 0xe086, 0xe087, /*0x20-0x27*/ 0xe088, 0xe089, 0xe08a, 0xe08b, 0xe08c, 0xe08d, 0xe08e, 0xdbb7, /*0x28-0x2f*/ 0xe08f, 0xdbb6, 0xe090, 0xe091, 0xe092, 0xe093, 0xe094, 0xe095, /*0x30-0x37*/ 0xe096, 0xdbb8, 0xe097, 0xe098, 0xe099, 0xe09a, 0xe09b, 0xe09c, /*0x38-0x3f*/ 0xe09d, 0xe09e, 0xe09f, 0xdbb9, 0xe0a0, 0xe140, 0xdbba, 0xe141, /*0x40-0x47*/ 0xe142, 0xd3cf, 0xf4fa, 0xc7f5, 0xd7c3, 0xc5e4, 0xf4fc, 0xf4fd, /*0x48-0x4f*/ 0xf4fb, 0xe143, 0xbec6, 0xe144, 0xe145, 0xe146, 0xe147, 0xd0ef, /*0x50-0x57*/ 0xe148, 0xe149, 0xb7d3, 0xe14a, 0xe14b, 0xd4cd, 0xccaa, 0xe14c, /*0x58-0x5f*/ 0xe14d, 0xf5a2, 0xf5a1, 0xbaa8, 0xf4fe, 0xcbd6, 0xe14e, 0xe14f, /*0x60-0x67*/ 0xe150, 0xf5a4, 0xc0d2, 0xe151, 0xb3ea, 0xe152, 0xcdaa, 0xf5a5, /*0x68-0x6f*/ 0xf5a3, 0xbdb4, 0xf5a8, 0xe153, 0xf5a9, 0xbdcd, 0xc3b8, 0xbfe1, /*0x70-0x77*/ 0xcbe1, 0xf5aa, 0xe154, 0xe155, 0xe156, 0xf5a6, 0xf5a7, 0xc4f0, /*0x78-0x7f*/ 0xe157, 0xe158, 0xe159, 0xe15a, 0xe15b, 0xf5ac, 0xe15c, 0xb4bc, /*0x80-0x87*/ 0xe15d, 0xd7ed, 0xe15e, 0xb4d7, 0xf5ab, 0xf5ae, 0xe15f, 0xe160, /*0x88-0x8f*/ 0xf5ad, 0xf5af, 0xd0d1, 0xe161, 0xe162, 0xe163, 0xe164, 0xe165, /*0x90-0x97*/ 0xe166, 0xe167, 0xc3d1, 0xc8a9, 0xe168, 0xe169, 0xe16a, 0xe16b, /*0x98-0x9f*/ 0xe16c, 0xe16d, 0xf5b0, 0xf5b1, 0xe16e, 0xe16f, 0xe170, 0xe171, /*0xa0-0xa7*/ 0xe172, 0xe173, 0xf5b2, 0xe174, 0xe175, 0xf5b3, 0xf5b4, 0xf5b5, /*0xa8-0xaf*/ 0xe176, 0xe177, 0xe178, 0xe179, 0xf5b7, 0xf5b6, 0xe17a, 0xe17b, /*0xb0-0xb7*/ 0xe17c, 0xe17d, 0xf5b8, 0xe17e, 0xe180, 0xe181, 0xe182, 0xe183, /*0xb8-0xbf*/ 0xe184, 0xe185, 0xe186, 0xe187, 0xe188, 0xe189, 0xe18a, 0xb2c9, /*0xc0-0xc7*/ 0xe18b, 0xd3d4, 0xcacd, 0xe18c, 0xc0ef, 0xd6d8, 0xd2b0, 0xc1bf, /*0xc8-0xcf*/ 0xe18d, 0xbdf0, 0xe18e, 0xe18f, 0xe190, 0xe191, 0xe192, 0xe193, /*0xd0-0xd7*/ 0xe194, 0xe195, 0xe196, 0xe197, 0xb8aa, 0xe198, 0xe199, 0xe19a, /*0xd8-0xdf*/ 0xe19b, 0xe19c, 0xe19d, 0xe19e, 0xe19f, 0xe1a0, 0xe240, 0xe241, /*0xe0-0xe7*/ 0xe242, 0xe243, 0xe244, 0xe245, 0xe246, 0xe247, 0xe248, 0xe249, /*0xe8-0xef*/ 0xe24a, 0xe24b, 0xe24c, 0xe24d, 0xe24e, 0xe24f, 0xe250, 0xe251, /*0xf0-0xf7*/ 0xe252, 0xe253, 0xe254, 0xe255, 0xe256, 0xe257, 0xe258, 0xe259, /*0xf8-0xff*/ /* 0x9200 */ 0xe25a, 0xe25b, 0xe25c, 0xe25d, 0xe25e, 0xe25f, 0xe260, 0xe261, /*0x00-0x07*/ 0xe262, 0xe263, 0xe264, 0xe265, 0xe266, 0xe267, 0xe268, 0xe269, /*0x08-0x0f*/ 0xe26a, 0xe26b, 0xe26c, 0xe26d, 0xe26e, 0xe26f, 0xe270, 0xe271, /*0x10-0x17*/ 0xe272, 0xe273, 0xe274, 0xe275, 0xe276, 0xe277, 0xe278, 0xe279, /*0x18-0x1f*/ 0xe27a, 0xe27b, 0xe27c, 0xe27d, 0xe27e, 0xe280, 0xe281, 0xe282, /*0x20-0x27*/ 0xe283, 0xe284, 0xe285, 0xe286, 0xe287, 0xe288, 0xe289, 0xe28a, /*0x28-0x2f*/ 0xe28b, 0xe28c, 0xe28d, 0xe28e, 0xe28f, 0xe290, 0xe291, 0xe292, /*0x30-0x37*/ 0xe293, 0xe294, 0xe295, 0xe296, 0xe297, 0xe298, 0xe299, 0xe29a, /*0x38-0x3f*/ 0xe29b, 0xe29c, 0xe29d, 0xe29e, 0xe29f, 0xe2a0, 0xe340, 0xe341, /*0x40-0x47*/ 0xe342, 0xe343, 0xe344, 0xe345, 0xe346, 0xe347, 0xe348, 0xe349, /*0x48-0x4f*/ 0xe34a, 0xe34b, 0xe34c, 0xe34d, 0xe34e, 0xe34f, 0xe350, 0xe351, /*0x50-0x57*/ 0xe352, 0xe353, 0xe354, 0xe355, 0xe356, 0xe357, 0xe358, 0xe359, /*0x58-0x5f*/ 0xe35a, 0xe35b, 0xe35c, 0xe35d, 0xe35e, 0xe35f, 0xe360, 0xe361, /*0x60-0x67*/ 0xe362, 0xe363, 0xe364, 0xe365, 0xe366, 0xe367, 0xe368, 0xe369, /*0x68-0x6f*/ 0xe36a, 0xe36b, 0xe36c, 0xe36d, 0xbcf8, 0xe36e, 0xe36f, 0xe370, /*0x70-0x77*/ 0xe371, 0xe372, 0xe373, 0xe374, 0xe375, 0xe376, 0xe377, 0xe378, /*0x78-0x7f*/ 0xe379, 0xe37a, 0xe37b, 0xe37c, 0xe37d, 0xe37e, 0xe380, 0xe381, /*0x80-0x87*/ 0xe382, 0xe383, 0xe384, 0xe385, 0xe386, 0xe387, 0xf6c6, 0xe388, /*0x88-0x8f*/ 0xe389, 0xe38a, 0xe38b, 0xe38c, 0xe38d, 0xe38e, 0xe38f, 0xe390, /*0x90-0x97*/ 0xe391, 0xe392, 0xe393, 0xe394, 0xe395, 0xe396, 0xe397, 0xe398, /*0x98-0x9f*/ 0xe399, 0xe39a, 0xe39b, 0xe39c, 0xe39d, 0xe39e, 0xe39f, 0xe3a0, /*0xa0-0xa7*/ 0xe440, 0xe441, 0xe442, 0xe443, 0xe444, 0xe445, 0xf6c7, 0xe446, /*0xa8-0xaf*/ 0xe447, 0xe448, 0xe449, 0xe44a, 0xe44b, 0xe44c, 0xe44d, 0xe44e, /*0xb0-0xb7*/ 0xe44f, 0xe450, 0xe451, 0xe452, 0xe453, 0xe454, 0xe455, 0xe456, /*0xb8-0xbf*/ 0xe457, 0xe458, 0xe459, 0xe45a, 0xe45b, 0xe45c, 0xe45d, 0xe45e, /*0xc0-0xc7*/ 0xf6c8, 0xe45f, 0xe460, 0xe461, 0xe462, 0xe463, 0xe464, 0xe465, /*0xc8-0xcf*/ 0xe466, 0xe467, 0xe468, 0xe469, 0xe46a, 0xe46b, 0xe46c, 0xe46d, /*0xd0-0xd7*/ 0xe46e, 0xe46f, 0xe470, 0xe471, 0xe472, 0xe473, 0xe474, 0xe475, /*0xd8-0xdf*/ 0xe476, 0xe477, 0xe478, 0xe479, 0xe47a, 0xe47b, 0xe47c, 0xe47d, /*0xe0-0xe7*/ 0xe47e, 0xe480, 0xe481, 0xe482, 0xe483, 0xe484, 0xe485, 0xe486, /*0xe8-0xef*/ 0xe487, 0xe488, 0xe489, 0xe48a, 0xe48b, 0xe48c, 0xe48d, 0xe48e, /*0xf0-0xf7*/ 0xe48f, 0xe490, 0xe491, 0xe492, 0xe493, 0xe494, 0xe495, 0xe496, /*0xf8-0xff*/ /* 0x9300 */ 0xe497, 0xe498, 0xe499, 0xe49a, 0xe49b, 0xe49c, 0xe49d, 0xe49e, /*0x00-0x07*/ 0xe49f, 0xe4a0, 0xe540, 0xe541, 0xe542, 0xe543, 0xe544, 0xe545, /*0x08-0x0f*/ 0xe546, 0xe547, 0xe548, 0xe549, 0xe54a, 0xe54b, 0xe54c, 0xe54d, /*0x10-0x17*/ 0xe54e, 0xe54f, 0xe550, 0xe551, 0xe552, 0xe553, 0xe554, 0xe555, /*0x18-0x1f*/ 0xe556, 0xe557, 0xe558, 0xe559, 0xe55a, 0xe55b, 0xe55c, 0xe55d, /*0x20-0x27*/ 0xe55e, 0xe55f, 0xe560, 0xe561, 0xe562, 0xe563, 0xe564, 0xe565, /*0x28-0x2f*/ 0xe566, 0xe567, 0xe568, 0xe569, 0xe56a, 0xe56b, 0xe56c, 0xe56d, /*0x30-0x37*/ 0xe56e, 0xe56f, 0xe570, 0xe571, 0xe572, 0xe573, 0xf6c9, 0xe574, /*0x38-0x3f*/ 0xe575, 0xe576, 0xe577, 0xe578, 0xe579, 0xe57a, 0xe57b, 0xe57c, /*0x40-0x47*/ 0xe57d, 0xe57e, 0xe580, 0xe581, 0xe582, 0xe583, 0xe584, 0xe585, /*0x48-0x4f*/ 0xe586, 0xe587, 0xe588, 0xe589, 0xe58a, 0xe58b, 0xe58c, 0xe58d, /*0x50-0x57*/ 0xe58e, 0xe58f, 0xe590, 0xe591, 0xe592, 0xe593, 0xe594, 0xe595, /*0x58-0x5f*/ 0xe596, 0xe597, 0xe598, 0xe599, 0xe59a, 0xe59b, 0xe59c, 0xe59d, /*0x60-0x67*/ 0xe59e, 0xe59f, 0xf6ca, 0xe5a0, 0xe640, 0xe641, 0xe642, 0xe643, /*0x68-0x6f*/ 0xe644, 0xe645, 0xe646, 0xe647, 0xe648, 0xe649, 0xe64a, 0xe64b, /*0x70-0x77*/ 0xe64c, 0xe64d, 0xe64e, 0xe64f, 0xe650, 0xe651, 0xe652, 0xe653, /*0x78-0x7f*/ 0xe654, 0xe655, 0xe656, 0xe657, 0xe658, 0xe659, 0xe65a, 0xe65b, /*0x80-0x87*/ 0xe65c, 0xe65d, 0xe65e, 0xe65f, 0xe660, 0xe661, 0xe662, 0xf6cc, /*0x88-0x8f*/ 0xe663, 0xe664, 0xe665, 0xe666, 0xe667, 0xe668, 0xe669, 0xe66a, /*0x90-0x97*/ 0xe66b, 0xe66c, 0xe66d, 0xe66e, 0xe66f, 0xe670, 0xe671, 0xe672, /*0x98-0x9f*/ 0xe673, 0xe674, 0xe675, 0xe676, 0xe677, 0xe678, 0xe679, 0xe67a, /*0xa0-0xa7*/ 0xe67b, 0xe67c, 0xe67d, 0xe67e, 0xe680, 0xe681, 0xe682, 0xe683, /*0xa8-0xaf*/ 0xe684, 0xe685, 0xe686, 0xe687, 0xe688, 0xe689, 0xe68a, 0xe68b, /*0xb0-0xb7*/ 0xe68c, 0xe68d, 0xe68e, 0xe68f, 0xe690, 0xe691, 0xe692, 0xe693, /*0xb8-0xbf*/ 0xe694, 0xe695, 0xe696, 0xe697, 0xe698, 0xe699, 0xe69a, 0xe69b, /*0xc0-0xc7*/ 0xe69c, 0xe69d, 0xf6cb, 0xe69e, 0xe69f, 0xe6a0, 0xe740, 0xe741, /*0xc8-0xcf*/ 0xe742, 0xe743, 0xe744, 0xe745, 0xe746, 0xe747, 0xf7e9, 0xe748, /*0xd0-0xd7*/ 0xe749, 0xe74a, 0xe74b, 0xe74c, 0xe74d, 0xe74e, 0xe74f, 0xe750, /*0xd8-0xdf*/ 0xe751, 0xe752, 0xe753, 0xe754, 0xe755, 0xe756, 0xe757, 0xe758, /*0xe0-0xe7*/ 0xe759, 0xe75a, 0xe75b, 0xe75c, 0xe75d, 0xe75e, 0xe75f, 0xe760, /*0xe8-0xef*/ 0xe761, 0xe762, 0xe763, 0xe764, 0xe765, 0xe766, 0xe767, 0xe768, /*0xf0-0xf7*/ 0xe769, 0xe76a, 0xe76b, 0xe76c, 0xe76d, 0xe76e, 0xe76f, 0xe770, /*0xf8-0xff*/ /* 0x9400 */ 0xe771, 0xe772, 0xe773, 0xe774, 0xe775, 0xe776, 0xe777, 0xe778, /*0x00-0x07*/ 0xe779, 0xe77a, 0xe77b, 0xe77c, 0xe77d, 0xe77e, 0xe780, 0xe781, /*0x08-0x0f*/ 0xe782, 0xe783, 0xe784, 0xe785, 0xe786, 0xe787, 0xe788, 0xe789, /*0x10-0x17*/ 0xe78a, 0xe78b, 0xe78c, 0xe78d, 0xe78e, 0xe78f, 0xe790, 0xe791, /*0x18-0x1f*/ 0xe792, 0xe793, 0xe794, 0xe795, 0xe796, 0xe797, 0xe798, 0xe799, /*0x20-0x27*/ 0xe79a, 0xe79b, 0xe79c, 0xe79d, 0xe79e, 0xe79f, 0xe7a0, 0xe840, /*0x28-0x2f*/ 0xe841, 0xe842, 0xe843, 0xe844, 0xe845, 0xe846, 0xe847, 0xe848, /*0x30-0x37*/ 0xe849, 0xe84a, 0xe84b, 0xe84c, 0xe84d, 0xe84e, 0xf6cd, 0xe84f, /*0x38-0x3f*/ 0xe850, 0xe851, 0xe852, 0xe853, 0xe854, 0xe855, 0xe856, 0xe857, /*0x40-0x47*/ 0xe858, 0xe859, 0xe85a, 0xe85b, 0xe85c, 0xe85d, 0xe85e, 0xe85f, /*0x48-0x4f*/ 0xe860, 0xe861, 0xe862, 0xe863, 0xe864, 0xe865, 0xe866, 0xe867, /*0x50-0x57*/ 0xe868, 0xe869, 0xe86a, 0xe86b, 0xe86c, 0xe86d, 0xe86e, 0xe86f, /*0x58-0x5f*/ 0xe870, 0xe871, 0xe872, 0xe873, 0xe874, 0xe875, 0xe876, 0xe877, /*0x60-0x67*/ 0xe878, 0xe879, 0xe87a, 0xf6ce, 0xe87b, 0xe87c, 0xe87d, 0xe87e, /*0x68-0x6f*/ 0xe880, 0xe881, 0xe882, 0xe883, 0xe884, 0xe885, 0xe886, 0xe887, /*0x70-0x77*/ 0xe888, 0xe889, 0xe88a, 0xe88b, 0xe88c, 0xe88d, 0xe88e, 0xe88f, /*0x78-0x7f*/ 0xe890, 0xe891, 0xe892, 0xe893, 0xe894, 0xeec4, 0xeec5, 0xeec6, /*0x80-0x87*/ 0xd5eb, 0xb6a4, 0xeec8, 0xeec7, 0xeec9, 0xeeca, 0xc7a5, 0xeecb, /*0x88-0x8f*/ 0xeecc, 0xe895, 0xb7b0, 0xb5f6, 0xeecd, 0xeecf, 0xe896, 0xeece, /*0x90-0x97*/ 0xe897, 0xb8c6, 0xeed0, 0xeed1, 0xeed2, 0xb6db, 0xb3ae, 0xd6d3, /*0x98-0x9f*/ 0xc4c6, 0xb1b5, 0xb8d6, 0xeed3, 0xeed4, 0xd4bf, 0xc7d5, 0xbefb, /*0xa0-0xa7*/ 0xced9, 0xb9b3, 0xeed6, 0xeed5, 0xeed8, 0xeed7, 0xc5a5, 0xeed9, /*0xa8-0xaf*/ 0xeeda, 0xc7ae, 0xeedb, 0xc7af, 0xeedc, 0xb2a7, 0xeedd, 0xeede, /*0xb0-0xb7*/ 0xeedf, 0xeee0, 0xeee1, 0xd7ea, 0xeee2, 0xeee3, 0xbcd8, 0xeee4, /*0xb8-0xbf*/ 0xd3cb, 0xccfa, 0xb2ac, 0xc1e5, 0xeee5, 0xc7a6, 0xc3ad, 0xe898, /*0xc0-0xc7*/ 0xeee6, 0xeee7, 0xeee8, 0xeee9, 0xeeea, 0xeeeb, 0xeeec, 0xe899, /*0xc8-0xcf*/ 0xeeed, 0xeeee, 0xeeef, 0xe89a, 0xe89b, 0xeef0, 0xeef1, 0xeef2, /*0xd0-0xd7*/ 0xeef4, 0xeef3, 0xe89c, 0xeef5, 0xcdad, 0xc2c1, 0xeef6, 0xeef7, /*0xd8-0xdf*/ 0xeef8, 0xd5a1, 0xeef9, 0xcfb3, 0xeefa, 0xeefb, 0xe89d, 0xeefc, /*0xe0-0xe7*/ 0xeefd, 0xefa1, 0xeefe, 0xefa2, 0xb8f5, 0xc3fa, 0xefa3, 0xefa4, /*0xe8-0xef*/ 0xbdc2, 0xd2bf, 0xb2f9, 0xefa5, 0xefa6, 0xefa7, 0xd2f8, 0xefa8, /*0xf0-0xf7*/ 0xd6fd, 0xefa9, 0xc6cc, 0xe89e, 0xefaa, 0xefab, 0xc1b4, 0xefac, /*0xf8-0xff*/ /* 0x9500 */ 0xcffa, 0xcbf8, 0xefae, 0xefad, 0xb3fa, 0xb9f8, 0xefaf, 0xefb0, /*0x00-0x07*/ 0xd0e2, 0xefb1, 0xefb2, 0xb7e6, 0xd0bf, 0xefb3, 0xefb4, 0xefb5, /*0x08-0x0f*/ 0xc8f1, 0xcce0, 0xefb6, 0xefb7, 0xefb8, 0xefb9, 0xefba, 0xd5e0, /*0x10-0x17*/ 0xefbb, 0xb4ed, 0xc3aa, 0xefbc, 0xe89f, 0xefbd, 0xefbe, 0xefbf, /*0x18-0x1f*/ 0xe8a0, 0xcefd, 0xefc0, 0xc2e0, 0xb4b8, 0xd7b6, 0xbdf5, 0xe940, /*0x20-0x27*/ 0xcfc7, 0xefc3, 0xefc1, 0xefc2, 0xefc4, 0xb6a7, 0xbcfc, 0xbee2, /*0x28-0x2f*/ 0xc3cc, 0xefc5, 0xefc6, 0xe941, 0xefc7, 0xefcf, 0xefc8, 0xefc9, /*0x30-0x37*/ 0xefca, 0xc7c2, 0xeff1, 0xb6cd, 0xefcb, 0xe942, 0xefcc, 0xefcd, /*0x38-0x3f*/ 0xb6c6, 0xc3be, 0xefce, 0xe943, 0xefd0, 0xefd1, 0xefd2, 0xd5f2, /*0x40-0x47*/ 0xe944, 0xefd3, 0xc4f7, 0xe945, 0xefd4, 0xc4f8, 0xefd5, 0xefd6, /*0x48-0x4f*/ 0xb8e4, 0xb0f7, 0xefd7, 0xefd8, 0xefd9, 0xe946, 0xefda, 0xefdb, /*0x50-0x57*/ 0xefdc, 0xefdd, 0xe947, 0xefde, 0xbeb5, 0xefe1, 0xefdf, 0xefe0, /*0x58-0x5f*/ 0xe948, 0xefe2, 0xefe3, 0xc1cd, 0xefe4, 0xefe5, 0xefe6, 0xefe7, /*0x60-0x67*/ 0xefe8, 0xefe9, 0xefea, 0xefeb, 0xefec, 0xc0d8, 0xe949, 0xefed, /*0x68-0x6f*/ 0xc1ad, 0xefee, 0xefef, 0xeff0, 0xe94a, 0xe94b, 0xcfe2, 0xe94c, /*0x70-0x77*/ 0xe94d, 0xe94e, 0xe94f, 0xe950, 0xe951, 0xe952, 0xe953, 0xb3a4, /*0x78-0x7f*/ 0xe954, 0xe955, 0xe956, 0xe957, 0xe958, 0xe959, 0xe95a, 0xe95b, /*0x80-0x87*/ 0xe95c, 0xe95d, 0xe95e, 0xe95f, 0xe960, 0xe961, 0xe962, 0xe963, /*0x88-0x8f*/ 0xe964, 0xe965, 0xe966, 0xe967, 0xe968, 0xe969, 0xe96a, 0xe96b, /*0x90-0x97*/ 0xe96c, 0xe96d, 0xe96e, 0xe96f, 0xe970, 0xe971, 0xe972, 0xe973, /*0x98-0x9f*/ 0xe974, 0xe975, 0xe976, 0xe977, 0xe978, 0xe979, 0xe97a, 0xe97b, /*0xa0-0xa7*/ 0xe97c, 0xe97d, 0xe97e, 0xe980, 0xe981, 0xe982, 0xe983, 0xe984, /*0xa8-0xaf*/ 0xe985, 0xe986, 0xe987, 0xe988, 0xe989, 0xe98a, 0xe98b, 0xe98c, /*0xb0-0xb7*/ 0xe98d, 0xe98e, 0xe98f, 0xe990, 0xe991, 0xe992, 0xe993, 0xe994, /*0xb8-0xbf*/ 0xe995, 0xe996, 0xe997, 0xe998, 0xe999, 0xe99a, 0xe99b, 0xe99c, /*0xc0-0xc7*/ 0xe99d, 0xe99e, 0xe99f, 0xe9a0, 0xea40, 0xea41, 0xea42, 0xea43, /*0xc8-0xcf*/ 0xea44, 0xea45, 0xea46, 0xea47, 0xea48, 0xea49, 0xea4a, 0xea4b, /*0xd0-0xd7*/ 0xea4c, 0xea4d, 0xea4e, 0xea4f, 0xea50, 0xea51, 0xea52, 0xea53, /*0xd8-0xdf*/ 0xea54, 0xea55, 0xea56, 0xea57, 0xea58, 0xea59, 0xea5a, 0xea5b, /*0xe0-0xe7*/ 0xc3c5, 0xe3c5, 0xc9c1, 0xe3c6, 0xea5c, 0xb1d5, 0xceca, 0xb4b3, /*0xe8-0xef*/ 0xc8f2, 0xe3c7, 0xcfd0, 0xe3c8, 0xbce4, 0xe3c9, 0xe3ca, 0xc3c6, /*0xf0-0xf7*/ 0xd5a2, 0xc4d6, 0xb9eb, 0xcec5, 0xe3cb, 0xc3f6, 0xe3cc, 0xea5d, /*0xf8-0xff*/ /* 0x9600 */ 0xb7a7, 0xb8f3, 0xbad2, 0xe3cd, 0xe3ce, 0xd4c4, 0xe3cf, 0xea5e, /*0x00-0x07*/ 0xe3d0, 0xd1cb, 0xe3d1, 0xe3d2, 0xe3d3, 0xe3d4, 0xd1d6, 0xe3d5, /*0x08-0x0f*/ 0xb2fb, 0xc0bb, 0xe3d6, 0xea5f, 0xc0ab, 0xe3d7, 0xe3d8, 0xe3d9, /*0x10-0x17*/ 0xea60, 0xe3da, 0xe3db, 0xea61, 0xb8b7, 0xdae2, 0xea62, 0xb6d3, /*0x18-0x1f*/ 0xea63, 0xdae4, 0xdae3, 0xea64, 0xea65, 0xea66, 0xea67, 0xea68, /*0x20-0x27*/ 0xea69, 0xea6a, 0xdae6, 0xea6b, 0xea6c, 0xea6d, 0xc8ee, 0xea6e, /*0x28-0x2f*/ 0xea6f, 0xdae5, 0xb7c0, 0xd1f4, 0xd2f5, 0xd5f3, 0xbdd7, 0xea70, /*0x30-0x37*/ 0xea71, 0xea72, 0xea73, 0xd7e8, 0xdae8, 0xdae7, 0xea74, 0xb0a2, /*0x38-0x3f*/ 0xcdd3, 0xea75, 0xdae9, 0xea76, 0xb8bd, 0xbcca, 0xc2bd, 0xc2a4, /*0x40-0x47*/ 0xb3c2, 0xdaea, 0xea77, 0xc2aa, 0xc4b0, 0xbdb5, 0xea78, 0xea79, /*0x48-0x4f*/ 0xcfde, 0xea7a, 0xea7b, 0xea7c, 0xdaeb, 0xc9c2, 0xea7d, 0xea7e, /*0x50-0x57*/ 0xea80, 0xea81, 0xea82, 0xb1dd, 0xea83, 0xea84, 0xea85, 0xdaec, /*0x58-0x5f*/ 0xea86, 0xb6b8, 0xd4ba, 0xea87, 0xb3fd, 0xea88, 0xea89, 0xdaed, /*0x60-0x67*/ 0xd4c9, 0xcfd5, 0xc5e3, 0xea8a, 0xdaee, 0xea8b, 0xea8c, 0xea8d, /*0x68-0x6f*/ 0xea8e, 0xea8f, 0xdaef, 0xea90, 0xdaf0, 0xc1ea, 0xccd5, 0xcfdd, /*0x70-0x77*/ 0xea91, 0xea92, 0xea93, 0xea94, 0xea95, 0xea96, 0xea97, 0xea98, /*0x78-0x7f*/ 0xea99, 0xea9a, 0xea9b, 0xea9c, 0xea9d, 0xd3e7, 0xc2a1, 0xea9e, /*0x80-0x87*/ 0xdaf1, 0xea9f, 0xeaa0, 0xcbe5, 0xeb40, 0xdaf2, 0xeb41, 0xcbe6, /*0x88-0x8f*/ 0xd2fe, 0xeb42, 0xeb43, 0xeb44, 0xb8f4, 0xeb45, 0xeb46, 0xdaf3, /*0x90-0x97*/ 0xb0af, 0xcfb6, 0xeb47, 0xeb48, 0xd5cf, 0xeb49, 0xeb4a, 0xeb4b, /*0x98-0x9f*/ 0xeb4c, 0xeb4d, 0xeb4e, 0xeb4f, 0xeb50, 0xeb51, 0xeb52, 0xcbed, /*0xa0-0xa7*/ 0xeb53, 0xeb54, 0xeb55, 0xeb56, 0xeb57, 0xeb58, 0xeb59, 0xeb5a, /*0xa8-0xaf*/ 0xdaf4, 0xeb5b, 0xeb5c, 0xe3c4, 0xeb5d, 0xeb5e, 0xc1a5, 0xeb5f, /*0xb0-0xb7*/ 0xeb60, 0xf6bf, 0xeb61, 0xeb62, 0xf6c0, 0xf6c1, 0xc4d1, 0xeb63, /*0xb8-0xbf*/ 0xc8b8, 0xd1e3, 0xeb64, 0xeb65, 0xd0db, 0xd1c5, 0xbcaf, 0xb9cd, /*0xc0-0xc7*/ 0xeb66, 0xeff4, 0xeb67, 0xeb68, 0xb4c6, 0xd3ba, 0xf6c2, 0xb3fb, /*0xc8-0xcf*/ 0xeb69, 0xeb6a, 0xf6c3, 0xeb6b, 0xeb6c, 0xb5f1, 0xeb6d, 0xeb6e, /*0xd0-0xd7*/ 0xeb6f, 0xeb70, 0xeb71, 0xeb72, 0xeb73, 0xeb74, 0xeb75, 0xeb76, /*0xd8-0xdf*/ 0xf6c5, 0xeb77, 0xeb78, 0xeb79, 0xeb7a, 0xeb7b, 0xeb7c, 0xeb7d, /*0xe0-0xe7*/ 0xd3ea, 0xf6a7, 0xd1a9, 0xeb7e, 0xeb80, 0xeb81, 0xeb82, 0xf6a9, /*0xe8-0xef*/ 0xeb83, 0xeb84, 0xeb85, 0xf6a8, 0xeb86, 0xeb87, 0xc1e3, 0xc0d7, /*0xf0-0xf7*/ 0xeb88, 0xb1a2, 0xeb89, 0xeb8a, 0xeb8b, 0xeb8c, 0xceed, 0xeb8d, /*0xf8-0xff*/ /* 0x9700 */ 0xd0e8, 0xf6ab, 0xeb8e, 0xeb8f, 0xcff6, 0xeb90, 0xf6aa, 0xd5f0, /*0x00-0x07*/ 0xf6ac, 0xc3b9, 0xeb91, 0xeb92, 0xeb93, 0xbbf4, 0xf6ae, 0xf6ad, /*0x08-0x0f*/ 0xeb94, 0xeb95, 0xeb96, 0xc4de, 0xeb97, 0xeb98, 0xc1d8, 0xeb99, /*0x10-0x17*/ 0xeb9a, 0xeb9b, 0xeb9c, 0xeb9d, 0xcbaa, 0xeb9e, 0xcfbc, 0xeb9f, /*0x18-0x1f*/ 0xeba0, 0xec40, 0xec41, 0xec42, 0xec43, 0xec44, 0xec45, 0xec46, /*0x20-0x27*/ 0xec47, 0xec48, 0xf6af, 0xec49, 0xec4a, 0xf6b0, 0xec4b, 0xec4c, /*0x28-0x2f*/ 0xf6b1, 0xec4d, 0xc2b6, 0xec4e, 0xec4f, 0xec50, 0xec51, 0xec52, /*0x30-0x37*/ 0xb0d4, 0xc5f9, 0xec53, 0xec54, 0xec55, 0xec56, 0xf6b2, 0xec57, /*0x38-0x3f*/ 0xec58, 0xec59, 0xec5a, 0xec5b, 0xec5c, 0xec5d, 0xec5e, 0xec5f, /*0x40-0x47*/ 0xec60, 0xec61, 0xec62, 0xec63, 0xec64, 0xec65, 0xec66, 0xec67, /*0x48-0x4f*/ 0xec68, 0xec69, 0xc7e0, 0xf6a6, 0xec6a, 0xec6b, 0xbeb8, 0xec6c, /*0x50-0x57*/ 0xec6d, 0xbeb2, 0xec6e, 0xb5e5, 0xec6f, 0xec70, 0xb7c7, 0xec71, /*0x58-0x5f*/ 0xbfbf, 0xc3d2, 0xc3e6, 0xec72, 0xec73, 0xd8cc, 0xec74, 0xec75, /*0x60-0x67*/ 0xec76, 0xb8ef, 0xec77, 0xec78, 0xec79, 0xec7a, 0xec7b, 0xec7c, /*0x68-0x6f*/ 0xec7d, 0xec7e, 0xec80, 0xbdf9, 0xd1a5, 0xec81, 0xb0d0, 0xec82, /*0x70-0x77*/ 0xec83, 0xec84, 0xec85, 0xec86, 0xf7b0, 0xec87, 0xec88, 0xec89, /*0x78-0x7f*/ 0xec8a, 0xec8b, 0xec8c, 0xec8d, 0xec8e, 0xf7b1, 0xec8f, 0xec90, /*0x80-0x87*/ 0xec91, 0xec92, 0xec93, 0xd0ac, 0xec94, 0xb0b0, 0xec95, 0xec96, /*0x88-0x8f*/ 0xec97, 0xf7b2, 0xf7b3, 0xec98, 0xf7b4, 0xec99, 0xec9a, 0xec9b, /*0x90-0x97*/ 0xc7ca, 0xec9c, 0xec9d, 0xec9e, 0xec9f, 0xeca0, 0xed40, 0xed41, /*0x98-0x9f*/ 0xbecf, 0xed42, 0xed43, 0xf7b7, 0xed44, 0xed45, 0xed46, 0xed47, /*0xa0-0xa7*/ 0xed48, 0xed49, 0xed4a, 0xf7b6, 0xed4b, 0xb1de, 0xed4c, 0xf7b5, /*0xa8-0xaf*/ 0xed4d, 0xed4e, 0xf7b8, 0xed4f, 0xf7b9, 0xed50, 0xed51, 0xed52, /*0xb0-0xb7*/ 0xed53, 0xed54, 0xed55, 0xed56, 0xed57, 0xed58, 0xed59, 0xed5a, /*0xb8-0xbf*/ 0xed5b, 0xed5c, 0xed5d, 0xed5e, 0xed5f, 0xed60, 0xed61, 0xed62, /*0xc0-0xc7*/ 0xed63, 0xed64, 0xed65, 0xed66, 0xed67, 0xed68, 0xed69, 0xed6a, /*0xc8-0xcf*/ 0xed6b, 0xed6c, 0xed6d, 0xed6e, 0xed6f, 0xed70, 0xed71, 0xed72, /*0xd0-0xd7*/ 0xed73, 0xed74, 0xed75, 0xed76, 0xed77, 0xed78, 0xed79, 0xed7a, /*0xd8-0xdf*/ 0xed7b, 0xed7c, 0xed7d, 0xed7e, 0xed80, 0xed81, 0xcea4, 0xc8cd, /*0xe0-0xe7*/ 0xed82, 0xbaab, 0xe8b8, 0xe8b9, 0xe8ba, 0xbec2, 0xed83, 0xed84, /*0xe8-0xef*/ 0xed85, 0xed86, 0xed87, 0xd2f4, 0xed88, 0xd4cf, 0xc9d8, 0xed89, /*0xf0-0xf7*/ 0xed8a, 0xed8b, 0xed8c, 0xed8d, 0xed8e, 0xed8f, 0xed90, 0xed91, /*0xf8-0xff*/ /* 0x9800 */ 0xed92, 0xed93, 0xed94, 0xed95, 0xed96, 0xed97, 0xed98, 0xed99, /*0x00-0x07*/ 0xed9a, 0xed9b, 0xed9c, 0xed9d, 0xed9e, 0xed9f, 0xeda0, 0xee40, /*0x08-0x0f*/ 0xee41, 0xee42, 0xee43, 0xee44, 0xee45, 0xee46, 0xee47, 0xee48, /*0x10-0x17*/ 0xee49, 0xee4a, 0xee4b, 0xee4c, 0xee4d, 0xee4e, 0xee4f, 0xee50, /*0x18-0x1f*/ 0xee51, 0xee52, 0xee53, 0xee54, 0xee55, 0xee56, 0xee57, 0xee58, /*0x20-0x27*/ 0xee59, 0xee5a, 0xee5b, 0xee5c, 0xee5d, 0xee5e, 0xee5f, 0xee60, /*0x28-0x2f*/ 0xee61, 0xee62, 0xee63, 0xee64, 0xee65, 0xee66, 0xee67, 0xee68, /*0x30-0x37*/ 0xee69, 0xee6a, 0xee6b, 0xee6c, 0xee6d, 0xee6e, 0xee6f, 0xee70, /*0x38-0x3f*/ 0xee71, 0xee72, 0xee73, 0xee74, 0xee75, 0xee76, 0xee77, 0xee78, /*0x40-0x47*/ 0xee79, 0xee7a, 0xee7b, 0xee7c, 0xee7d, 0xee7e, 0xee80, 0xee81, /*0x48-0x4f*/ 0xee82, 0xee83, 0xee84, 0xee85, 0xee86, 0xee87, 0xee88, 0xee89, /*0x50-0x57*/ 0xee8a, 0xee8b, 0xee8c, 0xee8d, 0xee8e, 0xee8f, 0xee90, 0xee91, /*0x58-0x5f*/ 0xee92, 0xee93, 0xee94, 0xee95, 0xee96, 0xee97, 0xee98, 0xee99, /*0x60-0x67*/ 0xee9a, 0xee9b, 0xee9c, 0xee9d, 0xee9e, 0xee9f, 0xeea0, 0xef40, /*0x68-0x6f*/ 0xef41, 0xef42, 0xef43, 0xef44, 0xef45, 0xd2b3, 0xb6a5, 0xc7ea, /*0x70-0x77*/ 0xf1fc, 0xcfee, 0xcbb3, 0xd0eb, 0xe7ef, 0xcde7, 0xb9cb, 0xb6d9, /*0x78-0x7f*/ 0xf1fd, 0xb0e4, 0xcbcc, 0xf1fe, 0xd4a4, 0xc2ad, 0xc1ec, 0xc6c4, /*0x80-0x87*/ 0xbeb1, 0xf2a1, 0xbcd5, 0xef46, 0xf2a2, 0xf2a3, 0xef47, 0xf2a4, /*0x88-0x8f*/ 0xd2c3, 0xc6b5, 0xef48, 0xcdc7, 0xf2a5, 0xef49, 0xd3b1, 0xbfc5, /*0x90-0x97*/ 0xcce2, 0xef4a, 0xf2a6, 0xf2a7, 0xd1d5, 0xb6ee, 0xf2a8, 0xf2a9, /*0x98-0x9f*/ 0xb5df, 0xf2aa, 0xf2ab, 0xef4b, 0xb2fc, 0xf2ac, 0xf2ad, 0xc8a7, /*0xa0-0xa7*/ 0xef4c, 0xef4d, 0xef4e, 0xef4f, 0xef50, 0xef51, 0xef52, 0xef53, /*0xa8-0xaf*/ 0xef54, 0xef55, 0xef56, 0xef57, 0xef58, 0xef59, 0xef5a, 0xef5b, /*0xb0-0xb7*/ 0xef5c, 0xef5d, 0xef5e, 0xef5f, 0xef60, 0xef61, 0xef62, 0xef63, /*0xb8-0xbf*/ 0xef64, 0xef65, 0xef66, 0xef67, 0xef68, 0xef69, 0xef6a, 0xef6b, /*0xc0-0xc7*/ 0xef6c, 0xef6d, 0xef6e, 0xef6f, 0xef70, 0xef71, 0xb7e7, 0xef72, /*0xc8-0xcf*/ 0xef73, 0xeca9, 0xecaa, 0xecab, 0xef74, 0xecac, 0xef75, 0xef76, /*0xd0-0xd7*/ 0xc6ae, 0xecad, 0xecae, 0xef77, 0xef78, 0xef79, 0xb7c9, 0xcab3, /*0xd8-0xdf*/ 0xef7a, 0xef7b, 0xef7c, 0xef7d, 0xef7e, 0xef80, 0xef81, 0xe2b8, /*0xe0-0xe7*/ 0xf7cf, 0xef82, 0xef83, 0xef84, 0xef85, 0xef86, 0xef87, 0xef88, /*0xe8-0xef*/ 0xef89, 0xef8a, 0xef8b, 0xef8c, 0xef8d, 0xef8e, 0xef8f, 0xef90, /*0xf0-0xf7*/ 0xef91, 0xef92, 0xef93, 0xef94, 0xef95, 0xef96, 0xef97, 0xef98, /*0xf8-0xff*/ /* 0x9900 */ 0xef99, 0xef9a, 0xef9b, 0xef9c, 0xef9d, 0xef9e, 0xef9f, 0xefa0, /*0x00-0x07*/ 0xf040, 0xf041, 0xf042, 0xf043, 0xf044, 0xf7d0, 0xf045, 0xf046, /*0x08-0x0f*/ 0xb2cd, 0xf047, 0xf048, 0xf049, 0xf04a, 0xf04b, 0xf04c, 0xf04d, /*0x10-0x17*/ 0xf04e, 0xf04f, 0xf050, 0xf051, 0xf052, 0xf053, 0xf054, 0xf055, /*0x18-0x1f*/ 0xf056, 0xf057, 0xf058, 0xf059, 0xf05a, 0xf05b, 0xf05c, 0xf05d, /*0x20-0x27*/ 0xf05e, 0xf05f, 0xf060, 0xf061, 0xf062, 0xf063, 0xf7d1, 0xf064, /*0x28-0x2f*/ 0xf065, 0xf066, 0xf067, 0xf068, 0xf069, 0xf06a, 0xf06b, 0xf06c, /*0x30-0x37*/ 0xf06d, 0xf06e, 0xf06f, 0xf070, 0xf071, 0xf072, 0xf073, 0xf074, /*0x38-0x3f*/ 0xf075, 0xf076, 0xf077, 0xf078, 0xf079, 0xf07a, 0xf07b, 0xf07c, /*0x40-0x47*/ 0xf07d, 0xf07e, 0xf080, 0xf081, 0xf082, 0xf083, 0xf084, 0xf085, /*0x48-0x4f*/ 0xf086, 0xf087, 0xf088, 0xf089, 0xf7d3, 0xf7d2, 0xf08a, 0xf08b, /*0x50-0x57*/ 0xf08c, 0xf08d, 0xf08e, 0xf08f, 0xf090, 0xf091, 0xf092, 0xf093, /*0x58-0x5f*/ 0xf094, 0xf095, 0xf096, 0xe2bb, 0xf097, 0xbca2, 0xf098, 0xe2bc, /*0x60-0x67*/ 0xe2bd, 0xe2be, 0xe2bf, 0xe2c0, 0xe2c1, 0xb7b9, 0xd2fb, 0xbda4, /*0x68-0x6f*/ 0xcace, 0xb1a5, 0xcbc7, 0xf099, 0xe2c2, 0xb6fc, 0xc8c4, 0xe2c3, /*0x70-0x77*/ 0xf09a, 0xf09b, 0xbdc8, 0xf09c, 0xb1fd, 0xe2c4, 0xf09d, 0xb6f6, /*0x78-0x7f*/ 0xe2c5, 0xc4d9, 0xf09e, 0xf09f, 0xe2c6, 0xcfda, 0xb9dd, 0xe2c7, /*0x80-0x87*/ 0xc0a1, 0xf0a0, 0xe2c8, 0xb2f6, 0xf140, 0xe2c9, 0xf141, 0xc1f3, /*0x88-0x8f*/ 0xe2ca, 0xe2cb, 0xc2f8, 0xe2cc, 0xe2cd, 0xe2ce, 0xcad7, 0xd8b8, /*0x90-0x97*/ 0xd9e5, 0xcfe3, 0xf142, 0xf143, 0xf144, 0xf145, 0xf146, 0xf147, /*0x98-0x9f*/ 0xf148, 0xf149, 0xf14a, 0xf14b, 0xf14c, 0xf0a5, 0xf14d, 0xf14e, /*0xa0-0xa7*/ 0xdcb0, 0xf14f, 0xf150, 0xf151, 0xf152, 0xf153, 0xf154, 0xf155, /*0xa8-0xaf*/ 0xf156, 0xf157, 0xf158, 0xf159, 0xf15a, 0xf15b, 0xf15c, 0xf15d, /*0xb0-0xb7*/ 0xf15e, 0xf15f, 0xf160, 0xf161, 0xf162, 0xf163, 0xf164, 0xf165, /*0xb8-0xbf*/ 0xf166, 0xf167, 0xf168, 0xf169, 0xf16a, 0xf16b, 0xf16c, 0xf16d, /*0xc0-0xc7*/ 0xf16e, 0xf16f, 0xf170, 0xf171, 0xf172, 0xf173, 0xf174, 0xf175, /*0xc8-0xcf*/ 0xf176, 0xf177, 0xf178, 0xf179, 0xf17a, 0xf17b, 0xf17c, 0xf17d, /*0xd0-0xd7*/ 0xf17e, 0xf180, 0xf181, 0xf182, 0xf183, 0xf184, 0xf185, 0xf186, /*0xd8-0xdf*/ 0xf187, 0xf188, 0xf189, 0xf18a, 0xf18b, 0xf18c, 0xf18d, 0xf18e, /*0xe0-0xe7*/ 0xf18f, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf195, 0xf196, /*0xe8-0xef*/ 0xf197, 0xf198, 0xf199, 0xf19a, 0xf19b, 0xf19c, 0xf19d, 0xf19e, /*0xf0-0xf7*/ 0xf19f, 0xf1a0, 0xf240, 0xf241, 0xf242, 0xf243, 0xf244, 0xf245, /*0xf8-0xff*/ /* 0x9a00 */ 0xf246, 0xf247, 0xf248, 0xf249, 0xf24a, 0xf24b, 0xf24c, 0xf24d, /*0x00-0x07*/ 0xf24e, 0xf24f, 0xf250, 0xf251, 0xf252, 0xf253, 0xf254, 0xf255, /*0x08-0x0f*/ 0xf256, 0xf257, 0xf258, 0xf259, 0xf25a, 0xf25b, 0xf25c, 0xf25d, /*0x10-0x17*/ 0xf25e, 0xf25f, 0xf260, 0xf261, 0xf262, 0xf263, 0xf264, 0xf265, /*0x18-0x1f*/ 0xf266, 0xf267, 0xf268, 0xf269, 0xf26a, 0xf26b, 0xf26c, 0xf26d, /*0x20-0x27*/ 0xf26e, 0xf26f, 0xf270, 0xf271, 0xf272, 0xf273, 0xf274, 0xf275, /*0x28-0x2f*/ 0xf276, 0xf277, 0xf278, 0xf279, 0xf27a, 0xf27b, 0xf27c, 0xf27d, /*0x30-0x37*/ 0xf27e, 0xf280, 0xf281, 0xf282, 0xf283, 0xf284, 0xf285, 0xf286, /*0x38-0x3f*/ 0xf287, 0xf288, 0xf289, 0xf28a, 0xf28b, 0xf28c, 0xf28d, 0xf28e, /*0x40-0x47*/ 0xf28f, 0xf290, 0xf291, 0xf292, 0xf293, 0xf294, 0xf295, 0xf296, /*0x48-0x4f*/ 0xf297, 0xf298, 0xf299, 0xf29a, 0xf29b, 0xf29c, 0xf29d, 0xf29e, /*0x50-0x57*/ 0xf29f, 0xf2a0, 0xf340, 0xf341, 0xf342, 0xf343, 0xf344, 0xf345, /*0x58-0x5f*/ 0xf346, 0xf347, 0xf348, 0xf349, 0xf34a, 0xf34b, 0xf34c, 0xf34d, /*0x60-0x67*/ 0xf34e, 0xf34f, 0xf350, 0xf351, 0xc2ed, 0xd4a6, 0xcdd4, 0xd1b1, /*0x68-0x6f*/ 0xb3db, 0xc7fd, 0xf352, 0xb2b5, 0xc2bf, 0xe6e0, 0xcabb, 0xe6e1, /*0x70-0x77*/ 0xe6e2, 0xbed4, 0xe6e3, 0xd7a4, 0xcdd5, 0xe6e5, 0xbcdd, 0xe6e4, /*0x78-0x7f*/ 0xe6e6, 0xe6e7, 0xc2ee, 0xf353, 0xbdbe, 0xe6e8, 0xc2e6, 0xbaa7, /*0x80-0x87*/ 0xe6e9, 0xf354, 0xe6ea, 0xb3d2, 0xd1e9, 0xf355, 0xf356, 0xbfa5, /*0x88-0x8f*/ 0xe6eb, 0xc6ef, 0xe6ec, 0xe6ed, 0xf357, 0xf358, 0xe6ee, 0xc6ad, /*0x90-0x97*/ 0xe6ef, 0xf359, 0xc9a7, 0xe6f0, 0xe6f1, 0xe6f2, 0xe5b9, 0xe6f3, /*0x98-0x9f*/ 0xe6f4, 0xc2e2, 0xe6f5, 0xe6f6, 0xd6e8, 0xe6f7, 0xf35a, 0xe6f8, /*0xa0-0xa7*/ 0xb9c7, 0xf35b, 0xf35c, 0xf35d, 0xf35e, 0xf35f, 0xf360, 0xf361, /*0xa8-0xaf*/ 0xf7bb, 0xf7ba, 0xf362, 0xf363, 0xf364, 0xf365, 0xf7be, 0xf7bc, /*0xb0-0xb7*/ 0xbaa1, 0xf366, 0xf7bf, 0xf367, 0xf7c0, 0xf368, 0xf369, 0xf36a, /*0xb8-0xbf*/ 0xf7c2, 0xf7c1, 0xf7c4, 0xf36b, 0xf36c, 0xf7c3, 0xf36d, 0xf36e, /*0xc0-0xc7*/ 0xf36f, 0xf370, 0xf371, 0xf7c5, 0xf7c6, 0xf372, 0xf373, 0xf374, /*0xc8-0xcf*/ 0xf375, 0xf7c7, 0xf376, 0xcbe8, 0xf377, 0xf378, 0xf379, 0xf37a, /*0xd0-0xd7*/ 0xb8df, 0xf37b, 0xf37c, 0xf37d, 0xf37e, 0xf380, 0xf381, 0xf7d4, /*0xd8-0xdf*/ 0xf382, 0xf7d5, 0xf383, 0xf384, 0xf385, 0xf386, 0xf7d6, 0xf387, /*0xe0-0xe7*/ 0xf388, 0xf389, 0xf38a, 0xf7d8, 0xf38b, 0xf7da, 0xf38c, 0xf7d7, /*0xe8-0xef*/ 0xf38d, 0xf38e, 0xf38f, 0xf390, 0xf391, 0xf392, 0xf393, 0xf394, /*0xf0-0xf7*/ 0xf395, 0xf7db, 0xf396, 0xf7d9, 0xf397, 0xf398, 0xf399, 0xf39a, /*0xf8-0xff*/ /* 0x9b00 */ 0xf39b, 0xf39c, 0xf39d, 0xd7d7, 0xf39e, 0xf39f, 0xf3a0, 0xf440, /*0x00-0x07*/ 0xf7dc, 0xf441, 0xf442, 0xf443, 0xf444, 0xf445, 0xf446, 0xf7dd, /*0x08-0x0f*/ 0xf447, 0xf448, 0xf449, 0xf7de, 0xf44a, 0xf44b, 0xf44c, 0xf44d, /*0x10-0x17*/ 0xf44e, 0xf44f, 0xf450, 0xf451, 0xf452, 0xf453, 0xf454, 0xf7df, /*0x18-0x1f*/ 0xf455, 0xf456, 0xf457, 0xf7e0, 0xf458, 0xf459, 0xf45a, 0xf45b, /*0x20-0x27*/ 0xf45c, 0xf45d, 0xf45e, 0xf45f, 0xf460, 0xf461, 0xf462, 0xdbcb, /*0x28-0x2f*/ 0xf463, 0xf464, 0xd8aa, 0xf465, 0xf466, 0xf467, 0xf468, 0xf469, /*0x30-0x37*/ 0xf46a, 0xf46b, 0xf46c, 0xe5f7, 0xb9ed, 0xf46d, 0xf46e, 0xf46f, /*0x38-0x3f*/ 0xf470, 0xbffd, 0xbbea, 0xf7c9, 0xc6c7, 0xf7c8, 0xf471, 0xf7ca, /*0x40-0x47*/ 0xf7cc, 0xf7cb, 0xf472, 0xf473, 0xf474, 0xf7cd, 0xf475, 0xceba, /*0x48-0x4f*/ 0xf476, 0xf7ce, 0xf477, 0xf478, 0xc4a7, 0xf479, 0xf47a, 0xf47b, /*0x50-0x57*/ 0xf47c, 0xf47d, 0xf47e, 0xf480, 0xf481, 0xf482, 0xf483, 0xf484, /*0x58-0x5f*/ 0xf485, 0xf486, 0xf487, 0xf488, 0xf489, 0xf48a, 0xf48b, 0xf48c, /*0x60-0x67*/ 0xf48d, 0xf48e, 0xf48f, 0xf490, 0xf491, 0xf492, 0xf493, 0xf494, /*0x68-0x6f*/ 0xf495, 0xf496, 0xf497, 0xf498, 0xf499, 0xf49a, 0xf49b, 0xf49c, /*0x70-0x77*/ 0xf49d, 0xf49e, 0xf49f, 0xf4a0, 0xf540, 0xf541, 0xf542, 0xf543, /*0x78-0x7f*/ 0xf544, 0xf545, 0xf546, 0xf547, 0xf548, 0xf549, 0xf54a, 0xf54b, /*0x80-0x87*/ 0xf54c, 0xf54d, 0xf54e, 0xf54f, 0xf550, 0xf551, 0xf552, 0xf553, /*0x88-0x8f*/ 0xf554, 0xf555, 0xf556, 0xf557, 0xf558, 0xf559, 0xf55a, 0xf55b, /*0x90-0x97*/ 0xf55c, 0xf55d, 0xf55e, 0xf55f, 0xf560, 0xf561, 0xf562, 0xf563, /*0x98-0x9f*/ 0xf564, 0xf565, 0xf566, 0xf567, 0xf568, 0xf569, 0xf56a, 0xf56b, /*0xa0-0xa7*/ 0xf56c, 0xf56d, 0xf56e, 0xf56f, 0xf570, 0xf571, 0xf572, 0xf573, /*0xa8-0xaf*/ 0xf574, 0xf575, 0xf576, 0xf577, 0xf578, 0xf579, 0xf57a, 0xf57b, /*0xb0-0xb7*/ 0xf57c, 0xf57d, 0xf57e, 0xf580, 0xf581, 0xf582, 0xf583, 0xf584, /*0xb8-0xbf*/ 0xf585, 0xf586, 0xf587, 0xf588, 0xf589, 0xf58a, 0xf58b, 0xf58c, /*0xc0-0xc7*/ 0xf58d, 0xf58e, 0xf58f, 0xf590, 0xf591, 0xf592, 0xf593, 0xf594, /*0xc8-0xcf*/ 0xf595, 0xf596, 0xf597, 0xf598, 0xf599, 0xf59a, 0xf59b, 0xf59c, /*0xd0-0xd7*/ 0xf59d, 0xf59e, 0xf59f, 0xf5a0, 0xf640, 0xf641, 0xf642, 0xf643, /*0xd8-0xdf*/ 0xf644, 0xf645, 0xf646, 0xf647, 0xf648, 0xf649, 0xf64a, 0xf64b, /*0xe0-0xe7*/ 0xf64c, 0xf64d, 0xf64e, 0xf64f, 0xf650, 0xf651, 0xf652, 0xf653, /*0xe8-0xef*/ 0xf654, 0xf655, 0xf656, 0xf657, 0xf658, 0xf659, 0xf65a, 0xf65b, /*0xf0-0xf7*/ 0xf65c, 0xf65d, 0xf65e, 0xf65f, 0xf660, 0xf661, 0xf662, 0xf663, /*0xf8-0xff*/ /* 0x9c00 */ 0xf664, 0xf665, 0xf666, 0xf667, 0xf668, 0xf669, 0xf66a, 0xf66b, /*0x00-0x07*/ 0xf66c, 0xf66d, 0xf66e, 0xf66f, 0xf670, 0xf671, 0xf672, 0xf673, /*0x08-0x0f*/ 0xf674, 0xf675, 0xf676, 0xf677, 0xf678, 0xf679, 0xf67a, 0xf67b, /*0x10-0x17*/ 0xf67c, 0xf67d, 0xf67e, 0xf680, 0xf681, 0xf682, 0xf683, 0xf684, /*0x18-0x1f*/ 0xf685, 0xf686, 0xf687, 0xf688, 0xf689, 0xf68a, 0xf68b, 0xf68c, /*0x20-0x27*/ 0xf68d, 0xf68e, 0xf68f, 0xf690, 0xf691, 0xf692, 0xf693, 0xf694, /*0x28-0x2f*/ 0xf695, 0xf696, 0xf697, 0xf698, 0xf699, 0xf69a, 0xf69b, 0xf69c, /*0x30-0x37*/ 0xf69d, 0xf69e, 0xf69f, 0xf6a0, 0xf740, 0xf741, 0xf742, 0xf743, /*0x38-0x3f*/ 0xf744, 0xf745, 0xf746, 0xf747, 0xf748, 0xf749, 0xf74a, 0xf74b, /*0x40-0x47*/ 0xf74c, 0xf74d, 0xf74e, 0xf74f, 0xf750, 0xf751, 0xf752, 0xf753, /*0x48-0x4f*/ 0xf754, 0xf755, 0xf756, 0xf757, 0xf758, 0xf759, 0xf75a, 0xf75b, /*0x50-0x57*/ 0xf75c, 0xf75d, 0xf75e, 0xf75f, 0xf760, 0xf761, 0xf762, 0xf763, /*0x58-0x5f*/ 0xf764, 0xf765, 0xf766, 0xf767, 0xf768, 0xf769, 0xf76a, 0xf76b, /*0x60-0x67*/ 0xf76c, 0xf76d, 0xf76e, 0xf76f, 0xf770, 0xf771, 0xf772, 0xf773, /*0x68-0x6f*/ 0xf774, 0xf775, 0xf776, 0xf777, 0xf778, 0xf779, 0xf77a, 0xf77b, /*0x70-0x77*/ 0xf77c, 0xf77d, 0xf77e, 0xf780, 0xd3e3, 0xf781, 0xf782, 0xf6cf, /*0x78-0x7f*/ 0xf783, 0xc2b3, 0xf6d0, 0xf784, 0xf785, 0xf6d1, 0xf6d2, 0xf6d3, /*0x80-0x87*/ 0xf6d4, 0xf786, 0xf787, 0xf6d6, 0xf788, 0xb1ab, 0xf6d7, 0xf789, /*0x88-0x8f*/ 0xf6d8, 0xf6d9, 0xf6da, 0xf78a, 0xf6db, 0xf6dc, 0xf78b, 0xf78c, /*0x90-0x97*/ 0xf78d, 0xf78e, 0xf6dd, 0xf6de, 0xcfca, 0xf78f, 0xf6df, 0xf6e0, /*0x98-0x9f*/ 0xf6e1, 0xf6e2, 0xf6e3, 0xf6e4, 0xc0f0, 0xf6e5, 0xf6e6, 0xf6e7, /*0xa0-0xa7*/ 0xf6e8, 0xf6e9, 0xf790, 0xf6ea, 0xf791, 0xf6eb, 0xf6ec, 0xf792, /*0xa8-0xaf*/ 0xf6ed, 0xf6ee, 0xf6ef, 0xf6f0, 0xf6f1, 0xf6f2, 0xf6f3, 0xf6f4, /*0xb0-0xb7*/ 0xbea8, 0xf793, 0xf6f5, 0xf6f6, 0xf6f7, 0xf6f8, 0xf794, 0xf795, /*0xb8-0xbf*/ 0xf796, 0xf797, 0xf798, 0xc8fa, 0xf6f9, 0xf6fa, 0xf6fb, 0xf6fc, /*0xc0-0xc7*/ 0xf799, 0xf79a, 0xf6fd, 0xf6fe, 0xf7a1, 0xf7a2, 0xf7a3, 0xf7a4, /*0xc8-0xcf*/ 0xf7a5, 0xf79b, 0xf79c, 0xf7a6, 0xf7a7, 0xf7a8, 0xb1ee, 0xf7a9, /*0xd0-0xd7*/ 0xf7aa, 0xf7ab, 0xf79d, 0xf79e, 0xf7ac, 0xf7ad, 0xc1db, 0xf7ae, /*0xd8-0xdf*/ 0xf79f, 0xf7a0, 0xf7af, 0xf840, 0xf841, 0xf842, 0xf843, 0xf844, /*0xe0-0xe7*/ 0xf845, 0xf846, 0xf847, 0xf848, 0xf849, 0xf84a, 0xf84b, 0xf84c, /*0xe8-0xef*/ 0xf84d, 0xf84e, 0xf84f, 0xf850, 0xf851, 0xf852, 0xf853, 0xf854, /*0xf0-0xf7*/ 0xf855, 0xf856, 0xf857, 0xf858, 0xf859, 0xf85a, 0xf85b, 0xf85c, /*0xf8-0xff*/ /* 0x9d00 */ 0xf85d, 0xf85e, 0xf85f, 0xf860, 0xf861, 0xf862, 0xf863, 0xf864, /*0x00-0x07*/ 0xf865, 0xf866, 0xf867, 0xf868, 0xf869, 0xf86a, 0xf86b, 0xf86c, /*0x08-0x0f*/ 0xf86d, 0xf86e, 0xf86f, 0xf870, 0xf871, 0xf872, 0xf873, 0xf874, /*0x10-0x17*/ 0xf875, 0xf876, 0xf877, 0xf878, 0xf879, 0xf87a, 0xf87b, 0xf87c, /*0x18-0x1f*/ 0xf87d, 0xf87e, 0xf880, 0xf881, 0xf882, 0xf883, 0xf884, 0xf885, /*0x20-0x27*/ 0xf886, 0xf887, 0xf888, 0xf889, 0xf88a, 0xf88b, 0xf88c, 0xf88d, /*0x28-0x2f*/ 0xf88e, 0xf88f, 0xf890, 0xf891, 0xf892, 0xf893, 0xf894, 0xf895, /*0x30-0x37*/ 0xf896, 0xf897, 0xf898, 0xf899, 0xf89a, 0xf89b, 0xf89c, 0xf89d, /*0x38-0x3f*/ 0xf89e, 0xf89f, 0xf8a0, 0xf940, 0xf941, 0xf942, 0xf943, 0xf944, /*0x40-0x47*/ 0xf945, 0xf946, 0xf947, 0xf948, 0xf949, 0xf94a, 0xf94b, 0xf94c, /*0x48-0x4f*/ 0xf94d, 0xf94e, 0xf94f, 0xf950, 0xf951, 0xf952, 0xf953, 0xf954, /*0x50-0x57*/ 0xf955, 0xf956, 0xf957, 0xf958, 0xf959, 0xf95a, 0xf95b, 0xf95c, /*0x58-0x5f*/ 0xf95d, 0xf95e, 0xf95f, 0xf960, 0xf961, 0xf962, 0xf963, 0xf964, /*0x60-0x67*/ 0xf965, 0xf966, 0xf967, 0xf968, 0xf969, 0xf96a, 0xf96b, 0xf96c, /*0x68-0x6f*/ 0xf96d, 0xf96e, 0xf96f, 0xf970, 0xf971, 0xf972, 0xf973, 0xf974, /*0x70-0x77*/ 0xf975, 0xf976, 0xf977, 0xf978, 0xf979, 0xf97a, 0xf97b, 0xf97c, /*0x78-0x7f*/ 0xf97d, 0xf97e, 0xf980, 0xf981, 0xf982, 0xf983, 0xf984, 0xf985, /*0x80-0x87*/ 0xf986, 0xf987, 0xf988, 0xf989, 0xf98a, 0xf98b, 0xf98c, 0xf98d, /*0x88-0x8f*/ 0xf98e, 0xf98f, 0xf990, 0xf991, 0xf992, 0xf993, 0xf994, 0xf995, /*0x90-0x97*/ 0xf996, 0xf997, 0xf998, 0xf999, 0xf99a, 0xf99b, 0xf99c, 0xf99d, /*0x98-0x9f*/ 0xf99e, 0xf99f, 0xf9a0, 0xfa40, 0xfa41, 0xfa42, 0xfa43, 0xfa44, /*0xa0-0xa7*/ 0xfa45, 0xfa46, 0xfa47, 0xfa48, 0xfa49, 0xfa4a, 0xfa4b, 0xfa4c, /*0xa8-0xaf*/ 0xfa4d, 0xfa4e, 0xfa4f, 0xfa50, 0xfa51, 0xfa52, 0xfa53, 0xfa54, /*0xb0-0xb7*/ 0xfa55, 0xfa56, 0xfa57, 0xfa58, 0xfa59, 0xfa5a, 0xfa5b, 0xfa5c, /*0xb8-0xbf*/ 0xfa5d, 0xfa5e, 0xfa5f, 0xfa60, 0xfa61, 0xfa62, 0xfa63, 0xfa64, /*0xc0-0xc7*/ 0xfa65, 0xfa66, 0xfa67, 0xfa68, 0xfa69, 0xfa6a, 0xfa6b, 0xfa6c, /*0xc8-0xcf*/ 0xfa6d, 0xfa6e, 0xfa6f, 0xfa70, 0xfa71, 0xfa72, 0xfa73, 0xfa74, /*0xd0-0xd7*/ 0xfa75, 0xfa76, 0xfa77, 0xfa78, 0xfa79, 0xfa7a, 0xfa7b, 0xfa7c, /*0xd8-0xdf*/ 0xfa7d, 0xfa7e, 0xfa80, 0xfa81, 0xfa82, 0xfa83, 0xfa84, 0xfa85, /*0xe0-0xe7*/ 0xfa86, 0xfa87, 0xfa88, 0xfa89, 0xfa8a, 0xfa8b, 0xfa8c, 0xfa8d, /*0xe8-0xef*/ 0xfa8e, 0xfa8f, 0xfa90, 0xfa91, 0xfa92, 0xfa93, 0xfa94, 0xfa95, /*0xf0-0xf7*/ 0xfa96, 0xfa97, 0xfa98, 0xfa99, 0xfa9a, 0xfa9b, 0xfa9c, 0xfa9d, /*0xf8-0xff*/ /* 0x9e00 */ 0xfa9e, 0xfa9f, 0xfaa0, 0xfb40, 0xfb41, 0xfb42, 0xfb43, 0xfb44, /*0x00-0x07*/ 0xfb45, 0xfb46, 0xfb47, 0xfb48, 0xfb49, 0xfb4a, 0xfb4b, 0xfb4c, /*0x08-0x0f*/ 0xfb4d, 0xfb4e, 0xfb4f, 0xfb50, 0xfb51, 0xfb52, 0xfb53, 0xfb54, /*0x10-0x17*/ 0xfb55, 0xfb56, 0xfb57, 0xfb58, 0xfb59, 0xfb5a, 0xfb5b, 0xc4f1, /*0x18-0x1f*/ 0xf0af, 0xbca6, 0xf0b0, 0xc3f9, 0xfb5c, 0xc5b8, 0xd1bb, 0xfb5d, /*0x20-0x27*/ 0xf0b1, 0xf0b2, 0xf0b3, 0xf0b4, 0xf0b5, 0xd1bc, 0xfb5e, 0xd1ec, /*0x28-0x2f*/ 0xfb5f, 0xf0b7, 0xf0b6, 0xd4a7, 0xfb60, 0xcdd2, 0xf0b8, 0xf0ba, /*0x30-0x37*/ 0xf0b9, 0xf0bb, 0xf0bc, 0xfb61, 0xfb62, 0xb8eb, 0xf0bd, 0xbae8, /*0x38-0x3f*/ 0xfb63, 0xf0be, 0xf0bf, 0xbee9, 0xf0c0, 0xb6ec, 0xf0c1, 0xf0c2, /*0x40-0x47*/ 0xf0c3, 0xf0c4, 0xc8b5, 0xf0c5, 0xf0c6, 0xfb64, 0xf0c7, 0xc5f4, /*0x48-0x4f*/ 0xfb65, 0xf0c8, 0xfb66, 0xfb67, 0xfb68, 0xf0c9, 0xfb69, 0xf0ca, /*0x50-0x57*/ 0xf7bd, 0xfb6a, 0xf0cb, 0xf0cc, 0xf0cd, 0xfb6b, 0xf0ce, 0xfb6c, /*0x58-0x5f*/ 0xfb6d, 0xfb6e, 0xfb6f, 0xf0cf, 0xbad7, 0xfb70, 0xf0d0, 0xf0d1, /*0x60-0x67*/ 0xf0d2, 0xf0d3, 0xf0d4, 0xf0d5, 0xf0d6, 0xf0d8, 0xfb71, 0xfb72, /*0x68-0x6f*/ 0xd3a5, 0xf0d7, 0xfb73, 0xf0d9, 0xfb74, 0xfb75, 0xfb76, 0xfb77, /*0x70-0x77*/ 0xfb78, 0xfb79, 0xfb7a, 0xfb7b, 0xfb7c, 0xfb7d, 0xf5ba, 0xc2b9, /*0x78-0x7f*/ 0xfb7e, 0xfb80, 0xf7e4, 0xfb81, 0xfb82, 0xfb83, 0xfb84, 0xf7e5, /*0x80-0x87*/ 0xf7e6, 0xfb85, 0xfb86, 0xf7e7, 0xfb87, 0xfb88, 0xfb89, 0xfb8a, /*0x88-0x8f*/ 0xfb8b, 0xfb8c, 0xf7e8, 0xc2b4, 0xfb8d, 0xfb8e, 0xfb8f, 0xfb90, /*0x90-0x97*/ 0xfb91, 0xfb92, 0xfb93, 0xfb94, 0xfb95, 0xf7ea, 0xfb96, 0xf7eb, /*0x98-0x9f*/ 0xfb97, 0xfb98, 0xfb99, 0xfb9a, 0xfb9b, 0xfb9c, 0xc2f3, 0xfb9d, /*0xa0-0xa7*/ 0xfb9e, 0xfb9f, 0xfba0, 0xfc40, 0xfc41, 0xfc42, 0xfc43, 0xfc44, /*0xa8-0xaf*/ 0xfc45, 0xfc46, 0xfc47, 0xfc48, 0xf4f0, 0xfc49, 0xfc4a, 0xfc4b, /*0xb0-0xb7*/ 0xf4ef, 0xfc4c, 0xfc4d, 0xc2e9, 0xfc4e, 0xf7e1, 0xf7e2, 0xfc4f, /*0xb8-0xbf*/ 0xfc50, 0xfc51, 0xfc52, 0xfc53, 0xbbc6, 0xfc54, 0xfc55, 0xfc56, /*0xc0-0xc7*/ 0xfc57, 0xd9e4, 0xfc58, 0xfc59, 0xfc5a, 0xcaf2, 0xc0e8, 0xf0a4, /*0xc8-0xcf*/ 0xfc5b, 0xbada, 0xfc5c, 0xfc5d, 0xc7ad, 0xfc5e, 0xfc5f, 0xfc60, /*0xd0-0xd7*/ 0xc4ac, 0xfc61, 0xfc62, 0xf7ec, 0xf7ed, 0xf7ee, 0xfc63, 0xf7f0, /*0xd8-0xdf*/ 0xf7ef, 0xfc64, 0xf7f1, 0xfc65, 0xfc66, 0xf7f4, 0xfc67, 0xf7f3, /*0xe0-0xe7*/ 0xfc68, 0xf7f2, 0xf7f5, 0xfc69, 0xfc6a, 0xfc6b, 0xfc6c, 0xf7f6, /*0xe8-0xef*/ 0xfc6d, 0xfc6e, 0xfc6f, 0xfc70, 0xfc71, 0xfc72, 0xfc73, 0xfc74, /*0xf0-0xf7*/ 0xfc75, 0xede9, 0xfc76, 0xedea, 0xedeb, 0xfc77, 0xf6bc, 0xfc78, /*0xf8-0xff*/ /* 0x9f00 */ 0xfc79, 0xfc7a, 0xfc7b, 0xfc7c, 0xfc7d, 0xfc7e, 0xfc80, 0xfc81, /*0x00-0x07*/ 0xfc82, 0xfc83, 0xfc84, 0xf6bd, 0xfc85, 0xf6be, 0xb6a6, 0xfc86, /*0x08-0x0f*/ 0xd8be, 0xfc87, 0xfc88, 0xb9c4, 0xfc89, 0xfc8a, 0xfc8b, 0xd8bb, /*0x10-0x17*/ 0xfc8c, 0xdcb1, 0xfc8d, 0xfc8e, 0xfc8f, 0xfc90, 0xfc91, 0xfc92, /*0x18-0x1f*/ 0xcaf3, 0xfc93, 0xf7f7, 0xfc94, 0xfc95, 0xfc96, 0xfc97, 0xfc98, /*0x20-0x27*/ 0xfc99, 0xfc9a, 0xfc9b, 0xfc9c, 0xf7f8, 0xfc9d, 0xfc9e, 0xf7f9, /*0x28-0x2f*/ 0xfc9f, 0xfca0, 0xfd40, 0xfd41, 0xfd42, 0xfd43, 0xfd44, 0xf7fb, /*0x30-0x37*/ 0xfd45, 0xf7fa, 0xfd46, 0xb1c7, 0xfd47, 0xf7fc, 0xf7fd, 0xfd48, /*0x38-0x3f*/ 0xfd49, 0xfd4a, 0xfd4b, 0xfd4c, 0xf7fe, 0xfd4d, 0xfd4e, 0xfd4f, /*0x40-0x47*/ 0xfd50, 0xfd51, 0xfd52, 0xfd53, 0xfd54, 0xfd55, 0xfd56, 0xfd57, /*0x48-0x4f*/ 0xc6eb, 0xecb4, 0xfd58, 0xfd59, 0xfd5a, 0xfd5b, 0xfd5c, 0xfd5d, /*0x50-0x57*/ 0xfd5e, 0xfd5f, 0xfd60, 0xfd61, 0xfd62, 0xfd63, 0xfd64, 0xfd65, /*0x58-0x5f*/ 0xfd66, 0xfd67, 0xfd68, 0xfd69, 0xfd6a, 0xfd6b, 0xfd6c, 0xfd6d, /*0x60-0x67*/ 0xfd6e, 0xfd6f, 0xfd70, 0xfd71, 0xfd72, 0xfd73, 0xfd74, 0xfd75, /*0x68-0x6f*/ 0xfd76, 0xfd77, 0xfd78, 0xfd79, 0xfd7a, 0xfd7b, 0xfd7c, 0xfd7d, /*0x70-0x77*/ 0xfd7e, 0xfd80, 0xfd81, 0xfd82, 0xfd83, 0xfd84, 0xfd85, 0xb3dd, /*0x78-0x7f*/ 0xf6b3, 0xfd86, 0xfd87, 0xf6b4, 0xc1e4, 0xf6b5, 0xf6b6, 0xf6b7, /*0x80-0x87*/ 0xf6b8, 0xf6b9, 0xf6ba, 0xc8a3, 0xf6bb, 0xfd88, 0xfd89, 0xfd8a, /*0x88-0x8f*/ 0xfd8b, 0xfd8c, 0xfd8d, 0xfd8e, 0xfd8f, 0xfd90, 0xfd91, 0xfd92, /*0x90-0x97*/ 0xfd93, 0xc1fa, 0xb9a8, 0xede8, 0xfd94, 0xfd95, 0xfd96, 0xb9ea, /*0x98-0x9f*/ 0xd9df, 0xfd97, 0xfd98, 0xfd99, 0xfd9a, 0xfd9b, 0x0000, 0x0000, /*0xa0-0xa7*/ }; static const unsigned short gbk_pagef9a[32] = { 0x0000, 0xfd9d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x78-0x7f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x80-0x87*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x88-0x8f*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfd9e, 0x0000, 0x0000, /*0x90-0x97*/ }; static const unsigned short gbk_pagef9b[24] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfd9f, /*0xe0-0xe7*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xe8-0xef*/ 0x0000, 0xfda0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xf0-0xf7*/ }; static const unsigned short gbk_pagefa[40] = { 0x0000, 0x0000, 0x0000, 0x0000, 0xfe40, 0xfe41, 0xfe42, 0xfe43, /*0x08-0x0f*/ 0x0000, 0xfe44, 0x0000, 0xfe45, 0xfe46, 0x0000, 0x0000, 0x0000, /*0x10-0x17*/ 0xfe47, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe48, /*0x18-0x1f*/ 0xfe49, 0xfe4a, 0x0000, 0xfe4b, 0xfe4c, 0x0000, 0x0000, 0xfe4d, /*0x20-0x27*/ 0xfe4e, 0xfe4f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ }; static const unsigned short gbk_pagefe[64] = { 0xa955, 0xa6f2, 0x0000, 0xa6f4, 0xa6f5, 0xa6e0, 0xa6e1, 0xa6f0, /*0x30-0x37*/ 0xa6f1, 0xa6e2, 0xa6e3, 0xa6ee, 0xa6ef, 0xa6e6, 0xa6e7, 0xa6e4, /*0x38-0x3f*/ 0xa6e5, 0xa6e8, 0xa6e9, 0xa6ea, 0xa6eb, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ 0x0000, 0xa968, 0xa969, 0xa96a, 0xa96b, 0xa96c, 0xa96d, 0xa96e, /*0x48-0x4f*/ 0xa96f, 0xa970, 0xa971, 0x0000, 0xa972, 0xa973, 0xa974, 0xa975, /*0x50-0x57*/ 0x0000, 0xa976, 0xa977, 0xa978, 0xa979, 0xa97a, 0xa97b, 0xa97c, /*0x58-0x5f*/ 0xa97d, 0xa97e, 0xa980, 0xa981, 0xa982, 0xa983, 0xa984, 0x0000, /*0x60-0x67*/ 0xa985, 0xa986, 0xa987, 0xa988, 0x0000, 0x0000, 0x0000, 0x0000, /*0x68-0x6f*/ }; static const unsigned short gbk_pageffa[96] = { 0x0000, 0xa3a1, 0xa3a2, 0xa3a3, 0xa1e7, 0xa3a5, 0xa3a6, 0xa3a7, /*0x00-0x07*/ 0xa3a8, 0xa3a9, 0xa3aa, 0xa3ab, 0xa3ac, 0xa3ad, 0xa3ae, 0xa3af, /*0x08-0x0f*/ 0xa3b0, 0xa3b1, 0xa3b2, 0xa3b3, 0xa3b4, 0xa3b5, 0xa3b6, 0xa3b7, /*0x10-0x17*/ 0xa3b8, 0xa3b9, 0xa3ba, 0xa3bb, 0xa3bc, 0xa3bd, 0xa3be, 0xa3bf, /*0x18-0x1f*/ 0xa3c0, 0xa3c1, 0xa3c2, 0xa3c3, 0xa3c4, 0xa3c5, 0xa3c6, 0xa3c7, /*0x20-0x27*/ 0xa3c8, 0xa3c9, 0xa3ca, 0xa3cb, 0xa3cc, 0xa3cd, 0xa3ce, 0xa3cf, /*0x28-0x2f*/ 0xa3d0, 0xa3d1, 0xa3d2, 0xa3d3, 0xa3d4, 0xa3d5, 0xa3d6, 0xa3d7, /*0x30-0x37*/ 0xa3d8, 0xa3d9, 0xa3da, 0xa3db, 0xa3dc, 0xa3dd, 0xa3de, 0xa3df, /*0x38-0x3f*/ 0xa3e0, 0xa3e1, 0xa3e2, 0xa3e3, 0xa3e4, 0xa3e5, 0xa3e6, 0xa3e7, /*0x40-0x47*/ 0xa3e8, 0xa3e9, 0xa3ea, 0xa3eb, 0xa3ec, 0xa3ed, 0xa3ee, 0xa3ef, /*0x48-0x4f*/ 0xa3f0, 0xa3f1, 0xa3f2, 0xa3f3, 0xa3f4, 0xa3f5, 0xa3f6, 0xa3f7, /*0x50-0x57*/ 0xa3f8, 0xa3f9, 0xa3fa, 0xa3fb, 0xa3fc, 0xa3fd, 0xa1ab, 0x0000, /*0x58-0x5f*/ }; static const unsigned short gbk_pageffb[8] = { 0xa1e9, 0xa1ea, 0xa956, 0xa3fe, 0xa957, 0xa3a4, 0x0000, 0x0000, /*0xe0-0xe7*/ }; static int gbk_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { if (n >= 2) { unsigned short c = 0; if (wc >= 0x00a0 && wc < 0x0170) c = gbk_page00[wc-0x00a0]; else if (wc >= 0x01c8 && wc < 0x01e0) c = gbk_page01[wc-0x01c8]; else if (wc >= 0x0250 && wc < 0x0268) c = gbk_page02a[wc-0x0250]; else if (wc >= 0x02c0 && wc < 0x02e0) c = gbk_page02b[wc-0x02c0]; else if (wc >= 0x0390 && wc < 0x03d0) c = gbk_page03[wc-0x0390]; else if (wc >= 0x0400 && wc < 0x0458) c = gbk_page04[wc-0x0400]; else if (wc >= 0x2010 && wc < 0x2040) c = gbk_page20[wc-0x2010]; else if (wc >= 0x2100 && wc < 0x21a0) c = gbk_page21[wc-0x2100]; else if (wc >= 0x2208 && wc < 0x22c0) c = gbk_page22[wc-0x2208]; else if (wc == 0x2312) c = 0xa1d0; else if (wc >= 0x2460 && wc < 0x24a0) c = gbk_page24[wc-0x2460]; else if (wc >= 0x2500 && wc < 0x25e8) c = gbk_page25[wc-0x2500]; else if (wc >= 0x2600 && wc < 0x2648) c = gbk_page26[wc-0x2600]; else if (wc >= 0x3000 && wc < 0x3130) c = gbk_page30[wc-0x3000]; else if (wc >= 0x3220 && wc < 0x3238) c = gbk_page32[wc-0x3220]; else if (wc == 0x32a3) c = 0xa949; else if (wc >= 0x3388 && wc < 0x33d8) c = gbk_page33[wc-0x3388]; else if (wc >= 0x4e00 && wc < 0x9fa8) c = gbk_page4e[wc-0x4e00]; else if (wc == 0xf92c) c = 0xfd9c; else if (wc >= 0xf978 && wc < 0xf998) c = gbk_pagef9a[wc-0xf978]; else if (wc >= 0xf9e0 && wc < 0xf9f8) c = gbk_pagef9b[wc-0xf9e0]; else if (wc >= 0xfa08 && wc < 0xfa30) c = gbk_pagefa[wc-0xfa08]; else if (wc >= 0xfe30 && wc < 0xfe70) c = gbk_pagefe[wc-0xfe30]; else if (wc >= 0xff00 && wc < 0xff60) c = gbk_pageffa[wc-0xff00]; else if (wc >= 0xffe0 && wc < 0xffe8) c = gbk_pageffb[wc-0xffe0]; if (c != 0) { r[0] = (c >> 8); r[1] = (c & 0xff); return 2; } return RET_ILSEQ; } return RET_TOOSMALL; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/georgian_academy.h0000644000000000000000000000621113614532331021625 0ustar /* * GEORGIAN-ACADEMY */ static const unsigned short georgian_academy_2uni[32] = { /* 0x80 */ 0x0080, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x008e, 0x008f, /* 0x90 */ 0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x009e, 0x0178, }; static int georgian_academy_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c >= 0x80 && c < 0xa0) *pwc = (ucs4_t) georgian_academy_2uni[c-0x80]; else if (c >= 0xc0 && c < 0xe7) *pwc = (ucs4_t) c + 0x1010; else *pwc = (ucs4_t) c; return 1; } static const unsigned char georgian_academy_page00[32] = { 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ }; static const unsigned char georgian_academy_page01[72] = { 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ }; static const unsigned char georgian_academy_page02[32] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ }; static const unsigned char georgian_academy_page20[48] = { 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ }; static int georgian_academy_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x0080) { *r = wc; return 1; } else if (wc >= 0x0080 && wc < 0x00a0) c = georgian_academy_page00[wc-0x0080]; else if ((wc >= 0x00a0 && wc < 0x00c0) || (wc >= 0x00e7 && wc < 0x0100)) c = wc; else if (wc >= 0x0150 && wc < 0x0198) c = georgian_academy_page01[wc-0x0150]; else if (wc >= 0x02c0 && wc < 0x02e0) c = georgian_academy_page02[wc-0x02c0]; else if (wc >= 0x10d0 && wc < 0x10f7) c = wc-0x1010; else if (wc >= 0x2010 && wc < 0x2040) c = georgian_academy_page20[wc-0x2010]; else if (wc == 0x2122) c = 0x99; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/georgian_ps.h0000644000000000000000000000761613614532331020656 0ustar /* * GEORGIAN-PS */ static const unsigned short georgian_ps_2uni_1[32] = { /* 0x80 */ 0x0080, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x008e, 0x008f, /* 0x90 */ 0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x009e, 0x0178, }; static const unsigned short georgian_ps_2uni_2[39] = { /* 0xc0 */ 0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10f1, 0x10d7, 0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10f2, 0x10dd, /* 0xd0 */ 0x10de, 0x10df, 0x10e0, 0x10e1, 0x10e2, 0x10f3, 0x10e3, 0x10e4, 0x10e5, 0x10e6, 0x10e7, 0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, /* 0xe0 */ 0x10ed, 0x10ee, 0x10f4, 0x10ef, 0x10f0, 0x10f5, }; static int georgian_ps_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c >= 0x80 && c < 0xa0) *pwc = (ucs4_t) georgian_ps_2uni_1[c-0x80]; else if (c >= 0xc0 && c < 0xe6) *pwc = (ucs4_t) georgian_ps_2uni_2[c-0xc0]; else *pwc = (ucs4_t) c; return 1; } static const unsigned char georgian_ps_page00[32] = { 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ }; static const unsigned char georgian_ps_page01[72] = { 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ }; static const unsigned char georgian_ps_page02[32] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ }; static const unsigned char georgian_ps_page10[40] = { 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc8, /* 0xd0-0xd7 */ 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xcf, 0xd0, 0xd1, /* 0xd8-0xdf */ 0xd2, 0xd3, 0xd4, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, /* 0xe0-0xe7 */ 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe3, /* 0xe8-0xef */ 0xe4, 0xc7, 0xce, 0xd5, 0xe2, 0xe5, 0x00, 0x00, /* 0xf0-0xf7 */ }; static const unsigned char georgian_ps_page20[48] = { 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ }; static int georgian_ps_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x0080) { *r = wc; return 1; } else if (wc >= 0x0080 && wc < 0x00a0) c = georgian_ps_page00[wc-0x0080]; else if ((wc >= 0x00a0 && wc < 0x00c0) || (wc >= 0x00e6 && wc < 0x0100)) c = wc; else if (wc >= 0x0150 && wc < 0x0198) c = georgian_ps_page01[wc-0x0150]; else if (wc >= 0x02c0 && wc < 0x02e0) c = georgian_ps_page02[wc-0x02c0]; else if (wc >= 0x10d0 && wc < 0x10f8) c = georgian_ps_page10[wc-0x10d0]; else if (wc >= 0x2010 && wc < 0x2040) c = georgian_ps_page20[wc-0x2010]; else if (wc == 0x2122) c = 0x99; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_10.h0000644000000000000000000000654713614532331020013 0ustar /* * ISO-8859-10 */ static const unsigned short iso8859_10_2uni[96] = { /* 0xa0 */ 0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x0128, 0x0136, 0x00a7, 0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a, /* 0xb0 */ 0x00b0, 0x0105, 0x0113, 0x0123, 0x012b, 0x0129, 0x0137, 0x00b7, 0x013c, 0x0111, 0x0161, 0x0167, 0x017e, 0x2015, 0x016b, 0x014b, /* 0xc0 */ 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x00cf, /* 0xd0 */ 0x00d0, 0x0145, 0x014c, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x0168, 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, /* 0xe0 */ 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x00ef, /* 0xf0 */ 0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169, 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138, }; static int iso8859_10_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0xa0) *pwc = (ucs4_t) c; else *pwc = (ucs4_t) iso8859_10_2uni[c-0xa0]; return 1; } static const unsigned char iso8859_10_page00[224] = { 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, /* 0xb0-0xb7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0x00, /* 0xc0-0xc7 */ 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0x00, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0x00, /* 0xd0-0xd7 */ 0xd8, 0x00, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ 0x00, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0x00, /* 0xe0-0xe7 */ 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0xf0, 0x00, 0x00, 0xf3, 0xf4, 0xf5, 0xf6, 0x00, /* 0xf0-0xf7 */ 0xf8, 0x00, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */ /* 0x0100 */ 0xc0, 0xe0, 0x00, 0x00, 0xa1, 0xb1, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */ 0xa9, 0xb9, 0xa2, 0xb2, 0x00, 0x00, 0xcc, 0xec, /* 0x10-0x17 */ 0xca, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0xa3, 0xb3, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0xa5, 0xb5, 0xa4, 0xb4, 0x00, 0x00, 0xc7, 0xe7, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0xb6, /* 0x30-0x37 */ 0xff, 0x00, 0x00, 0xa8, 0xb8, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xf1, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0xaf, 0xbf, 0xd2, 0xf2, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0xaa, 0xba, 0x00, 0x00, 0x00, 0x00, 0xab, 0xbb, /* 0x60-0x67 */ 0xd7, 0xf7, 0xae, 0xbe, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0xd9, 0xf9, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xbc, 0x00, /* 0x78-0x7f */ }; static int iso8859_10_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x0180) c = iso8859_10_page00[wc-0x00a0]; else if (wc == 0x2015) c = 0xbd; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_11.h0000644000000000000000000000465013614532331020005 0ustar /* * ISO8859-11 */ static const unsigned short iso8859_11_2uni[96] = { /* 0xa0 */ 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, /* 0xb0 */ 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, /* 0xc0 */ 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, /* 0xd0 */ 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, 0x0e38, 0x0e39, 0x0e3a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0e3f, /* 0xe0 */ 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, /* 0xf0 */ 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0xfffd, 0xfffd, 0xfffd, 0xfffd, }; static int iso8859_11_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0x80) { *pwc = (ucs4_t) c; return 1; } else if (c < 0xa0) { } else { unsigned short wc = iso8859_11_2uni[c-0xa0]; if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 1; } } return RET_ILSEQ; } static const unsigned char iso8859_11_page0e[96] = { 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x08-0x0f */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0x38-0x3f */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */ 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ }; static int iso8859_11_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x0080 || wc == 0x00a0) { *r = wc; return 1; } else if (wc >= 0x0e00 && wc < 0x0e60) c = iso8859_11_page0e[wc-0x0e00]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_13.h0000644000000000000000000000700713614532331020006 0ustar /* * ISO-8859-13 */ static const unsigned short iso8859_13_2uni[96] = { /* 0xa0 */ 0x00a0, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7, 0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6, /* 0xb0 */ 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x201c, 0x00b5, 0x00b6, 0x00b7, 0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6, /* 0xc0 */ 0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112, 0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b, /* 0xd0 */ 0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7, 0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df, /* 0xe0 */ 0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113, 0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c, /* 0xf0 */ 0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7, 0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019, }; static int iso8859_13_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0xa0) *pwc = (ucs4_t) c; else *pwc = (ucs4_t) iso8859_13_2uni[c-0xa0]; return 1; } static const unsigned char iso8859_13_page00[224] = { 0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0x00, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0x00, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ 0x00, 0x00, 0x00, 0x00, 0xc4, 0xc5, 0xaf, 0x00, /* 0xc0-0xc7 */ 0x00, 0xc9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0xd3, 0x00, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xa8, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ 0x00, 0x00, 0x00, 0x00, 0xe4, 0xe5, 0xbf, 0x00, /* 0xe0-0xe7 */ 0x00, 0xe9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ 0x00, 0x00, 0x00, 0xf3, 0x00, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ 0xb8, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ /* 0x0100 */ 0xc2, 0xe2, 0x00, 0x00, 0xc0, 0xe0, 0xc3, 0xe3, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */ 0x00, 0x00, 0xc7, 0xe7, 0x00, 0x00, 0xcb, 0xeb, /* 0x10-0x17 */ 0xc6, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0xcc, 0xec, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0xce, 0xee, 0x00, 0x00, 0xc1, 0xe1, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xed, /* 0x30-0x37 */ 0x00, 0x00, 0x00, 0xcf, 0xef, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0xd9, 0xf9, 0xd1, 0xf1, 0xd2, 0xf2, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0x00, 0x00, 0xd4, 0xf4, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xba, /* 0x50-0x57 */ 0x00, 0x00, 0xda, 0xfa, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0xdb, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0xd8, 0xf8, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0xca, 0xea, 0xdd, 0xfd, 0xde, 0xfe, 0x00, /* 0x78-0x7f */ }; static const unsigned char iso8859_13_page20[8] = { 0x00, 0xff, 0x00, 0x00, 0xb4, 0xa1, 0xa5, 0x00, /* 0x18-0x1f */ }; static int iso8859_13_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x0180) c = iso8859_13_page00[wc-0x00a0]; else if (wc >= 0x2018 && wc < 0x2020) c = iso8859_13_page20[wc-0x2018]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_14.h0000644000000000000000000001055113614532331020005 0ustar /* * ISO-8859-14 */ static const unsigned short iso8859_14_2uni[96] = { /* 0xa0 */ 0x00a0, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7, 0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178, /* 0xb0 */ 0x1e1e, 0x1e1f, 0x0120, 0x0121, 0x1e40, 0x1e41, 0x00b6, 0x1e56, 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, /* 0xc0 */ 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, /* 0xd0 */ 0x0174, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x1e6a, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x0176, 0x00df, /* 0xe0 */ 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, /* 0xf0 */ 0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff, }; static int iso8859_14_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c >= 0xa0) *pwc = (ucs4_t) iso8859_14_2uni[c-0xa0]; else *pwc = (ucs4_t) c; return 1; } static const unsigned char iso8859_14_page00[96] = { 0xa0, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ 0x00, 0xa9, 0x00, 0x00, 0x00, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb6, 0x00, /* 0xb0-0xb7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0x00, /* 0xd0-0xd7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x00, /* 0xf0-0xf7 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0x00, 0xff, /* 0xf8-0xff */ }; static const unsigned char iso8859_14_page01_0[32] = { 0x00, 0x00, 0xa4, 0xa5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0xb2, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ }; static const unsigned char iso8859_14_page01_1[16] = { 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0, 0xde, 0xfe, /* 0x70-0x77 */ 0xaf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ }; static const unsigned char iso8859_14_page1e_0[136] = { 0x00, 0x00, 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0x00, 0xa6, 0xab, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xb1, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0xb4, 0xb5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, 0xb9, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0xbb, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0xd7, 0xf7, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0xa8, 0xb8, 0xaa, 0xba, 0xbd, 0xbe, 0x00, 0x00, /* 0x80-0x87 */ }; static const unsigned char iso8859_14_page1e_1[8] = { 0x00, 0x00, 0xac, 0xbc, 0x00, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */ }; static int iso8859_14_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x0100) c = iso8859_14_page00[wc-0x00a0]; else if (wc >= 0x0108 && wc < 0x0128) c = iso8859_14_page01_0[wc-0x0108]; else if (wc >= 0x0170 && wc < 0x0180) c = iso8859_14_page01_1[wc-0x0170]; else if (wc >= 0x1e00 && wc < 0x1e88) c = iso8859_14_page1e_0[wc-0x1e00]; else if (wc >= 0x1ef0 && wc < 0x1ef8) c = iso8859_14_page1e_1[wc-0x1ef0]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_15.h0000644000000000000000000000346613614532331020015 0ustar /* * ISO-8859-15 */ static const unsigned short iso8859_15_2uni[32] = { /* 0xa0 */ 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7, 0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, /* 0xb0 */ 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7, 0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf, }; static int iso8859_15_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c >= 0xa0 && c < 0xc0) *pwc = (ucs4_t) iso8859_15_2uni[c-0xa0]; else *pwc = (ucs4_t) c; return 1; } static const unsigned char iso8859_15_page00[32] = { 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0xa5, 0x00, 0xa7, /* 0xa0-0xa7 */ 0x00, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0x00, 0xb9, 0xba, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0xb8-0xbf */ }; static const unsigned char iso8859_15_page01[48] = { 0x00, 0x00, 0xbc, 0xbd, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0xa6, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0xbe, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb8, 0x00, /* 0x78-0x7f */ }; static int iso8859_15_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x00c0) c = iso8859_15_page00[wc-0x00a0]; else if (wc >= 0x00c0 && wc < 0x0100) c = wc; else if (wc >= 0x0150 && wc < 0x0180) c = iso8859_15_page01[wc-0x0150]; else if (wc == 0x20ac) c = 0xa4; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_16.h0000644000000000000000000000736513614532331020020 0ustar /* * ISO-8859-16 */ static const unsigned short iso8859_16_2uni[96] = { /* 0xa0 */ 0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7, 0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b, /* 0xb0 */ 0x00b0, 0x00b1, 0x010c, 0x0142, 0x017d, 0x201d, 0x00b6, 0x00b7, 0x017e, 0x010d, 0x0219, 0x00bb, 0x0152, 0x0153, 0x0178, 0x017c, /* 0xc0 */ 0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0106, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, /* 0xd0 */ 0x0110, 0x0143, 0x00d2, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x015a, 0x0170, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0118, 0x021a, 0x00df, /* 0xe0 */ 0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x0107, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, /* 0xf0 */ 0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b, 0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff, }; static int iso8859_16_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0xa0) *pwc = (ucs4_t) c; else *pwc = (ucs4_t) iso8859_16_2uni[c-0xa0]; return 1; } static const unsigned char iso8859_16_page00[224] = { 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ 0x00, 0xa9, 0x00, 0xab, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ 0xb0, 0xb1, 0x00, 0x00, 0x00, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0x00, 0x00, 0xd2, 0xd3, 0xd4, 0x00, 0xd6, 0x00, /* 0xd0-0xd7 */ 0x00, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ 0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0xe7, /* 0xe0-0xe7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0x00, 0x00, 0xf2, 0xf3, 0xf4, 0x00, 0xf6, 0x00, /* 0xf0-0xf7 */ 0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff, /* 0xf8-0xff */ /* 0x0100 */ 0x00, 0x00, 0xc3, 0xe3, 0xa1, 0xa2, 0xc5, 0xe5, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0xb2, 0xb9, 0x00, 0x00, /* 0x08-0x0f */ 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0xa3, 0xb3, 0xd1, 0xf1, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0xd5, 0xf5, 0xbc, 0xbd, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0xd7, 0xf7, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0xa6, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0xd8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0xbe, 0xac, 0xae, 0xaf, 0xbf, 0xb4, 0xb8, 0x00, /* 0x78-0x7f */ }; static const unsigned char iso8859_16_page02[8] = { 0xaa, 0xba, 0xde, 0xfe, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ }; static const unsigned char iso8859_16_page20[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0xa5, 0x00, /* 0x18-0x1f */ }; static int iso8859_16_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x0180) c = iso8859_16_page00[wc-0x00a0]; else if (wc >= 0x0218 && wc < 0x0220) c = iso8859_16_page02[wc-0x0218]; else if (wc >= 0x2018 && wc < 0x2020) c = iso8859_16_page20[wc-0x2018]; else if (wc == 0x20ac) c = 0xa4; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_1.h0000644000000000000000000000050513614532331017717 0ustar /* * ISO-8859-1 */ static int iso8859_1_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; *pwc = (ucs4_t) c; return 1; } static int iso8859_1_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { if (wc < 0x0100) { *r = wc; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_2.h0000644000000000000000000000730513614532331017725 0ustar /* * ISO-8859-2 */ static const unsigned short iso8859_2_2uni[96] = { /* 0xa0 */ 0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b, /* 0xb0 */ 0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7, 0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, /* 0xc0 */ 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, /* 0xd0 */ 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, /* 0xe0 */ 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, /* 0xf0 */ 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, }; static int iso8859_2_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0xa0) *pwc = (ucs4_t) c; else *pwc = (ucs4_t) iso8859_2_2uni[c-0xa0]; return 1; } static const unsigned char iso8859_2_page00[224] = { 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ 0xb0, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 0x00, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0x00, 0xc7, /* 0xc0-0xc7 */ 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0x00, 0x00, 0xda, 0x00, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */ 0x00, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */ 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0x00, /* 0xe8-0xef */ 0x00, 0x00, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7, /* 0xf0-0xf7 */ 0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ /* 0x0100 */ 0x00, 0x00, 0xc3, 0xe3, 0xa1, 0xb1, 0xc6, 0xe6, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef, /* 0x08-0x0f */ 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0xca, 0xea, 0xcc, 0xec, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0xc5, 0xe5, 0x00, 0x00, 0xa5, 0xb5, 0x00, /* 0x38-0x3f */ 0x00, 0xa3, 0xb3, 0xd1, 0xf1, 0x00, 0x00, 0xd2, /* 0x40-0x47 */ 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0xd5, 0xf5, 0x00, 0x00, 0xc0, 0xe0, 0x00, 0x00, /* 0x50-0x57 */ 0xd8, 0xf8, 0xa6, 0xb6, 0x00, 0x00, 0xaa, 0xba, /* 0x58-0x5f */ 0xa9, 0xb9, 0xde, 0xfe, 0xab, 0xbb, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd9, 0xf9, /* 0x68-0x6f */ 0xdb, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0xac, 0xbc, 0xaf, 0xbf, 0xae, 0xbe, 0x00, /* 0x78-0x7f */ }; static const unsigned char iso8859_2_page02[32] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00, /* 0xd8-0xdf */ }; static int iso8859_2_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x0180) c = iso8859_2_page00[wc-0x00a0]; else if (wc >= 0x02c0 && wc < 0x02e0) c = iso8859_2_page02[wc-0x02c0]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_3.h0000644000000000000000000000723713614532331017732 0ustar /* * ISO-8859-3 */ static const unsigned short iso8859_3_2uni[96] = { /* 0xa0 */ 0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0xfffd, 0x0124, 0x00a7, 0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0xfffd, 0x017b, /* 0xb0 */ 0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7, 0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, 0xfffd, 0x017c, /* 0xc0 */ 0x00c0, 0x00c1, 0x00c2, 0xfffd, 0x00c4, 0x010a, 0x0108, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, /* 0xd0 */ 0xfffd, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7, 0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df, /* 0xe0 */ 0x00e0, 0x00e1, 0x00e2, 0xfffd, 0x00e4, 0x010b, 0x0109, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, /* 0xf0 */ 0xfffd, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7, 0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9, }; static int iso8859_3_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0xa0) { *pwc = (ucs4_t) c; return 1; } else { unsigned short wc = iso8859_3_2uni[c-0xa0]; if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 1; } } return RET_ILSEQ; } static const unsigned char iso8859_3_page00[96] = { 0xa0, 0x00, 0x00, 0xa3, 0xa4, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ 0xb0, 0x00, 0xb2, 0xb3, 0xb4, 0xb5, 0x00, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0x00, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0x00, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ 0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0x00, 0xf6, 0xf7, /* 0xf0-0xf7 */ 0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ }; static const unsigned char iso8859_3_page01[120] = { 0xc6, 0xe6, 0xc5, 0xe5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x00, 0x00, 0x00, 0x00, 0xd8, 0xf8, 0xab, 0xbb, /* 0x18-0x1f */ 0xd5, 0xf5, 0x00, 0x00, 0xa6, 0xb6, 0xa1, 0xb1, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0xa9, 0xb9, 0x00, 0x00, 0xac, 0xbc, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, 0xaa, 0xba, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0xdd, 0xfd, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0xaf, 0xbf, 0x00, 0x00, 0x00, /* 0x78-0x7f */ }; static const unsigned char iso8859_3_page02[8] = { 0xa2, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ }; static int iso8859_3_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x0100) c = iso8859_3_page00[wc-0x00a0]; else if (wc >= 0x0108 && wc < 0x0180) c = iso8859_3_page01[wc-0x0108]; else if (wc >= 0x02d8 && wc < 0x02e0) c = iso8859_3_page02[wc-0x02d8]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_4.h0000644000000000000000000000730513614532331017727 0ustar /* * ISO-8859-4 */ static const unsigned short iso8859_4_2uni[96] = { /* 0xa0 */ 0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x0128, 0x013b, 0x00a7, 0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af, /* 0xb0 */ 0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7, 0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b, /* 0xc0 */ 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a, /* 0xd0 */ 0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df, /* 0xe0 */ 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b, /* 0xf0 */ 0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9, }; static int iso8859_4_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0xa0) *pwc = (ucs4_t) c; else *pwc = (ucs4_t) iso8859_4_2uni[c-0xa0]; return 1; } static const unsigned char iso8859_4_page00[224] = { 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0xaf, /* 0xa8-0xaf */ 0xb0, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0x00, /* 0xc0-0xc7 */ 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xd8, 0x00, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ 0x00, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0x00, /* 0xe0-0xe7 */ 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0x00, /* 0xe8-0xef */ 0x00, 0x00, 0x00, 0x00, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ 0xf8, 0x00, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ /* 0x0100 */ 0xc0, 0xe0, 0x00, 0x00, 0xa1, 0xb1, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */ 0xd0, 0xf0, 0xaa, 0xba, 0x00, 0x00, 0xcc, 0xec, /* 0x10-0x17 */ 0xca, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0xab, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0xa5, 0xb5, 0xcf, 0xef, 0x00, 0x00, 0xc7, 0xe7, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd3, 0xf3, /* 0x30-0x37 */ 0xa2, 0x00, 0x00, 0xa6, 0xb6, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xf1, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0xbd, 0xbf, 0xd2, 0xf2, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0xb3, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0xa9, 0xb9, 0x00, 0x00, 0x00, 0x00, 0xac, 0xbc, /* 0x60-0x67 */ 0xdd, 0xfd, 0xde, 0xfe, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0xd9, 0xf9, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xbe, 0x00, /* 0x78-0x7f */ }; static const unsigned char iso8859_4_page02[32] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 0x00, 0xff, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ }; static int iso8859_4_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x0180) c = iso8859_4_page00[wc-0x00a0]; else if (wc >= 0x02c0 && wc < 0x02e0) c = iso8859_4_page02[wc-0x02c0]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_5.h0000644000000000000000000000507013614532331017725 0ustar /* * ISO-8859-5 */ static const unsigned short iso8859_5_2uni[96] = { /* 0xa0 */ 0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f, /* 0xb0 */ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, /* 0xc0 */ 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, /* 0xd0 */ 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, /* 0xe0 */ 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, /* 0xf0 */ 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f, }; static int iso8859_5_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0xa0) *pwc = (ucs4_t) c; else *pwc = (ucs4_t) iso8859_5_2uni[c-0xa0]; return 1; } static const unsigned char iso8859_5_page00[16] = { 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, /* 0xa0-0xa7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ }; static const unsigned char iso8859_5_page04[96] = { 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, /* 0x08-0x0f */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x38-0x3f */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff, /* 0x58-0x5f */ }; static int iso8859_5_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x00b0) c = iso8859_5_page00[wc-0x00a0]; else if (wc >= 0x0400 && wc < 0x0460) c = iso8859_5_page04[wc-0x0400]; else if (wc == 0x2116) c = 0xf0; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_6.h0000644000000000000000000000477313614532331017737 0ustar /* * ISO-8859-6 */ static const unsigned short iso8859_6_2uni[96] = { /* 0xa0 */ 0x00a0, 0xfffd, 0xfffd, 0xfffd, 0x00a4, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x060c, 0x00ad, 0xfffd, 0xfffd, /* 0xb0 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x061b, 0xfffd, 0xfffd, 0xfffd, 0x061f, /* 0xc0 */ 0xfffd, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, /* 0xd0 */ 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, 0x0638, 0x0639, 0x063a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xe0 */ 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, /* 0xf0 */ 0x0650, 0x0651, 0x0652, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, }; static int iso8859_6_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0xa0) { *pwc = (ucs4_t) c; return 1; } else { unsigned short wc = iso8859_6_2uni[c-0xa0]; if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 1; } } return RET_ILSEQ; } static const unsigned char iso8859_6_page00[16] = { 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ }; static const unsigned char iso8859_6_page06[80] = { 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0x18-0x1f */ 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ 0xf0, 0xf1, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ }; static int iso8859_6_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x00b0) c = iso8859_6_page00[wc-0x00a0]; else if (wc >= 0x0608 && wc < 0x0658) c = iso8859_6_page06[wc-0x0608]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_7.h0000644000000000000000000000560713614532331017735 0ustar /* * ISO-8859-7 */ static const unsigned short iso8859_7_2uni[96] = { /* 0xa0 */ 0x00a0, 0x2018, 0x2019, 0x00a3, 0xfffd, 0xfffd, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0xfffd, 0x00ab, 0x00ac, 0x00ad, 0xfffd, 0x2015, /* 0xb0 */ 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7, 0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f, /* 0xc0 */ 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, /* 0xd0 */ 0x03a0, 0x03a1, 0xfffd, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, /* 0xe0 */ 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, /* 0xf0 */ 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0xfffd, }; static int iso8859_7_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0xa0) { *pwc = (ucs4_t) c; return 1; } else { unsigned short wc = iso8859_7_2uni[c-0xa0]; if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 1; } } return RET_ILSEQ; } static const unsigned char iso8859_7_page00[32] = { 0xa0, 0x00, 0x00, 0xa3, 0x00, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0x00, 0x00, 0xb7, /* 0xb0-0xb7 */ 0x00, 0x00, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */ }; static const unsigned char iso8859_7_page03[80] = { 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb5, 0xb6, 0x00, /* 0x80-0x87 */ 0xb8, 0xb9, 0xba, 0x00, 0xbc, 0x00, 0xbe, 0xbf, /* 0x88-0x8f */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x90-0x97 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x98-0x9f */ 0xd0, 0xd1, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xa0-0xa7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xa8-0xaf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xb0-0xb7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xb8-0xbf */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xc0-0xc7 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xc8-0xcf */ }; static const unsigned char iso8859_7_page20[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, /* 0x10-0x17 */ 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ }; static int iso8859_7_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x00c0) c = iso8859_7_page00[wc-0x00a0]; else if (wc >= 0x0380 && wc < 0x03d0) c = iso8859_7_page03[wc-0x0380]; else if (wc >= 0x2010 && wc < 0x2020) c = iso8859_7_page20[wc-0x2010]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_8.h0000644000000000000000000000571213614532331017733 0ustar /* * ISO-8859-8 */ static const unsigned short iso8859_8_2uni[96] = { /* 0xa0 */ 0x00a0, 0xfffd, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, /* 0xb0 */ 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0xfffd, /* 0xc0 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0xd0 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2017, /* 0xe0 */ 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, /* 0xf0 */ 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, 0x05e8, 0x05e9, 0x05ea, 0xfffd, 0xfffd, 0x200e, 0x200f, 0xfffd, }; static int iso8859_8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c >= 0xa0) { unsigned short wc = iso8859_8_2uni[c-0xa0]; if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 1; } } else { *pwc = (ucs4_t) c; return 1; } return RET_ILSEQ; } static const unsigned char iso8859_8_page00[88] = { 0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, /* 0xd0-0xd7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, /* 0xf0-0xf7 */ }; static const unsigned char iso8859_8_page05[32] = { 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xd0-0xd7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xd8-0xdf */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xe0-0xe7 */ 0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ }; static const unsigned char iso8859_8_page20[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0x10-0x17 */ }; static int iso8859_8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x00f8) c = iso8859_8_page00[wc-0x00a0]; else if (wc >= 0x05d0 && wc < 0x05f0) c = iso8859_8_page05[wc-0x05d0]; else if (wc >= 0x2008 && wc < 0x2018) c = iso8859_8_page20[wc-0x2008]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_9e.h0000644000000000000000000000770113614532331020101 0ustar /* * ISO-8859-9E */ static const unsigned short iso8859_9e_2uni[96] = { /* 0xa0 */ 0x00a0, 0x017d, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x012c, 0x00a7, 0x016c, 0x00a9, 0x01e6, 0x00ab, 0x014a, 0x00ad, 0x00ae, 0x01d1, /* 0xb0 */ 0x00b0, 0x017e, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x012d, 0x00b7, 0x016d, 0x00b9, 0x01e7, 0x00bb, 0x014b, 0x00bd, 0x0178, 0x01d2, /* 0xc0 */ 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x018f, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, /* 0xd0 */ 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00dd, 0x019f, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, /* 0xe0 */ 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x0259, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, /* 0xf0 */ 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00fd, 0x0275, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, }; static int iso8859_9e_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c >= 0xa0) *pwc = (ucs4_t) iso8859_9e_2uni[c-0xa0]; else *pwc = (ucs4_t) c; return 1; } static const unsigned char iso8859_9e_page00[96] = { 0xa0, 0x00, 0xa2, 0xa3, 0x00, 0xa5, 0x00, 0xa7, /* 0xa0-0xa7 */ 0x00, 0xa9, 0x00, 0xab, 0x00, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ 0xb0, 0x00, 0xb2, 0xb3, 0xb4, 0xb5, 0x00, 0xb7, /* 0xb0-0xb7 */ 0x00, 0xb9, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0x00, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0x00, /* 0xd0-0xd7 */ 0x00, 0xd9, 0xda, 0xdb, 0xdc, 0xd7, 0x00, 0xdf, /* 0xd8-0xdf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0x00, 0xe7, /* 0xe0-0xe7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x00, /* 0xf0-0xf7 */ 0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0xf7, 0x00, 0xff, /* 0xf8-0xff */ }; static const unsigned char iso8859_9e_page01[136] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0xa6, 0xb6, 0x00, 0x00, /* 0x28-0x2f */ 0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0xac, 0xbc, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0xa8, 0xb8, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0xbe, 0x00, 0x00, 0x00, 0x00, 0xa1, 0xb1, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, /* 0x88-0x8f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, /* 0x98-0x9f */ }; static const unsigned char iso8859_9e_page01_d[24] = { 0x00, 0xaf, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xba, /* 0xe0-0xe7 */ }; static int iso8859_9e_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x0100) c = iso8859_9e_page00[wc-0x00a0]; else if (wc >= 0x0118 && wc < 0x01a0) c = iso8859_9e_page01[wc-0x0118]; else if (wc >= 0x01d0 && wc < 0x01e8) c = iso8859_9e_page01_d[wc-0x01d0]; else if (wc == 0x0259) c = 0xe6; else if (wc == 0x0275) c = 0xf8; else if (wc == 0x20ac) c = 0xa4; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_9.h0000644000000000000000000000424113614532331017730 0ustar /* * ISO-8859-9 */ static const unsigned short iso8859_9_2uni[48] = { /* 0xd0 */ 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, /* 0xe0 */ 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, /* 0xf0 */ 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, }; static int iso8859_9_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c >= 0xd0) *pwc = (ucs4_t) iso8859_9_2uni[c-0xd0]; else *pwc = (ucs4_t) c; return 1; } static const unsigned char iso8859_9_page00[48] = { 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff, /* 0xf8-0xff */ }; static const unsigned char iso8859_9_page01[72] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, /* 0x58-0x5f */ }; static int iso8859_9_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00d0) { *r = wc; return 1; } else if (wc >= 0x00d0 && wc < 0x0100) c = iso8859_9_page00[wc-0x00d0]; else if (wc >= 0x0118 && wc < 0x0160) c = iso8859_9_page01[wc-0x0118]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/jisx0201.h0000644000000000000000000000145213614532331017631 0ustar /* * JISX0201.1976-0 */ static int jisx0201_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0x80) { if (c == 0x5c) *pwc = (ucs4_t) 0x00a5; else if (c == 0x7e) *pwc = (ucs4_t) 0x203e; else *pwc = (ucs4_t) c; return 1; } else { if (c >= 0xa1 && c < 0xe0) { *pwc = (ucs4_t) c + 0xfec0; return 1; } } return RET_ILSEQ; } static int jisx0201_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { if (wc < 0x0080 && !(wc == 0x005c || wc == 0x007e)) { *r = wc; return 1; } if (wc == 0x00a5) { *r = 0x5c; return 1; } if (wc == 0x203e) { *r = 0x7e; return 1; } if (wc >= 0xff61 && wc < 0xffa0) { *r = wc - 0xfec0; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/jisx0208.h0000644000000000000000000043766713614532331017665 0ustar /* * JISX0208.1990-0 */ static const unsigned short jisx0208_2uni_page21[690] = { /* 0x21 */ 0x3000, 0x3001, 0x3002, 0xff0c, 0xff0e, 0x30fb, 0xff1a, 0xff1b, 0xff1f, 0xff01, 0x309b, 0x309c, 0x00b4, 0xff40, 0x00a8, 0xff3e, 0xffe3, 0xff3f, 0x30fd, 0x30fe, 0x309d, 0x309e, 0x3003, 0x4edd, 0x3005, 0x3006, 0x3007, 0x30fc, 0x2015, 0x2010, 0xff0f, 0xff3c, 0x301c, 0x2016, 0xff5c, 0x2026, 0x2025, 0x2018, 0x2019, 0x201c, 0x201d, 0xff08, 0xff09, 0x3014, 0x3015, 0xff3b, 0xff3d, 0xff5b, 0xff5d, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, 0x300d, 0x300e, 0x300f, 0x3010, 0x3011, 0xff0b, 0x2212, 0x00b1, 0x00d7, 0x00f7, 0xff1d, 0x2260, 0xff1c, 0xff1e, 0x2266, 0x2267, 0x221e, 0x2234, 0x2642, 0x2640, 0x00b0, 0x2032, 0x2033, 0x2103, 0xffe5, 0xff04, 0x00a2, 0x00a3, 0xff05, 0xff03, 0xff06, 0xff0a, 0xff20, 0x00a7, 0x2606, 0x2605, 0x25cb, 0x25cf, 0x25ce, 0x25c7, /* 0x22 */ 0x25c6, 0x25a1, 0x25a0, 0x25b3, 0x25b2, 0x25bd, 0x25bc, 0x203b, 0x3012, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2208, 0x220b, 0x2286, 0x2287, 0x2282, 0x2283, 0x222a, 0x2229, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2227, 0x2228, 0x00ac, 0x21d2, 0x21d4, 0x2200, 0x2203, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2220, 0x22a5, 0x2312, 0x2202, 0x2207, 0x2261, 0x2252, 0x226a, 0x226b, 0x221a, 0x223d, 0x221d, 0x2235, 0x222b, 0x222c, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x212b, 0x2030, 0x266f, 0x266d, 0x266a, 0x2020, 0x2021, 0x00b6, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x25ef, /* 0x23 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xff10, 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, 0xff19, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58, 0xff59, 0xff5a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x24 */ 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, 0x3091, 0x3092, 0x3093, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x25 */ 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8, 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8, 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0, 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8, 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0, 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x26 */ 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x27 */ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x28 */ 0x2500, 0x2502, 0x250c, 0x2510, 0x2518, 0x2514, 0x251c, 0x252c, 0x2524, 0x2534, 0x253c, 0x2501, 0x2503, 0x250f, 0x2513, 0x251b, 0x2517, 0x2523, 0x2533, 0x252b, 0x253b, 0x254b, 0x2520, 0x252f, 0x2528, 0x2537, 0x253f, 0x251d, 0x2530, 0x2525, 0x2538, 0x2542, }; static const unsigned short jisx0208_2uni_page30[6398] = { /* 0x30 */ 0x4e9c, 0x5516, 0x5a03, 0x963f, 0x54c0, 0x611b, 0x6328, 0x59f6, 0x9022, 0x8475, 0x831c, 0x7a50, 0x60aa, 0x63e1, 0x6e25, 0x65ed, 0x8466, 0x82a6, 0x9bf5, 0x6893, 0x5727, 0x65a1, 0x6271, 0x5b9b, 0x59d0, 0x867b, 0x98f4, 0x7d62, 0x7dbe, 0x9b8e, 0x6216, 0x7c9f, 0x88b7, 0x5b89, 0x5eb5, 0x6309, 0x6697, 0x6848, 0x95c7, 0x978d, 0x674f, 0x4ee5, 0x4f0a, 0x4f4d, 0x4f9d, 0x5049, 0x56f2, 0x5937, 0x59d4, 0x5a01, 0x5c09, 0x60df, 0x610f, 0x6170, 0x6613, 0x6905, 0x70ba, 0x754f, 0x7570, 0x79fb, 0x7dad, 0x7def, 0x80c3, 0x840e, 0x8863, 0x8b02, 0x9055, 0x907a, 0x533b, 0x4e95, 0x4ea5, 0x57df, 0x80b2, 0x90c1, 0x78ef, 0x4e00, 0x58f1, 0x6ea2, 0x9038, 0x7a32, 0x8328, 0x828b, 0x9c2f, 0x5141, 0x5370, 0x54bd, 0x54e1, 0x56e0, 0x59fb, 0x5f15, 0x98f2, 0x6deb, 0x80e4, 0x852d, /* 0x31 */ 0x9662, 0x9670, 0x96a0, 0x97fb, 0x540b, 0x53f3, 0x5b87, 0x70cf, 0x7fbd, 0x8fc2, 0x96e8, 0x536f, 0x9d5c, 0x7aba, 0x4e11, 0x7893, 0x81fc, 0x6e26, 0x5618, 0x5504, 0x6b1d, 0x851a, 0x9c3b, 0x59e5, 0x53a9, 0x6d66, 0x74dc, 0x958f, 0x5642, 0x4e91, 0x904b, 0x96f2, 0x834f, 0x990c, 0x53e1, 0x55b6, 0x5b30, 0x5f71, 0x6620, 0x66f3, 0x6804, 0x6c38, 0x6cf3, 0x6d29, 0x745b, 0x76c8, 0x7a4e, 0x9834, 0x82f1, 0x885b, 0x8a60, 0x92ed, 0x6db2, 0x75ab, 0x76ca, 0x99c5, 0x60a6, 0x8b01, 0x8d8a, 0x95b2, 0x698e, 0x53ad, 0x5186, 0x5712, 0x5830, 0x5944, 0x5bb4, 0x5ef6, 0x6028, 0x63a9, 0x63f4, 0x6cbf, 0x6f14, 0x708e, 0x7114, 0x7159, 0x71d5, 0x733f, 0x7e01, 0x8276, 0x82d1, 0x8597, 0x9060, 0x925b, 0x9d1b, 0x5869, 0x65bc, 0x6c5a, 0x7525, 0x51f9, 0x592e, 0x5965, 0x5f80, 0x5fdc, /* 0x32 */ 0x62bc, 0x65fa, 0x6a2a, 0x6b27, 0x6bb4, 0x738b, 0x7fc1, 0x8956, 0x9d2c, 0x9d0e, 0x9ec4, 0x5ca1, 0x6c96, 0x837b, 0x5104, 0x5c4b, 0x61b6, 0x81c6, 0x6876, 0x7261, 0x4e59, 0x4ffa, 0x5378, 0x6069, 0x6e29, 0x7a4f, 0x97f3, 0x4e0b, 0x5316, 0x4eee, 0x4f55, 0x4f3d, 0x4fa1, 0x4f73, 0x52a0, 0x53ef, 0x5609, 0x590f, 0x5ac1, 0x5bb6, 0x5be1, 0x79d1, 0x6687, 0x679c, 0x67b6, 0x6b4c, 0x6cb3, 0x706b, 0x73c2, 0x798d, 0x79be, 0x7a3c, 0x7b87, 0x82b1, 0x82db, 0x8304, 0x8377, 0x83ef, 0x83d3, 0x8766, 0x8ab2, 0x5629, 0x8ca8, 0x8fe6, 0x904e, 0x971e, 0x868a, 0x4fc4, 0x5ce8, 0x6211, 0x7259, 0x753b, 0x81e5, 0x82bd, 0x86fe, 0x8cc0, 0x96c5, 0x9913, 0x99d5, 0x4ecb, 0x4f1a, 0x89e3, 0x56de, 0x584a, 0x58ca, 0x5efb, 0x5feb, 0x602a, 0x6094, 0x6062, 0x61d0, 0x6212, 0x62d0, 0x6539, /* 0x33 */ 0x9b41, 0x6666, 0x68b0, 0x6d77, 0x7070, 0x754c, 0x7686, 0x7d75, 0x82a5, 0x87f9, 0x958b, 0x968e, 0x8c9d, 0x51f1, 0x52be, 0x5916, 0x54b3, 0x5bb3, 0x5d16, 0x6168, 0x6982, 0x6daf, 0x788d, 0x84cb, 0x8857, 0x8a72, 0x93a7, 0x9ab8, 0x6d6c, 0x99a8, 0x86d9, 0x57a3, 0x67ff, 0x86ce, 0x920e, 0x5283, 0x5687, 0x5404, 0x5ed3, 0x62e1, 0x64b9, 0x683c, 0x6838, 0x6bbb, 0x7372, 0x78ba, 0x7a6b, 0x899a, 0x89d2, 0x8d6b, 0x8f03, 0x90ed, 0x95a3, 0x9694, 0x9769, 0x5b66, 0x5cb3, 0x697d, 0x984d, 0x984e, 0x639b, 0x7b20, 0x6a2b, 0x6a7f, 0x68b6, 0x9c0d, 0x6f5f, 0x5272, 0x559d, 0x6070, 0x62ec, 0x6d3b, 0x6e07, 0x6ed1, 0x845b, 0x8910, 0x8f44, 0x4e14, 0x9c39, 0x53f6, 0x691b, 0x6a3a, 0x9784, 0x682a, 0x515c, 0x7ac3, 0x84b2, 0x91dc, 0x938c, 0x565b, 0x9d28, 0x6822, 0x8305, 0x8431, /* 0x34 */ 0x7ca5, 0x5208, 0x82c5, 0x74e6, 0x4e7e, 0x4f83, 0x51a0, 0x5bd2, 0x520a, 0x52d8, 0x52e7, 0x5dfb, 0x559a, 0x582a, 0x59e6, 0x5b8c, 0x5b98, 0x5bdb, 0x5e72, 0x5e79, 0x60a3, 0x611f, 0x6163, 0x61be, 0x63db, 0x6562, 0x67d1, 0x6853, 0x68fa, 0x6b3e, 0x6b53, 0x6c57, 0x6f22, 0x6f97, 0x6f45, 0x74b0, 0x7518, 0x76e3, 0x770b, 0x7aff, 0x7ba1, 0x7c21, 0x7de9, 0x7f36, 0x7ff0, 0x809d, 0x8266, 0x839e, 0x89b3, 0x8acc, 0x8cab, 0x9084, 0x9451, 0x9593, 0x9591, 0x95a2, 0x9665, 0x97d3, 0x9928, 0x8218, 0x4e38, 0x542b, 0x5cb8, 0x5dcc, 0x73a9, 0x764c, 0x773c, 0x5ca9, 0x7feb, 0x8d0b, 0x96c1, 0x9811, 0x9854, 0x9858, 0x4f01, 0x4f0e, 0x5371, 0x559c, 0x5668, 0x57fa, 0x5947, 0x5b09, 0x5bc4, 0x5c90, 0x5e0c, 0x5e7e, 0x5fcc, 0x63ee, 0x673a, 0x65d7, 0x65e2, 0x671f, 0x68cb, 0x68c4, /* 0x35 */ 0x6a5f, 0x5e30, 0x6bc5, 0x6c17, 0x6c7d, 0x757f, 0x7948, 0x5b63, 0x7a00, 0x7d00, 0x5fbd, 0x898f, 0x8a18, 0x8cb4, 0x8d77, 0x8ecc, 0x8f1d, 0x98e2, 0x9a0e, 0x9b3c, 0x4e80, 0x507d, 0x5100, 0x5993, 0x5b9c, 0x622f, 0x6280, 0x64ec, 0x6b3a, 0x72a0, 0x7591, 0x7947, 0x7fa9, 0x87fb, 0x8abc, 0x8b70, 0x63ac, 0x83ca, 0x97a0, 0x5409, 0x5403, 0x55ab, 0x6854, 0x6a58, 0x8a70, 0x7827, 0x6775, 0x9ecd, 0x5374, 0x5ba2, 0x811a, 0x8650, 0x9006, 0x4e18, 0x4e45, 0x4ec7, 0x4f11, 0x53ca, 0x5438, 0x5bae, 0x5f13, 0x6025, 0x6551, 0x673d, 0x6c42, 0x6c72, 0x6ce3, 0x7078, 0x7403, 0x7a76, 0x7aae, 0x7b08, 0x7d1a, 0x7cfe, 0x7d66, 0x65e7, 0x725b, 0x53bb, 0x5c45, 0x5de8, 0x62d2, 0x62e0, 0x6319, 0x6e20, 0x865a, 0x8a31, 0x8ddd, 0x92f8, 0x6f01, 0x79a6, 0x9b5a, 0x4ea8, 0x4eab, 0x4eac, /* 0x36 */ 0x4f9b, 0x4fa0, 0x50d1, 0x5147, 0x7af6, 0x5171, 0x51f6, 0x5354, 0x5321, 0x537f, 0x53eb, 0x55ac, 0x5883, 0x5ce1, 0x5f37, 0x5f4a, 0x602f, 0x6050, 0x606d, 0x631f, 0x6559, 0x6a4b, 0x6cc1, 0x72c2, 0x72ed, 0x77ef, 0x80f8, 0x8105, 0x8208, 0x854e, 0x90f7, 0x93e1, 0x97ff, 0x9957, 0x9a5a, 0x4ef0, 0x51dd, 0x5c2d, 0x6681, 0x696d, 0x5c40, 0x66f2, 0x6975, 0x7389, 0x6850, 0x7c81, 0x50c5, 0x52e4, 0x5747, 0x5dfe, 0x9326, 0x65a4, 0x6b23, 0x6b3d, 0x7434, 0x7981, 0x79bd, 0x7b4b, 0x7dca, 0x82b9, 0x83cc, 0x887f, 0x895f, 0x8b39, 0x8fd1, 0x91d1, 0x541f, 0x9280, 0x4e5d, 0x5036, 0x53e5, 0x533a, 0x72d7, 0x7396, 0x77e9, 0x82e6, 0x8eaf, 0x99c6, 0x99c8, 0x99d2, 0x5177, 0x611a, 0x865e, 0x55b0, 0x7a7a, 0x5076, 0x5bd3, 0x9047, 0x9685, 0x4e32, 0x6adb, 0x91e7, 0x5c51, 0x5c48, /* 0x37 */ 0x6398, 0x7a9f, 0x6c93, 0x9774, 0x8f61, 0x7aaa, 0x718a, 0x9688, 0x7c82, 0x6817, 0x7e70, 0x6851, 0x936c, 0x52f2, 0x541b, 0x85ab, 0x8a13, 0x7fa4, 0x8ecd, 0x90e1, 0x5366, 0x8888, 0x7941, 0x4fc2, 0x50be, 0x5211, 0x5144, 0x5553, 0x572d, 0x73ea, 0x578b, 0x5951, 0x5f62, 0x5f84, 0x6075, 0x6176, 0x6167, 0x61a9, 0x63b2, 0x643a, 0x656c, 0x666f, 0x6842, 0x6e13, 0x7566, 0x7a3d, 0x7cfb, 0x7d4c, 0x7d99, 0x7e4b, 0x7f6b, 0x830e, 0x834a, 0x86cd, 0x8a08, 0x8a63, 0x8b66, 0x8efd, 0x981a, 0x9d8f, 0x82b8, 0x8fce, 0x9be8, 0x5287, 0x621f, 0x6483, 0x6fc0, 0x9699, 0x6841, 0x5091, 0x6b20, 0x6c7a, 0x6f54, 0x7a74, 0x7d50, 0x8840, 0x8a23, 0x6708, 0x4ef6, 0x5039, 0x5026, 0x5065, 0x517c, 0x5238, 0x5263, 0x55a7, 0x570f, 0x5805, 0x5acc, 0x5efa, 0x61b2, 0x61f8, 0x62f3, 0x6372, /* 0x38 */ 0x691c, 0x6a29, 0x727d, 0x72ac, 0x732e, 0x7814, 0x786f, 0x7d79, 0x770c, 0x80a9, 0x898b, 0x8b19, 0x8ce2, 0x8ed2, 0x9063, 0x9375, 0x967a, 0x9855, 0x9a13, 0x9e78, 0x5143, 0x539f, 0x53b3, 0x5e7b, 0x5f26, 0x6e1b, 0x6e90, 0x7384, 0x73fe, 0x7d43, 0x8237, 0x8a00, 0x8afa, 0x9650, 0x4e4e, 0x500b, 0x53e4, 0x547c, 0x56fa, 0x59d1, 0x5b64, 0x5df1, 0x5eab, 0x5f27, 0x6238, 0x6545, 0x67af, 0x6e56, 0x72d0, 0x7cca, 0x88b4, 0x80a1, 0x80e1, 0x83f0, 0x864e, 0x8a87, 0x8de8, 0x9237, 0x96c7, 0x9867, 0x9f13, 0x4e94, 0x4e92, 0x4f0d, 0x5348, 0x5449, 0x543e, 0x5a2f, 0x5f8c, 0x5fa1, 0x609f, 0x68a7, 0x6a8e, 0x745a, 0x7881, 0x8a9e, 0x8aa4, 0x8b77, 0x9190, 0x4e5e, 0x9bc9, 0x4ea4, 0x4f7c, 0x4faf, 0x5019, 0x5016, 0x5149, 0x516c, 0x529f, 0x52b9, 0x52fe, 0x539a, 0x53e3, 0x5411, /* 0x39 */ 0x540e, 0x5589, 0x5751, 0x57a2, 0x597d, 0x5b54, 0x5b5d, 0x5b8f, 0x5de5, 0x5de7, 0x5df7, 0x5e78, 0x5e83, 0x5e9a, 0x5eb7, 0x5f18, 0x6052, 0x614c, 0x6297, 0x62d8, 0x63a7, 0x653b, 0x6602, 0x6643, 0x66f4, 0x676d, 0x6821, 0x6897, 0x69cb, 0x6c5f, 0x6d2a, 0x6d69, 0x6e2f, 0x6e9d, 0x7532, 0x7687, 0x786c, 0x7a3f, 0x7ce0, 0x7d05, 0x7d18, 0x7d5e, 0x7db1, 0x8015, 0x8003, 0x80af, 0x80b1, 0x8154, 0x818f, 0x822a, 0x8352, 0x884c, 0x8861, 0x8b1b, 0x8ca2, 0x8cfc, 0x90ca, 0x9175, 0x9271, 0x783f, 0x92fc, 0x95a4, 0x964d, 0x9805, 0x9999, 0x9ad8, 0x9d3b, 0x525b, 0x52ab, 0x53f7, 0x5408, 0x58d5, 0x62f7, 0x6fe0, 0x8c6a, 0x8f5f, 0x9eb9, 0x514b, 0x523b, 0x544a, 0x56fd, 0x7a40, 0x9177, 0x9d60, 0x9ed2, 0x7344, 0x6f09, 0x8170, 0x7511, 0x5ffd, 0x60da, 0x9aa8, 0x72db, 0x8fbc, /* 0x3a */ 0x6b64, 0x9803, 0x4eca, 0x56f0, 0x5764, 0x58be, 0x5a5a, 0x6068, 0x61c7, 0x660f, 0x6606, 0x6839, 0x68b1, 0x6df7, 0x75d5, 0x7d3a, 0x826e, 0x9b42, 0x4e9b, 0x4f50, 0x53c9, 0x5506, 0x5d6f, 0x5de6, 0x5dee, 0x67fb, 0x6c99, 0x7473, 0x7802, 0x8a50, 0x9396, 0x88df, 0x5750, 0x5ea7, 0x632b, 0x50b5, 0x50ac, 0x518d, 0x6700, 0x54c9, 0x585e, 0x59bb, 0x5bb0, 0x5f69, 0x624d, 0x63a1, 0x683d, 0x6b73, 0x6e08, 0x707d, 0x91c7, 0x7280, 0x7815, 0x7826, 0x796d, 0x658e, 0x7d30, 0x83dc, 0x88c1, 0x8f09, 0x969b, 0x5264, 0x5728, 0x6750, 0x7f6a, 0x8ca1, 0x51b4, 0x5742, 0x962a, 0x583a, 0x698a, 0x80b4, 0x54b2, 0x5d0e, 0x57fc, 0x7895, 0x9dfa, 0x4f5c, 0x524a, 0x548b, 0x643e, 0x6628, 0x6714, 0x67f5, 0x7a84, 0x7b56, 0x7d22, 0x932f, 0x685c, 0x9bad, 0x7b39, 0x5319, 0x518a, 0x5237, /* 0x3b */ 0x5bdf, 0x62f6, 0x64ae, 0x64e6, 0x672d, 0x6bba, 0x85a9, 0x96d1, 0x7690, 0x9bd6, 0x634c, 0x9306, 0x9bab, 0x76bf, 0x6652, 0x4e09, 0x5098, 0x53c2, 0x5c71, 0x60e8, 0x6492, 0x6563, 0x685f, 0x71e6, 0x73ca, 0x7523, 0x7b97, 0x7e82, 0x8695, 0x8b83, 0x8cdb, 0x9178, 0x9910, 0x65ac, 0x66ab, 0x6b8b, 0x4ed5, 0x4ed4, 0x4f3a, 0x4f7f, 0x523a, 0x53f8, 0x53f2, 0x55e3, 0x56db, 0x58eb, 0x59cb, 0x59c9, 0x59ff, 0x5b50, 0x5c4d, 0x5e02, 0x5e2b, 0x5fd7, 0x601d, 0x6307, 0x652f, 0x5b5c, 0x65af, 0x65bd, 0x65e8, 0x679d, 0x6b62, 0x6b7b, 0x6c0f, 0x7345, 0x7949, 0x79c1, 0x7cf8, 0x7d19, 0x7d2b, 0x80a2, 0x8102, 0x81f3, 0x8996, 0x8a5e, 0x8a69, 0x8a66, 0x8a8c, 0x8aee, 0x8cc7, 0x8cdc, 0x96cc, 0x98fc, 0x6b6f, 0x4e8b, 0x4f3c, 0x4f8d, 0x5150, 0x5b57, 0x5bfa, 0x6148, 0x6301, 0x6642, /* 0x3c */ 0x6b21, 0x6ecb, 0x6cbb, 0x723e, 0x74bd, 0x75d4, 0x78c1, 0x793a, 0x800c, 0x8033, 0x81ea, 0x8494, 0x8f9e, 0x6c50, 0x9e7f, 0x5f0f, 0x8b58, 0x9d2b, 0x7afa, 0x8ef8, 0x5b8d, 0x96eb, 0x4e03, 0x53f1, 0x57f7, 0x5931, 0x5ac9, 0x5ba4, 0x6089, 0x6e7f, 0x6f06, 0x75be, 0x8cea, 0x5b9f, 0x8500, 0x7be0, 0x5072, 0x67f4, 0x829d, 0x5c61, 0x854a, 0x7e1e, 0x820e, 0x5199, 0x5c04, 0x6368, 0x8d66, 0x659c, 0x716e, 0x793e, 0x7d17, 0x8005, 0x8b1d, 0x8eca, 0x906e, 0x86c7, 0x90aa, 0x501f, 0x52fa, 0x5c3a, 0x6753, 0x707c, 0x7235, 0x914c, 0x91c8, 0x932b, 0x82e5, 0x5bc2, 0x5f31, 0x60f9, 0x4e3b, 0x53d6, 0x5b88, 0x624b, 0x6731, 0x6b8a, 0x72e9, 0x73e0, 0x7a2e, 0x816b, 0x8da3, 0x9152, 0x9996, 0x5112, 0x53d7, 0x546a, 0x5bff, 0x6388, 0x6a39, 0x7dac, 0x9700, 0x56da, 0x53ce, 0x5468, /* 0x3d */ 0x5b97, 0x5c31, 0x5dde, 0x4fee, 0x6101, 0x62fe, 0x6d32, 0x79c0, 0x79cb, 0x7d42, 0x7e4d, 0x7fd2, 0x81ed, 0x821f, 0x8490, 0x8846, 0x8972, 0x8b90, 0x8e74, 0x8f2f, 0x9031, 0x914b, 0x916c, 0x96c6, 0x919c, 0x4ec0, 0x4f4f, 0x5145, 0x5341, 0x5f93, 0x620e, 0x67d4, 0x6c41, 0x6e0b, 0x7363, 0x7e26, 0x91cd, 0x9283, 0x53d4, 0x5919, 0x5bbf, 0x6dd1, 0x795d, 0x7e2e, 0x7c9b, 0x587e, 0x719f, 0x51fa, 0x8853, 0x8ff0, 0x4fca, 0x5cfb, 0x6625, 0x77ac, 0x7ae3, 0x821c, 0x99ff, 0x51c6, 0x5faa, 0x65ec, 0x696f, 0x6b89, 0x6df3, 0x6e96, 0x6f64, 0x76fe, 0x7d14, 0x5de1, 0x9075, 0x9187, 0x9806, 0x51e6, 0x521d, 0x6240, 0x6691, 0x66d9, 0x6e1a, 0x5eb6, 0x7dd2, 0x7f72, 0x66f8, 0x85af, 0x85f7, 0x8af8, 0x52a9, 0x53d9, 0x5973, 0x5e8f, 0x5f90, 0x6055, 0x92e4, 0x9664, 0x50b7, 0x511f, /* 0x3e */ 0x52dd, 0x5320, 0x5347, 0x53ec, 0x54e8, 0x5546, 0x5531, 0x5617, 0x5968, 0x59be, 0x5a3c, 0x5bb5, 0x5c06, 0x5c0f, 0x5c11, 0x5c1a, 0x5e84, 0x5e8a, 0x5ee0, 0x5f70, 0x627f, 0x6284, 0x62db, 0x638c, 0x6377, 0x6607, 0x660c, 0x662d, 0x6676, 0x677e, 0x68a2, 0x6a1f, 0x6a35, 0x6cbc, 0x6d88, 0x6e09, 0x6e58, 0x713c, 0x7126, 0x7167, 0x75c7, 0x7701, 0x785d, 0x7901, 0x7965, 0x79f0, 0x7ae0, 0x7b11, 0x7ca7, 0x7d39, 0x8096, 0x83d6, 0x848b, 0x8549, 0x885d, 0x88f3, 0x8a1f, 0x8a3c, 0x8a54, 0x8a73, 0x8c61, 0x8cde, 0x91a4, 0x9266, 0x937e, 0x9418, 0x969c, 0x9798, 0x4e0a, 0x4e08, 0x4e1e, 0x4e57, 0x5197, 0x5270, 0x57ce, 0x5834, 0x58cc, 0x5b22, 0x5e38, 0x60c5, 0x64fe, 0x6761, 0x6756, 0x6d44, 0x72b6, 0x7573, 0x7a63, 0x84b8, 0x8b72, 0x91b8, 0x9320, 0x5631, 0x57f4, 0x98fe, /* 0x3f */ 0x62ed, 0x690d, 0x6b96, 0x71ed, 0x7e54, 0x8077, 0x8272, 0x89e6, 0x98df, 0x8755, 0x8fb1, 0x5c3b, 0x4f38, 0x4fe1, 0x4fb5, 0x5507, 0x5a20, 0x5bdd, 0x5be9, 0x5fc3, 0x614e, 0x632f, 0x65b0, 0x664b, 0x68ee, 0x699b, 0x6d78, 0x6df1, 0x7533, 0x75b9, 0x771f, 0x795e, 0x79e6, 0x7d33, 0x81e3, 0x82af, 0x85aa, 0x89aa, 0x8a3a, 0x8eab, 0x8f9b, 0x9032, 0x91dd, 0x9707, 0x4eba, 0x4ec1, 0x5203, 0x5875, 0x58ec, 0x5c0b, 0x751a, 0x5c3d, 0x814e, 0x8a0a, 0x8fc5, 0x9663, 0x976d, 0x7b25, 0x8acf, 0x9808, 0x9162, 0x56f3, 0x53a8, 0x9017, 0x5439, 0x5782, 0x5e25, 0x63a8, 0x6c34, 0x708a, 0x7761, 0x7c8b, 0x7fe0, 0x8870, 0x9042, 0x9154, 0x9310, 0x9318, 0x968f, 0x745e, 0x9ac4, 0x5d07, 0x5d69, 0x6570, 0x67a2, 0x8da8, 0x96db, 0x636e, 0x6749, 0x6919, 0x83c5, 0x9817, 0x96c0, 0x88fe, /* 0x40 */ 0x6f84, 0x647a, 0x5bf8, 0x4e16, 0x702c, 0x755d, 0x662f, 0x51c4, 0x5236, 0x52e2, 0x59d3, 0x5f81, 0x6027, 0x6210, 0x653f, 0x6574, 0x661f, 0x6674, 0x68f2, 0x6816, 0x6b63, 0x6e05, 0x7272, 0x751f, 0x76db, 0x7cbe, 0x8056, 0x58f0, 0x88fd, 0x897f, 0x8aa0, 0x8a93, 0x8acb, 0x901d, 0x9192, 0x9752, 0x9759, 0x6589, 0x7a0e, 0x8106, 0x96bb, 0x5e2d, 0x60dc, 0x621a, 0x65a5, 0x6614, 0x6790, 0x77f3, 0x7a4d, 0x7c4d, 0x7e3e, 0x810a, 0x8cac, 0x8d64, 0x8de1, 0x8e5f, 0x78a9, 0x5207, 0x62d9, 0x63a5, 0x6442, 0x6298, 0x8a2d, 0x7a83, 0x7bc0, 0x8aac, 0x96ea, 0x7d76, 0x820c, 0x8749, 0x4ed9, 0x5148, 0x5343, 0x5360, 0x5ba3, 0x5c02, 0x5c16, 0x5ddd, 0x6226, 0x6247, 0x64b0, 0x6813, 0x6834, 0x6cc9, 0x6d45, 0x6d17, 0x67d3, 0x6f5c, 0x714e, 0x717d, 0x65cb, 0x7a7f, 0x7bad, 0x7dda, /* 0x41 */ 0x7e4a, 0x7fa8, 0x817a, 0x821b, 0x8239, 0x85a6, 0x8a6e, 0x8cce, 0x8df5, 0x9078, 0x9077, 0x92ad, 0x9291, 0x9583, 0x9bae, 0x524d, 0x5584, 0x6f38, 0x7136, 0x5168, 0x7985, 0x7e55, 0x81b3, 0x7cce, 0x564c, 0x5851, 0x5ca8, 0x63aa, 0x66fe, 0x66fd, 0x695a, 0x72d9, 0x758f, 0x758e, 0x790e, 0x7956, 0x79df, 0x7c97, 0x7d20, 0x7d44, 0x8607, 0x8a34, 0x963b, 0x9061, 0x9f20, 0x50e7, 0x5275, 0x53cc, 0x53e2, 0x5009, 0x55aa, 0x58ee, 0x594f, 0x723d, 0x5b8b, 0x5c64, 0x531d, 0x60e3, 0x60f3, 0x635c, 0x6383, 0x633f, 0x63bb, 0x64cd, 0x65e9, 0x66f9, 0x5de3, 0x69cd, 0x69fd, 0x6f15, 0x71e5, 0x4e89, 0x75e9, 0x76f8, 0x7a93, 0x7cdf, 0x7dcf, 0x7d9c, 0x8061, 0x8349, 0x8358, 0x846c, 0x84bc, 0x85fb, 0x88c5, 0x8d70, 0x9001, 0x906d, 0x9397, 0x971c, 0x9a12, 0x50cf, 0x5897, 0x618e, /* 0x42 */ 0x81d3, 0x8535, 0x8d08, 0x9020, 0x4fc3, 0x5074, 0x5247, 0x5373, 0x606f, 0x6349, 0x675f, 0x6e2c, 0x8db3, 0x901f, 0x4fd7, 0x5c5e, 0x8cca, 0x65cf, 0x7d9a, 0x5352, 0x8896, 0x5176, 0x63c3, 0x5b58, 0x5b6b, 0x5c0a, 0x640d, 0x6751, 0x905c, 0x4ed6, 0x591a, 0x592a, 0x6c70, 0x8a51, 0x553e, 0x5815, 0x59a5, 0x60f0, 0x6253, 0x67c1, 0x8235, 0x6955, 0x9640, 0x99c4, 0x9a28, 0x4f53, 0x5806, 0x5bfe, 0x8010, 0x5cb1, 0x5e2f, 0x5f85, 0x6020, 0x614b, 0x6234, 0x66ff, 0x6cf0, 0x6ede, 0x80ce, 0x817f, 0x82d4, 0x888b, 0x8cb8, 0x9000, 0x902e, 0x968a, 0x9edb, 0x9bdb, 0x4ee3, 0x53f0, 0x5927, 0x7b2c, 0x918d, 0x984c, 0x9df9, 0x6edd, 0x7027, 0x5353, 0x5544, 0x5b85, 0x6258, 0x629e, 0x62d3, 0x6ca2, 0x6fef, 0x7422, 0x8a17, 0x9438, 0x6fc1, 0x8afe, 0x8338, 0x51e7, 0x86f8, 0x53ea, /* 0x43 */ 0x53e9, 0x4f46, 0x9054, 0x8fb0, 0x596a, 0x8131, 0x5dfd, 0x7aea, 0x8fbf, 0x68da, 0x8c37, 0x72f8, 0x9c48, 0x6a3d, 0x8ab0, 0x4e39, 0x5358, 0x5606, 0x5766, 0x62c5, 0x63a2, 0x65e6, 0x6b4e, 0x6de1, 0x6e5b, 0x70ad, 0x77ed, 0x7aef, 0x7baa, 0x7dbb, 0x803d, 0x80c6, 0x86cb, 0x8a95, 0x935b, 0x56e3, 0x58c7, 0x5f3e, 0x65ad, 0x6696, 0x6a80, 0x6bb5, 0x7537, 0x8ac7, 0x5024, 0x77e5, 0x5730, 0x5f1b, 0x6065, 0x667a, 0x6c60, 0x75f4, 0x7a1a, 0x7f6e, 0x81f4, 0x8718, 0x9045, 0x99b3, 0x7bc9, 0x755c, 0x7af9, 0x7b51, 0x84c4, 0x9010, 0x79e9, 0x7a92, 0x8336, 0x5ae1, 0x7740, 0x4e2d, 0x4ef2, 0x5b99, 0x5fe0, 0x62bd, 0x663c, 0x67f1, 0x6ce8, 0x866b, 0x8877, 0x8a3b, 0x914e, 0x92f3, 0x99d0, 0x6a17, 0x7026, 0x732a, 0x82e7, 0x8457, 0x8caf, 0x4e01, 0x5146, 0x51cb, 0x558b, 0x5bf5, /* 0x44 */ 0x5e16, 0x5e33, 0x5e81, 0x5f14, 0x5f35, 0x5f6b, 0x5fb4, 0x61f2, 0x6311, 0x66a2, 0x671d, 0x6f6e, 0x7252, 0x753a, 0x773a, 0x8074, 0x8139, 0x8178, 0x8776, 0x8abf, 0x8adc, 0x8d85, 0x8df3, 0x929a, 0x9577, 0x9802, 0x9ce5, 0x52c5, 0x6357, 0x76f4, 0x6715, 0x6c88, 0x73cd, 0x8cc3, 0x93ae, 0x9673, 0x6d25, 0x589c, 0x690e, 0x69cc, 0x8ffd, 0x939a, 0x75db, 0x901a, 0x585a, 0x6802, 0x63b4, 0x69fb, 0x4f43, 0x6f2c, 0x67d8, 0x8fbb, 0x8526, 0x7db4, 0x9354, 0x693f, 0x6f70, 0x576a, 0x58f7, 0x5b2c, 0x7d2c, 0x722a, 0x540a, 0x91e3, 0x9db4, 0x4ead, 0x4f4e, 0x505c, 0x5075, 0x5243, 0x8c9e, 0x5448, 0x5824, 0x5b9a, 0x5e1d, 0x5e95, 0x5ead, 0x5ef7, 0x5f1f, 0x608c, 0x62b5, 0x633a, 0x63d0, 0x68af, 0x6c40, 0x7887, 0x798e, 0x7a0b, 0x7de0, 0x8247, 0x8a02, 0x8ae6, 0x8e44, 0x9013, /* 0x45 */ 0x90b8, 0x912d, 0x91d8, 0x9f0e, 0x6ce5, 0x6458, 0x64e2, 0x6575, 0x6ef4, 0x7684, 0x7b1b, 0x9069, 0x93d1, 0x6eba, 0x54f2, 0x5fb9, 0x64a4, 0x8f4d, 0x8fed, 0x9244, 0x5178, 0x586b, 0x5929, 0x5c55, 0x5e97, 0x6dfb, 0x7e8f, 0x751c, 0x8cbc, 0x8ee2, 0x985b, 0x70b9, 0x4f1d, 0x6bbf, 0x6fb1, 0x7530, 0x96fb, 0x514e, 0x5410, 0x5835, 0x5857, 0x59ac, 0x5c60, 0x5f92, 0x6597, 0x675c, 0x6e21, 0x767b, 0x83df, 0x8ced, 0x9014, 0x90fd, 0x934d, 0x7825, 0x783a, 0x52aa, 0x5ea6, 0x571f, 0x5974, 0x6012, 0x5012, 0x515a, 0x51ac, 0x51cd, 0x5200, 0x5510, 0x5854, 0x5858, 0x5957, 0x5b95, 0x5cf6, 0x5d8b, 0x60bc, 0x6295, 0x642d, 0x6771, 0x6843, 0x68bc, 0x68df, 0x76d7, 0x6dd8, 0x6e6f, 0x6d9b, 0x706f, 0x71c8, 0x5f53, 0x75d8, 0x7977, 0x7b49, 0x7b54, 0x7b52, 0x7cd6, 0x7d71, 0x5230, /* 0x46 */ 0x8463, 0x8569, 0x85e4, 0x8a0e, 0x8b04, 0x8c46, 0x8e0f, 0x9003, 0x900f, 0x9419, 0x9676, 0x982d, 0x9a30, 0x95d8, 0x50cd, 0x52d5, 0x540c, 0x5802, 0x5c0e, 0x61a7, 0x649e, 0x6d1e, 0x77b3, 0x7ae5, 0x80f4, 0x8404, 0x9053, 0x9285, 0x5ce0, 0x9d07, 0x533f, 0x5f97, 0x5fb3, 0x6d9c, 0x7279, 0x7763, 0x79bf, 0x7be4, 0x6bd2, 0x72ec, 0x8aad, 0x6803, 0x6a61, 0x51f8, 0x7a81, 0x6934, 0x5c4a, 0x9cf6, 0x82eb, 0x5bc5, 0x9149, 0x701e, 0x5678, 0x5c6f, 0x60c7, 0x6566, 0x6c8c, 0x8c5a, 0x9041, 0x9813, 0x5451, 0x66c7, 0x920d, 0x5948, 0x90a3, 0x5185, 0x4e4d, 0x51ea, 0x8599, 0x8b0e, 0x7058, 0x637a, 0x934b, 0x6962, 0x99b4, 0x7e04, 0x7577, 0x5357, 0x6960, 0x8edf, 0x96e3, 0x6c5d, 0x4e8c, 0x5c3c, 0x5f10, 0x8fe9, 0x5302, 0x8cd1, 0x8089, 0x8679, 0x5eff, 0x65e5, 0x4e73, 0x5165, /* 0x47 */ 0x5982, 0x5c3f, 0x97ee, 0x4efb, 0x598a, 0x5fcd, 0x8a8d, 0x6fe1, 0x79b0, 0x7962, 0x5be7, 0x8471, 0x732b, 0x71b1, 0x5e74, 0x5ff5, 0x637b, 0x649a, 0x71c3, 0x7c98, 0x4e43, 0x5efc, 0x4e4b, 0x57dc, 0x56a2, 0x60a9, 0x6fc3, 0x7d0d, 0x80fd, 0x8133, 0x81bf, 0x8fb2, 0x8997, 0x86a4, 0x5df4, 0x628a, 0x64ad, 0x8987, 0x6777, 0x6ce2, 0x6d3e, 0x7436, 0x7834, 0x5a46, 0x7f75, 0x82ad, 0x99ac, 0x4ff3, 0x5ec3, 0x62dd, 0x6392, 0x6557, 0x676f, 0x76c3, 0x724c, 0x80cc, 0x80ba, 0x8f29, 0x914d, 0x500d, 0x57f9, 0x5a92, 0x6885, 0x6973, 0x7164, 0x72fd, 0x8cb7, 0x58f2, 0x8ce0, 0x966a, 0x9019, 0x877f, 0x79e4, 0x77e7, 0x8429, 0x4f2f, 0x5265, 0x535a, 0x62cd, 0x67cf, 0x6cca, 0x767d, 0x7b94, 0x7c95, 0x8236, 0x8584, 0x8feb, 0x66dd, 0x6f20, 0x7206, 0x7e1b, 0x83ab, 0x99c1, 0x9ea6, /* 0x48 */ 0x51fd, 0x7bb1, 0x7872, 0x7bb8, 0x8087, 0x7b48, 0x6ae8, 0x5e61, 0x808c, 0x7551, 0x7560, 0x516b, 0x9262, 0x6e8c, 0x767a, 0x9197, 0x9aea, 0x4f10, 0x7f70, 0x629c, 0x7b4f, 0x95a5, 0x9ce9, 0x567a, 0x5859, 0x86e4, 0x96bc, 0x4f34, 0x5224, 0x534a, 0x53cd, 0x53db, 0x5e06, 0x642c, 0x6591, 0x677f, 0x6c3e, 0x6c4e, 0x7248, 0x72af, 0x73ed, 0x7554, 0x7e41, 0x822c, 0x85e9, 0x8ca9, 0x7bc4, 0x91c6, 0x7169, 0x9812, 0x98ef, 0x633d, 0x6669, 0x756a, 0x76e4, 0x78d0, 0x8543, 0x86ee, 0x532a, 0x5351, 0x5426, 0x5983, 0x5e87, 0x5f7c, 0x60b2, 0x6249, 0x6279, 0x62ab, 0x6590, 0x6bd4, 0x6ccc, 0x75b2, 0x76ae, 0x7891, 0x79d8, 0x7dcb, 0x7f77, 0x80a5, 0x88ab, 0x8ab9, 0x8cbb, 0x907f, 0x975e, 0x98db, 0x6a0b, 0x7c38, 0x5099, 0x5c3e, 0x5fae, 0x6787, 0x6bd8, 0x7435, 0x7709, 0x7f8e, /* 0x49 */ 0x9f3b, 0x67ca, 0x7a17, 0x5339, 0x758b, 0x9aed, 0x5f66, 0x819d, 0x83f1, 0x8098, 0x5f3c, 0x5fc5, 0x7562, 0x7b46, 0x903c, 0x6867, 0x59eb, 0x5a9b, 0x7d10, 0x767e, 0x8b2c, 0x4ff5, 0x5f6a, 0x6a19, 0x6c37, 0x6f02, 0x74e2, 0x7968, 0x8868, 0x8a55, 0x8c79, 0x5edf, 0x63cf, 0x75c5, 0x79d2, 0x82d7, 0x9328, 0x92f2, 0x849c, 0x86ed, 0x9c2d, 0x54c1, 0x5f6c, 0x658c, 0x6d5c, 0x7015, 0x8ca7, 0x8cd3, 0x983b, 0x654f, 0x74f6, 0x4e0d, 0x4ed8, 0x57e0, 0x592b, 0x5a66, 0x5bcc, 0x51a8, 0x5e03, 0x5e9c, 0x6016, 0x6276, 0x6577, 0x65a7, 0x666e, 0x6d6e, 0x7236, 0x7b26, 0x8150, 0x819a, 0x8299, 0x8b5c, 0x8ca0, 0x8ce6, 0x8d74, 0x961c, 0x9644, 0x4fae, 0x64ab, 0x6b66, 0x821e, 0x8461, 0x856a, 0x90e8, 0x5c01, 0x6953, 0x98a8, 0x847a, 0x8557, 0x4f0f, 0x526f, 0x5fa9, 0x5e45, 0x670d, /* 0x4a */ 0x798f, 0x8179, 0x8907, 0x8986, 0x6df5, 0x5f17, 0x6255, 0x6cb8, 0x4ecf, 0x7269, 0x9b92, 0x5206, 0x543b, 0x5674, 0x58b3, 0x61a4, 0x626e, 0x711a, 0x596e, 0x7c89, 0x7cde, 0x7d1b, 0x96f0, 0x6587, 0x805e, 0x4e19, 0x4f75, 0x5175, 0x5840, 0x5e63, 0x5e73, 0x5f0a, 0x67c4, 0x4e26, 0x853d, 0x9589, 0x965b, 0x7c73, 0x9801, 0x50fb, 0x58c1, 0x7656, 0x78a7, 0x5225, 0x77a5, 0x8511, 0x7b86, 0x504f, 0x5909, 0x7247, 0x7bc7, 0x7de8, 0x8fba, 0x8fd4, 0x904d, 0x4fbf, 0x52c9, 0x5a29, 0x5f01, 0x97ad, 0x4fdd, 0x8217, 0x92ea, 0x5703, 0x6355, 0x6b69, 0x752b, 0x88dc, 0x8f14, 0x7a42, 0x52df, 0x5893, 0x6155, 0x620a, 0x66ae, 0x6bcd, 0x7c3f, 0x83e9, 0x5023, 0x4ff8, 0x5305, 0x5446, 0x5831, 0x5949, 0x5b9d, 0x5cf0, 0x5cef, 0x5d29, 0x5e96, 0x62b1, 0x6367, 0x653e, 0x65b9, 0x670b, /* 0x4b */ 0x6cd5, 0x6ce1, 0x70f9, 0x7832, 0x7e2b, 0x80de, 0x82b3, 0x840c, 0x84ec, 0x8702, 0x8912, 0x8a2a, 0x8c4a, 0x90a6, 0x92d2, 0x98fd, 0x9cf3, 0x9d6c, 0x4e4f, 0x4ea1, 0x508d, 0x5256, 0x574a, 0x59a8, 0x5e3d, 0x5fd8, 0x5fd9, 0x623f, 0x66b4, 0x671b, 0x67d0, 0x68d2, 0x5192, 0x7d21, 0x80aa, 0x81a8, 0x8b00, 0x8c8c, 0x8cbf, 0x927e, 0x9632, 0x5420, 0x982c, 0x5317, 0x50d5, 0x535c, 0x58a8, 0x64b2, 0x6734, 0x7267, 0x7766, 0x7a46, 0x91e6, 0x52c3, 0x6ca1, 0x6b86, 0x5800, 0x5e4c, 0x5954, 0x672c, 0x7ffb, 0x51e1, 0x76c6, 0x6469, 0x78e8, 0x9b54, 0x9ebb, 0x57cb, 0x59b9, 0x6627, 0x679a, 0x6bce, 0x54e9, 0x69d9, 0x5e55, 0x819c, 0x6795, 0x9baa, 0x67fe, 0x9c52, 0x685d, 0x4ea6, 0x4fe3, 0x53c8, 0x62b9, 0x672b, 0x6cab, 0x8fc4, 0x4fad, 0x7e6d, 0x9ebf, 0x4e07, 0x6162, 0x6e80, /* 0x4c */ 0x6f2b, 0x8513, 0x5473, 0x672a, 0x9b45, 0x5df3, 0x7b95, 0x5cac, 0x5bc6, 0x871c, 0x6e4a, 0x84d1, 0x7a14, 0x8108, 0x5999, 0x7c8d, 0x6c11, 0x7720, 0x52d9, 0x5922, 0x7121, 0x725f, 0x77db, 0x9727, 0x9d61, 0x690b, 0x5a7f, 0x5a18, 0x51a5, 0x540d, 0x547d, 0x660e, 0x76df, 0x8ff7, 0x9298, 0x9cf4, 0x59ea, 0x725d, 0x6ec5, 0x514d, 0x68c9, 0x7dbf, 0x7dec, 0x9762, 0x9eba, 0x6478, 0x6a21, 0x8302, 0x5984, 0x5b5f, 0x6bdb, 0x731b, 0x76f2, 0x7db2, 0x8017, 0x8499, 0x5132, 0x6728, 0x9ed9, 0x76ee, 0x6762, 0x52ff, 0x9905, 0x5c24, 0x623b, 0x7c7e, 0x8cb0, 0x554f, 0x60b6, 0x7d0b, 0x9580, 0x5301, 0x4e5f, 0x51b6, 0x591c, 0x723a, 0x8036, 0x91ce, 0x5f25, 0x77e2, 0x5384, 0x5f79, 0x7d04, 0x85ac, 0x8a33, 0x8e8d, 0x9756, 0x67f3, 0x85ae, 0x9453, 0x6109, 0x6108, 0x6cb9, 0x7652, /* 0x4d */ 0x8aed, 0x8f38, 0x552f, 0x4f51, 0x512a, 0x52c7, 0x53cb, 0x5ba5, 0x5e7d, 0x60a0, 0x6182, 0x63d6, 0x6709, 0x67da, 0x6e67, 0x6d8c, 0x7336, 0x7337, 0x7531, 0x7950, 0x88d5, 0x8a98, 0x904a, 0x9091, 0x90f5, 0x96c4, 0x878d, 0x5915, 0x4e88, 0x4f59, 0x4e0e, 0x8a89, 0x8f3f, 0x9810, 0x50ad, 0x5e7c, 0x5996, 0x5bb9, 0x5eb8, 0x63da, 0x63fa, 0x64c1, 0x66dc, 0x694a, 0x69d8, 0x6d0b, 0x6eb6, 0x7194, 0x7528, 0x7aaf, 0x7f8a, 0x8000, 0x8449, 0x84c9, 0x8981, 0x8b21, 0x8e0a, 0x9065, 0x967d, 0x990a, 0x617e, 0x6291, 0x6b32, 0x6c83, 0x6d74, 0x7fcc, 0x7ffc, 0x6dc0, 0x7f85, 0x87ba, 0x88f8, 0x6765, 0x83b1, 0x983c, 0x96f7, 0x6d1b, 0x7d61, 0x843d, 0x916a, 0x4e71, 0x5375, 0x5d50, 0x6b04, 0x6feb, 0x85cd, 0x862d, 0x89a7, 0x5229, 0x540f, 0x5c65, 0x674e, 0x68a8, 0x7406, 0x7483, /* 0x4e */ 0x75e2, 0x88cf, 0x88e1, 0x91cc, 0x96e2, 0x9678, 0x5f8b, 0x7387, 0x7acb, 0x844e, 0x63a0, 0x7565, 0x5289, 0x6d41, 0x6e9c, 0x7409, 0x7559, 0x786b, 0x7c92, 0x9686, 0x7adc, 0x9f8d, 0x4fb6, 0x616e, 0x65c5, 0x865c, 0x4e86, 0x4eae, 0x50da, 0x4e21, 0x51cc, 0x5bee, 0x6599, 0x6881, 0x6dbc, 0x731f, 0x7642, 0x77ad, 0x7a1c, 0x7ce7, 0x826f, 0x8ad2, 0x907c, 0x91cf, 0x9675, 0x9818, 0x529b, 0x7dd1, 0x502b, 0x5398, 0x6797, 0x6dcb, 0x71d0, 0x7433, 0x81e8, 0x8f2a, 0x96a3, 0x9c57, 0x9e9f, 0x7460, 0x5841, 0x6d99, 0x7d2f, 0x985e, 0x4ee4, 0x4f36, 0x4f8b, 0x51b7, 0x52b1, 0x5dba, 0x601c, 0x73b2, 0x793c, 0x82d3, 0x9234, 0x96b7, 0x96f6, 0x970a, 0x9e97, 0x9f62, 0x66a6, 0x6b74, 0x5217, 0x52a3, 0x70c8, 0x88c2, 0x5ec9, 0x604b, 0x6190, 0x6f23, 0x7149, 0x7c3e, 0x7df4, 0x806f, /* 0x4f */ 0x84ee, 0x9023, 0x932c, 0x5442, 0x9b6f, 0x6ad3, 0x7089, 0x8cc2, 0x8def, 0x9732, 0x52b4, 0x5a41, 0x5eca, 0x5f04, 0x6717, 0x697c, 0x6994, 0x6d6a, 0x6f0f, 0x7262, 0x72fc, 0x7bed, 0x8001, 0x807e, 0x874b, 0x90ce, 0x516d, 0x9e93, 0x7984, 0x808b, 0x9332, 0x8ad6, 0x502d, 0x548c, 0x8a71, 0x6b6a, 0x8cc4, 0x8107, 0x60d1, 0x67a0, 0x9df2, 0x4e99, 0x4e98, 0x9c10, 0x8a6b, 0x85c1, 0x8568, 0x6900, 0x6e7e, 0x7897, 0x8155, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x50 */ 0x5f0c, 0x4e10, 0x4e15, 0x4e2a, 0x4e31, 0x4e36, 0x4e3c, 0x4e3f, 0x4e42, 0x4e56, 0x4e58, 0x4e82, 0x4e85, 0x8c6b, 0x4e8a, 0x8212, 0x5f0d, 0x4e8e, 0x4e9e, 0x4e9f, 0x4ea0, 0x4ea2, 0x4eb0, 0x4eb3, 0x4eb6, 0x4ece, 0x4ecd, 0x4ec4, 0x4ec6, 0x4ec2, 0x4ed7, 0x4ede, 0x4eed, 0x4edf, 0x4ef7, 0x4f09, 0x4f5a, 0x4f30, 0x4f5b, 0x4f5d, 0x4f57, 0x4f47, 0x4f76, 0x4f88, 0x4f8f, 0x4f98, 0x4f7b, 0x4f69, 0x4f70, 0x4f91, 0x4f6f, 0x4f86, 0x4f96, 0x5118, 0x4fd4, 0x4fdf, 0x4fce, 0x4fd8, 0x4fdb, 0x4fd1, 0x4fda, 0x4fd0, 0x4fe4, 0x4fe5, 0x501a, 0x5028, 0x5014, 0x502a, 0x5025, 0x5005, 0x4f1c, 0x4ff6, 0x5021, 0x5029, 0x502c, 0x4ffe, 0x4fef, 0x5011, 0x5006, 0x5043, 0x5047, 0x6703, 0x5055, 0x5050, 0x5048, 0x505a, 0x5056, 0x506c, 0x5078, 0x5080, 0x509a, 0x5085, 0x50b4, 0x50b2, /* 0x51 */ 0x50c9, 0x50ca, 0x50b3, 0x50c2, 0x50d6, 0x50de, 0x50e5, 0x50ed, 0x50e3, 0x50ee, 0x50f9, 0x50f5, 0x5109, 0x5101, 0x5102, 0x5116, 0x5115, 0x5114, 0x511a, 0x5121, 0x513a, 0x5137, 0x513c, 0x513b, 0x513f, 0x5140, 0x5152, 0x514c, 0x5154, 0x5162, 0x7af8, 0x5169, 0x516a, 0x516e, 0x5180, 0x5182, 0x56d8, 0x518c, 0x5189, 0x518f, 0x5191, 0x5193, 0x5195, 0x5196, 0x51a4, 0x51a6, 0x51a2, 0x51a9, 0x51aa, 0x51ab, 0x51b3, 0x51b1, 0x51b2, 0x51b0, 0x51b5, 0x51bd, 0x51c5, 0x51c9, 0x51db, 0x51e0, 0x8655, 0x51e9, 0x51ed, 0x51f0, 0x51f5, 0x51fe, 0x5204, 0x520b, 0x5214, 0x520e, 0x5227, 0x522a, 0x522e, 0x5233, 0x5239, 0x524f, 0x5244, 0x524b, 0x524c, 0x525e, 0x5254, 0x526a, 0x5274, 0x5269, 0x5273, 0x527f, 0x527d, 0x528d, 0x5294, 0x5292, 0x5271, 0x5288, 0x5291, 0x8fa8, /* 0x52 */ 0x8fa7, 0x52ac, 0x52ad, 0x52bc, 0x52b5, 0x52c1, 0x52cd, 0x52d7, 0x52de, 0x52e3, 0x52e6, 0x98ed, 0x52e0, 0x52f3, 0x52f5, 0x52f8, 0x52f9, 0x5306, 0x5308, 0x7538, 0x530d, 0x5310, 0x530f, 0x5315, 0x531a, 0x5323, 0x532f, 0x5331, 0x5333, 0x5338, 0x5340, 0x5346, 0x5345, 0x4e17, 0x5349, 0x534d, 0x51d6, 0x535e, 0x5369, 0x536e, 0x5918, 0x537b, 0x5377, 0x5382, 0x5396, 0x53a0, 0x53a6, 0x53a5, 0x53ae, 0x53b0, 0x53b6, 0x53c3, 0x7c12, 0x96d9, 0x53df, 0x66fc, 0x71ee, 0x53ee, 0x53e8, 0x53ed, 0x53fa, 0x5401, 0x543d, 0x5440, 0x542c, 0x542d, 0x543c, 0x542e, 0x5436, 0x5429, 0x541d, 0x544e, 0x548f, 0x5475, 0x548e, 0x545f, 0x5471, 0x5477, 0x5470, 0x5492, 0x547b, 0x5480, 0x5476, 0x5484, 0x5490, 0x5486, 0x54c7, 0x54a2, 0x54b8, 0x54a5, 0x54ac, 0x54c4, 0x54c8, 0x54a8, /* 0x53 */ 0x54ab, 0x54c2, 0x54a4, 0x54be, 0x54bc, 0x54d8, 0x54e5, 0x54e6, 0x550f, 0x5514, 0x54fd, 0x54ee, 0x54ed, 0x54fa, 0x54e2, 0x5539, 0x5540, 0x5563, 0x554c, 0x552e, 0x555c, 0x5545, 0x5556, 0x5557, 0x5538, 0x5533, 0x555d, 0x5599, 0x5580, 0x54af, 0x558a, 0x559f, 0x557b, 0x557e, 0x5598, 0x559e, 0x55ae, 0x557c, 0x5583, 0x55a9, 0x5587, 0x55a8, 0x55da, 0x55c5, 0x55df, 0x55c4, 0x55dc, 0x55e4, 0x55d4, 0x5614, 0x55f7, 0x5616, 0x55fe, 0x55fd, 0x561b, 0x55f9, 0x564e, 0x5650, 0x71df, 0x5634, 0x5636, 0x5632, 0x5638, 0x566b, 0x5664, 0x562f, 0x566c, 0x566a, 0x5686, 0x5680, 0x568a, 0x56a0, 0x5694, 0x568f, 0x56a5, 0x56ae, 0x56b6, 0x56b4, 0x56c2, 0x56bc, 0x56c1, 0x56c3, 0x56c0, 0x56c8, 0x56ce, 0x56d1, 0x56d3, 0x56d7, 0x56ee, 0x56f9, 0x5700, 0x56ff, 0x5704, 0x5709, /* 0x54 */ 0x5708, 0x570b, 0x570d, 0x5713, 0x5718, 0x5716, 0x55c7, 0x571c, 0x5726, 0x5737, 0x5738, 0x574e, 0x573b, 0x5740, 0x574f, 0x5769, 0x57c0, 0x5788, 0x5761, 0x577f, 0x5789, 0x5793, 0x57a0, 0x57b3, 0x57a4, 0x57aa, 0x57b0, 0x57c3, 0x57c6, 0x57d4, 0x57d2, 0x57d3, 0x580a, 0x57d6, 0x57e3, 0x580b, 0x5819, 0x581d, 0x5872, 0x5821, 0x5862, 0x584b, 0x5870, 0x6bc0, 0x5852, 0x583d, 0x5879, 0x5885, 0x58b9, 0x589f, 0x58ab, 0x58ba, 0x58de, 0x58bb, 0x58b8, 0x58ae, 0x58c5, 0x58d3, 0x58d1, 0x58d7, 0x58d9, 0x58d8, 0x58e5, 0x58dc, 0x58e4, 0x58df, 0x58ef, 0x58fa, 0x58f9, 0x58fb, 0x58fc, 0x58fd, 0x5902, 0x590a, 0x5910, 0x591b, 0x68a6, 0x5925, 0x592c, 0x592d, 0x5932, 0x5938, 0x593e, 0x7ad2, 0x5955, 0x5950, 0x594e, 0x595a, 0x5958, 0x5962, 0x5960, 0x5967, 0x596c, 0x5969, /* 0x55 */ 0x5978, 0x5981, 0x599d, 0x4f5e, 0x4fab, 0x59a3, 0x59b2, 0x59c6, 0x59e8, 0x59dc, 0x598d, 0x59d9, 0x59da, 0x5a25, 0x5a1f, 0x5a11, 0x5a1c, 0x5a09, 0x5a1a, 0x5a40, 0x5a6c, 0x5a49, 0x5a35, 0x5a36, 0x5a62, 0x5a6a, 0x5a9a, 0x5abc, 0x5abe, 0x5acb, 0x5ac2, 0x5abd, 0x5ae3, 0x5ad7, 0x5ae6, 0x5ae9, 0x5ad6, 0x5afa, 0x5afb, 0x5b0c, 0x5b0b, 0x5b16, 0x5b32, 0x5ad0, 0x5b2a, 0x5b36, 0x5b3e, 0x5b43, 0x5b45, 0x5b40, 0x5b51, 0x5b55, 0x5b5a, 0x5b5b, 0x5b65, 0x5b69, 0x5b70, 0x5b73, 0x5b75, 0x5b78, 0x6588, 0x5b7a, 0x5b80, 0x5b83, 0x5ba6, 0x5bb8, 0x5bc3, 0x5bc7, 0x5bc9, 0x5bd4, 0x5bd0, 0x5be4, 0x5be6, 0x5be2, 0x5bde, 0x5be5, 0x5beb, 0x5bf0, 0x5bf6, 0x5bf3, 0x5c05, 0x5c07, 0x5c08, 0x5c0d, 0x5c13, 0x5c20, 0x5c22, 0x5c28, 0x5c38, 0x5c39, 0x5c41, 0x5c46, 0x5c4e, 0x5c53, /* 0x56 */ 0x5c50, 0x5c4f, 0x5b71, 0x5c6c, 0x5c6e, 0x4e62, 0x5c76, 0x5c79, 0x5c8c, 0x5c91, 0x5c94, 0x599b, 0x5cab, 0x5cbb, 0x5cb6, 0x5cbc, 0x5cb7, 0x5cc5, 0x5cbe, 0x5cc7, 0x5cd9, 0x5ce9, 0x5cfd, 0x5cfa, 0x5ced, 0x5d8c, 0x5cea, 0x5d0b, 0x5d15, 0x5d17, 0x5d5c, 0x5d1f, 0x5d1b, 0x5d11, 0x5d14, 0x5d22, 0x5d1a, 0x5d19, 0x5d18, 0x5d4c, 0x5d52, 0x5d4e, 0x5d4b, 0x5d6c, 0x5d73, 0x5d76, 0x5d87, 0x5d84, 0x5d82, 0x5da2, 0x5d9d, 0x5dac, 0x5dae, 0x5dbd, 0x5d90, 0x5db7, 0x5dbc, 0x5dc9, 0x5dcd, 0x5dd3, 0x5dd2, 0x5dd6, 0x5ddb, 0x5deb, 0x5df2, 0x5df5, 0x5e0b, 0x5e1a, 0x5e19, 0x5e11, 0x5e1b, 0x5e36, 0x5e37, 0x5e44, 0x5e43, 0x5e40, 0x5e4e, 0x5e57, 0x5e54, 0x5e5f, 0x5e62, 0x5e64, 0x5e47, 0x5e75, 0x5e76, 0x5e7a, 0x9ebc, 0x5e7f, 0x5ea0, 0x5ec1, 0x5ec2, 0x5ec8, 0x5ed0, 0x5ecf, /* 0x57 */ 0x5ed6, 0x5ee3, 0x5edd, 0x5eda, 0x5edb, 0x5ee2, 0x5ee1, 0x5ee8, 0x5ee9, 0x5eec, 0x5ef1, 0x5ef3, 0x5ef0, 0x5ef4, 0x5ef8, 0x5efe, 0x5f03, 0x5f09, 0x5f5d, 0x5f5c, 0x5f0b, 0x5f11, 0x5f16, 0x5f29, 0x5f2d, 0x5f38, 0x5f41, 0x5f48, 0x5f4c, 0x5f4e, 0x5f2f, 0x5f51, 0x5f56, 0x5f57, 0x5f59, 0x5f61, 0x5f6d, 0x5f73, 0x5f77, 0x5f83, 0x5f82, 0x5f7f, 0x5f8a, 0x5f88, 0x5f91, 0x5f87, 0x5f9e, 0x5f99, 0x5f98, 0x5fa0, 0x5fa8, 0x5fad, 0x5fbc, 0x5fd6, 0x5ffb, 0x5fe4, 0x5ff8, 0x5ff1, 0x5fdd, 0x60b3, 0x5fff, 0x6021, 0x6060, 0x6019, 0x6010, 0x6029, 0x600e, 0x6031, 0x601b, 0x6015, 0x602b, 0x6026, 0x600f, 0x603a, 0x605a, 0x6041, 0x606a, 0x6077, 0x605f, 0x604a, 0x6046, 0x604d, 0x6063, 0x6043, 0x6064, 0x6042, 0x606c, 0x606b, 0x6059, 0x6081, 0x608d, 0x60e7, 0x6083, 0x609a, /* 0x58 */ 0x6084, 0x609b, 0x6096, 0x6097, 0x6092, 0x60a7, 0x608b, 0x60e1, 0x60b8, 0x60e0, 0x60d3, 0x60b4, 0x5ff0, 0x60bd, 0x60c6, 0x60b5, 0x60d8, 0x614d, 0x6115, 0x6106, 0x60f6, 0x60f7, 0x6100, 0x60f4, 0x60fa, 0x6103, 0x6121, 0x60fb, 0x60f1, 0x610d, 0x610e, 0x6147, 0x613e, 0x6128, 0x6127, 0x614a, 0x613f, 0x613c, 0x612c, 0x6134, 0x613d, 0x6142, 0x6144, 0x6173, 0x6177, 0x6158, 0x6159, 0x615a, 0x616b, 0x6174, 0x616f, 0x6165, 0x6171, 0x615f, 0x615d, 0x6153, 0x6175, 0x6199, 0x6196, 0x6187, 0x61ac, 0x6194, 0x619a, 0x618a, 0x6191, 0x61ab, 0x61ae, 0x61cc, 0x61ca, 0x61c9, 0x61f7, 0x61c8, 0x61c3, 0x61c6, 0x61ba, 0x61cb, 0x7f79, 0x61cd, 0x61e6, 0x61e3, 0x61f6, 0x61fa, 0x61f4, 0x61ff, 0x61fd, 0x61fc, 0x61fe, 0x6200, 0x6208, 0x6209, 0x620d, 0x620c, 0x6214, 0x621b, /* 0x59 */ 0x621e, 0x6221, 0x622a, 0x622e, 0x6230, 0x6232, 0x6233, 0x6241, 0x624e, 0x625e, 0x6263, 0x625b, 0x6260, 0x6268, 0x627c, 0x6282, 0x6289, 0x627e, 0x6292, 0x6293, 0x6296, 0x62d4, 0x6283, 0x6294, 0x62d7, 0x62d1, 0x62bb, 0x62cf, 0x62ff, 0x62c6, 0x64d4, 0x62c8, 0x62dc, 0x62cc, 0x62ca, 0x62c2, 0x62c7, 0x629b, 0x62c9, 0x630c, 0x62ee, 0x62f1, 0x6327, 0x6302, 0x6308, 0x62ef, 0x62f5, 0x6350, 0x633e, 0x634d, 0x641c, 0x634f, 0x6396, 0x638e, 0x6380, 0x63ab, 0x6376, 0x63a3, 0x638f, 0x6389, 0x639f, 0x63b5, 0x636b, 0x6369, 0x63be, 0x63e9, 0x63c0, 0x63c6, 0x63e3, 0x63c9, 0x63d2, 0x63f6, 0x63c4, 0x6416, 0x6434, 0x6406, 0x6413, 0x6426, 0x6436, 0x651d, 0x6417, 0x6428, 0x640f, 0x6467, 0x646f, 0x6476, 0x644e, 0x652a, 0x6495, 0x6493, 0x64a5, 0x64a9, 0x6488, 0x64bc, /* 0x5a */ 0x64da, 0x64d2, 0x64c5, 0x64c7, 0x64bb, 0x64d8, 0x64c2, 0x64f1, 0x64e7, 0x8209, 0x64e0, 0x64e1, 0x62ac, 0x64e3, 0x64ef, 0x652c, 0x64f6, 0x64f4, 0x64f2, 0x64fa, 0x6500, 0x64fd, 0x6518, 0x651c, 0x6505, 0x6524, 0x6523, 0x652b, 0x6534, 0x6535, 0x6537, 0x6536, 0x6538, 0x754b, 0x6548, 0x6556, 0x6555, 0x654d, 0x6558, 0x655e, 0x655d, 0x6572, 0x6578, 0x6582, 0x6583, 0x8b8a, 0x659b, 0x659f, 0x65ab, 0x65b7, 0x65c3, 0x65c6, 0x65c1, 0x65c4, 0x65cc, 0x65d2, 0x65db, 0x65d9, 0x65e0, 0x65e1, 0x65f1, 0x6772, 0x660a, 0x6603, 0x65fb, 0x6773, 0x6635, 0x6636, 0x6634, 0x661c, 0x664f, 0x6644, 0x6649, 0x6641, 0x665e, 0x665d, 0x6664, 0x6667, 0x6668, 0x665f, 0x6662, 0x6670, 0x6683, 0x6688, 0x668e, 0x6689, 0x6684, 0x6698, 0x669d, 0x66c1, 0x66b9, 0x66c9, 0x66be, 0x66bc, /* 0x5b */ 0x66c4, 0x66b8, 0x66d6, 0x66da, 0x66e0, 0x663f, 0x66e6, 0x66e9, 0x66f0, 0x66f5, 0x66f7, 0x670f, 0x6716, 0x671e, 0x6726, 0x6727, 0x9738, 0x672e, 0x673f, 0x6736, 0x6741, 0x6738, 0x6737, 0x6746, 0x675e, 0x6760, 0x6759, 0x6763, 0x6764, 0x6789, 0x6770, 0x67a9, 0x677c, 0x676a, 0x678c, 0x678b, 0x67a6, 0x67a1, 0x6785, 0x67b7, 0x67ef, 0x67b4, 0x67ec, 0x67b3, 0x67e9, 0x67b8, 0x67e4, 0x67de, 0x67dd, 0x67e2, 0x67ee, 0x67b9, 0x67ce, 0x67c6, 0x67e7, 0x6a9c, 0x681e, 0x6846, 0x6829, 0x6840, 0x684d, 0x6832, 0x684e, 0x68b3, 0x682b, 0x6859, 0x6863, 0x6877, 0x687f, 0x689f, 0x688f, 0x68ad, 0x6894, 0x689d, 0x689b, 0x6883, 0x6aae, 0x68b9, 0x6874, 0x68b5, 0x68a0, 0x68ba, 0x690f, 0x688d, 0x687e, 0x6901, 0x68ca, 0x6908, 0x68d8, 0x6922, 0x6926, 0x68e1, 0x690c, 0x68cd, /* 0x5c */ 0x68d4, 0x68e7, 0x68d5, 0x6936, 0x6912, 0x6904, 0x68d7, 0x68e3, 0x6925, 0x68f9, 0x68e0, 0x68ef, 0x6928, 0x692a, 0x691a, 0x6923, 0x6921, 0x68c6, 0x6979, 0x6977, 0x695c, 0x6978, 0x696b, 0x6954, 0x697e, 0x696e, 0x6939, 0x6974, 0x693d, 0x6959, 0x6930, 0x6961, 0x695e, 0x695d, 0x6981, 0x696a, 0x69b2, 0x69ae, 0x69d0, 0x69bf, 0x69c1, 0x69d3, 0x69be, 0x69ce, 0x5be8, 0x69ca, 0x69dd, 0x69bb, 0x69c3, 0x69a7, 0x6a2e, 0x6991, 0x69a0, 0x699c, 0x6995, 0x69b4, 0x69de, 0x69e8, 0x6a02, 0x6a1b, 0x69ff, 0x6b0a, 0x69f9, 0x69f2, 0x69e7, 0x6a05, 0x69b1, 0x6a1e, 0x69ed, 0x6a14, 0x69eb, 0x6a0a, 0x6a12, 0x6ac1, 0x6a23, 0x6a13, 0x6a44, 0x6a0c, 0x6a72, 0x6a36, 0x6a78, 0x6a47, 0x6a62, 0x6a59, 0x6a66, 0x6a48, 0x6a38, 0x6a22, 0x6a90, 0x6a8d, 0x6aa0, 0x6a84, 0x6aa2, 0x6aa3, /* 0x5d */ 0x6a97, 0x8617, 0x6abb, 0x6ac3, 0x6ac2, 0x6ab8, 0x6ab3, 0x6aac, 0x6ade, 0x6ad1, 0x6adf, 0x6aaa, 0x6ada, 0x6aea, 0x6afb, 0x6b05, 0x8616, 0x6afa, 0x6b12, 0x6b16, 0x9b31, 0x6b1f, 0x6b38, 0x6b37, 0x76dc, 0x6b39, 0x98ee, 0x6b47, 0x6b43, 0x6b49, 0x6b50, 0x6b59, 0x6b54, 0x6b5b, 0x6b5f, 0x6b61, 0x6b78, 0x6b79, 0x6b7f, 0x6b80, 0x6b84, 0x6b83, 0x6b8d, 0x6b98, 0x6b95, 0x6b9e, 0x6ba4, 0x6baa, 0x6bab, 0x6baf, 0x6bb2, 0x6bb1, 0x6bb3, 0x6bb7, 0x6bbc, 0x6bc6, 0x6bcb, 0x6bd3, 0x6bdf, 0x6bec, 0x6beb, 0x6bf3, 0x6bef, 0x9ebe, 0x6c08, 0x6c13, 0x6c14, 0x6c1b, 0x6c24, 0x6c23, 0x6c5e, 0x6c55, 0x6c62, 0x6c6a, 0x6c82, 0x6c8d, 0x6c9a, 0x6c81, 0x6c9b, 0x6c7e, 0x6c68, 0x6c73, 0x6c92, 0x6c90, 0x6cc4, 0x6cf1, 0x6cd3, 0x6cbd, 0x6cd7, 0x6cc5, 0x6cdd, 0x6cae, 0x6cb1, 0x6cbe, /* 0x5e */ 0x6cba, 0x6cdb, 0x6cef, 0x6cd9, 0x6cea, 0x6d1f, 0x884d, 0x6d36, 0x6d2b, 0x6d3d, 0x6d38, 0x6d19, 0x6d35, 0x6d33, 0x6d12, 0x6d0c, 0x6d63, 0x6d93, 0x6d64, 0x6d5a, 0x6d79, 0x6d59, 0x6d8e, 0x6d95, 0x6fe4, 0x6d85, 0x6df9, 0x6e15, 0x6e0a, 0x6db5, 0x6dc7, 0x6de6, 0x6db8, 0x6dc6, 0x6dec, 0x6dde, 0x6dcc, 0x6de8, 0x6dd2, 0x6dc5, 0x6dfa, 0x6dd9, 0x6de4, 0x6dd5, 0x6dea, 0x6dee, 0x6e2d, 0x6e6e, 0x6e2e, 0x6e19, 0x6e72, 0x6e5f, 0x6e3e, 0x6e23, 0x6e6b, 0x6e2b, 0x6e76, 0x6e4d, 0x6e1f, 0x6e43, 0x6e3a, 0x6e4e, 0x6e24, 0x6eff, 0x6e1d, 0x6e38, 0x6e82, 0x6eaa, 0x6e98, 0x6ec9, 0x6eb7, 0x6ed3, 0x6ebd, 0x6eaf, 0x6ec4, 0x6eb2, 0x6ed4, 0x6ed5, 0x6e8f, 0x6ea5, 0x6ec2, 0x6e9f, 0x6f41, 0x6f11, 0x704c, 0x6eec, 0x6ef8, 0x6efe, 0x6f3f, 0x6ef2, 0x6f31, 0x6eef, 0x6f32, 0x6ecc, /* 0x5f */ 0x6f3e, 0x6f13, 0x6ef7, 0x6f86, 0x6f7a, 0x6f78, 0x6f81, 0x6f80, 0x6f6f, 0x6f5b, 0x6ff3, 0x6f6d, 0x6f82, 0x6f7c, 0x6f58, 0x6f8e, 0x6f91, 0x6fc2, 0x6f66, 0x6fb3, 0x6fa3, 0x6fa1, 0x6fa4, 0x6fb9, 0x6fc6, 0x6faa, 0x6fdf, 0x6fd5, 0x6fec, 0x6fd4, 0x6fd8, 0x6ff1, 0x6fee, 0x6fdb, 0x7009, 0x700b, 0x6ffa, 0x7011, 0x7001, 0x700f, 0x6ffe, 0x701b, 0x701a, 0x6f74, 0x701d, 0x7018, 0x701f, 0x7030, 0x703e, 0x7032, 0x7051, 0x7063, 0x7099, 0x7092, 0x70af, 0x70f1, 0x70ac, 0x70b8, 0x70b3, 0x70ae, 0x70df, 0x70cb, 0x70dd, 0x70d9, 0x7109, 0x70fd, 0x711c, 0x7119, 0x7165, 0x7155, 0x7188, 0x7166, 0x7162, 0x714c, 0x7156, 0x716c, 0x718f, 0x71fb, 0x7184, 0x7195, 0x71a8, 0x71ac, 0x71d7, 0x71b9, 0x71be, 0x71d2, 0x71c9, 0x71d4, 0x71ce, 0x71e0, 0x71ec, 0x71e7, 0x71f5, 0x71fc, /* 0x60 */ 0x71f9, 0x71ff, 0x720d, 0x7210, 0x721b, 0x7228, 0x722d, 0x722c, 0x7230, 0x7232, 0x723b, 0x723c, 0x723f, 0x7240, 0x7246, 0x724b, 0x7258, 0x7274, 0x727e, 0x7282, 0x7281, 0x7287, 0x7292, 0x7296, 0x72a2, 0x72a7, 0x72b9, 0x72b2, 0x72c3, 0x72c6, 0x72c4, 0x72ce, 0x72d2, 0x72e2, 0x72e0, 0x72e1, 0x72f9, 0x72f7, 0x500f, 0x7317, 0x730a, 0x731c, 0x7316, 0x731d, 0x7334, 0x732f, 0x7329, 0x7325, 0x733e, 0x734e, 0x734f, 0x9ed8, 0x7357, 0x736a, 0x7368, 0x7370, 0x7378, 0x7375, 0x737b, 0x737a, 0x73c8, 0x73b3, 0x73ce, 0x73bb, 0x73c0, 0x73e5, 0x73ee, 0x73de, 0x74a2, 0x7405, 0x746f, 0x7425, 0x73f8, 0x7432, 0x743a, 0x7455, 0x743f, 0x745f, 0x7459, 0x7441, 0x745c, 0x7469, 0x7470, 0x7463, 0x746a, 0x7476, 0x747e, 0x748b, 0x749e, 0x74a7, 0x74ca, 0x74cf, 0x74d4, 0x73f1, /* 0x61 */ 0x74e0, 0x74e3, 0x74e7, 0x74e9, 0x74ee, 0x74f2, 0x74f0, 0x74f1, 0x74f8, 0x74f7, 0x7504, 0x7503, 0x7505, 0x750c, 0x750e, 0x750d, 0x7515, 0x7513, 0x751e, 0x7526, 0x752c, 0x753c, 0x7544, 0x754d, 0x754a, 0x7549, 0x755b, 0x7546, 0x755a, 0x7569, 0x7564, 0x7567, 0x756b, 0x756d, 0x7578, 0x7576, 0x7586, 0x7587, 0x7574, 0x758a, 0x7589, 0x7582, 0x7594, 0x759a, 0x759d, 0x75a5, 0x75a3, 0x75c2, 0x75b3, 0x75c3, 0x75b5, 0x75bd, 0x75b8, 0x75bc, 0x75b1, 0x75cd, 0x75ca, 0x75d2, 0x75d9, 0x75e3, 0x75de, 0x75fe, 0x75ff, 0x75fc, 0x7601, 0x75f0, 0x75fa, 0x75f2, 0x75f3, 0x760b, 0x760d, 0x7609, 0x761f, 0x7627, 0x7620, 0x7621, 0x7622, 0x7624, 0x7634, 0x7630, 0x763b, 0x7647, 0x7648, 0x7646, 0x765c, 0x7658, 0x7661, 0x7662, 0x7668, 0x7669, 0x766a, 0x7667, 0x766c, 0x7670, /* 0x62 */ 0x7672, 0x7676, 0x7678, 0x767c, 0x7680, 0x7683, 0x7688, 0x768b, 0x768e, 0x7696, 0x7693, 0x7699, 0x769a, 0x76b0, 0x76b4, 0x76b8, 0x76b9, 0x76ba, 0x76c2, 0x76cd, 0x76d6, 0x76d2, 0x76de, 0x76e1, 0x76e5, 0x76e7, 0x76ea, 0x862f, 0x76fb, 0x7708, 0x7707, 0x7704, 0x7729, 0x7724, 0x771e, 0x7725, 0x7726, 0x771b, 0x7737, 0x7738, 0x7747, 0x775a, 0x7768, 0x776b, 0x775b, 0x7765, 0x777f, 0x777e, 0x7779, 0x778e, 0x778b, 0x7791, 0x77a0, 0x779e, 0x77b0, 0x77b6, 0x77b9, 0x77bf, 0x77bc, 0x77bd, 0x77bb, 0x77c7, 0x77cd, 0x77d7, 0x77da, 0x77dc, 0x77e3, 0x77ee, 0x77fc, 0x780c, 0x7812, 0x7926, 0x7820, 0x792a, 0x7845, 0x788e, 0x7874, 0x7886, 0x787c, 0x789a, 0x788c, 0x78a3, 0x78b5, 0x78aa, 0x78af, 0x78d1, 0x78c6, 0x78cb, 0x78d4, 0x78be, 0x78bc, 0x78c5, 0x78ca, 0x78ec, /* 0x63 */ 0x78e7, 0x78da, 0x78fd, 0x78f4, 0x7907, 0x7912, 0x7911, 0x7919, 0x792c, 0x792b, 0x7940, 0x7960, 0x7957, 0x795f, 0x795a, 0x7955, 0x7953, 0x797a, 0x797f, 0x798a, 0x799d, 0x79a7, 0x9f4b, 0x79aa, 0x79ae, 0x79b3, 0x79b9, 0x79ba, 0x79c9, 0x79d5, 0x79e7, 0x79ec, 0x79e1, 0x79e3, 0x7a08, 0x7a0d, 0x7a18, 0x7a19, 0x7a20, 0x7a1f, 0x7980, 0x7a31, 0x7a3b, 0x7a3e, 0x7a37, 0x7a43, 0x7a57, 0x7a49, 0x7a61, 0x7a62, 0x7a69, 0x9f9d, 0x7a70, 0x7a79, 0x7a7d, 0x7a88, 0x7a97, 0x7a95, 0x7a98, 0x7a96, 0x7aa9, 0x7ac8, 0x7ab0, 0x7ab6, 0x7ac5, 0x7ac4, 0x7abf, 0x9083, 0x7ac7, 0x7aca, 0x7acd, 0x7acf, 0x7ad5, 0x7ad3, 0x7ad9, 0x7ada, 0x7add, 0x7ae1, 0x7ae2, 0x7ae6, 0x7aed, 0x7af0, 0x7b02, 0x7b0f, 0x7b0a, 0x7b06, 0x7b33, 0x7b18, 0x7b19, 0x7b1e, 0x7b35, 0x7b28, 0x7b36, 0x7b50, /* 0x64 */ 0x7b7a, 0x7b04, 0x7b4d, 0x7b0b, 0x7b4c, 0x7b45, 0x7b75, 0x7b65, 0x7b74, 0x7b67, 0x7b70, 0x7b71, 0x7b6c, 0x7b6e, 0x7b9d, 0x7b98, 0x7b9f, 0x7b8d, 0x7b9c, 0x7b9a, 0x7b8b, 0x7b92, 0x7b8f, 0x7b5d, 0x7b99, 0x7bcb, 0x7bc1, 0x7bcc, 0x7bcf, 0x7bb4, 0x7bc6, 0x7bdd, 0x7be9, 0x7c11, 0x7c14, 0x7be6, 0x7be5, 0x7c60, 0x7c00, 0x7c07, 0x7c13, 0x7bf3, 0x7bf7, 0x7c17, 0x7c0d, 0x7bf6, 0x7c23, 0x7c27, 0x7c2a, 0x7c1f, 0x7c37, 0x7c2b, 0x7c3d, 0x7c4c, 0x7c43, 0x7c54, 0x7c4f, 0x7c40, 0x7c50, 0x7c58, 0x7c5f, 0x7c64, 0x7c56, 0x7c65, 0x7c6c, 0x7c75, 0x7c83, 0x7c90, 0x7ca4, 0x7cad, 0x7ca2, 0x7cab, 0x7ca1, 0x7ca8, 0x7cb3, 0x7cb2, 0x7cb1, 0x7cae, 0x7cb9, 0x7cbd, 0x7cc0, 0x7cc5, 0x7cc2, 0x7cd8, 0x7cd2, 0x7cdc, 0x7ce2, 0x9b3b, 0x7cef, 0x7cf2, 0x7cf4, 0x7cf6, 0x7cfa, 0x7d06, /* 0x65 */ 0x7d02, 0x7d1c, 0x7d15, 0x7d0a, 0x7d45, 0x7d4b, 0x7d2e, 0x7d32, 0x7d3f, 0x7d35, 0x7d46, 0x7d73, 0x7d56, 0x7d4e, 0x7d72, 0x7d68, 0x7d6e, 0x7d4f, 0x7d63, 0x7d93, 0x7d89, 0x7d5b, 0x7d8f, 0x7d7d, 0x7d9b, 0x7dba, 0x7dae, 0x7da3, 0x7db5, 0x7dc7, 0x7dbd, 0x7dab, 0x7e3d, 0x7da2, 0x7daf, 0x7ddc, 0x7db8, 0x7d9f, 0x7db0, 0x7dd8, 0x7ddd, 0x7de4, 0x7dde, 0x7dfb, 0x7df2, 0x7de1, 0x7e05, 0x7e0a, 0x7e23, 0x7e21, 0x7e12, 0x7e31, 0x7e1f, 0x7e09, 0x7e0b, 0x7e22, 0x7e46, 0x7e66, 0x7e3b, 0x7e35, 0x7e39, 0x7e43, 0x7e37, 0x7e32, 0x7e3a, 0x7e67, 0x7e5d, 0x7e56, 0x7e5e, 0x7e59, 0x7e5a, 0x7e79, 0x7e6a, 0x7e69, 0x7e7c, 0x7e7b, 0x7e83, 0x7dd5, 0x7e7d, 0x8fae, 0x7e7f, 0x7e88, 0x7e89, 0x7e8c, 0x7e92, 0x7e90, 0x7e93, 0x7e94, 0x7e96, 0x7e8e, 0x7e9b, 0x7e9c, 0x7f38, 0x7f3a, /* 0x66 */ 0x7f45, 0x7f4c, 0x7f4d, 0x7f4e, 0x7f50, 0x7f51, 0x7f55, 0x7f54, 0x7f58, 0x7f5f, 0x7f60, 0x7f68, 0x7f69, 0x7f67, 0x7f78, 0x7f82, 0x7f86, 0x7f83, 0x7f88, 0x7f87, 0x7f8c, 0x7f94, 0x7f9e, 0x7f9d, 0x7f9a, 0x7fa3, 0x7faf, 0x7fb2, 0x7fb9, 0x7fae, 0x7fb6, 0x7fb8, 0x8b71, 0x7fc5, 0x7fc6, 0x7fca, 0x7fd5, 0x7fd4, 0x7fe1, 0x7fe6, 0x7fe9, 0x7ff3, 0x7ff9, 0x98dc, 0x8006, 0x8004, 0x800b, 0x8012, 0x8018, 0x8019, 0x801c, 0x8021, 0x8028, 0x803f, 0x803b, 0x804a, 0x8046, 0x8052, 0x8058, 0x805a, 0x805f, 0x8062, 0x8068, 0x8073, 0x8072, 0x8070, 0x8076, 0x8079, 0x807d, 0x807f, 0x8084, 0x8086, 0x8085, 0x809b, 0x8093, 0x809a, 0x80ad, 0x5190, 0x80ac, 0x80db, 0x80e5, 0x80d9, 0x80dd, 0x80c4, 0x80da, 0x80d6, 0x8109, 0x80ef, 0x80f1, 0x811b, 0x8129, 0x8123, 0x812f, 0x814b, /* 0x67 */ 0x968b, 0x8146, 0x813e, 0x8153, 0x8151, 0x80fc, 0x8171, 0x816e, 0x8165, 0x8166, 0x8174, 0x8183, 0x8188, 0x818a, 0x8180, 0x8182, 0x81a0, 0x8195, 0x81a4, 0x81a3, 0x815f, 0x8193, 0x81a9, 0x81b0, 0x81b5, 0x81be, 0x81b8, 0x81bd, 0x81c0, 0x81c2, 0x81ba, 0x81c9, 0x81cd, 0x81d1, 0x81d9, 0x81d8, 0x81c8, 0x81da, 0x81df, 0x81e0, 0x81e7, 0x81fa, 0x81fb, 0x81fe, 0x8201, 0x8202, 0x8205, 0x8207, 0x820a, 0x820d, 0x8210, 0x8216, 0x8229, 0x822b, 0x8238, 0x8233, 0x8240, 0x8259, 0x8258, 0x825d, 0x825a, 0x825f, 0x8264, 0x8262, 0x8268, 0x826a, 0x826b, 0x822e, 0x8271, 0x8277, 0x8278, 0x827e, 0x828d, 0x8292, 0x82ab, 0x829f, 0x82bb, 0x82ac, 0x82e1, 0x82e3, 0x82df, 0x82d2, 0x82f4, 0x82f3, 0x82fa, 0x8393, 0x8303, 0x82fb, 0x82f9, 0x82de, 0x8306, 0x82dc, 0x8309, 0x82d9, /* 0x68 */ 0x8335, 0x8334, 0x8316, 0x8332, 0x8331, 0x8340, 0x8339, 0x8350, 0x8345, 0x832f, 0x832b, 0x8317, 0x8318, 0x8385, 0x839a, 0x83aa, 0x839f, 0x83a2, 0x8396, 0x8323, 0x838e, 0x8387, 0x838a, 0x837c, 0x83b5, 0x8373, 0x8375, 0x83a0, 0x8389, 0x83a8, 0x83f4, 0x8413, 0x83eb, 0x83ce, 0x83fd, 0x8403, 0x83d8, 0x840b, 0x83c1, 0x83f7, 0x8407, 0x83e0, 0x83f2, 0x840d, 0x8422, 0x8420, 0x83bd, 0x8438, 0x8506, 0x83fb, 0x846d, 0x842a, 0x843c, 0x855a, 0x8484, 0x8477, 0x846b, 0x84ad, 0x846e, 0x8482, 0x8469, 0x8446, 0x842c, 0x846f, 0x8479, 0x8435, 0x84ca, 0x8462, 0x84b9, 0x84bf, 0x849f, 0x84d9, 0x84cd, 0x84bb, 0x84da, 0x84d0, 0x84c1, 0x84c6, 0x84d6, 0x84a1, 0x8521, 0x84ff, 0x84f4, 0x8517, 0x8518, 0x852c, 0x851f, 0x8515, 0x8514, 0x84fc, 0x8540, 0x8563, 0x8558, 0x8548, /* 0x69 */ 0x8541, 0x8602, 0x854b, 0x8555, 0x8580, 0x85a4, 0x8588, 0x8591, 0x858a, 0x85a8, 0x856d, 0x8594, 0x859b, 0x85ea, 0x8587, 0x859c, 0x8577, 0x857e, 0x8590, 0x85c9, 0x85ba, 0x85cf, 0x85b9, 0x85d0, 0x85d5, 0x85dd, 0x85e5, 0x85dc, 0x85f9, 0x860a, 0x8613, 0x860b, 0x85fe, 0x85fa, 0x8606, 0x8622, 0x861a, 0x8630, 0x863f, 0x864d, 0x4e55, 0x8654, 0x865f, 0x8667, 0x8671, 0x8693, 0x86a3, 0x86a9, 0x86aa, 0x868b, 0x868c, 0x86b6, 0x86af, 0x86c4, 0x86c6, 0x86b0, 0x86c9, 0x8823, 0x86ab, 0x86d4, 0x86de, 0x86e9, 0x86ec, 0x86df, 0x86db, 0x86ef, 0x8712, 0x8706, 0x8708, 0x8700, 0x8703, 0x86fb, 0x8711, 0x8709, 0x870d, 0x86f9, 0x870a, 0x8734, 0x873f, 0x8737, 0x873b, 0x8725, 0x8729, 0x871a, 0x8760, 0x875f, 0x8778, 0x874c, 0x874e, 0x8774, 0x8757, 0x8768, 0x876e, 0x8759, /* 0x6a */ 0x8753, 0x8763, 0x876a, 0x8805, 0x87a2, 0x879f, 0x8782, 0x87af, 0x87cb, 0x87bd, 0x87c0, 0x87d0, 0x96d6, 0x87ab, 0x87c4, 0x87b3, 0x87c7, 0x87c6, 0x87bb, 0x87ef, 0x87f2, 0x87e0, 0x880f, 0x880d, 0x87fe, 0x87f6, 0x87f7, 0x880e, 0x87d2, 0x8811, 0x8816, 0x8815, 0x8822, 0x8821, 0x8831, 0x8836, 0x8839, 0x8827, 0x883b, 0x8844, 0x8842, 0x8852, 0x8859, 0x885e, 0x8862, 0x886b, 0x8881, 0x887e, 0x889e, 0x8875, 0x887d, 0x88b5, 0x8872, 0x8882, 0x8897, 0x8892, 0x88ae, 0x8899, 0x88a2, 0x888d, 0x88a4, 0x88b0, 0x88bf, 0x88b1, 0x88c3, 0x88c4, 0x88d4, 0x88d8, 0x88d9, 0x88dd, 0x88f9, 0x8902, 0x88fc, 0x88f4, 0x88e8, 0x88f2, 0x8904, 0x890c, 0x890a, 0x8913, 0x8943, 0x891e, 0x8925, 0x892a, 0x892b, 0x8941, 0x8944, 0x893b, 0x8936, 0x8938, 0x894c, 0x891d, 0x8960, 0x895e, /* 0x6b */ 0x8966, 0x8964, 0x896d, 0x896a, 0x896f, 0x8974, 0x8977, 0x897e, 0x8983, 0x8988, 0x898a, 0x8993, 0x8998, 0x89a1, 0x89a9, 0x89a6, 0x89ac, 0x89af, 0x89b2, 0x89ba, 0x89bd, 0x89bf, 0x89c0, 0x89da, 0x89dc, 0x89dd, 0x89e7, 0x89f4, 0x89f8, 0x8a03, 0x8a16, 0x8a10, 0x8a0c, 0x8a1b, 0x8a1d, 0x8a25, 0x8a36, 0x8a41, 0x8a5b, 0x8a52, 0x8a46, 0x8a48, 0x8a7c, 0x8a6d, 0x8a6c, 0x8a62, 0x8a85, 0x8a82, 0x8a84, 0x8aa8, 0x8aa1, 0x8a91, 0x8aa5, 0x8aa6, 0x8a9a, 0x8aa3, 0x8ac4, 0x8acd, 0x8ac2, 0x8ada, 0x8aeb, 0x8af3, 0x8ae7, 0x8ae4, 0x8af1, 0x8b14, 0x8ae0, 0x8ae2, 0x8af7, 0x8ade, 0x8adb, 0x8b0c, 0x8b07, 0x8b1a, 0x8ae1, 0x8b16, 0x8b10, 0x8b17, 0x8b20, 0x8b33, 0x97ab, 0x8b26, 0x8b2b, 0x8b3e, 0x8b28, 0x8b41, 0x8b4c, 0x8b4f, 0x8b4e, 0x8b49, 0x8b56, 0x8b5b, 0x8b5a, 0x8b6b, /* 0x6c */ 0x8b5f, 0x8b6c, 0x8b6f, 0x8b74, 0x8b7d, 0x8b80, 0x8b8c, 0x8b8e, 0x8b92, 0x8b93, 0x8b96, 0x8b99, 0x8b9a, 0x8c3a, 0x8c41, 0x8c3f, 0x8c48, 0x8c4c, 0x8c4e, 0x8c50, 0x8c55, 0x8c62, 0x8c6c, 0x8c78, 0x8c7a, 0x8c82, 0x8c89, 0x8c85, 0x8c8a, 0x8c8d, 0x8c8e, 0x8c94, 0x8c7c, 0x8c98, 0x621d, 0x8cad, 0x8caa, 0x8cbd, 0x8cb2, 0x8cb3, 0x8cae, 0x8cb6, 0x8cc8, 0x8cc1, 0x8ce4, 0x8ce3, 0x8cda, 0x8cfd, 0x8cfa, 0x8cfb, 0x8d04, 0x8d05, 0x8d0a, 0x8d07, 0x8d0f, 0x8d0d, 0x8d10, 0x9f4e, 0x8d13, 0x8ccd, 0x8d14, 0x8d16, 0x8d67, 0x8d6d, 0x8d71, 0x8d73, 0x8d81, 0x8d99, 0x8dc2, 0x8dbe, 0x8dba, 0x8dcf, 0x8dda, 0x8dd6, 0x8dcc, 0x8ddb, 0x8dcb, 0x8dea, 0x8deb, 0x8ddf, 0x8de3, 0x8dfc, 0x8e08, 0x8e09, 0x8dff, 0x8e1d, 0x8e1e, 0x8e10, 0x8e1f, 0x8e42, 0x8e35, 0x8e30, 0x8e34, 0x8e4a, /* 0x6d */ 0x8e47, 0x8e49, 0x8e4c, 0x8e50, 0x8e48, 0x8e59, 0x8e64, 0x8e60, 0x8e2a, 0x8e63, 0x8e55, 0x8e76, 0x8e72, 0x8e7c, 0x8e81, 0x8e87, 0x8e85, 0x8e84, 0x8e8b, 0x8e8a, 0x8e93, 0x8e91, 0x8e94, 0x8e99, 0x8eaa, 0x8ea1, 0x8eac, 0x8eb0, 0x8ec6, 0x8eb1, 0x8ebe, 0x8ec5, 0x8ec8, 0x8ecb, 0x8edb, 0x8ee3, 0x8efc, 0x8efb, 0x8eeb, 0x8efe, 0x8f0a, 0x8f05, 0x8f15, 0x8f12, 0x8f19, 0x8f13, 0x8f1c, 0x8f1f, 0x8f1b, 0x8f0c, 0x8f26, 0x8f33, 0x8f3b, 0x8f39, 0x8f45, 0x8f42, 0x8f3e, 0x8f4c, 0x8f49, 0x8f46, 0x8f4e, 0x8f57, 0x8f5c, 0x8f62, 0x8f63, 0x8f64, 0x8f9c, 0x8f9f, 0x8fa3, 0x8fad, 0x8faf, 0x8fb7, 0x8fda, 0x8fe5, 0x8fe2, 0x8fea, 0x8fef, 0x9087, 0x8ff4, 0x9005, 0x8ff9, 0x8ffa, 0x9011, 0x9015, 0x9021, 0x900d, 0x901e, 0x9016, 0x900b, 0x9027, 0x9036, 0x9035, 0x9039, 0x8ff8, /* 0x6e */ 0x904f, 0x9050, 0x9051, 0x9052, 0x900e, 0x9049, 0x903e, 0x9056, 0x9058, 0x905e, 0x9068, 0x906f, 0x9076, 0x96a8, 0x9072, 0x9082, 0x907d, 0x9081, 0x9080, 0x908a, 0x9089, 0x908f, 0x90a8, 0x90af, 0x90b1, 0x90b5, 0x90e2, 0x90e4, 0x6248, 0x90db, 0x9102, 0x9112, 0x9119, 0x9132, 0x9130, 0x914a, 0x9156, 0x9158, 0x9163, 0x9165, 0x9169, 0x9173, 0x9172, 0x918b, 0x9189, 0x9182, 0x91a2, 0x91ab, 0x91af, 0x91aa, 0x91b5, 0x91b4, 0x91ba, 0x91c0, 0x91c1, 0x91c9, 0x91cb, 0x91d0, 0x91d6, 0x91df, 0x91e1, 0x91db, 0x91fc, 0x91f5, 0x91f6, 0x921e, 0x91ff, 0x9214, 0x922c, 0x9215, 0x9211, 0x925e, 0x9257, 0x9245, 0x9249, 0x9264, 0x9248, 0x9295, 0x923f, 0x924b, 0x9250, 0x929c, 0x9296, 0x9293, 0x929b, 0x925a, 0x92cf, 0x92b9, 0x92b7, 0x92e9, 0x930f, 0x92fa, 0x9344, 0x932e, /* 0x6f */ 0x9319, 0x9322, 0x931a, 0x9323, 0x933a, 0x9335, 0x933b, 0x935c, 0x9360, 0x937c, 0x936e, 0x9356, 0x93b0, 0x93ac, 0x93ad, 0x9394, 0x93b9, 0x93d6, 0x93d7, 0x93e8, 0x93e5, 0x93d8, 0x93c3, 0x93dd, 0x93d0, 0x93c8, 0x93e4, 0x941a, 0x9414, 0x9413, 0x9403, 0x9407, 0x9410, 0x9436, 0x942b, 0x9435, 0x9421, 0x943a, 0x9441, 0x9452, 0x9444, 0x945b, 0x9460, 0x9462, 0x945e, 0x946a, 0x9229, 0x9470, 0x9475, 0x9477, 0x947d, 0x945a, 0x947c, 0x947e, 0x9481, 0x947f, 0x9582, 0x9587, 0x958a, 0x9594, 0x9596, 0x9598, 0x9599, 0x95a0, 0x95a8, 0x95a7, 0x95ad, 0x95bc, 0x95bb, 0x95b9, 0x95be, 0x95ca, 0x6ff6, 0x95c3, 0x95cd, 0x95cc, 0x95d5, 0x95d4, 0x95d6, 0x95dc, 0x95e1, 0x95e5, 0x95e2, 0x9621, 0x9628, 0x962e, 0x962f, 0x9642, 0x964c, 0x964f, 0x964b, 0x9677, 0x965c, 0x965e, /* 0x70 */ 0x965d, 0x965f, 0x9666, 0x9672, 0x966c, 0x968d, 0x9698, 0x9695, 0x9697, 0x96aa, 0x96a7, 0x96b1, 0x96b2, 0x96b0, 0x96b4, 0x96b6, 0x96b8, 0x96b9, 0x96ce, 0x96cb, 0x96c9, 0x96cd, 0x894d, 0x96dc, 0x970d, 0x96d5, 0x96f9, 0x9704, 0x9706, 0x9708, 0x9713, 0x970e, 0x9711, 0x970f, 0x9716, 0x9719, 0x9724, 0x972a, 0x9730, 0x9739, 0x973d, 0x973e, 0x9744, 0x9746, 0x9748, 0x9742, 0x9749, 0x975c, 0x9760, 0x9764, 0x9766, 0x9768, 0x52d2, 0x976b, 0x9771, 0x9779, 0x9785, 0x977c, 0x9781, 0x977a, 0x9786, 0x978b, 0x978f, 0x9790, 0x979c, 0x97a8, 0x97a6, 0x97a3, 0x97b3, 0x97b4, 0x97c3, 0x97c6, 0x97c8, 0x97cb, 0x97dc, 0x97ed, 0x9f4f, 0x97f2, 0x7adf, 0x97f6, 0x97f5, 0x980f, 0x980c, 0x9838, 0x9824, 0x9821, 0x9837, 0x983d, 0x9846, 0x984f, 0x984b, 0x986b, 0x986f, 0x9870, /* 0x71 */ 0x9871, 0x9874, 0x9873, 0x98aa, 0x98af, 0x98b1, 0x98b6, 0x98c4, 0x98c3, 0x98c6, 0x98e9, 0x98eb, 0x9903, 0x9909, 0x9912, 0x9914, 0x9918, 0x9921, 0x991d, 0x991e, 0x9924, 0x9920, 0x992c, 0x992e, 0x993d, 0x993e, 0x9942, 0x9949, 0x9945, 0x9950, 0x994b, 0x9951, 0x9952, 0x994c, 0x9955, 0x9997, 0x9998, 0x99a5, 0x99ad, 0x99ae, 0x99bc, 0x99df, 0x99db, 0x99dd, 0x99d8, 0x99d1, 0x99ed, 0x99ee, 0x99f1, 0x99f2, 0x99fb, 0x99f8, 0x9a01, 0x9a0f, 0x9a05, 0x99e2, 0x9a19, 0x9a2b, 0x9a37, 0x9a45, 0x9a42, 0x9a40, 0x9a43, 0x9a3e, 0x9a55, 0x9a4d, 0x9a5b, 0x9a57, 0x9a5f, 0x9a62, 0x9a65, 0x9a64, 0x9a69, 0x9a6b, 0x9a6a, 0x9aad, 0x9ab0, 0x9abc, 0x9ac0, 0x9acf, 0x9ad1, 0x9ad3, 0x9ad4, 0x9ade, 0x9adf, 0x9ae2, 0x9ae3, 0x9ae6, 0x9aef, 0x9aeb, 0x9aee, 0x9af4, 0x9af1, 0x9af7, /* 0x72 */ 0x9afb, 0x9b06, 0x9b18, 0x9b1a, 0x9b1f, 0x9b22, 0x9b23, 0x9b25, 0x9b27, 0x9b28, 0x9b29, 0x9b2a, 0x9b2e, 0x9b2f, 0x9b32, 0x9b44, 0x9b43, 0x9b4f, 0x9b4d, 0x9b4e, 0x9b51, 0x9b58, 0x9b74, 0x9b93, 0x9b83, 0x9b91, 0x9b96, 0x9b97, 0x9b9f, 0x9ba0, 0x9ba8, 0x9bb4, 0x9bc0, 0x9bca, 0x9bb9, 0x9bc6, 0x9bcf, 0x9bd1, 0x9bd2, 0x9be3, 0x9be2, 0x9be4, 0x9bd4, 0x9be1, 0x9c3a, 0x9bf2, 0x9bf1, 0x9bf0, 0x9c15, 0x9c14, 0x9c09, 0x9c13, 0x9c0c, 0x9c06, 0x9c08, 0x9c12, 0x9c0a, 0x9c04, 0x9c2e, 0x9c1b, 0x9c25, 0x9c24, 0x9c21, 0x9c30, 0x9c47, 0x9c32, 0x9c46, 0x9c3e, 0x9c5a, 0x9c60, 0x9c67, 0x9c76, 0x9c78, 0x9ce7, 0x9cec, 0x9cf0, 0x9d09, 0x9d08, 0x9ceb, 0x9d03, 0x9d06, 0x9d2a, 0x9d26, 0x9daf, 0x9d23, 0x9d1f, 0x9d44, 0x9d15, 0x9d12, 0x9d41, 0x9d3f, 0x9d3e, 0x9d46, 0x9d48, /* 0x73 */ 0x9d5d, 0x9d5e, 0x9d64, 0x9d51, 0x9d50, 0x9d59, 0x9d72, 0x9d89, 0x9d87, 0x9dab, 0x9d6f, 0x9d7a, 0x9d9a, 0x9da4, 0x9da9, 0x9db2, 0x9dc4, 0x9dc1, 0x9dbb, 0x9db8, 0x9dba, 0x9dc6, 0x9dcf, 0x9dc2, 0x9dd9, 0x9dd3, 0x9df8, 0x9de6, 0x9ded, 0x9def, 0x9dfd, 0x9e1a, 0x9e1b, 0x9e1e, 0x9e75, 0x9e79, 0x9e7d, 0x9e81, 0x9e88, 0x9e8b, 0x9e8c, 0x9e92, 0x9e95, 0x9e91, 0x9e9d, 0x9ea5, 0x9ea9, 0x9eb8, 0x9eaa, 0x9ead, 0x9761, 0x9ecc, 0x9ece, 0x9ecf, 0x9ed0, 0x9ed4, 0x9edc, 0x9ede, 0x9edd, 0x9ee0, 0x9ee5, 0x9ee8, 0x9eef, 0x9ef4, 0x9ef6, 0x9ef7, 0x9ef9, 0x9efb, 0x9efc, 0x9efd, 0x9f07, 0x9f08, 0x76b7, 0x9f15, 0x9f21, 0x9f2c, 0x9f3e, 0x9f4a, 0x9f52, 0x9f54, 0x9f63, 0x9f5f, 0x9f60, 0x9f61, 0x9f66, 0x9f67, 0x9f6c, 0x9f6a, 0x9f77, 0x9f72, 0x9f76, 0x9f95, 0x9f9c, 0x9fa0, /* 0x74 */ 0x582f, 0x69c7, 0x9059, 0x7464, 0x51dc, 0x7199, }; static int jisx0208_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c1 = (s[0] & 0x7F); if ((c1 >= 0x21 && c1 <= 0x28) || (c1 >= 0x30 && c1 <= 0x74)) { if (n >= 2) { unsigned char c2 = (s[1] & 0x7F); if (c2 >= 0x21 && c2 < 0x7f) { unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); unsigned short wc = 0xfffd; if (i < 1410) { if (i < 690) wc = jisx0208_2uni_page21[i]; } else { if (i < 7808) wc = jisx0208_2uni_page30[i-1410]; } if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 2; } } return RET_ILSEQ; } return RET_TOOFEW(0); } return RET_ILSEQ; } static const unsigned short jisx0208_2charset[6879] = { 0x2140, 0x2171, 0x2172, 0x2178, 0x212f, 0x224c, 0x216b, 0x215e, 0x212d, 0x2279, 0x215f, 0x2160, 0x2621, 0x2622, 0x2623, 0x2624, 0x2625, 0x2626, 0x2627, 0x2628, 0x2629, 0x262a, 0x262b, 0x262c, 0x262d, 0x262e, 0x262f, 0x2630, 0x2631, 0x2632, 0x2633, 0x2634, 0x2635, 0x2636, 0x2637, 0x2638, 0x2641, 0x2642, 0x2643, 0x2644, 0x2645, 0x2646, 0x2647, 0x2648, 0x2649, 0x264a, 0x264b, 0x264c, 0x264d, 0x264e, 0x264f, 0x2650, 0x2651, 0x2652, 0x2653, 0x2654, 0x2655, 0x2656, 0x2657, 0x2658, 0x2727, 0x2721, 0x2722, 0x2723, 0x2724, 0x2725, 0x2726, 0x2728, 0x2729, 0x272a, 0x272b, 0x272c, 0x272d, 0x272e, 0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, 0x2738, 0x2739, 0x273a, 0x273b, 0x273c, 0x273d, 0x273e, 0x273f, 0x2740, 0x2741, 0x2751, 0x2752, 0x2753, 0x2754, 0x2755, 0x2756, 0x2758, 0x2759, 0x275a, 0x275b, 0x275c, 0x275d, 0x275e, 0x275f, 0x2760, 0x2761, 0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x2768, 0x2769, 0x276a, 0x276b, 0x276c, 0x276d, 0x276e, 0x276f, 0x2770, 0x2771, 0x2757, 0x213e, 0x213d, 0x2142, 0x2146, 0x2147, 0x2148, 0x2149, 0x2277, 0x2278, 0x2145, 0x2144, 0x2273, 0x216c, 0x216d, 0x2228, 0x216e, 0x2272, 0x222b, 0x222c, 0x222a, 0x222d, 0x224d, 0x224e, 0x224f, 0x225f, 0x2250, 0x2260, 0x223a, 0x223b, 0x215d, 0x2265, 0x2267, 0x2167, 0x225c, 0x224a, 0x224b, 0x2241, 0x2240, 0x2269, 0x226a, 0x2168, 0x2268, 0x2266, 0x2262, 0x2162, 0x2261, 0x2165, 0x2166, 0x2263, 0x2264, 0x223e, 0x223f, 0x223c, 0x223d, 0x225d, 0x225e, 0x2821, 0x282c, 0x2822, 0x282d, 0x2823, 0x282e, 0x2824, 0x282f, 0x2826, 0x2831, 0x2825, 0x2830, 0x2827, 0x283c, 0x2837, 0x2832, 0x2829, 0x283e, 0x2839, 0x2834, 0x2828, 0x2838, 0x283d, 0x2833, 0x282a, 0x283a, 0x283f, 0x2835, 0x282b, 0x283b, 0x2840, 0x2836, 0x2223, 0x2222, 0x2225, 0x2224, 0x2227, 0x2226, 0x2221, 0x217e, 0x217b, 0x217d, 0x217c, 0x227e, 0x217a, 0x2179, 0x216a, 0x2169, 0x2276, 0x2275, 0x2274, 0x2121, 0x2122, 0x2123, 0x2137, 0x2139, 0x213a, 0x213b, 0x2152, 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, 0x215b, 0x2229, 0x222e, 0x214c, 0x214d, 0x2141, 0x2421, 0x2422, 0x2423, 0x2424, 0x2425, 0x2426, 0x2427, 0x2428, 0x2429, 0x242a, 0x242b, 0x242c, 0x242d, 0x242e, 0x242f, 0x2430, 0x2431, 0x2432, 0x2433, 0x2434, 0x2435, 0x2436, 0x2437, 0x2438, 0x2439, 0x243a, 0x243b, 0x243c, 0x243d, 0x243e, 0x243f, 0x2440, 0x2441, 0x2442, 0x2443, 0x2444, 0x2445, 0x2446, 0x2447, 0x2448, 0x2449, 0x244a, 0x244b, 0x244c, 0x244d, 0x244e, 0x244f, 0x2450, 0x2451, 0x2452, 0x2453, 0x2454, 0x2455, 0x2456, 0x2457, 0x2458, 0x2459, 0x245a, 0x245b, 0x245c, 0x245d, 0x245e, 0x245f, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, 0x2472, 0x2473, 0x212b, 0x212c, 0x2135, 0x2136, 0x2521, 0x2522, 0x2523, 0x2524, 0x2525, 0x2526, 0x2527, 0x2528, 0x2529, 0x252a, 0x252b, 0x252c, 0x252d, 0x252e, 0x252f, 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, 0x2535, 0x2536, 0x2537, 0x2538, 0x2539, 0x253a, 0x253b, 0x253c, 0x253d, 0x253e, 0x253f, 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, 0x254c, 0x254d, 0x254e, 0x254f, 0x2550, 0x2551, 0x2552, 0x2553, 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, 0x255e, 0x255f, 0x2560, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x256d, 0x256e, 0x256f, 0x2570, 0x2571, 0x2572, 0x2573, 0x2574, 0x2575, 0x2576, 0x2126, 0x213c, 0x2133, 0x2134, 0x306c, 0x437a, 0x3c37, 0x4b7c, 0x3e66, 0x3b30, 0x3e65, 0x323c, 0x4954, 0x4d3f, 0x5022, 0x312f, 0x336e, 0x5023, 0x4024, 0x5242, 0x3556, 0x4a3a, 0x3e67, 0x4e3e, 0x4a42, 0x5024, 0x4366, 0x5025, 0x367a, 0x5026, 0x345d, 0x4330, 0x3c67, 0x5027, 0x5028, 0x5029, 0x4735, 0x3557, 0x4737, 0x4663, 0x3843, 0x4b33, 0x6949, 0x502a, 0x3e68, 0x502b, 0x3235, 0x3665, 0x3870, 0x4c69, 0x5626, 0x4d70, 0x467d, 0x3425, 0x3535, 0x502c, 0x502d, 0x4e3b, 0x4d3d, 0x4168, 0x502f, 0x3b76, 0x4673, 0x5032, 0x313e, 0x385f, 0x385e, 0x3066, 0x4f4b, 0x4f4a, 0x3a33, 0x3021, 0x5033, 0x5034, 0x5035, 0x4b34, 0x5036, 0x3872, 0x3067, 0x4b72, 0x357c, 0x357d, 0x357e, 0x4462, 0x4e3c, 0x5037, 0x5038, 0x5039, 0x3f4d, 0x3d3a, 0x3f4e, 0x503e, 0x503c, 0x503d, 0x3558, 0x3a23, 0x3270, 0x503b, 0x503a, 0x4a29, 0x3b46, 0x3b45, 0x423e, 0x503f, 0x4955, 0x4067, 0x2138, 0x5040, 0x5042, 0x4265, 0x4e61, 0x304a, 0x5041, 0x323e, 0x3644, 0x4367, 0x376f, 0x5043, 0x4724, 0x346b, 0x5044, 0x304b, 0x3860, 0x346c, 0x497a, 0x4832, 0x3559, 0x3271, 0x5067, 0x4541, 0x476c, 0x5046, 0x483c, 0x4e62, 0x3f2d, 0x3b47, 0x3b77, 0x3240, 0x4451, 0x4322, 0x504a, 0x304c, 0x4463, 0x3d3b, 0x3a34, 0x4d24, 0x424e, 0x323f, 0x5049, 0x4d3e, 0x5045, 0x5047, 0x3a6e, 0x5048, 0x5524, 0x5050, 0x5053, 0x5051, 0x3242, 0x4a3b, 0x504b, 0x504f, 0x3873, 0x3b48, 0x3426, 0x5054, 0x504c, 0x4e63, 0x3b78, 0x504d, 0x5052, 0x5055, 0x504e, 0x3621, 0x304d, 0x3622, 0x3241, 0x5525, 0x4b79, 0x496e, 0x3874, 0x3f2f, 0x4e37, 0x4a58, 0x3738, 0x4225, 0x3264, 0x3d53, 0x5059, 0x505e, 0x505c, 0x5057, 0x422f, 0x505a, 0x505d, 0x505b, 0x4a5d, 0x5058, 0x3f2e, 0x4b73, 0x505f, 0x5060, 0x3d24, 0x506d, 0x4750, 0x4936, 0x5068, 0x4a70, 0x3236, 0x506c, 0x5066, 0x506f, 0x4152, 0x3844, 0x475c, 0x6047, 0x506e, 0x455d, 0x5063, 0x3876, 0x3875, 0x5061, 0x3c5a, 0x5069, 0x4a6f, 0x434d, 0x5065, 0x3771, 0x5062, 0x506a, 0x5064, 0x4e51, 0x506b, 0x4f41, 0x3666, 0x3770, 0x5070, 0x5071, 0x5075, 0x304e, 0x4a50, 0x5074, 0x5073, 0x5077, 0x5076, 0x4464, 0x3772, 0x5078, 0x3c45, 0x4226, 0x4465, 0x3676, 0x5079, 0x3536, 0x507a, 0x507c, 0x4b35, 0x3766, 0x3b31, 0x4877, 0x507b, 0x3a45, 0x4d43, 0x507e, 0x5123, 0x507d, 0x3a44, 0x3d7d, 0x3739, 0x5124, 0x364f, 0x5121, 0x5122, 0x462f, 0x417c, 0x3623, 0x4b4d, 0x5125, 0x4e3d, 0x5126, 0x5129, 0x5127, 0x414e, 0x5128, 0x512a, 0x512c, 0x512b, 0x4a48, 0x3537, 0x512e, 0x512f, 0x322f, 0x512d, 0x3c74, 0x5132, 0x5131, 0x5130, 0x5056, 0x5133, 0x3d7e, 0x5134, 0x4d25, 0x4c59, 0x5136, 0x5135, 0x5138, 0x5137, 0x5139, 0x513a, 0x3074, 0x3835, 0x373b, 0x3d3c, 0x437b, 0x3624, 0x4068, 0x3877, 0x396e, 0x513c, 0x4c48, 0x4546, 0x3b79, 0x513b, 0x513d, 0x455e, 0x3375, 0x513e, 0x467e, 0x4134, 0x5140, 0x5141, 0x482c, 0x3878, 0x4f3b, 0x5142, 0x3626, 0x4a3c, 0x4236, 0x3671, 0x4535, 0x3773, 0x5143, 0x5144, 0x4662, 0x315f, 0x5147, 0x3a7d, 0x5146, 0x3a46, 0x5148, 0x666e, 0x5149, 0x4b41, 0x514a, 0x514b, 0x514c, 0x3e69, 0x3c4c, 0x3427, 0x514f, 0x514d, 0x4c3d, 0x514e, 0x495a, 0x5150, 0x5151, 0x5152, 0x455f, 0x5156, 0x5154, 0x5155, 0x5153, 0x3a63, 0x5157, 0x4c6a, 0x4e64, 0x5158, 0x4028, 0x5159, 0x3d5a, 0x515a, 0x437c, 0x4e3f, 0x4560, 0x5245, 0x515b, 0x7425, 0x3645, 0x515c, 0x4b5e, 0x3d68, 0x427c, 0x515e, 0x4664, 0x515f, 0x5160, 0x332e, 0x5161, 0x3627, 0x464c, 0x317a, 0x3d50, 0x4821, 0x5162, 0x4561, 0x3f4f, 0x5163, 0x4a2c, 0x405a, 0x3422, 0x3429, 0x5164, 0x5166, 0x373a, 0x5165, 0x4e73, 0x3d69, 0x483d, 0x4a4c, 0x5167, 0x4d78, 0x5168, 0x5169, 0x457e, 0x516a, 0x4029, 0x3a7e, 0x3774, 0x516b, 0x3b49, 0x396f, 0x4466, 0x516d, 0x4227, 0x3a6f, 0x516e, 0x516f, 0x4130, 0x516c, 0x5171, 0x4b36, 0x3964, 0x5170, 0x3775, 0x3a5e, 0x476d, 0x5174, 0x5172, 0x497b, 0x3e6a, 0x517b, 0x3364, 0x5175, 0x5173, 0x414f, 0x5177, 0x5176, 0x3344, 0x3760, 0x517c, 0x4e2d, 0x5178, 0x517d, 0x517a, 0x5179, 0x4e4f, 0x3879, 0x3243, 0x4e74, 0x3d75, 0x4558, 0x3965, 0x5222, 0x5223, 0x4e65, 0x4f2b, 0x5225, 0x387a, 0x5224, 0x332f, 0x5226, 0x4b56, 0x443c, 0x4d26, 0x4a59, 0x5227, 0x7055, 0x4630, 0x5228, 0x342a, 0x4c33, 0x3e21, 0x5229, 0x4a67, 0x522d, 0x402a, 0x522a, 0x3650, 0x522b, 0x342b, 0x372e, 0x522e, 0x522f, 0x5230, 0x5231, 0x3c5b, 0x387b, 0x4c5e, 0x4c68, 0x4677, 0x4a71, 0x5232, 0x5233, 0x5235, 0x5237, 0x5236, 0x5238, 0x323d, 0x4b4c, 0x3a7c, 0x5239, 0x4159, 0x3e22, 0x3629, 0x523a, 0x485b, 0x523b, 0x523c, 0x523d, 0x523e, 0x4924, 0x3668, 0x3065, 0x463f, 0x523f, 0x3d3d, 0x4069, 0x5241, 0x5240, 0x3e23, 0x3861, 0x5243, 0x483e, 0x5244, 0x485c, 0x4234, 0x426e, 0x3628, 0x466e, 0x4331, 0x476e, 0x4b4e, 0x5246, 0x406a, 0x3735, 0x5247, 0x5248, 0x312c, 0x3075, 0x346d, 0x4228, 0x3551, 0x4d71, 0x524b, 0x3237, 0x524a, 0x362a, 0x524c, 0x4c71, 0x524d, 0x4e52, 0x387c, 0x3836, 0x524e, 0x5250, 0x524f, 0x3f5f, 0x3139, 0x315e, 0x5251, 0x5252, 0x3837, 0x5253, 0x356e, 0x3b32, 0x5254, 0x4b74, 0x3a35, 0x355a, 0x4d27, 0x4150, 0x483f, 0x3c7d, 0x3d47, 0x3c68, 0x3c75, 0x3d76, 0x4840, 0x5257, 0x3143, 0x4151, 0x387d, 0x3845, 0x3667, 0x525b, 0x4321, 0x427e, 0x362b, 0x3e24, 0x525c, 0x525a, 0x3244, 0x4266, 0x3c38, 0x3b4b, 0x3126, 0x3370, 0x3966, 0x3b4a, 0x525d, 0x525e, 0x3549, 0x3346, 0x3967, 0x3548, 0x445f, 0x3125, 0x4631, 0x4c3e, 0x3921, 0x4d79, 0x4547, 0x387e, 0x372f, 0x5267, 0x3663, 0x4b4a, 0x485d, 0x5266, 0x345e, 0x5261, 0x5262, 0x5264, 0x5265, 0x355b, 0x3f61, 0x4a2d, 0x5263, 0x525f, 0x3863, 0x5260, 0x4f24, 0x4a72, 0x4468, 0x3862, 0x3970, 0x5268, 0x465d, 0x526c, 0x3c7e, 0x3c76, 0x526f, 0x526d, 0x4c23, 0x526a, 0x5273, 0x526e, 0x5271, 0x3846, 0x4c3f, 0x5272, 0x5274, 0x5276, 0x3a70, 0x4f42, 0x526b, 0x5269, 0x5275, 0x5270, 0x5278, 0x5323, 0x527a, 0x527e, 0x5321, 0x527b, 0x533e, 0x3a69, 0x3331, 0x5279, 0x5325, 0x3076, 0x5324, 0x3025, 0x494a, 0x5322, 0x527c, 0x5277, 0x527d, 0x3a48, 0x5326, 0x3077, 0x532f, 0x5327, 0x5328, 0x3e25, 0x4b69, 0x532d, 0x532c, 0x452f, 0x532e, 0x532b, 0x3134, 0x3a36, 0x3f30, 0x5329, 0x4562, 0x532a, 0x3022, 0x5334, 0x4d23, 0x3e27, 0x533a, 0x5339, 0x5330, 0x4243, 0x5331, 0x426f, 0x5336, 0x3e26, 0x5333, 0x4c64, 0x373c, 0x5337, 0x5338, 0x5335, 0x533b, 0x5332, 0x5341, 0x5346, 0x5342, 0x533d, 0x5347, 0x4131, 0x5349, 0x3922, 0x533f, 0x437d, 0x5343, 0x533c, 0x342d, 0x346e, 0x3365, 0x5344, 0x5340, 0x3776, 0x534a, 0x5348, 0x4153, 0x354a, 0x362c, 0x5345, 0x3674, 0x3144, 0x534e, 0x534c, 0x5427, 0x5351, 0x534b, 0x534f, 0x534d, 0x3b4c, 0x5350, 0x5353, 0x5358, 0x5356, 0x5355, 0x4332, 0x3245, 0x5352, 0x5354, 0x3e28, 0x3133, 0x5357, 0x325e, 0x5362, 0x3e7c, 0x535e, 0x535c, 0x535d, 0x535f, 0x313d, 0x4139, 0x5359, 0x535a, 0x337a, 0x5361, 0x346f, 0x5364, 0x5360, 0x5363, 0x4a2e, 0x4655, 0x4838, 0x5366, 0x5365, 0x3345, 0x5367, 0x536a, 0x5369, 0x5368, 0x4739, 0x536b, 0x536c, 0x536e, 0x536d, 0x5370, 0x5373, 0x5371, 0x536f, 0x5372, 0x5374, 0x5375, 0x5376, 0x5377, 0x5378, 0x5145, 0x3c7c, 0x3b4d, 0x3273, 0x3078, 0x4344, 0x5379, 0x3a24, 0x304f, 0x3f5e, 0x537a, 0x3847, 0x3971, 0x537c, 0x537b, 0x4a60, 0x537d, 0x5421, 0x537e, 0x5422, 0x5423, 0x3777, 0x3160, 0x5424, 0x5426, 0x5425, 0x5428, 0x455a, 0x5429, 0x3035, 0x3a5f, 0x373d, 0x434f, 0x542a, 0x542b, 0x542d, 0x542e, 0x3a64, 0x3651, 0x4b37, 0x542c, 0x542f, 0x3a41, 0x3923, 0x5433, 0x3a25, 0x4333, 0x5430, 0x445a, 0x5434, 0x3f62, 0x5432, 0x5435, 0x373f, 0x5436, 0x5437, 0x3924, 0x3340, 0x5439, 0x543a, 0x543b, 0x5438, 0x5431, 0x543c, 0x543d, 0x4b64, 0x3e6b, 0x543f, 0x5440, 0x543e, 0x5442, 0x4738, 0x3068, 0x4956, 0x5443, 0x3e7d, 0x3c39, 0x475d, 0x3470, 0x3a6b, 0x4b59, 0x4632, 0x3778, 0x424f, 0x5441, 0x5444, 0x4244, 0x5445, 0x5446, 0x5448, 0x4469, 0x342e, 0x7421, 0x3161, 0x4a73, 0x3e6c, 0x4548, 0x3a66, 0x544e, 0x4a3d, 0x4e5d, 0x3274, 0x544a, 0x413a, 0x544d, 0x4563, 0x4549, 0x4564, 0x4839, 0x444d, 0x3a49, 0x5449, 0x3176, 0x4536, 0x544b, 0x5447, 0x3f50, 0x544f, 0x3d4e, 0x362d, 0x5450, 0x4a68, 0x417d, 0x4446, 0x5452, 0x4b4f, 0x5453, 0x5458, 0x4a2f, 0x5457, 0x5451, 0x5454, 0x5456, 0x3a26, 0x4a49, 0x5459, 0x4345, 0x3275, 0x3e6d, 0x545b, 0x545a, 0x3968, 0x545c, 0x545e, 0x545d, 0x5460, 0x5455, 0x5462, 0x5461, 0x545f, 0x3b4e, 0x3f51, 0x4154, 0x5463, 0x403c, 0x306d, 0x4764, 0x445b, 0x5465, 0x5464, 0x5466, 0x5467, 0x5468, 0x5469, 0x4a51, 0x546a, 0x3246, 0x546b, 0x4d3c, 0x3330, 0x5249, 0x3d48, 0x423f, 0x546c, 0x4c6b, 0x4c34, 0x546e, 0x4267, 0x4537, 0x4240, 0x4957, 0x546f, 0x5470, 0x317b, 0x3c3a, 0x5471, 0x3050, 0x5472, 0x5473, 0x3162, 0x3471, 0x4660, 0x4a74, 0x5477, 0x4155, 0x5476, 0x3740, 0x4b5b, 0x5475, 0x4565, 0x5479, 0x5478, 0x547b, 0x547a, 0x317c, 0x547c, 0x3e29, 0x547e, 0x4325, 0x547d, 0x4a33, 0x3d77, 0x455b, 0x5521, 0x3925, 0x5522, 0x4721, 0x485e, 0x4c51, 0x4725, 0x552b, 0x3538, 0x4d45, 0x4c2f, 0x562c, 0x5523, 0x5526, 0x4245, 0x4b38, 0x454a, 0x5527, 0x4b65, 0x3a4a, 0x3e2a, 0x5528, 0x3b50, 0x3b4f, 0x3039, 0x3848, 0x402b, 0x3051, 0x552c, 0x552d, 0x552a, 0x3138, 0x342f, 0x5529, 0x4c45, 0x4931, 0x3028, 0x3079, 0x3b51, 0x3052, 0x3023, 0x5532, 0x5530, 0x4c3c, 0x5533, 0x5531, 0x552f, 0x3f31, 0x552e, 0x4a5a, 0x3864, 0x5537, 0x5538, 0x3e2b, 0x5534, 0x4f2c, 0x474c, 0x5536, 0x3a27, 0x5539, 0x4958, 0x553a, 0x5535, 0x4c3b, 0x475e, 0x553b, 0x4932, 0x553c, 0x5540, 0x553d, 0x3247, 0x553f, 0x3c3b, 0x553e, 0x3779, 0x554c, 0x5545, 0x5542, 0x4364, 0x5541, 0x5543, 0x5544, 0x5546, 0x5547, 0x3472, 0x5549, 0x5548, 0x554a, 0x3e6e, 0x554d, 0x445c, 0x3145, 0x554b, 0x554e, 0x554f, 0x5552, 0x5550, 0x5551, 0x3b52, 0x5553, 0x3926, 0x5554, 0x3b7a, 0x4238, 0x5555, 0x5556, 0x3b5a, 0x3927, 0x4c52, 0x3528, 0x3849, 0x5557, 0x3358, 0x5558, 0x4239, 0x5559, 0x5623, 0x555a, 0x555b, 0x555c, 0x555e, 0x555f, 0x5560, 0x4270, 0x3127, 0x3c69, 0x3042, 0x4157, 0x3430, 0x3c35, 0x3928, 0x4566, 0x3d21, 0x3431, 0x4368, 0x446a, 0x3038, 0x3539, 0x4a75, 0x3c42, 0x3552, 0x406b, 0x3c3c, 0x4d28, 0x5561, 0x355c, 0x3a4b, 0x3332, 0x3163, 0x3e2c, 0x3248, 0x5562, 0x4d46, 0x3d49, 0x3c64, 0x5563, 0x3473, 0x4652, 0x4c29, 0x5564, 0x5565, 0x4959, 0x5567, 0x3428, 0x3677, 0x5566, 0x3432, 0x3f32, 0x556b, 0x3b21, 0x3249, 0x556a, 0x5568, 0x556c, 0x5569, 0x472b, 0x5c4d, 0x3f33, 0x556d, 0x4e40, 0x556e, 0x5570, 0x437e, 0x556f, 0x4023, 0x3b7b, 0x4250, 0x3c77, 0x4975, 0x406c, 0x3c4d, 0x5571, 0x3e2d, 0x5572, 0x5573, 0x3053, 0x423a, 0x3f52, 0x5574, 0x4633, 0x3e2e, 0x3e2f, 0x5575, 0x406d, 0x3e30, 0x5576, 0x5577, 0x4c60, 0x5578, 0x3646, 0x3d22, 0x5579, 0x557a, 0x3c5c, 0x3f2c, 0x4674, 0x3f54, 0x4878, 0x4722, 0x3649, 0x557b, 0x356f, 0x557c, 0x367e, 0x464f, 0x3230, 0x3b53, 0x557d, 0x5622, 0x5621, 0x367d, 0x557e, 0x4538, 0x4230, 0x454b, 0x3c48, 0x4158, 0x4d7a, 0x5624, 0x5625, 0x4656, 0x3b33, 0x5627, 0x5628, 0x5629, 0x3474, 0x562a, 0x562b, 0x322c, 0x413b, 0x3464, 0x562d, 0x4c28, 0x4252, 0x3359, 0x562f, 0x5631, 0x345f, 0x562e, 0x5630, 0x5633, 0x5632, 0x5634, 0x5635, 0x463d, 0x362e, 0x3265, 0x5636, 0x563b, 0x5639, 0x4a77, 0x4a76, 0x4567, 0x5638, 0x3d54, 0x5637, 0x3f72, 0x563c, 0x3a6a, 0x5642, 0x5643, 0x563d, 0x3333, 0x563e, 0x5647, 0x5646, 0x5645, 0x5641, 0x5640, 0x5644, 0x4a78, 0x564b, 0x5648, 0x564a, 0x4d72, 0x5649, 0x563f, 0x3f73, 0x564c, 0x3a37, 0x564d, 0x564e, 0x5651, 0x5650, 0x564f, 0x4568, 0x563a, 0x5657, 0x5653, 0x5652, 0x5654, 0x5655, 0x5658, 0x4e66, 0x5659, 0x5656, 0x565a, 0x3460, 0x565b, 0x565d, 0x565c, 0x565e, 0x565f, 0x406e, 0x3d23, 0x3d64, 0x4163, 0x3929, 0x3a38, 0x392a, 0x3570, 0x5660, 0x3a39, 0x384a, 0x5661, 0x4c26, 0x4743, 0x5662, 0x392b, 0x342c, 0x4327, 0x3652, 0x3b54, 0x495b, 0x4841, 0x5663, 0x3475, 0x5666, 0x4421, 0x5665, 0x5664, 0x5667, 0x446b, 0x3f63, 0x3b55, 0x404a, 0x4253, 0x3522, 0x4422, 0x5668, 0x5669, 0x3e6f, 0x4b39, 0x566c, 0x566b, 0x566a, 0x497d, 0x5673, 0x4b5a, 0x566d, 0x566f, 0x4b6b, 0x566e, 0x5670, 0x4828, 0x5671, 0x4a3e, 0x5672, 0x3433, 0x4a3f, 0x472f, 0x5674, 0x5675, 0x392c, 0x3434, 0x5676, 0x3838, 0x4d44, 0x4d29, 0x3476, 0x5678, 0x4423, 0x392d, 0x3e31, 0x485f, 0x3e32, 0x3d78, 0x446c, 0x4a79, 0x4539, 0x392e, 0x495c, 0x5679, 0x4559, 0x3a42, 0x384b, 0x446d, 0x3043, 0x3d6e, 0x392f, 0x4d47, 0x567a, 0x567b, 0x4751, 0x567c, 0x4e77, 0x4f2d, 0x567e, 0x567d, 0x3347, 0x5721, 0x5724, 0x5725, 0x5723, 0x4940, 0x3e33, 0x5727, 0x5726, 0x5722, 0x5728, 0x5729, 0x572a, 0x572d, 0x572b, 0x572c, 0x572e, 0x3164, 0x446e, 0x572f, 0x377a, 0x3276, 0x4736, 0x5730, 0x467b, 0x4a5b, 0x5731, 0x4f2e, 0x5732, 0x4a40, 0x5735, 0x5021, 0x5031, 0x3c30, 0x4675, 0x5736, 0x355d, 0x4424, 0x307a, 0x5737, 0x4a26, 0x3930, 0x4350, 0x446f, 0x4c6f, 0x3839, 0x384c, 0x5738, 0x5739, 0x573f, 0x3c65, 0x4425, 0x362f, 0x573a, 0x492b, 0x4346, 0x573b, 0x573c, 0x3630, 0x573d, 0x573e, 0x5740, 0x4576, 0x5741, 0x5742, 0x5743, 0x5734, 0x5733, 0x5744, 0x3741, 0x4927, 0x3a4c, 0x4937, 0x4426, 0x494b, 0x5745, 0x3e34, 0x3146, 0x5746, 0x5747, 0x4c72, 0x4860, 0x574a, 0x317d, 0x402c, 0x5749, 0x5748, 0x3742, 0x4254, 0x574e, 0x574c, 0x574b, 0x4e27, 0x3865, 0x3d79, 0x574d, 0x454c, 0x3d3e, 0x4640, 0x5751, 0x5750, 0x574f, 0x5752, 0x3866, 0x5753, 0x497c, 0x3d5b, 0x5754, 0x4879, 0x4641, 0x4427, 0x4530, 0x5755, 0x352b, 0x3f34, 0x492c, 0x3477, 0x4726, 0x5756, 0x3b56, 0x4b3a, 0x4b3b, 0x317e, 0x575b, 0x4369, 0x5758, 0x3277, 0x582d, 0x575a, 0x4730, 0x5759, 0x5757, 0x397a, 0x575d, 0x5763, 0x5769, 0x5761, 0x455c, 0x5766, 0x495d, 0x5760, 0x5765, 0x4e67, 0x3b57, 0x4255, 0x575e, 0x355e, 0x5768, 0x402d, 0x3165, 0x5762, 0x3278, 0x5767, 0x3631, 0x5764, 0x576a, 0x576c, 0x5776, 0x5774, 0x5771, 0x5770, 0x4e78, 0x5772, 0x3632, 0x3931, 0x3d7a, 0x5779, 0x576b, 0x576f, 0x575f, 0x327a, 0x5773, 0x5775, 0x4351, 0x3a28, 0x3238, 0x576d, 0x5778, 0x5777, 0x3633, 0x4229, 0x3366, 0x3743, 0x576e, 0x577a, 0x577d, 0x5821, 0x3c3d, 0x5827, 0x4470, 0x577b, 0x5825, 0x3279, 0x5823, 0x5824, 0x577e, 0x5822, 0x3867, 0x4d2a, 0x3435, 0x3159, 0x5826, 0x473a, 0x302d, 0x4861, 0x575c, 0x582c, 0x5830, 0x4c65, 0x5829, 0x4569, 0x582e, 0x3e70, 0x582f, 0x4657, 0x4f47, 0x582b, 0x5831, 0x397b, 0x404b, 0x3054, 0x582a, 0x5828, 0x415a, 0x577c, 0x3b34, 0x4246, 0x583d, 0x415b, 0x5838, 0x5835, 0x5836, 0x3c66, 0x5839, 0x583c, 0x5837, 0x3d25, 0x583a, 0x5834, 0x4c7c, 0x4c7b, 0x583e, 0x583f, 0x3055, 0x5833, 0x3672, 0x3026, 0x3436, 0x583b, 0x5843, 0x5842, 0x5847, 0x5848, 0x5846, 0x5849, 0x5841, 0x5845, 0x584a, 0x584b, 0x5840, 0x3b7c, 0x5844, 0x4256, 0x3932, 0x5832, 0x3f35, 0x5858, 0x4a69, 0x584e, 0x584f, 0x5850, 0x5857, 0x5856, 0x4b7d, 0x3437, 0x5854, 0x3745, 0x3334, 0x5851, 0x4e38, 0x5853, 0x3056, 0x5855, 0x584c, 0x5852, 0x5859, 0x3744, 0x584d, 0x4d5d, 0x4d2b, 0x585c, 0x5860, 0x417e, 0x4e79, 0x5861, 0x585e, 0x585b, 0x585a, 0x585f, 0x4a30, 0x4634, 0x3746, 0x5862, 0x585d, 0x5863, 0x377b, 0x3231, 0x586b, 0x3438, 0x5869, 0x586a, 0x3a29, 0x5868, 0x5866, 0x5865, 0x586c, 0x5864, 0x586e, 0x327b, 0x5870, 0x586f, 0x4428, 0x5873, 0x5871, 0x5867, 0x377c, 0x5872, 0x5876, 0x5875, 0x5877, 0x5874, 0x5878, 0x5879, 0x587a, 0x4a6a, 0x587c, 0x587b, 0x3d3f, 0x402e, 0x3266, 0x327c, 0x587d, 0x303f, 0x404c, 0x587e, 0x6c43, 0x5921, 0x3761, 0x5922, 0x406f, 0x5923, 0x5924, 0x353a, 0x5925, 0x5926, 0x5927, 0x4257, 0x384d, 0x4c61, 0x4b3c, 0x3d6a, 0x5928, 0x4070, 0x6e3d, 0x4862, 0x3c6a, 0x3a4d, 0x5929, 0x4247, 0x4a27, 0x4271, 0x592c, 0x592a, 0x592d, 0x592b, 0x592e, 0x4a31, 0x3037, 0x495e, 0x4863, 0x592f, 0x5932, 0x3e35, 0x353b, 0x5930, 0x5937, 0x3e36, 0x5931, 0x4744, 0x4d5e, 0x5933, 0x5934, 0x5938, 0x456a, 0x5935, 0x3933, 0x405e, 0x5946, 0x4834, 0x4272, 0x4864, 0x5a2d, 0x4a7a, 0x4471, 0x4b75, 0x593b, 0x3221, 0x436a, 0x5944, 0x4334, 0x593e, 0x5945, 0x5940, 0x5947, 0x5943, 0x5942, 0x476f, 0x593c, 0x327d, 0x593a, 0x3571, 0x4273, 0x5936, 0x5939, 0x3934, 0x405b, 0x3e37, 0x5941, 0x4752, 0x3572, 0x3348, 0x3367, 0x3f21, 0x5949, 0x594e, 0x594a, 0x377d, 0x594f, 0x3b22, 0x3969, 0x3d26, 0x593d, 0x3b7d, 0x594c, 0x3b58, 0x594d, 0x3044, 0x5948, 0x4429, 0x3573, 0x3634, 0x594b, 0x3027, 0x3a43, 0x3f36, 0x4472, 0x4854, 0x5951, 0x415e, 0x422a, 0x3b2b, 0x5952, 0x5954, 0x5950, 0x4a61, 0x443d, 0x415c, 0x4a7b, 0x3c4e, 0x5960, 0x595f, 0x3f78, 0x377e, 0x5959, 0x3e39, 0x4668, 0x4731, 0x5957, 0x415d, 0x3c78, 0x595c, 0x3e38, 0x5956, 0x595b, 0x4753, 0x5955, 0x3721, 0x335d, 0x595d, 0x4e2b, 0x3a4e, 0x4335, 0x595a, 0x405c, 0x3935, 0x3f64, 0x3166, 0x413c, 0x5958, 0x3545, 0x3747, 0x444f, 0x595e, 0x415f, 0x5961, 0x5963, 0x4237, 0x5969, 0x5964, 0x5966, 0x4941, 0x4473, 0x5967, 0x4d2c, 0x4d48, 0x3439, 0x302e, 0x5965, 0x5962, 0x3478, 0x3167, 0x5968, 0x4d49, 0x596c, 0x423b, 0x5973, 0x596d, 0x596a, 0x5971, 0x5953, 0x596e, 0x5972, 0x4842, 0x456b, 0x596b, 0x596f, 0x3748, 0x3a71, 0x405d, 0x5977, 0x4526, 0x5974, 0x4b60, 0x5975, 0x5976, 0x4c4e, 0x4022, 0x3762, 0x597d, 0x3b35, 0x597a, 0x5979, 0x4732, 0x4635, 0x4531, 0x597b, 0x597c, 0x496f, 0x4745, 0x3b23, 0x4071, 0x4b50, 0x3349, 0x5a25, 0x597e, 0x4d4a, 0x5a27, 0x5a23, 0x5a24, 0x4160, 0x5a22, 0x593f, 0x5a26, 0x5a21, 0x5a2b, 0x5a2c, 0x4527, 0x5a2e, 0x3b24, 0x5a29, 0x353c, 0x5a2f, 0x5a28, 0x5a33, 0x5a32, 0x5a31, 0x5a34, 0x5a36, 0x3e71, 0x5a35, 0x5a39, 0x5a37, 0x5a38, 0x5970, 0x5a3b, 0x5a3a, 0x5978, 0x5a3c, 0x5a30, 0x3b59, 0x5a3d, 0x5a3e, 0x5a40, 0x5a3f, 0x5a41, 0x327e, 0x3936, 0x4a7c, 0x402f, 0x384e, 0x5a43, 0x5a46, 0x4952, 0x355f, 0x5a45, 0x5a44, 0x4754, 0x5a47, 0x3635, 0x5a49, 0x5a48, 0x343a, 0x3b36, 0x4658, 0x3749, 0x3f74, 0x5a4a, 0x4030, 0x4528, 0x495f, 0x5a4b, 0x5a4c, 0x5a4d, 0x4a38, 0x555d, 0x4046, 0x494c, 0x3a58, 0x4865, 0x4843, 0x454d, 0x4e41, 0x5a4f, 0x3c50, 0x5a50, 0x3036, 0x3654, 0x404d, 0x4960, 0x5a51, 0x3b42, 0x4347, 0x3b5b, 0x3f37, 0x5a52, 0x4a7d, 0x3177, 0x3b5c, 0x5a55, 0x5a53, 0x5a56, 0x4e39, 0x5a54, 0x407b, 0x5a57, 0x4232, 0x5a58, 0x347a, 0x5a5a, 0x5a59, 0x5a5b, 0x5a5c, 0x347b, 0x467c, 0x4336, 0x356c, 0x3b5d, 0x4161, 0x3d5c, 0x3030, 0x5a5d, 0x3222, 0x5a61, 0x3937, 0x5a60, 0x3a2b, 0x3e3a, 0x5a5f, 0x3e3b, 0x4c40, 0x3a2a, 0x3057, 0x404e, 0x5a66, 0x4031, 0x3147, 0x3d55, 0x4b66, 0x3a72, 0x3e3c, 0x4027, 0x5a65, 0x5a63, 0x5a64, 0x436b, 0x5b26, 0x5a6a, 0x3b7e, 0x3938, 0x5a68, 0x5a69, 0x3f38, 0x5a67, 0x3b2f, 0x5a6c, 0x5a6b, 0x5a70, 0x5a71, 0x5a6d, 0x3322, 0x5a6e, 0x5a6f, 0x4855, 0x4961, 0x374a, 0x5a72, 0x4032, 0x3e3d, 0x4352, 0x3647, 0x5a73, 0x5a77, 0x324b, 0x5a74, 0x5a76, 0x5a75, 0x3d6b, 0x4348, 0x3045, 0x5a78, 0x5a79, 0x442a, 0x4e71, 0x3b43, 0x4a6b, 0x4b3d, 0x5b22, 0x5a7b, 0x5a7e, 0x5a7d, 0x5a7a, 0x5b21, 0x465e, 0x5a7c, 0x5b23, 0x3d6c, 0x5b24, 0x4d4b, 0x4778, 0x5b25, 0x5b27, 0x5b28, 0x5b29, 0x364a, 0x3148, 0x3939, 0x5b2a, 0x5b2b, 0x3d71, 0x4162, 0x5258, 0x413e, 0x413d, 0x4258, 0x3a47, 0x5072, 0x376e, 0x4d2d, 0x4a7e, 0x497e, 0x5b2c, 0x3a73, 0x443f, 0x5b2d, 0x4f2f, 0x4b3e, 0x442b, 0x5b2e, 0x347c, 0x5b2f, 0x5b30, 0x4c5a, 0x4c24, 0x4b76, 0x4b5c, 0x3b25, 0x5b32, 0x3c6b, 0x4b51, 0x5b34, 0x5b37, 0x5b36, 0x3479, 0x3560, 0x5b33, 0x5b35, 0x5b38, 0x3f79, 0x4d7b, 0x3049, 0x3a60, 0x423c, 0x3c5d, 0x3e73, 0x5b3b, 0x454e, 0x5b39, 0x422b, 0x5b3a, 0x3e72, 0x4c5d, 0x5b3c, 0x5b3d, 0x4d68, 0x5b42, 0x393a, 0x4755, 0x5b3f, 0x456c, 0x5a5e, 0x5a62, 0x354f, 0x4747, 0x5b41, 0x3e3e, 0x4844, 0x5b47, 0x487a, 0x5b3e, 0x5b44, 0x5b43, 0x404f, 0x4b6d, 0x4e53, 0x4b67, 0x324c, 0x3b5e, 0x4f48, 0x5b46, 0x3f75, 0x5b45, 0x5b40, 0x384f, 0x5b4c, 0x5b4a, 0x324d, 0x5b48, 0x5b4e, 0x5b54, 0x4248, 0x4a41, 0x5b56, 0x4922, 0x5b55, 0x4770, 0x4b3f, 0x343b, 0x4077, 0x3d40, 0x4453, 0x4d2e, 0x5b51, 0x5b50, 0x5b52, 0x5b4f, 0x5b57, 0x5b4d, 0x5b4b, 0x5b53, 0x5b49, 0x436c, 0x4c78, 0x3c46, 0x3a74, 0x3a3a, 0x4b6f, 0x3341, 0x444e, 0x464a, 0x3149, 0x4072, 0x4034, 0x372a, 0x5b59, 0x393b, 0x337c, 0x5b5b, 0x3374, 0x5b61, 0x5b5e, 0x4073, 0x334b, 0x3a2c, 0x334a, 0x3a4f, 0x5b5c, 0x3765, 0x374b, 0x456d, 0x5b5a, 0x3046, 0x5b5d, 0x5b5f, 0x364d, 0x372c, 0x343c, 0x354b, 0x5b62, 0x3a79, 0x4b71, 0x3b37, 0x5b63, 0x4930, 0x5b6f, 0x3233, 0x5b64, 0x5b75, 0x5b65, 0x4e42, 0x5b6c, 0x475f, 0x5b74, 0x5b67, 0x3034, 0x5b69, 0x393c, 0x5b6b, 0x5b6a, 0x5b66, 0x5b71, 0x3e3f, 0x546d, 0x3868, 0x4d7c, 0x5b68, 0x4474, 0x3323, 0x3a2d, 0x5b60, 0x5b70, 0x3361, 0x5b6e, 0x5b72, 0x456e, 0x347e, 0x5c32, 0x4c49, 0x5b77, 0x347d, 0x5b7e, 0x4b40, 0x5c21, 0x5c23, 0x5c27, 0x5b79, 0x432a, 0x456f, 0x5c2b, 0x5b7c, 0x5c28, 0x5c22, 0x3f39, 0x5c2c, 0x4033, 0x5c2a, 0x343d, 0x4f50, 0x5b76, 0x5c26, 0x3058, 0x5b78, 0x4c3a, 0x5b7d, 0x3f22, 0x4447, 0x5b73, 0x5c25, 0x3f7a, 0x5c2f, 0x3371, 0x3821, 0x5c31, 0x5b7a, 0x5c30, 0x5c29, 0x5b7b, 0x5c2d, 0x5c2e, 0x5c3f, 0x464e, 0x5c24, 0x5c3b, 0x5c3d, 0x4458, 0x4d4c, 0x4976, 0x5c38, 0x424a, 0x5c3e, 0x413f, 0x5c35, 0x5c42, 0x5c41, 0x466f, 0x5c40, 0x466a, 0x5c44, 0x5c37, 0x3648, 0x5c3a, 0x3d5d, 0x4760, 0x5c3c, 0x364b, 0x5c34, 0x5c36, 0x5c33, 0x4f30, 0x335a, 0x5c39, 0x5c43, 0x3335, 0x3a67, 0x315d, 0x5c54, 0x4f31, 0x5c57, 0x3f3a, 0x5c56, 0x5c55, 0x5c52, 0x5c46, 0x5c63, 0x5c45, 0x5c58, 0x5c50, 0x5c4b, 0x5c48, 0x5c49, 0x5c51, 0x7422, 0x5c4e, 0x393d, 0x4448, 0x4164, 0x5c4c, 0x5c47, 0x5c4a, 0x4d4d, 0x4b6a, 0x5c4f, 0x5c59, 0x5c61, 0x5c5a, 0x5c67, 0x5c65, 0x5c60, 0x5c5f, 0x4450, 0x4165, 0x5c5d, 0x5c5b, 0x5c62, 0x5c68, 0x4875, 0x5c6e, 0x5c69, 0x5c6c, 0x5c66, 0x4374, 0x4938, 0x5c5c, 0x5c64, 0x3e40, 0x4c4f, 0x5c78, 0x5c6b, 0x3822, 0x3223, 0x335f, 0x5c53, 0x3e41, 0x5c70, 0x5c77, 0x3c79, 0x3372, 0x432e, 0x5c6d, 0x5c72, 0x5c76, 0x3636, 0x354c, 0x5c74, 0x3521, 0x464b, 0x5c73, 0x5c75, 0x5c6f, 0x5c71, 0x3360, 0x4349, 0x5c7c, 0x5c7a, 0x3869, 0x5c79, 0x5d21, 0x5b58, 0x5c7b, 0x5c7d, 0x5c7e, 0x5d2c, 0x5d28, 0x5b6d, 0x5d27, 0x5d26, 0x5d23, 0x5c6a, 0x5d25, 0x5d24, 0x5d2a, 0x4f26, 0x5d2d, 0x367b, 0x5d29, 0x5d2b, 0x4827, 0x5d2e, 0x5d32, 0x5d2f, 0x4d73, 0x5d30, 0x5c5e, 0x5d33, 0x5d34, 0x3135, 0x5d36, 0x3767, 0x3c21, 0x3655, 0x3224, 0x4d5f, 0x5d38, 0x5d37, 0x5d3a, 0x353d, 0x3656, 0x343e, 0x5d3d, 0x5d3c, 0x5d3e, 0x324e, 0x4337, 0x5d3f, 0x343f, 0x5d41, 0x5d40, 0x5d42, 0x5d43, 0x5d44, 0x3b5f, 0x4035, 0x3a21, 0x4970, 0x4a62, 0x4f44, 0x3b75, 0x3a50, 0x4e72, 0x5d45, 0x5d46, 0x3b60, 0x5d47, 0x5d48, 0x5d4a, 0x5d49, 0x4b58, 0x3d5e, 0x3c6c, 0x3b44, 0x5d4b, 0x5d4d, 0x3f23, 0x5d4c, 0x5d4e, 0x5d4f, 0x5d50, 0x5d51, 0x5d52, 0x5d54, 0x5d53, 0x5d55, 0x3225, 0x434a, 0x5d56, 0x3b26, 0x334c, 0x5d57, 0x4542, 0x544c, 0x3523, 0x5d58, 0x5d59, 0x4a6c, 0x4b68, 0x4647, 0x5d5a, 0x4866, 0x487b, 0x4c53, 0x5d5b, 0x5d5d, 0x5d5c, 0x5d5f, 0x5d5e, 0x5d61, 0x3b61, 0x4c31, 0x5d62, 0x5d63, 0x3524, 0x5d64, 0x5d66, 0x5d65, 0x3f65, 0x4939, 0x314a, 0x4845, 0x4475, 0x3d41, 0x3561, 0x4846, 0x3c2e, 0x5d68, 0x3440, 0x3178, 0x4672, 0x5d67, 0x393e, 0x4353, 0x5d69, 0x5d71, 0x5d6a, 0x4241, 0x3562, 0x5d72, 0x3768, 0x3525, 0x5d70, 0x5d6e, 0x5d6b, 0x4d60, 0x4440, 0x4659, 0x5d6c, 0x5d74, 0x5d73, 0x3723, 0x322d, 0x3a3b, 0x5d6d, 0x5d6f, 0x4b57, 0x4274, 0x4b77, 0x5d7c, 0x5d7d, 0x324f, 0x4a28, 0x4c7d, 0x5e21, 0x3c23, 0x3e42, 0x5d78, 0x5d7e, 0x3168, 0x3637, 0x5d75, 0x5d7a, 0x4074, 0x4771, 0x4867, 0x5d77, 0x4b21, 0x5d79, 0x5e24, 0x5e22, 0x5d7b, 0x4b22, 0x4748, 0x3563, 0x4525, 0x436d, 0x5e25, 0x5e23, 0x4259, 0x5d76, 0x314b, 0x4d4e, 0x5e30, 0x5e2f, 0x4076, 0x5e2c, 0x4d6c, 0x4636, 0x5e26, 0x4445, 0x314c, 0x393f, 0x5e29, 0x3d27, 0x5e2e, 0x5e2d, 0x5e28, 0x5e2b, 0x3368, 0x5e2a, 0x4749, 0x4e2e, 0x3e74, 0x4075, 0x5e36, 0x5e34, 0x494d, 0x5e31, 0x5e33, 0x313a, 0x3940, 0x4f32, 0x333d, 0x4962, 0x4d61, 0x3324, 0x3f3b, 0x5e35, 0x5e3a, 0x3e43, 0x4d30, 0x5e37, 0x5e32, 0x5e38, 0x4e5e, 0x4573, 0x4642, 0x3336, 0x3155, 0x5e3e, 0x5e41, 0x4e43, 0x4d64, 0x5e48, 0x5e42, 0x5e3f, 0x4e54, 0x5e45, 0x3d4a, 0x5e47, 0x5e4c, 0x4571, 0x5e4a, 0x5e44, 0x4338, 0x5e4b, 0x5e40, 0x5e46, 0x5e4d, 0x307c, 0x5e43, 0x5e4e, 0x3f3c, 0x3d5f, 0x4a25, 0x3a2e, 0x5e3b, 0x5e49, 0x453a, 0x4036, 0x3369, 0x3a51, 0x3e44, 0x5e3d, 0x3d42, 0x374c, 0x5e3c, 0x5e52, 0x3d6d, 0x383a, 0x5e61, 0x5e5b, 0x3574, 0x454f, 0x5e56, 0x5e5f, 0x302f, 0x3132, 0x3239, 0x5e58, 0x422c, 0x5e4f, 0x5e51, 0x3941, 0x5e62, 0x5e5d, 0x5e55, 0x5e5c, 0x4c2b, 0x5e5a, 0x5e5e, 0x3850, 0x3e45, 0x4339, 0x5e54, 0x4d2f, 0x5e57, 0x5e50, 0x4572, 0x5e53, 0x5e59, 0x4f51, 0x3c3e, 0x4b7e, 0x5e63, 0x482e, 0x5e6f, 0x383b, 0x3d60, 0x5e65, 0x4e2f, 0x3942, 0x5e72, 0x306e, 0x5e70, 0x5e64, 0x5e6a, 0x5e6c, 0x4d4f, 0x5e67, 0x452e, 0x5e69, 0x5e71, 0x5e6b, 0x4c47, 0x5e66, 0x3c22, 0x5e7e, 0x336a, 0x5e68, 0x5e6d, 0x5e6e, 0x426c, 0x425a, 0x5e76, 0x5e7c, 0x5e7a, 0x4529, 0x5f23, 0x5e77, 0x5e78, 0x5e60, 0x3579, 0x493a, 0x3c3f, 0x3977, 0x4f33, 0x5e74, 0x5f22, 0x3169, 0x4166, 0x4779, 0x3441, 0x4e7a, 0x4c21, 0x4452, 0x5e7b, 0x5e7d, 0x4132, 0x5f21, 0x5e79, 0x5e73, 0x3443, 0x3769, 0x5f2f, 0x5f2a, 0x4078, 0x3363, 0x3d61, 0x5f33, 0x5f2c, 0x442c, 0x5f29, 0x4459, 0x5f4c, 0x5f26, 0x5f25, 0x5f2e, 0x5f28, 0x5f27, 0x5f2d, 0x4021, 0x5f24, 0x5f30, 0x5f31, 0x3442, 0x5f36, 0x5f35, 0x5f37, 0x5f3a, 0x4543, 0x5f34, 0x5f38, 0x3763, 0x4279, 0x5f32, 0x473b, 0x5f39, 0x5f3e, 0x5f3c, 0x5f3f, 0x5f42, 0x5f3b, 0x396a, 0x4728, 0x5e39, 0x4d74, 0x5f3d, 0x5f41, 0x4275, 0x5f40, 0x5f2b, 0x6f69, 0x5f45, 0x5f49, 0x5f47, 0x5f43, 0x5f44, 0x5f48, 0x5f46, 0x494e, 0x5f4e, 0x5f4b, 0x5f4a, 0x5f4d, 0x4654, 0x5f4f, 0x4375, 0x426d, 0x4025, 0x5f50, 0x5f52, 0x5f51, 0x5e75, 0x5f53, 0x4667, 0x5f54, 0x3250, 0x4574, 0x3325, 0x3564, 0x3c5e, 0x3a52, 0x4f27, 0x3f66, 0x316a, 0x5f56, 0x5f55, 0x5f59, 0x433a, 0x5f5c, 0x5f57, 0x5f5b, 0x5f5a, 0x4540, 0x3059, 0x4e75, 0x5f5e, 0x3128, 0x5f60, 0x5f5f, 0x5f5d, 0x5f58, 0x4b23, 0x5f62, 0x5f61, 0x316b, 0x5f64, 0x4a32, 0x5f63, 0x4c35, 0x3e47, 0x4133, 0x3e46, 0x4e7b, 0x5f6a, 0x4079, 0x5f66, 0x5f6b, 0x316c, 0x5f69, 0x4761, 0x5f65, 0x5f68, 0x3e48, 0x4851, 0x5f6c, 0x3c51, 0x407a, 0x5f6f, 0x5f67, 0x3727, 0x5f6d, 0x4d50, 0x5f70, 0x7426, 0x3d4f, 0x5f71, 0x5f72, 0x472e, 0x5f74, 0x5f75, 0x4733, 0x4575, 0x5f77, 0x5f79, 0x4e55, 0x5f76, 0x5f78, 0x316d, 0x5f73, 0x535b, 0x5f7a, 0x4167, 0x3b38, 0x5f7c, 0x5f7b, 0x3f24, 0x5259, 0x5f7d, 0x6021, 0x5f6e, 0x5f7e, 0x6022, 0x477a, 0x6023, 0x6024, 0x6025, 0x6026, 0x445e, 0x6028, 0x6027, 0x6029, 0x602a, 0x3c5f, 0x4963, 0x4c6c, 0x602b, 0x602c, 0x4156, 0x3c24, 0x602d, 0x602e, 0x602f, 0x4a52, 0x4847, 0x6030, 0x4757, 0x442d, 0x6031, 0x3267, 0x356d, 0x4c46, 0x4c36, 0x3234, 0x4f34, 0x4b52, 0x4a2a, 0x4037, 0x6032, 0x4643, 0x3823, 0x6033, 0x3a54, 0x6035, 0x6034, 0x6036, 0x6037, 0x6038, 0x353e, 0x6039, 0x603a, 0x3824, 0x4848, 0x603c, 0x3e75, 0x603b, 0x3638, 0x603d, 0x603f, 0x603e, 0x6040, 0x3851, 0x6041, 0x3669, 0x4140, 0x397d, 0x6043, 0x6044, 0x6042, 0x3c6d, 0x4648, 0x3639, 0x6046, 0x432c, 0x6045, 0x4f35, 0x4762, 0x6049, 0x604b, 0x6048, 0x4c54, 0x604a, 0x604c, 0x4e44, 0x6050, 0x604f, 0x4376, 0x472d, 0x3825, 0x604e, 0x604d, 0x4d31, 0x4d32, 0x6051, 0x316e, 0x3976, 0x3b62, 0x6052, 0x6053, 0x6055, 0x3d43, 0x6057, 0x6056, 0x6058, 0x334d, 0x605a, 0x6059, 0x605c, 0x605b, 0x383c, 0x4e28, 0x364c, 0x3226, 0x366a, 0x3461, 0x4e68, 0x605e, 0x6060, 0x6061, 0x3251, 0x605d, 0x3b39, 0x4441, 0x605f, 0x6064, 0x3c6e, 0x6062, 0x373e, 0x4849, 0x6063, 0x607e, 0x6069, 0x383d, 0x3565, 0x6066, 0x4d7d, 0x4e30, 0x4276, 0x6068, 0x606a, 0x4e56, 0x3657, 0x487c, 0x474a, 0x606b, 0x606d, 0x6070, 0x606c, 0x606f, 0x386a, 0x314d, 0x6071, 0x3f70, 0x606e, 0x4e5c, 0x6074, 0x7424, 0x6072, 0x6075, 0x6067, 0x6073, 0x3a3c, 0x6076, 0x6077, 0x4d7e, 0x6078, 0x6079, 0x6065, 0x607a, 0x3444, 0x3c25, 0x607b, 0x607c, 0x607d, 0x313b, 0x6121, 0x493b, 0x6122, 0x3424, 0x6123, 0x6124, 0x6125, 0x6127, 0x6128, 0x6126, 0x4953, 0x612a, 0x6129, 0x612c, 0x612b, 0x612d, 0x612e, 0x6130, 0x612f, 0x3979, 0x6132, 0x6131, 0x3445, 0x3f53, 0x453c, 0x6133, 0x4038, 0x3b3a, 0x3179, 0x6134, 0x4d51, 0x4a63, 0x6135, 0x4544, 0x4d33, 0x3943, 0x3f3d, 0x434b, 0x5234, 0x442e, 0x3268, 0x6136, 0x6137, 0x613c, 0x613a, 0x6139, 0x5a42, 0x3326, 0x6138, 0x305a, 0x482a, 0x484a, 0x4e31, 0x613d, 0x613b, 0x435c, 0x4026, 0x482b, 0x492d, 0x613f, 0x4e2c, 0x374d, 0x6140, 0x613e, 0x4856, 0x6141, 0x6142, 0x305b, 0x3e76, 0x6147, 0x6144, 0x466d, 0x6143, 0x3526, 0x614a, 0x6145, 0x6146, 0x6149, 0x6148, 0x4925, 0x4142, 0x4141, 0x353f, 0x614b, 0x614c, 0x614d, 0x614f, 0x614e, 0x3156, 0x6157, 0x4868, 0x6151, 0x6153, 0x6155, 0x3f3e, 0x6156, 0x6154, 0x3c40, 0x6150, 0x6152, 0x4942, 0x3e49, 0x6159, 0x6158, 0x615a, 0x3c26, 0x3a2f, 0x4577, 0x615b, 0x444b, 0x615d, 0x4e21, 0x615c, 0x4169, 0x6162, 0x6164, 0x6165, 0x4354, 0x6163, 0x6160, 0x615e, 0x615f, 0x6161, 0x6168, 0x6166, 0x6167, 0x6169, 0x616b, 0x616c, 0x616d, 0x616e, 0x616a, 0x6170, 0x616f, 0x6171, 0x4e45, 0x6174, 0x6172, 0x6173, 0x3462, 0x4c7e, 0x4a4a, 0x6176, 0x6175, 0x6177, 0x6178, 0x617c, 0x6179, 0x617a, 0x617b, 0x617d, 0x617e, 0x6221, 0x6222, 0x6223, 0x482f, 0x4550, 0x6224, 0x4772, 0x4934, 0x6225, 0x6226, 0x452a, 0x3327, 0x3944, 0x6227, 0x6228, 0x6229, 0x3b29, 0x622b, 0x622a, 0x622c, 0x622d, 0x4869, 0x622e, 0x622f, 0x7369, 0x6230, 0x6231, 0x6232, 0x3b2e, 0x6233, 0x4756, 0x4b5f, 0x314e, 0x3157, 0x6234, 0x6236, 0x6235, 0x4570, 0x4039, 0x5d39, 0x6237, 0x4c41, 0x6238, 0x3446, 0x4857, 0x6239, 0x623a, 0x623b, 0x4c5c, 0x4c55, 0x443e, 0x416a, 0x623d, 0x3d62, 0x3e4a, 0x6240, 0x623f, 0x623e, 0x487d, 0x3447, 0x3829, 0x6246, 0x6243, 0x3f3f, 0x4c32, 0x6242, 0x6244, 0x6245, 0x6241, 0x6247, 0x6248, 0x442f, 0x3463, 0x4365, 0x6249, 0x624a, 0x624d, 0x3f67, 0x4644, 0x624e, 0x4b53, 0x624b, 0x624c, 0x6251, 0x6250, 0x624f, 0x6253, 0x6252, 0x6254, 0x6256, 0x6255, 0x4a4d, 0x3d56, 0x4e46, 0x6257, 0x4637, 0x6258, 0x6259, 0x625d, 0x625b, 0x625c, 0x625a, 0x625e, 0x625f, 0x6260, 0x6261, 0x4c37, 0x6262, 0x4c70, 0x6263, 0x434e, 0x476a, 0x366b, 0x433b, 0x6264, 0x363a, 0x4050, 0x6265, 0x3a3d, 0x6266, 0x6267, 0x3826, 0x3a55, 0x6269, 0x4556, 0x3a56, 0x354e, 0x4b24, 0x474b, 0x4557, 0x395c, 0x626b, 0x3e4b, 0x4e32, 0x3945, 0x3827, 0x4823, 0x626d, 0x626f, 0x386b, 0x626e, 0x4476, 0x6271, 0x3337, 0x626c, 0x486a, 0x3130, 0x3a6c, 0x4f52, 0x6270, 0x6272, 0x4a4b, 0x4059, 0x6274, 0x6275, 0x6273, 0x334e, 0x627b, 0x627a, 0x3c27, 0x627c, 0x6277, 0x627d, 0x6278, 0x4858, 0x6276, 0x6279, 0x6322, 0x6321, 0x4b61, 0x627e, 0x306b, 0x6324, 0x6323, 0x3e4c, 0x6325, 0x4143, 0x6327, 0x6326, 0x6328, 0x6268, 0x626a, 0x632a, 0x6329, 0x3c28, 0x4e69, 0x3c52, 0x632b, 0x3737, 0x3540, 0x3527, 0x3b63, 0x4d34, 0x6331, 0x6330, 0x4144, 0x632d, 0x632f, 0x3d4b, 0x3f40, 0x632e, 0x632c, 0x472a, 0x3e4d, 0x493c, 0x3a57, 0x4578, 0x6332, 0x6333, 0x6349, 0x3658, 0x4f3d, 0x4135, 0x6334, 0x3252, 0x4477, 0x4a21, 0x6335, 0x357a, 0x6336, 0x6338, 0x6339, 0x4729, 0x633a, 0x633b, 0x633c, 0x3659, 0x3253, 0x4645, 0x3d28, 0x3b64, 0x633d, 0x3d29, 0x324a, 0x4943, 0x633e, 0x486b, 0x4145, 0x6341, 0x6342, 0x4769, 0x3f41, 0x633f, 0x4361, 0x6340, 0x3e4e, 0x305c, 0x3529, 0x6343, 0x4478, 0x6344, 0x4047, 0x4c2d, 0x4923, 0x6345, 0x6346, 0x4355, 0x4e47, 0x6348, 0x6347, 0x3c6f, 0x634a, 0x3070, 0x634d, 0x634b, 0x3254, 0x374e, 0x634c, 0x3946, 0x3972, 0x4a66, 0x634e, 0x4b54, 0x6350, 0x4051, 0x314f, 0x323a, 0x302c, 0x634f, 0x6351, 0x6352, 0x3e77, 0x6353, 0x334f, 0x6355, 0x376a, 0x3566, 0x6356, 0x3675, 0x6357, 0x407c, 0x464d, 0x4060, 0x3a75, 0x6358, 0x4362, 0x416b, 0x635a, 0x635c, 0x6359, 0x635b, 0x3722, 0x635d, 0x3726, 0x3567, 0x4d52, 0x635f, 0x6360, 0x312e, 0x6363, 0x3376, 0x6362, 0x6361, 0x6365, 0x635e, 0x6366, 0x4e29, 0x6367, 0x6368, 0x5474, 0x636a, 0x6369, 0x636b, 0x636c, 0x4e35, 0x636d, 0x706f, 0x3e4f, 0x636e, 0x636f, 0x3d57, 0x4638, 0x6370, 0x4328, 0x6371, 0x433c, 0x6372, 0x3625, 0x513f, 0x435d, 0x3c33, 0x3448, 0x6373, 0x6422, 0x6376, 0x3568, 0x6375, 0x6424, 0x6374, 0x3e50, 0x6378, 0x6379, 0x452b, 0x637a, 0x335e, 0x3f5a, 0x4964, 0x637c, 0x4268, 0x6377, 0x637b, 0x637d, 0x3a7b, 0x6426, 0x492e, 0x4826, 0x4579, 0x365a, 0x6425, 0x6423, 0x4835, 0x637e, 0x435e, 0x457b, 0x457a, 0x3a76, 0x6438, 0x6428, 0x642a, 0x642d, 0x642e, 0x642b, 0x642c, 0x6429, 0x6427, 0x6421, 0x4a4f, 0x3255, 0x6435, 0x6432, 0x6437, 0x6436, 0x4773, 0x4c27, 0x3b3b, 0x6430, 0x6439, 0x6434, 0x6433, 0x642f, 0x6431, 0x3449, 0x433d, 0x407d, 0x4822, 0x643e, 0x4824, 0x4061, 0x643b, 0x484f, 0x643f, 0x4a53, 0x435b, 0x643a, 0x643c, 0x643d, 0x6440, 0x3c44, 0x4646, 0x6445, 0x6444, 0x6441, 0x4f36, 0x644a, 0x644e, 0x644b, 0x6447, 0x6448, 0x644d, 0x6442, 0x5255, 0x6449, 0x6443, 0x644c, 0x6452, 0x344a, 0x644f, 0x6450, 0x6451, 0x6454, 0x6453, 0x4876, 0x6455, 0x4e7c, 0x4a6d, 0x645a, 0x6457, 0x6456, 0x4052, 0x6459, 0x645b, 0x6458, 0x645f, 0x645c, 0x645d, 0x6446, 0x645e, 0x6460, 0x6461, 0x4a46, 0x6462, 0x4c62, 0x364e, 0x3729, 0x6463, 0x4a34, 0x3f68, 0x4c30, 0x6464, 0x4e33, 0x4774, 0x4146, 0x4734, 0x3d4d, 0x3040, 0x6469, 0x6467, 0x6465, 0x3421, 0x3e51, 0x646a, 0x6468, 0x6466, 0x646e, 0x646d, 0x646c, 0x646b, 0x646f, 0x6470, 0x403a, 0x6471, 0x6473, 0x6472, 0x3852, 0x4138, 0x6475, 0x457c, 0x6474, 0x6476, 0x4a35, 0x416c, 0x3947, 0x6477, 0x4e48, 0x6479, 0x647a, 0x647b, 0x647c, 0x3b65, 0x647d, 0x374f, 0x356a, 0x352a, 0x6521, 0x4c73, 0x3948, 0x647e, 0x6524, 0x4c66, 0x473c, 0x4933, 0x3d63, 0x6523, 0x3c53, 0x3949, 0x3b66, 0x3569, 0x4a36, 0x6522, 0x4147, 0x4b42, 0x3a77, 0x3b67, 0x445d, 0x6527, 0x4e5f, 0x3a59, 0x6528, 0x3f42, 0x652a, 0x3e52, 0x3a30, 0x6529, 0x3d2a, 0x383e, 0x4148, 0x6525, 0x652b, 0x6526, 0x3750, 0x652e, 0x6532, 0x376b, 0x652d, 0x6536, 0x394a, 0x4d6d, 0x303c, 0x6533, 0x356b, 0x6530, 0x6531, 0x457d, 0x652f, 0x652c, 0x3328, 0x4064, 0x3828, 0x6538, 0x6535, 0x6537, 0x6534, 0x3751, 0x4233, 0x6539, 0x416e, 0x6546, 0x6542, 0x653c, 0x6540, 0x3c7a, 0x305d, 0x653b, 0x6543, 0x6547, 0x394b, 0x4c56, 0x4456, 0x653d, 0x6545, 0x653a, 0x433e, 0x653f, 0x303d, 0x4c4a, 0x653e, 0x365b, 0x486c, 0x416d, 0x4e50, 0x3d6f, 0x656e, 0x6548, 0x407e, 0x6544, 0x6549, 0x654b, 0x4479, 0x654e, 0x654a, 0x4a54, 0x344b, 0x4c4b, 0x305e, 0x654d, 0x4e7d, 0x654c, 0x316f, 0x466c, 0x654f, 0x6556, 0x6550, 0x6557, 0x6553, 0x477b, 0x3c4a, 0x6555, 0x6552, 0x6558, 0x6551, 0x3d44, 0x4b25, 0x3d4c, 0x6554, 0x6560, 0x655c, 0x655f, 0x655d, 0x6561, 0x655b, 0x6541, 0x4053, 0x484b, 0x655e, 0x6559, 0x4121, 0x3752, 0x3d2b, 0x3f25, 0x4136, 0x6564, 0x6566, 0x6567, 0x6563, 0x6565, 0x655a, 0x6562, 0x656a, 0x6569, 0x4b7a, 0x372b, 0x6568, 0x656c, 0x656b, 0x656f, 0x6571, 0x3b3c, 0x656d, 0x6572, 0x6573, 0x6574, 0x657a, 0x453b, 0x6576, 0x6575, 0x6577, 0x6578, 0x6579, 0x657b, 0x657c, 0x344c, 0x657d, 0x657e, 0x6621, 0x6622, 0x6623, 0x6624, 0x6625, 0x6626, 0x6628, 0x6627, 0x6629, 0x662a, 0x662b, 0x662e, 0x662c, 0x662d, 0x3a61, 0x3753, 0x4356, 0x4833, 0x3d70, 0x474d, 0x486d, 0x662f, 0x586d, 0x6630, 0x6632, 0x4d65, 0x6631, 0x6634, 0x6633, 0x4d53, 0x6635, 0x487e, 0x6636, 0x6639, 0x6638, 0x6637, 0x663a, 0x3732, 0x4122, 0x3541, 0x663e, 0x663b, 0x663c, 0x663f, 0x6640, 0x663d, 0x3129, 0x3227, 0x6642, 0x6643, 0x6644, 0x4d62, 0x3d2c, 0x6646, 0x6645, 0x3f69, 0x6647, 0x6648, 0x6649, 0x3465, 0x344d, 0x664a, 0x664b, 0x4b5d, 0x4d63, 0x4d54, 0x4f37, 0x394d, 0x664e, 0x3c54, 0x664d, 0x664f, 0x3c29, 0x4251, 0x6650, 0x394c, 0x4c57, 0x6651, 0x6652, 0x6653, 0x6654, 0x6655, 0x3c2a, 0x4c6d, 0x6657, 0x433f, 0x6656, 0x6659, 0x6658, 0x665a, 0x403b, 0x665b, 0x665c, 0x4a39, 0x665d, 0x416f, 0x665e, 0x665f, 0x4e7e, 0x6662, 0x6661, 0x6660, 0x4430, 0x6663, 0x3f26, 0x6664, 0x6665, 0x4f38, 0x6666, 0x6667, 0x6669, 0x6668, 0x4825, 0x4679, 0x4f3e, 0x4829, 0x666b, 0x3e53, 0x492a, 0x666c, 0x666a, 0x344e, 0x3854, 0x3b68, 0x486e, 0x382a, 0x4b43, 0x666f, 0x666d, 0x394e, 0x394f, 0x3069, 0x3a68, 0x4759, 0x305f, 0x6674, 0x4340, 0x4758, 0x425b, 0x6676, 0x6672, 0x6675, 0x6670, 0x6673, 0x4b26, 0x3855, 0x307d, 0x6671, 0x6678, 0x6679, 0x4639, 0x363b, 0x6726, 0x473d, 0x3b69, 0x363c, 0x4048, 0x4f46, 0x4c2e, 0x6677, 0x4054, 0x3553, 0x667a, 0x667c, 0x667b, 0x667d, 0x4326, 0x473e, 0x4431, 0x6723, 0x6722, 0x667e, 0x3f55, 0x4965, 0x6725, 0x6724, 0x3950, 0x4f53, 0x6735, 0x6729, 0x672a, 0x3c70, 0x6728, 0x3978, 0x6727, 0x672b, 0x4432, 0x4a22, 0x4123, 0x425c, 0x672f, 0x6730, 0x672c, 0x672d, 0x672e, 0x3951, 0x6736, 0x6732, 0x4966, 0x4b6c, 0x4928, 0x6731, 0x6734, 0x6733, 0x4b44, 0x6737, 0x6738, 0x4137, 0x6739, 0x673b, 0x673f, 0x673c, 0x673a, 0x473f, 0x673d, 0x673e, 0x3232, 0x6745, 0x6740, 0x6741, 0x6742, 0x4221, 0x6744, 0x6743, 0x6746, 0x6747, 0x6748, 0x3f43, 0x3269, 0x6749, 0x4e57, 0x3c2b, 0x3d2d, 0x3b6a, 0x4357, 0x674a, 0x674b, 0x3131, 0x674c, 0x674d, 0x674e, 0x674f, 0x6750, 0x363d, 0x5a2a, 0x6751, 0x4065, 0x6752, 0x3c4b, 0x6753, 0x5030, 0x6754, 0x4a5e, 0x345c, 0x4124, 0x3d58, 0x4971, 0x3d2e, 0x6755, 0x3952, 0x6756, 0x484c, 0x6764, 0x6758, 0x4249, 0x4775, 0x383f, 0x6757, 0x4125, 0x6759, 0x447a, 0x675b, 0x675a, 0x675d, 0x675c, 0x675e, 0x6760, 0x675f, 0x344f, 0x6761, 0x6762, 0x6763, 0x3a31, 0x4e49, 0x6765, 0x3f27, 0x3170, 0x6766, 0x6767, 0x6768, 0x3072, 0x6769, 0x676a, 0x4967, 0x3c47, 0x676c, 0x3329, 0x3032, 0x676b, 0x676e, 0x474e, 0x3f44, 0x3256, 0x4b27, 0x375d, 0x365c, 0x676d, 0x326a, 0x3423, 0x3171, 0x6772, 0x4e6a, 0x425d, 0x4944, 0x677e, 0x3257, 0x677c, 0x677a, 0x6771, 0x676f, 0x6770, 0x3c63, 0x366c, 0x4377, 0x4651, 0x3151, 0x6774, 0x6773, 0x6779, 0x6775, 0x6778, 0x4c50, 0x6777, 0x3258, 0x337d, 0x677b, 0x677d, 0x3754, 0x6823, 0x682c, 0x682d, 0x302b, 0x6834, 0x3071, 0x682b, 0x682a, 0x6825, 0x6824, 0x6822, 0x6821, 0x4363, 0x427b, 0x6827, 0x6826, 0x6829, 0x4170, 0x3755, 0x3141, 0x6828, 0x3953, 0x4171, 0x683a, 0x683b, 0x3259, 0x322e, 0x6838, 0x682e, 0x6836, 0x683d, 0x6837, 0x6835, 0x6776, 0x6833, 0x682f, 0x3450, 0x6831, 0x683c, 0x6832, 0x683e, 0x6830, 0x477c, 0x4d69, 0x6839, 0x684f, 0x6847, 0x3f7b, 0x3546, 0x365d, 0x6842, 0x325b, 0x3e54, 0x6845, 0x3a5a, 0x4551, 0x684a, 0x4a6e, 0x6841, 0x325a, 0x3856, 0x4929, 0x684b, 0x683f, 0x6848, 0x6852, 0x6843, 0x6844, 0x463a, 0x6849, 0x6846, 0x4b28, 0x684c, 0x3060, 0x6840, 0x684e, 0x684d, 0x476b, 0x6854, 0x685f, 0x337e, 0x6862, 0x6850, 0x6855, 0x4d6e, 0x685e, 0x4d55, 0x4e2a, 0x4378, 0x336b, 0x4972, 0x6864, 0x4621, 0x3031, 0x685d, 0x6859, 0x4172, 0x6853, 0x685b, 0x6860, 0x472c, 0x302a, 0x6858, 0x6861, 0x4978, 0x685c, 0x6857, 0x3e55, 0x3d2f, 0x3c2c, 0x4c58, 0x4947, 0x6867, 0x6870, 0x685a, 0x3377, 0x3e78, 0x6865, 0x686a, 0x4173, 0x6866, 0x686d, 0x435f, 0x686e, 0x4d56, 0x6863, 0x3338, 0x6869, 0x686c, 0x4c2c, 0x686f, 0x6868, 0x686b, 0x4b29, 0x4f21, 0x6873, 0x687a, 0x6872, 0x3c43, 0x6851, 0x4a4e, 0x4c22, 0x6879, 0x6878, 0x6874, 0x6875, 0x3136, 0x6877, 0x6871, 0x4455, 0x6876, 0x307e, 0x4222, 0x4a43, 0x687b, 0x6921, 0x4859, 0x687e, 0x3e56, 0x3c49, 0x6923, 0x363e, 0x6924, 0x4979, 0x687d, 0x6856, 0x687c, 0x4f4f, 0x4622, 0x4973, 0x692b, 0x6931, 0x6932, 0x6925, 0x4776, 0x692f, 0x6927, 0x6929, 0x6933, 0x6928, 0x692c, 0x3172, 0x4665, 0x692d, 0x6930, 0x6926, 0x4126, 0x692a, 0x3b27, 0x3f45, 0x3730, 0x4c74, 0x4c79, 0x3d72, 0x6937, 0x6935, 0x4f4e, 0x6934, 0x4d75, 0x6936, 0x6938, 0x6939, 0x693c, 0x693a, 0x4623, 0x693b, 0x484d, 0x692e, 0x3d73, 0x693d, 0x6942, 0x4174, 0x6941, 0x6922, 0x6943, 0x4149, 0x693e, 0x6940, 0x693f, 0x5d31, 0x5d22, 0x6945, 0x6944, 0x4d76, 0x623c, 0x6946, 0x6947, 0x6948, 0x3857, 0x3554, 0x694a, 0x515d, 0x3575, 0x4e3a, 0x3673, 0x694b, 0x694c, 0x436e, 0x694d, 0x467a, 0x303a, 0x3263, 0x6952, 0x6953, 0x694e, 0x3b3d, 0x694f, 0x4742, 0x6950, 0x6951, 0x695b, 0x6955, 0x6958, 0x6954, 0x6956, 0x6957, 0x3c58, 0x6959, 0x4341, 0x3756, 0x3342, 0x695c, 0x333f, 0x6961, 0x695d, 0x6960, 0x483a, 0x695e, 0x695f, 0x4948, 0x485a, 0x6962, 0x427d, 0x696c, 0x6968, 0x326b, 0x6966, 0x4b2a, 0x6967, 0x6964, 0x6965, 0x696a, 0x696d, 0x696b, 0x6969, 0x6963, 0x4358, 0x6974, 0x4c2a, 0x6972, 0x6973, 0x696e, 0x6970, 0x6971, 0x696f, 0x4066, 0x4f39, 0x6978, 0x6979, 0x6a21, 0x3f2a, 0x697b, 0x697e, 0x6976, 0x6975, 0x6a22, 0x325c, 0x697c, 0x6a23, 0x697d, 0x697a, 0x4433, 0x6977, 0x4768, 0x6a27, 0x4d3b, 0x6a26, 0x6a25, 0x6a2e, 0x6a28, 0x6a30, 0x4d66, 0x6a33, 0x6a2a, 0x6a2b, 0x6a2f, 0x6a32, 0x6a31, 0x6a29, 0x6a2c, 0x6a3d, 0x6a36, 0x6a34, 0x6a35, 0x6a3a, 0x6a3b, 0x332a, 0x3542, 0x6a39, 0x6a24, 0x6a38, 0x6a3c, 0x6a37, 0x6a3e, 0x6a40, 0x6a3f, 0x6a42, 0x6a41, 0x695a, 0x6a46, 0x6a43, 0x6a44, 0x6a45, 0x6a47, 0x376c, 0x6a49, 0x6a48, 0x3d30, 0x3954, 0x5e27, 0x6a4a, 0x3d51, 0x3339, 0x6a4b, 0x3152, 0x3e57, 0x6a4c, 0x3955, 0x6a4d, 0x3061, 0x493d, 0x6a4e, 0x3f6a, 0x6a55, 0x6a52, 0x436f, 0x6a53, 0x6a50, 0x365e, 0x6a4f, 0x6a56, 0x3736, 0x425e, 0x6a5c, 0x6a58, 0x4235, 0x6a57, 0x6a5a, 0x6a51, 0x6a5b, 0x6a5d, 0x486f, 0x6a59, 0x6a5e, 0x6a60, 0x3853, 0x6a54, 0x3041, 0x6a5f, 0x3a5b, 0x4e76, 0x6a61, 0x6a62, 0x4175, 0x4e22, 0x6a63, 0x4d35, 0x6a64, 0x6a65, 0x4a64, 0x6a66, 0x3a40, 0x4e23, 0x6a6b, 0x6a6c, 0x3e58, 0x6a6a, 0x4d67, 0x6a67, 0x6a69, 0x403d, 0x3f7e, 0x6a68, 0x6a6d, 0x4a23, 0x6a6f, 0x6a6e, 0x336c, 0x4b2b, 0x6a70, 0x6a7c, 0x6a72, 0x6a73, 0x6a74, 0x6a75, 0x6a79, 0x6a7a, 0x6a78, 0x6a76, 0x6a71, 0x6a77, 0x6a7b, 0x7037, 0x3228, 0x6a7e, 0x365f, 0x6a7d, 0x6b22, 0x6b21, 0x6b24, 0x6b23, 0x6b25, 0x3d31, 0x6b26, 0x6b27, 0x6b28, 0x403e, 0x4d57, 0x6b29, 0x4a24, 0x4746, 0x6b2a, 0x6b2b, 0x382b, 0x352c, 0x6b2c, 0x3b6b, 0x4741, 0x6b2d, 0x3350, 0x6b2e, 0x6b30, 0x4d77, 0x6b2f, 0x3f46, 0x6b31, 0x6b32, 0x6b33, 0x3451, 0x6b34, 0x6b35, 0x6b36, 0x6b37, 0x3351, 0x6b38, 0x6b39, 0x6b3a, 0x3272, 0x3f28, 0x6b3b, 0x6b3c, 0x6b3d, 0x3840, 0x447b, 0x6b3e, 0x3757, 0x3f56, 0x6b41, 0x4624, 0x6b40, 0x3731, 0x6b3f, 0x4277, 0x352d, 0x6b42, 0x6b43, 0x3e59, 0x376d, 0x6b44, 0x4b2c, 0x405f, 0x3576, 0x4c75, 0x414a, 0x6b45, 0x3f47, 0x4370, 0x3e5a, 0x6b46, 0x6b49, 0x6b4a, 0x3a3e, 0x4242, 0x6b48, 0x3e5b, 0x493e, 0x6b47, 0x3b6c, 0x3153, 0x6b4e, 0x3758, 0x3b6e, 0x3b6d, 0x4f4d, 0x6b4d, 0x6b4c, 0x4127, 0x354d, 0x4f43, 0x333a, 0x3e5c, 0x6b4b, 0x6b50, 0x6b51, 0x6b4f, 0x3858, 0x4d40, 0x3b6f, 0x4727, 0x6b54, 0x4040, 0x4342, 0x4d36, 0x6b57, 0x386c, 0x403f, 0x6b53, 0x6b58, 0x386d, 0x6b55, 0x6b56, 0x6b52, 0x4062, 0x4649, 0x432f, 0x325d, 0x4870, 0x3543, 0x4434, 0x6b5b, 0x6b59, 0x434c, 0x4041, 0x3452, 0x6b5a, 0x3f5b, 0x4e4a, 0x4f40, 0x6b5c, 0x6b67, 0x4435, 0x6b66, 0x6b63, 0x6b6b, 0x6b64, 0x6b60, 0x447c, 0x6b5f, 0x6b5d, 0x4d21, 0x3b70, 0x6b61, 0x6b5e, 0x6b65, 0x3d74, 0x3841, 0x427a, 0x4b45, 0x315a, 0x3062, 0x4625, 0x6b69, 0x6b68, 0x4666, 0x6b6d, 0x6b62, 0x6b6c, 0x6b6e, 0x382c, 0x6b6a, 0x3956, 0x3c55, 0x6b6f, 0x4d58, 0x6b72, 0x6b75, 0x6b73, 0x4935, 0x6b70, 0x3660, 0x6b74, 0x6b76, 0x6b7a, 0x6b77, 0x6b79, 0x6b78, 0x6b7b, 0x3c31, 0x6b7d, 0x6b7c, 0x4968, 0x6c21, 0x3759, 0x6b7e, 0x6c22, 0x6c23, 0x3544, 0x6641, 0x3e79, 0x6c24, 0x386e, 0x6c25, 0x6c26, 0x3b3e, 0x5a4e, 0x6c27, 0x6c28, 0x3d32, 0x6c29, 0x6c2a, 0x6c2b, 0x6c2c, 0x6c2d, 0x432b, 0x6c2e, 0x6c30, 0x6c2f, 0x4626, 0x6c31, 0x4b2d, 0x6c32, 0x6c33, 0x6c34, 0x6c35, 0x465a, 0x3e5d, 0x6c36, 0x396b, 0x502e, 0x6c37, 0x6c38, 0x493f, 0x6c39, 0x6c41, 0x6c3a, 0x6c3c, 0x6c3b, 0x6c3d, 0x4b46, 0x6c3e, 0x6c3f, 0x6c40, 0x6c42, 0x332d, 0x4467, 0x4969, 0x3a62, 0x3957, 0x494f, 0x325f, 0x484e, 0x6c45, 0x3453, 0x4055, 0x6c44, 0x6c49, 0x4379, 0x4c63, 0x6c47, 0x6c48, 0x352e, 0x6c4a, 0x4763, 0x425f, 0x4871, 0x453d, 0x6c46, 0x4b47, 0x326c, 0x6c4c, 0x4f28, 0x4442, 0x4f45, 0x3b71, 0x6c4b, 0x4231, 0x6c5c, 0x4128, 0x4678, 0x4950, 0x6c4f, 0x3b3f, 0x3b72, 0x3e5e, 0x4765, 0x382d, 0x6c4e, 0x6c4d, 0x496a, 0x3c41, 0x4552, 0x6c51, 0x6c52, 0x3958, 0x6c50, 0x6c53, 0x6c54, 0x6c56, 0x4223, 0x6c55, 0x3466, 0x6c58, 0x6c57, 0x6c59, 0x6c5b, 0x6c5d, 0x6c5e, 0x4056, 0x3c4f, 0x6c5f, 0x3352, 0x6c60, 0x4176, 0x6c61, 0x6c62, 0x496b, 0x352f, 0x6c63, 0x4436, 0x315b, 0x6c64, 0x3c71, 0x3f76, 0x422d, 0x6c67, 0x6c66, 0x6c65, 0x6c6d, 0x6c6b, 0x6c68, 0x6c6a, 0x6c69, 0x6c6c, 0x3577, 0x6c70, 0x4057, 0x6c71, 0x3859, 0x6c6e, 0x6c6f, 0x4f29, 0x4437, 0x4129, 0x6c72, 0x6c75, 0x6c73, 0x6c74, 0x4d59, 0x4627, 0x6c78, 0x6c76, 0x6c77, 0x6c79, 0x6d29, 0x6c7c, 0x6c7d, 0x6c7b, 0x6c7a, 0x447d, 0x6d21, 0x6d25, 0x6d22, 0x6c7e, 0x6d23, 0x6d24, 0x6d2b, 0x6d26, 0x4058, 0x6d28, 0x6d2a, 0x6d27, 0x6d2d, 0x3d33, 0x6d2c, 0x6d2e, 0x6d2f, 0x6d32, 0x6d31, 0x6d30, 0x6d34, 0x6d33, 0x4c76, 0x6d36, 0x6d35, 0x6d37, 0x6d38, 0x6d3a, 0x6d39, 0x3f48, 0x6d3b, 0x366d, 0x6d3c, 0x6d3e, 0x6d3f, 0x6d40, 0x6d3d, 0x6d41, 0x3c56, 0x6d42, 0x3530, 0x3733, 0x382e, 0x6d43, 0x4670, 0x453e, 0x6d44, 0x6d47, 0x3c34, 0x6d46, 0x6d45, 0x375a, 0x6d48, 0x3353, 0x6d4a, 0x3a5c, 0x6d49, 0x6d52, 0x6d4c, 0x6d4e, 0x4a65, 0x6d4b, 0x6d4d, 0x6d51, 0x6d4f, 0x3531, 0x6d50, 0x6d53, 0x475a, 0x4e58, 0x3d34, 0x6d54, 0x4d22, 0x6d56, 0x6d55, 0x6d59, 0x4d41, 0x6d58, 0x336d, 0x6d57, 0x6d5c, 0x6d5b, 0x6d5a, 0x4532, 0x6d5d, 0x6d5e, 0x6d5f, 0x396c, 0x3725, 0x6d60, 0x6d61, 0x6d62, 0x3f49, 0x6d63, 0x3c2d, 0x6d64, 0x6d65, 0x5221, 0x517e, 0x6d66, 0x6570, 0x6d67, 0x4324, 0x3f2b, 0x4740, 0x6d68, 0x4a55, 0x4454, 0x397e, 0x4329, 0x312a, 0x4b78, 0x3f57, 0x375e, 0x3661, 0x4a56, 0x6d69, 0x6d6b, 0x6d6a, 0x3260, 0x4676, 0x6d6c, 0x4777, 0x4533, 0x6d6d, 0x3d52, 0x6d6f, 0x4c42, 0x6d7e, 0x6d71, 0x6d72, 0x4449, 0x4260, 0x4177, 0x4628, 0x6d70, 0x3555, 0x6d79, 0x6d76, 0x6e25, 0x4629, 0x4360, 0x6d73, 0x447e, 0x4553, 0x6d74, 0x6d78, 0x3f60, 0x4767, 0x444c, 0x4042, 0x6d77, 0x422e, 0x4224, 0x6d75, 0x3029, 0x4f22, 0x6d7a, 0x4261, 0x3d35, 0x3f4a, 0x6d7c, 0x6d7b, 0x306f, 0x6d7d, 0x492f, 0x6e27, 0x465b, 0x3f6b, 0x4359, 0x3678, 0x6e26, 0x4d37, 0x313f, 0x4a57, 0x3261, 0x6e21, 0x6e22, 0x6e23, 0x6e24, 0x463b, 0x4323, 0x3063, 0x6e28, 0x6e29, 0x7423, 0x423d, 0x6e2a, 0x3173, 0x414c, 0x382f, 0x4d5a, 0x6e2b, 0x452c, 0x4178, 0x3c57, 0x6e2c, 0x6e2f, 0x3d65, 0x6e2d, 0x412b, 0x412a, 0x3064, 0x4e4b, 0x6e31, 0x4872, 0x6e33, 0x6e32, 0x6e30, 0x6364, 0x3454, 0x6d6e, 0x6e35, 0x6e34, 0x6e36, 0x4d38, 0x4661, 0x4b2e, 0x6e37, 0x3c59, 0x6e38, 0x6e39, 0x6e3a, 0x4521, 0x306a, 0x3959, 0x4f3a, 0x6e3e, 0x3734, 0x6e3b, 0x6e3c, 0x4974, 0x3354, 0x4d39, 0x363f, 0x4554, 0x6e3f, 0x6e40, 0x6e41, 0x4522, 0x6e43, 0x6e42, 0x4653, 0x6e44, 0x3d36, 0x3c60, 0x475b, 0x4371, 0x3c72, 0x3f6c, 0x6e45, 0x6e46, 0x3f5d, 0x6e47, 0x6e48, 0x6e49, 0x4d6f, 0x3d37, 0x6e4b, 0x6e4a, 0x395a, 0x3973, 0x3b40, 0x6e4e, 0x3d66, 0x6e4d, 0x6e4c, 0x4269, 0x386f, 0x4043, 0x4830, 0x3d39, 0x6e4f, 0x3e5f, 0x6e52, 0x6e50, 0x6e51, 0x6e54, 0x6e53, 0x3e7a, 0x6e55, 0x6e56, 0x6e57, 0x4850, 0x3a53, 0x3c61, 0x6e58, 0x6e59, 0x4e24, 0x3d45, 0x4c6e, 0x4e4c, 0x6e5a, 0x3662, 0x6e5b, 0x4523, 0x6e5e, 0x3378, 0x3f4b, 0x6e5c, 0x6e5d, 0x4460, 0x4b55, 0x367c, 0x6e60, 0x6e61, 0x6e5f, 0x6e63, 0x465f, 0x3343, 0x6e67, 0x6e64, 0x6e66, 0x6e62, 0x6f4f, 0x6e65, 0x4e6b, 0x385a, 0x6e6f, 0x4534, 0x6e6a, 0x6e6d, 0x6e6b, 0x6e70, 0x6e71, 0x6e69, 0x6e76, 0x3174, 0x6e68, 0x482d, 0x6e6c, 0x3e60, 0x395b, 0x4b48, 0x3664, 0x3d46, 0x463c, 0x412d, 0x6e74, 0x6e6e, 0x6e73, 0x4c43, 0x4438, 0x6e75, 0x6e72, 0x412c, 0x6e79, 0x6e78, 0x6e77, 0x4b2f, 0x3d7b, 0x6e7a, 0x4a5f, 0x3154, 0x4946, 0x4372, 0x3578, 0x6e7c, 0x395d, 0x3b2c, 0x6e7b, 0x3f6d, 0x3f6e, 0x6f21, 0x6f23, 0x3e7b, 0x6f22, 0x6f24, 0x3653, 0x4945, 0x3c62, 0x4f23, 0x6e7e, 0x3a78, 0x4f3f, 0x6f26, 0x6f25, 0x6f27, 0x6e7d, 0x4669, 0x4555, 0x4457, 0x6f2c, 0x4343, 0x6f28, 0x6f29, 0x372d, 0x6f2b, 0x3830, 0x6f2a, 0x3e61, 0x3379, 0x6f30, 0x3a3f, 0x4179, 0x444a, 0x333b, 0x6f2e, 0x6f2f, 0x4443, 0x6f2d, 0x6f31, 0x6f37, 0x6f3a, 0x6f39, 0x452d, 0x6f32, 0x6f33, 0x6f36, 0x6f38, 0x3640, 0x6f3b, 0x6f35, 0x6f34, 0x6f3f, 0x6f40, 0x6f41, 0x6f3e, 0x6f3d, 0x3e62, 0x462a, 0x6f3c, 0x6f45, 0x6f43, 0x6f44, 0x6f42, 0x4278, 0x6f46, 0x6f47, 0x6f49, 0x3455, 0x6f48, 0x4c7a, 0x6f54, 0x6f4a, 0x6f4d, 0x6f4b, 0x6f4c, 0x6f4e, 0x6f50, 0x6f51, 0x6f52, 0x6f55, 0x6f53, 0x6f56, 0x6f58, 0x6f57, 0x4439, 0x4c67, 0x6f59, 0x412e, 0x6f5a, 0x4a44, 0x6f5b, 0x332b, 0x313c, 0x3457, 0x3456, 0x6f5c, 0x6f5d, 0x6f5e, 0x6f5f, 0x6f60, 0x3458, 0x3355, 0x395e, 0x4836, 0x6f62, 0x6f61, 0x6f63, 0x315c, 0x6f66, 0x6f65, 0x6f64, 0x6f67, 0x6f6a, 0x3047, 0x6f68, 0x6f6c, 0x6f6b, 0x6f6e, 0x6f6d, 0x6f6f, 0x462e, 0x6f70, 0x6f71, 0x6f73, 0x6f72, 0x496c, 0x6f74, 0x6f75, 0x3a65, 0x6f76, 0x6f77, 0x4b49, 0x414b, 0x3024, 0x424b, 0x6f78, 0x496d, 0x6f7b, 0x6f79, 0x395f, 0x6f7a, 0x3842, 0x4a45, 0x6f7d, 0x7021, 0x6f7e, 0x7022, 0x3121, 0x3f58, 0x3d7c, 0x3459, 0x7023, 0x4766, 0x7025, 0x3122, 0x7024, 0x4444, 0x4e4d, 0x462b, 0x6f7c, 0x4e26, 0x3831, 0x4d5b, 0x3679, 0x4e34, 0x3728, 0x4262, 0x6721, 0x7026, 0x332c, 0x3f6f, 0x3356, 0x7028, 0x7029, 0x7027, 0x3764, 0x3a5d, 0x3e63, 0x3123, 0x4e59, 0x702b, 0x6e2e, 0x702a, 0x702e, 0x702c, 0x702d, 0x702f, 0x7030, 0x4e6c, 0x7031, 0x7032, 0x4049, 0x483b, 0x3f7d, 0x3467, 0x4d3a, 0x326d, 0x3d38, 0x385b, 0x7035, 0x7034, 0x3b73, 0x7036, 0x7033, 0x3b28, 0x703a, 0x6a2d, 0x5256, 0x3f77, 0x7038, 0x4e25, 0x4671, 0x312b, 0x4063, 0x3c36, 0x4a37, 0x3140, 0x4e6d, 0x4d6b, 0x703b, 0x4545, 0x3c7b, 0x703c, 0x703d, 0x3f4c, 0x703e, 0x4e6e, 0x7039, 0x7040, 0x7042, 0x7041, 0x703f, 0x7043, 0x7044, 0x417a, 0x3262, 0x7045, 0x4c38, 0x7046, 0x7047, 0x4f2a, 0x5b31, 0x7048, 0x7049, 0x704a, 0x704e, 0x704b, 0x704c, 0x704d, 0x704f, 0x4044, 0x4c77, 0x4045, 0x7050, 0x4873, 0x7051, 0x7353, 0x4c4c, 0x7052, 0x7053, 0x7054, 0x3357, 0x7056, 0x3f59, 0x7057, 0x3724, 0x7058, 0x705c, 0x705a, 0x705b, 0x3373, 0x7059, 0x705d, 0x705e, 0x3048, 0x705f, 0x7060, 0x3e64, 0x7061, 0x3547, 0x7064, 0x7063, 0x7062, 0x6b71, 0x4a5c, 0x7065, 0x7066, 0x7067, 0x7068, 0x7069, 0x706a, 0x345a, 0x706b, 0x706c, 0x4723, 0x706e, 0x323b, 0x7071, 0x7070, 0x3124, 0x3641, 0x4a47, 0x443a, 0x3a22, 0x3960, 0x3d67, 0x3f5c, 0x7073, 0x7072, 0x4d42, 0x3468, 0x4852, 0x465c, 0x3f7c, 0x4e4e, 0x375b, 0x7076, 0x7075, 0x4b4b, 0x462c, 0x3150, 0x7077, 0x7074, 0x4951, 0x4d6a, 0x7078, 0x7079, 0x707b, 0x426a, 0x335b, 0x335c, 0x707a, 0x3469, 0x3832, 0x346a, 0x453f, 0x4e60, 0x385c, 0x707c, 0x707d, 0x707e, 0x7121, 0x7123, 0x7122, 0x4977, 0x7124, 0x7125, 0x7126, 0x7127, 0x7129, 0x7128, 0x712a, 0x4874, 0x664c, 0x3f29, 0x3532, 0x712b, 0x712c, 0x522c, 0x5d3b, 0x4853, 0x307b, 0x303b, 0x3b74, 0x4b30, 0x3e7e, 0x712d, 0x4c5f, 0x712e, 0x4d5c, 0x3142, 0x3b41, 0x712f, 0x326e, 0x7130, 0x7131, 0x7133, 0x7134, 0x7136, 0x7132, 0x7135, 0x345b, 0x7137, 0x7138, 0x7139, 0x713a, 0x713b, 0x713d, 0x713c, 0x713f, 0x7142, 0x713e, 0x7140, 0x7141, 0x7143, 0x3642, 0x3c73, 0x7144, 0x7145, 0x3961, 0x7146, 0x333e, 0x474f, 0x7147, 0x7148, 0x435a, 0x466b, 0x7149, 0x477d, 0x424c, 0x3158, 0x366e, 0x366f, 0x4373, 0x714e, 0x3670, 0x326f, 0x714d, 0x714b, 0x714c, 0x714a, 0x7158, 0x714f, 0x7150, 0x7151, 0x7152, 0x7154, 0x7153, 0x3d59, 0x7155, 0x7157, 0x3533, 0x7156, 0x417b, 0x3833, 0x7159, 0x424d, 0x715a, 0x462d, 0x715b, 0x7160, 0x715e, 0x715d, 0x715f, 0x715c, 0x7162, 0x7161, 0x7164, 0x3643, 0x7163, 0x7165, 0x7166, 0x7168, 0x7167, 0x7169, 0x716b, 0x716a, 0x397c, 0x716c, 0x716d, 0x333c, 0x716e, 0x716f, 0x3f71, 0x7170, 0x7171, 0x7172, 0x7173, 0x3962, 0x7174, 0x7175, 0x7176, 0x7177, 0x7178, 0x4831, 0x717a, 0x4926, 0x717b, 0x7179, 0x717d, 0x717c, 0x717e, 0x7221, 0x7222, 0x7223, 0x7224, 0x7225, 0x7226, 0x7227, 0x7228, 0x7229, 0x722a, 0x722b, 0x722c, 0x722d, 0x722e, 0x5d35, 0x722f, 0x6478, 0x3534, 0x3321, 0x3a32, 0x7231, 0x7230, 0x4c25, 0x7233, 0x7234, 0x7232, 0x7235, 0x4b62, 0x7236, 0x357b, 0x4f25, 0x7237, 0x7239, 0x303e, 0x723a, 0x4a2b, 0x7238, 0x723b, 0x723c, 0x723d, 0x723e, 0x723f, 0x4b6e, 0x3b2d, 0x3a7a, 0x412f, 0x7240, 0x7243, 0x7241, 0x7244, 0x3871, 0x7242, 0x7245, 0x7246, 0x7247, 0x724b, 0x3b2a, 0x4264, 0x724c, 0x7249, 0x7248, 0x724a, 0x375f, 0x7250, 0x724f, 0x724e, 0x3033, 0x725a, 0x7256, 0x7257, 0x7253, 0x7259, 0x7255, 0x3362, 0x4f4c, 0x7258, 0x7254, 0x7252, 0x7251, 0x725c, 0x725f, 0x725e, 0x725d, 0x4949, 0x725b, 0x3073, 0x7260, 0x7262, 0x336f, 0x724d, 0x3137, 0x7264, 0x7263, 0x7261, 0x432d, 0x4b70, 0x4e5a, 0x7265, 0x7266, 0x7267, 0x7268, 0x7269, 0x443b, 0x726a, 0x4837, 0x726f, 0x726b, 0x726c, 0x4b31, 0x4c44, 0x4650, 0x7270, 0x7271, 0x463e, 0x726e, 0x726d, 0x322a, 0x7279, 0x7278, 0x3175, 0x7276, 0x7275, 0x7273, 0x337b, 0x7272, 0x3c32, 0x3229, 0x3963, 0x727c, 0x727b, 0x727a, 0x7277, 0x727d, 0x727e, 0x7325, 0x7324, 0x7326, 0x312d, 0x7321, 0x7322, 0x3974, 0x4c39, 0x7323, 0x4b32, 0x732b, 0x7327, 0x732c, 0x7329, 0x7328, 0x375c, 0x732d, 0x732e, 0x732f, 0x732a, 0x7274, 0x7330, 0x4461, 0x7334, 0x7335, 0x7333, 0x7332, 0x7338, 0x7331, 0x7336, 0x7337, 0x733a, 0x7339, 0x733c, 0x733d, 0x733e, 0x4f49, 0x733b, 0x426b, 0x3a6d, 0x733f, 0x7340, 0x7341, 0x7342, 0x7343, 0x3834, 0x7344, 0x7345, 0x3c2f, 0x7346, 0x7347, 0x7348, 0x7349, 0x734c, 0x734a, 0x4f3c, 0x734b, 0x4e6f, 0x734d, 0x4e5b, 0x734e, 0x477e, 0x734f, 0x7351, 0x7352, 0x7350, 0x396d, 0x4c4d, 0x4b63, 0x5677, 0x5d60, 0x4b7b, 0x322b, 0x7354, 0x3550, 0x7355, 0x7356, 0x7357, 0x3975, 0x7358, 0x6054, 0x4c5b, 0x4263, 0x7359, 0x735b, 0x735a, 0x735c, 0x735d, 0x735e, 0x735f, 0x7360, 0x7361, 0x7362, 0x7363, 0x7364, 0x7365, 0x7366, 0x7367, 0x7368, 0x4524, 0x385d, 0x736a, 0x414d, 0x736b, 0x736c, 0x4921, 0x736d, 0x736e, 0x6337, 0x6c5a, 0x706d, 0x736f, 0x7370, 0x7372, 0x7373, 0x7374, 0x4e70, 0x7371, 0x7375, 0x7376, 0x7378, 0x7377, 0x737a, 0x737b, 0x7379, 0x4e36, 0x737c, 0x737d, 0x6354, 0x737e, 0x212a, 0x2174, 0x2170, 0x2173, 0x2175, 0x214a, 0x214b, 0x2176, 0x215c, 0x2124, 0x2125, 0x213f, 0x2330, 0x2331, 0x2332, 0x2333, 0x2334, 0x2335, 0x2336, 0x2337, 0x2338, 0x2339, 0x2127, 0x2128, 0x2163, 0x2161, 0x2164, 0x2129, 0x2177, 0x2341, 0x2342, 0x2343, 0x2344, 0x2345, 0x2346, 0x2347, 0x2348, 0x2349, 0x234a, 0x234b, 0x234c, 0x234d, 0x234e, 0x234f, 0x2350, 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, 0x2356, 0x2357, 0x2358, 0x2359, 0x235a, 0x214e, 0x214f, 0x2130, 0x2132, 0x212e, 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, 0x2366, 0x2367, 0x2368, 0x2369, 0x236a, 0x236b, 0x236c, 0x236d, 0x236e, 0x236f, 0x2370, 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, 0x2376, 0x2377, 0x2378, 0x2379, 0x237a, 0x2150, 0x2143, 0x2151, 0x2131, 0x216f, }; static const Summary16 jisx0208_uni2indx_page00[16] = { /* 0x0000 */ { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x1000 }, { 1, 0x0000 }, { 1, 0x0000 }, { 1, 0x0000 }, { 1, 0x0000 }, { 1, 0x118c }, { 6, 0x0053 }, { 10, 0x0000 }, { 10, 0x0080 }, { 11, 0x0000 }, { 11, 0x0080 }, }; static const Summary16 jisx0208_uni2indx_page03[22] = { /* 0x0300 */ { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0xfffe }, { 27, 0x03fb }, { 36, 0xfffe }, { 51, 0x03fb }, { 60, 0x0000 }, { 60, 0x0000 }, { 60, 0x0000 }, /* 0x0400 */ { 60, 0x0002 }, { 61, 0xffff }, { 77, 0xffff }, { 93, 0xffff }, { 109, 0xffff }, { 125, 0x0002 }, }; static const Summary16 jisx0208_uni2indx_page20[50] = { /* 0x2000 */ { 126, 0x0000 }, { 126, 0x3361 }, { 133, 0x0063 }, { 137, 0x080d }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, /* 0x2100 */ { 141, 0x0008 }, { 142, 0x0000 }, { 142, 0x0800 }, { 143, 0x0000 }, { 143, 0x0000 }, { 143, 0x0000 }, { 143, 0x0000 }, { 143, 0x0000 }, { 143, 0x0000 }, { 143, 0x000f }, { 147, 0x0000 }, { 147, 0x0000 }, { 147, 0x0000 }, { 147, 0x0014 }, { 149, 0x0000 }, { 149, 0x0000 }, /* 0x2200 */ { 149, 0x098d }, { 155, 0x6404 }, { 159, 0x1f81 }, { 166, 0x2030 }, { 169, 0x0000 }, { 169, 0x0004 }, { 170, 0x0cc3 }, { 176, 0x0000 }, { 176, 0x00cc }, { 180, 0x0000 }, { 180, 0x0020 }, { 181, 0x0000 }, { 181, 0x0000 }, { 181, 0x0000 }, { 181, 0x0000 }, { 181, 0x0000 }, /* 0x2300 */ { 181, 0x0000 }, { 181, 0x0004 }, }; static const Summary16 jisx0208_uni2indx_page25[23] = { /* 0x2500 */ { 182, 0x900f }, { 188, 0x3999 }, { 196, 0x9939 }, { 204, 0x9999 }, { 212, 0x0804 }, { 214, 0x0000 }, { 214, 0x0000 }, { 214, 0x0000 }, { 214, 0x0000 }, { 214, 0x0000 }, { 214, 0x0003 }, { 216, 0x300c }, { 220, 0xc8c0 }, { 225, 0x0000 }, { 225, 0x8000 }, { 226, 0x0000 }, /* 0x2600 */ { 226, 0x0060 }, { 228, 0x0000 }, { 228, 0x0000 }, { 228, 0x0000 }, { 228, 0x0005 }, { 230, 0x0000 }, { 230, 0xa400 }, }; static const Summary16 jisx0208_uni2indx_page30[16] = { /* 0x3000 */ { 233, 0xffef }, { 248, 0x103f }, { 255, 0x0000 }, { 255, 0x0000 }, { 255, 0xfffe }, { 270, 0xffff }, { 286, 0xffff }, { 302, 0xffff }, { 318, 0xffff }, { 334, 0x780f }, { 342, 0xfffe }, { 357, 0xffff }, { 373, 0xffff }, { 389, 0xffff }, { 405, 0xffff }, { 421, 0x787f }, }; static const Summary16 jisx0208_uni2indx_page4e[1307] = { /* 0x4e00 */ { 432, 0x6f8b }, { 442, 0x43f3 }, { 451, 0x2442 }, { 455, 0x9b46 }, { 463, 0xe82c }, { 470, 0xe3e0 }, { 478, 0x0004 }, { 479, 0x400a }, { 482, 0x5f65 }, { 492, 0xdb36 }, { 502, 0x7977 }, { 513, 0x0449 }, { 517, 0xecd7 }, { 528, 0xe3f0 }, { 537, 0x6038 }, { 542, 0x08c5 }, /* 0x4f00 */ { 547, 0xe602 }, { 553, 0x3403 }, { 558, 0x8000 }, { 559, 0x3551 }, { 566, 0xe0c8 }, { 572, 0x7eab }, { 583, 0x8200 }, { 585, 0x9869 }, { 592, 0xa948 }, { 598, 0x2942 }, { 603, 0xe803 }, { 609, 0x8060 }, { 612, 0x441c }, { 617, 0xad93 }, { 626, 0xc03a }, { 632, 0x4568 }, /* 0x5000 */ { 638, 0xaa60 }, { 644, 0x8656 }, { 651, 0x3f7a }, { 662, 0x0240 }, { 664, 0x8388 }, { 669, 0x1461 }, { 674, 0x1020 }, { 676, 0x2174 }, { 682, 0x2021 }, { 685, 0x0702 }, { 689, 0x3000 }, { 691, 0x40bc }, { 697, 0xa624 }, { 703, 0x4462 }, { 708, 0x60a8 }, { 713, 0x0a20 }, /* 0x5100 */ { 716, 0x0217 }, { 721, 0x8574 }, { 728, 0x0402 }, { 730, 0x9c84 }, { 736, 0x7bfb }, { 749, 0x1415 }, { 754, 0x7f24 }, { 763, 0x11e2 }, { 769, 0xb665 }, { 778, 0x02ef }, { 786, 0x1f75 }, { 796, 0x20ff }, { 805, 0x3a70 }, { 812, 0x3840 }, { 816, 0x26c3 }, { 823, 0x6763 }, /* 0x5200 */ { 832, 0x4dd9 }, { 841, 0x2092 }, { 845, 0x46b0 }, { 851, 0x0fc9 }, { 859, 0xbc98 }, { 867, 0x4850 }, { 871, 0x8638 }, { 877, 0xa03f }, { 885, 0x2388 }, { 890, 0x8816 }, { 895, 0x3e09 }, { 902, 0x5232 }, { 908, 0x22aa }, { 914, 0xe3a4 }, { 922, 0x00dd }, { 928, 0xc72c }, /* 0x5300 */ { 936, 0xa166 }, { 943, 0x26e1 }, { 950, 0x840b }, { 955, 0x8f0a }, { 962, 0x27eb }, { 972, 0x559e }, { 981, 0xc241 }, { 986, 0x89bb }, { 995, 0x0014 }, { 997, 0x8540 }, { 1001, 0x6361 }, { 1008, 0x0849 }, { 1012, 0x7f0c }, { 1021, 0x8ad0 }, { 1027, 0xff3e }, { 1040, 0x05cf }, /* 0x5400 */ { 1048, 0xff1a }, { 1059, 0xa803 }, { 1064, 0x7a41 }, { 1071, 0x7b40 }, { 1078, 0x4745 }, { 1085, 0x8002 }, { 1087, 0x0500 }, { 1089, 0x38eb }, { 1098, 0xd851 }, { 1105, 0x0005 }, { 1107, 0x9934 }, { 1114, 0x710c }, { 1120, 0x0397 }, { 1127, 0x0100 }, { 1128, 0x6366 }, { 1136, 0x2404 }, /* 0x5500 */ { 1139, 0x80d0 }, { 1143, 0x0051 }, { 1146, 0xc000 }, { 1148, 0x430a }, { 1153, 0x9071 }, { 1159, 0x30c8 }, { 1164, 0x0008 }, { 1165, 0x5800 }, { 1168, 0x0e99 }, { 1175, 0xf700 }, { 1182, 0x5f80 }, { 1189, 0x0041 }, { 1191, 0x00b0 }, { 1194, 0x9410 }, { 1198, 0x0018 }, { 1200, 0x6280 }, /* 0x5600 */ { 1204, 0x0240 }, { 1206, 0x09d0 }, { 1211, 0x8200 }, { 1213, 0x0156 }, { 1218, 0x5004 }, { 1221, 0x0801 }, { 1223, 0x1d10 }, { 1228, 0x0510 }, { 1231, 0x84c1 }, { 1236, 0x0010 }, { 1237, 0x4025 }, { 1241, 0x1050 }, { 1244, 0x410f }, { 1250, 0x4d8a }, { 1257, 0x4009 }, { 1260, 0xa60d }, /* 0x5700 */ { 1267, 0xab19 }, { 1275, 0x914c }, { 1281, 0x21c0 }, { 1285, 0x0981 }, { 1289, 0xc485 }, { 1295, 0x0003 }, { 1297, 0x0652 }, { 1302, 0x8000 }, { 1303, 0x0b04 }, { 1307, 0x0008 }, { 1308, 0x041d }, { 1313, 0x0009 }, { 1315, 0x4849 }, { 1320, 0x905c }, { 1326, 0x0009 }, { 1328, 0x1690 }, /* 0x5800 */ { 1333, 0x0c65 }, { 1339, 0x2220 }, { 1342, 0x8412 }, { 1346, 0x2433 }, { 1352, 0x0c03 }, { 1356, 0x4796 }, { 1364, 0x0a04 }, { 1367, 0x4225 }, { 1372, 0x0028 }, { 1374, 0x9088 }, { 1378, 0x4900 }, { 1381, 0x4f08 }, { 1387, 0x14a2 }, { 1392, 0xd3aa }, { 1401, 0xd830 }, { 1407, 0x3e87 }, /* 0x5900 */ { 1416, 0x8604 }, { 1420, 0x1f61 }, { 1428, 0x7ea4 }, { 1437, 0x4186 }, { 1442, 0xc390 }, { 1448, 0x05b3 }, { 1455, 0x57a5 }, { 1464, 0x2118 }, { 1468, 0x241e }, { 1474, 0x2a48 }, { 1479, 0x1128 }, { 1483, 0x4a04 }, { 1487, 0x0a40 }, { 1490, 0x161b }, { 1497, 0x0d60 }, { 1502, 0x8840 }, /* 0x5a00 */ { 1505, 0x020a }, { 1508, 0x9502 }, { 1513, 0x8221 }, { 1517, 0x1060 }, { 1520, 0x0243 }, { 1524, 0x0400 }, { 1525, 0x1444 }, { 1529, 0x8000 }, { 1530, 0x0000 }, { 1530, 0x0c04 }, { 1533, 0x0000 }, { 1533, 0x7000 }, { 1536, 0x1a06 }, { 1541, 0x00c1 }, { 1544, 0x024a }, { 1548, 0x0c00 }, /* 0x5b00 */ { 1550, 0x1a00 }, { 1553, 0x0040 }, { 1554, 0x1404 }, { 1557, 0x4045 }, { 1561, 0x0029 }, { 1564, 0xbdb3 }, { 1575, 0x0a78 }, { 1581, 0x052b }, { 1587, 0xbba9 }, { 1597, 0xbfa0 }, { 1606, 0x407c }, { 1612, 0x8379 }, { 1620, 0x12fc }, { 1628, 0xe81d }, { 1636, 0x4bf6 }, { 1646, 0xc569 }, /* 0x5c00 */ { 1654, 0xeff6 }, { 1667, 0x044a }, { 1671, 0x2115 }, { 1676, 0xff02 }, { 1685, 0xed63 }, { 1695, 0x402b }, { 1700, 0xd033 }, { 1707, 0x0242 }, { 1710, 0x1000 }, { 1711, 0x0013 }, { 1714, 0x1b02 }, { 1719, 0x59ca }, { 1727, 0x00a0 }, { 1729, 0x0200 }, { 1730, 0xa703 }, { 1737, 0x2c41 }, /* 0x5d00 */ { 1742, 0x4880 }, { 1745, 0x8ff2 }, { 1755, 0x0204 }, { 1757, 0x0000 }, { 1757, 0x5800 }, { 1760, 0x1005 }, { 1763, 0x9200 }, { 1766, 0x0048 }, { 1768, 0x1894 }, { 1773, 0x2001 }, { 1775, 0x5004 }, { 1778, 0x3480 }, { 1782, 0x3200 }, { 1785, 0x684c }, { 1791, 0x49ea }, { 1799, 0x68be }, /* 0x5e00 */ { 1808, 0x184c }, { 1813, 0x2e42 }, { 1819, 0xa820 }, { 1823, 0x21c9 }, { 1829, 0x50b9 }, { 1836, 0x80b0 }, { 1840, 0x001e }, { 1844, 0xff7c }, { 1857, 0x849a }, { 1863, 0x14e0 }, { 1868, 0x28c1 }, { 1873, 0x01e0 }, { 1877, 0x870e }, { 1884, 0xac49 }, { 1891, 0x130f }, { 1898, 0xdddb }, /* 0x5f00 */ { 1910, 0xbe1a }, { 1919, 0x89fb }, { 1929, 0xa2e0 }, { 1935, 0x51a2 }, { 1941, 0x5502 }, { 1946, 0x32ca }, { 1953, 0x3e46 }, { 1961, 0x928b }, { 1968, 0x1dbf }, { 1979, 0x438f }, { 1987, 0x6703 }, { 1994, 0x3218 }, { 1999, 0x3028 }, { 2003, 0x33c0 }, { 2009, 0x0811 }, { 2012, 0xa923 }, /* 0x6000 */ { 2019, 0xc000 }, { 2021, 0x3a65 }, { 2029, 0x8fe3 }, { 2039, 0x0402 }, { 2041, 0x2c4e }, { 2048, 0x8625 }, { 2054, 0xbf3d }, { 2066, 0x00a1 }, { 2069, 0x3a1a }, { 2076, 0x8cd4 }, { 2083, 0x06c9 }, { 2089, 0x317c }, { 2097, 0x00e0 }, { 2100, 0x950a }, { 2106, 0x018b }, { 2111, 0x0edb }, /* 0x6100 */ { 2120, 0xe34b }, { 2129, 0x8c20 }, { 2133, 0x1182 }, { 2137, 0xf010 }, { 2142, 0x7d94 }, { 2151, 0xa728 }, { 2158, 0xc9ac }, { 2166, 0x40fb }, { 2174, 0x4484 }, { 2178, 0x0653 }, { 2184, 0x5a90 }, { 2190, 0x4444 }, { 2194, 0x3fc8 }, { 2203, 0x0001 }, { 2204, 0x0048 }, { 2206, 0xf5d4 }, /* 0x6200 */ { 2216, 0x7701 }, { 2223, 0xec57 }, { 2233, 0xc442 }, { 2238, 0x891d }, { 2245, 0x6b83 }, { 2253, 0x4928 }, { 2258, 0x4109 }, { 2262, 0xd242 }, { 2268, 0x061d }, { 2274, 0x59fe }, { 2285, 0x1800 }, { 2287, 0x3a22 }, { 2293, 0xb7e4 }, { 2303, 0x3b9f }, { 2314, 0xf003 }, { 2320, 0xc0ea }, /* 0x6300 */ { 2327, 0x1386 }, { 2333, 0x8202 }, { 2336, 0x8980 }, { 2340, 0xe400 }, { 2344, 0xb200 }, { 2348, 0x10a1 }, { 2352, 0x4b80 }, { 2357, 0x0cc4 }, { 2362, 0xd309 }, { 2369, 0x8944 }, { 2374, 0x1faf }, { 2385, 0x4834 }, { 2390, 0x8259 }, { 2396, 0x0c45 }, { 2401, 0x420a }, { 2405, 0x0450 }, /* 0x6400 */ { 2408, 0xa040 }, { 2411, 0x10c8 }, { 2415, 0x3140 }, { 2419, 0x4450 }, { 2423, 0x4004 }, { 2425, 0x0100 }, { 2426, 0x8280 }, { 2429, 0x0540 }, { 2432, 0x0108 }, { 2434, 0x442c }, { 2439, 0x6a30 }, { 2445, 0x1a05 }, { 2450, 0x20a6 }, { 2455, 0x0514 }, { 2459, 0x90cf }, { 2467, 0x6456 }, /* 0x6500 */ { 2474, 0x0021 }, { 2476, 0x3100 }, { 2479, 0x9c18 }, { 2485, 0xcbf0 }, { 2494, 0xa120 }, { 2498, 0x63e2 }, { 2506, 0x104c }, { 2510, 0x01b5 }, { 2516, 0x538c }, { 2523, 0x9a83 }, { 2530, 0xb8b2 }, { 2538, 0x3281 }, { 2543, 0x987a }, { 2551, 0x0a84 }, { 2555, 0x33e7 }, { 2565, 0x0c02 }, /* 0x6600 */ { 2568, 0xd4cc }, { 2576, 0x9018 }, { 2580, 0xa1a1 }, { 2586, 0x9070 }, { 2591, 0x8a1e }, { 2598, 0xe004 }, { 2602, 0xc3d4 }, { 2610, 0x0451 }, { 2614, 0x439a }, { 2621, 0x21c2 }, { 2626, 0x4844 }, { 2630, 0x5310 }, { 2635, 0x0292 }, { 2639, 0x3640 }, { 2644, 0x0241 }, { 2647, 0xf3bd }, /* 0x6700 */ { 2659, 0xab09 }, { 2666, 0xe8f0 }, { 2674, 0x7dc0 }, { 2682, 0xa5d2 }, { 2690, 0xc242 }, { 2695, 0xd24b }, { 2703, 0xa43f }, { 2712, 0xd0af }, { 2721, 0x1aa0 }, { 2726, 0x34a1 }, { 2732, 0x8247 }, { 2738, 0x03d8 }, { 2744, 0xc452 }, { 2750, 0x651b }, { 2758, 0xd294 }, { 2765, 0xc83a }, /* 0x6800 */ { 2772, 0x001c }, { 2775, 0x40c8 }, { 2779, 0x0e06 }, { 2784, 0x3314 }, { 2790, 0x614f }, { 2798, 0xb21b }, { 2806, 0x0088 }, { 2808, 0xc0d0 }, { 2813, 0xa02a }, { 2818, 0xa898 }, { 2824, 0xa1c5 }, { 2831, 0x166b }, { 2839, 0x2e50 }, { 2845, 0x85b4 }, { 2852, 0xc08b }, { 2858, 0x0604 }, /* 0x6900 */ { 2861, 0xf933 }, { 2871, 0x1e04 }, { 2876, 0x056e }, { 2883, 0xa251 }, { 2889, 0x0400 }, { 2890, 0x7638 }, { 2898, 0xec07 }, { 2906, 0x73b8 }, { 2915, 0x4406 }, { 2919, 0x1832 }, { 2924, 0x4081 }, { 2927, 0xc816 }, { 2933, 0x7c8a }, { 2941, 0x6309 }, { 2947, 0x2980 }, { 2951, 0xaa04 }, /* 0x6a00 */ { 2956, 0x1c24 }, { 2961, 0xca9c }, { 2969, 0x4e0e }, { 2976, 0x2760 }, { 2982, 0x0990 }, { 2986, 0x8300 }, { 2989, 0x0046 }, { 2992, 0x8104 }, { 2995, 0x6011 }, { 2999, 0x1081 }, { 3002, 0x540d }, { 3008, 0x0908 }, { 3011, 0x000e }, { 3014, 0xcc0a }, { 3020, 0x0500 }, { 3022, 0x0c00 }, /* 0x6b00 */ { 3024, 0x0430 }, { 3027, 0xa044 }, { 3031, 0x008b }, { 3035, 0x6784 }, { 3042, 0x5288 }, { 3047, 0x8a19 }, { 3053, 0x865e }, { 3061, 0x8b18 }, { 3067, 0x2e59 }, { 3075, 0x4160 }, { 3079, 0x8c10 }, { 3083, 0x9cbe }, { 3093, 0x6861 }, { 3099, 0x891c }, { 3105, 0x9800 }, { 3108, 0x0008 }, /* 0x6c00 */ { 3109, 0x8100 }, { 3111, 0x089a }, { 3116, 0x0018 }, { 3118, 0x4190 }, { 3122, 0x4007 }, { 3126, 0xe4a1 }, { 3133, 0x0505 }, { 3137, 0x640d }, { 3143, 0x310e }, { 3149, 0x0e4d }, { 3156, 0x4806 }, { 3160, 0xff0a }, { 3170, 0x1632 }, { 3176, 0x2aa8 }, { 3182, 0x852e }, { 3189, 0x000b }, /* 0x6d00 */ { 3192, 0x1800 }, { 3194, 0xca84 }, { 3200, 0x0e20 }, { 3204, 0x696c }, { 3212, 0x0032 }, { 3215, 0x1600 }, { 3218, 0x5658 }, { 3225, 0x0390 }, { 3229, 0x5120 }, { 3233, 0x1a28 }, { 3238, 0x8000 }, { 3239, 0x1124 }, { 3243, 0x18e1 }, { 3249, 0x4326 }, { 3255, 0x5d52 }, { 3263, 0x0eaa }, /* 0x6e00 */ { 3270, 0x0fa0 }, { 3276, 0xae28 }, { 3283, 0xfa7b }, { 3295, 0x4500 }, { 3298, 0x6408 }, { 3302, 0x8940 }, { 3306, 0xc880 }, { 3310, 0xc044 }, { 3314, 0x9005 }, { 3318, 0xb141 }, { 3324, 0x8424 }, { 3328, 0x24c4 }, { 3333, 0x1a34 }, { 3339, 0x603a }, { 3345, 0x9000 }, { 3347, 0xc194 }, /* 0x6f00 */ { 3353, 0x8246 }, { 3358, 0x003a }, { 3362, 0x180d }, { 3367, 0xc106 }, { 3372, 0x0022 }, { 3374, 0x9910 }, { 3379, 0xe050 }, { 3384, 0x1511 }, { 3389, 0x4057 }, { 3395, 0x0082 }, { 3397, 0x041a }, { 3401, 0x020a }, { 3404, 0x004f }, { 3409, 0x8930 }, { 3414, 0xd813 }, { 3421, 0x444a }, /* 0x7000 */ { 3426, 0x8a02 }, { 3430, 0xed22 }, { 3438, 0x10c0 }, { 3441, 0x4005 }, { 3444, 0x1000 }, { 3445, 0x0102 }, { 3447, 0x8808 }, { 3450, 0x3101 }, { 3454, 0x4600 }, { 3457, 0x0204 }, { 3459, 0xf000 }, { 3463, 0x0708 }, { 3467, 0x8900 }, { 3470, 0xa200 }, { 3473, 0x0000 }, { 3473, 0x2202 }, /* 0x7100 */ { 3476, 0x0200 }, { 3477, 0x1610 }, { 3481, 0x0042 }, { 3483, 0x1040 }, { 3485, 0x5200 }, { 3488, 0x0260 }, { 3491, 0x52f4 }, { 3499, 0x2000 }, { 3500, 0x8510 }, { 3504, 0x8230 }, { 3508, 0x1100 }, { 3510, 0x4202 }, { 3513, 0x4308 }, { 3517, 0x80b5 }, { 3523, 0x70e1 }, { 3530, 0x9a20 }, /* 0x7200 */ { 3535, 0x2040 }, { 3537, 0x0801 }, { 3539, 0x3500 }, { 3543, 0xfc65 }, { 3553, 0x19c1 }, { 3559, 0xab04 }, { 3565, 0x0286 }, { 3569, 0x6214 }, { 3574, 0x0087 }, { 3578, 0x0044 }, { 3580, 0x9085 }, { 3585, 0x0244 }, { 3588, 0x405c }, { 3593, 0x0a85 }, { 3598, 0x3207 }, { 3604, 0x3380 }, /* 0x7300 */ { 3609, 0x0400 }, { 3610, 0xb8c0 }, { 3616, 0xce20 }, { 3622, 0xc0d0 }, { 3627, 0xc030 }, { 3631, 0x0080 }, { 3632, 0x0508 }, { 3635, 0x0d25 }, { 3641, 0x0a90 }, { 3645, 0x0040 }, { 3646, 0x0200 }, { 3647, 0x080c }, { 3650, 0x6505 }, { 3656, 0x4000 }, { 3657, 0x6421 }, { 3662, 0x4102 }, /* 0x7400 */ { 3665, 0x0268 }, { 3669, 0x0000 }, { 3669, 0x0024 }, { 3671, 0x847c }, { 3678, 0x0002 }, { 3679, 0xde20 }, { 3686, 0x8619 }, { 3692, 0x4049 }, { 3696, 0x0808 }, { 3698, 0x4000 }, { 3699, 0x0084 }, { 3701, 0x2001 }, { 3703, 0x8400 }, { 3705, 0x1010 }, { 3707, 0x42cd }, { 3714, 0x01c7 }, /* 0x7500 */ { 3720, 0x7038 }, { 3726, 0xd52a }, { 3734, 0x1968 }, { 3740, 0x1d8f }, { 3749, 0xbe50 }, { 3757, 0x3e12 }, { 3764, 0x2ef5 }, { 3774, 0x81d9 }, { 3781, 0xcec4 }, { 3789, 0x2412 }, { 3793, 0x0828 }, { 3796, 0x732e }, { 3805, 0x24ac }, { 3811, 0x4b34 }, { 3818, 0x020c }, { 3821, 0xd41d }, /* 0x7600 */ { 3829, 0x2a02 }, { 3833, 0x8000 }, { 3834, 0x0097 }, { 3839, 0x0811 }, { 3842, 0x11c4 }, { 3847, 0x1144 }, { 3851, 0x1786 }, { 3858, 0x7d45 }, { 3867, 0x49d9 }, { 3875, 0x0649 }, { 3880, 0x4000 }, { 3881, 0x8791 }, { 3888, 0x254c }, { 3894, 0xd8c4 }, { 3901, 0x44ba }, { 3908, 0x4914 }, /* 0x7700 */ { 3913, 0x1b92 }, { 3920, 0xc800 }, { 3923, 0x0271 }, { 3928, 0x1580 }, { 3932, 0x0081 }, { 3934, 0x0c00 }, { 3936, 0x096a }, { 3942, 0xc200 }, { 3945, 0x4800 }, { 3947, 0x4002 }, { 3949, 0x3021 }, { 3953, 0xba49 }, { 3961, 0x2080 }, { 3963, 0x1c80 }, { 3967, 0xe2ac }, { 3975, 0x1008 }, /* 0x7800 */ { 3977, 0x1004 }, { 3979, 0x0034 }, { 3982, 0x00e1 }, { 3986, 0x8414 }, { 3990, 0x0020 }, { 3991, 0x2000 }, { 3992, 0x9800 }, { 3995, 0x1014 }, { 3998, 0x70c2 }, { 4004, 0x04aa }, { 4009, 0x8688 }, { 4014, 0x5420 }, { 4018, 0x0c62 }, { 4023, 0x0413 }, { 4027, 0x9180 }, { 4031, 0x2010 }, /* 0x7900 */ { 4033, 0x4082 }, { 4036, 0x0206 }, { 4039, 0x1c40 }, { 4043, 0x5400 }, { 4046, 0x0383 }, { 4051, 0xe4e9 }, { 4060, 0x2125 }, { 4065, 0x8480 }, { 4068, 0xe433 }, { 4076, 0x2000 }, { 4077, 0x44c0 }, { 4081, 0xe609 }, { 4088, 0x0a03 }, { 4092, 0x8126 }, { 4097, 0x12da }, { 4104, 0x0801 }, /* 0x7a00 */ { 4106, 0x6901 }, { 4111, 0x9790 }, { 4118, 0x4001 }, { 4120, 0xf886 }, { 4128, 0xe24d }, { 4136, 0x0081 }, { 4138, 0x0a0e }, { 4143, 0xa651 }, { 4150, 0x011a }, { 4154, 0x81ec }, { 4161, 0xc600 }, { 4165, 0x8441 }, { 4169, 0xadb8 }, { 4178, 0xb62c }, { 4186, 0xa46f }, { 4195, 0x8741 }, /* 0x7b00 */ { 4201, 0x8d54 }, { 4208, 0x4b02 }, { 4213, 0x1161 }, { 4218, 0x0268 }, { 4222, 0xbb60 }, { 4230, 0x2057 }, { 4236, 0x50a0 }, { 4240, 0x0433 }, { 4245, 0xa8c0 }, { 4250, 0xb7b4 }, { 4260, 0x2402 }, { 4263, 0x0112 }, { 4266, 0x9ad3 }, { 4275, 0x2000 }, { 4276, 0x2271 }, { 4282, 0x00c8 }, /* 0x7c00 */ { 4285, 0x2081 }, { 4288, 0x809e }, { 4294, 0x0c8a }, { 4299, 0xe180 }, { 4304, 0xb009 }, { 4309, 0x8151 }, { 4314, 0x1031 }, { 4318, 0x4028 }, { 4321, 0x2a0e }, { 4327, 0x89a5 }, { 4334, 0x69b6 }, { 4343, 0x620e }, { 4349, 0x4425 }, { 4354, 0xd144 }, { 4360, 0x8085 }, { 4364, 0x4d54 }, /* 0x7d00 */ { 4371, 0x2c75 }, { 4379, 0x1fb1 }, { 4388, 0xd807 }, { 4395, 0x862d }, { 4402, 0xd87c }, { 4411, 0x4841 }, { 4415, 0x414e }, { 4421, 0x226e }, { 4428, 0x8200 }, { 4430, 0x9e08 }, { 4436, 0xf80c }, { 4443, 0xed37 }, { 4454, 0x8c80 }, { 4458, 0x7526 }, { 4466, 0x9313 }, { 4473, 0x0814 }, /* 0x7e00 */ { 4476, 0x0e32 }, { 4482, 0xc804 }, { 4486, 0x484e }, { 4492, 0x6ea6 }, { 4501, 0x2c4a }, { 4507, 0x6670 }, { 4514, 0x26c0 }, { 4519, 0xba01 }, { 4525, 0xd30c }, { 4532, 0x185d }, { 4539, 0x0000 }, { 4539, 0x0000 }, { 4539, 0x0000 }, { 4539, 0x0000 }, { 4539, 0x0000 }, { 4539, 0x0000 }, /* 0x7f00 */ { 4539, 0x0000 }, { 4539, 0x0000 }, { 4539, 0x0000 }, { 4539, 0x0540 }, { 4542, 0x7020 }, { 4546, 0x8133 }, { 4552, 0x4f81 }, { 4559, 0x03a5 }, { 4565, 0x55ec }, { 4574, 0x6410 }, { 4578, 0xc318 }, { 4584, 0x2344 }, { 4589, 0x1462 }, { 4594, 0x0034 }, { 4597, 0x0a43 }, { 4602, 0x1a09 }, /* 0x8000 */ { 4607, 0x187b }, { 4615, 0x13a5 }, { 4622, 0x0102 }, { 4624, 0xa848 }, { 4629, 0x0440 }, { 4631, 0xc544 }, { 4637, 0x8106 }, { 4641, 0xe2dd }, { 4651, 0x1af0 }, { 4658, 0x2d48 }, { 4664, 0xb626 }, { 4672, 0x0416 }, { 4676, 0x5058 }, { 4681, 0x6e40 }, { 4687, 0x8032 }, { 4691, 0x3112 }, /* 0x8100 */ { 4696, 0x07e4 }, { 4703, 0x0c00 }, { 4705, 0x8208 }, { 4708, 0x420a }, { 4712, 0x4840 }, { 4715, 0x803b }, { 4721, 0x4860 }, { 4725, 0x8713 }, { 4732, 0x850d }, { 4738, 0x3428 }, { 4743, 0x0319 }, { 4748, 0xe529 }, { 4756, 0x2345 }, { 4762, 0x870a }, { 4768, 0x25a9 }, { 4775, 0x5c18 }, /* 0x8200 */ { 4781, 0x77a6 }, { 4791, 0xd9c5 }, { 4800, 0x5e00 }, { 4805, 0x03e8 }, { 4811, 0x0081 }, { 4813, 0xa700 }, { 4818, 0xcd54 }, { 4826, 0x41c6 }, { 4832, 0x2800 }, { 4834, 0xa204 }, { 4838, 0xb860 }, { 4844, 0x2b0a }, { 4850, 0x0020 }, { 4851, 0xda9e }, { 4861, 0x08ea }, { 4867, 0x0e1a }, /* 0x8300 */ { 4873, 0x427c }, { 4880, 0x11c0 }, { 4884, 0x8908 }, { 4888, 0x0376 }, { 4895, 0x8621 }, { 4900, 0x0105 }, { 4903, 0x0000 }, { 4903, 0x18a8 }, { 4908, 0x46a0 }, { 4913, 0xc448 }, { 4918, 0x0d05 }, { 4923, 0x2022 }, { 4926, 0x5422 }, { 4931, 0x9148 }, { 4936, 0x8a01 }, { 4940, 0x2897 }, /* 0x8400 */ { 4947, 0x7898 }, { 4954, 0x0008 }, { 4955, 0x1605 }, { 4960, 0x3122 }, { 4965, 0x4240 }, { 4968, 0x0880 }, { 4970, 0xfa4e }, { 4980, 0x06a2 }, { 4985, 0x0814 }, { 4988, 0x9211 }, { 4993, 0x2002 }, { 4995, 0x9b04 }, { 5001, 0x2e52 }, { 5008, 0x0643 }, { 5013, 0x5000 }, { 5015, 0x9010 }, /* 0x8500 */ { 5018, 0x0041 }, { 5020, 0x85ba }, { 5028, 0x3042 }, { 5032, 0x2020 }, { 5034, 0x4f0b }, { 5042, 0x05a0 }, { 5046, 0x2708 }, { 5051, 0x4080 }, { 5053, 0x0591 }, { 5058, 0x1a93 }, { 5065, 0xdf50 }, { 5074, 0x0600 }, { 5076, 0xa202 }, { 5080, 0x3021 }, { 5084, 0x0630 }, { 5088, 0x4e80 }, /* 0x8600 */ { 5093, 0x0cc4 }, { 5098, 0x04c8 }, { 5102, 0xa004 }, { 5105, 0x8001 }, { 5107, 0x6000 }, { 5109, 0xd431 }, { 5116, 0x0880 }, { 5118, 0x0a02 }, { 5121, 0x1c00 }, { 5124, 0x0028 }, { 5126, 0x8e18 }, { 5132, 0x0041 }, { 5134, 0x6ad0 }, { 5141, 0xca10 }, { 5146, 0xf210 }, { 5152, 0x4b00 }, /* 0x8700 */ { 5156, 0x274d }, { 5164, 0x1506 }, { 5169, 0x0220 }, { 5171, 0x8890 }, { 5175, 0x5a00 }, { 5179, 0x82a8 }, { 5184, 0x4549 }, { 5190, 0x8150 }, { 5194, 0x2004 }, { 5196, 0x8000 }, { 5197, 0x8804 }, { 5200, 0x2c08 }, { 5204, 0x08d1 }, { 5209, 0x0005 }, { 5211, 0x8001 }, { 5213, 0x4ac4 }, /* 0x8800 */ { 5219, 0xe020 }, { 5223, 0x0062 }, { 5226, 0x008e }, { 5230, 0x0a42 }, { 5234, 0x3055 }, { 5240, 0x6a8c }, { 5247, 0x090e }, { 5252, 0xe0a5 }, { 5259, 0x2906 }, { 5264, 0x42c4 }, { 5269, 0x4814 }, { 5273, 0x80b3 }, { 5279, 0x803e }, { 5285, 0xb330 }, { 5292, 0x0102 }, { 5294, 0x731c }, /* 0x8900 */ { 5302, 0x1494 }, { 5307, 0x600d }, { 5312, 0x0c20 }, { 5315, 0x0940 }, { 5318, 0x301a }, { 5323, 0xc040 }, { 5326, 0xa451 }, { 5332, 0xc094 }, { 5337, 0x8dca }, { 5345, 0x05c8 }, { 5350, 0x96c2 }, { 5357, 0xa40c }, { 5362, 0x0001 }, { 5363, 0x3404 }, { 5367, 0x00c8 }, { 5370, 0x0110 }, /* 0x8a00 */ { 5372, 0x550d }, { 5379, 0xa9c9 }, { 5387, 0x2428 }, { 5391, 0x1c5a }, { 5398, 0x0142 }, { 5401, 0x4837 }, { 5408, 0x7a4d }, { 5417, 0x100f }, { 5422, 0x32b4 }, { 5429, 0x452a }, { 5435, 0x317b }, { 5444, 0x9205 }, { 5449, 0xb894 }, { 5456, 0x5c44 }, { 5462, 0x68d7 }, { 5471, 0x458a }, /* 0x8b00 */ { 5477, 0x5097 }, { 5484, 0x2ed1 }, { 5492, 0x1943 }, { 5498, 0x4208 }, { 5501, 0xd202 }, { 5506, 0x9d40 }, { 5512, 0x9840 }, { 5516, 0x2097 }, { 5522, 0x5409 }, { 5527, 0x064d }, { 5533, 0x0000 }, { 5533, 0x0000 }, { 5533, 0x0000 }, { 5533, 0x0000 }, { 5533, 0x0000 }, { 5533, 0x0000 }, /* 0x8c00 */ { 5533, 0x0000 }, { 5533, 0x0000 }, { 5533, 0x0000 }, { 5533, 0x8480 }, { 5536, 0x5542 }, { 5542, 0x0421 }, { 5545, 0x1c06 }, { 5550, 0x1700 }, { 5554, 0x7624 }, { 5561, 0x6110 }, { 5565, 0xff87 }, { 5577, 0xb9dd }, { 5588, 0x659f }, { 5598, 0x5c0a }, { 5604, 0x245d }, { 5611, 0x3c00 }, /* 0x8d00 */ { 5615, 0xadb0 }, { 5623, 0x0059 }, { 5627, 0x0000 }, { 5627, 0x0000 }, { 5627, 0x0000 }, { 5627, 0x0000 }, { 5627, 0x28d0 }, { 5632, 0x009b }, { 5637, 0x0422 }, { 5640, 0x0200 }, { 5641, 0x0108 }, { 5643, 0x4408 }, { 5646, 0x9804 }, { 5650, 0xac40 }, { 5655, 0x8d0a }, { 5661, 0x9028 }, /* 0x8e00 */ { 5665, 0x8700 }, { 5669, 0xe001 }, { 5673, 0x0400 }, { 5674, 0x0031 }, { 5677, 0x1794 }, { 5684, 0x8221 }, { 5688, 0x0019 }, { 5691, 0x1054 }, { 5695, 0x2cb2 }, { 5702, 0x021a }, { 5706, 0x9c02 }, { 5711, 0x4003 }, { 5714, 0x3d60 }, { 5721, 0x8804 }, { 5724, 0x080c }, { 5727, 0x7900 }, /* 0x8f00 */ { 5732, 0x1628 }, { 5737, 0xba3c }, { 5746, 0x8640 }, { 5750, 0xcb08 }, { 5756, 0x7274 }, { 5764, 0x9080 }, { 5767, 0x001e }, { 5771, 0x0000 }, { 5771, 0x0000 }, { 5771, 0xd800 }, { 5775, 0xe188 }, { 5781, 0x9c87 }, { 5789, 0x4034 }, { 5793, 0x0412 }, { 5796, 0xae64 }, { 5804, 0x2791 }, /* 0x9000 */ { 5811, 0xe86b }, { 5820, 0xe6fb }, { 5832, 0x408f }, { 5838, 0x5366 }, { 5846, 0xeea6 }, { 5856, 0x537f }, { 5867, 0xe32b }, { 5876, 0xb5e4 }, { 5885, 0x869f }, { 5894, 0x0002 }, { 5895, 0x8548 }, { 5900, 0x0122 }, { 5903, 0x4402 }, { 5906, 0x0800 }, { 5907, 0x2116 }, { 5912, 0x20a0 }, /* 0x9100 */ { 5915, 0x0004 }, { 5916, 0x0204 }, { 5918, 0x2000 }, { 5919, 0x0005 }, { 5921, 0x7e00 }, { 5927, 0x0154 }, { 5931, 0x162c }, { 5937, 0x01ac }, { 5942, 0x2a84 }, { 5947, 0x1085 }, { 5951, 0x8c14 }, { 5956, 0x0530 }, { 5960, 0xfbc3 }, { 5971, 0xb943 }, { 5979, 0x00ca }, { 5983, 0x9060 }, /* 0x9200 */ { 5987, 0x6000 }, { 5989, 0x4032 }, { 5993, 0x1200 }, { 5995, 0x8090 }, { 5998, 0x0b30 }, { 6003, 0x4c81 }, { 6008, 0x0054 }, { 6011, 0x4002 }, { 6013, 0x0029 }, { 6016, 0x1d6a }, { 6024, 0x2000 }, { 6025, 0x0280 }, { 6027, 0x8000 }, { 6028, 0x0004 }, { 6029, 0x2610 }, { 6033, 0x150c }, /* 0x9300 */ { 6038, 0x8040 }, { 6040, 0x0701 }, { 6044, 0xd94d }, { 6053, 0x0c24 }, { 6057, 0x2810 }, { 6060, 0x1850 }, { 6064, 0x5001 }, { 6067, 0x5020 }, { 6070, 0x1000 }, { 6071, 0x04d0 }, { 6075, 0x7080 }, { 6079, 0x0201 }, { 6081, 0x0108 }, { 6083, 0x21c3 }, { 6089, 0x0132 }, { 6093, 0x0000 }, /* 0x9400 */ { 6093, 0x0088 }, { 6095, 0x0719 }, { 6101, 0x0802 }, { 6103, 0x0560 }, { 6107, 0x0012 }, { 6109, 0x4c0e }, { 6115, 0x0405 }, { 6118, 0xf0a1 }, { 6125, 0x0002 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, /* 0x9500 */ { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0080 }, { 6127, 0x8e8d }, { 6135, 0x035a }, { 6141, 0x21bd }, { 6149, 0x5a04 }, { 6154, 0x3488 }, { 6159, 0x1170 }, { 6164, 0x0026 }, { 6167, 0x0000 }, /* 0x9600 */ { 6167, 0x0000 }, { 6167, 0x1000 }, { 6168, 0xc502 }, { 6173, 0x8804 }, { 6176, 0xb815 }, { 6183, 0xf801 }, { 6189, 0x147c }, { 6196, 0x25ed }, { 6205, 0xed60 }, { 6213, 0x1bb0 }, { 6220, 0x0589 }, { 6225, 0x1bd7 }, { 6235, 0x7af3 }, { 6246, 0x1a62 }, { 6252, 0x0d0c }, { 6257, 0x0ac5 }, /* 0x9700 */ { 6263, 0xe5d1 }, { 6272, 0x524a }, { 6278, 0x0490 }, { 6281, 0x6305 }, { 6287, 0x0354 }, { 6292, 0x5244 }, { 6297, 0x2b57 }, { 6306, 0x1612 }, { 6311, 0xa872 }, { 6318, 0x1101 }, { 6321, 0x2949 }, { 6327, 0x0018 }, { 6329, 0x0948 }, { 6333, 0x1008 }, { 6335, 0x6000 }, { 6337, 0x886c }, /* 0x9800 */ { 6343, 0x916e }, { 6351, 0x058f }, { 6358, 0x3012 }, { 6362, 0x3990 }, { 6368, 0xf840 }, { 6374, 0x4930 }, { 6379, 0x8880 }, { 6382, 0x001b }, { 6386, 0x0000 }, { 6386, 0x0000 }, { 6386, 0x8500 }, { 6389, 0x0042 }, { 6391, 0x0058 }, { 6394, 0x9800 }, { 6397, 0xea04 }, { 6403, 0x7014 }, /* 0x9900 */ { 6408, 0x1628 }, { 6413, 0x611d }, { 6420, 0x5113 }, { 6426, 0x6000 }, { 6428, 0x1a24 }, { 6433, 0x00a7 }, { 6438, 0x0000 }, { 6438, 0x0000 }, { 6438, 0x0000 }, { 6438, 0x03c0 }, { 6442, 0x7120 }, { 6447, 0x1018 }, { 6450, 0x0172 }, { 6455, 0xa927 }, { 6463, 0x6004 }, { 6466, 0x8906 }, /* 0x9a00 */ { 6471, 0xc022 }, { 6475, 0x020c }, { 6478, 0x0900 }, { 6480, 0x4081 }, { 6483, 0x202d }, { 6488, 0x8ca0 }, { 6493, 0x0e34 }, { 6499, 0x0000 }, { 6499, 0x0000 }, { 6499, 0x0000 }, { 6499, 0x2100 }, { 6501, 0x1101 }, { 6504, 0x8011 }, { 6507, 0xc11a }, { 6513, 0xec4c }, { 6521, 0x0892 }, /* 0x9b00 */ { 6525, 0x0040 }, { 6526, 0x8500 }, { 6529, 0xc7ac }, { 6538, 0x1806 }, { 6542, 0xe03e }, { 6550, 0x0512 }, { 6554, 0x8000 }, { 6555, 0x0010 }, { 6556, 0x4008 }, { 6558, 0x80ce }, { 6564, 0x6d01 }, { 6570, 0x0210 }, { 6572, 0x8641 }, { 6577, 0x0856 }, { 6582, 0x011e }, { 6587, 0x0027 }, /* 0x9c00 */ { 6591, 0x3750 }, { 6598, 0x083d }, { 6604, 0xe032 }, { 6610, 0x4e05 }, { 6616, 0x01c0 }, { 6619, 0x0484 }, { 6622, 0x0081 }, { 6624, 0x0140 }, { 6626, 0x0000 }, { 6626, 0x0000 }, { 6626, 0x0000 }, { 6626, 0x0000 }, { 6626, 0x0000 }, { 6626, 0x0000 }, { 6626, 0x1aa0 }, { 6631, 0x0059 }, /* 0x9d00 */ { 6635, 0x43c8 }, { 6641, 0x8824 }, { 6645, 0x1d48 }, { 6651, 0xc800 }, { 6654, 0x0152 }, { 6658, 0x7203 }, { 6664, 0x9013 }, { 6669, 0x0404 }, { 6671, 0x8280 }, { 6674, 0x0400 }, { 6675, 0x8a10 }, { 6679, 0x0d14 }, { 6684, 0x8056 }, { 6689, 0x0208 }, { 6691, 0xa040 }, { 6694, 0x2704 }, /* 0x9e00 */ { 6699, 0x0000 }, { 6699, 0x4c00 }, { 6702, 0x0000 }, { 6702, 0x0000 }, { 6702, 0x0000 }, { 6702, 0x0000 }, { 6702, 0x0000 }, { 6702, 0xa320 }, { 6707, 0x1902 }, { 6711, 0xa0ae }, { 6718, 0x2660 }, { 6723, 0xdf00 }, { 6730, 0xf010 }, { 6735, 0x7b15 }, { 6744, 0x8121 }, { 6748, 0x3ad0 }, /* 0x9f00 */ { 6755, 0x4180 }, { 6758, 0x0028 }, { 6760, 0x1003 }, { 6763, 0x4800 }, { 6765, 0xcc00 }, { 6769, 0x8014 }, { 6772, 0x14cf }, { 6780, 0x00c4 }, { 6783, 0x2000 }, { 6784, 0x3020 }, { 6787, 0x0001 }, }; static const Summary16 jisx0208_uni2indx_pageff[15] = { /* 0xff00 */ { 6788, 0xdf7a }, { 6800, 0xffff }, { 6816, 0xffff }, { 6832, 0xefff }, { 6847, 0xffff }, { 6863, 0x3fff }, { 6877, 0x0000 }, { 6877, 0x0000 }, { 6877, 0x0000 }, { 6877, 0x0000 }, { 6877, 0x0000 }, { 6877, 0x0000 }, { 6877, 0x0000 }, { 6877, 0x0000 }, { 6877, 0x0028 }, }; static int jisx0208_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { if (n >= 2) { const Summary16 *summary = NULL; if (wc < 0x0100) summary = &jisx0208_uni2indx_page00[(wc>>4)]; else if (wc >= 0x0300 && wc < 0x0460) summary = &jisx0208_uni2indx_page03[(wc>>4)-0x030]; else if (wc >= 0x2000 && wc < 0x2320) summary = &jisx0208_uni2indx_page20[(wc>>4)-0x200]; else if (wc >= 0x2500 && wc < 0x2670) summary = &jisx0208_uni2indx_page25[(wc>>4)-0x250]; else if (wc >= 0x3000 && wc < 0x3100) summary = &jisx0208_uni2indx_page30[(wc>>4)-0x300]; else if (wc >= 0x4e00 && wc < 0x9fb0) summary = &jisx0208_uni2indx_page4e[(wc>>4)-0x4e0]; else if (wc >= 0xff00 && wc < 0xfff0) summary = &jisx0208_uni2indx_pageff[(wc>>4)-0xff0]; if (summary) { unsigned short used = summary->used; unsigned int i = wc & 0x0f; if (used & ((unsigned short) 1 << i)) { unsigned short c; /* Keep in `used' only the bits 0..i-1. */ used &= ((unsigned short) 1 << i) - 1; /* Add `summary->indx' and the number of bits set in `used'. */ used = (used & 0x5555) + ((used & 0xaaaa) >> 1); used = (used & 0x3333) + ((used & 0xcccc) >> 2); used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); used = (used & 0x00ff) + (used >> 8); c = jisx0208_2charset[summary->indx + used]; r[0] = (c >> 8); r[1] = (c & 0xff); return 2; } } return RET_ILSEQ; } return RET_TOOSMALL; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/jisx0212.h0000644000000000000000000040331713614532331017641 0ustar /* * JISX0212.1990-0 */ static const unsigned short jisx0212_2uni_page22[81] = { /* 0x22 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x02d8, 0x02c7, 0x00b8, 0x02d9, 0x02dd, 0x00af, 0x02db, 0x02da, 0x007e, 0x0384, 0x0385, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x00a1, 0x00a6, 0x00bf, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x00ba, 0x00aa, 0x00a9, 0x00ae, 0x2122, 0x00a4, 0x2116, }; static const unsigned short jisx0212_2uni_page26[188] = { /* 0x26 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0xfffd, 0x038c, 0xfffd, 0x038e, 0x03ab, 0xfffd, 0x038f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, 0x03c2, 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0xfffd, 0xfffd, /* 0x27 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x040e, 0x040f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x045e, 0x045f, }; static const unsigned short jisx0212_2uni_page29[275] = { /* 0x29 */ 0x00c6, 0x0110, 0xfffd, 0x0126, 0xfffd, 0x0132, 0xfffd, 0x0141, 0x013f, 0xfffd, 0x014a, 0x00d8, 0x0152, 0xfffd, 0x0166, 0x00de, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x00e6, 0x0111, 0x00f0, 0x0127, 0x0131, 0x0133, 0x0138, 0x0142, 0x0140, 0x0149, 0x014b, 0x00f8, 0x0153, 0x00df, 0x0167, 0x00fe, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x2a */ 0x00c1, 0x00c0, 0x00c4, 0x00c2, 0x0102, 0x01cd, 0x0100, 0x0104, 0x00c5, 0x00c3, 0x0106, 0x0108, 0x010c, 0x00c7, 0x010a, 0x010e, 0x00c9, 0x00c8, 0x00cb, 0x00ca, 0x011a, 0x0116, 0x0112, 0x0118, 0xfffd, 0x011c, 0x011e, 0x0122, 0x0120, 0x0124, 0x00cd, 0x00cc, 0x00cf, 0x00ce, 0x01cf, 0x0130, 0x012a, 0x012e, 0x0128, 0x0134, 0x0136, 0x0139, 0x013d, 0x013b, 0x0143, 0x0147, 0x0145, 0x00d1, 0x00d3, 0x00d2, 0x00d6, 0x00d4, 0x01d1, 0x0150, 0x014c, 0x00d5, 0x0154, 0x0158, 0x0156, 0x015a, 0x015c, 0x0160, 0x015e, 0x0164, 0x0162, 0x00da, 0x00d9, 0x00dc, 0x00db, 0x016c, 0x01d3, 0x0170, 0x016a, 0x0172, 0x016e, 0x0168, 0x01d7, 0x01db, 0x01d9, 0x01d5, 0x0174, 0x00dd, 0x0178, 0x0176, 0x0179, 0x017d, 0x017b, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x2b */ 0x00e1, 0x00e0, 0x00e4, 0x00e2, 0x0103, 0x01ce, 0x0101, 0x0105, 0x00e5, 0x00e3, 0x0107, 0x0109, 0x010d, 0x00e7, 0x010b, 0x010f, 0x00e9, 0x00e8, 0x00eb, 0x00ea, 0x011b, 0x0117, 0x0113, 0x0119, 0x01f5, 0x011d, 0x011f, 0xfffd, 0x0121, 0x0125, 0x00ed, 0x00ec, 0x00ef, 0x00ee, 0x01d0, 0xfffd, 0x012b, 0x012f, 0x0129, 0x0135, 0x0137, 0x013a, 0x013e, 0x013c, 0x0144, 0x0148, 0x0146, 0x00f1, 0x00f3, 0x00f2, 0x00f6, 0x00f4, 0x01d2, 0x0151, 0x014d, 0x00f5, 0x0155, 0x0159, 0x0157, 0x015b, 0x015d, 0x0161, 0x015f, 0x0165, 0x0163, 0x00fa, 0x00f9, 0x00fc, 0x00fb, 0x016d, 0x01d4, 0x0171, 0x016b, 0x0173, 0x016f, 0x0169, 0x01d8, 0x01dc, 0x01da, 0x01d6, 0x0175, 0x00fd, 0x00ff, 0x0177, 0x017a, 0x017e, 0x017c, }; static const unsigned short jisx0212_2uni_page30[5801] = { /* 0x30 */ 0x4e02, 0x4e04, 0x4e05, 0x4e0c, 0x4e12, 0x4e1f, 0x4e23, 0x4e24, 0x4e28, 0x4e2b, 0x4e2e, 0x4e2f, 0x4e30, 0x4e35, 0x4e40, 0x4e41, 0x4e44, 0x4e47, 0x4e51, 0x4e5a, 0x4e5c, 0x4e63, 0x4e68, 0x4e69, 0x4e74, 0x4e75, 0x4e79, 0x4e7f, 0x4e8d, 0x4e96, 0x4e97, 0x4e9d, 0x4eaf, 0x4eb9, 0x4ec3, 0x4ed0, 0x4eda, 0x4edb, 0x4ee0, 0x4ee1, 0x4ee2, 0x4ee8, 0x4eef, 0x4ef1, 0x4ef3, 0x4ef5, 0x4efd, 0x4efe, 0x4eff, 0x4f00, 0x4f02, 0x4f03, 0x4f08, 0x4f0b, 0x4f0c, 0x4f12, 0x4f15, 0x4f16, 0x4f17, 0x4f19, 0x4f2e, 0x4f31, 0x4f60, 0x4f33, 0x4f35, 0x4f37, 0x4f39, 0x4f3b, 0x4f3e, 0x4f40, 0x4f42, 0x4f48, 0x4f49, 0x4f4b, 0x4f4c, 0x4f52, 0x4f54, 0x4f56, 0x4f58, 0x4f5f, 0x4f63, 0x4f6a, 0x4f6c, 0x4f6e, 0x4f71, 0x4f77, 0x4f78, 0x4f79, 0x4f7a, 0x4f7d, 0x4f7e, 0x4f81, 0x4f82, 0x4f84, /* 0x31 */ 0x4f85, 0x4f89, 0x4f8a, 0x4f8c, 0x4f8e, 0x4f90, 0x4f92, 0x4f93, 0x4f94, 0x4f97, 0x4f99, 0x4f9a, 0x4f9e, 0x4f9f, 0x4fb2, 0x4fb7, 0x4fb9, 0x4fbb, 0x4fbc, 0x4fbd, 0x4fbe, 0x4fc0, 0x4fc1, 0x4fc5, 0x4fc6, 0x4fc8, 0x4fc9, 0x4fcb, 0x4fcc, 0x4fcd, 0x4fcf, 0x4fd2, 0x4fdc, 0x4fe0, 0x4fe2, 0x4ff0, 0x4ff2, 0x4ffc, 0x4ffd, 0x4fff, 0x5000, 0x5001, 0x5004, 0x5007, 0x500a, 0x500c, 0x500e, 0x5010, 0x5013, 0x5017, 0x5018, 0x501b, 0x501c, 0x501d, 0x501e, 0x5022, 0x5027, 0x502e, 0x5030, 0x5032, 0x5033, 0x5035, 0x5040, 0x5041, 0x5042, 0x5045, 0x5046, 0x504a, 0x504c, 0x504e, 0x5051, 0x5052, 0x5053, 0x5057, 0x5059, 0x505f, 0x5060, 0x5062, 0x5063, 0x5066, 0x5067, 0x506a, 0x506d, 0x5070, 0x5071, 0x503b, 0x5081, 0x5083, 0x5084, 0x5086, 0x508a, 0x508e, 0x508f, 0x5090, /* 0x32 */ 0x5092, 0x5093, 0x5094, 0x5096, 0x509b, 0x509c, 0x509e, 0x509f, 0x50a0, 0x50a1, 0x50a2, 0x50aa, 0x50af, 0x50b0, 0x50b9, 0x50ba, 0x50bd, 0x50c0, 0x50c3, 0x50c4, 0x50c7, 0x50cc, 0x50ce, 0x50d0, 0x50d3, 0x50d4, 0x50d8, 0x50dc, 0x50dd, 0x50df, 0x50e2, 0x50e4, 0x50e6, 0x50e8, 0x50e9, 0x50ef, 0x50f1, 0x50f6, 0x50fa, 0x50fe, 0x5103, 0x5106, 0x5107, 0x5108, 0x510b, 0x510c, 0x510d, 0x510e, 0x50f2, 0x5110, 0x5117, 0x5119, 0x511b, 0x511c, 0x511d, 0x511e, 0x5123, 0x5127, 0x5128, 0x512c, 0x512d, 0x512f, 0x5131, 0x5133, 0x5134, 0x5135, 0x5138, 0x5139, 0x5142, 0x514a, 0x514f, 0x5153, 0x5155, 0x5157, 0x5158, 0x515f, 0x5164, 0x5166, 0x517e, 0x5183, 0x5184, 0x518b, 0x518e, 0x5198, 0x519d, 0x51a1, 0x51a3, 0x51ad, 0x51b8, 0x51ba, 0x51bc, 0x51be, 0x51bf, 0x51c2, /* 0x33 */ 0x51c8, 0x51cf, 0x51d1, 0x51d2, 0x51d3, 0x51d5, 0x51d8, 0x51de, 0x51e2, 0x51e5, 0x51ee, 0x51f2, 0x51f3, 0x51f4, 0x51f7, 0x5201, 0x5202, 0x5205, 0x5212, 0x5213, 0x5215, 0x5216, 0x5218, 0x5222, 0x5228, 0x5231, 0x5232, 0x5235, 0x523c, 0x5245, 0x5249, 0x5255, 0x5257, 0x5258, 0x525a, 0x525c, 0x525f, 0x5260, 0x5261, 0x5266, 0x526e, 0x5277, 0x5278, 0x5279, 0x5280, 0x5282, 0x5285, 0x528a, 0x528c, 0x5293, 0x5295, 0x5296, 0x5297, 0x5298, 0x529a, 0x529c, 0x52a4, 0x52a5, 0x52a6, 0x52a7, 0x52af, 0x52b0, 0x52b6, 0x52b7, 0x52b8, 0x52ba, 0x52bb, 0x52bd, 0x52c0, 0x52c4, 0x52c6, 0x52c8, 0x52cc, 0x52cf, 0x52d1, 0x52d4, 0x52d6, 0x52db, 0x52dc, 0x52e1, 0x52e5, 0x52e8, 0x52e9, 0x52ea, 0x52ec, 0x52f0, 0x52f1, 0x52f4, 0x52f6, 0x52f7, 0x5300, 0x5303, 0x530a, 0x530b, /* 0x34 */ 0x530c, 0x5311, 0x5313, 0x5318, 0x531b, 0x531c, 0x531e, 0x531f, 0x5325, 0x5327, 0x5328, 0x5329, 0x532b, 0x532c, 0x532d, 0x5330, 0x5332, 0x5335, 0x533c, 0x533d, 0x533e, 0x5342, 0x534c, 0x534b, 0x5359, 0x535b, 0x5361, 0x5363, 0x5365, 0x536c, 0x536d, 0x5372, 0x5379, 0x537e, 0x5383, 0x5387, 0x5388, 0x538e, 0x5393, 0x5394, 0x5399, 0x539d, 0x53a1, 0x53a4, 0x53aa, 0x53ab, 0x53af, 0x53b2, 0x53b4, 0x53b5, 0x53b7, 0x53b8, 0x53ba, 0x53bd, 0x53c0, 0x53c5, 0x53cf, 0x53d2, 0x53d3, 0x53d5, 0x53da, 0x53dd, 0x53de, 0x53e0, 0x53e6, 0x53e7, 0x53f5, 0x5402, 0x5413, 0x541a, 0x5421, 0x5427, 0x5428, 0x542a, 0x542f, 0x5431, 0x5434, 0x5435, 0x5443, 0x5444, 0x5447, 0x544d, 0x544f, 0x545e, 0x5462, 0x5464, 0x5466, 0x5467, 0x5469, 0x546b, 0x546d, 0x546e, 0x5474, 0x547f, /* 0x35 */ 0x5481, 0x5483, 0x5485, 0x5488, 0x5489, 0x548d, 0x5491, 0x5495, 0x5496, 0x549c, 0x549f, 0x54a1, 0x54a6, 0x54a7, 0x54a9, 0x54aa, 0x54ad, 0x54ae, 0x54b1, 0x54b7, 0x54b9, 0x54ba, 0x54bb, 0x54bf, 0x54c6, 0x54ca, 0x54cd, 0x54ce, 0x54e0, 0x54ea, 0x54ec, 0x54ef, 0x54f6, 0x54fc, 0x54fe, 0x54ff, 0x5500, 0x5501, 0x5505, 0x5508, 0x5509, 0x550c, 0x550d, 0x550e, 0x5515, 0x552a, 0x552b, 0x5532, 0x5535, 0x5536, 0x553b, 0x553c, 0x553d, 0x5541, 0x5547, 0x5549, 0x554a, 0x554d, 0x5550, 0x5551, 0x5558, 0x555a, 0x555b, 0x555e, 0x5560, 0x5561, 0x5564, 0x5566, 0x557f, 0x5581, 0x5582, 0x5586, 0x5588, 0x558e, 0x558f, 0x5591, 0x5592, 0x5593, 0x5594, 0x5597, 0x55a3, 0x55a4, 0x55ad, 0x55b2, 0x55bf, 0x55c1, 0x55c3, 0x55c6, 0x55c9, 0x55cb, 0x55cc, 0x55ce, 0x55d1, 0x55d2, /* 0x36 */ 0x55d3, 0x55d7, 0x55d8, 0x55db, 0x55de, 0x55e2, 0x55e9, 0x55f6, 0x55ff, 0x5605, 0x5608, 0x560a, 0x560d, 0x560e, 0x560f, 0x5610, 0x5611, 0x5612, 0x5619, 0x562c, 0x5630, 0x5633, 0x5635, 0x5637, 0x5639, 0x563b, 0x563c, 0x563d, 0x563f, 0x5640, 0x5641, 0x5643, 0x5644, 0x5646, 0x5649, 0x564b, 0x564d, 0x564f, 0x5654, 0x565e, 0x5660, 0x5661, 0x5662, 0x5663, 0x5666, 0x5669, 0x566d, 0x566f, 0x5671, 0x5672, 0x5675, 0x5684, 0x5685, 0x5688, 0x568b, 0x568c, 0x5695, 0x5699, 0x569a, 0x569d, 0x569e, 0x569f, 0x56a6, 0x56a7, 0x56a8, 0x56a9, 0x56ab, 0x56ac, 0x56ad, 0x56b1, 0x56b3, 0x56b7, 0x56be, 0x56c5, 0x56c9, 0x56ca, 0x56cb, 0x56cf, 0x56d0, 0x56cc, 0x56cd, 0x56d9, 0x56dc, 0x56dd, 0x56df, 0x56e1, 0x56e4, 0x56e5, 0x56e6, 0x56e7, 0x56e8, 0x56f1, 0x56eb, 0x56ed, /* 0x37 */ 0x56f6, 0x56f7, 0x5701, 0x5702, 0x5707, 0x570a, 0x570c, 0x5711, 0x5715, 0x571a, 0x571b, 0x571d, 0x5720, 0x5722, 0x5723, 0x5724, 0x5725, 0x5729, 0x572a, 0x572c, 0x572e, 0x572f, 0x5733, 0x5734, 0x573d, 0x573e, 0x573f, 0x5745, 0x5746, 0x574c, 0x574d, 0x5752, 0x5762, 0x5765, 0x5767, 0x5768, 0x576b, 0x576d, 0x576e, 0x576f, 0x5770, 0x5771, 0x5773, 0x5774, 0x5775, 0x5777, 0x5779, 0x577a, 0x577b, 0x577c, 0x577e, 0x5781, 0x5783, 0x578c, 0x5794, 0x5797, 0x5799, 0x579a, 0x579c, 0x579d, 0x579e, 0x579f, 0x57a1, 0x5795, 0x57a7, 0x57a8, 0x57a9, 0x57ac, 0x57b8, 0x57bd, 0x57c7, 0x57c8, 0x57cc, 0x57cf, 0x57d5, 0x57dd, 0x57de, 0x57e4, 0x57e6, 0x57e7, 0x57e9, 0x57ed, 0x57f0, 0x57f5, 0x57f6, 0x57f8, 0x57fd, 0x57fe, 0x57ff, 0x5803, 0x5804, 0x5808, 0x5809, 0x57e1, /* 0x38 */ 0x580c, 0x580d, 0x581b, 0x581e, 0x581f, 0x5820, 0x5826, 0x5827, 0x582d, 0x5832, 0x5839, 0x583f, 0x5849, 0x584c, 0x584d, 0x584f, 0x5850, 0x5855, 0x585f, 0x5861, 0x5864, 0x5867, 0x5868, 0x5878, 0x587c, 0x587f, 0x5880, 0x5881, 0x5887, 0x5888, 0x5889, 0x588a, 0x588c, 0x588d, 0x588f, 0x5890, 0x5894, 0x5896, 0x589d, 0x58a0, 0x58a1, 0x58a2, 0x58a6, 0x58a9, 0x58b1, 0x58b2, 0x58c4, 0x58bc, 0x58c2, 0x58c8, 0x58cd, 0x58ce, 0x58d0, 0x58d2, 0x58d4, 0x58d6, 0x58da, 0x58dd, 0x58e1, 0x58e2, 0x58e9, 0x58f3, 0x5905, 0x5906, 0x590b, 0x590c, 0x5912, 0x5913, 0x5914, 0x8641, 0x591d, 0x5921, 0x5923, 0x5924, 0x5928, 0x592f, 0x5930, 0x5933, 0x5935, 0x5936, 0x593f, 0x5943, 0x5946, 0x5952, 0x5953, 0x5959, 0x595b, 0x595d, 0x595e, 0x595f, 0x5961, 0x5963, 0x596b, 0x596d, /* 0x39 */ 0x596f, 0x5972, 0x5975, 0x5976, 0x5979, 0x597b, 0x597c, 0x598b, 0x598c, 0x598e, 0x5992, 0x5995, 0x5997, 0x599f, 0x59a4, 0x59a7, 0x59ad, 0x59ae, 0x59af, 0x59b0, 0x59b3, 0x59b7, 0x59ba, 0x59bc, 0x59c1, 0x59c3, 0x59c4, 0x59c8, 0x59ca, 0x59cd, 0x59d2, 0x59dd, 0x59de, 0x59df, 0x59e3, 0x59e4, 0x59e7, 0x59ee, 0x59ef, 0x59f1, 0x59f2, 0x59f4, 0x59f7, 0x5a00, 0x5a04, 0x5a0c, 0x5a0d, 0x5a0e, 0x5a12, 0x5a13, 0x5a1e, 0x5a23, 0x5a24, 0x5a27, 0x5a28, 0x5a2a, 0x5a2d, 0x5a30, 0x5a44, 0x5a45, 0x5a47, 0x5a48, 0x5a4c, 0x5a50, 0x5a55, 0x5a5e, 0x5a63, 0x5a65, 0x5a67, 0x5a6d, 0x5a77, 0x5a7a, 0x5a7b, 0x5a7e, 0x5a8b, 0x5a90, 0x5a93, 0x5a96, 0x5a99, 0x5a9c, 0x5a9e, 0x5a9f, 0x5aa0, 0x5aa2, 0x5aa7, 0x5aac, 0x5ab1, 0x5ab2, 0x5ab3, 0x5ab5, 0x5ab8, 0x5aba, 0x5abb, 0x5abf, /* 0x3a */ 0x5ac4, 0x5ac6, 0x5ac8, 0x5acf, 0x5ada, 0x5adc, 0x5ae0, 0x5ae5, 0x5aea, 0x5aee, 0x5af5, 0x5af6, 0x5afd, 0x5b00, 0x5b01, 0x5b08, 0x5b17, 0x5b34, 0x5b19, 0x5b1b, 0x5b1d, 0x5b21, 0x5b25, 0x5b2d, 0x5b38, 0x5b41, 0x5b4b, 0x5b4c, 0x5b52, 0x5b56, 0x5b5e, 0x5b68, 0x5b6e, 0x5b6f, 0x5b7c, 0x5b7d, 0x5b7e, 0x5b7f, 0x5b81, 0x5b84, 0x5b86, 0x5b8a, 0x5b8e, 0x5b90, 0x5b91, 0x5b93, 0x5b94, 0x5b96, 0x5ba8, 0x5ba9, 0x5bac, 0x5bad, 0x5baf, 0x5bb1, 0x5bb2, 0x5bb7, 0x5bba, 0x5bbc, 0x5bc0, 0x5bc1, 0x5bcd, 0x5bcf, 0x5bd6, 0x5bd7, 0x5bd8, 0x5bd9, 0x5bda, 0x5be0, 0x5bef, 0x5bf1, 0x5bf4, 0x5bfd, 0x5c0c, 0x5c17, 0x5c1e, 0x5c1f, 0x5c23, 0x5c26, 0x5c29, 0x5c2b, 0x5c2c, 0x5c2e, 0x5c30, 0x5c32, 0x5c35, 0x5c36, 0x5c59, 0x5c5a, 0x5c5c, 0x5c62, 0x5c63, 0x5c67, 0x5c68, 0x5c69, /* 0x3b */ 0x5c6d, 0x5c70, 0x5c74, 0x5c75, 0x5c7a, 0x5c7b, 0x5c7c, 0x5c7d, 0x5c87, 0x5c88, 0x5c8a, 0x5c8f, 0x5c92, 0x5c9d, 0x5c9f, 0x5ca0, 0x5ca2, 0x5ca3, 0x5ca6, 0x5caa, 0x5cb2, 0x5cb4, 0x5cb5, 0x5cba, 0x5cc9, 0x5ccb, 0x5cd2, 0x5cdd, 0x5cd7, 0x5cee, 0x5cf1, 0x5cf2, 0x5cf4, 0x5d01, 0x5d06, 0x5d0d, 0x5d12, 0x5d2b, 0x5d23, 0x5d24, 0x5d26, 0x5d27, 0x5d31, 0x5d34, 0x5d39, 0x5d3d, 0x5d3f, 0x5d42, 0x5d43, 0x5d46, 0x5d48, 0x5d55, 0x5d51, 0x5d59, 0x5d4a, 0x5d5f, 0x5d60, 0x5d61, 0x5d62, 0x5d64, 0x5d6a, 0x5d6d, 0x5d70, 0x5d79, 0x5d7a, 0x5d7e, 0x5d7f, 0x5d81, 0x5d83, 0x5d88, 0x5d8a, 0x5d92, 0x5d93, 0x5d94, 0x5d95, 0x5d99, 0x5d9b, 0x5d9f, 0x5da0, 0x5da7, 0x5dab, 0x5db0, 0x5db4, 0x5db8, 0x5db9, 0x5dc3, 0x5dc7, 0x5dcb, 0x5dd0, 0x5dce, 0x5dd8, 0x5dd9, 0x5de0, 0x5de4, /* 0x3c */ 0x5de9, 0x5df8, 0x5df9, 0x5e00, 0x5e07, 0x5e0d, 0x5e12, 0x5e14, 0x5e15, 0x5e18, 0x5e1f, 0x5e20, 0x5e2e, 0x5e28, 0x5e32, 0x5e35, 0x5e3e, 0x5e4b, 0x5e50, 0x5e49, 0x5e51, 0x5e56, 0x5e58, 0x5e5b, 0x5e5c, 0x5e5e, 0x5e68, 0x5e6a, 0x5e6b, 0x5e6c, 0x5e6d, 0x5e6e, 0x5e70, 0x5e80, 0x5e8b, 0x5e8e, 0x5ea2, 0x5ea4, 0x5ea5, 0x5ea8, 0x5eaa, 0x5eac, 0x5eb1, 0x5eb3, 0x5ebd, 0x5ebe, 0x5ebf, 0x5ec6, 0x5ecc, 0x5ecb, 0x5ece, 0x5ed1, 0x5ed2, 0x5ed4, 0x5ed5, 0x5edc, 0x5ede, 0x5ee5, 0x5eeb, 0x5f02, 0x5f06, 0x5f07, 0x5f08, 0x5f0e, 0x5f19, 0x5f1c, 0x5f1d, 0x5f21, 0x5f22, 0x5f23, 0x5f24, 0x5f28, 0x5f2b, 0x5f2c, 0x5f2e, 0x5f30, 0x5f34, 0x5f36, 0x5f3b, 0x5f3d, 0x5f3f, 0x5f40, 0x5f44, 0x5f45, 0x5f47, 0x5f4d, 0x5f50, 0x5f54, 0x5f58, 0x5f5b, 0x5f60, 0x5f63, 0x5f64, 0x5f67, /* 0x3d */ 0x5f6f, 0x5f72, 0x5f74, 0x5f75, 0x5f78, 0x5f7a, 0x5f7d, 0x5f7e, 0x5f89, 0x5f8d, 0x5f8f, 0x5f96, 0x5f9c, 0x5f9d, 0x5fa2, 0x5fa7, 0x5fab, 0x5fa4, 0x5fac, 0x5faf, 0x5fb0, 0x5fb1, 0x5fb8, 0x5fc4, 0x5fc7, 0x5fc8, 0x5fc9, 0x5fcb, 0x5fd0, 0x5fd1, 0x5fd2, 0x5fd3, 0x5fd4, 0x5fde, 0x5fe1, 0x5fe2, 0x5fe8, 0x5fe9, 0x5fea, 0x5fec, 0x5fed, 0x5fee, 0x5fef, 0x5ff2, 0x5ff3, 0x5ff6, 0x5ffa, 0x5ffc, 0x6007, 0x600a, 0x600d, 0x6013, 0x6014, 0x6017, 0x6018, 0x601a, 0x601f, 0x6024, 0x602d, 0x6033, 0x6035, 0x6040, 0x6047, 0x6048, 0x6049, 0x604c, 0x6051, 0x6054, 0x6056, 0x6057, 0x605d, 0x6061, 0x6067, 0x6071, 0x607e, 0x607f, 0x6082, 0x6086, 0x6088, 0x608a, 0x608e, 0x6091, 0x6093, 0x6095, 0x6098, 0x609d, 0x609e, 0x60a2, 0x60a4, 0x60a5, 0x60a8, 0x60b0, 0x60b1, 0x60b7, /* 0x3e */ 0x60bb, 0x60be, 0x60c2, 0x60c4, 0x60c8, 0x60c9, 0x60ca, 0x60cb, 0x60ce, 0x60cf, 0x60d4, 0x60d5, 0x60d9, 0x60db, 0x60dd, 0x60de, 0x60e2, 0x60e5, 0x60f2, 0x60f5, 0x60f8, 0x60fc, 0x60fd, 0x6102, 0x6107, 0x610a, 0x610c, 0x6110, 0x6111, 0x6112, 0x6113, 0x6114, 0x6116, 0x6117, 0x6119, 0x611c, 0x611e, 0x6122, 0x612a, 0x612b, 0x6130, 0x6131, 0x6135, 0x6136, 0x6137, 0x6139, 0x6141, 0x6145, 0x6146, 0x6149, 0x615e, 0x6160, 0x616c, 0x6172, 0x6178, 0x617b, 0x617c, 0x617f, 0x6180, 0x6181, 0x6183, 0x6184, 0x618b, 0x618d, 0x6192, 0x6193, 0x6197, 0x6198, 0x619c, 0x619d, 0x619f, 0x61a0, 0x61a5, 0x61a8, 0x61aa, 0x61ad, 0x61b8, 0x61b9, 0x61bc, 0x61c0, 0x61c1, 0x61c2, 0x61ce, 0x61cf, 0x61d5, 0x61dc, 0x61dd, 0x61de, 0x61df, 0x61e1, 0x61e2, 0x61e7, 0x61e9, 0x61e5, /* 0x3f */ 0x61ec, 0x61ed, 0x61ef, 0x6201, 0x6203, 0x6204, 0x6207, 0x6213, 0x6215, 0x621c, 0x6220, 0x6222, 0x6223, 0x6227, 0x6229, 0x622b, 0x6239, 0x623d, 0x6242, 0x6243, 0x6244, 0x6246, 0x624c, 0x6250, 0x6251, 0x6252, 0x6254, 0x6256, 0x625a, 0x625c, 0x6264, 0x626d, 0x626f, 0x6273, 0x627a, 0x627d, 0x628d, 0x628e, 0x628f, 0x6290, 0x62a6, 0x62a8, 0x62b3, 0x62b6, 0x62b7, 0x62ba, 0x62be, 0x62bf, 0x62c4, 0x62ce, 0x62d5, 0x62d6, 0x62da, 0x62ea, 0x62f2, 0x62f4, 0x62fc, 0x62fd, 0x6303, 0x6304, 0x630a, 0x630b, 0x630d, 0x6310, 0x6313, 0x6316, 0x6318, 0x6329, 0x632a, 0x632d, 0x6335, 0x6336, 0x6339, 0x633c, 0x6341, 0x6342, 0x6343, 0x6344, 0x6346, 0x634a, 0x634b, 0x634e, 0x6352, 0x6353, 0x6354, 0x6358, 0x635b, 0x6365, 0x6366, 0x636c, 0x636d, 0x6371, 0x6374, 0x6375, /* 0x40 */ 0x6378, 0x637c, 0x637d, 0x637f, 0x6382, 0x6384, 0x6387, 0x638a, 0x6390, 0x6394, 0x6395, 0x6399, 0x639a, 0x639e, 0x63a4, 0x63a6, 0x63ad, 0x63ae, 0x63af, 0x63bd, 0x63c1, 0x63c5, 0x63c8, 0x63ce, 0x63d1, 0x63d3, 0x63d4, 0x63d5, 0x63dc, 0x63e0, 0x63e5, 0x63ea, 0x63ec, 0x63f2, 0x63f3, 0x63f5, 0x63f8, 0x63f9, 0x6409, 0x640a, 0x6410, 0x6412, 0x6414, 0x6418, 0x641e, 0x6420, 0x6422, 0x6424, 0x6425, 0x6429, 0x642a, 0x642f, 0x6430, 0x6435, 0x643d, 0x643f, 0x644b, 0x644f, 0x6451, 0x6452, 0x6453, 0x6454, 0x645a, 0x645b, 0x645c, 0x645d, 0x645f, 0x6460, 0x6461, 0x6463, 0x646d, 0x6473, 0x6474, 0x647b, 0x647d, 0x6485, 0x6487, 0x648f, 0x6490, 0x6491, 0x6498, 0x6499, 0x649b, 0x649d, 0x649f, 0x64a1, 0x64a3, 0x64a6, 0x64a8, 0x64ac, 0x64b3, 0x64bd, 0x64be, 0x64bf, /* 0x41 */ 0x64c4, 0x64c9, 0x64ca, 0x64cb, 0x64cc, 0x64ce, 0x64d0, 0x64d1, 0x64d5, 0x64d7, 0x64e4, 0x64e5, 0x64e9, 0x64ea, 0x64ed, 0x64f0, 0x64f5, 0x64f7, 0x64fb, 0x64ff, 0x6501, 0x6504, 0x6508, 0x6509, 0x650a, 0x650f, 0x6513, 0x6514, 0x6516, 0x6519, 0x651b, 0x651e, 0x651f, 0x6522, 0x6526, 0x6529, 0x652e, 0x6531, 0x653a, 0x653c, 0x653d, 0x6543, 0x6547, 0x6549, 0x6550, 0x6552, 0x6554, 0x655f, 0x6560, 0x6567, 0x656b, 0x657a, 0x657d, 0x6581, 0x6585, 0x658a, 0x6592, 0x6595, 0x6598, 0x659d, 0x65a0, 0x65a3, 0x65a6, 0x65ae, 0x65b2, 0x65b3, 0x65b4, 0x65bf, 0x65c2, 0x65c8, 0x65c9, 0x65ce, 0x65d0, 0x65d4, 0x65d6, 0x65d8, 0x65df, 0x65f0, 0x65f2, 0x65f4, 0x65f5, 0x65f9, 0x65fe, 0x65ff, 0x6600, 0x6604, 0x6608, 0x6609, 0x660d, 0x6611, 0x6612, 0x6615, 0x6616, 0x661d, /* 0x42 */ 0x661e, 0x6621, 0x6622, 0x6623, 0x6624, 0x6626, 0x6629, 0x662a, 0x662b, 0x662c, 0x662e, 0x6630, 0x6631, 0x6633, 0x6639, 0x6637, 0x6640, 0x6645, 0x6646, 0x664a, 0x664c, 0x6651, 0x664e, 0x6657, 0x6658, 0x6659, 0x665b, 0x665c, 0x6660, 0x6661, 0x66fb, 0x666a, 0x666b, 0x666c, 0x667e, 0x6673, 0x6675, 0x667f, 0x6677, 0x6678, 0x6679, 0x667b, 0x6680, 0x667c, 0x668b, 0x668c, 0x668d, 0x6690, 0x6692, 0x6699, 0x669a, 0x669b, 0x669c, 0x669f, 0x66a0, 0x66a4, 0x66ad, 0x66b1, 0x66b2, 0x66b5, 0x66bb, 0x66bf, 0x66c0, 0x66c2, 0x66c3, 0x66c8, 0x66cc, 0x66ce, 0x66cf, 0x66d4, 0x66db, 0x66df, 0x66e8, 0x66eb, 0x66ec, 0x66ee, 0x66fa, 0x6705, 0x6707, 0x670e, 0x6713, 0x6719, 0x671c, 0x6720, 0x6722, 0x6733, 0x673e, 0x6745, 0x6747, 0x6748, 0x674c, 0x6754, 0x6755, 0x675d, /* 0x43 */ 0x6766, 0x676c, 0x676e, 0x6774, 0x6776, 0x677b, 0x6781, 0x6784, 0x678e, 0x678f, 0x6791, 0x6793, 0x6796, 0x6798, 0x6799, 0x679b, 0x67b0, 0x67b1, 0x67b2, 0x67b5, 0x67bb, 0x67bc, 0x67bd, 0x67f9, 0x67c0, 0x67c2, 0x67c3, 0x67c5, 0x67c8, 0x67c9, 0x67d2, 0x67d7, 0x67d9, 0x67dc, 0x67e1, 0x67e6, 0x67f0, 0x67f2, 0x67f6, 0x67f7, 0x6852, 0x6814, 0x6819, 0x681d, 0x681f, 0x6828, 0x6827, 0x682c, 0x682d, 0x682f, 0x6830, 0x6831, 0x6833, 0x683b, 0x683f, 0x6844, 0x6845, 0x684a, 0x684c, 0x6855, 0x6857, 0x6858, 0x685b, 0x686b, 0x686e, 0x686f, 0x6870, 0x6871, 0x6872, 0x6875, 0x6879, 0x687a, 0x687b, 0x687c, 0x6882, 0x6884, 0x6886, 0x6888, 0x6896, 0x6898, 0x689a, 0x689c, 0x68a1, 0x68a3, 0x68a5, 0x68a9, 0x68aa, 0x68ae, 0x68b2, 0x68bb, 0x68c5, 0x68c8, 0x68cc, 0x68cf, /* 0x44 */ 0x68d0, 0x68d1, 0x68d3, 0x68d6, 0x68d9, 0x68dc, 0x68dd, 0x68e5, 0x68e8, 0x68ea, 0x68eb, 0x68ec, 0x68ed, 0x68f0, 0x68f1, 0x68f5, 0x68f6, 0x68fb, 0x68fc, 0x68fd, 0x6906, 0x6909, 0x690a, 0x6910, 0x6911, 0x6913, 0x6916, 0x6917, 0x6931, 0x6933, 0x6935, 0x6938, 0x693b, 0x6942, 0x6945, 0x6949, 0x694e, 0x6957, 0x695b, 0x6963, 0x6964, 0x6965, 0x6966, 0x6968, 0x6969, 0x696c, 0x6970, 0x6971, 0x6972, 0x697a, 0x697b, 0x697f, 0x6980, 0x698d, 0x6992, 0x6996, 0x6998, 0x69a1, 0x69a5, 0x69a6, 0x69a8, 0x69ab, 0x69ad, 0x69af, 0x69b7, 0x69b8, 0x69ba, 0x69bc, 0x69c5, 0x69c8, 0x69d1, 0x69d6, 0x69d7, 0x69e2, 0x69e5, 0x69ee, 0x69ef, 0x69f1, 0x69f3, 0x69f5, 0x69fe, 0x6a00, 0x6a01, 0x6a03, 0x6a0f, 0x6a11, 0x6a15, 0x6a1a, 0x6a1d, 0x6a20, 0x6a24, 0x6a28, 0x6a30, 0x6a32, /* 0x45 */ 0x6a34, 0x6a37, 0x6a3b, 0x6a3e, 0x6a3f, 0x6a45, 0x6a46, 0x6a49, 0x6a4a, 0x6a4e, 0x6a50, 0x6a51, 0x6a52, 0x6a55, 0x6a56, 0x6a5b, 0x6a64, 0x6a67, 0x6a6a, 0x6a71, 0x6a73, 0x6a7e, 0x6a81, 0x6a83, 0x6a86, 0x6a87, 0x6a89, 0x6a8b, 0x6a91, 0x6a9b, 0x6a9d, 0x6a9e, 0x6a9f, 0x6aa5, 0x6aab, 0x6aaf, 0x6ab0, 0x6ab1, 0x6ab4, 0x6abd, 0x6abe, 0x6abf, 0x6ac6, 0x6ac9, 0x6ac8, 0x6acc, 0x6ad0, 0x6ad4, 0x6ad5, 0x6ad6, 0x6adc, 0x6add, 0x6ae4, 0x6ae7, 0x6aec, 0x6af0, 0x6af1, 0x6af2, 0x6afc, 0x6afd, 0x6b02, 0x6b03, 0x6b06, 0x6b07, 0x6b09, 0x6b0f, 0x6b10, 0x6b11, 0x6b17, 0x6b1b, 0x6b1e, 0x6b24, 0x6b28, 0x6b2b, 0x6b2c, 0x6b2f, 0x6b35, 0x6b36, 0x6b3b, 0x6b3f, 0x6b46, 0x6b4a, 0x6b4d, 0x6b52, 0x6b56, 0x6b58, 0x6b5d, 0x6b60, 0x6b67, 0x6b6b, 0x6b6e, 0x6b70, 0x6b75, 0x6b7d, /* 0x46 */ 0x6b7e, 0x6b82, 0x6b85, 0x6b97, 0x6b9b, 0x6b9f, 0x6ba0, 0x6ba2, 0x6ba3, 0x6ba8, 0x6ba9, 0x6bac, 0x6bad, 0x6bae, 0x6bb0, 0x6bb8, 0x6bb9, 0x6bbd, 0x6bbe, 0x6bc3, 0x6bc4, 0x6bc9, 0x6bcc, 0x6bd6, 0x6bda, 0x6be1, 0x6be3, 0x6be6, 0x6be7, 0x6bee, 0x6bf1, 0x6bf7, 0x6bf9, 0x6bff, 0x6c02, 0x6c04, 0x6c05, 0x6c09, 0x6c0d, 0x6c0e, 0x6c10, 0x6c12, 0x6c19, 0x6c1f, 0x6c26, 0x6c27, 0x6c28, 0x6c2c, 0x6c2e, 0x6c33, 0x6c35, 0x6c36, 0x6c3a, 0x6c3b, 0x6c3f, 0x6c4a, 0x6c4b, 0x6c4d, 0x6c4f, 0x6c52, 0x6c54, 0x6c59, 0x6c5b, 0x6c5c, 0x6c6b, 0x6c6d, 0x6c6f, 0x6c74, 0x6c76, 0x6c78, 0x6c79, 0x6c7b, 0x6c85, 0x6c86, 0x6c87, 0x6c89, 0x6c94, 0x6c95, 0x6c97, 0x6c98, 0x6c9c, 0x6c9f, 0x6cb0, 0x6cb2, 0x6cb4, 0x6cc2, 0x6cc6, 0x6ccd, 0x6ccf, 0x6cd0, 0x6cd1, 0x6cd2, 0x6cd4, 0x6cd6, /* 0x47 */ 0x6cda, 0x6cdc, 0x6ce0, 0x6ce7, 0x6ce9, 0x6ceb, 0x6cec, 0x6cee, 0x6cf2, 0x6cf4, 0x6d04, 0x6d07, 0x6d0a, 0x6d0e, 0x6d0f, 0x6d11, 0x6d13, 0x6d1a, 0x6d26, 0x6d27, 0x6d28, 0x6c67, 0x6d2e, 0x6d2f, 0x6d31, 0x6d39, 0x6d3c, 0x6d3f, 0x6d57, 0x6d5e, 0x6d5f, 0x6d61, 0x6d65, 0x6d67, 0x6d6f, 0x6d70, 0x6d7c, 0x6d82, 0x6d87, 0x6d91, 0x6d92, 0x6d94, 0x6d96, 0x6d97, 0x6d98, 0x6daa, 0x6dac, 0x6db4, 0x6db7, 0x6db9, 0x6dbd, 0x6dbf, 0x6dc4, 0x6dc8, 0x6dca, 0x6dce, 0x6dcf, 0x6dd6, 0x6ddb, 0x6ddd, 0x6ddf, 0x6de0, 0x6de2, 0x6de5, 0x6de9, 0x6def, 0x6df0, 0x6df4, 0x6df6, 0x6dfc, 0x6e00, 0x6e04, 0x6e1e, 0x6e22, 0x6e27, 0x6e32, 0x6e36, 0x6e39, 0x6e3b, 0x6e3c, 0x6e44, 0x6e45, 0x6e48, 0x6e49, 0x6e4b, 0x6e4f, 0x6e51, 0x6e52, 0x6e53, 0x6e54, 0x6e57, 0x6e5c, 0x6e5d, 0x6e5e, /* 0x48 */ 0x6e62, 0x6e63, 0x6e68, 0x6e73, 0x6e7b, 0x6e7d, 0x6e8d, 0x6e93, 0x6e99, 0x6ea0, 0x6ea7, 0x6ead, 0x6eae, 0x6eb1, 0x6eb3, 0x6ebb, 0x6ebf, 0x6ec0, 0x6ec1, 0x6ec3, 0x6ec7, 0x6ec8, 0x6eca, 0x6ecd, 0x6ece, 0x6ecf, 0x6eeb, 0x6eed, 0x6eee, 0x6ef9, 0x6efb, 0x6efd, 0x6f04, 0x6f08, 0x6f0a, 0x6f0c, 0x6f0d, 0x6f16, 0x6f18, 0x6f1a, 0x6f1b, 0x6f26, 0x6f29, 0x6f2a, 0x6f2f, 0x6f30, 0x6f33, 0x6f36, 0x6f3b, 0x6f3c, 0x6f2d, 0x6f4f, 0x6f51, 0x6f52, 0x6f53, 0x6f57, 0x6f59, 0x6f5a, 0x6f5d, 0x6f5e, 0x6f61, 0x6f62, 0x6f68, 0x6f6c, 0x6f7d, 0x6f7e, 0x6f83, 0x6f87, 0x6f88, 0x6f8b, 0x6f8c, 0x6f8d, 0x6f90, 0x6f92, 0x6f93, 0x6f94, 0x6f96, 0x6f9a, 0x6f9f, 0x6fa0, 0x6fa5, 0x6fa6, 0x6fa7, 0x6fa8, 0x6fae, 0x6faf, 0x6fb0, 0x6fb5, 0x6fb6, 0x6fbc, 0x6fc5, 0x6fc7, 0x6fc8, 0x6fca, /* 0x49 */ 0x6fda, 0x6fde, 0x6fe8, 0x6fe9, 0x6ff0, 0x6ff5, 0x6ff9, 0x6ffc, 0x6ffd, 0x7000, 0x7005, 0x7006, 0x7007, 0x700d, 0x7017, 0x7020, 0x7023, 0x702f, 0x7034, 0x7037, 0x7039, 0x703c, 0x7043, 0x7044, 0x7048, 0x7049, 0x704a, 0x704b, 0x7054, 0x7055, 0x705d, 0x705e, 0x704e, 0x7064, 0x7065, 0x706c, 0x706e, 0x7075, 0x7076, 0x707e, 0x7081, 0x7085, 0x7086, 0x7094, 0x7095, 0x7096, 0x7097, 0x7098, 0x709b, 0x70a4, 0x70ab, 0x70b0, 0x70b1, 0x70b4, 0x70b7, 0x70ca, 0x70d1, 0x70d3, 0x70d4, 0x70d5, 0x70d6, 0x70d8, 0x70dc, 0x70e4, 0x70fa, 0x7103, 0x7104, 0x7105, 0x7106, 0x7107, 0x710b, 0x710c, 0x710f, 0x711e, 0x7120, 0x712b, 0x712d, 0x712f, 0x7130, 0x7131, 0x7138, 0x7141, 0x7145, 0x7146, 0x7147, 0x714a, 0x714b, 0x7150, 0x7152, 0x7157, 0x715a, 0x715c, 0x715e, 0x7160, /* 0x4a */ 0x7168, 0x7179, 0x7180, 0x7185, 0x7187, 0x718c, 0x7192, 0x719a, 0x719b, 0x71a0, 0x71a2, 0x71af, 0x71b0, 0x71b2, 0x71b3, 0x71ba, 0x71bf, 0x71c0, 0x71c1, 0x71c4, 0x71cb, 0x71cc, 0x71d3, 0x71d6, 0x71d9, 0x71da, 0x71dc, 0x71f8, 0x71fe, 0x7200, 0x7207, 0x7208, 0x7209, 0x7213, 0x7217, 0x721a, 0x721d, 0x721f, 0x7224, 0x722b, 0x722f, 0x7234, 0x7238, 0x7239, 0x7241, 0x7242, 0x7243, 0x7245, 0x724e, 0x724f, 0x7250, 0x7253, 0x7255, 0x7256, 0x725a, 0x725c, 0x725e, 0x7260, 0x7263, 0x7268, 0x726b, 0x726e, 0x726f, 0x7271, 0x7277, 0x7278, 0x727b, 0x727c, 0x727f, 0x7284, 0x7289, 0x728d, 0x728e, 0x7293, 0x729b, 0x72a8, 0x72ad, 0x72ae, 0x72b1, 0x72b4, 0x72be, 0x72c1, 0x72c7, 0x72c9, 0x72cc, 0x72d5, 0x72d6, 0x72d8, 0x72df, 0x72e5, 0x72f3, 0x72f4, 0x72fa, 0x72fb, /* 0x4b */ 0x72fe, 0x7302, 0x7304, 0x7305, 0x7307, 0x730b, 0x730d, 0x7312, 0x7313, 0x7318, 0x7319, 0x731e, 0x7322, 0x7324, 0x7327, 0x7328, 0x732c, 0x7331, 0x7332, 0x7335, 0x733a, 0x733b, 0x733d, 0x7343, 0x734d, 0x7350, 0x7352, 0x7356, 0x7358, 0x735d, 0x735e, 0x735f, 0x7360, 0x7366, 0x7367, 0x7369, 0x736b, 0x736c, 0x736e, 0x736f, 0x7371, 0x7377, 0x7379, 0x737c, 0x7380, 0x7381, 0x7383, 0x7385, 0x7386, 0x738e, 0x7390, 0x7393, 0x7395, 0x7397, 0x7398, 0x739c, 0x739e, 0x739f, 0x73a0, 0x73a2, 0x73a5, 0x73a6, 0x73aa, 0x73ab, 0x73ad, 0x73b5, 0x73b7, 0x73b9, 0x73bc, 0x73bd, 0x73bf, 0x73c5, 0x73c6, 0x73c9, 0x73cb, 0x73cc, 0x73cf, 0x73d2, 0x73d3, 0x73d6, 0x73d9, 0x73dd, 0x73e1, 0x73e3, 0x73e6, 0x73e7, 0x73e9, 0x73f4, 0x73f5, 0x73f7, 0x73f9, 0x73fa, 0x73fb, 0x73fd, /* 0x4c */ 0x73ff, 0x7400, 0x7401, 0x7404, 0x7407, 0x740a, 0x7411, 0x741a, 0x741b, 0x7424, 0x7426, 0x7428, 0x7429, 0x742a, 0x742b, 0x742c, 0x742d, 0x742e, 0x742f, 0x7430, 0x7431, 0x7439, 0x7440, 0x7443, 0x7444, 0x7446, 0x7447, 0x744b, 0x744d, 0x7451, 0x7452, 0x7457, 0x745d, 0x7462, 0x7466, 0x7467, 0x7468, 0x746b, 0x746d, 0x746e, 0x7471, 0x7472, 0x7480, 0x7481, 0x7485, 0x7486, 0x7487, 0x7489, 0x748f, 0x7490, 0x7491, 0x7492, 0x7498, 0x7499, 0x749a, 0x749c, 0x749f, 0x74a0, 0x74a1, 0x74a3, 0x74a6, 0x74a8, 0x74a9, 0x74aa, 0x74ab, 0x74ae, 0x74af, 0x74b1, 0x74b2, 0x74b5, 0x74b9, 0x74bb, 0x74bf, 0x74c8, 0x74c9, 0x74cc, 0x74d0, 0x74d3, 0x74d8, 0x74da, 0x74db, 0x74de, 0x74df, 0x74e4, 0x74e8, 0x74ea, 0x74eb, 0x74ef, 0x74f4, 0x74fa, 0x74fb, 0x74fc, 0x74ff, 0x7506, /* 0x4d */ 0x7512, 0x7516, 0x7517, 0x7520, 0x7521, 0x7524, 0x7527, 0x7529, 0x752a, 0x752f, 0x7536, 0x7539, 0x753d, 0x753e, 0x753f, 0x7540, 0x7543, 0x7547, 0x7548, 0x754e, 0x7550, 0x7552, 0x7557, 0x755e, 0x755f, 0x7561, 0x756f, 0x7571, 0x7579, 0x757a, 0x757b, 0x757c, 0x757d, 0x757e, 0x7581, 0x7585, 0x7590, 0x7592, 0x7593, 0x7595, 0x7599, 0x759c, 0x75a2, 0x75a4, 0x75b4, 0x75ba, 0x75bf, 0x75c0, 0x75c1, 0x75c4, 0x75c6, 0x75cc, 0x75ce, 0x75cf, 0x75d7, 0x75dc, 0x75df, 0x75e0, 0x75e1, 0x75e4, 0x75e7, 0x75ec, 0x75ee, 0x75ef, 0x75f1, 0x75f9, 0x7600, 0x7602, 0x7603, 0x7604, 0x7607, 0x7608, 0x760a, 0x760c, 0x760f, 0x7612, 0x7613, 0x7615, 0x7616, 0x7619, 0x761b, 0x761c, 0x761d, 0x761e, 0x7623, 0x7625, 0x7626, 0x7629, 0x762d, 0x7632, 0x7633, 0x7635, 0x7638, 0x7639, /* 0x4e */ 0x763a, 0x763c, 0x764a, 0x7640, 0x7641, 0x7643, 0x7644, 0x7645, 0x7649, 0x764b, 0x7655, 0x7659, 0x765f, 0x7664, 0x7665, 0x766d, 0x766e, 0x766f, 0x7671, 0x7674, 0x7681, 0x7685, 0x768c, 0x768d, 0x7695, 0x769b, 0x769c, 0x769d, 0x769f, 0x76a0, 0x76a2, 0x76a3, 0x76a4, 0x76a5, 0x76a6, 0x76a7, 0x76a8, 0x76aa, 0x76ad, 0x76bd, 0x76c1, 0x76c5, 0x76c9, 0x76cb, 0x76cc, 0x76ce, 0x76d4, 0x76d9, 0x76e0, 0x76e6, 0x76e8, 0x76ec, 0x76f0, 0x76f1, 0x76f6, 0x76f9, 0x76fc, 0x7700, 0x7706, 0x770a, 0x770e, 0x7712, 0x7714, 0x7715, 0x7717, 0x7719, 0x771a, 0x771c, 0x7722, 0x7728, 0x772d, 0x772e, 0x772f, 0x7734, 0x7735, 0x7736, 0x7739, 0x773d, 0x773e, 0x7742, 0x7745, 0x7746, 0x774a, 0x774d, 0x774e, 0x774f, 0x7752, 0x7756, 0x7757, 0x775c, 0x775e, 0x775f, 0x7760, 0x7762, /* 0x4f */ 0x7764, 0x7767, 0x776a, 0x776c, 0x7770, 0x7772, 0x7773, 0x7774, 0x777a, 0x777d, 0x7780, 0x7784, 0x778c, 0x778d, 0x7794, 0x7795, 0x7796, 0x779a, 0x779f, 0x77a2, 0x77a7, 0x77aa, 0x77ae, 0x77af, 0x77b1, 0x77b5, 0x77be, 0x77c3, 0x77c9, 0x77d1, 0x77d2, 0x77d5, 0x77d9, 0x77de, 0x77df, 0x77e0, 0x77e4, 0x77e6, 0x77ea, 0x77ec, 0x77f0, 0x77f1, 0x77f4, 0x77f8, 0x77fb, 0x7805, 0x7806, 0x7809, 0x780d, 0x780e, 0x7811, 0x781d, 0x7821, 0x7822, 0x7823, 0x782d, 0x782e, 0x7830, 0x7835, 0x7837, 0x7843, 0x7844, 0x7847, 0x7848, 0x784c, 0x784e, 0x7852, 0x785c, 0x785e, 0x7860, 0x7861, 0x7863, 0x7864, 0x7868, 0x786a, 0x786e, 0x787a, 0x787e, 0x788a, 0x788f, 0x7894, 0x7898, 0x78a1, 0x789d, 0x789e, 0x789f, 0x78a4, 0x78a8, 0x78ac, 0x78ad, 0x78b0, 0x78b1, 0x78b2, 0x78b3, /* 0x50 */ 0x78bb, 0x78bd, 0x78bf, 0x78c7, 0x78c8, 0x78c9, 0x78cc, 0x78ce, 0x78d2, 0x78d3, 0x78d5, 0x78d6, 0x78e4, 0x78db, 0x78df, 0x78e0, 0x78e1, 0x78e6, 0x78ea, 0x78f2, 0x78f3, 0x7900, 0x78f6, 0x78f7, 0x78fa, 0x78fb, 0x78ff, 0x7906, 0x790c, 0x7910, 0x791a, 0x791c, 0x791e, 0x791f, 0x7920, 0x7925, 0x7927, 0x7929, 0x792d, 0x7931, 0x7934, 0x7935, 0x793b, 0x793d, 0x793f, 0x7944, 0x7945, 0x7946, 0x794a, 0x794b, 0x794f, 0x7951, 0x7954, 0x7958, 0x795b, 0x795c, 0x7967, 0x7969, 0x796b, 0x7972, 0x7979, 0x797b, 0x797c, 0x797e, 0x798b, 0x798c, 0x7991, 0x7993, 0x7994, 0x7995, 0x7996, 0x7998, 0x799b, 0x799c, 0x79a1, 0x79a8, 0x79a9, 0x79ab, 0x79af, 0x79b1, 0x79b4, 0x79b8, 0x79bb, 0x79c2, 0x79c4, 0x79c7, 0x79c8, 0x79ca, 0x79cf, 0x79d4, 0x79d6, 0x79da, 0x79dd, 0x79de, /* 0x51 */ 0x79e0, 0x79e2, 0x79e5, 0x79ea, 0x79eb, 0x79ed, 0x79f1, 0x79f8, 0x79fc, 0x7a02, 0x7a03, 0x7a07, 0x7a09, 0x7a0a, 0x7a0c, 0x7a11, 0x7a15, 0x7a1b, 0x7a1e, 0x7a21, 0x7a27, 0x7a2b, 0x7a2d, 0x7a2f, 0x7a30, 0x7a34, 0x7a35, 0x7a38, 0x7a39, 0x7a3a, 0x7a44, 0x7a45, 0x7a47, 0x7a48, 0x7a4c, 0x7a55, 0x7a56, 0x7a59, 0x7a5c, 0x7a5d, 0x7a5f, 0x7a60, 0x7a65, 0x7a67, 0x7a6a, 0x7a6d, 0x7a75, 0x7a78, 0x7a7e, 0x7a80, 0x7a82, 0x7a85, 0x7a86, 0x7a8a, 0x7a8b, 0x7a90, 0x7a91, 0x7a94, 0x7a9e, 0x7aa0, 0x7aa3, 0x7aac, 0x7ab3, 0x7ab5, 0x7ab9, 0x7abb, 0x7abc, 0x7ac6, 0x7ac9, 0x7acc, 0x7ace, 0x7ad1, 0x7adb, 0x7ae8, 0x7ae9, 0x7aeb, 0x7aec, 0x7af1, 0x7af4, 0x7afb, 0x7afd, 0x7afe, 0x7b07, 0x7b14, 0x7b1f, 0x7b23, 0x7b27, 0x7b29, 0x7b2a, 0x7b2b, 0x7b2d, 0x7b2e, 0x7b2f, 0x7b30, /* 0x52 */ 0x7b31, 0x7b34, 0x7b3d, 0x7b3f, 0x7b40, 0x7b41, 0x7b47, 0x7b4e, 0x7b55, 0x7b60, 0x7b64, 0x7b66, 0x7b69, 0x7b6a, 0x7b6d, 0x7b6f, 0x7b72, 0x7b73, 0x7b77, 0x7b84, 0x7b89, 0x7b8e, 0x7b90, 0x7b91, 0x7b96, 0x7b9b, 0x7b9e, 0x7ba0, 0x7ba5, 0x7bac, 0x7baf, 0x7bb0, 0x7bb2, 0x7bb5, 0x7bb6, 0x7bba, 0x7bbb, 0x7bbc, 0x7bbd, 0x7bc2, 0x7bc5, 0x7bc8, 0x7bca, 0x7bd4, 0x7bd6, 0x7bd7, 0x7bd9, 0x7bda, 0x7bdb, 0x7be8, 0x7bea, 0x7bf2, 0x7bf4, 0x7bf5, 0x7bf8, 0x7bf9, 0x7bfa, 0x7bfc, 0x7bfe, 0x7c01, 0x7c02, 0x7c03, 0x7c04, 0x7c06, 0x7c09, 0x7c0b, 0x7c0c, 0x7c0e, 0x7c0f, 0x7c19, 0x7c1b, 0x7c20, 0x7c25, 0x7c26, 0x7c28, 0x7c2c, 0x7c31, 0x7c33, 0x7c34, 0x7c36, 0x7c39, 0x7c3a, 0x7c46, 0x7c4a, 0x7c55, 0x7c51, 0x7c52, 0x7c53, 0x7c59, 0x7c5a, 0x7c5b, 0x7c5c, 0x7c5d, 0x7c5e, /* 0x53 */ 0x7c61, 0x7c63, 0x7c67, 0x7c69, 0x7c6d, 0x7c6e, 0x7c70, 0x7c72, 0x7c79, 0x7c7c, 0x7c7d, 0x7c86, 0x7c87, 0x7c8f, 0x7c94, 0x7c9e, 0x7ca0, 0x7ca6, 0x7cb0, 0x7cb6, 0x7cb7, 0x7cba, 0x7cbb, 0x7cbc, 0x7cbf, 0x7cc4, 0x7cc7, 0x7cc8, 0x7cc9, 0x7ccd, 0x7ccf, 0x7cd3, 0x7cd4, 0x7cd5, 0x7cd7, 0x7cd9, 0x7cda, 0x7cdd, 0x7ce6, 0x7ce9, 0x7ceb, 0x7cf5, 0x7d03, 0x7d07, 0x7d08, 0x7d09, 0x7d0f, 0x7d11, 0x7d12, 0x7d13, 0x7d16, 0x7d1d, 0x7d1e, 0x7d23, 0x7d26, 0x7d2a, 0x7d2d, 0x7d31, 0x7d3c, 0x7d3d, 0x7d3e, 0x7d40, 0x7d41, 0x7d47, 0x7d48, 0x7d4d, 0x7d51, 0x7d53, 0x7d57, 0x7d59, 0x7d5a, 0x7d5c, 0x7d5d, 0x7d65, 0x7d67, 0x7d6a, 0x7d70, 0x7d78, 0x7d7a, 0x7d7b, 0x7d7f, 0x7d81, 0x7d82, 0x7d83, 0x7d85, 0x7d86, 0x7d88, 0x7d8b, 0x7d8c, 0x7d8d, 0x7d91, 0x7d96, 0x7d97, 0x7d9d, /* 0x54 */ 0x7d9e, 0x7da6, 0x7da7, 0x7daa, 0x7db3, 0x7db6, 0x7db7, 0x7db9, 0x7dc2, 0x7dc3, 0x7dc4, 0x7dc5, 0x7dc6, 0x7dcc, 0x7dcd, 0x7dce, 0x7dd7, 0x7dd9, 0x7e00, 0x7de2, 0x7de5, 0x7de6, 0x7dea, 0x7deb, 0x7ded, 0x7df1, 0x7df5, 0x7df6, 0x7df9, 0x7dfa, 0x7e08, 0x7e10, 0x7e11, 0x7e15, 0x7e17, 0x7e1c, 0x7e1d, 0x7e20, 0x7e27, 0x7e28, 0x7e2c, 0x7e2d, 0x7e2f, 0x7e33, 0x7e36, 0x7e3f, 0x7e44, 0x7e45, 0x7e47, 0x7e4e, 0x7e50, 0x7e52, 0x7e58, 0x7e5f, 0x7e61, 0x7e62, 0x7e65, 0x7e6b, 0x7e6e, 0x7e6f, 0x7e73, 0x7e78, 0x7e7e, 0x7e81, 0x7e86, 0x7e87, 0x7e8a, 0x7e8d, 0x7e91, 0x7e95, 0x7e98, 0x7e9a, 0x7e9d, 0x7e9e, 0x7f3c, 0x7f3b, 0x7f3d, 0x7f3e, 0x7f3f, 0x7f43, 0x7f44, 0x7f47, 0x7f4f, 0x7f52, 0x7f53, 0x7f5b, 0x7f5c, 0x7f5d, 0x7f61, 0x7f63, 0x7f64, 0x7f65, 0x7f66, 0x7f6d, /* 0x55 */ 0x7f71, 0x7f7d, 0x7f7e, 0x7f7f, 0x7f80, 0x7f8b, 0x7f8d, 0x7f8f, 0x7f90, 0x7f91, 0x7f96, 0x7f97, 0x7f9c, 0x7fa1, 0x7fa2, 0x7fa6, 0x7faa, 0x7fad, 0x7fb4, 0x7fbc, 0x7fbf, 0x7fc0, 0x7fc3, 0x7fc8, 0x7fce, 0x7fcf, 0x7fdb, 0x7fdf, 0x7fe3, 0x7fe5, 0x7fe8, 0x7fec, 0x7fee, 0x7fef, 0x7ff2, 0x7ffa, 0x7ffd, 0x7ffe, 0x7fff, 0x8007, 0x8008, 0x800a, 0x800d, 0x800e, 0x800f, 0x8011, 0x8013, 0x8014, 0x8016, 0x801d, 0x801e, 0x801f, 0x8020, 0x8024, 0x8026, 0x802c, 0x802e, 0x8030, 0x8034, 0x8035, 0x8037, 0x8039, 0x803a, 0x803c, 0x803e, 0x8040, 0x8044, 0x8060, 0x8064, 0x8066, 0x806d, 0x8071, 0x8075, 0x8081, 0x8088, 0x808e, 0x809c, 0x809e, 0x80a6, 0x80a7, 0x80ab, 0x80b8, 0x80b9, 0x80c8, 0x80cd, 0x80cf, 0x80d2, 0x80d4, 0x80d5, 0x80d7, 0x80d8, 0x80e0, 0x80ed, 0x80ee, /* 0x56 */ 0x80f0, 0x80f2, 0x80f3, 0x80f6, 0x80f9, 0x80fa, 0x80fe, 0x8103, 0x810b, 0x8116, 0x8117, 0x8118, 0x811c, 0x811e, 0x8120, 0x8124, 0x8127, 0x812c, 0x8130, 0x8135, 0x813a, 0x813c, 0x8145, 0x8147, 0x814a, 0x814c, 0x8152, 0x8157, 0x8160, 0x8161, 0x8167, 0x8168, 0x8169, 0x816d, 0x816f, 0x8177, 0x8181, 0x8190, 0x8184, 0x8185, 0x8186, 0x818b, 0x818e, 0x8196, 0x8198, 0x819b, 0x819e, 0x81a2, 0x81ae, 0x81b2, 0x81b4, 0x81bb, 0x81cb, 0x81c3, 0x81c5, 0x81ca, 0x81ce, 0x81cf, 0x81d5, 0x81d7, 0x81db, 0x81dd, 0x81de, 0x81e1, 0x81e4, 0x81eb, 0x81ec, 0x81f0, 0x81f1, 0x81f2, 0x81f5, 0x81f6, 0x81f8, 0x81f9, 0x81fd, 0x81ff, 0x8200, 0x8203, 0x820f, 0x8213, 0x8214, 0x8219, 0x821a, 0x821d, 0x8221, 0x8222, 0x8228, 0x8232, 0x8234, 0x823a, 0x8243, 0x8244, 0x8245, 0x8246, /* 0x57 */ 0x824b, 0x824e, 0x824f, 0x8251, 0x8256, 0x825c, 0x8260, 0x8263, 0x8267, 0x826d, 0x8274, 0x827b, 0x827d, 0x827f, 0x8280, 0x8281, 0x8283, 0x8284, 0x8287, 0x8289, 0x828a, 0x828e, 0x8291, 0x8294, 0x8296, 0x8298, 0x829a, 0x829b, 0x82a0, 0x82a1, 0x82a3, 0x82a4, 0x82a7, 0x82a8, 0x82a9, 0x82aa, 0x82ae, 0x82b0, 0x82b2, 0x82b4, 0x82b7, 0x82ba, 0x82bc, 0x82be, 0x82bf, 0x82c6, 0x82d0, 0x82d5, 0x82da, 0x82e0, 0x82e2, 0x82e4, 0x82e8, 0x82ea, 0x82ed, 0x82ef, 0x82f6, 0x82f7, 0x82fd, 0x82fe, 0x8300, 0x8301, 0x8307, 0x8308, 0x830a, 0x830b, 0x8354, 0x831b, 0x831d, 0x831e, 0x831f, 0x8321, 0x8322, 0x832c, 0x832d, 0x832e, 0x8330, 0x8333, 0x8337, 0x833a, 0x833c, 0x833d, 0x8342, 0x8343, 0x8344, 0x8347, 0x834d, 0x834e, 0x8351, 0x8355, 0x8356, 0x8357, 0x8370, 0x8378, /* 0x58 */ 0x837d, 0x837f, 0x8380, 0x8382, 0x8384, 0x8386, 0x838d, 0x8392, 0x8394, 0x8395, 0x8398, 0x8399, 0x839b, 0x839c, 0x839d, 0x83a6, 0x83a7, 0x83a9, 0x83ac, 0x83be, 0x83bf, 0x83c0, 0x83c7, 0x83c9, 0x83cf, 0x83d0, 0x83d1, 0x83d4, 0x83dd, 0x8353, 0x83e8, 0x83ea, 0x83f6, 0x83f8, 0x83f9, 0x83fc, 0x8401, 0x8406, 0x840a, 0x840f, 0x8411, 0x8415, 0x8419, 0x83ad, 0x842f, 0x8439, 0x8445, 0x8447, 0x8448, 0x844a, 0x844d, 0x844f, 0x8451, 0x8452, 0x8456, 0x8458, 0x8459, 0x845a, 0x845c, 0x8460, 0x8464, 0x8465, 0x8467, 0x846a, 0x8470, 0x8473, 0x8474, 0x8476, 0x8478, 0x847c, 0x847d, 0x8481, 0x8485, 0x8492, 0x8493, 0x8495, 0x849e, 0x84a6, 0x84a8, 0x84a9, 0x84aa, 0x84af, 0x84b1, 0x84b4, 0x84ba, 0x84bd, 0x84be, 0x84c0, 0x84c2, 0x84c7, 0x84c8, 0x84cc, 0x84cf, 0x84d3, /* 0x59 */ 0x84dc, 0x84e7, 0x84ea, 0x84ef, 0x84f0, 0x84f1, 0x84f2, 0x84f7, 0x8532, 0x84fa, 0x84fb, 0x84fd, 0x8502, 0x8503, 0x8507, 0x850c, 0x850e, 0x8510, 0x851c, 0x851e, 0x8522, 0x8523, 0x8524, 0x8525, 0x8527, 0x852a, 0x852b, 0x852f, 0x8533, 0x8534, 0x8536, 0x853f, 0x8546, 0x854f, 0x8550, 0x8551, 0x8552, 0x8553, 0x8556, 0x8559, 0x855c, 0x855d, 0x855e, 0x855f, 0x8560, 0x8561, 0x8562, 0x8564, 0x856b, 0x856f, 0x8579, 0x857a, 0x857b, 0x857d, 0x857f, 0x8581, 0x8585, 0x8586, 0x8589, 0x858b, 0x858c, 0x858f, 0x8593, 0x8598, 0x859d, 0x859f, 0x85a0, 0x85a2, 0x85a5, 0x85a7, 0x85b4, 0x85b6, 0x85b7, 0x85b8, 0x85bc, 0x85bd, 0x85be, 0x85bf, 0x85c2, 0x85c7, 0x85ca, 0x85cb, 0x85ce, 0x85ad, 0x85d8, 0x85da, 0x85df, 0x85e0, 0x85e6, 0x85e8, 0x85ed, 0x85f3, 0x85f6, 0x85fc, /* 0x5a */ 0x85ff, 0x8600, 0x8604, 0x8605, 0x860d, 0x860e, 0x8610, 0x8611, 0x8612, 0x8618, 0x8619, 0x861b, 0x861e, 0x8621, 0x8627, 0x8629, 0x8636, 0x8638, 0x863a, 0x863c, 0x863d, 0x8640, 0x8642, 0x8646, 0x8652, 0x8653, 0x8656, 0x8657, 0x8658, 0x8659, 0x865d, 0x8660, 0x8661, 0x8662, 0x8663, 0x8664, 0x8669, 0x866c, 0x866f, 0x8675, 0x8676, 0x8677, 0x867a, 0x868d, 0x8691, 0x8696, 0x8698, 0x869a, 0x869c, 0x86a1, 0x86a6, 0x86a7, 0x86a8, 0x86ad, 0x86b1, 0x86b3, 0x86b4, 0x86b5, 0x86b7, 0x86b8, 0x86b9, 0x86bf, 0x86c0, 0x86c1, 0x86c3, 0x86c5, 0x86d1, 0x86d2, 0x86d5, 0x86d7, 0x86da, 0x86dc, 0x86e0, 0x86e3, 0x86e5, 0x86e7, 0x8688, 0x86fa, 0x86fc, 0x86fd, 0x8704, 0x8705, 0x8707, 0x870b, 0x870e, 0x870f, 0x8710, 0x8713, 0x8714, 0x8719, 0x871e, 0x871f, 0x8721, 0x8723, /* 0x5b */ 0x8728, 0x872e, 0x872f, 0x8731, 0x8732, 0x8739, 0x873a, 0x873c, 0x873d, 0x873e, 0x8740, 0x8743, 0x8745, 0x874d, 0x8758, 0x875d, 0x8761, 0x8764, 0x8765, 0x876f, 0x8771, 0x8772, 0x877b, 0x8783, 0x8784, 0x8785, 0x8786, 0x8787, 0x8788, 0x8789, 0x878b, 0x878c, 0x8790, 0x8793, 0x8795, 0x8797, 0x8798, 0x8799, 0x879e, 0x87a0, 0x87a3, 0x87a7, 0x87ac, 0x87ad, 0x87ae, 0x87b1, 0x87b5, 0x87be, 0x87bf, 0x87c1, 0x87c8, 0x87c9, 0x87ca, 0x87ce, 0x87d5, 0x87d6, 0x87d9, 0x87da, 0x87dc, 0x87df, 0x87e2, 0x87e3, 0x87e4, 0x87ea, 0x87eb, 0x87ed, 0x87f1, 0x87f3, 0x87f8, 0x87fa, 0x87ff, 0x8801, 0x8803, 0x8806, 0x8809, 0x880a, 0x880b, 0x8810, 0x8819, 0x8812, 0x8813, 0x8814, 0x8818, 0x881a, 0x881b, 0x881c, 0x881e, 0x881f, 0x8828, 0x882d, 0x882e, 0x8830, 0x8832, 0x8835, /* 0x5c */ 0x883a, 0x883c, 0x8841, 0x8843, 0x8845, 0x8848, 0x8849, 0x884a, 0x884b, 0x884e, 0x8851, 0x8855, 0x8856, 0x8858, 0x885a, 0x885c, 0x885f, 0x8860, 0x8864, 0x8869, 0x8871, 0x8879, 0x887b, 0x8880, 0x8898, 0x889a, 0x889b, 0x889c, 0x889f, 0x88a0, 0x88a8, 0x88aa, 0x88ba, 0x88bd, 0x88be, 0x88c0, 0x88ca, 0x88cb, 0x88cc, 0x88cd, 0x88ce, 0x88d1, 0x88d2, 0x88d3, 0x88db, 0x88de, 0x88e7, 0x88ef, 0x88f0, 0x88f1, 0x88f5, 0x88f7, 0x8901, 0x8906, 0x890d, 0x890e, 0x890f, 0x8915, 0x8916, 0x8918, 0x8919, 0x891a, 0x891c, 0x8920, 0x8926, 0x8927, 0x8928, 0x8930, 0x8931, 0x8932, 0x8935, 0x8939, 0x893a, 0x893e, 0x8940, 0x8942, 0x8945, 0x8946, 0x8949, 0x894f, 0x8952, 0x8957, 0x895a, 0x895b, 0x895c, 0x8961, 0x8962, 0x8963, 0x896b, 0x896e, 0x8970, 0x8973, 0x8975, 0x897a, /* 0x5d */ 0x897b, 0x897c, 0x897d, 0x8989, 0x898d, 0x8990, 0x8994, 0x8995, 0x899b, 0x899c, 0x899f, 0x89a0, 0x89a5, 0x89b0, 0x89b4, 0x89b5, 0x89b6, 0x89b7, 0x89bc, 0x89d4, 0x89d5, 0x89d6, 0x89d7, 0x89d8, 0x89e5, 0x89e9, 0x89eb, 0x89ed, 0x89f1, 0x89f3, 0x89f6, 0x89f9, 0x89fd, 0x89ff, 0x8a04, 0x8a05, 0x8a07, 0x8a0f, 0x8a11, 0x8a12, 0x8a14, 0x8a15, 0x8a1e, 0x8a20, 0x8a22, 0x8a24, 0x8a26, 0x8a2b, 0x8a2c, 0x8a2f, 0x8a35, 0x8a37, 0x8a3d, 0x8a3e, 0x8a40, 0x8a43, 0x8a45, 0x8a47, 0x8a49, 0x8a4d, 0x8a4e, 0x8a53, 0x8a56, 0x8a57, 0x8a58, 0x8a5c, 0x8a5d, 0x8a61, 0x8a65, 0x8a67, 0x8a75, 0x8a76, 0x8a77, 0x8a79, 0x8a7a, 0x8a7b, 0x8a7e, 0x8a7f, 0x8a80, 0x8a83, 0x8a86, 0x8a8b, 0x8a8f, 0x8a90, 0x8a92, 0x8a96, 0x8a97, 0x8a99, 0x8a9f, 0x8aa7, 0x8aa9, 0x8aae, 0x8aaf, 0x8ab3, /* 0x5e */ 0x8ab6, 0x8ab7, 0x8abb, 0x8abe, 0x8ac3, 0x8ac6, 0x8ac8, 0x8ac9, 0x8aca, 0x8ad1, 0x8ad3, 0x8ad4, 0x8ad5, 0x8ad7, 0x8add, 0x8adf, 0x8aec, 0x8af0, 0x8af4, 0x8af5, 0x8af6, 0x8afc, 0x8aff, 0x8b05, 0x8b06, 0x8b0b, 0x8b11, 0x8b1c, 0x8b1e, 0x8b1f, 0x8b0a, 0x8b2d, 0x8b30, 0x8b37, 0x8b3c, 0x8b42, 0x8b43, 0x8b44, 0x8b45, 0x8b46, 0x8b48, 0x8b52, 0x8b53, 0x8b54, 0x8b59, 0x8b4d, 0x8b5e, 0x8b63, 0x8b6d, 0x8b76, 0x8b78, 0x8b79, 0x8b7c, 0x8b7e, 0x8b81, 0x8b84, 0x8b85, 0x8b8b, 0x8b8d, 0x8b8f, 0x8b94, 0x8b95, 0x8b9c, 0x8b9e, 0x8b9f, 0x8c38, 0x8c39, 0x8c3d, 0x8c3e, 0x8c45, 0x8c47, 0x8c49, 0x8c4b, 0x8c4f, 0x8c51, 0x8c53, 0x8c54, 0x8c57, 0x8c58, 0x8c5b, 0x8c5d, 0x8c59, 0x8c63, 0x8c64, 0x8c66, 0x8c68, 0x8c69, 0x8c6d, 0x8c73, 0x8c75, 0x8c76, 0x8c7b, 0x8c7e, 0x8c86, /* 0x5f */ 0x8c87, 0x8c8b, 0x8c90, 0x8c92, 0x8c93, 0x8c99, 0x8c9b, 0x8c9c, 0x8ca4, 0x8cb9, 0x8cba, 0x8cc5, 0x8cc6, 0x8cc9, 0x8ccb, 0x8ccf, 0x8cd6, 0x8cd5, 0x8cd9, 0x8cdd, 0x8ce1, 0x8ce8, 0x8cec, 0x8cef, 0x8cf0, 0x8cf2, 0x8cf5, 0x8cf7, 0x8cf8, 0x8cfe, 0x8cff, 0x8d01, 0x8d03, 0x8d09, 0x8d12, 0x8d17, 0x8d1b, 0x8d65, 0x8d69, 0x8d6c, 0x8d6e, 0x8d7f, 0x8d82, 0x8d84, 0x8d88, 0x8d8d, 0x8d90, 0x8d91, 0x8d95, 0x8d9e, 0x8d9f, 0x8da0, 0x8da6, 0x8dab, 0x8dac, 0x8daf, 0x8db2, 0x8db5, 0x8db7, 0x8db9, 0x8dbb, 0x8dc0, 0x8dc5, 0x8dc6, 0x8dc7, 0x8dc8, 0x8dca, 0x8dce, 0x8dd1, 0x8dd4, 0x8dd5, 0x8dd7, 0x8dd9, 0x8de4, 0x8de5, 0x8de7, 0x8dec, 0x8df0, 0x8dbc, 0x8df1, 0x8df2, 0x8df4, 0x8dfd, 0x8e01, 0x8e04, 0x8e05, 0x8e06, 0x8e0b, 0x8e11, 0x8e14, 0x8e16, 0x8e20, 0x8e21, 0x8e22, /* 0x60 */ 0x8e23, 0x8e26, 0x8e27, 0x8e31, 0x8e33, 0x8e36, 0x8e37, 0x8e38, 0x8e39, 0x8e3d, 0x8e40, 0x8e41, 0x8e4b, 0x8e4d, 0x8e4e, 0x8e4f, 0x8e54, 0x8e5b, 0x8e5c, 0x8e5d, 0x8e5e, 0x8e61, 0x8e62, 0x8e69, 0x8e6c, 0x8e6d, 0x8e6f, 0x8e70, 0x8e71, 0x8e79, 0x8e7a, 0x8e7b, 0x8e82, 0x8e83, 0x8e89, 0x8e90, 0x8e92, 0x8e95, 0x8e9a, 0x8e9b, 0x8e9d, 0x8e9e, 0x8ea2, 0x8ea7, 0x8ea9, 0x8ead, 0x8eae, 0x8eb3, 0x8eb5, 0x8eba, 0x8ebb, 0x8ec0, 0x8ec1, 0x8ec3, 0x8ec4, 0x8ec7, 0x8ecf, 0x8ed1, 0x8ed4, 0x8edc, 0x8ee8, 0x8eee, 0x8ef0, 0x8ef1, 0x8ef7, 0x8ef9, 0x8efa, 0x8eed, 0x8f00, 0x8f02, 0x8f07, 0x8f08, 0x8f0f, 0x8f10, 0x8f16, 0x8f17, 0x8f18, 0x8f1e, 0x8f20, 0x8f21, 0x8f23, 0x8f25, 0x8f27, 0x8f28, 0x8f2c, 0x8f2d, 0x8f2e, 0x8f34, 0x8f35, 0x8f36, 0x8f37, 0x8f3a, 0x8f40, 0x8f41, /* 0x61 */ 0x8f43, 0x8f47, 0x8f4f, 0x8f51, 0x8f52, 0x8f53, 0x8f54, 0x8f55, 0x8f58, 0x8f5d, 0x8f5e, 0x8f65, 0x8f9d, 0x8fa0, 0x8fa1, 0x8fa4, 0x8fa5, 0x8fa6, 0x8fb5, 0x8fb6, 0x8fb8, 0x8fbe, 0x8fc0, 0x8fc1, 0x8fc6, 0x8fca, 0x8fcb, 0x8fcd, 0x8fd0, 0x8fd2, 0x8fd3, 0x8fd5, 0x8fe0, 0x8fe3, 0x8fe4, 0x8fe8, 0x8fee, 0x8ff1, 0x8ff5, 0x8ff6, 0x8ffb, 0x8ffe, 0x9002, 0x9004, 0x9008, 0x900c, 0x9018, 0x901b, 0x9028, 0x9029, 0x902f, 0x902a, 0x902c, 0x902d, 0x9033, 0x9034, 0x9037, 0x903f, 0x9043, 0x9044, 0x904c, 0x905b, 0x905d, 0x9062, 0x9066, 0x9067, 0x906c, 0x9070, 0x9074, 0x9079, 0x9085, 0x9088, 0x908b, 0x908c, 0x908e, 0x9090, 0x9095, 0x9097, 0x9098, 0x9099, 0x909b, 0x90a0, 0x90a1, 0x90a2, 0x90a5, 0x90b0, 0x90b2, 0x90b3, 0x90b4, 0x90b6, 0x90bd, 0x90cc, 0x90be, 0x90c3, /* 0x62 */ 0x90c4, 0x90c5, 0x90c7, 0x90c8, 0x90d5, 0x90d7, 0x90d8, 0x90d9, 0x90dc, 0x90dd, 0x90df, 0x90e5, 0x90d2, 0x90f6, 0x90eb, 0x90ef, 0x90f0, 0x90f4, 0x90fe, 0x90ff, 0x9100, 0x9104, 0x9105, 0x9106, 0x9108, 0x910d, 0x9110, 0x9114, 0x9116, 0x9117, 0x9118, 0x911a, 0x911c, 0x911e, 0x9120, 0x9125, 0x9122, 0x9123, 0x9127, 0x9129, 0x912e, 0x912f, 0x9131, 0x9134, 0x9136, 0x9137, 0x9139, 0x913a, 0x913c, 0x913d, 0x9143, 0x9147, 0x9148, 0x914f, 0x9153, 0x9157, 0x9159, 0x915a, 0x915b, 0x9161, 0x9164, 0x9167, 0x916d, 0x9174, 0x9179, 0x917a, 0x917b, 0x9181, 0x9183, 0x9185, 0x9186, 0x918a, 0x918e, 0x9191, 0x9193, 0x9194, 0x9195, 0x9198, 0x919e, 0x91a1, 0x91a6, 0x91a8, 0x91ac, 0x91ad, 0x91ae, 0x91b0, 0x91b1, 0x91b2, 0x91b3, 0x91b6, 0x91bb, 0x91bc, 0x91bd, 0x91bf, /* 0x63 */ 0x91c2, 0x91c3, 0x91c5, 0x91d3, 0x91d4, 0x91d7, 0x91d9, 0x91da, 0x91de, 0x91e4, 0x91e5, 0x91e9, 0x91ea, 0x91ec, 0x91ed, 0x91ee, 0x91ef, 0x91f0, 0x91f1, 0x91f7, 0x91f9, 0x91fb, 0x91fd, 0x9200, 0x9201, 0x9204, 0x9205, 0x9206, 0x9207, 0x9209, 0x920a, 0x920c, 0x9210, 0x9212, 0x9213, 0x9216, 0x9218, 0x921c, 0x921d, 0x9223, 0x9224, 0x9225, 0x9226, 0x9228, 0x922e, 0x922f, 0x9230, 0x9233, 0x9235, 0x9236, 0x9238, 0x9239, 0x923a, 0x923c, 0x923e, 0x9240, 0x9242, 0x9243, 0x9246, 0x9247, 0x924a, 0x924d, 0x924e, 0x924f, 0x9251, 0x9258, 0x9259, 0x925c, 0x925d, 0x9260, 0x9261, 0x9265, 0x9267, 0x9268, 0x9269, 0x926e, 0x926f, 0x9270, 0x9275, 0x9276, 0x9277, 0x9278, 0x9279, 0x927b, 0x927c, 0x927d, 0x927f, 0x9288, 0x9289, 0x928a, 0x928d, 0x928e, 0x9292, 0x9297, /* 0x64 */ 0x9299, 0x929f, 0x92a0, 0x92a4, 0x92a5, 0x92a7, 0x92a8, 0x92ab, 0x92af, 0x92b2, 0x92b6, 0x92b8, 0x92ba, 0x92bb, 0x92bc, 0x92bd, 0x92bf, 0x92c0, 0x92c1, 0x92c2, 0x92c3, 0x92c5, 0x92c6, 0x92c7, 0x92c8, 0x92cb, 0x92cc, 0x92cd, 0x92ce, 0x92d0, 0x92d3, 0x92d5, 0x92d7, 0x92d8, 0x92d9, 0x92dc, 0x92dd, 0x92df, 0x92e0, 0x92e1, 0x92e3, 0x92e5, 0x92e7, 0x92e8, 0x92ec, 0x92ee, 0x92f0, 0x92f9, 0x92fb, 0x92ff, 0x9300, 0x9302, 0x9308, 0x930d, 0x9311, 0x9314, 0x9315, 0x931c, 0x931d, 0x931e, 0x931f, 0x9321, 0x9324, 0x9325, 0x9327, 0x9329, 0x932a, 0x9333, 0x9334, 0x9336, 0x9337, 0x9347, 0x9348, 0x9349, 0x9350, 0x9351, 0x9352, 0x9355, 0x9357, 0x9358, 0x935a, 0x935e, 0x9364, 0x9365, 0x9367, 0x9369, 0x936a, 0x936d, 0x936f, 0x9370, 0x9371, 0x9373, 0x9374, 0x9376, /* 0x65 */ 0x937a, 0x937d, 0x937f, 0x9380, 0x9381, 0x9382, 0x9388, 0x938a, 0x938b, 0x938d, 0x938f, 0x9392, 0x9395, 0x9398, 0x939b, 0x939e, 0x93a1, 0x93a3, 0x93a4, 0x93a6, 0x93a8, 0x93ab, 0x93b4, 0x93b5, 0x93b6, 0x93ba, 0x93a9, 0x93c1, 0x93c4, 0x93c5, 0x93c6, 0x93c7, 0x93c9, 0x93ca, 0x93cb, 0x93cc, 0x93cd, 0x93d3, 0x93d9, 0x93dc, 0x93de, 0x93df, 0x93e2, 0x93e6, 0x93e7, 0x93f9, 0x93f7, 0x93f8, 0x93fa, 0x93fb, 0x93fd, 0x9401, 0x9402, 0x9404, 0x9408, 0x9409, 0x940d, 0x940e, 0x940f, 0x9415, 0x9416, 0x9417, 0x941f, 0x942e, 0x942f, 0x9431, 0x9432, 0x9433, 0x9434, 0x943b, 0x943f, 0x943d, 0x9443, 0x9445, 0x9448, 0x944a, 0x944c, 0x9455, 0x9459, 0x945c, 0x945f, 0x9461, 0x9463, 0x9468, 0x946b, 0x946d, 0x946e, 0x946f, 0x9471, 0x9472, 0x9484, 0x9483, 0x9578, 0x9579, /* 0x66 */ 0x957e, 0x9584, 0x9588, 0x958c, 0x958d, 0x958e, 0x959d, 0x959e, 0x959f, 0x95a1, 0x95a6, 0x95a9, 0x95ab, 0x95ac, 0x95b4, 0x95b6, 0x95ba, 0x95bd, 0x95bf, 0x95c6, 0x95c8, 0x95c9, 0x95cb, 0x95d0, 0x95d1, 0x95d2, 0x95d3, 0x95d9, 0x95da, 0x95dd, 0x95de, 0x95df, 0x95e0, 0x95e4, 0x95e6, 0x961d, 0x961e, 0x9622, 0x9624, 0x9625, 0x9626, 0x962c, 0x9631, 0x9633, 0x9637, 0x9638, 0x9639, 0x963a, 0x963c, 0x963d, 0x9641, 0x9652, 0x9654, 0x9656, 0x9657, 0x9658, 0x9661, 0x966e, 0x9674, 0x967b, 0x967c, 0x967e, 0x967f, 0x9681, 0x9682, 0x9683, 0x9684, 0x9689, 0x9691, 0x9696, 0x969a, 0x969d, 0x969f, 0x96a4, 0x96a5, 0x96a6, 0x96a9, 0x96ae, 0x96af, 0x96b3, 0x96ba, 0x96ca, 0x96d2, 0x5db2, 0x96d8, 0x96da, 0x96dd, 0x96de, 0x96df, 0x96e9, 0x96ef, 0x96f1, 0x96fa, 0x9702, /* 0x67 */ 0x9703, 0x9705, 0x9709, 0x971a, 0x971b, 0x971d, 0x9721, 0x9722, 0x9723, 0x9728, 0x9731, 0x9733, 0x9741, 0x9743, 0x974a, 0x974e, 0x974f, 0x9755, 0x9757, 0x9758, 0x975a, 0x975b, 0x9763, 0x9767, 0x976a, 0x976e, 0x9773, 0x9776, 0x9777, 0x9778, 0x977b, 0x977d, 0x977f, 0x9780, 0x9789, 0x9795, 0x9796, 0x9797, 0x9799, 0x979a, 0x979e, 0x979f, 0x97a2, 0x97ac, 0x97ae, 0x97b1, 0x97b2, 0x97b5, 0x97b6, 0x97b8, 0x97b9, 0x97ba, 0x97bc, 0x97be, 0x97bf, 0x97c1, 0x97c4, 0x97c5, 0x97c7, 0x97c9, 0x97ca, 0x97cc, 0x97cd, 0x97ce, 0x97d0, 0x97d1, 0x97d4, 0x97d7, 0x97d8, 0x97d9, 0x97dd, 0x97de, 0x97e0, 0x97db, 0x97e1, 0x97e4, 0x97ef, 0x97f1, 0x97f4, 0x97f7, 0x97f8, 0x97fa, 0x9807, 0x980a, 0x9819, 0x980d, 0x980e, 0x9814, 0x9816, 0x981c, 0x981e, 0x9820, 0x9823, 0x9826, /* 0x68 */ 0x982b, 0x982e, 0x982f, 0x9830, 0x9832, 0x9833, 0x9835, 0x9825, 0x983e, 0x9844, 0x9847, 0x984a, 0x9851, 0x9852, 0x9853, 0x9856, 0x9857, 0x9859, 0x985a, 0x9862, 0x9863, 0x9865, 0x9866, 0x986a, 0x986c, 0x98ab, 0x98ad, 0x98ae, 0x98b0, 0x98b4, 0x98b7, 0x98b8, 0x98ba, 0x98bb, 0x98bf, 0x98c2, 0x98c5, 0x98c8, 0x98cc, 0x98e1, 0x98e3, 0x98e5, 0x98e6, 0x98e7, 0x98ea, 0x98f3, 0x98f6, 0x9902, 0x9907, 0x9908, 0x9911, 0x9915, 0x9916, 0x9917, 0x991a, 0x991b, 0x991c, 0x991f, 0x9922, 0x9926, 0x9927, 0x992b, 0x9931, 0x9932, 0x9933, 0x9934, 0x9935, 0x9939, 0x993a, 0x993b, 0x993c, 0x9940, 0x9941, 0x9946, 0x9947, 0x9948, 0x994d, 0x994e, 0x9954, 0x9958, 0x9959, 0x995b, 0x995c, 0x995e, 0x995f, 0x9960, 0x999b, 0x999d, 0x999f, 0x99a6, 0x99b0, 0x99b1, 0x99b2, 0x99b5, /* 0x69 */ 0x99b9, 0x99ba, 0x99bd, 0x99bf, 0x99c3, 0x99c9, 0x99d3, 0x99d4, 0x99d9, 0x99da, 0x99dc, 0x99de, 0x99e7, 0x99ea, 0x99eb, 0x99ec, 0x99f0, 0x99f4, 0x99f5, 0x99f9, 0x99fd, 0x99fe, 0x9a02, 0x9a03, 0x9a04, 0x9a0b, 0x9a0c, 0x9a10, 0x9a11, 0x9a16, 0x9a1e, 0x9a20, 0x9a22, 0x9a23, 0x9a24, 0x9a27, 0x9a2d, 0x9a2e, 0x9a33, 0x9a35, 0x9a36, 0x9a38, 0x9a47, 0x9a41, 0x9a44, 0x9a4a, 0x9a4b, 0x9a4c, 0x9a4e, 0x9a51, 0x9a54, 0x9a56, 0x9a5d, 0x9aaa, 0x9aac, 0x9aae, 0x9aaf, 0x9ab2, 0x9ab4, 0x9ab5, 0x9ab6, 0x9ab9, 0x9abb, 0x9abe, 0x9abf, 0x9ac1, 0x9ac3, 0x9ac6, 0x9ac8, 0x9ace, 0x9ad0, 0x9ad2, 0x9ad5, 0x9ad6, 0x9ad7, 0x9adb, 0x9adc, 0x9ae0, 0x9ae4, 0x9ae5, 0x9ae7, 0x9ae9, 0x9aec, 0x9af2, 0x9af3, 0x9af5, 0x9af9, 0x9afa, 0x9afd, 0x9aff, 0x9b00, 0x9b01, 0x9b02, 0x9b03, /* 0x6a */ 0x9b04, 0x9b05, 0x9b08, 0x9b09, 0x9b0b, 0x9b0c, 0x9b0d, 0x9b0e, 0x9b10, 0x9b12, 0x9b16, 0x9b19, 0x9b1b, 0x9b1c, 0x9b20, 0x9b26, 0x9b2b, 0x9b2d, 0x9b33, 0x9b34, 0x9b35, 0x9b37, 0x9b39, 0x9b3a, 0x9b3d, 0x9b48, 0x9b4b, 0x9b4c, 0x9b55, 0x9b56, 0x9b57, 0x9b5b, 0x9b5e, 0x9b61, 0x9b63, 0x9b65, 0x9b66, 0x9b68, 0x9b6a, 0x9b6b, 0x9b6c, 0x9b6d, 0x9b6e, 0x9b73, 0x9b75, 0x9b77, 0x9b78, 0x9b79, 0x9b7f, 0x9b80, 0x9b84, 0x9b85, 0x9b86, 0x9b87, 0x9b89, 0x9b8a, 0x9b8b, 0x9b8d, 0x9b8f, 0x9b90, 0x9b94, 0x9b9a, 0x9b9d, 0x9b9e, 0x9ba6, 0x9ba7, 0x9ba9, 0x9bac, 0x9bb0, 0x9bb1, 0x9bb2, 0x9bb7, 0x9bb8, 0x9bbb, 0x9bbc, 0x9bbe, 0x9bbf, 0x9bc1, 0x9bc7, 0x9bc8, 0x9bce, 0x9bd0, 0x9bd7, 0x9bd8, 0x9bdd, 0x9bdf, 0x9be5, 0x9be7, 0x9bea, 0x9beb, 0x9bef, 0x9bf3, 0x9bf7, 0x9bf8, /* 0x6b */ 0x9bf9, 0x9bfa, 0x9bfd, 0x9bff, 0x9c00, 0x9c02, 0x9c0b, 0x9c0f, 0x9c11, 0x9c16, 0x9c18, 0x9c19, 0x9c1a, 0x9c1c, 0x9c1e, 0x9c22, 0x9c23, 0x9c26, 0x9c27, 0x9c28, 0x9c29, 0x9c2a, 0x9c31, 0x9c35, 0x9c36, 0x9c37, 0x9c3d, 0x9c41, 0x9c43, 0x9c44, 0x9c45, 0x9c49, 0x9c4a, 0x9c4e, 0x9c4f, 0x9c50, 0x9c53, 0x9c54, 0x9c56, 0x9c58, 0x9c5b, 0x9c5d, 0x9c5e, 0x9c5f, 0x9c63, 0x9c69, 0x9c6a, 0x9c5c, 0x9c6b, 0x9c68, 0x9c6e, 0x9c70, 0x9c72, 0x9c75, 0x9c77, 0x9c7b, 0x9ce6, 0x9cf2, 0x9cf7, 0x9cf9, 0x9d0b, 0x9d02, 0x9d11, 0x9d17, 0x9d18, 0x9d1c, 0x9d1d, 0x9d1e, 0x9d2f, 0x9d30, 0x9d32, 0x9d33, 0x9d34, 0x9d3a, 0x9d3c, 0x9d45, 0x9d3d, 0x9d42, 0x9d43, 0x9d47, 0x9d4a, 0x9d53, 0x9d54, 0x9d5f, 0x9d63, 0x9d62, 0x9d65, 0x9d69, 0x9d6a, 0x9d6b, 0x9d70, 0x9d76, 0x9d77, 0x9d7b, /* 0x6c */ 0x9d7c, 0x9d7e, 0x9d83, 0x9d84, 0x9d86, 0x9d8a, 0x9d8d, 0x9d8e, 0x9d92, 0x9d93, 0x9d95, 0x9d96, 0x9d97, 0x9d98, 0x9da1, 0x9daa, 0x9dac, 0x9dae, 0x9db1, 0x9db5, 0x9db9, 0x9dbc, 0x9dbf, 0x9dc3, 0x9dc7, 0x9dc9, 0x9dca, 0x9dd4, 0x9dd5, 0x9dd6, 0x9dd7, 0x9dda, 0x9dde, 0x9ddf, 0x9de0, 0x9de5, 0x9de7, 0x9de9, 0x9deb, 0x9dee, 0x9df0, 0x9df3, 0x9df4, 0x9dfe, 0x9e0a, 0x9e02, 0x9e07, 0x9e0e, 0x9e10, 0x9e11, 0x9e12, 0x9e15, 0x9e16, 0x9e19, 0x9e1c, 0x9e1d, 0x9e7a, 0x9e7b, 0x9e7c, 0x9e80, 0x9e82, 0x9e83, 0x9e84, 0x9e85, 0x9e87, 0x9e8e, 0x9e8f, 0x9e96, 0x9e98, 0x9e9b, 0x9e9e, 0x9ea4, 0x9ea8, 0x9eac, 0x9eae, 0x9eaf, 0x9eb0, 0x9eb3, 0x9eb4, 0x9eb5, 0x9ec6, 0x9ec8, 0x9ecb, 0x9ed5, 0x9edf, 0x9ee4, 0x9ee7, 0x9eec, 0x9eed, 0x9eee, 0x9ef0, 0x9ef1, 0x9ef2, 0x9ef5, /* 0x6d */ 0x9ef8, 0x9eff, 0x9f02, 0x9f03, 0x9f09, 0x9f0f, 0x9f10, 0x9f11, 0x9f12, 0x9f14, 0x9f16, 0x9f17, 0x9f19, 0x9f1a, 0x9f1b, 0x9f1f, 0x9f22, 0x9f26, 0x9f2a, 0x9f2b, 0x9f2f, 0x9f31, 0x9f32, 0x9f34, 0x9f37, 0x9f39, 0x9f3a, 0x9f3c, 0x9f3d, 0x9f3f, 0x9f41, 0x9f43, 0x9f44, 0x9f45, 0x9f46, 0x9f47, 0x9f53, 0x9f55, 0x9f56, 0x9f57, 0x9f58, 0x9f5a, 0x9f5d, 0x9f5e, 0x9f68, 0x9f69, 0x9f6d, 0x9f6e, 0x9f6f, 0x9f70, 0x9f71, 0x9f73, 0x9f75, 0x9f7a, 0x9f7d, 0x9f8f, 0x9f90, 0x9f91, 0x9f92, 0x9f94, 0x9f96, 0x9f97, 0x9f9e, 0x9fa1, 0x9fa2, 0x9fa3, 0x9fa5, }; static int jisx0212_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c1 = (s[0] & 0x7F); if ((c1 == 0x22) || (c1 >= 0x26 && c1 <= 0x27) || (c1 >= 0x29 && c1 <= 0x2b) || (c1 >= 0x30 && c1 <= 0x6d)) { if (n >= 2) { unsigned char c2 = (s[1] & 0x7F); if (c2 >= 0x21 && c2 < 0x7f) { unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); unsigned short wc = 0xfffd; if (i < 470) { if (i < 175) wc = jisx0212_2uni_page22[i-94]; } else if (i < 752) { if (i < 658) wc = jisx0212_2uni_page26[i-470]; } else if (i < 1410) { if (i < 1027) wc = jisx0212_2uni_page29[i-752]; } else { if (i < 7211) wc = jisx0212_2uni_page30[i-1410]; } if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 2; } } return RET_ILSEQ; } return RET_TOOFEW(0); } return RET_ILSEQ; } static const unsigned short jisx0212_2charset[6067] = { 0x2237, 0x2242, 0x2270, 0x2243, 0x226d, 0x226c, 0x226e, 0x2234, 0x2231, 0x226b, 0x2244, 0x2a22, 0x2a21, 0x2a24, 0x2a2a, 0x2a23, 0x2a29, 0x2921, 0x2a2e, 0x2a32, 0x2a31, 0x2a34, 0x2a33, 0x2a40, 0x2a3f, 0x2a42, 0x2a41, 0x2a50, 0x2a52, 0x2a51, 0x2a54, 0x2a58, 0x2a53, 0x292c, 0x2a63, 0x2a62, 0x2a65, 0x2a64, 0x2a72, 0x2930, 0x294e, 0x2b22, 0x2b21, 0x2b24, 0x2b2a, 0x2b23, 0x2b29, 0x2941, 0x2b2e, 0x2b32, 0x2b31, 0x2b34, 0x2b33, 0x2b40, 0x2b3f, 0x2b42, 0x2b41, 0x2943, 0x2b50, 0x2b52, 0x2b51, 0x2b54, 0x2b58, 0x2b53, 0x294c, 0x2b63, 0x2b62, 0x2b65, 0x2b64, 0x2b72, 0x2950, 0x2b73, 0x2a27, 0x2b27, 0x2a25, 0x2b25, 0x2a28, 0x2b28, 0x2a2b, 0x2b2b, 0x2a2c, 0x2b2c, 0x2a2f, 0x2b2f, 0x2a2d, 0x2b2d, 0x2a30, 0x2b30, 0x2922, 0x2942, 0x2a37, 0x2b37, 0x2a36, 0x2b36, 0x2a38, 0x2b38, 0x2a35, 0x2b35, 0x2a3a, 0x2b3a, 0x2a3b, 0x2b3b, 0x2a3d, 0x2b3d, 0x2a3c, 0x2a3e, 0x2b3e, 0x2924, 0x2944, 0x2a47, 0x2b47, 0x2a45, 0x2b45, 0x2a46, 0x2b46, 0x2a44, 0x2945, 0x2926, 0x2946, 0x2a48, 0x2b48, 0x2a49, 0x2b49, 0x2947, 0x2a4a, 0x2b4a, 0x2a4c, 0x2b4c, 0x2a4b, 0x2b4b, 0x2929, 0x2949, 0x2928, 0x2948, 0x2a4d, 0x2b4d, 0x2a4f, 0x2b4f, 0x2a4e, 0x2b4e, 0x294a, 0x292b, 0x294b, 0x2a57, 0x2b57, 0x2a56, 0x2b56, 0x292d, 0x294d, 0x2a59, 0x2b59, 0x2a5b, 0x2b5b, 0x2a5a, 0x2b5a, 0x2a5c, 0x2b5c, 0x2a5d, 0x2b5d, 0x2a5f, 0x2b5f, 0x2a5e, 0x2b5e, 0x2a61, 0x2b61, 0x2a60, 0x2b60, 0x292f, 0x294f, 0x2a6c, 0x2b6c, 0x2a69, 0x2b69, 0x2a66, 0x2b66, 0x2a6b, 0x2b6b, 0x2a68, 0x2b68, 0x2a6a, 0x2b6a, 0x2a71, 0x2b71, 0x2a74, 0x2b74, 0x2a73, 0x2a75, 0x2b75, 0x2a77, 0x2b77, 0x2a76, 0x2b76, 0x2a26, 0x2b26, 0x2a43, 0x2b43, 0x2a55, 0x2b55, 0x2a67, 0x2b67, 0x2a70, 0x2b70, 0x2a6d, 0x2b6d, 0x2a6f, 0x2b6f, 0x2a6e, 0x2b6e, 0x2b39, 0x2230, 0x222f, 0x2232, 0x2236, 0x2235, 0x2233, 0x2238, 0x2239, 0x2661, 0x2662, 0x2663, 0x2664, 0x2667, 0x2669, 0x266c, 0x2676, 0x2665, 0x266a, 0x2671, 0x2672, 0x2673, 0x2674, 0x267b, 0x2678, 0x2675, 0x267a, 0x2677, 0x2679, 0x267c, 0x2742, 0x2743, 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x2749, 0x274a, 0x274b, 0x274c, 0x274d, 0x274e, 0x2772, 0x2773, 0x2774, 0x2775, 0x2776, 0x2777, 0x2778, 0x2779, 0x277a, 0x277b, 0x277c, 0x277d, 0x277e, 0x2271, 0x226f, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027, 0x3028, 0x3029, 0x302a, 0x302b, 0x302c, 0x302d, 0x302e, 0x302f, 0x3030, 0x3031, 0x3032, 0x3033, 0x3034, 0x3035, 0x3036, 0x3037, 0x3038, 0x3039, 0x303a, 0x303b, 0x303c, 0x303d, 0x303e, 0x303f, 0x3040, 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, 0x305f, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, 0x3129, 0x312a, 0x312b, 0x312c, 0x312d, 0x312e, 0x312f, 0x3130, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, 0x3158, 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x3176, 0x315f, 0x3160, 0x3161, 0x3162, 0x3163, 0x3164, 0x3165, 0x3166, 0x3167, 0x3168, 0x3169, 0x316a, 0x316b, 0x316c, 0x316d, 0x316e, 0x316f, 0x3170, 0x3171, 0x3172, 0x3173, 0x3174, 0x3175, 0x3177, 0x3178, 0x3179, 0x317a, 0x317b, 0x317c, 0x317d, 0x317e, 0x3221, 0x3222, 0x3223, 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, 0x322a, 0x322b, 0x322c, 0x322d, 0x322e, 0x322f, 0x3230, 0x3231, 0x3232, 0x3233, 0x3234, 0x3235, 0x3236, 0x3237, 0x3238, 0x3239, 0x323a, 0x323b, 0x323c, 0x323d, 0x323e, 0x323f, 0x3240, 0x3241, 0x3242, 0x3243, 0x3244, 0x3245, 0x3251, 0x3246, 0x3247, 0x3248, 0x3249, 0x324a, 0x324b, 0x324c, 0x324d, 0x324e, 0x324f, 0x3250, 0x3252, 0x3253, 0x3254, 0x3255, 0x3256, 0x3257, 0x3258, 0x3259, 0x325a, 0x325b, 0x325c, 0x325d, 0x325e, 0x325f, 0x3260, 0x3261, 0x3262, 0x3263, 0x3264, 0x3265, 0x3266, 0x3267, 0x3268, 0x3269, 0x326a, 0x326b, 0x326c, 0x326d, 0x326e, 0x326f, 0x3270, 0x3271, 0x3272, 0x3273, 0x3274, 0x3275, 0x3276, 0x3277, 0x3278, 0x3279, 0x327a, 0x327b, 0x327c, 0x327d, 0x327e, 0x3321, 0x3322, 0x3323, 0x3324, 0x3325, 0x3326, 0x3327, 0x3328, 0x3329, 0x332a, 0x332b, 0x332c, 0x332d, 0x332e, 0x332f, 0x3330, 0x3331, 0x3332, 0x3333, 0x3334, 0x3335, 0x3336, 0x3337, 0x3338, 0x3339, 0x333a, 0x333b, 0x333c, 0x333d, 0x333e, 0x333f, 0x3340, 0x3341, 0x3342, 0x3343, 0x3344, 0x3345, 0x3346, 0x3347, 0x3348, 0x3349, 0x334a, 0x334b, 0x334c, 0x334d, 0x334e, 0x334f, 0x3350, 0x3351, 0x3352, 0x3353, 0x3354, 0x3355, 0x3356, 0x3357, 0x3358, 0x3359, 0x335a, 0x335b, 0x335c, 0x335d, 0x335e, 0x335f, 0x3360, 0x3361, 0x3362, 0x3363, 0x3364, 0x3365, 0x3366, 0x3367, 0x3368, 0x3369, 0x336a, 0x336b, 0x336c, 0x336d, 0x336e, 0x336f, 0x3370, 0x3371, 0x3372, 0x3373, 0x3374, 0x3375, 0x3376, 0x3377, 0x3378, 0x3379, 0x337a, 0x337b, 0x337c, 0x337d, 0x337e, 0x3421, 0x3422, 0x3423, 0x3424, 0x3425, 0x3426, 0x3427, 0x3428, 0x3429, 0x342a, 0x342b, 0x342c, 0x342d, 0x342e, 0x342f, 0x3430, 0x3431, 0x3432, 0x3433, 0x3434, 0x3435, 0x3436, 0x3438, 0x3437, 0x3439, 0x343a, 0x343b, 0x343c, 0x343d, 0x343e, 0x343f, 0x3440, 0x3441, 0x3442, 0x3443, 0x3444, 0x3445, 0x3446, 0x3447, 0x3448, 0x3449, 0x344a, 0x344b, 0x344c, 0x344d, 0x344e, 0x344f, 0x3450, 0x3451, 0x3452, 0x3453, 0x3454, 0x3455, 0x3456, 0x3457, 0x3458, 0x3459, 0x345a, 0x345b, 0x345c, 0x345d, 0x345e, 0x345f, 0x3460, 0x3461, 0x3462, 0x3463, 0x3464, 0x3465, 0x3466, 0x3467, 0x3468, 0x3469, 0x346a, 0x346b, 0x346c, 0x346d, 0x346e, 0x346f, 0x3470, 0x3471, 0x3472, 0x3473, 0x3474, 0x3475, 0x3476, 0x3477, 0x3478, 0x3479, 0x347a, 0x347b, 0x347c, 0x347d, 0x347e, 0x3521, 0x3522, 0x3523, 0x3524, 0x3525, 0x3526, 0x3527, 0x3528, 0x3529, 0x352a, 0x352b, 0x352c, 0x352d, 0x352e, 0x352f, 0x3530, 0x3531, 0x3532, 0x3533, 0x3534, 0x3535, 0x3536, 0x3537, 0x3538, 0x3539, 0x353a, 0x353b, 0x353c, 0x353d, 0x353e, 0x353f, 0x3540, 0x3541, 0x3542, 0x3543, 0x3544, 0x3545, 0x3546, 0x3547, 0x3548, 0x3549, 0x354a, 0x354b, 0x354c, 0x354d, 0x354e, 0x354f, 0x3550, 0x3551, 0x3552, 0x3553, 0x3554, 0x3555, 0x3556, 0x3557, 0x3558, 0x3559, 0x355a, 0x355b, 0x355c, 0x355d, 0x355e, 0x355f, 0x3560, 0x3561, 0x3562, 0x3563, 0x3564, 0x3565, 0x3566, 0x3567, 0x3568, 0x3569, 0x356a, 0x356b, 0x356c, 0x356d, 0x356e, 0x356f, 0x3570, 0x3571, 0x3572, 0x3573, 0x3574, 0x3575, 0x3576, 0x3577, 0x3578, 0x3579, 0x357a, 0x357b, 0x357c, 0x357d, 0x357e, 0x3621, 0x3622, 0x3623, 0x3624, 0x3625, 0x3626, 0x3627, 0x3628, 0x3629, 0x362a, 0x362b, 0x362c, 0x362d, 0x362e, 0x362f, 0x3630, 0x3631, 0x3632, 0x3633, 0x3634, 0x3635, 0x3636, 0x3637, 0x3638, 0x3639, 0x363a, 0x363b, 0x363c, 0x363d, 0x363e, 0x363f, 0x3640, 0x3641, 0x3642, 0x3643, 0x3644, 0x3645, 0x3646, 0x3647, 0x3648, 0x3649, 0x364a, 0x364b, 0x364c, 0x364d, 0x364e, 0x364f, 0x3650, 0x3651, 0x3652, 0x3653, 0x3654, 0x3655, 0x3656, 0x3657, 0x3658, 0x3659, 0x365a, 0x365b, 0x365c, 0x365d, 0x365e, 0x365f, 0x3660, 0x3661, 0x3662, 0x3663, 0x3664, 0x3665, 0x3666, 0x3667, 0x3668, 0x3669, 0x366a, 0x366b, 0x366c, 0x366d, 0x3670, 0x3671, 0x366e, 0x366f, 0x3672, 0x3673, 0x3674, 0x3675, 0x3676, 0x3677, 0x3678, 0x3679, 0x367a, 0x367b, 0x367d, 0x367e, 0x367c, 0x3721, 0x3722, 0x3723, 0x3724, 0x3725, 0x3726, 0x3727, 0x3728, 0x3729, 0x372a, 0x372b, 0x372c, 0x372d, 0x372e, 0x372f, 0x3730, 0x3731, 0x3732, 0x3733, 0x3734, 0x3735, 0x3736, 0x3737, 0x3738, 0x3739, 0x373a, 0x373b, 0x373c, 0x373d, 0x373e, 0x373f, 0x3740, 0x3741, 0x3742, 0x3743, 0x3744, 0x3745, 0x3746, 0x3747, 0x3748, 0x3749, 0x374a, 0x374b, 0x374c, 0x374d, 0x374e, 0x374f, 0x3750, 0x3751, 0x3752, 0x3753, 0x3754, 0x3755, 0x3756, 0x3757, 0x3760, 0x3758, 0x3759, 0x375a, 0x375b, 0x375c, 0x375d, 0x375e, 0x375f, 0x3761, 0x3762, 0x3763, 0x3764, 0x3765, 0x3766, 0x3767, 0x3768, 0x3769, 0x376a, 0x376b, 0x376c, 0x376d, 0x377e, 0x376e, 0x376f, 0x3770, 0x3771, 0x3772, 0x3773, 0x3774, 0x3775, 0x3776, 0x3777, 0x3778, 0x3779, 0x377a, 0x377b, 0x377c, 0x377d, 0x3821, 0x3822, 0x3823, 0x3824, 0x3825, 0x3826, 0x3827, 0x3828, 0x3829, 0x382a, 0x382b, 0x382c, 0x382d, 0x382e, 0x382f, 0x3830, 0x3831, 0x3832, 0x3833, 0x3834, 0x3835, 0x3836, 0x3837, 0x3838, 0x3839, 0x383a, 0x383b, 0x383c, 0x383d, 0x383e, 0x383f, 0x3840, 0x3841, 0x3842, 0x3843, 0x3844, 0x3845, 0x3846, 0x3847, 0x3848, 0x3849, 0x384a, 0x384b, 0x384c, 0x384d, 0x384e, 0x3850, 0x3851, 0x384f, 0x3852, 0x3853, 0x3854, 0x3855, 0x3856, 0x3857, 0x3858, 0x3859, 0x385a, 0x385b, 0x385c, 0x385d, 0x385e, 0x385f, 0x3860, 0x3861, 0x3862, 0x3863, 0x3864, 0x3865, 0x3867, 0x3868, 0x3869, 0x386a, 0x386b, 0x386c, 0x386d, 0x386e, 0x386f, 0x3870, 0x3871, 0x3872, 0x3873, 0x3874, 0x3875, 0x3876, 0x3877, 0x3878, 0x3879, 0x387a, 0x387b, 0x387c, 0x387d, 0x387e, 0x3921, 0x3922, 0x3923, 0x3924, 0x3925, 0x3926, 0x3927, 0x3928, 0x3929, 0x392a, 0x392b, 0x392c, 0x392d, 0x392e, 0x392f, 0x3930, 0x3931, 0x3932, 0x3933, 0x3934, 0x3935, 0x3936, 0x3937, 0x3938, 0x3939, 0x393a, 0x393b, 0x393c, 0x393d, 0x393e, 0x393f, 0x3940, 0x3941, 0x3942, 0x3943, 0x3944, 0x3945, 0x3946, 0x3947, 0x3948, 0x3949, 0x394a, 0x394b, 0x394c, 0x394d, 0x394e, 0x394f, 0x3950, 0x3951, 0x3952, 0x3953, 0x3954, 0x3955, 0x3956, 0x3957, 0x3958, 0x3959, 0x395a, 0x395b, 0x395c, 0x395d, 0x395e, 0x395f, 0x3960, 0x3961, 0x3962, 0x3963, 0x3964, 0x3965, 0x3966, 0x3967, 0x3968, 0x3969, 0x396a, 0x396b, 0x396c, 0x396d, 0x396e, 0x396f, 0x3970, 0x3971, 0x3972, 0x3973, 0x3974, 0x3975, 0x3976, 0x3977, 0x3978, 0x3979, 0x397a, 0x397b, 0x397c, 0x397d, 0x397e, 0x3a21, 0x3a22, 0x3a23, 0x3a24, 0x3a25, 0x3a26, 0x3a27, 0x3a28, 0x3a29, 0x3a2a, 0x3a2b, 0x3a2c, 0x3a2d, 0x3a2e, 0x3a2f, 0x3a30, 0x3a31, 0x3a33, 0x3a34, 0x3a35, 0x3a36, 0x3a37, 0x3a38, 0x3a32, 0x3a39, 0x3a3a, 0x3a3b, 0x3a3c, 0x3a3d, 0x3a3e, 0x3a3f, 0x3a40, 0x3a41, 0x3a42, 0x3a43, 0x3a44, 0x3a45, 0x3a46, 0x3a47, 0x3a48, 0x3a49, 0x3a4a, 0x3a4b, 0x3a4c, 0x3a4d, 0x3a4e, 0x3a4f, 0x3a50, 0x3a51, 0x3a52, 0x3a53, 0x3a54, 0x3a55, 0x3a56, 0x3a57, 0x3a58, 0x3a59, 0x3a5a, 0x3a5b, 0x3a5c, 0x3a5d, 0x3a5e, 0x3a5f, 0x3a60, 0x3a61, 0x3a62, 0x3a63, 0x3a64, 0x3a65, 0x3a66, 0x3a67, 0x3a68, 0x3a69, 0x3a6a, 0x3a6b, 0x3a6c, 0x3a6d, 0x3a6e, 0x3a6f, 0x3a70, 0x3a71, 0x3a72, 0x3a73, 0x3a74, 0x3a75, 0x3a76, 0x3a77, 0x3a78, 0x3a79, 0x3a7a, 0x3a7b, 0x3a7c, 0x3a7d, 0x3a7e, 0x3b21, 0x3b22, 0x3b23, 0x3b24, 0x3b25, 0x3b26, 0x3b27, 0x3b28, 0x3b29, 0x3b2a, 0x3b2b, 0x3b2c, 0x3b2d, 0x3b2e, 0x3b2f, 0x3b30, 0x3b31, 0x3b32, 0x3b33, 0x3b34, 0x3b35, 0x3b36, 0x3b37, 0x3b38, 0x3b39, 0x3b3a, 0x3b3b, 0x3b3d, 0x3b3c, 0x3b3e, 0x3b3f, 0x3b40, 0x3b41, 0x3b42, 0x3b43, 0x3b44, 0x3b45, 0x3b47, 0x3b48, 0x3b49, 0x3b4a, 0x3b46, 0x3b4b, 0x3b4c, 0x3b4d, 0x3b4e, 0x3b4f, 0x3b50, 0x3b51, 0x3b52, 0x3b53, 0x3b57, 0x3b55, 0x3b54, 0x3b56, 0x3b58, 0x3b59, 0x3b5a, 0x3b5b, 0x3b5c, 0x3b5d, 0x3b5e, 0x3b5f, 0x3b60, 0x3b61, 0x3b62, 0x3b63, 0x3b64, 0x3b65, 0x3b66, 0x3b67, 0x3b68, 0x3b69, 0x3b6a, 0x3b6b, 0x3b6c, 0x3b6d, 0x3b6e, 0x3b6f, 0x3b70, 0x3b71, 0x3b72, 0x6674, 0x3b73, 0x3b74, 0x3b75, 0x3b76, 0x3b77, 0x3b78, 0x3b7a, 0x3b79, 0x3b7b, 0x3b7c, 0x3b7d, 0x3b7e, 0x3c21, 0x3c22, 0x3c23, 0x3c24, 0x3c25, 0x3c26, 0x3c27, 0x3c28, 0x3c29, 0x3c2a, 0x3c2b, 0x3c2c, 0x3c2e, 0x3c2d, 0x3c2f, 0x3c30, 0x3c31, 0x3c34, 0x3c32, 0x3c33, 0x3c35, 0x3c36, 0x3c37, 0x3c38, 0x3c39, 0x3c3a, 0x3c3b, 0x3c3c, 0x3c3d, 0x3c3e, 0x3c3f, 0x3c40, 0x3c41, 0x3c42, 0x3c43, 0x3c44, 0x3c45, 0x3c46, 0x3c47, 0x3c48, 0x3c49, 0x3c4a, 0x3c4b, 0x3c4c, 0x3c4d, 0x3c4e, 0x3c4f, 0x3c50, 0x3c52, 0x3c51, 0x3c53, 0x3c54, 0x3c55, 0x3c56, 0x3c57, 0x3c58, 0x3c59, 0x3c5a, 0x3c5b, 0x3c5c, 0x3c5d, 0x3c5e, 0x3c5f, 0x3c60, 0x3c61, 0x3c62, 0x3c63, 0x3c64, 0x3c65, 0x3c66, 0x3c67, 0x3c68, 0x3c69, 0x3c6a, 0x3c6b, 0x3c6c, 0x3c6d, 0x3c6e, 0x3c6f, 0x3c70, 0x3c71, 0x3c72, 0x3c73, 0x3c74, 0x3c75, 0x3c76, 0x3c77, 0x3c78, 0x3c79, 0x3c7a, 0x3c7b, 0x3c7c, 0x3c7d, 0x3c7e, 0x3d21, 0x3d22, 0x3d23, 0x3d24, 0x3d25, 0x3d26, 0x3d27, 0x3d28, 0x3d29, 0x3d2a, 0x3d2b, 0x3d2c, 0x3d2d, 0x3d2e, 0x3d2f, 0x3d32, 0x3d30, 0x3d31, 0x3d33, 0x3d34, 0x3d35, 0x3d36, 0x3d37, 0x3d38, 0x3d39, 0x3d3a, 0x3d3b, 0x3d3c, 0x3d3d, 0x3d3e, 0x3d3f, 0x3d40, 0x3d41, 0x3d42, 0x3d43, 0x3d44, 0x3d45, 0x3d46, 0x3d47, 0x3d48, 0x3d49, 0x3d4a, 0x3d4b, 0x3d4c, 0x3d4d, 0x3d4e, 0x3d4f, 0x3d50, 0x3d51, 0x3d52, 0x3d53, 0x3d54, 0x3d55, 0x3d56, 0x3d57, 0x3d58, 0x3d59, 0x3d5a, 0x3d5b, 0x3d5c, 0x3d5d, 0x3d5e, 0x3d5f, 0x3d60, 0x3d61, 0x3d62, 0x3d63, 0x3d64, 0x3d65, 0x3d66, 0x3d67, 0x3d68, 0x3d69, 0x3d6a, 0x3d6b, 0x3d6c, 0x3d6d, 0x3d6e, 0x3d6f, 0x3d70, 0x3d71, 0x3d72, 0x3d73, 0x3d74, 0x3d75, 0x3d76, 0x3d77, 0x3d78, 0x3d79, 0x3d7a, 0x3d7b, 0x3d7c, 0x3d7d, 0x3d7e, 0x3e21, 0x3e22, 0x3e23, 0x3e24, 0x3e25, 0x3e26, 0x3e27, 0x3e28, 0x3e29, 0x3e2a, 0x3e2b, 0x3e2c, 0x3e2d, 0x3e2e, 0x3e2f, 0x3e30, 0x3e31, 0x3e32, 0x3e33, 0x3e34, 0x3e35, 0x3e36, 0x3e37, 0x3e38, 0x3e39, 0x3e3a, 0x3e3b, 0x3e3c, 0x3e3d, 0x3e3e, 0x3e3f, 0x3e40, 0x3e41, 0x3e42, 0x3e43, 0x3e44, 0x3e45, 0x3e46, 0x3e47, 0x3e48, 0x3e49, 0x3e4a, 0x3e4b, 0x3e4c, 0x3e4d, 0x3e4e, 0x3e4f, 0x3e50, 0x3e51, 0x3e52, 0x3e53, 0x3e54, 0x3e55, 0x3e56, 0x3e57, 0x3e58, 0x3e59, 0x3e5a, 0x3e5b, 0x3e5c, 0x3e5d, 0x3e5e, 0x3e5f, 0x3e60, 0x3e61, 0x3e62, 0x3e63, 0x3e64, 0x3e65, 0x3e66, 0x3e67, 0x3e68, 0x3e69, 0x3e6a, 0x3e6b, 0x3e6c, 0x3e6d, 0x3e6e, 0x3e6f, 0x3e70, 0x3e71, 0x3e72, 0x3e73, 0x3e74, 0x3e75, 0x3e76, 0x3e77, 0x3e78, 0x3e79, 0x3e7a, 0x3e7b, 0x3e7e, 0x3e7c, 0x3e7d, 0x3f21, 0x3f22, 0x3f23, 0x3f24, 0x3f25, 0x3f26, 0x3f27, 0x3f28, 0x3f29, 0x3f2a, 0x3f2b, 0x3f2c, 0x3f2d, 0x3f2e, 0x3f2f, 0x3f30, 0x3f31, 0x3f32, 0x3f33, 0x3f34, 0x3f35, 0x3f36, 0x3f37, 0x3f38, 0x3f39, 0x3f3a, 0x3f3b, 0x3f3c, 0x3f3d, 0x3f3e, 0x3f3f, 0x3f40, 0x3f41, 0x3f42, 0x3f43, 0x3f44, 0x3f45, 0x3f46, 0x3f47, 0x3f48, 0x3f49, 0x3f4a, 0x3f4b, 0x3f4c, 0x3f4d, 0x3f4e, 0x3f4f, 0x3f50, 0x3f51, 0x3f52, 0x3f53, 0x3f54, 0x3f55, 0x3f56, 0x3f57, 0x3f58, 0x3f59, 0x3f5a, 0x3f5b, 0x3f5c, 0x3f5d, 0x3f5e, 0x3f5f, 0x3f60, 0x3f61, 0x3f62, 0x3f63, 0x3f64, 0x3f65, 0x3f66, 0x3f67, 0x3f68, 0x3f69, 0x3f6a, 0x3f6b, 0x3f6c, 0x3f6d, 0x3f6e, 0x3f6f, 0x3f70, 0x3f71, 0x3f72, 0x3f73, 0x3f74, 0x3f75, 0x3f76, 0x3f77, 0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, 0x3f7d, 0x3f7e, 0x4021, 0x4022, 0x4023, 0x4024, 0x4025, 0x4026, 0x4027, 0x4028, 0x4029, 0x402a, 0x402b, 0x402c, 0x402d, 0x402e, 0x402f, 0x4030, 0x4031, 0x4032, 0x4033, 0x4034, 0x4035, 0x4036, 0x4037, 0x4038, 0x4039, 0x403a, 0x403b, 0x403c, 0x403d, 0x403e, 0x403f, 0x4040, 0x4041, 0x4042, 0x4043, 0x4044, 0x4045, 0x4046, 0x4047, 0x4048, 0x4049, 0x404a, 0x404b, 0x404c, 0x404d, 0x404e, 0x404f, 0x4050, 0x4051, 0x4052, 0x4053, 0x4054, 0x4055, 0x4056, 0x4057, 0x4058, 0x4059, 0x405a, 0x405b, 0x405c, 0x405d, 0x405e, 0x405f, 0x4060, 0x4061, 0x4062, 0x4063, 0x4064, 0x4065, 0x4066, 0x4067, 0x4068, 0x4069, 0x406a, 0x406b, 0x406c, 0x406d, 0x406e, 0x406f, 0x4070, 0x4071, 0x4072, 0x4073, 0x4074, 0x4075, 0x4076, 0x4077, 0x4078, 0x4079, 0x407a, 0x407b, 0x407c, 0x407d, 0x407e, 0x4121, 0x4122, 0x4123, 0x4124, 0x4125, 0x4126, 0x4127, 0x4128, 0x4129, 0x412a, 0x412b, 0x412c, 0x412d, 0x412e, 0x412f, 0x4130, 0x4131, 0x4132, 0x4133, 0x4134, 0x4135, 0x4136, 0x4137, 0x4138, 0x4139, 0x413a, 0x413b, 0x413c, 0x413d, 0x413e, 0x413f, 0x4140, 0x4141, 0x4142, 0x4143, 0x4144, 0x4145, 0x4146, 0x4147, 0x4148, 0x4149, 0x414a, 0x414b, 0x414c, 0x414d, 0x414e, 0x414f, 0x4150, 0x4151, 0x4152, 0x4153, 0x4154, 0x4155, 0x4156, 0x4157, 0x4158, 0x4159, 0x415a, 0x415b, 0x415c, 0x415d, 0x415e, 0x415f, 0x4160, 0x4161, 0x4162, 0x4163, 0x4164, 0x4165, 0x4166, 0x4167, 0x4168, 0x4169, 0x416a, 0x416b, 0x416c, 0x416d, 0x416e, 0x416f, 0x4170, 0x4171, 0x4172, 0x4173, 0x4174, 0x4175, 0x4176, 0x4177, 0x4178, 0x4179, 0x417a, 0x417b, 0x417c, 0x417d, 0x417e, 0x4221, 0x4222, 0x4223, 0x4224, 0x4225, 0x4226, 0x4227, 0x4228, 0x4229, 0x422a, 0x422b, 0x422c, 0x422d, 0x422e, 0x4230, 0x422f, 0x4231, 0x4232, 0x4233, 0x4234, 0x4235, 0x4237, 0x4236, 0x4238, 0x4239, 0x423a, 0x423b, 0x423c, 0x423d, 0x423e, 0x4240, 0x4241, 0x4242, 0x4244, 0x4245, 0x4247, 0x4248, 0x4249, 0x424a, 0x424c, 0x4243, 0x4246, 0x424b, 0x424d, 0x424e, 0x424f, 0x4250, 0x4251, 0x4252, 0x4253, 0x4254, 0x4255, 0x4256, 0x4257, 0x4258, 0x4259, 0x425a, 0x425b, 0x425c, 0x425d, 0x425e, 0x425f, 0x4260, 0x4261, 0x4262, 0x4263, 0x4264, 0x4265, 0x4266, 0x4267, 0x4268, 0x4269, 0x426a, 0x426b, 0x426c, 0x426d, 0x423f, 0x426e, 0x426f, 0x4270, 0x4271, 0x4272, 0x4273, 0x4274, 0x4275, 0x4276, 0x4277, 0x4278, 0x4279, 0x427a, 0x427b, 0x427c, 0x427d, 0x427e, 0x4321, 0x4322, 0x4323, 0x4324, 0x4325, 0x4326, 0x4327, 0x4328, 0x4329, 0x432a, 0x432b, 0x432c, 0x432d, 0x432e, 0x432f, 0x4330, 0x4331, 0x4332, 0x4333, 0x4334, 0x4335, 0x4336, 0x4337, 0x4339, 0x433a, 0x433b, 0x433c, 0x433d, 0x433e, 0x433f, 0x4340, 0x4341, 0x4342, 0x4343, 0x4344, 0x4345, 0x4346, 0x4347, 0x4348, 0x4338, 0x434a, 0x434b, 0x434c, 0x434d, 0x434f, 0x434e, 0x4350, 0x4351, 0x4352, 0x4353, 0x4354, 0x4355, 0x4356, 0x4357, 0x4358, 0x4359, 0x435a, 0x435b, 0x4349, 0x435c, 0x435d, 0x435e, 0x435f, 0x4360, 0x4361, 0x4362, 0x4363, 0x4364, 0x4365, 0x4366, 0x4367, 0x4368, 0x4369, 0x436a, 0x436b, 0x436c, 0x436d, 0x436e, 0x436f, 0x4370, 0x4371, 0x4372, 0x4373, 0x4374, 0x4375, 0x4376, 0x4377, 0x4378, 0x4379, 0x437a, 0x437b, 0x437c, 0x437d, 0x437e, 0x4421, 0x4422, 0x4423, 0x4424, 0x4425, 0x4426, 0x4427, 0x4428, 0x4429, 0x442a, 0x442b, 0x442c, 0x442d, 0x442e, 0x442f, 0x4430, 0x4431, 0x4432, 0x4433, 0x4434, 0x4435, 0x4436, 0x4437, 0x4438, 0x4439, 0x443a, 0x443b, 0x443c, 0x443d, 0x443e, 0x443f, 0x4440, 0x4441, 0x4442, 0x4443, 0x4444, 0x4445, 0x4446, 0x4447, 0x4448, 0x4449, 0x444a, 0x444b, 0x444c, 0x444d, 0x444e, 0x444f, 0x4450, 0x4451, 0x4452, 0x4453, 0x4454, 0x4455, 0x4456, 0x4457, 0x4458, 0x4459, 0x445a, 0x445b, 0x445c, 0x445d, 0x445e, 0x445f, 0x4460, 0x4461, 0x4462, 0x4463, 0x4464, 0x4465, 0x4466, 0x4467, 0x4468, 0x4469, 0x446a, 0x446b, 0x446c, 0x446d, 0x446e, 0x446f, 0x4470, 0x4471, 0x4472, 0x4473, 0x4474, 0x4475, 0x4476, 0x4477, 0x4478, 0x4479, 0x447a, 0x447b, 0x447c, 0x447d, 0x447e, 0x4521, 0x4522, 0x4523, 0x4524, 0x4525, 0x4526, 0x4527, 0x4528, 0x4529, 0x452a, 0x452b, 0x452c, 0x452d, 0x452e, 0x452f, 0x4530, 0x4531, 0x4532, 0x4533, 0x4534, 0x4535, 0x4536, 0x4537, 0x4538, 0x4539, 0x453a, 0x453b, 0x453c, 0x453d, 0x453e, 0x453f, 0x4540, 0x4541, 0x4542, 0x4543, 0x4544, 0x4545, 0x4546, 0x4547, 0x4548, 0x4549, 0x454a, 0x454b, 0x454d, 0x454c, 0x454e, 0x454f, 0x4550, 0x4551, 0x4552, 0x4553, 0x4554, 0x4555, 0x4556, 0x4557, 0x4558, 0x4559, 0x455a, 0x455b, 0x455c, 0x455d, 0x455e, 0x455f, 0x4560, 0x4561, 0x4562, 0x4563, 0x4564, 0x4565, 0x4566, 0x4567, 0x4568, 0x4569, 0x456a, 0x456b, 0x456c, 0x456d, 0x456e, 0x456f, 0x4570, 0x4571, 0x4572, 0x4573, 0x4574, 0x4575, 0x4576, 0x4577, 0x4578, 0x4579, 0x457a, 0x457b, 0x457c, 0x457d, 0x457e, 0x4621, 0x4622, 0x4623, 0x4624, 0x4625, 0x4626, 0x4627, 0x4628, 0x4629, 0x462a, 0x462b, 0x462c, 0x462d, 0x462e, 0x462f, 0x4630, 0x4631, 0x4632, 0x4633, 0x4634, 0x4635, 0x4636, 0x4637, 0x4638, 0x4639, 0x463a, 0x463b, 0x463c, 0x463d, 0x463e, 0x463f, 0x4640, 0x4641, 0x4642, 0x4643, 0x4644, 0x4645, 0x4646, 0x4647, 0x4648, 0x4649, 0x464a, 0x464b, 0x464c, 0x464d, 0x464e, 0x464f, 0x4650, 0x4651, 0x4652, 0x4653, 0x4654, 0x4655, 0x4656, 0x4657, 0x4658, 0x4659, 0x465a, 0x465b, 0x465c, 0x465d, 0x465e, 0x465f, 0x4660, 0x4736, 0x4661, 0x4662, 0x4663, 0x4664, 0x4665, 0x4666, 0x4667, 0x4668, 0x4669, 0x466a, 0x466b, 0x466c, 0x466d, 0x466e, 0x466f, 0x4670, 0x4671, 0x4672, 0x4673, 0x4674, 0x4675, 0x4676, 0x4677, 0x4678, 0x4679, 0x467a, 0x467b, 0x467c, 0x467d, 0x467e, 0x4721, 0x4722, 0x4723, 0x4724, 0x4725, 0x4726, 0x4727, 0x4728, 0x4729, 0x472a, 0x472b, 0x472c, 0x472d, 0x472e, 0x472f, 0x4730, 0x4731, 0x4732, 0x4733, 0x4734, 0x4735, 0x4737, 0x4738, 0x4739, 0x473a, 0x473b, 0x473c, 0x473d, 0x473e, 0x473f, 0x4740, 0x4741, 0x4742, 0x4743, 0x4744, 0x4745, 0x4746, 0x4747, 0x4748, 0x4749, 0x474a, 0x474b, 0x474c, 0x474d, 0x474e, 0x474f, 0x4750, 0x4751, 0x4752, 0x4753, 0x4754, 0x4755, 0x4756, 0x4757, 0x4758, 0x4759, 0x475a, 0x475b, 0x475c, 0x475d, 0x475e, 0x475f, 0x4760, 0x4761, 0x4762, 0x4763, 0x4764, 0x4765, 0x4766, 0x4767, 0x4768, 0x4769, 0x476a, 0x476b, 0x476c, 0x476d, 0x476e, 0x476f, 0x4770, 0x4771, 0x4772, 0x4773, 0x4774, 0x4775, 0x4776, 0x4777, 0x4778, 0x4779, 0x477a, 0x477b, 0x477c, 0x477d, 0x477e, 0x4821, 0x4822, 0x4823, 0x4824, 0x4825, 0x4826, 0x4827, 0x4828, 0x4829, 0x482a, 0x482b, 0x482c, 0x482d, 0x482e, 0x482f, 0x4830, 0x4831, 0x4832, 0x4833, 0x4834, 0x4835, 0x4836, 0x4837, 0x4838, 0x4839, 0x483a, 0x483b, 0x483c, 0x483d, 0x483e, 0x483f, 0x4840, 0x4841, 0x4842, 0x4843, 0x4844, 0x4845, 0x4846, 0x4847, 0x4848, 0x4849, 0x484a, 0x484b, 0x484c, 0x4853, 0x484d, 0x484e, 0x484f, 0x4850, 0x4851, 0x4852, 0x4854, 0x4855, 0x4856, 0x4857, 0x4858, 0x4859, 0x485a, 0x485b, 0x485c, 0x485d, 0x485e, 0x485f, 0x4860, 0x4861, 0x4862, 0x4863, 0x4864, 0x4865, 0x4866, 0x4867, 0x4868, 0x4869, 0x486a, 0x486b, 0x486c, 0x486d, 0x486e, 0x486f, 0x4870, 0x4871, 0x4872, 0x4873, 0x4874, 0x4875, 0x4876, 0x4877, 0x4878, 0x4879, 0x487a, 0x487b, 0x487c, 0x487d, 0x487e, 0x4921, 0x4922, 0x4923, 0x4924, 0x4925, 0x4926, 0x4927, 0x4928, 0x4929, 0x492a, 0x492b, 0x492c, 0x492d, 0x492e, 0x492f, 0x4930, 0x4931, 0x4932, 0x4933, 0x4934, 0x4935, 0x4936, 0x4937, 0x4938, 0x4939, 0x493a, 0x493b, 0x493c, 0x4941, 0x493d, 0x493e, 0x493f, 0x4940, 0x4942, 0x4943, 0x4944, 0x4945, 0x4946, 0x4947, 0x4948, 0x4949, 0x494a, 0x494b, 0x494c, 0x494d, 0x494e, 0x494f, 0x4950, 0x4951, 0x4952, 0x4953, 0x4954, 0x4955, 0x4956, 0x4957, 0x4958, 0x4959, 0x495a, 0x495b, 0x495c, 0x495d, 0x495e, 0x495f, 0x4960, 0x4961, 0x4962, 0x4963, 0x4964, 0x4965, 0x4966, 0x4967, 0x4968, 0x4969, 0x496a, 0x496b, 0x496c, 0x496d, 0x496e, 0x496f, 0x4970, 0x4971, 0x4972, 0x4973, 0x4974, 0x4975, 0x4976, 0x4977, 0x4978, 0x4979, 0x497a, 0x497b, 0x497c, 0x497d, 0x497e, 0x4a21, 0x4a22, 0x4a23, 0x4a24, 0x4a25, 0x4a26, 0x4a27, 0x4a28, 0x4a29, 0x4a2a, 0x4a2b, 0x4a2c, 0x4a2d, 0x4a2e, 0x4a2f, 0x4a30, 0x4a31, 0x4a32, 0x4a33, 0x4a34, 0x4a35, 0x4a36, 0x4a37, 0x4a38, 0x4a39, 0x4a3a, 0x4a3b, 0x4a3c, 0x4a3d, 0x4a3e, 0x4a3f, 0x4a40, 0x4a41, 0x4a42, 0x4a43, 0x4a44, 0x4a45, 0x4a46, 0x4a47, 0x4a48, 0x4a49, 0x4a4a, 0x4a4b, 0x4a4c, 0x4a4d, 0x4a4e, 0x4a4f, 0x4a50, 0x4a51, 0x4a52, 0x4a53, 0x4a54, 0x4a55, 0x4a56, 0x4a57, 0x4a58, 0x4a59, 0x4a5a, 0x4a5b, 0x4a5c, 0x4a5d, 0x4a5e, 0x4a5f, 0x4a60, 0x4a61, 0x4a62, 0x4a63, 0x4a64, 0x4a65, 0x4a66, 0x4a67, 0x4a68, 0x4a69, 0x4a6a, 0x4a6b, 0x4a6c, 0x4a6d, 0x4a6e, 0x4a6f, 0x4a70, 0x4a71, 0x4a72, 0x4a73, 0x4a74, 0x4a75, 0x4a76, 0x4a77, 0x4a78, 0x4a79, 0x4a7a, 0x4a7b, 0x4a7c, 0x4a7d, 0x4a7e, 0x4b21, 0x4b22, 0x4b23, 0x4b24, 0x4b25, 0x4b26, 0x4b27, 0x4b28, 0x4b29, 0x4b2a, 0x4b2b, 0x4b2c, 0x4b2d, 0x4b2e, 0x4b2f, 0x4b30, 0x4b31, 0x4b32, 0x4b33, 0x4b34, 0x4b35, 0x4b36, 0x4b37, 0x4b38, 0x4b39, 0x4b3a, 0x4b3b, 0x4b3c, 0x4b3d, 0x4b3e, 0x4b3f, 0x4b40, 0x4b41, 0x4b42, 0x4b43, 0x4b44, 0x4b45, 0x4b46, 0x4b47, 0x4b48, 0x4b49, 0x4b4a, 0x4b4b, 0x4b4c, 0x4b4d, 0x4b4e, 0x4b4f, 0x4b50, 0x4b51, 0x4b52, 0x4b53, 0x4b54, 0x4b55, 0x4b56, 0x4b57, 0x4b58, 0x4b59, 0x4b5a, 0x4b5b, 0x4b5c, 0x4b5d, 0x4b5e, 0x4b5f, 0x4b60, 0x4b61, 0x4b62, 0x4b63, 0x4b64, 0x4b65, 0x4b66, 0x4b67, 0x4b68, 0x4b69, 0x4b6a, 0x4b6b, 0x4b6c, 0x4b6d, 0x4b6e, 0x4b6f, 0x4b70, 0x4b71, 0x4b72, 0x4b73, 0x4b74, 0x4b75, 0x4b76, 0x4b77, 0x4b78, 0x4b79, 0x4b7a, 0x4b7b, 0x4b7c, 0x4b7d, 0x4b7e, 0x4c21, 0x4c22, 0x4c23, 0x4c24, 0x4c25, 0x4c26, 0x4c27, 0x4c28, 0x4c29, 0x4c2a, 0x4c2b, 0x4c2c, 0x4c2d, 0x4c2e, 0x4c2f, 0x4c30, 0x4c31, 0x4c32, 0x4c33, 0x4c34, 0x4c35, 0x4c36, 0x4c37, 0x4c38, 0x4c39, 0x4c3a, 0x4c3b, 0x4c3c, 0x4c3d, 0x4c3e, 0x4c3f, 0x4c40, 0x4c41, 0x4c42, 0x4c43, 0x4c44, 0x4c45, 0x4c46, 0x4c47, 0x4c48, 0x4c49, 0x4c4a, 0x4c4b, 0x4c4c, 0x4c4d, 0x4c4e, 0x4c4f, 0x4c50, 0x4c51, 0x4c52, 0x4c53, 0x4c54, 0x4c55, 0x4c56, 0x4c57, 0x4c58, 0x4c59, 0x4c5a, 0x4c5b, 0x4c5c, 0x4c5d, 0x4c5e, 0x4c5f, 0x4c60, 0x4c61, 0x4c62, 0x4c63, 0x4c64, 0x4c65, 0x4c66, 0x4c67, 0x4c68, 0x4c69, 0x4c6a, 0x4c6b, 0x4c6c, 0x4c6d, 0x4c6e, 0x4c6f, 0x4c70, 0x4c71, 0x4c72, 0x4c73, 0x4c74, 0x4c75, 0x4c76, 0x4c77, 0x4c78, 0x4c79, 0x4c7a, 0x4c7b, 0x4c7c, 0x4c7d, 0x4c7e, 0x4d21, 0x4d22, 0x4d23, 0x4d24, 0x4d25, 0x4d26, 0x4d27, 0x4d28, 0x4d29, 0x4d2a, 0x4d2b, 0x4d2c, 0x4d2d, 0x4d2e, 0x4d2f, 0x4d30, 0x4d31, 0x4d32, 0x4d33, 0x4d34, 0x4d35, 0x4d36, 0x4d37, 0x4d38, 0x4d39, 0x4d3a, 0x4d3b, 0x4d3c, 0x4d3d, 0x4d3e, 0x4d3f, 0x4d40, 0x4d41, 0x4d42, 0x4d43, 0x4d44, 0x4d45, 0x4d46, 0x4d47, 0x4d48, 0x4d49, 0x4d4a, 0x4d4b, 0x4d4c, 0x4d4d, 0x4d4e, 0x4d4f, 0x4d50, 0x4d51, 0x4d52, 0x4d53, 0x4d54, 0x4d55, 0x4d56, 0x4d57, 0x4d58, 0x4d59, 0x4d5a, 0x4d5b, 0x4d5c, 0x4d5d, 0x4d5e, 0x4d5f, 0x4d60, 0x4d61, 0x4d62, 0x4d63, 0x4d64, 0x4d65, 0x4d66, 0x4d67, 0x4d68, 0x4d69, 0x4d6a, 0x4d6b, 0x4d6c, 0x4d6d, 0x4d6e, 0x4d6f, 0x4d70, 0x4d71, 0x4d72, 0x4d73, 0x4d74, 0x4d75, 0x4d76, 0x4d77, 0x4d78, 0x4d79, 0x4d7a, 0x4d7b, 0x4d7c, 0x4d7d, 0x4d7e, 0x4e21, 0x4e22, 0x4e24, 0x4e25, 0x4e26, 0x4e27, 0x4e28, 0x4e29, 0x4e23, 0x4e2a, 0x4e2b, 0x4e2c, 0x4e2d, 0x4e2e, 0x4e2f, 0x4e30, 0x4e31, 0x4e32, 0x4e33, 0x4e34, 0x4e35, 0x4e36, 0x4e37, 0x4e38, 0x4e39, 0x4e3a, 0x4e3b, 0x4e3c, 0x4e3d, 0x4e3e, 0x4e3f, 0x4e40, 0x4e41, 0x4e42, 0x4e43, 0x4e44, 0x4e45, 0x4e46, 0x4e47, 0x4e48, 0x4e49, 0x4e4a, 0x4e4b, 0x4e4c, 0x4e4d, 0x4e4e, 0x4e4f, 0x4e50, 0x4e51, 0x4e52, 0x4e53, 0x4e54, 0x4e55, 0x4e56, 0x4e57, 0x4e58, 0x4e59, 0x4e5a, 0x4e5b, 0x4e5c, 0x4e5d, 0x4e5e, 0x4e5f, 0x4e60, 0x4e61, 0x4e62, 0x4e63, 0x4e64, 0x4e65, 0x4e66, 0x4e67, 0x4e68, 0x4e69, 0x4e6a, 0x4e6b, 0x4e6c, 0x4e6d, 0x4e6e, 0x4e6f, 0x4e70, 0x4e71, 0x4e72, 0x4e73, 0x4e74, 0x4e75, 0x4e76, 0x4e77, 0x4e78, 0x4e79, 0x4e7a, 0x4e7b, 0x4e7c, 0x4e7d, 0x4e7e, 0x4f21, 0x4f22, 0x4f23, 0x4f24, 0x4f25, 0x4f26, 0x4f27, 0x4f28, 0x4f29, 0x4f2a, 0x4f2b, 0x4f2c, 0x4f2d, 0x4f2e, 0x4f2f, 0x4f30, 0x4f31, 0x4f32, 0x4f33, 0x4f34, 0x4f35, 0x4f36, 0x4f37, 0x4f38, 0x4f39, 0x4f3a, 0x4f3b, 0x4f3c, 0x4f3d, 0x4f3e, 0x4f3f, 0x4f40, 0x4f41, 0x4f42, 0x4f43, 0x4f44, 0x4f45, 0x4f46, 0x4f47, 0x4f48, 0x4f49, 0x4f4a, 0x4f4b, 0x4f4c, 0x4f4d, 0x4f4e, 0x4f4f, 0x4f50, 0x4f51, 0x4f52, 0x4f53, 0x4f54, 0x4f55, 0x4f56, 0x4f57, 0x4f58, 0x4f59, 0x4f5a, 0x4f5b, 0x4f5c, 0x4f5d, 0x4f5e, 0x4f5f, 0x4f60, 0x4f61, 0x4f62, 0x4f63, 0x4f64, 0x4f65, 0x4f66, 0x4f67, 0x4f68, 0x4f69, 0x4f6a, 0x4f6b, 0x4f6c, 0x4f6d, 0x4f6e, 0x4f6f, 0x4f70, 0x4f71, 0x4f72, 0x4f74, 0x4f75, 0x4f76, 0x4f73, 0x4f77, 0x4f78, 0x4f79, 0x4f7a, 0x4f7b, 0x4f7c, 0x4f7d, 0x4f7e, 0x5021, 0x5022, 0x5023, 0x5024, 0x5025, 0x5026, 0x5027, 0x5028, 0x5029, 0x502a, 0x502b, 0x502c, 0x502e, 0x502f, 0x5030, 0x5031, 0x502d, 0x5032, 0x5033, 0x5034, 0x5035, 0x5037, 0x5038, 0x5039, 0x503a, 0x503b, 0x5036, 0x503c, 0x503d, 0x503e, 0x503f, 0x5040, 0x5041, 0x5042, 0x5043, 0x5044, 0x5045, 0x5046, 0x5047, 0x5048, 0x5049, 0x504a, 0x504b, 0x504c, 0x504d, 0x504e, 0x504f, 0x5050, 0x5051, 0x5052, 0x5053, 0x5054, 0x5055, 0x5056, 0x5057, 0x5058, 0x5059, 0x505a, 0x505b, 0x505c, 0x505d, 0x505e, 0x505f, 0x5060, 0x5061, 0x5062, 0x5063, 0x5064, 0x5065, 0x5066, 0x5067, 0x5068, 0x5069, 0x506a, 0x506b, 0x506c, 0x506d, 0x506e, 0x506f, 0x5070, 0x5071, 0x5072, 0x5073, 0x5074, 0x5075, 0x5076, 0x5077, 0x5078, 0x5079, 0x507a, 0x507b, 0x507c, 0x507d, 0x507e, 0x5121, 0x5122, 0x5123, 0x5124, 0x5125, 0x5126, 0x5127, 0x5128, 0x5129, 0x512a, 0x512b, 0x512c, 0x512d, 0x512e, 0x512f, 0x5130, 0x5131, 0x5132, 0x5133, 0x5134, 0x5135, 0x5136, 0x5137, 0x5138, 0x5139, 0x513a, 0x513b, 0x513c, 0x513d, 0x513e, 0x513f, 0x5140, 0x5141, 0x5142, 0x5143, 0x5144, 0x5145, 0x5146, 0x5147, 0x5148, 0x5149, 0x514a, 0x514b, 0x514c, 0x514d, 0x514e, 0x514f, 0x5150, 0x5151, 0x5152, 0x5153, 0x5154, 0x5155, 0x5156, 0x5157, 0x5158, 0x5159, 0x515a, 0x515b, 0x515c, 0x515d, 0x515e, 0x515f, 0x5160, 0x5161, 0x5162, 0x5163, 0x5164, 0x5165, 0x5166, 0x5167, 0x5168, 0x5169, 0x516a, 0x516b, 0x516c, 0x516d, 0x516e, 0x516f, 0x5170, 0x5171, 0x5172, 0x5173, 0x5174, 0x5175, 0x5176, 0x5177, 0x5178, 0x5179, 0x517a, 0x517b, 0x517c, 0x517d, 0x517e, 0x5221, 0x5222, 0x5223, 0x5224, 0x5225, 0x5226, 0x5227, 0x5228, 0x5229, 0x522a, 0x522b, 0x522c, 0x522d, 0x522e, 0x522f, 0x5230, 0x5231, 0x5232, 0x5233, 0x5234, 0x5235, 0x5236, 0x5237, 0x5238, 0x5239, 0x523a, 0x523b, 0x523c, 0x523d, 0x523e, 0x523f, 0x5240, 0x5241, 0x5242, 0x5243, 0x5244, 0x5245, 0x5246, 0x5247, 0x5248, 0x5249, 0x524a, 0x524b, 0x524c, 0x524d, 0x524e, 0x524f, 0x5250, 0x5251, 0x5252, 0x5253, 0x5254, 0x5255, 0x5256, 0x5257, 0x5258, 0x5259, 0x525a, 0x525b, 0x525c, 0x525d, 0x525e, 0x525f, 0x5260, 0x5261, 0x5262, 0x5263, 0x5264, 0x5265, 0x5266, 0x5267, 0x5268, 0x5269, 0x526a, 0x526b, 0x526c, 0x526d, 0x526e, 0x526f, 0x5270, 0x5271, 0x5272, 0x5273, 0x5274, 0x5276, 0x5277, 0x5278, 0x5275, 0x5279, 0x527a, 0x527b, 0x527c, 0x527d, 0x527e, 0x5321, 0x5322, 0x5323, 0x5324, 0x5325, 0x5326, 0x5327, 0x5328, 0x5329, 0x532a, 0x532b, 0x532c, 0x532d, 0x532e, 0x532f, 0x5330, 0x5331, 0x5332, 0x5333, 0x5334, 0x5335, 0x5336, 0x5337, 0x5338, 0x5339, 0x533a, 0x533b, 0x533c, 0x533d, 0x533e, 0x533f, 0x5340, 0x5341, 0x5342, 0x5343, 0x5344, 0x5345, 0x5346, 0x5347, 0x5348, 0x5349, 0x534a, 0x534b, 0x534c, 0x534d, 0x534e, 0x534f, 0x5350, 0x5351, 0x5352, 0x5353, 0x5354, 0x5355, 0x5356, 0x5357, 0x5358, 0x5359, 0x535a, 0x535b, 0x535c, 0x535d, 0x535e, 0x535f, 0x5360, 0x5361, 0x5362, 0x5363, 0x5364, 0x5365, 0x5366, 0x5367, 0x5368, 0x5369, 0x536a, 0x536b, 0x536c, 0x536d, 0x536e, 0x536f, 0x5370, 0x5371, 0x5372, 0x5373, 0x5374, 0x5375, 0x5376, 0x5377, 0x5378, 0x5379, 0x537a, 0x537b, 0x537c, 0x537d, 0x537e, 0x5421, 0x5422, 0x5423, 0x5424, 0x5425, 0x5426, 0x5427, 0x5428, 0x5429, 0x542a, 0x542b, 0x542c, 0x542d, 0x542e, 0x542f, 0x5430, 0x5431, 0x5432, 0x5434, 0x5435, 0x5436, 0x5437, 0x5438, 0x5439, 0x543a, 0x543b, 0x543c, 0x543d, 0x543e, 0x5433, 0x543f, 0x5440, 0x5441, 0x5442, 0x5443, 0x5444, 0x5445, 0x5446, 0x5447, 0x5448, 0x5449, 0x544a, 0x544b, 0x544c, 0x544d, 0x544e, 0x544f, 0x5450, 0x5451, 0x5452, 0x5453, 0x5454, 0x5455, 0x5456, 0x5457, 0x5458, 0x5459, 0x545a, 0x545b, 0x545c, 0x545d, 0x545e, 0x545f, 0x5460, 0x5461, 0x5462, 0x5463, 0x5464, 0x5465, 0x5466, 0x5467, 0x5468, 0x5469, 0x546a, 0x546c, 0x546b, 0x546d, 0x546e, 0x546f, 0x5470, 0x5471, 0x5472, 0x5473, 0x5474, 0x5475, 0x5476, 0x5477, 0x5478, 0x5479, 0x547a, 0x547b, 0x547c, 0x547d, 0x547e, 0x5521, 0x5522, 0x5523, 0x5524, 0x5525, 0x5526, 0x5527, 0x5528, 0x5529, 0x552a, 0x552b, 0x552c, 0x552d, 0x552e, 0x552f, 0x5530, 0x5531, 0x5532, 0x5533, 0x5534, 0x5535, 0x5536, 0x5537, 0x5538, 0x5539, 0x553a, 0x553b, 0x553c, 0x553d, 0x553e, 0x553f, 0x5540, 0x5541, 0x5542, 0x5543, 0x5544, 0x5545, 0x5546, 0x5547, 0x5548, 0x5549, 0x554a, 0x554b, 0x554c, 0x554d, 0x554e, 0x554f, 0x5550, 0x5551, 0x5552, 0x5553, 0x5554, 0x5555, 0x5556, 0x5557, 0x5558, 0x5559, 0x555a, 0x555b, 0x555c, 0x555d, 0x555e, 0x555f, 0x5560, 0x5561, 0x5562, 0x5563, 0x5564, 0x5565, 0x5566, 0x5567, 0x5568, 0x5569, 0x556a, 0x556b, 0x556c, 0x556d, 0x556e, 0x556f, 0x5570, 0x5571, 0x5572, 0x5573, 0x5574, 0x5575, 0x5576, 0x5577, 0x5578, 0x5579, 0x557a, 0x557b, 0x557c, 0x557d, 0x557e, 0x5621, 0x5622, 0x5623, 0x5624, 0x5625, 0x5626, 0x5627, 0x5628, 0x5629, 0x562a, 0x562b, 0x562c, 0x562d, 0x562e, 0x562f, 0x5630, 0x5631, 0x5632, 0x5633, 0x5634, 0x5635, 0x5636, 0x5637, 0x5638, 0x5639, 0x563a, 0x563b, 0x563c, 0x563d, 0x563e, 0x563f, 0x5640, 0x5641, 0x5642, 0x5643, 0x5644, 0x5645, 0x5647, 0x5648, 0x5649, 0x564a, 0x564b, 0x5646, 0x564c, 0x564d, 0x564e, 0x564f, 0x5650, 0x5651, 0x5652, 0x5653, 0x5654, 0x5656, 0x5657, 0x5658, 0x5655, 0x5659, 0x565a, 0x565b, 0x565c, 0x565d, 0x565e, 0x565f, 0x5660, 0x5661, 0x5662, 0x5663, 0x5664, 0x5665, 0x5666, 0x5667, 0x5668, 0x5669, 0x566a, 0x566b, 0x566c, 0x566d, 0x566e, 0x566f, 0x5670, 0x5671, 0x5672, 0x5673, 0x5674, 0x5675, 0x5676, 0x5677, 0x5678, 0x5679, 0x567a, 0x567b, 0x567c, 0x567d, 0x567e, 0x5721, 0x5722, 0x5723, 0x5724, 0x5725, 0x5726, 0x5727, 0x5728, 0x5729, 0x572a, 0x572b, 0x572c, 0x572d, 0x572e, 0x572f, 0x5730, 0x5731, 0x5732, 0x5733, 0x5734, 0x5735, 0x5736, 0x5737, 0x5738, 0x5739, 0x573a, 0x573b, 0x573c, 0x573d, 0x573e, 0x573f, 0x5740, 0x5741, 0x5742, 0x5743, 0x5744, 0x5745, 0x5746, 0x5747, 0x5748, 0x5749, 0x574a, 0x574b, 0x574c, 0x574d, 0x574e, 0x574f, 0x5750, 0x5751, 0x5752, 0x5753, 0x5754, 0x5755, 0x5756, 0x5757, 0x5758, 0x5759, 0x575a, 0x575b, 0x575c, 0x575d, 0x575e, 0x575f, 0x5760, 0x5761, 0x5762, 0x5764, 0x5765, 0x5766, 0x5767, 0x5768, 0x5769, 0x576a, 0x576b, 0x576c, 0x576d, 0x576e, 0x576f, 0x5770, 0x5771, 0x5772, 0x5773, 0x5774, 0x5775, 0x5776, 0x5777, 0x5778, 0x5779, 0x583e, 0x5763, 0x577a, 0x577b, 0x577c, 0x577d, 0x577e, 0x5821, 0x5822, 0x5823, 0x5824, 0x5825, 0x5826, 0x5827, 0x5828, 0x5829, 0x582a, 0x582b, 0x582c, 0x582d, 0x582e, 0x582f, 0x5830, 0x5831, 0x5832, 0x5833, 0x584c, 0x5834, 0x5835, 0x5836, 0x5837, 0x5838, 0x5839, 0x583a, 0x583b, 0x583c, 0x583d, 0x583f, 0x5840, 0x5841, 0x5842, 0x5843, 0x5844, 0x5845, 0x5846, 0x5847, 0x5848, 0x5849, 0x584a, 0x584b, 0x584d, 0x584e, 0x584f, 0x5850, 0x5851, 0x5852, 0x5853, 0x5854, 0x5855, 0x5856, 0x5857, 0x5858, 0x5859, 0x585a, 0x585b, 0x585c, 0x585d, 0x585e, 0x585f, 0x5860, 0x5861, 0x5862, 0x5863, 0x5864, 0x5865, 0x5866, 0x5867, 0x5868, 0x5869, 0x586a, 0x586b, 0x586c, 0x586d, 0x586e, 0x586f, 0x5870, 0x5871, 0x5872, 0x5873, 0x5874, 0x5875, 0x5876, 0x5877, 0x5878, 0x5879, 0x587a, 0x587b, 0x587c, 0x587d, 0x587e, 0x5921, 0x5922, 0x5923, 0x5924, 0x5925, 0x5926, 0x5927, 0x5928, 0x592a, 0x592b, 0x592c, 0x592d, 0x592e, 0x592f, 0x5930, 0x5931, 0x5932, 0x5933, 0x5934, 0x5935, 0x5936, 0x5937, 0x5938, 0x5939, 0x593a, 0x593b, 0x593c, 0x5929, 0x593d, 0x593e, 0x593f, 0x5940, 0x5941, 0x5942, 0x5943, 0x5944, 0x5945, 0x5946, 0x5947, 0x5948, 0x5949, 0x594a, 0x594b, 0x594c, 0x594d, 0x594e, 0x594f, 0x5950, 0x5951, 0x5952, 0x5953, 0x5954, 0x5955, 0x5956, 0x5957, 0x5958, 0x5959, 0x595a, 0x595b, 0x595c, 0x595d, 0x595e, 0x595f, 0x5960, 0x5961, 0x5962, 0x5963, 0x5964, 0x5965, 0x5966, 0x5974, 0x5967, 0x5968, 0x5969, 0x596a, 0x596b, 0x596c, 0x596d, 0x596e, 0x596f, 0x5970, 0x5971, 0x5972, 0x5973, 0x5975, 0x5976, 0x5977, 0x5978, 0x5979, 0x597a, 0x597b, 0x597c, 0x597d, 0x597e, 0x5a21, 0x5a22, 0x5a23, 0x5a24, 0x5a25, 0x5a26, 0x5a27, 0x5a28, 0x5a29, 0x5a2a, 0x5a2b, 0x5a2c, 0x5a2d, 0x5a2e, 0x5a2f, 0x5a30, 0x5a31, 0x5a32, 0x5a33, 0x5a34, 0x5a35, 0x5a36, 0x3866, 0x5a37, 0x5a38, 0x5a39, 0x5a3a, 0x5a3b, 0x5a3c, 0x5a3d, 0x5a3e, 0x5a3f, 0x5a40, 0x5a41, 0x5a42, 0x5a43, 0x5a44, 0x5a45, 0x5a46, 0x5a47, 0x5a48, 0x5a49, 0x5a4a, 0x5a4b, 0x5a6d, 0x5a4c, 0x5a4d, 0x5a4e, 0x5a4f, 0x5a50, 0x5a51, 0x5a52, 0x5a53, 0x5a54, 0x5a55, 0x5a56, 0x5a57, 0x5a58, 0x5a59, 0x5a5a, 0x5a5b, 0x5a5c, 0x5a5d, 0x5a5e, 0x5a5f, 0x5a60, 0x5a61, 0x5a62, 0x5a63, 0x5a64, 0x5a65, 0x5a66, 0x5a67, 0x5a68, 0x5a69, 0x5a6a, 0x5a6b, 0x5a6c, 0x5a6e, 0x5a6f, 0x5a70, 0x5a71, 0x5a72, 0x5a73, 0x5a74, 0x5a75, 0x5a76, 0x5a77, 0x5a78, 0x5a79, 0x5a7a, 0x5a7b, 0x5a7c, 0x5a7d, 0x5a7e, 0x5b21, 0x5b22, 0x5b23, 0x5b24, 0x5b25, 0x5b26, 0x5b27, 0x5b28, 0x5b29, 0x5b2a, 0x5b2b, 0x5b2c, 0x5b2d, 0x5b2e, 0x5b2f, 0x5b30, 0x5b31, 0x5b32, 0x5b33, 0x5b34, 0x5b35, 0x5b36, 0x5b37, 0x5b38, 0x5b39, 0x5b3a, 0x5b3b, 0x5b3c, 0x5b3d, 0x5b3e, 0x5b3f, 0x5b40, 0x5b41, 0x5b42, 0x5b43, 0x5b44, 0x5b45, 0x5b46, 0x5b47, 0x5b48, 0x5b49, 0x5b4a, 0x5b4b, 0x5b4c, 0x5b4d, 0x5b4e, 0x5b4f, 0x5b50, 0x5b51, 0x5b52, 0x5b53, 0x5b54, 0x5b55, 0x5b56, 0x5b57, 0x5b58, 0x5b59, 0x5b5a, 0x5b5b, 0x5b5c, 0x5b5d, 0x5b5e, 0x5b5f, 0x5b60, 0x5b61, 0x5b62, 0x5b63, 0x5b64, 0x5b65, 0x5b66, 0x5b67, 0x5b68, 0x5b69, 0x5b6a, 0x5b6b, 0x5b6c, 0x5b6d, 0x5b6e, 0x5b70, 0x5b71, 0x5b72, 0x5b73, 0x5b6f, 0x5b74, 0x5b75, 0x5b76, 0x5b77, 0x5b78, 0x5b79, 0x5b7a, 0x5b7b, 0x5b7c, 0x5b7d, 0x5b7e, 0x5c21, 0x5c22, 0x5c23, 0x5c24, 0x5c25, 0x5c26, 0x5c27, 0x5c28, 0x5c29, 0x5c2a, 0x5c2b, 0x5c2c, 0x5c2d, 0x5c2e, 0x5c2f, 0x5c30, 0x5c31, 0x5c32, 0x5c33, 0x5c34, 0x5c35, 0x5c36, 0x5c37, 0x5c38, 0x5c39, 0x5c3a, 0x5c3b, 0x5c3c, 0x5c3d, 0x5c3e, 0x5c3f, 0x5c40, 0x5c41, 0x5c42, 0x5c43, 0x5c44, 0x5c45, 0x5c46, 0x5c47, 0x5c48, 0x5c49, 0x5c4a, 0x5c4b, 0x5c4c, 0x5c4d, 0x5c4e, 0x5c4f, 0x5c50, 0x5c51, 0x5c52, 0x5c53, 0x5c54, 0x5c55, 0x5c56, 0x5c57, 0x5c58, 0x5c59, 0x5c5a, 0x5c5b, 0x5c5c, 0x5c5d, 0x5c5e, 0x5c5f, 0x5c60, 0x5c61, 0x5c62, 0x5c63, 0x5c64, 0x5c65, 0x5c66, 0x5c67, 0x5c68, 0x5c69, 0x5c6a, 0x5c6b, 0x5c6c, 0x5c6d, 0x5c6e, 0x5c6f, 0x5c70, 0x5c71, 0x5c72, 0x5c73, 0x5c74, 0x5c75, 0x5c76, 0x5c77, 0x5c78, 0x5c79, 0x5c7a, 0x5c7b, 0x5c7c, 0x5c7d, 0x5c7e, 0x5d21, 0x5d22, 0x5d23, 0x5d24, 0x5d25, 0x5d26, 0x5d27, 0x5d28, 0x5d29, 0x5d2a, 0x5d2b, 0x5d2c, 0x5d2d, 0x5d2e, 0x5d2f, 0x5d30, 0x5d31, 0x5d32, 0x5d33, 0x5d34, 0x5d35, 0x5d36, 0x5d37, 0x5d38, 0x5d39, 0x5d3a, 0x5d3b, 0x5d3c, 0x5d3d, 0x5d3e, 0x5d3f, 0x5d40, 0x5d41, 0x5d42, 0x5d43, 0x5d44, 0x5d45, 0x5d46, 0x5d47, 0x5d48, 0x5d49, 0x5d4a, 0x5d4b, 0x5d4c, 0x5d4d, 0x5d4e, 0x5d4f, 0x5d50, 0x5d51, 0x5d52, 0x5d53, 0x5d54, 0x5d55, 0x5d56, 0x5d57, 0x5d58, 0x5d59, 0x5d5a, 0x5d5b, 0x5d5c, 0x5d5d, 0x5d5e, 0x5d5f, 0x5d60, 0x5d61, 0x5d62, 0x5d63, 0x5d64, 0x5d65, 0x5d66, 0x5d67, 0x5d68, 0x5d69, 0x5d6a, 0x5d6b, 0x5d6c, 0x5d6d, 0x5d6e, 0x5d6f, 0x5d70, 0x5d71, 0x5d72, 0x5d73, 0x5d74, 0x5d75, 0x5d76, 0x5d77, 0x5d78, 0x5d79, 0x5d7a, 0x5d7b, 0x5d7c, 0x5d7d, 0x5d7e, 0x5e21, 0x5e22, 0x5e23, 0x5e24, 0x5e25, 0x5e26, 0x5e27, 0x5e28, 0x5e29, 0x5e2a, 0x5e2b, 0x5e2c, 0x5e2d, 0x5e2e, 0x5e2f, 0x5e30, 0x5e31, 0x5e32, 0x5e33, 0x5e34, 0x5e35, 0x5e36, 0x5e37, 0x5e38, 0x5e39, 0x5e3f, 0x5e3a, 0x5e3b, 0x5e3c, 0x5e3d, 0x5e3e, 0x5e40, 0x5e41, 0x5e42, 0x5e43, 0x5e44, 0x5e45, 0x5e46, 0x5e47, 0x5e48, 0x5e49, 0x5e4e, 0x5e4a, 0x5e4b, 0x5e4c, 0x5e4d, 0x5e4f, 0x5e50, 0x5e51, 0x5e52, 0x5e53, 0x5e54, 0x5e55, 0x5e56, 0x5e57, 0x5e58, 0x5e59, 0x5e5a, 0x5e5b, 0x5e5c, 0x5e5d, 0x5e5e, 0x5e5f, 0x5e60, 0x5e61, 0x5e62, 0x5e63, 0x5e64, 0x5e65, 0x5e66, 0x5e67, 0x5e68, 0x5e69, 0x5e6a, 0x5e6b, 0x5e6c, 0x5e6d, 0x5e6e, 0x5e6f, 0x5e72, 0x5e70, 0x5e71, 0x5e73, 0x5e74, 0x5e75, 0x5e76, 0x5e77, 0x5e78, 0x5e79, 0x5e7a, 0x5e7b, 0x5e7c, 0x5e7d, 0x5e7e, 0x5f21, 0x5f22, 0x5f23, 0x5f24, 0x5f25, 0x5f26, 0x5f27, 0x5f28, 0x5f29, 0x5f2a, 0x5f2b, 0x5f2c, 0x5f2d, 0x5f2e, 0x5f2f, 0x5f30, 0x5f32, 0x5f31, 0x5f33, 0x5f34, 0x5f35, 0x5f36, 0x5f37, 0x5f38, 0x5f39, 0x5f3a, 0x5f3b, 0x5f3c, 0x5f3d, 0x5f3e, 0x5f3f, 0x5f40, 0x5f41, 0x5f42, 0x5f43, 0x5f44, 0x5f45, 0x5f46, 0x5f47, 0x5f48, 0x5f49, 0x5f4a, 0x5f4b, 0x5f4c, 0x5f4d, 0x5f4e, 0x5f4f, 0x5f50, 0x5f51, 0x5f52, 0x5f53, 0x5f54, 0x5f55, 0x5f56, 0x5f57, 0x5f58, 0x5f59, 0x5f5a, 0x5f5b, 0x5f5c, 0x5f5d, 0x5f6f, 0x5f5e, 0x5f5f, 0x5f60, 0x5f61, 0x5f62, 0x5f63, 0x5f64, 0x5f65, 0x5f66, 0x5f67, 0x5f68, 0x5f69, 0x5f6a, 0x5f6b, 0x5f6c, 0x5f6d, 0x5f6e, 0x5f70, 0x5f71, 0x5f72, 0x5f73, 0x5f74, 0x5f75, 0x5f76, 0x5f77, 0x5f78, 0x5f79, 0x5f7a, 0x5f7b, 0x5f7c, 0x5f7d, 0x5f7e, 0x6021, 0x6022, 0x6023, 0x6024, 0x6025, 0x6026, 0x6027, 0x6028, 0x6029, 0x602a, 0x602b, 0x602c, 0x602d, 0x602e, 0x602f, 0x6030, 0x6031, 0x6032, 0x6033, 0x6034, 0x6035, 0x6036, 0x6037, 0x6038, 0x6039, 0x603a, 0x603b, 0x603c, 0x603d, 0x603e, 0x603f, 0x6040, 0x6041, 0x6042, 0x6043, 0x6044, 0x6045, 0x6046, 0x6047, 0x6048, 0x6049, 0x604a, 0x604b, 0x604c, 0x604d, 0x604e, 0x604f, 0x6050, 0x6051, 0x6052, 0x6053, 0x6054, 0x6055, 0x6056, 0x6057, 0x6058, 0x6059, 0x605a, 0x605b, 0x605c, 0x605d, 0x6064, 0x605e, 0x605f, 0x6060, 0x6061, 0x6062, 0x6063, 0x6065, 0x6066, 0x6067, 0x6068, 0x6069, 0x606a, 0x606b, 0x606c, 0x606d, 0x606e, 0x606f, 0x6070, 0x6071, 0x6072, 0x6073, 0x6074, 0x6075, 0x6076, 0x6077, 0x6078, 0x6079, 0x607a, 0x607b, 0x607c, 0x607d, 0x607e, 0x6121, 0x6122, 0x6123, 0x6124, 0x6125, 0x6126, 0x6127, 0x6128, 0x6129, 0x612a, 0x612b, 0x612c, 0x612d, 0x612e, 0x612f, 0x6130, 0x6131, 0x6132, 0x6133, 0x6134, 0x6135, 0x6136, 0x6137, 0x6138, 0x6139, 0x613a, 0x613b, 0x613c, 0x613d, 0x613e, 0x613f, 0x6140, 0x6141, 0x6142, 0x6143, 0x6144, 0x6145, 0x6146, 0x6147, 0x6148, 0x6149, 0x614a, 0x614b, 0x614c, 0x614d, 0x614e, 0x614f, 0x6150, 0x6151, 0x6152, 0x6154, 0x6155, 0x6156, 0x6153, 0x6157, 0x6158, 0x6159, 0x615a, 0x615b, 0x615c, 0x615d, 0x615e, 0x615f, 0x6160, 0x6161, 0x6162, 0x6163, 0x6164, 0x6165, 0x6166, 0x6167, 0x6168, 0x6169, 0x616a, 0x616b, 0x616c, 0x616d, 0x616e, 0x616f, 0x6170, 0x6171, 0x6172, 0x6173, 0x6174, 0x6175, 0x6176, 0x6177, 0x6178, 0x6179, 0x617a, 0x617b, 0x617d, 0x617e, 0x6221, 0x6222, 0x6223, 0x6224, 0x617c, 0x622d, 0x6225, 0x6226, 0x6227, 0x6228, 0x6229, 0x622a, 0x622b, 0x622c, 0x622f, 0x6230, 0x6231, 0x6232, 0x622e, 0x6233, 0x6234, 0x6235, 0x6236, 0x6237, 0x6238, 0x6239, 0x623a, 0x623b, 0x623c, 0x623d, 0x623e, 0x623f, 0x6240, 0x6241, 0x6242, 0x6243, 0x6245, 0x6246, 0x6244, 0x6247, 0x6248, 0x6249, 0x624a, 0x624b, 0x624c, 0x624d, 0x624e, 0x624f, 0x6250, 0x6251, 0x6252, 0x6253, 0x6254, 0x6255, 0x6256, 0x6257, 0x6258, 0x6259, 0x625a, 0x625b, 0x625c, 0x625d, 0x625e, 0x625f, 0x6260, 0x6261, 0x6262, 0x6263, 0x6264, 0x6265, 0x6266, 0x6267, 0x6268, 0x6269, 0x626a, 0x626b, 0x626c, 0x626d, 0x626e, 0x626f, 0x6270, 0x6271, 0x6272, 0x6273, 0x6274, 0x6275, 0x6276, 0x6277, 0x6278, 0x6279, 0x627a, 0x627b, 0x627c, 0x627d, 0x627e, 0x6321, 0x6322, 0x6323, 0x6324, 0x6325, 0x6326, 0x6327, 0x6328, 0x6329, 0x632a, 0x632b, 0x632c, 0x632d, 0x632e, 0x632f, 0x6330, 0x6331, 0x6332, 0x6333, 0x6334, 0x6335, 0x6336, 0x6337, 0x6338, 0x6339, 0x633a, 0x633b, 0x633c, 0x633d, 0x633e, 0x633f, 0x6340, 0x6341, 0x6342, 0x6343, 0x6344, 0x6345, 0x6346, 0x6347, 0x6348, 0x6349, 0x634a, 0x634b, 0x634c, 0x634d, 0x634e, 0x634f, 0x6350, 0x6351, 0x6352, 0x6353, 0x6354, 0x6355, 0x6356, 0x6357, 0x6358, 0x6359, 0x635a, 0x635b, 0x635c, 0x635d, 0x635e, 0x635f, 0x6360, 0x6361, 0x6362, 0x6363, 0x6364, 0x6365, 0x6366, 0x6367, 0x6368, 0x6369, 0x636a, 0x636b, 0x636c, 0x636d, 0x636e, 0x636f, 0x6370, 0x6371, 0x6372, 0x6373, 0x6374, 0x6375, 0x6376, 0x6377, 0x6378, 0x6379, 0x637a, 0x637b, 0x637c, 0x637d, 0x637e, 0x6421, 0x6422, 0x6423, 0x6424, 0x6425, 0x6426, 0x6427, 0x6428, 0x6429, 0x642a, 0x642b, 0x642c, 0x642d, 0x642e, 0x642f, 0x6430, 0x6431, 0x6432, 0x6433, 0x6434, 0x6435, 0x6436, 0x6437, 0x6438, 0x6439, 0x643a, 0x643b, 0x643c, 0x643d, 0x643e, 0x643f, 0x6440, 0x6441, 0x6442, 0x6443, 0x6444, 0x6445, 0x6446, 0x6447, 0x6448, 0x6449, 0x644a, 0x644b, 0x644c, 0x644d, 0x644e, 0x644f, 0x6450, 0x6451, 0x6452, 0x6453, 0x6454, 0x6455, 0x6456, 0x6457, 0x6458, 0x6459, 0x645a, 0x645b, 0x645c, 0x645d, 0x645e, 0x645f, 0x6460, 0x6461, 0x6462, 0x6463, 0x6464, 0x6465, 0x6466, 0x6467, 0x6468, 0x6469, 0x646a, 0x646b, 0x646c, 0x646d, 0x646e, 0x646f, 0x6470, 0x6471, 0x6472, 0x6473, 0x6474, 0x6475, 0x6476, 0x6477, 0x6478, 0x6479, 0x647a, 0x647b, 0x647c, 0x647d, 0x647e, 0x6521, 0x6522, 0x6523, 0x6524, 0x6525, 0x6526, 0x6527, 0x6528, 0x6529, 0x652a, 0x652b, 0x652c, 0x652d, 0x652e, 0x652f, 0x6530, 0x6531, 0x6532, 0x6533, 0x6534, 0x6535, 0x653b, 0x6536, 0x6537, 0x6538, 0x6539, 0x653a, 0x653c, 0x653d, 0x653e, 0x653f, 0x6540, 0x6541, 0x6542, 0x6543, 0x6544, 0x6545, 0x6546, 0x6547, 0x6548, 0x6549, 0x654a, 0x654b, 0x654c, 0x654d, 0x654f, 0x6550, 0x654e, 0x6551, 0x6552, 0x6553, 0x6554, 0x6555, 0x6556, 0x6557, 0x6558, 0x6559, 0x655a, 0x655b, 0x655c, 0x655d, 0x655e, 0x655f, 0x6560, 0x6561, 0x6562, 0x6563, 0x6564, 0x6565, 0x6566, 0x6568, 0x6567, 0x6569, 0x656a, 0x656b, 0x656c, 0x656d, 0x656e, 0x656f, 0x6570, 0x6571, 0x6572, 0x6573, 0x6574, 0x6575, 0x6576, 0x6577, 0x6578, 0x6579, 0x657a, 0x657c, 0x657b, 0x657d, 0x657e, 0x6621, 0x6622, 0x6623, 0x6624, 0x6625, 0x6626, 0x6627, 0x6628, 0x6629, 0x662a, 0x662b, 0x662c, 0x662d, 0x662e, 0x662f, 0x6630, 0x6631, 0x6632, 0x6633, 0x6634, 0x6635, 0x6636, 0x6637, 0x6638, 0x6639, 0x663a, 0x663b, 0x663c, 0x663d, 0x663e, 0x663f, 0x6640, 0x6641, 0x6642, 0x6643, 0x6644, 0x6645, 0x6646, 0x6647, 0x6648, 0x6649, 0x664a, 0x664b, 0x664c, 0x664d, 0x664e, 0x664f, 0x6650, 0x6651, 0x6652, 0x6653, 0x6654, 0x6655, 0x6656, 0x6657, 0x6658, 0x6659, 0x665a, 0x665b, 0x665c, 0x665d, 0x665e, 0x665f, 0x6660, 0x6661, 0x6662, 0x6663, 0x6664, 0x6665, 0x6666, 0x6667, 0x6668, 0x6669, 0x666a, 0x666b, 0x666c, 0x666d, 0x666e, 0x666f, 0x6670, 0x6671, 0x6672, 0x6673, 0x6675, 0x6676, 0x6677, 0x6678, 0x6679, 0x667a, 0x667b, 0x667c, 0x667d, 0x667e, 0x6721, 0x6722, 0x6723, 0x6724, 0x6725, 0x6726, 0x6727, 0x6728, 0x6729, 0x672a, 0x672b, 0x672c, 0x672d, 0x672e, 0x672f, 0x6730, 0x6731, 0x6732, 0x6733, 0x6734, 0x6735, 0x6736, 0x6737, 0x6738, 0x6739, 0x673a, 0x673b, 0x673c, 0x673d, 0x673e, 0x673f, 0x6740, 0x6741, 0x6742, 0x6743, 0x6744, 0x6745, 0x6746, 0x6747, 0x6748, 0x6749, 0x674a, 0x674b, 0x674c, 0x674d, 0x674e, 0x674f, 0x6750, 0x6751, 0x6752, 0x6753, 0x6754, 0x6755, 0x6756, 0x6757, 0x6758, 0x6759, 0x675a, 0x675b, 0x675c, 0x675d, 0x675e, 0x675f, 0x6760, 0x6761, 0x6762, 0x6763, 0x6764, 0x6765, 0x6766, 0x676a, 0x6767, 0x6768, 0x6769, 0x676b, 0x676c, 0x676d, 0x676e, 0x676f, 0x6770, 0x6771, 0x6772, 0x6773, 0x6774, 0x6776, 0x6777, 0x6778, 0x6779, 0x6775, 0x677a, 0x677b, 0x677c, 0x677d, 0x6828, 0x677e, 0x6821, 0x6822, 0x6823, 0x6824, 0x6825, 0x6826, 0x6827, 0x6829, 0x682a, 0x682b, 0x682c, 0x682d, 0x682e, 0x682f, 0x6830, 0x6831, 0x6832, 0x6833, 0x6834, 0x6835, 0x6836, 0x6837, 0x6838, 0x6839, 0x683a, 0x683b, 0x683c, 0x683d, 0x683e, 0x683f, 0x6840, 0x6841, 0x6842, 0x6843, 0x6844, 0x6845, 0x6846, 0x6847, 0x6848, 0x6849, 0x684a, 0x684b, 0x684c, 0x684d, 0x684e, 0x684f, 0x6850, 0x6851, 0x6852, 0x6853, 0x6854, 0x6855, 0x6856, 0x6857, 0x6858, 0x6859, 0x685a, 0x685b, 0x685c, 0x685d, 0x685e, 0x685f, 0x6860, 0x6861, 0x6862, 0x6863, 0x6864, 0x6865, 0x6866, 0x6867, 0x6868, 0x6869, 0x686a, 0x686b, 0x686c, 0x686d, 0x686e, 0x686f, 0x6870, 0x6871, 0x6872, 0x6873, 0x6874, 0x6875, 0x6876, 0x6877, 0x6878, 0x6879, 0x687a, 0x687b, 0x687c, 0x687d, 0x687e, 0x6921, 0x6922, 0x6923, 0x6924, 0x6925, 0x6926, 0x6927, 0x6928, 0x6929, 0x692a, 0x692b, 0x692c, 0x692d, 0x692e, 0x692f, 0x6930, 0x6931, 0x6932, 0x6933, 0x6934, 0x6935, 0x6936, 0x6937, 0x6938, 0x6939, 0x693a, 0x693b, 0x693c, 0x693d, 0x693e, 0x693f, 0x6940, 0x6941, 0x6942, 0x6943, 0x6944, 0x6945, 0x6946, 0x6947, 0x6948, 0x6949, 0x694a, 0x694c, 0x694d, 0x694b, 0x694e, 0x694f, 0x6950, 0x6951, 0x6952, 0x6953, 0x6954, 0x6955, 0x6956, 0x6957, 0x6958, 0x6959, 0x695a, 0x695b, 0x695c, 0x695d, 0x695e, 0x695f, 0x6960, 0x6961, 0x6962, 0x6963, 0x6964, 0x6965, 0x6966, 0x6967, 0x6968, 0x6969, 0x696a, 0x696b, 0x696c, 0x696d, 0x696e, 0x696f, 0x6970, 0x6971, 0x6972, 0x6973, 0x6974, 0x6975, 0x6976, 0x6977, 0x6978, 0x6979, 0x697a, 0x697b, 0x697c, 0x697d, 0x697e, 0x6a21, 0x6a22, 0x6a23, 0x6a24, 0x6a25, 0x6a26, 0x6a27, 0x6a28, 0x6a29, 0x6a2a, 0x6a2b, 0x6a2c, 0x6a2d, 0x6a2e, 0x6a2f, 0x6a30, 0x6a31, 0x6a32, 0x6a33, 0x6a34, 0x6a35, 0x6a36, 0x6a37, 0x6a38, 0x6a39, 0x6a3a, 0x6a3b, 0x6a3c, 0x6a3d, 0x6a3e, 0x6a3f, 0x6a40, 0x6a41, 0x6a42, 0x6a43, 0x6a44, 0x6a45, 0x6a46, 0x6a47, 0x6a48, 0x6a49, 0x6a4a, 0x6a4b, 0x6a4c, 0x6a4d, 0x6a4e, 0x6a4f, 0x6a50, 0x6a51, 0x6a52, 0x6a53, 0x6a54, 0x6a55, 0x6a56, 0x6a57, 0x6a58, 0x6a59, 0x6a5a, 0x6a5b, 0x6a5c, 0x6a5d, 0x6a5e, 0x6a5f, 0x6a60, 0x6a61, 0x6a62, 0x6a63, 0x6a64, 0x6a65, 0x6a66, 0x6a67, 0x6a68, 0x6a69, 0x6a6a, 0x6a6b, 0x6a6c, 0x6a6d, 0x6a6e, 0x6a6f, 0x6a70, 0x6a71, 0x6a72, 0x6a73, 0x6a74, 0x6a75, 0x6a76, 0x6a77, 0x6a78, 0x6a79, 0x6a7a, 0x6a7b, 0x6a7c, 0x6a7d, 0x6a7e, 0x6b21, 0x6b22, 0x6b23, 0x6b24, 0x6b25, 0x6b26, 0x6b27, 0x6b28, 0x6b29, 0x6b2a, 0x6b2b, 0x6b2c, 0x6b2d, 0x6b2e, 0x6b2f, 0x6b30, 0x6b31, 0x6b32, 0x6b33, 0x6b34, 0x6b35, 0x6b36, 0x6b37, 0x6b38, 0x6b39, 0x6b3a, 0x6b3b, 0x6b3c, 0x6b3d, 0x6b3e, 0x6b3f, 0x6b40, 0x6b41, 0x6b42, 0x6b43, 0x6b44, 0x6b45, 0x6b46, 0x6b47, 0x6b48, 0x6b49, 0x6b50, 0x6b4a, 0x6b4b, 0x6b4c, 0x6b4d, 0x6b52, 0x6b4e, 0x6b4f, 0x6b51, 0x6b53, 0x6b54, 0x6b55, 0x6b56, 0x6b57, 0x6b58, 0x6b59, 0x6b5a, 0x6b5b, 0x6b5c, 0x6b5e, 0x6b5d, 0x6b5f, 0x6b60, 0x6b61, 0x6b62, 0x6b63, 0x6b64, 0x6b65, 0x6b66, 0x6b67, 0x6b68, 0x6b69, 0x6b6a, 0x6b6b, 0x6b6d, 0x6b6e, 0x6b6f, 0x6b6c, 0x6b70, 0x6b71, 0x6b72, 0x6b73, 0x6b74, 0x6b76, 0x6b75, 0x6b77, 0x6b78, 0x6b79, 0x6b7a, 0x6b7b, 0x6b7c, 0x6b7d, 0x6b7e, 0x6c21, 0x6c22, 0x6c23, 0x6c24, 0x6c25, 0x6c26, 0x6c27, 0x6c28, 0x6c29, 0x6c2a, 0x6c2b, 0x6c2c, 0x6c2d, 0x6c2e, 0x6c2f, 0x6c30, 0x6c31, 0x6c32, 0x6c33, 0x6c34, 0x6c35, 0x6c36, 0x6c37, 0x6c38, 0x6c39, 0x6c3a, 0x6c3b, 0x6c3c, 0x6c3d, 0x6c3e, 0x6c3f, 0x6c40, 0x6c41, 0x6c42, 0x6c43, 0x6c44, 0x6c45, 0x6c46, 0x6c47, 0x6c48, 0x6c49, 0x6c4a, 0x6c4b, 0x6c4c, 0x6c4e, 0x6c4f, 0x6c4d, 0x6c50, 0x6c51, 0x6c52, 0x6c53, 0x6c54, 0x6c55, 0x6c56, 0x6c57, 0x6c58, 0x6c59, 0x6c5a, 0x6c5b, 0x6c5c, 0x6c5d, 0x6c5e, 0x6c5f, 0x6c60, 0x6c61, 0x6c62, 0x6c63, 0x6c64, 0x6c65, 0x6c66, 0x6c67, 0x6c68, 0x6c69, 0x6c6a, 0x6c6b, 0x6c6c, 0x6c6d, 0x6c6e, 0x6c6f, 0x6c70, 0x6c71, 0x6c72, 0x6c73, 0x6c74, 0x6c75, 0x6c76, 0x6c77, 0x6c78, 0x6c79, 0x6c7a, 0x6c7b, 0x6c7c, 0x6c7d, 0x6c7e, 0x6d21, 0x6d22, 0x6d23, 0x6d24, 0x6d25, 0x6d26, 0x6d27, 0x6d28, 0x6d29, 0x6d2a, 0x6d2b, 0x6d2c, 0x6d2d, 0x6d2e, 0x6d2f, 0x6d30, 0x6d31, 0x6d32, 0x6d33, 0x6d34, 0x6d35, 0x6d36, 0x6d37, 0x6d38, 0x6d39, 0x6d3a, 0x6d3b, 0x6d3c, 0x6d3d, 0x6d3e, 0x6d3f, 0x6d40, 0x6d41, 0x6d42, 0x6d43, 0x6d44, 0x6d45, 0x6d46, 0x6d47, 0x6d48, 0x6d49, 0x6d4a, 0x6d4b, 0x6d4c, 0x6d4d, 0x6d4e, 0x6d4f, 0x6d50, 0x6d51, 0x6d52, 0x6d53, 0x6d54, 0x6d55, 0x6d56, 0x6d57, 0x6d58, 0x6d59, 0x6d5a, 0x6d5b, 0x6d5c, 0x6d5d, 0x6d5e, 0x6d5f, 0x6d60, 0x6d61, 0x6d62, 0x6d63, }; static const Summary16 jisx0212_uni2indx_page00[70] = { /* 0x0000 */ { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x4000 }, { 1, 0x0000 }, { 1, 0x0000 }, { 1, 0xc652 }, { 8, 0x8500 }, { 11, 0xffff }, { 27, 0xff7e }, { 41, 0xffff }, { 57, 0xff7f }, /* 0x0100 */ { 72, 0xffff }, { 88, 0xffcf }, { 102, 0xcff7 }, { 115, 0xffff }, { 131, 0x3fff }, { 145, 0xffff }, { 161, 0xffff }, { 177, 0x7fff }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0xe000 }, { 195, 0x1fff }, { 208, 0x0000 }, { 208, 0x0020 }, /* 0x0200 */ { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0080 }, { 210, 0x2f00 }, { 215, 0x0000 }, { 215, 0x0000 }, /* 0x0300 */ { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0xd770 }, { 224, 0x0001 }, { 225, 0xfc00 }, { 231, 0x0001 }, { 232, 0x7c04 }, { 238, 0x0000 }, { 238, 0x0000 }, { 238, 0x0000 }, /* 0x0400 */ { 238, 0xdffc }, { 251, 0x0000 }, { 251, 0x0000 }, { 251, 0x0000 }, { 251, 0x0000 }, { 251, 0xdffc }, }; static const Summary16 jisx0212_uni2indx_page21[3] = { /* 0x2100 */ { 264, 0x0000 }, { 264, 0x0040 }, { 265, 0x0004 }, }; static const Summary16 jisx0212_uni2indx_page4e[1307] = { /* 0x4e00 */ { 266, 0x1034 }, { 270, 0x8004 }, { 272, 0xc918 }, { 278, 0x0021 }, { 280, 0x0093 }, { 284, 0x1402 }, { 287, 0x0308 }, { 290, 0x8230 }, { 294, 0x2000 }, { 295, 0x20c0 }, { 298, 0x8000 }, { 299, 0x0200 }, { 300, 0x0008 }, { 301, 0x0c01 }, { 304, 0x8107 }, { 309, 0xe02a }, /* 0x4f00 */ { 315, 0x190d }, { 321, 0x02e4 }, { 326, 0x4000 }, { 327, 0x4aaa }, { 334, 0x1b05 }, { 340, 0x8154 }, { 345, 0x5409 }, { 350, 0x6782 }, { 357, 0x5636 }, { 365, 0xc69d }, { 374, 0x0000 }, { 374, 0x7a84 }, { 381, 0xbb63 }, { 391, 0x1004 }, { 393, 0x0005 }, { 395, 0xb005 }, /* 0x5000 */ { 400, 0x5493 }, { 407, 0x7989 }, { 415, 0x4084 }, { 418, 0x082d }, { 423, 0x5467 }, { 431, 0x828e }, { 437, 0x24cd }, { 444, 0x0003 }, { 446, 0xc45a }, { 453, 0xd85d }, { 462, 0x8407 }, { 467, 0x2601 }, { 471, 0x5099 }, { 477, 0xb119 }, { 484, 0x8354 }, { 490, 0x4446 }, /* 0x5100 */ { 495, 0x79c8 }, { 503, 0x7a81 }, { 510, 0xb188 }, { 516, 0x033a }, { 522, 0x8404 }, { 525, 0x81a8 }, { 530, 0x0050 }, { 532, 0x4000 }, { 533, 0x4818 }, { 537, 0x2100 }, { 539, 0x200a }, { 542, 0xd500 }, { 547, 0x8104 }, { 550, 0x412e }, { 556, 0x4024 }, { 559, 0x009c }, /* 0x5200 */ { 563, 0x0026 }, { 566, 0x016c }, { 571, 0x0104 }, { 573, 0x1026 }, { 577, 0x0220 }, { 579, 0x95a0 }, { 585, 0x4043 }, { 589, 0x0380 }, { 592, 0x1425 }, { 597, 0x15e8 }, { 604, 0x80f0 }, { 609, 0x2dc1 }, { 616, 0x9151 }, { 622, 0x1852 }, { 627, 0x1722 }, { 633, 0x00d3 }, /* 0x5300 */ { 638, 0x1c09 }, { 643, 0xd90a }, { 650, 0x3ba0 }, { 657, 0x7025 }, { 663, 0x1804 }, { 666, 0x0a00 }, { 668, 0x302a }, { 673, 0x4204 }, { 676, 0x4188 }, { 680, 0x2218 }, { 684, 0x8c12 }, { 689, 0x25b4 }, { 696, 0x8021 }, { 699, 0x642c }, { 705, 0x00c1 }, { 708, 0x0020 }, /* 0x5400 */ { 709, 0x0004 }, { 710, 0x0408 }, { 712, 0x8582 }, { 717, 0x0032 }, { 720, 0xa098 }, { 725, 0x4000 }, { 726, 0x6ad4 }, { 734, 0x8010 }, { 736, 0x232a }, { 742, 0x9062 }, { 747, 0x66c2 }, { 754, 0x8e82 }, { 760, 0x6440 }, { 764, 0x0000 }, { 764, 0x9401 }, { 768, 0xd040 }, /* 0x5500 */ { 772, 0x7323 }, { 780, 0x0020 }, { 781, 0x0c00 }, { 783, 0x3864 }, { 789, 0x2682 }, { 794, 0x4d03 }, { 800, 0x0053 }, { 804, 0x8000 }, { 805, 0xc146 }, { 811, 0x009e }, { 816, 0x2018 }, { 819, 0x8004 }, { 821, 0x5a4a }, { 828, 0x498e }, { 835, 0x0204 }, { 837, 0x8040 }, /* 0x5600 */ { 839, 0xe520 }, { 845, 0x0207 }, { 849, 0x1000 }, { 850, 0xbaa9 }, { 859, 0xaa5b }, { 868, 0x4010 }, { 870, 0xa24f }, { 878, 0x0026 }, { 881, 0x1930 }, { 886, 0xe620 }, { 892, 0x3bc0 }, { 899, 0x408a }, { 903, 0xbe20 }, { 910, 0xb201 }, { 915, 0x29f2 }, { 923, 0x00c2 }, /* 0x5700 */ { 926, 0x1486 }, { 931, 0x2c22 }, { 936, 0xd63d }, { 946, 0xe018 }, { 951, 0x3060 }, { 955, 0x0004 }, { 956, 0xe9a4 }, { 964, 0x5ebb }, { 975, 0x100a }, { 978, 0xf6b0 }, { 987, 0x1382 }, { 992, 0x2100 }, { 994, 0x9180 }, { 998, 0x6020 }, { 1001, 0x22d2 }, { 1007, 0xe161 }, /* 0x5800 */ { 1014, 0x3318 }, { 1020, 0xc800 }, { 1023, 0x20c1 }, { 1027, 0x8204 }, { 1030, 0xb200 }, { 1034, 0x8021 }, { 1037, 0x0192 }, { 1041, 0x9100 }, { 1044, 0xb783 }, { 1053, 0x2051 }, { 1057, 0x0247 }, { 1062, 0x1006 }, { 1065, 0x6114 }, { 1070, 0x2455 }, { 1076, 0x0206 }, { 1079, 0x0008 }, /* 0x5900 */ { 1080, 0x1860 }, { 1084, 0x201c }, { 1088, 0x811a }, { 1093, 0x8069 }, { 1098, 0x0048 }, { 1100, 0xea0c }, { 1107, 0xa80a }, { 1112, 0x1a64 }, { 1118, 0x5800 }, { 1121, 0x80a4 }, { 1125, 0xe090 }, { 1130, 0x1489 }, { 1135, 0x251a }, { 1141, 0xe004 }, { 1145, 0xc098 }, { 1150, 0x0096 }, /* 0x5a00 */ { 1154, 0x7011 }, { 1159, 0x400c }, { 1162, 0x2598 }, { 1168, 0x0001 }, { 1169, 0x11b0 }, { 1174, 0x4021 }, { 1177, 0x20a8 }, { 1181, 0x4c80 }, { 1185, 0x0800 }, { 1186, 0xd249 }, { 1193, 0x1085 }, { 1197, 0x8d2e }, { 1205, 0x8150 }, { 1209, 0x1400 }, { 1211, 0x4421 }, { 1215, 0x2060 }, /* 0x5b00 */ { 1218, 0x0103 }, { 1221, 0x2a80 }, { 1225, 0x2022 }, { 1228, 0x0110 }, { 1230, 0x1802 }, { 1233, 0x4044 }, { 1236, 0xc100 }, { 1239, 0xf000 }, { 1243, 0x4452 }, { 1248, 0x005b }, { 1253, 0xb300 }, { 1258, 0x1486 }, { 1263, 0xa003 }, { 1267, 0x07c0 }, { 1272, 0x8001 }, { 1274, 0x2012 }, /* 0x5c00 */ { 1277, 0x1000 }, { 1278, 0xc080 }, { 1281, 0x5a48 }, { 1287, 0x0065 }, { 1291, 0x0000 }, { 1291, 0x1600 }, { 1294, 0x238c }, { 1300, 0x3c31 }, { 1307, 0x8580 }, { 1311, 0xa004 }, { 1314, 0x044d }, { 1319, 0x0434 }, { 1323, 0x0a00 }, { 1325, 0x2084 }, { 1328, 0x4000 }, { 1329, 0x0016 }, /* 0x5d00 */ { 1332, 0x2042 }, { 1335, 0x0004 }, { 1336, 0x08d8 }, { 1341, 0xa212 }, { 1346, 0x054c }, { 1351, 0x8222 }, { 1355, 0x2417 }, { 1361, 0xc601 }, { 1366, 0x050a }, { 1370, 0x8a3c }, { 1377, 0x0881 }, { 1380, 0x0315 }, { 1385, 0x4888 }, { 1389, 0x0301 }, { 1392, 0x0211 }, { 1395, 0x0300 }, /* 0x5e00 */ { 1397, 0x2081 }, { 1400, 0x8134 }, { 1405, 0x4101 }, { 1408, 0x4024 }, { 1411, 0x0a00 }, { 1413, 0x5943 }, { 1420, 0x7d00 }, { 1426, 0x0001 }, { 1427, 0x4801 }, { 1430, 0x0000 }, { 1430, 0x1534 }, { 1436, 0xe00a }, { 1441, 0x5840 }, { 1445, 0x5036 }, { 1451, 0x0820 }, { 1453, 0x0000 }, /* 0x5f00 */ { 1453, 0x41c4 }, { 1458, 0x3200 }, { 1461, 0x591e }, { 1469, 0xa851 }, { 1475, 0x20b1 }, { 1480, 0x0911 }, { 1484, 0x8099 }, { 1489, 0x6534 }, { 1496, 0xa200 }, { 1499, 0x3040 }, { 1502, 0x9894 }, { 1508, 0x0103 }, { 1511, 0x0b90 }, { 1516, 0x401f }, { 1522, 0xf706 }, { 1531, 0x144c }, /* 0x6000 */ { 1536, 0x2480 }, { 1539, 0x8598 }, { 1545, 0x2010 }, { 1547, 0x0028 }, { 1549, 0x1381 }, { 1554, 0x20d2 }, { 1559, 0x0082 }, { 1561, 0xc002 }, { 1564, 0x4544 }, { 1569, 0x612a }, { 1575, 0x0134 }, { 1579, 0x4883 }, { 1584, 0xcf14 }, { 1592, 0x6a30 }, { 1598, 0x0024 }, { 1600, 0x3124 }, /* 0x6100 */ { 1605, 0x1484 }, { 1609, 0x52df }, { 1619, 0x0c04 }, { 1622, 0x02e3 }, { 1628, 0x0262 }, { 1632, 0x4000 }, { 1633, 0x1001 }, { 1635, 0x9904 }, { 1640, 0x281b }, { 1646, 0xb18c }, { 1653, 0x2521 }, { 1658, 0x1300 }, { 1661, 0xc007 }, { 1666, 0xf020 }, { 1671, 0xb2a6 }, { 1679, 0x0000 }, /* 0x6200 */ { 1679, 0x009a }, { 1683, 0x1028 }, { 1686, 0x0a8d }, { 1692, 0x2200 }, { 1694, 0x105c }, { 1699, 0x1457 }, { 1706, 0xa010 }, { 1709, 0x2408 }, { 1712, 0xe000 }, { 1715, 0x0001 }, { 1716, 0x0140 }, { 1718, 0xc4c8 }, { 1724, 0x4010 }, { 1726, 0x0460 }, { 1729, 0x0400 }, { 1730, 0x3014 }, /* 0x6300 */ { 1734, 0x2c18 }, { 1739, 0x0149 }, { 1743, 0x2600 }, { 1746, 0x1260 }, { 1750, 0x4c5e }, { 1758, 0x091c }, { 1763, 0x3060 }, { 1767, 0xb132 }, { 1774, 0x0494 }, { 1778, 0x4631 }, { 1784, 0xe050 }, { 1789, 0x2000 }, { 1790, 0x4122 }, { 1794, 0x103a }, { 1799, 0x1421 }, { 1803, 0x032c }, /* 0x6400 */ { 1808, 0x0600 }, { 1810, 0x4115 }, { 1815, 0x8635 }, { 1822, 0xa021 }, { 1826, 0x8800 }, { 1828, 0xbc1e }, { 1837, 0x200b }, { 1841, 0x2818 }, { 1845, 0x80a0 }, { 1848, 0xab03 }, { 1855, 0x114a }, { 1860, 0xe008 }, { 1864, 0x5e10 }, { 1870, 0x00a3 }, { 1874, 0x2630 }, { 1879, 0x88a1 }, /* 0x6500 */ { 1884, 0x8712 }, { 1890, 0xca58 }, { 1897, 0x4244 }, { 1901, 0x3402 }, { 1905, 0x0288 }, { 1908, 0x8015 }, { 1912, 0x0881 }, { 1915, 0x2400 }, { 1917, 0x0422 }, { 1920, 0x2124 }, { 1924, 0x4049 }, { 1928, 0x801c }, { 1932, 0x4304 }, { 1936, 0x8151 }, { 1941, 0x0000 }, { 1941, 0xc235 }, /* 0x6600 */ { 1948, 0x2311 }, { 1953, 0x6066 }, { 1959, 0x5e5e }, { 1969, 0x028b }, { 1974, 0x5461 }, { 1980, 0x1b82 }, { 1986, 0x1c03 }, { 1991, 0xdba8 }, { 2000, 0x3801 }, { 2004, 0x9e05 }, { 2011, 0x2011 }, { 2014, 0x8826 }, { 2019, 0xd10d }, { 2026, 0x8810 }, { 2029, 0x5900 }, { 2033, 0x0c00 }, /* 0x6700 */ { 2035, 0x40a0 }, { 2038, 0x1208 }, { 2041, 0x0005 }, { 2043, 0x4008 }, { 2045, 0x11a0 }, { 2049, 0x2030 }, { 2052, 0x5040 }, { 2055, 0x0850 }, { 2058, 0xc012 }, { 2062, 0x0b4a }, { 2068, 0x0000 }, { 2068, 0x3827 }, { 2075, 0x032d }, { 2081, 0x1284 }, { 2085, 0x0042 }, { 2087, 0x02c5 }, /* 0x6800 */ { 2092, 0x0000 }, { 2092, 0xa210 }, { 2096, 0xb180 }, { 2101, 0x880b }, { 2106, 0x1430 }, { 2110, 0x09a4 }, { 2115, 0xc800 }, { 2118, 0x1e27 }, { 2126, 0x0154 }, { 2130, 0x1540 }, { 2134, 0x462a }, { 2140, 0x0804 }, { 2142, 0x9120 }, { 2146, 0x324b }, { 2153, 0x3d20 }, { 2159, 0x3863 }, /* 0x6900 */ { 2166, 0x0640 }, { 2169, 0x00cb }, { 2174, 0x0000 }, { 2174, 0x092a }, { 2179, 0x4224 }, { 2183, 0x0880 }, { 2185, 0x1378 }, { 2192, 0x8c07 }, { 2198, 0x2001 }, { 2200, 0x0144 }, { 2203, 0xa962 }, { 2210, 0x1580 }, { 2214, 0x0120 }, { 2216, 0x00c2 }, { 2219, 0xc024 }, { 2223, 0x402a }, /* 0x6a00 */ { 2227, 0x800b }, { 2231, 0x2422 }, { 2235, 0x0111 }, { 2238, 0xc895 }, { 2245, 0x4660 }, { 2250, 0x0867 }, { 2256, 0x0490 }, { 2259, 0x400a }, { 2262, 0x0aca }, { 2268, 0xe802 }, { 2273, 0x8820 }, { 2276, 0xe013 }, { 2282, 0x1340 }, { 2286, 0x3071 }, { 2292, 0x1090 }, { 2295, 0x3007 }, /* 0x6b00 */ { 2300, 0x82cc }, { 2306, 0x4883 }, { 2311, 0x9910 }, { 2316, 0x8860 }, { 2320, 0x2440 }, { 2323, 0x2144 }, { 2327, 0x4881 }, { 2331, 0x6021 }, { 2335, 0x0024 }, { 2337, 0x8880 }, { 2340, 0x730d }, { 2348, 0x6301 }, { 2353, 0x1218 }, { 2357, 0x0440 }, { 2359, 0x40ca }, { 2364, 0x8282 }, /* 0x6c00 */ { 2368, 0x6234 }, { 2374, 0x8205 }, { 2378, 0x51c0 }, { 2383, 0x8c68 }, { 2389, 0xac00 }, { 2393, 0x1a14 }, { 2398, 0xa880 }, { 2402, 0x0b50 }, { 2407, 0x02e0 }, { 2411, 0x91b0 }, { 2417, 0x0000 }, { 2417, 0x0015 }, { 2420, 0xa044 }, { 2424, 0x1457 }, { 2431, 0x5a81 }, { 2437, 0x0014 }, /* 0x6d00 */ { 2439, 0xc490 }, { 2444, 0x040a }, { 2447, 0xc1c0 }, { 2452, 0x9202 }, { 2456, 0x0000 }, { 2456, 0xc080 }, { 2459, 0x80a2 }, { 2463, 0x1001 }, { 2465, 0x0084 }, { 2467, 0x01d6 }, { 2473, 0x1400 }, { 2475, 0xa290 }, { 2480, 0xc510 }, { 2485, 0xa840 }, { 2489, 0x8225 }, { 2494, 0x1051 }, /* 0x6e00 */ { 2498, 0x0011 }, { 2500, 0x4000 }, { 2501, 0x0084 }, { 2503, 0x1a44 }, { 2508, 0x8b30 }, { 2514, 0x709e }, { 2522, 0x010c }, { 2525, 0x2808 }, { 2528, 0x2000 }, { 2529, 0x0208 }, { 2531, 0x6081 }, { 2535, 0x880a }, { 2539, 0xe58b }, { 2548, 0x0000 }, { 2548, 0x6800 }, { 2551, 0x2a00 }, /* 0x6f00 */ { 2554, 0x3510 }, { 2559, 0x0d40 }, { 2563, 0xa640 }, { 2568, 0x1849 }, { 2573, 0x8000 }, { 2574, 0x668e }, { 2582, 0x1106 }, { 2586, 0x6000 }, { 2588, 0x3988 }, { 2594, 0x845d }, { 2601, 0xc1e1 }, { 2608, 0x1061 }, { 2612, 0x05a0 }, { 2616, 0x4400 }, { 2618, 0x0300 }, { 2620, 0x3221 }, /* 0x7000 */ { 2625, 0x20e1 }, { 2630, 0x0080 }, { 2631, 0x8009 }, { 2634, 0x1290 }, { 2638, 0x4f18 }, { 2645, 0x6030 }, { 2649, 0x5030 }, { 2653, 0x4060 }, { 2656, 0x0062 }, { 2659, 0x09f0 }, { 2665, 0x0810 }, { 2667, 0x0093 }, { 2671, 0x0400 }, { 2672, 0x117a }, { 2679, 0x0010 }, { 2680, 0x0400 }, /* 0x7100 */ { 2681, 0x98f8 }, { 2689, 0x4000 }, { 2690, 0xa801 }, { 2694, 0x0103 }, { 2697, 0x0ce2 }, { 2703, 0x5485 }, { 2709, 0x0101 }, { 2711, 0x0200 }, { 2712, 0x10a1 }, { 2716, 0x0c04 }, { 2719, 0x8005 }, { 2722, 0x840d }, { 2727, 0x1813 }, { 2732, 0x1648 }, { 2737, 0x0000 }, { 2737, 0x4100 }, /* 0x7200 */ { 2739, 0x0381 }, { 2743, 0xa488 }, { 2748, 0x8810 }, { 2751, 0x0310 }, { 2754, 0xc02e }, { 2760, 0x5469 }, { 2767, 0xc909 }, { 2773, 0x9982 }, { 2779, 0x6210 }, { 2783, 0x0808 }, { 2785, 0x6100 }, { 2788, 0x4012 }, { 2791, 0x1282 }, { 2795, 0x8160 }, { 2799, 0x0020 }, { 2800, 0x4c18 }, /* 0x7300 */ { 2805, 0x28b4 }, { 2811, 0x430c }, { 2816, 0x1194 }, { 2821, 0x2c26 }, { 2827, 0x2008 }, { 2829, 0xe145 }, { 2836, 0xdac1 }, { 2844, 0x1282 }, { 2848, 0x406b }, { 2854, 0xd1a9 }, { 2862, 0x2c65 }, { 2869, 0xb2a0 }, { 2875, 0x9a60 }, { 2881, 0x224c }, { 2886, 0x02ca }, { 2891, 0xaeb0 }, /* 0x7400 */ { 2899, 0x0493 }, { 2904, 0x0c02 }, { 2907, 0xff50 }, { 2917, 0x0203 }, { 2920, 0x28d9 }, { 2927, 0x2086 }, { 2931, 0x69c4 }, { 2938, 0x0006 }, { 2940, 0x82e3 }, { 2947, 0x9707 }, { 2955, 0xcf4b }, { 2965, 0x8a26 }, { 2971, 0x1300 }, { 2974, 0xcd09 }, { 2981, 0x8d10 }, { 2986, 0x9c10 }, /* 0x7500 */ { 2991, 0x0040 }, { 2992, 0x00c4 }, { 2995, 0x8693 }, { 3002, 0xe240 }, { 3007, 0x4189 }, { 3012, 0xc085 }, { 3017, 0x8002 }, { 3019, 0x7e02 }, { 3026, 0x0022 }, { 3028, 0x122d }, { 3034, 0x0014 }, { 3036, 0x8410 }, { 3039, 0xd053 }, { 3046, 0x9080 }, { 3049, 0xd093 }, { 3056, 0x0202 }, /* 0x7600 */ { 3058, 0x959d }, { 3067, 0x7a6c }, { 3076, 0x2268 }, { 3081, 0x172c }, { 3088, 0x0e3b }, { 3096, 0x8220 }, { 3099, 0xe030 }, { 3104, 0x0012 }, { 3106, 0x3022 }, { 3110, 0xb820 }, { 3115, 0x25fd }, { 3125, 0x2000 }, { 3126, 0x5a22 }, { 3132, 0x0210 }, { 3134, 0x1141 }, { 3138, 0x1243 }, /* 0x7700 */ { 3143, 0x4441 }, { 3147, 0x16b4 }, { 3154, 0xe104 }, { 3159, 0x6270 }, { 3165, 0xe464 }, { 3172, 0xd0c4 }, { 3178, 0x1495 }, { 3184, 0x241d }, { 3190, 0x3011 }, { 3194, 0x8470 }, { 3199, 0xc484 }, { 3204, 0x4022 }, { 3207, 0x0208 }, { 3209, 0xc226 }, { 3215, 0x1451 }, { 3220, 0x0913 }, /* 0x7800 */ { 3225, 0x6260 }, { 3230, 0x2002 }, { 3232, 0x600e }, { 3237, 0x00a1 }, { 3240, 0x5198 }, { 3246, 0x5004 }, { 3249, 0x451b }, { 3256, 0x4400 }, { 3258, 0x8400 }, { 3260, 0xe110 }, { 3265, 0x3112 }, { 3270, 0xa80f }, { 3277, 0x5380 }, { 3282, 0x886c }, { 3288, 0x0453 }, { 3293, 0x8ccc }, /* 0x7900 */ { 3300, 0x1041 }, { 3303, 0xd401 }, { 3308, 0x22a1 }, { 3313, 0xa832 }, { 3319, 0x8c70 }, { 3325, 0x1912 }, { 3330, 0x0a80 }, { 3333, 0x5a04 }, { 3338, 0x1800 }, { 3340, 0x197a }, { 3348, 0x8b02 }, { 3353, 0x0912 }, { 3357, 0x8594 }, { 3363, 0x6450 }, { 3368, 0x2c25 }, { 3374, 0x1102 }, /* 0x7a00 */ { 3377, 0x168c }, { 3383, 0x4822 }, { 3387, 0xa882 }, { 3392, 0x0731 }, { 3398, 0x11b0 }, { 3403, 0xb260 }, { 3409, 0x24a1 }, { 3414, 0x4120 }, { 3417, 0x0c65 }, { 3423, 0x4013 }, { 3427, 0x1009 }, { 3430, 0x1a28 }, { 3435, 0x5240 }, { 3439, 0x0802 }, { 3441, 0x1b00 }, { 3445, 0x6812 }, /* 0x7b00 */ { 3450, 0x0080 }, { 3451, 0x8010 }, { 3453, 0xee88 }, { 3461, 0xa013 }, { 3466, 0x4083 }, { 3470, 0x0020 }, { 3471, 0xa651 }, { 3478, 0x008c }, { 3481, 0x4210 }, { 3484, 0x4843 }, { 3489, 0x9021 }, { 3493, 0x3c65 }, { 3501, 0x0524 }, { 3505, 0x0ed0 }, { 3511, 0x0500 }, { 3513, 0x5734 }, /* 0x7c00 */ { 3521, 0xda5e }, { 3531, 0x0a00 }, { 3533, 0x1161 }, { 3538, 0x065a }, { 3544, 0x0440 }, { 3546, 0x7e2e }, { 3556, 0x628a }, { 3562, 0x3205 }, { 3567, 0x80c0 }, { 3570, 0x4010 }, { 3572, 0x0041 }, { 3574, 0x9cc1 }, { 3581, 0xa390 }, { 3587, 0x26b8 }, { 3594, 0x0a40 }, { 3597, 0x0020 }, /* 0x7d00 */ { 3598, 0x8388 }, { 3603, 0x604e }, { 3609, 0x2448 }, { 3613, 0x7002 }, { 3617, 0x2183 }, { 3622, 0x368a }, { 3629, 0x04a0 }, { 3632, 0x8d01 }, { 3637, 0x396e }, { 3646, 0x60c2 }, { 3651, 0x04c0 }, { 3654, 0x02c8 }, { 3658, 0x707c }, { 3666, 0x0280 }, { 3668, 0x2c64 }, { 3674, 0x0662 }, /* 0x7e00 */ { 3679, 0x0101 }, { 3681, 0x30a3 }, { 3687, 0xb181 }, { 3693, 0x8048 }, { 3696, 0x40b0 }, { 3700, 0x8105 }, { 3704, 0xc826 }, { 3710, 0x4108 }, { 3713, 0x24c2 }, { 3718, 0x6522 }, { 3724, 0x0000 }, { 3724, 0x0000 }, { 3724, 0x0000 }, { 3724, 0x0000 }, { 3724, 0x0000 }, { 3724, 0x0000 }, /* 0x7f00 */ { 3724, 0x0000 }, { 3724, 0x0000 }, { 3724, 0x0000 }, { 3724, 0xf800 }, { 3729, 0x8098 }, { 3733, 0x380c }, { 3738, 0x207a }, { 3744, 0xe002 }, { 3748, 0xa801 }, { 3752, 0x10c3 }, { 3757, 0x2446 }, { 3762, 0x9010 }, { 3765, 0xc109 }, { 3770, 0x8800 }, { 3772, 0xd128 }, { 3778, 0xe404 }, /* 0x8000 */ { 3783, 0xe580 }, { 3789, 0xe05a }, { 3796, 0x5051 }, { 3801, 0x56b1 }, { 3809, 0x0011 }, { 3811, 0x0000 }, { 3811, 0x2051 }, { 3815, 0x0022 }, { 3817, 0x4102 }, { 3820, 0x5000 }, { 3822, 0x08c0 }, { 3825, 0x0300 }, { 3827, 0xa100 }, { 3830, 0x01b4 }, { 3835, 0x6001 }, { 3838, 0x464d }, /* 0x8100 */ { 3845, 0x0808 }, { 3847, 0x51c0 }, { 3852, 0x1091 }, { 3856, 0x1421 }, { 3860, 0x14a0 }, { 3864, 0x0084 }, { 3866, 0xa383 }, { 3873, 0x0080 }, { 3874, 0x4872 }, { 3880, 0x4941 }, { 3885, 0x4004 }, { 3887, 0x0814 }, { 3890, 0xcc28 }, { 3896, 0x68a0 }, { 3901, 0x1812 }, { 3905, 0xa367 }, /* 0x8200 */ { 3914, 0x8009 }, { 3917, 0x2618 }, { 3922, 0x0106 }, { 3925, 0x0414 }, { 3928, 0xc878 }, { 3935, 0x1042 }, { 3938, 0x2089 }, { 3942, 0xa810 }, { 3946, 0x469b }, { 3954, 0x0d52 }, { 3960, 0x479b }, { 3969, 0xd495 }, { 3977, 0x0040 }, { 3978, 0x0421 }, { 3981, 0xa515 }, { 3988, 0x60c0 }, /* 0x8300 */ { 3992, 0x0d83 }, { 3998, 0xe800 }, { 4002, 0x7006 }, { 4007, 0x3489 }, { 4013, 0x609c }, { 4019, 0x00fa }, { 4025, 0x0000 }, { 4025, 0xa101 }, { 4029, 0x2055 }, { 4034, 0x3b34 }, { 4042, 0x32c0 }, { 4047, 0xc000 }, { 4049, 0x8281 }, { 4053, 0x2013 }, { 4057, 0x0500 }, { 4059, 0x1340 }, /* 0x8400 */ { 4063, 0x8442 }, { 4067, 0x0222 }, { 4070, 0x8000 }, { 4071, 0x0200 }, { 4072, 0xa5a0 }, { 4078, 0x1746 }, { 4085, 0x04b1 }, { 4090, 0x3159 }, { 4097, 0x0022 }, { 4099, 0x402c }, { 4103, 0x8740 }, { 4108, 0x6412 }, { 4113, 0x9185 }, { 4119, 0x1008 }, { 4121, 0x8480 }, { 4124, 0x2c87 }, /* 0x8500 */ { 4131, 0x508c }, { 4136, 0x5001 }, { 4139, 0x8cbc }, { 4147, 0x805c }, { 4152, 0x8040 }, { 4154, 0xf24f }, { 4164, 0x8817 }, { 4170, 0xae00 }, { 4175, 0x9a62 }, { 4182, 0xa108 }, { 4186, 0x20a5 }, { 4191, 0xf1d0 }, { 4199, 0x4c84 }, { 4204, 0x8500 }, { 4207, 0x2141 }, { 4211, 0x9048 }, /* 0x8600 */ { 4215, 0x6031 }, { 4220, 0x4b07 }, { 4227, 0x0282 }, { 4230, 0x3540 }, { 4235, 0x0047 }, { 4239, 0x23cc }, { 4246, 0x921f }, { 4254, 0x04e0 }, { 4258, 0x2100 }, { 4260, 0x1542 }, { 4265, 0x21c2 }, { 4270, 0x83ba }, { 4278, 0x002b }, { 4282, 0x14a6 }, { 4288, 0x00a9 }, { 4292, 0x3400 }, /* 0x8700 */ { 4295, 0xc8b0 }, { 4301, 0xc219 }, { 4307, 0xc10a }, { 4312, 0x7606 }, { 4319, 0x2029 }, { 4323, 0x2100 }, { 4325, 0x8032 }, { 4329, 0x0806 }, { 4332, 0x1bf8 }, { 4341, 0x43a9 }, { 4348, 0x7089 }, { 4354, 0xc022 }, { 4358, 0x4702 }, { 4363, 0x9660 }, { 4369, 0x2c1c }, { 4375, 0x850a }, /* 0x8800 */ { 4380, 0x0e4a }, { 4386, 0xdf1d }, { 4397, 0x6100 }, { 4400, 0x1425 }, { 4405, 0x4f2a }, { 4413, 0x9562 }, { 4420, 0x0211 }, { 4423, 0x0a02 }, { 4426, 0x0001 }, { 4427, 0x9d00 }, { 4432, 0x0501 }, { 4435, 0x6400 }, { 4438, 0x7c01 }, { 4444, 0x480e }, { 4449, 0x8080 }, { 4451, 0x00a3 }, /* 0x8900 */ { 4455, 0xe042 }, { 4460, 0x1760 }, { 4466, 0x01c1 }, { 4470, 0x4627 }, { 4477, 0x8265 }, { 4483, 0x1c84 }, { 4488, 0x480e }, { 4493, 0x3c29 }, { 4500, 0x2200 }, { 4502, 0x9831 }, { 4508, 0x0021 }, { 4510, 0x10f1 }, { 4516, 0x0000 }, { 4516, 0x01f0 }, { 4521, 0x2a20 }, { 4525, 0xa24a }, /* 0x8a00 */ { 4531, 0x80b0 }, { 4535, 0x4036 }, { 4540, 0x9855 }, { 4547, 0x60a0 }, { 4551, 0x62a9 }, { 4558, 0x31c8 }, { 4564, 0x00a2 }, { 4567, 0xcee0 }, { 4575, 0x8849 }, { 4580, 0x82c5 }, { 4586, 0xc280 }, { 4590, 0x48c8 }, { 4595, 0x0748 }, { 4600, 0xa0ba }, { 4607, 0x1000 }, { 4608, 0x9071 }, /* 0x8b00 */ { 4614, 0x0c60 }, { 4618, 0xd002 }, { 4622, 0x2000 }, { 4623, 0x1081 }, { 4626, 0x217c }, { 4633, 0x421c }, { 4638, 0x2008 }, { 4640, 0x5340 }, { 4645, 0xa832 }, { 4651, 0xd030 }, { 4656, 0x0000 }, { 4656, 0x0000 }, { 4656, 0x0000 }, { 4656, 0x0000 }, { 4656, 0x0000 }, { 4656, 0x0000 }, /* 0x8c00 */ { 4656, 0x0000 }, { 4656, 0x0000 }, { 4656, 0x0000 }, { 4656, 0x6300 }, { 4660, 0x8aa0 }, { 4665, 0x2b9a }, { 4673, 0x2358 }, { 4679, 0x4868 }, { 4684, 0x08c0 }, { 4687, 0x1a0d }, { 4693, 0x0010 }, { 4694, 0x0600 }, { 4696, 0x8a60 }, { 4701, 0x2260 }, { 4705, 0x9102 }, { 4709, 0xc1a5 }, /* 0x8d00 */ { 4716, 0x020a }, { 4719, 0x0884 }, { 4722, 0x0000 }, { 4722, 0x0000 }, { 4722, 0x0000 }, { 4722, 0x0000 }, { 4722, 0x5220 }, { 4726, 0x8000 }, { 4727, 0x2114 }, { 4731, 0xc023 }, { 4736, 0x9841 }, { 4741, 0x1aa4 }, { 4747, 0x45e1 }, { 4754, 0x02b2 }, { 4759, 0x10b0 }, { 4763, 0x2017 }, /* 0x8e00 */ { 4768, 0x0872 }, { 4773, 0x0052 }, { 4776, 0x00cf }, { 4782, 0x23ca }, { 4789, 0xe803 }, { 4795, 0x7810 }, { 4800, 0xb206 }, { 4806, 0x0e03 }, { 4811, 0x020c }, { 4814, 0x6c25 }, { 4821, 0x6284 }, { 4826, 0x0c28 }, { 4830, 0x809b }, { 4836, 0x1012 }, { 4839, 0x6100 }, { 4842, 0x0683 }, /* 0x8f00 */ { 4847, 0x8185 }, { 4852, 0x41c1 }, { 4857, 0x71ab }, { 4866, 0x04f0 }, { 4871, 0x808b }, { 4876, 0x613e }, { 4884, 0x0020 }, { 4885, 0x0000 }, { 4885, 0x0000 }, { 4885, 0x2000 }, { 4886, 0x0073 }, { 4891, 0x4160 }, { 4895, 0x2c43 }, { 4901, 0x002d }, { 4905, 0x4119 }, { 4910, 0x4862 }, /* 0x9000 */ { 4915, 0x1114 }, { 4919, 0x0900 }, { 4921, 0xb700 }, { 4927, 0x8098 }, { 4931, 0x1018 }, { 4934, 0x2800 }, { 4936, 0x10c4 }, { 4940, 0x0211 }, { 4943, 0x5920 }, { 4948, 0x0ba1 }, { 4954, 0x0027 }, { 4958, 0x605d }, { 4965, 0x11b8 }, { 4971, 0xb3a4 }, { 4979, 0x8820 }, { 4982, 0xc051 }, /* 0x9100 */ { 4987, 0x2171 }, { 4993, 0x55d1 }, { 5001, 0xc2ad }, { 5009, 0x36d2 }, { 5017, 0x8188 }, { 5021, 0x0e88 }, { 5026, 0x2092 }, { 5030, 0x0e10 }, { 5034, 0x446a }, { 5040, 0x413a }, { 5046, 0x7142 }, { 5052, 0xb84f }, { 5061, 0x002c }, { 5064, 0x4698 }, { 5070, 0xf630 }, { 5078, 0x2a83 }, /* 0x9200 */ { 5084, 0x16f3 }, { 5093, 0x314d }, { 5100, 0xc178 }, { 5107, 0x5769 }, { 5116, 0xe4cd }, { 5125, 0x3302 }, { 5130, 0xc3a3 }, { 5138, 0xbbe1 }, { 5148, 0x6700 }, { 5153, 0x8284 }, { 5157, 0x89b1 }, { 5164, 0xbd44 }, { 5172, 0x79ef }, { 5184, 0xb3a9 }, { 5193, 0x51ab }, { 5201, 0x8a01 }, /* 0x9300 */ { 5205, 0x2105 }, { 5209, 0xf032 }, { 5216, 0x06b2 }, { 5222, 0x00d8 }, { 5226, 0x0380 }, { 5229, 0x45a7 }, { 5237, 0xa6b0 }, { 5244, 0xa45b }, { 5252, 0xad07 }, { 5260, 0x4924 }, { 5265, 0x0b5a }, { 5272, 0x0470 }, { 5276, 0x3ef2 }, { 5286, 0xd208 }, { 5291, 0x00c4 }, { 5294, 0x2f80 }, /* 0x9400 */ { 5300, 0xe316 }, { 5308, 0x80e0 }, { 5312, 0xc000 }, { 5314, 0xa81e }, { 5321, 0x1528 }, { 5326, 0x9220 }, { 5330, 0xe90a }, { 5337, 0x0006 }, { 5339, 0x0018 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, /* 0x9500 */ { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x4300 }, { 5344, 0x7110 }, { 5349, 0xe000 }, { 5352, 0x1a42 }, { 5357, 0xa450 }, { 5362, 0x0b40 }, { 5366, 0xe60f }, { 5375, 0x0051 }, { 5378, 0x0000 }, /* 0x9600 */ { 5378, 0x0000 }, { 5378, 0x6000 }, { 5380, 0x1074 }, { 5385, 0x378a }, { 5393, 0x0002 }, { 5394, 0x01d4 }, { 5399, 0x4002 }, { 5401, 0xd810 }, { 5406, 0x021e }, { 5411, 0xa442 }, { 5416, 0xc270 }, { 5422, 0x0408 }, { 5424, 0x0400 }, { 5425, 0xe504 }, { 5431, 0x8200 }, { 5433, 0x0402 }, /* 0x9700 */ { 5435, 0x022c }, { 5439, 0x2c00 }, { 5442, 0x010e }, { 5446, 0x000a }, { 5448, 0xc40a }, { 5453, 0x0da0 }, { 5458, 0x4488 }, { 5462, 0xa9c8 }, { 5469, 0x0201 }, { 5471, 0xc6e0 }, { 5478, 0x5004 }, { 5481, 0xd766 }, { 5491, 0x76b2 }, { 5500, 0x6b93 }, { 5509, 0x8013 }, { 5513, 0x0592 }, /* 0x9800 */ { 5518, 0x6480 }, { 5522, 0x5250 }, { 5527, 0xc869 }, { 5534, 0x402d }, { 5539, 0x0490 }, { 5542, 0x06ce }, { 5549, 0x146c }, { 5555, 0x0000 }, { 5555, 0x0000 }, { 5555, 0x0000 }, { 5555, 0x6800 }, { 5558, 0x8d91 }, { 5565, 0x1124 }, { 5569, 0x0000 }, { 5569, 0x04ea }, { 5575, 0x0048 }, /* 0x9900 */ { 5577, 0x0184 }, { 5580, 0x9ce2 }, { 5588, 0x08c4 }, { 5592, 0x1e3e }, { 5601, 0x61c3 }, { 5608, 0xdb10 }, { 5615, 0x0001 }, { 5616, 0x0000 }, { 5616, 0x0000 }, { 5616, 0xa800 }, { 5619, 0x0040 }, { 5620, 0xa627 }, { 5628, 0x0208 }, { 5630, 0x5618 }, { 5636, 0x1c80 }, { 5640, 0x6231 }, /* 0x9a00 */ { 5646, 0x181c }, { 5651, 0x4043 }, { 5655, 0x609d }, { 5662, 0x0168 }, { 5666, 0x5c92 }, { 5673, 0x2052 }, { 5677, 0x0000 }, { 5677, 0x0000 }, { 5677, 0x0000 }, { 5677, 0x0000 }, { 5677, 0xd400 }, { 5681, 0xca74 }, { 5689, 0x414a }, { 5694, 0x18e5 }, { 5701, 0x12b1 }, { 5707, 0xa62c }, /* 0x9b00 */ { 5714, 0x7b3f }, { 5726, 0x1a45 }, { 5732, 0x2841 }, { 5736, 0x26b8 }, { 5743, 0x1900 }, { 5746, 0x48e0 }, { 5751, 0x7d6a }, { 5761, 0x83a8 }, { 5767, 0xaef1 }, { 5777, 0x6411 }, { 5782, 0x12c0 }, { 5786, 0xd987 }, { 5795, 0x4182 }, { 5799, 0xa181 }, { 5804, 0x8ca0 }, { 5809, 0xa788 }, /* 0x9c00 */ { 5816, 0x8805 }, { 5820, 0x5742 }, { 5827, 0x07cc }, { 5834, 0x20e2 }, { 5839, 0xc63a }, { 5847, 0xf959 }, { 5857, 0x4f08 }, { 5863, 0x08a5 }, { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0040 }, { 5869, 0x0284 }, /* 0x9d00 */ { 5872, 0x0804 }, { 5874, 0x7182 }, { 5880, 0x8000 }, { 5881, 0x341d }, { 5888, 0x04ac }, { 5893, 0x8018 }, { 5896, 0x0e2c }, { 5902, 0x58c1 }, { 5908, 0x6458 }, { 5914, 0x01ec }, { 5920, 0x5402 }, { 5924, 0x9222 }, { 5929, 0x0688 }, { 5933, 0xc4f0 }, { 5940, 0x4aa1 }, { 5946, 0x4019 }, /* 0x9e00 */ { 5950, 0x4484 }, { 5954, 0x3267 }, { 5962, 0x0000 }, { 5962, 0x0000 }, { 5962, 0x0000 }, { 5962, 0x0000 }, { 5962, 0x0000 }, { 5962, 0x1c00 }, { 5965, 0xc0bd }, { 5973, 0x4940 }, { 5977, 0xd110 }, { 5982, 0x0039 }, { 5986, 0x0940 }, { 5989, 0x8020 }, { 5991, 0x7090 }, { 5996, 0x8127 }, /* 0x9f00 */ { 6002, 0x820c }, { 6006, 0x8ed7 }, { 6016, 0x8c44 }, { 6021, 0xb696 }, { 6030, 0x00fa }, { 6036, 0x65e8 }, { 6044, 0xe300 }, { 6049, 0x242b }, { 6055, 0x8000 }, { 6056, 0x40d7 }, { 6063, 0x002e }, }; static int jisx0212_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { if (n >= 2) { const Summary16 *summary = NULL; if (wc < 0x0460) summary = &jisx0212_uni2indx_page00[(wc>>4)]; else if (wc >= 0x2100 && wc < 0x2130) summary = &jisx0212_uni2indx_page21[(wc>>4)-0x210]; else if (wc >= 0x4e00 && wc < 0x9fb0) summary = &jisx0212_uni2indx_page4e[(wc>>4)-0x4e0]; if (summary) { unsigned short used = summary->used; unsigned int i = wc & 0x0f; if (used & ((unsigned short) 1 << i)) { unsigned short c; /* Keep in `used' only the bits 0..i-1. */ used &= ((unsigned short) 1 << i) - 1; /* Add `summary->indx' and the number of bits set in `used'. */ used = (used & 0x5555) + ((used & 0xaaaa) >> 1); used = (used & 0x3333) + ((used & 0xcccc) >> 2); used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); used = (used & 0x00ff) + (used >> 8); c = jisx0212_2charset[summary->indx + used]; r[0] = (c >> 8); r[1] = (c & 0xff); return 2; } } return RET_ILSEQ; } return RET_TOOSMALL; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/koi8_c.h0000644000000000000000000001007113614532331017522 0ustar /* * KOI8-C */ static const unsigned short koi8_c_2uni[128] = { /* 0x80 */ 0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3, 0x04b7, 0x04b9, 0x04bb, 0x2580, 0x04d9, 0x04e3, 0x04e9, 0x04ef, /* 0x90 */ 0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2, 0x04b6, 0x04b8, 0x04ba, 0x2321, 0x04d8, 0x04e2, 0x04e8, 0x04ee, /* 0xa0 */ 0x00a0, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0491, 0x045e, 0x045f, /* 0xb0 */ 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, 0x0486, 0x0409, 0x040a, 0x040b, 0x040c, 0x0490, 0x040e, 0x040f, /* 0xc0 */ 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0xd0 */ 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0xe0 */ 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0xf0 */ 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a, }; static int koi8_c_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0x80) *pwc = (ucs4_t) c; else *pwc = (ucs4_t) koi8_c_2uni[c-0x80]; return 1; } static const unsigned char koi8_c_page00[1] = { 0xa0, /* 0xa0-0xa7 */ }; static const unsigned char koi8_c_page04[240] = { 0x00, 0xb3, 0xb1, 0xb2, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x00-0x07 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0x00, 0xbe, 0xbf, /* 0x08-0x0f */ 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */ 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, /* 0x18-0x1f */ 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe, /* 0x20-0x27 */ 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1, /* 0x28-0x2f */ 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda, /* 0x30-0x37 */ 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, /* 0x38-0x3f */ 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde, /* 0x40-0x47 */ 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1, /* 0x48-0x4f */ 0x00, 0xa3, 0xa1, 0xa2, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x50-0x57 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0xbd, 0xad, 0x90, 0x80, 0x00, 0x00, 0x91, 0x81, /* 0x90-0x97 */ 0x00, 0x00, 0x92, 0x82, 0x93, 0x83, 0x00, 0x00, /* 0x98-0x9f */ 0x00, 0x00, 0x94, 0x84, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x95, 0x85, /* 0xa8-0xaf */ 0x96, 0x86, 0x97, 0x87, 0x00, 0x00, 0x98, 0x88, /* 0xb0-0xb7 */ 0x99, 0x89, 0x9a, 0x8a, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 0x9c, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 0x00, 0x00, 0x9d, 0x8d, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ 0x9e, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x9f, 0x8f, /* 0xe8-0xef */ }; static const unsigned char koi8_c_page22[1] = { 0xb0, /* 0x16-0x16 */ }; static int koi8_c_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x0080) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x00a1) c = koi8_c_page00[wc-0x00a0]; else if (wc >= 0x0400 && wc < 0x04ef) c = koi8_c_page04[wc-0x0400]; else if (wc >= 0x2216 && wc < 0x2217) c = koi8_c_page22[wc-0x2216]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/koi8_r.h0000644000000000000000000001340113614532331017541 0ustar /* * KOI8-R */ /* Specification: RFC 1489 */ static const unsigned short koi8_r_2uni[128] = { /* 0x80 */ 0x2500, 0x2502, 0x250c, 0x2510, 0x2514, 0x2518, 0x251c, 0x2524, 0x252c, 0x2534, 0x253c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590, /* 0x90 */ 0x2591, 0x2592, 0x2593, 0x2320, 0x25a0, 0x2219, 0x221a, 0x2248, 0x2264, 0x2265, 0x00a0, 0x2321, 0x00b0, 0x00b2, 0x00b7, 0x00f7, /* 0xa0 */ 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, 0x255e, /* 0xb0 */ 0x255f, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x00a9, /* 0xc0 */ 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0xd0 */ 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0xe0 */ 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0xf0 */ 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a, }; static int koi8_r_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0x80) *pwc = (ucs4_t) c; else *pwc = (ucs4_t) koi8_r_2uni[c-0x80]; return 1; } static const unsigned char koi8_r_page00[88] = { 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ 0x9c, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xb0-0xb7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, /* 0xf0-0xf7 */ }; static const unsigned char koi8_r_page04[88] = { 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */ 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, /* 0x18-0x1f */ 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe, /* 0x20-0x27 */ 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1, /* 0x28-0x2f */ 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda, /* 0x30-0x37 */ 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, /* 0x38-0x3f */ 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde, /* 0x40-0x47 */ 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1, /* 0x48-0x4f */ 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ }; static const unsigned char koi8_r_page22[80] = { 0x00, 0x95, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x98, 0x99, 0x00, 0x00, /* 0x60-0x67 */ }; static const unsigned char koi8_r_page23[8] = { 0x93, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ }; static const unsigned char koi8_r_page25[168] = { 0x80, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0x83, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x85, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0xa0, 0xa1, 0xa2, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, /* 0x50-0x57 */ 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, /* 0x58-0x5f */ 0xb1, 0xb2, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, /* 0x60-0x67 */ 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x8b, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x8d, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0x8f, 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ }; static int koi8_r_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x0080) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x00f8) c = koi8_r_page00[wc-0x00a0]; else if (wc >= 0x0400 && wc < 0x0458) c = koi8_r_page04[wc-0x0400]; else if (wc >= 0x2218 && wc < 0x2268) c = koi8_r_page22[wc-0x2218]; else if (wc >= 0x2320 && wc < 0x2328) c = koi8_r_page23[wc-0x2320]; else if (wc >= 0x2500 && wc < 0x25a8) c = koi8_r_page25[wc-0x2500]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/koi8_u.h0000644000000000000000000001442213614532331017550 0ustar /* * KOI8-U */ /* Specification: RFC 2319 */ static const unsigned short koi8_u_2uni[128] = { /* 0x80 */ 0x2500, 0x2502, 0x250c, 0x2510, 0x2514, 0x2518, 0x251c, 0x2524, 0x252c, 0x2534, 0x253c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590, /* 0x90 */ 0x2591, 0x2592, 0x2593, 0x2320, 0x25a0, 0x2219, 0x221a, 0x2248, 0x2264, 0x2265, 0x00a0, 0x2321, 0x00b0, 0x00b2, 0x00b7, 0x00f7, /* 0xa0 */ 0x2550, 0x2551, 0x2552, 0x0451, 0x0454, 0x2554, 0x0456, 0x0457, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x0491, 0x255d, 0x255e, /* 0xb0 */ 0x255f, 0x2560, 0x2561, 0x0401, 0x0404, 0x2563, 0x0406, 0x0407, 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x0490, 0x256c, 0x00a9, /* 0xc0 */ 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0xd0 */ 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0xe0 */ 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0xf0 */ 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a, }; static int koi8_u_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0x80) *pwc = (ucs4_t) c; else *pwc = (ucs4_t) koi8_u_2uni[c-0x80]; return 1; } static const unsigned char koi8_u_page00[88] = { 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ 0x9c, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xb0-0xb7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, /* 0xf0-0xf7 */ }; static const unsigned char koi8_u_page04[152] = { 0x00, 0xb3, 0x00, 0x00, 0xb4, 0x00, 0xb6, 0xb7, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */ 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, /* 0x18-0x1f */ 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe, /* 0x20-0x27 */ 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1, /* 0x28-0x2f */ 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda, /* 0x30-0x37 */ 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, /* 0x38-0x3f */ 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde, /* 0x40-0x47 */ 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1, /* 0x48-0x4f */ 0x00, 0xa3, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0xbd, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ }; static const unsigned char koi8_u_page22[80] = { 0x00, 0x95, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x98, 0x99, 0x00, 0x00, /* 0x60-0x67 */ }; static const unsigned char koi8_u_page23[8] = { 0x93, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ }; static const unsigned char koi8_u_page25[168] = { 0x80, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0x83, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x85, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0xa0, 0xa1, 0xa2, 0x00, 0xa5, 0x00, 0x00, 0xa8, /* 0x50-0x57 */ 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, 0xb0, /* 0x58-0x5f */ 0xb1, 0xb2, 0x00, 0xb5, 0x00, 0x00, 0xb8, 0xb9, /* 0x60-0x67 */ 0xba, 0xbb, 0xbc, 0x00, 0xbe, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x8b, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x8d, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0x8f, 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ }; static int koi8_u_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x0080) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x00f8) c = koi8_u_page00[wc-0x00a0]; else if (wc >= 0x0400 && wc < 0x0498) c = koi8_u_page04[wc-0x0400]; else if (wc >= 0x2218 && wc < 0x2268) c = koi8_u_page22[wc-0x2218]; else if (wc >= 0x2320 && wc < 0x2328) c = koi8_u_page23[wc-0x2320]; else if (wc >= 0x2500 && wc < 0x25a8) c = koi8_u_page25[wc-0x2500]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/ksc5601.h0000644000000000000000000055224513614532331017460 0ustar /* * KSC5601.1987-0 */ static const unsigned short ksc5601_2uni_page21[1115] = { /* 0x21 */ 0x3000, 0x3001, 0x3002, 0x00b7, 0x2025, 0x2026, 0x00a8, 0x3003, 0x00ad, 0x2015, 0x2225, 0xff3c, 0x223c, 0x2018, 0x2019, 0x201c, 0x201d, 0x3014, 0x3015, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, 0x300d, 0x300e, 0x300f, 0x3010, 0x3011, 0x00b1, 0x00d7, 0x00f7, 0x2260, 0x2264, 0x2265, 0x221e, 0x2234, 0x00b0, 0x2032, 0x2033, 0x2103, 0x212b, 0xffe0, 0xffe1, 0xffe5, 0x2642, 0x2640, 0x2220, 0x22a5, 0x2312, 0x2202, 0x2207, 0x2261, 0x2252, 0x00a7, 0x203b, 0x2606, 0x2605, 0x25cb, 0x25cf, 0x25ce, 0x25c7, 0x25c6, 0x25a1, 0x25a0, 0x25b3, 0x25b2, 0x25bd, 0x25bc, 0x2192, 0x2190, 0x2191, 0x2193, 0x2194, 0x3013, 0x226a, 0x226b, 0x221a, 0x223d, 0x221d, 0x2235, 0x222b, 0x222c, 0x2208, 0x220b, 0x2286, 0x2287, 0x2282, 0x2283, 0x222a, 0x2229, 0x2227, 0x2228, 0xffe2, /* 0x22 */ 0x21d2, 0x21d4, 0x2200, 0x2203, 0x00b4, 0xff5e, 0x02c7, 0x02d8, 0x02dd, 0x02da, 0x02d9, 0x00b8, 0x02db, 0x00a1, 0x00bf, 0x02d0, 0x222e, 0x2211, 0x220f, 0x00a4, 0x2109, 0x2030, 0x25c1, 0x25c0, 0x25b7, 0x25b6, 0x2664, 0x2660, 0x2661, 0x2665, 0x2667, 0x2663, 0x2299, 0x25c8, 0x25a3, 0x25d0, 0x25d1, 0x2592, 0x25a4, 0x25a5, 0x25a8, 0x25a7, 0x25a6, 0x25a9, 0x2668, 0x260f, 0x260e, 0x261c, 0x261e, 0x00b6, 0x2020, 0x2021, 0x2195, 0x2197, 0x2199, 0x2196, 0x2198, 0x266d, 0x2669, 0x266a, 0x266c, 0x327f, 0x321c, 0x2116, 0x33c7, 0x2122, 0x33c2, 0x33d8, 0x2121, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x23 */ 0xff01, 0xff02, 0xff03, 0xff04, 0xff05, 0xff06, 0xff07, 0xff08, 0xff09, 0xff0a, 0xff0b, 0xff0c, 0xff0d, 0xff0e, 0xff0f, 0xff10, 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, 0xff19, 0xff1a, 0xff1b, 0xff1c, 0xff1d, 0xff1e, 0xff1f, 0xff20, 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0xff3b, 0xffe6, 0xff3d, 0xff3e, 0xff3f, 0xff40, 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58, 0xff59, 0xff5a, 0xff5b, 0xff5c, 0xff5d, 0xffe3, /* 0x24 */ 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, 0x3158, 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, 0x3160, 0x3161, 0x3162, 0x3163, 0x3164, 0x3165, 0x3166, 0x3167, 0x3168, 0x3169, 0x316a, 0x316b, 0x316c, 0x316d, 0x316e, 0x316f, 0x3170, 0x3171, 0x3172, 0x3173, 0x3174, 0x3175, 0x3176, 0x3177, 0x3178, 0x3179, 0x317a, 0x317b, 0x317c, 0x317d, 0x317e, 0x317f, 0x3180, 0x3181, 0x3182, 0x3183, 0x3184, 0x3185, 0x3186, 0x3187, 0x3188, 0x3189, 0x318a, 0x318b, 0x318c, 0x318d, 0x318e, /* 0x25 */ 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x26 */ 0x2500, 0x2502, 0x250c, 0x2510, 0x2518, 0x2514, 0x251c, 0x252c, 0x2524, 0x2534, 0x253c, 0x2501, 0x2503, 0x250f, 0x2513, 0x251b, 0x2517, 0x2523, 0x2533, 0x252b, 0x253b, 0x254b, 0x2520, 0x252f, 0x2528, 0x2537, 0x253f, 0x251d, 0x2530, 0x2525, 0x2538, 0x2542, 0x2512, 0x2511, 0x251a, 0x2519, 0x2516, 0x2515, 0x250e, 0x250d, 0x251e, 0x251f, 0x2521, 0x2522, 0x2526, 0x2527, 0x2529, 0x252a, 0x252d, 0x252e, 0x2531, 0x2532, 0x2535, 0x2536, 0x2539, 0x253a, 0x253d, 0x253e, 0x2540, 0x2541, 0x2543, 0x2544, 0x2545, 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x27 */ 0x3395, 0x3396, 0x3397, 0x2113, 0x3398, 0x33c4, 0x33a3, 0x33a4, 0x33a5, 0x33a6, 0x3399, 0x339a, 0x339b, 0x339c, 0x339d, 0x339e, 0x339f, 0x33a0, 0x33a1, 0x33a2, 0x33ca, 0x338d, 0x338e, 0x338f, 0x33cf, 0x3388, 0x3389, 0x33c8, 0x33a7, 0x33a8, 0x33b0, 0x33b1, 0x33b2, 0x33b3, 0x33b4, 0x33b5, 0x33b6, 0x33b7, 0x33b8, 0x33b9, 0x3380, 0x3381, 0x3382, 0x3383, 0x3384, 0x33ba, 0x33bb, 0x33bc, 0x33bd, 0x33be, 0x33bf, 0x3390, 0x3391, 0x3392, 0x3393, 0x3394, 0x2126, 0x33c0, 0x33c1, 0x338a, 0x338b, 0x338c, 0x33d6, 0x33c5, 0x33ad, 0x33ae, 0x33af, 0x33db, 0x33a9, 0x33aa, 0x33ab, 0x33ac, 0x33dd, 0x33d0, 0x33d3, 0x33c3, 0x33c9, 0x33dc, 0x33c6, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x28 */ 0x00c6, 0x00d0, 0x00aa, 0x0126, 0xfffd, 0x0132, 0xfffd, 0x013f, 0x0141, 0x00d8, 0x0152, 0x00ba, 0x00de, 0x0166, 0x014a, 0xfffd, 0x3260, 0x3261, 0x3262, 0x3263, 0x3264, 0x3265, 0x3266, 0x3267, 0x3268, 0x3269, 0x326a, 0x326b, 0x326c, 0x326d, 0x326e, 0x326f, 0x3270, 0x3271, 0x3272, 0x3273, 0x3274, 0x3275, 0x3276, 0x3277, 0x3278, 0x3279, 0x327a, 0x327b, 0x24d0, 0x24d1, 0x24d2, 0x24d3, 0x24d4, 0x24d5, 0x24d6, 0x24d7, 0x24d8, 0x24d9, 0x24da, 0x24db, 0x24dc, 0x24dd, 0x24de, 0x24df, 0x24e0, 0x24e1, 0x24e2, 0x24e3, 0x24e4, 0x24e5, 0x24e6, 0x24e7, 0x24e8, 0x24e9, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x00bd, 0x2153, 0x2154, 0x00bc, 0x00be, 0x215b, 0x215c, 0x215d, 0x215e, /* 0x29 */ 0x00e6, 0x0111, 0x00f0, 0x0127, 0x0131, 0x0133, 0x0138, 0x0140, 0x0142, 0x00f8, 0x0153, 0x00df, 0x00fe, 0x0167, 0x014b, 0x0149, 0x3200, 0x3201, 0x3202, 0x3203, 0x3204, 0x3205, 0x3206, 0x3207, 0x3208, 0x3209, 0x320a, 0x320b, 0x320c, 0x320d, 0x320e, 0x320f, 0x3210, 0x3211, 0x3212, 0x3213, 0x3214, 0x3215, 0x3216, 0x3217, 0x3218, 0x3219, 0x321a, 0x321b, 0x249c, 0x249d, 0x249e, 0x249f, 0x24a0, 0x24a1, 0x24a2, 0x24a3, 0x24a4, 0x24a5, 0x24a6, 0x24a7, 0x24a8, 0x24a9, 0x24aa, 0x24ab, 0x24ac, 0x24ad, 0x24ae, 0x24af, 0x24b0, 0x24b1, 0x24b2, 0x24b3, 0x24b4, 0x24b5, 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, 0x247b, 0x247c, 0x247d, 0x247e, 0x247f, 0x2480, 0x2481, 0x2482, 0x00b9, 0x00b2, 0x00b3, 0x2074, 0x207f, 0x2081, 0x2082, 0x2083, 0x2084, /* 0x2a */ 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, 0x3091, 0x3092, 0x3093, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x2b */ 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8, 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8, 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0, 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8, 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0, 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, /* 0x2c */ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, }; static const unsigned short ksc5601_2uni_page30[2350] = { /* 0x30 */ 0xac00, 0xac01, 0xac04, 0xac07, 0xac08, 0xac09, 0xac0a, 0xac10, 0xac11, 0xac12, 0xac13, 0xac14, 0xac15, 0xac16, 0xac17, 0xac19, 0xac1a, 0xac1b, 0xac1c, 0xac1d, 0xac20, 0xac24, 0xac2c, 0xac2d, 0xac2f, 0xac30, 0xac31, 0xac38, 0xac39, 0xac3c, 0xac40, 0xac4b, 0xac4d, 0xac54, 0xac58, 0xac5c, 0xac70, 0xac71, 0xac74, 0xac77, 0xac78, 0xac7a, 0xac80, 0xac81, 0xac83, 0xac84, 0xac85, 0xac86, 0xac89, 0xac8a, 0xac8b, 0xac8c, 0xac90, 0xac94, 0xac9c, 0xac9d, 0xac9f, 0xaca0, 0xaca1, 0xaca8, 0xaca9, 0xacaa, 0xacac, 0xacaf, 0xacb0, 0xacb8, 0xacb9, 0xacbb, 0xacbc, 0xacbd, 0xacc1, 0xacc4, 0xacc8, 0xaccc, 0xacd5, 0xacd7, 0xace0, 0xace1, 0xace4, 0xace7, 0xace8, 0xacea, 0xacec, 0xacef, 0xacf0, 0xacf1, 0xacf3, 0xacf5, 0xacf6, 0xacfc, 0xacfd, 0xad00, 0xad04, 0xad06, /* 0x31 */ 0xad0c, 0xad0d, 0xad0f, 0xad11, 0xad18, 0xad1c, 0xad20, 0xad29, 0xad2c, 0xad2d, 0xad34, 0xad35, 0xad38, 0xad3c, 0xad44, 0xad45, 0xad47, 0xad49, 0xad50, 0xad54, 0xad58, 0xad61, 0xad63, 0xad6c, 0xad6d, 0xad70, 0xad73, 0xad74, 0xad75, 0xad76, 0xad7b, 0xad7c, 0xad7d, 0xad7f, 0xad81, 0xad82, 0xad88, 0xad89, 0xad8c, 0xad90, 0xad9c, 0xad9d, 0xada4, 0xadb7, 0xadc0, 0xadc1, 0xadc4, 0xadc8, 0xadd0, 0xadd1, 0xadd3, 0xaddc, 0xade0, 0xade4, 0xadf8, 0xadf9, 0xadfc, 0xadff, 0xae00, 0xae01, 0xae08, 0xae09, 0xae0b, 0xae0d, 0xae14, 0xae30, 0xae31, 0xae34, 0xae37, 0xae38, 0xae3a, 0xae40, 0xae41, 0xae43, 0xae45, 0xae46, 0xae4a, 0xae4c, 0xae4d, 0xae4e, 0xae50, 0xae54, 0xae56, 0xae5c, 0xae5d, 0xae5f, 0xae60, 0xae61, 0xae65, 0xae68, 0xae69, 0xae6c, 0xae70, 0xae78, /* 0x32 */ 0xae79, 0xae7b, 0xae7c, 0xae7d, 0xae84, 0xae85, 0xae8c, 0xaebc, 0xaebd, 0xaebe, 0xaec0, 0xaec4, 0xaecc, 0xaecd, 0xaecf, 0xaed0, 0xaed1, 0xaed8, 0xaed9, 0xaedc, 0xaee8, 0xaeeb, 0xaeed, 0xaef4, 0xaef8, 0xaefc, 0xaf07, 0xaf08, 0xaf0d, 0xaf10, 0xaf2c, 0xaf2d, 0xaf30, 0xaf32, 0xaf34, 0xaf3c, 0xaf3d, 0xaf3f, 0xaf41, 0xaf42, 0xaf43, 0xaf48, 0xaf49, 0xaf50, 0xaf5c, 0xaf5d, 0xaf64, 0xaf65, 0xaf79, 0xaf80, 0xaf84, 0xaf88, 0xaf90, 0xaf91, 0xaf95, 0xaf9c, 0xafb8, 0xafb9, 0xafbc, 0xafc0, 0xafc7, 0xafc8, 0xafc9, 0xafcb, 0xafcd, 0xafce, 0xafd4, 0xafdc, 0xafe8, 0xafe9, 0xaff0, 0xaff1, 0xaff4, 0xaff8, 0xb000, 0xb001, 0xb004, 0xb00c, 0xb010, 0xb014, 0xb01c, 0xb01d, 0xb028, 0xb044, 0xb045, 0xb048, 0xb04a, 0xb04c, 0xb04e, 0xb053, 0xb054, 0xb055, 0xb057, 0xb059, /* 0x33 */ 0xb05d, 0xb07c, 0xb07d, 0xb080, 0xb084, 0xb08c, 0xb08d, 0xb08f, 0xb091, 0xb098, 0xb099, 0xb09a, 0xb09c, 0xb09f, 0xb0a0, 0xb0a1, 0xb0a2, 0xb0a8, 0xb0a9, 0xb0ab, 0xb0ac, 0xb0ad, 0xb0ae, 0xb0af, 0xb0b1, 0xb0b3, 0xb0b4, 0xb0b5, 0xb0b8, 0xb0bc, 0xb0c4, 0xb0c5, 0xb0c7, 0xb0c8, 0xb0c9, 0xb0d0, 0xb0d1, 0xb0d4, 0xb0d8, 0xb0e0, 0xb0e5, 0xb108, 0xb109, 0xb10b, 0xb10c, 0xb110, 0xb112, 0xb113, 0xb118, 0xb119, 0xb11b, 0xb11c, 0xb11d, 0xb123, 0xb124, 0xb125, 0xb128, 0xb12c, 0xb134, 0xb135, 0xb137, 0xb138, 0xb139, 0xb140, 0xb141, 0xb144, 0xb148, 0xb150, 0xb151, 0xb154, 0xb155, 0xb158, 0xb15c, 0xb160, 0xb178, 0xb179, 0xb17c, 0xb180, 0xb182, 0xb188, 0xb189, 0xb18b, 0xb18d, 0xb192, 0xb193, 0xb194, 0xb198, 0xb19c, 0xb1a8, 0xb1cc, 0xb1d0, 0xb1d4, 0xb1dc, 0xb1dd, /* 0x34 */ 0xb1df, 0xb1e8, 0xb1e9, 0xb1ec, 0xb1f0, 0xb1f9, 0xb1fb, 0xb1fd, 0xb204, 0xb205, 0xb208, 0xb20b, 0xb20c, 0xb214, 0xb215, 0xb217, 0xb219, 0xb220, 0xb234, 0xb23c, 0xb258, 0xb25c, 0xb260, 0xb268, 0xb269, 0xb274, 0xb275, 0xb27c, 0xb284, 0xb285, 0xb289, 0xb290, 0xb291, 0xb294, 0xb298, 0xb299, 0xb29a, 0xb2a0, 0xb2a1, 0xb2a3, 0xb2a5, 0xb2a6, 0xb2aa, 0xb2ac, 0xb2b0, 0xb2b4, 0xb2c8, 0xb2c9, 0xb2cc, 0xb2d0, 0xb2d2, 0xb2d8, 0xb2d9, 0xb2db, 0xb2dd, 0xb2e2, 0xb2e4, 0xb2e5, 0xb2e6, 0xb2e8, 0xb2eb, 0xb2ec, 0xb2ed, 0xb2ee, 0xb2ef, 0xb2f3, 0xb2f4, 0xb2f5, 0xb2f7, 0xb2f8, 0xb2f9, 0xb2fa, 0xb2fb, 0xb2ff, 0xb300, 0xb301, 0xb304, 0xb308, 0xb310, 0xb311, 0xb313, 0xb314, 0xb315, 0xb31c, 0xb354, 0xb355, 0xb356, 0xb358, 0xb35b, 0xb35c, 0xb35e, 0xb35f, 0xb364, 0xb365, /* 0x35 */ 0xb367, 0xb369, 0xb36b, 0xb36e, 0xb370, 0xb371, 0xb374, 0xb378, 0xb380, 0xb381, 0xb383, 0xb384, 0xb385, 0xb38c, 0xb390, 0xb394, 0xb3a0, 0xb3a1, 0xb3a8, 0xb3ac, 0xb3c4, 0xb3c5, 0xb3c8, 0xb3cb, 0xb3cc, 0xb3ce, 0xb3d0, 0xb3d4, 0xb3d5, 0xb3d7, 0xb3d9, 0xb3db, 0xb3dd, 0xb3e0, 0xb3e4, 0xb3e8, 0xb3fc, 0xb410, 0xb418, 0xb41c, 0xb420, 0xb428, 0xb429, 0xb42b, 0xb434, 0xb450, 0xb451, 0xb454, 0xb458, 0xb460, 0xb461, 0xb463, 0xb465, 0xb46c, 0xb480, 0xb488, 0xb49d, 0xb4a4, 0xb4a8, 0xb4ac, 0xb4b5, 0xb4b7, 0xb4b9, 0xb4c0, 0xb4c4, 0xb4c8, 0xb4d0, 0xb4d5, 0xb4dc, 0xb4dd, 0xb4e0, 0xb4e3, 0xb4e4, 0xb4e6, 0xb4ec, 0xb4ed, 0xb4ef, 0xb4f1, 0xb4f8, 0xb514, 0xb515, 0xb518, 0xb51b, 0xb51c, 0xb524, 0xb525, 0xb527, 0xb528, 0xb529, 0xb52a, 0xb530, 0xb531, 0xb534, 0xb538, /* 0x36 */ 0xb540, 0xb541, 0xb543, 0xb544, 0xb545, 0xb54b, 0xb54c, 0xb54d, 0xb550, 0xb554, 0xb55c, 0xb55d, 0xb55f, 0xb560, 0xb561, 0xb5a0, 0xb5a1, 0xb5a4, 0xb5a8, 0xb5aa, 0xb5ab, 0xb5b0, 0xb5b1, 0xb5b3, 0xb5b4, 0xb5b5, 0xb5bb, 0xb5bc, 0xb5bd, 0xb5c0, 0xb5c4, 0xb5cc, 0xb5cd, 0xb5cf, 0xb5d0, 0xb5d1, 0xb5d8, 0xb5ec, 0xb610, 0xb611, 0xb614, 0xb618, 0xb625, 0xb62c, 0xb634, 0xb648, 0xb664, 0xb668, 0xb69c, 0xb69d, 0xb6a0, 0xb6a4, 0xb6ab, 0xb6ac, 0xb6b1, 0xb6d4, 0xb6f0, 0xb6f4, 0xb6f8, 0xb700, 0xb701, 0xb705, 0xb728, 0xb729, 0xb72c, 0xb72f, 0xb730, 0xb738, 0xb739, 0xb73b, 0xb744, 0xb748, 0xb74c, 0xb754, 0xb755, 0xb760, 0xb764, 0xb768, 0xb770, 0xb771, 0xb773, 0xb775, 0xb77c, 0xb77d, 0xb780, 0xb784, 0xb78c, 0xb78d, 0xb78f, 0xb790, 0xb791, 0xb792, 0xb796, 0xb797, /* 0x37 */ 0xb798, 0xb799, 0xb79c, 0xb7a0, 0xb7a8, 0xb7a9, 0xb7ab, 0xb7ac, 0xb7ad, 0xb7b4, 0xb7b5, 0xb7b8, 0xb7c7, 0xb7c9, 0xb7ec, 0xb7ed, 0xb7f0, 0xb7f4, 0xb7fc, 0xb7fd, 0xb7ff, 0xb800, 0xb801, 0xb807, 0xb808, 0xb809, 0xb80c, 0xb810, 0xb818, 0xb819, 0xb81b, 0xb81d, 0xb824, 0xb825, 0xb828, 0xb82c, 0xb834, 0xb835, 0xb837, 0xb838, 0xb839, 0xb840, 0xb844, 0xb851, 0xb853, 0xb85c, 0xb85d, 0xb860, 0xb864, 0xb86c, 0xb86d, 0xb86f, 0xb871, 0xb878, 0xb87c, 0xb88d, 0xb8a8, 0xb8b0, 0xb8b4, 0xb8b8, 0xb8c0, 0xb8c1, 0xb8c3, 0xb8c5, 0xb8cc, 0xb8d0, 0xb8d4, 0xb8dd, 0xb8df, 0xb8e1, 0xb8e8, 0xb8e9, 0xb8ec, 0xb8f0, 0xb8f8, 0xb8f9, 0xb8fb, 0xb8fd, 0xb904, 0xb918, 0xb920, 0xb93c, 0xb93d, 0xb940, 0xb944, 0xb94c, 0xb94f, 0xb951, 0xb958, 0xb959, 0xb95c, 0xb960, 0xb968, 0xb969, /* 0x38 */ 0xb96b, 0xb96d, 0xb974, 0xb975, 0xb978, 0xb97c, 0xb984, 0xb985, 0xb987, 0xb989, 0xb98a, 0xb98d, 0xb98e, 0xb9ac, 0xb9ad, 0xb9b0, 0xb9b4, 0xb9bc, 0xb9bd, 0xb9bf, 0xb9c1, 0xb9c8, 0xb9c9, 0xb9cc, 0xb9ce, 0xb9cf, 0xb9d0, 0xb9d1, 0xb9d2, 0xb9d8, 0xb9d9, 0xb9db, 0xb9dd, 0xb9de, 0xb9e1, 0xb9e3, 0xb9e4, 0xb9e5, 0xb9e8, 0xb9ec, 0xb9f4, 0xb9f5, 0xb9f7, 0xb9f8, 0xb9f9, 0xb9fa, 0xba00, 0xba01, 0xba08, 0xba15, 0xba38, 0xba39, 0xba3c, 0xba40, 0xba42, 0xba48, 0xba49, 0xba4b, 0xba4d, 0xba4e, 0xba53, 0xba54, 0xba55, 0xba58, 0xba5c, 0xba64, 0xba65, 0xba67, 0xba68, 0xba69, 0xba70, 0xba71, 0xba74, 0xba78, 0xba83, 0xba84, 0xba85, 0xba87, 0xba8c, 0xbaa8, 0xbaa9, 0xbaab, 0xbaac, 0xbab0, 0xbab2, 0xbab8, 0xbab9, 0xbabb, 0xbabd, 0xbac4, 0xbac8, 0xbad8, 0xbad9, 0xbafc, /* 0x39 */ 0xbb00, 0xbb04, 0xbb0d, 0xbb0f, 0xbb11, 0xbb18, 0xbb1c, 0xbb20, 0xbb29, 0xbb2b, 0xbb34, 0xbb35, 0xbb36, 0xbb38, 0xbb3b, 0xbb3c, 0xbb3d, 0xbb3e, 0xbb44, 0xbb45, 0xbb47, 0xbb49, 0xbb4d, 0xbb4f, 0xbb50, 0xbb54, 0xbb58, 0xbb61, 0xbb63, 0xbb6c, 0xbb88, 0xbb8c, 0xbb90, 0xbba4, 0xbba8, 0xbbac, 0xbbb4, 0xbbb7, 0xbbc0, 0xbbc4, 0xbbc8, 0xbbd0, 0xbbd3, 0xbbf8, 0xbbf9, 0xbbfc, 0xbbff, 0xbc00, 0xbc02, 0xbc08, 0xbc09, 0xbc0b, 0xbc0c, 0xbc0d, 0xbc0f, 0xbc11, 0xbc14, 0xbc15, 0xbc16, 0xbc17, 0xbc18, 0xbc1b, 0xbc1c, 0xbc1d, 0xbc1e, 0xbc1f, 0xbc24, 0xbc25, 0xbc27, 0xbc29, 0xbc2d, 0xbc30, 0xbc31, 0xbc34, 0xbc38, 0xbc40, 0xbc41, 0xbc43, 0xbc44, 0xbc45, 0xbc49, 0xbc4c, 0xbc4d, 0xbc50, 0xbc5d, 0xbc84, 0xbc85, 0xbc88, 0xbc8b, 0xbc8c, 0xbc8e, 0xbc94, 0xbc95, 0xbc97, /* 0x3a */ 0xbc99, 0xbc9a, 0xbca0, 0xbca1, 0xbca4, 0xbca7, 0xbca8, 0xbcb0, 0xbcb1, 0xbcb3, 0xbcb4, 0xbcb5, 0xbcbc, 0xbcbd, 0xbcc0, 0xbcc4, 0xbccd, 0xbccf, 0xbcd0, 0xbcd1, 0xbcd5, 0xbcd8, 0xbcdc, 0xbcf4, 0xbcf5, 0xbcf6, 0xbcf8, 0xbcfc, 0xbd04, 0xbd05, 0xbd07, 0xbd09, 0xbd10, 0xbd14, 0xbd24, 0xbd2c, 0xbd40, 0xbd48, 0xbd49, 0xbd4c, 0xbd50, 0xbd58, 0xbd59, 0xbd64, 0xbd68, 0xbd80, 0xbd81, 0xbd84, 0xbd87, 0xbd88, 0xbd89, 0xbd8a, 0xbd90, 0xbd91, 0xbd93, 0xbd95, 0xbd99, 0xbd9a, 0xbd9c, 0xbda4, 0xbdb0, 0xbdb8, 0xbdd4, 0xbdd5, 0xbdd8, 0xbddc, 0xbde9, 0xbdf0, 0xbdf4, 0xbdf8, 0xbe00, 0xbe03, 0xbe05, 0xbe0c, 0xbe0d, 0xbe10, 0xbe14, 0xbe1c, 0xbe1d, 0xbe1f, 0xbe44, 0xbe45, 0xbe48, 0xbe4c, 0xbe4e, 0xbe54, 0xbe55, 0xbe57, 0xbe59, 0xbe5a, 0xbe5b, 0xbe60, 0xbe61, 0xbe64, /* 0x3b */ 0xbe68, 0xbe6a, 0xbe70, 0xbe71, 0xbe73, 0xbe74, 0xbe75, 0xbe7b, 0xbe7c, 0xbe7d, 0xbe80, 0xbe84, 0xbe8c, 0xbe8d, 0xbe8f, 0xbe90, 0xbe91, 0xbe98, 0xbe99, 0xbea8, 0xbed0, 0xbed1, 0xbed4, 0xbed7, 0xbed8, 0xbee0, 0xbee3, 0xbee4, 0xbee5, 0xbeec, 0xbf01, 0xbf08, 0xbf09, 0xbf18, 0xbf19, 0xbf1b, 0xbf1c, 0xbf1d, 0xbf40, 0xbf41, 0xbf44, 0xbf48, 0xbf50, 0xbf51, 0xbf55, 0xbf94, 0xbfb0, 0xbfc5, 0xbfcc, 0xbfcd, 0xbfd0, 0xbfd4, 0xbfdc, 0xbfdf, 0xbfe1, 0xc03c, 0xc051, 0xc058, 0xc05c, 0xc060, 0xc068, 0xc069, 0xc090, 0xc091, 0xc094, 0xc098, 0xc0a0, 0xc0a1, 0xc0a3, 0xc0a5, 0xc0ac, 0xc0ad, 0xc0af, 0xc0b0, 0xc0b3, 0xc0b4, 0xc0b5, 0xc0b6, 0xc0bc, 0xc0bd, 0xc0bf, 0xc0c0, 0xc0c1, 0xc0c5, 0xc0c8, 0xc0c9, 0xc0cc, 0xc0d0, 0xc0d8, 0xc0d9, 0xc0db, 0xc0dc, 0xc0dd, 0xc0e4, /* 0x3c */ 0xc0e5, 0xc0e8, 0xc0ec, 0xc0f4, 0xc0f5, 0xc0f7, 0xc0f9, 0xc100, 0xc104, 0xc108, 0xc110, 0xc115, 0xc11c, 0xc11d, 0xc11e, 0xc11f, 0xc120, 0xc123, 0xc124, 0xc126, 0xc127, 0xc12c, 0xc12d, 0xc12f, 0xc130, 0xc131, 0xc136, 0xc138, 0xc139, 0xc13c, 0xc140, 0xc148, 0xc149, 0xc14b, 0xc14c, 0xc14d, 0xc154, 0xc155, 0xc158, 0xc15c, 0xc164, 0xc165, 0xc167, 0xc168, 0xc169, 0xc170, 0xc174, 0xc178, 0xc185, 0xc18c, 0xc18d, 0xc18e, 0xc190, 0xc194, 0xc196, 0xc19c, 0xc19d, 0xc19f, 0xc1a1, 0xc1a5, 0xc1a8, 0xc1a9, 0xc1ac, 0xc1b0, 0xc1bd, 0xc1c4, 0xc1c8, 0xc1cc, 0xc1d4, 0xc1d7, 0xc1d8, 0xc1e0, 0xc1e4, 0xc1e8, 0xc1f0, 0xc1f1, 0xc1f3, 0xc1fc, 0xc1fd, 0xc200, 0xc204, 0xc20c, 0xc20d, 0xc20f, 0xc211, 0xc218, 0xc219, 0xc21c, 0xc21f, 0xc220, 0xc228, 0xc229, 0xc22b, 0xc22d, /* 0x3d */ 0xc22f, 0xc231, 0xc232, 0xc234, 0xc248, 0xc250, 0xc251, 0xc254, 0xc258, 0xc260, 0xc265, 0xc26c, 0xc26d, 0xc270, 0xc274, 0xc27c, 0xc27d, 0xc27f, 0xc281, 0xc288, 0xc289, 0xc290, 0xc298, 0xc29b, 0xc29d, 0xc2a4, 0xc2a5, 0xc2a8, 0xc2ac, 0xc2ad, 0xc2b4, 0xc2b5, 0xc2b7, 0xc2b9, 0xc2dc, 0xc2dd, 0xc2e0, 0xc2e3, 0xc2e4, 0xc2eb, 0xc2ec, 0xc2ed, 0xc2ef, 0xc2f1, 0xc2f6, 0xc2f8, 0xc2f9, 0xc2fb, 0xc2fc, 0xc300, 0xc308, 0xc309, 0xc30c, 0xc30d, 0xc313, 0xc314, 0xc315, 0xc318, 0xc31c, 0xc324, 0xc325, 0xc328, 0xc329, 0xc345, 0xc368, 0xc369, 0xc36c, 0xc370, 0xc372, 0xc378, 0xc379, 0xc37c, 0xc37d, 0xc384, 0xc388, 0xc38c, 0xc3c0, 0xc3d8, 0xc3d9, 0xc3dc, 0xc3df, 0xc3e0, 0xc3e2, 0xc3e8, 0xc3e9, 0xc3ed, 0xc3f4, 0xc3f5, 0xc3f8, 0xc408, 0xc410, 0xc424, 0xc42c, 0xc430, /* 0x3e */ 0xc434, 0xc43c, 0xc43d, 0xc448, 0xc464, 0xc465, 0xc468, 0xc46c, 0xc474, 0xc475, 0xc479, 0xc480, 0xc494, 0xc49c, 0xc4b8, 0xc4bc, 0xc4e9, 0xc4f0, 0xc4f1, 0xc4f4, 0xc4f8, 0xc4fa, 0xc4ff, 0xc500, 0xc501, 0xc50c, 0xc510, 0xc514, 0xc51c, 0xc528, 0xc529, 0xc52c, 0xc530, 0xc538, 0xc539, 0xc53b, 0xc53d, 0xc544, 0xc545, 0xc548, 0xc549, 0xc54a, 0xc54c, 0xc54d, 0xc54e, 0xc553, 0xc554, 0xc555, 0xc557, 0xc558, 0xc559, 0xc55d, 0xc55e, 0xc560, 0xc561, 0xc564, 0xc568, 0xc570, 0xc571, 0xc573, 0xc574, 0xc575, 0xc57c, 0xc57d, 0xc580, 0xc584, 0xc587, 0xc58c, 0xc58d, 0xc58f, 0xc591, 0xc595, 0xc597, 0xc598, 0xc59c, 0xc5a0, 0xc5a9, 0xc5b4, 0xc5b5, 0xc5b8, 0xc5b9, 0xc5bb, 0xc5bc, 0xc5bd, 0xc5be, 0xc5c4, 0xc5c5, 0xc5c6, 0xc5c7, 0xc5c8, 0xc5c9, 0xc5ca, 0xc5cc, 0xc5ce, /* 0x3f */ 0xc5d0, 0xc5d1, 0xc5d4, 0xc5d8, 0xc5e0, 0xc5e1, 0xc5e3, 0xc5e5, 0xc5ec, 0xc5ed, 0xc5ee, 0xc5f0, 0xc5f4, 0xc5f6, 0xc5f7, 0xc5fc, 0xc5fd, 0xc5fe, 0xc5ff, 0xc600, 0xc601, 0xc605, 0xc606, 0xc607, 0xc608, 0xc60c, 0xc610, 0xc618, 0xc619, 0xc61b, 0xc61c, 0xc624, 0xc625, 0xc628, 0xc62c, 0xc62d, 0xc62e, 0xc630, 0xc633, 0xc634, 0xc635, 0xc637, 0xc639, 0xc63b, 0xc640, 0xc641, 0xc644, 0xc648, 0xc650, 0xc651, 0xc653, 0xc654, 0xc655, 0xc65c, 0xc65d, 0xc660, 0xc66c, 0xc66f, 0xc671, 0xc678, 0xc679, 0xc67c, 0xc680, 0xc688, 0xc689, 0xc68b, 0xc68d, 0xc694, 0xc695, 0xc698, 0xc69c, 0xc6a4, 0xc6a5, 0xc6a7, 0xc6a9, 0xc6b0, 0xc6b1, 0xc6b4, 0xc6b8, 0xc6b9, 0xc6ba, 0xc6c0, 0xc6c1, 0xc6c3, 0xc6c5, 0xc6cc, 0xc6cd, 0xc6d0, 0xc6d4, 0xc6dc, 0xc6dd, 0xc6e0, 0xc6e1, 0xc6e8, /* 0x40 */ 0xc6e9, 0xc6ec, 0xc6f0, 0xc6f8, 0xc6f9, 0xc6fd, 0xc704, 0xc705, 0xc708, 0xc70c, 0xc714, 0xc715, 0xc717, 0xc719, 0xc720, 0xc721, 0xc724, 0xc728, 0xc730, 0xc731, 0xc733, 0xc735, 0xc737, 0xc73c, 0xc73d, 0xc740, 0xc744, 0xc74a, 0xc74c, 0xc74d, 0xc74f, 0xc751, 0xc752, 0xc753, 0xc754, 0xc755, 0xc756, 0xc757, 0xc758, 0xc75c, 0xc760, 0xc768, 0xc76b, 0xc774, 0xc775, 0xc778, 0xc77c, 0xc77d, 0xc77e, 0xc783, 0xc784, 0xc785, 0xc787, 0xc788, 0xc789, 0xc78a, 0xc78e, 0xc790, 0xc791, 0xc794, 0xc796, 0xc797, 0xc798, 0xc79a, 0xc7a0, 0xc7a1, 0xc7a3, 0xc7a4, 0xc7a5, 0xc7a6, 0xc7ac, 0xc7ad, 0xc7b0, 0xc7b4, 0xc7bc, 0xc7bd, 0xc7bf, 0xc7c0, 0xc7c1, 0xc7c8, 0xc7c9, 0xc7cc, 0xc7ce, 0xc7d0, 0xc7d8, 0xc7dd, 0xc7e4, 0xc7e8, 0xc7ec, 0xc800, 0xc801, 0xc804, 0xc808, 0xc80a, /* 0x41 */ 0xc810, 0xc811, 0xc813, 0xc815, 0xc816, 0xc81c, 0xc81d, 0xc820, 0xc824, 0xc82c, 0xc82d, 0xc82f, 0xc831, 0xc838, 0xc83c, 0xc840, 0xc848, 0xc849, 0xc84c, 0xc84d, 0xc854, 0xc870, 0xc871, 0xc874, 0xc878, 0xc87a, 0xc880, 0xc881, 0xc883, 0xc885, 0xc886, 0xc887, 0xc88b, 0xc88c, 0xc88d, 0xc894, 0xc89d, 0xc89f, 0xc8a1, 0xc8a8, 0xc8bc, 0xc8bd, 0xc8c4, 0xc8c8, 0xc8cc, 0xc8d4, 0xc8d5, 0xc8d7, 0xc8d9, 0xc8e0, 0xc8e1, 0xc8e4, 0xc8f5, 0xc8fc, 0xc8fd, 0xc900, 0xc904, 0xc905, 0xc906, 0xc90c, 0xc90d, 0xc90f, 0xc911, 0xc918, 0xc92c, 0xc934, 0xc950, 0xc951, 0xc954, 0xc958, 0xc960, 0xc961, 0xc963, 0xc96c, 0xc970, 0xc974, 0xc97c, 0xc988, 0xc989, 0xc98c, 0xc990, 0xc998, 0xc999, 0xc99b, 0xc99d, 0xc9c0, 0xc9c1, 0xc9c4, 0xc9c7, 0xc9c8, 0xc9ca, 0xc9d0, 0xc9d1, 0xc9d3, /* 0x42 */ 0xc9d5, 0xc9d6, 0xc9d9, 0xc9da, 0xc9dc, 0xc9dd, 0xc9e0, 0xc9e2, 0xc9e4, 0xc9e7, 0xc9ec, 0xc9ed, 0xc9ef, 0xc9f0, 0xc9f1, 0xc9f8, 0xc9f9, 0xc9fc, 0xca00, 0xca08, 0xca09, 0xca0b, 0xca0c, 0xca0d, 0xca14, 0xca18, 0xca29, 0xca4c, 0xca4d, 0xca50, 0xca54, 0xca5c, 0xca5d, 0xca5f, 0xca60, 0xca61, 0xca68, 0xca7d, 0xca84, 0xca98, 0xcabc, 0xcabd, 0xcac0, 0xcac4, 0xcacc, 0xcacd, 0xcacf, 0xcad1, 0xcad3, 0xcad8, 0xcad9, 0xcae0, 0xcaec, 0xcaf4, 0xcb08, 0xcb10, 0xcb14, 0xcb18, 0xcb20, 0xcb21, 0xcb41, 0xcb48, 0xcb49, 0xcb4c, 0xcb50, 0xcb58, 0xcb59, 0xcb5d, 0xcb64, 0xcb78, 0xcb79, 0xcb9c, 0xcbb8, 0xcbd4, 0xcbe4, 0xcbe7, 0xcbe9, 0xcc0c, 0xcc0d, 0xcc10, 0xcc14, 0xcc1c, 0xcc1d, 0xcc21, 0xcc22, 0xcc27, 0xcc28, 0xcc29, 0xcc2c, 0xcc2e, 0xcc30, 0xcc38, 0xcc39, 0xcc3b, /* 0x43 */ 0xcc3c, 0xcc3d, 0xcc3e, 0xcc44, 0xcc45, 0xcc48, 0xcc4c, 0xcc54, 0xcc55, 0xcc57, 0xcc58, 0xcc59, 0xcc60, 0xcc64, 0xcc66, 0xcc68, 0xcc70, 0xcc75, 0xcc98, 0xcc99, 0xcc9c, 0xcca0, 0xcca8, 0xcca9, 0xccab, 0xccac, 0xccad, 0xccb4, 0xccb5, 0xccb8, 0xccbc, 0xccc4, 0xccc5, 0xccc7, 0xccc9, 0xccd0, 0xccd4, 0xcce4, 0xccec, 0xccf0, 0xcd01, 0xcd08, 0xcd09, 0xcd0c, 0xcd10, 0xcd18, 0xcd19, 0xcd1b, 0xcd1d, 0xcd24, 0xcd28, 0xcd2c, 0xcd39, 0xcd5c, 0xcd60, 0xcd64, 0xcd6c, 0xcd6d, 0xcd6f, 0xcd71, 0xcd78, 0xcd88, 0xcd94, 0xcd95, 0xcd98, 0xcd9c, 0xcda4, 0xcda5, 0xcda7, 0xcda9, 0xcdb0, 0xcdc4, 0xcdcc, 0xcdd0, 0xcde8, 0xcdec, 0xcdf0, 0xcdf8, 0xcdf9, 0xcdfb, 0xcdfd, 0xce04, 0xce08, 0xce0c, 0xce14, 0xce19, 0xce20, 0xce21, 0xce24, 0xce28, 0xce30, 0xce31, 0xce33, 0xce35, /* 0x44 */ 0xce58, 0xce59, 0xce5c, 0xce5f, 0xce60, 0xce61, 0xce68, 0xce69, 0xce6b, 0xce6d, 0xce74, 0xce75, 0xce78, 0xce7c, 0xce84, 0xce85, 0xce87, 0xce89, 0xce90, 0xce91, 0xce94, 0xce98, 0xcea0, 0xcea1, 0xcea3, 0xcea4, 0xcea5, 0xceac, 0xcead, 0xcec1, 0xcee4, 0xcee5, 0xcee8, 0xceeb, 0xceec, 0xcef4, 0xcef5, 0xcef7, 0xcef8, 0xcef9, 0xcf00, 0xcf01, 0xcf04, 0xcf08, 0xcf10, 0xcf11, 0xcf13, 0xcf15, 0xcf1c, 0xcf20, 0xcf24, 0xcf2c, 0xcf2d, 0xcf2f, 0xcf30, 0xcf31, 0xcf38, 0xcf54, 0xcf55, 0xcf58, 0xcf5c, 0xcf64, 0xcf65, 0xcf67, 0xcf69, 0xcf70, 0xcf71, 0xcf74, 0xcf78, 0xcf80, 0xcf85, 0xcf8c, 0xcfa1, 0xcfa8, 0xcfb0, 0xcfc4, 0xcfe0, 0xcfe1, 0xcfe4, 0xcfe8, 0xcff0, 0xcff1, 0xcff3, 0xcff5, 0xcffc, 0xd000, 0xd004, 0xd011, 0xd018, 0xd02d, 0xd034, 0xd035, 0xd038, 0xd03c, /* 0x45 */ 0xd044, 0xd045, 0xd047, 0xd049, 0xd050, 0xd054, 0xd058, 0xd060, 0xd06c, 0xd06d, 0xd070, 0xd074, 0xd07c, 0xd07d, 0xd081, 0xd0a4, 0xd0a5, 0xd0a8, 0xd0ac, 0xd0b4, 0xd0b5, 0xd0b7, 0xd0b9, 0xd0c0, 0xd0c1, 0xd0c4, 0xd0c8, 0xd0c9, 0xd0d0, 0xd0d1, 0xd0d3, 0xd0d4, 0xd0d5, 0xd0dc, 0xd0dd, 0xd0e0, 0xd0e4, 0xd0ec, 0xd0ed, 0xd0ef, 0xd0f0, 0xd0f1, 0xd0f8, 0xd10d, 0xd130, 0xd131, 0xd134, 0xd138, 0xd13a, 0xd140, 0xd141, 0xd143, 0xd144, 0xd145, 0xd14c, 0xd14d, 0xd150, 0xd154, 0xd15c, 0xd15d, 0xd15f, 0xd161, 0xd168, 0xd16c, 0xd17c, 0xd184, 0xd188, 0xd1a0, 0xd1a1, 0xd1a4, 0xd1a8, 0xd1b0, 0xd1b1, 0xd1b3, 0xd1b5, 0xd1ba, 0xd1bc, 0xd1c0, 0xd1d8, 0xd1f4, 0xd1f8, 0xd207, 0xd209, 0xd210, 0xd22c, 0xd22d, 0xd230, 0xd234, 0xd23c, 0xd23d, 0xd23f, 0xd241, 0xd248, 0xd25c, /* 0x46 */ 0xd264, 0xd280, 0xd281, 0xd284, 0xd288, 0xd290, 0xd291, 0xd295, 0xd29c, 0xd2a0, 0xd2a4, 0xd2ac, 0xd2b1, 0xd2b8, 0xd2b9, 0xd2bc, 0xd2bf, 0xd2c0, 0xd2c2, 0xd2c8, 0xd2c9, 0xd2cb, 0xd2d4, 0xd2d8, 0xd2dc, 0xd2e4, 0xd2e5, 0xd2f0, 0xd2f1, 0xd2f4, 0xd2f8, 0xd300, 0xd301, 0xd303, 0xd305, 0xd30c, 0xd30d, 0xd30e, 0xd310, 0xd314, 0xd316, 0xd31c, 0xd31d, 0xd31f, 0xd320, 0xd321, 0xd325, 0xd328, 0xd329, 0xd32c, 0xd330, 0xd338, 0xd339, 0xd33b, 0xd33c, 0xd33d, 0xd344, 0xd345, 0xd37c, 0xd37d, 0xd380, 0xd384, 0xd38c, 0xd38d, 0xd38f, 0xd390, 0xd391, 0xd398, 0xd399, 0xd39c, 0xd3a0, 0xd3a8, 0xd3a9, 0xd3ab, 0xd3ad, 0xd3b4, 0xd3b8, 0xd3bc, 0xd3c4, 0xd3c5, 0xd3c8, 0xd3c9, 0xd3d0, 0xd3d8, 0xd3e1, 0xd3e3, 0xd3ec, 0xd3ed, 0xd3f0, 0xd3f4, 0xd3fc, 0xd3fd, 0xd3ff, 0xd401, /* 0x47 */ 0xd408, 0xd41d, 0xd440, 0xd444, 0xd45c, 0xd460, 0xd464, 0xd46d, 0xd46f, 0xd478, 0xd479, 0xd47c, 0xd47f, 0xd480, 0xd482, 0xd488, 0xd489, 0xd48b, 0xd48d, 0xd494, 0xd4a9, 0xd4cc, 0xd4d0, 0xd4d4, 0xd4dc, 0xd4df, 0xd4e8, 0xd4ec, 0xd4f0, 0xd4f8, 0xd4fb, 0xd4fd, 0xd504, 0xd508, 0xd50c, 0xd514, 0xd515, 0xd517, 0xd53c, 0xd53d, 0xd540, 0xd544, 0xd54c, 0xd54d, 0xd54f, 0xd551, 0xd558, 0xd559, 0xd55c, 0xd560, 0xd565, 0xd568, 0xd569, 0xd56b, 0xd56d, 0xd574, 0xd575, 0xd578, 0xd57c, 0xd584, 0xd585, 0xd587, 0xd588, 0xd589, 0xd590, 0xd5a5, 0xd5c8, 0xd5c9, 0xd5cc, 0xd5d0, 0xd5d2, 0xd5d8, 0xd5d9, 0xd5db, 0xd5dd, 0xd5e4, 0xd5e5, 0xd5e8, 0xd5ec, 0xd5f4, 0xd5f5, 0xd5f7, 0xd5f9, 0xd600, 0xd601, 0xd604, 0xd608, 0xd610, 0xd611, 0xd613, 0xd614, 0xd615, 0xd61c, 0xd620, /* 0x48 */ 0xd624, 0xd62d, 0xd638, 0xd639, 0xd63c, 0xd640, 0xd645, 0xd648, 0xd649, 0xd64b, 0xd64d, 0xd651, 0xd654, 0xd655, 0xd658, 0xd65c, 0xd667, 0xd669, 0xd670, 0xd671, 0xd674, 0xd683, 0xd685, 0xd68c, 0xd68d, 0xd690, 0xd694, 0xd69d, 0xd69f, 0xd6a1, 0xd6a8, 0xd6ac, 0xd6b0, 0xd6b9, 0xd6bb, 0xd6c4, 0xd6c5, 0xd6c8, 0xd6cc, 0xd6d1, 0xd6d4, 0xd6d7, 0xd6d9, 0xd6e0, 0xd6e4, 0xd6e8, 0xd6f0, 0xd6f5, 0xd6fc, 0xd6fd, 0xd700, 0xd704, 0xd711, 0xd718, 0xd719, 0xd71c, 0xd720, 0xd728, 0xd729, 0xd72b, 0xd72d, 0xd734, 0xd735, 0xd738, 0xd73c, 0xd744, 0xd747, 0xd749, 0xd750, 0xd751, 0xd754, 0xd756, 0xd757, 0xd758, 0xd759, 0xd760, 0xd761, 0xd763, 0xd765, 0xd769, 0xd76c, 0xd770, 0xd774, 0xd77c, 0xd77d, 0xd781, 0xd788, 0xd789, 0xd78c, 0xd790, 0xd798, 0xd799, 0xd79b, 0xd79d, }; static const unsigned short ksc5601_2uni_page4a[4888] = { /* 0x4a */ 0x4f3d, 0x4f73, 0x5047, 0x50f9, 0x52a0, 0x53ef, 0x5475, 0x54e5, 0x5609, 0x5ac1, 0x5bb6, 0x6687, 0x67b6, 0x67b7, 0x67ef, 0x6b4c, 0x73c2, 0x75c2, 0x7a3c, 0x82db, 0x8304, 0x8857, 0x8888, 0x8a36, 0x8cc8, 0x8dcf, 0x8efb, 0x8fe6, 0x99d5, 0x523b, 0x5374, 0x5404, 0x606a, 0x6164, 0x6bbc, 0x73cf, 0x811a, 0x89ba, 0x89d2, 0x95a3, 0x4f83, 0x520a, 0x58be, 0x5978, 0x59e6, 0x5e72, 0x5e79, 0x61c7, 0x63c0, 0x6746, 0x67ec, 0x687f, 0x6f97, 0x764e, 0x770b, 0x78f5, 0x7a08, 0x7aff, 0x7c21, 0x809d, 0x826e, 0x8271, 0x8aeb, 0x9593, 0x4e6b, 0x559d, 0x66f7, 0x6e34, 0x78a3, 0x7aed, 0x845b, 0x8910, 0x874e, 0x97a8, 0x52d8, 0x574e, 0x582a, 0x5d4c, 0x611f, 0x61be, 0x6221, 0x6562, 0x67d1, 0x6a44, 0x6e1b, 0x7518, 0x75b3, 0x76e3, 0x77b0, 0x7d3a, 0x90af, 0x9451, 0x9452, 0x9f95, /* 0x4b */ 0x5323, 0x5cac, 0x7532, 0x80db, 0x9240, 0x9598, 0x525b, 0x5808, 0x59dc, 0x5ca1, 0x5d17, 0x5eb7, 0x5f3a, 0x5f4a, 0x6177, 0x6c5f, 0x757a, 0x7586, 0x7ce0, 0x7d73, 0x7db1, 0x7f8c, 0x8154, 0x8221, 0x8591, 0x8941, 0x8b1b, 0x92fc, 0x964d, 0x9c47, 0x4ecb, 0x4ef7, 0x500b, 0x51f1, 0x584f, 0x6137, 0x613e, 0x6168, 0x6539, 0x69ea, 0x6f11, 0x75a5, 0x7686, 0x76d6, 0x7b87, 0x82a5, 0x84cb, 0xf900, 0x93a7, 0x958b, 0x5580, 0x5ba2, 0x5751, 0xf901, 0x7cb3, 0x7fb9, 0x91b5, 0x5028, 0x53bb, 0x5c45, 0x5de8, 0x62d2, 0x636e, 0x64da, 0x64e7, 0x6e20, 0x70ac, 0x795b, 0x8ddd, 0x8e1e, 0xf902, 0x907d, 0x9245, 0x92f8, 0x4e7e, 0x4ef6, 0x5065, 0x5dfe, 0x5efa, 0x6106, 0x6957, 0x8171, 0x8654, 0x8e47, 0x9375, 0x9a2b, 0x4e5e, 0x5091, 0x6770, 0x6840, 0x5109, 0x528d, 0x5292, 0x6aa2, /* 0x4c */ 0x77bc, 0x9210, 0x9ed4, 0x52ab, 0x602f, 0x8ff2, 0x5048, 0x61a9, 0x63ed, 0x64ca, 0x683c, 0x6a84, 0x6fc0, 0x8188, 0x89a1, 0x9694, 0x5805, 0x727d, 0x72ac, 0x7504, 0x7d79, 0x7e6d, 0x80a9, 0x898b, 0x8b74, 0x9063, 0x9d51, 0x6289, 0x6c7a, 0x6f54, 0x7d50, 0x7f3a, 0x8a23, 0x517c, 0x614a, 0x7b9d, 0x8b19, 0x9257, 0x938c, 0x4eac, 0x4fd3, 0x501e, 0x50be, 0x5106, 0x52c1, 0x52cd, 0x537f, 0x5770, 0x5883, 0x5e9a, 0x5f91, 0x6176, 0x61ac, 0x64ce, 0x656c, 0x666f, 0x66bb, 0x66f4, 0x6897, 0x6d87, 0x7085, 0x70f1, 0x749f, 0x74a5, 0x74ca, 0x75d9, 0x786c, 0x78ec, 0x7adf, 0x7af6, 0x7d45, 0x7d93, 0x8015, 0x803f, 0x811b, 0x8396, 0x8b66, 0x8f15, 0x9015, 0x93e1, 0x9803, 0x9838, 0x9a5a, 0x9be8, 0x4fc2, 0x5553, 0x583a, 0x5951, 0x5b63, 0x5c46, 0x60b8, 0x6212, 0x6842, 0x68b0, /* 0x4d */ 0x68e8, 0x6eaa, 0x754c, 0x7678, 0x78ce, 0x7a3d, 0x7cfb, 0x7e6b, 0x7e7c, 0x8a08, 0x8aa1, 0x8c3f, 0x968e, 0x9dc4, 0x53e4, 0x53e9, 0x544a, 0x5471, 0x56fa, 0x59d1, 0x5b64, 0x5c3b, 0x5eab, 0x62f7, 0x6537, 0x6545, 0x6572, 0x66a0, 0x67af, 0x69c1, 0x6cbd, 0x75fc, 0x7690, 0x777e, 0x7a3f, 0x7f94, 0x8003, 0x80a1, 0x818f, 0x82e6, 0x82fd, 0x83f0, 0x85c1, 0x8831, 0x88b4, 0x8aa5, 0xf903, 0x8f9c, 0x932e, 0x96c7, 0x9867, 0x9ad8, 0x9f13, 0x54ed, 0x659b, 0x66f2, 0x688f, 0x7a40, 0x8c37, 0x9d60, 0x56f0, 0x5764, 0x5d11, 0x6606, 0x68b1, 0x68cd, 0x6efe, 0x7428, 0x889e, 0x9be4, 0x6c68, 0xf904, 0x9aa8, 0x4f9b, 0x516c, 0x5171, 0x529f, 0x5b54, 0x5de5, 0x6050, 0x606d, 0x62f1, 0x63a7, 0x653b, 0x73d9, 0x7a7a, 0x86a3, 0x8ca2, 0x978f, 0x4e32, 0x5be1, 0x6208, 0x679c, 0x74dc, /* 0x4e */ 0x79d1, 0x83d3, 0x8a87, 0x8ab2, 0x8de8, 0x904e, 0x934b, 0x9846, 0x5ed3, 0x69e8, 0x85ff, 0x90ed, 0xf905, 0x51a0, 0x5b98, 0x5bec, 0x6163, 0x68fa, 0x6b3e, 0x704c, 0x742f, 0x74d8, 0x7ba1, 0x7f50, 0x83c5, 0x89c0, 0x8cab, 0x95dc, 0x9928, 0x522e, 0x605d, 0x62ec, 0x9002, 0x4f8a, 0x5149, 0x5321, 0x58d9, 0x5ee3, 0x66e0, 0x6d38, 0x709a, 0x72c2, 0x73d6, 0x7b50, 0x80f1, 0x945b, 0x5366, 0x639b, 0x7f6b, 0x4e56, 0x5080, 0x584a, 0x58de, 0x602a, 0x6127, 0x62d0, 0x69d0, 0x9b41, 0x5b8f, 0x7d18, 0x80b1, 0x8f5f, 0x4ea4, 0x50d1, 0x54ac, 0x55ac, 0x5b0c, 0x5da0, 0x5de7, 0x652a, 0x654e, 0x6821, 0x6a4b, 0x72e1, 0x768e, 0x77ef, 0x7d5e, 0x7ff9, 0x81a0, 0x854e, 0x86df, 0x8f03, 0x8f4e, 0x90ca, 0x9903, 0x9a55, 0x9bab, 0x4e18, 0x4e45, 0x4e5d, 0x4ec7, 0x4ff1, 0x5177, 0x52fe, /* 0x4f */ 0x5340, 0x53e3, 0x53e5, 0x548e, 0x5614, 0x5775, 0x57a2, 0x5bc7, 0x5d87, 0x5ed0, 0x61fc, 0x62d8, 0x6551, 0x67b8, 0x67e9, 0x69cb, 0x6b50, 0x6bc6, 0x6bec, 0x6c42, 0x6e9d, 0x7078, 0x72d7, 0x7396, 0x7403, 0x77bf, 0x77e9, 0x7a76, 0x7d7f, 0x8009, 0x81fc, 0x8205, 0x820a, 0x82df, 0x8862, 0x8b33, 0x8cfc, 0x8ec0, 0x9011, 0x90b1, 0x9264, 0x92b6, 0x99d2, 0x9a45, 0x9ce9, 0x9dd7, 0x9f9c, 0x570b, 0x5c40, 0x83ca, 0x97a0, 0x97ab, 0x9eb4, 0x541b, 0x7a98, 0x7fa4, 0x88d9, 0x8ecd, 0x90e1, 0x5800, 0x5c48, 0x6398, 0x7a9f, 0x5bae, 0x5f13, 0x7a79, 0x7aae, 0x828e, 0x8eac, 0x5026, 0x5238, 0x52f8, 0x5377, 0x5708, 0x62f3, 0x6372, 0x6b0a, 0x6dc3, 0x7737, 0x53a5, 0x7357, 0x8568, 0x8e76, 0x95d5, 0x673a, 0x6ac3, 0x6f70, 0x8a6d, 0x8ecc, 0x994b, 0xf906, 0x6677, 0x6b78, 0x8cb4, /* 0x50 */ 0x9b3c, 0xf907, 0x53eb, 0x572d, 0x594e, 0x63c6, 0x69fb, 0x73ea, 0x7845, 0x7aba, 0x7ac5, 0x7cfe, 0x8475, 0x898f, 0x8d73, 0x9035, 0x95a8, 0x52fb, 0x5747, 0x7547, 0x7b60, 0x83cc, 0x921e, 0xf908, 0x6a58, 0x514b, 0x524b, 0x5287, 0x621f, 0x68d8, 0x6975, 0x9699, 0x50c5, 0x52a4, 0x52e4, 0x61c3, 0x65a4, 0x6839, 0x69ff, 0x747e, 0x7b4b, 0x82b9, 0x83eb, 0x89b2, 0x8b39, 0x8fd1, 0x9949, 0xf909, 0x4eca, 0x5997, 0x64d2, 0x6611, 0x6a8e, 0x7434, 0x7981, 0x79bd, 0x82a9, 0x887e, 0x887f, 0x895f, 0xf90a, 0x9326, 0x4f0b, 0x53ca, 0x6025, 0x6271, 0x6c72, 0x7d1a, 0x7d66, 0x4e98, 0x5162, 0x77dc, 0x80af, 0x4f01, 0x4f0e, 0x5176, 0x5180, 0x55dc, 0x5668, 0x573b, 0x57fa, 0x57fc, 0x5914, 0x5947, 0x5993, 0x5bc4, 0x5c90, 0x5d0e, 0x5df1, 0x5e7e, 0x5fcc, 0x6280, 0x65d7, 0x65e3, /* 0x51 */ 0x671e, 0x671f, 0x675e, 0x68cb, 0x68c4, 0x6a5f, 0x6b3a, 0x6c23, 0x6c7d, 0x6c82, 0x6dc7, 0x7398, 0x7426, 0x742a, 0x7482, 0x74a3, 0x7578, 0x757f, 0x7881, 0x78ef, 0x7941, 0x7947, 0x7948, 0x797a, 0x7b95, 0x7d00, 0x7dba, 0x7f88, 0x8006, 0x802d, 0x808c, 0x8a18, 0x8b4f, 0x8c48, 0x8d77, 0x9321, 0x9324, 0x98e2, 0x9951, 0x9a0e, 0x9a0f, 0x9a65, 0x9e92, 0x7dca, 0x4f76, 0x5409, 0x62ee, 0x6854, 0x91d1, 0x55ab, 0x513a, 0xf90b, 0xf90c, 0x5a1c, 0x61e6, 0xf90d, 0x62cf, 0x62ff, 0xf90e, 0xf90f, 0xf910, 0xf911, 0xf912, 0xf913, 0x90a3, 0xf914, 0xf915, 0xf916, 0xf917, 0xf918, 0x8afe, 0xf919, 0xf91a, 0xf91b, 0xf91c, 0x6696, 0xf91d, 0x7156, 0xf91e, 0xf91f, 0x96e3, 0xf920, 0x634f, 0x637a, 0x5357, 0xf921, 0x678f, 0x6960, 0x6e73, 0xf922, 0x7537, 0xf923, 0xf924, 0xf925, /* 0x52 */ 0x7d0d, 0xf926, 0xf927, 0x8872, 0x56ca, 0x5a18, 0xf928, 0xf929, 0xf92a, 0xf92b, 0xf92c, 0x4e43, 0xf92d, 0x5167, 0x5948, 0x67f0, 0x8010, 0xf92e, 0x5973, 0x5e74, 0x649a, 0x79ca, 0x5ff5, 0x606c, 0x62c8, 0x637b, 0x5be7, 0x5bd7, 0x52aa, 0xf92f, 0x5974, 0x5f29, 0x6012, 0xf930, 0xf931, 0xf932, 0x7459, 0xf933, 0xf934, 0xf935, 0xf936, 0xf937, 0xf938, 0x99d1, 0xf939, 0xf93a, 0xf93b, 0xf93c, 0xf93d, 0xf93e, 0xf93f, 0xf940, 0xf941, 0xf942, 0xf943, 0x6fc3, 0xf944, 0xf945, 0x81bf, 0x8fb2, 0x60f1, 0xf946, 0xf947, 0x8166, 0xf948, 0xf949, 0x5c3f, 0xf94a, 0xf94b, 0xf94c, 0xf94d, 0xf94e, 0xf94f, 0xf950, 0xf951, 0x5ae9, 0x8a25, 0x677b, 0x7d10, 0xf952, 0xf953, 0xf954, 0xf955, 0xf956, 0xf957, 0x80fd, 0xf958, 0xf959, 0x5c3c, 0x6ce5, 0x533f, 0x6eba, 0x591a, 0x8336, /* 0x53 */ 0x4e39, 0x4eb6, 0x4f46, 0x55ae, 0x5718, 0x58c7, 0x5f56, 0x65b7, 0x65e6, 0x6a80, 0x6bb5, 0x6e4d, 0x77ed, 0x7aef, 0x7c1e, 0x7dde, 0x86cb, 0x8892, 0x9132, 0x935b, 0x64bb, 0x6fbe, 0x737a, 0x75b8, 0x9054, 0x5556, 0x574d, 0x61ba, 0x64d4, 0x66c7, 0x6de1, 0x6e5b, 0x6f6d, 0x6fb9, 0x75f0, 0x8043, 0x81bd, 0x8541, 0x8983, 0x8ac7, 0x8b5a, 0x931f, 0x6c93, 0x7553, 0x7b54, 0x8e0f, 0x905d, 0x5510, 0x5802, 0x5858, 0x5e62, 0x6207, 0x649e, 0x68e0, 0x7576, 0x7cd6, 0x87b3, 0x9ee8, 0x4ee3, 0x5788, 0x576e, 0x5927, 0x5c0d, 0x5cb1, 0x5e36, 0x5f85, 0x6234, 0x64e1, 0x73b3, 0x81fa, 0x888b, 0x8cb8, 0x968a, 0x9edb, 0x5b85, 0x5fb7, 0x60b3, 0x5012, 0x5200, 0x5230, 0x5716, 0x5835, 0x5857, 0x5c0e, 0x5c60, 0x5cf6, 0x5d8b, 0x5ea6, 0x5f92, 0x60bc, 0x6311, 0x6389, 0x6417, 0x6843, /* 0x54 */ 0x68f9, 0x6ac2, 0x6dd8, 0x6e21, 0x6ed4, 0x6fe4, 0x71fe, 0x76dc, 0x7779, 0x79b1, 0x7a3b, 0x8404, 0x89a9, 0x8ced, 0x8df3, 0x8e48, 0x9003, 0x9014, 0x9053, 0x90fd, 0x934d, 0x9676, 0x97dc, 0x6bd2, 0x7006, 0x7258, 0x72a2, 0x7368, 0x7763, 0x79bf, 0x7be4, 0x7e9b, 0x8b80, 0x58a9, 0x60c7, 0x6566, 0x65fd, 0x66be, 0x6c8c, 0x711e, 0x71c9, 0x8c5a, 0x9813, 0x4e6d, 0x7a81, 0x4edd, 0x51ac, 0x51cd, 0x52d5, 0x540c, 0x61a7, 0x6771, 0x6850, 0x68df, 0x6d1e, 0x6f7c, 0x75bc, 0x77b3, 0x7ae5, 0x80f4, 0x8463, 0x9285, 0x515c, 0x6597, 0x675c, 0x6793, 0x75d8, 0x7ac7, 0x8373, 0xf95a, 0x8c46, 0x9017, 0x982d, 0x5c6f, 0x81c0, 0x829a, 0x9041, 0x906f, 0x920d, 0x5f97, 0x5d9d, 0x6a59, 0x71c8, 0x767b, 0x7b49, 0x85e4, 0x8b04, 0x9127, 0x9a30, 0x5587, 0x61f6, 0xf95b, 0x7669, 0x7f85, /* 0x55 */ 0x863f, 0x87ba, 0x88f8, 0x908f, 0xf95c, 0x6d1b, 0x70d9, 0x73de, 0x7d61, 0x843d, 0xf95d, 0x916a, 0x99f1, 0xf95e, 0x4e82, 0x5375, 0x6b04, 0x6b12, 0x703e, 0x721b, 0x862d, 0x9e1e, 0x524c, 0x8fa3, 0x5d50, 0x64e5, 0x652c, 0x6b16, 0x6feb, 0x7c43, 0x7e9c, 0x85cd, 0x8964, 0x89bd, 0x62c9, 0x81d8, 0x881f, 0x5eca, 0x6717, 0x6d6a, 0x72fc, 0x7405, 0x746f, 0x8782, 0x90de, 0x4f86, 0x5d0d, 0x5fa0, 0x840a, 0x51b7, 0x63a0, 0x7565, 0x4eae, 0x5006, 0x5169, 0x51c9, 0x6881, 0x6a11, 0x7cae, 0x7cb1, 0x7ce7, 0x826f, 0x8ad2, 0x8f1b, 0x91cf, 0x4fb6, 0x5137, 0x52f5, 0x5442, 0x5eec, 0x616e, 0x623e, 0x65c5, 0x6ada, 0x6ffe, 0x792a, 0x85dc, 0x8823, 0x95ad, 0x9a62, 0x9a6a, 0x9e97, 0x9ece, 0x529b, 0x66c6, 0x6b77, 0x701d, 0x792b, 0x8f62, 0x9742, 0x6190, 0x6200, 0x6523, 0x6f23, /* 0x56 */ 0x7149, 0x7489, 0x7df4, 0x806f, 0x84ee, 0x8f26, 0x9023, 0x934a, 0x51bd, 0x5217, 0x52a3, 0x6d0c, 0x70c8, 0x88c2, 0x5ec9, 0x6582, 0x6bae, 0x6fc2, 0x7c3e, 0x7375, 0x4ee4, 0x4f36, 0x56f9, 0xf95f, 0x5cba, 0x5dba, 0x601c, 0x73b2, 0x7b2d, 0x7f9a, 0x7fce, 0x8046, 0x901e, 0x9234, 0x96f6, 0x9748, 0x9818, 0x9f61, 0x4f8b, 0x6fa7, 0x79ae, 0x91b4, 0x96b7, 0x52de, 0xf960, 0x6488, 0x64c4, 0x6ad3, 0x6f5e, 0x7018, 0x7210, 0x76e7, 0x8001, 0x8606, 0x865c, 0x8def, 0x8f05, 0x9732, 0x9b6f, 0x9dfa, 0x9e75, 0x788c, 0x797f, 0x7da0, 0x83c9, 0x9304, 0x9e7f, 0x9e93, 0x8ad6, 0x58df, 0x5f04, 0x6727, 0x7027, 0x74cf, 0x7c60, 0x807e, 0x5121, 0x7028, 0x7262, 0x78ca, 0x8cc2, 0x8cda, 0x8cf4, 0x96f7, 0x4e86, 0x50da, 0x5bee, 0x5ed6, 0x6599, 0x71ce, 0x7642, 0x77ad, 0x804a, 0x84fc, /* 0x57 */ 0x907c, 0x9b27, 0x9f8d, 0x58d8, 0x5a41, 0x5c62, 0x6a13, 0x6dda, 0x6f0f, 0x763b, 0x7d2f, 0x7e37, 0x851e, 0x8938, 0x93e4, 0x964b, 0x5289, 0x65d2, 0x67f3, 0x69b4, 0x6d41, 0x6e9c, 0x700f, 0x7409, 0x7460, 0x7559, 0x7624, 0x786b, 0x8b2c, 0x985e, 0x516d, 0x622e, 0x9678, 0x4f96, 0x502b, 0x5d19, 0x6dea, 0x7db8, 0x8f2a, 0x5f8b, 0x6144, 0x6817, 0xf961, 0x9686, 0x52d2, 0x808b, 0x51dc, 0x51cc, 0x695e, 0x7a1c, 0x7dbe, 0x83f1, 0x9675, 0x4fda, 0x5229, 0x5398, 0x540f, 0x550e, 0x5c65, 0x60a7, 0x674e, 0x68a8, 0x6d6c, 0x7281, 0x72f8, 0x7406, 0x7483, 0xf962, 0x75e2, 0x7c6c, 0x7f79, 0x7fb8, 0x8389, 0x88cf, 0x88e1, 0x91cc, 0x91d0, 0x96e2, 0x9bc9, 0x541d, 0x6f7e, 0x71d0, 0x7498, 0x85fa, 0x8eaa, 0x96a3, 0x9c57, 0x9e9f, 0x6797, 0x6dcb, 0x7433, 0x81e8, 0x9716, 0x782c, /* 0x58 */ 0x7acb, 0x7b20, 0x7c92, 0x6469, 0x746a, 0x75f2, 0x78bc, 0x78e8, 0x99ac, 0x9b54, 0x9ebb, 0x5bde, 0x5e55, 0x6f20, 0x819c, 0x83ab, 0x9088, 0x4e07, 0x534d, 0x5a29, 0x5dd2, 0x5f4e, 0x6162, 0x633d, 0x6669, 0x66fc, 0x6eff, 0x6f2b, 0x7063, 0x779e, 0x842c, 0x8513, 0x883b, 0x8f13, 0x9945, 0x9c3b, 0x551c, 0x62b9, 0x672b, 0x6cab, 0x8309, 0x896a, 0x977a, 0x4ea1, 0x5984, 0x5fd8, 0x5fd9, 0x671b, 0x7db2, 0x7f54, 0x8292, 0x832b, 0x83bd, 0x8f1e, 0x9099, 0x57cb, 0x59b9, 0x5a92, 0x5bd0, 0x6627, 0x679a, 0x6885, 0x6bcf, 0x7164, 0x7f75, 0x8cb7, 0x8ce3, 0x9081, 0x9b45, 0x8108, 0x8c8a, 0x964c, 0x9a40, 0x9ea5, 0x5b5f, 0x6c13, 0x731b, 0x76f2, 0x76df, 0x840c, 0x51aa, 0x8993, 0x514d, 0x5195, 0x52c9, 0x68c9, 0x6c94, 0x7704, 0x7720, 0x7dbf, 0x7dec, 0x9762, 0x9eb5, 0x6ec5, /* 0x59 */ 0x8511, 0x51a5, 0x540d, 0x547d, 0x660e, 0x669d, 0x6927, 0x6e9f, 0x76bf, 0x7791, 0x8317, 0x84c2, 0x879f, 0x9169, 0x9298, 0x9cf4, 0x8882, 0x4fae, 0x5192, 0x52df, 0x59c6, 0x5e3d, 0x6155, 0x6478, 0x6479, 0x66ae, 0x67d0, 0x6a21, 0x6bcd, 0x6bdb, 0x725f, 0x7261, 0x7441, 0x7738, 0x77db, 0x8017, 0x82bc, 0x8305, 0x8b00, 0x8b28, 0x8c8c, 0x6728, 0x6c90, 0x7267, 0x76ee, 0x7766, 0x7a46, 0x9da9, 0x6b7f, 0x6c92, 0x5922, 0x6726, 0x8499, 0x536f, 0x5893, 0x5999, 0x5edf, 0x63cf, 0x6634, 0x6773, 0x6e3a, 0x732b, 0x7ad7, 0x82d7, 0x9328, 0x52d9, 0x5deb, 0x61ae, 0x61cb, 0x620a, 0x62c7, 0x64ab, 0x65e0, 0x6959, 0x6b66, 0x6bcb, 0x7121, 0x73f7, 0x755d, 0x7e46, 0x821e, 0x8302, 0x856a, 0x8aa3, 0x8cbf, 0x9727, 0x9d61, 0x58a8, 0x9ed8, 0x5011, 0x520e, 0x543b, 0x554f, 0x6587, /* 0x5a */ 0x6c76, 0x7d0a, 0x7d0b, 0x805e, 0x868a, 0x9580, 0x96ef, 0x52ff, 0x6c95, 0x7269, 0x5473, 0x5a9a, 0x5c3e, 0x5d4b, 0x5f4c, 0x5fae, 0x672a, 0x68b6, 0x6963, 0x6e3c, 0x6e44, 0x7709, 0x7c73, 0x7f8e, 0x8587, 0x8b0e, 0x8ff7, 0x9761, 0x9ef4, 0x5cb7, 0x60b6, 0x610d, 0x61ab, 0x654f, 0x65fb, 0x65fc, 0x6c11, 0x6cef, 0x739f, 0x73c9, 0x7de1, 0x9594, 0x5bc6, 0x871c, 0x8b10, 0x525d, 0x535a, 0x62cd, 0x640f, 0x64b2, 0x6734, 0x6a38, 0x6cca, 0x73c0, 0x749e, 0x7b94, 0x7c95, 0x7e1b, 0x818a, 0x8236, 0x8584, 0x8feb, 0x96f9, 0x99c1, 0x4f34, 0x534a, 0x53cd, 0x53db, 0x62cc, 0x642c, 0x6500, 0x6591, 0x69c3, 0x6cee, 0x6f58, 0x73ed, 0x7554, 0x7622, 0x76e4, 0x76fc, 0x78d0, 0x78fb, 0x792c, 0x7d46, 0x822c, 0x87e0, 0x8fd4, 0x9812, 0x98ef, 0x52c3, 0x62d4, 0x64a5, 0x6e24, 0x6f51, /* 0x5b */ 0x767c, 0x8dcb, 0x91b1, 0x9262, 0x9aee, 0x9b43, 0x5023, 0x508d, 0x574a, 0x59a8, 0x5c28, 0x5e47, 0x5f77, 0x623f, 0x653e, 0x65b9, 0x65c1, 0x6609, 0x678b, 0x699c, 0x6ec2, 0x78c5, 0x7d21, 0x80aa, 0x8180, 0x822b, 0x82b3, 0x84a1, 0x868c, 0x8a2a, 0x8b17, 0x90a6, 0x9632, 0x9f90, 0x500d, 0x4ff3, 0xf963, 0x57f9, 0x5f98, 0x62dc, 0x6392, 0x676f, 0x6e43, 0x7119, 0x76c3, 0x80cc, 0x80da, 0x88f4, 0x88f5, 0x8919, 0x8ce0, 0x8f29, 0x914d, 0x966a, 0x4f2f, 0x4f70, 0x5e1b, 0x67cf, 0x6822, 0x767d, 0x767e, 0x9b44, 0x5e61, 0x6a0a, 0x7169, 0x71d4, 0x756a, 0xf964, 0x7e41, 0x8543, 0x85e9, 0x98dc, 0x4f10, 0x7b4f, 0x7f70, 0x95a5, 0x51e1, 0x5e06, 0x68b5, 0x6c3e, 0x6c4e, 0x6cdb, 0x72af, 0x7bc4, 0x8303, 0x6cd5, 0x743a, 0x50fb, 0x5288, 0x58c1, 0x64d8, 0x6a97, 0x74a7, 0x7656, /* 0x5c */ 0x78a7, 0x8617, 0x95e2, 0x9739, 0xf965, 0x535e, 0x5f01, 0x8b8a, 0x8fa8, 0x8faf, 0x908a, 0x5225, 0x77a5, 0x9c49, 0x9f08, 0x4e19, 0x5002, 0x5175, 0x5c5b, 0x5e77, 0x661e, 0x663a, 0x67c4, 0x68c5, 0x70b3, 0x7501, 0x75c5, 0x79c9, 0x7add, 0x8f27, 0x9920, 0x9a08, 0x4fdd, 0x5821, 0x5831, 0x5bf6, 0x666e, 0x6b65, 0x6d11, 0x6e7a, 0x6f7d, 0x73e4, 0x752b, 0x83e9, 0x88dc, 0x8913, 0x8b5c, 0x8f14, 0x4f0f, 0x50d5, 0x5310, 0x535c, 0x5b93, 0x5fa9, 0x670d, 0x798f, 0x8179, 0x832f, 0x8514, 0x8907, 0x8986, 0x8f39, 0x8f3b, 0x99a5, 0x9c12, 0x672c, 0x4e76, 0x4ff8, 0x5949, 0x5c01, 0x5cef, 0x5cf0, 0x6367, 0x68d2, 0x70fd, 0x71a2, 0x742b, 0x7e2b, 0x84ec, 0x8702, 0x9022, 0x92d2, 0x9cf3, 0x4e0d, 0x4ed8, 0x4fef, 0x5085, 0x5256, 0x526f, 0x5426, 0x5490, 0x57e0, 0x592b, 0x5a66, /* 0x5d */ 0x5b5a, 0x5b75, 0x5bcc, 0x5e9c, 0xf966, 0x6276, 0x6577, 0x65a7, 0x6d6e, 0x6ea5, 0x7236, 0x7b26, 0x7c3f, 0x7f36, 0x8150, 0x8151, 0x819a, 0x8240, 0x8299, 0x83a9, 0x8a03, 0x8ca0, 0x8ce6, 0x8cfb, 0x8d74, 0x8dba, 0x90e8, 0x91dc, 0x961c, 0x9644, 0x99d9, 0x9ce7, 0x5317, 0x5206, 0x5429, 0x5674, 0x58b3, 0x5954, 0x596e, 0x5fff, 0x61a4, 0x626e, 0x6610, 0x6c7e, 0x711a, 0x76c6, 0x7c89, 0x7cde, 0x7d1b, 0x82ac, 0x8cc1, 0x96f0, 0xf967, 0x4f5b, 0x5f17, 0x5f7f, 0x62c2, 0x5d29, 0x670b, 0x68da, 0x787c, 0x7e43, 0x9d6c, 0x4e15, 0x5099, 0x5315, 0x532a, 0x5351, 0x5983, 0x5a62, 0x5e87, 0x60b2, 0x618a, 0x6249, 0x6279, 0x6590, 0x6787, 0x69a7, 0x6bd4, 0x6bd6, 0x6bd7, 0x6bd8, 0x6cb8, 0xf968, 0x7435, 0x75fa, 0x7812, 0x7891, 0x79d5, 0x79d8, 0x7c83, 0x7dcb, 0x7fe1, 0x80a5, /* 0x5e */ 0x813e, 0x81c2, 0x83f2, 0x871a, 0x88e8, 0x8ab9, 0x8b6c, 0x8cbb, 0x9119, 0x975e, 0x98db, 0x9f3b, 0x56ac, 0x5b2a, 0x5f6c, 0x658c, 0x6ab3, 0x6baf, 0x6d5c, 0x6ff1, 0x7015, 0x725d, 0x73ad, 0x8ca7, 0x8cd3, 0x983b, 0x6191, 0x6c37, 0x8058, 0x9a01, 0x4e4d, 0x4e8b, 0x4e9b, 0x4ed5, 0x4f3a, 0x4f3c, 0x4f7f, 0x4fdf, 0x50ff, 0x53f2, 0x53f8, 0x5506, 0x55e3, 0x56db, 0x58eb, 0x5962, 0x5a11, 0x5beb, 0x5bfa, 0x5c04, 0x5df3, 0x5e2b, 0x5f99, 0x601d, 0x6368, 0x659c, 0x65af, 0x67f6, 0x67fb, 0x68ad, 0x6b7b, 0x6c99, 0x6cd7, 0x6e23, 0x7009, 0x7345, 0x7802, 0x793e, 0x7940, 0x7960, 0x79c1, 0x7be9, 0x7d17, 0x7d72, 0x8086, 0x820d, 0x838e, 0x84d1, 0x86c7, 0x88df, 0x8a50, 0x8a5e, 0x8b1d, 0x8cdc, 0x8d66, 0x8fad, 0x90aa, 0x98fc, 0x99df, 0x9e9d, 0x524a, 0xf969, 0x6714, 0xf96a, /* 0x5f */ 0x5098, 0x522a, 0x5c71, 0x6563, 0x6c55, 0x73ca, 0x7523, 0x759d, 0x7b97, 0x849c, 0x9178, 0x9730, 0x4e77, 0x6492, 0x6bba, 0x715e, 0x85a9, 0x4e09, 0xf96b, 0x6749, 0x68ee, 0x6e17, 0x829f, 0x8518, 0x886b, 0x63f7, 0x6f81, 0x9212, 0x98af, 0x4e0a, 0x50b7, 0x50cf, 0x511f, 0x5546, 0x55aa, 0x5617, 0x5b40, 0x5c19, 0x5ce0, 0x5e38, 0x5e8a, 0x5ea0, 0x5ec2, 0x60f3, 0x6851, 0x6a61, 0x6e58, 0x723d, 0x7240, 0x72c0, 0x76f8, 0x7965, 0x7bb1, 0x7fd4, 0x88f3, 0x89f4, 0x8a73, 0x8c61, 0x8cde, 0x971c, 0x585e, 0x74bd, 0x8cfd, 0x55c7, 0xf96c, 0x7a61, 0x7d22, 0x8272, 0x7272, 0x751f, 0x7525, 0xf96d, 0x7b19, 0x5885, 0x58fb, 0x5dbc, 0x5e8f, 0x5eb6, 0x5f90, 0x6055, 0x6292, 0x637f, 0x654d, 0x6691, 0x66d9, 0x66f8, 0x6816, 0x68f2, 0x7280, 0x745e, 0x7b6e, 0x7d6e, 0x7dd6, 0x7f72, /* 0x60 */ 0x80e5, 0x8212, 0x85af, 0x897f, 0x8a93, 0x901d, 0x92e4, 0x9ecd, 0x9f20, 0x5915, 0x596d, 0x5e2d, 0x60dc, 0x6614, 0x6673, 0x6790, 0x6c50, 0x6dc5, 0x6f5f, 0x77f3, 0x78a9, 0x84c6, 0x91cb, 0x932b, 0x4ed9, 0x50ca, 0x5148, 0x5584, 0x5b0b, 0x5ba3, 0x6247, 0x657e, 0x65cb, 0x6e32, 0x717d, 0x7401, 0x7444, 0x7487, 0x74bf, 0x766c, 0x79aa, 0x7dda, 0x7e55, 0x7fa8, 0x817a, 0x81b3, 0x8239, 0x861a, 0x87ec, 0x8a75, 0x8de3, 0x9078, 0x9291, 0x9425, 0x994d, 0x9bae, 0x5368, 0x5c51, 0x6954, 0x6cc4, 0x6d29, 0x6e2b, 0x820c, 0x859b, 0x893b, 0x8a2d, 0x8aaa, 0x96ea, 0x9f67, 0x5261, 0x66b9, 0x6bb2, 0x7e96, 0x87fe, 0x8d0d, 0x9583, 0x965d, 0x651d, 0x6d89, 0x71ee, 0xf96e, 0x57ce, 0x59d3, 0x5bac, 0x6027, 0x60fa, 0x6210, 0x661f, 0x665f, 0x7329, 0x73f9, 0x76db, 0x7701, 0x7b6c, /* 0x61 */ 0x8056, 0x8072, 0x8165, 0x8aa0, 0x9192, 0x4e16, 0x52e2, 0x6b72, 0x6d17, 0x7a05, 0x7b39, 0x7d30, 0xf96f, 0x8cb0, 0x53ec, 0x562f, 0x5851, 0x5bb5, 0x5c0f, 0x5c11, 0x5de2, 0x6240, 0x6383, 0x6414, 0x662d, 0x68b3, 0x6cbc, 0x6d88, 0x6eaf, 0x701f, 0x70a4, 0x71d2, 0x7526, 0x758f, 0x758e, 0x7619, 0x7b11, 0x7be0, 0x7c2b, 0x7d20, 0x7d39, 0x852c, 0x856d, 0x8607, 0x8a34, 0x900d, 0x9061, 0x90b5, 0x92b7, 0x97f6, 0x9a37, 0x4fd7, 0x5c6c, 0x675f, 0x6d91, 0x7c9f, 0x7e8c, 0x8b16, 0x8d16, 0x901f, 0x5b6b, 0x5dfd, 0x640d, 0x84c0, 0x905c, 0x98e1, 0x7387, 0x5b8b, 0x609a, 0x677e, 0x6dde, 0x8a1f, 0x8aa6, 0x9001, 0x980c, 0x5237, 0xf970, 0x7051, 0x788e, 0x9396, 0x8870, 0x91d7, 0x4fee, 0x53d7, 0x55fd, 0x56da, 0x5782, 0x58fd, 0x5ac2, 0x5b88, 0x5cab, 0x5cc0, 0x5e25, 0x6101, /* 0x62 */ 0x620d, 0x624b, 0x6388, 0x641c, 0x6536, 0x6578, 0x6a39, 0x6b8a, 0x6c34, 0x6d19, 0x6f31, 0x71e7, 0x72e9, 0x7378, 0x7407, 0x74b2, 0x7626, 0x7761, 0x79c0, 0x7a57, 0x7aea, 0x7cb9, 0x7d8f, 0x7dac, 0x7e61, 0x7f9e, 0x8129, 0x8331, 0x8490, 0x84da, 0x85ea, 0x8896, 0x8ab0, 0x8b90, 0x8f38, 0x9042, 0x9083, 0x916c, 0x9296, 0x92b9, 0x968b, 0x96a7, 0x96a8, 0x96d6, 0x9700, 0x9808, 0x9996, 0x9ad3, 0x9b1a, 0x53d4, 0x587e, 0x5919, 0x5b70, 0x5bbf, 0x6dd1, 0x6f5a, 0x719f, 0x7421, 0x74b9, 0x8085, 0x83fd, 0x5de1, 0x5f87, 0x5faa, 0x6042, 0x65ec, 0x6812, 0x696f, 0x6a53, 0x6b89, 0x6d35, 0x6df3, 0x73e3, 0x76fe, 0x77ac, 0x7b4d, 0x7d14, 0x8123, 0x821c, 0x8340, 0x84f4, 0x8563, 0x8a62, 0x8ac4, 0x9187, 0x931e, 0x9806, 0x99b4, 0x620c, 0x8853, 0x8ff0, 0x9265, 0x5d07, 0x5d27, /* 0x63 */ 0x5d69, 0x745f, 0x819d, 0x8768, 0x6fd5, 0x62fe, 0x7fd2, 0x8936, 0x8972, 0x4e1e, 0x4e58, 0x50e7, 0x52dd, 0x5347, 0x627f, 0x6607, 0x7e69, 0x8805, 0x965e, 0x4f8d, 0x5319, 0x5636, 0x59cb, 0x5aa4, 0x5c38, 0x5c4e, 0x5c4d, 0x5e02, 0x5f11, 0x6043, 0x65bd, 0x662f, 0x6642, 0x67be, 0x67f4, 0x731c, 0x77e2, 0x793a, 0x7fc5, 0x8494, 0x84cd, 0x8996, 0x8a66, 0x8a69, 0x8ae1, 0x8c55, 0x8c7a, 0x57f4, 0x5bd4, 0x5f0f, 0x606f, 0x62ed, 0x690d, 0x6b96, 0x6e5c, 0x7184, 0x7bd2, 0x8755, 0x8b58, 0x8efe, 0x98df, 0x98fe, 0x4f38, 0x4f81, 0x4fe1, 0x547b, 0x5a20, 0x5bb8, 0x613c, 0x65b0, 0x6668, 0x71fc, 0x7533, 0x795e, 0x7d33, 0x814e, 0x81e3, 0x8398, 0x85aa, 0x85ce, 0x8703, 0x8a0a, 0x8eab, 0x8f9b, 0xf971, 0x8fc5, 0x5931, 0x5ba4, 0x5be6, 0x6089, 0x5be9, 0x5c0b, 0x5fc3, 0x6c81, /* 0x64 */ 0xf972, 0x6df1, 0x700b, 0x751a, 0x82af, 0x8af6, 0x4ec0, 0x5341, 0xf973, 0x96d9, 0x6c0f, 0x4e9e, 0x4fc4, 0x5152, 0x555e, 0x5a25, 0x5ce8, 0x6211, 0x7259, 0x82bd, 0x83aa, 0x86fe, 0x8859, 0x8a1d, 0x963f, 0x96c5, 0x9913, 0x9d09, 0x9d5d, 0x580a, 0x5cb3, 0x5dbd, 0x5e44, 0x60e1, 0x6115, 0x63e1, 0x6a02, 0x6e25, 0x9102, 0x9354, 0x984e, 0x9c10, 0x9f77, 0x5b89, 0x5cb8, 0x6309, 0x664f, 0x6848, 0x773c, 0x96c1, 0x978d, 0x9854, 0x9b9f, 0x65a1, 0x8b01, 0x8ecb, 0x95bc, 0x5535, 0x5ca9, 0x5dd6, 0x5eb5, 0x6697, 0x764c, 0x83f4, 0x95c7, 0x58d3, 0x62bc, 0x72ce, 0x9d28, 0x4ef0, 0x592e, 0x600f, 0x663b, 0x6b83, 0x79e7, 0x9d26, 0x5393, 0x54c0, 0x57c3, 0x5d16, 0x611b, 0x66d6, 0x6daf, 0x788d, 0x827e, 0x9698, 0x9744, 0x5384, 0x627c, 0x6396, 0x6db2, 0x7e0a, 0x814b, 0x984d, /* 0x65 */ 0x6afb, 0x7f4c, 0x9daf, 0x9e1a, 0x4e5f, 0x503b, 0x51b6, 0x591c, 0x60f9, 0x63f6, 0x6930, 0x723a, 0x8036, 0xf974, 0x91ce, 0x5f31, 0xf975, 0xf976, 0x7d04, 0x82e5, 0x846f, 0x84bb, 0x85e5, 0x8e8d, 0xf977, 0x4f6f, 0xf978, 0xf979, 0x58e4, 0x5b43, 0x6059, 0x63da, 0x6518, 0x656d, 0x6698, 0xf97a, 0x694a, 0x6a23, 0x6d0b, 0x7001, 0x716c, 0x75d2, 0x760d, 0x79b3, 0x7a70, 0xf97b, 0x7f8a, 0xf97c, 0x8944, 0xf97d, 0x8b93, 0x91c0, 0x967d, 0xf97e, 0x990a, 0x5704, 0x5fa1, 0x65bc, 0x6f01, 0x7600, 0x79a6, 0x8a9e, 0x99ad, 0x9b5a, 0x9f6c, 0x5104, 0x61b6, 0x6291, 0x6a8d, 0x81c6, 0x5043, 0x5830, 0x5f66, 0x7109, 0x8a00, 0x8afa, 0x5b7c, 0x8616, 0x4ffa, 0x513c, 0x56b4, 0x5944, 0x63a9, 0x6df9, 0x5daa, 0x696d, 0x5186, 0x4e88, 0x4f59, 0xf97f, 0xf980, 0xf981, 0x5982, 0xf982, /* 0x66 */ 0xf983, 0x6b5f, 0x6c5d, 0xf984, 0x74b5, 0x7916, 0xf985, 0x8207, 0x8245, 0x8339, 0x8f3f, 0x8f5d, 0xf986, 0x9918, 0xf987, 0xf988, 0xf989, 0x4ea6, 0xf98a, 0x57df, 0x5f79, 0x6613, 0xf98b, 0xf98c, 0x75ab, 0x7e79, 0x8b6f, 0xf98d, 0x9006, 0x9a5b, 0x56a5, 0x5827, 0x59f8, 0x5a1f, 0x5bb4, 0xf98e, 0x5ef6, 0xf98f, 0xf990, 0x6350, 0x633b, 0xf991, 0x693d, 0x6c87, 0x6cbf, 0x6d8e, 0x6d93, 0x6df5, 0x6f14, 0xf992, 0x70df, 0x7136, 0x7159, 0xf993, 0x71c3, 0x71d5, 0xf994, 0x784f, 0x786f, 0xf995, 0x7b75, 0x7de3, 0xf996, 0x7e2f, 0xf997, 0x884d, 0x8edf, 0xf998, 0xf999, 0xf99a, 0x925b, 0xf99b, 0x9cf6, 0xf99c, 0xf99d, 0xf99e, 0x6085, 0x6d85, 0xf99f, 0x71b1, 0xf9a0, 0xf9a1, 0x95b1, 0x53ad, 0xf9a2, 0xf9a3, 0xf9a4, 0x67d3, 0xf9a5, 0x708e, 0x7130, 0x7430, 0x8276, 0x82d2, /* 0x67 */ 0xf9a6, 0x95bb, 0x9ae5, 0x9e7d, 0x66c4, 0xf9a7, 0x71c1, 0x8449, 0xf9a8, 0xf9a9, 0x584b, 0xf9aa, 0xf9ab, 0x5db8, 0x5f71, 0xf9ac, 0x6620, 0x668e, 0x6979, 0x69ae, 0x6c38, 0x6cf3, 0x6e36, 0x6f41, 0x6fda, 0x701b, 0x702f, 0x7150, 0x71df, 0x7370, 0xf9ad, 0x745b, 0xf9ae, 0x74d4, 0x76c8, 0x7a4e, 0x7e93, 0xf9af, 0xf9b0, 0x82f1, 0x8a60, 0x8fce, 0xf9b1, 0x9348, 0xf9b2, 0x9719, 0xf9b3, 0xf9b4, 0x4e42, 0x502a, 0xf9b5, 0x5208, 0x53e1, 0x66f3, 0x6c6d, 0x6fca, 0x730a, 0x777f, 0x7a62, 0x82ae, 0x85dd, 0x8602, 0xf9b6, 0x88d4, 0x8a63, 0x8b7d, 0x8c6b, 0xf9b7, 0x92b3, 0xf9b8, 0x9713, 0x9810, 0x4e94, 0x4f0d, 0x4fc9, 0x50b2, 0x5348, 0x543e, 0x5433, 0x55da, 0x5862, 0x58ba, 0x5967, 0x5a1b, 0x5be4, 0x609f, 0xf9b9, 0x61ca, 0x6556, 0x65ff, 0x6664, 0x68a7, 0x6c5a, 0x6fb3, /* 0x68 */ 0x70cf, 0x71ac, 0x7352, 0x7b7d, 0x8708, 0x8aa4, 0x9c32, 0x9f07, 0x5c4b, 0x6c83, 0x7344, 0x7389, 0x923a, 0x6eab, 0x7465, 0x761f, 0x7a69, 0x7e15, 0x860a, 0x5140, 0x58c5, 0x64c1, 0x74ee, 0x7515, 0x7670, 0x7fc1, 0x9095, 0x96cd, 0x9954, 0x6e26, 0x74e6, 0x7aa9, 0x7aaa, 0x81e5, 0x86d9, 0x8778, 0x8a1b, 0x5a49, 0x5b8c, 0x5b9b, 0x68a1, 0x6900, 0x6d63, 0x73a9, 0x7413, 0x742c, 0x7897, 0x7de9, 0x7feb, 0x8118, 0x8155, 0x839e, 0x8c4c, 0x962e, 0x9811, 0x66f0, 0x5f80, 0x65fa, 0x6789, 0x6c6a, 0x738b, 0x502d, 0x5a03, 0x6b6a, 0x77ee, 0x5916, 0x5d6c, 0x5dcd, 0x7325, 0x754f, 0xf9ba, 0xf9bb, 0x50e5, 0x51f9, 0x582f, 0x592d, 0x5996, 0x59da, 0x5be5, 0xf9bc, 0xf9bd, 0x5da2, 0x62d7, 0x6416, 0x6493, 0x64fe, 0xf9be, 0x66dc, 0xf9bf, 0x6a48, 0xf9c0, 0x71ff, 0x7464, 0xf9c1, /* 0x69 */ 0x7a88, 0x7aaf, 0x7e47, 0x7e5e, 0x8000, 0x8170, 0xf9c2, 0x87ef, 0x8981, 0x8b20, 0x9059, 0xf9c3, 0x9080, 0x9952, 0x617e, 0x6b32, 0x6d74, 0x7e1f, 0x8925, 0x8fb1, 0x4fd1, 0x50ad, 0x5197, 0x52c7, 0x57c7, 0x5889, 0x5bb9, 0x5eb8, 0x6142, 0x6995, 0x6d8c, 0x6e67, 0x6eb6, 0x7194, 0x7462, 0x7528, 0x752c, 0x8073, 0x8338, 0x84c9, 0x8e0a, 0x9394, 0x93de, 0xf9c4, 0x4e8e, 0x4f51, 0x5076, 0x512a, 0x53c8, 0x53cb, 0x53f3, 0x5b87, 0x5bd3, 0x5c24, 0x611a, 0x6182, 0x65f4, 0x725b, 0x7397, 0x7440, 0x76c2, 0x7950, 0x7991, 0x79b9, 0x7d06, 0x7fbd, 0x828b, 0x85d5, 0x865e, 0x8fc2, 0x9047, 0x90f5, 0x91ea, 0x9685, 0x96e8, 0x96e9, 0x52d6, 0x5f67, 0x65ed, 0x6631, 0x682f, 0x715c, 0x7a36, 0x90c1, 0x980a, 0x4e91, 0xf9c5, 0x6a52, 0x6b9e, 0x6f90, 0x7189, 0x8018, 0x82b8, 0x8553, /* 0x6a */ 0x904b, 0x9695, 0x96f2, 0x97fb, 0x851a, 0x9b31, 0x4e90, 0x718a, 0x96c4, 0x5143, 0x539f, 0x54e1, 0x5713, 0x5712, 0x57a3, 0x5a9b, 0x5ac4, 0x5bc3, 0x6028, 0x613f, 0x63f4, 0x6c85, 0x6d39, 0x6e72, 0x6e90, 0x7230, 0x733f, 0x7457, 0x82d1, 0x8881, 0x8f45, 0x9060, 0xf9c6, 0x9662, 0x9858, 0x9d1b, 0x6708, 0x8d8a, 0x925e, 0x4f4d, 0x5049, 0x50de, 0x5371, 0x570d, 0x59d4, 0x5a01, 0x5c09, 0x6170, 0x6690, 0x6e2d, 0x7232, 0x744b, 0x7def, 0x80c3, 0x840e, 0x8466, 0x853f, 0x875f, 0x885b, 0x8918, 0x8b02, 0x9055, 0x97cb, 0x9b4f, 0x4e73, 0x4f91, 0x5112, 0x516a, 0xf9c7, 0x552f, 0x55a9, 0x5b7a, 0x5ba5, 0x5e7c, 0x5e7d, 0x5ebe, 0x60a0, 0x60df, 0x6108, 0x6109, 0x63c4, 0x6538, 0x6709, 0xf9c8, 0x67d4, 0x67da, 0xf9c9, 0x6961, 0x6962, 0x6cb9, 0x6d27, 0xf9ca, 0x6e38, 0xf9cb, /* 0x6b */ 0x6fe1, 0x7336, 0x7337, 0xf9cc, 0x745c, 0x7531, 0xf9cd, 0x7652, 0xf9ce, 0xf9cf, 0x7dad, 0x81fe, 0x8438, 0x88d5, 0x8a98, 0x8adb, 0x8aed, 0x8e30, 0x8e42, 0x904a, 0x903e, 0x907a, 0x9149, 0x91c9, 0x936e, 0xf9d0, 0xf9d1, 0x5809, 0xf9d2, 0x6bd3, 0x8089, 0x80b2, 0xf9d3, 0xf9d4, 0x5141, 0x596b, 0x5c39, 0xf9d5, 0xf9d6, 0x6f64, 0x73a7, 0x80e4, 0x8d07, 0xf9d7, 0x9217, 0x958f, 0xf9d8, 0xf9d9, 0xf9da, 0xf9db, 0x807f, 0x620e, 0x701c, 0x7d68, 0x878d, 0xf9dc, 0x57a0, 0x6069, 0x6147, 0x6bb7, 0x8abe, 0x9280, 0x96b1, 0x4e59, 0x541f, 0x6deb, 0x852d, 0x9670, 0x97f3, 0x98ee, 0x63d6, 0x6ce3, 0x9091, 0x51dd, 0x61c9, 0x81ba, 0x9df9, 0x4f9d, 0x501a, 0x5100, 0x5b9c, 0x610f, 0x61ff, 0x64ec, 0x6905, 0x6bc5, 0x7591, 0x77e3, 0x7fa9, 0x8264, 0x858f, 0x87fb, 0x8863, 0x8abc, /* 0x6c */ 0x8b70, 0x91ab, 0x4e8c, 0x4ee5, 0x4f0a, 0xf9dd, 0xf9de, 0x5937, 0x59e8, 0xf9df, 0x5df2, 0x5f1b, 0x5f5b, 0x6021, 0xf9e0, 0xf9e1, 0xf9e2, 0xf9e3, 0x723e, 0x73e5, 0xf9e4, 0x7570, 0x75cd, 0xf9e5, 0x79fb, 0xf9e6, 0x800c, 0x8033, 0x8084, 0x82e1, 0x8351, 0xf9e7, 0xf9e8, 0x8cbd, 0x8cb3, 0x9087, 0xf9e9, 0xf9ea, 0x98f4, 0x990c, 0xf9eb, 0xf9ec, 0x7037, 0x76ca, 0x7fca, 0x7fcc, 0x7ffc, 0x8b1a, 0x4eba, 0x4ec1, 0x5203, 0x5370, 0xf9ed, 0x54bd, 0x56e0, 0x59fb, 0x5bc5, 0x5f15, 0x5fcd, 0x6e6e, 0xf9ee, 0xf9ef, 0x7d6a, 0x8335, 0xf9f0, 0x8693, 0x8a8d, 0xf9f1, 0x976d, 0x9777, 0xf9f2, 0xf9f3, 0x4e00, 0x4f5a, 0x4f7e, 0x58f9, 0x65e5, 0x6ea2, 0x9038, 0x93b0, 0x99b9, 0x4efb, 0x58ec, 0x598a, 0x59d9, 0x6041, 0xf9f4, 0xf9f5, 0x7a14, 0xf9f6, 0x834f, 0x8cc3, 0x5165, 0x5344, /* 0x6d */ 0xf9f7, 0xf9f8, 0xf9f9, 0x4ecd, 0x5269, 0x5b55, 0x82bf, 0x4ed4, 0x523a, 0x54a8, 0x59c9, 0x59ff, 0x5b50, 0x5b57, 0x5b5c, 0x6063, 0x6148, 0x6ecb, 0x7099, 0x716e, 0x7386, 0x74f7, 0x75b5, 0x78c1, 0x7d2b, 0x8005, 0x81ea, 0x8328, 0x8517, 0x85c9, 0x8aee, 0x8cc7, 0x96cc, 0x4f5c, 0x52fa, 0x56bc, 0x65ab, 0x6628, 0x707c, 0x70b8, 0x7235, 0x7dbd, 0x828d, 0x914c, 0x96c0, 0x9d72, 0x5b71, 0x68e7, 0x6b98, 0x6f7a, 0x76de, 0x5c91, 0x66ab, 0x6f5b, 0x7bb4, 0x7c2a, 0x8836, 0x96dc, 0x4e08, 0x4ed7, 0x5320, 0x5834, 0x58bb, 0x58ef, 0x596c, 0x5c07, 0x5e33, 0x5e84, 0x5f35, 0x638c, 0x66b2, 0x6756, 0x6a1f, 0x6aa3, 0x6b0c, 0x6f3f, 0x7246, 0xf9fa, 0x7350, 0x748b, 0x7ae0, 0x7ca7, 0x8178, 0x81df, 0x81e7, 0x838a, 0x846c, 0x8523, 0x8594, 0x85cf, 0x88dd, 0x8d13, 0x91ac, 0x9577, /* 0x6e */ 0x969c, 0x518d, 0x54c9, 0x5728, 0x5bb0, 0x624d, 0x6750, 0x683d, 0x6893, 0x6e3d, 0x6ed3, 0x707d, 0x7e21, 0x88c1, 0x8ca1, 0x8f09, 0x9f4b, 0x9f4e, 0x722d, 0x7b8f, 0x8acd, 0x931a, 0x4f47, 0x4f4e, 0x5132, 0x5480, 0x59d0, 0x5e95, 0x62b5, 0x6775, 0x696e, 0x6a17, 0x6cae, 0x6e1a, 0x72d9, 0x732a, 0x75bd, 0x7bb8, 0x7d35, 0x82e7, 0x83f9, 0x8457, 0x85f7, 0x8a5b, 0x8caf, 0x8e87, 0x9019, 0x90b8, 0x96ce, 0x9f5f, 0x52e3, 0x540a, 0x5ae1, 0x5bc2, 0x6458, 0x6575, 0x6ef4, 0x72c4, 0xf9fb, 0x7684, 0x7a4d, 0x7b1b, 0x7c4d, 0x7e3e, 0x7fdf, 0x837b, 0x8b2b, 0x8cca, 0x8d64, 0x8de1, 0x8e5f, 0x8fea, 0x8ff9, 0x9069, 0x93d1, 0x4f43, 0x4f7a, 0x50b3, 0x5168, 0x5178, 0x524d, 0x526a, 0x5861, 0x587c, 0x5960, 0x5c08, 0x5c55, 0x5edb, 0x609b, 0x6230, 0x6813, 0x6bbf, 0x6c08, 0x6fb1, /* 0x6f */ 0x714e, 0x7420, 0x7530, 0x7538, 0x7551, 0x7672, 0x7b4c, 0x7b8b, 0x7bad, 0x7bc6, 0x7e8f, 0x8a6e, 0x8f3e, 0x8f49, 0x923f, 0x9293, 0x9322, 0x942b, 0x96fb, 0x985a, 0x986b, 0x991e, 0x5207, 0x622a, 0x6298, 0x6d59, 0x7664, 0x7aca, 0x7bc0, 0x7d76, 0x5360, 0x5cbe, 0x5e97, 0x6f38, 0x70b9, 0x7c98, 0x9711, 0x9b8e, 0x9ede, 0x63a5, 0x647a, 0x8776, 0x4e01, 0x4e95, 0x4ead, 0x505c, 0x5075, 0x5448, 0x59c3, 0x5b9a, 0x5e40, 0x5ead, 0x5ef7, 0x5f81, 0x60c5, 0x633a, 0x653f, 0x6574, 0x65cc, 0x6676, 0x6678, 0x67fe, 0x6968, 0x6a89, 0x6b63, 0x6c40, 0x6dc0, 0x6de8, 0x6e1f, 0x6e5e, 0x701e, 0x70a1, 0x738e, 0x73fd, 0x753a, 0x775b, 0x7887, 0x798e, 0x7a0b, 0x7a7d, 0x7cbe, 0x7d8e, 0x8247, 0x8a02, 0x8aea, 0x8c9e, 0x912d, 0x914a, 0x91d8, 0x9266, 0x92cc, 0x9320, 0x9706, 0x9756, /* 0x70 */ 0x975c, 0x9802, 0x9f0e, 0x5236, 0x5291, 0x557c, 0x5824, 0x5e1d, 0x5f1f, 0x608c, 0x63d0, 0x68af, 0x6fdf, 0x796d, 0x7b2c, 0x81cd, 0x85ba, 0x88fd, 0x8af8, 0x8e44, 0x918d, 0x9664, 0x969b, 0x973d, 0x984c, 0x9f4a, 0x4fce, 0x5146, 0x51cb, 0x52a9, 0x5632, 0x5f14, 0x5f6b, 0x63aa, 0x64cd, 0x65e9, 0x6641, 0x66fa, 0x66f9, 0x671d, 0x689d, 0x68d7, 0x69fd, 0x6f15, 0x6f6e, 0x7167, 0x71e5, 0x722a, 0x74aa, 0x773a, 0x7956, 0x795a, 0x79df, 0x7a20, 0x7a95, 0x7c97, 0x7cdf, 0x7d44, 0x7e70, 0x8087, 0x85fb, 0x86a4, 0x8a54, 0x8abf, 0x8d99, 0x8e81, 0x9020, 0x906d, 0x91e3, 0x963b, 0x96d5, 0x9ce5, 0x65cf, 0x7c07, 0x8db3, 0x93c3, 0x5b58, 0x5c0a, 0x5352, 0x62d9, 0x731d, 0x5027, 0x5b97, 0x5f9e, 0x60b0, 0x616b, 0x68d5, 0x6dd9, 0x742e, 0x7a2e, 0x7d42, 0x7d9c, 0x7e31, 0x816b, /* 0x71 */ 0x8e2a, 0x8e35, 0x937e, 0x9418, 0x4f50, 0x5750, 0x5de6, 0x5ea7, 0x632b, 0x7f6a, 0x4e3b, 0x4f4f, 0x4f8f, 0x505a, 0x59dd, 0x80c4, 0x546a, 0x5468, 0x55fe, 0x594f, 0x5b99, 0x5dde, 0x5eda, 0x665d, 0x6731, 0x67f1, 0x682a, 0x6ce8, 0x6d32, 0x6e4a, 0x6f8d, 0x70b7, 0x73e0, 0x7587, 0x7c4c, 0x7d02, 0x7d2c, 0x7da2, 0x821f, 0x86db, 0x8a3b, 0x8a85, 0x8d70, 0x8e8a, 0x8f33, 0x9031, 0x914e, 0x9152, 0x9444, 0x99d0, 0x7af9, 0x7ca5, 0x4fca, 0x5101, 0x51c6, 0x57c8, 0x5bef, 0x5cfb, 0x6659, 0x6a3d, 0x6d5a, 0x6e96, 0x6fec, 0x710c, 0x756f, 0x7ae3, 0x8822, 0x9021, 0x9075, 0x96cb, 0x99ff, 0x8301, 0x4e2d, 0x4ef2, 0x8846, 0x91cd, 0x537d, 0x6adb, 0x696b, 0x6c41, 0x847a, 0x589e, 0x618e, 0x66fe, 0x62ef, 0x70dd, 0x7511, 0x75c7, 0x7e52, 0x84b8, 0x8b49, 0x8d08, 0x4e4b, 0x53ea, /* 0x72 */ 0x54ab, 0x5730, 0x5740, 0x5fd7, 0x6301, 0x6307, 0x646f, 0x652f, 0x65e8, 0x667a, 0x679d, 0x67b3, 0x6b62, 0x6c60, 0x6c9a, 0x6f2c, 0x77e5, 0x7825, 0x7949, 0x7957, 0x7d19, 0x80a2, 0x8102, 0x81f3, 0x829d, 0x82b7, 0x8718, 0x8a8c, 0xf9fc, 0x8d04, 0x8dbe, 0x9072, 0x76f4, 0x7a19, 0x7a37, 0x7e54, 0x8077, 0x5507, 0x55d4, 0x5875, 0x632f, 0x6422, 0x6649, 0x664b, 0x686d, 0x699b, 0x6b84, 0x6d25, 0x6eb1, 0x73cd, 0x7468, 0x74a1, 0x755b, 0x75b9, 0x76e1, 0x771e, 0x778b, 0x79e6, 0x7e09, 0x7e1d, 0x81fb, 0x852f, 0x8897, 0x8a3a, 0x8cd1, 0x8eeb, 0x8fb0, 0x9032, 0x93ad, 0x9663, 0x9673, 0x9707, 0x4f84, 0x53f1, 0x59ea, 0x5ac9, 0x5e19, 0x684e, 0x74c6, 0x75be, 0x79e9, 0x7a92, 0x81a3, 0x86ed, 0x8cea, 0x8dcc, 0x8fed, 0x659f, 0x6715, 0xf9fd, 0x57f7, 0x6f57, 0x7ddd, 0x8f2f, /* 0x73 */ 0x93f6, 0x96c6, 0x5fb5, 0x61f2, 0x6f84, 0x4e14, 0x4f98, 0x501f, 0x53c9, 0x55df, 0x5d6f, 0x5dee, 0x6b21, 0x6b64, 0x78cb, 0x7b9a, 0xf9fe, 0x8e49, 0x8eca, 0x906e, 0x6349, 0x643e, 0x7740, 0x7a84, 0x932f, 0x947f, 0x9f6a, 0x64b0, 0x6faf, 0x71e6, 0x74a8, 0x74da, 0x7ac4, 0x7c12, 0x7e82, 0x7cb2, 0x7e98, 0x8b9a, 0x8d0a, 0x947d, 0x9910, 0x994c, 0x5239, 0x5bdf, 0x64e6, 0x672d, 0x7d2e, 0x50ed, 0x53c3, 0x5879, 0x6158, 0x6159, 0x61fa, 0x65ac, 0x7ad9, 0x8b92, 0x8b96, 0x5009, 0x5021, 0x5275, 0x5531, 0x5a3c, 0x5ee0, 0x5f70, 0x6134, 0x655e, 0x660c, 0x6636, 0x66a2, 0x69cd, 0x6ec4, 0x6f32, 0x7316, 0x7621, 0x7a93, 0x8139, 0x8259, 0x83d6, 0x84bc, 0x50b5, 0x57f0, 0x5bc0, 0x5be8, 0x5f69, 0x63a1, 0x7826, 0x7db5, 0x83dc, 0x8521, 0x91c7, 0x91f5, 0x518a, 0x67f5, 0x7b56, /* 0x74 */ 0x8cac, 0x51c4, 0x59bb, 0x60bd, 0x8655, 0x501c, 0xf9ff, 0x5254, 0x5c3a, 0x617d, 0x621a, 0x62d3, 0x64f2, 0x65a5, 0x6ecc, 0x7620, 0x810a, 0x8e60, 0x965f, 0x96bb, 0x4edf, 0x5343, 0x5598, 0x5929, 0x5ddd, 0x64c5, 0x6cc9, 0x6dfa, 0x7394, 0x7a7f, 0x821b, 0x85a6, 0x8ce4, 0x8e10, 0x9077, 0x91e7, 0x95e1, 0x9621, 0x97c6, 0x51f8, 0x54f2, 0x5586, 0x5fb9, 0x64a4, 0x6f88, 0x7db4, 0x8f1f, 0x8f4d, 0x9435, 0x50c9, 0x5c16, 0x6cbe, 0x6dfb, 0x751b, 0x77bb, 0x7c3d, 0x7c64, 0x8a79, 0x8ac2, 0x581e, 0x59be, 0x5e16, 0x6377, 0x7252, 0x758a, 0x776b, 0x8adc, 0x8cbc, 0x8f12, 0x5ef3, 0x6674, 0x6df8, 0x807d, 0x83c1, 0x8acb, 0x9751, 0x9bd6, 0xfa00, 0x5243, 0x66ff, 0x6d95, 0x6eef, 0x7de0, 0x8ae6, 0x902e, 0x905e, 0x9ad4, 0x521d, 0x527f, 0x54e8, 0x6194, 0x6284, 0x62db, 0x68a2, /* 0x75 */ 0x6912, 0x695a, 0x6a35, 0x7092, 0x7126, 0x785d, 0x7901, 0x790e, 0x79d2, 0x7a0d, 0x8096, 0x8278, 0x82d5, 0x8349, 0x8549, 0x8c82, 0x8d85, 0x9162, 0x918b, 0x91ae, 0x4fc3, 0x56d1, 0x71ed, 0x77d7, 0x8700, 0x89f8, 0x5bf8, 0x5fd6, 0x6751, 0x90a8, 0x53e2, 0x585a, 0x5bf5, 0x60a4, 0x6181, 0x6460, 0x7e3d, 0x8070, 0x8525, 0x9283, 0x64ae, 0x50ac, 0x5d14, 0x6700, 0x589c, 0x62bd, 0x63a8, 0x690e, 0x6978, 0x6a1e, 0x6e6b, 0x76ba, 0x79cb, 0x82bb, 0x8429, 0x8acf, 0x8da8, 0x8ffd, 0x9112, 0x914b, 0x919c, 0x9310, 0x9318, 0x939a, 0x96db, 0x9a36, 0x9c0d, 0x4e11, 0x755c, 0x795d, 0x7afa, 0x7b51, 0x7bc9, 0x7e2e, 0x84c4, 0x8e59, 0x8e74, 0x8ef8, 0x9010, 0x6625, 0x693f, 0x7443, 0x51fa, 0x672e, 0x9edc, 0x5145, 0x5fe0, 0x6c96, 0x87f2, 0x885d, 0x8877, 0x60b4, 0x81b5, 0x8403, /* 0x76 */ 0x8d05, 0x53d6, 0x5439, 0x5634, 0x5a36, 0x5c31, 0x708a, 0x7fe0, 0x805a, 0x8106, 0x81ed, 0x8da3, 0x9189, 0x9a5f, 0x9df2, 0x5074, 0x4ec4, 0x53a0, 0x60fb, 0x6e2c, 0x5c64, 0x4f88, 0x5024, 0x55e4, 0x5cd9, 0x5e5f, 0x6065, 0x6894, 0x6cbb, 0x6dc4, 0x71be, 0x75d4, 0x75f4, 0x7661, 0x7a1a, 0x7a49, 0x7dc7, 0x7dfb, 0x7f6e, 0x81f4, 0x86a9, 0x8f1c, 0x96c9, 0x99b3, 0x9f52, 0x5247, 0x52c5, 0x98ed, 0x89aa, 0x4e03, 0x67d2, 0x6f06, 0x4fb5, 0x5be2, 0x6795, 0x6c88, 0x6d78, 0x741b, 0x7827, 0x91dd, 0x937c, 0x87c4, 0x79e4, 0x7a31, 0x5feb, 0x4ed6, 0x54a4, 0x553e, 0x58ae, 0x59a5, 0x60f0, 0x6253, 0x62d6, 0x6736, 0x6955, 0x8235, 0x9640, 0x99b1, 0x99dd, 0x502c, 0x5353, 0x5544, 0x577c, 0xfa01, 0x6258, 0xfa02, 0x64e2, 0x666b, 0x67dd, 0x6fc1, 0x6fef, 0x7422, 0x7438, 0x8a17, /* 0x77 */ 0x9438, 0x5451, 0x5606, 0x5766, 0x5f48, 0x619a, 0x6b4e, 0x7058, 0x70ad, 0x7dbb, 0x8a95, 0x596a, 0x812b, 0x63a2, 0x7708, 0x803d, 0x8caa, 0x5854, 0x642d, 0x69bb, 0x5b95, 0x5e11, 0x6e6f, 0xfa03, 0x8569, 0x514c, 0x53f0, 0x592a, 0x6020, 0x614b, 0x6b86, 0x6c70, 0x6cf0, 0x7b1e, 0x80ce, 0x82d4, 0x8dc6, 0x90b0, 0x98b1, 0xfa04, 0x64c7, 0x6fa4, 0x6491, 0x6504, 0x514e, 0x5410, 0x571f, 0x8a0e, 0x615f, 0x6876, 0xfa05, 0x75db, 0x7b52, 0x7d71, 0x901a, 0x5806, 0x69cc, 0x817f, 0x892a, 0x9000, 0x9839, 0x5078, 0x5957, 0x59ac, 0x6295, 0x900f, 0x9b2a, 0x615d, 0x7279, 0x95d6, 0x5761, 0x5a46, 0x5df4, 0x628a, 0x64ad, 0x64fa, 0x6777, 0x6ce2, 0x6d3e, 0x722c, 0x7436, 0x7834, 0x7f77, 0x82ad, 0x8ddb, 0x9817, 0x5224, 0x5742, 0x677f, 0x7248, 0x74e3, 0x8ca9, 0x8fa6, 0x9211, /* 0x78 */ 0x962a, 0x516b, 0x53ed, 0x634c, 0x4f69, 0x5504, 0x6096, 0x6557, 0x6c9b, 0x6d7f, 0x724c, 0x72fd, 0x7a17, 0x8987, 0x8c9d, 0x5f6d, 0x6f8e, 0x70f9, 0x81a8, 0x610e, 0x4fbf, 0x504f, 0x6241, 0x7247, 0x7bc7, 0x7de8, 0x7fe9, 0x904d, 0x97ad, 0x9a19, 0x8cb6, 0x576a, 0x5e73, 0x67b0, 0x840d, 0x8a55, 0x5420, 0x5b16, 0x5e63, 0x5ee2, 0x5f0a, 0x6583, 0x80ba, 0x853d, 0x9589, 0x965b, 0x4f48, 0x5305, 0x530d, 0x530f, 0x5486, 0x54fa, 0x5703, 0x5e03, 0x6016, 0x629b, 0x62b1, 0x6355, 0xfa06, 0x6ce1, 0x6d66, 0x75b1, 0x7832, 0x80de, 0x812f, 0x82de, 0x8461, 0x84b2, 0x888d, 0x8912, 0x900b, 0x92ea, 0x98fd, 0x9b91, 0x5e45, 0x66b4, 0x66dd, 0x7011, 0x7206, 0xfa07, 0x4ff5, 0x527d, 0x5f6a, 0x6153, 0x6753, 0x6a19, 0x6f02, 0x74e2, 0x7968, 0x8868, 0x8c79, 0x98c7, 0x98c4, 0x9a43, /* 0x79 */ 0x54c1, 0x7a1f, 0x6953, 0x8af7, 0x8c4a, 0x98a8, 0x99ae, 0x5f7c, 0x62ab, 0x75b2, 0x76ae, 0x88ab, 0x907f, 0x9642, 0x5339, 0x5f3c, 0x5fc5, 0x6ccc, 0x73cc, 0x7562, 0x758b, 0x7b46, 0x82fe, 0x999d, 0x4e4f, 0x903c, 0x4e0b, 0x4f55, 0x53a6, 0x590f, 0x5ec8, 0x6630, 0x6cb3, 0x7455, 0x8377, 0x8766, 0x8cc0, 0x9050, 0x971e, 0x9c15, 0x58d1, 0x5b78, 0x8650, 0x8b14, 0x9db4, 0x5bd2, 0x6068, 0x608d, 0x65f1, 0x6c57, 0x6f22, 0x6fa3, 0x701a, 0x7f55, 0x7ff0, 0x9591, 0x9592, 0x9650, 0x97d3, 0x5272, 0x8f44, 0x51fd, 0x542b, 0x54b8, 0x5563, 0x558a, 0x6abb, 0x6db5, 0x7dd8, 0x8266, 0x929c, 0x9677, 0x9e79, 0x5408, 0x54c8, 0x76d2, 0x86e4, 0x95a4, 0x95d4, 0x965c, 0x4ea2, 0x4f09, 0x59ee, 0x5ae6, 0x5df7, 0x6052, 0x6297, 0x676d, 0x6841, 0x6c86, 0x6e2f, 0x7f38, 0x809b, 0x822a, /* 0x7a */ 0xfa08, 0xfa09, 0x9805, 0x4ea5, 0x5055, 0x54b3, 0x5793, 0x595a, 0x5b69, 0x5bb3, 0x61c8, 0x6977, 0x6d77, 0x7023, 0x87f9, 0x89e3, 0x8a72, 0x8ae7, 0x9082, 0x99ed, 0x9ab8, 0x52be, 0x6838, 0x5016, 0x5e78, 0x674f, 0x8347, 0x884c, 0x4eab, 0x5411, 0x56ae, 0x73e6, 0x9115, 0x97ff, 0x9909, 0x9957, 0x9999, 0x5653, 0x589f, 0x865b, 0x8a31, 0x61b2, 0x6af6, 0x737b, 0x8ed2, 0x6b47, 0x96aa, 0x9a57, 0x5955, 0x7200, 0x8d6b, 0x9769, 0x4fd4, 0x5cf4, 0x5f26, 0x61f8, 0x665b, 0x6ceb, 0x70ab, 0x7384, 0x73b9, 0x73fe, 0x7729, 0x774d, 0x7d43, 0x7d62, 0x7e23, 0x8237, 0x8852, 0xfa0a, 0x8ce2, 0x9249, 0x986f, 0x5b51, 0x7a74, 0x8840, 0x9801, 0x5acc, 0x4fe0, 0x5354, 0x593e, 0x5cfd, 0x633e, 0x6d79, 0x72f9, 0x8105, 0x8107, 0x83a2, 0x92cf, 0x9830, 0x4ea8, 0x5144, 0x5211, 0x578b, /* 0x7b */ 0x5f62, 0x6cc2, 0x6ece, 0x7005, 0x7050, 0x70af, 0x7192, 0x73e9, 0x7469, 0x834a, 0x87a2, 0x8861, 0x9008, 0x90a2, 0x93a3, 0x99a8, 0x516e, 0x5f57, 0x60e0, 0x6167, 0x66b3, 0x8559, 0x8e4a, 0x91af, 0x978b, 0x4e4e, 0x4e92, 0x547c, 0x58d5, 0x58fa, 0x597d, 0x5cb5, 0x5f27, 0x6236, 0x6248, 0x660a, 0x6667, 0x6beb, 0x6d69, 0x6dcf, 0x6e56, 0x6ef8, 0x6f94, 0x6fe0, 0x6fe9, 0x705d, 0x72d0, 0x7425, 0x745a, 0x74e0, 0x7693, 0x795c, 0x7cca, 0x7e1e, 0x80e1, 0x82a6, 0x846b, 0x84bf, 0x864e, 0x865f, 0x8774, 0x8b77, 0x8c6a, 0x93ac, 0x9800, 0x9865, 0x60d1, 0x6216, 0x9177, 0x5a5a, 0x660f, 0x6df7, 0x6e3e, 0x743f, 0x9b42, 0x5ffd, 0x60da, 0x7b0f, 0x54c4, 0x5f18, 0x6c5e, 0x6cd3, 0x6d2a, 0x70d8, 0x7d05, 0x8679, 0x8a0c, 0x9d3b, 0x5316, 0x548c, 0x5b05, 0x6a3a, 0x706b, 0x7575, /* 0x7c */ 0x798d, 0x79be, 0x82b1, 0x83ef, 0x8a71, 0x8b41, 0x8ca8, 0x9774, 0xfa0b, 0x64f4, 0x652b, 0x78ba, 0x78bb, 0x7a6b, 0x4e38, 0x559a, 0x5950, 0x5ba6, 0x5e7b, 0x60a3, 0x63db, 0x6b61, 0x6665, 0x6853, 0x6e19, 0x7165, 0x74b0, 0x7d08, 0x9084, 0x9a69, 0x9c25, 0x6d3b, 0x6ed1, 0x733e, 0x8c41, 0x95ca, 0x51f0, 0x5e4c, 0x5fa8, 0x604d, 0x60f6, 0x6130, 0x614c, 0x6643, 0x6644, 0x69a5, 0x6cc1, 0x6e5f, 0x6ec9, 0x6f62, 0x714c, 0x749c, 0x7687, 0x7bc1, 0x7c27, 0x8352, 0x8757, 0x9051, 0x968d, 0x9ec3, 0x532f, 0x56de, 0x5efb, 0x5f8a, 0x6062, 0x6094, 0x61f7, 0x6666, 0x6703, 0x6a9c, 0x6dee, 0x6fae, 0x7070, 0x736a, 0x7e6a, 0x81be, 0x8334, 0x86d4, 0x8aa8, 0x8cc4, 0x5283, 0x7372, 0x5b96, 0x6a6b, 0x9404, 0x54ee, 0x5686, 0x5b5d, 0x6548, 0x6585, 0x66c9, 0x689f, 0x6d8d, 0x6dc6, /* 0x7d */ 0x723b, 0x80b4, 0x9175, 0x9a4d, 0x4faf, 0x5019, 0x539a, 0x540e, 0x543c, 0x5589, 0x55c5, 0x5e3f, 0x5f8c, 0x673d, 0x7166, 0x73dd, 0x9005, 0x52db, 0x52f3, 0x5864, 0x58ce, 0x7104, 0x718f, 0x71fb, 0x85b0, 0x8a13, 0x6688, 0x85a8, 0x55a7, 0x6684, 0x714a, 0x8431, 0x5349, 0x5599, 0x6bc1, 0x5f59, 0x5fbd, 0x63ee, 0x6689, 0x7147, 0x8af1, 0x8f1d, 0x9ebe, 0x4f11, 0x643a, 0x70cb, 0x7566, 0x8667, 0x6064, 0x8b4e, 0x9df8, 0x5147, 0x51f6, 0x5308, 0x6d36, 0x80f8, 0x9ed1, 0x6615, 0x6b23, 0x7098, 0x75d5, 0x5403, 0x5c79, 0x7d07, 0x8a16, 0x6b20, 0x6b3d, 0x6b46, 0x5438, 0x6070, 0x6d3d, 0x7fd5, 0x8208, 0x50d6, 0x51de, 0x559c, 0x566b, 0x56cd, 0x59ec, 0x5b09, 0x5e0c, 0x6199, 0x6198, 0x6231, 0x665e, 0x66e6, 0x7199, 0x71b9, 0x71ba, 0x72a7, 0x79a7, 0x7a00, 0x7fb2, 0x8a70, }; static int ksc5601_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c1 = (s[0] & 0x7F); if ((c1 >= 0x21 && c1 <= 0x2c) || (c1 >= 0x30 && c1 <= 0x48) || (c1 >= 0x4a && c1 <= 0x7d)) { if (n >= 2) { unsigned char c2 = (s[1] & 0x7F); if (c2 >= 0x21 && c2 < 0x7f) { unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); unsigned short wc = 0xfffd; if (i < 1410) { if (i < 1115) wc = ksc5601_2uni_page21[i]; } else if (i < 3854) { if (i < 3760) wc = ksc5601_2uni_page30[i-1410]; } else { if (i < 8742) wc = ksc5601_2uni_page4a[i-3854]; } if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 2; } } return RET_ILSEQ; } return RET_TOOFEW(0); } return RET_ILSEQ; } static const unsigned short ksc5601_2charset[8224] = { 0x222e, 0x2234, 0x2157, 0x2127, 0x2823, 0x2129, 0x2146, 0x213e, 0x2977, 0x2978, 0x2225, 0x2252, 0x2124, 0x222c, 0x2976, 0x282c, 0x2879, 0x2876, 0x287a, 0x222f, 0x2821, 0x2822, 0x213f, 0x282a, 0x282d, 0x292c, 0x2921, 0x2923, 0x2140, 0x292a, 0x292d, 0x2922, 0x2824, 0x2924, 0x2925, 0x2826, 0x2926, 0x2927, 0x2828, 0x2928, 0x2829, 0x2929, 0x2930, 0x282f, 0x292f, 0x282b, 0x292b, 0x282e, 0x292e, 0x2227, 0x2230, 0x2228, 0x222b, 0x222a, 0x222d, 0x2229, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, 0x254c, 0x254d, 0x254e, 0x254f, 0x2550, 0x2551, 0x2552, 0x2553, 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x256d, 0x256e, 0x256f, 0x2570, 0x2571, 0x2572, 0x2573, 0x2574, 0x2575, 0x2576, 0x2577, 0x2578, 0x2c27, 0x2c21, 0x2c22, 0x2c23, 0x2c24, 0x2c25, 0x2c26, 0x2c28, 0x2c29, 0x2c2a, 0x2c2b, 0x2c2c, 0x2c2d, 0x2c2e, 0x2c2f, 0x2c30, 0x2c31, 0x2c32, 0x2c33, 0x2c34, 0x2c35, 0x2c36, 0x2c37, 0x2c38, 0x2c39, 0x2c3a, 0x2c3b, 0x2c3c, 0x2c3d, 0x2c3e, 0x2c3f, 0x2c40, 0x2c41, 0x2c51, 0x2c52, 0x2c53, 0x2c54, 0x2c55, 0x2c56, 0x2c58, 0x2c59, 0x2c5a, 0x2c5b, 0x2c5c, 0x2c5d, 0x2c5e, 0x2c5f, 0x2c60, 0x2c61, 0x2c62, 0x2c63, 0x2c64, 0x2c65, 0x2c66, 0x2c67, 0x2c68, 0x2c69, 0x2c6a, 0x2c6b, 0x2c6c, 0x2c6d, 0x2c6e, 0x2c6f, 0x2c70, 0x2c71, 0x2c57, 0x212a, 0x212e, 0x212f, 0x2130, 0x2131, 0x2253, 0x2254, 0x2125, 0x2126, 0x2236, 0x2147, 0x2148, 0x2158, 0x2979, 0x297a, 0x297b, 0x297c, 0x297d, 0x297e, 0x2149, 0x2235, 0x2724, 0x2260, 0x2265, 0x2262, 0x2759, 0x214a, 0x2877, 0x2878, 0x287b, 0x287c, 0x287d, 0x287e, 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, 0x2535, 0x2536, 0x2537, 0x2538, 0x2539, 0x2521, 0x2522, 0x2523, 0x2524, 0x2525, 0x2526, 0x2527, 0x2528, 0x2529, 0x252a, 0x2167, 0x2168, 0x2166, 0x2169, 0x216a, 0x2255, 0x2258, 0x2256, 0x2259, 0x2257, 0x2221, 0x2222, 0x2223, 0x2153, 0x2224, 0x2154, 0x2174, 0x2175, 0x2233, 0x2232, 0x216e, 0x2170, 0x2144, 0x2150, 0x212b, 0x217c, 0x217d, 0x217b, 0x217a, 0x2172, 0x2173, 0x2231, 0x2145, 0x2171, 0x212d, 0x216f, 0x2156, 0x2141, 0x2155, 0x2142, 0x2143, 0x216c, 0x216d, 0x2178, 0x2179, 0x2176, 0x2177, 0x2241, 0x2151, 0x2152, 0x2867, 0x2868, 0x2869, 0x286a, 0x286b, 0x286c, 0x286d, 0x286e, 0x286f, 0x2870, 0x2871, 0x2872, 0x2873, 0x2874, 0x2875, 0x2967, 0x2968, 0x2969, 0x296a, 0x296b, 0x296c, 0x296d, 0x296e, 0x296f, 0x2970, 0x2971, 0x2972, 0x2973, 0x2974, 0x2975, 0x294d, 0x294e, 0x294f, 0x2950, 0x2951, 0x2952, 0x2953, 0x2954, 0x2955, 0x2956, 0x2957, 0x2958, 0x2959, 0x295a, 0x295b, 0x295c, 0x295d, 0x295e, 0x295f, 0x2960, 0x2961, 0x2962, 0x2963, 0x2964, 0x2965, 0x2966, 0x284d, 0x284e, 0x284f, 0x2850, 0x2851, 0x2852, 0x2853, 0x2854, 0x2855, 0x2856, 0x2857, 0x2858, 0x2859, 0x285a, 0x285b, 0x285c, 0x285d, 0x285e, 0x285f, 0x2860, 0x2861, 0x2862, 0x2863, 0x2864, 0x2865, 0x2866, 0x2621, 0x262c, 0x2622, 0x262d, 0x2623, 0x2648, 0x2647, 0x262e, 0x2624, 0x2642, 0x2641, 0x262f, 0x2626, 0x2646, 0x2645, 0x2631, 0x2625, 0x2644, 0x2643, 0x2630, 0x2627, 0x263c, 0x2649, 0x264a, 0x2637, 0x264b, 0x264c, 0x2632, 0x2629, 0x263e, 0x264d, 0x264e, 0x2639, 0x264f, 0x2650, 0x2634, 0x2628, 0x2651, 0x2652, 0x2638, 0x263d, 0x2653, 0x2654, 0x2633, 0x262a, 0x2655, 0x2656, 0x263a, 0x263f, 0x2657, 0x2658, 0x2635, 0x262b, 0x2659, 0x265a, 0x263b, 0x265b, 0x265c, 0x2640, 0x265d, 0x265e, 0x265f, 0x2660, 0x2661, 0x2662, 0x2663, 0x2664, 0x2636, 0x2246, 0x2161, 0x2160, 0x2243, 0x2247, 0x2248, 0x224b, 0x224a, 0x2249, 0x224c, 0x2163, 0x2162, 0x223a, 0x2239, 0x2165, 0x2164, 0x2238, 0x2237, 0x215f, 0x215e, 0x2242, 0x215b, 0x215d, 0x215c, 0x2244, 0x2245, 0x215a, 0x2159, 0x224f, 0x224e, 0x2250, 0x2251, 0x214f, 0x214e, 0x223c, 0x223d, 0x2240, 0x223b, 0x223e, 0x223f, 0x224d, 0x225b, 0x225c, 0x225d, 0x225a, 0x2121, 0x2122, 0x2123, 0x2128, 0x2134, 0x2135, 0x2136, 0x2137, 0x2138, 0x2139, 0x213a, 0x213b, 0x213c, 0x213d, 0x216b, 0x2132, 0x2133, 0x2a21, 0x2a22, 0x2a23, 0x2a24, 0x2a25, 0x2a26, 0x2a27, 0x2a28, 0x2a29, 0x2a2a, 0x2a2b, 0x2a2c, 0x2a2d, 0x2a2e, 0x2a2f, 0x2a30, 0x2a31, 0x2a32, 0x2a33, 0x2a34, 0x2a35, 0x2a36, 0x2a37, 0x2a38, 0x2a39, 0x2a3a, 0x2a3b, 0x2a3c, 0x2a3d, 0x2a3e, 0x2a3f, 0x2a40, 0x2a41, 0x2a42, 0x2a43, 0x2a44, 0x2a45, 0x2a46, 0x2a47, 0x2a48, 0x2a49, 0x2a4a, 0x2a4b, 0x2a4c, 0x2a4d, 0x2a4e, 0x2a4f, 0x2a50, 0x2a51, 0x2a52, 0x2a53, 0x2a54, 0x2a55, 0x2a56, 0x2a57, 0x2a58, 0x2a59, 0x2a5a, 0x2a5b, 0x2a5c, 0x2a5d, 0x2a5e, 0x2a5f, 0x2a60, 0x2a61, 0x2a62, 0x2a63, 0x2a64, 0x2a65, 0x2a66, 0x2a67, 0x2a68, 0x2a69, 0x2a6a, 0x2a6b, 0x2a6c, 0x2a6d, 0x2a6e, 0x2a6f, 0x2a70, 0x2a71, 0x2a72, 0x2a73, 0x2b21, 0x2b22, 0x2b23, 0x2b24, 0x2b25, 0x2b26, 0x2b27, 0x2b28, 0x2b29, 0x2b2a, 0x2b2b, 0x2b2c, 0x2b2d, 0x2b2e, 0x2b2f, 0x2b30, 0x2b31, 0x2b32, 0x2b33, 0x2b34, 0x2b35, 0x2b36, 0x2b37, 0x2b38, 0x2b39, 0x2b3a, 0x2b3b, 0x2b3c, 0x2b3d, 0x2b3e, 0x2b3f, 0x2b40, 0x2b41, 0x2b42, 0x2b43, 0x2b44, 0x2b45, 0x2b46, 0x2b47, 0x2b48, 0x2b49, 0x2b4a, 0x2b4b, 0x2b4c, 0x2b4d, 0x2b4e, 0x2b4f, 0x2b50, 0x2b51, 0x2b52, 0x2b53, 0x2b54, 0x2b55, 0x2b56, 0x2b57, 0x2b58, 0x2b59, 0x2b5a, 0x2b5b, 0x2b5c, 0x2b5d, 0x2b5e, 0x2b5f, 0x2b60, 0x2b61, 0x2b62, 0x2b63, 0x2b64, 0x2b65, 0x2b66, 0x2b67, 0x2b68, 0x2b69, 0x2b6a, 0x2b6b, 0x2b6c, 0x2b6d, 0x2b6e, 0x2b6f, 0x2b70, 0x2b71, 0x2b72, 0x2b73, 0x2b74, 0x2b75, 0x2b76, 0x2421, 0x2422, 0x2423, 0x2424, 0x2425, 0x2426, 0x2427, 0x2428, 0x2429, 0x242a, 0x242b, 0x242c, 0x242d, 0x242e, 0x242f, 0x2430, 0x2431, 0x2432, 0x2433, 0x2434, 0x2435, 0x2436, 0x2437, 0x2438, 0x2439, 0x243a, 0x243b, 0x243c, 0x243d, 0x243e, 0x243f, 0x2440, 0x2441, 0x2442, 0x2443, 0x2444, 0x2445, 0x2446, 0x2447, 0x2448, 0x2449, 0x244a, 0x244b, 0x244c, 0x244d, 0x244e, 0x244f, 0x2450, 0x2451, 0x2452, 0x2453, 0x2454, 0x2455, 0x2456, 0x2457, 0x2458, 0x2459, 0x245a, 0x245b, 0x245c, 0x245d, 0x245e, 0x245f, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, 0x2472, 0x2473, 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, 0x247b, 0x247c, 0x247d, 0x247e, 0x2931, 0x2932, 0x2933, 0x2934, 0x2935, 0x2936, 0x2937, 0x2938, 0x2939, 0x293a, 0x293b, 0x293c, 0x293d, 0x293e, 0x293f, 0x2940, 0x2941, 0x2942, 0x2943, 0x2944, 0x2945, 0x2946, 0x2947, 0x2948, 0x2949, 0x294a, 0x294b, 0x294c, 0x225f, 0x2831, 0x2832, 0x2833, 0x2834, 0x2835, 0x2836, 0x2837, 0x2838, 0x2839, 0x283a, 0x283b, 0x283c, 0x283d, 0x283e, 0x283f, 0x2840, 0x2841, 0x2842, 0x2843, 0x2844, 0x2845, 0x2846, 0x2847, 0x2848, 0x2849, 0x284a, 0x284b, 0x284c, 0x225e, 0x2749, 0x274a, 0x274b, 0x274c, 0x274d, 0x273a, 0x273b, 0x275c, 0x275d, 0x275e, 0x2736, 0x2737, 0x2738, 0x2754, 0x2755, 0x2756, 0x2757, 0x2758, 0x2721, 0x2722, 0x2723, 0x2725, 0x272b, 0x272c, 0x272d, 0x272e, 0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2727, 0x2728, 0x2729, 0x272a, 0x273d, 0x273e, 0x2765, 0x2766, 0x2767, 0x2768, 0x2761, 0x2762, 0x2763, 0x273f, 0x2740, 0x2741, 0x2742, 0x2743, 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x274e, 0x274f, 0x2750, 0x2751, 0x2752, 0x2753, 0x275a, 0x275b, 0x2263, 0x276c, 0x2726, 0x2760, 0x276f, 0x2261, 0x273c, 0x276d, 0x2735, 0x2739, 0x276a, 0x276b, 0x275f, 0x2264, 0x2764, 0x276e, 0x2769, 0x6c69, 0x6f4b, 0x7652, 0x5832, 0x6d5b, 0x5f32, 0x5f3e, 0x793b, 0x5c74, 0x7564, 0x7326, 0x5d60, 0x6126, 0x4e78, 0x5c30, 0x632a, 0x7169, 0x4d7a, 0x7c2f, 0x5321, 0x712b, 0x6751, 0x522c, 0x4e79, 0x717d, 0x5e3f, 0x7b3a, 0x7939, 0x4e52, 0x632b, 0x6b60, 0x4e7a, 0x4b77, 0x6525, 0x4a61, 0x544c, 0x6a61, 0x5c63, 0x5f2d, 0x4b6b, 0x552f, 0x5675, 0x6578, 0x5e40, 0x6c23, 0x694d, 0x6a27, 0x6976, 0x7b3b, 0x6769, 0x6f4c, 0x5066, 0x5e41, 0x642c, 0x584c, 0x7971, 0x4e5f, 0x7a24, 0x6632, 0x7a7b, 0x7a3d, 0x4c48, 0x6f4d, 0x5555, 0x5322, 0x6c51, 0x6427, 0x6c52, 0x7631, 0x4e7b, 0x5051, 0x4b3f, 0x6d24, 0x6d28, 0x5e42, 0x7662, 0x6d5c, 0x5c75, 0x6039, 0x544e, 0x7435, 0x535b, 0x5635, 0x6c24, 0x6466, 0x716a, 0x4b6c, 0x4b40, 0x6c72, 0x506a, 0x7972, 0x6c25, 0x505f, 0x676a, 0x506b, 0x5c51, 0x5b69, 0x7d4c, 0x5b57, 0x5a61, 0x5636, 0x635f, 0x5e43, 0x5e44, 0x4a21, 0x6e6c, 0x5323, 0x6e37, 0x784f, 0x6a48, 0x6e38, 0x712c, 0x7125, 0x694e, 0x793c, 0x6579, 0x6c6a, 0x5d56, 0x6d42, 0x7825, 0x653a, 0x5b58, 0x4a22, 0x514d, 0x6e6d, 0x6c6b, 0x5e45, 0x6360, 0x4a49, 0x7269, 0x554e, 0x7636, 0x4e42, 0x5647, 0x6334, 0x712d, 0x6a62, 0x5742, 0x7327, 0x4d6a, 0x6b6e, 0x5932, 0x7d25, 0x7655, 0x5562, 0x7835, 0x4c75, 0x7535, 0x642d, 0x676b, 0x7155, 0x703b, 0x6935, 0x4c49, 0x7a55, 0x6154, 0x5756, 0x5c41, 0x5e46, 0x7a6f, 0x6361, 0x6173, 0x5c76, 0x4e7c, 0x5b44, 0x7871, 0x5c64, 0x656f, 0x5c31, 0x5556, 0x735a, 0x4b41, 0x5b43, 0x597a, 0x536e, 0x7a38, 0x7d26, 0x6b6f, 0x7426, 0x4c4a, 0x7328, 0x735b, 0x5b27, 0x7637, 0x4f66, 0x7072, 0x4b5a, 0x6752, 0x5743, 0x7670, 0x685e, 0x6526, 0x6567, 0x4a23, 0x4c27, 0x6a49, 0x7836, 0x7a25, 0x712e, 0x6f4e, 0x4b6d, 0x7630, 0x6f4f, 0x694f, 0x775e, 0x4e53, 0x5c77, 0x5b28, 0x4b78, 0x5f21, 0x5d61, 0x754a, 0x6936, 0x676c, 0x6e6e, 0x7370, 0x5f3f, 0x4c4b, 0x5041, 0x7452, 0x603a, 0x5f40, 0x4e60, 0x5c52, 0x7d6a, 0x5676, 0x6a4a, 0x6869, 0x632c, 0x7350, 0x4a24, 0x5b78, 0x5e47, 0x6b70, 0x7156, 0x6562, 0x4c4c, 0x4b7b, 0x6a63, 0x5f41, 0x566d, 0x6950, 0x6e39, 0x5563, 0x5153, 0x6570, 0x6834, 0x6b43, 0x6a2a, 0x7a7c, 0x7576, 0x703c, 0x7d54, 0x603b, 0x4e43, 0x503a, 0x773a, 0x5873, 0x774d, 0x642e, 0x545f, 0x5067, 0x6c7d, 0x522e, 0x6e6f, 0x5557, 0x6a64, 0x7822, 0x4d6b, 0x573f, 0x7b31, 0x4d6c, 0x5c32, 0x506c, 0x4e7d, 0x6e70, 0x4c42, 0x506d, 0x6577, 0x737c, 0x6e22, 0x5933, 0x5874, 0x6937, 0x4e2e, 0x5922, 0x5871, 0x544f, 0x6527, 0x5552, 0x5629, 0x7422, 0x7157, 0x5558, 0x703d, 0x5750, 0x5450, 0x574f, 0x6b6a, 0x7d6b, 0x5b6d, 0x7c45, 0x4b42, 0x7d55, 0x7448, 0x686a, 0x7573, 0x795e, 0x536f, 0x6c53, 0x5d42, 0x6f37, 0x6754, 0x4a4a, 0x597b, 0x7a7d, 0x562a, 0x7478, 0x7777, 0x5c2c, 0x5757, 0x5f22, 0x4e3e, 0x5370, 0x7024, 0x616c, 0x4f67, 0x734b, 0x6d29, 0x4a3e, 0x746f, 0x764e, 0x5e7b, 0x503b, 0x5537, 0x6e71, 0x7428, 0x5c78, 0x4b27, 0x5a4e, 0x6066, 0x6d25, 0x6e72, 0x5c79, 0x795c, 0x735c, 0x7872, 0x7479, 0x7c71, 0x503c, 0x5b79, 0x5731, 0x4b7c, 0x7025, 0x4b7d, 0x5574, 0x4d6d, 0x4a25, 0x562b, 0x5042, 0x703e, 0x523d, 0x4c24, 0x7a36, 0x4c4d, 0x5a7a, 0x764f, 0x6938, 0x5875, 0x4c4e, 0x574d, 0x5451, 0x696d, 0x4a6b, 0x5962, 0x7d32, 0x632d, 0x564c, 0x5934, 0x6127, 0x6e53, 0x5043, 0x7d33, 0x5564, 0x4f68, 0x6d43, 0x5032, 0x4e7e, 0x5a28, 0x7850, 0x7d56, 0x7851, 0x7852, 0x5c53, 0x5d62, 0x7b79, 0x5d41, 0x6335, 0x6d5d, 0x4e44, 0x4b21, 0x5d63, 0x7c5d, 0x792f, 0x527b, 0x4f21, 0x6428, 0x7436, 0x6c7e, 0x632e, 0x676d, 0x7d41, 0x5a62, 0x5833, 0x5d64, 0x706f, 0x7671, 0x7a70, 0x5175, 0x5a4f, 0x5c54, 0x5c26, 0x6f3f, 0x4e4f, 0x6059, 0x5956, 0x6c54, 0x6a4b, 0x4a3f, 0x5530, 0x4f69, 0x716d, 0x4c4f, 0x6478, 0x646d, 0x5758, 0x7d27, 0x6a2b, 0x7632, 0x4f70, 0x793d, 0x6674, 0x4b5b, 0x7351, 0x6951, 0x7329, 0x5060, 0x6952, 0x5a63, 0x6252, 0x7622, 0x6174, 0x5a64, 0x6755, 0x753f, 0x4f22, 0x4d2f, 0x4f23, 0x4d30, 0x717e, 0x5023, 0x612f, 0x7823, 0x4a26, 0x773b, 0x726a, 0x5e48, 0x6953, 0x5e49, 0x7d5e, 0x4a40, 0x796a, 0x514e, 0x6e54, 0x5452, 0x5923, 0x7d28, 0x5759, 0x774e, 0x7a3e, 0x4f56, 0x5770, 0x6b61, 0x7845, 0x5c7a, 0x5d43, 0x795f, 0x676f, 0x7d65, 0x7623, 0x597c, 0x7d29, 0x676e, 0x5565, 0x6f50, 0x4d31, 0x7722, 0x7132, 0x7131, 0x4d32, 0x5a2b, 0x4a27, 0x6362, 0x7b3c, 0x5924, 0x6e3a, 0x7853, 0x7b7a, 0x4f24, 0x5c7b, 0x7663, 0x6d2a, 0x7221, 0x4e61, 0x7a26, 0x7960, 0x6c56, 0x646e, 0x7921, 0x7b6f, 0x796b, 0x6e23, 0x6a2c, 0x4a28, 0x747a, 0x4d56, 0x7c76, 0x7449, 0x7854, 0x7826, 0x5e4a, 0x7246, 0x575a, 0x5350, 0x5845, 0x6a66, 0x735d, 0x645a, 0x7664, 0x7672, 0x5f42, 0x597d, 0x4c76, 0x533a, 0x642f, 0x7961, 0x7026, 0x4b53, 0x603c, 0x744a, 0x547a, 0x7d2a, 0x7962, 0x7437, 0x7d42, 0x7c30, 0x7d6c, 0x4a62, 0x7d3d, 0x6a67, 0x5f43, 0x5152, 0x4e62, 0x5324, 0x7d2b, 0x5f60, 0x7247, 0x6770, 0x506e, 0x732a, 0x5e4b, 0x7638, 0x6175, 0x7133, 0x7723, 0x4a29, 0x4f25, 0x5f44, 0x6130, 0x703f, 0x7624, 0x6336, 0x7a46, 0x506f, 0x7d6d, 0x5d44, 0x7c77, 0x663f, 0x5e2d, 0x7a3f, 0x6571, 0x6d44, 0x5225, 0x7d6e, 0x7536, 0x6176, 0x5e4c, 0x7c5e, 0x6c57, 0x4d5d, 0x5637, 0x4d33, 0x7855, 0x6558, 0x4f6a, 0x4f50, 0x6a4c, 0x6a2e, 0x6a2d, 0x5371, 0x5325, 0x774f, 0x6e24, 0x5024, 0x7222, 0x5070, 0x7223, 0x7778, 0x5033, 0x5b29, 0x533b, 0x4a6c, 0x7126, 0x4b55, 0x7767, 0x4d5e, 0x7724, 0x7840, 0x535d, 0x4c50, 0x4f26, 0x7673, 0x6177, 0x535c, 0x7a7e, 0x7a27, 0x6b59, 0x4f27, 0x6a2f, 0x646f, 0x6939, 0x7158, 0x5858, 0x6072, 0x6634, 0x5c7c, 0x7371, 0x6350, 0x727b, 0x5b46, 0x5071, 0x5072, 0x4f5c, 0x5351, 0x4c31, 0x7758, 0x4b28, 0x6b3c, 0x643e, 0x745c, 0x5c42, 0x7027, 0x6640, 0x4a6d, 0x686b, 0x6568, 0x5c43, 0x6d5e, 0x5372, 0x4c77, 0x4e54, 0x672b, 0x4b43, 0x6131, 0x7732, 0x5373, 0x5352, 0x7540, 0x5f5d, 0x6e73, 0x6771, 0x7d34, 0x7248, 0x7352, 0x6e74, 0x6253, 0x4c51, 0x5f6a, 0x693a, 0x5957, 0x754d, 0x7172, 0x7a47, 0x5978, 0x5442, 0x7665, 0x5d45, 0x6772, 0x6d5f, 0x4a4b, 0x5b7a, 0x6835, 0x5326, 0x7d35, 0x7949, 0x6462, 0x7b3d, 0x5724, 0x4e45, 0x4e55, 0x5666, 0x653d, 0x5e4d, 0x6c73, 0x6d60, 0x6c6c, 0x7b3e, 0x5f6b, 0x6178, 0x793e, 0x5073, 0x602a, 0x6862, 0x6254, 0x527d, 0x6528, 0x5953, 0x535e, 0x7438, 0x773c, 0x5c7d, 0x686c, 0x6467, 0x6377, 0x6c28, 0x7a71, 0x6572, 0x5074, 0x522f, 0x5c65, 0x5025, 0x7134, 0x7c31, 0x4c78, 0x5d46, 0x7a51, 0x775f, 0x7a28, 0x6e75, 0x5e4e, 0x6773, 0x772c, 0x6b44, 0x6d61, 0x602b, 0x5d47, 0x5233, 0x523f, 0x4a4c, 0x7b3f, 0x657d, 0x5d65, 0x584d, 0x6c74, 0x5075, 0x686d, 0x5052, 0x5958, 0x7666, 0x5b2a, 0x7760, 0x5859, 0x7423, 0x745d, 0x6f51, 0x5935, 0x6d2b, 0x6337, 0x6e3b, 0x4d34, 0x6073, 0x6a4d, 0x6c75, 0x686e, 0x4b29, 0x712f, 0x4a4d, 0x6c29, 0x726b, 0x7d6f, 0x7973, 0x6641, 0x6c58, 0x6d2c, 0x6a4e, 0x685f, 0x5e4f, 0x5226, 0x6774, 0x5156, 0x6642, 0x6363, 0x6430, 0x5834, 0x7625, 0x735e, 0x5725, 0x7768, 0x6846, 0x7b66, 0x5d66, 0x5c7e, 0x585a, 0x5a2c, 0x6a30, 0x6338, 0x4a2a, 0x6179, 0x6a31, 0x726c, 0x7a6e, 0x6e55, 0x7974, 0x526c, 0x7b7b, 0x7d70, 0x603d, 0x4e63, 0x7846, 0x5e2e, 0x5f45, 0x653e, 0x6d2d, 0x7a6a, 0x4d6e, 0x6d26, 0x6d2e, 0x706d, 0x5d21, 0x6d2f, 0x7c78, 0x586b, 0x4c79, 0x4d35, 0x7a29, 0x615d, 0x6255, 0x6d4f, 0x5d22, 0x794a, 0x6a68, 0x656d, 0x536b, 0x6954, 0x617a, 0x644c, 0x6164, 0x6847, 0x4e5b, 0x5c55, 0x7735, 0x7c73, 0x7073, 0x4e2f, 0x7135, 0x6f52, 0x6848, 0x6b71, 0x4b54, 0x603e, 0x6378, 0x6a69, 0x7c32, 0x6074, 0x4f60, 0x6e25, 0x7a2a, 0x6643, 0x6132, 0x4a2b, 0x6364, 0x693b, 0x6256, 0x7372, 0x6e56, 0x6a32, 0x5076, 0x6c59, 0x5a4b, 0x4f28, 0x5d23, 0x585b, 0x794e, 0x6955, 0x6351, 0x523c, 0x582c, 0x734c, 0x4d7b, 0x7656, 0x6775, 0x686f, 0x6379, 0x523b, 0x7373, 0x637b, 0x5e50, 0x4e30, 0x5677, 0x7159, 0x7541, 0x5c44, 0x753b, 0x5e51, 0x5c66, 0x5e52, 0x6d62, 0x6e76, 0x6a4f, 0x706e, 0x637c, 0x535f, 0x5374, 0x6133, 0x6134, 0x7453, 0x5f46, 0x6956, 0x5b2b, 0x7626, 0x6339, 0x6b45, 0x7429, 0x4d36, 0x5279, 0x5a2d, 0x5263, 0x4f51, 0x4b5c, 0x4c7a, 0x4f5d, 0x6829, 0x633b, 0x633a, 0x605a, 0x6e77, 0x5c33, 0x5375, 0x5726, 0x7635, 0x575b, 0x6155, 0x546a, 0x5f23, 0x7d5f, 0x5077, 0x6d54, 0x4b2a, 0x645b, 0x617b, 0x4b22, 0x5360, 0x643f, 0x7b40, 0x5a3e, 0x644d, 0x5639, 0x6f40, 0x617c, 0x7639, 0x5f47, 0x6431, 0x5c67, 0x5c68, 0x7a56, 0x5376, 0x715a, 0x7a72, 0x627d, 0x554f, 0x5078, 0x4d5f, 0x754b, 0x6470, 0x4b2b, 0x5744, 0x627e, 0x5d5a, 0x5a2e, 0x4a6e, 0x5539, 0x6321, 0x6863, 0x732b, 0x4f29, 0x5377, 0x5471, 0x4e64, 0x6872, 0x6575, 0x672e, 0x563a, 0x5f6c, 0x6440, 0x6864, 0x5835, 0x645c, 0x7439, 0x7136, 0x625e, 0x6135, 0x4d6f, 0x7127, 0x4e65, 0x4b5d, 0x5963, 0x732c, 0x5079, 0x6c2b, 0x5e53, 0x7769, 0x7975, 0x615e, 0x4b6e, 0x633c, 0x7856, 0x5b6e, 0x7d71, 0x7736, 0x745e, 0x726d, 0x5b59, 0x7028, 0x617d, 0x5e54, 0x602c, 0x6d63, 0x5361, 0x5f48, 0x5936, 0x7d2c, 0x6f53, 0x6441, 0x786b, 0x5b2c, 0x7c46, 0x582d, 0x763a, 0x5b5f, 0x5353, 0x7847, 0x4a4e, 0x7841, 0x5234, 0x5c34, 0x7a39, 0x4a4f, 0x7c33, 0x6a6a, 0x6a6b, 0x507a, 0x6d64, 0x5d67, 0x5f49, 0x5f6d, 0x6e3c, 0x6f41, 0x4c52, 0x5d24, 0x5f4a, 0x5378, 0x7128, 0x4d37, 0x6f54, 0x645d, 0x5f6e, 0x4b2c, 0x693c, 0x6a6c, 0x5f4b, 0x793f, 0x562f, 0x5546, 0x4f2a, 0x4e29, 0x5678, 0x7137, 0x6e78, 0x5959, 0x735f, 0x7848, 0x4e46, 0x5566, 0x7466, 0x6645, 0x6f55, 0x4b6f, 0x7c5f, 0x5c27, 0x5667, 0x7849, 0x6352, 0x633d, 0x4f61, 0x7040, 0x6c5a, 0x5d57, 0x7b70, 0x6c2c, 0x7029, 0x7a57, 0x7b41, 0x5240, 0x6530, 0x6d65, 0x4b2d, 0x7930, 0x7725, 0x4b2e, 0x5a2f, 0x5836, 0x5327, 0x7b32, 0x7d44, 0x6c2d, 0x7b21, 0x6569, 0x696e, 0x7374, 0x7873, 0x7041, 0x5e2f, 0x7830, 0x7360, 0x672f, 0x5b2d, 0x6635, 0x7928, 0x5d58, 0x6859, 0x6f56, 0x5362, 0x625f, 0x7c60, 0x5748, 0x7d2d, 0x5f6f, 0x4c53, 0x5379, 0x5470, 0x5b47, 0x5e55, 0x7074, 0x5550, 0x6559, 0x7c47, 0x5c56, 0x6260, 0x5a30, 0x7323, 0x536c, 0x744b, 0x7d45, 0x637d, 0x7931, 0x507b, 0x6c5b, 0x753c, 0x7224, 0x584e, 0x584f, 0x7577, 0x7661, 0x5237, 0x7b6c, 0x5d48, 0x6468, 0x5241, 0x7857, 0x563b, 0x5e56, 0x773d, 0x6c2e, 0x5061, 0x6075, 0x6a33, 0x4e56, 0x4c25, 0x6c76, 0x6261, 0x633e, 0x7c48, 0x4d70, 0x7976, 0x5f70, 0x653f, 0x4e3f, 0x7c61, 0x6d30, 0x7d51, 0x763b, 0x794f, 0x6b5a, 0x4a41, 0x5238, 0x4d71, 0x6353, 0x7d66, 0x666d, 0x637a, 0x702a, 0x7950, 0x7c62, 0x7827, 0x6165, 0x6e79, 0x6776, 0x6a6d, 0x7c34, 0x7542, 0x575c, 0x7075, 0x5d68, 0x536d, 0x757c, 0x5a3f, 0x4c7b, 0x537a, 0x7424, 0x6f57, 0x5443, 0x7b63, 0x7b6d, 0x602d, 0x6a6e, 0x7b33, 0x6442, 0x7667, 0x525d, 0x5f4c, 0x7c49, 0x6529, 0x6076, 0x7633, 0x617e, 0x4b70, 0x6a6f, 0x6a70, 0x5a40, 0x7834, 0x6b72, 0x6443, 0x6957, 0x6471, 0x4a6f, 0x4e57, 0x7c4a, 0x7361, 0x4b44, 0x6365, 0x4b45, 0x6a34, 0x693d, 0x5749, 0x6b5b, 0x6d31, 0x4c43, 0x773e, 0x7c4b, 0x7874, 0x5937, 0x7353, 0x7354, 0x7764, 0x7751, 0x5837, 0x4e31, 0x4a42, 0x7b34, 0x4b46, 0x7076, 0x5567, 0x6a50, 0x4c54, 0x4b2f, 0x742a, 0x692f, 0x7543, 0x6958, 0x5d69, 0x7173, 0x557b, 0x5e3b, 0x747b, 0x7d73, 0x7d72, 0x7726, 0x5d49, 0x5453, 0x4c28, 0x5a41, 0x4c55, 0x5964, 0x7a4a, 0x6563, 0x533c, 0x4a70, 0x5044, 0x4a50, 0x7a2b, 0x6b6b, 0x6778, 0x5965, 0x5157, 0x7324, 0x547b, 0x7c63, 0x7a58, 0x7355, 0x4f2b, 0x6b73, 0x557c, 0x5354, 0x4d7c, 0x5966, 0x6279, 0x6221, 0x6b54, 0x6077, 0x6432, 0x4c7c, 0x7b64, 0x742b, 0x503d, 0x4a71, 0x6f38, 0x5740, 0x6e7a, 0x7d74, 0x5363, 0x7b42, 0x5568, 0x5b2e, 0x6136, 0x7837, 0x603f, 0x7b43, 0x5d6a, 0x6222, 0x6e26, 0x7668, 0x7675, 0x5d4a, 0x5062, 0x5d26, 0x5d6b, 0x6479, 0x632f, 0x507c, 0x747c, 0x4c3c, 0x776a, 0x6564, 0x5f71, 0x7761, 0x7977, 0x6f39, 0x7858, 0x7929, 0x7859, 0x6e3d, 0x5846, 0x6463, 0x754e, 0x5d59, 0x5967, 0x5239, 0x5543, 0x5a65, 0x5a50, 0x5159, 0x4e58, 0x4b5e, 0x742c, 0x5a7b, 0x7669, 0x6873, 0x4f2c, 0x7070, 0x747d, 0x5b48, 0x4e40, 0x6354, 0x514f, 0x7175, 0x4d72, 0x4f6b, 0x4d38, 0x6326, 0x515a, 0x7225, 0x7226, 0x644e, 0x537b, 0x7129, 0x7249, 0x6f58, 0x6649, 0x5838, 0x7a73, 0x7335, 0x7824, 0x5173, 0x6648, 0x785a, 0x5c69, 0x5e57, 0x4b5f, 0x4f6c, 0x745f, 0x5174, 0x523a, 0x5f72, 0x6137, 0x6223, 0x537c, 0x6d66, 0x5b49, 0x647a, 0x4f5e, 0x4e50, 0x5553, 0x7375, 0x772e, 0x6f48, 0x4d73, 0x754f, 0x6573, 0x7042, 0x4a51, 0x6a71, 0x5026, 0x595a, 0x702b, 0x6b67, 0x6540, 0x7c35, 0x6444, 0x4c29, 0x7d46, 0x6a35, 0x652a, 0x5f3a, 0x615f, 0x5a51, 0x6138, 0x6874, 0x537d, 0x6224, 0x724a, 0x5a66, 0x7733, 0x7d4d, 0x7336, 0x6e57, 0x7544, 0x5824, 0x7227, 0x5938, 0x5939, 0x6f49, 0x564e, 0x774b, 0x5f2e, 0x6875, 0x5235, 0x5355, 0x744c, 0x5a7c, 0x5968, 0x776b, 0x7549, 0x733c, 0x5a52, 0x5335, 0x6836, 0x564f, 0x743a, 0x7749, 0x4c2a, 0x7043, 0x4c56, 0x5053, 0x533d, 0x5b7b, 0x4b60, 0x5364, 0x7677, 0x553a, 0x734d, 0x4b61, 0x6b74, 0x742d, 0x7c2a, 0x776c, 0x6876, 0x5a67, 0x774c, 0x6541, 0x606e, 0x557d, 0x4e66, 0x7c2b, 0x553b, 0x7228, 0x6225, 0x4d39, 0x6a72, 0x4b47, 0x4d74, 0x5b2f, 0x6f59, 0x4d3a, 0x7c79, 0x5f73, 0x4e67, 0x5a42, 0x4f2d, 0x6779, 0x7828, 0x7362, 0x4a72, 0x5f24, 0x5444, 0x4c57, 0x6542, 0x4d3b, 0x6f5a, 0x6e58, 0x5d27, 0x6226, 0x6040, 0x5630, 0x784a, 0x7c7a, 0x597e, 0x5e30, 0x5d6c, 0x5a68, 0x5460, 0x5679, 0x4d57, 0x5e58, 0x7278, 0x6456, 0x5045, 0x742e, 0x5d28, 0x6d45, 0x7356, 0x5e59, 0x6366, 0x5328, 0x5b30, 0x655a, 0x633f, 0x5b31, 0x5569, 0x6041, 0x6f5b, 0x7069, 0x5732, 0x507d, 0x5969, 0x507e, 0x6c6d, 0x5329, 0x7229, 0x7044, 0x6262, 0x696f, 0x7951, 0x6959, 0x685a, 0x5a43, 0x5a44, 0x5445, 0x677a, 0x4d60, 0x6330, 0x5b32, 0x7b44, 0x7363, 0x5925, 0x7b67, 0x5d4b, 0x5054, 0x6636, 0x602e, 0x7d5a, 0x5c35, 0x6078, 0x6731, 0x7570, 0x585c, 0x6d46, 0x6139, 0x6340, 0x7940, 0x6970, 0x595b, 0x7364, 0x5c36, 0x6469, 0x7045, 0x6341, 0x7c4c, 0x7c4d, 0x724b, 0x724c, 0x644f, 0x715b, 0x7a59, 0x7138, 0x7d75, 0x6079, 0x677b, 0x7c37, 0x7c64, 0x7b45, 0x6367, 0x5839, 0x7678, 0x5c45, 0x4c58, 0x602f, 0x7467, 0x6f5c, 0x4f7c, 0x6f5d, 0x722a, 0x7d3e, 0x4a2c, 0x7d3b, 0x7d47, 0x6732, 0x6a51, 0x5f74, 0x516c, 0x645e, 0x6543, 0x5926, 0x4d3c, 0x7365, 0x6d55, 0x593a, 0x6d67, 0x7b35, 0x786c, 0x6067, 0x4c59, 0x5446, 0x6725, 0x5575, 0x533e, 0x7c7b, 0x6472, 0x5f75, 0x6878, 0x786d, 0x4e47, 0x7d76, 0x6858, 0x4d58, 0x6756, 0x4c5a, 0x4a63, 0x5f76, 0x7047, 0x7046, 0x583a, 0x7174, 0x7470, 0x754c, 0x7c65, 0x6a45, 0x6a73, 0x5d5b, 0x5c57, 0x5e7d, 0x7279, 0x5547, 0x5850, 0x7048, 0x5121, 0x5122, 0x5954, 0x5668, 0x594a, 0x5a31, 0x5847, 0x5c62, 0x734e, 0x7574, 0x7139, 0x5a53, 0x766a, 0x4f75, 0x7d2e, 0x4a52, 0x5f34, 0x575d, 0x7a3a, 0x6e27, 0x753d, 0x7875, 0x6d68, 0x5461, 0x5123, 0x6156, 0x7978, 0x5b4a, 0x4b79, 0x5454, 0x595c, 0x6e3e, 0x776d, 0x526e, 0x6166, 0x7779, 0x5d6d, 0x685b, 0x5b33, 0x5177, 0x6030, 0x5462, 0x7657, 0x5779, 0x585d, 0x4d7d, 0x722b, 0x4d3d, 0x7842, 0x722c, 0x4a2d, 0x4a2e, 0x4f2e, 0x6342, 0x5c37, 0x5b5a, 0x593b, 0x4a73, 0x7653, 0x6678, 0x6a75, 0x6a76, 0x7679, 0x4f2f, 0x4a53, 0x4a2f, 0x5230, 0x713a, 0x5733, 0x6343, 0x737d, 0x5e5a, 0x5e5b, 0x6f5e, 0x6263, 0x6e7b, 0x5f77, 0x574a, 0x4e68, 0x5b5b, 0x713b, 0x6971, 0x7a37, 0x5046, 0x4c2b, 0x6e28, 0x4b7a, 0x7979, 0x4c7d, 0x537e, 0x6450, 0x726e, 0x5455, 0x5f4d, 0x7c38, 0x5150, 0x724d, 0x7752, 0x4a54, 0x5559, 0x585e, 0x4d59, 0x6e29, 0x763c, 0x4c5b, 0x7049, 0x7c7c, 0x6849, 0x747e, 0x677c, 0x575e, 0x5e5c, 0x702c, 0x4c7e, 0x4d61, 0x613a, 0x5b6f, 0x5a32, 0x5125, 0x5c38, 0x5876, 0x5124, 0x4d62, 0x5c6a, 0x7077, 0x704a, 0x503e, 0x5d5c, 0x5456, 0x5356, 0x6d50, 0x4d21, 0x5f35, 0x5f78, 0x5421, 0x4e32, 0x684a, 0x6b75, 0x6355, 0x7550, 0x7521, 0x5927, 0x652b, 0x664b, 0x7571, 0x6545, 0x7923, 0x605b, 0x766b, 0x4b71, 0x596a, 0x7522, 0x5751, 0x5178, 0x6a78, 0x6a79, 0x5a33, 0x6f5f, 0x716f, 0x6576, 0x6e3f, 0x6264, 0x503f, 0x7a2c, 0x7551, 0x6733, 0x693e, 0x724e, 0x5b34, 0x7c4e, 0x5d6e, 0x6734, 0x5734, 0x7734, 0x4d3e, 0x5a69, 0x4f30, 0x7759, 0x7366, 0x4e59, 0x4e2a, 0x4b48, 0x5027, 0x704b, 0x5047, 0x6445, 0x5b60, 0x555a, 0x5727, 0x6e40, 0x7876, 0x7552, 0x6d69, 0x593c, 0x6546, 0x7523, 0x5a54, 0x6227, 0x7b7c, 0x715c, 0x4a74, 0x687a, 0x4e69, 0x6978, 0x6265, 0x5039, 0x5472, 0x5126, 0x5f4e, 0x7c74, 0x532a, 0x4c2c, 0x6f60, 0x6565, 0x5055, 0x5b7c, 0x7c66, 0x4b7e, 0x6d6a, 0x5e31, 0x7963, 0x5422, 0x4f76, 0x5650, 0x556a, 0x716e, 0x7a4b, 0x6521, 0x5531, 0x4f6d, 0x6d6b, 0x5532, 0x553c, 0x7d62, 0x732d, 0x7d5b, 0x6930, 0x5127, 0x7d63, 0x4e33, 0x7d64, 0x7a4e, 0x4a30, 0x7727, 0x4f31, 0x6622, 0x7c36, 0x722d, 0x6f61, 0x732e, 0x5c46, 0x596b, 0x6860, 0x6128, 0x5576, 0x4f7d, 0x5e5d, 0x5951, 0x646a, 0x724f, 0x773f, 0x6266, 0x6228, 0x6356, 0x6d51, 0x6979, 0x5631, 0x5e32, 0x6068, 0x532b, 0x6b5c, 0x5f2f, 0x4a43, 0x6e7c, 0x7d43, 0x6b76, 0x4f32, 0x596c, 0x593d, 0x585f, 0x5438, 0x6b3e, 0x5d6f, 0x5d70, 0x5d71, 0x5d72, 0x593e, 0x7b46, 0x4f33, 0x6e7d, 0x642b, 0x5a45, 0x586c, 0x5128, 0x6229, 0x5e3c, 0x6735, 0x5b70, 0x6f62, 0x7170, 0x4f34, 0x5b71, 0x6031, 0x5f25, 0x7952, 0x677d, 0x6623, 0x7b71, 0x4b30, 0x722e, 0x4d67, 0x685c, 0x6757, 0x7740, 0x5063, 0x5a21, 0x4c3d, 0x5129, 0x5d4c, 0x637e, 0x512a, 0x682a, 0x6a36, 0x797a, 0x664c, 0x7658, 0x5447, 0x594b, 0x5952, 0x534b, 0x5877, 0x5a29, 0x7578, 0x5e5e, 0x722f, 0x7829, 0x5848, 0x6e41, 0x7941, 0x5d73, 0x6a7a, 0x763d, 0x613b, 0x4d3f, 0x7454, 0x664d, 0x7c4f, 0x7b22, 0x605c, 0x743b, 0x5a55, 0x7932, 0x7b72, 0x5b76, 0x5e5f, 0x5b72, 0x785c, 0x776e, 0x6b68, 0x527a, 0x713c, 0x7a5a, 0x5a6a, 0x5a46, 0x7741, 0x6736, 0x6547, 0x562c, 0x5c47, 0x6129, 0x622a, 0x5526, 0x5457, 0x7250, 0x6a7b, 0x605d, 0x7b73, 0x713d, 0x6267, 0x7d57, 0x4e48, 0x6a37, 0x7c40, 0x7d67, 0x776f, 0x5735, 0x6f3a, 0x715d, 0x5e33, 0x684b, 0x785d, 0x7b47, 0x5548, 0x575f, 0x5d29, 0x6931, 0x7a2d, 0x7659, 0x7a74, 0x782a, 0x666e, 0x4c5c, 0x613c, 0x606f, 0x693f, 0x7c7d, 0x664e, 0x6157, 0x664f, 0x7471, 0x6473, 0x647b, 0x7964, 0x6f63, 0x4f6e, 0x763e, 0x6032, 0x7c7e, 0x512b, 0x577a, 0x7b48, 0x6257, 0x5423, 0x7078, 0x5728, 0x6167, 0x533f, 0x6f64, 0x5745, 0x6b62, 0x7c67, 0x6422, 0x6268, 0x6650, 0x7b68, 0x7468, 0x6574, 0x743c, 0x7455, 0x5f36, 0x7c39, 0x6e42, 0x4a75, 0x6f65, 0x4b62, 0x5424, 0x5e60, 0x5a7d, 0x6446, 0x683e, 0x605e, 0x7634, 0x6a52, 0x797b, 0x6042, 0x4a64, 0x6737, 0x6a7d, 0x595d, 0x5a34, 0x6e2a, 0x7b69, 0x5b4b, 0x5a35, 0x713e, 0x532c, 0x7b49, 0x5f4f, 0x5340, 0x6357, 0x6f66, 0x7c50, 0x6940, 0x7553, 0x6c5c, 0x7737, 0x6a38, 0x5179, 0x5c48, 0x6a39, 0x715e, 0x5736, 0x4f35, 0x5928, 0x6c6e, 0x5d2a, 0x4d22, 0x682e, 0x613d, 0x7251, 0x6941, 0x527c, 0x5b35, 0x7367, 0x587e, 0x7c51, 0x6d32, 0x742f, 0x7b23, 0x7c41, 0x6e2b, 0x5425, 0x7472, 0x6e59, 0x7b4a, 0x4d63, 0x583b, 0x655b, 0x7877, 0x7654, 0x5729, 0x4b49, 0x6651, 0x704c, 0x582e, 0x7953, 0x557e, 0x583c, 0x7230, 0x622b, 0x7368, 0x6f42, 0x6d6c, 0x6738, 0x5a7e, 0x4c3e, 0x727c, 0x5a6b, 0x6258, 0x6d56, 0x5651, 0x6033, 0x7c52, 0x6b48, 0x5341, 0x704d, 0x4f77, 0x6d52, 0x5458, 0x5c49, 0x5771, 0x5f3b, 0x7325, 0x744d, 0x713f, 0x7831, 0x697a, 0x7b4b, 0x4a55, 0x7954, 0x774a, 0x5648, 0x7c68, 0x733d, 0x6e7e, 0x677e, 0x5342, 0x5336, 0x4c2d, 0x767a, 0x5632, 0x5258, 0x6758, 0x6325, 0x6739, 0x702d, 0x7b4c, 0x6b21, 0x5426, 0x7b4d, 0x553d, 0x715f, 0x767b, 0x5e34, 0x556b, 0x6548, 0x7b24, 0x5439, 0x5e61, 0x6423, 0x5737, 0x786e, 0x5e35, 0x5652, 0x7955, 0x673a, 0x6b55, 0x5577, 0x6f67, 0x613e, 0x7a2e, 0x5669, 0x566e, 0x673b, 0x6c4b, 0x5533, 0x4e34, 0x7b25, 0x616e, 0x7728, 0x7b4e, 0x583d, 0x7b7d, 0x7c69, 0x4f36, 0x6d47, 0x6e2c, 0x4c5d, 0x7627, 0x667a, 0x7524, 0x7d5c, 0x6d33, 0x4e49, 0x6f68, 0x613f, 0x7a5b, 0x4b63, 0x7729, 0x7b26, 0x5c39, 0x7140, 0x6d48, 0x6f43, 0x562d, 0x7d4e, 0x6821, 0x7b74, 0x5527, 0x7176, 0x6653, 0x4c5e, 0x7832, 0x5c6b, 0x7d36, 0x656a, 0x7160, 0x5b4c, 0x5d4d, 0x5448, 0x596d, 0x7525, 0x667b, 0x6654, 0x7d48, 0x5621, 0x7d3f, 0x7c53, 0x6f21, 0x673c, 0x516e, 0x6655, 0x6972, 0x5f30, 0x5860, 0x7c3a, 0x7d2f, 0x704e, 0x5b61, 0x6549, 0x6d34, 0x6043, 0x6358, 0x697b, 0x6a28, 0x7d37, 0x7b27, 0x6942, 0x7d77, 0x6259, 0x5c6c, 0x6822, 0x6670, 0x7d78, 0x7d79, 0x763f, 0x6727, 0x6657, 0x5473, 0x5449, 0x567a, 0x5772, 0x6140, 0x5b62, 0x6658, 0x673d, 0x704f, 0x733e, 0x622c, 0x7537, 0x6070, 0x7d38, 0x6368, 0x5427, 0x687c, 0x7a52, 0x786f, 0x5653, 0x5534, 0x7050, 0x7770, 0x6e33, 0x6a3a, 0x6a53, 0x6d49, 0x5d2b, 0x652c, 0x7d21, 0x5f50, 0x6c33, 0x5f51, 0x6d6d, 0x7838, 0x777a, 0x782b, 0x7460, 0x543a, 0x6433, 0x695a, 0x5e36, 0x593f, 0x5940, 0x566f, 0x594c, 0x5a2a, 0x5f65, 0x7765, 0x4c32, 0x5f79, 0x5760, 0x543b, 0x7d7a, 0x4c33, 0x5b73, 0x5f52, 0x4e4a, 0x6e5a, 0x6464, 0x7b4f, 0x4f37, 0x6e43, 0x4e6a, 0x622d, 0x5761, 0x7a75, 0x5549, 0x782c, 0x6759, 0x7369, 0x586d, 0x6344, 0x7071, 0x6865, 0x607a, 0x6e44, 0x595e, 0x6b22, 0x6b23, 0x7c42, 0x6a3b, 0x682b, 0x5e62, 0x6d6f, 0x6823, 0x4f71, 0x543c, 0x7c6a, 0x673e, 0x7c72, 0x5634, 0x622e, 0x5337, 0x7a4c, 0x7a5c, 0x6d35, 0x6163, 0x682c, 0x685d, 0x6f69, 0x743d, 0x4f38, 0x695b, 0x512c, 0x5a47, 0x6b49, 0x684c, 0x5e37, 0x563c, 0x5365, 0x7a5d, 0x5a56, 0x4a31, 0x5a48, 0x5f26, 0x7933, 0x7252, 0x4a44, 0x4e4b, 0x4d75, 0x7d30, 0x5528, 0x7141, 0x6269, 0x5c4a, 0x6c34, 0x7a40, 0x7b28, 0x5028, 0x5a6c, 0x596e, 0x607b, 0x6f6a, 0x7a5e, 0x6044, 0x4f39, 0x554a, 0x5762, 0x622f, 0x5738, 0x684d, 0x765a, 0x6f22, 0x625a, 0x767c, 0x7b50, 0x512d, 0x4d64, 0x512e, 0x5c6d, 0x684e, 0x7079, 0x4e35, 0x667c, 0x577b, 0x5056, 0x5d75, 0x7771, 0x767d, 0x5b77, 0x7b6a, 0x695c, 0x5941, 0x7572, 0x6045, 0x6a54, 0x7942, 0x6a3c, 0x5245, 0x7b51, 0x6740, 0x6b25, 0x5f7a, 0x6322, 0x5739, 0x6943, 0x687d, 0x682f, 0x7253, 0x7b29, 0x5825, 0x554b, 0x5048, 0x512f, 0x5763, 0x6046, 0x5622, 0x6d70, 0x5773, 0x7c54, 0x5a57, 0x4c5f, 0x7254, 0x5130, 0x4c60, 0x5b7d, 0x733f, 0x7051, 0x7c3b, 0x6230, 0x6625, 0x625b, 0x5f5e, 0x6047, 0x726f, 0x4c61, 0x566a, 0x6742, 0x4e36, 0x7340, 0x4d7e, 0x7b52, 0x7878, 0x777b, 0x683f, 0x6837, 0x6d36, 0x5c3a, 0x4c34, 0x7177, 0x6838, 0x4a76, 0x6424, 0x7456, 0x5f66, 0x5f27, 0x5f67, 0x6141, 0x6944, 0x5c4b, 0x6945, 0x6f23, 0x6b26, 0x4b23, 0x6369, 0x517b, 0x6f24, 0x6f6b, 0x5034, 0x4d23, 0x6866, 0x6f25, 0x534c, 0x5a6d, 0x573a, 0x7255, 0x7565, 0x596f, 0x7934, 0x5554, 0x7d4f, 0x5b63, 0x7161, 0x6c36, 0x7b7e, 0x5357, 0x5131, 0x4b31, 0x5132, 0x4b32, 0x7142, 0x7461, 0x7935, 0x6143, 0x6142, 0x6b77, 0x5f28, 0x4b4a, 0x6639, 0x785e, 0x792a, 0x4a77, 0x6d37, 0x5338, 0x7256, 0x5459, 0x6e45, 0x7270, 0x4a32, 0x5c3b, 0x7178, 0x6c37, 0x654a, 0x7640, 0x7d5d, 0x5463, 0x4c62, 0x7754, 0x5765, 0x5343, 0x5826, 0x7641, 0x5d76, 0x4d40, 0x655c, 0x654b, 0x6144, 0x6830, 0x7430, 0x736a, 0x5a6e, 0x573b, 0x6231, 0x572a, 0x567b, 0x645f, 0x4a56, 0x6b28, 0x5b7e, 0x7642, 0x6f3b, 0x547d, 0x6048, 0x6839, 0x6f26, 0x4d24, 0x5474, 0x5b21, 0x5b5c, 0x5b5d, 0x6e5c, 0x4b4b, 0x7c55, 0x4e6b, 0x4d41, 0x7b53, 0x792b, 0x7554, 0x5929, 0x695d, 0x5b4d, 0x5d4e, 0x6743, 0x6c4c, 0x796c, 0x4b4c, 0x607c, 0x5428, 0x6d53, 0x586f, 0x7257, 0x4a78, 0x5a6f, 0x5654, 0x594d, 0x586e, 0x7241, 0x5f53, 0x5a70, 0x626a, 0x607d, 0x5878, 0x772f, 0x5a36, 0x4a57, 0x7258, 0x5879, 0x7a5f, 0x4f6f, 0x5942, 0x7052, 0x6451, 0x7337, 0x7a60, 0x6f6c, 0x6232, 0x543d, 0x594e, 0x7462, 0x5429, 0x4d42, 0x675a, 0x7259, 0x592a, 0x583e, 0x5c2d, 0x626b, 0x567c, 0x4a79, 0x545a, 0x7457, 0x4c21, 0x4f3a, 0x7538, 0x5943, 0x5068, 0x6345, 0x6b78, 0x7231, 0x4f3b, 0x532d, 0x6861, 0x4e6c, 0x6034, 0x5e63, 0x5d77, 0x7232, 0x7376, 0x765b, 0x577e, 0x785f, 0x7772, 0x5029, 0x665a, 0x7526, 0x573c, 0x4c63, 0x665b, 0x5d5d, 0x5133, 0x6f6d, 0x565e, 0x6474, 0x616f, 0x5d78, 0x684f, 0x4a65, 0x5c21, 0x6035, 0x7c2c, 0x7c2d, 0x5827, 0x6d38, 0x5b36, 0x5670, 0x732f, 0x4d25, 0x5a71, 0x5828, 0x4c64, 0x5134, 0x4a58, 0x5a72, 0x7527, 0x7528, 0x6626, 0x556c, 0x5578, 0x5a73, 0x6346, 0x5e64, 0x5e65, 0x5135, 0x5136, 0x5137, 0x7233, 0x695e, 0x7053, 0x7234, 0x7054, 0x4b64, 0x7b54, 0x7566, 0x636a, 0x5e66, 0x5f54, 0x7879, 0x702e, 0x5138, 0x565f, 0x5057, 0x7c21, 0x6f6e, 0x5c58, 0x695f, 0x655d, 0x7d7b, 0x6049, 0x5649, 0x542a, 0x654c, 0x6960, 0x5058, 0x7c22, 0x543e, 0x6233, 0x5e67, 0x5c3c, 0x5236, 0x7555, 0x4e21, 0x7529, 0x5d79, 0x5d7a, 0x7055, 0x765f, 0x725a, 0x646b, 0x7271, 0x6c39, 0x7d7c, 0x612a, 0x4a59, 0x6f6f, 0x752a, 0x6c79, 0x782d, 0x7242, 0x7643, 0x5752, 0x7922, 0x7056, 0x707a, 0x7660, 0x6973, 0x7243, 0x542b, 0x4a33, 0x4d26, 0x4d43, 0x4d5a, 0x594f, 0x7644, 0x6e5d, 0x6744, 0x6234, 0x5f62, 0x675b, 0x6831, 0x7c2e, 0x654d, 0x7a6b, 0x4f3c, 0x4f62, 0x4d76, 0x6f70, 0x743e, 0x544d, 0x7338, 0x6921, 0x7272, 0x736b, 0x7057, 0x4f57, 0x4f5f, 0x6840, 0x6841, 0x4f63, 0x6922, 0x502a, 0x7341, 0x502b, 0x5464, 0x6f3c, 0x5821, 0x595f, 0x7357, 0x5c3d, 0x4c65, 0x6d71, 0x7162, 0x545b, 0x6235, 0x4a66, 0x532e, 0x4c66, 0x7153, 0x7567, 0x4a5a, 0x7b6e, 0x6145, 0x5f69, 0x6e5e, 0x7742, 0x5822, 0x5d2c, 0x702f, 0x563d, 0x612b, 0x7936, 0x5475, 0x5049, 0x6f27, 0x626c, 0x5b6a, 0x4e4c, 0x7568, 0x7755, 0x534d, 0x737e, 0x5035, 0x607e, 0x5f7b, 0x665d, 0x6824, 0x4b4d, 0x6f28, 0x6e34, 0x5a58, 0x5139, 0x5f29, 0x7330, 0x4c44, 0x4e37, 0x6f29, 0x5f55, 0x6d57, 0x6e46, 0x6f3d, 0x7c56, 0x5b74, 0x6f2a, 0x7839, 0x7569, 0x6359, 0x6146, 0x543f, 0x5e68, 0x706a, 0x7342, 0x532f, 0x4a5b, 0x7c57, 0x6d58, 0x6147, 0x7458, 0x5633, 0x5d2d, 0x553e, 0x7143, 0x6e5f, 0x566b, 0x7459, 0x5766, 0x5a37, 0x5d7b, 0x5d4f, 0x5823, 0x5a59, 0x7058, 0x6f44, 0x6158, 0x7154, 0x6d72, 0x555b, 0x555c, 0x7344, 0x4b57, 0x6236, 0x6f71, 0x7b55, 0x5358, 0x5d50, 0x7059, 0x4b33, 0x555d, 0x4d27, 0x502c, 0x513a, 0x7144, 0x6533, 0x7b75, 0x6961, 0x7d60, 0x7c3c, 0x5a22, 0x5a23, 0x5221, 0x526f, 0x626d, 0x5e69, 0x4e5c, 0x7235, 0x5064, 0x5d51, 0x6148, 0x5b37, 0x5f63, 0x6d39, 0x7145, 0x734f, 0x572b, 0x612c, 0x636b, 0x6e47, 0x6149, 0x4a7a, 0x707b, 0x7a61, 0x705a, 0x4c67, 0x5a74, 0x4c3f, 0x4e6d, 0x5529, 0x7a62, 0x5065, 0x6b56, 0x6c5f, 0x5f7c, 0x7756, 0x5e6a, 0x4b34, 0x6f3e, 0x4c35, 0x4f3d, 0x6f72, 0x6237, 0x4c68, 0x707c, 0x5660, 0x7146, 0x6238, 0x6b2b, 0x4b35, 0x5851, 0x744e, 0x7377, 0x5746, 0x513b, 0x772a, 0x6d4a, 0x5753, 0x587a, 0x7645, 0x514c, 0x5d7c, 0x5f7d, 0x7965, 0x604a, 0x727d, 0x5330, 0x7473, 0x5a49, 0x665e, 0x783a, 0x6850, 0x587b, 0x6a55, 0x5623, 0x7646, 0x725b, 0x647c, 0x6832, 0x5a5a, 0x725c, 0x7b56, 0x6932, 0x6e2d, 0x7a63, 0x5c6e, 0x756a, 0x6660, 0x707d, 0x572c, 0x7545, 0x6e60, 0x5b65, 0x5d5e, 0x5970, 0x6923, 0x7179, 0x7244, 0x604b, 0x6924, 0x6239, 0x6331, 0x7c6b, 0x4d28, 0x4c36, 0x705b, 0x663a, 0x4d29, 0x7343, 0x6159, 0x6f2b, 0x6745, 0x6069, 0x7345, 0x5440, 0x553f, 0x5d2e, 0x797c, 0x4c40, 0x6522, 0x4e38, 0x5852, 0x7956, 0x712a, 0x4e51, 0x7647, 0x5b6b, 0x5f7e, 0x5861, 0x7773, 0x5767, 0x547e, 0x513c, 0x654f, 0x4b36, 0x5a38, 0x4d44, 0x563e, 0x623a, 0x4f58, 0x604c, 0x6b79, 0x7d7d, 0x5768, 0x4b58, 0x6962, 0x683a, 0x6347, 0x6c4d, 0x6c4e, 0x563f, 0x6327, 0x5f56, 0x7d68, 0x6e61, 0x7628, 0x5d7d, 0x783b, 0x6851, 0x7957, 0x4e6e, 0x6c4f, 0x6925, 0x5655, 0x4d45, 0x6d3a, 0x513d, 0x4f3e, 0x6c3b, 0x5231, 0x4c69, 0x5944, 0x697c, 0x513e, 0x6c3c, 0x652d, 0x7730, 0x4c6a, 0x5344, 0x5640, 0x567d, 0x6121, 0x5e3d, 0x7629, 0x5a24, 0x5624, 0x7546, 0x6122, 0x6946, 0x7245, 0x7469, 0x566c, 0x6b53, 0x6c3d, 0x625c, 0x5e6b, 0x705c, 0x6b3f, 0x574e, 0x513f, 0x752b, 0x797d, 0x4a5c, 0x4d46, 0x7236, 0x5d7e, 0x4c37, 0x5b38, 0x5069, 0x4e5d, 0x6b40, 0x7d22, 0x784b, 0x6a56, 0x7130, 0x5b4e, 0x7743, 0x5b4f, 0x4b24, 0x7860, 0x7b57, 0x6b4a, 0x6021, 0x4e4d, 0x545c, 0x7d58, 0x5276, 0x7237, 0x7a76, 0x762a, 0x7a77, 0x5866, 0x7431, 0x6852, 0x4a45, 0x4c6b, 0x626e, 0x623b, 0x772d, 0x7861, 0x736c, 0x5e21, 0x647d, 0x636c, 0x5d2f, 0x5d30, 0x4b37, 0x6853, 0x6123, 0x5260, 0x707e, 0x6926, 0x4b72, 0x6d73, 0x5c59, 0x604d, 0x775a, 0x5b39, 0x4c2e, 0x5a5b, 0x4d47, 0x5d31, 0x582f, 0x6323, 0x4e6f, 0x7273, 0x7833, 0x604e, 0x757d, 0x6b6c, 0x5345, 0x7c6c, 0x525b, 0x546b, 0x5e22, 0x6566, 0x7030, 0x5544, 0x6d74, 0x636d, 0x6842, 0x6d75, 0x577c, 0x6d3b, 0x762b, 0x7238, 0x7648, 0x5366, 0x725d, 0x4f3f, 0x6b2c, 0x4f40, 0x6628, 0x7d69, 0x4f41, 0x605f, 0x5e6c, 0x6022, 0x743f, 0x626f, 0x5971, 0x7147, 0x4b38, 0x797e, 0x5b3a, 0x5a75, 0x766c, 0x5a5c, 0x7a64, 0x604f, 0x5d32, 0x6629, 0x6f73, 0x736d, 0x6b7a, 0x7966, 0x4a5d, 0x555e, 0x4a5e, 0x5f64, 0x667d, 0x752c, 0x6475, 0x6963, 0x6d4b, 0x4f64, 0x5853, 0x5d33, 0x546c, 0x7239, 0x5f37, 0x4b4e, 0x7b58, 0x5059, 0x5d52, 0x7774, 0x675c, 0x6425, 0x7c23, 0x5b3b, 0x723a, 0x697d, 0x504a, 0x7556, 0x5945, 0x6434, 0x6d27, 0x6a3d, 0x667e, 0x7744, 0x752d, 0x5960, 0x4a34, 0x7862, 0x4f42, 0x6c3e, 0x6534, 0x4d48, 0x6e48, 0x6748, 0x4d49, 0x7937, 0x7168, 0x5972, 0x5b75, 0x4a35, 0x5946, 0x5849, 0x592b, 0x6d3c, 0x5854, 0x5c5a, 0x623c, 0x7c6d, 0x6c60, 0x527e, 0x6947, 0x662a, 0x6270, 0x7a3b, 0x752e, 0x7b2a, 0x6c7b, 0x6c3f, 0x7c58, 0x5465, 0x7943, 0x6e62, 0x5769, 0x6d76, 0x5e6d, 0x4c6c, 0x636e, 0x6854, 0x7a78, 0x5d34, 0x6435, 0x5830, 0x5855, 0x746a, 0x4e39, 0x5661, 0x4f52, 0x5036, 0x4e22, 0x736e, 0x7378, 0x5c4c, 0x504b, 0x7c24, 0x4d4a, 0x5754, 0x5e23, 0x6460, 0x6e49, 0x625d, 0x757e, 0x542c, 0x5551, 0x5870, 0x7843, 0x6a57, 0x7557, 0x583f, 0x7d40, 0x6b2d, 0x552a, 0x6728, 0x6e4a, 0x4a67, 0x7863, 0x545d, 0x6a58, 0x7b59, 0x6d77, 0x6535, 0x502d, 0x7171, 0x623d, 0x6348, 0x5955, 0x5f2a, 0x5b3c, 0x7864, 0x717a, 0x6536, 0x736f, 0x7b5a, 0x6160, 0x592c, 0x756b, 0x6036, 0x6948, 0x4b4f, 0x6349, 0x5e6e, 0x623e, 0x5c6f, 0x5625, 0x6271, 0x567e, 0x5921, 0x5840, 0x5c5b, 0x6d3d, 0x5f38, 0x6a25, 0x572d, 0x7379, 0x6d78, 0x7547, 0x614a, 0x6b63, 0x725e, 0x784c, 0x6a59, 0x5346, 0x5b66, 0x752f, 0x4e70, 0x697e, 0x7b36, 0x6272, 0x4f72, 0x7739, 0x5973, 0x614b, 0x5a5d, 0x5a39, 0x6b7b, 0x4b39, 0x6d79, 0x6060, 0x7440, 0x7d3c, 0x5f31, 0x636f, 0x6023, 0x7d39, 0x7031, 0x4d4b, 0x6d3e, 0x5540, 0x6370, 0x6d7a, 0x6964, 0x556d, 0x675d, 0x5476, 0x6537, 0x5b67, 0x623f, 0x6e4b, 0x5774, 0x705d, 0x4e2b, 0x675e, 0x5656, 0x614c, 0x6833, 0x656e, 0x5c22, 0x6050, 0x5535, 0x5521, 0x7b5b, 0x794b, 0x4b73, 0x7425, 0x7a48, 0x5657, 0x6965, 0x7b5c, 0x7d50, 0x7b76, 0x5a25, 0x5b3d, 0x6c62, 0x4d77, 0x705e, 0x7649, 0x5e6f, 0x5331, 0x7c6e, 0x6843, 0x7148, 0x4e71, 0x796d, 0x7274, 0x6436, 0x7539, 0x5c70, 0x6371, 0x6825, 0x723b, 0x5e24, 0x5a4c, 0x4a69, 0x635a, 0x7c59, 0x6a5a, 0x7944, 0x6324, 0x7b5d, 0x6f4a, 0x6844, 0x554c, 0x6b57, 0x592d, 0x7b2b, 0x5359, 0x5522, 0x765e, 0x5a76, 0x6051, 0x6928, 0x7579, 0x7a2f, 0x6b7c, 0x606a, 0x6332, 0x5545, 0x7163, 0x556e, 0x4d4c, 0x6d59, 0x5841, 0x7a6c, 0x716b, 0x7a3c, 0x6662, 0x7a65, 0x627a, 0x4a36, 0x6437, 0x6a5b, 0x757a, 0x7b2c, 0x4f43, 0x6b7d, 0x787a, 0x5f39, 0x6171, 0x5224, 0x757b, 0x505a, 0x505b, 0x6a3e, 0x5931, 0x4a37, 0x5367, 0x7865, 0x5332, 0x6240, 0x725f, 0x4d65, 0x792c, 0x4d4d, 0x6e2e, 0x562e, 0x576a, 0x6760, 0x6b2e, 0x4f59, 0x5c4d, 0x6d7b, 0x5e70, 0x576b, 0x5e25, 0x5f57, 0x5b50, 0x5b51, 0x5523, 0x7032, 0x5c5c, 0x4a68, 0x7866, 0x5c4e, 0x6a5c, 0x5b52, 0x6933, 0x775b, 0x6328, 0x572e, 0x6061, 0x4b3a, 0x6551, 0x505c, 0x5541, 0x584a, 0x6329, 0x6024, 0x6929, 0x5347, 0x5c5d, 0x782e, 0x4c38, 0x502e, 0x5872, 0x634a, 0x4c2f, 0x542d, 0x7651, 0x504c, 0x4a46, 0x5542, 0x4e3a, 0x4a47, 0x7a30, 0x5f58, 0x753a, 0x656b, 0x6f74, 0x5d35, 0x4d2a, 0x6372, 0x7b77, 0x7750, 0x7d3a, 0x7d61, 0x767e, 0x5140, 0x6845, 0x6438, 0x6168, 0x4c41, 0x526d, 0x5b3e, 0x6062, 0x7a49, 0x614d, 0x4a38, 0x7260, 0x7149, 0x5e71, 0x705f, 0x7844, 0x6e4c, 0x5e72, 0x6749, 0x6273, 0x6761, 0x634b, 0x634c, 0x4f78, 0x6f2c, 0x7d7e, 0x7c25, 0x7a31, 0x5f59, 0x6052, 0x745a, 0x714a, 0x4e23, 0x723c, 0x6c63, 0x6025, 0x772b, 0x6b2f, 0x655e, 0x6124, 0x4d2b, 0x5974, 0x6826, 0x4d4e, 0x6169, 0x7c6f, 0x6063, 0x6241, 0x4e24, 0x5e26, 0x6b7e, 0x6b5d, 0x7060, 0x745b, 0x6274, 0x5348, 0x746b, 0x6e35, 0x7558, 0x555f, 0x5665, 0x6b30, 0x7463, 0x634d, 0x7474, 0x7a32, 0x6f75, 0x4a5f, 0x6b31, 0x6d3f, 0x7d49, 0x6426, 0x7924, 0x7033, 0x656c, 0x5167, 0x5947, 0x6457, 0x6a5d, 0x5477, 0x5a3a, 0x5a4d, 0x794c, 0x615a, 0x5b3f, 0x4c45, 0x6c50, 0x4b3b, 0x5e73, 0x692a, 0x5948, 0x6e63, 0x573d, 0x4f44, 0x504d, 0x7c26, 0x717b, 0x7d52, 0x5141, 0x635b, 0x5349, 0x5c4f, 0x4c6d, 0x5e27, 0x663b, 0x6c21, 0x4c39, 0x7b5e, 0x6762, 0x5441, 0x5c28, 0x6242, 0x7358, 0x6553, 0x7359, 0x7346, 0x4d5b, 0x4d2c, 0x7c43, 0x5467, 0x5142, 0x7925, 0x6855, 0x634e, 0x544a, 0x5f5a, 0x7b5f, 0x6763, 0x787b, 0x634f, 0x7530, 0x5867, 0x5949, 0x782f, 0x6f76, 0x5d36, 0x6e2f, 0x4d78, 0x5e38, 0x7c27, 0x777c, 0x7731, 0x4e3b, 0x7421, 0x6e4d, 0x612e, 0x6c43, 0x4f7e, 0x783f, 0x5862, 0x5368, 0x5e28, 0x7464, 0x6c42, 0x5975, 0x7945, 0x5d53, 0x5671, 0x6c7c, 0x7c70, 0x6d40, 0x4a39, 0x6e64, 0x7261, 0x5e39, 0x5672, 0x5e74, 0x5f5b, 0x5b53, 0x7a67, 0x5863, 0x7441, 0x5d37, 0x7275, 0x542e, 0x5673, 0x5d38, 0x4f45, 0x5f5f, 0x723e, 0x7621, 0x6b4b, 0x717c, 0x7347, 0x606b, 0x6d7c, 0x615b, 0x6e65, 0x5e75, 0x7a53, 0x714b, 0x502f, 0x5d39, 0x5143, 0x7531, 0x6a46, 0x7061, 0x762c, 0x7559, 0x706b, 0x5d3a, 0x723f, 0x7745, 0x5b22, 0x7276, 0x4a3a, 0x7775, 0x4b65, 0x6e66, 0x6053, 0x4e25, 0x5658, 0x542f, 0x6949, 0x534e, 0x7442, 0x4b66, 0x7121, 0x6b32, 0x7122, 0x6b33, 0x7034, 0x4b74, 0x5430, 0x7332, 0x7b37, 0x756c, 0x6e67, 0x7432, 0x756d, 0x4f73, 0x7062, 0x6e4e, 0x714c, 0x6538, 0x5775, 0x6373, 0x4f65, 0x4f46, 0x7333, 0x6458, 0x4f79, 0x4f5a, 0x7a4d, 0x6663, 0x7262, 0x756e, 0x4a3b, 0x635c, 0x4e72, 0x5659, 0x6e30, 0x7465, 0x5842, 0x5c50, 0x4c6e, 0x5560, 0x764a, 0x7d4a, 0x5856, 0x744f, 0x5626, 0x5c3e, 0x5b54, 0x5747, 0x727e, 0x714d, 0x6243, 0x5c5e, 0x5c5f, 0x6f2d, 0x662b, 0x795d, 0x6a3f, 0x6f2e, 0x7450, 0x4e73, 0x662c, 0x4e5e, 0x5579, 0x6374, 0x4d50, 0x5538, 0x777d, 0x5c29, 0x5e76, 0x5c2a, 0x7263, 0x6934, 0x525c, 0x6966, 0x6376, 0x674a, 0x504e, 0x5a77, 0x4a3c, 0x6e68, 0x5a5e, 0x7277, 0x627b, 0x4c26, 0x5a3b, 0x6e69, 0x755a, 0x775c, 0x616a, 0x4e41, 0x5431, 0x7d31, 0x663d, 0x7b2d, 0x7867, 0x614e, 0x7762, 0x756f, 0x4f47, 0x5432, 0x4c6f, 0x5468, 0x6e4f, 0x7757, 0x6026, 0x5641, 0x615c, 0x7063, 0x7164, 0x5c71, 0x5627, 0x7475, 0x714e, 0x7264, 0x5030, 0x6c6f, 0x793a, 0x6b35, 0x546d, 0x6244, 0x6967, 0x6b34, 0x6a21, 0x783c, 0x4e26, 0x7946, 0x7c5a, 0x5433, 0x5339, 0x6a5e, 0x692b, 0x6161, 0x534f, 0x7476, 0x6a40, 0x614f, 0x4c3a, 0x6e6a, 0x7064, 0x7334, 0x546e, 0x7240, 0x7165, 0x7443, 0x6054, 0x6b36, 0x5721, 0x4b68, 0x792d, 0x692d, 0x5864, 0x7a33, 0x6245, 0x7c3d, 0x6c44, 0x5831, 0x5c2b, 0x5524, 0x6b69, 0x683b, 0x5857, 0x7b2e, 0x5161, 0x5b40, 0x753e, 0x5e77, 0x4a7b, 0x7746, 0x4f48, 0x6150, 0x6e50, 0x6974, 0x4e74, 0x554d, 0x4f5b, 0x5d3b, 0x4e2c, 0x6968, 0x5434, 0x6447, 0x755b, 0x7a41, 0x5e29, 0x5478, 0x6f77, 0x5333, 0x6b37, 0x6f78, 0x755c, 0x6d4c, 0x5b55, 0x714f, 0x7150, 0x7532, 0x592e, 0x552c, 0x6246, 0x7d23, 0x7b65, 0x5f2b, 0x6275, 0x762d, 0x7533, 0x7035, 0x6125, 0x755d, 0x6c22, 0x6d7d, 0x7534, 0x7b38, 0x5b23, 0x564a, 0x4b59, 0x6554, 0x737a, 0x6b38, 0x6037, 0x576c, 0x716c, 0x652f, 0x5561, 0x576d, 0x5151, 0x6172, 0x6f79, 0x5d3c, 0x765c, 0x7065, 0x7444, 0x6969, 0x737b, 0x546f, 0x4c22, 0x777e, 0x5f3c, 0x6b4d, 0x5037, 0x5642, 0x682d, 0x6f2f, 0x4b25, 0x4b69, 0x7a68, 0x4c46, 0x6667, 0x6a47, 0x5b24, 0x4f49, 0x627c, 0x6f7a, 0x6b5e, 0x7548, 0x545e, 0x6055, 0x6f30, 0x6247, 0x592f, 0x7967, 0x6765, 0x4f4a, 0x6151, 0x6248, 0x6f7b, 0x7a79, 0x5c72, 0x6027, 0x7868, 0x4b6a, 0x4b3c, 0x5662, 0x755e, 0x755f, 0x6e36, 0x6276, 0x534a, 0x6f7c, 0x5144, 0x6f31, 0x5145, 0x505e, 0x5961, 0x6038, 0x4d51, 0x7339, 0x674c, 0x5628, 0x4e27, 0x5435, 0x6448, 0x5334, 0x6b39, 0x4b75, 0x765d, 0x7123, 0x4c47, 0x694a, 0x6170, 0x7560, 0x7b2f, 0x4b51, 0x7b60, 0x7265, 0x6c70, 0x706c, 0x6e6b, 0x694b, 0x4c70, 0x572f, 0x7321, 0x7c75, 0x7124, 0x6056, 0x6f32, 0x7451, 0x7721, 0x7151, 0x4a7c, 0x4a7d, 0x4e4e, 0x7348, 0x733a, 0x6d7e, 0x5a26, 0x606c, 0x784d, 0x4b52, 0x6b4e, 0x7958, 0x7959, 0x4a60, 0x5a4a, 0x4b26, 0x4a48, 0x796e, 0x5b6c, 0x5031, 0x556f, 0x6673, 0x6722, 0x6459, 0x6461, 0x7c44, 0x796f, 0x4f74, 0x7766, 0x4e3c, 0x7445, 0x5c23, 0x5d3d, 0x7446, 0x7821, 0x6856, 0x5b41, 0x7066, 0x6439, 0x766d, 0x792e, 0x5d3e, 0x5730, 0x5868, 0x4b3d, 0x795a, 0x784e, 0x7970, 0x606d, 0x6333, 0x7433, 0x6a42, 0x7266, 0x7036, 0x5b56, 0x6b64, 0x7267, 0x5755, 0x5436, 0x7968, 0x5741, 0x6555, 0x696a, 0x574c, 0x5369, 0x6249, 0x7c5b, 0x4d2d, 0x4c30, 0x6a22, 0x6476, 0x5040, 0x7037, 0x6e21, 0x5776, 0x624a, 0x624b, 0x7a4f, 0x6b5f, 0x564b, 0x7434, 0x6d4d, 0x6452, 0x6a29, 0x643a, 0x7322, 0x4d52, 0x764b, 0x7166, 0x6d41, 0x683c, 0x6e51, 0x7067, 0x624c, 0x642a, 0x7561, 0x6d5a, 0x576e, 0x5171, 0x696b, 0x696c, 0x6064, 0x5a27, 0x5d54, 0x6a23, 0x5643, 0x5674, 0x5a5f, 0x6f33, 0x624d, 0x6f7d, 0x7268, 0x6f45, 0x6767, 0x577d, 0x674e, 0x5f5c, 0x7947, 0x5976, 0x5f2c, 0x565a, 0x5c24, 0x7038, 0x557a, 0x6477, 0x5644, 0x746c, 0x6f7e, 0x7021, 0x5e2a, 0x5a3c, 0x587c, 0x7a54, 0x6c65, 0x7c28, 0x6c66, 0x584b, 0x7b39, 0x6453, 0x4d79, 0x4f53, 0x4a6a, 0x4f54, 0x783d, 0x7447, 0x6a5f, 0x795b, 0x5437, 0x6b65, 0x6152, 0x6a24, 0x7a42, 0x7b61, 0x7a6d, 0x7022, 0x4c71, 0x7a23, 0x6277, 0x624e, 0x6975, 0x616b, 0x6768, 0x6857, 0x5a78, 0x544b, 0x7776, 0x5645, 0x5469, 0x7a7a, 0x4c72, 0x775d, 0x5e3a, 0x4e28, 0x7039, 0x647e, 0x6449, 0x6454, 0x6a43, 0x6f34, 0x573e, 0x7b62, 0x4d53, 0x6f35, 0x7a69, 0x7926, 0x5f3d, 0x7747, 0x787d, 0x787c, 0x5e2b, 0x5b68, 0x635d, 0x6162, 0x5146, 0x7650, 0x6b66, 0x5a79, 0x6c47, 0x5e78, 0x7869, 0x635e, 0x4e75, 0x7a43, 0x6557, 0x6c48, 0x7349, 0x643b, 0x662e, 0x6f36, 0x5c3f, 0x4e3d, 0x5843, 0x504f, 0x4f7a, 0x734a, 0x6057, 0x5147, 0x692e, 0x683d, 0x7a44, 0x624f, 0x7a45, 0x7938, 0x5c60, 0x7b30, 0x5829, 0x655f, 0x7927, 0x766e, 0x764c, 0x6278, 0x6c71, 0x5a60, 0x7152, 0x524c, 0x4f4b, 0x4a3d, 0x5d3f, 0x766f, 0x5e79, 0x7a34, 0x552d, 0x7167, 0x5e3e, 0x5c40, 0x5148, 0x5149, 0x783e, 0x4b76, 0x5479, 0x7562, 0x6153, 0x5869, 0x787e, 0x4f4c, 0x7d24, 0x4e76, 0x7a50, 0x4c73, 0x663e, 0x762e, 0x5570, 0x514a, 0x7c3e, 0x5571, 0x4d69, 0x7a35, 0x6250, 0x7477, 0x4d54, 0x6723, 0x5b25, 0x6251, 0x5722, 0x7763, 0x6a26, 0x5021, 0x4e5a, 0x7b6b, 0x5b26, 0x5b5e, 0x5865, 0x6a60, 0x582a, 0x6560, 0x565b, 0x6f46, 0x786a, 0x6455, 0x4e77, 0x6058, 0x576f, 0x746d, 0x4d66, 0x4c74, 0x7563, 0x644a, 0x5c61, 0x7948, 0x7c3f, 0x6827, 0x5844, 0x4b3e, 0x5c2e, 0x5777, 0x7068, 0x5d40, 0x4f4d, 0x5c73, 0x5930, 0x6669, 0x643c, 0x6a44, 0x646c, 0x6465, 0x7b78, 0x4c3b, 0x643d, 0x4d5c, 0x5977, 0x5d5f, 0x6d4e, 0x5950, 0x6523, 0x794d, 0x4d2e, 0x4f4e, 0x762f, 0x7d53, 0x6b6d, 0x565c, 0x6524, 0x5536, 0x565d, 0x7969, 0x6724, 0x5663, 0x514b, 0x5664, 0x5572, 0x5e7a, 0x5778, 0x586a, 0x4f55, 0x587d, 0x582b, 0x7d4b, 0x7c5c, 0x6028, 0x5573, 0x7d59, 0x4c23, 0x5979, 0x536a, 0x7575, 0x6f47, 0x535a, 0x5a3d, 0x6828, 0x5c2f, 0x7023, 0x4d55, 0x6029, 0x5e2c, 0x703a, 0x6e31, 0x6e32, 0x764d, 0x6e52, 0x5646, 0x6065, 0x733b, 0x6561, 0x644b, 0x5723, 0x5b42, 0x4a7e, 0x4f4f, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027, 0x3028, 0x3029, 0x302a, 0x302b, 0x302c, 0x302d, 0x302e, 0x302f, 0x3030, 0x3031, 0x3032, 0x3033, 0x3034, 0x3035, 0x3036, 0x3037, 0x3038, 0x3039, 0x303a, 0x303b, 0x303c, 0x303d, 0x303e, 0x303f, 0x3040, 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, 0x3129, 0x312a, 0x312b, 0x312c, 0x312d, 0x312e, 0x312f, 0x3130, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, 0x3158, 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, 0x3160, 0x3161, 0x3162, 0x3163, 0x3164, 0x3165, 0x3166, 0x3167, 0x3168, 0x3169, 0x316a, 0x316b, 0x316c, 0x316d, 0x316e, 0x316f, 0x3170, 0x3171, 0x3172, 0x3173, 0x3174, 0x3175, 0x3176, 0x3177, 0x3178, 0x3179, 0x317a, 0x317b, 0x317c, 0x317d, 0x317e, 0x3221, 0x3222, 0x3223, 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, 0x322a, 0x322b, 0x322c, 0x322d, 0x322e, 0x322f, 0x3230, 0x3231, 0x3232, 0x3233, 0x3234, 0x3235, 0x3236, 0x3237, 0x3238, 0x3239, 0x323a, 0x323b, 0x323c, 0x323d, 0x323e, 0x323f, 0x3240, 0x3241, 0x3242, 0x3243, 0x3244, 0x3245, 0x3246, 0x3247, 0x3248, 0x3249, 0x324a, 0x324b, 0x324c, 0x324d, 0x324e, 0x324f, 0x3250, 0x3251, 0x3252, 0x3253, 0x3254, 0x3255, 0x3256, 0x3257, 0x3258, 0x3259, 0x325a, 0x325b, 0x325c, 0x325d, 0x325e, 0x325f, 0x3260, 0x3261, 0x3262, 0x3263, 0x3264, 0x3265, 0x3266, 0x3267, 0x3268, 0x3269, 0x326a, 0x326b, 0x326c, 0x326d, 0x326e, 0x326f, 0x3270, 0x3271, 0x3272, 0x3273, 0x3274, 0x3275, 0x3276, 0x3277, 0x3278, 0x3279, 0x327a, 0x327b, 0x327c, 0x327d, 0x327e, 0x3321, 0x3322, 0x3323, 0x3324, 0x3325, 0x3326, 0x3327, 0x3328, 0x3329, 0x332a, 0x332b, 0x332c, 0x332d, 0x332e, 0x332f, 0x3330, 0x3331, 0x3332, 0x3333, 0x3334, 0x3335, 0x3336, 0x3337, 0x3338, 0x3339, 0x333a, 0x333b, 0x333c, 0x333d, 0x333e, 0x333f, 0x3340, 0x3341, 0x3342, 0x3343, 0x3344, 0x3345, 0x3346, 0x3347, 0x3348, 0x3349, 0x334a, 0x334b, 0x334c, 0x334d, 0x334e, 0x334f, 0x3350, 0x3351, 0x3352, 0x3353, 0x3354, 0x3355, 0x3356, 0x3357, 0x3358, 0x3359, 0x335a, 0x335b, 0x335c, 0x335d, 0x335e, 0x335f, 0x3360, 0x3361, 0x3362, 0x3363, 0x3364, 0x3365, 0x3366, 0x3367, 0x3368, 0x3369, 0x336a, 0x336b, 0x336c, 0x336d, 0x336e, 0x336f, 0x3370, 0x3371, 0x3372, 0x3373, 0x3374, 0x3375, 0x3376, 0x3377, 0x3378, 0x3379, 0x337a, 0x337b, 0x337c, 0x337d, 0x337e, 0x3421, 0x3422, 0x3423, 0x3424, 0x3425, 0x3426, 0x3427, 0x3428, 0x3429, 0x342a, 0x342b, 0x342c, 0x342d, 0x342e, 0x342f, 0x3430, 0x3431, 0x3432, 0x3433, 0x3434, 0x3435, 0x3436, 0x3437, 0x3438, 0x3439, 0x343a, 0x343b, 0x343c, 0x343d, 0x343e, 0x343f, 0x3440, 0x3441, 0x3442, 0x3443, 0x3444, 0x3445, 0x3446, 0x3447, 0x3448, 0x3449, 0x344a, 0x344b, 0x344c, 0x344d, 0x344e, 0x344f, 0x3450, 0x3451, 0x3452, 0x3453, 0x3454, 0x3455, 0x3456, 0x3457, 0x3458, 0x3459, 0x345a, 0x345b, 0x345c, 0x345d, 0x345e, 0x345f, 0x3460, 0x3461, 0x3462, 0x3463, 0x3464, 0x3465, 0x3466, 0x3467, 0x3468, 0x3469, 0x346a, 0x346b, 0x346c, 0x346d, 0x346e, 0x346f, 0x3470, 0x3471, 0x3472, 0x3473, 0x3474, 0x3475, 0x3476, 0x3477, 0x3478, 0x3479, 0x347a, 0x347b, 0x347c, 0x347d, 0x347e, 0x3521, 0x3522, 0x3523, 0x3524, 0x3525, 0x3526, 0x3527, 0x3528, 0x3529, 0x352a, 0x352b, 0x352c, 0x352d, 0x352e, 0x352f, 0x3530, 0x3531, 0x3532, 0x3533, 0x3534, 0x3535, 0x3536, 0x3537, 0x3538, 0x3539, 0x353a, 0x353b, 0x353c, 0x353d, 0x353e, 0x353f, 0x3540, 0x3541, 0x3542, 0x3543, 0x3544, 0x3545, 0x3546, 0x3547, 0x3548, 0x3549, 0x354a, 0x354b, 0x354c, 0x354d, 0x354e, 0x354f, 0x3550, 0x3551, 0x3552, 0x3553, 0x3554, 0x3555, 0x3556, 0x3557, 0x3558, 0x3559, 0x355a, 0x355b, 0x355c, 0x355d, 0x355e, 0x355f, 0x3560, 0x3561, 0x3562, 0x3563, 0x3564, 0x3565, 0x3566, 0x3567, 0x3568, 0x3569, 0x356a, 0x356b, 0x356c, 0x356d, 0x356e, 0x356f, 0x3570, 0x3571, 0x3572, 0x3573, 0x3574, 0x3575, 0x3576, 0x3577, 0x3578, 0x3579, 0x357a, 0x357b, 0x357c, 0x357d, 0x357e, 0x3621, 0x3622, 0x3623, 0x3624, 0x3625, 0x3626, 0x3627, 0x3628, 0x3629, 0x362a, 0x362b, 0x362c, 0x362d, 0x362e, 0x362f, 0x3630, 0x3631, 0x3632, 0x3633, 0x3634, 0x3635, 0x3636, 0x3637, 0x3638, 0x3639, 0x363a, 0x363b, 0x363c, 0x363d, 0x363e, 0x363f, 0x3640, 0x3641, 0x3642, 0x3643, 0x3644, 0x3645, 0x3646, 0x3647, 0x3648, 0x3649, 0x364a, 0x364b, 0x364c, 0x364d, 0x364e, 0x364f, 0x3650, 0x3651, 0x3652, 0x3653, 0x3654, 0x3655, 0x3656, 0x3657, 0x3658, 0x3659, 0x365a, 0x365b, 0x365c, 0x365d, 0x365e, 0x365f, 0x3660, 0x3661, 0x3662, 0x3663, 0x3664, 0x3665, 0x3666, 0x3667, 0x3668, 0x3669, 0x366a, 0x366b, 0x366c, 0x366d, 0x366e, 0x366f, 0x3670, 0x3671, 0x3672, 0x3673, 0x3674, 0x3675, 0x3676, 0x3677, 0x3678, 0x3679, 0x367a, 0x367b, 0x367c, 0x367d, 0x367e, 0x3721, 0x3722, 0x3723, 0x3724, 0x3725, 0x3726, 0x3727, 0x3728, 0x3729, 0x372a, 0x372b, 0x372c, 0x372d, 0x372e, 0x372f, 0x3730, 0x3731, 0x3732, 0x3733, 0x3734, 0x3735, 0x3736, 0x3737, 0x3738, 0x3739, 0x373a, 0x373b, 0x373c, 0x373d, 0x373e, 0x373f, 0x3740, 0x3741, 0x3742, 0x3743, 0x3744, 0x3745, 0x3746, 0x3747, 0x3748, 0x3749, 0x374a, 0x374b, 0x374c, 0x374d, 0x374e, 0x374f, 0x3750, 0x3751, 0x3752, 0x3753, 0x3754, 0x3755, 0x3756, 0x3757, 0x3758, 0x3759, 0x375a, 0x375b, 0x375c, 0x375d, 0x375e, 0x375f, 0x3760, 0x3761, 0x3762, 0x3763, 0x3764, 0x3765, 0x3766, 0x3767, 0x3768, 0x3769, 0x376a, 0x376b, 0x376c, 0x376d, 0x376e, 0x376f, 0x3770, 0x3771, 0x3772, 0x3773, 0x3774, 0x3775, 0x3776, 0x3777, 0x3778, 0x3779, 0x377a, 0x377b, 0x377c, 0x377d, 0x377e, 0x3821, 0x3822, 0x3823, 0x3824, 0x3825, 0x3826, 0x3827, 0x3828, 0x3829, 0x382a, 0x382b, 0x382c, 0x382d, 0x382e, 0x382f, 0x3830, 0x3831, 0x3832, 0x3833, 0x3834, 0x3835, 0x3836, 0x3837, 0x3838, 0x3839, 0x383a, 0x383b, 0x383c, 0x383d, 0x383e, 0x383f, 0x3840, 0x3841, 0x3842, 0x3843, 0x3844, 0x3845, 0x3846, 0x3847, 0x3848, 0x3849, 0x384a, 0x384b, 0x384c, 0x384d, 0x384e, 0x384f, 0x3850, 0x3851, 0x3852, 0x3853, 0x3854, 0x3855, 0x3856, 0x3857, 0x3858, 0x3859, 0x385a, 0x385b, 0x385c, 0x385d, 0x385e, 0x385f, 0x3860, 0x3861, 0x3862, 0x3863, 0x3864, 0x3865, 0x3866, 0x3867, 0x3868, 0x3869, 0x386a, 0x386b, 0x386c, 0x386d, 0x386e, 0x386f, 0x3870, 0x3871, 0x3872, 0x3873, 0x3874, 0x3875, 0x3876, 0x3877, 0x3878, 0x3879, 0x387a, 0x387b, 0x387c, 0x387d, 0x387e, 0x3921, 0x3922, 0x3923, 0x3924, 0x3925, 0x3926, 0x3927, 0x3928, 0x3929, 0x392a, 0x392b, 0x392c, 0x392d, 0x392e, 0x392f, 0x3930, 0x3931, 0x3932, 0x3933, 0x3934, 0x3935, 0x3936, 0x3937, 0x3938, 0x3939, 0x393a, 0x393b, 0x393c, 0x393d, 0x393e, 0x393f, 0x3940, 0x3941, 0x3942, 0x3943, 0x3944, 0x3945, 0x3946, 0x3947, 0x3948, 0x3949, 0x394a, 0x394b, 0x394c, 0x394d, 0x394e, 0x394f, 0x3950, 0x3951, 0x3952, 0x3953, 0x3954, 0x3955, 0x3956, 0x3957, 0x3958, 0x3959, 0x395a, 0x395b, 0x395c, 0x395d, 0x395e, 0x395f, 0x3960, 0x3961, 0x3962, 0x3963, 0x3964, 0x3965, 0x3966, 0x3967, 0x3968, 0x3969, 0x396a, 0x396b, 0x396c, 0x396d, 0x396e, 0x396f, 0x3970, 0x3971, 0x3972, 0x3973, 0x3974, 0x3975, 0x3976, 0x3977, 0x3978, 0x3979, 0x397a, 0x397b, 0x397c, 0x397d, 0x397e, 0x3a21, 0x3a22, 0x3a23, 0x3a24, 0x3a25, 0x3a26, 0x3a27, 0x3a28, 0x3a29, 0x3a2a, 0x3a2b, 0x3a2c, 0x3a2d, 0x3a2e, 0x3a2f, 0x3a30, 0x3a31, 0x3a32, 0x3a33, 0x3a34, 0x3a35, 0x3a36, 0x3a37, 0x3a38, 0x3a39, 0x3a3a, 0x3a3b, 0x3a3c, 0x3a3d, 0x3a3e, 0x3a3f, 0x3a40, 0x3a41, 0x3a42, 0x3a43, 0x3a44, 0x3a45, 0x3a46, 0x3a47, 0x3a48, 0x3a49, 0x3a4a, 0x3a4b, 0x3a4c, 0x3a4d, 0x3a4e, 0x3a4f, 0x3a50, 0x3a51, 0x3a52, 0x3a53, 0x3a54, 0x3a55, 0x3a56, 0x3a57, 0x3a58, 0x3a59, 0x3a5a, 0x3a5b, 0x3a5c, 0x3a5d, 0x3a5e, 0x3a5f, 0x3a60, 0x3a61, 0x3a62, 0x3a63, 0x3a64, 0x3a65, 0x3a66, 0x3a67, 0x3a68, 0x3a69, 0x3a6a, 0x3a6b, 0x3a6c, 0x3a6d, 0x3a6e, 0x3a6f, 0x3a70, 0x3a71, 0x3a72, 0x3a73, 0x3a74, 0x3a75, 0x3a76, 0x3a77, 0x3a78, 0x3a79, 0x3a7a, 0x3a7b, 0x3a7c, 0x3a7d, 0x3a7e, 0x3b21, 0x3b22, 0x3b23, 0x3b24, 0x3b25, 0x3b26, 0x3b27, 0x3b28, 0x3b29, 0x3b2a, 0x3b2b, 0x3b2c, 0x3b2d, 0x3b2e, 0x3b2f, 0x3b30, 0x3b31, 0x3b32, 0x3b33, 0x3b34, 0x3b35, 0x3b36, 0x3b37, 0x3b38, 0x3b39, 0x3b3a, 0x3b3b, 0x3b3c, 0x3b3d, 0x3b3e, 0x3b3f, 0x3b40, 0x3b41, 0x3b42, 0x3b43, 0x3b44, 0x3b45, 0x3b46, 0x3b47, 0x3b48, 0x3b49, 0x3b4a, 0x3b4b, 0x3b4c, 0x3b4d, 0x3b4e, 0x3b4f, 0x3b50, 0x3b51, 0x3b52, 0x3b53, 0x3b54, 0x3b55, 0x3b56, 0x3b57, 0x3b58, 0x3b59, 0x3b5a, 0x3b5b, 0x3b5c, 0x3b5d, 0x3b5e, 0x3b5f, 0x3b60, 0x3b61, 0x3b62, 0x3b63, 0x3b64, 0x3b65, 0x3b66, 0x3b67, 0x3b68, 0x3b69, 0x3b6a, 0x3b6b, 0x3b6c, 0x3b6d, 0x3b6e, 0x3b6f, 0x3b70, 0x3b71, 0x3b72, 0x3b73, 0x3b74, 0x3b75, 0x3b76, 0x3b77, 0x3b78, 0x3b79, 0x3b7a, 0x3b7b, 0x3b7c, 0x3b7d, 0x3b7e, 0x3c21, 0x3c22, 0x3c23, 0x3c24, 0x3c25, 0x3c26, 0x3c27, 0x3c28, 0x3c29, 0x3c2a, 0x3c2b, 0x3c2c, 0x3c2d, 0x3c2e, 0x3c2f, 0x3c30, 0x3c31, 0x3c32, 0x3c33, 0x3c34, 0x3c35, 0x3c36, 0x3c37, 0x3c38, 0x3c39, 0x3c3a, 0x3c3b, 0x3c3c, 0x3c3d, 0x3c3e, 0x3c3f, 0x3c40, 0x3c41, 0x3c42, 0x3c43, 0x3c44, 0x3c45, 0x3c46, 0x3c47, 0x3c48, 0x3c49, 0x3c4a, 0x3c4b, 0x3c4c, 0x3c4d, 0x3c4e, 0x3c4f, 0x3c50, 0x3c51, 0x3c52, 0x3c53, 0x3c54, 0x3c55, 0x3c56, 0x3c57, 0x3c58, 0x3c59, 0x3c5a, 0x3c5b, 0x3c5c, 0x3c5d, 0x3c5e, 0x3c5f, 0x3c60, 0x3c61, 0x3c62, 0x3c63, 0x3c64, 0x3c65, 0x3c66, 0x3c67, 0x3c68, 0x3c69, 0x3c6a, 0x3c6b, 0x3c6c, 0x3c6d, 0x3c6e, 0x3c6f, 0x3c70, 0x3c71, 0x3c72, 0x3c73, 0x3c74, 0x3c75, 0x3c76, 0x3c77, 0x3c78, 0x3c79, 0x3c7a, 0x3c7b, 0x3c7c, 0x3c7d, 0x3c7e, 0x3d21, 0x3d22, 0x3d23, 0x3d24, 0x3d25, 0x3d26, 0x3d27, 0x3d28, 0x3d29, 0x3d2a, 0x3d2b, 0x3d2c, 0x3d2d, 0x3d2e, 0x3d2f, 0x3d30, 0x3d31, 0x3d32, 0x3d33, 0x3d34, 0x3d35, 0x3d36, 0x3d37, 0x3d38, 0x3d39, 0x3d3a, 0x3d3b, 0x3d3c, 0x3d3d, 0x3d3e, 0x3d3f, 0x3d40, 0x3d41, 0x3d42, 0x3d43, 0x3d44, 0x3d45, 0x3d46, 0x3d47, 0x3d48, 0x3d49, 0x3d4a, 0x3d4b, 0x3d4c, 0x3d4d, 0x3d4e, 0x3d4f, 0x3d50, 0x3d51, 0x3d52, 0x3d53, 0x3d54, 0x3d55, 0x3d56, 0x3d57, 0x3d58, 0x3d59, 0x3d5a, 0x3d5b, 0x3d5c, 0x3d5d, 0x3d5e, 0x3d5f, 0x3d60, 0x3d61, 0x3d62, 0x3d63, 0x3d64, 0x3d65, 0x3d66, 0x3d67, 0x3d68, 0x3d69, 0x3d6a, 0x3d6b, 0x3d6c, 0x3d6d, 0x3d6e, 0x3d6f, 0x3d70, 0x3d71, 0x3d72, 0x3d73, 0x3d74, 0x3d75, 0x3d76, 0x3d77, 0x3d78, 0x3d79, 0x3d7a, 0x3d7b, 0x3d7c, 0x3d7d, 0x3d7e, 0x3e21, 0x3e22, 0x3e23, 0x3e24, 0x3e25, 0x3e26, 0x3e27, 0x3e28, 0x3e29, 0x3e2a, 0x3e2b, 0x3e2c, 0x3e2d, 0x3e2e, 0x3e2f, 0x3e30, 0x3e31, 0x3e32, 0x3e33, 0x3e34, 0x3e35, 0x3e36, 0x3e37, 0x3e38, 0x3e39, 0x3e3a, 0x3e3b, 0x3e3c, 0x3e3d, 0x3e3e, 0x3e3f, 0x3e40, 0x3e41, 0x3e42, 0x3e43, 0x3e44, 0x3e45, 0x3e46, 0x3e47, 0x3e48, 0x3e49, 0x3e4a, 0x3e4b, 0x3e4c, 0x3e4d, 0x3e4e, 0x3e4f, 0x3e50, 0x3e51, 0x3e52, 0x3e53, 0x3e54, 0x3e55, 0x3e56, 0x3e57, 0x3e58, 0x3e59, 0x3e5a, 0x3e5b, 0x3e5c, 0x3e5d, 0x3e5e, 0x3e5f, 0x3e60, 0x3e61, 0x3e62, 0x3e63, 0x3e64, 0x3e65, 0x3e66, 0x3e67, 0x3e68, 0x3e69, 0x3e6a, 0x3e6b, 0x3e6c, 0x3e6d, 0x3e6e, 0x3e6f, 0x3e70, 0x3e71, 0x3e72, 0x3e73, 0x3e74, 0x3e75, 0x3e76, 0x3e77, 0x3e78, 0x3e79, 0x3e7a, 0x3e7b, 0x3e7c, 0x3e7d, 0x3e7e, 0x3f21, 0x3f22, 0x3f23, 0x3f24, 0x3f25, 0x3f26, 0x3f27, 0x3f28, 0x3f29, 0x3f2a, 0x3f2b, 0x3f2c, 0x3f2d, 0x3f2e, 0x3f2f, 0x3f30, 0x3f31, 0x3f32, 0x3f33, 0x3f34, 0x3f35, 0x3f36, 0x3f37, 0x3f38, 0x3f39, 0x3f3a, 0x3f3b, 0x3f3c, 0x3f3d, 0x3f3e, 0x3f3f, 0x3f40, 0x3f41, 0x3f42, 0x3f43, 0x3f44, 0x3f45, 0x3f46, 0x3f47, 0x3f48, 0x3f49, 0x3f4a, 0x3f4b, 0x3f4c, 0x3f4d, 0x3f4e, 0x3f4f, 0x3f50, 0x3f51, 0x3f52, 0x3f53, 0x3f54, 0x3f55, 0x3f56, 0x3f57, 0x3f58, 0x3f59, 0x3f5a, 0x3f5b, 0x3f5c, 0x3f5d, 0x3f5e, 0x3f5f, 0x3f60, 0x3f61, 0x3f62, 0x3f63, 0x3f64, 0x3f65, 0x3f66, 0x3f67, 0x3f68, 0x3f69, 0x3f6a, 0x3f6b, 0x3f6c, 0x3f6d, 0x3f6e, 0x3f6f, 0x3f70, 0x3f71, 0x3f72, 0x3f73, 0x3f74, 0x3f75, 0x3f76, 0x3f77, 0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, 0x3f7d, 0x3f7e, 0x4021, 0x4022, 0x4023, 0x4024, 0x4025, 0x4026, 0x4027, 0x4028, 0x4029, 0x402a, 0x402b, 0x402c, 0x402d, 0x402e, 0x402f, 0x4030, 0x4031, 0x4032, 0x4033, 0x4034, 0x4035, 0x4036, 0x4037, 0x4038, 0x4039, 0x403a, 0x403b, 0x403c, 0x403d, 0x403e, 0x403f, 0x4040, 0x4041, 0x4042, 0x4043, 0x4044, 0x4045, 0x4046, 0x4047, 0x4048, 0x4049, 0x404a, 0x404b, 0x404c, 0x404d, 0x404e, 0x404f, 0x4050, 0x4051, 0x4052, 0x4053, 0x4054, 0x4055, 0x4056, 0x4057, 0x4058, 0x4059, 0x405a, 0x405b, 0x405c, 0x405d, 0x405e, 0x405f, 0x4060, 0x4061, 0x4062, 0x4063, 0x4064, 0x4065, 0x4066, 0x4067, 0x4068, 0x4069, 0x406a, 0x406b, 0x406c, 0x406d, 0x406e, 0x406f, 0x4070, 0x4071, 0x4072, 0x4073, 0x4074, 0x4075, 0x4076, 0x4077, 0x4078, 0x4079, 0x407a, 0x407b, 0x407c, 0x407d, 0x407e, 0x4121, 0x4122, 0x4123, 0x4124, 0x4125, 0x4126, 0x4127, 0x4128, 0x4129, 0x412a, 0x412b, 0x412c, 0x412d, 0x412e, 0x412f, 0x4130, 0x4131, 0x4132, 0x4133, 0x4134, 0x4135, 0x4136, 0x4137, 0x4138, 0x4139, 0x413a, 0x413b, 0x413c, 0x413d, 0x413e, 0x413f, 0x4140, 0x4141, 0x4142, 0x4143, 0x4144, 0x4145, 0x4146, 0x4147, 0x4148, 0x4149, 0x414a, 0x414b, 0x414c, 0x414d, 0x414e, 0x414f, 0x4150, 0x4151, 0x4152, 0x4153, 0x4154, 0x4155, 0x4156, 0x4157, 0x4158, 0x4159, 0x415a, 0x415b, 0x415c, 0x415d, 0x415e, 0x415f, 0x4160, 0x4161, 0x4162, 0x4163, 0x4164, 0x4165, 0x4166, 0x4167, 0x4168, 0x4169, 0x416a, 0x416b, 0x416c, 0x416d, 0x416e, 0x416f, 0x4170, 0x4171, 0x4172, 0x4173, 0x4174, 0x4175, 0x4176, 0x4177, 0x4178, 0x4179, 0x417a, 0x417b, 0x417c, 0x417d, 0x417e, 0x4221, 0x4222, 0x4223, 0x4224, 0x4225, 0x4226, 0x4227, 0x4228, 0x4229, 0x422a, 0x422b, 0x422c, 0x422d, 0x422e, 0x422f, 0x4230, 0x4231, 0x4232, 0x4233, 0x4234, 0x4235, 0x4236, 0x4237, 0x4238, 0x4239, 0x423a, 0x423b, 0x423c, 0x423d, 0x423e, 0x423f, 0x4240, 0x4241, 0x4242, 0x4243, 0x4244, 0x4245, 0x4246, 0x4247, 0x4248, 0x4249, 0x424a, 0x424b, 0x424c, 0x424d, 0x424e, 0x424f, 0x4250, 0x4251, 0x4252, 0x4253, 0x4254, 0x4255, 0x4256, 0x4257, 0x4258, 0x4259, 0x425a, 0x425b, 0x425c, 0x425d, 0x425e, 0x425f, 0x4260, 0x4261, 0x4262, 0x4263, 0x4264, 0x4265, 0x4266, 0x4267, 0x4268, 0x4269, 0x426a, 0x426b, 0x426c, 0x426d, 0x426e, 0x426f, 0x4270, 0x4271, 0x4272, 0x4273, 0x4274, 0x4275, 0x4276, 0x4277, 0x4278, 0x4279, 0x427a, 0x427b, 0x427c, 0x427d, 0x427e, 0x4321, 0x4322, 0x4323, 0x4324, 0x4325, 0x4326, 0x4327, 0x4328, 0x4329, 0x432a, 0x432b, 0x432c, 0x432d, 0x432e, 0x432f, 0x4330, 0x4331, 0x4332, 0x4333, 0x4334, 0x4335, 0x4336, 0x4337, 0x4338, 0x4339, 0x433a, 0x433b, 0x433c, 0x433d, 0x433e, 0x433f, 0x4340, 0x4341, 0x4342, 0x4343, 0x4344, 0x4345, 0x4346, 0x4347, 0x4348, 0x4349, 0x434a, 0x434b, 0x434c, 0x434d, 0x434e, 0x434f, 0x4350, 0x4351, 0x4352, 0x4353, 0x4354, 0x4355, 0x4356, 0x4357, 0x4358, 0x4359, 0x435a, 0x435b, 0x435c, 0x435d, 0x435e, 0x435f, 0x4360, 0x4361, 0x4362, 0x4363, 0x4364, 0x4365, 0x4366, 0x4367, 0x4368, 0x4369, 0x436a, 0x436b, 0x436c, 0x436d, 0x436e, 0x436f, 0x4370, 0x4371, 0x4372, 0x4373, 0x4374, 0x4375, 0x4376, 0x4377, 0x4378, 0x4379, 0x437a, 0x437b, 0x437c, 0x437d, 0x437e, 0x4421, 0x4422, 0x4423, 0x4424, 0x4425, 0x4426, 0x4427, 0x4428, 0x4429, 0x442a, 0x442b, 0x442c, 0x442d, 0x442e, 0x442f, 0x4430, 0x4431, 0x4432, 0x4433, 0x4434, 0x4435, 0x4436, 0x4437, 0x4438, 0x4439, 0x443a, 0x443b, 0x443c, 0x443d, 0x443e, 0x443f, 0x4440, 0x4441, 0x4442, 0x4443, 0x4444, 0x4445, 0x4446, 0x4447, 0x4448, 0x4449, 0x444a, 0x444b, 0x444c, 0x444d, 0x444e, 0x444f, 0x4450, 0x4451, 0x4452, 0x4453, 0x4454, 0x4455, 0x4456, 0x4457, 0x4458, 0x4459, 0x445a, 0x445b, 0x445c, 0x445d, 0x445e, 0x445f, 0x4460, 0x4461, 0x4462, 0x4463, 0x4464, 0x4465, 0x4466, 0x4467, 0x4468, 0x4469, 0x446a, 0x446b, 0x446c, 0x446d, 0x446e, 0x446f, 0x4470, 0x4471, 0x4472, 0x4473, 0x4474, 0x4475, 0x4476, 0x4477, 0x4478, 0x4479, 0x447a, 0x447b, 0x447c, 0x447d, 0x447e, 0x4521, 0x4522, 0x4523, 0x4524, 0x4525, 0x4526, 0x4527, 0x4528, 0x4529, 0x452a, 0x452b, 0x452c, 0x452d, 0x452e, 0x452f, 0x4530, 0x4531, 0x4532, 0x4533, 0x4534, 0x4535, 0x4536, 0x4537, 0x4538, 0x4539, 0x453a, 0x453b, 0x453c, 0x453d, 0x453e, 0x453f, 0x4540, 0x4541, 0x4542, 0x4543, 0x4544, 0x4545, 0x4546, 0x4547, 0x4548, 0x4549, 0x454a, 0x454b, 0x454c, 0x454d, 0x454e, 0x454f, 0x4550, 0x4551, 0x4552, 0x4553, 0x4554, 0x4555, 0x4556, 0x4557, 0x4558, 0x4559, 0x455a, 0x455b, 0x455c, 0x455d, 0x455e, 0x455f, 0x4560, 0x4561, 0x4562, 0x4563, 0x4564, 0x4565, 0x4566, 0x4567, 0x4568, 0x4569, 0x456a, 0x456b, 0x456c, 0x456d, 0x456e, 0x456f, 0x4570, 0x4571, 0x4572, 0x4573, 0x4574, 0x4575, 0x4576, 0x4577, 0x4578, 0x4579, 0x457a, 0x457b, 0x457c, 0x457d, 0x457e, 0x4621, 0x4622, 0x4623, 0x4624, 0x4625, 0x4626, 0x4627, 0x4628, 0x4629, 0x462a, 0x462b, 0x462c, 0x462d, 0x462e, 0x462f, 0x4630, 0x4631, 0x4632, 0x4633, 0x4634, 0x4635, 0x4636, 0x4637, 0x4638, 0x4639, 0x463a, 0x463b, 0x463c, 0x463d, 0x463e, 0x463f, 0x4640, 0x4641, 0x4642, 0x4643, 0x4644, 0x4645, 0x4646, 0x4647, 0x4648, 0x4649, 0x464a, 0x464b, 0x464c, 0x464d, 0x464e, 0x464f, 0x4650, 0x4651, 0x4652, 0x4653, 0x4654, 0x4655, 0x4656, 0x4657, 0x4658, 0x4659, 0x465a, 0x465b, 0x465c, 0x465d, 0x465e, 0x465f, 0x4660, 0x4661, 0x4662, 0x4663, 0x4664, 0x4665, 0x4666, 0x4667, 0x4668, 0x4669, 0x466a, 0x466b, 0x466c, 0x466d, 0x466e, 0x466f, 0x4670, 0x4671, 0x4672, 0x4673, 0x4674, 0x4675, 0x4676, 0x4677, 0x4678, 0x4679, 0x467a, 0x467b, 0x467c, 0x467d, 0x467e, 0x4721, 0x4722, 0x4723, 0x4724, 0x4725, 0x4726, 0x4727, 0x4728, 0x4729, 0x472a, 0x472b, 0x472c, 0x472d, 0x472e, 0x472f, 0x4730, 0x4731, 0x4732, 0x4733, 0x4734, 0x4735, 0x4736, 0x4737, 0x4738, 0x4739, 0x473a, 0x473b, 0x473c, 0x473d, 0x473e, 0x473f, 0x4740, 0x4741, 0x4742, 0x4743, 0x4744, 0x4745, 0x4746, 0x4747, 0x4748, 0x4749, 0x474a, 0x474b, 0x474c, 0x474d, 0x474e, 0x474f, 0x4750, 0x4751, 0x4752, 0x4753, 0x4754, 0x4755, 0x4756, 0x4757, 0x4758, 0x4759, 0x475a, 0x475b, 0x475c, 0x475d, 0x475e, 0x475f, 0x4760, 0x4761, 0x4762, 0x4763, 0x4764, 0x4765, 0x4766, 0x4767, 0x4768, 0x4769, 0x476a, 0x476b, 0x476c, 0x476d, 0x476e, 0x476f, 0x4770, 0x4771, 0x4772, 0x4773, 0x4774, 0x4775, 0x4776, 0x4777, 0x4778, 0x4779, 0x477a, 0x477b, 0x477c, 0x477d, 0x477e, 0x4821, 0x4822, 0x4823, 0x4824, 0x4825, 0x4826, 0x4827, 0x4828, 0x4829, 0x482a, 0x482b, 0x482c, 0x482d, 0x482e, 0x482f, 0x4830, 0x4831, 0x4832, 0x4833, 0x4834, 0x4835, 0x4836, 0x4837, 0x4838, 0x4839, 0x483a, 0x483b, 0x483c, 0x483d, 0x483e, 0x483f, 0x4840, 0x4841, 0x4842, 0x4843, 0x4844, 0x4845, 0x4846, 0x4847, 0x4848, 0x4849, 0x484a, 0x484b, 0x484c, 0x484d, 0x484e, 0x484f, 0x4850, 0x4851, 0x4852, 0x4853, 0x4854, 0x4855, 0x4856, 0x4857, 0x4858, 0x4859, 0x485a, 0x485b, 0x485c, 0x485d, 0x485e, 0x485f, 0x4860, 0x4861, 0x4862, 0x4863, 0x4864, 0x4865, 0x4866, 0x4867, 0x4868, 0x4869, 0x486a, 0x486b, 0x486c, 0x486d, 0x486e, 0x486f, 0x4870, 0x4871, 0x4872, 0x4873, 0x4874, 0x4875, 0x4876, 0x4877, 0x4878, 0x4879, 0x487a, 0x487b, 0x487c, 0x487d, 0x487e, 0x4b50, 0x4b56, 0x4b67, 0x4d4f, 0x4d68, 0x4e2d, 0x4f7b, 0x5022, 0x5038, 0x5050, 0x505d, 0x5154, 0x5155, 0x5158, 0x515b, 0x515c, 0x515d, 0x515e, 0x515f, 0x5160, 0x5162, 0x5163, 0x5164, 0x5165, 0x5166, 0x5168, 0x5169, 0x516a, 0x516b, 0x516d, 0x516f, 0x5170, 0x5172, 0x5176, 0x517a, 0x517c, 0x517d, 0x517e, 0x5222, 0x5223, 0x5227, 0x5228, 0x5229, 0x522a, 0x522b, 0x522d, 0x5232, 0x523e, 0x5242, 0x5243, 0x5244, 0x5246, 0x5247, 0x5248, 0x5249, 0x524a, 0x524b, 0x524d, 0x524e, 0x524f, 0x5250, 0x5251, 0x5252, 0x5253, 0x5254, 0x5255, 0x5256, 0x5257, 0x5259, 0x525a, 0x525e, 0x525f, 0x5261, 0x5262, 0x5264, 0x5265, 0x5266, 0x5267, 0x5268, 0x5269, 0x526a, 0x526b, 0x5270, 0x5271, 0x5272, 0x5273, 0x5274, 0x5275, 0x5277, 0x5278, 0x5466, 0x547c, 0x5525, 0x552b, 0x552e, 0x5638, 0x564d, 0x574b, 0x5764, 0x5b45, 0x5b64, 0x5c25, 0x5d25, 0x5d55, 0x5d74, 0x5e7c, 0x5e7e, 0x5f33, 0x5f61, 0x5f68, 0x6071, 0x612d, 0x616d, 0x6375, 0x6421, 0x6429, 0x652e, 0x6531, 0x6532, 0x6539, 0x653b, 0x653c, 0x6544, 0x654e, 0x6550, 0x6552, 0x6556, 0x657a, 0x657b, 0x657c, 0x657e, 0x6621, 0x6624, 0x6627, 0x662d, 0x662f, 0x6630, 0x6631, 0x6633, 0x6637, 0x6638, 0x663c, 0x6644, 0x6646, 0x6647, 0x664a, 0x6652, 0x6656, 0x6659, 0x665c, 0x665f, 0x6661, 0x6664, 0x6665, 0x6666, 0x6668, 0x666a, 0x666b, 0x666c, 0x666f, 0x6671, 0x6672, 0x6675, 0x6676, 0x6677, 0x6679, 0x6721, 0x6726, 0x6729, 0x672a, 0x672c, 0x672d, 0x6730, 0x673f, 0x6741, 0x6746, 0x6747, 0x674b, 0x674d, 0x674f, 0x6750, 0x6753, 0x675f, 0x6764, 0x6766, 0x6777, 0x6867, 0x6868, 0x6870, 0x6871, 0x6877, 0x6879, 0x687b, 0x687e, 0x6927, 0x692c, 0x694c, 0x6977, 0x6a41, 0x6a65, 0x6a74, 0x6a77, 0x6a7c, 0x6a7e, 0x6b24, 0x6b27, 0x6b29, 0x6b2a, 0x6b3a, 0x6b3b, 0x6b3d, 0x6b41, 0x6b42, 0x6b46, 0x6b47, 0x6b4c, 0x6b4f, 0x6b50, 0x6b51, 0x6b52, 0x6b58, 0x6c26, 0x6c27, 0x6c2a, 0x6c2f, 0x6c30, 0x6c31, 0x6c32, 0x6c35, 0x6c38, 0x6c3a, 0x6c40, 0x6c41, 0x6c45, 0x6c46, 0x6c49, 0x6c4a, 0x6c55, 0x6c5d, 0x6c5e, 0x6c61, 0x6c64, 0x6c67, 0x6c68, 0x6c77, 0x6c78, 0x6c7a, 0x6d21, 0x6d22, 0x6d23, 0x6d6e, 0x6e5b, 0x723d, 0x727a, 0x7331, 0x7427, 0x746e, 0x7674, 0x7676, 0x7738, 0x7748, 0x7753, 0x785b, 0x7870, 0x7a21, 0x7a22, 0x7a66, 0x7c29, 0x2321, 0x2322, 0x2323, 0x2324, 0x2325, 0x2326, 0x2327, 0x2328, 0x2329, 0x232a, 0x232b, 0x232c, 0x232d, 0x232e, 0x232f, 0x2330, 0x2331, 0x2332, 0x2333, 0x2334, 0x2335, 0x2336, 0x2337, 0x2338, 0x2339, 0x233a, 0x233b, 0x233c, 0x233d, 0x233e, 0x233f, 0x2340, 0x2341, 0x2342, 0x2343, 0x2344, 0x2345, 0x2346, 0x2347, 0x2348, 0x2349, 0x234a, 0x234b, 0x234c, 0x234d, 0x234e, 0x234f, 0x2350, 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, 0x2356, 0x2357, 0x2358, 0x2359, 0x235a, 0x235b, 0x212c, 0x235d, 0x235e, 0x235f, 0x2360, 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, 0x2366, 0x2367, 0x2368, 0x2369, 0x236a, 0x236b, 0x236c, 0x236d, 0x236e, 0x236f, 0x2370, 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, 0x2376, 0x2377, 0x2378, 0x2379, 0x237a, 0x237b, 0x237c, 0x237d, 0x2226, 0x214b, 0x214c, 0x217e, 0x237e, 0x214d, 0x235c, }; static const Summary16 ksc5601_uni2indx_page00[70] = { /* 0x0000 */ { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x2592 }, { 6, 0xf7df }, { 20, 0x0040 }, { 21, 0xc181 }, { 26, 0x0040 }, { 27, 0x4181 }, /* 0x0100 */ { 31, 0x0000 }, { 31, 0x0002 }, { 32, 0x00c0 }, { 34, 0x810e }, { 39, 0x0e07 }, { 45, 0x000c }, { 47, 0x00c0 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, /* 0x0200 */ { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0080 }, { 50, 0x2f01 }, { 56, 0x0000 }, { 56, 0x0000 }, /* 0x0300 */ { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0xfffe }, { 71, 0x03fb }, { 80, 0xfffe }, { 95, 0x03fb }, { 104, 0x0000 }, { 104, 0x0000 }, { 104, 0x0000 }, /* 0x0400 */ { 104, 0x0002 }, { 105, 0xffff }, { 121, 0xffff }, { 137, 0xffff }, { 153, 0xffff }, { 169, 0x0002 }, }; static const Summary16 ksc5601_uni2indx_page20[103] = { /* 0x2000 */ { 170, 0x0000 }, { 170, 0x3320 }, { 175, 0x0063 }, { 179, 0x080d }, { 183, 0x0000 }, { 183, 0x0000 }, { 183, 0x0000 }, { 183, 0x8010 }, { 185, 0x001e }, { 189, 0x0000 }, { 189, 0x0000 }, { 189, 0x0000 }, { 189, 0x0000 }, { 189, 0x0000 }, { 189, 0x0000 }, { 189, 0x0000 }, /* 0x2100 */ { 189, 0x0208 }, { 191, 0x0048 }, { 193, 0x0846 }, { 197, 0x0000 }, { 197, 0x0000 }, { 197, 0x7818 }, { 203, 0x03ff }, { 213, 0x03ff }, { 223, 0x0000 }, { 223, 0x03ff }, { 233, 0x0000 }, { 233, 0x0000 }, { 233, 0x0000 }, { 233, 0x0014 }, { 235, 0x0000 }, { 235, 0x0000 }, /* 0x2200 */ { 235, 0x898d }, { 242, 0x6402 }, { 246, 0x5fa1 }, { 255, 0x3030 }, { 259, 0x0000 }, { 259, 0x0004 }, { 260, 0x0c33 }, { 266, 0x0000 }, { 266, 0x00cc }, { 270, 0x0200 }, { 271, 0x0020 }, { 272, 0x0000 }, { 272, 0x0000 }, { 272, 0x0000 }, { 272, 0x0000 }, { 272, 0x0000 }, /* 0x2300 */ { 272, 0x0000 }, { 272, 0x0004 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, /* 0x2400 */ { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x7fff }, { 288, 0xfff0 }, { 300, 0x0007 }, { 303, 0xf000 }, { 307, 0xffff }, { 323, 0x003f }, { 329, 0x0000 }, { 329, 0xffff }, { 345, 0x03ff }, { 355, 0x0000 }, /* 0x2500 */ { 355, 0xf00f }, { 363, 0xffff }, { 379, 0xffff }, { 395, 0xffff }, { 411, 0x0fff }, { 423, 0x0000 }, { 423, 0x0000 }, { 423, 0x0000 }, { 423, 0x0000 }, { 423, 0x0004 }, { 424, 0x03fb }, { 433, 0x30cc }, { 439, 0xc9c3 }, { 447, 0x0003 }, { 449, 0x0000 }, { 449, 0x0000 }, /* 0x2600 */ { 449, 0xc060 }, { 453, 0x5000 }, { 455, 0x0000 }, { 455, 0x0000 }, { 455, 0x0005 }, { 457, 0x0000 }, { 457, 0x37bb }, }; static const Summary16 ksc5601_uni2indx_page30[62] = { /* 0x3000 */ { 468, 0xff0f }, { 480, 0x003b }, { 485, 0x0000 }, { 485, 0x0000 }, { 485, 0xfffe }, { 500, 0xffff }, { 516, 0xffff }, { 532, 0xffff }, { 548, 0xffff }, { 564, 0x000f }, { 568, 0xfffe }, { 583, 0xffff }, { 599, 0xffff }, { 615, 0xffff }, { 631, 0xffff }, { 647, 0x007f }, /* 0x3100 */ { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0xfffe }, { 669, 0xffff }, { 685, 0xffff }, { 701, 0xffff }, { 717, 0xffff }, { 733, 0x7fff }, { 748, 0x0000 }, { 748, 0x0000 }, { 748, 0x0000 }, { 748, 0x0000 }, { 748, 0x0000 }, { 748, 0x0000 }, { 748, 0x0000 }, /* 0x3200 */ { 748, 0xffff }, { 764, 0x1fff }, { 777, 0x0000 }, { 777, 0x0000 }, { 777, 0x0000 }, { 777, 0x0000 }, { 777, 0xffff }, { 793, 0x8fff }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, /* 0x3300 */ { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0xff1f }, { 819, 0xffff }, { 835, 0xffff }, { 851, 0xffff }, { 867, 0x87ff }, { 879, 0x3949 }, }; static const Summary16 ksc5601_uni2indx_page4e[1306] = { /* 0x4e00 */ { 886, 0x2f8b }, { 895, 0x4372 }, { 902, 0x2000 }, { 903, 0x0b04 }, { 907, 0xe82c }, { 914, 0xe340 }, { 920, 0x2800 }, { 922, 0x40c8 }, { 926, 0x5944 }, { 932, 0x4937 }, { 940, 0x7976 }, { 950, 0x0440 }, { 952, 0x2c93 }, { 959, 0xa3f0 }, { 967, 0x0038 }, { 970, 0x08c5 }, /* 0x4f00 */ { 975, 0xee02 }, { 982, 0x0003 }, { 984, 0x8000 }, { 985, 0x3550 }, { 991, 0xe1c8 }, { 998, 0x1e23 }, { 1005, 0x8200 }, { 1007, 0xc449 }, { 1013, 0xad5a }, { 1022, 0x2942 }, { 1027, 0xc000 }, { 1029, 0x8060 }, { 1032, 0x461c }, { 1038, 0xa49a }, { 1045, 0xc003 }, { 1049, 0x052a }, /* 0x5000 */ { 1054, 0x2a44 }, { 1059, 0xd646 }, { 1067, 0x3dda }, { 1077, 0x0800 }, { 1078, 0x8388 }, { 1083, 0x1420 }, { 1086, 0x0020 }, { 1087, 0x0170 }, { 1091, 0x2021 }, { 1094, 0x0302 }, { 1097, 0x3000 }, { 1099, 0x40ac }, { 1104, 0x8620 }, { 1108, 0x4462 }, { 1113, 0x20a0 }, { 1116, 0x8a00 }, /* 0x5100 */ { 1119, 0x0253 }, { 1124, 0x8004 }, { 1126, 0x0402 }, { 1128, 0x1484 }, { 1132, 0x7bfb }, { 1145, 0x1004 }, { 1147, 0x7fa4 }, { 1157, 0x11e2 }, { 1163, 0x2441 }, { 1167, 0x00a4 }, { 1170, 0x1421 }, { 1174, 0x20c0 }, { 1177, 0x3a50 }, { 1183, 0x7000 }, { 1186, 0x0002 }, { 1187, 0x2743 }, /* 0x5200 */ { 1194, 0x45c9 }, { 1201, 0x2082 }, { 1204, 0x4630 }, { 1209, 0x0fc1 }, { 1216, 0x3c88 }, { 1222, 0x2850 }, { 1226, 0x8602 }, { 1230, 0xa024 }, { 1234, 0x2388 }, { 1239, 0x8806 }, { 1243, 0x0e19 }, { 1249, 0x4000 }, { 1250, 0x22aa }, { 1256, 0xeb64 }, { 1265, 0x001c }, { 1268, 0xcd28 }, /* 0x5300 */ { 1275, 0xa120 }, { 1279, 0x02e1 }, { 1284, 0x840b }, { 1289, 0x8200 }, { 1291, 0x279b }, { 1300, 0x549e }, { 1308, 0x8141 }, { 1312, 0xa0b3 }, { 1319, 0x0010 }, { 1320, 0x8508 }, { 1324, 0x2061 }, { 1328, 0x0800 }, { 1329, 0x2f08 }, { 1335, 0x08d0 }, { 1339, 0xbe3e }, { 1350, 0x010f }, /* 0x5400 */ { 1355, 0xf718 }, { 1364, 0xa803 }, { 1369, 0x0a41 }, { 1373, 0x5b08 }, { 1379, 0x0504 }, { 1382, 0x0002 }, { 1383, 0x0500 }, { 1385, 0x382a }, { 1391, 0x5041 }, { 1395, 0x0001 }, { 1396, 0x1910 }, { 1400, 0x2108 }, { 1403, 0x0313 }, { 1408, 0x0000 }, { 1408, 0x6122 }, { 1413, 0x0404 }, /* 0x5500 */ { 1415, 0x40d0 }, { 1419, 0x1001 }, { 1421, 0x8000 }, { 1422, 0x4022 }, { 1425, 0x8050 }, { 1428, 0x4048 }, { 1431, 0x0008 }, { 1432, 0x1000 }, { 1433, 0x06d1 }, { 1439, 0x3700 }, { 1444, 0x5e80 }, { 1450, 0x0000 }, { 1450, 0x00a0 }, { 1452, 0x9410 }, { 1456, 0x0018 }, { 1458, 0x6000 }, /* 0x5600 */ { 1460, 0x0240 }, { 1462, 0x0090 }, { 1464, 0x8000 }, { 1465, 0x0054 }, { 1468, 0x0000 }, { 1468, 0x0008 }, { 1469, 0x0900 }, { 1471, 0x0010 }, { 1472, 0x0040 }, { 1473, 0x0000 }, { 1473, 0x5020 }, { 1476, 0x1010 }, { 1478, 0x2400 }, { 1480, 0x4c02 }, { 1484, 0x0001 }, { 1485, 0x0601 }, /* 0x5700 */ { 1488, 0x2918 }, { 1493, 0x814c }, { 1498, 0x2100 }, { 1500, 0x0801 }, { 1502, 0x6485 }, { 1508, 0x0003 }, { 1510, 0x4452 }, { 1515, 0x1021 }, { 1518, 0x0904 }, { 1521, 0x0008 }, { 1522, 0x000d }, { 1525, 0x0000 }, { 1525, 0x4988 }, { 1530, 0x8000 }, { 1531, 0x0001 }, { 1532, 0x1691 }, /* 0x5800 */ { 1538, 0x0765 }, { 1545, 0x4000 }, { 1546, 0x8492 }, { 1551, 0x0433 }, { 1556, 0x8c00 }, { 1559, 0x4592 }, { 1565, 0x0016 }, { 1568, 0x5220 }, { 1572, 0x0228 }, { 1575, 0xd008 }, { 1579, 0x4300 }, { 1582, 0x4c08 }, { 1586, 0x40a2 }, { 1590, 0xc32a }, { 1597, 0x9810 }, { 1601, 0x2e00 }, /* 0x5900 */ { 1605, 0x8000 }, { 1606, 0x1670 }, { 1612, 0x6e84 }, { 1619, 0x4082 }, { 1622, 0xc390 }, { 1628, 0x04b3 }, { 1634, 0x7c85 }, { 1642, 0x2118 }, { 1646, 0x041c }, { 1650, 0x02c8 }, { 1654, 0x1120 }, { 1657, 0x4a00 }, { 1660, 0x0a48 }, { 1664, 0x361b }, { 1672, 0x5540 }, { 1677, 0x8900 }, /* 0x5a00 */ { 1680, 0x000a }, { 1682, 0x9902 }, { 1687, 0x0221 }, { 1690, 0x1040 }, { 1692, 0x0242 }, { 1695, 0x0400 }, { 1696, 0x0044 }, { 1698, 0x0000 }, { 1698, 0x0000 }, { 1698, 0x0c04 }, { 1701, 0x0010 }, { 1702, 0x0000 }, { 1702, 0x1216 }, { 1707, 0x0000 }, { 1707, 0x0242 }, { 1710, 0x0000 }, /* 0x5b00 */ { 1710, 0x1a20 }, { 1714, 0x0040 }, { 1715, 0x0400 }, { 1716, 0x0000 }, { 1716, 0x0009 }, { 1718, 0xb5b3 }, { 1728, 0x0a18 }, { 1732, 0x1523 }, { 1738, 0x9ba0 }, { 1745, 0x1fe8 }, { 1754, 0x507c }, { 1761, 0x8379 }, { 1769, 0x10fd }, { 1777, 0xc09d }, { 1784, 0xdbf6 }, { 1796, 0x0560 }, /* 0x5c00 */ { 1800, 0xef92 }, { 1810, 0x0242 }, { 1813, 0x0110 }, { 1815, 0xdf02 }, { 1823, 0x6961 }, { 1830, 0x0822 }, { 1833, 0x9035 }, { 1839, 0x0202 }, { 1841, 0x0000 }, { 1841, 0x0003 }, { 1843, 0x1a02 }, { 1847, 0x45aa }, { 1854, 0x0001 }, { 1855, 0x0200 }, { 1856, 0x8101 }, { 1859, 0x2851 }, /* 0x5d00 */ { 1864, 0x6080 }, { 1867, 0x02d2 }, { 1872, 0x0280 }, { 1874, 0x0000 }, { 1874, 0x1800 }, { 1876, 0x0001 }, { 1877, 0x9200 }, { 1880, 0x0000 }, { 1880, 0x0880 }, { 1882, 0x2000 }, { 1883, 0x0405 }, { 1886, 0x3500 }, { 1890, 0x2000 }, { 1891, 0x6044 }, { 1895, 0x49e6 }, { 1903, 0x609e }, /* 0x5e00 */ { 1910, 0x104c }, { 1914, 0x2a42 }, { 1919, 0x2820 }, { 1922, 0xa148 }, { 1927, 0x10b1 }, { 1932, 0x8020 }, { 1934, 0x000e }, { 1937, 0x7b9c }, { 1947, 0x8490 }, { 1951, 0x14a0 }, { 1955, 0x28c1 }, { 1960, 0x41e0 }, { 1965, 0x0704 }, { 1969, 0x8c49 }, { 1975, 0x100d }, { 1979, 0x0cc8 }, /* 0x5f00 */ { 1984, 0x8412 }, { 1988, 0x89ba }, { 1996, 0x02c0 }, { 1999, 0x1422 }, { 2003, 0x5500 }, { 2007, 0x0ac0 }, { 2011, 0x3ec4 }, { 2019, 0x9283 }, { 2025, 0x1ca3 }, { 2032, 0x4387 }, { 2039, 0x4703 }, { 2045, 0x22a0 }, { 2049, 0x3028 }, { 2053, 0x03c0 }, { 2057, 0x0801 }, { 2059, 0xa020 }, /* 0x6000 */ { 2062, 0x8000 }, { 2063, 0x3044 }, { 2067, 0x85a3 }, { 2074, 0x0000 }, { 2074, 0x200e }, { 2078, 0x2225 }, { 2083, 0xb73c }, { 2093, 0x0001 }, { 2094, 0x3220 }, { 2098, 0x8c50 }, { 2103, 0x0099 }, { 2107, 0x315d }, { 2115, 0x00a0 }, { 2117, 0x9402 }, { 2121, 0x0003 }, { 2123, 0x0e4b }, /* 0x6100 */ { 2130, 0xe342 }, { 2137, 0x8c20 }, { 2141, 0x0080 }, { 2142, 0xd091 }, { 2148, 0x1d94 }, { 2155, 0xa328 }, { 2161, 0x499c }, { 2168, 0x60c1 }, { 2173, 0x4406 }, { 2177, 0x0713 }, { 2183, 0x5a90 }, { 2189, 0x4444 }, { 2193, 0x0f88 }, { 2199, 0x0000 }, { 2199, 0x0040 }, { 2200, 0x95c4 }, /* 0x6200 */ { 2207, 0x7581 }, { 2214, 0x8447 }, { 2220, 0x4402 }, { 2223, 0xc053 }, { 2229, 0x2b83 }, { 2236, 0x0108 }, { 2238, 0x4000 }, { 2239, 0x9242 }, { 2244, 0x0611 }, { 2248, 0x09a6 }, { 2254, 0x0800 }, { 2255, 0x3222 }, { 2260, 0xb384 }, { 2267, 0x1bdd }, { 2277, 0xf000 }, { 2281, 0xc08a }, /* 0x6300 */ { 2286, 0x0282 }, { 2289, 0x0002 }, { 2290, 0x8800 }, { 2292, 0x6c00 }, { 2296, 0x9200 }, { 2299, 0x0021 }, { 2301, 0x4180 }, { 2304, 0x8c84 }, { 2309, 0x1308 }, { 2313, 0x0944 }, { 2317, 0x07a7 }, { 2325, 0x0000 }, { 2325, 0x8051 }, { 2329, 0x0c41 }, { 2333, 0x6002 }, { 2336, 0x00d0 }, /* 0x6400 */ { 2339, 0xa000 }, { 2341, 0x10d0 }, { 2345, 0x3004 }, { 2348, 0x4400 }, { 2350, 0x0000 }, { 2350, 0x0100 }, { 2351, 0x8201 }, { 2354, 0x0700 }, { 2357, 0x0100 }, { 2358, 0x440e }, { 2363, 0x6830 }, { 2368, 0x0805 }, { 2371, 0x64b2 }, { 2378, 0x0514 }, { 2382, 0x10e6 }, { 2388, 0x4414 }, /* 0x6500 */ { 2392, 0x0011 }, { 2394, 0x2100 }, { 2396, 0x9c08 }, { 2401, 0xcbc0 }, { 2408, 0xe120 }, { 2413, 0x40c2 }, { 2417, 0x304c }, { 2422, 0x41b4 }, { 2428, 0x10ac }, { 2433, 0x9a83 }, { 2440, 0x98b2 }, { 2447, 0x3281 }, { 2452, 0x9822 }, { 2457, 0x0084 }, { 2459, 0x3369 }, { 2467, 0xbc12 }, /* 0x6600 */ { 2474, 0xd6c0 }, { 2481, 0xc03b }, { 2488, 0xa1a1 }, { 2494, 0x0c53 }, { 2500, 0x8a1e }, { 2507, 0xea00 }, { 2512, 0xcbf0 }, { 2521, 0x05d8 }, { 2527, 0x4390 }, { 2532, 0x21c3 }, { 2538, 0x4805 }, { 2542, 0x4a1c }, { 2548, 0x02d0 }, { 2552, 0x3240 }, { 2556, 0x0041 }, { 2558, 0xd79d }, /* 0x6700 */ { 2569, 0x2b09 }, { 2575, 0xe8b0 }, { 2582, 0x7dc0 }, { 2590, 0x2452 }, { 2595, 0xc240 }, { 2599, 0xd04b }, { 2606, 0xa000 }, { 2608, 0xc8ab }, { 2616, 0x8a80 }, { 2620, 0x34a9 }, { 2627, 0x8000 }, { 2628, 0x41c9 }, { 2634, 0x8010 }, { 2636, 0x241f }, { 2643, 0x9200 }, { 2646, 0x487b }, /* 0x6800 */ { 2654, 0x0000 }, { 2654, 0x00cc }, { 2658, 0x8406 }, { 2662, 0x3300 }, { 2666, 0x410f }, { 2672, 0x001b }, { 2676, 0x2000 }, { 2677, 0x8040 }, { 2679, 0x8022 }, { 2682, 0xa098 }, { 2687, 0xa186 }, { 2693, 0x006b }, { 2698, 0x2a30 }, { 2703, 0x85a4 }, { 2709, 0x4181 }, { 2713, 0x0604 }, /* 0x6900 */ { 2716, 0x6021 }, { 2720, 0x0004 }, { 2721, 0x0080 }, { 2722, 0xa001 }, { 2725, 0x0400 }, { 2726, 0x46b8 }, { 2733, 0xe90f }, { 2742, 0x03a0 }, { 2746, 0x0000 }, { 2746, 0x1820 }, { 2749, 0x40a0 }, { 2752, 0x0810 }, { 2754, 0x380a }, { 2759, 0x0001 }, { 2760, 0x0500 }, { 2762, 0xa800 }, /* 0x6a00 */ { 2765, 0x0404 }, { 2767, 0xc28a }, { 2773, 0x000a }, { 2775, 0x2720 }, { 2780, 0x0910 }, { 2783, 0x830c }, { 2788, 0x0802 }, { 2790, 0x0000 }, { 2790, 0x6211 }, { 2795, 0x1080 }, { 2797, 0x000c }, { 2799, 0x0808 }, { 2801, 0x000c }, { 2803, 0x0c08 }, { 2806, 0x0000 }, { 2806, 0x0840 }, /* 0x6b00 */ { 2808, 0x1410 }, { 2811, 0x0044 }, { 2813, 0x000b }, { 2816, 0x6404 }, { 2820, 0x50c0 }, { 2824, 0x8001 }, { 2826, 0x047e }, { 2833, 0x8984 }, { 2838, 0x0658 }, { 2843, 0x4140 }, { 2846, 0xc000 }, { 2848, 0x94a4 }, { 2854, 0xa862 }, { 2860, 0x09dc }, { 2867, 0x1800 }, { 2869, 0x0000 }, /* 0x6c00 */ { 2869, 0x8100 }, { 2871, 0x000a }, { 2873, 0x0008 }, { 2874, 0x4190 }, { 2878, 0x4007 }, { 2882, 0xe4a1 }, { 2889, 0x2501 }, { 2893, 0x6445 }, { 2899, 0x11ee }, { 2907, 0x0e7d }, { 2916, 0x4800 }, { 2918, 0xfb08 }, { 2926, 0x1616 }, { 2932, 0x08a8 }, { 2936, 0xc92e }, { 2944, 0x0009 }, /* 0x6d00 */ { 2946, 0x1800 }, { 2948, 0x4a82 }, { 2953, 0x06a0 }, { 2957, 0x6b64 }, { 2965, 0x0002 }, { 2966, 0x1600 }, { 2969, 0x5648 }, { 2975, 0x8390 }, { 2980, 0x73a0 }, { 2987, 0x002a }, { 2990, 0x8000 }, { 2991, 0x0024 }, { 2993, 0x88f9 }, { 3001, 0x4702 }, { 3006, 0x4d02 }, { 3011, 0x0faa }, /* 0x6e00 */ { 3019, 0x0000 }, { 3019, 0x8e80 }, { 3024, 0xb87b }, { 3034, 0x7554 }, { 3042, 0x2418 }, { 3046, 0xd940 }, { 3052, 0xc880 }, { 3056, 0x040c }, { 3059, 0x0000 }, { 3059, 0xb041 }, { 3064, 0x8c24 }, { 3069, 0x0442 }, { 3072, 0x5a34 }, { 3079, 0x001a }, { 3082, 0x8000 }, { 3083, 0xc110 }, /* 0x6f00 */ { 3087, 0x8046 }, { 3091, 0x0032 }, { 3094, 0x180d }, { 3099, 0x8106 }, { 3103, 0x0002 }, { 3104, 0xcd92 }, { 3112, 0x6014 }, { 3116, 0x7401 }, { 3121, 0x6112 }, { 3126, 0x0091 }, { 3129, 0xc098 }, { 3134, 0x420a }, { 3138, 0x040f }, { 3143, 0x8420 }, { 3146, 0x9a13 }, { 3153, 0x4002 }, /* 0x7000 */ { 3155, 0x8a62 }, { 3161, 0xfd22 }, { 3170, 0x8188 }, { 3174, 0x4080 }, { 3176, 0x1000 }, { 3177, 0x2103 }, { 3181, 0x0808 }, { 3183, 0x3101 }, { 3187, 0x4420 }, { 3190, 0x0704 }, { 3194, 0xb812 }, { 3200, 0x0388 }, { 3204, 0x8900 }, { 3207, 0xa300 }, { 3211, 0x0000 }, { 3211, 0x2202 }, /* 0x7100 */ { 3214, 0x1210 }, { 3217, 0x4600 }, { 3220, 0x0042 }, { 3222, 0x0041 }, { 3224, 0x5680 }, { 3229, 0x5241 }, { 3234, 0x52f0 }, { 3241, 0x2000 }, { 3242, 0x8610 }, { 3246, 0x8214 }, { 3250, 0x1004 }, { 3252, 0x4602 }, { 3256, 0x430a }, { 3261, 0x8035 }, { 3266, 0x60e0 }, { 3271, 0xd800 }, /* 0x7200 */ { 3275, 0x0041 }, { 3277, 0x0801 }, { 3279, 0x3400 }, { 3282, 0x6c65 }, { 3290, 0x11c1 }, { 3295, 0xab04 }, { 3301, 0x0286 }, { 3305, 0x2204 }, { 3308, 0x0003 }, { 3310, 0x0000 }, { 3310, 0x9084 }, { 3314, 0x0000 }, { 3314, 0x4015 }, { 3318, 0x0281 }, { 3321, 0x0202 }, { 3323, 0x3300 }, /* 0x7300 */ { 3327, 0x0400 }, { 3328, 0x3840 }, { 3332, 0x0e20 }, { 3336, 0xc0c0 }, { 3340, 0x0030 }, { 3342, 0x0085 }, { 3345, 0x0500 }, { 3347, 0x0d25 }, { 3353, 0x4ad0 }, { 3359, 0x81d0 }, { 3364, 0x2280 }, { 3367, 0x020c }, { 3370, 0xb605 }, { 3377, 0x6240 }, { 3381, 0x2679 }, { 3389, 0x6280 }, /* 0x7400 */ { 3393, 0x02ea }, { 3399, 0x0808 }, { 3401, 0xdd67 }, { 3412, 0x8579 }, { 3420, 0x081b }, { 3425, 0xdea0 }, { 3433, 0x8735 }, { 3441, 0x4000 }, { 3442, 0x0a8c }, { 3447, 0xd100 }, { 3451, 0x05aa }, { 3457, 0xa225 }, { 3463, 0x8440 }, { 3466, 0x1510 }, { 3470, 0x404d }, { 3475, 0x0080 }, /* 0x7500 */ { 3476, 0x0012 }, { 3478, 0x8d22 }, { 3484, 0x1968 }, { 3490, 0x058f }, { 3497, 0x9080 }, { 3500, 0x3a1a }, { 3507, 0x8464 }, { 3512, 0x8561 }, { 3518, 0xccc0 }, { 3524, 0x2002 }, { 3526, 0x0820 }, { 3528, 0x732e }, { 3537, 0x20a4 }, { 3541, 0x0b34 }, { 3547, 0x0004 }, { 3548, 0x1415 }, /* 0x7600 */ { 3553, 0x2001 }, { 3555, 0x8200 }, { 3557, 0x0057 }, { 3562, 0x0800 }, { 3563, 0x5004 }, { 3566, 0x0044 }, { 3568, 0x1212 }, { 3572, 0x7905 }, { 3579, 0x40d0 }, { 3583, 0x0009 }, { 3585, 0x4000 }, { 3586, 0x8400 }, { 3588, 0x054c }, { 3593, 0xd844 }, { 3599, 0x409a }, { 3604, 0x5114 }, /* 0x7700 */ { 3609, 0x0b12 }, { 3614, 0x4000 }, { 3615, 0x0201 }, { 3617, 0x1580 }, { 3621, 0x2001 }, { 3623, 0x0800 }, { 3624, 0x084a }, { 3628, 0xc200 }, { 3631, 0x0800 }, { 3632, 0x4002 }, { 3634, 0x3020 }, { 3637, 0x9809 }, { 3642, 0x0000 }, { 3642, 0x1880 }, { 3645, 0xe22c }, { 3652, 0x0008 }, /* 0x7800 */ { 3653, 0x0004 }, { 3654, 0x0004 }, { 3655, 0x10e0 }, { 3659, 0x0014 }, { 3661, 0x8020 }, { 3663, 0x2000 }, { 3664, 0x9800 }, { 3667, 0x1000 }, { 3668, 0x7082 }, { 3673, 0x0082 }, { 3675, 0x0288 }, { 3678, 0x1c00 }, { 3681, 0x4c22 }, { 3686, 0x0001 }, { 3687, 0x9100 }, { 3690, 0x0820 }, /* 0x7900 */ { 3692, 0x4002 }, { 3694, 0x0040 }, { 3695, 0x1c00 }, { 3698, 0x4400 }, { 3700, 0x0383 }, { 3705, 0x7cc1 }, { 3713, 0x2121 }, { 3717, 0x8400 }, { 3719, 0xe002 }, { 3723, 0x0002 }, { 3724, 0x44c0 }, { 3728, 0xe20a }, { 3734, 0x0e03 }, { 3739, 0x8126 }, { 3744, 0x02d0 }, { 3748, 0x0800 }, /* 0x7a00 */ { 3749, 0x2921 }, { 3754, 0x9690 }, { 3760, 0x4001 }, { 3762, 0xb8c2 }, { 3769, 0x6241 }, { 3774, 0x0080 }, { 3775, 0x0a06 }, { 3779, 0xa651 }, { 3786, 0x0112 }, { 3789, 0x812c }, { 3794, 0xc600 }, { 3798, 0x0400 }, { 3799, 0x0cb0 }, { 3804, 0xa280 }, { 3808, 0xa429 }, { 3814, 0x8640 }, /* 0x7b00 */ { 3818, 0x8000 }, { 3819, 0x4a02 }, { 3823, 0x3041 }, { 3827, 0x0200 }, { 3828, 0xba40 }, { 3834, 0x0057 }, { 3839, 0x5001 }, { 3842, 0x2020 }, { 3844, 0x8880 }, { 3847, 0x24b0 }, { 3852, 0x2002 }, { 3854, 0x0112 }, { 3857, 0x02d3 }, { 3863, 0x0004 }, { 3864, 0x0211 }, { 3867, 0x0000 }, /* 0x7c00 */ { 3867, 0x0080 }, { 3868, 0x4004 }, { 3870, 0x0c82 }, { 3874, 0xe000 }, { 3877, 0x3008 }, { 3880, 0x0000 }, { 3880, 0x1011 }, { 3883, 0x0008 }, { 3884, 0x0208 }, { 3886, 0x81a4 }, { 3891, 0x40a0 }, { 3894, 0x420e }, { 3899, 0x0400 }, { 3900, 0xc040 }, { 3903, 0x0081 }, { 3905, 0x4800 }, /* 0x7d00 */ { 3907, 0x2df5 }, { 3917, 0x0f91 }, { 3924, 0xd807 }, { 3931, 0x0629 }, { 3936, 0x007c }, { 3941, 0x4001 }, { 3943, 0x4546 }, { 3949, 0x824e }, { 3955, 0xc000 }, { 3957, 0x1008 }, { 3959, 0x3005 }, { 3963, 0xed36 }, { 3973, 0x0c80 }, { 3976, 0x6540 }, { 3981, 0x930b }, { 3988, 0x0810 }, /* 0x7e00 */ { 3990, 0x0600 }, { 3992, 0xe820 }, { 3997, 0xc80a }, { 4002, 0x6082 }, { 4006, 0x00ca }, { 4010, 0x4034 }, { 4014, 0x2e02 }, { 4019, 0x1201 }, { 4022, 0x9004 }, { 4025, 0x1948 }, { 4030, 0x0000 }, { 4030, 0x0000 }, { 4030, 0x0000 }, { 4030, 0x0000 }, { 4030, 0x0000 }, { 4030, 0x0000 }, /* 0x7f00 */ { 4030, 0x0000 }, { 4030, 0x0000 }, { 4030, 0x0000 }, { 4030, 0x0540 }, { 4033, 0x1000 }, { 4034, 0x0031 }, { 4037, 0x4c00 }, { 4040, 0x02a5 }, { 4045, 0x5520 }, { 4050, 0x4410 }, { 4053, 0x0310 }, { 4056, 0x2304 }, { 4060, 0x5422 }, { 4065, 0x8034 }, { 4069, 0x0a03 }, { 4073, 0x1201 }, /* 0x8000 */ { 4076, 0x126b }, { 4083, 0x01a1 }, { 4087, 0x2000 }, { 4088, 0xa048 }, { 4092, 0x0448 }, { 4095, 0x4540 }, { 4099, 0x8000 }, { 4100, 0xe08d }, { 4107, 0x1af0 }, { 4114, 0x2840 }, { 4117, 0x8626 }, { 4123, 0x0416 }, { 4127, 0x5018 }, { 4131, 0x4c00 }, { 4134, 0x0032 }, { 4137, 0x2112 }, /* 0x8100 */ { 4141, 0x05e4 }, { 4147, 0x0d00 }, { 4150, 0x8a08 }, { 4154, 0x4200 }, { 4156, 0x4800 }, { 4158, 0x0033 }, { 4162, 0x0860 }, { 4165, 0x8703 }, { 4171, 0x8501 }, { 4175, 0x3400 }, { 4178, 0x0109 }, { 4181, 0xe428 }, { 4187, 0x2045 }, { 4191, 0x8100 }, { 4193, 0x25a8 }, { 4199, 0x5c18 }, /* 0x8200 */ { 4205, 0x35a0 }, { 4211, 0xd804 }, { 4216, 0x1c02 }, { 4220, 0x02e0 }, { 4224, 0x00a1 }, { 4227, 0x0200 }, { 4228, 0xc050 }, { 4232, 0x4146 }, { 4237, 0x6800 }, { 4240, 0xa604 }, { 4245, 0xf260 }, { 4252, 0xbb8a }, { 4261, 0x0000 }, { 4261, 0xc8b6 }, { 4269, 0x00e2 }, { 4273, 0x6002 }, /* 0x8300 */ { 4276, 0x023e }, { 4282, 0x0080 }, { 4283, 0x8900 }, { 4286, 0x0372 }, { 4292, 0x8681 }, { 4297, 0x0006 }, { 4299, 0x0000 }, { 4299, 0x0888 }, { 4302, 0x4600 }, { 4305, 0x4140 }, { 4308, 0x0e04 }, { 4312, 0x2000 }, { 4313, 0x1622 }, { 4318, 0x1048 }, { 4321, 0x8a00 }, { 4324, 0x2217 }, /* 0x8400 */ { 4330, 0x7418 }, { 4336, 0x0000 }, { 4336, 0x1200 }, { 4338, 0x2102 }, { 4341, 0x0200 }, { 4342, 0x0880 }, { 4344, 0x984a }, { 4350, 0x0420 }, { 4352, 0x0000 }, { 4352, 0x1211 }, { 4356, 0x0002 }, { 4357, 0x9904 }, { 4362, 0x2a55 }, { 4369, 0x0402 }, { 4371, 0x5000 }, { 4373, 0x1010 }, /* 0x8500 */ { 4375, 0x0000 }, { 4375, 0x459a }, { 4382, 0xb02a }, { 4388, 0xa000 }, { 4390, 0x420a }, { 4394, 0x0208 }, { 4396, 0x2708 }, { 4401, 0x0000 }, { 4401, 0x8090 }, { 4404, 0x0812 }, { 4407, 0x8740 }, { 4412, 0x0401 }, { 4414, 0xe202 }, { 4419, 0x3020 }, { 4422, 0x0630 }, { 4426, 0x8c80 }, /* 0x8600 */ { 4430, 0x04c4 }, { 4434, 0x04c0 }, { 4437, 0x2000 }, { 4438, 0x8000 }, { 4439, 0x4000 }, { 4440, 0xd831 }, { 4447, 0x0080 }, { 4448, 0x0200 }, { 4449, 0x1400 }, { 4451, 0x0008 }, { 4452, 0x0218 }, { 4455, 0x0000 }, { 4455, 0x0880 }, { 4457, 0x8a10 }, { 4461, 0x2010 }, { 4463, 0x4000 }, /* 0x8700 */ { 4464, 0x010d }, { 4468, 0x1500 }, { 4471, 0x0000 }, { 4471, 0x0000 }, { 4471, 0x4000 }, { 4472, 0x80a0 }, { 4475, 0x0140 }, { 4477, 0x0150 }, { 4480, 0x2004 }, { 4482, 0x8000 }, { 4483, 0x0004 }, { 4484, 0x0408 }, { 4486, 0x0010 }, { 4487, 0x0000 }, { 4487, 0x9001 }, { 4490, 0x4a04 }, /* 0x8800 */ { 4494, 0x0020 }, { 4495, 0x8000 }, { 4496, 0x000c }, { 4498, 0x0842 }, { 4501, 0x3041 }, { 4505, 0x2a8c }, { 4511, 0x090e }, { 4516, 0xc085 }, { 4521, 0x2906 }, { 4526, 0x40c4 }, { 4530, 0x0800 }, { 4531, 0x0010 }, { 4532, 0x8006 }, { 4535, 0xb230 }, { 4541, 0x0102 }, { 4543, 0x2138 }, /* 0x8900 */ { 4548, 0x0080 }, { 4549, 0x030d }, { 4554, 0x0420 }, { 4556, 0x0940 }, { 4559, 0x0012 }, { 4561, 0x8000 }, { 4562, 0x0410 }, { 4564, 0x8004 }, { 4566, 0x88ca }, { 4572, 0x0048 }, { 4574, 0x0602 }, { 4577, 0x2404 }, { 4580, 0x0001 }, { 4581, 0x0004 }, { 4582, 0x0008 }, { 4583, 0x0110 }, /* 0x8a00 */ { 4585, 0x550d }, { 4592, 0xa9c8 }, { 4599, 0x2428 }, { 4603, 0x0c52 }, { 4608, 0x0000 }, { 4608, 0x4831 }, { 4613, 0x624d }, { 4620, 0x022f }, { 4626, 0x30a0 }, { 4630, 0x4128 }, { 4634, 0x057b }, { 4642, 0xd205 }, { 4648, 0xa894 }, { 4654, 0x1844 }, { 4658, 0x6cc2 }, { 4665, 0x45c2 }, /* 0x8b00 */ { 4671, 0x4017 }, { 4676, 0x2ed1 }, { 4684, 0x1901 }, { 4688, 0x0208 }, { 4690, 0xc202 }, { 4694, 0x1500 }, { 4697, 0x9040 }, { 4700, 0x2091 }, { 4704, 0x0401 }, { 4706, 0x044d }, { 4711, 0x0000 }, { 4711, 0x0000 }, { 4711, 0x0000 }, { 4711, 0x0000 }, { 4711, 0x0000 }, { 4711, 0x0000 }, /* 0x8c00 */ { 4711, 0x0000 }, { 4711, 0x0000 }, { 4711, 0x0000 }, { 4711, 0x8080 }, { 4713, 0x1542 }, { 4718, 0x0420 }, { 4720, 0x0c02 }, { 4723, 0x0600 }, { 4725, 0x1404 }, { 4728, 0x6000 }, { 4730, 0x9f87 }, { 4740, 0xb9d9 }, { 4750, 0x059f }, { 4758, 0x540a }, { 4763, 0x245d }, { 4770, 0x3810 }, /* 0x8d00 */ { 4774, 0x25b0 }, { 4780, 0x0048 }, { 4782, 0x0000 }, { 4782, 0x0000 }, { 4782, 0x0000 }, { 4782, 0x0000 }, { 4782, 0x0850 }, { 4785, 0x0099 }, { 4789, 0x0420 }, { 4791, 0x0200 }, { 4792, 0x0108 }, { 4794, 0x4408 }, { 4797, 0x9840 }, { 4801, 0x2800 }, { 4803, 0x810a }, { 4807, 0x0008 }, /* 0x8e00 */ { 4808, 0x8400 }, { 4810, 0x4001 }, { 4812, 0x0400 }, { 4813, 0x0021 }, { 4815, 0x0794 }, { 4821, 0x8200 }, { 4823, 0x0001 }, { 4824, 0x0050 }, { 4826, 0x2482 }, { 4830, 0x0000 }, { 4830, 0x1c00 }, { 4833, 0x0000 }, { 4833, 0x3c01 }, { 4838, 0x8004 }, { 4840, 0x0800 }, { 4841, 0x4900 }, /* 0x8f00 */ { 4844, 0x0228 }, { 4847, 0xf83c }, { 4856, 0x86c0 }, { 4861, 0xcb08 }, { 4867, 0x6230 }, { 4872, 0xa000 }, { 4874, 0x0004 }, { 4875, 0x0000 }, { 4875, 0x0000 }, { 4875, 0x1800 }, { 4877, 0xa148 }, { 4882, 0x0007 }, { 4885, 0x4024 }, { 4888, 0x0012 }, { 4890, 0x2c40 }, { 4894, 0x2285 }, /* 0x9000 */ { 4899, 0xa96f }, { 4909, 0xe6b3 }, { 4919, 0x400f }, { 4924, 0x5126 }, { 4930, 0x6c86 }, { 4937, 0x723b }, { 4946, 0xe20b }, { 4953, 0xb5a4 }, { 4961, 0x859f }, { 4970, 0x0222 }, { 4973, 0x854c }, { 4979, 0x0123 }, { 4983, 0x0402 }, { 4985, 0x4000 }, { 4986, 0x2102 }, { 4989, 0x2020 }, /* 0x9100 */ { 4991, 0x0004 }, { 4992, 0x0224 }, { 4995, 0x2080 }, { 4997, 0x0004 }, { 4998, 0x7e00 }, { 5004, 0x0004 }, { 5005, 0x1604 }, { 5009, 0x01a0 }, { 5012, 0x2a80 }, { 5016, 0x1004 }, { 5018, 0xd800 }, { 5022, 0x0032 }, { 5025, 0xfa81 }, { 5033, 0x3183 }, { 5039, 0x0488 }, { 5042, 0x0020 }, /* 0x9200 */ { 5043, 0x2000 }, { 5044, 0x4087 }, { 5049, 0x0000 }, { 5049, 0x8410 }, { 5052, 0x0221 }, { 5055, 0x4880 }, { 5058, 0x0074 }, { 5062, 0x0000 }, { 5062, 0x0029 }, { 5065, 0x114a }, { 5070, 0x0000 }, { 5070, 0x02c8 }, { 5074, 0x9000 }, { 5076, 0x0004 }, { 5077, 0x0410 }, { 5079, 0x1100 }, /* 0x9300 */ { 5081, 0x0010 }, { 5082, 0xc501 }, { 5087, 0xc957 }, { 5096, 0x0000 }, { 5096, 0x2d00 }, { 5100, 0x0810 }, { 5102, 0x4000 }, { 5103, 0x5020 }, { 5106, 0x1000 }, { 5107, 0x0450 }, { 5110, 0x3088 }, { 5114, 0x0001 }, { 5115, 0x0008 }, { 5116, 0x4002 }, { 5118, 0x0012 }, { 5120, 0x0040 }, /* 0x9400 */ { 5121, 0x0010 }, { 5122, 0x0100 }, { 5123, 0x0820 }, { 5125, 0x0120 }, { 5127, 0x0010 }, { 5128, 0x0806 }, { 5131, 0x0000 }, { 5131, 0xa000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, /* 0x9500 */ { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0080 }, { 5134, 0x8a09 }, { 5139, 0x011e }, { 5144, 0x2138 }, { 5149, 0x1802 }, { 5152, 0x0480 }, { 5154, 0x1070 }, { 5158, 0x0006 }, { 5160, 0x0000 }, /* 0x9600 */ { 5160, 0x0000 }, { 5160, 0x1000 }, { 5161, 0x4402 }, { 5164, 0x8804 }, { 5167, 0x3815 }, { 5173, 0xf801 }, { 5179, 0x041c }, { 5183, 0x21e9 }, { 5190, 0x6c60 }, { 5196, 0x1b30 }, { 5202, 0x0588 }, { 5206, 0x0882 }, { 5209, 0x7af3 }, { 5220, 0x1a60 }, { 5225, 0x870c }, { 5231, 0x0ac5 }, /* 0x9700 */ { 5237, 0x00c1 }, { 5240, 0x524a }, { 5246, 0x0080 }, { 5247, 0x2205 }, { 5251, 0x0114 }, { 5254, 0x5042 }, { 5258, 0x2206 }, { 5262, 0x0490 }, { 5265, 0xa800 }, { 5268, 0x0000 }, { 5268, 0x2901 }, { 5272, 0x0000 }, { 5272, 0x0840 }, { 5274, 0x1008 }, { 5276, 0x0000 }, { 5276, 0x8848 }, /* 0x9800 */ { 5280, 0x156f }, { 5289, 0x018f }, { 5295, 0x2000 }, { 5296, 0x0b01 }, { 5300, 0x7040 }, { 5304, 0x4510 }, { 5308, 0x88a0 }, { 5312, 0x0000 }, { 5312, 0x0000 }, { 5312, 0x0000 }, { 5312, 0x8100 }, { 5314, 0x0002 }, { 5315, 0x0090 }, { 5317, 0x9800 }, { 5320, 0xe006 }, { 5325, 0x7010 }, /* 0x9900 */ { 5329, 0x1608 }, { 5333, 0x4109 }, { 5337, 0x0101 }, { 5339, 0x0000 }, { 5339, 0x3a20 }, { 5344, 0x0096 }, { 5348, 0x0000 }, { 5348, 0x0000 }, { 5348, 0x0000 }, { 5348, 0x2240 }, { 5351, 0x7120 }, { 5356, 0x021a }, { 5360, 0x0002 }, { 5361, 0xa227 }, { 5368, 0x2000 }, { 5369, 0x8002 }, /* 0x9a00 */ { 5371, 0xc102 }, { 5375, 0x0200 }, { 5376, 0x0800 }, { 5377, 0x00c1 }, { 5380, 0x2029 }, { 5384, 0x8ca0 }, { 5389, 0x0624 }, { 5393, 0x0000 }, { 5393, 0x0000 }, { 5393, 0x0000 }, { 5393, 0x0100 }, { 5394, 0x0100 }, { 5395, 0x0000 }, { 5395, 0x0118 }, { 5398, 0x4020 }, { 5400, 0x0000 }, /* 0x9b00 */ { 5400, 0x0000 }, { 5400, 0x0400 }, { 5401, 0x0480 }, { 5403, 0x1002 }, { 5405, 0x803e }, { 5411, 0x0410 }, { 5413, 0x8000 }, { 5414, 0x0000 }, { 5414, 0x4000 }, { 5415, 0x8002 }, { 5417, 0x4800 }, { 5419, 0x0000 }, { 5419, 0x0200 }, { 5420, 0x0040 }, { 5421, 0x0110 }, { 5423, 0x0000 }, /* 0x9c00 */ { 5423, 0x2000 }, { 5424, 0x0025 }, { 5427, 0x0020 }, { 5428, 0x0804 }, { 5430, 0x0280 }, { 5432, 0x0080 }, { 5433, 0x0000 }, { 5433, 0x0000 }, { 5433, 0x0000 }, { 5433, 0x0000 }, { 5433, 0x0000 }, { 5433, 0x0000 }, { 5433, 0x0000 }, { 5433, 0x0000 }, { 5433, 0x02a0 }, { 5436, 0x0058 }, /* 0x9d00 */ { 5439, 0x0200 }, { 5440, 0x0800 }, { 5441, 0x0140 }, { 5443, 0x0800 }, { 5444, 0x0000 }, { 5444, 0x2002 }, { 5446, 0x1003 }, { 5449, 0x0004 }, { 5450, 0x0000 }, { 5450, 0x0000 }, { 5450, 0x8200 }, { 5452, 0x0010 }, { 5453, 0x0010 }, { 5454, 0x0080 }, { 5455, 0x0000 }, { 5455, 0x0704 }, /* 0x9e00 */ { 5459, 0x0000 }, { 5459, 0x4400 }, { 5461, 0x0000 }, { 5461, 0x0000 }, { 5461, 0x0000 }, { 5461, 0x0000 }, { 5461, 0x0000 }, { 5461, 0xa220 }, { 5465, 0x0000 }, { 5465, 0xa08c }, { 5470, 0x0020 }, { 5471, 0x4830 }, { 5475, 0x6008 }, { 5478, 0x5912 }, { 5484, 0x0100 }, { 5485, 0x0010 }, /* 0x9f00 */ { 5486, 0x4180 }, { 5489, 0x0008 }, { 5490, 0x0001 }, { 5491, 0x0800 }, { 5492, 0x4c00 }, { 5495, 0x8004 }, { 5497, 0x1482 }, { 5501, 0x0080 }, { 5502, 0x2000 }, { 5503, 0x1021 }, }; static const Summary16 ksc5601_uni2indx_pageac[698] = { /* 0xac00 */ { 5506, 0x0793 }, { 5513, 0x3eff }, { 5526, 0xb011 }, { 5531, 0x1303 }, { 5536, 0x2801 }, { 5539, 0x1110 }, { 5542, 0x0000 }, { 5542, 0x0593 }, { 5548, 0x1e7b }, { 5558, 0xb011 }, { 5563, 0x9703 }, { 5570, 0x3b01 }, { 5576, 0x1112 }, { 5580, 0x00a0 }, { 5582, 0x9593 }, { 5590, 0x306b }, /* 0xad00 */ { 5597, 0xb051 }, { 5603, 0x1102 }, { 5606, 0x3201 }, { 5610, 0x1130 }, { 5614, 0x02b0 }, { 5618, 0x0111 }, { 5621, 0x300a }, { 5625, 0xb879 }, { 5634, 0x1306 }, { 5639, 0x3001 }, { 5642, 0x0010 }, { 5643, 0x0080 }, { 5644, 0x0113 }, { 5648, 0x100b }, { 5652, 0x0011 }, { 5654, 0x9300 }, /* 0xae00 */ { 5658, 0x2b03 }, { 5664, 0x0010 }, { 5665, 0x0000 }, { 5665, 0x0593 }, { 5671, 0x746b }, { 5680, 0xb051 }, { 5686, 0x1323 }, { 5692, 0x3b01 }, { 5698, 0x1030 }, { 5701, 0x0000 }, { 5701, 0x0000 }, { 5701, 0x7000 }, { 5704, 0xb011 }, { 5709, 0x1303 }, { 5714, 0x2900 }, { 5717, 0x1110 }, /* 0xaf00 */ { 5720, 0x2180 }, { 5723, 0x0001 }, { 5724, 0x3000 }, { 5726, 0xb015 }, { 5732, 0x030e }, { 5737, 0x3001 }, { 5740, 0x0030 }, { 5742, 0x0200 }, { 5743, 0x0111 }, { 5746, 0x1023 }, { 5750, 0x0000 }, { 5750, 0x1300 }, { 5753, 0x6b81 }, { 5760, 0x1010 }, { 5762, 0x0300 }, { 5764, 0x0113 }, /* 0xb000 */ { 5768, 0x1013 }, { 5772, 0x3011 }, { 5776, 0x0100 }, { 5777, 0x0000 }, { 5777, 0x5530 }, { 5783, 0x22b8 }, { 5789, 0x0000 }, { 5789, 0x3000 }, { 5791, 0xb011 }, { 5796, 0x9702 }, { 5802, 0xfb07 }, { 5812, 0x113a }, { 5818, 0x03b0 }, { 5823, 0x0113 }, { 5827, 0x0021 }, { 5829, 0x0000 }, /* 0xb100 */ { 5829, 0x1b00 }, { 5833, 0x3b0d }, { 5841, 0x1138 }, { 5846, 0x03b0 }, { 5851, 0x0113 }, { 5855, 0x1133 }, { 5861, 0x0001 }, { 5862, 0x1300 }, { 5865, 0x2b05 }, { 5871, 0x111c }, { 5876, 0x0100 }, { 5877, 0x0000 }, { 5877, 0x1000 }, { 5878, 0xb011 }, { 5883, 0x1300 }, { 5886, 0x2a01 }, /* 0xb200 */ { 5890, 0x1930 }, { 5895, 0x02b0 }, { 5899, 0x0001 }, { 5900, 0x1010 }, { 5902, 0x0000 }, { 5902, 0x1100 }, { 5904, 0x0301 }, { 5907, 0x1030 }, { 5910, 0x0230 }, { 5913, 0x0713 }, { 5919, 0x146b }, { 5926, 0x0011 }, { 5928, 0x1300 }, { 5931, 0x2b05 }, { 5937, 0xf974 }, { 5947, 0x8fb8 }, /* 0xb300 */ { 5956, 0x0113 }, { 5960, 0x103b }, { 5966, 0x0000 }, { 5966, 0x0000 }, { 5966, 0x0000 }, { 5966, 0xd970 }, { 5974, 0x4ab0 }, { 5980, 0x0113 }, { 5984, 0x103b }, { 5990, 0x0011 }, { 5992, 0x1103 }, { 5996, 0x0000 }, { 5996, 0x5930 }, { 6002, 0x2ab1 }, { 6009, 0x0111 }, { 6012, 0x1000 }, /* 0xb400 */ { 6013, 0x0000 }, { 6013, 0x1101 }, { 6016, 0x0b01 }, { 6020, 0x0010 }, { 6021, 0x0000 }, { 6021, 0x0113 }, { 6025, 0x102b }, { 6030, 0x0000 }, { 6030, 0x0101 }, { 6032, 0x2000 }, { 6033, 0x1110 }, { 6036, 0x02a0 }, { 6039, 0x0111 }, { 6042, 0x3021 }, { 6046, 0xb059 }, { 6053, 0x0102 }, /* 0xb500 */ { 6055, 0x0000 }, { 6055, 0x1930 }, { 6060, 0x07b0 }, { 6066, 0x0113 }, { 6070, 0x383b }, { 6078, 0xb011 }, { 6083, 0x0003 }, { 6085, 0x0000 }, { 6085, 0x0000 }, { 6085, 0x0000 }, { 6085, 0x0d13 }, { 6091, 0x383b }, { 6099, 0xb011 }, { 6104, 0x0103 }, { 6107, 0x1000 }, { 6108, 0x0000 }, /* 0xb600 */ { 6108, 0x0000 }, { 6108, 0x0113 }, { 6112, 0x1020 }, { 6114, 0x0010 }, { 6115, 0x0100 }, { 6116, 0x0000 }, { 6116, 0x0110 }, { 6118, 0x0000 }, { 6118, 0x0000 }, { 6118, 0x3000 }, { 6120, 0x1811 }, { 6124, 0x0002 }, { 6125, 0x0000 }, { 6125, 0x0010 }, { 6126, 0x0000 }, { 6126, 0x0111 }, /* 0xb700 */ { 6129, 0x0023 }, { 6132, 0x0000 }, { 6132, 0x9300 }, { 6136, 0x0b01 }, { 6140, 0x1110 }, { 6143, 0x0030 }, { 6145, 0x0111 }, { 6148, 0x302b }, { 6154, 0xb011 }, { 6159, 0x13c7 }, { 6167, 0x3b01 }, { 6173, 0x0130 }, { 6176, 0x0280 }, { 6178, 0x0000 }, { 6178, 0x3000 }, { 6180, 0xb011 }, /* 0xb800 */ { 6185, 0x1383 }, { 6191, 0x2b01 }, { 6196, 0x1130 }, { 6200, 0x03b0 }, { 6205, 0x0011 }, { 6207, 0x300a }, { 6211, 0xb011 }, { 6216, 0x1102 }, { 6219, 0x2000 }, { 6220, 0x0000 }, { 6220, 0x0100 }, { 6221, 0x0111 }, { 6224, 0x102b }, { 6229, 0xa011 }, { 6233, 0x1302 }, { 6237, 0x2b01 }, /* 0xb900 */ { 6242, 0x0010 }, { 6243, 0x0100 }, { 6244, 0x0001 }, { 6245, 0x3000 }, { 6247, 0x9011 }, { 6251, 0x1302 }, { 6255, 0x2b01 }, { 6260, 0x1130 }, { 6264, 0x66b0 }, { 6271, 0x0000 }, { 6271, 0x3000 }, { 6273, 0xb011 }, { 6278, 0xd302 }, { 6284, 0x6b07 }, { 6292, 0x113a }, { 6298, 0x07b0 }, /* 0xba00 */ { 6304, 0x0103 }, { 6307, 0x0020 }, { 6308, 0x0000 }, { 6308, 0x1300 }, { 6311, 0x6b05 }, { 6318, 0x1138 }, { 6323, 0x03b0 }, { 6328, 0x0113 }, { 6332, 0x10b8 }, { 6337, 0x0000 }, { 6337, 0x1b00 }, { 6341, 0x2b05 }, { 6347, 0x0110 }, { 6349, 0x0300 }, { 6351, 0x0000 }, { 6351, 0x1000 }, /* 0xbb00 */ { 6352, 0xa011 }, { 6356, 0x1102 }, { 6359, 0x0a01 }, { 6362, 0x7970 }, { 6370, 0xa2b0 }, { 6376, 0x0111 }, { 6379, 0x100a }, { 6382, 0x0000 }, { 6382, 0x1100 }, { 6384, 0x0001 }, { 6385, 0x1110 }, { 6388, 0x0090 }, { 6390, 0x0111 }, { 6393, 0x0009 }, { 6395, 0x0000 }, { 6395, 0x9300 }, /* 0xbc00 */ { 6399, 0xbb05 }, { 6407, 0xf9f2 }, { 6418, 0x22b0 }, { 6423, 0x0113 }, { 6427, 0x323b }, { 6435, 0x2001 }, { 6437, 0x0000 }, { 6437, 0x0000 }, { 6437, 0x5930 }, { 6443, 0x06b0 }, { 6448, 0x0193 }, { 6453, 0x303b }, { 6460, 0xa011 }, { 6464, 0x1123 }, { 6469, 0x0000 }, { 6469, 0x1170 }, /* 0xbd00 */ { 6474, 0x02b0 }, { 6478, 0x0011 }, { 6480, 0x1010 }, { 6482, 0x0000 }, { 6482, 0x1301 }, { 6486, 0x0301 }, { 6489, 0x0110 }, { 6491, 0x0000 }, { 6491, 0x0793 }, { 6498, 0x162b }, { 6505, 0x0010 }, { 6506, 0x0101 }, { 6508, 0x0000 }, { 6508, 0x1130 }, { 6512, 0x0200 }, { 6513, 0x0111 }, /* 0xbe00 */ { 6516, 0x3029 }, { 6521, 0xb011 }, { 6526, 0x0000 }, { 6526, 0x0000 }, { 6526, 0x5130 }, { 6531, 0x0eb0 }, { 6537, 0x0513 }, { 6542, 0x383b }, { 6550, 0xb011 }, { 6555, 0x0303 }, { 6559, 0x0100 }, { 6560, 0x0000 }, { 6560, 0x0000 }, { 6560, 0x0193 }, { 6565, 0x1039 }, { 6570, 0x0000 }, /* 0xbf00 */ { 6570, 0x0302 }, { 6573, 0x3b00 }, { 6578, 0x0000 }, { 6578, 0x0000 }, { 6578, 0x0113 }, { 6582, 0x0023 }, { 6585, 0x0000 }, { 6585, 0x0000 }, { 6585, 0x0000 }, { 6585, 0x0010 }, { 6586, 0x0000 }, { 6586, 0x0001 }, { 6587, 0x3020 }, { 6590, 0x9011 }, { 6594, 0x0002 }, { 6595, 0x0000 }, /* 0xc000 */ { 6595, 0x0000 }, { 6595, 0x0000 }, { 6595, 0x0000 }, { 6595, 0x1000 }, { 6596, 0x0000 }, { 6596, 0x1102 }, { 6599, 0x0301 }, { 6602, 0x0000 }, { 6602, 0x0000 }, { 6602, 0x0113 }, { 6606, 0xb02b }, { 6613, 0xb079 }, { 6621, 0x1323 }, { 6627, 0x3b01 }, { 6633, 0x1130 }, { 6637, 0x02b0 }, /* 0xc100 */ { 6641, 0x0111 }, { 6644, 0xf021 }, { 6650, 0xb0d9 }, { 6658, 0x1343 }, { 6664, 0x3b01 }, { 6670, 0x1130 }, { 6674, 0x03b0 }, { 6679, 0x0111 }, { 6682, 0x7020 }, { 6686, 0xb051 }, { 6692, 0x1322 }, { 6697, 0x2001 }, { 6699, 0x1110 }, { 6702, 0x0190 }, { 6705, 0x0111 }, { 6708, 0x300b }, /* 0xc200 */ { 6713, 0xb011 }, { 6718, 0x9302 }, { 6723, 0xab01 }, { 6729, 0x0016 }, { 6732, 0x0100 }, { 6733, 0x0113 }, { 6737, 0x3021 }, { 6741, 0xb011 }, { 6746, 0x0302 }, { 6749, 0x2901 }, { 6753, 0x3130 }, { 6758, 0x02b0 }, { 6762, 0x0000 }, { 6762, 0x3000 }, { 6764, 0xb819 }, { 6771, 0x1b42 }, /* 0xc300 */ { 6777, 0x3301 }, { 6782, 0x1138 }, { 6787, 0x0330 }, { 6791, 0x0000 }, { 6791, 0x0020 }, { 6792, 0x0000 }, { 6792, 0x1300 }, { 6795, 0x3305 }, { 6801, 0x1110 }, { 6804, 0x0000 }, { 6804, 0x0000 }, { 6804, 0x0000 }, { 6804, 0x0001 }, { 6805, 0x9300 }, { 6809, 0x2305 }, { 6814, 0x0130 }, /* 0xc400 */ { 6817, 0x0100 }, { 6818, 0x0001 }, { 6819, 0x1010 }, { 6821, 0x3011 }, { 6825, 0x0100 }, { 6826, 0x0000 }, { 6826, 0x1130 }, { 6830, 0x0230 }, { 6833, 0x0001 }, { 6834, 0x1010 }, { 6836, 0x0000 }, { 6836, 0x1100 }, { 6838, 0x0000 }, { 6838, 0x0000 }, { 6838, 0x0200 }, { 6839, 0x8513 }, /* 0xc500 */ { 6845, 0x1003 }, { 6848, 0x1011 }, { 6851, 0x1300 }, { 6854, 0x2b01 }, { 6859, 0x7730 }, { 6867, 0x63b8 }, { 6875, 0x0113 }, { 6879, 0x303b }, { 6886, 0xb091 }, { 6892, 0x11a2 }, { 6897, 0x0201 }, { 6899, 0x7b30 }, { 6907, 0x57f0 }, { 6916, 0x0113 }, { 6920, 0x702b }, { 6927, 0xf0d1 }, /* 0xc600 */ { 6935, 0x11e3 }, { 6942, 0x1b01 }, { 6947, 0x7130 }, { 6953, 0x0ab9 }, { 6960, 0x0113 }, { 6964, 0x303b }, { 6971, 0x9001 }, { 6974, 0x1302 }, { 6978, 0x2b01 }, { 6983, 0x1130 }, { 6987, 0x02b0 }, { 6991, 0x0713 }, { 6997, 0x302b }, { 7003, 0x3011 }, { 7007, 0x1303 }, { 7012, 0x2301 }, /* 0xc700 */ { 7016, 0x1130 }, { 7020, 0x02b0 }, { 7024, 0x0113 }, { 7028, 0x30ab }, { 7035, 0xb411 }, { 7041, 0x11fe }, { 7050, 0x0901 }, { 7053, 0x7130 }, { 7059, 0x47b8 }, { 7067, 0x05d3 }, { 7074, 0x307b }, { 7082, 0xb011 }, { 7087, 0x5303 }, { 7093, 0x2101 }, { 7096, 0x1110 }, { 7099, 0x0000 }, /* 0xc800 */ { 7099, 0x0513 }, { 7104, 0x306b }, { 7111, 0xb011 }, { 7116, 0x1102 }, { 7119, 0x3301 }, { 7124, 0x0010 }, { 7125, 0x0000 }, { 7125, 0x0513 }, { 7130, 0x38eb }, { 7139, 0xa010 }, { 7142, 0x0102 }, { 7144, 0x3000 }, { 7146, 0x1110 }, { 7149, 0x02b0 }, { 7153, 0x0013 }, { 7156, 0x3020 }, /* 0xc900 */ { 7159, 0xb071 }, { 7166, 0x0102 }, { 7168, 0x1000 }, { 7169, 0x0010 }, { 7170, 0x0000 }, { 7170, 0x0113 }, { 7174, 0x100b }, { 7178, 0x1011 }, { 7181, 0x1300 }, { 7184, 0x2b01 }, { 7189, 0x0000 }, { 7189, 0x0000 }, { 7189, 0x0593 }, { 7195, 0x366b }, { 7204, 0xb095 }, { 7211, 0x1303 }, /* 0xca00 */ { 7216, 0x3b01 }, { 7222, 0x0110 }, { 7224, 0x0200 }, { 7225, 0x0000 }, { 7225, 0x3000 }, { 7227, 0xb011 }, { 7232, 0x0103 }, { 7235, 0x2000 }, { 7236, 0x0010 }, { 7237, 0x0100 }, { 7238, 0x0000 }, { 7238, 0x3000 }, { 7240, 0xb011 }, { 7245, 0x030a }, { 7249, 0x1001 }, { 7251, 0x0010 }, /* 0xcb00 */ { 7252, 0x0100 }, { 7253, 0x0111 }, { 7256, 0x0003 }, { 7258, 0x0000 }, { 7258, 0x1302 }, { 7262, 0x2301 }, { 7266, 0x0010 }, { 7267, 0x0300 }, { 7269, 0x0000 }, { 7269, 0x1000 }, { 7270, 0x0000 }, { 7270, 0x0100 }, { 7271, 0x0000 }, { 7271, 0x0010 }, { 7272, 0x0290 }, { 7275, 0x0000 }, /* 0xcc00 */ { 7275, 0x3000 }, { 7277, 0x3011 }, { 7281, 0x5386 }, { 7288, 0x7b01 }, { 7295, 0x1130 }, { 7299, 0x03b0 }, { 7304, 0x0151 }, { 7308, 0x0021 }, { 7310, 0x0000 }, { 7310, 0x1300 }, { 7313, 0x3b01 }, { 7319, 0x1130 }, { 7323, 0x02b0 }, { 7327, 0x0011 }, { 7329, 0x1010 }, { 7331, 0x0001 }, /* 0xcd00 */ { 7332, 0x1302 }, { 7336, 0x2b01 }, { 7341, 0x1110 }, { 7344, 0x0200 }, { 7345, 0x0000 }, { 7345, 0x1000 }, { 7346, 0xb011 }, { 7351, 0x0102 }, { 7353, 0x0100 }, { 7354, 0x1130 }, { 7358, 0x02b0 }, { 7362, 0x0001 }, { 7363, 0x1010 }, { 7365, 0x0001 }, { 7366, 0x1100 }, { 7368, 0x2b01 }, /* 0xce00 */ { 7373, 0x1110 }, { 7376, 0x0210 }, { 7378, 0x0113 }, { 7382, 0x002b }, { 7386, 0x0000 }, { 7386, 0x9300 }, { 7390, 0x2b03 }, { 7396, 0x1130 }, { 7400, 0x02b0 }, { 7404, 0x0113 }, { 7408, 0x303b }, { 7415, 0x0000 }, { 7415, 0x0002 }, { 7416, 0x0000 }, { 7416, 0x1930 }, { 7421, 0x03b0 }, /* 0xcf00 */ { 7426, 0x0113 }, { 7430, 0x102b }, { 7435, 0xb011 }, { 7440, 0x0103 }, { 7443, 0x0000 }, { 7443, 0x1130 }, { 7447, 0x02b0 }, { 7451, 0x0113 }, { 7455, 0x1021 }, { 7458, 0x0000 }, { 7458, 0x0102 }, { 7460, 0x0001 }, { 7461, 0x0010 }, { 7462, 0x0000 }, { 7462, 0x0113 }, { 7466, 0x102b }, /* 0xd000 */ { 7471, 0x0011 }, { 7473, 0x0102 }, { 7475, 0x2000 }, { 7476, 0x1130 }, { 7480, 0x02b0 }, { 7484, 0x0111 }, { 7487, 0x3001 }, { 7490, 0x3011 }, { 7494, 0x0002 }, { 7495, 0x0000 }, { 7495, 0x1130 }, { 7499, 0x02b0 }, { 7503, 0x0313 }, { 7508, 0x303b }, { 7515, 0xb011 }, { 7520, 0x0103 }, /* 0xd100 */ { 7523, 0x2000 }, { 7524, 0x0000 }, { 7524, 0x0000 }, { 7524, 0x0513 }, { 7529, 0x303b }, { 7536, 0xb011 }, { 7541, 0x1102 }, { 7544, 0x1000 }, { 7545, 0x0110 }, { 7547, 0x0000 }, { 7547, 0x0113 }, { 7551, 0x142b }, { 7557, 0x0001 }, { 7558, 0x0100 }, { 7559, 0x0000 }, { 7559, 0x0110 }, /* 0xd200 */ { 7561, 0x0280 }, { 7563, 0x0001 }, { 7564, 0x3000 }, { 7566, 0xb011 }, { 7571, 0x0102 }, { 7573, 0x1000 }, { 7574, 0x0010 }, { 7575, 0x0000 }, { 7575, 0x0113 }, { 7579, 0x1023 }, { 7583, 0x1011 }, { 7586, 0x9302 }, { 7591, 0x0b05 }, { 7596, 0x1110 }, { 7599, 0x0030 }, { 7601, 0x0113 }, /* 0xd300 */ { 7605, 0x702b }, { 7612, 0xb051 }, { 7618, 0x1323 }, { 7624, 0x3b01 }, { 7630, 0x0030 }, { 7632, 0x0000 }, { 7632, 0x0000 }, { 7632, 0x3000 }, { 7634, 0xb011 }, { 7639, 0x1303 }, { 7644, 0x2b01 }, { 7649, 0x1110 }, { 7652, 0x0330 }, { 7656, 0x0101 }, { 7658, 0x300a }, { 7662, 0xb011 }, /* 0xd400 */ { 7667, 0x0102 }, { 7669, 0x2000 }, { 7670, 0x0000 }, { 7670, 0x0000 }, { 7670, 0x0011 }, { 7672, 0x1000 }, { 7673, 0xa011 }, { 7677, 0x9300 }, { 7681, 0x2b05 }, { 7687, 0x0010 }, { 7688, 0x0200 }, { 7689, 0x0000 }, { 7689, 0x1000 }, { 7690, 0x9011 }, { 7694, 0x1100 }, { 7696, 0x2901 }, /* 0xd500 */ { 7700, 0x1110 }, { 7703, 0x00b0 }, { 7706, 0x0000 }, { 7706, 0x3000 }, { 7708, 0xb011 }, { 7713, 0x1302 }, { 7717, 0x2b21 }, { 7723, 0x1130 }, { 7727, 0x03b0 }, { 7732, 0x0001 }, { 7733, 0x0020 }, { 7734, 0x0000 }, { 7734, 0x1300 }, { 7737, 0x2b05 }, { 7743, 0x1130 }, { 7747, 0x02b0 }, /* 0xd600 */ { 7751, 0x0113 }, { 7755, 0x103b }, { 7761, 0x2011 }, { 7764, 0x1300 }, { 7767, 0x2b21 }, { 7773, 0x1132 }, { 7778, 0x0280 }, { 7780, 0x0013 }, { 7783, 0x3028 }, { 7787, 0xa011 }, { 7791, 0x1102 }, { 7794, 0x0a01 }, { 7797, 0x1130 }, { 7801, 0x0292 }, { 7805, 0x0111 }, { 7808, 0x3021 }, /* 0xd700 */ { 7812, 0x0011 }, { 7814, 0x1302 }, { 7818, 0x2b01 }, { 7823, 0x1130 }, { 7827, 0x0290 }, { 7830, 0x03d3 }, { 7837, 0x122b }, { 7843, 0x3011 }, { 7847, 0x1302 }, { 7851, 0x2b01 }, }; static const Summary16 ksc5601_uni2indx_pagef9[17] = { /* 0xf900 */ { 7856, 0xffff }, { 7872, 0xffff }, { 7888, 0xffff }, { 7904, 0xffff }, { 7920, 0xffff }, { 7936, 0xffff }, { 7952, 0xffff }, { 7968, 0xffff }, { 7984, 0xffff }, { 8000, 0xffff }, { 8016, 0xffff }, { 8032, 0xffff }, { 8048, 0xffff }, { 8064, 0xffff }, { 8080, 0xffff }, { 8096, 0xffff }, /* 0xfa00 */ { 8112, 0x0fff }, }; static const Summary16 ksc5601_uni2indx_pageff[15] = { /* 0xff00 */ { 8124, 0xfffe }, { 8139, 0xffff }, { 8155, 0xffff }, { 8171, 0xffff }, { 8187, 0xffff }, { 8203, 0x7fff }, { 8218, 0x0000 }, { 8218, 0x0000 }, { 8218, 0x0000 }, { 8218, 0x0000 }, { 8218, 0x0000 }, { 8218, 0x0000 }, { 8218, 0x0000 }, { 8218, 0x0000 }, { 8218, 0x006f }, }; static int ksc5601_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { if (n >= 2) { const Summary16 *summary = NULL; if (wc < 0x0460) summary = &ksc5601_uni2indx_page00[(wc>>4)]; else if (wc >= 0x2000 && wc < 0x2670) /* General Punctuation (2000, 206F) */ summary = &ksc5601_uni2indx_page20[(wc>>4)-0x200]; else if (wc >= 0x3000 && wc < 0x33e0) /* CJK Symbols and Punctuation (3000, 303F) */ summary = &ksc5601_uni2indx_page30[(wc>>4)-0x300]; else if (wc >= 0x4e00 && wc < 0x9fa0) /* CJK Unified Ideographs (4E00, 9FFF) */ summary = &ksc5601_uni2indx_page4e[(wc>>4)-0x4e0]; else if (wc >= 0xac00 && wc < 0xd7a0) /* Hangul Syllables (AC00, D7AF) 11183 */ summary = &ksc5601_uni2indx_pageac[(wc>>4)-0xac0]; else if (wc >= 0xf900 && wc < 0xfa10) /* CJK Compatibility Ideographs (F900, FAFF) */ summary = &ksc5601_uni2indx_pagef9[(wc>>4)-0xf90]; else if (wc >= 0xff00 && wc < 0xfff0) /* Halfwidth and Fullwidth Forms (FF00, FFEF) */ summary = &ksc5601_uni2indx_pageff[(wc>>4)-0xff0]; if (summary) { unsigned short used = summary->used; unsigned int i = wc & 0x0f; if (used & ((unsigned short) 1 << i)) { unsigned short c; /* Keep in `used' only the bits 0..i-1. */ used &= ((unsigned short) 1 << i) - 1; /* Add `summary->indx' and the number of bits set in `used'. */ used = (used & 0x5555) + ((used & 0xaaaa) >> 1); used = (used & 0x3333) + ((used & 0xcccc) >> 2); used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); used = (used & 0x00ff) + (used >> 8); c = ksc5601_2charset[summary->indx + used]; r[0] = (c >> 8); r[1] = (c & 0xff); return 2; } } return RET_ILSEQ; } return RET_TOOSMALL; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/mulelao.h0000644000000000000000000000462113614532331020010 0ustar /* * MULELAO-1 */ static const unsigned short mulelao_2uni[96] = { /* 0xa0 */ 0x00a0, 0x0e81, 0x0e82, 0xfffd, 0x0e84, 0xfffd, 0xfffd, 0x0e87, 0x0e88, 0xfffd, 0x0e8a, 0xfffd, 0xfffd, 0x0e8d, 0xfffd, 0xfffd, /* 0xb0 */ 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0e94, 0x0e95, 0x0e96, 0x0e97, 0xfffd, 0x0e99, 0x0e9a, 0x0e9b, 0x0e9c, 0x0e9d, 0x0e9e, 0x0e9f, /* 0xc0 */ 0xfffd, 0x0ea1, 0x0ea2, 0x0ea3, 0xfffd, 0x0ea5, 0xfffd, 0x0ea7, 0xfffd, 0xfffd, 0x0eaa, 0x0eab, 0xfffd, 0x0ead, 0x0eae, 0x0eaf, /* 0xd0 */ 0x0eb0, 0x0eb1, 0x0eb2, 0x0eb3, 0x0eb4, 0x0eb5, 0x0eb6, 0x0eb7, 0x0eb8, 0x0eb9, 0xfffd, 0x0ebb, 0x0ebc, 0x0ebd, 0xfffd, 0xfffd, /* 0xe0 */ 0x0ec0, 0x0ec1, 0x0ec2, 0x0ec3, 0x0ec4, 0xfffd, 0x0ec6, 0xfffd, 0x0ec8, 0x0ec9, 0x0eca, 0x0ecb, 0x0ecc, 0x0ecd, 0xfffd, 0xfffd, /* 0xf0 */ 0x0ed0, 0x0ed1, 0x0ed2, 0x0ed3, 0x0ed4, 0x0ed5, 0x0ed6, 0x0ed7, 0x0ed8, 0x0ed9, 0xfffd, 0xfffd, 0x0edc, 0x0edd, 0xfffd, 0xfffd, }; static int mulelao_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0xa0) { *pwc = (ucs4_t) c; return 1; } else { unsigned short wc = mulelao_2uni[c-0xa0]; if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 1; } } return RET_ILSEQ; } static const unsigned char mulelao_page0e[96] = { 0x00, 0xa1, 0xa2, 0x00, 0xa4, 0x00, 0x00, 0xa7, /* 0x80-0x87 */ 0xa8, 0x00, 0xaa, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0x88-0x8f */ 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x90-0x97 */ 0x00, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x98-0x9f */ 0x00, 0xc1, 0xc2, 0xc3, 0x00, 0xc5, 0x00, 0xc7, /* 0xa0-0xa7 */ 0x00, 0x00, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf, /* 0xa8-0xaf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xb0-0xb7 */ 0xd8, 0xd9, 0x00, 0xdb, 0xdc, 0xdd, 0x00, 0x00, /* 0xb8-0xbf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0x00, 0xe6, 0x00, /* 0xc0-0xc7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0x00, 0x00, /* 0xc8-0xcf */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */ 0xf8, 0xf9, 0x00, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xd8-0xdf */ }; static int mulelao_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x00a0) { *r = wc; return 1; } else if (wc == 0x00a0) c = 0xa0; else if (wc >= 0x0e80 && wc < 0x0ee0) c = mulelao_page0e[wc-0x0e80]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/tatar_cyr.h0000644000000000000000000001212513614532331020340 0ustar /* * TATAR-CYR */ static const unsigned short tatar_cyr_2uni[128] = { /* 0x80 */ 0x04d8, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, 0x20ac, 0x2030, 0x04e8, 0x2039, 0x04ae, 0x0496, 0x04a2, 0x04ba, /* 0x90 */ 0x04d9, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x98, 0x2122, 0x04e9, 0x203a, 0x04af, 0x0497, 0x04a3, 0x04bb, /* 0xa0 */ 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, /* 0xb0 */ 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, /* 0xc0 */ 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, /* 0xd0 */ 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, /* 0xe0 */ 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, /* 0xf0 */ 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, }; static int tatar_cyr_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0x80) *pwc = (ucs4_t) c; else *pwc = (ucs4_t) tatar_cyr_2uni[c-0x80]; return 1; } static const unsigned char tatar_cyr_page00[32] = { 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0x00, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ 0xb0, 0xb1, 0x00, 0x00, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ }; static const unsigned char tatar_cyr_page04[240] = { 0x00, 0xa8, 0x00, 0x81, 0xaa, 0xbd, 0xb2, 0xaf, /* 0x00-0x07 */ 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa1, 0x00, /* 0x08-0x0f */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x10-0x17 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x18-0x1f */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x20-0x27 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x28-0x2f */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x30-0x37 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x38-0x3f */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x40-0x47 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0x48-0x4f */ 0x00, 0xb8, 0x00, 0x83, 0xba, 0xbe, 0xb3, 0xbf, /* 0x50-0x57 */ 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x00, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0xa5, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x9d, /* 0x90-0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0x00, 0x00, 0x8e, 0x9e, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x9c, /* 0xa8-0xaf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ 0x00, 0x00, 0x8f, 0x9f, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 0x80, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ 0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ }; static const unsigned char tatar_cyr_page20[48] = { 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ }; static const unsigned char tatar_cyr_page21[24] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x00, /* 0x10-0x17 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ }; static const unsigned char tatar_cyr_page22[1] = { 0xb0, /* 0x16-0x16 */ }; static int tatar_cyr_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x0080) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x00bc) c = tatar_cyr_page00[wc-0x00a0]; else if (wc >= 0x0400 && wc < 0x04ef) c = tatar_cyr_page04[wc-0x0400]; else if (wc >= 0x2010 && wc < 0x203b) c = tatar_cyr_page20[wc-0x2010]; else if (wc == 0x20ac) c = 0x88; else if (wc >= 0x2110 && wc < 0x2123) c = tatar_cyr_page21[wc-0x2110]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/tcvn.h0000644000000000000000000001345113614532331017325 0ustar /* * TCVN-5712 */ static const unsigned short tcvn_2uni_1[32] = { /* 0x00 */ 0x0000, 0x00da, 0x1ee4, 0x0003, 0x1eea, 0x1eec, 0x1eee, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, /* 0x10 */ 0x0010, 0x1ee8, 0x1ef0, 0x1ef2, 0x1ef6, 0x1ef8, 0x00dd, 0x1ef4, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, }; static const unsigned short tcvn_2uni_2[128] = { /* 0x80 */ 0x00c0, 0x1ea2, 0x00c3, 0x00c1, 0x1ea0, 0x1eb6, 0x1eac, 0x00c8, 0x1eba, 0x1ebc, 0x00c9, 0x1eb8, 0x1ec6, 0x00cc, 0x1ec8, 0x0128, /* 0x90 */ 0x00cd, 0x1eca, 0x00d2, 0x1ece, 0x00d5, 0x00d3, 0x1ecc, 0x1ed8, 0x1edc, 0x1ede, 0x1ee0, 0x1eda, 0x1ee2, 0x00d9, 0x1ee6, 0x0168, /* 0xa0 */ 0x00a0, 0x0102, 0x00c2, 0x00ca, 0x00d4, 0x01a0, 0x01af, 0x0110, 0x0103, 0x00e2, 0x00ea, 0x00f4, 0x01a1, 0x01b0, 0x0111, 0x1eb0, /* 0xb0 */ 0x0300, 0x0309, 0x0303, 0x0301, 0x0323, 0x00e0, 0x1ea3, 0x00e3, 0x00e1, 0x1ea1, 0x1eb2, 0x1eb1, 0x1eb3, 0x1eb5, 0x1eaf, 0x1eb4, /* 0xc0 */ 0x1eae, 0x1ea6, 0x1ea8, 0x1eaa, 0x1ea4, 0x1ec0, 0x1eb7, 0x1ea7, 0x1ea9, 0x1eab, 0x1ea5, 0x1ead, 0x00e8, 0x1ec2, 0x1ebb, 0x1ebd, /* 0xd0 */ 0x00e9, 0x1eb9, 0x1ec1, 0x1ec3, 0x1ec5, 0x1ebf, 0x1ec7, 0x00ec, 0x1ec9, 0x1ec4, 0x1ebe, 0x1ed2, 0x0129, 0x00ed, 0x1ecb, 0x00f2, /* 0xe0 */ 0x1ed4, 0x1ecf, 0x00f5, 0x00f3, 0x1ecd, 0x1ed3, 0x1ed5, 0x1ed7, 0x1ed1, 0x1ed9, 0x1edd, 0x1edf, 0x1ee1, 0x1edb, 0x1ee3, 0x00f9, /* 0xf0 */ 0x1ed6, 0x1ee7, 0x0169, 0x00fa, 0x1ee5, 0x1eeb, 0x1eed, 0x1eef, 0x1ee9, 0x1ef1, 0x1ef3, 0x1ef7, 0x1ef9, 0x00fd, 0x1ef5, 0x1ed0, }; static int tcvn_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0x20) *pwc = (ucs4_t) tcvn_2uni_1[c]; else if (c < 0x80) *pwc = (ucs4_t) c; else *pwc = (ucs4_t) tcvn_2uni_2[c-0x80]; return 1; } static const unsigned char tcvn_page00[96+184] = { 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 0x80, 0x83, 0xa2, 0x82, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ 0x87, 0x8a, 0xa3, 0x00, 0x8d, 0x90, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x92, 0x95, 0xa4, 0x94, 0x00, 0x00, /* 0xd0-0xd7 */ 0x00, 0x9d, 0x01, 0x00, 0x00, 0x16, 0x00, 0x00, /* 0xd8-0xdf */ 0xb5, 0xb8, 0xa9, 0xb7, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ 0xcc, 0xd0, 0xaa, 0x00, 0xd7, 0xdd, 0x00, 0x00, /* 0xe8-0xef */ 0x00, 0x00, 0xdf, 0xe3, 0xab, 0xe2, 0x00, 0x00, /* 0xf0-0xf7 */ 0x00, 0xef, 0xf3, 0x00, 0x00, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ /* 0x0100 */ 0x00, 0x00, 0xa1, 0xa8, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0xa7, 0xae, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x8f, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x9f, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0xa5, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, /* 0xa8-0xaf */ 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ }; static const unsigned char tcvn_page03[40] = { 0xb0, 0xb3, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ }; static const unsigned char tcvn_page1e[96] = { 0x84, 0xb9, 0x81, 0xb6, 0xc4, 0xca, 0xc1, 0xc7, /* 0xa0-0xa7 */ 0xc2, 0xc8, 0xc3, 0xc9, 0x86, 0xcb, 0xc0, 0xbe, /* 0xa8-0xaf */ 0xaf, 0xbb, 0xba, 0xbc, 0xbf, 0xbd, 0x85, 0xc6, /* 0xb0-0xb7 */ 0x8b, 0xd1, 0x88, 0xce, 0x89, 0xcf, 0xda, 0xd5, /* 0xb8-0xbf */ 0xc5, 0xd2, 0xcd, 0xd3, 0xd9, 0xd4, 0x8c, 0xd6, /* 0xc0-0xc7 */ 0x8e, 0xd8, 0x91, 0xde, 0x96, 0xe4, 0x93, 0xe1, /* 0xc8-0xcf */ 0xff, 0xe8, 0xdb, 0xe5, 0xe0, 0xe6, 0xf0, 0xe7, /* 0xd0-0xd7 */ 0x97, 0xe9, 0x9b, 0xed, 0x98, 0xea, 0x99, 0xeb, /* 0xd8-0xdf */ 0x9a, 0xec, 0x9c, 0xee, 0x02, 0xf4, 0x9e, 0xf1, /* 0xe0-0xe7 */ 0x11, 0xf8, 0x04, 0xf5, 0x05, 0xf6, 0x06, 0xf7, /* 0xe8-0xef */ 0x12, 0xf9, 0x13, 0xfa, 0x17, 0xfe, 0x14, 0xfb, /* 0xf0-0xf7 */ 0x15, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ }; static int tcvn_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x0080 && (wc >= 0x0020 || (0x00fe0076 & (1 << wc)) == 0)) { *r = wc; return 1; } else if (wc >= 0x00a0 && wc < 0x01b8) c = tcvn_page00[wc-0x00a0]; else if (wc >= 0x0300 && wc < 0x0328) c = tcvn_page03[wc-0x0300]; else if (wc >= 0x1ea0 && wc < 0x1f00) c = tcvn_page1e[wc-0x1ea0]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/tis620.h0000644000000000000000000000457613614532331017412 0ustar /* * TIS620-0 */ static const unsigned short tis620_2uni[96] = { /* 0xa0 */ 0xfffd, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, /* 0xb0 */ 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, /* 0xc0 */ 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, /* 0xd0 */ 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, 0x0e38, 0x0e39, 0x0e3a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0e3f, /* 0xe0 */ 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, /* 0xf0 */ 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0xfffd, 0xfffd, 0xfffd, 0xfffd, }; static int tis620_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0x80) { *pwc = (ucs4_t) c; return 1; } else if (c < 0xa0) { } else { unsigned short wc = tis620_2uni[c-0xa0]; if (wc != 0xfffd) { *pwc = (ucs4_t) wc; return 1; } } return RET_ILSEQ; } static const unsigned char tis620_page0e[96] = { 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x08-0x0f */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0x38-0x3f */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */ 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ }; static int tis620_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x0080) { *r = wc; return 1; } else if (wc >= 0x0e00 && wc < 0x0e60) c = tis620_page0e[wc-0x0e00]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/ucs2be.h0000644000000000000000000000113513614532331017532 0ustar /* * UCS-2BE = UCS-2 big endian */ static int ucs2be_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { if (n >= 2) { if (s[0] >= 0xd8 && s[0] < 0xe0) { return RET_ILSEQ; } else { *pwc = (s[0] << 8) + s[1]; return 2; } } return RET_TOOFEW(0); } static int ucs2be_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { if (wc < 0x10000 && !(wc >= 0xd800 && wc < 0xe000)) { if (n >= 2) { r[0] = (unsigned char) (wc >> 8); r[1] = (unsigned char) wc; return 2; } else return RET_TOOSMALL; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/utf8.h0000644000000000000000000000603713614532331017243 0ustar /* * UTF-8 */ /* Specification: RFC 2279 */ static int utf8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = s[0]; if (c < 0x80) { *pwc = c; return 1; } else if (c < 0xc2) { return RET_ILSEQ; } else if (c < 0xe0) { if (n < 2) return RET_TOOFEW(0); if (!((s[1] ^ 0x80) < 0x40)) return RET_ILSEQ; *pwc = ((ucs4_t) (c & 0x1f) << 6) | (ucs4_t) (s[1] ^ 0x80); return 2; } else if (c < 0xf0) { if (n < 3) return RET_TOOFEW(0); if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && (c >= 0xe1 || s[1] >= 0xa0))) return RET_ILSEQ; *pwc = ((ucs4_t) (c & 0x0f) << 12) | ((ucs4_t) (s[1] ^ 0x80) << 6) | (ucs4_t) (s[2] ^ 0x80); return 3; } else if (c < 0xf8) { if (n < 4) return RET_TOOFEW(0); if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && (s[3] ^ 0x80) < 0x40 && (c >= 0xf1 || s[1] >= 0x90))) return RET_ILSEQ; *pwc = ((ucs4_t) (c & 0x07) << 18) | ((ucs4_t) (s[1] ^ 0x80) << 12) | ((ucs4_t) (s[2] ^ 0x80) << 6) | (ucs4_t) (s[3] ^ 0x80); return 4; } else if (c < 0xfc) { if (n < 5) return RET_TOOFEW(0); if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 && (c >= 0xf9 || s[1] >= 0x88))) return RET_ILSEQ; *pwc = ((ucs4_t) (c & 0x03) << 24) | ((ucs4_t) (s[1] ^ 0x80) << 18) | ((ucs4_t) (s[2] ^ 0x80) << 12) | ((ucs4_t) (s[3] ^ 0x80) << 6) | (ucs4_t) (s[4] ^ 0x80); return 5; } else if (c < 0xfe) { if (n < 6) return RET_TOOFEW(0); if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 && (s[5] ^ 0x80) < 0x40 && (c >= 0xfd || s[1] >= 0x84))) return RET_ILSEQ; *pwc = ((ucs4_t) (c & 0x01) << 30) | ((ucs4_t) (s[1] ^ 0x80) << 24) | ((ucs4_t) (s[2] ^ 0x80) << 18) | ((ucs4_t) (s[3] ^ 0x80) << 12) | ((ucs4_t) (s[4] ^ 0x80) << 6) | (ucs4_t) (s[5] ^ 0x80); return 6; } else return RET_ILSEQ; } static int utf8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) /* n == 0 is acceptable */ { int count; if (wc < 0x80) count = 1; else if (wc < 0x800) count = 2; else if (wc < 0x10000) count = 3; else if (wc < 0x200000) count = 4; else if (wc < 0x4000000) count = 5; else if (wc <= 0x7fffffff) count = 6; else return RET_ILSEQ; if (n < count) return RET_TOOSMALL; switch (count) { /* note: code falls through cases! */ case 6: r[5] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x4000000; case 5: r[4] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x200000; case 4: r[3] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x10000; case 3: r[2] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x800; case 2: r[1] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0xc0; case 1: r[0] = wc; } return count; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUniConv/viscii.h0000644000000000000000000001222213614532331017634 0ustar /* * VISCII1.1-1 */ /* Specification: RFC 1456 */ static const unsigned short viscii_2uni_1[32] = { /* 0x00 */ 0x0000, 0x0001, 0x1eb2, 0x0003, 0x0004, 0x1eb4, 0x1eaa, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, /* 0x10 */ 0x0010, 0x0011, 0x0012, 0x0013, 0x1ef6, 0x0015, 0x0016, 0x0017, 0x0018, 0x1ef8, 0x001a, 0x001b, 0x001c, 0x001d, 0x1ef4, 0x001f, }; static const unsigned short viscii_2uni_2[128] = { /* 0x80 */ 0x1ea0, 0x1eae, 0x1eb0, 0x1eb6, 0x1ea4, 0x1ea6, 0x1ea8, 0x1eac, 0x1ebc, 0x1eb8, 0x1ebe, 0x1ec0, 0x1ec2, 0x1ec4, 0x1ec6, 0x1ed0, /* 0x90 */ 0x1ed2, 0x1ed4, 0x1ed6, 0x1ed8, 0x1ee2, 0x1eda, 0x1edc, 0x1ede, 0x1eca, 0x1ece, 0x1ecc, 0x1ec8, 0x1ee6, 0x0168, 0x1ee4, 0x1ef2, /* 0xa0 */ 0x00d5, 0x1eaf, 0x1eb1, 0x1eb7, 0x1ea5, 0x1ea7, 0x1ea9, 0x1ead, 0x1ebd, 0x1eb9, 0x1ebf, 0x1ec1, 0x1ec3, 0x1ec5, 0x1ec7, 0x1ed1, /* 0xb0 */ 0x1ed3, 0x1ed5, 0x1ed7, 0x1ee0, 0x01a0, 0x1ed9, 0x1edd, 0x1edf, 0x1ecb, 0x1ef0, 0x1ee8, 0x1eea, 0x1eec, 0x01a1, 0x1edb, 0x01af, /* 0xc0 */ 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x1ea2, 0x0102, 0x1eb3, 0x1eb5, 0x00c8, 0x00c9, 0x00ca, 0x1eba, 0x00cc, 0x00cd, 0x0128, 0x1ef3, /* 0xd0 */ 0x0110, 0x1ee9, 0x00d2, 0x00d3, 0x00d4, 0x1ea1, 0x1ef7, 0x1eeb, 0x1eed, 0x00d9, 0x00da, 0x1ef9, 0x1ef5, 0x00dd, 0x1ee1, 0x01b0, /* 0xe0 */ 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x1ea3, 0x0103, 0x1eef, 0x1eab, 0x00e8, 0x00e9, 0x00ea, 0x1ebb, 0x00ec, 0x00ed, 0x0129, 0x1ec9, /* 0xf0 */ 0x0111, 0x1ef1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x1ecf, 0x1ecd, 0x1ee5, 0x00f9, 0x00fa, 0x0169, 0x1ee7, 0x00fd, 0x1ee3, 0x1eee, }; static int viscii_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) { unsigned char c = *s; if (c < 0x20) *pwc = (ucs4_t) viscii_2uni_1[c]; else if (c < 0x80) *pwc = (ucs4_t) c; else *pwc = (ucs4_t) viscii_2uni_2[c-0x80]; return 1; } static const unsigned char viscii_page00[64+184] = { 0xc0, 0xc1, 0xc2, 0xc3, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0x00, 0xcc, 0xcd, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0xd2, 0xd3, 0xd4, 0xa0, 0x00, 0x00, /* 0xd0-0xd7 */ 0x00, 0xd9, 0xda, 0x00, 0x00, 0xdd, 0x00, 0x00, /* 0xd8-0xdf */ 0xe0, 0xe1, 0xe2, 0xe3, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ 0xe8, 0xe9, 0xea, 0x00, 0xec, 0xed, 0x00, 0x00, /* 0xe8-0xef */ 0x00, 0x00, 0xf2, 0xf3, 0xf4, 0xf5, 0x00, 0x00, /* 0xf0-0xf7 */ 0x00, 0xf9, 0xfa, 0x00, 0x00, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ /* 0x0100 */ 0x00, 0x00, 0xc5, 0xe5, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0xce, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x9d, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0xb4, 0xbd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, /* 0xa8-0xaf */ 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ }; static const unsigned char viscii_page1e[96] = { 0x80, 0xd5, 0xc4, 0xe4, 0x84, 0xa4, 0x85, 0xa5, /* 0xa0-0xa7 */ 0x86, 0xa6, 0x06, 0xe7, 0x87, 0xa7, 0x81, 0xa1, /* 0xa8-0xaf */ 0x82, 0xa2, 0x02, 0xc6, 0x05, 0xc7, 0x83, 0xa3, /* 0xb0-0xb7 */ 0x89, 0xa9, 0xcb, 0xeb, 0x88, 0xa8, 0x8a, 0xaa, /* 0xb8-0xbf */ 0x8b, 0xab, 0x8c, 0xac, 0x8d, 0xad, 0x8e, 0xae, /* 0xc0-0xc7 */ 0x9b, 0xef, 0x98, 0xb8, 0x9a, 0xf7, 0x99, 0xf6, /* 0xc8-0xcf */ 0x8f, 0xaf, 0x90, 0xb0, 0x91, 0xb1, 0x92, 0xb2, /* 0xd0-0xd7 */ 0x93, 0xb5, 0x95, 0xbe, 0x96, 0xb6, 0x97, 0xb7, /* 0xd8-0xdf */ 0xb3, 0xde, 0x94, 0xfe, 0x9e, 0xf8, 0x9c, 0xfc, /* 0xe0-0xe7 */ 0xba, 0xd1, 0xbb, 0xd7, 0xbc, 0xd8, 0xff, 0xe6, /* 0xe8-0xef */ 0xb9, 0xf1, 0x9f, 0xcf, 0x1e, 0xdc, 0x14, 0xd6, /* 0xf0-0xf7 */ 0x19, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ }; static int viscii_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) { unsigned char c = 0; if (wc < 0x0080 && (wc >= 0x0020 || (0x42100064 & (1 << wc)) == 0)) { *r = wc; return 1; } else if (wc >= 0x00c0 && wc < 0x01b8) c = viscii_page00[wc-0x00c0]; else if (wc >= 0x1ea0 && wc < 0x1f00) c = viscii_page1e[wc-0x1ea0]; if (c != 0) { *r = c; return 1; } return RET_ILSEQ; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUTF8.c0000644000000000000000000015700413614532331015516 0ustar /****************************************************************** Copyright 1993 by SunSoft, Inc. Copyright 1999-2000 by Bruno Haible Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of SunSoft, Inc. and Bruno Haible not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. SunSoft, Inc. and Bruno Haible make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. SunSoft Inc. AND Bruno Haible DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SunSoft, Inc. OR Bruno Haible BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* * This file contains: * * I. Conversion routines CompoundText/CharSet <--> Unicode/UTF-8. * * Used for three purposes: * 1. The UTF-8 locales, see below. * 2. Unicode aware applications for which the use of 8-bit character * sets is an anachronism. * 3. For conversion from keysym to locale encoding. * * II. Conversion files for an UTF-8 locale loader. * Supports: all locales with codeset UTF-8. * How: Provides converters for UTF-8. * Platforms: all systems. * * The loader itself is located in lcUTF8.c. */ /* * The conversion from UTF-8 to CompoundText is realized in a very * conservative way. Recall that CompoundText data is used for inter-client * communication purposes. We distinguish three classes of clients: * - Clients which accept only those pieces of CompoundText which belong to * the character set understood by the current locale. * (Example: clients which are linked to an older X11 library.) * - Clients which accept CompoundText with multiple character sets and parse * it themselves. * (Example: emacs, xemacs.) * - Clients which rely entirely on the X{mb,wc}TextPropertyToTextList * functions for the conversion of CompoundText to their current locale's * multi-byte/wide-character format. * For best interoperation, the UTF-8 to CompoundText conversion proceeds as * follows. For every character, it first tests whether the character is * representable in the current locale's original (non-UTF-8) character set. * If not, it goes through the list of predefined character sets for * CompoundText and tests if the character is representable in that character * set. If so, it encodes the character using its code within that character * set. If not, it uses an UTF-8-in-CompoundText encapsulation. Since * clients of the first and second kind ignore such encapsulated text, * this encapsulation is kept to a minimum and terminated as early as possible. * * In a distant future, when clients of the first and second kind will have * disappeared, we will be able to stuff UTF-8 data directly in CompoundText * without first going through the list of predefined character sets. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "XlcPubI.h" #include "XlcGeneric.h" static XlcConv create_conv( XLCd lcd, XlcConvMethods methods) { XlcConv conv; conv = Xmalloc(sizeof(XlcConvRec)); if (conv == (XlcConv) NULL) return (XlcConv) NULL; conv->methods = methods; conv->state = NULL; return conv; } static void close_converter( XlcConv conv) { Xfree(conv); } /* Replacement character for invalid multibyte sequence or wide character. */ #define BAD_WCHAR ((ucs4_t) 0xfffd) #define BAD_CHAR '?' /***************************************************************************/ /* Part I: Conversion routines CompoundText/CharSet <--> Unicode/UTF-8. * * Note that this code works in any locale. We store Unicode values in * `ucs4_t' variables, but don't pass them to the user. * * This code has to support all character sets that are used for CompoundText, * nothing more, nothing less. See the table in lcCT.c. * Since the conversion _to_ CompoundText is likely to need the tables for all * character sets at once, we don't use dynamic loading (of tables or shared * libraries through iconv()). Use a fixed set of tables instead. * * We use statically computed tables, not dynamically allocated arrays, * because it's more memory efficient: Different processes using the same * libX11 shared library share the "text" and read-only "data" sections. */ typedef unsigned int ucs4_t; #define conv_t XlcConv typedef struct _Utf8ConvRec { const char *name; XrmQuark xrm_name; int (* cstowc) (XlcConv, ucs4_t *, unsigned char const *, int); int (* wctocs) (XlcConv, unsigned char *, ucs4_t, int); } Utf8ConvRec, *Utf8Conv; /* * int xxx_cstowc (XlcConv conv, ucs4_t *pwc, unsigned char const *s, int n) * converts the byte sequence starting at s to a wide character. Up to n bytes * are available at s. n is >= 1. * Result is number of bytes consumed (if a wide character was read), * or 0 if invalid, or -1 if n too small. * * int xxx_wctocs (XlcConv conv, unsigned char *r, ucs4_t wc, int n) * converts the wide character wc to the character set xxx, and stores the * result beginning at r. Up to n bytes may be written at r. n is >= 1. * Result is number of bytes written, or 0 if invalid, or -1 if n too small. */ /* Return code if invalid. (xxx_mbtowc, xxx_wctomb) */ #define RET_ILSEQ 0 /* Return code if only a shift sequence of n bytes was read. (xxx_mbtowc) */ #define RET_TOOFEW(n) (-1-(n)) /* Return code if output buffer is too small. (xxx_wctomb, xxx_reset) */ #define RET_TOOSMALL -1 /* * The tables below are bijective. It would be possible to extend the * xxx_wctocs tables to do some transliteration (e.g. U+201C,U+201D -> 0x22) * but *only* with characters not contained in any other table, and *only* * when the current locale is not an UTF-8 locale. */ #include "lcUniConv/utf8.h" #include "lcUniConv/ucs2be.h" #include "lcUniConv/iso8859_1.h" #include "lcUniConv/iso8859_2.h" #include "lcUniConv/iso8859_3.h" #include "lcUniConv/iso8859_4.h" #include "lcUniConv/iso8859_5.h" #include "lcUniConv/iso8859_6.h" #include "lcUniConv/iso8859_7.h" #include "lcUniConv/iso8859_8.h" #include "lcUniConv/iso8859_9.h" #include "lcUniConv/iso8859_10.h" #include "lcUniConv/iso8859_11.h" #include "lcUniConv/iso8859_13.h" #include "lcUniConv/iso8859_14.h" #include "lcUniConv/iso8859_15.h" #include "lcUniConv/iso8859_16.h" #include "lcUniConv/iso8859_9e.h" #include "lcUniConv/jisx0201.h" #include "lcUniConv/tis620.h" #include "lcUniConv/koi8_r.h" #include "lcUniConv/koi8_u.h" #include "lcUniConv/koi8_c.h" #include "lcUniConv/armscii_8.h" #include "lcUniConv/cp1133.h" #include "lcUniConv/mulelao.h" #include "lcUniConv/viscii.h" #include "lcUniConv/tcvn.h" #include "lcUniConv/georgian_academy.h" #include "lcUniConv/georgian_ps.h" #include "lcUniConv/cp1251.h" #include "lcUniConv/cp1255.h" #include "lcUniConv/cp1256.h" #include "lcUniConv/tatar_cyr.h" typedef struct { unsigned short indx; /* index into big table */ unsigned short used; /* bitmask of used entries */ } Summary16; #include "lcUniConv/gb2312.h" #include "lcUniConv/jisx0208.h" #include "lcUniConv/jisx0212.h" #include "lcUniConv/ksc5601.h" #include "lcUniConv/big5.h" #include "lcUniConv/big5_emacs.h" #include "lcUniConv/big5hkscs.h" #include "lcUniConv/gbk.h" static Utf8ConvRec all_charsets[] = { /* The ISO10646-1/UTF-8 entry occurs twice, once at the beginning (for lookup speed), once at the end (as a fallback). */ { "ISO10646-1", NULLQUARK, utf8_mbtowc, utf8_wctomb }, { "ISO8859-1", NULLQUARK, iso8859_1_mbtowc, iso8859_1_wctomb }, { "ISO8859-2", NULLQUARK, iso8859_2_mbtowc, iso8859_2_wctomb }, { "ISO8859-3", NULLQUARK, iso8859_3_mbtowc, iso8859_3_wctomb }, { "ISO8859-4", NULLQUARK, iso8859_4_mbtowc, iso8859_4_wctomb }, { "ISO8859-5", NULLQUARK, iso8859_5_mbtowc, iso8859_5_wctomb }, { "ISO8859-6", NULLQUARK, iso8859_6_mbtowc, iso8859_6_wctomb }, { "ISO8859-7", NULLQUARK, iso8859_7_mbtowc, iso8859_7_wctomb }, { "ISO8859-8", NULLQUARK, iso8859_8_mbtowc, iso8859_8_wctomb }, { "ISO8859-9", NULLQUARK, iso8859_9_mbtowc, iso8859_9_wctomb }, { "ISO8859-10", NULLQUARK, iso8859_10_mbtowc, iso8859_10_wctomb }, { "ISO8859-11", NULLQUARK, iso8859_11_mbtowc, iso8859_11_wctomb }, { "ISO8859-13", NULLQUARK, iso8859_13_mbtowc, iso8859_13_wctomb }, { "ISO8859-14", NULLQUARK, iso8859_14_mbtowc, iso8859_14_wctomb }, { "ISO8859-15", NULLQUARK, iso8859_15_mbtowc, iso8859_15_wctomb }, { "ISO8859-16", NULLQUARK, iso8859_16_mbtowc, iso8859_16_wctomb }, { "JISX0201.1976-0", NULLQUARK, jisx0201_mbtowc, jisx0201_wctomb }, { "TIS620-0", NULLQUARK, tis620_mbtowc, tis620_wctomb }, { "GB2312.1980-0", NULLQUARK, gb2312_mbtowc, gb2312_wctomb }, { "JISX0208.1983-0", NULLQUARK, jisx0208_mbtowc, jisx0208_wctomb }, { "JISX0208.1990-0", NULLQUARK, jisx0208_mbtowc, jisx0208_wctomb }, { "JISX0212.1990-0", NULLQUARK, jisx0212_mbtowc, jisx0212_wctomb }, { "KSC5601.1987-0", NULLQUARK, ksc5601_mbtowc, ksc5601_wctomb }, { "KOI8-R", NULLQUARK, koi8_r_mbtowc, koi8_r_wctomb }, { "KOI8-U", NULLQUARK, koi8_u_mbtowc, koi8_u_wctomb }, { "KOI8-C", NULLQUARK, koi8_c_mbtowc, koi8_c_wctomb }, { "TATAR-CYR", NULLQUARK, tatar_cyr_mbtowc, tatar_cyr_wctomb }, { "ARMSCII-8", NULLQUARK, armscii_8_mbtowc, armscii_8_wctomb }, { "IBM-CP1133", NULLQUARK, cp1133_mbtowc, cp1133_wctomb }, { "MULELAO-1", NULLQUARK, mulelao_mbtowc, mulelao_wctomb }, { "VISCII1.1-1", NULLQUARK, viscii_mbtowc, viscii_wctomb }, { "TCVN-5712", NULLQUARK, tcvn_mbtowc, tcvn_wctomb }, { "GEORGIAN-ACADEMY", NULLQUARK, georgian_academy_mbtowc, georgian_academy_wctomb }, { "GEORGIAN-PS", NULLQUARK, georgian_ps_mbtowc, georgian_ps_wctomb }, { "ISO8859-9E", NULLQUARK, iso8859_9e_mbtowc, iso8859_9e_wctomb }, { "MICROSOFT-CP1251", NULLQUARK, cp1251_mbtowc, cp1251_wctomb }, { "MICROSOFT-CP1255", NULLQUARK, cp1255_mbtowc, cp1255_wctomb }, { "MICROSOFT-CP1256", NULLQUARK, cp1256_mbtowc, cp1256_wctomb }, { "BIG5-0", NULLQUARK, big5_mbtowc, big5_wctomb }, { "BIG5-E0", NULLQUARK, big5_0_mbtowc, big5_0_wctomb }, { "BIG5-E1", NULLQUARK, big5_1_mbtowc, big5_1_wctomb }, { "GBK-0", NULLQUARK, gbk_mbtowc, gbk_wctomb }, { "BIG5HKSCS-0", NULLQUARK, big5hkscs_mbtowc, big5hkscs_wctomb }, /* The ISO10646-1/UTF-8 entry occurs twice, once at the beginning (for lookup speed), once at the end (as a fallback). */ { "ISO10646-1", NULLQUARK, utf8_mbtowc, utf8_wctomb }, /* Encoding ISO10646-1 for fonts means UCS2-like encoding so for conversion to FontCharSet we need this record */ { "ISO10646-1", NULLQUARK, ucs2be_mbtowc, ucs2be_wctomb } }; #define charsets_table_size (sizeof(all_charsets)/sizeof(all_charsets[0])) #define all_charsets_count (charsets_table_size - 1) #define ucs2_conv_index (charsets_table_size - 1) static void init_all_charsets (void) { Utf8Conv convptr; int i; for (convptr = all_charsets, i = charsets_table_size; i > 0; convptr++, i--) convptr->xrm_name = XrmStringToQuark(convptr->name); } #define lazy_init_all_charsets() \ do { \ if (all_charsets[0].xrm_name == NULLQUARK) \ init_all_charsets(); \ } while (0) /* from XlcNCharSet to XlcNUtf8String */ static int cstoutf8( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { XlcCharSet charset; const char *name; Utf8Conv convptr; int i; unsigned char const *src; unsigned char const *srcend; unsigned char *dst; unsigned char *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; if (num_args < 1) return -1; charset = (XlcCharSet) args[0]; name = charset->encoding_name; /* not charset->name because the latter has a ":GL"/":GR" suffix */ for (convptr = all_charsets, i = all_charsets_count-1; i > 0; convptr++, i--) if (!strcmp(convptr->name, name)) break; if (i == 0) return -1; src = (unsigned char const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend) { ucs4_t wc; int consumed; int count; consumed = convptr->cstowc(conv, &wc, src, srcend-src); if (consumed == RET_ILSEQ) return -1; if (consumed == RET_TOOFEW(0)) break; count = utf8_wctomb(NULL, dst, wc, dstend-dst); if (count == RET_TOOSMALL) break; if (count == RET_ILSEQ) { count = utf8_wctomb(NULL, dst, BAD_WCHAR, dstend-dst); if (count == RET_TOOSMALL) break; unconv_num++; } src += consumed; dst += count; } *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; return unconv_num; } static XlcConvMethodsRec methods_cstoutf8 = { close_converter, cstoutf8, NULL }; static XlcConv open_cstoutf8( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { lazy_init_all_charsets(); return create_conv(from_lcd, &methods_cstoutf8); } /* from XlcNUtf8String to XlcNCharSet */ static XlcConv create_tocs_conv( XLCd lcd, XlcConvMethods methods) { XlcConv conv; CodeSet *codeset_list; int codeset_num; int charset_num; int i, j, k; Utf8Conv *preferred; lazy_init_all_charsets(); codeset_list = XLC_GENERIC(lcd, codeset_list); codeset_num = XLC_GENERIC(lcd, codeset_num); charset_num = 0; for (i = 0; i < codeset_num; i++) charset_num += codeset_list[i]->num_charsets; if (charset_num > all_charsets_count-1) charset_num = all_charsets_count-1; conv = Xmalloc(sizeof(XlcConvRec) + (charset_num + 1) * sizeof(Utf8Conv)); if (conv == (XlcConv) NULL) return (XlcConv) NULL; preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec)); /* Loop through all codesets mentioned in the locale. */ charset_num = 0; for (i = 0; i < codeset_num; i++) { XlcCharSet *charsets = codeset_list[i]->charset_list; int num_charsets = codeset_list[i]->num_charsets; for (j = 0; j < num_charsets; j++) { const char *name = charsets[j]->encoding_name; /* If it wasn't already encountered... */ for (k = charset_num-1; k >= 0; k--) if (!strcmp(preferred[k]->name, name)) break; if (k < 0) { /* Look it up in all_charsets[]. */ for (k = 0; k < all_charsets_count-1; k++) if (!strcmp(all_charsets[k].name, name)) { /* Add it to the preferred set. */ preferred[charset_num++] = &all_charsets[k]; break; } } } } preferred[charset_num] = (Utf8Conv) NULL; conv->methods = methods; conv->state = (XPointer) preferred; return conv; } static void close_tocs_converter( XlcConv conv) { /* conv->state is allocated together with conv, free both at once. */ Xfree(conv); } /* * Converts a Unicode character to an appropriate character set. The NULL * terminated array of preferred character sets is passed as first argument. * If successful, *charsetp is set to the character set that was used, and * *sidep is set to the character set side (XlcGL or XlcGR). */ static int charset_wctocs( Utf8Conv *preferred, Utf8Conv *charsetp, XlcSide *sidep, XlcConv conv, unsigned char *r, ucs4_t wc, int n) { int count; Utf8Conv convptr; int i; for (; *preferred != (Utf8Conv) NULL; preferred++) { convptr = *preferred; count = convptr->wctocs(conv, r, wc, n); if (count == RET_TOOSMALL) return RET_TOOSMALL; if (count != RET_ILSEQ) { *charsetp = convptr; *sidep = (*r < 0x80 ? XlcGL : XlcGR); return count; } } for (convptr = all_charsets+1, i = all_charsets_count-1; i > 0; convptr++, i--) { count = convptr->wctocs(conv, r, wc, n); if (count == RET_TOOSMALL) return RET_TOOSMALL; if (count != RET_ILSEQ) { *charsetp = convptr; *sidep = (*r < 0x80 ? XlcGL : XlcGR); return count; } } return RET_ILSEQ; } static int utf8tocs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { Utf8Conv *preferred_charsets; XlcCharSet last_charset = NULL; unsigned char const *src; unsigned char const *srcend; unsigned char *dst; unsigned char *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; preferred_charsets = (Utf8Conv *) conv->state; src = (unsigned char const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend && dst < dstend) { Utf8Conv chosen_charset = NULL; XlcSide chosen_side = XlcNONE; ucs4_t wc; int consumed; int count; consumed = utf8_mbtowc(NULL, &wc, src, srcend-src); if (consumed == RET_TOOFEW(0)) break; if (consumed == RET_ILSEQ) { src++; unconv_num++; continue; } count = charset_wctocs(preferred_charsets, &chosen_charset, &chosen_side, conv, dst, wc, dstend-dst); if (count == RET_TOOSMALL) break; if (count == RET_ILSEQ) { src += consumed; unconv_num++; continue; } if (last_charset == NULL) { last_charset = _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); if (last_charset == NULL) { src += consumed; unconv_num++; continue; } } else { if (!(last_charset->xrm_encoding_name == chosen_charset->xrm_name && (last_charset->side == XlcGLGR || last_charset->side == chosen_side))) break; } src += consumed; dst += count; } if (last_charset == NULL) return -1; *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; if (num_args >= 1) *((XlcCharSet *)args[0]) = last_charset; return unconv_num; } static XlcConvMethodsRec methods_utf8tocs = { close_tocs_converter, utf8tocs, NULL }; static XlcConv open_utf8tocs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_tocs_conv(from_lcd, &methods_utf8tocs); } /* from XlcNUtf8String to XlcNChar */ static int utf8tocs1( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { Utf8Conv *preferred_charsets; XlcCharSet last_charset = NULL; unsigned char const *src; unsigned char const *srcend; unsigned char *dst; unsigned char *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; preferred_charsets = (Utf8Conv *) conv->state; src = (unsigned char const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend && dst < dstend) { Utf8Conv chosen_charset = NULL; XlcSide chosen_side = XlcNONE; ucs4_t wc; int consumed; int count; consumed = utf8_mbtowc(NULL, &wc, src, srcend-src); if (consumed == RET_TOOFEW(0)) break; if (consumed == RET_ILSEQ) { src++; unconv_num++; continue; } count = charset_wctocs(preferred_charsets, &chosen_charset, &chosen_side, conv, dst, wc, dstend-dst); if (count == RET_TOOSMALL) break; if (count == RET_ILSEQ) { src += consumed; unconv_num++; continue; } if (last_charset == NULL) { last_charset = _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); if (last_charset == NULL) { src += consumed; unconv_num++; continue; } } else { if (!(last_charset->xrm_encoding_name == chosen_charset->xrm_name && (last_charset->side == XlcGLGR || last_charset->side == chosen_side))) break; } src += consumed; dst += count; break; } if (last_charset == NULL) return -1; *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; if (num_args >= 1) *((XlcCharSet *)args[0]) = last_charset; return unconv_num; } static XlcConvMethodsRec methods_utf8tocs1 = { close_tocs_converter, utf8tocs1, NULL }; static XlcConv open_utf8tocs1( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_tocs_conv(from_lcd, &methods_utf8tocs1); } /* from XlcNUtf8String to XlcNString */ static int utf8tostr( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { unsigned char const *src; unsigned char const *srcend; unsigned char *dst; unsigned char *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; src = (unsigned char const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend) { unsigned char c; ucs4_t wc; int consumed; consumed = utf8_mbtowc(NULL, &wc, src, srcend-src); if (consumed == RET_TOOFEW(0)) break; if (dst == dstend) break; if (consumed == RET_ILSEQ) { consumed = 1; c = BAD_CHAR; unconv_num++; } else { if ((wc & ~(ucs4_t)0xff) != 0) { c = BAD_CHAR; unconv_num++; } else c = (unsigned char) wc; } *dst++ = c; src += consumed; } *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; return unconv_num; } static XlcConvMethodsRec methods_utf8tostr = { close_converter, utf8tostr, NULL }; static XlcConv open_utf8tostr( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &methods_utf8tostr); } /* from XlcNString to XlcNUtf8String */ static int strtoutf8( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { unsigned char const *src; unsigned char const *srcend; unsigned char *dst; unsigned char *dstend; if (from == NULL || *from == NULL) return 0; src = (unsigned char const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; while (src < srcend) { int count = utf8_wctomb(NULL, dst, *src, dstend-dst); if (count == RET_TOOSMALL) break; dst += count; src++; } *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; return 0; } static XlcConvMethodsRec methods_strtoutf8 = { close_converter, strtoutf8, NULL }; static XlcConv open_strtoutf8( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &methods_strtoutf8); } /* Support for the input methods. */ XPointer _Utf8GetConvByName( const char *name) { XrmQuark xrm_name; Utf8Conv convptr; int i; if (name == NULL) return (XPointer) NULL; lazy_init_all_charsets(); xrm_name = XrmStringToQuark(name); for (convptr = all_charsets, i = all_charsets_count-1; i > 0; convptr++, i--) if (convptr->xrm_name == xrm_name) return (XPointer) convptr->wctocs; return (XPointer) NULL; } /* from XlcNUcsChar to XlcNChar, needed for input methods */ static XlcConv create_ucstocs_conv( XLCd lcd, XlcConvMethods methods) { if (XLC_PUBLIC_PART(lcd)->codeset && _XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "UTF-8") == 0) { XlcConv conv; Utf8Conv *preferred; lazy_init_all_charsets(); conv = Xmalloc(sizeof(XlcConvRec) + 2 * sizeof(Utf8Conv)); if (conv == (XlcConv) NULL) return (XlcConv) NULL; preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec)); preferred[0] = &all_charsets[0]; /* ISO10646 */ preferred[1] = (Utf8Conv) NULL; conv->methods = methods; conv->state = (XPointer) preferred; return conv; } else { return create_tocs_conv(lcd, methods); } } static int charset_wctocs_exactly( Utf8Conv *preferred, Utf8Conv *charsetp, XlcSide *sidep, XlcConv conv, unsigned char *r, ucs4_t wc, int n) { int count; Utf8Conv convptr; for (; *preferred != (Utf8Conv) NULL; preferred++) { convptr = *preferred; count = convptr->wctocs(conv, r, wc, n); if (count == RET_TOOSMALL) return RET_TOOSMALL; if (count != RET_ILSEQ) { *charsetp = convptr; *sidep = (*r < 0x80 ? XlcGL : XlcGR); return count; } } return RET_ILSEQ; } static int ucstocs1( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { ucs4_t const *src; unsigned char *dst = (unsigned char *) *to; int unconv_num = 0; Utf8Conv *preferred_charsets = (Utf8Conv *) conv->state; Utf8Conv chosen_charset = NULL; XlcSide chosen_side = XlcNONE; XlcCharSet charset = NULL; int count; if (from == NULL || *from == NULL) return 0; src = (ucs4_t const *) *from; count = charset_wctocs_exactly(preferred_charsets, &chosen_charset, &chosen_side, conv, dst, *src, *to_left); if (count < 1) { unconv_num++; count = 0; } else { charset = _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); } if (charset == NULL) return -1; *from = (XPointer) ++src; (*from_left)--; *to = (XPointer) dst; *to_left -= count; if (num_args >= 1) *((XlcCharSet *)args[0]) = charset; return unconv_num; } static XlcConvMethodsRec methods_ucstocs1 = { close_tocs_converter, ucstocs1, NULL }; static XlcConv open_ucstocs1( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_ucstocs_conv(from_lcd, &methods_ucstocs1); } /* from XlcNUcsChar to XlcNUtf8String, needed for input methods */ static int ucstoutf8( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { const ucs4_t *src; const ucs4_t *srcend; unsigned char *dst; unsigned char *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; src = (const ucs4_t *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend) { int count = utf8_wctomb(NULL, dst, *src, dstend-dst); if (count == RET_TOOSMALL) break; if (count == RET_ILSEQ) unconv_num++; src++; dst += count; } *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; return unconv_num; } static XlcConvMethodsRec methods_ucstoutf8 = { close_converter, ucstoutf8, NULL }; static XlcConv open_ucstoutf8( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &methods_ucstoutf8); } /* Registers UTF-8 converters for a non-UTF-8 locale. */ void _XlcAddUtf8Converters( XLCd lcd) { _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String, open_cstoutf8); _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNCharSet, open_utf8tocs); _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNChar, open_utf8tocs1); _XlcSetConverter(lcd, XlcNString, lcd, XlcNUtf8String, open_strtoutf8); _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNString, open_utf8tostr); _XlcSetConverter(lcd, XlcNUcsChar, lcd, XlcNChar, open_ucstocs1); _XlcSetConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String, open_ucstoutf8); } /***************************************************************************/ /* Part II: UTF-8 locale loader conversion files * * Here we can assume that "multi-byte" is UTF-8 and that `wchar_t' is Unicode. */ /* from XlcNMultiByte to XlcNWideChar */ static int utf8towcs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { unsigned char const *src; unsigned char const *srcend; wchar_t *dst; wchar_t *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; src = (unsigned char const *) *from; srcend = src + *from_left; dst = (wchar_t *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend && dst < dstend) { ucs4_t wc; int consumed = utf8_mbtowc(NULL, &wc, src, srcend-src); if (consumed == RET_TOOFEW(0)) break; if (consumed == RET_ILSEQ) { src++; *dst = BAD_WCHAR; unconv_num++; } else { src += consumed; *dst = wc; } dst++; } *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; return unconv_num; } static XlcConvMethodsRec methods_utf8towcs = { close_converter, utf8towcs, NULL }; static XlcConv open_utf8towcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &methods_utf8towcs); } /* from XlcNWideChar to XlcNMultiByte */ static int wcstoutf8( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { wchar_t const *src; wchar_t const *srcend; unsigned char *dst; unsigned char *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; src = (wchar_t const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend) { int count = utf8_wctomb(NULL, dst, *src, dstend-dst); if (count == RET_TOOSMALL) break; if (count == RET_ILSEQ) { count = utf8_wctomb(NULL, dst, BAD_WCHAR, dstend-dst); if (count == RET_TOOSMALL) break; unconv_num++; } dst += count; src++; } *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; return unconv_num; } static XlcConvMethodsRec methods_wcstoutf8 = { close_converter, wcstoutf8, NULL }; static XlcConv open_wcstoutf8( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &methods_wcstoutf8); } /* from XlcNString to XlcNWideChar */ static int our_strtowcs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { unsigned char const *src; unsigned char const *srcend; wchar_t *dst; wchar_t *dstend; if (from == NULL || *from == NULL) return 0; src = (unsigned char const *) *from; srcend = src + *from_left; dst = (wchar_t *) *to; dstend = dst + *to_left; while (src < srcend && dst < dstend) *dst++ = (wchar_t) *src++; *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; return 0; } static XlcConvMethodsRec methods_strtowcs = { close_converter, our_strtowcs, NULL }; static XlcConv open_strtowcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &methods_strtowcs); } /* from XlcNWideChar to XlcNString */ static int our_wcstostr( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { wchar_t const *src; wchar_t const *srcend; unsigned char *dst; unsigned char *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; src = (wchar_t const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend && dst < dstend) { unsigned int wc = *src++; if (wc < 0x80) *dst = wc; else { *dst = BAD_CHAR; unconv_num++; } dst++; } *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; return unconv_num; } static XlcConvMethodsRec methods_wcstostr = { close_converter, our_wcstostr, NULL }; static XlcConv open_wcstostr( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &methods_wcstostr); } /* from XlcNCharSet to XlcNWideChar */ static int cstowcs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { XlcCharSet charset; const char *name; Utf8Conv convptr; int i; unsigned char const *src; unsigned char const *srcend; wchar_t *dst; wchar_t *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; if (num_args < 1) return -1; charset = (XlcCharSet) args[0]; name = charset->encoding_name; /* not charset->name because the latter has a ":GL"/":GR" suffix */ for (convptr = all_charsets, i = all_charsets_count-1; i > 0; convptr++, i--) if (!strcmp(convptr->name, name)) break; if (i == 0) return -1; src = (unsigned char const *) *from; srcend = src + *from_left; dst = (wchar_t *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend && dst < dstend) { unsigned int wc; int consumed; consumed = convptr->cstowc(conv, &wc, src, srcend-src); if (consumed == RET_ILSEQ) return -1; if (consumed == RET_TOOFEW(0)) break; *dst++ = wc; src += consumed; } *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; return unconv_num; } static XlcConvMethodsRec methods_cstowcs = { close_converter, cstowcs, NULL }; static XlcConv open_cstowcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { lazy_init_all_charsets(); return create_conv(from_lcd, &methods_cstowcs); } /* from XlcNWideChar to XlcNCharSet */ static int wcstocs( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { Utf8Conv *preferred_charsets; XlcCharSet last_charset = NULL; wchar_t const *src; wchar_t const *srcend; unsigned char *dst; unsigned char *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; preferred_charsets = (Utf8Conv *) conv->state; src = (wchar_t const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend && dst < dstend) { Utf8Conv chosen_charset = NULL; XlcSide chosen_side = XlcNONE; wchar_t wc = *src; int count; count = charset_wctocs(preferred_charsets, &chosen_charset, &chosen_side, conv, dst, wc, dstend-dst); if (count == RET_TOOSMALL) break; if (count == RET_ILSEQ) { src++; unconv_num++; continue; } if (last_charset == NULL) { last_charset = _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); if (last_charset == NULL) { src++; unconv_num++; continue; } } else { if (!(last_charset->xrm_encoding_name == chosen_charset->xrm_name && (last_charset->side == XlcGLGR || last_charset->side == chosen_side))) break; } src++; dst += count; } if (last_charset == NULL) return -1; *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; if (num_args >= 1) *((XlcCharSet *)args[0]) = last_charset; return unconv_num; } static XlcConvMethodsRec methods_wcstocs = { close_tocs_converter, wcstocs, NULL }; static XlcConv open_wcstocs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_tocs_conv(from_lcd, &methods_wcstocs); } /* from XlcNWideChar to XlcNChar */ static int wcstocs1( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { Utf8Conv *preferred_charsets; XlcCharSet last_charset = NULL; wchar_t const *src; wchar_t const *srcend; unsigned char *dst; unsigned char *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; preferred_charsets = (Utf8Conv *) conv->state; src = (wchar_t const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend && dst < dstend) { Utf8Conv chosen_charset = NULL; XlcSide chosen_side = XlcNONE; wchar_t wc = *src; int count; count = charset_wctocs(preferred_charsets, &chosen_charset, &chosen_side, conv, dst, wc, dstend-dst); if (count == RET_TOOSMALL) break; if (count == RET_ILSEQ) { src++; unconv_num++; continue; } if (last_charset == NULL) { last_charset = _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); if (last_charset == NULL) { src++; unconv_num++; continue; } } else { if (!(last_charset->xrm_encoding_name == chosen_charset->xrm_name && (last_charset->side == XlcGLGR || last_charset->side == chosen_side))) break; } src++; dst += count; break; } if (last_charset == NULL) return -1; *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; if (num_args >= 1) *((XlcCharSet *)args[0]) = last_charset; return unconv_num; } static XlcConvMethodsRec methods_wcstocs1 = { close_tocs_converter, wcstocs1, NULL }; static XlcConv open_wcstocs1( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_tocs_conv(from_lcd, &methods_wcstocs1); } /* trivial, no conversion */ static int identity( XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { unsigned char const *src; unsigned char const *srcend; unsigned char *dst; unsigned char *dstend; if (from == NULL || *from == NULL) return 0; src = (unsigned char const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; while (src < srcend && dst < dstend) *dst++ = *src++; *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; return 0; } static XlcConvMethodsRec methods_identity = { close_converter, identity, NULL }; static XlcConv open_identity( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &methods_identity); } /* from MultiByte/WideChar to FontCharSet. */ /* They really use converters to CharSet * but with different create_conv procedure. */ static XlcConv create_tofontcs_conv( XLCd lcd, XlcConvMethods methods) { XlcConv conv; int i, num, k, count; char **value, buf[20]; Utf8Conv *preferred; lazy_init_all_charsets(); for (i = 0, num = 0;; i++) { snprintf(buf, sizeof(buf), "fs%d.charset.name", i); _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); if (count < 1) { snprintf(buf, sizeof(buf), "fs%d.charset", i); _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); if (count < 1) break; } num += count; } conv = Xmalloc(sizeof(XlcConvRec) + (num + 1) * sizeof(Utf8Conv)); if (conv == (XlcConv) NULL) return (XlcConv) NULL; preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec)); /* Loop through all fontsets mentioned in the locale. */ for (i = 0, num = 0;; i++) { snprintf(buf, sizeof(buf), "fs%d.charset.name", i); _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); if (count < 1) { snprintf(buf, sizeof(buf), "fs%d.charset", i); _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); if (count < 1) break; } while (count-- > 0) { XlcCharSet charset = _XlcGetCharSet(*value++); const char *name; if (charset == (XlcCharSet) NULL) continue; name = charset->encoding_name; /* If it wasn't already encountered... */ for (k = num - 1; k >= 0; k--) if (!strcmp(preferred[k]->name, name)) break; if (k < 0) { /* For fonts "ISO10646-1" means ucs2, not utf8.*/ if (!strcmp("ISO10646-1", name)) { preferred[num++] = &all_charsets[ucs2_conv_index]; continue; } /* Look it up in all_charsets[]. */ for (k = 0; k < all_charsets_count-1; k++) if (!strcmp(all_charsets[k].name, name)) { /* Add it to the preferred set. */ preferred[num++] = &all_charsets[k]; break; } } } } preferred[num] = (Utf8Conv) NULL; conv->methods = methods; conv->state = (XPointer) preferred; return conv; } static XlcConv open_wcstofcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_tofontcs_conv(from_lcd, &methods_wcstocs); } static XlcConv open_utf8tofcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_tofontcs_conv(from_lcd, &methods_utf8tocs); } /* ========================== iconv Stuff ================================ */ /* from XlcNCharSet to XlcNMultiByte */ static int iconv_cstombs(XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { XlcCharSet charset; char const *name; Utf8Conv convptr; int i; unsigned char const *src; unsigned char const *srcend; unsigned char *dst; unsigned char *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; if (num_args < 1) return -1; charset = (XlcCharSet) args[0]; name = charset->encoding_name; /* not charset->name because the latter has a ":GL"/":GR" suffix */ for (convptr = all_charsets, i = all_charsets_count-1; i > 0; convptr++, i--) if (!strcmp(convptr->name, name)) break; if (i == 0) return -1; src = (unsigned char const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend) { ucs4_t wc; int consumed; int count; consumed = convptr->cstowc(conv, &wc, src, srcend-src); if (consumed == RET_ILSEQ) return -1; if (consumed == RET_TOOFEW(0)) break; /* Use stdc iconv to convert widechar -> multibyte */ count = wctomb((char *)dst, wc); if (count == 0) break; if (count == -1) { count = wctomb((char *)dst, BAD_WCHAR); if (count == 0) break; unconv_num++; } src += consumed; dst += count; } *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; return unconv_num; } static XlcConvMethodsRec iconv_cstombs_methods = { close_converter, iconv_cstombs, NULL }; static XlcConv open_iconv_cstombs(XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { lazy_init_all_charsets(); return create_conv(from_lcd, &iconv_cstombs_methods); } static int iconv_mbstocs(XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { Utf8Conv *preferred_charsets; XlcCharSet last_charset = NULL; unsigned char const *src; unsigned char const *srcend; unsigned char *dst; unsigned char *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; preferred_charsets = (Utf8Conv *) conv->state; src = (unsigned char const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend && dst < dstend) { Utf8Conv chosen_charset = NULL; XlcSide chosen_side = XlcNONE; wchar_t wc; int consumed; int count; /* Uses stdc iconv to convert multibyte -> widechar */ consumed = mbtowc(&wc, (const char *)src, srcend-src); if (consumed == 0) break; if (consumed == -1) { src++; unconv_num++; continue; } count = charset_wctocs(preferred_charsets, &chosen_charset, &chosen_side, conv, dst, wc, dstend-dst); if (count == RET_TOOSMALL) break; if (count == RET_ILSEQ) { src += consumed; unconv_num++; continue; } if (last_charset == NULL) { last_charset = _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); if (last_charset == NULL) { src += consumed; unconv_num++; continue; } } else { if (!(last_charset->xrm_encoding_name == chosen_charset->xrm_name && (last_charset->side == XlcGLGR || last_charset->side == chosen_side))) break; } src += consumed; dst += count; } if (last_charset == NULL) return -1; *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; if (num_args >= 1) *((XlcCharSet *)args[0]) = last_charset; return unconv_num; } static XlcConvMethodsRec iconv_mbstocs_methods = { close_tocs_converter, iconv_mbstocs, NULL }; static XlcConv open_iconv_mbstocs(XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_tocs_conv(from_lcd, &iconv_mbstocs_methods); } /* from XlcNMultiByte to XlcNChar */ static int iconv_mbtocs(XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { Utf8Conv *preferred_charsets; XlcCharSet last_charset = NULL; unsigned char const *src; unsigned char const *srcend; unsigned char *dst; unsigned char *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; preferred_charsets = (Utf8Conv *) conv->state; src = (unsigned char const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend && dst < dstend) { Utf8Conv chosen_charset = NULL; XlcSide chosen_side = XlcNONE; wchar_t wc; int consumed; int count; /* Uses stdc iconv to convert multibyte -> widechar */ consumed = mbtowc(&wc, (const char *)src, srcend-src); if (consumed == 0) break; if (consumed == -1) { src++; unconv_num++; continue; } count = charset_wctocs(preferred_charsets, &chosen_charset, &chosen_side, conv, dst, wc, dstend-dst); if (count == RET_TOOSMALL) break; if (count == RET_ILSEQ) { src += consumed; unconv_num++; continue; } if (last_charset == NULL) { last_charset = _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); if (last_charset == NULL) { src += consumed; unconv_num++; continue; } } else { if (!(last_charset->xrm_encoding_name == chosen_charset->xrm_name && (last_charset->side == XlcGLGR || last_charset->side == chosen_side))) break; } src += consumed; dst += count; } if (last_charset == NULL) return -1; *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; if (num_args >= 1) *((XlcCharSet *)args[0]) = last_charset; return unconv_num; } static XlcConvMethodsRec iconv_mbtocs_methods = { close_tocs_converter, iconv_mbtocs, NULL }; static XlcConv open_iconv_mbtocs(XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_tocs_conv(from_lcd, &iconv_mbtocs_methods ); } /* from XlcNMultiByte to XlcNString */ static int iconv_mbstostr(XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { unsigned char const *src; unsigned char const *srcend; unsigned char *dst; unsigned char *dstend; int unconv_num; if (from == NULL || *from == NULL) return 0; src = (unsigned char const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; unconv_num = 0; while (src < srcend) { unsigned char c; wchar_t wc; int consumed; /* Uses stdc iconv to convert multibyte -> widechar */ consumed = mbtowc(&wc, (const char *)src, srcend-src); if (consumed == 0) break; if (dst == dstend) break; if (consumed == -1) { consumed = 1; c = BAD_CHAR; unconv_num++; } else { if ((wc & ~(wchar_t)0xff) != 0) { c = BAD_CHAR; unconv_num++; } else c = (unsigned char) wc; } *dst++ = c; src += consumed; } *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; return unconv_num; } static XlcConvMethodsRec iconv_mbstostr_methods = { close_converter, iconv_mbstostr, NULL }; static XlcConv open_iconv_mbstostr(XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &iconv_mbstostr_methods); } /* from XlcNString to XlcNMultiByte */ static int iconv_strtombs(XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { unsigned char const *src; unsigned char const *srcend; unsigned char *dst; unsigned char *dstend; if (from == NULL || *from == NULL) return 0; src = (unsigned char const *) *from; srcend = src + *from_left; dst = (unsigned char *) *to; dstend = dst + *to_left; while (src < srcend) { int count = wctomb((char *)dst, *src); if (count < 0) break; dst += count; src++; } *from = (XPointer) src; *from_left = srcend - src; *to = (XPointer) dst; *to_left = dstend - dst; return 0; } static XlcConvMethodsRec iconv_strtombs_methods= { close_converter, iconv_strtombs, NULL }; static XlcConv open_iconv_strtombs(XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &iconv_strtombs_methods); } /***************************************************************************/ /* Part II: An iconv locale loader. * *Here we can assume that "multi-byte" is iconv and that `wchar_t' is Unicode. */ /* from XlcNMultiByte to XlcNWideChar */ static int iconv_mbstowcs(XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { char *src = *((char **) from); wchar_t *dst = *((wchar_t **) to); int src_left = *from_left; int dst_left = *to_left; int length, unconv_num = 0; while (src_left > 0 && dst_left > 0) { length = mbtowc(dst, src, src_left); if (length > 0) { src += length; src_left -= length; if (dst) dst++; dst_left--; } else if (length < 0) { src++; src_left--; unconv_num++; } else { /* null ? */ src++; src_left--; if (dst) *dst++ = L'\0'; dst_left--; } } *from = (XPointer) src; if (dst) *to = (XPointer) dst; *from_left = src_left; *to_left = dst_left; return unconv_num; } static XlcConvMethodsRec iconv_mbstowcs_methods = { close_converter, iconv_mbstowcs, NULL } ; static XlcConv open_iconv_mbstowcs(XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &iconv_mbstowcs_methods); } static int iconv_wcstombs(XlcConv conv, XPointer *from, int *from_left, XPointer *to, int *to_left, XPointer *args, int num_args) { wchar_t *src = *((wchar_t **) from); char *dst = *((char **) to); int src_left = *from_left; int dst_left = *to_left; int length, unconv_num = 0; while (src_left > 0 && dst_left >= MB_CUR_MAX) { length = wctomb(dst, *src); /* XXX */ if (length > 0) { src++; src_left--; if (dst) dst += length; dst_left -= length; } else if (length < 0) { src++; src_left--; unconv_num++; } } *from = (XPointer) src; if (dst) *to = (XPointer) dst; *from_left = src_left; *to_left = dst_left; return unconv_num; } static XlcConvMethodsRec iconv_wcstombs_methods = { close_converter, iconv_wcstombs, NULL } ; static XlcConv open_iconv_wcstombs(XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_conv(from_lcd, &iconv_wcstombs_methods); } static XlcConv open_iconv_mbstofcs( XLCd from_lcd, const char *from_type, XLCd to_lcd, const char *to_type) { return create_tofontcs_conv(from_lcd, &iconv_mbstocs_methods); } /* Registers UTF-8 converters for a UTF-8 locale. */ void _XlcAddUtf8LocaleConverters( XLCd lcd) { /* Register elementary converters. */ _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_utf8towcs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_wcstoutf8); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_strtowcs); /* Register converters for XlcNCharSet. This implicitly provides * converters from and to XlcNCompoundText. */ _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstoutf8); _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_utf8tocs); _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_utf8tocs1); _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_wcstocs1); _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtoutf8); _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_utf8tostr); _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNMultiByte, open_identity); _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNUtf8String, open_identity); /* Register converters for XlcNFontCharSet */ _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNFontCharSet, open_utf8tofcs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNFontCharSet, open_wcstofcs); } void _XlcAddGB18030LocaleConverters( XLCd lcd) { /* Register elementary converters. */ _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_iconv_mbstowcs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_iconv_wcstombs); /* Register converters for XlcNCharSet. This implicitly provides * converters from and to XlcNCompoundText. */ _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_iconv_cstombs); _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_iconv_mbstocs); _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_iconv_mbtocs); _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_iconv_strtombs); _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_iconv_mbstostr); /* Register converters for XlcNFontCharSet */ _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNFontCharSet, open_iconv_mbstofcs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_strtowcs); _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_wcstocs1); /* Register converters for XlcNFontCharSet */ _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNFontCharSet, open_wcstofcs); } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcUtil.c0000644000000000000000000000455313614532331015705 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp * Bug fixes: Bruno Haible XFree86 Inc. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "XlcPublic.h" /* Don't use here because it is locale dependent. */ #define set_toupper(ch) \ if (ch >= 'a' && ch <= 'z') \ ch = ch - 'a' + 'A'; /* Compares two ISO 8859-1 strings, ignoring case of ASCII letters. Like strcasecmp in an ASCII locale. */ int _XlcCompareISOLatin1( const char *str1, const char *str2) { unsigned char ch1, ch2; for ( ; ; str1++, str2++) { ch1 = *str1; ch2 = *str2; if (ch1 == '\0' || ch2 == '\0') break; set_toupper(ch1); set_toupper(ch2); if (ch1 != ch2) break; } return ch1 - ch2; } /* Compares two ISO 8859-1 strings, at most len bytes of each, ignoring case of ASCII letters. Like strncasecmp in an ASCII locale. */ int _XlcNCompareISOLatin1( const char *str1, const char *str2, int len) { unsigned char ch1, ch2; for ( ; ; str1++, str2++, len--) { if (len == 0) return 0; ch1 = *str1; ch2 = *str2; if (ch1 == '\0' || ch2 == '\0') break; set_toupper(ch1); set_toupper(ch2); if (ch1 != ch2) break; } return ch1 - ch2; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/lcWrap.c0000644000000000000000000003227513614532331015703 0ustar /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Copyright 1991 by the Open Software Foundation * Copyright 1993 by the TOSHIBA Corp. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of Open Software Foundation and TOSHIBA * not be used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Open Software * Foundation and TOSHIBA make no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * OPEN SOFTWARE FOUNDATION AND TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN OR TOSHIBA BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * M. Collins OSF * * Katsuhisa Yano TOSHIBA Corp. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "Xlibint.h" #include "Xlcint.h" #include #include #ifdef WIN32 #undef close #endif #include #include "XlcPubI.h" #ifdef XTHREADS LockInfoPtr _Xi18n_lock; #endif char * XSetLocaleModifiers( const char *modifiers) { XLCd lcd = _XlcCurrentLC(); char *user_mods; char *mapped_mods; if (!lcd) return (char *) NULL; if (!modifiers) return lcd->core->modifiers; user_mods = getenv("XMODIFIERS"); mapped_mods = (*lcd->methods->map_modifiers) (lcd, user_mods, modifiers); if (mapped_mods) { Xfree(lcd->core->modifiers); lcd->core->modifiers = mapped_mods; } return mapped_mods; } Bool XSupportsLocale(void) { return _XlcCurrentLC() != (XLCd)NULL; } Bool _XlcValidModSyntax( const char * mods, const char * const *valid_mods) { int i; const char * const *ptr; while (mods && (*mods == '@')) { mods++; if (*mods == '@') break; for (ptr = valid_mods; *ptr; ptr++) { i = strlen(*ptr); if (strncmp(mods, *ptr, i) || ((mods[i] != '=') #ifdef WIN32 && (mods[i] != '#') #endif )) continue; mods = strchr(mods+i+1, '@'); break; } } return !mods || !*mods; } static const char *im_valid[] = {"im", (const char *)NULL}; /*ARGSUSED*/ char * _XlcDefaultMapModifiers( XLCd lcd, const char *user_mods, const char *prog_mods) { int i; char *mods; if (!_XlcValidModSyntax(prog_mods, im_valid)) return (char *)NULL; if (!_XlcValidModSyntax(user_mods, im_valid)) return (char *)NULL; i = strlen(prog_mods) + 1; if (user_mods) i += strlen(user_mods); mods = Xmalloc(i); if (mods) { strcpy(mods, prog_mods); if (user_mods) strcat(mods, user_mods); #ifdef WIN32 { char *s; for (s = mods; (s = strchr(s, '@')); s++) { for (s++; *s && *s != '='; s++) { if (*s == '#') { *s = '='; break; } } } } #endif } return mods; } typedef struct _XLCdListRec { struct _XLCdListRec *next; XLCd lcd; int ref_count; } XLCdListRec, *XLCdList; static XLCdList lcd_list = NULL; typedef struct _XlcLoaderListRec { struct _XlcLoaderListRec *next; XLCdLoadProc proc; } XlcLoaderListRec, *XlcLoaderList; static XlcLoaderList loader_list = NULL; void _XlcRemoveLoader( XLCdLoadProc proc) { XlcLoaderList loader, prev; if (loader_list == NULL) return; prev = loader = loader_list; if (loader->proc == proc) { loader_list = loader->next; Xfree(loader); return; } while ((loader = loader->next)) { if (loader->proc == proc) { prev->next = loader->next; Xfree(loader); return; } prev = loader; } return; } Bool _XlcAddLoader( XLCdLoadProc proc, XlcPosition position) { XlcLoaderList loader, last; _XlcRemoveLoader(proc); /* remove old loader, if exist */ loader = Xmalloc(sizeof(XlcLoaderListRec)); if (loader == NULL) return False; loader->proc = proc; if (loader_list == NULL) position = XlcHead; if (position == XlcHead) { loader->next = loader_list; loader_list = loader; } else { last = loader_list; while (last->next) last = last->next; loader->next = NULL; last->next = loader; } return True; } XLCd _XOpenLC( char *name) { XLCd lcd; XlcLoaderList loader; XLCdList cur; #if !defined(X_LOCALE) int len; char sinamebuf[256]; char* siname = sinamebuf; #endif if (name == NULL) { name = setlocale (LC_CTYPE, (char *)NULL); #if !defined(X_LOCALE) /* * _XlMapOSLocaleName will return the same string or a substring * of name, so strlen(name) is okay */ if ((len = strlen(name)) >= sizeof sinamebuf) { siname = Xmalloc (len + 1); if (siname == NULL) return NULL; } name = _XlcMapOSLocaleName(name, siname); #endif } _XLockMutex(_Xi18n_lock); /* * search for needed lcd, if found return it */ for (cur = lcd_list; cur; cur = cur->next) { if (!strcmp (cur->lcd->core->name, name)) { lcd = cur->lcd; cur->ref_count++; goto found; } } if (!loader_list) _XlcInitLoader(); /* * not there, so try to get and add to list */ for (loader = loader_list; loader; loader = loader->next) { lcd = (*loader->proc)(name); if (lcd) { cur = Xmalloc (sizeof(XLCdListRec)); if (cur) { cur->lcd = lcd; cur->ref_count = 1; cur->next = lcd_list; lcd_list = cur; } else { (*lcd->methods->close)(lcd); lcd = (XLCd) NULL; } goto found; } } lcd = NULL; found: _XUnlockMutex(_Xi18n_lock); #if !defined(X_LOCALE) if (siname != sinamebuf) Xfree(siname); #endif return lcd; } void _XCloseLC( XLCd lcd) { XLCdList cur, *prev; for (prev = &lcd_list; (cur = *prev); prev = &cur->next) { if (cur->lcd == lcd) { if (--cur->ref_count < 1) { (*lcd->methods->close)(lcd); *prev = cur->next; Xfree(cur); } break; } } if(loader_list) { _XlcDeInitLoader(); loader_list = NULL; } } /* * Get the XLCd for the current locale */ XLCd _XlcCurrentLC(void) { XLCd lcd; static XLCd last_lcd = NULL; lcd = _XOpenLC((char *) NULL); if (last_lcd) _XCloseLC(last_lcd); last_lcd = lcd; return lcd; } XrmMethods _XrmInitParseInfo( XPointer *state) { XLCd lcd = _XOpenLC((char *) NULL); if (lcd == (XLCd) NULL) return (XrmMethods) NULL; return (*lcd->methods->init_parse_info)(lcd, state); } int XmbTextPropertyToTextList( Display *dpy, const XTextProperty *text_prop, char ***list_ret, int *count_ret) { XLCd lcd = _XlcCurrentLC(); if (lcd == NULL) return XLocaleNotSupported; return (*lcd->methods->mb_text_prop_to_list)(lcd, dpy, text_prop, list_ret, count_ret); } int XwcTextPropertyToTextList( Display *dpy, const XTextProperty *text_prop, wchar_t ***list_ret, int *count_ret) { XLCd lcd = _XlcCurrentLC(); if (lcd == NULL) return XLocaleNotSupported; return (*lcd->methods->wc_text_prop_to_list)(lcd, dpy, text_prop, list_ret, count_ret); } int Xutf8TextPropertyToTextList( Display *dpy, const XTextProperty *text_prop, char ***list_ret, int *count_ret) { XLCd lcd = _XlcCurrentLC(); if (lcd == NULL) return XLocaleNotSupported; return (*lcd->methods->utf8_text_prop_to_list)(lcd, dpy, text_prop, list_ret, count_ret); } int XmbTextListToTextProperty( Display *dpy, char **list, int count, XICCEncodingStyle style, XTextProperty *text_prop) { XLCd lcd = _XlcCurrentLC(); if (lcd == NULL) return XLocaleNotSupported; return (*lcd->methods->mb_text_list_to_prop)(lcd, dpy, list, count, style, text_prop); } int XwcTextListToTextProperty( Display *dpy, wchar_t **list, int count, XICCEncodingStyle style, XTextProperty *text_prop) { XLCd lcd = _XlcCurrentLC(); if (lcd == NULL) return XLocaleNotSupported; return (*lcd->methods->wc_text_list_to_prop)(lcd, dpy, list, count, style, text_prop); } int Xutf8TextListToTextProperty( Display *dpy, char **list, int count, XICCEncodingStyle style, XTextProperty *text_prop) { XLCd lcd = _XlcCurrentLC(); if (lcd == NULL) return XLocaleNotSupported; return (*lcd->methods->utf8_text_list_to_prop)(lcd, dpy, list, count, style, text_prop); } void XwcFreeStringList( wchar_t **list) { XLCd lcd = _XlcCurrentLC(); if (lcd == NULL) return; (*lcd->methods->wc_free_string_list)(lcd, list); } const char * XDefaultString(void) { XLCd lcd = _XlcCurrentLC(); if (lcd == NULL) return (char *) NULL; return (*lcd->methods->default_string)(lcd); } void _XlcCopyFromArg( char *src, char *dst, int size) { if (size == sizeof(long)) *((long *) dst) = (long) src; #ifdef LONG64 else if (size == sizeof(int)) *((int *) dst) = (int)(long) src; #endif else if (size == sizeof(short)) *((short *) dst) = (short)(long) src; else if (size == sizeof(char)) *((char *) dst) = (char)(long) src; else if (size == sizeof(XPointer)) *((XPointer *) dst) = (XPointer) src; else if (size > sizeof(XPointer)) memcpy(dst, (char *) src, size); else memcpy(dst, (char *) &src, size); } void _XlcCopyToArg( char *src, char **dst, int size) { /* FIXME: On Big Endian machines, this behaves differently than _XCopyToArg. */ if (size == sizeof(long)) *((long *) *dst) = *((long *) src); #ifdef LONG64 else if (size == sizeof(int)) *((int *) *dst) = *((int *) src); #endif else if (size == sizeof(short)) *((short *) *dst) = *((short *) src); else if (size == sizeof(char)) *((char *) *dst) = *((char *) src); else if (size == sizeof(XPointer)) *((XPointer *) *dst) = *((XPointer *) src); else memcpy(*dst, src, size); } void _XlcCountVaList( va_list var, int *count_ret) { int count; for (count = 0; va_arg(var, char *); count++) (void)va_arg(var, XPointer); *count_ret = count; } void _XlcVaToArgList( va_list var, int count, XlcArgList *args_ret) { XlcArgList args; *args_ret = args = Xmalloc(sizeof(XlcArg) * count); if (args == (XlcArgList) NULL) return; for ( ; count-- > 0; args++) { args->name = va_arg(var, char *); args->value = va_arg(var, XPointer); } } void _XlcCompileResourceList( XlcResourceList resources, int num_resources) { for ( ; num_resources-- > 0; resources++) resources->xrm_name = XrmPermStringToQuark(resources->name); } char * _XlcGetValues( XPointer base, XlcResourceList resources, int num_resources, XlcArgList args, int num_args, unsigned long mask) { XlcResourceList res; XrmQuark xrm_name; int count; for ( ; num_args-- > 0; args++) { res = resources; count = num_resources; xrm_name = XrmPermStringToQuark(args->name); for ( ; count-- > 0; res++) { if (xrm_name == res->xrm_name && (mask & res->mask)) { _XlcCopyToArg(base + res->offset, &args->value, res->size); break; } } if (count < 0) return args->name; } return NULL; } char * _XlcSetValues( XPointer base, XlcResourceList resources, int num_resources, XlcArgList args, int num_args, unsigned long mask) { XlcResourceList res; XrmQuark xrm_name; int count; for ( ; num_args-- > 0; args++) { res = resources; count = num_resources; xrm_name = XrmPermStringToQuark(args->name); for ( ; count-- > 0; res++) { if (xrm_name == res->xrm_name && (mask & res->mask)) { _XlcCopyFromArg(args->value, base + res->offset, res->size); break; } } if (count < 0) return args->name; } return NULL; } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/Makefile.am0000644000000000000000000000267513614532331016344 0ustar NULL = noinst_LTLIBRARIES = libi18n.la AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/include/X11 \ -I$(top_builddir)/include \ -I$(top_builddir)/include/X11 \ -I$(top_srcdir)/src/xcms \ -I$(top_srcdir)/src/xkb \ -I$(top_srcdir)/src/xlibi18n \ -I$(top_srcdir)/src \ -I$(top_srcdir)/../exports/include \ -D_GNU_SOURCE \ $(NULL) AM_CFLAGS = \ $(X11_CFLAGS) \ $(BIGFONT_CFLAGS) \ $(XMALLOC_ZERO_CFLAGS) \ $(CWARNFLAGS) \ $(NULL) IM_LIBS = \ ${top_builddir}/modules/im/ximcp/libximcp.la \ $(NULL) LC_LIBS = \ ${top_builddir}/modules/lc/def/libxlcDef.la \ ${top_builddir}/modules/lc/gen/libxlibi18n.la \ ${top_builddir}/modules/lc/Utf8/libxlcUTF8Load.la \ $(NULL) OM_LIBS = \ ${top_builddir}/modules/om/generic/libxomGeneric.la \ $(NULL) libi18n_la_LIBADD = \ $(IM_LIBS) \ $(LC_LIBS) \ $(OM_LIBS) \ $(NULL) libi18n_la_SOURCES = \ $(XI18N_DL_SOURCES) \ xim_trans.c \ ICWrap.c \ IMWrap.c \ imKStoUCS.c \ lcCT.c \ lcCharSet.c \ lcConv.c \ lcDB.c \ lcFile.c \ lcGeneric.c \ lcInit.c \ lcPrTxt.c \ lcPubWrap.c \ lcPublic.c \ lcRM.c \ lcStd.c \ lcTxtPr.c \ lcUTF8.c \ lcUtil.c \ lcWrap.c \ mbWMProps.c \ mbWrap.c \ utf8WMProps.c \ utf8Wrap.c \ wcWrap.c \ $(NULL) nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/mbWMProps.c0000644000000000000000000000413713614532331016335 0ustar /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include void XmbSetWMProperties ( Display *dpy, Window w, _Xconst char *windowName, _Xconst char *iconName, char **argv, int argc, XSizeHints *sizeHints, XWMHints *wmHints, XClassHint *classHints) { XTextProperty wname, iname; XTextProperty *wprop = NULL; XTextProperty *iprop = NULL; if (windowName && XmbTextListToTextProperty(dpy, (char**)&windowName, 1, XStdICCTextStyle, &wname) >= Success) wprop = &wname; if (iconName && XmbTextListToTextProperty(dpy, (char**)&iconName, 1, XStdICCTextStyle, &iname) >= Success) iprop = &iname; XSetWMProperties(dpy, w, wprop, iprop, argv, argc, sizeHints, wmHints, classHints); if (wprop) Xfree(wname.value); if (iprop) Xfree(iname.value); /* Note: The WM_LOCALE_NAME property is set by XSetWMProperties. */ } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/mbWrap.c0000644000000000000000000001162213614532331015674 0ustar /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Copyright 1991 by the Open Software Foundation * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Open Software Foundation * not be used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Open Software * Foundation makes no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * OPEN SOFTWARE FOUNDATION DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * M. Collins OSF */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" void XmbDrawText( Display *dpy, Drawable d, GC gc, int x, int y, XmbTextItem *text_items, int nitems) { register XFontSet fs = NULL; register XmbTextItem *p = text_items; register int i = nitems; register int esc; /* ignore leading items with no fontset */ while (i && !p->font_set) { i--; p++; } for (; --i >= 0; p++) { if (p->font_set) fs = p->font_set; x += p->delta; esc = (*fs->methods->mb_draw_string) (dpy, d, fs, gc, x, y, p->chars, p->nchars); if (!esc) esc = fs->methods->mb_escapement (fs, p->chars, p->nchars); x += esc; } } void XmbDrawString( Display *dpy, Drawable d, XFontSet font_set, GC gc, int x, int y, _Xconst char *text, int text_len) { (void)(*font_set->methods->mb_draw_string) (dpy, d, font_set, gc, x, y, text, text_len); } void XmbDrawImageString( Display *dpy, Drawable d, XFontSet font_set, GC gc, int x, int y, _Xconst char *text, int text_len) { (*font_set->methods->mb_draw_image_string) (dpy, d, font_set, gc, x, y, text, text_len); } int XmbTextEscapement( XFontSet font_set, _Xconst char *text, int text_len) { return (*font_set->methods->mb_escapement) (font_set, text, text_len); } int XmbTextExtents( XFontSet font_set, _Xconst char *text, int text_len, XRectangle *overall_ink_extents, XRectangle *overall_logical_extents) { return (*font_set->methods->mb_extents) (font_set, text, text_len, overall_ink_extents, overall_logical_extents); } Status XmbTextPerCharExtents( XFontSet font_set, _Xconst char *text, int text_len, XRectangle *ink_extents_buffer, XRectangle *logical_extents_buffer, int buffer_size, int *num_chars, XRectangle *max_ink_extents, XRectangle *max_logical_extents) { return (*font_set->methods->mb_extents_per_char) (font_set, text, text_len, ink_extents_buffer, logical_extents_buffer, buffer_size, num_chars, max_ink_extents, max_logical_extents); } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/utf8WMProps.c0000644000000000000000000000635713614532331016633 0ustar /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Copyright 2000 by Bruno Haible * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation, and that the name of Bruno Haible not * be used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Bruno Haible * makes no representations about the suitability of this software for * any purpose. It is provided "as is" without express or implied * warranty. * * Bruno Haible DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN * NO EVENT SHALL Bruno Haible BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE * OR PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include void Xutf8SetWMProperties ( Display *dpy, Window w, _Xconst char *windowName, _Xconst char *iconName, char **argv, int argc, XSizeHints *sizeHints, XWMHints *wmHints, XClassHint *classHints) { XTextProperty wname, iname; XTextProperty *wprop = NULL; XTextProperty *iprop = NULL; if (windowName && Xutf8TextListToTextProperty(dpy, (char**)&windowName, 1, XStdICCTextStyle, &wname) >= Success) wprop = &wname; if (iconName && Xutf8TextListToTextProperty(dpy, (char**)&iconName, 1, XStdICCTextStyle, &iname) >= Success) iprop = &iname; XSetWMProperties(dpy, w, wprop, iprop, argv, argc, sizeHints, wmHints, classHints); if (wprop) Xfree(wname.value); if (iprop) Xfree(iname.value); /* Note: The WM_LOCALE_NAME property is set by XSetWMProperties. */ } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/utf8Wrap.c0000644000000000000000000001406513614532331016170 0ustar /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Copyright 1991 by the Open Software Foundation * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Open Software Foundation * not be used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Open Software * Foundation makes no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * OPEN SOFTWARE FOUNDATION DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * M. Collins OSF */ /* * Copyright 2000 by Bruno Haible * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation, and that the name of Bruno Haible not * be used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Bruno Haible * makes no representations about the suitability of this software for * any purpose. It is provided "as is" without express or implied * warranty. * * Bruno Haible DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN * NO EVENT SHALL Bruno Haible BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE * OR PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" void Xutf8DrawText( Display *dpy, Drawable d, GC gc, int x, int y, XmbTextItem *text_items, int nitems) { register XFontSet fs = NULL; register XmbTextItem *p = text_items; register int i = nitems; register int esc; /* ignore leading items with no fontset */ while (i && !p->font_set) { i--; p++; } for (; --i >= 0; p++) { if (p->font_set) fs = p->font_set; x += p->delta; esc = (*fs->methods->utf8_draw_string) (dpy, d, fs, gc, x, y, p->chars, p->nchars); if (!esc) esc = fs->methods->utf8_escapement (fs, p->chars, p->nchars); x += esc; } } void Xutf8DrawString( Display *dpy, Drawable d, XFontSet font_set, GC gc, int x, int y, _Xconst char *text, int text_len) { (void)(*font_set->methods->utf8_draw_string) (dpy, d, font_set, gc, x, y, text, text_len); } void Xutf8DrawImageString( Display *dpy, Drawable d, XFontSet font_set, GC gc, int x, int y, _Xconst char *text, int text_len) { (*font_set->methods->utf8_draw_image_string) (dpy, d, font_set, gc, x, y, text, text_len); } int Xutf8TextEscapement( XFontSet font_set, _Xconst char *text, int text_len) { return (*font_set->methods->utf8_escapement) (font_set, text, text_len); } int Xutf8TextExtents( XFontSet font_set, _Xconst char *text, int text_len, XRectangle *overall_ink_extents, XRectangle *overall_logical_extents) { return (*font_set->methods->utf8_extents) (font_set, text, text_len, overall_ink_extents, overall_logical_extents); } Status Xutf8TextPerCharExtents( XFontSet font_set, _Xconst char *text, int text_len, XRectangle *ink_extents_buffer, XRectangle *logical_extents_buffer, int buffer_size, int *num_chars, XRectangle *max_ink_extents, XRectangle *max_logical_extents) { return (*font_set->methods->utf8_extents_per_char) (font_set, text, text_len, ink_extents_buffer, logical_extents_buffer, buffer_size, num_chars, max_ink_extents, max_logical_extents); } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/wcWrap.c0000644000000000000000000001173113614532331015710 0ustar /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Copyright 1991 by the Open Software Foundation * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Open Software Foundation * not be used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Open Software * Foundation makes no representations about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. * * OPEN SOFTWARE FOUNDATION DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * M. Collins OSF */ #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xlcint.h" void XwcDrawText( Display *dpy, Drawable d, GC gc, int x, int y, XwcTextItem *text_items, int nitems) { register XFontSet fs = NULL; register XwcTextItem *p = text_items; register int i = nitems; register int esc; /* ignore leading items with no fontset */ while (i && !p->font_set) { i--; p++; } for (; --i >= 0; p++) { if (p->font_set) fs = p->font_set; x += p->delta; esc = (*fs->methods->wc_draw_string) (dpy, d, fs, gc, x, y, p->chars, p->nchars); if (!esc) esc = fs->methods->wc_escapement (fs, p->chars, p->nchars); x += esc; } } void XwcDrawString( Display *dpy, Drawable d, XFontSet font_set, GC gc, int x, int y, _Xconst wchar_t *text, int text_len) { (void)(*font_set->methods->wc_draw_string) (dpy, d, font_set, gc, x, y, text, text_len); } void XwcDrawImageString( Display *dpy, Drawable d, XFontSet font_set, GC gc, int x, int y, _Xconst wchar_t *text, int text_len) { (*font_set->methods->wc_draw_image_string) (dpy, d, font_set, gc, x, y, text, text_len); } int XwcTextEscapement( XFontSet font_set, _Xconst wchar_t *text, int text_len) { return (*font_set->methods->wc_escapement) (font_set, text, text_len); } int XwcTextExtents( XFontSet font_set, _Xconst wchar_t *text, int text_len, XRectangle *overall_ink_extents, XRectangle *overall_logical_extents) { return (*font_set->methods->wc_extents) (font_set, text, text_len, overall_ink_extents, overall_logical_extents); } Status XwcTextPerCharExtents( XFontSet font_set, _Xconst wchar_t *text, int text_len, XRectangle *ink_extents_buffer, XRectangle *logical_extents_buffer, int buffer_size, int *num_chars, XRectangle *max_ink_extents, XRectangle *max_logical_extents) { return (*font_set->methods->wc_extents_per_char) (font_set, text, text_len, ink_extents_buffer, logical_extents_buffer, buffer_size, num_chars, max_ink_extents, max_logical_extents); } nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/XimImSw.h0000644000000000000000000000314013614532331016002 0ustar /****************************************************************** Copyright 1992, 1993 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifndef _XIMIMSW_H #define _XIMIMSW_H typedef struct { Bool (*checkprocessing)( Xim im ); Bool (*im_open)( Xim im ); void (*im_free)( Xim im ); } XimImsportSW; extern XimImsportSW _XimImSportRec[]; #endif /* _XIMIMSW_H */ nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/Ximint.h0000644000000000000000000004414313614532331015725 0ustar /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1993, 1994 by Sony Corporation Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED and Sony Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED and Sony Corporation makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED AND SONY CORPORATION DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED AND SONY CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp Motifier: Makoto Wakamatsu Sony Corporation makoto@sm.sony.co.jp ******************************************************************/ #ifndef _XIMINT_H #define _XIMINT_H #include #include typedef struct _Xim *Xim; typedef struct _Xic *Xic; /* * Input Method data */ #include "XimintP.h" #include "XimintL.h" /* * XIM dependent data */ typedef struct _XimCommonPrivateRec { /* This struct is also inlined in XimLocalPrivateRec, XimProtoPrivateRec. */ XlcConv ctom_conv; XlcConv ctow_conv; XlcConv ctoutf8_conv; XlcConv cstomb_conv; XlcConv cstowc_conv; XlcConv cstoutf8_conv; XlcConv ucstoc_conv; XlcConv ucstoutf8_conv; } XimCommonPrivateRec; typedef union _XIMPrivateRec { XimCommonPrivateRec common; XimLocalPrivateRec local; XimProtoPrivateRec proto; } XIMPrivateRec; /* * IM struct */ typedef struct _Xim { XIMMethods methods; XIMCoreRec core; XIMPrivateRec private; } XimRec; /* * IC deprndent data */ typedef union _XICPrivateRec { XicLocalPrivateRec local; XicProtoPrivateRec proto; } XICPrivateRec; /* * IC struct */ typedef struct _Xic { XICMethods methods; XICCoreRec core; XICPrivateRec private; } XicRec; typedef struct _XimDefIMValues { XIMValuesList *im_values_list; XIMValuesList *ic_values_list; XIMStyles *styles; XIMCallback destroy_callback; char *res_name; char *res_class; Bool visible_position; } XimDefIMValues; typedef struct _XimDefICValues { XIMStyle input_style; Window client_window; Window focus_window; unsigned long filter_events; XICCallback geometry_callback; char *res_name; char *res_class; XICCallback destroy_callback; XICCallback preedit_state_notify_callback; XICCallback string_conversion_callback; XIMStringConversionText string_conversion; XIMResetState reset_state; XIMHotKeyTriggers *hotkey; XIMHotKeyState hotkey_state; ICPreeditAttributes preedit_attr; ICStatusAttributes status_attr; } XimDefICValues; #define XIM_MODE_IM_GET (1 << 0) #define XIM_MODE_IM_SET (1 << 1) #define XIM_MODE_IM_DEFAULT (1 << 2) #define XIM_MODE_PRE_GET (1 << 0) #define XIM_MODE_PRE_SET (1 << 1) #define XIM_MODE_PRE_CREATE (1 << 2) #define XIM_MODE_PRE_ONCE (1 << 3) #define XIM_MODE_PRE_DEFAULT (1 << 4) #define XIM_MODE_STS_GET (1 << 5) #define XIM_MODE_STS_SET (1 << 6) #define XIM_MODE_STS_CREATE (1 << 7) #define XIM_MODE_STS_ONCE (1 << 8) #define XIM_MODE_STS_DEFAULT (1 << 9) #define XIM_MODE_IC_GET (XIM_MODE_PRE_GET | XIM_MODE_STS_GET) #define XIM_MODE_IC_SET (XIM_MODE_PRE_SET | XIM_MODE_STS_SET) #define XIM_MODE_IC_CREATE (XIM_MODE_PRE_CREATE | XIM_MODE_STS_CREATE) #define XIM_MODE_IC_ONCE (XIM_MODE_PRE_ONCE | XIM_MODE_STS_ONCE) #define XIM_MODE_IC_DEFAULT (XIM_MODE_PRE_DEFAULT | XIM_MODE_STS_DEFAULT) #define XIM_MODE_PRE_MASK (XIM_MODE_PRE_GET | XIM_MODE_PRE_SET | \ XIM_MODE_PRE_CREATE | XIM_MODE_PRE_ONCE | \ XIM_MODE_PRE_DEFAULT) #define XIM_MODE_STS_MASK (XIM_MODE_STS_GET | XIM_MODE_STS_SET | \ XIM_MODE_STS_CREATE | XIM_MODE_STS_ONCE | \ XIM_MODE_STS_DEFAULT) #define XIM_SETIMDEFAULTS (1L << 0) #define XIM_SETIMVALUES (1L << 1) #define XIM_GETIMVALUES (1L << 2) #define XIM_SETICDEFAULTS (1L << 0) #define XIM_CREATEIC (1L << 1) #define XIM_SETICVALUES (1L << 2) #define XIM_GETICVALUES (1L << 3) #define XIM_PREEDIT_ATTR (1L << 4) #define XIM_STATUS_ATTR (1L << 5) #define XIM_CHECK_VALID 0 #define XIM_CHECK_INVALID 1 #define XIM_CHECK_ERROR 2 #define FILTERD True #define NOTFILTERD False #define XIMMODIFIER "@im=" #define XIM_TRUE True #define XIM_FALSE False #define XIM_OVERFLOW (-1) #define BRL_UC_ROW 0x2800 /* * Global symbols */ XPointer _XimGetLocaleCode ( const char *encoding_name ); int _XimGetCharCode ( XPointer conv, KeySym keysym, unsigned char *buf, int nbytes ); unsigned int KeySymToUcs4 ( KeySym keysym ); extern Bool _XimSetIMResourceList( XIMResourceList *res_list, unsigned int *list_num ); extern Bool _XimSetICResourceList( XIMResourceList *res_list, unsigned int *list_num ); extern Bool _XimSetInnerIMResourceList( XIMResourceList *res_list, unsigned int *list_num ); extern Bool _XimSetInnerICResourceList( XIMResourceList *res_list, unsigned int *list_num ); extern Bool _XimCheckCreateICValues( XIMResourceList res_list, unsigned int list_num ); extern XIMResourceList _XimGetResourceListRec( XIMResourceList res_list, unsigned int list_num, const char *name ); extern void _XimSetIMMode( XIMResourceList res_list, unsigned int list_num ); extern void _XimSetICMode( XIMResourceList res_list, unsigned int list_num, XIMStyle style ); extern int _XimCheckIMMode( XIMResourceList res_list, unsigned long mode ); extern int _XimCheckICMode( XIMResourceList res_list, unsigned long mode ); extern Bool _XimSetLocalIMDefaults( Xim im, XPointer top, XIMResourceList res_list, unsigned int list_num ); extern Bool _XimSetICDefaults( Xic ic, XPointer top, unsigned long mode, XIMResourceList res_list, unsigned int list_num ); extern Bool _XimEncodeLocalIMAttr( XIMResourceList res, XPointer top, XPointer val ); extern Bool _XimEncodeLocalICAttr( Xic ic, XIMResourceList res, XPointer top, XIMArg *arg, unsigned long mode ); extern Bool _XimCheckLocalInputStyle( Xic ic, XPointer top, XIMArg *values, XIMStyles *styles, XIMResourceList res_list, unsigned int list_num ); extern Bool _XimDecodeLocalIMAttr( XIMResourceList res, XPointer top, XPointer val ); extern Bool _XimDecodeLocalICAttr( XIMResourceList res, XPointer top, XPointer val, unsigned long mode ); extern void _XimGetCurrentIMValues( Xim im, XimDefIMValues *im_values ); extern void _XimSetCurrentIMValues( Xim im, XimDefIMValues *im_values ); extern void _XimGetCurrentICValues( Xic ic, XimDefICValues *ic_values ); extern void _XimSetCurrentICValues( Xic ic, XimDefICValues *ic_values ); extern void _XimInitialResourceInfo( void ); extern void _XimParseStringFile( FILE *fp, Xim im ); extern Bool _XimCheckIfLocalProcessing( Xim im ); extern Bool _XimCheckIfThaiProcessing( Xim im ); extern Bool _XimLocalOpenIM( Xim im ); extern Bool _XimThaiOpenIM( Xim im ); extern Bool _XimProtoOpenIM( Xim im ); extern void _XimLocalIMFree( Xim im ); extern void _XimThaiIMFree( Xim im ); extern void _XimProtoIMFree( Xim im ); extern char * _XimSetIMValueData( Xim im, XPointer top, XIMArg *arg, XIMResourceList res_list, unsigned int list_num ); extern char * _XimGetIMValueData( Xim im, XPointer top, XIMArg *arg, XIMResourceList res_list, unsigned int list_num ); extern char * _XimSetICValueData( Xic ic, XPointer top, XIMResourceList res_list, unsigned int list_num, XIMArg *arg, unsigned long mode, Bool flag ); extern char * _XimGetICValueData( Xic ic, XPointer top, XIMResourceList res_list, unsigned int list_num, XIMArg *arg, unsigned long mode ); extern char * _XimLocalSetIMValues( XIM im, XIMArg *arg ); extern char * _XimLocalGetIMValues( XIM im, XIMArg *arg ); extern XIC _XimLocalCreateIC( XIM im, XIMArg *arg ); extern Bool _XimDispatchInit( Xim im ); extern Bool _XimGetAttributeID( Xim im, CARD16 *buf ); extern Bool _XimExtension( Xim im ); extern void _XimDestroyIMStructureList( Xim im ); extern char * _XimMakeIMAttrIDList( Xim im, XIMResourceList res_list, unsigned int res_num, XIMArg *arg, CARD16 *buf, INT16 *len, unsigned long mode ); extern char * _XimMakeICAttrIDList( Xic ic, XIMResourceList res_list, unsigned int res_num, XIMArg *arg, CARD16 *idList, INT16 *num, unsigned long mode ); extern char * _XimDecodeIMATTRIBUTE( Xim im, XIMResourceList res_list, unsigned int res_num, CARD16 *buf, INT16 buf_len, XIMArg *arg, BITMASK32 mode ); extern char * _XimDecodeICATTRIBUTE( Xic ic, XIMResourceList res_list, unsigned int res_num, CARD16 *buf, INT16 buf_len, XIMArg *arg, BITMASK32 mode ); extern Bool _XimRegProtoIntrCallback( Xim im, CARD16 major_code, CARD16 minor_code, Bool (*proc)( Xim, INT16, XPointer, XPointer ), XPointer call_data ); extern Bool _XimErrorCallback( Xim im, INT16 len, XPointer data, XPointer call_data ); extern Bool _XimError( Xim im, Xic ic, CARD16 error_code, INT16 detail_length, CARD16 type, char *detail ); extern Bool _XimRegisterTriggerKeysCallback( Xim im, INT16 len, XPointer data, XPointer call_data ); extern Bool _XimSetEventMaskCallback( Xim im, INT16 len, XPointer data, XPointer call_data ); extern Bool _XimForwardEventCallback( Xim im, INT16 len, XPointer data, XPointer call_data ); extern Bool _XimCommitCallback( Xim im, INT16 len, XPointer data, XPointer call_data ); extern Bool _XimSyncCallback( Xim im, INT16 len, XPointer data, XPointer call_data ); extern void _XimFreeProtoIntrCallback( Xim im ); extern XIC _XimProtoCreateIC( XIM im, XIMArg *arg ); extern void _XimRegisterServerFilter( Xim im ); extern void _XimUnregisterServerFilter( Xim im ); extern Bool _XimTriggerNotify( Xim im, Xic ic, int mode, CARD32 idx ); extern Bool _XimProcSyncReply( Xim im, Xic ic ); extern void _XimSendSetFocus( Xim im, Xic ic ); extern Bool _XimForwardEvent( Xic ic, XEvent *ev, Bool sync ); extern void _XimFreeRemakeArg( XIMArg *arg ); extern void _XimServerDestroy( Xim im ); extern char * _XimEncodeIMATTRIBUTE( Xim im, XIMResourceList res_list, unsigned int res_num, XIMArg *arg, XIMArg **arg_ret, char *buf, int size, int *ret_len, XPointer top, unsigned long mode ); extern char * _XimEncodeICATTRIBUTE( Xic ic, XIMResourceList res_list, unsigned int res_num, XIMArg *arg, XIMArg **arg_ret, char *buf, int size, int *ret_len, XPointer top, BITMASK32 *flag, unsigned long mode ); #ifdef EXT_MOVE extern Bool _XimExtenMove( Xim im, Xic ic, CARD32 flag, CARD16 *buf, INT16 length ); #endif extern int _Ximctstombs( XIM im, char *from, int from_len, char *to, int to_len, Status *state ); extern int _Ximctstowcs( XIM im, char *from, int from_len, wchar_t *to, int to_len, Status *state ); extern int _Ximctstoutf8( XIM im, char *from, int from_len, char *to, int to_len, Status *state ); extern int _XimLcctstombs( XIM im, char *from, int from_len, char *to, int to_len, Status *state ); extern int _XimLcctstowcs( XIM im, char *from, int from_len, wchar_t *to, int to_len, Status *state ); extern int _XimLcctstoutf8( XIM im, char *from, int from_len, char *to, int to_len, Status *state ); extern char _XimGetMyEndian( void ); extern int _XimCheckDataSize( XPointer buf, int len ); extern void _XimSetHeader( XPointer buf, CARD8 major_opcode, CARD8 minor_opcode, INT16 *len ); extern Bool _XimSync( Xim im, Xic ic ); extern int _XimProtoMbLookupString( XIC xic, XKeyEvent *ev, char *buffer, int bytes, KeySym *keysym, Status *state ); extern int _XimProtoWcLookupString( XIC xic, XKeyEvent *ev, wchar_t *buffer, int bytes, KeySym *keysym, Status *state ); extern int _XimProtoUtf8LookupString( XIC xic, XKeyEvent *ev, char *buffer, int bytes, KeySym *keysym, Status *state ); extern void _XimRegisterFilter( Xic ic ); extern void _XimUnregisterFilter( Xic ic ); extern void _XimReregisterFilter( Xic ic ); extern Status _XimProtoEventToWire( XEvent *re, xEvent *event, Bool sw ); extern Bool _XimProtoWireToEvent( XEvent *re, xEvent *event, Bool sw ); #ifdef EXT_FORWARD extern Bool _XimExtForwardKeyEvent( Xic ic, XKeyEvent *ev, Bool sync ); #endif extern int _XimLookupMBText( Xic ic, XKeyEvent *event, char *buffer, int nbytes, KeySym *keysym, XComposeStatus *status ); extern int _XimLookupWCText( Xic ic, XKeyEvent *event, wchar_t *buffer, int nbytes, KeySym *keysym, XComposeStatus *status ); extern int _XimLookupUTF8Text( Xic ic, XKeyEvent *event, char *buffer, int nbytes, KeySym *keysym, XComposeStatus *status ); extern EVENTMASK _XimGetWindowEventmask( Xic ic ); extern Xic _XimICOfXICID( Xim im, XICID icid ); extern void _XimResetIMInstantiateCallback( Xim xim ); extern Bool _XimRegisterIMInstantiateCallback( XLCd lcd, Display *display, XrmDatabase rdb, char *res_name, char *res_class, XIDProc callback, XPointer client_data ); extern Bool _XimUnRegisterIMInstantiateCallback( XLCd lcd, Display *display, XrmDatabase rdb, char *res_name, char *res_class, XIDProc callback, XPointer client_data ); extern void _XimFreeCommitInfo( Xic ic ); extern Bool _XimConnect( Xim im ); extern Bool _XimShutdown( Xim im ); extern Bool _XimWrite( Xim im, INT16 len, XPointer data ); extern Bool _XimRead( Xim im, INT16 *len, XPointer data, int data_len, Bool (*predicate)( Xim, INT16, XPointer, XPointer ), XPointer arg ); extern void _XimFlush( Xim im ); extern Bool _XimFilterWaitEvent( Xim im ); extern void _XimProcError( Xim im, Xic ic, XPointer data ); #ifdef EXT_MOVE extern CARD32 _XimExtenArgCheck( XIMArg *arg ); #endif extern Bool _XimCbDispatch( Xim im, INT16 len, XPointer data, XPointer call_data ); extern Bool _XimLocalFilter( Display *d, Window w, XEvent *ev, XPointer client_data ); extern XIMResourceList _XimGetResourceListRecByQuark( XIMResourceList res_list, unsigned int list_num, XrmQuark quark ); extern Bool _XimReconnectModeCreateIC( Xic ic ); extern char *_XimLocalSetICValues( XIC ic, XIMArg *values ); extern char * _XimLocalGetICValues( XIC ic, XIMArg *values ); extern int _XimLocalMbLookupString( XIC ic, XKeyEvent *ev, char *buffer, int bytes, KeySym *keysym, Status *status ); extern int _XimLocalWcLookupString( XIC ic, XKeyEvent *ev, wchar_t *buffer, int bytes, KeySym *keysym, Status *status ); extern int _XimLocalUtf8LookupString( XIC ic, XKeyEvent *ev, char *buffer, int bytes, KeySym *keysym, Status *status ); extern Bool _XimThaiFilter( Display *d, Window w, XEvent *ev, XPointer client_data ); extern XIC _XimThaiCreateIC( XIM im, XIMArg *values ); extern Status _XimThaiCloseIM( XIM xim ); #ifdef XIM_CONNECTABLE extern void _XimSetProtoResource( Xim im ); extern Bool _XimConnectServer( Xim im ); extern Bool _XimDelayModeSetAttr( Xim im ); extern void _XimServerReconectableDestroy( void ); extern Bool _XimReCreateIC( Xic ic ); extern Bool _XimEncodeSavedIMATTRIBUTE( Xim im, XIMResourceList res_list, unsigned int res_num, int *idx, char *buf, int size, int *ret_len, XPointer top, unsigned long mode ); extern Bool _XimEncodeSavedICATTRIBUTE( Xic ic, XIMResourceList res_list, unsigned int res_num, int *idx, char *buf, int size, int *ret_len, XPointer top, unsigned long mode ); #endif extern Bool _XimRegisterDispatcher( Xim im, Bool (*callback)( Xim, INT16, XPointer, XPointer ), XPointer call_data); extern Bool _XimRespSyncReply( Xic ic, BITMASK16 mode); #endif /* _XIMINT_H */ nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/XimintL.h0000644000000000000000000000661413614532331016042 0ustar /****************************************************************** Copyright 1991, 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1993 by Digital Equipment Corporation Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED and Digital Equipment Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED and Digital Equipment Corporation makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp Modifier: Franky Ling Digital Equipment Corporation frankyling@hgrd01.enet.dec.com ******************************************************************/ #ifndef _XIMINTL_H #define _XIMINTL_H #define COMPOSE_FILE "Compose" /* * Data Structures for Local Processing */ typedef INT32 DTIndex; typedef INT32 DTCharIndex; typedef BITS32 DTModifier; typedef struct _DefTree { DTIndex next; DTIndex succession; /* successive Key Sequence */ /* Key definitions */ DTModifier modifier_mask; DTModifier modifier; KeySym keysym; /* leaf only */ DTCharIndex mb; DTCharIndex wc; /* make from mb */ DTCharIndex utf8; /* make from mb */ KeySym ks; } DefTree; typedef struct _DefTreeBase { DefTree *tree; char *mb; wchar_t *wc; char *utf8; DTIndex treeused, treesize; DTCharIndex mbused, mbsize; DTCharIndex wcused, wcsize; DTCharIndex utf8used, utf8size; } DefTreeBase; typedef struct _XimLocalPrivateRec { /* The first fields are identical with XimCommonPrivateRec. */ XlcConv ctom_conv; XlcConv ctow_conv; XlcConv ctoutf8_conv; XlcConv cstomb_conv; XlcConv cstowc_conv; XlcConv cstoutf8_conv; XlcConv ucstoc_conv; XlcConv ucstoutf8_conv; XIC current_ic; DefTreeBase base; DTIndex top; } XimLocalPrivateRec; typedef struct _XicThaiPart { int comp_state; KeySym keysym; int input_mode; } XicThaiPart; typedef struct _XicLocalPrivateRec { long value_mask; DefTreeBase base; DTIndex context; DTIndex composed; XicThaiPart thai; XIMResourceList ic_resources; unsigned int ic_num_resources; unsigned char brl_pressed, brl_committing, brl_committed; Time brl_release_start; } XicLocalPrivateRec; #endif /* _XIMINTL_H */ nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/XimintP.h0000644000000000000000000002350413614532331016043 0ustar /* * Copyright 1991, 1992 Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1993, 1994 by Sony Corporation Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED and Sony Corporation not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED and Sony Corporation makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED OR SONY CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp Makoto Wakamatsu Sony Corporation makoto@sm.sony.co.jp Hiroyuki Miyamoto Digital Equipment Corporation miyamoto@jrd.dec.com ******************************************************************/ #ifndef _XIMINTP_H #define _XIMINTP_H #include "XimProto.h" #include "XlcPublic.h" /* * for protocol layer callback function */ typedef Bool (*XimProtoIntrProc)( Xim, INT16, XPointer, XPointer ); typedef struct _XimProtoIntrRec { XimProtoIntrProc func; CARD16 major_code; CARD16 minor_code; XPointer call_data; struct _XimProtoIntrRec *next; } XimProtoIntrRec; /* * for transport layer methods */ typedef Bool (*XimTransConnectProc)( Xim ); typedef Bool (*XimTransShutdownProc)( Xim ); typedef Bool (*XimTransWriteProc)( Xim, INT16, XPointer ); typedef Bool (*XimTransReadProc)( Xim, XPointer, int, int * ); typedef void (*XimTransFlushProc)( Xim ); typedef Bool (*XimTransRegDispatcher)( Xim, Bool (*)(Xim, INT16, XPointer, XPointer), XPointer ); typedef Bool (*XimTransCallDispatcher)( Xim, INT16, XPointer ); /* * private part of IM */ typedef struct _XimProtoPrivateRec { /* The first fields are identical with XimCommonPrivateRec. */ XlcConv ctom_conv; XlcConv ctow_conv; XlcConv ctoutf8_conv; XlcConv cstomb_conv; XlcConv cstowc_conv; XlcConv cstoutf8_conv; XlcConv ucstoc_conv; XlcConv ucstoutf8_conv; Window im_window; XIMID imid; CARD16 unused; XIMStyles *default_styles; CARD32 *im_onkeylist; CARD32 *im_offkeylist; BITMASK32 flag; BITMASK32 registed_filter_event; EVENTMASK forward_event_mask; EVENTMASK synchronous_event_mask; XimProtoIntrRec *intrproto; XIMResourceList im_inner_resources; unsigned int im_num_inner_resources; XIMResourceList ic_inner_resources; unsigned int ic_num_inner_resources; char *hold_data; int hold_data_len; char *locale_name; CARD16 protocol_major_version; CARD16 protocol_minor_version; XrmQuark *saved_imvalues; int num_saved_imvalues; /* * transport specific */ XimTransConnectProc connect; XimTransShutdownProc shutdown; XimTransWriteProc write; XimTransReadProc read; XimTransFlushProc flush; XimTransRegDispatcher register_dispatcher; XimTransCallDispatcher call_dispatcher; XPointer spec; } XimProtoPrivateRec; /* * bit mask for the flag of XIMPrivateRec */ #define SERVER_CONNECTED (1L) #define DYNAMIC_EVENT_FLOW (1L << 1) #define USE_AUTHORIZATION_FUNC (1L << 2) #ifdef XIM_CONNECTABLE #define DELAYBINDABLE (1L << 3) #define RECONNECTABLE (1L << 4) #endif /* XIM_CONNECTABLE */ #define FABRICATED (1L << 5) #define NEED_SYNC_REPLY (1L << 6) /* * macro for the flag of XIMPrivateRec */ #define IS_SERVER_CONNECTED(im) \ ((((Xim)im))->private.proto.flag & SERVER_CONNECTED) #define MARK_SERVER_CONNECTED(im) \ ((((Xim)im))->private.proto.flag |= SERVER_CONNECTED) #define UNMARK_SERVER_CONNECTED(im) \ ((((Xim)im))->private.proto.flag &= ~SERVER_CONNECTED) #define IS_DYNAMIC_EVENT_FLOW(im) \ (((Xim)im)->private.proto.flag & DYNAMIC_EVENT_FLOW) #define MARK_DYNAMIC_EVENT_FLOW(im) \ (((Xim)im)->private.proto.flag |= DYNAMIC_EVENT_FLOW) #define IS_USE_AUTHORIZATION_FUNC(im) \ (((Xim)im)->private.proto.flag & USE_AUTHORIZATION_FUNC) #define MARK_USE_AUTHORIZATION_FUNC(im) \ (((Xim)im)->private.proto.flag |= USE_AUTHORIZATION_FUNC) #ifdef XIM_CONNECTABLE #define IS_DELAYBINDABLE(im) \ (((Xim)im)->private.proto.flag & DELAYBINDABLE) #define MARK_DELAYBINDABLE(im) \ (((Xim)im)->private.proto.flag |= DELAYBINDABLE) #define IS_RECONNECTABLE(im) \ (((Xim)im)->private.proto.flag & RECONNECTABLE) #define MARK_RECONNECTABLE(im) \ (((Xim)im)->private.proto.flag |= RECONNECTABLE) #define IS_CONNECTABLE(im) \ (((Xim)im)->private.proto.flag & (DELAYBINDABLE|RECONNECTABLE)) #define UNMAKE_CONNECTABLE(im) \ (((Xim)im)->private.proto.flag &= ~(DELAYBINDABLE|RECONNECTABLE)) #endif /* XIM_CONNECTABLE */ #define IS_FABRICATED(im) \ (((Xim)im)->private.proto.flag & FABRICATED) #define MARK_FABRICATED(im) \ (((Xim)im)->private.proto.flag |= FABRICATED) #define UNMARK_FABRICATED(im) \ (((Xim)im)->private.proto.flag &= ~FABRICATED) #define IS_NEED_SYNC_REPLY(im) \ (((Xim)im)->private.proto.flag & NEED_SYNC_REPLY) #define MARK_NEED_SYNC_REPLY(im) \ (((Xim)im)->private.proto.flag |= NEED_SYNC_REPLY) #define UNMARK_NEED_SYNC_REPLY(im) \ (((Xim)im)->private.proto.flag &= ~NEED_SYNC_REPLY) /* * bit mask for the register_filter_event of XIMPrivateRec/XICPrivateRec */ #define KEYPRESS_MASK (1L) #define KEYRELEASE_MASK (1L << 1) #define DESTROYNOTIFY_MASK (1L << 2) typedef struct _XimCommitInfoRec { struct _XimCommitInfoRec *next; char *string; int string_len; KeySym *keysym; int keysym_len; } XimCommitInfoRec, *XimCommitInfo; typedef struct _XimPendingCallback { int major_opcode; Xim im; Xic ic; char *proto; int proto_len; struct _XimPendingCallback *next; } XimPendingCallbackRec, *XimPendingCallback; /* * private part of IC */ typedef struct _XicProtoPrivateRec { XICID icid; /* ICID */ CARD16 dmy; BITMASK32 flag; /* Input Mode */ BITMASK32 registed_filter_event; /* registed filter mask */ EVENTMASK forward_event_mask; /* forward event mask */ EVENTMASK synchronous_event_mask;/* sync event mask */ EVENTMASK filter_event_mask; /* negrect event mask */ EVENTMASK intercept_event_mask; /* deselect event mask */ EVENTMASK select_event_mask; /* select event mask */ char *preedit_font; /* Base font name list */ int preedit_font_length; /* length of base font name */ char *status_font; /* Base font name list */ int status_font_length; /* length of base font name */ XimCommitInfo commit_info; XIMResourceList ic_resources; unsigned int ic_num_resources; XIMResourceList ic_inner_resources; unsigned int ic_num_inner_resources; XrmQuark *saved_icvalues; int num_saved_icvalues; XimPendingCallback pend_cb_que; Bool waitCallback; } XicProtoPrivateRec ; /* * bit mask for the flag of XICPrivateRec */ #define IC_CONNECTED (1L) /* * macro for the flag of XICPrivateRec */ #define IS_IC_CONNECTED(ic) \ (((Xic)ic)->private.proto.flag & IC_CONNECTED) #define MARK_IC_CONNECTED(ic) \ (((Xic)ic)->private.proto.flag |= IC_CONNECTED) #define UNMARK_IC_CONNECTED(ic) \ (((Xic)ic)->private.proto.flag &= ~IC_CONNECTED) /* * macro for the filter_event_mask of XICPrivateRec */ #define IS_NEGLECT_EVENT(ic, mask) \ (((Xic)ic)->private.proto.filter_event_mask & (mask)) /* * macro for the forward_event_mask of XICPrivateRec */ #define IS_FORWARD_EVENT(ic, mask) \ (((Xic)ic)->private.proto.forward_event_mask & (mask)) /* * macro for the synchronous_event_mask of XICPrivateRec */ #define IS_SYNCHRONOUS_EVENT(ic, mask) \ ((((Xic)ic)->private.proto.synchronous_event_mask & (mask)) ? True: False) #define XIM_MAXIMNAMELEN 64 #define XIM_MAXLCNAMELEN 64 #endif /* _XIMINTP_H */ nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/XimProto.h0000644000000000000000000001376113614532331016240 0ustar /****************************************************************** Copyright 1992, 1993 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifndef _XIMPROTO_H #define _XIMPROTO_H /* * Default Preconnection selection target */ #define XIM_SERVERS "XIM_SERVERS" #define XIM_LOCALES "LOCALES" #define XIM_TRANSPORT "TRANSPORT" /* * categories in XIM_SERVERS */ #define XIM_SERVER_CATEGORY "@server=" #define XIM_LOCAL_CATEGORY "@locale=" #define XIM_TRANSPORT_CATEGORY "@transport=" /* * Xim implementation revision */ #define PROTOCOLMAJORVERSION 1 #define PROTOCOLMINORVERSION 0 /* * Major Protocol number */ #define XIM_CONNECT 1 #define XIM_CONNECT_REPLY 2 #define XIM_DISCONNECT 3 #define XIM_DISCONNECT_REPLY 4 #define XIM_AUTH_REQUIRED 10 #define XIM_AUTH_REPLY 11 #define XIM_AUTH_NEXT 12 #define XIM_AUTH_SETUP 13 #define XIM_AUTH_NG 14 #define XIM_ERROR 20 #define XIM_OPEN 30 #define XIM_OPEN_REPLY 31 #define XIM_CLOSE 32 #define XIM_CLOSE_REPLY 33 #define XIM_REGISTER_TRIGGERKEYS 34 #define XIM_TRIGGER_NOTIFY 35 #define XIM_TRIGGER_NOTIFY_REPLY 36 #define XIM_SET_EVENT_MASK 37 #define XIM_ENCODING_NEGOTIATION 38 #define XIM_ENCODING_NEGOTIATION_REPLY 39 #define XIM_QUERY_EXTENSION 40 #define XIM_QUERY_EXTENSION_REPLY 41 #define XIM_SET_IM_VALUES 42 #define XIM_SET_IM_VALUES_REPLY 43 #define XIM_GET_IM_VALUES 44 #define XIM_GET_IM_VALUES_REPLY 45 #define XIM_CREATE_IC 50 #define XIM_CREATE_IC_REPLY 51 #define XIM_DESTROY_IC 52 #define XIM_DESTROY_IC_REPLY 53 #define XIM_SET_IC_VALUES 54 #define XIM_SET_IC_VALUES_REPLY 55 #define XIM_GET_IC_VALUES 56 #define XIM_GET_IC_VALUES_REPLY 57 #define XIM_SET_IC_FOCUS 58 #define XIM_UNSET_IC_FOCUS 59 #define XIM_FORWARD_EVENT 60 #define XIM_SYNC 61 #define XIM_SYNC_REPLY 62 #define XIM_COMMIT 63 #define XIM_RESET_IC 64 #define XIM_RESET_IC_REPLY 65 #define XIM_GEOMETRY 70 #define XIM_STR_CONVERSION 71 #define XIM_STR_CONVERSION_REPLY 72 #define XIM_PREEDIT_START 73 #define XIM_PREEDIT_START_REPLY 74 #define XIM_PREEDIT_DRAW 75 #define XIM_PREEDIT_CARET 76 #define XIM_PREEDIT_CARET_REPLY 77 #define XIM_PREEDIT_DONE 78 #define XIM_STATUS_START 79 #define XIM_STATUS_DRAW 80 #define XIM_STATUS_DONE 81 #define XIM_PREEDITSTATE 82 /* * values for the flag of XIM_ERROR */ #define XIM_IMID_VALID 0x0001 #define XIM_ICID_VALID 0x0002 /* * XIM Error Code */ #define XIM_BadAlloc 1 #define XIM_BadStyle 2 #define XIM_BadClientWindow 3 #define XIM_BadFocusWindow 4 #define XIM_BadArea 5 #define XIM_BadSpotLocation 6 #define XIM_BadColormap 7 #define XIM_BadAtom 8 #define XIM_BadPixel 9 #define XIM_BadPixmap 10 #define XIM_BadName 11 #define XIM_BadCursor 12 #define XIM_BadProtocol 13 #define XIM_BadForeground 14 #define XIM_BadBackground 15 #define XIM_LocaleNotSupported 16 #define XIM_BadSomething 999 /* * byte order */ #define BIGENDIAN (CARD8)0x42 /* MSB first */ #define LITTLEENDIAN (CARD8)0x6c /* LSB first */ /* * values for the type of XIMATTR & XICATTR */ #define XimType_SeparatorOfNestedList 0 #define XimType_CARD8 1 #define XimType_CARD16 2 #define XimType_CARD32 3 #define XimType_STRING8 4 #define XimType_Window 5 #define XimType_XIMStyles 10 #define XimType_XRectangle 11 #define XimType_XPoint 12 #define XimType_XFontSet 13 #define XimType_XIMOptions 14 #define XimType_XIMHotKeyTriggers 15 #define XimType_XIMHotKeyState 16 #define XimType_XIMStringConversion 17 #define XimType_NEST 0x7fff /* * values for the category of XIM_ENCODING_NEGITIATON_REPLY */ #define XIM_Encoding_NameCategory 0 #define XIM_Encoding_DetailCategory 1 /* * value for the index of XIM_ENCODING_NEGITIATON_REPLY */ #define XIM_Default_Encoding_IDX -1 /* * value for the flag of XIM_FORWARD_EVENT, XIM_COMMIT */ #define XimSYNCHRONUS 0x0001 #define XimLookupChars 0x0002 #define XimLookupKeySym 0x0004 #define XimLookupBoth 0x0006 /* * request packet header size */ #define XIM_HEADER_SIZE \ sizeof(CARD8) /* sizeof mejor-opcode */ \ + sizeof(CARD8) /* sizeof minor-opcode */ \ + sizeof(INT16) /* sizeof length */ /* * Client Message data size */ #define XIM_CM_DATA_SIZE 20 /* * XIM data structure */ typedef CARD16 BITMASK16; typedef CARD32 BITMASK32; typedef CARD32 EVENTMASK; typedef CARD16 XIMID; /* Input Method ID */ typedef CARD16 XICID; /* Input Context ID */ /* * Padding macro */ #define XIM_PAD(length) ((4 - ((length) % 4)) % 4) #define XIM_SET_PAD(ptr, length) \ { \ register int Counter = XIM_PAD((int)length); \ if (Counter) { \ register char *Ptr = (char *)(ptr) + (length); \ length += Counter; \ for (; Counter; --Counter, ++Ptr) \ *Ptr = '\0'; \ } \ } #endif /* _XIMPROTO_H */ nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/XimThai.h0000644000000000000000000000701313614532331016013 0ustar /*********************************************************** Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1993 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* **++ ** FACILITY: ** ** Xlib ** ** ABSTRACT: ** ** Definition file for Thai specific functions. ** ** MODIFICATION HISTORY: ** **/ #ifndef _XIMTHAI_H_ #define _XIMTHAI_H_ #include /* Classification of characters in TIS620 according to WTT */ #define CTRL 0 /* control chars */ #define NON 1 /* non composibles */ #define CONS 2 /* consonants */ #define LV 3 /* leading vowels */ #define FV1 4 /* following vowels */ #define FV2 5 #define FV3 6 #define BV1 7 /* below vowels */ #define BV2 8 #define BD 9 /* below diacritics */ #define TONE 10 /* tonemarks */ #define AD1 11 /* above diacritics */ #define AD2 12 #define AD3 13 #define AV1 14 /* above vowels */ #define AV2 15 #define AV3 16 /* extended classification */ #define DEAD 17 /* group of non-spacing characters */ /* display levels in display cell */ #define NONDISP 0 /* non displayable */ #define TOP 1 #define ABOVE 2 #define BASE 3 #define BELOW 4 /* Input Sequence Check modes */ #define WTT_ISC1 1 /* WTT default ISC mode */ #define WTT_ISC2 2 /* WTT strict ISC mode */ #define THAICAT_ISC 3 /* THAICAT ISC mode */ #define NOISC 255 /* No ISC */ #endif /* _XIMTHAI_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/xim_trans.c0000644000000000000000000000241013614532331016443 0ustar /* * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #define XIM_t 1 #define TRANS_CLIENT 1 #include nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/XimTrans.h0000644000000000000000000000776113614532331016227 0ustar /* * Copyright 1992 Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifndef _XIMTRANS_H #define _XIMTRANS_H typedef struct _TransIntrCallbackRec *TransIntrCallbackPtr; typedef struct _TransIntrCallbackRec { Bool (*func)( Xim, INT16, XPointer, XPointer ); XPointer call_data; TransIntrCallbackPtr next; } TransIntrCallbackRec ; typedef struct { TransIntrCallbackPtr intr_cb; struct _XtransConnInfo *trans_conn; /* transport connection object */ int fd; char *address; Window window; Bool is_putback; } TransSpecRec; /* * Prototypes */ extern Bool _XimTransRegisterDispatcher( Xim im, Bool (*callback)( Xim, INT16, XPointer, XPointer ), XPointer call_data ); extern Bool _XimTransIntrCallback( Xim im, Bool (*callback)( Xim, INT16, XPointer, XPointer ), XPointer call_data ); extern Bool _XimTransCallDispatcher( Xim im, INT16 len, XPointer data ); extern void _XimFreeTransIntrCallback( Xim im ); extern Bool _XimTransFilterWaitEvent( Display *d, Window w, XEvent *ev, XPointer arg ); extern void _XimTransInternalConnection( Display *d, int fd, XPointer arg ); extern Bool _XimTransWrite( Xim im, INT16 len, XPointer data ); extern Bool _XimTransRead( Xim im, XPointer recv_buf, int buf_len, int *ret_len ); extern void _XimTransFlush( Xim im ); #endif /* _XIMTRANS__H */ nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/XimTrInt.h0000644000000000000000000000572413614532331016175 0ustar /* * Copyright 1992 Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /****************************************************************** Copyright 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifndef _XIMTRINT_H #define _XIMTRINT_H #include "Ximint.h" typedef struct { const char *transportname; Bool (*config)( Xim, char * ); } TransportSW; extern TransportSW _XimTransportRec[]; /* * Global symbols */ extern Bool _XimXConf( Xim im, char *address ); #if defined(TCPCONN) || defined(UNIXCONN) extern Bool _XimTransConf( Xim im, char *address ); #endif #endif /* _XIMTRINT_H */ nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/XimTrX.h0000644000000000000000000000653113614532331015647 0ustar /* * Copyright 1992 Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /****************************************************************** Copyright 1992, 1993, 1994 by FUJITSU LIMITED Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of FUJITSU LIMITED not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. FUJITSU LIMITED makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ #ifndef _XIMTRX_H #define _XIMTRX_H typedef struct _XIntrCallbackRec *XIntrCallbackPtr; typedef struct _XIntrCallbackRec { Bool (*func)( Xim, INT16, XPointer, XPointer ); XPointer call_data; XIntrCallbackPtr next; } XIntrCallbackRec ; typedef struct _XSpecRec { XIntrCallbackPtr intr_cb; Atom imconnectid; Atom improtocolid; Atom immoredataid; Window lib_connect_wid; Window ims_connect_wid; XPointer ev; CARD32 major_code; CARD32 minor_code; CARD32 BoundarySize; } XSpecRec; #define _XIM_PROTOCOL "_XIM_PROTOCOL" #define _XIM_XCONNECT "_XIM_XCONNECT" #define _XIM_MOREDATA "_XIM_MOREDATA" #define MAJOR_TRANSPORT_VERSION 0 #define MINOR_TRANSPORT_VERSION 0 #endif /* _XIMTRX_H */ nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/XlcGeneric.h0000644000000000000000000001051113614532331016470 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ /* * Copyright 1995 by FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. * * Modifier: Takanori Tateno FUJITSU LIMITED * */ #ifndef _XLCGENERIC_H_ #define _XLCGENERIC_H_ #include "XlcPubI.h" typedef struct _ByteInfo { unsigned char start,end; } ByteInfoRec, *ByteInfo; typedef struct _ByteInfoList { int M; /* 1 <= M <= length */ int byteinfo_num; ByteInfo byteinfo; } ByteInfoListRec, *ByteInfoList; /* conversion_type values */ #define LOCALCONV 1 #define FILECONV 2 #define FUNCTIONCONV 4 typedef struct _Conversion { unsigned long conversion_type; int conv_num; FontScope convlist; char *cnv_file; XlcConv cnvfunc; } ConversionRec, *Conversion; typedef struct _ExtdSegment { char *name; XlcSide side; FontScope area; int area_num; XlcCharSet charset; } ExtdSegmentRec, *ExtdSegment; typedef struct _SegConvRec { int length; char *source_encoding; XlcCharSet source; char *destination_encoding; XlcCharSet dest; FontScopeRec range; int conv_num; FontScope conv; } SegConvRec, *SegConv; typedef struct _ParseInfoRec *ParseInfo; typedef struct _CodeSetRec { XlcCharSet *charset_list; int num_charsets; int cs_num; XlcSide side; int length; ByteInfoList byteM; Conversion mbconv; Conversion ctconv; ExtdSegment ctextseg; ParseInfo parse_info; unsigned long wc_encoding; Bool string_encoding; } CodeSetRec, *CodeSet; typedef enum { E_GL, /* GL encoding */ E_GR, /* GR encoding */ E_SS, /* single shift */ E_LSL, /* locking shift left */ E_LSR, /* locking shift right */ E_LAST } EncodingType; typedef struct _ParseInfoRec { EncodingType type; char *encoding; CodeSet codeset; } ParseInfoRec; /* * XLCd private data */ #define XLC_GENERIC(lcd, x) (((XLCdGeneric) lcd->core)->gen.x) #define XLC_GENERIC_PART(lcd) (&(((XLCdGeneric) lcd->core)->gen)) typedef struct _XLCdGenericPart { int codeset_num; CodeSet *codeset_list; unsigned char *mb_parse_table; int mb_parse_list_num; ParseInfo *mb_parse_list; unsigned long wc_encode_mask; unsigned long wc_shift_bits; CodeSet initial_state_GL; CodeSet initial_state_GR; int segment_conv_num; /* UDC */ SegConv segment_conv; /* UDC */ Bool use_stdc_env; Bool force_convert_to_mb; } XLCdGenericPart; typedef struct _XLCdGenericRec { XLCdCoreRec core; XLCdPublicPart pub; XLCdGenericPart gen; } XLCdGenericRec, *XLCdGeneric; extern XLCdMethods _XlcGenericMethods; extern FontScope _XlcParse_scopemaps( const char *str, int *size); extern void _XlcDbg_printValue( const char *str, char **value, int num); extern XIM _XDefaultOpenIM( XLCd lcd, Display *dpy, XrmDatabase rdb, char *res_name, char *res_class); #endif /* _XLCGENERIC_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/Xlcint.h0000644000000000000000000005704413614532331015722 0ustar /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation, * and Nippon Telegraph and Telephone Corporation * Copyright 1991 by the Open Software Foundation * Copyright 1993 by the TOSHIBA Corp. * Copyright 1993, 1994 by Sony Corporation * Copyright 1993, 1994 by the FUJITSU LIMITED * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of OMRON, NTT Software, NTT, Open * Software Foundation, and Sony Corporation not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. OMRON, NTT Software, NTT, Open Software * Foundation, and Sony Corporation make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * OMRON, NTT SOFTWARE, NTT, OPEN SOFTWARE FOUNDATION, AND SONY * CORPORATION DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT * SHALL OMRON, NTT SOFTWARE, NTT, OPEN SOFTWARE FOUNDATION, OR SONY * CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Authors: Li Yuhong OMRON Corporation * Tatsuya Kato NTT Software Corporation * Hiroshi Kuribayashi OMRON Coproration * Muneiyoshi Suzuki Nippon Telegraph and Telephone Co. * * M. Collins OSF * Katsuhisa Yano TOSHIBA Corp. * Makoto Wakamatsu Sony Corporation * Takashi Fujiwara FUJITSU LIMITED */ #ifndef _XLCINT_H_ #define _XLCINT_H_ #ifndef _XP_PRINT_SERVER_ #include #include #include typedef Bool (*XFilterEventProc)( Display* /* display */, Window /* window */, XEvent* /* event */, XPointer /* client_data */ ); typedef struct _XIMFilter { struct _XIMFilter *next; Window window; unsigned long event_mask; int start_type, end_type; XFilterEventProc filter; XPointer client_data; } XFilterEventRec, *XFilterEventList; typedef struct { char *name; XPointer value; } XIMArg; #ifdef offsetof #define XOffsetOf(s_type,field) offsetof(s_type,field) #else #define XOffsetOf(s_type,field) ((unsigned int)&(((s_type*)NULL)->field)) #endif #define XIMNumber(arr) ((unsigned int) (sizeof(arr) / sizeof(arr[0]))) /* * define secondary data structs which are part of Input Methods * and Input Context */ typedef struct { const char *resource_name; /* Resource string */ XrmQuark xrm_name; /* Resource name quark */ int resource_size; /* Size in bytes of data */ long resource_offset; /* Offset from base */ unsigned short mode; /* Read Write Permission */ unsigned short id; /* Input Method Protocol */ } XIMResource, *XIMResourceList; /* * data block describing the visual attributes associated with * an input context */ typedef struct { XRectangle area; XRectangle area_needed; XPoint spot_location; Colormap colormap; Atom std_colormap; unsigned long foreground; unsigned long background; Pixmap background_pixmap; XFontSet fontset; int line_spacing; Cursor cursor; XICCallback start_callback; XICCallback done_callback; XICCallback draw_callback; XICCallback caret_callback; XIMPreeditState preedit_state; XICCallback state_notify_callback; } ICPreeditAttributes, *ICPreeditAttributesPtr; typedef struct { XRectangle area; XRectangle area_needed; Colormap colormap; Atom std_colormap; unsigned long foreground; unsigned long background; Pixmap background_pixmap; XFontSet fontset; int line_spacing; Cursor cursor; XICCallback start_callback; XICCallback done_callback; XICCallback draw_callback; } ICStatusAttributes, *ICStatusAttributesPtr; #endif /* !_XP_PRINT_SERVER_ */ /* * Methods for Xrm parsing */ /* The state is a pointer to an object created by the locale's init_parse_info function (default: _XrmDefaultInitParseInfo). */ /* Sets the state to the initial state. Initiates a sequence of calls to the XmbCharProc. */ typedef void (*XmbInitProc)( XPointer state ); /* Transforms one multibyte character, starting at str, and return a 'char' in the same parsing class (not a wide character!). Returns the number of consumed bytes in *lenp. */ typedef char (*XmbCharProc)( XPointer state, const char * str, int* lenp ); /* Terminates a sequence of calls to the XmbCharProc. */ typedef void (*XmbFinishProc)( XPointer state ); /* Returns the name of the state's locale, as a static string. */ typedef const char* (*XlcNameProc)( XPointer state ); /* Frees the state, which was allocated by the locale's init_parse_info function. */ typedef void (*XrmDestroyProc)( XPointer state ); /* Set of methods for Xrm parsing. */ typedef struct { XmbInitProc mbinit; XmbCharProc mbchar; XmbFinishProc mbfinish; XlcNameProc lcname; XrmDestroyProc destroy; } XrmMethodsRec; typedef const XrmMethodsRec *XrmMethods; #ifndef _XP_PRINT_SERVER_ typedef struct _XLCd *XLCd; /* need forward reference */ /* * define an LC, it's methods, and data. */ typedef void (*XCloseLCProc)( XLCd /* lcd */ ); typedef char* (*XlcMapModifiersProc)( XLCd /* lcd */, _Xconst char* /* user_mods */, _Xconst char* /* prog_mods */ ); typedef XOM (*XOpenOMProc)( XLCd /* lcd */, Display* /* display */, XrmDatabase /* rdb */, _Xconst char* /* res_name */, _Xconst char* /* res_class */ ); typedef XIM (*XOpenIMProc)( XLCd /* lcd */, Display* /* display */, XrmDatabase /* rdb */, char* /* res_name */, char* /* res_class */ ); typedef Bool (*XRegisterIMInstantiateCBProc)( XLCd /* lcd */, Display* /* display */, XrmDatabase /* rdb */, char* /* res_name */, char* /* res_class */, XIDProc /* callback */, XPointer /* client_data */ ); typedef Bool (*XUnregisterIMInstantiateCBProc)( XLCd /* lcd */, Display* /* display */, XrmDatabase /* rdb */, char* /* res_name */, char* /* res_class */, XIDProc /* callback */, XPointer /* client_data */ ); typedef XrmMethods (*XrmInitParseInfoProc)( XLCd /* lcd */, XPointer* /* state */ ); typedef int (*XmbTextPropertyToTextListProc)( XLCd lcd, Display* display, const XTextProperty* text_prop, char*** list_return, int* count_return ); typedef int (*XwcTextPropertyToTextListProc)( XLCd lcd, Display* display, const XTextProperty* text_prop, wchar_t*** list_return, int* count_return ); typedef int (*XmbTextListToTextPropertyProc)( XLCd lcd, Display* display, char** list, int count, XICCEncodingStyle style, XTextProperty* text_prop_return ); typedef int (*XwcTextListToTextPropertyProc)( XLCd lcd, Display* display, wchar_t** list, int count, XICCEncodingStyle style, XTextProperty* text_prop_return ); typedef void (*XwcFreeStringListProc)( XLCd lcd, wchar_t** list ); typedef const char* (*XDefaultStringProc)( XLCd lcd ); typedef struct { XCloseLCProc close; XlcMapModifiersProc map_modifiers; XOpenOMProc open_om; XOpenIMProc open_im; XrmInitParseInfoProc init_parse_info; XmbTextPropertyToTextListProc mb_text_prop_to_list; XwcTextPropertyToTextListProc wc_text_prop_to_list; XmbTextPropertyToTextListProc utf8_text_prop_to_list; XmbTextListToTextPropertyProc mb_text_list_to_prop; XwcTextListToTextPropertyProc wc_text_list_to_prop; XmbTextListToTextPropertyProc utf8_text_list_to_prop; XwcFreeStringListProc wc_free_string_list; XDefaultStringProc default_string; XRegisterIMInstantiateCBProc register_callback; XUnregisterIMInstantiateCBProc unregister_callback; } XLCdMethodsRec, *XLCdMethods; typedef struct { char* name; /* name of this LC */ char* modifiers; /* modifiers of locale */ } XLCdCoreRec, *XLCdCore; typedef struct _XLCd { XLCdMethods methods; /* methods of this LC */ XLCdCore core; /* data of this LC */ XPointer opaque; /* LDX specific data */ } XLCdRec; typedef int XlcPosition; #define XlcHead 0 #define XlcTail -1 typedef struct { char *name; XPointer value; } XlcArg, *XlcArgList; typedef struct _XlcResource { const char *name; XrmQuark xrm_name; int size; int offset; unsigned long mask; } XlcResource, *XlcResourceList; #define XlcCreateMask (1L<<0) #define XlcDefaultMask (1L<<1) #define XlcGetMask (1L<<2) #define XlcSetMask (1L<<3) #define XlcIgnoreMask (1L<<4) #define XlcNumber(arr) (sizeof(arr) / sizeof(arr[0])) typedef Status (*XCloseOMProc)( XOM /* om */ ); typedef char* (*XSetOMValuesProc)( XOM /* om */, XlcArgList /* args */, int /* num_args */ ); typedef char* (*XGetOMValuesProc)( XOM /* om */, XlcArgList /* args */, int /* num_args */ ); typedef XOC (*XCreateOCProc)( XOM /* om */, XlcArgList /* args */, int /* num_args */ ); typedef struct _XOMMethodsRec { XCloseOMProc close; XSetOMValuesProc set_values; XGetOMValuesProc get_values; XCreateOCProc create_oc; } XOMMethodsRec, *XOMMethods; typedef struct _XOMCoreRec { XLCd lcd; /* lcd */ Display *display; /* display */ XrmDatabase rdb; /* database */ char *res_name; /* resource name */ char *res_class; /* resource class */ XOC oc_list; /* xoc list */ XlcResourceList resources; /* xom resources */ int num_resources; /* number of xom resources */ XOMCharSetList required_charset; /* required charset list */ XOMOrientation orientation_list; /* orientation list */ Bool directional_dependent; /* directional-dependent */ Bool contextual_drawing; /* contextual drawing */ Bool context_dependent; /* context-dependent drawing */ } XOMCoreRec, *XOMCore; typedef struct _XOM { XOMMethods methods; XOMCoreRec core; } XOMRec; typedef void (*XDestroyOCProc)( XOC /* oc */ ); typedef char* (*XSetOCValuesProc)( XOC /* oc */, XlcArgList /* args */, int /* num_args */ ); typedef char* (*XGetOCValuesProc)( XOC /* oc */, XlcArgList /* args */, int /* num_args */ ); /* * X Font Sets are an instantiable object, so we define it, the * object itself, a method list and data */ /* * XFontSet object method list */ typedef int (*XmbTextEscapementProc)( XFontSet /* font_set */, _Xconst char* /* text */, int /* text_len */ ); typedef int (*XmbTextExtentsProc)( XFontSet /* font_set */, _Xconst char* /* text */, int /* text_len */, XRectangle* /* overall_ink_extents */, XRectangle* /* overall_logical_extents */ ); typedef Status (*XmbTextPerCharExtentsProc)( XFontSet /* font_set */, _Xconst char* /* text */, int /* text_len */, XRectangle* /* ink_extents_buffer */, XRectangle* /* logical_extents_buffer */, int /* buffer_size */, int* /* num_chars */, XRectangle* /* max_ink_extents */, XRectangle* /* max_logical_extents */ ); typedef int (*XmbDrawStringProc)( Display* /* display */, Drawable /* drawable */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst char* /* text */, int /* text_len */ ); typedef void (*XmbDrawImageStringProc)( Display* /* display */, Drawable /* drawable */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst char* /* text */, int /* text_len */ ); typedef int (*XwcTextEscapementProc)( XFontSet /* font_set */, _Xconst wchar_t* /* text */, int /* text_len */ ); typedef int (*XwcTextExtentsProc)( XFontSet /* font_set */, _Xconst wchar_t* /* text */, int /* text_len */, XRectangle* /* overall_ink_extents */, XRectangle* /* overall_logical_extents */ ); typedef Status (*XwcTextPerCharExtentsProc)( XFontSet /* font_set */, _Xconst wchar_t* /* text */, int /* text_len */, XRectangle* /* ink_extents_buffer */, XRectangle* /* logical_extents_buffer */, int /* buffer_size */, int* /* num_chars */, XRectangle* /* max_ink_extents */, XRectangle* /* max_logical_extents */ ); typedef int (*XwcDrawStringProc)( Display* /* display */, Drawable /* drawable */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst wchar_t* /* text */, int /* text_len */ ); typedef void (*XwcDrawImageStringProc)( Display* /* display */, Drawable /* drawable */, XFontSet /* font_set */, GC /* gc */, int /* x */, int /* y */, _Xconst wchar_t* /* text */, int /* text_len */ ); typedef struct { XDestroyOCProc destroy; XSetOCValuesProc set_values; XGetOCValuesProc get_values; /* multi-byte text drawing methods */ XmbTextEscapementProc mb_escapement; XmbTextExtentsProc mb_extents; XmbTextPerCharExtentsProc mb_extents_per_char; XmbDrawStringProc mb_draw_string; XmbDrawImageStringProc mb_draw_image_string; /* wide character text drawing methods */ XwcTextEscapementProc wc_escapement; XwcTextExtentsProc wc_extents; XwcTextPerCharExtentsProc wc_extents_per_char; XwcDrawStringProc wc_draw_string; XwcDrawImageStringProc wc_draw_image_string; /* UTF-8 text drawing methods */ XmbTextEscapementProc utf8_escapement; XmbTextExtentsProc utf8_extents; XmbTextPerCharExtentsProc utf8_extents_per_char; XmbDrawStringProc utf8_draw_string; XmbDrawImageStringProc utf8_draw_image_string; } XOCMethodsRec, *XOCMethods; /* * XOC independent data */ typedef struct { XOM om; /* XOM */ XOC next; /* next XOC */ XlcResourceList resources; /* xoc resources */ int num_resources; /* number of xoc resources */ char *base_name_list; /* base font name list */ Bool om_automatic; /* OM Automatic */ XOMFontInfo font_info; /* font info */ XFontSetExtents font_set_extents; /* font set extents */ char *default_string; /* default string */ XOMCharSetList missing_list; /* missing charset list */ XOrientation orientation; /* orientation */ char *res_name; /* resource name */ char *res_class; /* resource class */ } XOCCoreRec, *XOCCore; typedef struct _XOC { XOCMethods methods; XOCCoreRec core; } XOCRec; /* * X Input Managers are an instantiable object, so we define it, the * object itself, a method list and data. */ /* * an Input Manager object method list */ typedef struct { Status (*close)( XIM ); char* (*set_values)( XIM, XIMArg* ); char* (*get_values)( XIM, XIMArg* ); XIC (*create_ic)( XIM, XIMArg* ); int (*ctstombs)( XIM, char*, int, char*, int, Status * ); int (*ctstowcs)( XIM, char*, int, wchar_t*, int, Status * ); int (*ctstoutf8)( XIM, char*, int, char*, int, Status * ); } XIMMethodsRec, *XIMMethods; /* * Input Manager LC independent data */ typedef struct { XLCd lcd; /* LC of this input method */ XIC ic_chain; /* list of ICs for this IM */ Display * display; /* display */ XrmDatabase rdb; char * res_name; char * res_class; XIMValuesList *im_values_list; XIMValuesList *ic_values_list; XIMStyles *styles; XIMCallback destroy_callback; char * im_name; /* XIMMODIFIER name */ XIMResourceList im_resources; /* compiled IM resource list */ unsigned int im_num_resources; XIMResourceList ic_resources; /* compiled IC resource list */ unsigned int ic_num_resources; Bool visible_position; } XIMCoreRec, *XIMCore; /* * An X Input Manager (IM). Implementations may need to extend this data * structure to accomodate additional data, state information etc. */ typedef struct _XIM { XIMMethods methods; /* method list of this IM */ XIMCoreRec core; /* data of this IM */ } XIMRec; /* * X Input Contexts (IC) are an instantiable object, so we define it, the * object itself, a method list and data for this object */ /* * Input Context method list */ typedef struct { void (*destroy)( XIC ); void (*set_focus)( XIC ); void (*unset_focus)( XIC ); char* (*set_values)( XIC, XIMArg* ); char* (*get_values)( XIC, XIMArg* ); char* (*mb_reset)( XIC ); wchar_t* (*wc_reset)( XIC ); char* (*utf8_reset)( XIC ); int (*mb_lookup_string)( XIC, XKeyEvent*, char*, int, KeySym*, Status* ); int (*wc_lookup_string)( XIC, XKeyEvent*, wchar_t*, int, KeySym*, Status* ); int (*utf8_lookup_string)( XIC, XKeyEvent*, char*, int, KeySym*, Status* ); } XICMethodsRec, *XICMethods; /* * Input Context LC independent data */ typedef struct { XIM im; /* XIM this IC belongs too */ XIC next; /* linked list of ICs for IM */ Window client_window; /* window IM can use for */ /* display or subwindows */ XIMStyle input_style; /* IM's input style */ Window focus_window; /* where key events go */ unsigned long filter_events; /* event mask from IM */ XICCallback geometry_callback; /* client callback */ char * res_name; char * res_class; XICCallback destroy_callback; XICCallback string_conversion_callback; XIMStringConversionText string_conversion; XIMResetState reset_state; XIMHotKeyTriggers *hotkey; XIMHotKeyState hotkey_state; ICPreeditAttributes preedit_attr; /* visuals of preedit area */ ICStatusAttributes status_attr; /* visuals of status area */ } XICCoreRec, *XICCore; /* * an Input Context. Implementations may need to extend this data * structure to accomodate additional data, state information etc. */ typedef struct _XIC { XICMethods methods; /* method list of this IC */ XICCoreRec core; /* data of this IC */ } XICRec; /* If the argument 'name' is appropriate for this loader, it instantiates an XLCd object with appropriate locale methods and returns it. May return NULL; in this case, the remaining loaders are tried. */ typedef XLCd (*XLCdLoadProc)( const char* name ); _XFUNCPROTOBEGIN extern XLCd _XOpenLC( char* name ); extern void _XCloseLC( XLCd lcd ); extern XLCd _XlcCurrentLC (void); extern Bool _XlcValidModSyntax( const char* mods, const char* const * valid ); extern char *_XlcDefaultMapModifiers( XLCd lcd, _Xconst char* user_mods, _Xconst char* prog_mods ); extern void _XIMCompileResourceList( XIMResourceList /* res */, unsigned int /* num_res */ ); extern void _XCopyToArg( XPointer /* src */, XPointer* /* dst */, unsigned int /* size */ ); extern char ** _XParseBaseFontNameList( char* /* str */, int* /* num */ ); extern XrmMethods _XrmInitParseInfo( XPointer* statep ); extern void _XRegisterFilterByMask( Display* /* dpy */, Window /* window */, unsigned long /* event_mask */, Bool (*)( Display* /* display */, Window /* window */, XEvent* /* event */, XPointer /* client_data */ ) /* filter */, XPointer /* client_data */ ); extern void _XRegisterFilterByType( Display* /* dpy */, Window /* window */, int /* start_type */, int /* end_type */, Bool (*)( Display* /* display */, Window /* window */, XEvent* /* event */, XPointer /* client_data */ ) /* filter */, XPointer /* client_data */ ); extern void _XUnregisterFilter( Display* /* dpy */, Window /* window */, Bool (*)( Display* /* display */, Window /* window */, XEvent* /* event */, XPointer /* client_data */ ) /* filter */, XPointer /* client_data */ ); extern void _XlcCountVaList( va_list var, int* count_return ); extern void _XlcVaToArgList( va_list var, int count, XlcArgList* args_return ); extern void _XlcCopyFromArg( char * src, char * dst, int size ); extern void _XlcCopyToArg( char * src, char ** dst, int size ); extern void _XlcCompileResourceList( XlcResourceList resources, int num_resources ); extern char *_XlcGetValues( XPointer base, XlcResourceList resources, int num_resources, XlcArgList args, int num_args, unsigned long mask ); extern char *_XlcSetValues( XPointer base, XlcResourceList resources, int num_resources, XlcArgList args, int num_args, unsigned long mask ); /* documented in i18n/Framework.PS */ extern void _XlcInitLoader (void); extern void _XlcDeInitLoader (void); /* documented in i18n/Framework.PS */ /* Returns True on success, False on failure. */ extern Bool _XlcAddLoader( XLCdLoadProc proc, XlcPosition position ); /* documented in i18n/Framework.PS */ extern void _XlcRemoveLoader( XLCdLoadProc proc ); /* Registers UTF-8 converters for a non-UTF-8 locale. */ extern void _XlcAddUtf8Converters( XLCd lcd ); /* Registers UTF-8 converters for a UTF-8 locale. */ extern void _XlcAddUtf8LocaleConverters( XLCd lcd ); /* Registers GB18030 converters for a GB18030 locale. */ extern void _XlcAddGB18030LocaleConverters( XLCd lcd ); /* The default locale loader. Assumes an ASCII encoding. */ extern XLCd _XlcDefaultLoader( const char* name ); /* The generic locale loader. Suitable for all encodings except UTF-8. Uses an XLC_LOCALE configuration file. */ extern XLCd _XlcGenericLoader( const char* name ); /* The UTF-8 locale loader. Suitable for UTF-8 encoding. Uses an XLC_LOCALE configuration file. */ extern XLCd _XlcUtf8Loader( const char* name ); extern XLCd _XlcDynamicLoad( const char* name ); /* The old dynamic loader. */ extern XLCd _XlcDynamicLoader( const char* name ); extern Bool _XInitDefaultIM( XLCd lcd ); extern Bool _XInitDefaultOM( XLCd lcd ); extern Bool _XInitDynamicIM( XLCd lcd ); extern Bool _XInitDynamicOM( XLCd lcd ); _XFUNCPROTOEND #endif /* !_XP_PRINT_SERVER_ */ #endif /* _XLCINT_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/XlcPubI.h0000644000000000000000000001512713614532331015763 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ #ifndef _XLCPUBLICI_H_ #define _XLCPUBLICI_H_ #include "XlcPublic.h" #define XLC_PUBLIC(lcd, x) (((XLCdPublic) lcd->core)->pub.x) #define XLC_PUBLIC_PART(lcd) (&(((XLCdPublic) lcd->core)->pub)) #define XLC_PUBLIC_METHODS(lcd) (&(((XLCdPublicMethods) lcd->methods)->pub)) /* * XLCd public methods */ typedef struct _XLCdPublicMethodsRec *XLCdPublicMethods; typedef XLCd (*XlcPubCreateProc)( const char* name, XLCdMethods methods ); typedef Bool (*XlcPubInitializeProc)( XLCd lcd ); typedef void (*XlcPubDestroyProc)( XLCd lcd ); typedef char* (*XlcPubGetValuesProc)( XLCd lcd, XlcArgList args, int num_args ); typedef void (*XlcPubGetResourceProc)( XLCd lcd, const char* category, const char* _class, char*** value, int* count ); typedef struct _XLCdPublicMethodsPart { XLCdPublicMethods superclass; XlcPubCreateProc create; XlcPubInitializeProc initialize; XlcPubDestroyProc destroy; XlcPubGetValuesProc get_values; XlcPubGetResourceProc get_resource; } XLCdPublicMethodsPart; typedef struct _XLCdPublicMethodsRec { XLCdMethodsRec core; XLCdPublicMethodsPart pub; } XLCdPublicMethodsRec; /* * XLCd public data */ typedef struct _XLCdPublicPart { char *siname; /* for _XlcMapOSLocaleName() */ char *language; /* language part of locale name */ char *territory; /* territory part of locale name */ char *codeset; /* codeset part of locale name */ char *encoding_name; /* encoding name */ int mb_cur_max; /* ANSI C MB_CUR_MAX */ Bool is_state_depend; /* state-depend encoding */ const char *default_string; /* for XDefaultString() */ XPointer xlocale_db; } XLCdPublicPart; typedef struct _XLCdPublicRec { XLCdCoreRec core; XLCdPublicPart pub; } XLCdPublicRec, *XLCdPublic; extern XLCdMethods _XlcPublicMethods; _XFUNCPROTOBEGIN extern XLCd _XlcCreateLC( const char* name, XLCdMethods methods ); extern void _XlcDestroyLC( XLCd lcd ); /* Fills into a freshly created XlcCharSet the fields that can be inferred from the ESC sequence. These are side, char_size, set_size. */ extern Bool _XlcParseCharSet( XlcCharSet charset ); /* Creates a new XlcCharSet, given its name (including side suffix) and Compound Text ESC sequence (normally at most 4 bytes). */ extern XlcCharSet _XlcCreateDefaultCharSet( const char* name, const char* ct_sequence ); extern XlcCharSet _XlcAddCT( const char* name, const char* ct_sequence ); extern Bool _XlcInitCTInfo (void); extern XrmMethods _XrmDefaultInitParseInfo( XLCd lcd, XPointer* state ); extern int _XmbTextPropertyToTextList( XLCd lcd, Display* dpy, const XTextProperty* text_prop, char*** list_ret, int* count_ret ); extern int _XwcTextPropertyToTextList( XLCd lcd, Display* dpy, const XTextProperty* text_prop, wchar_t*** list_ret, int* count_ret ); extern int _Xutf8TextPropertyToTextList( XLCd lcd, Display* dpy, const XTextProperty* text_prop, char*** list_ret, int* count_ret ); extern int _XmbTextListToTextProperty( XLCd /* lcd */, Display* /* dpy */, char** /* list */, int /* count */, XICCEncodingStyle /* style */, XTextProperty* /* text_prop */ ); extern int _XwcTextListToTextProperty( XLCd /* lcd */, Display* /* dpy */, wchar_t** /* list */, int /* count */, XICCEncodingStyle /* style */, XTextProperty* /* text_prop */ ); extern int _Xutf8TextListToTextProperty( XLCd /* lcd */, Display* /* dpy */, char** /* list */, int /* count */, XICCEncodingStyle /* style */, XTextProperty* /* text_prop */ ); extern void _XwcFreeStringList( XLCd /* lcd */, wchar_t** /* list */ ); extern int _XlcResolveLocaleName( const char* lc_name, XLCdPublicPart* pub ); extern int _XlcResolveI18NPath( char* buf, int buf_len ); extern char *_XlcLocaleLibDirName( char* /* dir_name */, size_t, /* dir_len */ const char* /* lc_name */ ); extern char *_XlcLocaleDirName( char* /* dir_name */, size_t, /* dir_len */ const char* /* lc_name */ ); extern XPointer _XlcCreateLocaleDataBase( XLCd lcd ); extern void _XlcDestroyLocaleDataBase( XLCd lcd ); extern void _XlcGetLocaleDataBase( XLCd /* lcd */, const char* /* category */, const char* /* name */, char*** /* value */, int* /* count */ ); #if defined(__APPLE__) || defined(__DARWIN__) extern char * _Xsetlocale( int category, _Xconst char *name); #endif extern char *_XlcMapOSLocaleName( char *osname, char *siname); extern int _Xmbstoutf8( char *ustr, const char *str, int len); extern int _Xlcmbstoutf8( XLCd lcd, char *ustr, const char *str, int len); extern int _Xmbstowcs( wchar_t *wstr, char *str, int len); extern int _Xlcwcstombs( XLCd lcd, char *str, wchar_t *wstr, int len); extern int _Xlcmbstowcs( XLCd lcd, wchar_t *wstr, char *str, int len); extern int _Xwcstombs( char *str, wchar_t *wstr, int len); extern int _Xlcmbtowc( XLCd lcd, wchar_t *wstr, char *str, int len); extern int _Xlcwctomb( XLCd lcd, char *str, wchar_t wc); extern XPointer _Utf8GetConvByName( const char *name); _XFUNCPROTOEND #endif /* _XLCPUBLICI_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/xlibi18n/XlcPublic.h0000644000000000000000000002024313614532331016335 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ /* * Copyright 1995 by FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. * * Modifier: Takanori Tateno FUJITSU LIMITED * */ /* * Most of this API is documented in i18n/Framework.PS */ #ifndef _XLCPUBLIC_H_ #define _XLCPUBLIC_H_ #include "Xlcint.h" /* * Character sets. */ /* Every character set has a "side". It denotes the range of byte values for which the character set is responsible. This means that the character set's encoded characters will only assumes bytes within the range, and that the character set can be used simultaneously with another character set responsible for a disjoint range. */ typedef enum { XlcUnknown, XlcC0, /* responsible for values 0x00..0x1F */ XlcGL, /* responsible for values 0x00..0x7F or 0x20..0x7F */ XlcC1, /* responsible for values 0x80..0x9F */ XlcGR, /* responsible for values 0x80..0xFF or 0xA0..0xFF */ XlcGLGR, /* responsible for values 0x00..0xFF */ XlcOther, /* unused */ XlcNONE } XlcSide; /* Data read from XLC_LOCALE files. XXX Apparently superseded by _XUDCGlyphRegion. */ typedef struct _UDCArea { unsigned long start; unsigned long end; } UDCAreaRec, *UDCArea; /* Where the character set comes from. */ typedef enum { CSsrcUndef, /* unused */ CSsrcStd, /* defined in libX11 */ CSsrcXLC /* defined in an XLC_LOCALE file */ } CSSrc; /* These are the supported properties of XlcCharSet. */ #define XlcNCharSize "charSize" #define XlcNControlSequence "controlSequence" #define XlcNEncodingName "encodingName" #define XlcNName "name" #define XlcNSetSize "setSize" #define XlcNSide "side" /* This is the structure of an XlcCharSet. Once allocated, they are never freed. */ typedef struct _XlcCharSetRec { /* Character set name, including side suffix */ const char *name; XrmQuark xrm_name; /* XLFD encoding name, no side suffix */ const char *encoding_name; XrmQuark xrm_encoding_name; /* Range for which the charset is responsible: XlcGL, XlcGR or XlcGLGR */ XlcSide side; /* Number of bytes per character. 0 means a varying number (e.g. UTF-8) */ int char_size; /* Classification of the character set according to ISO-2022 */ int set_size; /* e.g. 94 or 96 */ const char *ct_sequence; /* control sequence of CT */ /* (normally at most 4 bytes) */ /* for UDC */ Bool string_encoding; UDCArea udc_area; int udc_area_num; /* Description source */ CSSrc source; } XlcCharSetRec, *XlcCharSet; _XFUNCPROTOBEGIN /* Returns the charset with the given name (including side suffix). Returns NULL if not found. */ extern XlcCharSet _XlcGetCharSet( const char* name ); /* Returns the charset with the given encoding (no side suffix) and responsible for at least the given side (XlcGL or XlcGR). Returns NULL if not found. */ extern XlcCharSet _XlcGetCharSetWithSide( const char* encoding_name, XlcSide side ); /* Registers an XlcCharSet in the list of character sets. Returns True if successful. */ extern Bool _XlcAddCharSet( XlcCharSet charset ); /* Retrieves a number of attributes of an XlcCharSet. Return NULL if successful, otherwise the name of the first argument specifiying a nonexistent attribute. */ extern char *_XlcGetCSValues( XlcCharSet charset, ... ); _XFUNCPROTOEND #define XlcNCodeset "codeset" #define XlcNDefaultString "defaultString" #define XlcNLanguage "language" #define XlcNMbCurMax "mbCurMax" #define XlcNStateDependentEncoding "stateDependentEncoding" #define XlcNTerritory "territory" typedef struct _FontScope { unsigned long start; unsigned long end; unsigned long shift; unsigned long shift_direction; } FontScopeRec, *FontScope; /* * conversion methods */ typedef struct _XlcConvRec *XlcConv; typedef XlcConv (*XlcOpenConverterProc)( XLCd from_lcd, const char* from_type, XLCd to_lcd, const char* to_type ); typedef void (*XlcCloseConverterProc)( XlcConv /* conv */ ); typedef int (*XlcConvertProc)( XlcConv /* conv */, XPointer* /* from */, int* /* from_left */, XPointer* /* to */, int* /* to_left */, XPointer* /* args */, int /* num_args */ ); typedef void (*XlcResetConverterProc)( XlcConv /* conv */ ); typedef struct _XlcConvMethodsRec{ XlcCloseConverterProc close; XlcConvertProc convert; XlcResetConverterProc reset; } XlcConvMethodsRec, *XlcConvMethods; /* * conversion data */ #define XlcNMultiByte "multiByte" #define XlcNWideChar "wideChar" #define XlcNCompoundText "compoundText" #define XlcNString "string" #define XlcNUtf8String "utf8String" #define XlcNCharSet "charSet" #define XlcNCTCharSet "CTcharSet" #define XlcNFontCharSet "FontCharSet" #define XlcNChar "char" #define XlcNUcsChar "UCSchar" typedef struct _XlcConvRec { XlcConvMethods methods; XPointer state; } XlcConvRec; _XFUNCPROTOBEGIN extern Bool _XInitOM( XLCd /* lcd */ ); extern Bool _XInitIM( XLCd /* lcd */ ); extern XIM _XimOpenIM( XLCd /* lcd */, Display * /* dpy */, XrmDatabase /* rdb */, char * /* res_name */, char * /* res_class */ ); extern char *_XGetLCValues( XLCd /* lcd */, ... ); extern XlcConv _XlcOpenConverter( XLCd from_lcd, const char* from_type, XLCd to_lcd, const char* to_type ); extern void _XlcCloseConverter( XlcConv conv ); extern int _XlcConvert( XlcConv conv, XPointer* from, int* from_left, XPointer* to, int* to_left, XPointer* args, int num_args ); extern void _XlcResetConverter( XlcConv conv ); extern Bool _XlcSetConverter( XLCd from_lcd, const char* from_type, XLCd to_lcd, const char* to_type, XlcOpenConverterProc open_converter ); extern void _XlcGetResource( XLCd lcd, const char* category, const char* _class, char*** value, int* count ); extern char *_XlcFileName( XLCd lcd, const char* category ); extern int _Xwcslen( wchar_t* /* wstr */ ); extern wchar_t *_Xwcscpy( wchar_t* /* wstr1 */, wchar_t* /* wstr2 */ ); extern wchar_t *_Xwcsncpy(wchar_t *wstr1, wchar_t *wstr2, int len); extern int _Xwcscmp(wchar_t *wstr1, wchar_t *wstr2); extern int _Xwcsncmp(wchar_t *wstr1, wchar_t *wstr2, int len); /* Compares two ISO 8859-1 strings, ignoring case of ASCII letters. Like strcasecmp in an ASCII locale. */ extern int _XlcCompareISOLatin1( const char* str1, const char* str2 ); /* Compares two ISO 8859-1 strings, at most len bytes of each, ignoring case of ASCII letters. Like strncasecmp in an ASCII locale. */ extern int _XlcNCompareISOLatin1( const char* str1, const char* str2, int len ); extern XOM _XDefaultOpenOM( XLCd lcd, Display *dpy, XrmDatabase rdb, _Xconst char *res_name, _Xconst char *res_class); _XFUNCPROTOEND #endif /* _XLCPUBLIC_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/XlibInt.c0000644000000000000000000034372713614532331014375 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1985, 1986, 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * XlibInt.c - Internal support routines for the C subroutine * interface library (Xlib) to the X Window System Protocol V11.0. */ #ifdef WIN32 #define _XLIBINT_ #endif #ifdef HAVE_CONFIG_H #include #endif #include "Xlibint.h" #include "Xprivate.h" #include #if !USE_XCB #include #include #endif /* !USE_XCB */ #include #include #ifdef WIN32 #include #endif #ifdef XTHREADS #include "locking.h" /* these pointers get initialized by XInitThreads */ LockInfoPtr _Xglobal_lock = NULL; void (*_XCreateMutex_fn)(LockInfoPtr) = NULL; /* struct _XCVList *(*_XCreateCVL_fn)() = NULL; */ void (*_XFreeMutex_fn)(LockInfoPtr) = NULL; void (*_XLockMutex_fn)( LockInfoPtr /* lock */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char * /* file */ , int /* line */ #endif ) = NULL; void (*_XUnlockMutex_fn)( LockInfoPtr /* lock */ #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char * /* file */ , int /* line */ #endif ) = NULL; xthread_t (*_Xthread_self_fn)(void) = NULL; #define XThread_Self() ((*_Xthread_self_fn)()) #if !USE_XCB #define UnlockNextReplyReader(d) if ((d)->lock) \ (*(d)->lock->pop_reader)((d),&(d)->lock->reply_awaiters,&(d)->lock->reply_awaiters_tail) #define QueueReplyReaderLock(d) ((d)->lock ? \ (*(d)->lock->push_reader)(d,&(d)->lock->reply_awaiters_tail) : NULL) #define QueueEventReaderLock(d) ((d)->lock ? \ (*(d)->lock->push_reader)(d,&(d)->lock->event_awaiters_tail) : NULL) #endif /* !USE_XCB */ #else /* XTHREADS else */ #if !USE_XCB #define UnlockNextReplyReader(d) #define UnlockNextEventReader(d) #endif /* !USE_XCB */ #endif /* XTHREADS else */ #ifdef NX_TRANS_SOCKET #include #include static struct timeval retry; /* * From Xtranssock.c. Presently the congestion state * is reported by the proxy to the application, by * invoking the callback directly. The function will * be possibly used in the future, to be able to track * the bandwidth usage even when the NX transport is * not running. Note that in this sample implementation * the congestion state is checked very often and can * be surely optimized. */ #ifdef NX_TRANS_CHANGE extern int _X11TransSocketCongestionChange(XtransConnInfo, int *); #endif #endif /* #ifdef NX_TRANS_SOCKET */ /* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX * systems are broken and return EWOULDBLOCK when they should return EAGAIN */ #ifdef WIN32 #define ETEST() (WSAGetLastError() == WSAEWOULDBLOCK) #else #ifdef __CYGWIN__ /* Cygwin uses ENOBUFS to signal socket is full */ #define ETEST() (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS) #else #if defined(EAGAIN) && defined(EWOULDBLOCK) #define ETEST() (errno == EAGAIN || errno == EWOULDBLOCK) #else #ifdef EAGAIN #define ETEST() (errno == EAGAIN) #else #define ETEST() (errno == EWOULDBLOCK) #endif /* EAGAIN */ #endif /* EAGAIN && EWOULDBLOCK */ #endif /* __CYGWIN__ */ #endif /* WIN32 */ #ifdef WIN32 #define ECHECK(err) (WSAGetLastError() == err) #define ESET(val) WSASetLastError(val) #else #define ECHECK(err) (errno == err) #define ESET(val) errno = val #endif #if defined(LOCALCONN) || defined(LACHMAN) #ifdef EMSGSIZE #define ESZTEST() (ECHECK(EMSGSIZE) || ECHECK(ERANGE)) #else #define ESZTEST() ECHECK(ERANGE) #endif #else #ifdef EMSGSIZE #define ESZTEST() ECHECK(EMSGSIZE) #endif #endif #if !USE_XCB #define STARTITERATE(tpvar,type,start,endcond) \ for (tpvar = (type *) (start); endcond; ) #define ITERPTR(tpvar) (char *)tpvar #define RESETITERPTR(tpvar,type,start) tpvar = (type *) (start) #define INCITERPTR(tpvar,type) tpvar++ #define ENDITERATE typedef union { xReply rep; char buf[BUFSIZE]; } _XAlignedBuffer; static char *_XAsyncReply( Display *dpy, register xReply *rep, char *buf, register int *lenp, Bool discard); #endif /* !USE_XCB */ /* * The following routines are internal routines used by Xlib for protocol * packet transmission and reception. * * _XIOError(Display *) will be called if any sort of system call error occurs. * This is assumed to be a fatal condition, i.e., XIOError should not return. * * _XError(Display *, xError *) will be called whenever an X_Error event is * received. This is not assumed to be a fatal condition, i.e., it is * acceptable for this procedure to return. However, XError should NOT * perform any operations (directly or indirectly) on the DISPLAY. * * Routines declared with a return type of 'Status' return 0 on failure, * and non 0 on success. Routines with no declared return type don't * return anything. Whenever possible routines that create objects return * the object they have created. */ #if !USE_XCB static xReq _dummy_request = { 0, 0, 0 }; #ifdef NX_TRANS_SOCKET /* * Replace the standard Select with a version giving NX a * chance to check its own descriptors. This doesn't cover * the cases where the system is using poll or when system- * specific defines override the Select definition (OS/2). */ int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) { #ifdef NX_TRANS_TEST fprintf(stderr, "_XSelect: Called with [%d][%p][%p][%p][%p].\n", maxfds, (void *) readfds, (void *) writefds, (void *) exceptfds, (void *) timeout); #endif if (NXTransRunning(NX_FD_ANY)) { fd_set t_readfds, t_writefds; struct timeval t_timeout; int n, r, e; #ifdef NX_TRANS_TEST if (exceptfds != NULL) { fprintf(stderr, "_XSelect: WARNING! Can't handle exception fds in select.\n"); } #endif if (readfds == NULL) { FD_ZERO(&t_readfds); readfds = &t_readfds; } if (writefds == NULL) { FD_ZERO(&t_writefds); writefds = &t_writefds; } if (timeout == NULL) { t_timeout.tv_sec = 10; t_timeout.tv_usec = 0; timeout = &t_timeout; } n = maxfds; /* * If the transport is gone avoid * sleeping until the timeout. */ if (NXTransPrepare(&n, readfds, writefds, timeout) != 0) { NXTransSelect(&r, &e, &n, readfds, writefds, timeout); NXTransExecute(&r, &e, &n, readfds, writefds, timeout); errno = e; return r; } else { return 0; } } else { return select(maxfds, readfds, writefds, exceptfds, timeout); } } #else /* #ifdef NX_TRANS_SOCKET */ int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) { return select(maxfds, readfds, writefds, exceptfds, timeout); } #endif /* #ifdef NX_TRANS_SOCKET */ /* * This is an OS dependent routine which: * 1) returns as soon as the connection can be written on.... * 2) if the connection can be read, must enqueue events and handle errors, * until the connection is writable. */ static void _XWaitForWritable( Display *dpy #ifdef XTHREADS , xcondition_t cv /* our reading condition variable */ #endif ) { #ifdef USE_POLL struct pollfd filedes; #else fd_set r_mask; fd_set w_mask; #endif int nfound; #ifdef NX_TRANS_SOCKET #if defined(NX_TRANS_CHANGE) int congestion; #endif if (_XGetIOError(dpy)) { return; } #endif #ifdef USE_POLL filedes.fd = dpy->fd; filedes.events = 0; #else FD_ZERO(&r_mask); FD_ZERO(&w_mask); #endif for (;;) { #ifdef XTHREADS /* We allow only one thread at a time to read, to minimize passing of read data between threads. Now, who is it? If there is a non-NULL reply_awaiters and we (i.e., our cv) are not at the head of it, then whoever is at the head is the reader, and we don't read. Otherwise there is no reply_awaiters or we are at the head, having just appended ourselves. In this case, if there is a event_awaiters, then whoever is at the head of it got there before we did, and they are the reader. Last cases: no event_awaiters and we are at the head of reply_awaiters or reply_awaiters is NULL: we are the reader, since there is obviously no one else involved. XXX - what if cv is NULL and someone else comes along after us while we are waiting? */ if (!dpy->lock || (!dpy->lock->event_awaiters && (!dpy->lock->reply_awaiters || dpy->lock->reply_awaiters->cv == cv))) #endif #ifndef NX_TRANS_SOCKET #ifdef USE_POLL filedes.events = POLLIN; filedes.events |= POLLOUT; #else FD_SET(dpy->fd, &r_mask); FD_SET(dpy->fd, &w_mask); #endif #endif /* #ifndef NX_TRANS_SOCKET */ do { #ifdef NX_TRANS_SOCKET /* * Give a chance to the registered client to perform * any needed operation before entering the select. */ #ifdef NX_TRANS_TEST fprintf(stderr, "_XWaitForWritable: WAIT! Waiting for the display to become writable.\n"); #endif NXTransFlush(dpy->fd); if (_NXDisplayBlockFunction != NULL) { (*_NXDisplayBlockFunction)(dpy, NXBlockWrite); } /* * Need to set again the descriptors as we could have * run multiple selects before having the possibility * to read or write to the X connection. */ #ifdef USE_POLL filedes.events = POLLIN; filedes.events |= POLLOUT; #else FD_SET(dpy->fd, &r_mask); FD_SET(dpy->fd, &w_mask); #endif #endif /* #ifdef NX_TRANS_SOCKET */ UnlockDisplay(dpy); #ifdef USE_POLL #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XWaitForWritable: Calling poll().\n"); #endif nfound = poll (&filedes, 1, -1); #else /* USE_POLL */ #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XWaitForWritable: Calling select() after [%ld] ms.\n", NXTransTime()); #endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) */ #ifdef NX_TRANS_SOCKET /* * Give a chance to the callback to detect * the failure of the display even if we * miss the interrupt inside the select. */ if (_NXDisplayErrorFunction != NULL) { retry.tv_sec = 5; retry.tv_usec = 0; nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, &retry); } else { nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, NULL); } #else /* NX_TRANS_SOCKET */ nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, NULL); #endif /* NX_TRANS_SOCKET */ #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XWaitForWritable: Out of select() with [%d] after [%ld] ms.\n", nfound, NXTransTime()); if (FD_ISSET(dpy->fd, &r_mask)) { BytesReadable_t pend; _X11TransBytesReadable(dpy->trans_conn, &pend); fprintf(stderr, "_XWaitForWritable: Descriptor [%d] is ready with [%ld] bytes to read.\n", dpy->fd, pend); } if (FD_ISSET(dpy->fd, &w_mask)) { fprintf(stderr, "_XWaitForWritable: Descriptor [%d] has become writable.\n\n", dpy->fd); } #endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) */ #endif /* USE_POLL */ InternalLockDisplay(dpy, cv != NULL); #ifdef NX_TRANS_SOCKET #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) if (_NXDisplayCongestionFunction != NULL && _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { (*_NXDisplayCongestionFunction)(dpy, congestion); } #endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) */ if (nfound <= 0) { if ((nfound == -1 && !(ECHECK(EINTR) || ETEST())) || (_NXDisplayErrorFunction != NULL && (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { _XIOError(dpy); return; } } #else /* NX_TRANS_SOCKET */ if (nfound < 0 && !(ECHECK(EINTR) || ETEST())) _XIOError(dpy); #endif /* NX_TRANS_SOCKET */ } while (nfound <= 0); if ( #ifdef USE_POLL filedes.revents & POLLIN #else /* USE_POLL */ FD_ISSET(dpy->fd, &r_mask) #endif /* USE_POLL */ ) { _XAlignedBuffer buf; BytesReadable_t pend; register int len; register xReply *rep; /* find out how much data can be read */ if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) #ifdef NX_TRANS_SOCKET { _XIOError(dpy); return; } #else /* NX_TRANS_SOCKET */ _XIOError(dpy); #endif /* NX_TRANS_SOCKET */ len = pend; /* must read at least one xEvent; if none is pending, then we'll just block waiting for it */ if (len < SIZEOF(xReply) #ifdef XTHREADS || dpy->async_handlers #endif ) len = SIZEOF(xReply); /* but we won't read more than the max buffer size */ if (len > BUFSIZE) len = BUFSIZE; /* round down to an integral number of XReps */ len = (len / SIZEOF(xReply)) * SIZEOF(xReply); (void) _XRead (dpy, buf.buf, (long) len); STARTITERATE(rep,xReply,buf.buf,len > 0) { if (rep->generic.type == X_Reply) { int tmp = len; RESETITERPTR(rep,xReply, _XAsyncReply (dpy, rep, ITERPTR(rep), &tmp, True)); len = tmp; pend = len; } else { if (rep->generic.type == X_Error) _XError (dpy, (xError *)rep); else /* must be an event packet */ _XEnq (dpy, (xEvent *)rep); INCITERPTR(rep,xReply); len -= SIZEOF(xReply); } } ENDITERATE #ifdef XTHREADS if (dpy->lock && dpy->lock->event_awaiters) ConditionSignal(dpy, dpy->lock->event_awaiters->cv); #endif } #ifdef USE_POLL if (filedes.revents & (POLLOUT|POLLHUP|POLLERR)) #else if (FD_ISSET(dpy->fd, &w_mask)) #endif { #ifdef XTHREADS if (dpy->lock) { ConditionBroadcast(dpy, dpy->lock->writers); } #endif return; } } } #endif /* !USE_XCB */ #define POLLFD_CACHE_SIZE 5 /* initialize the struct array passed to poll() below */ Bool _XPollfdCacheInit( Display *dpy) { #ifdef USE_POLL struct pollfd *pfp; pfp = Xmalloc(POLLFD_CACHE_SIZE * sizeof(struct pollfd)); if (!pfp) return False; pfp[0].fd = dpy->fd; pfp[0].events = POLLIN; dpy->filedes = (XPointer)pfp; #endif return True; } void _XPollfdCacheAdd( Display *dpy, int fd) { #ifdef USE_POLL struct pollfd *pfp = (struct pollfd *)dpy->filedes; if (dpy->im_fd_length <= POLLFD_CACHE_SIZE) { pfp[dpy->im_fd_length].fd = fd; pfp[dpy->im_fd_length].events = POLLIN; } #endif } /* ARGSUSED */ void _XPollfdCacheDel( Display *dpy, int fd) /* not used */ { #ifdef USE_POLL struct pollfd *pfp = (struct pollfd *)dpy->filedes; struct _XConnectionInfo *conni; /* just recalculate whole list */ if (dpy->im_fd_length <= POLLFD_CACHE_SIZE) { int loc = 1; for (conni = dpy->im_fd_info; conni; conni=conni->next) { pfp[loc].fd = conni->fd; pfp[loc].events = POLLIN; loc++; } } #endif } #if !USE_XCB /* returns True iff there is an event in the queue newer than serial_num */ static Bool _XNewerQueuedEvent( Display *dpy, int serial_num) { _XQEvent *qev; if (dpy->next_event_serial_num == serial_num) return False; qev = dpy->head; while (qev) { if (qev->qserial_num >= serial_num) { return True; } qev = qev->next; } return False; } static int _XWaitForReadable( Display *dpy) { int result; int fd = dpy->fd; struct _XConnectionInfo *ilist; register int saved_event_serial = 0; int in_read_events = 0; register Bool did_proc_conni = False; #ifdef USE_POLL struct pollfd *filedes; #else fd_set r_mask; int highest_fd = fd; #endif #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) int congestion; #endif #ifdef NX_TRANS_SOCKET if (_XGetIOError(dpy)) { return -1; } #endif #ifdef USE_POLL if (dpy->im_fd_length + 1 > POLLFD_CACHE_SIZE && !(dpy->flags & XlibDisplayProcConni)) { /* XXX - this fallback is gross */ int i; filedes = (struct pollfd *)Xmalloc(dpy->im_fd_length * sizeof(struct pollfd)); filedes[0].fd = fd; filedes[0].events = POLLIN; for (ilist=dpy->im_fd_info, i=1; ilist; ilist=ilist->next, i++) { filedes[i].fd = ilist->fd; filedes[i].events = POLLIN; } } else { filedes = (struct pollfd *)dpy->filedes; } #else /* USE_POLL */ FD_ZERO(&r_mask); #endif /* USE_POLL */ for (;;) { #ifndef USE_POLL FD_SET(fd, &r_mask); if (!(dpy->flags & XlibDisplayProcConni)) for (ilist=dpy->im_fd_info; ilist; ilist=ilist->next) { FD_SET(ilist->fd, &r_mask); if (ilist->fd > highest_fd) highest_fd = ilist->fd; } #endif /* USE_POLL */ UnlockDisplay(dpy); #ifdef USE_POLL #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XWaitForReadable: Calling poll().\n"); #endif result = poll(filedes, (dpy->flags & XlibDisplayProcConni) ? 1 : 1+dpy->im_fd_length, -1); #else /* USE_POLL */ #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XWaitForReadable: Calling select().\n"); #endif #ifdef NX_TRANS_SOCKET /* * Give a chance to the registered application * to perform any needed operation. */ #ifdef NX_TRANS_TEST fprintf(stderr, "_XWaitForReadable: WAIT! Waiting for the display to become readable.\n"); #endif NXTransFlush(dpy->fd); if (_NXDisplayBlockFunction != NULL) { (*_NXDisplayBlockFunction)(dpy, NXBlockRead); } if (_NXDisplayErrorFunction != NULL) { retry.tv_sec = 5; retry.tv_usec = 0; result = Select(highest_fd + 1, &r_mask, NULL, NULL, &retry); } else { result = Select(highest_fd + 1, &r_mask, NULL, NULL, NULL); } #else /* NX_TRANS_SOCKET */ result = Select(highest_fd + 1, &r_mask, NULL, NULL, NULL); #endif /* NX_TRANS_SOCKET */ #endif /* USE_POLL */ #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XWaitForReadable: Out of select with result [%d] and errno [%d].\n", result, (result < 0 ? errno : 0)); #endif InternalLockDisplay(dpy, dpy->flags & XlibDisplayReply); #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) if (_NXDisplayCongestionFunction != NULL && _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { (*_NXDisplayCongestionFunction)(dpy, congestion); } #endif #ifdef NX_TRANS_SOCKET if (result <= 0) { if ((result == -1 && !(ECHECK(EINTR) || ETEST())) || (_NXDisplayErrorFunction != NULL && (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { _XIOError(dpy); return -1; } continue; } #else if (result == -1 && !(ECHECK(EINTR) || ETEST())) _XIOError(dpy); if (result <= 0) continue; #endif #ifdef USE_POLL if (filedes[0].revents & (POLLIN|POLLHUP|POLLERR)) #else if (FD_ISSET(fd, &r_mask)) #endif break; if (!(dpy->flags & XlibDisplayProcConni)) { int i; saved_event_serial = dpy->next_event_serial_num; /* dpy flags can be clobbered by internal connection callback */ in_read_events = dpy->flags & XlibDisplayReadEvents; for (ilist=dpy->im_fd_info, i=1; ilist; ilist=ilist->next, i++) { #ifdef USE_POLL if (filedes[i].revents & POLLIN) #else if (FD_ISSET(ilist->fd, &r_mask)) #endif { _XProcessInternalConnection(dpy, ilist); did_proc_conni = True; } } #ifdef USE_POLL if (dpy->im_fd_length + 1 > POLLFD_CACHE_SIZE) Xfree(filedes); #endif } if (did_proc_conni) { /* some internal connection callback might have done an XPutBackEvent. We notice it here and if we needed an event, we can return all the way. */ if (_XNewerQueuedEvent(dpy, saved_event_serial) && (in_read_events #ifdef XTHREADS || (dpy->lock && dpy->lock->event_awaiters) #endif )) return -2; did_proc_conni = False; } } #ifdef XTHREADS #ifdef XTHREADS_DEBUG printf("thread %x _XWaitForReadable returning\n", XThread_Self()); #endif #endif return 0; } #endif /* !USE_XCB */ static int sync_hazard(Display *dpy) { /* * "span" and "hazard" need to be signed such that the ">=" comparision * works correctly in the case that hazard is greater than 65525 */ int64_t span = X_DPY_GET_REQUEST(dpy) - X_DPY_GET_LAST_REQUEST_READ(dpy); int64_t hazard = min((dpy->bufmax - dpy->buffer) / SIZEOF(xReq), 65535 - 10); return span >= 65535 - hazard - 10; } static void sync_while_locked(Display *dpy) { #ifdef XTHREADS if (dpy->lock) (*dpy->lock->user_lock_display)(dpy); #endif UnlockDisplay(dpy); SyncHandle(); InternalLockDisplay(dpy, /* don't skip user locks */ 0); #ifdef XTHREADS if (dpy->lock) (*dpy->lock->user_unlock_display)(dpy); #endif } void _XSeqSyncFunction( register Display *dpy) { xGetInputFocusReply rep; _X_UNUSED register xReq *req; #ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_DEBUG fprintf(stderr, "_XSeqSyncFunction: Going to synchronize the display.\n"); #endif if (dpy->flags & XlibDisplayIOError) { #ifdef NX_TRANS_DEBUG fprintf(stderr, "_XSeqSyncFunction: Returning with I/O error detected.\n"); #endif return; } #endif /* NX_TRANS_SOCKET */ if ((X_DPY_GET_REQUEST(dpy) - X_DPY_GET_LAST_REQUEST_READ(dpy)) >= (65535 - BUFSIZE/SIZEOF(xReq))) { GetEmptyReq(GetInputFocus, req); (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); sync_while_locked(dpy); } else if (sync_hazard(dpy)) _XSetPrivSyncFunction(dpy); } /* NOTE: only called if !XTHREADS, or when XInitThreads wasn't called. */ static int _XPrivSyncFunction (Display *dpy) { #ifdef NX_TRANS_SOCKET if (dpy->flags & XlibDisplayIOError) { #ifdef NX_TRANS_DEBUG fprintf(stderr, "%s: Returning 0 with I/O error detected.\n", __func__); #endif return 0; } #endif /* NX_TRANS_SOCKET */ #ifdef XTHREADS assert(!dpy->lock_fns); #endif assert(dpy->synchandler == _XPrivSyncFunction); assert((dpy->flags & XlibDisplayPrivSync) != 0); dpy->synchandler = dpy->savedsynchandler; dpy->savedsynchandler = NULL; dpy->flags &= ~XlibDisplayPrivSync; if(dpy->synchandler) dpy->synchandler(dpy); _XIDHandler(dpy); _XSeqSyncFunction(dpy); return 0; } void _XSetPrivSyncFunction(Display *dpy) { #ifdef XTHREADS if (dpy->lock_fns) return; #endif if (!(dpy->flags & XlibDisplayPrivSync)) { dpy->savedsynchandler = dpy->synchandler; dpy->synchandler = _XPrivSyncFunction; dpy->flags |= XlibDisplayPrivSync; } } void _XSetSeqSyncFunction(Display *dpy) { if (sync_hazard(dpy)) _XSetPrivSyncFunction (dpy); } #if !USE_XCB #ifdef XTHREADS static void _XFlushInt( register Display *dpy, register xcondition_t cv); #endif /* * _XFlush - Flush the X request buffer. If the buffer is empty, no * action is taken. This routine correctly handles incremental writes. * This routine may have to be reworked if int < long. */ void _XFlush( register Display *dpy) { #ifdef XTHREADS /* With multi-threading we introduce an internal routine to which we can pass a condition variable to do locking correctly. */ _XFlushInt(dpy, NULL); } /* _XFlushInt - Internal version of _XFlush used to do multi-threaded * locking correctly. */ static void _XFlushInt( register Display *dpy, register xcondition_t cv) { #endif /* XTHREADS*/ register long size, todo; register int write_stat; register char *bufindex; _XExtension *ext; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) int congestion; #endif #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XFlushInt: Entering flush with [%d] bytes to write.\n", (dpy->bufptr - dpy->buffer)); #endif /* This fix resets the bufptr to the front of the buffer so * additional appends to the bufptr will not corrupt memory. Since * the server is down, these appends are no-op's anyway but * callers of _XFlush() are not verifying this before they call it. */ if (dpy->flags & XlibDisplayIOError) { #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XFlushInt: Returning with I/O error detected.\n"); #endif dpy->bufptr = dpy->buffer; dpy->last_req = (char *)&_dummy_request; return; } #ifdef XTHREADS #ifdef NX_TRANS_SOCKET while (dpy->flags & XlibDisplayWriting) { if (_XGetIOError(dpy)) { return; } #else while (dpy->flags & XlibDisplayWriting) { #endif if (dpy->lock) { ConditionWait(dpy, dpy->lock->writers); } else { _XWaitForWritable (dpy, cv); } } #endif size = todo = dpy->bufptr - dpy->buffer; if (!size) return; #ifdef XTHREADS dpy->flags |= XlibDisplayWriting; /* make sure no one else can put in data */ dpy->bufptr = dpy->bufmax; #endif for (ext = dpy->flushes; ext; ext = ext->next_flush) (*ext->before_flush)(dpy, &ext->codes, dpy->buffer, size); bufindex = dpy->buffer; /* * While write has not written the entire buffer, keep looping * until the entire buffer is written. bufindex will be * incremented and size decremented as buffer is written out. */ while (size) { ESET(0); write_stat = _X11TransWrite(dpy->trans_conn, bufindex, (int) todo); if (write_stat >= 0) { #ifdef NX_TRANS_SOCKET if (_NXDisplayWriteFunction != NULL) { (*_NXDisplayWriteFunction)(dpy, write_stat); } #ifdef NX_TRANS_CHANGE if (_NXDisplayCongestionFunction != NULL && _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { (*_NXDisplayCongestionFunction)(dpy, congestion); } #endif #endif size -= write_stat; todo = size; bufindex += write_stat; } else if (ETEST()) { _XWaitForWritable(dpy #ifdef XTHREADS , cv #endif ); #ifdef SUNSYSV } else if (ECHECK(0)) { _XWaitForWritable(dpy #ifdef XTHREADS , cv #endif ); #endif #ifdef ESZTEST } else if (ESZTEST()) { if (todo > 1) todo >>= 1; else { _XWaitForWritable(dpy #ifdef XTHREADS , cv #endif ); } #endif #ifdef NX_TRANS_SOCKET } else if (!ECHECK(EINTR) || (_NXDisplayErrorFunction != NULL && (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { _XIOError(dpy); return; } #else } else if (!ECHECK(EINTR)) { /* Write failed! */ /* errno set by write system call. */ _XIOError(dpy); } #endif #ifdef NX_TRANS_SOCKET if (_XGetIOError(dpy)) { return; } #endif } dpy->last_req = (char *)&_dummy_request; _XSetSeqSyncFunction(dpy); dpy->bufptr = dpy->buffer; #ifdef XTHREADS dpy->flags &= ~XlibDisplayWriting; #endif } int _XEventsQueued( register Display *dpy, int mode) { register int len; BytesReadable_t pend; _XAlignedBuffer buf; register xReply *rep; char *read_buf; #ifdef XTHREADS int entry_event_serial_num; struct _XCVList *cvl = NULL; xthread_t self; #ifdef XTHREADS_DEBUG printf("_XEventsQueued called in thread %x\n", XThread_Self()); #endif #endif /* XTHREADS*/ if (mode == QueuedAfterFlush) { _XFlush(dpy); if (dpy->qlen) return(dpy->qlen); } #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) if (dpy->flags & XlibDisplayIOError) { fprintf(stderr, "_XEventsQueued: Returning [%d] after display failure.\n", dpy->qlen); } #endif if (dpy->flags & XlibDisplayIOError) return(dpy->qlen); #ifdef XTHREADS /* create our condition variable and append to list, * unless we were called from within XProcessInternalConnection * or XLockDisplay */ xthread_clear_id(self); if (dpy->lock && (xthread_have_id (dpy->lock->conni_thread) || xthread_have_id (dpy->lock->locking_thread))) /* some thread is in XProcessInternalConnection or XLockDisplay so we have to see if we are it */ self = XThread_Self(); if (!xthread_have_id(self) || (!xthread_equal(self, dpy->lock->conni_thread) && !xthread_equal(self, dpy->lock->locking_thread))) { /* In the multi-threaded case, if there is someone else reading events, then there aren't any available, so we just return. If we waited we would block. */ if (dpy->lock && dpy->lock->event_awaiters) return dpy->qlen; /* nobody here but us, so lock out any newcomers */ cvl = QueueEventReaderLock(dpy); } while (dpy->lock && cvl && dpy->lock->reply_first) { /* note which events we have already seen so we'll know if _XReply (in another thread) reads one */ entry_event_serial_num = dpy->next_event_serial_num; ConditionWait(dpy, cvl->cv); /* did _XReply read an event we can return? */ if (_XNewerQueuedEvent(dpy, entry_event_serial_num)) { UnlockNextEventReader(dpy); return 0; } } #endif /* XTHREADS*/ #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XEventsQueued: Checking bytes readable.\n"); #endif if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) #ifdef NX_TRANS_SOCKET { _XIOError(dpy); return (dpy->qlen); } #else _XIOError(dpy); #endif #ifdef XCONN_CHECK_FREQ /* This is a crock, required because FIONREAD or equivalent is * not guaranteed to detect a broken connection. */ if (!pend && !dpy->qlen && ++dpy->conn_checker >= XCONN_CHECK_FREQ) { int result; #ifdef USE_POLL struct pollfd filedes; #else fd_set r_mask; static struct timeval zero_time; #endif dpy->conn_checker = 0; #ifdef USE_POLL #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XEventsQueued: Calling poll().\n"); #endif filedes.fd = dpy->fd; filedes.events = POLLIN; if ((result = poll(&filedes, 1, 0))) #else #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XEventsQueued: Calling select().\n"); #endif FD_ZERO(&r_mask); FD_SET(dpy->fd, &r_mask); if ((result = Select(dpy->fd + 1, &r_mask, NULL, NULL, &zero_time))) #endif { if (result > 0) { if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) #ifdef NX_TRANS_SOCKET { _XIOError(dpy); return (dpy->qlen); } #else _XIOError(dpy); #endif /* we should not get zero, if we do, force a read */ if (!pend) pend = SIZEOF(xReply); } #ifdef NX_TRANS_SOCKET if (result <= 0) { if ((result == -1 && !(ECHECK(EINTR) || ETEST())) || (_NXDisplayErrorFunction != NULL && (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { _XIOError(dpy); return (dpy->qlen); } } #else else if (result < 0 && !(ECHECK(EINTR) || ETEST())) #endif _XIOError(dpy); } } #endif /* XCONN_CHECK_FREQ */ if (!(len = pend)) { /* _XFlush can enqueue events */ #ifdef XTHREADS if (cvl) #endif { UnlockNextEventReader(dpy); } #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XEventsQueued: Returning [%d].\n", dpy->qlen); #endif return(dpy->qlen); } /* Force a read if there is not enough data. Otherwise, * a select() loop at a higher-level will spin undesirably, * and we've seen at least one OS that appears to not update * the result from FIONREAD once it has returned nonzero. */ #ifdef XTHREADS if (dpy->lock && dpy->lock->reply_awaiters) { read_buf = (char *)dpy->lock->reply_awaiters->buf; len = SIZEOF(xReply); } else #endif /* XTHREADS*/ { read_buf = buf.buf; if (len < SIZEOF(xReply) #ifdef XTHREADS || dpy->async_handlers #endif ) len = SIZEOF(xReply); else if (len > BUFSIZE) len = BUFSIZE; len = (len / SIZEOF(xReply)) * SIZEOF(xReply); } #ifdef XCONN_CHECK_FREQ dpy->conn_checker = 0; #endif (void) _XRead (dpy, read_buf, (long) len); #ifdef NX_TRANS_SOCKET if (_XGetIOError(dpy)) { return(dpy->qlen); } #endif #ifdef XTHREADS /* what did we actually read: reply or event? */ if (dpy->lock && dpy->lock->reply_awaiters) { if (((xReply *)read_buf)->generic.type == X_Reply || ((xReply *)read_buf)->generic.type == X_Error) { dpy->lock->reply_was_read = True; dpy->lock->reply_first = True; if (read_buf != (char *)dpy->lock->reply_awaiters->buf) memcpy(dpy->lock->reply_awaiters->buf, read_buf, len); if (cvl) { UnlockNextEventReader(dpy); } return(dpy->qlen); /* we read, so we can return */ } else if (read_buf != buf.buf) memcpy(buf.buf, read_buf, len); } #endif /* XTHREADS*/ STARTITERATE(rep,xReply,buf.buf,len > 0) { if (rep->generic.type == X_Reply) { int tmp = len; RESETITERPTR(rep,xReply, _XAsyncReply (dpy, rep, ITERPTR(rep), &tmp, True)); len = tmp; pend = len; } else { if (rep->generic.type == X_Error) _XError (dpy, (xError *)rep); else /* must be an event packet */ _XEnq (dpy, (xEvent *)rep); INCITERPTR(rep,xReply); len -= SIZEOF(xReply); } } ENDITERATE #ifdef XTHREADS if (cvl) #endif { UnlockNextEventReader(dpy); } return(dpy->qlen); } /* _XReadEvents - Flush the output queue, * then read as many events as possible (but at least 1) and enqueue them */ void _XReadEvents( register Display *dpy) { _XAlignedBuffer buf; BytesReadable_t pend; int len; register xReply *rep; Bool not_yet_flushed = True; char *read_buf; int i; int entry_event_serial_num = dpy->next_event_serial_num; #ifdef XTHREADS struct _XCVList *cvl = NULL; xthread_t self; #ifdef XTHREADS_DEBUG printf("_XReadEvents called in thread %x\n", XThread_Self()); #endif /* create our condition variable and append to list, * unless we were called from within XProcessInternalConnection * or XLockDisplay */ xthread_clear_id(self); if (dpy->lock && (xthread_have_id (dpy->lock->conni_thread) || xthread_have_id (dpy->lock->locking_thread))) /* some thread is in XProcessInternalConnection or XLockDisplay so we have to see if we are it */ self = XThread_Self(); if (!xthread_have_id(self) || (!xthread_equal(self, dpy->lock->conni_thread) && !xthread_equal(self, dpy->lock->locking_thread))) cvl = QueueEventReaderLock(dpy); #endif /* XTHREADS */ do { #ifdef XTHREADS /* if it is not our turn to read an event off the wire, wait til we're at head of list */ if (dpy->lock && cvl && (dpy->lock->event_awaiters != cvl || dpy->lock->reply_first)) { ConditionWait(dpy, cvl->cv); continue; } #endif /* XTHREADS */ /* find out how much data can be read */ if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) { _XIOError(dpy); #ifdef NX_TRANS_SOCKET return; #endif } len = pend; /* must read at least one xEvent; if none is pending, then we'll just flush and block waiting for it */ if (len < SIZEOF(xEvent) #ifdef XTHREADS || dpy->async_handlers #endif ) { len = SIZEOF(xEvent); /* don't flush until the first time we would block */ if (not_yet_flushed) { _XFlush (dpy); if (_XNewerQueuedEvent(dpy, entry_event_serial_num)) { /* _XReply has read an event for us */ goto got_event; } not_yet_flushed = False; } } #ifdef XTHREADS /* If someone is waiting for a reply, gamble that the reply will be the next thing on the wire and read it into their buffer. */ if (dpy->lock && dpy->lock->reply_awaiters) { read_buf = (char *)dpy->lock->reply_awaiters->buf; len = SIZEOF(xReply); } else #endif /* XTHREADS*/ { read_buf = buf.buf; /* but we won't read more than the max buffer size */ if (len > BUFSIZE) len = BUFSIZE; /* round down to an integral number of XReps */ len = (len / SIZEOF(xEvent)) * SIZEOF(xEvent); } #ifdef XTHREADS if (xthread_have_id(self)) /* save value we may have to stick in conni_thread */ dpy->lock->reading_thread = self; #endif /* XTHREADS */ dpy->flags |= XlibDisplayReadEvents; i = _XRead (dpy, read_buf, (long) len); dpy->flags &= ~XlibDisplayReadEvents; #ifdef NX_TRANS_SOCKET if (dpy->flags & XlibDisplayIOError) { #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XReadEvents: Returning with I/O error detected.\n"); #endif return; } #endif if (i == -2) { /* special flag from _XRead to say that internal connection has done XPutBackEvent. Which we can use so we're done. */ got_event: #ifdef XTHREADS if (dpy->lock && dpy->lock->lock_wait) { if (dpy->lock->event_awaiters != cvl) /* since it is not us, must be user lock thread */ ConditionSignal(dpy, dpy->lock->event_awaiters->cv); (*dpy->lock->lock_wait)(dpy); continue; } #endif break; } #ifdef XTHREADS if (xthread_have_id(self)) xthread_clear_id(dpy->lock->reading_thread); /* what did we actually read: reply or event? */ if (dpy->lock && dpy->lock->reply_awaiters) { if (((xReply *)read_buf)->generic.type == X_Reply || ((xReply *)read_buf)->generic.type == X_Error) { dpy->lock->reply_was_read = True; dpy->lock->reply_first = True; if (read_buf != (char *)dpy->lock->reply_awaiters->buf) memcpy(dpy->lock->reply_awaiters->buf, read_buf, len); ConditionSignal(dpy, dpy->lock->reply_awaiters->cv); continue; } else if (read_buf != buf.buf) memcpy(buf.buf, read_buf, len); } #endif /* XTHREADS */ STARTITERATE(rep,xReply,buf.buf,len > 0) { if (rep->generic.type == X_Reply) { RESETITERPTR(rep,xReply, _XAsyncReply (dpy, rep, ITERPTR(rep), &len, True)); pend = len; } else { if (rep->generic.type == X_Error) _XError (dpy, (xError *) rep); else /* must be an event packet */ { if (rep->generic.type == GenericEvent) { int evlen; evlen = (rep->generic.length << 2); if (_XRead(dpy, &read_buf[len], evlen) == -2) goto got_event; /* XXX: aargh! */ } _XEnq (dpy, (xEvent *)rep); } INCITERPTR(rep,xReply); len -= SIZEOF(xReply); } } ENDITERATE; } while (!_XNewerQueuedEvent(dpy, entry_event_serial_num)); UnlockNextEventReader(dpy); } /* * _XRead - Read bytes from the socket taking into account incomplete * reads. This routine may have to be reworked if int < long. */ int _XRead( register Display *dpy, register char *data, register long size) { register long bytes_read; #ifdef XTHREADS int original_size = size; #endif #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) int congestion; #endif if ((dpy->flags & XlibDisplayIOError) || size == 0) return 0; ESET(0); #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) while (1) { /* * Need to check the congestion state * after the read so split the statement * in multiple blocks. */ bytes_read = _X11TransRead(dpy->trans_conn, data, (int)size); if (_NXDisplayCongestionFunction != NULL && _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { (*_NXDisplayCongestionFunction)(dpy, congestion); } if (bytes_read == size) { break; } #else while ((bytes_read = _X11TransRead(dpy->trans_conn, data, (int)size)) != size) { #endif if (bytes_read > 0) { size -= bytes_read; data += bytes_read; } else if (ETEST()) { if (_XWaitForReadable(dpy) == -2) return -2; /* internal connection did XPutBackEvent */ ESET(0); } #ifdef SUNSYSV else if (ECHECK(0)) { if (_XWaitForReadable(dpy) == -2) return -2; /* internal connection did XPutBackEvent */ } #endif else if (bytes_read == 0) { /* Read failed because of end of file! */ ESET(EPIPE); #ifdef NX_TRANS_SOCKET _XIOError(dpy); return -1; #else _XIOError(dpy); #endif } else /* bytes_read is less than 0; presumably -1 */ { /* If it's a system call interrupt, it's not an error. */ #ifdef NX_TRANS_SOCKET if (!ECHECK(EINTR) || (_NXDisplayErrorFunction != NULL && (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { _XIOError(dpy); return -1; } #else if (!ECHECK(EINTR)) _XIOError(dpy); #endif } #ifdef NX_TRANS_SOCKET if (_XGetIOError(dpy)) { return -1; } #endif } #ifdef XTHREADS if (dpy->lock && dpy->lock->reply_bytes_left > 0) { dpy->lock->reply_bytes_left -= original_size; if (dpy->lock->reply_bytes_left == 0) { dpy->flags &= ~XlibDisplayReply; UnlockNextReplyReader(dpy); } } #endif /* XTHREADS*/ return 0; } #endif /* !USE_XCB */ #ifdef LONG64 void _XRead32( Display *dpy, register long *data, long len) { register int *buf; register long i; if (len) { (void) _XRead(dpy, (char *)data, len); i = len >> 2; buf = (int *)data + i; data += i; while (--i >= 0) *--data = *--buf; } } #endif /* LONG64 */ #if !USE_XCB /* * _XReadPad - Read bytes from the socket taking into account incomplete * reads. If the number of bytes is not 0 mod 4, read additional pad * bytes. This routine may have to be reworked if int < long. */ void _XReadPad( register Display *dpy, register char *data, register long size) { register long bytes_read; struct iovec iov[2]; char pad[3]; #ifdef XTHREADS int original_size; #endif #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) int congestion; #endif if ((dpy->flags & XlibDisplayIOError) || size == 0) return; iov[0].iov_len = (int)size; iov[0].iov_base = data; /* * The following hack is used to provide 32 bit long-word * aligned padding. The [1] vector is of length 0, 1, 2, or 3, * whatever is needed. */ iov[1].iov_len = -size & 3; iov[1].iov_base = pad; size += iov[1].iov_len; #ifdef XTHREADS original_size = size; #endif ESET(0); #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) while (1) { bytes_read = _X11TransReadv (dpy->trans_conn, iov, 2); if (_NXDisplayCongestionFunction != NULL && _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { (*_NXDisplayCongestionFunction)(dpy, congestion); } if (bytes_read == size) { break; } #else while ((bytes_read = _X11TransReadv (dpy->trans_conn, iov, 2)) != size) { #endif if (bytes_read > 0) { size -= bytes_read; if (iov[0].iov_len < bytes_read) { int pad_bytes_read = bytes_read - iov[0].iov_len; iov[1].iov_len -= pad_bytes_read; iov[1].iov_base = (char *)iov[1].iov_base + pad_bytes_read; iov[0].iov_len = 0; } else { iov[0].iov_len -= bytes_read; iov[0].iov_base = (char *)iov[0].iov_base + bytes_read; } } else if (ETEST()) { _XWaitForReadable(dpy); ESET(0); } #ifdef SUNSYSV else if (ECHECK(0)) { _XWaitForReadable(dpy); } #endif else if (bytes_read == 0) { /* Read failed because of end of file! */ ESET(EPIPE); #ifdef NX_TRANS_SOCKET _XIOError(dpy); return; #else _XIOError(dpy); #endif } else /* bytes_read is less than 0; presumably -1 */ { /* If it's a system call interrupt, it's not an error. */ #ifdef NX_TRANS_SOCKET if (!ECHECK(EINTR) || (_NXDisplayErrorFunction != NULL && (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { _XIOError(dpy); return; } #else if (!ECHECK(EINTR)) _XIOError(dpy); #endif } #ifdef NX_TRANS_SOCKET if (_XGetIOError(dpy)) { return; } #endif } #ifdef XTHREADS if (dpy->lock && dpy->lock->reply_bytes_left > 0) { dpy->lock->reply_bytes_left -= original_size; if (dpy->lock->reply_bytes_left == 0) { dpy->flags &= ~XlibDisplayReply; UnlockNextReplyReader(dpy); } } #endif /* XTHREADS*/ } /* * _XSend - Flush the buffer and send the client data. 32 bit word aligned * transmission is used, if size is not 0 mod 4, extra bytes are transmitted. * This routine may have to be reworked if int < long; */ void _XSend ( register Display *dpy, _Xconst char *data, register long size) { struct iovec iov[3]; static char const pad[3] = {0, 0, 0}; /* XText8 and XText16 require that the padding bytes be zero! */ long skip, dbufsize, padsize, total, todo; _XExtension *ext; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) int congestion; #endif #ifdef NX_TRANS_SOCKET #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XSend: Sending data with [%d] bytes to write.\n", (dpy->bufptr - dpy->buffer)); #endif if (!size || (dpy->flags & XlibDisplayIOError)) { if (dpy->flags & XlibDisplayIOError) { #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XSend: Returning with I/O error detected.\n"); #endif dpy->bufptr = dpy->buffer; dpy->last_req = (char *)&_dummy_request; } return; } #else if (!size || (dpy->flags & XlibDisplayIOError)) return; #endif dbufsize = dpy->bufptr - dpy->buffer; #ifdef XTHREADS dpy->flags |= XlibDisplayWriting; /* make sure no one else can put in data */ dpy->bufptr = dpy->bufmax; #endif padsize = -size & 3; for (ext = dpy->flushes; ext; ext = ext->next_flush) { (*ext->before_flush)(dpy, &ext->codes, dpy->buffer, dbufsize); (*ext->before_flush)(dpy, &ext->codes, (char *)data, size); if (padsize) (*ext->before_flush)(dpy, &ext->codes, pad, padsize); } skip = 0; todo = total = dbufsize + size + padsize; /* * There are 3 pieces that may need to be written out: * * o whatever is in the display buffer * o the data passed in by the user * o any padding needed to 32bit align the whole mess * * This loop looks at all 3 pieces each time through. It uses skip * to figure out whether or not a given piece is needed. */ while (total) { long before = skip; /* amount of whole thing written */ long remain = todo; /* amount to try this time, <= total */ int i = 0; long len; /* You could be very general here and have "in" and "out" iovecs * and write a loop without using a macro, but what the heck. This * translates to: * * how much of this piece is new? * if more new then we are trying this time, clamp * if nothing new * then bump down amount already written, for next piece * else put new stuff in iovec, will need all of next piece * * Note that todo had better be at least 1 or else we'll end up * writing 0 iovecs. */ #define InsertIOV(pointer, length) \ len = (length) - before; \ if (len > remain) \ len = remain; \ if (len <= 0) { \ before = (-len); \ } else { \ iov[i].iov_len = len; \ iov[i].iov_base = (pointer) + before; \ i++; \ remain -= len; \ before = 0; \ } InsertIOV (dpy->buffer, dbufsize) InsertIOV ((char *)data, size) InsertIOV ((char *)pad, padsize) ESET(0); if ((len = _X11TransWritev(dpy->trans_conn, iov, i)) >= 0) { #ifdef NX_TRANS_SOCKET if (_NXDisplayWriteFunction != NULL) { (*_NXDisplayWriteFunction)(dpy, len); } #ifdef NX_TRANS_CHANGE if (_NXDisplayCongestionFunction != NULL && _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { (*_NXDisplayCongestionFunction)(dpy, congestion); } #endif #endif skip += len; total -= len; todo = total; } else if (ETEST()) { _XWaitForWritable(dpy #ifdef XTHREADS , NULL #endif ); #ifdef SUNSYSV } else if (ECHECK(0)) { _XWaitForWritable(dpy #ifdef XTHREADS , NULL #endif ); #endif #ifdef ESZTEST } else if (ESZTEST()) { if (todo > 1) todo >>= 1; else { _XWaitForWritable(dpy #ifdef XTHREADS , NULL #endif ); } #endif #ifdef NX_TRANS_SOCKET } else if (!ECHECK(EINTR) || (_NXDisplayErrorFunction != NULL && (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { _XIOError(dpy); return; } #else } else if (!ECHECK(EINTR)) { _XIOError(dpy); } #endif #ifdef NX_TRANS_SOCKET if (_XGetIOError(dpy)) { return; } #endif } dpy->last_req = (char *) & _dummy_request; _XSetSeqSyncFunction(dpy); dpy->bufptr = dpy->buffer; #ifdef XTHREADS dpy->flags &= ~XlibDisplayWriting; #endif return; } static void _XGetMiscCode( register Display *dpy) { xQueryExtensionReply qrep; register xQueryExtensionReq *qreq; xXCMiscGetVersionReply vrep; register xXCMiscGetVersionReq *vreq; if (dpy->xcmisc_opcode) return; GetReq(QueryExtension, qreq); qreq->nbytes = sizeof(XCMiscExtensionName) - 1; qreq->length += (qreq->nbytes+(unsigned)3)>>2; _XSend(dpy, XCMiscExtensionName, (long)qreq->nbytes); if (!_XReply (dpy, (xReply *)&qrep, 0, xTrue)) dpy->xcmisc_opcode = -1; else { GetReq(XCMiscGetVersion, vreq); vreq->reqType = qrep.major_opcode; vreq->miscReqType = X_XCMiscGetVersion; vreq->majorVersion = XCMiscMajorVersion; vreq->minorVersion = XCMiscMinorVersion; if (!_XReply (dpy, (xReply *)&vrep, 0, xTrue)) dpy->xcmisc_opcode = -1; else dpy->xcmisc_opcode = qrep.major_opcode; } } void _XIDHandler( register Display *dpy) { xXCMiscGetXIDRangeReply grep; register xXCMiscGetXIDRangeReq *greq; if (dpy->resource_max == dpy->resource_mask + 1) { _XGetMiscCode(dpy); if (dpy->xcmisc_opcode > 0) { GetReq(XCMiscGetXIDRange, greq); greq->reqType = dpy->xcmisc_opcode; greq->miscReqType = X_XCMiscGetXIDRange; if (_XReply (dpy, (xReply *)&grep, 0, xTrue) && grep.count) { dpy->resource_id = ((grep.start_id - dpy->resource_base) >> dpy->resource_shift); dpy->resource_max = dpy->resource_id; if (grep.count > 5) dpy->resource_max += grep.count - 6; dpy->resource_max <<= dpy->resource_shift; } sync_while_locked(dpy); } } } /* * _XAllocID - resource ID allocation routine. */ XID _XAllocID( register Display *dpy) { XID id; id = dpy->resource_id << dpy->resource_shift; if (id >= dpy->resource_max) { _XSetPrivSyncFunction(dpy); dpy->resource_max = dpy->resource_mask + 1; } if (id <= dpy->resource_mask) { dpy->resource_id++; return (dpy->resource_base + id); } if (id != 0x10000000) { (void) fprintf(stderr, "Xlib: resource ID allocation space exhausted!\n"); id = 0x10000000; dpy->resource_id = id >> dpy->resource_shift; } return id; } /* * _XAllocIDs - multiple resource ID allocation routine. */ void _XAllocIDs( register Display *dpy, XID *ids, int count) { XID id; int i; xXCMiscGetXIDListReply grep; register xXCMiscGetXIDListReq *greq; id = dpy->resource_id << dpy->resource_shift; if (dpy->resource_max <= dpy->resource_mask && id <= dpy->resource_mask && (dpy->resource_max - id) > ((count - 1) << dpy->resource_shift)) { id += dpy->resource_base; for (i = 0; i < count; i++) { ids[i] = id; id += (1 << dpy->resource_shift); dpy->resource_id++; } return; } grep.count = 0; _XGetMiscCode(dpy); if (dpy->xcmisc_opcode > 0) { GetReq(XCMiscGetXIDList, greq); greq->reqType = dpy->xcmisc_opcode; greq->miscReqType = X_XCMiscGetXIDList; greq->count = count; if (_XReply(dpy, (xReply *)&grep, 0, xFalse) && grep.count) { _XRead32(dpy, (long *) ids, 4L * (long) (grep.count)); for (i = 0; i < grep.count; i++) { id = (ids[i] - dpy->resource_base) >> dpy->resource_shift; if (id >= dpy->resource_id) dpy->resource_id = id; } if (id >= dpy->resource_max) { _XSetPrivSyncFunction(dpy); dpy->resource_max = dpy->resource_mask + 1; } } } for (i = grep.count; i < count; i++) ids[i] = XAllocID(dpy); } #endif /* !USE_XCB */ /* * The hard part about this is that we only get 16 bits from a reply. * We have three values that will march along, with the following invariant: * dpy->last_request_read <= rep->sequenceNumber <= dpy->request * We have to keep * dpy->request - dpy->last_request_read < 2^16 * or else we won't know for sure what value to use in events. We do this * by forcing syncs when we get close. */ unsigned long _XSetLastRequestRead( register Display *dpy, register xGenericReply *rep) { register uint64_t newseq, lastseq; lastseq = X_DPY_GET_LAST_REQUEST_READ(dpy); /* * KeymapNotify has no sequence number, but is always guaranteed * to immediately follow another event, except when generated via * SendEvent (hmmm). */ if ((rep->type & 0x7f) == KeymapNotify) return(lastseq); newseq = (lastseq & ~((uint64_t)0xffff)) | rep->sequenceNumber; if (newseq < lastseq) { newseq += 0x10000; if (newseq > X_DPY_GET_REQUEST(dpy)) { #ifdef NX_TRANS_SOCKET if (_NXLostSequenceFunction != NULL) { (*_NXLostSequenceFunction)(dpy, newseq, X_DPY_GET_REQUEST(dpy), (unsigned int) rep->type); } else #endif /* #ifdef NX_TRANS_SOCKET */ { (void) fprintf (stderr, "Xlib: sequence lost (0x%llx > 0x%llx) in reply type 0x%x!\n", (unsigned long long)newseq, (unsigned long long)(X_DPY_GET_REQUEST(dpy)), (unsigned int) rep->type); } newseq -= 0x10000; } } X_DPY_SET_LAST_REQUEST_READ(dpy, newseq); return(newseq); } #if !USE_XCB /* * _XReply - Wait for a reply packet and copy its contents into the * specified rep. Meanwhile we must handle error and event packets that * we may encounter. */ Status _XReply ( register Display *dpy, register xReply *rep, int extra, /* number of 32-bit words expected after the reply */ Bool discard) /* should I discard data following "extra" words? */ { /* Pull out the serial number now, so that (currently illegal) requests * generated by an error handler don't confuse us. */ unsigned long cur_request = dpy->request; #ifdef XTHREADS struct _XCVList *cvl; #endif #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XReply: Going to wait for an X reply.\n"); #endif #ifdef NX_TRANS_SOCKET if (dpy->flags & XlibDisplayIOError) { #ifdef NX_TRANS_DEBUG fprintf(stderr, "_XReply: Returning 0 with I/O error detected.\n"); #endif return 0; } #else if (dpy->flags & XlibDisplayIOError) return 0; #endif #ifdef XTHREADS /* create our condition variable and append to list */ cvl = QueueReplyReaderLock(dpy); if (cvl) { cvl->buf = rep; if (dpy->lock->reply_awaiters == cvl && !dpy->lock->event_awaiters) dpy->lock->reply_first = True; } #ifdef XTHREADS_DEBUG printf("_XReply called in thread %x, adding %x to cvl\n", XThread_Self(), cvl); #endif #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XReply: Going to flush the display buffer.\n"); #endif _XFlushInt(dpy, cvl ? cvl->cv : NULL); /* if it is not our turn to read a reply off the wire, * wait til we're at head of list. if there is an event waiter, * and our reply hasn't been read, they'll be in select and will * hand control back to us next. */ if(dpy->lock && (dpy->lock->reply_awaiters != cvl || !dpy->lock->reply_first)) { ConditionWait(dpy, cvl->cv); } dpy->flags |= XlibDisplayReply; #else /* XTHREADS else */ _XFlush(dpy); #endif #ifdef NX_TRANS_SOCKET /* * We are going to block waiting for the remote * X server. Be sure that the proxy has flushed * all the data. */ #ifdef NX_TRANS_TEST fprintf(stderr, "_XReply: Requesting a flush of the NX transport.\n"); #endif NXTransFlush(dpy->fd); #endif for (;;) { #ifdef XTHREADS /* Did another thread's _XReadEvents get our reply by accident? */ if (!dpy->lock || !dpy->lock->reply_was_read) #endif (void) _XRead(dpy, (char *)rep, (long)SIZEOF(xReply)); #ifdef XTHREADS if (dpy->lock) dpy->lock->reply_was_read = False; #endif switch ((int)rep->generic.type) { case X_Reply: /* Reply received. Fast update for synchronous replies, * but deal with multiple outstanding replies. */ if (rep->generic.sequenceNumber == (cur_request & 0xffff)) dpy->last_request_read = cur_request; else { int pend = SIZEOF(xReply); if (_XAsyncReply(dpy, rep, (char *)rep, &pend, False) != (char *)rep) continue; } if (extra <= rep->generic.length) { if (extra > 0) /* * Read the extra data into storage immediately * following the GenericReply structure. */ (void) _XRead (dpy, (char *) (NEXTPTR(rep,xReply)), ((long)extra) << 2); if (discard) { if (extra < rep->generic.length) _XEatData(dpy, (rep->generic.length - extra) << 2); } #ifdef XTHREADS if (dpy->lock) { if (discard) { dpy->lock->reply_bytes_left = 0; } else { dpy->lock->reply_bytes_left = (rep->generic.length - extra) << 2; } if (dpy->lock->reply_bytes_left == 0) { dpy->flags &= ~XlibDisplayReply; UnlockNextReplyReader(dpy); } } else dpy->flags &= ~XlibDisplayReply; #endif return 1; } /* *if we get here, then extra > rep->generic.length--meaning we * read a reply that's shorter than we expected. This is an * error, but we still need to figure out how to handle it... */ (void) _XRead (dpy, (char *) (NEXTPTR(rep,xReply)), ((long) rep->generic.length) << 2); dpy->flags &= ~XlibDisplayReply; UnlockNextReplyReader(dpy); #ifdef NX_TRANS_SOCKET /* * The original code has provision * for returning already. */ #endif _XIOError (dpy); return (0); case X_Error: { register _XExtension *ext; register Bool ret = False; int ret_code; xError *err = (xError *) rep; unsigned long serial; dpy->flags &= ~XlibDisplayReply; serial = _XSetLastRequestRead(dpy, (xGenericReply *)rep); if (serial == cur_request) /* do not die on "no such font", "can't allocate", "can't grab" failures */ switch ((int)err->errorCode) { case BadName: switch (err->majorCode) { case X_LookupColor: case X_AllocNamedColor: UnlockNextReplyReader(dpy); return(0); } break; case BadFont: if (err->majorCode == X_QueryFont) { UnlockNextReplyReader(dpy); return (0); } break; case BadAlloc: case BadAccess: UnlockNextReplyReader(dpy); return (0); } /* * we better see if there is an extension who may * want to suppress the error. */ for (ext = dpy->ext_procs; !ret && ext; ext = ext->next) { if (ext->error) ret = (*ext->error)(dpy, err, &ext->codes, &ret_code); } if (!ret) { _XError(dpy, err); ret_code = 0; } if (serial == cur_request) { UnlockNextReplyReader(dpy); return(ret_code); } } /* case X_Error */ break; default: _XEnq(dpy, (xEvent *) rep); #ifdef XTHREADS if (dpy->lock && dpy->lock->event_awaiters) ConditionSignal(dpy, dpy->lock->event_awaiters->cv); #endif break; } #ifdef NX_TRANS_SOCKET if (_XGetIOError(dpy)) { UnlockNextReplyReader(dpy); return 0; } #endif } } static char * _XAsyncReply( Display *dpy, register xReply *rep, char *buf, register int *lenp, Bool discard) { register _XAsyncHandler *async, *next; register int len; register Bool consumed = False; char *nbuf; (void) _XSetLastRequestRead(dpy, &rep->generic); len = SIZEOF(xReply) + (rep->generic.length << 2); if (len < SIZEOF(xReply)) { #ifdef NX_TRANS_SOCKET /* * The original code has provision * for returning already. */ #endif _XIOError (dpy); buf += *lenp; *lenp = 0; return buf; } for (async = dpy->async_handlers; async; async = next) { next = async->next; if ((consumed = (*async->handler)(dpy, rep, buf, *lenp, async->data))) break; } if (!consumed) { if (!discard) return buf; (void) fprintf(stderr, "Xlib: unexpected async reply (sequence 0x%lx)!\n", dpy->last_request_read); #ifdef XTHREADS #ifdef XTHREADS_DEBUG printf("thread %x, unexpected async reply\n", XThread_Self()); #endif #endif if (len > *lenp) _XEatData(dpy, len - *lenp); } if (len < SIZEOF(xReply)) { #ifdef NX_TRANS_SOCKET /* * The original code has provision * for returning already. */ #endif _XIOError (dpy); buf += *lenp; *lenp = 0; return buf; } if (len >= *lenp) { buf += *lenp; *lenp = 0; return buf; } *lenp -= len; buf += len; len = *lenp; nbuf = buf; while (len > SIZEOF(xReply)) { if (*buf == X_Reply) return nbuf; buf += SIZEOF(xReply); len -= SIZEOF(xReply); } if (len > 0 && len < SIZEOF(xReply)) { buf = nbuf; len = SIZEOF(xReply) - len; nbuf -= len; memmove(nbuf, buf, *lenp); (void) _XRead(dpy, nbuf + *lenp, (long)len); *lenp += len; } return nbuf; } #endif /* !USE_XCB */ /* * Support for internal connections, such as an IM might use. * By Stephen Gildea, X Consortium, September 1993 */ /* _XRegisterInternalConnection * Each IM (or Xlib extension) that opens a file descriptor that Xlib should * include in its select/poll mask must call this function to register the * fd with Xlib. Any XConnectionWatchProc registered by XAddConnectionWatch * will also be called. * * Whenever Xlib detects input available on fd, it will call callback * with call_data to process it. If non-Xlib code calls select/poll * and detects input available, it must call XProcessInternalConnection, * which will call the associated callback. * * Non-Xlib code can learn about these additional fds by calling * XInternalConnectionNumbers or, more typically, by registering * a XConnectionWatchProc with XAddConnectionWatch * to be called when fds are registered or unregistered. * * Returns True if registration succeeded, False if not, typically * because could not allocate memory. * Assumes Display locked when called. */ Status _XRegisterInternalConnection( Display* dpy, int fd, _XInternalConnectionProc callback, XPointer call_data ) { struct _XConnectionInfo *new_conni, **iptr; struct _XConnWatchInfo *watchers; XPointer *wd; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XRegisterInternalConnection: Got called.\n"); #endif new_conni = Xmalloc(sizeof(struct _XConnectionInfo)); if (!new_conni) return 0; new_conni->watch_data = Xmalloc(dpy->watcher_count * sizeof(XPointer)); if (!new_conni->watch_data) { Xfree(new_conni); return 0; } new_conni->fd = fd; new_conni->read_callback = callback; new_conni->call_data = call_data; new_conni->next = NULL; /* link new structure onto end of list */ for (iptr = &dpy->im_fd_info; *iptr; iptr = &(*iptr)->next) ; *iptr = new_conni; dpy->im_fd_length++; _XPollfdCacheAdd(dpy, fd); for (watchers=dpy->conn_watchers, wd=new_conni->watch_data; watchers; watchers=watchers->next, wd++) { *wd = NULL; /* for cleanliness */ (*watchers->fn) (dpy, watchers->client_data, fd, True, wd); } return 1; } /* _XUnregisterInternalConnection * Each IM (or Xlib extension) that closes a file descriptor previously * registered with _XRegisterInternalConnection must call this function. * Any XConnectionWatchProc registered by XAddConnectionWatch * will also be called. * * Assumes Display locked when called. */ void _XUnregisterInternalConnection( Display* dpy, int fd ) { struct _XConnectionInfo *info_list, **prev; struct _XConnWatchInfo *watch; XPointer *wd; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XUnregisterInternalConnection: Got called.\n"); #endif for (prev = &dpy->im_fd_info; (info_list = *prev); prev = &info_list->next) { if (info_list->fd == fd) { *prev = info_list->next; dpy->im_fd_length--; for (watch=dpy->conn_watchers, wd=info_list->watch_data; watch; watch=watch->next, wd++) { (*watch->fn) (dpy, watch->client_data, fd, False, wd); } Xfree (info_list->watch_data); Xfree (info_list); break; } } _XPollfdCacheDel(dpy, fd); } /* XInternalConnectionNumbers * Returns an array of fds and an array of corresponding call data. * Typically a XConnectionWatchProc registered with XAddConnectionWatch * will be used instead of this function to discover * additional fds to include in the select/poll mask. * * The list is allocated with Xmalloc and should be freed by the caller * with Xfree; */ Status XInternalConnectionNumbers( Display *dpy, int **fd_return, int *count_return ) { int count; struct _XConnectionInfo *info_list; int *fd_list; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "XInternalConnectionNumbers: Got called.\n"); #endif LockDisplay(dpy); count = 0; for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) count++; fd_list = Xmalloc (count * sizeof(int)); if (!fd_list) { UnlockDisplay(dpy); return 0; } count = 0; for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) { fd_list[count] = info_list->fd; count++; } UnlockDisplay(dpy); *fd_return = fd_list; *count_return = count; return 1; } void _XProcessInternalConnection( Display *dpy, struct _XConnectionInfo *conn_info) { dpy->flags |= XlibDisplayProcConni; #if defined(XTHREADS) && !USE_XCB if (dpy->lock) { /* check cache to avoid call to thread_self */ if (xthread_have_id(dpy->lock->reading_thread)) dpy->lock->conni_thread = dpy->lock->reading_thread; else dpy->lock->conni_thread = XThread_Self(); } #endif /* XTHREADS && !USE_XCB */ UnlockDisplay(dpy); (*conn_info->read_callback) (dpy, conn_info->fd, conn_info->call_data); LockDisplay(dpy); #if defined(XTHREADS) && !USE_XCB if (dpy->lock) xthread_clear_id(dpy->lock->conni_thread); #endif /* XTHREADS && !USE_XCB */ dpy->flags &= ~XlibDisplayProcConni; } /* XProcessInternalConnection * Call the _XInternalConnectionProc registered by _XRegisterInternalConnection * for this fd. * The Display is NOT locked during the call. */ void XProcessInternalConnection( Display* dpy, int fd ) { struct _XConnectionInfo *info_list; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "XProcessInternalConnection: Got called.\n"); #endif LockDisplay(dpy); for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) { if (info_list->fd == fd) { _XProcessInternalConnection(dpy, info_list); break; } } UnlockDisplay(dpy); } /* XAddConnectionWatch * Register a callback to be called whenever _XRegisterInternalConnection * or _XUnregisterInternalConnection is called. * Callbacks are called with the Display locked. * If any connections are already registered, the callback is immediately * called for each of them. */ Status XAddConnectionWatch( Display* dpy, XConnectionWatchProc callback, XPointer client_data ) { struct _XConnWatchInfo *new_watcher, **wptr; struct _XConnectionInfo *info_list; XPointer *wd_array; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "XAddConnectionWatch: Got called.\n"); #endif LockDisplay(dpy); /* allocate new watch data */ for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) { wd_array = Xrealloc(info_list->watch_data, (dpy->watcher_count + 1) * sizeof(XPointer)); if (!wd_array) { UnlockDisplay(dpy); return 0; } info_list->watch_data = wd_array; wd_array[dpy->watcher_count] = NULL; /* for cleanliness */ } new_watcher = Xmalloc(sizeof(struct _XConnWatchInfo)); if (!new_watcher) { UnlockDisplay(dpy); return 0; } new_watcher->fn = callback; new_watcher->client_data = client_data; new_watcher->next = NULL; /* link new structure onto end of list */ for (wptr = &dpy->conn_watchers; *wptr; wptr = &(*wptr)->next) ; *wptr = new_watcher; dpy->watcher_count++; /* call new watcher on all currently registered fds */ for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) { (*callback) (dpy, client_data, info_list->fd, True, info_list->watch_data + dpy->watcher_count - 1); } UnlockDisplay(dpy); return 1; } /* XRemoveConnectionWatch * Unregister a callback registered by XAddConnectionWatch. * Both callback and client_data must match what was passed to * XAddConnectionWatch. */ void XRemoveConnectionWatch( Display* dpy, XConnectionWatchProc callback, XPointer client_data ) { struct _XConnWatchInfo *watch; struct _XConnWatchInfo *previous = NULL; struct _XConnectionInfo *conni; int counter = 0; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "XRemoveConnectionWatch: Got called.\n"); #endif LockDisplay(dpy); for (watch=dpy->conn_watchers; watch; watch=watch->next) { if (watch->fn == callback && watch->client_data == client_data) { if (previous) previous->next = watch->next; else dpy->conn_watchers = watch->next; Xfree (watch); dpy->watcher_count--; /* remove our watch_data for each connection */ for (conni=dpy->im_fd_info; conni; conni=conni->next) { /* don't bother realloc'ing; these arrays are small anyway */ /* overlapping */ memmove(conni->watch_data+counter, conni->watch_data+counter+1, dpy->watcher_count - counter); } break; } previous = watch; counter++; } UnlockDisplay(dpy); } /* end of internal connections support */ #if !USE_XCB /* Read and discard "n" 8-bit bytes of data */ void _XEatData( Display *dpy, register unsigned long n) { #define SCRATCHSIZE 2048 char buf[SCRATCHSIZE]; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XEatData: Going to eat [%ld] bytes of data from descriptor [%d].\n", n, dpy->fd); #endif while (n > 0) { register long bytes_read = (n > SCRATCHSIZE) ? SCRATCHSIZE : n; (void) _XRead (dpy, buf, bytes_read); n -= bytes_read; } #undef SCRATCHSIZE } /* Port from libXfixes commit b031e3b60fa1af9e49449f23d4a84395868be3ab We need this here to enable linking of current libXrender against libNX_X11 instead of the system's libX11 The original implementation of this function (libX11 commit 9f5d83706543696fc944c1835a403938c06f2cc5) uses xcb stuff which we do not have in libNX_X11. So we take a workaround from another lib. This workaround had been implemented temporarily in a couple of X libs, see e.g. https://lists.x.org/archives/xorg-devel/2013-July/036763.html. */ #include /* for LONG64 on 64-bit platforms */ #include void _XEatDataWords(Display *dpy, unsigned long n) { #ifndef LONG64 if (n >= (ULONG_MAX >> 2)) _XIOError(dpy); #endif _XEatData (dpy, n << 2); } #endif /* !USE_XCB */ /* Cookie jar implementation dpy->cookiejar is a linked list. _XEnq receives the events but leaves them in the normal EQ. _XStoreEvent returns the cookie event (minus data pointer) and adds it to the cookiejar. _XDeq just removes the entry like any other event but resets the data pointer for cookie events (to avoid double-free, the memory is re-used by Xlib). _XFetchEventCookie (called from XGetEventData) removes a cookie from the jar. _XFreeEventCookies removes all unclaimed cookies from the jar (called by XNextEvent). _XFreeDisplayStructure calls _XFreeEventCookies for each cookie in the normal EQ. */ #include "utlist.h" struct stored_event { XGenericEventCookie ev; struct stored_event *prev; struct stored_event *next; }; Bool _XIsEventCookie(Display *dpy, XEvent *ev) { return (ev->xcookie.type == GenericEvent && dpy->generic_event_vec[ev->xcookie.extension & 0x7F] != NULL); } /** * Free all events in the event list. */ void _XFreeEventCookies(Display *dpy) { struct stored_event **head, *e, *tmp; if (!dpy->cookiejar) return; head = (struct stored_event**)&dpy->cookiejar; DL_FOREACH_SAFE(*head, e, tmp) { if (dpy->cookiejar == e) dpy->cookiejar = NULL; XFree(e->ev.data); XFree(e); } } /** * Add an event to the display's event list. This event must be freed on the * next call to XNextEvent(). */ void _XStoreEventCookie(Display *dpy, XEvent *event) { XGenericEventCookie* cookie = &event->xcookie; struct stored_event **head, *add; if (!_XIsEventCookie(dpy, event)) return; head = (struct stored_event**)(&dpy->cookiejar); add = Xmalloc(sizeof(struct stored_event)); if (!add) { ESET(ENOMEM); _XIOError(dpy); } add->ev = *cookie; DL_APPEND(*head, add); cookie->data = NULL; /* don't return data yet, must be claimed */ } /** * Return the event with the given cookie and remove it from the list. */ Bool _XFetchEventCookie(Display *dpy, XGenericEventCookie* ev) { Bool ret = False; struct stored_event **head, *event; head = (struct stored_event**)&dpy->cookiejar; if (!_XIsEventCookie(dpy, (XEvent*)ev)) return ret; DL_FOREACH(*head, event) { if (event->ev.cookie == ev->cookie && event->ev.extension == ev->extension && event->ev.evtype == ev->evtype) { *ev = event->ev; DL_DELETE(*head, event); Xfree(event); ret = True; break; } } return ret; } Bool _XCopyEventCookie(Display *dpy, XGenericEventCookie *in, XGenericEventCookie *out) { Bool ret = False; int extension; if (!_XIsEventCookie(dpy, (XEvent*)in) || !out) return ret; extension = in->extension & 0x7F; if (!dpy->generic_event_copy_vec[extension]) return ret; ret = ((*dpy->generic_event_copy_vec[extension])(dpy, in, out)); out->cookie = ret ? ++dpy->next_cookie : 0; return ret; } /* * _XEnq - Place event packets on the display's queue. * note that no squishing of move events in V11, since there * is pointer motion hints.... */ void _XEnq( register Display *dpy, register xEvent *event) { register _XQEvent *qelt; int type, extension; if ((qelt = dpy->qfree)) { /* If dpy->qfree is non-NULL do this, else malloc a new one. */ dpy->qfree = qelt->next; } else if ((qelt = Xmalloc(sizeof(_XQEvent))) == NULL) { /* Malloc call failed! */ ESET(ENOMEM); _XIOError(dpy); #ifdef NX_TRANS_SOCKET return; #endif } qelt->next = NULL; type = event->u.u.type & 0177; extension = ((xGenericEvent*)event)->extension; qelt->event.type = type; /* If an extension has registered a generic_event_vec handler, then * it can handle event cookies. Otherwise, proceed with the normal * event handlers. * * If the generic_event_vec is called, qelt->event is a event cookie * with the data pointer and the "free" pointer set. Data pointer is * some memory allocated by the extension. */ if (type == GenericEvent && dpy->generic_event_vec[extension & 0x7F]) { XGenericEventCookie *cookie = &qelt->event.xcookie; (*dpy->generic_event_vec[extension & 0x7F])(dpy, cookie, event); cookie->cookie = ++dpy->next_cookie; qelt->qserial_num = dpy->next_event_serial_num++; if (dpy->tail) dpy->tail->next = qelt; else dpy->head = qelt; dpy->tail = qelt; dpy->qlen++; } else if ((*dpy->event_vec[type])(dpy, &qelt->event, event)) { qelt->qserial_num = dpy->next_event_serial_num++; if (dpy->tail) dpy->tail->next = qelt; else dpy->head = qelt; dpy->tail = qelt; dpy->qlen++; } else { /* ignored, or stashed away for many-to-one compression */ qelt->next = dpy->qfree; dpy->qfree = qelt; } } /* * _XDeq - Remove event packet from the display's queue. */ void _XDeq( register Display *dpy, register _XQEvent *prev, /* element before qelt */ register _XQEvent *qelt) /* element to be unlinked */ { if (prev) { if ((prev->next = qelt->next) == NULL) dpy->tail = prev; } else { /* no prev, so removing first elt */ if ((dpy->head = qelt->next) == NULL) dpy->tail = NULL; } qelt->qserial_num = 0; qelt->next = dpy->qfree; dpy->qfree = qelt; dpy->qlen--; if (_XIsEventCookie(dpy, &qelt->event)) { XGenericEventCookie* cookie = &qelt->event.xcookie; /* dpy->qfree is re-used, reset memory to avoid double free on * _XFreeDisplayStructure */ cookie->data = NULL; } } /* * EventToWire in separate file in that often not needed. */ /*ARGSUSED*/ Bool _XUnknownWireEvent( register Display *dpy, /* pointer to display structure */ register XEvent *re, /* pointer to where event should be reformatted */ register xEvent *event) /* wire protocol event */ { #ifdef notdef (void) fprintf(stderr, "Xlib: unhandled wire event! event number = %d, display = %x\n.", event->u.u.type, dpy); #endif return(False); } Bool _XUnknownWireEventCookie( Display *dpy, /* pointer to display structure */ XGenericEventCookie *re, /* pointer to where event should be reformatted */ xEvent *event) /* wire protocol event */ { #ifdef notdef fprintf(stderr, "Xlib: unhandled wire cookie event! extension number = %d, display = %x\n.", ((xGenericEvent*)event)->extension, dpy); #endif return(False); } Bool _XUnknownCopyEventCookie( Display *dpy, /* pointer to display structure */ XGenericEventCookie *in, /* source */ XGenericEventCookie *out) /* destination */ { #ifdef notdef fprintf(stderr, "Xlib: unhandled cookie event copy! extension number = %d, display = %x\n.", in->extension, dpy); #endif return(False); } /*ARGSUSED*/ Status _XUnknownNativeEvent( register Display *dpy, /* pointer to display structure */ register XEvent *re, /* pointer to where event should be reformatted */ register xEvent *event) /* wire protocol event */ { #ifdef notdef (void) fprintf(stderr, "Xlib: unhandled native event! event number = %d, display = %x\n.", re->type, dpy); #endif return(0); } /* * reformat a wire event into an XEvent structure of the right type. */ Bool _XWireToEvent( register Display *dpy, /* pointer to display structure */ register XEvent *re, /* pointer to where event should be reformatted */ register xEvent *event) /* wire protocol event */ { re->type = event->u.u.type & 0x7f; ((XAnyEvent *)re)->serial = _XSetLastRequestRead(dpy, (xGenericReply *)event); ((XAnyEvent *)re)->send_event = ((event->u.u.type & 0x80) != 0); ((XAnyEvent *)re)->display = dpy; /* Ignore the leading bit of the event type since it is set when a client sends an event rather than the server. */ switch (event-> u.u.type & 0177) { case KeyPress: case KeyRelease: { register XKeyEvent *ev = (XKeyEvent*) re; ev->root = event->u.keyButtonPointer.root; ev->window = event->u.keyButtonPointer.event; ev->subwindow = event->u.keyButtonPointer.child; ev->time = event->u.keyButtonPointer.time; ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX); ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY); ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX); ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY); ev->state = event->u.keyButtonPointer.state; ev->same_screen = event->u.keyButtonPointer.sameScreen; ev->keycode = event->u.u.detail; } break; case ButtonPress: case ButtonRelease: { register XButtonEvent *ev = (XButtonEvent *) re; ev->root = event->u.keyButtonPointer.root; ev->window = event->u.keyButtonPointer.event; ev->subwindow = event->u.keyButtonPointer.child; ev->time = event->u.keyButtonPointer.time; ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX); ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY); ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX); ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY); ev->state = event->u.keyButtonPointer.state; ev->same_screen = event->u.keyButtonPointer.sameScreen; ev->button = event->u.u.detail; } break; case MotionNotify: { register XMotionEvent *ev = (XMotionEvent *)re; ev->root = event->u.keyButtonPointer.root; ev->window = event->u.keyButtonPointer.event; ev->subwindow = event->u.keyButtonPointer.child; ev->time = event->u.keyButtonPointer.time; ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX); ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY); ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX); ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY); ev->state = event->u.keyButtonPointer.state; ev->same_screen = event->u.keyButtonPointer.sameScreen; ev->is_hint = event->u.u.detail; } break; case EnterNotify: case LeaveNotify: { register XCrossingEvent *ev = (XCrossingEvent *) re; ev->root = event->u.enterLeave.root; ev->window = event->u.enterLeave.event; ev->subwindow = event->u.enterLeave.child; ev->time = event->u.enterLeave.time; ev->x = cvtINT16toInt(event->u.enterLeave.eventX); ev->y = cvtINT16toInt(event->u.enterLeave.eventY); ev->x_root = cvtINT16toInt(event->u.enterLeave.rootX); ev->y_root = cvtINT16toInt(event->u.enterLeave.rootY); ev->state = event->u.enterLeave.state; ev->mode = event->u.enterLeave.mode; ev->same_screen = (event->u.enterLeave.flags & ELFlagSameScreen) && True; ev->focus = (event->u.enterLeave.flags & ELFlagFocus) && True; ev->detail = event->u.u.detail; } break; case FocusIn: case FocusOut: { register XFocusChangeEvent *ev = (XFocusChangeEvent *) re; ev->window = event->u.focus.window; ev->mode = event->u.focus.mode; ev->detail = event->u.u.detail; } break; case KeymapNotify: { register XKeymapEvent *ev = (XKeymapEvent *) re; ev->window = None; memcpy(&ev->key_vector[1], (char *)((xKeymapEvent *) event)->map, sizeof (((xKeymapEvent *) event)->map)); } break; case Expose: { register XExposeEvent *ev = (XExposeEvent *) re; ev->window = event->u.expose.window; ev->x = event->u.expose.x; ev->y = event->u.expose.y; ev->width = event->u.expose.width; ev->height = event->u.expose.height; ev->count = event->u.expose.count; } break; case GraphicsExpose: { register XGraphicsExposeEvent *ev = (XGraphicsExposeEvent *) re; ev->drawable = event->u.graphicsExposure.drawable; ev->x = event->u.graphicsExposure.x; ev->y = event->u.graphicsExposure.y; ev->width = event->u.graphicsExposure.width; ev->height = event->u.graphicsExposure.height; ev->count = event->u.graphicsExposure.count; ev->major_code = event->u.graphicsExposure.majorEvent; ev->minor_code = event->u.graphicsExposure.minorEvent; } break; case NoExpose: { register XNoExposeEvent *ev = (XNoExposeEvent *) re; ev->drawable = event->u.noExposure.drawable; ev->major_code = event->u.noExposure.majorEvent; ev->minor_code = event->u.noExposure.minorEvent; } break; case VisibilityNotify: { register XVisibilityEvent *ev = (XVisibilityEvent *) re; ev->window = event->u.visibility.window; ev->state = event->u.visibility.state; } break; case CreateNotify: { register XCreateWindowEvent *ev = (XCreateWindowEvent *) re; ev->window = event->u.createNotify.window; ev->parent = event->u.createNotify.parent; ev->x = cvtINT16toInt(event->u.createNotify.x); ev->y = cvtINT16toInt(event->u.createNotify.y); ev->width = event->u.createNotify.width; ev->height = event->u.createNotify.height; ev->border_width = event->u.createNotify.borderWidth; ev->override_redirect = event->u.createNotify.override; } break; case DestroyNotify: { register XDestroyWindowEvent *ev = (XDestroyWindowEvent *) re; ev->window = event->u.destroyNotify.window; ev->event = event->u.destroyNotify.event; } break; case UnmapNotify: { register XUnmapEvent *ev = (XUnmapEvent *) re; ev->window = event->u.unmapNotify.window; ev->event = event->u.unmapNotify.event; ev->from_configure = event->u.unmapNotify.fromConfigure; } break; case MapNotify: { register XMapEvent *ev = (XMapEvent *) re; ev->window = event->u.mapNotify.window; ev->event = event->u.mapNotify.event; ev->override_redirect = event->u.mapNotify.override; } break; case MapRequest: { register XMapRequestEvent *ev = (XMapRequestEvent *) re; ev->window = event->u.mapRequest.window; ev->parent = event->u.mapRequest.parent; } break; case ReparentNotify: { register XReparentEvent *ev = (XReparentEvent *) re; ev->event = event->u.reparent.event; ev->window = event->u.reparent.window; ev->parent = event->u.reparent.parent; ev->x = cvtINT16toInt(event->u.reparent.x); ev->y = cvtINT16toInt(event->u.reparent.y); ev->override_redirect = event->u.reparent.override; } break; case ConfigureNotify: { register XConfigureEvent *ev = (XConfigureEvent *) re; ev->event = event->u.configureNotify.event; ev->window = event->u.configureNotify.window; ev->above = event->u.configureNotify.aboveSibling; ev->x = cvtINT16toInt(event->u.configureNotify.x); ev->y = cvtINT16toInt(event->u.configureNotify.y); ev->width = event->u.configureNotify.width; ev->height = event->u.configureNotify.height; ev->border_width = event->u.configureNotify.borderWidth; ev->override_redirect = event->u.configureNotify.override; } break; case ConfigureRequest: { register XConfigureRequestEvent *ev = (XConfigureRequestEvent *) re; ev->window = event->u.configureRequest.window; ev->parent = event->u.configureRequest.parent; ev->above = event->u.configureRequest.sibling; ev->x = cvtINT16toInt(event->u.configureRequest.x); ev->y = cvtINT16toInt(event->u.configureRequest.y); ev->width = event->u.configureRequest.width; ev->height = event->u.configureRequest.height; ev->border_width = event->u.configureRequest.borderWidth; ev->value_mask = event->u.configureRequest.valueMask; ev->detail = event->u.u.detail; } break; case GravityNotify: { register XGravityEvent *ev = (XGravityEvent *) re; ev->window = event->u.gravity.window; ev->event = event->u.gravity.event; ev->x = cvtINT16toInt(event->u.gravity.x); ev->y = cvtINT16toInt(event->u.gravity.y); } break; case ResizeRequest: { register XResizeRequestEvent *ev = (XResizeRequestEvent *) re; ev->window = event->u.resizeRequest.window; ev->width = event->u.resizeRequest.width; ev->height = event->u.resizeRequest.height; } break; case CirculateNotify: { register XCirculateEvent *ev = (XCirculateEvent *) re; ev->window = event->u.circulate.window; ev->event = event->u.circulate.event; ev->place = event->u.circulate.place; } break; case CirculateRequest: { register XCirculateRequestEvent *ev = (XCirculateRequestEvent *) re; ev->window = event->u.circulate.window; ev->parent = event->u.circulate.event; ev->place = event->u.circulate.place; } break; case PropertyNotify: { register XPropertyEvent *ev = (XPropertyEvent *) re; ev->window = event->u.property.window; ev->atom = event->u.property.atom; ev->time = event->u.property.time; ev->state = event->u.property.state; } break; case SelectionClear: { register XSelectionClearEvent *ev = (XSelectionClearEvent *) re; ev->window = event->u.selectionClear.window; ev->selection = event->u.selectionClear.atom; ev->time = event->u.selectionClear.time; } break; case SelectionRequest: { register XSelectionRequestEvent *ev = (XSelectionRequestEvent *) re; ev->owner = event->u.selectionRequest.owner; ev->requestor = event->u.selectionRequest.requestor; ev->selection = event->u.selectionRequest.selection; ev->target = event->u.selectionRequest.target; ev->property = event->u.selectionRequest.property; ev->time = event->u.selectionRequest.time; } break; case SelectionNotify: { register XSelectionEvent *ev = (XSelectionEvent *) re; ev->requestor = event->u.selectionNotify.requestor; ev->selection = event->u.selectionNotify.selection; ev->target = event->u.selectionNotify.target; ev->property = event->u.selectionNotify.property; ev->time = event->u.selectionNotify.time; } break; case ColormapNotify: { register XColormapEvent *ev = (XColormapEvent *) re; ev->window = event->u.colormap.window; ev->colormap = event->u.colormap.colormap; ev->new = event->u.colormap.new; ev->state = event->u.colormap.state; } break; case ClientMessage: { register int i; register XClientMessageEvent *ev = (XClientMessageEvent *) re; ev->window = event->u.clientMessage.window; ev->format = event->u.u.detail; switch (ev->format) { case 8: ev->message_type = event->u.clientMessage.u.b.type; for (i = 0; i < 20; i++) ev->data.b[i] = event->u.clientMessage.u.b.bytes[i]; break; case 16: ev->message_type = event->u.clientMessage.u.s.type; ev->data.s[0] = cvtINT16toShort(event->u.clientMessage.u.s.shorts0); ev->data.s[1] = cvtINT16toShort(event->u.clientMessage.u.s.shorts1); ev->data.s[2] = cvtINT16toShort(event->u.clientMessage.u.s.shorts2); ev->data.s[3] = cvtINT16toShort(event->u.clientMessage.u.s.shorts3); ev->data.s[4] = cvtINT16toShort(event->u.clientMessage.u.s.shorts4); ev->data.s[5] = cvtINT16toShort(event->u.clientMessage.u.s.shorts5); ev->data.s[6] = cvtINT16toShort(event->u.clientMessage.u.s.shorts6); ev->data.s[7] = cvtINT16toShort(event->u.clientMessage.u.s.shorts7); ev->data.s[8] = cvtINT16toShort(event->u.clientMessage.u.s.shorts8); ev->data.s[9] = cvtINT16toShort(event->u.clientMessage.u.s.shorts9); break; case 32: ev->message_type = event->u.clientMessage.u.l.type; ev->data.l[0] = cvtINT32toLong(event->u.clientMessage.u.l.longs0); ev->data.l[1] = cvtINT32toLong(event->u.clientMessage.u.l.longs1); ev->data.l[2] = cvtINT32toLong(event->u.clientMessage.u.l.longs2); ev->data.l[3] = cvtINT32toLong(event->u.clientMessage.u.l.longs3); ev->data.l[4] = cvtINT32toLong(event->u.clientMessage.u.l.longs4); break; default: /* XXX should never occur */ break; } } break; case MappingNotify: { register XMappingEvent *ev = (XMappingEvent *)re; ev->window = 0; ev->first_keycode = event->u.mappingNotify.firstKeyCode; ev->request = event->u.mappingNotify.request; ev->count = event->u.mappingNotify.count; } break; default: return(_XUnknownWireEvent(dpy, re, event)); } return(True); } /* * _XDefaultIOError - Default fatal system error reporting routine. Called * when an X internal system error is encountered. */ int _XDefaultIOError( Display *dpy) { if (ECHECK(EPIPE)) { (void) fprintf (stderr, "X connection to %s broken (explicit kill or server shutdown).\r\n", DisplayString (dpy)); } else { (void) fprintf (stderr, "XIO: fatal IO error %d (%s) on X server \"%s\"\r\n", #ifdef WIN32 WSAGetLastError(), strerror(WSAGetLastError()), #else errno, strerror (errno), #endif DisplayString (dpy)); (void) fprintf (stderr, " after %lu requests (%lu known processed) with %d events remaining.\r\n", NextRequest(dpy) - 1, LastKnownRequestProcessed(dpy), QLength(dpy)); } #ifdef NX_TRANS_SOCKET if (_NXHandleDisplayError == 1) { #ifdef NX_TRANS_TEST fprintf(stderr, "_XDefaultIOError: Going to return from the error handler.\n"); #endif return 0; } else { #ifdef NX_TRANS_TEST fprintf(stderr, "_XDefaultIOError: Going to exit from the program.\n"); #endif #ifdef NX_TRANS_EXIT NXTransExit(1); #else exit(1); #endif } #else exit(1); #endif /* #ifdef NX_TRANS_SOCKET */ /*NOTREACHED*/ } static int _XPrintDefaultError( Display *dpy, XErrorEvent *event, FILE *fp) { char buffer[BUFSIZ]; char mesg[BUFSIZ]; char number[32]; const char *mtype = "XlibMessage"; register _XExtension *ext = (_XExtension *)NULL; _XExtension *bext = (_XExtension *)NULL; XGetErrorText(dpy, event->error_code, buffer, BUFSIZ); XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ); (void) fprintf(fp, "%s: %s\n ", mesg, buffer); XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d", mesg, BUFSIZ); (void) fprintf(fp, mesg, event->request_code); if (event->request_code < 128) { snprintf(number, sizeof(number), "%d", event->request_code); XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); } else { for (ext = dpy->ext_procs; ext && (ext->codes.major_opcode != event->request_code); ext = ext->next) ; if (ext) { strncpy(buffer, ext->name, BUFSIZ); buffer[BUFSIZ - 1] = '\0'; } else buffer[0] = '\0'; } (void) fprintf(fp, " (%s)\n", buffer); if (event->request_code >= 128) { XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", mesg, BUFSIZ); fputs(" ", fp); (void) fprintf(fp, mesg, event->minor_code); if (ext) { snprintf(mesg, sizeof(mesg), "%s.%d", ext->name, event->minor_code); XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ); (void) fprintf(fp, " (%s)", buffer); } fputs("\n", fp); } if (event->error_code >= 128) { /* kludge, try to find the extension that caused it */ buffer[0] = '\0'; for (ext = dpy->ext_procs; ext; ext = ext->next) { if (ext->error_string) (*ext->error_string)(dpy, event->error_code, &ext->codes, buffer, BUFSIZ); if (buffer[0]) { bext = ext; break; } if (ext->codes.first_error && ext->codes.first_error < (int)event->error_code && (!bext || ext->codes.first_error > bext->codes.first_error)) bext = ext; } if (bext) snprintf(buffer, sizeof(buffer), "%s.%d", bext->name, event->error_code - bext->codes.first_error); else strcpy(buffer, "Value"); XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ); if (mesg[0]) { fputs(" ", fp); (void) fprintf(fp, mesg, event->resourceid); fputs("\n", fp); } /* let extensions try to print the values */ for (ext = dpy->ext_procs; ext; ext = ext->next) { if (ext->error_values) (*ext->error_values)(dpy, event, fp); } } else if ((event->error_code == BadWindow) || (event->error_code == BadPixmap) || (event->error_code == BadCursor) || (event->error_code == BadFont) || (event->error_code == BadDrawable) || (event->error_code == BadColor) || (event->error_code == BadGC) || (event->error_code == BadIDChoice) || (event->error_code == BadValue) || (event->error_code == BadAtom)) { if (event->error_code == BadValue) XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", mesg, BUFSIZ); else if (event->error_code == BadAtom) XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", mesg, BUFSIZ); else XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", mesg, BUFSIZ); fputs(" ", fp); (void) fprintf(fp, mesg, event->resourceid); fputs("\n", fp); } XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", mesg, BUFSIZ); fputs(" ", fp); (void) fprintf(fp, mesg, event->serial); XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%lld", mesg, BUFSIZ); fputs("\n ", fp); (void) fprintf(fp, mesg, (unsigned long long)(X_DPY_GET_REQUEST(dpy))); fputs("\n", fp); if (event->error_code == BadImplementation) return 0; return 1; } int _XDefaultError( Display *dpy, XErrorEvent *event) { if (_XPrintDefaultError (dpy, event, stderr) == 0) return 0; /* * Store in dpy flags that the client is exiting on an unhandled XError * (pretend it is an IOError, since the application is dying anyway it * does not make a difference). * This is useful for _XReply not to hang if the application makes Xlib * calls in _fini as part of process termination. */ dpy->flags |= XlibDisplayIOError; exit(1); /*NOTREACHED*/ } /*ARGSUSED*/ Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we) { return True; } /* * _XError - upcall internal or user protocol error handler */ int _XError ( Display *dpy, register xError *rep) { /* * X_Error packet encountered! We need to unpack the error before * giving it to the user. */ XEvent event; /* make it a large event */ register _XAsyncHandler *async, *next; event.xerror.serial = _XSetLastRequestRead(dpy, (xGenericReply *)rep); for (async = dpy->async_handlers; async; async = next) { next = async->next; if ((*async->handler)(dpy, (xReply *)rep, (char *)rep, SIZEOF(xError), async->data)) return 0; } event.xerror.display = dpy; event.xerror.type = X_Error; event.xerror.resourceid = rep->resourceID; event.xerror.error_code = rep->errorCode; event.xerror.request_code = rep->majorCode; event.xerror.minor_code = rep->minorCode; if (dpy->error_vec && !(*dpy->error_vec[rep->errorCode])(dpy, &event.xerror, rep)) return 0; if (_XErrorFunction != NULL) { int rtn_val; #ifdef XTHREADS if (dpy->lock) (*dpy->lock->user_lock_display)(dpy); UnlockDisplay(dpy); #endif rtn_val = (*_XErrorFunction)(dpy, (XErrorEvent *)&event); /* upcall */ #ifdef XTHREADS LockDisplay(dpy); if (dpy->lock) (*dpy->lock->user_unlock_display)(dpy); #endif return rtn_val; } else { return _XDefaultError(dpy, (XErrorEvent *)&event); } } /* * _XIOError - call user connection error handler and exit */ int _XIOError ( Display *dpy) { dpy->flags |= XlibDisplayIOError; #ifdef WIN32 errno = WSAGetLastError(); #endif /* This assumes that the thread calling exit will call any atexit handlers. * If this does not hold, then an alternate solution would involve * registering an atexit handler to take over the lock, which would only * assume that the same thread calls all the atexit handlers. */ #ifdef XTHREADS if (dpy->lock) (*dpy->lock->user_lock_display)(dpy); #endif UnlockDisplay(dpy); if (_XIOErrorFunction != NULL) (*_XIOErrorFunction)(dpy); else _XDefaultIOError(dpy); #ifdef NX_TRANS_SOCKET /* * Check if we are supposed to return in the case * of a display failure. The client which originated * the X operation will have to check the value of * the XlibDisplayIOError flag and handle appropria- * tely the display disconnection. */ if (_NXHandleDisplayError == 0) { #ifdef NX_TRANS_EXIT NXTransExit(1); #else exit(1); #endif } /* * We are going to return. Reset the display * buffers. Further writes will be discarded. */ #ifdef NX_TRANS_TEST fprintf(stderr, "_XIOError: Resetting the display buffer.\n"); #endif dpy->bufptr = dpy->buffer; dpy->last_req = (char *) &_dummy_request; #ifdef NX_TRANS_TEST fprintf(stderr, "_XIOError: Resetting the display flags.\n"); #endif dpy->flags &= ~XlibDisplayProcConni; dpy->flags &= ~XlibDisplayPrivSync; dpy->flags &= ~XlibDisplayReadEvents; dpy->flags &= ~XlibDisplayWriting; dpy->flags &= ~XlibDisplayReply; /* shut up the compiler by returning something */ return 0; #else exit (1); #endif /*NOTREACHED*/ } /* * This routine can be used to (cheaply) get some memory within a single * Xlib routine for scratch space. A single buffer is reused each time * if possible. To be MT safe, you can only call this between a call to * GetReq* and a call to Data* or _XSend*, or in a context when the thread * is guaranteed to not unlock the display. */ char *_XAllocScratch( register Display *dpy, unsigned long nbytes) { if (nbytes > dpy->scratch_length) { Xfree (dpy->scratch_buffer); dpy->scratch_buffer = Xmalloc(nbytes); if (dpy->scratch_buffer) dpy->scratch_length = nbytes; else dpy->scratch_length = 0; } return (dpy->scratch_buffer); } /* * Scratch space allocator you can call any time, multiple times, and be * MT safe, but you must hand the buffer back with _XFreeTemp. */ char *_XAllocTemp( register Display *dpy, unsigned long nbytes) { char *buf; buf = _XAllocScratch(dpy, nbytes); dpy->scratch_buffer = NULL; dpy->scratch_length = 0; return buf; } void _XFreeTemp( register Display *dpy, char *buf, unsigned long nbytes) { Xfree(dpy->scratch_buffer); dpy->scratch_buffer = buf; dpy->scratch_length = nbytes; } /* * Given a visual id, find the visual structure for this id on this display. */ Visual *_XVIDtoVisual( Display *dpy, VisualID id) { register int i, j, k; register Screen *sp; register Depth *dp; register Visual *vp; for (i = 0; i < dpy->nscreens; i++) { sp = &dpy->screens[i]; for (j = 0; j < sp->ndepths; j++) { dp = &sp->depths[j]; /* if nvisuals == 0 then visuals will be NULL */ for (k = 0; k < dp->nvisuals; k++) { vp = &dp->visuals[k]; if (vp->visualid == id) return (vp); } } } return (NULL); } int XFree (void *data) { Xfree (data); return 1; } #ifdef _XNEEDBCOPYFUNC void _Xbcopy(b1, b2, length) register char *b1, *b2; register length; { if (b1 < b2) { b2 += length; b1 += length; while (length--) *--b2 = *--b1; } else { while (length--) *b2++ = *b1++; } } #endif #ifdef DataRoutineIsProcedure void Data( Display *dpy, _Xconst char *data, long len) { if (dpy->bufptr + (len) <= dpy->bufmax) { memcpy(dpy->bufptr, data, (int)len); dpy->bufptr += ((len) + 3) & ~3; } else { _XSend(dpy, data, len); } } #endif /* DataRoutineIsProcedure */ #ifdef LONG64 int _XData32( Display *dpy, register _Xconst long *data, unsigned len) { register int *buf; register long i; while (len) { buf = (int *)dpy->bufptr; i = dpy->bufmax - (char *)buf; if (!i) { _XFlush(dpy); continue; } if (len < i) i = len; dpy->bufptr = (char *)buf + i; len -= i; i >>= 2; while (--i >= 0) *buf++ = *data++; } return 0; } #endif /* LONG64 */ /* Make sure this produces the same string as DefineLocal/DefineSelf in xdm. * Otherwise, Xau will not be able to find your cookies in the Xauthority file. * * Note: POSIX says that the ``nodename'' member of utsname does _not_ have * to have sufficient information for interfacing to the network, * and so, you may be better off using gethostname (if it exists). */ #if defined(_POSIX_SOURCE) || defined(SVR4) #define NEED_UTSNAME #include #else #ifdef HAVE_UNISTD_H #include #endif #endif /* * _XGetHostname - similar to gethostname but allows special processing. */ int _XGetHostname ( char *buf, int maxlen) { int len; #ifdef NEED_UTSNAME struct utsname name; if (maxlen <= 0 || buf == NULL) return 0; uname (&name); len = strlen (name.nodename); if (len >= maxlen) len = maxlen - 1; strncpy (buf, name.nodename, len); buf[len] = '\0'; #else if (maxlen <= 0 || buf == NULL) return 0; buf[0] = '\0'; (void) gethostname (buf, maxlen); buf [maxlen - 1] = '\0'; len = strlen(buf); #endif /* NEED_UTSNAME */ return len; } /* * _XScreenOfWindow - get the Screen of a given window */ Screen *_XScreenOfWindow(Display *dpy, Window w) { register int i; Window root; int x, y; /* dummy variables */ unsigned int width, height, bw, depth; /* dummy variables */ if (XGetGeometry (dpy, w, &root, &x, &y, &width, &height, &bw, &depth) == False) { return NULL; } for (i = 0; i < ScreenCount (dpy); i++) { /* find root from list */ if (root == RootWindow (dpy, i)) { return ScreenOfDisplay (dpy, i); } } return NULL; } /* * WARNING: This implementation's pre-conditions and post-conditions * must remain compatible with the old macro-based implementations of * GetReq, GetReqExtra, GetResReq, and GetEmptyReq. The portions of the * Display structure affected by those macros are part of libX11's * ABI. */ void *_XGetRequest(Display *dpy, CARD8 type, size_t len) { xReq *req; if (dpy->bufptr + len > dpy->bufmax) _XFlush(dpy); /* Request still too large, so do not allow it to overflow. */ if (dpy->bufptr + len > dpy->bufmax) { fprintf(stderr, "Xlib: request %d length %zd would exceed buffer size.\n", type, len); /* Changes failure condition from overflow to NULL dereference. */ return NULL; } if (len % 4) fprintf(stderr, "Xlib: request %d length %zd not a multiple of 4.\n", type, len); dpy->last_req = dpy->bufptr; req = (xReq*)dpy->bufptr; req->reqType = type; req->length = len / 4; dpy->bufptr += len; X_DPY_REQUEST_INCREMENT(dpy); return req; } #if defined(WIN32) /* * These functions are intended to be used internally to Xlib only. * These functions will always prefix the path with a DOS drive in the * form ":". As such, these functions are only suitable * for use by Xlib function that supply a root-based path to some * particular file, e.g. /lib/X11/locale/locale.dir will * be converted to "C:/usr/X11R6.3/lib/X11/locale/locale.dir". */ static int access_file (path, pathbuf, len_pathbuf, pathret) char* path; char* pathbuf; int len_pathbuf; char** pathret; { if (access (path, F_OK) == 0) { if (strlen (path) < len_pathbuf) *pathret = pathbuf; else *pathret = Xmalloc (strlen (path) + 1); if (*pathret) { strcpy (*pathret, path); return 1; } } return 0; } static int AccessFile (path, pathbuf, len_pathbuf, pathret) char* path; char* pathbuf; int len_pathbuf; char** pathret; { unsigned long drives; int i, len; char* drive; char buf[MAX_PATH]; char* bufp; /* just try the "raw" name first and see if it works */ if (access_file (path, pathbuf, len_pathbuf, pathret)) return 1; /* try the places set in the environment */ drive = getenv ("_XBASEDRIVE"); if (!drive) drive = "C:"; len = strlen (drive) + strlen (path); if (len < MAX_PATH) bufp = buf; else bufp = Xmalloc (len + 1); strcpy (bufp, drive); strcat (bufp, path); if (access_file (bufp, pathbuf, len_pathbuf, pathret)) { if (bufp != buf) Xfree (bufp); return 1; } /* one last place to look */ drive = getenv ("HOMEDRIVE"); if (drive) { len = strlen (drive) + strlen (path); if (len < MAX_PATH) bufp = buf; else bufp = Xmalloc (len + 1); strcpy (bufp, drive); strcat (bufp, path); if (access_file (bufp, pathbuf, len_pathbuf, pathret)) { if (bufp != buf) Xfree (bufp); return 1; } } /* tried everywhere else, go fishing */ #define C_DRIVE ('C' - 'A') #define Z_DRIVE ('Z' - 'A') /* does OS/2 (with or with gcc-emx) have getdrives? */ drives = _getdrives (); for (i = C_DRIVE; i <= Z_DRIVE; i++) { /* don't check on A: or B: */ if ((1 << i) & drives) { len = 2 + strlen (path); if (len < MAX_PATH) bufp = buf; else bufp = Xmalloc (len + 1); *bufp = 'A' + i; *(bufp + 1) = ':'; *(bufp + 2) = '\0'; strcat (bufp, path); if (access_file (bufp, pathbuf, len_pathbuf, pathret)) { if (bufp != buf) Xfree (bufp); return 1; } } } return 0; } int _XOpenFile(path, flags) _Xconst char* path; int flags; { char buf[MAX_PATH]; char* bufp = NULL; int ret = -1; UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS); if (AccessFile (path, buf, MAX_PATH, &bufp)) ret = open (bufp, flags); (void) SetErrorMode (olderror); if (bufp != buf) Xfree (bufp); return ret; } int _XOpenFileMode(path, flags, mode) _Xconst char* path; int flags; mode_t mode; { char buf[MAX_PATH]; char* bufp = NULL; int ret = -1; UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS); if (AccessFile (path, buf, MAX_PATH, &bufp)) ret = open (bufp, flags, mode); (void) SetErrorMode (olderror); if (bufp != buf) Xfree (bufp); return ret; } void* _XFopenFile(path, mode) _Xconst char* path; _Xconst char* mode; { char buf[MAX_PATH]; char* bufp = NULL; void* ret = NULL; UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS); if (AccessFile (path, buf, MAX_PATH, &bufp)) ret = fopen (bufp, mode); (void) SetErrorMode (olderror); if (bufp != buf) Xfree (bufp); return ret; } int _XAccessFile(path) _Xconst char* path; { char buf[MAX_PATH]; char* bufp; int ret = -1; UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS); ret = AccessFile (path, buf, MAX_PATH, &bufp); (void) SetErrorMode (olderror); if (bufp != buf) Xfree (bufp); return ret; } #endif #ifdef WIN32 #undef _Xdebug int _Xdebug = 0; int *_Xdebug_p = &_Xdebug; void (**_XCreateMutex_fn_p)(LockInfoPtr) = &_XCreateMutex_fn; void (**_XFreeMutex_fn_p)(LockInfoPtr) = &_XFreeMutex_fn; void (**_XLockMutex_fn_p)(LockInfoPtr #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char * /* file */ , int /* line */ #endif ) = &_XLockMutex_fn; void (**_XUnlockMutex_fn_p)(LockInfoPtr #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) , char * /* file */ , int /* line */ #endif ) = &_XUnlockMutex_fn; LockInfoPtr *_Xglobal_lock_p = &_Xglobal_lock; #endif nx-libs-3.5.99.23/nx-X11/lib/src/XomGeneric.h0000644000000000000000000002224313614532331015054 0ustar /* * Copyright 1992, 1993 by TOSHIBA Corp. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of TOSHIBA not be used in advertising * or publicity pertaining to distribution of the software without specific, * written prior permission. TOSHIBA make no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Katsuhisa Yano TOSHIBA Corp. * mopi@osa.ilab.toshiba.co.jp */ /* * Copyright 1995 by FUJITSU LIMITED * This is source code modified by FUJITSU LIMITED under the Joint * Development Agreement for the CDE/Motif PST. * * Modifier: Takanori Tateno FUJITSU LIMITED * */ #ifndef _XOMGENERIC_H_ #define _XOMGENERIC_H_ #include "XlcPublic.h" #define XOM_GENERIC(om) (&((XOMGeneric) om)->gen) #define XOC_GENERIC(font_set) (&((XOCGeneric) font_set)->gen) /* For VW/UDC */ typedef struct _CodeRangeRec { unsigned long start; unsigned long end; unsigned long dmy1; unsigned long dmy2; } CodeRangeRec, *CodeRange; typedef struct _VRotateRec { char *charset_name; /* Charset name */ XlcSide side; /* Encoding side */ int num_cr; CodeRange code_range; char *xlfd_name; XFontStruct *font; } VRotateRec, *VRotate; typedef enum { XOMMultiByte, XOMWideChar, XOMUtf8String } XOMTextType; typedef struct _FontDataRec { char *name; XlcSide side; /* For VW/UDC */ int scopes_num; FontScope scopes; char *xlfd_name; XFontStruct *font; } FontDataRec, *FontData; #define VROTATE_NONE 0 #define VROTATE_PART 1 #define VROTATE_ALL 2 typedef struct _OMDataRec { int charset_count; XlcCharSet *charset_list; int font_data_count; FontData font_data; /* For VW/UDC */ int substitute_num; FontData substitute; /* Vertical Writing */ int vmap_num; FontData vmap; int vrotate_type; int vrotate_num; CodeRange vrotate; } OMDataRec, *OMData; typedef struct _XOMGenericPart { int data_num; OMData data; Bool on_demand_loading; char *object_name; } XOMGenericPart; typedef struct _XOMGenericRec { XOMMethods methods; XOMCoreRec core; XOMGenericPart gen; } XOMGenericRec, *XOMGeneric; /* * XOC dependent data */ typedef struct _FontSetRec { int id; int charset_count; XlcCharSet *charset_list; int font_data_count; FontData font_data; char *font_name; XFontStruct *info; XFontStruct *font; XlcSide side; Bool is_xchar2b; /* For VW/UDC */ int substitute_num; FontData substitute; /* Vertical Writing */ int vpart_initialize; int vmap_num; FontData vmap; int vrotate_num; VRotate vrotate; } FontSetRec, *FontSet; typedef struct _XOCGenericPart { XlcConv mbs_to_cs; XlcConv wcs_to_cs; XlcConv utf8_to_cs; int font_set_num; FontSet font_set; } XOCGenericPart; typedef struct _XOCGenericRec { XOCMethods methods; XOCCoreRec core; XOCGenericPart gen; } XOCGenericRec, *XOCGeneric; _XFUNCPROTOBEGIN extern XOM _XomGenericOpenOM( XLCd /* lcd */, Display* /* dpy */, XrmDatabase /* rdb */, _Xconst char* /* res_name */, _Xconst char* /* res_class */ ); extern XlcConv _XomInitConverter( XOC /* oc */, XOMTextType /* type */ ); extern int _XomConvert( XOC /* oc */, XlcConv /* conv */, XPointer* /* from */, int* /* from_left */, XPointer* /* to */, int* /* to_left */, XPointer* /* args */, int /* num_args */ ); extern int _XmbDefaultTextEscapement(XOC oc, _Xconst char *text, int length); extern int _XwcDefaultTextEscapement(XOC oc, _Xconst wchar_t *text, int length); extern int _Xutf8DefaultTextEscapement(XOC oc, _Xconst char *text, int length); extern int _XmbDefaultTextExtents(XOC oc, _Xconst char *text, int length, XRectangle *overall_ink, XRectangle *overall_logical); extern int _XwcDefaultTextExtents(XOC oc, _Xconst wchar_t *text, int length, XRectangle *overall_ink, XRectangle *overall_logical); extern int _Xutf8DefaultTextExtents(XOC oc, _Xconst char *text, int length, XRectangle *overall_ink, XRectangle *overall_logical); extern Status _XmbDefaultTextPerCharExtents( XOC oc, _Xconst char *text, int length, XRectangle *ink_buf, XRectangle *logical_buf, int buf_size, int *num_chars, XRectangle *overall_ink, XRectangle *overall_logical); extern Status _XwcDefaultTextPerCharExtents( XOC oc, _Xconst wchar_t *text, int length, XRectangle *ink_buf, XRectangle *logical_buf, int buf_size, int *num_chars, XRectangle *overall_ink, XRectangle *overall_logical); extern Status _Xutf8DefaultTextPerCharExtents( XOC oc, _Xconst char *text, int length, XRectangle *ink_buf, XRectangle *logical_buf, int buf_size, int *num_chars, XRectangle *overall_ink, XRectangle *overall_logical); extern int _XmbDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length); extern int _XwcDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst wchar_t *text, int length); extern int _Xutf8DefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length); extern void _XmbDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length); extern void _XwcDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst wchar_t *text, int length); extern void _Xutf8DefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length); extern int _XmbGenericTextEscapement(XOC oc, _Xconst char *text, int length); extern int _XmbGenericTextExtents(XOC oc, _Xconst char *text, int length, XRectangle *overall_ink, XRectangle *overall_logical); extern int _Xutf8GenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length); extern void _Xutf8GenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length); extern Status _Xutf8GenericTextPerCharExtents( XOC oc, _Xconst char *text, int length, XRectangle *ink_buf, XRectangle *logical_buf, int buf_size, int *num_chars, XRectangle *overall_ink, XRectangle *overall_logical); extern int _Xutf8GenericTextExtents(XOC oc, _Xconst char *text, int length, XRectangle *overall_ink, XRectangle *overall_logical); extern int _Xutf8GenericTextEscapement(XOC oc, _Xconst char *text, int length); extern void _XwcGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst wchar_t *text, int length); extern int _XwcGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst wchar_t *text, int length); extern Status _XwcGenericTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length, XRectangle *ink_buf, XRectangle *logical_buf, int buf_size, int *num_chars, XRectangle *overall_ink, XRectangle *overall_logical); extern int _XwcGenericTextExtents(XOC oc, _Xconst wchar_t *text, int length, XRectangle *overall_ink, XRectangle *overall_logical); extern int _XwcGenericTextEscapement(XOC oc, _Xconst wchar_t *text, int length); extern void _XmbGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length); extern int _XmbGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, _Xconst char *text, int length); extern Status _XmbGenericTextPerCharExtents(XOC oc, _Xconst char *text, int length, XRectangle *ink_buf, XRectangle *logical_buf, int buf_size, int *num_chars, XRectangle *overall_ink, XRectangle *overall_logical); extern FontData read_EncodingInfo( int count, char **value); extern int _XomGenericDrawString( Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, XOMTextType type, XPointer text, int length); extern int _XomGenericTextExtents( XOC oc, XOMTextType type, XPointer text, int length, XRectangle *overall_ink, XRectangle *overall_logical); extern FontData _XomGetFontDataFromFontSet( FontSet fs, unsigned char *str, int len, int *len_ret, int is2b, int type); _XFUNCPROTOEND #endif /* _XOMGENERIC_H_ */ nx-libs-3.5.99.23/nx-X11/lib/src/Xprivate.h0000644000000000000000000000173413614532331014620 0ustar /* Copyright (C) 2008 Jamey Sharp, Josh Triplett * This file is licensed under the MIT license. See the file COPYING. * * As Xlibint.h has long become effectively public API, this header exists * for new private functions that nothing outside of libX11 should call. */ #ifndef XPRIVATE_H #define XPRIVATE_H #include extern _X_HIDDEN void _XIDHandler(Display *dpy); extern _X_HIDDEN void _XSeqSyncFunction(Display *dpy); extern _X_HIDDEN void _XSetPrivSyncFunction(Display *dpy); extern _X_HIDDEN void _XSetSeqSyncFunction(Display *dpy); #ifdef XTHREADS #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) #define InternalLockDisplay(d,wskip) if ((d)->lock) \ (*(d)->lock->internal_lock_display)(d,wskip,__FILE__,__LINE__) #else #define InternalLockDisplay(d,wskip) if ((d)->lock) \ (*(d)->lock->internal_lock_display)(d,wskip) #endif #else /* XTHREADS else */ #define InternalLockDisplay(d,wskip) #endif /* XTHREADS else */ #endif /* XPRIVATE_H */ nx-libs-3.5.99.23/nx-X11/lib/src/Xresinternal.h0000644000000000000000000000063313614532331015471 0ustar #ifndef _XRESINTERNAL_H_ #define _XRESINTERNAL_H_ #include #include #include /* type defines */ typedef uint32_t Signature; /* prototypes */ extern XrmQuark _XrmInternalStringToQuark( register _Xconst char *name, register int len, register Signature sig, Bool permstring); #endif /* _XRESOURCEINTERNAL_H_ */ /* DON'T ADD STUFF AFTER THIS #endif */ nx-libs-3.5.99.23/nx-X11/lib/src/Xrm.c0000644000000000000000000020677513614532331013573 0ustar /*********************************************************** Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* Copyright 1987, 1988, 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "Xlibint.h" #include #include "Xlcint.h" #ifdef XTHREADS #include "locking.h" #endif #include #include #include #include "Xresinternal.h" #include "Xresource.h" /* These Xrm routines allow very fast lookup of resources in the resource database. Several usage patterns are exploited: (1) Widgets get a lot of resources at one time. Rather than look up each from scratch, we can precompute the prioritized list of database levels once, then search for each resource starting at the beginning of the list. (2) Many database levels don't contain any leaf resource nodes. There is no point in looking for resources on a level that doesn't contain any. This information is kept on a per-level basis. (3) Sometimes the widget instance tree is structured such that you get the same class name repeated on the fully qualified widget name. This can result in the same database level occuring multiple times on the search list. The code below only checks to see if you get two identical search lists in a row, rather than look back through all database levels, but in practice this removes all duplicates I've ever observed. Joel McCormack */ /* The Xrm representation has been completely redesigned to substantially reduce memory and hopefully improve performance. The database is structured into two kinds of tables: LTables that contain only values, and NTables that contain only other tables. Some invariants: The next pointer of the top-level node table points to the top-level leaf table, if any. Within an LTable, for a given name, the tight value always precedes the loose value, and if both are present the loose value is always right after the tight value. Within an NTable, all of the entries for a given name are contiguous, in the order tight NTable, loose NTable, tight LTable, loose LTable. Bob Scheifler */ static XrmQuark XrmQString, XrmQANY; typedef Bool (*DBEnumProc)( XrmDatabase* /* db */, XrmBindingList /* bindings */, XrmQuarkList /* quarks */, XrmRepresentation* /* type */, XrmValue* /* value */, XPointer /* closure */ ); typedef struct _VEntry { struct _VEntry *next; /* next in chain */ XrmQuark name; /* name of this entry */ unsigned int tight:1; /* 1 if it is a tight binding */ unsigned int string:1; /* 1 if type is String */ unsigned int size:30; /* size of value */ } VEntryRec, *VEntry; typedef struct _DEntry { VEntryRec entry; /* entry */ XrmRepresentation type; /* representation type */ } DEntryRec, *DEntry; /* the value is right after the structure */ #define StringValue(ve) (XPointer)((ve) + 1) #define RepType(ve) ((DEntry)(ve))->type /* the value is right after the structure */ #define DataValue(ve) (XPointer)(((DEntry)(ve)) + 1) #define RawValue(ve) (char *)((ve)->string ? StringValue(ve) : DataValue(ve)) typedef struct _NTable { struct _NTable *next; /* next in chain */ XrmQuark name; /* name of this entry */ unsigned int tight:1; /* 1 if it is a tight binding */ unsigned int leaf:1; /* 1 if children are values */ unsigned int hasloose:1; /* 1 if has loose children */ unsigned int hasany:1; /* 1 if has ANY entry */ unsigned int pad:4; /* unused */ unsigned int mask:8; /* hash size - 1 */ unsigned int entries:16; /* number of children */ } NTableRec, *NTable; /* the buckets are right after the structure */ #define NodeBuckets(ne) ((NTable *)((ne) + 1)) #define NodeHash(ne,q) NodeBuckets(ne)[(q) & (ne)->mask] /* leaf tables have an extra level of indirection for the buckets, * so that resizing can be done without invalidating a search list. * This is completely ugly, and wastes some memory, but the Xlib * spec doesn't really specify whether invalidation is OK, and the * old implementation did not invalidate. */ typedef struct _LTable { NTableRec table; VEntry *buckets; } LTableRec, *LTable; #define LeafHash(le,q) (le)->buckets[(q) & (le)->table.mask] /* An XrmDatabase just holds a pointer to the first top-level table. * The type name is no longer descriptive, but better to not change * the Xresource.h header file. This type also gets used to define * XrmSearchList, which is a complete crock, but we'll just leave it * and caste types as required. */ typedef struct _XrmHashBucketRec { NTable table; XPointer mbstate; XrmMethods methods; #ifdef XTHREADS LockInfoRec linfo; #endif } XrmHashBucketRec; /* closure used in get/put resource */ typedef struct _VClosure { XrmRepresentation *type; /* type of value */ XrmValuePtr value; /* value itself */ } VClosureRec, *VClosure; /* closure used in get search list */ typedef struct _SClosure { LTable *list; /* search list */ int idx; /* index of last filled element */ int limit; /* maximum index */ } SClosureRec, *SClosure; /* placed in XrmSearchList to indicate next table is loose only */ #define LOOSESEARCH ((LTable)1) /* closure used in enumerate database */ typedef struct _EClosure { XrmDatabase db; /* the database */ DBEnumProc proc; /* the user proc */ XPointer closure; /* the user closure */ XrmBindingList bindings; /* binding list */ XrmQuarkList quarks; /* quark list */ int mode; /* XrmEnum */ } EClosureRec, *EClosure; /* types for typecasting ETable based functions to NTable based functions */ typedef Bool (*getNTableSProcp)( NTable table, XrmNameList names, XrmClassList classes, SClosure closure); typedef Bool (*getNTableVProcp)( NTable table, XrmNameList names, XrmClassList classes, VClosure closure); typedef Bool (*getNTableEProcp)( NTable table, XrmNameList names, XrmClassList classes, register int level, EClosure closure); /* predicate to determine when to resize a hash table */ #define GrowthPred(n,m) ((unsigned)(n) > (((m) + 1) << 2)) #define GROW(prev) \ if (GrowthPred((*prev)->entries, (*prev)->mask)) \ GrowTable(prev) /* pick a reasonable value for maximum depth of resource database */ #define MAXDBDEPTH 100 /* macro used in get/search functions */ /* find an entry named ename, with leafness given by leaf */ #define NFIND(ename) \ q = ename; \ entry = NodeHash(table, q); \ while (entry && entry->name != q) \ entry = entry->next; \ if (leaf && entry && !entry->leaf) { \ entry = entry->next; \ if (entry && !entry->leaf) \ entry = entry->next; \ if (entry && entry->name != q) \ entry = (NTable)NULL; \ } /* resourceQuarks keeps track of what quarks have been associated with values * in all LTables. If a quark has never been used in an LTable, we don't need * to bother looking for it. */ static unsigned char *resourceQuarks = (unsigned char *)NULL; static XrmQuark maxResourceQuark = -1; /* determines if a quark has been used for a value in any database */ #define IsResourceQuark(q) ((q) > 0 && (q) <= maxResourceQuark && \ resourceQuarks[(q) >> 3] & (1 << ((q) & 7))) typedef unsigned char XrmBits; #define BSLASH ((XrmBits) (1 << 5)) #define NORMAL ((XrmBits) (1 << 4)) #define EOQ ((XrmBits) (1 << 3)) #define SEP ((XrmBits) (1 << 2)) #define ENDOF ((XrmBits) (1 << 1)) #define SPACE (NORMAL|EOQ|SEP|(XrmBits)0) #define RSEP (NORMAL|EOQ|SEP|(XrmBits)1) #define EOS (EOQ|SEP|ENDOF|(XrmBits)0) #define EOL (EOQ|SEP|ENDOF|(XrmBits)1) #define BINDING (NORMAL|EOQ) #define ODIGIT (NORMAL|(XrmBits)1) #define next_char(ch,str) xrmtypes[(unsigned char)((ch) = *(++(str)))] #define next_mbchar(ch,len,str) xrmtypes[(unsigned char)(ch = (*db->methods->mbchar)(db->mbstate, str, &len), str += len, ch)] #define is_space(bits) ((bits) == SPACE) #define is_EOQ(bits) ((bits) & EOQ) #define is_EOF(bits) ((bits) == EOS) #define is_EOL(bits) ((bits) & ENDOF) #define is_binding(bits) ((bits) == BINDING) #define is_odigit(bits) ((bits) == ODIGIT) #define is_separator(bits) ((bits) & SEP) #define is_nonpcs(bits) (!(bits)) #define is_normal(bits) ((bits) & NORMAL) #define is_simple(bits) ((bits) & (NORMAL|BSLASH)) #define is_special(bits) ((bits) & (ENDOF|BSLASH)) /* parsing types */ static XrmBits const xrmtypes[256] = { EOS,0,0,0,0,0,0,0, 0,SPACE,EOL,0,0, #if defined(WIN32) EOL, /* treat CR the same as LF, just in case */ #else 0, #endif 0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, SPACE,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, NORMAL,NORMAL,BINDING,NORMAL,NORMAL,NORMAL,BINDING,NORMAL, ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT, NORMAL,NORMAL,RSEP,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, NORMAL,NORMAL,NORMAL,NORMAL,BSLASH,NORMAL,NORMAL,NORMAL, NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,0 /* The rest will be automatically initialized to zero. */ }; void XrmInitialize(void) { XrmQString = XrmPermStringToQuark("String"); XrmQANY = XrmPermStringToQuark("?"); } XrmDatabase XrmGetDatabase( Display *display) { XrmDatabase retval; LockDisplay(display); retval = display->db; UnlockDisplay(display); return retval; } void XrmSetDatabase( Display *display, XrmDatabase database) { LockDisplay(display); /* destroy database if set up implicitly by XGetDefault() */ if (display->db && (display->flags & XlibDisplayDfltRMDB)) { XrmDestroyDatabase(display->db); display->flags &= ~XlibDisplayDfltRMDB; } display->db = database; UnlockDisplay(display); } void XrmStringToQuarkList( register _Xconst char *name, register XrmQuarkList quarks) /* RETURN */ { register XrmBits bits; register Signature sig = 0; register char ch, *tname; register int i = 0; if ((tname = (char *)name)) { tname--; while (!is_EOF(bits = next_char(ch, tname))) { if (is_binding (bits)) { if (i) { /* Found a complete name */ *quarks++ = _XrmInternalStringToQuark(name,tname - name, sig, False); i = 0; sig = 0; } name = tname+1; } else { sig = (sig << 1) + ch; /* Compute the signature. */ i++; } } *quarks++ = _XrmInternalStringToQuark(name, tname - name, sig, False); } *quarks = NULLQUARK; } void XrmStringToBindingQuarkList( register _Xconst char *name, register XrmBindingList bindings, /* RETURN */ register XrmQuarkList quarks) /* RETURN */ { register XrmBits bits; register Signature sig = 0; register char ch, *tname; register XrmBinding binding; register int i = 0; if ((tname = (char *)name)) { tname--; binding = XrmBindTightly; while (!is_EOF(bits = next_char(ch, tname))) { if (is_binding (bits)) { if (i) { /* Found a complete name */ *bindings++ = binding; *quarks++ = _XrmInternalStringToQuark(name, tname - name, sig, False); i = 0; sig = 0; binding = XrmBindTightly; } name = tname+1; if (ch == '*') binding = XrmBindLoosely; } else { sig = (sig << 1) + ch; /* Compute the signature. */ i++; } } *bindings = binding; *quarks++ = _XrmInternalStringToQuark(name, tname - name, sig, False); } *quarks = NULLQUARK; } #ifdef DEBUG static void PrintQuarkList( XrmQuarkList quarks, FILE *stream) { Bool firstNameSeen; for (firstNameSeen = False; *quarks; quarks++) { if (firstNameSeen) { (void) fprintf(stream, "."); } firstNameSeen = True; (void) fputs(XrmQuarkToString(*quarks), stream); } } /* PrintQuarkList */ #endif /* DEBUG */ /* * Fallback methods for Xrm parsing. * Simulate a C locale. No state needed here. */ static void c_mbnoop( XPointer state) { } static char c_mbchar( XPointer state, const char *str, int *lenp) { *lenp = 1; return *str; } static const char * c_lcname( XPointer state) { return "C"; } static const XrmMethodsRec mb_methods = { c_mbnoop, /* mbinit */ c_mbchar, /* mbchar */ c_mbnoop, /* mbfinish */ c_lcname, /* lcname */ c_mbnoop /* destroy */ }; static XrmDatabase NewDatabase(void) { register XrmDatabase db; db = Xmalloc(sizeof(XrmHashBucketRec)); if (db) { _XCreateMutex(&db->linfo); db->table = (NTable)NULL; db->mbstate = (XPointer)NULL; db->methods = _XrmInitParseInfo(&db->mbstate); if (!db->methods) db->methods = &mb_methods; } return db; } /* move all values from ftable to ttable, and free ftable's buckets. * ttable is guaranteed empty to start with. */ static void MoveValues( LTable ftable, register LTable ttable) { register VEntry fentry, nfentry; register VEntry *prev; register VEntry *bucket; register VEntry tentry; register int i; for (i = ftable->table.mask, bucket = ftable->buckets; i >= 0; i--) { for (fentry = *bucket++; fentry; fentry = nfentry) { prev = &LeafHash(ttable, fentry->name); tentry = *prev; *prev = fentry; /* chain on all with same name, to preserve invariant order */ while ((nfentry = fentry->next) && nfentry->name == fentry->name) fentry = nfentry; fentry->next = tentry; } } Xfree(ftable->buckets); } /* move all tables from ftable to ttable, and free ftable. * ttable is quaranteed empty to start with. */ static void MoveTables( NTable ftable, register NTable ttable) { register NTable fentry, nfentry; register NTable *prev; register NTable *bucket; register NTable tentry; register int i; for (i = ftable->mask, bucket = NodeBuckets(ftable); i >= 0; i--) { for (fentry = *bucket++; fentry; fentry = nfentry) { prev = &NodeHash(ttable, fentry->name); tentry = *prev; *prev = fentry; /* chain on all with same name, to preserve invariant order */ while ((nfentry = fentry->next) && nfentry->name == fentry->name) fentry = nfentry; fentry->next = tentry; } } Xfree(ftable); } /* grow the table, based on current number of entries */ static void GrowTable( NTable *prev) { register NTable table; register int i; table = *prev; i = table->mask; if (i == 255) /* biggest it gets */ return; while (i < 255 && GrowthPred(table->entries, i)) i = (i << 1) + 1; i++; /* i is now the new size */ if (table->leaf) { register LTable ltable; LTableRec otable; ltable = (LTable)table; /* cons up a copy to make MoveValues look symmetric */ otable = *ltable; ltable->buckets = Xcalloc(i, sizeof(VEntry)); if (!ltable->buckets) { ltable->buckets = otable.buckets; return; } ltable->table.mask = i - 1; MoveValues(&otable, ltable); } else { register NTable ntable; ntable = Xcalloc(1, sizeof(NTableRec) + (i * sizeof(NTable))); if (!ntable) return; *ntable = *table; ntable->mask = i - 1; *prev = ntable; MoveTables(table, ntable); } } /* merge values from ftable into *pprev, destroy ftable in the process */ static void MergeValues( LTable ftable, NTable *pprev, Bool override) { register VEntry fentry, tentry; register VEntry *prev; register LTable ttable; VEntry *bucket; int i; register XrmQuark q; ttable = (LTable)*pprev; if (ftable->table.hasloose) ttable->table.hasloose = 1; for (i = ftable->table.mask, bucket = ftable->buckets; i >= 0; i--, bucket++) { for (fentry = *bucket; fentry; ) { q = fentry->name; prev = &LeafHash(ttable, q); tentry = *prev; while (tentry && tentry->name != q) tentry = *(prev = &tentry->next); /* note: test intentionally uses fentry->name instead of q */ /* permits serendipitous inserts */ while (tentry && tentry->name == fentry->name) { /* if tentry is earlier, skip it */ if (!fentry->tight && tentry->tight) { tentry = *(prev = &tentry->next); continue; } if (fentry->tight != tentry->tight) { /* no match, chain in fentry */ *prev = fentry; prev = &fentry->next; fentry = *prev; *prev = tentry; ttable->table.entries++; } else if (override) { /* match, chain in fentry, splice out and free tentry */ *prev = fentry; prev = &fentry->next; fentry = *prev; *prev = tentry->next; /* free the overridden entry */ Xfree(tentry); /* get next tentry */ tentry = *prev; } else { /* match, discard fentry */ prev = &tentry->next; tentry = fentry; /* use as a temp var */ fentry = fentry->next; /* free the overpowered entry */ Xfree(tentry); /* get next tentry */ tentry = *prev; } if (!fentry) break; } /* at this point, tentry cannot match any fentry named q */ /* chain in all bindings together, preserve invariant order */ while (fentry && fentry->name == q) { *prev = fentry; prev = &fentry->next; fentry = *prev; *prev = tentry; ttable->table.entries++; } } } Xfree(ftable->buckets); Xfree(ftable); /* resize if necessary, now that we're all done */ GROW(pprev); } /* merge tables from ftable into *pprev, destroy ftable in the process */ static void MergeTables( NTable ftable, NTable *pprev, Bool override) { register NTable fentry, tentry; NTable nfentry; register NTable *prev; register NTable ttable; NTable *bucket; int i; register XrmQuark q; ttable = *pprev; if (ftable->hasloose) ttable->hasloose = 1; if (ftable->hasany) ttable->hasany = 1; for (i = ftable->mask, bucket = NodeBuckets(ftable); i >= 0; i--, bucket++) { for (fentry = *bucket; fentry; ) { q = fentry->name; prev = &NodeHash(ttable, q); tentry = *prev; while (tentry && tentry->name != q) tentry = *(prev = &tentry->next); /* note: test intentionally uses fentry->name instead of q */ /* permits serendipitous inserts */ while (tentry && tentry->name == fentry->name) { /* if tentry is earlier, skip it */ if ((fentry->leaf && !tentry->leaf) || (!fentry->tight && tentry->tight && (fentry->leaf || !tentry->leaf))) { tentry = *(prev = &tentry->next); continue; } nfentry = fentry->next; if (fentry->leaf != tentry->leaf || fentry->tight != tentry->tight) { /* no match, just chain in */ *prev = fentry; *(prev = &fentry->next) = tentry; ttable->entries++; } else { if (fentry->leaf) MergeValues((LTable)fentry, prev, override); else MergeTables(fentry, prev, override); /* bump to next tentry */ tentry = *(prev = &(*prev)->next); } /* bump to next fentry */ fentry = nfentry; if (!fentry) break; } /* at this point, tentry cannot match any fentry named q */ /* chain in all bindings together, preserve invariant order */ while (fentry && fentry->name == q) { *prev = fentry; prev = &fentry->next; fentry = *prev; *prev = tentry; ttable->entries++; } } } Xfree(ftable); /* resize if necessary, now that we're all done */ GROW(pprev); } void XrmCombineDatabase( XrmDatabase from, XrmDatabase *into, Bool override) { register NTable *prev; register NTable ftable, ttable, nftable; if (!*into) { *into = from; } else if (from) { _XLockMutex(&from->linfo); _XLockMutex(&(*into)->linfo); if ((ftable = from->table)) { prev = &(*into)->table; ttable = *prev; if (!ftable->leaf) { nftable = ftable->next; if (ttable && !ttable->leaf) { /* both have node tables, merge them */ MergeTables(ftable, prev, override); /* bump to into's leaf table, if any */ ttable = *(prev = &(*prev)->next); } else { /* into has no node table, link from's in */ *prev = ftable; *(prev = &ftable->next) = ttable; } /* bump to from's leaf table, if any */ ftable = nftable; } else { /* bump to into's leaf table, if any */ if (ttable && !ttable->leaf) ttable = *(prev = &ttable->next); } if (ftable) { /* if into has a leaf, merge, else insert */ if (ttable) MergeValues((LTable)ftable, prev, override); else *prev = ftable; } } (from->methods->destroy)(from->mbstate); _XUnlockMutex(&from->linfo); _XFreeMutex(&from->linfo); Xfree(from); _XUnlockMutex(&(*into)->linfo); } } void XrmMergeDatabases( XrmDatabase from, XrmDatabase *into) { XrmCombineDatabase(from, into, True); } /* store a value in the database, overriding any existing entry */ static void PutEntry( XrmDatabase db, XrmBindingList bindings, XrmQuarkList quarks, XrmRepresentation type, XrmValuePtr value) { register NTable *pprev, *prev; register NTable table; register XrmQuark q; register VEntry *vprev; register VEntry entry; NTable *nprev, *firstpprev; #define NEWTABLE(q,i) \ table = Xmalloc(sizeof(LTableRec)); \ if (!table) \ return; \ table->name = q; \ table->hasloose = 0; \ table->hasany = 0; \ table->mask = 0; \ table->entries = 0; \ if (quarks[i]) { \ table->leaf = 0; \ nprev = NodeBuckets(table); \ } else { \ table->leaf = 1; \ if (!(nprev = Xmalloc(sizeof(VEntry *)))) {\ Xfree(table); \ return; \ } \ ((LTable)table)->buckets = (VEntry *)nprev; \ } \ *nprev = (NTable)NULL; \ table->next = *prev; \ *prev = table if (!db || !*quarks) return; table = *(prev = &db->table); /* if already at leaf, bump to the leaf table */ if (!quarks[1] && table && !table->leaf) table = *(prev = &table->next); pprev = prev; if (!table || (quarks[1] && table->leaf)) { /* no top-level node table, create one and chain it in */ NEWTABLE(NULLQUARK,1); table->tight = 1; /* arbitrary */ prev = nprev; } else { /* search along until we need a value */ while (quarks[1]) { q = *quarks; table = *(prev = &NodeHash(table, q)); while (table && table->name != q) table = *(prev = &table->next); if (!table) break; /* not found */ if (quarks[2]) { if (table->leaf) break; /* not found */ } else { if (!table->leaf) { /* bump to leaf table, if any */ table = *(prev = &table->next); if (!table || table->name != q) break; /* not found */ if (!table->leaf) { /* bump to leaf table, if any */ table = *(prev = &table->next); if (!table || table->name != q) break; /* not found */ } } } if (*bindings == XrmBindTightly) { if (!table->tight) break; /* not found */ } else { if (table->tight) { /* bump to loose table, if any */ table = *(prev = &table->next); if (!table || table->name != q || (!quarks[2]) != table->leaf) break; /* not found */ } } /* found that one, bump to next quark */ pprev = prev; quarks++; bindings++; } if (!quarks[1]) { /* found all the way to a leaf */ q = *quarks; entry = *(vprev = &LeafHash((LTable)table, q)); while (entry && entry->name != q) entry = *(vprev = &entry->next); /* if want loose and have tight, bump to next entry */ if (entry && *bindings == XrmBindLoosely && entry->tight) entry = *(vprev = &entry->next); if (entry && entry->name == q && (*bindings == XrmBindTightly) == entry->tight) { /* match, need to override */ if ((type == XrmQString) == entry->string && entry->size == value->size) { /* update type if not String, can be different */ if (!entry->string) RepType(entry) = type; /* identical size, just overwrite value */ memcpy(RawValue(entry), (char *)value->addr, value->size); return; } /* splice out and free old entry */ *vprev = entry->next; Xfree(entry); (*pprev)->entries--; } /* this is where to insert */ prev = (NTable *)vprev; } } /* keep the top table, because we may have to grow it */ firstpprev = pprev; /* iterate until we get to the leaf */ while (quarks[1]) { /* build a new table and chain it in */ NEWTABLE(*quarks,2); if (*quarks++ == XrmQANY) (*pprev)->hasany = 1; if (*bindings++ == XrmBindTightly) { table->tight = 1; } else { table->tight = 0; (*pprev)->hasloose = 1; } (*pprev)->entries++; pprev = prev; prev = nprev; } /* now allocate the value entry */ entry = Xmalloc(((type == XrmQString) ? sizeof(VEntryRec) : sizeof(DEntryRec)) + value->size); if (!entry) return; entry->name = q = *quarks; if (*bindings == XrmBindTightly) { entry->tight = 1; } else { entry->tight = 0; (*pprev)->hasloose = 1; } /* chain it in, with a bit of type cast ugliness */ entry->next = *((VEntry *)prev); *((VEntry *)prev) = entry; entry->size = value->size; if (type == XrmQString) { entry->string = 1; } else { entry->string = 0; RepType(entry) = type; } /* save a copy of the value */ memcpy(RawValue(entry), (char *)value->addr, value->size); (*pprev)->entries++; /* this is a new leaf, need to remember it for search lists */ if (q > maxResourceQuark) { unsigned oldsize = (maxResourceQuark + 1) >> 3; unsigned size = ((q | 0x7f) + 1) >> 3; /* reallocate in chunks */ if (resourceQuarks) { unsigned char *prevQuarks = resourceQuarks; resourceQuarks = Xrealloc(resourceQuarks, size); if (!resourceQuarks) { Xfree(prevQuarks); } } else resourceQuarks = Xmalloc(size); if (resourceQuarks) { bzero((char *)&resourceQuarks[oldsize], size - oldsize); maxResourceQuark = (size << 3) - 1; } else { maxResourceQuark = -1; } } if (q > 0 && resourceQuarks) resourceQuarks[q >> 3] |= 1 << (q & 0x7); GROW(firstpprev); #undef NEWTABLE } void XrmQPutResource( XrmDatabase *pdb, XrmBindingList bindings, XrmQuarkList quarks, XrmRepresentation type, XrmValuePtr value) { if (!*pdb) *pdb = NewDatabase(); _XLockMutex(&(*pdb)->linfo); PutEntry(*pdb, bindings, quarks, type, value); _XUnlockMutex(&(*pdb)->linfo); } void XrmPutResource( XrmDatabase *pdb, _Xconst char *specifier, _Xconst char *type, XrmValuePtr value) { XrmBinding bindings[MAXDBDEPTH+1]; XrmQuark quarks[MAXDBDEPTH+1]; if (!*pdb) *pdb = NewDatabase(); _XLockMutex(&(*pdb)->linfo); XrmStringToBindingQuarkList(specifier, bindings, quarks); PutEntry(*pdb, bindings, quarks, XrmStringToQuark(type), value); _XUnlockMutex(&(*pdb)->linfo); } void XrmQPutStringResource( XrmDatabase *pdb, XrmBindingList bindings, XrmQuarkList quarks, _Xconst char *str) { XrmValue value; if (!*pdb) *pdb = NewDatabase(); value.addr = (XPointer) str; value.size = strlen(str)+1; _XLockMutex(&(*pdb)->linfo); PutEntry(*pdb, bindings, quarks, XrmQString, &value); _XUnlockMutex(&(*pdb)->linfo); } /* Function Name: GetDatabase * Description: Parses a string and stores it as a database. * Arguments: db - the database. * str - a pointer to the string containing the database. * filename - source filename, if any. * doall - whether to do all lines or just one */ /* * This function is highly optimized to inline as much as possible. * Be very careful with modifications, or simplifications, as they * may adversely affect the performance. * * Chris Peterson, MIT X Consortium 5/17/90. */ /* * Xlib spec says max 100 quarks in a lookup, will stop and return if * return if any single production's lhs has more than 100 components. */ #define QLIST_SIZE 100 /* * This should be big enough to handle things like the XKeysymDB or biggish * ~/.Xdefaults or app-defaults files. Anything bigger will be allocated on * the heap. */ #define DEF_BUFF_SIZE 8192 static void GetIncludeFile( XrmDatabase db, _Xconst char *base, _Xconst char *fname, int fnamelen, int depth); static void GetDatabase( XrmDatabase db, _Xconst char *str, _Xconst char *filename, Bool doall, int depth) { char *rhs; char *lhs, lhs_s[DEF_BUFF_SIZE]; XrmQuark quarks[QLIST_SIZE + 1]; /* allow for a terminal NullQuark */ XrmBinding bindings[QLIST_SIZE + 1]; register char *ptr; register XrmBits bits = 0; register char c; register Signature sig; register char *ptr_max; register int num_quarks; register XrmBindingList t_bindings; int len, alloc_chars; unsigned long str_len; XrmValue value; Bool only_pcs; Bool dolines; if (!db) return; /* * if strlen (str) < DEF_BUFF_SIZE allocate buffers on the stack for * speed otherwise malloc the buffer. From a buffer overflow standpoint * we can be sure that neither: a) a component on the lhs, or b) a * value on the rhs, will be longer than the overall length of str, * i.e. strlen(str). * * This should give good performance when parsing "*foo: bar" type * databases as might be passed with -xrm command line options; but * with larger databases, e.g. .Xdefaults, app-defaults, or KeysymDB * files, the size of the buffers will be overly large. One way * around this would be to double-parse each production with a resulting * performance hit. In any event we can be assured that a lhs component * name or a rhs value won't be longer than str itself. */ str_len = strlen (str); if (DEF_BUFF_SIZE > str_len) lhs = lhs_s; else if ((lhs = Xmalloc (str_len)) == NULL) return; alloc_chars = DEF_BUFF_SIZE < str_len ? str_len : DEF_BUFF_SIZE; if ((rhs = Xmalloc (alloc_chars)) == NULL) { if (lhs != lhs_s) Xfree (lhs); return; } (*db->methods->mbinit)(db->mbstate); str--; dolines = True; while (!is_EOF(bits) && dolines) { dolines = doall; /* * First: Remove extra whitespace. */ do { bits = next_char(c, str); } while is_space(bits); /* * Ignore empty lines. */ if (is_EOL(bits)) continue; /* start a new line. */ /* * Second: check the first character in a line to see if it is * "!" signifying a comment, or "#" signifying a directive. */ if (c == '!') { /* Comment, spin to next newline */ while (is_simple(bits = next_char(c, str))) {} if (is_EOL(bits)) continue; while (!is_EOL(bits = next_mbchar(c, len, str))) {} str--; continue; /* start a new line. */ } if (c == '#') { /* Directive */ /* remove extra whitespace */ only_pcs = True; while (is_space(bits = next_char(c, str))) {}; /* only "include" directive is currently defined */ if (!strncmp(str, "include", 7)) { str += (7-1); /* remove extra whitespace */ while (is_space(bits = next_char(c, str))) {}; /* must have a starting " */ if (c == '"') { _Xconst char *fname = str+1; len = 0; do { if (only_pcs) { bits = next_char(c, str); if (is_nonpcs(bits)) only_pcs = False; } if (!only_pcs) bits = next_mbchar(c, len, str); } while (c != '"' && !is_EOL(bits)); /* must have an ending " */ if (c == '"') GetIncludeFile(db, filename, fname, str - len - fname, depth); } } /* spin to next newline */ if (only_pcs) { while (is_simple(bits)) bits = next_char(c, str); if (is_EOL(bits)) continue; } while (!is_EOL(bits)) bits = next_mbchar(c, len, str); str--; continue; /* start a new line. */ } /* * Third: loop through the LHS of the resource specification * storing characters and converting this to a Quark. */ num_quarks = 0; t_bindings = bindings; sig = 0; ptr = lhs; *t_bindings = XrmBindTightly; for(;;) { if (!is_binding(bits)) { while (!is_EOQ(bits)) { *ptr++ = c; sig = (sig << 1) + c; /* Compute the signature. */ bits = next_char(c, str); } quarks[num_quarks++] = _XrmInternalStringToQuark(lhs, ptr - lhs, sig, False); if (num_quarks > QLIST_SIZE) { Xfree(rhs); if (lhs != lhs_s) Xfree (lhs); (*db->methods->mbfinish)(db->mbstate); return; } if (is_separator(bits)) { if (!is_space(bits)) break; /* Remove white space */ do { *ptr++ = c; sig = (sig << 1) + c; /* Compute the signature. */ } while (is_space(bits = next_char(c, str))); /* * The spec doesn't permit it, but support spaces * internal to resource name/class */ if (is_separator(bits)) break; num_quarks--; continue; } if (c == '.') *(++t_bindings) = XrmBindTightly; else *(++t_bindings) = XrmBindLoosely; sig = 0; ptr = lhs; } else { /* * Magic unspecified feature #254. * * If two separators appear with no Text between them then * ignore them. * * If anyone of those separators is a '*' then the binding * will be loose, otherwise it will be tight. */ if (c == '*') *t_bindings = XrmBindLoosely; } bits = next_char(c, str); } quarks[num_quarks] = NULLQUARK; /* * Make sure that there is a ':' in this line. */ if (c != ':') { char oldc; /* * A parsing error has occured, toss everything on the line * a new_line can still be escaped with a '\'. */ while (is_normal(bits)) bits = next_char(c, str); if (is_EOL(bits)) continue; bits = next_mbchar(c, len, str); do { oldc = c; bits = next_mbchar(c, len, str); } while (c && (c != '\n' || oldc == '\\')); str--; continue; } /* * I now have a quark and binding list for the entire left hand * side. "c" currently points to the ":" separating the left hand * side for the right hand side. It is time to begin processing * the right hand side. */ /* * Fourth: Remove more whitespace */ for(;;) { if (is_space(bits = next_char(c, str))) continue; if (c != '\\') break; bits = next_char(c, str); if (c == '\n') continue; str--; bits = BSLASH; c = '\\'; break; } /* * Fifth: Process the right hand side. */ ptr = rhs; ptr_max = ptr + alloc_chars - 4; only_pcs = True; len = 1; for(;;) { /* * Tight loop for the normal case: Non backslash, non-end of value * character that will fit into the allocated buffer. */ if (only_pcs) { while (is_normal(bits) && ptr < ptr_max) { *ptr++ = c; bits = next_char(c, str); } if (is_EOL(bits)) break; if (is_nonpcs(bits)) { only_pcs = False; bits = next_mbchar(c, len, str); } } while (!is_special(bits) && ptr + len <= ptr_max) { len = -len; while (len) *ptr++ = str[len++]; if (*str == '\0') { bits = EOS; break; } bits = next_mbchar(c, len, str); } if (is_EOL(bits)) { str--; break; } if (c == '\\') { /* * We need to do some magic after a backslash. */ Bool read_next = True; if (only_pcs) { bits = next_char(c, str); if (is_nonpcs(bits)) only_pcs = False; } if (!only_pcs) bits = next_mbchar(c, len, str); if (is_EOL(bits)) { if (is_EOF(bits)) continue; } else if (c == 'n') { /* * "\n" means insert a newline. */ *ptr++ = '\n'; } else if (c == '\\') { /* * "\\" completes to just one backslash. */ *ptr++ = '\\'; } else { /* * pick up to three octal digits after the '\'. */ char temp[3]; int count = 0; while (is_odigit(bits) && count < 3) { temp[count++] = c; if (only_pcs) { bits = next_char(c, str); if (is_nonpcs(bits)) only_pcs = False; } if (!only_pcs) bits = next_mbchar(c, len, str); } /* * If we found three digits then insert that octal code * into the value string as a character. */ if (count == 3) { *ptr++ = (unsigned char) ((temp[0] - '0') * 0100 + (temp[1] - '0') * 010 + (temp[2] - '0')); } else { int tcount; /* * Otherwise just insert those characters into the * string, since no special processing is needed on * numerics we can skip the special processing. */ for (tcount = 0; tcount < count; tcount++) { *ptr++ = temp[tcount]; /* print them in the correct order */ } } read_next = False; } if (read_next) { if (only_pcs) { bits = next_char(c, str); if (is_nonpcs(bits)) only_pcs = False; } if (!only_pcs) bits = next_mbchar(c, len, str); } } /* * It is important to make sure that there is room for at least * four more characters in the buffer, since I can add that * many characters into the buffer after a backslash has occured. */ if (ptr + len > ptr_max) { char * temp_str; alloc_chars += BUFSIZ/10; temp_str = Xrealloc(rhs, sizeof(char) * alloc_chars); if (!temp_str) { Xfree(rhs); if (lhs != lhs_s) Xfree (lhs); (*db->methods->mbfinish)(db->mbstate); return; } ptr = temp_str + (ptr - rhs); /* reset pointer. */ rhs = temp_str; ptr_max = rhs + alloc_chars - 4; } } /* * Lastly: Terminate the value string, and store this entry * into the database. */ *ptr++ = '\0'; /* Store it in database */ value.size = ptr - rhs; value.addr = (XPointer) rhs; PutEntry(db, bindings, quarks, XrmQString, &value); } if (lhs != lhs_s) Xfree (lhs); Xfree (rhs); (*db->methods->mbfinish)(db->mbstate); } void XrmPutStringResource( XrmDatabase *pdb, _Xconst char*specifier, _Xconst char*str) { XrmValue value; XrmBinding bindings[MAXDBDEPTH+1]; XrmQuark quarks[MAXDBDEPTH+1]; if (!*pdb) *pdb = NewDatabase(); XrmStringToBindingQuarkList(specifier, bindings, quarks); value.addr = (XPointer) str; value.size = strlen(str)+1; _XLockMutex(&(*pdb)->linfo); PutEntry(*pdb, bindings, quarks, XrmQString, &value); _XUnlockMutex(&(*pdb)->linfo); } void XrmPutLineResource( XrmDatabase *pdb, _Xconst char*line) { if (!*pdb) *pdb = NewDatabase(); _XLockMutex(&(*pdb)->linfo); GetDatabase(*pdb, line, (char *)NULL, False, 0); _XUnlockMutex(&(*pdb)->linfo); } XrmDatabase XrmGetStringDatabase( _Xconst char *data) { XrmDatabase db; db = NewDatabase(); _XLockMutex(&db->linfo); GetDatabase(db, data, (char *)NULL, True, 0); _XUnlockMutex(&db->linfo); return db; } /* Function Name: ReadInFile * Description: Reads the file into a buffer. * Arguments: filename - the name of the file. * Returns: An allocated string containing the contents of the file. */ static char * ReadInFile(_Xconst char *filename) { register int fd, size; char * filebuf; /* * MS-Windows and OS/2 note: Default open mode includes O_TEXT */ if ( (fd = _XOpenFile (filename, O_RDONLY)) == -1 ) return (char *)NULL; /* * MS-Windows and OS/2 note: depending on how the sources are * untarred, the newlines in resource files may or may not have * been expanded to CRLF. Either way the size returned by fstat * is sufficient to read the file into because in text-mode any * CRLFs in a file will be converted to newlines (LF) with the * result that the number of bytes actually read with be <= * to the size returned by fstat. */ { struct stat status_buffer; if ( ((fstat(fd, &status_buffer)) == -1 ) || (status_buffer.st_size >= INT_MAX) ) { close (fd); return (char *)NULL; } else size = (int) status_buffer.st_size; } if (!(filebuf = Xmalloc(size + 1))) { /* leave room for '\0' */ close(fd); return (char *)NULL; } size = read (fd, filebuf, size); if (size < 0) { close (fd); Xfree(filebuf); return (char *)NULL; } close (fd); filebuf[size] = '\0'; /* NULL terminate it. */ return filebuf; } static void GetIncludeFile( XrmDatabase db, _Xconst char *base, _Xconst char *fname, int fnamelen, int depth) { int len; char *str; char realfname[BUFSIZ]; if (fnamelen <= 0 || fnamelen >= BUFSIZ) return; if (depth >= MAXDBDEPTH) return; if (*fname != '/' && base && (str = strrchr(base, '/'))) { len = str - base + 1; if (len + fnamelen >= BUFSIZ) return; strncpy(realfname, base, len); strncpy(realfname + len, fname, fnamelen); realfname[len + fnamelen] = '\0'; } else { strncpy(realfname, fname, fnamelen); realfname[fnamelen] = '\0'; } if (!(str = ReadInFile(realfname))) return; GetDatabase(db, str, realfname, True, depth + 1); Xfree(str); } XrmDatabase XrmGetFileDatabase( _Xconst char *filename) { XrmDatabase db; char *str; if (!(str = ReadInFile(filename))) return (XrmDatabase)NULL; db = NewDatabase(); _XLockMutex(&db->linfo); GetDatabase(db, str, filename, True, 0); _XUnlockMutex(&db->linfo); Xfree(str); return db; } Status XrmCombineFileDatabase( _Xconst char *filename, XrmDatabase *target, Bool override) { XrmDatabase db; char *str; if (!(str = ReadInFile(filename))) return 0; if (override) { db = *target; if (!db) *target = db = NewDatabase(); } else db = NewDatabase(); _XLockMutex(&db->linfo); GetDatabase(db, str, filename, True, 0); _XUnlockMutex(&db->linfo); Xfree(str); if (!override) XrmCombineDatabase(db, target, False); return 1; } /* call the user proc for every value in the table, arbitrary order. * stop if user proc returns True. level is current depth in database. */ /*ARGSUSED*/ static Bool EnumLTable( LTable table, XrmNameList names, XrmClassList classes, register int level, register EClosure closure) { register VEntry *bucket; register int i; register VEntry entry; XrmValue value; XrmRepresentation type; Bool tightOk; closure->bindings[level] = (table->table.tight ? XrmBindTightly : XrmBindLoosely); closure->quarks[level] = table->table.name; level++; tightOk = !*names; closure->quarks[level + 1] = NULLQUARK; for (i = table->table.mask, bucket = table->buckets; i >= 0; i--, bucket++) { for (entry = *bucket; entry; entry = entry->next) { if (entry->tight && !tightOk) continue; closure->bindings[level] = (entry->tight ? XrmBindTightly : XrmBindLoosely); closure->quarks[level] = entry->name; value.size = entry->size; if (entry->string) { type = XrmQString; value.addr = StringValue(entry); } else { type = RepType(entry); value.addr = DataValue(entry); } if ((*closure->proc)(&closure->db, closure->bindings+1, closure->quarks+1, &type, &value, closure->closure)) return True; } } return False; } static Bool EnumAllNTable( NTable table, register int level, register EClosure closure) { register NTable *bucket; register int i; register NTable entry; XrmQuark empty = NULLQUARK; if (level >= MAXDBDEPTH) return False; for (i = table->mask, bucket = NodeBuckets(table); i >= 0; i--, bucket++) { for (entry = *bucket; entry; entry = entry->next) { if (entry->leaf) { if (EnumLTable((LTable)entry, &empty, &empty, level, closure)) return True; } else { closure->bindings[level] = (entry->tight ? XrmBindTightly : XrmBindLoosely); closure->quarks[level] = entry->name; if (EnumAllNTable(entry, level+1, closure)) return True; } } } return False; } /* recurse on every table in the table, arbitrary order. * stop if user proc returns True. level is current depth in database. */ static Bool EnumNTable( NTable table, XrmNameList names, XrmClassList classes, register int level, register EClosure closure) { register NTable entry; register XrmQuark q; register unsigned int leaf; Bool (*get)( NTable table, XrmNameList names, XrmClassList classes, register int level, EClosure closure); Bool bilevel; /* find entries named ename, leafness leaf, tight or loose, and call get */ #define ITIGHTLOOSE(ename) \ NFIND(ename); \ if (entry) { \ if (leaf == entry->leaf) { \ if (!leaf && !entry->tight && entry->next && \ entry->next->name == q && entry->next->tight && \ (bilevel || entry->next->hasloose) && \ EnumLTable((LTable)entry->next, names+1, classes+1, \ level, closure)) \ return True; \ if ((*get)(entry, names+1, classes+1, level, closure)) \ return True; \ if (entry->tight && (entry = entry->next) && \ entry->name == q && leaf == entry->leaf && \ (*get)(entry, names+1, classes+1, level, closure)) \ return True; \ } else if (entry->leaf) { \ if ((bilevel || entry->hasloose) && \ EnumLTable((LTable)entry, names+1, classes+1, level, closure))\ return True; \ if (entry->tight && (entry = entry->next) && \ entry->name == q && (bilevel || entry->hasloose) && \ EnumLTable((LTable)entry, names+1, classes+1, level, closure))\ return True; \ } \ } /* find entries named ename, leafness leaf, loose only, and call get */ #define ILOOSE(ename) \ NFIND(ename); \ if (entry && entry->tight && (entry = entry->next) && entry->name != q) \ entry = (NTable)NULL; \ if (entry) { \ if (leaf == entry->leaf) { \ if ((*get)(entry, names+1, classes+1, level, closure)) \ return True; \ } else if (entry->leaf && (bilevel || entry->hasloose)) { \ if (EnumLTable((LTable)entry, names+1, classes+1, level, closure))\ return True; \ } \ } if (level >= MAXDBDEPTH) return False; closure->bindings[level] = (table->tight ? XrmBindTightly : XrmBindLoosely); closure->quarks[level] = table->name; level++; if (!*names) { if (EnumAllNTable(table, level, closure)) return True; } else { if (names[1] || closure->mode == XrmEnumAllLevels) { get = EnumNTable; /* recurse */ leaf = 0; bilevel = !names[1]; } else { get = (getNTableEProcp)EnumLTable; /* bottom of recursion */ leaf = 1; bilevel = False; } if (table->hasloose && closure->mode == XrmEnumAllLevels) { NTable *bucket; int i; XrmQuark empty = NULLQUARK; for (i = table->mask, bucket = NodeBuckets(table); i >= 0; i--, bucket++) { q = NULLQUARK; for (entry = *bucket; entry; entry = entry->next) { if (!entry->tight && entry->name != q && entry->name != *names && entry->name != *classes) { q = entry->name; if (entry->leaf) { if (EnumLTable((LTable)entry, &empty, &empty, level, closure)) return True; } else { if (EnumNTable(entry, &empty, &empty, level, closure)) return True; } } } } } ITIGHTLOOSE(*names); /* do name, tight and loose */ ITIGHTLOOSE(*classes); /* do class, tight and loose */ if (table->hasany) { ITIGHTLOOSE(XrmQANY); /* do ANY, tight and loose */ } if (table->hasloose) { while (1) { names++; classes++; if (!*names) break; if (!names[1] && closure->mode != XrmEnumAllLevels) { get = (getNTableEProcp)EnumLTable; /* bottom of recursion */ leaf = 1; } ILOOSE(*names); /* loose names */ ILOOSE(*classes); /* loose classes */ if (table->hasany) { ILOOSE(XrmQANY); /* loose ANY */ } } names--; classes--; } } /* now look for matching leaf nodes */ entry = table->next; if (!entry) return False; if (entry->leaf) { if (entry->tight && !table->tight) entry = entry->next; } else { entry = entry->next; if (!entry || !entry->tight) return False; } if (!entry || entry->name != table->name) return False; /* found one */ level--; if ((!*names || entry->hasloose) && EnumLTable((LTable)entry, names, classes, level, closure)) return True; if (entry->tight && entry == table->next && (entry = entry->next) && entry->name == table->name && (!*names || entry->hasloose)) return EnumLTable((LTable)entry, names, classes, level, closure); return False; #undef ITIGHTLOOSE #undef ILOOSE } /* call the proc for every value in the database, arbitrary order. * stop if the proc returns True. */ Bool XrmEnumerateDatabase( XrmDatabase db, XrmNameList names, XrmClassList classes, int mode, DBEnumProc proc, XPointer closure) { XrmBinding bindings[MAXDBDEPTH+2]; XrmQuark quarks[MAXDBDEPTH+2]; register NTable table; EClosureRec eclosure; Bool retval = False; if (!db) return False; _XLockMutex(&db->linfo); eclosure.db = db; eclosure.proc = proc; eclosure.closure = closure; eclosure.bindings = bindings; eclosure.quarks = quarks; eclosure.mode = mode; table = db->table; if (table && !table->leaf && !*names && mode == XrmEnumOneLevel) table = table->next; if (table) { if (!table->leaf) retval = EnumNTable(table, names, classes, 0, &eclosure); else retval = EnumLTable((LTable)table, names, classes, 0, &eclosure); } _XUnlockMutex(&db->linfo); return retval; } static void PrintBindingQuarkList( XrmBindingList bindings, XrmQuarkList quarks, FILE *stream) { Bool firstNameSeen; for (firstNameSeen = False; *quarks; bindings++, quarks++) { if (*bindings == XrmBindLoosely) { (void) fprintf(stream, "*"); } else if (firstNameSeen) { (void) fprintf(stream, "."); } firstNameSeen = True; (void) fputs(XrmQuarkToString(*quarks), stream); } } /* output out the entry in correct file syntax */ /*ARGSUSED*/ static Bool DumpEntry( XrmDatabase *db, XrmBindingList bindings, XrmQuarkList quarks, XrmRepresentation *type, XrmValuePtr value, XPointer data) { FILE *stream = (FILE *)data; register unsigned int i; register char *s; register char c; if (*type != XrmQString) (void) putc('!', stream); PrintBindingQuarkList(bindings, quarks, stream); s = value->addr; i = value->size; if (*type == XrmQString) { (void) fputs(":\t", stream); if (i) i--; } else (void) fprintf(stream, "=%s:\t", XrmRepresentationToString(*type)); if (i && (*s == ' ' || *s == '\t')) (void) putc('\\', stream); /* preserve leading whitespace */ while (i--) { c = *s++; if (c == '\n') { if (i) (void) fputs("\\n\\\n", stream); else (void) fputs("\\n", stream); } else if (c == '\\') (void) fputs("\\\\", stream); else if ((c < ' ' && c != '\t') || ((unsigned char)c >= 0x7f && (unsigned char)c < 0xa0)) (void) fprintf(stream, "\\%03o", (unsigned char)c); else (void) putc(c, stream); } (void) putc('\n', stream); return ferror(stream) != 0; } #ifdef DEBUG void PrintTable( NTable table, FILE *file) { XrmBinding bindings[MAXDBDEPTH+1]; XrmQuark quarks[MAXDBDEPTH+1]; EClosureRec closure; XrmQuark empty = NULLQUARK; closure.db = (XrmDatabase)NULL; closure.proc = DumpEntry; closure.closure = (XPointer)file; closure.bindings = bindings; closure.quarks = quarks; closure.mode = XrmEnumAllLevels; if (table->leaf) EnumLTable((LTable)table, &empty, &empty, 0, &closure); else EnumNTable(table, &empty, &empty, 0, &closure); } #endif /* DEBUG */ void XrmPutFileDatabase( XrmDatabase db, _Xconst char *fileName) { FILE *file; XrmQuark empty = NULLQUARK; if (!db) return; if (!(file = fopen(fileName, "w"))) return; if (XrmEnumerateDatabase(db, &empty, &empty, XrmEnumAllLevels, DumpEntry, (XPointer) file)) unlink((char *)fileName); fclose(file); } /* macros used in get/search functions */ /* find entries named ename, leafness leaf, tight or loose, and call get */ #define GTIGHTLOOSE(ename,looseleaf) \ NFIND(ename); \ if (entry) { \ if (leaf == entry->leaf) { \ if (!leaf && !entry->tight && entry->next && \ entry->next->name == q && entry->next->tight && \ entry->next->hasloose && \ looseleaf((LTable)entry->next, names+1, classes+1, closure)) \ return True; \ if ((*get)(entry, names+1, classes+1, closure)) \ return True; \ if (entry->tight && (entry = entry->next) && \ entry->name == q && leaf == entry->leaf && \ (*get)(entry, names+1, classes+1, closure)) \ return True; \ } else if (entry->leaf) { \ if (entry->hasloose && \ looseleaf((LTable)entry, names+1, classes+1, closure)) \ return True; \ if (entry->tight && (entry = entry->next) && \ entry->name == q && entry->hasloose && \ looseleaf((LTable)entry, names+1, classes+1, closure)) \ return True; \ } \ } /* find entries named ename, leafness leaf, loose only, and call get */ #define GLOOSE(ename,looseleaf) \ NFIND(ename); \ if (entry && entry->tight && (entry = entry->next) && entry->name != q) \ entry = (NTable)NULL; \ if (entry) { \ if (leaf == entry->leaf) { \ if ((*get)(entry, names+1, classes+1, closure)) \ return True; \ } else if (entry->leaf && entry->hasloose) { \ if (looseleaf((LTable)entry, names+1, classes+1, closure)) \ return True; \ } \ } /* add tight/loose entry to the search list, return True if list is full */ /*ARGSUSED*/ static Bool AppendLEntry( LTable table, XrmNameList names, XrmClassList classes, register SClosure closure) { /* check for duplicate */ if (closure->idx >= 0 && closure->list[closure->idx] == table) return False; if (closure->idx == closure->limit) return True; /* append it */ closure->idx++; closure->list[closure->idx] = table; return False; } /* add loose entry to the search list, return True if list is full */ /*ARGSUSED*/ static Bool AppendLooseLEntry( LTable table, XrmNameList names, XrmClassList classes, register SClosure closure) { /* check for duplicate */ if (closure->idx >= 0 && closure->list[closure->idx] == table) return False; if (closure->idx >= closure->limit - 1) return True; /* append it */ closure->idx++; closure->list[closure->idx] = LOOSESEARCH; closure->idx++; closure->list[closure->idx] = table; return False; } /* search for a leaf table */ static Bool SearchNEntry( NTable table, XrmNameList names, XrmClassList classes, SClosure closure) { register NTable entry; register XrmQuark q; register unsigned int leaf; Bool (*get)( NTable table, XrmNameList names, XrmClassList classes, SClosure closure); if (names[1]) { get = SearchNEntry; /* recurse */ leaf = 0; } else { get = (getNTableSProcp)AppendLEntry; /* bottom of recursion */ leaf = 1; } GTIGHTLOOSE(*names, AppendLooseLEntry); /* do name, tight and loose */ GTIGHTLOOSE(*classes, AppendLooseLEntry); /* do class, tight and loose */ if (table->hasany) { GTIGHTLOOSE(XrmQANY, AppendLooseLEntry); /* do ANY, tight and loose */ } if (table->hasloose) { while (1) { names++; classes++; if (!*names) break; if (!names[1]) { get = (getNTableSProcp)AppendLEntry; /* bottom of recursion */ leaf = 1; } GLOOSE(*names, AppendLooseLEntry); /* loose names */ GLOOSE(*classes, AppendLooseLEntry); /* loose classes */ if (table->hasany) { GLOOSE(XrmQANY, AppendLooseLEntry); /* loose ANY */ } } } /* now look for matching leaf nodes */ entry = table->next; if (!entry) return False; if (entry->leaf) { if (entry->tight && !table->tight) entry = entry->next; } else { entry = entry->next; if (!entry || !entry->tight) return False; } if (!entry || entry->name != table->name) return False; /* found one */ if (entry->hasloose && AppendLooseLEntry((LTable)entry, names, classes, closure)) return True; if (entry->tight && entry == table->next && (entry = entry->next) && entry->name == table->name && entry->hasloose) return AppendLooseLEntry((LTable)entry, names, classes, closure); return False; } Bool XrmQGetSearchList( XrmDatabase db, XrmNameList names, XrmClassList classes, XrmSearchList searchList, /* RETURN */ int listLength) { register NTable table; SClosureRec closure; if (listLength <= 0) return False; closure.list = (LTable *)searchList; closure.idx = -1; closure.limit = listLength - 2; if (db) { _XLockMutex(&db->linfo); table = db->table; if (*names) { if (table && !table->leaf) { if (SearchNEntry(table, names, classes, &closure)) { _XUnlockMutex(&db->linfo); return False; } } else if (table && table->hasloose && AppendLooseLEntry((LTable)table, names, classes, &closure)) { _XUnlockMutex(&db->linfo); return False; } } else { if (table && !table->leaf) table = table->next; if (table && AppendLEntry((LTable)table, names, classes, &closure)) { _XUnlockMutex(&db->linfo); return False; } } _XUnlockMutex(&db->linfo); } closure.list[closure.idx + 1] = (LTable)NULL; return True; } Bool XrmQGetSearchResource( XrmSearchList searchList, register XrmName name, register XrmClass class, XrmRepresentation *pType, /* RETURN */ XrmValue *pValue) /* RETURN */ { register LTable *list; register LTable table; register VEntry entry = NULL; int flags; /* find tight or loose entry */ #define VTIGHTLOOSE(q) \ entry = LeafHash(table, q); \ while (entry && entry->name != q) \ entry = entry->next; \ if (entry) \ break /* find loose entry */ #define VLOOSE(q) \ entry = LeafHash(table, q); \ while (entry && entry->name != q) \ entry = entry->next; \ if (entry) { \ if (!entry->tight) \ break; \ if ((entry = entry->next) && entry->name == q) \ break; \ } list = (LTable *)searchList; /* figure out which combination of name and class we need to search for */ flags = 0; if (IsResourceQuark(name)) flags = 2; if (IsResourceQuark(class)) flags |= 1; if (!flags) { /* neither name nor class has ever been used to name a resource */ table = (LTable)NULL; } else if (flags == 3) { /* both name and class */ while ((table = *list++)) { if (table != LOOSESEARCH) { VTIGHTLOOSE(name); /* do name, tight and loose */ VTIGHTLOOSE(class); /* do class, tight and loose */ } else { table = *list++; VLOOSE(name); /* do name, loose only */ VLOOSE(class); /* do class, loose only */ } } } else { /* just one of name or class */ if (flags == 1) name = class; while ((table = *list++)) { if (table != LOOSESEARCH) { VTIGHTLOOSE(name); /* tight and loose */ } else { table = *list++; VLOOSE(name); /* loose only */ } } } if (table) { /* found a match */ if (entry->string) { *pType = XrmQString; pValue->addr = StringValue(entry); } else { *pType = RepType(entry); pValue->addr = DataValue(entry); } pValue->size = entry->size; return True; } *pType = NULLQUARK; pValue->addr = (XPointer)NULL; pValue->size = 0; return False; #undef VTIGHTLOOSE #undef VLOOSE } /* look for a tight/loose value */ static Bool GetVEntry( LTable table, XrmNameList names, XrmClassList classes, VClosure closure) { register VEntry entry; register XrmQuark q; /* try name first */ q = *names; entry = LeafHash(table, q); while (entry && entry->name != q) entry = entry->next; if (!entry) { /* not found, try class */ q = *classes; entry = LeafHash(table, q); while (entry && entry->name != q) entry = entry->next; if (!entry) return False; } if (entry->string) { *closure->type = XrmQString; closure->value->addr = StringValue(entry); } else { *closure->type = RepType(entry); closure->value->addr = DataValue(entry); } closure->value->size = entry->size; return True; } /* look for a loose value */ static Bool GetLooseVEntry( LTable table, XrmNameList names, XrmClassList classes, VClosure closure) { register VEntry entry; register XrmQuark q; #define VLOOSE(ename) \ q = ename; \ entry = LeafHash(table, q); \ while (entry && entry->name != q) \ entry = entry->next; \ if (entry && entry->tight && (entry = entry->next) && entry->name != q) \ entry = (VEntry)NULL; /* bump to last component */ while (names[1]) { names++; classes++; } VLOOSE(*names); /* do name, loose only */ if (!entry) { VLOOSE(*classes); /* do class, loose only */ if (!entry) return False; } if (entry->string) { *closure->type = XrmQString; closure->value->addr = StringValue(entry); } else { *closure->type = RepType(entry); closure->value->addr = DataValue(entry); } closure->value->size = entry->size; return True; #undef VLOOSE } /* recursive search for a value */ static Bool GetNEntry( NTable table, XrmNameList names, XrmClassList classes, VClosure closure) { register NTable entry; register XrmQuark q; register unsigned int leaf; Bool (*get)( NTable table, XrmNameList names, XrmClassList classes, VClosure closure); NTable otable; if (names[2]) { get = GetNEntry; /* recurse */ leaf = 0; } else { get = (getNTableVProcp)GetVEntry; /* bottom of recursion */ leaf = 1; } GTIGHTLOOSE(*names, GetLooseVEntry); /* do name, tight and loose */ GTIGHTLOOSE(*classes, GetLooseVEntry); /* do class, tight and loose */ if (table->hasany) { GTIGHTLOOSE(XrmQANY, GetLooseVEntry); /* do ANY, tight and loose */ } if (table->hasloose) { while (1) { names++; classes++; if (!names[1]) break; if (!names[2]) { get = (getNTableVProcp)GetVEntry; /* bottom of recursion */ leaf = 1; } GLOOSE(*names, GetLooseVEntry); /* do name, loose only */ GLOOSE(*classes, GetLooseVEntry); /* do class, loose only */ if (table->hasany) { GLOOSE(XrmQANY, GetLooseVEntry); /* do ANY, loose only */ } } } /* look for matching leaf tables */ otable = table; table = table->next; if (!table) return False; if (table->leaf) { if (table->tight && !otable->tight) table = table->next; } else { table = table->next; if (!table || !table->tight) return False; } if (!table || table->name != otable->name) return False; /* found one */ if (table->hasloose && GetLooseVEntry((LTable)table, names, classes, closure)) return True; if (table->tight && table == otable->next) { table = table->next; if (table && table->name == otable->name && table->hasloose) return GetLooseVEntry((LTable)table, names, classes, closure); } return False; } Bool XrmQGetResource( XrmDatabase db, XrmNameList names, XrmClassList classes, XrmRepresentation *pType, /* RETURN */ XrmValuePtr pValue) /* RETURN */ { register NTable table; VClosureRec closure; if (db && *names) { _XLockMutex(&db->linfo); closure.type = pType; closure.value = pValue; table = db->table; if (names[1]) { if (table && !table->leaf) { if (GetNEntry(table, names, classes, &closure)) { _XUnlockMutex(&db->linfo); return True; } } else if (table && table->hasloose && GetLooseVEntry((LTable)table, names, classes, &closure)) { _XUnlockMutex (&db->linfo); return True; } } else { if (table && !table->leaf) table = table->next; if (table && GetVEntry((LTable)table, names, classes, &closure)) { _XUnlockMutex(&db->linfo); return True; } } _XUnlockMutex(&db->linfo); } *pType = NULLQUARK; pValue->addr = (XPointer)NULL; pValue->size = 0; return False; } Bool XrmGetResource(XrmDatabase db, _Xconst char *name_str, _Xconst char *class_str, XrmString *pType_str, XrmValuePtr pValue) { XrmName names[MAXDBDEPTH+1]; XrmClass classes[MAXDBDEPTH+1]; XrmRepresentation fromType; Bool result; XrmStringToNameList(name_str, names); XrmStringToClassList(class_str, classes); result = XrmQGetResource(db, names, classes, &fromType, pValue); (*pType_str) = XrmQuarkToString(fromType); return result; } /* destroy all values, plus table itself */ static void DestroyLTable( LTable table) { register int i; register VEntry *buckets; register VEntry entry, next; buckets = table->buckets; for (i = table->table.mask; i >= 0; i--, buckets++) { for (next = *buckets; (entry = next); ) { next = entry->next; Xfree(entry); } } Xfree(table->buckets); Xfree(table); } /* destroy all contained tables, plus table itself */ static void DestroyNTable( NTable table) { register int i; register NTable *buckets; register NTable entry, next; buckets = NodeBuckets(table); for (i = table->mask; i >= 0; i--, buckets++) { for (next = *buckets; (entry = next); ) { next = entry->next; if (entry->leaf) DestroyLTable((LTable)entry); else DestroyNTable(entry); } } Xfree(table); } const char * XrmLocaleOfDatabase( XrmDatabase db) { const char* retval; _XLockMutex(&db->linfo); retval = (*db->methods->lcname)(db->mbstate); _XUnlockMutex(&db->linfo); return retval; } void XrmDestroyDatabase( XrmDatabase db) { register NTable table, next; if (db) { _XLockMutex(&db->linfo); for (next = db->table; (table = next); ) { next = table->next; if (table->leaf) DestroyLTable((LTable)table); else DestroyNTable(table); } _XUnlockMutex(&db->linfo); _XFreeMutex(&db->linfo); (*db->methods->destroy)(db->mbstate); Xfree(db); } } nx-libs-3.5.99.23/nx-X11/Makefile0000644000000000000000000000541513614532331012750 0ustar # $Xorg: Makefile,v 1.5 2000/08/17 19:41:44 cpqbld Exp $ # $Id: Makefile,v 1.5 2005/12/14 23:41:52 alanc Exp $ # $XFree86: xc/Makefile,v 3.28tsi Exp $ # Luna users will need to either run make as "make MAKE=make" # or add "MAKE = make" to this file. RELEASE = "Release $(shell cat ../VERSION)" SHELL = /bin/sh RM = rm -f MV = mv WORLDOPTS = WIN32WORLDOPTS = -i TOP = . CURRENT_DIR = . CONFIGSRC = $(TOP)/config IRULESRC = $(CONFIGSRC)/cf IMAKE = imake IMAKE_CMD = $(IMAKE) -I$(IRULESRC) $(IMAKE_DEFINES) MAKE_OPTS = -f xmakefile MAKE_CMD = $(MAKE) $(MAKE_OPTS) all: @${MAKE} ${MAKE_OPTS} xmakefile-exists || $(MAKE) all-initial @${MAKE} ${MAKE_OPTS} $@ all-initial: @echo Please use make World, or on NT use nmake World.Win32. @echo @echo Read the release notes carefully before proceeding. @echo Do not name your log file make.log or it will be deleted. World: BuildEnv @echo "" @echo Building $(RELEASE). @echo "" @date @echo "" ${MAKE} ${MAKE_OPTS} $(MFLAGS) $(WORLDOPTS) World @echo "" @date @echo "" @echo Full build of $(RELEASE) complete. @echo "" CleanEnv: SetupEnv ${MAKE} ${MAKE_OPTS} -k clean rm -f $(IRULESRC)/date.def; echo "" > $(IRULESRC)/date.def; SetupEnv: xmakefile VerifyOS Makefiles BuildEnv: SetupEnv BuildIncludes BuildDependsOnly BuildIncludes: SetupEnv includes BuildDependsOnly: SetupEnv depend Makefile:: $(MAKE) $(MFLAGS) xmakefile .PRECIOUS: Makefile xmakefile: if [ -f xmakefile ]; then \ set -x; \ $(RM) xmakefile.bak; \ $(MV) xmakefile xmakefile.bak; \ else \ exit 0; \ fi which $(IMAKE) 1>/dev/null && $(IMAKE_CMD) $(MFLAGS) -s xmakefile -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) # don't allow any default rules in this Makefile .SUFFIXES: # quiet "make" programs that display a message if suffix list empty .SUFFIXES: .Dummy # a copy of every rule that might be invoked at top level clean: CleanEnv dangerous_strip_clean: xmakefile ${MAKE} ${MAKE_OPTS} $@ distclean: clean -${MAKE} ${MAKE_OPTS} ${MFLAGS} $@ find config programs include -type f -name Makefile | while read makefile; do rm -f $$makefile; done $(RM) xmakefile depend: xmakefile ${MAKE} ${MAKE_OPTS} ${MFLAGS} $@ Everything: SetupEnv ${MAKE} ${MAKE_OPTS} ${MFLAGS} $@ external.ln: xmakefile ${MAKE} ${MAKE_OPTS} ${MFLAGS} $@ includes: xmakefile VerifyOS Makefiles ${MAKE} ${MAKE_OPTS} ${MFLAGS} $@ install.sdk: SetupEnv ${MAKE} ${MAKE_OPTS} ${MFLAGS} $@ install.ln: SetupEnv ${MAKE} ${MAKE_OPTS} ${MFLAGS} $@ install.man: SetupEnv ${MAKE} ${MAKE_OPTS} ${MFLAGS} $@ install: SetupEnv ${MAKE} ${MAKE_OPTS} ${MFLAGS} $@ Makefiles: xmakefile VerifyOS ${MAKE} ${MAKE_OPTS} ${MFLAGS} $@ man_keywords: SetupEnv ${MAKE} ${MAKE_OPTS} ${MFLAGS} $@ tags: xmakefile ${MAKE} ${MAKE_OPTS} ${MFLAGS} $@ VerifyOS: xmakefile ${MAKE} ${MAKE_OPTS} ${MFLAGS} $@ nx-libs-3.5.99.23/nx-X11/programs/Imakefile0000644000000000000000000000320013614532331014741 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /**************************************************************************/ #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" #if BuildServer XSSRCDIR = Xserver #endif SUBDIRS = $(XSSRCDIR) MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) nx-libs-3.5.99.23/nx-X11/programs/Xserver/code-versions.txt0000644000000000000000000000137713614532331020124 0ustar An overview of where we stand with upgrading to latest xorg-xserver code base. This ignores any security fixes that have been backported, it rather describes what functionality level the modules are at (roughly): module xorg version composite 1.12 (~ 9838b70 2012-03-21 Introduce a consistent coding style [Keith Packard]) damageext 6.9/7.0 dbe 1.4.2 dix 1.3.0.0 fb 7.1/1.1 GL 6.9/7.0 mi 7.1/1.1 miext 7.1/1.1 os ? 7.1/1.1 + many backports, some of them from 2017 randr 1.18.0 record 1.4.2 render 6.9/7.0 Xext 1.4.2 xfixes 1.4.2 Xi 1.3.0.0 xkb 1.3.0.0 nx-libs-3.5.99.23/nx-X11/programs/Xserver/composite/compalloc.c0000644000000000000000000004550313614532331020721 0ustar /* * $Id: compalloc.c,v 1.7 2005/07/03 07:37:34 daniels Exp $ * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "compint.h" static void compScreenUpdate(ScreenPtr pScreen) { compCheckTree(pScreen); compPaintChildrenToWindow(pScreen, pScreen->root); } static void compBlockHandler(int i, void *blockData, void *pTimeout, void *pReadmask) { ScreenPtr pScreen = screenInfo.screens[i]; CompScreenPtr cs = GetCompScreen(pScreen); pScreen->BlockHandler = cs->BlockHandler; compScreenUpdate(pScreen); (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); /* Next damage will restore the block handler */ cs->BlockHandler = NULL; } static void compReportDamage(DamagePtr pDamage, RegionPtr pRegion, void *closure) { WindowPtr pWin = (WindowPtr) closure; ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen(pScreen); CompWindowPtr cw = GetCompWindow(pWin); if (!cs->BlockHandler) { cs->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = compBlockHandler; } cs->damaged = TRUE; cw->damaged = TRUE; /* Mark the ancestors */ /* We can't do this, Dave. No damagedDescendants support. */ /* pWin = pWin->parent; while (pWin) { if (pWin->damagedDescendants) break; pWin->damagedDescendants = TRUE; pWin = pWin->parent; } */ } static void compDestroyDamage(DamagePtr pDamage, void *closure) { WindowPtr pWin = (WindowPtr) closure; CompWindowPtr cw = GetCompWindow(pWin); cw->damage = 0; } static Bool compMarkWindows(WindowPtr pWin, WindowPtr *ppLayerWin) { ScreenPtr pScreen = pWin->drawable.pScreen; WindowPtr pLayerWin = pWin; if (!pWin->viewable) return FALSE; (*pScreen->MarkOverlappedWindows) (pWin, pWin, &pLayerWin); (*pScreen->MarkWindow) (pLayerWin->parent); *ppLayerWin = pLayerWin; return TRUE; } static void compHandleMarkedWindows(WindowPtr pWin, WindowPtr pLayerWin) { ScreenPtr pScreen = pWin->drawable.pScreen; (*pScreen->ValidateTree) (pLayerWin->parent, pLayerWin, VTOther); (*pScreen->HandleExposures) (pLayerWin->parent); if (pScreen->PostValidateTree) (*pScreen->PostValidateTree) (pLayerWin->parent, pLayerWin, VTOther); } /* * Redirect one window for one client */ int compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update) { CompWindowPtr cw = GetCompWindow(pWin); CompClientWindowPtr ccw; CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen); WindowPtr pLayerWin; Bool anyMarked = FALSE; if (pWin == cs->pOverlayWin) { return Success; } if (!pWin->parent) return BadMatch; /* * Only one Manual update is allowed */ if (cw && update == CompositeRedirectManual) for (ccw = cw->clients; ccw; ccw = ccw->next) if (ccw->update == CompositeRedirectManual) return BadAccess; /* * Allocate per-client per-window structure * The client *could* allocate multiple, but while supported, * it is not expected to be common */ ccw = malloc (sizeof (CompClientWindowRec)); if (!ccw) return BadAlloc; ccw->id = FakeClientID (pClient->index); ccw->update = update; /* * Now make sure there's a per-window structure to hang this from */ if (!cw) { cw = malloc (sizeof (CompWindowRec)); if (!cw) { free (ccw); return BadAlloc; } cw->damage = DamageCreate (compReportDamage, compDestroyDamage, DamageReportNonEmpty, FALSE, pWin->drawable.pScreen, pWin); if (!cw->damage) { free (ccw); free (cw); return BadAlloc; } anyMarked = compMarkWindows(pWin, &pLayerWin); RegionNull(&cw->borderClip); cw->update = CompositeRedirectAutomatic; cw->clients = 0; cw->oldx = COMP_ORIGIN_INVALID; cw->oldy = COMP_ORIGIN_INVALID; cw->damageRegistered = FALSE; cw->damaged = FALSE; cw->pOldPixmap = NullPixmap; FAKE_DIX_SET_WINDOW_PRIVATE(pWin, cw); } ccw->next = cw->clients; cw->clients = ccw; if (!AddResource (ccw->id, CompositeClientWindowType, pWin)) return BadAlloc; if (ccw->update == CompositeRedirectManual) { if (!anyMarked) anyMarked = compMarkWindows(pWin, &pLayerWin); if (cw->damageRegistered) { DamageUnregister (&pWin->drawable, cw->damage); cw->damageRegistered = FALSE; } cw->update = CompositeRedirectManual; } else if (cw->update == CompositeRedirectAutomatic && !cw->damageRegistered) { if (!anyMarked) anyMarked = compMarkWindows(pWin, &pLayerWin); } if (!compCheckRedirect (pWin)) { FreeResource (ccw->id, RT_NONE); return BadAlloc; } if (anyMarked) compHandleMarkedWindows(pWin, pLayerWin); return Success; } void compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap) { ScreenPtr pScreen = pWin->drawable.pScreen; WindowPtr pParent = pWin->parent; if (pParent->drawable.depth == pWin->drawable.depth) { GCPtr pGC = GetScratchGC(pWin->drawable.depth, pScreen); int bw = (int) pWin->borderWidth; int x = bw; int y = bw; int w = pWin->drawable.width; int h = pWin->drawable.height; if (pGC) { ChangeGCVal val; val.val = IncludeInferiors; dixChangeGC(NullClient, pGC, GCSubwindowMode, NULL, &val); ValidateGC(&pWin->drawable, pGC); (*pGC->ops->CopyArea) (&pPixmap->drawable, &pWin->drawable, pGC, x, y, w, h, 0, 0); FreeScratchGC(pGC); } } } /* * Free one of the per-client per-window resources, clearing * redirect and the per-window pointer as appropriate */ void compFreeClientWindow (WindowPtr pWin, XID id) { ScreenPtr pScreen = pWin->drawable.pScreen; CompWindowPtr cw = GetCompWindow (pWin); CompClientWindowPtr ccw, *prev; Bool anyMarked = FALSE; WindowPtr pLayerWin; PixmapPtr pPixmap = NULL; if (!cw) return; for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next) { if (ccw->id == id) { *prev = ccw->next; if (ccw->update == CompositeRedirectManual) cw->update = CompositeRedirectAutomatic; free (ccw); break; } } if (!cw->clients) { anyMarked = compMarkWindows(pWin, &pLayerWin); if (pWin->redirectDraw != RedirectDrawNone) { pPixmap = (*pScreen->GetWindowPixmap) (pWin); compSetParentPixmap(pWin); } if (cw->damage) DamageDestroy (cw->damage); RegionUninit(&cw->borderClip); FAKE_DIX_SET_WINDOW_PRIVATE(pWin, NULL); free (cw); } else if (cw->update == CompositeRedirectAutomatic && !cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone) { anyMarked = compMarkWindows(pWin, &pLayerWin); DamageRegister (&pWin->drawable, cw->damage); cw->damageRegistered = TRUE; pWin->redirectDraw = RedirectDrawAutomatic; DamageDamageRegion (&pWin->drawable, &pWin->borderSize); } if (anyMarked) compHandleMarkedWindows(pWin, pLayerWin); if (pPixmap) { compRestoreWindow(pWin, pPixmap); (*pScreen->DestroyPixmap) (pPixmap); } } /* * This is easy, just free the appropriate resource. */ int compUnredirectWindow (ClientPtr pClient, WindowPtr pWin, int update) { CompWindowPtr cw = GetCompWindow (pWin); CompClientWindowPtr ccw; if (!cw) return BadValue; for (ccw = cw->clients; ccw; ccw = ccw->next) if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) { FreeResource (ccw->id, RT_NONE); return Success; } return BadValue; } /* * Redirect all subwindows for one client */ int compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update) { CompSubwindowsPtr csw = GetCompSubwindows (pWin); CompClientWindowPtr ccw; WindowPtr pChild; /* * Only one Manual update is allowed */ if (csw && update == CompositeRedirectManual) for (ccw = csw->clients; ccw; ccw = ccw->next) if (ccw->update == CompositeRedirectManual) return BadAccess; /* * Allocate per-client per-window structure * The client *could* allocate multiple, but while supported, * it is not expected to be common */ ccw = malloc (sizeof (CompClientWindowRec)); if (!ccw) return BadAlloc; ccw->id = FakeClientID (pClient->index); ccw->update = update; /* * Now make sure there's a per-window structure to hang this from */ if (!csw) { csw = malloc (sizeof (CompSubwindowsRec)); if (!csw) { free (ccw); return BadAlloc; } csw->update = CompositeRedirectAutomatic; csw->clients = 0; FAKE_DIX_SET_SUBWINDOWS_PRIVATE(pWin, csw); } /* * Redirect all existing windows */ for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib) { int ret = compRedirectWindow (pClient, pChild, update); if (ret != Success) { for (pChild = pChild->nextSib; pChild; pChild = pChild->nextSib) (void) compUnredirectWindow (pClient, pChild, update); if (!csw->clients) { free (csw); FAKE_DIX_SET_SUBWINDOWS_PRIVATE(pWin, NULL); } free (ccw); return ret; } } /* * Hook into subwindows list */ ccw->next = csw->clients; csw->clients = ccw; if (!AddResource (ccw->id, CompositeClientSubwindowsType, pWin)) return BadAlloc; if (ccw->update == CompositeRedirectManual) { csw->update = CompositeRedirectManual; /* * tell damage extension that damage events for this client are * critical output */ DamageExtSetCritical (pClient, TRUE); } return Success; } /* * Free one of the per-client per-subwindows resources, * which frees one redirect per subwindow */ void compFreeClientSubwindows (WindowPtr pWin, XID id) { CompSubwindowsPtr csw = GetCompSubwindows (pWin); CompClientWindowPtr ccw, *prev; WindowPtr pChild; if (!csw) return; for (prev = &csw->clients; (ccw = *prev); prev = &ccw->next) { if (ccw->id == id) { ClientPtr pClient = clients[CLIENT_ID(id)]; *prev = ccw->next; if (ccw->update == CompositeRedirectManual) { /* * tell damage extension that damage events for this client are * critical output */ DamageExtSetCritical (pClient, FALSE); csw->update = CompositeRedirectAutomatic; if (pWin->mapped) (*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, TRUE); } /* * Unredirect all existing subwindows */ for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib) (void) compUnredirectWindow (pClient, pChild, ccw->update); free (ccw); break; } } /* * Check if all of the per-client records are gone */ if (!csw->clients) { FAKE_DIX_SET_SUBWINDOWS_PRIVATE(pWin, NULL); free (csw); } } /* * This is easy, just free the appropriate resource. */ int compUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update) { CompSubwindowsPtr csw = GetCompSubwindows (pWin); CompClientWindowPtr ccw; if (!csw) return BadValue; for (ccw = csw->clients; ccw; ccw = ccw->next) if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) { FreeResource (ccw->id, RT_NONE); return Success; } return BadValue; } /* * Add redirection information for one subwindow (during reparent) */ int compRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin) { CompSubwindowsPtr csw = GetCompSubwindows (pParent); CompClientWindowPtr ccw; if (!csw) return Success; for (ccw = csw->clients; ccw; ccw = ccw->next) { int ret = compRedirectWindow (clients[CLIENT_ID(ccw->id)], pWin, ccw->update); if (ret != Success) return ret; } return Success; } /* * Remove redirection information for one subwindow (during reparent) */ int compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin) { CompSubwindowsPtr csw = GetCompSubwindows (pParent); CompClientWindowPtr ccw; if (!csw) return Success; for (ccw = csw->clients; ccw; ccw = ccw->next) { int ret = compUnredirectWindow (clients[CLIENT_ID(ccw->id)], pWin, ccw->update); if (ret != Success) return ret; } return Success; } static PixmapPtr compNewPixmap (WindowPtr pWin, int x, int y, int w, int h) { ScreenPtr pScreen = pWin->drawable.pScreen; WindowPtr pParent = pWin->parent; PixmapPtr pPixmap; /* usage_hint unsupported by our old server infrastructure. */ pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth, CREATE_PIXMAP_USAGE_BACKING_PIXMAP); if (!pPixmap) return 0; pPixmap->screen_x = x; pPixmap->screen_y = y; if (pParent->drawable.depth == pWin->drawable.depth) { GCPtr pGC = GetScratchGC (pWin->drawable.depth, pScreen); /* * Copy bits from the parent into the new pixmap so that it will * have "reasonable" contents in case for background None areas. */ if (pGC) { ChangeGCVal val; val.val = IncludeInferiors; dixChangeGC(NullClient, pGC, GCSubwindowMode, NULL, &val); ValidateGC(&pPixmap->drawable, pGC); (*pGC->ops->CopyArea) (&pParent->drawable, &pPixmap->drawable, pGC, x - pParent->drawable.x, y - pParent->drawable.y, w, h, 0, 0); FreeScratchGC (pGC); } } else { PictFormatPtr pSrcFormat = compWindowFormat (pParent); PictFormatPtr pDstFormat = compWindowFormat (pWin); XID inferiors = IncludeInferiors; int error; PicturePtr pSrcPicture = CreatePicture(None, &pParent->drawable, pSrcFormat, CPSubwindowMode, &inferiors, serverClient, &error); PicturePtr pDstPicture = CreatePicture(None, &pPixmap->drawable, pDstFormat, 0, 0, serverClient, &error); if (pSrcPicture && pDstPicture) { CompositePicture(PictOpSrc, pSrcPicture, NULL, pDstPicture, x - pParent->drawable.x, y - pParent->drawable.y, 0, 0, 0, 0, w, h); } if (pSrcPicture) FreePicture(pSrcPicture, 0); if (pDstPicture) FreePicture(pDstPicture, 0); } return pPixmap; } Bool compAllocPixmap (WindowPtr pWin) { int bw = (int) pWin->borderWidth; int x = pWin->drawable.x - bw; int y = pWin->drawable.y - bw; int w = pWin->drawable.width + (bw << 1); int h = pWin->drawable.height + (bw << 1); PixmapPtr pPixmap = compNewPixmap (pWin, x, y, w, h); CompWindowPtr cw = GetCompWindow (pWin); if (!pPixmap) return FALSE; if (cw->update == CompositeRedirectAutomatic) pWin->redirectDraw = RedirectDrawAutomatic; else pWin->redirectDraw = RedirectDrawManual; compSetPixmap (pWin, pPixmap); cw->oldx = COMP_ORIGIN_INVALID; cw->oldy = COMP_ORIGIN_INVALID; cw->damageRegistered = FALSE; if (cw->update == CompositeRedirectAutomatic) { DamageRegister (&pWin->drawable, cw->damage); cw->damageRegistered = TRUE; } /* Make sure our borderClip is up to date */ RegionUninit(&cw->borderClip); RegionCopy(&cw->borderClip, &pWin->borderClip); cw->borderClipX = pWin->drawable.x; cw->borderClipY = pWin->drawable.y; return TRUE; } void compSetParentPixmap (WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; PixmapPtr pParentPixmap; CompWindowPtr cw = GetCompWindow (pWin); if (cw->damageRegistered) { DamageUnregister (&pWin->drawable, cw->damage); cw->damageRegistered = FALSE; DamageEmpty (cw->damage); } /* * Move the parent-constrained border clip region back into * the window so that ValidateTree will handle the unmap * case correctly. Unmap adds the window borderClip to the * parent exposed area; regions beyond the parent cause crashes */ RegionCopy(&pWin->borderClip, &cw->borderClip); pParentPixmap = (*pScreen->GetWindowPixmap) (pWin->parent); pWin->redirectDraw = RedirectDrawNone; compSetPixmap (pWin, pParentPixmap); } /* * Make sure the pixmap is the right size and offset. Allocate a new * pixmap to change size, adjust origin to change offset, leaving the * old pixmap in cw->pOldPixmap so bits can be recovered */ Bool compReallocPixmap (WindowPtr pWin, int draw_x, int draw_y, unsigned int w, unsigned int h, int bw) { ScreenPtr pScreen = pWin->drawable.pScreen; PixmapPtr pOld = (*pScreen->GetWindowPixmap) (pWin); PixmapPtr pNew; CompWindowPtr cw = GetCompWindow (pWin); int pix_x, pix_y; int pix_w, pix_h; assert (cw && pWin->redirectDraw != RedirectDrawNone); cw->oldx = pOld->screen_x; cw->oldy = pOld->screen_y; pix_x = draw_x - bw; pix_y = draw_y - bw; pix_w = w + (bw << 1); pix_h = h + (bw << 1); if (pix_w != pOld->drawable.width || pix_h != pOld->drawable.height) { pNew = compNewPixmap (pWin, pix_x, pix_y, pix_w, pix_h); if (!pNew) return FALSE; cw->pOldPixmap = pOld; compSetPixmap (pWin, pNew); } else { pNew = pOld; cw->pOldPixmap = 0; } pNew->screen_x = pix_x; pNew->screen_y = pix_y; return TRUE; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/composite/compext.c0000644000000000000000000007157413614532331020436 0ustar /* * $Id: compext.c,v 1.5 2005/07/03 07:37:34 daniels Exp $ * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "compint.h" #include "XI.h" #include "XIproto.h" #include "protocol-versions.h" #include "extinit.h" static CARD8 CompositeReqCode; #ifndef NXAGENT_SERVER static DevPrivateKeyRec CompositeClientPrivateKeyRec; #define CompositeClientPrivateKey (&CompositeClientPrivateKeyRec) #else /* !defined(NXAGENT_SERVER) */ static int CompositeClientPrivIndex = -1; #endif /* !defined(NXAGENT_SERVER) */ RESTYPE CompositeClientWindowType; RESTYPE CompositeClientSubwindowsType; RESTYPE CompositeClientOverlayType; typedef struct _CompositeClient { int major_version; int minor_version; } CompositeClientRec, *CompositeClientPtr; #ifndef NXAGENT_SERVER #define GetCompositeClient(pClient) ((CompositeClientPtr) \ dixLookupPrivate(&(pClient)->devPrivates, CompositeClientPrivateKey)) #else /* !defined(NXAGENT_SERVER) */ #define GetCompositeClient(pClient) ((CompositeClientPtr) \ (pClient)->devPrivates[CompositeClientPrivIndex].ptr) #endif /* !edefined(NXAGENT_SERVER) */ static void CompositeClientCallback (CallbackListPtr *list, void *closure, void *data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; CompositeClientPtr pCompositeClient = GetCompositeClient (pClient); pCompositeClient->major_version = 0; pCompositeClient->minor_version = 0; } static void CompositeResetProc (ExtensionEntry *extEntry) { } static int FreeCompositeClientWindow(void *value, XID ccwid) { WindowPtr pWin = value; compFreeClientWindow(pWin, ccwid); return Success; } static int FreeCompositeClientSubwindows(void *value, XID ccwid) { WindowPtr pWin = value; compFreeClientSubwindows(pWin, ccwid); return Success; } static int FreeCompositeClientOverlay(void *value, XID ccwid) { CompOverlayClientPtr pOc = (CompOverlayClientPtr) value; compFreeOverlayClient(pOc); return Success; } static int ProcCompositeQueryVersion (ClientPtr client) { CompositeClientPtr pCompositeClient = GetCompositeClient (client); xCompositeQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; REQUEST(xCompositeQueryVersionReq); REQUEST_SIZE_MATCH(xCompositeQueryVersionReq); if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR_VERSION) { rep.majorVersion = stuff->majorVersion; rep.minorVersion = stuff->minorVersion; } else { rep.majorVersion = SERVER_COMPOSITE_MAJOR_VERSION; rep.minorVersion = SERVER_COMPOSITE_MINOR_VERSION; } pCompositeClient->major_version = rep.majorVersion; pCompositeClient->minor_version = rep.minorVersion; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.majorVersion); swapl(&rep.minorVersion); } WriteToClient(client, sizeof(xCompositeQueryVersionReply), &rep); return Success; } /* Unsupported by current architecture and porting is too much effort. */ #if 0 #define VERIFY_WINDOW(pWindow, wid, client, mode) \ do { \ int err; \ err = dixLookupResourceByType((void **) &pWindow, wid, \ RT_WINDOW, client, mode); \ if (err != Success) { \ client->errorValue = wid; \ return err; \ } \ } while (0) #endif /* 0 */ static int ProcCompositeRedirectWindow (ClientPtr client) { WindowPtr pWin; REQUEST(xCompositeRedirectWindowReq); REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq); /* Unsupported by current architecture and porting is too much effort. */ /* VERIFY_WINDOW(pWin, stuff->window, client, DixSetAttrAccess | DixManageAccess | DixBlendAccess); */ pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); if (!pWin) { client->errorValue = stuff->window; return BadWindow; } return compRedirectWindow (client, pWin, stuff->update); } static int ProcCompositeRedirectSubwindows (ClientPtr client) { WindowPtr pWin; REQUEST(xCompositeRedirectSubwindowsReq); REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq); /* Unsupported by current architecture and porting is too much effort. */ /* VERIFY_WINDOW(pWin, stuff->window, client, DixSetAttrAccess | DixManageAccess | DixBlendAccess); */ pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); if (!pWin) { client->errorValue = stuff->window; return BadWindow; } return compRedirectSubwindows (client, pWin, stuff->update); } static int ProcCompositeUnredirectWindow (ClientPtr client) { WindowPtr pWin; REQUEST(xCompositeUnredirectWindowReq); REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq); /* Unsupported by current architecture and porting is too much effort. */ /* VERIFY_WINDOW(pWin, stuff->window, client, DixSetAttrAccess | DixManageAccess | DixBlendAccess); */ pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); if (!pWin) { client->errorValue = stuff->window; return BadWindow; } return compUnredirectWindow (client, pWin, stuff->update); } static int ProcCompositeUnredirectSubwindows (ClientPtr client) { WindowPtr pWin; REQUEST(xCompositeUnredirectSubwindowsReq); REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq); /* Unsupported by current architecture and porting is too much effort. */ /* VERIFY_WINDOW(pWin, stuff->window, client, DixSetAttrAccess | DixManageAccess | DixBlendAccess); */ pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); if (!pWin) { client->errorValue = stuff->window; return BadWindow; } return compUnredirectSubwindows (client, pWin, stuff->update); } static int ProcCompositeCreateRegionFromBorderClip (ClientPtr client) { WindowPtr pWin; CompWindowPtr cw; RegionPtr pBorderClip, pRegion; REQUEST(xCompositeCreateRegionFromBorderClipReq); REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq); /* Unsupported by current architecture and porting is too much effort. */ /* VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess); */ pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); if (!pWin) { client->errorValue = stuff->window; return BadWindow; } LEGAL_NEW_RESOURCE (stuff->region, client); cw = GetCompWindow (pWin); if (cw) pBorderClip = &cw->borderClip; else pBorderClip = &pWin->borderClip; pRegion = XFixesRegionCopy (pBorderClip); if (!pRegion) return BadAlloc; RegionTranslate(pRegion, -pWin->drawable.x, -pWin->drawable.y); if (!AddResource (stuff->region, RegionResType, (void *) pRegion)) return BadAlloc; return Success; } static int ProcCompositeNameWindowPixmap (ClientPtr client) { WindowPtr pWin; CompWindowPtr cw; PixmapPtr pPixmap; ScreenPtr pScreen; int rc; REQUEST(xCompositeNameWindowPixmapReq); REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq); /* Unsupported by current architecture and porting is too much effort. */ /* VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess); */ pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); if (!pWin) { client->errorValue = stuff->window; return BadWindow; } pScreen = pWin->drawable.pScreen; if (!pWin->viewable) return BadMatch; LEGAL_NEW_RESOURCE (stuff->pixmap, client); cw = GetCompWindow (pWin); if (!cw) return BadMatch; pPixmap = (*pScreen->GetWindowPixmap) (pWin); if (!pPixmap) return BadMatch; /* security creation/labeling check */ /* rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP, pPixmap, RT_WINDOW, pWin, DixCreateAccess); */ rc = Success; if (rc != Success) return rc; ++pPixmap->refcnt; if (!AddResource (stuff->pixmap, RT_PIXMAP, (void *) pPixmap)) return BadAlloc; /* Unsupported by current architecture. */ /* if (pScreen->NameWindowPixmap) { rc = pScreen->NameWindowPixmap(pWin, pPixmap, stuff->pixmap); if (rc != Success) { FreeResource(stuff->pixmap, RT_NONE); return rc; } } */ return Success; } static int ProcCompositeGetOverlayWindow(ClientPtr client) { REQUEST(xCompositeGetOverlayWindowReq); xCompositeGetOverlayWindowReply rep; WindowPtr pWin; ScreenPtr pScreen; CompScreenPtr cs; CompOverlayClientPtr pOc; int rc; REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq); /* Unsupported by current architecture and porting is too much effort. */ /* VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess); */ pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); if (!pWin) { client->errorValue = stuff->window; return BadWindow; } pScreen = pWin->drawable.pScreen; /* * Create an OverlayClient structure to mark this client's * interest in the overlay window */ pOc = compCreateOverlayClient(pScreen, client); if (pOc == NULL) return BadAlloc; /* * Make sure the overlay window exists */ cs = GetCompScreen(pScreen); if (cs->pOverlayWin == NULL) if (!compCreateOverlayWindow(pScreen)) { FreeResource(pOc->resource, RT_NONE); return BadAlloc; } /* rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id, RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess); */ rc = Success; if (rc != Success) { FreeResource(pOc->resource, RT_NONE); return rc; } rep = (xCompositeGetOverlayWindowReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .overlayWin = cs->pOverlayWin->drawable.id }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.overlayWin); } WriteToClient(client, sz_xCompositeGetOverlayWindowReply, &rep); return Success; } static int ProcCompositeReleaseOverlayWindow(ClientPtr client) { REQUEST(xCompositeReleaseOverlayWindowReq); WindowPtr pWin; CompOverlayClientPtr pOc; REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq); /* Unsupported by current architecture and porting is too much effort. */ /* VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess); */ pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); if (!pWin) { client->errorValue = stuff->window; return BadWindow; } /* * Has client queried a reference to the overlay window * on this screen? If not, generate an error. */ pOc = compFindOverlayClient(pWin->drawable.pScreen, client); if (pOc == NULL) return BadMatch; /* The delete function will free the client structure */ FreeResource(pOc->resource, RT_NONE); return Success; } static int (*ProcCompositeVector[CompositeNumberRequests])(ClientPtr) = { ProcCompositeQueryVersion, ProcCompositeRedirectWindow, ProcCompositeRedirectSubwindows, ProcCompositeUnredirectWindow, ProcCompositeUnredirectSubwindows, ProcCompositeCreateRegionFromBorderClip, ProcCompositeNameWindowPixmap, ProcCompositeGetOverlayWindow, ProcCompositeReleaseOverlayWindow, }; static int ProcCompositeDispatch (ClientPtr client) { REQUEST(xReq); if (stuff->data < CompositeNumberRequests) return (*ProcCompositeVector[stuff->data]) (client); else return BadRequest; } static int SProcCompositeQueryVersion (ClientPtr client) { REQUEST(xCompositeQueryVersionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCompositeQueryVersionReq); swapl(&stuff->majorVersion); swapl(&stuff->minorVersion); return (*ProcCompositeVector[stuff->compositeReqType]) (client); } static int SProcCompositeRedirectWindow (ClientPtr client) { REQUEST(xCompositeRedirectWindowReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq); swapl (&stuff->window); return (*ProcCompositeVector[stuff->compositeReqType]) (client); } static int SProcCompositeRedirectSubwindows (ClientPtr client) { REQUEST(xCompositeRedirectSubwindowsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq); swapl (&stuff->window); return (*ProcCompositeVector[stuff->compositeReqType]) (client); } static int SProcCompositeUnredirectWindow (ClientPtr client) { REQUEST(xCompositeUnredirectWindowReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq); swapl (&stuff->window); return (*ProcCompositeVector[stuff->compositeReqType]) (client); } static int SProcCompositeUnredirectSubwindows (ClientPtr client) { REQUEST(xCompositeUnredirectSubwindowsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq); swapl (&stuff->window); return (*ProcCompositeVector[stuff->compositeReqType]) (client); } static int SProcCompositeCreateRegionFromBorderClip (ClientPtr client) { REQUEST(xCompositeCreateRegionFromBorderClipReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq); swapl (&stuff->region); swapl (&stuff->window); return (*ProcCompositeVector[stuff->compositeReqType]) (client); } static int SProcCompositeNameWindowPixmap (ClientPtr client) { REQUEST(xCompositeNameWindowPixmapReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq); swapl (&stuff->window); swapl (&stuff->pixmap); return (*ProcCompositeVector[stuff->compositeReqType]) (client); } static int SProcCompositeGetOverlayWindow(ClientPtr client) { REQUEST(xCompositeGetOverlayWindowReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq); swapl(&stuff->window); return (*ProcCompositeVector[stuff->compositeReqType]) (client); } static int SProcCompositeReleaseOverlayWindow(ClientPtr client) { REQUEST(xCompositeReleaseOverlayWindowReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq); swapl(&stuff->window); return (*ProcCompositeVector[stuff->compositeReqType]) (client); } static int (*SProcCompositeVector[CompositeNumberRequests])(ClientPtr) = { SProcCompositeQueryVersion, SProcCompositeRedirectWindow, SProcCompositeRedirectSubwindows, SProcCompositeUnredirectWindow, SProcCompositeUnredirectSubwindows, SProcCompositeCreateRegionFromBorderClip, SProcCompositeNameWindowPixmap, SProcCompositeGetOverlayWindow, SProcCompositeReleaseOverlayWindow, }; static int SProcCompositeDispatch (ClientPtr client) { REQUEST(xReq); if (stuff->data < CompositeNumberRequests) return (*SProcCompositeVector[stuff->data]) (client); else return BadRequest; } /* Both unused and incompatible due to architecture, disabled. */ #if 0 /** @see GetDefaultBytes */ static void GetCompositeClientWindowBytes(void *value, XID id, ResourceSizePtr size) { WindowPtr window = value; /* Currently only pixmap bytes are reported to clients. */ size->resourceSize = 0; /* Calculate pixmap reference sizes. */ size->pixmapRefSize = 0; if (window->redirectDraw != RedirectDrawNone) { SizeType pixmapSizeFunc = GetResourceTypeSizeFunc(RT_PIXMAP); ResourceSizeRec pixmapSize = { 0, 0 }; ScreenPtr screen = window->drawable.pScreen; PixmapPtr pixmap = screen->GetWindowPixmap(window); pixmapSizeFunc(pixmap, pixmap->drawable.id, &pixmapSize); size->pixmapRefSize += pixmapSize.pixmapRefSize; } } #endif /* 0 */ void CompositeExtensionInit (void) { ExtensionEntry *extEntry; int s; /* Assume initialization is going to fail */ noCompositeExtension = TRUE; fprintf(stderr, "COMPOSITE: trying to initialize extension.\n"); for (s = 0; s < screenInfo.numScreens; s++) { ScreenPtr pScreen = screenInfo.screens[s]; VisualPtr vis; /* Composite on 8bpp pseudocolor root windows appears to fail, so * just disable it on anything pseudocolor for safety. */ for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++); if ((vis->class | DynamicClass) == PseudoColor) return; /* Ensure that Render is initialized, which is required for automatic * compositing. */ if (GetPictureScreenIfSet(pScreen) == NULL) return; } #ifdef PANORAMIX /* Xinerama's rewriting of window drawing before Composite gets to it * breaks Composite. */ if (!noPanoramiXExtension) return; #endif CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow); if (!CompositeClientWindowType) return; /* SetResourceTypeSizeFunc(CompositeClientWindowType, GetCompositeClientWindowBytes); */ CompositeClientSubwindowsType = CreateNewResourceType (FreeCompositeClientSubwindows); if (!CompositeClientSubwindowsType) return; CompositeClientOverlayType = CreateNewResourceType (FreeCompositeClientOverlay); if (!CompositeClientOverlayType) return; #ifndef NXAGENT_SERVER if (!dixRegisterPrivateKey(&CompositeClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (CompositeClientRec))) return; #else /* !defined(NXAGENT_SERVER) */ if ((CompositeClientPrivIndex = AllocateClientPrivateIndex()) < 0) return; if (!AllocateClientPrivate(CompositeClientPrivIndex, sizeof (CompositeClientRec))) return; #endif /* !defined(NXAGENT_SERVER) */ if (!AddCallback (&ClientStateCallback, CompositeClientCallback, 0)) return; for (s = 0; s < screenInfo.numScreens; s++) if (!compScreenInit (screenInfo.screens[s])) { fprintf (stderr, "COMPOSITE: could not initialize via compScreenInit() for screen %d\n", s); return; } extEntry = AddExtension (COMPOSITE_NAME, 0, 0, ProcCompositeDispatch, SProcCompositeDispatch, CompositeResetProc, StandardMinorOpcode); if (!extEntry) return; CompositeReqCode = (CARD8) extEntry->base; /* Initialization succeeded */ noCompositeExtension = FALSE; } /* * This code requires features the current infrastructure does not provide * and will thus be disabled. */ #if 0 #ifdef PANORAMIX #include "panoramiXsrv.h" int (*PanoramiXSaveCompositeVector[CompositeNumberRequests]) (ClientPtr); static int PanoramiXCompositeRedirectWindow(ClientPtr client) { PanoramiXRes *win; int rc = 0, j; REQUEST(xCompositeRedirectWindowReq); REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq); if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixUnknownAccess))) { client->errorValue = stuff->window; return rc; } FOR_NSCREENS_FORWARD(j) { stuff->window = win->info[j].id; rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client); if (rc != Success) break; } return rc; } static int PanoramiXCompositeRedirectSubwindows(ClientPtr client) { PanoramiXRes *win; int rc = 0, j; REQUEST(xCompositeRedirectSubwindowsReq); REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq); if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixUnknownAccess))) { client->errorValue = stuff->window; return rc; } FOR_NSCREENS_FORWARD(j) { stuff->window = win->info[j].id; rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client); if (rc != Success) break; } return rc; } static int PanoramiXCompositeUnredirectWindow(ClientPtr client) { PanoramiXRes *win; int rc = 0, j; REQUEST(xCompositeUnredirectWindowReq); REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq); if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixUnknownAccess))) { client->errorValue = stuff->window; return rc; } FOR_NSCREENS_FORWARD(j) { stuff->window = win->info[j].id; rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client); if (rc != Success) break; } return rc; } static int PanoramiXCompositeUnredirectSubwindows(ClientPtr client) { PanoramiXRes *win; int rc = 0, j; REQUEST(xCompositeUnredirectSubwindowsReq); REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq); if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixUnknownAccess))) { client->errorValue = stuff->window; return rc; } FOR_NSCREENS_FORWARD(j) { stuff->window = win->info[j].id; rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client); if (rc != Success) break; } return rc; } static int PanoramiXCompositeNameWindowPixmap(ClientPtr client) { WindowPtr pWin; CompWindowPtr cw; PixmapPtr pPixmap; int rc; PanoramiXRes *win, *newPix; int i; REQUEST(xCompositeNameWindowPixmapReq); REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq); if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixUnknownAccess))) { client->errorValue = stuff->window; return rc; } LEGAL_NEW_RESOURCE(stuff->pixmap, client); if (!(newPix = malloc(sizeof(PanoramiXRes)))) return BadAlloc; newPix->type = XRT_PIXMAP; newPix->u.pix.shared = FALSE; panoramix_setup_ids(newPix, client, stuff->pixmap); FOR_NSCREENS(i) { rc = dixLookupResourceByType((void **) &pWin, win->info[i].id, RT_WINDOW, client, DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->window; free(newPix); return rc; } if (!pWin->viewable) { free(newPix); return BadMatch; } cw = GetCompWindow(pWin); if (!cw) { free(newPix); return BadMatch; } pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin); if (!pPixmap) { free(newPix); return BadMatch; } if (!AddResource(newPix->info[i].id, RT_PIXMAP, (void *) pPixmap)) return BadAlloc; ++pPixmap->refcnt; } if (!AddResource(stuff->pixmap, XRT_PIXMAP, (void *) newPix)) return BadAlloc; return Success; } static int PanoramiXCompositeGetOverlayWindow(ClientPtr client) { REQUEST(xCompositeGetOverlayWindowReq); xCompositeGetOverlayWindowReply rep; WindowPtr pWin; ScreenPtr pScreen; CompScreenPtr cs; CompOverlayClientPtr pOc; int rc; PanoramiXRes *win, *overlayWin = NULL; int i; REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq); if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixUnknownAccess))) { client->errorValue = stuff->window; return rc; } cs = GetCompScreen(screenInfo.screens[0]); if (!cs->pOverlayWin) { if (!(overlayWin = malloc(sizeof(PanoramiXRes)))) return BadAlloc; overlayWin->type = XRT_WINDOW; overlayWin->u.win.root = FALSE; } FOR_NSCREENS_BACKWARD(i) { rc = dixLookupResourceByType((void **) &pWin, win->info[i].id, RT_WINDOW, client, DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->window; free(overlayWin); return rc; } pScreen = pWin->drawable.pScreen; /* * Create an OverlayClient structure to mark this client's * interest in the overlay window */ pOc = compCreateOverlayClient(pScreen, client); if (pOc == NULL) { free(overlayWin); return BadAlloc; } /* * Make sure the overlay window exists */ cs = GetCompScreen(pScreen); if (cs->pOverlayWin == NULL) if (!compCreateOverlayWindow(pScreen)) { FreeResource(pOc->resource, RT_NONE); free(overlayWin); return BadAlloc; } /* rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id, RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess); */ rc = Success; if (rc != Success) { FreeResource(pOc->resource, RT_NONE); free(overlayWin); return rc; } } if (overlayWin) { FOR_NSCREENS(i) { cs = GetCompScreen(screenInfo.screens[i]); overlayWin->info[i].id = cs->pOverlayWin->drawable.id; } AddResource(overlayWin->info[0].id, XRT_WINDOW, overlayWin); } cs = GetCompScreen(screenInfo.screens[0]); rep = (xCompositeGetOverlayWindowReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .overlayWin = cs->pOverlayWin->drawable.id }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.overlayWin); } WriteToClient(client, sz_xCompositeGetOverlayWindowReply, &rep); return Success; } static int PanoramiXCompositeReleaseOverlayWindow(ClientPtr client) { REQUEST(xCompositeReleaseOverlayWindowReq); WindowPtr pWin; CompOverlayClientPtr pOc; PanoramiXRes *win; int i, rc; REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq); if ((rc = dixLookupResourceByType((void **) &win, stuff->window, XRT_WINDOW, client, DixUnknownAccess))) { client->errorValue = stuff->window; return rc; } FOR_NSCREENS_BACKWARD(i) { if ((rc = dixLookupResourceByType((void **) &pWin, win->info[i].id, XRT_WINDOW, client, DixUnknownAccess))) { client->errorValue = stuff->window; return rc; } /* * Has client queried a reference to the overlay window * on this screen? If not, generate an error. */ pOc = compFindOverlayClient(pWin->drawable.pScreen, client); if (pOc == NULL) return BadMatch; /* The delete function will free the client structure */ FreeResource(pOc->resource, RT_NONE); } return Success; } void PanoramiXCompositeInit(void) { int i; for (i = 0; i < CompositeNumberRequests; i++) PanoramiXSaveCompositeVector[i] = ProcCompositeVector[i]; /* * Stuff in Xinerama aware request processing hooks */ ProcCompositeVector[X_CompositeRedirectWindow] = PanoramiXCompositeRedirectWindow; ProcCompositeVector[X_CompositeRedirectSubwindows] = PanoramiXCompositeRedirectSubwindows; ProcCompositeVector[X_CompositeUnredirectWindow] = PanoramiXCompositeUnredirectWindow; ProcCompositeVector[X_CompositeUnredirectSubwindows] = PanoramiXCompositeUnredirectSubwindows; ProcCompositeVector[X_CompositeNameWindowPixmap] = PanoramiXCompositeNameWindowPixmap; ProcCompositeVector[X_CompositeGetOverlayWindow] = PanoramiXCompositeGetOverlayWindow; ProcCompositeVector[X_CompositeReleaseOverlayWindow] = PanoramiXCompositeReleaseOverlayWindow; } void PanoramiXCompositeReset(void) { int i; for (i = 0; i < CompositeNumberRequests; i++) ProcCompositeVector[i] = PanoramiXSaveCompositeVector[i]; } #endif #endif /* 0 */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/composite/compinit.c0000644000000000000000000003533313614532331020572 0ustar /* * $Id: compinit.c,v 1.9 2005/07/03 07:37:34 daniels Exp $ * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "compint.h" #include "compositeext.h" #ifndef NXAGENT_SERVER DevPrivateKeyRec CompScreenPrivateKeyRec; DevPrivateKeyRec CompWindowPrivateKeyRec; DevPrivateKeyRec CompSubwindowsPrivateKeyRec; #else /* !defined(NXAGENT_SERVER) */ int CompScreenPrivIndex = -1; int CompWindowPrivIndex = -1; int CompSubwindowsPrivIndex = -1; #endif static Bool compCloseScreen (ScreenPtr pScreen) { CompScreenPtr cs = GetCompScreen (pScreen); Bool ret; free(cs->alternateVisuals); pScreen->CloseScreen = cs->CloseScreen; pScreen->InstallColormap = cs->InstallColormap; pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes; pScreen->ReparentWindow = cs->ReparentWindow; /* * Unsupported by our old Xserver infrastructure, replaced with direct calls to * compReallocPixmap(). */ /* pScreen->ConfigNotify = cs->ConfigNotify; */ pScreen->MoveWindow = cs->MoveWindow; pScreen->ResizeWindow = cs->ResizeWindow; pScreen->ChangeBorderWidth = cs->ChangeBorderWidth; pScreen->ClipNotify = cs->ClipNotify; pScreen->UnrealizeWindow = cs->UnrealizeWindow; pScreen->RealizeWindow = cs->RealizeWindow; pScreen->DestroyWindow = cs->DestroyWindow; pScreen->CreateWindow = cs->CreateWindow; pScreen->CopyWindow = cs->CopyWindow; pScreen->PositionWindow = cs->PositionWindow; pScreen->GetImage = cs->GetImage; pScreen->GetSpans = cs->GetSpans; pScreen->SourceValidate = cs->SourceValidate; free (cs); FAKE_DIX_SET_SCREEN_PRIVATE(pScreen, NULL); ret = (*pScreen->CloseScreen) (pScreen); return ret; } static void compInstallColormap (ColormapPtr pColormap) { VisualPtr pVisual = pColormap->pVisual; ScreenPtr pScreen = pColormap->pScreen; CompScreenPtr cs = GetCompScreen (pScreen); int a; for (a = 0; a < cs->numAlternateVisuals; a++) if (pVisual->vid == cs->alternateVisuals[a]) return; pScreen->InstallColormap = cs->InstallColormap; (*pScreen->InstallColormap) (pColormap); cs->InstallColormap = pScreen->InstallColormap; pScreen->InstallColormap = compInstallColormap; } /* Unsupported by current architecture, drop for now. */ #if 0 static void compCheckBackingStore(WindowPtr pWin) { if (pWin->backingStore != NotUseful && !pWin->backStorage) { compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic); pWin->backStorage = TRUE; } else if (pWin->backingStore == NotUseful && pWin->backStorage) { compUnredirectWindow(serverClient, pWin, CompositeRedirectAutomatic); pWin->backStorage = FALSE; } } /* Fake backing store via automatic redirection */ static Bool compChangeWindowAttributes(WindowPtr pWin, unsigned long mask) { ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen(pScreen); Bool ret; pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes; ret = pScreen->ChangeWindowAttributes(pWin, mask); if (ret && (mask & CWBackingStore) && pScreen->backingStoreSupport != NotUseful) compCheckBackingStore(pWin); pScreen->ChangeWindowAttributes = compChangeWindowAttributes; return ret; } #endif /* 0 */ static void compGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planemask, char *pdstLine) { ScreenPtr pScreen = pDrawable->pScreen; CompScreenPtr cs = GetCompScreen(pScreen); pScreen->GetImage = cs->GetImage; if (pDrawable->type == DRAWABLE_WINDOW) compPaintChildrenToWindow(pScreen, (WindowPtr) pDrawable); (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); cs->GetImage = pScreen->GetImage; pScreen->GetImage = compGetImage; } static void compGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart) { ScreenPtr pScreen = pDrawable->pScreen; CompScreenPtr cs = GetCompScreen(pScreen); pScreen->GetSpans = cs->GetSpans; if (pDrawable->type == DRAWABLE_WINDOW) compPaintChildrenToWindow(pScreen, (WindowPtr) pDrawable); (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); cs->GetSpans = pScreen->GetSpans; pScreen->GetSpans = compGetSpans; } static void compSourceValidate(DrawablePtr pDrawable, int x, int y, int width, int height /* , unsigned int subWindowMode */ /* unsupported */) { ScreenPtr pScreen = pDrawable->pScreen; CompScreenPtr cs = GetCompScreen(pScreen); pScreen->SourceValidate = cs->SourceValidate; if (pDrawable->type == DRAWABLE_WINDOW /* && subWindowMode == IncludeInferiors */ /* unsupported */) compPaintChildrenToWindow(pScreen, (WindowPtr) pDrawable); if (pScreen->SourceValidate) (*pScreen->SourceValidate) (pDrawable, x, y, width, height /*, subWindowMode */ /* unsupported */); cs->SourceValidate = pScreen->SourceValidate; pScreen->SourceValidate = compSourceValidate; } /* * Add alternate visuals -- always expose an ARGB32 and RGB24 visual */ static DepthPtr compFindVisuallessDepth (ScreenPtr pScreen, int d) { int i; for (i = 0; i < pScreen->numDepths; i++) { DepthPtr depth = &pScreen->allowedDepths[i]; if (depth->depth == d) { /* * Make sure it doesn't have visuals already */ if (depth->numVids) return 0; /* * looks fine */ return depth; } } /* * If there isn't one, then it's gonna be hard to have * an associated visual */ return 0; } /* * Add a list of visual IDs to the list of visuals to implicitly redirect. */ static Bool compRegisterAlternateVisuals(CompScreenPtr cs, VisualID * vids, int nVisuals) { VisualID *p; p = reallocarray(cs->alternateVisuals, cs->numAlternateVisuals + nVisuals, sizeof(VisualID)); if (p == NULL) return FALSE; memcpy(&p[cs->numAlternateVisuals], vids, sizeof(VisualID) * nVisuals); cs->alternateVisuals = p; cs->numAlternateVisuals += nVisuals; return TRUE; } Bool CompositeRegisterAlternateVisuals(ScreenPtr pScreen, VisualID * vids, int nVisuals) { CompScreenPtr cs = GetCompScreen(pScreen); return compRegisterAlternateVisuals(cs, vids, nVisuals); } Bool CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen, VisualID parentVisual, VisualID winVisual) { CompScreenPtr cs = GetCompScreen(pScreen); CompImplicitRedirectException *p; p = reallocarray(cs->implicitRedirectExceptions, cs->numImplicitRedirectExceptions + 1, sizeof(p[0])); if (p == NULL) return FALSE; p[cs->numImplicitRedirectExceptions].parentVisual = parentVisual; p[cs->numImplicitRedirectExceptions].winVisual = winVisual; cs->implicitRedirectExceptions = p; cs->numImplicitRedirectExceptions++; return TRUE; } typedef struct _alternateVisual { int depth; CARD32 format; } CompAlternateVisual; static CompAlternateVisual altVisuals[] = { #if COMP_INCLUDE_RGB24_VISUAL { 24, PICT_r8g8b8 }, #endif { 32, PICT_a8r8g8b8 }, }; static const int NUM_COMP_ALTERNATE_VISUALS = sizeof(altVisuals) / sizeof(CompAlternateVisual); static Bool compAddAlternateVisual (ScreenPtr pScreen, CompScreenPtr cs, CompAlternateVisual * alt) { VisualPtr visual; DepthPtr depth; PictFormatPtr pPictFormat; unsigned long alphaMask; /* * The ARGB32 visual is always available. Other alternate depth visuals * are only provided if their depth is less than the root window depth. * There's no deep reason for this. */ if (alt->depth >= pScreen->rootDepth && alt->depth != 32) return FALSE; depth = compFindVisuallessDepth(pScreen, alt->depth); if (!depth) /* alt->depth doesn't exist or already has alternate visuals. */ return TRUE; pPictFormat = PictureMatchFormat(pScreen, alt->depth, alt->format); if (!pPictFormat) return FALSE; if (ResizeVisualArray(pScreen, 1, depth) == FALSE) { return FALSE; } visual = pScreen->visuals + (pScreen->numVisuals - 1); /* the new one */ /* Initialize the visual */ visual->bitsPerRGBValue = 8; if (PICT_FORMAT_TYPE(alt->format) == PICT_TYPE_COLOR) { visual->class = PseudoColor; visual->nplanes = PICT_FORMAT_BPP(alt->format); visual->ColormapEntries = 1 << visual->nplanes; } else { DirectFormatRec *direct = &pPictFormat->direct; visual->class = TrueColor; visual->redMask = ((unsigned long) direct->redMask) << direct->red; visual->greenMask = ((unsigned long) direct->greenMask) << direct->green; visual->blueMask = ((unsigned long) direct->blueMask) << direct->blue; alphaMask = ((unsigned long) direct->alphaMask) << direct->alpha; visual->offsetRed = direct->red; visual->offsetGreen = direct->green; visual->offsetBlue = direct->blue; /* * Include A bits in this (unlike GLX which includes only RGB) * This lets DIX compute suitable masks for colormap allocations */ visual->nplanes = Ones(visual->redMask | visual->greenMask | visual->blueMask | alphaMask); /* find widest component */ visual->ColormapEntries = (1 << max(Ones(visual->redMask), max(Ones(visual->greenMask), Ones(visual->blueMask)))); } /* remember the visual ID to detect auto-update windows */ compRegisterAlternateVisuals(cs, &visual->vid, 1); return TRUE; } static Bool compAddAlternateVisuals(ScreenPtr pScreen, CompScreenPtr cs) { int alt, ret = 0; for (alt = 0; alt < NUM_COMP_ALTERNATE_VISUALS; alt++) ret |= compAddAlternateVisual(pScreen, cs, altVisuals + alt); return ! !ret; } Bool compScreenInit (ScreenPtr pScreen) { CompScreenPtr cs; #ifndef NXAGENT_SERVER if (!dixRegisterPrivateKey(&CompScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) return FALSE; if (!dixRegisterPrivateKey(&CompWindowPrivateKeyRec, PRIVATE_WINDOW, 0)) return FALSE; if (!dixRegisterPrivateKey(&CompSubwindowsPrivateKeyRec, PRIVATE_WINDOW, 0)) return FALSE; #else /* !defined(NXAGENT_SERVER) */ if ((CompScreenPrivIndex = AllocateScreenPrivateIndex()) < 0) return FALSE; if ((CompWindowPrivIndex = AllocateWindowPrivateIndex()) < 0) return FALSE; if ((CompSubwindowsPrivIndex = AllocateWindowPrivateIndex()) < 0) return FALSE; if (!AllocateWindowPrivate (pScreen, CompWindowPrivIndex, 0)) return FALSE; if (!AllocateWindowPrivate (pScreen, CompSubwindowsPrivIndex, 0)) return FALSE; #endif if (GetCompScreen (pScreen)) return TRUE; cs = (CompScreenPtr) malloc (sizeof (CompScreenRec)); if (!cs) return FALSE; cs->damaged = FALSE; cs->overlayWid = FakeClientID(0); cs->pOverlayWin = NULL; cs->pOverlayClients = NULL; cs->numAlternateVisuals = 0; cs->alternateVisuals = NULL; cs->numImplicitRedirectExceptions = 0; cs->implicitRedirectExceptions = NULL; if (!compAddAlternateVisuals (pScreen, cs)) { free (cs); return FALSE; } if (!disableBackingStore) pScreen->backingStoreSupport = WhenMapped; cs->PositionWindow = pScreen->PositionWindow; pScreen->PositionWindow = compPositionWindow; cs->CopyWindow = pScreen->CopyWindow; pScreen->CopyWindow = compCopyWindow; cs->CreateWindow = pScreen->CreateWindow; pScreen->CreateWindow = compCreateWindow; cs->DestroyWindow = pScreen->DestroyWindow; pScreen->DestroyWindow = compDestroyWindow; cs->RealizeWindow = pScreen->RealizeWindow; pScreen->RealizeWindow = compRealizeWindow; cs->UnrealizeWindow = pScreen->UnrealizeWindow; pScreen->UnrealizeWindow = compUnrealizeWindow; cs->ClipNotify = pScreen->ClipNotify; pScreen->ClipNotify = compClipNotify; /* * Unsupported by our old Xserver infrastructure, replaced with direct calls to * compReallocPixmap(). */ /* cs->ConfigNotify = pScreen->ConfigNotify; pScreen->ConfigNotify = compConfigNotify; */ cs->MoveWindow = pScreen->MoveWindow; pScreen->MoveWindow = compMoveWindow; cs->ResizeWindow = pScreen->ResizeWindow; pScreen->ResizeWindow = compResizeWindow; cs->ChangeBorderWidth = pScreen->ChangeBorderWidth; pScreen->ChangeBorderWidth = compChangeBorderWidth; cs->ReparentWindow = pScreen->ReparentWindow; pScreen->ReparentWindow = compReparentWindow; cs->InstallColormap = pScreen->InstallColormap; pScreen->InstallColormap = compInstallColormap; /* Unsupported by our current architecture, drop for now. */ /* cs->ChangeWindowAttributes = pScreen->ChangeWindowAttributes; pScreen->ChangeWindowAttributes = compChangeWindowAttributes; */ cs->BlockHandler = NULL; cs->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = compCloseScreen; cs->GetImage = pScreen->GetImage; pScreen->GetImage = compGetImage; cs->GetSpans = pScreen->GetSpans; pScreen->GetSpans = compGetSpans; cs->SourceValidate = pScreen->SourceValidate; pScreen->SourceValidate = compSourceValidate; FAKE_DIX_SET_SCREEN_PRIVATE(pScreen, cs); RegisterRealChildHeadProc(CompositeRealChildHead); return TRUE; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/composite/compint.h0000644000000000000000000002315413614532331020424 0ustar /* * $Id: compint.h,v 1.8 2005/07/03 08:53:37 daniels Exp $ * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _COMPINT_H_ #define _COMPINT_H_ #include "misc.h" #include "scrnintstr.h" #include "os.h" #include "regionstr.h" #include "validate.h" #include "windowstr.h" #include "input.h" #include "resource.h" #include "colormapst.h" #include "cursorstr.h" #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" #include "dixevents.h" #include "globals.h" #include "picturestr.h" #include "extnsionst.h" #include "mi.h" #include "damage.h" #include "damageextint.h" #include "xfixes.h" #include #include "compositeext.h" #include /* * enable this for debugging #define COMPOSITE_DEBUG */ typedef struct _CompClientWindow { struct _CompClientWindow *next; XID id; int update; } CompClientWindowRec, *CompClientWindowPtr; typedef struct _CompWindow { RegionRec borderClip; DamagePtr damage; /* for automatic update mode */ Bool damageRegistered; Bool damaged; int update; CompClientWindowPtr clients; int oldx; int oldy; PixmapPtr pOldPixmap; int borderClipX, borderClipY; } CompWindowRec, *CompWindowPtr; #define COMP_ORIGIN_INVALID 0x80000000 typedef struct _CompSubwindows { int update; CompClientWindowPtr clients; } CompSubwindowsRec, *CompSubwindowsPtr; #ifndef COMP_INCLUDE_RGB24_VISUAL #define COMP_INCLUDE_RGB24_VISUAL 0 #endif typedef struct _CompOverlayClientRec *CompOverlayClientPtr; typedef struct _CompOverlayClientRec { CompOverlayClientPtr pNext; ClientPtr pClient; ScreenPtr pScreen; XID resource; } CompOverlayClientRec; typedef struct _CompImplicitRedirectException { XID parentVisual; XID winVisual; } CompImplicitRedirectException; typedef struct _CompScreen { PositionWindowProcPtr PositionWindow; CopyWindowProcPtr CopyWindow; CreateWindowProcPtr CreateWindow; DestroyWindowProcPtr DestroyWindow; RealizeWindowProcPtr RealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow; ClipNotifyProcPtr ClipNotify; /* * Called from ConfigureWindow, these * three track changes to the offscreen storage * geometry */ /* * Unsupported by our old Xserver infrastructure, replaced with direct calls to * compReallocPixmap(). */ /* ConfigNotifyProcPtr ConfigNotify; */ MoveWindowProcPtr MoveWindow; ResizeWindowProcPtr ResizeWindow; ChangeBorderWidthProcPtr ChangeBorderWidth; /* * Reparenting has an effect on Subwindows redirect */ ReparentWindowProcPtr ReparentWindow; /* * Colormaps for new visuals better not get installed */ InstallColormapProcPtr InstallColormap; /* * Fake backing store via automatic redirection */ ChangeWindowAttributesProcPtr ChangeWindowAttributes; ScreenBlockHandlerProcPtr BlockHandler; CloseScreenProcPtr CloseScreen; Bool damaged; int numAlternateVisuals; VisualID *alternateVisuals; int numImplicitRedirectExceptions; CompImplicitRedirectException *implicitRedirectExceptions; WindowPtr pOverlayWin; Window overlayWid; CompOverlayClientPtr pOverlayClients; GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; SourceValidateProcPtr SourceValidate; } CompScreenRec, *CompScreenPtr; #ifndef NXAGENT_SERVER extern DevPrivateKeyRec CompScreenPrivateKeyRec; #define CompScreenPrivateKey (&CompScreenPrivateKeyRec) extern DevPrivateKeyRec CompWindowPrivateKeyRec; #define CompWindowPrivateKey (&CompWindowPrivateKeyRec) extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec; #define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec) #define GetCompScreen(s) ((CompScreenPtr) \ dixLookupPrivate(&(s)->devPrivates, CompScreenPrivateKey)) #define GetCompWindow(w) ((CompWindowPtr) \ dixLookupPrivate(&(w)->devPrivates, CompWindowPrivateKey)) #define GetCompSubwindows(w) ((CompSubwindowsPtr) \ dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey)) #else /* !defined(NXAGENT_SERVER) */ extern int CompScreenPrivIndex; extern int CompWindowPrivIndex; extern int CompSubwindowsPrivIndex; #define GetCompScreen(s) ((CompScreenPtr) (s)->devPrivates[CompScreenPrivIndex].ptr) #define GetCompWindow(w) ((CompWindowPtr) (w)->devPrivates[CompWindowPrivIndex].ptr) #define GetCompSubwindows(w) ((CompSubwindowsPtr) (w)->devPrivates[CompSubwindowsPrivIndex].ptr) #endif /* !defined(NXAGENT_SERVER) */ extern RESTYPE CompositeClientSubwindowsType; extern RESTYPE CompositeClientOverlayType; /* Shim for less ifdefs within the actual code. */ #ifndef NXAGENT_SERVER #define FAKE_DIX_SET_PRIVATE_IMPL(obj, privateKey, ptr_val) do { dixSetPrivate(&(obj)->devPrivates, privateKey, ptr_val); } while (0) #define FAKE_DIX_SET_SCREEN_PRIVATE(pScreen, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pScreen, CompScreenPrivateKey, ptr_val) #define FAKE_DIX_SET_WINDOW_PRIVATE(pWin, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pWin, CompWindowPrivateKey, ptr_val) #define FAKE_DIX_SET_SUBWINDOWS_PRIVATE(pWin, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pWin, CompSubwindowsPrivateKey, ptr_val) #else /* !defined(NXAGENT_SERVER) */ #define FAKE_DIX_SET_PRIVATE_IMPL(obj, privIndex, ptr_val) do { (obj)->devPrivates[privIndex].ptr = (void *) (ptr_val); } while (0) #define FAKE_DIX_SET_SCREEN_PRIVATE(pScreen, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pScreen, CompScreenPrivIndex, ptr_val) #define FAKE_DIX_SET_WINDOW_PRIVATE(pWin, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pWin, CompWindowPrivIndex, ptr_val) #define FAKE_DIX_SET_SUBWINDOWS_PRIVATE(pWin, ptr_val) FAKE_DIX_SET_PRIVATE_IMPL(pWin, CompSubwindowsPrivIndex, ptr_val) #endif /* !defined(NXAGENT_SERVER) */ /* * compalloc.c */ Bool compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update); void compFreeClientWindow (WindowPtr pWin, XID id); int compUnredirectWindow (ClientPtr pClient, WindowPtr pWin, int update); int compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update); void compFreeClientSubwindows (WindowPtr pWin, XID id); int compUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update); int compRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin); int compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin); Bool compAllocPixmap (WindowPtr pWin); void compSetParentPixmap(WindowPtr pWin); void compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap); Bool compReallocPixmap (WindowPtr pWin, int x, int y, unsigned int w, unsigned int h, int bw); /* * compinit.c */ Bool compScreenInit(ScreenPtr pScreen); /* * compoverlay.c */ void compFreeOverlayClient(CompOverlayClientPtr pOcToDel); CompOverlayClientPtr compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient); CompOverlayClientPtr compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient); Bool compCreateOverlayWindow(ScreenPtr pScreen); void compDestroyOverlayWindow(ScreenPtr pScreen); /* * compwindow.c */ #ifdef COMPOSITE_DEBUG void compCheckTree (ScreenPtr pScreen); #else #define compCheckTree(s) #endif PictFormatPtr compWindowFormat (WindowPtr pWin); void compSetPixmap (WindowPtr pWin, PixmapPtr pPixmap); Bool compCheckRedirect (WindowPtr pWin); Bool compPositionWindow (WindowPtr pWin, int x, int y); Bool compRealizeWindow (WindowPtr pWin); Bool compUnrealizeWindow (WindowPtr pWin); void compClipNotify (WindowPtr pWin, int dx, int dy); void compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind); void compResizeWindow (WindowPtr pWin, int x, int y, unsigned int w, unsigned int h, WindowPtr pSib); void compChangeBorderWidth (WindowPtr pWin, unsigned int border_width); void compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent); Bool compCreateWindow (WindowPtr pWin); Bool compDestroyWindow (WindowPtr pWin); void compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion); RegionPtr compGetRedirectBorderClip (WindowPtr pWin); void compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); void compPaintChildrenToWindow(ScreenPtr pScreen, WindowPtr pWin); WindowPtr CompositeRealChildHead(WindowPtr pWin); int DeleteWindowNoInputDevices(void *value, XID wid); /* * Unsupported by our old Xserver infrastructure, replaced with direct calls to * compReallocPixmap(). */ /* int compConfigNotify(WindowPtr pWin, int x, int y, int w, int h, int bw, WindowPtr pSib); */ void PanoramiXCompositeInit(void); void PanoramiXCompositeReset(void); #endif /* _COMPINT_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/composite/compositeext.h0000644000000000000000000000356113614532331021476 0ustar /* * Copyright © 2009 NVIDIA Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _COMPOSITEEXT_H_ #define _COMPOSITEEXT_H_ #include "misc.h" #include "scrnintstr.h" extern _X_EXPORT Bool CompositeRegisterAlternateVisuals(ScreenPtr pScreen, VisualID * vids, int nVisuals); extern _X_EXPORT Bool CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen, VisualID parentVisual, VisualID winVisual); extern _X_EXPORT RESTYPE CompositeClientWindowType; #endif /* _COMPOSITEEXT_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/composite/compoverlay.c0000644000000000000000000001272113614532331021304 0ustar /* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "compint.h" #ifndef NXAGENT_SERVER #include "xace.h" #endif #ifdef PANORAMIX #include "panoramiXsrv.h" #endif /* * Delete the given overlay client list element from its screen list. */ void compFreeOverlayClient(CompOverlayClientPtr pOcToDel) { ScreenPtr pScreen = pOcToDel->pScreen; CompScreenPtr cs = GetCompScreen(pScreen); CompOverlayClientPtr *pPrev, pOc; for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext) { if (pOc == pOcToDel) { *pPrev = pOc->pNext; free(pOc); break; } } /* Destroy overlay window when there are no more clients using it */ if (cs->pOverlayClients == NULL) compDestroyOverlayWindow(pScreen); } /* * Return the client's first overlay client rec from the given screen */ CompOverlayClientPtr compFindOverlayClient(ScreenPtr pScreen, ClientPtr pClient) { CompScreenPtr cs = GetCompScreen(pScreen); CompOverlayClientPtr pOc; for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext) if (pOc->pClient == pClient) return pOc; return NULL; } /* * Create an overlay client object for the given client */ CompOverlayClientPtr compCreateOverlayClient(ScreenPtr pScreen, ClientPtr pClient) { CompScreenPtr cs = GetCompScreen(pScreen); CompOverlayClientPtr pOc; pOc = (CompOverlayClientPtr) malloc(sizeof(CompOverlayClientRec)); if (pOc == NULL) return NULL; pOc->pClient = pClient; pOc->pScreen = pScreen; pOc->resource = FakeClientID(pClient->index); pOc->pNext = cs->pOverlayClients; cs->pOverlayClients = pOc; /* * Create a resource for this element so it can be deleted * when the client goes away. */ if (!AddResource(pOc->resource, CompositeClientOverlayType, (void *) pOc)) return NULL; return pOc; } /* * Create the overlay window and map it */ Bool compCreateOverlayWindow(ScreenPtr pScreen) { CompScreenPtr cs = GetCompScreen(pScreen); WindowPtr pRoot = pScreen->root; WindowPtr pWin; XID attrs[] = { None, TRUE }; /* backPixmap, overrideRedirect */ int result; int w = pScreen->width; int h = pScreen->height; int x = 0, y = 0; /* Unsupported by current architecture, disabled. */ #if 0 #ifdef PANORAMIX if (!noPanoramiXExtension) { x = -pScreen->x; y = -pScreen->y; w = PanoramiXPixWidth; h = PanoramiXPixHeight; } #endif #endif pWin = cs->pOverlayWin = CreateWindow(cs->overlayWid, pRoot, x, y, w, h, 0, InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0], pRoot->drawable.depth, serverClient, pScreen->rootVisual, &result); if (pWin == NULL) return FALSE; if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *) pWin)) return FALSE; MapWindow(pWin, serverClient); return TRUE; } /* * Destroy the overlay window */ void compDestroyOverlayWindow(ScreenPtr pScreen) { CompScreenPtr cs = GetCompScreen(pScreen); cs->pOverlayWin = NullWindow; FreeResource(cs->overlayWid, RT_NONE); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/composite/compwindow.c0000644000000000000000000006106113614532331021133 0ustar /* * $Id: compwindow.c,v 1.11 2005/07/03 07:37:34 daniels Exp $ * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "compint.h" #ifdef PANORAMIX #include "panoramiXsrv.h" #endif #ifdef COMPOSITE_DEBUG static int compCheckWindow (WindowPtr pWin, void * data) { ScreenPtr pScreen = pWin->drawable.pScreen; PixmapPtr pWinPixmap = (*pScreen->GetWindowPixmap) (pWin); PixmapPtr pParentPixmap = pWin->parent ? (*pScreen->GetWindowPixmap) (pWin->parent) : 0; PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen); if (!pWin->parent) { assert (pWin->redirectDraw == RedriectDrawNone); assert (pWinPixmap == pScreenPixmap); } else if (pWin->redirectDraw != RedirectDrawNone) { assert (pWinPixmap != pParentPixmap); assert (pWinPixmap != pScreenPixmap); } else { assert (pWinPixmap == pParentPixmap); } assert (0 < pWinPixmap->refcnt && pWinPixmap->refcnt < 3); assert (0 < pScreenPixmap->refcnt && pScreenPixmap->refcnt < 3); if (pParentPixmap) assert (0 <= pParentPixmap->refcnt && pParentPixmap->refcnt < 3); return WT_WALKCHILDREN; } void compCheckTree (ScreenPtr pScreen) { WalkTree (pScreen, compCheckWindow, 0); } #endif typedef struct _compPixmapVisit { WindowPtr pWindow; PixmapPtr pPixmap; } CompPixmapVisitRec, *CompPixmapVisitPtr; static Bool compRepaintBorder (ClientPtr pClient, void * closure) { WindowPtr pWindow; #ifndef NXAGENT_SERVER int rc = dixLookupWindow(&pWindow, (XID) (intptr_t) closure, pClient, DixWriteAccess); #else pWindow = SecurityLookupWindow((XID) (intptr_t) closure, pClient, DixWriteAccess); int rc = pWindow ? Success : BadWindow; #endif if (rc == Success) { RegionRec exposed; RegionNull(&exposed); RegionSubtract(&exposed, &pWindow->borderClip, &pWindow->winSize); #ifndef NXAGENT_SERVER pWindow->drawable.pScreen->PaintWindowBorder(pWindow, &exposed, PW_BORDER); #else (*pWindow->drawable.pScreen->PaintWindowBorder)(pWindow, &exposed, PW_BORDER); #endif RegionUninit(&exposed); } return TRUE; } static int compSetPixmapVisitWindow (WindowPtr pWindow, void * data) { CompPixmapVisitPtr pVisit = (CompPixmapVisitPtr) data; ScreenPtr pScreen = pWindow->drawable.pScreen; if (pWindow != pVisit->pWindow && pWindow->redirectDraw != RedirectDrawNone) return WT_DONTWALKCHILDREN; (*pScreen->SetWindowPixmap) (pWindow, pVisit->pPixmap); /* * Recompute winSize and borderSize. This is duplicate effort * when resizing pixmaps, but necessary when changing redirection. * Might be nice to fix this. */ SetWinSize (pWindow); SetBorderSize (pWindow); if (HasBorder (pWindow)) QueueWorkProc (compRepaintBorder, serverClient, (void *) (intptr_t) pWindow->drawable.id); return WT_WALKCHILDREN; } void compSetPixmap (WindowPtr pWindow, PixmapPtr pPixmap) { CompPixmapVisitRec visitRec; visitRec.pWindow = pWindow; visitRec.pPixmap = pPixmap; TraverseTree (pWindow, compSetPixmapVisitWindow, (void *) &visitRec); compCheckTree (pWindow->drawable.pScreen); } Bool compCheckRedirect (WindowPtr pWin) { CompWindowPtr cw = GetCompWindow (pWin); CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen); Bool should; should = pWin->realized && (pWin->drawable.class != InputOnly) && (cw != NULL) && (pWin->parent != NULL); /* Never redirect the overlay window */ if (cs->pOverlayWin != NULL) { if (pWin == cs->pOverlayWin) { should = FALSE; } } if (should != (pWin->redirectDraw != RedirectDrawNone)) { if (should) return compAllocPixmap (pWin); else { ScreenPtr pScreen = pWin->drawable.pScreen; PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); compSetParentPixmap(pWin); compRestoreWindow(pWin, pPixmap); (*pScreen->DestroyPixmap) (pPixmap); } } else if (should) { if (cw->update == CompositeRedirectAutomatic) pWin->redirectDraw = RedirectDrawAutomatic; else pWin->redirectDraw = RedirectDrawManual; } return TRUE; } static int updateOverlayWindow(ScreenPtr pScreen) { CompScreenPtr cs; WindowPtr pWin; /* overlay window */ XID vlist[2]; int w = pScreen->width; int h = pScreen->height; #ifdef PANORAMIX if (!noPanoramiXExtension) { w = PanoramiXPixWidth; h = PanoramiXPixHeight; } #endif cs = GetCompScreen(pScreen); if ((pWin = cs->pOverlayWin) != NULL) { if ((pWin->drawable.width == w) && (pWin->drawable.height == h)) return Success; /* Let's resize the overlay window. */ vlist[0] = w; vlist[1] = h; return ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin)); } /* Let's be on the safe side and not assume an overlay window is always allocated. */ return Success; } Bool compPositionWindow (WindowPtr pWin, int x, int y) { ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen (pScreen); Bool ret = TRUE; pScreen->PositionWindow = cs->PositionWindow; /* * "Shouldn't need this as all possible places should be wrapped * compCheckRedirect (pWin); */ #ifdef COMPOSITE_DEBUG if ((pWin->redirectDraw != RedirectDrawNone) != (pWin->viewable && (GetCompWindow(pWin) != NULL))) abort (); #endif if (pWin->redirectDraw != RedirectDrawNone) { PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); int bw = wBorderWidth (pWin); int nx = pWin->drawable.x - bw; int ny = pWin->drawable.y - bw; if (pPixmap->screen_x != nx || pPixmap->screen_y != ny) { pPixmap->screen_x = nx; pPixmap->screen_y = ny; pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; } } if (!(*pScreen->PositionWindow) (pWin, x, y)) ret = FALSE; cs->PositionWindow = pScreen->PositionWindow; pScreen->PositionWindow = compPositionWindow; compCheckTree (pWin->drawable.pScreen); if (updateOverlayWindow(pScreen) != Success) ret = FALSE; return ret; } Bool compRealizeWindow (WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen (pScreen); Bool ret = TRUE; pScreen->RealizeWindow = cs->RealizeWindow; compCheckRedirect (pWin); if (!(*pScreen->RealizeWindow) (pWin)) ret = FALSE; cs->RealizeWindow = pScreen->RealizeWindow; pScreen->RealizeWindow = compRealizeWindow; compCheckTree (pWin->drawable.pScreen); return ret; } Bool compUnrealizeWindow (WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen (pScreen); Bool ret = TRUE; pScreen->UnrealizeWindow = cs->UnrealizeWindow; compCheckRedirect (pWin); if (!(*pScreen->UnrealizeWindow) (pWin)) ret = FALSE; cs->UnrealizeWindow = pScreen->UnrealizeWindow; pScreen->UnrealizeWindow = compUnrealizeWindow; compCheckTree (pWin->drawable.pScreen); return ret; } /* * Called after the borderClip for the window has settled down * We use this to make sure our extra borderClip has the right origin */ void compClipNotify (WindowPtr pWin, int dx, int dy) { ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen (pScreen); CompWindowPtr cw = GetCompWindow (pWin); if (cw) { if (cw->borderClipX != pWin->drawable.x || cw->borderClipY != pWin->drawable.y) { RegionTranslate(&cw->borderClip, pWin->drawable.x - cw->borderClipX, pWin->drawable.y - cw->borderClipY); cw->borderClipX = pWin->drawable.x; cw->borderClipY = pWin->drawable.y; } } if (cs->ClipNotify) { pScreen->ClipNotify = cs->ClipNotify; (*pScreen->ClipNotify) (pWin, dx, dy); cs->ClipNotify = pScreen->ClipNotify; pScreen->ClipNotify = compClipNotify; } } /* * Returns TRUE if the window needs server-provided automatic redirect, * which is true if the child and parent aren't both regular or ARGB visuals */ static Bool compIsAlternateVisual (ScreenPtr pScreen, XID visual) { CompScreenPtr cs = GetCompScreen (pScreen); int i; for (i = 0; i < cs->numAlternateVisuals; i++) if (cs->alternateVisuals[i] == visual) return TRUE; return FALSE; } static Bool compIsImplicitRedirectException(ScreenPtr pScreen, XID parentVisual, XID winVisual) { CompScreenPtr cs = GetCompScreen(pScreen); int i; for (i = 0; i < cs->numImplicitRedirectExceptions; i++) if (cs->implicitRedirectExceptions[i].parentVisual == parentVisual && cs->implicitRedirectExceptions[i].winVisual == winVisual) return TRUE; return FALSE; } static Bool compImplicitRedirect (WindowPtr pWin, WindowPtr pParent) { if (pParent) { ScreenPtr pScreen = pWin->drawable.pScreen; XID winVisual = wVisual (pWin); XID parentVisual = wVisual (pParent); if (compIsImplicitRedirectException(pScreen, parentVisual, winVisual)) return FALSE; if (winVisual != parentVisual && (compIsAlternateVisual (pScreen, winVisual) || compIsAlternateVisual (pScreen, parentVisual))) return TRUE; } return FALSE; } static void compFreeOldPixmap(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; if (pWin->redirectDraw != RedirectDrawNone) { CompWindowPtr cw = GetCompWindow(pWin); if (cw->pOldPixmap) { (*pScreen->DestroyPixmap) (cw->pOldPixmap); cw->pOldPixmap = NullPixmap; } } } void compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind) { ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen (pScreen); compCheckTree (pScreen); if (pWin->redirectDraw != RedirectDrawNone) { WindowPtr pParent; int draw_x, draw_y; unsigned int w, h, bw; /* if this is a root window, can't be moved */ if (!(pParent = pWin->parent)) return; bw = wBorderWidth (pWin); draw_x = pParent->drawable.x + x + (int)bw; draw_y = pParent->drawable.y + y + (int)bw; w = pWin->drawable.width; h = pWin->drawable.height; compReallocPixmap (pWin, draw_x, draw_y, w, h, bw); } compCheckTree (pScreen); pScreen->MoveWindow = cs->MoveWindow; (*pScreen->MoveWindow) (pWin, x, y, pSib, kind); cs->MoveWindow = pScreen->MoveWindow; pScreen->MoveWindow = compMoveWindow; compFreeOldPixmap(pWin); compCheckTree (pScreen); } void compResizeWindow (WindowPtr pWin, int x, int y, unsigned int w, unsigned int h, WindowPtr pSib) { ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen (pScreen); compCheckTree (pScreen); if (pWin->redirectDraw != RedirectDrawNone) { WindowPtr pParent; int draw_x, draw_y; unsigned int bw; /* if this is a root window, can't be moved */ if (!(pParent = pWin->parent)) return; bw = wBorderWidth (pWin); draw_x = pParent->drawable.x + x + (int)bw; draw_y = pParent->drawable.y + y + (int)bw; compReallocPixmap (pWin, draw_x, draw_y, w, h, bw); } compCheckTree (pScreen); pScreen->ResizeWindow = cs->ResizeWindow; (*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib); cs->ResizeWindow = pScreen->ResizeWindow; pScreen->ResizeWindow = compResizeWindow; compFreeOldPixmap(pWin); compCheckTree (pWin->drawable.pScreen); } void compChangeBorderWidth (WindowPtr pWin, unsigned int bw) { ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen (pScreen); compCheckTree (pScreen); if (pWin->redirectDraw != RedirectDrawNone) { WindowPtr pParent; int draw_x, draw_y; unsigned int w, h; /* if this is a root window, can't be moved */ if (!(pParent = pWin->parent)) return; draw_x = pWin->drawable.x; draw_y = pWin->drawable.y; w = pWin->drawable.width; h = pWin->drawable.height; compReallocPixmap (pWin, draw_x, draw_y, w, h, bw); } compCheckTree (pScreen); pScreen->ChangeBorderWidth = cs->ChangeBorderWidth; (*pScreen->ChangeBorderWidth) (pWin, bw); cs->ChangeBorderWidth = pScreen->ChangeBorderWidth; pScreen->ChangeBorderWidth = compChangeBorderWidth; compFreeOldPixmap(pWin); compCheckTree (pWin->drawable.pScreen); } void compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent) { ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen (pScreen); pScreen->ReparentWindow = cs->ReparentWindow; /* * Remove any implicit redirect due to synthesized visual */ if (compImplicitRedirect (pWin, pPriorParent)) compUnredirectWindow (serverClient, pWin, CompositeRedirectAutomatic); /* * Handle subwindows redirection */ compUnredirectOneSubwindow (pPriorParent, pWin); compRedirectOneSubwindow (pWin->parent, pWin); /* * Add any implict redirect due to synthesized visual */ if (compImplicitRedirect (pWin, pWin->parent)) compRedirectWindow (serverClient, pWin, CompositeRedirectAutomatic); /* * Allocate any necessary redirect pixmap * (this actually should never be true; pWin is always unmapped) */ compCheckRedirect (pWin); /* * Reset pixmap pointers as appropriate */ if (pWin->parent && pWin->redirectDraw == RedirectDrawNone) compSetPixmap (pWin, (*pScreen->GetWindowPixmap) (pWin->parent)); /* * Call down to next function */ if (pScreen->ReparentWindow) (*pScreen->ReparentWindow) (pWin, pPriorParent); cs->ReparentWindow = pScreen->ReparentWindow; pScreen->ReparentWindow = compReparentWindow; compCheckTree (pWin->drawable.pScreen); } void compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen (pScreen); int dx = 0, dy = 0; if (pWin->redirectDraw != RedirectDrawNone) { PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); CompWindowPtr cw = GetCompWindow (pWin); assert (cw->oldx != COMP_ORIGIN_INVALID); assert (cw->oldy != COMP_ORIGIN_INVALID); if (cw->pOldPixmap) { /* * Ok, the old bits are available in pOldPixmap and * need to be copied to pNewPixmap. */ RegionRec rgnDst; GCPtr pGC; dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; RegionTranslate(prgnSrc, -dx, -dy); RegionNull(&rgnDst); RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc); RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y); dx = dx + pPixmap->screen_x - cw->oldx; dy = dy + pPixmap->screen_y - cw->oldy; pGC = GetScratchGC (pPixmap->drawable.depth, pScreen); if (pGC) { BoxPtr pBox = RegionRects (&rgnDst); int nBox = RegionNumRects (&rgnDst); ValidateGC(&pPixmap->drawable, pGC); while (nBox--) { (void) (*pGC->ops->CopyArea) (&cw->pOldPixmap->drawable, &pPixmap->drawable, pGC, pBox->x1 + dx, pBox->y1 + dy, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1, pBox->y1); pBox++; } FreeScratchGC (pGC); } RegionUninit (&rgnDst); return; } dx = pPixmap->screen_x - cw->oldx; dy = pPixmap->screen_y - cw->oldy; ptOldOrg.x += dx; ptOldOrg.y += dy; } pScreen->CopyWindow = cs->CopyWindow; if (ptOldOrg.x != pWin->drawable.x || ptOldOrg.y != pWin->drawable.y) { if (dx || dy) RegionTranslate(prgnSrc, dx, dy); (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); if (dx || dy) RegionTranslate(prgnSrc, -dx, -dy); } else { ptOldOrg.x -= dx; ptOldOrg.y -= dy; RegionTranslate(prgnSrc, pWin->drawable.x - ptOldOrg.x, pWin->drawable.y - ptOldOrg.y); DamageDamageRegion (&pWin->drawable, prgnSrc); } cs->CopyWindow = pScreen->CopyWindow; pScreen->CopyWindow = compCopyWindow; compCheckTree (pWin->drawable.pScreen); } Bool compCreateWindow (WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen (pScreen); Bool ret; pScreen->CreateWindow = cs->CreateWindow; ret = (*pScreen->CreateWindow) (pWin); if (pWin->parent && ret) { CompSubwindowsPtr csw = GetCompSubwindows (pWin->parent); CompClientWindowPtr ccw; PixmapPtr parent_pixmap = (*pScreen->GetWindowPixmap)(pWin->parent); PixmapPtr window_pixmap = (*pScreen->GetWindowPixmap)(pWin); if (window_pixmap != parent_pixmap) (*pScreen->SetWindowPixmap) (pWin, parent_pixmap); if (csw) for (ccw = csw->clients; ccw; ccw = ccw->next) compRedirectWindow (clients[CLIENT_ID(ccw->id)], pWin, ccw->update); if (compImplicitRedirect (pWin, pWin->parent)) compRedirectWindow (serverClient, pWin, CompositeRedirectAutomatic); } cs->CreateWindow = pScreen->CreateWindow; pScreen->CreateWindow = compCreateWindow; compCheckTree (pWin->drawable.pScreen); return ret; } Bool compDestroyWindow (WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen (pScreen); CompWindowPtr cw; CompSubwindowsPtr csw; Bool ret; pScreen->DestroyWindow = cs->DestroyWindow; while ((cw = GetCompWindow (pWin))) FreeResource (cw->clients->id, RT_NONE); while ((csw = GetCompSubwindows (pWin))) FreeResource (csw->clients->id, RT_NONE); if (pWin->redirectDraw != RedirectDrawNone) { PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); compSetParentPixmap (pWin); (*pScreen->DestroyPixmap) (pPixmap); } ret = (*pScreen->DestroyWindow) (pWin); cs->DestroyWindow = pScreen->DestroyWindow; pScreen->DestroyWindow = compDestroyWindow; /* compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/ return ret; } void compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion) { CompWindowPtr cw = GetCompWindow (pWin); RegionRec damage; RegionNull(&damage); /* * Align old border clip with new border clip */ RegionTranslate(&cw->borderClip, pWin->drawable.x - cw->borderClipX, pWin->drawable.y - cw->borderClipY); /* * Compute newly visible portion of window for repaint */ RegionSubtract(&damage, pRegion, &cw->borderClip); /* * Report that as damaged so it will be redrawn */ DamageDamageRegion (&pWin->drawable, &damage); RegionUninit(&damage); /* * Save the new border clip region */ RegionCopy(&cw->borderClip, pRegion); cw->borderClipX = pWin->drawable.x; cw->borderClipY = pWin->drawable.y; } RegionPtr compGetRedirectBorderClip (WindowPtr pWin) { CompWindowPtr cw = GetCompWindow (pWin); return &cw->borderClip; } static VisualPtr compGetWindowVisual (WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; VisualID vid = wVisual (pWin); int i; for (i = 0; i < pScreen->numVisuals; i++) if (pScreen->visuals[i].vid == vid) return &pScreen->visuals[i]; return 0; } PictFormatPtr compWindowFormat (WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; return PictureMatchVisual (pScreen, pWin->drawable.depth, compGetWindowVisual (pWin)); } static void compWindowUpdateAutomatic (WindowPtr pWin) { CompWindowPtr cw = GetCompWindow (pWin); ScreenPtr pScreen = pWin->drawable.pScreen; WindowPtr pParent = pWin->parent; PixmapPtr pSrcPixmap = (*pScreen->GetWindowPixmap) (pWin); PictFormatPtr pSrcFormat = compWindowFormat (pWin); PictFormatPtr pDstFormat = compWindowFormat (pWin->parent); int error; RegionPtr pRegion = DamageRegion (cw->damage); PicturePtr pSrcPicture = CreatePicture (0, &pSrcPixmap->drawable, pSrcFormat, 0, 0, serverClient, &error); XID subwindowMode = IncludeInferiors; PicturePtr pDstPicture = CreatePicture (0, &pParent->drawable, pDstFormat, CPSubwindowMode, &subwindowMode, serverClient, &error); /* * First move the region from window to screen coordinates */ RegionTranslate(pRegion, pWin->drawable.x, pWin->drawable.y); /* * Clip against the "real" border clip */ RegionIntersect(pRegion, pRegion, &cw->borderClip); /* * Now translate from screen to dest coordinates */ RegionTranslate(pRegion, -pParent->drawable.x, -pParent->drawable.y); /* * Clip the picture */ SetPictureClipRegion (pDstPicture, 0, 0, pRegion); /* * And paint */ CompositePicture (PictOpSrc, pSrcPicture, 0, pDstPicture, 0, 0, /* src_x, src_y */ 0, 0, /* msk_x, msk_y */ pSrcPixmap->screen_x - pParent->drawable.x, pSrcPixmap->screen_y - pParent->drawable.y, pSrcPixmap->drawable.width, pSrcPixmap->drawable.height); FreePicture (pSrcPicture, 0); FreePicture (pDstPicture, 0); /* * Empty the damage region. This has the nice effect of * rendering the translations above harmless */ DamageEmpty (cw->damage); } static void compPaintWindowToParent(WindowPtr pWin) { compPaintChildrenToWindow(pWin->drawable.pScreen, pWin); if (pWin->redirectDraw != RedirectDrawNone) { CompWindowPtr cw = GetCompWindow(pWin); if (cw->damaged) { compWindowUpdateAutomatic(pWin); cw->damaged = FALSE; } } } void compPaintChildrenToWindow(ScreenPtr pScreen, WindowPtr pWin) { WindowPtr pChild; CompScreenPtr cs = GetCompScreen(pScreen); if (!cs->damaged) return; for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib) compPaintWindowToParent(pChild); cs->damaged = FALSE; } WindowPtr CompositeRealChildHead(WindowPtr pWin) { WindowPtr pChild, pChildBefore; CompScreenPtr cs; if (!pWin->parent && (screenIsSaved == SCREEN_SAVER_ON) && (HasSaverWindow(pWin->drawable.pScreen->myNum))) { /* First child is the screen saver; see if next child is the overlay */ pChildBefore = pWin->firstChild; pChild = pChildBefore->nextSib; } else { pChildBefore = NullWindow; pChild = pWin->firstChild; } if (!pChild) { return NullWindow; } cs = GetCompScreen(pWin->drawable.pScreen); if (pChild == cs->pOverlayWin) { return pChild; } else { return pChildBefore; } } /* ConfigNotify not implemented... replace with the old pixmap reallocation algorithm... */ /* int compConfigNotify(WindowPtr pWin, int x, int y, int w, int h, int bw, WindowPtr pSib) { ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen(pScreen); Bool ret = 0; WindowPtr pParent = pWin->parent; int draw_x, draw_y; Bool alloc_ret; if (cs->ConfigNotify) { pScreen->ConfigNotify = cs->ConfigNotify; ret = (*pScreen->ConfigNotify) (pWin, x, y, w, h, bw, pSib); cs->ConfigNotify = pScreen->ConfigNotify; pScreen->ConfigNotify = compConfigNotify; if (ret) return ret; } if (pWin->redirectDraw == RedirectDrawNone) return Success; compCheckTree(pScreen); draw_x = pParent->drawable.x + x + bw; draw_y = pParent->drawable.y + y + bw; alloc_ret = compReallocPixmap(pWin, draw_x, draw_y, w, h, bw); if (alloc_ret == FALSE) return BadAlloc; return Success; } */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/composite/Imakefile0000644000000000000000000000133013614532331020403 0ustar #include NULL = SRCS = compalloc.c compext.c compinit.c compoverlay.c compwindow.c OBJS = compalloc.o compext.o compinit.o compoverlay.o compwindow.o INCLUDES = -I../include -I../mi -I../Xext -I../render -I../xfixes \ -I../damageext -I../miext/damage -I$(EXTINCSRC) \ -I$(XINCLUDESRC) \ `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln #if defined(NXAgentServer) && NXAgentServer NX_DEFINES = -DNXAGENT_SERVER #endif DEFINES = \ $(NX_DEFINES) \ $(NULL) NormalLibraryTarget(composite,$(OBJS)) NormalLibraryObjectRule() LintLibraryTarget(composite,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() nx-libs-3.5.99.23/nx-X11/programs/Xserver/damageext/damageext.c0000644000000000000000000003172013614532331020640 0ustar /* * $Id: damageext.c,v 1.6 2005/07/03 07:37:35 daniels Exp $ * * Copyright © 2002 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "damageextint.h" #include "protocol-versions.h" unsigned char DamageReqCode; int DamageEventBase; int DamageErrorBase; int DamageClientPrivateIndex; RESTYPE DamageExtType; RESTYPE DamageExtWinType; #define prScreen screenInfo.screens[0] static void DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes) { ClientPtr pClient = pDamageExt->pClient; DamageClientPtr pDamageClient = GetDamageClient (pClient); DrawablePtr pDrawable = pDamageExt->pDrawable; xDamageNotifyEvent ev; int i; UpdateCurrentTimeIf (); ev.type = DamageEventBase + XDamageNotify; ev.level = pDamageExt->level; ev.sequenceNumber = pClient->sequence; ev.drawable = pDrawable->id; ev.damage = pDamageExt->id; ev.timestamp = currentTime.milliseconds; ev.geometry.x = pDrawable->x; ev.geometry.y = pDrawable->y; ev.geometry.width = pDrawable->width; ev.geometry.height = pDrawable->height; if (pBoxes) { for (i = 0; i < nBoxes; i++) { ev.level = pDamageExt->level; if (i < nBoxes - 1) ev.level |= DamageNotifyMore; ev.area.x = pBoxes[i].x1; ev.area.y = pBoxes[i].y1; ev.area.width = pBoxes[i].x2 - pBoxes[i].x1; ev.area.height = pBoxes[i].y2 - pBoxes[i].y1; WriteEventsToClient (pClient, 1, (xEvent *) &ev); } } else { ev.area.x = 0; ev.area.y = 0; ev.area.width = pDrawable->width; ev.area.height = pDrawable->height; WriteEventsToClient (pClient, 1, (xEvent *) &ev); } /* Composite extension marks clients with manual Subwindows as critical */ if (pDamageClient->critical > 0) { SetCriticalOutputPending (); pClient->smart_priority = SMART_MAX_PRIORITY; } } static void DamageExtReport (DamagePtr pDamage, RegionPtr pRegion, void *closure) { DamageExtPtr pDamageExt = closure; switch (pDamageExt->level) { case DamageReportRawRegion: case DamageReportDeltaRegion: DamageExtNotify (pDamageExt, RegionRects(pRegion), RegionNumRects(pRegion)); break; case DamageReportBoundingBox: DamageExtNotify (pDamageExt, RegionExtents(pRegion), 1); break; case DamageReportNonEmpty: DamageExtNotify (pDamageExt, NullBox, 0); break; case DamageReportNone: break; } } static void DamageExtDestroy (DamagePtr pDamage, void *closure) { DamageExtPtr pDamageExt = closure; pDamageExt->pDamage = 0; if (pDamageExt->id) FreeResource (pDamageExt->id, RT_NONE); } void DamageExtSetCritical (ClientPtr pClient, Bool critical) { DamageClientPtr pDamageClient = GetDamageClient (pClient); if (pDamageClient) pDamageClient->critical += critical ? 1 : -1; } static int ProcDamageQueryVersion(ClientPtr client) { DamageClientPtr pDamageClient = GetDamageClient (client); xDamageQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; REQUEST(xDamageQueryVersionReq); REQUEST_SIZE_MATCH(xDamageQueryVersionReq); if (stuff->majorVersion < SERVER_DAMAGE_MAJOR_VERSION) { rep.majorVersion = stuff->majorVersion; rep.minorVersion = stuff->minorVersion; } else { rep.majorVersion = SERVER_DAMAGE_MAJOR_VERSION; if (stuff->majorVersion == SERVER_DAMAGE_MAJOR_VERSION && stuff->minorVersion < SERVER_DAMAGE_MINOR_VERSION) rep.minorVersion = stuff->minorVersion; else rep.minorVersion = SERVER_DAMAGE_MINOR_VERSION; } pDamageClient->major_version = rep.majorVersion; pDamageClient->minor_version = rep.minorVersion; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.majorVersion); swapl(&rep.minorVersion); } WriteToClient(client, sizeof(xDamageQueryVersionReply), &rep); return(client->noClientException); } static int ProcDamageCreate (ClientPtr client) { DrawablePtr pDrawable; DamageExtPtr pDamageExt; DamageReportLevel level; RegionPtr pRegion; REQUEST(xDamageCreateReq); REQUEST_SIZE_MATCH(xDamageCreateReq); LEGAL_NEW_RESOURCE(stuff->damage, client); SECURITY_VERIFY_DRAWABLE (pDrawable, stuff->drawable, client, DixReadAccess); switch (stuff->level) { case XDamageReportRawRectangles: level = DamageReportRawRegion; break; case XDamageReportDeltaRectangles: level = DamageReportDeltaRegion; break; case XDamageReportBoundingBox: level = DamageReportBoundingBox; break; case XDamageReportNonEmpty: level = DamageReportNonEmpty; break; default: client->errorValue = stuff->level; return BadValue; } pDamageExt = malloc (sizeof (DamageExtRec)); if (!pDamageExt) return BadAlloc; pDamageExt->id = stuff->damage; pDamageExt->pDrawable = pDrawable; pDamageExt->level = level; pDamageExt->pClient = client; pDamageExt->pDamage = DamageCreate (DamageExtReport, DamageExtDestroy, level, FALSE, pDrawable->pScreen, pDamageExt); if (!pDamageExt->pDamage) { free (pDamageExt); return BadAlloc; } if (!AddResource (stuff->damage, DamageExtType, (void *) pDamageExt)) return BadAlloc; DamageRegister (pDamageExt->pDrawable, pDamageExt->pDamage); if (pDrawable->type == DRAWABLE_WINDOW) { pRegion = &((WindowPtr) pDrawable)->borderClip; DamageDamageRegion (pDrawable, pRegion); } return (client->noClientException); } static int ProcDamageDestroy (ClientPtr client) { REQUEST(xDamageDestroyReq); DamageExtPtr pDamageExt; REQUEST_SIZE_MATCH(xDamageDestroyReq); VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess); FreeResource (stuff->damage, RT_NONE); return (client->noClientException); } static int ProcDamageSubtract (ClientPtr client) { REQUEST(xDamageSubtractReq); DamageExtPtr pDamageExt; RegionPtr pRepair; RegionPtr pParts; REQUEST_SIZE_MATCH(xDamageSubtractReq); VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess); VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, DixWriteAccess); VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, DixWriteAccess); if (pDamageExt->level != DamageReportRawRegion) { DamagePtr pDamage = pDamageExt->pDamage; if (pRepair) { if (pParts) RegionIntersect(pParts, DamageRegion (pDamage), pRepair); if (DamageSubtract (pDamage, pRepair)) DamageExtReport (pDamage, DamageRegion (pDamage), (void *) pDamageExt); } else { if (pParts) RegionCopy(pParts, DamageRegion (pDamage)); DamageEmpty (pDamage); } } return (client->noClientException); } /* Major version controls available requests */ static const int version_requests[] = { X_DamageQueryVersion, /* before client sends QueryVersion */ X_DamageSubtract, /* Version 1 */ }; #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) int (*ProcDamageVector[XDamageNumberRequests])(ClientPtr) = { /*************** Version 1 ******************/ ProcDamageQueryVersion, ProcDamageCreate, ProcDamageDestroy, ProcDamageSubtract, }; static int ProcDamageDispatch (ClientPtr client) { REQUEST(xDamageReq); DamageClientPtr pDamageClient = GetDamageClient (client); if (pDamageClient->major_version >= NUM_VERSION_REQUESTS) return BadRequest; if (stuff->damageReqType > version_requests[pDamageClient->major_version]) return BadRequest; return (*ProcDamageVector[stuff->damageReqType]) (client); } static int SProcDamageQueryVersion(ClientPtr client) { REQUEST(xDamageQueryVersionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDamageQueryVersionReq); swapl(&stuff->majorVersion); swapl(&stuff->minorVersion); return (*ProcDamageVector[stuff->damageReqType]) (client); } static int SProcDamageCreate (ClientPtr client) { REQUEST(xDamageCreateReq); swaps (&stuff->length); REQUEST_SIZE_MATCH(xDamageCreateReq); swapl (&stuff->damage); swapl (&stuff->drawable); return (*ProcDamageVector[stuff->damageReqType]) (client); } static int SProcDamageDestroy (ClientPtr client) { REQUEST(xDamageDestroyReq); swaps (&stuff->length); REQUEST_SIZE_MATCH(xDamageDestroyReq); swapl (&stuff->damage); return (*ProcDamageVector[stuff->damageReqType]) (client); } static int SProcDamageSubtract (ClientPtr client) { REQUEST(xDamageSubtractReq); swaps (&stuff->length); REQUEST_SIZE_MATCH(xDamageSubtractReq); swapl (&stuff->damage); swapl (&stuff->repair); swapl (&stuff->parts); return (*ProcDamageVector[stuff->damageReqType]) (client); } int (*SProcDamageVector[XDamageNumberRequests])(ClientPtr) = { /*************** Version 1 ******************/ SProcDamageQueryVersion, SProcDamageCreate, SProcDamageDestroy, SProcDamageSubtract, }; static int SProcDamageDispatch (ClientPtr client) { REQUEST(xDamageReq); if (stuff->damageReqType >= XDamageNumberRequests) return BadRequest; return (*SProcDamageVector[stuff->damageReqType]) (client); } static void DamageClientCallback (CallbackListPtr *list, void * closure, void * data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; DamageClientPtr pDamageClient = GetDamageClient (pClient); pDamageClient->critical = 0; pDamageClient->major_version = 0; pDamageClient->minor_version = 0; } /*ARGSUSED*/ static void DamageResetProc (ExtensionEntry *extEntry) { DeleteCallback (&ClientStateCallback, DamageClientCallback, 0); } static int FreeDamageExt (void * value, XID did) { DamageExtPtr pDamageExt = (DamageExtPtr) value; /* * Get rid of the resource table entry hanging from the window id */ pDamageExt->id = 0; if (WindowDrawable(pDamageExt->pDrawable->type)) FreeResourceByType (pDamageExt->pDrawable->id, DamageExtWinType, TRUE); if (pDamageExt->pDamage) { DamageUnregister (pDamageExt->pDrawable, pDamageExt->pDamage); DamageDestroy (pDamageExt->pDamage); } free (pDamageExt); return Success; } static int FreeDamageExtWin (void * value, XID wid) { DamageExtPtr pDamageExt = (DamageExtPtr) value; if (pDamageExt->id) FreeResource (pDamageExt->id, RT_NONE); return Success; } void SDamageNotifyEvent (xDamageNotifyEvent *from, xDamageNotifyEvent *to) { to->type = from->type; cpswaps (from->sequenceNumber, to->sequenceNumber); cpswapl (from->drawable, to->drawable); cpswapl (from->damage, to->damage); cpswaps (from->area.x, to->area.x); cpswaps (from->area.y, to->area.y); cpswaps (from->area.width, to->area.width); cpswaps (from->area.height, to->area.height); cpswaps (from->geometry.x, to->geometry.x); cpswaps (from->geometry.y, to->geometry.y); cpswaps (from->geometry.width, to->geometry.width); cpswaps (from->geometry.height, to->geometry.height); } void DamageExtensionInit(void) { ExtensionEntry *extEntry; int s; for (s = 0; s < screenInfo.numScreens; s++) DamageSetup (screenInfo.screens[s]); DamageExtType = CreateNewResourceType (FreeDamageExt); if (!DamageExtType) return; DamageExtWinType = CreateNewResourceType (FreeDamageExtWin); if (!DamageExtWinType) return; DamageClientPrivateIndex = AllocateClientPrivateIndex (); if (!AllocateClientPrivate (DamageClientPrivateIndex, sizeof (DamageClientRec))) return; if (!AddCallback (&ClientStateCallback, DamageClientCallback, 0)) return; if ((extEntry = AddExtension(DAMAGE_NAME, XDamageNumberEvents, XDamageNumberErrors, ProcDamageDispatch, SProcDamageDispatch, DamageResetProc, StandardMinorOpcode)) != 0) { DamageReqCode = (unsigned char)extEntry->base; DamageEventBase = extEntry->eventBase; DamageErrorBase = extEntry->errorBase; EventSwapVector[DamageEventBase + XDamageNotify] = (EventSwapPtr) SDamageNotifyEvent; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/damageext/damageext.h0000644000000000000000000000255213614532331020646 0ustar /* * $Id: damageext.h,v 1.5 2005/07/03 07:01:17 daniels Exp $ * * Copyright © 2002 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _DAMAGEEXT_H_ #define _DAMAGEEXT_H_ void DamageExtensionInit(void); #endif /* _DAMAGEEXT_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/damageext/damageextint.h0000644000000000000000000000541613614532331021363 0ustar /* * $Id: damageextint.h,v 1.6 2005/07/03 08:53:38 daniels Exp $ * * Copyright © 2002 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _DAMAGEEXTINT_H_ #define _DAMAGEEXTINT_H_ #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include #include "windowstr.h" #include "selection.h" #include "scrnintstr.h" #include "damageext.h" #include "damage.h" #include "xfixes.h" extern unsigned char DamageReqCode; extern int DamageEventBase; extern int DamageErrorBase; extern int DamageClientPrivateIndex; extern RESTYPE DamageExtType; extern RESTYPE DamageExtWinType; typedef struct _DamageClient { CARD32 major_version; CARD32 minor_version; int critical; } DamageClientRec, *DamageClientPtr; #define GetDamageClient(pClient) ((DamageClientPtr) (pClient)->devPrivates[DamageClientPrivateIndex].ptr) typedef struct _DamageExt { DamagePtr pDamage; DrawablePtr pDrawable; DamageReportLevel level; ClientPtr pClient; XID id; } DamageExtRec, *DamageExtPtr; extern int (*ProcDamageVector[/*XDamageNumberRequests*/])(ClientPtr); extern int (*SProcDamageVector[/*XDamageNumberRequests*/])(ClientPtr); #define VERIFY_DAMAGEEXT(pDamageExt, rid, client, mode) { \ pDamageExt = SecurityLookupIDByType (client, rid, DamageExtType, mode); \ if (!pDamageExt) { \ client->errorValue = rid; \ return DamageErrorBase + BadDamage; \ } \ } void SDamageNotifyEvent (xDamageNotifyEvent *from, xDamageNotifyEvent *to); void DamageExtSetCritical (ClientPtr pClient, Bool critical); #endif /* _DAMAGEEXTINT_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/damageext/Imakefile0000644000000000000000000000113513614532331020343 0ustar #include NULL = SRCS = damageext.c OBJS = damageext.o INCLUDES = -I../include -I../Xext -I../render -I../xfixes -I../miext/damage \ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln #if defined(NXAgentServer) && NXAgentServer NX_DEFINES = -DNXAGENT_SERVER #endif DEFINES = \ $(NX_DEFINES) \ $(NULL) NormalLibraryTarget(damageext,$(OBJS)) NormalLibraryObjectRule() LintLibraryTarget(damageext,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() nx-libs-3.5.99.23/nx-X11/programs/Xserver/dbe/dbe.c0000644000000000000000000015611213614532331016231 0ustar /****************************************************************************** * * Copyright (c) 1994, 1995 Hewlett-Packard Company * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the Hewlett-Packard * Company shall not be used in advertising or otherwise to promote the * sale, use or other dealings in this Software without prior written * authorization from the Hewlett-Packard Company. * * DIX DBE code * *****************************************************************************/ /* INCLUDES */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "scrnintstr.h" #include "extnsionst.h" #include "gcstruct.h" #include "dixstruct.h" #define NEED_DBE_PROTOCOL #include "dbestruct.h" #include "midbe.h" #if !defined(UINT32_MAX) #define UINT32_MAX 0xffffffffU #endif /* GLOBALS */ /* Per-screen initialization functions [init'ed by DbeRegisterFunction()] */ static Bool (* DbeInitFunct[MAXSCREENS])(); /* pScreen, pDbeScreenPriv */ /* These are static globals copied to DBE's screen private for use by DDX */ static int dbeScreenPrivIndex; static int dbeWindowPrivIndex; /* These are static globals copied to DBE's screen private for use by DDX */ static RESTYPE dbeDrawableResType; static RESTYPE dbeWindowPrivResType; /* This global is used by DbeAllocWinPrivPrivIndex() */ static int winPrivPrivCount = 0; /* Used to generate DBE's BadBuffer error. */ static int dbeErrorBase; /* Used by DbeRegisterFunction() to initialize the initialization function * table only once per server lifetime. */ static Bool firstRegistrationPass = TRUE; /****************************************************************************** * * DBE DIX Procedure: DbeRegisterFunction * * Description: * * This function registers the DBE init function for the specified screen. * *****************************************************************************/ void DbeRegisterFunction(ScreenPtr pScreen, Bool (*funct) (/* ??? */)) { int i; /* Initialize the initialization function table if it has not been * initialized already. */ if (firstRegistrationPass) { for (i = 0; i < MAXSCREENS; i++) { DbeInitFunct[i] = NULL; } firstRegistrationPass = FALSE; } DbeInitFunct[pScreen->myNum] = funct; } /* DbeRegisterFunction() */ /****************************************************************************** * * DBE DIX Procedure: DbeAllocWinPriv * * Description: * * This function was cloned from AllocateWindow() in window.c. * This function allocates a window priv structure to be associated * with a double-buffered window. * *****************************************************************************/ static DbeWindowPrivPtr DbeAllocWinPriv(ScreenPtr pScreen) { DbeWindowPrivPtr pDbeWindowPriv; DbeScreenPrivPtr pDbeScreenPriv; register char *ptr; register DevUnion *ppriv; register unsigned int *sizes; register unsigned int size; register int i; pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); pDbeWindowPriv = (DbeWindowPrivPtr)malloc(pDbeScreenPriv->totalWinPrivSize); if (pDbeWindowPriv) { ppriv = (DevUnion *)(pDbeWindowPriv + 1); pDbeWindowPriv->devPrivates = ppriv; sizes = pDbeScreenPriv->winPrivPrivSizes; ptr = (char *)(ppriv + pDbeScreenPriv->winPrivPrivLen); for (i = pDbeScreenPriv->winPrivPrivLen; --i >= 0; ppriv++, sizes++) { if ((size = *sizes)) { ppriv->ptr = (void *)ptr; ptr += size; } else ppriv->ptr = (void *)NULL; } } return(pDbeWindowPriv); } /* DbeAllocWinPriv() */ /****************************************************************************** * * DBE DIX Procedure: DbeFallbackAllocWinPriv * * Description: * * This is a fallback function for AllocWinPriv(). * *****************************************************************************/ #if 0 /* NOT USED */ static DbeWindowPrivPtr DbeFallbackAllocWinPriv(pScreen) ScreenPtr pScreen; { return (NULL); } /* DbeFallbackAllocWinPriv() */ #endif /****************************************************************************** * * DBE DIX Procedure: DbeAllocWinPrivPrivIndex * * Description: * * This function was cloned from AllocateWindowPrivateIndex() in window.c. * This function allocates a new window priv priv index by simply returning * an incremented private counter. * *****************************************************************************/ static int DbeAllocWinPrivPrivIndex(void) { return winPrivPrivCount++; } /* DbeAllocWinPrivPrivIndex() */ /****************************************************************************** * * DBE DIX Procedure: DbeAllocWinPrivPriv * * Description: * * This function was cloned from AllocateWindowPrivate() in privates.c. * This function allocates a private structure to be hung off * a window private. * *****************************************************************************/ static Bool DbeAllocWinPrivPriv(register ScreenPtr pScreen, int index, unsigned int amount) { DbeScreenPrivPtr pDbeScreenPriv; unsigned int oldamount; pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); if (index >= pDbeScreenPriv->winPrivPrivLen) { unsigned *nsizes; nsizes = (unsigned *)realloc(pDbeScreenPriv->winPrivPrivSizes, (index + 1) * sizeof(unsigned)); if (!nsizes) { return(FALSE); } while (pDbeScreenPriv->winPrivPrivLen <= index) { nsizes[pDbeScreenPriv->winPrivPrivLen++] = 0; pDbeScreenPriv->totalWinPrivSize += sizeof(DevUnion); } pDbeScreenPriv->winPrivPrivSizes = nsizes; } oldamount = pDbeScreenPriv->winPrivPrivSizes[index]; if (amount > oldamount) { pDbeScreenPriv->winPrivPrivSizes[index] = amount; pDbeScreenPriv->totalWinPrivSize += (amount - oldamount); } return(TRUE); } /* DbeAllocWinPrivPriv() */ /****************************************************************************** * * DBE DIX Procedure: DbeStubScreen * * Description: * * This is function stubs the function pointers in the given DBE screen * private and increments the number of stubbed screens. * *****************************************************************************/ static void DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens) { /* Stub DIX. */ pDbeScreenPriv->SetupBackgroundPainter = NULL; pDbeScreenPriv->AllocWinPriv = NULL; pDbeScreenPriv->AllocWinPrivPrivIndex = NULL; pDbeScreenPriv->AllocWinPrivPriv = NULL; /* Do not unwrap PositionWindow nor DestroyWindow. If the DDX * initialization function failed, we assume that it did not wrap * PositionWindow. Also, DestroyWindow is only wrapped if the DDX * initialization function succeeded. */ /* Stub DDX. */ pDbeScreenPriv->GetVisualInfo = NULL; pDbeScreenPriv->AllocBackBufferName = NULL; pDbeScreenPriv->SwapBuffers = NULL; pDbeScreenPriv->BeginIdiom = NULL; pDbeScreenPriv->EndIdiom = NULL; pDbeScreenPriv->WinPrivDelete = NULL; pDbeScreenPriv->ResetProc = NULL; (*nStubbedScreens)++; } /* DbeStubScreen() */ /****************************************************************************** * * DBE DIX Procedure: ProcDbeGetVersion * * Description: * * This function is for processing a DbeGetVersion request. * This request returns the major and minor version numbers of this * extension. * * Return Values: * * Success * *****************************************************************************/ static int ProcDbeGetVersion(ClientPtr client) { /* REQUEST(xDbeGetVersionReq); */ xDbeGetVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .majorVersion = DBE_MAJOR_VERSION, .minorVersion = DBE_MINOR_VERSION }; REQUEST_SIZE_MATCH(xDbeGetVersionReq); if (client->swapped) { swaps(&rep.sequenceNumber); } WriteToClient(client, sizeof(xDbeGetVersionReply), &rep); return(client->noClientException); } /* ProcDbeGetVersion() */ /****************************************************************************** * * DBE DIX Procedure: ProcDbeAllocateBackBufferName * * Description: * * This function is for processing a DbeAllocateBackBufferName request. * This request allocates a drawable ID used to refer to the back buffer * of a window. * * Return Values: * * BadAlloc - server can not allocate resources * BadIDChoice - id is out of range for client; id is already in use * BadMatch - window is not an InputOutput window; * visual of window is not on list returned by * DBEGetVisualInfo; * BadValue - invalid swap action is specified * BadWindow - window is not a valid window * Success * *****************************************************************************/ static int ProcDbeAllocateBackBufferName(ClientPtr client) { REQUEST(xDbeAllocateBackBufferNameReq); WindowPtr pWin; DbeScreenPrivPtr pDbeScreenPriv; DbeWindowPrivPtr pDbeWindowPriv; XdbeScreenVisualInfo scrVisInfo; register int i; Bool visualMatched = FALSE; xDbeSwapAction swapAction; VisualID visual; int status; REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq); /* The window must be valid. */ #ifndef NXAGENT_SERVER status = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); if (status != Success) return status; #else if (!(pWin = SecurityLookupWindow(stuff->window, client, DixWriteAccess))) { return(BadWindow); } #endif /* The window must be InputOutput. */ if (pWin->drawable.class != InputOutput) { return(BadMatch); } /* The swap action must be valid. */ swapAction = stuff->swapAction; /* use local var for performance. */ if ((swapAction != XdbeUndefined ) && (swapAction != XdbeBackground) && (swapAction != XdbeUntouched ) && (swapAction != XdbeCopied )) { return(BadValue); } /* The id must be in range and not already in use. */ LEGAL_NEW_RESOURCE(stuff->buffer, client); /* The visual of the window must be in the list returned by * GetVisualInfo. */ pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin); if (!pDbeScreenPriv->GetVisualInfo) return(BadMatch); /* screen doesn't support double buffering */ if (!(*pDbeScreenPriv->GetVisualInfo)(pWin->drawable.pScreen, &scrVisInfo)) { /* GetVisualInfo() failed to allocate visual info data. */ return(BadAlloc); } /* See if the window's visual is on the list. */ visual = wVisual(pWin); for (i = 0; (i < scrVisInfo.count) && !visualMatched; i++) { if (scrVisInfo.visinfo[i].visual == visual) { visualMatched = TRUE; } } /* Free what was allocated by the GetVisualInfo() call above. */ free(scrVisInfo.visinfo); if (!visualMatched) { return(BadMatch); } if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)) == NULL) { /* There is no buffer associated with the window. * Allocate a window priv. */ if (!(pDbeWindowPriv = (*pDbeScreenPriv->AllocWinPriv)(pWin->drawable.pScreen))) { return(BadAlloc); } /* Make the window priv a DBE window priv resource. */ if (!AddResource(stuff->buffer, dbeWindowPrivResType, (void *)pDbeWindowPriv)) { free(pDbeWindowPriv); return(BadAlloc); } /* Fill out window priv information. */ pDbeWindowPriv->pWindow = pWin; pDbeWindowPriv->width = pWin->drawable.width; pDbeWindowPriv->height = pWin->drawable.height; pDbeWindowPriv->x = pWin->drawable.x; pDbeWindowPriv->y = pWin->drawable.y; pDbeWindowPriv->nBufferIDs = 0; /* Set the buffer ID array pointer to the initial (static) array). */ pDbeWindowPriv->IDs = pDbeWindowPriv->initIDs; /* Initialize the buffer ID list. */ pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS; pDbeWindowPriv->IDs[0] = stuff->buffer; for (i = 1; i < DBE_INIT_MAX_IDS; i++) { pDbeWindowPriv->IDs[i] = DBE_FREE_ID_ELEMENT; } /* Actually connect the window priv to the window. */ pWin->devPrivates[dbeWindowPrivIndex].ptr = (void *)pDbeWindowPriv; } /* if -- There is no buffer associated with the window. */ else { /* A buffer is already associated with the window. * Add the new buffer ID to the array, reallocating the array memory * if necessary. */ /* Determine if there is a free element in the ID array. */ for (i = 0; i < pDbeWindowPriv->maxAvailableIDs; i++) { if (pDbeWindowPriv->IDs[i] == DBE_FREE_ID_ELEMENT) { /* There is still room in the ID array. */ break; } } if (i == pDbeWindowPriv->maxAvailableIDs) { /* No more room in the ID array -- reallocate another array. */ XID *pIDs; /* Setup an array pointer for the realloc operation below. */ if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS) { /* We will malloc a new array. */ pIDs = NULL; } else { /* We will realloc a new array. */ pIDs = pDbeWindowPriv->IDs; } /* malloc/realloc a new array and initialize all elements to 0. */ pDbeWindowPriv->IDs = (XID *)realloc(pIDs, (pDbeWindowPriv->maxAvailableIDs+DBE_INCR_MAX_IDS)*sizeof(XID)); if (!pDbeWindowPriv->IDs) { return(BadAlloc); } memset(&pDbeWindowPriv->IDs[pDbeWindowPriv->nBufferIDs], 0, (pDbeWindowPriv->maxAvailableIDs + DBE_INCR_MAX_IDS - pDbeWindowPriv->nBufferIDs) * sizeof(XID)); if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS) { /* We just went from using the initial (static) array to a * newly allocated array. Copy the IDs from the initial array * to the new array. */ memcpy(pDbeWindowPriv->IDs, pDbeWindowPriv->initIDs, DBE_INIT_MAX_IDS * sizeof(XID)); } pDbeWindowPriv->maxAvailableIDs += DBE_INCR_MAX_IDS; } /* Finally, record the buffer ID in the array. */ pDbeWindowPriv->IDs[i] = stuff->buffer; /* Associate the new ID with an existing window priv. */ if (!AddResource(stuff->buffer, dbeWindowPrivResType, (void *)pDbeWindowPriv)) { pDbeWindowPriv->IDs[i] = DBE_FREE_ID_ELEMENT; return(BadAlloc); } } /* else -- A buffer is already associated with the window. */ /* Call the DDX routine to allocate the back buffer. */ status = (*pDbeScreenPriv->AllocBackBufferName)(pWin, stuff->buffer, stuff->swapAction); if ((status != Success) && (pDbeWindowPriv->nBufferIDs == 0)) { /* The DDX buffer allocation routine failed for the first buffer of * this window. */ free(pDbeWindowPriv); return(status); } /* Increment the number of buffers (XIDs) associated with this window. */ pDbeWindowPriv->nBufferIDs++; /* Set swap action on all calls. */ pDbeWindowPriv->swapAction = stuff->swapAction; return(status); } /* ProcDbeAllocateBackBufferName() */ /****************************************************************************** * * DBE DIX Procedure: ProcDbeDeallocateBackBufferName * * Description: * * This function is for processing a DbeDeallocateBackBufferName request. * This request frees a drawable ID that was obtained by a * DbeAllocateBackBufferName request. * * Return Values: * * BadBuffer - buffer to deallocate is not associated with a window * Success * *****************************************************************************/ static int ProcDbeDeallocateBackBufferName(ClientPtr client) { REQUEST(xDbeDeallocateBackBufferNameReq); DbeWindowPrivPtr pDbeWindowPriv; int i; REQUEST_SIZE_MATCH(xDbeDeallocateBackBufferNameReq); /* Buffer name must be valid */ if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client, stuff->buffer, dbeWindowPrivResType, DixDestroyAccess)) || !(SecurityLookupIDByType(client, stuff->buffer, dbeDrawableResType, DixDestroyAccess))) { client->errorValue = stuff->buffer; return(dbeErrorBase + DbeBadBuffer); } /* Make sure that the id is valid for the window. * This is paranoid code since we already looked up the ID by type * above. */ for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++) { /* Loop through the ID list to find the ID. */ if (pDbeWindowPriv->IDs[i] == stuff->buffer) { break; } } if (i == pDbeWindowPriv->nBufferIDs) { /* We did not find the ID in the ID list. */ client->errorValue = stuff->buffer; return(dbeErrorBase + DbeBadBuffer); } FreeResource(stuff->buffer, RT_NONE); return(Success); } /* ProcDbeDeallocateBackBufferName() */ /****************************************************************************** * * DBE DIX Procedure: ProcDbeSwapBuffers * * Description: * * This function is for processing a DbeSwapBuffers request. * This request swaps the buffers for all windows listed, applying the * appropriate swap action for each window. * * Return Values: * * BadAlloc - local allocation failed; this return value is not defined * by the protocol * BadMatch - a window in request is not double-buffered; a window in * request is listed more than once * BadValue - invalid swap action is specified; no swap action is * specified * BadWindow - a window in request is not valid * Success * *****************************************************************************/ static int ProcDbeSwapBuffers(ClientPtr client) { REQUEST(xDbeSwapBuffersReq); WindowPtr pWin; DbeScreenPrivPtr pDbeScreenPriv; DbeSwapInfoPtr swapInfo; xDbeSwapInfo *dbeSwapInfo; int error; unsigned int i, j; unsigned int nStuff; int nStuff_i; /* DDX API requires int for nStuff */ REQUEST_AT_LEAST_SIZE(xDbeSwapBuffersReq); nStuff = stuff->n; /* use local variable for performance. */ if (nStuff == 0) { REQUEST_SIZE_MATCH(xDbeSwapBuffersReq); return(Success); } if (nStuff > UINT32_MAX / sizeof(DbeSwapInfoRec)) return BadAlloc; REQUEST_FIXED_SIZE(xDbeSwapBuffersReq, nStuff * sizeof(xDbeSwapInfo)); /* Get to the swap info appended to the end of the request. */ dbeSwapInfo = (xDbeSwapInfo *)&stuff[1]; /* Allocate array to record swap information. */ swapInfo = (DbeSwapInfoPtr)malloc(nStuff * sizeof(DbeSwapInfoRec)); if (swapInfo == NULL) { return(BadAlloc); } for (i = 0; i < nStuff; i++) { /* Check all windows to swap. */ /* Each window must be a valid window - BadWindow. */ #ifndef NXAGENT_SERVER error = dixLookupWindow(&pWin, dbeSwapInfo[i].window, client, DixWriteAccess); if (error != Success) { free(swapInfo); return error; } #else if (!(pWin = SecurityLookupWindow(dbeSwapInfo[i].window, client, DixWriteAccess))) { free(swapInfo); return(BadWindow); } #endif /* Each window must be double-buffered - BadMatch. */ if (DBE_WINDOW_PRIV(pWin) == NULL) { free(swapInfo); return(BadMatch); } /* Each window must only be specified once - BadMatch. */ for (j = i + 1; j < nStuff; j++) { if (dbeSwapInfo[i].window == dbeSwapInfo[j].window) { free(swapInfo); return(BadMatch); } } /* Each swap action must be valid - BadValue. */ if ((dbeSwapInfo[i].swapAction != XdbeUndefined ) && (dbeSwapInfo[i].swapAction != XdbeBackground) && (dbeSwapInfo[i].swapAction != XdbeUntouched ) && (dbeSwapInfo[i].swapAction != XdbeCopied )) { free(swapInfo); return(BadValue); } /* Everything checks out OK. Fill in the swap info array. */ swapInfo[i].pWindow = pWin; swapInfo[i].swapAction = dbeSwapInfo[i].swapAction; } /* for (i = 0; i < nStuff; i++) */ /* Call the DDX routine to perform the swap(s). The DDX routine should * scan the swap list (swap info), swap any buffers that it knows how to * handle, delete them from the list, and update nStuff to indicate how * many windows it did not handle. * * This scheme allows a range of sophistication in the DDX SwapBuffers() * implementation. Naive implementations could just swap the first buffer * in the list, move the last buffer to the front, decrement nStuff, and * return. The next level of sophistication could be to scan the whole * list for windows on the same screen. Up another level, the DDX routine * could deal with cross-screen synchronization. */ nStuff_i = nStuff; while (nStuff_i > 0) { pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(swapInfo[0].pWindow); error = (*pDbeScreenPriv->SwapBuffers)(client, &nStuff_i, swapInfo); if (error != Success) { free(swapInfo); return(error); } } free(swapInfo); return(Success); } /* ProcDbeSwapBuffers() */ /****************************************************************************** * * DBE DIX Procedure: ProcDbeBeginIdiom * * Description: * * This function is for processing a DbeBeginIdiom request. * This request informs the server that a complex swap will immediately * follow this request. * * Return Values: * * Success * *****************************************************************************/ static int ProcDbeBeginIdiom(ClientPtr client) { /* REQUEST(xDbeBeginIdiomReq); */ DbeScreenPrivPtr pDbeScreenPriv; register int i; REQUEST_SIZE_MATCH(xDbeBeginIdiomReq); for (i = 0; i < screenInfo.numScreens; i++) { pDbeScreenPriv = DBE_SCREEN_PRIV(screenInfo.screens[i]); /* Call the DDX begin idiom procedure if there is one. */ if (pDbeScreenPriv->BeginIdiom) { (*pDbeScreenPriv->BeginIdiom)(client); } } return(Success); } /* ProcDbeBeginIdiom() */ /****************************************************************************** * * DBE DIX Procedure: ProcDbeGetVisualInfo * * Description: * * This function is for processing a ProcDbeGetVisualInfo request. * This request returns information about which visuals support * double buffering. * * Return Values: * * BadDrawable - value in screen specifiers is not a valid drawable * Success * *****************************************************************************/ static int ProcDbeGetVisualInfo(ClientPtr client) { REQUEST(xDbeGetVisualInfoReq); DbeScreenPrivPtr pDbeScreenPriv; xDbeGetVisualInfoReply rep; Drawable *drawables; DrawablePtr *pDrawables = NULL; register int i, j; register int count; /* number of visual infos in reply */ register int length; /* length of reply */ ScreenPtr pScreen; XdbeScreenVisualInfo *pScrVisInfo; REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq); if (stuff->n > UINT32_MAX / sizeof(DrawablePtr)) return BadAlloc; /* Make sure any specified drawables are valid. */ if (stuff->n != 0) { if (!(pDrawables = (DrawablePtr *)malloc(stuff->n * sizeof(DrawablePtr)))) { return(BadAlloc); } drawables = (Drawable *)&stuff[1]; for (i = 0; i < stuff->n; i++) { #ifndef NXAGENT_SERVER register int rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0, DixReadAccess); if (rc != Success) { free(pDrawables); return rc; } #else if (!(pDrawables[i] = (DrawablePtr)SecurityLookupDrawable( drawables[i], client, DixReadAccess))) { free(pDrawables); return(BadDrawable); } #endif } } count = (stuff->n == 0) ? screenInfo.numScreens : stuff->n; if (!(pScrVisInfo = (XdbeScreenVisualInfo *)malloc(count * sizeof(XdbeScreenVisualInfo)))) { if (pDrawables) { free(pDrawables); } return(BadAlloc); } length = 0; for (i = 0; i < count; i++) { pScreen = (stuff->n == 0) ? screenInfo.screens[i] : pDrawables[i]->pScreen; pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); if (!(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i])) { /* We failed to alloc pScrVisInfo[i].visinfo. */ /* Free visinfos that we allocated for previous screen infos.*/ for (j = 0; j < i; j++) { free(pScrVisInfo[j].visinfo); } /* Free pDrawables if we needed to allocate it above. */ if (pDrawables) { free(pDrawables); } return(BadAlloc); } /* Account for n, number of xDbeVisInfo items in list. */ length += sizeof(CARD32); /* Account for n xDbeVisInfo items */ length += pScrVisInfo[i].count * sizeof(xDbeVisInfo); } rep = (xDbeGetVisualInfoReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = length >> 2, .m = count }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.m); } /* Send off reply. */ WriteToClient(client, sizeof(xDbeGetVisualInfoReply), &rep); for (i = 0; i < count; i++) { CARD32 data32; /* For each screen in the reply, send off the visual info */ /* Send off number of visuals. */ data32 = (CARD32)pScrVisInfo[i].count; if (client->swapped) { swapl(&data32); } WriteToClient(client, sizeof(CARD32), &data32); /* Now send off visual info items. */ for (j = 0; j < pScrVisInfo[i].count; j++) { xDbeVisInfo visInfo; /* Copy the data in the client data structure to a protocol * data structure. We will send data to the client from the * protocol data structure. */ visInfo.visualID = (CARD32)pScrVisInfo[i].visinfo[j].visual; visInfo.depth = (CARD8) pScrVisInfo[i].visinfo[j].depth; visInfo.perfLevel = (CARD8) pScrVisInfo[i].visinfo[j].perflevel; if (client->swapped) { swapl(&visInfo.visualID); /* We do not need to swap depth and perfLevel since they are * already 1 byte quantities. */ } /* Write visualID(32), depth(8), perfLevel(8), and pad(16). */ WriteToClient(client, 2*sizeof(CARD32), &visInfo.visualID); } } /* Clean up memory. */ for (i = 0; i < count; i++) { free(pScrVisInfo[i].visinfo); } free(pScrVisInfo); if (pDrawables) { free(pDrawables); } return(client->noClientException); } /* ProcDbeGetVisualInfo() */ /****************************************************************************** * * DBE DIX Procedure: ProcDbeGetbackBufferAttributes * * Description: * * This function is for processing a ProcDbeGetbackBufferAttributes * request. This request returns information about a back buffer. * * Return Values: * * Success * *****************************************************************************/ static int ProcDbeGetBackBufferAttributes(ClientPtr client) { REQUEST(xDbeGetBackBufferAttributesReq); xDbeGetBackBufferAttributesReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; DbeWindowPrivPtr pDbeWindowPriv; REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq); if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client, stuff->buffer, dbeWindowPrivResType, DixReadAccess))) { rep.attributes = None; } else { rep.attributes = pDbeWindowPriv->pWindow->drawable.id; } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.attributes); } WriteToClient(client, sizeof(xDbeGetBackBufferAttributesReply), &rep); return(client->noClientException); } /* ProcDbeGetbackBufferAttributes() */ /****************************************************************************** * * DBE DIX Procedure: ProcDbeDispatch * * Description: * * This function dispatches DBE requests. * *****************************************************************************/ static int ProcDbeDispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_DbeGetVersion: return(ProcDbeGetVersion(client)); case X_DbeAllocateBackBufferName: return(ProcDbeAllocateBackBufferName(client)); case X_DbeDeallocateBackBufferName: return(ProcDbeDeallocateBackBufferName(client)); case X_DbeSwapBuffers: return(ProcDbeSwapBuffers(client)); case X_DbeBeginIdiom: return(ProcDbeBeginIdiom(client)); case X_DbeEndIdiom: return(Success); case X_DbeGetVisualInfo: return(ProcDbeGetVisualInfo(client)); case X_DbeGetBackBufferAttributes: return(ProcDbeGetBackBufferAttributes(client)); default: return(BadRequest); } } /* ProcDbeDispatch() */ /****************************************************************************** * * DBE DIX Procedure: SProcDbeGetVersion * * Description: * * This function is for processing a DbeGetVersion request on a swapped * server. This request returns the major and minor version numbers of * this extension. * * Return Values: * * Success * *****************************************************************************/ static int SProcDbeGetVersion(ClientPtr client) { REQUEST(xDbeGetVersionReq); swaps(&stuff->length); return(ProcDbeGetVersion(client)); } /* SProcDbeGetVersion() */ /****************************************************************************** * * DBE DIX Procedure: SProcDbeAllocateBackBufferName * * Description: * * This function is for processing a DbeAllocateBackBufferName request on * a swapped server. This request allocates a drawable ID used to refer * to the back buffer of a window. * * Return Values: * * BadAlloc - server can not allocate resources * BadIDChoice - id is out of range for client; id is already in use * BadMatch - window is not an InputOutput window; * visual of window is not on list returned by * DBEGetVisualInfo; * BadValue - invalid swap action is specified * BadWindow - window is not a valid window * Success * *****************************************************************************/ static int SProcDbeAllocateBackBufferName(ClientPtr client) { REQUEST(xDbeAllocateBackBufferNameReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq); swapl(&stuff->window); swapl(&stuff->buffer); /* stuff->swapAction is a byte. We do not need to swap this field. */ return(ProcDbeAllocateBackBufferName(client)); } /* SProcDbeAllocateBackBufferName() */ /****************************************************************************** * * DBE DIX Procedure: SProcDbeDeallocateBackBufferName * * Description: * * This function is for processing a DbeDeallocateBackBufferName request * on a swapped server. This request frees a drawable ID that was * obtained by a DbeAllocateBackBufferName request. * * Return Values: * * BadBuffer - buffer to deallocate is not associated with a window * Success * *****************************************************************************/ static int SProcDbeDeallocateBackBufferName(ClientPtr client) { REQUEST (xDbeDeallocateBackBufferNameReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDbeDeallocateBackBufferNameReq); swapl(&stuff->buffer); return(ProcDbeDeallocateBackBufferName(client)); } /* SProcDbeDeallocateBackBufferName() */ /****************************************************************************** * * DBE DIX Procedure: SProcDbeSwapBuffers * * Description: * * This function is for processing a DbeSwapBuffers request on a swapped * server. This request swaps the buffers for all windows listed, * applying the appropriate swap action for each window. * * Return Values: * * BadMatch - a window in request is not double-buffered; a window in * request is listed more than once; all windows in request do * not have the same root * BadValue - invalid swap action is specified * BadWindow - a window in request is not valid * Success * *****************************************************************************/ static int SProcDbeSwapBuffers(ClientPtr client) { REQUEST(xDbeSwapBuffersReq); unsigned int i; xDbeSwapInfo *pSwapInfo; swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xDbeSwapBuffersReq); swapl(&stuff->n); if (stuff->n > UINT32_MAX / sizeof(DbeSwapInfoRec)) return BadAlloc; REQUEST_FIXED_SIZE(xDbeSwapBuffersReq, stuff->n * sizeof(xDbeSwapInfo)); if (stuff->n != 0) { pSwapInfo = (xDbeSwapInfo *)stuff+1; /* The swap info following the fix part of this request is a window(32) * followed by a 1 byte swap action and then 3 pad bytes. We only need * to swap the window information. */ for (i = 0; i < stuff->n; i++) { swapl(&pSwapInfo->window); } } return(ProcDbeSwapBuffers(client)); } /* SProcDbeSwapBuffers() */ /****************************************************************************** * * DBE DIX Procedure: SProcDbeBeginIdiom * * Description: * * This function is for processing a DbeBeginIdiom request on a swapped * server. This request informs the server that a complex swap will * immediately follow this request. * * Return Values: * * Success * *****************************************************************************/ static int SProcDbeBeginIdiom(ClientPtr client) { REQUEST(xDbeBeginIdiomReq); swaps(&stuff->length); return(ProcDbeBeginIdiom(client)); } /* SProcDbeBeginIdiom() */ /****************************************************************************** * * DBE DIX Procedure: SProcDbeGetVisualInfo * * Description: * * This function is for processing a ProcDbeGetVisualInfo request on a * swapped server. This request returns information about which visuals * support double buffering. * * Return Values: * * BadDrawable - value in screen specifiers is not a valid drawable * Success * *****************************************************************************/ static int SProcDbeGetVisualInfo(ClientPtr client) { REQUEST(xDbeGetVisualInfoReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq); swapl(&stuff->n); SwapRestL(stuff); return(ProcDbeGetVisualInfo(client)); } /* SProcDbeGetVisualInfo() */ /****************************************************************************** * * DBE DIX Procedure: SProcDbeGetbackBufferAttributes * * Description: * * This function is for processing a ProcDbeGetbackBufferAttributes * request on a swapped server. This request returns information about a * back buffer. * * Return Values: * * Success * *****************************************************************************/ static int SProcDbeGetBackBufferAttributes(ClientPtr client) { REQUEST (xDbeGetBackBufferAttributesReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq); swapl(&stuff->buffer); return(ProcDbeGetBackBufferAttributes(client)); } /* SProcDbeGetBackBufferAttributes() */ /****************************************************************************** * * DBE DIX Procedure: SProcDbeDispatch * * Description: * * This function dispatches DBE requests on a swapped server. * *****************************************************************************/ static int SProcDbeDispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_DbeGetVersion: return(SProcDbeGetVersion(client)); case X_DbeAllocateBackBufferName: return(SProcDbeAllocateBackBufferName(client)); case X_DbeDeallocateBackBufferName: return(SProcDbeDeallocateBackBufferName(client)); case X_DbeSwapBuffers: return(SProcDbeSwapBuffers(client)); case X_DbeBeginIdiom: return(SProcDbeBeginIdiom(client)); case X_DbeEndIdiom: return(Success); case X_DbeGetVisualInfo: return(SProcDbeGetVisualInfo(client)); case X_DbeGetBackBufferAttributes: return(SProcDbeGetBackBufferAttributes(client)); default: return (BadRequest); } } /* SProcDbeDispatch() */ /****************************************************************************** * * DBE DIX Procedure: DbeSetupBackgroundPainter * * Description: * * This function sets up pGC to clear pixmaps. * * Return Values: * * TRUE - setup was successful * FALSE - the window's background state is NONE * *****************************************************************************/ static Bool DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC) { void *gcvalues[4]; int ts_x_origin, ts_y_origin; PixUnion background; int backgroundState; Mask gcmask; /* First take care of any ParentRelative stuff by altering the * tile/stipple origin to match the coordinates of the upper-left * corner of the first ancestor without a ParentRelative background. * This coordinate is, of course, negative. */ ts_x_origin = ts_y_origin = 0; while (pWin->backgroundState == ParentRelative) { ts_x_origin -= pWin->origin.x; ts_y_origin -= pWin->origin.y; pWin = pWin->parent; } backgroundState = pWin->backgroundState; background = pWin->background; switch (backgroundState) { case BackgroundPixel: gcvalues[0] = (void *)background.pixel; gcvalues[1] = (void *)FillSolid; gcmask = GCForeground|GCFillStyle; break; case BackgroundPixmap: gcvalues[0] = (void *)FillTiled; gcvalues[1] = (void *)background.pixmap; gcvalues[2] = (void *)(long)ts_x_origin; gcvalues[3] = (void *)(long)ts_y_origin; gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin; break; default: /* pWin->backgroundState == None */ return(FALSE); } if (DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE) != 0) { return(FALSE); } return(TRUE); } /* DbeSetupBackgroundPainter() */ /****************************************************************************** * * DBE DIX Procedure: DbeDrawableDelete * * Description: * * This is the resource delete function for dbeDrawableResType. * It is registered when the drawable resource type is created in * DbeExtensionInit(). * * To make resource deletion simple, we do not do anything in this function * and leave all resource deleteion to DbeWindowPrivDelete(), which will * eventually be called or already has been called. Deletion functions are * not guaranteed to be called in any particular order. * *****************************************************************************/ static int DbeDrawableDelete(void * pDrawable, XID id) { return(Success); } /* DbeDrawableDelete() */ /****************************************************************************** * * DBE DIX Procedure: DbeWindowPrivDelete * * Description: * * This is the resource delete function for dbeWindowPrivResType. * It is registered when the drawable resource type is created in * DbeExtensionInit(). * *****************************************************************************/ static int DbeWindowPrivDelete(void * pDbeWinPriv, XID id) { DbeScreenPrivPtr pDbeScreenPriv; DbeWindowPrivPtr pDbeWindowPriv = (DbeWindowPrivPtr)pDbeWinPriv; int i; /* ************************************************************************** ** Remove the buffer ID from the ID array. ************************************************************************** */ /* Find the ID in the ID array. */ i = 0; while ((i < pDbeWindowPriv->nBufferIDs) && (pDbeWindowPriv->IDs[i] != id)) { i++; } if (i == pDbeWindowPriv->nBufferIDs) { /* We did not find the ID in the array. We should never get here. */ return(BadValue); } /* Remove the ID from the array. */ if (i < (pDbeWindowPriv->nBufferIDs - 1)) { /* Compress the buffer ID array, overwriting the ID in the process. */ memmove(&pDbeWindowPriv->IDs[i], &pDbeWindowPriv->IDs[i+1], (pDbeWindowPriv->nBufferIDs - i - 1) * sizeof(XID)); } else { /* We are removing the last ID in the array, in which case, the * assignement below is all that we need to do. */ } pDbeWindowPriv->IDs[pDbeWindowPriv->nBufferIDs - 1] = DBE_FREE_ID_ELEMENT; pDbeWindowPriv->nBufferIDs--; /* If an extended array was allocated, then check to see if the remaining * buffer IDs will fit in the static array. */ if ((pDbeWindowPriv->maxAvailableIDs > DBE_INIT_MAX_IDS) && (pDbeWindowPriv->nBufferIDs == DBE_INIT_MAX_IDS)) { /* Copy the IDs back into the static array. */ memcpy(pDbeWindowPriv->initIDs, pDbeWindowPriv->IDs, DBE_INIT_MAX_IDS * sizeof(XID)); /* Free the extended array; use the static array. */ free(pDbeWindowPriv->IDs); pDbeWindowPriv->IDs = pDbeWindowPriv->initIDs; pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS; } /* ************************************************************************** ** Perform DDX level tasks. ************************************************************************** */ pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW_PRIV( (DbeWindowPrivPtr)pDbeWindowPriv); (*pDbeScreenPriv->WinPrivDelete)((DbeWindowPrivPtr)pDbeWindowPriv, id); /* ************************************************************************** ** Perform miscellaneous tasks if this is the last buffer associated ** with the window. ************************************************************************** */ if (pDbeWindowPriv->nBufferIDs == 0) { /* Reset the DBE window priv pointer. */ pDbeWindowPriv->pWindow->devPrivates[dbeWindowPrivIndex].ptr = (void *)NULL; /* We are done with the window priv. */ free(pDbeWindowPriv); } return(Success); } /* DbeWindowPrivDelete() */ /****************************************************************************** * * DBE DIX Procedure: DbeResetProc * * Description: * * This routine is called at the end of every server generation. * It deallocates any memory reserved for the extension and performs any * other tasks related to shutting down the extension. * *****************************************************************************/ static void DbeResetProc(ExtensionEntry *extEntry) { int i; ScreenPtr pScreen; DbeScreenPrivPtr pDbeScreenPriv; if (dbeScreenPrivIndex < 0) { return; } for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); if (pDbeScreenPriv) { /* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit().*/ pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow; if (pDbeScreenPriv->ResetProc) (*pDbeScreenPriv->ResetProc)(pScreen); if (pDbeScreenPriv->winPrivPrivSizes) { free(pDbeScreenPriv->winPrivPrivSizes); } free(pDbeScreenPriv); } } /* We want to init the initialization function table after every server * reset in DbeRegisterFunction(). */ firstRegistrationPass = TRUE; } /* DbeResetProc() */ /****************************************************************************** * * DBE DIX Procedure: DbeDestroyWindow * * Description: * * This is the wrapper for pScreen->DestroyWindow. * This function frees buffer resources for a window before it is * destroyed. * *****************************************************************************/ static Bool DbeDestroyWindow(WindowPtr pWin) { DbeScreenPrivPtr pDbeScreenPriv; DbeWindowPrivPtr pDbeWindowPriv; ScreenPtr pScreen; Bool ret; /* ************************************************************************** ** 1. Unwrap the member routine. ************************************************************************** */ pScreen = pWin->drawable.pScreen; pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow; /* ************************************************************************** ** 2. Do any work necessary before the member routine is called. ** ** Call the window priv delete function for all buffer IDs associated ** with this window. ************************************************************************** */ if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) { while (pDbeWindowPriv) { /* *DbeWinPrivDelete() will free the window private and set it to * NULL if there are no more buffer IDs associated with this * window. */ FreeResource(pDbeWindowPriv->IDs[0], RT_NONE); pDbeWindowPriv = DBE_WINDOW_PRIV(pWin); } } /* ************************************************************************** ** 3. Call the member routine, saving its result if necessary. ************************************************************************** */ ret = (*pScreen->DestroyWindow)(pWin); /* ************************************************************************** ** 4. Rewrap the member routine, restoring the wrapper value first in case ** the wrapper (or something that it wrapped) change this value. ************************************************************************** */ pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow; pScreen->DestroyWindow = DbeDestroyWindow; /* ************************************************************************** ** 5. Do any work necessary after the member routine has been called. ** ** In this case we do not need to do anything. ************************************************************************** */ return(ret); } /* DbeDestroyWindow() */ /****************************************************************************** * * DBE DIX Procedure: DbeExtensionInit * * Description: * * Called from InitExtensions in main() * *****************************************************************************/ void DbeExtensionInit(void) { ExtensionEntry *extEntry; register int i, j; ScreenPtr pScreen = NULL; DbeScreenPrivPtr pDbeScreenPriv; int nStubbedScreens = 0; Bool ddxInitSuccess; #ifdef PANORAMIX if(!noPanoramiXExtension) return; #endif /* Allocate private pointers in windows and screens. */ if ((dbeScreenPrivIndex = AllocateScreenPrivateIndex()) < 0) { return; } if ((dbeWindowPrivIndex = AllocateWindowPrivateIndex()) < 0) { return; } /* Initialize the priv priv counts between server generations. */ winPrivPrivCount = 0; /* Create the resource types. */ dbeDrawableResType = CreateNewResourceType(DbeDrawableDelete) | RC_DRAWABLE; dbeWindowPrivResType = CreateNewResourceType(DbeWindowPrivDelete); for (i = 0; i < screenInfo.numScreens; i++) { /* For each screen, set up DBE screen privates and init DIX and DDX * interface. */ pScreen = screenInfo.screens[i]; if (!AllocateWindowPrivate(pScreen, dbeWindowPrivIndex, 0) || !(pDbeScreenPriv = (DbeScreenPrivPtr)calloc(1, sizeof(DbeScreenPrivRec)))) { /* If we can not alloc a window or screen private, * then free any privates that we already alloc'ed and return */ for (j = 0; j < i; j++) { free(screenInfo.screens[j]->devPrivates[dbeScreenPrivIndex].ptr); screenInfo.screens[j]->devPrivates[dbeScreenPrivIndex].ptr = NULL; } return; } pScreen->devPrivates[dbeScreenPrivIndex].ptr = (void *)pDbeScreenPriv; /* Store the DBE priv priv size info for later use when allocating * priv privs at the driver level. */ pDbeScreenPriv->winPrivPrivLen = 0; pDbeScreenPriv->winPrivPrivSizes = (unsigned *)NULL; pDbeScreenPriv->totalWinPrivSize = sizeof(DbeWindowPrivRec); /* Copy the resource types */ pDbeScreenPriv->dbeDrawableResType = dbeDrawableResType; pDbeScreenPriv->dbeWindowPrivResType = dbeWindowPrivResType; /* Copy the private indices */ pDbeScreenPriv->dbeScreenPrivIndex = dbeScreenPrivIndex; pDbeScreenPriv->dbeWindowPrivIndex = dbeWindowPrivIndex; if(DbeInitFunct[i]) { /* This screen supports DBE. */ /* Setup DIX. */ pDbeScreenPriv->SetupBackgroundPainter = DbeSetupBackgroundPainter; pDbeScreenPriv->AllocWinPriv = DbeAllocWinPriv; pDbeScreenPriv->AllocWinPrivPrivIndex = DbeAllocWinPrivPrivIndex; pDbeScreenPriv->AllocWinPrivPriv = DbeAllocWinPrivPriv; /* Setup DDX. */ ddxInitSuccess = (*DbeInitFunct[i])(pScreen, pDbeScreenPriv); /* DDX DBE initialization may have the side affect of * reallocating pDbeScreenPriv, so we need to update it. */ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); if (ddxInitSuccess) { /* Wrap DestroyWindow. The DDX initialization function * already wrapped PositionWindow for us. */ pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow; pScreen->DestroyWindow = DbeDestroyWindow; } else { /* DDX initialization failed. Stub the screen. */ DbeStubScreen(pDbeScreenPriv, &nStubbedScreens); } } else { /* This screen does not support DBE. */ #ifndef DISABLE_MI_DBE_BY_DEFAULT /* Setup DIX. */ pDbeScreenPriv->SetupBackgroundPainter = DbeSetupBackgroundPainter; pDbeScreenPriv->AllocWinPriv = DbeAllocWinPriv; pDbeScreenPriv->AllocWinPrivPrivIndex = DbeAllocWinPrivPrivIndex; pDbeScreenPriv->AllocWinPrivPriv = DbeAllocWinPrivPriv; /* Setup DDX. */ ddxInitSuccess = miDbeInit(pScreen, pDbeScreenPriv); /* DDX DBE initialization may have the side affect of * reallocating pDbeScreenPriv, so we need to update it. */ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); if (ddxInitSuccess) { /* Wrap DestroyWindow. The DDX initialization function * already wrapped PositionWindow for us. */ pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow; pScreen->DestroyWindow = DbeDestroyWindow; } else { /* DDX initialization failed. Stub the screen. */ DbeStubScreen(pDbeScreenPriv, &nStubbedScreens); } #else DbeStubScreen(pDbeScreenPriv, &nStubbedScreens); #endif } /* else -- this screen does not support DBE. */ } /* for (i = 0; i < screenInfo.numScreens; i++) */ if (nStubbedScreens == screenInfo.numScreens) { /* All screens stubbed. Clean up and return. */ for (i = 0; i < screenInfo.numScreens; i++) { free(screenInfo.screens[i]->devPrivates[dbeScreenPrivIndex].ptr); pScreen->devPrivates[dbeScreenPrivIndex].ptr = NULL; } return; } /* Now add the extension. */ extEntry = AddExtension(DBE_PROTOCOL_NAME, DbeNumberEvents, DbeNumberErrors, ProcDbeDispatch, SProcDbeDispatch, DbeResetProc, StandardMinorOpcode); dbeErrorBase = extEntry->errorBase; } /* DbeExtensionInit() */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/dbe/dbestruct.h0000644000000000000000000001544513614532331017506 0ustar /****************************************************************************** * * Copyright (c) 1994, 1995 Hewlett-Packard Company * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the Hewlett-Packard * Company shall not be used in advertising or otherwise to promote the * sale, use or other dealings in this Software without prior written * authorization from the Hewlett-Packard Company. * * Header file for DIX-related DBE * *****************************************************************************/ #ifndef DBE_STRUCT_H #define DBE_STRUCT_H /* INCLUDES */ #include #include "windowstr.h" /* DEFINES */ #define DBE_SCREEN_PRIV(pScreen) \ ((dbeScreenPrivIndex < 0) ? \ NULL : \ ((DbeScreenPrivPtr)((pScreen)->devPrivates[dbeScreenPrivIndex].ptr))) #define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \ DBE_SCREEN_PRIV((pDrawable)->pScreen) #define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \ DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen) #define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \ DBE_SCREEN_PRIV((pWindow)->drawable.pScreen) #define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \ DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen) #define DBE_SCREEN_PRIV_FROM_GC(pGC)\ DBE_SCREEN_PRIV((pGC)->pScreen) #define DBE_WINDOW_PRIV(pWindow)\ ((dbeWindowPrivIndex < 0) ? \ NULL : \ ((DbeWindowPrivPtr)(pWindow->devPrivates[dbeWindowPrivIndex].ptr))) /* Initial size of the buffer ID array in the window priv. */ #define DBE_INIT_MAX_IDS 2 /* Reallocation increment for the buffer ID array. */ #define DBE_INCR_MAX_IDS 4 /* Marker for free elements in the buffer ID array. */ #define DBE_FREE_ID_ELEMENT 0 /* TYPEDEFS */ /* Record used to pass swap information between DIX and DDX swapping * procedures. */ typedef struct _DbeSwapInfoRec { WindowPtr pWindow; unsigned char swapAction; } DbeSwapInfoRec, *DbeSwapInfoPtr; /* ****************************************************************************** ** Per-window data ****************************************************************************** */ typedef struct _DbeWindowPrivRec { /* A pointer to the window with which the DBE window private (buffer) is * associated. */ WindowPtr pWindow; /* Last known swap action for this buffer. Legal values for this field * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied. */ unsigned char swapAction; /* Last known buffer size. */ unsigned short width, height; /* Coordinates used for static gravity when the window is positioned. */ short x, y; /* Number of XIDs associated with this buffer. */ int nBufferIDs; /* Capacity of the current buffer ID array, IDs. */ int maxAvailableIDs; /* Pointer to the array of buffer IDs. This initially points to initIDs. * When the static limit of the initIDs array is reached, the array is * reallocated and this pointer is set to the new array instead of initIDs. */ XID *IDs; /* Initial array of buffer IDs. We are defining the XID array within the * window priv to optimize for data locality. In most cases, only one * buffer will be associated with a window. Having the array declared * here can prevent us from accessing the data in another memory page, * possibly resulting in a page swap and loss of performance. Initially we * will use this array to store buffer IDs. For situations where we have * more IDs than can fit in this static array, we will allocate a larger * array to use, possibly suffering a performance loss. */ XID initIDs[DBE_INIT_MAX_IDS]; /* Device-specific private information. */ DevUnion *devPrivates; } DbeWindowPrivRec, *DbeWindowPrivPtr; /* ****************************************************************************** ** Per-screen data ****************************************************************************** */ typedef struct _DbeScreenPrivRec { /* Info for creating window privs */ int winPrivPrivLen; /* Length of privs in DbeWindowPrivRec */ unsigned int *winPrivPrivSizes; /* Array of private record sizes */ unsigned int totalWinPrivSize; /* PrivRec + size of all priv priv ptrs */ /* Resources created by DIX to be used by DDX */ RESTYPE dbeDrawableResType; RESTYPE dbeWindowPrivResType; /* Private indices created by DIX to be used by DDX */ int dbeScreenPrivIndex; int dbeWindowPrivIndex; /* Wrapped functions * It is the responsibilty of the DDX layer to wrap PositionWindow(). * DbeExtensionInit wraps DestroyWindow(). */ PositionWindowProcPtr PositionWindow; DestroyWindowProcPtr DestroyWindow; /* Per-screen DIX routines */ Bool (*SetupBackgroundPainter)( WindowPtr /*pWin*/, GCPtr /*pGC*/ ); DbeWindowPrivPtr (*AllocWinPriv)( ScreenPtr /*pScreen*/ ); int (*AllocWinPrivPrivIndex)( void ); Bool (*AllocWinPrivPriv)( ScreenPtr /*pScreen*/, int /*index*/, unsigned /*amount*/ ); /* Per-screen DDX routines */ Bool (*GetVisualInfo)( ScreenPtr /*pScreen*/, XdbeScreenVisualInfo * /*pVisInfo*/ ); int (*AllocBackBufferName)( WindowPtr /*pWin*/, XID /*bufId*/, int /*swapAction*/ ); int (*SwapBuffers)( ClientPtr /*client*/, int * /*pNumWindows*/, DbeSwapInfoPtr /*swapInfo*/ ); void (*BeginIdiom)( ClientPtr /*client*/ ); void (*EndIdiom)( ClientPtr /*client*/ ); void (*WinPrivDelete)( DbeWindowPrivPtr /*pDbeWindowPriv*/, XID /*bufId*/ ); void (*ResetProc)( ScreenPtr /*pScreen*/ ); /* Device-specific private information. */ DevUnion *devPrivates; } DbeScreenPrivRec, *DbeScreenPrivPtr; #endif /* DBE_STRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/dbe/Imakefile0000644000000000000000000000107313614532331017137 0ustar #include SRCS = dbe.c midbe.c OBJS = dbe.o midbe.o INCLUDES = -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) $(EXTRAINCLUDES) `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln #if defined(NXAgentServer) && NXAgentServer NX_DEFINES = -DNXAGENT_SERVER #endif DEFINES = \ $(NX_DEFINES) \ $(NULL) NormalLibraryObjectRule() NormalLibraryTarget(dbe,$(OBJS)) LintLibraryTarget(dbe,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() nx-libs-3.5.99.23/nx-X11/programs/Xserver/dbe/midbe.c0000644000000000000000000006231613614532331016561 0ustar /****************************************************************************** * * Copyright (c) 1994, 1995 Hewlett-Packard Company * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the Hewlett-Packard * Company shall not be used in advertising or otherwise to promote the * sale, use or other dealings in this Software without prior written * authorization from the Hewlett-Packard Company. * * Machine-independent DBE code * *****************************************************************************/ /* INCLUDES */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "os.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "extnsionst.h" #include "dixstruct.h" #include "resource.h" #include "opaque.h" #include "dbestruct.h" #include "midbestr.h" #include "regionstr.h" #include "gcstruct.h" #include "inputstr.h" #include "midbe.h" #include static int miDbePrivPrivGeneration = 0; static int miDbeWindowPrivPrivIndex = -1; static RESTYPE dbeDrawableResType; static RESTYPE dbeWindowPrivResType; static int dbeScreenPrivIndex = -1; static int dbeWindowPrivIndex = -1; /****************************************************************************** * * DBE MI Procedure: miDbeGetVisualInfo * * Description: * * This is the MI function for the DbeGetVisualInfo request. This function * is called through pDbeScreenPriv->GetVisualInfo. This function is also * called for the DbeAllocateBackBufferName request at the extension level; * it is called by ProcDbeAllocateBackBufferName() in dbe.c. * * If memory allocation fails or we can not get the visual info, this * function returns FALSE. Otherwise, it returns TRUE for success. * *****************************************************************************/ static Bool miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo *pScrVisInfo) { register int i, j, k; register int count; DepthPtr pDepth; XdbeVisualInfo *visInfo; /* Determine number of visuals for this screen. */ for (i = 0, count = 0; i < pScreen->numDepths; i++) { count += pScreen->allowedDepths[i].numVids; } /* Allocate an array of XdbeVisualInfo items. */ if (!(visInfo = (XdbeVisualInfo *)malloc(count * sizeof(XdbeVisualInfo)))) { return(FALSE); /* memory alloc failure */ } for (i = 0, k = 0; i < pScreen->numDepths; i++) { /* For each depth of this screen, get visual information. */ pDepth = &pScreen->allowedDepths[i]; for (j = 0; j < pDepth->numVids; j++) { /* For each visual for this depth of this screen, get visual ID * and visual depth. Since this is MI code, we will always return * the same performance level for all visuals (0). A higher * performance level value indicates higher performance. */ visInfo[k].visual = pDepth->vids[j]; visInfo[k].depth = pDepth->depth; visInfo[k].perflevel = 0; k++; } } /* Record the number of visuals and point visual_depth to * the array of visual info. */ pScrVisInfo->count = count; pScrVisInfo->visinfo = visInfo; return(TRUE); /* success */ } /* miDbeGetVisualInfo() */ /****************************************************************************** * * DBE MI Procedure: miAllocBackBufferName * * Description: * * This is the MI function for the DbeAllocateBackBufferName request. * *****************************************************************************/ static int miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) { ScreenPtr pScreen; DbeWindowPrivPtr pDbeWindowPriv; MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv; DbeScreenPrivPtr pDbeScreenPriv; GCPtr pGC; xRectangle clearRect; pScreen = pWin->drawable.pScreen; pDbeWindowPriv = DBE_WINDOW_PRIV(pWin); if (pDbeWindowPriv->nBufferIDs == 0) { /* There is no buffer associated with the window. * We have to create the window priv priv. Remember, the window * priv was created at the DIX level, so all we need to do is * create the priv priv and attach it to the priv. */ pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); /* Setup the window priv priv. */ pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); pDbeWindowPrivPriv->pDbeWindowPriv = pDbeWindowPriv; /* Get a front pixmap. */ if (!(pDbeWindowPrivPriv->pFrontBuffer = (*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width, pDbeWindowPriv->height, pWin->drawable.depth, 0))) { return(BadAlloc); } /* Get a back pixmap. */ if (!(pDbeWindowPrivPriv->pBackBuffer = (*pScreen->CreatePixmap)(pScreen, pDbeWindowPriv->width, pDbeWindowPriv->height, pWin->drawable.depth, 0))) { (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer); return(BadAlloc); } /* Make the back pixmap a DBE drawable resource. */ if (!AddResource(bufId, dbeDrawableResType, (void *)pDbeWindowPrivPriv->pBackBuffer)) { /* free the buffer and the drawable resource */ FreeResource(bufId, RT_NONE); return(BadAlloc); } /* Attach the priv priv to the priv. */ pDbeWindowPriv->devPrivates[miDbeWindowPrivPrivIndex].ptr = (void *)pDbeWindowPrivPriv; /* Clear the back buffer. */ pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC)) { ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC); clearRect.x = clearRect.y = 0; clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width; clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height; (*pGC->ops->PolyFillRect)( (DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC, 1, &clearRect); } FreeScratchGC(pGC); } /* if no buffer associated with the window */ else { /* A buffer is already associated with the window. * Place the new buffer ID information at the head of the ID list. */ /* Associate the new ID with an existing pixmap. */ pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); if (!AddResource(bufId, dbeDrawableResType, (void *)pDbeWindowPrivPriv->pBackBuffer)) { return(BadAlloc); } } return(Success); } /* miDbeAllocBackBufferName() */ /****************************************************************************** * * DBE MI Procedure: miDbeAliasBuffers * * Description: * * This function associates all XIDs of a buffer with the back pixmap * stored in the window priv. * *****************************************************************************/ static void miDbeAliasBuffers(DbeWindowPrivPtr pDbeWindowPriv) { int i; MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++) { ChangeResourceValue(pDbeWindowPriv->IDs[i], dbeDrawableResType, (void *)pDbeWindowPrivPriv->pBackBuffer); } } /* miDbeAliasBuffers() */ /****************************************************************************** * * DBE MI Procedure: miDbeSwapBuffers * * Description: * * This is the MI function for the DbeSwapBuffers request. * *****************************************************************************/ static int miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo) { DbeScreenPrivPtr pDbeScreenPriv; GCPtr pGC; WindowPtr pWin; MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv; PixmapPtr pTmpBuffer; xRectangle clearRect; pWin = swapInfo[0].pWindow; pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin); pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin); pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); /* ********************************************************************** ** Setup before swap. ********************************************************************** */ switch(swapInfo[0].swapAction) { case XdbeUndefined: break; case XdbeBackground: break; case XdbeUntouched: ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer, pGC); (*pGC->ops->CopyArea)((DrawablePtr)pWin, (DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer, pGC, 0, 0, pWin->drawable.width, pWin->drawable.height, 0, 0); break; case XdbeCopied: break; } /* ********************************************************************** ** Swap. ********************************************************************** */ ValidateGC((DrawablePtr)pWin, pGC); (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, (DrawablePtr)pWin, pGC, 0, 0, pWin->drawable.width, pWin->drawable.height, 0, 0); /* ********************************************************************** ** Tasks after swap. ********************************************************************** */ switch(swapInfo[0].swapAction) { case XdbeUndefined: break; case XdbeBackground: if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC)) { ValidateGC((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC); clearRect.x = 0; clearRect.y = 0; clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width; clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height; (*pGC->ops->PolyFillRect)( (DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC, 1, &clearRect); } break; case XdbeUntouched: /* Swap pixmap pointers. */ pTmpBuffer = pDbeWindowPrivPriv->pBackBuffer; pDbeWindowPrivPriv->pBackBuffer = pDbeWindowPrivPriv->pFrontBuffer; pDbeWindowPrivPriv->pFrontBuffer = pTmpBuffer; miDbeAliasBuffers(pDbeWindowPrivPriv->pDbeWindowPriv); break; case XdbeCopied: break; } /* Remove the swapped window from the swap information array and decrement * pNumWindows to indicate to the DIX level how many windows were actually * swapped. */ if (*pNumWindows > 1) { /* We were told to swap more than one window, but we only swapped the * first one. Remove the first window in the list by moving the last * window to the beginning. */ swapInfo[0].pWindow = swapInfo[*pNumWindows - 1].pWindow; swapInfo[0].swapAction = swapInfo[*pNumWindows - 1].swapAction; /* Clear the last window information just to be safe. */ swapInfo[*pNumWindows - 1].pWindow = (WindowPtr)NULL; swapInfo[*pNumWindows - 1].swapAction = 0; } else { /* Clear the window information just to be safe. */ swapInfo[0].pWindow = (WindowPtr)NULL; swapInfo[0].swapAction = 0; } (*pNumWindows)--; FreeScratchGC(pGC); return(Success); } /* miSwapBuffers() */ /****************************************************************************** * * DBE MI Procedure: miDbeWinPrivDelete * * Description: * * This is the MI function for deleting the dbeWindowPrivResType resource. * This function is invoked indirectly by calling FreeResource() to free * the resources associated with a DBE buffer ID. There are 5 ways that * miDbeWinPrivDelete() can be called by FreeResource(). They are: * * - A DBE window is destroyed, in which case the DbeDestroyWindow() * wrapper is invoked. The wrapper calls FreeResource() for all DBE * buffer IDs. * * - miDbeAllocBackBufferName() calls FreeResource() to clean up resources * after a buffer allocation failure. * * - The PositionWindow wrapper, miDbePositionWindow(), calls * FreeResource() when it fails to create buffers of the new size. * FreeResource() is called for all DBE buffer IDs. * * - FreeClientResources() calls FreeResource() when a client dies or the * the server resets. * * When FreeResource() is called for a DBE buffer ID, the delete function * for the only other type of DBE resource, dbeDrawableResType, is also * invoked. This delete function (DbeDrawableDelete) is a NOOP to make * resource deletion easier. It is not guaranteed which delete function is * called first. Hence, we will let miDbeWinPrivDelete() free all DBE * resources. * * This function deletes/frees the following stuff associated with * the window private: * * - the ID node in the ID list representing the passed in ID. * * In addition, pDbeWindowPriv->nBufferIDs is decremented. * * If this function is called for the last/only buffer ID for a window, * these are additionally deleted/freed: * * - the front and back pixmaps * - the window priv itself * *****************************************************************************/ static void miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId) { MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv; if (pDbeWindowPriv->nBufferIDs != 0) { /* We still have at least one more buffer ID associated with this * window. */ return; } /* We have no more buffer IDs associated with this window. We need to * free some stuff. */ pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); /* Destroy the front and back pixmaps. */ if (pDbeWindowPrivPriv->pFrontBuffer) { (*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)( pDbeWindowPrivPriv->pFrontBuffer); } if (pDbeWindowPrivPriv->pBackBuffer) { (*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)( pDbeWindowPrivPriv->pBackBuffer); } } /* miDbeWinPrivDelete() */ /****************************************************************************** * * DBE MI Procedure: miDbePositionWindow * * Description: * * This function was cloned from miMbxPositionWindow() in mimultibuf.c. * This function resizes the buffer when the window is resized. * *****************************************************************************/ static Bool miDbePositionWindow(WindowPtr pWin, int x, int y) { ScreenPtr pScreen; DbeScreenPrivPtr pDbeScreenPriv; DbeWindowPrivPtr pDbeWindowPriv; int width, height; int dx, dy, dw, dh; int sourcex, sourcey; int destx, desty; int savewidth, saveheight; PixmapPtr pFrontBuffer; PixmapPtr pBackBuffer; Bool clear; GCPtr pGC; xRectangle clearRect; Bool ret; /* ************************************************************************** ** 1. Unwrap the member routine. ************************************************************************** */ pScreen = pWin->drawable.pScreen; pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); pScreen->PositionWindow = pDbeScreenPriv->PositionWindow; /* ************************************************************************** ** 2. Do any work necessary before the member routine is called. ** ** In this case we do not need to do anything. ************************************************************************** */ /* ************************************************************************** ** 3. Call the member routine, saving its result if necessary. ************************************************************************** */ ret = (*pScreen->PositionWindow)(pWin, x, y); /* ************************************************************************** ** 4. Rewrap the member routine, restoring the wrapper value first in case ** the wrapper (or something that it wrapped) change this value. ************************************************************************** */ pDbeScreenPriv->PositionWindow = pScreen->PositionWindow; pScreen->PositionWindow = miDbePositionWindow; /* ************************************************************************** ** 5. Do any work necessary after the member routine has been called. ************************************************************************** */ if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) { return(ret); } if (pDbeWindowPriv->width == pWin->drawable.width && pDbeWindowPriv->height == pWin->drawable.height) { return(ret); } width = pWin->drawable.width; height = pWin->drawable.height; dx = pWin->drawable.x - pDbeWindowPriv->x; dy = pWin->drawable.y - pDbeWindowPriv->y; dw = width - pDbeWindowPriv->width; dh = height - pDbeWindowPriv->height; GravityTranslate (0, 0, -dx, -dy, dw, dh, pWin->bitGravity, &destx, &desty); clear = ((pDbeWindowPriv->width < (unsigned short)width ) || (pDbeWindowPriv->height < (unsigned short)height) || (pWin->bitGravity == ForgetGravity)); sourcex = 0; sourcey = 0; savewidth = pDbeWindowPriv->width; saveheight = pDbeWindowPriv->height; /* Clip rectangle to source and destination. */ if (destx < 0) { savewidth += destx; sourcex -= destx; destx = 0; } if (destx + savewidth > width) { savewidth = width - destx; } if (desty < 0) { saveheight += desty; sourcey -= desty; desty = 0; } if (desty + saveheight > height) { saveheight = height - desty; } pDbeWindowPriv->width = width; pDbeWindowPriv->height = height; pDbeWindowPriv->x = pWin->drawable.x; pDbeWindowPriv->y = pWin->drawable.y; pGC = GetScratchGC (pWin->drawable.depth, pScreen); if (clear) { if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC)) { clearRect.x = 0; clearRect.y = 0; clearRect.width = width; clearRect.height = height; } else { clear = FALSE; } } /* Create DBE buffer pixmaps equal to size of resized window. */ pFrontBuffer = (*pScreen->CreatePixmap)(pScreen, width, height, pWin->drawable.depth, 0); pBackBuffer = (*pScreen->CreatePixmap)(pScreen, width, height, pWin->drawable.depth, 0); if (!pFrontBuffer || !pBackBuffer) { /* We failed at creating 1 or 2 of the pixmaps. */ if (pFrontBuffer) { (*pScreen->DestroyPixmap)(pFrontBuffer); } if (pBackBuffer) { (*pScreen->DestroyPixmap)(pBackBuffer); } /* Destroy all buffers for this window. */ while (pDbeWindowPriv) { /* DbeWindowPrivDelete() will free the window private if there no * more buffer IDs associated with this window. */ FreeResource(pDbeWindowPriv->IDs[0], RT_NONE); pDbeWindowPriv = DBE_WINDOW_PRIV(pWin); } FreeScratchGC(pGC); return(FALSE); } else { /* Clear out the new DBE buffer pixmaps. */ MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv; pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); ValidateGC((DrawablePtr)pFrontBuffer, pGC); /* I suppose this could avoid quite a bit of work if * it computed the minimal area required. */ if (clear) { (*pGC->ops->PolyFillRect)((DrawablePtr)pFrontBuffer, pGC, 1, &clearRect); (*pGC->ops->PolyFillRect)((DrawablePtr)pBackBuffer , pGC, 1, &clearRect); } /* Copy the contents of the old DBE pixmaps to the new pixmaps. */ if (pWin->bitGravity != ForgetGravity) { (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer, (DrawablePtr)pFrontBuffer, pGC, sourcex, sourcey, savewidth, saveheight, destx, desty); (*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, (DrawablePtr)pBackBuffer, pGC, sourcex, sourcey, savewidth, saveheight, destx, desty); } /* Destroy the old pixmaps, and point the DBE window priv to the new * pixmaps. */ (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pFrontBuffer); (*pScreen->DestroyPixmap)(pDbeWindowPrivPriv->pBackBuffer); pDbeWindowPrivPriv->pFrontBuffer = pFrontBuffer; pDbeWindowPrivPriv->pBackBuffer = pBackBuffer; /* Make sure all XID are associated with the new back pixmap. */ miDbeAliasBuffers(pDbeWindowPriv); FreeScratchGC(pGC); } return(ret); } /* miDbePositionWindow() */ /****************************************************************************** * * DBE MI Procedure: miDbeResetProc * * Description: * * This function is called from DbeResetProc(), which is called at the end * of every server generation. This function peforms any MI-specific * shutdown tasks. * *****************************************************************************/ static void miDbeResetProc(ScreenPtr pScreen) { DbeScreenPrivPtr pDbeScreenPriv; pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); /* Unwrap wrappers */ pScreen->PositionWindow = pDbeScreenPriv->PositionWindow; } /* miDbeResetProc() */ /****************************************************************************** * * DBE MI Procedure: miDbeInit * * Description: * * This is the MI initialization function called by DbeExtensionInit(). * *****************************************************************************/ Bool miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv) { /* Copy resource types created by DIX */ dbeDrawableResType = pDbeScreenPriv->dbeDrawableResType; dbeWindowPrivResType = pDbeScreenPriv->dbeWindowPrivResType; /* Copy private indices created by DIX */ dbeScreenPrivIndex = pDbeScreenPriv->dbeScreenPrivIndex; dbeWindowPrivIndex = pDbeScreenPriv->dbeWindowPrivIndex; /* Reset the window priv privs if generations do not match. */ if (miDbePrivPrivGeneration != serverGeneration) { /* ********************************************************************** ** Allocate the window priv priv. ********************************************************************** */ miDbeWindowPrivPrivIndex = (*pDbeScreenPriv->AllocWinPrivPrivIndex)(); /* Make sure we only do this code once. */ miDbePrivPrivGeneration = serverGeneration; } /* if -- Reset priv privs. */ if (!(*pDbeScreenPriv->AllocWinPrivPriv)(pScreen, miDbeWindowPrivPrivIndex, sizeof(MiDbeWindowPrivPrivRec))) { return(FALSE); } /* Wrap functions. */ pDbeScreenPriv->PositionWindow = pScreen->PositionWindow; pScreen->PositionWindow = miDbePositionWindow; /* Initialize the per-screen DBE function pointers. */ pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo; pDbeScreenPriv->AllocBackBufferName = miDbeAllocBackBufferName; pDbeScreenPriv->SwapBuffers = miDbeSwapBuffers; pDbeScreenPriv->BeginIdiom = 0; pDbeScreenPriv->EndIdiom = 0; pDbeScreenPriv->ResetProc = miDbeResetProc; pDbeScreenPriv->WinPrivDelete = miDbeWinPrivDelete; return(TRUE); } /* miDbeInit() */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/dbe/midbe.h0000644000000000000000000000346713614532331016570 0ustar /****************************************************************************** * Copyright (c) 1994, 1995 Hewlett-Packard Company * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the Hewlett-Packard * Company shall not be used in advertising or otherwise to promote the * sale, use or other dealings in this Software without prior written * authorization from the Hewlett-Packard Company. * * Header file for users of machine-independent DBE code * *****************************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef MIDBE_H #define MIDBE_H /* EXTERNS */ extern Bool miDbeInit( ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv ); #endif /* MIDBE_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/dbe/midbestr.h0000644000000000000000000000711013614532331017306 0ustar /****************************************************************************** * * Copyright (c) 1994, 1995 Hewlett-Packard Company * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the Hewlett-Packard * Company shall not be used in advertising or otherwise to promote the * sale, use or other dealings in this Software without prior written * authorization from the Hewlett-Packard Company. * * Header file for users of machine-independent DBE code * *****************************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef MIDBE_STRUCT_H #define MIDBE_STRUCT_H /* DEFINES */ #define MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv) \ (((miDbeWindowPrivPrivIndex < 0) || (!pDbeWindowPriv)) ? \ NULL : \ ((MiDbeWindowPrivPrivPtr) \ ((pDbeWindowPriv)->devPrivates[miDbeWindowPrivPrivIndex].ptr))) #define MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin)\ MI_DBE_WINDOW_PRIV_PRIV(DBE_WINDOW_PRIV(pWin)) #define MI_DBE_SCREEN_PRIV_PRIV(pDbeScreenPriv) \ (((miDbeScreenPrivPrivIndex < 0) || (!pDbeScreenPriv)) ? \ NULL : \ ((MiDbeScreenPrivPrivPtr) \ ((pDbeScreenPriv)->devPrivates[miDbeScreenPrivPrivIndex].ptr))) /* TYPEDEFS */ typedef struct _MiDbeWindowPrivPrivRec { /* Place machine-specific fields in here. * Since this is mi code, we do not really have machine-specific fields. */ /* Pointer to a drawable that contains the contents of the back buffer. */ PixmapPtr pBackBuffer; /* Pointer to a drawable that contains the contents of the front buffer. * This pointer is only used for the XdbeUntouched swap action. For that * swap action, we need to copy the front buffer (window) contents into * this drawable, copy the contents of current back buffer drawable (the * back buffer) into the window, swap the front and back drawable pointers, * and then swap the drawable/resource associations in the resource * database. */ PixmapPtr pFrontBuffer; /* Pointer back to our window private with which we are associated. */ DbeWindowPrivPtr pDbeWindowPriv; } MiDbeWindowPrivPrivRec, *MiDbeWindowPrivPrivPtr; typedef struct _MiDbeScreenPrivPrivRec { /* Place machine-specific fields in here. * Since this is mi code, we do not really have machine-specific fields. */ /* Pointer back to our screen private with which we are associated. */ DbeScreenPrivPtr pDbeScreenPriv; } MiDbeScreenPrivPrivRec, *MiDbeScreenPrivPrivPtr; #endif /* MIDBE_STRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/atom.c0000644000000000000000000001251213614532331016464 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include "misc.h" #include "resource.h" #include "dix.h" #define InitialTableSize 100 typedef struct _Node { struct _Node *left, *right; Atom a; unsigned int fingerPrint; const char *string; } NodeRec, *NodePtr; static Atom lastAtom = None; static NodePtr atomRoot = (NodePtr)NULL; static unsigned long tableLength; static NodePtr *nodeTable; void FreeAtom(NodePtr patom); Atom MakeAtom(const char *string, unsigned len, Bool makeit) { register NodePtr * np; unsigned i; int comp; register unsigned int fp = 0; np = &atomRoot; for (i = 0; i < (len+1)/2; i++) { fp = fp * 27 + string[i]; fp = fp * 27 + string[len - 1 - i]; } while (*np != (NodePtr) NULL) { if (fp < (*np)->fingerPrint) np = &((*np)->left); else if (fp > (*np)->fingerPrint) np = &((*np)->right); else { /* now start testing the strings */ comp = strncmp(string, (*np)->string, (int)len); if ((comp < 0) || ((comp == 0) && (len < strlen((*np)->string)))) np = &((*np)->left); else if (comp > 0) np = &((*np)->right); else return(*np)->a; } } if (makeit) { register NodePtr nd; nd = (NodePtr) malloc(sizeof(NodeRec)); if (!nd) return BAD_RESOURCE; if (lastAtom < XA_LAST_PREDEFINED) { nd->string = string; } else { nd->string = strndup(string, len); if (!nd->string) { free(nd); return BAD_RESOURCE; } } if ((lastAtom + 1) >= tableLength) { NodePtr *table; table = (NodePtr *) realloc(nodeTable, tableLength * (2 * sizeof(NodePtr))); if (!table) { if (nd->string != string) /* nd->string has been strdup'ed */ free((char *)nd->string); free(nd); return BAD_RESOURCE; } tableLength <<= 1; nodeTable = table; } *np = nd; nd->left = nd->right = (NodePtr) NULL; nd->fingerPrint = fp; nd->a = (++lastAtom); *(nodeTable+lastAtom) = nd; return nd->a; } else return None; } Bool ValidAtom(Atom atom) { return (atom != None) && (atom <= lastAtom); } const char * NameForAtom(Atom atom) { NodePtr node; if (atom > lastAtom) return 0; if ((node = nodeTable[atom]) == (NodePtr)NULL) return 0; return node->string; } void AtomError() { FatalError("initializing atoms"); } void FreeAtom(NodePtr patom) { if(patom->left) FreeAtom(patom->left); if(patom->right) FreeAtom(patom->right); if (patom->a > XA_LAST_PREDEFINED) free((char *)patom->string); free(patom); } void FreeAllAtoms() { if(atomRoot == (NodePtr)NULL) return; FreeAtom(atomRoot); atomRoot = (NodePtr)NULL; free(nodeTable); nodeTable = (NodePtr *)NULL; lastAtom = None; } void InitAtoms() { FreeAllAtoms(); tableLength = InitialTableSize; nodeTable = (NodePtr *)malloc(InitialTableSize*sizeof(NodePtr)); if (!nodeTable) AtomError(); nodeTable[None] = (NodePtr)NULL; MakePredeclaredAtoms(); if (lastAtom != XA_LAST_PREDEFINED) AtomError (); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/buildatoms0000644000000000000000000000232213614532331017444 0ustar #!/bin/sh hfile=../../../include/Xatom.h cfile=initatoms.c rm -f $hfile $cfile umask 222 awk ' BEGIN { hfile = "'$hfile'"; cfile = "'$cfile'"; hformat = "#define XA_%s ((Atom) %d)\n"; printf("#ifndef XATOM_H\n") > hfile; printf("#define XATOM_H 1\n\n") > hfile; printf("/* THIS IS A GENERATED FILE\n") > hfile; printf(" *\n") > hfile; printf(" * Do not change! Changing this file implies a protocol change!\n") > hfile; printf(" */\n\n") > hfile; printf("/* THIS IS A GENERATED FILE\n") > cfile; printf(" *\n") > cfile; printf(" * Do not change! Changing this file implies a protocol change!\n") > cfile; printf(" */\n\n") > cfile; printf("#include \"X.h\"\n") > cfile; printf("#include \"Xatom.h\"\n") > cfile; printf("#include \"misc.h\"\n") > cfile; printf("#include \"dix.h\"\n") > cfile; printf("void MakePredeclaredAtoms()\n") > cfile; printf("{\n") > cfile; } NF == 2 && $2 == "@" { printf(hformat, $1, ++atomno) > hfile ; printf(" if (MakeAtom(\"%s\", %d, 1) != XA_%s) AtomError();\n", $1, length($1), $1) > cfile ; } END { printf("\n") > hfile; printf(hformat, "LAST_PREDEFINED", atomno) > hfile ; printf("#endif /* XATOM_H */\n") > hfile; printf("}\n") > cfile ; } ' BuiltInAtoms exit 0 nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/colormap.c0000644000000000000000000021707113614532331017347 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include "misc.h" #include "dix.h" #include "colormapst.h" #include "os.h" #include "scrnintstr.h" #include "resource.h" #include "windowstr.h" extern XID clientErrorValue; extern int colormapPrivateCount; static Pixel FindBestPixel( EntryPtr /*pentFirst*/, int /*size*/, xrgb * /*prgb*/, int /*channel*/ ); static int AllComp( EntryPtr /*pent*/, xrgb * /*prgb*/ ); static int RedComp( EntryPtr /*pent*/, xrgb * /*prgb*/ ); static int GreenComp( EntryPtr /*pent*/, xrgb * /*prgb*/ ); static int BlueComp( EntryPtr /*pent*/, xrgb * /*prgb*/ ); static void FreePixels( register ColormapPtr /*pmap*/, register int /*client*/ ); static void CopyFree( int /*channel*/, int /*client*/, ColormapPtr /*pmapSrc*/, ColormapPtr /*pmapDst*/ ); static void FreeCell( ColormapPtr /*pmap*/, Pixel /*i*/, int /*channel*/ ); static void UpdateColors( ColormapPtr /*pmap*/ ); static int AllocDirect( int /*client*/, ColormapPtr /*pmap*/, int /*c*/, int /*r*/, int /*g*/, int /*b*/, Bool /*contig*/, Pixel * /*pixels*/, Pixel * /*prmask*/, Pixel * /*pgmask*/, Pixel * /*pbmask*/ ); static int AllocPseudo( int /*client*/, ColormapPtr /*pmap*/, int /*c*/, int /*r*/, Bool /*contig*/, Pixel * /*pixels*/, Pixel * /*pmask*/, Pixel ** /*pppixFirst*/ ); static Bool AllocCP( ColormapPtr /*pmap*/, EntryPtr /*pentFirst*/, int /*count*/, int /*planes*/, Bool /*contig*/, Pixel * /*pixels*/, Pixel * /*pMask*/ ); static Bool AllocShared( ColormapPtr /*pmap*/, Pixel * /*ppix*/, int /*c*/, int /*r*/, int /*g*/, int /*b*/, Pixel /*rmask*/, Pixel /*gmask*/, Pixel /*bmask*/, Pixel * /*ppixFirst*/ ); static int FreeCo( ColormapPtr /*pmap*/, int /*client*/, int /*color*/, int /*npixIn*/, Pixel * /*ppixIn*/, Pixel /*mask*/ ); static int TellNoMap( WindowPtr /*pwin*/, Colormap * /*pmid*/ ); static void FindColorInRootCmap ( ColormapPtr /* pmap */, EntryPtr /* pentFirst */, int /* size */, xrgb* /* prgb */, Pixel* /* pPixel */, int /* channel */, ColorCompareProcPtr /* comp */ ); #define NUMRED(vis) ((vis->redMask >> vis->offsetRed) + 1) #define NUMGREEN(vis) ((vis->greenMask >> vis->offsetGreen) + 1) #define NUMBLUE(vis) ((vis->blueMask >> vis->offsetBlue) + 1) #if COMPOSITE #define ALPHAMASK(vis) ((vis)->nplanes < 32 ? 0 : \ (CARD32) ~((vis)->redMask|(vis)->greenMask|(vis)->blueMask)) #else #define ALPHAMASK(vis) 0 #endif #define RGBMASK(vis) (vis->redMask | vis->greenMask | vis->blueMask | ALPHAMASK(vis)) /* GetNextBitsOrBreak(bits, mask, base) -- * (Suggestion: First read the macro, then read this explanation. * * Either generate the next value to OR in to a pixel or break out of this * while loop * * This macro is used when we're trying to generate all 2^n combinations of * bits in mask. What we're doing here is counting in binary, except that * the bits we use to count may not be contiguous. This macro will be * called 2^n times, returning a different value in bits each time. Then * it will cause us to break out of a surrounding loop. (It will always be * called from within a while loop.) * On call: mask is the value we want to find all the combinations for * base has 1 bit set where the least significant bit of mask is set * * For example,if mask is 01010, base should be 0010 and we count like this: * 00010 (see this isn't so hard), * then we add base to bits and get 0100. (bits & ~mask) is (0100 & 0100) so * we add that to bits getting (0100 + 0100) = * 01000 for our next value. * then we add 0010 to get * 01010 and we're done (easy as 1, 2, 3) */ #define GetNextBitsOrBreak(bits, mask, base) \ if((bits) == (mask)) \ break; \ (bits) += (base); \ while((bits) & ~(mask)) \ (bits) += ((bits) & ~(mask)); /* ID of server as client */ #define SERVER_ID 0 typedef struct _colorResource { Colormap mid; int client; } colorResource; /* Invariants: * refcnt == 0 means entry is empty * refcnt > 0 means entry is useable by many clients, so it can't be changed * refcnt == AllocPrivate means entry owned by one client only * fShared should only be set if refcnt == AllocPrivate, and only in red map */ /** * Create and initialize the color map * * \param mid resource to use for this colormap * \param alloc 1 iff all entries are allocated writable */ int CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, ColormapPtr *ppcmap, int alloc, int client) { int class, size; unsigned long sizebytes; ColormapPtr pmap; register EntryPtr pent; int i; register Pixel *ppix, **pptr; class = pVisual->class; if(!(class & DynamicClass) && (alloc != AllocNone) && (client != SERVER_ID)) return (BadMatch); size = pVisual->ColormapEntries; sizebytes = (size * sizeof(Entry)) + (MAXCLIENTS * sizeof(Pixel *)) + (MAXCLIENTS * sizeof(int)); if ((class | DynamicClass) == DirectColor) sizebytes *= 3; sizebytes += sizeof(ColormapRec); pmap = (ColormapPtr) malloc(sizebytes); if (!pmap) return (BadAlloc); #if defined(_XSERVER64) pmap->pad0 = 0; pmap->pad1 = 0; #if (X_BYTE_ORDER == X_LITTLE_ENDIAN) pmap->pad2 = 0; #endif #endif pmap->red = (EntryPtr)((char *)pmap + sizeof(ColormapRec)); sizebytes = size * sizeof(Entry); pmap->clientPixelsRed = (Pixel **)((char *)pmap->red + sizebytes); pmap->numPixelsRed = (int *)((char *)pmap->clientPixelsRed + (MAXCLIENTS * sizeof(Pixel *))); pmap->mid = mid; pmap->flags = 0; /* start out with all flags clear */ if(mid == pScreen->defColormap) pmap->flags |= IsDefault; pmap->pScreen = pScreen; pmap->pVisual = pVisual; pmap->class = class; if ((class | DynamicClass) == DirectColor) size = NUMRED(pVisual); pmap->freeRed = size; bzero ((char *) pmap->red, (int)sizebytes); bzero((char *) pmap->numPixelsRed, MAXCLIENTS * sizeof(int)); for (pptr = &pmap->clientPixelsRed[MAXCLIENTS]; --pptr >= pmap->clientPixelsRed; ) *pptr = (Pixel *)NULL; if (alloc == AllocAll) { if (class & DynamicClass) pmap->flags |= AllAllocated; for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--) pent->refcnt = AllocPrivate; pmap->freeRed = 0; ppix = (Pixel *)malloc(size * sizeof(Pixel)); if (!ppix) { free(pmap); return (BadAlloc); } pmap->clientPixelsRed[client] = ppix; for(i = 0; i < size; i++) ppix[i] = i; pmap->numPixelsRed[client] = size; } if ((class | DynamicClass) == DirectColor) { pmap->freeGreen = NUMGREEN(pVisual); pmap->green = (EntryPtr)((char *)pmap->numPixelsRed + (MAXCLIENTS * sizeof(int))); pmap->clientPixelsGreen = (Pixel **)((char *)pmap->green + sizebytes); pmap->numPixelsGreen = (int *)((char *)pmap->clientPixelsGreen + (MAXCLIENTS * sizeof(Pixel *))); pmap->freeBlue = NUMBLUE(pVisual); pmap->blue = (EntryPtr)((char *)pmap->numPixelsGreen + (MAXCLIENTS * sizeof(int))); pmap->clientPixelsBlue = (Pixel **)((char *)pmap->blue + sizebytes); pmap->numPixelsBlue = (int *)((char *)pmap->clientPixelsBlue + (MAXCLIENTS * sizeof(Pixel *))); bzero ((char *) pmap->green, (int)sizebytes); bzero ((char *) pmap->blue, (int)sizebytes); memmove((char *) pmap->clientPixelsGreen, (char *) pmap->clientPixelsRed, MAXCLIENTS * sizeof(Pixel *)); memmove((char *) pmap->clientPixelsBlue, (char *) pmap->clientPixelsRed, MAXCLIENTS * sizeof(Pixel *)); bzero((char *) pmap->numPixelsGreen, MAXCLIENTS * sizeof(int)); bzero((char *) pmap->numPixelsBlue, MAXCLIENTS * sizeof(int)); /* If every cell is allocated, mark its refcnt */ if (alloc == AllocAll) { size = pmap->freeGreen; for(pent = &pmap->green[size-1]; pent >= pmap->green; pent--) pent->refcnt = AllocPrivate; pmap->freeGreen = 0; ppix = (Pixel *) malloc(size * sizeof(Pixel)); if (!ppix) { free(pmap->clientPixelsRed[client]); free(pmap); return(BadAlloc); } pmap->clientPixelsGreen[client] = ppix; for(i = 0; i < size; i++) ppix[i] = i; pmap->numPixelsGreen[client] = size; size = pmap->freeBlue; for(pent = &pmap->blue[size-1]; pent >= pmap->blue; pent--) pent->refcnt = AllocPrivate; pmap->freeBlue = 0; ppix = (Pixel *) malloc(size * sizeof(Pixel)); if (!ppix) { free(pmap->clientPixelsGreen[client]); free(pmap->clientPixelsRed[client]); free(pmap); return(BadAlloc); } pmap->clientPixelsBlue[client] = ppix; for(i = 0; i < size; i++) ppix[i] = i; pmap->numPixelsBlue[client] = size; } } if (!AddResource(mid, RT_COLORMAP, (void *)pmap)) return (BadAlloc); /* If the device wants a chance to initialize the colormap in any way, * this is it. In specific, if this is a Static colormap, this is the * time to fill in the colormap's values */ pmap->flags |= BeingCreated; /* * Allocate the array of devPrivate's for this colormap. */ if (colormapPrivateCount == 0) pmap->devPrivates = NULL; else { pmap->devPrivates = (DevUnion *) calloc ( sizeof(DevUnion), colormapPrivateCount); if (!pmap->devPrivates) { FreeResource (mid, RT_NONE); return BadAlloc; } } if (!(*pScreen->CreateColormap)(pmap)) { FreeResource (mid, RT_NONE); return BadAlloc; } pmap->flags &= ~BeingCreated; *ppcmap = pmap; return (Success); } /** * * \param value must conform to DeleteType */ int FreeColormap (void * value, XID mid) { int i; register EntryPtr pent; ColormapPtr pmap = (ColormapPtr)value; if(CLIENT_ID(mid) != SERVER_ID) { (*pmap->pScreen->UninstallColormap) (pmap); WalkTree(pmap->pScreen, (VisitWindowProcPtr)TellNoMap, (void *) &mid); } /* This is the device's chance to undo anything it needs to, especially * to free any storage it allocated */ (*pmap->pScreen->DestroyColormap)(pmap); if(pmap->clientPixelsRed) { for(i = 0; i < MAXCLIENTS; i++) free(pmap->clientPixelsRed[i]); } if ((pmap->class == PseudoColor) || (pmap->class == GrayScale)) { for(pent = &pmap->red[pmap->pVisual->ColormapEntries - 1]; pent >= pmap->red; pent--) { if(pent->fShared) { if (--pent->co.shco.red->refcnt == 0) free(pent->co.shco.red); if (--pent->co.shco.green->refcnt == 0) free(pent->co.shco.green); if (--pent->co.shco.blue->refcnt == 0) free(pent->co.shco.blue); } } } if((pmap->class | DynamicClass) == DirectColor) { for(i = 0; i < MAXCLIENTS; i++) { free(pmap->clientPixelsGreen[i]); free(pmap->clientPixelsBlue[i]); } } if (pmap->devPrivates) free(pmap->devPrivates); free(pmap); return(Success); } /* Tell window that pmid has disappeared */ static int TellNoMap (WindowPtr pwin, Colormap *pmid) { xEvent xE = {0}; if (wColormap(pwin) == *pmid) { /* This should be call to DeliverEvent */ xE.u.u.type = ColormapNotify; xE.u.colormap.window = pwin->drawable.id; xE.u.colormap.colormap = None; xE.u.colormap.new = TRUE; xE.u.colormap.state = ColormapUninstalled; #ifdef PANORAMIX if(noPanoramiXExtension || !pwin->drawable.pScreen->myNum) #endif DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL); if (pwin->optional) { pwin->optional->colormap = None; CheckWindowOptionalNeed (pwin); } } return (WT_WALKCHILDREN); } /* Tell window that pmid got uninstalled */ int TellLostMap (WindowPtr pwin, void * value) { Colormap *pmid = (Colormap *)value; xEvent xE = {0}; #ifdef PANORAMIX if(!noPanoramiXExtension && pwin->drawable.pScreen->myNum) return WT_STOPWALKING; #endif if (wColormap(pwin) == *pmid) { /* This should be call to DeliverEvent */ xE.u.u.type = ColormapNotify; xE.u.colormap.window = pwin->drawable.id; xE.u.colormap.colormap = *pmid; xE.u.colormap.new = FALSE; xE.u.colormap.state = ColormapUninstalled; DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL); } return (WT_WALKCHILDREN); } /* Tell window that pmid got installed */ int TellGainedMap (WindowPtr pwin, void * value) { Colormap *pmid = (Colormap *)value; xEvent xE = {0}; #ifdef PANORAMIX if(!noPanoramiXExtension && pwin->drawable.pScreen->myNum) return WT_STOPWALKING; #endif if (wColormap (pwin) == *pmid) { /* This should be call to DeliverEvent */ xE.u.u.type = ColormapNotify; xE.u.colormap.window = pwin->drawable.id; xE.u.colormap.colormap = *pmid; xE.u.colormap.new = FALSE; xE.u.colormap.state = ColormapInstalled; DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL); } return (WT_WALKCHILDREN); } int CopyColormapAndFree (Colormap mid, ColormapPtr pSrc, int client) { ColormapPtr pmap = (ColormapPtr) NULL; int result, alloc, size; Colormap midSrc; ScreenPtr pScreen; VisualPtr pVisual; pScreen = pSrc->pScreen; pVisual = pSrc->pVisual; midSrc = pSrc->mid; alloc = ((pSrc->flags & AllAllocated) && CLIENT_ID(midSrc) == client) ? AllocAll : AllocNone; size = pVisual->ColormapEntries; /* If the create returns non-0, it failed */ result = CreateColormap (mid, pScreen, pVisual, &pmap, alloc, client); if(result != Success) return(result); if(alloc == AllocAll) { memmove((char *)pmap->red, (char *)pSrc->red, size * sizeof(Entry)); if((pmap->class | DynamicClass) == DirectColor) { memmove((char *)pmap->green, (char *)pSrc->green, size * sizeof(Entry)); memmove((char *)pmap->blue, (char *)pSrc->blue, size * sizeof(Entry)); } pSrc->flags &= ~AllAllocated; FreePixels(pSrc, client); UpdateColors(pmap); return(Success); } CopyFree(REDMAP, client, pSrc, pmap); if ((pmap->class | DynamicClass) == DirectColor) { CopyFree(GREENMAP, client, pSrc, pmap); CopyFree(BLUEMAP, client, pSrc, pmap); } if (pmap->class & DynamicClass) UpdateColors(pmap); /* XXX should worry about removing any RT_CMAPENTRY resource */ return(Success); } /* Helper routine for freeing large numbers of cells from a map */ static void CopyFree (int channel, int client, ColormapPtr pmapSrc, ColormapPtr pmapDst) { int z, npix; EntryPtr pentSrcFirst, pentDstFirst; EntryPtr pentSrc, pentDst; Pixel *ppix; int nalloc; switch(channel) { default: /* so compiler can see that everything gets initialized */ case REDMAP: ppix = (pmapSrc->clientPixelsRed)[client]; npix = (pmapSrc->numPixelsRed)[client]; pentSrcFirst = pmapSrc->red; pentDstFirst = pmapDst->red; break; case GREENMAP: ppix = (pmapSrc->clientPixelsGreen)[client]; npix = (pmapSrc->numPixelsGreen)[client]; pentSrcFirst = pmapSrc->green; pentDstFirst = pmapDst->green; break; case BLUEMAP: ppix = (pmapSrc->clientPixelsBlue)[client]; npix = (pmapSrc->numPixelsBlue)[client]; pentSrcFirst = pmapSrc->blue; pentDstFirst = pmapDst->blue; break; } nalloc = 0; if (pmapSrc->class & DynamicClass) { for(z = npix; --z >= 0; ppix++) { /* Copy entries */ pentSrc = pentSrcFirst + *ppix; pentDst = pentDstFirst + *ppix; if (pentDst->refcnt > 0) { pentDst->refcnt++; } else { *pentDst = *pentSrc; nalloc++; if (pentSrc->refcnt > 0) pentDst->refcnt = 1; else pentSrc->fShared = FALSE; } FreeCell(pmapSrc, *ppix, channel); } } /* Note that FreeCell has already fixed pmapSrc->free{Color} */ switch(channel) { case REDMAP: pmapDst->freeRed -= nalloc; (pmapDst->clientPixelsRed)[client] = (pmapSrc->clientPixelsRed)[client]; (pmapSrc->clientPixelsRed)[client] = (Pixel *) NULL; (pmapDst->numPixelsRed)[client] = (pmapSrc->numPixelsRed)[client]; (pmapSrc->numPixelsRed)[client] = 0; break; case GREENMAP: pmapDst->freeGreen -= nalloc; (pmapDst->clientPixelsGreen)[client] = (pmapSrc->clientPixelsGreen)[client]; (pmapSrc->clientPixelsGreen)[client] = (Pixel *) NULL; (pmapDst->numPixelsGreen)[client] = (pmapSrc->numPixelsGreen)[client]; (pmapSrc->numPixelsGreen)[client] = 0; break; case BLUEMAP: pmapDst->freeBlue -= nalloc; pmapDst->clientPixelsBlue[client] = pmapSrc->clientPixelsBlue[client]; pmapSrc->clientPixelsBlue[client] = (Pixel *) NULL; pmapDst->numPixelsBlue[client] = pmapSrc->numPixelsBlue[client]; pmapSrc->numPixelsBlue[client] = 0; break; } } /* Free the ith entry in a color map. Must handle freeing of * colors allocated through AllocColorPlanes */ static void FreeCell (ColormapPtr pmap, Pixel i, int channel) { EntryPtr pent; int *pCount; switch (channel) { default: /* so compiler can see that everything gets initialized */ case PSEUDOMAP: case REDMAP: pent = (EntryPtr) &pmap->red[i]; pCount = &pmap->freeRed; break; case GREENMAP: pent = (EntryPtr) &pmap->green[i]; pCount = &pmap->freeGreen; break; case BLUEMAP: pent = (EntryPtr) &pmap->blue[i]; pCount = &pmap->freeBlue; break; } /* If it's not privately allocated and it's not time to free it, just * decrement the count */ if (pent->refcnt > 1) pent->refcnt--; else { /* If the color type is shared, find the sharedcolor. If decremented * refcnt is 0, free the shared cell. */ if (pent->fShared) { if(--pent->co.shco.red->refcnt == 0) free(pent->co.shco.red); if(--pent->co.shco.green->refcnt == 0) free(pent->co.shco.green); if(--pent->co.shco.blue->refcnt == 0) free(pent->co.shco.blue); pent->fShared = FALSE; } pent->refcnt = 0; *pCount += 1; } } static void UpdateColors (ColormapPtr pmap) { xColorItem *defs; register xColorItem *pdef; register EntryPtr pent; register VisualPtr pVisual; int i, n, size; pVisual = pmap->pVisual; size = pVisual->ColormapEntries; defs = (xColorItem *)malloc(size * sizeof(xColorItem)); if (!defs) return; n = 0; pdef = defs; if (pmap->class == DirectColor) { for (i = 0; i < size; i++) { if (!pmap->red[i].refcnt && !pmap->green[i].refcnt && !pmap->blue[i].refcnt) continue; pdef->pixel = ((Pixel)i << pVisual->offsetRed) | ((Pixel)i << pVisual->offsetGreen) | ((Pixel)i << pVisual->offsetBlue); pdef->red = pmap->red[i].co.local.red; pdef->green = pmap->green[i].co.local.green; pdef->blue = pmap->blue[i].co.local.blue; pdef->flags = DoRed|DoGreen|DoBlue; pdef++; n++; } } else { for (i = 0, pent = pmap->red; i < size; i++, pent++) { if (!pent->refcnt) continue; pdef->pixel = i; if(pent->fShared) { pdef->red = pent->co.shco.red->color; pdef->green = pent->co.shco.green->color; pdef->blue = pent->co.shco.blue->color; } else { pdef->red = pent->co.local.red; pdef->green = pent->co.local.green; pdef->blue = pent->co.local.blue; } pdef->flags = DoRed|DoGreen|DoBlue; pdef++; n++; } } if (n) (*pmap->pScreen->StoreColors)(pmap, n, defs); free(defs); } /* Get a read-only color from a ColorMap (probably slow for large maps) * Returns by changing the value in pred, pgreen, pblue and pPix */ int AllocColor (ColormapPtr pmap, unsigned short *pred, unsigned short *pgreen, unsigned short *pblue, Pixel *pPix, int client) { Pixel pixR, pixG, pixB; int entries; xrgb rgb; int class; VisualPtr pVisual; int npix; Pixel *ppix; pVisual = pmap->pVisual; (*pmap->pScreen->ResolveColor) (pred, pgreen, pblue, pVisual); rgb.red = *pred; rgb.green = *pgreen; rgb.blue = *pblue; class = pmap->class; entries = pVisual->ColormapEntries; /* If the colormap is being created, then we want to be able to change * the colormap, even if it's a static type. Otherwise, we'd never be * able to initialize static colormaps */ if(pmap->flags & BeingCreated) class |= DynamicClass; /* If this is one of the static storage classes, and we're not initializing * it, the best we can do is to find the closest color entry to the * requested one and return that. */ switch (class) { case StaticColor: case StaticGray: /* Look up all three components in the same pmap */ *pPix = pixR = FindBestPixel(pmap->red, entries, &rgb, PSEUDOMAP); *pred = pmap->red[pixR].co.local.red; *pgreen = pmap->red[pixR].co.local.green; *pblue = pmap->red[pixR].co.local.blue; npix = pmap->numPixelsRed[client]; ppix = (Pixel *) realloc(pmap->clientPixelsRed[client], (npix + 1) * sizeof(Pixel)); if (!ppix) return (BadAlloc); ppix[npix] = pixR; pmap->clientPixelsRed[client] = ppix; pmap->numPixelsRed[client]++; break; case TrueColor: /* Look up each component in its own map, then OR them together */ pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP); pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb, GREENMAP); pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP); *pPix = (pixR << pVisual->offsetRed) | (pixG << pVisual->offsetGreen) | (pixB << pVisual->offsetBlue) | ALPHAMASK(pVisual); *pred = pmap->red[pixR].co.local.red; *pgreen = pmap->green[pixG].co.local.green; *pblue = pmap->blue[pixB].co.local.blue; npix = pmap->numPixelsRed[client]; ppix = (Pixel *) realloc(pmap->clientPixelsRed[client], (npix + 1) * sizeof(Pixel)); if (!ppix) return (BadAlloc); ppix[npix] = pixR; pmap->clientPixelsRed[client] = ppix; npix = pmap->numPixelsGreen[client]; ppix = (Pixel *) realloc(pmap->clientPixelsGreen[client], (npix + 1) * sizeof(Pixel)); if (!ppix) return (BadAlloc); ppix[npix] = pixG; pmap->clientPixelsGreen[client] = ppix; npix = pmap->numPixelsBlue[client]; ppix = (Pixel *) realloc(pmap->clientPixelsBlue[client], (npix + 1) * sizeof(Pixel)); if (!ppix) return (BadAlloc); ppix[npix] = pixB; pmap->clientPixelsBlue[client] = ppix; pmap->numPixelsRed[client]++; pmap->numPixelsGreen[client]++; pmap->numPixelsBlue[client]++; break; case GrayScale: case PseudoColor: if (pmap->mid != pmap->pScreen->defColormap && pmap->pVisual->vid == pmap->pScreen->rootVisual) { ColormapPtr prootmap = (ColormapPtr) SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap, RT_COLORMAP, DixReadAccess); if (pmap->class == prootmap->class) FindColorInRootCmap (prootmap, prootmap->red, entries, &rgb, pPix, PSEUDOMAP, AllComp); } if (FindColor(pmap, pmap->red, entries, &rgb, pPix, PSEUDOMAP, client, AllComp) != Success) return (BadAlloc); break; case DirectColor: if (pmap->mid != pmap->pScreen->defColormap && pmap->pVisual->vid == pmap->pScreen->rootVisual) { ColormapPtr prootmap = (ColormapPtr) SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap, RT_COLORMAP, DixReadAccess); if (pmap->class == prootmap->class) { pixR = (*pPix & pVisual->redMask) >> pVisual->offsetRed; FindColorInRootCmap (prootmap, prootmap->red, entries, &rgb, &pixR, REDMAP, RedComp); pixG = (*pPix & pVisual->greenMask) >> pVisual->offsetGreen; FindColorInRootCmap (prootmap, prootmap->green, entries, &rgb, &pixG, GREENMAP, GreenComp); pixB = (*pPix & pVisual->blueMask) >> pVisual->offsetBlue; FindColorInRootCmap (prootmap, prootmap->blue, entries, &rgb, &pixB, BLUEMAP, BlueComp); *pPix = pixR | pixG | pixB; } } pixR = (*pPix & pVisual->redMask) >> pVisual->offsetRed; if (FindColor(pmap, pmap->red, NUMRED(pVisual), &rgb, &pixR, REDMAP, client, RedComp) != Success) return (BadAlloc); pixG = (*pPix & pVisual->greenMask) >> pVisual->offsetGreen; if (FindColor(pmap, pmap->green, NUMGREEN(pVisual), &rgb, &pixG, GREENMAP, client, GreenComp) != Success) { (void)FreeCo(pmap, client, REDMAP, 1, &pixR, (Pixel)0); return (BadAlloc); } pixB = (*pPix & pVisual->blueMask) >> pVisual->offsetBlue; if (FindColor(pmap, pmap->blue, NUMBLUE(pVisual), &rgb, &pixB, BLUEMAP, client, BlueComp) != Success) { (void)FreeCo(pmap, client, GREENMAP, 1, &pixG, (Pixel)0); (void)FreeCo(pmap, client, REDMAP, 1, &pixR, (Pixel)0); return (BadAlloc); } *pPix = pixR | pixG | pixB | ALPHAMASK(pVisual); break; } /* if this is the client's first pixel in this colormap, tell the * resource manager that the client has pixels in this colormap which * should be freed when the client dies */ if ((pmap->numPixelsRed[client] == 1) && (CLIENT_ID(pmap->mid) != client) && !(pmap->flags & BeingCreated)) { colorResource *pcr; pcr = (colorResource *) malloc(sizeof(colorResource)); if (!pcr) { (void)FreeColors(pmap, client, 1, pPix, (Pixel)0); return (BadAlloc); } pcr->mid = pmap->mid; pcr->client = client; if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *)pcr)) return (BadAlloc); } return (Success); } /* * FakeAllocColor -- fake an AllocColor request by * returning a free pixel if availible, otherwise returning * the closest matching pixel. This is used by the mi * software sprite code to recolor cursors. A nice side-effect * is that this routine will never return failure. */ void FakeAllocColor (register ColormapPtr pmap, register xColorItem *item) { Pixel pixR, pixG, pixB; Pixel temp; int entries; xrgb rgb; int class; register VisualPtr pVisual; pVisual = pmap->pVisual; rgb.red = item->red; rgb.green = item->green; rgb.blue = item->blue; (*pmap->pScreen->ResolveColor) (&rgb.red, &rgb.green, &rgb.blue, pVisual); class = pmap->class; entries = pVisual->ColormapEntries; switch (class) { case GrayScale: case PseudoColor: item->pixel = 0; if (FindColor(pmap, pmap->red, entries, &rgb, &temp, PSEUDOMAP, -1, AllComp) == Success) { item->pixel = temp; break; } /* fall through ... */ case StaticColor: case StaticGray: item->pixel = FindBestPixel(pmap->red, entries, &rgb, PSEUDOMAP); break; case DirectColor: /* Look up each component in its own map, then OR them together */ pixR = (item->pixel & pVisual->redMask) >> pVisual->offsetRed; pixG = (item->pixel & pVisual->greenMask) >> pVisual->offsetGreen; pixB = (item->pixel & pVisual->blueMask) >> pVisual->offsetBlue; if (FindColor(pmap, pmap->red, NUMRED(pVisual), &rgb, &pixR, REDMAP, -1, RedComp) != Success) pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP) << pVisual->offsetRed; if (FindColor(pmap, pmap->green, NUMGREEN(pVisual), &rgb, &pixG, GREENMAP, -1, GreenComp) != Success) pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb, GREENMAP) << pVisual->offsetGreen; if (FindColor(pmap, pmap->blue, NUMBLUE(pVisual), &rgb, &pixB, BLUEMAP, -1, BlueComp) != Success) pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP) << pVisual->offsetBlue; item->pixel = pixR | pixG | pixB; break; case TrueColor: /* Look up each component in its own map, then OR them together */ pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP); pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb, GREENMAP); pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP); item->pixel = (pixR << pVisual->offsetRed) | (pixG << pVisual->offsetGreen) | (pixB << pVisual->offsetBlue); break; } } /* free a pixel value obtained from FakeAllocColor */ void FakeFreeColor(register ColormapPtr pmap, Pixel pixel) { register VisualPtr pVisual; Pixel pixR, pixG, pixB; switch (pmap->class) { case GrayScale: case PseudoColor: if (pmap->red[pixel].refcnt == AllocTemporary) pmap->red[pixel].refcnt = 0; break; case DirectColor: pVisual = pmap->pVisual; pixR = (pixel & pVisual->redMask) >> pVisual->offsetRed; pixG = (pixel & pVisual->greenMask) >> pVisual->offsetGreen; pixB = (pixel & pVisual->blueMask) >> pVisual->offsetBlue; if (pmap->red[pixR].refcnt == AllocTemporary) pmap->red[pixR].refcnt = 0; if (pmap->green[pixG].refcnt == AllocTemporary) pmap->green[pixG].refcnt = 0; if (pmap->blue[pixB].refcnt == AllocTemporary) pmap->blue[pixB].refcnt = 0; break; } } typedef unsigned short BigNumUpper; typedef unsigned long BigNumLower; #define BIGNUMLOWERBITS 24 #define BIGNUMUPPERBITS 16 #define BIGNUMLOWER (1 << BIGNUMLOWERBITS) #define BIGNUMUPPER (1 << BIGNUMUPPERBITS) #define UPPERPART(i) ((i) >> BIGNUMLOWERBITS) #define LOWERPART(i) ((i) & (BIGNUMLOWER - 1)) typedef struct _bignum { BigNumUpper upper; BigNumLower lower; } BigNumRec, *BigNumPtr; #define BigNumGreater(x,y) (((x)->upper > (y)->upper) ||\ ((x)->upper == (y)->upper && (x)->lower > (y)->lower)) #define UnsignedToBigNum(u,r) (((r)->upper = UPPERPART(u)), \ ((r)->lower = LOWERPART(u))) #define MaxBigNum(r) (((r)->upper = BIGNUMUPPER-1), \ ((r)->lower = BIGNUMLOWER-1)) static void BigNumAdd (BigNumPtr x, BigNumPtr y, BigNumPtr r) { BigNumLower lower, carry = 0; lower = x->lower + y->lower; if (lower >= BIGNUMLOWER) { lower -= BIGNUMLOWER; carry = 1; } r->lower = lower; r->upper = x->upper + y->upper + carry; } static Pixel FindBestPixel(EntryPtr pentFirst, int size, xrgb *prgb, int channel) { EntryPtr pent; Pixel pixel, final; long dr, dg, db; unsigned long sq; BigNumRec minval, sum, temp; final = 0; MaxBigNum(&minval); /* look for the minimal difference */ for (pent = pentFirst, pixel = 0; pixel < size; pent++, pixel++) { dr = dg = db = 0; switch(channel) { case PSEUDOMAP: dg = (long) pent->co.local.green - prgb->green; db = (long) pent->co.local.blue - prgb->blue; case REDMAP: dr = (long) pent->co.local.red - prgb->red; break; case GREENMAP: dg = (long) pent->co.local.green - prgb->green; break; case BLUEMAP: db = (long) pent->co.local.blue - prgb->blue; break; } sq = dr * dr; UnsignedToBigNum (sq, &sum); sq = dg * dg; UnsignedToBigNum (sq, &temp); BigNumAdd (&sum, &temp, &sum); sq = db * db; UnsignedToBigNum (sq, &temp); BigNumAdd (&sum, &temp, &sum); if (BigNumGreater (&minval, &sum)) { final = pixel; minval = sum; } } return(final); } static void FindColorInRootCmap (ColormapPtr pmap, EntryPtr pentFirst, int size, xrgb *prgb, Pixel *pPixel, int channel, ColorCompareProcPtr comp) { EntryPtr pent; Pixel pixel; int count; if ((pixel = *pPixel) >= size) pixel = 0; for (pent = pentFirst + pixel, count = size; --count >= 0; pent++, pixel++) { if (pent->refcnt > 0 && (*comp) (pent, prgb)) { switch (channel) { case REDMAP: pixel <<= pmap->pVisual->offsetRed; break; case GREENMAP: pixel <<= pmap->pVisual->offsetGreen; break; case BLUEMAP: pixel <<= pmap->pVisual->offsetBlue; break; default: /* PSEUDOMAP */ break; } *pPixel = pixel; } } } /* Tries to find a color in pmap that exactly matches the one requested in prgb * if it can't it allocates one. * Starts looking at pentFirst + *pPixel, so if you want a specific pixel, * load *pPixel with that value, otherwise set it to 0 */ int FindColor (ColormapPtr pmap, EntryPtr pentFirst, int size, xrgb *prgb, Pixel *pPixel, int channel, int client, ColorCompareProcPtr comp) { EntryPtr pent; Bool foundFree; Pixel pixel, Free = 0; int npix, count, *nump = NULL; Pixel **pixp = NULL, *ppix; xColorItem def; foundFree = FALSE; if((pixel = *pPixel) >= size) pixel = 0; /* see if there is a match, and also look for a free entry */ for (pent = pentFirst + pixel, count = size; --count >= 0; ) { if (pent->refcnt > 0) { if ((*comp) (pent, prgb)) { if (client >= 0) pent->refcnt++; *pPixel = pixel; switch(channel) { case REDMAP: *pPixel <<= pmap->pVisual->offsetRed; case PSEUDOMAP: break; case GREENMAP: *pPixel <<= pmap->pVisual->offsetGreen; break; case BLUEMAP: *pPixel <<= pmap->pVisual->offsetBlue; break; } goto gotit; } } else if (!foundFree && pent->refcnt == 0) { Free = pixel; foundFree = TRUE; /* If we're initializing the colormap, then we are looking for * the first free cell we can find, not to minimize the number * of entries we use. So don't look any further. */ if(pmap->flags & BeingCreated) break; } pixel++; if(pixel >= size) { pent = pentFirst; pixel = 0; } else pent++; } /* If we got here, we didn't find a match. If we also didn't find * a free entry, we're out of luck. Otherwise, we'll usurp a free * entry and fill it in */ if (!foundFree) return (BadAlloc); pent = pentFirst + Free; pent->fShared = FALSE; pent->refcnt = (client >= 0) ? 1 : AllocTemporary; switch (channel) { case PSEUDOMAP: pent->co.local.red = prgb->red; pent->co.local.green = prgb->green; pent->co.local.blue = prgb->blue; def.red = prgb->red; def.green = prgb->green; def.blue = prgb->blue; def.flags = (DoRed|DoGreen|DoBlue); if (client >= 0) pmap->freeRed--; def.pixel = Free; break; case REDMAP: pent->co.local.red = prgb->red; def.red = prgb->red; def.green = pmap->green[0].co.local.green; def.blue = pmap->blue[0].co.local.blue; def.flags = DoRed; if (client >= 0) pmap->freeRed--; def.pixel = Free << pmap->pVisual->offsetRed; break; case GREENMAP: pent->co.local.green = prgb->green; def.red = pmap->red[0].co.local.red; def.green = prgb->green; def.blue = pmap->blue[0].co.local.blue; def.flags = DoGreen; if (client >= 0) pmap->freeGreen--; def.pixel = Free << pmap->pVisual->offsetGreen; break; case BLUEMAP: pent->co.local.blue = prgb->blue; def.red = pmap->red[0].co.local.red; def.green = pmap->green[0].co.local.green; def.blue = prgb->blue; def.flags = DoBlue; if (client >= 0) pmap->freeBlue--; def.pixel = Free << pmap->pVisual->offsetBlue; break; } (*pmap->pScreen->StoreColors) (pmap, 1, &def); pixel = Free; *pPixel = def.pixel; gotit: if (pmap->flags & BeingCreated || client == -1) return(Success); /* Now remember the pixel, for freeing later */ switch (channel) { case PSEUDOMAP: case REDMAP: nump = pmap->numPixelsRed; pixp = pmap->clientPixelsRed; break; case GREENMAP: nump = pmap->numPixelsGreen; pixp = pmap->clientPixelsGreen; break; case BLUEMAP: nump = pmap->numPixelsBlue; pixp = pmap->clientPixelsBlue; break; } npix = nump[client]; ppix = (Pixel *) realloc (pixp[client], (npix + 1) * sizeof(Pixel)); if (!ppix) { pent->refcnt--; if (!pent->fShared) switch (channel) { case PSEUDOMAP: case REDMAP: pmap->freeRed++; break; case GREENMAP: pmap->freeGreen++; break; case BLUEMAP: pmap->freeBlue++; break; } return(BadAlloc); } ppix[npix] = pixel; pixp[client] = ppix; nump[client]++; return(Success); } /* Comparison functions -- passed to FindColor to determine if an * entry is already the color we're looking for or not */ static int AllComp (EntryPtr pent, xrgb *prgb) { if((pent->co.local.red == prgb->red) && (pent->co.local.green == prgb->green) && (pent->co.local.blue == prgb->blue) ) return (1); return (0); } static int RedComp (EntryPtr pent, xrgb *prgb) { if (pent->co.local.red == prgb->red) return (1); return (0); } static int GreenComp (EntryPtr pent, xrgb *prgb) { if (pent->co.local.green == prgb->green) return (1); return (0); } static int BlueComp (EntryPtr pent, xrgb *prgb) { if (pent->co.local.blue == prgb->blue) return (1); return (0); } /* Read the color value of a cell */ int QueryColors (ColormapPtr pmap, int count, Pixel *ppixIn, xrgb *prgbList) { Pixel *ppix, pixel; xrgb *prgb; VisualPtr pVisual; EntryPtr pent; Pixel i; int errVal = Success; pVisual = pmap->pVisual; if ((pmap->class | DynamicClass) == DirectColor) { int numred, numgreen, numblue; Pixel rgbbad; numred = NUMRED(pVisual); numgreen = NUMGREEN(pVisual); numblue = NUMBLUE(pVisual); rgbbad = ~RGBMASK(pVisual); for( ppix = ppixIn, prgb = prgbList; --count >= 0; ppix++, prgb++) { pixel = *ppix; if (pixel & rgbbad) { clientErrorValue = pixel; errVal = BadValue; continue; } i = (pixel & pVisual->redMask) >> pVisual->offsetRed; if (i >= numred) { clientErrorValue = pixel; errVal = BadValue; continue; } prgb->red = pmap->red[i].co.local.red; i = (pixel & pVisual->greenMask) >> pVisual->offsetGreen; if (i >= numgreen) { clientErrorValue = pixel; errVal = BadValue; continue; } prgb->green = pmap->green[i].co.local.green; i = (pixel & pVisual->blueMask) >> pVisual->offsetBlue; if (i >= numblue) { clientErrorValue = pixel; errVal = BadValue; continue; } prgb->blue = pmap->blue[i].co.local.blue; } } else { for( ppix = ppixIn, prgb = prgbList; --count >= 0; ppix++, prgb++) { pixel = *ppix; if (pixel >= pVisual->ColormapEntries) { clientErrorValue = pixel; errVal = BadValue; } else { pent = (EntryPtr)&pmap->red[pixel]; if (pent->fShared) { prgb->red = pent->co.shco.red->color; prgb->green = pent->co.shco.green->color; prgb->blue = pent->co.shco.blue->color; } else { prgb->red = pent->co.local.red; prgb->green = pent->co.local.green; prgb->blue = pent->co.local.blue; } } } } return (errVal); } static void FreePixels(register ColormapPtr pmap, register int client) { register Pixel *ppix, *ppixStart; register int n; int class; class = pmap->class; ppixStart = pmap->clientPixelsRed[client]; if (class & DynamicClass) { n = pmap->numPixelsRed[client]; for (ppix = ppixStart; --n >= 0; ) { FreeCell(pmap, *ppix, REDMAP); ppix++; } } free(ppixStart); pmap->clientPixelsRed[client] = (Pixel *) NULL; pmap->numPixelsRed[client] = 0; if ((class | DynamicClass) == DirectColor) { ppixStart = pmap->clientPixelsGreen[client]; if (class & DynamicClass) for (ppix = ppixStart, n = pmap->numPixelsGreen[client]; --n >= 0;) FreeCell(pmap, *ppix++, GREENMAP); free(ppixStart); pmap->clientPixelsGreen[client] = (Pixel *) NULL; pmap->numPixelsGreen[client] = 0; ppixStart = pmap->clientPixelsBlue[client]; if (class & DynamicClass) for (ppix = ppixStart, n = pmap->numPixelsBlue[client]; --n >= 0; ) FreeCell(pmap, *ppix++, BLUEMAP); free(ppixStart); pmap->clientPixelsBlue[client] = (Pixel *) NULL; pmap->numPixelsBlue[client] = 0; } } /** * Frees all of a client's colors and cells. * * \param value must conform to DeleteType * \unused fakeid */ int FreeClientPixels (void * value, XID fakeid) { ColormapPtr pmap; colorResource *pcr = (colorResource *)value; pmap = (ColormapPtr) LookupIDByType(pcr->mid, RT_COLORMAP); if (pmap) FreePixels(pmap, pcr->client); free(pcr); return Success; } int AllocColorCells (int client, ColormapPtr pmap, int colors, int planes, Bool contig, Pixel *ppix, Pixel *masks) { Pixel rmask, gmask, bmask, *ppixFirst, r, g, b; int n, class; int ok; int oldcount; colorResource *pcr = (colorResource *)NULL; class = pmap->class; if (!(class & DynamicClass)) return (BadAlloc); /* Shouldn't try on this type */ oldcount = pmap->numPixelsRed[client]; if (pmap->class == DirectColor) oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client]; if (!oldcount && (CLIENT_ID(pmap->mid) != client)) { pcr = (colorResource *) malloc(sizeof(colorResource)); if (!pcr) return (BadAlloc); } if (pmap->class == DirectColor) { ok = AllocDirect (client, pmap, colors, planes, planes, planes, contig, ppix, &rmask, &gmask, &bmask); if(ok == Success) { for (r = g = b = 1, n = planes; --n >= 0; r += r, g += g, b += b) { while(!(rmask & r)) r += r; while(!(gmask & g)) g += g; while(!(bmask & b)) b += b; *masks++ = r | g | b; } } } else { ok = AllocPseudo (client, pmap, colors, planes, contig, ppix, &rmask, &ppixFirst); if(ok == Success) { for (r = 1, n = planes; --n >= 0; r += r) { while(!(rmask & r)) r += r; *masks++ = r; } } } /* if this is the client's first pixels in this colormap, tell the * resource manager that the client has pixels in this colormap which * should be freed when the client dies */ if ((ok == Success) && pcr) { pcr->mid = pmap->mid; pcr->client = client; if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *)pcr)) ok = BadAlloc; } else if (pcr) free(pcr); return (ok); } int AllocColorPlanes (int client, ColormapPtr pmap, int colors, int r, int g, int b, Bool contig, Pixel *pixels, Pixel *prmask, Pixel *pgmask, Pixel *pbmask) { int ok; Pixel mask, *ppixFirst; register Pixel shift; register int i; int class; int oldcount; colorResource *pcr = (colorResource *)NULL; class = pmap->class; if (!(class & DynamicClass)) return (BadAlloc); /* Shouldn't try on this type */ oldcount = pmap->numPixelsRed[client]; if (class == DirectColor) oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client]; if (!oldcount && (CLIENT_ID(pmap->mid) != client)) { pcr = (colorResource *) malloc(sizeof(colorResource)); if (!pcr) return (BadAlloc); } if (class == DirectColor) { ok = AllocDirect (client, pmap, colors, r, g, b, contig, pixels, prmask, pgmask, pbmask); } else { /* Allocate the proper pixels */ /* XXX This is sort of bad, because of contig is set, we force all * r + g + b bits to be contiguous. Should only force contiguity * per mask */ ok = AllocPseudo (client, pmap, colors, r + g + b, contig, pixels, &mask, &ppixFirst); if(ok == Success) { /* now split that mask into three */ *prmask = *pgmask = *pbmask = 0; shift = 1; for (i = r; --i >= 0; shift += shift) { while (!(mask & shift)) shift += shift; *prmask |= shift; } for (i = g; --i >= 0; shift += shift) { while (!(mask & shift)) shift += shift; *pgmask |= shift; } for (i = b; --i >= 0; shift += shift) { while (!(mask & shift)) shift += shift; *pbmask |= shift; } /* set up the shared color cells */ if (!AllocShared(pmap, pixels, colors, r, g, b, *prmask, *pgmask, *pbmask, ppixFirst)) { (void)FreeColors(pmap, client, colors, pixels, mask); ok = BadAlloc; } } } /* if this is the client's first pixels in this colormap, tell the * resource manager that the client has pixels in this colormap which * should be freed when the client dies */ if ((ok == Success) && pcr) { pcr->mid = pmap->mid; pcr->client = client; if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (void *)pcr)) ok = BadAlloc; } else if (pcr) free(pcr); return (ok); } static int AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool contig, Pixel *pixels, Pixel *prmask, Pixel *pgmask, Pixel *pbmask) { Pixel *ppixRed, *ppixGreen, *ppixBlue; Pixel *ppix, *pDst, *p; int npix, npixR, npixG, npixB; Bool okR, okG, okB; Pixel *rpix = 0, *gpix = 0, *bpix = 0; npixR = c << r; npixG = c << g; npixB = c << b; if ((r >= 32) || (g >= 32) || (b >= 32) || (npixR > pmap->freeRed) || (npixR < c) || (npixG > pmap->freeGreen) || (npixG < c) || (npixB > pmap->freeBlue) || (npixB < c)) return BadAlloc; /* start out with empty pixels */ for(p = pixels; p < pixels + c; p++) *p = 0; ppixRed = (Pixel *)malloc(npixR * sizeof(Pixel)); ppixGreen = (Pixel *)malloc(npixG * sizeof(Pixel)); ppixBlue = (Pixel *)malloc(npixB * sizeof(Pixel)); if (!ppixRed || !ppixGreen || !ppixBlue) { if (ppixBlue) free(ppixBlue); if (ppixGreen) free(ppixGreen); if (ppixRed) free(ppixRed); return(BadAlloc); } okR = AllocCP(pmap, pmap->red, c, r, contig, ppixRed, prmask); okG = AllocCP(pmap, pmap->green, c, g, contig, ppixGreen, pgmask); okB = AllocCP(pmap, pmap->blue, c, b, contig, ppixBlue, pbmask); if (okR && okG && okB) { rpix = (Pixel *) realloc(pmap->clientPixelsRed[client], (pmap->numPixelsRed[client] + (c << r)) * sizeof(Pixel)); if (rpix) pmap->clientPixelsRed[client] = rpix; gpix = (Pixel *) realloc(pmap->clientPixelsGreen[client], (pmap->numPixelsGreen[client] + (c << g)) * sizeof(Pixel)); if (gpix) pmap->clientPixelsGreen[client] = gpix; bpix = (Pixel *) realloc(pmap->clientPixelsBlue[client], (pmap->numPixelsBlue[client] + (c << b)) * sizeof(Pixel)); if (bpix) pmap->clientPixelsBlue[client] = bpix; } if (!okR || !okG || !okB || !rpix || !gpix || !bpix) { if (okR) for(ppix = ppixRed, npix = npixR; --npix >= 0; ppix++) pmap->red[*ppix].refcnt = 0; if (okG) for(ppix = ppixGreen, npix = npixG; --npix >= 0; ppix++) pmap->green[*ppix].refcnt = 0; if (okB) for(ppix = ppixBlue, npix = npixB; --npix >= 0; ppix++) pmap->blue[*ppix].refcnt = 0; free(ppixBlue); free(ppixGreen); free(ppixRed); return(BadAlloc); } *prmask <<= pmap->pVisual->offsetRed; *pgmask <<= pmap->pVisual->offsetGreen; *pbmask <<= pmap->pVisual->offsetBlue; ppix = rpix + pmap->numPixelsRed[client]; for (pDst = pixels, p = ppixRed; p < ppixRed + npixR; p++) { *ppix++ = *p; if(p < ppixRed + c) *pDst++ |= *p << pmap->pVisual->offsetRed; } pmap->numPixelsRed[client] += npixR; pmap->freeRed -= npixR; ppix = gpix + pmap->numPixelsGreen[client]; for (pDst = pixels, p = ppixGreen; p < ppixGreen + npixG; p++) { *ppix++ = *p; if(p < ppixGreen + c) *pDst++ |= *p << pmap->pVisual->offsetGreen; } pmap->numPixelsGreen[client] += npixG; pmap->freeGreen -= npixG; ppix = bpix + pmap->numPixelsBlue[client]; for (pDst = pixels, p = ppixBlue; p < ppixBlue + npixB; p++) { *ppix++ = *p; if(p < ppixBlue + c) *pDst++ |= *p << pmap->pVisual->offsetBlue; } pmap->numPixelsBlue[client] += npixB; pmap->freeBlue -= npixB; for (pDst = pixels; pDst < pixels + c; pDst++) *pDst |= ALPHAMASK(pmap->pVisual); free(ppixBlue); free(ppixGreen); free(ppixRed); return (Success); } static int AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig, Pixel *pixels, Pixel *pmask, Pixel **pppixFirst) { Pixel *ppix, *p, *pDst, *ppixTemp; int npix; Bool ok; npix = c << r; if ((r >= 32) || (npix > pmap->freeRed) || (npix < c)) return(BadAlloc); if(!(ppixTemp = (Pixel *)malloc(npix * sizeof(Pixel)))) return(BadAlloc); ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask); if (ok) { /* all the allocated pixels are added to the client pixel list, * but only the unique ones are returned to the client */ ppix = (Pixel *)realloc(pmap->clientPixelsRed[client], (pmap->numPixelsRed[client] + npix) * sizeof(Pixel)); if (!ppix) { for (p = ppixTemp; p < ppixTemp + npix; p++) pmap->red[*p].refcnt = 0; return (BadAlloc); } pmap->clientPixelsRed[client] = ppix; ppix += pmap->numPixelsRed[client]; *pppixFirst = ppix; pDst = pixels; for (p = ppixTemp; p < ppixTemp + npix; p++) { *ppix++ = *p; if(p < ppixTemp + c) *pDst++ = *p; } pmap->numPixelsRed[client] += npix; pmap->freeRed -= npix; } free(ppixTemp); return (ok ? Success : BadAlloc); } /* Allocates count << planes pixels from colormap pmap for client. If * contig, then the plane mask is made of consecutive bits. Returns * all count << pixels in the array pixels. The first count of those * pixels are the unique pixels. *pMask has the mask to Or with the * unique pixels to get the rest of them. * * Returns True iff all pixels could be allocated * All cells allocated will have refcnt set to AllocPrivate and shared to FALSE * (see AllocShared for why we care) */ static Bool AllocCP (ColormapPtr pmap, EntryPtr pentFirst, int count, int planes, Bool contig, Pixel *pixels, Pixel *pMask) { EntryPtr ent; Pixel pixel, base, entries, maxp, save; int dplanes, found; Pixel *ppix; Pixel mask; Pixel finalmask; dplanes = pmap->pVisual->nplanes; /* Easy case. Allocate pixels only */ if (planes == 0) { /* allocate writable entries */ ppix = pixels; ent = pentFirst; pixel = 0; while (--count >= 0) { /* Just find count unallocated cells */ while (ent->refcnt) { ent++; pixel++; } ent->refcnt = AllocPrivate; *ppix++ = pixel; ent->fShared = FALSE; } *pMask = 0; return (TRUE); } else if (planes > dplanes) { return (FALSE); } /* General case count pixels * 2 ^ planes cells to be allocated */ /* make room for new pixels */ ent = pentFirst; /* first try for contiguous planes, since it's fastest */ for (mask = (((Pixel)1) << planes) - 1, base = 1, dplanes -= (planes - 1); --dplanes >= 0; mask += mask, base += base) { ppix = pixels; found = 0; pixel = 0; entries = pmap->pVisual->ColormapEntries - mask; while (pixel < entries) { save = pixel; maxp = pixel + mask + base; /* check if all are free */ while (pixel != maxp && ent[pixel].refcnt == 0) pixel += base; if (pixel == maxp) { /* this one works */ *ppix++ = save; found++; if (found == count) { /* found enough, allocate them all */ while (--count >= 0) { pixel = pixels[count]; maxp = pixel + mask; while (1) { ent[pixel].refcnt = AllocPrivate; ent[pixel].fShared = FALSE; if (pixel == maxp) break; pixel += base; *ppix++ = pixel; } } *pMask = mask; return (TRUE); } } pixel = save + 1; if (pixel & mask) pixel += mask; } } dplanes = pmap->pVisual->nplanes; if (contig || planes == 1 || dplanes < 3) return (FALSE); /* this will be very slow for large maps, need a better algorithm */ /* we can generate the smallest and largest numbers that fits in dplanes bits and contain exactly planes bits set as follows. First, we need to check that it is possible to generate such a mask at all. (Non-contiguous masks need one more bit than contiguous masks). Then the smallest such mask consists of the rightmost planes-1 bits set, then a zero, then a one in position planes + 1. The formula is (3 << (planes-1)) -1 The largest such masks consists of the leftmost planes-1 bits set, then a zero, then a one bit in position dplanes-planes-1. If dplanes is smaller than 32 (the number of bits in a word) then the formula is: (1<>> */ finalmask = (((((Pixel)1)<<(planes-1)) - 1) << (dplanes-planes+1)) + (((Pixel)1)<<(dplanes-planes-1)); for (mask = (((Pixel)3) << (planes -1)) - 1; mask <= finalmask; mask++) { /* next 3 magic statements count number of ones (HAKMEM #169) */ pixel = (mask >> 1) & 033333333333; pixel = mask - pixel - ((pixel >> 1) & 033333333333); if ((((pixel + (pixel >> 3)) & 030707070707) % 077) != planes) continue; ppix = pixels; found = 0; entries = pmap->pVisual->ColormapEntries - mask; base = lowbit (mask); for (pixel = 0; pixel < entries; pixel++) { if (pixel & mask) continue; maxp = 0; /* check if all are free */ while (ent[pixel + maxp].refcnt == 0) { GetNextBitsOrBreak(maxp, mask, base); } if ((maxp < mask) || (ent[pixel + mask].refcnt != 0)) continue; /* this one works */ *ppix++ = pixel; found++; if (found < count) continue; /* found enough, allocate them all */ while (--count >= 0) { pixel = (pixels)[count]; maxp = 0; while (1) { ent[pixel + maxp].refcnt = AllocPrivate; ent[pixel + maxp].fShared = FALSE; GetNextBitsOrBreak(maxp, mask, base); *ppix++ = pixel + maxp; } } *pMask = mask; return (TRUE); } } return (FALSE); } /** * * \param ppixFirst First of the client's new pixels */ static Bool AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b, Pixel rmask, Pixel gmask, Pixel bmask, Pixel *ppixFirst) { Pixel *pptr, *cptr; int npix, z, npixClientNew, npixShared; Pixel basemask, base, bits, common; SHAREDCOLOR *pshared, **ppshared, **psharedList; npixClientNew = c << (r + g + b); npixShared = (c << r) + (c << g) + (c << b); psharedList = (SHAREDCOLOR **)malloc(npixShared * sizeof(SHAREDCOLOR *)); if (!psharedList) return FALSE; ppshared = psharedList; for (z = npixShared; --z >= 0; ) { if (!(ppshared[z] = (SHAREDCOLOR *)malloc(sizeof(SHAREDCOLOR)))) { for (z++ ; z < npixShared; z++) free(ppshared[z]); return FALSE; } } for(pptr = ppix, npix = c; --npix >= 0; pptr++) { basemask = ~(gmask | bmask); common = *pptr & basemask; if (rmask) { bits = 0; base = lowbit (rmask); while(1) { pshared = *ppshared++; pshared->refcnt = 1 << (g + b); for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) { if ((*cptr & basemask) == (common | bits)) { pmap->red[*cptr].fShared = TRUE; pmap->red[*cptr].co.shco.red = pshared; } } GetNextBitsOrBreak(bits, rmask, base); } } else { pshared = *ppshared++; pshared->refcnt = 1 << (g + b); for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) { if ((*cptr & basemask) == common) { pmap->red[*cptr].fShared = TRUE; pmap->red[*cptr].co.shco.red = pshared; } } } basemask = ~(rmask | bmask); common = *pptr & basemask; if (gmask) { bits = 0; base = lowbit (gmask); while(1) { pshared = *ppshared++; pshared->refcnt = 1 << (r + b); for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) { if ((*cptr & basemask) == (common | bits)) { pmap->red[*cptr].co.shco.green = pshared; } } GetNextBitsOrBreak(bits, gmask, base); } } else { pshared = *ppshared++; pshared->refcnt = 1 << (g + b); for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) { if ((*cptr & basemask) == common) { pmap->red[*cptr].co.shco.green = pshared; } } } basemask = ~(rmask | gmask); common = *pptr & basemask; if (bmask) { bits = 0; base = lowbit (bmask); while(1) { pshared = *ppshared++; pshared->refcnt = 1 << (r + g); for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) { if ((*cptr & basemask) == (common | bits)) { pmap->red[*cptr].co.shco.blue = pshared; } } GetNextBitsOrBreak(bits, bmask, base); } } else { pshared = *ppshared++; pshared->refcnt = 1 << (g + b); for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) { if ((*cptr & basemask) == common) { pmap->red[*cptr].co.shco.blue = pshared; } } } } free(psharedList); return TRUE; } /** FreeColors * Free colors and/or cells (probably slow for large numbers) */ int FreeColors (ColormapPtr pmap, int client, int count, Pixel *pixels, Pixel mask) { int rval, result, class; Pixel rmask; class = pmap->class; if (pmap->flags & AllAllocated) return(BadAccess); if ((class | DynamicClass) == DirectColor) { rmask = mask & RGBMASK(pmap->pVisual); result = FreeCo(pmap, client, REDMAP, count, pixels, mask & pmap->pVisual->redMask); /* If any of the three calls fails, we must report that, if more * than one fails, it's ok that we report the last one */ rval = FreeCo(pmap, client, GREENMAP, count, pixels, mask & pmap->pVisual->greenMask); if(rval != Success) result = rval; rval = FreeCo(pmap, client, BLUEMAP, count, pixels, mask & pmap->pVisual->blueMask); if(rval != Success) result = rval; } else { rmask = mask & ((((Pixel)1) << pmap->pVisual->nplanes) - 1); result = FreeCo(pmap, client, PSEUDOMAP, count, pixels, rmask); } if ((mask != rmask) && count) { clientErrorValue = *pixels | mask; result = BadValue; } /* XXX should worry about removing any RT_CMAPENTRY resource */ return (result); } /** * Helper for FreeColors -- frees all combinations of *newpixels and mask bits * which the client has allocated in channel colormap cells of pmap. * doesn't change newpixels if it doesn't need to * * \param pmap which colormap head * \param color which sub-map, eg, RED, BLUE, PSEUDO * \param npixIn number of pixels passed in * \param ppixIn number of base pixels * \param mask mask client gave us */ static int FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixel mask) { Pixel *ppixClient, pixTest; int npixClient, npixNew, npix; Pixel bits, base, cmask, rgbbad; Pixel *pptr, *cptr; int n, zapped; int errVal = Success; int offset, numents; if (npixIn == 0) return (errVal); bits = 0; zapped = 0; base = lowbit (mask); switch(color) { case REDMAP: cmask = pmap->pVisual->redMask; rgbbad = ~RGBMASK(pmap->pVisual); offset = pmap->pVisual->offsetRed; numents = (cmask >> offset) + 1; ppixClient = pmap->clientPixelsRed[client]; npixClient = pmap->numPixelsRed[client]; break; case GREENMAP: cmask = pmap->pVisual->greenMask; rgbbad = ~RGBMASK(pmap->pVisual); offset = pmap->pVisual->offsetGreen; numents = (cmask >> offset) + 1; ppixClient = pmap->clientPixelsGreen[client]; npixClient = pmap->numPixelsGreen[client]; break; case BLUEMAP: cmask = pmap->pVisual->blueMask; rgbbad = ~RGBMASK(pmap->pVisual); offset = pmap->pVisual->offsetBlue; numents = (cmask >> offset) + 1; ppixClient = pmap->clientPixelsBlue[client]; npixClient = pmap->numPixelsBlue[client]; break; default: /* so compiler can see that everything gets initialized */ case PSEUDOMAP: cmask = ~((Pixel)0); rgbbad = 0; offset = 0; numents = pmap->pVisual->ColormapEntries; ppixClient = pmap->clientPixelsRed[client]; npixClient = pmap->numPixelsRed[client]; break; } /* zap all pixels which match */ while (1) { /* go through pixel list */ for (pptr = ppixIn, n = npixIn; --n >= 0; pptr++) { pixTest = ((*pptr | bits) & cmask) >> offset; if ((pixTest >= numents) || (*pptr & rgbbad)) { clientErrorValue = *pptr | bits; errVal = BadValue; continue; } /* find match in client list */ for (cptr = ppixClient, npix = npixClient; --npix >= 0 && *cptr != pixTest; cptr++) ; if (npix >= 0) { if (pmap->class & DynamicClass) { FreeCell(pmap, pixTest, color); } *cptr = ~((Pixel)0); zapped++; } else errVal = BadAccess; } /* generate next bits value */ GetNextBitsOrBreak(bits, mask, base); } /* delete freed pixels from client pixel list */ if (zapped) { npixNew = npixClient - zapped; if (npixNew) { /* Since the list can only get smaller, we can do a copy in * place and then realloc to a smaller size */ pptr = cptr = ppixClient; /* If we have all the new pixels, we don't have to examine the * rest of the old ones */ for(npix = 0; npix < npixNew; cptr++) { if (*cptr != ~((Pixel)0)) { *pptr++ = *cptr; npix++; } } pptr = (Pixel *)realloc(ppixClient, npixNew * sizeof(Pixel)); if (pptr) ppixClient = pptr; npixClient = npixNew; } else { npixClient = 0; free(ppixClient); ppixClient = (Pixel *)NULL; } switch(color) { case PSEUDOMAP: case REDMAP: pmap->clientPixelsRed[client] = ppixClient; pmap->numPixelsRed[client] = npixClient; break; case GREENMAP: pmap->clientPixelsGreen[client] = ppixClient; pmap->numPixelsGreen[client] = npixClient; break; case BLUEMAP: pmap->clientPixelsBlue[client] = ppixClient; pmap->numPixelsBlue[client] = npixClient; break; } } return (errVal); } /* Redefine color values */ int StoreColors (ColormapPtr pmap, int count, xColorItem *defs) { register Pixel pix; register xColorItem *pdef; register EntryPtr pent, pentT, pentLast; register VisualPtr pVisual; SHAREDCOLOR *pred, *pgreen, *pblue; int n, ChgRed, ChgGreen, ChgBlue, idef; int class, errVal = Success; int ok; class = pmap->class; if(!(class & DynamicClass) && !(pmap->flags & BeingCreated)) { return(BadAccess); } pVisual = pmap->pVisual; idef = 0; if((class | DynamicClass) == DirectColor) { int numred, numgreen, numblue; Pixel rgbbad; numred = NUMRED(pVisual); numgreen = NUMGREEN(pVisual); numblue = NUMBLUE(pVisual); rgbbad = ~RGBMASK(pVisual); for (pdef = defs, n = 0; n < count; pdef++, n++) { ok = TRUE; (*pmap->pScreen->ResolveColor) (&pdef->red, &pdef->green, &pdef->blue, pmap->pVisual); if (pdef->pixel & rgbbad) { errVal = BadValue; clientErrorValue = pdef->pixel; continue; } pix = (pdef->pixel & pVisual->redMask) >> pVisual->offsetRed; if (pix >= numred) { errVal = BadValue; ok = FALSE; } else if (pmap->red[pix].refcnt != AllocPrivate) { errVal = BadAccess; ok = FALSE; } else if (pdef->flags & DoRed) { pmap->red[pix].co.local.red = pdef->red; } else { pdef->red = pmap->red[pix].co.local.red; } pix = (pdef->pixel & pVisual->greenMask) >> pVisual->offsetGreen; if (pix >= numgreen) { errVal = BadValue; ok = FALSE; } else if (pmap->green[pix].refcnt != AllocPrivate) { errVal = BadAccess; ok = FALSE; } else if (pdef->flags & DoGreen) { pmap->green[pix].co.local.green = pdef->green; } else { pdef->green = pmap->green[pix].co.local.green; } pix = (pdef->pixel & pVisual->blueMask) >> pVisual->offsetBlue; if (pix >= numblue) { errVal = BadValue; ok = FALSE; } else if (pmap->blue[pix].refcnt != AllocPrivate) { errVal = BadAccess; ok = FALSE; } else if (pdef->flags & DoBlue) { pmap->blue[pix].co.local.blue = pdef->blue; } else { pdef->blue = pmap->blue[pix].co.local.blue; } /* If this is an o.k. entry, then it gets added to the list * to be sent to the hardware. If not, skip it. Once we've * skipped one, we have to copy all the others. */ if(ok) { if(idef != n) defs[idef] = defs[n]; idef++; } else clientErrorValue = pdef->pixel; } } else { for (pdef = defs, n = 0; n < count; pdef++, n++) { ok = TRUE; if (pdef->pixel >= pVisual->ColormapEntries) { clientErrorValue = pdef->pixel; errVal = BadValue; ok = FALSE; } else if (pmap->red[pdef->pixel].refcnt != AllocPrivate) { errVal = BadAccess; ok = FALSE; } /* If this is an o.k. entry, then it gets added to the list * to be sent to the hardware. If not, skip it. Once we've * skipped one, we have to copy all the others. */ if(ok) { if(idef != n) defs[idef] = defs[n]; idef++; } else continue; (*pmap->pScreen->ResolveColor) (&pdef->red, &pdef->green, &pdef->blue, pmap->pVisual); pent = &pmap->red[pdef->pixel]; if(pdef->flags & DoRed) { if(pent->fShared) { pent->co.shco.red->color = pdef->red; if (pent->co.shco.red->refcnt > 1) ok = FALSE; } else pent->co.local.red = pdef->red; } else { if(pent->fShared) pdef->red = pent->co.shco.red->color; else pdef->red = pent->co.local.red; } if(pdef->flags & DoGreen) { if(pent->fShared) { pent->co.shco.green->color = pdef->green; if (pent->co.shco.green->refcnt > 1) ok = FALSE; } else pent->co.local.green = pdef->green; } else { if(pent->fShared) pdef->green = pent->co.shco.green->color; else pdef->green = pent->co.local.green; } if(pdef->flags & DoBlue) { if(pent->fShared) { pent->co.shco.blue->color = pdef->blue; if (pent->co.shco.blue->refcnt > 1) ok = FALSE; } else pent->co.local.blue = pdef->blue; } else { if(pent->fShared) pdef->blue = pent->co.shco.blue->color; else pdef->blue = pent->co.local.blue; } if(!ok) { /* have to run through the colormap and change anybody who * shares this value */ pred = pent->co.shco.red; pgreen = pent->co.shco.green; pblue = pent->co.shco.blue; ChgRed = pdef->flags & DoRed; ChgGreen = pdef->flags & DoGreen; ChgBlue = pdef->flags & DoBlue; pentLast = pmap->red + pVisual->ColormapEntries; for(pentT = pmap->red; pentT < pentLast; pentT++) { if(pentT->fShared && (pentT != pent)) { xColorItem defChg; /* There are, alas, devices in this world too dumb * to read their own hardware colormaps. Sick, but * true. So we're going to be really nice and load * the xColorItem with the proper value for all the * fields. We will only set the flags for those * fields that actually change. Smart devices can * arrange to change only those fields. Dumb devices * can rest assured that we have provided for them, * and can change all three fields */ defChg.flags = 0; if(ChgRed && pentT->co.shco.red == pred) { defChg.flags |= DoRed; } if(ChgGreen && pentT->co.shco.green == pgreen) { defChg.flags |= DoGreen; } if(ChgBlue && pentT->co.shco.blue == pblue) { defChg.flags |= DoBlue; } if(defChg.flags != 0) { defChg.pixel = pentT - pmap->red; defChg.red = pentT->co.shco.red->color; defChg.green = pentT->co.shco.green->color; defChg.blue = pentT->co.shco.blue->color; (*pmap->pScreen->StoreColors) (pmap, 1, &defChg); } } } } } } /* Note that we use idef, the count of acceptable entries, and not * count, the count of proposed entries */ if (idef != 0) ( *pmap->pScreen->StoreColors) (pmap, idef, defs); return (errVal); } int IsMapInstalled(Colormap map, WindowPtr pWin) { Colormap *pmaps; int imap, nummaps, found; pmaps = (Colormap *) malloc( pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap)); if(!pmaps) return(FALSE); nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps) (pWin->drawable.pScreen, pmaps); found = FALSE; for(imap = 0; imap < nummaps; imap++) { if(pmaps[imap] == map) { found = TRUE; break; } } free(pmaps); return (found); } struct colormap_lookup_data { ScreenPtr pScreen; VisualPtr visuals; }; static void _colormap_find_resource(void *value, XID id, void *cdata) { struct colormap_lookup_data *cmap_data = cdata; VisualPtr visuals = cmap_data->visuals; ScreenPtr pScreen = cmap_data->pScreen; ColormapPtr cmap = value; int j; if (pScreen != cmap->pScreen) return; j = cmap->pVisual - pScreen->visuals; cmap->pVisual = &visuals[j]; } /* something has realloced the visuals, instead of breaking ABI fix it up here - glx and compsite did this wrong */ Bool ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth) { struct colormap_lookup_data cdata; int numVisuals; VisualPtr visuals; XID *vids, vid; int first_new_vid, first_new_visual, i; first_new_vid = depth->numVids; first_new_visual = pScreen->numVisuals; vids = reallocarray(depth->vids, depth->numVids + new_visual_count, sizeof(XID)); if (!vids) return FALSE; /* its realloced now no going back if we fail the next one */ depth->vids = vids; numVisuals = pScreen->numVisuals + new_visual_count; visuals = reallocarray(pScreen->visuals, numVisuals, sizeof(VisualRec)); if (!visuals) { return FALSE; } cdata.visuals = visuals; cdata.pScreen = pScreen; FindClientResourcesByType(serverClient, RT_COLORMAP, _colormap_find_resource, &cdata); pScreen->visuals = visuals; for (i = 0; i < new_visual_count; i++) { vid = FakeClientID(0); pScreen->visuals[first_new_visual + i].vid = vid; vids[first_new_vid + i] = vid; } depth->numVids += new_visual_count; pScreen->numVisuals += new_visual_count; return TRUE; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/cursor.c0000644000000000000000000002656513614532331017056 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "servermd.h" #include "scrnintstr.h" #include "dixstruct.h" #include "cursorstr.h" #include "dixfontstr.h" #include "opaque.h" typedef struct _GlyphShare { FontPtr font; unsigned short sourceChar; unsigned short maskChar; CursorBitsPtr bits; struct _GlyphShare *next; } GlyphShare, *GlyphSharePtr; static GlyphSharePtr sharedGlyphs = (GlyphSharePtr)NULL; #ifdef XFIXES static CARD32 cursorSerial; #endif static void FreeCursorBits(CursorBitsPtr bits) { if (--bits->refcnt > 0) return; free(bits->source); free(bits->mask); #ifdef ARGB_CURSOR free(bits->argb); #endif if (bits->refcnt == 0) { register GlyphSharePtr *prev, this; for (prev = &sharedGlyphs; (this = *prev) && (this->bits != bits); prev = &this->next) ; if (this) { *prev = this->next; CloseFont(this->font, (Font)0); free(this); } free(bits); } } /** * To be called indirectly by DeleteResource; must use exactly two args. * * \param value must conform to DeleteType */ int FreeCursor(void * value, XID cid) { int nscr; CursorPtr pCurs = (CursorPtr)value; ScreenPtr pscr; if ( --pCurs->refcnt > 0) return(Success); for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { pscr = screenInfo.screens[nscr]; (void)( *pscr->UnrealizeCursor)( pscr, pCurs); } FreeCursorBits(pCurs->bits); free( pCurs); return(Success); } /* * We check for empty cursors so that we won't have to display them */ static void CheckForEmptyMask(CursorBitsPtr bits) { register unsigned char *msk = bits->mask; int n = BitmapBytePad(bits->width) * bits->height; bits->emptyMask = FALSE; while(n--) if(*(msk++) != 0) return; #ifdef ARGB_CURSOR if (bits->argb) { CARD32 *argb = bits->argb; n = bits->width * bits->height; while (n--) if (*argb++ & 0xff000000) return; } #endif bits->emptyMask = TRUE; } /** * does nothing about the resource table, just creates the data structure. * does not copy the src and mask bits * * \param psrcbits server-defined padding * \param pmaskbits server-defined padding * \param argb no padding */ CursorPtr AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb, CursorMetricPtr cm, unsigned foreRed, unsigned foreGreen, unsigned foreBlue, unsigned backRed, unsigned backGreen, unsigned backBlue) { CursorBitsPtr bits; CursorPtr pCurs; int nscr; ScreenPtr pscr; pCurs = (CursorPtr)malloc(sizeof(CursorRec) + sizeof(CursorBits)); if (!pCurs) { free(psrcbits); free(pmaskbits); return (CursorPtr)NULL; } bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec)); bits->source = psrcbits; bits->mask = pmaskbits; #ifdef ARGB_CURSOR bits->argb = argb; #endif bits->width = cm->width; bits->height = cm->height; bits->xhot = cm->xhot; bits->yhot = cm->yhot; bits->refcnt = -1; CheckForEmptyMask(bits); pCurs->bits = bits; pCurs->refcnt = 1; #ifdef XFIXES pCurs->serialNumber = ++cursorSerial; pCurs->name = None; #endif pCurs->foreRed = foreRed; pCurs->foreGreen = foreGreen; pCurs->foreBlue = foreBlue; pCurs->backRed = backRed; pCurs->backGreen = backGreen; pCurs->backBlue = backBlue; /* * realize the cursor for every screen */ for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { pscr = screenInfo.screens[nscr]; if (!( *pscr->RealizeCursor)( pscr, pCurs)) { while (--nscr >= 0) { pscr = screenInfo.screens[nscr]; ( *pscr->UnrealizeCursor)( pscr, pCurs); } FreeCursorBits(bits); free(pCurs); return (CursorPtr)NULL; } } return pCurs; } /** * * \param psrcbits server-defined padding * \param pmaskbits server-defined padding */ CursorPtr AllocCursor(unsigned char *psrcbits, unsigned char *pmaskbits, CursorMetricPtr cm, unsigned foreRed, unsigned foreGreen, unsigned foreBlue, unsigned backRed, unsigned backGreen, unsigned backBlue) { return AllocCursorARGB (psrcbits, pmaskbits, (CARD32 *) 0, cm, foreRed, foreGreen, foreBlue, backRed, backGreen, backBlue); } int AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, unsigned foreRed, unsigned foreGreen, unsigned foreBlue, unsigned backRed, unsigned backGreen, unsigned backBlue, CursorPtr *ppCurs, ClientPtr client) { FontPtr sourcefont, maskfont; unsigned char *srcbits; unsigned char *mskbits; CursorMetricRec cm; int res; CursorBitsPtr bits; CursorPtr pCurs; int nscr; ScreenPtr pscr; GlyphSharePtr pShare; sourcefont = (FontPtr) SecurityLookupIDByType(client, source, RT_FONT, DixReadAccess); maskfont = (FontPtr) SecurityLookupIDByType(client, mask, RT_FONT, DixReadAccess); if (!sourcefont) { client->errorValue = source; return(BadFont); } if (!maskfont && (mask != None)) { client->errorValue = mask; return(BadFont); } if (sourcefont != maskfont) pShare = (GlyphSharePtr)NULL; else { for (pShare = sharedGlyphs; pShare && ((pShare->font != sourcefont) || (pShare->sourceChar != sourceChar) || (pShare->maskChar != maskChar)); pShare = pShare->next) ; } if (pShare) { pCurs = (CursorPtr)malloc(sizeof(CursorRec)); if (!pCurs) return BadAlloc; bits = pShare->bits; bits->refcnt++; } else { if (!CursorMetricsFromGlyph(sourcefont, sourceChar, &cm)) { client->errorValue = sourceChar; return BadValue; } if (!maskfont) { register long n; register unsigned char *mskptr; n = BitmapBytePad(cm.width)*(long)cm.height; mskptr = mskbits = (unsigned char *)malloc(n); if (!mskptr) return BadAlloc; while (--n >= 0) *mskptr++ = ~0; } else { if (!CursorMetricsFromGlyph(maskfont, maskChar, &cm)) { client->errorValue = maskChar; return BadValue; } if ((res = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits)) != 0) return res; } if ((res = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits)) != 0) { free(mskbits); return res; } if (sourcefont != maskfont) { pCurs = (CursorPtr)malloc(sizeof(CursorRec) + sizeof(CursorBits)); if (pCurs) bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec)); else bits = (CursorBitsPtr)NULL; } else { pCurs = (CursorPtr)malloc(sizeof(CursorRec)); if (pCurs) bits = (CursorBitsPtr)malloc(sizeof(CursorBits)); else bits = (CursorBitsPtr)NULL; } if (!bits) { free(pCurs); free(mskbits); free(srcbits); return BadAlloc; } bits->source = srcbits; bits->mask = mskbits; #ifdef ARGB_CURSOR bits->argb = 0; #endif bits->width = cm.width; bits->height = cm.height; bits->xhot = cm.xhot; bits->yhot = cm.yhot; if (sourcefont != maskfont) bits->refcnt = -1; else { bits->refcnt = 1; pShare = (GlyphSharePtr)malloc(sizeof(GlyphShare)); if (!pShare) { FreeCursorBits(bits); free(pCurs); return BadAlloc; } pShare->font = sourcefont; sourcefont->refcnt++; pShare->sourceChar = sourceChar; pShare->maskChar = maskChar; pShare->bits = bits; pShare->next = sharedGlyphs; sharedGlyphs = pShare; } } CheckForEmptyMask(bits); pCurs->bits = bits; pCurs->refcnt = 1; #ifdef XFIXES pCurs->serialNumber = ++cursorSerial; pCurs->name = None; #endif pCurs->foreRed = foreRed; pCurs->foreGreen = foreGreen; pCurs->foreBlue = foreBlue; pCurs->backRed = backRed; pCurs->backGreen = backGreen; pCurs->backBlue = backBlue; /* * realize the cursor for every screen */ for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { pscr = screenInfo.screens[nscr]; if (!( *pscr->RealizeCursor)( pscr, pCurs)) { while (--nscr >= 0) { pscr = screenInfo.screens[nscr]; ( *pscr->UnrealizeCursor)( pscr, pCurs); } FreeCursorBits(pCurs->bits); free(pCurs); return BadAlloc; } } *ppCurs = pCurs; return Success; } /** CreateRootCursor * * look up the name of a font * open the font * add the font to the resource table * make a cursor from the glyphs * add the cursor to the resource table *************************************************************/ CursorPtr CreateRootCursor(char *pfilename, unsigned glyph) { CursorPtr curs; FontPtr cursorfont; int err; XID fontID; fontID = FakeClientID(0); err = OpenFont(serverClient, fontID, FontLoadAll | FontOpenSync, (unsigned)strlen( pfilename), pfilename); if (err != Success) return NullCursor; cursorfont = (FontPtr)LookupIDByType(fontID, RT_FONT); if (!cursorfont) return NullCursor; if (AllocGlyphCursor(fontID, glyph, fontID, glyph + 1, 0, 0, 0, ~0, ~0, ~0, &curs, serverClient) != Success) return NullCursor; if (!AddResource(FakeClientID(0), RT_CURSOR, (void *)curs)) return NullCursor; return curs; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/devices.c0000644000000000000000000012340213614532331017147 0ustar /************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "misc.h" #include "resource.h" #include #include "windowstr.h" #include "inputstr.h" #include "scrnintstr.h" #include "cursorstr.h" #include "dixstruct.h" #include "site.h" #ifdef XKB #include "xkbsrv.h" #endif #ifdef XCSECURITY #define _SECURITY_SERVER #include #endif #include "dispatch.h" #include "swaprep.h" #include "dixevents.h" DeviceIntPtr AddInputDevice(DeviceProc deviceProc, Bool autoStart) { register DeviceIntPtr dev; if (inputInfo.numDevices >= MAX_DEVICES) return (DeviceIntPtr)NULL; dev = (DeviceIntPtr) calloc(1, sizeof(DeviceIntRec)); if (!dev) return (DeviceIntPtr)NULL; dev->name = (char *)NULL; dev->type = 0; dev->id = inputInfo.numDevices; inputInfo.numDevices++; dev->public.on = FALSE; dev->public.processInputProc = (ProcessInputProc)NoopDDA; dev->public.realInputProc = (ProcessInputProc)NoopDDA; dev->public.enqueueInputProc = EnqueueEvent; dev->deviceProc = deviceProc; dev->startup = autoStart; dev->sync.frozen = FALSE; dev->sync.other = NullGrab; dev->sync.state = NOT_GRABBED; dev->sync.event = (xEvent *) NULL; dev->sync.evcount = 0; dev->grab = NullGrab; dev->grabTime = currentTime; dev->fromPassiveGrab = FALSE; dev->key = (KeyClassPtr)NULL; dev->valuator = (ValuatorClassPtr)NULL; dev->button = (ButtonClassPtr)NULL; dev->focus = (FocusClassPtr)NULL; dev->proximity = (ProximityClassPtr)NULL; dev->kbdfeed = (KbdFeedbackPtr)NULL; dev->ptrfeed = (PtrFeedbackPtr)NULL; dev->intfeed = (IntegerFeedbackPtr)NULL; dev->stringfeed = (StringFeedbackPtr)NULL; dev->bell = (BellFeedbackPtr)NULL; dev->leds = (LedFeedbackPtr)NULL; dev->next = inputInfo.off_devices; #ifdef XKB dev->xkb_interest= NULL; #endif dev->nPrivates = 0; dev->devPrivates = NULL; dev->unwrapProc = NULL; inputInfo.off_devices = dev; return dev; } Bool EnableDevice(register DeviceIntPtr dev) { register DeviceIntPtr *prev; for (prev = &inputInfo.off_devices; *prev && (*prev != dev); prev = &(*prev)->next) ; if ((*prev != dev) || !dev->inited || ((*dev->deviceProc)(dev, DEVICE_ON) != Success)) return FALSE; *prev = dev->next; dev->next = inputInfo.devices; inputInfo.devices = dev; return TRUE; } Bool DisableDevice(register DeviceIntPtr dev) { register DeviceIntPtr *prev; for (prev = &inputInfo.devices; *prev && (*prev != dev); prev = &(*prev)->next) ; if (*prev != dev) return FALSE; (void)(*dev->deviceProc)(dev, DEVICE_OFF); *prev = dev->next; dev->next = inputInfo.off_devices; inputInfo.off_devices = dev; return TRUE; } int InitAndStartDevices() { register DeviceIntPtr dev, next; for (dev = inputInfo.off_devices; dev; dev = dev->next) dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success); for (dev = inputInfo.off_devices; dev; dev = next) { next = dev->next; if (dev->inited && dev->startup) (void)EnableDevice(dev); } for (dev = inputInfo.devices; dev && (dev != inputInfo.keyboard); dev = dev->next) ; if (!dev || (dev != inputInfo.keyboard)) { ErrorF("No core keyboard\n"); return BadImplementation; } for (dev = inputInfo.devices; dev && (dev != inputInfo.pointer); dev = dev->next) ; if (!dev || (dev != inputInfo.pointer)) { ErrorF("No core pointer\n"); return BadImplementation; } return Success; } static void CloseDevice(register DeviceIntPtr dev) { KbdFeedbackPtr k, knext; PtrFeedbackPtr p, pnext; IntegerFeedbackPtr i, inext; StringFeedbackPtr s, snext; BellFeedbackPtr b, bnext; LedFeedbackPtr l, lnext; if (dev->inited) (void)(*dev->deviceProc)(dev, DEVICE_CLOSE); #ifdef XKB while (dev->xkb_interest) { XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource); } #endif free(dev->name); if (dev->key) { #ifdef XKB if (dev->key->xkbInfo) XkbFreeInfo(dev->key->xkbInfo); #endif dev->key->xkbInfo = NULL; free(dev->key->curKeySyms.map); free(dev->key->modifierKeyMap); free(dev->key); } free(dev->valuator); #ifdef XKB if ((dev->button)&&(dev->button->xkb_acts)) free(dev->button->xkb_acts); #endif free(dev->button); if (dev->focus) { free(dev->focus->trace); free(dev->focus); } free(dev->proximity); for (k=dev->kbdfeed; k; k=knext) { knext = k->next; #ifdef XKB if (k->xkb_sli) XkbFreeSrvLedInfo(k->xkb_sli); #endif free(k); } for (p=dev->ptrfeed; p; p=pnext) { pnext = p->next; free(p); } for (i=dev->intfeed; i; i=inext) { inext = i->next; free(i); } for (s=dev->stringfeed; s; s=snext) { snext = s->next; free(s->ctrl.symbols_supported); free(s->ctrl.symbols_displayed); free(s); } for (b=dev->bell; b; b=bnext) { bnext = b->next; free(b); } for (l=dev->leds; l; l=lnext) { lnext = l->next; #ifdef XKB if (l->xkb_sli) XkbFreeSrvLedInfo(l->xkb_sli); #endif free(l); } #ifdef XKB XkbFreePrivates(dev); #endif free(dev->devPrivates); free(dev->sync.event); free(dev); } void CloseDownDevices() { register DeviceIntPtr dev, next; for (dev = inputInfo.devices; dev; dev = next) { next = dev->next; CloseDevice(dev); } for (dev = inputInfo.off_devices; dev; dev = next) { next = dev->next; CloseDevice(dev); } inputInfo.devices = NULL; inputInfo.off_devices = NULL; inputInfo.keyboard = NULL; inputInfo.pointer = NULL; } void RemoveDevice(register DeviceIntPtr dev) { register DeviceIntPtr prev,tmp,next; prev= NULL; for (tmp= inputInfo.devices; tmp; (prev = tmp), (tmp = next)) { next = tmp->next; if (tmp==dev) { CloseDevice(tmp); if (prev==NULL) inputInfo.devices = next; else prev->next = next; inputInfo.numDevices--; if (inputInfo.keyboard == tmp) inputInfo.keyboard = NULL; else if (inputInfo.pointer == tmp) inputInfo.pointer = NULL; return; } } prev= NULL; for (tmp= inputInfo.off_devices; tmp; (prev = tmp), (tmp = next)) { next = tmp->next; if (tmp==dev) { CloseDevice(tmp); if (prev==NULL) inputInfo.off_devices = next; else prev->next = next; inputInfo.numDevices--; if (inputInfo.keyboard == tmp) inputInfo.keyboard = NULL; else if (inputInfo.pointer == tmp) inputInfo.pointer = NULL; return; } } ErrorF("Internal Error! Attempt to remove a non-existent device\n"); return; } int NumMotionEvents() { return inputInfo.pointer->valuator->numMotionEvents; } void RegisterPointerDevice(DeviceIntPtr device) { inputInfo.pointer = device; #ifdef XKB device->public.processInputProc = CoreProcessPointerEvent; device->public.realInputProc = CoreProcessPointerEvent; if (!noXkbExtension) XkbSetExtension(device,ProcessPointerEvent); #else device->public.processInputProc = ProcessPointerEvent; device->public.realInputProc = ProcessPointerEvent; #endif device->ActivateGrab = ActivatePointerGrab; device->DeactivateGrab = DeactivatePointerGrab; if (!device->name) { char *p = "pointer"; device->name = (char *)malloc(strlen(p) + 1); strcpy(device->name, p); } } void RegisterKeyboardDevice(DeviceIntPtr device) { inputInfo.keyboard = device; #ifdef XKB device->public.processInputProc = CoreProcessKeyboardEvent; device->public.realInputProc = CoreProcessKeyboardEvent; if (!noXkbExtension) XkbSetExtension(device,ProcessKeyboardEvent); #else device->public.processInputProc = ProcessKeyboardEvent; device->public.realInputProc = ProcessKeyboardEvent; #endif device->ActivateGrab = ActivateKeyboardGrab; device->DeactivateGrab = DeactivateKeyboardGrab; if (!device->name) { char *k = "keyboard"; device->name = (char *)malloc(strlen(k) + 1); strcpy(device->name, k); } } DevicePtr LookupKeyboardDevice() { return inputInfo.keyboard ? &inputInfo.keyboard->public : NULL; } DevicePtr LookupPointerDevice() { return inputInfo.pointer ? &inputInfo.pointer->public : NULL; } DevicePtr LookupDevice(int id) { DeviceIntPtr dev; for (dev=inputInfo.devices; dev; dev=dev->next) { if (dev->id == (CARD8)id) return (DevicePtr)dev; } for (dev=inputInfo.off_devices; dev; dev=dev->next) { if (dev->id == (CARD8)id) return (DevicePtr)dev; } return NULL; } void QueryMinMaxKeyCodes(KeyCode *minCode, KeyCode *maxCode) { if (inputInfo.keyboard) { *minCode = inputInfo.keyboard->key->curKeySyms.minKeyCode; *maxCode = inputInfo.keyboard->key->curKeySyms.maxKeyCode; } } Bool SetKeySymsMap(register KeySymsPtr dst, register KeySymsPtr src) { int i, j; int rowDif = src->minKeyCode - dst->minKeyCode; /* if keysym map size changes, grow map first */ if (src->mapWidth < dst->mapWidth) { for (i = src->minKeyCode; i <= src->maxKeyCode; i++) { #define SI(r, c) (((r-src->minKeyCode)*src->mapWidth) + (c)) #define DI(r, c) (((r - dst->minKeyCode)*dst->mapWidth) + (c)) for (j = 0; j < src->mapWidth; j++) dst->map[DI(i, j)] = src->map[SI(i, j)]; for (j = src->mapWidth; j < dst->mapWidth; j++) dst->map[DI(i, j)] = NoSymbol; #undef SI #undef DI } return TRUE; } else if (src->mapWidth > dst->mapWidth) { KeySym *map; int bytes = sizeof(KeySym) * src->mapWidth * (dst->maxKeyCode - dst->minKeyCode + 1); map = (KeySym *)malloc(bytes); if (!map) return FALSE; bzero((char *)map, bytes); if (dst->map) { for (i = 0; i <= dst->maxKeyCode-dst->minKeyCode; i++) memmove((char *)&map[i*src->mapWidth], (char *)&dst->map[i*dst->mapWidth], dst->mapWidth * sizeof(KeySym)); free(dst->map); } dst->mapWidth = src->mapWidth; dst->map = map; } memmove((char *)&dst->map[rowDif * dst->mapWidth], (char *)src->map, (int)(src->maxKeyCode - src->minKeyCode + 1) * dst->mapWidth * sizeof(KeySym)); return TRUE; } static Bool InitModMap(register KeyClassPtr keyc) { int i, j; CARD8 keysPerModifier[8]; CARD8 mask; keyc->maxKeysPerModifier = 0; for (i = 0; i < 8; i++) keysPerModifier[i] = 0; for (i = 8; i < MAP_LENGTH; i++) { for (j = 0, mask = 1; j < 8; j++, mask <<= 1) { if (mask & keyc->modifierMap[i]) { if (++keysPerModifier[j] > keyc->maxKeysPerModifier) keyc->maxKeysPerModifier = keysPerModifier[j]; } } } keyc->modifierKeyMap = (KeyCode *)calloc(8, keyc->maxKeysPerModifier); if (!keyc->modifierKeyMap && keyc->maxKeysPerModifier) return (FALSE); for (i = 0; i < 8; i++) keysPerModifier[i] = 0; for (i = 8; i < MAP_LENGTH; i++) { for (j = 0, mask = 1; j < 8; j++, mask <<= 1) { if (mask & keyc->modifierMap[i]) { keyc->modifierKeyMap[(j*keyc->maxKeysPerModifier) + keysPerModifier[j]] = i; keysPerModifier[j]++; } } } return TRUE; } Bool InitKeyClassDeviceStruct(DeviceIntPtr dev, KeySymsPtr pKeySyms, CARD8 pModifiers[]) { int i; register KeyClassPtr keyc; keyc = (KeyClassPtr)calloc(1, sizeof(KeyClassRec)); if (!keyc) return FALSE; keyc->curKeySyms.map = (KeySym *)NULL; keyc->curKeySyms.mapWidth = 0; keyc->curKeySyms.minKeyCode = pKeySyms->minKeyCode; keyc->curKeySyms.maxKeyCode = pKeySyms->maxKeyCode; keyc->modifierKeyMap = (KeyCode *)NULL; keyc->state = 0; keyc->prev_state = 0; if (pModifiers) memmove((char *)keyc->modifierMap, (char *)pModifiers, MAP_LENGTH); else bzero((char *)keyc->modifierMap, MAP_LENGTH); bzero((char *)keyc->down, DOWN_LENGTH); for (i = 0; i < 8; i++) keyc->modifierKeyCount[i] = 0; if (!SetKeySymsMap(&keyc->curKeySyms, pKeySyms) || !InitModMap(keyc)) { free(keyc->curKeySyms.map); free(keyc->modifierKeyMap); free(keyc); return FALSE; } dev->key = keyc; #ifdef XKB dev->key->xkbInfo= NULL; if (!noXkbExtension) XkbInitDevice(dev); #endif return TRUE; } Bool InitButtonClassDeviceStruct(register DeviceIntPtr dev, int numButtons, CARD8 *map) { register ButtonClassPtr butc; int i; butc = (ButtonClassPtr)calloc(1, sizeof(ButtonClassRec)); if (!butc) return FALSE; butc->numButtons = numButtons; for (i = 1; i <= numButtons; i++) butc->map[i] = map[i]; butc->buttonsDown = 0; butc->state = 0; butc->motionMask = 0; bzero((char *)butc->down, DOWN_LENGTH); #ifdef XKB butc->xkb_acts= NULL; #endif dev->button = butc; return TRUE; } Bool InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, ValuatorMotionProcPtr motionProc, int numMotionEvents, int mode) { int i; register ValuatorClassPtr valc; valc = (ValuatorClassPtr)calloc(1, sizeof(ValuatorClassRec) + numAxes * sizeof(AxisInfo) + numAxes * sizeof(unsigned int)); if (!valc) return FALSE; valc->GetMotionProc = motionProc; valc->numMotionEvents = numMotionEvents; valc->motionHintWindow = NullWindow; valc->numAxes = numAxes; valc->mode = mode; valc->axes = (AxisInfoPtr)(valc + 1); valc->axisVal = (int *)(valc->axes + numAxes); for (i=0; iaxisVal[i]=0; dev->valuator = valc; return TRUE; } Bool InitFocusClassDeviceStruct(DeviceIntPtr dev) { register FocusClassPtr focc; focc = (FocusClassPtr)calloc(1, sizeof(FocusClassRec)); if (!focc) return FALSE; focc->win = PointerRootWin; focc->revert = None; focc->time = currentTime; focc->trace = (WindowPtr *)NULL; focc->traceSize = 0; focc->traceGood = 0; dev->focus = focc; return TRUE; } Bool InitKbdFeedbackClassDeviceStruct(DeviceIntPtr dev, BellProcPtr bellProc, KbdCtrlProcPtr controlProc) { register KbdFeedbackPtr feedc; feedc = (KbdFeedbackPtr)calloc(1, sizeof(KbdFeedbackClassRec)); if (!feedc) return FALSE; feedc->BellProc = bellProc; feedc->CtrlProc = controlProc; #ifdef XKB defaultKeyboardControl.autoRepeat = TRUE; #endif feedc->ctrl = defaultKeyboardControl; feedc->ctrl.id = 0; if ((feedc->next = dev->kbdfeed) != 0) feedc->ctrl.id = dev->kbdfeed->ctrl.id + 1; dev->kbdfeed = feedc; #ifdef XKB feedc->xkb_sli= NULL; if (!noXkbExtension) XkbFinishDeviceInit(dev); #endif (*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl); return TRUE; } Bool InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc) { register PtrFeedbackPtr feedc; feedc = (PtrFeedbackPtr)calloc(1, sizeof(PtrFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; feedc->ctrl = defaultPointerControl; feedc->ctrl.id = 0; if ( (feedc->next = dev->ptrfeed) ) feedc->ctrl.id = dev->ptrfeed->ctrl.id + 1; dev->ptrfeed = feedc; (*controlProc)(dev, &feedc->ctrl); return TRUE; } LedCtrl defaultLedControl = { DEFAULT_LEDS, DEFAULT_LEDS_MASK, 0}; BellCtrl defaultBellControl = { DEFAULT_BELL, DEFAULT_BELL_PITCH, DEFAULT_BELL_DURATION, 0}; IntegerCtrl defaultIntegerControl = { DEFAULT_INT_RESOLUTION, DEFAULT_INT_MIN_VALUE, DEFAULT_INT_MAX_VALUE, DEFAULT_INT_DISPLAYED, 0}; Bool InitStringFeedbackClassDeviceStruct ( DeviceIntPtr dev, StringCtrlProcPtr controlProc, int max_symbols, int num_symbols_supported, KeySym *symbols) { int i; register StringFeedbackPtr feedc; feedc = (StringFeedbackPtr)calloc(1, sizeof(StringFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; feedc->ctrl.num_symbols_supported = num_symbols_supported; feedc->ctrl.num_symbols_displayed = 0; feedc->ctrl.max_symbols = max_symbols; feedc->ctrl.symbols_supported = (KeySym *) calloc (num_symbols_supported, sizeof (KeySym)); feedc->ctrl.symbols_displayed = (KeySym *) calloc (max_symbols, sizeof (KeySym)); if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed) { if (feedc->ctrl.symbols_supported) free(feedc->ctrl.symbols_supported); if (feedc->ctrl.symbols_displayed) free(feedc->ctrl.symbols_displayed); free(feedc); return FALSE; } for (i=0; ictrl.symbols_supported+i) = *symbols++; for (i=0; ictrl.symbols_displayed+i) = (KeySym) 0; feedc->ctrl.id = 0; if ( (feedc->next = dev->stringfeed) ) feedc->ctrl.id = dev->stringfeed->ctrl.id + 1; dev->stringfeed = feedc; (*controlProc)(dev, &feedc->ctrl); return TRUE; } Bool InitBellFeedbackClassDeviceStruct (DeviceIntPtr dev, BellProcPtr bellProc, BellCtrlProcPtr controlProc) { register BellFeedbackPtr feedc; feedc = (BellFeedbackPtr)calloc(1, sizeof(BellFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; feedc->BellProc = bellProc; feedc->ctrl = defaultBellControl; feedc->ctrl.id = 0; if ( (feedc->next = dev->bell) ) feedc->ctrl.id = dev->bell->ctrl.id + 1; dev->bell = feedc; (*controlProc)(dev, &feedc->ctrl); return TRUE; } Bool InitLedFeedbackClassDeviceStruct (DeviceIntPtr dev, LedCtrlProcPtr controlProc) { register LedFeedbackPtr feedc; feedc = (LedFeedbackPtr)calloc(1, sizeof(LedFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; feedc->ctrl = defaultLedControl; feedc->ctrl.id = 0; if ( (feedc->next = dev->leds) ) feedc->ctrl.id = dev->leds->ctrl.id + 1; #ifdef XKB feedc->xkb_sli= NULL; #endif dev->leds = feedc; (*controlProc)(dev, &feedc->ctrl); return TRUE; } Bool InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr controlProc) { register IntegerFeedbackPtr feedc; feedc = (IntegerFeedbackPtr)calloc(1, sizeof(IntegerFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; feedc->ctrl = defaultIntegerControl; feedc->ctrl.id = 0; if ( (feedc->next = dev->intfeed) ) feedc->ctrl.id = dev->intfeed->ctrl.id + 1; dev->intfeed = feedc; (*controlProc)(dev, &feedc->ctrl); return TRUE; } Bool InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons, ValuatorMotionProcPtr motionProc, PtrCtrlProcPtr controlProc, int numMotionEvents) { DeviceIntPtr dev = (DeviceIntPtr)device; return(InitButtonClassDeviceStruct(dev, numButtons, map) && InitValuatorClassDeviceStruct(dev, 2, motionProc, numMotionEvents, 0) && InitPtrFeedbackClassDeviceStruct(dev, controlProc)); } Bool InitKeyboardDeviceStruct(DevicePtr device, KeySymsPtr pKeySyms, CARD8 pModifiers[], BellProcPtr bellProc, KbdCtrlProcPtr controlProc) { DeviceIntPtr dev = (DeviceIntPtr)device; return(InitKeyClassDeviceStruct(dev, pKeySyms, pModifiers) && InitFocusClassDeviceStruct(dev) && InitKbdFeedbackClassDeviceStruct(dev, bellProc, controlProc)); } void SendMappingNotify(unsigned request, unsigned firstKeyCode, unsigned count, ClientPtr client) { int i; xEvent event; event.u.u.type = MappingNotify; event.u.mappingNotify.request = request; if (request == MappingKeyboard) { event.u.mappingNotify.firstKeyCode = firstKeyCode; event.u.mappingNotify.count = count; } #ifdef XKB if (!noXkbExtension && ((request == MappingKeyboard) || (request == MappingModifier))) { XkbApplyMappingChange(inputInfo.keyboard,request,firstKeyCode,count, client); } #endif /* 0 is the server client */ for (i=1; iclientState == ClientStateRunning) { #ifdef XKB if (!noXkbExtension && (request == MappingKeyboard) && (clients[i]->xkbClientFlags != 0) && (clients[i]->mapNotifyMask&XkbKeySymsMask)) continue; #endif event.u.u.sequenceNumber = clients[i]->sequence; WriteEventsToClient(clients[i], 1, &event); } } } /* * n-squared algorithm. n < 255 and don't want to copy the whole thing and * sort it to do the checking. How often is it called? Just being lazy? */ Bool BadDeviceMap(register BYTE *buff, int length, unsigned low, unsigned high, XID *errval) { register int i, j; for (i = 0; i < length; i++) if (buff[i]) /* only check non-zero elements */ { if ((low > buff[i]) || (high < buff[i])) { *errval = buff[i]; return TRUE; } for (j = i + 1; j < length; j++) if (buff[i] == buff[j]) { *errval = buff[i]; return TRUE; } } return FALSE; } Bool AllModifierKeysAreUp(dev, map1, per1, map2, per2) register DeviceIntPtr dev; register CARD8 *map1, *map2; int per1, per2; { register int i, j, k; register CARD8 *down = dev->key->down; for (i = 8; --i >= 0; map2 += per2) { for (j = per1; --j >= 0; map1++) { if (*map1 && BitIsOn(down, *map1)) { for (k = per2; (--k >= 0) && (*map1 != map2[k]);) ; if (k < 0) return FALSE; } } } return TRUE; } int ProcSetModifierMapping(ClientPtr client) { xSetModifierMappingReply rep = {0}; REQUEST(xSetModifierMappingReq); KeyCode *inputMap; int inputMapLen; register int i; DeviceIntPtr keybd = inputInfo.keyboard; register KeyClassPtr keyc = keybd->key; REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq); if (client->req_len != ((stuff->numKeyPerModifier<<1) + (sizeof (xSetModifierMappingReq)>>2))) return BadLength; inputMapLen = 8*stuff->numKeyPerModifier; inputMap = (KeyCode *)&stuff[1]; /* * Now enforce the restriction that "all of the non-zero keycodes must be * in the range specified by min-keycode and max-keycode in the * connection setup (else a Value error)" */ i = inputMapLen; while (i--) { if (inputMap[i] && (inputMap[i] < keyc->curKeySyms.minKeyCode || inputMap[i] > keyc->curKeySyms.maxKeyCode)) { client->errorValue = inputMap[i]; return BadValue; } } #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(client, keybd, TRUE)) return BadAccess; #endif rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.success = MappingSuccess; /* * Now enforce the restriction that none of the old or new * modifier keys may be down while we change the mapping, and * that the DDX layer likes the choice. */ if (!AllModifierKeysAreUp(keybd, keyc->modifierKeyMap, (int)keyc->maxKeysPerModifier, inputMap, (int)stuff->numKeyPerModifier) || !AllModifierKeysAreUp(keybd, inputMap, (int)stuff->numKeyPerModifier, keyc->modifierKeyMap, (int)keyc->maxKeysPerModifier)) { rep.success = MappingBusy; } else { for (i = 0; i < inputMapLen; i++) { if (inputMap[i] && !LegalModifier(inputMap[i], (DevicePtr)keybd)) { rep.success = MappingFailed; break; } } } if (rep.success == MappingSuccess) { KeyCode *map; /* * Now build the keyboard's modifier bitmap from the * list of keycodes. */ map = (KeyCode *)malloc(inputMapLen); if (!map && inputMapLen) return BadAlloc; if (keyc->modifierKeyMap) free(keyc->modifierKeyMap); keyc->modifierKeyMap = map; memmove((char *)map, (char *)inputMap, inputMapLen); keyc->maxKeysPerModifier = stuff->numKeyPerModifier; for (i = 0; i < MAP_LENGTH; i++) keyc->modifierMap[i] = 0; for (i = 0; i < inputMapLen; i++) { if (inputMap[i]) keyc->modifierMap[inputMap[i]] |= (1<<(((unsigned int)i)/keyc->maxKeysPerModifier)); } } if (rep.success == MappingSuccess) SendMappingNotify(MappingModifier, 0, 0, client); WriteReplyToClient(client, sizeof(xSetModifierMappingReply), &rep); return(client->noClientException); } int ProcGetModifierMapping(ClientPtr client) { xGetModifierMappingReply rep = {0}; register KeyClassPtr keyc = inputInfo.keyboard->key; REQUEST_SIZE_MATCH(xReq); rep.type = X_Reply; rep.numKeyPerModifier = keyc->maxKeysPerModifier; rep.sequenceNumber = client->sequence; /* length counts 4 byte quantities - there are 8 modifiers 1 byte big */ rep.length = keyc->maxKeysPerModifier << 1; WriteReplyToClient(client, sizeof(xGetModifierMappingReply), &rep); /* Use the (modified by DDX) map that SetModifierMapping passed in */ WriteToClient(client, (int)(keyc->maxKeysPerModifier << 3), (char *)keyc->modifierKeyMap); return client->noClientException; } int ProcChangeKeyboardMapping(ClientPtr client) { REQUEST(xChangeKeyboardMappingReq); unsigned len; KeySymsRec keysyms; register KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms; REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq); len = client->req_len - (sizeof(xChangeKeyboardMappingReq) >> 2); if (len != (stuff->keyCodes * stuff->keySymsPerKeyCode)) return BadLength; if ((stuff->firstKeyCode < curKeySyms->minKeyCode) || (stuff->firstKeyCode > curKeySyms->maxKeyCode)) { client->errorValue = stuff->firstKeyCode; return BadValue; } if ( ((unsigned)(stuff->firstKeyCode + stuff->keyCodes - 1) > curKeySyms->maxKeyCode) || (stuff->keySymsPerKeyCode == 0)) { client->errorValue = stuff->keySymsPerKeyCode; return BadValue; } #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) return BadAccess; #endif keysyms.minKeyCode = stuff->firstKeyCode; keysyms.maxKeyCode = stuff->firstKeyCode + stuff->keyCodes - 1; keysyms.mapWidth = stuff->keySymsPerKeyCode; keysyms.map = (KeySym *)&stuff[1]; if (!SetKeySymsMap(curKeySyms, &keysyms)) return BadAlloc; SendMappingNotify(MappingKeyboard, stuff->firstKeyCode, stuff->keyCodes, client); return client->noClientException; } int ProcSetPointerMapping(ClientPtr client) { REQUEST(xSetPointerMappingReq); BYTE *map; xSetPointerMappingReply rep = {0}; register unsigned int i; DeviceIntPtr mouse = inputInfo.pointer; REQUEST_AT_LEAST_SIZE(xSetPointerMappingReq); if (client->req_len != (sizeof(xSetPointerMappingReq)+stuff->nElts+3) >> 2) return BadLength; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.success = MappingSuccess; map = (BYTE *)&stuff[1]; if (stuff->nElts != mouse->button->numButtons) { client->errorValue = stuff->nElts; return BadValue; } if (BadDeviceMap(&map[0], (int)stuff->nElts, 1, 255, &client->errorValue)) return BadValue; for (i=0; i < stuff->nElts; i++) if ((mouse->button->map[i + 1] != map[i]) && BitIsOn(mouse->button->down, i + 1)) { rep.success = MappingBusy; WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep); return Success; } for (i = 0; i < stuff->nElts; i++) mouse->button->map[i + 1] = map[i]; SendMappingNotify(MappingPointer, 0, 0, client); WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep); return Success; } int ProcGetKeyboardMapping(ClientPtr client) { xGetKeyboardMappingReply rep = {0}; REQUEST(xGetKeyboardMappingReq); KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms; REQUEST_SIZE_MATCH(xGetKeyboardMappingReq); if ((stuff->firstKeyCode < curKeySyms->minKeyCode) || (stuff->firstKeyCode > curKeySyms->maxKeyCode)) { client->errorValue = stuff->firstKeyCode; return BadValue; } if (stuff->firstKeyCode + stuff->count > (unsigned)(curKeySyms->maxKeyCode + 1)) { client->errorValue = stuff->count; return BadValue; } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.keySymsPerKeyCode = curKeySyms->mapWidth; /* length is a count of 4 byte quantities and KeySyms are 4 bytes */ rep.length = (curKeySyms->mapWidth * stuff->count); WriteReplyToClient(client, sizeof(xGetKeyboardMappingReply), &rep); client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; WriteSwappedDataToClient( client, curKeySyms->mapWidth * stuff->count * sizeof(KeySym), &curKeySyms->map[(stuff->firstKeyCode - curKeySyms->minKeyCode) * curKeySyms->mapWidth]); return client->noClientException; } int ProcGetPointerMapping(ClientPtr client) { int nElts; xGetPointerMappingReply rep = {0}; ButtonClassPtr butc = inputInfo.pointer->button; nElts = (butc) ? butc->numButtons : 0; REQUEST_SIZE_MATCH(xReq); rep.type = X_Reply; rep.nElts = nElts; rep.sequenceNumber = client->sequence; rep.length = ((unsigned)nElts + (4-1))/4; WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep); if (butc) WriteToClient(client, nElts, &butc->map[1]); return Success; } void NoteLedState(DeviceIntPtr keybd, int led, Bool on) { KeybdCtrl *ctrl = &keybd->kbdfeed->ctrl; if (on) ctrl->leds |= ((Leds)1 << (led - 1)); else ctrl->leds &= ~((Leds)1 << (led - 1)); } int Ones(unsigned long mask) /* HACKMEM 169 */ { register unsigned long y; y = (mask >> 1) &033333333333; y = mask - y - ((y >>1) & 033333333333); return (((y + (y >> 3)) & 030707070707) % 077); } int ProcChangeKeyboardControl (ClientPtr client) { #define DO_ALL (-1) KeybdCtrl ctrl; DeviceIntPtr keybd = inputInfo.keyboard; XID *vlist; int t; int led = DO_ALL; int key = DO_ALL; BITS32 vmask, index2; int mask, i; REQUEST(xChangeKeyboardControlReq); REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq); vmask = stuff->mask; if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask)) return BadLength; #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(client, keybd, TRUE)) return BadAccess; #endif vlist = (XID *)&stuff[1]; /* first word of values */ ctrl = keybd->kbdfeed->ctrl; while (vmask) { index2 = (BITS32) lowbit (vmask); vmask &= ~index2; switch (index2) { case KBKeyClickPercent: t = (INT8)*vlist; vlist++; if (t == -1) t = defaultKeyboardControl.click; else if (t < 0 || t > 100) { client->errorValue = t; return BadValue; } ctrl.click = t; break; case KBBellPercent: t = (INT8)*vlist; vlist++; if (t == -1) t = defaultKeyboardControl.bell; else if (t < 0 || t > 100) { client->errorValue = t; return BadValue; } ctrl.bell = t; break; case KBBellPitch: t = (INT16)*vlist; vlist++; if (t == -1) t = defaultKeyboardControl.bell_pitch; else if (t < 0) { client->errorValue = t; return BadValue; } ctrl.bell_pitch = t; break; case KBBellDuration: t = (INT16)*vlist; vlist++; if (t == -1) t = defaultKeyboardControl.bell_duration; else if (t < 0) { client->errorValue = t; return BadValue; } ctrl.bell_duration = t; break; case KBLed: led = (CARD8)*vlist; vlist++; if (led < 1 || led > 32) { client->errorValue = led; return BadValue; } if (!(stuff->mask & KBLedMode)) return BadMatch; break; case KBLedMode: t = (CARD8)*vlist; vlist++; if (t == LedModeOff) { if (led == DO_ALL) ctrl.leds = 0x0; else ctrl.leds &= ~(((Leds)(1)) << (led - 1)); } else if (t == LedModeOn) { if (led == DO_ALL) ctrl.leds = ~0L; else ctrl.leds |= (((Leds)(1)) << (led - 1)); } else { client->errorValue = t; return BadValue; } #ifdef XKB if (!noXkbExtension) { XkbEventCauseRec cause; XkbSetCauseCoreReq(&cause,X_ChangeKeyboardControl,client); XkbSetIndicators(keybd,((led == DO_ALL) ? ~0L : (1L<<(led-1))), ctrl.leds, &cause); ctrl.leds = keybd->kbdfeed->ctrl.leds; } #endif break; case KBKey: key = (KeyCode)*vlist; vlist++; if ((KeyCode)key < inputInfo.keyboard->key->curKeySyms.minKeyCode || (KeyCode)key > inputInfo.keyboard->key->curKeySyms.maxKeyCode) { client->errorValue = key; return BadValue; } if (!(stuff->mask & KBAutoRepeatMode)) return BadMatch; break; case KBAutoRepeatMode: i = (key >> 3); mask = (1 << (key & 7)); t = (CARD8)*vlist; vlist++; #ifdef XKB if (!noXkbExtension && key != DO_ALL) XkbDisableComputedAutoRepeats(keybd,key); #endif if (t == AutoRepeatModeOff) { if (key == DO_ALL) ctrl.autoRepeat = FALSE; else ctrl.autoRepeats[i] &= ~mask; } else if (t == AutoRepeatModeOn) { if (key == DO_ALL) ctrl.autoRepeat = TRUE; else ctrl.autoRepeats[i] |= mask; } else if (t == AutoRepeatModeDefault) { if (key == DO_ALL) ctrl.autoRepeat = defaultKeyboardControl.autoRepeat; else ctrl.autoRepeats[i] = (ctrl.autoRepeats[i] & ~mask) | (defaultKeyboardControl.autoRepeats[i] & mask); } else { client->errorValue = t; return BadValue; } break; default: client->errorValue = stuff->mask; return BadValue; } } keybd->kbdfeed->ctrl = ctrl; #ifdef XKB /* The XKB RepeatKeys control and core protocol global autorepeat */ /* value are linked */ if (!noXkbExtension) { XkbSetRepeatKeys(keybd,key,keybd->kbdfeed->ctrl.autoRepeat); } else #endif (*keybd->kbdfeed->CtrlProc)(keybd, &keybd->kbdfeed->ctrl); return Success; #undef DO_ALL } int ProcGetKeyboardControl (ClientPtr client) { int i; register KeybdCtrl *ctrl = &inputInfo.keyboard->kbdfeed->ctrl; xGetKeyboardControlReply rep = {0}; REQUEST_SIZE_MATCH(xReq); rep.type = X_Reply; rep.length = 5; rep.sequenceNumber = client->sequence; rep.globalAutoRepeat = ctrl->autoRepeat; rep.keyClickPercent = ctrl->click; rep.bellPercent = ctrl->bell; rep.bellPitch = ctrl->bell_pitch; rep.bellDuration = ctrl->bell_duration; rep.ledMask = ctrl->leds; for (i = 0; i < 32; i++) rep.map[i] = ctrl->autoRepeats[i]; WriteReplyToClient(client, sizeof(xGetKeyboardControlReply), &rep); return Success; } int ProcBell(ClientPtr client) { register DeviceIntPtr keybd = inputInfo.keyboard; int base = keybd->kbdfeed->ctrl.bell; int newpercent; REQUEST(xBellReq); REQUEST_SIZE_MATCH(xBellReq); if (stuff->percent < -100 || stuff->percent > 100) { client->errorValue = stuff->percent; return BadValue; } newpercent = (base * stuff->percent) / 100; if (stuff->percent < 0) newpercent = base + newpercent; else newpercent = base - newpercent + stuff->percent; #ifdef XKB if (!noXkbExtension) XkbHandleBell(FALSE,FALSE, keybd, newpercent, &keybd->kbdfeed->ctrl, 0, None, NULL, client); else #endif (*keybd->kbdfeed->BellProc)(newpercent, keybd, (void *) &keybd->kbdfeed->ctrl, 0); return Success; } int ProcChangePointerControl(ClientPtr client) { DeviceIntPtr mouse = inputInfo.pointer; PtrCtrl ctrl; /* might get BadValue part way through */ REQUEST(xChangePointerControlReq); REQUEST_SIZE_MATCH(xChangePointerControlReq); ctrl = mouse->ptrfeed->ctrl; if ((stuff->doAccel != xTrue) && (stuff->doAccel != xFalse)) { client->errorValue = stuff->doAccel; return(BadValue); } if ((stuff->doThresh != xTrue) && (stuff->doThresh != xFalse)) { client->errorValue = stuff->doThresh; return(BadValue); } if (stuff->doAccel) { if (stuff->accelNum == -1) ctrl.num = defaultPointerControl.num; else if (stuff->accelNum < 0) { client->errorValue = stuff->accelNum; return BadValue; } else ctrl.num = stuff->accelNum; if (stuff->accelDenum == -1) ctrl.den = defaultPointerControl.den; else if (stuff->accelDenum <= 0) { client->errorValue = stuff->accelDenum; return BadValue; } else ctrl.den = stuff->accelDenum; } if (stuff->doThresh) { if (stuff->threshold == -1) ctrl.threshold = defaultPointerControl.threshold; else if (stuff->threshold < 0) { client->errorValue = stuff->threshold; return BadValue; } else ctrl.threshold = stuff->threshold; } mouse->ptrfeed->ctrl = ctrl; (*mouse->ptrfeed->CtrlProc)(mouse, &mouse->ptrfeed->ctrl); return Success; } int ProcGetPointerControl(ClientPtr client) { register PtrCtrl *ctrl = &inputInfo.pointer->ptrfeed->ctrl; xGetPointerControlReply rep = {0}; REQUEST_SIZE_MATCH(xReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.threshold = ctrl->threshold; rep.accelNumerator = ctrl->num; rep.accelDenominator = ctrl->den; WriteReplyToClient(client, sizeof(xGenericReply), &rep); return Success; } void MaybeStopHint(register DeviceIntPtr dev, ClientPtr client) { GrabPtr grab = dev->grab; if ((grab && SameClient(grab, client) && ((grab->eventMask & PointerMotionHintMask) || (grab->ownerEvents && (EventMaskForClient(dev->valuator->motionHintWindow, client) & PointerMotionHintMask)))) || (!grab && (EventMaskForClient(dev->valuator->motionHintWindow, client) & PointerMotionHintMask))) dev->valuator->motionHintWindow = NullWindow; } int ProcGetMotionEvents(ClientPtr client) { WindowPtr pWin; xTimecoord * coords = (xTimecoord *) NULL; xGetMotionEventsReply rep = {0}; int i, count, xmin, xmax, ymin, ymax; unsigned long nEvents; DeviceIntPtr mouse = inputInfo.pointer; TimeStamp start, stop; REQUEST(xGetMotionEventsReq); REQUEST_SIZE_MATCH(xGetMotionEventsReq); pWin = SecurityLookupWindow(stuff->window, client, TRUE); if (!pWin) return BadWindow; if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); rep.type = X_Reply; rep.sequenceNumber = client->sequence; nEvents = 0; start = ClientTimeToServerTime(stuff->start); stop = ClientTimeToServerTime(stuff->stop); if ((CompareTimeStamps(start, stop) != LATER) && (CompareTimeStamps(start, currentTime) != LATER) && mouse->valuator->numMotionEvents) { if (CompareTimeStamps(stop, currentTime) == LATER) stop = currentTime; coords = (xTimecoord *)malloc(mouse->valuator->numMotionEvents * sizeof(xTimecoord)); if (!coords) return BadAlloc; count = (*mouse->valuator->GetMotionProc) (mouse, coords, start.milliseconds, stop.milliseconds, pWin->drawable.pScreen); xmin = pWin->drawable.x - wBorderWidth (pWin); xmax = pWin->drawable.x + (int)pWin->drawable.width + wBorderWidth (pWin); ymin = pWin->drawable.y - wBorderWidth (pWin); ymax = pWin->drawable.y + (int)pWin->drawable.height + wBorderWidth (pWin); for (i = 0; i < count; i++) if ((xmin <= coords[i].x) && (coords[i].x < xmax) && (ymin <= coords[i].y) && (coords[i].y < ymax)) { coords[nEvents].time = coords[i].time; coords[nEvents].x = coords[i].x - pWin->drawable.x; coords[nEvents].y = coords[i].y - pWin->drawable.y; nEvents++; } } rep.length = nEvents * (sizeof(xTimecoord) >> 2); rep.nEvents = nEvents; WriteReplyToClient(client, sizeof(xGetMotionEventsReply), &rep); if (nEvents) { client->pSwapReplyFunc = (ReplySwapPtr) SwapTimeCoordWrite; WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord), (char *)coords); } if (coords) free(coords); return Success; } int ProcQueryKeymap(ClientPtr client) { xQueryKeymapReply rep = {0}; int i; CARD8 *down = inputInfo.keyboard->key->down; REQUEST_SIZE_MATCH(xReq); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 2; #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) { bzero((char *)&rep.map[0], 32); } else #endif for (i = 0; i<32; i++) rep.map[i] = down[i]; WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep); return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/dispatch.c0000644000000000000000000033404513614532331017333 0ustar /************************************************************ Copyright 1987, 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* The panoramix components contained the following notice */ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifdef PANORAMIX_DEBUG #include int ProcInitialConnection(); #endif #include "windowstr.h" #include #ifdef HAS_XFONT2 # include #else # include #endif /* HAS_XFONT2 */ #include "dixfontstr.h" #include "gcstruct.h" #include "selection.h" #include "colormapst.h" #include "cursorstr.h" #include "scrnintstr.h" #include "opaque.h" #include "input.h" #include "servermd.h" #include "extnsionst.h" #include "dixfont.h" #include "dispatch.h" #include "swaprep.h" #include "swapreq.h" #ifdef PANORAMIX #include "../Xext/panoramiX.h" #include "../Xext/panoramiXsrv.h" #endif #ifdef XCSECURITY #define _SECURITY_SERVER #include #endif #ifdef XKB #include "inputstr.h" #include "xkbsrv.h" #endif #include "client.h" #define mskcnt ((MAXCLIENTS + 31) / 32) #define BITMASK(i) (1U << ((i) & 31)) #define MASKIDX(i) ((i) >> 5) #define MASKWORD(buf, i) buf[MASKIDX(i)] #define BITSET(buf, i) MASKWORD(buf, i) |= BITMASK(i) #define BITCLEAR(buf, i) MASKWORD(buf, i) &= ~BITMASK(i) #define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i)) extern xConnSetupPrefix connSetupPrefix; extern char *ConnectionInfo; extern int screenPrivateCount; Selection *CurrentSelections; int NumCurrentSelections; CallbackListPtr SelectionCallback = NULL; static ClientPtr grabClient; #define GrabNone 0 #define GrabActive 1 #define GrabKickout 2 static int grabState = GrabNone; static long grabWaiters[mskcnt]; CallbackListPtr ServerGrabCallback = NULL; HWEventQueuePtr checkForInput[2]; extern int connBlockScreenStart; static void KillAllClients(void); static void DeleteClientFromAnySelections(ClientPtr client); static int nextFreeClientID; /* always MIN free client ID */ static int nClients; /* number of authorized clients */ CallbackListPtr ClientStateCallback; /* dispatchException & isItTimeToYield must be declared volatile since they * are modified by signal handlers - otherwise optimizer may assume it doesn't * need to actually check value in memory when used and may miss changes from * signal handlers. */ volatile char dispatchException = 0; volatile char isItTimeToYield; /* Various of the DIX function interfaces were not designed to allow * the client->errorValue to be set on BadValue and other errors. * Rather than changing interfaces and breaking untold code we introduce * a new global that dispatch can use. */ XID clientErrorValue; /* XXX this is a kludge */ #define SAME_SCREENS(a, b) (\ (a.pScreen == b.pScreen)) void SetInputCheck(HWEventQueuePtr c0, HWEventQueuePtr c1) { checkForInput[0] = c0; checkForInput[1] = c1; } void UpdateCurrentTime() { TimeStamp systime; /* To avoid time running backwards, we must call GetTimeInMillis before * calling ProcessInputEvents. */ systime.months = currentTime.months; systime.milliseconds = GetTimeInMillis(); if (systime.milliseconds < currentTime.milliseconds) systime.months++; if (*checkForInput[0] != *checkForInput[1]) ProcessInputEvents(); if (CompareTimeStamps(systime, currentTime) == LATER) currentTime = systime; } /* Like UpdateCurrentTime, but can't call ProcessInputEvents */ void UpdateCurrentTimeIf() { TimeStamp systime; systime.months = currentTime.months; systime.milliseconds = GetTimeInMillis(); if (systime.milliseconds < currentTime.milliseconds) systime.months++; if (*checkForInput[0] == *checkForInput[1]) currentTime = systime; } void #ifdef NXAGENT_SERVER xorg_InitSelections(void) #else InitSelections(void) #endif { if (CurrentSelections) free(CurrentSelections); CurrentSelections = (Selection *)NULL; NumCurrentSelections = 0; } #undef SMART_DEBUG #define SMART_SCHEDULE_DEFAULT_INTERVAL 20 /* ms */ #define SMART_SCHEDULE_MAX_SLICE 200 /* ms */ #ifdef HAVE_SETITIMER #define SMART_SCHEDULE_DEFAULT_SIGNAL_ENABLE HAVE_SETITIMER Bool SmartScheduleSignalEnable = SMART_SCHEDULE_DEFAULT_SIGNAL_ENABLE; #endif long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL; long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL; long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE; long SmartScheduleTime; ClientPtr SmartLastClient; int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1]; int SmartScheduleClient(int *clientReady, int nready); #ifdef SMART_DEBUG long SmartLastPrint; #endif void Dispatch(void); void InitProcVectors(void); int SmartScheduleClient (int *clientReady, int nready) { int i; int client; ClientPtr pClient, best = NULL; int bestRobin, robin; long now = SmartScheduleTime; long idle; bestRobin = 0; idle = 2 * SmartScheduleSlice; for (i = 0; i < nready; i++) { client = clientReady[i]; pClient = clients[client]; /* Praise clients which are idle */ if ((now - pClient->smart_check_tick) >= idle) { if (pClient->smart_priority < 0) pClient->smart_priority++; } pClient->smart_check_tick = now; /* check priority to select best client */ robin = (pClient->index - SmartLastIndex[pClient->smart_priority - SMART_MIN_PRIORITY]) & 0xff; /* pick the best client */ if (!best || pClient->priority > best->priority || (pClient->priority == best->priority && (pClient->smart_priority > best->smart_priority || (pClient->smart_priority == best->smart_priority && robin > bestRobin)))) { best = pClient; bestRobin = robin; } #ifdef SMART_DEBUG if ((now - SmartLastPrint) >= 5000) fprintf (stderr, " %2d: %3d", client, pClient->smart_priority); #endif } #ifdef SMART_DEBUG if ((now - SmartLastPrint) >= 5000) { fprintf (stderr, " use %2d\n", best); SmartLastPrint = now; } #endif SmartLastIndex[best->smart_priority - SMART_MIN_PRIORITY] = best->index; /* * Set current client pointer */ if (SmartLastClient != pClient) { pClient->smart_start_tick = now; SmartLastClient = pClient; } /* * Adjust slice */ if (nready == 1) { /* * If it's been a long time since another client * has run, bump the slice up to get maximal * performance from a single client */ if ((now - pClient->smart_start_tick) > 1000 && SmartScheduleSlice < SmartScheduleMaxSlice) { SmartScheduleSlice += SmartScheduleInterval; } } else { SmartScheduleSlice = SmartScheduleInterval; } return best->index; } #ifndef NXAGENT_SERVER #define MAJOROP ((xReq *)client->requestBuffer)->reqType void Dispatch(void) { register int *clientReady; /* array of request ready clients */ register int result; register ClientPtr client; register int nready; register HWEventQueuePtr* icheck = checkForInput; long start_tick; nextFreeClientID = 1; InitSelections(); nClients = 0; clientReady = (int *) malloc(sizeof(int) * MaxClients); if (!clientReady) return; while (!dispatchException) { if (*icheck[0] != *icheck[1]) { ProcessInputEvents(); FlushIfCriticalOutputPending(); } nready = WaitForSomething(clientReady); if (nready) { clientReady[0] = SmartScheduleClient (clientReady, nready); nready = 1; } /***************** * Handle events in round robin fashion, doing input between * each round *****************/ while (!dispatchException && (--nready >= 0)) { client = clients[clientReady[nready]]; if (! client) { /* KillClient can cause this to happen */ continue; } /* GrabServer activation can cause this to be true */ if (grabState == GrabKickout) { grabState = GrabActive; break; } isItTimeToYield = FALSE; start_tick = SmartScheduleTime; while (!isItTimeToYield) { if (*icheck[0] != *icheck[1]) { ProcessInputEvents(); FlushIfCriticalOutputPending(); } if ((SmartScheduleTime - start_tick) >= SmartScheduleSlice) { /* Penalize clients which consume ticks */ if (client->smart_priority > SMART_MIN_PRIORITY) client->smart_priority--; break; } /* now, finally, deal with client requests */ /* Update currentTime so request time checks, such as for input * device grabs, are calculated correctly */ UpdateCurrentTimeIf(); result = ReadRequestFromClient(client); if (result <= 0) { if (result < 0) CloseDownClient(client); break; } client->sequence++; if (result > (maxBigRequestSize << 2)) result = BadLength; else result = (* client->requestVector[MAJOROP])(client); if (!SmartScheduleSignalEnable) SmartScheduleTime = GetTimeInMillis(); if (result != Success) { if (client->noClientException != Success) CloseDownClient(client); else SendErrorToClient(client, MAJOROP, MinorOpcodeOfRequest(client), client->errorValue, result); break; } #ifdef DAMAGEEXT FlushIfCriticalOutputPending (); #endif } FlushAllOutput(); client = clients[clientReady[nready]]; if (client) client->smart_stop_tick = SmartScheduleTime; } dispatchException &= ~DE_PRIORITYCHANGE; } #if defined(DDXBEFORERESET) ddxBeforeReset (); #endif KillAllClients(); free(clientReady); dispatchException &= ~DE_RESET; } #undef MAJOROP #endif /* NXAGENT_SERVER */ int ProcBadRequest(ClientPtr client) { return (BadRequest); } int ProcCreateWindow(ClientPtr client) { register WindowPtr pParent, pWin; REQUEST(xCreateWindowReq); int result; int len; REQUEST_AT_LEAST_SIZE(xCreateWindowReq); LEGAL_NEW_RESOURCE(stuff->wid, client); if (!(pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, DixWriteAccess))) return BadWindow; len = client->req_len - (sizeof(xCreateWindowReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; if (!stuff->width || !stuff->height) { client->errorValue = 0; return BadValue; } pWin = CreateWindow(stuff->wid, pParent, stuff->x, stuff->y, stuff->width, stuff->height, stuff->borderWidth, stuff->class, stuff->mask, (XID *) &stuff[1], (int)stuff->depth, client, stuff->visual, &result); if (pWin) { Mask mask = pWin->eventMask; pWin->eventMask = 0; /* subterfuge in case AddResource fails */ if (!AddResource(stuff->wid, RT_WINDOW, (void *)pWin)) return BadAlloc; pWin->eventMask = mask; } if (client->noClientException != Success) return(client->noClientException); else return(result); } int ProcChangeWindowAttributes(register ClientPtr client) { register WindowPtr pWin; REQUEST(xChangeWindowAttributesReq); register int result; int len; REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixWriteAccess); if (!pWin) return(BadWindow); len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2); if (len != Ones(stuff->valueMask)) return BadLength; result = ChangeWindowAttributes(pWin, stuff->valueMask, (XID *) &stuff[1], client); if (client->noClientException != Success) return(client->noClientException); else return(result); } int ProcGetWindowAttributes(register ClientPtr client) { register WindowPtr pWin; REQUEST(xResourceReq); xGetWindowAttributesReply wa; REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, DixReadAccess); if (!pWin) return(BadWindow); memset(&wa, 0, sizeof(xGetWindowAttributesReply)); GetWindowAttributes(pWin, client, &wa); WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa); return(client->noClientException); } int ProcDestroyWindow(register ClientPtr client) { register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, DixDestroyAccess); if (!pWin) return(BadWindow); if (pWin->parent) FreeResource(stuff->id, RT_NONE); return(client->noClientException); } int ProcDestroySubwindows(register ClientPtr client) { register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, DixDestroyAccess); if (!pWin) return(BadWindow); DestroySubwindows(pWin, client); return(client->noClientException); } int ProcChangeSaveSet(register ClientPtr client) { register WindowPtr pWin; REQUEST(xChangeSaveSetReq); register int result; REQUEST_SIZE_MATCH(xChangeSaveSetReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixReadAccess); if (!pWin) return(BadWindow); if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) return BadMatch; if ((stuff->mode == SetModeInsert) || (stuff->mode == SetModeDelete)) { result = AlterSaveSetForClient(client, pWin, stuff->mode, FALSE, TRUE); if (client->noClientException != Success) return(client->noClientException); else return(result); } else { client->errorValue = stuff->mode; return( BadValue ); } } #ifndef NXAGENT_SERVER int ProcReparentWindow(register ClientPtr client) { register WindowPtr pWin, pParent; REQUEST(xReparentWindowReq); register int result; REQUEST_SIZE_MATCH(xReparentWindowReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixWriteAccess); if (!pWin) return(BadWindow); pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, DixWriteAccess); if (!pParent) return(BadWindow); if (SAME_SCREENS(pWin->drawable, pParent->drawable)) { if ((pWin->backgroundState == ParentRelative) && (pParent->drawable.depth != pWin->drawable.depth)) return BadMatch; if ((pWin->drawable.class != InputOnly) && (pParent->drawable.class == InputOnly)) return BadMatch; result = ReparentWindow(pWin, pParent, (short)stuff->x, (short)stuff->y, client); if (client->noClientException != Success) return(client->noClientException); else return(result); } else return (BadMatch); } #endif /* NXAGENT_SERVER */ int ProcMapWindow(register ClientPtr client) { register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, DixReadAccess); if (!pWin) return(BadWindow); MapWindow(pWin, client); /* update cache to say it is mapped */ return(client->noClientException); } int ProcMapSubwindows(register ClientPtr client) { register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, DixReadAccess); if (!pWin) return(BadWindow); MapSubwindows(pWin, client); /* update cache to say it is mapped */ return(client->noClientException); } int ProcUnmapWindow(register ClientPtr client) { register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, DixReadAccess); if (!pWin) return(BadWindow); UnmapWindow(pWin, FALSE); /* update cache to say it is mapped */ return(client->noClientException); } int ProcUnmapSubwindows(register ClientPtr client) { register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, DixReadAccess); if (!pWin) return(BadWindow); UnmapSubwindows(pWin); return(client->noClientException); } int ProcConfigureWindow(register ClientPtr client) { register WindowPtr pWin; REQUEST(xConfigureWindowReq); register int result; int len; REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->window, client, DixWriteAccess); if (!pWin) return(BadWindow); len = client->req_len - (sizeof(xConfigureWindowReq) >> 2); if (Ones((Mask)stuff->mask) != len) return BadLength; result = ConfigureWindow(pWin, (Mask)stuff->mask, (XID *) &stuff[1], client); if (client->noClientException != Success) return(client->noClientException); else return(result); } int ProcCirculateWindow(register ClientPtr client) { register WindowPtr pWin; REQUEST(xCirculateWindowReq); REQUEST_SIZE_MATCH(xCirculateWindowReq); if ((stuff->direction != RaiseLowest) && (stuff->direction != LowerHighest)) { client->errorValue = stuff->direction; return BadValue; } pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixWriteAccess); if (!pWin) return(BadWindow); CirculateWindow(pWin, (int)stuff->direction, client); return(client->noClientException); } int GetGeometry(register ClientPtr client, xGetGeometryReply *rep) { register DrawablePtr pDraw; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->id, client, DixReadAccess); memset(rep, 0, sizeof(xGetGeometryReply)); rep->type = X_Reply; rep->length = 0; rep->sequenceNumber = client->sequence; rep->root = pDraw->pScreen->root->drawable.id; rep->depth = pDraw->depth; rep->width = pDraw->width; rep->height = pDraw->height; /* XXX - Because the pixmap-implementation of the multibuffer extension * may have the buffer-id's drawable resource value be a pointer * to the buffer's window instead of the buffer itself * (this happens if the buffer is the displayed buffer), * we also have to check that the id matches before we can * truly say that it is a DRAWABLE_WINDOW. */ if ((pDraw->type == UNDRAWABLE_WINDOW) || ((pDraw->type == DRAWABLE_WINDOW) && (stuff->id == pDraw->id))) { register WindowPtr pWin = (WindowPtr)pDraw; rep->x = pWin->origin.x - wBorderWidth (pWin); rep->y = pWin->origin.y - wBorderWidth (pWin); rep->borderWidth = pWin->borderWidth; } else /* DRAWABLE_PIXMAP or DRAWABLE_BUFFER */ { rep->x = rep->y = rep->borderWidth = 0; } return Success; } int ProcGetGeometry(register ClientPtr client) { xGetGeometryReply rep = {0}; int status; if ((status = GetGeometry(client, &rep)) != Success) return status; WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep); return(client->noClientException); } #ifndef NXAGENT_SERVER int ProcQueryTree(register ClientPtr client) { xQueryTreeReply reply = {0}; int numChildren = 0; register WindowPtr pChild, pWin, pHead; Window *childIDs = (Window *)NULL; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, DixReadAccess); if (!pWin) return(BadWindow); reply.type = X_Reply; reply.root = pWin->drawable.pScreen->root->drawable.id; reply.sequenceNumber = client->sequence; if (pWin->parent) reply.parent = pWin->parent->drawable.id; else reply.parent = (Window)None; pHead = RealChildHead(pWin); for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) numChildren++; if (numChildren) { int curChild = 0; childIDs = (Window *) malloc(numChildren * sizeof(Window)); if (!childIDs) return BadAlloc; for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) childIDs[curChild++] = pChild->drawable.id; } reply.nChildren = numChildren; reply.length = (numChildren * sizeof(Window)) >> 2; WriteReplyToClient(client, sizeof(xQueryTreeReply), &reply); if (numChildren) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs); free(childIDs); } return(client->noClientException); } #endif /* NXAGENT_SERVER */ int ProcInternAtom(register ClientPtr client) { Atom atom; char *tchar; REQUEST(xInternAtomReq); REQUEST_FIXED_SIZE(xInternAtomReq, stuff->nbytes); if ((stuff->onlyIfExists != xTrue) && (stuff->onlyIfExists != xFalse)) { client->errorValue = stuff->onlyIfExists; return(BadValue); } tchar = (char *) &stuff[1]; atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists); if (atom != BAD_RESOURCE) { xInternAtomReply reply = {0}; reply.type = X_Reply; reply.length = 0; reply.sequenceNumber = client->sequence; reply.atom = atom; WriteReplyToClient(client, sizeof(xInternAtomReply), &reply); return(client->noClientException); } else return (BadAlloc); } int ProcGetAtomName(register ClientPtr client) { const char *str; int len; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); if ( (str = NameForAtom(stuff->id)) ) { xGetAtomNameReply reply = {0}; len = strlen(str); reply.type = X_Reply; reply.length = (len + 3) >> 2; reply.sequenceNumber = client->sequence; reply.nameLength = len; WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply); WriteToClient(client, len, str); return(client->noClientException); } else { client->errorValue = stuff->id; return (BadAtom); } } int ProcSetSelectionOwner(register ClientPtr client) { WindowPtr pWin; TimeStamp time; REQUEST(xSetSelectionOwnerReq); REQUEST_SIZE_MATCH(xSetSelectionOwnerReq); UpdateCurrentTime(); time = ClientTimeToServerTime(stuff->time); /* If the client's time stamp is in the future relative to the server's time stamp, do not set the selection, just return success. */ if (CompareTimeStamps(time, currentTime) == LATER) return Success; if (stuff->window != None) { pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixReadAccess); if (!pWin) return(BadWindow); } else pWin = (WindowPtr)None; if (ValidAtom(stuff->selection)) { int i = 0; /* * First, see if the selection is already set... */ while ((i < NumCurrentSelections) && CurrentSelections[i].selection != stuff->selection) i++; if (i < NumCurrentSelections) { /* If the timestamp in client's request is in the past relative to the time stamp indicating the last time the owner of the selection was set, do not set the selection, just return success. */ if (CompareTimeStamps(time, CurrentSelections[i].lastTimeChanged) == EARLIER) return Success; if (CurrentSelections[i].client && (!pWin || (CurrentSelections[i].client != client))) { xEvent event = {0}; event.u.u.type = SelectionClear; event.u.selectionClear.time = time.milliseconds; event.u.selectionClear.window = CurrentSelections[i].window; event.u.selectionClear.atom = CurrentSelections[i].selection; (void) TryClientEvents (CurrentSelections[i].client, &event, 1, NoEventMask, NoEventMask /* CantBeFiltered */, NullGrab); } } else { /* * It doesn't exist, so add it... */ Selection *newsels; if (i == 0) newsels = (Selection *)malloc(sizeof(Selection)); else newsels = (Selection *)realloc(CurrentSelections, (NumCurrentSelections + 1) * sizeof(Selection)); if (!newsels) return BadAlloc; NumCurrentSelections++; CurrentSelections = newsels; CurrentSelections[i].selection = stuff->selection; } CurrentSelections[i].lastTimeChanged = time; CurrentSelections[i].window = stuff->window; CurrentSelections[i].pWin = pWin; CurrentSelections[i].client = (pWin ? client : NullClient); if (SelectionCallback) { SelectionInfoRec info = {0}; info.selection = &CurrentSelections[i]; info.kind= SelectionSetOwner; CallCallbacks(&SelectionCallback, &info); } return (client->noClientException); } else { client->errorValue = stuff->selection; return (BadAtom); } } int ProcGetSelectionOwner(register ClientPtr client) { REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); if (ValidAtom(stuff->id)) { int i; xGetSelectionOwnerReply reply; i = 0; while ((i < NumCurrentSelections) && CurrentSelections[i].selection != stuff->id) i++; memset(&reply, 0, sizeof(xGetSelectionOwnerReply)); reply.type = X_Reply; reply.length = 0; reply.sequenceNumber = client->sequence; if (i < NumCurrentSelections) reply.owner = CurrentSelections[i].window; else reply.owner = None; WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply); return(client->noClientException); } else { client->errorValue = stuff->id; return (BadAtom); } } #ifndef NXAGENT_SERVER int ProcConvertSelection(register ClientPtr client) { Bool paramsOkay; xEvent event; WindowPtr pWin; REQUEST(xConvertSelectionReq); REQUEST_SIZE_MATCH(xConvertSelectionReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->requestor, client, DixReadAccess); if (!pWin) return(BadWindow); paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target)); if (stuff->property != None) paramsOkay &= ValidAtom(stuff->property); if (paramsOkay) { int i; i = 0; while ((i < NumCurrentSelections) && CurrentSelections[i].selection != stuff->selection) i++; if ((i < NumCurrentSelections) && (CurrentSelections[i].window != None) #ifdef XCSECURITY && (!client->CheckAccess || (* client->CheckAccess)(client, CurrentSelections[i].window, RT_WINDOW, DixReadAccess, CurrentSelections[i].pWin)) #endif ) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = SelectionRequest; event.u.selectionRequest.time = stuff->time; event.u.selectionRequest.owner = CurrentSelections[i].window; event.u.selectionRequest.requestor = stuff->requestor; event.u.selectionRequest.selection = stuff->selection; event.u.selectionRequest.target = stuff->target; event.u.selectionRequest.property = stuff->property; if (TryClientEvents( CurrentSelections[i].client, &event, 1, NoEventMask, NoEventMask /* CantBeFiltered */, NullGrab)) return (client->noClientException); } memset(&event, 0, sizeof(xEvent)); event.u.u.type = SelectionNotify; event.u.selectionNotify.time = stuff->time; event.u.selectionNotify.requestor = stuff->requestor; event.u.selectionNotify.selection = stuff->selection; event.u.selectionNotify.target = stuff->target; event.u.selectionNotify.property = None; (void) TryClientEvents(client, &event, 1, NoEventMask, NoEventMask /* CantBeFiltered */, NullGrab); return (client->noClientException); } else { client->errorValue = stuff->property; return (BadAtom); } } #endif /* NXAGENT_SERVER */ int ProcGrabServer(register ClientPtr client) { REQUEST_SIZE_MATCH(xReq); if (grabState != GrabNone && client != grabClient) { ResetCurrentRequest(client); client->sequence--; BITSET(grabWaiters, client->index); IgnoreClient(client); return(client->noClientException); } OnlyListenToOneClient(client); grabState = GrabKickout; grabClient = client; if (ServerGrabCallback) { ServerGrabInfoRec grabinfo = {0}; grabinfo.client = client; grabinfo.grabstate = SERVER_GRABBED; CallCallbacks(&ServerGrabCallback, (void *)&grabinfo); } return(client->noClientException); } static void UngrabServer(ClientPtr client) { int i; grabState = GrabNone; ListenToAllClients(); for (i = mskcnt; --i >= 0 && !grabWaiters[i]; ) ; if (i >= 0) { i <<= 5; while (!GETBIT(grabWaiters, i)) i++; BITCLEAR(grabWaiters, i); AttendClient(clients[i]); } if (ServerGrabCallback) { ServerGrabInfoRec grabinfo = {0}; grabinfo.client = client; grabinfo.grabstate = SERVER_UNGRABBED; CallCallbacks(&ServerGrabCallback, (void *)&grabinfo); } } int ProcUngrabServer(register ClientPtr client) { REQUEST_SIZE_MATCH(xReq); UngrabServer(client); return(client->noClientException); } int ProcTranslateCoords(register ClientPtr client) { REQUEST(xTranslateCoordsReq); register WindowPtr pWin, pDst; xTranslateCoordsReply rep = {0}; REQUEST_SIZE_MATCH(xTranslateCoordsReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, DixReadAccess); if (!pWin) return(BadWindow); pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, DixReadAccess); if (!pDst) return(BadWindow); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; if (!SAME_SCREENS(pWin->drawable, pDst->drawable)) { rep.sameScreen = xFalse; rep.child = None; rep.dstX = rep.dstY = 0; } else { INT16 x, y; rep.sameScreen = xTrue; rep.child = None; /* computing absolute coordinates -- adjust to destination later */ x = pWin->drawable.x + stuff->srcX; y = pWin->drawable.y + stuff->srcY; pWin = pDst->firstChild; while (pWin) { #ifdef SHAPE BoxRec box = {0}; #endif if ((pWin->mapped) && (x >= pWin->drawable.x - wBorderWidth (pWin)) && (x < pWin->drawable.x + (int)pWin->drawable.width + wBorderWidth (pWin)) && (y >= pWin->drawable.y - wBorderWidth (pWin)) && (y < pWin->drawable.y + (int)pWin->drawable.height + wBorderWidth (pWin)) #ifdef SHAPE /* When a window is shaped, a further check * is made to see if the point is inside * borderSize */ && (!wBoundingShape(pWin) || RegionContainsPoint( &pWin->borderSize, x, y, &box)) && (!wInputShape(pWin) || RegionContainsPoint( wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box)) #endif ) { rep.child = pWin->drawable.id; pWin = (WindowPtr) NULL; } else pWin = pWin->nextSib; } /* adjust to destination coordinates */ rep.dstX = x - pDst->drawable.x; rep.dstY = y - pDst->drawable.y; } WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep); return(client->noClientException); } #ifndef NXAGENT_SERVER int ProcOpenFont(register ClientPtr client) { int err; REQUEST(xOpenFontReq); REQUEST_FIXED_SIZE(xOpenFontReq, stuff->nbytes); client->errorValue = stuff->fid; LEGAL_NEW_RESOURCE(stuff->fid, client); err = OpenFont(client, stuff->fid, (Mask) 0, stuff->nbytes, (char *)&stuff[1]); if (err == Success) { return(client->noClientException); } else return err; } int ProcCloseFont(register ClientPtr client) { FontPtr pFont; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, DixDestroyAccess); if ( pFont != (FontPtr)NULL) /* id was valid */ { FreeResource(stuff->id, RT_NONE); return(client->noClientException); } else { client->errorValue = stuff->id; return (BadFont); } } #endif /* NXAGENT_SERVER */ int ProcQueryFont(register ClientPtr client) { xQueryFontReply *reply; FontPtr pFont; register GC *pGC; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); client->errorValue = stuff->id; /* EITHER font or gc */ pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, DixReadAccess); if (!pFont) { /* can't use VERIFY_GC because it might return BadGC */ pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC, DixReadAccess); if (!pGC) { client->errorValue = stuff->id; return(BadFont); /* procotol spec says only error is BadFont */ } pFont = pGC->font; } { xCharInfo *pmax = FONTINKMAX(pFont); xCharInfo *pmin = FONTINKMIN(pFont); int nprotoxcistructs; int rlength; nprotoxcistructs = ( pmax->rightSideBearing == pmin->rightSideBearing && pmax->leftSideBearing == pmin->leftSideBearing && pmax->descent == pmin->descent && pmax->ascent == pmin->ascent && pmax->characterWidth == pmin->characterWidth) ? 0 : N2dChars(pFont); rlength = sizeof(xQueryFontReply) + FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) + nprotoxcistructs * sizeof(xCharInfo); reply = (xQueryFontReply *)calloc(1, rlength); if(!reply) { return(BadAlloc); } reply->type = X_Reply; reply->length = (rlength - sizeof(xGenericReply)) >> 2; reply->sequenceNumber = client->sequence; QueryFont( pFont, reply, nprotoxcistructs); WriteReplyToClient(client, rlength, reply); free(reply); return(client->noClientException); } } int ProcQueryTextExtents(register ClientPtr client) { REQUEST(xQueryTextExtentsReq); xQueryTextExtentsReply reply = {0}; FontPtr pFont; GC *pGC; ExtentInfoRec info; unsigned long length; REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq); pFont = (FontPtr)SecurityLookupIDByType(client, stuff->fid, RT_FONT, DixReadAccess); if (!pFont) { pGC = (GC *)SecurityLookupIDByType(client, stuff->fid, RT_GC, DixReadAccess); if (!pGC) { client->errorValue = stuff->fid; return(BadFont); } pFont = pGC->font; } length = client->req_len - (sizeof(xQueryTextExtentsReq) >> 2); length = length << 1; if (stuff->oddLength) { if (length == 0) return(BadLength); length--; } #ifdef HAS_XFONT2 if (!xfont2_query_text_extents(pFont, length, (unsigned char *)&stuff[1], &info)) #else if (!QueryTextExtents(pFont, length, (unsigned char *)&stuff[1], &info)) #endif /* HAS_XFONT2 */ return(BadAlloc); reply.type = X_Reply; reply.length = 0; reply.sequenceNumber = client->sequence; reply.drawDirection = info.drawDirection; reply.fontAscent = info.fontAscent; reply.fontDescent = info.fontDescent; reply.overallAscent = info.overallAscent; reply.overallDescent = info.overallDescent; reply.overallWidth = info.overallWidth; reply.overallLeft = info.overallLeft; reply.overallRight = info.overallRight; WriteReplyToClient(client, sizeof(xQueryTextExtentsReply), &reply); return(client->noClientException); } #ifndef NXAGENT_SERVER int ProcListFonts(register ClientPtr client) { REQUEST(xListFontsReq); REQUEST_FIXED_SIZE(xListFontsReq, stuff->nbytes); return ListFonts(client, (unsigned char *) &stuff[1], stuff->nbytes, stuff->maxNames); } int ProcListFontsWithInfo(register ClientPtr client) { REQUEST(xListFontsWithInfoReq); REQUEST_FIXED_SIZE(xListFontsWithInfoReq, stuff->nbytes); return StartListFontsWithInfo(client, stuff->nbytes, (unsigned char *) &stuff[1], stuff->maxNames); } #endif /* NXAGENT_SERVER */ /** * * \param value must conform to DeleteType */ int dixDestroyPixmap(void * value, XID pid) { PixmapPtr pPixmap = (PixmapPtr)value; return (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap); } int ProcCreatePixmap(register ClientPtr client) { PixmapPtr pMap; register DrawablePtr pDraw; REQUEST(xCreatePixmapReq); DepthPtr pDepth; register int i; REQUEST_SIZE_MATCH(xCreatePixmapReq); client->errorValue = stuff->pid; LEGAL_NEW_RESOURCE(stuff->pid, client); SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client, DixReadAccess); if (!stuff->width || !stuff->height) { client->errorValue = 0; return BadValue; } if (stuff->width > 32767 || stuff->height > 32767) { /* It is allowed to try and allocate a pixmap which is larger than * 32767 in either dimension. However, all of the framebuffer code * is buggy and does not reliably draw to such big pixmaps, basically * because the Region data structure operates with signed shorts * for the rectangles in it. * * Furthermore, several places in the X server computes the * size in bytes of the pixmap and tries to store it in an * integer. This integer can overflow and cause the allocated size * to be much smaller. * * So, such big pixmaps are rejected here with a BadAlloc */ return BadAlloc; } if (stuff->depth != 1) { pDepth = pDraw->pScreen->allowedDepths; for (i=0; ipScreen->numDepths; i++, pDepth++) if (pDepth->depth == stuff->depth) goto CreatePmap; client->errorValue = stuff->depth; return BadValue; } CreatePmap: pMap = (PixmapPtr)(*pDraw->pScreen->CreatePixmap) (pDraw->pScreen, stuff->width, stuff->height, stuff->depth, 0); if (pMap) { pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = stuff->pid; if (AddResource(stuff->pid, RT_PIXMAP, (void *)pMap)) return(client->noClientException); } return (BadAlloc); } #ifndef NXAGENT_SERVER int ProcFreePixmap(register ClientPtr client) { PixmapPtr pMap; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pMap = (PixmapPtr)SecurityLookupIDByType(client, stuff->id, RT_PIXMAP, DixDestroyAccess); if (pMap) { FreeResource(stuff->id, RT_NONE); return(client->noClientException); } else { client->errorValue = stuff->id; return (BadPixmap); } } #endif /* NXAGENT_SERVER */ int ProcCreateGC(register ClientPtr client) { int error; GC *pGC; register DrawablePtr pDraw; unsigned len; REQUEST(xCreateGCReq); REQUEST_AT_LEAST_SIZE(xCreateGCReq); client->errorValue = stuff->gc; LEGAL_NEW_RESOURCE(stuff->gc, client); SECURITY_VERIFY_DRAWABLE (pDraw, stuff->drawable, client, DixReadAccess); len = client->req_len - (sizeof(xCreateGCReq) >> 2); if (len != Ones(stuff->mask)) return BadLength; pGC = (GC *)CreateGC(pDraw, stuff->mask, (XID *) &stuff[1], &error); if (error != Success) return error; if (!AddResource(stuff->gc, RT_GC, (void *)pGC)) return (BadAlloc); return(client->noClientException); } int ProcChangeGC(register ClientPtr client) { GC *pGC; REQUEST(xChangeGCReq); int result; unsigned len; REQUEST_AT_LEAST_SIZE(xChangeGCReq); SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixWriteAccess); len = client->req_len - (sizeof(xChangeGCReq) >> 2); if (len != Ones(stuff->mask)) return BadLength; result = dixChangeGC(client, pGC, stuff->mask, (CARD32 *) &stuff[1], 0); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; return(result); } } int ProcCopyGC(register ClientPtr client) { register GC *dstGC; register GC *pGC; int result; REQUEST(xCopyGCReq); REQUEST_SIZE_MATCH(xCopyGCReq); SECURITY_VERIFY_GC( pGC, stuff->srcGC, client, DixReadAccess); SECURITY_VERIFY_GC( dstGC, stuff->dstGC, client, DixWriteAccess); if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth)) return (BadMatch); result = CopyGC(pGC, dstGC, stuff->mask); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; return(result); } } int ProcSetDashes(register ClientPtr client) { register GC *pGC; int result; REQUEST(xSetDashesReq); REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes); if (stuff->nDashes == 0) { client->errorValue = 0; return BadValue; } SECURITY_VERIFY_GC(pGC,stuff->gc, client, DixWriteAccess); result = SetDashes(pGC, stuff->dashOffset, stuff->nDashes, (unsigned char *)&stuff[1]); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; return(result); } } int ProcSetClipRectangles(register ClientPtr client) { int nr; int result; register GC *pGC; REQUEST(xSetClipRectanglesReq); REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq); if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) && (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded)) { client->errorValue = stuff->ordering; return BadValue; } SECURITY_VERIFY_GC(pGC,stuff->gc, client, DixWriteAccess); nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq); if (nr & 4) return(BadLength); nr >>= 3; result = SetClipRects(pGC, stuff->xOrigin, stuff->yOrigin, nr, (xRectangle *)&stuff[1], (int)stuff->ordering); if (client->noClientException != Success) return(client->noClientException); else return(result); } int ProcFreeGC(register ClientPtr client) { register GC *pGC; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); SECURITY_VERIFY_GC(pGC, stuff->id, client, DixDestroyAccess); FreeResource(stuff->id, RT_NONE); return(client->noClientException); } int ProcClearToBackground(register ClientPtr client) { REQUEST(xClearAreaReq); register WindowPtr pWin; REQUEST_SIZE_MATCH(xClearAreaReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixWriteAccess); if (!pWin) return(BadWindow); if (pWin->drawable.class == InputOnly) { client->errorValue = stuff->window; return (BadMatch); } if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse)) { client->errorValue = stuff->exposures; return(BadValue); } (*pWin->drawable.pScreen->ClearToBackground)(pWin, stuff->x, stuff->y, stuff->width, stuff->height, (Bool)stuff->exposures); return(client->noClientException); } int ProcCopyArea(register ClientPtr client) { register DrawablePtr pDst; register DrawablePtr pSrc; register GC *pGC; REQUEST(xCopyAreaReq); RegionPtr pRgn; REQUEST_SIZE_MATCH(xCopyAreaReq); VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client); if (stuff->dstDrawable != stuff->srcDrawable) { SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client, DixReadAccess); if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) { client->errorValue = stuff->dstDrawable; return (BadMatch); } } else pSrc = pDst; SET_DBE_SRCBUF(pSrc, stuff->srcDrawable); pRgn = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, stuff->srcX, stuff->srcY, stuff->width, stuff->height, stuff->dstX, stuff->dstY); if (pGC->graphicsExposures) { (*pDst->pScreen->SendGraphicsExpose) (client, pRgn, stuff->dstDrawable, X_CopyArea, 0); if (pRgn) RegionDestroy(pRgn); } return(client->noClientException); } int ProcCopyPlane(register ClientPtr client) { register DrawablePtr psrcDraw, pdstDraw; register GC *pGC; REQUEST(xCopyPlaneReq); RegionPtr pRgn; REQUEST_SIZE_MATCH(xCopyPlaneReq); VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client); if (stuff->dstDrawable != stuff->srcDrawable) { SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client, DixReadAccess); if (pdstDraw->pScreen != psrcDraw->pScreen) { client->errorValue = stuff->dstDrawable; return (BadMatch); } } else psrcDraw = pdstDraw; SET_DBE_SRCBUF(psrcDraw, stuff->srcDrawable); /* Check to see if stuff->bitPlane has exactly ONE good bit set */ if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) || (stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) { client->errorValue = stuff->bitPlane; return(BadValue); } pRgn = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC, stuff->srcX, stuff->srcY, stuff->width, stuff->height, stuff->dstX, stuff->dstY, stuff->bitPlane); if (pGC->graphicsExposures) { (*pdstDraw->pScreen->SendGraphicsExpose) (client, pRgn, stuff->dstDrawable, X_CopyPlane, 0); if (pRgn) RegionDestroy(pRgn); } return(client->noClientException); } int ProcPolyPoint(register ClientPtr client) { int npoint; register GC *pGC; register DrawablePtr pDraw; REQUEST(xPolyPointReq); REQUEST_AT_LEAST_SIZE(xPolyPointReq); if ((stuff->coordMode != CoordModeOrigin) && (stuff->coordMode != CoordModePrevious)) { client->errorValue = stuff->coordMode; return BadValue; } VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2; if (npoint) (*pGC->ops->PolyPoint)(pDraw, pGC, stuff->coordMode, npoint, (xPoint *) &stuff[1]); return (client->noClientException); } int ProcPolyLine(register ClientPtr client) { int npoint; register GC *pGC; register DrawablePtr pDraw; REQUEST(xPolyLineReq); REQUEST_AT_LEAST_SIZE(xPolyLineReq); if ((stuff->coordMode != CoordModeOrigin) && (stuff->coordMode != CoordModePrevious)) { client->errorValue = stuff->coordMode; return BadValue; } VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2; if (npoint > 1) (*pGC->ops->Polylines)(pDraw, pGC, stuff->coordMode, npoint, (DDXPointPtr) &stuff[1]); return(client->noClientException); } int ProcPolySegment(register ClientPtr client) { int nsegs; register GC *pGC; register DrawablePtr pDraw; REQUEST(xPolySegmentReq); REQUEST_AT_LEAST_SIZE(xPolySegmentReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq); if (nsegs & 4) return(BadLength); nsegs >>= 3; if (nsegs) (*pGC->ops->PolySegment)(pDraw, pGC, nsegs, (xSegment *) &stuff[1]); return (client->noClientException); } int ProcPolyRectangle (register ClientPtr client) { int nrects; register GC *pGC; register DrawablePtr pDraw; REQUEST(xPolyRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyRectangleReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq); if (nrects & 4) return(BadLength); nrects >>= 3; if (nrects) (*pGC->ops->PolyRectangle)(pDraw, pGC, nrects, (xRectangle *) &stuff[1]); return(client->noClientException); } int ProcPolyArc(register ClientPtr client) { int narcs; register GC *pGC; register DrawablePtr pDraw; REQUEST(xPolyArcReq); REQUEST_AT_LEAST_SIZE(xPolyArcReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); narcs = (client->req_len << 2) - sizeof(xPolyArcReq); if (narcs % sizeof(xArc)) return(BadLength); narcs /= sizeof(xArc); if (narcs) (*pGC->ops->PolyArc)(pDraw, pGC, narcs, (xArc *) &stuff[1]); return (client->noClientException); } int ProcFillPoly(register ClientPtr client) { int things; register GC *pGC; register DrawablePtr pDraw; REQUEST(xFillPolyReq); REQUEST_AT_LEAST_SIZE(xFillPolyReq); if ((stuff->shape != Complex) && (stuff->shape != Nonconvex) && (stuff->shape != Convex)) { client->errorValue = stuff->shape; return BadValue; } if ((stuff->coordMode != CoordModeOrigin) && (stuff->coordMode != CoordModePrevious)) { client->errorValue = stuff->coordMode; return BadValue; } VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); things = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2; if (things) (*pGC->ops->FillPolygon) (pDraw, pGC, stuff->shape, stuff->coordMode, things, (DDXPointPtr) &stuff[1]); return(client->noClientException); } int ProcPolyFillRectangle(register ClientPtr client) { int things; register GC *pGC; register DrawablePtr pDraw; REQUEST(xPolyFillRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq); if (things & 4) return(BadLength); things >>= 3; if (things) (*pGC->ops->PolyFillRect) (pDraw, pGC, things, (xRectangle *) &stuff[1]); return (client->noClientException); } int ProcPolyFillArc(register ClientPtr client) { int narcs; register GC *pGC; register DrawablePtr pDraw; REQUEST(xPolyFillArcReq); REQUEST_AT_LEAST_SIZE(xPolyFillArcReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq); if (narcs % sizeof(xArc)) return(BadLength); narcs /= sizeof(xArc); if (narcs) (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]); return (client->noClientException); } #ifdef MATCH_CLIENT_ENDIAN int ServerOrder (void) { int whichbyte = 1; if (*((char *) &whichbyte)) return LSBFirst; return MSBFirst; } #define ClientOrder(client) ((client)->swapped ? !ServerOrder() : ServerOrder()) void ReformatImage (char *base, int nbytes, int bpp, int order) { switch (bpp) { case 1: /* yuck */ if (BITMAP_BIT_ORDER != order) BitOrderInvert ((unsigned char *) base, nbytes); #if IMAGE_BYTE_ORDER != BITMAP_BIT_ORDER && BITMAP_SCANLINE_UNIT != 8 ReformatImage (base, nbytes, BITMAP_SCANLINE_UNIT, order); #endif break; case 4: break; /* yuck */ case 8: break; case 16: if (IMAGE_BYTE_ORDER != order) TwoByteSwap ((unsigned char *) base, nbytes); break; case 32: if (IMAGE_BYTE_ORDER != order) FourByteSwap ((unsigned char *) base, nbytes); break; } } #else #define ReformatImage(b,n,bpp,o) #endif /* 64-bit server notes: the protocol restricts padding of images to * 8-, 16-, or 32-bits. We would like to have 64-bits for the server * to use internally. Removes need for internal alignment checking. * All of the PutImage functions could be changed individually, but * as currently written, they call other routines which require things * to be 64-bit padded on scanlines, so we changed things here. * If an image would be padded differently for 64- versus 32-, then * copy each scanline to a 64-bit padded scanline. * Also, we need to make sure that the image is aligned on a 64-bit * boundary, even if the scanlines are padded to our satisfaction. */ int ProcPutImage(register ClientPtr client) { register GC *pGC; register DrawablePtr pDraw; long length; /* length of scanline server padded */ long lengthProto; /* length of scanline protocol padded */ char *tmpImage; REQUEST(xPutImageReq); REQUEST_AT_LEAST_SIZE(xPutImageReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); if (stuff->format == XYBitmap) { if ((stuff->depth != 1) || (stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad)) return BadMatch; length = BitmapBytePad(stuff->width + stuff->leftPad); } else if (stuff->format == XYPixmap) { if ((pDraw->depth != stuff->depth) || (stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad)) return BadMatch; length = BitmapBytePad(stuff->width + stuff->leftPad); length *= stuff->depth; } else if (stuff->format == ZPixmap) { if ((pDraw->depth != stuff->depth) || (stuff->leftPad != 0)) return BadMatch; length = PixmapBytePad(stuff->width, stuff->depth); } else { client->errorValue = stuff->format; return BadValue; } tmpImage = (char *)&stuff[1]; lengthProto = length; if (stuff->height != 0 && lengthProto >= (INT32_MAX / stuff->height)) return BadLength; if (((((lengthProto * stuff->height) + (unsigned)3) >> 2) + (sizeof(xPutImageReq) >> 2)) != client->req_len) return BadLength; ReformatImage (tmpImage, lengthProto * stuff->height, stuff->format == ZPixmap ? BitsPerPixel (stuff->depth) : 1, ClientOrder(client)); (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY, stuff->width, stuff->height, stuff->leftPad, stuff->format, tmpImage); return (client->noClientException); } int DoGetImage(register ClientPtr client, int format, Drawable drawable, int x, int y, int width, int height, Mask planemask, xGetImageReply **im_return) { register DrawablePtr pDraw; int nlines, linesPerBuf; register int linesDone; long widthBytesLine, length; Mask plane = 0; char *pBuf; xGetImageReply xgi = {0}; #ifdef XCSECURITY RegionPtr pVisibleRegion = NULL; #endif if ((format != XYPixmap) && (format != ZPixmap)) { client->errorValue = format; return(BadValue); } SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, DixReadAccess); if(pDraw->type == DRAWABLE_WINDOW) { if( /* check for being viewable */ !((WindowPtr) pDraw)->realized || /* check for being on screen */ pDraw->x + x < 0 || pDraw->x + x + width > pDraw->pScreen->width || pDraw->y + y < 0 || pDraw->y + y + height > pDraw->pScreen->height || /* check for being inside of border */ x < - wBorderWidth((WindowPtr)pDraw) || x + width > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width || y < -wBorderWidth((WindowPtr)pDraw) || y + height > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height ) return(BadMatch); xgi.visual = wVisual (((WindowPtr) pDraw)); } else { if(x < 0 || x+width > (int)pDraw->width || y < 0 || y+height > (int)pDraw->height ) return(BadMatch); xgi.visual = None; } SET_DBE_SRCBUF(pDraw, drawable); xgi.type = X_Reply; xgi.sequenceNumber = client->sequence; xgi.depth = pDraw->depth; if(format == ZPixmap) { widthBytesLine = PixmapBytePad(width, pDraw->depth); length = widthBytesLine * height; } else { widthBytesLine = BitmapBytePad(width); plane = ((Mask)1) << (pDraw->depth - 1); /* only planes asked for */ length = widthBytesLine * height * Ones(planemask & (plane | (plane - 1))); } xgi.length = length; if (im_return) { pBuf = (char *)calloc(1, sz_xGetImageReply + length); if (!pBuf) return (BadAlloc); if (widthBytesLine == 0) linesPerBuf = 0; else linesPerBuf = height; *im_return = (xGetImageReply *)pBuf; *(xGetImageReply *)pBuf = xgi; pBuf += sz_xGetImageReply; } else { xgi.length = (xgi.length + 3) >> 2; if (widthBytesLine == 0 || height == 0) linesPerBuf = 0; else if (widthBytesLine >= IMAGE_BUFSIZE) linesPerBuf = 1; else { linesPerBuf = IMAGE_BUFSIZE / widthBytesLine; if (linesPerBuf > height) linesPerBuf = height; } length = linesPerBuf * widthBytesLine; if (linesPerBuf < height) { /* we have to make sure intermediate buffers don't need padding */ while ((linesPerBuf > 1) && (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD)-1))) { linesPerBuf--; length -= widthBytesLine; } while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD)-1)) { linesPerBuf++; length += widthBytesLine; } } if(!(pBuf = (char *) malloc(length))) return (BadAlloc); memset(pBuf, 0, length); WriteReplyToClient(client, sizeof (xGetImageReply), &xgi); } #ifdef XCSECURITY if (client->trustLevel != XSecurityClientTrusted && pDraw->type == DRAWABLE_WINDOW) { pVisibleRegion = NotClippedByChildren((WindowPtr)pDraw); if (pVisibleRegion) { RegionTranslate(pVisibleRegion, -pDraw->x, -pDraw->y); } } #endif if (linesPerBuf == 0) { /* nothing to do */ } else if (format == ZPixmap) { linesDone = 0; while (height - linesDone > 0) { nlines = min(linesPerBuf, height - linesDone); (*pDraw->pScreen->GetImage) (pDraw, x, y + linesDone, width, nlines, format, planemask, (void *) pBuf); #ifdef XCSECURITY if (pVisibleRegion) SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y + linesDone, width, nlines, format, pBuf); #endif /* Note that this is NOT a call to WriteSwappedDataToClient, as we do NOT byte swap */ if (!im_return) { ReformatImage (pBuf, (int)(nlines * widthBytesLine), BitsPerPixel (pDraw->depth), ClientOrder(client)); /* Don't split me, gcc pukes when you do */ WriteToClient(client, (int)(nlines * widthBytesLine), pBuf); } linesDone += nlines; } } else /* XYPixmap */ { for (; plane; plane >>= 1) { if (planemask & plane) { linesDone = 0; while (height - linesDone > 0) { nlines = min(linesPerBuf, height - linesDone); (*pDraw->pScreen->GetImage) (pDraw, x, y + linesDone, width, nlines, format, plane, (void *)pBuf); #ifdef XCSECURITY if (pVisibleRegion) SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y + linesDone, width, nlines, format, pBuf); #endif /* Note: NOT a call to WriteSwappedDataToClient, as we do NOT byte swap */ if (im_return) { pBuf += nlines * widthBytesLine; } else { ReformatImage (pBuf, (int)(nlines * widthBytesLine), 1, ClientOrder (client)); /* Don't split me, gcc pukes when you do */ WriteToClient(client, (int)(nlines * widthBytesLine), pBuf); } linesDone += nlines; } } } } #ifdef XCSECURITY if (pVisibleRegion) RegionDestroy(pVisibleRegion); #endif if (!im_return) free(pBuf); return (client->noClientException); } int ProcGetImage(register ClientPtr client) { REQUEST(xGetImageReq); REQUEST_SIZE_MATCH(xGetImageReq); return DoGetImage(client, stuff->format, stuff->drawable, stuff->x, stuff->y, (int)stuff->width, (int)stuff->height, stuff->planeMask, (xGetImageReply **)NULL); } int ProcPolyText(register ClientPtr client) { int err; REQUEST(xPolyTextReq); DrawablePtr pDraw; GC *pGC; REQUEST_AT_LEAST_SIZE(xPolyTextReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); err = PolyText(client, pDraw, pGC, (unsigned char *)&stuff[1], ((unsigned char *) stuff) + (client->req_len << 2), stuff->x, stuff->y, stuff->reqType, stuff->drawable); if (err == Success) { return(client->noClientException); } else return err; } int ProcImageText8(register ClientPtr client) { int err; register DrawablePtr pDraw; register GC *pGC; REQUEST(xImageTextReq); REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); err = ImageText(client, pDraw, pGC, stuff->nChars, (unsigned char *)&stuff[1], stuff->x, stuff->y, stuff->reqType, stuff->drawable); if (err == Success) { return(client->noClientException); } else return err; } int ProcImageText16(register ClientPtr client) { int err; register DrawablePtr pDraw; register GC *pGC; REQUEST(xImageTextReq); REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); err = ImageText(client, pDraw, pGC, stuff->nChars, (unsigned char *)&stuff[1], stuff->x, stuff->y, stuff->reqType, stuff->drawable); if (err == Success) { return(client->noClientException); } else return err; } int ProcCreateColormap(register ClientPtr client) { VisualPtr pVisual; ColormapPtr pmap; Colormap mid; register WindowPtr pWin; ScreenPtr pScreen; REQUEST(xCreateColormapReq); int i, result; REQUEST_SIZE_MATCH(xCreateColormapReq); if ((stuff->alloc != AllocNone) && (stuff->alloc != AllocAll)) { client->errorValue = stuff->alloc; return(BadValue); } mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixReadAccess); if (!pWin) return(BadWindow); pScreen = pWin->drawable.pScreen; for (i = 0, pVisual = pScreen->visuals; i < pScreen->numVisuals; i++, pVisual++) { if (pVisual->vid != stuff->visual) continue; result = CreateColormap(mid, pScreen, pVisual, &pmap, (int)stuff->alloc, client->index); if (client->noClientException != Success) return(client->noClientException); else return(result); } client->errorValue = stuff->visual; return(BadMatch); } int ProcFreeColormap(register ClientPtr client) { ColormapPtr pmap; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pmap = (ColormapPtr )SecurityLookupIDByType(client, stuff->id, RT_COLORMAP, DixDestroyAccess); if (pmap) { /* Freeing a default colormap is a no-op */ if (!(pmap->flags & IsDefault)) FreeResource(stuff->id, RT_NONE); return (client->noClientException); } else { client->errorValue = stuff->id; return (BadColor); } } int ProcCopyColormapAndFree(register ClientPtr client) { Colormap mid; ColormapPtr pSrcMap; REQUEST(xCopyColormapAndFreeReq); int result; REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq); mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); if( (pSrcMap = (ColormapPtr )SecurityLookupIDByType(client, stuff->srcCmap, RT_COLORMAP, DixReadAccess|DixWriteAccess)) ) { result = CopyColormapAndFree(mid, pSrcMap, client->index); if (client->noClientException != Success) return(client->noClientException); else return(result); } else { client->errorValue = stuff->srcCmap; return(BadColor); } } int ProcInstallColormap(register ClientPtr client) { ColormapPtr pcmp; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id, RT_COLORMAP, DixReadAccess); if (pcmp) { (*(pcmp->pScreen->InstallColormap)) (pcmp); return (client->noClientException); } else { client->errorValue = stuff->id; return (BadColor); } } int ProcUninstallColormap(register ClientPtr client) { ColormapPtr pcmp; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id, RT_COLORMAP, DixReadAccess); if (pcmp) { if(pcmp->mid != pcmp->pScreen->defColormap) (*(pcmp->pScreen->UninstallColormap)) (pcmp); return (client->noClientException); } else { client->errorValue = stuff->id; return (BadColor); } } int ProcListInstalledColormaps(register ClientPtr client) { xListInstalledColormapsReply *preply; int nummaps; WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, DixReadAccess); if (!pWin) return(BadWindow); preply = (xListInstalledColormapsReply *) malloc(sizeof(xListInstalledColormapsReply) + pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap)); if(!preply) return(BadAlloc); preply->type = X_Reply; preply->sequenceNumber = client->sequence; nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps) (pWin->drawable.pScreen, (Colormap *)&preply[1]); preply->nColormaps = nummaps; preply->length = nummaps; WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]); free(preply); return(client->noClientException); } int ProcAllocColor (register ClientPtr client) { ColormapPtr pmap; int retval; xAllocColorReply acr = {0}; REQUEST(xAllocColorReq); REQUEST_SIZE_MATCH(xAllocColorReq); pmap = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, DixWriteAccess); if (pmap) { acr.type = X_Reply; acr.length = 0; acr.sequenceNumber = client->sequence; acr.red = stuff->red; acr.green = stuff->green; acr.blue = stuff->blue; acr.pixel = 0; if( (retval = AllocColor(pmap, &acr.red, &acr.green, &acr.blue, &acr.pixel, client->index)) ) { if (client->noClientException != Success) return(client->noClientException); else return (retval); } #ifdef PANORAMIX if (noPanoramiXExtension || !pmap->pScreen->myNum) #endif WriteReplyToClient(client, sizeof(xAllocColorReply), &acr); return (client->noClientException); } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcAllocNamedColor (register ClientPtr client) { ColormapPtr pcmp; REQUEST(xAllocNamedColorReq); REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, DixWriteAccess); if (pcmp) { int retval; xAllocNamedColorReply ancr = {0}; ancr.type = X_Reply; ancr.length = 0; ancr.sequenceNumber = client->sequence; if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1], stuff->nbytes, &ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue)) { ancr.screenRed = ancr.exactRed; ancr.screenGreen = ancr.exactGreen; ancr.screenBlue = ancr.exactBlue; ancr.pixel = 0; if( (retval = AllocColor(pcmp, &ancr.screenRed, &ancr.screenGreen, &ancr.screenBlue, &ancr.pixel, client->index)) ) { if (client->noClientException != Success) return(client->noClientException); else return(retval); } #ifdef PANORAMIX if (noPanoramiXExtension || !pcmp->pScreen->myNum) #endif WriteReplyToClient(client, sizeof (xAllocNamedColorReply), &ancr); return (client->noClientException); } else return(BadName); } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcAllocColorCells (register ClientPtr client) { ColormapPtr pcmp; REQUEST(xAllocColorCellsReq); REQUEST_SIZE_MATCH(xAllocColorCellsReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, DixWriteAccess); if (pcmp) { xAllocColorCellsReply accr = {0}; int npixels, nmasks, retval; long length; Pixel *ppixels, *pmasks; npixels = stuff->colors; if (!npixels) { client->errorValue = npixels; return (BadValue); } if (stuff->contiguous != xTrue && stuff->contiguous != xFalse) { client->errorValue = stuff->contiguous; return (BadValue); } nmasks = stuff->planes; length = ((long)npixels + (long)nmasks) * sizeof(Pixel); ppixels = (Pixel *)malloc(length); if(!ppixels) return(BadAlloc); pmasks = ppixels + npixels; if( (retval = AllocColorCells(client->index, pcmp, npixels, nmasks, (Bool)stuff->contiguous, ppixels, pmasks)) ) { free(ppixels); if (client->noClientException != Success) return(client->noClientException); else return(retval); } #ifdef PANORAMIX if (noPanoramiXExtension || !pcmp->pScreen->myNum) #endif { accr.type = X_Reply; accr.length = length >> 2; accr.sequenceNumber = client->sequence; accr.nPixels = npixels; accr.nMasks = nmasks; WriteReplyToClient(client, sizeof (xAllocColorCellsReply), &accr); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, length, ppixels); } free(ppixels); return (client->noClientException); } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcAllocColorPlanes(register ClientPtr client) { ColormapPtr pcmp; REQUEST(xAllocColorPlanesReq); REQUEST_SIZE_MATCH(xAllocColorPlanesReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, DixWriteAccess); if (pcmp) { xAllocColorPlanesReply acpr = {0}; int npixels, retval; long length; Pixel *ppixels; npixels = stuff->colors; if (!npixels) { client->errorValue = npixels; return (BadValue); } if (stuff->contiguous != xTrue && stuff->contiguous != xFalse) { client->errorValue = stuff->contiguous; return (BadValue); } acpr.type = X_Reply; acpr.sequenceNumber = client->sequence; acpr.nPixels = npixels; length = (long)npixels * sizeof(Pixel); ppixels = (Pixel *)malloc(length); if(!ppixels) return(BadAlloc); if( (retval = AllocColorPlanes(client->index, pcmp, npixels, (int)stuff->red, (int)stuff->green, (int)stuff->blue, (Bool)stuff->contiguous, ppixels, &acpr.redMask, &acpr.greenMask, &acpr.blueMask)) ) { free(ppixels); if (client->noClientException != Success) return(client->noClientException); else return(retval); } acpr.length = length >> 2; #ifdef PANORAMIX if (noPanoramiXExtension || !pcmp->pScreen->myNum) #endif { WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, length, ppixels); } free(ppixels); return (client->noClientException); } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcFreeColors(register ClientPtr client) { ColormapPtr pcmp; REQUEST(xFreeColorsReq); REQUEST_AT_LEAST_SIZE(xFreeColorsReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, DixWriteAccess); if (pcmp) { int count; int retval; if(pcmp->flags & AllAllocated) return(BadAccess); count = ((client->req_len << 2)- sizeof(xFreeColorsReq)) >> 2; retval = FreeColors(pcmp, client->index, count, (Pixel *)&stuff[1], (Pixel)stuff->planeMask); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; return(retval); } } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcStoreColors (ClientPtr client) { ColormapPtr pcmp; REQUEST(xStoreColorsReq); REQUEST_AT_LEAST_SIZE(xStoreColorsReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, DixWriteAccess); if (pcmp) { int count; int retval; count = (client->req_len << 2) - sizeof(xStoreColorsReq); if (count % sizeof(xColorItem)) return(BadLength); count /= sizeof(xColorItem); retval = StoreColors(pcmp, count, (xColorItem *)&stuff[1]); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; return(retval); } } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcStoreNamedColor (register ClientPtr client) { ColormapPtr pcmp; REQUEST(xStoreNamedColorReq); REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, DixWriteAccess); if (pcmp) { xColorItem def = {0}; int retval; if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1], stuff->nbytes, &def.red, &def.green, &def.blue)) { def.flags = stuff->flags; def.pixel = stuff->pixel; retval = StoreColors(pcmp, 1, &def); if (client->noClientException != Success) return(client->noClientException); else return(retval); } return (BadName); } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcQueryColors(register ClientPtr client) { ColormapPtr pcmp; REQUEST(xQueryColorsReq); REQUEST_AT_LEAST_SIZE(xQueryColorsReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, DixReadAccess); if (pcmp) { int count, retval; xrgb *prgbs; xQueryColorsReply qcr = {0}; count = ((client->req_len << 2) - sizeof(xQueryColorsReq)) >> 2; prgbs = (xrgb *)malloc(count * sizeof(xrgb)); if(!prgbs && count) return(BadAlloc); memset(prgbs, 0, count * sizeof(xrgb)); if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) ) { if (prgbs) free(prgbs); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; return (retval); } } memset(&qcr, 0, sizeof(xQueryColorsReply)); qcr.type = X_Reply; qcr.length = (count * sizeof(xrgb)) >> 2; qcr.sequenceNumber = client->sequence; qcr.nColors = count; WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr); if (count) { client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend; WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs); } if (prgbs) free(prgbs); return(client->noClientException); } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcLookupColor(register ClientPtr client) { ColormapPtr pcmp; REQUEST(xLookupColorReq); REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, DixReadAccess); if (pcmp) { xLookupColorReply lcr = {0}; if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1], stuff->nbytes, &lcr.exactRed, &lcr.exactGreen, &lcr.exactBlue)) { lcr.type = X_Reply; lcr.length = 0; lcr.sequenceNumber = client->sequence; lcr.screenRed = lcr.exactRed; lcr.screenGreen = lcr.exactGreen; lcr.screenBlue = lcr.exactBlue; (*pcmp->pScreen->ResolveColor)(&lcr.screenRed, &lcr.screenGreen, &lcr.screenBlue, pcmp->pVisual); WriteReplyToClient(client, sizeof(xLookupColorReply), &lcr); return(client->noClientException); } return (BadName); } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcCreateCursor (register ClientPtr client) { CursorPtr pCursor; register PixmapPtr src; register PixmapPtr msk; unsigned char * srcbits; unsigned char * mskbits; unsigned short width, height; long n; CursorMetricRec cm = {0}; REQUEST(xCreateCursorReq); REQUEST_SIZE_MATCH(xCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); src = (PixmapPtr)SecurityLookupIDByType(client, stuff->source, RT_PIXMAP, DixReadAccess); msk = (PixmapPtr)SecurityLookupIDByType(client, stuff->mask, RT_PIXMAP, DixReadAccess); if ( src == (PixmapPtr)NULL) { client->errorValue = stuff->source; return (BadPixmap); } if ( msk == (PixmapPtr)NULL) { if (stuff->mask != None) { client->errorValue = stuff->mask; return (BadPixmap); } } else if ( src->drawable.width != msk->drawable.width || src->drawable.height != msk->drawable.height || src->drawable.depth != 1 || msk->drawable.depth != 1) return (BadMatch); width = src->drawable.width; height = src->drawable.height; if ( stuff->x > width || stuff->y > height ) return (BadMatch); n = BitmapBytePad(width)*height; srcbits = (unsigned char *)malloc(n); if (!srcbits) return (BadAlloc); mskbits = (unsigned char *)malloc(n); if (!mskbits) { free(srcbits); return (BadAlloc); } /* zeroing the (pad) bits helps some ddx cursor handling */ bzero((char *)srcbits, n); (* src->drawable.pScreen->GetImage)( (DrawablePtr)src, 0, 0, width, height, XYPixmap, 1, (void *)srcbits); if ( msk == (PixmapPtr)NULL) { register unsigned char *bits = mskbits; while (--n >= 0) *bits++ = ~0; } else { /* zeroing the (pad) bits helps some ddx cursor handling */ bzero((char *)mskbits, n); (* msk->drawable.pScreen->GetImage)( (DrawablePtr)msk, 0, 0, width, height, XYPixmap, 1, (void *)mskbits); } cm.width = width; cm.height = height; cm.xhot = stuff->x; cm.yhot = stuff->y; pCursor = AllocCursor( srcbits, mskbits, &cm, stuff->foreRed, stuff->foreGreen, stuff->foreBlue, stuff->backRed, stuff->backGreen, stuff->backBlue); if (pCursor && AddResource(stuff->cid, RT_CURSOR, (void *)pCursor)) return (client->noClientException); return BadAlloc; } int ProcCreateGlyphCursor (register ClientPtr client) { CursorPtr pCursor; int res; REQUEST(xCreateGlyphCursorReq); REQUEST_SIZE_MATCH(xCreateGlyphCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); res = AllocGlyphCursor(stuff->source, stuff->sourceChar, stuff->mask, stuff->maskChar, stuff->foreRed, stuff->foreGreen, stuff->foreBlue, stuff->backRed, stuff->backGreen, stuff->backBlue, &pCursor, client); if (res != Success) return res; if (AddResource(stuff->cid, RT_CURSOR, (void *)pCursor)) return client->noClientException; return BadAlloc; } int ProcFreeCursor (register ClientPtr client) { CursorPtr pCursor; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->id, RT_CURSOR, DixDestroyAccess); if (pCursor) { FreeResource(stuff->id, RT_NONE); return (client->noClientException); } else { client->errorValue = stuff->id; return (BadCursor); } } int ProcQueryBestSize (register ClientPtr client) { xQueryBestSizeReply reply = {0}; register DrawablePtr pDraw; ScreenPtr pScreen; REQUEST(xQueryBestSizeReq); REQUEST_SIZE_MATCH(xQueryBestSizeReq); if ((stuff->class != CursorShape) && (stuff->class != TileShape) && (stuff->class != StippleShape)) { client->errorValue = stuff->class; return(BadValue); } SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client, DixReadAccess); if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW) return (BadMatch); pScreen = pDraw->pScreen; (* pScreen->QueryBestSize)(stuff->class, &stuff->width, &stuff->height, pScreen); memset(&reply, 0, sizeof(xQueryBestSizeReply)); reply.type = X_Reply; reply.length = 0; reply.sequenceNumber = client->sequence; reply.width = stuff->width; reply.height = stuff->height; WriteReplyToClient(client, sizeof(xQueryBestSizeReply), &reply); return (client->noClientException); } #ifndef NXAGENT_SERVER int ProcSetScreenSaver (register ClientPtr client) { int blankingOption, exposureOption; REQUEST(xSetScreenSaverReq); REQUEST_SIZE_MATCH(xSetScreenSaverReq); blankingOption = stuff->preferBlank; if ((blankingOption != DontPreferBlanking) && (blankingOption != PreferBlanking) && (blankingOption != DefaultBlanking)) { client->errorValue = blankingOption; return BadValue; } exposureOption = stuff->allowExpose; if ((exposureOption != DontAllowExposures) && (exposureOption != AllowExposures) && (exposureOption != DefaultExposures)) { client->errorValue = exposureOption; return BadValue; } if (stuff->timeout < -1) { client->errorValue = stuff->timeout; return BadValue; } if (stuff->interval < -1) { client->errorValue = stuff->interval; return BadValue; } if (blankingOption == DefaultBlanking) ScreenSaverBlanking = defaultScreenSaverBlanking; else ScreenSaverBlanking = blankingOption; if (exposureOption == DefaultExposures) ScreenSaverAllowExposures = defaultScreenSaverAllowExposures; else ScreenSaverAllowExposures = exposureOption; if (stuff->timeout >= 0) ScreenSaverTime = stuff->timeout * MILLI_PER_SECOND; else ScreenSaverTime = defaultScreenSaverTime; if (stuff->interval >= 0) ScreenSaverInterval = stuff->interval * MILLI_PER_SECOND; else ScreenSaverInterval = defaultScreenSaverInterval; SetScreenSaverTimer(); return (client->noClientException); } #endif /* NXAGENT_SERVER */ int ProcGetScreenSaver(register ClientPtr client) { xGetScreenSaverReply rep = {0}; REQUEST_SIZE_MATCH(xReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.timeout = ScreenSaverTime / MILLI_PER_SECOND; rep.interval = ScreenSaverInterval / MILLI_PER_SECOND; rep.preferBlanking = ScreenSaverBlanking; rep.allowExposures = ScreenSaverAllowExposures; WriteReplyToClient(client, sizeof(xGetScreenSaverReply), &rep); return (client->noClientException); } int ProcChangeHosts(register ClientPtr client) { REQUEST(xChangeHostsReq); int result; REQUEST_FIXED_SIZE(xChangeHostsReq, stuff->hostLength); if(stuff->mode == HostInsert) result = AddHost(client, (int)stuff->hostFamily, stuff->hostLength, (void *)&stuff[1]); else if (stuff->mode == HostDelete) result = RemoveHost(client, (int)stuff->hostFamily, stuff->hostLength, (void *)&stuff[1]); else { client->errorValue = stuff->mode; return BadValue; } if (!result) result = client->noClientException; return (result); } int ProcListHosts(register ClientPtr client) { xListHostsReply reply = {0}; int len, nHosts, result; void * pdata; /* REQUEST(xListHostsReq); */ REQUEST_SIZE_MATCH(xListHostsReq); #ifdef XCSECURITY /* untrusted clients can't list hosts */ if (client->trustLevel != XSecurityClientTrusted) { SecurityAudit("client %d attempted to list hosts\n", client->index); return BadAccess; } #endif result = GetHosts(&pdata, &nHosts, &len, &reply.enabled); if (result != Success) return(result); reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.nHosts = nHosts; reply.length = len >> 2; WriteReplyToClient(client, sizeof(xListHostsReply), &reply); if (nHosts) { client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend; WriteSwappedDataToClient(client, len, pdata); } free(pdata); return (client->noClientException); } int ProcChangeAccessControl(register ClientPtr client) { int result; REQUEST(xSetAccessControlReq); REQUEST_SIZE_MATCH(xSetAccessControlReq); if ((stuff->mode != EnableAccess) && (stuff->mode != DisableAccess)) { client->errorValue = stuff->mode; return BadValue; } result = ChangeAccessControl(client, stuff->mode == EnableAccess); if (!result) result = client->noClientException; return (result); } int ProcKillClient(register ClientPtr client) { REQUEST(xResourceReq); ClientPtr killclient; REQUEST_SIZE_MATCH(xResourceReq); if (stuff->id == AllTemporary) { CloseDownRetainedResources(); return (client->noClientException); } if ((killclient = LookupClient(stuff->id, client))) { CloseDownClient(killclient); /* if an LBX proxy gets killed, isItTimeToYield will be set */ if (isItTimeToYield || (client == killclient)) { /* force yield and return Success, so that Dispatch() * doesn't try to touch client */ isItTimeToYield = TRUE; return (Success); } return (client->noClientException); } else { client->errorValue = stuff->id; return (BadValue); } } int ProcSetFontPath(register ClientPtr client) { unsigned char *ptr; unsigned long nbytes, total; long nfonts; int n, result; REQUEST(xSetFontPathReq); REQUEST_AT_LEAST_SIZE(xSetFontPathReq); nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq); total = nbytes; ptr = (unsigned char *)&stuff[1]; nfonts = stuff->nFonts; while (--nfonts >= 0) { if ((total == 0) || (total < (n = (*ptr + 1)))) return(BadLength); total -= n; ptr += n; } if (total >= 4) return(BadLength); result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1]); if (!result) result = client->noClientException; return (result); } int ProcGetFontPath(register ClientPtr client) { xGetFontPathReply reply = {0}; int stringLens, numpaths; unsigned char *bufferStart; /* REQUEST (xReq); */ REQUEST_SIZE_MATCH(xReq); bufferStart = GetFontPath(&numpaths, &stringLens); reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.length = (stringLens + numpaths + 3) >> 2; reply.nPaths = numpaths; WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply); if (stringLens || numpaths) WriteToClient(client, stringLens + numpaths, bufferStart); return(client->noClientException); } int ProcChangeCloseDownMode(register ClientPtr client) { REQUEST(xSetCloseDownModeReq); REQUEST_SIZE_MATCH(xSetCloseDownModeReq); if ((stuff->mode == AllTemporary) || (stuff->mode == RetainPermanent) || (stuff->mode == RetainTemporary)) { client->closeDownMode = stuff->mode; return (client->noClientException); } else { client->errorValue = stuff->mode; return (BadValue); } } #ifndef NXAGENT_SERVER int ProcForceScreenSaver(register ClientPtr client) { REQUEST(xForceScreenSaverReq); REQUEST_SIZE_MATCH(xForceScreenSaverReq); if ((stuff->mode != ScreenSaverReset) && (stuff->mode != ScreenSaverActive)) { client->errorValue = stuff->mode; return BadValue; } SaveScreens(SCREEN_SAVER_FORCER, (int)stuff->mode); return client->noClientException; } #endif /* NXAGENT_SERVER */ int ProcNoOperation(register ClientPtr client) { REQUEST_AT_LEAST_SIZE(xReq); /* noop -- don't do anything */ return(client->noClientException); } void InitProcVectors(void) { int i; for (i = 0; i<256; i++) { if(!ProcVector[i]) { ProcVector[i] = SwappedProcVector[i] = ProcBadRequest; ReplySwapVector[i] = ReplyNotSwappd; } } for(i = LASTEvent; i < 128; i++) { EventSwapVector[i] = NotImplemented; } } /********************** * CloseDownClient * * Client can either mark his resources destroy or retain. If retained and * then killed again, the client is really destroyed. *********************/ char dispatchExceptionAtReset = DE_RESET; void #ifdef NXAGENT_SERVER xorg_CloseDownClient(ClientPtr client) #else CloseDownClient(ClientPtr client) #endif { Bool really_close_down = client->clientGone || client->closeDownMode == DestroyAll; if (!client->clientGone) { /* ungrab server if grabbing client dies */ if (grabState != GrabNone && grabClient == client) { UngrabServer(client); } BITCLEAR(grabWaiters, client->index); DeleteClientFromAnySelections(client); ReleaseActiveGrabs(client); DeleteClientFontStuff(client); if (!really_close_down) { /* This frees resources that should never be retained * no matter what the close down mode is. Actually we * could do this unconditionally, but it's probably * better not to traverse all the client's resources * twice (once here, once a few lines down in * FreeClientResources) in the common case of * really_close_down == TRUE. */ FreeClientNeverRetainResources(client); client->clientState = ClientStateRetained; if (ClientStateCallback) { NewClientInfoRec clientinfo; clientinfo.client = client; clientinfo.prefix = (xConnSetupPrefix *)NULL; clientinfo.setup = (xConnSetup *) NULL; CallCallbacks((&ClientStateCallback), (void *)&clientinfo); } } client->clientGone = TRUE; /* so events aren't sent to client */ if (ClientIsAsleep(client)) ClientSignal (client); ProcessWorkQueueZombies(); CloseDownConnection(client); /* If the client made it to the Running stage, nClients has * been incremented on its behalf, so we need to decrement it * now. If it hasn't gotten to Running, nClients has *not* * been incremented, so *don't* decrement it. */ if (client->clientState != ClientStateInitial && client->clientState != ClientStateAuthenticating ) { --nClients; } } if (really_close_down) { if (client->clientState == ClientStateRunning && nClients == 0) dispatchException |= dispatchExceptionAtReset; client->clientState = ClientStateGone; if (ClientStateCallback) { NewClientInfoRec clientinfo; clientinfo.client = client; clientinfo.prefix = (xConnSetupPrefix *)NULL; clientinfo.setup = (xConnSetup *) NULL; CallCallbacks((&ClientStateCallback), (void *)&clientinfo); } FreeClientResources(client); /* Disable client ID tracking. This must be done after * ClientStateCallback. */ ReleaseClientIds(client); if (client->index < nextFreeClientID) nextFreeClientID = client->index; clients[client->index] = NullClient; SmartLastClient = NullClient; free(client); while (!clients[currentMaxClients-1]) currentMaxClients--; } } static void KillAllClients() { int i; for (i=1; icloseDownMode = DestroyAll; CloseDownClient(clients[i]); } } /********************* * CloseDownRetainedResources * * Find all clients that are gone and have terminated in RetainTemporary * and destroy their resources. *********************/ void CloseDownRetainedResources() { register int i; register ClientPtr client; for (i=1; icloseDownMode == RetainTemporary) && (client->clientGone)) CloseDownClient(client); } } extern int clientPrivateLen; extern unsigned *clientPrivateSizes; extern unsigned totalClientSize; void InitClient(ClientPtr client, int i, void * ospriv) { client->index = i; client->sequence = 0; client->clientAsMask = ((Mask)i) << CLIENTOFFSET; client->clientGone = FALSE; client->closeDownMode = i ? DestroyAll : RetainPermanent; client->numSaved = 0; client->saveSet = (SaveSetElt *)NULL; client->noClientException = Success; client->requestVector = InitialVector; client->osPrivate = ospriv; client->swapped = FALSE; client->big_requests = FALSE; client->priority = 0; client->clientState = ClientStateInitial; #ifdef XKB if (!noXkbExtension) { client->xkbClientFlags = 0; client->mapNotifyMask = 0; QueryMinMaxKeyCodes(&client->minKC,&client->maxKC); } #endif client->replyBytesRemaining = 0; #ifdef XCSECURITY client->trustLevel = XSecurityClientTrusted; client->CheckAccess = NULL; client->authId = 0; #endif client->fontResFunc = NULL; client->smart_priority = 0; client->smart_start_tick = SmartScheduleTime; client->smart_stop_tick = SmartScheduleTime; client->smart_check_tick = SmartScheduleTime; client->clientIds = NULL; } int #ifdef NXAGENT_SERVER xorg_InitClientPrivates(ClientPtr client) #else InitClientPrivates(ClientPtr client) #endif { register char *ptr; DevUnion *ppriv; register unsigned *sizes; register unsigned size; register int i; if (totalClientSize == sizeof(ClientRec)) ppriv = (DevUnion *)NULL; else if (client->index) ppriv = (DevUnion *)(client + 1); else { ppriv = (DevUnion *)malloc(totalClientSize - sizeof(ClientRec)); if (!ppriv) return 0; } client->devPrivates = ppriv; sizes = clientPrivateSizes; ptr = (char *)(ppriv + clientPrivateLen); for (i = clientPrivateLen; --i >= 0; ppriv++, sizes++) { if ( (size = *sizes) ) { ppriv->ptr = (void *)ptr; ptr += size; } else ppriv->ptr = (void *)NULL; } /* Allow registrants to initialize the serverClient devPrivates */ if (!client->index && ClientStateCallback) { NewClientInfoRec clientinfo; clientinfo.client = client; clientinfo.prefix = (xConnSetupPrefix *)NULL; clientinfo.setup = (xConnSetup *) NULL; CallCallbacks((&ClientStateCallback), (void *)&clientinfo); } return 1; } /************************ * int NextAvailableClient(ospriv) * * OS dependent portion can't assign client id's because of CloseDownModes. * Returns NULL if there are no free clients. *************************/ ClientPtr NextAvailableClient(void * ospriv) { register int i; register ClientPtr client; xReq data; i = nextFreeClientID; if (i == MAXCLIENTS) return (ClientPtr)NULL; clients[i] = client = (ClientPtr)calloc(1,totalClientSize); if (!client) return (ClientPtr)NULL; InitClient(client, i, ospriv); InitClientPrivates(client); if (!InitClientResources(client)) { free(client); return (ClientPtr)NULL; } data.reqType = 1; data.length = (sz_xReq + sz_xConnClientPrefix) >> 2; if (!InsertFakeRequest(client, (char *)&data, sz_xReq)) { FreeClientResources(client); free(client); return (ClientPtr)NULL; } if (i == currentMaxClients) currentMaxClients++; while ((nextFreeClientID < MAXCLIENTS) && clients[nextFreeClientID]) nextFreeClientID++; /* Enable client ID tracking. This must be done before * ClientStateCallback. */ ReserveClientIds(client); if (ClientStateCallback) { NewClientInfoRec clientinfo = {0}; clientinfo.client = client; clientinfo.prefix = (xConnSetupPrefix *)NULL; clientinfo.setup = (xConnSetup *) NULL; CallCallbacks((&ClientStateCallback), (void *)&clientinfo); } return(client); } int ProcInitialConnection(register ClientPtr client) { REQUEST(xReq); register xConnClientPrefix *prefix; int whichbyte = 1; char order; prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq); order = prefix->byteOrder; if (order != 'l' && order != 'B' && order != 'r' && order != 'R') return (client->noClientException = -1); if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) || (!(*(char *) &whichbyte) && (order == 'l' || order == 'r'))) { client->swapped = TRUE; SwapConnClientPrefix(prefix); } stuff->reqType = 2; stuff->length += ((prefix->nbytesAuthProto + (unsigned)3) >> 2) + ((prefix->nbytesAuthString + (unsigned)3) >> 2); if (client->swapped) { swaps(&stuff->length); } if (order == 'r' || order == 'R') { client->local = FALSE; } ResetCurrentRequest(client); return (client->noClientException); } int SendConnSetup(register ClientPtr client, char *reason) { register xWindowRoot *root; register int i; int numScreens; char* lConnectionInfo; xConnSetupPrefix* lconnSetupPrefix; if (reason) { xConnSetupPrefix csp = {0};; csp.success = xFalse; csp.lengthReason = strlen(reason); csp.length = (csp.lengthReason + (unsigned)3) >> 2; csp.majorVersion = X_PROTOCOL; csp.minorVersion = X_PROTOCOL_REVISION; if (client->swapped) WriteSConnSetupPrefix(client, &csp); else WriteToClient(client, sz_xConnSetupPrefix, &csp); WriteToClient(client, (int)csp.lengthReason, reason); return (client->noClientException = -1); } numScreens = screenInfo.numScreens; lConnectionInfo = ConnectionInfo; lconnSetupPrefix = &connSetupPrefix; /* We're about to start speaking X protocol back to the client by * sending the connection setup info. This means the authorization * step is complete, and we can count the client as an * authorized one. */ nClients++; client->requestVector = client->swapped ? SwappedProcVector : ProcVector; client->sequence = 0; ((xConnSetup *)lConnectionInfo)->ridBase = client->clientAsMask; ((xConnSetup *)lConnectionInfo)->ridMask = RESOURCE_ID_MASK; #ifdef MATCH_CLIENT_ENDIAN ((xConnSetup *)lConnectionInfo)->imageByteOrder = ClientOrder (client); ((xConnSetup *)lConnectionInfo)->bitmapBitOrder = ClientOrder (client); #endif /* fill in the "currentInputMask" */ root = (xWindowRoot *)(lConnectionInfo + connBlockScreenStart); #ifdef PANORAMIX if (noPanoramiXExtension) numScreens = screenInfo.numScreens; else numScreens = ((xConnSetup *)ConnectionInfo)->numRoots; #endif for (i=0; icurrentInputMask = screenInfo.screens[i]->root->eventMask | wOtherEventMasks (screenInfo.screens[i]->root); pDepth = (xDepth *)(root + 1); for (j = 0; j < root->nDepths; j++) { pDepth = (xDepth *)(((char *)(pDepth + 1)) + pDepth->nVisuals * sizeof(xVisualType)); } root = (xWindowRoot *)pDepth; } if (client->swapped) { WriteSConnSetupPrefix(client, lconnSetupPrefix); WriteSConnectionInfo(client, (unsigned long)(lconnSetupPrefix->length << 2), lConnectionInfo); } else { WriteToClient(client, sizeof(xConnSetupPrefix), (char *) lconnSetupPrefix); WriteToClient(client, (int)(lconnSetupPrefix->length << 2), lConnectionInfo); } client->clientState = ClientStateRunning; if (ClientStateCallback) { NewClientInfoRec clientinfo = {0}; clientinfo.client = client; clientinfo.prefix = lconnSetupPrefix; clientinfo.setup = (xConnSetup *)lConnectionInfo; CallCallbacks((&ClientStateCallback), (void *)&clientinfo); } return (client->noClientException); } int ProcEstablishConnection(register ClientPtr client) { char *reason, *auth_proto, *auth_string; register xConnClientPrefix *prefix; REQUEST(xReq); prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq); auth_proto = (char *)prefix + sz_xConnClientPrefix; auth_string = auth_proto + ((prefix->nbytesAuthProto + 3) & ~3); if ((prefix->majorVersion != X_PROTOCOL) || (prefix->minorVersion != X_PROTOCOL_REVISION)) reason = "Protocol version mismatch"; else reason = ClientAuthorized(client, (unsigned short)prefix->nbytesAuthProto, auth_proto, (unsigned short)prefix->nbytesAuthString, auth_string); /* * If Kerberos is being used for this client, the clientState * will be set to ClientStateAuthenticating at this point. * More messages need to be exchanged among the X server, Kerberos * server, and client to figure out if everyone is authorized. * So we don't want to send the connection setup info yet, since * the auth step isn't really done. */ if (client->clientState == ClientStateCheckingSecurity) client->clientState = ClientStateCheckedSecurity; else if (client->clientState != ClientStateAuthenticating) return(SendConnSetup(client, reason)); return(client->noClientException); } void SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode, XID resId, int errorCode) { xError rep = {0}; rep.type = X_Error; rep.errorCode = errorCode; rep.majorCode = majorCode; rep.minorCode = minorCode; rep.resourceID = resId; WriteEventsToClient (client, 1, (xEvent *)&rep); } void DeleteWindowFromAnySelections(WindowPtr pWin) { register int i; for (i = 0; i< NumCurrentSelections; i++) if (CurrentSelections[i].pWin == pWin) { if (SelectionCallback) { SelectionInfoRec info; info.selection = &CurrentSelections[i]; info.kind = SelectionWindowDestroy; CallCallbacks(&SelectionCallback, &info); } CurrentSelections[i].pWin = (WindowPtr)NULL; CurrentSelections[i].window = None; CurrentSelections[i].client = NullClient; } } static void DeleteClientFromAnySelections(ClientPtr client) { register int i; for (i = 0; i< NumCurrentSelections; i++) if (CurrentSelections[i].client == client) { if (SelectionCallback) { SelectionInfoRec info; info.selection = &CurrentSelections[i]; info.kind = SelectionWindowDestroy; CallCallbacks(&SelectionCallback, &info); } CurrentSelections[i].pWin = (WindowPtr)NULL; CurrentSelections[i].window = None; CurrentSelections[i].client = NullClient; } } void MarkClientException(ClientPtr client) { client->noClientException = -1; } /* * This array encodes the answer to the question "what is the log base 2 * of the number of pixels that fit in a scanline pad unit?" * Note that ~0 is an invalid entry (mostly for the benefit of the reader). */ static int answer[6][4] = { /* pad pad pad pad*/ /* 8 16 32 64 */ { 3, 4, 5 , 6 }, /* 1 bit per pixel */ { 1, 2, 3 , 4 }, /* 4 bits per pixel */ { 0, 1, 2 , 3 }, /* 8 bits per pixel */ { ~0, 0, 1 , 2 }, /* 16 bits per pixel */ { ~0, ~0, 0 , 1 }, /* 24 bits per pixel */ { ~0, ~0, 0 , 1 } /* 32 bits per pixel */ }; /* * This array gives the bytesperPixel value for cases where the number * of bits per pixel is a multiple of 8 but not a power of 2. */ static int answerBytesPerPixel[ 33 ] = { ~0, 0, ~0, ~0, /* 1 bit per pixel */ 0, ~0, ~0, ~0, /* 4 bits per pixel */ 0, ~0, ~0, ~0, /* 8 bits per pixel */ ~0,~0, ~0, ~0, 0, ~0, ~0, ~0, /* 16 bits per pixel */ ~0,~0, ~0, ~0, 3, ~0, ~0, ~0, /* 24 bits per pixel */ ~0,~0, ~0, ~0, 0 /* 32 bits per pixel */ }; /* * This array gives the answer to the question "what is the first index for * the answer array above given the number of bits per pixel?" * Note that ~0 is an invalid entry (mostly for the benefit of the reader). */ static int indexForBitsPerPixel[ 33 ] = { ~0, 0, ~0, ~0, /* 1 bit per pixel */ 1, ~0, ~0, ~0, /* 4 bits per pixel */ 2, ~0, ~0, ~0, /* 8 bits per pixel */ ~0,~0, ~0, ~0, 3, ~0, ~0, ~0, /* 16 bits per pixel */ ~0,~0, ~0, ~0, 4, ~0, ~0, ~0, /* 24 bits per pixel */ ~0,~0, ~0, ~0, 5 /* 32 bits per pixel */ }; /* * This array gives the answer to the question "what is the second index for * the answer array above given the number of bits per scanline pad unit?" * Note that ~0 is an invalid entry (mostly for the benefit of the reader). */ static int indexForScanlinePad[ 65 ] = { ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, 0, ~0, ~0, ~0, /* 8 bits per scanline pad unit */ ~0, ~0, ~0, ~0, 1, ~0, ~0, ~0, /* 16 bits per scanline pad unit */ ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, 2, ~0, ~0, ~0, /* 32 bits per scanline pad unit */ ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, 3 /* 64 bits per scanline pad unit */ }; #ifndef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif static int init_screen(ScreenPtr pScreen, int i) { int scanlinepad, format, depth, bitsPerPixel, j, k; #ifdef DEBUG void (**jNI) (); #endif /* DEBUG */ pScreen->myNum = i; pScreen->WindowPrivateLen = 0; pScreen->WindowPrivateSizes = (unsigned *)NULL; pScreen->totalWindowSize = ((sizeof(WindowRec) + sizeof(long) - 1) / sizeof(long)) * sizeof(long); pScreen->GCPrivateLen = 0; pScreen->GCPrivateSizes = (unsigned *)NULL; pScreen->totalGCSize = ((sizeof(GC) + sizeof(long) - 1) / sizeof(long)) * sizeof(long); #ifdef PIXPRIV pScreen->PixmapPrivateLen = 0; pScreen->PixmapPrivateSizes = (unsigned *)NULL; pScreen->totalPixmapSize = BitmapBytePad(sizeof(PixmapRec)*8); #endif pScreen->ClipNotify = 0; /* for R4 ddx compatibility */ pScreen->CreateScreenResources = 0; #ifdef DEBUG for (jNI = &pScreen->QueryBestSize; jNI < (void (**) ()) &pScreen->SendGraphicsExpose; jNI++) *jNI = NotImplemented; #endif /* DEBUG */ /* * This loop gets run once for every Screen that gets added, * but thats ok. If the ddx layer initializes the formats * one at a time calling AddScreen() after each, then each * iteration will make it a little more accurate. Worst case * we do this loop N * numPixmapFormats where N is # of screens. * Anyway, this must be called after InitOutput and before the * screen init routine is called. */ for (format=0; formatdevPrivates = (DevUnion *)calloc(sizeof(DevUnion), screenPrivateCount); if (!pScreen->devPrivates && screenPrivateCount) { free(pScreen); return -1; } ret = init_screen(pScreen, i); if (ret != 0) { free(pScreen); return ret; } /* This is where screen specific stuff gets initialized. Load the screen structure, call the hardware, whatever. This is also where the default colormap should be allocated and also pixel values for blackPixel, whitePixel, and the cursor Note that InitScreen is NOT allowed to modify argc, argv, or any of the strings pointed to by argv. They may be passed to multiple screens. */ pScreen->rgf = ~0L; /* there are no scratch GCs yet*/ screenInfo.screens[i] = pScreen; screenInfo.numScreens++; if (!(*pfnInit)(pScreen, argc, argv)) { FreeScreen(pScreen); screenInfo.numScreens--; return -1; } return i; } void FreeScreen(ScreenPtr pScreen) { pScreen->root = NullWindow; free(pScreen->WindowPrivateSizes); free(pScreen->GCPrivateSizes); #ifdef PIXPRIV free(pScreen->PixmapPrivateSizes); #endif free(pScreen->devPrivates); free(pScreen); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/dispatch.h0000644000000000000000000001201413614532331017325 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* * This prototypes the dispatch.c module (except for functions declared in * global headers), plus related dispatch procedures from devices.c, events.c, * extension.c, property.c. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef DISPATCH_H #define DISPATCH_H 1 DISPATCH_PROC(InitClientPrivates); DISPATCH_PROC(ProcAllocColor); DISPATCH_PROC(ProcAllocColorCells); DISPATCH_PROC(ProcAllocColorPlanes); DISPATCH_PROC(ProcAllocNamedColor); DISPATCH_PROC(ProcBell); DISPATCH_PROC(ProcChangeAccessControl); DISPATCH_PROC(ProcChangeCloseDownMode); DISPATCH_PROC(ProcChangeGC); DISPATCH_PROC(ProcChangeHosts); DISPATCH_PROC(ProcChangeKeyboardControl); DISPATCH_PROC(ProcChangeKeyboardMapping); DISPATCH_PROC(ProcChangePointerControl); DISPATCH_PROC(ProcChangeProperty); DISPATCH_PROC(ProcChangeSaveSet); DISPATCH_PROC(ProcChangeWindowAttributes); DISPATCH_PROC(ProcCirculateWindow); DISPATCH_PROC(ProcClearToBackground); DISPATCH_PROC(ProcCloseFont); DISPATCH_PROC(ProcConfigureWindow); DISPATCH_PROC(ProcConvertSelection); DISPATCH_PROC(ProcCopyArea); DISPATCH_PROC(ProcCopyColormapAndFree); DISPATCH_PROC(ProcCopyGC); DISPATCH_PROC(ProcCopyPlane); DISPATCH_PROC(ProcCreateColormap); DISPATCH_PROC(ProcCreateCursor); DISPATCH_PROC(ProcCreateGC); DISPATCH_PROC(ProcCreateGlyphCursor); DISPATCH_PROC(ProcCreatePixmap); DISPATCH_PROC(ProcCreateWindow); DISPATCH_PROC(ProcDeleteProperty); DISPATCH_PROC(ProcDestroySubwindows); DISPATCH_PROC(ProcDestroyWindow); DISPATCH_PROC(ProcEstablishConnection); DISPATCH_PROC(ProcFillPoly); DISPATCH_PROC(ProcForceScreenSaver); DISPATCH_PROC(ProcFreeColormap); DISPATCH_PROC(ProcFreeColors); DISPATCH_PROC(ProcFreeCursor); DISPATCH_PROC(ProcFreeGC); DISPATCH_PROC(ProcFreePixmap); DISPATCH_PROC(ProcGetAtomName); DISPATCH_PROC(ProcGetFontPath); DISPATCH_PROC(ProcGetGeometry); DISPATCH_PROC(ProcGetImage); DISPATCH_PROC(ProcGetKeyboardControl); DISPATCH_PROC(ProcGetKeyboardMapping); DISPATCH_PROC(ProcGetModifierMapping); DISPATCH_PROC(ProcGetMotionEvents); DISPATCH_PROC(ProcGetPointerControl); DISPATCH_PROC(ProcGetPointerMapping); DISPATCH_PROC(ProcGetProperty); DISPATCH_PROC(ProcGetScreenSaver); DISPATCH_PROC(ProcGetSelectionOwner); DISPATCH_PROC(ProcGetWindowAttributes); DISPATCH_PROC(ProcGrabServer); DISPATCH_PROC(ProcImageText16); DISPATCH_PROC(ProcImageText8); DISPATCH_PROC(ProcInitialConnection); DISPATCH_PROC(ProcInstallColormap); DISPATCH_PROC(ProcInternAtom); DISPATCH_PROC(ProcKillClient); DISPATCH_PROC(ProcListExtensions); DISPATCH_PROC(ProcListFonts); DISPATCH_PROC(ProcListFontsWithInfo); DISPATCH_PROC(ProcListHosts); DISPATCH_PROC(ProcListInstalledColormaps); DISPATCH_PROC(ProcListProperties); DISPATCH_PROC(ProcLookupColor); DISPATCH_PROC(ProcMapSubwindows); DISPATCH_PROC(ProcMapWindow); DISPATCH_PROC(ProcNoOperation); DISPATCH_PROC(ProcOpenFont); DISPATCH_PROC(ProcPolyArc); DISPATCH_PROC(ProcPolyFillArc); DISPATCH_PROC(ProcPolyFillRectangle); DISPATCH_PROC(ProcPolyLine); DISPATCH_PROC(ProcPolyPoint); DISPATCH_PROC(ProcPolyRectangle); DISPATCH_PROC(ProcPolySegment); DISPATCH_PROC(ProcPolyText); DISPATCH_PROC(ProcPutImage); DISPATCH_PROC(ProcQueryBestSize); DISPATCH_PROC(ProcQueryColors); DISPATCH_PROC(ProcQueryExtension); DISPATCH_PROC(ProcQueryFont); DISPATCH_PROC(ProcQueryKeymap); DISPATCH_PROC(ProcQueryTextExtents); DISPATCH_PROC(ProcQueryTree); DISPATCH_PROC(ProcReparentWindow); DISPATCH_PROC(ProcRotateProperties); DISPATCH_PROC(ProcSetClipRectangles); DISPATCH_PROC(ProcSetDashes); DISPATCH_PROC(ProcSetFontPath); DISPATCH_PROC(ProcSetModifierMapping); DISPATCH_PROC(ProcSetPointerMapping); DISPATCH_PROC(ProcSetScreenSaver); DISPATCH_PROC(ProcSetSelectionOwner); DISPATCH_PROC(ProcStoreColors); DISPATCH_PROC(ProcStoreNamedColor); DISPATCH_PROC(ProcTranslateCoords); DISPATCH_PROC(ProcUngrabServer); DISPATCH_PROC(ProcUninstallColormap); DISPATCH_PROC(ProcUnmapSubwindows); DISPATCH_PROC(ProcUnmapWindow); #endif /* DISPATCH_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/dixfonts.c0000644000000000000000000017755413614532331017404 0ustar /************************************************************************ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************/ /* The panoramix components contained the following notice */ /* Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "scrnintstr.h" #include "resource.h" #include "dixstruct.h" #include "cursorstr.h" #include "list.h" #include "misc.h" #include "opaque.h" #include "dixfontstr.h" #include "closestr.h" #ifdef HAS_XFONT2 # include #endif /* HAS_XFONT2 */ #ifdef DEBUG #include #endif #ifdef PANORAMIX #include "panoramiX.h" #endif #ifdef XF86BIGFONT #define _XF86BIGFONT_SERVER_ #include #endif #define QUERYCHARINFO(pci, pr) *(pr) = (pci)->metrics #ifndef HAS_XFONT2 extern void register_fpe_functions(void); #endif extern void * fosNaturalParams; extern FontPtr defaultFont; static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0; static int num_fpes = 0; #ifdef HAS_XFONT2 xfont2_fpe_funcs_rec const **fpe_functions; #else FPEFunctions *fpe_functions = (FPEFunctions *) 0; #endif static int num_fpe_types = 0; static unsigned char *font_path_string; static int num_slept_fpes = 0; static int size_slept_fpes = 0; static FontPathElementPtr *slept_fpes = (FontPathElementPtr *) 0; #ifdef HAS_XFONT2 xfont2_pattern_cache_ptr patternCache; #else static FontPatternCachePtr patternCache; #endif /* HAS_FONT2 */ int FontToXError(err) int err; { switch (err) { case Successful: return Success; case AllocError: return BadAlloc; case BadFontName: return BadName; case BadFontPath: case BadFontFormat: /* is there something better? */ case BadCharRange: return BadValue; default: return err; } } /* * adding RT_FONT prevents conflict with default cursor font */ Bool SetDefaultFont(char *defaultfontname) { int err; FontPtr pf; XID fid; fid = FakeClientID(0); err = OpenFont(serverClient, fid, FontLoadAll | FontOpenSync, (unsigned) strlen(defaultfontname), defaultfontname); if (err != Success) return FALSE; pf = (FontPtr) LookupIDByType(fid, RT_FONT); if (pf == (FontPtr) NULL) return FALSE; defaultFont = pf; return TRUE; } /* * note that the font wakeup queue is not refcounted. this is because * an fpe needs to be added when it's inited, and removed when it's finally * freed, in order to handle any data that isn't requested, like FS events. * * since the only thing that should call these routines is the renderer's * init_fpe() and free_fpe(), there shouldn't be any problem in using * freed data. */ void QueueFontWakeup(FontPathElementPtr fpe) { int i; FontPathElementPtr *new; for (i = 0; i < num_slept_fpes; i++) { if (slept_fpes[i] == fpe) { #ifdef DEBUG fprintf(stderr, "re-queueing fpe wakeup\n"); #endif return; } } if (num_slept_fpes == size_slept_fpes) { new = (FontPathElementPtr *) realloc(slept_fpes, sizeof(FontPathElementPtr) * (size_slept_fpes + 4)); if (!new) return; slept_fpes = new; size_slept_fpes += 4; } slept_fpes[num_slept_fpes] = fpe; num_slept_fpes++; } void RemoveFontWakeup(FontPathElementPtr fpe) { int i, j; for (i = 0; i < num_slept_fpes; i++) { if (slept_fpes[i] == fpe) { for (j = i; j < num_slept_fpes; j++) { slept_fpes[j] = slept_fpes[j + 1]; } num_slept_fpes--; return; } } } void FontWakeup(void * data, int count, void * LastSelectMask) { int i; FontPathElementPtr fpe; if (count < 0) return; /* wake up any fpe's that may be waiting for information */ for (i = 0; i < num_slept_fpes; i++) { fpe = slept_fpes[i]; #ifdef HAS_XFONT2 (void) (*fpe_functions[fpe->type]->wakeup_fpe) (fpe); #else (void) (*fpe_functions[fpe->type].wakeup_fpe) (fpe, LastSelectMask); #endif /* HAS_XFONT2 */ } } /* XXX -- these two funcs may want to be broken into macros */ static void UseFPE(FontPathElementPtr fpe) { fpe->refcount++; } static void FreeFPE (FontPathElementPtr fpe) { fpe->refcount--; if (fpe->refcount == 0) { #ifdef HAS_XFONT2 (*fpe_functions[fpe->type]->free_fpe) (fpe); #else (*fpe_functions[fpe->type].free_fpe) (fpe); #endif free(fpe->name); free(fpe); } } #ifndef NXAGENT_SERVER static Bool doOpenFont(ClientPtr client, OFclosurePtr c) { FontPtr pfont = NullFont; FontPathElementPtr fpe = NULL; ScreenPtr pScr; int err = Successful; int i; char *alias, *newname; int newlen; int aliascount = 20; /* * Decide at runtime what FontFormat to use. */ Mask FontFormat = ((screenInfo.imageByteOrder == LSBFirst) ? BitmapFormatByteOrderLSB : BitmapFormatByteOrderMSB) | ((screenInfo.bitmapBitOrder == LSBFirst) ? BitmapFormatBitOrderLSB : BitmapFormatBitOrderMSB) | BitmapFormatImageRectMin | #if GLYPHPADBYTES == 1 BitmapFormatScanlinePad8 | #endif #if GLYPHPADBYTES == 2 BitmapFormatScanlinePad16 | #endif #if GLYPHPADBYTES == 4 BitmapFormatScanlinePad32 | #endif #if GLYPHPADBYTES == 8 BitmapFormatScanlinePad64 | #endif BitmapFormatScanlineUnit8; if (client->clientGone) { if (c->current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current_fpe]; #ifdef HAS_XFONT2 (*fpe_functions[fpe->type]->client_died) ((void *) client, fpe); #else (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); #endif /* HAS_XFONT2 */ } err = Successful; goto bail; } while (c->current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current_fpe]; #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->open_font) #else err = (*fpe_functions[fpe->type].open_font) #endif /* HAS_XFONT2 */ ((void *) client, fpe, c->flags, c->fontname, c->fnamelen, FontFormat, BitmapFormatMaskByte | BitmapFormatMaskBit | BitmapFormatMaskImageRectangle | BitmapFormatMaskScanLinePad | BitmapFormatMaskScanLineUnit, c->fontid, &pfont, &alias, c->non_cachable_font && c->non_cachable_font->fpe == fpe ? c->non_cachable_font : (FontPtr)0); if (err == FontNameAlias && alias) { newlen = strlen(alias); newname = (char *) realloc(c->fontname, newlen); if (!newname) { err = AllocError; break; } memmove(newname, alias, newlen); c->fontname = newname; c->fnamelen = newlen; c->current_fpe = 0; if (--aliascount <= 0) break; continue; } if (err == BadFontName) { c->current_fpe++; continue; } if (err == Suspended) { if (!c->slept) { c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)doOpenFont, (void *) c); } return TRUE; } break; } if (err != Successful) goto bail; if (!pfont) { err = BadFontName; goto bail; } /* check values for firstCol, lastCol, firstRow, and lastRow */ if (pfont->info.firstCol > pfont->info.lastCol || pfont->info.firstRow > pfont->info.lastRow || pfont->info.lastCol - pfont->info.firstCol > 255) { err = AllocError; goto bail; } if (!pfont->fpe) pfont->fpe = fpe; pfont->refcnt++; if (pfont->refcnt == 1) { UseFPE(pfont->fpe); for (i = 0; i < screenInfo.numScreens; i++) { pScr = screenInfo.screens[i]; if (pScr->RealizeFont) { if (!(*pScr->RealizeFont) (pScr, pfont)) { CloseFont (pfont, (Font) 0); err = AllocError; goto bail; } } } } if (!AddResource(c->fontid, RT_FONT, (void *) pfont)) { err = AllocError; goto bail; } if (patternCache && pfont != c->non_cachable_font) #ifdef HAS_XFONT2 xfont2_cache_font_pattern(patternCache, c->origFontName, c->origFontNameLen, #else CacheFontPattern(patternCache, c->origFontName, c->origFontNameLen, #endif /* HAS_XFONT2 */ pfont); bail: if (err != Successful && c->client != serverClient) { SendErrorToClient(c->client, X_OpenFont, 0, c->fontid, FontToXError(err)); } if (c->slept) ClientWakeup(c->client); for (i = 0; i < c->num_fpes; i++) { FreeFPE(c->fpe_list[i]); } free(c->fpe_list); free(c->fontname); free(c); return TRUE; } #endif /* NXAGENT_SERVER */ int OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontname) { OFclosurePtr c; int i; FontPtr cached = (FontPtr)0; #ifdef FONTDEBUG char *f; f = (char *)malloc(lenfname + 1); memmove(f, pfontname, lenfname); f[lenfname] = '\0'; ErrorF("OpenFont: fontname is \"%s\"\n", f); free(f); #endif if (!lenfname || lenfname > XLFDMAXFONTNAMELEN) return BadName; if (patternCache) { /* ** Check name cache. If we find a cached version of this font that ** is cachable, immediately satisfy the request with it. If we find ** a cached version of this font that is non-cachable, we do not ** satisfy the request with it. Instead, we pass the FontPtr to the ** FPE's open_font code (the fontfile FPE in turn passes the ** information to the rasterizer; the fserve FPE ignores it). ** ** Presumably, the font is marked non-cachable because the FPE has ** put some licensing restrictions on it. If the FPE, using ** whatever logic it relies on, determines that it is willing to ** share this existing font with the client, then it has the option ** to return the FontPtr we passed it as the newly-opened font. ** This allows the FPE to exercise its licensing logic without ** having to create another instance of a font that already exists. */ #ifdef HAS_XFONT2 cached = xfont2_find_cached_font_pattern(patternCache, pfontname, lenfname); #else cached = FindCachedFontPattern(patternCache, pfontname, lenfname); #endif /* HAS_XFONT2 */ if (cached && cached->info.cachable) { if (!AddResource(fid, RT_FONT, (void *) cached)) return BadAlloc; cached->refcnt++; return Success; } } c = (OFclosurePtr) malloc(sizeof(OFclosureRec)); if (!c) return BadAlloc; c->fontname = (char *) malloc(lenfname); c->origFontName = pfontname; c->origFontNameLen = lenfname; if (!c->fontname) { free(c); return BadAlloc; } /* * copy the current FPE list, so that if it gets changed by another client * while we're blocking, the request still appears atomic */ c->fpe_list = (FontPathElementPtr *) malloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { free(c->fontname); free(c); return BadAlloc; } memmove(c->fontname, pfontname, lenfname); for (i = 0; i < num_fpes; i++) { c->fpe_list[i] = font_path_elements[i]; UseFPE(c->fpe_list[i]); } c->client = client; c->fontid = fid; c->current_fpe = 0; c->num_fpes = num_fpes; c->fnamelen = lenfname; c->slept = FALSE; c->flags = flags; c->non_cachable_font = cached; (void) doOpenFont(client, c); return Success; } /** * Decrement font's ref count, and free storage if ref count equals zero * * \param value must conform to DeleteType */ int CloseFont(void * value, XID fid) { int nscr; ScreenPtr pscr; FontPathElementPtr fpe; FontPtr pfont = (FontPtr)value; if (pfont == NullFont) return (Success); if (--pfont->refcnt == 0) { if (patternCache) #ifdef HAS_XFONT2 xfont2_remove_cached_font_pattern(patternCache, pfont); #else RemoveCachedFontPattern (patternCache, pfont); #endif /* HAS_XFONT2 */ /* * since the last reference is gone, ask each screen to free any * storage it may have allocated locally for it. */ for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { pscr = screenInfo.screens[nscr]; if (pscr->UnrealizeFont) (*pscr->UnrealizeFont) (pscr, pfont); } if (pfont == defaultFont) defaultFont = NULL; #ifdef XF86BIGFONT XF86BigfontFreeFontShm(pfont); #endif fpe = pfont->fpe; #ifdef HAS_XFONT2 (*fpe_functions[fpe->type]->close_font) (fpe, pfont); #else (*fpe_functions[fpe->type].close_font) (fpe, pfont); #endif FreeFPE(fpe); } return (Success); } /***====================================================================***/ /** * Sets up pReply as the correct QueryFontReply for pFont with the first * nProtoCCIStructs char infos. * * \param pReply caller must allocate this storage */ void QueryFont(FontPtr pFont, xQueryFontReply *pReply, int nProtoCCIStructs) { FontPropPtr pFP; int r, c, i; xFontProp *prFP; xCharInfo *prCI; xCharInfo *charInfos[256]; unsigned char chars[512]; int ninfos; unsigned long ncols; unsigned long count; /* pr->length set in dispatch */ pReply->minCharOrByte2 = pFont->info.firstCol; pReply->defaultChar = pFont->info.defaultCh; pReply->maxCharOrByte2 = pFont->info.lastCol; pReply->drawDirection = pFont->info.drawDirection; pReply->allCharsExist = pFont->info.allExist; pReply->minByte1 = pFont->info.firstRow; pReply->maxByte1 = pFont->info.lastRow; pReply->fontAscent = pFont->info.fontAscent; pReply->fontDescent = pFont->info.fontDescent; pReply->minBounds = pFont->info.ink_minbounds; pReply->maxBounds = pFont->info.ink_maxbounds; pReply->nFontProps = pFont->info.nprops; pReply->nCharInfos = nProtoCCIStructs; for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) (&pReply[1]); i < pFont->info.nprops; i++, pFP++, prFP++) { prFP->name = pFP->name; prFP->value = pFP->value; } ninfos = 0; ncols = (unsigned long) (pFont->info.lastCol - pFont->info.firstCol + 1); prCI = (xCharInfo *) (prFP); for (r = pFont->info.firstRow; ninfos < nProtoCCIStructs && r <= (int)pFont->info.lastRow; r++) { i = 0; for (c = pFont->info.firstCol; c <= (int)pFont->info.lastCol; c++) { chars[i++] = r; chars[i++] = c; } (*pFont->get_metrics) (pFont, ncols, chars, TwoD16Bit, &count, charInfos); i = 0; for (i = 0; i < (int) count && ninfos < nProtoCCIStructs; i++) { *prCI = *charInfos[i]; prCI++; ninfos++; } } return; } #ifndef NXAGENT_SERVER static Bool doListFontsAndAliases(ClientPtr client, LFclosurePtr c) { FontPathElementPtr fpe; int err = Successful; FontNamesPtr names = NULL; char *name, *resolved=NULL; int namelen, resolvedlen; int nnames; int stringLens; int i; xListFontsReply reply; char *bufptr; char *bufferStart; int aliascount = 0; if (client->clientGone) { if (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; #ifdef HAS_XFONT2 (*fpe_functions[fpe->type]->client_died) ((void *) client, fpe); #else (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); #endif /* HAS_XFONT2 */ } err = Successful; goto bail; } if (!c->current.patlen) goto finish; while (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; err = Successful; #ifdef HAS_XFONT2 if (!fpe_functions[fpe->type]->start_list_fonts_and_aliases) #else if (!fpe_functions[fpe->type].start_list_fonts_and_aliases) #endif /* HAS_XFONT2 */ { /* This FPE doesn't support/require list_fonts_and_aliases */ #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->list_fonts) #else err = (*fpe_functions[fpe->type].list_fonts) #endif /* HAS_XFONT2 */ ((void *) c->client, fpe, c->current.pattern, c->current.patlen, c->current.max_names - c->names->nnames, c->names); if (err == Suspended) { if (!c->slept) { c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)doListFontsAndAliases, (void *) c); } return TRUE; } err = BadFontName; } else { /* Start of list_fonts_and_aliases functionality. Modeled after list_fonts_with_info in that it resolves aliases, except that the information collected from FPEs is just names, not font info. Each list_next_font_or_alias() returns either a name into name/namelen or an alias into name/namelen and its target name into resolved/resolvedlen. The code at this level then resolves the alias by polling the FPEs. */ if (!c->current.list_started) { #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->start_list_fonts_and_aliases) #else err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases) #endif /* HAS_XFONT2 */ ((void *) c->client, fpe, c->current.pattern, c->current.patlen, c->current.max_names - c->names->nnames, &c->current.private); if (err == Suspended) { if (!c->slept) { ClientSleep(client, (ClientSleepProcPtr)doListFontsAndAliases, (void *) c); c->slept = TRUE; } return TRUE; } if (err == Successful) c->current.list_started = TRUE; } if (err == Successful) { char *tmpname; name = 0; #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->list_next_font_or_alias) #else err = (*fpe_functions[fpe->type].list_next_font_or_alias) #endif /* HAS_XFONT2 */ ((void *) c->client, fpe, &name, &namelen, &tmpname, &resolvedlen, c->current.private); if (err == Suspended) { if (!c->slept) { ClientSleep(client, (ClientSleepProcPtr)doListFontsAndAliases, (void *) c); c->slept = TRUE; } return TRUE; } if (err == FontNameAlias) { free(resolved); resolved = (char *) malloc(resolvedlen + 1); if (resolved) memmove(resolved, tmpname, resolvedlen + 1); } } if (err == Successful) { if (c->haveSaved) { if (c->savedName) #ifdef HAS_XFONT2 (void)xfont2_add_font_names_name(c->names, c->savedName, #else (void)AddFontNamesName(c->names, c->savedName, #endif /* HAS_XFONT2 */ c->savedNameLen); } else #ifdef HAS_XFONT2 (void)xfont2_add_font_names_name(c->names, name, namelen); #else (void)AddFontNamesName(c->names, name, namelen); #endif /* HAS_XFONT2 */ } /* * When we get an alias back, save our state and reset back to * the start of the FPE looking for the specified name. As * soon as a real font is found for the alias, pop back to the * old state */ else if (err == FontNameAlias) { char tmp_pattern[XLFDMAXFONTNAMELEN]; /* * when an alias recurses, we need to give * the last FPE a chance to clean up; so we call * it again, and assume that the error returned * is BadFontName, indicating the alias resolution * is complete. */ memmove(tmp_pattern, resolved, resolvedlen); if (c->haveSaved) { char *tmpname; int tmpnamelen; tmpname = 0; #ifdef HAS_XFONT2 (void) (*fpe_functions[fpe->type]->list_next_font_or_alias) #else (void) (*fpe_functions[fpe->type].list_next_font_or_alias) #endif /* HAS_XFONT2 */ ((void *) c->client, fpe, &tmpname, &tmpnamelen, &tmpname, &tmpnamelen, c->current.private); if (--aliascount <= 0) { err = BadFontName; goto ContBadFontName; } } else { c->saved = c->current; c->haveSaved = TRUE; free(c->savedName); c->savedName = (char *)malloc(namelen + 1); if (c->savedName) memmove(c->savedName, name, namelen + 1); c->savedNameLen = namelen; aliascount = 20; } memmove(c->current.pattern, tmp_pattern, resolvedlen); c->current.patlen = resolvedlen; c->current.max_names = c->names->nnames + 1; c->current.current_fpe = -1; c->current.private = 0; err = BadFontName; } } /* * At the end of this FPE, step to the next. If we've finished * processing an alias, pop state back. If we've collected enough * font names, quit. */ if (err == BadFontName) { ContBadFontName: ; c->current.list_started = FALSE; c->current.current_fpe++; err = Successful; if (c->haveSaved) { if (c->names->nnames == c->current.max_names || c->current.current_fpe == c->num_fpes) { c->haveSaved = FALSE; c->current = c->saved; /* Give the saved namelist a chance to clean itself up */ continue; } } if (c->names->nnames == c->current.max_names) break; } } /* * send the reply */ if (err != Successful) { SendErrorToClient(client, X_ListFonts, 0, 0, FontToXError(err)); goto bail; } finish: names = c->names; nnames = names->nnames; client = c->client; stringLens = 0; for (i = 0; i < nnames; i++) stringLens += (names->length[i] <= 255) ? names->length[i] : 0; memset(&reply, 0, sizeof(xListFontsReply)); reply.type = X_Reply; reply.length = (stringLens + nnames + 3) >> 2; reply.nFonts = nnames; reply.sequenceNumber = client->sequence; bufptr = bufferStart = (char *) malloc(reply.length << 2); if (!bufptr && reply.length) { SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc); goto bail; } /* * since WriteToClient long word aligns things, copy to temp buffer and * write all at once */ for (i = 0; i < nnames; i++) { if (names->length[i] > 255) reply.nFonts--; else { *bufptr++ = names->length[i]; memmove( bufptr, names->names[i], names->length[i]); bufptr += names->length[i]; } } nnames = reply.nFonts; reply.length = (stringLens + nnames + 3) >> 2; client->pSwapReplyFunc = ReplySwapVector[X_ListFonts]; WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply); WriteToClient(client, stringLens + nnames, bufferStart); free(bufferStart); bail: if (c->slept) ClientWakeup(client); for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); free(c->fpe_list); free(c->savedName); #ifdef HAS_XFONT2 xfont2_free_font_names(names); #else FreeFontNames(names); #endif /* HAS_XFONT2 */ free(c); free(resolved); return TRUE; } int ListFonts(ClientPtr client, unsigned char *pattern, unsigned length, unsigned max_names) { int i; LFclosurePtr c; /* * The right error to return here would be BadName, however the * specification does not allow for a Name error on this request. * Perhaps a better solution would be to return a nil list, i.e. * a list containing zero fontnames. */ if (length > XLFDMAXFONTNAMELEN) return BadAlloc; if (!(c = (LFclosurePtr) calloc(1, sizeof *c))) return BadAlloc; c->fpe_list = (FontPathElementPtr *) malloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { free(c); return BadAlloc; } #ifdef HAS_XFONT2 c->names = xfont2_make_font_names_record(max_names < 100 ? max_names : 100); #else c->names = MakeFontNamesRecord(max_names < 100 ? max_names : 100); #endif /* HAS_XFONT2 */ if (!c->names) { free(c->fpe_list); free(c); return BadAlloc; } memmove( c->current.pattern, pattern, length); for (i = 0; i < num_fpes; i++) { c->fpe_list[i] = font_path_elements[i]; UseFPE(c->fpe_list[i]); } c->client = client; c->num_fpes = num_fpes; c->current.patlen = length; c->current.current_fpe = 0; c->current.max_names = max_names; c->current.list_started = FALSE; c->current.private = 0; c->haveSaved = FALSE; c->slept = FALSE; c->savedName = 0; doListFontsAndAliases(client, c); return Success; } int doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) { FontPathElementPtr fpe; int err = Successful; char *name; int namelen; int numFonts; FontInfoRec fontInfo, *pFontInfo; xListFontsWithInfoReply *reply; int length; xFontProp *pFP; int i; int aliascount = 0; xListFontsWithInfoReply finalReply; if (client->clientGone) { if (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; #ifdef HAS_XFONT2 (*fpe_functions[fpe->type]->client_died) ((void *) client, fpe); #else (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); #endif /* HAS_XFONT2 */ } err = Successful; goto bail; } client->pSwapReplyFunc = ReplySwapVector[X_ListFontsWithInfo]; if (!c->current.patlen) goto finish; while (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; err = Successful; if (!c->current.list_started) { #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->start_list_fonts_with_info) #else err = (*fpe_functions[fpe->type].start_list_fonts_with_info) #endif /* HAS_XFONT2 */ (client, fpe, c->current.pattern, c->current.patlen, c->current.max_names, &c->current.private); if (err == Suspended) { if (!c->slept) { ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c); c->slept = TRUE; } return TRUE; } if (err == Successful) c->current.list_started = TRUE; } if (err == Successful) { name = 0; pFontInfo = &fontInfo; #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->list_next_font_with_info) #else err = (*fpe_functions[fpe->type].list_next_font_with_info) #endif /* HAS_XFONT2 */ (client, fpe, &name, &namelen, &pFontInfo, &numFonts, c->current.private); if (err == Suspended) { if (!c->slept) { ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c); c->slept = TRUE; } return TRUE; } } /* * When we get an alias back, save our state and reset back to the * start of the FPE looking for the specified name. As soon as a real * font is found for the alias, pop back to the old state */ if (err == FontNameAlias) { /* * when an alias recurses, we need to give * the last FPE a chance to clean up; so we call * it again, and assume that the error returned * is BadFontName, indicating the alias resolution * is complete. */ if (c->haveSaved) { char *tmpname; int tmpnamelen; FontInfoPtr tmpFontInfo; tmpname = 0; tmpFontInfo = &fontInfo; #ifdef HAS_XFONT2 (void) (*fpe_functions[fpe->type]->list_next_font_with_info) #else (void) (*fpe_functions[fpe->type].list_next_font_with_info) #endif /* HAS_XFONT2 */ (client, fpe, &tmpname, &tmpnamelen, &tmpFontInfo, &numFonts, c->current.private); if (--aliascount <= 0) { err = BadFontName; goto ContBadFontName; } } else { c->saved = c->current; c->haveSaved = TRUE; c->savedNumFonts = numFonts; free(c->savedName); c->savedName = (char *)malloc(namelen + 1); if (c->savedName) memmove(c->savedName, name, namelen + 1); aliascount = 20; } memmove(c->current.pattern, name, namelen); c->current.patlen = namelen; c->current.max_names = 1; c->current.current_fpe = 0; c->current.private = 0; c->current.list_started = FALSE; } /* * At the end of this FPE, step to the next. If we've finished * processing an alias, pop state back. If we've sent enough font * names, quit. Always wait for BadFontName to let the FPE * have a chance to clean up. */ else if (err == BadFontName) { ContBadFontName: ; c->current.list_started = FALSE; c->current.current_fpe++; err = Successful; if (c->haveSaved) { if (c->current.max_names == 0 || c->current.current_fpe == c->num_fpes) { c->haveSaved = FALSE; c->saved.max_names -= (1 - c->current.max_names); c->current = c->saved; } } else if (c->current.max_names == 0) break; } else if (err == Successful) { length = sizeof(*reply) + pFontInfo->nprops * sizeof(xFontProp); reply = c->reply; if (c->length < length) { reply = (xListFontsWithInfoReply *) realloc(c->reply, length); if (!reply) { err = AllocError; break; } memset(reply + c->length, 0, length - c->length); c->reply = reply; c->length = length; } if (c->haveSaved) { numFonts = c->savedNumFonts; name = c->savedName; namelen = strlen(name); } reply->type = X_Reply; reply->length = (sizeof *reply - sizeof(xGenericReply) + pFontInfo->nprops * sizeof(xFontProp) + namelen + 3) >> 2; reply->sequenceNumber = client->sequence; reply->nameLength = namelen; reply->minBounds = pFontInfo->ink_minbounds; reply->maxBounds = pFontInfo->ink_maxbounds; reply->minCharOrByte2 = pFontInfo->firstCol; reply->maxCharOrByte2 = pFontInfo->lastCol; reply->defaultChar = pFontInfo->defaultCh; reply->nFontProps = pFontInfo->nprops; reply->drawDirection = pFontInfo->drawDirection; reply->minByte1 = pFontInfo->firstRow; reply->maxByte1 = pFontInfo->lastRow; reply->allCharsExist = pFontInfo->allExist; reply->fontAscent = pFontInfo->fontAscent; reply->fontDescent = pFontInfo->fontDescent; reply->nReplies = numFonts; pFP = (xFontProp *) (reply + 1); for (i = 0; i < pFontInfo->nprops; i++) { pFP->name = pFontInfo->props[i].name; pFP->value = pFontInfo->props[i].value; pFP++; } WriteSwappedDataToClient(client, length, reply); WriteToClient(client, namelen, name); if (pFontInfo == &fontInfo) { free(fontInfo.props); free(fontInfo.isStringProp); } --c->current.max_names; } } finish: length = sizeof(xListFontsWithInfoReply); bzero((char *) &finalReply, sizeof(xListFontsWithInfoReply)); finalReply.type = X_Reply; finalReply.sequenceNumber = client->sequence; finalReply.length = (sizeof(xListFontsWithInfoReply) - sizeof(xGenericReply)) >> 2; WriteSwappedDataToClient(client, length, &finalReply); bail: if (c->slept) ClientWakeup(client); for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); free(c->reply); free(c->fpe_list); free(c->savedName); free(c); return TRUE; } #endif /* NXAGENT_SERVER */ int StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern, int max_names) { int i; LFWIclosurePtr c; /* * The right error to return here would be BadName, however the * specification does not allow for a Name error on this request. * Perhaps a better solution would be to return a nil list, i.e. * a list containing zero fontnames. */ if (length > XLFDMAXFONTNAMELEN) return BadAlloc; if (!(c = (LFWIclosurePtr) malloc(sizeof *c))) goto badAlloc; c->fpe_list = (FontPathElementPtr *) malloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { free(c); goto badAlloc; } memmove(c->current.pattern, pattern, length); for (i = 0; i < num_fpes; i++) { c->fpe_list[i] = font_path_elements[i]; UseFPE(c->fpe_list[i]); } c->client = client; c->num_fpes = num_fpes; c->reply = 0; c->length = 0; c->current.patlen = length; c->current.current_fpe = 0; c->current.max_names = max_names; c->current.list_started = FALSE; c->current.private = 0; c->savedNumFonts = 0; c->haveSaved = FALSE; c->slept = FALSE; c->savedName = 0; doListFontsWithInfo(client, c); return Success; badAlloc: return BadAlloc; } #define TextEltHeader 2 #define FontShiftSize 5 static XID clearGC[] = { CT_NONE }; #define clearGCmask (GCClipMask) int doPolyText(ClientPtr client, register PTclosurePtr c) { register FontPtr pFont = c->pGC->font, oldpFont; Font fid, oldfid; int err = Success, lgerr; /* err is in X error, not font error, space */ enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state = NEVER_SLEPT; FontPathElementPtr fpe; GC *origGC = NULL; if (client->clientGone) { fpe = c->pGC->font->fpe; #ifdef HAS_XFONT2 (*fpe_functions[fpe->type]->client_died) ((void *) client, fpe); #else (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); #endif /* HAS_XFONT2 */ if (c->slept) { /* Client has died, but we cannot bail out right now. We need to clean up after the work we did when going to sleep. Setting the drawable pointer to 0 makes this happen without any attempts to render or perform other unnecessary activities. */ c->pDraw = (DrawablePtr)0; } else { err = Success; goto bail; } } /* Make sure our drawable hasn't disappeared while we slept. */ if (c->slept && c->pDraw && c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did, RC_DRAWABLE, DixWriteAccess)) { /* Our drawable has disappeared. Treat like client died... ask the FPE code to clean up after client and avoid further rendering while we clean up after ourself. */ fpe = c->pGC->font->fpe; #ifdef HAS_XFONT2 (*fpe_functions[fpe->type]->client_died) ((void *) client, fpe); #else (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); #endif /* HAS_XFONT2 */ c->pDraw = (DrawablePtr)0; } client_state = c->slept ? SLEEPING : NEVER_SLEPT; while (c->endReq - c->pElt > TextEltHeader) { if (*c->pElt == FontChange) { if (c->endReq - c->pElt < FontShiftSize) { err = BadLength; goto bail; } oldpFont = pFont; oldfid = fid; fid = ((Font)*(c->pElt+4)) /* big-endian */ | ((Font)*(c->pElt+3)) << 8 | ((Font)*(c->pElt+2)) << 16 | ((Font)*(c->pElt+1)) << 24; pFont = (FontPtr)SecurityLookupIDByType(client, fid, RT_FONT, DixReadAccess); if (!pFont) { client->errorValue = fid; err = BadFont; /* restore pFont and fid for step 4 (described below) */ pFont = oldpFont; fid = oldfid; /* If we're in START_SLEEP mode, the following step shortens the request... in the unlikely event that the fid somehow becomes valid before we come through again to actually execute the polytext, which would then mess up our refcounting scheme badly. */ c->err = err; c->endReq = c->pElt; goto bail; } /* Step 3 (described below) on our new font */ if (client_state == START_SLEEP) pFont->refcnt++; else { if (pFont != c->pGC->font && c->pDraw) { ChangeGC( c->pGC, GCFont, &fid); ValidateGC(c->pDraw, c->pGC); if (c->reqType == X_PolyText8) c->polyText = (PolyTextPtr) c->pGC->ops->PolyText8; else c->polyText = (PolyTextPtr) c->pGC->ops->PolyText16; } /* Undo the refcnt++ we performed when going to sleep */ if (client_state == SLEEPING) (void)CloseFont(c->pGC->font, (Font)0); } c->pElt += FontShiftSize; } else /* print a string */ { unsigned char *pNextElt; pNextElt = c->pElt + TextEltHeader + (*c->pElt)*c->itemSize; if ( pNextElt > c->endReq) { err = BadLength; goto bail; } if (client_state == START_SLEEP) { c->pElt = pNextElt; continue; } if (c->pDraw) { lgerr = LoadGlyphs(client, c->pGC->font, *c->pElt, c->itemSize, c->pElt + TextEltHeader); } else lgerr = Successful; if (lgerr == Suspended) { if (!c->slept) { int len; GC *pGC; PTclosurePtr new_closure; /* We're putting the client to sleep. We need to do a few things to ensure successful and atomic-appearing execution of the remainder of the request. First, copy the remainder of the request into a safe malloc'd area. Second, create a scratch GC to use for the remainder of the request. Third, mark all fonts referenced in the remainder of the request to prevent their deallocation. Fourth, make the original GC look like the request has completed... set its font to the final font value from this request. These GC manipulations are for the unlikely (but possible) event that some other client is using the GC. Steps 3 and 4 are performed by running this procedure through the remainder of the request in a special no-render mode indicated by client_state = START_SLEEP. */ /* Step 1 */ /* Allocate a malloc'd closure structure to replace the local one we were passed */ new_closure = (PTclosurePtr) malloc(sizeof(PTclosureRec)); if (!new_closure) { err = BadAlloc; goto bail; } *new_closure = *c; c = new_closure; len = c->endReq - c->pElt; c->data = (unsigned char *)malloc(len); if (!c->data) { free(c); err = BadAlloc; goto bail; } memmove(c->data, c->pElt, len); c->pElt = c->data; c->endReq = c->pElt + len; /* Step 2 */ pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen); if (!pGC) { free(c->data); free(c); err = BadAlloc; goto bail; } #ifdef NXAGENT_SERVER pGC->tileIsPixel = TRUE; pGC->tile.pixel = 0; pGC->stipple = NullPixmap; #endif if ((err = CopyGC(c->pGC, pGC, GCFunction | GCPlaneMask | GCForeground | GCBackground | GCFillStyle | GCTile | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin | GCFont | GCSubwindowMode | GCClipXOrigin | GCClipYOrigin | GCClipMask)) != Success) { FreeScratchGC(pGC); free(c->data); free(c); err = BadAlloc; goto bail; } origGC = c->pGC; c->pGC = pGC; ValidateGC(c->pDraw, c->pGC); c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)doPolyText, (void *) c); /* Set up to perform steps 3 and 4 */ client_state = START_SLEEP; continue; /* on to steps 3 and 4 */ } return TRUE; } else if (lgerr != Successful) { err = FontToXError(lgerr); goto bail; } if (c->pDraw) { c->xorg += *((INT8 *)(c->pElt + 1)); /* must be signed */ c->xorg = (* c->polyText)(c->pDraw, c->pGC, c->xorg, c->yorg, *c->pElt, c->pElt + TextEltHeader); } c->pElt = pNextElt; } } bail: if (client_state == START_SLEEP) { /* Step 4 */ if (pFont != origGC->font) { ChangeGC(origGC, GCFont, &fid); ValidateGC(c->pDraw, origGC); } /* restore pElt pointer for execution of remainder of the request */ c->pElt = c->data; return TRUE; } if (c->err != Success) err = c->err; if (err != Success && c->client != serverClient) { #ifdef PANORAMIX if (noPanoramiXExtension || !c->pGC->pScreen->myNum) #endif SendErrorToClient(c->client, c->reqType, 0, 0, err); } if (c->slept) { ClientWakeup(c->client); ChangeGC(c->pGC, clearGCmask, clearGC); /* Unreference the font from the scratch GC */ CloseFont(c->pGC->font, (Font)0); c->pGC->font = NullFont; FreeScratchGC(c->pGC); free(c->data); free(c); } return TRUE; } int PolyText(ClientPtr client, DrawablePtr pDraw, GC *pGC, unsigned char *pElt, unsigned char *endReq, int xorg, int yorg, int reqType, XID did) { PTclosureRec local_closure; local_closure.pElt = pElt; local_closure.endReq = endReq; local_closure.client = client; local_closure.pDraw = pDraw; local_closure.xorg = xorg; local_closure.yorg = yorg; if ((local_closure.reqType = reqType) == X_PolyText8) { local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText8; local_closure.itemSize = 1; } else { local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText16; local_closure.itemSize = 2; } local_closure.pGC = pGC; local_closure.did = did; local_closure.err = Success; local_closure.slept = FALSE; (void) doPolyText(client, &local_closure); return Success; } #undef TextEltHeader #undef FontShiftSize int doImageText(ClientPtr client, register ITclosurePtr c) { int err = Success, lgerr; /* err is in X error, not font error, space */ FontPathElementPtr fpe; if (client->clientGone) { fpe = c->pGC->font->fpe; #ifdef HAS_XFONT2 (*fpe_functions[fpe->type]->client_died) ((void *) client, fpe); #else (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); #endif err = Success; goto bail; } /* Make sure our drawable hasn't disappeared while we slept. */ if (c->slept && c->pDraw && c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did, RC_DRAWABLE, DixWriteAccess)) { /* Our drawable has disappeared. Treat like client died... ask the FPE code to clean up after client. */ fpe = c->pGC->font->fpe; #ifdef HAS_XFONT2 (*fpe_functions[fpe->type]->client_died) ((void *) client, fpe); #else (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); #endif /* HAS_XFONT2 */ err = Success; goto bail; } lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, c->itemSize, c->data); if (lgerr == Suspended) { if (!c->slept) { GC *pGC; unsigned char *data; ITclosurePtr new_closure; ITclosurePtr old_closure; /* We're putting the client to sleep. We need to save some state. Similar problem to that handled in doPolyText, but much simpler because the request structure is much simpler. */ new_closure = (ITclosurePtr) malloc(sizeof(ITclosureRec)); if (!new_closure) { err = BadAlloc; goto bail; } old_closure = c; *new_closure = *c; c = new_closure; data = (unsigned char *)malloc(c->nChars * c->itemSize); if (!data) { free(c); c = old_closure; err = BadAlloc; goto bail; } memmove(data, c->data, c->nChars * c->itemSize); c->data = data; pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen); if (!pGC) { free(c->data); free(c); c = old_closure; err = BadAlloc; goto bail; } #ifdef NXAGENT_SERVER pGC->tileIsPixel = TRUE; pGC->tile.pixel = 0; pGC->stipple = NullPixmap; #endif if ((err = CopyGC(c->pGC, pGC, GCFunction | GCPlaneMask | GCForeground | GCBackground | GCFillStyle | GCTile | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin | GCFont | GCSubwindowMode | GCClipXOrigin | GCClipYOrigin | GCClipMask)) != Success) { FreeScratchGC(pGC); free(c->data); free(c); c = old_closure; err = BadAlloc; goto bail; } c->pGC = pGC; ValidateGC(c->pDraw, c->pGC); c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)doImageText, (void *) c); } return TRUE; } else if (lgerr != Successful) { err = FontToXError(lgerr); goto bail; } if (c->pDraw) { (* c->imageText)(c->pDraw, c->pGC, c->xorg, c->yorg, c->nChars, c->data); } bail: if (err != Success && c->client != serverClient) { SendErrorToClient(c->client, c->reqType, 0, 0, err); } if (c->slept) { ClientWakeup(c->client); ChangeGC(c->pGC, clearGCmask, clearGC); /* Unreference the font from the scratch GC */ CloseFont(c->pGC->font, (Font)0); c->pGC->font = NullFont; FreeScratchGC(c->pGC); free(c->data); free(c); } return TRUE; } int ImageText(ClientPtr client, DrawablePtr pDraw, GC *pGC, int nChars, unsigned char *data, int xorg, int yorg, int reqType, XID did) { ITclosureRec local_closure; local_closure.client = client; local_closure.pDraw = pDraw; local_closure.pGC = pGC; local_closure.nChars = nChars; local_closure.data = data; local_closure.xorg = xorg; local_closure.yorg = yorg; if ((local_closure.reqType = reqType) == X_ImageText8) { local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText8; local_closure.itemSize = 1; } else { local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText16; local_closure.itemSize = 2; } local_closure.did = did; local_closure.slept = FALSE; (void) doImageText(client, &local_closure); return Success; } /* does the necessary magic to figure out the fpe type */ static int DetermineFPEType(char *pathname) { int i; for (i = 0; i < num_fpe_types; i++) { #ifdef HAS_XFONT2 if ((*fpe_functions[i]->name_check) (pathname)) #else if ((*fpe_functions[i].name_check) (pathname)) #endif /* HAS_XFONT2 */ return i; } return -1; } static void FreeFontPath(FontPathElementPtr *list, int n, Bool force) { int i; for (i = 0; i < n; i++) { if (force) { /* Sanity check that all refcounts will be 0 by the time we get to the end of the list. */ int found = 1; /* the first reference is us */ int j; for (j = i+1; j < n; j++) { if (list[j] == list[i]) found++; } if (list[i]->refcount != found) { ErrorF("FreeFontPath: FPE \"%.*s\" refcount is %d, should be %d; fixing.\n", list[i]->name_length, list[i]->name, list[i]->refcount, found); list[i]->refcount = found; /* ensure it will get freed */ } } FreeFPE(list[i]); } free((char *) list); } static FontPathElementPtr find_existing_fpe(FontPathElementPtr *list, int num, unsigned char *name, int len) { FontPathElementPtr fpe; int i; for (i = 0; i < num; i++) { fpe = list[i]; if (fpe->name_length == len && memcmp(name, fpe->name, len) == 0) return fpe; } return (FontPathElementPtr) 0; } static int SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) { int i, err = 0; int valid_paths = 0; unsigned int len; unsigned char *cp = paths; FontPathElementPtr fpe = NULL, *fplist; fplist = (FontPathElementPtr *) malloc(sizeof(FontPathElementPtr) * npaths); if (!fplist) { *bad = 0; return BadAlloc; } for (i = 0; i < num_fpe_types; i++) { #ifdef HAS_XFONT2 if (fpe_functions[i]->set_path_hook) (*fpe_functions[i]->set_path_hook) (); #else if (fpe_functions[i].set_path_hook) (*fpe_functions[i].set_path_hook) (); #endif /* HAS_XFONT2 */ } for (i = 0; i < npaths; i++) { len = (unsigned int) (*cp++); if (len == 0) { if (persist) ErrorF ("Removing empty element from the valid list of fontpaths\n"); err = BadValue; } else { /* if it's already in our active list, just reset it */ /* * note that this can miss FPE's in limbo -- may be worth catching * them, though it'd muck up refcounting */ fpe = find_existing_fpe(font_path_elements, num_fpes, cp, len); if (fpe) { #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->reset_fpe) (fpe); #else err = (*fpe_functions[fpe->type].reset_fpe) (fpe); #endif /* HAS_XFONT2 */ if (err == Successful) { UseFPE(fpe);/* since it'll be decref'd later when freed * from the old list */ } else fpe = 0; } /* if error or can't do it, act like it's a new one */ if (!fpe) { fpe = (FontPathElementPtr) malloc(sizeof(FontPathElementRec)); if (!fpe) { err = BadAlloc; goto bail; } fpe->name = (char *) malloc(len + 1); if (!fpe->name) { free(fpe); err = BadAlloc; goto bail; } fpe->refcount = 1; strncpy(fpe->name, (char *) cp, (int) len); fpe->name[len] = '\0'; fpe->name_length = len; fpe->type = DetermineFPEType(fpe->name); if (fpe->type == -1) err = BadValue; else #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->init_fpe) (fpe); #else err = (*fpe_functions[fpe->type].init_fpe) (fpe); #endif /* HAS_XFONT2 */ if (err != Successful) { #ifndef NXAGENT_SERVER if (persist) { ErrorF("Could not init font path element %s, removing from list!\n", fpe->name); } #endif /* NXAGENT_SERVER */ free (fpe->name); free (fpe); } } } if (err != Successful) { if (!persist) goto bail; } else { fplist[valid_paths++] = fpe; } cp += len; } FreeFontPath(font_path_elements, num_fpes, FALSE); font_path_elements = fplist; if (patternCache) #ifdef HAS_XFONT2 xfont2_empty_font_pattern_cache(patternCache); #else EmptyFontPatternCache(patternCache); #endif /* HAS_XFONT2 */ num_fpes = valid_paths; return Success; bail: *bad = i; while (--valid_paths >= 0) FreeFPE(fplist[valid_paths]); free(fplist); return FontToXError(err); } int SetFontPath(ClientPtr client, int npaths, unsigned char *paths) { int err = Success; if (npaths == 0) { if (SetDefaultFontPath(defaultFontPath) != Success) return BadValue; } else { int bad; err = SetFontPathElements(npaths, paths, &bad, FALSE); client->errorValue = bad; } return err; } #ifndef NXAGENT_SERVER int SetDefaultFontPath(char *path) { char *temp_path, *start, *end; unsigned char *cp, *pp, *nump, *newpath; int num = 1, len, err, size = 0, bad; /* ensure temp_path contains "built-ins" */ start = path; while (1) { start = strstr(start, "built-ins"); if (start == NULL) break; end = start + strlen("built-ins"); if ((start == path || start[-1] == ',') && (!*end || *end == ',')) break; start = end; } if (!start) { if (asprintf(&temp_path, "%s%sbuilt-ins", path, *path ? "," : "") == -1) temp_path = NULL; } else { temp_path = strdup(path); } if (!temp_path) return BadAlloc; /* get enough for string, plus values -- use up commas */ len = strlen(temp_path) + 1; nump = cp = newpath = (unsigned char *) malloc(len); if (!newpath) { free(temp_path); return BadAlloc; } pp = (unsigned char *) temp_path; cp++; while (*pp) { if (*pp == ',') { *nump = (unsigned char) size; nump = cp++; pp++; num++; size = 0; } else { *cp++ = *pp++; size++; } } *nump = (unsigned char) size; err = SetFontPathElements(num, newpath, &bad, TRUE); free(newpath); free(temp_path); return err; } #endif /* NXAGENT_SERVER */ unsigned char * GetFontPath(int *count, int *length) { int i; unsigned char *c; int len; FontPathElementPtr fpe; len = 0; for (i = 0; i < num_fpes; i++) { fpe = font_path_elements[i]; len += fpe->name_length + 1; } c = realloc(font_path_string, len); if (c == NULL) { free(font_path_string); font_path_string = NULL; return NULL; } font_path_string = c; *length = 0; for (i = 0; i < num_fpes; i++) { fpe = font_path_elements[i]; *c = fpe->name_length; *length += *c++; memmove(c, fpe->name, fpe->name_length); c += fpe->name_length; } *count = num_fpes; return font_path_string; } int LoadGlyphs(ClientPtr client, FontPtr pfont, unsigned nchars, int item_size, unsigned char *data) { #ifdef HAS_XFONT2 if (fpe_functions[pfont->fpe->type]->load_glyphs) return (*fpe_functions[pfont->fpe->type]->load_glyphs) #else if (fpe_functions[pfont->fpe->type].load_glyphs) return (*fpe_functions[pfont->fpe->type].load_glyphs) #endif (client, pfont, 0, nchars, item_size, data); else return Successful; } void #ifdef HAS_XFONT2 GetGlyphs(FontPtr font, unsigned long count, unsigned char *chars, FontEncoding fontEncoding, unsigned long *glyphcount, /* RETURN */ CharInfoPtr *glyphs) /* RETURN */ #else dixGetGlyphs(FontPtr font, unsigned long count, unsigned char *chars, FontEncoding fontEncoding, unsigned long *glyphcount, /* RETURN */ CharInfoPtr *glyphs) /* RETURN */ #endif /* HAS_XFONT2 */ { (*font->get_glyphs) (font, count, chars, fontEncoding, glyphcount, glyphs); } void DeleteClientFontStuff(ClientPtr client) { int i; FontPathElementPtr fpe; for (i = 0; i < num_fpes; i++) { fpe = font_path_elements[i]; #ifdef HAS_XFONT2 if (fpe_functions[fpe->type]->client_died) (*fpe_functions[fpe->type]->client_died) ((void *) client, fpe); #else if (fpe_functions[fpe->type].client_died) (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); #endif /* HAS_XFONT2 */ } } #ifdef HAS_XFONT2 static int register_fpe_funcs(const xfont2_fpe_funcs_rec *funcs) { xfont2_fpe_funcs_rec const **new; /* grow the list */ new = reallocarray(fpe_functions, num_fpe_types + 1, sizeof(xfont2_fpe_funcs_ptr)); if (!new) return -1; fpe_functions = new; fpe_functions[num_fpe_types] = funcs; return num_fpe_types++; } #else void InitFonts () { patternCache = MakeFontPatternCache(); ResetFontPrivateIndex(); #ifdef LEGACY_XFONT1 BuiltinRegisterFpeFunctions(); FontFileRegisterFpeFunctions(); fs_register_fpe_functions(); #else register_fpe_functions(); #endif } #endif /* HAS_XFONT2 */ #ifdef HAS_XFONT2 static unsigned long get_server_generation(void) { return serverGeneration; } static void * get_server_client(void) { return serverClient; } static int get_default_point_size(void) #else int GetDefaultPointSize () #endif /* HAS_XFONT2 */ { return 120; } #ifdef HAS_XFONT2 static FontResolutionPtr get_client_resolutions(int *num) #else FontResolutionPtr GetClientResolutions (int *num) #endif /* HAS_XFONT2 */ { static struct _FontResolution res; ScreenPtr pScreen; pScreen = screenInfo.screens[0]; res.x_resolution = (pScreen->width * 25.4) / pScreen->mmWidth; /* * XXX - we'll want this as long as bitmap instances are prevalent so that we can match them from scalable fonts */ if (res.x_resolution < 88) res.x_resolution = 75; else res.x_resolution = 100; res.y_resolution = (pScreen->height * 25.4) / pScreen->mmHeight; if (res.y_resolution < 88) res.y_resolution = 75; else res.y_resolution = 100; res.point_size = 120; *num = 1; return &res; } #ifndef HAS_XFONT2 /* * returns the type index of the new fpe * * should be called (only once!) by each type of fpe when initialized */ int RegisterFPEFunctions(NameCheckFunc name_func, InitFpeFunc init_func, FreeFpeFunc free_func, ResetFpeFunc reset_func, OpenFontFunc open_func, CloseFontFunc close_func, ListFontsFunc list_func, StartLfwiFunc start_lfwi_func, NextLfwiFunc next_lfwi_func, WakeupFpeFunc wakeup_func, ClientDiedFunc client_died, LoadGlyphsFunc load_glyphs, StartLaFunc start_list_alias_func, NextLaFunc next_list_alias_func, SetPathFunc set_path_func) { FPEFunctions *new; /* grow the list */ new = (FPEFunctions *) realloc(fpe_functions, (num_fpe_types + 1) * sizeof(FPEFunctions)); if (!new) return -1; fpe_functions = new; fpe_functions[num_fpe_types].name_check = name_func; fpe_functions[num_fpe_types].open_font = open_func; fpe_functions[num_fpe_types].close_font = close_func; fpe_functions[num_fpe_types].wakeup_fpe = wakeup_func; fpe_functions[num_fpe_types].list_fonts = list_func; fpe_functions[num_fpe_types].start_list_fonts_with_info = start_lfwi_func; fpe_functions[num_fpe_types].list_next_font_with_info = next_lfwi_func; fpe_functions[num_fpe_types].init_fpe = init_func; fpe_functions[num_fpe_types].free_fpe = free_func; fpe_functions[num_fpe_types].reset_fpe = reset_func; fpe_functions[num_fpe_types].client_died = client_died; fpe_functions[num_fpe_types].load_glyphs = load_glyphs; fpe_functions[num_fpe_types].start_list_fonts_and_aliases = start_list_alias_func; fpe_functions[num_fpe_types].list_next_font_or_alias = next_list_alias_func; fpe_functions[num_fpe_types].set_path_hook = set_path_func; return num_fpe_types++; } #endif /* !HAS_XFONT2 */ void FreeFonts() { if (patternCache) { #ifdef HAS_XFONT2 xfont2_free_font_pattern_cache(patternCache); #else FreeFontPatternCache(patternCache); #endif /* HAS_XFONT2 */ patternCache = 0; } FreeFontPath(font_path_elements, num_fpes, TRUE); font_path_elements = 0; num_fpes = 0; free(fpe_functions); num_fpe_types = 0; #ifdef HAS_XFONT2 fpe_functions = NULL; #else fpe_functions = (FPEFunctions *) 0; #endif /* HAS_XFONT2 */ } /* convenience functions for FS interface */ #ifdef HAS_XFONT2 static #endif /* HAS_XFONT2 */ FontPtr find_old_font(XID id) { return (FontPtr) SecurityLookupIDByType(NullClient, id, RT_NONE, DixUnknownAccess); } #ifdef HAS_XFONT2 static Font get_new_font_client_id(void) #else Font GetNewFontClientID() #endif /* HAS_XFONT2 */ { return FakeClientID(0); } #ifdef HAS_XFONT2 static int store_font_Client_font(FontPtr pfont, Font id) #else int StoreFontClientFont(FontPtr pfont, Font id) #endif /* HAS_XFONT2 */ { return AddResource(id, RT_NONE, (void *) pfont); } #ifdef HAS_XFONT2 static void delete_font_client_id(Font id) #else void DeleteFontClientID(Font id) #endif /* HAS_XFONT2 */ { FreeResource(id, RT_NONE); } #ifdef HAS_XFONT2 static int _client_auth_generation(ClientPtr client) #else int client_auth_generation(ClientPtr client) #endif /* HAS_XFONT2 */ { return 0; } static int fs_handlers_installed = 0; static unsigned int last_server_gen; #ifdef HAS_XFONT2 static void fs_block_handler(void *blockData, OSTimePtr timeout, void *readmask) { FontBlockHandlerProcPtr block_handler = blockData; (*block_handler)(timeout); } struct fs_fd_entry { struct xorg_list entry; int fd; void *data; FontFdHandlerProcPtr handler; }; static void fs_fd_handler(int fd, int ready, void *data) { struct fs_fd_entry *entry = data; entry->handler(fd, entry->data); } static struct xorg_list fs_fd_list; static int add_fs_fd(int fd, FontFdHandlerProcPtr handler, void *data) { struct fs_fd_entry *entry = calloc(1, sizeof (struct fs_fd_entry)); if (!entry) return FALSE; entry->fd = fd; entry->data = data; entry->handler = handler; if (!SetNotifyFd(fd, fs_fd_handler, X_NOTIFY_READ, entry)) { free(entry); return FALSE; } xorg_list_add(&entry->entry, &fs_fd_list); return TRUE; } static void remove_fs_fd(int fd) { struct fs_fd_entry *entry, *temp; xorg_list_for_each_entry_safe(entry, temp, &fs_fd_list, entry) { if (entry->fd == fd) { xorg_list_del(&entry->entry); free(entry); break; } } RemoveNotifyFd(fd); } static void adjust_fs_wait_for_delay(void *wt, unsigned long newdelay) { AdjustWaitForDelay(wt, newdelay); } static int _init_fs_handlers(FontPathElementPtr fpe, FontBlockHandlerProcPtr block_handler) #else int init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler) #endif /* HAS_XFONT2 */ { /* if server has reset, make sure the b&w handlers are reinstalled */ if (last_server_gen < serverGeneration) { last_server_gen = serverGeneration; fs_handlers_installed = 0; } if (fs_handlers_installed == 0) { #ifdef DEBUG fprintf(stderr, "adding FS b & w handlers\n"); #endif #ifdef HAS_XFONT2 if (!RegisterBlockAndWakeupHandlers(fs_block_handler, FontWakeup, (void *) block_handler)) #else if (!RegisterBlockAndWakeupHandlers(block_handler, FontWakeup, (void *) 0)) #endif /* HAS_XFONT2 */ return AllocError; #ifdef HAS_XFONT2 xorg_list_init(&fs_fd_list); #endif /* HAS_XFONT2 */ fs_handlers_installed++; } QueueFontWakeup(fpe); return Successful; } #ifdef HAS_XFONT2 static void _remove_fs_handlers(FontPathElementPtr fpe, FontBlockHandlerProcPtr block_handler, Bool all) #else void remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler, Bool all) #endif /* HAS_XFONT2 */ { if (all) { /* remove the handlers if no one else is using them */ if (--fs_handlers_installed == 0) { #ifdef DEBUG fprintf(stderr, "removing FS b & w handlers\n"); #endif #ifdef HAS_XFONT2 RemoveBlockAndWakeupHandlers(fs_block_handler, FontWakeup, (void *) block_handler); #else RemoveBlockAndWakeupHandlers(block_handler, FontWakeup, (void *) 0); #endif /* HAS_XFONT2 */ } } RemoveFontWakeup(fpe); } #ifdef HAS_XFONT2 static const xfont2_client_funcs_rec xfont2_client_funcs = { .version = XFONT2_CLIENT_FUNCS_VERSION, .client_auth_generation = _client_auth_generation, .client_signal = ClientSignal, .delete_font_client_id = delete_font_client_id, .verrorf = VErrorF, .find_old_font = find_old_font, .get_client_resolutions = get_client_resolutions, .get_default_point_size = get_default_point_size, .get_new_font_client_id = get_new_font_client_id, .get_time_in_millis = GetTimeInMillis, .init_fs_handlers = _init_fs_handlers, .register_fpe_funcs = register_fpe_funcs, .remove_fs_handlers = _remove_fs_handlers, .get_server_client = get_server_client, .set_font_authorizations = set_font_authorizations, .store_font_client_font = store_font_Client_font, .make_atom = MakeAtom, .valid_atom = ValidAtom, .name_for_atom = NameForAtom, .get_server_generation = get_server_generation, .add_fs_fd = add_fs_fd, .remove_fs_fd = remove_fs_fd, .adjust_fs_wait_for_delay = adjust_fs_wait_for_delay, }; xfont2_pattern_cache_ptr fontPatternCache; void InitFonts(void) { if (fontPatternCache) xfont2_free_font_pattern_cache(fontPatternCache); fontPatternCache = xfont2_make_font_pattern_cache(); xfont2_init(&xfont2_client_funcs); } #endif /* HAS_XFONT2 */ #ifdef DEBUG #define GLWIDTHBYTESPADDED(bits,nbytes) \ ((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \ :(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \ :(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \ :(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \ : 0) #define GLYPH_SIZE(ch, nbytes) \ GLWIDTHBYTESPADDED((ch)->metrics.rightSideBearing - \ (ch)->metrics.leftSideBearing, (nbytes)) void dump_char_ascii(CharInfoPtr cip) { int r, l; int bpr; int byte; static unsigned maskTab[] = { (1 << 7), (1 << 6), (1 << 5), (1 << 4), (1 << 3), (1 << 2), (1 << 1), (1 << 0), }; bpr = GLYPH_SIZE(cip, 4); for (r = 0; r < (cip->metrics.ascent + cip->metrics.descent); r++) { void * row = (void *) cip->bits + r * bpr; byte = 0; for (l = 0; l <= (cip->metrics.rightSideBearing - cip->metrics.leftSideBearing); l++) { if (maskTab[l & 7] & (((int*)row)[l >> 3])) putchar('X'); else putchar('.'); } putchar('\n'); } } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/dixutils.c0000644000000000000000000005366113614532331017403 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* (c)Copyright 1988,1991 Adobe Systems Incorporated. All rights reserved. Permission to use, copy, modify, distribute, and sublicense this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notices appear in all copies and that both those copyright notices and this permission notice appear in supporting documentation and that the name of Adobe Systems Incorporated not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. No trademark license to use the Adobe trademarks is hereby granted. If the Adobe trademark "Display PostScript"(tm) is used to describe this software, its functionality or for any other purpose, such use shall be limited to a statement that this software works in conjunction with the Display PostScript system. Proper trademark attribution to reflect Adobe's ownership of the trademark shall be given whenever any such reference to the Display PostScript system is made. ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE. Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems Incorporated which may be registered in certain jurisdictions. Author: Adobe Systems Incorporated */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "windowstr.h" #include "dixstruct.h" #include "pixmapstr.h" #include "scrnintstr.h" #define XK_LATIN1 #include #ifdef XCSECURITY #define _SECURITY_SERVER #include #endif /* * CompareTimeStamps returns -1, 0, or +1 depending on if the first * argument is less than, equal to or greater than the second argument. */ int CompareTimeStamps(TimeStamp a, TimeStamp b) { if (a.months < b.months) return EARLIER; if (a.months > b.months) return LATER; if (a.milliseconds < b.milliseconds) return EARLIER; if (a.milliseconds > b.milliseconds) return LATER; return SAMETIME; } /* * convert client times to server TimeStamps */ #define HALFMONTH ((unsigned long) 1<<31) TimeStamp ClientTimeToServerTime(CARD32 c) { TimeStamp ts; if (c == CurrentTime) return currentTime; ts.months = currentTime.months; ts.milliseconds = c; if (c > currentTime.milliseconds) { if (((unsigned long) c - currentTime.milliseconds) > HALFMONTH) ts.months -= 1; } else if (c < currentTime.milliseconds) { if (((unsigned long)currentTime.milliseconds - c) > HALFMONTH) ts.months += 1; } return ts; } /* * ISO Latin-1 case conversion routine * * this routine always null-terminates the result, so * beware of too-small buffers */ static unsigned char ISOLatin1ToLower (unsigned char source) { unsigned char dest; if ((source >= XK_A) && (source <= XK_Z)) dest = source + (XK_a - XK_A); else if ((source >= XK_Agrave) && (source <= XK_Odiaeresis)) dest = source + (XK_agrave - XK_Agrave); else if ((source >= XK_Ooblique) && (source <= XK_Thorn)) dest = source + (XK_oslash - XK_Ooblique); else dest = source; return dest; } void CopyISOLatin1Lowered(char *dest, const char *source, int length) { register int i; for (i = 0; i < length; i++, source++, dest++) *dest = ISOLatin1ToLower (*source); *dest = '\0'; } int CompareISOLatin1Lowered(unsigned char *s1, int s1len, unsigned char *s2, int s2len) { unsigned char c1, c2; for (;;) { /* note -- compare against zero so that -1 ignores len */ c1 = s1len-- ? *s1++ : '\0'; c2 = s2len-- ? *s2++ : '\0'; if (!c1 || (c1 != c2 && (c1 = ISOLatin1ToLower (c1)) != (c2 = ISOLatin1ToLower (c2)))) break; } return (int) c1 - (int) c2; } #ifdef XCSECURITY /* SecurityLookupWindow and SecurityLookupDrawable: * Look up the window/drawable taking into account the client doing * the lookup and the type of access desired. Return the window/drawable * if it exists and the client is allowed access, else return NULL. * Most Proc* functions should be calling these instead of * LookupWindow and LookupDrawable, which do no access checks. */ WindowPtr SecurityLookupWindow(XID rid, ClientPtr client, Mask access_mode) { client->errorValue = rid; if(rid == INVALID) return NULL; return (WindowPtr)SecurityLookupIDByType(client, rid, RT_WINDOW, access_mode); } void * SecurityLookupDrawable(XID rid, ClientPtr client, Mask access_mode) { register DrawablePtr pDraw; if(rid == INVALID) return (void *) NULL; pDraw = (DrawablePtr)SecurityLookupIDByClass(client, rid, RC_DRAWABLE, access_mode); if ((client->trustLevel != XSecurityClientTrusted) || (pDraw && (pDraw->type != UNDRAWABLE_WINDOW))) return (void *)pDraw; return (void *)NULL; } /* We can't replace the LookupWindow and LookupDrawable functions with * macros because of compatibility with loadable servers. */ WindowPtr LookupWindow(XID rid, ClientPtr client) { return SecurityLookupWindow(rid, client, DixUnknownAccess); } void * LookupDrawable(XID rid, ClientPtr client) { return SecurityLookupDrawable(rid, client, DixUnknownAccess); } #else /* not XCSECURITY */ WindowPtr LookupWindow(XID rid, ClientPtr client) { WindowPtr pWin; client->errorValue = rid; if(rid == INVALID) return NULL; return (WindowPtr)LookupIDByType(rid, RT_WINDOW); } void * LookupDrawable(XID rid, ClientPtr client) { register DrawablePtr pDraw; if(rid == INVALID) return (void *) NULL; pDraw = (DrawablePtr)LookupIDByClass(rid, RC_DRAWABLE); if (pDraw && (pDraw->type != UNDRAWABLE_WINDOW)) return (void *)pDraw; return (void *)NULL; } #endif /* XCSECURITY */ ClientPtr LookupClient(XID rid, ClientPtr client) { void * pRes = (void *)SecurityLookupIDByClass(client, rid, RC_ANY, DixReadAccess); int clientIndex = CLIENT_ID(rid); if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) { return clients[clientIndex]; } return (ClientPtr)NULL; } int AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode, Bool toRoot, Bool remap) { int numnow; SaveSetElt *pTmp = NULL; int j; numnow = client->numSaved; j = 0; if (numnow) { pTmp = client->saveSet; while ((j < numnow) && (SaveSetWindow(pTmp[j]) != (void *)pWin)) j++; } if (mode == SetModeInsert) { if (j < numnow) /* duplicate */ return(Success); numnow++; pTmp = (SaveSetElt *)realloc(client->saveSet, sizeof(*pTmp) * numnow); if (!pTmp) return(BadAlloc); client->saveSet = pTmp; client->numSaved = numnow; SaveSetAssignWindow(client->saveSet[numnow - 1], pWin); SaveSetAssignToRoot(client->saveSet[numnow - 1], toRoot); SaveSetAssignRemap(client->saveSet[numnow - 1], remap); return(Success); } else if ((mode == SetModeDelete) && (j < numnow)) { while (j < numnow-1) { pTmp[j] = pTmp[j+1]; j++; } numnow--; if (numnow) { pTmp = (SaveSetElt *)realloc(client->saveSet, sizeof(*pTmp) * numnow); if (pTmp) client->saveSet = pTmp; } else { free(client->saveSet); client->saveSet = (SaveSetElt *)NULL; } client->numSaved = numnow; return(Success); } return(Success); } void DeleteWindowFromAnySaveSet(WindowPtr pWin) { register int i; register ClientPtr client; for (i = 0; i< currentMaxClients; i++) { client = clients[i]; if (client && client->numSaved) (void)AlterSaveSetForClient(client, pWin, SetModeDelete, FALSE, TRUE); } } /* No-op Don't Do Anything : sometimes we need to be able to call a procedure * that doesn't do anything. For example, on screen with only static * colormaps, if someone calls install colormap, it's easier to have a dummy * procedure to call than to check if there's a procedure */ void NoopDDA(void) { } typedef struct _BlockHandler { BlockHandlerProcPtr BlockHandler; WakeupHandlerProcPtr WakeupHandler; void * blockData; Bool deleted; } BlockHandlerRec, *BlockHandlerPtr; static BlockHandlerPtr handlers; static int numHandlers; static int sizeHandlers; static Bool inHandler; static Bool handlerDeleted; /** * * \param pTimeout DIX doesn't want to know how OS represents time * \param pReadMask nor how it represents the det of descriptors */ void BlockHandler(void * pTimeout, void * pReadmask) { register int i, j; ++inHandler; for (i = 0; i < screenInfo.numScreens; i++) (* screenInfo.screens[i]->BlockHandler)(i, screenInfo.screens[i]->blockData, pTimeout, pReadmask); for (i = 0; i < numHandlers; i++) (*handlers[i].BlockHandler) (handlers[i].blockData, pTimeout, pReadmask); if (handlerDeleted) { for (i = 0; i < numHandlers;) if (handlers[i].deleted) { for (j = i; j < numHandlers - 1; j++) handlers[j] = handlers[j+1]; numHandlers--; } else i++; handlerDeleted = FALSE; } --inHandler; } /** * * \param result 32 bits of undefined result from the wait * \param pReadmask the resulting descriptor mask */ void WakeupHandler(int result, void * pReadmask) { register int i, j; ++inHandler; for (i = numHandlers - 1; i >= 0; i--) (*handlers[i].WakeupHandler) (handlers[i].blockData, result, pReadmask); for (i = 0; i < screenInfo.numScreens; i++) (* screenInfo.screens[i]->WakeupHandler)(i, screenInfo.screens[i]->wakeupData, result, pReadmask); if (handlerDeleted) { for (i = 0; i < numHandlers;) if (handlers[i].deleted) { for (j = i; j < numHandlers - 1; j++) handlers[j] = handlers[j+1]; numHandlers--; } else i++; handlerDeleted = FALSE; } --inHandler; } /** * Reentrant with BlockHandler and WakeupHandler, except wakeup won't * get called until next time */ Bool RegisterBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler, WakeupHandlerProcPtr wakeupHandler, void * blockData) { BlockHandlerPtr new; if (numHandlers >= sizeHandlers) { new = (BlockHandlerPtr) realloc (handlers, (numHandlers + 1) * sizeof (BlockHandlerRec)); if (!new) return FALSE; handlers = new; sizeHandlers = numHandlers + 1; } handlers[numHandlers].BlockHandler = blockHandler; handlers[numHandlers].WakeupHandler = wakeupHandler; handlers[numHandlers].blockData = blockData; handlers[numHandlers].deleted = FALSE; numHandlers = numHandlers + 1; return TRUE; } void RemoveBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler, WakeupHandlerProcPtr wakeupHandler, void * blockData) { int i; for (i = 0; i < numHandlers; i++) if (handlers[i].BlockHandler == blockHandler && handlers[i].WakeupHandler == wakeupHandler && handlers[i].blockData == blockData) { if (inHandler) { handlerDeleted = TRUE; handlers[i].deleted = TRUE; } else { for (; i < numHandlers - 1; i++) handlers[i] = handlers[i+1]; numHandlers--; } break; } } void InitBlockAndWakeupHandlers () { free (handlers); handlers = (BlockHandlerPtr) 0; numHandlers = 0; sizeHandlers = 0; } /* * A general work queue. Perform some task before the server * sleeps for input. */ WorkQueuePtr workQueue; static WorkQueuePtr *workQueueLast = &workQueue; void ProcessWorkQueue(void) { WorkQueuePtr q, *p; p = &workQueue; /* * Scan the work queue once, calling each function. Those * which return TRUE are removed from the queue, otherwise * they will be called again. This must be reentrant with * QueueWorkProc. */ while ((q = *p)) { if ((*q->function) (q->client, q->closure)) { /* remove q from the list */ *p = q->next; /* don't fetch until after func called */ free (q); } else { p = &q->next; /* don't fetch until after func called */ } } workQueueLast = p; } void ProcessWorkQueueZombies(void) { WorkQueuePtr q, *p; p = &workQueue; while ((q = *p)) { if (q->client && q->client->clientGone) { (void) (*q->function) (q->client, q->closure); /* remove q from the list */ *p = q->next; /* don't fetch until after func called */ free (q); } else { p = &q->next; /* don't fetch until after func called */ } } workQueueLast = p; } Bool QueueWorkProc ( Bool (*function)(ClientPtr /* pClient */, void * /* closure */), ClientPtr client, void * closure) { WorkQueuePtr q; q = (WorkQueuePtr) malloc (sizeof *q); if (!q) return FALSE; q->function = function; q->client = client; q->closure = closure; q->next = NULL; *workQueueLast = q; workQueueLast = &q->next; return TRUE; } /* * Manage a queue of sleeping clients, awakening them * when requested, by using the OS functions IgnoreClient * and AttendClient. Note that this *ignores* the troubles * with request data interleaving itself with events, but * we'll leave that until a later time. */ typedef struct _SleepQueue { struct _SleepQueue *next; ClientPtr client; ClientSleepProcPtr function; void * closure; } SleepQueueRec, *SleepQueuePtr; static SleepQueuePtr sleepQueue = NULL; Bool ClientSleep (ClientPtr client, ClientSleepProcPtr function, void * closure) { SleepQueuePtr q; q = (SleepQueuePtr) malloc (sizeof *q); if (!q) return FALSE; IgnoreClient (client); q->next = sleepQueue; q->client = client; q->function = function; q->closure = closure; sleepQueue = q; return TRUE; } Bool ClientSignal (ClientPtr client) { SleepQueuePtr q; for (q = sleepQueue; q; q = q->next) if (q->client == client) { return QueueWorkProc (q->function, q->client, q->closure); } return FALSE; } void ClientWakeup (ClientPtr client) { SleepQueuePtr q, *prev; prev = &sleepQueue; while ( (q = *prev) ) { if (q->client == client) { *prev = q->next; free (q); if (client->clientGone) /* Oops -- new zombie cleanup code ensures this only * happens from inside CloseDownClient; don't want to * recurse here... */ /* CloseDownClient(client) */; else AttendClient (client); break; } prev = &q->next; } } Bool ClientIsAsleep (ClientPtr client) { SleepQueuePtr q; for (q = sleepQueue; q; q = q->next) if (q->client == client) return TRUE; return FALSE; } /* * Generic Callback Manager */ /* ===== Private Procedures ===== */ static int numCallbackListsToCleanup = 0; static CallbackListPtr **listsToCleanup = NULL; static Bool _AddCallback( CallbackListPtr *pcbl, CallbackProcPtr callback, void *data) { CallbackPtr cbr; cbr = (CallbackPtr) malloc(sizeof(CallbackRec)); if (!cbr) return FALSE; cbr->proc = callback; cbr->data = data; cbr->next = (*pcbl)->list; cbr->deleted = FALSE; (*pcbl)->list = cbr; return TRUE; } static Bool _DeleteCallback( CallbackListPtr *pcbl, CallbackProcPtr callback, void *data) { CallbackListPtr cbl = *pcbl; CallbackPtr cbr, pcbr; for (pcbr = NULL, cbr = cbl->list; cbr != NULL; pcbr = cbr, cbr = cbr->next) { if ((cbr->proc == callback) && (cbr->data == data)) break; } if (cbr != NULL) { if (cbl->inCallback) { ++(cbl->numDeleted); cbr->deleted = TRUE; } else { if (pcbr == NULL) cbl->list = cbr->next; else pcbr->next = cbr->next; free(cbr); } return TRUE; } return FALSE; } static void _CallCallbacks( CallbackListPtr *pcbl, void *call_data) { CallbackListPtr cbl = *pcbl; CallbackPtr cbr, pcbr; ++(cbl->inCallback); for (cbr = cbl->list; cbr != NULL; cbr = cbr->next) { (*(cbr->proc)) (pcbl, cbr->data, call_data); } --(cbl->inCallback); if (cbl->inCallback) return; /* Was the entire list marked for deletion? */ if (cbl->deleted) { DeleteCallbackList(pcbl); return; } /* Were some individual callbacks on the list marked for deletion? * If so, do the deletions. */ if (cbl->numDeleted) { for (pcbr = NULL, cbr = cbl->list; (cbr != NULL) && cbl->numDeleted; ) { if (cbr->deleted) { if (pcbr) { cbr = cbr->next; free(pcbr->next); pcbr->next = cbr; } else { cbr = cbr->next; free(cbl->list); cbl->list = cbr; } cbl->numDeleted--; } else /* this one wasn't deleted */ { pcbr = cbr; cbr = cbr->next; } } } } static void _DeleteCallbackList( CallbackListPtr *pcbl) { CallbackListPtr cbl = *pcbl; CallbackPtr cbr, nextcbr; int i; if (cbl->inCallback) { cbl->deleted = TRUE; return; } for (i = 0; i < numCallbackListsToCleanup; i++) { if ((listsToCleanup[i] = pcbl) != 0) { listsToCleanup[i] = NULL; break; } } for (cbr = cbl->list; cbr != NULL; cbr = nextcbr) { nextcbr = cbr->next; free(cbr); } free(cbl); *pcbl = NULL; } static CallbackFuncsRec default_cbfuncs = { _AddCallback, _DeleteCallback, _CallCallbacks, _DeleteCallbackList }; /* ===== Public Procedures ===== */ Bool CreateCallbackList(CallbackListPtr *pcbl, CallbackFuncsPtr cbfuncs) { CallbackListPtr cbl; int i; if (!pcbl) return FALSE; cbl = (CallbackListPtr) malloc(sizeof(CallbackListRec)); if (!cbl) return FALSE; cbl->funcs = cbfuncs ? *cbfuncs : default_cbfuncs; cbl->inCallback = 0; cbl->deleted = FALSE; cbl->numDeleted = 0; cbl->list = NULL; *pcbl = cbl; for (i = 0; i < numCallbackListsToCleanup; i++) { if (!listsToCleanup[i]) { listsToCleanup[i] = pcbl; return TRUE; } } listsToCleanup = (CallbackListPtr **)xnfrealloc(listsToCleanup, sizeof(CallbackListPtr *) * (numCallbackListsToCleanup+1)); listsToCleanup[numCallbackListsToCleanup] = pcbl; numCallbackListsToCleanup++; return TRUE; } Bool AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void * data) { if (!pcbl) return FALSE; if (!*pcbl) { /* list hasn't been created yet; go create it */ if (!CreateCallbackList(pcbl, (CallbackFuncsPtr)NULL)) return FALSE; } return ((*(*pcbl)->funcs.AddCallback) (pcbl, callback, data)); } Bool DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void * data) { if (!pcbl || !*pcbl) return FALSE; return ((*(*pcbl)->funcs.DeleteCallback) (pcbl, callback, data)); } void CallCallbacks(CallbackListPtr *pcbl, void * call_data) { if (!pcbl || !*pcbl) return; (*(*pcbl)->funcs.CallCallbacks) (pcbl, call_data); } void DeleteCallbackList(CallbackListPtr *pcbl) { if (!pcbl || !*pcbl) return; (*(*pcbl)->funcs.DeleteCallbackList) (pcbl); } void InitCallbackManager() { int i; for (i = 0; i < numCallbackListsToCleanup; i++) { DeleteCallbackList(listsToCleanup[i]); } if (listsToCleanup) free(listsToCleanup); numCallbackListsToCleanup = 0; listsToCleanup = NULL; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/events.c0000644000000000000000000035554213614532331017045 0ustar /************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* The panoramix components contained the following notice */ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /***************************************************************** Copyright 2003-2005 Sun Microsystems, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "misc.h" #include "resource.h" #include #include "windowstr.h" #include "inputstr.h" #include "scrnintstr.h" #include "cursorstr.h" #include "dixstruct.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #endif #include "globals.h" #ifdef XKB #include "xkbsrv.h" extern Bool XkbFilterEvents(ClientPtr, int, xEvent *); #endif #ifdef XCSECURITY #define _SECURITY_SERVER #include #endif #include #include "exevents.h" #include "extnsionst.h" #include "dixevents.h" #include "dixgrabs.h" #include "dispatch.h" #define EXTENSION_EVENT_BASE 64 #define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */ #define StructureAndSubMask ( StructureNotifyMask | SubstructureNotifyMask ) #define AllButtonsMask ( \ Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) #define MotionMask ( \ PointerMotionMask | Button1MotionMask | \ Button2MotionMask | Button3MotionMask | Button4MotionMask | \ Button5MotionMask | ButtonMotionMask ) #define PropagateMask ( \ KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \ MotionMask ) #define PointerGrabMask ( \ ButtonPressMask | ButtonReleaseMask | \ EnterWindowMask | LeaveWindowMask | \ PointerMotionHintMask | KeymapStateMask | \ MotionMask ) #define AllModifiersMask ( \ ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \ Mod3Mask | Mod4Mask | Mod5Mask ) #define AllEventMasks (lastEventMask|(lastEventMask-1)) /* * The following relies on the fact that the ButtonMotionMasks are equal * to the corresponding ButtonMasks from the current modifier/button state. */ #define Motion_Filter(class) (PointerMotionMask | \ (class)->state | (class)->motionMask) #define WID(w) ((w) ? ((w)->drawable.id) : 0) #define XE_KBPTR (xE->u.keyButtonPointer) #define rClient(obj) (clients[CLIENT_ID((obj)->resource)]) CallbackListPtr EventCallback; CallbackListPtr DeviceEventCallback; #define DNPMCOUNT 8 Mask DontPropagateMasks[DNPMCOUNT]; static int DontPropagateRefCnts[DNPMCOUNT]; #ifdef DEBUG static debug_events = 0; #endif InputInfo inputInfo; static struct { QdEventPtr pending, *pendtail; DeviceIntPtr replayDev; /* kludgy rock to put flag for */ WindowPtr replayWin; /* ComputeFreezes */ Bool playingEvents; TimeStamp time; } syncEvents; /* * The window trace information is used to avoid having to compute all the * windows between the root and the current pointer window each time a button * or key goes down. The grabs on each of those windows must be checked. */ static WindowPtr *spriteTrace = (WindowPtr *)NULL; #define ROOT spriteTrace[0] static int spriteTraceSize = 0; static int spriteTraceGood; static struct { CursorPtr current; BoxRec hotLimits; /* logical constraints of hot spot */ Bool confined; /* confined to screen */ #if defined(SHAPE) || defined(PANORAMIX) RegionPtr hotShape; /* additional logical shape constraint */ #endif BoxRec physLimits; /* physical constraints of hot spot */ WindowPtr win; /* window of logical position */ HotSpot hot; /* logical pointer position */ HotSpot hotPhys; /* physical pointer position */ #ifdef PANORAMIX ScreenPtr screen; /* all others are in Screen 0 coordinates */ RegionRec Reg1; /* Region 1 for confining motion */ RegionRec Reg2; /* Region 2 for confining virtual motion */ WindowPtr windows[MAXSCREENS]; WindowPtr confineWin; /* confine window */ #endif } sprite; /* info about the cursor sprite */ static void DoEnterLeaveEvents( WindowPtr fromWin, WindowPtr toWin, int mode ); static WindowPtr XYToWindow( int x, int y ); static Bool CheckMotion(xEvent *xE); extern int lastEvent; static Mask lastEventMask; #ifdef XINPUT extern int DeviceMotionNotify; #endif #define CantBeFiltered NoEventMask static Mask filters[128] = { NoSuchEvent, /* 0 */ NoSuchEvent, /* 1 */ KeyPressMask, /* KeyPress */ KeyReleaseMask, /* KeyRelease */ ButtonPressMask, /* ButtonPress */ ButtonReleaseMask, /* ButtonRelease */ PointerMotionMask, /* MotionNotify (initial state) */ EnterWindowMask, /* EnterNotify */ LeaveWindowMask, /* LeaveNotify */ FocusChangeMask, /* FocusIn */ FocusChangeMask, /* FocusOut */ KeymapStateMask, /* KeymapNotify */ ExposureMask, /* Expose */ CantBeFiltered, /* GraphicsExpose */ CantBeFiltered, /* NoExpose */ VisibilityChangeMask, /* VisibilityNotify */ SubstructureNotifyMask, /* CreateNotify */ StructureAndSubMask, /* DestroyNotify */ StructureAndSubMask, /* UnmapNotify */ StructureAndSubMask, /* MapNotify */ SubstructureRedirectMask, /* MapRequest */ StructureAndSubMask, /* ReparentNotify */ StructureAndSubMask, /* ConfigureNotify */ SubstructureRedirectMask, /* ConfigureRequest */ StructureAndSubMask, /* GravityNotify */ ResizeRedirectMask, /* ResizeRequest */ StructureAndSubMask, /* CirculateNotify */ SubstructureRedirectMask, /* CirculateRequest */ PropertyChangeMask, /* PropertyNotify */ CantBeFiltered, /* SelectionClear */ CantBeFiltered, /* SelectionRequest */ CantBeFiltered, /* SelectionNotify */ ColormapChangeMask, /* ColormapNotify */ CantBeFiltered, /* ClientMessage */ CantBeFiltered /* MappingNotify */ }; static CARD8 criticalEvents[32] = { 0x7c /* key and button events */ }; #ifdef PANORAMIX static void ConfineToShape(RegionPtr shape, int *px, int *py); static void SyntheticMotion(int x, int y); static void PostNewCursor(void); static Bool XineramaSetCursorPosition( int x, int y, Bool generateEvent ){ ScreenPtr pScreen; BoxRec box; int i; /* x,y are in Screen 0 coordinates. We need to decide what Screen to send the message too and what the coordinates relative to that screen are. */ pScreen = sprite.screen; x += panoramiXdataPtr[0].x; y += panoramiXdataPtr[0].y; if(!RegionContainsPoint(&XineramaScreenRegions[pScreen->myNum], x, y, &box)) { FOR_NSCREENS(i) { if(i == pScreen->myNum) continue; if(RegionContainsPoint(&XineramaScreenRegions[i], x, y, &box)) { pScreen = screenInfo.screens[i]; break; } } } sprite.screen = pScreen; sprite.hotPhys.x = x - panoramiXdataPtr[0].x; sprite.hotPhys.y = y - panoramiXdataPtr[0].y; x -= panoramiXdataPtr[pScreen->myNum].x; y -= panoramiXdataPtr[pScreen->myNum].y; return (*pScreen->SetCursorPosition)(pScreen, x, y, generateEvent); } static void XineramaConstrainCursor(void) { ScreenPtr pScreen = sprite.screen; BoxRec newBox = sprite.physLimits; /* Translate the constraining box to the screen the sprite is actually on */ newBox.x1 += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x; newBox.x2 += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x; newBox.y1 += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y; newBox.y2 += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y; (* pScreen->ConstrainCursor)(pScreen, &newBox); } static void XineramaCheckPhysLimits( CursorPtr cursor, Bool generateEvents ){ HotSpot new; if (!cursor) return; new = sprite.hotPhys; /* I don't care what the DDX has to say about it */ sprite.physLimits = sprite.hotLimits; /* constrain the pointer to those limits */ if (new.x < sprite.physLimits.x1) new.x = sprite.physLimits.x1; else if (new.x >= sprite.physLimits.x2) new.x = sprite.physLimits.x2 - 1; if (new.y < sprite.physLimits.y1) new.y = sprite.physLimits.y1; else if (new.y >= sprite.physLimits.y2) new.y = sprite.physLimits.y2 - 1; if (sprite.hotShape) /* more work if the shape is a mess */ ConfineToShape(sprite.hotShape, &new.x, &new.y); if((new.x != sprite.hotPhys.x) || (new.y != sprite.hotPhys.y)) { XineramaSetCursorPosition (new.x, new.y, generateEvents); if (!generateEvents) SyntheticMotion(new.x, new.y); } /* Tell DDX what the limits are */ XineramaConstrainCursor(); } static Bool XineramaSetWindowPntrs(WindowPtr pWin) { if(pWin == screenInfo.screens[0]->root) { int i; for (i = 0; i < PanoramiXNumScreens; i++) sprite.windows[i] = screenInfo.screens[i]->root; } else { PanoramiXRes *win; int i; win = (PanoramiXRes*)LookupIDByType(pWin->drawable.id, XRT_WINDOW); if(!win) return FALSE; for(i = 0; i < PanoramiXNumScreens; i++) { sprite.windows[i] = LookupIDByType(win->info[i].id, RT_WINDOW); if(!sprite.windows[i]) /* window is being unmapped */ return FALSE; } } return TRUE; } static void XineramaCheckVirtualMotion( QdEventPtr qe, WindowPtr pWin ){ if (qe) { sprite.hot.pScreen = qe->pScreen; /* should always be Screen 0 */ sprite.hot.x = qe->event->u.keyButtonPointer.rootX; sprite.hot.y = qe->event->u.keyButtonPointer.rootY; pWin = inputInfo.pointer->grab ? inputInfo.pointer->grab->confineTo : NullWindow; } if (pWin) { int x, y, off_x, off_y, i; BoxRec lims; if(!XineramaSetWindowPntrs(pWin)) return; i = PanoramiXNumScreens - 1; RegionCopy(&sprite.Reg2, &sprite.windows[i]->borderSize); off_x = panoramiXdataPtr[i].x; off_y = panoramiXdataPtr[i].y; while(i--) { x = off_x - panoramiXdataPtr[i].x; y = off_y - panoramiXdataPtr[i].y; if(x || y) RegionTranslate(&sprite.Reg2, x, y); RegionUnion(&sprite.Reg2, &sprite.Reg2, &sprite.windows[i]->borderSize); off_x = panoramiXdataPtr[i].x; off_y = panoramiXdataPtr[i].y; } lims = *RegionExtents(&sprite.Reg2); if (sprite.hot.x < lims.x1) sprite.hot.x = lims.x1; else if (sprite.hot.x >= lims.x2) sprite.hot.x = lims.x2 - 1; if (sprite.hot.y < lims.y1) sprite.hot.y = lims.y1; else if (sprite.hot.y >= lims.y2) sprite.hot.y = lims.y2 - 1; if (RegionNumRects(&sprite.Reg2) > 1) ConfineToShape(&sprite.Reg2, &sprite.hot.x, &sprite.hot.y); if (qe) { qe->pScreen = sprite.hot.pScreen; qe->event->u.keyButtonPointer.rootX = sprite.hot.x; qe->event->u.keyButtonPointer.rootY = sprite.hot.y; } } } static Bool XineramaCheckMotion(xEvent *xE) { WindowPtr prevSpriteWin = sprite.win; if (xE && !syncEvents.playingEvents) { /* Motion events entering DIX get translated to Screen 0 coordinates. Replayed events have already been translated since they've entered DIX before */ XE_KBPTR.rootX += panoramiXdataPtr[sprite.screen->myNum].x - panoramiXdataPtr[0].x; XE_KBPTR.rootY += panoramiXdataPtr[sprite.screen->myNum].y - panoramiXdataPtr[0].y; sprite.hot.x = XE_KBPTR.rootX; sprite.hot.y = XE_KBPTR.rootY; if (sprite.hot.x < sprite.physLimits.x1) sprite.hot.x = sprite.physLimits.x1; else if (sprite.hot.x >= sprite.physLimits.x2) sprite.hot.x = sprite.physLimits.x2 - 1; if (sprite.hot.y < sprite.physLimits.y1) sprite.hot.y = sprite.physLimits.y1; else if (sprite.hot.y >= sprite.physLimits.y2) sprite.hot.y = sprite.physLimits.y2 - 1; if (sprite.hotShape) ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y); sprite.hotPhys = sprite.hot; if ((sprite.hotPhys.x != XE_KBPTR.rootX) || (sprite.hotPhys.y != XE_KBPTR.rootY)) { XineramaSetCursorPosition( sprite.hotPhys.x, sprite.hotPhys.y, FALSE); } XE_KBPTR.rootX = sprite.hot.x; XE_KBPTR.rootY = sprite.hot.y; } sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y); if (sprite.win != prevSpriteWin) { if (prevSpriteWin != NullWindow) { if (!xE) UpdateCurrentTimeIf(); DoEnterLeaveEvents(prevSpriteWin, sprite.win, NotifyNormal); } PostNewCursor(); return FALSE; } return TRUE; } static void XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents) { if (syncEvents.playingEvents) { XineramaCheckVirtualMotion((QdEventPtr)NULL, pWin); SyntheticMotion(sprite.hot.x, sprite.hot.y); } else { int x, y, off_x, off_y, i; if(!XineramaSetWindowPntrs(pWin)) return; i = PanoramiXNumScreens - 1; RegionCopy(&sprite.Reg1, &sprite.windows[i]->borderSize); off_x = panoramiXdataPtr[i].x; off_y = panoramiXdataPtr[i].y; while(i--) { x = off_x - panoramiXdataPtr[i].x; y = off_y - panoramiXdataPtr[i].y; if(x || y) RegionTranslate(&sprite.Reg1, x, y); RegionUnion(&sprite.Reg1, &sprite.Reg1, &sprite.windows[i]->borderSize); off_x = panoramiXdataPtr[i].x; off_y = panoramiXdataPtr[i].y; } sprite.hotLimits = *RegionExtents(&sprite.Reg1); if(RegionNumRects(&sprite.Reg1) > 1) sprite.hotShape = &sprite.Reg1; else sprite.hotShape = NullRegion; sprite.confined = FALSE; sprite.confineWin = (pWin == screenInfo.screens[0]->root) ? NullWindow : pWin; XineramaCheckPhysLimits(sprite.current, generateEvents); } } static void XineramaChangeToCursor(CursorPtr cursor) { if (cursor != sprite.current) { if ((sprite.current->bits->xhot != cursor->bits->xhot) || (sprite.current->bits->yhot != cursor->bits->yhot)) XineramaCheckPhysLimits(cursor, FALSE); (*sprite.screen->DisplayCursor)(sprite.screen, cursor); FreeCursor(sprite.current, (Cursor)0); sprite.current = cursor; sprite.current->refcnt++; } } #endif /* PANORAMIX */ void SetMaskForEvent(Mask mask, int event) { if ((event < LASTEvent) || (event >= 128)) FatalError("SetMaskForEvent: bogus event number"); filters[event] = mask; } void SetCriticalEvent(int event) { if (event >= 128) FatalError("SetCriticalEvent: bogus event number"); criticalEvents[event >> 3] |= 1 << (event & 7); } static void SyntheticMotion(int x, int y) { xEvent xE; #ifdef PANORAMIX /* Translate back to the sprite screen since processInputProc will translate from sprite screen to screen 0 upon reentry to the DIX layer */ if(!noPanoramiXExtension) { x += panoramiXdataPtr[0].x - panoramiXdataPtr[sprite.screen->myNum].x; y += panoramiXdataPtr[0].y - panoramiXdataPtr[sprite.screen->myNum].y; } #endif memset(&xE, 0, sizeof(xEvent)); xE.u.keyButtonPointer.rootX = x; xE.u.keyButtonPointer.rootY = y; if (syncEvents.playingEvents) xE.u.keyButtonPointer.time = syncEvents.time.milliseconds; else xE.u.keyButtonPointer.time = currentTime.milliseconds; xE.u.u.type = MotionNotify; (*inputInfo.pointer->public.processInputProc)(&xE, inputInfo.pointer, 1); } #ifdef SHAPE static void ConfineToShape(RegionPtr shape, int *px, int *py) { BoxRec box; int x = *px, y = *py; int incx = 1, incy = 1; if (RegionContainsPoint(shape, x, y, &box)) return; box = *RegionExtents(shape); /* this is rather crude */ do { x += incx; if (x >= box.x2) { incx = -1; x = *px - 1; } else if (x < box.x1) { incx = 1; x = *px; y += incy; if (y >= box.y2) { incy = -1; y = *py - 1; } else if (y < box.y1) return; /* should never get here! */ } } while (!RegionContainsPoint(shape, x, y, &box)); *px = x; *py = y; } #endif static void CheckPhysLimits( CursorPtr cursor, Bool generateEvents, Bool confineToScreen, ScreenPtr pScreen) { HotSpot new; if (!cursor) return; new = sprite.hotPhys; if (pScreen) new.pScreen = pScreen; else pScreen = new.pScreen; (*pScreen->CursorLimits) (pScreen, cursor, &sprite.hotLimits, &sprite.physLimits); sprite.confined = confineToScreen; (* pScreen->ConstrainCursor)(pScreen, &sprite.physLimits); if (new.x < sprite.physLimits.x1) new.x = sprite.physLimits.x1; else if (new.x >= sprite.physLimits.x2) new.x = sprite.physLimits.x2 - 1; if (new.y < sprite.physLimits.y1) new.y = sprite.physLimits.y1; else if (new.y >= sprite.physLimits.y2) new.y = sprite.physLimits.y2 - 1; #ifdef SHAPE if (sprite.hotShape) ConfineToShape(sprite.hotShape, &new.x, &new.y); #endif if ((pScreen != sprite.hotPhys.pScreen) || (new.x != sprite.hotPhys.x) || (new.y != sprite.hotPhys.y)) { if (pScreen != sprite.hotPhys.pScreen) sprite.hotPhys = new; (*pScreen->SetCursorPosition) (pScreen, new.x, new.y, generateEvents); if (!generateEvents) SyntheticMotion(new.x, new.y); } } static void CheckVirtualMotion( register QdEventPtr qe, register WindowPtr pWin) { #ifdef PANORAMIX if(!noPanoramiXExtension) { XineramaCheckVirtualMotion(qe, pWin); return; } #endif if (qe) { sprite.hot.pScreen = qe->pScreen; sprite.hot.x = qe->event->u.keyButtonPointer.rootX; sprite.hot.y = qe->event->u.keyButtonPointer.rootY; pWin = inputInfo.pointer->grab ? inputInfo.pointer->grab->confineTo : NullWindow; } if (pWin) { BoxRec lims; if (sprite.hot.pScreen != pWin->drawable.pScreen) { sprite.hot.pScreen = pWin->drawable.pScreen; sprite.hot.x = sprite.hot.y = 0; } lims = *RegionExtents(&pWin->borderSize); if (sprite.hot.x < lims.x1) sprite.hot.x = lims.x1; else if (sprite.hot.x >= lims.x2) sprite.hot.x = lims.x2 - 1; if (sprite.hot.y < lims.y1) sprite.hot.y = lims.y1; else if (sprite.hot.y >= lims.y2) sprite.hot.y = lims.y2 - 1; #ifdef SHAPE if (wBoundingShape(pWin)) ConfineToShape(&pWin->borderSize, &sprite.hot.x, &sprite.hot.y); #endif if (qe) { qe->pScreen = sprite.hot.pScreen; qe->event->u.keyButtonPointer.rootX = sprite.hot.x; qe->event->u.keyButtonPointer.rootY = sprite.hot.y; } } ROOT = sprite.hot.pScreen->root; } static void ConfineCursorToWindow(WindowPtr pWin, Bool generateEvents, Bool confineToScreen) { ScreenPtr pScreen = pWin->drawable.pScreen; #ifdef PANORAMIX if(!noPanoramiXExtension) { XineramaConfineCursorToWindow(pWin, generateEvents); return; } #endif if (syncEvents.playingEvents) { CheckVirtualMotion((QdEventPtr)NULL, pWin); SyntheticMotion(sprite.hot.x, sprite.hot.y); } else { sprite.hotLimits = *RegionExtents(&pWin->borderSize); #ifdef SHAPE sprite.hotShape = wBoundingShape(pWin) ? &pWin->borderSize : NullRegion; #endif CheckPhysLimits(sprite.current, generateEvents, confineToScreen, pScreen); } } Bool PointerConfinedToScreen() { return sprite.confined; } static void ChangeToCursor(CursorPtr cursor) { #ifdef PANORAMIX if(!noPanoramiXExtension) { XineramaChangeToCursor(cursor); return; } #endif if (cursor != sprite.current) { if ((sprite.current->bits->xhot != cursor->bits->xhot) || (sprite.current->bits->yhot != cursor->bits->yhot)) CheckPhysLimits(cursor, FALSE, sprite.confined, (ScreenPtr)NULL); (*sprite.hotPhys.pScreen->DisplayCursor) (sprite.hotPhys.pScreen, cursor); FreeCursor(sprite.current, (Cursor)0); sprite.current = cursor; sprite.current->refcnt++; } } /* returns true if b is a descendent of a */ Bool IsParent(register WindowPtr a, register WindowPtr b) { for (b = b->parent; b; b = b->parent) if (b == a) return TRUE; return FALSE; } static void PostNewCursor(void) { register WindowPtr win; register GrabPtr grab = inputInfo.pointer->grab; if (syncEvents.playingEvents) return; if (grab) { if (grab->cursor) { ChangeToCursor(grab->cursor); return; } if (IsParent(grab->window, sprite.win)) win = sprite.win; else win = grab->window; } else win = sprite.win; for (; win; win = win->parent) if (win->optional && win->optional->cursor != NullCursor) { ChangeToCursor(win->optional->cursor); return; } } WindowPtr GetCurrentRootWindow() { return ROOT; } WindowPtr GetSpriteWindow() { return sprite.win; } CursorPtr GetSpriteCursor() { return sprite.current; } void GetSpritePosition(int *px, int *py) { *px = sprite.hotPhys.x; *py = sprite.hotPhys.y; } #ifdef PANORAMIX int XineramaGetCursorScreen() { if(!noPanoramiXExtension) { return sprite.screen->myNum; } else { return 0; } } #endif /* PANORAMIX */ #define TIMESLOP (5 * 60 * 1000) /* 5 minutes */ static void MonthChangedOrBadTime(register xEvent *xE) { /* If the ddx/OS is careless about not processing timestamped events from * different sources in sorted order, then it's possible for time to go * backwards when it should not. Here we ensure a decent time. */ if ((currentTime.milliseconds - XE_KBPTR.time) > TIMESLOP) currentTime.months++; else XE_KBPTR.time = currentTime.milliseconds; } #define NoticeTime(xE) { \ if ((xE)->u.keyButtonPointer.time < currentTime.milliseconds) \ MonthChangedOrBadTime(xE); \ currentTime.milliseconds = (xE)->u.keyButtonPointer.time; \ lastDeviceEventTime = currentTime; } void NoticeEventTime(register xEvent *xE) { if (!syncEvents.playingEvents) NoticeTime(xE); } /************************************************************************** * The following procedures deal with synchronous events * **************************************************************************/ void EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count) { register QdEventPtr tail = *syncEvents.pendtail; register QdEventPtr qe; xEvent *qxE; NoticeTime(xE); #ifdef XKB /* Fix for key repeating bug. */ if (device->key != NULL && device->key->xkbInfo != NULL && xE->u.u.type == KeyRelease) AccessXCancelRepeatKey(device->key->xkbInfo, xE->u.u.detail); #endif if (DeviceEventCallback) { DeviceEventInfoRec eventinfo; /* The RECORD spec says that the root window field of motion events * must be valid. At this point, it hasn't been filled in yet, so * we do it here. The long expression below is necessary to get * the current root window; the apparently reasonable alternative * GetCurrentRootWindow()->drawable.id doesn't give you the right * answer on the first motion event after a screen change because * the data that GetCurrentRootWindow relies on hasn't been * updated yet. */ if (xE->u.u.type == MotionNotify) XE_KBPTR.root = sprite.hotPhys.pScreen->root->drawable.id; eventinfo.events = xE; eventinfo.count = count; CallCallbacks(&DeviceEventCallback, (void *)&eventinfo); } if (xE->u.u.type == MotionNotify) { #ifdef PANORAMIX if(!noPanoramiXExtension) { XE_KBPTR.rootX += panoramiXdataPtr[sprite.screen->myNum].x - panoramiXdataPtr[0].x; XE_KBPTR.rootY += panoramiXdataPtr[sprite.screen->myNum].y - panoramiXdataPtr[0].y; } #endif sprite.hotPhys.x = XE_KBPTR.rootX; sprite.hotPhys.y = XE_KBPTR.rootY; /* do motion compression */ if (tail && (tail->event->u.u.type == MotionNotify) && (tail->pScreen == sprite.hotPhys.pScreen)) { tail->event->u.keyButtonPointer.rootX = sprite.hotPhys.x; tail->event->u.keyButtonPointer.rootY = sprite.hotPhys.y; tail->event->u.keyButtonPointer.time = XE_KBPTR.time; tail->months = currentTime.months; return; } } qe = (QdEventPtr)calloc(1, sizeof(QdEventRec) + (count * sizeof(xEvent))); if (!qe) return; qe->next = (QdEventPtr)NULL; qe->device = device; qe->pScreen = sprite.hotPhys.pScreen; qe->months = currentTime.months; qe->event = (xEvent *)(qe + 1); qe->evcount = count; for (qxE = qe->event; --count >= 0; qxE++, xE++) *qxE = *xE; if (tail) syncEvents.pendtail = &tail->next; *syncEvents.pendtail = qe; } static void PlayReleasedEvents(void) { register QdEventPtr *prev, qe; register DeviceIntPtr dev; prev = &syncEvents.pending; while ( (qe = *prev) ) { if (!qe->device->sync.frozen) { *prev = qe->next; if (*syncEvents.pendtail == *prev) syncEvents.pendtail = prev; if (qe->event->u.u.type == MotionNotify) CheckVirtualMotion(qe, NullWindow); syncEvents.time.months = qe->months; syncEvents.time.milliseconds = qe->event->u.keyButtonPointer.time; #ifdef PANORAMIX /* Translate back to the sprite screen since processInputProc will translate from sprite screen to screen 0 upon reentry to the DIX layer */ if(!noPanoramiXExtension) { qe->event->u.keyButtonPointer.rootX += panoramiXdataPtr[0].x - panoramiXdataPtr[sprite.screen->myNum].x; qe->event->u.keyButtonPointer.rootY += panoramiXdataPtr[0].y - panoramiXdataPtr[sprite.screen->myNum].y; } #endif (*qe->device->public.processInputProc)(qe->event, qe->device, qe->evcount); free(qe); for (dev = inputInfo.devices; dev && dev->sync.frozen; dev = dev->next) ; if (!dev) break; /* Playing the event may have unfrozen another device. */ /* So to play it safe, restart at the head of the queue */ prev = &syncEvents.pending; } else prev = &qe->next; } } static void FreezeThaw(register DeviceIntPtr dev, Bool frozen) { dev->sync.frozen = frozen; if (frozen) dev->public.processInputProc = dev->public.enqueueInputProc; else dev->public.processInputProc = dev->public.realInputProc; } void ComputeFreezes() { register DeviceIntPtr replayDev = syncEvents.replayDev; register int i; WindowPtr w; register xEvent *xE; int count; GrabPtr grab; register DeviceIntPtr dev; for (dev = inputInfo.devices; dev; dev = dev->next) FreezeThaw(dev, dev->sync.other || (dev->sync.state >= FROZEN)); if (syncEvents.playingEvents || (!replayDev && !syncEvents.pending)) return; syncEvents.playingEvents = TRUE; if (replayDev) { xE = replayDev->sync.event; count = replayDev->sync.evcount; syncEvents.replayDev = (DeviceIntPtr)NULL; w = XYToWindow( XE_KBPTR.rootX, XE_KBPTR.rootY); for (i = 0; i < spriteTraceGood; i++) { if (syncEvents.replayWin == spriteTrace[i]) { if (!CheckDeviceGrabs(replayDev, xE, i+1, count)) { if (replayDev->focus) DeliverFocusedEvent(replayDev, xE, w, count); else DeliverDeviceEvents(w, xE, NullGrab, NullWindow, replayDev, count); } goto playmore; } } /* must not still be in the same stack */ if (replayDev->focus) DeliverFocusedEvent(replayDev, xE, w, count); else DeliverDeviceEvents(w, xE, NullGrab, NullWindow, replayDev, count); } playmore: for (dev = inputInfo.devices; dev; dev = dev->next) { if (!dev->sync.frozen) { PlayReleasedEvents(); break; } } syncEvents.playingEvents = FALSE; /* the following may have been skipped during replay, so do it now */ if ((grab = inputInfo.pointer->grab) && grab->confineTo) { if (grab->confineTo->drawable.pScreen != sprite.hotPhys.pScreen) sprite.hotPhys.x = sprite.hotPhys.y = 0; ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); } else ConfineCursorToWindow(sprite.hotPhys.pScreen->root, TRUE, FALSE); PostNewCursor(); } #ifdef RANDR void ScreenRestructured (ScreenPtr pScreen) { GrabPtr grab; if ((grab = inputInfo.pointer->grab) && grab->confineTo) { if (grab->confineTo->drawable.pScreen != sprite.hotPhys.pScreen) sprite.hotPhys.x = sprite.hotPhys.y = 0; ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); } else ConfineCursorToWindow(sprite.hotPhys.pScreen->root, TRUE, FALSE); } #endif void CheckGrabForSyncs(register DeviceIntPtr thisDev, Bool thisMode, Bool otherMode) { register GrabPtr grab = thisDev->grab; register DeviceIntPtr dev; if (thisMode == GrabModeSync) thisDev->sync.state = FROZEN_NO_EVENT; else { /* free both if same client owns both */ thisDev->sync.state = THAWED; if (thisDev->sync.other && (CLIENT_BITS(thisDev->sync.other->resource) == CLIENT_BITS(grab->resource))) thisDev->sync.other = NullGrab; } for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev != thisDev) { if (otherMode == GrabModeSync) dev->sync.other = grab; else { /* free both if same client owns both */ if (dev->sync.other && (CLIENT_BITS(dev->sync.other->resource) == CLIENT_BITS(grab->resource))) dev->sync.other = NullGrab; } } } ComputeFreezes(); } void #ifdef NXAGENT_SERVER xorg_ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, TimeStamp time, Bool autoGrab) #else ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, TimeStamp time, Bool autoGrab) #endif { WindowPtr oldWin = (mouse->grab) ? mouse->grab->window : sprite.win; if (grab->confineTo) { if (grab->confineTo->drawable.pScreen != sprite.hotPhys.pScreen) sprite.hotPhys.x = sprite.hotPhys.y = 0; ConfineCursorToWindow(grab->confineTo, FALSE, TRUE); } DoEnterLeaveEvents(oldWin, grab->window, NotifyGrab); mouse->valuator->motionHintWindow = NullWindow; if (syncEvents.playingEvents) mouse->grabTime = syncEvents.time; else mouse->grabTime = time; if (grab->cursor) grab->cursor->refcnt++; mouse->activeGrab = *grab; mouse->grab = &mouse->activeGrab; mouse->fromPassiveGrab = autoGrab; PostNewCursor(); CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode); } void #ifdef NXAGENT_SERVER xorg_DeactivatePointerGrab(register DeviceIntPtr mouse) #else DeactivatePointerGrab(register DeviceIntPtr mouse) #endif { register GrabPtr grab = mouse->grab; register DeviceIntPtr dev; mouse->valuator->motionHintWindow = NullWindow; mouse->grab = NullGrab; mouse->sync.state = NOT_GRABBED; mouse->fromPassiveGrab = FALSE; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->sync.other == grab) dev->sync.other = NullGrab; } DoEnterLeaveEvents(grab->window, sprite.win, NotifyUngrab); if (grab->confineTo) ConfineCursorToWindow(ROOT, FALSE, FALSE); PostNewCursor(); if (grab->cursor) FreeCursor(grab->cursor, (Cursor)0); ComputeFreezes(); } void ActivateKeyboardGrab(register DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive) { WindowPtr oldWin; if (keybd->grab) oldWin = keybd->grab->window; else if (keybd->focus) oldWin = keybd->focus->win; else oldWin = sprite.win; if (oldWin == FollowKeyboardWin) oldWin = inputInfo.keyboard->focus->win; if (keybd->valuator) keybd->valuator->motionHintWindow = NullWindow; DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab); if (syncEvents.playingEvents) keybd->grabTime = syncEvents.time; else keybd->grabTime = time; keybd->activeGrab = *grab; keybd->grab = &keybd->activeGrab; keybd->fromPassiveGrab = passive; CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode); } void DeactivateKeyboardGrab(register DeviceIntPtr keybd) { register GrabPtr grab = keybd->grab; register DeviceIntPtr dev; register WindowPtr focusWin = keybd->focus ? keybd->focus->win : sprite.win; if (focusWin == FollowKeyboardWin) focusWin = inputInfo.keyboard->focus->win; if (keybd->valuator) keybd->valuator->motionHintWindow = NullWindow; keybd->grab = NullGrab; keybd->sync.state = NOT_GRABBED; keybd->fromPassiveGrab = FALSE; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->sync.other == grab) dev->sync.other = NullGrab; } DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab); ComputeFreezes(); } void AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState) { Bool thisGrabbed, otherGrabbed, othersFrozen, thisSynced; TimeStamp grabTime; register DeviceIntPtr dev; thisGrabbed = thisDev->grab && SameClient(thisDev->grab, client); thisSynced = FALSE; otherGrabbed = FALSE; othersFrozen = TRUE; grabTime = thisDev->grabTime; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev == thisDev) continue; if (dev->grab && SameClient(dev->grab, client)) { if (!(thisGrabbed || otherGrabbed) || (CompareTimeStamps(dev->grabTime, grabTime) == LATER)) grabTime = dev->grabTime; otherGrabbed = TRUE; if (thisDev->sync.other == dev->grab) thisSynced = TRUE; if (dev->sync.state < FROZEN) othersFrozen = FALSE; } else if (!dev->sync.other || !SameClient(dev->sync.other, client)) othersFrozen = FALSE; } if (!((thisGrabbed && thisDev->sync.state >= FROZEN) || thisSynced)) return; if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, grabTime) == EARLIER)) return; switch (newState) { case THAWED: /* Async */ if (thisGrabbed) thisDev->sync.state = THAWED; if (thisSynced) thisDev->sync.other = NullGrab; ComputeFreezes(); break; case FREEZE_NEXT_EVENT: /* Sync */ if (thisGrabbed) { thisDev->sync.state = FREEZE_NEXT_EVENT; if (thisSynced) thisDev->sync.other = NullGrab; ComputeFreezes(); } break; case THAWED_BOTH: /* AsyncBoth */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->grab && SameClient(dev->grab, client)) dev->sync.state = THAWED; if (dev->sync.other && SameClient(dev->sync.other, client)) dev->sync.other = NullGrab; } ComputeFreezes(); } break; case FREEZE_BOTH_NEXT_EVENT: /* SyncBoth */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->grab && SameClient(dev->grab, client)) dev->sync.state = FREEZE_BOTH_NEXT_EVENT; if (dev->sync.other && SameClient(dev->sync.other, client)) dev->sync.other = NullGrab; } ComputeFreezes(); } break; case NOT_GRABBED: /* Replay */ if (thisGrabbed && thisDev->sync.state == FROZEN_WITH_EVENT) { if (thisSynced) thisDev->sync.other = NullGrab; syncEvents.replayDev = thisDev; syncEvents.replayWin = thisDev->grab->window; (*thisDev->DeactivateGrab)(thisDev); syncEvents.replayDev = (DeviceIntPtr)NULL; } break; case THAW_OTHERS: /* AsyncOthers */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev == thisDev) continue; if (dev->grab && SameClient(dev->grab, client)) dev->sync.state = THAWED; if (dev->sync.other && SameClient(dev->sync.other, client)) dev->sync.other = NullGrab; } ComputeFreezes(); } break; } } int #ifdef NXAGENT_SERVER xorg_ProcAllowEvents(register ClientPtr client) #else ProcAllowEvents(register ClientPtr client) #endif { TimeStamp time; DeviceIntPtr mouse = inputInfo.pointer; DeviceIntPtr keybd = inputInfo.keyboard; REQUEST(xAllowEventsReq); REQUEST_SIZE_MATCH(xAllowEventsReq); time = ClientTimeToServerTime(stuff->time); switch (stuff->mode) { case ReplayPointer: AllowSome(client, time, mouse, NOT_GRABBED); break; case SyncPointer: AllowSome(client, time, mouse, FREEZE_NEXT_EVENT); break; case AsyncPointer: AllowSome(client, time, mouse, THAWED); break; case ReplayKeyboard: AllowSome(client, time, keybd, NOT_GRABBED); break; case SyncKeyboard: AllowSome(client, time, keybd, FREEZE_NEXT_EVENT); break; case AsyncKeyboard: AllowSome(client, time, keybd, THAWED); break; case SyncBoth: AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT); break; case AsyncBoth: AllowSome(client, time, keybd, THAWED_BOTH); break; default: client->errorValue = stuff->mode; return BadValue; } return Success; } void ReleaseActiveGrabs(ClientPtr client) { register DeviceIntPtr dev; Bool done; /* XXX CloseDownClient should remove passive grabs before * releasing active grabs. */ do { done = TRUE; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->grab && SameClient(dev->grab, client)) { (*dev->DeactivateGrab)(dev); done = FALSE; } } } while (!done); } /************************************************************************** * The following procedures deal with delivering events * **************************************************************************/ int TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask, Mask filter, GrabPtr grab) { int type; #ifdef DEBUG if (debug_events) ErrorF( "Event([%d, %d], mask=0x%x), client=%d", pEvents->u.u.type, pEvents->u.u.detail, mask, client->index); #endif if ((client) && (client != serverClient) && (!client->clientGone) && ((filter == CantBeFiltered) || (mask & filter))) { if (grab && !SameClient(grab, client)) return -1; /* don't send, but notify caller */ type = pEvents->u.u.type; if (type == MotionNotify) { if (mask & PointerMotionHintMask) { if (WID(inputInfo.pointer->valuator->motionHintWindow) == pEvents->u.keyButtonPointer.event) { #ifdef DEBUG if (debug_events) ErrorF("\n"); fprintf(stderr,"motionHintWindow == keyButtonPointer.event\n"); #endif return 1; /* don't send, but pretend we did */ } pEvents->u.u.detail = NotifyHint; } else { pEvents->u.u.detail = NotifyNormal; } } #ifdef XINPUT else { if ((type == DeviceMotionNotify) && MaybeSendDeviceMotionNotifyHint ((deviceKeyButtonPointer*)pEvents, mask) != 0) return 1; } #endif if (BitIsOn(criticalEvents, type)) { if (client->smart_priority < SMART_MAX_PRIORITY) client->smart_priority++; SetCriticalOutputPending(); } WriteEventsToClient(client, count, pEvents); #ifdef DEBUG if (debug_events) ErrorF( " delivered\n"); #endif return 1; } else { #ifdef DEBUG if (debug_events) ErrorF("\n"); #endif return 0; } } int DeliverEventsToWindow(register WindowPtr pWin, xEvent *pEvents, int count, Mask filter, GrabPtr grab, int mskidx) { int deliveries = 0, nondeliveries = 0; int attempt; register InputClients *other; ClientPtr client = NullClient; Mask deliveryMask = 0; /* If a grab occurs due to a button press, then this mask is the mask of the grab. */ int type = pEvents->u.u.type; /* CantBeFiltered means only window owner gets the event */ if ((filter == CantBeFiltered) || !(type & EXTENSION_EVENT_BASE)) { /* if nobody ever wants to see this event, skip some work */ if (filter != CantBeFiltered && !((wOtherEventMasks(pWin)|pWin->eventMask) & filter)) return 0; if ( (attempt = TryClientEvents(wClient(pWin), pEvents, count, pWin->eventMask, filter, grab)) ) { if (attempt > 0) { deliveries++; client = wClient(pWin); deliveryMask = pWin->eventMask; } else nondeliveries--; } } if (filter != CantBeFiltered) { if (type & EXTENSION_EVENT_BASE) { OtherInputMasks *inputMasks; inputMasks = wOtherInputMasks(pWin); if (!inputMasks || !(inputMasks->inputEvents[mskidx] & filter)) return 0; other = inputMasks->inputClients; } else other = (InputClients *)wOtherClients(pWin); for (; other; other = other->next) { if ( (attempt = TryClientEvents(rClient(other), pEvents, count, other->mask[mskidx], filter, grab)) ) { if (attempt > 0) { deliveries++; client = rClient(other); deliveryMask = other->mask[mskidx]; } else nondeliveries--; } } } if ((type == ButtonPress) && deliveries && (!grab)) { GrabRec tempGrab; tempGrab.device = inputInfo.pointer; tempGrab.resource = client->clientAsMask; tempGrab.window = pWin; tempGrab.ownerEvents = (deliveryMask & OwnerGrabButtonMask) ? TRUE : FALSE; tempGrab.eventMask = deliveryMask; tempGrab.keyboardMode = GrabModeAsync; tempGrab.pointerMode = GrabModeAsync; tempGrab.confineTo = NullWindow; tempGrab.cursor = NullCursor; (*inputInfo.pointer->ActivateGrab)(inputInfo.pointer, &tempGrab, currentTime, TRUE); } else if ((type == MotionNotify) && deliveries) inputInfo.pointer->valuator->motionHintWindow = pWin; #ifdef XINPUT else { if (((type == DeviceMotionNotify) #ifdef XKB || (type == DeviceButtonPress) #endif ) && deliveries) CheckDeviceGrabAndHintWindow (pWin, type, (deviceKeyButtonPointer*) pEvents, grab, client, deliveryMask); } #endif if (deliveries) return deliveries; return nondeliveries; } /* If the event goes to dontClient, don't send it and return 0. if send works, return 1 or if send didn't work, return 2. Only works for core events. */ #ifdef PANORAMIX static int XineramaTryClientEventsResult( ClientPtr client, GrabPtr grab, Mask mask, Mask filter ){ if ((client) && (client != serverClient) && (!client->clientGone) && ((filter == CantBeFiltered) || (mask & filter))) { if (grab && !SameClient(grab, client)) return -1; else return 1; } return 0; } #endif int MaybeDeliverEventsToClient(register WindowPtr pWin, xEvent *pEvents, int count, Mask filter, ClientPtr dontClient) { register OtherClients *other; if (pWin->eventMask & filter) { if (wClient(pWin) == dontClient) return 0; #ifdef PANORAMIX if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return XineramaTryClientEventsResult( wClient(pWin), NullGrab, pWin->eventMask, filter); #endif return TryClientEvents(wClient(pWin), pEvents, count, pWin->eventMask, filter, NullGrab); } for (other = wOtherClients(pWin); other; other = other->next) { if (other->mask & filter) { if (SameClient(other, dontClient)) return 0; #ifdef PANORAMIX if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return XineramaTryClientEventsResult( rClient(other), NullGrab, other->mask, filter); #endif return TryClientEvents(rClient(other), pEvents, count, other->mask, filter, NullGrab); } } return 2; } static void FixUpEventFromWindow( xEvent *xE, WindowPtr pWin, Window child, Bool calcChild) { if (calcChild) { WindowPtr w=spriteTrace[spriteTraceGood-1]; /* If the search ends up past the root should the child field be set to none or should the value in the argument be passed through. It probably doesn't matter since everyone calls this function with child == None anyway. */ while (w) { /* If the source window is same as event window, child should be none. Don't bother going all all the way back to the root. */ if (w == pWin) { child = None; break; } if (w->parent == pWin) { child = w->drawable.id; break; } w = w->parent; } } XE_KBPTR.root = ROOT->drawable.id; XE_KBPTR.event = pWin->drawable.id; if (sprite.hot.pScreen == pWin->drawable.pScreen) { XE_KBPTR.sameScreen = xTrue; XE_KBPTR.child = child; XE_KBPTR.eventX = XE_KBPTR.rootX - pWin->drawable.x; XE_KBPTR.eventY = XE_KBPTR.rootY - pWin->drawable.y; } else { XE_KBPTR.sameScreen = xFalse; XE_KBPTR.child = None; XE_KBPTR.eventX = 0; XE_KBPTR.eventY = 0; } } int DeliverDeviceEvents(register WindowPtr pWin, register xEvent *xE, GrabPtr grab, register WindowPtr stopAt, DeviceIntPtr dev, int count) { Window child = None; int type = xE->u.u.type; Mask filter = filters[type]; int deliveries = 0; if (type & EXTENSION_EVENT_BASE) { register OtherInputMasks *inputMasks; int mskidx = dev->id; inputMasks = wOtherInputMasks(pWin); if (inputMasks && !(filter & inputMasks->deliverableEvents[mskidx])) return 0; while (pWin) { if (inputMasks && (inputMasks->inputEvents[mskidx] & filter)) { FixUpEventFromWindow(xE, pWin, child, FALSE); deliveries = DeliverEventsToWindow(pWin, xE, count, filter, grab, mskidx); if (deliveries > 0) return deliveries; } if ((deliveries < 0) || (pWin == stopAt) || (inputMasks && (filter & inputMasks->dontPropagateMask[mskidx]))) return 0; child = pWin->drawable.id; pWin = pWin->parent; if (pWin) inputMasks = wOtherInputMasks(pWin); } } else { if (!(filter & pWin->deliverableEvents)) return 0; while (pWin) { if ((wOtherEventMasks(pWin)|pWin->eventMask) & filter) { FixUpEventFromWindow(xE, pWin, child, FALSE); deliveries = DeliverEventsToWindow(pWin, xE, count, filter, grab, 0); if (deliveries > 0) return deliveries; } if ((deliveries < 0) || (pWin == stopAt) || (filter & wDontPropagateMask(pWin))) return 0; child = pWin->drawable.id; pWin = pWin->parent; } } return 0; } /* not useful for events that propagate up the tree or extension events */ int DeliverEvents(register WindowPtr pWin, register xEvent *xE, int count, register WindowPtr otherParent) { Mask filter; int deliveries; #ifdef PANORAMIX if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return count; #endif if (!count) return 0; filter = filters[xE->u.u.type]; if ((filter & SubstructureNotifyMask) && (xE->u.u.type != CreateNotify)) xE->u.destroyNotify.event = pWin->drawable.id; if (filter != StructureAndSubMask) return DeliverEventsToWindow(pWin, xE, count, filter, NullGrab, 0); deliveries = DeliverEventsToWindow(pWin, xE, count, StructureNotifyMask, NullGrab, 0); if (pWin->parent) { xE->u.destroyNotify.event = pWin->parent->drawable.id; deliveries += DeliverEventsToWindow(pWin->parent, xE, count, SubstructureNotifyMask, NullGrab, 0); if (xE->u.u.type == ReparentNotify) { xE->u.destroyNotify.event = otherParent->drawable.id; deliveries += DeliverEventsToWindow(otherParent, xE, count, SubstructureNotifyMask, NullGrab, 0); } } return deliveries; } static Bool PointInBorderSize(WindowPtr pWin, int x, int y) { BoxRec box; if(RegionContainsPoint(&pWin->borderSize, x, y, &box)) return TRUE; #ifdef PANORAMIX if(!noPanoramiXExtension && XineramaSetWindowPntrs(pWin)) { int i; for(i = 1; i < PanoramiXNumScreens; i++) { if(RegionContainsPoint( &sprite.windows[i]->borderSize, x + panoramiXdataPtr[0].x - panoramiXdataPtr[i].x, y + panoramiXdataPtr[0].y - panoramiXdataPtr[i].y, &box)) return TRUE; } } #endif return FALSE; } /* define XYWINDOWCALLBACK if your DDX provides this callback */ static WindowPtr GetXYStartWindow(WindowPtr pWin); #ifndef XYWINDOWCALLBACK static WindowPtr GetXYStartWindow(WindowPtr pWin) { return pWin; } #endif static WindowPtr XYToWindow(int x, int y) { register WindowPtr pWin; BoxRec box; spriteTraceGood = 1; /* root window still there */ pWin = GetXYStartWindow(ROOT->firstChild); while (pWin) { if ((pWin->mapped) && (x >= pWin->drawable.x - wBorderWidth (pWin)) && (x < pWin->drawable.x + (int)pWin->drawable.width + wBorderWidth(pWin)) && (y >= pWin->drawable.y - wBorderWidth (pWin)) && (y < pWin->drawable.y + (int)pWin->drawable.height + wBorderWidth (pWin)) #ifdef SHAPE /* When a window is shaped, a further check * is made to see if the point is inside * borderSize */ && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y)) && (!wInputShape(pWin) || RegionContainsPoint( wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box)) #endif ) { if (spriteTraceGood >= spriteTraceSize) { spriteTraceSize += 10; spriteTrace = realloc( spriteTrace, spriteTraceSize*sizeof(WindowPtr)); } spriteTrace[spriteTraceGood++] = pWin; pWin = pWin->firstChild; } else pWin = pWin->nextSib; } return spriteTrace[spriteTraceGood-1]; } #ifndef NXAGENT_SERVER static Bool CheckMotion(xEvent *xE) { WindowPtr prevSpriteWin = sprite.win; #ifdef PANORAMIX if(!noPanoramiXExtension) return XineramaCheckMotion(xE); #endif if (xE && !syncEvents.playingEvents) { if (sprite.hot.pScreen != sprite.hotPhys.pScreen) { sprite.hot.pScreen = sprite.hotPhys.pScreen; ROOT = sprite.hot.pScreen->root; } sprite.hot.x = XE_KBPTR.rootX; sprite.hot.y = XE_KBPTR.rootY; if (sprite.hot.x < sprite.physLimits.x1) sprite.hot.x = sprite.physLimits.x1; else if (sprite.hot.x >= sprite.physLimits.x2) sprite.hot.x = sprite.physLimits.x2 - 1; if (sprite.hot.y < sprite.physLimits.y1) sprite.hot.y = sprite.physLimits.y1; else if (sprite.hot.y >= sprite.physLimits.y2) sprite.hot.y = sprite.physLimits.y2 - 1; #ifdef SHAPE if (sprite.hotShape) ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y); #endif sprite.hotPhys = sprite.hot; if ((sprite.hotPhys.x != XE_KBPTR.rootX) || (sprite.hotPhys.y != XE_KBPTR.rootY)) { (*sprite.hotPhys.pScreen->SetCursorPosition)( sprite.hotPhys.pScreen, sprite.hotPhys.x, sprite.hotPhys.y, FALSE); } XE_KBPTR.rootX = sprite.hot.x; XE_KBPTR.rootY = sprite.hot.y; } sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y); #ifdef notyet if (!(sprite.win->deliverableEvents & Motion_Filter(inputInfo.pointer->button)) !syncEvents.playingEvents) { /* XXX Do PointerNonInterestBox here */ } #endif if (sprite.win != prevSpriteWin) { if (prevSpriteWin != NullWindow) { if (!xE) UpdateCurrentTimeIf(); DoEnterLeaveEvents(prevSpriteWin, sprite.win, NotifyNormal); } PostNewCursor(); return FALSE; } return TRUE; } #endif /* NXAGENT_SERVER */ void WindowsRestructured() { (void) CheckMotion((xEvent *)NULL); } #ifdef PANORAMIX /* This was added to support reconfiguration under Xdmx. The problem is * that if the 0th screen (i.e., screenInfo.screens[0]->root) is moved to an origin * other than 0,0, the information in the private sprite structure must * be updated accordingly, or XYToWindow (and other routines) will not * compute correctly. */ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) { GrabPtr grab; if (noPanoramiXExtension) return; sprite.hot.x -= xoff; sprite.hot.y -= yoff; sprite.hotPhys.x -= xoff; sprite.hotPhys.y -= yoff; sprite.hotLimits.x1 -= xoff; sprite.hotLimits.y1 -= yoff; sprite.hotLimits.x2 -= xoff; sprite.hotLimits.y2 -= yoff; if (RegionNotEmpty(&sprite.Reg1)) RegionTranslate(&sprite.Reg1, xoff, yoff); if (RegionNotEmpty(&sprite.Reg2)) RegionTranslate(&sprite.Reg2, xoff, yoff); /* FIXME: if we call ConfineCursorToWindow, must we do anything else? */ if ((grab = inputInfo.pointer->grab) && grab->confineTo) { if (grab->confineTo->drawable.pScreen != sprite.hotPhys.pScreen) sprite.hotPhys.x = sprite.hotPhys.y = 0; ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); } else ConfineCursorToWindow(sprite.hotPhys.pScreen->root, TRUE, FALSE); } #endif void #ifdef NXAGENT_SERVER xorg_DefineInitialRootWindow(register WindowPtr win) #else DefineInitialRootWindow(register WindowPtr win) #endif { register ScreenPtr pScreen = win->drawable.pScreen; sprite.hotPhys.pScreen = pScreen; sprite.hotPhys.x = pScreen->width / 2; sprite.hotPhys.y = pScreen->height / 2; sprite.hot = sprite.hotPhys; sprite.hotLimits.x2 = pScreen->width; sprite.hotLimits.y2 = pScreen->height; sprite.win = win; sprite.current = wCursor (win); sprite.current->refcnt++; spriteTraceGood = 1; ROOT = win; (*pScreen->CursorLimits) ( pScreen, sprite.current, &sprite.hotLimits, &sprite.physLimits); sprite.confined = FALSE; (*pScreen->ConstrainCursor) (pScreen, &sprite.physLimits); (*pScreen->SetCursorPosition) (pScreen, sprite.hot.x, sprite.hot.y, FALSE); (*pScreen->DisplayCursor) (pScreen, sprite.current); #ifdef PANORAMIX if(!noPanoramiXExtension) { sprite.hotLimits.x1 = -panoramiXdataPtr[0].x; sprite.hotLimits.y1 = -panoramiXdataPtr[0].y; sprite.hotLimits.x2 = PanoramiXPixWidth - panoramiXdataPtr[0].x; sprite.hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y; sprite.physLimits = sprite.hotLimits; sprite.confineWin = NullWindow; #ifdef SHAPE sprite.hotShape = NullRegion; #endif sprite.screen = pScreen; /* gotta UNINIT these someplace */ RegionNull(&sprite.Reg1); RegionNull(&sprite.Reg2); } #endif } /* * This does not take any shortcuts, and even ignores its argument, since * it does not happen very often, and one has to walk up the tree since * this might be a newly instantiated cursor for an intermediate window * between the one the pointer is in and the one that the last cursor was * instantiated from. */ void WindowHasNewCursor(WindowPtr pWin) { PostNewCursor(); } void NewCurrentScreen(ScreenPtr newScreen, int x, int y) { sprite.hotPhys.x = x; sprite.hotPhys.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension) { sprite.hotPhys.x += panoramiXdataPtr[newScreen->myNum].x - panoramiXdataPtr[0].x; sprite.hotPhys.y += panoramiXdataPtr[newScreen->myNum].y - panoramiXdataPtr[0].y; if (newScreen != sprite.screen) { sprite.screen = newScreen; /* Make sure we tell the DDX to update its copy of the screen */ if(sprite.confineWin) XineramaConfineCursorToWindow(sprite.confineWin, TRUE); else XineramaConfineCursorToWindow(screenInfo.screens[0]->root, TRUE); /* if the pointer wasn't confined, the DDX won't get told of the pointer warp so we reposition it here */ if(!syncEvents.playingEvents) (*sprite.screen->SetCursorPosition)(sprite.screen, sprite.hotPhys.x + panoramiXdataPtr[0].x - panoramiXdataPtr[sprite.screen->myNum].x, sprite.hotPhys.y + panoramiXdataPtr[0].y - panoramiXdataPtr[sprite.screen->myNum].y, FALSE); } } else #endif if (newScreen != sprite.hotPhys.pScreen) ConfineCursorToWindow(newScreen->root, TRUE, FALSE); } #ifdef PANORAMIX static Bool XineramaPointInWindowIsVisible( WindowPtr pWin, int x, int y ) { BoxRec box; int i, xoff, yoff; if (!pWin->realized) return FALSE; if (RegionContainsPoint(&pWin->borderClip, x, y, &box)) return TRUE; if(!XineramaSetWindowPntrs(pWin)) return FALSE; xoff = x + panoramiXdataPtr[0].x; yoff = y + panoramiXdataPtr[0].y; for(i = 1; i < PanoramiXNumScreens; i++) { pWin = sprite.windows[i]; x = xoff - panoramiXdataPtr[i].x; y = yoff - panoramiXdataPtr[i].y; if(RegionContainsPoint(&pWin->borderClip, x, y, &box) && (!wInputShape(pWin) || RegionContainsPoint( wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box))) return TRUE; } return FALSE; } static int XineramaWarpPointer(ClientPtr client) { WindowPtr dest = NULL; int x, y; REQUEST(xWarpPointerReq); if (stuff->dstWid != None) { dest = SecurityLookupWindow(stuff->dstWid, client, DixReadAccess); if (!dest) return BadWindow; } x = sprite.hotPhys.x; y = sprite.hotPhys.y; if (stuff->srcWid != None) { int winX, winY; XID winID = stuff->srcWid; WindowPtr source; source = SecurityLookupWindow(winID, client, DixReadAccess); if (!source) return BadWindow; winX = source->drawable.x; winY = source->drawable.y; if(source == screenInfo.screens[0]->root) { winX -= panoramiXdataPtr[0].x; winY -= panoramiXdataPtr[0].y; } if (x < winX + stuff->srcX || y < winY + stuff->srcY || (stuff->srcWidth != 0 && winX + stuff->srcX + (int)stuff->srcWidth < x) || (stuff->srcHeight != 0 && winY + stuff->srcY + (int)stuff->srcHeight < y) || !XineramaPointInWindowIsVisible(source, x, y)) return Success; } if (dest) { x = dest->drawable.x; y = dest->drawable.y; if(dest == screenInfo.screens[0]->root) { x -= panoramiXdataPtr[0].x; y -= panoramiXdataPtr[0].y; } } x += stuff->dstX; y += stuff->dstY; if (x < sprite.physLimits.x1) x = sprite.physLimits.x1; else if (x >= sprite.physLimits.x2) x = sprite.physLimits.x2 - 1; if (y < sprite.physLimits.y1) y = sprite.physLimits.y1; else if (y >= sprite.physLimits.y2) y = sprite.physLimits.y2 - 1; if (sprite.hotShape) ConfineToShape(sprite.hotShape, &x, &y); XineramaSetCursorPosition(x, y, TRUE); return Success; } #endif int ProcWarpPointer(ClientPtr client) { WindowPtr dest = NULL; int x, y; ScreenPtr newScreen; REQUEST(xWarpPointerReq); REQUEST_SIZE_MATCH(xWarpPointerReq); #ifdef PANORAMIX if(!noPanoramiXExtension) return XineramaWarpPointer(client); #endif if (stuff->dstWid != None) { dest = SecurityLookupWindow(stuff->dstWid, client, DixReadAccess); if (!dest) return BadWindow; } x = sprite.hotPhys.x; y = sprite.hotPhys.y; if (stuff->srcWid != None) { int winX, winY; XID winID = stuff->srcWid; WindowPtr source; source = SecurityLookupWindow(winID, client, DixReadAccess); if (!source) return BadWindow; winX = source->drawable.x; winY = source->drawable.y; if (source->drawable.pScreen != sprite.hotPhys.pScreen || x < winX + stuff->srcX || y < winY + stuff->srcY || (stuff->srcWidth != 0 && winX + stuff->srcX + (int)stuff->srcWidth < x) || (stuff->srcHeight != 0 && winY + stuff->srcY + (int)stuff->srcHeight < y) || !PointInWindowIsVisible(source, x, y)) return Success; } if (dest) { x = dest->drawable.x; y = dest->drawable.y; newScreen = dest->drawable.pScreen; } else newScreen = sprite.hotPhys.pScreen; x += stuff->dstX; y += stuff->dstY; if (x < 0) x = 0; else if (x >= newScreen->width) x = newScreen->width - 1; if (y < 0) y = 0; else if (y >= newScreen->height) y = newScreen->height - 1; if (newScreen == sprite.hotPhys.pScreen) { if (x < sprite.physLimits.x1) x = sprite.physLimits.x1; else if (x >= sprite.physLimits.x2) x = sprite.physLimits.x2 - 1; if (y < sprite.physLimits.y1) y = sprite.physLimits.y1; else if (y >= sprite.physLimits.y2) y = sprite.physLimits.y2 - 1; #if defined(SHAPE) if (sprite.hotShape) ConfineToShape(sprite.hotShape, &x, &y); #endif (*newScreen->SetCursorPosition)(newScreen, x, y, TRUE); } else if (!PointerConfinedToScreen()) { NewCurrentScreen(newScreen, x, y); } return Success; } static Bool BorderSizeNotEmpty(WindowPtr pWin) { if(RegionNotEmpty(&pWin->borderSize)) return TRUE; #ifdef PANORAMIX if(!noPanoramiXExtension && XineramaSetWindowPntrs(pWin)) { int i; for(i = 1; i < PanoramiXNumScreens; i++) { if(RegionNotEmpty(&sprite.windows[i]->borderSize)) return TRUE; } } #endif return FALSE; } /* "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a passive grab set on the window to be activated. */ static Bool CheckPassiveGrabsOnWindow( WindowPtr pWin, register DeviceIntPtr device, register xEvent *xE, int count) { register GrabPtr grab = wPassiveGrabs(pWin); GrabRec tempGrab; register xEvent *dxE; if (!grab) return FALSE; tempGrab.window = pWin; tempGrab.device = device; tempGrab.type = xE->u.u.type; tempGrab.detail.exact = xE->u.u.detail; tempGrab.detail.pMask = NULL; tempGrab.modifiersDetail.pMask = NULL; for (; grab; grab = grab->next) { #ifdef XKB DeviceIntPtr gdev; XkbSrvInfoPtr xkbi; gdev= grab->modifierDevice; xkbi= gdev->key->xkbInfo; #endif tempGrab.modifierDevice = grab->modifierDevice; if ((device == grab->modifierDevice) && ((xE->u.u.type == KeyPress) #if defined(XINPUT) && defined(XKB) || (xE->u.u.type == DeviceKeyPress) #endif )) tempGrab.modifiersDetail.exact = #ifdef XKB (noXkbExtension?gdev->key->prev_state:xkbi->state.grab_mods); #else grab->modifierDevice->key->prev_state; #endif else tempGrab.modifiersDetail.exact = #ifdef XKB (noXkbExtension ? gdev->key->state : xkbi->state.grab_mods); #else grab->modifierDevice->key->state; #endif if (GrabMatchesSecond(&tempGrab, grab) && (!grab->confineTo || (grab->confineTo->realized && BorderSizeNotEmpty(grab->confineTo)))) { #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(wClient(pWin), device, FALSE)) return FALSE; #endif #ifdef XKB if (!noXkbExtension) { XE_KBPTR.state &= 0x1f00; XE_KBPTR.state |= tempGrab.modifiersDetail.exact&(~0x1f00); } #endif (*device->ActivateGrab)(device, grab, currentTime, TRUE); FixUpEventFromWindow(xE, grab->window, None, TRUE); (void) TryClientEvents(rClient(grab), xE, count, filters[xE->u.u.type], filters[xE->u.u.type], grab); if (device->sync.state == FROZEN_NO_EVENT) { if (device->sync.evcount < count) { device->sync.event = realloc(device->sync.event, count* sizeof(xEvent)); } device->sync.evcount = count; for (dxE = device->sync.event; --count >= 0; dxE++, xE++) *dxE = *xE; device->sync.state = FROZEN_WITH_EVENT; } return TRUE; } } return FALSE; } /** "CheckDeviceGrabs" handles both keyboard and pointer events that may cause a passive grab to be activated. If the event is a keyboard event, the ancestors of the focus window are traced down and tried to see if they have any passive grabs to be activated. If the focus window itself is reached and its descendants contain the pointer, the ancestors of the window that the pointer is in are then traced down starting at the focus window, otherwise no grabs are activated. If the event is a pointer event, the ancestors of the window that the pointer is in are traced down starting at the root until CheckPassiveGrabs causes a passive grab to activate or all the windows are tried. PRH */ Bool CheckDeviceGrabs(register DeviceIntPtr device, register xEvent *xE, int checkFirst, int count) { register int i; register WindowPtr pWin = NULL; register FocusClassPtr focus = device->focus; if (((xE->u.u.type == ButtonPress) #if defined(XINPUT) && defined(XKB) || (xE->u.u.type == DeviceButtonPress) #endif ) && (device->button->buttonsDown != 1)) return FALSE; i = checkFirst; if (focus) { for (; i < focus->traceGood; i++) { pWin = focus->trace[i]; if (pWin->optional && CheckPassiveGrabsOnWindow(pWin, device, xE, count)) return TRUE; } if ((focus->win == NoneWin) || (i >= spriteTraceGood) || ((i > checkFirst) && (pWin != spriteTrace[i-1]))) return FALSE; } for (; i < spriteTraceGood; i++) { pWin = spriteTrace[i]; if (pWin->optional && CheckPassiveGrabsOnWindow(pWin, device, xE, count)) return TRUE; } return FALSE; } void DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count) { WindowPtr focus = keybd->focus->win; int mskidx = 0; if (focus == FollowKeyboardWin) focus = inputInfo.keyboard->focus->win; if (!focus) return; if (focus == PointerRootWin) { DeliverDeviceEvents(window, xE, NullGrab, NullWindow, keybd, count); return; } if ((focus == window) || IsParent(focus, window)) { if (DeliverDeviceEvents(window, xE, NullGrab, focus, keybd, count)) return; } /* just deliver it to the focus window */ FixUpEventFromWindow(xE, focus, None, FALSE); if (xE->u.u.type & EXTENSION_EVENT_BASE) mskidx = keybd->id; (void)DeliverEventsToWindow(focus, xE, count, filters[xE->u.u.type], NullGrab, mskidx); } void DeliverGrabbedEvent(register xEvent *xE, register DeviceIntPtr thisDev, Bool deactivateGrab, int count) { register GrabPtr grab = thisDev->grab; int deliveries = 0; register DeviceIntPtr dev; register xEvent *dxE; if (grab->ownerEvents) { WindowPtr focus; if (thisDev->focus) { focus = thisDev->focus->win; if (focus == FollowKeyboardWin) focus = inputInfo.keyboard->focus->win; } else focus = PointerRootWin; if (focus == PointerRootWin) deliveries = DeliverDeviceEvents(sprite.win, xE, grab, NullWindow, thisDev, count); else if (focus && (focus == sprite.win || IsParent(focus, sprite.win))) deliveries = DeliverDeviceEvents(sprite.win, xE, grab, focus, thisDev, count); else if (focus) deliveries = DeliverDeviceEvents(focus, xE, grab, focus, thisDev, count); } if (!deliveries) { FixUpEventFromWindow(xE, grab->window, None, TRUE); deliveries = TryClientEvents(rClient(grab), xE, count, (Mask)grab->eventMask, filters[xE->u.u.type], grab); if (deliveries && (xE->u.u.type == MotionNotify #ifdef XINPUT || xE->u.u.type == DeviceMotionNotify #endif )) thisDev->valuator->motionHintWindow = grab->window; } if (deliveries && !deactivateGrab && (xE->u.u.type != MotionNotify #ifdef XINPUT && xE->u.u.type != DeviceMotionNotify #endif )) switch (thisDev->sync.state) { case FREEZE_BOTH_NEXT_EVENT: for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev == thisDev) continue; FreezeThaw(dev, TRUE); if ((dev->sync.state == FREEZE_BOTH_NEXT_EVENT) && (CLIENT_BITS(dev->grab->resource) == CLIENT_BITS(thisDev->grab->resource))) dev->sync.state = FROZEN_NO_EVENT; else dev->sync.other = thisDev->grab; } /* fall through */ case FREEZE_NEXT_EVENT: thisDev->sync.state = FROZEN_WITH_EVENT; FreezeThaw(thisDev, TRUE); if (thisDev->sync.evcount < count) { thisDev->sync.event = realloc(thisDev->sync.event, count*sizeof(xEvent)); } thisDev->sync.evcount = count; for (dxE = thisDev->sync.event; --count >= 0; dxE++, xE++) *dxE = *xE; break; } } void #ifdef XKB CoreProcessKeyboardEvent (register xEvent *xE, register DeviceIntPtr keybd, int count) #else ProcessKeyboardEvent (register xEvent *xE, register DeviceIntPtr keybd, int count) #endif { int key, bit; register BYTE *kptr; register int i; register CARD8 modifiers; register CARD16 mask; GrabPtr grab = keybd->grab; Bool deactivateGrab = FALSE; register KeyClassPtr keyc = keybd->key; if (!syncEvents.playingEvents) { NoticeTime(xE); if (DeviceEventCallback) { DeviceEventInfoRec eventinfo; eventinfo.events = xE; eventinfo.count = count; CallCallbacks(&DeviceEventCallback, (void *)&eventinfo); } } XE_KBPTR.state = (keyc->state | inputInfo.pointer->button->state); XE_KBPTR.rootX = sprite.hot.x; XE_KBPTR.rootY = sprite.hot.y; key = xE->u.u.detail; kptr = &keyc->down[key >> 3]; bit = 1 << (key & 7); modifiers = keyc->modifierMap[key]; #ifdef DEBUG if ((xkbDebugFlags&0x4)&& ((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) { ErrorF("CoreProcessKbdEvent: Key %d %s\n",key, (xE->u.u.type==KeyPress?"down":"up")); } #endif switch (xE->u.u.type) { case KeyPress: if (*kptr & bit) /* allow ddx to generate multiple downs */ { if (!modifiers) { xE->u.u.type = KeyRelease; (*keybd->public.processInputProc)(xE, keybd, count); xE->u.u.type = KeyPress; /* release can have side effects, don't fall through */ (*keybd->public.processInputProc)(xE, keybd, count); } return; } inputInfo.pointer->valuator->motionHintWindow = NullWindow; *kptr |= bit; keyc->prev_state = keyc->state; for (i = 0, mask = 1; modifiers; i++, mask <<= 1) { if (mask & modifiers) { /* This key affects modifier "i" */ keyc->modifierKeyCount[i]++; keyc->state |= mask; modifiers &= ~mask; } } if (!grab && CheckDeviceGrabs(keybd, xE, 0, count)) { keybd->activatingKey = key; return; } break; case KeyRelease: if (!(*kptr & bit)) /* guard against duplicates */ return; inputInfo.pointer->valuator->motionHintWindow = NullWindow; *kptr &= ~bit; keyc->prev_state = keyc->state; for (i = 0, mask = 1; modifiers; i++, mask <<= 1) { if (mask & modifiers) { /* This key affects modifier "i" */ if (--keyc->modifierKeyCount[i] <= 0) { keyc->state &= ~mask; keyc->modifierKeyCount[i] = 0; } modifiers &= ~mask; } } if (keybd->fromPassiveGrab && (key == keybd->activatingKey)) deactivateGrab = TRUE; break; default: FatalError("Impossible keyboard event"); } if (grab) DeliverGrabbedEvent(xE, keybd, deactivateGrab, count); else DeliverFocusedEvent(keybd, xE, sprite.win, count); if (deactivateGrab) (*keybd->DeactivateGrab)(keybd); } #ifdef XKB /* This function is used to set the key pressed or key released state - this is only used when the pressing of keys does not cause CoreProcessKeyEvent to be called, as in for example Mouse Keys. */ void FixKeyState (register xEvent *xE, register DeviceIntPtr keybd) { int key, bit; register BYTE *kptr; register KeyClassPtr keyc = keybd->key; key = xE->u.u.detail; kptr = &keyc->down[key >> 3]; bit = 1 << (key & 7); #ifdef DEBUG if ((xkbDebugFlags&0x4)&& ((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) { ErrorF("FixKeyState: Key %d %s\n",key, (xE->u.u.type==KeyPress?"down":"up")); } #endif switch (xE->u.u.type) { case KeyPress: *kptr |= bit; break; case KeyRelease: *kptr &= ~bit; break; default: FatalError("Impossible keyboard event"); } } #endif void #ifdef XKB CoreProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count) #else ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count) #endif { register GrabPtr grab = mouse->grab; Bool deactivateGrab = FALSE; register ButtonClassPtr butc = mouse->button; #ifdef XKB XkbSrvInfoPtr xkbi= inputInfo.keyboard->key->xkbInfo; #endif if (!syncEvents.playingEvents) NoticeTime(xE) XE_KBPTR.state = (butc->state | ( #ifdef XKB (noXkbExtension ? inputInfo.keyboard->key->state : xkbi->state.grab_mods) #else inputInfo.keyboard->key->state #endif )); { NoticeTime(xE); if (DeviceEventCallback) { DeviceEventInfoRec eventinfo; /* see comment in EnqueueEvents regarding the next three lines */ if (xE->u.u.type == MotionNotify) XE_KBPTR.root = sprite.hotPhys.pScreen->root->drawable.id; eventinfo.events = xE; eventinfo.count = count; CallCallbacks(&DeviceEventCallback, (void *)&eventinfo); } } if (xE->u.u.type != MotionNotify) { register int key; register BYTE *kptr; int bit; XE_KBPTR.rootX = sprite.hot.x; XE_KBPTR.rootY = sprite.hot.y; key = xE->u.u.detail; kptr = &butc->down[key >> 3]; bit = 1 << (key & 7); switch (xE->u.u.type) { case ButtonPress: mouse->valuator->motionHintWindow = NullWindow; if (!(*kptr & bit)) butc->buttonsDown++; butc->motionMask = ButtonMotionMask; *kptr |= bit; if (xE->u.u.detail == 0) return; if (xE->u.u.detail <= 5) butc->state |= (Button1Mask >> 1) << xE->u.u.detail; filters[MotionNotify] = Motion_Filter(butc); if (!grab) if (CheckDeviceGrabs(mouse, xE, 0, count)) return; break; case ButtonRelease: mouse->valuator->motionHintWindow = NullWindow; if (*kptr & bit) --butc->buttonsDown; if (!butc->buttonsDown) butc->motionMask = 0; *kptr &= ~bit; if (xE->u.u.detail == 0) return; if (xE->u.u.detail <= 5) butc->state &= ~((Button1Mask >> 1) << xE->u.u.detail); filters[MotionNotify] = Motion_Filter(butc); if (!butc->state && mouse->fromPassiveGrab) deactivateGrab = TRUE; break; default: FatalError("bogus pointer event from ddx"); } } else if (!CheckMotion(xE)) return; if (grab) DeliverGrabbedEvent(xE, mouse, deactivateGrab, count); else DeliverDeviceEvents(sprite.win, xE, NullGrab, NullWindow, mouse, count); if (deactivateGrab) (*mouse->DeactivateGrab)(mouse); } #define AtMostOneClient \ (SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask) void RecalculateDeliverableEvents(pWin) register WindowPtr pWin; { register OtherClients *others; register WindowPtr pChild; pChild = pWin; while (1) { if (pChild->optional) { pChild->optional->otherEventMasks = 0; for (others = wOtherClients(pChild); others; others = others->next) { pChild->optional->otherEventMasks |= others->mask; } } pChild->deliverableEvents = pChild->eventMask| wOtherEventMasks(pChild); if (pChild->parent) pChild->deliverableEvents |= (pChild->parent->deliverableEvents & ~wDontPropagateMask(pChild) & PropagateMask); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } } /** * * \param value must conform to DeleteType */ int OtherClientGone(void * value, XID id) { register OtherClientsPtr other, prev; register WindowPtr pWin = (WindowPtr)value; prev = 0; for (other = wOtherClients(pWin); other; other = other->next) { if (other->resource == id) { if (prev) prev->next = other->next; else { if (!(pWin->optional->otherClients = other->next)) CheckWindowOptionalNeed (pWin); } free(other); RecalculateDeliverableEvents(pWin); return(Success); } prev = other; } FatalError("client not on event list"); /*NOTREACHED*/ return -1; /* make compiler happy */ } int EventSelectForWindow(register WindowPtr pWin, register ClientPtr client, Mask mask) { Mask check; OtherClients * others; if (mask & ~AllEventMasks) { client->errorValue = mask; return BadValue; } check = (mask & AtMostOneClient); if (check & (pWin->eventMask|wOtherEventMasks(pWin))) { /* It is illegal for two different clients to select on any of the events for AtMostOneClient. However, it is OK, for some client to continue selecting on one of those events. */ if ((wClient(pWin) != client) && (check & pWin->eventMask)) return BadAccess; for (others = wOtherClients (pWin); others; others = others->next) { if (!SameClient(others, client) && (check & others->mask)) return BadAccess; } } if (wClient (pWin) == client) { check = pWin->eventMask; pWin->eventMask = mask; } else { for (others = wOtherClients (pWin); others; others = others->next) { if (SameClient(others, client)) { check = others->mask; if (mask == 0) { FreeResource(others->resource, RT_NONE); return Success; } else others->mask = mask; goto maskSet; } } check = 0; if (!pWin->optional && !MakeWindowOptional (pWin)) return BadAlloc; others = (OtherClients *) malloc(sizeof(OtherClients)); if (!others) return BadAlloc; others->mask = mask; others->resource = FakeClientID(client->index); others->next = pWin->optional->otherClients; pWin->optional->otherClients = others; if (!AddResource(others->resource, RT_OTHERCLIENT, (void *)pWin)) return BadAlloc; } maskSet: if ((inputInfo.pointer->valuator->motionHintWindow == pWin) && (mask & PointerMotionHintMask) && !(check & PointerMotionHintMask) && !inputInfo.pointer->grab) inputInfo.pointer->valuator->motionHintWindow = NullWindow; RecalculateDeliverableEvents(pWin); return Success; } int EventSuppressForWindow(register WindowPtr pWin, register ClientPtr client, Mask mask, Bool *checkOptional) { register int i, free; if (mask & ~PropagateMask) { client->errorValue = mask; return BadValue; } if (pWin->dontPropagate) DontPropagateRefCnts[pWin->dontPropagate]--; if (!mask) i = 0; else { for (i = DNPMCOUNT, free = 0; --i > 0; ) { if (!DontPropagateRefCnts[i]) free = i; else if (mask == DontPropagateMasks[i]) break; } if (!i && free) { i = free; DontPropagateMasks[i] = mask; } } if (i || !mask) { pWin->dontPropagate = i; if (i) DontPropagateRefCnts[i]++; if (pWin->optional) { pWin->optional->dontPropagateMask = mask; *checkOptional = TRUE; } } else { if (!pWin->optional && !MakeWindowOptional (pWin)) { if (pWin->dontPropagate) DontPropagateRefCnts[pWin->dontPropagate]++; return BadAlloc; } pWin->dontPropagate = 0; pWin->optional->dontPropagateMask = mask; } RecalculateDeliverableEvents(pWin); return Success; } static WindowPtr CommonAncestor( register WindowPtr a, register WindowPtr b) { for (b = b->parent; b; b = b->parent) if (IsParent(b, a)) return b; return NullWindow; } static void EnterLeaveEvent( int type, int mode, int detail, register WindowPtr pWin, Window child) { register DeviceIntPtr keybd = inputInfo.keyboard; WindowPtr focus; register DeviceIntPtr mouse = inputInfo.pointer; register GrabPtr grab = mouse->grab; Mask mask; if ((pWin == mouse->valuator->motionHintWindow) && (detail != NotifyInferior)) mouse->valuator->motionHintWindow = NullWindow; if (grab) { mask = (pWin == grab->window) ? grab->eventMask : 0; if (grab->ownerEvents) mask |= EventMaskForClient(pWin, rClient(grab)); } else { mask = pWin->eventMask | wOtherEventMasks(pWin); } if (mask & filters[type]) { xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.u.type = type; event.u.u.detail = detail; event.u.enterLeave.time = currentTime.milliseconds; event.u.enterLeave.rootX = sprite.hot.x; event.u.enterLeave.rootY = sprite.hot.y; /* Counts on the same initial structure of crossing & button events! */ FixUpEventFromWindow(&event, pWin, None, FALSE); /* Enter/Leave events always set child */ event.u.enterLeave.child = child; event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ? ELFlagSameScreen : 0; #ifdef XKB if (!noXkbExtension) { event.u.enterLeave.state = mouse->button->state & 0x1f00; event.u.enterLeave.state |= XkbGrabStateFromRec(&keybd->key->xkbInfo->state); } else #endif event.u.enterLeave.state = keybd->key->state | mouse->button->state; event.u.enterLeave.mode = mode; focus = keybd->focus->win; if ((focus != NoneWin) && ((pWin == focus) || (focus == PointerRootWin) || IsParent(focus, pWin))) event.u.enterLeave.flags |= ELFlagFocus; if (grab) (void)TryClientEvents(rClient(grab), &event, 1, mask, filters[type], grab); else (void)DeliverEventsToWindow(pWin, &event, 1, filters[type], NullGrab, 0); } if ((type == EnterNotify) && (mask & KeymapStateMask)) { xKeymapEvent ke; #ifdef XCSECURITY ClientPtr client = grab ? rClient(grab) : clients[CLIENT_ID(pWin->drawable.id)]; if (!SecurityCheckDeviceAccess(client, keybd, FALSE)) { bzero((char *)&ke.map[0], 31); } else #endif memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31); ke.type = KeymapNotify; if (grab) (void)TryClientEvents(rClient(grab), (xEvent *)&ke, 1, mask, KeymapStateMask, grab); else (void)DeliverEventsToWindow(pWin, (xEvent *)&ke, 1, KeymapStateMask, NullGrab, 0); } } static void EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail) { WindowPtr parent = child->parent; if (ancestor == parent) return; EnterNotifies(ancestor, parent, mode, detail); EnterLeaveEvent(EnterNotify, mode, detail, parent, child->drawable.id); } static void LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail) { register WindowPtr pWin; if (ancestor == child) return; for (pWin = child->parent; pWin != ancestor; pWin = pWin->parent) { EnterLeaveEvent(LeaveNotify, mode, detail, pWin, child->drawable.id); child = pWin; } } static void DoEnterLeaveEvents(WindowPtr fromWin, WindowPtr toWin, int mode) { if (fromWin == toWin) return; if (IsParent(fromWin, toWin)) { EnterLeaveEvent(LeaveNotify, mode, NotifyInferior, fromWin, None); EnterNotifies(fromWin, toWin, mode, NotifyVirtual); EnterLeaveEvent(EnterNotify, mode, NotifyAncestor, toWin, None); } else if (IsParent(toWin, fromWin)) { EnterLeaveEvent(LeaveNotify, mode, NotifyAncestor, fromWin, None); LeaveNotifies(fromWin, toWin, mode, NotifyVirtual); EnterLeaveEvent(EnterNotify, mode, NotifyInferior, toWin, None); } else { /* neither fromWin nor toWin is descendent of the other */ WindowPtr common = CommonAncestor(toWin, fromWin); /* common == NullWindow ==> different screens */ EnterLeaveEvent(LeaveNotify, mode, NotifyNonlinear, fromWin, None); LeaveNotifies(fromWin, common, mode, NotifyNonlinearVirtual); EnterNotifies(common, toWin, mode, NotifyNonlinearVirtual); EnterLeaveEvent(EnterNotify, mode, NotifyNonlinear, toWin, None); } } static void FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register WindowPtr pWin) { xEvent event; #ifdef XINPUT if (dev != inputInfo.keyboard) { DeviceFocusEvent(dev, type, mode, detail, pWin); return; } #endif memset(&event, 0, sizeof(xEvent)); event.u.focus.mode = mode; event.u.u.type = type; event.u.u.detail = detail; event.u.focus.window = pWin->drawable.id; (void)DeliverEventsToWindow(pWin, &event, 1, filters[type], NullGrab, 0); if ((type == FocusIn) && ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) { xKeymapEvent ke; #ifdef XCSECURITY ClientPtr client = clients[CLIENT_ID(pWin->drawable.id)]; if (!SecurityCheckDeviceAccess(client, dev, FALSE)) { bzero((char *)&ke.map[0], 31); } else #endif memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31); ke.type = KeymapNotify; (void)DeliverEventsToWindow(pWin, (xEvent *)&ke, 1, KeymapStateMask, NullGrab, 0); } } /* * recursive because it is easier * no-op if child not descended from ancestor */ static Bool FocusInEvents( DeviceIntPtr dev, WindowPtr ancestor, WindowPtr child, WindowPtr skipChild, int mode, int detail, Bool doAncestor) { if (child == NullWindow) return ancestor == NullWindow; if (ancestor == child) { if (doAncestor) FocusEvent(dev, FocusIn, mode, detail, child); return TRUE; } if (FocusInEvents(dev, ancestor, child->parent, skipChild, mode, detail, doAncestor)) { if (child != skipChild) FocusEvent(dev, FocusIn, mode, detail, child); return TRUE; } return FALSE; } /* dies horribly if ancestor is not an ancestor of child */ static void FocusOutEvents( DeviceIntPtr dev, WindowPtr child, WindowPtr ancestor, int mode, int detail, Bool doAncestor) { register WindowPtr pWin; for (pWin = child; pWin != ancestor; pWin = pWin->parent) FocusEvent(dev, FocusOut, mode, detail, pWin); if (doAncestor) FocusEvent(dev, FocusOut, mode, detail, ancestor); } void DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode) { int out, in; /* for holding details for to/from PointerRoot/None */ int i; if (fromWin == toWin) return; out = (fromWin == NoneWin) ? NotifyDetailNone : NotifyPointerRoot; in = (toWin == NoneWin) ? NotifyDetailNone : NotifyPointerRoot; /* wrong values if neither, but then not referenced */ if ((toWin == NullWindow) || (toWin == PointerRootWin)) { if ((fromWin == NullWindow) || (fromWin == PointerRootWin)) { if (fromWin == PointerRootWin) FocusOutEvents(dev, sprite.win, ROOT, mode, NotifyPointer, TRUE); /* Notify all the roots */ #ifdef PANORAMIX if ( !noPanoramiXExtension ) FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[0]->root); else #endif for (i=0; iroot); } else { if (IsParent(fromWin, sprite.win)) FocusOutEvents(dev, sprite.win, fromWin, mode, NotifyPointer, FALSE); FocusEvent(dev, FocusOut, mode, NotifyNonlinear, fromWin); /* next call catches the root too, if the screen changed */ FocusOutEvents(dev, fromWin->parent, NullWindow, mode, NotifyNonlinearVirtual, FALSE); } /* Notify all the roots */ #ifdef PANORAMIX if ( !noPanoramiXExtension ) FocusEvent(dev, FocusIn, mode, in, screenInfo.screens[0]->root); else #endif for (i=0; iroot); if (toWin == PointerRootWin) (void)FocusInEvents(dev, ROOT, sprite.win, NullWindow, mode, NotifyPointer, TRUE); } else { if ((fromWin == NullWindow) || (fromWin == PointerRootWin)) { if (fromWin == PointerRootWin) FocusOutEvents(dev, sprite.win, ROOT, mode, NotifyPointer, TRUE); #ifdef PANORAMIX if ( !noPanoramiXExtension ) FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[0]->root); else #endif for (i=0; iroot); if (toWin->parent != NullWindow) (void)FocusInEvents(dev, ROOT, toWin, toWin, mode, NotifyNonlinearVirtual, TRUE); FocusEvent(dev, FocusIn, mode, NotifyNonlinear, toWin); if (IsParent(toWin, sprite.win)) (void)FocusInEvents(dev, toWin, sprite.win, NullWindow, mode, NotifyPointer, FALSE); } else { if (IsParent(toWin, fromWin)) { FocusEvent(dev, FocusOut, mode, NotifyAncestor, fromWin); FocusOutEvents(dev, fromWin->parent, toWin, mode, NotifyVirtual, FALSE); FocusEvent(dev, FocusIn, mode, NotifyInferior, toWin); if ((IsParent(toWin, sprite.win)) && (sprite.win != fromWin) && (!IsParent(fromWin, sprite.win)) && (!IsParent(sprite.win, fromWin))) (void)FocusInEvents(dev, toWin, sprite.win, NullWindow, mode, NotifyPointer, FALSE); } else if (IsParent(fromWin, toWin)) { if ((IsParent(fromWin, sprite.win)) && (sprite.win != fromWin) && (!IsParent(toWin, sprite.win)) && (!IsParent(sprite.win, toWin))) FocusOutEvents(dev, sprite.win, fromWin, mode, NotifyPointer, FALSE); FocusEvent(dev, FocusOut, mode, NotifyInferior, fromWin); (void)FocusInEvents(dev, fromWin, toWin, toWin, mode, NotifyVirtual, FALSE); FocusEvent(dev, FocusIn, mode, NotifyAncestor, toWin); } else { /* neither fromWin or toWin is child of other */ WindowPtr common = CommonAncestor(toWin, fromWin); /* common == NullWindow ==> different screens */ if (IsParent(fromWin, sprite.win)) FocusOutEvents(dev, sprite.win, fromWin, mode, NotifyPointer, FALSE); FocusEvent(dev, FocusOut, mode, NotifyNonlinear, fromWin); if (fromWin->parent != NullWindow) FocusOutEvents(dev, fromWin->parent, common, mode, NotifyNonlinearVirtual, FALSE); if (toWin->parent != NullWindow) (void)FocusInEvents(dev, common, toWin, toWin, mode, NotifyNonlinearVirtual, FALSE); FocusEvent(dev, FocusIn, mode, NotifyNonlinear, toWin); if (IsParent(toWin, sprite.win)) (void)FocusInEvents(dev, toWin, sprite.win, NullWindow, mode, NotifyPointer, FALSE); } } } } int SetInputFocus( ClientPtr client, DeviceIntPtr dev, Window focusID, CARD8 revertTo, Time ctime, Bool followOK) { register FocusClassPtr focus; register WindowPtr focusWin; int mode; TimeStamp time; UpdateCurrentTime(); if ((revertTo != RevertToParent) && (revertTo != RevertToPointerRoot) && (revertTo != RevertToNone) && ((revertTo != RevertToFollowKeyboard) || !followOK)) { client->errorValue = revertTo; return BadValue; } time = ClientTimeToServerTime(ctime); if ((focusID == None) || (focusID == PointerRoot)) focusWin = (WindowPtr)(long)focusID; else if ((focusID == FollowKeyboard) && followOK) focusWin = inputInfo.keyboard->focus->win; else if (!(focusWin = SecurityLookupWindow(focusID, client, DixReadAccess))) return BadWindow; else { /* It is a match error to try to set the input focus to an unviewable window. */ if(!focusWin->realized) return(BadMatch); } focus = dev->focus; if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, focus->time) == EARLIER)) return Success; mode = (dev->grab) ? NotifyWhileGrabbed : NotifyNormal; if (focus->win == FollowKeyboardWin) DoFocusEvents(dev, inputInfo.keyboard->focus->win, focusWin, mode); else DoFocusEvents(dev, focus->win, focusWin, mode); focus->time = time; focus->revert = revertTo; if (focusID == FollowKeyboard) focus->win = FollowKeyboardWin; else focus->win = focusWin; if ((focusWin == NoneWin) || (focusWin == PointerRootWin)) focus->traceGood = 0; else { int depth = 0; register WindowPtr pWin; for (pWin = focusWin; pWin; pWin = pWin->parent) depth++; if (depth > focus->traceSize) { focus->traceSize = depth+1; focus->trace = realloc(focus->trace, focus->traceSize * sizeof(WindowPtr)); } focus->traceGood = depth; for (pWin = focusWin, depth--; pWin; pWin = pWin->parent, depth--) focus->trace[depth] = pWin; } return Success; } int ProcSetInputFocus(client) ClientPtr client; { REQUEST(xSetInputFocusReq); REQUEST_SIZE_MATCH(xSetInputFocusReq); #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) return Success; #endif return SetInputFocus(client, inputInfo.keyboard, stuff->focus, stuff->revertTo, stuff->time, FALSE); } int ProcGetInputFocus(ClientPtr client) { xGetInputFocusReply rep; /* REQUEST(xReq); */ FocusClassPtr focus = inputInfo.keyboard->focus; REQUEST_SIZE_MATCH(xReq); memset(&rep, 0, sizeof(xGetInputFocusReply)); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; if (focus->win == NoneWin) rep.focus = None; else if (focus->win == PointerRootWin) rep.focus = PointerRoot; else rep.focus = focus->win->drawable.id; rep.revertTo = focus->revert; WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep); return Success; } int ProcGrabPointer(ClientPtr client) { xGrabPointerReply rep; DeviceIntPtr device = inputInfo.pointer; GrabPtr grab; WindowPtr pWin, confineTo; CursorPtr cursor, oldCursor; REQUEST(xGrabPointerReq); TimeStamp time; REQUEST_SIZE_MATCH(xGrabPointerReq); UpdateCurrentTime(); if ((stuff->pointerMode != GrabModeSync) && (stuff->pointerMode != GrabModeAsync)) { client->errorValue = stuff->pointerMode; return BadValue; } if ((stuff->keyboardMode != GrabModeSync) && (stuff->keyboardMode != GrabModeAsync)) { client->errorValue = stuff->keyboardMode; return BadValue; } if ((stuff->ownerEvents != xFalse) && (stuff->ownerEvents != xTrue)) { client->errorValue = stuff->ownerEvents; return BadValue; } if (stuff->eventMask & ~PointerGrabMask) { client->errorValue = stuff->eventMask; return BadValue; } pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); if (!pWin) return BadWindow; if (stuff->confineTo == None) confineTo = NullWindow; else { confineTo = SecurityLookupWindow(stuff->confineTo, client, DixReadAccess); if (!confineTo) return BadWindow; } if (stuff->cursor == None) cursor = NullCursor; else { cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, RT_CURSOR, DixReadAccess); if (!cursor) { client->errorValue = stuff->cursor; return BadCursor; } } /* at this point, some sort of reply is guaranteed. */ time = ClientTimeToServerTime(stuff->time); memset(&rep, 0, sizeof(xGrabPointerReply)); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; grab = device->grab; if ((grab) && !SameClient(grab, client)) rep.status = AlreadyGrabbed; else if ((!pWin->realized) || (confineTo && !(confineTo->realized && BorderSizeNotEmpty(confineTo)))) rep.status = GrabNotViewable; else if (device->sync.frozen && device->sync.other && !SameClient(device->sync.other, client)) rep.status = GrabFrozen; else if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, device->grabTime) == EARLIER)) rep.status = GrabInvalidTime; else { GrabRec tempGrab; oldCursor = NullCursor; if (grab) { if (grab->confineTo && !confineTo) ConfineCursorToWindow(ROOT, FALSE, FALSE); oldCursor = grab->cursor; } tempGrab.cursor = cursor; tempGrab.resource = client->clientAsMask; tempGrab.ownerEvents = stuff->ownerEvents; tempGrab.eventMask = stuff->eventMask; tempGrab.confineTo = confineTo; tempGrab.window = pWin; tempGrab.keyboardMode = stuff->keyboardMode; tempGrab.pointerMode = stuff->pointerMode; tempGrab.device = device; (*device->ActivateGrab)(device, &tempGrab, time, FALSE); if (oldCursor) FreeCursor (oldCursor, (Cursor)0); rep.status = GrabSuccess; } WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep); return Success; } int ProcChangeActivePointerGrab(ClientPtr client) { DeviceIntPtr device = inputInfo.pointer; register GrabPtr grab = device->grab; CursorPtr newCursor, oldCursor; REQUEST(xChangeActivePointerGrabReq); TimeStamp time; REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq); if (stuff->eventMask & ~PointerGrabMask) { client->errorValue = stuff->eventMask; return BadValue; } if (stuff->cursor == None) newCursor = NullCursor; else { newCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, RT_CURSOR, DixReadAccess); if (!newCursor) { client->errorValue = stuff->cursor; return BadCursor; } } if (!grab) return Success; if (!SameClient(grab, client)) return Success; time = ClientTimeToServerTime(stuff->time); if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, device->grabTime) == EARLIER)) return Success; oldCursor = grab->cursor; grab->cursor = newCursor; if (newCursor) newCursor->refcnt++; PostNewCursor(); if (oldCursor) FreeCursor(oldCursor, (Cursor)0); grab->eventMask = stuff->eventMask; return Success; } int ProcUngrabPointer(ClientPtr client) { DeviceIntPtr device = inputInfo.pointer; GrabPtr grab; TimeStamp time; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); UpdateCurrentTime(); grab = device->grab; time = ClientTimeToServerTime(stuff->id); if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, device->grabTime) != EARLIER) && (grab) && SameClient(grab, client)) (*device->DeactivateGrab)(device); return Success; } int GrabDevice(register ClientPtr client, register DeviceIntPtr dev, unsigned this_mode, unsigned other_mode, Window grabWindow, unsigned ownerEvents, Time ctime, Mask mask, CARD8 *status) { register WindowPtr pWin; register GrabPtr grab; TimeStamp time; UpdateCurrentTime(); if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync)) { client->errorValue = this_mode; return BadValue; } if ((other_mode != GrabModeSync) && (other_mode != GrabModeAsync)) { client->errorValue = other_mode; return BadValue; } if ((ownerEvents != xFalse) && (ownerEvents != xTrue)) { client->errorValue = ownerEvents; return BadValue; } pWin = SecurityLookupWindow(grabWindow, client, DixReadAccess); if (!pWin) return BadWindow; time = ClientTimeToServerTime(ctime); grab = dev->grab; if (grab && !SameClient(grab, client)) *status = AlreadyGrabbed; else if (!pWin->realized) *status = GrabNotViewable; else if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, dev->grabTime) == EARLIER)) *status = GrabInvalidTime; else if (dev->sync.frozen && dev->sync.other && !SameClient(dev->sync.other, client)) *status = GrabFrozen; else { GrabRec tempGrab; tempGrab.window = pWin; tempGrab.resource = client->clientAsMask; tempGrab.ownerEvents = ownerEvents; tempGrab.keyboardMode = this_mode; tempGrab.pointerMode = other_mode; tempGrab.eventMask = mask; tempGrab.device = dev; (*dev->ActivateGrab)(dev, &tempGrab, time, FALSE); *status = GrabSuccess; } return Success; } int ProcGrabKeyboard(ClientPtr client) { xGrabKeyboardReply rep; REQUEST(xGrabKeyboardReq); int result; REQUEST_SIZE_MATCH(xGrabKeyboardReq); memset(&rep, 0, sizeof(xGrabKeyboardReply)); #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) { result = Success; rep.status = AlreadyGrabbed; } else #endif result = GrabDevice(client, inputInfo.keyboard, stuff->keyboardMode, stuff->pointerMode, stuff->grabWindow, stuff->ownerEvents, stuff->time, KeyPressMask | KeyReleaseMask, &rep.status); if (result != Success) return result; rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep); return Success; } int ProcUngrabKeyboard(ClientPtr client) { DeviceIntPtr device = inputInfo.keyboard; GrabPtr grab; TimeStamp time; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); UpdateCurrentTime(); grab = device->grab; time = ClientTimeToServerTime(stuff->id); if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, device->grabTime) != EARLIER) && (grab) && SameClient(grab, client)) (*device->DeactivateGrab)(device); return Success; } int ProcQueryPointer(ClientPtr client) { xQueryPointerReply rep; WindowPtr pWin, t; REQUEST(xResourceReq); DeviceIntPtr mouse = inputInfo.pointer; REQUEST_SIZE_MATCH(xResourceReq); pWin = SecurityLookupWindow(stuff->id, client, DixReadAccess); if (!pWin) return BadWindow; if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); memset(&rep, 0, sizeof(xQueryPointerReply)); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.mask = mouse->button->state | inputInfo.keyboard->key->state; rep.length = 0; rep.root = (ROOT)->drawable.id; rep.rootX = sprite.hot.x; rep.rootY = sprite.hot.y; rep.child = None; if (sprite.hot.pScreen == pWin->drawable.pScreen) { rep.sameScreen = xTrue; rep.winX = sprite.hot.x - pWin->drawable.x; rep.winY = sprite.hot.y - pWin->drawable.y; for (t = sprite.win; t; t = t->parent) if (t->parent == pWin) { rep.child = t->drawable.id; break; } } else { rep.sameScreen = xFalse; rep.winX = 0; rep.winY = 0; } #ifdef PANORAMIX if(!noPanoramiXExtension) { rep.rootX += panoramiXdataPtr[0].x; rep.rootY += panoramiXdataPtr[0].y; if(stuff->id == rep.root) { rep.winX += panoramiXdataPtr[0].x; rep.winY += panoramiXdataPtr[0].y; } } #endif WriteReplyToClient(client, sizeof(xQueryPointerReply), &rep); return(Success); } void InitEvents() { int i; sprite.hot.pScreen = sprite.hotPhys.pScreen = (ScreenPtr)NULL; inputInfo.numDevices = 0; inputInfo.devices = (DeviceIntPtr)NULL; inputInfo.off_devices = (DeviceIntPtr)NULL; inputInfo.keyboard = (DeviceIntPtr)NULL; inputInfo.pointer = (DeviceIntPtr)NULL; if (spriteTraceSize == 0) { spriteTraceSize = 32; spriteTrace = (WindowPtr *)malloc(32*sizeof(WindowPtr)); if (!spriteTrace) FatalError("failed to allocate spriteTrace"); } spriteTraceGood = 0; lastEventMask = OwnerGrabButtonMask; filters[MotionNotify] = PointerMotionMask; sprite.win = NullWindow; sprite.current = NullCursor; sprite.hotLimits.x1 = 0; sprite.hotLimits.y1 = 0; sprite.hotLimits.x2 = 0; sprite.hotLimits.y2 = 0; sprite.confined = FALSE; syncEvents.replayDev = (DeviceIntPtr)NULL; syncEvents.replayWin = NullWindow; while (syncEvents.pending) { QdEventPtr next = syncEvents.pending->next; free(syncEvents.pending); syncEvents.pending = next; } syncEvents.pendtail = &syncEvents.pending; syncEvents.playingEvents = FALSE; syncEvents.time.months = 0; syncEvents.time.milliseconds = 0; /* hardly matters */ currentTime.months = 0; currentTime.milliseconds = GetTimeInMillis(); lastDeviceEventTime = currentTime; for (i = 0; i < DNPMCOUNT; i++) { DontPropagateMasks[i] = 0; DontPropagateRefCnts[i] = 0; } } void CloseDownEvents(void) { free(spriteTrace); spriteTrace = NULL; spriteTraceSize = 0; } int #ifdef NXAGENT_SERVER xorg_ProcSendEvent(ClientPtr client) #else ProcSendEvent(ClientPtr client) #endif { WindowPtr pWin; WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */ REQUEST(xSendEventReq); REQUEST_SIZE_MATCH(xSendEventReq); /* The client's event type must be a core event type or one defined by an extension. */ if ( ! ((stuff->event.u.u.type > X_Reply && stuff->event.u.u.type < LASTEvent) || (stuff->event.u.u.type >= EXTENSION_EVENT_BASE && stuff->event.u.u.type < (unsigned)lastEvent))) { client->errorValue = stuff->event.u.u.type; return BadValue; } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32) { client->errorValue = stuff->event.u.u.detail; return BadValue; } if (stuff->eventMask & ~AllEventMasks) { client->errorValue = stuff->eventMask; return BadValue; } if (stuff->destination == PointerWindow) pWin = sprite.win; else if (stuff->destination == InputFocus) { WindowPtr inputFocus = inputInfo.keyboard->focus->win; if (inputFocus == NoneWin) return Success; /* If the input focus is PointerRootWin, send the event to where the pointer is if possible, then perhaps propogate up to root. */ if (inputFocus == PointerRootWin) inputFocus = ROOT; if (IsParent(inputFocus, sprite.win)) { effectiveFocus = inputFocus; pWin = sprite.win; } else effectiveFocus = pWin = inputFocus; } else pWin = SecurityLookupWindow(stuff->destination, client, DixReadAccess); if (!pWin) return BadWindow; if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue)) { client->errorValue = stuff->propagate; return BadValue; } stuff->event.u.u.type |= 0x80; if (stuff->propagate) { for (;pWin; pWin = pWin->parent) { if (DeliverEventsToWindow(pWin, &stuff->event, 1, stuff->eventMask, NullGrab, 0)) return Success; if (pWin == effectiveFocus) return Success; stuff->eventMask &= ~wDontPropagateMask(pWin); if (!stuff->eventMask) break; } } else (void)DeliverEventsToWindow(pWin, &stuff->event, 1, stuff->eventMask, NullGrab, 0); return Success; } int ProcUngrabKey(ClientPtr client) { REQUEST(xUngrabKeyReq); WindowPtr pWin; GrabRec tempGrab; DeviceIntPtr keybd = inputInfo.keyboard; REQUEST_SIZE_MATCH(xUngrabKeyReq); pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); if (!pWin) return BadWindow; if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) || (stuff->key < keybd->key->curKeySyms.minKeyCode)) && (stuff->key != AnyKey)) { client->errorValue = stuff->key; return BadValue; } if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { client->errorValue = stuff->modifiers; return BadValue; } tempGrab.resource = client->clientAsMask; tempGrab.device = keybd; tempGrab.window = pWin; tempGrab.modifiersDetail.exact = stuff->modifiers; tempGrab.modifiersDetail.pMask = NULL; tempGrab.modifierDevice = inputInfo.keyboard; tempGrab.type = KeyPress; tempGrab.detail.exact = stuff->key; tempGrab.detail.pMask = NULL; if (!DeletePassiveGrabFromList(&tempGrab)) return(BadAlloc); return(Success); } int ProcGrabKey(ClientPtr client) { WindowPtr pWin; REQUEST(xGrabKeyReq); GrabPtr grab; DeviceIntPtr keybd = inputInfo.keyboard; REQUEST_SIZE_MATCH(xGrabKeyReq); if ((stuff->ownerEvents != xTrue) && (stuff->ownerEvents != xFalse)) { client->errorValue = stuff->ownerEvents; return(BadValue); } if ((stuff->pointerMode != GrabModeSync) && (stuff->pointerMode != GrabModeAsync)) { client->errorValue = stuff->pointerMode; return BadValue; } if ((stuff->keyboardMode != GrabModeSync) && (stuff->keyboardMode != GrabModeAsync)) { client->errorValue = stuff->keyboardMode; return BadValue; } if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) || (stuff->key < keybd->key->curKeySyms.minKeyCode)) && (stuff->key != AnyKey)) { client->errorValue = stuff->key; return BadValue; } if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { client->errorValue = stuff->modifiers; return BadValue; } pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); if (!pWin) return BadWindow; grab = CreateGrab(client->index, keybd, pWin, (Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents, (Bool)stuff->keyboardMode, (Bool)stuff->pointerMode, keybd, stuff->modifiers, KeyPress, stuff->key, NullWindow, NullCursor); if (!grab) return BadAlloc; return AddPassiveGrabToList(grab); } int ProcGrabButton(ClientPtr client) { WindowPtr pWin, confineTo; REQUEST(xGrabButtonReq); CursorPtr cursor; GrabPtr grab; REQUEST_SIZE_MATCH(xGrabButtonReq); if ((stuff->pointerMode != GrabModeSync) && (stuff->pointerMode != GrabModeAsync)) { client->errorValue = stuff->pointerMode; return BadValue; } if ((stuff->keyboardMode != GrabModeSync) && (stuff->keyboardMode != GrabModeAsync)) { client->errorValue = stuff->keyboardMode; return BadValue; } if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { client->errorValue = stuff->modifiers; return BadValue; } if ((stuff->ownerEvents != xFalse) && (stuff->ownerEvents != xTrue)) { client->errorValue = stuff->ownerEvents; return BadValue; } if (stuff->eventMask & ~PointerGrabMask) { client->errorValue = stuff->eventMask; return BadValue; } pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); if (!pWin) return BadWindow; if (stuff->confineTo == None) confineTo = NullWindow; else { confineTo = SecurityLookupWindow(stuff->confineTo, client, DixReadAccess); if (!confineTo) return BadWindow; } if (stuff->cursor == None) cursor = NullCursor; else { cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, RT_CURSOR, DixReadAccess); if (!cursor) { client->errorValue = stuff->cursor; return BadCursor; } } grab = CreateGrab(client->index, inputInfo.pointer, pWin, (Mask)stuff->eventMask, (Bool)stuff->ownerEvents, (Bool) stuff->keyboardMode, (Bool)stuff->pointerMode, inputInfo.keyboard, stuff->modifiers, ButtonPress, stuff->button, confineTo, cursor); if (!grab) return BadAlloc; return AddPassiveGrabToList(grab); } int ProcUngrabButton(ClientPtr client) { REQUEST(xUngrabButtonReq); WindowPtr pWin; GrabRec tempGrab; REQUEST_SIZE_MATCH(xUngrabButtonReq); if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { client->errorValue = stuff->modifiers; return BadValue; } pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); if (!pWin) return BadWindow; tempGrab.resource = client->clientAsMask; tempGrab.device = inputInfo.pointer; tempGrab.window = pWin; tempGrab.modifiersDetail.exact = stuff->modifiers; tempGrab.modifiersDetail.pMask = NULL; tempGrab.modifierDevice = inputInfo.keyboard; tempGrab.type = ButtonPress; tempGrab.detail.exact = stuff->button; tempGrab.detail.pMask = NULL; if (!DeletePassiveGrabFromList(&tempGrab)) return(BadAlloc); return(Success); } void DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources) { WindowPtr parent; DeviceIntPtr mouse = inputInfo.pointer; DeviceIntPtr keybd = inputInfo.keyboard; FocusClassPtr focus = keybd->focus; OtherClientsPtr oc; GrabPtr passive; /* Deactivate any grabs performed on this window, before making any input focus changes. */ if (mouse->grab && ((mouse->grab->window == pWin) || (mouse->grab->confineTo == pWin))) (*mouse->DeactivateGrab)(mouse); /* Deactivating a keyboard grab should cause focus events. */ if (keybd->grab && (keybd->grab->window == pWin)) (*keybd->DeactivateGrab)(keybd); /* If the focus window is a root window (ie. has no parent) then don't delete the focus from it. */ if ((pWin == focus->win) && (pWin->parent != NullWindow)) { int focusEventMode = NotifyNormal; /* If a grab is in progress, then alter the mode of focus events. */ if (keybd->grab) focusEventMode = NotifyWhileGrabbed; switch (focus->revert) { case RevertToNone: DoFocusEvents(keybd, pWin, NoneWin, focusEventMode); focus->win = NoneWin; focus->traceGood = 0; break; case RevertToParent: parent = pWin; do { parent = parent->parent; focus->traceGood--; } while (!parent->realized /* This would be a good protocol change -- windows being reparented during SaveSet processing would cause the focus to revert to the nearest enclosing window which will survive the death of the exiting client, instead of ending up reverting to a dying window and thence to None */ #ifdef NOTDEF || clients[CLIENT_ID(parent->drawable.id)]->clientGone #endif ); DoFocusEvents(keybd, pWin, parent, focusEventMode); focus->win = parent; focus->revert = RevertToNone; break; case RevertToPointerRoot: DoFocusEvents(keybd, pWin, PointerRootWin, focusEventMode); focus->win = PointerRootWin; focus->traceGood = 0; break; } } if (mouse->valuator->motionHintWindow == pWin) mouse->valuator->motionHintWindow = NullWindow; if (freeResources) { if (pWin->dontPropagate) DontPropagateRefCnts[pWin->dontPropagate]--; while ( (oc = wOtherClients(pWin)) ) FreeResource(oc->resource, RT_NONE); while ( (passive = wPassiveGrabs(pWin)) ) FreeResource(passive->resource, RT_NONE); } #ifdef XINPUT DeleteWindowFromAnyExtEvents(pWin, freeResources); #endif } /** * Call this whenever some window at or below pWin has changed geometry */ void CheckCursorConfinement(WindowPtr pWin) { GrabPtr grab = inputInfo.pointer->grab; WindowPtr confineTo; #ifdef PANORAMIX if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return; #endif if (grab && (confineTo = grab->confineTo)) { if (!BorderSizeNotEmpty(confineTo)) (*inputInfo.pointer->DeactivateGrab)(inputInfo.pointer); else if ((pWin == confineTo) || IsParent(pWin, confineTo)) ConfineCursorToWindow(confineTo, TRUE, TRUE); } } Mask EventMaskForClient(WindowPtr pWin, ClientPtr client) { register OtherClientsPtr other; if (wClient (pWin) == client) return pWin->eventMask; for (other = wOtherClients(pWin); other; other = other->next) { if (SameClient(other, client)) return other->mask; } return 0; } int ProcRecolorCursor(ClientPtr client) { CursorPtr pCursor; int nscr; ScreenPtr pscr; Bool displayed; REQUEST(xRecolorCursorReq); REQUEST_SIZE_MATCH(xRecolorCursorReq); pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, RT_CURSOR, DixWriteAccess); if ( !pCursor) { client->errorValue = stuff->cursor; return (BadCursor); } pCursor->foreRed = stuff->foreRed; pCursor->foreGreen = stuff->foreGreen; pCursor->foreBlue = stuff->foreBlue; pCursor->backRed = stuff->backRed; pCursor->backGreen = stuff->backGreen; pCursor->backBlue = stuff->backBlue; for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { pscr = screenInfo.screens[nscr]; #ifdef PANORAMIX if(!noPanoramiXExtension) displayed = (pscr == sprite.screen); else #endif displayed = (pscr == sprite.hotPhys.pScreen); ( *pscr->RecolorCursor)(pscr, pCursor, (pCursor == sprite.current) && displayed); } return (Success); } void WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) { #ifdef PANORAMIX xEvent eventCopy; #endif xEvent eventTo, *eventFrom; int i; if (!pClient || pClient == serverClient || pClient->clientGone) return; for (i = 0; i < count; i++) if ((events[i].u.u.type & 0x7f) != KeymapNotify) events[i].u.u.sequenceNumber = pClient->sequence; #ifdef XKB if ((!noXkbExtension)&&(!XkbFilterEvents(pClient, count, events))) return; #endif #ifdef PANORAMIX if(!noPanoramiXExtension && (panoramiXdataPtr[0].x || panoramiXdataPtr[0].y)) { switch(events->u.u.type) { case MotionNotify: case ButtonPress: case ButtonRelease: case KeyPress: case KeyRelease: case EnterNotify: case LeaveNotify: /* When multiple clients want the same event DeliverEventsToWindow passes the same event structure multiple times so we can't modify the one passed to us */ count = 1; /* should always be 1 */ memcpy(&eventCopy, events, sizeof(xEvent)); eventCopy.u.keyButtonPointer.rootX += panoramiXdataPtr[0].x; eventCopy.u.keyButtonPointer.rootY += panoramiXdataPtr[0].y; if(eventCopy.u.keyButtonPointer.event == eventCopy.u.keyButtonPointer.root) { eventCopy.u.keyButtonPointer.eventX += panoramiXdataPtr[0].x; eventCopy.u.keyButtonPointer.eventY += panoramiXdataPtr[0].y; } events = &eventCopy; break; default: break; } } #endif if (EventCallback) { EventInfoRec eventinfo; eventinfo.client = pClient; eventinfo.events = events; eventinfo.count = count; CallCallbacks(&EventCallback, (void *)&eventinfo); } if(pClient->swapped) { for(i = 0; i < count; i++) { eventFrom = &events[i]; /* Remember to strip off the leading bit of type in case this event was sent with "SendEvent." */ (*EventSwapVector[eventFrom->u.u.type & 0177]) (eventFrom, &eventTo); WriteToClient(pClient, sizeof(xEvent), &eventTo); } } else { WriteToClient(pClient, count * sizeof(xEvent), events); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/extension.c0000644000000000000000000003164313614532331017546 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" #include "gcstruct.h" #include "scrnintstr.h" #include "dispatch.h" #ifdef XCSECURITY #define _SECURITY_SERVER #include #endif #define EXTENSION_BASE 128 #define EXTENSION_EVENT_BASE 64 #define LAST_EVENT 128 #define LAST_ERROR 255 ScreenProcEntry AuxillaryScreenProcs[MAXSCREENS]; static ExtensionEntry **extensions = (ExtensionEntry **)NULL; int lastEvent = EXTENSION_EVENT_BASE; static int lastError = FirstExtensionError; static unsigned int NumExtensions = 0; extern int extensionPrivateLen; extern unsigned *extensionPrivateSizes; extern unsigned totalExtensionSize; static void InitExtensionPrivates(ExtensionEntry *ext) { register char *ptr; DevUnion *ppriv; register unsigned *sizes; register unsigned size; register int i; if (totalExtensionSize == sizeof(ExtensionEntry)) ppriv = (DevUnion *)NULL; else ppriv = (DevUnion *)(ext + 1); ext->devPrivates = ppriv; sizes = extensionPrivateSizes; ptr = (char *)(ppriv + extensionPrivateLen); for (i = extensionPrivateLen; --i >= 0; ppriv++, sizes++) { if ( (size = *sizes) ) { ppriv->ptr = (void *)ptr; ptr += size; } else ppriv->ptr = (void *)NULL; } } ExtensionEntry * AddExtension(char *name, int NumEvents, int NumErrors, int (*MainProc)(ClientPtr c1), int (*SwappedMainProc)(ClientPtr c2), void (*CloseDownProc)(ExtensionEntry *e), unsigned short (*MinorOpcodeProc)(ClientPtr c3)) { int i; register ExtensionEntry *ext, **newexts; if (!MainProc || !SwappedMainProc || !MinorOpcodeProc) return((ExtensionEntry *) NULL); if ((lastEvent + NumEvents > LAST_EVENT) || (unsigned)(lastError + NumErrors > LAST_ERROR)) return((ExtensionEntry *) NULL); ext = (ExtensionEntry *) malloc(totalExtensionSize); if (!ext) return((ExtensionEntry *) NULL); bzero(ext, totalExtensionSize); InitExtensionPrivates(ext); ext->name = (char *)malloc(strlen(name) + 1); ext->num_aliases = 0; ext->aliases = (char **)NULL; if (!ext->name) { free(ext); return((ExtensionEntry *) NULL); } strcpy(ext->name, name); i = NumExtensions; newexts = (ExtensionEntry **) realloc(extensions, (i + 1) * sizeof(ExtensionEntry *)); if (!newexts) { free(ext->name); free(ext); return((ExtensionEntry *) NULL); } NumExtensions++; extensions = newexts; extensions[i] = ext; ext->index = i; ext->base = i + EXTENSION_BASE; ext->CloseDown = CloseDownProc; ext->MinorOpcode = MinorOpcodeProc; ProcVector[i + EXTENSION_BASE] = MainProc; SwappedProcVector[i + EXTENSION_BASE] = SwappedMainProc; if (NumEvents) { ext->eventBase = lastEvent; ext->eventLast = lastEvent + NumEvents; lastEvent += NumEvents; } else { ext->eventBase = 0; ext->eventLast = 0; } if (NumErrors) { ext->errorBase = lastError; ext->errorLast = lastError + NumErrors; lastError += NumErrors; } else { ext->errorBase = 0; ext->errorLast = 0; } #ifdef XCSECURITY ext->secure = FALSE; #endif return(ext); } Bool AddExtensionAlias(char *alias, ExtensionEntry *ext) { char *name; char **aliases; aliases = (char **)realloc(ext->aliases, (ext->num_aliases + 1) * sizeof(char *)); if (!aliases) return FALSE; ext->aliases = aliases; name = (char *)malloc(strlen(alias) + 1); if (!name) return FALSE; strcpy(name, alias); ext->aliases[ext->num_aliases] = name; ext->num_aliases++; return TRUE; } static int FindExtension(char *extname, int len) { int i, j; for (i=0; iname) == len) && !strncmp(extname, extensions[i]->name, len)) break; for (j = extensions[i]->num_aliases; --j >= 0;) { if ((strlen(extensions[i]->aliases[j]) == len) && !strncmp(extname, extensions[i]->aliases[j], len)) break; } if (j >= 0) break; } return ((i == NumExtensions) ? -1 : i); } /* * CheckExtension returns the extensions[] entry for the requested * extension name. Maybe this could just return a Bool instead? */ ExtensionEntry * CheckExtension(const char *extname) { int n; n = FindExtension((char*)extname, strlen(extname)); if (n != -1) return extensions[n]; else return NULL; } /* * Added as part of Xace. */ ExtensionEntry * GetExtensionEntry(int major) { if (major < EXTENSION_BASE) return NULL; major -= EXTENSION_BASE; if (major >= NumExtensions) return NULL; return extensions[major]; } void DeclareExtensionSecurity(char *extname, Bool secure) { #ifdef XCSECURITY int i = FindExtension(extname, strlen(extname)); if (i >= 0) { int majorop = extensions[i]->base; extensions[i]->secure = secure; if (secure) { UntrustedProcVector[majorop] = ProcVector[majorop]; SwappedUntrustedProcVector[majorop] = SwappedProcVector[majorop]; } else { UntrustedProcVector[majorop] = ProcBadRequest; SwappedUntrustedProcVector[majorop] = ProcBadRequest; } } #endif } unsigned short StandardMinorOpcode(ClientPtr client) { return ((xReq *)client->requestBuffer)->data; } unsigned short MinorOpcodeOfRequest(ClientPtr client) { unsigned char major; major = ((xReq *)client->requestBuffer)->reqType; if (major < EXTENSION_BASE) return 0; major -= EXTENSION_BASE; if (major >= NumExtensions) return 0; return (*extensions[major]->MinorOpcode)(client); } void CloseDownExtensions() { register int i,j; for (i = NumExtensions - 1; i >= 0; i--) { if (extensions[i]->CloseDown) (* extensions[i]->CloseDown)(extensions[i]); NumExtensions = i; free(extensions[i]->name); for (j = extensions[i]->num_aliases; --j >= 0;) free(extensions[i]->aliases[j]); free(extensions[i]->aliases); free(extensions[i]); } free(extensions); extensions = (ExtensionEntry **)NULL; lastEvent = EXTENSION_EVENT_BASE; lastError = FirstExtensionError; for (i=0; inum) { spentry->num--; free(spentry->procList[spentry->num].name); } free(spentry->procList); spentry->procList = (ProcEntryPtr)NULL; } } int ProcQueryExtension(ClientPtr client) { xQueryExtensionReply reply; int i; REQUEST(xQueryExtensionReq); REQUEST_FIXED_SIZE(xQueryExtensionReq, stuff->nbytes); memset(&reply, 0, sizeof(xQueryExtensionReply)); reply.type = X_Reply; reply.length = 0; reply.major_opcode = 0; reply.sequenceNumber = client->sequence; if ( ! NumExtensions ) reply.present = xFalse; else { i = FindExtension((char *)&stuff[1], stuff->nbytes); if (i < 0 #ifdef XCSECURITY /* don't show insecure extensions to untrusted clients */ || (client->trustLevel == XSecurityClientUntrusted && !extensions[i]->secure) #endif ) reply.present = xFalse; else { reply.present = xTrue; reply.major_opcode = extensions[i]->base; reply.first_event = extensions[i]->eventBase; reply.first_error = extensions[i]->errorBase; } } WriteReplyToClient(client, sizeof(xQueryExtensionReply), &reply); return(client->noClientException); } int ProcListExtensions(ClientPtr client) { xListExtensionsReply reply; char *bufptr, *buffer; int total_length = 0; REQUEST_SIZE_MATCH(xReq); memset(&reply, 0, sizeof(xListExtensionsReply)); reply.type = X_Reply; reply.nExtensions = 0; reply.length = 0; reply.sequenceNumber = client->sequence; buffer = NULL; if ( NumExtensions ) { register int i, j; for (i=0; itrustLevel == XSecurityClientUntrusted && !extensions[i]->secure) continue; #endif total_length += strlen(extensions[i]->name) + 1; reply.nExtensions += 1 + extensions[i]->num_aliases; for (j = extensions[i]->num_aliases; --j >= 0;) total_length += strlen(extensions[i]->aliases[j]) + 1; } reply.length = (total_length + 3) >> 2; buffer = bufptr = (char *)malloc(total_length); if (!buffer) return(BadAlloc); for (i=0; itrustLevel == XSecurityClientUntrusted && !extensions[i]->secure) continue; #endif *bufptr++ = len = strlen(extensions[i]->name); memmove(bufptr, extensions[i]->name, len); bufptr += len; for (j = extensions[i]->num_aliases; --j >= 0;) { *bufptr++ = len = strlen(extensions[i]->aliases[j]); memmove(bufptr, extensions[i]->aliases[j], len); bufptr += len; } } } WriteReplyToClient(client, sizeof(xListExtensionsReply), &reply); if (reply.length) { WriteToClient(client, total_length, buffer); free(buffer); } return(client->noClientException); } ExtensionLookupProc LookupProc(char *name, GCPtr pGC) { register int i; register ScreenProcEntry *spentry; spentry = &AuxillaryScreenProcs[pGC->pScreen->myNum]; if (spentry->num) { for (i = 0; i < spentry->num; i++) if (strcmp(name, spentry->procList[i].name) == 0) return(spentry->procList[i].proc); } return (ExtensionLookupProc)NULL; } Bool RegisterProc(char *name, GC *pGC, ExtensionLookupProc proc) { return RegisterScreenProc(name, pGC->pScreen, proc); } Bool RegisterScreenProc(char *name, ScreenPtr pScreen, ExtensionLookupProc proc) { register ScreenProcEntry *spentry; register ProcEntryPtr procEntry = (ProcEntryPtr)NULL; char *newname; int i; spentry = &AuxillaryScreenProcs[pScreen->myNum]; /* first replace duplicates */ if (spentry->num) { for (i = 0; i < spentry->num; i++) if (strcmp(name, spentry->procList[i].name) == 0) { procEntry = &spentry->procList[i]; break; } } if (procEntry) procEntry->proc = proc; else { newname = (char *)malloc(strlen(name)+1); if (!newname) return FALSE; procEntry = (ProcEntryPtr) realloc(spentry->procList, sizeof(ProcEntryRec) * (spentry->num+1)); if (!procEntry) { free(newname); return FALSE; } spentry->procList = procEntry; procEntry += spentry->num; procEntry->name = newname; strcpy(newname, name); procEntry->proc = proc; spentry->num++; } return TRUE; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/ffs.c0000644000000000000000000000236713614532331016311 0ustar /* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL- ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ int ffs(int i) { int j; if (i == 0) return 0; for (j = 1; (i & 1) == 0; j++) i >>= 1; return j; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/gc.c0000644000000000000000000007571413614532331016132 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "resource.h" #include "gcstruct.h" #include "pixmapstr.h" #include "dixfontstr.h" #include "scrnintstr.h" #include "region.h" #include "dix.h" #include extern XID clientErrorValue; extern FontPtr defaultFont; static Bool CreateDefaultTile(GCPtr pGC); unsigned char DefaultDash[2] = {4, 4}; void ValidateGC(DrawablePtr pDraw, GC *pGC) { (*pGC->funcs->ValidateGC) (pGC, pGC->stateChanges, pDraw); pGC->stateChanges = 0; pGC->serialNumber = pDraw->serialNumber; } /* dixChangeGC(client, pGC, mask, pC32, pUnion) * * This function was created as part of the Security extension * implementation. The client performing the gc change must be passed so * that access checks can be performed on any tiles, stipples, or fonts * that are specified. ddxen can call this too; they should normally * pass NullClient for the client since any access checking should have * already been done at a higher level. * * Since we had to create a new function anyway, we decided to change the * way the list of gc values is passed to eliminate the compiler warnings * caused by the DoChangeGC interface. You can pass the values via pC32 * or pUnion, but not both; one of them must be NULL. If you don't need * to pass any pointers, you can use either one: * * example calling dixChangeGC using pC32 parameter * * CARD32 v[2]; * v[0] = foreground; * v[1] = background; * dixChangeGC(client, pGC, GCForeground|GCBackground, v, NULL); * * example calling dixChangeGC using pUnion parameter; * same effect as above * * ChangeGCVal v[2]; * v[0].val = foreground; * v[1].val = background; * dixChangeGC(client, pGC, GCForeground|GCBackground, NULL, v); * * However, if you need to pass a pointer to a pixmap or font, you MUST * use the pUnion parameter. * * example calling dixChangeGC passing pointers in the value list * v[1].ptr is a pointer to a pixmap * * ChangeGCVal v[2]; * v[0].val = FillTiled; * v[1].ptr = pPixmap; * dixChangeGC(client, pGC, GCFillStyle|GCTile, NULL, v); * * Note: we could have gotten by with just the pUnion parameter, but on * 64 bit machines that would have forced us to copy the value list that * comes in the ChangeGC request. * * Ideally, we'd change all the DoChangeGC calls to dixChangeGC, but this * is far too many changes to consider at this time, so we've only * changed the ones that caused compiler warnings. New code should use * dixChangeGC. * * dpw */ #define NEXTVAL(_type, _var) { \ if (pC32) _var = (_type)*pC32++; \ else { \ _var = (_type)(pUnion->val); pUnion++; \ } \ } #define NEXT_PTR(_type, _var) { \ assert(pUnion); _var = (_type)pUnion->ptr; pUnion++; } int dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC32, ChangeGCValPtr pUnion) { register BITS32 index2; register int error = 0; PixmapPtr pPixmap; BITS32 maskQ; assert( (pC32 && !pUnion) || (!pC32 && pUnion) ); pGC->serialNumber |= GC_CHANGE_SERIAL_BIT; maskQ = mask; /* save these for when we walk the GCque */ while (mask && !error) { index2 = (BITS32) lowbit (mask); mask &= ~index2; pGC->stateChanges |= index2; switch (index2) { case GCFunction: { CARD8 newalu; NEXTVAL(CARD8, newalu); if (newalu <= GXset) pGC->alu = newalu; else { clientErrorValue = newalu; error = BadValue; } break; } case GCPlaneMask: NEXTVAL(unsigned long, pGC->planemask); break; case GCForeground: NEXTVAL(unsigned long, pGC->fgPixel); /* * this is for CreateGC */ if (!pGC->tileIsPixel && !pGC->tile.pixmap) { pGC->tileIsPixel = TRUE; pGC->tile.pixel = pGC->fgPixel; } break; case GCBackground: NEXTVAL(unsigned long, pGC->bgPixel); break; case GCLineWidth: /* ??? line width is a CARD16 */ NEXTVAL(CARD16, pGC->lineWidth); break; case GCLineStyle: { unsigned int newlinestyle; NEXTVAL(unsigned int, newlinestyle); if (newlinestyle <= LineDoubleDash) pGC->lineStyle = newlinestyle; else { clientErrorValue = newlinestyle; error = BadValue; } break; } case GCCapStyle: { unsigned int newcapstyle; NEXTVAL(unsigned int, newcapstyle); if (newcapstyle <= CapProjecting) pGC->capStyle = newcapstyle; else { clientErrorValue = newcapstyle; error = BadValue; } break; } case GCJoinStyle: { unsigned int newjoinstyle; NEXTVAL(unsigned int, newjoinstyle); if (newjoinstyle <= JoinBevel) pGC->joinStyle = newjoinstyle; else { clientErrorValue = newjoinstyle; error = BadValue; } break; } case GCFillStyle: { unsigned int newfillstyle; NEXTVAL(unsigned int, newfillstyle); if (newfillstyle <= FillOpaqueStippled) pGC->fillStyle = newfillstyle; else { clientErrorValue = newfillstyle; error = BadValue; } break; } case GCFillRule: { unsigned int newfillrule; NEXTVAL(unsigned int, newfillrule); if (newfillrule <= WindingRule) pGC->fillRule = newfillrule; else { clientErrorValue = newfillrule; error = BadValue; } break; } case GCTile: { XID newpix = 0; if (pUnion) { NEXT_PTR(PixmapPtr, pPixmap); } else { NEXTVAL(XID, newpix); pPixmap = (PixmapPtr)SecurityLookupIDByType(client, newpix, RT_PIXMAP, DixReadAccess); } if (pPixmap) { if ((pPixmap->drawable.depth != pGC->depth) || (pPixmap->drawable.pScreen != pGC->pScreen)) { error = BadMatch; } else { pPixmap->refcnt++; if (!pGC->tileIsPixel) (* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap); pGC->tileIsPixel = FALSE; pGC->tile.pixmap = pPixmap; } } else { clientErrorValue = newpix; error = BadPixmap; } break; } case GCStipple: { XID newstipple = 0; if (pUnion) { NEXT_PTR(PixmapPtr, pPixmap); } else { NEXTVAL(XID, newstipple) pPixmap = (PixmapPtr)SecurityLookupIDByType(client, newstipple, RT_PIXMAP, DixReadAccess); } if (pPixmap) { if ((pPixmap->drawable.depth != 1) || (pPixmap->drawable.pScreen != pGC->pScreen)) { error = BadMatch; } else { pPixmap->refcnt++; if (pGC->stipple) (* pGC->pScreen->DestroyPixmap)(pGC->stipple); pGC->stipple = pPixmap; } } else { clientErrorValue = newstipple; error = BadPixmap; } break; } case GCTileStipXOrigin: NEXTVAL(INT16, pGC->patOrg.x); break; case GCTileStipYOrigin: NEXTVAL(INT16, pGC->patOrg.y); break; case GCFont: { FontPtr pFont; XID newfont = 0; if (pUnion) { NEXT_PTR(FontPtr, pFont); } else { NEXTVAL(XID, newfont) pFont = (FontPtr)SecurityLookupIDByType(client, newfont, RT_FONT, DixReadAccess); } if (pFont) { pFont->refcnt++; if (pGC->font) CloseFont(pGC->font, (Font)0); pGC->font = pFont; } else { clientErrorValue = newfont; error = BadFont; } break; } case GCSubwindowMode: { unsigned int newclipmode; NEXTVAL(unsigned int, newclipmode); if (newclipmode <= IncludeInferiors) pGC->subWindowMode = newclipmode; else { clientErrorValue = newclipmode; error = BadValue; } break; } case GCGraphicsExposures: { unsigned int newge; NEXTVAL(unsigned int, newge); if (newge <= xTrue) pGC->graphicsExposures = newge; else { clientErrorValue = newge; error = BadValue; } break; } case GCClipXOrigin: NEXTVAL(INT16, pGC->clipOrg.x); break; case GCClipYOrigin: NEXTVAL(INT16, pGC->clipOrg.y); break; case GCClipMask: { Pixmap pid = 0; int clipType = 0; if (pUnion) { NEXT_PTR(PixmapPtr, pPixmap); } else { NEXTVAL(Pixmap, pid) if (pid == None) { clipType = CT_NONE; pPixmap = NullPixmap; } else pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pid, RT_PIXMAP, DixReadAccess); } if (pPixmap) { if ((pPixmap->drawable.depth != 1) || (pPixmap->drawable.pScreen != pGC->pScreen)) { error = BadMatch; } else { clipType = CT_PIXMAP; pPixmap->refcnt++; } } else if (!pUnion && (pid != None)) { clientErrorValue = pid; error = BadPixmap; } if(error == Success) { (*pGC->funcs->ChangeClip)(pGC, clipType, (void *)pPixmap, 0); } break; } case GCDashOffset: NEXTVAL(INT16, pGC->dashOffset); break; case GCDashList: { CARD8 newdash; NEXTVAL(CARD8, newdash); if (newdash == 4) { if (pGC->dash != DefaultDash) { free(pGC->dash); pGC->numInDashList = 2; pGC->dash = DefaultDash; } } else if (newdash != 0) { unsigned char *dash; dash = (unsigned char *)malloc(2 * sizeof(unsigned char)); if (dash) { if (pGC->dash != DefaultDash) free(pGC->dash); pGC->numInDashList = 2; pGC->dash = dash; dash[0] = newdash; dash[1] = newdash; } else error = BadAlloc; } else { clientErrorValue = newdash; error = BadValue; } break; } case GCArcMode: { unsigned int newarcmode; NEXTVAL(unsigned int, newarcmode); if (newarcmode <= ArcPieSlice) pGC->arcMode = newarcmode; else { clientErrorValue = newarcmode; error = BadValue; } break; } default: clientErrorValue = maskQ; error = BadValue; break; } } /* end while mask && !error */ if (pGC->fillStyle == FillTiled && pGC->tileIsPixel) { if (!CreateDefaultTile (pGC)) { pGC->fillStyle = FillSolid; error = BadAlloc; } } (*pGC->funcs->ChangeGC)(pGC, maskQ); return error; } #undef NEXTVAL #undef NEXT_PTR /* Publically defined entry to ChangeGC. Just calls dixChangeGC and tells * it that all of the entries are constants or IDs */ int ChangeGC(register GC *pGC, register BITS32 mask, XID *pval) { return (dixChangeGC(NullClient, pGC, mask, pval, NULL)); } /* DoChangeGC(pGC, mask, pval, fPointer) mask is a set of bits indicating which values to change. pval contains an appropriate value for each mask. fPointer is true if the values for tiles, stipples, fonts or clipmasks are pointers instead of IDs. Note: if you are passing pointers you MUST declare the array of values as type void*! Other data types may not be large enough to hold pointers on some machines. Yes, this means you have to cast to (XID *) when you pass the array to DoChangeGC. Similarly, if you are not passing pointers (fPointer = 0) you MUST declare the array as type XID (not unsigned long!), or again the wrong size data type may be used. To avoid this cruftiness, use dixChangeGC above. if there is an error, the value is marked as changed anyway, which is probably wrong, but infrequent. NOTE: all values sent over the protocol for ChangeGC requests are 32 bits long */ int DoChangeGC(register GC *pGC, register BITS32 mask, XID *pval, int fPointer) { if (fPointer) /* XXX might be a problem on 64 bit big-endian servers */ return dixChangeGC(NullClient, pGC, mask, NULL, (ChangeGCValPtr)pval); else return dixChangeGC(NullClient, pGC, mask, pval, NULL); } /* CreateGC(pDrawable, mask, pval, pStatus) creates a default GC for the given drawable, using mask to fill in any non-default values. Returns a pointer to the new GC on success, NULL otherwise. returns status of non-default fields in pStatus BUG: should check for failure to create default tile */ static GCPtr AllocateGC(ScreenPtr pScreen) { GCPtr pGC; register char *ptr; register DevUnion *ppriv; register unsigned *sizes; register unsigned size; register int i; pGC = (GCPtr)malloc(pScreen->totalGCSize); if (pGC) { ppriv = (DevUnion *)(pGC + 1); pGC->devPrivates = ppriv; sizes = pScreen->GCPrivateSizes; ptr = (char *)(ppriv + pScreen->GCPrivateLen); for (i = pScreen->GCPrivateLen; --i >= 0; ppriv++, sizes++) { if ( (size = *sizes) ) { ppriv->ptr = (void *)ptr; ptr += size; } else ppriv->ptr = (void *)NULL; } } return pGC; } GCPtr CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus) { register GCPtr pGC; pGC = AllocateGC(pDrawable->pScreen); if (!pGC) { *pStatus = BadAlloc; return (GCPtr)NULL; } pGC->pScreen = pDrawable->pScreen; pGC->depth = pDrawable->depth; pGC->alu = GXcopy; /* dst <- src */ pGC->planemask = ~0; pGC->serialNumber = GC_CHANGE_SERIAL_BIT; pGC->funcs = 0; pGC->fgPixel = 0; pGC->bgPixel = 1; pGC->lineWidth = 0; pGC->lineStyle = LineSolid; pGC->capStyle = CapButt; pGC->joinStyle = JoinMiter; pGC->fillStyle = FillSolid; pGC->fillRule = EvenOddRule; pGC->arcMode = ArcPieSlice; if (mask & GCForeground) { /* * magic special case -- ChangeGC checks for this condition * and snags the Foreground value to create a pseudo default-tile */ pGC->tileIsPixel = FALSE; pGC->tile.pixmap = NullPixmap; } else { pGC->tileIsPixel = TRUE; pGC->tile.pixel = 0; } pGC->patOrg.x = 0; pGC->patOrg.y = 0; pGC->subWindowMode = ClipByChildren; pGC->graphicsExposures = TRUE; pGC->clipOrg.x = 0; pGC->clipOrg.y = 0; pGC->clientClipType = CT_NONE; pGC->clientClip = (void *)NULL; pGC->numInDashList = 2; pGC->dash = DefaultDash; pGC->dashOffset = 0; pGC->lastWinOrg.x = 0; pGC->lastWinOrg.y = 0; /* use the default font and stipple */ pGC->font = defaultFont; defaultFont->refcnt++; pGC->stipple = pGC->pScreen->PixmapPerDepth[0]; pGC->stipple->refcnt++; pGC->stateChanges = (1 << (GCLastBit+1)) - 1; if (!(*pGC->pScreen->CreateGC)(pGC)) *pStatus = BadAlloc; else if (mask) *pStatus = ChangeGC(pGC, mask, pval); else *pStatus = Success; if (*pStatus != Success) { if (!pGC->tileIsPixel && !pGC->tile.pixmap) pGC->tileIsPixel = TRUE; /* undo special case */ FreeGC(pGC, (XID)0); pGC = (GCPtr)NULL; } return (pGC); } static Bool CreateDefaultTile (GCPtr pGC) { XID tmpval[3]; PixmapPtr pTile; GCPtr pgcScratch; xRectangle rect; CARD16 w, h; w = 1; h = 1; (*pGC->pScreen->QueryBestSize)(TileShape, &w, &h, pGC->pScreen); pTile = (PixmapPtr) (*pGC->pScreen->CreatePixmap)(pGC->pScreen, w, h, pGC->depth, 0); pgcScratch = GetScratchGC(pGC->depth, pGC->pScreen); if (!pTile || !pgcScratch) { if (pTile) (*pTile->drawable.pScreen->DestroyPixmap)(pTile); if (pgcScratch) FreeScratchGC(pgcScratch); return FALSE; } tmpval[0] = GXcopy; tmpval[1] = pGC->tile.pixel; tmpval[2] = FillSolid; (void)ChangeGC(pgcScratch, GCFunction | GCForeground | GCFillStyle, tmpval); ValidateGC((DrawablePtr)pTile, pgcScratch); rect.x = 0; rect.y = 0; rect.width = w; rect.height = h; (*pgcScratch->ops->PolyFillRect)((DrawablePtr)pTile, pgcScratch, 1, &rect); /* Always remember to free the scratch graphics context after use. */ FreeScratchGC(pgcScratch); pGC->tileIsPixel = FALSE; pGC->tile.pixmap = pTile; return TRUE; } int CopyGC(register GC *pgcSrc, register GC *pgcDst, register BITS32 mask) { register BITS32 index2; BITS32 maskQ; int error = 0; if (pgcSrc == pgcDst) return Success; pgcDst->serialNumber |= GC_CHANGE_SERIAL_BIT; pgcDst->stateChanges |= mask; maskQ = mask; while (mask) { index2 = (BITS32) lowbit (mask); mask &= ~index2; switch (index2) { case GCFunction: pgcDst->alu = pgcSrc->alu; break; case GCPlaneMask: pgcDst->planemask = pgcSrc->planemask; break; case GCForeground: pgcDst->fgPixel = pgcSrc->fgPixel; break; case GCBackground: pgcDst->bgPixel = pgcSrc->bgPixel; break; case GCLineWidth: pgcDst->lineWidth = pgcSrc->lineWidth; break; case GCLineStyle: pgcDst->lineStyle = pgcSrc->lineStyle; break; case GCCapStyle: pgcDst->capStyle = pgcSrc->capStyle; break; case GCJoinStyle: pgcDst->joinStyle = pgcSrc->joinStyle; break; case GCFillStyle: pgcDst->fillStyle = pgcSrc->fillStyle; break; case GCFillRule: pgcDst->fillRule = pgcSrc->fillRule; break; case GCTile: { if (EqualPixUnion(pgcDst->tileIsPixel, pgcDst->tile, pgcSrc->tileIsPixel, pgcSrc->tile)) { break; } if (!pgcDst->tileIsPixel) (* pgcDst->pScreen->DestroyPixmap)(pgcDst->tile.pixmap); pgcDst->tileIsPixel = pgcSrc->tileIsPixel; pgcDst->tile = pgcSrc->tile; if (!pgcDst->tileIsPixel) pgcDst->tile.pixmap->refcnt++; break; } case GCStipple: { if (pgcDst->stipple == pgcSrc->stipple) break; if (pgcDst->stipple) (* pgcDst->pScreen->DestroyPixmap)(pgcDst->stipple); pgcDst->stipple = pgcSrc->stipple; if (pgcDst->stipple) pgcDst->stipple->refcnt ++; break; } case GCTileStipXOrigin: pgcDst->patOrg.x = pgcSrc->patOrg.x; break; case GCTileStipYOrigin: pgcDst->patOrg.y = pgcSrc->patOrg.y; break; case GCFont: if (pgcDst->font == pgcSrc->font) break; if (pgcDst->font) CloseFont(pgcDst->font, (Font)0); if ((pgcDst->font = pgcSrc->font) != NullFont) (pgcDst->font)->refcnt++; break; case GCSubwindowMode: pgcDst->subWindowMode = pgcSrc->subWindowMode; break; case GCGraphicsExposures: pgcDst->graphicsExposures = pgcSrc->graphicsExposures; break; case GCClipXOrigin: pgcDst->clipOrg.x = pgcSrc->clipOrg.x; break; case GCClipYOrigin: pgcDst->clipOrg.y = pgcSrc->clipOrg.y; break; case GCClipMask: (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); break; case GCDashOffset: pgcDst->dashOffset = pgcSrc->dashOffset; break; case GCDashList: if (pgcSrc->dash == DefaultDash) { if (pgcDst->dash != DefaultDash) { free(pgcDst->dash); pgcDst->numInDashList = pgcSrc->numInDashList; pgcDst->dash = pgcSrc->dash; } } else { unsigned char *dash; unsigned int i; dash = (unsigned char *)malloc(pgcSrc->numInDashList * sizeof(unsigned char)); if (dash) { if (pgcDst->dash != DefaultDash) free(pgcDst->dash); pgcDst->numInDashList = pgcSrc->numInDashList; pgcDst->dash = dash; for (i=0; inumInDashList; i++) dash[i] = pgcSrc->dash[i]; } else error = BadAlloc; } break; case GCArcMode: pgcDst->arcMode = pgcSrc->arcMode; break; default: clientErrorValue = maskQ; error = BadValue; break; } } if (pgcDst->fillStyle == FillTiled && pgcDst->tileIsPixel) { if (!CreateDefaultTile (pgcDst)) { pgcDst->fillStyle = FillSolid; error = BadAlloc; } } (*pgcDst->funcs->CopyGC) (pgcSrc, maskQ, pgcDst); return error; } /** * does the diX part of freeing the characteristics in the GC. * * \param value must conform to DeleteType */ int FreeGC(void * value, XID gid) { GCPtr pGC = (GCPtr)value; CloseFont(pGC->font, (Font)0); (* pGC->funcs->DestroyClip)(pGC); if (!pGC->tileIsPixel) (* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap); if (pGC->stipple) (* pGC->pScreen->DestroyPixmap)(pGC->stipple); (*pGC->funcs->DestroyGC) (pGC); if (pGC->dash != DefaultDash) free(pGC->dash); free(pGC); return(Success); } void SetGCMask(GCPtr pGC, Mask selectMask, Mask newDataMask) { pGC->stateChanges = (~selectMask & pGC->stateChanges) | (selectMask & newDataMask); if (selectMask & newDataMask) pGC->serialNumber |= GC_CHANGE_SERIAL_BIT; } /* CreateScratchGC(pScreen, depth) like CreateGC, but doesn't do the default tile or stipple, since we can't create them without already having a GC. any code using the tile or stipple has to set them explicitly anyway, since the state of the scratch gc is unknown. This is OK because ChangeGC() has to be able to deal with NULL tiles and stipples anyway (in case the CreateGC() call has provided a value for them -- we can't set the default tile until the client-supplied attributes are installed, since the fgPixel is what fills the default tile. (maybe this comment should go with CreateGC() or ChangeGC().) */ GCPtr CreateScratchGC(ScreenPtr pScreen, unsigned depth) { register GCPtr pGC; pGC = AllocateGC(pScreen); if (!pGC) return (GCPtr)NULL; pGC->pScreen = pScreen; pGC->depth = depth; pGC->alu = GXcopy; /* dst <- src */ pGC->planemask = ~0; pGC->serialNumber = 0; pGC->fgPixel = 0; pGC->bgPixel = 1; pGC->lineWidth = 0; pGC->lineStyle = LineSolid; pGC->capStyle = CapButt; pGC->joinStyle = JoinMiter; pGC->fillStyle = FillSolid; pGC->fillRule = EvenOddRule; pGC->arcMode = ArcPieSlice; pGC->font = defaultFont; if ( pGC->font) /* necessary, because open of default font could fail */ pGC->font->refcnt++; pGC->tileIsPixel = TRUE; pGC->tile.pixel = 0; pGC->stipple = NullPixmap; pGC->patOrg.x = 0; pGC->patOrg.y = 0; pGC->subWindowMode = ClipByChildren; pGC->graphicsExposures = TRUE; pGC->clipOrg.x = 0; pGC->clipOrg.y = 0; pGC->clientClipType = CT_NONE; pGC->dashOffset = 0; pGC->numInDashList = 2; pGC->dash = DefaultDash; pGC->lastWinOrg.x = 0; pGC->lastWinOrg.y = 0; pGC->stateChanges = (1 << (GCLastBit+1)) - 1; if (!(*pScreen->CreateGC)(pGC)) { FreeGC(pGC, (XID)0); pGC = (GCPtr)NULL; } return pGC; } void FreeGCperDepth(int screenNum) { register int i; register ScreenPtr pScreen; GCPtr *ppGC; pScreen = screenInfo.screens[screenNum]; ppGC = pScreen->GCperDepth; for (i = 0; i <= pScreen->numDepths; i++) (void)FreeGC(ppGC[i], (XID)0); pScreen->rgf = ~0L; } Bool CreateGCperDepth(int screenNum) { register int i; register ScreenPtr pScreen; DepthPtr pDepth; GCPtr *ppGC; pScreen = screenInfo.screens[screenNum]; pScreen->rgf = 0; ppGC = pScreen->GCperDepth; /* do depth 1 separately because it's not included in list */ if (!(ppGC[0] = CreateScratchGC(pScreen, 1))) return FALSE; ppGC[0]->graphicsExposures = FALSE; /* Make sure we don't overflow GCperDepth[] */ if( pScreen->numDepths > MAXFORMATS ) return FALSE; pDepth = pScreen->allowedDepths; for (i=0; inumDepths; i++, pDepth++) { if (!(ppGC[i+1] = CreateScratchGC(pScreen, pDepth->depth))) { for (; i >= 0; i--) (void)FreeGC(ppGC[i], (XID)0); return FALSE; } ppGC[i+1]->graphicsExposures = FALSE; } return TRUE; } Bool CreateDefaultStipple(int screenNum) { register ScreenPtr pScreen; XID tmpval[3]; xRectangle rect; CARD16 w, h; GCPtr pgcScratch; pScreen = screenInfo.screens[screenNum]; w = 16; h = 16; (* pScreen->QueryBestSize)(StippleShape, &w, &h, pScreen); if (!(pScreen->PixmapPerDepth[0] = (*pScreen->CreatePixmap)(pScreen, w, h, 1, 0))) return FALSE; /* fill stipple with 1 */ tmpval[0] = GXcopy; tmpval[1] = 1; tmpval[2] = FillSolid; pgcScratch = GetScratchGC(1, pScreen); if (!pgcScratch) { (*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]); return FALSE; } (void)ChangeGC(pgcScratch, GCFunction|GCForeground|GCFillStyle, tmpval); ValidateGC((DrawablePtr)pScreen->PixmapPerDepth[0], pgcScratch); rect.x = 0; rect.y = 0; rect.width = w; rect.height = h; (*pgcScratch->ops->PolyFillRect)((DrawablePtr)pScreen->PixmapPerDepth[0], pgcScratch, 1, &rect); FreeScratchGC(pgcScratch); return TRUE; } void FreeDefaultStipple(int screenNum) { ScreenPtr pScreen = screenInfo.screens[screenNum]; (*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]); } int SetDashes(register GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash) { register long i; register unsigned char *p, *indash; BITS32 maskQ = 0; i = ndash; p = pdash; while (i--) { if (!*p++) { /* dash segment must be > 0 */ clientErrorValue = 0; return BadValue; } } if (ndash & 1) p = (unsigned char *)malloc(2 * ndash * sizeof(unsigned char)); else p = (unsigned char *)malloc(ndash * sizeof(unsigned char)); if (!p) return BadAlloc; pGC->serialNumber |= GC_CHANGE_SERIAL_BIT; if (offset != pGC->dashOffset) { pGC->dashOffset = offset; pGC->stateChanges |= GCDashOffset; maskQ |= GCDashOffset; } if (pGC->dash != DefaultDash) free(pGC->dash); pGC->numInDashList = ndash; pGC->dash = p; if (ndash & 1) { pGC->numInDashList += ndash; indash = pdash; i = ndash; while (i--) *p++ = *indash++; } while(ndash--) *p++ = *pdash++; pGC->stateChanges |= GCDashList; maskQ |= GCDashList; if (pGC->funcs->ChangeGC) (*pGC->funcs->ChangeGC) (pGC, maskQ); return Success; } int VerifyRectOrder(int nrects, xRectangle *prects, int ordering) { register xRectangle *prectP, *prectN; register int i; switch(ordering) { case Unsorted: return CT_UNSORTED; case YSorted: if(nrects > 1) { for(i = 1, prectP = prects, prectN = prects + 1; i < nrects; i++, prectP++, prectN++) if(prectN->y < prectP->y) return -1; } return CT_YSORTED; case YXSorted: if(nrects > 1) { for(i = 1, prectP = prects, prectN = prects + 1; i < nrects; i++, prectP++, prectN++) if((prectN->y < prectP->y) || ( (prectN->y == prectP->y) && (prectN->x < prectP->x) ) ) return -1; } return CT_YXSORTED; case YXBanded: if(nrects > 1) { for(i = 1, prectP = prects, prectN = prects + 1; i < nrects; i++, prectP++, prectN++) if((prectN->y != prectP->y && prectN->y < prectP->y + (int) prectP->height) || ((prectN->y == prectP->y) && (prectN->height != prectP->height || prectN->x < prectP->x + (int) prectP->width))) return -1; } return CT_YXBANDED; } return -1; } int SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects, xRectangle *prects, int ordering) { int newct, size; xRectangle *prectsNew; newct = VerifyRectOrder(nrects, prects, ordering); if (newct < 0) return(BadMatch); size = nrects * sizeof(xRectangle); prectsNew = (xRectangle *) malloc(size); if (!prectsNew && size) return BadAlloc; pGC->serialNumber |= GC_CHANGE_SERIAL_BIT; pGC->clipOrg.x = xOrigin; pGC->stateChanges |= GCClipXOrigin; pGC->clipOrg.y = yOrigin; pGC->stateChanges |= GCClipYOrigin; if (size) memmove((char *)prectsNew, (char *)prects, size); (*pGC->funcs->ChangeClip)(pGC, newct, (void *)prectsNew, nrects); if (pGC->funcs->ChangeGC) (*pGC->funcs->ChangeGC) (pGC, GCClipXOrigin|GCClipYOrigin|GCClipMask); return Success; } /* sets reasonable defaults if we can get a pre-allocated one, use it and mark it as used. if we can't, create one out of whole cloth (The Velveteen GC -- if you use it often enough it will become real.) */ GCPtr GetScratchGC(register unsigned depth, register ScreenPtr pScreen) { register int i; register GCPtr pGC; for (i=0; i<=pScreen->numDepths; i++) if ( pScreen->GCperDepth[i]->depth == depth && !(pScreen->rgf & (1L << (i+1))) ) { pScreen->rgf |= (1L << (i+1)); pGC = (pScreen->GCperDepth[i]); pGC->alu = GXcopy; pGC->planemask = ~0; pGC->serialNumber = 0; pGC->fgPixel = 0; pGC->bgPixel = 1; pGC->lineWidth = 0; pGC->lineStyle = LineSolid; pGC->capStyle = CapButt; pGC->joinStyle = JoinMiter; pGC->fillStyle = FillSolid; pGC->fillRule = EvenOddRule; pGC->arcMode = ArcChord; pGC->patOrg.x = 0; pGC->patOrg.y = 0; pGC->subWindowMode = ClipByChildren; pGC->graphicsExposures = FALSE; pGC->clipOrg.x = 0; pGC->clipOrg.y = 0; if (pGC->clientClipType != CT_NONE) (*pGC->funcs->ChangeClip) (pGC, CT_NONE, NULL, 0); pGC->stateChanges = (1 << (GCLastBit+1)) - 1; return pGC; } /* if we make it this far, need to roll our own */ pGC = CreateScratchGC(pScreen, depth); if (pGC) pGC->graphicsExposures = FALSE; return pGC; } /* if the gc to free is in the table of pre-existing ones, mark it as available. if not, free it for real */ void FreeScratchGC(register GCPtr pGC) { register ScreenPtr pScreen = pGC->pScreen; register int i; for (i=0; i<=pScreen->numDepths; i++) { if ( pScreen->GCperDepth[i] == pGC) { pScreen->rgf &= ~(1L << (i+1)); return; } } (void)FreeGC(pGC, (GContext)0); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/globals.c0000644000000000000000000001221213614532331017144 0ustar /************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "windowstr.h" #include "scrnintstr.h" #include "input.h" #include "dixfont.h" #include "site.h" #include "dixstruct.h" #include "os.h" ScreenInfo screenInfo; KeybdCtrl defaultKeyboardControl = { DEFAULT_KEYBOARD_CLICK, DEFAULT_BELL, DEFAULT_BELL_PITCH, DEFAULT_BELL_DURATION, DEFAULT_AUTOREPEAT, DEFAULT_AUTOREPEATS, DEFAULT_LEDS, 0}; PtrCtrl defaultPointerControl = { DEFAULT_PTR_NUMERATOR, DEFAULT_PTR_DENOMINATOR, DEFAULT_PTR_THRESHOLD, 0}; ClientPtr *clients; ClientPtr serverClient; int currentMaxClients; /* current size of clients array */ long maxBigRequestSize = MAX_BIG_REQUEST_SIZE; unsigned long globalSerialNumber = 0; unsigned long serverGeneration = 0; /* these next four are initialized in main.c */ CARD32 ScreenSaverTime; CARD32 ScreenSaverInterval; int ScreenSaverBlanking; int ScreenSaverAllowExposures; #ifdef DPMSExtension # ifndef DEFAULT_STANDBY_TIME # define DEFAULT_STANDBY_TIME DEFAULT_SCREEN_SAVER_TIME * 2 # endif # ifndef DEFAULT_SUSPEND_TIME # define DEFAULT_SUSPEND_TIME DEFAULT_SCREEN_SAVER_TIME * 3 # endif # ifndef DEFAULT_OFF_TIME # define DEFAULT_OFF_TIME DEFAULT_SCREEN_SAVER_TIME * 4 # endif # ifndef DEFAULT_DPMS_ENABLED # define DEFAULT_DPMS_ENABLED TRUE # endif CARD32 defaultDPMSStandbyTime = DEFAULT_STANDBY_TIME; CARD32 defaultDPMSSuspendTime = DEFAULT_SUSPEND_TIME; CARD32 defaultDPMSOffTime = DEFAULT_OFF_TIME; CARD16 DPMSPowerLevel = 0; Bool defaultDPMSEnabled = DEFAULT_DPMS_ENABLED; Bool DPMSEnabledSwitch = FALSE; /* these denote the DPMS command */ Bool DPMSDisabledSwitch = FALSE; /* line switch states */ Bool DPMSCapableFlag = FALSE; CARD32 DPMSStandbyTime; CARD32 DPMSSuspendTime; CARD32 DPMSOffTime; Bool DPMSEnabled; #endif CARD32 defaultScreenSaverTime = DEFAULT_SCREEN_SAVER_TIME; CARD32 defaultScreenSaverInterval = DEFAULT_SCREEN_SAVER_INTERVAL; int defaultScreenSaverBlanking = DEFAULT_SCREEN_SAVER_BLANKING; int defaultScreenSaverAllowExposures = DEFAULT_SCREEN_SAVER_EXPOSURES; #ifndef NOLOGOHACK int logoScreenSaver = DEFAULT_LOGO_SCREEN_SAVER; #endif #ifdef SCREENSAVER Bool screenSaverSuspended = FALSE; #endif char *defaultFontPath = COMPILEDDEFAULTFONTPATH; char *defaultTextFont = COMPILEDDEFAULTFONT; char *defaultCursorFont = COMPILEDCURSORFONT; char *defaultDisplayClass = COMPILEDDISPLAYCLASS; FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in every compilation of dix code */ Bool loadableFonts = FALSE; CursorPtr rootCursor; Bool blackRoot=FALSE; Bool whiteRoot=FALSE; TimeStamp currentTime; TimeStamp lastDeviceEventTime; int defaultColorVisualClass = -1; int monitorResolution = 0; char *display; int displayfd = -1; Bool explicit_display = FALSE; CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND; int argcGlobal; char **argvGlobal; DDXPointRec dixScreenOrigins[MAXSCREENS]; char *ConnectionInfo; nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/glyphcurs.c0000644000000000000000000001417713614532331017555 0ustar /************************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "misc.h" #include #include "dixfontstr.h" #include "scrnintstr.h" #include "gcstruct.h" #include "resource.h" #include "dix.h" #include "cursorstr.h" #include "opaque.h" #include "servermd.h" /* get the bits out of the font in a portable way. to avoid dealing with padding and such-like, we draw the glyph into a bitmap, then read the bits out with GetImage, which uses server-natural format. since all screens return the same bitmap format, we'll just use the first one we find. the character origin lines up with the hotspot in the cursor metrics. */ #ifndef NXAGENT_SERVER int ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, unsigned char **ppbits) { register ScreenPtr pScreen; register GCPtr pGC; xRectangle rect; PixmapPtr ppix; long nby; char *pbits; ChangeGCVal gcval[3]; unsigned char char2b[2]; /* turn glyph index into a protocol-format char2b */ char2b[0] = (unsigned char)(ch >> 8); char2b[1] = (unsigned char)(ch & 0xff); pScreen = screenInfo.screens[0]; nby = BitmapBytePad(cm->width) * (long)cm->height; pbits = (char *)malloc(nby); if (!pbits) return BadAlloc; /* zeroing the (pad) bits seems to help some ddx cursor handling */ bzero(pbits, nby); ppix = (PixmapPtr)(*pScreen->CreatePixmap)(pScreen, cm->width, cm->height, 1, CREATE_PIXMAP_USAGE_SCRATCH); pGC = GetScratchGC(1, pScreen); if (!ppix || !pGC) { if (ppix) (*pScreen->DestroyPixmap)(ppix); if (pGC) FreeScratchGC(pGC); free(pbits); return BadAlloc; } rect.x = 0; rect.y = 0; rect.width = cm->width; rect.height = cm->height; /* fill the pixmap with 0 */ gcval[0].val = GXcopy; gcval[1].val = 0; gcval[2].ptr = (void *)pfont; dixChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFont, NULL, gcval); ValidateGC((DrawablePtr)ppix, pGC); (*pGC->ops->PolyFillRect)((DrawablePtr)ppix, pGC, 1, &rect); /* draw the glyph */ gcval[0].val = 1; dixChangeGC(NullClient, pGC, GCForeground, NULL, gcval); ValidateGC((DrawablePtr)ppix, pGC); (*pGC->ops->PolyText16)((DrawablePtr)ppix, pGC, cm->xhot, cm->yhot, 1, (unsigned short *)char2b); (*pScreen->GetImage)((DrawablePtr)ppix, 0, 0, cm->width, cm->height, XYPixmap, 1, pbits); *ppbits = (unsigned char *)pbits; FreeScratchGC(pGC); (*pScreen->DestroyPixmap)(ppix); return Success; } #endif /* NXAGENT_SERVER */ Bool CursorMetricsFromGlyph(register FontPtr pfont, unsigned ch, register CursorMetricPtr cm) { CharInfoPtr pci; unsigned long nglyphs; CARD8 chs[2]; FontEncoding encoding; chs[0] = ch >> 8; chs[1] = ch; encoding = (FONTLASTROW(pfont) == 0) ? Linear16Bit : TwoD16Bit; if (encoding == Linear16Bit) { if (ch < pfont->info.firstCol || pfont->info.lastCol < ch) return FALSE; } else { if (chs[0] < pfont->info.firstRow || pfont->info.lastRow < chs[0]) return FALSE; if (chs[1] < pfont->info.firstCol || pfont->info.lastCol < chs[1]) return FALSE; } (*pfont->get_glyphs) (pfont, 1, chs, encoding, &nglyphs, &pci); if (nglyphs == 0) return FALSE; cm->width = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; cm->height = pci->metrics.descent + pci->metrics.ascent; if (pci->metrics.leftSideBearing > 0) { cm->width += pci->metrics.leftSideBearing; cm->xhot = 0; } else { cm->xhot = -pci->metrics.leftSideBearing; if (pci->metrics.rightSideBearing < 0) cm->width -= pci->metrics.rightSideBearing; } if (pci->metrics.ascent < 0) { cm->height -= pci->metrics.ascent; cm->yhot = 0; } else { cm->yhot = pci->metrics.ascent; if (pci->metrics.descent < 0) cm->height -= pci->metrics.descent; } return TRUE; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/grabs.c0000644000000000000000000002635013614532331016627 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN action OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "misc.h" #include #include "windowstr.h" #include "inputstr.h" #include "cursorstr.h" #include "dixgrabs.h" #define BITMASK(i) (((Mask)1) << ((i) & 31)) #define MASKIDX(i) ((i) >> 5) #define MASKWORD(buf, i) buf[MASKIDX(i)] #define BITSET(buf, i) MASKWORD(buf, i) |= BITMASK(i) #define BITCLEAR(buf, i) MASKWORD(buf, i) &= ~BITMASK(i) #define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i)) GrabPtr CreateGrab( int client, DeviceIntPtr device, WindowPtr window, Mask eventMask, Bool ownerEvents, Bool keyboardMode, Bool pointerMode, DeviceIntPtr modDevice, unsigned short modifiers, int type, KeyCode keybut, /* key or button */ WindowPtr confineTo, CursorPtr cursor) { GrabPtr grab; grab = (GrabPtr)malloc(sizeof(GrabRec)); if (!grab) return (GrabPtr)NULL; grab->resource = FakeClientID(client); grab->device = device; grab->coreGrab = ((device == inputInfo.keyboard) || (device == inputInfo.pointer)); grab->window = window; grab->eventMask = eventMask; grab->ownerEvents = ownerEvents; grab->keyboardMode = keyboardMode; grab->pointerMode = pointerMode; grab->modifiersDetail.exact = modifiers; grab->modifiersDetail.pMask = NULL; grab->modifierDevice = modDevice; grab->coreMods = ((modDevice == inputInfo.keyboard) || (modDevice == inputInfo.pointer)); grab->type = type; grab->detail.exact = keybut; grab->detail.pMask = NULL; grab->confineTo = confineTo; grab->cursor = cursor; if (cursor) cursor->refcnt++; return grab; } static void FreeGrab(GrabPtr pGrab) { if (pGrab->modifiersDetail.pMask != NULL) free(pGrab->modifiersDetail.pMask); if (pGrab->detail.pMask != NULL) free(pGrab->detail.pMask); if (pGrab->cursor) FreeCursor(pGrab->cursor, (Cursor)0); free(pGrab); } int DeletePassiveGrab(void * value, XID id) { register GrabPtr g, prev; GrabPtr pGrab = (GrabPtr)value; /* it is OK if the grab isn't found */ prev = 0; for (g = (wPassiveGrabs (pGrab->window)); g; g = g->next) { if (pGrab == g) { if (prev) prev->next = g->next; else if (!(pGrab->window->optional->passiveGrabs = g->next)) CheckWindowOptionalNeed (pGrab->window); break; } prev = g; } FreeGrab(pGrab); return Success; } static Mask * DeleteDetailFromMask(Mask *pDetailMask, unsigned short detail) { register Mask *mask; register int i; mask = (Mask *)malloc(sizeof(Mask) * MasksPerDetailMask); if (mask) { if (pDetailMask) for (i = 0; i < MasksPerDetailMask; i++) mask[i]= pDetailMask[i]; else for (i = 0; i < MasksPerDetailMask; i++) mask[i]= ~0L; BITCLEAR(mask, detail); } return mask; } static Bool IsInGrabMask( DetailRec firstDetail, DetailRec secondDetail, unsigned short exception) { if (firstDetail.exact == exception) { if (firstDetail.pMask == NULL) return TRUE; /* (at present) never called with two non-null pMasks */ if (secondDetail.exact == exception) return FALSE; if (GETBIT(firstDetail.pMask, secondDetail.exact)) return TRUE; } return FALSE; } static Bool IdenticalExactDetails( unsigned short firstExact, unsigned short secondExact, unsigned short exception) { if ((firstExact == exception) || (secondExact == exception)) return FALSE; if (firstExact == secondExact) return TRUE; return FALSE; } static Bool DetailSupersedesSecond( DetailRec firstDetail, DetailRec secondDetail, unsigned short exception) { if (IsInGrabMask(firstDetail, secondDetail, exception)) return TRUE; if (IdenticalExactDetails(firstDetail.exact, secondDetail.exact, exception)) return TRUE; return FALSE; } static Bool GrabSupersedesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab) { if (!DetailSupersedesSecond(pFirstGrab->modifiersDetail, pSecondGrab->modifiersDetail, (unsigned short)AnyModifier)) return FALSE; if (DetailSupersedesSecond(pFirstGrab->detail, pSecondGrab->detail, (unsigned short)AnyKey)) return TRUE; return FALSE; } Bool GrabMatchesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab) { if ((pFirstGrab->device != pSecondGrab->device) || (pFirstGrab->modifierDevice != pSecondGrab->modifierDevice) || (pFirstGrab->type != pSecondGrab->type)) return FALSE; if (GrabSupersedesSecond(pFirstGrab, pSecondGrab) || GrabSupersedesSecond(pSecondGrab, pFirstGrab)) return TRUE; if (DetailSupersedesSecond(pSecondGrab->detail, pFirstGrab->detail, (unsigned short)AnyKey) && DetailSupersedesSecond(pFirstGrab->modifiersDetail, pSecondGrab->modifiersDetail, (unsigned short)AnyModifier)) return TRUE; if (DetailSupersedesSecond(pFirstGrab->detail, pSecondGrab->detail, (unsigned short)AnyKey) && DetailSupersedesSecond(pSecondGrab->modifiersDetail, pFirstGrab->modifiersDetail, (unsigned short)AnyModifier)) return TRUE; return FALSE; } int AddPassiveGrabToList(GrabPtr pGrab) { GrabPtr grab; for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next) { if (GrabMatchesSecond(pGrab, grab)) { if (CLIENT_BITS(pGrab->resource) != CLIENT_BITS(grab->resource)) { FreeGrab(pGrab); return BadAccess; } } } if (!pGrab->window->optional && !MakeWindowOptional (pGrab->window)) { FreeGrab(pGrab); return BadAlloc; } pGrab->next = pGrab->window->optional->passiveGrabs; pGrab->window->optional->passiveGrabs = pGrab; if (AddResource(pGrab->resource, RT_PASSIVEGRAB, (void *)pGrab)) return Success; return BadAlloc; } /* the following is kinda complicated, because we need to be able to back out * if any allocation fails */ Bool DeletePassiveGrabFromList(GrabPtr pMinuendGrab) { register GrabPtr grab; GrabPtr *deletes, *adds; Mask ***updates, **details; int i, ndels, nadds, nups; Bool ok; #define UPDATE(mask,exact) \ if (!(details[nups] = DeleteDetailFromMask(mask, exact))) \ ok = FALSE; \ else \ updates[nups++] = &(mask) i = 0; for (grab = wPassiveGrabs(pMinuendGrab->window); grab; grab = grab->next) i++; if (!i) return TRUE; deletes = (GrabPtr *)malloc(i * sizeof(GrabPtr)); adds = (GrabPtr *)malloc(i * sizeof(GrabPtr)); updates = (Mask ***)malloc(i * sizeof(Mask **)); details = (Mask **)malloc(i * sizeof(Mask *)); if (!deletes || !adds || !updates || !details) { if (details) free(details); if (updates) free(updates); if (adds) free(adds); if (deletes) free(deletes); return FALSE; } ndels = nadds = nups = 0; ok = TRUE; for (grab = wPassiveGrabs(pMinuendGrab->window); grab && ok; grab = grab->next) { if ((CLIENT_BITS(grab->resource) != CLIENT_BITS(pMinuendGrab->resource)) || !GrabMatchesSecond(grab, pMinuendGrab)) continue; if (GrabSupersedesSecond(pMinuendGrab, grab)) { deletes[ndels++] = grab; } else if ((grab->detail.exact == AnyKey) && (grab->modifiersDetail.exact != AnyModifier)) { UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact); } else if ((grab->modifiersDetail.exact == AnyModifier) && (grab->detail.exact != AnyKey)) { UPDATE(grab->modifiersDetail.pMask, pMinuendGrab->modifiersDetail.exact); } else if ((pMinuendGrab->detail.exact != AnyKey) && (pMinuendGrab->modifiersDetail.exact != AnyModifier)) { GrabPtr pNewGrab; UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact); pNewGrab = CreateGrab(CLIENT_ID(grab->resource), grab->device, grab->window, (Mask)grab->eventMask, (Bool)grab->ownerEvents, (Bool)grab->keyboardMode, (Bool)grab->pointerMode, grab->modifierDevice, AnyModifier, (int)grab->type, pMinuendGrab->detail.exact, grab->confineTo, grab->cursor); if (!pNewGrab) ok = FALSE; else if (!(pNewGrab->modifiersDetail.pMask = DeleteDetailFromMask(grab->modifiersDetail.pMask, pMinuendGrab->modifiersDetail.exact)) || (!pNewGrab->window->optional && !MakeWindowOptional(pNewGrab->window))) { FreeGrab(pNewGrab); ok = FALSE; } else if (!AddResource(pNewGrab->resource, RT_PASSIVEGRAB, (void *)pNewGrab)) ok = FALSE; else adds[nadds++] = pNewGrab; } else if (pMinuendGrab->detail.exact == AnyKey) { UPDATE(grab->modifiersDetail.pMask, pMinuendGrab->modifiersDetail.exact); } else { UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact); } } if (!ok) { for (i = 0; i < nadds; i++) FreeResource(adds[i]->resource, RT_NONE); for (i = 0; i < nups; i++) free(details[i]); } else { for (i = 0; i < ndels; i++) FreeResource(deletes[i]->resource, RT_NONE); for (i = 0; i < nadds; i++) { grab = adds[i]; grab->next = grab->window->optional->passiveGrabs; grab->window->optional->passiveGrabs = grab; } for (i = 0; i < nups; i++) { free(*updates[i]); *updates[i] = details[i]; } } free(details); free(updates); free(adds); free(deletes); return ok; #undef UPDATE } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/Imakefile0000644000000000000000000000764113614532331017200 0ustar NULL = #include #if !HasFfs FFS_SRC = ffs.c FFS_OBJ = ffs.o #endif #if (!(defined(NXAgentServer) && NXAgentServer)) NXAGENT_SKIP_SRCS = \ dispatch.c \ dixfonts.c \ events.c \ glyphcurs.c \ property.c \ resource.c \ window.c \ $(NULL) NXAGENT_SKIP_OBJS = \ dispatch.o \ dixfonts.o \ events.o \ glyphcurs.o \ property.o \ resource.o \ window.o \ $(NULL) #endif SRCS = \ atom.c \ colormap.c \ cursor.c \ devices.c \ dixutils.c \ extension.c \ gc.c \ globals.c \ grabs.c \ main.c \ region.c \ swaprep.c \ swapreq.c \ tables.c \ initatoms.c \ privates.c \ pixmap.c \ $(NXAGENT_SKIP_SRCS) \ $(FFS_SRC) \ $(NULL) OBJS = \ atom.o \ colormap.o \ cursor.o \ devices.o \ dixutils.o \ extension.o \ gc.o \ globals.o \ grabs.o \ main.o \ region.o \ swaprep.o \ swapreq.o \ tables.o \ initatoms.o \ privates.o \ pixmap.o \ $(NXAGENT_SKIP_OBJS) \ $(FFS_OBJ) \ $(NULL) INCLUDES = -I../include \ -I$(XINCLUDESRC) \ -I$(EXTINCSRC) \ -I$(SERVERSRC)/Xext \ -I$(SERVERSRC)/lbx \ `pkg-config --cflags-only-I pixman-1` \ $(NULL) LINTLIBS = ../os/llib-los.ln /* * The following configuration parameters may be set in the appropriate * .macros files or site.def in the directory util/imake.includes/: * * DefaultFontPath COMPILEDDEFAULTFONTPATH * * The sample util/imake.includes/Imake.tmpl will provide generic defaults. * The values in site.h are simply a last line of defense and should not be * changed. */ #ifdef DefaultFontPath DEFAULTFONTPATH = DefaultFontPath SITE_FONT_PATH = -DCOMPILEDDEFAULTFONTPATH=\"$(DEFAULTFONTPATH)\" #endif #ifdef DefaultDisplayClass DEFAULTDISPLAYCLASS = DefaultDisplayClass SITE_DISPLAY_CLASS = -DCOMPILEDDISPLAYCLASS=\"$(DEFAULTDISPLAYCLASS)\" #endif #ifdef XVendorString VENDORSTRING = XVendorString VENDOR_STRING = -DVENDOR_STRING=\"$(VENDORSTRING)\" #endif #ifdef XVendorRelease VENDORRELEASE = XVendorRelease VENDOR_RELEASE = -DVENDOR_RELEASE="$(VENDORRELEASE)" #endif #ifdef DarwinArchitecture #if DarwinQuartzSupport QUARTZ_DEFINES = -DDARWIN_WITH_QUARTZ #endif #endif SITE_DEFINES = $(SITE_FONT_PATH) $(SITE_DISPLAY_CLASS) VENDOR_DEFINES = $(VENDOR_STRING) $(VENDOR_RELEASE) $(QUARTZ_DEFINES) NormalLibraryObjectRule() NormalLibraryTarget(dix,$(OBJS)) SpecialCObjectRule(globals,$(ICONFIGFILES),$(SITE_DEFINES) $(EXT_DEFINES)) SpecialCObjectRule(main,$(ICONFIGFILES),$(VENDOR_DEFINES)) SpecialCObjectRule(pixmap,$(ICONFIGFILES),$(_NOOP_)) SpecialCObjectRule(privates,$(ICONFIGFILES),$(_NOOP_)) SpecialCObjectRule(window,$(ICONFIGFILES),$(QUARTZ_DEFINES)) DependTarget() nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/initatoms.c0000644000000000000000000001155413614532331017540 0ustar /* THIS IS A GENERATED FILE * * Do not change! Changing this file implies a protocol change! */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "dix.h" void MakePredeclaredAtoms() { if (MakeAtom("PRIMARY", 7, 1) != XA_PRIMARY) AtomError(); if (MakeAtom("SECONDARY", 9, 1) != XA_SECONDARY) AtomError(); if (MakeAtom("ARC", 3, 1) != XA_ARC) AtomError(); if (MakeAtom("ATOM", 4, 1) != XA_ATOM) AtomError(); if (MakeAtom("BITMAP", 6, 1) != XA_BITMAP) AtomError(); if (MakeAtom("CARDINAL", 8, 1) != XA_CARDINAL) AtomError(); if (MakeAtom("COLORMAP", 8, 1) != XA_COLORMAP) AtomError(); if (MakeAtom("CURSOR", 6, 1) != XA_CURSOR) AtomError(); if (MakeAtom("CUT_BUFFER0", 11, 1) != XA_CUT_BUFFER0) AtomError(); if (MakeAtom("CUT_BUFFER1", 11, 1) != XA_CUT_BUFFER1) AtomError(); if (MakeAtom("CUT_BUFFER2", 11, 1) != XA_CUT_BUFFER2) AtomError(); if (MakeAtom("CUT_BUFFER3", 11, 1) != XA_CUT_BUFFER3) AtomError(); if (MakeAtom("CUT_BUFFER4", 11, 1) != XA_CUT_BUFFER4) AtomError(); if (MakeAtom("CUT_BUFFER5", 11, 1) != XA_CUT_BUFFER5) AtomError(); if (MakeAtom("CUT_BUFFER6", 11, 1) != XA_CUT_BUFFER6) AtomError(); if (MakeAtom("CUT_BUFFER7", 11, 1) != XA_CUT_BUFFER7) AtomError(); if (MakeAtom("DRAWABLE", 8, 1) != XA_DRAWABLE) AtomError(); if (MakeAtom("FONT", 4, 1) != XA_FONT) AtomError(); if (MakeAtom("INTEGER", 7, 1) != XA_INTEGER) AtomError(); if (MakeAtom("PIXMAP", 6, 1) != XA_PIXMAP) AtomError(); if (MakeAtom("POINT", 5, 1) != XA_POINT) AtomError(); if (MakeAtom("RECTANGLE", 9, 1) != XA_RECTANGLE) AtomError(); if (MakeAtom("RESOURCE_MANAGER", 16, 1) != XA_RESOURCE_MANAGER) AtomError(); if (MakeAtom("RGB_COLOR_MAP", 13, 1) != XA_RGB_COLOR_MAP) AtomError(); if (MakeAtom("RGB_BEST_MAP", 12, 1) != XA_RGB_BEST_MAP) AtomError(); if (MakeAtom("RGB_BLUE_MAP", 12, 1) != XA_RGB_BLUE_MAP) AtomError(); if (MakeAtom("RGB_DEFAULT_MAP", 15, 1) != XA_RGB_DEFAULT_MAP) AtomError(); if (MakeAtom("RGB_GRAY_MAP", 12, 1) != XA_RGB_GRAY_MAP) AtomError(); if (MakeAtom("RGB_GREEN_MAP", 13, 1) != XA_RGB_GREEN_MAP) AtomError(); if (MakeAtom("RGB_RED_MAP", 11, 1) != XA_RGB_RED_MAP) AtomError(); if (MakeAtom("STRING", 6, 1) != XA_STRING) AtomError(); if (MakeAtom("VISUALID", 8, 1) != XA_VISUALID) AtomError(); if (MakeAtom("WINDOW", 6, 1) != XA_WINDOW) AtomError(); if (MakeAtom("WM_COMMAND", 10, 1) != XA_WM_COMMAND) AtomError(); if (MakeAtom("WM_HINTS", 8, 1) != XA_WM_HINTS) AtomError(); if (MakeAtom("WM_CLIENT_MACHINE", 17, 1) != XA_WM_CLIENT_MACHINE) AtomError(); if (MakeAtom("WM_ICON_NAME", 12, 1) != XA_WM_ICON_NAME) AtomError(); if (MakeAtom("WM_ICON_SIZE", 12, 1) != XA_WM_ICON_SIZE) AtomError(); if (MakeAtom("WM_NAME", 7, 1) != XA_WM_NAME) AtomError(); if (MakeAtom("WM_NORMAL_HINTS", 15, 1) != XA_WM_NORMAL_HINTS) AtomError(); if (MakeAtom("WM_SIZE_HINTS", 13, 1) != XA_WM_SIZE_HINTS) AtomError(); if (MakeAtom("WM_ZOOM_HINTS", 13, 1) != XA_WM_ZOOM_HINTS) AtomError(); if (MakeAtom("MIN_SPACE", 9, 1) != XA_MIN_SPACE) AtomError(); if (MakeAtom("NORM_SPACE", 10, 1) != XA_NORM_SPACE) AtomError(); if (MakeAtom("MAX_SPACE", 9, 1) != XA_MAX_SPACE) AtomError(); if (MakeAtom("END_SPACE", 9, 1) != XA_END_SPACE) AtomError(); if (MakeAtom("SUPERSCRIPT_X", 13, 1) != XA_SUPERSCRIPT_X) AtomError(); if (MakeAtom("SUPERSCRIPT_Y", 13, 1) != XA_SUPERSCRIPT_Y) AtomError(); if (MakeAtom("SUBSCRIPT_X", 11, 1) != XA_SUBSCRIPT_X) AtomError(); if (MakeAtom("SUBSCRIPT_Y", 11, 1) != XA_SUBSCRIPT_Y) AtomError(); if (MakeAtom("UNDERLINE_POSITION", 18, 1) != XA_UNDERLINE_POSITION) AtomError(); if (MakeAtom("UNDERLINE_THICKNESS", 19, 1) != XA_UNDERLINE_THICKNESS) AtomError(); if (MakeAtom("STRIKEOUT_ASCENT", 16, 1) != XA_STRIKEOUT_ASCENT) AtomError(); if (MakeAtom("STRIKEOUT_DESCENT", 17, 1) != XA_STRIKEOUT_DESCENT) AtomError(); if (MakeAtom("ITALIC_ANGLE", 12, 1) != XA_ITALIC_ANGLE) AtomError(); if (MakeAtom("X_HEIGHT", 8, 1) != XA_X_HEIGHT) AtomError(); if (MakeAtom("QUAD_WIDTH", 10, 1) != XA_QUAD_WIDTH) AtomError(); if (MakeAtom("WEIGHT", 6, 1) != XA_WEIGHT) AtomError(); if (MakeAtom("POINT_SIZE", 10, 1) != XA_POINT_SIZE) AtomError(); if (MakeAtom("RESOLUTION", 10, 1) != XA_RESOLUTION) AtomError(); if (MakeAtom("COPYRIGHT", 9, 1) != XA_COPYRIGHT) AtomError(); if (MakeAtom("NOTICE", 6, 1) != XA_NOTICE) AtomError(); if (MakeAtom("FONT_NAME", 9, 1) != XA_FONT_NAME) AtomError(); if (MakeAtom("FAMILY_NAME", 11, 1) != XA_FAMILY_NAME) AtomError(); if (MakeAtom("FULL_NAME", 9, 1) != XA_FULL_NAME) AtomError(); if (MakeAtom("CAP_HEIGHT", 10, 1) != XA_CAP_HEIGHT) AtomError(); if (MakeAtom("WM_CLASS", 8, 1) != XA_WM_CLASS) AtomError(); if (MakeAtom("WM_TRANSIENT_FOR", 16, 1) != XA_WM_TRANSIENT_FOR) AtomError(); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/main.c0000644000000000000000000004116013614532331016451 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* The panoramix components contained the following notice */ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* $TOG: main.c /main/86 1998/02/09 14:20:03 kaleb $ */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include /* for unistd.h */ #include #include "scrnintstr.h" #include "misc.h" #include "os.h" #include "windowstr.h" #include "resource.h" #include "dixstruct.h" #include "gcstruct.h" #include "extension.h" #include "colormap.h" #include "colormapst.h" #include "cursorstr.h" #include #include #ifdef HAS_XFONT2 # include #else # include #endif /* HAS_XFONT2 */ #include "opaque.h" #include "servermd.h" #include "site.h" #include "dixfont.h" #include "extnsionst.h" #include "client.h" #ifdef PANORAMIX #include "panoramiXsrv.h" #else #include "dixevents.h" /* InitEvents() */ #include "dispatch.h" /* InitProcVectors() */ #endif #ifdef DPMSExtension #define DPMS_SERVER #include #include "dpmsproc.h" #endif extern int InitClientPrivates(ClientPtr client); extern void Dispatch(void); xConnSetupPrefix connSetupPrefix; extern FontPtr defaultFont; extern void InitProcVectors(void); extern Bool CreateGCperDepthArray(void); extern void FreeScreen(ScreenPtr pScreen); #ifndef PANORAMIX static #endif Bool CreateConnectionBlock(void); PaddingInfo PixmapWidthPaddingInfo[33]; int connBlockScreenStart; static int restart = 0; void NotImplemented(xEvent *from, xEvent *to) { FatalError("Not implemented"); } /* * Dummy entry for ReplySwapVector[] */ void ReplyNotSwappd( ClientPtr pClient , int size , void * pbuf ) { FatalError("Not implemented"); } int main(int argc, char *argv[], char *envp[]) { int i; char *xauthfile; HWEventQueueType alwaysCheckForInput[2]; display = "0"; InitGlobals(); /* Quartz support on Mac OS X requires that the Cocoa event loop be in * the main thread. This allows the X server main to be called again * from another thread. */ #if defined(__DARWIN__) && defined(DARWIN_WITH_QUARTZ) DarwinHandleGUI(argc, argv, envp); #endif /* Notice if we're restarted. Probably this is because we jumped through * an uninitialized pointer */ if (restart) FatalError("server restarted. Jumped through uninitialized pointer?\n"); else restart = 1; CheckUserParameters(argc, argv, envp); CheckUserAuthorization(); #ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS ExpandCommandLine(&argc, &argv); #endif InitConnectionLimits(); /* These are needed by some routines which are called from interrupt * handlers, thus have no direct calling path back to main and thus * can't be passed argc, argv as parameters */ argcGlobal = argc; argvGlobal = argv; /* prep X authority file from environment; this can be overriden by a * command line option */ xauthfile = getenv("XAUTHORITY"); if (xauthfile) InitAuthorization (xauthfile); ProcessCommandLine(argc, argv); alwaysCheckForInput[0] = 0; alwaysCheckForInput[1] = 1; while(1) { serverGeneration++; ScreenSaverTime = defaultScreenSaverTime; ScreenSaverInterval = defaultScreenSaverInterval; ScreenSaverBlanking = defaultScreenSaverBlanking; ScreenSaverAllowExposures = defaultScreenSaverAllowExposures; #ifdef DPMSExtension DPMSStandbyTime = defaultDPMSStandbyTime; DPMSSuspendTime = defaultDPMSSuspendTime; DPMSOffTime = defaultDPMSOffTime; DPMSEnabled = defaultDPMSEnabled; DPMSPowerLevel = 0; #endif InitBlockAndWakeupHandlers(); /* Perform any operating system dependent initializations you'd like */ OsInit(); if(serverGeneration == 1) { CreateWellKnownSockets(); InitProcVectors(); clients = (ClientPtr *)malloc(MAXCLIENTS * sizeof(ClientPtr)); if (!clients) FatalError("couldn't create client array"); for (i=1; iCreateScreenResources && !(*pScreen->CreateScreenResources)(pScreen)) FatalError("failed to create screen resources"); if (!CreateGCperDepth(i)) FatalError("failed to create scratch GCs"); if (!CreateDefaultStipple(i)) FatalError("failed to create default stipple"); if (!CreateRootWindow(pScreen)) FatalError("failed to create root window"); } InitInput(argc, argv); if (InitAndStartDevices() != Success) FatalError("failed to initialize core devices"); ReserveClientIds(serverClient); if (loadableFonts) { SetFontPath(serverClient, 0, (unsigned char *)defaultFontPath); } else { if (SetDefaultFontPath(defaultFontPath) != Success) ErrorF("failed to set default font path '%s'\n", defaultFontPath); } if (!SetDefaultFont(defaultTextFont)) FatalError("could not open default font '%s'", defaultTextFont); if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0))) FatalError("could not open default cursor font '%s'", defaultCursorFont); #ifdef DPMSExtension /* check all screens, looking for DPMS Capabilities */ DPMSCapableFlag = DPMSSupported(); if (!DPMSCapableFlag) DPMSEnabled = FALSE; #endif #ifdef PANORAMIX /* * Consolidate window and colourmap information for each screen */ if (!noPanoramiXExtension) PanoramiXConsolidate(); #endif for (i = 0; i < screenInfo.numScreens; i++) InitRootWindow(screenInfo.screens[i]->root); DefineInitialRootWindow(screenInfo.screens[0]->root); SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); #ifdef PANORAMIX if (!noPanoramiXExtension) { if (!PanoramiXCreateConnectionBlock()) FatalError("could not create connection block info"); } else #endif { if (!CreateConnectionBlock()) FatalError("could not create connection block info"); } NotifyParentProcess(); Dispatch(); /* Now free up whatever must be freed */ if (screenIsSaved == SCREEN_SAVER_ON) SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset); FreeScreenSaverTimer(); CloseDownExtensions(); #ifdef PANORAMIX { Bool remember_it = noPanoramiXExtension; noPanoramiXExtension = TRUE; FreeAllResources(); noPanoramiXExtension = remember_it; } #else FreeAllResources(); #endif for (i = 0; i < screenInfo.numScreens; i++) screenInfo.screens[i]->root = NullWindow; CloseDownDevices(); CloseDownEvents(); for (i = screenInfo.numScreens - 1; i >= 0; i--) { FreeScratchPixmapsForScreen(i); FreeGCperDepth(i); FreeDefaultStipple(i); (* screenInfo.screens[i]->CloseScreen)(screenInfo.screens[i]); FreeScreen(screenInfo.screens[i]); screenInfo.numScreens = i; } FreeFonts(); FreeAuditTimer(); ReleaseClientIds(serverClient); free(serverClient->devPrivates); serverClient->devPrivates = NULL; if (dispatchException & DE_TERMINATE) { CloseWellKnownConnections(); } OsCleanup((dispatchException & DE_TERMINATE) != 0); if (dispatchException & DE_TERMINATE) { ddxGiveUp(); break; } free(ConnectionInfo); ConnectionInfo = NULL; } return(0); } static int VendorRelease = VENDOR_RELEASE; static char *VendorString = VENDOR_STRING; void SetVendorRelease(int release) { VendorRelease = release; } void SetVendorString(char *string) { VendorString = string; } static int padlength[4] = {0, 3, 2, 1}; #ifndef PANORAMIX static #endif Bool CreateConnectionBlock() { xConnSetup setup; xWindowRoot root; xDepth depth; xVisualType visual; xPixmapFormat format; unsigned long vid; int i, j, k, lenofblock, sizesofar = 0; char *pBuf; memset(&setup, 0, sizeof(xConnSetup)); /* Leave off the ridBase and ridMask, these must be sent with connection */ setup.release = VendorRelease; /* * per-server image and bitmap parameters are defined in Xmd.h */ setup.imageByteOrder = screenInfo.imageByteOrder; setup.bitmapScanlineUnit = screenInfo.bitmapScanlineUnit; setup.bitmapScanlinePad = screenInfo.bitmapScanlinePad; setup.bitmapBitOrder = screenInfo.bitmapBitOrder; setup.motionBufferSize = NumMotionEvents(); setup.numRoots = screenInfo.numScreens; setup.nbytesVendor = strlen(VendorString); setup.numFormats = screenInfo.numPixmapFormats; setup.maxRequestSize = MAX_REQUEST_SIZE; QueryMinMaxKeyCodes(&setup.minKeyCode, &setup.maxKeyCode); lenofblock = sizeof(xConnSetup) + ((setup.nbytesVendor + 3) & ~3) + (setup.numFormats * sizeof(xPixmapFormat)) + (setup.numRoots * sizeof(xWindowRoot)); ConnectionInfo = (char *) malloc(lenofblock); if (!ConnectionInfo) return FALSE; memmove(ConnectionInfo, (char *)&setup, sizeof(xConnSetup)); sizesofar = sizeof(xConnSetup); pBuf = ConnectionInfo + sizeof(xConnSetup); memmove(pBuf, VendorString, (int)setup.nbytesVendor); sizesofar += setup.nbytesVendor; pBuf += setup.nbytesVendor; i = padlength[setup.nbytesVendor & 3]; sizesofar += i; while (--i >= 0) *pBuf++ = 0; memset(&format, 0, sizeof(xPixmapFormat)); for (i=0; iroot->drawable.id; root.defaultColormap = pScreen->defColormap; root.whitePixel = pScreen->whitePixel; root.blackPixel = pScreen->blackPixel; root.currentInputMask = 0; /* filled in when sent */ root.pixWidth = pScreen->width; root.pixHeight = pScreen->height; root.mmWidth = pScreen->mmWidth; root.mmHeight = pScreen->mmHeight; root.minInstalledMaps = pScreen->minInstalledCmaps; root.maxInstalledMaps = pScreen->maxInstalledCmaps; root.rootVisualID = pScreen->rootVisual; root.backingStore = pScreen->backingStoreSupport; root.saveUnders = pScreen->saveUnderSupport != NotUseful; root.rootDepth = pScreen->rootDepth; root.nDepths = pScreen->numDepths; memmove(pBuf, (char *)&root, sizeof(xWindowRoot)); sizesofar += sizeof(xWindowRoot); pBuf += sizeof(xWindowRoot); pDepth = pScreen->allowedDepths; for(j = 0; j < pScreen->numDepths; j++, pDepth++) { lenofblock += sizeof(xDepth) + (pDepth->numVids * sizeof(xVisualType)); pBuf = (char *)realloc(ConnectionInfo, lenofblock); if (!pBuf) { free(ConnectionInfo); return FALSE; } ConnectionInfo = pBuf; pBuf += sizesofar; depth.depth = pDepth->depth; depth.nVisuals = pDepth->numVids; memmove(pBuf, (char *)&depth, sizeof(xDepth)); pBuf += sizeof(xDepth); sizesofar += sizeof(xDepth); for(k = 0; k < pDepth->numVids; k++) { vid = pDepth->vids[k]; for (pVisual = pScreen->visuals; pVisual->vid != vid; pVisual++) ; visual.visualID = vid; visual.class = pVisual->class; visual.bitsPerRGB = pVisual->bitsPerRGBValue; visual.colormapEntries = pVisual->ColormapEntries; visual.redMask = pVisual->redMask; visual.greenMask = pVisual->greenMask; visual.blueMask = pVisual->blueMask; memmove(pBuf, (char *)&visual, sizeof(xVisualType)); pBuf += sizeof(xVisualType); sizesofar += sizeof(xVisualType); } } } connSetupPrefix.success = xTrue; connSetupPrefix.length = lenofblock/4; connSetupPrefix.majorVersion = X_PROTOCOL; connSetupPrefix.minorVersion = X_PROTOCOL_REVISION; return TRUE; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/pixmap.c0000644000000000000000000001000713614532331017017 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "scrnintstr.h" #include "misc.h" #include "os.h" #include "windowstr.h" #include "resource.h" #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" #include "site.h" /* * Scratch pixmap management and device independent pixmap allocation * function. */ /* callable by ddx */ PixmapPtr GetScratchPixmapHeader(ScreenPtr pScreen, int width, int height, int depth, int bitsPerPixel, int devKind, void * pPixData) { PixmapPtr pPixmap = pScreen->pScratchPixmap; if (pPixmap) pScreen->pScratchPixmap = NULL; else /* width and height of 0 means don't allocate any pixmap data */ pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth, 0); if (pPixmap) { if ((*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth, bitsPerPixel, devKind, pPixData)) return pPixmap; (*pScreen->DestroyPixmap)(pPixmap); } return NullPixmap; } /* callable by ddx */ void FreeScratchPixmapHeader(PixmapPtr pPixmap) { if (pPixmap) { ScreenPtr pScreen = pPixmap->drawable.pScreen; pPixmap->devPrivate.ptr = NULL; /* lest ddx chases bad ptr */ if (pScreen->pScratchPixmap) (*pScreen->DestroyPixmap)(pPixmap); else pScreen->pScratchPixmap = pPixmap; } } Bool CreateScratchPixmapsForScreen(int scrnum) { /* let it be created on first use */ screenInfo.screens[scrnum]->pScratchPixmap = NULL; return TRUE; } void FreeScratchPixmapsForScreen(int scrnum) { FreeScratchPixmapHeader(screenInfo.screens[scrnum]->pScratchPixmap); } /* callable by ddx */ PixmapPtr AllocatePixmap(ScreenPtr pScreen, int pixDataSize) { PixmapPtr pPixmap; #ifdef PIXPRIV char *ptr; DevUnion *ppriv; unsigned *sizes; unsigned size; int i; if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize) return NullPixmap; /* * FIXME: Allocate 4 bytes at the end of each pixmap. This * is a quick workaround intended to fix a problem reported * by Valgrind due to fbBlt() writing just after the end of * the pixmap buffer. This may be a RENDER bug. * This is not included in xorg upstream! */ pPixmap = (PixmapPtr)calloc(1, pScreen->totalPixmapSize + pixDataSize + 4); if (!pPixmap) return NullPixmap; ppriv = (DevUnion *)(pPixmap + 1); pPixmap->devPrivates = ppriv; sizes = pScreen->PixmapPrivateSizes; ptr = (char *)(ppriv + pScreen->PixmapPrivateLen); for (i = pScreen->PixmapPrivateLen; --i >= 0; ppriv++, sizes++) { if ((size = *sizes) != 0) { ppriv->ptr = (void *)ptr; ptr += size; } else ppriv->ptr = (void *)NULL; } #else pPixmap = (PixmapPtr)calloc(1, sizeof(PixmapRec) + pixDataSize); #endif #ifdef _XSERVER64 if (pPixmap) { pPixmap->drawable.pad0 = 0; pPixmap->drawable.pad1 = 0; } #endif return pPixmap; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/privates.c0000644000000000000000000002342113614532331017362 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "scrnintstr.h" #include "misc.h" #include "os.h" #include "windowstr.h" #include "resource.h" #include "dixstruct.h" #include "gcstruct.h" #include "colormapst.h" #include "servermd.h" #include "site.h" #include "inputstr.h" #include "extnsionst.h" /* * See the Wrappers and devPrivates section in "Definition of the * Porting Layer for the X v11 Sample Server" (doc/Server/ddx.tbl.ms) * for information on how to use devPrivates. */ /* * extension private machinery */ static int extensionPrivateCount; int extensionPrivateLen; unsigned *extensionPrivateSizes; unsigned totalExtensionSize; void ResetExtensionPrivates() { extensionPrivateCount = 0; extensionPrivateLen = 0; free(extensionPrivateSizes); extensionPrivateSizes = (unsigned *)NULL; totalExtensionSize = ((sizeof(ExtensionEntry) + sizeof(long) - 1) / sizeof(long)) * sizeof(long); } int AllocateExtensionPrivateIndex() { return extensionPrivateCount++; } Bool AllocateExtensionPrivate(int index2, unsigned amount) { unsigned oldamount; /* Round up sizes for proper alignment */ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); if (index2 >= extensionPrivateLen) { unsigned *nsizes; nsizes = (unsigned *)realloc(extensionPrivateSizes, (index2 + 1) * sizeof(unsigned)); if (!nsizes) return FALSE; while (extensionPrivateLen <= index2) { nsizes[extensionPrivateLen++] = 0; totalExtensionSize += sizeof(DevUnion); } extensionPrivateSizes = nsizes; } oldamount = extensionPrivateSizes[index2]; if (amount > oldamount) { extensionPrivateSizes[index2] = amount; totalExtensionSize += (amount - oldamount); } return TRUE; } /* * client private machinery */ static int clientPrivateCount; int clientPrivateLen; unsigned *clientPrivateSizes; unsigned totalClientSize; void ResetClientPrivates() { clientPrivateCount = 0; clientPrivateLen = 0; free(clientPrivateSizes); clientPrivateSizes = (unsigned *)NULL; totalClientSize = ((sizeof(ClientRec) + sizeof(long) - 1) / sizeof(long)) * sizeof(long); } int AllocateClientPrivateIndex() { return clientPrivateCount++; } Bool AllocateClientPrivate(int index2, unsigned amount) { unsigned oldamount; /* Round up sizes for proper alignment */ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); if (index2 >= clientPrivateLen) { unsigned *nsizes; nsizes = (unsigned *)realloc(clientPrivateSizes, (index2 + 1) * sizeof(unsigned)); if (!nsizes) return FALSE; while (clientPrivateLen <= index2) { nsizes[clientPrivateLen++] = 0; totalClientSize += sizeof(DevUnion); } clientPrivateSizes = nsizes; } oldamount = clientPrivateSizes[index2]; if (amount > oldamount) { clientPrivateSizes[index2] = amount; totalClientSize += (amount - oldamount); } return TRUE; } /* * screen private machinery */ int screenPrivateCount; void ResetScreenPrivates() { screenPrivateCount = 0; } /* this can be called after some screens have been created, * so we have to worry about resizing existing devPrivates */ int AllocateScreenPrivateIndex() { int idx; int i; ScreenPtr pScreen; DevUnion *nprivs; idx = screenPrivateCount++; for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; nprivs = (DevUnion *)realloc(pScreen->devPrivates, screenPrivateCount * sizeof(DevUnion)); if (!nprivs) { screenPrivateCount--; return -1; } /* Zero the new private */ bzero(&nprivs[idx], sizeof(DevUnion)); pScreen->devPrivates = nprivs; } return idx; } /* * window private machinery */ static int windowPrivateCount; void ResetWindowPrivates() { windowPrivateCount = 0; } int AllocateWindowPrivateIndex() { return windowPrivateCount++; } Bool AllocateWindowPrivate(register ScreenPtr pScreen, int index2, unsigned amount) { unsigned oldamount; /* Round up sizes for proper alignment */ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); if (index2 >= pScreen->WindowPrivateLen) { unsigned *nsizes; nsizes = (unsigned *)realloc(pScreen->WindowPrivateSizes, (index2 + 1) * sizeof(unsigned)); if (!nsizes) return FALSE; while (pScreen->WindowPrivateLen <= index2) { nsizes[pScreen->WindowPrivateLen++] = 0; pScreen->totalWindowSize += sizeof(DevUnion); } pScreen->WindowPrivateSizes = nsizes; } oldamount = pScreen->WindowPrivateSizes[index2]; if (amount > oldamount) { pScreen->WindowPrivateSizes[index2] = amount; pScreen->totalWindowSize += (amount - oldamount); } return TRUE; } /* * gc private machinery */ static int gcPrivateCount; void ResetGCPrivates() { gcPrivateCount = 0; } int AllocateGCPrivateIndex() { return gcPrivateCount++; } Bool AllocateGCPrivate(register ScreenPtr pScreen, int index2, unsigned amount) { unsigned oldamount; /* Round up sizes for proper alignment */ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); if (index2 >= pScreen->GCPrivateLen) { unsigned *nsizes; nsizes = (unsigned *)realloc(pScreen->GCPrivateSizes, (index2 + 1) * sizeof(unsigned)); if (!nsizes) return FALSE; while (pScreen->GCPrivateLen <= index2) { nsizes[pScreen->GCPrivateLen++] = 0; pScreen->totalGCSize += sizeof(DevUnion); } pScreen->GCPrivateSizes = nsizes; } oldamount = pScreen->GCPrivateSizes[index2]; if (amount > oldamount) { pScreen->GCPrivateSizes[index2] = amount; pScreen->totalGCSize += (amount - oldamount); } return TRUE; } /* * pixmap private machinery */ #ifdef PIXPRIV static int pixmapPrivateCount; void ResetPixmapPrivates() { pixmapPrivateCount = 0; } int AllocatePixmapPrivateIndex() { return pixmapPrivateCount++; } Bool AllocatePixmapPrivate(register ScreenPtr pScreen, int index2, unsigned amount) { unsigned oldamount; /* Round up sizes for proper alignment */ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); if (index2 >= pScreen->PixmapPrivateLen) { unsigned *nsizes; nsizes = (unsigned *)realloc(pScreen->PixmapPrivateSizes, (index2 + 1) * sizeof(unsigned)); if (!nsizes) return FALSE; while (pScreen->PixmapPrivateLen <= index2) { nsizes[pScreen->PixmapPrivateLen++] = 0; pScreen->totalPixmapSize += sizeof(DevUnion); } pScreen->PixmapPrivateSizes = nsizes; } oldamount = pScreen->PixmapPrivateSizes[index2]; if (amount > oldamount) { pScreen->PixmapPrivateSizes[index2] = amount; pScreen->totalPixmapSize += (amount - oldamount); } pScreen->totalPixmapSize = BitmapBytePad(pScreen->totalPixmapSize * 8); return TRUE; } #endif /* * colormap private machinery */ int colormapPrivateCount; void ResetColormapPrivates() { colormapPrivateCount = 0; } int AllocateColormapPrivateIndex (InitCmapPrivFunc initPrivFunc) { int index; int i; ColormapPtr pColormap; DevUnion *privs; index = colormapPrivateCount++; for (i = 0; i < screenInfo.numScreens; i++) { /* * AllocateColormapPrivateIndex may be called after the * default colormap has been created on each screen! * * We must resize the devPrivates array for the default * colormap on each screen, making room for this new private. * We also call the initialization function 'initPrivFunc' on * the new private allocated for each default colormap. */ ScreenPtr pScreen = screenInfo.screens[i]; pColormap = (ColormapPtr) LookupIDByType ( pScreen->defColormap, RT_COLORMAP); if (pColormap) { privs = (DevUnion *) realloc (pColormap->devPrivates, colormapPrivateCount * sizeof(DevUnion)); if (!privs) { colormapPrivateCount--; return -1; } bzero(&privs[index], sizeof(DevUnion)); pColormap->devPrivates = privs; if (!(*initPrivFunc)(pColormap,index)) { colormapPrivateCount--; return -1; } } } return index; } /* * device private machinery */ static int devicePrivateIndex = 0; int AllocateDevicePrivateIndex() { return devicePrivateIndex++; } Bool AllocateDevicePrivate(DeviceIntPtr device, int index) { if (device->nPrivates < ++index) { DevUnion *nprivs = (DevUnion *) realloc(device->devPrivates, index * sizeof(DevUnion)); if (!nprivs) return FALSE; device->devPrivates = nprivs; bzero(&nprivs[device->nPrivates], sizeof(DevUnion) * (index - device->nPrivates)); device->nPrivates = index; return TRUE; } else { return TRUE; } } void ResetDevicePrivateIndex(void) { devicePrivateIndex = 0; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/property.c0000644000000000000000000004604513614532331017420 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "windowstr.h" #include "propertyst.h" #include "dixstruct.h" #include "dispatch.h" #include "swaprep.h" #ifdef XCSECURITY #define _SECURITY_SERVER #include #endif /***************************************************************** * Property Stuff * * ChangeProperty, DeleteProperty, GetProperties, * ListProperties * * Properties below to windows. A allocate slots each time * a property is added. No fancy searching done. * *****************************************************************/ #ifdef notdef static void PrintPropertys(WindowPtr pWin) { PropertyPtr pProp; register int j; pProp = pWin->userProps; while (pProp) { ErrorF( "%x %x\n", pProp->propertyName, pProp->type); ErrorF("property format: %d\n", pProp->format); ErrorF("property data: \n"); for (j=0; j<(pProp->format/8)*pProp->size; j++) ErrorF("%c\n", pProp->data[j]); pProp = pProp->next; } } #endif int ProcRotateProperties(ClientPtr client) { int i, j, delta; REQUEST(xRotatePropertiesReq); WindowPtr pWin; register Atom * atoms; PropertyPtr * props; /* array of pointer */ PropertyPtr pProp; REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2); UpdateCurrentTime(); pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client, DixWriteAccess); if (!pWin) return(BadWindow); if (!stuff->nAtoms) return(Success); atoms = (Atom *) & stuff[1]; props = (PropertyPtr *)malloc(stuff->nAtoms * sizeof(PropertyPtr)); if (!props) return(BadAlloc); for (i = 0; i < stuff->nAtoms; i++) { #ifdef XCSECURITY char action = SecurityCheckPropertyAccess(client, pWin, atoms[i], DixReadAccess|DixWriteAccess); #endif if (!ValidAtom(atoms[i]) #ifdef XCSECURITY || (SecurityErrorOperation == action) #endif ) { free(props); client->errorValue = atoms[i]; return BadAtom; } #ifdef XCSECURITY if (SecurityIgnoreOperation == action) { free(props); return Success; } #endif for (j = i + 1; j < stuff->nAtoms; j++) if (atoms[j] == atoms[i]) { free(props); return BadMatch; } pProp = wUserProps (pWin); while (pProp) { if (pProp->propertyName == atoms[i]) goto found; pProp = pProp->next; } free(props); return BadMatch; found: props[i] = pProp; } delta = stuff->nPositions; /* If the rotation is a complete 360 degrees, then moving the properties around and generating PropertyNotify events should be skipped. */ if ( (stuff->nAtoms != 0) && (abs(delta) % stuff->nAtoms) != 0 ) { while (delta < 0) /* faster if abs value is small */ delta += stuff->nAtoms; for (i = 0; i < stuff->nAtoms; i++) { /* Generate a PropertyNotify event for each property whose value is changed in the order in which they appear in the request. */ xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.u.type = PropertyNotify; event.u.property.window = pWin->drawable.id; event.u.property.state = PropertyNewValue; event.u.property.atom = props[i]->propertyName; event.u.property.time = currentTime.milliseconds; DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); props[i]->propertyName = atoms[(i + delta) % stuff->nAtoms]; } } free(props); return Success; } #ifndef NXAGENT_SERVER int ProcChangeProperty(ClientPtr client) { WindowPtr pWin; char format, mode; unsigned long len; int sizeInBytes; int totalSize; int err; REQUEST(xChangePropertyReq); REQUEST_AT_LEAST_SIZE(xChangePropertyReq); UpdateCurrentTime(); format = stuff->format; mode = stuff->mode; if ((mode != PropModeReplace) && (mode != PropModeAppend) && (mode != PropModePrepend)) { client->errorValue = mode; return BadValue; } if ((format != 8) && (format != 16) && (format != 32)) { client->errorValue = format; return BadValue; } len = stuff->nUnits; if (len > ((0xffffffff - sizeof(xChangePropertyReq)) >> 2)) return BadLength; sizeInBytes = format>>3; totalSize = len * sizeInBytes; REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixWriteAccess); if (!pWin) return(BadWindow); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return(BadAtom); } if (!ValidAtom(stuff->type)) { client->errorValue = stuff->type; return(BadAtom); } #ifdef XCSECURITY switch (SecurityCheckPropertyAccess(client, pWin, stuff->property, DixWriteAccess)) { case SecurityErrorOperation: client->errorValue = stuff->property; return BadAtom; case SecurityIgnoreOperation: return Success; } #endif err = ChangeWindowProperty(pWin, stuff->property, stuff->type, (int)format, (int)mode, len, (void *)&stuff[1], TRUE); if (err != Success) return err; else return client->noClientException; } #endif /* NXAGENT_SERVER */ int #ifdef NXAGENT_SERVER Xorg_ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, int mode, unsigned long len, void * value, Bool sendevent) #else ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, int mode, unsigned long len, void * value, Bool sendevent) #endif { PropertyPtr pProp; int sizeInBytes; int totalSize; void * data; sizeInBytes = format>>3; totalSize = len * sizeInBytes; /* first see if property already exists */ pProp = wUserProps (pWin); while (pProp) { if (pProp->propertyName == property) break; pProp = pProp->next; } if (!pProp) /* just add to list */ { if (!pWin->optional && !MakeWindowOptional (pWin)) return(BadAlloc); pProp = (PropertyPtr)malloc(sizeof(PropertyRec)); if (!pProp) return(BadAlloc); data = (void *)malloc(totalSize); if (!data && len) { free(pProp); return(BadAlloc); } pProp->propertyName = property; pProp->type = type; pProp->format = format; pProp->data = data; if (len) memmove((char *)data, (char *)value, totalSize); pProp->size = len; pProp->next = pWin->optional->userProps; pWin->optional->userProps = pProp; } else { /* To append or prepend to a property the request format and type must match those of the already defined property. The existing format and type are irrelevant when using the mode "PropModeReplace" since they will be written over. */ if ((format != pProp->format) && (mode != PropModeReplace)) return(BadMatch); if ((pProp->type != type) && (mode != PropModeReplace)) return(BadMatch); if (mode == PropModeReplace) { if (totalSize != pProp->size * (pProp->format >> 3)) { data = (void *)realloc(pProp->data, totalSize); if (!data && len) return(BadAlloc); pProp->data = data; } if (len) memmove((char *)pProp->data, (char *)value, totalSize); pProp->size = len; pProp->type = type; pProp->format = format; } else if (len == 0) { /* do nothing */ } else if (mode == PropModeAppend) { data = (void *)realloc(pProp->data, sizeInBytes * (len + pProp->size)); if (!data) return(BadAlloc); pProp->data = data; memmove(&((char *)data)[pProp->size * sizeInBytes], (char *)value, totalSize); pProp->size += len; } else if (mode == PropModePrepend) { data = (void *)malloc(sizeInBytes * (len + pProp->size)); if (!data) return(BadAlloc); memmove(&((char *)data)[totalSize], (char *)pProp->data, (int)(pProp->size * sizeInBytes)); memmove((char *)data, (char *)value, totalSize); free(pProp->data); pProp->data = data; pProp->size += len; } } if (sendevent) { xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.u.type = PropertyNotify; event.u.property.window = pWin->drawable.id; event.u.property.state = PropertyNewValue; event.u.property.atom = pProp->propertyName; event.u.property.time = currentTime.milliseconds; DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); } return(Success); } int DeleteProperty(WindowPtr pWin, Atom propName) { PropertyPtr pProp, prevProp; if (!(pProp = wUserProps (pWin))) return(Success); prevProp = (PropertyPtr)NULL; while (pProp) { if (pProp->propertyName == propName) break; prevProp = pProp; pProp = pProp->next; } if (pProp) { xEvent event; if (prevProp == (PropertyPtr)NULL) /* takes care of head */ { if (!(pWin->optional->userProps = pProp->next)) CheckWindowOptionalNeed (pWin); } else { prevProp->next = pProp->next; } memset(&event, 0, sizeof(xEvent)); event.u.u.type = PropertyNotify; event.u.property.window = pWin->drawable.id; event.u.property.state = PropertyDelete; event.u.property.atom = pProp->propertyName; event.u.property.time = currentTime.milliseconds; DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); free(pProp->data); free(pProp); } return(Success); } void DeleteAllWindowProperties(WindowPtr pWin) { PropertyPtr pProp, pNextProp; xEvent event; memset(&event, 0, sizeof(xEvent)); pProp = wUserProps (pWin); while (pProp) { event.u.u.type = PropertyNotify; event.u.property.window = pWin->drawable.id; event.u.property.state = PropertyDelete; event.u.property.atom = pProp->propertyName; event.u.property.time = currentTime.milliseconds; DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); pNextProp = pProp->next; free(pProp->data); free(pProp); pProp = pNextProp; } } static int NullPropertyReply( ClientPtr client, ATOM propertyType, int format, xGetPropertyReply *reply) { reply->nItems = 0; reply->length = 0; reply->bytesAfter = 0; reply->propertyType = propertyType; reply->format = format; WriteReplyToClient(client, sizeof(xGenericReply), reply); return(client->noClientException); } #ifndef NXAGENT_SERVER /***************** * GetProperty * If type Any is specified, returns the property from the specified * window regardless of its type. If a type is specified, returns the * property only if its type equals the specified type. * If delete is True and a property is returned, the property is also * deleted from the window and a PropertyNotify event is generated on the * window. *****************/ int ProcGetProperty(ClientPtr client) { PropertyPtr pProp, prevProp; unsigned long n, len, ind; WindowPtr pWin; xGetPropertyReply reply; REQUEST(xGetPropertyReq); REQUEST_SIZE_MATCH(xGetPropertyReq); if (stuff->delete) UpdateCurrentTime(); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixReadAccess); if (!pWin) return BadWindow; if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return(BadAtom); } if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) { client->errorValue = stuff->delete; return(BadValue); } if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type)) { client->errorValue = stuff->type; return(BadAtom); } pProp = wUserProps (pWin); prevProp = (PropertyPtr)NULL; while (pProp) { if (pProp->propertyName == stuff->property) break; prevProp = pProp; pProp = pProp->next; } memset(&reply, 0, sizeof(xGetPropertyReply)); reply.type = X_Reply; reply.sequenceNumber = client->sequence; if (!pProp) return NullPropertyReply(client, None, 0, &reply); #ifdef XCSECURITY { Mask access_mode = DixReadAccess; if (stuff->delete) access_mode |= DixDestroyAccess; switch(SecurityCheckPropertyAccess(client, pWin, stuff->property, access_mode)) { case SecurityErrorOperation: client->errorValue = stuff->property; return BadAtom;; case SecurityIgnoreOperation: return NullPropertyReply(client, pProp->type, pProp->format, &reply); } } #endif /* If the request type and actual type don't match. Return the property information, but not the data. */ if (((stuff->type != pProp->type) && (stuff->type != AnyPropertyType)) ) { reply.bytesAfter = pProp->size; reply.format = pProp->format; reply.length = 0; reply.nItems = 0; reply.propertyType = pProp->type; WriteReplyToClient(client, sizeof(xGenericReply), &reply); return(Success); } /* * Return type, format, value to client */ n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */ ind = stuff->longOffset << 2; /* If longOffset is invalid such that it causes "len" to be negative, it's a value error. */ if (n < ind) { client->errorValue = stuff->longOffset; return BadValue; } len = min(n - ind, 4 * stuff->longLength); reply.bytesAfter = n - (ind + len); reply.format = pProp->format; reply.length = (len + 3) >> 2; reply.nItems = len / (pProp->format / 8 ); reply.propertyType = pProp->type; if (stuff->delete && (reply.bytesAfter == 0)) { /* send the event */ xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.u.type = PropertyNotify; event.u.property.window = pWin->drawable.id; event.u.property.state = PropertyDelete; event.u.property.atom = pProp->propertyName; event.u.property.time = currentTime.milliseconds; DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); } WriteReplyToClient(client, sizeof(xGenericReply), &reply); if (len) { switch (reply.format) { case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break; case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break; default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break; } WriteSwappedDataToClient(client, len, (char *)pProp->data + ind); } if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */ if (prevProp == (PropertyPtr)NULL) /* takes care of head */ { if (!(pWin->optional->userProps = pProp->next)) CheckWindowOptionalNeed (pWin); } else prevProp->next = pProp->next; free(pProp->data); free(pProp); } return(client->noClientException); } #endif /* NXAGENT_SERVER */ int ProcListProperties(ClientPtr client) { Atom *pAtoms = NULL, *temppAtoms; xListPropertiesReply xlpr; int numProps = 0; WindowPtr pWin; PropertyPtr pProp; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, DixReadAccess); if (!pWin) return(BadWindow); pProp = wUserProps (pWin); while (pProp) { pProp = pProp->next; numProps++; } if (numProps) if(!(pAtoms = (Atom *)malloc(numProps * sizeof(Atom)))) return(BadAlloc); memset(&xlpr, 0, sizeof(xListPropertiesReply)); xlpr.type = X_Reply; xlpr.nProperties = numProps; xlpr.length = (numProps * sizeof(Atom)) >> 2; xlpr.sequenceNumber = client->sequence; pProp = wUserProps (pWin); temppAtoms = pAtoms; while (pProp) { *temppAtoms++ = pProp->propertyName; pProp = pProp->next; } WriteReplyToClient(client, sizeof(xGenericReply), &xlpr); if (numProps) { client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write; WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); free(pAtoms); } return(client->noClientException); } #ifndef NXAGENT_SERVER int ProcDeleteProperty(register ClientPtr client) { WindowPtr pWin; REQUEST(xDeletePropertyReq); int result; REQUEST_SIZE_MATCH(xDeletePropertyReq); UpdateCurrentTime(); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixWriteAccess); if (!pWin) return(BadWindow); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return (BadAtom); } #ifdef XCSECURITY switch(SecurityCheckPropertyAccess(client, pWin, stuff->property, DixDestroyAccess)) { case SecurityErrorOperation: client->errorValue = stuff->property; return BadAtom;; case SecurityIgnoreOperation: return Success; } #endif result = DeleteProperty(pWin, stuff->property); if (client->noClientException != Success) return(client->noClientException); else return(result); } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/region.c0000644000000000000000000013703613614532331017020 0ustar /*********************************************************** Copyright 1987, 1988, 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* The panoramix components contained the following notice */ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "regionstr.h" #include #include "gc.h" #if defined (__GNUC__) && !defined (NO_INLINES) #define INLINE __inline #else #define INLINE #endif #undef assert #ifdef DEBUG #define assert(expr) {if (!(expr)) \ FatalError("Assertion failed file %s, line %d: expr\n", \ __FILE__, __LINE__); } #else #define assert(expr) #endif #define good(reg) assert(RegionIsValid(reg)) /* * The functions in this file implement the Region abstraction used extensively * throughout the X11 sample server. A Region is simply a set of disjoint * (non-overlapping) rectangles, plus an "extent" rectangle which is the * smallest single rectangle that contains all the non-overlapping rectangles. * * A Region is implemented as a "y-x-banded" array of rectangles. This array * imposes two degrees of order. First, all rectangles are sorted by top side * y coordinate first (y1), and then by left side x coordinate (x1). * * Furthermore, the rectangles are grouped into "bands". Each rectangle in a * band has the same top y coordinate (y1), and each has the same bottom y * coordinate (y2). Thus all rectangles in a band differ only in their left * and right side (x1 and x2). Bands are implicit in the array of rectangles: * there is no separate list of band start pointers. * * The y-x band representation does not minimize rectangles. In particular, * if a rectangle vertically crosses a band (the rectangle has scanlines in * the y1 to y2 area spanned by the band), then the rectangle may be broken * down into two or more smaller rectangles stacked one atop the other. * * ----------- ----------- * | | | | band 0 * | | -------- ----------- -------- * | | | | in y-x banded | | | | band 1 * | | | | form is | | | | * ----------- | | ----------- -------- * | | | | band 2 * -------- -------- * * An added constraint on the rectangles is that they must cover as much * horizontal area as possible: no two rectangles within a band are allowed * to touch. * * Whenever possible, bands will be merged together to cover a greater vertical * distance (and thus reduce the number of rectangles). Two bands can be merged * only if the bottom of one touches the top of the other and they have * rectangles in the same places (of the same width, of course). * * Adam de Boor wrote most of the original region code. Joel McCormack * substantially modified or rewrote most of the core arithmetic routines, * and added RegionValidate in order to support several speed improvements * to miValidateTree. Bob Scheifler changed the representation to be more * compact when empty or a single rectangle, and did a bunch of gratuitous * reformatting. */ /* true iff two Boxes overlap */ #define EXTENTCHECK(r1,r2) \ (!( ((r1)->x2 <= (r2)->x1) || \ ((r1)->x1 >= (r2)->x2) || \ ((r1)->y2 <= (r2)->y1) || \ ((r1)->y1 >= (r2)->y2) ) ) /* true iff (x,y) is in Box */ #define INBOX(r,x,y) \ ( ((r)->x2 > x) && \ ((r)->x1 <= x) && \ ((r)->y2 > y) && \ ((r)->y1 <= y) ) /* true iff Box r1 contains Box r2 */ #define SUBSUMES(r1,r2) \ ( ((r1)->x1 <= (r2)->x1) && \ ((r1)->x2 >= (r2)->x2) && \ ((r1)->y1 <= (r2)->y1) && \ ((r1)->y2 >= (r2)->y2) ) #define xfreeData(reg) if ((reg)->data && (reg)->data->size) free((reg)->data) #define RECTALLOC_BAIL(pReg,n,bail) \ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \ if (!RegionRectAlloc(pReg, n)) { goto bail; } #define RECTALLOC(pReg,n) \ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \ if (!RegionRectAlloc(pReg, n)) { return FALSE; } #define ADDRECT(pNextRect,nx1,ny1,nx2,ny2) \ { \ pNextRect->x1 = nx1; \ pNextRect->y1 = ny1; \ pNextRect->x2 = nx2; \ pNextRect->y2 = ny2; \ pNextRect++; \ } #define NEWRECT(pReg,pNextRect,nx1,ny1,nx2,ny2) \ { \ if (!(pReg)->data || ((pReg)->data->numRects == (pReg)->data->size))\ { \ if (!RegionRectAlloc(pReg, 1)) \ return FALSE; \ pNextRect = RegionTop(pReg); \ } \ ADDRECT(pNextRect,nx1,ny1,nx2,ny2); \ pReg->data->numRects++; \ assert(pReg->data->numRects<=pReg->data->size); \ } #define DOWNSIZE(reg,numRects) \ if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \ { \ size_t NewSize = RegionSizeof(numRects); \ RegDataPtr NewData = \ (NewSize > 0) ? (RegDataPtr)realloc((reg)->data, NewSize) : NULL; \ if (NewData) \ { \ NewData->size = (numRects); \ (reg)->data = NewData; \ } \ } pixman_box16_t RegionEmptyBox = {0, 0, 0, 0}; RegDataRec RegionEmptyData = {0, 0}; RegDataRec RegionBrokenData = {0, 0}; RegionRec RegionBrokenRegion = { { 0, 0, 0, 0 }, &RegionBrokenData }; #ifdef DEBUG int RegionPrint(rgn) RegionPtr rgn; { int num, size; register int i; BoxPtr rects; num = RegionNumRects(rgn); size = RegionSize(rgn); rects = RegionRects(rgn); ErrorF("num: %d size: %d\n", num, size); ErrorF("extents: %d %d %d %d\n", rgn->extents.x1, rgn->extents.y1, rgn->extents.x2, rgn->extents.y2); for (i = 0; i < num; i++) ErrorF("%d %d %d %d \n", rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2); ErrorF("\n"); return(num); } #endif /* DEBUG */ #ifdef DEBUG Bool RegionIsValid(reg) RegionPtr reg; { register int i, numRects; if ((reg->extents.x1 > reg->extents.x2) || (reg->extents.y1 > reg->extents.y2)) return FALSE; numRects = RegionNumRects(reg); if (!numRects) return ((reg->extents.x1 == reg->extents.x2) && (reg->extents.y1 == reg->extents.y2) && (reg->data->size || (reg->data == &RegionEmptyData))); else if (numRects == 1) return (!reg->data); else { register BoxPtr pboxP, pboxN; BoxRec box; pboxP = RegionRects(reg); box = *pboxP; box.y2 = pboxP[numRects-1].y2; pboxN = pboxP + 1; for (i = numRects; --i > 0; pboxP++, pboxN++) { if ((pboxN->x1 >= pboxN->x2) || (pboxN->y1 >= pboxN->y2)) return FALSE; if (pboxN->x1 < box.x1) box.x1 = pboxN->x1; if (pboxN->x2 > box.x2) box.x2 = pboxN->x2; if ((pboxN->y1 < pboxP->y1) || ((pboxN->y1 == pboxP->y1) && ((pboxN->x1 < pboxP->x2) || (pboxN->y2 != pboxP->y2)))) return FALSE; } return ((box.x1 == reg->extents.x1) && (box.x2 == reg->extents.x2) && (box.y1 == reg->extents.y1) && (box.y2 == reg->extents.y2)); } } #endif /* DEBUG */ /***************************************************************** * RegionCreate(rect, size) * This routine does a simple malloc to make a structure of * REGION of "size" number of rectangles. *****************************************************************/ RegionPtr RegionCreate(rect, size) BoxPtr rect; int size; { register RegionPtr pReg; size_t newSize; pReg = (RegionPtr)malloc(sizeof(RegionRec)); if (!pReg) return &RegionBrokenRegion; if (rect) { pReg->extents = *rect; pReg->data = (RegDataPtr)NULL; } else { pReg->extents = RegionEmptyBox; newSize = RegionSizeof(size); if ((size > 1) && (newSize > 0) && (pReg->data = malloc(newSize))) { pReg->data->size = size; pReg->data->numRects = 0; } else pReg->data = &RegionEmptyData; } return(pReg); } void RegionDestroy(pReg) RegionPtr pReg; { good(pReg); xfreeData(pReg); if (pReg != &RegionBrokenRegion) free(pReg); } Bool RegionBreak (pReg) RegionPtr pReg; { xfreeData (pReg); pReg->extents = RegionEmptyBox; pReg->data = &RegionBrokenData; return FALSE; } Bool RegionRectAlloc( register RegionPtr pRgn, int n) { RegDataPtr data; size_t rgnSize; if (!pRgn->data) { n++; rgnSize = RegionSizeof(n); pRgn->data = (rgnSize > 0) ? malloc(rgnSize) : NULL; if (!pRgn->data) return RegionBreak (pRgn); pRgn->data->numRects = 1; *RegionBoxptr(pRgn) = pRgn->extents; } else if (!pRgn->data->size) { rgnSize = RegionSizeof(n); pRgn->data = (rgnSize > 0) ? malloc(rgnSize) : NULL; if (!pRgn->data) return RegionBreak (pRgn); pRgn->data->numRects = 0; } else { if (n == 1) { n = pRgn->data->numRects; if (n > 500) /* XXX pick numbers out of a hat */ n = 250; } n += pRgn->data->numRects; rgnSize = RegionSizeof(n); data = (rgnSize > 0) ? realloc(pRgn->data, rgnSize) : NULL; if (!data) return RegionBreak (pRgn); pRgn->data = data; } pRgn->data->size = n; return TRUE; } /*====================================================================== * Generic Region Operator *====================================================================*/ /*- *----------------------------------------------------------------------- * RegionCoalesce -- * Attempt to merge the boxes in the current band with those in the * previous one. We are guaranteed that the current band extends to * the end of the rects array. Used only by RegionOp. * * Results: * The new index for the previous band. * * Side Effects: * If coalescing takes place: * - rectangles in the previous band will have their y2 fields * altered. * - pReg->data->numRects will be decreased. * *----------------------------------------------------------------------- */ INLINE static int RegionCoalesce ( register RegionPtr pReg, /* Region to coalesce */ int prevStart, /* Index of start of previous band */ int curStart) /* Index of start of current band */ { register BoxPtr pPrevBox; /* Current box in previous band */ register BoxPtr pCurBox; /* Current box in current band */ register int numRects; /* Number rectangles in both bands */ register int y2; /* Bottom of current band */ /* * Figure out how many rectangles are in the band. */ numRects = curStart - prevStart; assert(numRects == pReg->data->numRects - curStart); if (!numRects) return curStart; /* * The bands may only be coalesced if the bottom of the previous * matches the top scanline of the current. */ pPrevBox = RegionBox(pReg, prevStart); pCurBox = RegionBox(pReg, curStart); if (pPrevBox->y2 != pCurBox->y1) return curStart; /* * Make sure the bands have boxes in the same places. This * assumes that boxes have been added in such a way that they * cover the most area possible. I.e. two boxes in a band must * have some horizontal space between them. */ y2 = pCurBox->y2; do { if ((pPrevBox->x1 != pCurBox->x1) || (pPrevBox->x2 != pCurBox->x2)) { return (curStart); } pPrevBox++; pCurBox++; numRects--; } while (numRects); /* * The bands may be merged, so set the bottom y of each box * in the previous band to the bottom y of the current band. */ numRects = curStart - prevStart; pReg->data->numRects -= numRects; do { pPrevBox--; pPrevBox->y2 = y2; numRects--; } while (numRects); return prevStart; } /* Quicky macro to avoid trivial reject procedure calls to RegionCoalesce */ #define Coalesce(newReg, prevBand, curBand) \ if (curBand - prevBand == newReg->data->numRects - curBand) { \ prevBand = RegionCoalesce(newReg, prevBand, curBand); \ } else { \ prevBand = curBand; \ } /*- *----------------------------------------------------------------------- * RegionAppendNonO -- * Handle a non-overlapping band for the union and subtract operations. * Just adds the (top/bottom-clipped) rectangles into the region. * Doesn't have to check for subsumption or anything. * * Results: * None. * * Side Effects: * pReg->data->numRects is incremented and the rectangles overwritten * with the rectangles we're passed. * *----------------------------------------------------------------------- */ INLINE static Bool RegionAppendNonO ( register RegionPtr pReg, register BoxPtr r, BoxPtr rEnd, register int y1, register int y2) { register BoxPtr pNextRect; register int newRects; newRects = rEnd - r; assert(y1 < y2); assert(newRects != 0); /* Make sure we have enough space for all rectangles to be added */ RECTALLOC(pReg, newRects); pNextRect = RegionTop(pReg); pReg->data->numRects += newRects; do { assert(r->x1 < r->x2); ADDRECT(pNextRect, r->x1, y1, r->x2, y2); r++; } while (r != rEnd); return TRUE; } #define FindBand(r, rBandEnd, rEnd, ry1) \ { \ ry1 = r->y1; \ rBandEnd = r+1; \ while ((rBandEnd != rEnd) && (rBandEnd->y1 == ry1)) { \ rBandEnd++; \ } \ } #define AppendRegions(newReg, r, rEnd) \ { \ int newRects; \ if ((newRects = rEnd - r)) { \ RECTALLOC(newReg, newRects); \ memmove((char *)RegionTop(newReg),(char *)r, \ newRects * sizeof(BoxRec)); \ newReg->data->numRects += newRects; \ } \ } /*- *----------------------------------------------------------------------- * RegionOp -- * Apply an operation to two regions. Called by RegionUnion, RegionInverse, * RegionSubtract, RegionIntersect.... Both regions MUST have at least one * rectangle, and cannot be the same object. * * Results: * TRUE if successful. * * Side Effects: * The new region is overwritten. * pOverlap set to TRUE if overlapFunc ever returns TRUE. * * Notes: * The idea behind this function is to view the two regions as sets. * Together they cover a rectangle of area that this function divides * into horizontal bands where points are covered only by one region * or by both. For the first case, the nonOverlapFunc is called with * each the band and the band's upper and lower extents. For the * second, the overlapFunc is called to process the entire band. It * is responsible for clipping the rectangles in the band, though * this function provides the boundaries. * At the end of each band, the new region is coalesced, if possible, * to reduce the number of rectangles in the region. * *----------------------------------------------------------------------- */ typedef Bool (*OverlapProcPtr)( RegionPtr pReg, BoxPtr r1, BoxPtr r1End, BoxPtr r2, BoxPtr r2End, short y1, short y2, Bool *pOverlap); static Bool RegionOp( RegionPtr newReg, /* Place to store result */ RegionPtr reg1, /* First region in operation */ RegionPtr reg2, /* 2d region in operation */ OverlapProcPtr overlapFunc, /* Function to call for over- * lapping bands */ Bool appendNon1, /* Append non-overlapping bands */ /* in region 1 ? */ Bool appendNon2, /* Append non-overlapping bands */ /* in region 2 ? */ Bool *pOverlap) { register BoxPtr r1; /* Pointer into first region */ register BoxPtr r2; /* Pointer into 2d region */ BoxPtr r1End; /* End of 1st region */ BoxPtr r2End; /* End of 2d region */ short ybot; /* Bottom of intersection */ short ytop; /* Top of intersection */ RegDataPtr oldData; /* Old data for newReg */ int prevBand; /* Index of start of * previous band in newReg */ int curBand; /* Index of start of current * band in newReg */ register BoxPtr r1BandEnd; /* End of current band in r1 */ register BoxPtr r2BandEnd; /* End of current band in r2 */ short top; /* Top of non-overlapping band */ short bot; /* Bottom of non-overlapping band*/ register int r1y1; /* Temps for r1->y1 and r2->y1 */ register int r2y1; int newSize; int numRects; /* * Break any region computed from a broken region */ if (RegionNar (reg1) || RegionNar(reg2)) return RegionBreak (newReg); /* * Initialization: * set r1, r2, r1End and r2End appropriately, save the rectangles * of the destination region until the end in case it's one of * the two source regions, then mark the "new" region empty, allocating * another array of rectangles for it to use. */ r1 = RegionRects(reg1); newSize = RegionNumRects(reg1); r1End = r1 + newSize; numRects = RegionNumRects(reg2); r2 = RegionRects(reg2); r2End = r2 + numRects; assert(r1 != r1End); assert(r2 != r2End); oldData = (RegDataPtr)NULL; if (((newReg == reg1) && (newSize > 1)) || ((newReg == reg2) && (numRects > 1))) { oldData = newReg->data; newReg->data = &RegionEmptyData; } /* guess at new size */ if (numRects > newSize) newSize = numRects; newSize <<= 1; if (!newReg->data) newReg->data = &RegionEmptyData; else if (newReg->data->size) newReg->data->numRects = 0; if (newSize > newReg->data->size) if (!RegionRectAlloc(newReg, newSize)) return FALSE; /* * Initialize ybot. * In the upcoming loop, ybot and ytop serve different functions depending * on whether the band being handled is an overlapping or non-overlapping * band. * In the case of a non-overlapping band (only one of the regions * has points in the band), ybot is the bottom of the most recent * intersection and thus clips the top of the rectangles in that band. * ytop is the top of the next intersection between the two regions and * serves to clip the bottom of the rectangles in the current band. * For an overlapping band (where the two regions intersect), ytop clips * the top of the rectangles of both regions and ybot clips the bottoms. */ ybot = min(r1->y1, r2->y1); /* * prevBand serves to mark the start of the previous band so rectangles * can be coalesced into larger rectangles. qv. RegionCoalesce, above. * In the beginning, there is no previous band, so prevBand == curBand * (curBand is set later on, of course, but the first band will always * start at index 0). prevBand and curBand must be indices because of * the possible expansion, and resultant moving, of the new region's * array of rectangles. */ prevBand = 0; do { /* * This algorithm proceeds one source-band (as opposed to a * destination band, which is determined by where the two regions * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the * rectangle after the last one in the current band for their * respective regions. */ assert(r1 != r1End); assert(r2 != r2End); FindBand(r1, r1BandEnd, r1End, r1y1); FindBand(r2, r2BandEnd, r2End, r2y1); /* * First handle the band that doesn't intersect, if any. * * Note that attention is restricted to one band in the * non-intersecting region at once, so if a region has n * bands between the current position and the next place it overlaps * the other, this entire loop will be passed through n times. */ if (r1y1 < r2y1) { if (appendNon1) { top = max(r1y1, ybot); bot = min(r1->y2, r2y1); if (top != bot) { curBand = newReg->data->numRects; RegionAppendNonO(newReg, r1, r1BandEnd, top, bot); Coalesce(newReg, prevBand, curBand); } } ytop = r2y1; } else if (r2y1 < r1y1) { if (appendNon2) { top = max(r2y1, ybot); bot = min(r2->y2, r1y1); if (top != bot) { curBand = newReg->data->numRects; RegionAppendNonO(newReg, r2, r2BandEnd, top, bot); Coalesce(newReg, prevBand, curBand); } } ytop = r1y1; } else { ytop = r1y1; } /* * Now see if we've hit an intersecting band. The two bands only * intersect if ybot > ytop */ ybot = min(r1->y2, r2->y2); if (ybot > ytop) { curBand = newReg->data->numRects; (* overlapFunc)(newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot, pOverlap); Coalesce(newReg, prevBand, curBand); } /* * If we've finished with a band (y2 == ybot) we skip forward * in the region to the next band. */ if (r1->y2 == ybot) r1 = r1BandEnd; if (r2->y2 == ybot) r2 = r2BandEnd; } while (r1 != r1End && r2 != r2End); /* * Deal with whichever region (if any) still has rectangles left. * * We only need to worry about banding and coalescing for the very first * band left. After that, we can just group all remaining boxes, * regardless of how many bands, into one final append to the list. */ if ((r1 != r1End) && appendNon1) { /* Do first nonOverlap1Func call, which may be able to coalesce */ FindBand(r1, r1BandEnd, r1End, r1y1); curBand = newReg->data->numRects; RegionAppendNonO(newReg, r1, r1BandEnd, max(r1y1, ybot), r1->y2); Coalesce(newReg, prevBand, curBand); /* Just append the rest of the boxes */ AppendRegions(newReg, r1BandEnd, r1End); } else if ((r2 != r2End) && appendNon2) { /* Do first nonOverlap2Func call, which may be able to coalesce */ FindBand(r2, r2BandEnd, r2End, r2y1); curBand = newReg->data->numRects; RegionAppendNonO(newReg, r2, r2BandEnd, max(r2y1, ybot), r2->y2); Coalesce(newReg, prevBand, curBand); /* Append rest of boxes */ AppendRegions(newReg, r2BandEnd, r2End); } if (oldData) free(oldData); if (!(numRects = newReg->data->numRects)) { xfreeData(newReg); newReg->data = &RegionEmptyData; } else if (numRects == 1) { newReg->extents = *RegionBoxptr(newReg); xfreeData(newReg); newReg->data = (RegDataPtr)NULL; } else { DOWNSIZE(newReg, numRects); } return TRUE; } /*- *----------------------------------------------------------------------- * RegionSetExtents -- * Reset the extents of a region to what they should be. Called by * RegionSubtract and RegionIntersect as they can't figure it out along the * way or do so easily, as RegionUnion can. * * Results: * None. * * Side Effects: * The region's 'extents' structure is overwritten. * *----------------------------------------------------------------------- */ void RegionSetExtents (pReg) register RegionPtr pReg; { register BoxPtr pBox, pBoxEnd; if (!pReg->data) return; if (!pReg->data->size) { pReg->extents.x2 = pReg->extents.x1; pReg->extents.y2 = pReg->extents.y1; return; } pBox = RegionBoxptr(pReg); pBoxEnd = RegionEnd(pReg); /* * Since pBox is the first rectangle in the region, it must have the * smallest y1 and since pBoxEnd is the last rectangle in the region, * it must have the largest y2, because of banding. Initialize x1 and * x2 from pBox and pBoxEnd, resp., as good things to initialize them * to... */ pReg->extents.x1 = pBox->x1; pReg->extents.y1 = pBox->y1; pReg->extents.x2 = pBoxEnd->x2; pReg->extents.y2 = pBoxEnd->y2; assert(pReg->extents.y1 < pReg->extents.y2); while (pBox <= pBoxEnd) { if (pBox->x1 < pReg->extents.x1) pReg->extents.x1 = pBox->x1; if (pBox->x2 > pReg->extents.x2) pReg->extents.x2 = pBox->x2; pBox++; }; assert(pReg->extents.x1 < pReg->extents.x2); } #define MERGERECT(r) \ { \ if (r->x1 <= x2) { \ /* Merge with current rectangle */ \ if (r->x1 < x2) *pOverlap = TRUE; \ if (x2 < r->x2) x2 = r->x2; \ } else { \ /* Add current rectangle, start new one */ \ NEWRECT(pReg, pNextRect, x1, y1, x2, y2); \ x1 = r->x1; \ x2 = r->x2; \ } \ r++; \ } /*====================================================================== * Region Union *====================================================================*/ /*- *----------------------------------------------------------------------- * RegionUnionO -- * Handle an overlapping band for the union operation. Picks the * left-most rectangle each time and merges it into the region. * * Results: * TRUE if successful. * * Side Effects: * pReg is overwritten. * pOverlap is set to TRUE if any boxes overlap. * *----------------------------------------------------------------------- */ static Bool RegionUnionO ( register RegionPtr pReg, register BoxPtr r1, BoxPtr r1End, register BoxPtr r2, BoxPtr r2End, short y1, short y2, Bool *pOverlap) { register BoxPtr pNextRect; register int x1; /* left and right side of current union */ register int x2; assert (y1 < y2); assert(r1 != r1End && r2 != r2End); pNextRect = RegionTop(pReg); /* Start off current rectangle */ if (r1->x1 < r2->x1) { x1 = r1->x1; x2 = r1->x2; r1++; } else { x1 = r2->x1; x2 = r2->x2; r2++; } while (r1 != r1End && r2 != r2End) { if (r1->x1 < r2->x1) MERGERECT(r1) else MERGERECT(r2); } /* Finish off whoever (if any) is left */ if (r1 != r1End) { do { MERGERECT(r1); } while (r1 != r1End); } else if (r2 != r2End) { do { MERGERECT(r2); } while (r2 != r2End); } /* Add current rectangle */ NEWRECT(pReg, pNextRect, x1, y1, x2, y2); return TRUE; } /*====================================================================== * Batch Rectangle Union *====================================================================*/ /*- *----------------------------------------------------------------------- * RegionAppend -- * * "Append" the rgn rectangles onto the end of dstrgn, maintaining * knowledge of YX-banding when it's easy. Otherwise, dstrgn just * becomes a non-y-x-banded random collection of rectangles, and not * yet a true region. After a sequence of appends, the caller must * call RegionValidate to ensure that a valid region is constructed. * * Results: * TRUE if successful. * * Side Effects: * dstrgn is modified if rgn has rectangles. * */ Bool RegionAppend(dstrgn, rgn) register RegionPtr dstrgn; register RegionPtr rgn; { int numRects, dnumRects, size; BoxPtr new, old; Bool prepend; if (RegionNar(rgn)) return RegionBreak (dstrgn); if (!rgn->data && (dstrgn->data == &RegionEmptyData)) { dstrgn->extents = rgn->extents; dstrgn->data = (RegDataPtr)NULL; return TRUE; } numRects = RegionNumRects(rgn); if (!numRects) return TRUE; prepend = FALSE; size = numRects; dnumRects = RegionNumRects(dstrgn); if (!dnumRects && (size < 200)) size = 200; /* XXX pick numbers out of a hat */ RECTALLOC(dstrgn, size); old = RegionRects(rgn); if (!dnumRects) dstrgn->extents = rgn->extents; else if (dstrgn->extents.x2 > dstrgn->extents.x1) { register BoxPtr first, last; first = old; last = RegionBoxptr(dstrgn) + (dnumRects - 1); if ((first->y1 > last->y2) || ((first->y1 == last->y1) && (first->y2 == last->y2) && (first->x1 > last->x2))) { if (rgn->extents.x1 < dstrgn->extents.x1) dstrgn->extents.x1 = rgn->extents.x1; if (rgn->extents.x2 > dstrgn->extents.x2) dstrgn->extents.x2 = rgn->extents.x2; dstrgn->extents.y2 = rgn->extents.y2; } else { first = RegionBoxptr(dstrgn); last = old + (numRects - 1); if ((first->y1 > last->y2) || ((first->y1 == last->y1) && (first->y2 == last->y2) && (first->x1 > last->x2))) { prepend = TRUE; if (rgn->extents.x1 < dstrgn->extents.x1) dstrgn->extents.x1 = rgn->extents.x1; if (rgn->extents.x2 > dstrgn->extents.x2) dstrgn->extents.x2 = rgn->extents.x2; dstrgn->extents.y1 = rgn->extents.y1; } else dstrgn->extents.x2 = dstrgn->extents.x1; } } if (prepend) { new = RegionBox(dstrgn, numRects); if (dnumRects == 1) *new = *RegionBoxptr(dstrgn); else memmove((char *)new,(char *)RegionBoxptr(dstrgn), dnumRects * sizeof(BoxRec)); new = RegionBoxptr(dstrgn); } else new = RegionBoxptr(dstrgn) + dnumRects; if (numRects == 1) *new = *old; else memmove((char *)new, (char *)old, numRects * sizeof(BoxRec)); dstrgn->data->numRects += numRects; return TRUE; } #define ExchangeRects(a, b) \ { \ BoxRec t; \ t = rects[a]; \ rects[a] = rects[b]; \ rects[b] = t; \ } static void QuickSortRects( register BoxRec rects[], register int numRects) { register int y1; register int x1; register int i, j; register BoxPtr r; /* Always called with numRects > 1 */ do { if (numRects == 2) { if (rects[0].y1 > rects[1].y1 || (rects[0].y1 == rects[1].y1 && rects[0].x1 > rects[1].x1)) ExchangeRects(0, 1); return; } /* Choose partition element, stick in location 0 */ ExchangeRects(0, numRects >> 1); y1 = rects[0].y1; x1 = rects[0].x1; /* Partition array */ i = 0; j = numRects; do { r = &(rects[i]); do { r++; i++; } while (i != numRects && (r->y1 < y1 || (r->y1 == y1 && r->x1 < x1))); r = &(rects[j]); do { r--; j--; } while (y1 < r->y1 || (y1 == r->y1 && x1 < r->x1)); if (i < j) ExchangeRects(i, j); } while (i < j); /* Move partition element back to middle */ ExchangeRects(0, j); /* Recurse */ if (numRects-j-1 > 1) QuickSortRects(&rects[j+1], numRects-j-1); numRects = j; } while (numRects > 1); } /*- *----------------------------------------------------------------------- * RegionValidate -- * * Take a ``region'' which is a non-y-x-banded random collection of * rectangles, and compute a nice region which is the union of all the * rectangles. * * Results: * TRUE if successful. * * Side Effects: * The passed-in ``region'' may be modified. * pOverlap set to TRUE if any retangles overlapped, else FALSE; * * Strategy: * Step 1. Sort the rectangles into ascending order with primary key y1 * and secondary key x1. * * Step 2. Split the rectangles into the minimum number of proper y-x * banded regions. This may require horizontally merging * rectangles, and vertically coalescing bands. With any luck, * this step in an identity tranformation (ala the Box widget), * or a coalescing into 1 box (ala Menus). * * Step 3. Merge the separate regions down to a single region by calling * RegionUnion. Maximize the work each RegionUnion call does by using * a binary merge. * *----------------------------------------------------------------------- */ Bool RegionValidate(badreg, pOverlap) RegionPtr badreg; Bool *pOverlap; { /* Descriptor for regions under construction in Step 2. */ typedef struct { RegionRec reg; int prevBand; int curBand; } RegionInfo; int numRects; /* Original numRects for badreg */ RegionInfo *ri; /* Array of current regions */ int numRI; /* Number of entries used in ri */ int sizeRI; /* Number of entries available in ri */ int i; /* Index into rects */ register int j; /* Index into ri */ register RegionInfo *rit; /* &ri[j] */ register RegionPtr reg; /* ri[j].reg */ register BoxPtr box; /* Current box in rects */ register BoxPtr riBox; /* Last box in ri[j].reg */ register RegionPtr hreg; /* ri[j_half].reg */ Bool ret = TRUE; *pOverlap = FALSE; if (!badreg->data) { good(badreg); return TRUE; } numRects = badreg->data->numRects; if (!numRects) { if (RegionNar(badreg)) return FALSE; good(badreg); return TRUE; } if (badreg->extents.x1 < badreg->extents.x2) { if ((numRects) == 1) { xfreeData(badreg); badreg->data = (RegDataPtr) NULL; } else { DOWNSIZE(badreg, numRects); } good(badreg); return TRUE; } /* Step 1: Sort the rects array into ascending (y1, x1) order */ QuickSortRects(RegionBoxptr(badreg), numRects); /* Step 2: Scatter the sorted array into the minimum number of regions */ /* Set up the first region to be the first rectangle in badreg */ /* Note that step 2 code will never overflow the ri[0].reg rects array */ ri = (RegionInfo *) malloc(4 * sizeof(RegionInfo)); if (!ri) return RegionBreak (badreg); sizeRI = 4; numRI = 1; ri[0].prevBand = 0; ri[0].curBand = 0; ri[0].reg = *badreg; box = RegionBoxptr(&ri[0].reg); ri[0].reg.extents = *box; ri[0].reg.data->numRects = 1; /* Now scatter rectangles into the minimum set of valid regions. If the next rectangle to be added to a region would force an existing rectangle in the region to be split up in order to maintain y-x banding, just forget it. Try the next region. If it doesn't fit cleanly into any region, make a new one. */ for (i = numRects; --i > 0;) { box++; /* Look for a region to append box to */ for (j = numRI, rit = ri; --j >= 0; rit++) { reg = &rit->reg; riBox = RegionEnd(reg); if (box->y1 == riBox->y1 && box->y2 == riBox->y2) { /* box is in same band as riBox. Merge or append it */ if (box->x1 <= riBox->x2) { /* Merge it with riBox */ if (box->x1 < riBox->x2) *pOverlap = TRUE; if (box->x2 > riBox->x2) riBox->x2 = box->x2; } else { RECTALLOC_BAIL(reg, 1, bail); *RegionTop(reg) = *box; reg->data->numRects++; } goto NextRect; /* So sue me */ } else if (box->y1 >= riBox->y2) { /* Put box into new band */ if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2; if (reg->extents.x1 > box->x1) reg->extents.x1 = box->x1; Coalesce(reg, rit->prevBand, rit->curBand); rit->curBand = reg->data->numRects; RECTALLOC_BAIL(reg, 1, bail); *RegionTop(reg) = *box; reg->data->numRects++; goto NextRect; } /* Well, this region was inappropriate. Try the next one. */ } /* for j */ /* Uh-oh. No regions were appropriate. Create a new one. */ if (sizeRI == numRI) { /* Oops, allocate space for new region information */ sizeRI <<= 1; rit = (RegionInfo *) realloc(ri, sizeRI * sizeof(RegionInfo)); if (!rit) goto bail; ri = rit; rit = &ri[numRI]; } numRI++; rit->prevBand = 0; rit->curBand = 0; rit->reg.extents = *box; rit->reg.data = (RegDataPtr)NULL; if (!RegionRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */ goto bail; NextRect: ; } /* for i */ /* Make a final pass over each region in order to Coalesce and set extents.x2 and extents.y2 */ for (j = numRI, rit = ri; --j >= 0; rit++) { reg = &rit->reg; riBox = RegionEnd(reg); reg->extents.y2 = riBox->y2; if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2; Coalesce(reg, rit->prevBand, rit->curBand); if (reg->data->numRects == 1) /* keep unions happy below */ { xfreeData(reg); reg->data = (RegDataPtr)NULL; } } /* Step 3: Union all regions into a single region */ while (numRI > 1) { int half = numRI/2; for (j = numRI & 1; j < (half + (numRI & 1)); j++) { reg = &ri[j].reg; hreg = &ri[j+half].reg; if (!RegionOp(reg, reg, hreg, RegionUnionO, TRUE, TRUE, pOverlap)) ret = FALSE; if (hreg->extents.x1 < reg->extents.x1) reg->extents.x1 = hreg->extents.x1; if (hreg->extents.y1 < reg->extents.y1) reg->extents.y1 = hreg->extents.y1; if (hreg->extents.x2 > reg->extents.x2) reg->extents.x2 = hreg->extents.x2; if (hreg->extents.y2 > reg->extents.y2) reg->extents.y2 = hreg->extents.y2; xfreeData(hreg); } numRI -= half; } *badreg = ri[0].reg; free(ri); good(badreg); return ret; bail: for (i = 0; i < numRI; i++) xfreeData(&ri[i].reg); free (ri); return RegionBreak (badreg); } RegionPtr RegionFromRects(nrects, prect, ctype) int nrects; register xRectangle *prect; int ctype; { register RegionPtr pRgn; register RegDataPtr pData; register BoxPtr pBox; register int i; int x1, y1, x2, y2; size_t newSize; pRgn = RegionCreate(NullBox, 0); if (RegionNar (pRgn)) return pRgn; if (!nrects) return pRgn; if (nrects == 1) { x1 = prect->x; y1 = prect->y; if ((x2 = x1 + (int) prect->width) > MAXSHORT) x2 = MAXSHORT; if ((y2 = y1 + (int) prect->height) > MAXSHORT) y2 = MAXSHORT; if (x1 != x2 && y1 != y2) { pRgn->extents.x1 = x1; pRgn->extents.y1 = y1; pRgn->extents.x2 = x2; pRgn->extents.y2 = y2; pRgn->data = (RegDataPtr)NULL; } return pRgn; } newSize = RegionSizeof(nrects); pData = newSize > 0 ? malloc(newSize) : NULL; if (!pData) { RegionBreak (pRgn); return pRgn; } pBox = (BoxPtr) (pData + 1); for (i = nrects; --i >= 0; prect++) { x1 = prect->x; y1 = prect->y; if ((x2 = x1 + (int) prect->width) > MAXSHORT) x2 = MAXSHORT; if ((y2 = y1 + (int) prect->height) > MAXSHORT) y2 = MAXSHORT; if (x1 != x2 && y1 != y2) { pBox->x1 = x1; pBox->y1 = y1; pBox->x2 = x2; pBox->y2 = y2; pBox++; } } if (pBox != (BoxPtr) (pData + 1)) { pData->size = nrects; pData->numRects = pBox - (BoxPtr) (pData + 1); pRgn->data = pData; if (ctype != CT_YXBANDED) { Bool overlap; /* result ignored */ pRgn->extents.x1 = pRgn->extents.x2 = 0; RegionValidate(pRgn, &overlap); } else RegionSetExtents(pRgn); good(pRgn); } else { free (pData); } return pRgn; } Bool miRegionDataCopy( register RegionPtr dst, register RegionPtr src) { good(dst); good(src); if (dst->data) return TRUE; if (dst == src) return TRUE; if (!src->data || !src->data->size) { xfreeData(dst); dst->data = (RegDataPtr)NULL; return TRUE; } if (!dst->data || (dst->data->size < src->data->numRects)) { size_t newSize = RegionSizeof(src->data->numRects); xfreeData(dst); dst->data = newSize > 0 ? malloc(newSize) : NULL; if (!dst->data) return RegionBreak (dst); } dst->data->size = src->data->size; dst->data->numRects = src->data->numRects; return TRUE; } #define ExchangeSpans(a, b) \ { \ DDXPointRec tpt; \ register int tw; \ \ tpt = spans[a]; spans[a] = spans[b]; spans[b] = tpt; \ tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \ } /* ||| I should apply the merge sort code to rectangle sorting above, and see if mapping time can be improved. But right now I've been at work 12 hours, so forget it. */ static void QuickSortSpans( register DDXPointRec spans[], register int widths[], register int numSpans) { register int y; register int i, j, m; register DDXPointPtr r; /* Always called with numSpans > 1 */ /* Sorts only by y, doesn't bother to sort by x */ do { if (numSpans < 9) { /* Do insertion sort */ register int yprev; yprev = spans[0].y; i = 1; do { /* while i != numSpans */ y = spans[i].y; if (yprev > y) { /* spans[i] is out of order. Move into proper location. */ DDXPointRec tpt; int tw, k; for (j = 0; y >= spans[j].y; j++) {} tpt = spans[i]; tw = widths[i]; for (k = i; k != j; k--) { spans[k] = spans[k-1]; widths[k] = widths[k-1]; } spans[j] = tpt; widths[j] = tw; y = spans[i].y; } /* if out of order */ yprev = y; i++; } while (i != numSpans); return; } /* Choose partition element, stick in location 0 */ m = numSpans / 2; if (spans[m].y > spans[0].y) ExchangeSpans(m, 0); if (spans[m].y > spans[numSpans-1].y) ExchangeSpans(m, numSpans-1); if (spans[m].y > spans[0].y) ExchangeSpans(m, 0); y = spans[0].y; /* Partition array */ i = 0; j = numSpans; do { r = &(spans[i]); do { r++; i++; } while (i != numSpans && r->y < y); r = &(spans[j]); do { r--; j--; } while (y < r->y); if (i < j) ExchangeSpans(i, j); } while (i < j); /* Move partition element back to middle */ ExchangeSpans(0, j); /* Recurse */ if (numSpans-j-1 > 1) QuickSortSpans(&spans[j+1], &widths[j+1], numSpans-j-1); numSpans = j; } while (numSpans > 1); } #define NextBand() \ { \ clipy1 = pboxBandStart->y1; \ clipy2 = pboxBandStart->y2; \ pboxBandEnd = pboxBandStart + 1; \ while (pboxBandEnd != pboxLast && pboxBandEnd->y1 == clipy1) { \ pboxBandEnd++; \ } \ for (; ppt != pptLast && ppt->y < clipy1; ppt++, pwidth++) {} \ } /* Clip a list of scanlines to a region. The caller has allocated the space. FSorted is non-zero if the scanline origins are in ascending order. returns the number of new, clipped scanlines. */ int RegionClipSpans( RegionPtr prgnDst, register DDXPointPtr ppt, register int *pwidth, int nspans, register DDXPointPtr pptNew, int *pwidthNew, int fSorted) { register DDXPointPtr pptLast; int *pwidthNewStart; /* the vengeance of Xerox! */ register int y, x1, x2; register int numRects; good(prgnDst); pptLast = ppt + nspans; pwidthNewStart = pwidthNew; if (!prgnDst->data) { /* Do special fast code with clip boundaries in registers(?) */ /* It doesn't pay much to make use of fSorted in this case, so we lump everything together. */ register int clipx1, clipx2, clipy1, clipy2; clipx1 = prgnDst->extents.x1; clipy1 = prgnDst->extents.y1; clipx2 = prgnDst->extents.x2; clipy2 = prgnDst->extents.y2; for (; ppt != pptLast; ppt++, pwidth++) { y = ppt->y; x1 = ppt->x; if (clipy1 <= y && y < clipy2) { x2 = x1 + *pwidth; if (x1 < clipx1) x1 = clipx1; if (x2 > clipx2) x2 = clipx2; if (x1 < x2) { /* part of span in clip rectangle */ pptNew->x = x1; pptNew->y = y; *pwidthNew = x2 - x1; pptNew++; pwidthNew++; } } } /* end for */ } else if ((numRects = prgnDst->data->numRects)) { /* Have to clip against many boxes */ BoxPtr pboxBandStart, pboxBandEnd; register BoxPtr pbox; register BoxPtr pboxLast; register int clipy1, clipy2; /* In this case, taking advantage of sorted spans gains more than the sorting costs. */ if ((! fSorted) && (nspans > 1)) QuickSortSpans(ppt, pwidth, nspans); pboxBandStart = RegionBoxptr(prgnDst); pboxLast = pboxBandStart + numRects; NextBand(); for (; ppt != pptLast; ) { y = ppt->y; if (y < clipy2) { /* span is in the current band */ pbox = pboxBandStart; x1 = ppt->x; x2 = x1 + *pwidth; do { /* For each box in band */ register int newx1, newx2; newx1 = x1; newx2 = x2; if (newx1 < pbox->x1) newx1 = pbox->x1; if (newx2 > pbox->x2) newx2 = pbox->x2; if (newx1 < newx2) { /* Part of span in clip rectangle */ pptNew->x = newx1; pptNew->y = y; *pwidthNew = newx2 - newx1; pptNew++; pwidthNew++; } pbox++; } while (pbox != pboxBandEnd); ppt++; pwidth++; } else { /* Move to next band, adjust ppt as needed */ pboxBandStart = pboxBandEnd; if (pboxBandStart == pboxLast) break; /* We're completely done */ NextBand(); } } } return (pwidthNew - pwidthNewStart); } /* find the band in a region with the most rectangles */ int miFindMaxBand(prgn) RegionPtr prgn; { register int nbox; register BoxPtr pbox; register int nThisBand; register int nMaxBand = 0; short yThisBand; good(prgn); nbox = RegionNumRects(prgn); pbox = RegionRects(prgn); while(nbox > 0) { yThisBand = pbox->y1; nThisBand = 0; while((nbox > 0) && (pbox->y1 == yThisBand)) { nbox--; pbox++; nThisBand++; } if (nThisBand > nMaxBand) nMaxBand = nThisBand; } return (nMaxBand); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/resource.c0000644000000000000000000006133213614532331017357 0ustar /************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* The panoramix components contained the following notice */ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* $TOG: resource.c /main/41 1998/02/09 14:20:31 kaleb $ */ /* Routines to manage various kinds of resources: * * CreateNewResourceType, CreateNewResourceClass, InitClientResources, * FakeClientID, AddResource, FreeResource, FreeClientResources, * FreeAllResources, LookupIDByType, LookupIDByClass, GetXIDRange */ /* * A resource ID is a 32 bit quantity, the upper 2 bits of which are * off-limits for client-visible resources. The next 8 bits are * used as client ID, and the low 22 bits come from the client. * A resource ID is "hashed" by extracting and xoring subfields * (varying with the size of the hash table). * * It is sometimes necessary for the server to create an ID that looks * like it belongs to a client. This ID, however, must not be one * the client actually can create, or we have the potential for conflict. * The 31st bit of the ID is reserved for the server's use for this * purpose. By setting CLIENT_ID(id) to the client, the SERVER_BIT to * 1, and an otherwise arbitrary ID in the low 22 bits, we can create a * resource "owned" by the client. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "misc.h" #include "os.h" #include "resource.h" #include "dixstruct.h" #include "opaque.h" #include "windowstr.h" #include "dixfont.h" #include "colormap.h" #include "inputstr.h" #include "dixevents.h" #include "dixgrabs.h" #include "cursor.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #endif #include static void RebuildTable( int /*client*/ ); #define SERVER_MINID 32 #define INITBUCKETS 64 #define INITHASHSIZE 6 #define MAXHASHSIZE 11 typedef struct _Resource { struct _Resource *next; XID id; RESTYPE type; void * value; } ResourceRec, *ResourcePtr; #define NullResource ((ResourcePtr)NULL) typedef struct _ClientResource { ResourcePtr *resources; int elements; int buckets; int hashsize; /* log(2)(buckets) */ XID fakeID; XID endFakeID; XID expectID; } ClientResourceRec; RESTYPE lastResourceType; static RESTYPE lastResourceClass; RESTYPE TypeMask; static DeleteType *DeleteFuncs = (DeleteType *)NULL; #ifdef XResExtension Atom * ResourceNames = NULL; void RegisterResourceName (RESTYPE type, char *name) { ResourceNames[type & TypeMask] = MakeAtom(name, strlen(name), TRUE); } #endif RESTYPE CreateNewResourceType(DeleteType deleteFunc) { RESTYPE next = lastResourceType + 1; DeleteType *funcs; if (next & lastResourceClass) return 0; funcs = (DeleteType *)realloc(DeleteFuncs, (next + 1) * sizeof(DeleteType)); if (!funcs) return 0; #ifdef XResExtension { Atom *newnames; newnames = realloc(ResourceNames, (next + 1) * sizeof(Atom)); if(!newnames) return 0; ResourceNames = newnames; ResourceNames[next] = 0; } #endif lastResourceType = next; DeleteFuncs = funcs; DeleteFuncs[next] = deleteFunc; return next; } RESTYPE CreateNewResourceClass() { RESTYPE next = lastResourceClass >> 1; if (next & lastResourceType) return 0; lastResourceClass = next; TypeMask = next - 1; return next; } ClientResourceRec clientTable[MAXCLIENTS]; /***************** * InitClientResources * When a new client is created, call this to allocate space * in resource table *****************/ Bool InitClientResources(ClientPtr client) { register int i, j; if (client == serverClient) { lastResourceType = RT_LASTPREDEF; lastResourceClass = RC_LASTPREDEF; TypeMask = RC_LASTPREDEF - 1; if (DeleteFuncs) free(DeleteFuncs); DeleteFuncs = (DeleteType *)malloc((lastResourceType + 1) * sizeof(DeleteType)); if (!DeleteFuncs) return FALSE; DeleteFuncs[RT_NONE & TypeMask] = (DeleteType)NoopDDA; DeleteFuncs[RT_WINDOW & TypeMask] = DeleteWindow; DeleteFuncs[RT_PIXMAP & TypeMask] = dixDestroyPixmap; DeleteFuncs[RT_GC & TypeMask] = FreeGC; DeleteFuncs[RT_FONT & TypeMask] = CloseFont; DeleteFuncs[RT_CURSOR & TypeMask] = FreeCursor; DeleteFuncs[RT_COLORMAP & TypeMask] = FreeColormap; DeleteFuncs[RT_CMAPENTRY & TypeMask] = FreeClientPixels; DeleteFuncs[RT_OTHERCLIENT & TypeMask] = OtherClientGone; DeleteFuncs[RT_PASSIVEGRAB & TypeMask] = DeletePassiveGrab; #ifdef XResExtension if(ResourceNames) free(ResourceNames); ResourceNames = malloc((lastResourceType + 1) * sizeof(Atom)); if(!ResourceNames) return FALSE; #endif } clientTable[i = client->index].resources = (ResourcePtr *)malloc(INITBUCKETS*sizeof(ResourcePtr)); if (!clientTable[i].resources) return FALSE; clientTable[i].buckets = INITBUCKETS; clientTable[i].elements = 0; clientTable[i].hashsize = INITHASHSIZE; /* Many IDs allocated from the server client are visible to clients, * so we don't use the SERVER_BIT for them, but we have to start * past the magic value constants used in the protocol. For normal * clients, we can start from zero, with SERVER_BIT set. */ clientTable[i].fakeID = client->clientAsMask | (client->index ? SERVER_BIT : SERVER_MINID); clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1; clientTable[i].expectID = client->clientAsMask; for (j=0; j>6) ^ (id>>12)))); case 7: return ((int)(0x07F & (id ^ (id>>7) ^ (id>>13)))); case 8: return ((int)(0x0FF & (id ^ (id>>8) ^ (id>>16)))); case 9: return ((int)(0x1FF & (id ^ (id>>9)))); case 10: return ((int)(0x3FF & (id ^ (id>>10)))); case 11: return ((int)(0x7FF & (id ^ (id>>11)))); } return -1; } static XID AvailableID( register int client, register XID id, register XID maxid, register XID goodid) { register ResourcePtr res; if ((goodid >= id) && (goodid <= maxid)) return goodid; for (; id <= maxid; id++) { res = clientTable[client].resources[Hash(client, id)]; while (res && (res->id != id)) res = res->next; if (!res) return id; } return 0; } void GetXIDRange(int client, Bool server, XID *minp, XID *maxp) { register XID id, maxid; register ResourcePtr *resp; register ResourcePtr res; register int i; XID goodid; id = (Mask)client << CLIENTOFFSET; if (server) id |= client ? SERVER_BIT : SERVER_MINID; maxid = id | RESOURCE_ID_MASK; goodid = 0; for (resp = clientTable[client].resources, i = clientTable[client].buckets; --i >= 0;) { for (res = *resp++; res; res = res->next) { if ((res->id < id) || (res->id > maxid)) continue; if (((res->id - id) >= (maxid - res->id)) ? (goodid = AvailableID(client, id, res->id - 1, goodid)) : !(goodid = AvailableID(client, res->id + 1, maxid, goodid))) maxid = res->id - 1; else id = res->id + 1; } } if (id > maxid) id = maxid = 0; *minp = id; *maxp = maxid; } /** * GetXIDList is called by the XC-MISC extension's MiscGetXIDList function. * This function tries to find count unused XIDs for the given client. It * puts the IDs in the array pids and returns the number found, which should * almost always be the number requested. * * The circumstances that lead to a call to this function are very rare. * Xlib must run out of IDs while trying to generate a request that wants * multiple ID's, like the Multi-buffering CreateImageBuffers request. * * No rocket science in the implementation; just iterate over all * possible IDs for the given client and pick the first count IDs * that aren't in use. A more efficient algorithm could probably be * invented, but this will be used so rarely that this should suffice. */ unsigned int GetXIDList(ClientPtr pClient, unsigned count, XID *pids) { unsigned int found = 0; XID id = pClient->clientAsMask; XID maxid; maxid = id | RESOURCE_ID_MASK; while ( (found < count) && (id <= maxid) ) { if (!LookupIDByClass(id, RC_ANY)) { pids[found++] = id; } id++; } return found; } /* * Return the next usable fake client ID. * * Normally this is just the next one in line, but if we've used the last * in the range, we need to find a new range of safe IDs to avoid * over-running another client. */ XID FakeClientID(register int client) { XID id, maxid; id = clientTable[client].fakeID++; if (id != clientTable[client].endFakeID) return id; GetXIDRange(client, TRUE, &id, &maxid); if (!id) { if (!client) FatalError("FakeClientID: server internal ids exhausted\n"); MarkClientException(clients[client]); id = ((Mask)client << CLIENTOFFSET) | (SERVER_BIT * 3); maxid = id | RESOURCE_ID_MASK; } clientTable[client].fakeID = id + 1; clientTable[client].endFakeID = maxid + 1; return id; } #ifndef NXAGENT_SERVER Bool AddResource(XID id, RESTYPE type, void * value) { int client; register ClientResourceRec *rrec; register ResourcePtr res, *head; client = CLIENT_ID(id); rrec = &clientTable[client]; if (!rrec->buckets) { ErrorF("AddResource(%lx, %lx, %lx), client=%d \n", (unsigned long)id, type, (unsigned long)value, client); FatalError("client not in use\n"); } if ((rrec->elements >= 4*rrec->buckets) && (rrec->hashsize < MAXHASHSIZE)) RebuildTable(client); head = &rrec->resources[Hash(client, id)]; res = (ResourcePtr)malloc(sizeof(ResourceRec)); if (!res) { (*DeleteFuncs[type & TypeMask])(value, id); return FALSE; } res->next = *head; res->id = id; res->type = type; res->value = value; *head = res; rrec->elements++; if (!(id & SERVER_BIT) && (id >= rrec->expectID)) rrec->expectID = id + 1; return TRUE; } #endif /* NXAGENT_SERVER */ static void RebuildTable(int client) { register int j; register ResourcePtr res, next; ResourcePtr **tails, *resources; register ResourcePtr **tptr, *rptr; /* * For now, preserve insertion order, since some ddx layers depend * on resources being free in the opposite order they are added. */ j = 2 * clientTable[client].buckets; tails = (ResourcePtr **)malloc(j * sizeof(ResourcePtr *)); if (!tails) return; resources = (ResourcePtr *)malloc(j * sizeof(ResourcePtr)); if (!resources) { free(tails); return; } for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++) { *rptr = NullResource; *tptr = rptr; } clientTable[client].hashsize++; for (j = clientTable[client].buckets, rptr = clientTable[client].resources; --j >= 0; rptr++) { for (res = *rptr; res; res = next) { next = res->next; res->next = NullResource; tptr = &tails[Hash(client, res->id)]; **tptr = res; *tptr = &res->next; } } free(tails); clientTable[client].buckets *= 2; free(clientTable[client].resources); clientTable[client].resources = resources; } #ifndef NXAGENT_SERVER void FreeResource(XID id, RESTYPE skipDeleteFuncType) { int cid; register ResourcePtr res; register ResourcePtr *prev, *head; register int *eltptr; int elements; Bool gotOne = FALSE; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { head = &clientTable[cid].resources[Hash(cid, id)]; eltptr = &clientTable[cid].elements; prev = head; while ( (res = *prev) ) { if (res->id == id) { RESTYPE rtype = res->type; *prev = res->next; elements = --*eltptr; if (rtype != skipDeleteFuncType) (*DeleteFuncs[rtype & TypeMask])(res->value, res->id); free(res); if (*eltptr != elements) prev = head; /* prev may no longer be valid */ gotOne = TRUE; } else prev = &res->next; } } if (!gotOne) ErrorF("Freeing resource id=%lX which isn't there.\n", (unsigned long)id); } void FreeResourceByType(XID id, RESTYPE type, Bool skipFree) { int cid; register ResourcePtr res; register ResourcePtr *prev, *head; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { head = &clientTable[cid].resources[Hash(cid, id)]; prev = head; while ( (res = *prev) ) { if (res->id == id && res->type == type) { *prev = res->next; if (!skipFree) (*DeleteFuncs[type & TypeMask])(res->value, res->id); free(res); break; } else prev = &res->next; } } } #endif /* NXAGENT_SERVER */ /* * Change the value associated with a resource id. Caller * is responsible for "doing the right thing" with the old * data */ Bool ChangeResourceValue (XID id, RESTYPE rtype, void * value) { int cid; register ResourcePtr res; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { res = clientTable[cid].resources[Hash(cid, id)]; for (; res; res = res->next) if ((res->id == id) && (res->type == rtype)) { res->value = value; return TRUE; } } return FALSE; } /* Note: if func adds or deletes resources, then func can get called * more than once for some resources. If func adds new resources, * func might or might not get called for them. func cannot both * add and delete an equal number of resources! */ #ifndef NXAGENT_SERVER void FindClientResourcesByType( ClientPtr client, RESTYPE type, FindResType func, void * cdata ){ register ResourcePtr *resources; register ResourcePtr this, next; int i, elements; register int *eltptr; if (!client) client = serverClient; resources = clientTable[client->index].resources; eltptr = &clientTable[client->index].elements; for (i = 0; i < clientTable[client->index].buckets; i++) { for (this = resources[i]; this; this = next) { next = this->next; if (!type || this->type == type) { elements = *eltptr; (*func)(this->value, this->id, cdata); if (*eltptr != elements) next = resources[i]; /* start over */ } } } } void FindAllClientResources( ClientPtr client, FindAllRes func, void * cdata ){ register ResourcePtr *resources; register ResourcePtr this, next; int i, elements; register int *eltptr; if (!client) client = serverClient; resources = clientTable[client->index].resources; eltptr = &clientTable[client->index].elements; for (i = 0; i < clientTable[client->index].buckets; i++) { for (this = resources[i]; this; this = next) { next = this->next; elements = *eltptr; (*func)(this->value, this->id, this->type, cdata); if (*eltptr != elements) next = resources[i]; /* start over */ } } } void * LookupClientResourceComplex( ClientPtr client, RESTYPE type, FindComplexResType func, void * cdata ){ ResourcePtr *resources; ResourcePtr this; int i; if (!client) client = serverClient; resources = clientTable[client->index].resources; for (i = 0; i < clientTable[client->index].buckets; i++) { for (this = resources[i]; this; this = this->next) { if (!type || this->type == type) { if((*func)(this->value, this->id, cdata)) return this->value; } } } return NULL; } #endif /* NXAGENT_SERVER */ void FreeClientNeverRetainResources(ClientPtr client) { ResourcePtr *resources; ResourcePtr this; ResourcePtr *prev; int j; if (!client) return; resources = clientTable[client->index].resources; for (j=0; j < clientTable[client->index].buckets; j++) { prev = &resources[j]; while ( (this = *prev) ) { RESTYPE rtype = this->type; if (rtype & RC_NEVERRETAIN) { *prev = this->next; (*DeleteFuncs[rtype & TypeMask])(this->value, this->id); free(this); } else prev = &this->next; } } } void FreeClientResources(ClientPtr client) { register ResourcePtr *resources; register ResourcePtr this; int j; /* This routine shouldn't be called with a null client, but just in case ... */ if (!client) return; HandleSaveSet(client); resources = clientTable[client->index].resources; for (j=0; j < clientTable[client->index].buckets; j++) { /* It may seem silly to update the head of this resource list as we delete the members, since the entire list will be deleted any way, but there are some resource deletion functions "FreeClientPixels" for one which do a LookupID on another resource id (a Colormap id in this case), so the resource list must be kept valid up to the point that it is deleted, so every time we delete a resource, we must update the head, just like in FreeResource. I hope that this doesn't slow down mass deletion appreciably. PRH */ ResourcePtr *head; head = &resources[j]; for (this = *head; this; this = *head) { RESTYPE rtype = this->type; *head = this->next; (*DeleteFuncs[rtype & TypeMask])(this->value, this->id); free(this); } } free(clientTable[client->index].resources); clientTable[client->index].resources = NULL; clientTable[client->index].buckets = 0; } void FreeAllResources() { int i; for (i = currentMaxClients; --i >= 0; ) { if (clientTable[i].buckets) FreeClientResources(clients[i]); } } Bool LegalNewID(XID id, register ClientPtr client) { #ifdef PANORAMIX XID minid, maxid; if (!noPanoramiXExtension) { minid = client->clientAsMask | (client->index ? SERVER_BIT : SERVER_MINID); maxid = (clientTable[client->index].fakeID | RESOURCE_ID_MASK) + 1; if ((id >= minid) && (id <= maxid)) return TRUE; } #endif /* PANORAMIX */ return ((client->clientAsMask == (id & ~RESOURCE_ID_MASK)) && ((clientTable[client->index].expectID <= id) || !LookupIDByClass(id, RC_ANY))); } #ifdef XCSECURITY /* SecurityLookupIDByType and SecurityLookupIDByClass: * These are the heart of the resource ID security system. They take * two additional arguments compared to the old LookupID functions: * the client doing the lookup, and the access mode (see resource.h). * The resource is returned if it exists and the client is allowed access, * else NULL is returned. */ void * SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype, Mask mode) { int cid; register ResourcePtr res; void * retval = NULL; assert(client == NullClient || (client->index <= currentMaxClients && clients[client->index] == client)); assert( (rtype & TypeMask) <= lastResourceType); if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { res = clientTable[cid].resources[Hash(cid, id)]; for (; res; res = res->next) if ((res->id == id) && (res->type == rtype)) { retval = res->value; break; } } if (retval && client && client->CheckAccess) retval = (* client->CheckAccess)(client, id, rtype, mode, retval); return retval; } void * SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes, Mask mode) { int cid; register ResourcePtr res = NULL; void * retval = NULL; assert(client == NullClient || (client->index <= currentMaxClients && clients[client->index] == client)); assert (classes >= lastResourceClass); if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { res = clientTable[cid].resources[Hash(cid, id)]; for (; res; res = res->next) if ((res->id == id) && (res->type & classes)) { retval = res->value; break; } } if (retval && client && client->CheckAccess) retval = (* client->CheckAccess)(client, id, res->type, mode, retval); return retval; } /* We can't replace the LookupIDByType and LookupIDByClass functions with * macros because of compatibility with loadable servers. */ void * LookupIDByType(XID id, RESTYPE rtype) { return SecurityLookupIDByType(NullClient, id, rtype, DixUnknownAccess); } void * LookupIDByClass(XID id, RESTYPE classes) { return SecurityLookupIDByClass(NullClient, id, classes, DixUnknownAccess); } #else /* not XCSECURITY */ /* * LookupIDByType returns the object with the given id and type, else NULL. */ void * LookupIDByType(XID id, RESTYPE rtype) { int cid; register ResourcePtr res; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { res = clientTable[cid].resources[Hash(cid, id)]; for (; res; res = res->next) if ((res->id == id) && (res->type == rtype)) return res->value; } return (void *)NULL; } /* * LookupIDByClass returns the object with the given id and any one of the * given classes, else NULL. */ void * LookupIDByClass(XID id, RESTYPE classes) { int cid; register ResourcePtr res; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { res = clientTable[cid].resources[Hash(cid, id)]; for (; res; res = res->next) if ((res->id == id) && (res->type & classes)) return res->value; } return (void *)NULL; } #endif /* XCSECURITY */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/swaprep.c0000644000000000000000000010464713614532331017220 0ustar /************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "dixstruct.h" #include #include "scrnintstr.h" #include "swaprep.h" #include "globals.h" static void SwapFontInfo(xQueryFontReply *pr); static void SwapCharInfo(xCharInfo *pInfo); static void SwapFont(xQueryFontReply *pr, Bool hasGlyphs); /** * Thanks to Jack Palevich for testing and subsequently rewriting all this * * \param size size in bytes */ void Swap32Write(ClientPtr pClient, int size, register CARD32 *pbuf) { register int i; size >>= 2; for(i = 0; i < size; i++) /* brackets are mandatory here, because "swapl" macro expands to several statements */ { swapl(&pbuf[i]); } WriteToClient(pClient, size << 2, pbuf); } /** * * \param size size in bytes */ void CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) { int bufsize = size; CARD32 *pbufT; register CARD32 *from, *to, *fromLast, *toLast; CARD32 tmpbuf[1]; /* Allocate as big a buffer as we can... */ while (!(pbufT = (CARD32 *) malloc(bufsize))) { bufsize >>= 1; if (bufsize == 4) { pbufT = tmpbuf; break; } } /* convert lengths from # of bytes to # of longs */ size >>= 2; bufsize >>= 2; from = pbuf; fromLast = from + size; while (from < fromLast) { int nbytes; to = pbufT; toLast = to + min (bufsize, fromLast - from); nbytes = (toLast - to) << 2; while (to < toLast) { /* can't write "cpswapl(*from++, *to++)" because cpswapl is a macro that evaulates its args more than once */ cpswapl(*from, *to); from++; to++; } WriteToClient (pClient, nbytes, pbufT); } if (pbufT != tmpbuf) free ((char *) pbufT); } /** * * \param size size in bytes */ void CopySwap16Write(ClientPtr pClient, int size, short *pbuf) { int bufsize = size; short *pbufT; register short *from, *to, *fromLast, *toLast; short tmpbuf[2]; /* Allocate as big a buffer as we can... */ while (!(pbufT = (short *) malloc(bufsize))) { bufsize >>= 1; if (bufsize == 4) { pbufT = tmpbuf; break; } } /* convert lengths from # of bytes to # of shorts */ size >>= 1; bufsize >>= 1; from = pbuf; fromLast = from + size; while (from < fromLast) { int nbytes; to = pbufT; toLast = to + min (bufsize, fromLast - from); nbytes = (toLast - to) << 1; while (to < toLast) { /* can't write "cpswaps(*from++, *to++)" because cpswaps is a macro that evaulates its args more than once */ cpswaps(*from, *to); from++; to++; } WriteToClient (pClient, nbytes, pbufT); } if (pbufT != tmpbuf) free ((char *) pbufT); } /* Extra-small reply */ void SGenericReply(ClientPtr pClient, int size, xGenericReply *pRep) { swaps(&pRep->sequenceNumber); WriteToClient(pClient, size, pRep); } /* Extra-large reply */ void SGetWindowAttributesReply(ClientPtr pClient, int size, xGetWindowAttributesReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swapl(&pRep->visualID); swaps(&pRep->class); swapl(&pRep->backingBitPlanes); swapl(&pRep->backingPixel); swapl(&pRep->colormap); swapl(&pRep->allEventMasks); swapl(&pRep->yourEventMask); swaps(&pRep->doNotPropagateMask); WriteToClient(pClient, size, pRep); } void SGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->root); swaps(&pRep->x); swaps(&pRep->y); swaps(&pRep->width); swaps(&pRep->height); swaps(&pRep->borderWidth); WriteToClient(pClient, size, pRep); } void SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swapl(&pRep->root); swapl(&pRep->parent); swaps(&pRep->nChildren); WriteToClient(pClient, size, pRep); } void SInternAtomReply(ClientPtr pClient, int size, xInternAtomReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->atom); WriteToClient(pClient, size, pRep); } void SGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nameLength); WriteToClient(pClient, size, pRep); } void SGetPropertyReply(ClientPtr pClient, int size, xGetPropertyReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swapl(&pRep->propertyType); swapl(&pRep->bytesAfter); swapl(&pRep->nItems); WriteToClient(pClient, size, pRep); } void SListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nProperties); WriteToClient(pClient, size, pRep); } void SGetSelectionOwnerReply(ClientPtr pClient, int size, xGetSelectionOwnerReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->owner); WriteToClient(pClient, size, pRep); } void SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->root); swapl(&pRep->child); swaps(&pRep->rootX); swaps(&pRep->rootY); swaps(&pRep->winX); swaps(&pRep->winY); swaps(&pRep->mask); WriteToClient(pClient, size, pRep); } void SwapTimecoord(xTimecoord* pCoord) { swapl(&pCoord->time); swaps(&pCoord->x); swaps(&pCoord->y); } void SwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord *pRep) { int i, n; xTimecoord *pRepT; n = size / sizeof(xTimecoord); pRepT = pRep; for(i = 0; i < n; i++) { SwapTimecoord(pRepT); pRepT++; } WriteToClient(pClient, size, pRep); } void SGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swapl(&pRep->nEvents); WriteToClient(pClient, size, pRep); } void STranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->child); swaps(&pRep->dstX); swaps(&pRep->dstY); WriteToClient(pClient, size, pRep); } void SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->focus); WriteToClient(pClient, size, pRep); } /* extra long reply */ void SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); WriteToClient(pClient, size, pRep); } static void SwapCharInfo(xCharInfo *pInfo) { swaps(&pInfo->leftSideBearing); swaps(&pInfo->rightSideBearing); swaps(&pInfo->characterWidth); swaps(&pInfo->ascent); swaps(&pInfo->descent); swaps(&pInfo->attributes); } static void SwapFontInfo(xQueryFontReply *pr) { swaps(&pr->minCharOrByte2); swaps(&pr->maxCharOrByte2); swaps(&pr->defaultChar); swaps(&pr->nFontProps); swaps(&pr->fontAscent); swaps(&pr->fontDescent); SwapCharInfo( &pr->minBounds); SwapCharInfo( &pr->maxBounds); swapl(&pr->nCharInfos); } static void SwapFont(xQueryFontReply *pr, Bool hasGlyphs) { unsigned i; xCharInfo * pxci; unsigned nchars, nprops; char *pby; swaps(&pr->sequenceNumber); swapl(&pr->length); nchars = pr->nCharInfos; nprops = pr->nFontProps; SwapFontInfo(pr); pby = (char *) &pr[1]; /* Font properties are an atom and either an int32 or a CARD32, so * they are always 2 4 byte values */ for(i = 0; i < nprops; i++) { swapl((int *)pby); pby += 4; swapl((int *)pby); pby += 4; } if (hasGlyphs) { pxci = (xCharInfo *)pby; for(i = 0; i< nchars; i++, pxci++) SwapCharInfo(pxci); } } void SQueryFontReply(ClientPtr pClient, int size, xQueryFontReply *pRep) { SwapFont(pRep, TRUE); WriteToClient(pClient, size, pRep); } void SQueryTextExtentsReply(ClientPtr pClient, int size, xQueryTextExtentsReply *pRep) { swaps(&pRep->sequenceNumber); swaps(&pRep->fontAscent); swaps(&pRep->fontDescent); swaps(&pRep->overallAscent); swaps(&pRep->overallDescent); swapl(&pRep->overallWidth); swapl(&pRep->overallLeft); swapl(&pRep->overallRight); WriteToClient(pClient, size, pRep); } void SListFontsReply(ClientPtr pClient, int size, xListFontsReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nFonts); WriteToClient(pClient, size, pRep); } void SListFontsWithInfoReply(ClientPtr pClient, int size, xListFontsWithInfoReply *pRep) { SwapFont((xQueryFontReply *)pRep, FALSE); WriteToClient(pClient, size, pRep); } void SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nPaths); WriteToClient(pClient, size, pRep); } void SGetImageReply(ClientPtr pClient, int size, xGetImageReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swapl(&pRep->visual); WriteToClient(pClient, size, pRep); /* Fortunately, image doesn't need swapping */ } void SListInstalledColormapsReply(ClientPtr pClient, int size, xListInstalledColormapsReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nColormaps); WriteToClient(pClient, size, pRep); } void SAllocColorReply(pClient, size, pRep) ClientPtr pClient; int size; xAllocColorReply *pRep; { swaps(&pRep->sequenceNumber); swaps(&pRep->red); swaps(&pRep->green); swaps(&pRep->blue); swapl(&pRep->pixel); WriteToClient(pClient, size, pRep); } void SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->pixel); swaps(&pRep->exactRed); swaps(&pRep->exactGreen); swaps(&pRep->exactBlue); swaps(&pRep->screenRed); swaps(&pRep->screenGreen); swaps(&pRep->screenBlue); WriteToClient(pClient, size, pRep); } void SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nPixels); swaps(&pRep->nMasks); WriteToClient(pClient, size, pRep); } void SAllocColorPlanesReply(ClientPtr pClient, int size, xAllocColorPlanesReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nPixels); swapl(&pRep->redMask); swapl(&pRep->greenMask); swapl(&pRep->blueMask); WriteToClient(pClient, size, pRep); } void SwapRGB(xrgb *prgb) { swaps(&prgb->red); swaps(&prgb->green); swaps(&prgb->blue); } void SQColorsExtend(ClientPtr pClient, int size, xrgb *prgb) { int i, n; xrgb *prgbT; n = size / sizeof(xrgb); prgbT = prgb; for(i = 0; i < n; i++) { SwapRGB(prgbT); prgbT++; } WriteToClient(pClient, size, prgb); } void SQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply* pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nColors); WriteToClient(pClient, size, pRep); } void SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply *pRep) { swaps(&pRep->sequenceNumber); swaps(&pRep->exactRed); swaps(&pRep->exactGreen); swaps(&pRep->exactBlue); swaps(&pRep->screenRed); swaps(&pRep->screenGreen); swaps(&pRep->screenBlue); WriteToClient(pClient, size, pRep); } void SQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply *pRep) { swaps(&pRep->sequenceNumber); swaps(&pRep->width); swaps(&pRep->height); WriteToClient(pClient, size, pRep); } void SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); WriteToClient(pClient, size, pRep); } void SGetKeyboardMappingReply(ClientPtr pClient, int size, xGetKeyboardMappingReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); WriteToClient(pClient, size, pRep); } void SGetPointerMappingReply(ClientPtr pClient, int size, xGetPointerMappingReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); WriteToClient(pClient, size, pRep); } void SGetModifierMappingReply(ClientPtr pClient, int size, xGetModifierMappingReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); WriteToClient(pClient, size, pRep); } void SGetKeyboardControlReply(ClientPtr pClient, int size, xGetKeyboardControlReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swapl(&pRep->ledMask); swaps(&pRep->bellPitch); swaps(&pRep->bellDuration); WriteToClient(pClient, size, pRep); } void SGetPointerControlReply(ClientPtr pClient, int size, xGetPointerControlReply *pRep) { swaps(&pRep->sequenceNumber); swaps(&pRep->accelNumerator); swaps(&pRep->accelDenominator); swaps(&pRep->threshold); WriteToClient(pClient, size, pRep); } void SGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply *pRep) { swaps(&pRep->sequenceNumber); swaps(&pRep->timeout); swaps(&pRep->interval); WriteToClient(pClient, size, pRep); } void SLHostsExtend(ClientPtr pClient, int size, char *buf) { char *bufT = buf; char *endbuf = buf + size; while (bufT < endbuf) { xHostEntry *host = (xHostEntry *) bufT; int len = host->length; swaps (&host->length); bufT += sizeof (xHostEntry) + (((len + 3) >> 2) << 2); } WriteToClient (pClient, size, buf); } void SListHostsReply(ClientPtr pClient, int size, xListHostsReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nHosts); WriteToClient(pClient, size, pRep); } void SErrorEvent(xError *from, xError *to) { to->type = X_Error; to->errorCode = from->errorCode; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->resourceID, to->resourceID); cpswaps(from->minorCode, to->minorCode); to->majorCode = from->majorCode; } void SKeyButtonPtrEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; to->u.u.detail = from->u.u.detail; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.keyButtonPointer.time, to->u.keyButtonPointer.time); cpswapl(from->u.keyButtonPointer.root, to->u.keyButtonPointer.root); cpswapl(from->u.keyButtonPointer.event, to->u.keyButtonPointer.event); cpswapl(from->u.keyButtonPointer.child, to->u.keyButtonPointer.child); cpswaps(from->u.keyButtonPointer.rootX, to->u.keyButtonPointer.rootX); cpswaps(from->u.keyButtonPointer.rootY, to->u.keyButtonPointer.rootY); cpswaps(from->u.keyButtonPointer.eventX, to->u.keyButtonPointer.eventX); cpswaps(from->u.keyButtonPointer.eventY, to->u.keyButtonPointer.eventY); cpswaps(from->u.keyButtonPointer.state, to->u.keyButtonPointer.state); to->u.keyButtonPointer.sameScreen = from->u.keyButtonPointer.sameScreen; } void SEnterLeaveEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; to->u.u.detail = from->u.u.detail; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.enterLeave.time, to->u.enterLeave.time); cpswapl(from->u.enterLeave.root, to->u.enterLeave.root); cpswapl(from->u.enterLeave.event, to->u.enterLeave.event); cpswapl(from->u.enterLeave.child, to->u.enterLeave.child); cpswaps(from->u.enterLeave.rootX, to->u.enterLeave.rootX); cpswaps(from->u.enterLeave.rootY, to->u.enterLeave.rootY); cpswaps(from->u.enterLeave.eventX, to->u.enterLeave.eventX); cpswaps(from->u.enterLeave.eventY, to->u.enterLeave.eventY); cpswaps(from->u.enterLeave.state, to->u.enterLeave.state); to->u.enterLeave.mode = from->u.enterLeave.mode; to->u.enterLeave.flags = from->u.enterLeave.flags; } void SFocusEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; to->u.u.detail = from->u.u.detail; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.focus.window, to->u.focus.window); to->u.focus.mode = from->u.focus.mode; } void SExposeEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.expose.window, to->u.expose.window); cpswaps(from->u.expose.x, to->u.expose.x); cpswaps(from->u.expose.y, to->u.expose.y); cpswaps(from->u.expose.width, to->u.expose.width); cpswaps(from->u.expose.height, to->u.expose.height); cpswaps(from->u.expose.count, to->u.expose.count); } void SGraphicsExposureEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.graphicsExposure.drawable, to->u.graphicsExposure.drawable); cpswaps(from->u.graphicsExposure.x, to->u.graphicsExposure.x); cpswaps(from->u.graphicsExposure.y, to->u.graphicsExposure.y); cpswaps(from->u.graphicsExposure.width, to->u.graphicsExposure.width); cpswaps(from->u.graphicsExposure.height, to->u.graphicsExposure.height); cpswaps(from->u.graphicsExposure.minorEvent, to->u.graphicsExposure.minorEvent); cpswaps(from->u.graphicsExposure.count, to->u.graphicsExposure.count); to->u.graphicsExposure.majorEvent = from->u.graphicsExposure.majorEvent; } void SNoExposureEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.noExposure.drawable, to->u.noExposure.drawable); cpswaps(from->u.noExposure.minorEvent, to->u.noExposure.minorEvent); to->u.noExposure.majorEvent = from->u.noExposure.majorEvent; } void SVisibilityEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.visibility.window, to->u.visibility.window); to->u.visibility.state = from->u.visibility.state; } void SCreateNotifyEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.createNotify.window, to->u.createNotify.window); cpswapl(from->u.createNotify.parent, to->u.createNotify.parent); cpswaps(from->u.createNotify.x, to->u.createNotify.x); cpswaps(from->u.createNotify.y, to->u.createNotify.y); cpswaps(from->u.createNotify.width, to->u.createNotify.width); cpswaps(from->u.createNotify.height, to->u.createNotify.height); cpswaps(from->u.createNotify.borderWidth, to->u.createNotify.borderWidth); to->u.createNotify.override = from->u.createNotify.override; } void SDestroyNotifyEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.destroyNotify.event, to->u.destroyNotify.event); cpswapl(from->u.destroyNotify.window, to->u.destroyNotify.window); } void SUnmapNotifyEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.unmapNotify.event, to->u.unmapNotify.event); cpswapl(from->u.unmapNotify.window, to->u.unmapNotify.window); to->u.unmapNotify.fromConfigure = from->u.unmapNotify.fromConfigure; } void SMapNotifyEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.mapNotify.event, to->u.mapNotify.event); cpswapl(from->u.mapNotify.window, to->u.mapNotify.window); to->u.mapNotify.override = from->u.mapNotify.override; } void SMapRequestEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.mapRequest.parent, to->u.mapRequest.parent); cpswapl(from->u.mapRequest.window, to->u.mapRequest.window); } void SReparentEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.reparent.event, to->u.reparent.event); cpswapl(from->u.reparent.window, to->u.reparent.window); cpswapl(from->u.reparent.parent, to->u.reparent.parent); cpswaps(from->u.reparent.x, to->u.reparent.x); cpswaps(from->u.reparent.y, to->u.reparent.y); to->u.reparent.override = from->u.reparent.override; } void SConfigureNotifyEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.configureNotify.event, to->u.configureNotify.event); cpswapl(from->u.configureNotify.window, to->u.configureNotify.window); cpswapl(from->u.configureNotify.aboveSibling, to->u.configureNotify.aboveSibling); cpswaps(from->u.configureNotify.x, to->u.configureNotify.x); cpswaps(from->u.configureNotify.y, to->u.configureNotify.y); cpswaps(from->u.configureNotify.width, to->u.configureNotify.width); cpswaps(from->u.configureNotify.height, to->u.configureNotify.height); cpswaps(from->u.configureNotify.borderWidth, to->u.configureNotify.borderWidth); to->u.configureNotify.override = from->u.configureNotify.override; } void SConfigureRequestEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; to->u.u.detail = from->u.u.detail; /* actually stack-mode */ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.configureRequest.parent, to->u.configureRequest.parent); cpswapl(from->u.configureRequest.window, to->u.configureRequest.window); cpswapl(from->u.configureRequest.sibling, to->u.configureRequest.sibling); cpswaps(from->u.configureRequest.x, to->u.configureRequest.x); cpswaps(from->u.configureRequest.y, to->u.configureRequest.y); cpswaps(from->u.configureRequest.width, to->u.configureRequest.width); cpswaps(from->u.configureRequest.height, to->u.configureRequest.height); cpswaps(from->u.configureRequest.borderWidth, to->u.configureRequest.borderWidth); cpswaps(from->u.configureRequest.valueMask, to->u.configureRequest.valueMask); } void SGravityEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.gravity.event, to->u.gravity.event); cpswapl(from->u.gravity.window, to->u.gravity.window); cpswaps(from->u.gravity.x, to->u.gravity.x); cpswaps(from->u.gravity.y, to->u.gravity.y); } void SResizeRequestEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.resizeRequest.window, to->u.resizeRequest.window); cpswaps(from->u.resizeRequest.width, to->u.resizeRequest.width); cpswaps(from->u.resizeRequest.height, to->u.resizeRequest.height); } void SCirculateEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; to->u.u.detail = from->u.u.detail; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.circulate.event, to->u.circulate.event); cpswapl(from->u.circulate.window, to->u.circulate.window); cpswapl(from->u.circulate.parent, to->u.circulate.parent); to->u.circulate.place = from->u.circulate.place; } void SPropertyEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.property.window, to->u.property.window); cpswapl(from->u.property.atom, to->u.property.atom); cpswapl(from->u.property.time, to->u.property.time); to->u.property.state = from->u.property.state; } void SSelectionClearEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.selectionClear.time, to->u.selectionClear.time); cpswapl(from->u.selectionClear.window, to->u.selectionClear.window); cpswapl(from->u.selectionClear.atom, to->u.selectionClear.atom); } void SSelectionRequestEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.selectionRequest.time, to->u.selectionRequest.time); cpswapl(from->u.selectionRequest.owner, to->u.selectionRequest.owner); cpswapl(from->u.selectionRequest.requestor, to->u.selectionRequest.requestor); cpswapl(from->u.selectionRequest.selection, to->u.selectionRequest.selection); cpswapl(from->u.selectionRequest.target, to->u.selectionRequest.target); cpswapl(from->u.selectionRequest.property, to->u.selectionRequest.property); } void SSelectionNotifyEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.selectionNotify.time, to->u.selectionNotify.time); cpswapl(from->u.selectionNotify.requestor, to->u.selectionNotify.requestor); cpswapl(from->u.selectionNotify.selection, to->u.selectionNotify.selection); cpswapl(from->u.selectionNotify.target, to->u.selectionNotify.target); cpswapl(from->u.selectionNotify.property, to->u.selectionNotify.property); } void SColormapEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.colormap.window, to->u.colormap.window); cpswapl(from->u.colormap.colormap, to->u.colormap.colormap); to->u.colormap.new = from->u.colormap.new; to->u.colormap.state = from->u.colormap.state; } void SMappingEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); to->u.mappingNotify.request = from->u.mappingNotify.request; to->u.mappingNotify.firstKeyCode = from->u.mappingNotify.firstKeyCode; to->u.mappingNotify.count = from->u.mappingNotify.count; } void SClientMessageEvent(xEvent *from, xEvent *to) { to->u.u.type = from->u.u.type; to->u.u.detail = from->u.u.detail; /* actually format */ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.clientMessage.window, to->u.clientMessage.window); cpswapl(from->u.clientMessage.u.l.type, to->u.clientMessage.u.l.type); switch (from->u.u.detail) { case 8: memmove(to->u.clientMessage.u.b.bytes, from->u.clientMessage.u.b.bytes,20); break; case 16: cpswaps(from->u.clientMessage.u.s.shorts0, to->u.clientMessage.u.s.shorts0); cpswaps(from->u.clientMessage.u.s.shorts1, to->u.clientMessage.u.s.shorts1); cpswaps(from->u.clientMessage.u.s.shorts2, to->u.clientMessage.u.s.shorts2); cpswaps(from->u.clientMessage.u.s.shorts3, to->u.clientMessage.u.s.shorts3); cpswaps(from->u.clientMessage.u.s.shorts4, to->u.clientMessage.u.s.shorts4); cpswaps(from->u.clientMessage.u.s.shorts5, to->u.clientMessage.u.s.shorts5); cpswaps(from->u.clientMessage.u.s.shorts6, to->u.clientMessage.u.s.shorts6); cpswaps(from->u.clientMessage.u.s.shorts7, to->u.clientMessage.u.s.shorts7); cpswaps(from->u.clientMessage.u.s.shorts8, to->u.clientMessage.u.s.shorts8); cpswaps(from->u.clientMessage.u.s.shorts9, to->u.clientMessage.u.s.shorts9); break; case 32: cpswapl(from->u.clientMessage.u.l.longs0, to->u.clientMessage.u.l.longs0); cpswapl(from->u.clientMessage.u.l.longs1, to->u.clientMessage.u.l.longs1); cpswapl(from->u.clientMessage.u.l.longs2, to->u.clientMessage.u.l.longs2); cpswapl(from->u.clientMessage.u.l.longs3, to->u.clientMessage.u.l.longs3); cpswapl(from->u.clientMessage.u.l.longs4, to->u.clientMessage.u.l.longs4); break; } } void SKeymapNotifyEvent(xEvent *from, xEvent *to) { /* Keymap notify events are special; they have no sequence number field, and contain entirely 8-bit data */ *to = *from; } void SwapConnSetupInfo( char *pInfo, char *pInfoT ) { int i, j, k; xConnSetup *pConnSetup = (xConnSetup *)pInfo; xDepth *depth; xWindowRoot *root; SwapConnSetup(pConnSetup, (xConnSetup *)pInfoT); pInfo += sizeof(xConnSetup); pInfoT += sizeof(xConnSetup); /* Copy the vendor string */ i = (pConnSetup->nbytesVendor + 3) & ~3; memcpy(pInfoT, pInfo, i); pInfo += i; pInfoT += i; /* The Pixmap formats don't need to be swapped, just copied. */ i = sizeof(xPixmapFormat) * pConnSetup->numFormats; memcpy(pInfoT, pInfo, i); pInfo += i; pInfoT += i; for(i = 0; i < pConnSetup->numRoots; i++) { root = (xWindowRoot*)pInfo; SwapWinRoot(root, (xWindowRoot *)pInfoT); pInfo += sizeof(xWindowRoot); pInfoT += sizeof(xWindowRoot); for(j = 0; j < root->nDepths; j++) { depth = (xDepth*)pInfo; ((xDepth *)pInfoT)->depth = depth->depth; cpswaps(depth->nVisuals, ((xDepth *)pInfoT)->nVisuals); pInfo += sizeof(xDepth); pInfoT += sizeof(xDepth); for(k = 0; k < depth->nVisuals; k++) { SwapVisual((xVisualType *)pInfo, (xVisualType *)pInfoT); pInfo += sizeof(xVisualType); pInfoT += sizeof(xVisualType); } } } } void WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) { char *pInfoTBase; pInfoTBase = (char *) malloc(size); if (!pInfoTBase) { pClient->noClientException = -1; return; } SwapConnSetupInfo(pInfo, pInfoTBase); WriteToClient(pClient, (int)size, pInfoTBase); free(pInfoTBase); } void SwapConnSetup(xConnSetup *pConnSetup, xConnSetup *pConnSetupT) { cpswapl(pConnSetup->release, pConnSetupT->release); cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase); cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask); cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize); cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor); cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize); pConnSetupT->minKeyCode = pConnSetup->minKeyCode; pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode; pConnSetupT->numRoots = pConnSetup->numRoots; pConnSetupT->numFormats = pConnSetup->numFormats; pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder; pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder; pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit; pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad; } void SwapWinRoot(xWindowRoot *pRoot, xWindowRoot *pRootT) { cpswapl(pRoot->windowId, pRootT->windowId); cpswapl(pRoot->defaultColormap, pRootT->defaultColormap); cpswapl(pRoot->whitePixel, pRootT->whitePixel); cpswapl(pRoot->blackPixel, pRootT->blackPixel); cpswapl(pRoot->currentInputMask, pRootT->currentInputMask); cpswaps(pRoot->pixWidth, pRootT->pixWidth); cpswaps(pRoot->pixHeight, pRootT->pixHeight); cpswaps(pRoot->mmWidth, pRootT->mmWidth); cpswaps(pRoot->mmHeight, pRootT->mmHeight); cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps); cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps); cpswapl(pRoot->rootVisualID, pRootT->rootVisualID); pRootT->backingStore = pRoot->backingStore; pRootT->saveUnders = pRoot->saveUnders; pRootT->rootDepth = pRoot->rootDepth; pRootT->nDepths = pRoot->nDepths; } void SwapVisual(xVisualType *pVis, xVisualType *pVisT) { cpswapl(pVis->visualID, pVisT->visualID); pVisT->class = pVis->class; pVisT->bitsPerRGB = pVis->bitsPerRGB; cpswaps(pVis->colormapEntries, pVisT->colormapEntries); cpswapl(pVis->redMask, pVisT->redMask); cpswapl(pVis->greenMask, pVisT->greenMask); cpswapl(pVis->blueMask, pVisT->blueMask); } void SwapConnSetupPrefix(xConnSetupPrefix *pcspFrom, xConnSetupPrefix *pcspTo) { pcspTo->success = pcspFrom->success; pcspTo->lengthReason = pcspFrom->lengthReason; cpswaps(pcspFrom->majorVersion, pcspTo->majorVersion); cpswaps(pcspFrom->minorVersion, pcspTo->minorVersion); cpswaps(pcspFrom->length, pcspTo->length); } void WriteSConnSetupPrefix(ClientPtr pClient, xConnSetupPrefix *pcsp) { xConnSetupPrefix cspT; SwapConnSetupPrefix(pcsp, &cspT); WriteToClient(pClient, sizeof(cspT), &cspT); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/swapreq.c0000644000000000000000000006131213614532331017210 0ustar /************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" /* for SendEvent */ #include "swapreq.h" /* Thanks to Jack Palevich for testing and subsequently rewriting all this */ /* Byte swap a list of longs */ void SwapLongs (register CARD32 *list, register unsigned long count) { while (count >= 8) { swapl(list+0); swapl(list+1); swapl(list+2); swapl(list+3); swapl(list+4); swapl(list+5); swapl(list+6); swapl(list+7); list += 8; count -= 8; } if (count != 0) { do { swapl(list); list++; } while (--count != 0); } } /* Byte swap a list of shorts */ void SwapShorts (register short *list, register unsigned long count) { while (count >= 16) { swaps(list+0); swaps(list+1); swaps(list+2); swaps(list+3); swaps(list+4); swaps(list+5); swaps(list+6); swaps(list+7); swaps(list+8); swaps(list+9); swaps(list+10); swaps(list+11); swaps(list+12); swaps(list+13); swaps(list+14); swaps(list+15); list += 16; count -= 16; } if (count != 0) { do { swaps(list); list++; } while (--count != 0); } } /* The following is used for all requests that have no fields to be swapped (except "length") */ int SProcSimpleReq(register ClientPtr client) { REQUEST(xReq); swaps(&stuff->length); return(*ProcVector[stuff->reqType])(client); } /* The following is used for all requests that have only a single 32-bit field to be swapped, coming right after the "length" field */ int SProcResourceReq(register ClientPtr client) { REQUEST(xResourceReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xResourceReq); /* not EXACT */ swapl(&stuff->id); return(*ProcVector[stuff->reqType])(client); } int SProcCreateWindow(register ClientPtr client) { REQUEST(xCreateWindowReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xCreateWindowReq); swapl(&stuff->wid); swapl(&stuff->parent); swaps(&stuff->x); swaps(&stuff->y); swaps(&stuff->width); swaps(&stuff->height); swaps(&stuff->borderWidth); swaps(&stuff->class); swapl(&stuff->visual); swapl(&stuff->mask); SwapRestL(stuff); return((* ProcVector[X_CreateWindow])(client)); } int SProcChangeWindowAttributes(register ClientPtr client) { REQUEST(xChangeWindowAttributesReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); swapl(&stuff->window); swapl(&stuff->valueMask); SwapRestL(stuff); return((* ProcVector[X_ChangeWindowAttributes])(client)); } int SProcReparentWindow(register ClientPtr client) { REQUEST(xReparentWindowReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xReparentWindowReq); swapl(&stuff->window); swapl(&stuff->parent); swaps(&stuff->x); swaps(&stuff->y); return((* ProcVector[X_ReparentWindow])(client)); } int SProcConfigureWindow(register ClientPtr client) { REQUEST(xConfigureWindowReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); swapl(&stuff->window); swaps(&stuff->mask); SwapRestL(stuff); return((* ProcVector[X_ConfigureWindow])(client)); } int SProcInternAtom(register ClientPtr client) { REQUEST(xInternAtomReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xInternAtomReq); swaps(&stuff->nbytes); return((* ProcVector[X_InternAtom])(client)); } int SProcChangeProperty(register ClientPtr client) { REQUEST(xChangePropertyReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xChangePropertyReq); swapl(&stuff->window); swapl(&stuff->property); swapl(&stuff->type); swapl(&stuff->nUnits); switch ( stuff->format ) { case 8 : break; case 16: SwapRestS(stuff); break; case 32: SwapRestL(stuff); break; } return((* ProcVector[X_ChangeProperty])(client)); } int SProcDeleteProperty(register ClientPtr client) { REQUEST(xDeletePropertyReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDeletePropertyReq); swapl(&stuff->window); swapl(&stuff->property); return((* ProcVector[X_DeleteProperty])(client)); } int SProcGetProperty(register ClientPtr client) { REQUEST(xGetPropertyReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xGetPropertyReq); swapl(&stuff->window); swapl(&stuff->property); swapl(&stuff->type); swapl(&stuff->longOffset); swapl(&stuff->longLength); return((* ProcVector[X_GetProperty])(client)); } int SProcSetSelectionOwner(register ClientPtr client) { REQUEST(xSetSelectionOwnerReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xSetSelectionOwnerReq); swapl(&stuff->window); swapl(&stuff->selection); swapl(&stuff->time); return((* ProcVector[X_SetSelectionOwner])(client)); } int SProcConvertSelection(register ClientPtr client) { REQUEST(xConvertSelectionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xConvertSelectionReq); swapl(&stuff->requestor); swapl(&stuff->selection); swapl(&stuff->target); swapl(&stuff->property); swapl(&stuff->time); return((* ProcVector[X_ConvertSelection])(client)); } int SProcSendEvent(register ClientPtr client) { xEvent eventT; EventSwapPtr proc; REQUEST(xSendEventReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xSendEventReq); swapl(&stuff->destination); swapl(&stuff->eventMask); /* Swap event */ proc = EventSwapVector[stuff->event.u.u.type & 0177]; if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */ return (BadValue); (*proc)(&stuff->event, &eventT); stuff->event = eventT; return((* ProcVector[X_SendEvent])(client)); } int SProcGrabPointer(register ClientPtr client) { REQUEST(xGrabPointerReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xGrabPointerReq); swapl(&stuff->grabWindow); swaps(&stuff->eventMask); swapl(&stuff->confineTo); swapl(&stuff->cursor); swapl(&stuff->time); return((* ProcVector[X_GrabPointer])(client)); } int SProcGrabButton(register ClientPtr client) { REQUEST(xGrabButtonReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xGrabButtonReq); swapl(&stuff->grabWindow); swaps(&stuff->eventMask); swapl(&stuff->confineTo); swapl(&stuff->cursor); swaps(&stuff->modifiers); return((* ProcVector[X_GrabButton])(client)); } int SProcUngrabButton(register ClientPtr client) { REQUEST(xUngrabButtonReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xUngrabButtonReq); swapl(&stuff->grabWindow); swaps(&stuff->modifiers); return((* ProcVector[X_UngrabButton])(client)); } int SProcChangeActivePointerGrab(register ClientPtr client) { REQUEST(xChangeActivePointerGrabReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq); swapl(&stuff->cursor); swapl(&stuff->time); swaps(&stuff->eventMask); return((* ProcVector[X_ChangeActivePointerGrab])(client)); } int SProcGrabKeyboard(register ClientPtr client) { REQUEST(xGrabKeyboardReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xGrabKeyboardReq); swapl(&stuff->grabWindow); swapl(&stuff->time); return((* ProcVector[X_GrabKeyboard])(client)); } int SProcGrabKey(register ClientPtr client) { REQUEST(xGrabKeyReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xGrabKeyReq); swapl(&stuff->grabWindow); swaps(&stuff->modifiers); return((* ProcVector[X_GrabKey])(client)); } int SProcUngrabKey(register ClientPtr client) { REQUEST(xUngrabKeyReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xUngrabKeyReq); swapl(&stuff->grabWindow); swaps(&stuff->modifiers); return((* ProcVector[X_UngrabKey])(client)); } int SProcGetMotionEvents(register ClientPtr client) { REQUEST(xGetMotionEventsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xGetMotionEventsReq); swapl(&stuff->window); swapl(&stuff->start); swapl(&stuff->stop); return((* ProcVector[X_GetMotionEvents])(client)); } int SProcTranslateCoords(register ClientPtr client) { REQUEST(xTranslateCoordsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xTranslateCoordsReq); swapl(&stuff->srcWid); swapl(&stuff->dstWid); swaps(&stuff->srcX); swaps(&stuff->srcY); return((* ProcVector[X_TranslateCoords])(client)); } int SProcWarpPointer(register ClientPtr client) { REQUEST(xWarpPointerReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xWarpPointerReq); swapl(&stuff->srcWid); swapl(&stuff->dstWid); swaps(&stuff->srcX); swaps(&stuff->srcY); swaps(&stuff->srcWidth); swaps(&stuff->srcHeight); swaps(&stuff->dstX); swaps(&stuff->dstY); return((* ProcVector[X_WarpPointer])(client)); } int SProcSetInputFocus(register ClientPtr client) { REQUEST(xSetInputFocusReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xSetInputFocusReq); swapl(&stuff->focus); swapl(&stuff->time); return((* ProcVector[X_SetInputFocus])(client)); } int SProcOpenFont(register ClientPtr client) { REQUEST(xOpenFontReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xOpenFontReq); swapl(&stuff->fid); swaps(&stuff->nbytes); return((* ProcVector[X_OpenFont])(client)); } int SProcListFonts(register ClientPtr client) { REQUEST(xListFontsReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xListFontsReq); swaps(&stuff->maxNames); swaps(&stuff->nbytes); return((* ProcVector[X_ListFonts])(client)); } int SProcListFontsWithInfo(register ClientPtr client) { REQUEST(xListFontsWithInfoReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xListFontsWithInfoReq); swaps(&stuff->maxNames); swaps(&stuff->nbytes); return((* ProcVector[X_ListFontsWithInfo])(client)); } int SProcSetFontPath(register ClientPtr client) { REQUEST(xSetFontPathReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xSetFontPathReq); swaps(&stuff->nFonts); return((* ProcVector[X_SetFontPath])(client)); } int SProcCreatePixmap(register ClientPtr client) { REQUEST(xCreatePixmapReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCreatePixmapReq); swapl(&stuff->pid); swapl(&stuff->drawable); swaps(&stuff->width); swaps(&stuff->height); return((* ProcVector[X_CreatePixmap])(client)); } int SProcCreateGC(register ClientPtr client) { REQUEST(xCreateGCReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xCreateGCReq); swapl(&stuff->gc); swapl(&stuff->drawable); swapl(&stuff->mask); SwapRestL(stuff); return((* ProcVector[X_CreateGC])(client)); } int SProcChangeGC(register ClientPtr client) { REQUEST(xChangeGCReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xChangeGCReq); swapl(&stuff->gc); swapl(&stuff->mask); SwapRestL(stuff); return((* ProcVector[X_ChangeGC])(client)); } int SProcCopyGC(register ClientPtr client) { REQUEST(xCopyGCReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCopyGCReq); swapl(&stuff->srcGC); swapl(&stuff->dstGC); swapl(&stuff->mask); return((* ProcVector[X_CopyGC])(client)); } int SProcSetDashes(register ClientPtr client) { REQUEST(xSetDashesReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xSetDashesReq); swapl(&stuff->gc); swaps(&stuff->dashOffset); swaps(&stuff->nDashes); return((* ProcVector[X_SetDashes])(client)); } int SProcSetClipRectangles(register ClientPtr client) { REQUEST(xSetClipRectanglesReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq); swapl(&stuff->gc); swaps(&stuff->xOrigin); swaps(&stuff->yOrigin); SwapRestS(stuff); return((* ProcVector[X_SetClipRectangles])(client)); } int SProcClearToBackground(register ClientPtr client) { REQUEST(xClearAreaReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xClearAreaReq); swapl(&stuff->window); swaps(&stuff->x); swaps(&stuff->y); swaps(&stuff->width); swaps(&stuff->height); return((* ProcVector[X_ClearArea])(client)); } int SProcCopyArea(register ClientPtr client) { REQUEST(xCopyAreaReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCopyAreaReq); swapl(&stuff->srcDrawable); swapl(&stuff->dstDrawable); swapl(&stuff->gc); swaps(&stuff->srcX); swaps(&stuff->srcY); swaps(&stuff->dstX); swaps(&stuff->dstY); swaps(&stuff->width); swaps(&stuff->height); return((* ProcVector[X_CopyArea])(client)); } int SProcCopyPlane(register ClientPtr client) { REQUEST(xCopyPlaneReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCopyPlaneReq); swapl(&stuff->srcDrawable); swapl(&stuff->dstDrawable); swapl(&stuff->gc); swaps(&stuff->srcX); swaps(&stuff->srcY); swaps(&stuff->dstX); swaps(&stuff->dstY); swaps(&stuff->width); swaps(&stuff->height); swapl(&stuff->bitPlane); return((* ProcVector[X_CopyPlane])(client)); } /* The following routine is used for all Poly drawing requests (except FillPoly, which uses a different request format) */ int SProcPoly(register ClientPtr client) { REQUEST(xPolyPointReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xPolyPointReq); swapl(&stuff->drawable); swapl(&stuff->gc); SwapRestS(stuff); return((* ProcVector[stuff->reqType])(client)); } /* cannot use SProcPoly for this one, because xFillPolyReq is longer than xPolyPointReq, and we don't want to swap the difference as shorts! */ int SProcFillPoly(register ClientPtr client) { REQUEST(xFillPolyReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xFillPolyReq); swapl(&stuff->drawable); swapl(&stuff->gc); SwapRestS(stuff); return((* ProcVector[X_FillPoly])(client)); } int SProcPutImage(register ClientPtr client) { REQUEST(xPutImageReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xPutImageReq); swapl(&stuff->drawable); swapl(&stuff->gc); swaps(&stuff->width); swaps(&stuff->height); swaps(&stuff->dstX); swaps(&stuff->dstY); /* Image should already be swapped */ return((* ProcVector[X_PutImage])(client)); } int SProcGetImage(register ClientPtr client) { REQUEST(xGetImageReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xGetImageReq); swapl(&stuff->drawable); swaps(&stuff->x); swaps(&stuff->y); swaps(&stuff->width); swaps(&stuff->height); swapl(&stuff->planeMask); return((* ProcVector[X_GetImage])(client)); } /* ProcPolyText used for both PolyText8 and PolyText16 */ int SProcPolyText(register ClientPtr client) { REQUEST(xPolyTextReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xPolyTextReq); swapl(&stuff->drawable); swapl(&stuff->gc); swaps(&stuff->x); swaps(&stuff->y); return((* ProcVector[stuff->reqType])(client)); } /* ProcImageText used for both ImageText8 and ImageText16 */ int SProcImageText(register ClientPtr client) { REQUEST(xImageTextReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xImageTextReq); swapl(&stuff->drawable); swapl(&stuff->gc); swaps(&stuff->x); swaps(&stuff->y); return((* ProcVector[stuff->reqType])(client)); } int SProcCreateColormap(register ClientPtr client) { REQUEST(xCreateColormapReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCreateColormapReq); swapl(&stuff->mid); swapl(&stuff->window); swapl(&stuff->visual); return((* ProcVector[X_CreateColormap])(client)); } int SProcCopyColormapAndFree(register ClientPtr client) { REQUEST(xCopyColormapAndFreeReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq); swapl(&stuff->mid); swapl(&stuff->srcCmap); return((* ProcVector[X_CopyColormapAndFree])(client)); } int SProcAllocColor(register ClientPtr client) { REQUEST(xAllocColorReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xAllocColorReq); swapl(&stuff->cmap); swaps(&stuff->red); swaps(&stuff->green); swaps(&stuff->blue); return((* ProcVector[X_AllocColor])(client)); } int SProcAllocNamedColor(register ClientPtr client) { REQUEST(xAllocNamedColorReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xAllocNamedColorReq); swapl(&stuff->cmap); swaps(&stuff->nbytes); return((* ProcVector[X_AllocNamedColor])(client)); } int SProcAllocColorCells(register ClientPtr client) { REQUEST(xAllocColorCellsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xAllocColorCellsReq); swapl(&stuff->cmap); swaps(&stuff->colors); swaps(&stuff->planes); return((* ProcVector[X_AllocColorCells])(client)); } int SProcAllocColorPlanes(register ClientPtr client) { REQUEST(xAllocColorPlanesReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xAllocColorPlanesReq); swapl(&stuff->cmap); swaps(&stuff->colors); swaps(&stuff->red); swaps(&stuff->green); swaps(&stuff->blue); return((* ProcVector[X_AllocColorPlanes])(client)); } int SProcFreeColors(register ClientPtr client) { REQUEST(xFreeColorsReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xFreeColorsReq); swapl(&stuff->cmap); swapl(&stuff->planeMask); SwapRestL(stuff); return((* ProcVector[X_FreeColors])(client)); } void SwapColorItem(xColorItem *pItem) { swapl(&pItem->pixel); swaps(&pItem->red); swaps(&pItem->green); swaps(&pItem->blue); } int SProcStoreColors(register ClientPtr client) { long count; xColorItem *pItem; REQUEST(xStoreColorsReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xStoreColorsReq); swapl(&stuff->cmap); pItem = (xColorItem *) &stuff[1]; for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; ) SwapColorItem(pItem++); return((* ProcVector[X_StoreColors])(client)); } int SProcStoreNamedColor (register ClientPtr client) { REQUEST(xStoreNamedColorReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xStoreNamedColorReq); swapl(&stuff->cmap); swapl(&stuff->pixel); swaps(&stuff->nbytes); return((* ProcVector[X_StoreNamedColor])(client)); } int SProcQueryColors (register ClientPtr client) { REQUEST(xQueryColorsReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xQueryColorsReq); swapl(&stuff->cmap); SwapRestL(stuff); return((* ProcVector[X_QueryColors])(client)); } int SProcLookupColor (register ClientPtr client) { REQUEST(xLookupColorReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xLookupColorReq); swapl(&stuff->cmap); swaps(&stuff->nbytes); return((* ProcVector[X_LookupColor])(client)); } int SProcCreateCursor (register ClientPtr client) { REQUEST(xCreateCursorReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCreateCursorReq); swapl(&stuff->cid); swapl(&stuff->source); swapl(&stuff->mask); swaps(&stuff->foreRed); swaps(&stuff->foreGreen); swaps(&stuff->foreBlue); swaps(&stuff->backRed); swaps(&stuff->backGreen); swaps(&stuff->backBlue); swaps(&stuff->x); swaps(&stuff->y); return((* ProcVector[X_CreateCursor])(client)); } int SProcCreateGlyphCursor (register ClientPtr client) { REQUEST(xCreateGlyphCursorReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCreateGlyphCursorReq); swapl(&stuff->cid); swapl(&stuff->source); swapl(&stuff->mask); swaps(&stuff->sourceChar); swaps(&stuff->maskChar); swaps(&stuff->foreRed); swaps(&stuff->foreGreen); swaps(&stuff->foreBlue); swaps(&stuff->backRed); swaps(&stuff->backGreen); swaps(&stuff->backBlue); return((* ProcVector[X_CreateGlyphCursor])(client)); } int SProcRecolorCursor (register ClientPtr client) { REQUEST(xRecolorCursorReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xRecolorCursorReq); swapl(&stuff->cursor); swaps(&stuff->foreRed); swaps(&stuff->foreGreen); swaps(&stuff->foreBlue); swaps(&stuff->backRed); swaps(&stuff->backGreen); swaps(&stuff->backBlue); return((* ProcVector[X_RecolorCursor])(client)); } int SProcQueryBestSize (register ClientPtr client) { REQUEST(xQueryBestSizeReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xQueryBestSizeReq); swapl(&stuff->drawable); swaps(&stuff->width); swaps(&stuff->height); return((* ProcVector[X_QueryBestSize])(client)); } int SProcQueryExtension (register ClientPtr client) { REQUEST(xQueryExtensionReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xQueryExtensionReq); swaps(&stuff->nbytes); return((* ProcVector[X_QueryExtension])(client)); } int SProcChangeKeyboardMapping (register ClientPtr client) { REQUEST(xChangeKeyboardMappingReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq); SwapRestL(stuff); return((* ProcVector[X_ChangeKeyboardMapping])(client)); } int SProcChangeKeyboardControl (register ClientPtr client) { REQUEST(xChangeKeyboardControlReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq); swapl(&stuff->mask); SwapRestL(stuff); return((* ProcVector[X_ChangeKeyboardControl])(client)); } int SProcChangePointerControl (register ClientPtr client) { REQUEST(xChangePointerControlReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xChangePointerControlReq); swaps(&stuff->accelNum); swaps(&stuff->accelDenum); swaps(&stuff->threshold); return((* ProcVector[X_ChangePointerControl])(client)); } int SProcSetScreenSaver (register ClientPtr client) { REQUEST(xSetScreenSaverReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xSetScreenSaverReq); swaps(&stuff->timeout); swaps(&stuff->interval); return((* ProcVector[X_SetScreenSaver])(client)); } int SProcChangeHosts (register ClientPtr client) { REQUEST(xChangeHostsReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xChangeHostsReq); swaps(&stuff->hostLength); return((* ProcVector[X_ChangeHosts])(client)); } int SProcRotateProperties (register ClientPtr client) { REQUEST(xRotatePropertiesReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xRotatePropertiesReq); swapl(&stuff->window); swaps(&stuff->nAtoms); swaps(&stuff->nPositions); SwapRestL(stuff); return ((* ProcVector[X_RotateProperties])(client)); } int SProcNoOperation(register ClientPtr client) { REQUEST(xReq); swaps(&stuff->length); return ((* ProcVector[X_NoOperation])(client)); } void SwapConnClientPrefix(xConnClientPrefix *pCCP) { swaps(&pCCP->majorVersion); swaps(&pCCP->minorVersion); swaps(&pCCP->nbytesAuthProto); swaps(&pCCP->nbytesAuthString); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/tables.c0000644000000000000000000003525113614532331017003 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "windowstr.h" #include "extnsionst.h" #include "dixstruct.h" #include "dixevents.h" #include "dispatch.h" #include "swaprep.h" #include "swapreq.h" int (* InitialVector[3]) ( ClientPtr /* client */ ) = { 0, ProcInitialConnection, ProcEstablishConnection }; int (* ProcVector[256]) ( ClientPtr /* client */ ) = { ProcBadRequest, ProcCreateWindow, ProcChangeWindowAttributes, ProcGetWindowAttributes, ProcDestroyWindow, ProcDestroySubwindows, /* 5 */ ProcChangeSaveSet, ProcReparentWindow, ProcMapWindow, ProcMapSubwindows, ProcUnmapWindow, /* 10 */ ProcUnmapSubwindows, ProcConfigureWindow, ProcCirculateWindow, ProcGetGeometry, ProcQueryTree, /* 15 */ ProcInternAtom, ProcGetAtomName, ProcChangeProperty, ProcDeleteProperty, ProcGetProperty, /* 20 */ ProcListProperties, ProcSetSelectionOwner, ProcGetSelectionOwner, ProcConvertSelection, ProcSendEvent, /* 25 */ ProcGrabPointer, ProcUngrabPointer, ProcGrabButton, ProcUngrabButton, ProcChangeActivePointerGrab, /* 30 */ ProcGrabKeyboard, ProcUngrabKeyboard, ProcGrabKey, ProcUngrabKey, ProcAllowEvents, /* 35 */ ProcGrabServer, ProcUngrabServer, ProcQueryPointer, ProcGetMotionEvents, ProcTranslateCoords, /* 40 */ ProcWarpPointer, ProcSetInputFocus, ProcGetInputFocus, ProcQueryKeymap, ProcOpenFont, /* 45 */ ProcCloseFont, ProcQueryFont, ProcQueryTextExtents, ProcListFonts, ProcListFontsWithInfo, /* 50 */ ProcSetFontPath, ProcGetFontPath, ProcCreatePixmap, ProcFreePixmap, ProcCreateGC, /* 55 */ ProcChangeGC, ProcCopyGC, ProcSetDashes, ProcSetClipRectangles, ProcFreeGC, /* 60 */ ProcClearToBackground, ProcCopyArea, ProcCopyPlane, ProcPolyPoint, ProcPolyLine, /* 65 */ ProcPolySegment, ProcPolyRectangle, ProcPolyArc, ProcFillPoly, ProcPolyFillRectangle, /* 70 */ ProcPolyFillArc, ProcPutImage, ProcGetImage, ProcPolyText, ProcPolyText, /* 75 */ ProcImageText8, ProcImageText16, ProcCreateColormap, ProcFreeColormap, ProcCopyColormapAndFree, /* 80 */ ProcInstallColormap, ProcUninstallColormap, ProcListInstalledColormaps, ProcAllocColor, ProcAllocNamedColor, /* 85 */ ProcAllocColorCells, ProcAllocColorPlanes, ProcFreeColors, ProcStoreColors, ProcStoreNamedColor, /* 90 */ ProcQueryColors, ProcLookupColor, ProcCreateCursor, ProcCreateGlyphCursor, ProcFreeCursor, /* 95 */ ProcRecolorCursor, ProcQueryBestSize, ProcQueryExtension, ProcListExtensions, ProcChangeKeyboardMapping, /* 100 */ ProcGetKeyboardMapping, ProcChangeKeyboardControl, ProcGetKeyboardControl, ProcBell, ProcChangePointerControl, /* 105 */ ProcGetPointerControl, ProcSetScreenSaver, ProcGetScreenSaver, ProcChangeHosts, ProcListHosts, /* 110 */ ProcChangeAccessControl, ProcChangeCloseDownMode, ProcKillClient, ProcRotateProperties, ProcForceScreenSaver, /* 115 */ ProcSetPointerMapping, ProcGetPointerMapping, ProcSetModifierMapping, ProcGetModifierMapping, 0, /* 120 */ 0, 0, 0, 0, 0, /* 125 */ 0, ProcNoOperation }; int (* SwappedProcVector[256]) ( ClientPtr /* client */ ) = { ProcBadRequest, SProcCreateWindow, SProcChangeWindowAttributes, SProcResourceReq, /* GetWindowAttributes */ SProcResourceReq, /* DestroyWindow */ SProcResourceReq, /* 5 DestroySubwindows */ SProcResourceReq, /* SProcChangeSaveSet, */ SProcReparentWindow, SProcResourceReq, /* MapWindow */ SProcResourceReq, /* MapSubwindows */ SProcResourceReq, /* 10 UnmapWindow */ SProcResourceReq, /* UnmapSubwindows */ SProcConfigureWindow, SProcResourceReq, /* SProcCirculateWindow, */ SProcResourceReq, /* GetGeometry */ SProcResourceReq, /* 15 QueryTree */ SProcInternAtom, SProcResourceReq, /* SProcGetAtomName, */ SProcChangeProperty, SProcDeleteProperty, SProcGetProperty, /* 20 */ SProcResourceReq, /* SProcListProperties, */ SProcSetSelectionOwner, SProcResourceReq, /* SProcGetSelectionOwner, */ SProcConvertSelection, SProcSendEvent, /* 25 */ SProcGrabPointer, SProcResourceReq, /* SProcUngrabPointer, */ SProcGrabButton, SProcUngrabButton, SProcChangeActivePointerGrab, /* 30 */ SProcGrabKeyboard, SProcResourceReq, /* SProcUngrabKeyboard, */ SProcGrabKey, SProcUngrabKey, SProcResourceReq, /* 35 SProcAllowEvents, */ SProcSimpleReq, /* SProcGrabServer, */ SProcSimpleReq, /* SProcUngrabServer, */ SProcResourceReq, /* SProcQueryPointer, */ SProcGetMotionEvents, SProcTranslateCoords, /*40 */ SProcWarpPointer, SProcSetInputFocus, SProcSimpleReq, /* SProcGetInputFocus, */ SProcSimpleReq, /* QueryKeymap, */ SProcOpenFont, /* 45 */ SProcResourceReq, /* SProcCloseFont, */ SProcResourceReq, /* SProcQueryFont, */ SProcResourceReq, /* SProcQueryTextExtents, */ SProcListFonts, SProcListFontsWithInfo, /* 50 */ SProcSetFontPath, SProcSimpleReq, /* GetFontPath, */ SProcCreatePixmap, SProcResourceReq, /* SProcFreePixmap, */ SProcCreateGC, /* 55 */ SProcChangeGC, SProcCopyGC, SProcSetDashes, SProcSetClipRectangles, SProcResourceReq, /* 60 SProcFreeGC, */ SProcClearToBackground, SProcCopyArea, SProcCopyPlane, SProcPoly, /* PolyPoint, */ SProcPoly, /* 65 PolyLine */ SProcPoly, /* PolySegment, */ SProcPoly, /* PolyRectangle, */ SProcPoly, /* PolyArc, */ SProcFillPoly, SProcPoly, /* 70 PolyFillRectangle */ SProcPoly, /* PolyFillArc, */ SProcPutImage, SProcGetImage, SProcPolyText, SProcPolyText, /* 75 */ SProcImageText, SProcImageText, SProcCreateColormap, SProcResourceReq, /* SProcFreeColormap, */ SProcCopyColormapAndFree, /* 80 */ SProcResourceReq, /* SProcInstallColormap, */ SProcResourceReq, /* SProcUninstallColormap, */ SProcResourceReq, /* SProcListInstalledColormaps, */ SProcAllocColor, SProcAllocNamedColor, /* 85 */ SProcAllocColorCells, SProcAllocColorPlanes, SProcFreeColors, SProcStoreColors, SProcStoreNamedColor, /* 90 */ SProcQueryColors, SProcLookupColor, SProcCreateCursor, SProcCreateGlyphCursor, SProcResourceReq, /* 95 SProcFreeCursor, */ SProcRecolorCursor, SProcQueryBestSize, SProcQueryExtension, SProcSimpleReq, /* ListExtensions, */ SProcChangeKeyboardMapping, /* 100 */ SProcSimpleReq, /* GetKeyboardMapping, */ SProcChangeKeyboardControl, SProcSimpleReq, /* GetKeyboardControl, */ SProcSimpleReq, /* Bell, */ SProcChangePointerControl, /* 105 */ SProcSimpleReq, /* GetPointerControl, */ SProcSetScreenSaver, SProcSimpleReq, /* GetScreenSaver, */ SProcChangeHosts, SProcSimpleReq, /* 110 ListHosts, */ SProcSimpleReq, /* SProcChangeAccessControl, */ SProcSimpleReq, /* SProcChangeCloseDownMode, */ SProcResourceReq, /* SProcKillClient, */ SProcRotateProperties, SProcSimpleReq, /* 115 ForceScreenSaver */ SProcSimpleReq, /* SetPointerMapping, */ SProcSimpleReq, /* GetPointerMapping, */ SProcSimpleReq, /* SetModifierMapping, */ SProcSimpleReq, /* GetModifierMapping, */ 0, /* 120 */ 0, 0, 0, 0, 0, /* 125 */ 0, SProcNoOperation }; EventSwapPtr EventSwapVector[128] = { (EventSwapPtr)SErrorEvent, NotImplemented, SKeyButtonPtrEvent, SKeyButtonPtrEvent, SKeyButtonPtrEvent, SKeyButtonPtrEvent, /* 5 */ SKeyButtonPtrEvent, SEnterLeaveEvent, SEnterLeaveEvent, SFocusEvent, SFocusEvent, /* 10 */ SKeymapNotifyEvent, SExposeEvent, SGraphicsExposureEvent, SNoExposureEvent, SVisibilityEvent, /* 15 */ SCreateNotifyEvent, SDestroyNotifyEvent, SUnmapNotifyEvent, SMapNotifyEvent, SMapRequestEvent, /* 20 */ SReparentEvent, SConfigureNotifyEvent, SConfigureRequestEvent, SGravityEvent, SResizeRequestEvent, /* 25 */ SCirculateEvent, SCirculateEvent, SPropertyEvent, SSelectionClearEvent, SSelectionRequestEvent, /* 30 */ SSelectionNotifyEvent, SColormapEvent, SClientMessageEvent, SMappingEvent, }; ReplySwapPtr ReplySwapVector[256] = { ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr)SGetWindowAttributesReply, ReplyNotSwappd, ReplyNotSwappd, /* 5 */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 10 */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr)SGetGeometryReply, (ReplySwapPtr)SQueryTreeReply, /* 15 */ (ReplySwapPtr)SInternAtomReply, (ReplySwapPtr)SGetAtomNameReply, ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr)SGetPropertyReply, /* 20 */ (ReplySwapPtr)SListPropertiesReply, ReplyNotSwappd, (ReplySwapPtr)SGetSelectionOwnerReply, ReplyNotSwappd, ReplyNotSwappd, /* 25 */ (ReplySwapPtr)SGenericReply, /* SGrabPointerReply, */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 30 */ (ReplySwapPtr)SGenericReply, /* SGrabKeyboardReply, */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 35 */ ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr)SQueryPointerReply, (ReplySwapPtr)SGetMotionEventsReply, (ReplySwapPtr)STranslateCoordsReply, /* 40 */ ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr)SGetInputFocusReply, (ReplySwapPtr)SQueryKeymapReply, ReplyNotSwappd, /* 45 */ ReplyNotSwappd, (ReplySwapPtr)SQueryFontReply, (ReplySwapPtr)SQueryTextExtentsReply, (ReplySwapPtr)SListFontsReply, (ReplySwapPtr)SListFontsWithInfoReply, /* 50 */ ReplyNotSwappd, (ReplySwapPtr)SGetFontPathReply, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 55 */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 60 */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 65 */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 70 */ ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr)SGetImageReply, ReplyNotSwappd, ReplyNotSwappd, /* 75 */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 80 */ ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr)SListInstalledColormapsReply, (ReplySwapPtr)SAllocColorReply, (ReplySwapPtr)SAllocNamedColorReply, /* 85 */ (ReplySwapPtr)SAllocColorCellsReply, (ReplySwapPtr)SAllocColorPlanesReply, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 90 */ (ReplySwapPtr)SQueryColorsReply, (ReplySwapPtr)SLookupColorReply, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 95 */ ReplyNotSwappd, (ReplySwapPtr)SQueryBestSizeReply, (ReplySwapPtr)SGenericReply, /* SQueryExtensionReply, */ (ReplySwapPtr)SListExtensionsReply, ReplyNotSwappd, /* 100 */ (ReplySwapPtr)SGetKeyboardMappingReply, ReplyNotSwappd, (ReplySwapPtr)SGetKeyboardControlReply, ReplyNotSwappd, ReplyNotSwappd, /* 105 */ (ReplySwapPtr)SGetPointerControlReply, ReplyNotSwappd, (ReplySwapPtr)SGetScreenSaverReply, ReplyNotSwappd, (ReplySwapPtr)SListHostsReply, /* 110 */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 115 */ (ReplySwapPtr)SGenericReply, /* SetPointerMapping */ (ReplySwapPtr)SGetPointerMappingReply, (ReplySwapPtr)SGenericReply, /* SetModifierMapping */ (ReplySwapPtr)SGetModifierMappingReply, /* 119 */ ReplyNotSwappd, /* 120 */ ReplyNotSwappd, /* 121 */ ReplyNotSwappd, /* 122 */ ReplyNotSwappd, /* 123 */ ReplyNotSwappd, /* 124 */ ReplyNotSwappd, /* 125 */ ReplyNotSwappd, /* 126 */ ReplyNotSwappd, /* NoOperation */ ReplyNotSwappd }; nx-libs-3.5.99.23/nx-X11/programs/Xserver/dix/window.c0000644000000000000000000030324113614532331017035 0ustar /* Copyright (c) 2006, Red Hat, Inc. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL RED HAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Red Hat shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Red Hat. Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* The panoramix components contained the following notice */ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "misc.h" #include "scrnintstr.h" #include "os.h" #include "regionstr.h" #include "validate.h" #include "windowstr.h" #include "input.h" #include "resource.h" #include "colormapst.h" #include "cursorstr.h" #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #endif #include "dixevents.h" #include "globals.h" #ifdef XCSECURITY #define _SECURITY_SERVER #include #endif /****** * Window stuff for server * * CreateRootWindow, CreateWindow, ChangeWindowAttributes, * GetWindowAttributes, DeleteWindow, DestroySubWindows, * HandleSaveSet, ReparentWindow, MapWindow, MapSubWindows, * UnmapWindow, UnmapSubWindows, ConfigureWindow, CirculateWindow, * ******/ static unsigned char _back_lsb[4] = {0x88, 0x22, 0x44, 0x11}; static unsigned char _back_msb[4] = {0x11, 0x44, 0x22, 0x88}; int screenIsSaved = SCREEN_SAVER_OFF; ScreenSaverStuffRec savedScreenInfo[MAXSCREENS]; #if 0 extern void DeleteWindowFromAnyEvents(); extern Mask EventMaskForClient(); extern void WindowHasNewCursor(); extern void RecalculateDeliverableEvents(); #endif static Bool TileScreenSaver(int i, int kind); #define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \ CWDontPropagate | CWOverrideRedirect | CWCursor ) #define BOXES_OVERLAP(b1, b2) \ (!( ((b1)->x2 <= (b2)->x1) || \ ( ((b1)->x1 >= (b2)->x2)) || \ ( ((b1)->y2 <= (b2)->y1)) || \ ( ((b1)->y1 >= (b2)->y2)) ) ) #define RedirectSend(pWin) \ ((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureRedirectMask) #define SubSend(pWin) \ ((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureNotifyMask) #define StrSend(pWin) \ ((pWin->eventMask|wOtherEventMasks(pWin)) & StructureNotifyMask) #define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent)) int numSaveUndersViewable = 0; int deltaSaveUndersViewable = 0; #if defined(DEBUG) || (defined(NXAGENT_SERVER) && defined(WINDOW_TREE_DEBUG)) /****** * PrintWindowTree * For debugging only ******/ int PrintChildren(WindowPtr p1, int indent) { WindowPtr p2; int i; while (p1) { p2 = p1->firstChild; for (i=0; idrawable.id); RegionPrint(&p1->clipList); PrintChildren(p2, indent+4); p1 = p1->nextSib; } } PrintWindowTree() { int i; WindowPtr pWin, p1; for (i=0; iroot; RegionPrint(&pWin->clipList); p1 = pWin->firstChild; PrintChildren(p1, 4); } } #endif int TraverseTree(register WindowPtr pWin, VisitWindowProcPtr func, void * data) { register int result; register WindowPtr pChild; if (!(pChild = pWin)) return(WT_NOMATCH); while (1) { result = (* func)(pChild, data); if (result == WT_STOPWALKING) return(WT_STOPWALKING); if ((result == WT_WALKCHILDREN) && pChild->firstChild) { pChild = pChild->firstChild; continue; } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } return(WT_NOMATCH); } /***** * WalkTree * Walk the window tree, for SCREEN, preforming FUNC(pWin, data) on * each window. If FUNC returns WT_WALKCHILDREN, traverse the children, * if it returns WT_DONTWALKCHILDREN, dont. If it returns WT_STOPWALKING * exit WalkTree. Does depth-first traverse. *****/ int WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, void * data) { return(TraverseTree(pScreen->root, func, data)); } /* hack for forcing backing store on all windows */ int defaultBackingStore = NotUseful; /* hack to force no backing store */ Bool disableBackingStore = FALSE; Bool enableBackingStore = FALSE; /* hack to force no save unders */ Bool disableSaveUnders = FALSE; static void SetWindowToDefaults(register WindowPtr pWin) { pWin->prevSib = NullWindow; pWin->firstChild = NullWindow; pWin->lastChild = NullWindow; pWin->valdata = (ValidatePtr)NULL; pWin->optional = (WindowOptPtr)NULL; pWin->cursorIsNone = TRUE; pWin->backingStore = NotUseful; pWin->DIXsaveUnder = FALSE; pWin->backStorage = (void *) NULL; pWin->mapped = FALSE; /* off */ pWin->realized = FALSE; /* off */ pWin->viewable = FALSE; pWin->visibility = VisibilityNotViewable; pWin->overrideRedirect = FALSE; pWin->saveUnder = FALSE; pWin->bitGravity = ForgetGravity; pWin->winGravity = NorthWestGravity; pWin->eventMask = 0; pWin->deliverableEvents = 0; pWin->dontPropagate = 0; pWin->forcedBS = FALSE; #ifdef NEED_DBE_BUF_BITS pWin->srcBuffer = DBE_FRONT_BUFFER; pWin->dstBuffer = DBE_FRONT_BUFFER; #endif #ifdef COMPOSITE pWin->redirectDraw = 0; #endif } static void MakeRootTile(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; GCPtr pGC; unsigned char back[128]; int len = BitmapBytePad(sizeof(long)); register unsigned char *from, *to; register int i, j; pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4, pScreen->rootDepth, 0); pWin->backgroundState = BackgroundPixmap; pGC = GetScratchGC(pScreen->rootDepth, pScreen); if (!pWin->background.pixmap || !pGC) FatalError("could not create root tile"); { CARD32 attributes[2]; attributes[0] = pScreen->whitePixel; attributes[1] = pScreen->blackPixel; (void)ChangeGC(pGC, GCForeground | GCBackground, attributes); } ValidateGC((DrawablePtr)pWin->background.pixmap, pGC); from = (screenInfo.bitmapBitOrder == LSBFirst) ? _back_lsb : _back_msb; to = back; for (i = 4; i > 0; i--, from++) for (j = len; j > 0; j--) *to++ = *from; (*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap, pGC, 1, 0, 0, len, 4, 0, XYBitmap, (char *)back); FreeScratchGC(pGC); } WindowPtr AllocateWindow(ScreenPtr pScreen) { WindowPtr pWin; register char *ptr; register DevUnion *ppriv; register unsigned *sizes; register unsigned size; register int i; pWin = (WindowPtr)malloc(pScreen->totalWindowSize); if (pWin) { ppriv = (DevUnion *)(pWin + 1); pWin->devPrivates = ppriv; sizes = pScreen->WindowPrivateSizes; ptr = (char *)(ppriv + pScreen->WindowPrivateLen); for (i = pScreen->WindowPrivateLen; --i >= 0; ppriv++, sizes++) { if ( (size = *sizes) ) { ppriv->ptr = (void *)ptr; ptr += size; } else ppriv->ptr = (void *)NULL; } #if _XSERVER64 pWin->drawable.pad0 = 0; pWin->drawable.pad1 = 0; #endif } return pWin; } /***** * CreateRootWindow * Makes a window at initialization time for specified screen *****/ Bool CreateRootWindow(ScreenPtr pScreen) { WindowPtr pWin; BoxRec box; PixmapFormatRec *format; pWin = AllocateWindow(pScreen); if (!pWin) return FALSE; savedScreenInfo[pScreen->myNum].pWindow = NULL; savedScreenInfo[pScreen->myNum].wid = FakeClientID(0); savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL; screenIsSaved = SCREEN_SAVER_OFF; pScreen->root = pWin; pWin->drawable.pScreen = pScreen; pWin->drawable.type = DRAWABLE_WINDOW; pWin->drawable.depth = pScreen->rootDepth; for (format = screenInfo.formats; format->depth != pScreen->rootDepth; format++) ; pWin->drawable.bitsPerPixel = format->bitsPerPixel; pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; pWin->parent = NullWindow; SetWindowToDefaults(pWin); pWin->optional = (WindowOptRec *) malloc (sizeof (WindowOptRec)); if (!pWin->optional) return FALSE; pWin->optional->dontPropagateMask = 0; pWin->optional->otherEventMasks = 0; pWin->optional->otherClients = NULL; pWin->optional->passiveGrabs = NULL; pWin->optional->userProps = NULL; pWin->optional->backingBitPlanes = ~0L; pWin->optional->backingPixel = 0; #ifdef SHAPE pWin->optional->boundingShape = NULL; pWin->optional->clipShape = NULL; pWin->optional->inputShape = NULL; #endif #ifdef XINPUT pWin->optional->inputMasks = NULL; #endif pWin->optional->colormap = pScreen->defColormap; pWin->optional->visual = pScreen->rootVisual; pWin->nextSib = NullWindow; pWin->drawable.id = FakeClientID(0); pWin->origin.x = pWin->origin.y = 0; pWin->drawable.height = pScreen->height; pWin->drawable.width = pScreen->width; pWin->drawable.x = pWin->drawable.y = 0; box.x1 = 0; box.y1 = 0; box.x2 = pScreen->width; box.y2 = pScreen->height; RegionInit(&pWin->clipList, &box, 1); RegionInit(&pWin->winSize, &box, 1); RegionInit(&pWin->borderSize, &box, 1); RegionInit(&pWin->borderClip, &box, 1); pWin->drawable.class = InputOutput; pWin->optional->visual = pScreen->rootVisual; pWin->backgroundState = BackgroundPixel; pWin->background.pixel = pScreen->whitePixel; pWin->borderIsPixel = TRUE; pWin->border.pixel = pScreen->blackPixel; pWin->borderWidth = 0; if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *)pWin)) return FALSE; if (disableBackingStore) pScreen->backingStoreSupport = NotUseful; if (enableBackingStore) pScreen->backingStoreSupport = Always; #ifdef DO_SAVE_UNDERS if ((pScreen->backingStoreSupport != NotUseful) && (pScreen->saveUnderSupport == NotUseful)) { /* * If the screen has backing-store but no save-unders, let the * clients know we can support save-unders using backing-store. */ pScreen->saveUnderSupport = USE_DIX_SAVE_UNDERS; } #endif /* DO_SAVE_UNDERS */ if (disableSaveUnders) pScreen->saveUnderSupport = NotUseful; return TRUE; } void #ifdef NXAGENT_SERVER xorg_InitRootWindow(WindowPtr pWin) #else InitRootWindow(WindowPtr pWin) #endif { ScreenPtr pScreen = pWin->drawable.pScreen; int backFlag = CWBorderPixel | CWCursor | CWBackingStore; if (!(*pScreen->CreateWindow)(pWin)) return; /* XXX */ (*pScreen->PositionWindow)(pWin, 0, 0); pWin->cursorIsNone = FALSE; pWin->optional->cursor = rootCursor; rootCursor->refcnt++; if (!blackRoot && !whiteRoot) { MakeRootTile(pWin); backFlag |= CWBackPixmap; } else { if (blackRoot) pWin->background.pixel = pScreen->blackPixel; else pWin->background.pixel = pScreen->whitePixel; backFlag |= CWBackPixel; } pWin->backingStore = defaultBackingStore; pWin->forcedBS = (defaultBackingStore != NotUseful); /* We SHOULD check for an error value here XXX */ (*pScreen->ChangeWindowAttributes)(pWin, backFlag); MapWindow(pWin, serverClient); } /* Set the region to the intersection of the rectangle and the * window's winSize. The window is typically the parent of the * window from which the region came. */ void ClippedRegionFromBox(register WindowPtr pWin, RegionPtr Rgn, register int x, register int y, register int w, register int h) { BoxRec box; box = *(RegionExtents(&pWin->winSize)); /* we do these calculations to avoid overflows */ if (x > box.x1) box.x1 = x; if (y > box.y1) box.y1 = y; x += w; if (x < box.x2) box.x2 = x; y += h; if (y < box.y2) box.y2 = y; if (box.x1 > box.x2) box.x2 = box.x1; if (box.y1 > box.y2) box.y2 = box.y1; RegionReset(Rgn, &box); RegionIntersect(Rgn, Rgn, &pWin->winSize); } static RealChildHeadProc realChildHeadProc = NULL; void RegisterRealChildHeadProc (RealChildHeadProc proc) { realChildHeadProc = proc; } WindowPtr RealChildHead(register WindowPtr pWin) { if (realChildHeadProc) { return realChildHeadProc (pWin); } if (!pWin->parent && (screenIsSaved == SCREEN_SAVER_ON) && (HasSaverWindow (pWin->drawable.pScreen->myNum))) return (pWin->firstChild); else return (NullWindow); } /***** * CreateWindow * Makes a window in response to client request *****/ WindowPtr CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w, unsigned h, unsigned bw, unsigned class, register Mask vmask, XID *vlist, int depth, ClientPtr client, VisualID visual, int *error) { register WindowPtr pWin; WindowPtr pHead; register ScreenPtr pScreen; xEvent event; int idepth, ivisual; Bool fOK; DepthPtr pDepth; PixmapFormatRec *format; register WindowOptPtr ancwopt; if (class == CopyFromParent) class = pParent->drawable.class; if ((class != InputOutput) && (class != InputOnly)) { *error = BadValue; client->errorValue = class; return NullWindow; } if ((class != InputOnly) && (pParent->drawable.class == InputOnly)) { *error = BadMatch; return NullWindow; } if ((class == InputOnly) && ((bw != 0) || (depth != 0))) { *error = BadMatch; return NullWindow; } pScreen = pParent->drawable.pScreen; if ((class == InputOutput) && (depth == 0)) depth = pParent->drawable.depth; ancwopt = pParent->optional; if (!ancwopt) ancwopt = FindWindowWithOptional(pParent)->optional; if (visual == CopyFromParent) { visual = ancwopt->visual; } /* Find out if the depth and visual are acceptable for this Screen */ if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth)) { fOK = FALSE; for(idepth = 0; idepth < pScreen->numDepths; idepth++) { pDepth = (DepthPtr) &pScreen->allowedDepths[idepth]; if ((depth == pDepth->depth) || (depth == 0)) { for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) { if (visual == pDepth->vids[ivisual]) { fOK = TRUE; break; } } } } if (fOK == FALSE) { *error = BadMatch; return NullWindow; } } if (((vmask & (CWBorderPixmap | CWBorderPixel)) == 0) && (class != InputOnly) && (depth != pParent->drawable.depth)) { *error = BadMatch; return NullWindow; } if (((vmask & CWColormap) == 0) && (class != InputOnly) && ((visual != ancwopt->visual) || (ancwopt->colormap == None))) { *error = BadMatch; return NullWindow; } pWin = AllocateWindow(pScreen); if (!pWin) { *error = BadAlloc; return NullWindow; } pWin->drawable = pParent->drawable; pWin->drawable.depth = depth; if (depth == pParent->drawable.depth) pWin->drawable.bitsPerPixel = pParent->drawable.bitsPerPixel; else { for (format = screenInfo.formats; format->depth != depth; format++) ; pWin->drawable.bitsPerPixel = format->bitsPerPixel; } if (class == InputOnly) pWin->drawable.type = (short) UNDRAWABLE_WINDOW; pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; pWin->drawable.id = wid; pWin->drawable.class = class; pWin->parent = pParent; SetWindowToDefaults(pWin); if (visual != ancwopt->visual) { if (!MakeWindowOptional (pWin)) { free (pWin); *error = BadAlloc; return NullWindow; } pWin->optional->visual = visual; pWin->optional->colormap = None; } pWin->borderWidth = bw; #ifdef XCSECURITY /* can't let untrusted clients have background None windows; * they make it too easy to steal window contents */ if (client->trustLevel != XSecurityClientTrusted) { pWin->backgroundState = BackgroundPixel; pWin->background.pixel = 0; } else #endif pWin->backgroundState = None; pWin->borderIsPixel = pParent->borderIsPixel; pWin->border = pParent->border; if (pWin->borderIsPixel == FALSE) pWin->border.pixmap->refcnt++; pWin->origin.x = x + (int)bw; pWin->origin.y = y + (int)bw; pWin->drawable.width = w; pWin->drawable.height = h; pWin->drawable.x = pParent->drawable.x + x + (int)bw; pWin->drawable.y = pParent->drawable.y + y + (int)bw; /* set up clip list correctly for unobscured WindowPtr */ RegionNull(&pWin->clipList); RegionNull(&pWin->borderClip); RegionNull(&pWin->winSize); RegionNull(&pWin->borderSize); pHead = RealChildHead(pParent); if (pHead) { pWin->nextSib = pHead->nextSib; if (pHead->nextSib) pHead->nextSib->prevSib = pWin; else pParent->lastChild = pWin; pHead->nextSib = pWin; pWin->prevSib = pHead; } else { pWin->nextSib = pParent->firstChild; if (pParent->firstChild) pParent->firstChild->prevSib = pWin; else pParent->lastChild = pWin; pParent->firstChild = pWin; } SetWinSize (pWin); SetBorderSize (pWin); /* We SHOULD check for an error value here XXX */ if (!(*pScreen->CreateWindow)(pWin)) { *error = BadAlloc; DeleteWindow(pWin, None); return NullWindow; } /* We SHOULD check for an error value here XXX */ (*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y); if (!(vmask & CWEventMask)) RecalculateDeliverableEvents(pWin); if (vmask) *error = ChangeWindowAttributes(pWin, vmask, vlist, wClient (pWin)); else *error = Success; if (*error != Success) { DeleteWindow(pWin, None); return NullWindow; } if (!(vmask & CWBackingStore) && (defaultBackingStore != NotUseful)) { XID value = defaultBackingStore; (void)ChangeWindowAttributes(pWin, CWBackingStore, &value, wClient (pWin)); pWin->forcedBS = TRUE; } if (SubSend(pParent)) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = CreateNotify; event.u.createNotify.window = wid; event.u.createNotify.parent = pParent->drawable.id; event.u.createNotify.x = x; event.u.createNotify.y = y; event.u.createNotify.width = w; event.u.createNotify.height = h; event.u.createNotify.borderWidth = bw; event.u.createNotify.override = pWin->overrideRedirect; DeliverEvents(pParent, &event, 1, NullWindow); } return pWin; } static void FreeWindowResources(register WindowPtr pWin) { register ScreenPtr pScreen = pWin->drawable.pScreen; DeleteWindowFromAnySaveSet(pWin); DeleteWindowFromAnySelections(pWin); DeleteWindowFromAnyEvents(pWin, TRUE); RegionUninit(&pWin->clipList); RegionUninit(&pWin->winSize); RegionUninit(&pWin->borderClip); RegionUninit(&pWin->borderSize); #ifdef SHAPE if (wBoundingShape (pWin)) RegionDestroy(wBoundingShape (pWin)); if (wClipShape (pWin)) RegionDestroy(wClipShape (pWin)); if (wInputShape (pWin)) RegionDestroy(wInputShape (pWin)); #endif if (pWin->borderIsPixel == FALSE) (*pScreen->DestroyPixmap)(pWin->border.pixmap); if (pWin->backgroundState == BackgroundPixmap) (*pScreen->DestroyPixmap)(pWin->background.pixmap); DeleteAllWindowProperties(pWin); /* We SHOULD check for an error value here XXX */ (*pScreen->DestroyWindow)(pWin); DisposeWindowOptional (pWin); } static void CrushTree(WindowPtr pWin) { register WindowPtr pChild, pSib, pParent; UnrealizeWindowProcPtr UnrealizeWindow; xEvent event; if (!(pChild = pWin->firstChild)) return; UnrealizeWindow = pWin->drawable.pScreen->UnrealizeWindow; while (1) { if (pChild->firstChild) { pChild = pChild->firstChild; continue; } while (1) { pParent = pChild->parent; if (SubStrSend(pChild, pParent)) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = DestroyNotify; event.u.destroyNotify.window = pChild->drawable.id; DeliverEvents(pChild, &event, 1, NullWindow); } FreeResource(pChild->drawable.id, RT_WINDOW); pSib = pChild->nextSib; #ifdef DO_SAVE_UNDERS if (pChild->saveUnder && pChild->viewable) deltaSaveUndersViewable--; #endif pChild->viewable = FALSE; if (pChild->realized) { pChild->realized = FALSE; (*UnrealizeWindow)(pChild); } FreeWindowResources(pChild); free(pChild); if ( (pChild = pSib) ) break; pChild = pParent; pChild->firstChild = NullWindow; pChild->lastChild = NullWindow; if (pChild == pWin) return; } } } /***** * DeleteWindow * Deletes child of window then window itself * If wid is None, don't send any events *****/ int DeleteWindow(void * value, XID wid) { register WindowPtr pParent; register WindowPtr pWin = (WindowPtr)value; xEvent event; UnmapWindow(pWin, FALSE); CrushTree(pWin); pParent = pWin->parent; if (wid && pParent && SubStrSend(pWin, pParent)) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = DestroyNotify; event.u.destroyNotify.window = pWin->drawable.id; DeliverEvents(pWin, &event, 1, NullWindow); } FreeWindowResources(pWin); if (pParent) { if (pParent->firstChild == pWin) pParent->firstChild = pWin->nextSib; if (pParent->lastChild == pWin) pParent->lastChild = pWin->prevSib; if (pWin->nextSib) pWin->nextSib->prevSib = pWin->prevSib; if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; } free(pWin); return Success; } void DestroySubwindows(register WindowPtr pWin, ClientPtr client) { /* XXX * The protocol is quite clear that each window should be * destroyed in turn, however, unmapping all of the first * eliminates most of the calls to ValidateTree. So, * this implementation is incorrect in that all of the * UnmapNotifies occur before all of the DestroyNotifies. * If you care, simply delete the call to UnmapSubwindows. */ UnmapSubwindows(pWin); while (pWin->lastChild) FreeResource(pWin->lastChild->drawable.id, RT_NONE); } #define DeviceEventMasks (KeyPressMask | KeyReleaseMask | ButtonPressMask | \ ButtonReleaseMask | PointerMotionMask) /***** * ChangeWindowAttributes * * The value-mask specifies which attributes are to be changed; the * value-list contains one value for each one bit in the mask, from least * to most significant bit in the mask. *****/ int ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) { register Mask index2; register XID *pVlist; PixmapPtr pPixmap; Pixmap pixID; CursorPtr pCursor, pOldCursor; Cursor cursorID; WindowPtr pChild; Colormap cmap; ColormapPtr pCmap; xEvent xE; int result; register ScreenPtr pScreen; Mask vmaskCopy = 0; register Mask tmask; unsigned int val; int error; Bool checkOptional = FALSE; Bool borderRelative = FALSE; WindowPtr pLayerWin; if ((pWin->drawable.class == InputOnly) && (vmask & (~INPUTONLY_LEGAL_MASK))) return BadMatch; error = Success; pScreen = pWin->drawable.pScreen; pVlist = vlist; tmask = vmask; while (tmask) { index2 = (Mask) lowbit (tmask); tmask &= ~index2; switch (index2) { case CWBackPixmap: pixID = (Pixmap )*pVlist; pVlist++; if (pWin->backgroundState == ParentRelative) borderRelative = TRUE; if (pixID == None) { #ifdef XCSECURITY /* can't let untrusted clients have background None windows */ if (client->trustLevel == XSecurityClientTrusted) { #endif if (pWin->backgroundState == BackgroundPixmap) (*pScreen->DestroyPixmap)(pWin->background.pixmap); if (!pWin->parent) MakeRootTile(pWin); else pWin->backgroundState = None; #ifdef XCSECURITY } else { /* didn't change the background to None, so don't tell ddx */ index2 = 0; } #endif } else if (pixID == ParentRelative) { if (pWin->parent && pWin->drawable.depth != pWin->parent->drawable.depth) { error = BadMatch; goto PatchUp; } if (pWin->backgroundState == BackgroundPixmap) (*pScreen->DestroyPixmap)(pWin->background.pixmap); if (!pWin->parent) MakeRootTile(pWin); else pWin->backgroundState = ParentRelative; borderRelative = TRUE; /* Note that the parent's backgroundTile's refcnt is NOT * incremented. */ } else { pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID, RT_PIXMAP, DixReadAccess); if (pPixmap != (PixmapPtr) NULL) { if ((pPixmap->drawable.depth != pWin->drawable.depth) || (pPixmap->drawable.pScreen != pScreen)) { error = BadMatch; goto PatchUp; } if (pWin->backgroundState == BackgroundPixmap) (*pScreen->DestroyPixmap)(pWin->background.pixmap); pWin->backgroundState = BackgroundPixmap; pWin->background.pixmap = pPixmap; pPixmap->refcnt++; } else { error = BadPixmap; client->errorValue = pixID; goto PatchUp; } } break; case CWBackPixel: if (pWin->backgroundState == ParentRelative) borderRelative = TRUE; if (pWin->backgroundState == BackgroundPixmap) (*pScreen->DestroyPixmap)(pWin->background.pixmap); pWin->backgroundState = BackgroundPixel; pWin->background.pixel = (CARD32 ) *pVlist; /* background pixel overrides background pixmap, so don't let the ddx layer see both bits */ vmaskCopy &= ~CWBackPixmap; pVlist++; break; case CWBorderPixmap: pixID = (Pixmap ) *pVlist; pVlist++; if (pixID == CopyFromParent) { if (!pWin->parent || (pWin->drawable.depth != pWin->parent->drawable.depth)) { error = BadMatch; goto PatchUp; } if (pWin->borderIsPixel == FALSE) (*pScreen->DestroyPixmap)(pWin->border.pixmap); pWin->border = pWin->parent->border; if ((pWin->borderIsPixel = pWin->parent->borderIsPixel) == TRUE) { index2 = CWBorderPixel; } else { pWin->parent->border.pixmap->refcnt++; } } else { pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID, RT_PIXMAP, DixReadAccess); if (pPixmap) { if ((pPixmap->drawable.depth != pWin->drawable.depth) || (pPixmap->drawable.pScreen != pScreen)) { error = BadMatch; goto PatchUp; } if (pWin->borderIsPixel == FALSE) (*pScreen->DestroyPixmap)(pWin->border.pixmap); pWin->borderIsPixel = FALSE; pWin->border.pixmap = pPixmap; pPixmap->refcnt++; } else { error = BadPixmap; client->errorValue = pixID; goto PatchUp; } } break; case CWBorderPixel: if (pWin->borderIsPixel == FALSE) (*pScreen->DestroyPixmap)(pWin->border.pixmap); pWin->borderIsPixel = TRUE; pWin->border.pixel = (CARD32) *pVlist; /* border pixel overrides border pixmap, so don't let the ddx layer see both bits */ vmaskCopy &= ~CWBorderPixmap; pVlist++; break; case CWBitGravity: val = (CARD8 )*pVlist; pVlist++; if (val > StaticGravity) { error = BadValue; client->errorValue = val; goto PatchUp; } pWin->bitGravity = val; break; case CWWinGravity: val = (CARD8 )*pVlist; pVlist++; if (val > StaticGravity) { error = BadValue; client->errorValue = val; goto PatchUp; } pWin->winGravity = val; break; case CWBackingStore: val = (CARD8 )*pVlist; pVlist++; if ((val != NotUseful) && (val != WhenMapped) && (val != Always)) { error = BadValue; client->errorValue = val; goto PatchUp; } pWin->backingStore = val; pWin->forcedBS = FALSE; break; case CWBackingPlanes: if (pWin->optional || ((CARD32)*pVlist != (CARD32)~0L)) { if (!pWin->optional && !MakeWindowOptional (pWin)) { error = BadAlloc; goto PatchUp; } pWin->optional->backingBitPlanes = (CARD32) *pVlist; if ((CARD32)*pVlist == (CARD32)~0L) checkOptional = TRUE; } pVlist++; break; case CWBackingPixel: if (pWin->optional || (CARD32) *pVlist) { if (!pWin->optional && !MakeWindowOptional (pWin)) { error = BadAlloc; goto PatchUp; } pWin->optional->backingPixel = (CARD32) *pVlist; if (!*pVlist) checkOptional = TRUE; } pVlist++; break; case CWSaveUnder: val = (BOOL) *pVlist; pVlist++; if ((val != xTrue) && (val != xFalse)) { error = BadValue; client->errorValue = val; goto PatchUp; } #ifdef DO_SAVE_UNDERS if (pWin->parent && (pWin->saveUnder != val) && (pWin->viewable) && DO_SAVE_UNDERS(pWin)) { /* * Re-check all siblings and inferiors for obscurity or * exposition (hee hee). */ if (pWin->saveUnder) deltaSaveUndersViewable--; else deltaSaveUndersViewable++; pWin->saveUnder = val; if (pWin->firstChild) { pLayerWin = (*pScreen->GetLayerWindow)(pWin); if ((*pScreen->ChangeSaveUnder)(pLayerWin->parent, pWin->nextSib)) (*pScreen->PostChangeSaveUnder)(pLayerWin->parent, pWin->nextSib); } else { if ((*pScreen->ChangeSaveUnder)(pWin, pWin->nextSib)) (*pScreen->PostChangeSaveUnder)(pWin, pWin->nextSib); } } else { /* If we're changing the saveUnder attribute of the root * window, all we do is set pWin->saveUnder so that * GetWindowAttributes returns the right value. We don't * do the "normal" save-under processing (as above). * Hope that doesn't cause any problems. */ pWin->saveUnder = val; } #else pWin->saveUnder = val; #endif /* DO_SAVE_UNDERS */ break; case CWEventMask: /* * TODO: Some applications like java bean shell * don' t work if they cannot monitor the root * window for Structure Redirect events. However * this doesn't seem to be the best solution, since * also an X server with a window manager running, * doesn't allow to monitor for those events, but * the java bean shell works flawlessy on this * server. * * #ifdef NXAGENT_SERVER * if (nxagentCheckIllegalRootMonitoring(pWin, (Mask)*pVlist)) * { * return BadAccess; * } * #endif */ result = EventSelectForWindow(pWin, client, (Mask )*pVlist); if (result) { error = result; goto PatchUp; } pVlist++; break; case CWDontPropagate: result = EventSuppressForWindow(pWin, client, (Mask )*pVlist, &checkOptional); if (result) { error = result; goto PatchUp; } pVlist++; break; case CWOverrideRedirect: val = (BOOL ) *pVlist; pVlist++; if ((val != xTrue) && (val != xFalse)) { error = BadValue; client->errorValue = val; goto PatchUp; } pWin->overrideRedirect = val; break; case CWColormap: cmap = (Colormap) *pVlist; pVlist++; if (cmap == CopyFromParent) { if (pWin->parent && (!pWin->optional || pWin->optional->visual == wVisual (pWin->parent))) { cmap = wColormap (pWin->parent); } else cmap = None; } if (cmap == None) { error = BadMatch; goto PatchUp; } pCmap = (ColormapPtr)SecurityLookupIDByType(client, cmap, RT_COLORMAP, DixReadAccess); if (!pCmap) { error = BadColor; client->errorValue = cmap; goto PatchUp; } if (pCmap->pVisual->vid != wVisual (pWin) || pCmap->pScreen != pScreen) { error = BadMatch; goto PatchUp; } if (cmap != wColormap (pWin)) { if (!pWin->optional) { if (!MakeWindowOptional (pWin)) { error = BadAlloc; goto PatchUp; } } else if (pWin->parent && cmap == wColormap (pWin->parent)) checkOptional = TRUE; /* * propagate the original colormap to any children * inheriting it */ for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib) { if (!pChild->optional && !MakeWindowOptional (pChild)) { error = BadAlloc; goto PatchUp; } } pWin->optional->colormap = cmap; /* * check on any children now matching the new colormap */ for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib) { if (pChild->optional->colormap == cmap) CheckWindowOptionalNeed (pChild); } xE.u.u.type = ColormapNotify; xE.u.colormap.window = pWin->drawable.id; xE.u.colormap.colormap = cmap; xE.u.colormap.new = xTrue; xE.u.colormap.state = IsMapInstalled(cmap, pWin); DeliverEvents(pWin, &xE, 1, NullWindow); } break; case CWCursor: cursorID = (Cursor ) *pVlist; pVlist++; /* * install the new */ if ( cursorID == None) { if (pWin == pWin->drawable.pScreen->root) pCursor = rootCursor; else pCursor = (CursorPtr) None; } else { pCursor = (CursorPtr)SecurityLookupIDByType(client, cursorID, RT_CURSOR, DixReadAccess); if (!pCursor) { error = BadCursor; client->errorValue = cursorID; goto PatchUp; } } if (pCursor != wCursor (pWin)) { /* * patch up child windows so they don't lose cursors. */ for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib) { if (!pChild->optional && !pChild->cursorIsNone && !MakeWindowOptional (pChild)) { error = BadAlloc; goto PatchUp; } } pOldCursor = 0; if (pCursor == (CursorPtr) None) { pWin->cursorIsNone = TRUE; if (pWin->optional) { pOldCursor = pWin->optional->cursor; pWin->optional->cursor = (CursorPtr) None; checkOptional = TRUE; } } else { if (!pWin->optional) { if (!MakeWindowOptional (pWin)) { error = BadAlloc; goto PatchUp; } } else if (pWin->parent && pCursor == wCursor (pWin->parent)) checkOptional = TRUE; pOldCursor = pWin->optional->cursor; pWin->optional->cursor = pCursor; pCursor->refcnt++; pWin->cursorIsNone = FALSE; /* * check on any children now matching the new cursor */ for (pChild=pWin->firstChild; pChild; pChild=pChild->nextSib) { if (pChild->optional && (pChild->optional->cursor == pCursor)) CheckWindowOptionalNeed (pChild); } } if (pWin->realized) WindowHasNewCursor( pWin); /* Can't free cursor until here - old cursor * is needed in WindowHasNewCursor */ if (pOldCursor) FreeCursor (pOldCursor, (Cursor)0); } break; default: error = BadValue; client->errorValue = vmask; goto PatchUp; } vmaskCopy |= index2; } PatchUp: if (checkOptional) CheckWindowOptionalNeed (pWin); /* We SHOULD check for an error value here XXX */ (*pScreen->ChangeWindowAttributes)(pWin, vmaskCopy); /* If the border contents have changed, redraw the border. Note that this has to be done AFTER pScreen->ChangeWindowAttributes for the tile to be rotated, and the correct function selected. */ if (((vmaskCopy & (CWBorderPixel | CWBorderPixmap)) || borderRelative) && pWin->viewable && HasBorder (pWin)) { RegionRec exposed; RegionNull(&exposed); RegionSubtract(&exposed, &pWin->borderClip, &pWin->winSize); (*pWin->drawable.pScreen->PaintWindowBorder)(pWin, &exposed, PW_BORDER); RegionUninit(&exposed); } return error; } /***** * GetWindowAttributes * Notice that this is different than ChangeWindowAttributes *****/ void GetWindowAttributes(register WindowPtr pWin, ClientPtr client, xGetWindowAttributesReply *wa) { wa->type = X_Reply; wa->bitGravity = pWin->bitGravity; wa->winGravity = pWin->winGravity; if (pWin->forcedBS && pWin->backingStore != Always) wa->backingStore = NotUseful; else wa->backingStore = pWin->backingStore; wa->length = (sizeof(xGetWindowAttributesReply) - sizeof(xGenericReply)) >> 2; wa->sequenceNumber = client->sequence; wa->backingBitPlanes = wBackingBitPlanes (pWin); wa->backingPixel = wBackingPixel (pWin); wa->saveUnder = (BOOL)pWin->saveUnder; wa->override = pWin->overrideRedirect; if (!pWin->mapped) wa->mapState = IsUnmapped; else if (pWin->realized) wa->mapState = IsViewable; else wa->mapState = IsUnviewable; wa->colormap = wColormap (pWin); wa->mapInstalled = (wa->colormap == None) ? xFalse : IsMapInstalled(wa->colormap, pWin); wa->yourEventMask = EventMaskForClient(pWin, client); wa->allEventMasks = pWin->eventMask | wOtherEventMasks (pWin); wa->doNotPropagateMask = wDontPropagateMask (pWin); wa->class = pWin->drawable.class; wa->visualID = wVisual (pWin); } WindowPtr MoveWindowInStack(register WindowPtr pWin, register WindowPtr pNextSib) { register WindowPtr pParent = pWin->parent; WindowPtr pFirstChange = pWin; /* highest window where list changes */ if (pWin->nextSib != pNextSib) { WindowPtr pOldNextSib = pWin->nextSib; if (!pNextSib) /* move to bottom */ { if (pParent->firstChild == pWin) pParent->firstChild = pWin->nextSib; /* if (pWin->nextSib) */ /* is always True: pNextSib == NULL * and pWin->nextSib != pNextSib * therefore pWin->nextSib != NULL */ pFirstChange = pWin->nextSib; pWin->nextSib->prevSib = pWin->prevSib; if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; pParent->lastChild->nextSib = pWin; pWin->prevSib = pParent->lastChild; pWin->nextSib = NullWindow; pParent->lastChild = pWin; } else if (pParent->firstChild == pNextSib) /* move to top */ { pFirstChange = pWin; if (pParent->lastChild == pWin) pParent->lastChild = pWin->prevSib; if (pWin->nextSib) pWin->nextSib->prevSib = pWin->prevSib; if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; pWin->nextSib = pParent->firstChild; pWin->prevSib = (WindowPtr ) NULL; pNextSib->prevSib = pWin; pParent->firstChild = pWin; } else /* move in middle of list */ { WindowPtr pOldNext = pWin->nextSib; pFirstChange = NullWindow; if (pParent->firstChild == pWin) pFirstChange = pParent->firstChild = pWin->nextSib; if (pParent->lastChild == pWin) { pFirstChange = pWin; pParent->lastChild = pWin->prevSib; } if (pWin->nextSib) pWin->nextSib->prevSib = pWin->prevSib; if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; pWin->nextSib = pNextSib; pWin->prevSib = pNextSib->prevSib; if (pNextSib->prevSib) pNextSib->prevSib->nextSib = pWin; pNextSib->prevSib = pWin; if (!pFirstChange) { /* do we know it yet? */ pFirstChange = pParent->firstChild; /* no, search from top */ while ((pFirstChange != pWin) && (pFirstChange != pOldNext)) pFirstChange = pFirstChange->nextSib; } } if(pWin->drawable.pScreen->RestackWindow) (*pWin->drawable.pScreen->RestackWindow)(pWin, pOldNextSib); } #ifdef ROOTLESS /* * In rootless mode we can't optimize away window restacks. * There may be non-X windows around, so even if the window * is in the correct position from X's point of view, * the underlying window system may want to reorder it. */ else if (pWin->drawable.pScreen->RestackWindow) (*pWin->drawable.pScreen->RestackWindow)(pWin, pWin->nextSib); #endif return( pFirstChange ); } RegionPtr CreateUnclippedWinSize (register WindowPtr pWin) { RegionPtr pRgn; BoxRec box; box.x1 = pWin->drawable.x; box.y1 = pWin->drawable.y; box.x2 = pWin->drawable.x + (int) pWin->drawable.width; box.y2 = pWin->drawable.y + (int) pWin->drawable.height; pRgn = RegionCreate(&box, 1); #ifdef SHAPE if (wBoundingShape (pWin) || wClipShape (pWin)) { RegionTranslate(pRgn, - pWin->drawable.x, - pWin->drawable.y); if (wBoundingShape (pWin)) RegionIntersect(pRgn, pRgn, wBoundingShape (pWin)); if (wClipShape (pWin)) RegionIntersect(pRgn, pRgn, wClipShape (pWin)); RegionTranslate(pRgn, pWin->drawable.x, pWin->drawable.y); } #endif return pRgn; } void SetWinSize (register WindowPtr pWin) { #ifdef COMPOSITE if (pWin->redirectDraw) { BoxRec box; box.x1 = pWin->drawable.x; box.y1 = pWin->drawable.y; box.x2 = pWin->drawable.x + pWin->drawable.width; box.y2 = pWin->drawable.y + pWin->drawable.height; RegionReset(&pWin->winSize, &box); } else #endif ClippedRegionFromBox(pWin->parent, &pWin->winSize, pWin->drawable.x, pWin->drawable.y, (int)pWin->drawable.width, (int)pWin->drawable.height); #ifdef SHAPE if (wBoundingShape (pWin) || wClipShape (pWin)) { RegionTranslate(&pWin->winSize, - pWin->drawable.x, - pWin->drawable.y); if (wBoundingShape (pWin)) RegionIntersect(&pWin->winSize, &pWin->winSize, wBoundingShape (pWin)); if (wClipShape (pWin)) RegionIntersect(&pWin->winSize, &pWin->winSize, wClipShape (pWin)); RegionTranslate(&pWin->winSize, pWin->drawable.x, pWin->drawable.y); } #endif } void SetBorderSize (register WindowPtr pWin) { int bw; if (HasBorder (pWin)) { bw = wBorderWidth (pWin); #ifdef COMPOSITE if (pWin->redirectDraw) { BoxRec box; box.x1 = pWin->drawable.x - bw; box.y1 = pWin->drawable.y - bw; box.x2 = pWin->drawable.x + pWin->drawable.width + bw; box.y2 = pWin->drawable.y + pWin->drawable.height + bw; RegionReset(&pWin->borderSize, &box); } else #endif ClippedRegionFromBox(pWin->parent, &pWin->borderSize, pWin->drawable.x - bw, pWin->drawable.y - bw, (int)(pWin->drawable.width + (bw<<1)), (int)(pWin->drawable.height + (bw<<1))); #ifdef SHAPE if (wBoundingShape (pWin)) { RegionTranslate(&pWin->borderSize, - pWin->drawable.x, - pWin->drawable.y); RegionIntersect(&pWin->borderSize, &pWin->borderSize, wBoundingShape (pWin)); RegionTranslate(&pWin->borderSize, pWin->drawable.x, pWin->drawable.y); RegionUnion(&pWin->borderSize, &pWin->borderSize, &pWin->winSize); } #endif } else { RegionCopy(&pWin->borderSize, &pWin->winSize); } } /** * * \param x,y new window position * \param oldx,oldy old window position * \param destx,desty position relative to gravity */ void GravityTranslate (register int x, register int y, int oldx, int oldy, int dw, int dh, unsigned gravity, register int *destx, register int *desty) { switch (gravity) { case NorthGravity: *destx = x + dw / 2; *desty = y; break; case NorthEastGravity: *destx = x + dw; *desty = y; break; case WestGravity: *destx = x; *desty = y + dh / 2; break; case CenterGravity: *destx = x + dw / 2; *desty = y + dh / 2; break; case EastGravity: *destx = x + dw; *desty = y + dh / 2; break; case SouthWestGravity: *destx = x; *desty = y + dh; break; case SouthGravity: *destx = x + dw / 2; *desty = y + dh; break; case SouthEastGravity: *destx = x + dw; *desty = y + dh; break; case StaticGravity: *destx = oldx; *desty = oldy; break; default: *destx = x; *desty = y; break; } } /* XXX need to retile border on each window with ParentRelative origin */ #ifndef NXAGENT_SERVER void ResizeChildrenWinSize(register WindowPtr pWin, int dx, int dy, int dw, int dh) { register ScreenPtr pScreen; register WindowPtr pSib, pChild; Bool resized = (dw || dh); pScreen = pWin->drawable.pScreen; for (pSib = pWin->firstChild; pSib; pSib = pSib->nextSib) { if (resized && (pSib->winGravity > NorthWestGravity)) { int cwsx, cwsy; cwsx = pSib->origin.x; cwsy = pSib->origin.y; GravityTranslate (cwsx, cwsy, cwsx - dx, cwsy - dy, dw, dh, pSib->winGravity, &cwsx, &cwsy); if (cwsx != pSib->origin.x || cwsy != pSib->origin.y) { xEvent event; event.u.u.type = GravityNotify; event.u.gravity.window = pSib->drawable.id; event.u.gravity.x = cwsx - wBorderWidth (pSib); event.u.gravity.y = cwsy - wBorderWidth (pSib); DeliverEvents (pSib, &event, 1, NullWindow); pSib->origin.x = cwsx; pSib->origin.y = cwsy; } } pSib->drawable.x = pWin->drawable.x + pSib->origin.x; pSib->drawable.y = pWin->drawable.y + pSib->origin.y; SetWinSize (pSib); SetBorderSize (pSib); (*pScreen->PositionWindow)(pSib, pSib->drawable.x, pSib->drawable.y); if ( (pChild = pSib->firstChild) ) { while (1) { pChild->drawable.x = pChild->parent->drawable.x + pChild->origin.x; pChild->drawable.y = pChild->parent->drawable.y + pChild->origin.y; SetWinSize (pChild); SetBorderSize (pChild); (*pScreen->PositionWindow)(pChild, pChild->drawable.x, pChild->drawable.y); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } while (!pChild->nextSib && (pChild != pSib)) pChild = pChild->parent; if (pChild == pSib) break; pChild = pChild->nextSib; } } } } #endif /* NXAGENT_SERVER */ #define GET_INT16(m, f) \ if (m & mask) \ { \ f = (INT16) *pVlist;\ pVlist++; \ } #define GET_CARD16(m, f) \ if (m & mask) \ { \ f = (CARD16) *pVlist;\ pVlist++;\ } #define GET_CARD8(m, f) \ if (m & mask) \ { \ f = (CARD8) *pVlist;\ pVlist++;\ } #define ChangeMask ((Mask)(CWX | CWY | CWWidth | CWHeight)) #define IllegalInputOnlyConfigureMask (CWBorderWidth) /* * IsSiblingAboveMe * returns Above if pSib above pMe in stack or Below otherwise */ static int IsSiblingAboveMe( register WindowPtr pMe, register WindowPtr pSib) { register WindowPtr pWin; pWin = pMe->parent->firstChild; while (pWin) { if (pWin == pSib) return(Above); else if (pWin == pMe) return(Below); pWin = pWin->nextSib; } return(Below); } static BoxPtr WindowExtents( register WindowPtr pWin, register BoxPtr pBox) { pBox->x1 = pWin->drawable.x - wBorderWidth (pWin); pBox->y1 = pWin->drawable.y - wBorderWidth (pWin); pBox->x2 = pWin->drawable.x + (int)pWin->drawable.width + wBorderWidth (pWin); pBox->y2 = pWin->drawable.y + (int)pWin->drawable.height + wBorderWidth (pWin); return(pBox); } #ifdef SHAPE #define IS_SHAPED(pWin) (wBoundingShape (pWin) != (RegionPtr) NULL) static RegionPtr MakeBoundingRegion ( register WindowPtr pWin, BoxPtr pBox) { RegionPtr pRgn; pRgn = RegionCreate(pBox, 1); if (wBoundingShape (pWin)) { RegionTranslate(pRgn, -pWin->origin.x, -pWin->origin.y); RegionIntersect(pRgn, pRgn, wBoundingShape (pWin)); RegionTranslate(pRgn, pWin->origin.x, pWin->origin.y); } return pRgn; } static Bool ShapeOverlap ( WindowPtr pWin, BoxPtr pWinBox, WindowPtr pSib, BoxPtr pSibBox) { RegionPtr pWinRgn, pSibRgn; Bool ret; if (!IS_SHAPED(pWin) && !IS_SHAPED(pSib)) return TRUE; pWinRgn = MakeBoundingRegion (pWin, pWinBox); pSibRgn = MakeBoundingRegion (pSib, pSibBox); RegionIntersect(pWinRgn, pWinRgn, pSibRgn); ret = RegionNotEmpty(pWinRgn); RegionDestroy(pWinRgn); RegionDestroy(pSibRgn); return ret; } #endif static Bool AnyWindowOverlapsMe( WindowPtr pWin, WindowPtr pHead, register BoxPtr box) { register WindowPtr pSib; BoxRec sboxrec; register BoxPtr sbox; for (pSib = pWin->prevSib; pSib != pHead; pSib = pSib->prevSib) { if (pSib->mapped) { sbox = WindowExtents(pSib, &sboxrec); if (BOXES_OVERLAP(sbox, box) #ifdef SHAPE && ShapeOverlap (pWin, box, pSib, sbox) #endif ) return(TRUE); } } return(FALSE); } static Bool IOverlapAnyWindow( WindowPtr pWin, register BoxPtr box) { register WindowPtr pSib; BoxRec sboxrec; register BoxPtr sbox; for (pSib = pWin->nextSib; pSib; pSib = pSib->nextSib) { if (pSib->mapped) { sbox = WindowExtents(pSib, &sboxrec); if (BOXES_OVERLAP(sbox, box) #ifdef SHAPE && ShapeOverlap (pWin, box, pSib, sbox) #endif ) return(TRUE); } } return(FALSE); } /* * WhereDoIGoInTheStack() * Given pWin and pSib and the relationshipe smode, return * the window that pWin should go ABOVE. * If a pSib is specified: * Above: pWin is placed just above pSib * Below: pWin is placed just below pSib * TopIf: if pSib occludes pWin, then pWin is placed * at the top of the stack * BottomIf: if pWin occludes pSib, then pWin is * placed at the bottom of the stack * Opposite: if pSib occludes pWin, then pWin is placed at the * top of the stack, else if pWin occludes pSib, then * pWin is placed at the bottom of the stack * * If pSib is NULL: * Above: pWin is placed at the top of the stack * Below: pWin is placed at the bottom of the stack * TopIf: if any sibling occludes pWin, then pWin is placed at * the top of the stack * BottomIf: if pWin occludes any sibline, then pWin is placed at * the bottom of the stack * Opposite: if any sibling occludes pWin, then pWin is placed at * the top of the stack, else if pWin occludes any * sibling, then pWin is placed at the bottom of the stack * */ static WindowPtr WhereDoIGoInTheStack( register WindowPtr pWin, register WindowPtr pSib, short x, short y, unsigned short w, unsigned short h, int smode) { BoxRec box; WindowPtr pHead, pFirst; if ((pWin == pWin->parent->firstChild) && (pWin == pWin->parent->lastChild)) return((WindowPtr ) NULL); pHead = RealChildHead(pWin->parent); pFirst = pHead ? pHead->nextSib : pWin->parent->firstChild; box.x1 = x; box.y1 = y; box.x2 = x + (int)w; box.y2 = y + (int)h; switch (smode) { case Above: if (pSib) return(pSib); else if (pWin == pFirst) return(pWin->nextSib); else return(pFirst); case Below: if (pSib) if (pSib->nextSib != pWin) return(pSib->nextSib); else return(pWin->nextSib); else return NullWindow; case TopIf: if ((!pWin->mapped || (pSib && !pSib->mapped))) return(pWin->nextSib); else if (pSib) { if ((IsSiblingAboveMe(pWin, pSib) == Above) && (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT)) return(pFirst); else return(pWin->nextSib); } else if (AnyWindowOverlapsMe(pWin, pHead, &box)) return(pFirst); else return(pWin->nextSib); case BottomIf: if ((!pWin->mapped || (pSib && !pSib->mapped))) return(pWin->nextSib); else if (pSib) { if ((IsSiblingAboveMe(pWin, pSib) == Below) && (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT)) return NullWindow; else return(pWin->nextSib); } else if (IOverlapAnyWindow(pWin, &box)) return NullWindow; else return(pWin->nextSib); case Opposite: if ((!pWin->mapped || (pSib && !pSib->mapped))) return(pWin->nextSib); else if (pSib) { if (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT) { if (IsSiblingAboveMe(pWin, pSib) == Above) return(pFirst); else return NullWindow; } else return(pWin->nextSib); } else if (AnyWindowOverlapsMe(pWin, pHead, &box)) { /* If I'm occluded, I can't possibly be the first child * if (pWin == pWin->parent->firstChild) * return pWin->nextSib; */ return(pFirst); } else if (IOverlapAnyWindow(pWin, &box)) return NullWindow; else return pWin->nextSib; default: { ErrorF("Internal error in ConfigureWindow, smode == %d\n",smode ); return pWin->nextSib; } } } static void ReflectStackChange( register WindowPtr pWin, register WindowPtr pSib, VTKind kind) { /* Note that pSib might be NULL */ Bool WasViewable = (Bool)pWin->viewable; Bool anyMarked; WindowPtr pFirstChange; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; ScreenPtr pScreen = pWin->drawable.pScreen; /* if this is a root window, can't be restacked */ if (!pWin->parent) return; pFirstChange = MoveWindowInStack(pWin, pSib); if (WasViewable) { anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange, &pLayerWin); if (pLayerWin != pWin) pFirstChange = pLayerWin; #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pFirstChange); } #endif /* DO_SAVE_UNDERS */ if (anyMarked) { (*pScreen->ValidateTree)(pLayerWin->parent, pFirstChange, kind); (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, pFirstChange); #endif /* DO_SAVE_UNDERS */ if (anyMarked && pWin->drawable.pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstChange, kind); } if (pWin->realized) WindowsRestructured (); } /***** * ConfigureWindow *****/ #ifndef NXAGENT_SERVER int ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientPtr client) { #define RESTACK_WIN 0 #define MOVE_WIN 1 #define RESIZE_WIN 2 #define REBORDER_WIN 3 register WindowPtr pSib = NullWindow; register WindowPtr pParent = pWin->parent; Window sibwid = 0; Mask index2, tmask; register XID *pVlist; short x, y, beforeX, beforeY; unsigned short w = pWin->drawable.width, h = pWin->drawable.height, bw = pWin->borderWidth; int action, smode = Above; xEvent event; if ((pWin->drawable.class == InputOnly) && (mask & IllegalInputOnlyConfigureMask)) return(BadMatch); if ((mask & CWSibling) && !(mask & CWStackMode)) return(BadMatch); pVlist = vlist; if (pParent) { x = pWin->drawable.x - pParent->drawable.x - (int)bw; y = pWin->drawable.y - pParent->drawable.y - (int)bw; } else { x = pWin->drawable.x; y = pWin->drawable.y; } beforeX = x; beforeY = y; action = RESTACK_WIN; if ((mask & (CWX | CWY)) && (!(mask & (CWHeight | CWWidth)))) { GET_INT16(CWX, x); GET_INT16(CWY, y); action = MOVE_WIN; } /* or should be resized */ else if (mask & (CWX | CWY | CWWidth | CWHeight)) { GET_INT16(CWX, x); GET_INT16(CWY, y); GET_CARD16(CWWidth, w); GET_CARD16 (CWHeight, h); if (!w || !h) { client->errorValue = 0; return BadValue; } action = RESIZE_WIN; } tmask = mask & ~ChangeMask; while (tmask) { index2 = (Mask)lowbit (tmask); tmask &= ~index2; switch (index2) { case CWBorderWidth: GET_CARD16(CWBorderWidth, bw); break; case CWSibling: sibwid = (Window ) *pVlist; pVlist++; pSib = (WindowPtr )SecurityLookupIDByType(client, sibwid, RT_WINDOW, DixReadAccess); if (!pSib) { client->errorValue = sibwid; return(BadWindow); } if (pSib->parent != pParent) return(BadMatch); if (pSib == pWin) return(BadMatch); break; case CWStackMode: GET_CARD8(CWStackMode, smode); if ((smode != TopIf) && (smode != BottomIf) && (smode != Opposite) && (smode != Above) && (smode != Below)) { client->errorValue = smode; return(BadValue); } break; default: client->errorValue = mask; return(BadValue); } } /* root really can't be reconfigured, so just return */ if (!pParent) return Success; /* Figure out if the window should be moved. Doesnt make the changes to the window if event sent */ if (mask & CWStackMode) pSib = WhereDoIGoInTheStack(pWin, pSib, pParent->drawable.x + x, pParent->drawable.y + y, w + (bw << 1), h + (bw << 1), smode); else pSib = pWin->nextSib; if ((!pWin->overrideRedirect) && (RedirectSend(pParent) )) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = ConfigureRequest; event.u.configureRequest.window = pWin->drawable.id; if (mask & CWSibling) event.u.configureRequest.sibling = sibwid; else event.u.configureRequest.sibling = None; if (mask & CWStackMode) event.u.u.detail = smode; else event.u.u.detail = Above; event.u.configureRequest.x = x; event.u.configureRequest.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension && (!pParent || !pParent->parent)) { event.u.configureRequest.x += panoramiXdataPtr[0].x; event.u.configureRequest.y += panoramiXdataPtr[0].y; } #endif event.u.configureRequest.width = w; event.u.configureRequest.height = h; event.u.configureRequest.borderWidth = bw; event.u.configureRequest.valueMask = mask; event.u.configureRequest.parent = pParent->drawable.id; if (MaybeDeliverEventsToClient(pParent, &event, 1, SubstructureRedirectMask, client) == 1) return(Success); } if (action == RESIZE_WIN) { Bool size_change = (w != pWin->drawable.width) || (h != pWin->drawable.height); if (size_change && ((pWin->eventMask|wOtherEventMasks(pWin)) & ResizeRedirectMask)) { xEvent eventT; memset(&eventT, 0, sizeof(xEvent)); eventT.u.u.type = ResizeRequest; eventT.u.resizeRequest.window = pWin->drawable.id; eventT.u.resizeRequest.width = w; eventT.u.resizeRequest.height = h; if (MaybeDeliverEventsToClient(pWin, &eventT, 1, ResizeRedirectMask, client) == 1) { /* if event is delivered, leave the actual size alone. */ w = pWin->drawable.width; h = pWin->drawable.height; size_change = FALSE; } } if (!size_change) { if (mask & (CWX | CWY)) action = MOVE_WIN; else if (mask & (CWStackMode | CWBorderWidth)) action = RESTACK_WIN; else /* really nothing to do */ return(Success) ; } } if (action == RESIZE_WIN) /* we've already checked whether there's really a size change */ goto ActuallyDoSomething; if ((mask & CWX) && (x != beforeX)) goto ActuallyDoSomething; if ((mask & CWY) && (y != beforeY)) goto ActuallyDoSomething; if ((mask & CWBorderWidth) && (bw != wBorderWidth (pWin))) goto ActuallyDoSomething; if (mask & CWStackMode) { #ifndef ROOTLESS /* See above for why we always reorder in rootless mode. */ if (pWin->nextSib != pSib) #endif goto ActuallyDoSomething; } return(Success); ActuallyDoSomething: if (SubStrSend(pWin, pParent)) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = ConfigureNotify; event.u.configureNotify.window = pWin->drawable.id; if (pSib) event.u.configureNotify.aboveSibling = pSib->drawable.id; else event.u.configureNotify.aboveSibling = None; event.u.configureNotify.x = x; event.u.configureNotify.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension && (!pParent || !pParent->parent)) { event.u.configureNotify.x += panoramiXdataPtr[0].x; event.u.configureNotify.y += panoramiXdataPtr[0].y; } #endif event.u.configureNotify.width = w; event.u.configureNotify.height = h; event.u.configureNotify.borderWidth = bw; event.u.configureNotify.override = pWin->overrideRedirect; DeliverEvents(pWin, &event, 1, NullWindow); } if (mask & CWBorderWidth) { if (action == RESTACK_WIN) { action = MOVE_WIN; pWin->borderWidth = bw; } else if ((action == MOVE_WIN) && (beforeX + wBorderWidth (pWin) == x + (int)bw) && (beforeY + wBorderWidth (pWin) == y + (int)bw)) { action = REBORDER_WIN; (*pWin->drawable.pScreen->ChangeBorderWidth)(pWin, bw); } else pWin->borderWidth = bw; } if (action == MOVE_WIN) (*pWin->drawable.pScreen->MoveWindow)(pWin, x, y, pSib, (mask & CWBorderWidth) ? VTOther : VTMove); else if (action == RESIZE_WIN) (*pWin->drawable.pScreen->ResizeWindow)(pWin, x, y, w, h, pSib); else if (mask & CWStackMode) ReflectStackChange(pWin, pSib, VTOther); if (action != RESTACK_WIN) CheckCursorConfinement(pWin); return(Success); #undef RESTACK_WIN #undef MOVE_WIN #undef RESIZE_WIN #undef REBORDER_WIN } #endif /* NXAGENT_SERVER */ /****** * * CirculateWindow * For RaiseLowest, raises the lowest mapped child (if any) that is * obscured by another child to the top of the stack. For LowerHighest, * lowers the highest mapped child (if any) that is obscuring another * child to the bottom of the stack. Exposure processing is performed * ******/ int CirculateWindow(WindowPtr pParent, int direction, ClientPtr client) { register WindowPtr pWin, pHead, pFirst; xEvent event; BoxRec box; /* * #ifdef NXAGENT_SERVER * if (nxagentOption(Rootless) && nxagentWMIsRunning && * nxagentWindowTopLevel(pWin) && pWin -> overrideRedirect == 0) * { * nxagentCirculateRootlessWindows(direction); * return Success; * } * #endif */ pHead = RealChildHead(pParent); pFirst = pHead ? pHead->nextSib : pParent->firstChild; if (direction == RaiseLowest) { for (pWin = pParent->lastChild; (pWin != pHead) && !(pWin->mapped && AnyWindowOverlapsMe(pWin, pHead, WindowExtents(pWin, &box))); pWin = pWin->prevSib) ; if (pWin == pHead) return Success; } else { for (pWin = pFirst; pWin && !(pWin->mapped && IOverlapAnyWindow(pWin, WindowExtents(pWin, &box))); pWin = pWin->nextSib) ; if (!pWin) return Success; } event.u.circulate.window = pWin->drawable.id; event.u.circulate.parent = pParent->drawable.id; event.u.circulate.event = pParent->drawable.id; if (direction == RaiseLowest) event.u.circulate.place = PlaceOnTop; else event.u.circulate.place = PlaceOnBottom; if (RedirectSend(pParent)) { event.u.u.type = CirculateRequest; if (MaybeDeliverEventsToClient(pParent, &event, 1, SubstructureRedirectMask, client) == 1) return(Success); } event.u.u.type = CirculateNotify; DeliverEvents(pWin, &event, 1, NullWindow); ReflectStackChange(pWin, (direction == RaiseLowest) ? pFirst : NullWindow, VTStack); return(Success); } static int CompareWIDs( WindowPtr pWin, void * value) /* must conform to VisitWindowProcPtr */ { Window *wid = (Window *)value; if (pWin->drawable.id == *wid) return(WT_STOPWALKING); else return(WT_WALKCHILDREN); } /***** * ReparentWindow *****/ #ifndef NXAGENT_SERVER int ReparentWindow(register WindowPtr pWin, register WindowPtr pParent, int x, int y, ClientPtr client) { WindowPtr pPrev, pPriorParent; Bool WasMapped = (Bool)(pWin->mapped); xEvent event; int bw = wBorderWidth (pWin); register ScreenPtr pScreen; pScreen = pWin->drawable.pScreen; if (TraverseTree(pWin, CompareWIDs, (void *)&pParent->drawable.id) == WT_STOPWALKING) return(BadMatch); if (!MakeWindowOptional(pWin)) return(BadAlloc); if (WasMapped) UnmapWindow(pWin, FALSE); memset(&event, 0, sizeof(xEvent)); event.u.u.type = ReparentNotify; event.u.reparent.window = pWin->drawable.id; event.u.reparent.parent = pParent->drawable.id; event.u.reparent.x = x; event.u.reparent.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension && !pParent->parent) { event.u.reparent.x += panoramiXdataPtr[0].x; event.u.reparent.y += panoramiXdataPtr[0].y; } #endif event.u.reparent.override = pWin->overrideRedirect; DeliverEvents(pWin, &event, 1, pParent); /* take out of sibling chain */ pPriorParent = pPrev = pWin->parent; if (pPrev->firstChild == pWin) pPrev->firstChild = pWin->nextSib; if (pPrev->lastChild == pWin) pPrev->lastChild = pWin->prevSib; if (pWin->nextSib) pWin->nextSib->prevSib = pWin->prevSib; if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; /* insert at begining of pParent */ pWin->parent = pParent; pPrev = RealChildHead(pParent); if (pPrev) { pWin->nextSib = pPrev->nextSib; if (pPrev->nextSib) pPrev->nextSib->prevSib = pWin; else pParent->lastChild = pWin; pPrev->nextSib = pWin; pWin->prevSib = pPrev; } else { pWin->nextSib = pParent->firstChild; pWin->prevSib = NullWindow; if (pParent->firstChild) pParent->firstChild->prevSib = pWin; else pParent->lastChild = pWin; pParent->firstChild = pWin; } pWin->origin.x = x + bw; pWin->origin.y = y + bw; pWin->drawable.x = x + bw + pParent->drawable.x; pWin->drawable.y = y + bw + pParent->drawable.y; /* clip to parent */ SetWinSize (pWin); SetBorderSize (pWin); if (pScreen->ReparentWindow) (*pScreen->ReparentWindow)(pWin, pPriorParent); (*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y); ResizeChildrenWinSize(pWin, 0, 0, 0, 0); CheckWindowOptionalNeed(pWin); if (WasMapped) MapWindow(pWin, client); RecalculateDeliverableEvents(pWin); return(Success); } #endif /* NXAGENT_SERVER */ static void RealizeTree(WindowPtr pWin) { register WindowPtr pChild; RealizeWindowProcPtr Realize; Realize = pWin->drawable.pScreen->RealizeWindow; pChild = pWin; while (1) { if (pChild->mapped) { pChild->realized = TRUE; #ifdef DO_SAVE_UNDERS if (pChild->saveUnder) deltaSaveUndersViewable++; #endif pChild->viewable = (pChild->drawable.class == InputOutput); (* Realize)(pChild); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) return; pChild = pChild->nextSib; } } /***** * MapWindow * If some other client has selected SubStructureReDirect on the parent * and override-redirect is xFalse, then a MapRequest event is generated, * but the window remains unmapped. Otherwise, the window is mapped and a * MapNotify event is generated. *****/ #ifndef NXAGENT_SERVER int MapWindow(register WindowPtr pWin, ClientPtr client) { register ScreenPtr pScreen; register WindowPtr pParent; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; if (pWin->mapped) return(Success); #ifdef XCSECURITY /* don't let an untrusted client map a child-of-trusted-window, InputOnly * window; too easy to steal device input */ if ( (client->trustLevel != XSecurityClientTrusted) && (pWin->drawable.class == InputOnly) && (wClient(pWin->parent)->trustLevel == XSecurityClientTrusted) ) return Success; #endif pScreen = pWin->drawable.pScreen; if ( (pParent = pWin->parent) ) { xEvent event; Bool anyMarked; if ((!pWin->overrideRedirect) && (RedirectSend(pParent) )) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = MapRequest; event.u.mapRequest.window = pWin->drawable.id; event.u.mapRequest.parent = pParent->drawable.id; if (MaybeDeliverEventsToClient(pParent, &event, 1, SubstructureRedirectMask, client) == 1) return(Success); } pWin->mapped = TRUE; if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = MapNotify; event.u.mapNotify.window = pWin->drawable.id; event.u.mapNotify.override = pWin->overrideRedirect; DeliverEvents(pWin, &event, 1, NullWindow); } if (!pParent->realized) return(Success); RealizeTree(pWin); if (pWin->viewable) { anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pWin->nextSib); } #endif /* DO_SAVE_UNDERS */ if (anyMarked) { (*pScreen->ValidateTree)(pLayerWin->parent, pLayerWin, VTMap); (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, pWin->nextSib); #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pLayerWin, VTMap); } WindowsRestructured (); } else { RegionRec temp; pWin->mapped = TRUE; pWin->realized = TRUE; /* for roots */ pWin->viewable = pWin->drawable.class == InputOutput; /* We SHOULD check for an error value here XXX */ (*pScreen->RealizeWindow)(pWin); if (pScreen->ClipNotify) (*pScreen->ClipNotify) (pWin, 0, 0); if (pScreen->PostValidateTree) (*pScreen->PostValidateTree)(NullWindow, pWin, VTMap); RegionNull(&temp); RegionCopy(&temp, &pWin->clipList); (*pScreen->WindowExposures) (pWin, &temp, NullRegion); RegionUninit(&temp); } return(Success); } #endif /* NXAGENT_SERVER */ /***** * MapSubwindows * Performs a MapWindow all unmapped children of the window, in top * to bottom stacking order. *****/ void MapSubwindows(register WindowPtr pParent, ClientPtr client) { register WindowPtr pWin; WindowPtr pFirstMapped = NullWindow; #ifdef DO_SAVE_UNDERS WindowPtr pFirstSaveUndered = NullWindow; #endif register ScreenPtr pScreen; register Mask parentRedirect; register Mask parentNotify; xEvent event; Bool anyMarked; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; pScreen = pParent->drawable.pScreen; parentRedirect = RedirectSend(pParent); parentNotify = SubSend(pParent); anyMarked = FALSE; for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib) { if (!pWin->mapped) { if (parentRedirect && !pWin->overrideRedirect) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = MapRequest; event.u.mapRequest.window = pWin->drawable.id; event.u.mapRequest.parent = pParent->drawable.id; if (MaybeDeliverEventsToClient(pParent, &event, 1, SubstructureRedirectMask, client) == 1) continue; } pWin->mapped = TRUE; if (parentNotify || StrSend(pWin)) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = MapNotify; event.u.mapNotify.window = pWin->drawable.id; event.u.mapNotify.override = pWin->overrideRedirect; DeliverEvents(pWin, &event, 1, NullWindow); } if (!pFirstMapped) pFirstMapped = pWin; if (pParent->realized) { RealizeTree(pWin); if (pWin->viewable) { anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin, (WindowPtr *)NULL); #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = TRUE; } #endif /* DO_SAVE_UNDERS */ } } } } if (pFirstMapped) { pLayerWin = (*pScreen->GetLayerWindow)(pParent); if (pLayerWin->parent != pParent) { anyMarked |= (*pScreen->MarkOverlappedWindows)(pLayerWin, pLayerWin, (WindowPtr *)NULL); pFirstMapped = pLayerWin; } if (anyMarked) { #ifdef DO_SAVE_UNDERS if (pLayerWin->parent != pParent) { if (dosave || (DO_SAVE_UNDERS(pLayerWin))) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin); } } else if (dosave) { dosave = FALSE; for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib) { if (DO_SAVE_UNDERS(pWin)) { dosave |= (*pScreen->ChangeSaveUnder)(pWin, pWin->nextSib); if (dosave && !pFirstSaveUndered) pFirstSaveUndered = pWin; } } } #endif /* DO_SAVE_UNDERS */ (*pScreen->ValidateTree)(pLayerWin->parent, pFirstMapped, VTMap); (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, pFirstSaveUndered->nextSib); #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstMapped, VTMap); WindowsRestructured (); } } static void UnrealizeTree( WindowPtr pWin, Bool fromConfigure) { register WindowPtr pChild; UnrealizeWindowProcPtr Unrealize; MarkUnrealizedWindowProcPtr MarkUnrealizedWindow; Unrealize = pWin->drawable.pScreen->UnrealizeWindow; MarkUnrealizedWindow = pWin->drawable.pScreen->MarkUnrealizedWindow; pChild = pWin; while (1) { if (pChild->realized) { pChild->realized = FALSE; pChild->visibility = VisibilityNotViewable; #ifdef PANORAMIX if(!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) { PanoramiXRes *win; win = (PanoramiXRes*)LookupIDByType(pChild->drawable.id, XRT_WINDOW); if(win) win->u.win.visibility = VisibilityNotViewable; } #endif (* Unrealize)(pChild); DeleteWindowFromAnyEvents(pChild, FALSE); if (pChild->viewable) { #ifdef DO_SAVE_UNDERS if (pChild->saveUnder) deltaSaveUndersViewable--; #endif pChild->viewable = FALSE; if (pChild->backStorage) (*pChild->drawable.pScreen->SaveDoomedAreas)( pChild, &pChild->clipList, 0, 0); (* MarkUnrealizedWindow)(pChild, pWin, fromConfigure); pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER; } if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) return; pChild = pChild->nextSib; } } /***** * UnmapWindow * If the window is already unmapped, this request has no effect. * Otherwise, the window is unmapped and an UnMapNotify event is * generated. Cannot unmap a root window. *****/ int UnmapWindow(register WindowPtr pWin, Bool fromConfigure) { register WindowPtr pParent; xEvent event; Bool wasRealized = (Bool)pWin->realized; Bool wasViewable = (Bool)pWin->viewable; ScreenPtr pScreen = pWin->drawable.pScreen; WindowPtr pLayerWin = pWin; if ((!pWin->mapped) || (!(pParent = pWin->parent))) return(Success); if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = UnmapNotify; event.u.unmapNotify.window = pWin->drawable.id; event.u.unmapNotify.fromConfigure = fromConfigure; DeliverEvents(pWin, &event, 1, NullWindow); } if (wasViewable && !fromConfigure) { pWin->valdata = UnmapValData; (*pScreen->MarkOverlappedWindows)(pWin, pWin->nextSib, &pLayerWin); (*pScreen->MarkWindow)(pLayerWin->parent); } pWin->mapped = FALSE; if (wasRealized) UnrealizeTree(pWin, fromConfigure); if (wasViewable) { if (!fromConfigure) { (*pScreen->ValidateTree)(pLayerWin->parent, pWin, VTUnmap); (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { if ( (*pScreen->ChangeSaveUnder)(pLayerWin, pWin->nextSib) ) { (*pScreen->PostChangeSaveUnder)(pLayerWin, pWin->nextSib); } } pWin->DIXsaveUnder = FALSE; #endif /* DO_SAVE_UNDERS */ if (!fromConfigure && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pWin, VTUnmap); } if (wasRealized && !fromConfigure) WindowsRestructured (); return(Success); } /***** * UnmapSubwindows * Performs an UnmapWindow request with the specified mode on all mapped * children of the window, in bottom to top stacking order. *****/ void UnmapSubwindows(register WindowPtr pWin) { register WindowPtr pChild, pHead; xEvent event; Bool wasRealized = (Bool)pWin->realized; Bool wasViewable = (Bool)pWin->viewable; Bool anyMarked = FALSE; Mask parentNotify; WindowPtr pLayerWin = NULL; ScreenPtr pScreen = pWin->drawable.pScreen; if (!pWin->firstChild) return; parentNotify = SubSend(pWin); pHead = RealChildHead(pWin); if (wasViewable) pLayerWin = (*pScreen->GetLayerWindow)(pWin); for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) { if (pChild->mapped) { if (parentNotify || StrSend(pChild)) { event.u.u.type = UnmapNotify; event.u.unmapNotify.window = pChild->drawable.id; event.u.unmapNotify.fromConfigure = xFalse; DeliverEvents(pChild, &event, 1, NullWindow); } if (pChild->viewable) { pChild->valdata = UnmapValData; anyMarked = TRUE; } pChild->mapped = FALSE; if (pChild->realized) UnrealizeTree(pChild, FALSE); if (wasViewable) { #ifdef DO_SAVE_UNDERS pChild->DIXsaveUnder = FALSE; #endif /* DO_SAVE_UNDERS */ if (pChild->backStorage) (*pScreen->SaveDoomedAreas)( pChild, &pChild->clipList, 0, 0); } } } if (wasViewable) { if (anyMarked) { if (pLayerWin->parent == pWin) (*pScreen->MarkWindow)(pWin); else { WindowPtr ptmp; (*pScreen->MarkOverlappedWindows)(pWin, pLayerWin, (WindowPtr *)NULL); (*pScreen->MarkWindow)(pLayerWin->parent); /* Windows between pWin and pLayerWin may not have been marked */ ptmp = pWin; while (ptmp != pLayerWin->parent) { (*pScreen->MarkWindow)(ptmp); ptmp = ptmp->parent; } pHead = pWin->firstChild; } (*pScreen->ValidateTree)(pLayerWin->parent, pHead, VTUnmap); (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { if ( (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin)) (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin); } #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pHead, VTUnmap); } if (wasRealized) WindowsRestructured (); } void HandleSaveSet(register ClientPtr client) { register WindowPtr pParent, pWin; register int j; for (j=0; jnumSaved; j++) { pWin = SaveSetWindow(client->saveSet[j]); #ifdef XFIXES if (SaveSetToRoot(client->saveSet[j])) pParent = pWin->drawable.pScreen->root; else #endif { pParent = pWin->parent; while (pParent && (wClient (pParent) == client)) pParent = pParent->parent; } if (pParent) { if (pParent != pWin->parent) { ReparentWindow(pWin, pParent, pWin->drawable.x - wBorderWidth (pWin) - pParent->drawable.x, pWin->drawable.y - wBorderWidth (pWin) - pParent->drawable.y, client); if(!pWin->realized && pWin->mapped) pWin->mapped = FALSE; } #ifdef XFIXES if (SaveSetRemap (client->saveSet[j])) #endif MapWindow(pWin, client); } } free(client->saveSet); client->numSaved = 0; client->saveSet = (SaveSetElt *)NULL; } /** * * \param x,y in root * \param box "return" value */ Bool VisibleBoundingBoxFromPoint(register WindowPtr pWin, int x, int y, BoxPtr box) { if (!pWin->realized) return (FALSE); if (RegionContainsPoint(&pWin->clipList, x, y, box)) return(TRUE); return(FALSE); } /** * * \param x,y in root */ Bool PointInWindowIsVisible(register WindowPtr pWin, int x, int y) { BoxRec box; if (!pWin->realized) return (FALSE); if (RegionContainsPoint(&pWin->borderClip, x, y, &box) && (!wInputShape(pWin) || RegionContainsPoint( wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box))) return(TRUE); return(FALSE); } RegionPtr NotClippedByChildren(register WindowPtr pWin) { RegionPtr pReg; pReg = RegionCreate(NullBox, 1); if (pWin->parent || screenIsSaved != SCREEN_SAVER_ON || !HasSaverWindow (pWin->drawable.pScreen->myNum)) { RegionIntersect(pReg, &pWin->borderClip, &pWin->winSize); } return(pReg); } void SendVisibilityNotify(WindowPtr pWin) { xEvent event; #ifndef NO_XINERAMA_PORT unsigned int visibility = pWin->visibility; #endif #ifdef PANORAMIX /* This is not quite correct yet, but it's close */ if(!noPanoramiXExtension) { PanoramiXRes *win; WindowPtr pWin2; int i, Scrnum; Scrnum = pWin->drawable.pScreen->myNum; win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, Scrnum); if(!win || (win->u.win.visibility == visibility)) return; switch(visibility) { case VisibilityUnobscured: for(i = 0; i < PanoramiXNumScreens; i++) { if(i == Scrnum) continue; pWin2 = (WindowPtr)LookupIDByType(win->info[i].id, RT_WINDOW); if (pWin2) { if(pWin2->visibility == VisibilityPartiallyObscured) return; if(!i) pWin = pWin2; } } break; case VisibilityPartiallyObscured: if(Scrnum) { pWin2 = (WindowPtr)LookupIDByType(win->info[0].id, RT_WINDOW); if (pWin2) pWin = pWin2; } break; case VisibilityFullyObscured: for(i = 0; i < PanoramiXNumScreens; i++) { if(i == Scrnum) continue; pWin2 = (WindowPtr)LookupIDByType(win->info[i].id, RT_WINDOW); if (pWin2) { if(pWin2->visibility != VisibilityFullyObscured) return; if(!i) pWin = pWin2; } } break; } win->u.win.visibility = visibility; } #endif memset(&event, 0, sizeof(xEvent)); event.u.u.type = VisibilityNotify; event.u.visibility.window = pWin->drawable.id; event.u.visibility.state = visibility; DeliverEvents(pWin, &event, 1, NullWindow); } static WindowPtr windowDisableMapUnmapEvents; void DisableMapUnmapEvents(WindowPtr pWin) { assert (windowDisableMapUnmapEvents == NULL); windowDisableMapUnmapEvents = pWin; } void EnableMapUnmapEvents(WindowPtr pWin) { assert (windowDisableMapUnmapEvents != NULL); windowDisableMapUnmapEvents = NULL; } Bool MapUnmapEventsEnabled(WindowPtr pWin) { return pWin != windowDisableMapUnmapEvents; } #define RANDOM_WIDTH 32 #ifndef NOLOGOHACK static void DrawLogo( WindowPtr pWin ); #endif #ifndef NXAGENT_SERVER void SaveScreens(int on, int mode) { int i; int what; int type; if (on == SCREEN_SAVER_FORCER) { if (mode == ScreenSaverReset) what = SCREEN_SAVER_OFF; else what = SCREEN_SAVER_ON; type = what; } else { what = on; type = what; if (what == screenIsSaved) type = SCREEN_SAVER_CYCLE; } for (i = 0; i < screenInfo.numScreens; i++) { if (on == SCREEN_SAVER_FORCER) (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], on); if (savedScreenInfo[i].ExternalScreenSaver) { if ((*savedScreenInfo[i].ExternalScreenSaver) (screenInfo.screens[i], type, on == SCREEN_SAVER_FORCER)) continue; } if (type == screenIsSaved) continue; switch (type) { case SCREEN_SAVER_OFF: if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED) { (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], what); } else if (HasSaverWindow (i)) { savedScreenInfo[i].pWindow = NullWindow; FreeResource(savedScreenInfo[i].wid, RT_NONE); } break; case SCREEN_SAVER_CYCLE: if (savedScreenInfo[i].blanked == SCREEN_IS_TILED) { WindowPtr pWin = savedScreenInfo[i].pWindow; /* make it look like screen saver is off, so that * NotClippedByChildren will compute a clip list * for the root window, so miPaintWindow works */ screenIsSaved = SCREEN_SAVER_OFF; #ifndef NOLOGOHACK if (logoScreenSaver) (*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, FALSE); #endif (*pWin->drawable.pScreen->MoveWindow)(pWin, (short)(-(rand() % RANDOM_WIDTH)), (short)(-(rand() % RANDOM_WIDTH)), pWin->nextSib, VTMove); #ifndef NOLOGOHACK if (logoScreenSaver) DrawLogo(pWin); #endif screenIsSaved = SCREEN_SAVER_ON; } /* * Call the DDX saver in case it wants to do something * at cycle time */ else if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED) { (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], type); } break; case SCREEN_SAVER_ON: if (ScreenSaverBlanking != DontPreferBlanking) { if ((* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], what)) { savedScreenInfo[i].blanked = SCREEN_IS_BLANKED; continue; } if ((ScreenSaverAllowExposures != DontAllowExposures) && TileScreenSaver(i, SCREEN_IS_BLACK)) { savedScreenInfo[i].blanked = SCREEN_IS_BLACK; continue; } } if ((ScreenSaverAllowExposures != DontAllowExposures) && TileScreenSaver(i, SCREEN_IS_TILED)) { savedScreenInfo[i].blanked = SCREEN_IS_TILED; } else savedScreenInfo[i].blanked = SCREEN_ISNT_SAVED; break; } } screenIsSaved = what; if (mode == ScreenSaverReset) SetScreenSaverTimer(); } #endif /* NXAGENT_SERVER */ static Bool TileScreenSaver(int i, int kind) { int j; int result; XID attributes[3]; Mask mask; WindowPtr pWin; CursorMetricRec cm; unsigned char *srcbits, *mskbits; CursorPtr cursor; XID cursorID = 0; int attri; mask = 0; attri = 0; switch (kind) { case SCREEN_IS_TILED: switch (screenInfo.screens[i]->root->backgroundState) { case BackgroundPixel: attributes[attri++] = screenInfo.screens[i]->root->background.pixel; mask |= CWBackPixel; break; case BackgroundPixmap: attributes[attri++] = None; mask |= CWBackPixmap; break; default: break; } break; case SCREEN_IS_BLACK: attributes[attri++] = screenInfo.screens[i]->root->drawable.pScreen->blackPixel; mask |= CWBackPixel; break; } mask |= CWOverrideRedirect; attributes[attri++] = xTrue; /* * create a blank cursor */ cm.width=16; cm.height=16; cm.xhot=8; cm.yhot=8; srcbits = (unsigned char *)malloc( BitmapBytePad(32)*16); mskbits = (unsigned char *)malloc( BitmapBytePad(32)*16); if (!srcbits || !mskbits) { free(srcbits); free(mskbits); cursor = 0; } else { for (j=0; jroot, -RANDOM_WIDTH, -RANDOM_WIDTH, (unsigned short)screenInfo.screens[i]->width + RANDOM_WIDTH, (unsigned short)screenInfo.screens[i]->height + RANDOM_WIDTH, 0, InputOutput, mask, attributes, 0, serverClient, wVisual (screenInfo.screens[i]->root), &result); if (cursor) FreeResource (cursorID, RT_NONE); if (!pWin) return FALSE; if (!AddResource(pWin->drawable.id, RT_WINDOW, (void *)savedScreenInfo[i].pWindow)) return FALSE; if (mask & CWBackPixmap) { MakeRootTile (pWin); (*pWin->drawable.pScreen->ChangeWindowAttributes)(pWin, CWBackPixmap); } MapWindow(pWin, serverClient); #ifndef NOLOGOHACK if (kind == SCREEN_IS_TILED && logoScreenSaver) DrawLogo(pWin); #endif return TRUE; } /* * FindWindowWithOptional * * search ancestors of the given window for an entry containing * a WindowOpt structure. Assumptions: some parent will * contain the structure. */ WindowPtr FindWindowWithOptional (register WindowPtr w) { do w = w->parent; while (!w->optional); return w; } /* * CheckWindowOptionalNeed * * check each optional entry in the given window to see if * the value is satisfied by the default rules. If so, * release the optional record */ void CheckWindowOptionalNeed (register WindowPtr w) { register WindowOptPtr optional; register WindowOptPtr parentOptional; if (!w->parent) return; optional = w->optional; if (optional->dontPropagateMask != DontPropagateMasks[w->dontPropagate]) return; if (optional->otherEventMasks != 0) return; if (optional->otherClients != NULL) return; if (optional->passiveGrabs != NULL) return; if (optional->userProps != NULL) return; if (optional->backingBitPlanes != ~0L) return; if (optional->backingPixel != 0) return; #ifdef SHAPE if (optional->boundingShape != NULL) return; if (optional->clipShape != NULL) return; if (optional->inputShape != NULL) return; #endif #ifdef XINPUT if (optional->inputMasks != NULL) return; #endif parentOptional = FindWindowWithOptional(w)->optional; if (optional->visual != parentOptional->visual) return; if (optional->cursor != None && (optional->cursor != parentOptional->cursor || w->parent->cursorIsNone)) return; if (optional->colormap != parentOptional->colormap) return; DisposeWindowOptional (w); } /* * MakeWindowOptional * * create an optional record and initialize it with the default * values. */ Bool MakeWindowOptional (register WindowPtr pWin) { register WindowOptPtr optional; register WindowOptPtr parentOptional; if (pWin->optional) return TRUE; optional = (WindowOptPtr) malloc (sizeof (WindowOptRec)); if (!optional) return FALSE; optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate]; optional->otherEventMasks = 0; optional->otherClients = NULL; optional->passiveGrabs = NULL; optional->userProps = NULL; optional->backingBitPlanes = ~0L; optional->backingPixel = 0; #ifdef SHAPE optional->boundingShape = NULL; optional->clipShape = NULL; optional->inputShape = NULL; #endif #ifdef XINPUT optional->inputMasks = NULL; #endif parentOptional = FindWindowWithOptional(pWin)->optional; optional->visual = parentOptional->visual; if (!pWin->cursorIsNone) { optional->cursor = parentOptional->cursor; optional->cursor->refcnt++; } else { optional->cursor = None; } optional->colormap = parentOptional->colormap; pWin->optional = optional; return TRUE; } void DisposeWindowOptional (register WindowPtr pWin) { if (!pWin->optional) return; /* * everything is peachy. Delete the optional record * and clean up */ /* * TOG changed this code to: * * if (pWin->cursorIsNone == FALSE) * FreeCursor (pWin->optional->cursor, (Cursor)0); * pWin->cursorIsNone = TRUE; * * This is blatently wrong; windows without optionals can have * two different cursor values, either None or sharing their * parents cursor. This difference is controlled by the * cursorIsNone value; when TRUE, the window has no cursor, * when false, it shares its cursor with its parent; TOG * made it impossible for a window to have a cursor without * an optional record. */ if (pWin->optional->cursor) { FreeCursor (pWin->optional->cursor, (Cursor)0); pWin->cursorIsNone = FALSE; } else pWin->cursorIsNone = TRUE; free (pWin->optional); pWin->optional = NULL; } #ifndef NOLOGOHACK static void DrawLogo(WindowPtr pWin) { DrawablePtr pDraw; ScreenPtr pScreen; int x, y; unsigned int width, height, size; GC *pGC; int thin, gap, d31; DDXPointRec poly[4]; ChangeGCVal fore[2], back[2]; xrgb rgb[2]; BITS32 fmask, bmask; ColormapPtr cmap; pDraw = (DrawablePtr)pWin; pScreen = pDraw->pScreen; x = -pWin->origin.x; y = -pWin->origin.y; width = pScreen->width; height = pScreen->height; pGC = GetScratchGC(pScreen->rootDepth, pScreen); if (!pGC) return; if ((rand() % 100) <= 17) /* make the probability for white fairly low */ fore[0].val = pScreen->whitePixel; else fore[0].val = pScreen->blackPixel; if ((pWin->backgroundState == BackgroundPixel) && (cmap = (ColormapPtr)LookupIDByType(wColormap (pWin), RT_COLORMAP))) { Pixel querypixels[2]; querypixels[0] = fore[0].val; querypixels[1] = pWin->background.pixel; QueryColors(cmap, 2, querypixels, rgb); if ((rgb[0].red == rgb[1].red) && (rgb[0].green == rgb[1].green) && (rgb[0].blue == rgb[1].blue)) { if (fore[0].val == pScreen->blackPixel) fore[0].val = pScreen->whitePixel; else fore[0].val = pScreen->blackPixel; } } fore[1].val = FillSolid; fmask = GCForeground|GCFillStyle; if (pWin->backgroundState == BackgroundPixel) { back[0].val = pWin->background.pixel; back[1].val = FillSolid; bmask = GCForeground|GCFillStyle; } else { back[0].val = 0; back[1].val = 0; dixChangeGC(NullClient, pGC, GCTileStipXOrigin|GCTileStipYOrigin, NULL, back); back[0].val = FillTiled; back[1].ptr = pWin->background.pixmap; bmask = GCFillStyle|GCTile; } /* should be the same as the reference function XmuDrawLogo() */ size = width; if (height < width) size = height; size = RANDOM_WIDTH + rand() % (size - RANDOM_WIDTH); size &= ~1; x += rand() % (width - size); y += rand() % (height - size); /* * Draw what will be the thin strokes. * * ----- * / / * / / * / / * / / * /____/ * d * * Point d is 9/44 (~1/5) of the way across. */ thin = (size / 11); if (thin < 1) thin = 1; gap = (thin+3) / 4; d31 = thin + thin + gap; poly[0].x = x + size; poly[0].y = y; poly[1].x = x + size-d31; poly[1].y = y; poly[2].x = x + 0; poly[2].y = y + size; poly[3].x = x + d31; poly[3].y = y + size; dixChangeGC(NullClient, pGC, fmask, NULL, fore); ValidateGC(pDraw, pGC); (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly); /* * Erase area not needed for lower thin stroke. * * ------ * / / * / __ / * / / / * / / / * /__/__/ */ poly[0].x = x + d31/2; poly[0].y = y + size; poly[1].x = x + size / 2; poly[1].y = y + size/2; poly[2].x = x + (size/2)+(d31-(d31/2)); poly[2].y = y + size/2; poly[3].x = x + d31; poly[3].y = y + size; dixChangeGC(NullClient, pGC, bmask, NULL, back); ValidateGC(pDraw, pGC); (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly); /* * Erase area not needed for upper thin stroke. * * ------ * / / / * /--/ / * / / * / / * /_____/ */ poly[0].x = x + size - d31/2; poly[0].y = y; poly[1].x = x + size / 2; poly[1].y = y + size/2; poly[2].x = x + (size/2)-(d31-(d31/2)); poly[2].y = y + size/2; poly[3].x = x + size - d31; poly[3].y = y; ValidateGC(pDraw, pGC); (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly); /* * Draw thick stroke. * Point b is 1/4 of the way across. * * b * ----- * \ \ * \ \ * \ \ * \ \ * \____\ */ poly[0].x = x; poly[0].y = y; poly[1].x = x + size/4; poly[1].y = y; poly[2].x = x + size; poly[2].y = y + size; poly[3].x = x + size - size/4; poly[3].y = y + size; dixChangeGC(NullClient, pGC, fmask, NULL, fore); ValidateGC(pDraw, pGC); (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly); /* * Erase to create gap. * * / * / * / * / * / */ poly[0].x = x + size- thin; poly[0].y = y; poly[1].x = x + size-( thin+gap); poly[1].y = y; poly[2].x = x + thin; poly[2].y = y + size; poly[3].x = x + thin + gap; poly[3].y = y + size; dixChangeGC(NullClient, pGC, bmask, NULL, back); ValidateGC(pDraw, pGC); (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly); FreeScratchGC(pGC); } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fb24_32.c0000644000000000000000000003250613614532331016375 0ustar /* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "fb.h" /* X apps don't like 24bpp images, this code exposes 32bpp images */ /* * These two functions do a full CopyArea while reformatting * the data between 24 and 32bpp. They try to go a bit faster * by reading/writing aligned CARD32s where it's easy */ #define Get8(a) ((CARD32) *(a)) #if BITMAP_BIT_ORDER == MSBFirst #define Get24(a) ((Get8(a) << 16) | (Get8((a)+1) << 8) | Get8((a)+2)) #define Put24(a,p) (((a)[0] = (CARD8) ((p) >> 16)), \ ((a)[1] = (CARD8) ((p) >> 8)), \ ((a)[2] = (CARD8) (p))) #else #define Get24(a) (Get8(a) | (Get8((a)+1) << 8) | (Get8((a)+2)<<16)) #define Put24(a,p) (((a)[0] = (CARD8) (p)), \ ((a)[1] = (CARD8) ((p) >> 8)), \ ((a)[2] = (CARD8) ((p) >> 16))) #endif typedef void (*fb24_32BltFunc) (CARD8 *srcLine, FbStride srcStride, int srcX, CARD8 *dstLine, FbStride dstStride, int dstX, int width, int height, int alu, FbBits pm); static void fb24_32BltDown (CARD8 *srcLine, FbStride srcStride, int srcX, CARD8 *dstLine, FbStride dstStride, int dstX, int width, int height, int alu, FbBits pm) { CARD32 *src; CARD8 *dst; int w; Bool destInvarient; CARD32 pixel, dpixel; FbDeclareMergeRop (); srcLine += srcX * 4; dstLine += dstX * 3; FbInitializeMergeRop(alu, (pm | ~(FbBits) 0xffffff)); destInvarient = FbDestInvarientMergeRop(); while (height--) { src = (CARD32 *) srcLine; dst = dstLine; srcLine += srcStride; dstLine += dstStride; w = width; if (destInvarient) { while (((long) dst & 3) && w) { w--; pixel = *src++; pixel = FbDoDestInvarientMergeRop(pixel); Put24 (dst, pixel); dst += 3; } /* Do four aligned pixels at a time */ while (w >= 4) { CARD32 s0, s1; s0 = *src++; s0 = FbDoDestInvarientMergeRop(s0); s1 = *src++; s1 = FbDoDestInvarientMergeRop(s1); #if BITMAP_BIT_ORDER == LSBFirst *(CARD32 *)(dst) = (s0 & 0xffffff) | (s1 << 24); #else *(CARD32 *)(dst) = (s0 << 8) | ((s1 & 0xffffff) >> 16); #endif s0 = *src++; s0 = FbDoDestInvarientMergeRop(s0); #if BITMAP_BIT_ORDER == LSBFirst *(CARD32 *)(dst+4) = ((s1 & 0xffffff) >> 8) | (s0 << 16); #else *(CARD32 *)(dst+4) = (s1 << 16) | ((s0 & 0xffffff) >> 8); #endif s1 = *src++; s1 = FbDoDestInvarientMergeRop(s1); #if BITMAP_BIT_ORDER == LSBFirst *(CARD32 *)(dst+8) = ((s0 & 0xffffff) >> 16) | (s1 << 8); #else *(CARD32 *)(dst+8) = (s0 << 24) | (s1 & 0xffffff); #endif dst += 12; w -= 4; } while (w--) { pixel = *src++; pixel = FbDoDestInvarientMergeRop(pixel); Put24 (dst, pixel); dst += 3; } } else { while (w--) { pixel = *src++; dpixel = Get24 (dst); pixel = FbDoMergeRop(pixel, dpixel); Put24 (dst, pixel); dst += 3; } } } } static void fb24_32BltUp (CARD8 *srcLine, FbStride srcStride, int srcX, CARD8 *dstLine, FbStride dstStride, int dstX, int width, int height, int alu, FbBits pm) { CARD8 *src; CARD32 *dst; int w; Bool destInvarient; CARD32 pixel; FbDeclareMergeRop (); FbInitializeMergeRop(alu, (pm | (~(FbBits) 0xffffff))); destInvarient = FbDestInvarientMergeRop(); srcLine += srcX * 3; dstLine += dstX * 4; while (height--) { w = width; src = srcLine; dst = (CARD32 *) dstLine; srcLine += srcStride; dstLine += dstStride; if (destInvarient) { while (((long) src & 3) && w) { w--; pixel = Get24(src); src += 3; *dst++ = FbDoDestInvarientMergeRop(pixel); } /* Do four aligned pixels at a time */ while (w >= 4) { CARD32 s0, s1; s0 = *(CARD32 *)(src); #if BITMAP_BIT_ORDER == LSBFirst pixel = s0 & 0xffffff; #else pixel = s0 >> 8; #endif *dst++ = FbDoDestInvarientMergeRop(pixel); s1 = *(CARD32 *)(src+4); #if BITMAP_BIT_ORDER == LSBFirst pixel = (s0 >> 24) | ((s1 << 8) & 0xffffff); #else pixel = ((s0 << 16) & 0xffffff) | (s1 >> 16); #endif *dst++ = FbDoDestInvarientMergeRop(pixel); s0 = *(CARD32 *)(src+8); #if BITMAP_BIT_ORDER == LSBFirst pixel = (s1 >> 16) | ((s0 << 16) & 0xffffff); #else pixel = ((s1 << 8) & 0xffffff) | (s0 >> 24); #endif *dst++ = FbDoDestInvarientMergeRop(pixel); #if BITMAP_BIT_ORDER == LSBFirst pixel = s0 >> 8; #else pixel = s0 & 0xffffff; #endif *dst++ = FbDoDestInvarientMergeRop(pixel); src += 12; w -= 4; } while (w) { w--; pixel = Get24(src); src += 3; *dst++ = FbDoDestInvarientMergeRop(pixel); } } else { while (w--) { pixel = Get24(src); src += 3; *dst = FbDoMergeRop(pixel, *dst); dst++; } } } } /* * Spans functions; probably unused. */ void fb24_32GetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart) { FbBits *srcBits; CARD8 *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; CARD8 *dst; fbGetDrawable (pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff); src = (CARD8 *) srcBits; srcStride *= sizeof (FbBits); while (nspans--) { dst = (CARD8 *) pchardstStart; fb24_32BltUp (src + (ppt->y + srcYoff) * srcStride, srcStride, ppt->x + srcXoff, dst, 1, 0, *pwidth, 1, GXcopy, FB_ALLONES); pchardstStart += PixmapBytePad(*pwidth, pDrawable->depth); ppt++; pwidth++; } } void fb24_32SetSpans (DrawablePtr pDrawable, GCPtr pGC, char *src, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) { FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); RegionPtr pClip = fbGetCompositeClip(pGC); FbBits *dstBits; CARD8 *dst, *d, *s; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; BoxPtr pbox; int n; int x1, x2; fbGetDrawable (pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); dst = (CARD8 *) dstBits; dstStride *= sizeof (FbBits); while (nspans--) { d = dst + (ppt->y + dstYoff) * dstStride; s = (CARD8 *) src; n = RegionNumRects(pClip); pbox = RegionRects (pClip); while (n--) { if (pbox->y1 > ppt->y) break; if (pbox->y2 > ppt->y) { x1 = ppt->x; x2 = x1 + *pwidth; if (pbox->x1 > x1) x1 = pbox->x1; if (pbox->x2 < x2) x2 = pbox->x2; if (x1 < x2) fb24_32BltDown (s, 0, (x1 - ppt->x), d, dstStride, x1 + dstXoff, (x2 - x1), 1, pGC->alu, pPriv->pm); } } src += PixmapBytePad (*pwidth, pDrawable->depth); ppt++; pwidth++; } } /* * Clip and put 32bpp Z-format images to a 24bpp drawable */ void fb24_32PutZImage (DrawablePtr pDrawable, RegionPtr pClip, int alu, FbBits pm, int x, int y, int width, int height, CARD8 *src, FbStride srcStride) { FbBits *dstBits; CARD8 *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; int nbox; BoxPtr pbox; int x1, y1, x2, y2; fbGetDrawable (pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); dstStride *= sizeof(FbBits); dst = (CARD8 *) dstBits; for (nbox = RegionNumRects (pClip), pbox = RegionRects(pClip); nbox--; pbox++) { x1 = x; y1 = y; x2 = x + width; y2 = y + height; if (x1 < pbox->x1) x1 = pbox->x1; if (y1 < pbox->y1) y1 = pbox->y1; if (x2 > pbox->x2) x2 = pbox->x2; if (y2 > pbox->y2) y2 = pbox->y2; if (x1 >= x2 || y1 >= y2) continue; fb24_32BltDown (src + (y1 - y) * srcStride, srcStride, (x1 - x), dst + (y1 + dstYoff) * dstStride, dstStride, x1 + dstXoff, (x2 - x1), (y2 - y1), alu, pm); } } void fb24_32GetImage (DrawablePtr pDrawable, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *d) { FbBits *srcBits; CARD8 *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbStride dstStride; FbBits pm; fbGetDrawable (pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff); src = (CARD8 *) srcBits; srcStride *= sizeof (FbBits); x += pDrawable->x; y += pDrawable->y; pm = fbReplicatePixel (planeMask, 32); dstStride = PixmapBytePad(w, pDrawable->depth); if (pm != FB_ALLONES) memset (d, 0, dstStride * h); fb24_32BltUp (src + (y + srcYoff) * srcStride, srcStride, x + srcXoff, (CARD8 *) d, dstStride, 0, w, h, GXcopy, pm); } void fb24_32CopyMtoN (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); FbBits *srcBits; CARD8 *src; FbStride srcStride; int srcBpp; FbBits *dstBits; CARD8 *dst; FbStride dstStride; int dstBpp; fb24_32BltFunc blt; int srcXoff, srcYoff; int dstXoff, dstYoff; fbGetDrawable (pSrcDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff); src = (CARD8 *) srcBits; srcStride *= sizeof (FbBits); fbGetDrawable (pDstDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); dst = (CARD8 *) dstBits; dstStride *= sizeof (FbBits); if (srcBpp == 24) blt = fb24_32BltUp; else blt = fb24_32BltDown; while (nbox--) { (*blt) (src + (pbox->y1 + dy + srcYoff) * srcStride, srcStride, (pbox->x1 + dx + srcXoff), dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff), (pbox->x2 - pbox->x1), (pbox->y2 - pbox->y1), pGC->alu, pPriv->pm); pbox++; } } PixmapPtr fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel) { ScreenPtr pScreen = pOldTile->drawable.pScreen; PixmapPtr pNewTile; FbBits *old, *new; FbStride oldStride, newStride; int oldBpp, newBpp; fb24_32BltFunc blt; _X_UNUSED int oldXoff, oldYoff; _X_UNUSED int newXoff, newYoff; pNewTile = fbCreatePixmapBpp (pScreen, pOldTile->drawable.width, pOldTile->drawable.height, pOldTile->drawable.depth, bitsPerPixel, 0); if (!pNewTile) return 0; fbGetDrawable (&pOldTile->drawable, old, oldStride, oldBpp, oldXoff, oldYoff); fbGetDrawable (&pNewTile->drawable, new, newStride, newBpp, newXoff, newYoff); if (oldBpp == 24) blt = fb24_32BltUp; else blt = fb24_32BltDown; (*blt) ((CARD8 *) old, oldStride * sizeof (FbBits), 0, (CARD8 *) new, newStride * sizeof (FbBits), 0, pOldTile->drawable.width, pOldTile->drawable.height, GXcopy, FB_ALLONES); return pNewTile; } typedef struct { void * pbits; int width; } miScreenInitParmsRec, *miScreenInitParmsPtr; Bool fb24_32CreateScreenResources(ScreenPtr pScreen) { miScreenInitParmsPtr pScrInitParms; int pitch; Bool retval; /* get the pitch before mi destroys it */ pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate; pitch = BitmapBytePad(pScrInitParms->width * 24); if((retval = miCreateScreenResources(pScreen))) { /* fix the screen pixmap */ PixmapPtr pPix = (PixmapPtr)pScreen->devPrivate; pPix->drawable.bitsPerPixel = 24; pPix->devKind = pitch; } return retval; } Bool fb24_32ModifyPixmapHeader (PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, void *pPixData) { int bpp, w; if (!pPixmap) return FALSE; bpp = bitsPerPixel; if (bpp <= 0) bpp = pPixmap->drawable.bitsPerPixel; if (bpp == 24) { if (devKind < 0) { w = width; if (w <= 0) w = pPixmap->drawable.width; devKind = BitmapBytePad(w * 24); } } return miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind, pPixData); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fballpriv.c0000644000000000000000000000520613614532331017312 0ustar /* * Id: fballpriv.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" #ifdef FB_SCREEN_PRIVATE int fbScreenPrivateIndex; int fbGetScreenPrivateIndex(void) { return fbScreenPrivateIndex; } #endif int fbGCPrivateIndex; int fbGetGCPrivateIndex(void) { return fbGCPrivateIndex; } #ifndef FB_NO_WINDOW_PIXMAPS int fbWinPrivateIndex; int fbGetWinPrivateIndex(void) { return fbWinPrivateIndex; } #endif int fbGeneration; #ifdef FB_OLD_SCREEN #define miAllocateGCPrivateIndex() AllocateGCPrivateIndex() #endif Bool fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex) { if (fbGeneration != serverGeneration) { fbGCPrivateIndex = miAllocateGCPrivateIndex (); #ifndef FB_NO_WINDOW_PIXMAPS fbWinPrivateIndex = AllocateWindowPrivateIndex(); #endif #ifdef FB_SCREEN_PRIVATE fbScreenPrivateIndex = AllocateScreenPrivateIndex (); if (fbScreenPrivateIndex == -1) return FALSE; #endif fbGeneration = serverGeneration; } if (pGCIndex) *pGCIndex = fbGCPrivateIndex; if (!AllocateGCPrivate(pScreen, fbGCPrivateIndex, sizeof(FbGCPrivRec))) return FALSE; #ifndef FB_NO_WINDOW_PIXMAPS if (!AllocateWindowPrivate(pScreen, fbWinPrivateIndex, 0)) return FALSE; #endif #ifdef FB_SCREEN_PRIVATE { FbScreenPrivPtr pScreenPriv; pScreenPriv = (FbScreenPrivPtr) malloc (sizeof (FbScreenPrivRec)); if (!pScreenPriv) return FALSE; pScreen->devPrivates[fbScreenPrivateIndex].ptr = (void *) pScreenPriv; } #endif return TRUE; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbarc.c0000644000000000000000000000714413614532331016411 0ustar /* * Id: fbarc.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" #include "mizerarc.h" #include typedef void (*FbArc) (FbBits *dst, FbStride dstStride, int dstBpp, xArc *arc, int dx, int dy, FbBits and, FbBits xor); void fbPolyArc (DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) { FbArc arc; if (pGC->lineWidth == 0) { #ifndef FBNOPIXADDR arc = 0; if (pGC->lineStyle == LineSolid && pGC->fillStyle == FillSolid) { switch (pDrawable->bitsPerPixel) { case 8: arc = fbArc8; break; case 16: arc = fbArc16; break; #ifdef FB_24BIT case 24: arc = fbArc24; break; #endif case 32: arc = fbArc32; break; } } if (arc) { FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; BoxRec box; int x2, y2; RegionPtr cclip; cclip = fbGetCompositeClip (pGC); fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); while (narcs--) { if (miCanZeroArc (parcs)) { box.x1 = parcs->x + pDrawable->x; box.y1 = parcs->y + pDrawable->y; /* * Because box.x2 and box.y2 get truncated to 16 bits, and the * RECT_IN_REGION test treats the resulting number as a signed * integer, the RECT_IN_REGION test alone can go the wrong way. * This can result in a server crash because the rendering * routines in this file deal directly with cpu addresses * of pixels to be stored, and do not clip or otherwise check * that all such addresses are within their respective pixmaps. * So we only allow the RECT_IN_REGION test to be used for * values that can be expressed correctly in a signed short. */ x2 = box.x1 + (int)parcs->width + 1; box.x2 = x2; y2 = box.y1 + (int)parcs->height + 1; box.y2 = y2; if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) && (RegionContainsRect(cclip, &box) == rgnIN) ) (*arc) (dst, dstStride, dstBpp, parcs, pDrawable->x + dstXoff, pDrawable->y + dstYoff, pPriv->and, pPriv->xor); else miZeroPolyArc(pDrawable, pGC, 1, parcs); } else miPolyArc(pDrawable, pGC, 1, parcs); parcs++; } } else #endif miZeroPolyArc (pDrawable, pGC, narcs, parcs); } else miPolyArc (pDrawable, pGC, narcs, parcs); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbbits.c0000644000000000000000000001101613614532331016576 0ustar /* * Id: fbbits.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" #include "miline.h" #include "mizerarc.h" #undef BRESSOLID #undef BRESDASH #undef DOTS #undef ARC #undef GLYPH #undef BITS #undef BITS2 #undef BITS4 #define BRESSOLID fbBresSolid8 #define BRESDASH fbBresDash8 #define DOTS fbDots8 #define ARC fbArc8 #define GLYPH fbGlyph8 #define POLYLINE fbPolyline8 #define POLYSEGMENT fbPolySegment8 #define BITS BYTE #define BITS2 CARD16 #define BITS4 CARD32 #include "fbbits.h" #undef BRESSOLID #undef BRESDASH #undef DOTS #undef ARC #undef GLYPH #undef POLYLINE #undef POLYSEGMENT #undef BITS #undef BITS2 #undef BITS4 #define BRESSOLID fbBresSolid16 #define BRESDASH fbBresDash16 #define DOTS fbDots16 #define ARC fbArc16 #define GLYPH fbGlyph16 #define POLYLINE fbPolyline16 #define POLYSEGMENT fbPolySegment16 #define BITS CARD16 #define BITS2 CARD32 #if FB_SHIFT == 6 #define BITS4 FbBits #endif #include "fbbits.h" #undef BRESSOLID #undef BRESDASH #undef DOTS #undef ARC #undef GLYPH #undef POLYLINE #undef POLYSEGMENT #undef BITS #undef BITS2 #if FB_SHIFT == 6 #undef BITS4 #endif #ifdef FB_24BIT #define BRESSOLID fbBresSolid24 #define BRESDASH fbBresDash24 #define DOTS fbDots24 #define ARC fbArc24 #define POLYLINE fbPolyline24 #define POLYSEGMENT fbPolySegment24 #define BITS CARD32 #define BITSUNIT BYTE #define BITSMUL 3 #define FbDoTypeStore(b,t,x,s) (*((t *) (b)) = (x) >> (s)) #define FbDoTypeRRop(b,t,a,x,s) (*((t *) (b)) = FbDoRRop(*((t *) (b)),\ (a) >> (s), \ (x) >> (s))) #define FbDoTypeMaskRRop(b,t,a,x,m,s) (*((t *) (b)) = FbDoMaskRRop(*((t *) (b)),\ (a) >> (s), \ (x) >> (s), \ (m) >> (s)) #if BITMAP_BIT_ORDER == LSBFirst #define BITSSTORE(b,x) ((unsigned long) (b) & 1 ? \ (FbDoTypeStore (b, CARD8, x, 0), \ FbDoTypeStore ((b) + 1, CARD16, x, 8)) : \ (FbDoTypeStore (b, CARD16, x, 0), \ FbDoTypeStore ((b) + 2, CARD8, x, 16))) #define BITSRROP(b,a,x) ((unsigned long) (b) & 1 ? \ (FbDoTypeRRop(b,CARD8,a,x,0), \ FbDoTypeRRop((b)+1,CARD16,a,x,8)) : \ (FbDoTypeRRop(b,CARD16,a,x,0), \ FbDoTypeRRop((b)+2,CARD8,a,x,16))) #else #define BITSSTORE(b,x) ((unsigned long) (b) & 1 ? \ (FbDoTypeStore (b, CARD8, x, 16), \ FbDoTypeStore ((b) + 1, CARD16, x, 0)) : \ (FbDoTypeStore (b, CARD16, x, 8), \ FbDoTypeStore ((b) + 2, CARD8, x, 0))) #define BITSRROP(b,a,x) ((unsigned long) (b) & 1 ? \ (FbDoTypeRRop (b, CARD8, a, x, 16), \ FbDoTypeRRop ((b) + 1, CARD16, a, x, 0)) : \ (FbDoTypeRRop (b, CARD16, a, x, 8), \ FbDoTypeRRop ((b) + 2, CARD8, a, x, 0))) #endif #include "fbbits.h" #undef BITSSTORE #undef BITSRROP #undef BITSMUL #undef BITSUNIT #undef BITS #undef BRESSOLID #undef BRESDASH #undef DOTS #undef ARC #undef POLYLINE #undef POLYSEGMENT #endif /* FB_24BIT */ #define BRESSOLID fbBresSolid32 #define BRESDASH fbBresDash32 #define DOTS fbDots32 #define ARC fbArc32 #define GLYPH fbGlyph32 #define POLYLINE fbPolyline32 #define POLYSEGMENT fbPolySegment32 #define BITS CARD32 #if FB_SHIFT == 6 #define BITS2 FbBits #endif #include "fbbits.h" #undef BRESSOLID #undef BRESDASH #undef DOTS #undef ARC #undef GLYPH #undef POLYLINE #undef POLYSEGMENT #undef BITS #if FB_SHIFT == 6 #undef BITS2 #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbbits.h0000644000000000000000000004764213614532331016621 0ustar /* * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* * This file defines functions for drawing some primitives using * underlying datatypes instead of masks */ #define isClipped(c,ul,lr) ((((c) - (ul)) | ((lr) - (c))) & 0x80008000) #ifdef HAVE_DIX_CONFIG_H #include #endif #ifdef BITSMUL #define MUL BITSMUL #else #define MUL 1 #endif #ifdef BITSSTORE #define STORE(b,x) BITSSTORE(b,x) #else #define STORE(b,x) (*(b) = (x)) #endif #ifdef BITSRROP #define RROP(b,a,x) BITSRROP(b,a,x) #else #define RROP(b,a,x) (*(b) = FbDoRRop (*(b), (a), (x))) #endif #ifdef BITSUNIT #define UNIT BITSUNIT #define USE_SOLID #else #define UNIT BITS #endif /* * Define the following before including this file: * * BRESSOLID name of function for drawing a solid segment * BRESDASH name of function for drawing a dashed segment * DOTS name of function for drawing dots * ARC name of function for drawing a solid arc * BITS type of underlying unit */ #ifdef BRESSOLID void BRESSOLID (DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); UNIT *bits; FbStride bitsStride; FbStride majorStep, minorStep; BITS xor = (BITS) pPriv->xor; fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); bits = ((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff) * MUL; bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT)); if (signdy < 0) bitsStride = -bitsStride; if (axis == X_AXIS) { majorStep = signdx * MUL; minorStep = bitsStride; } else { majorStep = bitsStride; minorStep = signdx * MUL; } while (len--) { STORE(bits,xor); bits += majorStep; e += e1; if (e >= 0) { bits += minorStep; e += e3; } } } #endif #ifdef BRESDASH void BRESDASH (DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); UNIT *bits; FbStride bitsStride; FbStride majorStep, minorStep; BITS xorfg, xorbg; FbDashDeclare; int dashlen; Bool even; Bool doOdd; fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); doOdd = pGC->lineStyle == LineDoubleDash; xorfg = (BITS) pPriv->xor; xorbg = (BITS) pPriv->bgxor; FbDashInit (pGC, pPriv, dashOffset, dashlen, even); bits = ((UNIT *) (dst + ((y1 + dstYoff) * dstStride))) + (x1 + dstXoff) * MUL; bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT)); if (signdy < 0) bitsStride = -bitsStride; if (axis == X_AXIS) { majorStep = signdx * MUL; minorStep = bitsStride; } else { majorStep = bitsStride; minorStep = signdx * MUL; } if (dashlen >= len) dashlen = len; if (doOdd) { if (!even) goto doubleOdd; for (;;) { len -= dashlen; while (dashlen--) { STORE(bits,xorfg); bits += majorStep; if ((e += e1) >= 0) { e += e3; bits += minorStep; } } if (!len) break; FbDashNextEven(dashlen); if (dashlen >= len) dashlen = len; doubleOdd: len -= dashlen; while (dashlen--) { STORE(bits,xorbg); bits += majorStep; if ((e += e1) >= 0) { e += e3; bits += minorStep; } } if (!len) break; FbDashNextOdd(dashlen); if (dashlen >= len) dashlen = len; } } else { if (!even) goto onOffOdd; for (;;) { len -= dashlen; while (dashlen--) { STORE(bits,xorfg); bits += majorStep; if ((e += e1) >= 0) { e += e3; bits += minorStep; } } if (!len) break; FbDashNextEven (dashlen); if (dashlen >= len) dashlen = len; onOffOdd: len -= dashlen; while (dashlen--) { bits += majorStep; if ((e += e1) >= 0) { e += e3; bits += minorStep; } } if (!len) break; FbDashNextOdd (dashlen); if (dashlen >= len) dashlen = len; } } } #endif #ifdef DOTS void DOTS (FbBits *dst, FbStride dstStride, int dstBpp, BoxPtr pBox, xPoint *ptsOrig, int npt, int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor) { INT32 *pts = (INT32 *) ptsOrig; UNIT *bits = (UNIT *) dst; UNIT *point; BITS bxor = (BITS) xor; BITS band = (BITS) and; FbStride bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT)); INT32 ul, lr; INT32 pt; ul = coordToInt(pBox->x1 - xorg, pBox->y1 - yorg); lr = coordToInt(pBox->x2 - xorg - 1, pBox->y2 - yorg - 1); bits += bitsStride * (yorg + yoff) + (xorg + xoff) * MUL; if (and == 0) { while (npt--) { pt = *pts++; if (!isClipped(pt,ul,lr)) { point = bits + intToY(pt) * bitsStride + intToX(pt) * MUL; STORE(point,bxor); } } } else { while (npt--) { pt = *pts++; if (!isClipped(pt,ul,lr)) { point = bits + intToY(pt) * bitsStride + intToX(pt) * MUL; RROP(point,band,bxor); } } } } #endif #ifdef ARC #define ARCCOPY(d) STORE(d,xorBits) #define ARCRROP(d) RROP(d,andBits,xorBits) void ARC (FbBits *dst, FbStride dstStride, int dstBpp, xArc *arc, int drawX, int drawY, FbBits and, FbBits xor) { UNIT *bits; FbStride bitsStride; miZeroArcRec info; Bool do360; int x; UNIT *yorgp, *yorgop; BITS andBits, xorBits; int yoffset, dyoffset; int y, a, b, d, mask; int k1, k3, dx, dy; bits = (UNIT *) dst; bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT)); andBits = (BITS) and; xorBits = (BITS) xor; do360 = miZeroArcSetup(arc, &info, TRUE); yorgp = bits + ((info.yorg + drawY) * bitsStride); yorgop = bits + ((info.yorgo + drawY) * bitsStride); info.xorg = (info.xorg + drawX) * MUL; info.xorgo = (info.xorgo + drawX) * MUL; MIARCSETUP(); yoffset = y ? bitsStride : 0; dyoffset = 0; mask = info.initialMask; if (!(arc->width & 1)) { if (andBits == 0) { if (mask & 2) ARCCOPY(yorgp + info.xorgo); if (mask & 8) ARCCOPY(yorgop + info.xorgo); } else { if (mask & 2) ARCRROP(yorgp + info.xorgo); if (mask & 8) ARCRROP(yorgop + info.xorgo); } } if (!info.end.x || !info.end.y) { mask = info.end.mask; info.end = info.altend; } if (do360 && (arc->width == arc->height) && !(arc->width & 1)) { int xoffset = bitsStride; UNIT *yorghb = yorgp + (info.h * bitsStride) + info.xorg; UNIT *yorgohb = yorghb - info.h * MUL; yorgp += info.xorg; yorgop += info.xorg; yorghb += info.h * MUL; while (1) { if (andBits == 0) { ARCCOPY(yorgp + yoffset + x * MUL); ARCCOPY(yorgp + yoffset - x * MUL); ARCCOPY(yorgop - yoffset - x * MUL); ARCCOPY(yorgop - yoffset + x * MUL); } else { ARCRROP(yorgp + yoffset + x * MUL); ARCRROP(yorgp + yoffset - x * MUL); ARCRROP(yorgop - yoffset - x * MUL); ARCRROP(yorgop - yoffset + x * MUL); } if (a < 0) break; if (andBits == 0) { ARCCOPY(yorghb - xoffset - y * MUL); ARCCOPY(yorgohb - xoffset + y * MUL); ARCCOPY(yorgohb + xoffset + y * MUL); ARCCOPY(yorghb + xoffset - y * MUL); } else { ARCRROP(yorghb - xoffset - y * MUL); ARCRROP(yorgohb - xoffset + y * MUL); ARCRROP(yorgohb + xoffset + y * MUL); ARCRROP(yorghb + xoffset - y * MUL); } xoffset += bitsStride; MIARCCIRCLESTEP(yoffset += bitsStride;); } yorgp -= info.xorg; yorgop -= info.xorg; x = info.w; yoffset = info.h * bitsStride; } else if (do360) { while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(dyoffset = bitsStride;); if (andBits == 0) { ARCCOPY(yorgp + yoffset + info.xorg + x * MUL); ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL); ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL); ARCCOPY(yorgop - yoffset + info.xorg + x * MUL); } else { ARCRROP(yorgp + yoffset + info.xorg + x * MUL); ARCRROP(yorgp + yoffset + info.xorgo - x * MUL); ARCRROP(yorgop - yoffset + info.xorgo - x * MUL); ARCRROP(yorgop - yoffset + info.xorg + x * MUL); } MIARCSTEP(yoffset += dyoffset;, yoffset += bitsStride;); } } else { while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(dyoffset = bitsStride;); if ((x == info.start.x) || (y == info.start.y)) { mask = info.start.mask; info.start = info.altstart; } if (andBits == 0) { if (mask & 1) ARCCOPY(yorgp + yoffset + info.xorg + x * MUL); if (mask & 2) ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL); if (mask & 4) ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL); if (mask & 8) ARCCOPY(yorgop - yoffset + info.xorg + x * MUL); } else { if (mask & 1) ARCRROP(yorgp + yoffset + info.xorg + x * MUL); if (mask & 2) ARCRROP(yorgp + yoffset + info.xorgo - x * MUL); if (mask & 4) ARCRROP(yorgop - yoffset + info.xorgo - x * MUL); if (mask & 8) ARCRROP(yorgop - yoffset + info.xorg + x * MUL); } if ((x == info.end.x) || (y == info.end.y)) { mask = info.end.mask; info.end = info.altend; } MIARCSTEP(yoffset += dyoffset;, yoffset += bitsStride;); } } if ((x == info.start.x) || (y == info.start.y)) mask = info.start.mask; if (andBits == 0) { if (mask & 1) ARCCOPY(yorgp + yoffset + info.xorg + x * MUL); if (mask & 4) ARCCOPY(yorgop - yoffset + info.xorgo - x * MUL); if (arc->height & 1) { if (mask & 2) ARCCOPY(yorgp + yoffset + info.xorgo - x * MUL); if (mask & 8) ARCCOPY(yorgop - yoffset + info.xorg + x * MUL); } } else { if (mask & 1) ARCRROP(yorgp + yoffset + info.xorg + x * MUL); if (mask & 4) ARCRROP(yorgop - yoffset + info.xorgo - x * MUL); if (arc->height & 1) { if (mask & 2) ARCRROP(yorgp + yoffset + info.xorgo - x * MUL); if (mask & 8) ARCRROP(yorgop - yoffset + info.xorg + x * MUL); } } } #undef ARCCOPY #undef ARCRROP #endif #ifdef GLYPH #if BITMAP_BIT_ORDER == LSBFirst # define WRITE_ADDR1(n) (n) # define WRITE_ADDR2(n) (n) # define WRITE_ADDR4(n) (n) #else # define WRITE_ADDR1(n) ((n) ^ 3) # define WRITE_ADDR2(n) ((n) ^ 2) # define WRITE_ADDR4(n) ((n)) #endif #define WRITE1(d,n,fg) ((d)[WRITE_ADDR1(n)] = (BITS) (fg)) #ifdef BITS2 # define WRITE2(d,n,fg) (*((BITS2 *) &((d)[WRITE_ADDR2(n)])) = (BITS2) (fg)) #else # define WRITE2(d,n,fg) WRITE1(d,(n)+1,WRITE1(d,n,fg)) #endif #ifdef BITS4 # define WRITE4(d,n,fg) (*((BITS4 *) &((d)[WRITE_ADDR4(n)])) = (BITS4) (fg)) #else # define WRITE4(d,n,fg) WRITE2(d,(n)+2,WRITE2(d,n,fg)) #endif void GLYPH (FbBits *dstBits, FbStride dstStride, int dstBpp, FbStip *stipple, FbBits fg, int x, int height) { int lshift; FbStip bits; BITS *dstLine; BITS *dst; int n; int shift; dstLine = (BITS *) dstBits; dstLine += x & ~3; dstStride *= (sizeof (FbBits) / sizeof (BITS)); shift = x & 3; lshift = 4 - shift; while (height--) { bits = *stipple++; dst = (BITS *) dstLine; n = lshift; while (bits) { switch (FbStipMoveLsb (FbLeftStipBits (bits, n), 4, n)) { case 0: break; case 1: WRITE1(dst,0,fg); break; case 2: WRITE1(dst,1,fg); break; case 3: WRITE2(dst,0,fg); break; case 4: WRITE1(dst,2,fg); break; case 5: WRITE1(dst,0,fg); WRITE1(dst,2,fg); break; case 6: WRITE1(dst,1,fg); WRITE1(dst,2,fg); break; case 7: WRITE2(dst,0,fg); WRITE1(dst,2,fg); break; case 8: WRITE1(dst,3,fg); break; case 9: WRITE1(dst,0,fg); WRITE1(dst,3,fg); break; case 10: WRITE1(dst,1,fg); WRITE1(dst,3,fg); break; case 11: WRITE2(dst,0,fg); WRITE1(dst,3,fg); break; case 12: WRITE2(dst,2,fg); break; case 13: WRITE1(dst,0,fg); WRITE2(dst,2,fg); break; case 14: WRITE1(dst,1,fg); WRITE2(dst,2,fg); break; case 15: WRITE4(dst,0,fg); break; } bits = FbStipLeft (bits, n); n = 4; dst += 4; } dstLine += dstStride; } } #undef WRITE_ADDR1 #undef WRITE_ADDR2 #undef WRITE_ADDR4 #undef WRITE1 #undef WRITE2 #undef WRITE4 #endif #ifdef POLYLINE void POLYLINE (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig) { INT32 *pts = (INT32 *) ptsOrig; int xoff = pDrawable->x; int yoff = pDrawable->y; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); BoxPtr pBox = RegionExtents(fbGetCompositeClip (pGC)); FbBits *dst; int dstStride; int dstBpp; int dstXoff, dstYoff; UNIT *bits, *bitsBase; FbStride bitsStride; BITS xor = fbGetGCPrivate(pGC)->xor; BITS and = fbGetGCPrivate(pGC)->and; int dashoffset = 0; INT32 ul, lr; INT32 pt1, pt2; int e, e1, e3, len; int stepmajor, stepminor; int octant; if (mode == CoordModePrevious) fbFixCoordModePrevious (npt, ptsOrig); fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT)); bitsBase = ((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff) * MUL; ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff); lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1); pt1 = *pts++; npt--; pt2 = *pts++; npt--; for (;;) { if (isClipped (pt1, ul, lr) | isClipped (pt2, ul, lr)) { fbSegment (pDrawable, pGC, intToX(pt1) + xoff, intToY(pt1) + yoff, intToX(pt2) + xoff, intToY(pt2) + yoff, npt == 0 && pGC->capStyle != CapNotLast, &dashoffset); if (!npt) return; pt1 = pt2; pt2 = *pts++; npt--; } else { bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1) * MUL; for (;;) { CalcLineDeltas (intToX(pt1), intToY(pt1), intToX(pt2), intToY(pt2), len, e1, stepmajor, stepminor, 1, bitsStride, octant); stepmajor *= MUL; if (len < e1) { e3 = len; len = e1; e1 = e3; e3 = stepminor; stepminor = stepmajor; stepmajor = e3; SetYMajorOctant(octant); } e = -len; e1 <<= 1; e3 = e << 1; FIXUP_ERROR (e, octant, bias); if (and == 0) { while (len--) { STORE(bits,xor); bits += stepmajor; e += e1; if (e >= 0) { bits += stepminor; e += e3; } } } else { while (len--) { RROP(bits,and,xor); bits += stepmajor; e += e1; if (e >= 0) { bits += stepminor; e += e3; } } } if (!npt) { if (pGC->capStyle != CapNotLast && pt2 != *((INT32 *) ptsOrig)) { RROP(bits,and,xor); } return; } pt1 = pt2; pt2 = *pts++; --npt; if (isClipped (pt2, ul, lr)) break; } } } } #endif #ifdef POLYSEGMENT void POLYSEGMENT (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pseg) { INT32 *pts = (INT32 *) pseg; int xoff = pDrawable->x; int yoff = pDrawable->y; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); BoxPtr pBox = RegionExtents(fbGetCompositeClip (pGC)); FbBits *dst; int dstStride; int dstBpp; int dstXoff, dstYoff; UNIT *bits, *bitsBase; FbStride bitsStride; FbBits xorBits = fbGetGCPrivate(pGC)->xor; FbBits andBits = fbGetGCPrivate(pGC)->and; BITS xor = xorBits; BITS and = andBits; int dashoffset = 0; INT32 ul, lr; INT32 pt1, pt2; int e, e1, e3, len; int stepmajor, stepminor; int octant; Bool capNotLast; fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); bitsStride = dstStride * (sizeof (FbBits) / sizeof (UNIT)); bitsBase = ((UNIT *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff) * MUL; ul = coordToInt(pBox->x1 - xoff, pBox->y1 - yoff); lr = coordToInt(pBox->x2 - xoff - 1, pBox->y2 - yoff - 1); capNotLast = pGC->capStyle == CapNotLast; while (nseg--) { pt1 = *pts++; pt2 = *pts++; if (isClipped (pt1, ul, lr) | isClipped (pt2, ul, lr)) { fbSegment (pDrawable, pGC, intToX(pt1) + xoff, intToY(pt1) + yoff, intToX(pt2) + xoff, intToY(pt2) + yoff, !capNotLast, &dashoffset); } else { CalcLineDeltas (intToX(pt1), intToY(pt1), intToX(pt2), intToY(pt2), len, e1, stepmajor, stepminor, 1, bitsStride, octant); if (e1 == 0 && len > 3 #if MUL != 1 && FbCheck24Pix(and) && FbCheck24Pix(xor) #endif ) { int x1, x2; FbBits *dstLine; int dstX, width; FbBits startmask, endmask; int nmiddle; if (stepmajor < 0) { x1 = intToX(pt2); x2 = intToX(pt1) + 1; if (capNotLast) x1++; } else { x1 = intToX(pt1); x2 = intToX(pt2); if (!capNotLast) x2++; } dstX = (x1 + xoff + dstXoff) * (sizeof (UNIT) * 8 * MUL); width = (x2 - x1) * (sizeof (UNIT) * 8 * MUL); dstLine = dst + (intToY(pt1) + yoff + dstYoff) * dstStride; dstLine += dstX >> FB_SHIFT; dstX &= FB_MASK; FbMaskBits (dstX, width, startmask, nmiddle, endmask); if (startmask) { *dstLine = FbDoMaskRRop (*dstLine, andBits, xorBits, startmask); dstLine++; } if (!andBits) while (nmiddle--) *dstLine++ = xorBits; else while (nmiddle--) { *dstLine = FbDoRRop (*dstLine, andBits, xorBits); dstLine++; } if (endmask) *dstLine = FbDoMaskRRop (*dstLine, andBits, xorBits, endmask); } else { stepmajor *= MUL; bits = bitsBase + intToY(pt1) * bitsStride + intToX(pt1) * MUL; if (len < e1) { e3 = len; len = e1; e1 = e3; e3 = stepminor; stepminor = stepmajor; stepmajor = e3; SetYMajorOctant(octant); } e = -len; e1 <<= 1; e3 = e << 1; FIXUP_ERROR (e, octant, bias); if (!capNotLast) len++; if (and == 0) { while (len--) { STORE(bits,xor); bits += stepmajor; e += e1; if (e >= 0) { bits += stepminor; e += e3; } } } else { while (len--) { RROP(bits,and,xor); bits += stepmajor; e += e1; if (e >= 0) { bits += stepminor; e += e3; } } } } } } } #endif #undef MUL #undef STORE #undef RROP #undef UNIT #undef USE_SOLID #undef isClipped nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbblt.c0000644000000000000000000004777613614532331016444 0ustar /* * Id: fbblt.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "fb.h" #define InitializeShifts(sx,dx,ls,rs) { \ if (sx != dx) { \ if (sx > dx) { \ ls = sx - dx; \ rs = FB_UNIT - ls; \ } else { \ rs = dx - sx; \ ls = FB_UNIT - rs; \ } \ } \ } void fbBlt (FbBits *srcLine, FbStride srcStride, int srcX, FbBits *dstLine, FbStride dstStride, int dstX, int width, int height, int alu, FbBits pm, int bpp, Bool reverse, Bool upsidedown) { FbBits *src, *dst; int leftShift, rightShift; FbBits startmask, endmask; FbBits bits, bits1; int n, nmiddle; Bool destInvarient; int startbyte, endbyte; FbDeclareMergeRop (); if (alu == GXcopy && pm == FB_ALLONES && !(srcX & 7) && !(dstX & 7) && !(width & 7)) { CARD8 *src_byte = (CARD8 *) srcLine + (srcX >> 3); CARD8 *dst_byte = (CARD8 *) dstLine + (dstX >> 3); FbStride src_byte_stride = srcStride << (FB_SHIFT - 3); FbStride dst_byte_stride = dstStride << (FB_SHIFT - 3); int width_byte = (width >> 3); /* Make sure there's no overlap; we can't use memcpy in that * case as it's not well defined, so fall through to the * general code */ if (src_byte + width_byte <= dst_byte || dst_byte + width_byte <= src_byte) { int i; if (!upsidedown) for (i = 0; i < height; i++) memcpy(dst_byte + i * dst_byte_stride, src_byte + i * src_byte_stride, width_byte); else for (i = height - 1; i >= 0; i--) memcpy(dst_byte + i * dst_byte_stride, src_byte + i * src_byte_stride, width_byte); return; } } #ifdef FB_24BIT if (bpp == 24 && !FbCheck24Pix (pm)) { fbBlt24 (srcLine, srcStride, srcX, dstLine, dstStride, dstX, width, height, alu, pm, reverse, upsidedown); return; } #endif FbInitializeMergeRop(alu, pm); destInvarient = FbDestInvarientMergeRop(); if (upsidedown) { srcLine += (height - 1) * (srcStride); dstLine += (height - 1) * (dstStride); srcStride = -srcStride; dstStride = -dstStride; } FbMaskBitsBytes (dstX, width, destInvarient, startmask, startbyte, nmiddle, endmask, endbyte); if (reverse) { srcLine += ((srcX + width - 1) >> FB_SHIFT) + 1; dstLine += ((dstX + width - 1) >> FB_SHIFT) + 1; srcX = (srcX + width - 1) & FB_MASK; dstX = (dstX + width - 1) & FB_MASK; } else { srcLine += srcX >> FB_SHIFT; dstLine += dstX >> FB_SHIFT; srcX &= FB_MASK; dstX &= FB_MASK; } if (srcX == dstX) { while (height--) { src = srcLine; srcLine += srcStride; dst = dstLine; dstLine += dstStride; if (reverse) { if (endmask) { bits = *--src; --dst; FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); } n = nmiddle; if (destInvarient) { while (n--) *--dst = FbDoDestInvarientMergeRop(*--src); } else { while (n--) { bits = *--src; --dst; *dst = FbDoMergeRop (bits, *dst); } } if (startmask) { bits = *--src; --dst; FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); } } else { if (startmask) { bits = *src++; FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); dst++; } n = nmiddle; if (destInvarient) { #if 0 /* * This provides some speedup on screen->screen blts * over the PCI bus, usually about 10%. But fb * isn't usually used for this operation... */ if (_ca2 + 1 == 0 && _cx2 == 0) { FbBits t1, t2, t3, t4; while (n >= 4) { t1 = *src++; t2 = *src++; t3 = *src++; t4 = *src++; *dst++ = t1; *dst++ = t2; *dst++ = t3; *dst++ = t4; n -= 4; } } #endif while (n--) *dst++ = FbDoDestInvarientMergeRop(*src++); } else { while (n--) { bits = *src++; *dst = FbDoMergeRop (bits, *dst); dst++; } } if (endmask) { bits = *src; FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); } } } } else { if (srcX > dstX) { leftShift = srcX - dstX; rightShift = FB_UNIT - leftShift; } else { rightShift = dstX - srcX; leftShift = FB_UNIT - rightShift; } while (height--) { src = srcLine; srcLine += srcStride; dst = dstLine; dstLine += dstStride; bits1 = 0; if (reverse) { if (srcX < dstX) bits1 = *--src; if (endmask) { bits = FbScrRight(bits1, rightShift); if (FbScrRight(endmask, leftShift)) { bits1 = *--src; bits |= FbScrLeft(bits1, leftShift); } --dst; FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); } n = nmiddle; if (destInvarient) { while (n--) { bits = FbScrRight(bits1, rightShift); bits1 = *--src; bits |= FbScrLeft(bits1, leftShift); --dst; *dst = FbDoDestInvarientMergeRop(bits); } } else { while (n--) { bits = FbScrRight(bits1, rightShift); bits1 = *--src; bits |= FbScrLeft(bits1, leftShift); --dst; *dst = FbDoMergeRop(bits, *dst); } } if (startmask) { bits = FbScrRight(bits1, rightShift); if (FbScrRight(startmask, leftShift)) { bits1 = *--src; bits |= FbScrLeft(bits1, leftShift); } --dst; FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask); } } else { if (srcX > dstX) bits1 = *src++; if (startmask) { bits = FbScrLeft(bits1, leftShift); if (FbScrLeft(startmask, rightShift)) { bits1 = *src++; bits |= FbScrRight(bits1, rightShift); } FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask); dst++; } n = nmiddle; if (destInvarient) { while (n--) { bits = FbScrLeft(bits1, leftShift); bits1 = *src++; bits |= FbScrRight(bits1, rightShift); *dst = FbDoDestInvarientMergeRop(bits); dst++; } } else { while (n--) { bits = FbScrLeft(bits1, leftShift); bits1 = *src++; bits |= FbScrRight(bits1, rightShift); *dst = FbDoMergeRop(bits, *dst); dst++; } } if (endmask) { bits = FbScrLeft(bits1, leftShift); if (FbScrLeft(endmask, rightShift)) { bits1 = *src; bits |= FbScrRight(bits1, rightShift); } FbDoRightMaskByteMergeRop (dst, bits, endbyte, endmask); } } } } } #ifdef FB_24BIT #undef DEBUG_BLT24 #ifdef DEBUG_BLT24 static unsigned long getPixel (char *src, int x) { unsigned long l; l = 0; memcpy (&l, src + x * 3, 3); return l; } #endif static void fbBlt24Line (FbBits *src, int srcX, FbBits *dst, int dstX, int width, int alu, FbBits pm, Bool reverse) { #ifdef DEBUG_BLT24 char *origDst = (char *) dst; FbBits *origLine = dst + ((dstX >> FB_SHIFT) - 1); int origNlw = ((width + FB_MASK) >> FB_SHIFT) + 3; int origX = dstX / 24; #endif int leftShift, rightShift; FbBits startmask, endmask; int n; FbBits bits, bits1; FbBits mask; int rot; FbDeclareMergeRop (); FbInitializeMergeRop (alu, FB_ALLONES); FbMaskBits(dstX, width, startmask, n, endmask); #ifdef DEBUG_BLT24 ErrorF ("dstX %d width %d reverse %d\n", dstX, width, reverse); #endif if (reverse) { src += ((srcX + width - 1) >> FB_SHIFT) + 1; dst += ((dstX + width - 1) >> FB_SHIFT) + 1; rot = FbFirst24Rot (((dstX + width - 8) & FB_MASK)); rot = FbPrev24Rot(rot); #ifdef DEBUG_BLT24 ErrorF ("dstX + width - 8: %d rot: %d\n", (dstX + width - 8) & FB_MASK, rot); #endif srcX = (srcX + width - 1) & FB_MASK; dstX = (dstX + width - 1) & FB_MASK; } else { src += srcX >> FB_SHIFT; dst += dstX >> FB_SHIFT; srcX &= FB_MASK; dstX &= FB_MASK; rot = FbFirst24Rot (dstX); #ifdef DEBUG_BLT24 ErrorF ("dstX: %d rot: %d\n", dstX, rot); #endif } mask = FbRot24(pm,rot); #ifdef DEBUG_BLT24 ErrorF ("pm 0x%x mask 0x%x\n", pm, mask); #endif if (srcX == dstX) { if (reverse) { if (endmask) { bits = *--src; --dst; *dst = FbDoMaskMergeRop (bits, *dst, mask & endmask); mask = FbPrev24Pix (mask); } while (n--) { bits = *--src; --dst; *dst = FbDoMaskMergeRop (bits, *dst, mask); mask = FbPrev24Pix (mask); } if (startmask) { bits = *--src; --dst; *dst = FbDoMaskMergeRop(bits, *dst, mask & startmask); } } else { if (startmask) { bits = *src++; *dst = FbDoMaskMergeRop (bits, *dst, mask & startmask); dst++; mask = FbNext24Pix(mask); } while (n--) { bits = *src++; *dst = FbDoMaskMergeRop (bits, *dst, mask); dst++; mask = FbNext24Pix(mask); } if (endmask) { bits = *src; *dst = FbDoMaskMergeRop(bits, *dst, mask & endmask); } } } else { if (srcX > dstX) { leftShift = srcX - dstX; rightShift = FB_UNIT - leftShift; } else { rightShift = dstX - srcX; leftShift = FB_UNIT - rightShift; } bits1 = 0; if (reverse) { if (srcX < dstX) bits1 = *--src; if (endmask) { bits = FbScrRight(bits1, rightShift); if (FbScrRight(endmask, leftShift)) { bits1 = *--src; bits |= FbScrLeft(bits1, leftShift); } --dst; *dst = FbDoMaskMergeRop (bits, *dst, mask & endmask); mask = FbPrev24Pix(mask); } while (n--) { bits = FbScrRight(bits1, rightShift); bits1 = *--src; bits |= FbScrLeft(bits1, leftShift); --dst; *dst = FbDoMaskMergeRop(bits, *dst, mask); mask = FbPrev24Pix(mask); } if (startmask) { bits = FbScrRight(bits1, rightShift); if (FbScrRight(startmask, leftShift)) { bits1 = *--src; bits |= FbScrLeft(bits1, leftShift); } --dst; *dst = FbDoMaskMergeRop (bits, *dst, mask & startmask); } } else { if (srcX > dstX) bits1 = *src++; if (startmask) { bits = FbScrLeft(bits1, leftShift); bits1 = *src++; bits |= FbScrRight(bits1, rightShift); *dst = FbDoMaskMergeRop (bits, *dst, mask & startmask); dst++; mask = FbNext24Pix(mask); } while (n--) { bits = FbScrLeft(bits1, leftShift); bits1 = *src++; bits |= FbScrRight(bits1, rightShift); *dst = FbDoMaskMergeRop(bits, *dst, mask); dst++; mask = FbNext24Pix(mask); } if (endmask) { bits = FbScrLeft(bits1, leftShift); if (FbScrLeft(endmask, rightShift)) { bits1 = *src; bits |= FbScrRight(bits1, rightShift); } *dst = FbDoMaskMergeRop (bits, *dst, mask & endmask); } } } #ifdef DEBUG_BLT24 { int firstx, lastx, x; firstx = origX; if (firstx) firstx--; lastx = origX + width/24 + 1; for (x = firstx; x <= lastx; x++) ErrorF ("%06x ", getPixel (origDst, x)); ErrorF ("\n"); while (origNlw--) ErrorF ("%08x ", *origLine++); ErrorF ("\n"); } #endif } void fbBlt24 (FbBits *srcLine, FbStride srcStride, int srcX, FbBits *dstLine, FbStride dstStride, int dstX, int width, int height, int alu, FbBits pm, Bool reverse, Bool upsidedown) { if (upsidedown) { srcLine += (height-1) * srcStride; dstLine += (height-1) * dstStride; srcStride = -srcStride; dstStride = -dstStride; } while (height--) { fbBlt24Line (srcLine, srcX, dstLine, dstX, width, alu, pm, reverse); srcLine += srcStride; dstLine += dstStride; } #ifdef DEBUG_BLT24 ErrorF ("\n"); #endif } #endif /* FB_24BIT */ #if FB_SHIFT == FB_STIP_SHIFT + 1 /* * Could be generalized to FB_SHIFT > FB_STIP_SHIFT + 1 by * creating an ring of values stepped through for each line */ void fbBltOdd (FbBits *srcLine, FbStride srcStrideEven, FbStride srcStrideOdd, int srcXEven, int srcXOdd, FbBits *dstLine, FbStride dstStrideEven, FbStride dstStrideOdd, int dstXEven, int dstXOdd, int width, int height, int alu, FbBits pm, int bpp) { FbBits *src; int leftShiftEven, rightShiftEven; FbBits startmaskEven, endmaskEven; int nmiddleEven; FbBits *dst; int leftShiftOdd, rightShiftOdd; FbBits startmaskOdd, endmaskOdd; int nmiddleOdd; int leftShift, rightShift; FbBits startmask, endmask; int nmiddle; int srcX, dstX; FbBits bits, bits1; int n; Bool destInvarient; Bool even; FbDeclareMergeRop (); FbInitializeMergeRop (alu, pm); destInvarient = FbDestInvarientMergeRop(); srcLine += srcXEven >> FB_SHIFT; dstLine += dstXEven >> FB_SHIFT; srcXEven &= FB_MASK; dstXEven &= FB_MASK; srcXOdd &= FB_MASK; dstXOdd &= FB_MASK; FbMaskBits(dstXEven, width, startmaskEven, nmiddleEven, endmaskEven); FbMaskBits(dstXOdd, width, startmaskOdd, nmiddleOdd, endmaskOdd); even = TRUE; InitializeShifts(srcXEven, dstXEven, leftShiftEven, rightShiftEven); InitializeShifts(srcXOdd, dstXOdd, leftShiftOdd, rightShiftOdd); while (height--) { src = srcLine; dst = dstLine; if (even) { srcX = srcXEven; dstX = dstXEven; startmask = startmaskEven; endmask = endmaskEven; nmiddle = nmiddleEven; leftShift = leftShiftEven; rightShift = rightShiftEven; srcLine += srcStrideEven; dstLine += dstStrideEven; even = FALSE; } else { srcX = srcXOdd; dstX = dstXOdd; startmask = startmaskOdd; endmask = endmaskOdd; nmiddle = nmiddleOdd; leftShift = leftShiftOdd; rightShift = rightShiftOdd; srcLine += srcStrideOdd; dstLine += dstStrideOdd; even = TRUE; } if (srcX == dstX) { if (startmask) { bits = *src++; *dst = FbDoMaskMergeRop (bits, *dst, startmask); dst++; } n = nmiddle; if (destInvarient) { while (n--) { bits = *src++; *dst = FbDoDestInvarientMergeRop(bits); dst++; } } else { while (n--) { bits = *src++; *dst = FbDoMergeRop (bits, *dst); dst++; } } if (endmask) { bits = *src; *dst = FbDoMaskMergeRop(bits, *dst, endmask); } } else { bits = 0; if (srcX > dstX) bits = *src++; if (startmask) { bits1 = FbScrLeft(bits, leftShift); bits = *src++; bits1 |= FbScrRight(bits, rightShift); *dst = FbDoMaskMergeRop (bits1, *dst, startmask); dst++; } n = nmiddle; if (destInvarient) { while (n--) { bits1 = FbScrLeft(bits, leftShift); bits = *src++; bits1 |= FbScrRight(bits, rightShift); *dst = FbDoDestInvarientMergeRop(bits1); dst++; } } else { while (n--) { bits1 = FbScrLeft(bits, leftShift); bits = *src++; bits1 |= FbScrRight(bits, rightShift); *dst = FbDoMergeRop(bits1, *dst); dst++; } } if (endmask) { bits1 = FbScrLeft(bits, leftShift); if (FbScrLeft(endmask, rightShift)) { bits = *src; bits1 |= FbScrRight(bits, rightShift); } *dst = FbDoMaskMergeRop (bits1, *dst, endmask); } } } } #ifdef FB_24BIT void fbBltOdd24 (FbBits *srcLine, FbStride srcStrideEven, FbStride srcStrideOdd, int srcXEven, int srcXOdd, FbBits *dstLine, FbStride dstStrideEven, FbStride dstStrideOdd, int dstXEven, int dstXOdd, int width, int height, int alu, FbBits pm) { Bool even = TRUE; while (height--) { if (even) { fbBlt24Line (srcLine, srcXEven, dstLine, dstXEven, width, alu, pm, FALSE); srcLine += srcStrideEven; dstLine += dstStrideEven; even = FALSE; } else { fbBlt24Line (srcLine, srcXOdd, dstLine, dstXOdd, width, alu, pm, FALSE); srcLine += srcStrideOdd; dstLine += dstStrideOdd; even = TRUE; } } #if 0 fprintf (stderr, "\n"); #endif } #endif #endif #if FB_STIP_SHIFT != FB_SHIFT void fbSetBltOdd (FbStip *stip, FbStride stipStride, int srcX, FbBits **bits, FbStride *strideEven, FbStride *strideOdd, int *srcXEven, int *srcXOdd) { int srcAdjust; int strideAdjust; /* * bytes needed to align source */ srcAdjust = (((int) stip) & (FB_MASK >> 3)); /* * FbStip units needed to align stride */ strideAdjust = stipStride & (FB_MASK >> FB_STIP_SHIFT); *bits = (FbBits *) ((char *) stip - srcAdjust); if (srcAdjust) { *strideEven = FbStipStrideToBitsStride (stipStride + 1); *strideOdd = FbStipStrideToBitsStride (stipStride); *srcXEven = srcX + (srcAdjust << 3); *srcXOdd = srcX + (srcAdjust << 3) - (strideAdjust << FB_STIP_SHIFT); } else { *strideEven = FbStipStrideToBitsStride (stipStride); *strideOdd = FbStipStrideToBitsStride (stipStride + 1); *srcXEven = srcX; *srcXOdd = srcX + (strideAdjust << FB_STIP_SHIFT); } } #endif void fbBltStip (FbStip *src, FbStride srcStride, /* in FbStip units, not FbBits units */ int srcX, FbStip *dst, FbStride dstStride, /* in FbStip units, not FbBits units */ int dstX, int width, int height, int alu, FbBits pm, int bpp) { #if FB_STIP_SHIFT != FB_SHIFT if (FB_STIP_ODDSTRIDE(srcStride) || FB_STIP_ODDPTR(src) || FB_STIP_ODDSTRIDE(dstStride) || FB_STIP_ODDPTR(dst)) { FbStride srcStrideEven, srcStrideOdd; FbStride dstStrideEven, dstStrideOdd; int srcXEven, srcXOdd; int dstXEven, dstXOdd; FbBits *s, *d; int sx, dx; src += srcX >> FB_STIP_SHIFT; srcX &= FB_STIP_MASK; dst += dstX >> FB_STIP_SHIFT; dstX &= FB_STIP_MASK; fbSetBltOdd (src, srcStride, srcX, &s, &srcStrideEven, &srcStrideOdd, &srcXEven, &srcXOdd); fbSetBltOdd (dst, dstStride, dstX, &d, &dstStrideEven, &dstStrideOdd, &dstXEven, &dstXOdd); #ifdef FB_24BIT if (bpp == 24 && !FbCheck24Pix (pm)) { fbBltOdd24 (s, srcStrideEven, srcStrideOdd, srcXEven, srcXOdd, d, dstStrideEven, dstStrideOdd, dstXEven, dstXOdd, width, height, alu, pm); } else #endif { fbBltOdd (s, srcStrideEven, srcStrideOdd, srcXEven, srcXOdd, d, dstStrideEven, dstStrideOdd, dstXEven, dstXOdd, width, height, alu, pm, bpp); } } else #endif { fbBlt ((FbBits *) src, FbStipStrideToBitsStride (srcStride), srcX, (FbBits *) dst, FbStipStrideToBitsStride (dstStride), dstX, width, height, alu, pm, bpp, FALSE, FALSE); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbbltone.c0000644000000000000000000005121113614532331017121 0ustar /* * Id: fbbltone.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" /* * Example: srcX = 13 dstX = 8 (FB unit 32 dstBpp 8) * * **** **** **** **** **** **** **** **** * ^ * ******** ******** ******** ******** * ^ * leftShift = 12 * rightShift = 20 * * Example: srcX = 0 dstX = 8 (FB unit 32 dstBpp 8) * * **** **** **** **** **** **** **** **** * ^ * ******** ******** ******** ******** * ^ * * leftShift = 24 * rightShift = 8 */ #define LoadBits {\ if (leftShift) { \ bitsRight = (src < srcEnd ? *src++ : 0); \ bits = (FbStipLeft (bitsLeft, leftShift) | \ FbStipRight(bitsRight, rightShift)); \ bitsLeft = bitsRight; \ } else \ bits = (src < srcEnd ? *src++ : 0); \ } #ifndef FBNOPIXADDR #define LaneCases1(n,a) case n: (void)FbLaneCase(n,a); break #define LaneCases2(n,a) LaneCases1(n,a); LaneCases1(n+1,a) #define LaneCases4(n,a) LaneCases2(n,a); LaneCases2(n+2,a) #define LaneCases8(n,a) LaneCases4(n,a); LaneCases4(n+4,a) #define LaneCases16(n,a) LaneCases8(n,a); LaneCases8(n+8,a) #define LaneCases32(n,a) LaneCases16(n,a); LaneCases16(n+16,a) #define LaneCases64(n,a) LaneCases32(n,a); LaneCases32(n+32,a) #define LaneCases128(n,a) LaneCases64(n,a); LaneCases64(n+64,a) #define LaneCases256(n,a) LaneCases128(n,a); LaneCases128(n+128,a) #if FB_SHIFT == 6 #define LaneCases(a) LaneCases256(0,a) #endif #if FB_SHIFT == 5 #define LaneCases(a) LaneCases16(0,a) #endif #if FB_SHIFT == 6 CARD8 fb8Lane[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,103,104,105,106,107,108,109,110,111,112,113,114,115, 116, 117, 118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133, 134, 135, 136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151, 152, 153, 154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169, 170, 171, 172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187, 188, 189, 190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205, 206, 207, 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, 224, 225, 226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241, 242, 243, 244,245,246,247,248,249,250,251,252,253,254,255, }; CARD8 fb16Lane[256] = { 0x00, 0x03, 0x0c, 0x0f, 0x30, 0x33, 0x3c, 0x3f, 0xc0, 0xc3, 0xcc, 0xcf, 0xf0, 0xf3, 0xfc, 0xff, }; CARD8 fb32Lane[16] = { 0x00, 0x0f, 0xf0, 0xff, }; #endif #if FB_SHIFT == 5 CARD8 fb8Lane[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; CARD8 fb16Lane[16] = { 0, 3, 12, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; CARD8 fb32Lane[16] = { 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; #endif CARD8 *fbLaneTable[33] = { 0, 0, 0, 0, 0, 0, 0, 0, fb8Lane, 0, 0, 0, 0, 0, 0, 0, fb16Lane, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, fb32Lane }; #endif void fbBltOne (FbStip *src, FbStride srcStride, /* FbStip units per scanline */ int srcX, /* bit position of source */ FbBits *dst, FbStride dstStride, /* FbBits units per scanline */ int dstX, /* bit position of dest */ int dstBpp, /* bits per destination unit */ int width, /* width in bits of destination */ int height, /* height in scanlines */ FbBits fgand, /* rrop values */ FbBits fgxor, FbBits bgand, FbBits bgxor) { const FbBits *fbBits; FbBits *srcEnd; int pixelsPerDst; /* dst pixels per FbBits */ int unitsPerSrc; /* src patterns per FbStip */ int leftShift, rightShift; /* align source with dest */ FbBits startmask, endmask; /* dest scanline masks */ FbStip bits=0, bitsLeft, bitsRight;/* source bits */ FbStip left; FbBits mask; int nDst; /* dest longwords (w.o. end) */ int w; int n, nmiddle; int dstS; /* stipple-relative dst X coordinate */ Bool copy; /* accelerate dest-invariant */ Bool transparent; /* accelerate 0 nop */ int srcinc; /* source units consumed */ Bool endNeedsLoad = FALSE; /* need load for endmask */ #ifndef FBNOPIXADDR CARD8 *fbLane; #endif int startbyte, endbyte; #ifdef FB_24BIT if (dstBpp == 24) { fbBltOne24 (src, srcStride, srcX, dst, dstStride, dstX, dstBpp, width, height, fgand, fgxor, bgand, bgxor); return; } #endif /* * Do not read past the end of the buffer! */ srcEnd = src + height * srcStride; /* * Number of destination units in FbBits == number of stipple pixels * used each time */ pixelsPerDst = FB_UNIT / dstBpp; /* * Number of source stipple patterns in FbStip */ unitsPerSrc = FB_STIP_UNIT / pixelsPerDst; copy = FALSE; transparent = FALSE; if (bgand == 0 && fgand == 0) copy = TRUE; else if (bgand == FB_ALLONES && bgxor == 0) transparent = TRUE; /* * Adjust source and dest to nearest FbBits boundary */ src += srcX >> FB_STIP_SHIFT; dst += dstX >> FB_SHIFT; srcX &= FB_STIP_MASK; dstX &= FB_MASK; FbMaskBitsBytes(dstX, width, copy, startmask, startbyte, nmiddle, endmask, endbyte); /* * Compute effective dest alignment requirement for * source -- must align source to dest unit boundary */ dstS = dstX / dstBpp; /* * Compute shift constants for effective alignement */ if (srcX >= dstS) { leftShift = srcX - dstS; rightShift = FB_STIP_UNIT - leftShift; } else { rightShift = dstS - srcX; leftShift = FB_STIP_UNIT - rightShift; } /* * Get pointer to stipple mask array for this depth */ fbBits = 0; /* unused */ if (pixelsPerDst <= 8) fbBits = fbStippleTable[pixelsPerDst]; #ifndef FBNOPIXADDR fbLane = 0; if (transparent && fgand == 0 && dstBpp >= 8) fbLane = fbLaneTable[dstBpp]; #endif /* * Compute total number of destination words written, but * don't count endmask */ nDst = nmiddle; if (startmask) nDst++; dstStride -= nDst; /* * Compute total number of source words consumed */ srcinc = (nDst + unitsPerSrc - 1) / unitsPerSrc; if (srcX > dstS) srcinc++; if (endmask) { endNeedsLoad = nDst % unitsPerSrc == 0; if (endNeedsLoad) srcinc++; } srcStride -= srcinc; /* * Copy rectangle */ while (height--) { w = nDst; /* total units across scanline */ n = unitsPerSrc; /* units avail in single stipple */ if (n > w) n = w; bitsLeft = 0; if (srcX > dstS) bitsLeft = *src++; if (n) { /* * Load first set of stipple bits */ LoadBits; /* * Consume stipple bits for startmask */ if (startmask) { #if FB_UNIT > 32 if (pixelsPerDst == 16) mask = FbStipple16Bits(FbLeftStipBits(bits,16)); else #endif mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)]; #ifndef FBNOPIXADDR if (fbLane) { fbTransparentSpan (dst, mask & startmask, fgxor, 1); } else #endif { if (mask || !transparent) FbDoLeftMaskByteStippleRRop (dst, mask, fgand, fgxor, bgand, bgxor, startbyte, startmask); } bits = FbStipLeft (bits, pixelsPerDst); dst++; n--; w--; } /* * Consume stipple bits across scanline */ for (;;) { w -= n; if (copy) { while (n--) { #if FB_UNIT > 32 if (pixelsPerDst == 16) mask = FbStipple16Bits(FbLeftStipBits(bits,16)); else #endif mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)]; *dst = FbOpaqueStipple (mask, fgxor, bgxor); dst++; bits = FbStipLeft(bits, pixelsPerDst); } } else { #ifndef FBNOPIXADDR if (fbLane) { while (bits && n) { switch (fbLane[FbLeftStipBits(bits,pixelsPerDst)]) { LaneCases((CARD8 *) dst); } bits = FbStipLeft(bits,pixelsPerDst); dst++; n--; } dst += n; } else #endif { while (n--) { left = FbLeftStipBits(bits,pixelsPerDst); if (left || !transparent) { mask = fbBits[left]; *dst = FbStippleRRop (*dst, mask, fgand, fgxor, bgand, bgxor); } dst++; bits = FbStipLeft(bits, pixelsPerDst); } } } if (!w) break; /* * Load another set and reset number of available units */ LoadBits; n = unitsPerSrc; if (n > w) n = w; } } /* * Consume stipple bits for endmask */ if (endmask) { if (endNeedsLoad) { LoadBits; } #if FB_UNIT > 32 if (pixelsPerDst == 16) mask = FbStipple16Bits(FbLeftStipBits(bits,16)); else #endif mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)]; #ifndef FBNOPIXADDR if (fbLane) { fbTransparentSpan (dst, mask & endmask, fgxor, 1); } else #endif { if (mask || !transparent) FbDoRightMaskByteStippleRRop (dst, mask, fgand, fgxor, bgand, bgxor, endbyte, endmask); } } dst += dstStride; src += srcStride; } } #ifdef FB_24BIT /* * Crufty macros to initialize the mask array, most of this * is to avoid compile-time warnings about shift overflow */ #if BITMAP_BIT_ORDER == MSBFirst #define Mask24Pos(x,r) ((x)*24-(r)) #else #define Mask24Pos(x,r) ((x)*24-((r) ? 24 - (r) : 0)) #endif #define Mask24Neg(x,r) (Mask24Pos(x,r) < 0 ? -Mask24Pos(x,r) : 0) #define Mask24Check(x,r) (Mask24Pos(x,r) < 0 ? 0 : \ Mask24Pos(x,r) >= FB_UNIT ? 0 : Mask24Pos(x,r)) #define Mask24(x,r) (Mask24Pos(x,r) < FB_UNIT ? \ (Mask24Pos(x,r) < 0 ? \ 0xffffff >> Mask24Neg (x,r) : \ 0xffffff << Mask24Check(x,r)) : 0) #define SelMask24(b,n,r) ((((b) >> n) & 1) * Mask24(n,r)) /* * Untested for MSBFirst or FB_UNIT == 32 */ #if FB_UNIT == 64 #define C4_24(b,r) \ (SelMask24(b,0,r) | \ SelMask24(b,1,r) | \ SelMask24(b,2,r) | \ SelMask24(b,3,r)) #define FbStip24New(rot) (2 + (rot != 0)) #define FbStip24Len 4 const FbBits fbStipple24Bits[3][1 << FbStip24Len] = { /* rotate 0 */ { C4_24( 0, 0), C4_24( 1, 0), C4_24( 2, 0), C4_24( 3, 0), C4_24( 4, 0), C4_24( 5, 0), C4_24( 6, 0), C4_24( 7, 0), C4_24( 8, 0), C4_24( 9, 0), C4_24(10, 0), C4_24(11, 0), C4_24(12, 0), C4_24(13, 0), C4_24(14, 0), C4_24(15, 0), }, /* rotate 8 */ { C4_24( 0, 8), C4_24( 1, 8), C4_24( 2, 8), C4_24( 3, 8), C4_24( 4, 8), C4_24( 5, 8), C4_24( 6, 8), C4_24( 7, 8), C4_24( 8, 8), C4_24( 9, 8), C4_24(10, 8), C4_24(11, 8), C4_24(12, 8), C4_24(13, 8), C4_24(14, 8), C4_24(15, 8), }, /* rotate 16 */ { C4_24( 0,16), C4_24( 1,16), C4_24( 2,16), C4_24( 3,16), C4_24( 4,16), C4_24( 5,16), C4_24( 6,16), C4_24( 7,16), C4_24( 8,16), C4_24( 9,16), C4_24(10,16), C4_24(11,16), C4_24(12,16), C4_24(13,16), C4_24(14,16), C4_24(15,16), } }; #endif #if FB_UNIT == 32 #define C2_24(b,r) \ (SelMask24(b,0,r) | \ SelMask24(b,1,r)) #define FbStip24Len 2 #if BITMAP_BIT_ORDER == MSBFirst #define FbStip24New(rot) (1 + (rot == 0)) #else #define FbStip24New(rot) (1 + (rot == 8)) #endif const FbBits fbStipple24Bits[3][1 << FbStip24Len] = { /* rotate 0 */ { C2_24( 0, 0), C2_24 ( 1, 0), C2_24 ( 2, 0), C2_24 ( 3, 0), }, /* rotate 8 */ { C2_24( 0, 8), C2_24 ( 1, 8), C2_24 ( 2, 8), C2_24 ( 3, 8), }, /* rotate 16 */ { C2_24( 0,16), C2_24 ( 1,16), C2_24 ( 2,16), C2_24 ( 3,16), } }; #endif #if BITMAP_BIT_ORDER == LSBFirst #define FbMergeStip24Bits(left, right, new) \ (FbStipLeft (left, new) | FbStipRight ((right), (FbStip24Len - (new)))) #define FbMergePartStip24Bits(left, right, llen, rlen) \ (left | FbStipRight(right, llen)) #else #define FbMergeStip24Bits(left, right, new) \ ((FbStipLeft (left, new) & ((1 << FbStip24Len) - 1)) | right) #define FbMergePartStip24Bits(left, right, llen, rlen) \ (FbStipLeft(left, rlen) | right) #endif #define fbFirstStipBits(len,stip) {\ int __len = (len); \ if (len <= remain) { \ stip = FbLeftStipBits(bits, len); \ } else { \ stip = FbLeftStipBits(bits, remain); \ bits = (src < srcEnd ? *src++ : 0); \ __len = (len) - remain; \ stip = FbMergePartStip24Bits(stip, FbLeftStipBits(bits, __len), \ remain, __len); \ remain = FB_STIP_UNIT; \ } \ bits = FbStipLeft (bits, __len); \ remain -= __len; \ } #define fbInitStipBits(offset,len,stip) {\ bits = FbStipLeft (*src++,offset); \ remain = FB_STIP_UNIT - offset; \ fbFirstStipBits(len,stip); \ stip = FbMergeStip24Bits (0, stip, len); \ } #define fbNextStipBits(rot,stip) {\ int __new = FbStip24New(rot); \ FbStip __right; \ fbFirstStipBits(__new, __right); \ stip = FbMergeStip24Bits (stip, __right, __new); \ rot = FbNext24Rot (rot); \ } /* * Use deep mask tables that incorporate rotation, pull * a variable number of bits out of the stipple and * reuse the right bits as needed for the next write * * Yes, this is probably too much code, but most 24-bpp screens * have no acceleration so this code is used for stipples, copyplane * and text */ void fbBltOne24 (FbStip *srcLine, FbStride srcStride, /* FbStip units per scanline */ int srcX, /* bit position of source */ FbBits *dst, FbStride dstStride, /* FbBits units per scanline */ int dstX, /* bit position of dest */ int dstBpp, /* bits per destination unit */ int width, /* width in bits of destination */ int height, /* height in scanlines */ FbBits fgand, /* rrop values */ FbBits fgxor, FbBits bgand, FbBits bgxor) { FbStip *src, *srcEnd; FbBits leftMask, rightMask, mask; int nlMiddle, nl; FbStip stip, bits; int remain; int dstS; int firstlen; int rot0, rot; int nDst; /* * Do not read past the end of the buffer! */ srcEnd = srcLine + height * srcStride; srcLine += srcX >> FB_STIP_SHIFT; dst += dstX >> FB_SHIFT; srcX &= FB_STIP_MASK; dstX &= FB_MASK; rot0 = FbFirst24Rot (dstX); FbMaskBits (dstX, width, leftMask, nlMiddle, rightMask); dstS = (dstX + 23) / 24; firstlen = FbStip24Len - dstS; nDst = nlMiddle; if (leftMask) nDst++; dstStride -= nDst; /* opaque copy */ if (bgand == 0 && fgand == 0) { while (height--) { rot = rot0; src = srcLine; srcLine += srcStride; fbInitStipBits (srcX,firstlen, stip); if (leftMask) { mask = fbStipple24Bits[rot >> 3][stip]; *dst = (*dst & ~leftMask) | (FbOpaqueStipple (mask, FbRot24(fgxor, rot), FbRot24(bgxor, rot)) & leftMask); dst++; fbNextStipBits(rot,stip); } nl = nlMiddle; while (nl--) { mask = fbStipple24Bits[rot>>3][stip]; *dst = FbOpaqueStipple (mask, FbRot24(fgxor, rot), FbRot24(bgxor, rot)); dst++; fbNextStipBits(rot,stip); } if (rightMask) { mask = fbStipple24Bits[rot >> 3][stip]; *dst = (*dst & ~rightMask) | (FbOpaqueStipple (mask, FbRot24(fgxor, rot), FbRot24(bgxor, rot)) & rightMask); } dst += dstStride; src += srcStride; } } /* transparent copy */ else if (bgand == FB_ALLONES && bgxor == 0 && fgand == 0) { while (height--) { rot = rot0; src = srcLine; srcLine += srcStride; fbInitStipBits (srcX, firstlen, stip); if (leftMask) { if (stip) { mask = fbStipple24Bits[rot >> 3][stip] & leftMask; *dst = (*dst & ~mask) | (FbRot24(fgxor, rot) & mask); } dst++; fbNextStipBits (rot, stip); } nl = nlMiddle; while (nl--) { if (stip) { mask = fbStipple24Bits[rot>>3][stip]; *dst = (*dst & ~mask) | (FbRot24(fgxor,rot) & mask); } dst++; fbNextStipBits (rot, stip); } if (rightMask) { if (stip) { mask = fbStipple24Bits[rot >> 3][stip] & rightMask; *dst = (*dst & ~mask) | (FbRot24(fgxor, rot) & mask); } } dst += dstStride; } } else { while (height--) { rot = rot0; src = srcLine; srcLine += srcStride; fbInitStipBits (srcX, firstlen, stip); if (leftMask) { mask = fbStipple24Bits[rot >> 3][stip]; *dst = FbStippleRRopMask (*dst, mask, FbRot24(fgand, rot), FbRot24(fgxor, rot), FbRot24(bgand, rot), FbRot24(bgxor, rot), leftMask); dst++; fbNextStipBits(rot,stip); } nl = nlMiddle; while (nl--) { mask = fbStipple24Bits[rot >> 3][stip]; *dst = FbStippleRRop (*dst, mask, FbRot24(fgand, rot), FbRot24(fgxor, rot), FbRot24(bgand, rot), FbRot24(bgxor, rot)); dst++; fbNextStipBits(rot,stip); } if (rightMask) { mask = fbStipple24Bits[rot >> 3][stip]; *dst = FbStippleRRopMask (*dst, mask, FbRot24(fgand, rot), FbRot24(fgxor, rot), FbRot24(bgand, rot), FbRot24(bgxor, rot), rightMask); } dst += dstStride; } } } #endif /* * Not very efficient, but simple -- copy a single plane * from an N bit image to a 1 bit image */ void fbBltPlane (FbBits *src, FbStride srcStride, int srcX, int srcBpp, FbStip *dst, FbStride dstStride, int dstX, int width, int height, FbStip fgand, FbStip fgxor, FbStip bgand, FbStip bgxor, Pixel planeMask) { FbBits *s; FbBits pm; FbBits srcMask; FbBits srcMaskFirst; FbBits srcMask0 = 0; FbBits srcBits; FbStip dstBits; FbStip *d; FbStip dstMask; FbStip dstMaskFirst; FbStip dstUnion; int w; int wt; int rot0; if (!width) return; src += srcX >> FB_SHIFT; srcX &= FB_MASK; dst += dstX >> FB_STIP_SHIFT; dstX &= FB_STIP_MASK; w = width / srcBpp; pm = fbReplicatePixel (planeMask, srcBpp); #ifdef FB_24BIT if (srcBpp == 24) { int w = 24; rot0 = FbFirst24Rot (srcX); if (srcX + w > FB_UNIT) w = FB_UNIT - srcX; srcMaskFirst = FbRot24(pm,rot0) & FbBitsMask(srcX,w); } else #endif { rot0 = 0; srcMaskFirst = pm & FbBitsMask(srcX, srcBpp); srcMask0 = pm & FbBitsMask(0, srcBpp); } dstMaskFirst = FbStipMask(dstX,1); while (height--) { d = dst; dst += dstStride; s = src; src += srcStride; srcMask = srcMaskFirst; #ifdef FB_24BIT if (srcBpp == 24) srcMask0 = FbRot24(pm,rot0) & FbBitsMask(0, srcBpp); #endif srcBits = *s++; dstMask = dstMaskFirst; dstUnion = 0; dstBits = 0; wt = w; while (wt--) { if (!srcMask) { srcBits = *s++; #ifdef FB_24BIT if (srcBpp == 24) srcMask0 = FbNext24Pix(srcMask0) & FbBitsMask(0,24); #endif srcMask = srcMask0; } if (!dstMask) { *d = FbStippleRRopMask(*d, dstBits, fgand, fgxor, bgand, bgxor, dstUnion); d++; dstMask = FbStipMask(0,1); dstUnion = 0; dstBits = 0; } if (srcBits & srcMask) dstBits |= dstMask; dstUnion |= dstMask; if (srcBpp == FB_UNIT) srcMask = 0; else srcMask = FbScrRight(srcMask,srcBpp); dstMask = FbStipRight(dstMask,1); } if (dstUnion) *d = FbStippleRRopMask(*d,dstBits, fgand, fgxor, bgand, bgxor, dstUnion); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbbstore.c0000644000000000000000000000370313614532331017137 0ustar /* * Id: fbbstore.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" void fbSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, WindowPtr pWin) { fbCopyWindowProc (&pWin->drawable, &pPixmap->drawable, 0, RegionRects(prgnSave), RegionNumRects(prgnSave), xorg, yorg, FALSE, FALSE, 0,0); } void fbRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, int yorg, WindowPtr pWin) { fbCopyWindowProc (&pPixmap->drawable, &pWin->drawable, 0, RegionRects(prgnRestore), RegionNumRects(prgnRestore), -xorg, -yorg, FALSE, FALSE, 0,0); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbcmap.c0000644000000000000000000004025613614532331016565 0ustar /* $XConsortium: fbcmap.c,v 4.19 94/04/17 20:28:46 dpw Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright no- tice appear in all copies and that both that copyright no- tice and this permission notice appear in supporting docu- mentation, and that the names of Sun or X Consortium not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Sun and X Consortium make no representations about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "scrnintstr.h" #include "colormapst.h" #include "resource.h" #include "fb.h" #ifndef XFree86Server ColormapPtr FbInstalledMaps[MAXSCREENS]; int fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps) { /* By the time we are processing requests, we can guarantee that there * is always a colormap installed */ *pmaps = FbInstalledMaps[pScreen->myNum]->mid; return (1); } void fbInstallColormap(ColormapPtr pmap) { int index = pmap->pScreen->myNum; ColormapPtr oldpmap = FbInstalledMaps[index]; if(pmap != oldpmap) { /* Uninstall pInstalledMap. No hardware changes required, just * notify all interested parties. */ if(oldpmap != (ColormapPtr)None) WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid); /* Install pmap */ FbInstalledMaps[index] = pmap; WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid); } } void fbUninstallColormap(ColormapPtr pmap) { int index = pmap->pScreen->myNum; ColormapPtr curpmap = FbInstalledMaps[index]; if(pmap == curpmap) { if (pmap->mid != pmap->pScreen->defColormap) { curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, RT_COLORMAP); (*pmap->pScreen->InstallColormap)(curpmap); } } } void fbResolveColor(unsigned short *pred, unsigned short *pgreen, unsigned short *pblue, VisualPtr pVisual) { int shift = 16 - pVisual->bitsPerRGBValue; unsigned lim = (1 << pVisual->bitsPerRGBValue) - 1; if ((pVisual->class | DynamicClass) == GrayScale) { /* rescale to gray then rgb bits */ *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100; *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim; } else { /* rescale to rgb bits */ *pred = ((*pred >> shift) * 65535) / lim; *pgreen = ((*pgreen >> shift) * 65535) / lim; *pblue = ((*pblue >> shift) * 65535) / lim; } } Bool fbInitializeColormap(ColormapPtr pmap) { register unsigned i; register VisualPtr pVisual; unsigned lim, maxent, shift; pVisual = pmap->pVisual; lim = (1 << pVisual->bitsPerRGBValue) - 1; shift = 16 - pVisual->bitsPerRGBValue; maxent = pVisual->ColormapEntries - 1; if (pVisual->class == TrueColor) { unsigned limr, limg, limb; limr = pVisual->redMask >> pVisual->offsetRed; limg = pVisual->greenMask >> pVisual->offsetGreen; limb = pVisual->blueMask >> pVisual->offsetBlue; for(i = 0; i <= maxent; i++) { /* rescale to [0..65535] then rgb bits */ pmap->red[i].co.local.red = ((((i * 65535) / limr) >> shift) * 65535) / lim; pmap->green[i].co.local.green = ((((i * 65535) / limg) >> shift) * 65535) / lim; pmap->blue[i].co.local.blue = ((((i * 65535) / limb) >> shift) * 65535) / lim; } } else if (pVisual->class == StaticColor) { unsigned n; unsigned r, g, b; unsigned red, green, blue; for (n = 0; n*n*n < pVisual->ColormapEntries; n++) ; n--; i = 0; for (r = 0; r < n; r++) { red = (((r * 65535 / (n - 1)) >> shift) * 65535) / lim; for (g = 0; g < n; g++) { green = (((g * 65535 / (n - 1)) >> shift) * 65535) / lim; for (b = 0; b < n; b++) { blue = (((b * 65535 / (n - 1)) >> shift) * 65535) / lim; pmap->red[i].co.local.red = red; pmap->red[i].co.local.green = green; pmap->red[i].co.local.blue = blue; i++; } } } n = pVisual->ColormapEntries - i; for (r = 0; r < n; r++) { red = (((r * 65535 / (n - 1)) >> shift) * 65535) / lim; pmap->red[i].co.local.red = red; pmap->red[i].co.local.green = red; pmap->red[i].co.local.blue = red; i++; } } else if (pVisual->class == StaticGray) { for(i = 0; i <= maxent; i++) { /* rescale to [0..65535] then rgb bits */ pmap->red[i].co.local.red = ((((i * 65535) / maxent) >> shift) * 65535) / lim; pmap->red[i].co.local.green = pmap->red[i].co.local.red; pmap->red[i].co.local.blue = pmap->red[i].co.local.red; } } return TRUE; } /* When simulating DirectColor on PseudoColor hardware, multiple entries of the colormap must be updated */ #define AddElement(mask) { \ pixel = red | green | blue; \ for (i = 0; i < nresult; i++) \ if (outdefs[i].pixel == pixel) \ break; \ if (i == nresult) \ { \ nresult++; \ outdefs[i].pixel = pixel; \ outdefs[i].flags = 0; \ } \ outdefs[i].flags |= (mask); \ outdefs[i].red = pmap->red[red >> pVisual->offsetRed].co.local.red; \ outdefs[i].green = pmap->green[green >> pVisual->offsetGreen].co.local.green; \ outdefs[i].blue = pmap->blue[blue >> pVisual->offsetBlue].co.local.blue; \ } int fbExpandDirectColors (ColormapPtr pmap, int ndef, xColorItem *indefs, xColorItem *outdefs) { register int red, green, blue; int maxred, maxgreen, maxblue; int stepred, stepgreen, stepblue; VisualPtr pVisual; register int pixel; register int nresult; register int i; pVisual = pmap->pVisual; stepred = 1 << pVisual->offsetRed; stepgreen = 1 << pVisual->offsetGreen; stepblue = 1 << pVisual->offsetBlue; maxred = pVisual->redMask; maxgreen = pVisual->greenMask; maxblue = pVisual->blueMask; nresult = 0; for (;ndef--; indefs++) { if (indefs->flags & DoRed) { red = indefs->pixel & pVisual->redMask; for (green = 0; green <= maxgreen; green += stepgreen) { for (blue = 0; blue <= maxblue; blue += stepblue) { AddElement (DoRed) } } } if (indefs->flags & DoGreen) { green = indefs->pixel & pVisual->greenMask; for (red = 0; red <= maxred; red += stepred) { for (blue = 0; blue <= maxblue; blue += stepblue) { AddElement (DoGreen) } } } if (indefs->flags & DoBlue) { blue = indefs->pixel & pVisual->blueMask; for (red = 0; red <= maxred; red += stepred) { for (green = 0; green <= maxgreen; green += stepgreen) { AddElement (DoBlue) } } } } return nresult; } Bool fbCreateDefColormap(ScreenPtr pScreen) { unsigned short zero = 0, ones = 0xFFFF; VisualPtr pVisual; ColormapPtr cmap; Pixel wp, bp; for (pVisual = pScreen->visuals; pVisual->vid != pScreen->rootVisual; pVisual++) ; if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &cmap, (pVisual->class & DynamicClass) ? AllocNone : AllocAll, 0) != Success) return FALSE; wp = pScreen->whitePixel; bp = pScreen->blackPixel; if ((AllocColor(cmap, &ones, &ones, &ones, &wp, 0) != Success) || (AllocColor(cmap, &zero, &zero, &zero, &bp, 0) != Success)) return FALSE; pScreen->whitePixel = wp; pScreen->blackPixel = bp; (*pScreen->InstallColormap)(cmap); return TRUE; } extern int defaultColorVisualClass; #define _RZ(d) ((d + 2) / 3) #define _RS(d) 0 #define _RM(d) ((1 << _RZ(d)) - 1) #define _GZ(d) ((d - _RZ(d) + 1) / 2) #define _GS(d) _RZ(d) #define _GM(d) (((1 << _GZ(d)) - 1) << _GS(d)) #define _BZ(d) (d - _RZ(d) - _GZ(d)) #define _BS(d) (_RZ(d) + _GZ(d)) #define _BM(d) (((1 << _BZ(d)) - 1) << _BS(d)) #define _CE(d) (1 << _RZ(d)) #define MAX_PSEUDO_DEPTH 10 /* largest DAC size I know */ #define StaticGrayMask (1 << StaticGray) #define GrayScaleMask (1 << GrayScale) #define StaticColorMask (1 << StaticColor) #define PseudoColorMask (1 << PseudoColor) #define TrueColorMask (1 << TrueColor) #define DirectColorMask (1 << DirectColor) #define ALL_VISUALS (StaticGrayMask|\ GrayScaleMask|\ StaticColorMask|\ PseudoColorMask|\ TrueColorMask|\ DirectColorMask) #define LARGE_VISUALS (TrueColorMask|\ DirectColorMask) typedef struct _fbVisuals { struct _fbVisuals *next; int depth; int bitsPerRGB; int visuals; int count; Pixel redMask, greenMask, blueMask; } fbVisualsRec, *fbVisualsPtr; static const int fbVisualPriority[] = { PseudoColor, DirectColor, GrayScale, StaticColor, TrueColor, StaticGray }; #define NUM_PRIORITY 6 static fbVisualsPtr fbVisuals; static int popCount (int i) { int count; count = (i >> 1) & 033333333333; count = i - count - ((count >> 1) & 033333333333); count = (((count + (count >> 3)) & 030707070707) % 077); /* HAKMEM 169 */ return count; } /* * Distance to least significant one bit */ static int maskShift (Pixel p) { int s; if (!p) return 0; s = 0; while (!(p & 1)) { s++; p >>= 1; } return s; } Bool fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB, Pixel redMask, Pixel greenMask, Pixel blueMask) { fbVisualsPtr new, *prev, v; new = (fbVisualsPtr) malloc (sizeof *new); if (!new) return FALSE; if (!redMask || !greenMask || !blueMask) { redMask = _RM(depth); greenMask = _GM(depth); blueMask = _BM(depth); } new->next = 0; new->depth = depth; new->visuals = visuals; new->bitsPerRGB = bitsPerRGB; new->redMask = redMask; new->greenMask = greenMask; new->blueMask = blueMask; new->count = popCount (visuals); for (prev = &fbVisuals; (v = *prev); prev = &v->next); *prev = new; return TRUE; } Bool fbHasVisualTypes (int depth) { fbVisualsPtr v; for (v = fbVisuals; v; v = v->next) if (v->depth == depth) return TRUE; return FALSE; } Bool fbSetVisualTypes (int depth, int visuals, int bitsPerRGB) { return fbSetVisualTypesAndMasks (depth, visuals, bitsPerRGB, _RM(depth), _GM(depth), _BM(depth)); } /* * Given a list of formats for a screen, create a list * of visuals and depths for the screen which coorespond to * the set which can be used with this version of fb. */ Bool fbInitVisuals (VisualPtr *visualp, DepthPtr *depthp, int *nvisualp, int *ndepthp, int *rootDepthp, VisualID *defaultVisp, unsigned long sizes, int bitsPerRGB) { int i, j = 0, k; VisualPtr visual; DepthPtr depth; VisualID *vid; int d, b; int f; int ndepth, nvisual; int nvtype; int vtype; fbVisualsPtr visuals, nextVisuals; /* none specified, we'll guess from pixmap formats */ if (!fbVisuals) { for (f = 0; f < screenInfo.numPixmapFormats; f++) { d = screenInfo.formats[f].depth; b = screenInfo.formats[f].bitsPerPixel; if (sizes & (1 << (b - 1))) { if (d > MAX_PSEUDO_DEPTH) vtype = LARGE_VISUALS; else if (d == 1) vtype = StaticGrayMask; else vtype = ALL_VISUALS; } else vtype = 0; if (!fbSetVisualTypes (d, vtype, bitsPerRGB)) return FALSE; } } nvisual = 0; ndepth = 0; for (visuals = fbVisuals; visuals; visuals = nextVisuals) { nextVisuals = visuals->next; ndepth++; nvisual += visuals->count; } depth = (DepthPtr) malloc (ndepth * sizeof (DepthRec)); visual = (VisualPtr) malloc (nvisual * sizeof (VisualRec)); if (!depth || !visual) { free (depth); free (visual); return FALSE; } *depthp = depth; *visualp = visual; *ndepthp = ndepth; *nvisualp = nvisual; for (visuals = fbVisuals; visuals; visuals = nextVisuals) { nextVisuals = visuals->next; d = visuals->depth; vtype = visuals->visuals; nvtype = visuals->count; vid = NULL; if (nvtype) { vid = (VisualID *) malloc (nvtype * sizeof (VisualID)); if (!vid) return FALSE; } depth->depth = d; depth->numVids = nvtype; depth->vids = vid; depth++; for (i = 0; i < NUM_PRIORITY; i++) { if (! (vtype & (1 << fbVisualPriority[i]))) continue; visual->class = fbVisualPriority[i]; visual->bitsPerRGBValue = visuals->bitsPerRGB; visual->ColormapEntries = 1 << d; visual->nplanes = d; visual->vid = *vid = FakeClientID (0); switch (visual->class) { case PseudoColor: case GrayScale: case StaticGray: case StaticColor: visual->redMask = 0; visual->greenMask = 0; visual->blueMask = 0; visual->offsetRed = 0; visual->offsetGreen = 0; visual->offsetBlue = 0; break; case DirectColor: case TrueColor: visual->ColormapEntries = _CE(d); visual->redMask = visuals->redMask; visual->greenMask = visuals->greenMask; visual->blueMask = visuals->blueMask; visual->offsetRed = maskShift (visuals->redMask); visual->offsetGreen = maskShift (visuals->greenMask); visual->offsetBlue = maskShift (visuals->blueMask); } vid++; visual++; } free (visuals); } fbVisuals = NULL; visual = *visualp; depth = *depthp; for (i = 0; i < ndepth; i++) { if (*rootDepthp && *rootDepthp != depth[i].depth) continue; for (j = 0; j < depth[i].numVids; j++) { for (k = 0; k < nvisual; k++) if (visual[k].vid == depth[i].vids[j]) break; if (k == nvisual) continue; if (defaultColorVisualClass < 0 || visual[k].class == defaultColorVisualClass) break; } if (j != depth[i].numVids) break; } if (i == ndepth) { for (i = 0; i < ndepth; i++) { if (depth[i].numVids) break; } if (i == ndepth) return FALSE; j = 0; } *rootDepthp = depth[i].depth; *defaultVisp = depth[i].vids[j]; return TRUE; } #else #include "micmap.h" int fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps) { return miListInstalledColormaps(pScreen, pmaps); } void fbInstallColormap(ColormapPtr pmap) { miInstallColormap(pmap); } void fbUninstallColormap(ColormapPtr pmap) { miUninstallColormap(pmap); } void fbResolveColor(unsigned short *pred, unsigned short *pgreen, unsigned short *pblue, VisualPtr pVisual) { miResolveColor(pred, pgreen, pblue, pVisual); } Bool fbInitializeColormap(ColormapPtr pmap) { return miInitializeColormap(pmap); } int fbExpandDirectColors (ColormapPtr pmap, int ndef, xColorItem *indefs, xColorItem *outdefs) { return miExpandDirectColors(pmap, ndef, indefs, outdefs); } Bool fbCreateDefColormap(ScreenPtr pScreen) { return miCreateDefColormap(pScreen); } void fbClearVisualTypes(void) { miClearVisualTypes(); } Bool fbSetVisualTypes (int depth, int visuals, int bitsPerRGB) { return miSetVisualTypes(depth, visuals, bitsPerRGB, -1); } /* * Given a list of formats for a screen, create a list * of visuals and depths for the screen which coorespond to * the set which can be used with this version of fb. */ Bool fbInitVisuals (VisualPtr *visualp, DepthPtr *depthp, int *nvisualp, int *ndepthp, int *rootDepthp, VisualID *defaultVisp, unsigned long sizes, int bitsPerRGB) { return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp, defaultVisp, sizes, bitsPerRGB, -1); } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbcompose.c0000644000000000000000000033232213614532331017310 0ustar /* * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * 2005 Lars Knoll & Zack Rusin, Trolltech * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" #ifdef RENDER #include #include #include #include #include "picturestr.h" #include "mipict.h" #include "fbpict.h" #define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) #define SCANLINE_BUFFER_LENGTH 2048 typedef FASTCALL void (*fetchProc)(const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed); /* * All of the fetch functions */ static FASTCALL void fbFetch_a8r8g8b8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { memcpy(buffer, (const CARD32 *)bits + x, width*sizeof(CARD32)); } static FASTCALL void fbFetch_x8r8g8b8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD32 *pixel = (const CARD32 *)bits + x; const CARD32 *end = pixel + width; while (pixel < end) { *buffer++ = *pixel++ | 0xff000000; } } static FASTCALL void fbFetch_a8b8g8r8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD32 *pixel = (CARD32 *)bits + x; const CARD32 *end = pixel + width; while (pixel < end) { *buffer++ = ((*pixel & 0xff00ff00) | ((*pixel >> 16) & 0xff) | ((*pixel & 0xff) << 16)); ++pixel; } } static FASTCALL void fbFetch_x8b8g8r8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD32 *pixel = (CARD32 *)bits + x; const CARD32 *end = pixel + width; while (pixel < end) { *buffer++ = 0xff000000 | ((*pixel & 0x0000ff00) | ((*pixel >> 16) & 0xff) | ((*pixel & 0xff) << 16)); ++pixel; } } static FASTCALL void fbFetch_r8g8b8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + 3*x; const CARD8 *end = pixel + 3*width; while (pixel < end) { CARD32 b = Fetch24(pixel) | 0xff000000; pixel += 3; *buffer++ = b; } } static FASTCALL void fbFetch_b8g8r8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + 3*x; const CARD8 *end = pixel + 3*width; while (pixel < end) { CARD32 b = 0xff000000; #if IMAGE_BYTE_ORDER == MSBFirst b |= (*pixel++); b |= (*pixel++ << 8); b |= (*pixel++ << 16); #else b |= (*pixel++ << 16); b |= (*pixel++ << 8); b |= (*pixel++); #endif } } static FASTCALL void fbFetch_r5g6b5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; CARD32 r = (((p) << 3) & 0xf8) | (((p) << 5) & 0xfc00) | (((p) << 8) & 0xf80000); r |= (r >> 5) & 0x70007; r |= (r >> 6) & 0x300; *buffer++ = 0xff000000 | r; } } static FASTCALL void fbFetch_b5g6r5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; CARD32 r,g,b; b = ((p & 0xf800) | ((p & 0xe000) >> 5)) >> 8; g = ((p & 0x07e0) | ((p & 0x0600) >> 6)) << 5; r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14; *buffer++ = (0xff000000 | r | g | b); } } static FASTCALL void fbFetch_a1r5g5b5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; CARD32 r,g,b, a; a = (CARD32) ((CARD8) (0 - ((p & 0x8000) >> 15))) << 24; r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9; g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2; *buffer++ = (a | r | g | b); } } static FASTCALL void fbFetch_x1r5g5b5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; CARD32 r,g,b; r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9; g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2; *buffer++ = (0xff000000 | r | g | b); } } static FASTCALL void fbFetch_a1b5g5r5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; CARD32 r,g,b, a; a = (CARD32) ((CARD8) (0 - ((p & 0x8000) >> 15))) << 24; b = ((p & 0x7c00) | ((p & 0x7000) >> 5)) >> 7; g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14; *buffer++ = (a | r | g | b); } } static FASTCALL void fbFetch_x1b5g5r5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; CARD32 r,g,b; b = ((p & 0x7c00) | ((p & 0x7000) >> 5)) >> 7; g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14; *buffer++ = (0xff000000 | r | g | b); } } static FASTCALL void fbFetch_a4r4g4b4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; CARD32 r,g,b, a; a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16; r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12; g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; b = ((p & 0x000f) | ((p & 0x000f) << 4)); *buffer++ = (a | r | g | b); } } static FASTCALL void fbFetch_x4r4g4b4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; CARD32 r,g,b; r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12; g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; b = ((p & 0x000f) | ((p & 0x000f) << 4)); *buffer++ = (0xff000000 | r | g | b); } } static FASTCALL void fbFetch_a4b4g4r4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; CARD32 r,g,b, a; a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16; b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12; g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; r = ((p & 0x000f) | ((p & 0x000f) << 4)); *buffer++ = (a | r | g | b); } } static FASTCALL void fbFetch_x4b4g4r4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD16 *pixel = (const CARD16 *)bits + x; const CARD16 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; CARD32 r,g,b; b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12; g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; r = ((p & 0x000f) | ((p & 0x000f) << 4)); *buffer++ = (0xff000000 | r | g | b); } } static FASTCALL void fbFetch_a8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { *buffer++ = (*pixel++) << 24; } } static FASTCALL void fbFetch_r3g3b2 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; CARD32 r,g,b; r = ((p & 0xe0) | ((p & 0xe0) >> 3) | ((p & 0xc0) >> 6)) << 16; g = ((p & 0x1c) | ((p & 0x18) >> 3) | ((p & 0x1c) << 3)) << 8; b = (((p & 0x03) ) | ((p & 0x03) << 2) | ((p & 0x03) << 4) | ((p & 0x03) << 6)); *buffer++ = (0xff000000 | r | g | b); } } static FASTCALL void fbFetch_b2g3r3 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; CARD32 r,g,b; b = (((p & 0xc0) ) | ((p & 0xc0) >> 2) | ((p & 0xc0) >> 4) | ((p & 0xc0) >> 6)); g = ((p & 0x38) | ((p & 0x38) >> 3) | ((p & 0x30) << 2)) << 8; r = (((p & 0x07) ) | ((p & 0x07) << 3) | ((p & 0x06) << 6)) << 16; *buffer++ = (0xff000000 | r | g | b); } } static FASTCALL void fbFetch_a2r2g2b2 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; CARD32 a,r,g,b; a = ((p & 0xc0) * 0x55) << 18; r = ((p & 0x30) * 0x55) << 12; g = ((p & 0x0c) * 0x55) << 6; b = ((p & 0x03) * 0x55); *buffer++ = a|r|g|b; } } static FASTCALL void fbFetch_a2b2g2r2 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; CARD32 a,r,g,b; a = ((p & 0xc0) * 0x55) << 18; b = ((p & 0x30) * 0x55) >> 6; g = ((p & 0x0c) * 0x55) << 6; r = ((p & 0x03) * 0x55) << 16; *buffer++ = a|r|g|b; } } static FASTCALL void fbFetch_c8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { CARD32 p = *pixel++; *buffer++ = indexed->rgba[p]; } } static FASTCALL void fbFetch_x4a4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; while (pixel < end) { CARD8 p = (*pixel++) & 0xf; *buffer++ = (p | (p << 4)) << 24; } } #define Fetch8(l,o) (((CARD8 *) (l))[(o) >> 2]) #if IMAGE_BYTE_ORDER == MSBFirst #define Fetch4(l,o) ((o) & 2 ? Fetch8(l,o) & 0xf : Fetch8(l,o) >> 4) #else #define Fetch4(l,o) ((o) & 2 ? Fetch8(l,o) >> 4 : Fetch8(l,o) & 0xf) #endif static FASTCALL void fbFetch_a4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); p |= p << 4; *buffer++ = p << 24; } } static FASTCALL void fbFetch_r1g2b1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); CARD32 r,g,b; r = ((p & 0x8) * 0xff) << 13; g = ((p & 0x6) * 0x55) << 7; b = ((p & 0x1) * 0xff); *buffer++ = 0xff000000|r|g|b; } } static FASTCALL void fbFetch_b1g2r1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); CARD32 r,g,b; b = ((p & 0x8) * 0xff) >> 3; g = ((p & 0x6) * 0x55) << 7; r = ((p & 0x1) * 0xff) << 16; *buffer++ = 0xff000000|r|g|b; } } static FASTCALL void fbFetch_a1r1g1b1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); CARD32 a,r,g,b; a = ((p & 0x8) * 0xff) << 21; r = ((p & 0x4) * 0xff) << 14; g = ((p & 0x2) * 0xff) << 7; b = ((p & 0x1) * 0xff); *buffer++ = a|r|g|b; } } static FASTCALL void fbFetch_a1b1g1r1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); CARD32 a,r,g,b; a = ((p & 0x8) * 0xff) << 21; r = ((p & 0x4) * 0xff) >> 3; g = ((p & 0x2) * 0xff) << 7; b = ((p & 0x1) * 0xff) << 16; *buffer++ = a|r|g|b; } } static FASTCALL void fbFetch_c4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = Fetch4(bits, i + x); *buffer++ = indexed->rgba[p]; } } static FASTCALL void fbFetch_a1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = ((CARD32 *)bits)[(i + x) >> 5]; CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst a = p >> (0x1f - ((i+x) & 0x1f)); #else a = p >> ((i+x) & 0x1f); #endif a = a & 1; a |= a << 1; a |= a << 2; a |= a << 4; *buffer++ = a << 24; } } static FASTCALL void fbFetch_g1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 p = ((CARD32 *)bits)[(i+x) >> 5]; CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst a = p >> (0x1f - ((i+x) & 0x1f)); #else a = p >> ((i+x) & 0x1f); #endif a = a & 1; *buffer++ = indexed->rgba[a]; } } static fetchProc fetchProcForPicture (PicturePtr pict) { switch(pict->format) { case PICT_a8r8g8b8: return fbFetch_a8r8g8b8; case PICT_x8r8g8b8: return fbFetch_x8r8g8b8; case PICT_a8b8g8r8: return fbFetch_a8b8g8r8; case PICT_x8b8g8r8: return fbFetch_x8b8g8r8; /* 24bpp formats */ case PICT_r8g8b8: return fbFetch_r8g8b8; case PICT_b8g8r8: return fbFetch_b8g8r8; /* 16bpp formats */ case PICT_r5g6b5: return fbFetch_r5g6b5; case PICT_b5g6r5: return fbFetch_b5g6r5; case PICT_a1r5g5b5: return fbFetch_a1r5g5b5; case PICT_x1r5g5b5: return fbFetch_x1r5g5b5; case PICT_a1b5g5r5: return fbFetch_a1b5g5r5; case PICT_x1b5g5r5: return fbFetch_x1b5g5r5; case PICT_a4r4g4b4: return fbFetch_a4r4g4b4; case PICT_x4r4g4b4: return fbFetch_x4r4g4b4; case PICT_a4b4g4r4: return fbFetch_a4b4g4r4; case PICT_x4b4g4r4: return fbFetch_x4b4g4r4; /* 8bpp formats */ case PICT_a8: return fbFetch_a8; case PICT_r3g3b2: return fbFetch_r3g3b2; case PICT_b2g3r3: return fbFetch_b2g3r3; case PICT_a2r2g2b2: return fbFetch_a2r2g2b2; case PICT_a2b2g2r2: return fbFetch_a2b2g2r2; case PICT_c8: return fbFetch_c8; case PICT_g8: return fbFetch_c8; case PICT_x4a4: return fbFetch_x4a4; /* 4bpp formats */ case PICT_a4: return fbFetch_a4; case PICT_r1g2b1: return fbFetch_r1g2b1; case PICT_b1g2r1: return fbFetch_b1g2r1; case PICT_a1r1g1b1: return fbFetch_a1r1g1b1; case PICT_a1b1g1r1: return fbFetch_a1b1g1r1; case PICT_c4: return fbFetch_c4; case PICT_g4: return fbFetch_c4; /* 1bpp formats */ case PICT_a1: return fbFetch_a1; case PICT_g1: return fbFetch_g1; default: return NULL; } } /* * Pixel wise fetching */ typedef FASTCALL CARD32 (*fetchPixelProc)(const FbBits *bits, int offset, miIndexedPtr indexed); static FASTCALL CARD32 fbFetchPixel_a8r8g8b8 (const FbBits *bits, int offset, miIndexedPtr indexed) { return ((CARD32 *)bits)[offset]; } static FASTCALL CARD32 fbFetchPixel_x8r8g8b8 (const FbBits *bits, int offset, miIndexedPtr indexed) { return ((CARD32 *)bits)[offset] | 0xff000000; } static FASTCALL CARD32 fbFetchPixel_a8b8g8r8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD32 *)bits)[offset]; return ((pixel & 0xff000000) | ((pixel >> 16) & 0xff) | (pixel & 0x0000ff00) | ((pixel & 0xff) << 16)); } static FASTCALL CARD32 fbFetchPixel_x8b8g8r8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD32 *)bits)[offset]; return ((0xff000000) | ((pixel >> 16) & 0xff) | (pixel & 0x0000ff00) | ((pixel & 0xff) << 16)); } static FASTCALL CARD32 fbFetchPixel_r8g8b8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD8 *pixel = ((CARD8 *) bits) + (offset*3); #if IMAGE_BYTE_ORDER == MSBFirst return (0xff000000 | (pixel[0] << 16) | (pixel[1] << 8) | (pixel[2])); #else return (0xff000000 | (pixel[2] << 16) | (pixel[1] << 8) | (pixel[0])); #endif } static FASTCALL CARD32 fbFetchPixel_b8g8r8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD8 *pixel = ((CARD8 *) bits) + (offset*3); #if IMAGE_BYTE_ORDER == MSBFirst return (0xff000000 | (pixel[2] << 16) | (pixel[1] << 8) | (pixel[0])); #else return (0xff000000 | (pixel[0] << 16) | (pixel[1] << 8) | (pixel[2])); #endif } static FASTCALL CARD32 fbFetchPixel_r5g6b5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD16 *) bits)[offset]; CARD32 r,g,b; r = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) << 8; g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5; b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; return (0xff000000 | r | g | b); } static FASTCALL CARD32 fbFetchPixel_b5g6r5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD16 *) bits)[offset]; CARD32 r,g,b; b = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) >> 8; g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5; r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; return (0xff000000 | r | g | b); } static FASTCALL CARD32 fbFetchPixel_a1r5g5b5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD16 *) bits)[offset]; CARD32 a,r,g,b; a = (CARD32) ((CARD8) (0 - ((pixel & 0x8000) >> 15))) << 24; r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; return (a | r | g | b); } static FASTCALL CARD32 fbFetchPixel_x1r5g5b5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD16 *) bits)[offset]; CARD32 r,g,b; r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; return (0xff000000 | r | g | b); } static FASTCALL CARD32 fbFetchPixel_a1b5g5r5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD16 *) bits)[offset]; CARD32 a,r,g,b; a = (CARD32) ((CARD8) (0 - ((pixel & 0x8000) >> 15))) << 24; b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; return (a | r | g | b); } static FASTCALL CARD32 fbFetchPixel_x1b5g5r5 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD16 *) bits)[offset]; CARD32 r,g,b; b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; return (0xff000000 | r | g | b); } static FASTCALL CARD32 fbFetchPixel_a4r4g4b4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD16 *) bits)[offset]; CARD32 a,r,g,b; a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16; r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)); return (a | r | g | b); } static FASTCALL CARD32 fbFetchPixel_x4r4g4b4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD16 *) bits)[offset]; CARD32 r,g,b; r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)); return (0xff000000 | r | g | b); } static FASTCALL CARD32 fbFetchPixel_a4b4g4r4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD16 *) bits)[offset]; CARD32 a,r,g,b; a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16; b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)); return (a | r | g | b); } static FASTCALL CARD32 fbFetchPixel_x4b4g4r4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD16 *) bits)[offset]; CARD32 r,g,b; b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)); return (0xff000000 | r | g | b); } static FASTCALL CARD32 fbFetchPixel_a8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD8 *) bits)[offset]; return pixel << 24; } static FASTCALL CARD32 fbFetchPixel_r3g3b2 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD8 *) bits)[offset]; CARD32 r,g,b; r = ((pixel & 0xe0) | ((pixel & 0xe0) >> 3) | ((pixel & 0xc0) >> 6)) << 16; g = ((pixel & 0x1c) | ((pixel & 0x18) >> 3) | ((pixel & 0x1c) << 3)) << 8; b = (((pixel & 0x03) ) | ((pixel & 0x03) << 2) | ((pixel & 0x03) << 4) | ((pixel & 0x03) << 6)); return (0xff000000 | r | g | b); } static FASTCALL CARD32 fbFetchPixel_b2g3r3 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD8 *) bits)[offset]; CARD32 r,g,b; b = (((pixel & 0xc0) ) | ((pixel & 0xc0) >> 2) | ((pixel & 0xc0) >> 4) | ((pixel & 0xc0) >> 6)); g = ((pixel & 0x38) | ((pixel & 0x38) >> 3) | ((pixel & 0x30) << 2)) << 8; r = (((pixel & 0x07) ) | ((pixel & 0x07) << 3) | ((pixel & 0x06) << 6)) << 16; return (0xff000000 | r | g | b); } static FASTCALL CARD32 fbFetchPixel_a2r2g2b2 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD8 *) bits)[offset]; CARD32 a,r,g,b; a = ((pixel & 0xc0) * 0x55) << 18; r = ((pixel & 0x30) * 0x55) << 12; g = ((pixel & 0x0c) * 0x55) << 6; b = ((pixel & 0x03) * 0x55); return a|r|g|b; } static FASTCALL CARD32 fbFetchPixel_a2b2g2r2 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD8 *) bits)[offset]; CARD32 a,r,g,b; a = ((pixel & 0xc0) * 0x55) << 18; b = ((pixel & 0x30) * 0x55) >> 6; g = ((pixel & 0x0c) * 0x55) << 6; r = ((pixel & 0x03) * 0x55) << 16; return a|r|g|b; } static FASTCALL CARD32 fbFetchPixel_c8 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD8 *) bits)[offset]; return indexed->rgba[pixel]; } #define Fetch8(l,o) (((CARD8 *) (l))[(o) >> 2]) #if IMAGE_BYTE_ORDER == MSBFirst #define Fetch4(l,o) ((o) & 2 ? Fetch8(l,o) & 0xf : Fetch8(l,o) >> 4) #else #define Fetch4(l,o) ((o) & 2 ? Fetch8(l,o) >> 4 : Fetch8(l,o) & 0xf) #endif static FASTCALL CARD32 fbFetchPixel_a4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); pixel |= pixel << 4; return pixel << 24; } static FASTCALL CARD32 fbFetchPixel_r1g2b1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); CARD32 r,g,b; r = ((pixel & 0x8) * 0xff) << 13; g = ((pixel & 0x6) * 0x55) << 7; b = ((pixel & 0x1) * 0xff); return 0xff000000|r|g|b; } static FASTCALL CARD32 fbFetchPixel_b1g2r1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); CARD32 r,g,b; b = ((pixel & 0x8) * 0xff) >> 3; g = ((pixel & 0x6) * 0x55) << 7; r = ((pixel & 0x1) * 0xff) << 16; return 0xff000000|r|g|b; } static FASTCALL CARD32 fbFetchPixel_a1r1g1b1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); CARD32 a,r,g,b; a = ((pixel & 0x8) * 0xff) << 21; r = ((pixel & 0x4) * 0xff) << 14; g = ((pixel & 0x2) * 0xff) << 7; b = ((pixel & 0x1) * 0xff); return a|r|g|b; } static FASTCALL CARD32 fbFetchPixel_a1b1g1r1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); CARD32 a,r,g,b; a = ((pixel & 0x8) * 0xff) << 21; r = ((pixel & 0x4) * 0xff) >> 3; g = ((pixel & 0x2) * 0xff) << 7; b = ((pixel & 0x1) * 0xff) << 16; return a|r|g|b; } static FASTCALL CARD32 fbFetchPixel_c4 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = Fetch4(bits, offset); return indexed->rgba[pixel]; } static FASTCALL CARD32 fbFetchPixel_a1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD32 *)bits)[offset >> 5]; CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst a = pixel >> (0x1f - (offset & 0x1f)); #else a = pixel >> (offset & 0x1f); #endif a = a & 1; a |= a << 1; a |= a << 2; a |= a << 4; return a << 24; } static FASTCALL CARD32 fbFetchPixel_g1 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = ((CARD32 *)bits)[offset >> 5]; CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst a = pixel >> (0x1f - (offset & 0x1f)); #else a = pixel >> (offset & 0x1f); #endif a = a & 1; return indexed->rgba[a]; } static fetchPixelProc fetchPixelProcForPicture (PicturePtr pict) { switch(pict->format) { case PICT_a8r8g8b8: return fbFetchPixel_a8r8g8b8; case PICT_x8r8g8b8: return fbFetchPixel_x8r8g8b8; case PICT_a8b8g8r8: return fbFetchPixel_a8b8g8r8; case PICT_x8b8g8r8: return fbFetchPixel_x8b8g8r8; /* 24bpp formats */ case PICT_r8g8b8: return fbFetchPixel_r8g8b8; case PICT_b8g8r8: return fbFetchPixel_b8g8r8; /* 16bpp formats */ case PICT_r5g6b5: return fbFetchPixel_r5g6b5; case PICT_b5g6r5: return fbFetchPixel_b5g6r5; case PICT_a1r5g5b5: return fbFetchPixel_a1r5g5b5; case PICT_x1r5g5b5: return fbFetchPixel_x1r5g5b5; case PICT_a1b5g5r5: return fbFetchPixel_a1b5g5r5; case PICT_x1b5g5r5: return fbFetchPixel_x1b5g5r5; case PICT_a4r4g4b4: return fbFetchPixel_a4r4g4b4; case PICT_x4r4g4b4: return fbFetchPixel_x4r4g4b4; case PICT_a4b4g4r4: return fbFetchPixel_a4b4g4r4; case PICT_x4b4g4r4: return fbFetchPixel_x4b4g4r4; /* 8bpp formats */ case PICT_a8: return fbFetchPixel_a8; case PICT_r3g3b2: return fbFetchPixel_r3g3b2; case PICT_b2g3r3: return fbFetchPixel_b2g3r3; case PICT_a2r2g2b2: return fbFetchPixel_a2r2g2b2; case PICT_a2b2g2r2: return fbFetchPixel_a2b2g2r2; case PICT_c8: return fbFetchPixel_c8; case PICT_g8: return fbFetchPixel_c8; /* 4bpp formats */ case PICT_a4: return fbFetchPixel_a4; case PICT_r1g2b1: return fbFetchPixel_r1g2b1; case PICT_b1g2r1: return fbFetchPixel_b1g2r1; case PICT_a1r1g1b1: return fbFetchPixel_a1r1g1b1; case PICT_a1b1g1r1: return fbFetchPixel_a1b1g1r1; case PICT_c4: return fbFetchPixel_c4; case PICT_g4: return fbFetchPixel_c4; /* 1bpp formats */ case PICT_a1: return fbFetchPixel_a1; case PICT_g1: return fbFetchPixel_g1; default: return NULL; } } /* * All the store functions */ typedef FASTCALL void (*storeProc) (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed); #define Splita(v) CARD32 a = ((v) >> 24), r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff #define Split(v) CARD32 r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff static FASTCALL void fbStore_a8r8g8b8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { memcpy(((CARD32 *)bits) + x, values, width*sizeof(CARD32)); } static FASTCALL void fbStore_x8r8g8b8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD32 *pixel = (CARD32 *)bits + x; for (i = 0; i < width; ++i) *pixel++ = values[i] & 0xffffff; } static FASTCALL void fbStore_a8b8g8r8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD32 *pixel = (CARD32 *)bits + x; for (i = 0; i < width; ++i) *pixel++ = (values[i] & 0xff00ff00) | ((values[i] >> 16) & 0xff) | ((values[i] & 0xff) << 16); } static FASTCALL void fbStore_x8b8g8r8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD32 *pixel = (CARD32 *)bits + x; for (i = 0; i < width; ++i) *pixel++ = (values[i] & 0x0000ff00) | ((values[i] >> 16) & 0xff) | ((values[i] & 0xff) << 16); } static FASTCALL void fbStore_r8g8b8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + 3*x; for (i = 0; i < width; ++i) { Store24(pixel, values[i]); pixel += 3; } } static FASTCALL void fbStore_b8g8r8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + 3*x; for (i = 0; i < width; ++i) { #if IMAGE_BYTE_ORDER == MSBFirst *pixel++ = Blue(values[i]); *pixel++ = Green(values[i]); *pixel++ = Red(values[i]); #else *pixel++ = Red(values[i]); *pixel++ = Green(values[i]); *pixel++ = Blue(values[i]); #endif } } static FASTCALL void fbStore_r5g6b5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { CARD32 s = values[i]; *pixel++ = ((s >> 3) & 0x001f) | ((s >> 5) & 0x07e0) | ((s >> 8) & 0xf800); } } static FASTCALL void fbStore_b5g6r5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Split(values[i]); *pixel++ = (((b << 8) & 0xf800) | ((g << 3) & 0x07e0) | ((r >> 3) )); } } static FASTCALL void fbStore_a1r5g5b5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Splita(values[i]); *pixel++ = (((a << 8) & 0x8000) | ((r << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((b >> 3) )); } } static FASTCALL void fbStore_x1r5g5b5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Split(values[i]); *pixel++ = (((r << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((b >> 3) )); } } static FASTCALL void fbStore_a1b5g5r5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Splita(values[i]); *pixel++ = (((a << 8) & 0x8000) | ((b << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((r >> 3) )); } } static FASTCALL void fbStore_x1b5g5r5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Split(values[i]); *pixel++ = (((b << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((r >> 3) )); } } static FASTCALL void fbStore_a4r4g4b4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Splita(values[i]); *pixel++ = (((a << 8) & 0xf000) | ((r << 4) & 0x0f00) | ((g ) & 0x00f0) | ((b >> 4) )); } } static FASTCALL void fbStore_x4r4g4b4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Split(values[i]); *pixel++ = (((r << 4) & 0x0f00) | ((g ) & 0x00f0) | ((b >> 4) )); } } static FASTCALL void fbStore_a4b4g4r4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Splita(values[i]); *pixel++ = (((a << 8) & 0xf000) | ((b << 4) & 0x0f00) | ((g ) & 0x00f0) | ((r >> 4) )); } } static FASTCALL void fbStore_x4b4g4r4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Split(values[i]); *pixel++ = (((b << 4) & 0x0f00) | ((g ) & 0x00f0) | ((r >> 4) )); } } static FASTCALL void fbStore_a8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { *pixel++ = values[i] >> 24; } } static FASTCALL void fbStore_r3g3b2 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { Split(values[i]); *pixel++ = (((r ) & 0xe0) | ((g >> 3) & 0x1c) | ((b >> 6) )); } } static FASTCALL void fbStore_b2g3r3 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { Split(values[i]); *pixel++ = (((b ) & 0xe0) | ((g >> 3) & 0x1c) | ((r >> 6) )); } } static FASTCALL void fbStore_a2r2g2b2 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { Splita(values[i]); *pixel++ = (((a ) & 0xc0) | ((r >> 2) & 0x30) | ((g >> 4) & 0x0c) | ((b >> 6) )); } } static FASTCALL void fbStore_c8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { *pixel++ = miIndexToEnt24(indexed,values[i]); } } static FASTCALL void fbStore_x4a4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD8 *pixel = ((CARD8 *) bits) + x; for (i = 0; i < width; ++i) { *pixel++ = values[i] >> 28; } } #define Store8(l,o,v) (((CARD8 *) l)[(o) >> 3] = (v)) #if IMAGE_BYTE_ORDER == MSBFirst #define Store4(l,o,v) Store8(l,o,((o) & 4 ? \ (Fetch8(l,o) & 0xf0) | (v) : \ (Fetch8(l,o) & 0x0f) | ((v) << 4))) #else #define Store4(l,o,v) Store8(l,o,((o) & 4 ? \ (Fetch8(l,o) & 0x0f) | ((v) << 4) : \ (Fetch8(l,o) & 0xf0) | (v))) #endif static FASTCALL void fbStore_a4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { Store4(bits, i + x, values[i]>>28); } } static FASTCALL void fbStore_r1g2b1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 pixel; Split(values[i]); pixel = (((r >> 4) & 0x8) | ((g >> 5) & 0x6) | ((b >> 7) )); Store4(bits, i + x, pixel); } } static FASTCALL void fbStore_b1g2r1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 pixel; Split(values[i]); pixel = (((b >> 4) & 0x8) | ((g >> 5) & 0x6) | ((r >> 7) )); Store4(bits, i + x, pixel); } } static FASTCALL void fbStore_a1r1g1b1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 pixel; Splita(values[i]); pixel = (((a >> 4) & 0x8) | ((r >> 5) & 0x4) | ((g >> 6) & 0x2) | ((b >> 7) )); Store4(bits, i + x, pixel); } } static FASTCALL void fbStore_a1b1g1r1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 pixel; Splita(values[i]); pixel = (((a >> 4) & 0x8) | ((b >> 5) & 0x4) | ((g >> 6) & 0x2) | ((r >> 7) )); Store4(bits, i + x, pixel); } } static FASTCALL void fbStore_c4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 pixel; pixel = miIndexToEnt24(indexed, values[i]); Store4(bits, i + x, pixel); } } static FASTCALL void fbStore_a1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 *pixel = ((CARD32 *) bits) + ((i+x) >> 5); CARD32 mask = FbStipMask((i+x) & 0x1f, 1); CARD32 v = values[i] & 0x80000000 ? mask : 0; *pixel = (*pixel & ~mask) | v; } } static FASTCALL void fbStore_g1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; for (i = 0; i < width; ++i) { CARD32 *pixel = ((CARD32 *) bits) + ((i+x) >> 5); CARD32 mask = FbStipMask((i+x) & 0x1f, 1); CARD32 v = miIndexToEntY24(indexed,values[i]) ? mask : 0; *pixel = (*pixel & ~mask) | v; } } static storeProc storeProcForPicture (PicturePtr pict) { switch(pict->format) { case PICT_a8r8g8b8: return fbStore_a8r8g8b8; case PICT_x8r8g8b8: return fbStore_x8r8g8b8; case PICT_a8b8g8r8: return fbStore_a8b8g8r8; case PICT_x8b8g8r8: return fbStore_x8b8g8r8; /* 24bpp formats */ case PICT_r8g8b8: return fbStore_r8g8b8; case PICT_b8g8r8: return fbStore_b8g8r8; /* 16bpp formats */ case PICT_r5g6b5: return fbStore_r5g6b5; case PICT_b5g6r5: return fbStore_b5g6r5; case PICT_a1r5g5b5: return fbStore_a1r5g5b5; case PICT_x1r5g5b5: return fbStore_x1r5g5b5; case PICT_a1b5g5r5: return fbStore_a1b5g5r5; case PICT_x1b5g5r5: return fbStore_x1b5g5r5; case PICT_a4r4g4b4: return fbStore_a4r4g4b4; case PICT_x4r4g4b4: return fbStore_x4r4g4b4; case PICT_a4b4g4r4: return fbStore_a4b4g4r4; case PICT_x4b4g4r4: return fbStore_x4b4g4r4; /* 8bpp formats */ case PICT_a8: return fbStore_a8; case PICT_r3g3b2: return fbStore_r3g3b2; case PICT_b2g3r3: return fbStore_b2g3r3; case PICT_a2r2g2b2: return fbStore_a2r2g2b2; case PICT_c8: return fbStore_c8; case PICT_g8: return fbStore_c8; case PICT_x4a4: return fbStore_x4a4; /* 4bpp formats */ case PICT_a4: return fbStore_a4; case PICT_r1g2b1: return fbStore_r1g2b1; case PICT_b1g2r1: return fbStore_b1g2r1; case PICT_a1r1g1b1: return fbStore_a1r1g1b1; case PICT_a1b1g1r1: return fbStore_a1b1g1r1; case PICT_c4: return fbStore_c4; case PICT_g4: return fbStore_c4; /* 1bpp formats */ case PICT_a1: return fbStore_a1; case PICT_g1: return fbStore_g1; default: return NULL; } } /* * Combine src and mask */ static FASTCALL void fbCombineMaskU (CARD32 *src, const CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 a = mask[i] >> 24; CARD32 s = src[i]; FbByteMul(s, a); src[i] = s; } } /* * All of the composing functions */ static FASTCALL void fbCombineClear (CARD32 *dest, const CARD32 *src, int width) { memset(dest, 0, width*sizeof(CARD32)); } static FASTCALL void fbCombineSrcU (CARD32 *dest, const CARD32 *src, int width) { memcpy(dest, src, width*sizeof(CARD32)); } static FASTCALL void fbCombineOverU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = src[i]; CARD32 d = dest[i]; CARD32 ia = Alpha(~s); FbByteMulAdd(d, ia, s); dest[i] = d; } } static FASTCALL void fbCombineOverReverseU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = src[i]; CARD32 d = dest[i]; CARD32 ia = Alpha(~dest[i]); FbByteMulAdd(s, ia, d); dest[i] = s; } } static FASTCALL void fbCombineInU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = src[i]; CARD32 a = Alpha(dest[i]); FbByteMul(s, a); dest[i] = s; } } static FASTCALL void fbCombineInReverseU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = dest[i]; CARD32 a = Alpha(src[i]); FbByteMul(d, a); dest[i] = d; } } static FASTCALL void fbCombineOutU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = src[i]; CARD32 a = Alpha(~dest[i]); FbByteMul(s, a); dest[i] = s; } } static FASTCALL void fbCombineOutReverseU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 d = dest[i]; CARD32 a = Alpha(~src[i]); FbByteMul(d, a); dest[i] = d; } } static FASTCALL void fbCombineAtopU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = src[i]; CARD32 d = dest[i]; CARD32 dest_a = Alpha(d); CARD32 src_ia = Alpha(~s); FbByteAddMul(s, dest_a, d, src_ia); dest[i] = s; } } static FASTCALL void fbCombineAtopReverseU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = src[i]; CARD32 d = dest[i]; CARD32 src_a = Alpha(s); CARD32 dest_ia = Alpha(~d); FbByteAddMul(s, dest_ia, d, src_a); dest[i] = s; } } static FASTCALL void fbCombineXorU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = src[i]; CARD32 d = dest[i]; CARD32 src_ia = Alpha(~s); CARD32 dest_ia = Alpha(~d); FbByteAddMul(s, dest_ia, d, src_ia); dest[i] = s; } } static FASTCALL void fbCombineAddU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = src[i]; CARD32 d = dest[i]; FbByteAdd(d, s); dest[i] = d; } } static FASTCALL void fbCombineSaturateU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = src[i]; CARD32 d = dest[i]; CARD16 sa, da; sa = s >> 24; da = ~d >> 24; if (sa > da) { sa = FbIntDiv(da, sa); FbByteMul(s, sa); } FbByteAdd(d, s); dest[i] = d; } } /* * All of the disjoint composing functions The four entries in the first column indicate what source contributions come from each of the four areas of the picture -- areas covered by neither A nor B, areas covered only by A, areas covered only by B and finally areas covered by both A and B. Disjoint Conjoint Fa Fb Fa Fb (0,0,0,0) 0 0 0 0 (0,A,0,A) 1 0 1 0 (0,0,B,B) 0 1 0 1 (0,A,B,A) 1 min((1-a)/b,1) 1 max(1-a/b,0) (0,A,B,B) min((1-b)/a,1) 1 max(1-b/a,0) 1 (0,0,0,A) max(1-(1-b)/a,0) 0 min(1,b/a) 0 (0,0,0,B) 0 max(1-(1-a)/b,0) 0 min(a/b,1) (0,A,0,0) min(1,(1-b)/a) 0 max(1-b/a,0) 0 (0,0,B,0) 0 min(1,(1-a)/b) 0 max(1-a/b,0) (0,0,B,A) max(1-(1-b)/a,0) min(1,(1-a)/b) min(1,b/a) max(1-a/b,0) (0,A,0,B) min(1,(1-b)/a) max(1-(1-a)/b,0) max(1-b/a,0) min(1,a/b) (0,A,B,0) min(1,(1-b)/a) min(1,(1-a)/b) max(1-b/a,0) max(1-a/b,0) */ #define CombineAOut 1 #define CombineAIn 2 #define CombineBOut 4 #define CombineBIn 8 #define CombineClear 0 #define CombineA (CombineAOut|CombineAIn) #define CombineB (CombineBOut|CombineBIn) #define CombineAOver (CombineAOut|CombineBOut|CombineAIn) #define CombineBOver (CombineAOut|CombineBOut|CombineBIn) #define CombineAAtop (CombineBOut|CombineAIn) #define CombineBAtop (CombineAOut|CombineBIn) #define CombineXor (CombineAOut|CombineBOut) /* portion covered by a but not b */ static INLINE CARD8 fbCombineDisjointOutPart (CARD8 a, CARD8 b) { /* min (1, (1-b) / a) */ b = ~b; /* 1 - b */ if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ return 0xff; /* 1 */ return FbIntDiv(b,a); /* (1-b) / a */ } /* portion covered by both a and b */ static INLINE CARD8 fbCombineDisjointInPart (CARD8 a, CARD8 b) { /* max (1-(1-b)/a,0) */ /* = - min ((1-b)/a - 1, 0) */ /* = 1 - min (1, (1-b)/a) */ b = ~b; /* 1 - b */ if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ return 0; /* 1 - 1 */ return ~FbIntDiv(b,a); /* 1 - (1-b) / a */ } static FASTCALL void fbCombineDisjointGeneralU (CARD32 *dest, const CARD32 *src, int width, CARD8 combine) { int i; for (i = 0; i < width; ++i) { CARD32 s = src[i]; CARD32 d = dest[i]; CARD32 m,n,o,p; CARD16 Fa, Fb, t, u, v; CARD8 sa = s >> 24; CARD8 da = d >> 24; switch (combine & CombineA) { default: Fa = 0; break; case CombineAOut: Fa = fbCombineDisjointOutPart (sa, da); break; case CombineAIn: Fa = fbCombineDisjointInPart (sa, da); break; case CombineA: Fa = 0xff; break; } switch (combine & CombineB) { default: Fb = 0; break; case CombineBOut: Fb = fbCombineDisjointOutPart (da, sa); break; case CombineBIn: Fb = fbCombineDisjointInPart (da, sa); break; case CombineB: Fb = 0xff; break; } m = FbGen (s,d,0,Fa,Fb,t, u, v); n = FbGen (s,d,8,Fa,Fb,t, u, v); o = FbGen (s,d,16,Fa,Fb,t, u, v); p = FbGen (s,d,24,Fa,Fb,t, u, v); s = m|n|o|p; dest[i] = s; } } static FASTCALL void fbCombineDisjointOverU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = src[i]; CARD16 a = s >> 24; if (a != 0x00) { if (a != 0xff) { CARD32 d = dest[i]; a = fbCombineDisjointOutPart (d >> 24, a); FbByteMulAdd(d, a, s); s = d; } dest[i] = s; } } } static FASTCALL void fbCombineDisjointInU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineAIn); } static FASTCALL void fbCombineDisjointInReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineBIn); } static FASTCALL void fbCombineDisjointOutU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineAOut); } static FASTCALL void fbCombineDisjointOutReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineBOut); } static FASTCALL void fbCombineDisjointAtopU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineAAtop); } static FASTCALL void fbCombineDisjointAtopReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineBAtop); } static FASTCALL void fbCombineDisjointXorU (CARD32 *dest, const CARD32 *src, int width) { fbCombineDisjointGeneralU (dest, src, width, CombineXor); } /* portion covered by a but not b */ static INLINE CARD8 fbCombineConjointOutPart (CARD8 a, CARD8 b) { /* max (1-b/a,0) */ /* = 1-min(b/a,1) */ /* min (1, (1-b) / a) */ if (b >= a) /* b >= a -> b/a >= 1 */ return 0x00; /* 0 */ return ~FbIntDiv(b,a); /* 1 - b/a */ } /* portion covered by both a and b */ static INLINE CARD8 fbCombineConjointInPart (CARD8 a, CARD8 b) { /* min (1,b/a) */ if (b >= a) /* b >= a -> b/a >= 1 */ return 0xff; /* 1 */ return FbIntDiv(b,a); /* b/a */ } static FASTCALL void fbCombineConjointGeneralU (CARD32 *dest, const CARD32 *src, int width, CARD8 combine) { int i; for (i = 0; i < width; ++i) { CARD32 s = src[i]; CARD32 d = dest[i]; CARD32 m,n,o,p; CARD16 Fa, Fb, t, u, v; CARD8 sa = s >> 24; CARD8 da = d >> 24; switch (combine & CombineA) { default: Fa = 0; break; case CombineAOut: Fa = fbCombineConjointOutPart (sa, da); break; case CombineAIn: Fa = fbCombineConjointInPart (sa, da); break; case CombineA: Fa = 0xff; break; } switch (combine & CombineB) { default: Fb = 0; break; case CombineBOut: Fb = fbCombineConjointOutPart (da, sa); break; case CombineBIn: Fb = fbCombineConjointInPart (da, sa); break; case CombineB: Fb = 0xff; break; } m = FbGen (s,d,0,Fa,Fb,t, u, v); n = FbGen (s,d,8,Fa,Fb,t, u, v); o = FbGen (s,d,16,Fa,Fb,t, u, v); p = FbGen (s,d,24,Fa,Fb,t, u, v); s = m|n|o|p; dest[i] = s; } } static FASTCALL void fbCombineConjointOverU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineAOver); } static FASTCALL void fbCombineConjointOverReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineBOver); } static FASTCALL void fbCombineConjointInU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineAIn); } static FASTCALL void fbCombineConjointInReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineBIn); } static FASTCALL void fbCombineConjointOutU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineAOut); } static FASTCALL void fbCombineConjointOutReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineBOut); } static FASTCALL void fbCombineConjointAtopU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineAAtop); } static FASTCALL void fbCombineConjointAtopReverseU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineBAtop); } static FASTCALL void fbCombineConjointXorU (CARD32 *dest, const CARD32 *src, int width) { fbCombineConjointGeneralU (dest, src, width, CombineXor); } static CombineFuncU fbCombineFuncU[] = { fbCombineClear, fbCombineSrcU, NULL, /* CombineDst */ fbCombineOverU, fbCombineOverReverseU, fbCombineInU, fbCombineInReverseU, fbCombineOutU, fbCombineOutReverseU, fbCombineAtopU, fbCombineAtopReverseU, fbCombineXorU, fbCombineAddU, fbCombineSaturateU, NULL, NULL, fbCombineClear, fbCombineSrcU, NULL, /* CombineDst */ fbCombineDisjointOverU, fbCombineSaturateU, /* DisjointOverReverse */ fbCombineDisjointInU, fbCombineDisjointInReverseU, fbCombineDisjointOutU, fbCombineDisjointOutReverseU, fbCombineDisjointAtopU, fbCombineDisjointAtopReverseU, fbCombineDisjointXorU, NULL, NULL, NULL, NULL, fbCombineClear, fbCombineSrcU, NULL, /* CombineDst */ fbCombineConjointOverU, fbCombineConjointOverReverseU, fbCombineConjointInU, fbCombineConjointInReverseU, fbCombineConjointOutU, fbCombineConjointOutReverseU, fbCombineConjointAtopU, fbCombineConjointAtopReverseU, fbCombineConjointXorU, }; static FASTCALL void fbCombineMaskC (CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 a = mask[i]; CARD32 x; CARD16 xa; if (!a) { src[i] = 0; continue; } x = src[i]; if (a == 0xffffffff) { x = x >> 24; x |= x << 8; x |= x << 16; mask[i] = x; continue; } xa = x >> 24; FbByteMulC(x, a); src[i] = x; FbByteMul(a, xa); mask[i] = a; } } static FASTCALL void fbCombineMaskValueC (CARD32 *src, const CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 a = mask[i]; CARD32 x; if (!a) { src[i] = 0; continue; } if (a == 0xffffffff) continue; x = src[i]; FbByteMulC(x, a); src[i] = x; } } static FASTCALL void fbCombineMaskAlphaC (const CARD32 *src, CARD32 *mask, int width) { int i; for (i = 0; i < width; ++i) { CARD32 a = mask[i]; CARD32 x; if (!a) continue; x = src[i] >> 24; if (x == 0xff) continue; if (a == 0xffffffff) { x = x >> 24; x |= x << 8; x |= x << 16; mask[i] = x; continue; } FbByteMul(a, x); mask[i] = a; } } static FASTCALL void fbCombineClearC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { memset(dest, 0, width*sizeof(CARD32)); } static FASTCALL void fbCombineSrcC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineMaskValueC(src, mask, width); memcpy(dest, src, width*sizeof(CARD32)); } static FASTCALL void fbCombineOverC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; fbCombineMaskC(src, mask, width); for (i = 0; i < width; ++i) { CARD32 s = src[i]; CARD32 a = ~mask[i]; if (a != 0xffffffff) { if (a) { CARD32 d = dest[i]; FbByteMulAddC(d, a, s); s = d; } dest[i] = s; } } } static FASTCALL void fbCombineOverReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; fbCombineMaskValueC(src, mask, width); for (i = 0; i < width; ++i) { CARD32 d = dest[i]; CARD32 a = ~d >> 24; if (a) { CARD32 s = src[i]; if (a != 0xff) { FbByteMulAdd(s, a, d); } dest[i] = s; } } } static FASTCALL void fbCombineInC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; fbCombineMaskValueC(src, mask, width); for (i = 0; i < width; ++i) { CARD32 d = dest[i]; CARD16 a = d >> 24; CARD32 s = 0; if (a) { s = src[i]; if (a != 0xff) { FbByteMul(s, a); } } dest[i] = s; } } static FASTCALL void fbCombineInReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; fbCombineMaskAlphaC(src, mask, width); for (i = 0; i < width; ++i) { CARD32 a = mask[i]; if (a != 0xffffffff) { CARD32 d = 0; if (a) { d = dest[i]; FbByteMulC(d, a); } dest[i] = d; } } } static FASTCALL void fbCombineOutC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; fbCombineMaskValueC(src, mask, width); for (i = 0; i < width; ++i) { CARD32 d = dest[i]; CARD16 a = ~d >> 24; CARD32 s = 0; if (a) { s = src[i]; if (a != 0xff) { FbByteMul(s, a); } } dest[i] = s; } } static FASTCALL void fbCombineOutReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; fbCombineMaskAlphaC(src, mask, width); for (i = 0; i < width; ++i) { CARD32 a = ~mask[i]; if (a != 0xffffffff) { CARD32 d = 0; if (a) { d = dest[i]; FbByteMulC(d, a); } dest[i] = d; } } } static FASTCALL void fbCombineAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; fbCombineMaskC(src, mask, width); for (i = 0; i < width; ++i) { CARD32 d = dest[i]; CARD32 s = src[i]; CARD32 ad = ~mask[i]; CARD16 as = d >> 24; FbByteAddMulC(d, ad, s, as); dest[i] = d; } } static FASTCALL void fbCombineAtopReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; fbCombineMaskC(src, mask, width); for (i = 0; i < width; ++i) { CARD32 d = dest[i]; CARD32 s = src[i]; CARD32 ad = mask[i]; CARD16 as = ~d >> 24; FbByteAddMulC(d, ad, s, as); dest[i] = d; } } static FASTCALL void fbCombineXorC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; fbCombineMaskC(src, mask, width); for (i = 0; i < width; ++i) { CARD32 d = dest[i]; CARD32 s = src[i]; CARD32 ad = ~mask[i]; CARD16 as = ~d >> 24; FbByteAddMulC(d, ad, s, as); dest[i] = d; } } static FASTCALL void fbCombineAddC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; fbCombineMaskValueC(src, mask, width); for (i = 0; i < width; ++i) { CARD32 s = src[i]; CARD32 d = dest[i]; FbByteAdd(d, s); dest[i] = d; } } static FASTCALL void fbCombineSaturateC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { int i; fbCombineMaskC(src, mask, width); for (i = 0; i < width; ++i) { CARD32 s, d; CARD16 sa, sr, sg, sb, da; CARD16 t, u, v; CARD32 m,n,o,p; d = dest[i]; s = src[i]; sa = (mask[i] >> 24); sr = (mask[i] >> 16) & 0xff; sg = (mask[i] >> 8) & 0xff; sb = (mask[i] ) & 0xff; da = ~d >> 24; if (sb <= da) m = FbAdd(s,d,0,t); else m = FbGen (s, d, 0, (da << 8) / sb, 0xff, t, u, v); if (sg <= da) n = FbAdd(s,d,8,t); else n = FbGen (s, d, 8, (da << 8) / sg, 0xff, t, u, v); if (sr <= da) o = FbAdd(s,d,16,t); else o = FbGen (s, d, 16, (da << 8) / sr, 0xff, t, u, v); if (sa <= da) p = FbAdd(s,d,24,t); else p = FbGen (s, d, 24, (da << 8) / sa, 0xff, t, u, v); dest[i] = m|n|o|p; } } static FASTCALL void fbCombineDisjointGeneralC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width, CARD8 combine) { int i; fbCombineMaskC(src, mask, width); for (i = 0; i < width; ++i) { CARD32 s, d; CARD32 m,n,o,p; CARD32 Fa, Fb; CARD16 t, u, v; CARD32 sa; CARD8 da; s = src[i]; sa = mask[i]; d = dest[i]; da = d >> 24; switch (combine & CombineA) { default: Fa = 0; break; case CombineAOut: m = fbCombineDisjointOutPart ((CARD8) (sa >> 0), da); n = fbCombineDisjointOutPart ((CARD8) (sa >> 8), da) << 8; o = fbCombineDisjointOutPart ((CARD8) (sa >> 16), da) << 16; p = fbCombineDisjointOutPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineAIn: m = fbCombineDisjointInPart ((CARD8) (sa >> 0), da); n = fbCombineDisjointInPart ((CARD8) (sa >> 8), da) << 8; o = fbCombineDisjointInPart ((CARD8) (sa >> 16), da) << 16; p = fbCombineDisjointInPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineA: Fa = 0xffffffff; break; } switch (combine & CombineB) { default: Fb = 0; break; case CombineBOut: m = fbCombineDisjointOutPart (da, (CARD8) (sa >> 0)); n = fbCombineDisjointOutPart (da, (CARD8) (sa >> 8)) << 8; o = fbCombineDisjointOutPart (da, (CARD8) (sa >> 16)) << 16; p = fbCombineDisjointOutPart (da, (CARD8) (sa >> 24)) << 24; Fb = m|n|o|p; break; case CombineBIn: m = fbCombineDisjointInPart (da, (CARD8) (sa >> 0)); n = fbCombineDisjointInPart (da, (CARD8) (sa >> 8)) << 8; o = fbCombineDisjointInPart (da, (CARD8) (sa >> 16)) << 16; p = fbCombineDisjointInPart (da, (CARD8) (sa >> 24)) << 24; Fb = m|n|o|p; break; case CombineB: Fb = 0xffffffff; break; } m = FbGen (s,d,0,FbGet8(Fa,0),FbGet8(Fb,0),t, u, v); n = FbGen (s,d,8,FbGet8(Fa,8),FbGet8(Fb,8),t, u, v); o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t, u, v); p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t, u, v); s = m|n|o|p; dest[i] = s; } } static FASTCALL void fbCombineDisjointOverC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOver); } static FASTCALL void fbCombineDisjointInC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineAIn); } static FASTCALL void fbCombineDisjointInReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineBIn); } static FASTCALL void fbCombineDisjointOutC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOut); } static FASTCALL void fbCombineDisjointOutReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineBOut); } static FASTCALL void fbCombineDisjointAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineAAtop); } static FASTCALL void fbCombineDisjointAtopReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineBAtop); } static FASTCALL void fbCombineDisjointXorC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineXor); } static FASTCALL void fbCombineConjointGeneralC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width, CARD8 combine) { int i; fbCombineMaskC(src, mask, width); for (i = 0; i < width; ++i) { CARD32 s, d; CARD32 m,n,o,p; CARD32 Fa, Fb; CARD16 t, u, v; CARD32 sa; CARD8 da; s = src[i]; sa = mask[i]; d = dest[i]; da = d >> 24; switch (combine & CombineA) { default: Fa = 0; break; case CombineAOut: m = fbCombineConjointOutPart ((CARD8) (sa >> 0), da); n = fbCombineConjointOutPart ((CARD8) (sa >> 8), da) << 8; o = fbCombineConjointOutPart ((CARD8) (sa >> 16), da) << 16; p = fbCombineConjointOutPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineAIn: m = fbCombineConjointInPart ((CARD8) (sa >> 0), da); n = fbCombineConjointInPart ((CARD8) (sa >> 8), da) << 8; o = fbCombineConjointInPart ((CARD8) (sa >> 16), da) << 16; p = fbCombineConjointInPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineA: Fa = 0xffffffff; break; } switch (combine & CombineB) { default: Fb = 0; break; case CombineBOut: m = fbCombineConjointOutPart (da, (CARD8) (sa >> 0)); n = fbCombineConjointOutPart (da, (CARD8) (sa >> 8)) << 8; o = fbCombineConjointOutPart (da, (CARD8) (sa >> 16)) << 16; p = fbCombineConjointOutPart (da, (CARD8) (sa >> 24)) << 24; Fb = m|n|o|p; break; case CombineBIn: m = fbCombineConjointInPart (da, (CARD8) (sa >> 0)); n = fbCombineConjointInPart (da, (CARD8) (sa >> 8)) << 8; o = fbCombineConjointInPart (da, (CARD8) (sa >> 16)) << 16; p = fbCombineConjointInPart (da, (CARD8) (sa >> 24)) << 24; Fb = m|n|o|p; break; case CombineB: Fb = 0xffffffff; break; } m = FbGen (s,d,0,FbGet8(Fa,0),FbGet8(Fb,0),t, u, v); n = FbGen (s,d,8,FbGet8(Fa,8),FbGet8(Fb,8),t, u, v); o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t, u, v); p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t, u, v); s = m|n|o|p; dest[i] = s; } } static FASTCALL void fbCombineConjointOverC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineAOver); } static FASTCALL void fbCombineConjointOverReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineBOver); } static FASTCALL void fbCombineConjointInC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineAIn); } static FASTCALL void fbCombineConjointInReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineBIn); } static FASTCALL void fbCombineConjointOutC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineAOut); } static FASTCALL void fbCombineConjointOutReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineBOut); } static FASTCALL void fbCombineConjointAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineAAtop); } static FASTCALL void fbCombineConjointAtopReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineBAtop); } static FASTCALL void fbCombineConjointXorC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineXor); } static CombineFuncC fbCombineFuncC[] = { fbCombineClearC, fbCombineSrcC, NULL, /* Dest */ fbCombineOverC, fbCombineOverReverseC, fbCombineInC, fbCombineInReverseC, fbCombineOutC, fbCombineOutReverseC, fbCombineAtopC, fbCombineAtopReverseC, fbCombineXorC, fbCombineAddC, fbCombineSaturateC, NULL, NULL, fbCombineClearC, /* 0x10 */ fbCombineSrcC, NULL, /* Dest */ fbCombineDisjointOverC, fbCombineSaturateC, /* DisjointOverReverse */ fbCombineDisjointInC, fbCombineDisjointInReverseC, fbCombineDisjointOutC, fbCombineDisjointOutReverseC, fbCombineDisjointAtopC, fbCombineDisjointAtopReverseC, fbCombineDisjointXorC, /* 0x1b */ NULL, NULL, NULL, NULL, fbCombineClearC, fbCombineSrcC, NULL, /* Dest */ fbCombineConjointOverC, fbCombineConjointOverReverseC, fbCombineConjointInC, fbCombineConjointInReverseC, fbCombineConjointOutC, fbCombineConjointOutReverseC, fbCombineConjointAtopC, fbCombineConjointAtopReverseC, fbCombineConjointXorC, }; FbComposeFunctions composeFunctions = { fbCombineFuncU, fbCombineFuncC, fbCombineMaskU }; static void fbFetchSolid(PicturePtr pict, int x, int y, int width, CARD32 *buffer) { FbBits *bits; FbStride stride; int bpp; int xoff, yoff; CARD32 color; CARD32 *end; fetchPixelProc fetch = fetchPixelProcForPicture(pict); miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); bits += yoff*stride + (xoff*bpp >> FB_SHIFT); color = fetch(bits, 0, indexed); end = buffer + width; while (buffer < end) *buffer++ = color; } static void fbFetch(PicturePtr pict, int x, int y, int width, CARD32 *buffer) { FbBits *bits; FbStride stride; int bpp; int xoff, yoff; fetchProc fetch = fetchProcForPicture(pict); miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); x += xoff; y += yoff; bits += y*stride; fetch(bits, x, width, buffer, indexed); } #define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b)) #define DIV(a,b) ((((a) < 0) == ((b) < 0)) ? (a) / (b) :\ ((a) - (b) + 1 - (((b) < 0) << 1)) / (b)) static CARD32 gradientPixel(const SourcePictPtr pGradient, xFixed_48_16 pos, unsigned int spread) { int ipos = (pos * PICT_GRADIENT_STOPTABLE_SIZE - 1) >> 16; /* calculate the actual offset. */ if (ipos < 0 || ipos >= PICT_GRADIENT_STOPTABLE_SIZE) { if (pGradient->type == SourcePictTypeConical || spread == RepeatNormal) { ipos = ipos % PICT_GRADIENT_STOPTABLE_SIZE; ipos = ipos < 0 ? PICT_GRADIENT_STOPTABLE_SIZE + ipos : ipos; } else if (spread == RepeatReflect) { const int limit = PICT_GRADIENT_STOPTABLE_SIZE * 2 - 1; ipos = ipos % limit; ipos = ipos < 0 ? limit + ipos : ipos; ipos = ipos >= PICT_GRADIENT_STOPTABLE_SIZE ? limit - ipos : ipos; } else if (spread == RepeatPad) { if (ipos < 0) ipos = 0; else if (ipos >= PICT_GRADIENT_STOPTABLE_SIZE) ipos = PICT_GRADIENT_STOPTABLE_SIZE-1; } else { /* RepeatNone */ return 0; } } assert(ipos >= 0); assert(ipos < PICT_GRADIENT_STOPTABLE_SIZE); return pGradient->linear.colorTable[ipos]; } static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 *buffer) { SourcePictPtr pGradient = pict->pSourcePict; CARD32 *end = buffer + width; if (pGradient->type == SourcePictTypeSolidFill) { register CARD32 color = pGradient->solidFill.color; while (buffer < end) { *buffer++ = color; } } else if (pGradient->type == SourcePictTypeLinear) { PictVector v, unit; xFixed_32_32 l; xFixed_48_16 dx, dy, a, b, off; v.vector[0] = IntToxFixed(x); v.vector[1] = IntToxFixed(y); v.vector[2] = xFixed1; if (pict->transform) { if (!PictureTransformPoint3d (pict->transform, &v)) return; unit.vector[0] = pict->transform->matrix[0][0]; unit.vector[1] = pict->transform->matrix[1][0]; unit.vector[2] = pict->transform->matrix[2][0]; } else { unit.vector[0] = xFixed1; unit.vector[1] = 0; unit.vector[2] = 0; } dx = pGradient->linear.p2.x - pGradient->linear.p1.x; dy = pGradient->linear.p2.y - pGradient->linear.p1.y; l = dx*dx + dy*dy; if (l != 0) { a = (dx << 32) / l; b = (dy << 32) / l; off = (-a*pGradient->linear.p1.x - b*pGradient->linear.p1.y)>>16; } if (l == 0 || (unit.vector[2] == 0 && v.vector[2] == xFixed1)) { xFixed_48_16 inc, t; /* affine transformation only */ if (l == 0) { t = 0; inc = 0; } else { t = ((a*v.vector[0] + b*v.vector[1]) >> 16) + off; inc = (a * unit.vector[0] + b * unit.vector[1]) >> 16; } while (buffer < end) { *buffer++ = gradientPixel(pGradient, t, pict->repeatType); t += inc; } } else { /* projective transformation */ while (buffer < end) { xFixed_48_16 t; if (v.vector[2] == 0) { t = 0; } else { xFixed_48_16 x, y; x = ((xFixed_48_16)v.vector[0] << 16) / v.vector[2]; y = ((xFixed_48_16)v.vector[1] << 16) / v.vector[2]; t = ((a*x + b*y) >> 16) + off; } *buffer++ = gradientPixel(pGradient, t, pict->repeatType); v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } } else { /* radial or conical */ Bool affine = TRUE; double cx = 1.; double cy = 0.; double cz = 0.; double rx = x; double ry = y; double rz = 1.; if (pict->transform) { PictVector v; v.vector[0] = IntToxFixed(x); v.vector[1] = IntToxFixed(y); v.vector[2] = xFixed1; if (!PictureTransformPoint3d (pict->transform, &v)) return; cx = pict->transform->matrix[0][0]/65536.; cy = pict->transform->matrix[1][0]/65536.; cz = pict->transform->matrix[2][0]/65536.; rx = v.vector[0]/65536.; ry = v.vector[1]/65536.; rz = v.vector[2]/65536.; affine = pict->transform->matrix[2][0] == 0 && v.vector[2] == xFixed1; } if (pGradient->type == SourcePictTypeRadial) { if (affine) { rx -= pGradient->radial.fx; ry -= pGradient->radial.fy; while (buffer < end) { double b = 2*(rx*pGradient->radial.dx + ry*pGradient->radial.dy); double c = -(rx*rx + ry*ry); double det = (b * b) - (4 * pGradient->radial.a * c); double s = (-b + sqrt(det))/(2. * pGradient->radial.a); *buffer = gradientPixel(pGradient, (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536), pict->repeatType); ++buffer; rx += cx; ry += cy; } } else { while (buffer < end) { double x, y; double b, c, det, s; if (rz != 0) { x = rx/rz; y = ry/rz; } else { x = y = 0.; } x -= pGradient->radial.fx; y -= pGradient->radial.fy; b = 2*(x*pGradient->radial.dx + y*pGradient->radial.dy); c = -(x*x + y*y); det = (b * b) - (4 * pGradient->radial.a * c); s = (-b + sqrt(det))/(2. * pGradient->radial.a); *buffer = gradientPixel(pGradient, (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536), pict->repeatType); ++buffer; rx += cx; ry += cy; rz += cz; } } } else /* SourcePictTypeConical */ { double a = pGradient->conical.angle/(180.*65536); if (affine) { rx -= pGradient->conical.center.x/65536.; ry -= pGradient->conical.center.y/65536.; while (buffer < end) { double angle = atan2(ry, rx) + a; *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))), pict->repeatType); ++buffer; rx += cx; ry += cy; } } else { while (buffer < end) { double x, y, angle; if (rz != 0) { x = rx/rz; y = ry/rz; } else { x = y = 0.; } x -= pGradient->conical.center.x/65536.; y -= pGradient->conical.center.y/65536.; angle = atan2(y, x) + a; *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))), pict->repeatType); ++buffer; rx += cx; ry += cy; rz += cz; } } } } } static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 *buffer) { FbBits *bits; FbStride stride; int bpp; int xoff, yoff, dx, dy; fetchPixelProc fetch; PictVector v; PictVector unit; int i; BoxRec box; miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; Bool affine = TRUE; fetch = fetchPixelProcForPicture(pict); fbGetDrawable(pict->pDrawable, bits, stride, bpp, xoff, yoff); x += xoff; y += yoff; dx = pict->pDrawable->x; dy = pict->pDrawable->y; v.vector[0] = IntToxFixed(x - dx); v.vector[1] = IntToxFixed(y - dy); v.vector[2] = xFixed1; /* when using convolution filters one might get here without a transform */ if (pict->transform) { if (!PictureTransformPoint3d (pict->transform, &v)) return; unit.vector[0] = pict->transform->matrix[0][0]; unit.vector[1] = pict->transform->matrix[1][0]; unit.vector[2] = pict->transform->matrix[2][0]; affine = v.vector[2] == xFixed1 && unit.vector[2] == 0; } else { unit.vector[0] = xFixed1; unit.vector[1] = 0; unit.vector[2] = 0; } if (pict->filter == PictFilterNearest) { if (pict->repeatType == RepeatNormal) { if (RegionNumRects(pict->pCompositeClip) == 1) { for (i = 0; i < width; ++i) { if (!v.vector[2]) { buffer[i] = 0; } else { if (!affine) { y = MOD(DIV(v.vector[1],v.vector[2]), pict->pDrawable->height); x = MOD(DIV(v.vector[0],v.vector[2]), pict->pDrawable->width); } else { y = MOD(v.vector[1]>>16, pict->pDrawable->height); x = MOD(v.vector[0]>>16, pict->pDrawable->width); } buffer[i] = fetch(bits + (y + dy)*stride, x + dx, indexed); } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } else { for (i = 0; i < width; ++i) { if (!v.vector[2]) { buffer[i] = 0; } else { if (!affine) { y = MOD(DIV(v.vector[1],v.vector[2]), pict->pDrawable->height); x = MOD(DIV(v.vector[0],v.vector[2]), pict->pDrawable->width); } else { y = MOD(v.vector[1]>>16, pict->pDrawable->height); x = MOD(v.vector[0]>>16, pict->pDrawable->width); } if (RegionContainsPoint(pict->pCompositeClip, x + dx, y + dy, &box)) buffer[i] = fetch(bits + (y + dy)*stride, x + dx, indexed); else buffer[i] = 0; } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } } else { if (RegionNumRects(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; for (i = 0; i < width; ++i) { if (!v.vector[2]) { buffer[i] = 0; } else { if (!affine) { y = DIV(v.vector[1],v.vector[2]); x = DIV(v.vector[0],v.vector[2]); } else { y = v.vector[1]>>16; x = v.vector[0]>>16; } buffer[i] = ((x < box.x1-dx) | (x >= box.x2-dx) | (y < box.y1-dy) | (y >= box.y2-dy)) ? 0 : fetch(bits + (y + dy)*stride, x + dx, indexed); } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } else { for (i = 0; i < width; ++i) { if (!v.vector[2]) { buffer[i] = 0; } else { if (!affine) { y = DIV(v.vector[1],v.vector[2]); x = DIV(v.vector[0],v.vector[2]); } else { y = v.vector[1]>>16; x = v.vector[0]>>16; } if (RegionContainsPoint(pict->pCompositeClip, x + dx, y + dy, &box)) buffer[i] = fetch(bits + (y + dy)*stride, x + dx, indexed); else buffer[i] = 0; } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } } } else if (pict->filter == PictFilterBilinear) { if (pict->repeatType == RepeatNormal) { if (RegionNumRects(pict->pCompositeClip) == 1) { for (i = 0; i < width; ++i) { if (!v.vector[2]) { buffer[i] = 0; } else { int x1, x2, y1, y2, distx, idistx, disty, idisty; FbBits *b; CARD32 tl, tr, bl, br, r; CARD32 ft, fb; if (!affine) { xFixed_48_16 div; div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; x1 = div >> 16; distx = ((xFixed)div >> 8) & 0xff; div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; y1 = div >> 16; disty = ((xFixed)div >> 8) & 0xff; } else { x1 = v.vector[0] >> 16; distx = (v.vector[0] >> 8) & 0xff; y1 = v.vector[1] >> 16; disty = (v.vector[1] >> 8) & 0xff; } x2 = x1 + 1; y2 = y1 + 1; idistx = 256 - distx; idisty = 256 - disty; x1 = MOD (x1, pict->pDrawable->width); x2 = MOD (x2, pict->pDrawable->width); y1 = MOD (y1, pict->pDrawable->height); y2 = MOD (y2, pict->pDrawable->height); b = bits + (y1 + dy)*stride; tl = fetch(b, x1 + dx, indexed); tr = fetch(b, x2 + dx, indexed); b = bits + (y2 + dy)*stride; bl = fetch(b, x1 + dx, indexed); br = fetch(b, x2 + dx, indexed); ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; r = (((ft * idisty + fb * disty) >> 16) & 0xff); ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; r |= (((ft * idisty + fb * disty)) & 0xff0000); ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); buffer[i] = r; } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } else { for (i = 0; i < width; ++i) { if (!v.vector[2]) { buffer[i] = 0; } else { int x1, x2, y1, y2, distx, idistx, disty, idisty; FbBits *b; CARD32 tl, tr, bl, br, r; CARD32 ft, fb; if (!affine) { xFixed_48_16 div; div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; x1 = div >> 16; distx = ((xFixed)div >> 8) & 0xff; div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; y1 = div >> 16; disty = ((xFixed)div >> 8) & 0xff; } else { x1 = v.vector[0] >> 16; distx = (v.vector[0] >> 8) & 0xff; y1 = v.vector[1] >> 16; disty = (v.vector[1] >> 8) & 0xff; } x2 = x1 + 1; y2 = y1 + 1; idistx = 256 - distx; idisty = 256 - disty; x1 = MOD (x1, pict->pDrawable->width); x2 = MOD (x2, pict->pDrawable->width); y1 = MOD (y1, pict->pDrawable->height); y2 = MOD (y2, pict->pDrawable->height); b = bits + (y1 + dy)*stride; tl = RegionContainsPoint(pict->pCompositeClip, x1 + dx, y1 + dy, &box) ? fetch(b, x1 + dx, indexed) : 0; tr = RegionContainsPoint(pict->pCompositeClip, x2 + dx, y1 + dy, &box) ? fetch(b, x2 + dx, indexed) : 0; b = bits + (y2 + dy)*stride; bl = RegionContainsPoint(pict->pCompositeClip, x1 + dx, y2 + dy, &box) ? fetch(b, x1 + dx, indexed) : 0; br = RegionContainsPoint(pict->pCompositeClip, x2 + dx, y2 + dy, &box) ? fetch(b, x2 + dx, indexed) : 0; ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; r = (((ft * idisty + fb * disty) >> 16) & 0xff); ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; r |= (((ft * idisty + fb * disty)) & 0xff0000); ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); buffer[i] = r; } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } } else { if (RegionNumRects(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; for (i = 0; i < width; ++i) { if (!v.vector[2]) { buffer[i] = 0; } else { int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off; FbBits *b; CARD32 tl, tr, bl, br, r; Bool x1_out, x2_out, y1_out, y2_out; CARD32 ft, fb; if (!affine) { xFixed_48_16 div; div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; x1 = div >> 16; distx = ((xFixed)div >> 8) & 0xff; div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; y1 = div >> 16; disty = ((xFixed)div >> 8) & 0xff; } else { x1 = v.vector[0] >> 16; distx = (v.vector[0] >> 8) & 0xff; y1 = v.vector[1] >> 16; disty = (v.vector[1] >> 8) & 0xff; } x2 = x1 + 1; y2 = y1 + 1; idistx = 256 - distx; idisty = 256 - disty; b = bits + (y1 + dy)*stride; x_off = x1 + dx; x1_out = (x1 < box.x1-dx) | (x1 >= box.x2-dx); x2_out = (x2 < box.x1-dx) | (x2 >= box.x2-dx); y1_out = (y1 < box.y1-dy) | (y1 >= box.y2-dy); y2_out = (y2 < box.y1-dy) | (y2 >= box.y2-dy); tl = x1_out|y1_out ? 0 : fetch(b, x_off, indexed); tr = x2_out|y1_out ? 0 : fetch(b, x_off + 1, indexed); b += stride; bl = x1_out|y2_out ? 0 : fetch(b, x_off, indexed); br = x2_out|y2_out ? 0 : fetch(b, x_off + 1, indexed); ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; r = (((ft * idisty + fb * disty) >> 16) & 0xff); ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; r |= (((ft * idisty + fb * disty)) & 0xff0000); ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); buffer[i] = r; } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } else { for (i = 0; i < width; ++i) { if (!v.vector[2]) { buffer[i] = 0; } else { int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off; FbBits *b; CARD32 tl, tr, bl, br, r; CARD32 ft, fb; if (!affine) { xFixed_48_16 div; div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; x1 = div >> 16; distx = ((xFixed)div >> 8) & 0xff; div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; y1 = div >> 16; disty = ((xFixed)div >> 8) & 0xff; } else { x1 = v.vector[0] >> 16; distx = (v.vector[0] >> 8) & 0xff; y1 = v.vector[1] >> 16; disty = (v.vector[1] >> 8) & 0xff; } x2 = x1 + 1; y2 = y1 + 1; idistx = 256 - distx; idisty = 256 - disty; b = bits + (y1 + dy)*stride; x_off = x1 + dx; tl = RegionContainsPoint(pict->pCompositeClip, x1 + dx, y1 + dy, &box) ? fetch(b, x_off, indexed) : 0; tr = RegionContainsPoint(pict->pCompositeClip, x2 + dx, y1 + dy, &box) ? fetch(b, x_off + 1, indexed) : 0; b += stride; bl = RegionContainsPoint(pict->pCompositeClip, x1 + dx, y2 + dy, &box) ? fetch(b, x_off, indexed) : 0; br = RegionContainsPoint(pict->pCompositeClip, x2 + dx, y2 + dy, &box) ? fetch(b, x_off + 1, indexed) : 0; ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx; r = (((ft * idisty + fb * disty) >> 16) & 0xff); ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx; fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx; r |= (((ft * idisty + fb * disty) >> 8) & 0xff00); ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx; fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx; r |= (((ft * idisty + fb * disty)) & 0xff0000); ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx; fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx; r |= (((ft * idisty + fb * disty) << 8) & 0xff000000); buffer[i] = r; } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } } } else if (pict->filter == PictFilterConvolution) { xFixed *params = pict->filter_params; INT32 cwidth = xFixedToInt(params[0]); INT32 cheight = xFixedToInt(params[1]); int xoff = params[0] >> 1; int yoff = params[1] >> 1; params += 2; for (i = 0; i < width; ++i) { if (!v.vector[2]) { buffer[i] = 0; } else { int x1, x2, y1, y2, x, y; INT32 srtot, sgtot, sbtot, satot; xFixed *p = params; if (!affine) { xFixed_48_16 tmp; tmp = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2] - xoff; x1 = xFixedToInt(tmp); tmp = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2] - yoff; y1 = xFixedToInt(tmp); } else { x1 = xFixedToInt(v.vector[0] - xoff); y1 = xFixedToInt(v.vector[1] - yoff); } x2 = x1 + cwidth; y2 = y1 + cheight; srtot = sgtot = sbtot = satot = 0; for (y = y1; y < y2; y++) { int ty = (pict->repeatType == RepeatNormal) ? MOD (y, pict->pDrawable->height) : y; for (x = x1; x < x2; x++) { if (*p) { int tx = (pict->repeatType == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x; if (RegionContainsPoint(pict->pCompositeClip, tx + dx, ty + dy, &box)) { FbBits *b = bits + (ty + dy)*stride; CARD32 c = fetch(b, tx + dx, indexed); srtot += Red(c) * *p; sgtot += Green(c) * *p; sbtot += Blue(c) * *p; satot += Alpha(c) * *p; } } p++; } } if (satot < 0) satot = 0; else if (satot > 0xff) satot = 0xff; if (srtot < 0) srtot = 0; else if (srtot > 0xff) srtot = 0xff; if (sgtot < 0) sgtot = 0; else if (sgtot > 0xff) sgtot = 0xff; if (sbtot < 0) sbtot = 0; else if (sbtot > 0xff) sbtot = 0xff; buffer[i] = ((satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot )); } v.vector[0] += unit.vector[0]; v.vector[1] += unit.vector[1]; v.vector[2] += unit.vector[2]; } } } static void fbFetchExternalAlpha(PicturePtr pict, int x, int y, int width, CARD32 *buffer) { int i; CARD32 _alpha_buffer[SCANLINE_BUFFER_LENGTH]; CARD32 *alpha_buffer = _alpha_buffer; if (!pict->alphaMap) { fbFetchTransformed(pict, x, y, width, buffer); return; } if (width > SCANLINE_BUFFER_LENGTH) alpha_buffer = (CARD32 *) malloc(width*sizeof(CARD32)); fbFetchTransformed(pict, x, y, width, buffer); fbFetchTransformed(pict->alphaMap, x - pict->alphaOrigin.x, y - pict->alphaOrigin.y, width, alpha_buffer); for (i = 0; i < width; ++i) { int a = alpha_buffer[i]>>24; buffer[i] = (a << 24) | (div_255(Red(buffer[i]) * a) << 16) | (div_255(Green(buffer[i]) * a) << 8) | (div_255(Blue(buffer[i]) * a)); } if (alpha_buffer != _alpha_buffer) free(alpha_buffer); } static void fbStore(PicturePtr pict, int x, int y, int width, CARD32 *buffer) { FbBits *bits; FbStride stride; int bpp; int xoff, yoff; storeProc store = storeProcForPicture(pict); miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); x += xoff; y += yoff; bits += y*stride; store(bits, buffer, x, width, indexed); } static void fbStoreExternalAlpha(PicturePtr pict, int x, int y, int width, CARD32 *buffer) { FbBits *bits, *alpha_bits; FbStride stride, astride; int bpp, abpp; int xoff, yoff; int ax, ay; storeProc store; storeProc astore; miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; miIndexedPtr aindexed; if (!pict->alphaMap) { fbStore(pict, x, y, width, buffer); return; } store = storeProcForPicture(pict); astore = storeProcForPicture(pict->alphaMap); aindexed = (miIndexedPtr) pict->alphaMap->pFormat->index.devPrivate; ax = x; ay = y; fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); x += xoff; y += yoff; fbGetDrawable (pict->alphaMap->pDrawable, alpha_bits, astride, abpp, xoff, yoff); ax += xoff; ay += yoff; bits += y*stride; alpha_bits += (ay - pict->alphaOrigin.y)*astride; store(bits, buffer, x, width, indexed); astore(alpha_bits, buffer, ax - pict->alphaOrigin.x, width, aindexed); } typedef void (*scanStoreProc)(PicturePtr , int , int , int , CARD32 *); typedef void (*scanFetchProc)(PicturePtr , int , int , int , CARD32 *); static void fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer) { CARD32 *src_buffer = scanline_buffer; CARD32 *dest_buffer = src_buffer + data->width; int i; scanStoreProc store; scanFetchProc fetchSrc = NULL, fetchMask = NULL, fetchDest = NULL; if (data->op == PictOpClear) fetchSrc = NULL; else if (!data->src->pDrawable) { if (data->src->pSourcePict) fetchSrc = fbFetchSourcePict; } else if (data->src->alphaMap) fetchSrc = fbFetchExternalAlpha; else if (data->src->repeatType == RepeatNormal && data->src->pDrawable->width == 1 && data->src->pDrawable->height == 1) fetchSrc = fbFetchSolid; else if (!data->src->transform && data->src->filter != PictFilterConvolution) fetchSrc = fbFetch; else fetchSrc = fbFetchTransformed; if (data->mask && data->op != PictOpClear) { if (!data->mask->pDrawable) { if (data->mask->pSourcePict) fetchMask = fbFetchSourcePict; } else if (data->mask->alphaMap) fetchMask = fbFetchExternalAlpha; else if (data->mask->repeatType == RepeatNormal && data->mask->pDrawable->width == 1 && data->mask->pDrawable->height == 1) fetchMask = fbFetchSolid; else if (!data->mask->transform && data->mask->filter != PictFilterConvolution) fetchMask = fbFetch; else fetchMask = fbFetchTransformed; } else { fetchMask = NULL; } if (data->dest->alphaMap) { fetchDest = fbFetchExternalAlpha; store = fbStoreExternalAlpha; } else { fetchDest = fbFetch; store = fbStore; } if (data->op == PictOpClear || data->op == PictOpSrc) fetchDest = NULL; if (fetchSrc && fetchMask && data->mask && data->mask->componentAlpha && PICT_FORMAT_RGB(data->mask->format)) { CARD32 *mask_buffer = dest_buffer + data->width; CombineFuncC compose = composeFunctions.combineC[data->op]; if (!compose) return; for (i = 0; i < data->height; ++i) { /* fill first half of scanline with source */ fetchSrc(data->src, data->xSrc, data->ySrc + i, data->width, src_buffer); fetchMask(data->mask, data->xMask, data->yMask + i, data->width, mask_buffer); /* fill dest into second half of scanline */ if (fetchDest) fetchDest(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); /* blend */ compose(dest_buffer, src_buffer, mask_buffer, data->width); /* write back */ store(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); } } else { CombineFuncU compose = composeFunctions.combineU[data->op]; if (!compose) return; if (fetchSrc == fbFetchSolid && (!fetchMask || fetchMask == fbFetchSolid)) { fetchSrc(data->src, data->xSrc, data->ySrc, data->width, src_buffer); if (fetchMask) { fetchMask(data->mask, data->xMask, data->yMask, data->width, dest_buffer); composeFunctions.combineMaskU(src_buffer, dest_buffer, data->width); } fetchSrc = NULL; fetchMask = NULL; } for (i = 0; i < data->height; ++i) { /* fill first half of scanline with source */ if (fetchSrc) { fetchSrc(data->src, data->xSrc, data->ySrc + i, data->width, src_buffer); /* add in mask */ if (fetchMask) { fetchMask(data->mask, data->xMask, data->yMask + i, data->width, dest_buffer); composeFunctions.combineMaskU(src_buffer, dest_buffer, data->width); } } /* fill dest into second half of scanline */ if (fetchDest) fetchDest(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); /* blend */ compose(dest_buffer, src_buffer, data->width); /* write back */ store(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); } } } void fbCompositeGeneral (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { RegionRec region; int n; BoxPtr pbox; Bool srcRepeat = FALSE; Bool maskRepeat = FALSE; int w, h; CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; CARD32 *scanline_buffer = _scanline_buffer; FbComposeData compose_data; if (pSrc->pDrawable) srcRepeat = pSrc->repeatType == RepeatNormal && !pSrc->transform && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); if (pMask && pMask->pDrawable) maskRepeat = pMask->repeatType == RepeatNormal && !pMask->transform && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); if (op == PictOpOver && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format) && !pSrc->alphaMap) op = PictOpSrc; if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height)) return; compose_data.op = op; compose_data.src = pSrc; compose_data.mask = pMask; compose_data.dest = pDst; if (width > SCANLINE_BUFFER_LENGTH) scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); n = RegionNumRects (®ion); pbox = RegionRects (®ion); while (n--) { h = pbox->y2 - pbox->y1; compose_data.ySrc = pbox->y1 - yDst + ySrc; compose_data.yMask = pbox->y1 - yDst + yMask; compose_data.yDest = pbox->y1; while (h) { compose_data.height = h; w = pbox->x2 - pbox->x1; compose_data.xSrc = pbox->x1 - xDst + xSrc; compose_data.xMask = pbox->x1 - xDst + xMask; compose_data.xDest = pbox->x1; if (maskRepeat) { compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) compose_data.height = pMask->pDrawable->height - compose_data.yMask; } if (srcRepeat) { compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; } while (w) { compose_data.width = w; if (maskRepeat) { compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) compose_data.width = pMask->pDrawable->width - compose_data.xMask; } if (srcRepeat) { compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; } fbCompositeRect(&compose_data, scanline_buffer); w -= compose_data.width; compose_data.xSrc += compose_data.width; compose_data.xMask += compose_data.width; compose_data.xDest += compose_data.width; } h -= compose_data.height; compose_data.ySrc += compose_data.height; compose_data.yMask += compose_data.height; compose_data.yDest += compose_data.height; } pbox++; } RegionUninit(®ion); if (scanline_buffer != _scanline_buffer) free(scanline_buffer); } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbcopy.c0000644000000000000000000003553613614532331016624 0ustar /* * Id: fbcopy.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "fb.h" void fbCopyNtoN (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { CARD8 alu = pGC ? pGC->alu : GXcopy; FbBits pm = pGC ? fbGetGCPrivate(pGC)->pm : FB_ALLONES; FbBits *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); while (nbox--) { fbBlt (src + (pbox->y1 + dy + srcYoff) * srcStride, srcStride, (pbox->x1 + dx + srcXoff) * srcBpp, dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, (pbox->x2 - pbox->x1) * dstBpp, (pbox->y2 - pbox->y1), alu, pm, dstBpp, reverse, upsidedown); pbox++; } } void fbCopy1toN (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); FbBits *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); while (nbox--) { if (dstBpp == 1) { fbBlt (src + (pbox->y1 + dy + srcYoff) * srcStride, srcStride, (pbox->x1 + dx + srcXoff) * srcBpp, dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, (pbox->x2 - pbox->x1) * dstBpp, (pbox->y2 - pbox->y1), FbOpaqueStipple1Rop(pGC->alu, pGC->fgPixel,pGC->bgPixel), pPriv->pm, dstBpp, reverse, upsidedown); } else { fbBltOne ((FbStip *) (src + (pbox->y1 + dy + srcYoff) * srcStride), srcStride*(FB_UNIT/FB_STIP_UNIT), (pbox->x1 + dx + srcXoff), dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, dstBpp, (pbox->x2 - pbox->x1) * dstBpp, (pbox->y2 - pbox->y1), pPriv->and, pPriv->xor, pPriv->bgand, pPriv->bgxor); } pbox++; } } void fbCopyNto1 (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); while (nbox--) { if (pDstDrawable->bitsPerPixel == 1) { FbBits *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbStip *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); fbGetStipDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); fbBltPlane (src + (pbox->y1+ dy + srcYoff) * srcStride, srcStride, (pbox->x1 + dx + srcXoff) * srcBpp, srcBpp, dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, (pbox->x2 - pbox->x1) * srcBpp, (pbox->y2 - pbox->y1), (FbStip) pPriv->and, (FbStip) pPriv->xor, (FbStip) pPriv->bgand, (FbStip) pPriv->bgxor, bitplane); } else { FbBits *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbStip *tmp; FbStride tmpStride; int width, height; width = pbox->x2 - pbox->x1; height = pbox->y2 - pbox->y1; tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT); tmp = malloc (tmpStride * height * sizeof (FbStip)); if (!tmp) return; fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); fbBltPlane (src + (pbox->y1+ dy + srcYoff) * srcStride, srcStride, (pbox->x1 + dx + srcXoff) * srcBpp, srcBpp, tmp, tmpStride, 0, width * srcBpp, height, fbAndStip(GXcopy,FB_ALLONES,FB_ALLONES), fbXorStip(GXcopy,FB_ALLONES,FB_ALLONES), fbAndStip(GXcopy,0,FB_ALLONES), fbXorStip(GXcopy,0,FB_ALLONES), bitplane); fbBltOne (tmp, tmpStride, 0, dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, dstBpp, width * dstBpp, height, pPriv->and, pPriv->xor, pPriv->bgand, pPriv->bgxor); free (tmp); } pbox++; } } void fbCopyRegion (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, RegionPtr pDstRegion, int dx, int dy, fbCopyProc copyProc, Pixel bitPlane, void *closure) { int careful; Bool reverse; Bool upsidedown; BoxPtr pbox; int nbox; BoxPtr pboxNew1, pboxNew2, pboxBase, pboxNext, pboxTmp; pbox = RegionRects(pDstRegion); nbox = RegionNumRects(pDstRegion); /* XXX we have to err on the side of safety when both are windows, * because we don't know if IncludeInferiors is being used. */ careful = ((pSrcDrawable == pDstDrawable) || ((pSrcDrawable->type == DRAWABLE_WINDOW) && (pDstDrawable->type == DRAWABLE_WINDOW))); pboxNew1 = NULL; pboxNew2 = NULL; if (careful && dy < 0) { upsidedown = TRUE; if (nbox > 1) { /* keep ordering in each band, reverse order of bands */ pboxNew1 = (BoxPtr)malloc(sizeof(BoxRec) * nbox); if(!pboxNew1) return; pboxBase = pboxNext = pbox+nbox-1; while (pboxBase >= pbox) { while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1)) pboxNext--; pboxTmp = pboxNext+1; while (pboxTmp <= pboxBase) { *pboxNew1++ = *pboxTmp++; } pboxBase = pboxNext; } pboxNew1 -= nbox; pbox = pboxNew1; } } else { /* walk source top to bottom */ upsidedown = FALSE; } if (careful && dx < 0) { /* walk source right to left */ if (dy <= 0) reverse = TRUE; else reverse = FALSE; if (nbox > 1) { /* reverse order of rects in each band */ pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox); if(!pboxNew2) { if (pboxNew1) free(pboxNew1); return; } pboxBase = pboxNext = pbox; while (pboxBase < pbox+nbox) { while ((pboxNext < pbox+nbox) && (pboxNext->y1 == pboxBase->y1)) pboxNext++; pboxTmp = pboxNext; while (pboxTmp != pboxBase) { *pboxNew2++ = *--pboxTmp; } pboxBase = pboxNext; } pboxNew2 -= nbox; pbox = pboxNew2; } } else { /* walk source left to right */ reverse = FALSE; } (*copyProc) (pSrcDrawable, pDstDrawable, pGC, pbox, nbox, dx, dy, reverse, upsidedown, bitPlane, closure); if (pboxNew1) free (pboxNew1); if (pboxNew2) free (pboxNew2); } RegionPtr fbDoCopy (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut, fbCopyProc copyProc, Pixel bitPlane, void *closure) { RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */ Bool freeSrcClip = FALSE; RegionPtr prgnExposed = NULL; RegionRec rgnDst; int dx; int dy; int numRects; int box_x1; int box_y1; int box_x2; int box_y2; Bool fastSrc = FALSE; /* for fast clipping with pixmap source */ Bool fastDst = FALSE; /* for fast clipping with one rect dest */ Bool fastExpose = FALSE; /* for fast exposures with pixmap source */ /* Short cut for unmapped windows */ if (pDstDrawable->type == DRAWABLE_WINDOW && !((WindowPtr)pDstDrawable)->realized) { return NULL; } if ((pSrcDrawable != pDstDrawable) && pSrcDrawable->pScreen->SourceValidate) { (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, xIn, yIn, widthSrc, heightSrc); } /* Compute source clip region */ if (pSrcDrawable->type == DRAWABLE_PIXMAP) { if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE)) prgnSrcClip = fbGetCompositeClip(pGC); else fastSrc = TRUE; } else { if (pGC->subWindowMode == IncludeInferiors) { /* * XFree86 DDX empties the border clip when the * VT is inactive, make sure the region isn't empty */ if (!((WindowPtr) pSrcDrawable)->parent && RegionNotEmpty( &((WindowPtr) pSrcDrawable)->borderClip)) { /* * special case bitblt from root window in * IncludeInferiors mode; just like from a pixmap */ fastSrc = TRUE; } else if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE)) { prgnSrcClip = fbGetCompositeClip(pGC); } else { prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable); freeSrcClip = TRUE; } } else { prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList; } } xIn += pSrcDrawable->x; yIn += pSrcDrawable->y; xOut += pDstDrawable->x; yOut += pDstDrawable->y; box_x1 = xIn; box_y1 = yIn; box_x2 = xIn + widthSrc; box_y2 = yIn + heightSrc; dx = xIn - xOut; dy = yIn - yOut; /* Don't create a source region if we are doing a fast clip */ if (fastSrc) { RegionPtr cclip; fastExpose = TRUE; /* * clip the source; if regions extend beyond the source size, * make sure exposure events get sent */ if (box_x1 < pSrcDrawable->x) { box_x1 = pSrcDrawable->x; fastExpose = FALSE; } if (box_y1 < pSrcDrawable->y) { box_y1 = pSrcDrawable->y; fastExpose = FALSE; } if (box_x2 > pSrcDrawable->x + (int) pSrcDrawable->width) { box_x2 = pSrcDrawable->x + (int) pSrcDrawable->width; fastExpose = FALSE; } if (box_y2 > pSrcDrawable->y + (int) pSrcDrawable->height) { box_y2 = pSrcDrawable->y + (int) pSrcDrawable->height; fastExpose = FALSE; } /* Translate and clip the dst to the destination composite clip */ box_x1 -= dx; box_x2 -= dx; box_y1 -= dy; box_y2 -= dy; /* If the destination composite clip is one rectangle we can do the clip directly. Otherwise we have to create a full blown region and call intersect */ cclip = fbGetCompositeClip(pGC); if (RegionNumRects(cclip) == 1) { BoxPtr pBox = RegionRects(cclip); if (box_x1 < pBox->x1) box_x1 = pBox->x1; if (box_x2 > pBox->x2) box_x2 = pBox->x2; if (box_y1 < pBox->y1) box_y1 = pBox->y1; if (box_y2 > pBox->y2) box_y2 = pBox->y2; fastDst = TRUE; } } /* Check to see if the region is empty */ if (box_x1 >= box_x2 || box_y1 >= box_y2) { RegionNull(&rgnDst); } else { BoxRec box; box.x1 = box_x1; box.y1 = box_y1; box.x2 = box_x2; box.y2 = box_y2; RegionInit(&rgnDst, &box, 1); } /* Clip against complex source if needed */ if (!fastSrc) { RegionIntersect(&rgnDst, &rgnDst, prgnSrcClip); RegionTranslate(&rgnDst, -dx, -dy); } /* Clip against complex dest if needed */ if (!fastDst) { RegionIntersect(&rgnDst, &rgnDst, fbGetCompositeClip(pGC)); } /* Do bit blitting */ numRects = RegionNumRects(&rgnDst); if (numRects && widthSrc && heightSrc) fbCopyRegion (pSrcDrawable, pDstDrawable, pGC, &rgnDst, dx, dy, copyProc, bitPlane, closure); /* Pixmap sources generate a NoExposed (we return NULL to do this) */ if (!fastExpose && pGC->fExpose) prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, xIn - pSrcDrawable->x, yIn - pSrcDrawable->y, widthSrc, heightSrc, xOut - pDstDrawable->x, yOut - pDstDrawable->y, (unsigned long) bitPlane); RegionUninit(&rgnDst); if (freeSrcClip) RegionDestroy(prgnSrcClip); fbValidateDrawable (pDstDrawable); return prgnExposed; } RegionPtr fbCopyArea (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut) { fbCopyProc copy; #ifdef FB_24_32BIT if (pSrcDrawable->bitsPerPixel != pDstDrawable->bitsPerPixel) copy = fb24_32CopyMtoN; else #endif copy = fbCopyNtoN; return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut, copy, 0, 0); } RegionPtr fbCopyPlane (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut, unsigned long bitplane) { if (pSrcDrawable->bitsPerPixel > 1) return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut, fbCopyNto1, (Pixel) bitplane, 0); else if (bitplane & 1) return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut, fbCopy1toN, (Pixel) bitplane, 0); else return miHandleExposures(pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut, bitplane); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbedge.c0000644000000000000000000002113013614532331016537 0ustar /* * $Id: fbedge.c,v 1.5 2005/10/03 10:20:29 anholt Exp $ * * Copyright © 2004 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" #ifdef RENDER #include "picturestr.h" #include "mipict.h" #include "renderedge.h" #include "fbpict.h" /* * 4 bit alpha */ #define N_BITS 4 #define rasterizeEdges fbRasterizeEdges4 #if BITMAP_BIT_ORDER == LSBFirst #define Shift4(o) ((o) << 2) #else #define Shift4(o) ((1-(o)) << 2) #endif #define Get4(x,o) (((x) >> Shift4(o)) & 0xf) #define Put4(x,o,v) (((x) & ~(0xf << Shift4(o))) | (((v) & 0xf) << Shift4(o))) #define DefineAlpha(line,x) \ CARD8 *__ap = (CARD8 *) line + ((x) >> 1); \ int __ao = (x) & 1 #define StepAlpha ((__ap += __ao), (__ao ^= 1)) #define AddAlpha(a) { \ CARD8 __o = *__ap; \ CARD8 __a = (a) + Get4(__o, __ao); \ *__ap = Put4 (__o, __ao, __a | (0 - ((__a) >> 4))); \ } #include "fbedgeimp.h" #undef AddAlpha #undef StepAlpha #undef DefineAlpha #undef rasterizeEdges #undef N_BITS /* * 1 bit alpha */ #define N_BITS 1 #define rasterizeEdges fbRasterizeEdges1 #include "fbedgeimp.h" #undef rasterizeEdges #undef N_BITS /* * 8 bit alpha */ static INLINE CARD8 clip255 (int x) { if (x > 255) return 255; return x; } static INLINE void add_saturate_8 (CARD8 *buf, int value, int length) { while (length--) { *buf = clip255 (*buf + value); buf++; } } /* * We want to detect the case where we add the same value to a long * span of pixels. The triangles on the end are filled in while we * count how many sub-pixel scanlines contribute to the middle section. * * +--------------------------+ * fill_height =| \ / * +------------------+ * |================| * fill_start fill_end */ static void fbRasterizeEdges8 (FbBits *buf, int width, int stride, RenderEdge *l, RenderEdge *r, xFixed t, xFixed b) { xFixed y = t; FbBits *line; int fill_start = -1, fill_end = -1; int fill_size = 0; line = buf + xFixedToInt (y) * stride; for (;;) { CARD8 *ap = (CARD8 *) line; xFixed lx, rx; int lxi, rxi; /* clip X */ lx = l->x; if (lx < 0) lx = 0; rx = r->x; if (xFixedToInt (rx) >= width) rx = IntToxFixed (width); /* Skip empty (or backwards) sections */ if (rx > lx) { int lxs, rxs; /* Find pixel bounds for span. */ lxi = xFixedToInt (lx); rxi = xFixedToInt (rx); /* Sample coverage for edge pixels */ lxs = RenderSamplesX (lx, 8); rxs = RenderSamplesX (rx, 8); /* Add coverage across row */ if (lxi == rxi) { ap[lxi] = clip255 (ap[lxi] + rxs - lxs); } else { ap[lxi] = clip255 (ap[lxi] + N_X_FRAC(8) - lxs); /* Move forward so that lxi/rxi is the pixel span */ lxi++; /* Don't bother trying to optimize the fill unless * the span is longer than 4 pixels. */ if (rxi - lxi > 4) { if (fill_start < 0) { fill_start = lxi; fill_end = rxi; fill_size++; } else { if (lxi >= fill_end || rxi < fill_start) { /* We're beyond what we saved, just fill it */ add_saturate_8 (ap + fill_start, fill_size * N_X_FRAC(8), fill_end - fill_start); fill_start = lxi; fill_end = rxi; fill_size = 1; } else { /* Update fill_start */ if (lxi > fill_start) { add_saturate_8 (ap + fill_start, fill_size * N_X_FRAC(8), lxi - fill_start); fill_start = lxi; } else if (lxi < fill_start) { add_saturate_8 (ap + lxi, N_X_FRAC(8), fill_start - lxi); } /* Update fill_end */ if (rxi < fill_end) { add_saturate_8 (ap + rxi, fill_size * N_X_FRAC(8), fill_end - rxi); fill_end = rxi; } else if (fill_end < rxi) { add_saturate_8 (ap + fill_end, N_X_FRAC(8), rxi - fill_end); } fill_size++; } } } else { add_saturate_8 (ap + lxi, N_X_FRAC(8), rxi - lxi); } /* Do not add in a 0 alpha here. This check is * necessary to avoid a buffer overrun, (when rx * is exactly on a pixel boundary). */ if (rxs) ap[rxi] = clip255 (ap[rxi] + rxs); } } if (y == b) { /* We're done, make sure we clean up any remaining fill. */ if (fill_start != fill_end) { if (fill_size == N_Y_FRAC(8)) { memset (ap + fill_start, 0xff, fill_end - fill_start); } else { add_saturate_8 (ap + fill_start, fill_size * N_X_FRAC(8), fill_end - fill_start); } } break; } if (xFixedFrac (y) != Y_FRAC_LAST(8)) { RenderEdgeStepSmall (l); RenderEdgeStepSmall (r); y += STEP_Y_SMALL(8); } else { RenderEdgeStepBig (l); RenderEdgeStepBig (r); y += STEP_Y_BIG(8); if (fill_start != fill_end) { if (fill_size == N_Y_FRAC(8)) { memset (ap + fill_start, 0xff, fill_end - fill_start); } else { add_saturate_8 (ap + fill_start, fill_size * N_X_FRAC(8), fill_end - fill_start); } fill_start = fill_end = -1; fill_size = 0; } line += stride; } } } void fbRasterizeEdges (FbBits *buf, int bpp, int width, int stride, RenderEdge *l, RenderEdge *r, xFixed t, xFixed b) { switch (bpp) { case 1: fbRasterizeEdges1 (buf, width, stride, l, r, t, b); break; case 4: fbRasterizeEdges4 (buf, width, stride, l, r, t, b); break; case 8: fbRasterizeEdges8 (buf, width, stride, l, r, t, b); break; } } #endif /* RENDER */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbedgeimp.h0000644000000000000000000000625113614532331017261 0ustar /* * $Id: fbedgeimp.h,v 1.4 2005/08/30 03:05:21 anholt Exp $ * * Copyright © 2004 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef rasterizeSpan #endif static void rasterizeEdges (FbBits *buf, int width, int stride, RenderEdge *l, RenderEdge *r, xFixed t, xFixed b) { xFixed y = t; FbBits *line; line = buf + xFixedToInt (y) * stride; for (;;) { xFixed lx, rx; int lxi, rxi; /* clip X */ lx = l->x; if (lx < 0) lx = 0; rx = r->x; if (xFixedToInt (rx) >= width) rx = IntToxFixed (width); /* Skip empty (or backwards) sections */ if (rx > lx) { /* Find pixel bounds for span */ lxi = xFixedToInt (lx); rxi = xFixedToInt (rx); #if N_BITS == 1 { FbBits *a = line; FbBits startmask, endmask; int nmiddle; int width = rxi - lxi; int x = lxi; a += x >> FB_SHIFT; x &= FB_MASK; FbMaskBits (x, width, startmask, nmiddle, endmask); if (startmask) *a++ |= startmask; while (nmiddle--) *a++ = FB_ALLONES; if (endmask) *a |= endmask; } #else { DefineAlpha(line,lxi); int lxs, rxs; /* Sample coverage for edge pixels */ lxs = RenderSamplesX (lx, N_BITS); rxs = RenderSamplesX (rx, N_BITS); /* Add coverage across row */ if (lxi == rxi) { AddAlpha (rxs - lxs); } else { int xi; AddAlpha (N_X_FRAC(N_BITS) - lxs); StepAlpha; for (xi = lxi + 1; xi < rxi; xi++) { AddAlpha (N_X_FRAC(N_BITS)); StepAlpha; } /* Do not add in a 0 alpha here. This check is necessary * to avoid a buffer overrun when rx is exactly on a pixel * boundary. */ if (rxs != 0) AddAlpha (rxs); } } #endif } if (y == b) break; #if N_BITS > 1 if (xFixedFrac (y) != Y_FRAC_LAST(N_BITS)) { RenderEdgeStepSmall (l); RenderEdgeStepSmall (r); y += STEP_Y_SMALL(N_BITS); } else #endif { RenderEdgeStepBig (l); RenderEdgeStepBig (r); y += STEP_Y_BIG(N_BITS); line += stride; } } } #undef rasterizeSpan nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbfill.c0000644000000000000000000001250613614532331016570 0ustar /* * Id: fbfill.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" void fbFill (DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); switch (pGC->fillStyle) { case FillSolid: fbSolid (dst + (y + dstYoff) * dstStride, dstStride, (x + dstXoff) * dstBpp, dstBpp, width * dstBpp, height, pPriv->and, pPriv->xor); break; case FillStippled: case FillOpaqueStippled: { PixmapPtr pStip = pGC->stipple; int stipWidth = pStip->drawable.width; int stipHeight = pStip->drawable.height; if (dstBpp == 1) { int alu; FbBits *stip; FbStride stipStride; int stipBpp; _X_UNUSED int stipXoff, stipYoff; /* XXX assumed to be zero */ if (pGC->fillStyle == FillStippled) alu = FbStipple1Rop(pGC->alu,pGC->fgPixel); else alu = FbOpaqueStipple1Rop(pGC->alu,pGC->fgPixel,pGC->bgPixel); fbGetDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff); fbTile (dst + (y + dstYoff) * dstStride, dstStride, x + dstXoff, width, height, stip, stipStride, stipWidth, stipHeight, alu, pPriv->pm, dstBpp, (pGC->patOrg.x + pDrawable->x + dstXoff), pGC->patOrg.y + pDrawable->y - y); } else { FbStip *stip; FbStride stipStride; int stipBpp; _X_UNUSED int stipXoff, stipYoff; /* XXX assumed to be zero */ FbBits fgand, fgxor, bgand, bgxor; fgand = pPriv->and; fgxor = pPriv->xor; if (pGC->fillStyle == FillStippled) { bgand = fbAnd(GXnoop,(FbBits) 0,FB_ALLONES); bgxor = fbXor(GXnoop,(FbBits) 0,FB_ALLONES); } else { bgand = pPriv->bgand; bgxor = pPriv->bgxor; } fbGetStipDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff); fbStipple (dst + (y + dstYoff) * dstStride, dstStride, (x + dstXoff) * dstBpp, dstBpp, width * dstBpp, height, stip, stipStride, stipWidth, stipHeight, pPriv->evenStipple, fgand, fgxor, bgand, bgxor, pGC->patOrg.x + pDrawable->x + dstXoff, pGC->patOrg.y + pDrawable->y - y); } break; } case FillTiled: { PixmapPtr pTile = pGC->tile.pixmap; FbBits *tile; FbStride tileStride; int tileBpp; int tileWidth; int tileHeight; _X_UNUSED int tileXoff, tileYoff; /* XXX assumed to be zero */ fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff); tileWidth = pTile->drawable.width; tileHeight = pTile->drawable.height; fbTile (dst + (y + dstYoff) * dstStride, dstStride, (x + dstXoff) * dstBpp, width * dstBpp, height, tile, tileStride, tileWidth * tileBpp, tileHeight, pGC->alu, pPriv->pm, dstBpp, (pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp, pGC->patOrg.y + pDrawable->y - y); break; } } fbValidateDrawable (pDrawable); } void fbSolidBoxClipped (DrawablePtr pDrawable, RegionPtr pClip, int x1, int y1, int x2, int y2, FbBits and, FbBits xor) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; BoxPtr pbox; int nbox; int partX1, partX2, partY1, partY2; fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); for (nbox = RegionNumRects(pClip), pbox = RegionRects(pClip); nbox--; pbox++) { partX1 = pbox->x1; if (partX1 < x1) partX1 = x1; partX2 = pbox->x2; if (partX2 > x2) partX2 = x2; if (partX2 <= partX1) continue; partY1 = pbox->y1; if (partY1 < y1) partY1 = y1; partY2 = pbox->y2; if (partY2 > y2) partY2 = y2; if (partY2 <= partY1) continue; fbSolid (dst + (partY1 + dstYoff) * dstStride, dstStride, (partX1 + dstXoff) * dstBpp, dstBpp, (partX2 - partX1) * dstBpp, (partY2 - partY1), and, xor); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbfillrect.c0000644000000000000000000000605413614532331017447 0ustar /* * Id: fbfillrect.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" void fbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrect, xRectangle *prect) { RegionPtr pClip = fbGetCompositeClip(pGC); register BoxPtr pbox; BoxPtr pextent; int extentX1, extentX2, extentY1, extentY2; int fullX1, fullX2, fullY1, fullY2; int partX1, partX2, partY1, partY2; int xorg, yorg; int n; xorg = pDrawable->x; yorg = pDrawable->y; pextent = RegionExtents(pClip); extentX1 = pextent->x1; extentY1 = pextent->y1; extentX2 = pextent->x2; extentY2 = pextent->y2; while (nrect--) { fullX1 = prect->x + xorg; fullY1 = prect->y + yorg; fullX2 = fullX1 + (int) prect->width; fullY2 = fullY1 + (int) prect->height; prect++; if (fullX1 < extentX1) fullX1 = extentX1; if (fullY1 < extentY1) fullY1 = extentY1; if (fullX2 > extentX2) fullX2 = extentX2; if (fullY2 > extentY2) fullY2 = extentY2; if ((fullX1 >= fullX2) || (fullY1 >= fullY2)) continue; n = RegionNumRects (pClip); if (n == 1) { fbFill (pDrawable, pGC, fullX1, fullY1, fullX2-fullX1, fullY2-fullY1); } else { pbox = RegionRects(pClip); /* * clip the rectangle to each box in the clip region * this is logically equivalent to calling Intersect() */ while(n--) { partX1 = pbox->x1; if (partX1 < fullX1) partX1 = fullX1; partY1 = pbox->y1; if (partY1 < fullY1) partY1 = fullY1; partX2 = pbox->x2; if (partX2 > fullX2) partX2 = fullX2; partY2 = pbox->y2; if (partY2 > fullY2) partY2 = fullY2; pbox++; if (partX1 < partX2 && partY1 < partY2) fbFill (pDrawable, pGC, partX1, partY1, partX2 - partX1, partY2 - partY1); } } } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbfillsp.c0000644000000000000000000000516513614532331017136 0ustar /* * Id: fbfillsp.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" void fbFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n, DDXPointPtr ppt, int *pwidth, int fSorted) { RegionPtr pClip = fbGetCompositeClip(pGC); BoxPtr pextent, pbox; int nbox; int extentX1, extentX2, extentY1, extentY2; int fullX1, fullX2, fullY1; int partX1, partX2; pextent = RegionExtents(pClip); extentX1 = pextent->x1; extentY1 = pextent->y1; extentX2 = pextent->x2; extentY2 = pextent->y2; while (n--) { fullX1 = ppt->x; fullY1 = ppt->y; fullX2 = fullX1 + (int) *pwidth; ppt++; pwidth++; if (fullY1 < extentY1 || extentY2 <= fullY1) continue; if (fullX1 < extentX1) fullX1 = extentX1; if (fullX2 > extentX2) fullX2 = extentX2; if (fullX1 >= fullX2) continue; nbox = RegionNumRects (pClip); if (nbox == 1) { fbFill (pDrawable, pGC, fullX1, fullY1, fullX2-fullX1, 1); } else { pbox = RegionRects(pClip); while(nbox--) { if (pbox->y1 <= fullY1 && fullY1 < pbox->y2) { partX1 = pbox->x1; if (partX1 < fullX1) partX1 = fullX1; partX2 = pbox->x2; if (partX2 > fullX2) partX2 = fullX2; if (partX2 > partX1) { fbFill (pDrawable, pGC, partX1, fullY1, partX2 - partX1, 1); } } pbox++; } } } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbgc.c0000644000000000000000000001742313614532331016236 0ustar /* * Id: fbgc.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "fb.h" const GCFuncs fbGCFuncs = { fbValidateGC, miChangeGC, miCopyGC, miDestroyGC, miChangeClip, miDestroyClip, miCopyClip, }; const GCOps fbGCOps = { fbFillSpans, fbSetSpans, fbPutImage, fbCopyArea, fbCopyPlane, fbPolyPoint, fbPolyLine, fbPolySegment, fbPolyRectangle, fbPolyArc, miFillPolygon, fbPolyFillRect, fbPolyFillArc, miPolyText8, miPolyText16, miImageText8, miImageText16, fbImageGlyphBlt, fbPolyGlyphBlt, fbPushPixels #ifdef NEED_LINEHELPER ,NULL #endif }; Bool fbCreateGC(GCPtr pGC) { pGC->clientClip = NULL; pGC->clientClipType = CT_NONE; pGC->ops = (GCOps *) &fbGCOps; pGC->funcs = (GCFuncs *) &fbGCFuncs; /* fb wants to translate before scan conversion */ pGC->miTranslate = 1; fbGetRotatedPixmap(pGC) = 0; fbGetExpose(pGC) = 1; fbGetFreeCompClip(pGC) = 0; fbGetCompositeClip(pGC) = 0; fbGetGCPrivate(pGC)->bpp = BitsPerPixel (pGC->depth); return TRUE; } /* * Pad pixmap to FB_UNIT bits wide */ void fbPadPixmap (PixmapPtr pPixmap) { int width; FbBits *bits; FbBits b; FbBits mask; int height; int w; int stride; int bpp; _X_UNUSED int xOff, yOff; fbGetDrawable (&pPixmap->drawable, bits, stride, bpp, xOff, yOff); width = pPixmap->drawable.width * pPixmap->drawable.bitsPerPixel; height = pPixmap->drawable.height; mask = FbBitsMask (0, width); while (height--) { b = *bits & mask; w = width; while (w < FB_UNIT) { b = b | FbScrRight(b, w); w <<= 1; } *bits = b; bits += stride; } } /* * Verify that 'bits' repeats every 'len' bits */ static Bool fbBitsRepeat (FbBits bits, int len, int width) { FbBits mask = FbBitsMask(0, len); FbBits orig = bits & mask; int i; if (width > FB_UNIT) width = FB_UNIT; for (i = 0; i < width / len; i++) { if ((bits & mask) != orig) return FALSE; bits = FbScrLeft(bits,len); } return TRUE; } /* * Check whether an entire bitmap line is a repetition of * the first 'len' bits */ static Bool fbLineRepeat (FbBits *bits, int len, int width) { FbBits first = bits[0]; if (!fbBitsRepeat (first, len, width)) return FALSE; width = (width + FB_UNIT-1) >> FB_SHIFT; bits++; while (--width) if (*bits != first) return FALSE; return TRUE; } /* * The even stipple code wants the first FB_UNIT/bpp bits on * each scanline to represent the entire stipple */ static Bool fbCanEvenStipple (PixmapPtr pStipple, int bpp) { int len = FB_UNIT / bpp; FbBits *bits; int stride; int stip_bpp; _X_UNUSED int stipXoff, stipYoff; int h; /* can't even stipple 24bpp drawables */ if ((bpp & (bpp-1)) != 0) return FALSE; /* make sure the stipple width is a multiple of the even stipple width */ if (pStipple->drawable.width % len != 0) return FALSE; fbGetDrawable (&pStipple->drawable, bits, stride, stip_bpp, stipXoff, stipYoff); h = pStipple->drawable.height; /* check to see that the stipple repeats horizontally */ while (h--) { if (!fbLineRepeat (bits, len, pStipple->drawable.width)) return FALSE; bits += stride; } return TRUE; } void fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); FbBits mask; pGC->lastWinOrg.x = pDrawable->x; pGC->lastWinOrg.y = pDrawable->y; /* * if the client clip is different or moved OR the subwindowMode has * changed OR the window's clip has changed since the last validation * we need to recompute the composite clip */ if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) || (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)) ) { miComputeCompositeClip (pGC, pDrawable); pPriv->oneRect = RegionNumRects(fbGetCompositeClip(pGC)) == 1; } #ifdef FB_24_32BIT if (pPriv->bpp != pDrawable->bitsPerPixel) { changes |= GCStipple|GCForeground|GCBackground|GCPlaneMask; pPriv->bpp = pDrawable->bitsPerPixel; } if ((changes & GCTile) && fbGetRotatedPixmap(pGC)) { (*pGC->pScreen->DestroyPixmap) (fbGetRotatedPixmap(pGC)); fbGetRotatedPixmap(pGC) = 0; } if (pGC->fillStyle == FillTiled) { PixmapPtr pOldTile, pNewTile; pOldTile = pGC->tile.pixmap; if (pOldTile->drawable.bitsPerPixel != pDrawable->bitsPerPixel) { pNewTile = fbGetRotatedPixmap(pGC); if (!pNewTile || pNewTile ->drawable.bitsPerPixel != pDrawable->bitsPerPixel) { if (pNewTile) (*pGC->pScreen->DestroyPixmap) (pNewTile); pNewTile = fb24_32ReformatTile (pOldTile, pDrawable->bitsPerPixel); } if (pNewTile) { fbGetRotatedPixmap(pGC) = pOldTile; pGC->tile.pixmap = pNewTile; changes |= GCTile; } } } #endif if (changes & GCTile) { if (!pGC->tileIsPixel && FbEvenTile (pGC->tile.pixmap->drawable.width * pDrawable->bitsPerPixel)) fbPadPixmap (pGC->tile.pixmap); } if (changes & GCStipple) { pPriv->evenStipple = FALSE; if (pGC->stipple) { /* can we do an even stipple ?? */ if (FbEvenStip (pGC->stipple->drawable.width, pDrawable->bitsPerPixel) && (fbCanEvenStipple (pGC->stipple, pDrawable->bitsPerPixel))) pPriv->evenStipple = TRUE; if (pGC->stipple->drawable.width * pDrawable->bitsPerPixel < FB_UNIT) fbPadPixmap (pGC->stipple); } } /* * Recompute reduced rop values */ if (changes & (GCForeground|GCBackground|GCPlaneMask|GCFunction)) { int s; FbBits depthMask; mask = FbFullMask(pDrawable->bitsPerPixel); depthMask = FbFullMask(pDrawable->depth); pPriv->fg = pGC->fgPixel & mask; pPriv->bg = pGC->bgPixel & mask; if ((pGC->planemask & depthMask) == depthMask) pPriv->pm = mask; else pPriv->pm = pGC->planemask & mask; s = pDrawable->bitsPerPixel; while (s < FB_UNIT) { pPriv->fg |= pPriv->fg << s; pPriv->bg |= pPriv->bg << s; pPriv->pm |= pPriv->pm << s; s <<= 1; } pPriv->and = fbAnd(pGC->alu, pPriv->fg, pPriv->pm); pPriv->xor = fbXor(pGC->alu, pPriv->fg, pPriv->pm); pPriv->bgand = fbAnd(pGC->alu, pPriv->bg, pPriv->pm); pPriv->bgxor = fbXor(pGC->alu, pPriv->bg, pPriv->pm); } if (changes & GCDashList) { unsigned short n = pGC->numInDashList; unsigned char *dash = pGC->dash; unsigned int dashLength = 0; while (n--) dashLength += (unsigned int ) *dash++; pPriv->dashLength = dashLength; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbgetsp.c0000644000000000000000000000471113614532331016763 0ustar /* * Id: fbgetsp.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" void fbGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart) { FbBits *src, *dst; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; int xoff; /* * XFree86 DDX empties the root borderClip when the VT is * switched away; this checks for that case */ if (!fbDrawableEnabled(pDrawable)) return; #ifdef FB_24_32BIT if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) { fb24_32GetSpans (pDrawable, wMax, ppt, pwidth, nspans, pchardstStart); return; } #endif fbGetDrawable (pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); while (nspans--) { xoff = (int) (((long) pchardstStart) & (FB_MASK >> 3)); dst = (FbBits *) (pchardstStart - xoff); xoff <<= 3; fbBlt (src + (ppt->y + srcYoff) * srcStride, srcStride, (ppt->x + srcXoff) * srcBpp, dst, 1, xoff, *pwidth * srcBpp, 1, GXcopy, FB_ALLONES, srcBpp, FALSE, FALSE); pchardstStart += PixmapBytePad(*pwidth, pDrawable->depth); ppt++; pwidth++; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbglyph.c0000644000000000000000000002424213614532331016765 0ustar /* * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" #include #include "dixfontstr.h" #define dummyScreen screenInfo.screens[0] Bool fbGlyphIn (RegionPtr pRegion, int x, int y, int width, int height) { BoxRec box; BoxPtr pExtents = RegionExtents(pRegion); /* * Check extents by hand to avoid 16 bit overflows */ if (x < (int) pExtents->x1) return FALSE; if ((int) pExtents->x2 < x + width) return FALSE; if (y < (int) pExtents->y1) return FALSE; if ((int) pExtents->y2 < y + height) return FALSE; box.x1 = x; box.x2 = x + width; box.y1 = y; box.y2 = y + height; return RegionContainsRect(pRegion, &box) == rgnIN; } #ifdef FB_24BIT #ifndef FBNOPIXADDR #define WRITE1(d,n,fg) ((d)[n] = (CARD8) fg) #define WRITE2(d,n,fg) (*(CARD16 *) &(d[n]) = (CARD16) fg) #define WRITE4(d,n,fg) (*(CARD32 *) &(d[n]) = (CARD32) fg) #if FB_UNIT == 6 && IMAGE_BYTE_ORDER == LSBFirst #define WRITE8(d) (*(FbBits *) &(d[0]) = fg) #else #define WRITE8(d) WRITE4(d,0,_ABCA), WRITE4(d,4,_BCAB) #endif /* * This is a bit tricky, but it's brief. Write 12 bytes worth * of dest, which is four pixels, at a time. This gives constant * code for each pattern as they're always aligned the same * * a b c d a b c d a b c d bytes * A B C A B C A B C A B C pixels * * f0 f1 f2 * A B C A B C A B C A B C pixels LSB * C A B C A B C A B C A B pixels MSB * * LSB MSB * A f0 f1 * B f1 f2 * C f2 f0 * A B f0 f2 * B C f1 f0 * C A f2 f1 * A B C A f0 f1 * B C A B f1 f2 * C A B C f2 f0 */ #undef _A #undef _B #undef _C #undef _AB #undef _BC #undef _CA #undef _ABCA #undef _BCAB #undef _CABC #if IMAGE_BYTE_ORDER == MSBFirst #define _A f1 #define _B f2 #define _C f0 #define _AB f2 #define _BC f0 #define _CA f1 #define _ABCA f1 #define _BCAB f2 #define _CABC f0 #define CASE(a,b,c,d) ((a << 3) | (b << 2) | (c << 1) | d) #else #define _A f0 #define _B f1 #define _C f2 #define _AB f0 #define _BC f1 #define _CA f2 #define _ABCA f0 #define _BCAB f1 #define _CABC f2 #define CASE(a,b,c,d) (a | (b << 1) | (c << 2) | (d << 3)) #endif void fbGlyph24 (FbBits *dstBits, FbStride dstStride, int dstBpp, FbStip *stipple, FbBits fg, int x, int height) { int lshift; FbStip bits; CARD8 *dstLine; CARD8 *dst; FbStip f0, f1, f2; int n; int shift; f0 = fg; f1 = FbRot24(f0,16); f2 = FbRot24(f0,8); dstLine = (CARD8 *) dstBits; dstLine += (x & ~3) * 3; dstStride *= (sizeof (FbBits) / sizeof (CARD8)); shift = x & 3; lshift = 4 - shift; while (height--) { bits = *stipple++; n = lshift; dst = dstLine; while (bits) { switch (FbStipMoveLsb (FbLeftStipBits (bits, n), 4, n)) { case CASE(0,0,0,0): break; case CASE(1,0,0,0): WRITE2(dst,0,_AB); WRITE1(dst,2,_C); break; case CASE(0,1,0,0): WRITE1(dst,3,_A); WRITE2(dst,4,_BC); break; case CASE(1,1,0,0): WRITE4(dst,0,_ABCA); WRITE2(dst,4,_BC); break; case CASE(0,0,1,0): WRITE2(dst,6,_AB); WRITE1(dst,8,_C); break; case CASE(1,0,1,0): WRITE2(dst,0,_AB); WRITE1(dst,2,_C); WRITE2(dst,6,_AB); WRITE1(dst,8,_C); break; case CASE(0,1,1,0): WRITE1(dst,3,_A); WRITE4(dst,4,_BCAB); WRITE1(dst,8,_C); break; case CASE(1,1,1,0): WRITE8(dst); WRITE1(dst,8,_C); break; case CASE(0,0,0,1): WRITE1(dst,9,_A); WRITE2(dst,10,_BC); break; case CASE(1,0,0,1): WRITE2(dst,0,_AB); WRITE1(dst,2,_C); WRITE1(dst,9,_A); WRITE2(dst,10,_BC); break; case CASE(0,1,0,1): WRITE1(dst,3,_A); WRITE2(dst,4,_BC); WRITE1(dst,9,_A); WRITE2(dst,10,_BC); break; case CASE(1,1,0,1): WRITE4(dst,0,_ABCA); WRITE2(dst,4,_BC); WRITE1(dst,9,_A); WRITE2(dst,10,_BC); break; case CASE(0,0,1,1): WRITE2(dst,6,_AB); WRITE4(dst,8,_CABC); break; case CASE(1,0,1,1): WRITE2(dst,0,_AB); WRITE1(dst,2,_C); WRITE2(dst,6,_AB); WRITE4(dst,8,_CABC); break; case CASE(0,1,1,1): WRITE1(dst,3,_A); WRITE4(dst,4,_BCAB); WRITE4(dst,8,_CABC); break; case CASE(1,1,1,1): WRITE8(dst); WRITE4(dst,8,_CABC); break; } bits = FbStipLeft (bits, n); n = 4; dst += 12; } dstLine += dstStride; } } #endif #endif void fbPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void * pglyphBase) { FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); CharInfoPtr pci; unsigned char *pglyph; /* pointer bits in glyph */ int gx, gy; int gWidth, gHeight; /* width and height of glyph */ FbStride gStride; /* stride of glyph */ #ifndef FBNOPIXADDR void (*glyph) (FbBits *, FbStride, int, FbStip *, FbBits, int, int); FbBits *dst = 0; FbStride dstStride = 0; int dstBpp = 0; int dstXoff = 0, dstYoff = 0; glyph = 0; if (pGC->fillStyle == FillSolid && pPriv->and == 0) { fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); switch (dstBpp) { case 8: glyph = fbGlyph8; break; case 16: glyph = fbGlyph16; break; #ifdef FB_24BIT case 24: glyph = fbGlyph24; break; #endif case 32: glyph = fbGlyph32; break; } } #endif x += pDrawable->x; y += pDrawable->y; while (nglyph--) { pci = *ppci++; pglyph = FONTGLYPHBITS(pglyphBase, pci); gWidth = GLYPHWIDTHPIXELS(pci); gHeight = GLYPHHEIGHTPIXELS(pci); if (gWidth && gHeight) { gx = x + pci->metrics.leftSideBearing; gy = y - pci->metrics.ascent; #ifndef FBNOPIXADDR if (glyph && gWidth <= sizeof (FbStip) * 8 && fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) { (*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp, (FbStip *) pglyph, pPriv->xor, gx + dstXoff, gHeight); } else #endif { gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip); fbPushImage (pDrawable, pGC, (FbStip *) pglyph, gStride, 0, gx, gy, gWidth, gHeight); } } x += pci->metrics.characterWidth; } } void fbImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppciInit, void * pglyphBase) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); CharInfoPtr *ppci; CharInfoPtr pci; unsigned char *pglyph; /* pointer bits in glyph */ int gWidth, gHeight; /* width and height of glyph */ FbStride gStride; /* stride of glyph */ Bool opaque; int n; int gx, gy; #ifndef FBNOPIXADDR void (*glyph) (FbBits *, FbStride, int, FbStip *, FbBits, int, int); FbBits *dst = 0; FbStride dstStride = 0; int dstBpp = 0; int dstXoff = 0, dstYoff = 0; glyph = 0; if (pPriv->and == 0) { fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); switch (dstBpp) { case 8: glyph = fbGlyph8; break; case 16: glyph = fbGlyph16; break; #ifdef FB_24BIT case 24: glyph = fbGlyph24; break; #endif case 32: glyph = fbGlyph32; break; } } #endif x += pDrawable->x; y += pDrawable->y; if (TERMINALFONT (pGC->font) #ifndef FBNOPIXADDR && !glyph #endif ) { opaque = TRUE; } else { int xBack, widthBack; int yBack, heightBack; ppci = ppciInit; n = nglyph; widthBack = 0; while (n--) widthBack += (*ppci++)->metrics.characterWidth; xBack = x; if (widthBack < 0) { xBack += widthBack; widthBack = -widthBack; } yBack = y - FONTASCENT(pGC->font); heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); fbSolidBoxClipped (pDrawable, fbGetCompositeClip(pGC), xBack, yBack, xBack + widthBack, yBack + heightBack, fbAnd(GXcopy,pPriv->bg,pPriv->pm), fbXor(GXcopy,pPriv->bg,pPriv->pm)); opaque = FALSE; } ppci = ppciInit; while (nglyph--) { pci = *ppci++; pglyph = FONTGLYPHBITS(pglyphBase, pci); gWidth = GLYPHWIDTHPIXELS(pci); gHeight = GLYPHHEIGHTPIXELS(pci); if (gWidth && gHeight) { gx = x + pci->metrics.leftSideBearing; gy = y - pci->metrics.ascent; #ifndef FBNOPIXADDR if (glyph && gWidth <= sizeof (FbStip) * 8 && fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) { (*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp, (FbStip *) pglyph, pPriv->fg, gx + dstXoff, gHeight); } else #endif { gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip); fbPutXYImage (pDrawable, fbGetCompositeClip(pGC), pPriv->fg, pPriv->bg, pPriv->pm, GXcopy, opaque, gx, gy, gWidth, gHeight, (FbStip *) pglyph, gStride, 0); } } x += pci->metrics.characterWidth; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fb.h0000644000000000000000000012753413614532331015736 0ustar /* * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _FB_H_ #define _FB_H_ #include #include "scrnintstr.h" #include "pixmap.h" #include "pixmapstr.h" #include "region.h" #include "gcstruct.h" #include "colormap.h" #include "miscstruct.h" #include "servermd.h" #include "windowstr.h" #include "mi.h" #include "migc.h" #include "mibstore.h" #ifdef RENDER #include "picturestr.h" #else #include "picture.h" #endif /* * This single define controls the basic size of data manipulated * by this software; it must be log2(sizeof (FbBits) * 8) */ #ifndef FB_SHIFT #define FB_SHIFT LOG2_BITMAP_PAD #endif #if FB_SHIFT < LOG2_BITMAP_PAD error FB_SHIFT must be >= LOG2_BITMAP_PAD #endif #define FB_UNIT (1 << FB_SHIFT) #define FB_HALFUNIT (1 << (FB_SHIFT-1)) #define FB_MASK (FB_UNIT - 1) #define FB_ALLONES ((FbBits) -1) #if GLYPHPADBYTES != 4 #error "GLYPHPADBYTES must be 4" #endif /* whether to bother to include 24bpp support */ #ifndef FBNO24BIT #define FB_24BIT #endif /* * Unless otherwise instructed, fb includes code to advertise 24bpp * windows with 32bpp image format for application compatibility */ #ifdef FB_24BIT #ifndef FBNO24_32 #define FB_24_32BIT #endif #endif #define FB_STIP_SHIFT LOG2_BITMAP_PAD #define FB_STIP_UNIT (1 << FB_STIP_SHIFT) #define FB_STIP_MASK (FB_STIP_UNIT - 1) #define FB_STIP_ALLONES ((FbStip) -1) #define FB_STIP_ODDSTRIDE(s) (((s) & (FB_MASK >> FB_STIP_SHIFT)) != 0) #define FB_STIP_ODDPTR(p) ((((long) (p)) & (FB_MASK >> 3)) != 0) #define FbStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT))) #define FbBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT))) #define FbFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((FbBits) 1) << n) - 1)) #if FB_SHIFT == 6 # ifdef WIN32 typedef unsigned __int64 FbBits; # else # if defined(__alpha__) || defined(__alpha) || \ defined(ia64) || defined(__ia64__) || \ defined(__sparc64__) || defined(_LP64) || \ defined(__s390x__) || \ defined(amd64) || defined (__amd64__) || \ defined (__powerpc64__) typedef unsigned long FbBits; # else typedef unsigned long long FbBits; # endif # endif #endif #if FB_SHIFT == 5 typedef CARD32 FbBits; #endif #if FB_SHIFT == 4 typedef CARD16 FbBits; #endif #if LOG2_BITMAP_PAD == FB_SHIFT typedef FbBits FbStip; #else # if LOG2_BITMAP_PAD == 5 typedef CARD32 FbStip; # endif #endif typedef int FbStride; #ifdef FB_DEBUG extern void fbValidateDrawable(DrawablePtr d); extern void fbInitializeDrawable(DrawablePtr d); extern void fbSetBits (FbStip *bits, int stride, FbStip data); #define FB_HEAD_BITS (FbStip) (0xbaadf00d) #define FB_TAIL_BITS (FbStip) (0xbaddf0ad) #else #define fbValidateDrawable(d) #define fdInitializeDrawable(d) #endif #include "fbrop.h" #if BITMAP_BIT_ORDER == LSBFirst #define FbScrLeft(x,n) ((x) >> (n)) #define FbScrRight(x,n) ((x) << (n)) /* #define FbLeftBits(x,n) ((x) & ((((FbBits) 1) << (n)) - 1)) */ #define FbLeftStipBits(x,n) ((x) & ((((FbStip) 1) << (n)) - 1)) #define FbStipMoveLsb(x,s,n) (FbStipRight (x,(s)-(n))) #define FbPatternOffsetBits 0 #else #define FbScrLeft(x,n) ((x) << (n)) #define FbScrRight(x,n) ((x) >> (n)) /* #define FbLeftBits(x,n) ((x) >> (FB_UNIT - (n))) */ #define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n))) #define FbStipMoveLsb(x,s,n) (x) #define FbPatternOffsetBits (sizeof (FbBits) - 1) #endif #include "micoord.h" #define FbStipLeft(x,n) FbScrLeft(x,n) #define FbStipRight(x,n) FbScrRight(x,n) #define FbRotLeft(x,n) FbScrLeft(x,n) | (n ? FbScrRight(x,FB_UNIT-n) : 0) #define FbRotRight(x,n) FbScrRight(x,n) | (n ? FbScrLeft(x,FB_UNIT-n) : 0) #define FbRotStipLeft(x,n) FbStipLeft(x,n) | (n ? FbStipRight(x,FB_STIP_UNIT-n) : 0) #define FbRotStipRight(x,n) FbStipRight(x,n) | (n ? FbStipLeft(x,FB_STIP_UNIT-n) : 0) #define FbLeftMask(x) ( ((x) & FB_MASK) ? \ FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0) #define FbRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \ FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0) #define FbLeftStipMask(x) ( ((x) & FB_STIP_MASK) ? \ FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) : 0) #define FbRightStipMask(x) ( ((FB_STIP_UNIT - (x)) & FB_STIP_MASK) ? \ FbScrLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - (x)) & FB_STIP_MASK) : 0) #define FbBitsMask(x,w) (FbScrRight(FB_ALLONES,(x) & FB_MASK) & \ FbScrLeft(FB_ALLONES,(FB_UNIT - ((x) + (w))) & FB_MASK)) #define FbStipMask(x,w) (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \ FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK)) #define FbMaskBits(x,w,l,n,r) { \ n = (w); \ r = FbRightMask((x)+n); \ l = FbLeftMask(x); \ if (l) { \ n -= FB_UNIT - ((x) & FB_MASK); \ if (n < 0) { \ n = 0; \ l &= r; \ r = 0; \ } \ } \ n >>= FB_SHIFT; \ } #ifdef FBNOPIXADDR #define FbMaskBitsBytes(x,w,copy,l,lb,n,r,rb) FbMaskBits(x,w,l,n,r) #define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \ *dst = FbDoMaskRRop(*dst,and,xor,l); \ } #define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \ *dst = FbDoMaskRRop(*dst,and,xor,r); \ } #else #define FbByteMaskInvalid 0x10 #define FbPatternOffset(o,t) ((o) ^ (FbPatternOffsetBits & ~(sizeof (t) - 1))) #define FbPtrOffset(p,o,t) ((t *) ((CARD8 *) (p) + (o))) #define FbSelectPatternPart(xor,o,t) ((xor) >> (FbPatternOffset (o,t) << 3)) #define FbStorePart(dst,off,t,xor) (*FbPtrOffset(dst,off,t) = \ FbSelectPart(xor,off,t)) #ifndef FbSelectPart #define FbSelectPart(x,o,t) FbSelectPatternPart(x,o,t) #endif #define FbMaskBitsBytes(x,w,copy,l,lb,n,r,rb) { \ n = (w); \ lb = 0; \ rb = 0; \ r = FbRightMask((x)+n); \ if (r) { \ /* compute right byte length */ \ if ((copy) && (((x) + n) & 7) == 0) { \ rb = (((x) + n) & FB_MASK) >> 3; \ } else { \ rb = FbByteMaskInvalid; \ } \ } \ l = FbLeftMask(x); \ if (l) { \ /* compute left byte length */ \ if ((copy) && ((x) & 7) == 0) { \ lb = ((x) & FB_MASK) >> 3; \ } else { \ lb = FbByteMaskInvalid; \ } \ /* subtract out the portion painted by leftMask */ \ n -= FB_UNIT - ((x) & FB_MASK); \ if (n < 0) { \ if (lb != FbByteMaskInvalid) { \ if (rb == FbByteMaskInvalid) { \ lb = FbByteMaskInvalid; \ } else if (rb) { \ lb |= (rb - lb) << (FB_SHIFT - 3); \ rb = 0; \ } \ } \ n = 0; \ l &= r; \ r = 0; \ }\ } \ n >>= FB_SHIFT; \ } #if FB_SHIFT == 6 #define FbDoLeftMaskByteRRop6Cases(dst,xor) \ case (sizeof (FbBits) - 7) | (1 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ break; \ case (sizeof (FbBits) - 7) | (2 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \ break; \ case (sizeof (FbBits) - 7) | (3 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ break; \ case (sizeof (FbBits) - 7) | (4 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \ break; \ case (sizeof (FbBits) - 7) | (5 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ break; \ case (sizeof (FbBits) - 7) | (6 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ break; \ case (sizeof (FbBits) - 7): \ FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \ break; \ case (sizeof (FbBits) - 6) | (1 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \ break; \ case (sizeof (FbBits) - 6) | (2 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ break; \ case (sizeof (FbBits) - 6) | (3 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \ break; \ case (sizeof (FbBits) - 6) | (4 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ break; \ case (sizeof (FbBits) - 6) | (5 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ break; \ case (sizeof (FbBits) - 6): \ FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \ break; \ case (sizeof (FbBits) - 5) | (1 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ break; \ case (sizeof (FbBits) - 5) | (2 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \ break; \ case (sizeof (FbBits) - 5) | (3 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ break; \ case (sizeof (FbBits) - 5) | (4 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ break; \ case (sizeof (FbBits) - 5): \ FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \ break; \ case (sizeof (FbBits) - 4) | (1 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \ break; \ case (sizeof (FbBits) - 4) | (2 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ break; \ case (sizeof (FbBits) - 4) | (3 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ break; \ case (sizeof (FbBits) - 4): \ FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \ break; #define FbDoRightMaskByteRRop6Cases(dst,xor) \ case 4: \ FbStorePart(dst,0,CARD32,xor); \ break; \ case 5: \ FbStorePart(dst,0,CARD32,xor); \ FbStorePart(dst,4,CARD8,xor); \ break; \ case 6: \ FbStorePart(dst,0,CARD32,xor); \ FbStorePart(dst,4,CARD16,xor); \ break; \ case 7: \ FbStorePart(dst,0,CARD32,xor); \ FbStorePart(dst,4,CARD16,xor); \ FbStorePart(dst,6,CARD8,xor); \ break; #else #define FbDoLeftMaskByteRRop6Cases(dst,xor) #define FbDoRightMaskByteRRop6Cases(dst,xor) #endif #define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \ switch (lb) { \ FbDoLeftMaskByteRRop6Cases(dst,xor) \ case (sizeof (FbBits) - 3) | (1 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \ break; \ case (sizeof (FbBits) - 3) | (2 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \ FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ break; \ case (sizeof (FbBits) - 2) | (1 << (FB_SHIFT - 3)): \ FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ break; \ case sizeof (FbBits) - 3: \ FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \ case sizeof (FbBits) - 2: \ FbStorePart(dst,sizeof (FbBits) - 2,CARD16,xor); \ break; \ case sizeof (FbBits) - 1: \ FbStorePart(dst,sizeof (FbBits) - 1,CARD8,xor); \ break; \ default: \ *dst = FbDoMaskRRop(*dst, and, xor, l); \ break; \ } \ } #define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \ switch (rb) { \ case 1: \ FbStorePart(dst,0,CARD8,xor); \ break; \ case 2: \ FbStorePart(dst,0,CARD16,xor); \ break; \ case 3: \ FbStorePart(dst,0,CARD16,xor); \ FbStorePart(dst,2,CARD8,xor); \ break; \ FbDoRightMaskByteRRop6Cases(dst,xor) \ default: \ *dst = FbDoMaskRRop (*dst, and, xor, r); \ } \ } #endif #define FbMaskStip(x,w,l,n,r) { \ n = (w); \ r = FbRightStipMask((x)+n); \ l = FbLeftStipMask(x); \ if (l) { \ n -= FB_STIP_UNIT - ((x) & FB_STIP_MASK); \ if (n < 0) { \ n = 0; \ l &= r; \ r = 0; \ } \ } \ n >>= FB_STIP_SHIFT; \ } /* * These macros are used to transparently stipple * in copy mode; the expected usage is with 'n' constant * so all of the conditional parts collapse into a minimal * sequence of partial word writes * * 'n' is the bytemask of which bytes to store, 'a' is the address * of the FbBits base unit, 'o' is the offset within that unit * * The term "lane" comes from the hardware term "byte-lane" which */ #define FbLaneCase1(n,a,o) ((n) == 0x01 ? \ (*(CARD8 *) ((a)+FbPatternOffset(o,CARD8)) = \ fgxor) : 0) #define FbLaneCase2(n,a,o) ((n) == 0x03 ? \ (*(CARD16 *) ((a)+FbPatternOffset(o,CARD16)) = \ fgxor) : \ ((void)FbLaneCase1((n)&1,a,o), \ FbLaneCase1((n)>>1,a,(o)+1))) #define FbLaneCase4(n,a,o) ((n) == 0x0f ? \ (*(CARD32 *) ((a)+FbPatternOffset(o,CARD32)) = \ fgxor) : \ ((void)FbLaneCase2((n)&3,a,o), \ FbLaneCase2((n)>>2,a,(o)+2))) #define FbLaneCase8(n,a,o) ((n) == 0x0ff ? (*(FbBits *) ((a)+(o)) = fgxor) : \ ((void)FbLaneCase4((n)&15,a,o), \ FbLaneCase4((n)>>4,a,(o)+4))) #if FB_SHIFT == 6 #define FbLaneCase(n,a) FbLaneCase8(n,(CARD8 *) (a),0) #endif #if FB_SHIFT == 5 #define FbLaneCase(n,a) FbLaneCase4(n,(CARD8 *) (a),0) #endif /* Rotate a filled pixel value to the specified alignement */ #define FbRot24(p,b) (FbScrRight(p,b) | FbScrLeft(p,24-(b))) #define FbRot24Stip(p,b) (FbStipRight(p,b) | FbStipLeft(p,24-(b))) /* step a filled pixel value to the next/previous FB_UNIT alignment */ #define FbNext24Pix(p) (FbRot24(p,(24-FB_UNIT%24))) #define FbPrev24Pix(p) (FbRot24(p,FB_UNIT%24)) #define FbNext24Stip(p) (FbRot24(p,(24-FB_STIP_UNIT%24))) #define FbPrev24Stip(p) (FbRot24(p,FB_STIP_UNIT%24)) /* step a rotation value to the next/previous rotation value */ #if FB_UNIT == 64 #define FbNext24Rot(r) ((r) == 16 ? 0 : (r) + 8) #define FbPrev24Rot(r) ((r) == 0 ? 16 : (r) - 8) #if IMAGE_BYTE_ORDER == MSBFirst #define FbFirst24Rot(x) (((x) + 8) % 24) #else #define FbFirst24Rot(x) ((x) % 24) #endif #endif #if FB_UNIT == 32 #define FbNext24Rot(r) ((r) == 0 ? 16 : (r) - 8) #define FbPrev24Rot(r) ((r) == 16 ? 0 : (r) + 8) #if IMAGE_BYTE_ORDER == MSBFirst #define FbFirst24Rot(x) (((x) + 16) % 24) #else #define FbFirst24Rot(x) ((x) % 24) #endif #endif #define FbNext24RotStip(r) ((r) == 0 ? 16 : (r) - 8) #define FbPrev24RotStip(r) ((r) == 16 ? 0 : (r) + 8) /* Whether 24-bit specific code is needed for this filled pixel value */ #define FbCheck24Pix(p) ((p) == FbNext24Pix(p)) /* Macros for dealing with dashing */ #define FbDashDeclare \ unsigned char *__dash, *__firstDash, *__lastDash #define FbDashInit(pGC,pPriv,dashOffset,dashlen,even) { \ (even) = TRUE; \ __firstDash = (pGC)->dash; \ __lastDash = __firstDash + (pGC)->numInDashList; \ (dashOffset) %= (pPriv)->dashLength; \ \ __dash = __firstDash; \ while ((dashOffset) >= ((dashlen) = *__dash)) \ { \ (dashOffset) -= (dashlen); \ (even) = 1-(even); \ if (++__dash == __lastDash) \ __dash = __firstDash; \ } \ (dashlen) -= (dashOffset); \ } #define FbDashNext(dashlen) { \ if (++__dash == __lastDash) \ __dash = __firstDash; \ (dashlen) = *__dash; \ } /* as numInDashList is always even, this case can skip a test */ #define FbDashNextEven(dashlen) { \ (dashlen) = *++__dash; \ } #define FbDashNextOdd(dashlen) FbDashNext(dashlen) #define FbDashStep(dashlen,even) { \ if (!--(dashlen)) { \ FbDashNext(dashlen); \ (even) = 1-(even); \ } \ } /* XXX fb*PrivateIndex should be static, but it breaks the ABI */ extern int fbGCPrivateIndex; extern int fbGetGCPrivateIndex(void); #ifndef FB_NO_WINDOW_PIXMAPS extern int fbWinPrivateIndex; extern int fbGetWinPrivateIndex(void); #endif extern const GCOps fbGCOps; extern const GCFuncs fbGCFuncs; #ifdef TEKX11 #define FB_OLD_GC #define FB_OLD_SCREEN #endif #ifdef FB_OLD_SCREEN # define FB_OLD_MISCREENINIT /* miScreenInit requires 14 args, not 13 */ #endif #ifdef FB_24_32BIT #define FB_SCREEN_PRIVATE #endif #ifdef FB_SCREEN_PRIVATE extern int fbScreenPrivateIndex; extern int fbGetScreenPrivateIndex(void); /* private field of a screen */ typedef struct { unsigned char win32bpp; /* window bpp for 32-bpp images */ unsigned char pix32bpp; /* pixmap bpp for 32-bpp images */ } FbScreenPrivRec, *FbScreenPrivPtr; #define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \ (pScreen)->devPrivates[fbGetScreenPrivateIndex()].ptr) #endif /* private field of GC */ typedef struct { #ifdef FB_OLD_GC unsigned char pad1; unsigned char pad2; unsigned char pad3; unsigned fExpose:1; unsigned freeCompClip:1; PixmapPtr pRotatedPixmap; RegionPtr pCompositeClip; #endif FbBits and, xor; /* reduced rop values */ FbBits bgand, bgxor; /* for stipples */ FbBits fg, bg, pm; /* expanded and filled */ unsigned int dashLength; /* total of all dash elements */ unsigned char oneRect; /* clip list is single rectangle */ unsigned char evenStipple; /* stipple is even */ unsigned char bpp; /* current drawable bpp */ } FbGCPrivRec, *FbGCPrivPtr; #define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\ (pGC)->devPrivates[fbGetGCPrivateIndex()].ptr) #ifdef FB_OLD_GC #define fbGetCompositeClip(pGC) (fbGetGCPrivate(pGC)->pCompositeClip) #define fbGetExpose(pGC) (fbGetGCPrivate(pGC)->fExpose) #define fbGetFreeCompClip(pGC) (fbGetGCPrivate(pGC)->freeCompClip) #define fbGetRotatedPixmap(pGC) (fbGetGCPrivate(pGC)->pRotatedPixmap) #else #define fbGetCompositeClip(pGC) ((pGC)->pCompositeClip) #define fbGetExpose(pGC) ((pGC)->fExpose) #define fbGetFreeCompClip(pGC) ((pGC)->freeCompClip) #define fbGetRotatedPixmap(pGC) ((pGC)->pRotatedPixmap) #endif #define fbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate) #ifdef FB_NO_WINDOW_PIXMAPS #define fbGetWindowPixmap(d) fbGetScreenPixmap(((DrawablePtr) (d))->pScreen) #else #define fbGetWindowPixmap(pWin) ((PixmapPtr)\ ((WindowPtr) (pWin))->devPrivates[fbGetWinPrivateIndex()].ptr) #endif #ifdef ROOTLESS #define __fbPixDrawableX(pPix) ((pPix)->drawable.x) #define __fbPixDrawableY(pPix) ((pPix)->drawable.y) #else #define __fbPixDrawableX(pPix) 0 #define __fbPixDrawableY(pPix) 0 #endif #ifdef COMPOSITE #define __fbPixOffXWin(pPix) (__fbPixDrawableX(pPix) - (pPix)->screen_x) #define __fbPixOffYWin(pPix) (__fbPixDrawableY(pPix) - (pPix)->screen_y) #else #define __fbPixOffXWin(pPix) (__fbPixDrawableX(pPix)) #define __fbPixOffYWin(pPix) (__fbPixDrawableY(pPix)) #endif #define __fbPixOffXPix(pPix) (__fbPixDrawableX(pPix)) #define __fbPixOffYPix(pPix) (__fbPixDrawableY(pPix)) #define fbGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \ PixmapPtr _pPix; \ if ((pDrawable)->type != DRAWABLE_PIXMAP) { \ _pPix = fbGetWindowPixmap(pDrawable); \ (xoff) = __fbPixOffXWin(_pPix); \ (yoff) = __fbPixOffYWin(_pPix); \ } else { \ _pPix = (PixmapPtr) (pDrawable); \ (xoff) = __fbPixOffXPix(_pPix); \ (yoff) = __fbPixOffYPix(_pPix); \ } \ (pointer) = (FbBits *) _pPix->devPrivate.ptr; \ (stride) = ((int) _pPix->devKind) / sizeof (FbBits); (void)(stride); \ (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \ } #define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \ PixmapPtr _pPix; \ if ((pDrawable)->type != DRAWABLE_PIXMAP) { \ _pPix = fbGetWindowPixmap(pDrawable); \ (xoff) = __fbPixOffXWin(_pPix); \ (yoff) = __fbPixOffYWin(_pPix); \ } else { \ _pPix = (PixmapPtr) (pDrawable); \ (xoff) = __fbPixOffXPix(_pPix); \ (yoff) = __fbPixOffYPix(_pPix); \ } \ (pointer) = (FbStip *) _pPix->devPrivate.ptr; \ (stride) = ((int) _pPix->devKind) / sizeof (FbStip); (void)(stride); \ (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \ } /* * XFree86 empties the root BorderClip when the VT is inactive, * here's a macro which uses that to disable GetImage and GetSpans */ #define fbWindowEnabled(pWin) \ RegionNotEmpty(\ &(pWin)->drawable.pScreen->root->borderClip) #define fbDrawableEnabled(pDrawable) \ ((pDrawable)->type == DRAWABLE_PIXMAP ? \ TRUE : fbWindowEnabled((WindowPtr) pDrawable)) #ifdef FB_OLD_SCREEN #define BitsPerPixel(d) (\ ((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \ (PixmapWidthPaddingInfo[d].padRoundUp+1))) #endif #define FbPowerOfTwo(w) (((w) & ((w) - 1)) == 0) /* * Accelerated tiles are power of 2 width <= FB_UNIT */ #define FbEvenTile(w) ((w) <= FB_UNIT && FbPowerOfTwo(w)) /* * Accelerated stipples are power of 2 width and <= FB_UNIT/dstBpp * with dstBpp a power of 2 as well */ #define FbEvenStip(w,bpp) ((w) * (bpp) <= FB_UNIT && FbPowerOfTwo(w) && FbPowerOfTwo(bpp)) /* * fb24_32.c */ void fb24_32GetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart); void fb24_32SetSpans (DrawablePtr pDrawable, GCPtr pGC, char *src, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted); void fb24_32PutZImage (DrawablePtr pDrawable, RegionPtr pClip, int alu, FbBits pm, int x, int y, int width, int height, CARD8 *src, FbStride srcStride); void fb24_32GetImage (DrawablePtr pDrawable, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *d); void fb24_32CopyMtoN (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure); PixmapPtr fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel); Bool fb24_32CreateScreenResources(ScreenPtr pScreen); Bool fb24_32ModifyPixmapHeader (PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, void *pPixData); /* * fballpriv.c */ Bool fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex); /* * fbarc.c */ void fbPolyArc (DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs); /* * fbbits.c */ void fbBresSolid8(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); void fbBresDash8 (DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); void fbDots8 (FbBits *dst, FbStride dstStride, int dstBpp, BoxPtr pBox, xPoint *pts, int npt, int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor); void fbArc8 (FbBits *dst, FbStride dstStride, int dstBpp, xArc *arc, int dx, int dy, FbBits and, FbBits xor); void fbGlyph8 (FbBits *dstLine, FbStride dstStride, int dstBpp, FbStip *stipple, FbBits fg, int height, int shift); void fbPolyline8 (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig); void fbPolySegment8 (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pseg); void fbBresSolid16(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); void fbBresDash16(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); void fbDots16(FbBits *dst, FbStride dstStride, int dstBpp, BoxPtr pBox, xPoint *pts, int npt, int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor); void fbArc16(FbBits *dst, FbStride dstStride, int dstBpp, xArc *arc, int dx, int dy, FbBits and, FbBits xor); void fbGlyph16(FbBits *dstLine, FbStride dstStride, int dstBpp, FbStip *stipple, FbBits fg, int height, int shift); void fbPolyline16 (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig); void fbPolySegment16 (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pseg); void fbBresSolid24(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); void fbBresDash24(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); void fbDots24(FbBits *dst, FbStride dstStride, int dstBpp, BoxPtr pBox, xPoint *pts, int npt, int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor); void fbArc24(FbBits *dst, FbStride dstStride, int dstBpp, xArc *arc, int dx, int dy, FbBits and, FbBits xor); void fbGlyph24(FbBits *dstLine, FbStride dstStride, int dstBpp, FbStip *stipple, FbBits fg, int height, int shift); void fbPolyline24 (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig); void fbPolySegment24 (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pseg); void fbBresSolid32(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); void fbBresDash32(DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); void fbDots32(FbBits *dst, FbStride dstStride, int dstBpp, BoxPtr pBox, xPoint *pts, int npt, int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor); void fbArc32(FbBits *dst, FbStride dstStride, int dstBpp, xArc *arc, int dx, int dy, FbBits and, FbBits xor); void fbGlyph32(FbBits *dstLine, FbStride dstStride, int dstBpp, FbStip *stipple, FbBits fg, int height, int shift); void fbPolyline32 (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig); void fbPolySegment32 (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pseg); /* * fbblt.c */ void fbBlt (FbBits *src, FbStride srcStride, int srcX, FbBits *dst, FbStride dstStride, int dstX, int width, int height, int alu, FbBits pm, int bpp, Bool reverse, Bool upsidedown); void fbBlt24 (FbBits *srcLine, FbStride srcStride, int srcX, FbBits *dstLine, FbStride dstStride, int dstX, int width, int height, int alu, FbBits pm, Bool reverse, Bool upsidedown); void fbBltStip (FbStip *src, FbStride srcStride, /* in FbStip units, not FbBits units */ int srcX, FbStip *dst, FbStride dstStride, /* in FbStip units, not FbBits units */ int dstX, int width, int height, int alu, FbBits pm, int bpp); /* * fbbltone.c */ void fbBltOne (FbStip *src, FbStride srcStride, int srcX, FbBits *dst, FbStride dstStride, int dstX, int dstBpp, int width, int height, FbBits fgand, FbBits fbxor, FbBits bgand, FbBits bgxor); #ifdef FB_24BIT void fbBltOne24 (FbStip *src, FbStride srcStride, /* FbStip units per scanline */ int srcX, /* bit position of source */ FbBits *dst, FbStride dstStride, /* FbBits units per scanline */ int dstX, /* bit position of dest */ int dstBpp, /* bits per destination unit */ int width, /* width in bits of destination */ int height, /* height in scanlines */ FbBits fgand, /* rrop values */ FbBits fgxor, FbBits bgand, FbBits bgxor); #endif void fbBltPlane (FbBits *src, FbStride srcStride, int srcX, int srcBpp, FbStip *dst, FbStride dstStride, int dstX, int width, int height, FbStip fgand, FbStip fgxor, FbStip bgand, FbStip bgxor, Pixel planeMask); /* * fbbstore.c */ void fbSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, WindowPtr pWin); void fbRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, int yorg, WindowPtr pWin); /* * fbcmap.c */ int fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps); void fbInstallColormap(ColormapPtr pmap); void fbUninstallColormap(ColormapPtr pmap); void fbResolveColor(unsigned short *pred, unsigned short *pgreen, unsigned short *pblue, VisualPtr pVisual); Bool fbInitializeColormap(ColormapPtr pmap); int fbExpandDirectColors (ColormapPtr pmap, int ndef, xColorItem *indefs, xColorItem *outdefs); Bool fbCreateDefColormap(ScreenPtr pScreen); void fbClearVisualTypes(void); Bool fbSetVisualTypes (int depth, int visuals, int bitsPerRGB); Bool fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB, Pixel redMask, Pixel greenMask, Pixel blueMask); Bool fbInitVisuals (VisualPtr *visualp, DepthPtr *depthp, int *nvisualp, int *ndepthp, int *rootDepthp, VisualID *defaultVisp, unsigned long sizes, int bitsPerRGB); /* * fbcopy.c */ typedef void (*fbCopyProc) (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pDstBox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure); void fbCopyNtoN (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure); void fbCopy1toN (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure); void fbCopyNto1 (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure); void fbCopyRegion (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, RegionPtr pDstRegion, int dx, int dy, fbCopyProc copyProc, Pixel bitPlane, void *closure); RegionPtr fbDoCopy (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut, fbCopyProc copyProc, Pixel bitplane, void *closure); RegionPtr fbCopyArea (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut); RegionPtr fbCopyPlane (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut, unsigned long bitplane); /* * fbfill.c */ void fbFill (DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height); void fbSolidBoxClipped (DrawablePtr pDrawable, RegionPtr pClip, int xa, int ya, int xb, int yb, FbBits and, FbBits xor); /* * fbfillrect.c */ void fbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectInit, xRectangle *prectInit); #define fbPolyFillArc miPolyFillArc #define fbFillPolygon miFillPolygon /* * fbfillsp.c */ void fbFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted); /* * fbgc.c */ Bool fbCreateGC(GCPtr pGC); void fbPadPixmap (PixmapPtr pPixmap); void fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable); /* * fbgetsp.c */ void fbGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart); /* * fbglyph.c */ Bool fbGlyphIn (RegionPtr pRegion, int x, int y, int width, int height); void fbPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void *pglyphBase); void fbImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void *pglyphBase); /* * fbimage.c */ void fbPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage); void fbPutZImage (DrawablePtr pDrawable, RegionPtr pClip, int alu, FbBits pm, int x, int y, int width, int height, FbStip *src, FbStride srcStride); void fbPutXYImage (DrawablePtr pDrawable, RegionPtr pClip, FbBits fg, FbBits bg, FbBits pm, int alu, Bool opaque, int x, int y, int width, int height, FbStip *src, FbStride srcStride, int srcX); void fbGetImage (DrawablePtr pDrawable, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *d); /* * fbline.c */ void fbZeroLine (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt); void fbZeroSegment (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs); void fbPolyLine (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt); void fbFixCoordModePrevious (int npt, DDXPointPtr ppt); void fbPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pseg); #define fbPolyRectangle miPolyRectangle /* * fbpict.c */ Bool fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); /* * fbpixmap.c */ PixmapPtr fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp, unsigned usage_hint); PixmapPtr fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint); Bool fbDestroyPixmap (PixmapPtr pPixmap); RegionPtr fbPixmapToRegion(PixmapPtr pPix); /* * fbpoint.c */ void fbDots (FbBits *dstOrig, FbStride dstStride, int dstBpp, BoxPtr pBox, xPoint *pts, int npt, int xorg, int yorg, int xoff, int yoff, FbBits andOrig, FbBits xorOrig); void fbPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, xPoint *pptInit); /* * fbpush.c */ void fbPushPattern (DrawablePtr pDrawable, GCPtr pGC, FbStip *src, FbStride srcStride, int srcX, int x, int y, int width, int height); void fbPushFill (DrawablePtr pDrawable, GCPtr pGC, FbStip *src, FbStride srcStride, int srcX, int x, int y, int width, int height); void fbPush1toN (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure); void fbPushImage (DrawablePtr pDrawable, GCPtr pGC, FbStip *src, FbStride srcStride, int srcX, int x, int y, int width, int height); void fbPushPixels (GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg); /* * fbscreen.c */ Bool fbCloseScreen (ScreenPtr pScreen); Bool fbRealizeFont(ScreenPtr pScreen, FontPtr pFont); Bool fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont); void fbQueryBestSize (int class, unsigned short *width, unsigned short *height, ScreenPtr pScreen); #ifndef FB_OLD_SCREEN PixmapPtr _fbGetWindowPixmap (WindowPtr pWindow); void _fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap); #endif Bool fbSetupScreen(ScreenPtr pScreen, void *pbits, /* pointer to screen bitmap */ int xsize, /* in pixels */ int ysize, int dpix, /* dots per inch */ int dpiy, int width, /* pixel width of frame buffer */ int bpp); /* bits per pixel of frame buffer */ Bool fbFinishScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp); Bool fbScreenInit(ScreenPtr pScreen, void *pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp); void fbInitializeBackingStore (ScreenPtr pScreen); /* * fbseg.c */ typedef void FbBres (DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); FbBres fbBresSolid, fbBresDash, fbBresFill, fbBresFillDash; /* * fbsetsp.c */ void fbSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *src, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted); FbBres * fbSelectBres (DrawablePtr pDrawable, GCPtr pGC); void fbBres (DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x, int y, int e, int e1, int e3, int len); void fbSegment (DrawablePtr pDrawable, GCPtr pGC, int xa, int ya, int xb, int yb, Bool drawLast, int *dashOffset); /* * fbsolid.c */ void fbSolid (FbBits *dst, FbStride dstStride, int dstX, int bpp, int width, int height, FbBits and, FbBits xor); #ifdef FB_24BIT void fbSolid24 (FbBits *dst, FbStride dstStride, int dstX, int width, int height, FbBits and, FbBits xor); #endif /* * fbstipple.c */ void fbTransparentSpan (FbBits *dst, FbBits stip, FbBits fgxor, int n); void fbEvenStipple (FbBits *dst, FbStride dstStride, int dstX, int dstBpp, int width, int height, FbStip *stip, FbStride stipStride, int stipHeight, FbBits fgand, FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot); void fbOddStipple (FbBits *dst, FbStride dstStride, int dstX, int dstBpp, int width, int height, FbStip *stip, FbStride stipStride, int stipWidth, int stipHeight, FbBits fgand, FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot); void fbStipple (FbBits *dst, FbStride dstStride, int dstX, int dstBpp, int width, int height, FbStip *stip, FbStride stipStride, int stipWidth, int stipHeight, Bool even, FbBits fgand, FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot); /* * fbtile.c */ void fbEvenTile (FbBits *dst, FbStride dstStride, int dstX, int width, int height, FbBits *tile, int tileHeight, int alu, FbBits pm, int xRot, int yRot); void fbOddTile (FbBits *dst, FbStride dstStride, int dstX, int width, int height, FbBits *tile, FbStride tileStride, int tileWidth, int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot); void fbTile (FbBits *dst, FbStride dstStride, int dstX, int width, int height, FbBits *tile, FbStride tileStride, int tileWidth, int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot); /* * fbutil.c */ FbBits fbReplicatePixel (Pixel p, int bpp); void fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp); /* * fbwindow.c */ Bool fbCreateWindow(WindowPtr pWin); Bool fbDestroyWindow(WindowPtr pWin); Bool fbMapWindow(WindowPtr pWindow); Bool fbPositionWindow(WindowPtr pWin, int x, int y); Bool fbUnmapWindow(WindowPtr pWindow); void fbCopyWindowProc (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure); void fbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); Bool fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask); void fbFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, FbBits and, FbBits xor); void fbFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile); void fbPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what); #endif /* _FB_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbimage.c0000644000000000000000000001735713614532331016735 0ustar /* * Id: fbimage.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "fb.h" void fbPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); unsigned long i; FbStride srcStride; FbStip *src = (FbStip *) pImage; x += pDrawable->x; y += pDrawable->y; switch (format) { case XYBitmap: srcStride = BitmapBytePad(w + leftPad) / sizeof (FbStip); fbPutXYImage (pDrawable, fbGetCompositeClip(pGC), pPriv->fg, pPriv->bg, pPriv->pm, pGC->alu, TRUE, x, y, w, h, src, srcStride, leftPad); break; case XYPixmap: srcStride = BitmapBytePad(w + leftPad) / sizeof (FbStip); for (i = 1 << (pDrawable->depth - 1); i; i >>= 1) { if (i & pGC->planemask) { fbPutXYImage (pDrawable, fbGetCompositeClip(pGC), FB_ALLONES, 0, fbReplicatePixel (i, pDrawable->bitsPerPixel), pGC->alu, TRUE, x, y, w, h, src, srcStride, leftPad); src += srcStride * h; } } break; case ZPixmap: #ifdef FB_24_32BIT if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) { srcStride = PixmapBytePad(w, pDrawable->depth); fb24_32PutZImage (pDrawable, fbGetCompositeClip(pGC), pGC->alu, (FbBits) pGC->planemask, x, y, w, h, (CARD8 *) pImage, srcStride); } else #endif { srcStride = PixmapBytePad(w, pDrawable->depth) / sizeof (FbStip); fbPutZImage (pDrawable, fbGetCompositeClip(pGC), pGC->alu, pPriv->pm, x, y, w, h, src, srcStride); } } } void fbPutZImage (DrawablePtr pDrawable, RegionPtr pClip, int alu, FbBits pm, int x, int y, int width, int height, FbStip *src, FbStride srcStride) { FbStip *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; int nbox; BoxPtr pbox; int x1, y1, x2, y2; fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); for (nbox = RegionNumRects (pClip), pbox = RegionRects(pClip); nbox--; pbox++) { x1 = x; y1 = y; x2 = x + width; y2 = y + height; if (x1 < pbox->x1) x1 = pbox->x1; if (y1 < pbox->y1) y1 = pbox->y1; if (x2 > pbox->x2) x2 = pbox->x2; if (y2 > pbox->y2) y2 = pbox->y2; if (x1 >= x2 || y1 >= y2) continue; fbBltStip (src + (y1 - y) * srcStride, srcStride, (x1 - x) * dstBpp, dst + (y1 + dstYoff) * dstStride, dstStride, (x1 + dstXoff) * dstBpp, (x2 - x1) * dstBpp, (y2 - y1), alu, pm, dstBpp); } } void fbPutXYImage (DrawablePtr pDrawable, RegionPtr pClip, FbBits fg, FbBits bg, FbBits pm, int alu, Bool opaque, int x, int y, int width, int height, FbStip *src, FbStride srcStride, int srcX) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; int nbox; BoxPtr pbox; int x1, y1, x2, y2; FbBits fgand = 0, fgxor = 0, bgand = 0, bgxor = 0; fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); if (dstBpp == 1) { if (opaque) alu = FbOpaqueStipple1Rop(alu,fg,bg); else alu = FbStipple1Rop(alu,fg); } else { fgand = fbAnd(alu,fg,pm); fgxor = fbXor(alu,fg,pm); if (opaque) { bgand = fbAnd(alu,bg,pm); bgxor = fbXor(alu,bg,pm); } else { bgand = fbAnd(GXnoop,(FbBits)0,FB_ALLONES); bgxor = fbXor(GXnoop,(FbBits)0,FB_ALLONES); } } for (nbox = RegionNumRects (pClip), pbox = RegionRects(pClip); nbox--; pbox++) { x1 = x; y1 = y; x2 = x + width; y2 = y + height; if (x1 < pbox->x1) x1 = pbox->x1; if (y1 < pbox->y1) y1 = pbox->y1; if (x2 > pbox->x2) x2 = pbox->x2; if (y2 > pbox->y2) y2 = pbox->y2; if (x1 >= x2 || y1 >= y2) continue; if (dstBpp == 1) { fbBltStip (src + (y1 - y) * srcStride, srcStride, (x1 - x) + srcX, (FbStip *) (dst + (y1 + dstYoff) * dstStride), FbBitsStrideToStipStride(dstStride), (x1 + dstXoff) * dstBpp, (x2 - x1) * dstBpp, (y2 - y1), alu, pm, dstBpp); } else { fbBltOne (src + (y1 - y) * srcStride, srcStride, (x1 - x) + srcX, dst + (y1 + dstYoff) * dstStride, dstStride, (x1 + dstXoff) * dstBpp, dstBpp, (x2 - x1) * dstBpp, (y2 - y1), fgand, fgxor, bgand, bgxor); } } } void fbGetImage (DrawablePtr pDrawable, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *d) { FbBits *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbStip *dst; FbStride dstStride; /* * XFree86 DDX empties the root borderClip when the VT is * switched away; this checks for that case */ if (!fbDrawableEnabled(pDrawable)) return; #ifdef FB_24_32BIT if (format == ZPixmap && pDrawable->bitsPerPixel != BitsPerPixel (pDrawable->depth)) { fb24_32GetImage (pDrawable, x, y, w, h, format, planeMask, d); return; } #endif fbGetDrawable (pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); x += pDrawable->x; y += pDrawable->y; dst = (FbStip *) d; if (format == ZPixmap || srcBpp == 1) { FbBits pm; pm = fbReplicatePixel (planeMask, srcBpp); dstStride = PixmapBytePad(w, pDrawable->depth); if (pm != FB_ALLONES) memset (d, 0, dstStride * h); dstStride /= sizeof (FbStip); fbBltStip ((FbStip *) (src + (y + srcYoff) * srcStride), FbBitsStrideToStipStride(srcStride), (x + srcXoff) * srcBpp, dst, dstStride, 0, w * srcBpp, h, GXcopy, pm, srcBpp); } else { dstStride = BitmapBytePad(w) / sizeof (FbStip); fbBltPlane (src + (y + srcYoff) * srcStride, srcStride, (x + srcXoff) * srcBpp, srcBpp, dst, dstStride, 0, w * srcBpp, h, fbAndStip(GXcopy,FB_STIP_ALLONES,FB_STIP_ALLONES), fbXorStip(GXcopy,FB_STIP_ALLONES,FB_STIP_ALLONES), fbAndStip(GXcopy,0,FB_STIP_ALLONES), fbXorStip(GXcopy,0,FB_STIP_ALLONES), planeMask); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbline.c0000644000000000000000000000772713614532331016602 0ustar /* * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" void fbZeroLine (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt) { int x1, y1, x2, y2; int x, y; int dashOffset; x = pDrawable->x; y = pDrawable->y; x1 = ppt->x; y1 = ppt->y; dashOffset = pGC->dashOffset; while (--npt) { ++ppt; x2 = ppt->x; y2 = ppt->y; if (mode == CoordModePrevious) { x2 += x1; y2 += y1; } fbSegment (pDrawable, pGC, x1 + x, y1 + y, x2 + x, y2 + y, npt == 1 && pGC->capStyle != CapNotLast, &dashOffset); x1 = x2; y1 = y2; } } void fbZeroSegment (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs) { int dashOffset; int x, y; Bool drawLast = pGC->capStyle != CapNotLast; x = pDrawable->x; y = pDrawable->y; while (nseg--) { dashOffset = pGC->dashOffset; fbSegment (pDrawable, pGC, pSegs->x1 + x, pSegs->y1 + y, pSegs->x2 + x, pSegs->y2 + y, drawLast, &dashOffset); pSegs++; } } void fbFixCoordModePrevious (int npt, DDXPointPtr ppt) { int x, y; x = ppt->x; y = ppt->y; npt--; while (npt--) { ppt++; x = (ppt->x += x); y = (ppt->y += y); } } void fbPolyLine (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt) { void (*line) (DrawablePtr, GCPtr, int mode, int npt, DDXPointPtr ppt); if (pGC->lineWidth == 0) { line = fbZeroLine; #ifndef FBNOPIXADDR if (pGC->fillStyle == FillSolid && pGC->lineStyle == LineSolid && RegionNumRects (fbGetCompositeClip(pGC)) == 1) { switch (pDrawable->bitsPerPixel) { case 8: line = fbPolyline8; break; case 16: line = fbPolyline16; break; #ifdef FB_24BIT case 24: line = fbPolyline24; break; #endif case 32: line = fbPolyline32; break; } } #endif } else { if (pGC->lineStyle != LineSolid) line = miWideDash; else line = miWideLine; } (*line) (pDrawable, pGC, mode, npt, ppt); } void fbPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pseg) { void (*seg) (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pseg); if (pGC->lineWidth == 0) { seg = fbZeroSegment; #ifndef FBNOPIXADDR if (pGC->fillStyle == FillSolid && pGC->lineStyle == LineSolid && RegionNumRects (fbGetCompositeClip(pGC)) == 1) { switch (pDrawable->bitsPerPixel) { case 8: seg = fbPolySegment8; break; case 16: seg = fbPolySegment16; break; #ifdef FB_24BIT case 24: seg = fbPolySegment24; break; #endif case 32: seg = fbPolySegment32; break; } } #endif } else { seg = miPolySegment; } (*seg) (pDrawable, pGC, nseg, pseg); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fboverlay.c0000644000000000000000000002656513614532331017335 0ustar /* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "fb.h" #include "fboverlay.h" #ifdef MITSHM #include "shmint.h" #endif int fbOverlayGeneration; int fbOverlayScreenPrivateIndex = -1; int fbOverlayGetScreenPrivateIndex(void) { return fbOverlayScreenPrivateIndex; } /* * Replace this if you want something supporting * multiple overlays with the same depth */ Bool fbOverlayCreateWindow(WindowPtr pWin) { FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pWin->drawable.pScreen); int i; PixmapPtr pPixmap; if (pWin->drawable.class != InputOutput) return TRUE; #ifdef FB_SCREEN_PRIVATE if (pWin->drawable.bitsPerPixel == 32) pWin->drawable.bitsPerPixel = fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp; #endif for (i = 0; i < pScrPriv->nlayers; i++) { pPixmap = pScrPriv->layer[i].u.run.pixmap; if (pWin->drawable.depth == pPixmap->drawable.depth) { pWin->devPrivates[fbWinPrivateIndex].ptr = (void *) pPixmap; /* * Make sure layer keys are written correctly by * having non-root layers set to full while the * root layer is set to empty. This will cause * all of the layers to get painted when the root * is mapped */ if (!pWin->parent) { RegionEmpty( &pScrPriv->layer[i].u.run.region); } return TRUE; } } return FALSE; } Bool fbOverlayCloseScreen (ScreenPtr pScreen) { FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); int i; for (i = 0; i < pScrPriv->nlayers; i++) { (*pScreen->DestroyPixmap)(pScrPriv->layer[i].u.run.pixmap); RegionUninit(&pScrPriv->layer[i].u.run.region); } return TRUE; } /* * Return layer containing this window */ int fbOverlayWindowLayer(WindowPtr pWin) { FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pWin->drawable.pScreen); int i; for (i = 0; i < pScrPriv->nlayers; i++) if (pWin->devPrivates[fbWinPrivateIndex].ptr == (void *) pScrPriv->layer[i].u.run.pixmap) return i; return 0; } Bool fbOverlayCreateScreenResources(ScreenPtr pScreen) { int i; FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); PixmapPtr pPixmap; void * pbits; int width; int depth; BoxRec box; if (!miCreateScreenResources(pScreen)) return FALSE; box.x1 = 0; box.y1 = 0; box.x2 = pScreen->width; box.y2 = pScreen->height; for (i = 0; i < pScrPriv->nlayers; i++) { pbits = pScrPriv->layer[i].u.init.pbits; width = pScrPriv->layer[i].u.init.width; depth = pScrPriv->layer[i].u.init.depth; pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth, 0); if (!pPixmap) return FALSE; if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width, pScreen->height, depth, BitsPerPixel(depth), PixmapBytePad(width, depth), pbits)) return FALSE; pScrPriv->layer[i].u.run.pixmap = pPixmap; RegionInit(&pScrPriv->layer[i].u.run.region, &box, 0); } pScreen->devPrivate = pScrPriv->layer[0].u.run.pixmap; return TRUE; } void fbOverlayPaintKey (DrawablePtr pDrawable, RegionPtr pRegion, CARD32 pixel, int layer) { fbFillRegionSolid (pDrawable, pRegion, 0, fbReplicatePixel (pixel, pDrawable->bitsPerPixel)); } /* * Track visible region for each layer */ void fbOverlayUpdateLayerRegion (ScreenPtr pScreen, int layer, RegionPtr prgn) { FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); int i; RegionRec rgnNew; if (!prgn || !RegionNotEmpty(prgn)) return; for (i = 0; i < pScrPriv->nlayers; i++) { if (i == layer) { /* add new piece to this fb */ RegionUnion( &pScrPriv->layer[i].u.run.region, &pScrPriv->layer[i].u.run.region, prgn); } else if (RegionNotEmpty( &pScrPriv->layer[i].u.run.region)) { /* paint new piece with chroma key */ RegionNull(&rgnNew); RegionIntersect( &rgnNew, prgn, &pScrPriv->layer[i].u.run.region); (*pScrPriv->PaintKey) (&pScrPriv->layer[i].u.run.pixmap->drawable, &rgnNew, pScrPriv->layer[i].key, i); RegionUninit(&rgnNew); /* remove piece from other fbs */ RegionSubtract( &pScrPriv->layer[i].u.run.region, &pScrPriv->layer[i].u.run.region, prgn); } } } /* * Copy only areas in each layer containing real bits */ void fbOverlayCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWin->drawable.pScreen; FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pWin->drawable.pScreen); RegionRec rgnDst; int dx, dy; int i; RegionRec layerRgn[FB_OVERLAY_MAX]; PixmapPtr pPixmap; dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; /* * Clip to existing bits */ RegionTranslate(prgnSrc, -dx, -dy); RegionNull(&rgnDst); RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc); RegionTranslate(&rgnDst, dx, dy); /* * Compute the portion of each fb affected by this copy */ for (i = 0; i < pScrPriv->nlayers; i++) { RegionNull(&layerRgn[i]); RegionIntersect(&layerRgn[i], &rgnDst, &pScrPriv->layer[i].u.run.region); if (RegionNotEmpty(&layerRgn[i])) { RegionTranslate(&layerRgn[i], -dx, -dy); pPixmap = pScrPriv->layer[i].u.run.pixmap; fbCopyRegion (&pPixmap->drawable, &pPixmap->drawable, 0, &layerRgn[i], dx, dy, pScrPriv->CopyWindow, 0, (void *)(long) i); } } /* * Update regions */ for (i = 0; i < pScrPriv->nlayers; i++) { if (RegionNotEmpty(&layerRgn[i])) fbOverlayUpdateLayerRegion (pScreen, i, &layerRgn[i]); RegionUninit(&layerRgn[i]); } RegionUninit(&rgnDst); } void fbOverlayWindowExposures (WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed) { fbOverlayUpdateLayerRegion (pWin->drawable.pScreen, fbOverlayWindowLayer (pWin), prgn); miWindowExposures(pWin, prgn, other_exposed); } void fbOverlayPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) { if (what == PW_BORDER) fbOverlayUpdateLayerRegion (pWin->drawable.pScreen, fbOverlayWindowLayer (pWin), pRegion); fbPaintWindow (pWin, pRegion, what); } Bool fbOverlaySetupScreen(ScreenPtr pScreen, void * pbits1, void * pbits2, int xsize, int ysize, int dpix, int dpiy, int width1, int width2, int bpp1, int bpp2) { return fbSetupScreen (pScreen, pbits1, xsize, ysize, dpix, dpiy, width1, bpp1); } static Bool fb24_32OverlayCreateScreenResources(ScreenPtr pScreen) { FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); int pitch; Bool retval; int i; if((retval = fbOverlayCreateScreenResources(pScreen))) { for (i = 0; i < pScrPriv->nlayers; i++) { /* fix the screen pixmap */ PixmapPtr pPix = (PixmapPtr) pScrPriv->layer[i].u.run.pixmap; if (pPix->drawable.bitsPerPixel == 32) { pPix->drawable.bitsPerPixel = 24; pitch = BitmapBytePad(pPix->drawable.width * 24); pPix->devKind = pitch; } } } return retval; } Bool fbOverlayFinishScreenInit(ScreenPtr pScreen, void * pbits1, void * pbits2, int xsize, int ysize, int dpix, int dpiy, int width1, int width2, int bpp1, int bpp2, int depth1, int depth2) { VisualPtr visuals; DepthPtr depths; int nvisuals; int ndepths; int bpp = 0, imagebpp = 32; VisualID defaultVisual; FbOverlayScrPrivPtr pScrPriv; if (fbOverlayGeneration != serverGeneration) { fbOverlayScreenPrivateIndex = AllocateScreenPrivateIndex (); fbOverlayGeneration = serverGeneration; } pScrPriv = malloc (sizeof (FbOverlayScrPrivRec)); if (!pScrPriv) return FALSE; #ifdef FB_24_32BIT if (bpp1 == 32 || bpp2 == 32) bpp = 32; else if (bpp1 == 24 || bpp2 == 24) bpp = 24; if (bpp == 24) { int f; imagebpp = 32; /* * Check to see if we're advertising a 24bpp image format, * in which case windows will use it in preference to a 32 bit * format. */ for (f = 0; f < screenInfo.numPixmapFormats; f++) { if (screenInfo.formats[f].bitsPerPixel == 24) { imagebpp = 24; break; } } } #endif #ifdef FB_SCREEN_PRIVATE if (imagebpp == 32) { fbGetScreenPrivate(pScreen)->win32bpp = bpp; fbGetScreenPrivate(pScreen)->pix32bpp = bpp; } else { fbGetScreenPrivate(pScreen)->win32bpp = 32; fbGetScreenPrivate(pScreen)->pix32bpp = 32; } #endif if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &depth1, &defaultVisual, ((unsigned long)1<<(bpp1-1)) | ((unsigned long)1<<(bpp2-1)), 8)) { free(pScrPriv); return FALSE; } if (! miScreenInit(pScreen, 0, xsize, ysize, dpix, dpiy, 0, depth1, ndepths, depths, defaultVisual, nvisuals, visuals #ifdef FB_OLD_MISCREENINIT , (miBSFuncPtr) 0 #endif )) { free(pScrPriv); return FALSE; } /* MI thinks there's no frame buffer */ #ifdef MITSHM ShmRegisterFbFuncs(pScreen); #endif pScreen->minInstalledCmaps = 1; pScreen->maxInstalledCmaps = 2; pScrPriv->nlayers = 2; pScrPriv->PaintKey = fbOverlayPaintKey; pScrPriv->CopyWindow = fbCopyWindowProc; pScrPriv->layer[0].u.init.pbits = pbits1; pScrPriv->layer[0].u.init.width = width1; pScrPriv->layer[0].u.init.depth = depth1; pScrPriv->layer[1].u.init.pbits = pbits2; pScrPriv->layer[1].u.init.width = width2; pScrPriv->layer[1].u.init.depth = depth2; pScreen->devPrivates[fbOverlayScreenPrivateIndex].ptr = (void *) pScrPriv; /* overwrite miCloseScreen with our own */ pScreen->CloseScreen = fbOverlayCloseScreen; pScreen->CreateScreenResources = fbOverlayCreateScreenResources; pScreen->CreateWindow = fbOverlayCreateWindow; pScreen->WindowExposures = fbOverlayWindowExposures; pScreen->CopyWindow = fbOverlayCopyWindow; pScreen->PaintWindowBorder = fbOverlayPaintWindow; #ifdef FB_24_32BIT if (bpp == 24 && imagebpp == 32) { pScreen->ModifyPixmapHeader = fb24_32ModifyPixmapHeader; pScreen->CreateScreenResources = fb24_32OverlayCreateScreenResources; } #endif return TRUE; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fboverlay.h0000644000000000000000000000636113614532331017332 0ustar /* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifndef _FBOVERLAY_H_ #define _FBOVERLAY_H_ extern int fbOverlayGeneration; extern int fbOverlayScreenPrivateIndex; /* XXX should be static */ extern int fbOverlayGetScreenPrivateIndex(void); #ifndef FB_OVERLAY_MAX #define FB_OVERLAY_MAX 2 #endif typedef void (*fbOverlayPaintKeyProc) (DrawablePtr, RegionPtr, CARD32, int); typedef struct _fbOverlayLayer { union { struct { void * pbits; int width; int depth; } init; struct { PixmapPtr pixmap; RegionRec region; } run; } u; CARD32 key; /* special pixel value */ } FbOverlayLayer; typedef struct _fbOverlayScrPriv { int nlayers; fbOverlayPaintKeyProc PaintKey; fbCopyProc CopyWindow; FbOverlayLayer layer[FB_OVERLAY_MAX]; } FbOverlayScrPrivRec, *FbOverlayScrPrivPtr; #define fbOverlayGetScrPriv(s) \ ((fbOverlayGetScreenPrivateIndex() != -1) ? \ (s)->devPrivates[fbOverlayGetScreenPrivateIndex()].ptr : NULL) Bool fbOverlayCreateWindow(WindowPtr pWin); Bool fbOverlayCloseScreen (ScreenPtr pScreen); int fbOverlayWindowLayer(WindowPtr pWin); Bool fbOverlayCreateScreenResources(ScreenPtr pScreen); void fbOverlayPaintKey (DrawablePtr pDrawable, RegionPtr pRegion, CARD32 pixel, int layer); void fbOverlayUpdateLayerRegion (ScreenPtr pScreen, int layer, RegionPtr prgn); void fbOverlayCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); void fbOverlayWindowExposures (WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed); void fbOverlayPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what); Bool fbOverlaySetupScreen(ScreenPtr pScreen, void * pbits1, void * pbits2, int xsize, int ysize, int dpix, int dpiy, int width1, int width2, int bpp1, int bpp2); Bool fbOverlayFinishScreenInit(ScreenPtr pScreen, void * pbits1, void * pbits2, int xsize, int ysize, int dpix, int dpiy, int width1, int width2, int bpp1, int bpp2, int depth1, int depth2); #endif /* _FBOVERLAY_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbpict.c0000644000000000000000000006206213614532331016603 0ustar /* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "fb.h" #ifdef RENDER #include "picturestr.h" #include "mipict.h" #include "fbpict.h" typedef void (*CompositeFunc) (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); CARD32 fbOver (CARD32 x, CARD32 y) { CARD16 a = ~x >> 24; CARD16 t; CARD32 m,n,o,p; m = FbOverU(x,y,0,a,t); n = FbOverU(x,y,8,a,t); o = FbOverU(x,y,16,a,t); p = FbOverU(x,y,24,a,t); return m|n|o|p; } CARD32 fbOver24 (CARD32 x, CARD32 y) { CARD16 a = ~x >> 24; CARD16 t; CARD32 m,n,o; m = FbOverU(x,y,0,a,t); n = FbOverU(x,y,8,a,t); o = FbOverU(x,y,16,a,t); return m|n|o; } CARD32 fbIn (CARD32 x, CARD8 y) { CARD16 a = y; CARD16 t; CARD32 m,n,o,p; m = FbInU(x,0,a,t); n = FbInU(x,8,a,t); o = FbInU(x,16,a,t); p = FbInU(x,24,a,t); return m|n|o|p; } /* * Naming convention: * * opSRCxMASKxDST */ void fbCompositeSolidMask_nx8x8888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 src, srca; CARD32 *dstLine, *dst, d, dstMask; CARD8 *maskLine, *mask, m; FbStride dstStride, maskStride; CARD16 w; fbComposeGetSolid(pSrc, src, pDst->format); dstMask = FbFullMask (pDst->pDrawable->depth); srca = src >> 24; if (src == 0) return; fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; mask = maskLine; maskLine += maskStride; w = width; while (w--) { m = *mask++; if (m == 0xff) { if (srca == 0xff) *dst = src & dstMask; else *dst = fbOver (src, *dst) & dstMask; } else if (m) { d = fbIn (src, m); *dst = fbOver (d, *dst) & dstMask; } dst++; } } } void fbCompositeSolidMask_nx8888x8888C (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 src, srca; CARD32 *dstLine, *dst, d, dstMask; CARD32 *maskLine, *mask, ma; FbStride dstStride, maskStride; CARD16 w; CARD32 m, n, o, p; fbComposeGetSolid(pSrc, src, pDst->format); dstMask = FbFullMask (pDst->pDrawable->depth); srca = src >> 24; if (src == 0) return; fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; mask = maskLine; maskLine += maskStride; w = width; while (w--) { ma = *mask++; if (ma == 0xffffffff) { if (srca == 0xff) *dst = src & dstMask; else *dst = fbOver (src, *dst) & dstMask; } else if (ma) { d = *dst; #define FbInOverC(src,srca,msk,dst,i,result) { \ CARD16 __a = FbGet8(msk,i); \ CARD32 __t, __ta; \ CARD32 __i; \ __t = FbIntMult (FbGet8(src,i), __a,__i); \ __ta = (CARD8) ~FbIntMult (srca, __a,__i); \ __t = __t + FbIntMult(FbGet8(dst,i),__ta,__i); \ __t = (CARD32) (CARD8) (__t | (-(__t >> 8))); \ result = __t << (i); \ } FbInOverC (src, srca, ma, d, 0, m); FbInOverC (src, srca, ma, d, 8, n); FbInOverC (src, srca, ma, d, 16, o); FbInOverC (src, srca, ma, d, 24, p); *dst = m|n|o|p; } dst++; } } } void fbCompositeSolidMask_nx8x0888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 src, srca; CARD8 *dstLine, *dst; CARD32 d; CARD8 *maskLine, *mask, m; FbStride dstStride, maskStride; CARD16 w; fbComposeGetSolid(pSrc, src, pDst->format); srca = src >> 24; if (src == 0) return; fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; mask = maskLine; maskLine += maskStride; w = width; while (w--) { m = *mask++; if (m == 0xff) { if (srca == 0xff) d = src; else { d = Fetch24(dst); d = fbOver24 (src, d); } Store24(dst,d); } else if (m) { d = fbOver24 (fbIn(src,m), Fetch24(dst)); Store24(dst,d); } dst += 3; } } } void fbCompositeSolidMask_nx8x0565 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 src, srca; CARD16 *dstLine, *dst; CARD32 d; CARD8 *maskLine, *mask, m; FbStride dstStride, maskStride; CARD16 w; fbComposeGetSolid(pSrc, src, pDst->format); srca = src >> 24; if (src == 0) return; fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; mask = maskLine; maskLine += maskStride; w = width; while (w--) { m = *mask++; if (m == 0xff) { if (srca == 0xff) d = src; else { d = *dst; d = fbOver24 (src, cvt0565to8888(d)); } *dst = cvt8888to0565(d); } else if (m) { d = *dst; d = fbOver24 (fbIn(src,m), cvt0565to8888(d)); *dst = cvt8888to0565(d); } dst++; } } } void fbCompositeSolidMask_nx8888x0565C (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 src, srca; CARD16 src16; CARD16 *dstLine, *dst; CARD32 d; CARD32 *maskLine, *mask, ma; FbStride dstStride, maskStride; CARD16 w; CARD32 m, n, o; fbComposeGetSolid(pSrc, src, pDst->format); srca = src >> 24; if (src == 0) return; src16 = cvt8888to0565(src); fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; mask = maskLine; maskLine += maskStride; w = width; while (w--) { ma = *mask++; if (ma == 0xffffffff) { if (srca == 0xff) { *dst = src16; } else { d = *dst; d = fbOver24 (src, cvt0565to8888(d)); *dst = cvt8888to0565(d); } } else if (ma) { d = *dst; d = cvt0565to8888(d); FbInOverC (src, srca, ma, d, 0, m); FbInOverC (src, srca, ma, d, 8, n); FbInOverC (src, srca, ma, d, 16, o); d = m|n|o; *dst = cvt8888to0565(d); } dst++; } } } void fbCompositeSrc_8888x8888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 *dstLine, *dst, dstMask; CARD32 *srcLine, *src, s; FbStride dstStride, srcStride; CARD8 a; CARD16 w; fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); dstMask = FbFullMask (pDst->pDrawable->depth); while (height--) { dst = dstLine; dstLine += dstStride; src = srcLine; srcLine += srcStride; w = width; while (w--) { s = *src++; a = s >> 24; if (a == 0xff) *dst = s & dstMask; else if (a) *dst = fbOver (s, *dst) & dstMask; dst++; } } } void fbCompositeSrc_8888x0888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD8 *dstLine, *dst; CARD32 d; CARD32 *srcLine, *src, s; CARD8 a; FbStride dstStride, srcStride; CARD16 w; fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; src = srcLine; srcLine += srcStride; w = width; while (w--) { s = *src++; a = s >> 24; if (a) { if (a == 0xff) d = s; else d = fbOver24 (s, Fetch24(dst)); Store24(dst,d); } dst += 3; } } } void fbCompositeSrc_8888x0565 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD16 *dstLine, *dst; CARD32 d; CARD32 *srcLine, *src, s; CARD8 a; FbStride dstStride, srcStride; CARD16 w; fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; src = srcLine; srcLine += srcStride; w = width; while (w--) { s = *src++; a = s >> 24; if (a) { if (a == 0xff) d = s; else { d = *dst; d = fbOver24 (s, cvt0565to8888(d)); } *dst = cvt8888to0565(d); } dst++; } } } void fbCompositeSrc_0565x0565 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD16 *dstLine, *dst; CARD16 *srcLine, *src; FbStride dstStride, srcStride; CARD16 w; fbComposeGetStart (pSrc, xSrc, ySrc, CARD16, srcStride, srcLine, 1); fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; src = srcLine; srcLine += srcStride; w = width; while (w--) *dst++ = *src++; } } void fbCompositeSrcAdd_8000x8000 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD8 *dstLine, *dst; CARD8 *srcLine, *src; FbStride dstStride, srcStride; CARD16 w; CARD8 s, d; CARD16 t; fbComposeGetStart (pSrc, xSrc, ySrc, CARD8, srcStride, srcLine, 1); fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; src = srcLine; srcLine += srcStride; w = width; while (w--) { s = *src++; if (s) { if (s != 0xff) { d = *dst; t = d + s; s = t | (0 - (t >> 8)); } *dst = s; } dst++; } } } void fbCompositeSrcAdd_8888x8888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 *dstLine, *dst; CARD32 *srcLine, *src; FbStride dstStride, srcStride; CARD16 w; CARD32 s, d; CARD16 t; CARD32 m,n,o,p; fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; src = srcLine; srcLine += srcStride; w = width; while (w--) { s = *src++; if (s) { if (s != 0xffffffff) { d = *dst; if (d) { m = FbAdd(s,d,0,t); n = FbAdd(s,d,8,t); o = FbAdd(s,d,16,t); p = FbAdd(s,d,24,t); s = m|n|o|p; } } *dst = s; } dst++; } } } void fbCompositeSrcAdd_1000x1000 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { FbBits *dstBits, *srcBits; FbStride dstStride, srcStride; int dstBpp, srcBpp; int dstXoff, dstYoff; int srcXoff, srcYoff; fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff); fbGetDrawable(pDst->pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); fbBlt (srcBits + srcStride * (ySrc + srcYoff), srcStride, xSrc + srcXoff, dstBits + dstStride * (yDst + dstYoff), dstStride, xDst + dstXoff, width, height, GXor, FB_ALLONES, srcBpp, FALSE, FALSE); } void fbCompositeSolidMask_nx1xn (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { FbBits *dstBits; FbStip *maskBits; FbStride dstStride, maskStride; int dstBpp, maskBpp; int dstXoff, dstYoff; int maskXoff, maskYoff; FbBits src; fbComposeGetSolid(pSrc, src, pDst->format); if ((src & 0xff000000) != 0xff000000) { fbCompositeGeneral (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); return; } fbGetStipDrawable (pMask->pDrawable, maskBits, maskStride, maskBpp, maskXoff, maskYoff); fbGetDrawable (pDst->pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); switch (dstBpp) { case 32: break; case 24: break; case 16: src = cvt8888to0565(src); break; } src = fbReplicatePixel (src, dstBpp); fbBltOne (maskBits + maskStride * (yMask + maskYoff), maskStride, xMask + maskXoff, dstBits + dstStride * (yDst + dstYoff), dstStride, (xDst + dstXoff) * dstBpp, dstBpp, width * dstBpp, height, 0x0, src, FB_ALLONES, 0x0); } # define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) void fbComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { RegionRec region; int n; BoxPtr pbox; CompositeFunc func = NULL; Bool srcRepeat = pSrc->pDrawable && pSrc->repeat == RepeatNormal; Bool maskRepeat = FALSE; Bool srcAlphaMap = pSrc->alphaMap != 0; Bool maskAlphaMap = FALSE; Bool dstAlphaMap = pDst->alphaMap != 0; int x_msk, y_msk, x_src, y_src, x_dst, y_dst; int w, h, w_this, h_this; xDst += pDst->pDrawable->x; yDst += pDst->pDrawable->y; if (pSrc->pDrawable) { xSrc += pSrc->pDrawable->x; ySrc += pSrc->pDrawable->y; } if (pMask && pMask->pDrawable) { xMask += pMask->pDrawable->x; yMask += pMask->pDrawable->y; maskRepeat = pMask->repeat == RepeatNormal; maskAlphaMap = pMask->alphaMap != 0; } if (pSrc->pDrawable && (!pMask || pMask->pDrawable) && !pSrc->transform && !(pMask && pMask->transform) && !maskAlphaMap && !srcAlphaMap && !dstAlphaMap && (pSrc->filter != PictFilterConvolution) && (!pMask || pMask->filter != PictFilterConvolution)) switch (op) { case PictOpSrc: break; case PictOpOver: if (pMask) { if (srcRepeat && pSrc->pDrawable->width == 1 && pSrc->pDrawable->height == 1) { srcRepeat = FALSE; if (PICT_FORMAT_COLOR(pSrc->format)) { switch (pMask->format) { case PICT_a8: switch (pDst->format) { case PICT_r5g6b5: case PICT_b5g6r5: func = fbCompositeSolidMask_nx8x0565; break; case PICT_r8g8b8: case PICT_b8g8r8: func = fbCompositeSolidMask_nx8x0888; break; case PICT_a8r8g8b8: case PICT_x8r8g8b8: case PICT_a8b8g8r8: case PICT_x8b8g8r8: func = fbCompositeSolidMask_nx8x8888; break; } break; case PICT_a8r8g8b8: if (pMask->componentAlpha) { switch (pDst->format) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: func = fbCompositeSolidMask_nx8888x8888C; break; case PICT_r5g6b5: func = fbCompositeSolidMask_nx8888x0565C; break; } } break; case PICT_a8b8g8r8: if (pMask->componentAlpha) { switch (pDst->format) { case PICT_a8b8g8r8: case PICT_x8b8g8r8: func = fbCompositeSolidMask_nx8888x8888C; break; case PICT_b5g6r5: func = fbCompositeSolidMask_nx8888x0565C; break; } } break; case PICT_a1: switch (pDst->format) { case PICT_r5g6b5: case PICT_b5g6r5: case PICT_r8g8b8: case PICT_b8g8r8: case PICT_a8r8g8b8: case PICT_x8r8g8b8: case PICT_a8b8g8r8: case PICT_x8b8g8r8: func = fbCompositeSolidMask_nx1xn; break; } break; } } } else /* has mask and non-repeating source */ { if (pSrc->pDrawable == pMask->pDrawable && xSrc == xMask && ySrc == yMask && !pMask->componentAlpha) { /* source == mask: non-premultiplied data */ switch (pSrc->format) { case PICT_x8b8g8r8: switch (pMask->format) { case PICT_a8r8g8b8: case PICT_a8b8g8r8: switch (pDst->format) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: break; case PICT_r5g6b5: break; } break; } break; case PICT_x8r8g8b8: switch (pMask->format) { case PICT_a8r8g8b8: case PICT_a8b8g8r8: switch (pDst->format) { case PICT_a8b8g8r8: case PICT_x8b8g8r8: break; case PICT_r5g6b5: break; } break; } break; } break; } else { /* non-repeating source, repeating mask => translucent window */ if (maskRepeat && pMask->pDrawable->width == 1 && pMask->pDrawable->height == 1) { if (pSrc->format == PICT_x8r8g8b8 && pDst->format == PICT_x8r8g8b8 && pMask->format == PICT_a8) { } } } } } else /* no mask */ { if (srcRepeat && pSrc->pDrawable->width == 1 && pSrc->pDrawable->height == 1) { /* no mask and repeating source */ switch (pSrc->format) { case PICT_a8r8g8b8: switch (pDst->format) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: break; case PICT_r5g6b5: break; } break; } } else { switch (pSrc->format) { case PICT_a8r8g8b8: switch (pDst->format) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: func = fbCompositeSrc_8888x8888; break; case PICT_r8g8b8: func = fbCompositeSrc_8888x0888; break; case PICT_r5g6b5: func = fbCompositeSrc_8888x0565; break; } break; case PICT_x8r8g8b8: switch (pDst->format) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: break; } case PICT_x8b8g8r8: switch (pDst->format) { case PICT_a8b8g8r8: case PICT_x8b8g8r8: break; } break; case PICT_a8b8g8r8: switch (pDst->format) { case PICT_a8b8g8r8: case PICT_x8b8g8r8: func = fbCompositeSrc_8888x8888; break; case PICT_b8g8r8: func = fbCompositeSrc_8888x0888; break; case PICT_b5g6r5: func = fbCompositeSrc_8888x0565; break; } break; case PICT_r5g6b5: switch (pDst->format) { case PICT_r5g6b5: func = fbCompositeSrc_0565x0565; break; } break; case PICT_b5g6r5: switch (pDst->format) { case PICT_b5g6r5: func = fbCompositeSrc_0565x0565; break; } break; } } } break; case PictOpAdd: if (pMask == 0) { switch (pSrc->format) { case PICT_a8r8g8b8: switch (pDst->format) { case PICT_a8r8g8b8: func = fbCompositeSrcAdd_8888x8888; break; } break; case PICT_a8b8g8r8: switch (pDst->format) { case PICT_a8b8g8r8: func = fbCompositeSrcAdd_8888x8888; break; } break; case PICT_a8: switch (pDst->format) { case PICT_a8: func = fbCompositeSrcAdd_8000x8000; break; } break; case PICT_a1: switch (pDst->format) { case PICT_a1: func = fbCompositeSrcAdd_1000x1000; break; } break; } } break; } if (!func) { /* no fast path, use the general code */ fbCompositeGeneral(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); return; } if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height)) return; n = RegionNumRects (®ion); pbox = RegionRects (®ion); while (n--) { h = pbox->y2 - pbox->y1; y_src = pbox->y1 - yDst + ySrc; y_msk = pbox->y1 - yDst + yMask; y_dst = pbox->y1; while (h) { h_this = h; w = pbox->x2 - pbox->x1; x_src = pbox->x1 - xDst + xSrc; x_msk = pbox->x1 - xDst + xMask; x_dst = pbox->x1; if (maskRepeat) { y_msk = mod (y_msk - pMask->pDrawable->y, pMask->pDrawable->height); if (h_this > pMask->pDrawable->height - y_msk) h_this = pMask->pDrawable->height - y_msk; y_msk += pMask->pDrawable->y; } if (srcRepeat) { y_src = mod (y_src - pSrc->pDrawable->y, pSrc->pDrawable->height); if (h_this > pSrc->pDrawable->height - y_src) h_this = pSrc->pDrawable->height - y_src; y_src += pSrc->pDrawable->y; } while (w) { w_this = w; if (maskRepeat) { x_msk = mod (x_msk - pMask->pDrawable->x, pMask->pDrawable->width); if (w_this > pMask->pDrawable->width - x_msk) w_this = pMask->pDrawable->width - x_msk; x_msk += pMask->pDrawable->x; } if (srcRepeat) { x_src = mod (x_src - pSrc->pDrawable->x, pSrc->pDrawable->width); if (w_this > pSrc->pDrawable->width - x_src) w_this = pSrc->pDrawable->width - x_src; x_src += pSrc->pDrawable->x; } (*func) (op, pSrc, pMask, pDst, x_src, y_src, x_msk, y_msk, x_dst, y_dst, w_this, h_this); w -= w_this; x_src += w_this; x_msk += w_this; x_dst += w_this; } h -= h_this; y_src += h_this; y_msk += h_this; y_dst += h_this; } pbox++; } RegionUninit(®ion); } #endif /* RENDER */ Bool fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) { #ifdef RENDER PictureScreenPtr ps; if (!miPictureInit (pScreen, formats, nformats)) return FALSE; ps = GetPictureScreen(pScreen); ps->Composite = fbComposite; ps->Glyphs = miGlyphs; ps->CompositeRects = miCompositeRects; ps->RasterizeTrapezoid = fbRasterizeTrapezoid; ps->AddTraps = fbAddTraps; ps->AddTriangles = fbAddTriangles; #endif /* RENDER */ return TRUE; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbpict.h0000644000000000000000000005142713614532331016613 0ustar /* * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _FBPICT_H_ #define _FBPICT_H_ #include "renderedge.h" #define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) ) #define FbIntDiv(a,b) (((CARD16) (a) * 255) / (b)) #define FbGet8(v,i) ((CARD16) (CARD8) ((v) >> i)) /* * There are two ways of handling alpha -- either as a single unified value or * a separate value for each component, hence each macro must have two * versions. The unified alpha version has a 'U' at the end of the name, * the component version has a 'C'. Similarly, functions which deal with * this difference will have two versions using the same convention. */ #define FbOverU(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),(a),(t)) + FbGet8(x,i),\ (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) #define FbOverC(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),FbGet8(a,i),(t)) + FbGet8(x,i),\ (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) #define FbInU(x,i,a,t) ((CARD32) FbIntMult(FbGet8(x,i),(a),(t)) << (i)) #define FbInC(x,i,a,t) ((CARD32) FbIntMult(FbGet8(x,i),FbGet8(a,i),(t)) << (i)) #define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (FbIntMult(FbGet8(y,i),ay,(u)) + \ FbIntMult(FbGet8(x,i),ax,(v))),\ (CARD32) ((CARD8) ((t) | \ (0 - ((t) >> 8)))) << (i)) #define FbAdd(x,y,i,t) ((t) = FbGet8(x,i) + FbGet8(y,i), \ (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) #define Alpha(x) ((x) >> 24) #define Red(x) (((x) >> 16) & 0xff) #define Green(x) (((x) >> 8) & 0xff) #define Blue(x) ((x) & 0xff) #define fbComposeGetSolid(pict, bits, fmt) { \ FbBits *__bits__; \ FbStride __stride__; \ int __bpp__; \ _X_UNUSED int __xoff__,__yoff__; \ \ fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ switch (__bpp__) { \ case 32: \ (bits) = *(CARD32 *) __bits__; \ break; \ case 24: \ (bits) = Fetch24 ((CARD8 *) __bits__); \ break; \ case 16: \ (bits) = *(CARD16 *) __bits__; \ (bits) = cvt0565to8888(bits); \ break; \ default: \ return; \ } \ /* If necessary, convert RGB <--> BGR. */ \ if (PICT_FORMAT_TYPE((pict)->format) != PICT_FORMAT_TYPE(fmt)) \ { \ (bits) = (((bits) & 0xff000000) | \ (((bits) & 0x00ff0000) >> 16) | \ (((bits) & 0x0000ff00) >> 0) | \ (((bits) & 0x000000ff) << 16)); \ } \ /* manage missing src alpha */ \ if ((pict)->pFormat->direct.alphaMask == 0) \ (bits) |= 0xff000000; \ } #define fbComposeGetStart(pict,x,y,type,stride,line,mul) {\ FbBits *__bits__; \ FbStride __stride__; \ int __bpp__; \ int __xoff__,__yoff__; \ \ fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ (stride) = __stride__ * sizeof (FbBits) / sizeof (type); \ (line) = ((type *) __bits__) + (stride) * ((y) + __yoff__) + (mul) * ((x) + __xoff__); \ } #define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \ (((s) >> 5) & 0x07e0) | \ (((s) >> 8) & 0xf800)) #define cvt0565to8888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \ ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \ ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000))) #if IMAGE_BYTE_ORDER == MSBFirst #define Fetch24(a) ((unsigned long) (a) & 1 ? \ ((*(a) << 16) | *((CARD16 *) ((a)+1))) : \ ((*((CARD16 *) (a)) << 8) | *((a)+2))) #define Store24(a,v) ((unsigned long) (a) & 1 ? \ ((*(a) = (CARD8) ((v) >> 16)), \ (*((CARD16 *) ((a)+1)) = (CARD16) (v))) : \ ((*((CARD16 *) (a)) = (CARD16) ((v) >> 8)), \ (*((a)+2) = (CARD8) (v)))) #else #define Fetch24(a) ((unsigned long) (a) & 1 ? \ ((*(a)) | (*((CARD16 *) ((a)+1)) << 8)) : \ ((*((CARD16 *) (a))) | (*((a)+2) << 16))) #define Store24(a,v) ((unsigned long) (a) & 1 ? \ ((*(a) = (CARD8) (v)), \ (*((CARD16 *) ((a)+1)) = (CARD16) ((v) >> 8))) : \ ((*((CARD16 *) (a)) = (CARD16) (v)),\ (*((a)+2) = (CARD8) ((v) >> 16)))) #endif /* The methods below use some tricks to be able to do two color components at the same time. */ /* x_c = (x_c * a) / 255 */ #define FbByteMul(x, a) do { \ CARD32 t = ((x & 0xff00ff) * a) + 0x800080; \ t = (t + ((t >> 8) & 0xff00ff)) >> 8; \ t &= 0xff00ff; \ \ x = (((x >> 8) & 0xff00ff) * a) + 0x800080; \ x = (x + ((x >> 8) & 0xff00ff)); \ x &= 0xff00ff00; \ x += t; \ } while (0) /* x_c = (x_c * a) / 255 + y */ #define FbByteMulAdd(x, a, y) do { \ CARD32 t = ((x & 0xff00ff) * a) + 0x800080; \ t = (t + ((t >> 8) & 0xff00ff)) >> 8; \ t &= 0xff00ff; \ t += y & 0xff00ff; \ t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ t &= 0xff00ff; \ \ x = (((x >> 8) & 0xff00ff) * a) + 0x800080; \ x = (x + ((x >> 8) & 0xff00ff)) >> 8; \ x &= 0xff00ff; \ x += (y >> 8) & 0xff00ff; \ x |= 0x1000100 - ((x >> 8) & 0xff00ff); \ x &= 0xff00ff; \ x <<= 8; \ x += t; \ } while (0) /* x_c = (x_c * a + y_c * b) / 255 */ #define FbByteAddMul(x, a, y, b) do { \ CARD32 t; \ CARD32 r = (x >> 24) * a + (y >> 24) * b + 0x80; \ r += (r >> 8); \ r >>= 8; \ \ t = (x & 0xff00) * a + (y & 0xff00) * b; \ t += (t >> 8) + 0x8000; \ t >>= 16; \ \ t |= r << 16; \ t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ t &= 0xff00ff; \ t <<= 8; \ \ r = ((x >> 16) & 0xff) * a + ((y >> 16) & 0xff) * b + 0x80; \ r += (r >> 8); \ r >>= 8; \ \ x = (x & 0xff) * a + (y & 0xff) * b + 0x80; \ x += (x >> 8); \ x >>= 8; \ x |= r << 16; \ x |= 0x1000100 - ((x >> 8) & 0xff00ff); \ x &= 0xff00ff; \ x |= t; \ } while (0) /* x_c = (x_c * a + y_c *b) / 256 */ #define FbByteAddMul_256(x, a, y, b) do { \ CARD32 t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; \ t >>= 8; \ t &= 0xff00ff; \ \ x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; \ x &= 0xff00ff00; \ x += t; \ } while (0) /* x_c = (x_c * a_c) / 255 */ #define FbByteMulC(x, a) do { \ CARD32 t; \ CARD32 r = (x & 0xff) * (a & 0xff); \ r |= (x & 0xff0000) * ((a >> 16) & 0xff); \ r += 0x800080; \ r = (r + ((r >> 8) & 0xff00ff)) >> 8; \ r &= 0xff00ff; \ \ x >>= 8; \ t = (x & 0xff) * ((a >> 8) & 0xff); \ t |= (x & 0xff0000) * (a >> 24); \ t += 0x800080; \ t = t + ((t >> 8) & 0xff00ff); \ x = r | (t & 0xff00ff00); \ \ } while (0) /* x_c = (x_c * a) / 255 + y */ #define FbByteMulAddC(x, a, y) do { \ CARD32 t; \ CARD32 r = (x & 0xff) * (a & 0xff); \ r |= (x & 0xff0000) * ((a >> 16) & 0xff); \ r += 0x800080; \ r = (r + ((r >> 8) & 0xff00ff)) >> 8; \ r &= 0xff00ff; \ r += y & 0xff00ff; \ r |= 0x1000100 - ((r >> 8) & 0xff00ff); \ r &= 0xff00ff; \ \ x >>= 8; \ t = (x & 0xff) * ((a >> 8) & 0xff); \ t |= (x & 0xff0000) * (a >> 24); \ t += 0x800080; \ t = (t + ((t >> 8) & 0xff00ff)) >> 8; \ t &= 0xff00ff; \ t += (y >> 8) & 0xff00ff; \ t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ t &= 0xff00ff; \ x = r | (t << 8); \ } while (0) /* x_c = (x_c * a_c + y_c * b) / 255 */ #define FbByteAddMulC(x, a, y, b) do { \ CARD32 t; \ CARD32 r = (x >> 24) * (a >> 24) + (y >> 24) * b; \ r += (r >> 8) + 0x80; \ r >>= 8; \ \ t = (x & 0xff00) * ((a >> 8) & 0xff) + (y & 0xff00) * b; \ t += (t >> 8) + 0x8000; \ t >>= 16; \ \ t |= r << 16; \ t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ t &= 0xff00ff; \ t <<= 8; \ \ r = ((x >> 16) & 0xff) * ((a >> 16) & 0xff) + ((y >> 16) & 0xff) * b + 0x80; \ r += (r >> 8); \ r >>= 8; \ \ x = (x & 0xff) * (a & 0xff) + (y & 0xff) * b + 0x80; \ x += (x >> 8); \ x >>= 8; \ x |= r << 16; \ x |= 0x1000100 - ((x >> 8) & 0xff00ff); \ x &= 0xff00ff; \ x |= t; \ } while (0) /* x_c = min(x_c + y_c, 255) */ #define FbByteAdd(x, y) do { \ CARD32 t; \ CARD32 r = (x & 0xff00ff) + (y & 0xff00ff); \ r |= 0x1000100 - ((r >> 8) & 0xff00ff); \ r &= 0xff00ff; \ \ t = ((x >> 8) & 0xff00ff) + ((y >> 8) & 0xff00ff); \ t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ r |= (t & 0xff00ff) << 8; \ x = r; \ } while (0) #define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8) #if defined(__i386__) && defined(__GNUC__) #define FASTCALL __attribute__((regparm(3))) #else #define FASTCALL #endif #if defined(__GNUC__) #define INLINE __inline__ #else #define INLINE #endif typedef struct _FbComposeData { CARD8 op; PicturePtr src; PicturePtr mask; PicturePtr dest; INT16 xSrc; INT16 ySrc; INT16 xMask; INT16 yMask; INT16 xDest; INT16 yDest; CARD16 width; CARD16 height; } FbComposeData; typedef FASTCALL void (*CombineMaskU) (CARD32 *src, const CARD32 *mask, int width); typedef FASTCALL void (*CombineFuncU) (CARD32 *dest, const CARD32 *src, int width); typedef FASTCALL void (*CombineFuncC) (CARD32 *dest, CARD32 *src, CARD32 *mask, int width); typedef struct _FbComposeFunctions { CombineFuncU *combineU; CombineFuncC *combineC; CombineMaskU combineMaskU; } FbComposeFunctions; /* fbcompose.c */ void fbCompositeGeneral (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); /* fbedge.c */ void fbRasterizeEdges (FbBits *buf, int bpp, int width, int stride, RenderEdge *l, RenderEdge *r, xFixed t, xFixed b); /* fbpict.c */ CARD32 fbOver (CARD32 x, CARD32 y); CARD32 fbOver24 (CARD32 x, CARD32 y); CARD32 fbIn (CARD32 x, CARD8 y); void fbCompositeSolidMask_nx8x8888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void fbCompositeSolidMask_nx8x0888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void fbCompositeSolidMask_nx8888x8888C (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void fbCompositeSolidMask_nx8x0565 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void fbCompositeSolidMask_nx8888x0565C (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void fbCompositeSrc_8888x8888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void fbCompositeSrc_8888x0888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void fbCompositeSrc_8888x0565 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void fbCompositeSrc_0565x0565 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void fbCompositeSrcAdd_8000x8000 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void fbCompositeSrcAdd_8888x8888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void fbCompositeSrcAdd_1000x1000 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void fbCompositeSolidMask_nx1xn (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void fbComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); /* fbtrap.c */ void fbAddTraps (PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntrap, xTrap *traps); void fbRasterizeTrapezoid (PicturePtr alpha, xTrapezoid *trap, int x_off, int y_off); void fbAddTriangles (PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntri, xTriangle *tris); #endif /* _FBPICT_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbpixmap.c0000644000000000000000000002311713614532331017140 0ustar /* * Id: fbpixmap.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "fb.h" PixmapPtr fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp, unsigned usage_hint) { PixmapPtr pPixmap; size_t datasize; size_t paddedWidth; int adjust; int base; paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits); if (paddedWidth / 4 > 32767 || height > 32767) return NullPixmap; datasize = height * paddedWidth; #ifdef PIXPRIV base = pScreen->totalPixmapSize; #else base = sizeof (PixmapRec); #endif adjust = 0; if (base & 7) adjust = 8 - (base & 7); datasize += adjust; #ifdef FB_DEBUG datasize += 2 * paddedWidth; #endif pPixmap = AllocatePixmap(pScreen, datasize); if (!pPixmap) return NullPixmap; pPixmap->drawable.type = DRAWABLE_PIXMAP; pPixmap->drawable.class = 0; pPixmap->drawable.pScreen = pScreen; pPixmap->drawable.depth = depth; pPixmap->drawable.bitsPerPixel = bpp; pPixmap->drawable.id = 0; pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pPixmap->drawable.x = 0; pPixmap->drawable.y = 0; pPixmap->drawable.width = width; pPixmap->drawable.height = height; pPixmap->devKind = paddedWidth; pPixmap->refcnt = 1; pPixmap->devPrivate.ptr = (void *) ((char *)pPixmap + base + adjust); #ifdef FB_DEBUG pPixmap->devPrivate.ptr = (void *) ((char *) pPixmap->devPrivate.ptr + paddedWidth); fbInitializeDrawable (&pPixmap->drawable); #endif #ifdef COMPOSITE pPixmap->screen_x = 0; pPixmap->screen_y = 0; #endif pPixmap->usage_hint = usage_hint; return pPixmap; } PixmapPtr fbCreatePixmap (ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint) { int bpp; bpp = BitsPerPixel (depth); #ifdef FB_SCREEN_PRIVATE if (bpp == 32 && depth <= 24) bpp = fbGetScreenPrivate(pScreen)->pix32bpp; #endif return fbCreatePixmapBpp (pScreen, width, height, depth, bpp, usage_hint); } Bool fbDestroyPixmap (PixmapPtr pPixmap) { if(--pPixmap->refcnt) return TRUE; free(pPixmap); return TRUE; } #define ADDRECT(reg,r,fr,rx1,ry1,rx2,ry2) \ if (((rx1) < (rx2)) && ((ry1) < (ry2)) && \ (!((reg)->data->numRects && \ ((r-1)->y1 == (ry1)) && \ ((r-1)->y2 == (ry2)) && \ ((r-1)->x1 <= (rx1)) && \ ((r-1)->x2 >= (rx2))))) \ { \ if ((reg)->data->numRects == (reg)->data->size) \ { \ RegionRectAlloc(reg, 1); \ fr = RegionBoxptr(reg); \ r = fr + (reg)->data->numRects; \ } \ r->x1 = (rx1); \ r->y1 = (ry1); \ r->x2 = (rx2); \ r->y2 = (ry2); \ (reg)->data->numRects++; \ if(r->x1 < (reg)->extents.x1) \ (reg)->extents.x1 = r->x1; \ if(r->x2 > (reg)->extents.x2) \ (reg)->extents.x2 = r->x2; \ r++; \ } /* Convert bitmap clip mask into clipping region. * First, goes through each line and makes boxes by noting the transitions * from 0 to 1 and 1 to 0. * Then it coalesces the current line with the previous if they have boxes * at the same X coordinates. */ RegionPtr fbPixmapToRegion(PixmapPtr pPix) { register RegionPtr pReg; FbBits *pw, w; register int ib; int width, h, base, rx1 = 0, crects; FbBits *pwLineEnd; int irectPrevStart, irectLineStart; register BoxPtr prectO, prectN; BoxPtr FirstRect, rects, prectLineStart; Bool fInBox, fSame; register FbBits mask0 = FB_ALLONES & ~FbScrRight(FB_ALLONES, 1); FbBits *pwLine; int nWidth; pReg = RegionCreate(NULL, 1); if(!pReg) return NullRegion; FirstRect = RegionBoxptr(pReg); rects = FirstRect; pwLine = (FbBits *) pPix->devPrivate.ptr; nWidth = pPix->devKind >> (FB_SHIFT-3); width = pPix->drawable.width; pReg->extents.x1 = width - 1; pReg->extents.x2 = 0; irectPrevStart = -1; for(h = 0; h < pPix->drawable.height; h++) { pw = pwLine; pwLine += nWidth; irectLineStart = rects - FirstRect; /* If the Screen left most bit of the word is set, we're starting in * a box */ if(*pw & mask0) { fInBox = TRUE; rx1 = 0; } else fInBox = FALSE; /* Process all words which are fully in the pixmap */ pwLineEnd = pw + (width >> FB_SHIFT); for (base = 0; pw < pwLineEnd; base += FB_UNIT) { w = *pw++; if (fInBox) { if (!~w) continue; } else { if (!w) continue; } for(ib = 0; ib < FB_UNIT; ib++) { /* If the Screen left most bit of the word is set, we're * starting a box */ if(w & mask0) { if(!fInBox) { rx1 = base + ib; /* start new box */ fInBox = TRUE; } } else { if(fInBox) { /* end box */ ADDRECT(pReg, rects, FirstRect, rx1, h, base + ib, h + 1); fInBox = FALSE; } } /* Shift the word VISUALLY left one. */ w = FbScrLeft(w, 1); } } if(width & FB_MASK) { /* Process final partial word on line */ w = *pw++; for(ib = 0; ib < (width & FB_MASK); ib++) { /* If the Screen left most bit of the word is set, we're * starting a box */ if(w & mask0) { if(!fInBox) { rx1 = base + ib; /* start new box */ fInBox = TRUE; } } else { if(fInBox) { /* end box */ ADDRECT(pReg, rects, FirstRect, rx1, h, base + ib, h + 1); fInBox = FALSE; } } /* Shift the word VISUALLY left one. */ w = FbScrLeft(w, 1); } } /* If scanline ended with last bit set, end the box */ if(fInBox) { ADDRECT(pReg, rects, FirstRect, rx1, h, base + (width & FB_MASK), h + 1); } /* if all rectangles on this line have the same x-coords as * those on the previous line, then add 1 to all the previous y2s and * throw away all the rectangles from this line */ fSame = FALSE; if(irectPrevStart != -1) { crects = irectLineStart - irectPrevStart; if(crects == ((rects - FirstRect) - irectLineStart)) { prectO = FirstRect + irectPrevStart; prectN = prectLineStart = FirstRect + irectLineStart; fSame = TRUE; while(prectO < prectLineStart) { if((prectO->x1 != prectN->x1) || (prectO->x2 != prectN->x2)) { fSame = FALSE; break; } prectO++; prectN++; } if (fSame) { prectO = FirstRect + irectPrevStart; while(prectO < prectLineStart) { prectO->y2 += 1; prectO++; } rects -= crects; pReg->data->numRects -= crects; } } } if(!fSame) irectPrevStart = irectLineStart; } if (!pReg->data->numRects) pReg->extents.x1 = pReg->extents.x2 = 0; else { pReg->extents.y1 = RegionBoxptr(pReg)->y1; pReg->extents.y2 = RegionEnd(pReg)->y2; if (pReg->data->numRects == 1) { free(pReg->data); pReg->data = (RegDataPtr)NULL; } } #ifdef DEBUG if (!RegionIsValid(pReg)) FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__); #endif return(pReg); } #ifdef FB_DEBUG #ifndef WIN32 #include #else #include #endif static Bool fbValidateBits (FbStip *bits, int stride, FbStip data) { while (stride--) { if (*bits != data) { #ifdef WIN32 NCD_DEBUG ((DEBUG_FAILURE, "fdValidateBits failed at 0x%x (is 0x%x want 0x%x)", bits, *bits, data)); #else fprintf (stderr, "fbValidateBits failed\n"); #endif return FALSE; } bits++; } } void fbValidateDrawable (DrawablePtr pDrawable) { FbStip *bits, *first, *last; int stride, bpp; int xoff, yoff; int height; Bool failed; if (pDrawable->type != DRAWABLE_PIXMAP) pDrawable = (DrawablePtr) fbGetWindowPixmap(pDrawable); fbGetStipDrawable(pDrawable, bits, stride, bpp, xoff, yoff); first = bits - stride; last = bits + stride * pDrawable->height; if (!fbValidateBits (first, stride, FB_HEAD_BITS) || !fbValidateBits (last, stride, FB_TAIL_BITS)) fbInitializeDrawable(pDrawable); } void fbSetBits (FbStip *bits, int stride, FbStip data) { while (stride--) *bits++ = data; } void fbInitializeDrawable (DrawablePtr pDrawable) { FbStip *bits, *first, *last; int stride, bpp; int xoff, yoff; fbGetStipDrawable(pDrawable, bits, stride, bpp, xoff, yoff); first = bits - stride; last = bits + stride * pDrawable->height; fbSetBits (first, stride, FB_HEAD_BITS); fbSetBits (last, stride, FB_TAIL_BITS); } #endif /* FB_DEBUG */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbpoint.c0000644000000000000000000001003013614532331016761 0ustar /* * Id: fbpoint.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" typedef void (*FbDots) (FbBits *dst, FbStride dstStride, int dstBpp, BoxPtr pBox, xPoint *pts, int npt, int xorg, int yorg, int xoff, int yoff, FbBits and, FbBits xor); void fbDots (FbBits *dstOrig, FbStride dstStride, int dstBpp, BoxPtr pBox, xPoint *pts, int npt, int xorg, int yorg, int xoff, int yoff, FbBits andOrig, FbBits xorOrig) { FbStip *dst = (FbStip *) dstOrig; int x1, y1, x2, y2; int x, y; FbStip *d; FbStip and = andOrig; FbStip xor = xorOrig; dstStride = FbBitsStrideToStipStride (dstStride); x1 = pBox->x1; y1 = pBox->y1; x2 = pBox->x2; y2 = pBox->y2; while (npt--) { x = pts->x + xorg; y = pts->y + yorg; pts++; if (x1 <= x && x < x2 && y1 <= y && y < y2) { x = (x + xoff) * dstBpp; d = dst + ((y + yoff) * dstStride) + (x >> FB_STIP_SHIFT); x &= FB_STIP_MASK; #ifdef FB_24BIT if (dstBpp == 24) { FbStip leftMask, rightMask; int n, rot; FbStip andT, xorT; rot = FbFirst24Rot (x); andT = FbRot24Stip(and,rot); xorT = FbRot24Stip(xor,rot); FbMaskStip (x, 24, leftMask, n, rightMask); if (leftMask) { *d = FbDoMaskRRop (*d, andT, xorT, leftMask); andT = FbNext24Stip(andT); xorT = FbNext24Stip(xorT); d++; } if (rightMask) *d = FbDoMaskRRop(*d, andT, xorT, rightMask); } else #endif { FbStip mask; mask = FbStipMask(x, dstBpp); *d = FbDoMaskRRop (*d, and, xor, mask); } } } } void fbPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int nptInit, xPoint *pptInit) { FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); RegionPtr pClip = fbGetCompositeClip(pGC); FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbDots dots; FbBits and, xor; xPoint *ppt; int npt; BoxPtr pBox; int nBox; /* make pointlist origin relative */ ppt = pptInit; npt = nptInit; if (mode == CoordModePrevious) { npt--; while(npt--) { ppt++; ppt->x += (ppt-1)->x; ppt->y += (ppt-1)->y; } } fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); and = pPriv->and; xor = pPriv->xor; dots = fbDots; #ifndef FBNOPIXADDR switch (dstBpp) { case 8: dots = fbDots8; break; case 16: dots = fbDots16; break; #ifdef FB_24BIT case 24: dots = fbDots24; break; #endif case 32: dots = fbDots32; break; } #endif for (nBox = RegionNumRects (pClip), pBox = RegionRects (pClip); nBox--; pBox++) (*dots) (dst, dstStride, dstBpp, pBox, pptInit, nptInit, pDrawable->x, pDrawable->y, dstXoff, dstYoff, and, xor); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbpush.c0000644000000000000000000001201713614532331016616 0ustar /* * Id: fbpush.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" void fbPushPattern (DrawablePtr pDrawable, GCPtr pGC, FbStip *src, FbStride srcStride, int srcX, int x, int y, int width, int height) { FbStip *s, bitsMask, bitsMask0, bits; int xspan; int w; int lenspan; src += srcX >> FB_STIP_SHIFT; srcX &= FB_STIP_MASK; bitsMask0 = FbStipMask (srcX, 1); while (height--) { bitsMask = bitsMask0; w = width; s = src; src += srcStride; bits = *s++; xspan = x; while (w) { if (bits & bitsMask) { lenspan = 0; do { lenspan++; if (lenspan == w) break; bitsMask = FbStipRight (bitsMask, 1); if (!bitsMask) { bits = *s++; bitsMask = FbBitsMask(0,1); } } while (bits & bitsMask); fbFill (pDrawable, pGC, xspan, y, lenspan, 1); xspan += lenspan; w -= lenspan; } else { do { w--; xspan++; if (!w) break; bitsMask = FbStipRight (bitsMask, 1); if (!bitsMask) { bits = *s++; bitsMask = FbBitsMask(0,1); } } while (!(bits & bitsMask)); } } y++; } } void fbPushFill (DrawablePtr pDrawable, GCPtr pGC, FbStip *src, FbStride srcStride, int srcX, int x, int y, int width, int height) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); if (pGC->fillStyle == FillSolid) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; int dstX; int dstWidth; fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); dst = dst + (y + dstYoff) * dstStride; dstX = (x + dstXoff) * dstBpp; dstWidth = width * dstBpp; if (dstBpp == 1) { fbBltStip (src, srcStride, srcX, (FbStip *) dst, FbBitsStrideToStipStride (dstStride), dstX, dstWidth, height, FbStipple1Rop(pGC->alu,pGC->fgPixel), pPriv->pm, dstBpp); } else { fbBltOne (src, srcStride, srcX, dst, dstStride, dstX, dstBpp, dstWidth, height, pPriv->and, pPriv->xor, fbAnd(GXnoop,(FbBits) 0,FB_ALLONES), fbXor(GXnoop,(FbBits) 0,FB_ALLONES)); } } else { fbPushPattern (pDrawable, pGC, src, srcStride, srcX, x, y, width, height); } } void fbPushImage (DrawablePtr pDrawable, GCPtr pGC, FbStip *src, FbStride srcStride, int srcX, int x, int y, int width, int height) { RegionPtr pClip = fbGetCompositeClip (pGC); int nbox; BoxPtr pbox; int x1, y1, x2, y2; for (nbox = RegionNumRects (pClip), pbox = RegionRects(pClip); nbox--; pbox++) { x1 = x; y1 = y; x2 = x + width; y2 = y + height; if (x1 < pbox->x1) x1 = pbox->x1; if (y1 < pbox->y1) y1 = pbox->y1; if (x2 > pbox->x2) x2 = pbox->x2; if (y2 > pbox->y2) y2 = pbox->y2; if (x1 >= x2 || y1 >= y2) continue; fbPushFill (pDrawable, pGC, src + (y1 - y) * srcStride, srcStride, srcX + (x1 - x), x1, y1, x2 - x1, y2 - y1); } } void fbPushPixels (GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg) { FbStip *stip; FbStride stipStride; int stipBpp; _X_UNUSED int stipXoff, stipYoff; /* Assumed to be zero */ fbGetStipDrawable (&pBitmap->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff); fbPushImage (pDrawable, pGC, stip, stipStride, 0, xOrg, yOrg, dx, dy); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbrop.h0000644000000000000000000001144413614532331016447 0ustar /* * Id: fbrop.h,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _FBROP_H_ #define _FBROP_H_ typedef struct _mergeRopBits { FbBits ca1, cx1, ca2, cx2; } FbMergeRopRec, *FbMergeRopPtr; extern const FbMergeRopRec FbMergeRopBits[16]; #define FbDeclareMergeRop() FbBits _ca1, _cx1, _ca2, _cx2; #define FbDeclarePrebuiltMergeRop() FbBits _cca, _ccx; #define FbInitializeMergeRop(alu,pm) {\ const FbMergeRopRec *_bits; \ _bits = &FbMergeRopBits[alu]; \ _ca1 = _bits->ca1 & pm; \ _cx1 = _bits->cx1 | ~pm; \ _ca2 = _bits->ca2 & pm; \ _cx2 = _bits->cx2 & pm; \ } #define FbDestInvarientRop(alu,pm) ((pm) == FB_ALLONES && \ (((alu) >> 1 & 5) == ((alu) & 5))) #define FbDestInvarientMergeRop() (_ca1 == 0 && _cx1 == 0) /* AND has higher precedence than XOR */ #define FbDoMergeRop(src, dst) \ (((dst) & (((src) & _ca1) ^ _cx1)) ^ (((src) & _ca2) ^ _cx2)) #define FbDoDestInvarientMergeRop(src) (((src) & _ca2) ^ _cx2) #define FbDoMaskMergeRop(src, dst, mask) \ (((dst) & ((((src) & _ca1) ^ _cx1) | ~(mask))) ^ ((((src) & _ca2) ^ _cx2) & (mask))) #define FbDoLeftMaskByteMergeRop(dst, src, lb, l) { \ FbBits __xor = ((src) & _ca2) ^ _cx2; \ FbDoLeftMaskByteRRop(dst,lb,l,((src) & _ca1) ^ _cx1,__xor); \ } #define FbDoRightMaskByteMergeRop(dst, src, rb, r) { \ FbBits __xor = ((src) & _ca2) ^ _cx2; \ FbDoRightMaskByteRRop(dst,rb,r,((src) & _ca1) ^ _cx1,__xor); \ } #define FbDoRRop(dst, and, xor) (((dst) & (and)) ^ (xor)) #define FbDoMaskRRop(dst, and, xor, mask) \ (((dst) & ((and) | ~(mask))) ^ (xor & mask)) /* * Take a single bit (0 or 1) and generate a full mask */ #define fbFillFromBit(b,t) (~((t) ((b) & 1)-1)) #define fbXorT(rop,fg,pm,t) ((((fg) & fbFillFromBit((rop) >> 1,t)) | \ (~(fg) & fbFillFromBit((rop) >> 3,t))) & (pm)) #define fbAndT(rop,fg,pm,t) ((((fg) & fbFillFromBit (rop ^ (rop>>1),t)) | \ (~(fg) & fbFillFromBit((rop>>2) ^ (rop>>3),t))) | \ ~(pm)) #define fbXor(rop,fg,pm) fbXorT(rop,fg,pm,FbBits) #define fbAnd(rop,fg,pm) fbAndT(rop,fg,pm,FbBits) #define fbXorStip(rop,fg,pm) fbXorT(rop,fg,pm,FbStip) #define fbAndStip(rop,fg,pm) fbAndT(rop,fg,pm,FbStip) /* * Stippling operations; */ extern const FbBits fbStipple16Bits[256]; /* half of table */ #define FbStipple16Bits(b) \ (fbStipple16Bits[(b)&0xff] | fbStipple16Bits[(b) >> 8] << FB_HALFUNIT) extern const FbBits fbStipple8Bits[256]; extern const FbBits fbStipple4Bits[16]; extern const FbBits fbStipple2Bits[4]; extern const FbBits fbStipple1Bits[2]; extern const FbBits *const fbStippleTable[]; #define FbStippleRRop(dst, b, fa, fx, ba, bx) \ (FbDoRRop(dst, fa, fx) & b) | (FbDoRRop(dst, ba, bx) & ~b) #define FbStippleRRopMask(dst, b, fa, fx, ba, bx, m) \ (FbDoMaskRRop(dst, fa, fx, m) & (b)) | (FbDoMaskRRop(dst, ba, bx, m) & ~(b)) #define FbDoLeftMaskByteStippleRRop(dst, b, fa, fx, ba, bx, lb, l) { \ FbBits __xor = ((fx) & (b)) | ((bx) & ~(b)); \ FbDoLeftMaskByteRRop(dst, lb, l, ((fa) & (b)) | ((ba) & ~(b)), __xor); \ } #define FbDoRightMaskByteStippleRRop(dst, b, fa, fx, ba, bx, rb, r) { \ FbBits __xor = ((fx) & (b)) | ((bx) & ~(b)); \ FbDoRightMaskByteRRop(dst, rb, r, ((fa) & (b)) | ((ba) & ~(b)), __xor); \ } #define FbOpaqueStipple(b, fg, bg) (((fg) & (b)) | ((bg) & ~(b))) /* * Compute rop for using tile code for 1-bit dest stipples; modifies * existing rop to flip depending on pixel values */ #define FbStipple1RopPick(alu,b) (((alu) >> (2 - (((b) & 1) << 1))) & 3) #define FbOpaqueStipple1Rop(alu,fg,bg) (FbStipple1RopPick(alu,fg) | \ (FbStipple1RopPick(alu,bg) << 2)) #define FbStipple1Rop(alu,fg) (FbStipple1RopPick(alu,fg) | 4) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbscreen.c0000644000000000000000000002022613614532331017117 0ustar /* $XdotOrg: xc/programs/Xserver/fb/fbscreen.c,v 1.6 2005/07/03 07:01:23 daniels Exp $ * Id: fbscreen.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" Bool fbCloseScreen (ScreenPtr pScreen) { int d; DepthPtr depths = pScreen->allowedDepths; for (d = 0; d < pScreen->numDepths; d++) free (depths[d].vids); free (depths); free (pScreen->visuals); free (pScreen->devPrivate); #ifdef FB_SCREEN_PRIVATE free (pScreen->devPrivates[fbScreenPrivateIndex].ptr); #endif return TRUE; } Bool fbRealizeFont(ScreenPtr pScreen, FontPtr pFont) { return (TRUE); } Bool fbUnrealizeFont(ScreenPtr pScreen, FontPtr pFont) { return (TRUE); } void fbQueryBestSize (int class, unsigned short *width, unsigned short *height, ScreenPtr pScreen) { unsigned short w; switch (class) { case CursorShape: if (*width > pScreen->width) *width = pScreen->width; if (*height > pScreen->height) *height = pScreen->height; break; case TileShape: case StippleShape: w = *width; if ((w & (w - 1)) && w < FB_UNIT) { for (w = 1; w < *width; w <<= 1) ; *width = w; } } } #ifndef FB_OLD_SCREEN PixmapPtr _fbGetWindowPixmap (WindowPtr pWindow) { return fbGetWindowPixmap (pWindow); } void _fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap) { #ifdef FB_NO_WINDOW_PIXMAPS FatalError ("Attempted to set window pixmap without fb support\n"); #else pWindow->devPrivates[fbWinPrivateIndex].ptr = (void *) pPixmap; #endif } #endif Bool fbSetupScreen(ScreenPtr pScreen, void * pbits, /* pointer to screen bitmap */ int xsize, /* in pixels */ int ysize, int dpix, /* dots per inch */ int dpiy, int width, /* pixel width of frame buffer */ int bpp) /* bits per pixel for screen */ { if (!fbAllocatePrivates(pScreen, (int *) 0)) return FALSE; pScreen->defColormap = FakeClientID(0); /* let CreateDefColormap do whatever it wants for pixels */ pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0; pScreen->QueryBestSize = fbQueryBestSize; /* SaveScreen */ pScreen->GetImage = fbGetImage; pScreen->GetSpans = fbGetSpans; pScreen->CreateWindow = fbCreateWindow; pScreen->DestroyWindow = fbDestroyWindow; pScreen->PositionWindow = fbPositionWindow; pScreen->ChangeWindowAttributes = fbChangeWindowAttributes; pScreen->RealizeWindow = fbMapWindow; pScreen->UnrealizeWindow = fbUnmapWindow; pScreen->PaintWindowBackground = fbPaintWindow; pScreen->PaintWindowBorder = fbPaintWindow; pScreen->CopyWindow = fbCopyWindow; pScreen->CreatePixmap = fbCreatePixmap; pScreen->DestroyPixmap = fbDestroyPixmap; pScreen->RealizeFont = fbRealizeFont; pScreen->UnrealizeFont = fbUnrealizeFont; pScreen->CreateGC = fbCreateGC; pScreen->CreateColormap = fbInitializeColormap; pScreen->DestroyColormap = (void (*)(ColormapPtr))NoopDDA; pScreen->InstallColormap = fbInstallColormap; pScreen->UninstallColormap = fbUninstallColormap; pScreen->ListInstalledColormaps = fbListInstalledColormaps; pScreen->StoreColors = (void (*)(ColormapPtr, int, xColorItem *))NoopDDA; pScreen->ResolveColor = fbResolveColor; pScreen->BitmapToRegion = fbPixmapToRegion; #ifndef FB_OLD_SCREEN pScreen->GetWindowPixmap = _fbGetWindowPixmap; pScreen->SetWindowPixmap = _fbSetWindowPixmap; pScreen->BackingStoreFuncs.SaveAreas = fbSaveAreas; pScreen->BackingStoreFuncs.RestoreAreas = fbRestoreAreas; pScreen->BackingStoreFuncs.SetClipmaskRgn = 0; pScreen->BackingStoreFuncs.GetImagePixmap = 0; pScreen->BackingStoreFuncs.GetSpansPixmap = 0; #endif return TRUE; } Bool fbFinishScreenInit(ScreenPtr pScreen, void * pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp) { VisualPtr visuals; DepthPtr depths; int nvisuals; int ndepths; int rootdepth; VisualID defaultVisual; int imagebpp = bpp; #ifdef FB_DEBUG int stride; ysize -= 2; stride = (width * bpp) / 8; fbSetBits ((FbStip *) pbits, stride / sizeof (FbStip), FB_HEAD_BITS); pbits = (void *) ((char *) pbits + stride); fbSetBits ((FbStip *) ((char *) pbits + stride * ysize), stride / sizeof (FbStip), FB_TAIL_BITS); #endif /* * By default, a 24bpp screen will use 32bpp images, this avoids * problems with many applications which just can't handle packed * pixels. If you want real 24bit images, include a 24bpp * format in the pixmap formats */ #ifdef FB_24_32BIT if (bpp == 24) { int f; imagebpp = 32; /* * Check to see if we're advertising a 24bpp image format, * in which case windows will use it in preference to a 32 bit * format. */ for (f = 0; f < screenInfo.numPixmapFormats; f++) { if (screenInfo.formats[f].bitsPerPixel == 24) { imagebpp = 24; break; } } } #endif #ifdef FB_SCREEN_PRIVATE if (imagebpp == 32) { fbGetScreenPrivate(pScreen)->win32bpp = bpp; fbGetScreenPrivate(pScreen)->pix32bpp = bpp; } else { fbGetScreenPrivate(pScreen)->win32bpp = 32; fbGetScreenPrivate(pScreen)->pix32bpp = 32; } #endif rootdepth = 0; if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth, &defaultVisual,((unsigned long)1<<(imagebpp-1)), 8)) return FALSE; if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, rootdepth, ndepths, depths, defaultVisual, nvisuals, visuals #ifdef FB_OLD_MISCREENINIT , (miBSFuncPtr) 0 #endif )) return FALSE; /* overwrite miCloseScreen with our own */ pScreen->CloseScreen = fbCloseScreen; #ifdef FB_24_32BIT if (bpp == 24 && imagebpp == 32) { pScreen->ModifyPixmapHeader = fb24_32ModifyPixmapHeader; pScreen->CreateScreenResources = fb24_32CreateScreenResources; } #endif #if 0 /* leave backing store initialization to the enclosing code so * it can choose the correct order of wrappers */ /* init backing store here so we can overwrite CloseScreen without stepping * on the backing store wrapped version */ fbInitializeBackingStore (pScreen); #endif return TRUE; } /* dts * (inch/dot) * (25.4 mm / inch) = mm */ Bool fbScreenInit(ScreenPtr pScreen, void * pbits, int xsize, int ysize, int dpix, int dpiy, int width, int bpp) { if (!fbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)) return FALSE; if (!fbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp)) return FALSE; return TRUE; } #ifdef FB_OLD_SCREEN const miBSFuncRec fbBSFuncRec = { fbSaveAreas, fbRestoreAreas, (void (*)(GCPtr, RegionPtr)) 0, (PixmapPtr (*)(void)) 0, (PixmapPtr (*)(void)) 0, }; #endif #if 0 void fbInitializeBackingStore (ScreenPtr pScreen) { #ifdef FB_OLD_SCREEN miInitializeBackingStore (pScreen, (miBSFuncRec *) &fbBSFuncRec); #else miInitializeBackingStore (pScreen); #endif } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbseg.c0000644000000000000000000003447413614532331016430 0ustar /* * Id: fbseg.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "fb.h" #include "miline.h" #define fbBresShiftMask(mask,dir,bpp) ((bpp == FB_STIP_UNIT) ? 0 : \ ((dir < 0) ? FbStipLeft(mask,bpp) : \ FbStipRight(mask,bpp))) void fbBresSolid (DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { FbStip *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); FbStip and = (FbStip) pPriv->and; FbStip xor = (FbStip) pPriv->xor; FbStip mask, mask0; FbStip bits; fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); dst += ((y1 + dstYoff) * dstStride); x1 = (x1 + dstXoff) * dstBpp; dst += x1 >> FB_STIP_SHIFT; x1 &= FB_STIP_MASK; mask0 = FbStipMask(0, dstBpp); mask = FbStipRight (mask0, x1); if (signdx < 0) mask0 = FbStipRight (mask0, FB_STIP_UNIT - dstBpp); if (signdy < 0) dstStride = -dstStride; if (axis == X_AXIS) { bits = 0; while (len--) { bits |= mask; mask = fbBresShiftMask(mask,signdx,dstBpp); if (!mask) { *dst = FbDoMaskRRop (*dst, and, xor, bits); bits = 0; dst += signdx; mask = mask0; } e += e1; if (e >= 0) { *dst = FbDoMaskRRop (*dst, and, xor, bits); bits = 0; dst += dstStride; e += e3; } } if (bits) *dst = FbDoMaskRRop (*dst, and, xor, bits); } else { while (len--) { *dst = FbDoMaskRRop (*dst, and, xor, mask); dst += dstStride; e += e1; if (e >= 0) { e += e3; mask = fbBresShiftMask(mask,signdx,dstBpp); if (!mask) { dst += signdx; mask = mask0; } } } } } void fbBresDash (DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { FbStip *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); FbStip and = (FbStip) pPriv->and; FbStip xor = (FbStip) pPriv->xor; FbStip bgand = (FbStip) pPriv->bgand; FbStip bgxor = (FbStip) pPriv->bgxor; FbStip mask, mask0; FbDashDeclare; int dashlen; Bool even; Bool doOdd; fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); doOdd = pGC->lineStyle == LineDoubleDash; FbDashInit (pGC, pPriv, dashOffset, dashlen, even); dst += ((y1 + dstYoff) * dstStride); x1 = (x1 + dstXoff) * dstBpp; dst += x1 >> FB_STIP_SHIFT; x1 &= FB_STIP_MASK; mask0 = FbStipMask(0, dstBpp); mask = FbStipRight (mask0, x1); if (signdx < 0) mask0 = FbStipRight (mask0, FB_STIP_UNIT - dstBpp); if (signdy < 0) dstStride = -dstStride; while (len--) { if (even) *dst = FbDoMaskRRop (*dst, and, xor, mask); else if (doOdd) *dst = FbDoMaskRRop (*dst, bgand, bgxor, mask); if (axis == X_AXIS) { mask = fbBresShiftMask(mask,signdx,dstBpp); if (!mask) { dst += signdx; mask = mask0; } e += e1; if (e >= 0) { dst += dstStride; e += e3; } } else { dst += dstStride; e += e1; if (e >= 0) { e += e3; mask = fbBresShiftMask(mask,signdx,dstBpp); if (!mask) { dst += signdx; mask = mask0; } } } FbDashStep (dashlen, even); } } void fbBresFill (DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { while (len--) { fbFill (pDrawable, pGC, x1, y1, 1, 1); if (axis == X_AXIS) { x1 += signdx; e += e1; if (e >= 0) { e += e3; y1 += signdy; } } else { y1 += signdy; e += e1; if (e >= 0) { e += e3; x1 += signdx; } } } } static void fbSetFg (DrawablePtr pDrawable, GCPtr pGC, Pixel fg) { if (fg != pGC->fgPixel) { DoChangeGC (pGC, GCForeground, (XID *) &fg, FALSE); ValidateGC (pDrawable, pGC); } } void fbBresFillDash (DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); FbDashDeclare; int dashlen; Bool even; Bool doOdd; Bool doBg; Pixel fg, bg; fg = pGC->fgPixel; bg = pGC->bgPixel; /* whether to fill the odd dashes */ doOdd = pGC->lineStyle == LineDoubleDash; /* whether to switch fg to bg when filling odd dashes */ doBg = doOdd && (pGC->fillStyle == FillSolid || pGC->fillStyle == FillStippled); /* compute current dash position */ FbDashInit (pGC, pPriv, dashOffset, dashlen, even); while (len--) { if (even || doOdd) { if (doBg) { if (even) fbSetFg (pDrawable, pGC, fg); else fbSetFg (pDrawable, pGC, bg); } fbFill (pDrawable, pGC, x1, y1, 1, 1); } if (axis == X_AXIS) { x1 += signdx; e += e1; if (e >= 0) { e += e3; y1 += signdy; } } else { y1 += signdy; e += e1; if (e >= 0) { e += e3; x1 += signdx; } } FbDashStep (dashlen, even); } if (doBg) fbSetFg (pDrawable, pGC, fg); } #ifdef FB_24BIT static void fbBresSolid24RRop (DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { FbStip *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); FbStip and = pPriv->and; FbStip xor = pPriv->xor; FbStip leftMask, rightMask; int nl; FbStip *d; int x; int rot; FbStip andT, xorT; fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); dst += ((y1 + dstYoff) * dstStride); x1 = (x1 + dstXoff) * 24; if (signdy < 0) dstStride = -dstStride; signdx *= 24; while (len--) { d = dst + (x1 >> FB_STIP_SHIFT); x = x1 & FB_STIP_MASK; rot = FbFirst24Rot (x); andT = FbRot24Stip(and,rot); xorT = FbRot24Stip(xor,rot); FbMaskStip (x, 24, leftMask, nl, rightMask); if (leftMask) { *d = FbDoMaskRRop (*d, andT, xorT, leftMask); d++; andT = FbNext24Stip (andT); xorT = FbNext24Stip (xorT); } if (rightMask) *d = FbDoMaskRRop (*d, andT, xorT, rightMask); if (axis == X_AXIS) { x1 += signdx; e += e1; if (e >= 0) { e += e3; dst += dstStride; } } else { dst += dstStride; e += e1; if (e >= 0) { e += e3; x1 += signdx; } } } } static void fbBresDash24RRop (DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { FbStip *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); FbStip andT, xorT; FbStip fgand = pPriv->and; FbStip fgxor = pPriv->xor; FbStip bgand = pPriv->bgand; FbStip bgxor = pPriv->bgxor; FbStip leftMask, rightMask; int nl; FbStip *d; int x; int rot; FbDashDeclare; int dashlen; Bool even; Bool doOdd; fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); doOdd = pGC->lineStyle == LineDoubleDash; /* compute current dash position */ FbDashInit(pGC, pPriv, dashOffset, dashlen, even); dst += ((y1 + dstYoff) * dstStride); x1 = (x1 + dstXoff) * 24; if (signdy < 0) dstStride = -dstStride; signdx *= 24; while (len--) { if (even || doOdd) { if (even) { andT = fgand; xorT = fgxor; } else { andT = bgand; xorT = bgxor; } d = dst + (x1 >> FB_STIP_SHIFT); x = x1 & FB_STIP_MASK; rot = FbFirst24Rot (x); andT = FbRot24Stip (andT, rot); xorT = FbRot24Stip (xorT, rot); FbMaskStip (x, 24, leftMask, nl, rightMask); if (leftMask) { *d = FbDoMaskRRop (*d, andT, xorT, leftMask); d++; andT = FbNext24Stip (andT); xorT = FbNext24Stip (xorT); } if (rightMask) *d = FbDoMaskRRop (*d, andT, xorT, rightMask); } if (axis == X_AXIS) { x1 += signdx; e += e1; if (e >= 0) { e += e3; dst += dstStride; } } else { dst += dstStride; e += e1; if (e >= 0) { e += e3; x1 += signdx; } } FbDashStep (dashlen, even); } } #endif /* * For drivers that want to bail drawing some lines, this * function takes care of selecting the appropriate rasterizer * based on the contents of the specified GC. */ FbBres * fbSelectBres (DrawablePtr pDrawable, GCPtr pGC) { FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); int dstBpp = pDrawable->bitsPerPixel; FbBres * bres; if (pGC->lineStyle == LineSolid) { bres = fbBresFill; if (pGC->fillStyle == FillSolid) { bres = fbBresSolid; #ifdef FB_24BIT if (dstBpp == 24) bres = fbBresSolid24RRop; #endif #ifndef FBNOPIXADDR if (pPriv->and == 0) { switch (dstBpp) { case 8: bres = fbBresSolid8; break; case 16: bres = fbBresSolid16; break; #ifdef FB_24BIT case 24: bres = fbBresSolid24; break; #endif case 32: bres = fbBresSolid32; break; } } #endif } } else { bres = fbBresFillDash; if (pGC->fillStyle == FillSolid) { bres = fbBresDash; #ifdef FB_24BIT if (dstBpp == 24) bres = fbBresDash24RRop; #endif #ifndef FBNOPIXADDR if (pPriv->and == 0 && (pGC->lineStyle == LineOnOffDash || pPriv->bgand == 0)) { switch (dstBpp) { case 8: bres = fbBresDash8; break; case 16: bres = fbBresDash16; break; #ifdef FB_24BIT case 24: bres = fbBresDash24; break; #endif case 32: bres = fbBresDash32; break; } } #endif } } return bres; } void fbBres (DrawablePtr pDrawable, GCPtr pGC, int dashOffset, int signdx, int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len) { (*fbSelectBres (pDrawable, pGC)) (pDrawable, pGC, dashOffset, signdx, signdy, axis, x1, y1, e, e1, e3, len); } void fbSegment (DrawablePtr pDrawable, GCPtr pGC, int x1, int y1, int x2, int y2, Bool drawLast, int *dashOffset) { FbBres * bres; RegionPtr pClip = fbGetCompositeClip(pGC); BoxPtr pBox; int nBox; int adx; /* abs values of dx and dy */ int ady; int signdx; /* sign of dx and dy */ int signdy; int e, e1, e2, e3; /* bresenham error and increments */ int len; /* length of segment */ int axis; /* major axis */ int octant; int dashoff; int doff; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); unsigned int oc1; /* outcode of point 1 */ unsigned int oc2; /* outcode of point 2 */ nBox = RegionNumRects (pClip); pBox = RegionRects (pClip); bres = fbSelectBres (pDrawable, pGC); CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); if (adx > ady) { axis = X_AXIS; e1 = ady << 1; e2 = e1 - (adx << 1); e = e1 - adx; len = adx; } else { axis = Y_AXIS; e1 = adx << 1; e2 = e1 - (ady << 1); e = e1 - ady; SetYMajorOctant(octant); len = ady; } FIXUP_ERROR (e, octant, bias); /* * Adjust error terms to compare against zero */ e3 = e2 - e1; e = e - e1; /* we have bresenham parameters and two points. all we have to do now is clip and draw. */ if (drawLast) len++; dashoff = *dashOffset; *dashOffset = dashoff + len; while(nBox--) { oc1 = 0; oc2 = 0; OUTCODES(oc1, x1, y1, pBox); OUTCODES(oc2, x2, y2, pBox); if ((oc1 | oc2) == 0) { (*bres) (pDrawable, pGC, dashoff, signdx, signdy, axis, x1, y1, e, e1, e3, len); break; } else if (oc1 & oc2) { pBox++; } else { int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2; int clip1 = 0, clip2 = 0; int clipdx, clipdy; int err; if (miZeroClipLine(pBox->x1, pBox->y1, pBox->x2-1, pBox->y2-1, &new_x1, &new_y1, &new_x2, &new_y2, adx, ady, &clip1, &clip2, octant, bias, oc1, oc2) == -1) { pBox++; continue; } if (axis == X_AXIS) len = abs(new_x2 - new_x1); else len = abs(new_y2 - new_y1); if (clip2 != 0 || drawLast) len++; if (len) { /* unwind bresenham error term to first point */ doff = dashoff; err = e; if (clip1) { clipdx = abs(new_x1 - x1); clipdy = abs(new_y1 - y1); if (axis == X_AXIS) { doff += clipdx; err += e3 * clipdy + e1 * clipdx; } else { doff += clipdy; err += e3 * clipdx + e1 * clipdy; } } (*bres) (pDrawable, pGC, doff, signdx, signdy, axis, new_x1, new_y1, err, e1, e3, len); } pBox++; } } /* while (nBox--) */ } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbsetsp.c0000644000000000000000000000543013614532331016776 0ustar /* * Id: fbsetsp.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" void fbSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *src, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) { FbGCPrivPtr pPriv = fbGetGCPrivate (pGC); RegionPtr pClip = fbGetCompositeClip(pGC); FbBits *dst, *d, *s; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; BoxPtr pbox; int n; int xoff; int x1, x2; #ifdef FB_24_32BIT if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) { fb24_32SetSpans (pDrawable, pGC, src, ppt, pwidth, nspans, fSorted); return; } #endif fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); while (nspans--) { d = dst + (ppt->y + dstYoff) * dstStride; xoff = (int) (((long) src) & (FB_MASK >> 3)); s = (FbBits *) (src - xoff); xoff <<= 3; n = RegionNumRects(pClip); pbox = RegionRects (pClip); while (n--) { if (pbox->y1 > ppt->y) break; if (pbox->y2 > ppt->y) { x1 = ppt->x; x2 = x1 + *pwidth; if (pbox->x1 > x1) x1 = pbox->x1; if (pbox->x2 < x2) x2 = pbox->x2; if (x1 < x2) fbBlt ((FbBits *) s, 0, (x1 - ppt->x) * dstBpp + xoff, d, dstStride, (x1 + dstXoff) * dstBpp, (x2 - x1) * dstBpp, 1, pGC->alu, pPriv->pm, dstBpp, FALSE, FALSE); } } src += PixmapBytePad (*pwidth, pDrawable->depth); ppt++; pwidth++; } fbValidateDrawable (pDrawable); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbsolid.c0000644000000000000000000001045613614532331016756 0ustar /* * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #define FbSelectPart(xor,o,t) xor #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" void fbSolid (FbBits *dst, FbStride dstStride, int dstX, int bpp, int width, int height, FbBits and, FbBits xor) { FbBits startmask, endmask; int n, nmiddle; int startbyte, endbyte; #ifdef FB_24BIT if (bpp == 24 && (!FbCheck24Pix(and) || !FbCheck24Pix(xor))) { fbSolid24 (dst, dstStride, dstX, width, height, and, xor); return; } #endif dst += dstX >> FB_SHIFT; dstX &= FB_MASK; FbMaskBitsBytes(dstX, width, and == 0, startmask, startbyte, nmiddle, endmask, endbyte); if (startmask) dstStride--; dstStride -= nmiddle; while (height--) { if (startmask) { FbDoLeftMaskByteRRop(dst,startbyte,startmask,and,xor); dst++; } n = nmiddle; if (!and) while (n--) *dst++ = xor; else while (n--) { *dst = FbDoRRop (*dst, and, xor); dst++; } if (endmask) FbDoRightMaskByteRRop(dst,endbyte,endmask,and,xor); dst += dstStride; } } #ifdef FB_24BIT void fbSolid24 (FbBits *dst, FbStride dstStride, int dstX, int width, int height, FbBits and, FbBits xor) { FbBits startmask, endmask; FbBits xor0 = 0, xor1 = 0, xor2 = 0; FbBits and0 = 0, and1 = 0, and2 = 0; FbBits xorS = 0, andS = 0, xorE = 0, andE = 0; int n, nmiddle; int rotS, rot; dst += dstX >> FB_SHIFT; dstX &= FB_MASK; /* * Rotate pixel values this far across the word to align on * screen pixel boundaries */ rot = FbFirst24Rot (dstX); FbMaskBits (dstX, width, startmask, nmiddle, endmask); if (startmask) dstStride--; dstStride -= nmiddle; /* * Precompute rotated versions of the rasterop values */ rotS = rot; xor = FbRot24(xor,rotS); and = FbRot24(and,rotS); if (startmask) { xorS = xor; andS = and; xor = FbNext24Pix(xor); and = FbNext24Pix(and); } if (nmiddle) { xor0 = xor; and0 = and; xor1 = FbNext24Pix(xor0); and1 = FbNext24Pix(and0); xor2 = FbNext24Pix(xor1); and2 = FbNext24Pix(and1); } if (endmask) { switch (nmiddle % 3) { case 0: xorE = xor; andE = and; break; case 1: xorE = xor1; andE = and1; break; case 2: xorE = xor2; andE = and2; break; } } while (height--) { if (startmask) { *dst = FbDoMaskRRop(*dst, andS, xorS, startmask); dst++; } n = nmiddle; if (!and0) { while (n >= 3) { *dst++ = xor0; *dst++ = xor1; *dst++ = xor2; n -= 3; } if (n) { *dst++ = xor0; n--; if (n) { *dst++ = xor1; } } } else { while (n >= 3) { *dst = FbDoRRop (*dst, and0, xor0); dst++; *dst = FbDoRRop (*dst, and1, xor1); dst++; *dst = FbDoRRop (*dst, and2, xor2); dst++; n -= 3; } if (n) { *dst = FbDoRRop (*dst, and0, xor0); dst++; n--; if (n) { *dst = FbDoRRop (*dst, and1, xor1); dst++; } } } if (endmask) *dst = FbDoMaskRRop (*dst, andE, xorE, endmask); dst += dstStride; } } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbstipple.c0000644000000000000000000001617413614532331017327 0ustar /* * Id: fbstipple.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" #ifndef FBNOPIXADDR /* * This is a slight abuse of the preprocessor to generate repetitive * code, the idea is to generate code for each case of a copy-mode * transparent stipple */ #define LaneCases1(c,a) case c: \ while (n--) { (void)FbLaneCase(c,a); a++; } \ break #define LaneCases2(c,a) LaneCases1(c,a); LaneCases1(c+1,a) #define LaneCases4(c,a) LaneCases2(c,a); LaneCases2(c+2,a) #define LaneCases8(c,a) LaneCases4(c,a); LaneCases4(c+4,a) #define LaneCases16(c,a) LaneCases8(c,a); LaneCases8(c+8,a) #define LaneCases32(c,a) LaneCases16(c,a); LaneCases16(c+16,a) #define LaneCases64(c,a) LaneCases32(c,a); LaneCases32(c+32,a) #define LaneCases128(c,a) LaneCases64(c,a); LaneCases64(c+64,a) #define LaneCases256(c,a) LaneCases128(c,a); LaneCases128(c+128,a) #if FB_SHIFT == 6 #define LaneCases(a) LaneCases256(0,a) #endif #if FB_SHIFT == 5 #define LaneCases(a) LaneCases16(0,a) #endif /* * Repeat a transparent stipple across a scanline n times */ void fbTransparentSpan (FbBits *dst, FbBits stip, FbBits fgxor, int n) { FbStip s; s = ((FbStip) (stip ) & 0x01); s |= ((FbStip) (stip >> 8) & 0x02); s |= ((FbStip) (stip >> 16) & 0x04); s |= ((FbStip) (stip >> 24) & 0x08); #if FB_SHIFT > 5 s |= ((FbStip) (stip >> 32) & 0x10); s |= ((FbStip) (stip >> 40) & 0x20); s |= ((FbStip) (stip >> 48) & 0x40); s |= ((FbStip) (stip >> 56) & 0x80); #endif switch (s) { LaneCases(dst); } } #endif void fbEvenStipple (FbBits *dst, FbStride dstStride, int dstX, int dstBpp, int width, int height, FbStip *stip, FbStride stipStride, int stipHeight, FbBits fgand, FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot) { FbBits startmask, endmask; FbBits mask, and, xor; int nmiddle, n; FbStip *s, *stipEnd, bits; int rot, stipX, stipY; int pixelsPerDst; const FbBits *fbBits; Bool transparent; int startbyte, endbyte; /* * Check for a transparent stipple (stencil) */ transparent = FALSE; if (dstBpp >= 8 && fgand == 0 && bgand == FB_ALLONES && bgxor == 0) transparent = TRUE; pixelsPerDst = FB_UNIT / dstBpp; /* * Adjust dest pointers */ dst += dstX >> FB_SHIFT; dstX &= FB_MASK; FbMaskBitsBytes (dstX, width, fgand == 0 && bgand == 0, startmask, startbyte, nmiddle, endmask, endbyte); if (startmask) dstStride--; dstStride -= nmiddle; xRot *= dstBpp; /* * Compute stip start scanline and rotation parameters */ stipEnd = stip + stipStride * stipHeight; modulus (- yRot, stipHeight, stipY); s = stip + stipStride * stipY; modulus (- xRot, FB_UNIT, stipX); rot = stipX; /* * Get pointer to stipple mask array for this depth */ fbBits = 0; /* unused */ if (pixelsPerDst <= 8) fbBits = fbStippleTable[pixelsPerDst]; while (height--) { /* * Extract stipple bits for this scanline; */ bits = *s; s += stipStride; if (s == stipEnd) s = stip; #if FB_UNIT > 32 if (pixelsPerDst == 16) mask = FbStipple16Bits(FbLeftStipBits(bits,16)); else #endif mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)]; /* * Rotate into position and compute reduced rop values */ mask = FbRotLeft(mask, rot); and = (fgand & mask) | (bgand & ~mask); xor = (fgxor & mask) | (bgxor & ~mask); #ifndef FBNOPIXADDR if (transparent) { if (startmask) { fbTransparentSpan(dst, mask&startmask, fgxor, 1); dst++; } fbTransparentSpan (dst, mask, fgxor, nmiddle); dst += nmiddle; if (endmask) fbTransparentSpan(dst, mask&endmask, fgxor, 1); } else #endif { /* * Fill scanline */ if (startmask) { FbDoLeftMaskByteRRop (dst, startbyte, startmask, and, xor); dst++; } n = nmiddle; if (!and) while (n--) *dst++ = xor; else { while (n--) { *dst = FbDoRRop (*dst, and, xor); dst++; } } if (endmask) FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor); } dst += dstStride; } } void fbOddStipple (FbBits *dst, FbStride dstStride, int dstX, int dstBpp, int width, int height, FbStip *stip, FbStride stipStride, int stipWidth, int stipHeight, FbBits fgand, FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot) { int stipX, stipY, sx; int widthTmp; int h, w; int x, y; modulus (- yRot, stipHeight, stipY); modulus (dstX / dstBpp - xRot, stipWidth, stipX); y = 0; while (height) { h = stipHeight - stipY; if (h > height) h = height; height -= h; widthTmp = width; x = dstX; sx = stipX; while (widthTmp) { w = (stipWidth - sx) * dstBpp; if (w > widthTmp) w = widthTmp; widthTmp -= w; fbBltOne (stip + stipY * stipStride, stipStride, sx, dst + y * dstStride, dstStride, x, dstBpp, w, h, fgand, fgxor, bgand, bgxor); x += w; sx = 0; } y += h; stipY = 0; } } void fbStipple (FbBits *dst, FbStride dstStride, int dstX, int dstBpp, int width, int height, FbStip *stip, FbStride stipStride, int stipWidth, int stipHeight, Bool even, FbBits fgand, FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot) { if (even) fbEvenStipple (dst, dstStride, dstX, dstBpp, width, height, stip, stipStride, stipHeight, fgand, fgxor, bgand, bgxor, xRot, yRot); else fbOddStipple (dst, dstStride, dstX, dstBpp, width, height, stip, stipStride, stipWidth, stipHeight, fgand, fgxor, bgand, bgxor, xRot, yRot); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbtile.c0000644000000000000000000001031213614532331016570 0ustar /* * Id: fbtile.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" /* * Accelerated tile fill -- tile width is a power of two not greater * than FB_UNIT */ void fbEvenTile (FbBits *dst, FbStride dstStride, int dstX, int width, int height, FbBits *tile, int tileHeight, int alu, FbBits pm, int xRot, int yRot) { FbBits *t, *tileEnd, bits; FbBits startmask, endmask; FbBits and, xor; int n, nmiddle; int tileX, tileY; int rot; int startbyte, endbyte; dst += dstX >> FB_SHIFT; dstX &= FB_MASK; FbMaskBitsBytes(dstX, width, FbDestInvarientRop(alu, pm), startmask, startbyte, nmiddle, endmask, endbyte); if (startmask) dstStride--; dstStride -= nmiddle; /* * Compute tile start scanline and rotation parameters */ tileEnd = tile + tileHeight; modulus (- yRot, tileHeight, tileY); t = tile + tileY; modulus (- xRot, FB_UNIT, tileX); rot = tileX; while (height--) { /* * Pick up bits for this scanline */ bits = *t++; if (t == tileEnd) t = tile; bits = FbRotLeft(bits,rot); and = fbAnd(alu,bits,pm); xor = fbXor(alu,bits,pm); if (startmask) { FbDoLeftMaskByteRRop(dst, startbyte, startmask, and, xor); dst++; } n = nmiddle; if (!and) while (n--) *dst++ = xor; else while (n--) { *dst = FbDoRRop (*dst, and, xor); dst++; } if (endmask) FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor); dst += dstStride; } } void fbOddTile(FbBits *dst, FbStride dstStride, int dstX, int width, int height, FbBits *tile, FbStride tileStride, int tileWidth, int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot) { int tileX, tileY; int widthTmp; int h, w; int x, y; modulus (- yRot, tileHeight, tileY); y = 0; while (height) { h = tileHeight - tileY; if (h > height) h = height; height -= h; widthTmp = width; x = dstX; modulus (dstX - xRot, tileWidth, tileX); while (widthTmp) { w = tileWidth - tileX; if (w > widthTmp) w = widthTmp; widthTmp -= w; fbBlt (tile + tileY * tileStride, tileStride, tileX, dst + y * dstStride, dstStride, x, w, h, alu, pm, bpp, FALSE, FALSE); x += w; tileX = 0; } y += h; tileY = 0; } } void fbTile (FbBits *dst, FbStride dstStride, int dstX, int width, int height, FbBits *tile, FbStride tileStride, int tileWidth, int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot) { if (FbEvenTile (tileWidth)) fbEvenTile (dst, dstStride, dstX, width, height, tile, tileHeight, alu, pm, xRot, yRot); else fbOddTile (dst, dstStride, dstX, width, height, tile, tileStride, tileWidth, tileHeight, alu, pm, bpp, xRot, yRot); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbtrap.c0000644000000000000000000001324613614532331016612 0ustar /* * $Id: fbtrap.c,v 1.5 2005/07/03 07:01:23 daniels Exp $ * * Copyright © 2004 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" #ifdef RENDER #include "picturestr.h" #include "mipict.h" #include "renderedge.h" #include "fbpict.h" void fbAddTraps (PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntrap, xTrap *traps) { FbBits *buf; int bpp; int width; int stride; int height; int pxoff, pyoff; xFixed x_off_fixed; xFixed y_off_fixed; RenderEdge l, r; xFixed t, b; fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff); width = pPicture->pDrawable->width; height = pPicture->pDrawable->height; x_off += pxoff; y_off += pyoff; x_off_fixed = IntToxFixed(y_off); y_off_fixed = IntToxFixed(y_off); while (ntrap--) { t = traps->top.y + y_off_fixed; if (t < 0) t = 0; t = RenderSampleCeilY (t, bpp); b = traps->bot.y + y_off_fixed; if (xFixedToInt (b) >= height) b = IntToxFixed (height) - 1; b = RenderSampleFloorY (b, bpp); if (b >= t) { /* initialize edge walkers */ RenderEdgeInit (&l, bpp, t, traps->top.l + x_off_fixed, traps->top.y + y_off_fixed, traps->bot.l + x_off_fixed, traps->bot.y + y_off_fixed); RenderEdgeInit (&r, bpp, t, traps->top.r + x_off_fixed, traps->top.y + y_off_fixed, traps->bot.r + x_off_fixed, traps->bot.y + y_off_fixed); fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b); } traps++; } } void fbRasterizeTrapezoid (PicturePtr pPicture, xTrapezoid *trap, int x_off, int y_off) { FbBits *buf; int bpp; int width; int stride; int height; int pxoff, pyoff; xFixed y_off_fixed; RenderEdge l, r; xFixed t, b; if (!xTrapezoidValid (trap)) return; fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff); width = pPicture->pDrawable->width; height = pPicture->pDrawable->height; x_off += pxoff; y_off += pyoff; y_off_fixed = IntToxFixed(y_off); t = trap->top + y_off_fixed; if (t < 0) t = 0; t = RenderSampleCeilY (t, bpp); b = trap->bottom + y_off_fixed; if (xFixedToInt (b) >= height) b = IntToxFixed (height) - 1; b = RenderSampleFloorY (b, bpp); if (b >= t) { /* initialize edge walkers */ RenderLineFixedEdgeInit (&l, bpp, t, &trap->left, x_off, y_off); RenderLineFixedEdgeInit (&r, bpp, t, &trap->right, x_off, y_off); fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b); } } static int _GreaterY (xPointFixed *a, xPointFixed *b) { if (a->y == b->y) return a->x > b->x; return a->y > b->y; } /* * Note that the definition of this function is a bit odd because * of the X coordinate space (y increasing downwards). */ static int _Clockwise (xPointFixed *ref, xPointFixed *a, xPointFixed *b) { xPointFixed ad, bd; ad.x = a->x - ref->x; ad.y = a->y - ref->y; bd.x = b->x - ref->x; bd.y = b->y - ref->y; return ((xFixed_32_32) bd.y * ad.x - (xFixed_32_32) ad.y * bd.x) < 0; } /* FIXME -- this could be made more efficient */ void fbAddTriangles (PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntri, xTriangle *tris) { xPointFixed *top, *left, *right, *tmp; xTrapezoid trap; for (; ntri; ntri--, tris++) { top = &tris->p1; left = &tris->p2; right = &tris->p3; if (_GreaterY (top, left)) { tmp = left; left = top; top = tmp; } if (_GreaterY (top, right)) { tmp = right; right = top; top = tmp; } if (_Clockwise (top, right, left)) { tmp = right; right = left; left = tmp; } /* * Two cases: * * + + * / \ / \ * / \ / \ * / + + \ * / -- -- \ * / -- -- \ * / --- --- \ * +-- --+ */ trap.top = top->y; trap.left.p1 = *top; trap.left.p2 = *left; trap.right.p1 = *top; trap.right.p2 = *right; if (right->y < left->y) trap.bottom = right->y; else trap.bottom = left->y; fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off); if (right->y < left->y) { trap.top = right->y; trap.bottom = left->y; trap.right.p1 = *right; trap.right.p2 = *left; } else { trap.top = left->y; trap.bottom = right->y; trap.left.p1 = *left; trap.left.p2 = *right; } fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off); } } #endif /* RENDER */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbutil.c0000644000000000000000000003527713614532331016631 0ustar /* * Id: fbutil.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "fb.h" FbBits fbReplicatePixel (Pixel p, int bpp) { FbBits b = p; b &= FbFullMask (bpp); while (bpp < FB_UNIT) { b |= b << bpp; bpp <<= 1; } return b; } void fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp) { FbBits and, xor; switch (rop) { default: case GXclear: /* 0 0 0 0 */ and = 0; xor = 0; break; case GXand: /* 0 0 0 1 */ and = fg; xor = 0; break; case GXandReverse: /* 0 0 1 0 */ and = fg; xor = fg; break; case GXcopy: /* 0 0 1 1 */ and = 0; xor = fg; break; case GXandInverted: /* 0 1 0 0 */ and = ~fg; xor = 0; break; case GXnoop: /* 0 1 0 1 */ and = FB_ALLONES; xor = 0; break; case GXxor: /* 0 1 1 0 */ and = FB_ALLONES; xor = fg; break; case GXor: /* 0 1 1 1 */ and = ~fg; xor = fg; break; case GXnor: /* 1 0 0 0 */ and = ~fg; xor = ~fg; break; case GXequiv: /* 1 0 0 1 */ and = FB_ALLONES; xor = ~fg; break; case GXinvert: /* 1 0 1 0 */ and = FB_ALLONES; xor = FB_ALLONES; break; case GXorReverse: /* 1 0 1 1 */ and = ~fg; xor = FB_ALLONES; break; case GXcopyInverted: /* 1 1 0 0 */ and = 0; xor = ~fg; break; case GXorInverted: /* 1 1 0 1 */ and = fg; xor = ~fg; break; case GXnand: /* 1 1 1 0 */ and = fg; xor = FB_ALLONES; break; case GXset: /* 1 1 1 1 */ and = 0; xor = FB_ALLONES; break; } and |= ~pm; xor &= pm; *andp = and; *xorp = xor; } #define O 0 #define I FB_ALLONES const FbMergeRopRec FbMergeRopBits[16] = { { O,O,O,O }, /* clear 0x0 0 */ { I,O,O,O }, /* and 0x1 src AND dst */ { I,O,I,O }, /* andReverse 0x2 src AND NOT dst */ { O,O,I,O }, /* copy 0x3 src */ { I,I,O,O }, /* andInverted 0x4 NOT src AND dst */ { O,I,O,O }, /* noop 0x5 dst */ { O,I,I,O }, /* xor 0x6 src XOR dst */ { I,I,I,O }, /* or 0x7 src OR dst */ { I,I,I,I }, /* nor 0x8 NOT src AND NOT dst */ { O,I,I,I }, /* equiv 0x9 NOT src XOR dst */ { O,I,O,I }, /* invert 0xa NOT dst */ { I,I,O,I }, /* orReverse 0xb src OR NOT dst */ { O,O,I,I }, /* copyInverted 0xc NOT src */ { I,O,I,I }, /* orInverted 0xd NOT src OR dst */ { I,O,O,I }, /* nand 0xe NOT src OR NOT dst */ { O,O,O,I }, /* set 0xf 1 */ }; /* * Stipple masks are independent of bit/byte order as long * as bitorder == byteorder. FB doesn't handle the case * where these differ */ #define BitsMask(x,w) ((FB_ALLONES << ((x) & FB_MASK)) & \ (FB_ALLONES >> ((FB_UNIT - ((x) + (w))) & FB_MASK))) #define Mask(x,w) BitsMask((x)*(w),(w)) #define SelMask(b,n,w) ((((b) >> n) & 1) * Mask(n,w)) #define C1(b,w) \ (SelMask(b,0,w)) #define C2(b,w) \ (SelMask(b,0,w) | \ SelMask(b,1,w)) #define C4(b,w) \ (SelMask(b,0,w) | \ SelMask(b,1,w) | \ SelMask(b,2,w) | \ SelMask(b,3,w)) #define C8(b,w) \ (SelMask(b,0,w) | \ SelMask(b,1,w) | \ SelMask(b,2,w) | \ SelMask(b,3,w) | \ SelMask(b,4,w) | \ SelMask(b,5,w) | \ SelMask(b,6,w) | \ SelMask(b,7,w)) #if FB_UNIT == 16 #define fbStipple16Bits 0 #define fbStipple8Bits 0 const FbBits fbStipple4Bits[16] = { C4( 0,4), C4( 1,4), C4( 2,4), C4( 3,4), C4( 4,4), C4( 5,4), C4( 6,4), C4( 7,4), C4( 8,4), C4( 9,4), C4( 10,4), C4( 11,4), C4( 12,4), C4( 13,4), C4( 14,4), C4( 15,4),}; const FbBits fbStipple2Bits[4] = { C2( 0,8), C2( 1,8), C2( 2,8), C2( 3,8), }; const FbBits fbStipple1Bits[2] = { C1( 0,16), C1( 1,16), }; #endif #if FB_UNIT == 32 #define fbStipple16Bits 0 const FbBits fbStipple8Bits[256] = { C8( 0,4), C8( 1,4), C8( 2,4), C8( 3,4), C8( 4,4), C8( 5,4), C8( 6,4), C8( 7,4), C8( 8,4), C8( 9,4), C8( 10,4), C8( 11,4), C8( 12,4), C8( 13,4), C8( 14,4), C8( 15,4), C8( 16,4), C8( 17,4), C8( 18,4), C8( 19,4), C8( 20,4), C8( 21,4), C8( 22,4), C8( 23,4), C8( 24,4), C8( 25,4), C8( 26,4), C8( 27,4), C8( 28,4), C8( 29,4), C8( 30,4), C8( 31,4), C8( 32,4), C8( 33,4), C8( 34,4), C8( 35,4), C8( 36,4), C8( 37,4), C8( 38,4), C8( 39,4), C8( 40,4), C8( 41,4), C8( 42,4), C8( 43,4), C8( 44,4), C8( 45,4), C8( 46,4), C8( 47,4), C8( 48,4), C8( 49,4), C8( 50,4), C8( 51,4), C8( 52,4), C8( 53,4), C8( 54,4), C8( 55,4), C8( 56,4), C8( 57,4), C8( 58,4), C8( 59,4), C8( 60,4), C8( 61,4), C8( 62,4), C8( 63,4), C8( 64,4), C8( 65,4), C8( 66,4), C8( 67,4), C8( 68,4), C8( 69,4), C8( 70,4), C8( 71,4), C8( 72,4), C8( 73,4), C8( 74,4), C8( 75,4), C8( 76,4), C8( 77,4), C8( 78,4), C8( 79,4), C8( 80,4), C8( 81,4), C8( 82,4), C8( 83,4), C8( 84,4), C8( 85,4), C8( 86,4), C8( 87,4), C8( 88,4), C8( 89,4), C8( 90,4), C8( 91,4), C8( 92,4), C8( 93,4), C8( 94,4), C8( 95,4), C8( 96,4), C8( 97,4), C8( 98,4), C8( 99,4), C8(100,4), C8(101,4), C8(102,4), C8(103,4), C8(104,4), C8(105,4), C8(106,4), C8(107,4), C8(108,4), C8(109,4), C8(110,4), C8(111,4), C8(112,4), C8(113,4), C8(114,4), C8(115,4), C8(116,4), C8(117,4), C8(118,4), C8(119,4), C8(120,4), C8(121,4), C8(122,4), C8(123,4), C8(124,4), C8(125,4), C8(126,4), C8(127,4), C8(128,4), C8(129,4), C8(130,4), C8(131,4), C8(132,4), C8(133,4), C8(134,4), C8(135,4), C8(136,4), C8(137,4), C8(138,4), C8(139,4), C8(140,4), C8(141,4), C8(142,4), C8(143,4), C8(144,4), C8(145,4), C8(146,4), C8(147,4), C8(148,4), C8(149,4), C8(150,4), C8(151,4), C8(152,4), C8(153,4), C8(154,4), C8(155,4), C8(156,4), C8(157,4), C8(158,4), C8(159,4), C8(160,4), C8(161,4), C8(162,4), C8(163,4), C8(164,4), C8(165,4), C8(166,4), C8(167,4), C8(168,4), C8(169,4), C8(170,4), C8(171,4), C8(172,4), C8(173,4), C8(174,4), C8(175,4), C8(176,4), C8(177,4), C8(178,4), C8(179,4), C8(180,4), C8(181,4), C8(182,4), C8(183,4), C8(184,4), C8(185,4), C8(186,4), C8(187,4), C8(188,4), C8(189,4), C8(190,4), C8(191,4), C8(192,4), C8(193,4), C8(194,4), C8(195,4), C8(196,4), C8(197,4), C8(198,4), C8(199,4), C8(200,4), C8(201,4), C8(202,4), C8(203,4), C8(204,4), C8(205,4), C8(206,4), C8(207,4), C8(208,4), C8(209,4), C8(210,4), C8(211,4), C8(212,4), C8(213,4), C8(214,4), C8(215,4), C8(216,4), C8(217,4), C8(218,4), C8(219,4), C8(220,4), C8(221,4), C8(222,4), C8(223,4), C8(224,4), C8(225,4), C8(226,4), C8(227,4), C8(228,4), C8(229,4), C8(230,4), C8(231,4), C8(232,4), C8(233,4), C8(234,4), C8(235,4), C8(236,4), C8(237,4), C8(238,4), C8(239,4), C8(240,4), C8(241,4), C8(242,4), C8(243,4), C8(244,4), C8(245,4), C8(246,4), C8(247,4), C8(248,4), C8(249,4), C8(250,4), C8(251,4), C8(252,4), C8(253,4), C8(254,4), C8(255,4), }; const FbBits fbStipple4Bits[16] = { C4( 0,8), C4( 1,8), C4( 2,8), C4( 3,8), C4( 4,8), C4( 5,8), C4( 6,8), C4( 7,8), C4( 8,8), C4( 9,8), C4( 10,8), C4( 11,8), C4( 12,8), C4( 13,8), C4( 14,8), C4( 15,8),}; const FbBits fbStipple2Bits[4] = { C2( 0,16), C2( 1,16), C2( 2,16), C2( 3,16), }; const FbBits fbStipple1Bits[2] = { C1( 0,32), C1( 1,32), }; #endif #if FB_UNIT == 64 const FbBits fbStipple16Bits[256] = { C8( 0,4), C8( 1,4), C8( 2,4), C8( 3,4), C8( 4,4), C8( 5,4), C8( 6,4), C8( 7,4), C8( 8,4), C8( 9,4), C8( 10,4), C8( 11,4), C8( 12,4), C8( 13,4), C8( 14,4), C8( 15,4), C8( 16,4), C8( 17,4), C8( 18,4), C8( 19,4), C8( 20,4), C8( 21,4), C8( 22,4), C8( 23,4), C8( 24,4), C8( 25,4), C8( 26,4), C8( 27,4), C8( 28,4), C8( 29,4), C8( 30,4), C8( 31,4), C8( 32,4), C8( 33,4), C8( 34,4), C8( 35,4), C8( 36,4), C8( 37,4), C8( 38,4), C8( 39,4), C8( 40,4), C8( 41,4), C8( 42,4), C8( 43,4), C8( 44,4), C8( 45,4), C8( 46,4), C8( 47,4), C8( 48,4), C8( 49,4), C8( 50,4), C8( 51,4), C8( 52,4), C8( 53,4), C8( 54,4), C8( 55,4), C8( 56,4), C8( 57,4), C8( 58,4), C8( 59,4), C8( 60,4), C8( 61,4), C8( 62,4), C8( 63,4), C8( 64,4), C8( 65,4), C8( 66,4), C8( 67,4), C8( 68,4), C8( 69,4), C8( 70,4), C8( 71,4), C8( 72,4), C8( 73,4), C8( 74,4), C8( 75,4), C8( 76,4), C8( 77,4), C8( 78,4), C8( 79,4), C8( 80,4), C8( 81,4), C8( 82,4), C8( 83,4), C8( 84,4), C8( 85,4), C8( 86,4), C8( 87,4), C8( 88,4), C8( 89,4), C8( 90,4), C8( 91,4), C8( 92,4), C8( 93,4), C8( 94,4), C8( 95,4), C8( 96,4), C8( 97,4), C8( 98,4), C8( 99,4), C8(100,4), C8(101,4), C8(102,4), C8(103,4), C8(104,4), C8(105,4), C8(106,4), C8(107,4), C8(108,4), C8(109,4), C8(110,4), C8(111,4), C8(112,4), C8(113,4), C8(114,4), C8(115,4), C8(116,4), C8(117,4), C8(118,4), C8(119,4), C8(120,4), C8(121,4), C8(122,4), C8(123,4), C8(124,4), C8(125,4), C8(126,4), C8(127,4), C8(128,4), C8(129,4), C8(130,4), C8(131,4), C8(132,4), C8(133,4), C8(134,4), C8(135,4), C8(136,4), C8(137,4), C8(138,4), C8(139,4), C8(140,4), C8(141,4), C8(142,4), C8(143,4), C8(144,4), C8(145,4), C8(146,4), C8(147,4), C8(148,4), C8(149,4), C8(150,4), C8(151,4), C8(152,4), C8(153,4), C8(154,4), C8(155,4), C8(156,4), C8(157,4), C8(158,4), C8(159,4), C8(160,4), C8(161,4), C8(162,4), C8(163,4), C8(164,4), C8(165,4), C8(166,4), C8(167,4), C8(168,4), C8(169,4), C8(170,4), C8(171,4), C8(172,4), C8(173,4), C8(174,4), C8(175,4), C8(176,4), C8(177,4), C8(178,4), C8(179,4), C8(180,4), C8(181,4), C8(182,4), C8(183,4), C8(184,4), C8(185,4), C8(186,4), C8(187,4), C8(188,4), C8(189,4), C8(190,4), C8(191,4), C8(192,4), C8(193,4), C8(194,4), C8(195,4), C8(196,4), C8(197,4), C8(198,4), C8(199,4), C8(200,4), C8(201,4), C8(202,4), C8(203,4), C8(204,4), C8(205,4), C8(206,4), C8(207,4), C8(208,4), C8(209,4), C8(210,4), C8(211,4), C8(212,4), C8(213,4), C8(214,4), C8(215,4), C8(216,4), C8(217,4), C8(218,4), C8(219,4), C8(220,4), C8(221,4), C8(222,4), C8(223,4), C8(224,4), C8(225,4), C8(226,4), C8(227,4), C8(228,4), C8(229,4), C8(230,4), C8(231,4), C8(232,4), C8(233,4), C8(234,4), C8(235,4), C8(236,4), C8(237,4), C8(238,4), C8(239,4), C8(240,4), C8(241,4), C8(242,4), C8(243,4), C8(244,4), C8(245,4), C8(246,4), C8(247,4), C8(248,4), C8(249,4), C8(250,4), C8(251,4), C8(252,4), C8(253,4), C8(254,4), C8(255,4), }; const FbBits fbStipple8Bits[256] = { C8( 0,8), C8( 1,8), C8( 2,8), C8( 3,8), C8( 4,8), C8( 5,8), C8( 6,8), C8( 7,8), C8( 8,8), C8( 9,8), C8( 10,8), C8( 11,8), C8( 12,8), C8( 13,8), C8( 14,8), C8( 15,8), C8( 16,8), C8( 17,8), C8( 18,8), C8( 19,8), C8( 20,8), C8( 21,8), C8( 22,8), C8( 23,8), C8( 24,8), C8( 25,8), C8( 26,8), C8( 27,8), C8( 28,8), C8( 29,8), C8( 30,8), C8( 31,8), C8( 32,8), C8( 33,8), C8( 34,8), C8( 35,8), C8( 36,8), C8( 37,8), C8( 38,8), C8( 39,8), C8( 40,8), C8( 41,8), C8( 42,8), C8( 43,8), C8( 44,8), C8( 45,8), C8( 46,8), C8( 47,8), C8( 48,8), C8( 49,8), C8( 50,8), C8( 51,8), C8( 52,8), C8( 53,8), C8( 54,8), C8( 55,8), C8( 56,8), C8( 57,8), C8( 58,8), C8( 59,8), C8( 60,8), C8( 61,8), C8( 62,8), C8( 63,8), C8( 64,8), C8( 65,8), C8( 66,8), C8( 67,8), C8( 68,8), C8( 69,8), C8( 70,8), C8( 71,8), C8( 72,8), C8( 73,8), C8( 74,8), C8( 75,8), C8( 76,8), C8( 77,8), C8( 78,8), C8( 79,8), C8( 80,8), C8( 81,8), C8( 82,8), C8( 83,8), C8( 84,8), C8( 85,8), C8( 86,8), C8( 87,8), C8( 88,8), C8( 89,8), C8( 90,8), C8( 91,8), C8( 92,8), C8( 93,8), C8( 94,8), C8( 95,8), C8( 96,8), C8( 97,8), C8( 98,8), C8( 99,8), C8(100,8), C8(101,8), C8(102,8), C8(103,8), C8(104,8), C8(105,8), C8(106,8), C8(107,8), C8(108,8), C8(109,8), C8(110,8), C8(111,8), C8(112,8), C8(113,8), C8(114,8), C8(115,8), C8(116,8), C8(117,8), C8(118,8), C8(119,8), C8(120,8), C8(121,8), C8(122,8), C8(123,8), C8(124,8), C8(125,8), C8(126,8), C8(127,8), C8(128,8), C8(129,8), C8(130,8), C8(131,8), C8(132,8), C8(133,8), C8(134,8), C8(135,8), C8(136,8), C8(137,8), C8(138,8), C8(139,8), C8(140,8), C8(141,8), C8(142,8), C8(143,8), C8(144,8), C8(145,8), C8(146,8), C8(147,8), C8(148,8), C8(149,8), C8(150,8), C8(151,8), C8(152,8), C8(153,8), C8(154,8), C8(155,8), C8(156,8), C8(157,8), C8(158,8), C8(159,8), C8(160,8), C8(161,8), C8(162,8), C8(163,8), C8(164,8), C8(165,8), C8(166,8), C8(167,8), C8(168,8), C8(169,8), C8(170,8), C8(171,8), C8(172,8), C8(173,8), C8(174,8), C8(175,8), C8(176,8), C8(177,8), C8(178,8), C8(179,8), C8(180,8), C8(181,8), C8(182,8), C8(183,8), C8(184,8), C8(185,8), C8(186,8), C8(187,8), C8(188,8), C8(189,8), C8(190,8), C8(191,8), C8(192,8), C8(193,8), C8(194,8), C8(195,8), C8(196,8), C8(197,8), C8(198,8), C8(199,8), C8(200,8), C8(201,8), C8(202,8), C8(203,8), C8(204,8), C8(205,8), C8(206,8), C8(207,8), C8(208,8), C8(209,8), C8(210,8), C8(211,8), C8(212,8), C8(213,8), C8(214,8), C8(215,8), C8(216,8), C8(217,8), C8(218,8), C8(219,8), C8(220,8), C8(221,8), C8(222,8), C8(223,8), C8(224,8), C8(225,8), C8(226,8), C8(227,8), C8(228,8), C8(229,8), C8(230,8), C8(231,8), C8(232,8), C8(233,8), C8(234,8), C8(235,8), C8(236,8), C8(237,8), C8(238,8), C8(239,8), C8(240,8), C8(241,8), C8(242,8), C8(243,8), C8(244,8), C8(245,8), C8(246,8), C8(247,8), C8(248,8), C8(249,8), C8(250,8), C8(251,8), C8(252,8), C8(253,8), C8(254,8), C8(255,8), }; const FbBits fbStipple4Bits[16] = { C4( 0,16), C4( 1,16), C4( 2,16), C4( 3,16), C4( 4,16), C4( 5,16), C4( 6,16), C4( 7,16), C4( 8,16), C4( 9,16), C4( 10,16), C4( 11,16), C4( 12,16), C4( 13,16), C4( 14,16), C4( 15,16),}; const FbBits fbStipple2Bits[4] = { C2( 0,32), C2( 1,32), C2( 2,32), C2( 3,32), }; #define fbStipple1Bits 0 #endif const FbBits * const fbStippleTable[] = { 0, fbStipple1Bits, fbStipple2Bits, 0, fbStipple4Bits, 0, 0, 0, fbStipple8Bits, }; nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/fbwindow.c0000644000000000000000000002004213614532331017143 0ustar /* * Id: fbwindow.c,v 1.1 1999/11/02 03:54:45 keithp Exp $ * * Copyright © 1998 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "fb.h" Bool fbCreateWindow(WindowPtr pWin) { #ifndef FB_NO_WINDOW_PIXMAPS pWin->devPrivates[fbWinPrivateIndex].ptr = (void *) fbGetScreenPixmap(pWin->drawable.pScreen); #endif #ifdef FB_SCREEN_PRIVATE if (pWin->drawable.bitsPerPixel == 32) pWin->drawable.bitsPerPixel = fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp; #endif return TRUE; } Bool fbDestroyWindow(WindowPtr pWin) { return TRUE; } Bool fbMapWindow(WindowPtr pWindow) { return TRUE; } Bool fbPositionWindow(WindowPtr pWin, int x, int y) { return TRUE; } Bool fbUnmapWindow(WindowPtr pWindow) { return TRUE; } void fbCopyWindowProc (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, Bool upsidedown, Pixel bitplane, void *closure) { FbBits *src; FbStride srcStride; int srcBpp; int srcXoff, srcYoff; FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); while (nbox--) { fbBlt (src + (pbox->y1 + dy + srcYoff) * srcStride, srcStride, (pbox->x1 + dx + srcXoff) * srcBpp, dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, (pbox->x2 - pbox->x1) * dstBpp, (pbox->y2 - pbox->y1), GXcopy, FB_ALLONES, dstBpp, reverse, upsidedown); pbox++; } } void fbCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { RegionRec rgnDst; int dx, dy; PixmapPtr pPixmap = fbGetWindowPixmap (pWin); DrawablePtr pDrawable = &pPixmap->drawable; dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; RegionTranslate(prgnSrc, -dx, -dy); RegionNull(&rgnDst); RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc); #ifdef COMPOSITE if (pPixmap->screen_x || pPixmap->screen_y) RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y); #endif fbCopyRegion (pDrawable, pDrawable, 0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0); RegionUninit(&rgnDst); fbValidateDrawable (&pWin->drawable); } Bool fbChangeWindowAttributes(WindowPtr pWin, unsigned long mask) { PixmapPtr pPixmap; if (mask & CWBackPixmap) { if (pWin->backgroundState == BackgroundPixmap) { pPixmap = pWin->background.pixmap; #ifdef FB_24_32BIT if (pPixmap->drawable.bitsPerPixel != pWin->drawable.bitsPerPixel) { pPixmap = fb24_32ReformatTile (pPixmap, pWin->drawable.bitsPerPixel); if (pPixmap) { (*pWin->drawable.pScreen->DestroyPixmap) (pWin->background.pixmap); pWin->background.pixmap = pPixmap; } } #endif if (FbEvenTile (pPixmap->drawable.width * pPixmap->drawable.bitsPerPixel)) fbPadPixmap (pPixmap); } } if (mask & CWBorderPixmap) { if (pWin->borderIsPixel == FALSE) { pPixmap = pWin->border.pixmap; #ifdef FB_24_32BIT if (pPixmap->drawable.bitsPerPixel != pWin->drawable.bitsPerPixel) { pPixmap = fb24_32ReformatTile (pPixmap, pWin->drawable.bitsPerPixel); if (pPixmap) { (*pWin->drawable.pScreen->DestroyPixmap) (pWin->border.pixmap); pWin->border.pixmap = pPixmap; } } #endif if (FbEvenTile (pPixmap->drawable.width * pPixmap->drawable.bitsPerPixel)) fbPadPixmap (pPixmap); } } return TRUE; } void fbFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, FbBits and, FbBits xor) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; int n = RegionNumRects(pRegion); BoxPtr pbox = RegionRects(pRegion); fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); while (n--) { fbSolid (dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, dstBpp, (pbox->x2 - pbox->x1) * dstBpp, pbox->y2 - pbox->y1, and, xor); fbValidateDrawable (pDrawable); pbox++; } } #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #endif void fbFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile) { FbBits *dst; FbStride dstStride; int dstBpp; int dstXoff, dstYoff; FbBits *tile; FbStride tileStride; int tileBpp; _X_UNUSED int tileXoff, tileYoff; /* XXX assumed to be zero */ int tileWidth, tileHeight; int n = RegionNumRects(pRegion); BoxPtr pbox = RegionRects(pRegion); int xRot = pDrawable->x; int yRot = pDrawable->y; #ifdef PANORAMIX if(!noPanoramiXExtension) { int index = pDrawable->pScreen->myNum; if(&screenInfo.screens[index]->root->drawable == pDrawable) { xRot -= panoramiXdataPtr[index].x; yRot -= panoramiXdataPtr[index].y; } } #endif fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff); tileWidth = pTile->drawable.width; tileHeight = pTile->drawable.height; xRot += dstXoff; yRot += dstYoff; while (n--) { fbTile (dst + (pbox->y1 + dstYoff) * dstStride, dstStride, (pbox->x1 + dstXoff) * dstBpp, (pbox->x2 - pbox->x1) * dstBpp, pbox->y2 - pbox->y1, tile, tileStride, tileWidth * dstBpp, tileHeight, GXcopy, FB_ALLONES, dstBpp, xRot * dstBpp, yRot - (pbox->y1 + dstYoff)); pbox++; } } void fbPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) { WindowPtr pBgWin; switch (what) { case PW_BACKGROUND: switch (pWin->backgroundState) { case None: break; case ParentRelative: do { pWin = pWin->parent; } while (pWin->backgroundState == ParentRelative); (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion, what); break; case BackgroundPixmap: fbFillRegionTiled (&pWin->drawable, pRegion, pWin->background.pixmap); break; case BackgroundPixel: fbFillRegionSolid (&pWin->drawable, pRegion, 0, fbReplicatePixel (pWin->background.pixel, pWin->drawable.bitsPerPixel)); break; } break; case PW_BORDER: if (pWin->borderIsPixel) { fbFillRegionSolid (&pWin->drawable, pRegion, 0, fbReplicatePixel (pWin->border.pixel, pWin->drawable.bitsPerPixel)); } else { for (pBgWin = pWin; pBgWin->backgroundState == ParentRelative; pBgWin = pBgWin->parent); fbFillRegionTiled (&pBgWin->drawable, pRegion, pWin->border.pixmap); } break; } fbValidateDrawable (&pWin->drawable); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/fb/Imakefile0000644000000000000000000000670213614532331017000 0ustar NULL = #include #ifdef FbNoPixelAddrCode FB_DEFINES=-DFBNOPIXADDR -DFBNO24BIT #endif #if HasShm SHM_DEFINES = ShmDefines #endif #if BuildRender RENDERSRC = fbcompose.c RENDEROBJ = fbcompose.o #endif #if defined(NXAgentServer) && NXAgentServer NX_DEFINES = -DNXAGENT_SERVER #endif #if defined(NXAgentServer) && NXAgentServer DEFINES = $(FB_DEFINES) $(NX_DEFINES) #else DEFINES = $(FB_DEFINES) #endif SRCS = $(XFMODSRC) \ fballpriv.c \ fbbits.c \ fbblt.c \ fbbltone.c \ fbbstore.c \ fbcmap.c \ $(RENDERSRC) \ fbcopy.c \ fbedge.c \ fbfill.c \ fbfillrect.c \ fbfillsp.c \ fbgc.c \ fbgetsp.c \ fbglyph.c \ fbimage.c \ fbline.c \ fboverlay.c \ fbpixmap.c \ fbpoint.c \ fbpush.c \ fbscreen.c \ fbseg.c \ fbsetsp.c \ fbsolid.c \ fbstipple.c \ fbtile.c \ fbtrap.c \ fbutil.c \ fbwindow.c \ fb24_32.c \ fbpict.c \ $(NULL) OBJS = $(XFMODOBJ) \ fbarc.o \ fballpriv.o \ fbbits.o \ fbblt.o \ fbbltone.o \ fbbstore.o \ fbcmap.o \ $(RENDEROBJ) \ fbcopy.o \ fbedge.o \ fbfill.o \ fbfillrect.o \ fbfillsp.o \ fbgc.o \ fbgetsp.o \ fbglyph.o \ fbimage.o \ fbline.o \ fboverlay.o \ fbpixmap.o \ fbpoint.o \ fbpush.o \ fbscreen.o \ fbseg.o \ fbsetsp.o \ fbsolid.o \ fbstipple.o \ fbtile.o \ fbtrap.o \ fbutil.o \ fbwindow.o \ fb24_32.o \ fbpict.o \ $(NULL) INCLUDES = -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) \ -I$(XF86SRC)/common $(EXTRAINCLUDES) \ -I$(SERVERSRC)/render -I$(EXTINCSRC) -I$(SERVERSRC)/Xext \ `pkg-config --cflags-only-I pixman-1` LINTLIBS = $(SERVERSRC)/dix/llib-ldix.ln $(SERVERSRC)/os/llib-los.ln \ $(SERVERSRC)/mi/llib-lmi.ln NormalLibraryObjectRule() NormalLibraryTarget(fb,$(OBJS)) LintLibraryTarget(fb,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif SpecialCObjectRule(fboverlay,$(ICONFIGFILES),$(SHM_DEFINES)) #ifdef LinkDirectory LinkSourceFile(fb24_32.c,LinkDirectory) LinkSourceFile(fballpriv.c,LinkDirectory) LinkSourceFile(fbarc.c,LinkDirectory) LinkSourceFile(fbbits.c,LinkDirectory) LinkSourceFile(fbblt.c,LinkDirectory) LinkSourceFile(fbbltone.c,LinkDirectory) LinkSourceFile(fbbstore.c,LinkDirectory) LinkSourceFile(fbcmap.c,LinkDirectory) #if BuildRender LinkSourceFile(fbcompose.c,LinkDirectory) #endif LinkSourceFile(fbcopy.c,LinkDirectory) LinkSourceFile(fbfill.c,LinkDirectory) LinkSourceFile(fbfillrect.c,LinkDirectory) LinkSourceFile(fbfillsp.c,LinkDirectory) LinkSourceFile(fbgc.c,LinkDirectory) LinkSourceFile(fbgetsp.c,LinkDirectory) LinkSourceFile(fbglyph.c,LinkDirectory) LinkSourceFile(fbimage.c,LinkDirectory) LinkSourceFile(fbline.c,LinkDirectory) LinkSourceFile(fbmodule.c,LinkDirectory) LinkSourceFile(fboverlay.c,LinkDirectory) LinkSourceFile(fbpict.c,LinkDirectory) LinkSourceFile(fbpixmap.c,LinkDirectory) LinkSourceFile(fbpoint.c,LinkDirectory) LinkSourceFile(fbpush.c,LinkDirectory) LinkSourceFile(fbscreen.c,LinkDirectory) LinkSourceFile(fbseg.c,LinkDirectory) LinkSourceFile(fbsetsp.c,LinkDirectory) LinkSourceFile(fbsolid.c,LinkDirectory) LinkSourceFile(fbstipple.c,LinkDirectory) LinkSourceFile(fbtile.c,LinkDirectory) LinkSourceFile(fbtrap.c,LinkDirectory) LinkSourceFile(fbutil.c,LinkDirectory) LinkSourceFile(fbwindow.c,LinkDirectory) #endif InstallDriverSDKLibraryModule(fb,$(DRIVERSDKMODULEDIR),.) InstallDriverSDKNonExecFile(fb.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(fbrop.h,$(DRIVERSDKINCLUDEDIR)) nx-libs-3.5.99.23/nx-X11/programs/Xserver/fix-miregion0000755000000000000000000000210013614532331017107 0ustar #!/bin/sh sed -i \ -e 's/miRegionCreate\b/RegionCreate/g' \ -e 's/miRegionInit\b/RegionInit/g' \ -e 's/miRegionDestroy\b/RegionDestroy/g' \ -e 's/miRegionUninit\b/RegionUninit/g' \ -e 's/miRegionCopy\b/RegionCopy/g' \ -e 's/miIntersect\b/RegionIntersect/g' \ -e 's/miUnion\b/RegionUnion/g' \ -e 's/miRegionAppend\b/RegionAppend/g' \ -e 's/miRegionValidate\b/RegionValidate/g' \ -e 's/miRectsToRegion\b/RegionFromRects/g' \ -e 's/miSubtract\b/RegionSubtract/g' \ -e 's/miInverse\b/RegionInverse/g' \ -e 's/miRectIn\b/RegionContainsRect/g' \ -e 's/miTranslateRegion\b/RegionTranslate/g' \ -e 's/miRegionReset\b/RegionReset/g' \ -e 's/miRegionBreak\b/RegionBreak/g' \ -e 's/miPointInRegion\b/RegionContainsPoint/g' \ -e 's/miRegionEqual\b/RegionEqual/g' \ -e 's/miRegionNotEmpty\b/RegionNotEmpty/g' \ -e 's/miRegionEmpty\b/RegionEmpty/g' \ -e 's/miRegionExtents\b/RegionExtents/g' \ -e 's/miPrintRegion\b/RegionPrint/g' \ -e 's/miRectAlloc\b/RegionRectAlloc/g' \ -e 's/miValidRegion\b/RegionIsValid/g' \ -e 's/miRegionBroken\b/RegionBroken/g' \ -e 's/miClipSpans\b/RegionClipSpans/g' \ "$@" nx-libs-3.5.99.23/nx-X11/programs/Xserver/fix-miregion-private0000755000000000000000000000072713614532331020574 0ustar #!/bin/sh sed -i \ -e 's/miEmptyBox\b/RegionEmptyBox/g' \ -e 's/miEmptyData\b/RegionEmptyData/g' \ -e 's/miBrokenData\b/RegionBrokenData/g' \ -e 's/miBrokenRegion\b/RegionBrokenRegion/g' \ -e 's/miCoalesce\b/RegionCoalesce/g' \ -e 's/miAppendNonO\b/RegionAppendNonO/g' \ -e 's/miRegionOp\b/RegionOp/g' \ -e 's/miSetExtents\b/RegionSetExtents/g' \ -e 's/miIntersectO\b/RegionIntersectO/g' \ -e 's/miUnionO\b/RegionUnionO/g' \ -e 's/miSubtractO\b/RegionSubtractO/g' \ "$@" nx-libs-3.5.99.23/nx-X11/programs/Xserver/fix-region0000755000000000000000000000356113614532331016575 0ustar #!/bin/sh sed -i \ -e 's/REGION_NIL\b/RegionNil/g' \ -e 's/REGION_NAR\b/RegionNar/g' \ -e 's/REGION_NUM_RECTS\b/RegionNumRects/g' \ -e 's/REGION_SIZE\b/RegionSize/g' \ -e 's/REGION_RECTS\b/RegionRects/g' \ -e 's/REGION_BOXPTR\b/RegionBoxptr/g' \ -e 's/REGION_BOX\b/RegionBox/g' \ -e 's/REGION_TOP\b/RegionTop/g' \ -e 's/REGION_END\b/RegionEnd/g' \ -e 's/REGION_SZOF\b/RegionSizeof/g' \ -e 's/REGION_CREATE *([^,]*, */RegionCreate(/g' \ -e 's/REGION_COPY *([^,]*, */RegionCopy(/g' \ -e 's/REGION_DESTROY *([^,]*, */RegionDestroy(/g' \ -e 's/REGION_INTERSECT *([^,]*, */RegionIntersect(/g' \ -e 's/REGION_UNION *([^,]*, */RegionUnion(/g' \ -e 's/REGION_SUBTRACT *([^,]*, */RegionSubtract(/g' \ -e 's/REGION_INVERSE *([^,]*, */RegionInverse(/g' \ -e 's/REGION_TRANSLATE *([^,]*, */RegionTranslate(/g' \ -e 's/RECT_IN_REGION *([^,]*, */RegionContainsRect(/g' \ -e 's/POINT_IN_REGION *([^,]*, */RegionContainsPoint(/g' \ -e 's/REGION_EQUAL *([^,]*, */RegionEqual(/g' \ -e 's/REGION_APPEND *([^,]*, */RegionAppend(/g' \ -e 's/REGION_VALIDATE *([^,]*, */RegionValidate(/g' \ -e 's/BITMAP_TO_REGION\b/BitmapToRegion/g' \ -e 's/RECTS_TO_REGION *([^,]*, */RegionFromRects(/g' \ -e 's/REGION_BREAK *([^,]*, */RegionBreak(/g' \ -e 's/REGION_INIT *([^,]*, */RegionInit(/g' \ -e 's/REGION_UNINIT *([^,]*, */RegionUninit(/g' \ -e 's/REGION_RESET *([^,]*, */RegionReset(/g' \ -e 's/REGION_NOTEMPTY *([^,]*, */RegionNotEmpty(/g' \ -e 's/REGION_BROKEN *([^,]*, */RegionBroken(/g' \ -e 's/REGION_EMPTY *([^,]*, */RegionEmpty(/g' \ -e 's/REGION_EXTENTS *([^,]*, */RegionExtents(/g' \ -e 's/REGION_NUM_RECTS *([^,]*, */RegionNumRects(/g' \ -e 's/REGION_RECTS *([^,]*, */RegionRects(/g' \ -e 's/REGION_NULL *([^,]*, */RegionNull(/g' \ -e 's/REGION_NULL$/RegionNull/g' \ "$@" nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/g_disptab.c0000644000000000000000000005404213614532331017774 0ustar /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) ** version 1.2.1 Specification. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxext.h" #include "g_disptab.h" __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE] = { __glXNoSuchSingleOpcode, __glXRender, __glXRenderLarge, __glXCreateContext, __glXDestroyContext, __glXMakeCurrent, __glXIsDirect, __glXQueryVersion, __glXWaitGL, __glXWaitX, __glXCopyContext, __glXSwapBuffers, __glXUseXFont, __glXCreateGLXPixmap, __glXGetVisualConfigs, __glXDestroyGLXPixmap, __glXVendorPrivate, __glXVendorPrivateWithReply, __glXQueryExtensionsString, __glXQueryServerString, __glXClientInfo, __glXGetFBConfigs, __glXCreatePixmap, __glXDestroyGLXPixmap, /* glXDestroyPixmap */ __glXCreateNewContext, __glXNoSuchSingleOpcode, /* glXQueryContext */ __glXMakeContextCurrent, __glXNoSuchSingleOpcode, /* glXCreatePbuffer */ __glXNoSuchSingleOpcode, /* glXDestroyPbuffer */ __glXNoSuchSingleOpcode, /* glXGetDrawableAttributes */ __glXNoSuchSingleOpcode, /* glXChangeDrawableAttributes */ __glXNoSuchSingleOpcode, /* glXCreateWindow */ __glXNoSuchSingleOpcode, /* glXDestroyWindow */ __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXDisp_NewList, __glXDisp_EndList, __glXDisp_DeleteLists, __glXDisp_GenLists, __glXDisp_FeedbackBuffer, __glXDisp_SelectBuffer, __glXDisp_RenderMode, __glXDisp_Finish, __glXDisp_PixelStoref, __glXDisp_PixelStorei, __glXDisp_ReadPixels, __glXDisp_GetBooleanv, __glXDisp_GetClipPlane, __glXDisp_GetDoublev, __glXDisp_GetError, __glXDisp_GetFloatv, __glXDisp_GetIntegerv, __glXDisp_GetLightfv, __glXDisp_GetLightiv, __glXDisp_GetMapdv, __glXDisp_GetMapfv, __glXDisp_GetMapiv, __glXDisp_GetMaterialfv, __glXDisp_GetMaterialiv, __glXDisp_GetPixelMapfv, __glXDisp_GetPixelMapuiv, __glXDisp_GetPixelMapusv, __glXDisp_GetPolygonStipple, __glXDisp_GetString, __glXDisp_GetTexEnvfv, __glXDisp_GetTexEnviv, __glXDisp_GetTexGendv, __glXDisp_GetTexGenfv, __glXDisp_GetTexGeniv, __glXDisp_GetTexImage, __glXDisp_GetTexParameterfv, __glXDisp_GetTexParameteriv, __glXDisp_GetTexLevelParameterfv, __glXDisp_GetTexLevelParameteriv, __glXDisp_IsEnabled, __glXDisp_IsList, __glXDisp_Flush, __glXDisp_AreTexturesResident, __glXDisp_DeleteTextures, __glXDisp_GenTextures, __glXDisp_IsTexture, __glXDisp_GetColorTable, __glXDisp_GetColorTableParameterfv, __glXDisp_GetColorTableParameteriv, __glXDisp_GetConvolutionFilter, __glXDisp_GetConvolutionParameterfv, __glXDisp_GetConvolutionParameteriv, __glXDisp_GetSeparableFilter, __glXDisp_GetHistogram, __glXDisp_GetHistogramParameterfv, __glXDisp_GetHistogramParameteriv, __glXDisp_GetMinmax, __glXDisp_GetMinmaxParameterfv, __glXDisp_GetMinmaxParameteriv, }; __GLXdispatchRenderProcPtr __glXRenderTable[] = { __glXNoSuchRenderOpcode, __glXDisp_CallList, __glXDisp_CallLists, __glXDisp_ListBase, __glXDisp_Begin, __glXDisp_Bitmap, __glXDisp_Color3bv, __glXDisp_Color3dv, __glXDisp_Color3fv, __glXDisp_Color3iv, __glXDisp_Color3sv, __glXDisp_Color3ubv, __glXDisp_Color3uiv, __glXDisp_Color3usv, __glXDisp_Color4bv, __glXDisp_Color4dv, __glXDisp_Color4fv, __glXDisp_Color4iv, __glXDisp_Color4sv, __glXDisp_Color4ubv, __glXDisp_Color4uiv, __glXDisp_Color4usv, __glXDisp_EdgeFlagv, __glXDisp_End, __glXDisp_Indexdv, __glXDisp_Indexfv, __glXDisp_Indexiv, __glXDisp_Indexsv, __glXDisp_Normal3bv, __glXDisp_Normal3dv, __glXDisp_Normal3fv, __glXDisp_Normal3iv, __glXDisp_Normal3sv, __glXDisp_RasterPos2dv, __glXDisp_RasterPos2fv, __glXDisp_RasterPos2iv, __glXDisp_RasterPos2sv, __glXDisp_RasterPos3dv, __glXDisp_RasterPos3fv, __glXDisp_RasterPos3iv, __glXDisp_RasterPos3sv, __glXDisp_RasterPos4dv, __glXDisp_RasterPos4fv, __glXDisp_RasterPos4iv, __glXDisp_RasterPos4sv, __glXDisp_Rectdv, __glXDisp_Rectfv, __glXDisp_Rectiv, __glXDisp_Rectsv, __glXDisp_TexCoord1dv, __glXDisp_TexCoord1fv, __glXDisp_TexCoord1iv, __glXDisp_TexCoord1sv, __glXDisp_TexCoord2dv, __glXDisp_TexCoord2fv, __glXDisp_TexCoord2iv, __glXDisp_TexCoord2sv, __glXDisp_TexCoord3dv, __glXDisp_TexCoord3fv, __glXDisp_TexCoord3iv, __glXDisp_TexCoord3sv, __glXDisp_TexCoord4dv, __glXDisp_TexCoord4fv, __glXDisp_TexCoord4iv, __glXDisp_TexCoord4sv, __glXDisp_Vertex2dv, __glXDisp_Vertex2fv, __glXDisp_Vertex2iv, __glXDisp_Vertex2sv, __glXDisp_Vertex3dv, __glXDisp_Vertex3fv, __glXDisp_Vertex3iv, __glXDisp_Vertex3sv, __glXDisp_Vertex4dv, __glXDisp_Vertex4fv, __glXDisp_Vertex4iv, __glXDisp_Vertex4sv, __glXDisp_ClipPlane, __glXDisp_ColorMaterial, __glXDisp_CullFace, __glXDisp_Fogf, __glXDisp_Fogfv, __glXDisp_Fogi, __glXDisp_Fogiv, __glXDisp_FrontFace, __glXDisp_Hint, __glXDisp_Lightf, __glXDisp_Lightfv, __glXDisp_Lighti, __glXDisp_Lightiv, __glXDisp_LightModelf, __glXDisp_LightModelfv, __glXDisp_LightModeli, __glXDisp_LightModeliv, __glXDisp_LineStipple, __glXDisp_LineWidth, __glXDisp_Materialf, __glXDisp_Materialfv, __glXDisp_Materiali, __glXDisp_Materialiv, __glXDisp_PointSize, __glXDisp_PolygonMode, __glXDisp_PolygonStipple, __glXDisp_Scissor, __glXDisp_ShadeModel, __glXDisp_TexParameterf, __glXDisp_TexParameterfv, __glXDisp_TexParameteri, __glXDisp_TexParameteriv, __glXDisp_TexImage1D, __glXDisp_TexImage2D, __glXDisp_TexEnvf, __glXDisp_TexEnvfv, __glXDisp_TexEnvi, __glXDisp_TexEnviv, __glXDisp_TexGend, __glXDisp_TexGendv, __glXDisp_TexGenf, __glXDisp_TexGenfv, __glXDisp_TexGeni, __glXDisp_TexGeniv, __glXDisp_InitNames, __glXDisp_LoadName, __glXDisp_PassThrough, __glXDisp_PopName, __glXDisp_PushName, __glXDisp_DrawBuffer, __glXDisp_Clear, __glXDisp_ClearAccum, __glXDisp_ClearIndex, __glXDisp_ClearColor, __glXDisp_ClearStencil, __glXDisp_ClearDepth, __glXDisp_StencilMask, __glXDisp_ColorMask, __glXDisp_DepthMask, __glXDisp_IndexMask, __glXDisp_Accum, __glXDisp_Disable, __glXDisp_Enable, __glXNoSuchRenderOpcode, __glXDisp_PopAttrib, __glXDisp_PushAttrib, __glXDisp_Map1d, __glXDisp_Map1f, __glXDisp_Map2d, __glXDisp_Map2f, __glXDisp_MapGrid1d, __glXDisp_MapGrid1f, __glXDisp_MapGrid2d, __glXDisp_MapGrid2f, __glXDisp_EvalCoord1dv, __glXDisp_EvalCoord1fv, __glXDisp_EvalCoord2dv, __glXDisp_EvalCoord2fv, __glXDisp_EvalMesh1, __glXDisp_EvalPoint1, __glXDisp_EvalMesh2, __glXDisp_EvalPoint2, __glXDisp_AlphaFunc, __glXDisp_BlendFunc, __glXDisp_LogicOp, __glXDisp_StencilFunc, __glXDisp_StencilOp, __glXDisp_DepthFunc, __glXDisp_PixelZoom, __glXDisp_PixelTransferf, __glXDisp_PixelTransferi, __glXDisp_PixelMapfv, __glXDisp_PixelMapuiv, __glXDisp_PixelMapusv, __glXDisp_ReadBuffer, __glXDisp_CopyPixels, __glXDisp_DrawPixels, __glXDisp_DepthRange, __glXDisp_Frustum, __glXDisp_LoadIdentity, __glXDisp_LoadMatrixf, __glXDisp_LoadMatrixd, __glXDisp_MatrixMode, __glXDisp_MultMatrixf, __glXDisp_MultMatrixd, __glXDisp_Ortho, __glXDisp_PopMatrix, __glXDisp_PushMatrix, __glXDisp_Rotated, __glXDisp_Rotatef, __glXDisp_Scaled, __glXDisp_Scalef, __glXDisp_Translated, __glXDisp_Translatef, __glXDisp_Viewport, __glXDisp_PolygonOffset, __glXDisp_DrawArrays, __glXDisp_Indexubv, __glXDisp_ColorSubTable, __glXDisp_CopyColorSubTable, __glXDisp_ActiveTextureARB, __glXDisp_MultiTexCoord1dvARB, __glXDisp_MultiTexCoord1fvARB, __glXDisp_MultiTexCoord1ivARB, __glXDisp_MultiTexCoord1svARB, __glXDisp_MultiTexCoord2dvARB, __glXDisp_MultiTexCoord2fvARB, __glXDisp_MultiTexCoord2ivARB, __glXDisp_MultiTexCoord2svARB, __glXDisp_MultiTexCoord3dvARB, __glXDisp_MultiTexCoord3fvARB, __glXDisp_MultiTexCoord3ivARB, __glXDisp_MultiTexCoord3svARB, __glXDisp_MultiTexCoord4dvARB, __glXDisp_MultiTexCoord4fvARB, __glXDisp_MultiTexCoord4ivARB, __glXDisp_MultiTexCoord4svARB, /* 213 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 220 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXDisp_SampleCoverageARB, #ifndef MISSING_GL_EXTS __glXDisp_WindowPos3fARB /* 230 */ #else __glXNoSuchRenderOpcode #endif }; __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE] = { __glXNoSuchSingleOpcode, __glXSwapRender, __glXSwapRenderLarge, __glXSwapCreateContext, __glXSwapDestroyContext, __glXSwapMakeCurrent, __glXSwapIsDirect, __glXSwapQueryVersion, __glXSwapWaitGL, __glXSwapWaitX, __glXSwapCopyContext, __glXSwapSwapBuffers, __glXSwapUseXFont, __glXSwapCreateGLXPixmap, __glXSwapGetVisualConfigs, __glXSwapDestroyGLXPixmap, __glXSwapVendorPrivate, __glXSwapVendorPrivateWithReply, __glXSwapQueryExtensionsString, __glXSwapQueryServerString, __glXSwapClientInfo, __glXSwapGetFBConfigs, __glXSwapCreatePixmap, __glXSwapDestroyGLXPixmap, /* glXDestroyPixmap */ __glXSwapCreateNewContext, __glXNoSuchSingleOpcode, /* glXQueryContext */ __glXSwapMakeContextCurrent, __glXNoSuchSingleOpcode, /* glXCreatePbuffer */ __glXNoSuchSingleOpcode, /* glXDestroyPbuffer */ __glXNoSuchSingleOpcode, /* glXGetDrawableAttributes */ __glXNoSuchSingleOpcode, /* glXChangeDrawableAttributes */ __glXNoSuchSingleOpcode, /* glXCreateWindow */ __glXNoSuchSingleOpcode, /* glXDestroyWindow */ __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXDispSwap_NewList, __glXDispSwap_EndList, __glXDispSwap_DeleteLists, __glXDispSwap_GenLists, __glXDispSwap_FeedbackBuffer, __glXDispSwap_SelectBuffer, __glXDispSwap_RenderMode, __glXDispSwap_Finish, __glXDispSwap_PixelStoref, __glXDispSwap_PixelStorei, __glXDispSwap_ReadPixels, __glXDispSwap_GetBooleanv, __glXDispSwap_GetClipPlane, __glXDispSwap_GetDoublev, __glXDispSwap_GetError, __glXDispSwap_GetFloatv, __glXDispSwap_GetIntegerv, __glXDispSwap_GetLightfv, __glXDispSwap_GetLightiv, __glXDispSwap_GetMapdv, __glXDispSwap_GetMapfv, __glXDispSwap_GetMapiv, __glXDispSwap_GetMaterialfv, __glXDispSwap_GetMaterialiv, __glXDispSwap_GetPixelMapfv, __glXDispSwap_GetPixelMapuiv, __glXDispSwap_GetPixelMapusv, __glXDispSwap_GetPolygonStipple, __glXDispSwap_GetString, __glXDispSwap_GetTexEnvfv, __glXDispSwap_GetTexEnviv, __glXDispSwap_GetTexGendv, __glXDispSwap_GetTexGenfv, __glXDispSwap_GetTexGeniv, __glXDispSwap_GetTexImage, __glXDispSwap_GetTexParameterfv, __glXDispSwap_GetTexParameteriv, __glXDispSwap_GetTexLevelParameterfv, __glXDispSwap_GetTexLevelParameteriv, __glXDispSwap_IsEnabled, __glXDispSwap_IsList, __glXDispSwap_Flush, __glXDispSwap_AreTexturesResident, __glXDispSwap_DeleteTextures, __glXDispSwap_GenTextures, __glXDispSwap_IsTexture, __glXDispSwap_GetColorTable, __glXDispSwap_GetColorTableParameterfv, __glXDispSwap_GetColorTableParameteriv, __glXDispSwap_GetConvolutionFilter, __glXDispSwap_GetConvolutionParameterfv, __glXDispSwap_GetConvolutionParameteriv, __glXDispSwap_GetSeparableFilter, __glXDispSwap_GetHistogram, __glXDispSwap_GetHistogramParameterfv, __glXDispSwap_GetHistogramParameteriv, __glXDispSwap_GetMinmax, __glXDispSwap_GetMinmaxParameterfv, __glXDispSwap_GetMinmaxParameteriv, }; __GLXdispatchRenderProcPtr __glXSwapRenderTable[__GLX_RENDER_TABLE_SIZE] = { __glXNoSuchRenderOpcode, __glXDispSwap_CallList, __glXDispSwap_CallLists, __glXDispSwap_ListBase, __glXDispSwap_Begin, __glXDispSwap_Bitmap, __glXDispSwap_Color3bv, __glXDispSwap_Color3dv, __glXDispSwap_Color3fv, __glXDispSwap_Color3iv, __glXDispSwap_Color3sv, __glXDispSwap_Color3ubv, __glXDispSwap_Color3uiv, __glXDispSwap_Color3usv, __glXDispSwap_Color4bv, __glXDispSwap_Color4dv, __glXDispSwap_Color4fv, __glXDispSwap_Color4iv, __glXDispSwap_Color4sv, __glXDispSwap_Color4ubv, __glXDispSwap_Color4uiv, __glXDispSwap_Color4usv, __glXDispSwap_EdgeFlagv, __glXDispSwap_End, __glXDispSwap_Indexdv, __glXDispSwap_Indexfv, __glXDispSwap_Indexiv, __glXDispSwap_Indexsv, __glXDispSwap_Normal3bv, __glXDispSwap_Normal3dv, __glXDispSwap_Normal3fv, __glXDispSwap_Normal3iv, __glXDispSwap_Normal3sv, __glXDispSwap_RasterPos2dv, __glXDispSwap_RasterPos2fv, __glXDispSwap_RasterPos2iv, __glXDispSwap_RasterPos2sv, __glXDispSwap_RasterPos3dv, __glXDispSwap_RasterPos3fv, __glXDispSwap_RasterPos3iv, __glXDispSwap_RasterPos3sv, __glXDispSwap_RasterPos4dv, __glXDispSwap_RasterPos4fv, __glXDispSwap_RasterPos4iv, __glXDispSwap_RasterPos4sv, __glXDispSwap_Rectdv, __glXDispSwap_Rectfv, __glXDispSwap_Rectiv, __glXDispSwap_Rectsv, __glXDispSwap_TexCoord1dv, __glXDispSwap_TexCoord1fv, __glXDispSwap_TexCoord1iv, __glXDispSwap_TexCoord1sv, __glXDispSwap_TexCoord2dv, __glXDispSwap_TexCoord2fv, __glXDispSwap_TexCoord2iv, __glXDispSwap_TexCoord2sv, __glXDispSwap_TexCoord3dv, __glXDispSwap_TexCoord3fv, __glXDispSwap_TexCoord3iv, __glXDispSwap_TexCoord3sv, __glXDispSwap_TexCoord4dv, __glXDispSwap_TexCoord4fv, __glXDispSwap_TexCoord4iv, __glXDispSwap_TexCoord4sv, __glXDispSwap_Vertex2dv, __glXDispSwap_Vertex2fv, __glXDispSwap_Vertex2iv, __glXDispSwap_Vertex2sv, __glXDispSwap_Vertex3dv, __glXDispSwap_Vertex3fv, __glXDispSwap_Vertex3iv, __glXDispSwap_Vertex3sv, __glXDispSwap_Vertex4dv, __glXDispSwap_Vertex4fv, __glXDispSwap_Vertex4iv, __glXDispSwap_Vertex4sv, __glXDispSwap_ClipPlane, __glXDispSwap_ColorMaterial, __glXDispSwap_CullFace, __glXDispSwap_Fogf, __glXDispSwap_Fogfv, __glXDispSwap_Fogi, __glXDispSwap_Fogiv, __glXDispSwap_FrontFace, __glXDispSwap_Hint, __glXDispSwap_Lightf, __glXDispSwap_Lightfv, __glXDispSwap_Lighti, __glXDispSwap_Lightiv, __glXDispSwap_LightModelf, __glXDispSwap_LightModelfv, __glXDispSwap_LightModeli, __glXDispSwap_LightModeliv, __glXDispSwap_LineStipple, __glXDispSwap_LineWidth, __glXDispSwap_Materialf, __glXDispSwap_Materialfv, __glXDispSwap_Materiali, __glXDispSwap_Materialiv, __glXDispSwap_PointSize, __glXDispSwap_PolygonMode, __glXDispSwap_PolygonStipple, __glXDispSwap_Scissor, __glXDispSwap_ShadeModel, __glXDispSwap_TexParameterf, __glXDispSwap_TexParameterfv, __glXDispSwap_TexParameteri, __glXDispSwap_TexParameteriv, __glXDispSwap_TexImage1D, __glXDispSwap_TexImage2D, __glXDispSwap_TexEnvf, __glXDispSwap_TexEnvfv, __glXDispSwap_TexEnvi, __glXDispSwap_TexEnviv, __glXDispSwap_TexGend, __glXDispSwap_TexGendv, __glXDispSwap_TexGenf, __glXDispSwap_TexGenfv, __glXDispSwap_TexGeni, __glXDispSwap_TexGeniv, __glXDispSwap_InitNames, __glXDispSwap_LoadName, __glXDispSwap_PassThrough, __glXDispSwap_PopName, __glXDispSwap_PushName, __glXDispSwap_DrawBuffer, __glXDispSwap_Clear, __glXDispSwap_ClearAccum, __glXDispSwap_ClearIndex, __glXDispSwap_ClearColor, __glXDispSwap_ClearStencil, __glXDispSwap_ClearDepth, __glXDispSwap_StencilMask, __glXDispSwap_ColorMask, __glXDispSwap_DepthMask, __glXDispSwap_IndexMask, __glXDispSwap_Accum, __glXDispSwap_Disable, __glXDispSwap_Enable, __glXNoSuchRenderOpcode, __glXDispSwap_PopAttrib, __glXDispSwap_PushAttrib, __glXDispSwap_Map1d, __glXDispSwap_Map1f, __glXDispSwap_Map2d, __glXDispSwap_Map2f, __glXDispSwap_MapGrid1d, __glXDispSwap_MapGrid1f, __glXDispSwap_MapGrid2d, __glXDispSwap_MapGrid2f, __glXDispSwap_EvalCoord1dv, __glXDispSwap_EvalCoord1fv, __glXDispSwap_EvalCoord2dv, __glXDispSwap_EvalCoord2fv, __glXDispSwap_EvalMesh1, __glXDispSwap_EvalPoint1, __glXDispSwap_EvalMesh2, __glXDispSwap_EvalPoint2, __glXDispSwap_AlphaFunc, __glXDispSwap_BlendFunc, __glXDispSwap_LogicOp, __glXDispSwap_StencilFunc, __glXDispSwap_StencilOp, __glXDispSwap_DepthFunc, __glXDispSwap_PixelZoom, __glXDispSwap_PixelTransferf, __glXDispSwap_PixelTransferi, __glXDispSwap_PixelMapfv, __glXDispSwap_PixelMapuiv, __glXDispSwap_PixelMapusv, __glXDispSwap_ReadBuffer, __glXDispSwap_CopyPixels, __glXDispSwap_DrawPixels, __glXDispSwap_DepthRange, __glXDispSwap_Frustum, __glXDispSwap_LoadIdentity, __glXDispSwap_LoadMatrixf, __glXDispSwap_LoadMatrixd, __glXDispSwap_MatrixMode, __glXDispSwap_MultMatrixf, __glXDispSwap_MultMatrixd, __glXDispSwap_Ortho, __glXDispSwap_PopMatrix, __glXDispSwap_PushMatrix, __glXDispSwap_Rotated, __glXDispSwap_Rotatef, __glXDispSwap_Scaled, __glXDispSwap_Scalef, __glXDispSwap_Translated, __glXDispSwap_Translatef, __glXDispSwap_Viewport, __glXDispSwap_PolygonOffset, __glXDispSwap_DrawArrays, __glXDispSwap_Indexubv, __glXDispSwap_ColorSubTable, __glXDispSwap_CopyColorSubTable, __glXDispSwap_ActiveTextureARB, __glXDispSwap_MultiTexCoord1dvARB, __glXDispSwap_MultiTexCoord1fvARB, __glXDispSwap_MultiTexCoord1ivARB, __glXDispSwap_MultiTexCoord1svARB, __glXDispSwap_MultiTexCoord2dvARB, __glXDispSwap_MultiTexCoord2fvARB, __glXDispSwap_MultiTexCoord2ivARB, __glXDispSwap_MultiTexCoord2svARB, __glXDispSwap_MultiTexCoord3dvARB, __glXDispSwap_MultiTexCoord3fvARB, __glXDispSwap_MultiTexCoord3ivARB, __glXDispSwap_MultiTexCoord3svARB, __glXDispSwap_MultiTexCoord4dvARB, __glXDispSwap_MultiTexCoord4fvARB, __glXDispSwap_MultiTexCoord4ivARB, __glXDispSwap_MultiTexCoord4svARB, /* 213 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 220 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXDispSwap_SampleCoverageARB, #ifndef MISSING_GL_EXTS __glXDispSwap_WindowPos3fARB /* 230 */ #else __glXNoSuchRenderOpcode #endif }; nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.c0000644000000000000000000034705213614532331020522 0ustar /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) ** version 1.2.1 Specification. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxext.h" #include "g_disptab_EXT.h" __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __GLX_MIN_RENDER_OPCODE_EXT + 1] = { __glXDisp_ColorTable, /* 2053 */ __glXDisp_ColorTableParameterfv, /* 2054 */ __glXDisp_ColorTableParameteriv, __glXDisp_CopyColorTable, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 2060 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, #ifndef MISSING_GL_EXTS __glXDisp_PointParameterfARB, /* 2065 */ __glXDisp_PointParameterfvARB, /* 2066 */ #else __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, #endif __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 2070 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXDisp_BlendColor, /* 4096 */ __glXDisp_BlendEquation, /* 4097 */ __glXNoSuchRenderOpcode, /* 4098 */ __glXDisp_TexSubImage1D, /* 4099 */ __glXDisp_TexSubImage2D, /* 4100 */ __glXDisp_ConvolutionFilter1D, __glXDisp_ConvolutionFilter2D, __glXDisp_ConvolutionParameterf, __glXDisp_ConvolutionParameterfv, __glXDisp_ConvolutionParameteri, __glXDisp_ConvolutionParameteriv, __glXDisp_CopyConvolutionFilter1D, __glXDisp_CopyConvolutionFilter2D, __glXDisp_SeparableFilter2D, __glXDisp_Histogram, /* 4110 */ __glXDisp_Minmax, __glXDisp_ResetHistogram, __glXDisp_ResetMinmax, __glXDisp_TexImage3D, __glXDisp_TexSubImage3D, __glXDisp_DrawArraysEXT, __glXDisp_BindTexture, __glXDisp_PrioritizeTextures, __glXDisp_CopyTexImage1D, __glXDisp_CopyTexImage2D, /* 4120 */ __glXDisp_CopyTexSubImage1D, /* 4121 */ __glXDisp_CopyTexSubImage2D, /* 4122 */ __glXDisp_CopyTexSubImage3D, /* 4123 */ #ifndef MISSING_GL_EXTS __glXDisp_FogCoordfv, /* 4124 */ __glXDisp_FogCoorddv, /* 4125 */ __glXDisp_SecondaryColor3bv, /* 4126 */ __glXDisp_SecondaryColor3sv, /* 4127 */ __glXDisp_SecondaryColor3iv, /* 4128 */ __glXDisp_SecondaryColor3fv, /* 4129 */ __glXDisp_SecondaryColor3dv, /* 4130 */ __glXDisp_SecondaryColor3ubv, /* 4131 */ __glXDisp_SecondaryColor3usv, /* 4132 */ __glXDisp_SecondaryColor3uiv, /* 4133 */ __glXDisp_BlendFuncSeparate, /* 4134 */ #else __glXNoSuchRenderOpcode, /* 4124 */ __glXNoSuchRenderOpcode, /* 4125 */ __glXNoSuchRenderOpcode, /* 4126 */ __glXNoSuchRenderOpcode, /* 4127 */ __glXNoSuchRenderOpcode, /* 4128 */ __glXNoSuchRenderOpcode, /* 4129 */ __glXNoSuchRenderOpcode, /* 4130 */ __glXNoSuchRenderOpcode, /* 4131 */ __glXNoSuchRenderOpcode, /* 4132 */ __glXNoSuchRenderOpcode, /* 4133 */ __glXNoSuchRenderOpcode, /* 4134 */ #endif __glXNoSuchRenderOpcode, /* 4135 */ __glXNoSuchRenderOpcode, /* 4136 */ __glXNoSuchRenderOpcode, /* 4137 */ __glXNoSuchRenderOpcode, /* 4138 */ __glXNoSuchRenderOpcode, /* 4139 */ __glXNoSuchRenderOpcode, /* 4140 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4150 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4160 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4170 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4180 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4190 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4200 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4210 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4219 */ #ifndef MISSING_GL_EXTS __glXDisp_ActiveStencilFaceEXT, /* 4220 */ __glXDisp_PointParameteriNV, /* 4221 */ __glXDisp_PointParameterivNV, /* 4222 */ #else __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, #endif }; __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[__GLX_MAX_VENDPRIV_OPCODE_EXT - __GLX_MIN_VENDPRIV_OPCODE_EXT + 1] = { __glXDisp_AreTexturesResidentEXT, /* 11 */ __glXDisp_DeleteTexturesEXT, /* 12 */ __glXDisp_GenTexturesEXT, /* 13 */ __glXDisp_IsTextureEXT, /* 14 */ }; __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __GLX_MIN_RENDER_OPCODE_EXT + 1] = { __glXDispSwap_ColorTable, /* 2053 */ __glXDispSwap_ColorTableParameterfv, /* 2054 */ __glXDispSwap_ColorTableParameteriv, __glXDispSwap_CopyColorTable, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 2060 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, #ifndef MISSING_GL_EXTS __glXDispSwap_PointParameterfARB, /* 2065 */ __glXDispSwap_PointParameterfvARB, /* 2066 */ #else __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, #endif __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 2070 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXDispSwap_BlendColor, __glXDispSwap_BlendEquation, __glXNoSuchRenderOpcode, __glXDispSwap_TexSubImage1D, __glXDispSwap_TexSubImage2D, __glXDispSwap_ConvolutionFilter1D, __glXDispSwap_ConvolutionFilter2D, __glXDispSwap_ConvolutionParameterf, __glXDispSwap_ConvolutionParameterfv, __glXDispSwap_ConvolutionParameteri, __glXDispSwap_ConvolutionParameteriv, __glXDispSwap_CopyConvolutionFilter1D, __glXDispSwap_CopyConvolutionFilter2D, __glXDispSwap_SeparableFilter2D, __glXDispSwap_Histogram, __glXDispSwap_Minmax, __glXDispSwap_ResetHistogram, __glXDispSwap_ResetMinmax, __glXDispSwap_TexImage3D, __glXDispSwap_TexSubImage3D, __glXDispSwap_DrawArraysEXT, __glXDispSwap_BindTexture, __glXDispSwap_PrioritizeTextures, __glXDispSwap_CopyTexImage1D, __glXDispSwap_CopyTexImage2D, /* 4120 */ __glXDispSwap_CopyTexSubImage1D, /* 4121 */ __glXDispSwap_CopyTexSubImage2D, /* 4122 */ __glXDispSwap_CopyTexSubImage3D, /* 4123 */ #ifndef MISSING_GL_EXTS __glXDispSwap_FogCoordfv, /* 4124 */ __glXDispSwap_FogCoorddv, /* 4125 */ __glXDispSwap_SecondaryColor3bv, /* 4126 */ __glXDispSwap_SecondaryColor3sv, /* 4127 */ __glXDispSwap_SecondaryColor3iv, /* 4128 */ __glXDispSwap_SecondaryColor3fv, /* 4129 */ __glXDispSwap_SecondaryColor3dv, /* 4130 */ __glXDispSwap_SecondaryColor3ubv, /* 4131 */ __glXDispSwap_SecondaryColor3usv, /* 4132 */ __glXDispSwap_SecondaryColor3uiv, /* 4133 */ __glXDisp_BlendFuncSeparate, /* 4134 */ #else __glXNoSuchRenderOpcode, /* 4124 */ __glXNoSuchRenderOpcode, /* 4125 */ __glXNoSuchRenderOpcode, /* 4126 */ __glXNoSuchRenderOpcode, /* 4127 */ __glXNoSuchRenderOpcode, /* 4128 */ __glXNoSuchRenderOpcode, /* 4129 */ __glXNoSuchRenderOpcode, /* 4130 */ __glXNoSuchRenderOpcode, /* 4131 */ __glXNoSuchRenderOpcode, /* 4132 */ __glXNoSuchRenderOpcode, /* 4133 */ __glXNoSuchRenderOpcode, /* 4134 */ #endif __glXNoSuchRenderOpcode, /* 4135 */ __glXNoSuchRenderOpcode, /* 4136 */ __glXNoSuchRenderOpcode, /* 4137 */ __glXNoSuchRenderOpcode, /* 4138 */ __glXNoSuchRenderOpcode, /* 4139 */ __glXNoSuchRenderOpcode, /* 4140 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4150 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4160 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4170 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4180 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4190 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4200 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4210 */ __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, /* 4219 */ #ifndef MISSING_GL_EXTS __glXDispSwap_ActiveStencilFaceEXT, /* 4220 */ __glXDispSwap_PointParameteriNV, /* 4221 */ __glXDispSwap_PointParameterivNV, /* 4222 */ #else __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, __glXNoSuchRenderOpcode, #endif }; __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[__GLX_MAX_VENDPRIV_OPCODE_EXT - __GLX_MIN_VENDPRIV_OPCODE_EXT + 1] = { __glXDispSwap_AreTexturesResidentEXT, /* 11 */ __glXDispSwap_DeleteTexturesEXT, /* 12 */ __glXDispSwap_GenTexturesEXT, /* 13 */ __glXDispSwap_IsTextureEXT, /* 14 */ }; nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/g_disptab_EXT.h0000644000000000000000000001720613614532331020522 0ustar /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _GLX_g_disptab_EXT_h_ #define _GLX_g_disptab_EXT_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) ** version 1.2.1 Specification. */ extern int __glXDisp_AreTexturesResidentEXT(__GLXclientState*, GLbyte*); extern int __glXDisp_DeleteTexturesEXT(__GLXclientState*, GLbyte*); extern int __glXDisp_GenTexturesEXT(__GLXclientState*, GLbyte*); extern int __glXDisp_IsTextureEXT(__GLXclientState*, GLbyte*); extern void __glXDisp_ColorTable(GLbyte*); extern void __glXDisp_ColorTableParameterfv(GLbyte*); extern void __glXDisp_ColorTableParameteriv(GLbyte*); extern void __glXDisp_CopyColorTable(GLbyte*); extern void __glXDisp_BlendColor(GLbyte*); extern void __glXDisp_BlendEquation(GLbyte*); extern void __glXDisp_TexSubImage1D(GLbyte*); extern void __glXDisp_TexSubImage2D(GLbyte*); extern void __glXDisp_ConvolutionFilter1D(GLbyte*); extern void __glXDisp_ConvolutionFilter2D(GLbyte*); extern void __glXDisp_ConvolutionParameterf(GLbyte*); extern void __glXDisp_ConvolutionParameterfv(GLbyte*); extern void __glXDisp_ConvolutionParameteri(GLbyte*); extern void __glXDisp_ConvolutionParameteriv(GLbyte*); extern void __glXDisp_CopyConvolutionFilter1D(GLbyte*); extern void __glXDisp_CopyConvolutionFilter2D(GLbyte*); extern void __glXDisp_SeparableFilter2D(GLbyte*); extern void __glXDisp_Histogram(GLbyte*); extern void __glXDisp_Minmax(GLbyte*); extern void __glXDisp_ResetHistogram(GLbyte*); extern void __glXDisp_ResetMinmax(GLbyte*); extern void __glXDisp_TexImage3D(GLbyte*); extern void __glXDisp_TexSubImage3D(GLbyte*); extern void __glXDisp_DrawArraysEXT(GLbyte*); extern void __glXDisp_BindTexture(GLbyte*); extern void __glXDisp_PrioritizeTextures(GLbyte*); extern void __glXDisp_CopyTexImage1D(GLbyte*); extern void __glXDisp_CopyTexImage2D(GLbyte*); extern void __glXDisp_CopyTexSubImage1D(GLbyte*); extern void __glXDisp_CopyTexSubImage2D(GLbyte*); extern void __glXDisp_CopyTexSubImage3D(GLbyte*); extern void __glXDisp_PointParameterfARB(GLbyte*); extern void __glXDisp_PointParameterfvARB(GLbyte*); extern void __glXDisp_FogCoordfv(GLbyte *); extern void __glXDisp_FogCoorddv(GLbyte *); extern void __glXDispSwap_FogCoordfv(GLbyte *); extern void __glXDispSwap_FogCoorddv(GLbyte *); extern void __glXDisp_SecondaryColor3bv(GLbyte *); extern void __glXDisp_SecondaryColor3sv(GLbyte *); extern void __glXDisp_SecondaryColor3iv(GLbyte *); extern void __glXDisp_SecondaryColor3ubv(GLbyte *); extern void __glXDisp_SecondaryColor3usv(GLbyte *); extern void __glXDisp_SecondaryColor3uiv(GLbyte *); extern void __glXDisp_SecondaryColor3fv(GLbyte *); extern void __glXDisp_SecondaryColor3dv(GLbyte *); extern void __glXDispSwap_SecondaryColor3bv(GLbyte *); extern void __glXDispSwap_SecondaryColor3sv(GLbyte *); extern void __glXDispSwap_SecondaryColor3iv(GLbyte *); extern void __glXDispSwap_SecondaryColor3ubv(GLbyte *); extern void __glXDispSwap_SecondaryColor3usv(GLbyte *); extern void __glXDispSwap_SecondaryColor3uiv(GLbyte *); extern void __glXDispSwap_SecondaryColor3fv(GLbyte *); extern void __glXDispSwap_SecondaryColor3dv(GLbyte *); extern void __glXDisp_BlendFuncSeparate(GLbyte *); extern void __glXDispSwap_BlendFuncSeparate(GLbyte *); extern void __glXDisp_PointParameteriNV(GLbyte *); extern void __glXDisp_PointParameterivNV(GLbyte *); extern void __glXDispSwap_PointParameteriNV(GLbyte *); extern void __glXDispSwap_PointParameterivNV(GLbyte *); extern void __glXDisp_ActiveStencilFaceEXT(GLbyte*); extern int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState*, GLbyte*); extern int __glXDispSwap_DeleteTexturesEXT(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GenTexturesEXT(__GLXclientState*, GLbyte*); extern int __glXDispSwap_IsTextureEXT(__GLXclientState*, GLbyte*); extern void __glXDispSwap_ColorTable(GLbyte*); extern void __glXDispSwap_ColorTableParameterfv(GLbyte*); extern void __glXDispSwap_ColorTableParameteriv(GLbyte*); extern void __glXDispSwap_CopyColorTable(GLbyte*); extern void __glXDispSwap_BlendColor(GLbyte*); extern void __glXDispSwap_BlendEquation(GLbyte*); extern void __glXDispSwap_TexSubImage1D(GLbyte*); extern void __glXDispSwap_TexSubImage2D(GLbyte*); extern void __glXDispSwap_ConvolutionFilter1D(GLbyte*); extern void __glXDispSwap_ConvolutionFilter2D(GLbyte*); extern void __glXDispSwap_ConvolutionParameterf(GLbyte*); extern void __glXDispSwap_ConvolutionParameterfv(GLbyte*); extern void __glXDispSwap_ConvolutionParameteri(GLbyte*); extern void __glXDispSwap_ConvolutionParameteriv(GLbyte*); extern void __glXDispSwap_CopyConvolutionFilter1D(GLbyte*); extern void __glXDispSwap_CopyConvolutionFilter2D(GLbyte*); extern void __glXDispSwap_SeparableFilter2D(GLbyte*); extern void __glXDispSwap_Histogram(GLbyte*); extern void __glXDispSwap_Minmax(GLbyte*); extern void __glXDispSwap_ResetHistogram(GLbyte*); extern void __glXDispSwap_ResetMinmax(GLbyte*); extern void __glXDispSwap_TexImage3D(GLbyte*); extern void __glXDispSwap_TexSubImage3D(GLbyte*); extern void __glXDispSwap_DrawArraysEXT(GLbyte*); extern void __glXDispSwap_BindTexture(GLbyte*); extern void __glXDispSwap_PrioritizeTextures(GLbyte*); extern void __glXDispSwap_CopyTexImage1D(GLbyte*); extern void __glXDispSwap_CopyTexImage2D(GLbyte*); extern void __glXDispSwap_CopyTexSubImage1D(GLbyte*); extern void __glXDispSwap_CopyTexSubImage2D(GLbyte*); extern void __glXDispSwap_CopyTexSubImage3D(GLbyte*); extern void __glXDispSwap_PointParameterfARB(GLbyte*); extern void __glXDispSwap_PointParameterfvARB(GLbyte*); extern void __glXDispSwap_ActiveStencilFaceEXT(GLbyte*); #define __GLX_MIN_RENDER_OPCODE_EXT 2053 #define __GLX_MAX_RENDER_OPCODE_EXT 4222 #define __GLX_MIN_VENDPRIV_OPCODE_EXT 11 #define __GLX_MAX_VENDPRIV_OPCODE_EXT 14 #define __GLX_VENDPRIV_TABLE_SIZE_EXT (__GLX_MAX_VENDPRIV_OPCODE_EXT - __GLX_MIN_VENDPRIV_OPCODE_EXT + 1) #define __GLX_RENDER_TABLE_SIZE_EXT (__GLX_MAX_RENDER_OPCODE_EXT - __GLX_MIN_RENDER_OPCODE_EXT + 1) extern __GLXdispatchRenderProcPtr __glXRenderTable_EXT[__GLX_RENDER_TABLE_SIZE_EXT]; extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[__GLX_VENDPRIV_TABLE_SIZE_EXT]; extern __GLXdispatchRenderProcPtr __glXSwapRenderTable_EXT[__GLX_RENDER_TABLE_SIZE_EXT]; extern __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[__GLX_VENDPRIV_TABLE_SIZE_EXT]; #endif /* _GLX_g_disptab_EXT_h_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/g_disptab.h0000644000000000000000000007716013614532331020007 0ustar /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _GLX_g_disptab_h_ #define _GLX_g_disptab_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) ** version 1.2.1 Specification. */ extern int __glXRender(__GLXclientState*, GLbyte*); extern int __glXRenderLarge(__GLXclientState*, GLbyte*); extern int __glXCreateContext(__GLXclientState*, GLbyte*); extern int __glXDestroyContext(__GLXclientState*, GLbyte*); extern int __glXMakeCurrent(__GLXclientState*, GLbyte*); extern int __glXIsDirect(__GLXclientState*, GLbyte*); extern int __glXQueryVersion(__GLXclientState*, GLbyte*); extern int __glXWaitGL(__GLXclientState*, GLbyte*); extern int __glXWaitX(__GLXclientState*, GLbyte*); extern int __glXCopyContext(__GLXclientState*, GLbyte*); extern int __glXSwapBuffers(__GLXclientState*, GLbyte*); extern int __glXUseXFont(__GLXclientState*, GLbyte*); extern int __glXCreateGLXPixmap(__GLXclientState*, GLbyte*); extern int __glXGetVisualConfigs(__GLXclientState*, GLbyte*); extern int __glXDestroyGLXPixmap(__GLXclientState*, GLbyte*); extern int __glXVendorPrivate(__GLXclientState*, GLbyte*); extern int __glXVendorPrivateWithReply(__GLXclientState*, GLbyte*); extern int __glXQueryExtensionsString(__GLXclientState*, GLbyte*); extern int __glXQueryServerString(__GLXclientState*, GLbyte*); extern int __glXClientInfo(__GLXclientState*, GLbyte*); extern int __glXMakeContextCurrent(__GLXclientState*, GLbyte*); extern int __glXGetFBConfigs(__GLXclientState*, GLbyte*); extern int __glXCreateNewContext(__GLXclientState*, GLbyte*); extern int __glXCreatePixmap(__GLXclientState*, GLbyte*); extern int __glXDisp_NewList(__GLXclientState*, GLbyte*); extern int __glXDisp_EndList(__GLXclientState*, GLbyte*); extern int __glXDisp_DeleteLists(__GLXclientState*, GLbyte*); extern int __glXDisp_GenLists(__GLXclientState*, GLbyte*); extern int __glXDisp_FeedbackBuffer(__GLXclientState*, GLbyte*); extern int __glXDisp_SelectBuffer(__GLXclientState*, GLbyte*); extern int __glXDisp_RenderMode(__GLXclientState*, GLbyte*); extern int __glXDisp_Finish(__GLXclientState*, GLbyte*); extern int __glXDisp_PixelStoref(__GLXclientState*, GLbyte*); extern int __glXDisp_PixelStorei(__GLXclientState*, GLbyte*); extern int __glXDisp_ReadPixels(__GLXclientState*, GLbyte*); extern int __glXDisp_GetBooleanv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetClipPlane(__GLXclientState*, GLbyte*); extern int __glXDisp_GetDoublev(__GLXclientState*, GLbyte*); extern int __glXDisp_GetError(__GLXclientState*, GLbyte*); extern int __glXDisp_GetFloatv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetIntegerv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetLightfv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetLightiv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetMapdv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetMapfv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetMapiv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetMaterialfv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetMaterialiv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetPixelMapfv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetPixelMapuiv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetPixelMapusv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetPolygonStipple(__GLXclientState*, GLbyte*); extern int __glXDisp_GetString(__GLXclientState*, GLbyte*); extern int __glXDisp_GetTexEnvfv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetTexEnviv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetTexGendv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetTexGenfv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetTexGeniv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetTexImage(__GLXclientState*, GLbyte*); extern int __glXDisp_GetTexParameterfv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetTexParameteriv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetTexLevelParameterfv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetTexLevelParameteriv(__GLXclientState*, GLbyte*); extern int __glXDisp_IsEnabled(__GLXclientState*, GLbyte*); extern int __glXDisp_IsList(__GLXclientState*, GLbyte*); extern int __glXDisp_Flush(__GLXclientState*, GLbyte*); extern int __glXDisp_AreTexturesResident(__GLXclientState*, GLbyte*); extern int __glXDisp_DeleteTextures(__GLXclientState*, GLbyte*); extern int __glXDisp_GenTextures(__GLXclientState*, GLbyte*); extern int __glXDisp_IsTexture(__GLXclientState*, GLbyte*); extern int __glXDisp_GetColorTable(__GLXclientState*, GLbyte*); extern int __glXDisp_GetColorTableParameterfv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetColorTableParameteriv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetConvolutionFilter(__GLXclientState*, GLbyte*); extern int __glXDisp_GetConvolutionParameterfv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetConvolutionParameteriv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetSeparableFilter(__GLXclientState*, GLbyte*); extern int __glXDisp_GetHistogram(__GLXclientState*, GLbyte*); extern int __glXDisp_GetHistogramParameterfv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetHistogramParameteriv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetMinmax(__GLXclientState*, GLbyte*); extern int __glXDisp_GetMinmaxParameterfv(__GLXclientState*, GLbyte*); extern int __glXDisp_GetMinmaxParameteriv(__GLXclientState*, GLbyte*); extern void __glXDisp_CallList(GLbyte*); extern void __glXDisp_CallLists(GLbyte*); extern void __glXDisp_ListBase(GLbyte*); extern void __glXDisp_Begin(GLbyte*); extern void __glXDisp_Bitmap(GLbyte*); extern void __glXDisp_Color3bv(GLbyte*); extern void __glXDisp_Color3dv(GLbyte*); extern void __glXDisp_Color3fv(GLbyte*); extern void __glXDisp_Color3iv(GLbyte*); extern void __glXDisp_Color3sv(GLbyte*); extern void __glXDisp_Color3ubv(GLbyte*); extern void __glXDisp_Color3uiv(GLbyte*); extern void __glXDisp_Color3usv(GLbyte*); extern void __glXDisp_Color4bv(GLbyte*); extern void __glXDisp_Color4dv(GLbyte*); extern void __glXDisp_Color4fv(GLbyte*); extern void __glXDisp_Color4iv(GLbyte*); extern void __glXDisp_Color4sv(GLbyte*); extern void __glXDisp_Color4ubv(GLbyte*); extern void __glXDisp_Color4uiv(GLbyte*); extern void __glXDisp_Color4usv(GLbyte*); extern void __glXDisp_EdgeFlagv(GLbyte*); extern void __glXDisp_End(GLbyte*); extern void __glXDisp_Indexdv(GLbyte*); extern void __glXDisp_Indexfv(GLbyte*); extern void __glXDisp_Indexiv(GLbyte*); extern void __glXDisp_Indexsv(GLbyte*); extern void __glXDisp_Normal3bv(GLbyte*); extern void __glXDisp_Normal3dv(GLbyte*); extern void __glXDisp_Normal3fv(GLbyte*); extern void __glXDisp_Normal3iv(GLbyte*); extern void __glXDisp_Normal3sv(GLbyte*); extern void __glXDisp_RasterPos2dv(GLbyte*); extern void __glXDisp_RasterPos2fv(GLbyte*); extern void __glXDisp_RasterPos2iv(GLbyte*); extern void __glXDisp_RasterPos2sv(GLbyte*); extern void __glXDisp_RasterPos3dv(GLbyte*); extern void __glXDisp_RasterPos3fv(GLbyte*); extern void __glXDisp_RasterPos3iv(GLbyte*); extern void __glXDisp_RasterPos3sv(GLbyte*); extern void __glXDisp_RasterPos4dv(GLbyte*); extern void __glXDisp_RasterPos4fv(GLbyte*); extern void __glXDisp_RasterPos4iv(GLbyte*); extern void __glXDisp_RasterPos4sv(GLbyte*); extern void __glXDisp_Rectdv(GLbyte*); extern void __glXDisp_Rectfv(GLbyte*); extern void __glXDisp_Rectiv(GLbyte*); extern void __glXDisp_Rectsv(GLbyte*); extern void __glXDisp_TexCoord1dv(GLbyte*); extern void __glXDisp_TexCoord1fv(GLbyte*); extern void __glXDisp_TexCoord1iv(GLbyte*); extern void __glXDisp_TexCoord1sv(GLbyte*); extern void __glXDisp_TexCoord2dv(GLbyte*); extern void __glXDisp_TexCoord2fv(GLbyte*); extern void __glXDisp_TexCoord2iv(GLbyte*); extern void __glXDisp_TexCoord2sv(GLbyte*); extern void __glXDisp_TexCoord3dv(GLbyte*); extern void __glXDisp_TexCoord3fv(GLbyte*); extern void __glXDisp_TexCoord3iv(GLbyte*); extern void __glXDisp_TexCoord3sv(GLbyte*); extern void __glXDisp_TexCoord4dv(GLbyte*); extern void __glXDisp_TexCoord4fv(GLbyte*); extern void __glXDisp_TexCoord4iv(GLbyte*); extern void __glXDisp_TexCoord4sv(GLbyte*); extern void __glXDisp_Vertex2dv(GLbyte*); extern void __glXDisp_Vertex2fv(GLbyte*); extern void __glXDisp_Vertex2iv(GLbyte*); extern void __glXDisp_Vertex2sv(GLbyte*); extern void __glXDisp_Vertex3dv(GLbyte*); extern void __glXDisp_Vertex3fv(GLbyte*); extern void __glXDisp_Vertex3iv(GLbyte*); extern void __glXDisp_Vertex3sv(GLbyte*); extern void __glXDisp_Vertex4dv(GLbyte*); extern void __glXDisp_Vertex4fv(GLbyte*); extern void __glXDisp_Vertex4iv(GLbyte*); extern void __glXDisp_Vertex4sv(GLbyte*); extern void __glXDisp_ClipPlane(GLbyte*); extern void __glXDisp_ColorMaterial(GLbyte*); extern void __glXDisp_CullFace(GLbyte*); extern void __glXDisp_Fogf(GLbyte*); extern void __glXDisp_Fogfv(GLbyte*); extern void __glXDisp_Fogi(GLbyte*); extern void __glXDisp_Fogiv(GLbyte*); extern void __glXDisp_FrontFace(GLbyte*); extern void __glXDisp_Hint(GLbyte*); extern void __glXDisp_Lightf(GLbyte*); extern void __glXDisp_Lightfv(GLbyte*); extern void __glXDisp_Lighti(GLbyte*); extern void __glXDisp_Lightiv(GLbyte*); extern void __glXDisp_LightModelf(GLbyte*); extern void __glXDisp_LightModelfv(GLbyte*); extern void __glXDisp_LightModeli(GLbyte*); extern void __glXDisp_LightModeliv(GLbyte*); extern void __glXDisp_LineStipple(GLbyte*); extern void __glXDisp_LineWidth(GLbyte*); extern void __glXDisp_Materialf(GLbyte*); extern void __glXDisp_Materialfv(GLbyte*); extern void __glXDisp_Materiali(GLbyte*); extern void __glXDisp_Materialiv(GLbyte*); extern void __glXDisp_PointSize(GLbyte*); extern void __glXDisp_PolygonMode(GLbyte*); extern void __glXDisp_PolygonStipple(GLbyte*); extern void __glXDisp_Scissor(GLbyte*); extern void __glXDisp_ShadeModel(GLbyte*); extern void __glXDisp_TexParameterf(GLbyte*); extern void __glXDisp_TexParameterfv(GLbyte*); extern void __glXDisp_TexParameteri(GLbyte*); extern void __glXDisp_TexParameteriv(GLbyte*); extern void __glXDisp_TexImage1D(GLbyte*); extern void __glXDisp_TexImage2D(GLbyte*); extern void __glXDisp_TexEnvf(GLbyte*); extern void __glXDisp_TexEnvfv(GLbyte*); extern void __glXDisp_TexEnvi(GLbyte*); extern void __glXDisp_TexEnviv(GLbyte*); extern void __glXDisp_TexGend(GLbyte*); extern void __glXDisp_TexGendv(GLbyte*); extern void __glXDisp_TexGenf(GLbyte*); extern void __glXDisp_TexGenfv(GLbyte*); extern void __glXDisp_TexGeni(GLbyte*); extern void __glXDisp_TexGeniv(GLbyte*); extern void __glXDisp_InitNames(GLbyte*); extern void __glXDisp_LoadName(GLbyte*); extern void __glXDisp_PassThrough(GLbyte*); extern void __glXDisp_PopName(GLbyte*); extern void __glXDisp_PushName(GLbyte*); extern void __glXDisp_DrawBuffer(GLbyte*); extern void __glXDisp_Clear(GLbyte*); extern void __glXDisp_ClearAccum(GLbyte*); extern void __glXDisp_ClearIndex(GLbyte*); extern void __glXDisp_ClearColor(GLbyte*); extern void __glXDisp_ClearStencil(GLbyte*); extern void __glXDisp_ClearDepth(GLbyte*); extern void __glXDisp_StencilMask(GLbyte*); extern void __glXDisp_ColorMask(GLbyte*); extern void __glXDisp_DepthMask(GLbyte*); extern void __glXDisp_IndexMask(GLbyte*); extern void __glXDisp_Accum(GLbyte*); extern void __glXDisp_Disable(GLbyte*); extern void __glXDisp_Enable(GLbyte*); extern void __glXDisp_PopAttrib(GLbyte*); extern void __glXDisp_PushAttrib(GLbyte*); extern void __glXDisp_Map1d(GLbyte*); extern void __glXDisp_Map1f(GLbyte*); extern void __glXDisp_Map2d(GLbyte*); extern void __glXDisp_Map2f(GLbyte*); extern void __glXDisp_MapGrid1d(GLbyte*); extern void __glXDisp_MapGrid1f(GLbyte*); extern void __glXDisp_MapGrid2d(GLbyte*); extern void __glXDisp_MapGrid2f(GLbyte*); extern void __glXDisp_EvalCoord1dv(GLbyte*); extern void __glXDisp_EvalCoord1fv(GLbyte*); extern void __glXDisp_EvalCoord2dv(GLbyte*); extern void __glXDisp_EvalCoord2fv(GLbyte*); extern void __glXDisp_EvalMesh1(GLbyte*); extern void __glXDisp_EvalPoint1(GLbyte*); extern void __glXDisp_EvalMesh2(GLbyte*); extern void __glXDisp_EvalPoint2(GLbyte*); extern void __glXDisp_AlphaFunc(GLbyte*); extern void __glXDisp_BlendFunc(GLbyte*); extern void __glXDisp_LogicOp(GLbyte*); extern void __glXDisp_StencilFunc(GLbyte*); extern void __glXDisp_StencilOp(GLbyte*); extern void __glXDisp_DepthFunc(GLbyte*); extern void __glXDisp_PixelZoom(GLbyte*); extern void __glXDisp_PixelTransferf(GLbyte*); extern void __glXDisp_PixelTransferi(GLbyte*); extern void __glXDisp_PixelMapfv(GLbyte*); extern void __glXDisp_PixelMapuiv(GLbyte*); extern void __glXDisp_PixelMapusv(GLbyte*); extern void __glXDisp_ReadBuffer(GLbyte*); extern void __glXDisp_CopyPixels(GLbyte*); extern void __glXDisp_DrawPixels(GLbyte*); extern void __glXDisp_DepthRange(GLbyte*); extern void __glXDisp_Frustum(GLbyte*); extern void __glXDisp_LoadIdentity(GLbyte*); extern void __glXDisp_LoadMatrixf(GLbyte*); extern void __glXDisp_LoadMatrixd(GLbyte*); extern void __glXDisp_MatrixMode(GLbyte*); extern void __glXDisp_MultMatrixf(GLbyte*); extern void __glXDisp_MultMatrixd(GLbyte*); extern void __glXDisp_Ortho(GLbyte*); extern void __glXDisp_PopMatrix(GLbyte*); extern void __glXDisp_PushMatrix(GLbyte*); extern void __glXDisp_Rotated(GLbyte*); extern void __glXDisp_Rotatef(GLbyte*); extern void __glXDisp_Scaled(GLbyte*); extern void __glXDisp_Scalef(GLbyte*); extern void __glXDisp_Translated(GLbyte*); extern void __glXDisp_Translatef(GLbyte*); extern void __glXDisp_Viewport(GLbyte*); extern void __glXDisp_PolygonOffset(GLbyte*); extern void __glXDisp_DrawArrays(GLbyte*); extern void __glXDisp_Indexubv(GLbyte*); extern void __glXDisp_ColorSubTable(GLbyte*); extern void __glXDisp_CopyColorSubTable(GLbyte*); extern void __glXDisp_ActiveTextureARB(GLbyte*); extern void __glXDisp_MultiTexCoord1dvARB(GLbyte*); extern void __glXDisp_MultiTexCoord1fvARB(GLbyte*); extern void __glXDisp_MultiTexCoord1ivARB(GLbyte*); extern void __glXDisp_MultiTexCoord1svARB(GLbyte*); extern void __glXDisp_MultiTexCoord2dvARB(GLbyte*); extern void __glXDisp_MultiTexCoord2fvARB(GLbyte*); extern void __glXDisp_MultiTexCoord2ivARB(GLbyte*); extern void __glXDisp_MultiTexCoord2svARB(GLbyte*); extern void __glXDisp_MultiTexCoord3dvARB(GLbyte*); extern void __glXDisp_MultiTexCoord3fvARB(GLbyte*); extern void __glXDisp_MultiTexCoord3ivARB(GLbyte*); extern void __glXDisp_MultiTexCoord3svARB(GLbyte*); extern void __glXDisp_MultiTexCoord4dvARB(GLbyte*); extern void __glXDisp_MultiTexCoord4fvARB(GLbyte*); extern void __glXDisp_MultiTexCoord4ivARB(GLbyte*); extern void __glXDisp_MultiTexCoord4svARB(GLbyte*); extern void __glXDisp_SampleCoverageARB(GLbyte *); extern void __glXDisp_WindowPos3fARB(GLbyte *); extern int __glXSwapRender(__GLXclientState*, GLbyte*); extern int __glXSwapRenderLarge(__GLXclientState*, GLbyte*); extern int __glXSwapCreateContext(__GLXclientState*, GLbyte*); extern int __glXSwapDestroyContext(__GLXclientState*, GLbyte*); extern int __glXSwapMakeCurrent(__GLXclientState*, GLbyte*); extern int __glXSwapIsDirect(__GLXclientState*, GLbyte*); extern int __glXSwapQueryVersion(__GLXclientState*, GLbyte*); extern int __glXSwapWaitGL(__GLXclientState*, GLbyte*); extern int __glXSwapWaitX(__GLXclientState*, GLbyte*); extern int __glXSwapCopyContext(__GLXclientState*, GLbyte*); extern int __glXSwapSwapBuffers(__GLXclientState*, GLbyte*); extern int __glXSwapUseXFont(__GLXclientState*, GLbyte*); extern int __glXSwapCreateGLXPixmap(__GLXclientState*, GLbyte*); extern int __glXSwapGetVisualConfigs(__GLXclientState*, GLbyte*); extern int __glXSwapDestroyGLXPixmap(__GLXclientState*, GLbyte*); extern int __glXSwapVendorPrivate(__GLXclientState*, GLbyte*); extern int __glXSwapVendorPrivateWithReply(__GLXclientState*, GLbyte*); extern int __glXSwapQueryExtensionsString(__GLXclientState*, GLbyte*); extern int __glXSwapQueryServerString(__GLXclientState*, GLbyte*); extern int __glXSwapClientInfo(__GLXclientState*, GLbyte*); extern int __glXSwapMakeContextCurrent(__GLXclientState*, GLbyte*); extern int __glXSwapGetFBConfigs(__GLXclientState*, GLbyte*); extern int __glXSwapCreateNewContext(__GLXclientState*, GLbyte*); extern int __glXSwapCreatePixmap(__GLXclientState*, GLbyte*); extern int __glXDispSwap_NewList(__GLXclientState*, GLbyte*); extern int __glXDispSwap_EndList(__GLXclientState*, GLbyte*); extern int __glXDispSwap_DeleteLists(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GenLists(__GLXclientState*, GLbyte*); extern int __glXDispSwap_FeedbackBuffer(__GLXclientState*, GLbyte*); extern int __glXDispSwap_SelectBuffer(__GLXclientState*, GLbyte*); extern int __glXDispSwap_RenderMode(__GLXclientState*, GLbyte*); extern int __glXDispSwap_Finish(__GLXclientState*, GLbyte*); extern int __glXDispSwap_PixelStoref(__GLXclientState*, GLbyte*); extern int __glXDispSwap_PixelStorei(__GLXclientState*, GLbyte*); extern int __glXDispSwap_ReadPixels(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetBooleanv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetClipPlane(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetDoublev(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetError(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetFloatv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetIntegerv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetLightfv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetLightiv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetMapdv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetMapfv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetMapiv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetMaterialfv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetMaterialiv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetPixelMapfv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetPixelMapuiv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetPixelMapusv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetPolygonStipple(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetString(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetTexEnvfv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetTexEnviv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetTexGendv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetTexGenfv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetTexGeniv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetTexImage(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetTexParameterfv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetTexParameteriv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_IsEnabled(__GLXclientState*, GLbyte*); extern int __glXDispSwap_IsList(__GLXclientState*, GLbyte*); extern int __glXDispSwap_Flush(__GLXclientState*, GLbyte*); extern int __glXDispSwap_AreTexturesResident(__GLXclientState*, GLbyte*); extern int __glXDispSwap_DeleteTextures(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GenTextures(__GLXclientState*, GLbyte*); extern int __glXDispSwap_IsTexture(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetColorTable(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetColorTableParameterfv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetColorTableParameteriv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetConvolutionFilter(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetSeparableFilter(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetHistogram(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetHistogramParameterfv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetHistogramParameteriv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetMinmax(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState*, GLbyte*); extern int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState*, GLbyte*); extern void __glXDispSwap_CallList(GLbyte*); extern void __glXDispSwap_CallLists(GLbyte*); extern void __glXDispSwap_ListBase(GLbyte*); extern void __glXDispSwap_Begin(GLbyte*); extern void __glXDispSwap_Bitmap(GLbyte*); extern void __glXDispSwap_Color3bv(GLbyte*); extern void __glXDispSwap_Color3dv(GLbyte*); extern void __glXDispSwap_Color3fv(GLbyte*); extern void __glXDispSwap_Color3iv(GLbyte*); extern void __glXDispSwap_Color3sv(GLbyte*); extern void __glXDispSwap_Color3ubv(GLbyte*); extern void __glXDispSwap_Color3uiv(GLbyte*); extern void __glXDispSwap_Color3usv(GLbyte*); extern void __glXDispSwap_Color4bv(GLbyte*); extern void __glXDispSwap_Color4dv(GLbyte*); extern void __glXDispSwap_Color4fv(GLbyte*); extern void __glXDispSwap_Color4iv(GLbyte*); extern void __glXDispSwap_Color4sv(GLbyte*); extern void __glXDispSwap_Color4ubv(GLbyte*); extern void __glXDispSwap_Color4uiv(GLbyte*); extern void __glXDispSwap_Color4usv(GLbyte*); extern void __glXDispSwap_EdgeFlagv(GLbyte*); extern void __glXDispSwap_End(GLbyte*); extern void __glXDispSwap_Indexdv(GLbyte*); extern void __glXDispSwap_Indexfv(GLbyte*); extern void __glXDispSwap_Indexiv(GLbyte*); extern void __glXDispSwap_Indexsv(GLbyte*); extern void __glXDispSwap_Normal3bv(GLbyte*); extern void __glXDispSwap_Normal3dv(GLbyte*); extern void __glXDispSwap_Normal3fv(GLbyte*); extern void __glXDispSwap_Normal3iv(GLbyte*); extern void __glXDispSwap_Normal3sv(GLbyte*); extern void __glXDispSwap_RasterPos2dv(GLbyte*); extern void __glXDispSwap_RasterPos2fv(GLbyte*); extern void __glXDispSwap_RasterPos2iv(GLbyte*); extern void __glXDispSwap_RasterPos2sv(GLbyte*); extern void __glXDispSwap_RasterPos3dv(GLbyte*); extern void __glXDispSwap_RasterPos3fv(GLbyte*); extern void __glXDispSwap_RasterPos3iv(GLbyte*); extern void __glXDispSwap_RasterPos3sv(GLbyte*); extern void __glXDispSwap_RasterPos4dv(GLbyte*); extern void __glXDispSwap_RasterPos4fv(GLbyte*); extern void __glXDispSwap_RasterPos4iv(GLbyte*); extern void __glXDispSwap_RasterPos4sv(GLbyte*); extern void __glXDispSwap_Rectdv(GLbyte*); extern void __glXDispSwap_Rectfv(GLbyte*); extern void __glXDispSwap_Rectiv(GLbyte*); extern void __glXDispSwap_Rectsv(GLbyte*); extern void __glXDispSwap_TexCoord1dv(GLbyte*); extern void __glXDispSwap_TexCoord1fv(GLbyte*); extern void __glXDispSwap_TexCoord1iv(GLbyte*); extern void __glXDispSwap_TexCoord1sv(GLbyte*); extern void __glXDispSwap_TexCoord2dv(GLbyte*); extern void __glXDispSwap_TexCoord2fv(GLbyte*); extern void __glXDispSwap_TexCoord2iv(GLbyte*); extern void __glXDispSwap_TexCoord2sv(GLbyte*); extern void __glXDispSwap_TexCoord3dv(GLbyte*); extern void __glXDispSwap_TexCoord3fv(GLbyte*); extern void __glXDispSwap_TexCoord3iv(GLbyte*); extern void __glXDispSwap_TexCoord3sv(GLbyte*); extern void __glXDispSwap_TexCoord4dv(GLbyte*); extern void __glXDispSwap_TexCoord4fv(GLbyte*); extern void __glXDispSwap_TexCoord4iv(GLbyte*); extern void __glXDispSwap_TexCoord4sv(GLbyte*); extern void __glXDispSwap_Vertex2dv(GLbyte*); extern void __glXDispSwap_Vertex2fv(GLbyte*); extern void __glXDispSwap_Vertex2iv(GLbyte*); extern void __glXDispSwap_Vertex2sv(GLbyte*); extern void __glXDispSwap_Vertex3dv(GLbyte*); extern void __glXDispSwap_Vertex3fv(GLbyte*); extern void __glXDispSwap_Vertex3iv(GLbyte*); extern void __glXDispSwap_Vertex3sv(GLbyte*); extern void __glXDispSwap_Vertex4dv(GLbyte*); extern void __glXDispSwap_Vertex4fv(GLbyte*); extern void __glXDispSwap_Vertex4iv(GLbyte*); extern void __glXDispSwap_Vertex4sv(GLbyte*); extern void __glXDispSwap_ClipPlane(GLbyte*); extern void __glXDispSwap_ColorMaterial(GLbyte*); extern void __glXDispSwap_CullFace(GLbyte*); extern void __glXDispSwap_Fogf(GLbyte*); extern void __glXDispSwap_Fogfv(GLbyte*); extern void __glXDispSwap_Fogi(GLbyte*); extern void __glXDispSwap_Fogiv(GLbyte*); extern void __glXDispSwap_FrontFace(GLbyte*); extern void __glXDispSwap_Hint(GLbyte*); extern void __glXDispSwap_Lightf(GLbyte*); extern void __glXDispSwap_Lightfv(GLbyte*); extern void __glXDispSwap_Lighti(GLbyte*); extern void __glXDispSwap_Lightiv(GLbyte*); extern void __glXDispSwap_LightModelf(GLbyte*); extern void __glXDispSwap_LightModelfv(GLbyte*); extern void __glXDispSwap_LightModeli(GLbyte*); extern void __glXDispSwap_LightModeliv(GLbyte*); extern void __glXDispSwap_LineStipple(GLbyte*); extern void __glXDispSwap_LineWidth(GLbyte*); extern void __glXDispSwap_Materialf(GLbyte*); extern void __glXDispSwap_Materialfv(GLbyte*); extern void __glXDispSwap_Materiali(GLbyte*); extern void __glXDispSwap_Materialiv(GLbyte*); extern void __glXDispSwap_PointSize(GLbyte*); extern void __glXDispSwap_PolygonMode(GLbyte*); extern void __glXDispSwap_PolygonStipple(GLbyte*); extern void __glXDispSwap_Scissor(GLbyte*); extern void __glXDispSwap_ShadeModel(GLbyte*); extern void __glXDispSwap_TexParameterf(GLbyte*); extern void __glXDispSwap_TexParameterfv(GLbyte*); extern void __glXDispSwap_TexParameteri(GLbyte*); extern void __glXDispSwap_TexParameteriv(GLbyte*); extern void __glXDispSwap_TexImage1D(GLbyte*); extern void __glXDispSwap_TexImage2D(GLbyte*); extern void __glXDispSwap_TexEnvf(GLbyte*); extern void __glXDispSwap_TexEnvfv(GLbyte*); extern void __glXDispSwap_TexEnvi(GLbyte*); extern void __glXDispSwap_TexEnviv(GLbyte*); extern void __glXDispSwap_TexGend(GLbyte*); extern void __glXDispSwap_TexGendv(GLbyte*); extern void __glXDispSwap_TexGenf(GLbyte*); extern void __glXDispSwap_TexGenfv(GLbyte*); extern void __glXDispSwap_TexGeni(GLbyte*); extern void __glXDispSwap_TexGeniv(GLbyte*); extern void __glXDispSwap_InitNames(GLbyte*); extern void __glXDispSwap_LoadName(GLbyte*); extern void __glXDispSwap_PassThrough(GLbyte*); extern void __glXDispSwap_PopName(GLbyte*); extern void __glXDispSwap_PushName(GLbyte*); extern void __glXDispSwap_DrawBuffer(GLbyte*); extern void __glXDispSwap_Clear(GLbyte*); extern void __glXDispSwap_ClearAccum(GLbyte*); extern void __glXDispSwap_ClearIndex(GLbyte*); extern void __glXDispSwap_ClearColor(GLbyte*); extern void __glXDispSwap_ClearStencil(GLbyte*); extern void __glXDispSwap_ClearDepth(GLbyte*); extern void __glXDispSwap_StencilMask(GLbyte*); extern void __glXDispSwap_ColorMask(GLbyte*); extern void __glXDispSwap_DepthMask(GLbyte*); extern void __glXDispSwap_IndexMask(GLbyte*); extern void __glXDispSwap_Accum(GLbyte*); extern void __glXDispSwap_Disable(GLbyte*); extern void __glXDispSwap_Enable(GLbyte*); extern void __glXDispSwap_PopAttrib(GLbyte*); extern void __glXDispSwap_PushAttrib(GLbyte*); extern void __glXDispSwap_Map1d(GLbyte*); extern void __glXDispSwap_Map1f(GLbyte*); extern void __glXDispSwap_Map2d(GLbyte*); extern void __glXDispSwap_Map2f(GLbyte*); extern void __glXDispSwap_MapGrid1d(GLbyte*); extern void __glXDispSwap_MapGrid1f(GLbyte*); extern void __glXDispSwap_MapGrid2d(GLbyte*); extern void __glXDispSwap_MapGrid2f(GLbyte*); extern void __glXDispSwap_EvalCoord1dv(GLbyte*); extern void __glXDispSwap_EvalCoord1fv(GLbyte*); extern void __glXDispSwap_EvalCoord2dv(GLbyte*); extern void __glXDispSwap_EvalCoord2fv(GLbyte*); extern void __glXDispSwap_EvalMesh1(GLbyte*); extern void __glXDispSwap_EvalPoint1(GLbyte*); extern void __glXDispSwap_EvalMesh2(GLbyte*); extern void __glXDispSwap_EvalPoint2(GLbyte*); extern void __glXDispSwap_AlphaFunc(GLbyte*); extern void __glXDispSwap_BlendFunc(GLbyte*); extern void __glXDispSwap_LogicOp(GLbyte*); extern void __glXDispSwap_StencilFunc(GLbyte*); extern void __glXDispSwap_StencilOp(GLbyte*); extern void __glXDispSwap_DepthFunc(GLbyte*); extern void __glXDispSwap_PixelZoom(GLbyte*); extern void __glXDispSwap_PixelTransferf(GLbyte*); extern void __glXDispSwap_PixelTransferi(GLbyte*); extern void __glXDispSwap_PixelMapfv(GLbyte*); extern void __glXDispSwap_PixelMapuiv(GLbyte*); extern void __glXDispSwap_PixelMapusv(GLbyte*); extern void __glXDispSwap_ReadBuffer(GLbyte*); extern void __glXDispSwap_CopyPixels(GLbyte*); extern void __glXDispSwap_DrawPixels(GLbyte*); extern void __glXDispSwap_DepthRange(GLbyte*); extern void __glXDispSwap_Frustum(GLbyte*); extern void __glXDispSwap_LoadIdentity(GLbyte*); extern void __glXDispSwap_LoadMatrixf(GLbyte*); extern void __glXDispSwap_LoadMatrixd(GLbyte*); extern void __glXDispSwap_MatrixMode(GLbyte*); extern void __glXDispSwap_MultMatrixf(GLbyte*); extern void __glXDispSwap_MultMatrixd(GLbyte*); extern void __glXDispSwap_Ortho(GLbyte*); extern void __glXDispSwap_PopMatrix(GLbyte*); extern void __glXDispSwap_PushMatrix(GLbyte*); extern void __glXDispSwap_Rotated(GLbyte*); extern void __glXDispSwap_Rotatef(GLbyte*); extern void __glXDispSwap_Scaled(GLbyte*); extern void __glXDispSwap_Scalef(GLbyte*); extern void __glXDispSwap_Translated(GLbyte*); extern void __glXDispSwap_Translatef(GLbyte*); extern void __glXDispSwap_Viewport(GLbyte*); extern void __glXDispSwap_PolygonOffset(GLbyte*); extern void __glXDispSwap_DrawArrays(GLbyte*); extern void __glXDispSwap_Indexubv(GLbyte*); extern void __glXDispSwap_ColorSubTable(GLbyte*); extern void __glXDispSwap_CopyColorSubTable(GLbyte*); extern void __glXDispSwap_ActiveTextureARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord1dvARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord1fvARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord1ivARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord1svARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord2dvARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord2fvARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord2ivARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord2svARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord3dvARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord3fvARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord3ivARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord3svARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord4dvARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord4fvARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord4ivARB(GLbyte*); extern void __glXDispSwap_MultiTexCoord4svARB(GLbyte*); extern void __glXDispSwap_SampleCoverageARB(GLbyte *); extern void __glXDispSwap_WindowPos3fARB(GLbyte *); #define __GLX_MIN_GLXCMD_OPCODE 1 #define __GLX_MAX_GLXCMD_OPCODE 20 #define __GLX_MIN_RENDER_OPCODE 1 /*#define __GLX_MAX_RENDER_OPCODE 213*/ #define __GLX_MAX_RENDER_OPCODE 230 #define __GLX_MIN_SINGLE_OPCODE 1 #define __GLX_MAX_SINGLE_OPCODE 159 #define __GLX_SINGLE_TABLE_SIZE 160 /*#define __GLX_RENDER_TABLE_SIZE 214*/ #define __GLX_RENDER_TABLE_SIZE 231 extern __GLXdispatchRenderProcPtr __glXRenderTable[__GLX_RENDER_TABLE_SIZE]; extern __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE]; extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[__GLX_RENDER_TABLE_SIZE]; extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE]; #endif /* _GLX_g_disptab_h_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/global.c0000644000000000000000000000523613614532331017301 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" /* ** The last context used by the server. It is the context that is current ** from the server's perspective. */ __GLXcontext *__glXLastContext; /* ** X resources. */ RESTYPE __glXContextRes; RESTYPE __glXClientRes; RESTYPE __glXPixmapRes; RESTYPE __glXSwapBarrierRes; /* ** Error codes with the extension error base already added in. */ int __glXBadContext, __glXBadContextState, __glXBadDrawable, __glXBadPixmap; int __glXBadContextTag, __glXBadCurrentWindow; int __glXBadRenderRequest, __glXBadLargeRequest; int __glXUnsupportedPrivateRequest; /* ** Reply for most singles. */ xGLXSingleReply __glXReply; /* ** A set of state for each client. The 0th one is unused because client ** indices start at 1, not 0. */ __GLXclientState *__glXClients[MAXCLIENTS+1]; nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxbuf.c0000644000000000000000000002163313614532331017327 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxutil.h" #include "glxbuf.h" #include "glxfb.h" #include "glxmem.h" #include "glxpix.h" void __glXFBInitDrawable(__GLXdrawablePrivate *glxPriv, __GLcontextModes *modes) { __GLdrawablePrivate *glPriv; GLint rgbBits; GLint accumBits; glPriv = &glxPriv->glPriv; rgbBits = modes->rgbBits; accumBits = modes->accumRedBits + modes->accumGreenBits + modes->accumBlueBits + modes->accumAlphaBits; #if defined(__GL_ALIGNED_BUFFERS) /* initialize pixel alignments (for more details see context.h) */ glPriv->xAlignment = 1; glPriv->yAlignment = 1; #endif glxPriv->swapBuffers = __glXFBMemSwapBuffers; glPriv->yInverted = GL_TRUE; /* Y is upside-down */ if (modes->doubleBufferMode) { if (modes->colorIndexMode) { __glXInitFB(&glPriv->frontBuffer, glPriv, modes->indexBits); __glXInitMem(&glPriv->backBuffer, glPriv, modes->indexBits); } else { __glXInitFB(&glPriv->frontBuffer, glPriv, rgbBits); __glXInitMem(&glPriv->backBuffer, glPriv, rgbBits); } } else { if (modes->colorIndexMode) { __glXInitFB(&glPriv->frontBuffer, glPriv, modes->indexBits); } else { __glXInitFB(&glPriv->frontBuffer, glPriv, rgbBits); } } #if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0) if (modes->maxAuxBuffers > 0) { GLint i; for (i=0; i < modes->maxAuxBuffers; i++) { if (modes->colorIndexMode) { __glXInitMem(&glPriv->auxBuffer[i], glPriv, modes->indexBits); } else { __glXInitMem(&glPriv->auxBuffer[i], glPriv, rgbBits); } } } #endif if (modes->haveAccumBuffer) { __glXInitMem(&glPriv->accumBuffer, glPriv, accumBits); } if (modes->haveDepthBuffer) { __glXInitMem(&glPriv->depthBuffer, glPriv, modes->depthBits); } if (modes->haveStencilBuffer) { __glXInitMem(&glPriv->stencilBuffer, glPriv, modes->stencilBits); } } void __glXPixInitDrawable(__GLXdrawablePrivate *glxPriv, __GLcontextModes *modes) { __GLdrawablePrivate *glPriv; GLint rgbBits; GLint accumBits; assert(glxPriv->pGlxPixmap); glPriv = &glxPriv->glPriv; rgbBits = modes->rgbBits; accumBits = modes->accumRedBits + modes->accumGreenBits + modes->accumBlueBits + modes->accumAlphaBits; #if defined(__GL_ALIGNED_BUFFERS) /* initialize pixel alignments (for more details see context.h) */ glPriv->xAlignment = 1; glPriv->yAlignment = 1; #endif glxPriv->swapBuffers = (GLboolean (*)(__GLXdrawablePrivate *))__glXNop; glPriv->yInverted = GL_FALSE; if (modes->doubleBufferMode) { if (modes->colorIndexMode) { __glXInitPix(&glPriv->frontBuffer, glPriv, rgbBits, glxPriv->drawId, glxPriv->pGlxPixmap); __glXInitMem(&glPriv->backBuffer, glPriv, modes->indexBits); } else { __glXInitPix(&glPriv->frontBuffer, glPriv, rgbBits, glxPriv->drawId, glxPriv->pGlxPixmap); __glXInitMem(&glPriv->backBuffer, glPriv, rgbBits); } } else { if (modes->colorIndexMode) { __glXInitPix(&glPriv->frontBuffer, glPriv, rgbBits, glxPriv->drawId, glxPriv->pGlxPixmap); } else { __glXInitPix(&glPriv->frontBuffer, glPriv, rgbBits, glxPriv->drawId, glxPriv->pGlxPixmap); } } #if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0) if (modes->maxAuxBuffers > 0) { GLint i; for (i=0; i < modes->maxAuxBuffers; i++) { if (modes->colorIndexMode) { __glXInitMem(&glPriv->auxBuffer[i], glPriv, modes->indexBits); } else { __glXInitMem(&glPriv->auxBuffer[i], glPriv, rgbBits); } } } #endif if (modes->haveAccumBuffer) { __glXInitMem(&glPriv->accumBuffer, glPriv, accumBits); } if (modes->haveDepthBuffer) { __glXInitMem(&glPriv->depthBuffer, glPriv, modes->depthBits); } if (modes->haveStencilBuffer) { __glXInitMem(&glPriv->stencilBuffer, glPriv, modes->stencilBits); } } #define __GLX_SET_ACCEL_BUFFER_MASK(bm) \ if (status == GL_FALSE) return GL_FALSE; \ if (status == GL_TRUE) accelBufferMask |= bm; \ /* for __GL_BUFFER_FALLBACK don't do anything */ GLboolean __glXResizeBuffers(__GLdrawablePrivate *glPriv, GLint x, GLint y, GLuint width, GLuint height) { __GLcontextModes *modes; __GLdrawableRegion *glRegion; GLboolean status; GLuint accelBufferMask; modes = glPriv->modes; accelBufferMask = 0; status = (*glPriv->frontBuffer.resize)(&glPriv->frontBuffer, x, y, width, height, glPriv, __GL_FRONT_BUFFER_MASK); __GLX_SET_ACCEL_BUFFER_MASK(__GL_FRONT_BUFFER_MASK); if (modes->doubleBufferMode) { status = (*glPriv->backBuffer.resize)(&glPriv->backBuffer, x, y, width, height, glPriv, __GL_BACK_BUFFER_MASK); __GLX_SET_ACCEL_BUFFER_MASK(__GL_BACK_BUFFER_MASK); } #if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0) if (modes->maxAuxBuffers > 0) { GLint i; for (i=0; i < modes->maxAuxBuffers; i++) { status = (*glPriv->auxBuffers[i].resize)(&glPriv->auxBuffer[i], x, y, width, height, glPriv, __GL_AUX_BUFFER_MASK(i)); __GLX_SET_ACCEL_BUFFER_MASK(__GL_AUX_BUFFER_MASK(i)); } } #endif if (modes->haveAccumBuffer) { status = (*glPriv->accumBuffer.resize)(&glPriv->accumBuffer, x, y, width, height, glPriv, __GL_ACCUM_BUFFER_MASK); __GLX_SET_ACCEL_BUFFER_MASK(__GL_ACCUM_BUFFER_MASK); } if (modes->haveDepthBuffer) { status = (*glPriv->depthBuffer.resize)(&glPriv->depthBuffer, x, y, width, height, glPriv, __GL_DEPTH_BUFFER_MASK); __GLX_SET_ACCEL_BUFFER_MASK(__GL_DEPTH_BUFFER_MASK); } if (modes->haveStencilBuffer) { status = (*glPriv->stencilBuffer.resize)(&glPriv->stencilBuffer, x, y, width, height, glPriv, __GL_STENCIL_BUFFER_MASK); __GLX_SET_ACCEL_BUFFER_MASK(__GL_STENCIL_BUFFER_MASK); } glPriv->accelBufferMask = accelBufferMask; /* finally, update the ownership region */ glRegion = &glPriv->ownershipRegion; glRegion->numRects = 1; glRegion->rects[0].x0 = 0; glRegion->rects[0].y0 = 0; glRegion->rects[0].x1 = width; glRegion->rects[0].y1 = height; return GL_TRUE; } void __glXFreeBuffers(__GLXdrawablePrivate *glxPriv) { __GLdrawablePrivate *glPriv = &glxPriv->glPriv; #if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0) __GLcontextModes *modes = glPriv->modes; #endif if (glPriv->frontBuffer.free) { (*glPriv->frontBuffer.free)(&glPriv->frontBuffer, glPriv); } if (glPriv->backBuffer.free) { (*glPriv->backBuffer.free)(&glPriv->backBuffer, glPriv); } #if defined(__GL_MAX_AUXBUFFERS) && (__GL_MAX_AUXBUFFERS > 0) if (modes->maxAuxBuffers > 0) { GLint i; for (i=0; i < modes->maxAuxBuffers; i++) { if (glPriv->auxBuffer[i].free) { (*glPriv->auxBuffer[i].free)(&glPriv->auxBuffer[i], glPriv); } } } #endif if (glPriv->accumBuffer.free) { (*glPriv->accumBuffer.free)(&glPriv->accumBuffer, glPriv); } if (glPriv->depthBuffer.free) { (*glPriv->depthBuffer.free)(&glPriv->depthBuffer, glPriv); } if (glPriv->stencilBuffer.free) { (*glPriv->stencilBuffer.free)(&glPriv->stencilBuffer, glPriv); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxbuf.h0000644000000000000000000000457213614532331017337 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _glxbuf_h_ #define _glxbuf_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ extern void __glXFBInitDrawable(__GLXdrawablePrivate *glxPriv, __GLcontextModes *modes); extern void __glXPixInitDrawable(__GLXdrawablePrivate *glxPriv, __GLcontextModes *modes); extern GLboolean __glXResizeBuffers(__GLdrawablePrivate *glPriv, GLint x, GLint y, GLuint width, GLuint height); extern void __glXFreeBuffers(__GLXdrawablePrivate *glxPriv); extern void __glXUpdatePalette(__GLXdrawablePrivate *); #endif /* _glxbuf_h_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxcmds.c0000644000000000000000000016665013614532331017512 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #define FONT_PCF #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "glxserver.h" #include #include #include "g_disptab.h" #include #include #include "g_disptab_EXT.h" #include "glximports.h" #include "glxutil.h" #include "glxext.h" #include "glcontextmodes.h" /************************************************************************/ static __GLimports imports = { __glXImpMalloc, __glXImpCalloc, __glXImpRealloc, __glXImpFree, __glXImpWarning, __glXImpFatal, __glXImpGetenv, __glXImpAtoi, __glXImpSprintf, __glXImpFopen, __glXImpFclose, __glXImpFprintf, __glXImpGetDrawablePrivate, __glXImpGetReadablePrivate, NULL }; static int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); static int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); static int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); static int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); static int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc); static int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc); static int __glxQueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc); static int __glxDestroyHyperpipeConfigSGIX (__GLXclientState *cl, GLbyte *pc); static int __glxQueryHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc); static int __glxHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc); /************************************************************************/ /** * Create a GL context with the given properties. This routine is used * to implement \c glXCreateContext, \c glXCreateNewContext, and * \c glXCreateContextWithConfigSGIX. This works becuase of the hack way * that GLXFBConfigs are implemented. Basically, the FBConfigID is the * same as the VisualID. */ int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, GLXContextID shareList, VisualID visual, GLuint screen, GLboolean isDirect) { ClientPtr client = cl->client; VisualPtr pVisual; ScreenPtr pScreen; __GLXcontext *glxc, *shareglxc; __GLcontextModes *modes; __GLXscreenInfo *pGlxScreen; __GLinterface *shareGC; GLint i; LEGAL_NEW_RESOURCE(gcId, client); /* ** Check if screen exists. */ if (screen >= screenInfo.numScreens) { client->errorValue = screen; return BadValue; } pScreen = screenInfo.screens[screen]; pGlxScreen = &__glXActiveScreens[screen]; /* ** Check if the visual ID is valid for this screen. */ pVisual = pScreen->visuals; for (i = 0; i < pScreen->numVisuals; i++, pVisual++) { if (pVisual->vid == visual) { break; } } if (i == pScreen->numVisuals) { client->errorValue = visual; return BadValue; } /* ** Get configuration of the visual. This assumes that the ** glXActiveScreens structure contains visual configurations only for the ** subset of Visuals that are supported by this implementation of the ** OpenGL. */ modes = _gl_context_modes_find_visual( pGlxScreen->modes, visual ); if (modes == NULL) { /* ** Visual not support on this screen by this OpenGL implementation. */ client->errorValue = visual; return BadValue; } /* ** Find the display list space that we want to share. ** ** NOTE: In a multithreaded X server, we would need to keep a reference ** count for each display list so that if one client detroyed a list that ** another client was using, the list would not really be freed until it ** was no longer in use. Since this sample implementation has no support ** for multithreaded servers, we don't do this. */ if (shareList == None) { shareGC = 0; } else { shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes); if (!shareglxc) { client->errorValue = shareList; return __glXBadContext; } if (shareglxc->isDirect) { /* ** NOTE: no support for sharing display lists between direct ** contexts, even if they are in the same address space. */ #if 0 /* Disabling this code seems to allow shared display lists * and texture objects to work. We'll leave it disabled for now. */ client->errorValue = shareList; return BadMatch; #endif } else { /* ** Create an indirect context regardless of what the client asked ** for; this way we can share display list space with shareList. */ isDirect = GL_FALSE; } shareGC = shareglxc->gc; } /* ** Allocate memory for the new context */ glxc = (__GLXcontext *) malloc(sizeof(__GLXcontext)); if (!glxc) { return BadAlloc; } memset(glxc, 0, sizeof(__GLXcontext)); /* ** Initially, setup the part of the context that could be used by ** a GL core that needs windowing information (e.g., Mesa). */ glxc->pScreen = pScreen; glxc->pGlxScreen = pGlxScreen; glxc->pVisual = pVisual; glxc->modes = modes; if (!isDirect) { /* ** Allocate a GL context */ imports.other = (void *)glxc; glxc->gc = (*pGlxScreen->createContext)(&imports, glxc->modes, shareGC); if (!glxc->gc) { free(glxc); client->errorValue = gcId; return BadAlloc; } } else { /* ** Don't need local GL context for a direct context. */ glxc->gc = 0; } /* ** Register this context as a resource. */ if (!AddResource(gcId, __glXContextRes, (void *)glxc)) { if (!isDirect) { (*glxc->gc->exports.destroyContext)((__GLcontext *)glxc->gc); } free(glxc); client->errorValue = gcId; return BadAlloc; } /* ** Finally, now that everything is working, setup the rest of the ** context. */ glxc->id = gcId; glxc->share_id = shareList; glxc->idExists = GL_TRUE; glxc->isCurrent = GL_FALSE; glxc->isDirect = isDirect; glxc->renderMode = GL_RENDER; return Success; } int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) { xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; return DoCreateContext( cl, req->context, req->shareList, req->visual, req->screen, req->isDirect ); } int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc) { xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, req->screen, req->isDirect ); } int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) { xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc; return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, req->screen, req->isDirect ); } /* ** Destroy a GL context as an X resource. */ int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; GLXContextID gcId = req->context; __GLXcontext *glxc; glxc = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes); if (glxc) { /* ** Just free the resource; don't actually destroy the context, ** because it might be in use. The ** destroy method will be called by the resource destruction routine ** if necessary. */ FreeResourceByType(gcId, __glXContextRes, FALSE); return Success; } else { client->errorValue = gcId; return __glXBadContext; } } /*****************************************************************************/ /* ** For each client, the server keeps a table of all the contexts that are ** current for that client (each thread of a client may have its own current ** context). These routines add, change, and lookup contexts in the table. */ /* ** Add a current context, and return the tag that will be used to refer to it. */ static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc) { int i; int num = cl->numCurrentContexts; __GLXcontext **table = cl->currentContexts; if (!glxc) return -1; /* ** Try to find an empty slot and use it. */ for (i=0; i < num; i++) { if (!table[i]) { table[i] = glxc; return i+1; } } /* ** Didn't find a free slot, so we'll have to grow the table. */ if (!num) { table = (__GLXcontext **) malloc(sizeof(__GLXcontext *)); } else { table = (__GLXcontext **) realloc(table, (num+1)*sizeof(__GLXcontext *)); } table[num] = glxc; cl->currentContexts = table; cl->numCurrentContexts++; return num+1; } /* ** Given a tag, change the current context for the corresponding entry. */ static void ChangeCurrentContext(__GLXclientState *cl, __GLXcontext *glxc, GLXContextTag tag) { __GLXcontext **table = cl->currentContexts; table[tag-1] = glxc; } /* ** For this implementation we have chosen to simply use the index of the ** context's entry in the table as the context tag. A tag must be greater ** than 0. */ __GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag) { int num = cl->numCurrentContexts; if (tag < 1 || tag > num) { return 0; } else { return cl->currentContexts[tag-1]; } } /*****************************************************************************/ static void StopUsingContext(__GLXcontext *glxc) { if (glxc) { if (glxc == __glXLastContext) { /* Tell server GL library */ __glXLastContext = 0; } glxc->isCurrent = GL_FALSE; if (!glxc->idExists) { __glXFreeContext(glxc); } } } static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc) { glxc->isCurrent = GL_TRUE; } /*****************************************************************************/ /* ** Make an OpenGL context and drawable current. */ int __glXMakeCurrent(__GLXclientState *cl, GLbyte *pc) { xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; return DoMakeCurrent( cl, req->drawable, req->drawable, req->context, req->oldContextTag ); } int __glXMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) { xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; return DoMakeCurrent( cl, req->drawable, req->readdrawable, req->context, req->oldContextTag ); } int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) { xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; return DoMakeCurrent( cl, req->drawable, req->readable, req->context, req->oldContextTag ); } /** * Given a drawable ID, get the associated drawable and / or pixmap. * * If the specified drawable ID is not a pixmap, \c ppPixmap will be set * to \c NULL on return. In either case, \c ppDraw will be set to a drawable. * In the case where the drawable ID is a pixmap, \c ppDraw will be set to * the drawable associated with that pixmap. * * \param glxc Associated GLX context. * \param drawId ID of the drawable. * \param ppDraw Location to store the pointer to the drawable. * \param ppPixmap Location to store the pointer to the pixmap. * \param client Pointer to the client state. * \return Zero is returned on success. Otherwise a GLX / X11 protocol error * is returned. * * \notes This function will need some modification when support pbuffers * is added. */ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId, DrawablePtr *ppDraw, __GLXpixmap **ppPixmap, ClientPtr client ) { DrawablePtr pDraw; __GLXpixmap *drawPixmap = NULL; pDraw = (DrawablePtr) LookupDrawable(drawId, client); if (pDraw) { if (pDraw->type == DRAWABLE_WINDOW) { /* ** Drawable is an X Window. */ WindowPtr pWin = (WindowPtr)pDraw; VisualID vid = wVisual(pWin); /* ** Check if window and context are similar. */ if ((vid != glxc->pVisual->vid) || (pWin->drawable.pScreen != glxc->pScreen)) { client->errorValue = drawId; return BadMatch; } } else { /* ** An X Pixmap is not allowed as a parameter (a GLX Pixmap ** is, but it must first be created with glxCreateGLXPixmap). */ client->errorValue = drawId; return __glXBadDrawable; } } else { drawPixmap = (__GLXpixmap *) LookupIDByType(drawId, __glXPixmapRes); if (drawPixmap) { /* ** Check if pixmap and context are similar. */ if (drawPixmap->pScreen != glxc->pScreen || drawPixmap->modes->visualID != glxc->modes->visualID) { client->errorValue = drawId; return BadMatch; } pDraw = drawPixmap->pDraw; } else { /* ** Drawable is neither a Window nor a GLXPixmap. */ client->errorValue = drawId; return __glXBadDrawable; } } *ppPixmap = drawPixmap; *ppDraw = pDraw; return 0; } int DoMakeCurrent( __GLXclientState *cl, GLXDrawable drawId, GLXDrawable readId, GLXContextID contextId, GLXContextTag tag ) { ClientPtr client = cl->client; DrawablePtr pDraw; DrawablePtr pRead; xGLXMakeCurrentReply reply = {0}; __GLXpixmap *drawPixmap = NULL; __GLXpixmap *readPixmap = NULL; __GLXcontext *glxc, *prevglxc; __GLinterface *gc, *prevgc; __GLXdrawablePrivate *drawPriv = NULL; __GLXdrawablePrivate *readPriv = NULL; GLint error; GLuint mask; /* ** If one is None and the other isn't, it's a bad match. */ mask = (drawId == None) ? (1 << 0) : 0; mask |= (readId == None) ? (1 << 1) : 0; mask |= (contextId == None) ? (1 << 2) : 0; if ( (mask != 0x00) && (mask != 0x07) ) { return BadMatch; } /* ** Lookup old context. If we have one, it must be in a usable state. */ if (tag != 0) { prevglxc = __glXLookupContextByTag(cl, tag); if (!prevglxc) { /* ** Tag for previous context is invalid. */ return __glXBadContextTag; } if (prevglxc->renderMode != GL_RENDER) { /* Oops. Not in render mode render. */ client->errorValue = prevglxc->id; return __glXBadContextState; } prevgc = prevglxc->gc; } else { prevglxc = 0; prevgc = 0; } /* ** Lookup new context. It must not be current for someone else. */ if (contextId != None) { int status; glxc = (__GLXcontext *) LookupIDByType(contextId, __glXContextRes); if (!glxc) { client->errorValue = contextId; return __glXBadContext; } if ((glxc != prevglxc) && glxc->isCurrent) { /* Context is current to somebody else */ return BadAccess; } gc = glxc->gc; assert( drawId != None ); assert( readId != None ); status = GetDrawableOrPixmap( glxc, drawId, & pDraw, & drawPixmap, client ); if ( status != 0 ) { return status; } if ( readId != drawId ) { status = GetDrawableOrPixmap( glxc, readId, & pRead, & readPixmap, client ); if ( status != 0 ) { return status; } } else { pRead = pDraw; } /* FIXME: Finish refactoring this. - idr */ /* get the drawable private */ if (pDraw) { drawPriv = __glXGetDrawablePrivate(pDraw, drawId, glxc->modes); if (drawPriv == NULL) { return __glXBadDrawable; } } if (pRead != pDraw) { readPriv = __glXGetDrawablePrivate(pRead, readId, glxc->modes); if (readPriv == NULL) { return __glXBadDrawable; } } else { readPriv = drawPriv; } } else { /* Switching to no context. Ignore new drawable. */ glxc = 0; gc = 0; pDraw = 0; pRead = 0; } if (prevglxc) { /* ** Flush the previous context if needed. */ if (__GLX_HAS_UNFLUSHED_CMDS(prevglxc)) { if (__glXForceCurrent(cl, tag, (int *)&error)) { glFlush(); __GLX_NOTE_FLUSHED_CMDS(prevglxc); } else { return error; } } /* ** Make the previous context not current. */ if (!(*prevgc->exports.loseCurrent)((__GLcontext *)prevgc)) { return __glXBadContext; } __glXDeassociateContext(prevglxc); } if ((glxc != 0) && !glxc->isDirect) { glxc->drawPriv = drawPriv; glxc->readPriv = readPriv; __glXCacheDrawableSize(drawPriv); /* make the context current */ if (!(*gc->exports.makeCurrent)((__GLcontext *)gc)) { glxc->drawPriv = NULL; glxc->readPriv = NULL; return __glXBadContext; } /* resize the buffers */ if (!__glXResizeDrawableBuffers(drawPriv)) { /* could not do initial resize. make current failed */ (*gc->exports.loseCurrent)((__GLcontext *)gc); glxc->drawPriv = NULL; glxc->readPriv = NULL; return __glXBadContext; } glxc->isCurrent = GL_TRUE; __glXAssociateContext(glxc); assert(drawPriv->drawGlxc == glxc); assert(readPriv->readGlxc == glxc); } if (prevglxc) { if (prevglxc->drawPixmap) { if (prevglxc->readPixmap && prevglxc->drawPixmap != prevglxc->readPixmap) { /* ** The previous drawable was a glx pixmap, release it. */ prevglxc->readPixmap->refcnt--; if (!prevglxc->readPixmap->idExists && !prevglxc->readPixmap->refcnt) { PixmapPtr pPixmap = (PixmapPtr) prevglxc->readPixmap->pDraw; /* ** The DestroyPixmap routine should decrement the ** refcount of the X pixmap and free only if it's zero. */ (*prevglxc->readPixmap->pScreen->DestroyPixmap)(pPixmap); free(prevglxc->readPixmap); } } /* ** The previous drawable was a glx pixmap, release it. */ prevglxc->drawPixmap->refcnt--; if (!prevglxc->drawPixmap->idExists && !prevglxc->drawPixmap->refcnt) { PixmapPtr pPixmap = (PixmapPtr) prevglxc->drawPixmap->pDraw; /* ** The DestroyPixmap routine should decrement the ** refcount of the X pixmap and free only if it's zero. */ (*prevglxc->drawPixmap->pScreen->DestroyPixmap)(pPixmap); free(prevglxc->drawPixmap); } prevglxc->drawPixmap = NULL; } ChangeCurrentContext(cl, glxc, tag); StopUsingContext(prevglxc); } else { tag = AddCurrentContext(cl, glxc); } if (glxc) { if (drawPixmap) { drawPixmap->refcnt++; glxc->drawPixmap = drawPixmap; } if (readPixmap && (readPixmap != drawPixmap)) { readPixmap->refcnt++; glxc->readPixmap = readPixmap; } StartUsingContext(cl, glxc); reply.contextTag = tag; } else { reply.contextTag = 0; } reply.length = 0; reply.type = X_Reply; reply.sequenceNumber = client->sequence; if (client->swapped) { __glXSwapMakeCurrentReply(client, &reply); } else { WriteToClient(client, sz_xGLXMakeCurrentReply, &reply); } return Success; } int __glXIsDirect(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; xGLXIsDirectReply reply = {0}; __GLXcontext *glxc; /* ** Find the GL context. */ glxc = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes); if (!glxc) { client->errorValue = req->context; return __glXBadContext; } reply.isDirect = glxc->isDirect; reply.length = 0; reply.type = X_Reply; reply.sequenceNumber = client->sequence; if (client->swapped) { __glXSwapIsDirectReply(client, &reply); } else { WriteToClient(client, sz_xGLXIsDirectReply, &reply); } return Success; } int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; xGLXQueryVersionReply reply = {0}; GLuint major, minor; major = req->majorVersion; minor = req->minorVersion; (void)major; (void)minor; memset(&reply, 0, sizeof(xGLXQueryVersionReply)); /* ** Server should take into consideration the version numbers sent by the ** client if it wants to work with older clients; however, in this ** implementation the server just returns its version number. */ reply.majorVersion = GLX_SERVER_MAJOR_VERSION; reply.minorVersion = GLX_SERVER_MINOR_VERSION; reply.length = 0; reply.type = X_Reply; reply.sequenceNumber = client->sequence; if (client->swapped) { __glXSwapQueryVersionReply(client, &reply); } else { WriteToClient(client, sz_xGLXQueryVersionReply, &reply); } return Success; } int __glXWaitGL(__GLXclientState *cl, GLbyte *pc) { xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc; int error; if (!__glXForceCurrent(cl, req->contextTag, &error)) { return error; } glFinish(); return Success; } int __glXWaitX(__GLXclientState *cl, GLbyte *pc) { xGLXWaitXReq *req = (xGLXWaitXReq *)pc; int error; if (!__glXForceCurrent(cl, req->contextTag, &error)) { return error; } /* ** In a multithreaded server that had separate X and GL threads, we would ** have to wait for the X thread to finish before returning. As it stands, ** this sample implementation only supports singlethreaded servers, and ** nothing needs to be done here. */ return Success; } int __glXCopyContext(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; GLXContextID source = req->source; GLXContextID dest = req->dest; GLXContextTag tag = req->contextTag; unsigned long mask = req->mask; __GLXcontext *src, *dst; int error; /* ** Check that each context exists. */ src = (__GLXcontext *) LookupIDByType(source, __glXContextRes); if (!src) { client->errorValue = source; return __glXBadContext; } dst = (__GLXcontext *) LookupIDByType(dest, __glXContextRes); if (!dst) { client->errorValue = dest; return __glXBadContext; } /* ** They must be in the same address space, and same screen. ** NOTE: no support for direct rendering contexts here. */ if (src->isDirect || dst->isDirect || (src->pGlxScreen != dst->pGlxScreen)) { client->errorValue = source; return BadMatch; } /* ** The destination context must not be current for any client. */ if (dst->isCurrent) { client->errorValue = dest; return BadAccess; } if (tag) { __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag); if (!tagcx) { return __glXBadContextTag; } if (tagcx != src) { /* ** This would be caused by a faulty implementation of the client ** library. */ return BadMatch; } /* ** In this case, glXCopyContext is in both GL and X streams, in terms ** of sequentiality. */ if (__glXForceCurrent(cl, tag, &error)) { /* ** Do whatever is needed to make sure that all preceding requests ** in both streams are completed before the copy is executed. */ glFinish(); __GLX_NOTE_FLUSHED_CMDS(tagcx); } else { return error; } } /* ** Issue copy. The only reason for failure is a bad mask. */ if (!(*dst->gc->exports.copyContext)((__GLcontext *)dst->gc, (__GLcontext *)src->gc, mask)) { client->errorValue = mask; return BadValue; } return Success; } int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap) { ClientPtr client = cl->client; xGLXGetVisualConfigsReply reply = {0}; __GLXscreenInfo *pGlxScreen; __GLcontextModes *modes; CARD32 buf[__GLX_TOTAL_CONFIG] = {0}; int p; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; if (screen >= screenInfo.numScreens) { /* The client library must send a valid screen number. */ client->errorValue = screen; return BadValue; } pGlxScreen = &__glXActiveScreens[screen]; reply.numVisuals = pGlxScreen->numUsableVisuals; reply.numProps = __GLX_TOTAL_CONFIG; reply.length = (pGlxScreen->numUsableVisuals * __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG) >> 2; reply.type = X_Reply; reply.sequenceNumber = client->sequence; if ( do_swap ) { __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.numVisuals); __GLX_SWAP_INT(&reply.numProps); } WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply); for ( modes = pGlxScreen->modes ; modes != NULL ; modes = modes->next ) { if (modes->visualID == 0) { /* not a usable visual */ continue; } p = 0; buf[p++] = modes->visualID; buf[p++] = _gl_convert_to_x_visual_type( modes->visualType ); buf[p++] = modes->rgbMode; buf[p++] = modes->redBits; buf[p++] = modes->greenBits; buf[p++] = modes->blueBits; buf[p++] = modes->alphaBits; buf[p++] = modes->accumRedBits; buf[p++] = modes->accumGreenBits; buf[p++] = modes->accumBlueBits; buf[p++] = modes->accumAlphaBits; buf[p++] = modes->doubleBufferMode; buf[p++] = modes->stereoMode; buf[p++] = modes->rgbBits; buf[p++] = modes->depthBits; buf[p++] = modes->stencilBits; buf[p++] = modes->numAuxBuffers; buf[p++] = modes->level; /* ** Add token/value pairs for extensions. */ buf[p++] = GLX_VISUAL_CAVEAT_EXT; buf[p++] = modes->visualRating; buf[p++] = GLX_TRANSPARENT_TYPE; buf[p++] = modes->transparentPixel; buf[p++] = GLX_TRANSPARENT_RED_VALUE; buf[p++] = modes->transparentRed; buf[p++] = GLX_TRANSPARENT_GREEN_VALUE; buf[p++] = modes->transparentGreen; buf[p++] = GLX_TRANSPARENT_BLUE_VALUE; buf[p++] = modes->transparentBlue; buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE; buf[p++] = modes->transparentAlpha; buf[p++] = GLX_TRANSPARENT_INDEX_VALUE; buf[p++] = modes->transparentIndex; if ( do_swap ) { __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); } WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, buf); } return Success; } int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) { xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; return DoGetVisualConfigs( cl, req->screen, GL_FALSE ); } #define __GLX_TOTAL_FBCONFIG_ATTRIBS (28) #define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2) /** * Send the set of GLXFBConfigs to the client. There is not currently * and interface into the driver on the server-side to get GLXFBConfigs, * so we "invent" some based on the \c __GLXvisualConfig structures that * the driver does supply. * * The reply format for both \c glXGetFBConfigs and \c glXGetFBConfigsSGIX * is the same, so this routine pulls double duty. */ int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap) { ClientPtr client = cl->client; xGLXGetFBConfigsReply reply = {0}; __GLXscreenInfo *pGlxScreen; CARD32 buf[__GLX_FBCONFIG_ATTRIBS_LENGTH]; int p; __GLcontextModes *modes; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; if (screen >= screenInfo.numScreens) { /* The client library must send a valid screen number. */ client->errorValue = screen; return BadValue; } pGlxScreen = &__glXActiveScreens[screen]; reply.numFBConfigs = pGlxScreen->numUsableVisuals; reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS; reply.length = (__GLX_FBCONFIG_ATTRIBS_LENGTH * reply.numFBConfigs); reply.type = X_Reply; reply.sequenceNumber = client->sequence; if ( do_swap ) { __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.numFBConfigs); __GLX_SWAP_INT(&reply.numAttribs); } WriteToClient(client, sz_xGLXGetFBConfigsReply, &reply); for ( modes = pGlxScreen->modes ; modes != NULL ; modes = modes->next ) { if (modes->visualID == 0) { /* not a usable visual */ continue; } p = 0; #define WRITE_PAIR(tag,value) \ do { buf[p++] = tag ; buf[p++] = value ; } while( 0 ) WRITE_PAIR( GLX_VISUAL_ID, modes->visualID ); WRITE_PAIR( GLX_FBCONFIG_ID, modes->visualID ); WRITE_PAIR( GLX_X_RENDERABLE, GL_TRUE ); WRITE_PAIR( GLX_RGBA, modes->rgbMode ); WRITE_PAIR( GLX_DOUBLEBUFFER, modes->doubleBufferMode ); WRITE_PAIR( GLX_STEREO, modes->stereoMode ); WRITE_PAIR( GLX_BUFFER_SIZE, modes->rgbBits ); WRITE_PAIR( GLX_LEVEL, modes->level ); WRITE_PAIR( GLX_AUX_BUFFERS, modes->numAuxBuffers ); WRITE_PAIR( GLX_RED_SIZE, modes->redBits ); WRITE_PAIR( GLX_GREEN_SIZE, modes->greenBits ); WRITE_PAIR( GLX_BLUE_SIZE, modes->blueBits ); WRITE_PAIR( GLX_ALPHA_SIZE, modes->alphaBits ); WRITE_PAIR( GLX_ACCUM_RED_SIZE, modes->accumRedBits ); WRITE_PAIR( GLX_ACCUM_GREEN_SIZE, modes->accumGreenBits ); WRITE_PAIR( GLX_ACCUM_BLUE_SIZE, modes->accumBlueBits ); WRITE_PAIR( GLX_ACCUM_ALPHA_SIZE, modes->accumAlphaBits ); WRITE_PAIR( GLX_DEPTH_SIZE, modes->depthBits ); WRITE_PAIR( GLX_STENCIL_SIZE, modes->stencilBits ); WRITE_PAIR( GLX_X_VISUAL_TYPE, modes->visualType ); /* ** Add token/value pairs for extensions. */ WRITE_PAIR( GLX_CONFIG_CAVEAT, modes->visualRating ); WRITE_PAIR( GLX_TRANSPARENT_TYPE, modes->transparentPixel ); WRITE_PAIR( GLX_TRANSPARENT_RED_VALUE, modes->transparentRed ); WRITE_PAIR( GLX_TRANSPARENT_GREEN_VALUE, modes->transparentGreen ); WRITE_PAIR( GLX_TRANSPARENT_BLUE_VALUE, modes->transparentBlue ); WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha ); WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex ); WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod ); if ( do_swap ) { __GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH); } WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_FBCONFIG_ATTRIBS_LENGTH, buf); } return Success; } int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc) { xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; return DoGetFBConfigs( cl, req->screen, GL_FALSE ); } int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) { xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; return DoGetFBConfigs( cl, req->screen, GL_FALSE ); } /* ** Create a GLX Pixmap from an X Pixmap. */ int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual, GLuint screenNum, XID pixmapId, XID glxpixmapId) { ClientPtr client = cl->client; DrawablePtr pDraw; ScreenPtr pScreen; VisualPtr pVisual; __GLXpixmap *pGlxPixmap; __GLXscreenInfo *pGlxScreen; __GLcontextModes *modes; int i; LEGAL_NEW_RESOURCE(glxpixmapId, client); pDraw = (DrawablePtr) LookupDrawable(pixmapId, client); if (!pDraw || pDraw->type != DRAWABLE_PIXMAP) { client->errorValue = pixmapId; return BadPixmap; } /* ** Check if screen of visual matches screen of pixmap. */ pScreen = pDraw->pScreen; if (screenNum != pScreen->myNum) { return BadMatch; } /* ** Find the VisualRec for this visual. */ pVisual = pScreen->visuals; for (i=0; i < pScreen->numVisuals; i++, pVisual++) { if (pVisual->vid == visual) { break; } } if (i == pScreen->numVisuals) { client->errorValue = visual; return BadValue; } /* ** Check if depth of visual matches depth of pixmap. */ if (pVisual->nplanes != pDraw->depth) { return BadMatch; } /* ** Get configuration of the visual. */ pGlxScreen = &__glXActiveScreens[screenNum]; modes = _gl_context_modes_find_visual( pGlxScreen->modes, visual ); if (modes == NULL) { /* ** Visual not support on this screen by this OpenGL implementation. */ client->errorValue = visual; return BadValue; } pGlxPixmap = (__GLXpixmap *) malloc(sizeof(__GLXpixmap)); if (!pGlxPixmap) { return BadAlloc; } if (!(AddResource(glxpixmapId, __glXPixmapRes, pGlxPixmap))) { return BadAlloc; } pGlxPixmap->pDraw = pDraw; pGlxPixmap->pGlxScreen = pGlxScreen; pGlxPixmap->pScreen = pScreen; pGlxPixmap->idExists = True; pGlxPixmap->refcnt = 0; pGlxPixmap->modes = modes; /* ** Bump the ref count on the X pixmap so it won't disappear. */ ((PixmapPtr) pDraw)->refcnt++; return Success; } int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) { xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; return DoCreateGLXPixmap( cl, req->visual, req->screen, req->pixmap, req->glxpixmap ); } int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc) { xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, req->pixmap, req->glxpixmap ); } int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) { xGLXCreateGLXPixmapWithConfigSGIXReq *req = (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, req->pixmap, req->glxpixmap ); } /** * Destroy a GLX pixmap. This function is used for both * \c glXDestroyGLXPixmap and \c glXDestroyPixmap. */ int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; XID glxpixmap = req->glxpixmap; /* ** Check if it's a valid GLX pixmap. */ if (!LookupIDByType(glxpixmap, __glXPixmapRes)) { client->errorValue = glxpixmap; return __glXBadPixmap; } FreeResource(glxpixmap, FALSE); return Success; } /*****************************************************************************/ /* ** NOTE: There is no portable implementation for swap buffers as of ** this time that is of value. Consequently, this code must be ** implemented by somebody other than SGI. */ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; DrawablePtr pDraw; xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; GLXContextTag tag = req->contextTag; XID drawId = req->drawable; __GLXpixmap *pGlxPixmap; __GLXcontext *glxc = NULL; int error; /* ** Check that the GLX drawable is valid. */ pDraw = (DrawablePtr) LookupDrawable(drawId, client); if (pDraw) { if (pDraw->type == DRAWABLE_WINDOW) { /* ** Drawable is an X window. */ } else { /* ** Drawable is an X pixmap, which is not allowed. */ client->errorValue = drawId; return __glXBadDrawable; } } else { pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, __glXPixmapRes); if (pGlxPixmap) { /* ** Drawable is a GLX pixmap. */ } else { /* ** Drawable is neither a X window nor a GLX pixmap. */ client->errorValue = drawId; return __glXBadDrawable; } } if (tag) { glxc = __glXLookupContextByTag(cl, tag); if (!glxc) { return __glXBadContextTag; } /* ** The calling thread is swapping its current drawable. In this case, ** glxSwapBuffers is in both GL and X streams, in terms of ** sequentiality. */ if (__glXForceCurrent(cl, tag, &error)) { /* ** Do whatever is needed to make sure that all preceding requests ** in both streams are completed before the swap is executed. */ glFinish(); __GLX_NOTE_FLUSHED_CMDS(glxc); } else { return error; } } if (pDraw) { __GLXdrawablePrivate *glxPriv; if (glxc) { glxPriv = __glXGetDrawablePrivate(pDraw, drawId, glxc->modes); if (glxPriv == NULL) { return __glXBadDrawable; } } else { glxPriv = __glXFindDrawablePrivate(drawId); if (glxPriv == NULL) { /* This is a window we've never seen before, do nothing */ return Success; } } if ((*glxPriv->swapBuffers)(glxPriv) == GL_FALSE) { return __glXBadDrawable; } } return Success; } int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; __GLXcontext *ctx; xGLXQueryContextInfoEXTReq *req; xGLXQueryContextInfoEXTReply reply = {0}; int nProps; int *sendBuf, *pSendBuf; int nReplyBytes; req = (xGLXQueryContextInfoEXTReq *)pc; ctx = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes); if (!ctx) { client->errorValue = req->context; return __glXBadContext; } nProps = 3; reply.length = nProps << 1; reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.n = nProps; nReplyBytes = reply.length << 2; sendBuf = (int *)malloc((size_t)nReplyBytes); if (sendBuf == NULL) { return __glXBadContext; /* XXX: Is this correct? */ } pSendBuf = sendBuf; *pSendBuf++ = GLX_SHARE_CONTEXT_EXT; *pSendBuf++ = (int)(ctx->share_id); *pSendBuf++ = GLX_VISUAL_ID_EXT; *pSendBuf++ = (int)(ctx->pVisual->vid); *pSendBuf++ = GLX_SCREEN_EXT; *pSendBuf++ = (int)(ctx->pScreen->myNum); if (client->swapped) { __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf); } else { WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply); WriteToClient(client, nReplyBytes, sendBuf); } free((char *)sendBuf); return Success; } /************************************************************************/ /* ** Render and Renderlarge are not in the GLX API. They are used by the GLX ** client library to send batches of GL rendering commands. */ /* ** Execute all the drawing commands in a request. */ int __glXRender(__GLXclientState *cl, GLbyte *pc) { xGLXRenderReq *req; ClientPtr client= cl->client; int left, cmdlen, error; int commandsDone; CARD16 opcode; __GLXrenderHeader *hdr; __GLXcontext *glxc; /* ** NOTE: much of this code also appears in the byteswapping version of this ** routine, __glXSwapRender(). Any changes made here should also be ** duplicated there. */ req = (xGLXRenderReq *) pc; glxc = __glXForceCurrent(cl, req->contextTag, &error); if (!glxc) { return error; } commandsDone = 0; pc += sz_xGLXRenderReq; left = (req->length << 2) - sz_xGLXRenderReq; while (left > 0) { __GLXrenderSizeData *entry; int extra = 0; void (* proc)(GLbyte *); /* ** Verify that the header length and the overall length agree. ** Also, each command must be word aligned. */ hdr = (__GLXrenderHeader *) pc; cmdlen = hdr->length; opcode = hdr->opcode; if (left < cmdlen) return BadLength; /* ** Check for core opcodes and grab entry data. */ if ( (opcode >= __GLX_MIN_RENDER_OPCODE) && (opcode <= __GLX_MAX_RENDER_OPCODE) ) { entry = &__glXRenderSizeTable[opcode]; proc = __glXRenderTable[opcode]; #if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) { entry = &__glXRenderSizeTable_EXT[opcode - __GLX_MIN_RENDER_OPCODE_EXT]; proc = __glXRenderTable_EXT[opcode - __GLX_MIN_RENDER_OPCODE_EXT]; #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ } else { client->errorValue = commandsDone; return __glXBadRenderRequest; } if (!entry->bytes) { /* unused opcode */ client->errorValue = commandsDone; return __glXBadRenderRequest; } if (cmdlen < entry->bytes) { return BadLength; } if (entry->varsize) { /* variable size command */ extra = (*entry->varsize)(pc + __GLX_RENDER_HDR_SIZE, False, left - __GLX_RENDER_HDR_SIZE); if (extra < 0) { return BadLength; } } if (cmdlen != safe_pad(safe_add(entry->bytes, extra))) { return BadLength; } /* ** Skip over the header and execute the command. We allow the ** caller to trash the command memory. This is useful especially ** for things that require double alignment - they can just shift ** the data towards lower memory (trashing the header) by 4 bytes ** and achieve the required alignment. */ (*proc)(pc + __GLX_RENDER_HDR_SIZE); pc += cmdlen; left -= cmdlen; commandsDone++; } __GLX_NOTE_UNFLUSHED_CMDS(glxc); return Success; } /* ** Execute a large rendering request (one that spans multiple X requests). */ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc) { xGLXRenderLargeReq *req; ClientPtr client= cl->client; GLuint dataBytes; void (*proc)(GLbyte *); __GLXrenderLargeHeader *hdr; __GLXcontext *glxc; int error; CARD16 opcode; /* ** NOTE: much of this code also appears in the byteswapping version of this ** routine, __glXSwapRenderLarge(). Any changes made here should also be ** duplicated there. */ REQUEST_AT_LEAST_SIZE(xGLXRenderLargeReq); req = (xGLXRenderLargeReq *) pc; glxc = __glXForceCurrent(cl, req->contextTag, &error); if (!glxc) { /* Reset in case this isn't 1st request. */ __glXResetLargeCommandStatus(cl); return error; } if (safe_pad(req->dataBytes) < 0) return BadLength; dataBytes = req->dataBytes; /* ** Check the request length. */ if ((req->length << 2) != safe_pad(dataBytes) + sz_xGLXRenderLargeReq) { client->errorValue = req->length; /* Reset in case this isn't 1st request. */ __glXResetLargeCommandStatus(cl); return BadLength; } pc += sz_xGLXRenderLargeReq; if (cl->largeCmdRequestsSoFar == 0) { __GLXrenderSizeData *entry; int extra = 0, cmdlen; int left = (req->length << 2) - sz_xGLXRenderLargeReq; /* ** This is the first request of a multi request command. ** Make enough space in the buffer, then copy the entire request. */ if (req->requestNumber != 1) { client->errorValue = req->requestNumber; return __glXBadLargeRequest; } if (dataBytes < __GLX_RENDER_LARGE_HDR_SIZE) return BadLength; hdr = (__GLXrenderLargeHeader *) pc; opcode = hdr->opcode; if ((cmdlen = safe_pad(hdr->length)) < 0) return BadLength; /* ** Check for core opcodes and grab entry data. */ if ( (opcode >= __GLX_MIN_RENDER_OPCODE) && (opcode <= __GLX_MAX_RENDER_OPCODE) ) { entry = &__glXRenderSizeTable[opcode]; #if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) { opcode -= __GLX_MIN_RENDER_OPCODE_EXT; entry = &__glXRenderSizeTable_EXT[opcode]; #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ } else { client->errorValue = opcode; return __glXBadLargeRequest; } if (!entry->bytes) { /* unused opcode */ client->errorValue = opcode; return __glXBadLargeRequest; } if (entry->varsize) { /* ** If it's a variable-size command (a command whose length must ** be computed from its parameters), all the parameters needed ** will be in the 1st request, so it's okay to do this. */ extra = (*entry->varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE, False, left - __GLX_RENDER_LARGE_HDR_SIZE); if (extra < 0) { return BadLength; } } /* the +4 is safe because we know entry.bytes is small */ if (cmdlen != safe_pad(safe_add(entry->bytes + 4, extra))) { return BadLength; } /* ** Make enough space in the buffer, then copy the entire request. */ if (cl->largeCmdBufSize < cmdlen) { if (!cl->largeCmdBuf) { cl->largeCmdBuf = (GLbyte *) malloc((size_t)cmdlen); } else { cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, (size_t)cmdlen); } if (!cl->largeCmdBuf) { return BadAlloc; } cl->largeCmdBufSize = cmdlen; } memcpy(cl->largeCmdBuf, pc, dataBytes); cl->largeCmdBytesSoFar = dataBytes; cl->largeCmdBytesTotal = cmdlen; cl->largeCmdRequestsSoFar = 1; cl->largeCmdRequestsTotal = req->requestTotal; return Success; } else { /* ** We are receiving subsequent (i.e. not the first) requests of a ** multi request command. */ int bytesSoFar; /* including this packet */ /* ** Check the request number and the total request count. */ if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) { client->errorValue = req->requestNumber; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; } if (req->requestTotal != cl->largeCmdRequestsTotal) { client->errorValue = req->requestTotal; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; } /* ** Check that we didn't get too much data. */ if ((bytesSoFar = safe_add(cl->largeCmdBytesSoFar, dataBytes)) < 0) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; } if (bytesSoFar > cl->largeCmdBytesTotal) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; } memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); cl->largeCmdBytesSoFar += dataBytes; cl->largeCmdRequestsSoFar++; if (req->requestNumber == cl->largeCmdRequestsTotal) { /* ** This is the last request; it must have enough bytes to complete ** the command. */ /* NOTE: the pad macro below is needed because the client library ** pads the total byte count, but not the per-request byte counts. ** The Protocol Encoding says the total byte count should not be ** padded, so a proposal will be made to the ARB to relax the ** padding constraint on the total byte count, thus preserving ** backward compatibility. Meanwhile, the padding done below ** fixes a bug that did not allow large commands of odd sizes to ** be accepted by the server. */ if (safe_pad(cl->largeCmdBytesSoFar) != cl->largeCmdBytesTotal) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; } hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf; opcode = hdr->opcode; /* ** Use the opcode to index into the procedure table. */ if ( (opcode >= __GLX_MIN_RENDER_OPCODE) && (opcode <= __GLX_MAX_RENDER_OPCODE) ) { proc = __glXRenderTable[opcode]; #if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) { opcode -= __GLX_MIN_RENDER_OPCODE_EXT; proc = __glXRenderTable_EXT[opcode]; #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ } else { client->errorValue = opcode; return __glXBadLargeRequest; } /* ** Skip over the header and execute the command. */ (*proc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE); __GLX_NOTE_UNFLUSHED_CMDS(glxc); /* ** Reset for the next RenderLarge series. */ __glXResetLargeCommandStatus(cl); } else { /* ** This is neither the first nor the last request. */ } return Success; } } extern RESTYPE __glXSwapBarrierRes; static int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc; XID drawable = req->drawable; int barrier = req->barrier; DrawablePtr pDraw = (DrawablePtr) LookupDrawable(drawable, client); int screen = pDraw->pScreen->myNum; if (pDraw && (pDraw->type == DRAWABLE_WINDOW)) { if (__glXSwapBarrierFuncs && __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc) { int ret = __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc(screen, drawable, barrier); if (ret == Success) { if (barrier) /* add source for cleanup when drawable is gone */ AddResource(drawable, __glXSwapBarrierRes, (void *)(intptr_t)screen); else /* delete source */ FreeResourceByType(drawable, __glXSwapBarrierRes, FALSE); } return ret; } } client->errorValue = drawable; return __glXBadDrawable; } static int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXQueryMaxSwapBarriersSGIXReq *req = (xGLXQueryMaxSwapBarriersSGIXReq *) pc; xGLXQueryMaxSwapBarriersSGIXReply reply = {0}; int screen = req->screen; if (__glXSwapBarrierFuncs && __glXSwapBarrierFuncs[screen].queryMaxSwapBarriersFunc) reply.max = __glXSwapBarrierFuncs[screen].queryMaxSwapBarriersFunc(screen); else reply.max = 0; reply.length = 0; reply.type = X_Reply; reply.sequenceNumber = client->sequence; if (client->swapped) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply.sequenceNumber); } WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, &reply); return Success; } #define GLX_BAD_HYPERPIPE_SGIX 92 static int __glxQueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXQueryHyperpipeNetworkSGIXReq * req = (xGLXQueryHyperpipeNetworkSGIXReq *) pc; xGLXQueryHyperpipeNetworkSGIXReply reply = {0}; int screen = req->screen; void *rdata = NULL; int length=0; int npipes=0; int n= 0; if (__glXHyperpipeFuncs && __glXHyperpipeFuncs[screen].queryHyperpipeNetworkFunc != NULL) { rdata = (__glXHyperpipeFuncs[screen].queryHyperpipeNetworkFunc(screen, &npipes, &n)); } length = __GLX_PAD(n) >> 2; reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.length = length; reply.n = n; reply.npipes = npipes; if (client->swapped) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.n); __GLX_SWAP_INT(&reply.npipes); } WriteToClient(client, sz_xGLXQueryHyperpipeNetworkSGIXReply, &reply); WriteToClient(client, length << 2, rdata); return Success; } static int __glxDestroyHyperpipeConfigSGIX (__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXDestroyHyperpipeConfigSGIXReq * req = (xGLXDestroyHyperpipeConfigSGIXReq *) pc; xGLXDestroyHyperpipeConfigSGIXReply reply = {0}; int screen = req->screen; int success = GLX_BAD_HYPERPIPE_SGIX; int hpId ; hpId = req->hpId; if (__glXHyperpipeFuncs && __glXHyperpipeFuncs[screen].destroyHyperpipeConfigFunc != NULL) { success = __glXHyperpipeFuncs[screen].destroyHyperpipeConfigFunc(screen, hpId); } reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.length = __GLX_PAD(0) >> 2; reply.n = 0; reply.success = success; if (client->swapped) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply.sequenceNumber); } WriteToClient(client, sz_xGLXDestroyHyperpipeConfigSGIXReply, &reply); return Success; } static int __glxQueryHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXQueryHyperpipeConfigSGIXReq * req = (xGLXQueryHyperpipeConfigSGIXReq *) pc; xGLXQueryHyperpipeConfigSGIXReply reply = {0}; int screen = req->screen; void *rdata = NULL; int length; int npipes=0; int n= 0; int hpId; hpId = req->hpId; if (__glXHyperpipeFuncs && __glXHyperpipeFuncs[screen].queryHyperpipeConfigFunc != NULL) { rdata = __glXHyperpipeFuncs[screen].queryHyperpipeConfigFunc(screen, hpId,&npipes, &n); } length = __GLX_PAD(n) >> 2; reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.length = length; reply.n = n; reply.npipes = npipes; if (client->swapped) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.n); __GLX_SWAP_INT(&reply.npipes); } WriteToClient(client, sz_xGLXQueryHyperpipeConfigSGIXReply, &reply); WriteToClient(client, length << 2, rdata); return Success; } static int __glxHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXHyperpipeConfigSGIXReq * req = (xGLXHyperpipeConfigSGIXReq *) pc; xGLXHyperpipeConfigSGIXReply reply = {0}; int screen = req->screen; void *rdata; int npipes=0, networkId; int hpId=-1; networkId = (int)req->networkId; npipes = (int)req->npipes; rdata = (void *)(req +1); if (__glXHyperpipeFuncs && __glXHyperpipeFuncs[screen].hyperpipeConfigFunc != NULL) { __glXHyperpipeFuncs[screen].hyperpipeConfigFunc(screen,networkId, &hpId, &npipes, (void *) rdata); } reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.length = __GLX_PAD(0) >> 2; reply.n = 0; reply.npipes = npipes; reply.hpId = hpId; if (client->swapped) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.npipes); __GLX_SWAP_INT(&reply.hpId); } WriteToClient(client, sz_xGLXHyperpipeConfigSGIXReply, &reply); return Success; } /************************************************************************/ /* ** No support is provided for the vendor-private requests other than ** allocating the entry points in the dispatch table. */ int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc) { xGLXVendorPrivateReq *req; GLint vendorcode; req = (xGLXVendorPrivateReq *) pc; vendorcode = req->vendorCode; #ifndef __DARWIN__ switch( vendorcode ) { case X_GLvop_SampleMaskSGIS: glSampleMaskSGIS(*(GLfloat *)(pc + 4), *(GLboolean *)(pc + 8)); return Success; case X_GLvop_SamplePatternSGIS: glSamplePatternSGIS( *(GLenum *)(pc + 4)); return Success; case X_GLXvop_BindSwapBarrierSGIX: return __glXBindSwapBarrierSGIX(cl, pc); } #endif if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { (*__glXVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT]) (cl, (GLbyte*)req); return Success; } /* ** This sample implemention does not support any private requests. */ cl->client->errorValue = req->vendorCode; return __glXUnsupportedPrivateRequest; } int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) { xGLXVendorPrivateWithReplyReq *req; GLint vendorcode; req = (xGLXVendorPrivateWithReplyReq *) pc; vendorcode = req->vendorCode; switch (vendorcode) { case X_GLXvop_QueryContextInfoEXT: return __glXQueryContextInfoEXT(cl, pc); case X_GLXvop_MakeCurrentReadSGI: return __glXMakeCurrentReadSGI(cl, pc); case X_GLXvop_QueryMaxSwapBarriersSGIX: return __glXQueryMaxSwapBarriersSGIX(cl, pc); case X_GLXvop_QueryHyperpipeNetworkSGIX: return __glxQueryHyperpipeNetworkSGIX(cl, pc); case X_GLXvop_QueryHyperpipeConfigSGIX: return __glxQueryHyperpipeConfigSGIX(cl, pc); case X_GLXvop_DestroyHyperpipeConfigSGIX: return __glxDestroyHyperpipeConfigSGIX(cl, pc); case X_GLXvop_HyperpipeConfigSGIX: return __glxHyperpipeConfigSGIX(cl, pc); case X_GLXvop_GetFBConfigsSGIX: return __glXGetFBConfigsSGIX(cl, pc); case X_GLXvop_CreateContextWithConfigSGIX: return __glXCreateContextWithConfigSGIX(cl, pc); case X_GLXvop_CreateGLXPixmapWithConfigSGIX: return __glXCreateGLXPixmapWithConfigSGIX(cl, pc); default: break; } if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { return (*__glXVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT]) (cl, (GLbyte*)req); } cl->client->errorValue = vendorcode; return __glXUnsupportedPrivateRequest; } int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc; xGLXQueryExtensionsStringReply reply = {0}; GLuint screen; size_t n, length; const char *ptr; char *buf; screen = req->screen; /* ** Check if screen exists. */ if (screen >= screenInfo.numScreens) { client->errorValue = screen; return BadValue; } ptr = __glXActiveScreens[screen].GLXextensions; n = strlen(ptr) + 1; length = __GLX_PAD(n) >> 2; reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.length = length; reply.n = n; /* Allocate buffer to make sure it's a multiple of 4 bytes big.*/ buf = calloc(length, 4); if (buf == NULL) return BadAlloc; memcpy(buf, ptr, n); if (client->swapped) { glxSwapQueryExtensionsStringReply(client, &reply, buf); } else { WriteToClient(client, sz_xGLXQueryExtensionsStringReply,&reply); WriteToClient(client, (int)(length << 2), buf); } free(buf); return Success; } int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc; xGLXQueryServerStringReply reply = {0}; int name; GLuint screen; size_t n, length; const char *ptr; char *buf; name = req->name; screen = req->screen; /* ** Check if screen exists. */ if (screen >= screenInfo.numScreens) { client->errorValue = screen; return BadValue; } switch(name) { case GLX_VENDOR: ptr = __glXActiveScreens[screen].GLXvendor; break; case GLX_VERSION: ptr = __glXActiveScreens[screen].GLXversion; break; case GLX_EXTENSIONS: ptr = __glXActiveScreens[screen].GLXextensions; break; default: return BadValue; } n = strlen(ptr) + 1; length = __GLX_PAD(n) >> 2; reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.length = length; reply.n = n; if ((buf = calloc(length, 4)) == NULL) { return BadAlloc; } memcpy(buf, ptr, n); if (client->swapped) { glxSwapQueryServerStringReply(client, &reply, buf); } else { WriteToClient(client, sz_xGLXQueryServerStringReply, &reply); WriteToClient(client, (int)(length << 2), buf); } free(buf); return Success; } int __glXClientInfo(__GLXclientState *cl, GLbyte *pc) { xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc; const char *buf; cl->GLClientmajorVersion = req->major; cl->GLClientminorVersion = req->minor; if (cl->GLClientextensions) free(cl->GLClientextensions); buf = (const char *)(req+1); cl->GLClientextensions = xstrdup(buf); return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxcmdsswap.c0000644000000000000000000006500313614532331020373 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #define FONT_PCF #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxutil.h" #include #include #include #include #include #include #include "glxext.h" static int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); static int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); static int __glXSwapCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); static int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); /************************************************************************/ /* ** Byteswapping versions of GLX commands. In most cases they just swap ** the incoming arguments and then call the unswapped routine. For commands ** that have replies, a separate swapping routine for the reply is provided; ** it is called at the end of the unswapped routine. */ int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc) { xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->visual); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->shareList); return DoCreateContext( cl, req->context, req->shareList, req->visual, req->screen, req->isDirect ); } int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc) { xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->renderType); __GLX_SWAP_INT(&req->shareList); return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, req->screen, req->isDirect ); } int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) { xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->renderType); __GLX_SWAP_INT(&req->shareList); return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, req->screen, req->isDirect ); } int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc) { xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); return __glXDestroyContext(cl, pc); } int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc) { xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->drawable); __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->oldContextTag); return DoMakeCurrent( cl, req->drawable, req->drawable, req->context, req->oldContextTag ); } int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) { xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->drawable); __GLX_SWAP_INT(&req->readdrawable); __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->oldContextTag); return DoMakeCurrent( cl, req->drawable, req->readdrawable, req->context, req->oldContextTag ); } int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) { xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->drawable); __GLX_SWAP_INT(&req->readable); __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->oldContextTag); return DoMakeCurrent( cl, req->drawable, req->readable, req->context, req->oldContextTag ); } int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc) { xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); return __glXIsDirect(cl, pc); } int __glXSwapQueryVersion(__GLXclientState *cl, GLbyte *pc) { xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->majorVersion); __GLX_SWAP_INT(&req->minorVersion); return __glXQueryVersion(cl, pc); } int __glXSwapWaitGL(__GLXclientState *cl, GLbyte *pc) { xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); return __glXWaitGL(cl, pc); } int __glXSwapWaitX(__GLXclientState *cl, GLbyte *pc) { xGLXWaitXReq *req = (xGLXWaitXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); return __glXWaitX(cl, pc); } int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc) { xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->source); __GLX_SWAP_INT(&req->dest); __GLX_SWAP_INT(&req->mask); return __glXCopyContext(cl, pc); } int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) { xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&req->screen); return DoGetVisualConfigs( cl, req->screen, GL_TRUE ); } int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc) { xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&req->screen); return DoGetFBConfigs( cl, req->screen, GL_TRUE ); } int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) { xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&req->screen); return DoGetFBConfigs( cl, req->screen, GL_TRUE ); } int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) { xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->visual); __GLX_SWAP_INT(&req->pixmap); __GLX_SWAP_INT(&req->glxpixmap); return DoCreateGLXPixmap( cl, req->visual, req->screen, req->pixmap, req->glxpixmap ); } int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc) { xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->pixmap); __GLX_SWAP_INT(&req->glxpixmap); return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, req->pixmap, req->glxpixmap ); } int __glXSwapCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) { xGLXCreateGLXPixmapWithConfigSGIXReq *req = (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->pixmap); __GLX_SWAP_INT(&req->glxpixmap); return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, req->pixmap, req->glxpixmap ); } int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) { xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->glxpixmap); return __glXDestroyGLXPixmap(cl, pc); } int __glXSwapSwapBuffers(__GLXclientState *cl, GLbyte *pc) { xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); __GLX_SWAP_INT(&req->drawable); return __glXSwapBuffers(cl, pc); } int __glXSwapUseXFont(__GLXclientState *cl, GLbyte *pc) { xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); __GLX_SWAP_INT(&req->font); __GLX_SWAP_INT(&req->first); __GLX_SWAP_INT(&req->count); __GLX_SWAP_INT(&req->listBase); return __glXUseXFont(cl, pc); } int __glXSwapQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) { xGLXQueryExtensionsStringReq *req = NULL; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); return __glXQueryExtensionsString(cl, pc); } int __glXSwapQueryServerString(__GLXclientState *cl, GLbyte *pc) { xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->name); return __glXQueryServerString(cl, pc); } int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc) { xGLXClientInfoReq *req = (xGLXClientInfoReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->major); __GLX_SWAP_INT(&req->minor); __GLX_SWAP_INT(&req->numbytes); return __glXClientInfo(cl, pc); } int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) { xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); return __glXQueryContextInfoEXT(cl, pc); } /************************************************************************/ /* ** Swap replies. */ void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReply *reply) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->contextTag); WriteToClient(client, sz_xGLXMakeCurrentReply, reply); } void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply *reply) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); WriteToClient(client, sz_xGLXIsDirectReply, reply); } void __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply *reply) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->majorVersion); __GLX_SWAP_INT(&reply->minorVersion); WriteToClient(client, sz_xGLXQueryVersionReply, reply); } void glxSwapQueryExtensionsStringReply(ClientPtr client, xGLXQueryExtensionsStringReply *reply, char *buf) { int length = reply->length; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); WriteToClient(client, sz_xGLXQueryExtensionsStringReply, reply); __GLX_SWAP_INT_ARRAY((int *)buf, length); WriteToClient(client, length << 2, buf); } void glxSwapQueryServerStringReply(ClientPtr client, xGLXQueryServerStringReply *reply, char *buf) { int length = reply->length; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); WriteToClient(client, sz_xGLXQueryServerStringReply, reply); /** no swap is needed for an array of chars **/ /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */ WriteToClient(client, length << 2, buf); } void __glXSwapQueryContextInfoEXTReply(ClientPtr client, xGLXQueryContextInfoEXTReply *reply, int *buf) { int length = reply->length; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT(&reply->sequenceNumber); __GLX_SWAP_INT(&reply->length); __GLX_SWAP_INT(&reply->n); WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, reply); __GLX_SWAP_INT_ARRAY((int *)buf, length); WriteToClient(client, length << 2, buf); } /************************************************************************/ /* ** Render and Renderlarge are not in the GLX API. They are used by the GLX ** client library to send batches of GL rendering commands. */ int __glXSwapRender(__GLXclientState *cl, GLbyte *pc) { xGLXRenderReq *req; ClientPtr client= cl->client; int left, cmdlen, error; int commandsDone; CARD16 opcode; __GLXrenderHeader *hdr; __GLXcontext *cx; __GLX_DECLARE_SWAP_VARIABLES; /* ** NOTE: much of this code also appears in the nonswapping version of this ** routine, __glXRender(). Any changes made here should also be ** duplicated there. */ req = (xGLXRenderReq *) pc; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); cx = __glXForceCurrent(cl, req->contextTag, &error); if (!cx) { return error; } commandsDone = 0; pc += sz_xGLXRenderReq; left = (req->length << 2) - sz_xGLXRenderReq; while (left > 0) { __GLXrenderSizeData *entry; int extra = 0; void (* proc)(GLbyte *); /* ** Verify that the header length and the overall length agree. ** Also, each command must be word aligned. */ hdr = (__GLXrenderHeader *) pc; __GLX_SWAP_SHORT(&hdr->length); __GLX_SWAP_SHORT(&hdr->opcode); cmdlen = hdr->length; opcode = hdr->opcode; if (left < cmdlen) return BadLength; if ( (opcode >= __GLX_MIN_RENDER_OPCODE) && (opcode <= __GLX_MAX_RENDER_OPCODE) ) { entry = &__glXRenderSizeTable[opcode]; proc = __glXSwapRenderTable[opcode]; #if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) { int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT; entry = &__glXRenderSizeTable_EXT[index]; proc = __glXSwapRenderTable_EXT[index]; #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ } else { client->errorValue = commandsDone; return __glXBadRenderRequest; } if (!entry->bytes) { /* unused opcode */ client->errorValue = commandsDone; return __glXBadRenderRequest; } if (cmdlen < entry->bytes) { return BadLength; } if (entry->varsize) { /* variable size command */ extra = (*entry->varsize)(pc + __GLX_RENDER_HDR_SIZE, True, left - __GLX_RENDER_HDR_SIZE); if (extra < 0) { return BadLength; } } if (cmdlen != safe_pad(safe_add(entry->bytes, extra))) { return BadLength; } /* ** Skip over the header and execute the command. We allow the ** caller to trash the command memory. This is useful especially ** for things that require double alignment - they can just shift ** the data towards lower memory (trashing the header) by 4 bytes ** and achieve the required alignment. */ (*proc)(pc + __GLX_RENDER_HDR_SIZE); pc += cmdlen; left -= cmdlen; commandsDone++; } __GLX_NOTE_UNFLUSHED_CMDS(cx); return Success; } /* ** Execute a large rendering request (one that spans multiple X requests). */ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc) { xGLXRenderLargeReq *req; ClientPtr client= cl->client; size_t dataBytes; void (*proc)(GLbyte *); __GLXrenderLargeHeader *hdr; __GLXcontext *cx; int error; CARD16 opcode; __GLX_DECLARE_SWAP_VARIABLES; /* ** NOTE: much of this code also appears in the nonswapping version of this ** routine, __glXRenderLarge(). Any changes made here should also be ** duplicated there. */ REQUEST_AT_LEAST_SIZE(xGLXRenderLargeReq); req = (xGLXRenderLargeReq *) pc; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); __GLX_SWAP_INT(&req->dataBytes); __GLX_SWAP_SHORT(&req->requestNumber); __GLX_SWAP_SHORT(&req->requestTotal); cx = __glXForceCurrent(cl, req->contextTag, &error); if (!cx) { /* Reset in case this isn't 1st request. */ __glXResetLargeCommandStatus(cl); return error; } if (safe_pad(req->dataBytes) < 0) return BadLength; dataBytes = req->dataBytes; /* ** Check the request length. */ if ((req->length << 2) != safe_pad(dataBytes) + sz_xGLXRenderLargeReq) { client->errorValue = req->length; /* Reset in case this isn't 1st request. */ __glXResetLargeCommandStatus(cl); return BadLength; } pc += sz_xGLXRenderLargeReq; if (cl->largeCmdRequestsSoFar == 0) { __GLXrenderSizeData *entry; int extra = 0; int left = (req->length << 2) - sz_xGLXRenderLargeReq; size_t cmdlen; /* ** This is the first request of a multi request command. ** Make enough space in the buffer, then copy the entire request. */ if (req->requestNumber != 1) { client->errorValue = req->requestNumber; return __glXBadLargeRequest; } if (dataBytes < __GLX_RENDER_LARGE_HDR_SIZE) return BadLength; hdr = (__GLXrenderLargeHeader *) pc; __GLX_SWAP_INT(&hdr->length); __GLX_SWAP_INT(&hdr->opcode); opcode = hdr->opcode; if ((cmdlen = safe_pad(hdr->length)) < 0) return BadLength; if ( (opcode >= __GLX_MIN_RENDER_OPCODE) && (opcode <= __GLX_MAX_RENDER_OPCODE) ) { entry = &__glXRenderSizeTable[opcode]; proc = __glXSwapRenderTable[opcode]; #if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) { int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT; entry = &__glXRenderSizeTable_EXT[index]; proc = __glXSwapRenderTable_EXT[index]; #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ } else { client->errorValue = opcode; return __glXBadLargeRequest; } if (!entry->bytes) { /* unused opcode */ client->errorValue = opcode; return __glXBadLargeRequest; } if (entry->varsize) { /* ** If it's a variable-size command (a command whose length must ** be computed from its parameters), all the parameters needed ** will be in the 1st request, so it's okay to do this. */ extra = (*entry->varsize)(pc + __GLX_RENDER_LARGE_HDR_SIZE, True, left - __GLX_RENDER_LARGE_HDR_SIZE); if (extra < 0) { return BadLength; } } /* the +4 is safe because we know entry->bytes is small */ if (cmdlen != safe_pad(safe_add(entry->bytes + 4, extra))) { return BadLength; } /* ** Make enough space in the buffer, then copy the entire request. */ if (cl->largeCmdBufSize < cmdlen) { if (!cl->largeCmdBuf) { cl->largeCmdBuf = (GLbyte *) malloc(cmdlen); } else { cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen); } if (!cl->largeCmdBuf) { return BadAlloc; } cl->largeCmdBufSize = cmdlen; } memcpy(cl->largeCmdBuf, pc, dataBytes); cl->largeCmdBytesSoFar = dataBytes; cl->largeCmdBytesTotal = cmdlen; cl->largeCmdRequestsSoFar = 1; cl->largeCmdRequestsTotal = req->requestTotal; return Success; } else { /* ** We are receiving subsequent (i.e. not the first) requests of a ** multi request command. */ int bytesSoFar; /* including this packet */ /* ** Check the request number and the total request count. */ if (req->requestNumber != cl->largeCmdRequestsSoFar + 1) { client->errorValue = req->requestNumber; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; } if (req->requestTotal != cl->largeCmdRequestsTotal) { client->errorValue = req->requestTotal; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; } /* ** Check that we didn't get too much data. */ if ((bytesSoFar = safe_add(cl->largeCmdBytesSoFar, dataBytes)) < 0) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; } if (bytesSoFar > cl->largeCmdBytesTotal) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; } memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, dataBytes); cl->largeCmdBytesSoFar += dataBytes; cl->largeCmdRequestsSoFar++; if (req->requestNumber == cl->largeCmdRequestsTotal) { /* ** This is the last request; it must have enough bytes to complete ** the command. */ /* NOTE: the pad macro below is needed because the client library ** pads the total byte count, but not the per-request byte counts. ** The Protocol Encoding says the total byte count should not be ** padded, so a proposal will be made to the ARB to relax the ** padding constraint on the total byte count, thus preserving ** backward compatibility. Meanwhile, the padding done below ** fixes a bug that did not allow large commands of odd sizes to ** be accepted by the server. */ if (safe_pad(cl->largeCmdBytesSoFar) != cl->largeCmdBytesTotal) { client->errorValue = dataBytes; __glXResetLargeCommandStatus(cl); return __glXBadLargeRequest; } hdr = (__GLXrenderLargeHeader *) cl->largeCmdBuf; /* ** The opcode and length field in the header had already been ** swapped when the first request was received. */ /* ** Use the opcode to index into the procedure table. */ opcode = hdr->opcode; if ( (opcode >= __GLX_MIN_RENDER_OPCODE) && (opcode <= __GLX_MAX_RENDER_OPCODE) ) { proc = __glXSwapRenderTable[opcode]; #if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) { int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT; proc = __glXSwapRenderTable_EXT[index]; #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ } else { client->errorValue = opcode; return __glXBadLargeRequest; } /* ** Skip over the header and execute the command. */ (*proc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE); __GLX_NOTE_UNFLUSHED_CMDS(cx); /* ** Reset for the next RenderLarge series. */ __glXResetLargeCommandStatus(cl); } else { /* ** This is neither the first nor the last request. */ } return Success; } } /************************************************************************/ /* ** No support is provided for the vendor-private requests other than ** allocating these entry points in the dispatch table. */ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXVendorPrivateReq *req; GLint vendorcode; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq); req = (xGLXVendorPrivateReq *) pc; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->vendorCode); vendorcode = req->vendorCode; #ifndef __DARWIN__ switch( vendorcode ) { case X_GLvop_SampleMaskSGIS: __GLX_SWAP_FLOAT(pc + 4); __GLX_SWAP_INT(pc + 8); glSampleMaskSGIS(*(GLfloat *)(pc + 4), *(GLboolean *)(pc + 8)); return Success; case X_GLvop_SamplePatternSGIS: __GLX_SWAP_INT(pc + 4); glSamplePatternSGIS( *(GLenum *)(pc + 4)); return Success; } #endif if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { (*__glXSwapVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])(cl, (GLbyte*)req); return Success; } cl->client->errorValue = req->vendorCode; return __glXUnsupportedPrivateRequest; } int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXVendorPrivateWithReplyReq *req; GLint vendorcode; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateWithReplyReq); req = (xGLXVendorPrivateWithReplyReq *) pc; __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->vendorCode); vendorcode = req->vendorCode; switch (vendorcode) { case X_GLXvop_QueryContextInfoEXT: return __glXSwapQueryContextInfoEXT(cl, pc); case X_GLXvop_MakeCurrentReadSGI: return __glXSwapMakeCurrentReadSGI(cl, pc); case X_GLXvop_GetFBConfigsSGIX: return __glXSwapGetFBConfigsSGIX(cl, pc); case X_GLXvop_CreateContextWithConfigSGIX: return __glXSwapCreateContextWithConfigSGIX(cl, pc); case X_GLXvop_CreateGLXPixmapWithConfigSGIX: return __glXSwapCreateGLXPixmapWithConfigSGIX(cl, pc); default: break; } if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { return (*__glXSwapVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])(cl, (GLbyte*)req); } cl->client->errorValue = req->vendorCode; return __glXUnsupportedPrivateRequest; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxcontext.h0000644000000000000000000001057113614532331020243 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _GLX_context_h_ #define _GLX_context_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ typedef struct __GLXcontextRec __GLXcontext; /* XXX: should be defined somewhere globally */ #define CAPI #include "GL/internal/glcore.h" struct __GLXcontextRec { /* ** list of context structs */ struct __GLXcontextRec *last; struct __GLXcontextRec *next; /* ** list of contexts bound to the same drawable */ struct __GLXcontextRec *nextDrawPriv; struct __GLXcontextRec *nextReadPriv; /* ** Opaque pointer the context object created by the GL that the ** server is bound with. Never dereferenced by this code, but used ** as a handle to feed to the routines in the screen info struct. */ __GLinterface *gc; /* ** mode struct for this context */ __GLcontextModes *modes; /* ** Pointer to screen info data for this context. This is set ** when the context is created. */ ScreenPtr pScreen; __GLXscreenInfo *pGlxScreen; /* ** This context is created with respect to this visual. */ VisualRec *pVisual; /* ** The XID of this context. */ XID id; /* ** The XID of the shareList context. */ XID share_id; /* ** Visual id. */ VisualID vid; /* ** screen number. */ GLint screen; /* ** Whether this context's ID still exists. */ GLboolean idExists; /* ** Whether this context is current for some client. */ GLboolean isCurrent; /* ** Whether this context is a direct rendering context. */ GLboolean isDirect; /* ** Window pending state */ GLuint pendingState; /* ** This flag keeps track of whether there are unflushed GL commands. */ GLboolean hasUnflushedCommands; /* ** Current rendering mode for this context. */ GLenum renderMode; /* ** Buffers for feedback and selection. */ GLfloat *feedbackBuf; GLint feedbackBufSize; /* number of elements allocated */ GLuint *selectBuf; GLint selectBufSize; /* number of elements allocated */ /* ** Set only if current drawable is a glx pixmap. */ __GLXpixmap *drawPixmap; __GLXpixmap *readPixmap; /* ** The drawable private this context is bound to */ __GLXdrawablePrivate *drawPriv; __GLXdrawablePrivate *readPriv; }; /* pending state defines */ #define __GLX_PENDING_RESIZE 0x1 #define __GLX_PENDING_DESTROY 0x2 #define __GLX_PENDING_SWAP 0x4 #endif /* !__GLX_context_h__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxdrawable.h0000644000000000000000000000704713614532331020344 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _GLX_drawable_h_ #define _GLX_drawable_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ typedef struct { DrawablePtr pDraw; __GLcontextModes *modes; __GLXscreenInfo *pGlxScreen; ScreenPtr pScreen; Bool idExists; int refcnt; } __GLXpixmap; struct __GLXdrawablePrivateRec { /* ** list of drawable private structs */ struct __GLXdrawablePrivateRec *last; struct __GLXdrawablePrivateRec *next; DrawablePtr pDraw; XID drawId; __GLXpixmap *pGlxPixmap; /* ** Either DRAWABLE_PIXMAP or DRAWABLE_WINDOW, copied from pDraw above. ** Needed by the resource freer because pDraw might already have been ** freed. */ int type; /* ** Configuration of the visual to which this drawable was created. */ __GLcontextModes *modes; /* ** cached drawable size and origin */ GLint xorigin, yorigin; GLint width, height; /* ** Lists of contexts bound to this drawable. There are two lists here. ** One list is of the contexts that have this drawable bound for drawing, ** and the other is the list of contexts that have this drawable bound ** for reading. */ struct __GLXcontextRec *drawGlxc; struct __GLXcontextRec *readGlxc; /* ** "methods" that the drawble should be able to respond to. */ void (*freeBuffers)(struct __GLXdrawablePrivateRec *); void (*updatePalette)(struct __GLXdrawablePrivateRec *); GLboolean (*swapBuffers)(struct __GLXdrawablePrivateRec *); /* ** The GL drawable (information shared between GLX and the GL core) */ __GLdrawablePrivate glPriv; /* ** reference count */ int refCount; }; #endif /* !__GLX_drawable_h__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxerror.h0000644000000000000000000000451113614532331017705 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _GLX_error_h_ #define _GLX_error_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ /* ** Error codes. These have the extension error base added to them ** when the extension initializes. */ extern int __glXBadContext; extern int __glXBadContextState; extern int __glXBadDrawable; extern int __glXBadPixmap; extern int __glXBadCurrentWindow; extern int __glXBadContextTag; extern int __glXBadRenderRequest; extern int __glXBadLargeRequest; extern int __glXUnsupportedPrivateRequest; #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxext.c0000644000000000000000000003006713614532331017354 0ustar /* ** The contents of this file are subject to the GLX Public License Version 1.0 ** (the "License"). You may not use this file except in compliance with the ** License. You may obtain a copy of the License at Silicon Graphics, Inc., ** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 ** or at http://www.sgi.com/software/opensource/glx/license.html. ** ** Software distributed under the License is distributed on an "AS IS" ** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY ** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR ** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific ** language governing rights and limitations under the License. ** ** The Original Software is GLX version 1.2 source code, released February, ** 1999. The developer of the Original Software is Silicon Graphics, Inc. ** Those portions of the Subject Software created by Silicon Graphics, Inc. ** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include #include #include #include "g_disptab.h" #include "unpack.h" #include "glxutil.h" #include "glxext.h" #include "micmap.h" void GlxWrapInitVisuals(miInitVisualsProcPtr *); void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **privates); static __GLXextensionInfo *__glXExt /* = &__glDDXExtensionInfo */; /* ** Forward declarations. */ static int __glXDispatch(ClientPtr); /* ** Called when the extension is reset. */ static void ResetExtension(ExtensionEntry* extEntry) { __glXFlushContextCache(); (*__glXExt->resetExtension)(); __glXScreenReset(); } /* ** Initialize the per-client context storage. */ static void ResetClientState(int clientIndex) { __GLXclientState *cl = __glXClients[clientIndex]; if (cl->returnBuf) free(cl->returnBuf); if (cl->largeCmdBuf) free(cl->largeCmdBuf); if (cl->currentContexts) free(cl->currentContexts); if (cl->GLClientextensions) free(cl->GLClientextensions); memset(cl, 0, sizeof(__GLXclientState)); /* ** By default, assume that the client supports ** GLX major version 1 minor version 0 protocol. */ cl->GLClientmajorVersion = 1; cl->GLClientminorVersion = 0; } /* ** Reset state used to keep track of large (multi-request) commands. */ void __glXResetLargeCommandStatus(__GLXclientState *cl) { cl->largeCmdBytesSoFar = 0; cl->largeCmdBytesTotal = 0; cl->largeCmdRequestsSoFar = 0; cl->largeCmdRequestsTotal = 0; } /* ** This procedure is called when the client who created the context goes ** away OR when glXDestroyContext is called. In either case, all we do is ** flag that the ID is no longer valid, and (maybe) free the context. ** use. */ static int ContextGone(__GLXcontext* cx, XID id) { cx->idExists = GL_FALSE; if (!cx->isCurrent) { __glXFreeContext(cx); } return True; } /* ** Free a client's state. */ static int ClientGone(int clientIndex, XID id) { __GLXcontext *cx; __GLXclientState *cl = __glXClients[clientIndex]; int i; if (cl) { /* ** Free all the contexts that are current for this client. */ for (i=0; i < cl->numCurrentContexts; i++) { cx = cl->currentContexts[i]; if (cx) { __glXDeassociateContext(cx); cx->isCurrent = GL_FALSE; if (!cx->idExists) { __glXFreeContext(cx); } } } /* ** Re-initialize the client state structure. Don't free it because ** we'll probably get another client with this index and use the struct ** again. There is a maximum of MAXCLIENTS of these structures. */ ResetClientState(clientIndex); } return True; } /* ** Free a GLX Pixmap. */ static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id) { PixmapPtr pPixmap = (PixmapPtr) pGlxPixmap->pDraw; pGlxPixmap->idExists = False; if (!pGlxPixmap->refcnt) { /* ** The DestroyPixmap routine should decrement the refcount and free ** only if it's zero. */ (*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap); free(pGlxPixmap); } return True; } /* ** Free a context. */ GLboolean __glXFreeContext(__GLXcontext *cx) { if (cx->idExists || cx->isCurrent) return GL_FALSE; if (!cx->isDirect) { if ((*cx->gc->exports.destroyContext)((__GLcontext *)cx->gc) == GL_FALSE) { return GL_FALSE; } } if (cx->feedbackBuf) free(cx->feedbackBuf); if (cx->selectBuf) free(cx->selectBuf); free(cx); if (cx == __glXLastContext) { __glXFlushContextCache(); } return GL_TRUE; } extern RESTYPE __glXSwapBarrierRes; static int SwapBarrierGone(int screen, XID drawable) { if (__glXSwapBarrierFuncs && __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc != NULL) { __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc(screen, drawable, 0); } FreeResourceByType(drawable, __glXSwapBarrierRes, FALSE); return True; } /************************************************************************/ /* ** These routines can be used to check whether a particular GL command ** has caused an error. Specifically, we use them to check whether a ** given query has caused an error, in which case a zero-length data ** reply is sent to the client. */ static GLboolean errorOccured = GL_FALSE; /* ** The GL was will call this routine if an error occurs. */ void __glXErrorCallBack(__GLinterface *gc, GLenum code) { errorOccured = GL_TRUE; } /* ** Clear the error flag before calling the GL command. */ void __glXClearErrorOccured(void) { errorOccured = GL_FALSE; } /* ** Check if the GL command caused an error. */ GLboolean __glXErrorOccured(void) { return errorOccured; } /************************************************************************/ /* ** Initialize the GLX extension. */ void GlxExtensionInit(void) { ExtensionEntry *extEntry; int i; __glXContextRes = CreateNewResourceType((DeleteType)ContextGone); __glXClientRes = CreateNewResourceType((DeleteType)ClientGone); __glXPixmapRes = CreateNewResourceType((DeleteType)PixmapGone); /* ** Add extension to server extensions. */ extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS, __GLX_NUMBER_ERRORS, __glXDispatch, __glXDispatch, ResetExtension, StandardMinorOpcode); if (!extEntry) { FatalError("__glXExtensionInit: AddExtensions failed\n"); return; } if (!AddExtensionAlias(GLX_EXTENSION_ALIAS, extEntry)) { ErrorF("__glXExtensionInit: AddExtensionAlias failed\n"); return; } __glXBadContext = extEntry->errorBase + GLXBadContext; __glXBadContextState = extEntry->errorBase + GLXBadContextState; __glXBadDrawable = extEntry->errorBase + GLXBadDrawable; __glXBadPixmap = extEntry->errorBase + GLXBadPixmap; __glXBadContextTag = extEntry->errorBase + GLXBadContextTag; __glXBadCurrentWindow = extEntry->errorBase + GLXBadCurrentWindow; __glXBadRenderRequest = extEntry->errorBase + GLXBadRenderRequest; __glXBadLargeRequest = extEntry->errorBase + GLXBadLargeRequest; __glXUnsupportedPrivateRequest = extEntry->errorBase + GLXUnsupportedPrivateRequest; __glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone); /* ** Initialize table of client state. There is never a client 0. */ for (i=1; i <= MAXCLIENTS; i++) { __glXClients[i] = 0; } /* ** Initialize screen specific data. */ __glXScreenInit(screenInfo.numScreens); } /************************************************************************/ Bool __glXCoreType(void) { return __glXExt->type; } /************************************************************************/ void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **privates) { (*__glXExt->setVisualConfigs)(nconfigs, configs, privates); } static miInitVisualsProcPtr saveInitVisualsProc; Bool GlxInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp, int *ndepthp, int *rootDepthp, VisualID *defaultVisp, unsigned long sizes, int bitsPerRGB, int preferredVis) { Bool ret; if (saveInitVisualsProc) { ret = saveInitVisualsProc(visualp, depthp, nvisualp, ndepthp, rootDepthp, defaultVisp, sizes, bitsPerRGB, preferredVis); if (!ret) return False; } (*__glXExt->initVisuals)(visualp, depthp, nvisualp, ndepthp, rootDepthp, defaultVisp, sizes, bitsPerRGB); return True; } void GlxWrapInitVisuals(miInitVisualsProcPtr *initVisProc) { saveInitVisualsProc = *initVisProc; *initVisProc = GlxInitVisuals; /* HACK: this shouldn't be done here but it's the earliest time */ __glXExt = __glXglDDXExtensionInfo(); /* from GLcore */ } /************************************************************************/ void __glXFlushContextCache(void) { __glXLastContext = 0; } /* ** Make a context the current one for the GL (in this implementation, there ** is only one instance of the GL, and we use it to serve all GL clients by ** switching it between different contexts). While we are at it, look up ** a context by its tag and return its (__GLXcontext *). */ __GLXcontext *__glXForceCurrent(__GLXclientState *cl, GLXContextTag tag, int *error) { __GLXcontext *cx; /* ** See if the context tag is legal; it is managed by the extension, ** so if it's invalid, we have an implementation error. */ cx = (__GLXcontext *) __glXLookupContextByTag(cl, tag); if (!cx) { cl->client->errorValue = tag; *error = __glXBadContextTag; return 0; } if (!cx->isDirect) { if (cx->drawPriv == NULL) { /* ** The drawable has vanished. It must be a window, because only ** windows can be destroyed from under us; GLX pixmaps are ** refcounted and don't go away until no one is using them. */ *error = __glXBadCurrentWindow; return 0; } } if (cx == __glXLastContext) { /* No need to re-bind */ return cx; } /* Make this context the current one for the GL. */ if (!cx->isDirect) { if (!(*cx->gc->exports.forceCurrent)((__GLcontext *)cx->gc)) { /* Bind failed, and set the error code. Bummer */ cl->client->errorValue = cx->id; *error = __glXBadContextState; return 0; } } __glXLastContext = cx; return cx; } /************************************************************************/ /* ** Top level dispatcher; all commands are executed from here down. */ #ifdef NXAGENT_SERVER static int xorg__glXDispatch(ClientPtr client) #else static int __glXDispatch(ClientPtr client) #endif { REQUEST(xGLXSingleReq); CARD8 opcode; int (*proc)(__GLXclientState *cl, GLbyte *pc); __GLXclientState *cl; opcode = stuff->glxCode; cl = __glXClients[client->index]; if (!cl) { cl = (__GLXclientState *) malloc(sizeof(__GLXclientState)); __glXClients[client->index] = cl; if (!cl) { return BadAlloc; } memset(cl, 0, sizeof(__GLXclientState)); } if (!cl->inUse) { /* ** This is first request from this client. Associate a resource ** with the client so we will be notified when the client dies. */ XID xid = FakeClientID(client->index); if (!AddResource( xid, __glXClientRes, (void *)(long)client->index)) { return BadAlloc; } ResetClientState(client->index); cl->inUse = GL_TRUE; cl->client = client; } /* ** Check for valid opcode. */ if (opcode >= __GLX_SINGLE_TABLE_SIZE) { return BadRequest; } /* ** If we're expecting a glXRenderLarge request, this better be one. */ if ((cl->largeCmdRequestsSoFar != 0) && (opcode != X_GLXRenderLarge)) { client->errorValue = stuff->glxCode; return __glXBadLargeRequest; } /* ** Use the opcode to index into the procedure table. */ if (client->swapped) proc = __glXSwapSingleTable[opcode]; else proc = __glXSingleTable[opcode]; return (*proc)(cl, (GLbyte *) stuff); } int __glXNoSuchSingleOpcode(__GLXclientState *cl, GLbyte *pc) { return BadRequest; } void __glXNoSuchRenderOpcode(GLbyte *pc) { return; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxext.h0000644000000000000000000001160613614532331017357 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _glxext_h_ #define _glxext_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ /* * Added by VA Linux for XFree86 4.0.x */ typedef struct { int type; void (*resetExtension)(void); Bool (*initVisuals)( VisualPtr * visualp, DepthPtr * depthp, int * nvisualp, int * ndepthp, int * rootDepthp, VisualID * defaultVisp, unsigned long sizes, int bitsPerRGB ); void (*setVisualConfigs)( int nconfigs, __GLXvisualConfig *configs, void **privates ); } __GLXextensionInfo; extern GLboolean __glXFreeContext(__GLXcontext *glxc); extern void __glXFlushContextCache(void); extern void __glXNoSuchRenderOpcode(GLbyte*); extern int __glXNoSuchSingleOpcode(__GLXclientState*, GLbyte*); extern void __glXErrorCallBack(__GLinterface *gc, GLenum code); extern void __glXClearErrorOccured(void); extern GLboolean __glXErrorOccured(void); extern void __glXResetLargeCommandStatus(__GLXclientState*); extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc); extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc); extern int DoMakeCurrent( __GLXclientState *cl, GLXDrawable drawId, GLXDrawable readId, GLXContextID contextId, GLXContextTag tag ); extern int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap); extern int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap); extern int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, GLXContextID shareList, VisualID visual, GLuint screen, GLboolean isDirect); extern int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual, GLuint screenNum, XID pixmapId, XID glxpixmapId); extern void GlxExtensionInit(void); extern Bool __glXCoreType(void); extern const char GLServerVersion[]; extern int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap); extern int GlxInitVisuals( VisualPtr * visualp, DepthPtr * depthp, int * nvisualp, int * ndepthp, int * rootDepthp, VisualID * defaultVisp, unsigned long sizes, int bitsPerRGB, int preferredVis ); typedef struct { void * (* queryHyperpipeNetworkFunc)(int, int *, int *); void * (* queryHyperpipeConfigFunc)(int, int, int *, int *); int (* destroyHyperpipeConfigFunc)(int, int); void * (* hyperpipeConfigFunc)(int, int, int *, int *, void *); } __GLXHyperpipeExtensionFuncs; extern void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs); extern __GLXHyperpipeExtensionFuncs *__glXHyperpipeFuncs; typedef struct { int (* bindSwapBarrierFunc)(int, XID, int); int (* queryMaxSwapBarriersFunc)(int); } __GLXSwapBarrierExtensionFuncs; extern void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs); extern __GLXSwapBarrierExtensionFuncs *__glXSwapBarrierFuncs; #endif /* _glxext_h_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxfb.c0000644000000000000000000001222113614532331017133 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ /* ** An implementation of a buffer which is part of the front buffer */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxutil.h" #include "glxfb.h" #include /* so we don't include glmath.h */ extern GLuint __glFloorLog2(GLuint); typedef struct __GLFBbufferInfoRec { GCPtr pGC; } __GLFBbufferInfo; extern PixmapPtr __glXPrivPixGetPtr(__GLdrawableBuffer *); /* ---------------------------------------------------------- */ static GLboolean Resize(__GLdrawableBuffer *buf, GLint x, GLint y, GLuint width, GLuint height, __GLdrawablePrivate *glPriv, GLuint bufferMask) { buf->width = width; buf->height = height; buf->byteWidth = width * buf->elementSize; buf->outerWidth = width; return GL_TRUE; } static void Lock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv) { } static void Unlock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv) { } /* ** Do a swap buffer with ** a memory surface as a back buffer ** a FB surface as a front buffer */ GLboolean __glXFBMemSwapBuffers(__GLXdrawablePrivate *glxPriv) { __GLdrawablePrivate *glPriv = &glxPriv->glPriv; __GLdrawableBuffer *front = &glPriv->frontBuffer; __GLdrawableBuffer *back = &glPriv->backBuffer; __GLFBbufferInfo *bufferInfo; GCPtr pGC; GLint width, height, depth, pad; GLubyte *buf; bufferInfo = (__GLFBbufferInfo *) front->other; pGC = bufferInfo->pGC; width = back->width; height = back->height; depth = back->depth; buf = back->base; pad = back->outerWidth - back->width; /* back buffer padding */ /* adjust buffer padding. X wants left, GL has right */ buf -= pad; ValidateGC(glxPriv->pDraw, pGC); (*pGC->ops->PutImage)(glxPriv->pDraw, pGC, depth, 0, 0, width, height, pad, ZPixmap, (char *)buf); return GL_TRUE; } static void Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv) { __GLFBbufferInfo *bufferInfo; bufferInfo = (__GLFBbufferInfo *) buf->other; if (bufferInfo->pGC) { FreeScratchGC(bufferInfo->pGC); } free(bufferInfo); buf->other = NULL; } /* ** function to return the X GC of this buffer (to be used by DDX) */ GCPtr __glXFBGetGC(__GLdrawableBuffer *buf) { __GLFBbufferInfo *bufferInfo; bufferInfo = (__GLFBbufferInfo *) buf->other; if (bufferInfo) { return bufferInfo->pGC; } else { return NULL; } } void __glXInitFB(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits) { __GLFBbufferInfo *bufferInfo; __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *) glPriv->other; GCPtr pGC; buf->depth = bits; buf->width = buf->height = 0; /* to be filled during Update */ buf->handle = buf->base = NULL; /* to be filled during Update */ buf->size = 0; buf->byteWidth = 0; buf->elementSize = ((bits-1) / 8) + 1; buf->elementSizeLog2 = __glFloorLog2(buf->elementSize); buf->resize = Resize; buf->lock = Lock; buf->unlock = Unlock; buf->fill = NULL; buf->free = Free; /* allocate local information */ bufferInfo = (__GLFBbufferInfo *) malloc(sizeof(__GLFBbufferInfo)); buf->other = (void *) bufferInfo; pGC = CreateScratchGC(glxPriv->pDraw->pScreen, glxPriv->pDraw->depth); bufferInfo->pGC = pGC; (*pGC->funcs->ChangeClip)(pGC, CT_NONE, NULL, 0); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxfb.h0000644000000000000000000000423513614532331017146 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _glxfb_h_ #define _glxfb_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ extern void __glXInitFB(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits); extern GCPtr __glXFBGetGC(__GLdrawableBuffer *buf); extern GLboolean __glXFBMemSwapBuffers(__GLXdrawablePrivate *glxPriv); #endif /* _glxfb_h_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glximports.c0000644000000000000000000001104113614532331020240 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "glxserver.h" #include "glxcontext.h" #include "glximports.h" void *__glXImpMalloc(__GLcontext *gc, size_t size) { void *addr; if (size == 0) { return NULL; } addr = malloc(size); if (addr == NULL) { /* XXX: handle out of memory error */ return NULL; } return addr; } void *__glXImpCalloc(__GLcontext *gc, size_t numElements, size_t elementSize) { void *addr; size_t size; if ((numElements == 0) || (elementSize == 0)) { return NULL; } size = numElements * elementSize; addr = malloc(size); if (addr == NULL) { /* XXX: handle out of memory error */ return NULL; } /* zero out memory */ memset(addr, 0, size); return addr; } void __glXImpFree(__GLcontext *gc, void *addr) { if (addr) { free(addr); } } void *__glXImpRealloc(__GLcontext *gc, void *addr, size_t newSize) { void *newAddr; if (addr) { if (newSize == 0) { free(addr); return NULL; } newAddr = realloc(addr, newSize); } else { if (newSize == 0) { return NULL; } newAddr = malloc(newSize); } if (newAddr == NULL) { return NULL; /* XXX: out of memory error */ } return newAddr; } void __glXImpWarning(__GLcontext *gc, char *msg) { ErrorF("%s",(char *)msg); } void __glXImpFatal(__GLcontext *gc, char *msg) { ErrorF("%s",(char *)msg); abort(); } char *__glXImpGetenv(__GLcontext *gc, const char *var) { return getenv(var); } int __glXImpAtoi(__GLcontext *gc, const char *str) { return atoi(str); } int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...) { va_list ap; int ret; /* have to deal with var args */ va_start(ap, fmt); ret = vsprintf(str, fmt, ap); va_end(ap); return ret; } void *__glXImpFopen(__GLcontext *gc, const char *path, const char *mode) { return (void *) fopen(path, mode); } int __glXImpFclose(__GLcontext *gc, void *stream) { return fclose((FILE *)stream); } int __glXImpFprintf(__GLcontext *gc, void *stream, const char *fmt, ...) { va_list ap; int ret; /* have to deal with var args */ va_start(ap, fmt); ret = vfprintf((FILE *)stream, fmt, ap); va_end(ap); return ret; } __GLdrawablePrivate *__glXImpGetDrawablePrivate(__GLcontext *gc) { __GLinterface *glci = (__GLinterface *) gc; __GLXcontext *glrc = (__GLXcontext *) glci->imports.other; return &glrc->drawPriv->glPriv; } __GLdrawablePrivate *__glXImpGetReadablePrivate(__GLcontext *gc) { __GLinterface *glci = (__GLinterface *) gc; __GLXcontext *glrc = (__GLXcontext *) glci->imports.other; return &glrc->readPriv->glPriv; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glximports.h0000644000000000000000000000563513614532331020261 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _glximports_h_ #define _glximports_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ extern void *__glXImpMalloc(__GLcontext *gc, size_t size); extern void *__glXImpCalloc(__GLcontext *gc, size_t nElem, size_t eSize); extern void *__glXImpRealloc(__GLcontext *gc, void *addr, size_t newSize); extern void __glXImpFree(__GLcontext *gc, void *addr); extern void __glXImpWarning(__GLcontext *gc, char *msg); extern void __glXImpFatal(__GLcontext *gc, char *msg); extern char *__glXImpGetenv(__GLcontext *gc, const char *var); extern int __glXImpAtoi(__GLcontext *gc, const char *str); extern int __glXImpSprintf(__GLcontext *gc, char *str, const char *fmt, ...); extern void *__glXImpFopen(__GLcontext *gc, const char *path, const char *mode); extern int __glXImpFclose(__GLcontext *gc, void *stream); extern int __glXImpFprintf(__GLcontext *gc, void *stream, const char *fmt, ...); extern __GLdrawablePrivate *__glXImpGetDrawablePrivate(__GLcontext *gc); extern __GLdrawablePrivate *__glXImpGetReadablePrivate(__GLcontext *gc); #endif /* _glximports_h_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxmem.c0000644000000000000000000001073713614532331017334 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ /* ** Implementation of a buffer in main memory */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxmem.h" #include "glxext.h" #include "GL/internal/glcore.h" /* don't want to include glmath.h */ extern GLuint __glFloorLog2(GLuint); /* ---------------------------------------------------------- */ #define BUF_ALIGN 32 /* x86 cache alignment (used for assembly paths) */ #define BUF_ALIGN_MASK (BUF_ALIGN-1) static GLboolean Resize(__GLdrawableBuffer *buf, GLint x, GLint y, GLuint width, GLuint height, __GLdrawablePrivate *glPriv, GLuint bufferMask) { GLuint newSize; void *ubase; GLint pixelWidth; GLint alignedWidth; /* ** Note: ** buf->handle : unaligned base ** buf->base : aligned base */ pixelWidth = BUF_ALIGN / buf->elementSize; alignedWidth = (width & ~(pixelWidth-1)) + pixelWidth; newSize = alignedWidth * height * buf->elementSize; /* ** Only allocate buffer space for the SGI core. ** Mesa and Aqua handle their own buffer allocations. */ #if defined(__GL_BUFFER_SIZE_TRACKS_WINDOW) if (__glXCoreType() == GL_CORE_SGI) { #else if (newSize > buf->size && __glXCoreType() == GL_CORE_SGI) { #endif if (buf->handle) { ubase = (*glPriv->realloc)(buf->handle, newSize + BUF_ALIGN_MASK); if (ubase == NULL) { return GL_FALSE; } } else { ubase = (*glPriv->malloc)(newSize + BUF_ALIGN_MASK); if (ubase == NULL) { return GL_FALSE; } } buf->size = newSize; buf->handle = ubase; buf->base = (void *)(((size_t)ubase + BUF_ALIGN_MASK) & (unsigned int) ~BUF_ALIGN_MASK); assert(((size_t)buf->base % BUF_ALIGN) == 0); } buf->width = width; buf->height = height; buf->byteWidth = alignedWidth * buf->elementSize; buf->outerWidth = alignedWidth; return GL_TRUE; } static void Lock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv) { } static void Unlock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv) { } static void Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv) { if (buf->handle) { (*glPriv->free)(buf->handle); buf->handle = NULL; } } void __glXInitMem(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits) { buf->width = buf->height = 0; /* to be filled during Update */ buf->depth = bits; buf->size = 0; buf->handle = buf->base = NULL; /* to be filled during Update */ buf->byteWidth = 0; buf->elementSize = ((bits - 1) / 8) + 1; buf->elementSizeLog2 = __glFloorLog2(buf->elementSize); buf->resize = Resize; buf->lock = Lock; buf->unlock = Unlock; buf->fill = NULL; buf->free = Free; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxmem.h0000644000000000000000000000404513614532331017334 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _glxmem_h_ #define _glxmem_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ extern void __glXInitMem(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits); #endif /* _glxmem_h_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxpix.c0000644000000000000000000000770513614532331017357 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ /* ** An implementation of a glx pixmap buffer */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxutil.h" #include "glxpix.h" #include /* don't want to include glmath.h */ extern GLuint __glFloorLog2(GLuint); typedef struct __GLPixBufferInfoRec { GCPtr pGC; } __GLPixBufferInfo; /* ---------------------------------------------------------- */ static GLboolean Resize(__GLdrawableBuffer *buf, GLint x, GLint y, GLuint width, GLuint height, __GLdrawablePrivate *glPriv, GLuint bufferMask) { buf->width = width; buf->height = width; buf->byteWidth = width * buf->elementSize; buf->outerWidth = width; return GL_TRUE; } static void Lock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv) { } static void Unlock(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv) { } static void Free(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv) { __GLPixBufferInfo *bufferInfo; if (LookupIDByType((XID)(long)buf->handle, __glXPixmapRes)) { FreeResource((XID)(long)buf->handle, FALSE); buf->handle = NULL; } bufferInfo = (__GLPixBufferInfo *) buf->other; if (bufferInfo->pGC) { FreeScratchGC(bufferInfo->pGC); } free(bufferInfo); buf->other = NULL; } void __glXInitPix(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits, XID glxpixmapId, __GLXpixmap *pGlxPixmap) { __GLPixBufferInfo *bufferInfo; buf->width = buf->height = 0; /* to be filled during Update */ buf->depth = bits; buf->size = 0; buf->base = NULL; buf->byteWidth = 0; buf->elementSize = ((bits-1) / 8) + 1; buf->elementSizeLog2 = __glFloorLog2(buf->elementSize); buf->handle = (void *)(long) glxpixmapId; pGlxPixmap->refcnt++; buf->resize = Resize; buf->lock = Lock; buf->unlock = Unlock; buf->fill = NULL; buf->free = Free; /* allocate local information */ bufferInfo = (__GLPixBufferInfo *) malloc(sizeof(__GLPixBufferInfo)); buf->other = (void *) bufferInfo; bufferInfo->pGC = CreateScratchGC(pGlxPixmap->pDraw->pScreen, pGlxPixmap->pDraw->depth); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxpix.h0000644000000000000000000000411713614532331017356 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _glxpix_h_ #define _glxpix_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ extern void __glXInitPix(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv, GLint bits, XID glxpixmapId, __GLXpixmap *pGlxPixmap); #endif /* _glxpix_h_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxscreens.c0000644000000000000000000002647313614532331020224 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "glxserver.h" #include "glxutil.h" #include "glxext.h" const char GLServerVersion[] = "1.2"; static const char GLServerExtensions[] = "GL_ARB_depth_texture " "GL_ARB_imaging " "GL_ARB_multitexture " "GL_ARB_point_parameters " "GL_ARB_point_sprite " "GL_ARB_shadow " "GL_ARB_shadow_ambient " "GL_ARB_texture_border_clamp " "GL_ARB_texture_cube_map " "GL_ARB_texture_env_add " "GL_ARB_texture_env_combine " "GL_ARB_texture_env_crossbar " "GL_ARB_texture_env_dot3 " "GL_ARB_texture_mirrored_repeat " "GL_ARB_transpose_matrix " "GL_ARB_window_pos " "GL_EXT_abgr " "GL_EXT_bgra " "GL_EXT_blend_color " "GL_EXT_blend_func_separate " "GL_EXT_blend_logic_op " "GL_EXT_blend_minmax " "GL_EXT_blend_subtract " "GL_EXT_clip_volume_hint " "GL_EXT_copy_texture " "GL_EXT_draw_range_elements " "GL_EXT_fog_coord " "GL_EXT_multi_draw_arrays " "GL_EXT_packed_pixels " "GL_EXT_polygon_offset " "GL_EXT_rescale_normal " "GL_EXT_secondary_color " "GL_EXT_separate_specular_color " "GL_EXT_shadow_funcs " "GL_EXT_stencil_two_side " "GL_EXT_stencil_wrap " "GL_EXT_subtexture " "GL_EXT_texture " "GL_EXT_texture3D " "GL_EXT_texture_edge_clamp " "GL_EXT_texture_env_add " "GL_EXT_texture_env_combine " "GL_EXT_texture_env_dot3 " "GL_EXT_texture_lod " "GL_EXT_texture_lod_bias " "GL_EXT_texture_object " "GL_EXT_texture_rectangle " "GL_EXT_vertex_array " "GL_APPLE_packed_pixels " "GL_ATI_texture_mirror_once " "GL_ATI_texture_env_combine3 " "GL_HP_occlusion_test " "GL_IBM_texture_mirrored_repeat " "GL_MESA_pack_invert " "GL_MESA_ycbcr_texture " "GL_NV_blend_square " "GL_NV_point_sprite " "GL_NV_texgen_reflection " "GL_NV_texture_rectangle " "GL_SGIS_generate_mipmap " "GL_SGIS_texture_border_clamp " "GL_SGIS_texture_edge_clamp " "GL_SGIS_texture_lod " "GL_SGIX_depth_texture " "GL_SGIX_shadow " "GL_SGIX_shadow_ambient " ; /* ** We have made the simplifying assuption that the same extensions are ** supported across all screens in a multi-screen system. */ static char GLXServerVendorName[] = "SGI"; static char GLXServerVersion[] = "1.2"; static char GLXServerExtensions[] = "GLX_ARB_multisample " "GLX_EXT_visual_info " "GLX_EXT_visual_rating " "GLX_EXT_import_context " "GLX_OML_swap_method " "GLX_SGI_make_current_read " #ifndef __DARWIN__ "GLX_SGIS_multisample " "GLX_SGIX_hyperpipe " "GLX_SGIX_swap_barrier " #endif "GLX_SGIX_fbconfig " ; /* * __glDDXScreenInfo comes from GLcore, so we can't resolve this symbol at * module open time. Leave a placeholder, and fill this in when we first * need it (in __glXScreenInit). XXX Why make this an array? */ static __GLXscreenInfo *__glXScreens[] = { NULL /* &__glDDXScreenInfo */ , }; static GLint __glXNumStaticScreens = (sizeof __glXScreens / sizeof __glXScreens[0]); __GLXscreenInfo *__glXActiveScreens; GLint __glXNumActiveScreens; __GLXSwapBarrierExtensionFuncs *__glXSwapBarrierFuncs = NULL; static int __glXNumSwapBarrierFuncs = 0; __GLXHyperpipeExtensionFuncs *__glXHyperpipeFuncs = NULL; static int __glXNumHyperpipeFuncs = 0; RESTYPE __glXDrawableRes; __GLXscreenInfo *__glXgetActiveScreen(int num) { return &__glXActiveScreens[num]; } /* ** Destroy routine that gets called when a drawable is freed. A drawable ** contains the ancillary buffers needed for rendering. */ static Bool DrawableGone(__GLXdrawablePrivate *glxPriv, XID xid) { __GLXcontext *cx, *cx1; /* ** Use glxPriv->type to figure out what kind of drawable this is. Don't ** use glxPriv->pDraw->type because by the time this routine is called, ** the pDraw might already have been freed. */ if (glxPriv->type == DRAWABLE_WINDOW) { /* ** When a window is destroyed, notify all context bound to ** it, that there are no longer bound to anything. */ for (cx = glxPriv->drawGlxc; cx; cx = cx1) { cx1 = cx->nextDrawPriv; cx->pendingState |= __GLX_PENDING_DESTROY; } for (cx = glxPriv->readGlxc; cx; cx = cx1) { cx1 = cx->nextReadPriv; cx->pendingState |= __GLX_PENDING_DESTROY; } } /* ** set the size to 0, so that context that may still be using this ** drawable not do anything harmful */ glxPriv->xorigin = 0; glxPriv->yorigin = 0; glxPriv->width = 0; glxPriv->height = 0; __glXUnrefDrawablePrivate(glxPriv); return True; } /* ** This hook gets called when a window moves or changes size. */ static Bool PositionWindow(WindowPtr pWin, int x, int y) { ScreenPtr pScreen; __GLXcontext *glxc; __GLXdrawablePrivate *glxPriv; Bool ret; /* ** Call wrapped position window routine */ pScreen = pWin->drawable.pScreen; pScreen->PositionWindow = __glXActiveScreens[pScreen->myNum].WrappedPositionWindow; ret = (*pScreen->PositionWindow)(pWin, x, y); pScreen->PositionWindow = PositionWindow; /* ** Tell all contexts rendering into this window that the window size ** has changed. */ glxPriv = (__GLXdrawablePrivate *) LookupIDByType(pWin->drawable.id, __glXDrawableRes); if (glxPriv == NULL) { /* ** This window is not being used by the OpenGL. */ return ret; } /* ** resize the drawable */ /* first change the drawable size */ if (__glXResizeDrawableBuffers(glxPriv) == GL_FALSE) { /* resize failed! */ /* XXX: what can we possibly do here? */ ret = False; } /* mark contexts as needing resize */ for (glxc = glxPriv->drawGlxc; glxc; glxc = glxc->nextDrawPriv) { glxc->pendingState |= __GLX_PENDING_RESIZE; } for (glxc = glxPriv->readGlxc; glxc; glxc = glxc->nextReadPriv) { glxc->pendingState |= __GLX_PENDING_RESIZE; } return ret; } /* ** Wrap our own PositionWindow routine around the server's, so we can ** be notified when a window changes size */ static void wrapPositionWindow(int screen) { ScreenPtr pScreen = screenInfo.screens[screen]; __glXActiveScreens[screen].WrappedPositionWindow = pScreen->PositionWindow; pScreen->PositionWindow = PositionWindow; } /* * If your DDX driver wants to register support for swap barriers or hyperpipe * topology, it should call __glXHyperpipeInit() or __glXSwapBarrierInit() * with a dispatch table of functions to handle the requests. In the XFree86 * DDX, for example, you would call these near the bottom of the driver's * ScreenInit method, after DRI has been initialized. * * This should be replaced with a better method when we teach the server how * to load DRI drivers. */ void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs) { if (__glXNumHyperpipeFuncs < screen + 1) { __glXHyperpipeFuncs = realloc(__glXHyperpipeFuncs, (screen+1) * sizeof(__GLXHyperpipeExtensionFuncs)); __glXNumHyperpipeFuncs = screen + 1; } __glXHyperpipeFuncs[screen].queryHyperpipeNetworkFunc = *funcs->queryHyperpipeNetworkFunc; __glXHyperpipeFuncs[screen].queryHyperpipeConfigFunc = *funcs->queryHyperpipeConfigFunc; __glXHyperpipeFuncs[screen].destroyHyperpipeConfigFunc = *funcs->destroyHyperpipeConfigFunc; __glXHyperpipeFuncs[screen].hyperpipeConfigFunc = *funcs->hyperpipeConfigFunc; } void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs) { if (__glXNumSwapBarrierFuncs < screen + 1) { __glXSwapBarrierFuncs = realloc(__glXSwapBarrierFuncs, (screen+1) * sizeof(__GLXSwapBarrierExtensionFuncs)); __glXNumSwapBarrierFuncs = screen + 1; } __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc = funcs->bindSwapBarrierFunc; __glXSwapBarrierFuncs[screen].queryMaxSwapBarriersFunc = funcs->queryMaxSwapBarriersFunc; } void __glXScreenInit(GLint numscreens) { GLint i,j; __glXScreens[0] = __glXglDDXScreenInfo(); /* from GLcore */ /* ** This alloc has to work or else the server might as well core dump. */ __glXActiveScreens = (__GLXscreenInfo *) malloc(sizeof(__GLXscreenInfo) * numscreens); for (i=0; i < numscreens; i++) { /* ** Probe each static screen to see which exists. */ for (j=0; j < __glXNumStaticScreens; j++) { if ((*__glXScreens[j]->screenProbe)(i)) { __glXActiveScreens[i] = *__glXScreens[j]; __glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals; __glXActiveScreens[i].GLextensions = strdup(GLServerExtensions); __glXActiveScreens[i].GLXvendor = strdup(GLXServerVendorName); __glXActiveScreens[i].GLXversion = strdup(GLXServerVersion); __glXActiveScreens[i].GLXextensions = strdup(GLXServerExtensions); __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone); wrapPositionWindow(i); } } } __glXNumActiveScreens = numscreens; } void __glXScreenReset(void) { int i; for (i = 0; i < __glXNumActiveScreens; i++) { free(__glXActiveScreens[i].GLXvendor); free(__glXActiveScreens[i].GLXversion); free(__glXActiveScreens[i].GLXextensions); free(__glXActiveScreens[i].GLextensions); } free(__glXActiveScreens); free(__glXHyperpipeFuncs); free(__glXSwapBarrierFuncs); __glXNumHyperpipeFuncs = 0; __glXNumSwapBarrierFuncs = 0; __glXHyperpipeFuncs = NULL; __glXSwapBarrierFuncs = NULL; __glXActiveScreens = NULL; __glXNumActiveScreens = 0; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxscreens.h0000644000000000000000000000671513614532331020226 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _GLX_screens_h_ #define _GLX_screens_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ /* XXX: should be defined somewhere globally */ #define CAPI #include "GL/internal/glcore.h" /* ** Screen dependent data. These methods are the interface between the DIX ** and DDX layers of the GLX server extension. The methods provide an ** interface for context management on a screen. */ typedef struct { /* ** Probe the screen and see if it supports GL rendering. It will ** return GL_FALSE if it doesn't, GL_TRUE otherwise. */ Bool (*screenProbe)(int screen); /* ** Create a context using configuration information from modes. ** Use imports as callbacks back to the OS. Return an opaque handle ** on the context (NULL if failure). */ __GLinterface *(*createContext)(__GLimports *imports, __GLcontextModes *modes, __GLinterface *shareGC); /* ** Create a buffer using information from glxPriv. This routine ** sets up any wrappers necessary to resize, swap or destroy the ** buffer. */ void (*createBuffer)(__GLXdrawablePrivate *glxPriv); /** * Linked list of valid context modes for this screen. */ __GLcontextModes *modes; void **pVisualPriv; GLint numVisuals; GLint numUsableVisuals; char *GLextensions; char *GLXvendor; char *GLXversion; char *GLXextensions; /* ** Things that are not statically set. */ Bool (*WrappedPositionWindow)(WindowPtr pWin, int x, int y); } __GLXscreenInfo; extern void __glXScreenInit(GLint); extern void __glXScreenReset(void); #endif /* !__GLX_screens_h__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxserver.h0000644000000000000000000002536313614532331020072 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _GLX_server_h_ #define _GLX_server_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #include #include #include #include #include #include #include #include #include #include #include "protocol-versions.h" #include /* ** The X header misc.h defines these math functions. */ #undef abs #undef fabs #define GL_GLEXT_PROTOTYPES /* we want prototypes */ #include #include #include /* For glxscreens.h */ typedef struct __GLXdrawablePrivateRec __GLXdrawablePrivate; #include "glxscreens.h" #include "glxdrawable.h" #include "glxcontext.h" #include "glxerror.h" #define GLX_SERVER_MAJOR_VERSION SERVER_GLX_MAJOR_VERSION #define GLX_SERVER_MINOR_VERSION SERVER_GLX_MINOR_VERSION #ifndef True #define True 1 #endif #ifndef False #define False 0 #endif /* ** GLX resources. */ typedef XID GLXContextID; typedef XID GLXPixmap; typedef XID GLXDrawable; typedef struct __GLXcontextRec *GLXContext; typedef struct __GLXclientStateRec __GLXclientState; extern __GLXscreenInfo *__glXActiveScreens; extern GLint __glXNumActiveScreens; extern __GLXscreenInfo *__glXgetActiveScreen(int num); /************************************************************************/ /* ** The last context used (from the server's persective) is cached. */ extern __GLXcontext *__glXLastContext; extern __GLXcontext *__glXForceCurrent(__GLXclientState*, GLXContextTag, int*); /* ** Macros to set, unset, and retrieve the flag that says whether a context ** has unflushed commands. */ #define __GLX_NOTE_UNFLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_TRUE #define __GLX_NOTE_FLUSHED_CMDS(glxc) glxc->hasUnflushedCommands = GL_FALSE #define __GLX_HAS_UNFLUSHED_CMDS(glxc) (glxc->hasUnflushedCommands) /************************************************************************/ /* ** State kept per client. */ struct __GLXclientStateRec { /* ** Whether this structure is currently being used to support a client. */ Bool inUse; /* ** Buffer for returned data. */ GLbyte *returnBuf; GLint returnBufSize; /* ** Keep track of large rendering commands, which span multiple requests. */ GLint largeCmdBytesSoFar; /* bytes received so far */ GLint largeCmdBytesTotal; /* total bytes expected */ GLint largeCmdRequestsSoFar; /* requests received so far */ GLint largeCmdRequestsTotal; /* total requests expected */ GLbyte *largeCmdBuf; GLint largeCmdBufSize; /* ** Keep a list of all the contexts that are current for this client's ** threads. */ __GLXcontext **currentContexts; GLint numCurrentContexts; /* Back pointer to X client record */ ClientPtr client; int GLClientmajorVersion; int GLClientminorVersion; char *GLClientextensions; }; extern __GLXclientState *__glXClients[]; /************************************************************************/ /* ** Dispatch tables. */ typedef void (*__GLXdispatchRenderProcPtr)(GLbyte *); typedef int (*__GLXdispatchSingleProcPtr)(__GLXclientState *, GLbyte *); typedef int (*__GLXdispatchVendorPrivProcPtr)(__GLXclientState *, GLbyte *); /* * Dispatch for GLX commands. */ typedef int (*__GLXprocPtr)(__GLXclientState *, char *pc); extern __GLXprocPtr __glXProcTable[]; /* * Tables for computing the size of each rendering command. */ typedef struct { int bytes; int (*varsize)(GLbyte *pc, Bool swap, int left); } __GLXrenderSizeData; extern __GLXrenderSizeData __glXRenderSizeTable[]; extern __GLXrenderSizeData __glXRenderSizeTable_EXT[]; /************************************************************************/ /* ** X resources. */ extern RESTYPE __glXContextRes; extern RESTYPE __glXClientRes; extern RESTYPE __glXPixmapRes; extern RESTYPE __glXDrawableRes; /************************************************************************/ /* ** Prototypes. */ extern char *__glXcombine_strings(const char *, const char *); /* ** Routines for sending swapped replies. */ extern void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReply *reply); extern void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply *reply); extern void __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply *reply); extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client, xGLXQueryContextInfoEXTReply *reply, int *buf); extern void glxSwapQueryExtensionsStringReply(ClientPtr client, xGLXQueryExtensionsStringReply *reply, char *buf); extern void glxSwapQueryServerStringReply(ClientPtr client, xGLXQueryServerStringReply *reply, char *buf); /* * Routines for computing the size of variably-sized rendering commands. */ static __inline__ int safe_add(int a, int b) { if (a < 0 || b < 0) return -1; if (INT_MAX - a < b) return -1; return a + b; } static __inline__ int safe_mul(int a, int b) { if (a < 0 || b < 0) return -1; if (a == 0 || b == 0) return 0; if (a > INT_MAX / b) return -1; return a * b; } static __inline__ int safe_pad(int a) { int ret; if (a < 0) return -1; if ((ret = safe_add(a, 3)) < 0) return -1; return ret & (GLuint)~3; } extern int __glXTypeSize(GLenum enm); extern int __glXImageSize(GLenum format, GLenum type, GLenum target, GLsizei w, GLsizei h, GLsizei d, GLint imageHeight, GLint rowLength, GLint skipImages, GLint skipRows, GLint alignment); extern int __glXCallListsReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXBitmapReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXFogfvReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXFogivReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXLightfvReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXLightivReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXLightModelfvReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXLightModelivReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXMaterialfvReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXMaterialivReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXTexParameterivReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXTexImage1DReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXTexImage2DReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXTexEnvivReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXTexGendvReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXTexGenfvReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXTexGenivReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXMap1dReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXMap1fReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXMap2dReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXMap2fReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXDrawArraysSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap, int reqlen ); extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXColorTableReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap, int reqlen); /* * Routines for computing the size of returned data. */ extern int __glXConvolutionParameterivSize(GLenum pname); extern int __glXConvolutionParameterfvSize(GLenum pname); extern int __glXColorTableParameterfvSize(GLenum pname); extern int __glXColorTableParameterivSize(GLenum pname); extern int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap, int reqlen); extern int __glXPointParameterivReqSize(GLbyte *pc, Bool swap, int reqlen); #endif /* !__GLX_server_h__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxutil.c0000644000000000000000000002677313614532331017542 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #define FONT_PCF #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "glxserver.h" #include #include #include #include #include "glxutil.h" #include "glxbuf.h" #include "GL/internal/glcore.h" #include "GL/glxint.h" #include "glcontextmodes.h" /************************************************************************/ void __glXNop(void) {} /************************************************************************/ /* Context stuff */ /* ** associate a context with a drawable */ void __glXAssociateContext(__GLXcontext *glxc) { glxc->nextDrawPriv = glxc->drawPriv->drawGlxc; glxc->drawPriv->drawGlxc = glxc; __glXRefDrawablePrivate(glxc->drawPriv); glxc->nextReadPriv = glxc->readPriv->readGlxc; glxc->readPriv->readGlxc = glxc; __glXRefDrawablePrivate(glxc->readPriv); } /* ** Deassociate a context from a drawable */ void __glXDeassociateContext(__GLXcontext *glxc) { __GLXcontext *curr, *prev; prev = NULL; for ( curr = glxc->drawPriv->drawGlxc ; curr != NULL ; prev = curr, curr = curr->nextDrawPriv ) { if (curr == glxc) { /* found context. Deassociate. */ if (prev == NULL) { glxc->drawPriv->drawGlxc = curr->nextDrawPriv; } else { prev->nextDrawPriv = curr->nextDrawPriv; } curr->nextDrawPriv = NULL; __glXUnrefDrawablePrivate(glxc->drawPriv); break; } } prev = NULL; for ( curr = glxc->readPriv->readGlxc ; curr != NULL ; prev = curr, curr = curr->nextReadPriv ) { if (curr == glxc) { /* found context. Deassociate. */ if (prev == NULL) { glxc->readPriv->readGlxc = curr->nextReadPriv; } else { prev->nextReadPriv = curr->nextReadPriv; } curr->nextReadPriv = NULL; __glXUnrefDrawablePrivate(glxc->readPriv); break; } } } /************************************************************************/ void __glXGetDrawableSize(__GLdrawablePrivate *glPriv, GLint *x, GLint *y, GLuint *width, GLuint *height) { __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other; if (glxPriv) { *x = glxPriv->xorigin; *y = glxPriv->yorigin; *width = glxPriv->width; *height = glxPriv->height; } else { *x = *y = *width = *height = 0; } } GLboolean __glXResizeDrawable(__GLdrawablePrivate *glPriv) { /* nothing to be done here */ return GL_TRUE; } /*****************************************************************************/ /* accessing the drawable private */ static void LockDP(__GLdrawablePrivate *glPriv, __GLcontext *gc) { __GLinterface *glci = (__GLinterface *) gc; __GLXcontext *glxc = (__GLXcontext *) glci->imports.other; /* quick exit test */ if ((glxc->pendingState & (__GLX_PENDING_RESIZE | __GLX_PENDING_DESTROY | __GLX_PENDING_SWAP)) == 0x0) return; /* some pending state. Deal with it */ if (glxc->pendingState & __GLX_PENDING_RESIZE) { glxc->pendingState &= ~__GLX_PENDING_RESIZE; (*glci->exports.notifyResize)(gc); assert((glxc->pendingState & __GLX_PENDING_RESIZE) == 0x0); } if (glxc->pendingState & __GLX_PENDING_DESTROY) { glxc->pendingState &= ~__GLX_PENDING_DESTROY; assert(glxc->drawPriv->xorigin == 0); assert(glxc->drawPriv->yorigin == 0); assert(glxc->drawPriv->width == 0); assert(glxc->drawPriv->height == 0); assert(glxc->readPriv->xorigin == 0); assert(glxc->readPriv->yorigin == 0); assert(glxc->readPriv->width == 0); assert(glxc->readPriv->height == 0); (*glci->exports.notifyDestroy)(gc); __glXDeassociateContext(glxc); assert((glxc->pendingState & __GLX_PENDING_DESTROY) == 0x0); } if (glxc->pendingState & __GLX_PENDING_SWAP) { glxc->pendingState &= ~__GLX_PENDING_SWAP; (*glci->exports.notifySwapBuffers)(gc); assert((glxc->pendingState & __GLX_PENDING_SWAP) == 0x0); } } static void UnlockDP(__GLdrawablePrivate *glPriv) { } /*****************************************************************************/ /* Drawable private stuff */ void __glXRefDrawablePrivate(__GLXdrawablePrivate *glxPriv) { glxPriv->refCount++; } void __glXUnrefDrawablePrivate(__GLXdrawablePrivate *glxPriv) { glxPriv->refCount--; if (glxPriv->refCount == 0) { __glXDestroyDrawablePrivate(glxPriv); } } __GLXdrawablePrivate * __glXCreateDrawablePrivate(DrawablePtr pDraw, XID drawId, __GLcontextModes *modes) { __GLXdrawablePrivate *glxPriv; __GLdrawablePrivate *glPriv; __GLXscreenInfo *pGlxScreen; glxPriv = (__GLXdrawablePrivate *) malloc(sizeof(*glxPriv)); memset(glxPriv, 0, sizeof(__GLXdrawablePrivate)); glxPriv->type = pDraw->type; glxPriv->pDraw = pDraw; glxPriv->drawId = drawId; /* if not a pixmap, lookup will fail, so pGlxPixmap will be NULL */ glxPriv->pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, __glXPixmapRes); /* since we are creating the drawablePrivate, drawId should be new */ if (!AddResource(drawId, __glXDrawableRes, glxPriv)) { /* oops! */ free(glxPriv); return NULL; } /* fill up glPriv */ glPriv = &glxPriv->glPriv; glPriv->modes = (__GLcontextModes *) malloc(sizeof(__GLcontextModes)); *glPriv->modes = *modes; glPriv->malloc = malloc; glPriv->calloc = calloc; glPriv->realloc = realloc; glPriv->free = free; glPriv->addSwapRect = NULL; glPriv->setClipRect = (void (*)(__GLdrawablePrivate *, GLint, GLint, GLsizei, GLsizei)) __glXNop; glPriv->lockDP = LockDP; glPriv->unlockDP = UnlockDP; glPriv->getDrawableSize = __glXGetDrawableSize; glPriv->resize = __glXResizeDrawable; glPriv->other = glxPriv; /* allocate a one-rect ownership region */ glPriv->ownershipRegion.rects = (__GLregionRect *)calloc(1, sizeof(__GLregionRect)); glPriv->ownershipRegion.numRects = 1; glxPriv->freeBuffers = __glXFreeBuffers; glxPriv->updatePalette = (void (*)(__GLXdrawablePrivate *)) __glXNop; pGlxScreen = &__glXActiveScreens[pDraw->pScreen->myNum]; if (glxPriv->type == DRAWABLE_WINDOW) { VisualID vid = wVisual((WindowPtr)pDraw); glxPriv->modes = _gl_context_modes_find_visual( pGlxScreen->modes, vid ); __glXFBInitDrawable(glxPriv, modes); } else { glxPriv->modes = glxPriv->pGlxPixmap->modes; __glXPixInitDrawable(glxPriv, modes); } /* initialize the core's private buffer information */ (*pGlxScreen->createBuffer)(glxPriv); return glxPriv; } GLboolean __glXDestroyDrawablePrivate(__GLXdrawablePrivate *glxPriv) { __GLdrawablePrivate *glPriv = &glxPriv->glPriv; /* remove the drawable from the drawable list */ FreeResourceByType(glxPriv->drawId, __glXDrawableRes, FALSE); /* Have the core free any memory it may have attached to the drawable */ if (glPriv->freePrivate) { (*glPriv->freePrivate)(glPriv); } /* Free any framebuffer memory attached to the drawable */ if (glxPriv->freeBuffers) { (*glxPriv->freeBuffers)(glxPriv); } /* Free the drawable Private */ free(glxPriv->glPriv.modes); free(glxPriv->glPriv.ownershipRegion.rects); free(glxPriv); return GL_TRUE; } __GLXdrawablePrivate * __glXFindDrawablePrivate(XID drawId) { __GLXdrawablePrivate *glxPriv; glxPriv = (__GLXdrawablePrivate *)LookupIDByType(drawId, __glXDrawableRes); return glxPriv; } __GLXdrawablePrivate * __glXGetDrawablePrivate(DrawablePtr pDraw, XID drawId, __GLcontextModes *modes) { __GLXdrawablePrivate *glxPriv; glxPriv = __glXFindDrawablePrivate(drawId); if (glxPriv == NULL) { glxPriv = __glXCreateDrawablePrivate(pDraw, drawId, modes); if (glxPriv) { __glXRefDrawablePrivate(glxPriv); } } return glxPriv; } void __glXCacheDrawableSize(__GLXdrawablePrivate *glxPriv) { if (glxPriv) { if (glxPriv->pDraw) { glxPriv->xorigin = glxPriv->pDraw->x; glxPriv->yorigin = glxPriv->pDraw->y; glxPriv->width = glxPriv->pDraw->width; glxPriv->height = glxPriv->pDraw->height; } } } /* ** resize/move the drawable. Called during the actual resize callback ** to update the drawable side of the buffers */ GLboolean __glXResizeDrawableBuffers(__GLXdrawablePrivate *glxPriv) { __GLdrawablePrivate *glPriv = &glxPriv->glPriv; GLint x, y; GLuint w, h; #if defined(__GL_ALIGNED_BUFFERS) GLint xAlignment, yAlignment; GLint xOffset, yOffset; GLint xStart, xEnd; GLint yStart, yEnd; GLuint xAlignedMask, yAlignedMask; #endif GLboolean status = GL_TRUE; __glXCacheDrawableSize(glxPriv); w = glxPriv->width; h = glxPriv->height; x = glxPriv->xorigin; y = glxPriv->yorigin; #if defined(__GL_ALIGNED_BUFFERS) xAlignment = glPriv->xAlignment; yAlignment = glPriv->yAlignment; xOffset = x & (xAlignment-1); yOffset = y & (yAlignment-1); xAlignedMask = ~(xAlignment-1); yAlignedMask = ~(yAlignment-1); xStart = x; xEnd = x+w; yStart = y; yEnd = y+h; xStart &= xAlignedMask; if (xEnd & ~xAlignedMask) { xEnd = (xEnd&xAlignedMask) + xAlignment; } yStart &= yAlignedMask; if (yEnd & ~yAlignedMask) { yEnd = (yEnd&yAlignedMask) + yAlignment; } x = xStart; y = yStart; w = xEnd-xStart; h = yEnd-yStart; #endif if ((x != glPriv->xOrigin) || (y != glPriv->yOrigin) || #if defined(__GL_ALIGNED_BUFFERS) (xOffset != glPriv->xOffset) || (yOffset != glPriv->yOffset) || #endif (w != glPriv->width) || (h != glPriv->height) || (!w && !h)) { /* set up the glPriv info */ glPriv->width = w; glPriv->height = h; glPriv->xOrigin = x; glPriv->yOrigin = y; #if defined(__GL_ALIGNED_BUFFERS) glPriv->xOffset = xOffset; glPriv->yOffset = yOffset; #endif /* notify the buffers */ status = __glXResizeBuffers(glPriv, x, y, w, h); } return status; } /************************************************************************/ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/glxutil.h0000644000000000000000000000641713614532331017540 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _glxcmds_h_ #define _glxcmds_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ extern void __glXNop(void); /* relate contexts with drawables */ extern void __glXAssociateContext(__GLXcontext *glxc); extern void __glXDeassociateContext(__GLXcontext *glxc); /* drawable operation */ extern void __glXGetDrawableSize(__GLdrawablePrivate *glPriv, GLint *x, GLint *y, GLuint *width, GLuint *height); extern GLboolean __glXResizeDrawable(__GLdrawablePrivate *glPriv); extern GLboolean __glXResizeDrawableBuffers(__GLXdrawablePrivate *glxPriv); /* drawable management */ extern void __glXRefDrawablePrivate(__GLXdrawablePrivate *glxPriv); extern void __glXUnrefDrawablePrivate(__GLXdrawablePrivate *glxPriv); extern __GLXdrawablePrivate *__glXCreateDrawablePrivate(DrawablePtr pDraw, XID glxpixmapId, __GLcontextModes *modes); extern GLboolean __glXDestroyDrawablePrivate(__GLXdrawablePrivate *glxPriv); extern __GLXdrawablePrivate *__glXFindDrawablePrivate(XID glxpixmapId); extern __GLXdrawablePrivate *__glXGetDrawablePrivate(DrawablePtr pDraw, XID glxpixmapId, __GLcontextModes *modes); extern void __glXCacheDrawableSize(__GLXdrawablePrivate *glxPriv); /* context helper routines */ extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag); /* init helper routines */ extern void *__glXglDDXScreenInfo(void); extern void *__glXglDDXExtensionInfo(void); #endif /* _glxcmds_h_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/g_render.c0000644000000000000000000011037013614532331017622 0ustar /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) ** version 1.2.1 Specification. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxext.h" #include "g_disptab.h" #include "g_disptab_EXT.h" #include "unpack.h" #include "impsize.h" #include "singlesize.h" void __glXDisp_CallList(GLbyte *pc) { glCallList( *(GLuint *)(pc + 0) ); } void __glXDisp_ListBase(GLbyte *pc) { glListBase( *(GLuint *)(pc + 0) ); } void __glXDisp_Begin(GLbyte *pc) { glBegin( *(GLenum *)(pc + 0) ); } #define __GLX_SWAP_GLbyte(ptr) #define __GLX_SWAP_GLshort(ptr) __GLX_SWAP_SHORT(ptr) #define __GLX_SWAP_GLint(ptr) __GLX_SWAP_INT(ptr) #define __GLX_SWAP_GLubyte(ptr) #define __GLX_SWAP_GLushort(ptr) __GLX_SWAP_SHORT(ptr) #define __GLX_SWAP_GLuint(ptr) __GLX_SWAP_INT(ptr) #define __GLX_SWAP_GLdouble(ptr) __GLX_SWAP_DOUBLE(ptr) #define __GLX_SWAP_GLfloat(ptr) __GLX_SWAP_FLOAT(ptr) #define __GLX_SWAP_GLbyte_ARRAY(ptr,count) (void) swapEnd; (void) swapPC; (void) sw; #define __GLX_SWAP_GLshort_ARRAY(ptr,count) __GLX_SWAP_SHORT_ARRAY(ptr,count) #define __GLX_SWAP_GLint_ARRAY(ptr,count) __GLX_SWAP_INT_ARRAY(ptr,count) #define __GLX_SWAP_GLenum_ARRAY(ptr,count) __GLX_SWAP_INT_ARRAY(ptr,count) #define __GLX_SWAP_GLubyte_ARRAY(ptr,count) (void) swapEnd; (void) swapPC; (void) sw; #define __GLX_SWAP_GLushort_ARRAY(ptr,count) __GLX_SWAP_SHORT_ARRAY(ptr,count) #define __GLX_SWAP_GLuint_ARRAY(ptr,count) __GLX_SWAP_INT_ARRAY(ptr,count) #define __GLX_SWAP_GLdouble_ARRAY(ptr,count) __GLX_SWAP_DOUBLE_ARRAY(ptr,count) #define __GLX_SWAP_GLfloat_ARRAY(ptr,count) __GLX_SWAP_FLOAT_ARRAY(ptr,count) #ifdef __GLX_ALIGN64 /* If type is not GLdouble, the compiler should optimize this away. */ # define GLX_DO_ALIGN_MAGIC(count, type) \ do { \ if ( (sizeof(type) == 8) && ((unsigned long)(pc) & 7)) \ { \ __GLX_MEM_COPY(pc-4, pc, (count * sizeof( type ) )); \ pc -= 4; \ } \ } while( 0 ) #else # define GLX_DO_ALIGN_MAGIC(count, type) #endif #define dispatch_template_1( name, type ) \ void __glXDisp_ ## name ( GLbyte * pc ) \ { \ GLX_DO_ALIGN_MAGIC( 1, type ); \ gl ## name ( (type *) pc ); \ } \ void __glXDispSwap_ ## name ( GLbyte * pc ) \ { \ __GLX_DECLARE_SWAP_VARIABLES; \ GLX_DO_ALIGN_MAGIC( 1, type ); \ __GLX_SWAP_ ## type ( pc ); \ gl ## name ( (type *) pc ); \ } #define dispatch_template_3( name, type ) \ void __glXDisp_ ## name ( GLbyte * pc ) \ { \ GLX_DO_ALIGN_MAGIC( 3, type ); \ gl ## name ( (type *) pc ); \ } \ void __glXDispSwap_ ## name ( GLbyte * pc ) \ { \ __GLX_DECLARE_SWAP_VARIABLES; \ __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \ GLX_DO_ALIGN_MAGIC( 3, type ); \ __GLX_SWAP_ ## type ## _ARRAY(pc, 3); \ gl ## name ( (type *) pc ); \ } #define dispatch_template_4( name, type ) \ void __glXDisp_ ## name ( GLbyte * pc ) \ { \ GLX_DO_ALIGN_MAGIC( 4, type ); \ gl ## name ( (type *) pc ); \ } \ void __glXDispSwap_ ## name ( GLbyte * pc ) \ { \ __GLX_DECLARE_SWAP_VARIABLES; \ __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \ GLX_DO_ALIGN_MAGIC( 4, type ); \ __GLX_SWAP_ ## type ## _ARRAY(pc, 4); \ gl ## name ( (type *) pc ); \ } #define dispatch_template_4s( name, type ) \ void __glXDisp_ ## name ( GLbyte * pc ) \ { \ GLX_DO_ALIGN_MAGIC( 4, type ); \ gl ## name ( ((type *) pc)[0], ((type *) pc)[1], \ ((type *) pc)[2], ((type *) pc)[3] ); \ } \ void __glXDispSwap_ ## name ( GLbyte * pc ) \ { \ __GLX_DECLARE_SWAP_VARIABLES; \ __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \ GLX_DO_ALIGN_MAGIC( 4, type ); \ __GLX_SWAP_ ## type ## _ARRAY(pc, 4); \ gl ## name ( ((type *) pc)[0], ((type *) pc)[1], \ ((type *) pc)[2], ((type *) pc)[3] ); \ } /** * \bug All of the enum1 templates need to be updated to handle the case where * \c type is \c GLdouble. When the type is a double, the data comes before * the enum. This is also the reason the invocation of the * \c GLX_DO_ALIGN_MAGIC macro was removed. */ #define dispatch_template_enum1_1s( name, type ) \ void __glXDisp_ ## name ( GLbyte * pc ) \ { \ gl ## name ( *(GLenum *) (pc + 0), \ *(type *) (pc + 4) ); \ } \ void __glXDispSwap_ ## name ( GLbyte * pc ) \ { \ __GLX_DECLARE_SWAP_VARIABLES; \ __GLX_SWAP_INT (pc + 0); \ __GLX_SWAP_ ## type (pc + 4); \ gl ## name ( *(GLenum *) (pc + 0), \ *(type *) (pc + 4) ); \ } #define dispatch_template_enum1_Vv( name, type ) \ void __glXDisp_ ## name ( GLbyte * pc ) \ { \ gl ## name ( *(GLenum *) (pc + 0), \ (type *) (pc + 4) ); \ } \ void __glXDispSwap_ ## name ( GLbyte * pc ) \ { \ GLenum pname; GLint compsize; \ __GLX_DECLARE_SWAP_VARIABLES; \ __GLX_DECLARE_SWAP_ARRAY_VARIABLES; \ __GLX_SWAP_INT(pc + 0); \ pname = *(GLenum *)(pc + 0); \ compsize = __gl ## name ## _size(pname); \ if (compsize < 0) compsize = 0; \ __GLX_SWAP_ ## type ## _ARRAY(pc + 4, compsize); \ gl ## name ( *(GLenum *) (pc + 0), \ (type *) (pc + 4) ); \ } #ifndef MISSING_GL_EXTS dispatch_template_1( FogCoordfv, GLfloat ) dispatch_template_1( FogCoorddv, GLdouble ) dispatch_template_3( SecondaryColor3bv, GLbyte ) dispatch_template_3( SecondaryColor3sv, GLshort ) dispatch_template_3( SecondaryColor3iv, GLint ) dispatch_template_3( SecondaryColor3ubv, GLubyte ) dispatch_template_3( SecondaryColor3usv, GLushort ) dispatch_template_3( SecondaryColor3uiv, GLuint ) dispatch_template_3( SecondaryColor3fv, GLfloat ) dispatch_template_3( SecondaryColor3dv, GLdouble ) dispatch_template_4s( BlendFuncSeparate, GLenum ) #endif /* !MISSING_GL_EXTS */ void __glXDisp_Color3bv(GLbyte *pc) { glColor3bv( (GLbyte *)(pc + 0) ); } void __glXDisp_Color3dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 24); pc -= 4; } #endif glColor3dv( (GLdouble *)(pc + 0) ); } void __glXDisp_Color3fv(GLbyte *pc) { glColor3fv( (GLfloat *)(pc + 0) ); } void __glXDisp_Color3iv(GLbyte *pc) { glColor3iv( (GLint *)(pc + 0) ); } void __glXDisp_Color3sv(GLbyte *pc) { glColor3sv( (GLshort *)(pc + 0) ); } void __glXDisp_Color3ubv(GLbyte *pc) { glColor3ubv( (GLubyte *)(pc + 0) ); } void __glXDisp_Color3uiv(GLbyte *pc) { glColor3uiv( (GLuint *)(pc + 0) ); } void __glXDisp_Color3usv(GLbyte *pc) { glColor3usv( (GLushort *)(pc + 0) ); } void __glXDisp_Color4bv(GLbyte *pc) { glColor4bv( (GLbyte *)(pc + 0) ); } void __glXDisp_Color4dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 32); pc -= 4; } #endif glColor4dv( (GLdouble *)(pc + 0) ); } void __glXDisp_Color4fv(GLbyte *pc) { glColor4fv( (GLfloat *)(pc + 0) ); } void __glXDisp_Color4iv(GLbyte *pc) { glColor4iv( (GLint *)(pc + 0) ); } void __glXDisp_Color4sv(GLbyte *pc) { glColor4sv( (GLshort *)(pc + 0) ); } void __glXDisp_Color4ubv(GLbyte *pc) { glColor4ubv( (GLubyte *)(pc + 0) ); } void __glXDisp_Color4uiv(GLbyte *pc) { glColor4uiv( (GLuint *)(pc + 0) ); } void __glXDisp_Color4usv(GLbyte *pc) { glColor4usv( (GLushort *)(pc + 0) ); } void __glXDisp_EdgeFlagv(GLbyte *pc) { glEdgeFlagv( (GLboolean *)(pc + 0) ); } void __glXDisp_End(GLbyte *pc) { glEnd( ); } void __glXDisp_Indexdv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 8); pc -= 4; } #endif glIndexdv( (GLdouble *)(pc + 0) ); } void __glXDisp_Indexfv(GLbyte *pc) { glIndexfv( (GLfloat *)(pc + 0) ); } void __glXDisp_Indexiv(GLbyte *pc) { glIndexiv( (GLint *)(pc + 0) ); } void __glXDisp_Indexsv(GLbyte *pc) { glIndexsv( (GLshort *)(pc + 0) ); } void __glXDisp_Normal3bv(GLbyte *pc) { glNormal3bv( (GLbyte *)(pc + 0) ); } void __glXDisp_Normal3dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 24); pc -= 4; } #endif glNormal3dv( (GLdouble *)(pc + 0) ); } void __glXDisp_Normal3fv(GLbyte *pc) { glNormal3fv( (GLfloat *)(pc + 0) ); } void __glXDisp_Normal3iv(GLbyte *pc) { glNormal3iv( (GLint *)(pc + 0) ); } void __glXDisp_Normal3sv(GLbyte *pc) { glNormal3sv( (GLshort *)(pc + 0) ); } void __glXDisp_RasterPos2dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 16); pc -= 4; } #endif glRasterPos2dv( (GLdouble *)(pc + 0) ); } void __glXDisp_RasterPos2fv(GLbyte *pc) { glRasterPos2fv( (GLfloat *)(pc + 0) ); } void __glXDisp_RasterPos2iv(GLbyte *pc) { glRasterPos2iv( (GLint *)(pc + 0) ); } void __glXDisp_RasterPos2sv(GLbyte *pc) { glRasterPos2sv( (GLshort *)(pc + 0) ); } void __glXDisp_RasterPos3dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 24); pc -= 4; } #endif glRasterPos3dv( (GLdouble *)(pc + 0) ); } void __glXDisp_RasterPos3fv(GLbyte *pc) { glRasterPos3fv( (GLfloat *)(pc + 0) ); } void __glXDisp_RasterPos3iv(GLbyte *pc) { glRasterPos3iv( (GLint *)(pc + 0) ); } void __glXDisp_RasterPos3sv(GLbyte *pc) { glRasterPos3sv( (GLshort *)(pc + 0) ); } void __glXDisp_RasterPos4dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 32); pc -= 4; } #endif glRasterPos4dv( (GLdouble *)(pc + 0) ); } void __glXDisp_RasterPos4fv(GLbyte *pc) { glRasterPos4fv( (GLfloat *)(pc + 0) ); } void __glXDisp_RasterPos4iv(GLbyte *pc) { glRasterPos4iv( (GLint *)(pc + 0) ); } void __glXDisp_RasterPos4sv(GLbyte *pc) { glRasterPos4sv( (GLshort *)(pc + 0) ); } void __glXDisp_Rectdv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 32); pc -= 4; } #endif glRectdv( (GLdouble *)(pc + 0), (GLdouble *)(pc + 16) ); } void __glXDisp_Rectfv(GLbyte *pc) { glRectfv( (GLfloat *)(pc + 0), (GLfloat *)(pc + 8) ); } void __glXDisp_Rectiv(GLbyte *pc) { glRectiv( (GLint *)(pc + 0), (GLint *)(pc + 8) ); } void __glXDisp_Rectsv(GLbyte *pc) { glRectsv( (GLshort *)(pc + 0), (GLshort *)(pc + 4) ); } void __glXDisp_TexCoord1dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 8); pc -= 4; } #endif glTexCoord1dv( (GLdouble *)(pc + 0) ); } void __glXDisp_TexCoord1fv(GLbyte *pc) { glTexCoord1fv( (GLfloat *)(pc + 0) ); } void __glXDisp_TexCoord1iv(GLbyte *pc) { glTexCoord1iv( (GLint *)(pc + 0) ); } void __glXDisp_TexCoord1sv(GLbyte *pc) { glTexCoord1sv( (GLshort *)(pc + 0) ); } void __glXDisp_TexCoord2dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 16); pc -= 4; } #endif glTexCoord2dv( (GLdouble *)(pc + 0) ); } void __glXDisp_TexCoord2fv(GLbyte *pc) { glTexCoord2fv( (GLfloat *)(pc + 0) ); } void __glXDisp_TexCoord2iv(GLbyte *pc) { glTexCoord2iv( (GLint *)(pc + 0) ); } void __glXDisp_TexCoord2sv(GLbyte *pc) { glTexCoord2sv( (GLshort *)(pc + 0) ); } void __glXDisp_TexCoord3dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 24); pc -= 4; } #endif glTexCoord3dv( (GLdouble *)(pc + 0) ); } void __glXDisp_TexCoord3fv(GLbyte *pc) { glTexCoord3fv( (GLfloat *)(pc + 0) ); } void __glXDisp_TexCoord3iv(GLbyte *pc) { glTexCoord3iv( (GLint *)(pc + 0) ); } void __glXDisp_TexCoord3sv(GLbyte *pc) { glTexCoord3sv( (GLshort *)(pc + 0) ); } void __glXDisp_TexCoord4dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 32); pc -= 4; } #endif glTexCoord4dv( (GLdouble *)(pc + 0) ); } void __glXDisp_TexCoord4fv(GLbyte *pc) { glTexCoord4fv( (GLfloat *)(pc + 0) ); } void __glXDisp_TexCoord4iv(GLbyte *pc) { glTexCoord4iv( (GLint *)(pc + 0) ); } void __glXDisp_TexCoord4sv(GLbyte *pc) { glTexCoord4sv( (GLshort *)(pc + 0) ); } void __glXDisp_Vertex2dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 16); pc -= 4; } #endif glVertex2dv( (GLdouble *)(pc + 0) ); } void __glXDisp_Vertex2fv(GLbyte *pc) { glVertex2fv( (GLfloat *)(pc + 0) ); } void __glXDisp_Vertex2iv(GLbyte *pc) { glVertex2iv( (GLint *)(pc + 0) ); } void __glXDisp_Vertex2sv(GLbyte *pc) { glVertex2sv( (GLshort *)(pc + 0) ); } void __glXDisp_Vertex3dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 24); pc -= 4; } #endif glVertex3dv( (GLdouble *)(pc + 0) ); } void __glXDisp_Vertex3fv(GLbyte *pc) { glVertex3fv( (GLfloat *)(pc + 0) ); } void __glXDisp_Vertex3iv(GLbyte *pc) { glVertex3iv( (GLint *)(pc + 0) ); } void __glXDisp_Vertex3sv(GLbyte *pc) { glVertex3sv( (GLshort *)(pc + 0) ); } void __glXDisp_Vertex4dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 32); pc -= 4; } #endif glVertex4dv( (GLdouble *)(pc + 0) ); } void __glXDisp_Vertex4fv(GLbyte *pc) { glVertex4fv( (GLfloat *)(pc + 0) ); } void __glXDisp_Vertex4iv(GLbyte *pc) { glVertex4iv( (GLint *)(pc + 0) ); } void __glXDisp_Vertex4sv(GLbyte *pc) { glVertex4sv( (GLshort *)(pc + 0) ); } void __glXDisp_ClipPlane(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 36); pc -= 4; } #endif glClipPlane( *(GLenum *)(pc + 32), (GLdouble *)(pc + 0) ); } void __glXDisp_ColorMaterial(GLbyte *pc) { glColorMaterial( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4) ); } void __glXDisp_CullFace(GLbyte *pc) { glCullFace( *(GLenum *)(pc + 0) ); } void __glXDisp_Fogf(GLbyte *pc) { glFogf( *(GLenum *)(pc + 0), *(GLfloat *)(pc + 4) ); } void __glXDisp_Fogfv(GLbyte *pc) { glFogfv( *(GLenum *)(pc + 0), (GLfloat *)(pc + 4) ); } void __glXDisp_Fogi(GLbyte *pc) { glFogi( *(GLenum *)(pc + 0), *(GLint *)(pc + 4) ); } void __glXDisp_Fogiv(GLbyte *pc) { glFogiv( *(GLenum *)(pc + 0), (GLint *)(pc + 4) ); } void __glXDisp_FrontFace(GLbyte *pc) { glFrontFace( *(GLenum *)(pc + 0) ); } void __glXDisp_Hint(GLbyte *pc) { glHint( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4) ); } void __glXDisp_Lightf(GLbyte *pc) { glLightf( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDisp_Lightfv(GLbyte *pc) { glLightfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDisp_Lighti(GLbyte *pc) { glLighti( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8) ); } void __glXDisp_Lightiv(GLbyte *pc) { glLightiv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); } void __glXDisp_LightModelf(GLbyte *pc) { glLightModelf( *(GLenum *)(pc + 0), *(GLfloat *)(pc + 4) ); } void __glXDisp_LightModelfv(GLbyte *pc) { glLightModelfv( *(GLenum *)(pc + 0), (GLfloat *)(pc + 4) ); } void __glXDisp_LightModeli(GLbyte *pc) { glLightModeli( *(GLenum *)(pc + 0), *(GLint *)(pc + 4) ); } void __glXDisp_LightModeliv(GLbyte *pc) { glLightModeliv( *(GLenum *)(pc + 0), (GLint *)(pc + 4) ); } void __glXDisp_LineStipple(GLbyte *pc) { glLineStipple( *(GLint *)(pc + 0), *(GLushort *)(pc + 4) ); } void __glXDisp_LineWidth(GLbyte *pc) { glLineWidth( *(GLfloat *)(pc + 0) ); } void __glXDisp_Materialf(GLbyte *pc) { glMaterialf( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDisp_Materialfv(GLbyte *pc) { glMaterialfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDisp_Materiali(GLbyte *pc) { glMateriali( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8) ); } void __glXDisp_Materialiv(GLbyte *pc) { glMaterialiv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); } void __glXDisp_PointSize(GLbyte *pc) { glPointSize( *(GLfloat *)(pc + 0) ); } void __glXDisp_PolygonMode(GLbyte *pc) { glPolygonMode( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4) ); } void __glXDisp_Scissor(GLbyte *pc) { glScissor( *(GLint *)(pc + 0), *(GLint *)(pc + 4), *(GLsizei *)(pc + 8), *(GLsizei *)(pc + 12) ); } void __glXDisp_ShadeModel(GLbyte *pc) { glShadeModel( *(GLenum *)(pc + 0) ); } void __glXDisp_TexParameterf(GLbyte *pc) { glTexParameterf( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDisp_TexParameterfv(GLbyte *pc) { glTexParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDisp_TexParameteri(GLbyte *pc) { glTexParameteri( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8) ); } void __glXDisp_TexParameteriv(GLbyte *pc) { glTexParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); } void __glXDisp_TexEnvf(GLbyte *pc) { glTexEnvf( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDisp_TexEnvfv(GLbyte *pc) { glTexEnvfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDisp_TexEnvi(GLbyte *pc) { glTexEnvi( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8) ); } void __glXDisp_TexEnviv(GLbyte *pc) { glTexEnviv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); } void __glXDisp_TexGend(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 16); pc -= 4; } #endif glTexGend( *(GLenum *)(pc + 8), *(GLenum *)(pc + 12), *(GLdouble *)(pc + 0) ); } void __glXDisp_TexGendv(GLbyte *pc) { #ifdef __GLX_ALIGN64 GLenum pname; GLint cmdlen; GLint compsize; pname = *(GLenum *)(pc + 4); compsize = __glTexGendv_size(pname); if (compsize < 0) compsize = 0; cmdlen = __GLX_PAD(8+compsize*8); if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, cmdlen); pc -= 4; } #endif glTexGendv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLdouble *)(pc + 8) ); } void __glXDisp_TexGenf(GLbyte *pc) { glTexGenf( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDisp_TexGenfv(GLbyte *pc) { glTexGenfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDisp_TexGeni(GLbyte *pc) { glTexGeni( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8) ); } void __glXDisp_TexGeniv(GLbyte *pc) { glTexGeniv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); } void __glXDisp_InitNames(GLbyte *pc) { glInitNames( ); } void __glXDisp_LoadName(GLbyte *pc) { glLoadName( *(GLuint *)(pc + 0) ); } void __glXDisp_PassThrough(GLbyte *pc) { glPassThrough( *(GLfloat *)(pc + 0) ); } void __glXDisp_PopName(GLbyte *pc) { glPopName( ); } void __glXDisp_PushName(GLbyte *pc) { glPushName( *(GLuint *)(pc + 0) ); } void __glXDisp_DrawBuffer(GLbyte *pc) { glDrawBuffer( *(GLenum *)(pc + 0) ); } void __glXDisp_Clear(GLbyte *pc) { glClear( *(GLbitfield *)(pc + 0) ); } void __glXDisp_ClearAccum(GLbyte *pc) { glClearAccum( *(GLfloat *)(pc + 0), *(GLfloat *)(pc + 4), *(GLfloat *)(pc + 8), *(GLfloat *)(pc + 12) ); } void __glXDisp_ClearIndex(GLbyte *pc) { glClearIndex( *(GLfloat *)(pc + 0) ); } void __glXDisp_ClearColor(GLbyte *pc) { glClearColor( *(GLclampf *)(pc + 0), *(GLclampf *)(pc + 4), *(GLclampf *)(pc + 8), *(GLclampf *)(pc + 12) ); } void __glXDisp_ClearStencil(GLbyte *pc) { glClearStencil( *(GLint *)(pc + 0) ); } void __glXDisp_ClearDepth(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 8); pc -= 4; } #endif glClearDepth( *(GLclampd *)(pc + 0) ); } void __glXDisp_StencilMask(GLbyte *pc) { glStencilMask( *(GLuint *)(pc + 0) ); } void __glXDisp_ColorMask(GLbyte *pc) { glColorMask( *(GLboolean *)(pc + 0), *(GLboolean *)(pc + 1), *(GLboolean *)(pc + 2), *(GLboolean *)(pc + 3) ); } void __glXDisp_DepthMask(GLbyte *pc) { glDepthMask( *(GLboolean *)(pc + 0) ); } void __glXDisp_IndexMask(GLbyte *pc) { glIndexMask( *(GLuint *)(pc + 0) ); } void __glXDisp_Accum(GLbyte *pc) { glAccum( *(GLenum *)(pc + 0), *(GLfloat *)(pc + 4) ); } void __glXDisp_Disable(GLbyte *pc) { glDisable( *(GLenum *)(pc + 0) ); } void __glXDisp_Enable(GLbyte *pc) { glEnable( *(GLenum *)(pc + 0) ); } void __glXDisp_PopAttrib(GLbyte *pc) { glPopAttrib( ); } void __glXDisp_PushAttrib(GLbyte *pc) { glPushAttrib( *(GLbitfield *)(pc + 0) ); } void __glXDisp_MapGrid1d(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 20); pc -= 4; } #endif glMapGrid1d( *(GLint *)(pc + 16), *(GLdouble *)(pc + 0), *(GLdouble *)(pc + 8) ); } void __glXDisp_MapGrid1f(GLbyte *pc) { glMapGrid1f( *(GLint *)(pc + 0), *(GLfloat *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDisp_MapGrid2d(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 40); pc -= 4; } #endif glMapGrid2d( *(GLint *)(pc + 32), *(GLdouble *)(pc + 0), *(GLdouble *)(pc + 8), *(GLint *)(pc + 36), *(GLdouble *)(pc + 16), *(GLdouble *)(pc + 24) ); } void __glXDisp_MapGrid2f(GLbyte *pc) { glMapGrid2f( *(GLint *)(pc + 0), *(GLfloat *)(pc + 4), *(GLfloat *)(pc + 8), *(GLint *)(pc + 12), *(GLfloat *)(pc + 16), *(GLfloat *)(pc + 20) ); } void __glXDisp_EvalCoord1dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 8); pc -= 4; } #endif glEvalCoord1dv( (GLdouble *)(pc + 0) ); } void __glXDisp_EvalCoord1fv(GLbyte *pc) { glEvalCoord1fv( (GLfloat *)(pc + 0) ); } void __glXDisp_EvalCoord2dv(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 16); pc -= 4; } #endif glEvalCoord2dv( (GLdouble *)(pc + 0) ); } void __glXDisp_EvalCoord2fv(GLbyte *pc) { glEvalCoord2fv( (GLfloat *)(pc + 0) ); } void __glXDisp_EvalMesh1(GLbyte *pc) { glEvalMesh1( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLint *)(pc + 8) ); } void __glXDisp_EvalPoint1(GLbyte *pc) { glEvalPoint1( *(GLint *)(pc + 0) ); } void __glXDisp_EvalMesh2(GLbyte *pc) { glEvalMesh2( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLint *)(pc + 16) ); } void __glXDisp_EvalPoint2(GLbyte *pc) { glEvalPoint2( *(GLint *)(pc + 0), *(GLint *)(pc + 4) ); } void __glXDisp_AlphaFunc(GLbyte *pc) { glAlphaFunc( *(GLenum *)(pc + 0), *(GLclampf *)(pc + 4) ); } void __glXDisp_BlendFunc(GLbyte *pc) { glBlendFunc( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4) ); } void __glXDisp_LogicOp(GLbyte *pc) { glLogicOp( *(GLenum *)(pc + 0) ); } void __glXDisp_StencilFunc(GLbyte *pc) { glStencilFunc( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLuint *)(pc + 8) ); } void __glXDisp_StencilOp(GLbyte *pc) { glStencilOp( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLenum *)(pc + 8) ); } void __glXDisp_DepthFunc(GLbyte *pc) { glDepthFunc( *(GLenum *)(pc + 0) ); } void __glXDisp_PixelZoom(GLbyte *pc) { glPixelZoom( *(GLfloat *)(pc + 0), *(GLfloat *)(pc + 4) ); } void __glXDisp_PixelTransferf(GLbyte *pc) { glPixelTransferf( *(GLenum *)(pc + 0), *(GLfloat *)(pc + 4) ); } void __glXDisp_PixelTransferi(GLbyte *pc) { glPixelTransferi( *(GLenum *)(pc + 0), *(GLint *)(pc + 4) ); } void __glXDisp_PixelMapfv(GLbyte *pc) { glPixelMapfv( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDisp_PixelMapuiv(GLbyte *pc) { glPixelMapuiv( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), (GLuint *)(pc + 8) ); } void __glXDisp_PixelMapusv(GLbyte *pc) { glPixelMapusv( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), (GLushort *)(pc + 8) ); } void __glXDisp_ReadBuffer(GLbyte *pc) { glReadBuffer( *(GLenum *)(pc + 0) ); } void __glXDisp_CopyPixels(GLbyte *pc) { glCopyPixels( *(GLint *)(pc + 0), *(GLint *)(pc + 4), *(GLsizei *)(pc + 8), *(GLsizei *)(pc + 12), *(GLenum *)(pc + 16) ); } void __glXDisp_DepthRange(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 16); pc -= 4; } #endif glDepthRange( *(GLclampd *)(pc + 0), *(GLclampd *)(pc + 8) ); } void __glXDisp_Frustum(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 48); pc -= 4; } #endif glFrustum( *(GLdouble *)(pc + 0), *(GLdouble *)(pc + 8), *(GLdouble *)(pc + 16), *(GLdouble *)(pc + 24), *(GLdouble *)(pc + 32), *(GLdouble *)(pc + 40) ); } void __glXDisp_LoadIdentity(GLbyte *pc) { glLoadIdentity( ); } void __glXDisp_LoadMatrixf(GLbyte *pc) { glLoadMatrixf( (GLfloat *)(pc + 0) ); } void __glXDisp_LoadMatrixd(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 128); pc -= 4; } #endif glLoadMatrixd( (GLdouble *)(pc + 0) ); } void __glXDisp_MatrixMode(GLbyte *pc) { glMatrixMode( *(GLenum *)(pc + 0) ); } void __glXDisp_MultMatrixf(GLbyte *pc) { glMultMatrixf( (GLfloat *)(pc + 0) ); } void __glXDisp_MultMatrixd(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 128); pc -= 4; } #endif glMultMatrixd( (GLdouble *)(pc + 0) ); } void __glXDisp_Ortho(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 48); pc -= 4; } #endif glOrtho( *(GLdouble *)(pc + 0), *(GLdouble *)(pc + 8), *(GLdouble *)(pc + 16), *(GLdouble *)(pc + 24), *(GLdouble *)(pc + 32), *(GLdouble *)(pc + 40) ); } void __glXDisp_PopMatrix(GLbyte *pc) { glPopMatrix( ); } void __glXDisp_PushMatrix(GLbyte *pc) { glPushMatrix( ); } void __glXDisp_Rotated(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 32); pc -= 4; } #endif glRotated( *(GLdouble *)(pc + 0), *(GLdouble *)(pc + 8), *(GLdouble *)(pc + 16), *(GLdouble *)(pc + 24) ); } void __glXDisp_Rotatef(GLbyte *pc) { glRotatef( *(GLfloat *)(pc + 0), *(GLfloat *)(pc + 4), *(GLfloat *)(pc + 8), *(GLfloat *)(pc + 12) ); } void __glXDisp_Scaled(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 24); pc -= 4; } #endif glScaled( *(GLdouble *)(pc + 0), *(GLdouble *)(pc + 8), *(GLdouble *)(pc + 16) ); } void __glXDisp_Scalef(GLbyte *pc) { glScalef( *(GLfloat *)(pc + 0), *(GLfloat *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDisp_Translated(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 24); pc -= 4; } #endif glTranslated( *(GLdouble *)(pc + 0), *(GLdouble *)(pc + 8), *(GLdouble *)(pc + 16) ); } void __glXDisp_Translatef(GLbyte *pc) { glTranslatef( *(GLfloat *)(pc + 0), *(GLfloat *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDisp_Viewport(GLbyte *pc) { glViewport( *(GLint *)(pc + 0), *(GLint *)(pc + 4), *(GLsizei *)(pc + 8), *(GLsizei *)(pc + 12) ); } void __glXDisp_PolygonOffset(GLbyte *pc) { glPolygonOffset( *(GLfloat *)(pc + 0), *(GLfloat *)(pc + 4) ); } void __glXDisp_CopyTexImage1D(GLbyte *pc) { glCopyTexImage1D( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), *(GLint *)(pc + 12), *(GLint *)(pc + 16), *(GLsizei *)(pc + 20), *(GLint *)(pc + 24) ); } void __glXDisp_CopyTexImage2D(GLbyte *pc) { glCopyTexImage2D( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), *(GLint *)(pc + 12), *(GLint *)(pc + 16), *(GLsizei *)(pc + 20), *(GLsizei *)(pc + 24), *(GLint *)(pc + 28) ); } void __glXDisp_CopyTexSubImage1D(GLbyte *pc) { glCopyTexSubImage1D( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLint *)(pc + 16), *(GLsizei *)(pc + 20) ); } void __glXDisp_CopyTexSubImage2D(GLbyte *pc) { glCopyTexSubImage2D( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLint *)(pc + 16), *(GLint *)(pc + 20), *(GLsizei *)(pc + 24), *(GLsizei *)(pc + 28) ); } void __glXDisp_BindTexture(GLbyte *pc) { glBindTexture( *(GLenum *)(pc + 0), *(GLuint *)(pc + 4) ); } void __glXDisp_PrioritizeTextures(GLbyte *pc) { GLsizei n; n = *(GLsizei *)(pc + 0); glPrioritizeTextures( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4), (GLclampf *)(pc + 4+n*4) ); } void __glXDisp_Indexubv(GLbyte *pc) { glIndexubv( (GLubyte *)(pc + 0) ); } void __glXDisp_BlendColor(GLbyte *pc) { glBlendColor( *(GLclampf *)(pc + 0), *(GLclampf *)(pc + 4), *(GLclampf *)(pc + 8), *(GLclampf *)(pc + 12) ); } void __glXDisp_BlendEquation(GLbyte *pc) { glBlendEquation( *(GLenum *)(pc + 0) ); } void __glXDisp_ColorTableParameterfv(GLbyte *pc) { glColorTableParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDisp_ColorTableParameteriv(GLbyte *pc) { glColorTableParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); } void __glXDisp_CopyColorTable(GLbyte *pc) { glCopyColorTable( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLsizei *)(pc + 16) ); } void __glXDisp_CopyColorSubTable(GLbyte *pc) { glCopyColorSubTable( *(GLenum *)(pc + 0), *(GLsizei *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLsizei *)(pc + 16) ); } void __glXDisp_ConvolutionParameterf(GLbyte *pc) { glConvolutionParameterf( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDisp_ConvolutionParameterfv(GLbyte *pc) { glConvolutionParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDisp_ConvolutionParameteri(GLbyte *pc) { glConvolutionParameteri( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8) ); } void __glXDisp_ConvolutionParameteriv(GLbyte *pc) { glConvolutionParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); } void __glXDisp_CopyConvolutionFilter1D(GLbyte *pc) { glCopyConvolutionFilter1D( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLsizei *)(pc + 16) ); } void __glXDisp_CopyConvolutionFilter2D(GLbyte *pc) { glCopyConvolutionFilter2D( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLsizei *)(pc + 16), *(GLsizei *)(pc + 20) ); } void __glXDisp_Histogram(GLbyte *pc) { glHistogram( *(GLenum *)(pc + 0), *(GLsizei *)(pc + 4), *(GLenum *)(pc + 8), *(GLboolean *)(pc + 12) ); } void __glXDisp_Minmax(GLbyte *pc) { glMinmax( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLboolean *)(pc + 8) ); } void __glXDisp_ResetHistogram(GLbyte *pc) { glResetHistogram( *(GLenum *)(pc + 0) ); } void __glXDisp_ResetMinmax(GLbyte *pc) { glResetMinmax( *(GLenum *)(pc + 0) ); } void __glXDisp_CopyTexSubImage3D(GLbyte *pc) { glCopyTexSubImage3D( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLint *)(pc + 16), *(GLint *)(pc + 20), *(GLint *)(pc + 24), *(GLsizei *)(pc + 28), *(GLsizei *)(pc + 32) ); } void __glXDisp_ActiveTextureARB(GLbyte *pc) { glActiveTextureARB( *(GLenum *)(pc + 0) ); } void __glXDisp_MultiTexCoord1dvARB(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 12); pc -= 4; } #endif glMultiTexCoord1dvARB( *(GLenum *)(pc + 8), (GLdouble *)(pc + 0) ); } void __glXDisp_MultiTexCoord1fvARB(GLbyte *pc) { glMultiTexCoord1fvARB( *(GLenum *)(pc + 0), (GLfloat *)(pc + 4) ); } void __glXDisp_MultiTexCoord1ivARB(GLbyte *pc) { glMultiTexCoord1ivARB( *(GLenum *)(pc + 0), (GLint *)(pc + 4) ); } void __glXDisp_MultiTexCoord1svARB(GLbyte *pc) { glMultiTexCoord1svARB( *(GLenum *)(pc + 0), (GLshort *)(pc + 4) ); } void __glXDisp_MultiTexCoord2dvARB(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 20); pc -= 4; } #endif glMultiTexCoord2dvARB( *(GLenum *)(pc + 16), (GLdouble *)(pc + 0) ); } void __glXDisp_MultiTexCoord2fvARB(GLbyte *pc) { glMultiTexCoord2fvARB( *(GLenum *)(pc + 0), (GLfloat *)(pc + 4) ); } void __glXDisp_MultiTexCoord2ivARB(GLbyte *pc) { glMultiTexCoord2ivARB( *(GLenum *)(pc + 0), (GLint *)(pc + 4) ); } void __glXDisp_MultiTexCoord2svARB(GLbyte *pc) { glMultiTexCoord2svARB( *(GLenum *)(pc + 0), (GLshort *)(pc + 4) ); } void __glXDisp_MultiTexCoord3dvARB(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 28); pc -= 4; } #endif glMultiTexCoord3dvARB( *(GLenum *)(pc + 24), (GLdouble *)(pc + 0) ); } void __glXDisp_MultiTexCoord3fvARB(GLbyte *pc) { glMultiTexCoord3fvARB( *(GLenum *)(pc + 0), (GLfloat *)(pc + 4) ); } void __glXDisp_MultiTexCoord3ivARB(GLbyte *pc) { glMultiTexCoord3ivARB( *(GLenum *)(pc + 0), (GLint *)(pc + 4) ); } void __glXDisp_MultiTexCoord3svARB(GLbyte *pc) { glMultiTexCoord3svARB( *(GLenum *)(pc + 0), (GLshort *)(pc + 4) ); } void __glXDisp_MultiTexCoord4dvARB(GLbyte *pc) { #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 36); pc -= 4; } #endif glMultiTexCoord4dvARB( *(GLenum *)(pc + 32), (GLdouble *)(pc + 0) ); } void __glXDisp_MultiTexCoord4fvARB(GLbyte *pc) { glMultiTexCoord4fvARB( *(GLenum *)(pc + 0), (GLfloat *)(pc + 4) ); } void __glXDisp_MultiTexCoord4ivARB(GLbyte *pc) { glMultiTexCoord4ivARB( *(GLenum *)(pc + 0), (GLint *)(pc + 4) ); } void __glXDisp_MultiTexCoord4svARB(GLbyte *pc) { glMultiTexCoord4svARB( *(GLenum *)(pc + 0), (GLshort *)(pc + 4) ); } /* * Extensions */ #ifndef MISSING_GL_EXTS void __glXDisp_PointParameterfARB(GLbyte *pc) { glPointParameterfARB( *(GLenum *)(pc + 0), *(GLfloat *)(pc + 4) ); } void __glXDisp_PointParameterfvARB(GLbyte *pc) { glPointParameterfvARB( *(GLenum *)(pc + 0), (GLfloat *)(pc + 4) ); } dispatch_template_enum1_1s(PointParameteriNV, GLint) dispatch_template_enum1_Vv(PointParameterivNV, GLint) void __glXDisp_ActiveStencilFaceEXT(GLbyte *pc) { glActiveStencilFaceEXT( *(GLenum *)(pc + 0) ); } void __glXDisp_WindowPos3fARB(GLbyte *pc) { glWindowPos3fARB( *(GLfloat *)(pc + 0), *(GLfloat *)(pc + 4), *(GLfloat *)(pc + 8) ); } #endif /* !MISSING_GL_EXTS */ void __glXDisp_SampleCoverageARB(GLbyte *pc) { glSampleCoverageARB( *(GLfloat *)(pc + 0), *(GLboolean *)(pc + 4) ); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/g_renderswap.c0000644000000000000000000016374213614532331020530 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) ** version 1.2.1 Specification. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxext.h" #include "g_disptab.h" #include "g_disptab_EXT.h" #include "unpack.h" #include "impsize.h" #include "singlesize.h" void __glXDispSwap_CallList(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glCallList( *(GLuint *)(pc + 0) ); } void __glXDispSwap_ListBase(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glListBase( *(GLuint *)(pc + 0) ); } void __glXDispSwap_Begin(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glBegin( *(GLenum *)(pc + 0) ); } void __glXDispSwap_Color3bv(GLbyte *pc) { glColor3bv( (GLbyte *)(pc + 0) ); } void __glXDispSwap_Color3dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 24); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); glColor3dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_Color3fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); glColor3fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_Color3iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 3); glColor3iv( (GLint *)(pc + 0) ); } void __glXDispSwap_Color3sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); glColor3sv( (GLshort *)(pc + 0) ); } void __glXDispSwap_Color3ubv(GLbyte *pc) { glColor3ubv( (GLubyte *)(pc + 0) ); } void __glXDispSwap_Color3uiv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 3); glColor3uiv( (GLuint *)(pc + 0) ); } void __glXDispSwap_Color3usv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); glColor3usv( (GLushort *)(pc + 0) ); } void __glXDispSwap_Color4bv(GLbyte *pc) { glColor4bv( (GLbyte *)(pc + 0) ); } void __glXDispSwap_Color4dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 32); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); glColor4dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_Color4fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); glColor4fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_Color4iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 4); glColor4iv( (GLint *)(pc + 0) ); } void __glXDispSwap_Color4sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); glColor4sv( (GLshort *)(pc + 0) ); } void __glXDispSwap_Color4ubv(GLbyte *pc) { glColor4ubv( (GLubyte *)(pc + 0) ); } void __glXDispSwap_Color4uiv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 4); glColor4uiv( (GLuint *)(pc + 0) ); } void __glXDispSwap_Color4usv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); glColor4usv( (GLushort *)(pc + 0) ); } void __glXDispSwap_EdgeFlagv(GLbyte *pc) { glEdgeFlagv( (GLboolean *)(pc + 0) ); } void __glXDispSwap_End(GLbyte *pc) { glEnd( ); } void __glXDispSwap_Indexdv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 8); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); glIndexdv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_Indexfv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1); glIndexfv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_Indexiv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 1); glIndexiv( (GLint *)(pc + 0) ); } void __glXDispSwap_Indexsv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 1); glIndexsv( (GLshort *)(pc + 0) ); } void __glXDispSwap_Normal3bv(GLbyte *pc) { glNormal3bv( (GLbyte *)(pc + 0) ); } void __glXDispSwap_Normal3dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 24); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); glNormal3dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_Normal3fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); glNormal3fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_Normal3iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 3); glNormal3iv( (GLint *)(pc + 0) ); } void __glXDispSwap_Normal3sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); glNormal3sv( (GLshort *)(pc + 0) ); } void __glXDispSwap_RasterPos2dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 16); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); glRasterPos2dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_RasterPos2fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); glRasterPos2fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_RasterPos2iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 2); glRasterPos2iv( (GLint *)(pc + 0) ); } void __glXDispSwap_RasterPos2sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); glRasterPos2sv( (GLshort *)(pc + 0) ); } void __glXDispSwap_RasterPos3dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 24); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); glRasterPos3dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_RasterPos3fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); glRasterPos3fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_RasterPos3iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 3); glRasterPos3iv( (GLint *)(pc + 0) ); } void __glXDispSwap_RasterPos3sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); glRasterPos3sv( (GLshort *)(pc + 0) ); } void __glXDispSwap_RasterPos4dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 32); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); glRasterPos4dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_RasterPos4fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); glRasterPos4fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_RasterPos4iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 4); glRasterPos4iv( (GLint *)(pc + 0) ); } void __glXDispSwap_RasterPos4sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); glRasterPos4sv( (GLshort *)(pc + 0) ); } void __glXDispSwap_Rectdv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 32); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); __GLX_SWAP_DOUBLE_ARRAY(pc + 16, 2); glRectdv( (GLdouble *)(pc + 0), (GLdouble *)(pc + 16) ); } void __glXDispSwap_Rectfv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); __GLX_SWAP_FLOAT_ARRAY(pc + 8, 2); glRectfv( (GLfloat *)(pc + 0), (GLfloat *)(pc + 8) ); } void __glXDispSwap_Rectiv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 2); __GLX_SWAP_INT_ARRAY(pc + 8, 2); glRectiv( (GLint *)(pc + 0), (GLint *)(pc + 8) ); } void __glXDispSwap_Rectsv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); __GLX_SWAP_SHORT_ARRAY(pc + 4, 2); glRectsv( (GLshort *)(pc + 0), (GLshort *)(pc + 4) ); } void __glXDispSwap_TexCoord1dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 8); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); glTexCoord1dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_TexCoord1fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1); glTexCoord1fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_TexCoord1iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 1); glTexCoord1iv( (GLint *)(pc + 0) ); } void __glXDispSwap_TexCoord1sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 1); glTexCoord1sv( (GLshort *)(pc + 0) ); } void __glXDispSwap_TexCoord2dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 16); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); glTexCoord2dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_TexCoord2fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); glTexCoord2fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_TexCoord2iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 2); glTexCoord2iv( (GLint *)(pc + 0) ); } void __glXDispSwap_TexCoord2sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); glTexCoord2sv( (GLshort *)(pc + 0) ); } void __glXDispSwap_TexCoord3dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 24); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); glTexCoord3dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_TexCoord3fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); glTexCoord3fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_TexCoord3iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 3); glTexCoord3iv( (GLint *)(pc + 0) ); } void __glXDispSwap_TexCoord3sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); glTexCoord3sv( (GLshort *)(pc + 0) ); } void __glXDispSwap_TexCoord4dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 32); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); glTexCoord4dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_TexCoord4fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); glTexCoord4fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_TexCoord4iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 4); glTexCoord4iv( (GLint *)(pc + 0) ); } void __glXDispSwap_TexCoord4sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); glTexCoord4sv( (GLshort *)(pc + 0) ); } void __glXDispSwap_Vertex2dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 16); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); glVertex2dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_Vertex2fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); glVertex2fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_Vertex2iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 2); glVertex2iv( (GLint *)(pc + 0) ); } void __glXDispSwap_Vertex2sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); glVertex2sv( (GLshort *)(pc + 0) ); } void __glXDispSwap_Vertex3dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 24); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); glVertex3dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_Vertex3fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); glVertex3fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_Vertex3iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 3); glVertex3iv( (GLint *)(pc + 0) ); } void __glXDispSwap_Vertex3sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); glVertex3sv( (GLshort *)(pc + 0) ); } void __glXDispSwap_Vertex4dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 32); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); glVertex4dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_Vertex4fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); glVertex4fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_Vertex4iv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT_ARRAY(pc + 0, 4); glVertex4iv( (GLint *)(pc + 0) ); } void __glXDispSwap_Vertex4sv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); glVertex4sv( (GLshort *)(pc + 0) ); } void __glXDispSwap_ClipPlane(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 36); pc -= 4; } #endif __GLX_SWAP_INT(pc + 32); __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); glClipPlane( *(GLenum *)(pc + 32), (GLdouble *)(pc + 0) ); } void __glXDispSwap_ColorMaterial(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); glColorMaterial( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4) ); } void __glXDispSwap_CullFace(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glCullFace( *(GLenum *)(pc + 0) ); } void __glXDispSwap_Fogf(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); glFogf( *(GLenum *)(pc + 0), *(GLfloat *)(pc + 4) ); } void __glXDispSwap_Fogfv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); pname = *(GLenum *)(pc + 0); compsize = __glFogfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize); glFogfv( *(GLenum *)(pc + 0), (GLfloat *)(pc + 4) ); } void __glXDispSwap_Fogi(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); glFogi( *(GLenum *)(pc + 0), *(GLint *)(pc + 4) ); } void __glXDispSwap_Fogiv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); pname = *(GLenum *)(pc + 0); compsize = __glFogiv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT_ARRAY(pc + 4, compsize); glFogiv( *(GLenum *)(pc + 0), (GLint *)(pc + 4) ); } void __glXDispSwap_FrontFace(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glFrontFace( *(GLenum *)(pc + 0) ); } void __glXDispSwap_Hint(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); glHint( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4) ); } void __glXDispSwap_Lightf(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); glLightf( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDispSwap_Lightfv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glLightfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); glLightfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDispSwap_Lighti(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); glLighti( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8) ); } void __glXDispSwap_Lightiv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glLightiv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 8, compsize); glLightiv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); } void __glXDispSwap_LightModelf(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); glLightModelf( *(GLenum *)(pc + 0), *(GLfloat *)(pc + 4) ); } void __glXDispSwap_LightModelfv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); pname = *(GLenum *)(pc + 0); compsize = __glLightModelfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize); glLightModelfv( *(GLenum *)(pc + 0), (GLfloat *)(pc + 4) ); } void __glXDispSwap_LightModeli(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); glLightModeli( *(GLenum *)(pc + 0), *(GLint *)(pc + 4) ); } void __glXDispSwap_LightModeliv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); pname = *(GLenum *)(pc + 0); compsize = __glLightModeliv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT_ARRAY(pc + 4, compsize); glLightModeliv( *(GLenum *)(pc + 0), (GLint *)(pc + 4) ); } void __glXDispSwap_LineStipple(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_SHORT(pc + 4); glLineStipple( *(GLint *)(pc + 0), *(GLushort *)(pc + 4) ); } void __glXDispSwap_LineWidth(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_FLOAT(pc + 0); glLineWidth( *(GLfloat *)(pc + 0) ); } void __glXDispSwap_Materialf(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); glMaterialf( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDispSwap_Materialfv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glMaterialfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); glMaterialfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDispSwap_Materiali(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); glMateriali( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8) ); } void __glXDispSwap_Materialiv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glMaterialiv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 8, compsize); glMaterialiv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); } void __glXDispSwap_PointSize(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_FLOAT(pc + 0); glPointSize( *(GLfloat *)(pc + 0) ); } void __glXDispSwap_PolygonMode(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); glPolygonMode( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4) ); } void __glXDispSwap_Scissor(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); glScissor( *(GLint *)(pc + 0), *(GLint *)(pc + 4), *(GLsizei *)(pc + 8), *(GLsizei *)(pc + 12) ); } void __glXDispSwap_ShadeModel(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glShadeModel( *(GLenum *)(pc + 0) ); } void __glXDispSwap_TexParameterf(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); glTexParameterf( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDispSwap_TexParameterfv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glTexParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); glTexParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDispSwap_TexParameteri(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); glTexParameteri( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8) ); } void __glXDispSwap_TexParameteriv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glTexParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 8, compsize); glTexParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); } void __glXDispSwap_TexEnvf(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); glTexEnvf( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDispSwap_TexEnvfv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glTexEnvfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); glTexEnvfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDispSwap_TexEnvi(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); glTexEnvi( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8) ); } void __glXDispSwap_TexEnviv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glTexEnviv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 8, compsize); glTexEnviv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); } void __glXDispSwap_TexGend(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 16); pc -= 4; } #endif __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_DOUBLE(pc + 0); glTexGend( *(GLenum *)(pc + 8), *(GLenum *)(pc + 12), *(GLdouble *)(pc + 0) ); } void __glXDispSwap_TexGendv(GLbyte *pc) { GLenum pname; #ifdef __GLX_ALIGN64 GLint cmdlen; #endif GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glTexGendv_size(pname); if (compsize < 0) compsize = 0; #ifdef __GLX_ALIGN64 cmdlen = __GLX_PAD(8+compsize*8); if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, cmdlen); pc -= 4; } #endif __GLX_SWAP_INT(pc + 0); __GLX_SWAP_DOUBLE_ARRAY(pc + 8, compsize); glTexGendv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLdouble *)(pc + 8) ); } void __glXDispSwap_TexGenf(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); glTexGenf( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDispSwap_TexGenfv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glTexGenfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); glTexGenfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDispSwap_TexGeni(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); glTexGeni( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8) ); } void __glXDispSwap_TexGeniv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glTexGeniv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 8, compsize); glTexGeniv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); } void __glXDispSwap_InitNames(GLbyte *pc) { glInitNames( ); } void __glXDispSwap_LoadName(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glLoadName( *(GLuint *)(pc + 0) ); } void __glXDispSwap_PassThrough(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_FLOAT(pc + 0); glPassThrough( *(GLfloat *)(pc + 0) ); } void __glXDispSwap_PopName(GLbyte *pc) { glPopName( ); } void __glXDispSwap_PushName(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glPushName( *(GLuint *)(pc + 0) ); } void __glXDispSwap_DrawBuffer(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glDrawBuffer( *(GLenum *)(pc + 0) ); } void __glXDispSwap_Clear(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glClear( *(GLbitfield *)(pc + 0) ); } void __glXDispSwap_ClearAccum(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_FLOAT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); __GLX_SWAP_FLOAT(pc + 12); glClearAccum( *(GLfloat *)(pc + 0), *(GLfloat *)(pc + 4), *(GLfloat *)(pc + 8), *(GLfloat *)(pc + 12) ); } void __glXDispSwap_ClearIndex(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_FLOAT(pc + 0); glClearIndex( *(GLfloat *)(pc + 0) ); } void __glXDispSwap_ClearColor(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_FLOAT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); __GLX_SWAP_FLOAT(pc + 12); glClearColor( *(GLclampf *)(pc + 0), *(GLclampf *)(pc + 4), *(GLclampf *)(pc + 8), *(GLclampf *)(pc + 12) ); } void __glXDispSwap_ClearStencil(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glClearStencil( *(GLint *)(pc + 0) ); } void __glXDispSwap_ClearDepth(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 8); pc -= 4; } #endif __GLX_SWAP_DOUBLE(pc + 0); glClearDepth( *(GLclampd *)(pc + 0) ); } void __glXDispSwap_StencilMask(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glStencilMask( *(GLuint *)(pc + 0) ); } void __glXDispSwap_ColorMask(GLbyte *pc) { glColorMask( *(GLboolean *)(pc + 0), *(GLboolean *)(pc + 1), *(GLboolean *)(pc + 2), *(GLboolean *)(pc + 3) ); } void __glXDispSwap_DepthMask(GLbyte *pc) { glDepthMask( *(GLboolean *)(pc + 0) ); } void __glXDispSwap_IndexMask(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glIndexMask( *(GLuint *)(pc + 0) ); } void __glXDispSwap_Accum(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); glAccum( *(GLenum *)(pc + 0), *(GLfloat *)(pc + 4) ); } void __glXDispSwap_Disable(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glDisable( *(GLenum *)(pc + 0) ); } void __glXDispSwap_Enable(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glEnable( *(GLenum *)(pc + 0) ); } void __glXDispSwap_PopAttrib(GLbyte *pc) { glPopAttrib( ); } void __glXDispSwap_PushAttrib(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glPushAttrib( *(GLbitfield *)(pc + 0) ); } void __glXDispSwap_MapGrid1d(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 20); pc -= 4; } #endif __GLX_SWAP_INT(pc + 16); __GLX_SWAP_DOUBLE(pc + 0); __GLX_SWAP_DOUBLE(pc + 8); glMapGrid1d( *(GLint *)(pc + 16), *(GLdouble *)(pc + 0), *(GLdouble *)(pc + 8) ); } void __glXDispSwap_MapGrid1f(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); glMapGrid1f( *(GLint *)(pc + 0), *(GLfloat *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDispSwap_MapGrid2d(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 40); pc -= 4; } #endif __GLX_SWAP_INT(pc + 32); __GLX_SWAP_DOUBLE(pc + 0); __GLX_SWAP_DOUBLE(pc + 8); __GLX_SWAP_INT(pc + 36); __GLX_SWAP_DOUBLE(pc + 16); __GLX_SWAP_DOUBLE(pc + 24); glMapGrid2d( *(GLint *)(pc + 32), *(GLdouble *)(pc + 0), *(GLdouble *)(pc + 8), *(GLint *)(pc + 36), *(GLdouble *)(pc + 16), *(GLdouble *)(pc + 24) ); } void __glXDispSwap_MapGrid2f(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_FLOAT(pc + 16); __GLX_SWAP_FLOAT(pc + 20); glMapGrid2f( *(GLint *)(pc + 0), *(GLfloat *)(pc + 4), *(GLfloat *)(pc + 8), *(GLint *)(pc + 12), *(GLfloat *)(pc + 16), *(GLfloat *)(pc + 20) ); } void __glXDispSwap_EvalCoord1dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 8); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); glEvalCoord1dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_EvalCoord1fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1); glEvalCoord1fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_EvalCoord2dv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 16); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); glEvalCoord2dv( (GLdouble *)(pc + 0) ); } void __glXDispSwap_EvalCoord2fv(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); glEvalCoord2fv( (GLfloat *)(pc + 0) ); } void __glXDispSwap_EvalMesh1(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); glEvalMesh1( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLint *)(pc + 8) ); } void __glXDispSwap_EvalPoint1(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glEvalPoint1( *(GLint *)(pc + 0) ); } void __glXDispSwap_EvalMesh2(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_INT(pc + 16); glEvalMesh2( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLint *)(pc + 16) ); } void __glXDispSwap_EvalPoint2(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); glEvalPoint2( *(GLint *)(pc + 0), *(GLint *)(pc + 4) ); } void __glXDispSwap_AlphaFunc(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); glAlphaFunc( *(GLenum *)(pc + 0), *(GLclampf *)(pc + 4) ); } void __glXDispSwap_BlendFunc(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); glBlendFunc( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4) ); } void __glXDispSwap_LogicOp(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glLogicOp( *(GLenum *)(pc + 0) ); } void __glXDispSwap_StencilFunc(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); glStencilFunc( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLuint *)(pc + 8) ); } void __glXDispSwap_StencilOp(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); glStencilOp( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLenum *)(pc + 8) ); } void __glXDispSwap_DepthFunc(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glDepthFunc( *(GLenum *)(pc + 0) ); } void __glXDispSwap_PixelZoom(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_FLOAT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); glPixelZoom( *(GLfloat *)(pc + 0), *(GLfloat *)(pc + 4) ); } void __glXDispSwap_PixelTransferf(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); glPixelTransferf( *(GLenum *)(pc + 0), *(GLfloat *)(pc + 4) ); } void __glXDispSwap_PixelTransferi(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); glPixelTransferi( *(GLenum *)(pc + 0), *(GLint *)(pc + 4) ); } void __glXDispSwap_PixelMapfv(GLbyte *pc) { GLint mapsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); mapsize = *(GLint *)(pc + 4); __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 8, mapsize); glPixelMapfv( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDispSwap_PixelMapuiv(GLbyte *pc) { GLint mapsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); mapsize = *(GLint *)(pc + 4); __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 8, mapsize); glPixelMapuiv( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), (GLuint *)(pc + 8) ); } void __glXDispSwap_PixelMapusv(GLbyte *pc) { GLint mapsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); mapsize = *(GLint *)(pc + 4); __GLX_SWAP_INT(pc + 0); __GLX_SWAP_SHORT_ARRAY(pc + 8, mapsize); glPixelMapusv( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), (GLushort *)(pc + 8) ); } void __glXDispSwap_ReadBuffer(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glReadBuffer( *(GLenum *)(pc + 0) ); } void __glXDispSwap_CopyPixels(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_INT(pc + 16); glCopyPixels( *(GLint *)(pc + 0), *(GLint *)(pc + 4), *(GLsizei *)(pc + 8), *(GLsizei *)(pc + 12), *(GLenum *)(pc + 16) ); } void __glXDispSwap_DepthRange(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 16); pc -= 4; } #endif __GLX_SWAP_DOUBLE(pc + 0); __GLX_SWAP_DOUBLE(pc + 8); glDepthRange( *(GLclampd *)(pc + 0), *(GLclampd *)(pc + 8) ); } void __glXDispSwap_Frustum(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 48); pc -= 4; } #endif __GLX_SWAP_DOUBLE(pc + 0); __GLX_SWAP_DOUBLE(pc + 8); __GLX_SWAP_DOUBLE(pc + 16); __GLX_SWAP_DOUBLE(pc + 24); __GLX_SWAP_DOUBLE(pc + 32); __GLX_SWAP_DOUBLE(pc + 40); glFrustum( *(GLdouble *)(pc + 0), *(GLdouble *)(pc + 8), *(GLdouble *)(pc + 16), *(GLdouble *)(pc + 24), *(GLdouble *)(pc + 32), *(GLdouble *)(pc + 40) ); } void __glXDispSwap_LoadIdentity(GLbyte *pc) { glLoadIdentity( ); } void __glXDispSwap_LoadMatrixf(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16); glLoadMatrixf( (GLfloat *)(pc + 0) ); } void __glXDispSwap_LoadMatrixd(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 128); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16); glLoadMatrixd( (GLdouble *)(pc + 0) ); } void __glXDispSwap_MatrixMode(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glMatrixMode( *(GLenum *)(pc + 0) ); } void __glXDispSwap_MultMatrixf(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16); glMultMatrixf( (GLfloat *)(pc + 0) ); } void __glXDispSwap_MultMatrixd(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 128); pc -= 4; } #endif __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16); glMultMatrixd( (GLdouble *)(pc + 0) ); } void __glXDispSwap_Ortho(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 48); pc -= 4; } #endif __GLX_SWAP_DOUBLE(pc + 0); __GLX_SWAP_DOUBLE(pc + 8); __GLX_SWAP_DOUBLE(pc + 16); __GLX_SWAP_DOUBLE(pc + 24); __GLX_SWAP_DOUBLE(pc + 32); __GLX_SWAP_DOUBLE(pc + 40); glOrtho( *(GLdouble *)(pc + 0), *(GLdouble *)(pc + 8), *(GLdouble *)(pc + 16), *(GLdouble *)(pc + 24), *(GLdouble *)(pc + 32), *(GLdouble *)(pc + 40) ); } void __glXDispSwap_PopMatrix(GLbyte *pc) { glPopMatrix( ); } void __glXDispSwap_PushMatrix(GLbyte *pc) { glPushMatrix( ); } void __glXDispSwap_Rotated(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 32); pc -= 4; } #endif __GLX_SWAP_DOUBLE(pc + 0); __GLX_SWAP_DOUBLE(pc + 8); __GLX_SWAP_DOUBLE(pc + 16); __GLX_SWAP_DOUBLE(pc + 24); glRotated( *(GLdouble *)(pc + 0), *(GLdouble *)(pc + 8), *(GLdouble *)(pc + 16), *(GLdouble *)(pc + 24) ); } void __glXDispSwap_Rotatef(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_FLOAT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); __GLX_SWAP_FLOAT(pc + 12); glRotatef( *(GLfloat *)(pc + 0), *(GLfloat *)(pc + 4), *(GLfloat *)(pc + 8), *(GLfloat *)(pc + 12) ); } void __glXDispSwap_Scaled(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 24); pc -= 4; } #endif __GLX_SWAP_DOUBLE(pc + 0); __GLX_SWAP_DOUBLE(pc + 8); __GLX_SWAP_DOUBLE(pc + 16); glScaled( *(GLdouble *)(pc + 0), *(GLdouble *)(pc + 8), *(GLdouble *)(pc + 16) ); } void __glXDispSwap_Scalef(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_FLOAT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); glScalef( *(GLfloat *)(pc + 0), *(GLfloat *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDispSwap_Translated(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 24); pc -= 4; } #endif __GLX_SWAP_DOUBLE(pc + 0); __GLX_SWAP_DOUBLE(pc + 8); __GLX_SWAP_DOUBLE(pc + 16); glTranslated( *(GLdouble *)(pc + 0), *(GLdouble *)(pc + 8), *(GLdouble *)(pc + 16) ); } void __glXDispSwap_Translatef(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_FLOAT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); glTranslatef( *(GLfloat *)(pc + 0), *(GLfloat *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDispSwap_Viewport(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); glViewport( *(GLint *)(pc + 0), *(GLint *)(pc + 4), *(GLsizei *)(pc + 8), *(GLsizei *)(pc + 12) ); } void __glXDispSwap_PolygonOffset(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_FLOAT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); glPolygonOffset( *(GLfloat *)(pc + 0), *(GLfloat *)(pc + 4) ); } void __glXDispSwap_CopyTexImage1D(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_INT(pc + 16); __GLX_SWAP_INT(pc + 20); __GLX_SWAP_INT(pc + 24); glCopyTexImage1D( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), *(GLint *)(pc + 12), *(GLint *)(pc + 16), *(GLsizei *)(pc + 20), *(GLint *)(pc + 24) ); } void __glXDispSwap_CopyTexImage2D(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_INT(pc + 16); __GLX_SWAP_INT(pc + 20); __GLX_SWAP_INT(pc + 24); __GLX_SWAP_INT(pc + 28); glCopyTexImage2D( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), *(GLint *)(pc + 12), *(GLint *)(pc + 16), *(GLsizei *)(pc + 20), *(GLsizei *)(pc + 24), *(GLint *)(pc + 28) ); } void __glXDispSwap_CopyTexSubImage1D(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_INT(pc + 16); __GLX_SWAP_INT(pc + 20); glCopyTexSubImage1D( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLint *)(pc + 16), *(GLsizei *)(pc + 20) ); } void __glXDispSwap_CopyTexSubImage2D(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_INT(pc + 16); __GLX_SWAP_INT(pc + 20); __GLX_SWAP_INT(pc + 24); __GLX_SWAP_INT(pc + 28); glCopyTexSubImage2D( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLint *)(pc + 16), *(GLint *)(pc + 20), *(GLsizei *)(pc + 24), *(GLsizei *)(pc + 28) ); } void __glXDispSwap_BindTexture(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); glBindTexture( *(GLenum *)(pc + 0), *(GLuint *)(pc + 4) ); } void __glXDispSwap_PrioritizeTextures(GLbyte *pc) { GLsizei n; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); n = *(GLsizei *)(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, n); __GLX_SWAP_FLOAT_ARRAY(pc + 4+n*4, n); glPrioritizeTextures( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4), (GLclampf *)(pc + 4+n*4) ); } void __glXDispSwap_Indexubv(GLbyte *pc) { glIndexubv( (GLubyte *)(pc + 0) ); } void __glXDispSwap_BlendColor(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_FLOAT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); __GLX_SWAP_FLOAT(pc + 12); glBlendColor( *(GLclampf *)(pc + 0), *(GLclampf *)(pc + 4), *(GLclampf *)(pc + 8), *(GLclampf *)(pc + 12) ); } void __glXDispSwap_BlendEquation(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glBlendEquation( *(GLenum *)(pc + 0) ); } void __glXDispSwap_ColorTableParameterfv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glColorTableParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); glColorTableParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDispSwap_ColorTableParameteriv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glColorTableParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 8, compsize); glColorTableParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); } void __glXDispSwap_CopyColorTable(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_INT(pc + 16); glCopyColorTable( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLsizei *)(pc + 16) ); } void __glXDispSwap_CopyColorSubTable(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_INT(pc + 16); glCopyColorSubTable( *(GLenum *)(pc + 0), *(GLsizei *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLsizei *)(pc + 16) ); } void __glXDispSwap_ConvolutionParameterf(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); glConvolutionParameterf( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLfloat *)(pc + 8) ); } void __glXDispSwap_ConvolutionParameterfv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glConvolutionParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); glConvolutionParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *)(pc + 8) ); } void __glXDispSwap_ConvolutionParameteri(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); glConvolutionParameteri( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8) ); } void __glXDispSwap_ConvolutionParameteriv(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glConvolutionParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 8, compsize); glConvolutionParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); } void __glXDispSwap_CopyConvolutionFilter1D(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_INT(pc + 16); glCopyConvolutionFilter1D( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLsizei *)(pc + 16) ); } void __glXDispSwap_CopyConvolutionFilter2D(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_INT(pc + 16); __GLX_SWAP_INT(pc + 20); glCopyConvolutionFilter2D( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLsizei *)(pc + 16), *(GLsizei *)(pc + 20) ); } void __glXDispSwap_Histogram(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); glHistogram( *(GLenum *)(pc + 0), *(GLsizei *)(pc + 4), *(GLenum *)(pc + 8), *(GLboolean *)(pc + 12) ); } void __glXDispSwap_Minmax(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); glMinmax( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLboolean *)(pc + 8) ); } void __glXDispSwap_ResetHistogram(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glResetHistogram( *(GLenum *)(pc + 0) ); } void __glXDispSwap_ResetMinmax(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glResetMinmax( *(GLenum *)(pc + 0) ); } void __glXDispSwap_CopyTexSubImage3D(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 8); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_INT(pc + 16); __GLX_SWAP_INT(pc + 20); __GLX_SWAP_INT(pc + 24); __GLX_SWAP_INT(pc + 28); __GLX_SWAP_INT(pc + 32); glCopyTexSubImage3D( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLint *)(pc + 8), *(GLint *)(pc + 12), *(GLint *)(pc + 16), *(GLint *)(pc + 20), *(GLint *)(pc + 24), *(GLsizei *)(pc + 28), *(GLsizei *)(pc + 32) ); } void __glXDispSwap_ActiveTextureARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glActiveTextureARB( *(GLenum *)(pc + 0) ); } void __glXDispSwap_MultiTexCoord1dvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 12); pc -= 4; } #endif __GLX_SWAP_INT(pc + 8); __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); glMultiTexCoord1dvARB( *(GLenum *)(pc + 8), (GLdouble *)(pc + 0) ); } void __glXDispSwap_MultiTexCoord1fvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 4, 1); glMultiTexCoord1fvARB( *(GLenum *)(pc + 0), (GLfloat *)(pc + 4) ); } void __glXDispSwap_MultiTexCoord1ivARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, 1); glMultiTexCoord1ivARB( *(GLenum *)(pc + 0), (GLint *)(pc + 4) ); } void __glXDispSwap_MultiTexCoord1svARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_SHORT_ARRAY(pc + 4, 1); glMultiTexCoord1svARB( *(GLenum *)(pc + 0), (GLshort *)(pc + 4) ); } void __glXDispSwap_MultiTexCoord2dvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 20); pc -= 4; } #endif __GLX_SWAP_INT(pc + 16); __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); glMultiTexCoord2dvARB( *(GLenum *)(pc + 16), (GLdouble *)(pc + 0) ); } void __glXDispSwap_MultiTexCoord2fvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 4, 2); glMultiTexCoord2fvARB( *(GLenum *)(pc + 0), (GLfloat *)(pc + 4) ); } void __glXDispSwap_MultiTexCoord2ivARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, 2); glMultiTexCoord2ivARB( *(GLenum *)(pc + 0), (GLint *)(pc + 4) ); } void __glXDispSwap_MultiTexCoord2svARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_SHORT_ARRAY(pc + 4, 2); glMultiTexCoord2svARB( *(GLenum *)(pc + 0), (GLshort *)(pc + 4) ); } void __glXDispSwap_MultiTexCoord3dvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 28); pc -= 4; } #endif __GLX_SWAP_INT(pc + 24); __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); glMultiTexCoord3dvARB( *(GLenum *)(pc + 24), (GLdouble *)(pc + 0) ); } void __glXDispSwap_MultiTexCoord3fvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 4, 3); glMultiTexCoord3fvARB( *(GLenum *)(pc + 0), (GLfloat *)(pc + 4) ); } void __glXDispSwap_MultiTexCoord3ivARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, 3); glMultiTexCoord3ivARB( *(GLenum *)(pc + 0), (GLint *)(pc + 4) ); } void __glXDispSwap_MultiTexCoord3svARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_SHORT_ARRAY(pc + 4, 3); glMultiTexCoord3svARB( *(GLenum *)(pc + 0), (GLshort *)(pc + 4) ); } void __glXDispSwap_MultiTexCoord4dvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; #ifdef __GLX_ALIGN64 if ((unsigned long)(pc) & 7) { __GLX_MEM_COPY(pc-4, pc, 36); pc -= 4; } #endif __GLX_SWAP_INT(pc + 32); __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); glMultiTexCoord4dvARB( *(GLenum *)(pc + 32), (GLdouble *)(pc + 0) ); } void __glXDispSwap_MultiTexCoord4fvARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT_ARRAY(pc + 4, 4); glMultiTexCoord4fvARB( *(GLenum *)(pc + 0), (GLfloat *)(pc + 4) ); } void __glXDispSwap_MultiTexCoord4ivARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, 4); glMultiTexCoord4ivARB( *(GLenum *)(pc + 0), (GLint *)(pc + 4) ); } void __glXDispSwap_MultiTexCoord4svARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_SHORT_ARRAY(pc + 4, 4); glMultiTexCoord4svARB( *(GLenum *)(pc + 0), (GLshort *)(pc + 4) ); } /* * Extensions */ #ifndef MISSING_GL_EXTS void __glXDispSwap_PointParameterfARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); glPointParameterfARB( *(GLenum *)(pc + 0), *(GLfloat *)(pc + 4) ); } void __glXDispSwap_PointParameterfvARB(GLbyte *pc) { GLenum pname; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); pname = *(GLenum *)(pc + 0); compsize = __glPointParameterfvEXT_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize); glPointParameterfvARB( *(GLenum *)(pc + 0), (GLfloat *)(pc + 4) ); } void __glXDispSwap_ActiveStencilFaceEXT(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(pc + 0); glActiveStencilFaceEXT( *(GLenum *)(pc + 0) ); } void __glXDispSwap_WindowPos3fARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_FLOAT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); glWindowPos3fARB( *(GLfloat *)(pc + 0), *(GLfloat *)(pc + 4), *(GLfloat *)(pc + 8) ); } #endif /* !MISSING_GL_EXTS */ void __glXDispSwap_SampleCoverageARB(GLbyte *pc) { __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_FLOAT(pc + 0); __GLX_SWAP_INT(pc + 4); glSampleCoverageARB( *(GLfloat *)(pc + 0), *(GLboolean *)(pc + 4) ); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/g_single.c0000644000000000000000000011672513614532331017636 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) ** version 1.2.1 Specification. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxext.h" #include "g_disptab.h" #include "g_disptab_EXT.h" #include "unpack.h" #include "impsize.h" #include "singlesize.h" int __glXDisp_NewList(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; int error; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; glNewList( *(GLuint *)(pc + 0), *(GLenum *)(pc + 4) ); __GLX_NOTE_UNFLUSHED_CMDS(cx); return Success; } int __glXDisp_EndList(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; int error; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } glEndList( ); return Success; } int __glXDisp_DeleteLists(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; int error; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; glDeleteLists( *(GLuint *)(pc + 0), *(GLsizei *)(pc + 4) ); __GLX_NOTE_UNFLUSHED_CMDS(cx); return Success; } int __glXDisp_GenLists(__GLXclientState *cl, GLbyte *pc) { GLuint retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; retval = glGenLists( *(GLsizei *)(pc + 0) ); __GLX_PUT_RETVAL(retval); __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); return Success; } int __glXDisp_PixelStoref(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; int error; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; glPixelStoref( *(GLenum *)(pc + 0), *(GLfloat *)(pc + 4) ); __GLX_NOTE_UNFLUSHED_CMDS(cx); return Success; } int __glXDisp_PixelStorei(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; int error; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; glPixelStorei( *(GLenum *)(pc + 0), *(GLint *)(pc + 4) ); __GLX_NOTE_UNFLUSHED_CMDS(cx); return Success; } int __glXDisp_GetBooleanv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLboolean answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 0); compsize = __glGetBooleanv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); glGetBooleanv( *(GLenum *)(pc + 0), (GLboolean *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_BYTE(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_BYTE_ARRAY(compsize); } return Success; } int __glXDisp_GetDoublev(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLdouble answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 0); compsize = __glGetDoublev_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*8,8); __glXClearErrorOccured(); glGetDoublev( *(GLenum *)(pc + 0), (GLdouble *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_DOUBLE(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*8); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_DOUBLE_ARRAY(compsize); } return Success; } int __glXDisp_GetError(__GLXclientState *cl, GLbyte *pc) { GLenum retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } retval = glGetError( ); __GLX_PUT_RETVAL(retval); __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); return Success; } int __glXDisp_GetFloatv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 0); compsize = __glGetFloatv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetFloatv( *(GLenum *)(pc + 0), (GLfloat *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDisp_GetIntegerv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 0); compsize = __glGetIntegerv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetIntegerv( *(GLenum *)(pc + 0), (GLint *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDisp_GetLightfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetLightfv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetLightfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDisp_GetLightiv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetLightiv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetLightiv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc) { GLenum target; GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLdouble answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; target = *(GLenum *)(pc + 0); query = *(GLenum *)(pc + 4); compsize = __glGetMapdv_size(target,query); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*8,8); __glXClearErrorOccured(); glGetMapdv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLdouble *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_DOUBLE(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*8); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_DOUBLE_ARRAY(compsize); } return Success; } int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc) { GLenum target; GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; target = *(GLenum *)(pc + 0); query = *(GLenum *)(pc + 4); compsize = __glGetMapfv_size(target,query); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetMapfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDisp_GetMapiv(__GLXclientState *cl, GLbyte *pc) { GLenum target; GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; target = *(GLenum *)(pc + 0); query = *(GLenum *)(pc + 4); compsize = __glGetMapiv_size(target,query); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetMapiv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDisp_GetMaterialfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetMaterialfv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetMaterialfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDisp_GetMaterialiv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetMaterialiv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetMaterialiv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDisp_GetPixelMapfv(__GLXclientState *cl, GLbyte *pc) { GLenum map; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; map = *(GLenum *)(pc + 0); compsize = __glGetPixelMapfv_size(map); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetPixelMapfv( *(GLenum *)(pc + 0), (GLfloat *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDisp_GetPixelMapuiv(__GLXclientState *cl, GLbyte *pc) { GLenum map; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLuint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; map = *(GLenum *)(pc + 0); compsize = __glGetPixelMapuiv_size(map); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetPixelMapuiv( *(GLenum *)(pc + 0), (GLuint *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDisp_GetPixelMapusv(__GLXclientState *cl, GLbyte *pc) { GLenum map; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLushort answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; map = *(GLenum *)(pc + 0); compsize = __glGetPixelMapusv_size(map); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*2,2); __glXClearErrorOccured(); glGetPixelMapusv( *(GLenum *)(pc + 0), (GLushort *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_SHORT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*2); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_SHORT_ARRAY(compsize); } return Success; } int __glXDisp_GetTexEnvfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetTexEnvfv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexEnvfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDisp_GetTexEnviv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetTexEnviv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexEnviv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDisp_GetTexGendv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLdouble answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetTexGendv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*8,8); __glXClearErrorOccured(); glGetTexGendv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLdouble *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_DOUBLE(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*8); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_DOUBLE_ARRAY(compsize); } return Success; } int __glXDisp_GetTexGenfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetTexGenfv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexGenfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDisp_GetTexGeniv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetTexGeniv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexGeniv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDisp_GetTexParameterfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetTexParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDisp_GetTexParameteriv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetTexParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDisp_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 8); compsize = __glGetTexLevelParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexLevelParameterfv( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), (GLfloat *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDisp_GetTexLevelParameteriv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 8); compsize = __glGetTexLevelParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexLevelParameteriv( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), (GLint *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDisp_IsEnabled(__GLXclientState *cl, GLbyte *pc) { GLboolean retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; retval = glIsEnabled( *(GLenum *)(pc + 0) ); __GLX_PUT_RETVAL(retval); __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); return Success; } int __glXDisp_IsList(__GLXclientState *cl, GLbyte *pc) { GLboolean retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; retval = glIsList( *(GLuint *)(pc + 0) ); __GLX_PUT_RETVAL(retval); __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); return Success; } int __glXDisp_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) { GLsizei n; GLboolean retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLboolean answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); retval = glAreTexturesResident( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4), (GLboolean *) answer ); __GLX_PUT_RETVAL(retval); __GLX_BEGIN_REPLY(n); __GLX_SEND_HEADER(); __GLX_SEND_BYTE_ARRAY(n); return Success; } int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; int error; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; glDeleteTextures( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4) ); return Success; } int __glXDisp_GenTextures(__GLXclientState *cl, GLbyte *pc) { GLsizei n; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLuint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); glGenTextures( *(GLsizei *)(pc + 0), (GLuint *) answer ); __GLX_BEGIN_REPLY(n*4); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(n); return Success; } int __glXDisp_IsTexture(__GLXclientState *cl, GLbyte *pc) { GLboolean retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; retval = glIsTexture( *(GLuint *)(pc + 0) ); __GLX_PUT_RETVAL(retval); __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); return Success; } int __glXDisp_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetColorTableParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetColorTableParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDisp_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetColorTableParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetColorTableParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDisp_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetConvolutionParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetConvolutionParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDisp_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetConvolutionParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetConvolutionParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDisp_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetHistogramParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetHistogramParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDisp_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetHistogramParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetHistogramParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDisp_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetMinmaxParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetMinmaxParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDisp_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 4); compsize = __glGetMinmaxParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetMinmaxParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDisp_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc) { GLsizei n; GLboolean retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLboolean answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_VENDPRIV_HDR_SIZE; n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); retval = glAreTexturesResidentEXT( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4), (GLboolean *) answer ); __GLX_PUT_RETVAL(retval); __GLX_BEGIN_REPLY(n); __GLX_SEND_HEADER(); __GLX_SEND_BYTE_ARRAY(n); return Success; } int __glXDisp_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; int error; cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_VENDPRIV_HDR_SIZE; glDeleteTexturesEXT( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4) ); return Success; } int __glXDisp_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc) { GLsizei n; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLuint answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_VENDPRIV_HDR_SIZE; n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); glGenTexturesEXT( *(GLsizei *)(pc + 0), (GLuint *) answer ); __GLX_BEGIN_REPLY(n*4); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(n); return Success; } int __glXDisp_IsTextureEXT(__GLXclientState *cl, GLbyte *pc) { GLboolean retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_VENDPRIV_HDR_SIZE; retval = glIsTextureEXT( *(GLuint *)(pc + 0) ); __GLX_PUT_RETVAL(retval); __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/g_singleswap.c0000644000000000000000000015277413614532331020535 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) ** version 1.2.1 Specification. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxext.h" #include "g_disptab.h" #include "g_disptab_EXT.h" #include "unpack.h" #include "impsize.h" #include "singlesize.h" int __glXDispSwap_NewList(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; int error; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); glNewList( *(GLuint *)(pc + 0), *(GLenum *)(pc + 4) ); __GLX_NOTE_UNFLUSHED_CMDS(cx); return Success; } int __glXDispSwap_EndList(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; int error; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } glEndList( ); return Success; } int __glXDispSwap_DeleteLists(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; int error; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); glDeleteLists( *(GLuint *)(pc + 0), *(GLsizei *)(pc + 4) ); __GLX_NOTE_UNFLUSHED_CMDS(cx); return Success; } int __glXDispSwap_GenLists(__GLXclientState *cl, GLbyte *pc) { GLuint retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); retval = glGenLists( *(GLsizei *)(pc + 0) ); __GLX_PUT_RETVAL(retval); __GLX_SWAP_REPLY_RETVAL(); __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); return Success; } int __glXDispSwap_PixelStoref(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; int error; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_FLOAT(pc + 4); glPixelStoref( *(GLenum *)(pc + 0), *(GLfloat *)(pc + 4) ); __GLX_NOTE_UNFLUSHED_CMDS(cx); return Success; } int __glXDispSwap_PixelStorei(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; int error; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); glPixelStorei( *(GLenum *)(pc + 0), *(GLint *)(pc + 4) ); __GLX_NOTE_UNFLUSHED_CMDS(cx); return Success; } int __glXDispSwap_GetBooleanv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLboolean answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); pname = *(GLenum *)(pc + 0); compsize = __glGetBooleanv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); glGetBooleanv( *(GLenum *)(pc + 0), (GLboolean *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_BYTE(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_BYTE_ARRAY(compsize); } return Success; } int __glXDispSwap_GetDoublev(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLdouble answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); pname = *(GLenum *)(pc + 0); compsize = __glGetDoublev_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*8,8); __glXClearErrorOccured(); glGetDoublev( *(GLenum *)(pc + 0), (GLdouble *) answer ); __GLX_SWAP_DOUBLE_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_DOUBLE(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*8); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_DOUBLE_ARRAY(compsize); } return Success; } int __glXDispSwap_GetError(__GLXclientState *cl, GLbyte *pc) { GLenum retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } retval = glGetError( ); __GLX_PUT_RETVAL(retval); __GLX_SWAP_REPLY_RETVAL(); __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); return Success; } int __glXDispSwap_GetFloatv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); pname = *(GLenum *)(pc + 0); compsize = __glGetFloatv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetFloatv( *(GLenum *)(pc + 0), (GLfloat *) answer ); __GLX_SWAP_FLOAT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetIntegerv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); pname = *(GLenum *)(pc + 0); compsize = __glGetIntegerv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetIntegerv( *(GLenum *)(pc + 0), (GLint *) answer ); __GLX_SWAP_INT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetLightfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetLightfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetLightfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); __GLX_SWAP_FLOAT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetLightiv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetLightiv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetLightiv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); __GLX_SWAP_INT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc) { GLenum target; GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLdouble answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); target = *(GLenum *)(pc + 0); query = *(GLenum *)(pc + 4); compsize = __glGetMapdv_size(target,query); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*8,8); __glXClearErrorOccured(); glGetMapdv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLdouble *) answer ); __GLX_SWAP_DOUBLE_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_DOUBLE(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*8); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_DOUBLE_ARRAY(compsize); } return Success; } int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc) { GLenum target; GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); target = *(GLenum *)(pc + 0); query = *(GLenum *)(pc + 4); compsize = __glGetMapfv_size(target,query); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetMapfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); __GLX_SWAP_FLOAT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetMapiv(__GLXclientState *cl, GLbyte *pc) { GLenum target; GLenum query; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); target = *(GLenum *)(pc + 0); query = *(GLenum *)(pc + 4); compsize = __glGetMapiv_size(target,query); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetMapiv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); __GLX_SWAP_INT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetMaterialfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetMaterialfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetMaterialfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); __GLX_SWAP_FLOAT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetMaterialiv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetMaterialiv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetMaterialiv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); __GLX_SWAP_INT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetPixelMapfv(__GLXclientState *cl, GLbyte *pc) { GLenum map; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); map = *(GLenum *)(pc + 0); compsize = __glGetPixelMapfv_size(map); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetPixelMapfv( *(GLenum *)(pc + 0), (GLfloat *) answer ); __GLX_SWAP_FLOAT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetPixelMapuiv(__GLXclientState *cl, GLbyte *pc) { GLenum map; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLuint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); map = *(GLenum *)(pc + 0); compsize = __glGetPixelMapuiv_size(map); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetPixelMapuiv( *(GLenum *)(pc + 0), (GLuint *) answer ); __GLX_SWAP_INT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetPixelMapusv(__GLXclientState *cl, GLbyte *pc) { GLenum map; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLushort answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); map = *(GLenum *)(pc + 0); compsize = __glGetPixelMapusv_size(map); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*2,2); __glXClearErrorOccured(); glGetPixelMapusv( *(GLenum *)(pc + 0), (GLushort *) answer ); __GLX_SWAP_SHORT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_SHORT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*2); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_SHORT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetTexEnvfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetTexEnvfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexEnvfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); __GLX_SWAP_FLOAT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetTexEnviv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetTexEnviv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexEnviv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); __GLX_SWAP_INT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetTexGendv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLdouble answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetTexGendv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*8,8); __glXClearErrorOccured(); glGetTexGendv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLdouble *) answer ); __GLX_SWAP_DOUBLE_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_DOUBLE(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*8); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_DOUBLE_ARRAY(compsize); } return Success; } int __glXDispSwap_GetTexGenfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetTexGenfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexGenfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); __GLX_SWAP_FLOAT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetTexGeniv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetTexGeniv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexGeniv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); __GLX_SWAP_INT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetTexParameterfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetTexParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); __GLX_SWAP_FLOAT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetTexParameteriv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetTexParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); __GLX_SWAP_INT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 8); pname = *(GLenum *)(pc + 8); compsize = __glGetTexLevelParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexLevelParameterfv( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), (GLfloat *) answer ); __GLX_SWAP_FLOAT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 8); pname = *(GLenum *)(pc + 8); compsize = __glGetTexLevelParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 4); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexLevelParameteriv( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), (GLint *) answer ); __GLX_SWAP_INT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDispSwap_IsEnabled(__GLXclientState *cl, GLbyte *pc) { GLboolean retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); retval = glIsEnabled( *(GLenum *)(pc + 0) ); __GLX_PUT_RETVAL(retval); __GLX_SWAP_REPLY_RETVAL(); __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); return Success; } int __glXDispSwap_IsList(__GLXclientState *cl, GLbyte *pc) { GLboolean retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); retval = glIsList( *(GLuint *)(pc + 0) ); __GLX_PUT_RETVAL(retval); __GLX_SWAP_REPLY_RETVAL(); __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); return Success; } int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) { GLsizei n; GLboolean retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLboolean answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); n = *(GLsizei *)(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, n); __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); retval = glAreTexturesResident( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4), (GLboolean *) answer ); __GLX_PUT_RETVAL(retval); __GLX_SWAP_REPLY_RETVAL(); __GLX_BEGIN_REPLY(n); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); __GLX_SEND_BYTE_ARRAY(n); return Success; } int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc) { GLsizei n; __GLXcontext *cx; int error; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); n = *(GLsizei *)(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, n); glDeleteTextures( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4) ); return Success; } int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) { GLsizei n; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLuint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); glGenTextures( *(GLsizei *)(pc + 0), (GLuint *) answer ); __GLX_SWAP_INT_ARRAY(answer, n); __GLX_BEGIN_REPLY(n*4); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(n); return Success; } int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc) { GLboolean retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); retval = glIsTexture( *(GLuint *)(pc + 0) ); __GLX_PUT_RETVAL(retval); __GLX_SWAP_REPLY_RETVAL(); __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); return Success; } int __glXDispSwap_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetColorTableParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetColorTableParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); __GLX_SWAP_FLOAT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetColorTableParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetColorTableParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); __GLX_SWAP_INT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetConvolutionParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetConvolutionParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); __GLX_SWAP_FLOAT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetConvolutionParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetConvolutionParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); __GLX_SWAP_INT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetHistogramParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetHistogramParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); __GLX_SWAP_FLOAT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetHistogramParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetHistogramParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); __GLX_SWAP_INT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetMinmaxParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetMinmaxParameterfv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLfloat *) answer ); __GLX_SWAP_FLOAT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; } int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 4); pname = *(GLenum *)(pc + 4); compsize = __glGetMinmaxParameteriv_size(pname); if (compsize < 0) compsize = 0; __GLX_SWAP_INT(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetMinmaxParameteriv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *) answer ); __GLX_SWAP_INT_ARRAY(answer, compsize); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(1); __GLX_SWAP_REPLY_SIZE(); __GLX_PUT_INT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_SWAP_REPLY_HEADER(); __GLX_PUT_SIZE(compsize); __GLX_SWAP_REPLY_SIZE(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(compsize); } return Success; } int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc) { GLsizei n; GLboolean retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLboolean answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXVendorPrivateReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_VENDPRIV_HDR_SIZE; __GLX_SWAP_INT(pc + 0); n = *(GLsizei *)(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, n); __GLX_GET_ANSWER_BUFFER(answer,cl,n,1); retval = glAreTexturesResidentEXT( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4), (GLboolean *) answer ); __GLX_PUT_RETVAL(retval); __GLX_SWAP_REPLY_RETVAL(); __GLX_BEGIN_REPLY(n); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); __GLX_SEND_BYTE_ARRAY(n); return Success; } int __glXDispSwap_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc) { GLsizei n; __GLXcontext *cx; int error; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXVendorPrivateReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_VENDPRIV_HDR_SIZE; __GLX_SWAP_INT(pc + 0); n = *(GLsizei *)(pc + 0); __GLX_SWAP_INT_ARRAY(pc + 4, n); glDeleteTexturesEXT( *(GLsizei *)(pc + 0), (GLuint *)(pc + 4) ); return Success; } int __glXDispSwap_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc) { GLsizei n; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLuint answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXVendorPrivateReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_VENDPRIV_HDR_SIZE; __GLX_SWAP_INT(pc + 0); n = *(GLsizei *)(pc + 0); __GLX_GET_ANSWER_BUFFER(answer,cl,n*4,4); glGenTexturesEXT( *(GLsizei *)(pc + 0), (GLuint *) answer ); __GLX_SWAP_INT_ARRAY(answer, n); __GLX_BEGIN_REPLY(n*4); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); __GLX_SEND_INT_ARRAY(n); return Success; } int __glXDispSwap_IsTextureEXT(__GLXclientState *cl, GLbyte *pc) { GLboolean retval; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&((xGLXVendorPrivateReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_VENDPRIV_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_VENDPRIV_HDR_SIZE; __GLX_SWAP_INT(pc + 0); retval = glIsTextureEXT( *(GLuint *)(pc + 0) ); __GLX_PUT_RETVAL(retval); __GLX_SWAP_REPLY_RETVAL(); __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/Imakefile0000644000000000000000000001452613614532331017510 0ustar NULL = /* Large PIC tables needed for SPARC builds */ #if defined(sparc) || defined(SparcArchitecture) # define LargePICTable YES PICFLAGS = LargePositionIndependentCFlags #endif #include LinkSourceFile(glcontextmodes.c, $(MESASRCDIR)/src/mesa/drivers/dri/common) LinkSourceFile(glcontextmodes.h, $(MESASRCDIR)/src/mesa/drivers/dri/common) LinkSourceFile(indirect_size.c, $(MESASRCDIR)/src/glx/x11) LinkSourceFile(indirect_size.h, $(MESASRCDIR)/src/glx/x11) #if (!(defined(NXAgentServer) && NXAgentServer)) NXAGENT_SKIP_SRCS = \ glxext.c \ $(NULL) NXAGENT_SKIP_OBJS = \ glxext.o \ $(NULL) #else NX_DEFINES = -DNXAGENT_SERVER #endif SRCS = global.c \ glxbuf.c \ glxcmds.c \ glxcmdsswap.c \ glxfb.c \ glximports.c \ glxmem.c \ glxpix.c \ glxscreens.c \ glxutil.c \ render2.c \ render2swap.c \ renderpix.c \ renderpixswap.c \ rensize.c \ rensizetab.c \ single2.c \ single2swap.c \ singlepix.c \ singlepixswap.c \ singlesize.c \ xfont.c \ g_disptab.c \ g_disptab_EXT.c \ g_render.c \ g_renderswap.c \ g_single.c \ g_singleswap.c \ glcontextmodes.c \ indirect_size.c \ $(MSRCS) \ $(NXAGENT_SKIP_SRCS) \ $(NULL) OBJS = global.o \ glxbuf.o \ glxcmds.o \ glxcmdsswap.o \ glxfb.o \ glximports.o \ glxmem.o \ glxpix.o \ glxscreens.o \ glxutil.o \ render2.o \ render2swap.o \ renderpix.o \ renderpixswap.o \ rensize.o \ rensizetab.o \ single2.o \ single2swap.o \ singlepix.o \ singlepixswap.o \ singlesize.o \ xfont.o \ g_disptab.o \ g_disptab_EXT.o \ g_render.o \ g_renderswap.o \ g_single.o \ g_singleswap.o \ glcontextmodes.o \ indirect_size.o \ $(MOBJS) \ $(NXAGENT_SKIP_OBJS) \ $(NULL) INCLUDES = -I$(SERVERSRC)/GL/glx \ -I$(SERVERSRC)/GL/include \ -I$(SERVERSRC)/include \ -I$(INCLUDESRC) \ -I$(MESASRCDIR)/include \ -I$(XINCLUDESRC) \ -I$(SERVERSRC)/mi \ -I$(EXTINCSRC) \ -I$(LIBSRC)/GL/include \ -I$(XF86SRC) \ `pkg-config --cflags-only-I pixman-1` \ $(NULL) #if defined(DarwinArchitecture) && ((OSMajorVersion == 6 && OSMinorVersion < 3) || OSMajorVersion < 6) NO_EXT_DEFS = -DMISSING_GL_EXTS #endif #if defined(Win32Architecture) # undef __stdcall APIENTRY_DEFS = -DAPIENTRY=__stdcall #endif XCOMM If you add "-DDEBUG" in DEFINES, then make sure you also XCOMM add DEBUG to the define in ../mesa/src/X/xf86glx.c DEFINES = \ $(GLX_DEFINES) \ $(NO_EXT_DEFS) \ $(APIENTRY_DEFS) \ $(NX_DEFINES) \ $(NULL) NormalLibraryObjectRule() NormalLibraryTarget(glx,$(OBJS)) #if defined(GlxUseWindows) && GlxUseWindows clean:: RemoveFiles($(foreach obj,$(OBJS), stdcall/$(obj))) includes:: MakeDir(stdcall) SpecialObjectRule(stdcall/%.o,%.c,-DUSE_OPENGL32 -o $@) NormalLibraryTarget(glx_stdcall,$(foreach obj,$(OBJS), stdcall/$(obj))) #endif SubdirLibraryRule($(OBJS)) LintLibraryTarget(glx,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif #ifdef LinkDirectory LinkSourceFile(global.c,LinkDirectory) LinkSourceFile(glxbuf.c,LinkDirectory) LinkSourceFile(glxcmds.c,LinkDirectory) LinkSourceFile(glxcmdsswap.c,LinkDirectory) LinkSourceFile(glxext.c,LinkDirectory) LinkSourceFile(glxfb.c,LinkDirectory) LinkSourceFile(glximports.c,LinkDirectory) LinkSourceFile(glxmem.c,LinkDirectory) LinkSourceFile(glxpix.c,LinkDirectory) LinkSourceFile(glxscreens.c,LinkDirectory) LinkSourceFile(glxutil.c,LinkDirectory) LinkSourceFile(render2.c,LinkDirectory) LinkSourceFile(render2swap.c,LinkDirectory) LinkSourceFile(renderpix.c,LinkDirectory) LinkSourceFile(renderpixswap.c,LinkDirectory) LinkSourceFile(rensize.c,LinkDirectory) LinkSourceFile(rensizetab.c,LinkDirectory) LinkSourceFile(single2.c,LinkDirectory) LinkSourceFile(single2swap.c,LinkDirectory) LinkSourceFile(singlepix.c,LinkDirectory) LinkSourceFile(singlepixswap.c,LinkDirectory) LinkSourceFile(singlesize.c,LinkDirectory) LinkSourceFile(xfont.c,LinkDirectory) LinkSourceFile(g_disptab.c,LinkDirectory) LinkSourceFile(g_disptab_EXT.c,LinkDirectory) LinkSourceFile(g_render.c,LinkDirectory) LinkSourceFile(g_renderswap.c,LinkDirectory) LinkSourceFile(g_single.c,LinkDirectory) LinkSourceFile(g_singleswap.c,LinkDirectory) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/impsize.h0000644000000000000000000000460513614532331017525 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _impsize_h_ #define _impsize_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ /* ** These are defined in libsampleGL.a. They are not technically part of ** the defined interface between libdixGL.a and libsampleGL.a (that interface ** being the functions in the __glXScreenInfo structure, plus the OpenGL API ** itself), but we thought it was better to call these routines than to ** replicate the code in here. */ #include "indirect_size.h" extern int __glDrawPixels_size(GLenum format, GLenum type, GLsizei w,GLsizei h); #endif /* _impsize_h_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/render2.c0000644000000000000000000001702113614532331017375 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "unpack.h" #include "g_disptab.h" #include "g_disptab_EXT.h" #include "indirect_size.h" void __glXDisp_Map1f(GLbyte *pc) { GLint order, k; GLfloat u1, u2, *points; GLenum target; target = *(GLenum *)(pc + 0); order = *(GLint *)(pc + 12); u1 = *(GLfloat *)(pc + 4); u2 = *(GLfloat *)(pc + 8); points = (GLfloat *)(pc + 16); k = __glMap1f_size(target); glMap1f(target, u1, u2, k, order, points); } void __glXDisp_Map2f(GLbyte *pc) { GLint uorder, vorder, ustride, vstride, k; GLfloat u1, u2, v1, v2, *points; GLenum target; target = *(GLenum *)(pc + 0); uorder = *(GLint *)(pc + 12); vorder = *(GLint *)(pc + 24); u1 = *(GLfloat *)(pc + 4); u2 = *(GLfloat *)(pc + 8); v1 = *(GLfloat *)(pc + 16); v2 = *(GLfloat *)(pc + 20); points = (GLfloat *)(pc + 28); k = __glMap2f_size(target); ustride = vorder * k; vstride = k; glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); } void __glXDisp_Map1d(GLbyte *pc) { GLint order, k; #ifdef __GLX_ALIGN64 GLint compsize; #endif GLenum target; GLdouble u1, u2, *points; target = *(GLenum*) (pc + 16); order = *(GLint*) (pc + 20); k = __glMap1d_size(target); #ifdef __GLX_ALIGN64 if (order < 0 || k < 0) { compsize = 0; } else { compsize = order * k; } #endif __GLX_GET_DOUBLE(u1,pc); __GLX_GET_DOUBLE(u2,pc+8); pc += 24; #ifdef __GLX_ALIGN64 if (((unsigned long)pc) & 7) { /* ** Copy the doubles up 4 bytes, trashing the command but aligning ** the data in the process */ __GLX_MEM_COPY(pc-4, pc, compsize*8); points = (GLdouble*) (pc - 4); } else { points = (GLdouble*) pc; } #else points = (GLdouble*) pc; #endif glMap1d(target, u1, u2, k, order, points); } void __glXDisp_Map2d(GLbyte *pc) { GLdouble u1, u2, v1, v2, *points; GLint uorder, vorder, ustride, vstride, k; #ifdef __GLX_ALIGN64 GLint compsize; #endif GLenum target; target = *(GLenum *)(pc + 32); uorder = *(GLint *)(pc + 36); vorder = *(GLint *)(pc + 40); k = __glMap2d_size(target); #ifdef __GLX_ALIGN64 if (vorder < 0 || uorder < 0 || k < 0) { compsize = 0; } else { compsize = uorder * vorder * k; } #endif __GLX_GET_DOUBLE(u1,pc); __GLX_GET_DOUBLE(u2,pc+8); __GLX_GET_DOUBLE(v1,pc+16); __GLX_GET_DOUBLE(v2,pc+24); pc += 44; ustride = vorder * k; vstride = k; #ifdef __GLX_ALIGN64 if (((unsigned long)pc) & 7) { /* ** Copy the doubles up 4 bytes, trashing the command but aligning ** the data in the process */ __GLX_MEM_COPY(pc-4, pc, compsize*8); points = (GLdouble*) (pc - 4); } else { points = (GLdouble*) pc; } #else points = (GLdouble*) pc; #endif glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); } void __glXDisp_CallLists(GLbyte *pc) { GLenum type; GLsizei n; type = *(GLenum *)(pc + 4); n = *(GLsizei *)(pc + 0); glCallLists(n, type, pc + 8); } void __glXDisp_DrawArrays(GLbyte *pc) { __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc; __GLXdispatchDrawArraysComponentHeader *compHeader; GLint numVertexes = hdr->numVertexes; GLint numComponents = hdr->numComponents; GLenum primType = hdr->primType; GLint stride = 0; int i; pc += sizeof(__GLXdispatchDrawArraysHeader); compHeader = (__GLXdispatchDrawArraysComponentHeader *)pc; /* compute stride (same for all component arrays) */ for (i = 0; i < numComponents; i++) { GLenum datatype = compHeader[i].datatype; GLint numVals = compHeader[i].numVals; stride += __GLX_PAD(numVals * __glXTypeSize(datatype)); } pc += numComponents * sizeof(__GLXdispatchDrawArraysComponentHeader); /* set up component arrays */ for (i = 0; i < numComponents; i++) { GLenum datatype = compHeader[i].datatype; GLint numVals = compHeader[i].numVals; GLenum component = compHeader[i].component; switch (component) { case GL_VERTEX_ARRAY: glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(numVals, datatype, stride, pc); break; case GL_NORMAL_ARRAY: glEnableClientState(GL_NORMAL_ARRAY); glNormalPointer(datatype, stride, pc); break; case GL_COLOR_ARRAY: glEnableClientState(GL_COLOR_ARRAY); glColorPointer(numVals, datatype, stride, pc); break; case GL_INDEX_ARRAY: glEnableClientState(GL_INDEX_ARRAY); glIndexPointer(datatype, stride, pc); break; case GL_TEXTURE_COORD_ARRAY: glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(numVals, datatype, stride, pc); break; case GL_EDGE_FLAG_ARRAY: glEnableClientState(GL_EDGE_FLAG_ARRAY); glEdgeFlagPointer(stride, (const GLboolean *)pc); break; case GL_SECONDARY_COLOR_ARRAY: glEnableClientState(GL_SECONDARY_COLOR_ARRAY); glSecondaryColorPointer(numVals, datatype, stride, pc); break; case GL_FOG_COORD_ARRAY: glEnableClientState(GL_FOG_COORD_ARRAY); glFogCoordPointer(datatype, stride, pc); break; default: break; } pc += __GLX_PAD(numVals * __glXTypeSize(datatype)); } glDrawArrays(primType, 0, numVertexes); /* turn off anything we might have turned on */ glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_INDEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_EDGE_FLAG_ARRAY); glDisableClientState(GL_SECONDARY_COLOR_ARRAY); glDisableClientState(GL_FOG_COORD_ARRAY); } void __glXDisp_DrawArraysEXT(GLbyte *pc) { __glXDisp_DrawArrays(pc); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/render2swap.c0000644000000000000000000002505413614532331020275 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "unpack.h" #include "g_disptab.h" #include "g_disptab_EXT.h" #include "indirect_size.h" void __glXDispSwap_Map1f(GLbyte *pc) { GLint order, k; GLfloat u1, u2, *points; GLenum target; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_FLOAT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); target = *(GLenum *)(pc + 0); order = *(GLint *)(pc + 12); u1 = *(GLfloat *)(pc + 4); u2 = *(GLfloat *)(pc + 8); points = (GLfloat *)(pc + 16); k = __glMap1f_size(target); if (order <= 0 || k < 0) { /* Erroneous command. */ compsize = 0; } else { compsize = order * k; } __GLX_SWAP_FLOAT_ARRAY(points, compsize); glMap1f(target, u1, u2, k, order, points); } void __glXDispSwap_Map2f(GLbyte *pc) { GLint uorder, vorder, ustride, vstride, k; GLfloat u1, u2, v1, v2, *points; GLenum target; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 0); __GLX_SWAP_INT(pc + 12); __GLX_SWAP_INT(pc + 24); __GLX_SWAP_FLOAT(pc + 4); __GLX_SWAP_FLOAT(pc + 8); __GLX_SWAP_FLOAT(pc + 16); __GLX_SWAP_FLOAT(pc + 20); target = *(GLenum *)(pc + 0); uorder = *(GLint *)(pc + 12); vorder = *(GLint *)(pc + 24); u1 = *(GLfloat *)(pc + 4); u2 = *(GLfloat *)(pc + 8); v1 = *(GLfloat *)(pc + 16); v2 = *(GLfloat *)(pc + 20); points = (GLfloat *)(pc + 28); k = __glMap2f_size(target); ustride = vorder * k; vstride = k; if (vorder <= 0 || uorder <= 0 || k < 0) { /* Erroneous command. */ compsize = 0; } else { compsize = uorder * vorder * k; } __GLX_SWAP_FLOAT_ARRAY(points, compsize); glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); } void __glXDispSwap_Map1d(GLbyte *pc) { GLint order, k, compsize; GLenum target; GLdouble u1, u2, *points; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_DOUBLE(pc + 0); __GLX_SWAP_DOUBLE(pc + 8); __GLX_SWAP_INT(pc + 16); __GLX_SWAP_INT(pc + 20); target = *(GLenum*) (pc + 16); order = *(GLint*) (pc + 20); k = __glMap1d_size(target); if (order <= 0 || k < 0) { /* Erroneous command. */ compsize = 0; } else { compsize = order * k; } __GLX_GET_DOUBLE(u1,pc); __GLX_GET_DOUBLE(u2,pc+8); __GLX_SWAP_DOUBLE_ARRAY(pc+24, compsize); pc += 24; #ifdef __GLX_ALIGN64 if (((unsigned long)pc) & 7) { /* ** Copy the doubles up 4 bytes, trashing the command but aligning ** the data in the process */ __GLX_MEM_COPY(pc-4, pc, compsize*8); points = (GLdouble*) (pc - 4); } else { points = (GLdouble*) pc; } #else points = (GLdouble*) pc; #endif glMap1d(target, u1, u2, k, order, points); } void __glXDispSwap_Map2d(GLbyte *pc) { GLdouble u1, u2, v1, v2, *points; GLint uorder, vorder, ustride, vstride, k, compsize; GLenum target; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_DOUBLE(pc + 0); __GLX_SWAP_DOUBLE(pc + 8); __GLX_SWAP_DOUBLE(pc + 16); __GLX_SWAP_DOUBLE(pc + 24); __GLX_SWAP_INT(pc + 32); __GLX_SWAP_INT(pc + 36); __GLX_SWAP_INT(pc + 40); target = *(GLenum *)(pc + 32); uorder = *(GLint *)(pc + 36); vorder = *(GLint *)(pc + 40); k = __glMap2d_size(target); if (vorder <= 0 || uorder <= 0 || k < 0) { /* Erroneous command. */ compsize = 0; } else { compsize = uorder * vorder * k; } __GLX_GET_DOUBLE(u1,pc); __GLX_GET_DOUBLE(u2,pc+8); __GLX_GET_DOUBLE(v1,pc+16); __GLX_GET_DOUBLE(v2,pc+24); __GLX_SWAP_DOUBLE_ARRAY(pc+44, compsize); pc += 44; ustride = vorder * k; vstride = k; #ifdef __GLX_ALIGN64 if (((unsigned long)pc) & 7) { /* ** Copy the doubles up 4 bytes, trashing the command but aligning ** the data in the process */ __GLX_MEM_COPY(pc-4, pc, compsize*8); points = (GLdouble*) (pc - 4); } else { points = (GLdouble*) pc; } #else points = (GLdouble*) pc; #endif glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); } void __glXDispSwap_CallLists(GLbyte *pc) { GLenum type; GLsizei n; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + 0); type = *(GLenum *)(pc + 4); n = *(GLsizei *)(pc + 0); switch (type) { case GL_BYTE: case GL_UNSIGNED_BYTE: case GL_2_BYTES: case GL_3_BYTES: case GL_4_BYTES: break; case GL_SHORT: case GL_UNSIGNED_SHORT: __GLX_SWAP_SHORT_ARRAY(pc+8, n); break; case GL_INT: case GL_UNSIGNED_INT: __GLX_SWAP_INT_ARRAY(pc+8, n); break; case GL_FLOAT: __GLX_SWAP_FLOAT_ARRAY(pc+8, n); break; } glCallLists(n, type, pc+8); } static void swapArray(GLint numVals, GLenum datatype, GLint stride, GLint numVertexes, GLbyte *pc) { int i,j; __GLX_DECLARE_SWAP_VARIABLES; switch (datatype) { case GL_BYTE: case GL_UNSIGNED_BYTE: /* don't need to swap */ return; case GL_SHORT: case GL_UNSIGNED_SHORT: for (i=0; inumVertexes; GLint numComponents = hdr->numComponents; GLenum primType = hdr->primType; GLint stride = 0; int i; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT(&numVertexes); __GLX_SWAP_INT(&numComponents); __GLX_SWAP_INT(&primType); pc += sizeof(__GLXdispatchDrawArraysHeader); compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc; /* compute stride (same for all component arrays) */ for (i=0; i #endif #include "glxserver.h" #include "unpack.h" #include "g_disptab.h" #include "g_disptab_EXT.h" void __glXDisp_PolygonStipple(GLbyte *pc) { __GLXpixelHeader *hdr = (__GLXpixelHeader *) pc; glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glPolygonStipple((GLubyte *)(hdr+1)); } void __glXDisp_Bitmap(GLbyte *pc) { __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc; glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glBitmap((GLsizei) hdr->width, (GLsizei) hdr->height, (GLfloat) hdr->xorig, (GLfloat) hdr->yorig, (GLfloat) hdr->xmove, (GLfloat) hdr->ymove, (GLubyte *)(hdr+1)); } void __glXDisp_TexImage1D(GLbyte *pc) { __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glTexImage1D(hdr->target, (GLint) hdr->level, (GLint) hdr->components, (GLsizei) hdr->width, (GLint) hdr->border, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDisp_TexImage2D(GLbyte *pc) { __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glTexImage2D(hdr->target, (GLint) hdr->level, (GLint) hdr->components, (GLsizei) hdr->width, (GLsizei) hdr->height, (GLint) hdr->border, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDisp_TexImage3D(GLbyte *pc) { __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); glTexImage3D(hdr->target, hdr->level, hdr->internalformat, hdr->width, hdr->height, hdr->depth, hdr->border, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDisp_DrawPixels(GLbyte *pc) { __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glDrawPixels((GLsizei) hdr->width, (GLsizei) hdr->height, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDisp_TexSubImage1D(GLbyte *pc) { __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glTexSubImage1D(hdr->target, (GLint) hdr->level, (GLint) hdr->xoffset, (GLsizei) hdr->width, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDisp_TexSubImage2D(GLbyte *pc) { __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glTexSubImage2D(hdr->target, (GLint) hdr->level, (GLint) hdr->xoffset, (GLint) hdr->yoffset, (GLsizei) hdr->width, (GLsizei) hdr->height, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDisp_TexSubImage3D(GLbyte *pc) { __GLXdispatchTexSubImage3DHeader *hdr = (__GLXdispatchTexSubImage3DHeader *) pc; glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); glTexSubImage3D(hdr->target, hdr->level, hdr->xoffset, hdr->yoffset, hdr->zoffset, hdr->width, hdr->height, hdr->depth, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDisp_ColorTable(GLbyte *pc) { __GLXdispatchColorTableHeader *hdr = (__GLXdispatchColorTableHeader *) pc; glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); glColorTable(hdr->target, hdr->internalformat, hdr->width, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDisp_ColorSubTable(GLbyte *pc) { __GLXdispatchColorSubTableHeader *hdr = (__GLXdispatchColorSubTableHeader *) pc; glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); glColorSubTable(hdr->target, hdr->start, hdr->count, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDisp_ConvolutionFilter1D(GLbyte *pc) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); glConvolutionFilter1D(hdr->target, hdr->internalformat, hdr->width, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDisp_ConvolutionFilter2D(GLbyte *pc) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); glConvolutionFilter2D(hdr->target, hdr->internalformat, hdr->width, hdr->height, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDisp_SeparableFilter2D(GLbyte *pc) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; GLint hdrlen, image1len; hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_DISPATCH_HDR_SIZE); glPixelStorei(GL_UNPACK_SWAP_BYTES, hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); /* XXX check this usage - internal code called ** a version without the packing parameters */ image1len = __glXImageSize(hdr->format, hdr->type, 0, hdr->width, 1, 1, 0, hdr->rowLength, 0, hdr->skipRows, hdr->alignment); image1len = __GLX_PAD(image1len); glSeparableFilter2D(hdr->target, hdr->internalformat, hdr->width, hdr->height, hdr->format, hdr->type, ((GLubyte *)hdr+hdrlen), ((GLubyte *)hdr+hdrlen+image1len)); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/renderpixswap.c0000644000000000000000000004755313614532331020744 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "unpack.h" #include "g_disptab.h" #include "g_disptab_EXT.h" void __glXDispSwap_PolygonStipple(GLbyte *pc) { __GLXpixelHeader *hdr = (__GLXpixelHeader *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glPolygonStipple((GLubyte *)(hdr+1)); } void __glXDispSwap_Bitmap(GLbyte *pc) { __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_FLOAT((GLbyte *)&hdr->xorig); __GLX_SWAP_FLOAT((GLbyte *)&hdr->yorig); __GLX_SWAP_FLOAT((GLbyte *)&hdr->xmove); __GLX_SWAP_FLOAT((GLbyte *)&hdr->ymove); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glBitmap((GLsizei) hdr->width, (GLsizei) hdr->height, (GLfloat) hdr->xorig, (GLfloat) hdr->yorig, (GLfloat) hdr->xmove, (GLfloat) hdr->ymove, (GLubyte *)(hdr+1)); } void __glXDispSwap_TexImage1D(GLbyte *pc) { __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->components); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_INT((GLbyte *)&hdr->border); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. */ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glTexImage1D(hdr->target, (GLint) hdr->level, (GLint) hdr->components, (GLsizei) hdr->width, (GLint) hdr->border, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDispSwap_TexImage2D(GLbyte *pc) { __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->components); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_INT((GLbyte *)&hdr->border); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. */ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glTexImage2D(hdr->target, (GLint) hdr->level, (GLint) hdr->components, (GLsizei) hdr->width, (GLsizei) hdr->height, (GLint) hdr->border, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDispSwap_TexImage3D(GLbyte *pc) { __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight); __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth); __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipImages); __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_INT((GLbyte *)&hdr->depth); __GLX_SWAP_INT((GLbyte *)&hdr->size4d); __GLX_SWAP_INT((GLbyte *)&hdr->border); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. */ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); glTexImage3D(hdr->target, hdr->level, hdr->internalformat, hdr->width, hdr->height, hdr->depth, hdr->border, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDispSwap_DrawPixels(GLbyte *pc) { __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. */ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glDrawPixels((GLsizei) hdr->width, (GLsizei) hdr->height, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDispSwap_TexSubImage1D(GLbyte *pc) { __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. */ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glTexSubImage1D(hdr->target, (GLint) hdr->level, (GLint) hdr->xoffset, (GLsizei) hdr->width, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDispSwap_TexSubImage2D(GLbyte *pc) { __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); __GLX_SWAP_INT((GLbyte *)&hdr->yoffset); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. */ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment); glTexSubImage2D(hdr->target, (GLint) hdr->level, (GLint) hdr->xoffset, (GLint) hdr->yoffset, (GLsizei) hdr->width, (GLsizei) hdr->height, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDispSwap_TexSubImage3D(GLbyte *pc) { __GLXdispatchTexSubImage3DHeader *hdr = (__GLXdispatchTexSubImage3DHeader *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight); __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth); __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipImages); __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->level); __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); __GLX_SWAP_INT((GLbyte *)&hdr->yoffset); __GLX_SWAP_INT((GLbyte *)&hdr->zoffset); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_INT((GLbyte *)&hdr->depth); __GLX_SWAP_INT((GLbyte *)&hdr->size4d); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. */ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, hdr->imageHeight); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_IMAGES, hdr->skipImages); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); glTexSubImage3D(hdr->target, hdr->level, hdr->xoffset, hdr->yoffset, hdr->zoffset, hdr->width, hdr->height, hdr->depth, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDispSwap_ColorTable(GLbyte *pc) { __GLXdispatchColorTableHeader *hdr = (__GLXdispatchColorTableHeader *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. */ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); glColorTable(hdr->target, hdr->internalformat, hdr->width, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDispSwap_ColorSubTable(GLbyte *pc) { __GLXdispatchColorSubTableHeader *hdr = (__GLXdispatchColorSubTableHeader *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->start); __GLX_SWAP_INT((GLbyte *)&hdr->count); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. */ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); glColorSubTable(hdr->target, hdr->start, hdr->count, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDispSwap_ConvolutionFilter1D(GLbyte *pc) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. */ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); glConvolutionFilter2D(hdr->target, hdr->internalformat, hdr->width, 1, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDispSwap_ConvolutionFilter2D(GLbyte *pc) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. */ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); glConvolutionFilter2D(hdr->target, hdr->internalformat, hdr->width, hdr->height, hdr->format, hdr->type, (GLvoid *)(hdr+1)); } void __glXDispSwap_SeparableFilter2D(GLbyte *pc) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; GLint hdrlen, image1len; __GLX_DECLARE_SWAP_VARIABLES; hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE); __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); __GLX_SWAP_INT((GLbyte *)&hdr->alignment); __GLX_SWAP_INT((GLbyte *)&hdr->target); __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); __GLX_SWAP_INT((GLbyte *)&hdr->width); __GLX_SWAP_INT((GLbyte *)&hdr->height); __GLX_SWAP_INT((GLbyte *)&hdr->format); __GLX_SWAP_INT((GLbyte *)&hdr->type); /* ** Just invert swapBytes flag; the GL will figure out if it needs to swap ** the pixel data. */ glPixelStorei(GL_UNPACK_SWAP_BYTES, !hdr->swapBytes); glPixelStorei(GL_UNPACK_LSB_FIRST, hdr->lsbFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, hdr->rowLength); glPixelStorei(GL_UNPACK_SKIP_ROWS, hdr->skipRows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, hdr->skipPixels); glPixelStorei(GL_UNPACK_ALIGNMENT, hdr->alignment); /* XXX check this usage - internal code called ** a version without the packing parameters */ image1len = __glXImageSize(hdr->format, hdr->type, 0, hdr->width, 1, 1, 0, hdr->rowLength, 0, hdr->skipRows, hdr->alignment); image1len = __GLX_PAD(image1len); glSeparableFilter2D(hdr->target, hdr->internalformat, hdr->width, hdr->height, hdr->format, hdr->type, ((GLubyte *)hdr+hdrlen), ((GLubyte *)hdr+hdrlen+image1len)); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/rensize.c0000644000000000000000000006713113614532331017522 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "glxserver.h" #include "GL/glxproto.h" #include "unpack.h" #include "impsize.h" #define SWAPL(a) \ (((a & 0xff000000U)>>24) | ((a & 0xff0000U)>>8) | \ ((a & 0xff00U)<<8) | ((a & 0xffU)<<24)) int __glXCallListsReqSize(GLbyte *pc, Bool swap, int reqlen) { GLsizei n = *(GLsizei *)(pc + 0); GLenum type = *(GLenum *)(pc + 4); if (swap) { n = SWAPL( n ); type = SWAPL( type ); } return n * __glCallLists_size( type ); } int __glXFogivReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 0); if (swap) { pname = SWAPL( pname ); } return 4 * __glFogiv_size( pname ); /* defined in samplegl lib */ } int __glXFogfvReqSize(GLbyte *pc, Bool swap, int reqlen) { return __glXFogivReqSize( pc, swap, reqlen); } int __glXLightfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { pname = SWAPL( pname ); } return 4 * __glLightfv_size( pname ); /* defined in samplegl lib */ } int __glXLightivReqSize(GLbyte *pc, Bool swap, int reqlen) { return __glXLightfvReqSize( pc, swap, reqlen); } int __glXLightModelfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 0); if (swap) { pname = SWAPL( pname ); } return 4 * __glLightModelfv_size( pname ); /* defined in samplegl lib */ } int __glXLightModelivReqSize(GLbyte *pc, Bool swap, int reqlen) { return __glXLightModelfvReqSize( pc, swap, reqlen); } int __glXMaterialfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { pname = SWAPL( pname ); } return 4 * __glMaterialfv_size( pname ); /* defined in samplegl lib */ } int __glXMaterialivReqSize(GLbyte *pc, Bool swap, int reqlen) { return __glXMaterialfvReqSize( pc, swap, reqlen); } int __glXTexGendvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { pname = SWAPL( pname ); } return 8 * __glTexGendv_size( pname ); /* defined in samplegl lib */ } int __glXTexGenfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { pname = SWAPL( pname ); } return 4 * __glTexGenfv_size( pname ); /* defined in samplegl lib */ } int __glXTexGenivReqSize(GLbyte *pc, Bool swap, int reqlen) { return __glXTexGenfvReqSize( pc, swap, reqlen); } int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { pname = SWAPL( pname ); } return 4 * __glTexParameterfv_size( pname ); /* defined in samplegl lib */ } int __glXTexParameterivReqSize(GLbyte *pc, Bool swap, int reqlen) { return __glXTexParameterfvReqSize( pc, swap, reqlen); } int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { pname = SWAPL( pname ); } return 4 * __glTexEnvfv_size( pname ); /* defined in samplegl lib */ } int __glXTexEnvivReqSize(GLbyte *pc, Bool swap, int reqlen ) { return __glXTexEnvfvReqSize( pc, swap, reqlen); } int __glXMap1dReqSize(GLbyte *pc, Bool swap, int reqlen ) { GLenum target; GLint order; target = *(GLenum*) (pc + 16); order = *(GLint*) (pc + 20); if (swap) { target = SWAPL( target ); order = SWAPL( order ); } if (order < 1) return -1; return safe_mul(8, safe_mul(__glMap1d_size(target), order)); } int __glXMap1fReqSize(GLbyte *pc, Bool swap, int reqlen ) { GLenum target; GLint order; target = *(GLenum *)(pc + 0); order = *(GLint *)(pc + 12); if (swap) { target = SWAPL( target ); order = SWAPL( order ); } if (order < 1) return -1; return safe_mul(4, safe_mul(__glMap1f_size(target), order)); } static int Map2Size(int k, int majorOrder, int minorOrder) { if (majorOrder < 1 || minorOrder < 1) return -1; return safe_mul(k, safe_mul(majorOrder, minorOrder)); } int __glXMap2dReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum target; GLint uorder, vorder; target = *(GLenum *)(pc + 32); uorder = *(GLint *)(pc + 36); vorder = *(GLint *)(pc + 40); if (swap) { target = SWAPL( target ); uorder = SWAPL( uorder ); vorder = SWAPL( vorder ); } return safe_mul(8, Map2Size(__glMap2d_size(target), uorder, vorder)); } int __glXMap2fReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum target; GLint uorder, vorder; target = *(GLenum *)(pc + 0); uorder = *(GLint *)(pc + 12); vorder = *(GLint *)(pc + 24); if (swap) { target = SWAPL( target ); uorder = SWAPL( uorder ); vorder = SWAPL( vorder ); } return safe_mul(4, Map2Size(__glMap2f_size(target), uorder, vorder)); } int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLint mapsize; mapsize = *(GLint *)(pc + 4); if (swap) { mapsize = SWAPL( mapsize ); } return 4 * mapsize; } int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap, int reqlen) { return __glXPixelMapfvReqSize( pc, swap, reqlen); } int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLint mapsize; mapsize = *(GLint *)(pc + 4); if (swap) { mapsize = SWAPL( mapsize ); } return 2 * mapsize; } /** * Calculate the size of an image. * * The size of an image sent to the server from the client or sent from the * server to the client is calculated. The size is based on the dimensions * of the image, the type of pixel data, padding in the image, and the * alignment requirements of the image. * * \param format Format of the pixels. Same as the \c format parameter * to \c glTexImage1D * \param type Type of the pixel data. Same as the \c type parameter * to \c glTexImage1D * \param target Typically the texture target of the image. If the * target is one of \c GL_PROXY_*, the size returned is * always zero. For uses that do not have a texture target * (e.g, glDrawPixels), zero should be specified. * \param w Width of the image data. Must be >= 1. * \param h Height of the image data. Must be >= 1, even for 1D * images. * \param d Depth of the image data. Must be >= 1, even for 1D or * 2D images. * \param imageHeight If non-zero, defines the true height of a volumetric * image. This value will be used instead of \c h for * calculating the size of the image. * \param rowLength If non-zero, defines the true width of an image. This * value will be used instead of \c w for calculating the * size of the image. * \param skipImages Number of extra layers of image data in a volumtric * image that are to be skipped before the real data. * \param skipRows Number of extra rows of image data in an image that are * to be skipped before the real data. * \param alignment Specifies the alignment for the start of each pixel row * in memory. This value must be one of 1, 2, 4, or 8. * * \returns * The size of the image is returned. If the specified \c format and \c type * are invalid, -1 is returned. If \c target is one of \c GL_PROXY_*, zero * is returned. */ int __glXImageSize( GLenum format, GLenum type, GLenum target, GLsizei w, GLsizei h, GLsizei d, GLint imageHeight, GLint rowLength, GLint skipImages, GLint skipRows, GLint alignment ) { GLint bytesPerElement, elementsPerGroup, groupsPerRow; GLint groupSize, rowSize, padding, imageSize; if (w == 0 || h == 0 || d == 0) return 0; if (w < 0 || h < 0 || d < 0 || (type == GL_BITMAP && (format != GL_COLOR_INDEX && format != GL_STENCIL_INDEX))) { return -1; } /* proxy targets have no data */ switch( target ) { case GL_PROXY_TEXTURE_1D: case GL_PROXY_TEXTURE_2D: case GL_PROXY_TEXTURE_3D: case GL_PROXY_TEXTURE_4D_SGIS: case GL_PROXY_TEXTURE_CUBE_MAP: case GL_PROXY_TEXTURE_RECTANGLE_ARB: case GL_PROXY_HISTOGRAM: case GL_PROXY_COLOR_TABLE: case GL_PROXY_TEXTURE_COLOR_TABLE_SGI: case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: case GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP: return 0; } /* real data has to have real sizes */ if (imageHeight < 0 || rowLength < 0 || skipImages < 0 || skipRows < 0) return -1; if (alignment != 1 && alignment != 2 && alignment != 4 && alignment != 8) return -1; if (type == GL_BITMAP) { if (rowLength > 0) { groupsPerRow = rowLength; } else { groupsPerRow = w; } rowSize = (groupsPerRow + 7) >> 3; if (rowSize < 0) return -1; padding = (rowSize % alignment); if (padding) { rowSize += alignment - padding; } return safe_mul(safe_add(h, skipRows), rowSize); } else { switch(format) { case GL_COLOR_INDEX: case GL_STENCIL_INDEX: case GL_DEPTH_COMPONENT: case GL_RED: case GL_GREEN: case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: case GL_INTENSITY: elementsPerGroup = 1; break; case GL_422_EXT: case GL_422_REV_EXT: case GL_422_AVERAGE_EXT: case GL_422_REV_AVERAGE_EXT: case GL_DEPTH_STENCIL_NV: case GL_DEPTH_STENCIL_MESA: case GL_YCBCR_MESA: case GL_LUMINANCE_ALPHA: elementsPerGroup = 2; break; case GL_RGB: case GL_BGR: elementsPerGroup = 3; break; case GL_RGBA: case GL_BGRA: case GL_ABGR_EXT: elementsPerGroup = 4; break; default: return -1; } switch(type) { case GL_UNSIGNED_BYTE: case GL_BYTE: bytesPerElement = 1; break; case GL_UNSIGNED_BYTE_3_3_2: case GL_UNSIGNED_BYTE_2_3_3_REV: bytesPerElement = 1; elementsPerGroup = 1; break; case GL_UNSIGNED_SHORT: case GL_SHORT: bytesPerElement = 2; break; case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL_UNSIGNED_SHORT_8_8_APPLE: case GL_UNSIGNED_SHORT_8_8_REV_APPLE: case GL_UNSIGNED_SHORT_15_1_MESA: case GL_UNSIGNED_SHORT_1_15_REV_MESA: bytesPerElement = 2; elementsPerGroup = 1; break; case GL_INT: case GL_UNSIGNED_INT: case GL_FLOAT: bytesPerElement = 4; break; case GL_UNSIGNED_INT_8_8_8_8: case GL_UNSIGNED_INT_8_8_8_8_REV: case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: case GL_UNSIGNED_INT_24_8_NV: case GL_UNSIGNED_INT_24_8_MESA: case GL_UNSIGNED_INT_8_24_REV_MESA: bytesPerElement = 4; elementsPerGroup = 1; break; default: return -1; } /* known safe by the switches above, not checked */ groupSize = bytesPerElement * elementsPerGroup; if (rowLength > 0) { groupsPerRow = rowLength; } else { groupsPerRow = w; } if ((rowSize = safe_mul(groupsPerRow, groupSize)) < 0) return -1; padding = (rowSize % alignment); if (padding) { rowSize += alignment - padding; } if (imageHeight > 0) h = imageHeight; h = safe_add(h, skipRows); imageSize = safe_mul(h, rowSize); return safe_mul(safe_add(d, skipImages), imageSize); } } int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; GLenum format = hdr->format; GLenum type = hdr->type; GLint w = hdr->width; GLint h = hdr->height; GLint rowLength = hdr->rowLength; GLint skipRows = hdr->skipRows; GLint alignment = hdr->alignment; if (swap) { format = SWAPL( format ); type = SWAPL( type ); w = SWAPL( w ); h = SWAPL( h ); rowLength = SWAPL( rowLength ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } return __glXImageSize( format, type, 0, w, h, 1, 0, rowLength, 0, skipRows, alignment ); } int __glXBitmapReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc; GLint w = hdr->width; GLint h = hdr->height; GLint rowLength = hdr->rowLength; GLint skipRows = hdr->skipRows; GLint alignment = hdr->alignment; if (swap) { w = SWAPL( w ); h = SWAPL( h ); rowLength = SWAPL( rowLength ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } return __glXImageSize( GL_COLOR_INDEX, GL_BITMAP, 0, w, h, 1, 0, rowLength, 0, skipRows, alignment ); } int __glXTexImage1DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; GLenum target = hdr->target; GLenum format = hdr->format; GLenum type = hdr->type; GLint w = hdr->width; GLint rowLength = hdr->rowLength; GLint skipRows = hdr->skipRows; GLint alignment = hdr->alignment; if (swap) { target = SWAPL( target ); format = SWAPL( format ); type = SWAPL( type ); w = SWAPL( w ); rowLength = SWAPL( rowLength ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } if (target == GL_PROXY_TEXTURE_1D) { return 0; } else if (format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT) { return -1; } return __glXImageSize( format, type, 0, w, 1, 1, 0, rowLength, 0, skipRows, alignment ); } int __glXTexImage2DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; GLenum target = hdr->target; GLenum format = hdr->format; GLenum type = hdr->type; GLint w = hdr->width; GLint h = hdr->height; GLint rowLength = hdr->rowLength; GLint skipRows = hdr->skipRows; GLint alignment = hdr->alignment; if (swap) { target = SWAPL( target ); format = SWAPL( format ); type = SWAPL( type ); w = SWAPL( w ); h = SWAPL( h ); rowLength = SWAPL( rowLength ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } if (target == GL_PROXY_TEXTURE_2D || target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) { return 0; } else if (format == GL_STENCIL_INDEX || format == GL_DEPTH_COMPONENT) { return -1; } return __glXImageSize( format, type, 0, w, h, 1, 0, rowLength, 0, skipRows, alignment ); } /* XXX this is used elsewhere - should it be exported from glxserver.h? */ int __glXTypeSize(GLenum enm) { switch(enm) { case GL_BYTE: return sizeof(GLbyte); case GL_UNSIGNED_BYTE: return sizeof(GLubyte); case GL_SHORT: return sizeof(GLshort); case GL_UNSIGNED_SHORT: return sizeof(GLushort); case GL_INT: return sizeof(GLint); case GL_UNSIGNED_INT: return sizeof(GLint); case GL_FLOAT: return sizeof(GLfloat); case GL_DOUBLE: return sizeof(GLdouble); default: return -1; } } int __glXDrawArraysSize( GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *) pc; __GLXdispatchDrawArraysComponentHeader *compHeader; GLint numVertexes = hdr->numVertexes; GLint numComponents = hdr->numComponents; GLint arrayElementSize = 0; GLint x, size; int i; if (swap) { numVertexes = SWAPL( numVertexes ); numComponents = SWAPL( numComponents ); } pc += sizeof(__GLXdispatchDrawArraysHeader); reqlen -= sizeof(__GLXdispatchDrawArraysHeader); size = safe_mul(sizeof(__GLXdispatchDrawArraysComponentHeader), numComponents); if (size < 0 || reqlen < 0 || reqlen < size) return -1; compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc; for (i=0; iformat; GLenum type = hdr->type; GLint w = hdr->width; GLint rowLength = hdr->rowLength; GLint skipRows = hdr->skipRows; GLint alignment = hdr->alignment; if (swap) { format = SWAPL( format ); type = SWAPL( type ); w = SWAPL( w ); rowLength = SWAPL( rowLength ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } return __glXImageSize( format, type, 0, w, 1, 1, 0, rowLength, 0, skipRows, alignment ); } int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; GLenum format = hdr->format; GLenum type = hdr->type; GLint w = hdr->width; GLint h = hdr->height; GLint rowLength = hdr->rowLength; GLint skipRows = hdr->skipRows; GLint alignment = hdr->alignment; if (swap) { format = SWAPL( format ); type = SWAPL( type ); w = SWAPL( w ); h = SWAPL( h ); rowLength = SWAPL( rowLength ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } return __glXImageSize( format, type, 0, w, h, 1, 0, rowLength, 0, skipRows, alignment ); } int __glXTexImage3DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; GLenum target = hdr->target; GLenum format = hdr->format; GLenum type = hdr->type; GLint w = hdr->width; GLint h = hdr->height; GLint d = hdr->depth; GLint imageHeight = hdr->imageHeight; GLint rowLength = hdr->rowLength; GLint skipImages = hdr->skipImages; GLint skipRows = hdr->skipRows; GLint alignment = hdr->alignment; GLint nullImage = hdr->nullimage; if (swap) { target = SWAPL( target ); format = SWAPL( format ); type = SWAPL( type ); w = SWAPL( w ); h = SWAPL( h ); d = SWAPL( d ); imageHeight = SWAPL( imageHeight ); rowLength = SWAPL( rowLength ); skipImages = SWAPL( skipImages ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } if (target == GL_PROXY_TEXTURE_3D || nullImage) { return 0; } else { return __glXImageSize( format, type, target, w, h, d, imageHeight, rowLength, skipImages, skipRows, alignment ); } } int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchTexSubImage3DHeader *hdr = (__GLXdispatchTexSubImage3DHeader *) pc; GLenum target = hdr->target; GLenum format = hdr->format; GLenum type = hdr->type; GLint w = hdr->width; GLint h = hdr->height; GLint d = hdr->depth; GLint imageHeight = hdr->imageHeight; GLint rowLength = hdr->rowLength; GLint skipImages = hdr->skipImages; GLint skipRows = hdr->skipRows; GLint alignment = hdr->alignment; if (swap) { target = SWAPL( target ); format = SWAPL( format ); type = SWAPL( type ); w = SWAPL( w ); h = SWAPL( h ); d = SWAPL( d ); imageHeight = SWAPL( imageHeight ); rowLength = SWAPL( rowLength ); skipImages = SWAPL( skipImages ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } if (target == GL_PROXY_TEXTURE_3D) { return 0; } else { return __glXImageSize( format, type, target, w, h, d, imageHeight, rowLength, skipImages, skipRows, alignment ); } } int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; GLenum format = hdr->format; GLenum type = hdr->type; GLint w = hdr->width; GLint rowLength = hdr->rowLength; GLint alignment = hdr->alignment; if (swap) { format = SWAPL( format ); type = SWAPL( type ); w = SWAPL( w ); rowLength = SWAPL( rowLength ); alignment = SWAPL( alignment ); } return __glXImageSize( format, type, 0, w, 1, 1, 0, rowLength, 0, 0, alignment ); } int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; GLenum format = hdr->format; GLenum type = hdr->type; GLint w = hdr->width; GLint h = hdr->height; GLint rowLength = hdr->rowLength; GLint skipRows = hdr->skipRows; GLint alignment = hdr->alignment; if (swap) { format = SWAPL( format ); type = SWAPL( type ); w = SWAPL( w ); h = SWAPL( h ); rowLength = SWAPL( rowLength ); skipRows = SWAPL( skipRows ); alignment = SWAPL( alignment ); } return __glXImageSize( format, type, 0, w, h, 1, 0, rowLength, 0, skipRows, alignment ); } int __glXConvolutionParameterivSize(GLenum pname) { switch (pname) { case GL_CONVOLUTION_BORDER_COLOR: case GL_CONVOLUTION_FILTER_SCALE: case GL_CONVOLUTION_FILTER_BIAS: return 4; case GL_CONVOLUTION_BORDER_MODE: return 1; default: return -1; } } int __glXConvolutionParameterfvSize(GLenum pname) { return __glXConvolutionParameterivSize(pname); } int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { pname = SWAPL( pname ); } return 4 * __glXConvolutionParameterivSize( pname ); } int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen) { return __glXConvolutionParameterivReqSize( pc, swap, reqlen); } int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchConvolutionFilterHeader *hdr = (__GLXdispatchConvolutionFilterHeader *) pc; GLint image1size, image2size; GLenum format = hdr->format; GLenum type = hdr->type; GLint w = hdr->width; GLint h = hdr->height; GLint rowLength = hdr->rowLength; GLint alignment = hdr->alignment; if (swap) { format = SWAPL( format ); type = SWAPL( type ); w = SWAPL( w ); h = SWAPL( h ); rowLength = SWAPL( rowLength ); alignment = SWAPL( alignment ); } /* XXX Should rowLength be used for either or both image? */ image1size = __glXImageSize( format, type, 0, w, 1, 1, 0, rowLength, 0, 0, alignment ); image2size = __glXImageSize( format, type, 0, h, 1, 1, 0, rowLength, 0, 0, alignment ); return safe_add(safe_pad(image1size), image2size); } int __glXColorTableParameterfvSize(GLenum pname) { /* currently, only scale and bias are supported; return RGBA */ switch(pname) { case GL_COLOR_TABLE_SCALE: case GL_COLOR_TABLE_BIAS: return 4; default: return 0; } } int __glXColorTableParameterivSize(GLenum pname) { /* fv and iv are the same in this context */ return __glXColorTableParameterfvSize(pname); } int __glXColorTableReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchColorTableHeader *hdr = (__GLXdispatchColorTableHeader *) pc; GLenum target = hdr->target; GLenum format = hdr->format; GLenum type = hdr->type; GLint w = hdr->width; GLint rowLength = hdr->rowLength; GLint alignment = hdr->alignment; switch (target) { case GL_PROXY_TEXTURE_1D: case GL_PROXY_TEXTURE_2D: case GL_PROXY_TEXTURE_3D: case GL_PROXY_COLOR_TABLE: case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: case GL_PROXY_TEXTURE_CUBE_MAP_ARB: return 0; } if (swap) { format = SWAPL( format ); type = SWAPL( type ); w = SWAPL( w ); rowLength = SWAPL( rowLength ); alignment = SWAPL( alignment ); } return __glXImageSize( format, type, 0, w, 1, 1, 0, rowLength, 0, 0, alignment ); } int __glXColorSubTableReqSize(GLbyte *pc, Bool swap, int reqlen) { __GLXdispatchColorSubTableHeader *hdr = (__GLXdispatchColorSubTableHeader *) pc; GLenum format = hdr->format; GLenum type = hdr->type; GLint count = hdr->count; GLint rowLength = hdr->rowLength; GLint alignment = hdr->alignment; if (swap) { format = SWAPL( format ); type = SWAPL( type ); count = SWAPL( count ); rowLength = SWAPL( rowLength ); alignment = SWAPL( alignment ); } return __glXImageSize( format, type, 0, count, 1, 1, 0, rowLength, 0, 0, alignment ); } int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 4); if (swap) { pname = SWAPL( pname ); } return 4 * __glXColorTableParameterfvSize(pname); } int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap, int reqlen) { /* no difference between fv and iv versions */ return __glXColorTableParameterfvReqSize(pc, swap, reqlen); } int __glXPointParameterfvARBReqSize(GLbyte *pc, Bool swap, int reqlen) { GLenum pname = *(GLenum *)(pc + 0); if (swap) { pname = SWAPL( pname ); } return 4 * __glPointParameterfvEXT_size( pname ); } int __glXPointParameterivReqSize(GLbyte *pc, Bool swap, int reqlen) { /* no difference between fv and iv versions */ return __glXPointParameterfvARBReqSize(pc, swap, reqlen); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/rensizetab.c0000644000000000000000000051026213614532331020207 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "g_disptab_EXT.h" __GLXrenderSizeData __glXRenderSizeTable[__GLX_MAX_RENDER_OPCODE_EXT - __GLX_MIN_RENDER_OPCODE_EXT + 1] = { /* no such opcode */ { 0, 0 }, /* CallList */ { 8, 0 }, /* CallLists */ { 12, __glXCallListsReqSize }, /* ListBase */ { 8, 0 }, /* Begin */ { 8, 0 }, /* Bitmap */ { 48, __glXBitmapReqSize }, /* Color3bv */ { 8, 0 }, /* Color3dv */ { 28, 0 }, /* Color3fv */ { 16, 0 }, /* Color3iv */ { 16, 0 }, /* Color3sv */ { 12, 0 }, /* Color3ubv */ { 8, 0 }, /* Color3uiv */ { 16, 0 }, /* Color3usv */ { 12, 0 }, /* Color4bv */ { 8, 0 }, /* Color4dv */ { 36, 0 }, /* Color4fv */ { 20, 0 }, /* Color4iv */ { 20, 0 }, /* Color4sv */ { 12, 0 }, /* Color4ubv */ { 8, 0 }, /* Color4uiv */ { 20, 0 }, /* Color4usv */ { 12, 0 }, /* EdgeFlagv */ { 8, 0 }, /* End */ { 4, 0 }, /* Indexdv */ { 12, 0 }, /* Indexfv */ { 8, 0 }, /* Indexiv */ { 8, 0 }, /* Indexsv */ { 8, 0 }, /* Normal3bv */ { 8, 0 }, /* Normal3dv */ { 28, 0 }, /* Normal3fv */ { 16, 0 }, /* Normal3iv */ { 16, 0 }, /* Normal3sv */ { 12, 0 }, /* RasterPos2dv */ { 20, 0 }, /* RasterPos2fv */ { 12, 0 }, /* RasterPos2iv */ { 12, 0 }, /* RasterPos2sv */ { 8, 0 }, /* RasterPos3dv */ { 28, 0 }, /* RasterPos3fv */ { 16, 0 }, /* RasterPos3iv */ { 16, 0 }, /* RasterPos3sv */ { 12, 0 }, /* RasterPos4dv */ { 36, 0 }, /* RasterPos4fv */ { 20, 0 }, /* RasterPos4iv */ { 20, 0 }, /* RasterPos4sv */ { 12, 0 }, /* Rectdv */ { 36, 0 }, /* Rectfv */ { 20, 0 }, /* Rectiv */ { 20, 0 }, /* Rectsv */ { 12, 0 }, /* TexCoord1dv */ { 12, 0 }, /* TexCoord1fv */ { 8, 0 }, /* TexCoord1iv */ { 8, 0 }, /* TexCoord1sv */ { 8, 0 }, /* TexCoord2dv */ { 20, 0 }, /* TexCoord2fv */ { 12, 0 }, /* TexCoord2iv */ { 12, 0 }, /* TexCoord2sv */ { 8, 0 }, /* TexCoord3dv */ { 28, 0 }, /* TexCoord3fv */ { 16, 0 }, /* TexCoord3iv */ { 16, 0 }, /* TexCoord3sv */ { 12, 0 }, /* TexCoord4dv */ { 36, 0 }, /* TexCoord4fv */ { 20, 0 }, /* TexCoord4iv */ { 20, 0 }, /* TexCoord4sv */ { 12, 0 }, /* Vertex2dv */ { 20, 0 }, /* Vertex2fv */ { 12, 0 }, /* Vertex2iv */ { 12, 0 }, /* Vertex2sv */ { 8, 0 }, /* Vertex3dv */ { 28, 0 }, /* Vertex3fv */ { 16, 0 }, /* Vertex3iv */ { 16, 0 }, /* Vertex3sv */ { 12, 0 }, /* Vertex4dv */ { 36, 0 }, /* Vertex4fv */ { 20, 0 }, /* Vertex4iv */ { 20, 0 }, /* Vertex4sv */ { 12, 0 }, /* ClipPlane */ { 40, 0 }, /* ColorMaterial */ { 12, 0 }, /* CullFace */ { 8, 0 }, /* Fogf */ { 12, 0 }, /* Fogfv */ { 8, __glXFogfvReqSize }, /* Fogi */ { 12, 0 }, /* Fogiv */ { 8, __glXFogivReqSize }, /* FrontFace */ { 8, 0 }, /* Hint */ { 12, 0 }, /* Lightf */ { 16, 0 }, /* Lightfv */ { 12, __glXLightfvReqSize }, /* Lighti */ { 16, 0 }, /* Lightiv */ { 12, __glXLightivReqSize }, /* LightModelf */ { 12, 0 }, /* LightModelfv */ { 8, __glXLightModelfvReqSize }, /* LightModeli */ { 12, 0 }, /* LightModeliv */ { 8, __glXLightModelivReqSize }, /* LineStipple */ { 12, 0 }, /* LineWidth */ { 8, 0 }, /* Materialf */ { 16, 0 }, /* Materialfv */ { 12, __glXMaterialfvReqSize }, /* Materiali */ { 16, 0 }, /* Materialiv */ { 12, __glXMaterialivReqSize }, /* PointSize */ { 8, 0 }, /* PolygonMode */ { 12, 0 }, /* PolygonStipple */ { 152, 0 }, /* Scissor */ { 20, 0 }, /* ShadeModel */ { 8, 0 }, /* TexParameterf */ { 16, 0 }, /* TexParameterfv */ { 12, __glXTexParameterfvReqSize }, /* TexParameteri */ { 16, 0 }, /* TexParameteriv */ { 12, __glXTexParameterivReqSize }, /* TexImage1D */ { 56, __glXTexImage1DReqSize }, /* TexImage2D */ { 56, __glXTexImage2DReqSize }, /* TexEnvf */ { 16, 0 }, /* TexEnvfv */ { 12, __glXTexEnvfvReqSize }, /* TexEnvi */ { 16, 0 }, /* TexEnviv */ { 12, __glXTexEnvivReqSize }, /* TexGend */ { 20, 0 }, /* TexGendv */ { 12, __glXTexGendvReqSize }, /* TexGenf */ { 16, 0 }, /* TexGenfv */ { 12, __glXTexGenfvReqSize }, /* TexGeni */ { 16, 0 }, /* TexGeniv */ { 12, __glXTexGenivReqSize }, /* InitNames */ { 4, 0 }, /* LoadName */ { 8, 0 }, /* PassThrough */ { 8, 0 }, /* PopName */ { 4, 0 }, /* PushName */ { 8, 0 }, /* DrawBuffer */ { 8, 0 }, /* Clear */ { 8, 0 }, /* ClearAccum */ { 20, 0 }, /* ClearIndex */ { 8, 0 }, /* ClearColor */ { 20, 0 }, /* ClearStencil */ { 8, 0 }, /* ClearDepth */ { 12, 0 }, /* StencilMask */ { 8, 0 }, /* ColorMask */ { 8, 0 }, /* DepthMask */ { 8, 0 }, /* IndexMask */ { 8, 0 }, /* Accum */ { 12, 0 }, /* Disable */ { 8, 0 }, /* Enable */ { 8, 0 }, /* no such opcode */ { 0, 0 }, /* PopAttrib */ { 4, 0 }, /* PushAttrib */ { 8, 0 }, /* Map1d */ { 28, __glXMap1dReqSize }, /* Map1f */ { 20, __glXMap1fReqSize }, /* Map2d */ { 48, __glXMap2dReqSize }, /* Map2f */ { 32, __glXMap2fReqSize }, /* MapGrid1d */ { 24, 0 }, /* MapGrid1f */ { 16, 0 }, /* MapGrid2d */ { 44, 0 }, /* MapGrid2f */ { 28, 0 }, /* EvalCoord1dv */ { 12, 0 }, /* EvalCoord1fv */ { 8, 0 }, /* EvalCoord2dv */ { 20, 0 }, /* EvalCoord2fv */ { 12, 0 }, /* EvalMesh1 */ { 16, 0 }, /* EvalPoint1 */ { 8, 0 }, /* EvalMesh2 */ { 24, 0 }, /* EvalPoint2 */ { 12, 0 }, /* AlphaFunc */ { 12, 0 }, /* BlendFunc */ { 12, 0 }, /* LogicOp */ { 8, 0 }, /* StencilFunc */ { 16, 0 }, /* StencilOp */ { 16, 0 }, /* DepthFunc */ { 8, 0 }, /* PixelZoom */ { 12, 0 }, /* PixelTransferf */ { 12, 0 }, /* PixelTransferi */ { 12, 0 }, /* PixelMapfv */ { 12, __glXPixelMapfvReqSize }, /* PixelMapuiv */ { 12, __glXPixelMapuivReqSize }, /* PixelMapusv */ { 12, __glXPixelMapusvReqSize }, /* ReadBuffer */ { 8, 0 }, /* CopyPixels */ { 24, 0 }, /* DrawPixels */ { 40, __glXDrawPixelsReqSize }, /* DepthRange */ { 20, 0 }, /* Frustum */ { 52, 0 }, /* LoadIdentity */ { 4, 0 }, /* LoadMatrixf */ { 68, 0 }, /* LoadMatrixd */ { 132, 0 }, /* MatrixMode */ { 8, 0 }, /* MultMatrixf */ { 68, 0 }, /* MultMatrixd */ { 132, 0 }, /* Ortho */ { 52, 0 }, /* PopMatrix */ { 4, 0 }, /* PushMatrix */ { 4, 0 }, /* Rotated */ { 36, 0 }, /* Rotatef */ { 20, 0 }, /* Scaled */ { 28, 0 }, /* Scalef */ { 16, 0 }, /* Translated */ { 28, 0 }, /* Translatef */ { 16, 0 }, /* Viewport */ { 20, 0 }, /* PolygonOffset */ { 12, 0 }, /* DrawArrays */ { 16, __glXDrawArraysSize }, /* Indexubv */ { 8, 0 }, /* ColorSubTable */ { 44, __glXColorSubTableReqSize }, /* CopyColorSubTable */ { 24, 0 }, /* ActiveTextureARB */ { 8, 0 }, /* MultiTexCoord1dvARB */ { 16, 0 }, /* MultiTexCoord1fvARB */ { 12, 0 }, /* MultiTexCoord1ivARB */ { 12, 0 }, /* MultiTexCoord1svARB */ { 12, 0 }, /* MultiTexCoord2dvARB */ { 24, 0 }, /* MultiTexCoord2fvARB */ { 16, 0 }, /* MultiTexCoord2ivARB */ { 16, 0 }, /* MultiTexCoord2svARB */ { 12, 0 }, /* MultiTexCoord3dvARB */ { 32, 0 }, /* MultiTexCoord3fvARB */ { 20, 0 }, /* MultiTexCoord3ivARB */ { 20, 0 }, /* MultiTexCoord3svARB */ { 16, 0 }, /* MultiTexCoord4dvARB */ { 40, 0 }, /* MultiTexCoord4fvARB */ { 24, 0 }, /* MultiTexCoord4ivARB */ { 24, 0 }, /* MultiTexCoord4svARB 213 */ { 16, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode 220 */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* WindowPos3fARB 230 */ { 16, 0 }, }; __GLXrenderSizeData __glXRenderSizeTable_EXT[__GLX_MAX_RENDER_OPCODE_EXT - __GLX_MIN_RENDER_OPCODE_EXT + 1] = { /* ColorTable 2053 */ { 44, __glXColorTableReqSize }, /* ColorTableParameterfv */ { 12, __glXColorTableParameterfvReqSize }, /* ColorTableParameteriv */ { 12, __glXColorTableParameterivReqSize }, /* CopyColorTable */ { 24, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* PointParameterfARB 2065 */ { 12, 0 }, /* PointParameterfvARB 2066 */ { 8, __glXPointParameterfvARBReqSize }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* BlendColor */ { 20, 0 }, /* BlendEquation */ { 8, 0 }, /* no such opcode */ { 0, 0 }, /* TexSubImage1D */ { 60, __glXTexSubImage1DReqSize }, /* TexSubImage2D */ { 60, __glXTexSubImage2DReqSize }, /* ConvolutionFilter1D */ { 48, __glXConvolutionFilter1DReqSize }, /* ConvolutionFilter2D */ { 48, __glXConvolutionFilter2DReqSize }, /* ConvolutionParameterf */ { 16, 0 }, /* ConvolutionParameterfv */ { 12, __glXConvolutionParameterfvReqSize }, /* ConvolutionParameteri */ { 16, 0 }, /* ConvolutionParameteriv */ { 12, __glXConvolutionParameterivReqSize }, /* CopyConvolutionFilter1D */ { 24, }, /* CopyConvolutionFilter2D */ { 28, }, /* SeparableFilter2D */ { 48, __glXSeparableFilter2DReqSize }, /* Histogram */ { 20, }, /* Minmax */ { 16, }, /* ResetHistogram */ { 8, }, /* ResetMinmax */ { 8, }, /* TexImage3D */ { 84, __glXTexImage3DReqSize }, /* TexSubImage3D */ { 92, __glXTexSubImage3DReqSize }, /* DrawArrays */ { 16, __glXDrawArraysSize }, /* BindTexture */ { 12, 0 }, /* PrioritizeTextures */ { 8, __glXPrioritizeTexturesReqSize }, /* CopyTexImage1D */ { 32, 0 }, /* CopyTexImage2D */ { 36, 0 }, /* CopyTexSubImage1D */ { 28, 0 }, /* CopyTexSubImage2D */ { 36, 0 }, /* CopyTexSubImage3D 4123 */ { 40, 0 }, /* FogCoordfv 4124 */ { 8, 0 }, /* FogCoorddv 4125 */ { 12, 0 }, /* SecondaryColor3bv 4126 */ { 8, 0 }, /* SecondaryColor3sv 4127 */ { 12, 0 }, /* SecondaryColor3iv 4128 */ { 16, 0 }, /* SecondaryColor3fv 4129 */ { 16, 0 }, /* SecondaryColor3dv 4130 */ { 28, 0 }, /* SecondaryColor3ubv 4131 */ { 8, 0 }, /* SecondaryColor3usv 4132 */ { 12, 0 }, /* SecondaryColor3uiv 4133 */ { 16, 0 }, /* BlendFuncSeparate 4134 */ { 20, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* no such opcode */ { 0, 0 }, /* ActiveStencilFaceEXT 4220 */ { 8, 0 }, /* PointParameteri 4221 */ { 12, 0 }, /* PointParameteriv 4222 */ { 8, __glXPointParameterivReqSize }, }; nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/single2.c0000644000000000000000000002571313614532331017406 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "glxserver.h" #include "glxutil.h" #include "glxext.h" #include "unpack.h" #include "g_disptab.h" int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; GLsizei size; GLenum type; __GLXcontext *cx; int error; REQUEST_FIXED_SIZE(xGLXSingleReq, 8); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; size = *(GLsizei *)(pc+0); type = *(GLenum *)(pc+4); if (cx->feedbackBufSize < size) { cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf, (size_t)size * __GLX_SIZE_FLOAT32); if (!cx->feedbackBuf) { cl->client->errorValue = size; return BadAlloc; } cx->feedbackBufSize = size; } glFeedbackBuffer(size, type, cx->feedbackBuf); __GLX_NOTE_UNFLUSHED_CMDS(cx); return Success; } int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; __GLXcontext *cx; GLsizei size; int error; REQUEST_FIXED_SIZE(xGLXSingleReq, 4); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; size = *(GLsizei *)(pc+0); if (cx->selectBufSize < size) { cx->selectBuf = (GLuint *) realloc(cx->selectBuf, (size_t) size * __GLX_SIZE_CARD32); if (!cx->selectBuf) { cl->client->errorValue = size; return BadAlloc; } cx->selectBufSize = size; } glSelectBuffer(size, cx->selectBuf); __GLX_NOTE_UNFLUSHED_CMDS(cx); return Success; } int __glXDisp_RenderMode(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXRenderModeReply reply; __GLXcontext *cx; GLint nitems=0, retBytes=0, retval, newModeCheck; GLubyte *retBuffer = NULL; GLenum newMode; int error; REQUEST_FIXED_SIZE(xGLXSingleReq, 4); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; newMode = *(GLenum*) pc; retval = glRenderMode(newMode); /* Check that render mode worked */ glGetIntegerv(GL_RENDER_MODE, &newModeCheck); if (newModeCheck != newMode) { /* Render mode change failed. Bail */ newMode = newModeCheck; goto noChangeAllowed; } /* ** Render mode might have still failed if we get here. But in this ** case we can't really tell, nor does it matter. If it did fail, it ** will return 0, and thus we won't send any data across the wire. */ switch (cx->renderMode) { case GL_RENDER: cx->renderMode = newMode; break; case GL_FEEDBACK: if (retval < 0) { /* Overflow happened. Copy the entire buffer */ nitems = cx->feedbackBufSize; } else { nitems = retval; } retBytes = nitems * __GLX_SIZE_FLOAT32; retBuffer = (GLubyte*) cx->feedbackBuf; cx->renderMode = newMode; break; case GL_SELECT: if (retval < 0) { /* Overflow happened. Copy the entire buffer */ nitems = cx->selectBufSize; } else { GLuint *bp = cx->selectBuf; GLint i; /* ** Figure out how many bytes of data need to be sent. Parse ** the selection buffer to determine this fact as the ** return value is the number of hits, not the number of ** items in the buffer. */ nitems = 0; i = retval; while (--i >= 0) { GLuint n; /* Parse select data for this hit */ n = *bp; bp += 3 + n; } nitems = bp - cx->selectBuf; } retBytes = nitems * __GLX_SIZE_CARD32; retBuffer = (GLubyte*) cx->selectBuf; cx->renderMode = newMode; break; } /* ** First reply is the number of elements returned in the feedback or ** selection array, as per the API for glRenderMode itself. */ noChangeAllowed:; reply.length = nitems; reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.retval = retval; reply.size = nitems; reply.newMode = newMode; WriteToClient(client, sz_xGLXRenderModeReply, &reply); if (retBytes) { WriteToClient(client, retBytes, retBuffer); } return Success; } int __glXDisp_Flush(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; __GLXcontext *cx; int error; REQUEST_SIZE_MATCH(xGLXSingleReq); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } glFlush(); __GLX_NOTE_FLUSHED_CMDS(cx); return Success; } int __glXDisp_Finish(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; __GLXcontext *cx; int error; REQUEST_SIZE_MATCH(xGLXSingleReq); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } /* Do a local glFinish */ glFinish(); __GLX_NOTE_FLUSHED_CMDS(cx); /* Send empty reply packet to indicate finish is finished */ __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); return Success; } #define SEPARATOR " " char *__glXcombine_strings(const char *cext_string, const char *sext_string) { size_t clen, slen; char *combo_string, *token, *s1; const char *s2, *end; /* safeguard to prevent potentially fatal errors in the string functions */ if (!cext_string) cext_string = ""; if (!sext_string) sext_string = ""; /* ** String can't be longer than min(cstring, sstring) ** pull tokens out of shortest string ** include space in combo_string for final separator and null terminator */ clen = strlen(cext_string); slen = strlen(sext_string); if (clen > slen) { combo_string = (char *) malloc(slen + 2); s1 = (char *) malloc(slen + 2); strcpy(s1, sext_string); s2 = cext_string; } else { combo_string = (char *) malloc(clen + 2); s1 = (char *) malloc(clen + 2); strcpy(s1, cext_string); s2 = sext_string; } if (!combo_string || !s1) { if (combo_string) free(combo_string); if (s1) free(s1); return NULL; } combo_string[0] = '\0'; /* Get first extension token */ token = strtok( s1, SEPARATOR); while ( token != NULL ) { /* ** if token in second string then save it ** beware of extension names which are prefixes of other extension names */ const char *p = s2; end = p + strlen(p); while (p < end) { size_t n = strcspn(p, SEPARATOR); if ((strlen(token) == n) && (strncmp(token, p, n) == 0)) { combo_string = strcat(combo_string, token); combo_string = strcat(combo_string, SEPARATOR); } p += (n + 1); } /* Get next extension token */ token = strtok( NULL, SEPARATOR); } free(s1); return combo_string; } int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap) { ClientPtr client = cl->client; __GLXcontext *cx; GLenum name; const char *string; __GLX_DECLARE_SWAP_VARIABLES; int error; char *buf = NULL, *buf1 = NULL; GLint length = 0; REQUEST_FIXED_SIZE(xGLXSingleReq, 4); /* If the client has the opposite byte order, swap the contextTag and * the name. */ if ( need_swap ) { __GLX_SWAP_INT(pc + 4); __GLX_SWAP_INT(pc + __GLX_SINGLE_HDR_SIZE); } cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; name = *(GLenum *)(pc + 0); string = (const char *)glGetString(name); /* ** Restrict extensions to those that are supported by both the ** implementation and the connection. That is, return the ** intersection of client, server, and core extension strings. */ if (name == GL_EXTENSIONS) { buf1 = __glXcombine_strings(string, cl->GLClientextensions); buf = __glXcombine_strings(buf1, cx->pGlxScreen->GLextensions); if (buf1 != NULL) { free(buf1); } string = buf; } else if ( name == GL_VERSION ) { if ( atof( string ) > atof( GLServerVersion ) ) { buf = malloc( strlen( string ) + strlen( GLServerVersion ) + 4 ); if ( buf == NULL ) { string = GLServerVersion; } else { sprintf( buf, "%s (%s)", GLServerVersion, string ); string = buf; } } } if (string) { length = strlen((const char *) string) + 1; } __GLX_BEGIN_REPLY(length); __GLX_PUT_SIZE(length); if ( need_swap ) { __GLX_SWAP_REPLY_SIZE(); __GLX_SWAP_REPLY_HEADER(); } __GLX_SEND_HEADER(); WriteToClient(client, length, string); if (buf != NULL) { free(buf); } return Success; } int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc) { return DoGetString(cl, pc, GL_FALSE); } int __glXDisp_GetClipPlane(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; ClientPtr client = cl->client; int error; GLdouble answer[4]; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __glXClearErrorOccured(); glGetClipPlane(*(GLenum *)(pc + 0), answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(32); __GLX_SEND_HEADER(); __GLX_SEND_DOUBLE_ARRAY(4); } return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/single2swap.c0000644000000000000000000002122013614532331020266 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxutil.h" #include "glxext.h" #include "unpack.h" #include "g_disptab.h" int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; GLsizei size; GLenum type; __GLX_DECLARE_SWAP_VARIABLES; __GLXcontext *cx; int error; REQUEST_FIXED_SIZE(xGLXSingleReq, 8); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc+0); __GLX_SWAP_INT(pc+4); size = *(GLsizei *)(pc+0); type = *(GLenum *)(pc+4); if (cx->feedbackBufSize < size) { cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf, (size_t) size * __GLX_SIZE_FLOAT32); if (!cx->feedbackBuf) { cl->client->errorValue = size; return BadAlloc; } cx->feedbackBufSize = size; } glFeedbackBuffer(size, type, cx->feedbackBuf); __GLX_NOTE_UNFLUSHED_CMDS(cx); return Success; } int __glXDispSwap_SelectBuffer(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; __GLXcontext *cx; GLsizei size; __GLX_DECLARE_SWAP_VARIABLES; int error; REQUEST_FIXED_SIZE(xGLXSingleReq, 4); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc+0); size = *(GLsizei *)(pc+0); if (cx->selectBufSize < size) { cx->selectBuf = (GLuint *) realloc(cx->selectBuf, (size_t) size * __GLX_SIZE_CARD32); if (!cx->selectBuf) { cl->client->errorValue = size; return BadAlloc; } cx->selectBufSize = size; } glSelectBuffer(size, cx->selectBuf); __GLX_NOTE_UNFLUSHED_CMDS(cx); return Success; } int __glXDispSwap_RenderMode(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; __GLXcontext *cx; xGLXRenderModeReply reply; GLint nitems=0, retBytes=0, retval, newModeCheck; GLubyte *retBuffer = NULL; GLenum newMode; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; int error; REQUEST_FIXED_SIZE(xGLXSingleReq, 4); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc); newMode = *(GLenum*) pc; retval = glRenderMode(newMode); /* Check that render mode worked */ glGetIntegerv(GL_RENDER_MODE, &newModeCheck); if (newModeCheck != newMode) { /* Render mode change failed. Bail */ newMode = newModeCheck; goto noChangeAllowed; } /* ** Render mode might have still failed if we get here. But in this ** case we can't really tell, nor does it matter. If it did fail, it ** will return 0, and thus we won't send any data across the wire. */ switch (cx->renderMode) { case GL_RENDER: cx->renderMode = newMode; break; case GL_FEEDBACK: if (retval < 0) { /* Overflow happened. Copy the entire buffer */ nitems = cx->feedbackBufSize; } else { nitems = retval; } retBytes = nitems * __GLX_SIZE_FLOAT32; retBuffer = (GLubyte*) cx->feedbackBuf; __GLX_SWAP_FLOAT_ARRAY((GLbyte *)retBuffer, nitems); cx->renderMode = newMode; break; case GL_SELECT: if (retval < 0) { /* Overflow happened. Copy the entire buffer */ nitems = cx->selectBufSize; } else { GLuint *bp = cx->selectBuf; GLint i; /* ** Figure out how many bytes of data need to be sent. Parse ** the selection buffer to determine this fact as the ** return value is the number of hits, not the number of ** items in the buffer. */ nitems = 0; i = retval; while (--i >= 0) { GLuint n; /* Parse select data for this hit */ n = *bp; bp += 3 + n; } nitems = bp - cx->selectBuf; } retBytes = nitems * __GLX_SIZE_CARD32; retBuffer = (GLubyte*) cx->selectBuf; __GLX_SWAP_INT_ARRAY((GLbyte *)retBuffer, nitems); cx->renderMode = newMode; break; } /* ** First reply is the number of elements returned in the feedback or ** selection array, as per the API for glRenderMode itself. */ noChangeAllowed:; reply.length = nitems; reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.retval = retval; reply.size = nitems; reply.newMode = newMode; __GLX_SWAP_SHORT(&reply.sequenceNumber); __GLX_SWAP_INT(&reply.length); __GLX_SWAP_INT(&reply.retval); __GLX_SWAP_INT(&reply.size); __GLX_SWAP_INT(&reply.newMode); WriteToClient(client, sz_xGLXRenderModeReply, &reply); if (retBytes) { WriteToClient(client, retBytes, retBuffer); } return Success; } int __glXDispSwap_Flush(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; __GLXcontext *cx; int error; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_SIZE_MATCH(xGLXSingleReq); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } glFlush(); __GLX_NOTE_FLUSHED_CMDS(cx); return Success; } int __glXDispSwap_Finish(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; __GLXcontext *cx; int error; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_SIZE_MATCH(xGLXSingleReq); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } /* Do a local glFinish */ glFinish(); __GLX_NOTE_FLUSHED_CMDS(cx); /* Send empty reply packet to indicate finish is finished */ __GLX_BEGIN_REPLY(0); __GLX_PUT_RETVAL(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); return Success; } int __glXDispSwap_GetString(__GLXclientState *cl, GLbyte *pc) { return DoGetString(cl, pc, GL_TRUE); } int __glXDispSwap_GetClipPlane(__GLXclientState *cl, GLbyte *pc) { __GLXcontext *cx; ClientPtr client = cl->client; int error; GLdouble answer[4]; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc + 0); __glXClearErrorOccured(); glGetClipPlane(*(GLenum *)(pc + 0), answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); } else { __GLX_SWAP_DOUBLE_ARRAY((GLbyte *)answer, 4); __GLX_BEGIN_REPLY(32); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); __GLX_SEND_DOUBLE_ARRAY(4); } return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/singlepix.c0000644000000000000000000003263013614532331020041 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxext.h" #include "singlesize.h" #include "unpack.h" #include "g_disptab.h" #include "g_disptab_EXT.h" int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc) { GLsizei width, height; GLenum format, type; GLboolean swapBytes, lsbFirst; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; REQUEST_FIXED_SIZE(xGLXSingleReq, 28); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; width = *(GLsizei *)(pc + 8); height = *(GLsizei *)(pc + 12); format = *(GLenum *)(pc + 16); type = *(GLenum *)(pc + 20); swapBytes = *(GLboolean *)(pc + 24); lsbFirst = *(GLboolean *)(pc + 25); compsize = __glReadPixels_size(format,type,width,height); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); glReadPixels( *(GLint *)(pc + 0), *(GLint *)(pc + 4), *(GLsizei *)(pc + 8), *(GLsizei *)(pc + 12), *(GLenum *)(pc + 16), *(GLenum *)(pc + 20), answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDisp_GetTexImage(__GLXclientState *cl, GLbyte *pc) { GLint level, compsize; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; GLint width=0, height=0, depth=1; REQUEST_FIXED_SIZE(xGLXSingleReq, 20); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; level = *(GLint *)(pc + 4); format = *(GLenum *)(pc + 8); type = *(GLenum *)(pc + 12); target = *(GLenum *)(pc + 0); swapBytes = *(GLboolean *)(pc + 16); glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width); glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height); if ( target == GL_TEXTURE_3D) { glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth); } /* * The three queries above might fail if we're in a state where queries * are illegal, but then width, height, and depth would still be zero anyway. */ compsize = __glGetTexImage_size(target,level,format,type,width,height,depth); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); glGetTexImage( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), *(GLenum *)(pc + 12), answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); ((xGLXGetTexImageReply *)&__glXReply)->width = width; ((xGLXGetTexImageReply *)&__glXReply)->height = height; ((xGLXGetTexImageReply *)&__glXReply)->depth = depth; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDisp_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) { GLboolean lsbFirst; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLubyte answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; lsbFirst = *(GLboolean *)(pc + 0); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,128,1); __glXClearErrorOccured(); glGetPolygonStipple( (GLubyte *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(128); __GLX_SEND_HEADER(); __GLX_SEND_BYTE_ARRAY(128); } return Success; } int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) { GLint compsize, compsize2; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; GLint width=0, height=0; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; format = *(GLenum *)(pc + 4); type = *(GLenum *)(pc + 8); target = *(GLenum *)(pc + 0); swapBytes = *(GLboolean *)(pc + 12); /* target must be SEPARABLE_2D, however I guess we can let the GL barf on this one.... */ glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); /* * The two queries above might fail if we're in a state where queries * are illegal, but then width and height would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,1,1); compsize2 = __glGetTexImage_size(target,1,format,type,height,1,1); if ((compsize = safe_pad(compsize)) < 0) return BadLength; if ((compsize2 = safe_pad(compsize2)) < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,safe_add(compsize, compsize2),1); __glXClearErrorOccured(); glGetSeparableFilter( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLenum *)(pc + 8), answer, answer + compsize, NULL ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize + compsize2); ((xGLXGetSeparableFilterReply *)&__glXReply)->width = width; ((xGLXGetSeparableFilterReply *)&__glXReply)->height = height; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize + compsize2); } return Success; } int __glXDisp_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) { GLint compsize; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; GLint width=0, height=0; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; format = *(GLenum *)(pc + 4); type = *(GLenum *)(pc + 8); target = *(GLenum *)(pc + 0); swapBytes = *(GLboolean *)(pc + 12); glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); if (target == GL_CONVOLUTION_1D) { height = 1; } else { glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); } /* * The two queries above might fail if we're in a state where queries * are illegal, but then width and height would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,height,1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); glGetConvolutionFilter( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLenum *)(pc + 8), answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); ((xGLXGetConvolutionFilterReply *)&__glXReply)->width = width; ((xGLXGetConvolutionFilterReply *)&__glXReply)->height = height; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDisp_GetHistogram(__GLXclientState *cl, GLbyte *pc) { GLint compsize; GLenum format, type, target; GLboolean swapBytes, reset; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; GLint width=0; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; format = *(GLenum *)(pc + 4); type = *(GLenum *)(pc + 8); target = *(GLenum *)(pc + 0); swapBytes = *(GLboolean *)(pc + 12); reset = *(GLboolean *)(pc + 13); glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH, &width); /* * The one query above might fail if we're in a state where queries * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,1,1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); glGetHistogram( target, reset, format, type, answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); ((xGLXGetHistogramReply *)&__glXReply)->width = width; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDisp_GetMinmax(__GLXclientState *cl, GLbyte *pc) { GLint compsize; GLenum format, type, target; GLboolean swapBytes, reset; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; format = *(GLenum *)(pc + 4); type = *(GLenum *)(pc + 8); target = *(GLenum *)(pc + 0); swapBytes = *(GLboolean *)(pc + 12); reset = *(GLboolean *)(pc + 13); compsize = __glGetTexImage_size(target,1,format,type,2,1,1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); glGetMinmax( target, reset, format, type, answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc) { GLint compsize; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; GLint width=0; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; target = *(GLenum *)(pc + 0); format = *(GLenum *)(pc + 4); type = *(GLenum *)(pc + 8); swapBytes = *(GLboolean *)(pc + 12); glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH, &width); /* * The one query above might fail if we're in a state where queries * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,1,1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); glGetColorTable( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLenum *)(pc + 8), answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); ((xGLXGetColorTableReply *)&__glXReply)->width = width; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/singlepixswap.c0000644000000000000000000003577113614532331020745 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxext.h" #include "singlesize.h" #include "unpack.h" #include "g_disptab.h" #include "g_disptab_EXT.h" int __glXDispSwap_ReadPixels(__GLXclientState *cl, GLbyte *pc) { GLsizei width, height; GLenum format, type; GLboolean swapBytes, lsbFirst; GLint compsize; __GLX_DECLARE_SWAP_VARIABLES; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; REQUEST_FIXED_SIZE(xGLXSingleReq, 28); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc+0); __GLX_SWAP_INT(pc+4); __GLX_SWAP_INT(pc+8); __GLX_SWAP_INT(pc+12); __GLX_SWAP_INT(pc+16); __GLX_SWAP_INT(pc+20); width = *(GLsizei *)(pc + 8); height = *(GLsizei *)(pc + 12); format = *(GLenum *)(pc + 16); type = *(GLenum *)(pc + 20); swapBytes = *(GLboolean *)(pc + 24); lsbFirst = *(GLboolean *)(pc + 25); compsize = __glReadPixels_size(format,type,width,height); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); glReadPixels( *(GLint *)(pc + 0), *(GLint *)(pc + 4), *(GLsizei *)(pc + 8), *(GLsizei *)(pc + 12), *(GLenum *)(pc + 16), *(GLenum *)(pc + 20), answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc) { GLint level, compsize; GLenum format, type, target; GLboolean swapBytes; __GLX_DECLARE_SWAP_VARIABLES; __GLXcontext *cx; ClientPtr client = cl->client; int error; char *answer, answerBuffer[200]; GLint width=0, height=0, depth=1; REQUEST_FIXED_SIZE(xGLXSingleReq, 24); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc+0); __GLX_SWAP_INT(pc+4); __GLX_SWAP_INT(pc+8); __GLX_SWAP_INT(pc+12); level = *(GLint *)(pc + 4); format = *(GLenum *)(pc + 8); type = *(GLenum *)(pc + 12); target = *(GLenum *)(pc + 0); swapBytes = *(GLboolean *)(pc + 16); glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width); glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height); if ( target == GL_TEXTURE_3D) { glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, &depth); } /* * The three queries above might fail if we're in a state where queries * are illegal, but then width, height, and depth would still be zero anyway. */ compsize = __glGetTexImage_size(target,level,format,type,width,height,depth); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); glGetTexImage( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), *(GLenum *)(pc + 12), answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); __GLX_SWAP_INT(&height); __GLX_SWAP_INT(&depth); ((xGLXGetTexImageReply *)&__glXReply)->width = width; ((xGLXGetTexImageReply *)&__glXReply)->height = height; ((xGLXGetTexImageReply *)&__glXReply)->depth = depth; __GLX_SEND_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDispSwap_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc) { GLboolean lsbFirst; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLubyte answerBuffer[200]; char *answer; __GLX_DECLARE_SWAP_VARIABLES; REQUEST_FIXED_SIZE(xGLXSingleReq, 4); __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; lsbFirst = *(GLboolean *)(pc + 0); glPixelStorei(GL_PACK_LSB_FIRST, lsbFirst); __GLX_GET_ANSWER_BUFFER(answer,cl,128,1); __glXClearErrorOccured(); glGetPolygonStipple( (GLubyte *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(128); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_HEADER(); __GLX_SEND_BYTE_ARRAY(128); } return Success; } int __glXDispSwap_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) { GLint compsize, compsize2; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; char *answer, answerBuffer[200]; GLint width=0, height=0; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc+0); __GLX_SWAP_INT(pc+4); __GLX_SWAP_INT(pc+8); format = *(GLenum *)(pc + 4); type = *(GLenum *)(pc + 8); target = *(GLenum *)(pc + 0); swapBytes = *(GLboolean *)(pc + 12); /* target must be SEPARABLE_2D, however I guess we can let the GL barf on this one.... */ glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); /* * The two queries above might fail if we're in a state where queries * are illegal, but then width and height would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,1,1); compsize2 = __glGetTexImage_size(target,1,format,type,height,1,1); if ((compsize = safe_pad(compsize)) < 0) return BadLength; if ((compsize2 = safe_pad(compsize2)) < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,safe_add(compsize, compsize2),1); __glXClearErrorOccured(); glGetSeparableFilter( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLenum *)(pc + 8), answer, answer + compsize, NULL ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); } else { __GLX_BEGIN_REPLY(compsize + compsize2); __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); __GLX_SWAP_INT(&height); ((xGLXGetSeparableFilterReply *)&__glXReply)->width = width; ((xGLXGetSeparableFilterReply *)&__glXReply)->height = height; __GLX_SEND_VOID_ARRAY(compsize + compsize2); } return Success; } int __glXDispSwap_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) { GLint compsize; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; char *answer, answerBuffer[200]; GLint width=0, height=0; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc+0); __GLX_SWAP_INT(pc+4); __GLX_SWAP_INT(pc+8); format = *(GLenum *)(pc + 4); type = *(GLenum *)(pc + 8); target = *(GLenum *)(pc + 0); swapBytes = *(GLboolean *)(pc + 12); glGetConvolutionParameteriv(target, GL_CONVOLUTION_WIDTH, &width); if (target == GL_CONVOLUTION_2D) { height = 1; } else { glGetConvolutionParameteriv(target, GL_CONVOLUTION_HEIGHT, &height); } /* * The two queries above might fail if we're in a state where queries * are illegal, but then width and height would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,height,1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); glGetConvolutionFilter( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLenum *)(pc + 8), answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); __GLX_SWAP_INT(&height); ((xGLXGetConvolutionFilterReply *)&__glXReply)->width = width; ((xGLXGetConvolutionFilterReply *)&__glXReply)->height = height; __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDispSwap_GetHistogram(__GLXclientState *cl, GLbyte *pc) { GLint compsize; GLenum format, type, target; GLboolean swapBytes, reset; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; char *answer, answerBuffer[200]; GLint width=0; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc+0); __GLX_SWAP_INT(pc+4); __GLX_SWAP_INT(pc+8); format = *(GLenum *)(pc + 4); type = *(GLenum *)(pc + 8); target = *(GLenum *)(pc + 0); swapBytes = *(GLboolean *)(pc + 12); reset = *(GLboolean *)(pc + 13); glGetHistogramParameteriv(target, GL_HISTOGRAM_WIDTH, &width); /* * The one query above might fail if we're in a state where queries * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,1,1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); glGetHistogram( target, reset, format, type, answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); ((xGLXGetHistogramReply *)&__glXReply)->width = width; __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDispSwap_GetMinmax(__GLXclientState *cl, GLbyte *pc) { GLint compsize; GLenum format, type, target; GLboolean swapBytes, reset; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; char *answer, answerBuffer[200]; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc+0); __GLX_SWAP_INT(pc+4); __GLX_SWAP_INT(pc+8); format = *(GLenum *)(pc + 4); type = *(GLenum *)(pc + 8); target = *(GLenum *)(pc + 0); swapBytes = *(GLboolean *)(pc + 12); reset = *(GLboolean *)(pc + 13); compsize = __glGetTexImage_size(target,1,format,type,2,1,1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); glGetMinmax( target, reset, format, type, answer); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_SEND_VOID_ARRAY(compsize); } return Success; } int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc) { GLint compsize; GLenum format, type, target; GLboolean swapBytes; __GLXcontext *cx; ClientPtr client = cl->client; int error; __GLX_DECLARE_SWAP_VARIABLES; char *answer, answerBuffer[200]; GLint width=0; REQUEST_FIXED_SIZE(xGLXSingleReq, 16); cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; __GLX_SWAP_INT(pc+0); __GLX_SWAP_INT(pc+4); __GLX_SWAP_INT(pc+8); format = *(GLenum *)(pc + 4); type = *(GLenum *)(pc + 8); target = *(GLenum *)(pc + 0); swapBytes = *(GLboolean *)(pc + 12); glGetColorTableParameteriv(target, GL_COLOR_TABLE_WIDTH, &width); /* * The one query above might fail if we're in a state where queries * are illegal, but then width would still be zero anyway. */ compsize = __glGetTexImage_size(target,1,format,type,width,1,1); if (compsize < 0) return BadLength; glPixelStorei(GL_PACK_SWAP_BYTES, !swapBytes); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __glXClearErrorOccured(); glGetColorTable( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), *(GLenum *)(pc + 8), answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_SWAP_REPLY_HEADER(); } else { __GLX_BEGIN_REPLY(compsize); __GLX_SWAP_REPLY_HEADER(); __GLX_SWAP_INT(&width); ((xGLXGetColorTableReply *)&__glXReply)->width = width; __GLX_SEND_VOID_ARRAY(compsize); } return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/singlesize.c0000644000000000000000000007417513614532331020225 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "glxserver.h" #include "singlesize.h" /* ** These routines compute the size of variable-size returned parameters. ** Unlike the similar routines that do the same thing for variable-size ** incoming parameters, the samplegl library itself doesn't use these routines. ** Hence, they are located here, in the GLX extension library. */ GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h) { return __glXImageSize( format, type, 0, w, h, 1, 0, 0, 0, 0, 4 ); } /** * Determine the number of data elements that go with the specified \c pname * to a \c glGetTexEnvfv or \c glGetTexEnviv call. * * \todo * Replace this function with a call to \c __glTexEnvfv_size. Make that there * aren't any values of \c pname that are valid for one but not the other. */ GLint __glGetTexEnvfv_size(GLenum pname) { switch (pname) { case GL_TEXTURE_ENV_MODE: case GL_TEXTURE_LOD_BIAS: case GL_COMBINE_RGB: case GL_COMBINE_ALPHA: case GL_SOURCE0_RGB: case GL_SOURCE1_RGB: case GL_SOURCE2_RGB: case GL_SOURCE0_ALPHA: case GL_SOURCE1_ALPHA: case GL_SOURCE2_ALPHA: case GL_OPERAND0_RGB: case GL_OPERAND1_RGB: case GL_OPERAND2_RGB: case GL_OPERAND0_ALPHA: case GL_OPERAND1_ALPHA: case GL_OPERAND2_ALPHA: case GL_RGB_SCALE: case GL_ALPHA_SCALE: /* GL_ARB_point_sprite / GL_NV_point_sprite */ case GL_COORD_REPLACE_ARB: /* GL_NV_texture_env_combine4 */ case GL_SOURCE3_RGB_NV: case GL_SOURCE3_ALPHA_NV: case GL_OPERAND3_RGB_NV: case GL_OPERAND3_ALPHA_NV: return 1; case GL_TEXTURE_ENV_COLOR: return 4; default: return -1; } } GLint __glGetTexEnviv_size(GLenum pname) { return __glGetTexEnvfv_size(pname); } GLint __glGetTexGenfv_size(GLenum pname) { switch (pname) { case GL_TEXTURE_GEN_MODE: return 1; case GL_OBJECT_PLANE: return 4; case GL_EYE_PLANE: return 4; default: return -1; } } GLint __glGetTexGendv_size(GLenum pname) { return __glGetTexGenfv_size(pname); } GLint __glGetTexGeniv_size(GLenum pname) { return __glGetTexGenfv_size(pname); } GLint __glGetTexParameterfv_size(GLenum pname) { switch (pname) { case GL_TEXTURE_BORDER_COLOR: return 4; case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: case GL_TEXTURE_WRAP_R: case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MAG_FILTER: case GL_TEXTURE_PRIORITY: case GL_TEXTURE_RESIDENT: /* GL_SGIS_texture_lod / GL_EXT_texture_lod / GL 1.2 */ case GL_TEXTURE_MIN_LOD: case GL_TEXTURE_MAX_LOD: case GL_TEXTURE_BASE_LEVEL: case GL_TEXTURE_MAX_LEVEL: /* GL_SGIX_texture_lod_bias */ case GL_TEXTURE_LOD_BIAS_S_SGIX: case GL_TEXTURE_LOD_BIAS_T_SGIX: case GL_TEXTURE_LOD_BIAS_R_SGIX: /* GL_ARB_shadow / GL 1.4 */ case GL_TEXTURE_COMPARE_MODE: case GL_TEXTURE_COMPARE_FUNC: /* GL_SGIS_generate_mipmap / GL 1.4 */ case GL_GENERATE_MIPMAP: /* GL_ARB_depth_texture / GL 1.4 */ case GL_DEPTH_TEXTURE_MODE: /* GL_EXT_texture_lod_bias / GL 1.4 */ case GL_TEXTURE_LOD_BIAS: /* GL_SGIX_shadow_ambient / GL_ARB_shadow_ambient */ case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: /* GL_SGIX_shadow */ case GL_TEXTURE_COMPARE_SGIX: case GL_TEXTURE_COMPARE_OPERATOR_SGIX: /* GL_SGIX_texture_coordinate_clamp */ case GL_TEXTURE_MAX_CLAMP_S_SGIX: case GL_TEXTURE_MAX_CLAMP_T_SGIX: case GL_TEXTURE_MAX_CLAMP_R_SGIX: /* GL_EXT_texture_filter_anisotropic */ case GL_TEXTURE_MAX_ANISOTROPY_EXT: /* GL_NV_texture_expand_normal */ case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV: return 1; default: return -1; } } GLint __glGetTexParameteriv_size(GLenum pname) { return __glGetTexParameterfv_size(pname); } GLint __glGetLightfv_size(GLenum pname) { switch (pname) { case GL_AMBIENT: return 4; case GL_DIFFUSE: return 4; case GL_SPECULAR: return 4; case GL_POSITION: return 4; case GL_SPOT_DIRECTION: return 3; case GL_SPOT_EXPONENT: return 1; case GL_SPOT_CUTOFF: return 1; case GL_CONSTANT_ATTENUATION: return 1; case GL_LINEAR_ATTENUATION: return 1; case GL_QUADRATIC_ATTENUATION: return 1; default: return -1; } } GLint __glGetLightiv_size(GLenum pname) { return __glGetLightfv_size(pname); } GLint __glGetMap_size(GLenum target, GLenum query) { GLint k, order=0, majorMinor[2]; /* ** Assume target and query are both valid. */ switch (target) { case GL_MAP1_COLOR_4: case GL_MAP1_NORMAL: case GL_MAP1_INDEX: case GL_MAP1_TEXTURE_COORD_1: case GL_MAP1_TEXTURE_COORD_2: case GL_MAP1_TEXTURE_COORD_3: case GL_MAP1_TEXTURE_COORD_4: case GL_MAP1_VERTEX_3: case GL_MAP1_VERTEX_4: switch (query) { case GL_COEFF: k = __glMap1d_size(target); glGetMapiv(target, GL_ORDER, &order); /* ** The query above might fail, but then order will be zero anyway. */ return (order * k); case GL_DOMAIN: return 2; case GL_ORDER: return 1; } break; case GL_MAP2_COLOR_4: case GL_MAP2_NORMAL: case GL_MAP2_INDEX: case GL_MAP2_TEXTURE_COORD_1: case GL_MAP2_TEXTURE_COORD_2: case GL_MAP2_TEXTURE_COORD_3: case GL_MAP2_TEXTURE_COORD_4: case GL_MAP2_VERTEX_3: case GL_MAP2_VERTEX_4: switch (query) { case GL_COEFF: k = __glMap2d_size(target); majorMinor[0] = majorMinor[1] = 0; glGetMapiv(target, GL_ORDER, majorMinor); /* ** The query above might fail, but then majorMinor will be zeroes */ return (majorMinor[0] * majorMinor[1] * k); case GL_DOMAIN: return 4; case GL_ORDER: return 2; } break; } return -1; } GLint __glGetMapdv_size(GLenum target, GLenum query) { return __glGetMap_size(target, query); } GLint __glGetMapfv_size(GLenum target, GLenum query) { return __glGetMap_size(target, query); } GLint __glGetMapiv_size(GLenum target, GLenum query) { return __glGetMap_size(target, query); } GLint __glGetMaterialfv_size(GLenum pname) { switch (pname) { case GL_SHININESS: return 1; case GL_COLOR_INDEXES: return 3; case GL_EMISSION: return 4; case GL_AMBIENT: return 4; case GL_DIFFUSE: return 4; case GL_SPECULAR: return 4; case GL_AMBIENT_AND_DIFFUSE: return 4; default: return -1; } } GLint __glGetMaterialiv_size(GLenum pname) { return __glGetMaterialfv_size(pname); } GLint __glGetPixelMap_size(GLenum map) { GLint size; GLenum query; switch (map) { case GL_PIXEL_MAP_I_TO_I: query = GL_PIXEL_MAP_I_TO_I_SIZE; break; case GL_PIXEL_MAP_S_TO_S: query = GL_PIXEL_MAP_S_TO_S_SIZE; break; case GL_PIXEL_MAP_I_TO_R: query = GL_PIXEL_MAP_I_TO_R_SIZE; break; case GL_PIXEL_MAP_I_TO_G: query = GL_PIXEL_MAP_I_TO_G_SIZE; break; case GL_PIXEL_MAP_I_TO_B: query = GL_PIXEL_MAP_I_TO_B_SIZE; break; case GL_PIXEL_MAP_I_TO_A: query = GL_PIXEL_MAP_I_TO_A_SIZE; break; case GL_PIXEL_MAP_R_TO_R: query = GL_PIXEL_MAP_R_TO_R_SIZE; break; case GL_PIXEL_MAP_G_TO_G: query = GL_PIXEL_MAP_G_TO_G_SIZE; break; case GL_PIXEL_MAP_B_TO_B: query = GL_PIXEL_MAP_B_TO_B_SIZE; break; case GL_PIXEL_MAP_A_TO_A: query = GL_PIXEL_MAP_A_TO_A_SIZE; break; default: return -1; } glGetIntegerv(query, &size); return size; } GLint __glGetPixelMapfv_size(GLenum map) { return __glGetPixelMap_size(map); } GLint __glGetPixelMapuiv_size(GLenum map) { return __glGetPixelMap_size(map); } GLint __glGetPixelMapusv_size(GLenum map) { return __glGetPixelMap_size(map); } /* ** Return the number of words needed to pass back the requested ** value. */ GLint __glGet_size(GLenum sq) { switch (sq) { case GL_MAX_TEXTURE_SIZE: return 1; case GL_SUBPIXEL_BITS: return 1; case GL_MAX_LIST_NESTING: return 1; case GL_MAP1_COLOR_4: case GL_MAP1_INDEX: case GL_MAP1_NORMAL: case GL_MAP1_TEXTURE_COORD_1: case GL_MAP1_TEXTURE_COORD_2: case GL_MAP1_TEXTURE_COORD_3: case GL_MAP1_TEXTURE_COORD_4: case GL_MAP1_VERTEX_3: case GL_MAP1_VERTEX_4: return 1; case GL_MAP2_COLOR_4: case GL_MAP2_INDEX: case GL_MAP2_NORMAL: case GL_MAP2_TEXTURE_COORD_1: case GL_MAP2_TEXTURE_COORD_2: case GL_MAP2_TEXTURE_COORD_3: case GL_MAP2_TEXTURE_COORD_4: case GL_MAP2_VERTEX_3: case GL_MAP2_VERTEX_4: return 1; case GL_AUTO_NORMAL: return 1; case GL_CURRENT_COLOR: return 4; case GL_CURRENT_INDEX: return 1; case GL_CURRENT_NORMAL: return 3; case GL_CURRENT_TEXTURE_COORDS: return 4; case GL_CURRENT_RASTER_INDEX: return 1; case GL_CURRENT_RASTER_COLOR: return 4; case GL_CURRENT_RASTER_TEXTURE_COORDS: return 4; case GL_CURRENT_RASTER_POSITION: return 4; case GL_CURRENT_RASTER_POSITION_VALID: return 1; case GL_CURRENT_RASTER_DISTANCE: return 1; case GL_POINT_SIZE: return 1; case GL_POINT_SIZE_RANGE: /* case GL_SMOOTH_POINT_SIZE_RANGE: */ /* alias */ return 2; case GL_POINT_SIZE_GRANULARITY: /* case GL_SMOOTH_POINT_SIZE_GRANULARITY: */ /* alias */ return 1; case GL_ALIASED_POINT_SIZE_RANGE: return 2; case GL_POINT_SMOOTH: return 1; case GL_LINE_SMOOTH: return 1; case GL_LINE_WIDTH: return 1; case GL_LINE_WIDTH_RANGE: /* case GL_SMOOTH_LINE_WIDTH_RANGE: */ /* alias */ return 2; case GL_LINE_WIDTH_GRANULARITY: /* case GL_SMOOTH_LINE_WIDTH_GRANULARITY: */ /* alias */ return 1; case GL_ALIASED_LINE_WIDTH_RANGE: return 2; case GL_LINE_STIPPLE_PATTERN: return 1; case GL_LINE_STIPPLE_REPEAT: return 1; case GL_LINE_STIPPLE: return 1; case GL_POLYGON_MODE: return 2; case GL_POLYGON_SMOOTH: return 1; case GL_POLYGON_STIPPLE: return 1; case GL_EDGE_FLAG: return 1; case GL_CULL_FACE: return 1; case GL_CULL_FACE_MODE: return 1; case GL_FRONT_FACE: return 1; case GL_LIGHTING: return 1; case GL_LIGHT_MODEL_LOCAL_VIEWER: return 1; case GL_LIGHT_MODEL_TWO_SIDE: return 1; case GL_LIGHT_MODEL_AMBIENT: return 4; case GL_LIGHT_MODEL_COLOR_CONTROL: return 1; case GL_COLOR_MATERIAL: return 1; case GL_COLOR_MATERIAL_FACE: return 1; case GL_COLOR_MATERIAL_PARAMETER: return 1; case GL_SHADE_MODEL: return 1; case GL_FOG: return 1; case GL_FOG_INDEX: return 1; case GL_FOG_DENSITY: return 1; case GL_FOG_START: return 1; case GL_FOG_END: return 1; case GL_FOG_MODE: return 1; case GL_FOG_COLOR: return 4; case GL_DEPTH_RANGE: return 2; case GL_DEPTH_TEST: return 1; case GL_DEPTH_WRITEMASK: return 1; case GL_DEPTH_CLEAR_VALUE: return 1; case GL_DEPTH_FUNC: return 1; case GL_ACCUM_CLEAR_VALUE: return 4; case GL_STENCIL_TEST: return 1; case GL_STENCIL_CLEAR_VALUE: return 1; case GL_STENCIL_FUNC: return 1; case GL_STENCIL_VALUE_MASK: return 1; case GL_STENCIL_FAIL: return 1; case GL_STENCIL_PASS_DEPTH_FAIL: return 1; case GL_STENCIL_PASS_DEPTH_PASS: return 1; case GL_STENCIL_REF: return 1; case GL_STENCIL_WRITEMASK: return 1; case GL_MATRIX_MODE: return 1; case GL_NORMALIZE: return 1; case GL_VIEWPORT: return 4; case GL_ATTRIB_STACK_DEPTH: return 1; case GL_MODELVIEW_STACK_DEPTH: return 1; case GL_PROJECTION_STACK_DEPTH: return 1; case GL_TEXTURE_STACK_DEPTH: return 1; case GL_MODELVIEW_MATRIX: return 16; case GL_PROJECTION_MATRIX: return 16; case GL_TEXTURE_MATRIX: return 16; case GL_ALPHA_TEST: return 1; case GL_ALPHA_TEST_FUNC: return 1; case GL_ALPHA_TEST_REF: return 1; case GL_DITHER: return 1; case GL_BLEND_DST: return 1; case GL_BLEND_SRC: return 1; case GL_BLEND: return 1; case GL_LOGIC_OP_MODE: return 1; case GL_LOGIC_OP: return 1; case GL_DRAW_BUFFER: return 1; case GL_READ_BUFFER: return 1; case GL_SCISSOR_TEST: return 1; case GL_SCISSOR_BOX: return 4; case GL_INDEX_CLEAR_VALUE: return 1; case GL_INDEX_MODE: return 1; case GL_INDEX_WRITEMASK: return 1; case GL_COLOR_CLEAR_VALUE: return 4; case GL_RGBA_MODE: return 1; case GL_COLOR_WRITEMASK: return 4; case GL_RENDER_MODE: return 1; case GL_PERSPECTIVE_CORRECTION_HINT: return 1; case GL_POINT_SMOOTH_HINT: return 1; case GL_LINE_SMOOTH_HINT: return 1; case GL_POLYGON_SMOOTH_HINT: return 1; case GL_FOG_HINT: return 1; case GL_LIST_BASE: return 1; case GL_LIST_INDEX: return 1; case GL_LIST_MODE: return 1; case GL_TEXTURE_GEN_S: return 1; case GL_TEXTURE_GEN_T: return 1; case GL_TEXTURE_GEN_R: return 1; case GL_TEXTURE_GEN_Q: return 1; case GL_PACK_SWAP_BYTES: return 1; case GL_PACK_LSB_FIRST: return 1; case GL_PACK_ROW_LENGTH: return 1; case GL_PACK_IMAGE_HEIGHT: return 1; case GL_PACK_SKIP_ROWS: return 1; case GL_PACK_SKIP_PIXELS: return 1; case GL_PACK_SKIP_IMAGES: return 1; case GL_PACK_ALIGNMENT: return 1; case GL_UNPACK_SWAP_BYTES: return 1; case GL_UNPACK_LSB_FIRST: return 1; case GL_UNPACK_ROW_LENGTH: return 1; case GL_UNPACK_IMAGE_HEIGHT: return 1; case GL_UNPACK_SKIP_ROWS: return 1; case GL_UNPACK_SKIP_PIXELS: return 1; case GL_UNPACK_SKIP_IMAGES: return 1; case GL_UNPACK_ALIGNMENT: return 1; case GL_MAP_COLOR: return 1; case GL_MAP_STENCIL: return 1; case GL_INDEX_SHIFT: return 1; case GL_INDEX_OFFSET: return 1; case GL_RED_SCALE: case GL_GREEN_SCALE: case GL_BLUE_SCALE: case GL_ALPHA_SCALE: case GL_DEPTH_SCALE: return 1; case GL_RED_BIAS: case GL_GREEN_BIAS: case GL_BLUE_BIAS: case GL_ALPHA_BIAS: case GL_DEPTH_BIAS: return 1; case GL_ZOOM_X: case GL_ZOOM_Y: return 1; case GL_PIXEL_MAP_I_TO_I_SIZE: case GL_PIXEL_MAP_S_TO_S_SIZE: case GL_PIXEL_MAP_I_TO_R_SIZE: case GL_PIXEL_MAP_I_TO_G_SIZE: case GL_PIXEL_MAP_I_TO_B_SIZE: case GL_PIXEL_MAP_I_TO_A_SIZE: case GL_PIXEL_MAP_R_TO_R_SIZE: case GL_PIXEL_MAP_G_TO_G_SIZE: case GL_PIXEL_MAP_B_TO_B_SIZE: case GL_PIXEL_MAP_A_TO_A_SIZE: return 1; case GL_MAX_EVAL_ORDER: return 1; case GL_MAX_LIGHTS: return 1; case GL_MAX_CLIP_PLANES: return 1; case GL_MAX_PIXEL_MAP_TABLE: return 1; case GL_MAX_ATTRIB_STACK_DEPTH: return 1; case GL_MAX_MODELVIEW_STACK_DEPTH: return 1; case GL_MAX_NAME_STACK_DEPTH: return 1; case GL_MAX_PROJECTION_STACK_DEPTH: return 1; case GL_MAX_TEXTURE_STACK_DEPTH: return 1; case GL_INDEX_BITS: return 1; case GL_RED_BITS: return 1; case GL_GREEN_BITS: return 1; case GL_BLUE_BITS: return 1; case GL_ALPHA_BITS: return 1; case GL_DEPTH_BITS: return 1; case GL_STENCIL_BITS: return 1; case GL_ACCUM_RED_BITS: case GL_ACCUM_GREEN_BITS: case GL_ACCUM_BLUE_BITS: case GL_ACCUM_ALPHA_BITS: return 1; case GL_MAP1_GRID_DOMAIN: return 2; case GL_MAP1_GRID_SEGMENTS: return 1; case GL_MAP2_GRID_DOMAIN: return 4; case GL_MAP2_GRID_SEGMENTS: return 2; case GL_TEXTURE_1D: case GL_TEXTURE_2D: case GL_TEXTURE_3D: return 1; case GL_NAME_STACK_DEPTH: return 1; case GL_MAX_VIEWPORT_DIMS: return 2; case GL_DOUBLEBUFFER: return 1; case GL_AUX_BUFFERS: return 1; case GL_STEREO: return 1; case GL_CLIP_PLANE0: case GL_CLIP_PLANE1: case GL_CLIP_PLANE2: case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: return 1; case GL_LIGHT0: case GL_LIGHT1: case GL_LIGHT2: case GL_LIGHT3: case GL_LIGHT4: case GL_LIGHT5: case GL_LIGHT6: case GL_LIGHT7: return 1; case GL_VERTEX_ARRAY: case GL_VERTEX_ARRAY_SIZE: case GL_VERTEX_ARRAY_TYPE: case GL_VERTEX_ARRAY_STRIDE: case GL_NORMAL_ARRAY: case GL_NORMAL_ARRAY_TYPE: case GL_NORMAL_ARRAY_STRIDE: case GL_COLOR_ARRAY: case GL_COLOR_ARRAY_SIZE: case GL_COLOR_ARRAY_TYPE: case GL_COLOR_ARRAY_STRIDE: case GL_INDEX_ARRAY: case GL_INDEX_ARRAY_TYPE: case GL_INDEX_ARRAY_STRIDE: case GL_TEXTURE_COORD_ARRAY: case GL_TEXTURE_COORD_ARRAY_SIZE: case GL_TEXTURE_COORD_ARRAY_TYPE: case GL_TEXTURE_COORD_ARRAY_STRIDE: case GL_EDGE_FLAG_ARRAY: case GL_EDGE_FLAG_ARRAY_STRIDE: return 1; case GL_TEXTURE_BINDING_1D: case GL_TEXTURE_BINDING_2D: case GL_TEXTURE_BINDING_3D: return 1; case GL_BLEND_COLOR: return 4; case GL_BLEND_EQUATION: return 1; case GL_COLOR_MATRIX: return 16; case GL_COLOR_MATRIX_STACK_DEPTH: return 1; case GL_COLOR_TABLE: case GL_POST_CONVOLUTION_COLOR_TABLE: case GL_POST_COLOR_MATRIX_COLOR_TABLE: case GL_CONVOLUTION_1D: case GL_CONVOLUTION_2D: case GL_SEPARABLE_2D: case GL_HISTOGRAM: case GL_MINMAX: return 1; case GL_POLYGON_OFFSET_FACTOR: case GL_POLYGON_OFFSET_UNITS: return 1; case GL_POST_CONVOLUTION_RED_SCALE: case GL_POST_CONVOLUTION_GREEN_SCALE: case GL_POST_CONVOLUTION_BLUE_SCALE: case GL_POST_CONVOLUTION_ALPHA_SCALE: case GL_POST_CONVOLUTION_RED_BIAS: case GL_POST_CONVOLUTION_GREEN_BIAS: case GL_POST_CONVOLUTION_BLUE_BIAS: case GL_POST_CONVOLUTION_ALPHA_BIAS: return 1; case GL_POST_COLOR_MATRIX_RED_SCALE: case GL_POST_COLOR_MATRIX_GREEN_SCALE: case GL_POST_COLOR_MATRIX_BLUE_SCALE: case GL_POST_COLOR_MATRIX_ALPHA_SCALE: case GL_POST_COLOR_MATRIX_RED_BIAS: case GL_POST_COLOR_MATRIX_GREEN_BIAS: case GL_POST_COLOR_MATRIX_BLUE_BIAS: case GL_POST_COLOR_MATRIX_ALPHA_BIAS: return 1; case GL_RESCALE_NORMAL: return 1; case GL_MAX_ELEMENTS_INDICES: case GL_MAX_ELEMENTS_VERTICES: return 1; case GL_ACTIVE_TEXTURE_ARB: case GL_CLIENT_ACTIVE_TEXTURE_ARB: case GL_MAX_TEXTURE_UNITS_ARB: return 1; case GL_MAX_COLOR_MATRIX_STACK_DEPTH: case GL_MAX_CONVOLUTION_WIDTH: case GL_MAX_CONVOLUTION_HEIGHT: return 1; case GL_OCCLUSION_TEST_RESULT_HP: case GL_OCCLUSION_TEST_HP: return 1; case GL_PACK_INVERT_MESA: return 1; case GL_CULL_VERTEX_IBM: return 1; case GL_RASTER_POSITION_UNCLIPPED_IBM: return 1; /* GL_ARB_texture_cube_map / GL 1.3 */ case GL_TEXTURE_CUBE_MAP: case GL_TEXTURE_BINDING_CUBE_MAP: case GL_MAX_CUBE_MAP_TEXTURE_SIZE: /* GL_ARB_multisample / GL 1.3 */ case GL_MULTISAMPLE: case GL_SAMPLE_ALPHA_TO_COVERAGE: case GL_SAMPLE_ALPHA_TO_ONE: case GL_SAMPLE_COVERAGE: case GL_SAMPLE_BUFFERS: case GL_SAMPLES: case GL_SAMPLE_COVERAGE_VALUE: case GL_SAMPLE_COVERAGE_INVERT: /* GL_ARB_texture_comrpession / GL 1.3 */ case GL_TEXTURE_COMPRESSION_HINT: case GL_NUM_COMPRESSED_TEXTURE_FORMATS: /* GL_EXT_blend_func_separate / GL 1.4 */ case GL_BLEND_DST_RGB: case GL_BLEND_SRC_RGB: case GL_BLEND_DST_ALPHA: case GL_BLEND_SRC_ALPHA: /* GL_EXT_fog_coord / GL 1.4 */ case GL_CURRENT_FOG_COORD: case GL_FOG_COORD_ARRAY_TYPE: case GL_FOG_COORD_ARRAY_STRIDE: case GL_FOG_COORD_ARRAY: case GL_FOG_COORD_SRC: /* GL_EXT_secondary_color / GL 1.4 */ case GL_COLOR_SUM: case GL_SECONDARY_COLOR_ARRAY_SIZE: case GL_SECONDARY_COLOR_ARRAY_TYPE: case GL_SECONDARY_COLOR_ARRAY_STRIDE: case GL_SECONDARY_COLOR_ARRAY: /* GL_EXT_texture_lod_bias / GL 1.4 */ case GL_MAX_TEXTURE_LOD_BIAS: /* GL_ARB_point_sprite */ case GL_POINT_SPRITE_ARB: /* GL_ARB_vertex_blend */ case GL_MAX_VERTEX_UNITS_ARB: case GL_ACTIVE_VERTEX_UNITS_ARB: case GL_WEIGHT_SUM_UNITY_ARB: case GL_VERTEX_BLEND_ARB: case GL_CURRENT_WEIGHT_ARB: case GL_WEIGHT_ARRAY_ARB: case GL_WEIGHT_ARRAY_TYPE_ARB: case GL_WEIGHT_ARRAY_STRIDE_ARB: case GL_WEIGHT_ARRAY_SIZE_ARB: /* GL_ARB_matrix_palette */ case GL_MATRIX_PALETTE_ARB: case GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB: case GL_MAX_PALETTE_MATRICES_ARB: case GL_CURRENT_PALETTE_MATRIX_ARB: case GL_CURRENT_MATRIX_INDEX_ARB: case GL_MATRIX_INDEX_ARRAY_ARB: case GL_MATRIX_INDEX_ARRAY_SIZE_ARB: case GL_MATRIX_INDEX_ARRAY_TYPE_ARB: case GL_MATRIX_INDEX_ARRAY_STRIDE_ARB: /* GL_EXT_clip_volume_hint */ case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: /* GL_EXT_depth_bounds_test */ case GL_DEPTH_BOUNDS_TEST_EXT: /* GL_EXT_stencil_two_size */ case GL_STENCIL_TEST_TWO_SIDE_EXT: case GL_ACTIVE_STENCIL_FACE_EXT: /* GL_EXT_vertex_weighting */ case GL_VERTEX_WEIGHTING_EXT: case GL_MODELVIEW0_EXT: case GL_MODELVIEW1_EXT: case GL_CURRENT_VERTEX_WEIGHT_EXT: case GL_VERTEX_WEIGHT_ARRAY_EXT: case GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT: case GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT: case GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT: /* case GL_MODELVIEW0_STACK_DEPTH_EXT: */ /* alias */ case GL_MODELVIEW1_STACK_DEPTH_EXT: /* GL_EXT_blend_equation_separate */ /* case GL_BLEND_EQUATION_RGB_EXT: */ /* alias */ case GL_BLEND_EQUATION_ALPHA_EXT: /* GL_ATI_vertex_streams */ case GL_MAX_VERTEX_STREAMS_ATI: /* GL_ATI_draw_buffers */ case GL_MAX_DRAW_BUFFERS_ATI: case GL_DRAW_BUFFER0_ATI: case GL_DRAW_BUFFER1_ATI: case GL_DRAW_BUFFER2_ATI: case GL_DRAW_BUFFER3_ATI: case GL_DRAW_BUFFER4_ATI: case GL_DRAW_BUFFER5_ATI: case GL_DRAW_BUFFER6_ATI: case GL_DRAW_BUFFER7_ATI: case GL_DRAW_BUFFER8_ATI: case GL_DRAW_BUFFER9_ATI: case GL_DRAW_BUFFER10_ATI: case GL_DRAW_BUFFER11_ATI: case GL_DRAW_BUFFER12_ATI: case GL_DRAW_BUFFER13_ATI: case GL_DRAW_BUFFER14_ATI: case GL_DRAW_BUFFER15_ATI: /* GL_ATI_separate_stencil */ case GL_STENCIL_BACK_FUNC_ATI: case GL_STENCIL_BACK_FAIL_ATI: case GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI: case GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI: /* GL_NV_depth_clamp */ case GL_DEPTH_CLAMP_NV: /* GL_NV_fog_distance */ case GL_FOG_DISTANCE_MODE_NV: /* GL_NV_light_max_exponent */ case GL_MAX_SHININESS_NV: case GL_MAX_SPOT_EXPONENT_NV: /* GL_NV_multisample_filter_hint */ case GL_MULTISAMPLE_FILTER_HINT_NV: /* GL_NV_point_sprite */ /* case GL_POINT_SPRITE_NV: */ /* alias */ case GL_POINT_SPRITE_R_MODE_NV: /* GL_NV_primitive_restart */ case GL_PRIMITIVE_RESTART_NV: case GL_PRIMITIVE_RESTART_INDEX_NV: /* GL_NV_register_combiners */ case GL_REGISTER_COMBINERS_NV: case GL_NUM_GENERAL_COMBINERS_NV: case GL_COLOR_SUM_CLAMP_NV: case GL_MAX_GENERAL_COMBINERS_NV: /* GL_NV_register_combiners2 */ case GL_PER_STAGE_CONSTANTS_NV: /* GL_NV_texture_rectangle */ case GL_TEXTURE_RECTANGLE_NV: case GL_TEXTURE_BINDING_RECTANGLE_NV: case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: return 1; /* GL_EXT_depth_bounds_test */ case GL_DEPTH_BOUNDS_EXT: return 2; /* GL_EXT_secondary_color / GL 1.4 */ case GL_CURRENT_SECONDARY_COLOR: /* GL_NV_register_combiners */ case GL_CONSTANT_COLOR0_NV: case GL_CONSTANT_COLOR1_NV: return 4; /* GL_ARB_vertex_blend */ /* case GL_MODELVIEW0_ARB: */ /* alias */ /* case GL_MODELVIEW1_ARB: */ /* alias */ case GL_MODELVIEW2_ARB: case GL_MODELVIEW3_ARB: case GL_MODELVIEW4_ARB: case GL_MODELVIEW5_ARB: case GL_MODELVIEW6_ARB: case GL_MODELVIEW7_ARB: case GL_MODELVIEW8_ARB: case GL_MODELVIEW9_ARB: case GL_MODELVIEW10_ARB: case GL_MODELVIEW11_ARB: case GL_MODELVIEW12_ARB: case GL_MODELVIEW13_ARB: case GL_MODELVIEW14_ARB: case GL_MODELVIEW15_ARB: case GL_MODELVIEW16_ARB: case GL_MODELVIEW17_ARB: case GL_MODELVIEW18_ARB: case GL_MODELVIEW19_ARB: case GL_MODELVIEW20_ARB: case GL_MODELVIEW21_ARB: case GL_MODELVIEW22_ARB: case GL_MODELVIEW23_ARB: case GL_MODELVIEW24_ARB: case GL_MODELVIEW25_ARB: case GL_MODELVIEW26_ARB: case GL_MODELVIEW27_ARB: case GL_MODELVIEW28_ARB: case GL_MODELVIEW29_ARB: case GL_MODELVIEW30_ARB: case GL_MODELVIEW31_ARB: /* GL_EXT_vertex_weighting */ /* case GL_MODELVIEW0_MATRIX_EXT: */ /* alias */ case GL_MODELVIEW1_MATRIX_EXT: return 32; /* GL_ARB_texture_comrpession / GL 1.3 */ case GL_COMPRESSED_TEXTURE_FORMATS: { GLint temp; glGetIntegerv( GL_NUM_COMPRESSED_TEXTURE_FORMATS, & temp ); return temp; } default: return -1; } } GLint __glGetDoublev_size(GLenum sq) { return __glGet_size(sq); } GLint __glGetFloatv_size(GLenum sq) { return __glGet_size(sq); } GLint __glGetIntegerv_size(GLenum sq) { return __glGet_size(sq); } GLint __glGetBooleanv_size(GLenum sq) { return __glGet_size(sq); } GLint __glGetTexLevelParameterfv_size(GLenum pname) { switch (pname) { case GL_TEXTURE_WIDTH: case GL_TEXTURE_HEIGHT: case GL_TEXTURE_DEPTH: case GL_TEXTURE_COMPONENTS: case GL_TEXTURE_BORDER: case GL_TEXTURE_RED_SIZE: case GL_TEXTURE_GREEN_SIZE: case GL_TEXTURE_BLUE_SIZE: case GL_TEXTURE_ALPHA_SIZE: case GL_TEXTURE_LUMINANCE_SIZE: case GL_TEXTURE_INTENSITY_SIZE: /* GL_ARB_texture_compression / GL 1.3 */ case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: case GL_TEXTURE_COMPRESSED: /* GL_ARB_depth_texture / GL 1.4 */ case GL_TEXTURE_DEPTH_SIZE: return 1; default: return -1; } } GLint __glGetTexLevelParameteriv_size(GLenum pname) { return __glGetTexLevelParameterfv_size(pname); } GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, GLenum type, GLint width, GLint height, GLint depth) { return __glXImageSize( format, type, target, width, height, depth, 0, 0, 0, 0, 4 ); } GLint __glGetConvolutionParameteriv_size(GLenum pname) { switch (pname) { case GL_CONVOLUTION_BORDER_COLOR: case GL_CONVOLUTION_FILTER_SCALE: case GL_CONVOLUTION_FILTER_BIAS: return 4; case GL_CONVOLUTION_BORDER_MODE: case GL_CONVOLUTION_FORMAT: case GL_CONVOLUTION_WIDTH: case GL_CONVOLUTION_HEIGHT: case GL_MAX_CONVOLUTION_WIDTH: case GL_MAX_CONVOLUTION_HEIGHT: return 1; default: return -1; } } GLint __glGetConvolutionParameterfv_size(GLenum pname) { return __glGetConvolutionParameteriv_size(pname); } GLint __glGetHistogramParameterfv_size(GLenum pname) { switch (pname) { case GL_HISTOGRAM_WIDTH: case GL_HISTOGRAM_FORMAT: case GL_HISTOGRAM_RED_SIZE: case GL_HISTOGRAM_GREEN_SIZE: case GL_HISTOGRAM_BLUE_SIZE: case GL_HISTOGRAM_ALPHA_SIZE: case GL_HISTOGRAM_LUMINANCE_SIZE: case GL_HISTOGRAM_SINK: return 1; default: return -1; } } GLint __glGetHistogramParameteriv_size(GLenum pname) { return __glGetHistogramParameterfv_size(pname); } GLint __glGetMinmaxParameterfv_size(GLenum pname) { switch (pname) { case GL_MINMAX_FORMAT: case GL_MINMAX_SINK: return 1; default: return -1; } } GLint __glGetMinmaxParameteriv_size(GLenum pname) { return __glGetMinmaxParameterfv_size(pname); } GLint __glGetColorTableParameterfv_size(GLenum pname) { switch(pname) { case GL_COLOR_TABLE_SCALE: /* return RGBA */ case GL_COLOR_TABLE_BIAS: return 4; case GL_COLOR_TABLE_FORMAT: case GL_COLOR_TABLE_WIDTH: case GL_COLOR_TABLE_RED_SIZE: case GL_COLOR_TABLE_GREEN_SIZE: case GL_COLOR_TABLE_BLUE_SIZE: case GL_COLOR_TABLE_ALPHA_SIZE: case GL_COLOR_TABLE_LUMINANCE_SIZE: case GL_COLOR_TABLE_INTENSITY_SIZE: return 1; default: return 0; } } GLint __glGetColorTableParameteriv_size(GLenum pname) { return __glGetColorTableParameterfv_size(pname); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/singlesize.h0000644000000000000000000000776313614532331020231 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _singlesize_h_ #define _singlesize_h_ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #include "indirect_size.h" extern GLint __glReadPixels_size(GLenum format, GLenum type, GLint width, GLint height); extern GLint __glGetTexEnvfv_size(GLenum pname); extern GLint __glGetTexEnviv_size(GLenum pname); extern GLint __glGetTexGenfv_size(GLenum pname); extern GLint __glGetTexGendv_size(GLenum pname); extern GLint __glGetTexGeniv_size(GLenum pname); extern GLint __glGetTexParameterfv_size(GLenum pname); extern GLint __glGetTexParameteriv_size(GLenum pname); extern GLint __glGetLightfv_size(GLenum pname); extern GLint __glGetLightiv_size(GLenum pname); extern GLint __glGetMap_size(GLenum pname, GLenum query); extern GLint __glGetMapdv_size(GLenum target, GLenum query); extern GLint __glGetMapfv_size(GLenum target, GLenum query); extern GLint __glGetMapiv_size(GLenum target, GLenum query); extern GLint __glGetMaterialfv_size(GLenum pname); extern GLint __glGetMaterialiv_size(GLenum pname); extern GLint __glGetPixelMap_size(GLenum map); extern GLint __glGetPixelMapfv_size(GLenum map); extern GLint __glGetPixelMapuiv_size(GLenum map); extern GLint __glGetPixelMapusv_size(GLenum map); extern GLint __glGet_size(GLenum sq); extern GLint __glGetDoublev_size(GLenum sq); extern GLint __glGetFloatv_size(GLenum sq); extern GLint __glGetIntegerv_size(GLenum sq); extern GLint __glGetBooleanv_size(GLenum sq); extern GLint __glGetTexLevelParameterfv_size(GLenum pname); extern GLint __glGetTexLevelParameteriv_size(GLenum pname); extern GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, GLenum type, GLint width, GLint height, GLint depth); extern GLint __glGetColorTableParameterfv_size(GLenum pname); extern GLint __glGetColorTableParameteriv_size(GLenum pname); extern GLint __glGetConvolutionParameterfv_size(GLenum pname); extern GLint __glGetConvolutionParameteriv_size(GLenum pname); extern GLint __glGetHistogramParameterfv_size(GLenum pname); extern GLint __glGetHistogramParameteriv_size(GLenum pname); extern GLint __glGetMinmaxParameterfv_size(GLenum pname); extern GLint __glGetMinmaxParameteriv_size(GLenum pname); #endif /* _singlesize_h_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/unpack.h0000644000000000000000000001737513614532331017336 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef __GLX_unpack_h__ #define __GLX_unpack_h__ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #define __GLX_PAD(s) (((s)+3) & (GLuint)~3) /* ** Fetch the context-id out of a SingleReq request pointed to by pc. */ #define __GLX_GET_SINGLE_CONTEXT_TAG(pc) (((xGLXSingleReq*)pc)->contextTag) #define __GLX_GET_VENDPRIV_CONTEXT_TAG(pc) (((xGLXVendorPrivateReq*)pc)->contextTag) /* ** Fetch a double from potentially unaligned memory. */ #ifdef __GLX_ALIGN64 #define __GLX_MEM_COPY(dst,src,n) memmove(dst,src,n) #define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8) #else #define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src)) #endif extern void __glXMemInit(void); extern xGLXSingleReply __glXReply; #define __GLX_BEGIN_REPLY(size) \ __glXReply.length = __GLX_PAD(size) >> 2; \ __glXReply.type = X_Reply; \ __glXReply.sequenceNumber = client->sequence; #define __GLX_SEND_HEADER() \ WriteToClient( client, sz_xGLXSingleReply, &__glXReply); #define __GLX_PUT_RETVAL(a) \ __glXReply.retval = (a); #define __GLX_PUT_SIZE(a) \ __glXReply.size = (a); #define __GLX_PUT_RENDERMODE(m) \ __glXReply.pad3 = (m) /* ** Get a buffer to hold returned data, with the given alignment. If we have ** to realloc, allocate size+align, in case the pointer has to be bumped for ** alignment. The answerBuffer should already be aligned. ** ** NOTE: the cast (long)res below assumes a long is large enough to hold a ** pointer. */ #define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \ if (size < 0) return BadLength; \ else if ((size) > sizeof(answerBuffer)) { \ int bump; \ if ((cl)->returnBufSize < (size)+(align)) { \ (cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf, \ (size)+(align)); \ if (!(cl)->returnBuf) { \ return BadAlloc; \ } \ (cl)->returnBufSize = (size)+(align); \ } \ res = (char*)cl->returnBuf; \ bump = (long)(res) % (align); \ if (bump) res += (align) - (bump); \ } else { \ res = (char *)answerBuffer; \ } #define __GLX_PUT_BYTE() \ *(GLbyte *)&__glXReply.pad3 = *(GLbyte *)answer #define __GLX_PUT_SHORT() \ *(GLshort *)&__glXReply.pad3 = *(GLshort *)answer #define __GLX_PUT_INT() \ *(GLint *)&__glXReply.pad3 = *(GLint *)answer #define __GLX_PUT_FLOAT() \ *(GLfloat *)&__glXReply.pad3 = *(GLfloat *)answer #define __GLX_PUT_DOUBLE() \ *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer #define __GLX_SEND_BYTE_ARRAY(len) \ WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), answer) #define __GLX_SEND_SHORT_ARRAY(len) \ WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), answer) #define __GLX_SEND_INT_ARRAY(len) \ WriteToClient(client, (len)*__GLX_SIZE_INT32, answer) #define __GLX_SEND_FLOAT_ARRAY(len) \ WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, answer) #define __GLX_SEND_DOUBLE_ARRAY(len) \ WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, answer) #define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) #define __GLX_SEND_UBYTE_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) #define __GLX_SEND_USHORT_ARRAY(len) __GLX_SEND_SHORT_ARRAY(len) #define __GLX_SEND_UINT_ARRAY(len) __GLX_SEND_INT_ARRAY(len) /* ** PERFORMANCE NOTE: ** Machine dependent optimizations abound here; these swapping macros can ** conceivably be replaced with routines that do the job faster. */ #define __GLX_DECLARE_SWAP_VARIABLES \ GLbyte sw #define __GLX_DECLARE_SWAP_ARRAY_VARIABLES \ GLbyte *swapPC; \ GLbyte *swapEnd #define __GLX_SWAP_INT(pc) \ sw = ((GLbyte *)(pc))[0]; \ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ ((GLbyte *)(pc))[3] = sw; \ sw = ((GLbyte *)(pc))[1]; \ ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \ ((GLbyte *)(pc))[2] = sw; #define __GLX_SWAP_SHORT(pc) \ sw = ((GLbyte *)(pc))[0]; \ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[1]; \ ((GLbyte *)(pc))[1] = sw; #define __GLX_SWAP_DOUBLE(pc) \ sw = ((GLbyte *)(pc))[0]; \ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[7]; \ ((GLbyte *)(pc))[7] = sw; \ sw = ((GLbyte *)(pc))[1]; \ ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[6]; \ ((GLbyte *)(pc))[6] = sw; \ sw = ((GLbyte *)(pc))[2]; \ ((GLbyte *)(pc))[2] = ((GLbyte *)(pc))[5]; \ ((GLbyte *)(pc))[5] = sw; \ sw = ((GLbyte *)(pc))[3]; \ ((GLbyte *)(pc))[3] = ((GLbyte *)(pc))[4]; \ ((GLbyte *)(pc))[4] = sw; #define __GLX_SWAP_FLOAT(pc) \ sw = ((GLbyte *)(pc))[0]; \ ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ ((GLbyte *)(pc))[3] = sw; \ sw = ((GLbyte *)(pc))[1]; \ ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \ ((GLbyte *)(pc))[2] = sw; #define __GLX_SWAP_INT_ARRAY(pc, count) \ swapPC = ((GLbyte *)(pc)); \ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT32;\ while (swapPC < swapEnd) { \ __GLX_SWAP_INT(swapPC); \ swapPC += __GLX_SIZE_INT32; \ } #define __GLX_SWAP_SHORT_ARRAY(pc, count) \ swapPC = ((GLbyte *)(pc)); \ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT16;\ while (swapPC < swapEnd) { \ __GLX_SWAP_SHORT(swapPC); \ swapPC += __GLX_SIZE_INT16; \ } #define __GLX_SWAP_DOUBLE_ARRAY(pc, count) \ swapPC = ((GLbyte *)(pc)); \ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT64;\ while (swapPC < swapEnd) { \ __GLX_SWAP_DOUBLE(swapPC); \ swapPC += __GLX_SIZE_FLOAT64; \ } #define __GLX_SWAP_FLOAT_ARRAY(pc, count) \ swapPC = ((GLbyte *)(pc)); \ swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT32;\ while (swapPC < swapEnd) { \ __GLX_SWAP_FLOAT(swapPC); \ swapPC += __GLX_SIZE_FLOAT32; \ } #define __GLX_SWAP_REPLY_HEADER() \ __GLX_SWAP_SHORT(&__glXReply.sequenceNumber); \ __GLX_SWAP_INT(&__glXReply.length); #define __GLX_SWAP_REPLY_RETVAL() \ __GLX_SWAP_INT(&__glXReply.retval) #define __GLX_SWAP_REPLY_SIZE() \ __GLX_SWAP_INT(&__glXReply.size) #endif /* !__GLX_unpack_h__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/glx/xfont.c0000644000000000000000000001342413614532331017175 0ustar /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X ** Window System(R) (Version 1.3), released October 19, 1998. This software ** was created using the OpenGL(R) version 1.2.1 Sample Implementation ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "glxserver.h" #include "glxutil.h" #include "g_disptab.h" #include #include #include #include #include extern XID clientErrorValue; /* imported kludge from dix layer */ /* ** Make a single GL bitmap from a single X glyph */ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci) { int i, j; int widthPadded; /* width of glyph in bytes, as padded by X */ int allocBytes; /* bytes to allocate to store bitmap */ int w; /* width of glyph in bits */ int h; /* height of glyph */ register unsigned char *pglyph; register unsigned char *p; unsigned char *allocbuf; #define __GL_CHAR_BUF_SIZE 2048 unsigned char buf[__GL_CHAR_BUF_SIZE]; w = GLYPHWIDTHPIXELS(pci); h = GLYPHHEIGHTPIXELS(pci); widthPadded = GLYPHWIDTHBYTESPADDED(pci); /* ** Use the local buf if possible, otherwise malloc. */ allocBytes = widthPadded * h; if (allocBytes <= __GL_CHAR_BUF_SIZE) { p = buf; allocbuf = 0; } else { p = (unsigned char *) malloc(allocBytes); if (!p) return BadAlloc; allocbuf = p; } /* ** We have to reverse the picture, top to bottom */ pglyph = FONTGLYPHBITS(FONTGLYPHS(font), pci) + (h-1)*widthPadded; for (j=0; j < h; j++) { for (i=0; i < widthPadded; i++) { p[i] = pglyph[i]; } pglyph -= widthPadded; p += widthPadded; } glBitmap(w, h, -pci->metrics.leftSideBearing, pci->metrics.descent, pci->metrics.characterWidth, 0, allocbuf ? allocbuf : buf); if (allocbuf) { free(allocbuf); } return Success; #undef __GL_CHAR_BUF_SIZE } /* ** Create a GL bitmap for each character in the X font. The bitmap is stored ** in a display list. */ static int MakeBitmapsFromFont(FontPtr pFont, int first, int count, int list_base) { unsigned long i, nglyphs; CARD8 chs[2]; /* the font index we are going after */ CharInfoPtr pci; int rv; /* return value */ int encoding = (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit; glPixelStorei(GL_UNPACK_SWAP_BYTES, FALSE); glPixelStorei(GL_UNPACK_LSB_FIRST, BITMAP_BIT_ORDER == LSBFirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); glPixelStorei(GL_UNPACK_ALIGNMENT, GLYPHPADBYTES); for (i=0; i < count; i++) { chs[0] = (first + i) >> 8; /* high byte is first byte */ chs[1] = first + i; (*pFont->get_glyphs)(pFont, 1, chs, (FontEncoding)encoding, &nglyphs, &pci); /* ** Define a display list containing just a glBitmap() call. */ glNewList(list_base + i, GL_COMPILE); if (nglyphs ) { rv = __glXMakeBitmapFromGlyph(pFont, pci); if (rv) { return rv; } } glEndList(); } return Success; } /************************************************************************/ int __glXUseXFont(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXUseXFontReq *req; FontPtr pFont; GC *pGC; GLuint currentListIndex; __GLXcontext *cx; int error; req = (xGLXUseXFontReq *) pc; cx = __glXForceCurrent(cl, req->contextTag, &error); if (!cx) { return error; } glGetIntegerv(GL_LIST_INDEX, (GLint*) ¤tListIndex); if (currentListIndex != 0) { /* ** A display list is currently being made. It is an error ** to try to make a font during another lists construction. */ client->errorValue = cx->id; return __glXBadContextState; } /* ** Font can actually be either the ID of a font or the ID of a GC ** containing a font. */ pFont = (FontPtr)LookupIDByType(req->font, RT_FONT); if (!pFont) { pGC = (GC *)LookupIDByType(req->font, RT_GC); if (!pGC) { client->errorValue = req->font; return BadFont; } pFont = pGC->font; } return MakeBitmapsFromFont(pFont, req->first, req->count, req->listBase); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/Imakefile0000644000000000000000000000162213614532331016707 0ustar #define IHaveModules #include #define IHaveSubdirs CORE_SUBDIR = mesa SUBDIRS = glx $(CORE_SUBDIR) #if BuildModuleInSubdir SRCS = glx/module/?*.c $(MSRCS) OBJS = glx/module/?*.o $(MOBJS) #else SRCS = glx/?*.c $(MSRCS) OBJS = glx/?*.o $(MOBJS) #endif DONES = glx/DONE INCLUDES = -Iinclude -I$(SERVERSRC)/include -I$(SERVERSRC)/mi \ -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(XF86OSSRC) DEPEND_DEFINES = $(EXT_DEFINES) DependDefines DEFINES = $(GLX_DEFINES) #if HasParallelMake MakeMutex($(SUBDIRS) $(OBJS) $(DONES)) #endif #if HasGnuMake || HasBsdMake $(DONES): $(SUBDIRS) #endif ModuleObjectRule() DepLibraryModuleTarget(glx,$(SUBDIRS) $(DONES) $(MOBJS),$(OBJS)) InstallLibraryModule(glx,$(MODULEDIR),extensions) ForceSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) MakeLintLibSubdirs($(SUBDIRS)) LintSubdirs($(SUBDIRS)) InstallDriverSDKLibraryModule(glx,$(DRIVERSDKMODULEDIR),extensions) nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/include/GL/glx_ansic.h0000644000000000000000000000014013614532331021135 0ustar /* no-op file to make current Mesa happy */ #ifndef _glx_ansic_h_ #define _glx_ansic_h_ #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/include/GL/xf86glx.h0000644000000000000000000000005413614532331020500 0ustar /* no-op file to make current Mesa happy */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/array_cache/Imakefile0000644000000000000000000000154013614532331022074 0ustar #include #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaACBuildDir /**/ #include "Imakefile.inc" SRCS = $(MESA_AC_SRCS) OBJS = $(MESA_AC_OBJS) INCLUDES = -I$(MESASRCDIR)/src/mesa \ -I$(MESASRCDIR)/src/mesa/array_cache \ -I$(MESASRCDIR)/src/mesa/math \ -I$(MESASRCDIR)/src/mesa/main \ -I$(MESASRCDIR)/src/mesa/glapi \ -I$(MESASRCDIR)/include \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ -I$(LIBSRC)/GL/include \ -I$(XF86SRC) -I$(INCLUDESRC) DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ NormalLibraryObjectRule() SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) DependTarget() #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/array_cache/Imakefile.inc0000644000000000000000000000154713614532331022653 0ustar MESAACBUILDDIR = MesaACBuildDir MESA_AC_SRCS = $(MESAACBUILDDIR)ac_context.c \ $(MESAACBUILDDIR)ac_import.c #ifdef NeedToLinkMesaSrc LinkSourceFile(acache.h, $(MESASRCDIR)/src/mesa/array_cache) LinkSourceFile(ac_context.c, $(MESASRCDIR)/src/mesa/array_cache) LinkSourceFile(ac_context.h, $(MESASRCDIR)/src/mesa/array_cache) LinkSourceFile(ac_import.c, $(MESASRCDIR)/src/mesa/array_cache) #endif MESA_AC_OBJS = $(MESAACBUILDDIR)ac_context.o \ $(MESAACBUILDDIR)ac_import.o #if defined(DoSharedLib) && DoSharedLib MESA_AC_UOBJS = $(MESAACBUILDDIR)unshared/ac_context.o \ $(MESAACBUILDDIR)unshared/ac_import.o #else MESA_AC_UOBJS = $(MESA_AC_OBJS) #endif MESA_AC_DOBJS = $(MESAACBUILDDIR)debugger/ac_context.o \ $(MESAACBUILDDIR)debugger/ac_import.o MESA_AC_POBJS = $(MESAACBUILDDIR)profiled/ac_context.o \ $(MESAACBUILDDIR)profiled/ac_import.o nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/GLcore/Imakefile0000644000000000000000000000300313614532331021002 0ustar #include #define NeedAllMesaSrc #define MesaInXServer #define MesaBuildDir ../main/ #define MesaACBuildDir ../array_cache/ #define MesaMathBuildDir ../math/ #define MesaSwrastBuildDir ../swrast/ #define MesaSwrastSetupBuildDir ../swrast_setup/ #define MesaTnlBuildDir ../tnl/ #define MesaShaderBuildDir ../shader/ #define MesaGrammarBuildDir ../shader/grammar/ #define MesaSlangBuildDir ../shader/slang/ #define MesaXBuildDir ../X/ #include "../array_cache/Imakefile.inc" #include "../swrast/Imakefile.inc" #include "../swrast_setup/Imakefile.inc" #include "../tnl/Imakefile.inc" #include "../main/Imakefile.inc" #include "../math/Imakefile.inc" #include "../shader/Imakefile.inc" #include "../shader/grammar/Imakefile.inc" #include "../shader/slang/Imakefile.inc" #include "../X/Imakefile.inc" #include "../Imakefile.inc" XOBJS = ../X/?*.o OBJS = $(COREMESAOBJS) $(MOBJS) DONES = ../main/DONE ../X/DONE ../array_cache/DONE \ ../math/DONE ../swrast/DONE ../swrast_setup/DONE \ ../tnl/DONE ../shader/DONE ../shader/grammar/DONE \ ../shader/slang/DONE INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \ -I$(MESASRCDIR)/include \ -I$(MESASRCDIR)/src/mesa \ -I$(SERVERSRC)/include DEFINES = $(GLX_DEFINES) NormalDepLibraryTarget(GLcore, $(DONES) $(OBJS), $(OBJS) $(XOBJS)) NormalLibraryObjectRule() InstallDriverSDKLibraryModule(GLcore,$(DRIVERSDKMODULEDIR),extensions) #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/Imakefile0000644000000000000000000000106313614532331017633 0ustar #define IHaveSubdirs SUBDIRS = main math array_cache swrast swrast_setup tnl shader X GLcore $(MODSUBDIR) #include #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaBuildDir /**/ #include "Imakefile.inc" INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \ -I$(MESASRCDIR)/include -I$(GLXLIBSRC)/include \ -I$(MESASRCDIR)/src/mesa \ -I$(SERVERSRC)/include DEFINES = $(GLX_DEFINES) NormalLibraryObjectRule() #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif DependTarget() nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/Imakefile.inc0000644000000000000000000000243413614532331020406 0ustar MESABUILDDIR = MesaBuildDir COREMESASRCS = $(COREMESABASESRCS) \ $(MESA_AC_SRCS) \ $(MESA_MATH_SRCS) \ $(MESA_SWRAST_SRCS) \ $(MESA_SWR_SETUP_SRCS) \ $(MESA_TNL_SRCS) \ $(MESA_SHADER_SRCS) \ $(MESA_GRAMMAR_SRCS) \ $(MESA_SLANG_SRCS) COREMESAOBJS = $(COREMESABASEOBJS) \ $(MESA_AC_OBJS) \ $(MESA_MATH_OBJS) \ $(MESA_SWRAST_OBJS) \ $(MESA_SWR_SETUP_OBJS) \ $(MESA_TNL_OBJS) \ $(MESA_SHADER_OBJS) \ $(MESA_GRAMMAR_OBJS) \ $(MESA_SLANG_OBJS) COREMESAUOBJS = $(COREMESABASEUOBJS) \ $(MESA_AC_UOBJS) \ $(MESA_MATH_UOBJS) \ $(MESA_SWRAST_UOBJS) \ $(MESA_SWR_SETUP_UOBJS) \ $(MESA_TNL_UOBJS) \ $(MESA_SHADER_UOBJS) \ $(MESA_GRAMMAR_UOBJS) \ $(MESA_SLANG_UOBJS) COREMESADOBJS = $(COREMESABASEDOBJS) \ $(MESA_AC_DOBJS) \ $(MESA_MATH_DOBJS) \ $(MESA_SWRAST_DOBJS) \ $(MESA_SWR_SETUP_DOBJS) \ $(MESA_TNL_DOBJS) \ $(MESA_SHADER_DOBJS) \ $(MESA_GRAMMAR_DOBJS) \ $(MESA_SLANG_DOBJS) COREMESAPOBJS = $(COREMESABASEPOBJS) \ $(MESA_AC_POBJS) \ $(MESA_MATH_POBJS) \ $(MESA_SWRAST_POBJS) \ $(MESA_SWR_SETUP_POBJS) \ $(MESA_TNL_POBJS) \ $(MESA_SHADER_POBJS) \ $(MESA_GRAMMAR_POBJS) \ $(MESA_SLANG_POBJS) nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/main/Imakefile0000644000000000000000000000204213614532331020555 0ustar /* Large PIC tables needed for Solaris/SPARC builds */ #if defined(SunArchitecture) && defined(SparcArchitecture) && defined(LargePositionIndependentCFlags) PICFLAGS = LargePositionIndependentCFlags #endif #include #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaBuildDir /**/ #include "Imakefile.inc" SRCS = $(COREMESABASESRCS) OBJS = $(COREMESABASEOBJS) INCLUDES = -I$(MESASRCDIR)/src/mesa \ -I$(MESASRCDIR)/src/mesa/main \ -I$(MESASRCDIR)/src/mesa/shader \ -I$(MESASRCDIR)/src/mesa/glapi \ -I$(MESASRCDIR)/include \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ -I$(LIBSRC)/GL/include \ -I$(XF86SRC) -I$(INCLUDESRC) DEFINES = $(GLX_DEFINES) -DNXAGENT_SERVER /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ NormalLibraryObjectRule() SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) DependTarget() #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/main/Imakefile.inc0000644000000000000000000004476413614532331021346 0ustar /* gcc on ppc64 defines this, causes macro recursion with pixel below */ #undef pixel MESABUILDDIR = MesaBuildDir #ifdef NeedAllMesaSrc DISPATCHSRCS = $(MESABUILDDIR)dispatch.c GLAPISRCS = $(MESABUILDDIR)glapi.c GLTHREADSRCS = $(MESABUILDDIR)glthread.c #endif MESA_CORE_INCLUDES = -I$(MESASRCDIR)/src/array_cache \ -I$(MESASRCDIR)/src/math -I$(MESASRCDIR)/src/shader \ -I$(MESASRCDIR)/src/swrast -I$(MESASRCDIR)/src/swrast_setup \ -I$(MESASRCDIR)/src/tnl -I$(MESASRCDIR)/src/tnl_dd COREMESABASESRCS = \ $(MESABUILDDIR)api_arrayelt.c \ $(MESABUILDDIR)api_loopback.c \ $(MESABUILDDIR)api_noop.c \ $(MESABUILDDIR)api_validate.c \ $(MESABUILDDIR)accum.c \ $(MESABUILDDIR)attrib.c \ $(MESABUILDDIR)blend.c \ $(MESABUILDDIR)bufferobj.c \ $(MESABUILDDIR)buffers.c \ $(MESABUILDDIR)clip.c \ $(MESABUILDDIR)colortab.c \ $(MESABUILDDIR)context.c \ $(MESABUILDDIR)convolve.c \ $(MESABUILDDIR)debug.c \ $(MESABUILDDIR)depth.c \ $(MESABUILDDIR)dlist.c \ $(MESABUILDDIR)drawpix.c \ $(MESABUILDDIR)enable.c \ $(MESABUILDDIR)enums.c \ $(MESABUILDDIR)eval.c \ $(MESABUILDDIR)execmem.c \ $(MESABUILDDIR)extensions.c \ $(MESABUILDDIR)feedback.c \ $(MESABUILDDIR)fbobject.c \ $(MESABUILDDIR)fog.c \ $(MESABUILDDIR)framebuffer.c \ $(MESABUILDDIR)get.c \ $(MESABUILDDIR)getstring.c \ $(MESABUILDDIR)hash.c \ $(MESABUILDDIR)hint.c \ $(MESABUILDDIR)histogram.c \ $(MESABUILDDIR)image.c \ $(MESABUILDDIR)imports.c \ $(MESABUILDDIR)light.c \ $(MESABUILDDIR)lines.c \ $(MESABUILDDIR)matrix.c \ $(MESABUILDDIR)mm.c \ $(MESABUILDDIR)occlude.c \ $(MESABUILDDIR)pixel.c \ $(MESABUILDDIR)points.c \ $(MESABUILDDIR)polygon.c \ $(MESABUILDDIR)rastpos.c \ $(MESABUILDDIR)renderbuffer.c \ $(MESABUILDDIR)state.c \ $(MESABUILDDIR)stencil.c \ $(MESABUILDDIR)texcompress.c \ $(MESABUILDDIR)texcompress_fxt1.c \ $(MESABUILDDIR)texcompress_s3tc.c \ $(MESABUILDDIR)texenvprogram.c \ $(MESABUILDDIR)texformat.c \ $(MESABUILDDIR)teximage.c \ $(MESABUILDDIR)texobj.c \ $(MESABUILDDIR)texrender.c \ $(MESABUILDDIR)texstate.c \ $(MESABUILDDIR)texstore.c \ $(MESABUILDDIR)varray.c \ $(MESABUILDDIR)vtxfmt.c #ifdef NeedToLinkMesaSrc LinkSourceFile(api_arrayelt.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(api_arrayelt.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(api_eval.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(api_loopback.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(api_loopback.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(api_noop.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(api_noop.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(api_validate.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(api_validate.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(accum.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(accum.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(attrib.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(attrib.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(blend.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(blend.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(bufferobj.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(bufferobj.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(buffers.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(buffers.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(clip.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(clip.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(colormac.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(colortab.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(colortab.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(config.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(context.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(context.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(convolve.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(convolve.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(dd.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(debug.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(debug.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(depth.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(depth.h, $(MESASRCDIR)/src/mesa/main) #ifdef NeedAllMesaSrc LinkSourceFile(dispatch.c, $(MESASRCDIR)/src/mesa/main) #endif LinkSourceFile(dlist.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(dlist.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(drawpix.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(drawpix.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(enable.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(enable.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(enums.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(enums.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(eval.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(eval.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(execmem.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(extensions.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(extensions.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(fbobject.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(fbobject.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(feedback.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(feedback.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(fog.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(fog.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(framebuffer.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(framebuffer.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(get.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(get.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(getstring.c, $(MESASRCDIR)/src/mesa/main) #ifdef NeedAllMesaSrc LinkSourceFile(glapi.c, $(MESASRCDIR)/src/mesa/glapi) LinkSourceFile(glthread.c, $(MESASRCDIR)/src/mesa/glapi) #endif LinkSourceFile(glheader.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(hash.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(hash.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(hint.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(hint.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(histogram.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(histogram.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(image.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(image.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(imports.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(imports.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(light.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(light.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(lines.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(lines.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(macros.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(matrix.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(matrix.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(mm.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(mm.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(mtypes.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(occlude.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(occlude.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(pixel.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(pixel.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(points.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(points.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(polygon.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(polygon.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(rastpos.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(rastpos.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(renderbuffer.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(renderbuffer.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(simple_list.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(state.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(state.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(stencil.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(stencil.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texcompress.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texcompress_fxt1.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texcompress_s3tc.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texcompress.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texenvprogram.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texenvprogram.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texformat.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texformat.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texformat_tmp.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(teximage.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(teximage.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texobj.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texobj.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texrender.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texrender.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texstate.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texstate.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texstore.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(texstore.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(varray.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(varray.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(version.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(vtxfmt.c, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(vtxfmt.h, $(MESASRCDIR)/src/mesa/main) LinkSourceFile(vtxfmt_tmp.h, $(MESASRCDIR)/src/mesa/main) #endif #ifdef NeedAllMesaSrc DISPATCHOBJS = $(MESABUILDDIR)dispatch.o GLAPIOBJS = $(MESABUILDDIR)glapi.o GLTHREADOBJS = $(MESABUILDDIR)glthread.o #endif COREMESABASEOBJS = \ $(DISPATCHOBJS) \ $(GLAPIOBJS) \ $(GLTHREADOBJS) \ $(MESABUILDDIR)api_arrayelt.o \ $(MESABUILDDIR)api_loopback.o \ $(MESABUILDDIR)api_noop.o \ $(MESABUILDDIR)api_validate.o \ $(MESABUILDDIR)accum.o \ $(MESABUILDDIR)attrib.o \ $(MESABUILDDIR)blend.o \ $(MESABUILDDIR)bufferobj.o \ $(MESABUILDDIR)buffers.o \ $(MESABUILDDIR)clip.o \ $(MESABUILDDIR)colortab.o \ $(MESABUILDDIR)context.o \ $(MESABUILDDIR)convolve.o \ $(MESABUILDDIR)debug.o \ $(MESABUILDDIR)depth.o \ $(MESABUILDDIR)dlist.o \ $(MESABUILDDIR)drawpix.o \ $(MESABUILDDIR)enable.o \ $(MESABUILDDIR)enums.o \ $(MESABUILDDIR)eval.o \ $(MESABUILDDIR)execmem.o \ $(MESABUILDDIR)extensions.o \ $(MESABUILDDIR)fbobject.o \ $(MESABUILDDIR)feedback.o \ $(MESABUILDDIR)fog.o \ $(MESABUILDDIR)framebuffer.o \ $(MESABUILDDIR)get.o \ $(MESABUILDDIR)getstring.o \ $(MESABUILDDIR)hash.o \ $(MESABUILDDIR)hint.o \ $(MESABUILDDIR)histogram.o \ $(MESABUILDDIR)image.o \ $(MESABUILDDIR)imports.o \ $(MESABUILDDIR)light.o \ $(MESABUILDDIR)lines.o \ $(MESABUILDDIR)matrix.o \ $(MESABUILDDIR)mm.o \ $(MESABUILDDIR)occlude.o \ $(MESABUILDDIR)pixel.o \ $(MESABUILDDIR)points.o \ $(MESABUILDDIR)polygon.o \ $(MESABUILDDIR)rastpos.o \ $(MESABUILDDIR)renderbuffer.o \ $(MESABUILDDIR)state.o \ $(MESABUILDDIR)stencil.o \ $(MESABUILDDIR)texcompress.o \ $(MESABUILDDIR)texcompress_fxt1.o \ $(MESABUILDDIR)texcompress_s3tc.o \ $(MESABUILDDIR)texenvprogram.o \ $(MESABUILDDIR)texformat.o \ $(MESABUILDDIR)teximage.o \ $(MESABUILDDIR)texrender.o \ $(MESABUILDDIR)texobj.o \ $(MESABUILDDIR)texstate.o \ $(MESABUILDDIR)texstore.o \ $(MESABUILDDIR)varray.o \ $(MESABUILDDIR)vtxfmt.o #ifdef NeedAllMesaSrc DISPATCHUOBJS = $(MESABUILDDIR)unshared/dispatch.o GLAPIUOBJS = $(MESABUILDDIR)unshared/glapi.o GLTHREADUOBJS = $(MESABUILDDIR)unshared/glthread.o #endif #if defined(DoSharedLib) && DoSharedLib COREMESABASEUOBJS = \ $(DISPATCHUOBJS) \ $(GLAPIUOBJS) \ $(GLTHREADUOBJS) \ $(MESABUILDDIR)unshared/api_arrayelt.o \ $(MESABUILDDIR)unshared/api_loopback.o \ $(MESABUILDDIR)unshared/api_noop.o \ $(MESABUILDDIR)unshared/api_validate.o \ $(MESABUILDDIR)unshared/accum.o \ $(MESABUILDDIR)unshared/attrib.o \ $(MESABUILDDIR)unshared/blend.o \ $(MESABUILDDIR)unshared/bufferobj.o \ $(MESABUILDDIR)unshared/buffers.o \ $(MESABUILDDIR)unshared/clip.o \ $(MESABUILDDIR)unshared/colortab.o \ $(MESABUILDDIR)unshared/context.o \ $(MESABUILDDIR)unshared/convolve.o \ $(MESABUILDDIR)unshared/debug.o \ $(MESABUILDDIR)unshared/depth.o \ $(MESABUILDDIR)unshared/dlist.o \ $(MESABUILDDIR)unshared/drawpix.o \ $(MESABUILDDIR)unshared/enable.o \ $(MESABUILDDIR)unshared/enums.o \ $(MESABUILDDIR)unshared/eval.o \ $(MESABUILDDIR)unshared/execmem.o \ $(MESABUILDDIR)unshared/extensions.o \ $(MESABUILDDIR)unshared/fbobject.o \ $(MESABUILDDIR)unshared/feedback.o \ $(MESABUILDDIR)unshared/fog.o \ $(MESABUILDDIR)unshared/framebuffer.o \ $(MESABUILDDIR)unshared/get.o \ $(MESABUILDDIR)unshared/getstring.o \ $(MESABUILDDIR)unshared/hash.o \ $(MESABUILDDIR)unshared/hint.o \ $(MESABUILDDIR)unshared/histogram.o \ $(MESABUILDDIR)unshared/image.o \ $(MESABUILDDIR)unshared/imports.o \ $(MESABUILDDIR)unshared/light.o \ $(MESABUILDDIR)unshared/lines.o \ $(MESABUILDDIR)unshared/matrix.o \ $(MESABUILDDIR)unshared/mm.o \ $(MESABUILDDIR)unshared/occlude.o \ $(MESABUILDDIR)unshared/pixel.o \ $(MESABUILDDIR)unshared/points.o \ $(MESABUILDDIR)unshared/polygon.o \ $(MESABUILDDIR)unshared/rastpos.o \ $(MESABUILDDIR)unshared/renderbuffer.o \ $(MESABUILDDIR)unshared/state.o \ $(MESABUILDDIR)unshared/stencil.o \ $(MESABUILDDIR)unshared/texcompress.o \ $(MESABUILDDIR)unshared/texcompress_fxt1.o \ $(MESABUILDDIR)unshared/texcompress_s3tc.o \ $(MESABUILDDIR)unshared/texenvprogram.o \ $(MESABUILDDIR)unshared/texformat.o \ $(MESABUILDDIR)unshared/teximage.o \ $(MESABUILDDIR)unshared/texobj.o \ $(MESABUILDDIR)unshared/texrender.o \ $(MESABUILDDIR)unshared/texstate.o \ $(MESABUILDDIR)unshared/texstore.o \ $(MESABUILDDIR)unshared/varray.o \ $(MESABUILDDIR)unshared/vtxfmt.o #else COREMESABASEUOBJS = $(COREMESABASEOBJS) #endif #ifdef NeedAllMesaSrc DISPATCHDOBJS = $(MESABUILDDIR)debugger/dispatch.o GLAPIDOBJS = $(MESABUILDDIR)debugger/glapi.o GLTHREADDOBJS = $(MESABUILDDIR)debugger/glthread.o #endif COREMESABASEDOBJS = \ $(DISPATCHDOBJS) \ $(GLAPIDOBJS) \ $(GLTHREADDOBJS) \ $(MESABUILDDIR)debugger/api_arrayelt.o \ $(MESABUILDDIR)debugger/api_loopback.o \ $(MESABUILDDIR)debugger/api_noop.o \ $(MESABUILDDIR)debugger/api_validate.o \ $(MESABUILDDIR)debugger/accum.o \ $(MESABUILDDIR)debugger/attrib.o \ $(MESABUILDDIR)debugger/blend.o \ $(MESABUILDDIR)debugger/bufferobj.o \ $(MESABUILDDIR)debugger/buffers.o \ $(MESABUILDDIR)debugger/clip.o \ $(MESABUILDDIR)debugger/colortab.o \ $(MESABUILDDIR)debugger/context.o \ $(MESABUILDDIR)debugger/convolve.o \ $(MESABUILDDIR)debugger/debug.o \ $(MESABUILDDIR)debugger/depth.o \ $(MESABUILDDIR)debugger/dlist.o \ $(MESABUILDDIR)debugger/drawpix.o \ $(MESABUILDDIR)debugger/enable.o \ $(MESABUILDDIR)debugger/enums.o \ $(MESABUILDDIR)debugger/eval.o \ $(MESABUILDDIR)debugger/execmem.o \ $(MESABUILDDIR)debugger/extensions.o \ $(MESABUILDDIR)debugger/fbobject.o \ $(MESABUILDDIR)debugger/feedback.o \ $(MESABUILDDIR)debugger/fog.o \ $(MESABUILDDIR)debugger/framebuffer.o \ $(MESABUILDDIR)debugger/get.o \ $(MESABUILDDIR)debugger/getstring.o \ $(MESABUILDDIR)debugger/hash.o \ $(MESABUILDDIR)debugger/hint.o \ $(MESABUILDDIR)debugger/histogram.o \ $(MESABUILDDIR)debugger/image.o \ $(MESABUILDDIR)debugger/imports.o \ $(MESABUILDDIR)debugger/light.o \ $(MESABUILDDIR)debugger/lines.o \ $(MESABUILDDIR)debugger/matrix.o \ $(MESABUILDDIR)debugger/mm.o \ $(MESABUILDDIR)debugger/occlude.o \ $(MESABUILDDIR)debugger/pixel.o \ $(MESABUILDDIR)debugger/points.o \ $(MESABUILDDIR)debugger/polygon.o \ $(MESABUILDDIR)debugger/rastpos.o \ $(MESABUILDDIR)debugger/renderbuffer.o \ $(MESABUILDDIR)debugger/state.o \ $(MESABUILDDIR)debugger/stencil.o \ $(MESABUILDDIR)debugger/texcompress.o \ $(MESABUILDDIR)debugger/texcompress_fxt1.o \ $(MESABUILDDIR)debugger/texcompress_s3tc.o \ $(MESABUILDDIR)debugger/texenvprogram.o \ $(MESABUILDDIR)debugger/texformat.o \ $(MESABUILDDIR)debugger/teximage.o \ $(MESABUILDDIR)debugger/texobj.o \ $(MESABUILDDIR)debugger/texrender.o \ $(MESABUILDDIR)debugger/texstate.o \ $(MESABUILDDIR)debugger/texstore.o \ $(MESABUILDDIR)debugger/varray.o \ $(MESABUILDDIR)debugger/vtxfmt.o #ifdef NeedAllMesaSrc DISPATCHPOBJS = $(MESABUILDDIR)profiled/dispatch.o GLAPIPOBJS = $(MESABUILDDIR)profiled/glapi.o GLTHREADPOBJS = $(MESABUILDDIR)profiled/glthread.o #endif COREMESABASEPOBJS = \ $(DISPATCHPOBJS) \ $(GLAPIPOBJS) \ $(GLTHREADPOBJS) \ $(MESABUILDDIR)profiled/api_arrayelt.o \ $(MESABUILDDIR)profiled/api_loopback.o \ $(MESABUILDDIR)profiled/api_noop.o \ $(MESABUILDDIR)profiled/api_validate.o \ $(MESABUILDDIR)profiled/accum.o \ $(MESABUILDDIR)profiled/attrib.o \ $(MESABUILDDIR)profiled/blend.o \ $(MESABUILDDIR)profiled/bufferobj.o \ $(MESABUILDDIR)profiled/buffers.o \ $(MESABUILDDIR)profiled/clip.o \ $(MESABUILDDIR)profiled/colortab.o \ $(MESABUILDDIR)profiled/context.o \ $(MESABUILDDIR)profiled/convolve.o \ $(MESABUILDDIR)profiled/debug.o \ $(MESABUILDDIR)profiled/depth.o \ $(MESABUILDDIR)profiled/dlist.o \ $(MESABUILDDIR)profiled/drawpix.o \ $(MESABUILDDIR)profiled/enable.o \ $(MESABUILDDIR)profiled/enums.o \ $(MESABUILDDIR)profiled/eval.o \ $(MESABUILDDIR)profiled/execmem.o \ $(MESABUILDDIR)profiled/extensions.o \ $(MESABUILDDIR)profiled/fbobject.o \ $(MESABUILDDIR)profiled/feedback.o \ $(MESABUILDDIR)profiled/fog.o \ $(MESABUILDDIR)profiled/framebuffer.o \ $(MESABUILDDIR)profiled/get.o \ $(MESABUILDDIR)profiled/getstring.o \ $(MESABUILDDIR)profiled/hash.o \ $(MESABUILDDIR)profiled/hint.o \ $(MESABUILDDIR)profiled/histogram.o \ $(MESABUILDDIR)profiled/image.o \ $(MESABUILDDIR)profiled/imports.o \ $(MESABUILDDIR)profiled/light.o \ $(MESABUILDDIR)profiled/lines.o \ $(MESABUILDDIR)profiled/matrix.o \ $(MESABUILDDIR)profiled/mm.o \ $(MESABUILDDIR)profiled/occlude.o \ $(MESABUILDDIR)profiled/pixel.o \ $(MESABUILDDIR)profiled/points.o \ $(MESABUILDDIR)profiled/polygon.o \ $(MESABUILDDIR)profiled/rastpos.o \ $(MESABUILDDIR)profiled/renderbuffer.o \ $(MESABUILDDIR)profiled/state.o \ $(MESABUILDDIR)profiled/stencil.o \ $(MESABUILDDIR)profiled/texcompress.o \ $(MESABUILDDIR)profiled/texcompress_fxt1.o \ $(MESABUILDDIR)profiled/texcompress_s3tc.o \ $(MESABUILDDIR)profiled/texenvprogram.o \ $(MESABUILDDIR)profiled/texformat.o \ $(MESABUILDDIR)profiled/teximage.o \ $(MESABUILDDIR)profiled/texobj.o \ $(MESABUILDDIR)profiled/texrender.o \ $(MESABUILDDIR)profiled/texstate.o \ $(MESABUILDDIR)profiled/texstore.o \ $(MESABUILDDIR)profiled/varray.o \ $(MESABUILDDIR)profiled/vtxfmt.o nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/main/WSDrawBuffer.h0000644000000000000000000000314113614532331021417 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /**************************************************************************/ typedef struct _WSDrawBufferRec { GLframebuffer *DrawBuffer; struct _WSDrawBufferRec *next; } WSDrawBufferRec, *WSDrawBufferPtr; WSDrawBufferPtr pWSDrawBuffer; nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/math/Imakefile0000644000000000000000000000147513614532331020573 0ustar #include #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaMathBuildDir /**/ #include "Imakefile.inc" SRCS = $(MESA_MATH_SRCS) OBJS = $(MESA_MATH_OBJS) INCLUDES = -I$(MESASRCDIR)/src/mesa \ -I$(MESASRCDIR)/src/mesa/math \ -I$(MESASRCDIR)/src/mesa/main \ -I$(MESASRCDIR)/src/mesa/glapi \ -I$(MESASRCDIR)/include \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ -I$(LIBSRC)/GL/include \ -I$(XF86SRC) -I$(INCLUDESRC) DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ NormalLibraryObjectRule() SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) DependTarget() #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/math/Imakefile.inc0000644000000000000000000000626213614532331021342 0ustar MESAMATHBUILDDIR = MesaMathBuildDir MESA_MATH_SRCS = $(MESAMATHBUILDDIR)m_debug_clip.c \ $(MESAMATHBUILDDIR)m_debug_norm.c \ $(MESAMATHBUILDDIR)m_debug_xform.c \ $(MESAMATHBUILDDIR)m_eval.c \ $(MESAMATHBUILDDIR)m_matrix.c \ $(MESAMATHBUILDDIR)m_translate.c \ $(MESAMATHBUILDDIR)m_vector.c \ $(MESAMATHBUILDDIR)m_xform.c #ifdef NeedToLinkMesaSrc LinkSourceFile(mathmod.h, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_clip_tmp.h, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_copy_tmp.h, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_debug_clip.c, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_debug.h, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_debug_util.h, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_debug_norm.c, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_debug_xform.c, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_dotprod_tmp.h, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_eval.c, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_eval.h, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_matrix.c, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_matrix.h, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_norm_tmp.h, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_translate.c, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_translate.h, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_trans_tmp.h, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_vector.c, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_vector.h, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_xform.c, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_xform.h, $(MESASRCDIR)/src/mesa/math) LinkSourceFile(m_xform_tmp.h, $(MESASRCDIR)/src/mesa/math) #endif MESA_MATH_OBJS = $(MESAMATHBUILDDIR)m_debug_clip.o \ $(MESAMATHBUILDDIR)m_debug_norm.o \ $(MESAMATHBUILDDIR)m_debug_xform.o \ $(MESAMATHBUILDDIR)m_eval.o \ $(MESAMATHBUILDDIR)m_matrix.o \ $(MESAMATHBUILDDIR)m_translate.o \ $(MESAMATHBUILDDIR)m_vector.o \ $(MESAMATHBUILDDIR)m_xform.o #if defined(DoSharedLib) && DoSharedLib MESA_MATH_UOBJS = $(MESAMATHBUILDDIR)unshared/m_debug_clip.o \ $(MESAMATHBUILDDIR)unshared/m_debug_norm.o \ $(MESAMATHBUILDDIR)unshared/m_debug_xform.o \ $(MESAMATHBUILDDIR)unshared/m_eval.o \ $(MESAMATHBUILDDIR)unshared/m_matrix.o \ $(MESAMATHBUILDDIR)unshared/m_translate.o \ $(MESAMATHBUILDDIR)unshared/m_vector.o \ $(MESAMATHBUILDDIR)unshared/m_xform.o #else MATH_MESA_UOBJS = $(MESA_MATH_OBJS) #endif MESA_MATH_DOBJS = $(MESAMATHBUILDDIR)debugger/m_debug_clip.o \ $(MESAMATHBUILDDIR)debugger/m_debug_norm.o \ $(MESAMATHBUILDDIR)debugger/m_debug_xform.o \ $(MESAMATHBUILDDIR)debugger/m_eval.o \ $(MESAMATHBUILDDIR)debugger/m_matrix.o \ $(MESAMATHBUILDDIR)debugger/m_translate.o \ $(MESAMATHBUILDDIR)debugger/m_vector.o \ $(MESAMATHBUILDDIR)debugger/m_xform.o MESA_MATH_POBJS = $(MESAMATHBUILDDIR)profiled/m_debug_clip.o \ $(MESAMATHBUILDDIR)profiled/m_debug_norm.o \ $(MESAMATHBUILDDIR)profiled/m_debug_xform.o \ $(MESAMATHBUILDDIR)profiled/m_eval.o \ $(MESAMATHBUILDDIR)profiled/m_matrix.o \ $(MESAMATHBUILDDIR)profiled/m_translate.o \ $(MESAMATHBUILDDIR)profiled/m_vector.o \ $(MESAMATHBUILDDIR)profiled/m_xform.o nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/shader/grammar/Imakefile0000644000000000000000000000160313614532331022527 0ustar #include #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaGrammarBuildDir /**/ #include "Imakefile.inc" SRCS = $(MESA_GRAMMAR_SRCS) OBJS = $(MESA_GRAMMAR_OBJS) INCLUDES = -I$(MESASRCDIR)/src/mesa \ -I$(MESASRCDIR)/src/mesa/shader \ -I$(MESASRCDIR)/src/mesa/shader/grammar \ -I$(MESASRCDIR)/src/mesa/main \ -I$(MESASRCDIR)/src/mesa/glapi \ -I$(MESASRCDIR)/include \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ -I$(LIBSRC)/GL/include \ -I$(XF86SRC) -I$(INCLUDESRC) DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ NormalLibraryObjectRule() SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) DependTarget() #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/shader/grammar/Imakefile.inc0000644000000000000000000000150413614532331023277 0ustar MESAGRAMMARBUILDDIR=MesaGrammarBuildDir MESA_GRAMMAR_SRCS = $(MESAGRAMMARBUILDDIR)grammar_mesa.c #ifdef NeedToLinkMesaSrc LinkSourceFile(grammar.c, $(MESASRCDIR)/src/mesa/shader/grammar) LinkSourceFile(grammar.h, $(MESASRCDIR)/src/mesa/shader/grammar) LinkSourceFile(grammar_syn.h, $(MESASRCDIR)/src/mesa/shader/grammar) LinkSourceFile(grammar_mesa.c, $(MESASRCDIR)/src/mesa/shader/grammar) LinkSourceFile(grammar_mesa.h, $(MESASRCDIR)/src/mesa/shader/grammar) #endif MESA_GRAMMAR_OBJS = $(MESAGRAMMARBUILDDIR)grammar_mesa.o #if defined(DoSharedLib) && DoSharedLib MESA_GRAMMAR_UOBJS = $(MESAGRAMMARBUILDDIR)unshared/grammar_mesa.o #else MESA_GRAMMAR_UOBJS = $(MESA_GRAMMAR_OBJS) #endif MESA_GRAMMAR_DOBJS = $(MESAGRAMMARBUILDDIR)debugger/grammar_mesa.o MESA_GRAMMAR_POBJS = $(MESAGRAMMARBUILDDIR)profiled/grammar_mesa.o nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/shader/Imakefile0000644000000000000000000000175313614532331021107 0ustar #define IHaveSubdirs SUBDIRS = grammar slang #include #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaShaderBuildDir /**/ #include "Imakefile.inc" SRCS = $(MESA_SHADER_SRCS) OBJS = $(MESA_SHADER_OBJS) INCLUDES = -I$(MESASRCDIR)/src/mesa \ -I$(MESASRCDIR)/src/mesa/shader \ -I$(MESASRCDIR)/src/mesa/shader/grammar \ -I$(MESASRCDIR)/src/mesa/shader/slang \ -I$(MESASRCDIR)/src/mesa/main \ -I$(MESASRCDIR)/src/mesa/glapi \ -I$(MESASRCDIR)/include \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ -I$(LIBSRC)/GL/include \ -I$(XF86SRC) -I$(INCLUDESRC) DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ NormalLibraryObjectRule() SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) DependTarget() #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/shader/Imakefile.inc0000644000000000000000000001160613614532331021655 0ustar MESASHADERBUILDDIR = MesaShaderBuildDir MESA_SHADER_SRCS = $(MESASHADERBUILDDIR)arbprogparse.c \ $(MESASHADERBUILDDIR)arbprogram.c \ $(MESASHADERBUILDDIR)arbfragparse.c \ $(MESASHADERBUILDDIR)arbvertparse.c \ $(MESASHADERBUILDDIR)atifragshader.c \ $(MESASHADERBUILDDIR)nvprogram.c \ $(MESASHADERBUILDDIR)nvfragparse.c \ $(MESASHADERBUILDDIR)nvvertexec.c \ $(MESASHADERBUILDDIR)nvvertparse.c \ $(MESASHADERBUILDDIR)program.c \ $(MESASHADERBUILDDIR)shaderobjects.c \ $(MESASHADERBUILDDIR)shaderobjects_3dlabs.c #ifdef NeedToLinkMesaSrc LinkSourceFile(arbprogparse.c, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(arbprogram.c, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(arbfragparse.c, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(arbvertparse.c, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(arbfragparse.h, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(arbprogparse.h, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(arbprogram.h, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(arbprogram_syn.h, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(arbvertparse.h, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(atifragshader.c, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(atifragshader.h, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(nvfragparse.h, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(nvfragprog.h, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(nvprogram.c, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(nvprogram.h, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(nvfragparse.c, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(nvvertexec.c, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(nvvertexec.h, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(nvvertparse.c, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(nvvertparse.h, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(nvvertprog.h, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(program.c, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(program.h, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(shaderobjects.c, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(shaderobjects.h, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(shaderobjects_3dlabs.c, $(MESASRCDIR)/src/mesa/shader) LinkSourceFile(shaderobjects_3dlabs.h, $(MESASRCDIR)/src/mesa/shader) #endif MESA_SHADER_OBJS = $(MESASHADERBUILDDIR)arbprogparse.o \ $(MESASHADERBUILDDIR)arbprogram.o \ $(MESASHADERBUILDDIR)arbfragparse.o \ $(MESASHADERBUILDDIR)arbvertparse.o \ $(MESASHADERBUILDDIR)atifragshader.o \ $(MESASHADERBUILDDIR)nvprogram.o \ $(MESASHADERBUILDDIR)nvfragparse.o \ $(MESASHADERBUILDDIR)nvvertexec.o \ $(MESASHADERBUILDDIR)nvvertparse.o \ $(MESASHADERBUILDDIR)program.o \ $(MESASHADERBUILDDIR)shaderobjects.o \ $(MESASHADERBUILDDIR)shaderobjects_3dlabs.o #if defined(DoSharedLib) && DoSharedLib MESA_SHADER_UOBJS = $(MESASHADERBUILDDIR)unshared/arbprogparse.o \ $(MESASHADERBUILDDIR)unshared/arbprogram.o \ $(MESASHADERBUILDDIR)unshared/arbfragparse.o \ $(MESASHADERBUILDDIR)unshared/arbvertparse.o \ $(MESASHADERBUILDDIR)unshared/atifragshader.o \ $(MESASHADERBUILDDIR)unshared/nvprogram.o \ $(MESASHADERBUILDDIR)unshared/nvfragparse.o \ $(MESASHADERBUILDDIR)unshared/nvvertexec.o \ $(MESASHADERBUILDDIR)unshared/nvvertparse.o \ $(MESASHADERBUILDDIR)unshared/program.o \ $(MESASHADERBUILDDIR)unshared/shaderobjects.o \ $(MESASHADERBUILDDIR)unshared/shaderobjects_3dlabs.o #else MESA_SHADER_UOBJS = $(MESA_SHADER_OBJS) #endif MESA_SHADER_DOBJS = $(MESASHADERBUILDDIR)debugger/arbprogparse.o \ $(MESASHADERBUILDDIR)debugger/arbprogram.o \ $(MESASHADERBUILDDIR)debugger/arbfragparse.o \ $(MESASHADERBUILDDIR)debugger/arbvertparse.o \ $(MESASHADERBUILDDIR)debugger/atifragshader.o \ $(MESASHADERBUILDDIR)debugger/nvprogram.o \ $(MESASHADERBUILDDIR)debugger/nvfragparse.o \ $(MESASHADERBUILDDIR)debugger/nvvertexec.o \ $(MESASHADERBUILDDIR)debugger/nvvertparse.o \ $(MESASHADERBUILDDIR)debugger/program.o \ $(MESASHADERBUILDDIR)debugger/shaderobjects.o \ $(MESASHADERBUILDDIR)debugger/shaderobjects_3dlabs.o MESA_SHADER_POBJS = $(MESASHADERBUILDDIR)profiled/arbprogparse.o \ $(MESASHADERBUILDDIR)profiled/arbprogram.o \ $(MESASHADERBUILDDIR)profiled/arbfragparse.o \ $(MESASHADERBUILDDIR)profiled/arbvertparse.o \ $(MESASHADERBUILDDIR)profiled/atifragshader.o \ $(MESASHADERBUILDDIR)profiled/nvprogram.o \ $(MESASHADERBUILDDIR)profiled/nvfragparse.o \ $(MESASHADERBUILDDIR)profiled/nvvertexec.o \ $(MESASHADERBUILDDIR)profiled/nvvertparse.o \ $(MESASHADERBUILDDIR)profiled/program.o \ $(MESASHADERBUILDDIR)profiled/shaderobjects.o \ $(MESASHADERBUILDDIR)profiled/shaderobjects_3dlabs.o nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/shader/slang/Imakefile0000644000000000000000000000165313614532331022212 0ustar #define IHaveSubdirs SUBDIRS = library #include #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaSlangBuildDir /**/ #include "Imakefile.inc" SRCS = $(MESA_SLANG_SRCS) OBJS = $(MESA_SLANG_OBJS) INCLUDES = -I$(MESASRCDIR)/src/mesa \ -I$(MESASRCDIR)/src/mesa/shader \ -I$(MESASRCDIR)/src/mesa/shader/grammar \ -I$(MESASRCDIR)/src/mesa/main \ -I$(MESASRCDIR)/src/mesa/glapi \ -I$(MESASRCDIR)/include \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ -I$(LIBSRC)/GL/include \ -I$(XF86SRC) -I$(INCLUDESRC) DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ NormalLibraryObjectRule() SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) DependTarget() #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/shader/slang/Imakefile.inc0000644000000000000000000001213313614532331022755 0ustar MESASLANGBUILDDIR=MesaSlangBuildDir MESA_SLANG_SRCS = $(MESASLANGBUILDDIR)slang_assemble_assignment.c \ $(MESASLANGBUILDDIR)slang_assemble.c \ $(MESASLANGBUILDDIR)slang_assemble_conditional.c \ $(MESASLANGBUILDDIR)slang_assemble_constructor.c \ $(MESASLANGBUILDDIR)slang_assemble_typeinfo.c \ $(MESASLANGBUILDDIR)slang_compile.c \ $(MESASLANGBUILDDIR)slang_execute.c \ $(MESASLANGBUILDDIR)slang_preprocess.c \ $(MESASLANGBUILDDIR)slang_storage.c \ $(MESASLANGBUILDDIR)slang_utility.c #ifdef NeedToLinkMesaSrc LinkSourceFile(slang_assemble_assignment.c, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_assemble_assignment.h, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_assemble.c, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_assemble.h, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_assemble_conditional.c, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_assemble_conditional.h, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_assemble_constructor.c, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_assemble_constructor.h, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_assemble_typeinfo.c, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_assemble_typeinfo.h, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_compile.c, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_compile.h, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_execute.c, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_execute.h, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_preprocess.c, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_preprocess.h, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_storage.c, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_storage.h, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_utility.c, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(slang_utility.h, $(MESASRCDIR)/src/mesa/shader/slang) LinkSourceFile(traverse_wrap.h, $(MESASRCDIR)/src/mesa/shader/slang) #endif MESA_SLANG_OBJS = $(MESASLANGBUILDDIR)slang_assemble_assignment.o \ $(MESASLANGBUILDDIR)slang_assemble.o \ $(MESASLANGBUILDDIR)slang_assemble_conditional.o \ $(MESASLANGBUILDDIR)slang_assemble_constructor.o \ $(MESASLANGBUILDDIR)slang_assemble_typeinfo.o \ $(MESASLANGBUILDDIR)slang_compile.o \ $(MESASLANGBUILDDIR)slang_execute.o \ $(MESASLANGBUILDDIR)slang_preprocess.o \ $(MESASLANGBUILDDIR)slang_storage.o \ $(MESASLANGBUILDDIR)slang_utility.o #if defined(DoSharedLib) && DoSharedLib MESA_SLANG_UOBJS = $(MESASLANGBUILDDIR)unshared/slang_assemble_assignment.o \ $(MESASLANGBUILDDIR)unshared/slang_assemble.o \ $(MESASLANGBUILDDIR)unshared/slang_assemble_conditional.o \ $(MESASLANGBUILDDIR)unshared/slang_assemble_constructor.o \ $(MESASLANGBUILDDIR)unshared/slang_assemble_typeinfo.o \ $(MESASLANGBUILDDIR)unshared/slang_compile.o \ $(MESASLANGBUILDDIR)unshared/slang_execute.o \ $(MESASLANGBUILDDIR)unshared/slang_preprocess.o \ $(MESASLANGBUILDDIR)unshared/slang_storage.o \ $(MESASLANGBUILDDIR)unshared/slang_utility.o #else MESA_SLANG_UOBJS = $(MESA_SLANG_OBJS) #endif MESA_SLANG_DOBJS = $(MESASLANGBUILDDIR)debugger/slang_assemble_assignment.o \ $(MESASLANGBUILDDIR)debugger/slang_assemble.o \ $(MESASLANGBUILDDIR)debugger/slang_assemble_conditional.o \ $(MESASLANGBUILDDIR)debugger/slang_assemble_constructor.o \ $(MESASLANGBUILDDIR)debugger/slang_assemble_typeinfo.o \ $(MESASLANGBUILDDIR)debugger/slang_compile.o \ $(MESASLANGBUILDDIR)debugger/slang_execute.o \ $(MESASLANGBUILDDIR)debugger/slang_preprocess.o \ $(MESASLANGBUILDDIR)debugger/slang_storage.o \ $(MESASLANGBUILDDIR)debugger/slang_utility.o MESA_SLANG_POBJS = $(MESASLANGBUILDDIR)profiled/slang_assemble_assignment.o \ $(MESASLANGBUILDDIR)profiled/slang_assemble.o \ $(MESASLANGBUILDDIR)profiled/slang_assemble_conditional.o \ $(MESASLANGBUILDDIR)profiled/slang_assemble_constructor.o \ $(MESASLANGBUILDDIR)profiled/slang_assemble_typeinfo.o \ $(MESASLANGBUILDDIR)profiled/slang_compile.o \ $(MESASLANGBUILDDIR)profiled/slang_execute.o \ $(MESASLANGBUILDDIR)profiled/slang_preprocess.o \ $(MESASLANGBUILDDIR)profiled/slang_storage.o \ $(MESASLANGBUILDDIR)profiled/slang_utility.o nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/shader/slang/library/Imakefile0000644000000000000000000000140113614532331023645 0ustar #include #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaLibraryBuildDir /**/ #include "Imakefile.inc" INCLUDES = -I$(MESASRCDIR)/src/mesa \ -I$(MESASRCDIR)/src/mesa/shader \ -I$(MESASRCDIR)/src/mesa/shader/grammar \ -I$(MESASRCDIR)/src/mesa/main \ -I$(MESASRCDIR)/src/mesa/glapi \ -I$(MESASRCDIR)/include \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ -I$(LIBSRC)/GL/include \ -I$(XF86SRC) -I$(INCLUDESRC) DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ NormalLibraryObjectRule() DependTarget() #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/shader/slang/library/Imakefile.inc0000644000000000000000000000157113614532331024425 0ustar #ifdef NeedToLinkMesaSrc LinkSourceFile(slang_common_builtin_gc_bin.h, $(MESASRCDIR)/src/mesa/shader/slang/library) LinkSourceFile(slang_common_builtin_gc.h, $(MESASRCDIR)/src/mesa/shader/slang/library) LinkSourceFile(slang_core_gc_bin.h, $(MESASRCDIR)/src/mesa/shader/slang/library) LinkSourceFile(slang_core_gc.h, $(MESASRCDIR)/src/mesa/shader/slang/library) LinkSourceFile(slang_fragment_builtin_gc_bin.h, $(MESASRCDIR)/src/mesa/shader/slang/library) LinkSourceFile(slang_fragment_builtin_gc.h, $(MESASRCDIR)/src/mesa/shader/slang/library) LinkSourceFile(slang_shader_syn.h, $(MESASRCDIR)/src/mesa/shader/slang/library) LinkSourceFile(slang_version_syn.h, $(MESASRCDIR)/src/mesa/shader/slang/library) LinkSourceFile(slang_vertex_builtin_gc_bin.h, $(MESASRCDIR)/src/mesa/shader/slang/library) LinkSourceFile(slang_vertex_builtin_gc.h, $(MESASRCDIR)/src/mesa/shader/slang/library) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/swrast/Imakefile0000644000000000000000000000214513614532331021160 0ustar /* Large PIC tables needed for Solaris/SPARC builds */ #if defined(SunArchitecture) && defined(SparcArchitecture) && defined(LargePositionIndependentCFlags) PICFLAGS = LargePositionIndependentCFlags #endif #include #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaSwrastBuildDir /**/ #include "Imakefile.inc" SRCS = $(MESA_SWRAST_SRCS) OBJS = $(MESA_SWRAST_OBJS) INCLUDES = -I$(MESASRCDIR)/src/mesa \ -I$(MESASRCDIR)/src/mesa/main \ -I$(MESASRCDIR)/src/mesa/glapi \ -I$(MESASRCDIR)/src/mesa/swrast \ -I$(MESASRCDIR)/src/mesa/swrast_setup \ -I$(MESASRCDIR)/src/mesa/shader \ -I$(MESASRCDIR)/include \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ -I$(LIBSRC)/GL/include \ -I$(XF86SRC) -I$(INCLUDESRC) DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ NormalLibraryObjectRule() SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) DependTarget() #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/swrast/Imakefile.inc0000644000000000000000000002410013614532331021723 0ustar MESASWRASTBUILDDIR = MesaSwrastBuildDir MESA_SWRAST_SRCS = $(MESASWRASTBUILDDIR)s_aaline.c \ $(MESASWRASTBUILDDIR)s_aatriangle.c \ $(MESASWRASTBUILDDIR)s_accum.c \ $(MESASWRASTBUILDDIR)s_alpha.c \ $(MESASWRASTBUILDDIR)s_atifragshader.c \ $(MESASWRASTBUILDDIR)s_bitmap.c \ $(MESASWRASTBUILDDIR)s_blend.c \ $(MESASWRASTBUILDDIR)s_buffers.c \ $(MESASWRASTBUILDDIR)s_context.c \ $(MESASWRASTBUILDDIR)s_copypix.c \ $(MESASWRASTBUILDDIR)s_depth.c \ $(MESASWRASTBUILDDIR)s_drawpix.c \ $(MESASWRASTBUILDDIR)s_feedback.c \ $(MESASWRASTBUILDDIR)s_fog.c \ $(MESASWRASTBUILDDIR)s_imaging.c \ $(MESASWRASTBUILDDIR)s_lines.c \ $(MESASWRASTBUILDDIR)s_logic.c \ $(MESASWRASTBUILDDIR)s_masking.c \ $(MESASWRASTBUILDDIR)s_nvfragprog.c \ $(MESASWRASTBUILDDIR)s_pixeltex.c \ $(MESASWRASTBUILDDIR)s_points.c \ $(MESASWRASTBUILDDIR)s_readpix.c \ $(MESASWRASTBUILDDIR)s_span.c \ $(MESASWRASTBUILDDIR)s_stencil.c \ $(MESASWRASTBUILDDIR)s_texstore.c \ $(MESASWRASTBUILDDIR)s_texture.c \ $(MESASWRASTBUILDDIR)s_triangle.c \ $(MESASWRASTBUILDDIR)s_zoom.c #ifdef NeedToLinkMesaSrc LinkSourceFile(s_aaline.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_aaline.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_aalinetemp.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_aatriangle.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_aatriangle.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_aatritemp.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_accum.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_accum.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_alpha.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_alpha.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_atifragshader.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_atifragshader.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_bitmap.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_blend.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_blend.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_buffers.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_context.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_context.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_copypix.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_depth.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_depth.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_drawpix.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_drawpix.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_feedback.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_feedback.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_fog.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_fog.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_imaging.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_lines.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_lines.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_linetemp.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_logic.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_logic.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_masking.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_masking.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_nvfragprog.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_nvfragprog.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_pixeltex.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_pixeltex.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_points.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_points.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_pointtemp.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_readpix.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_span.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_span.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_spantemp.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_stencil.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_stencil.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_texstore.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_texture.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_texture.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_triangle.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_triangle.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_trispan.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_tritemp.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_zoom.c, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(s_zoom.h, $(MESASRCDIR)/src/mesa/swrast) LinkSourceFile(swrast.h, $(MESASRCDIR)/src/mesa/swrast) #endif MESA_SWRAST_OBJS = $(MESASWRASTBUILDDIR)s_aaline.o \ $(MESASWRASTBUILDDIR)s_aatriangle.o \ $(MESASWRASTBUILDDIR)s_accum.o \ $(MESASWRASTBUILDDIR)s_alpha.o \ $(MESASWRASTBUILDDIR)s_atifragshader.o \ $(MESASWRASTBUILDDIR)s_bitmap.o \ $(MESASWRASTBUILDDIR)s_blend.o \ $(MESASWRASTBUILDDIR)s_buffers.o \ $(MESASWRASTBUILDDIR)s_context.o \ $(MESASWRASTBUILDDIR)s_copypix.o \ $(MESASWRASTBUILDDIR)s_depth.o \ $(MESASWRASTBUILDDIR)s_drawpix.o \ $(MESASWRASTBUILDDIR)s_feedback.o \ $(MESASWRASTBUILDDIR)s_fog.o \ $(MESASWRASTBUILDDIR)s_imaging.o \ $(MESASWRASTBUILDDIR)s_lines.o \ $(MESASWRASTBUILDDIR)s_logic.o \ $(MESASWRASTBUILDDIR)s_masking.o \ $(MESASWRASTBUILDDIR)s_nvfragprog.o \ $(MESASWRASTBUILDDIR)s_pixeltex.o \ $(MESASWRASTBUILDDIR)s_points.o \ $(MESASWRASTBUILDDIR)s_readpix.o \ $(MESASWRASTBUILDDIR)s_span.o \ $(MESASWRASTBUILDDIR)s_stencil.o \ $(MESASWRASTBUILDDIR)s_texstore.o \ $(MESASWRASTBUILDDIR)s_texture.o \ $(MESASWRASTBUILDDIR)s_triangle.o \ $(MESASWRASTBUILDDIR)s_zoom.o #if defined(DoSharedLib) && DoSharedLib MESA_SWRAST_UOBJS = $(MESASWRASTBUILDDIR)unshared/s_aaline.o \ $(MESASWRASTBUILDDIR)unshared/s_aatriangle.o \ $(MESASWRASTBUILDDIR)unshared/s_accum.o \ $(MESASWRASTBUILDDIR)unshared/s_alpha.o \ $(MESASWRASTBUILDDIR)unshared/s_atifragshader.o \ $(MESASWRASTBUILDDIR)unshared/s_bitmap.o \ $(MESASWRASTBUILDDIR)unshared/s_blend.o \ $(MESASWRASTBUILDDIR)unshared/s_buffers.o \ $(MESASWRASTBUILDDIR)unshared/s_context.o \ $(MESASWRASTBUILDDIR)unshared/s_copypix.o \ $(MESASWRASTBUILDDIR)unshared/s_depth.o \ $(MESASWRASTBUILDDIR)unshared/s_drawpix.o \ $(MESASWRASTBUILDDIR)unshared/s_feedback.o \ $(MESASWRASTBUILDDIR)unshared/s_fog.o \ $(MESASWRASTBUILDDIR)unshared/s_imaging.o \ $(MESASWRASTBUILDDIR)unshared/s_lines.o \ $(MESASWRASTBUILDDIR)unshared/s_logic.o \ $(MESASWRASTBUILDDIR)unshared/s_masking.o \ $(MESASWRASTBUILDDIR)unshared/s_nvfragprog.o \ $(MESASWRASTBUILDDIR)unshared/s_pixeltex.o \ $(MESASWRASTBUILDDIR)unshared/s_points.o \ $(MESASWRASTBUILDDIR)unshared/s_readpix.o \ $(MESASWRASTBUILDDIR)unshared/s_span.o \ $(MESASWRASTBUILDDIR)unshared/s_stencil.o \ $(MESASWRASTBUILDDIR)unshared/s_texstore.o \ $(MESASWRASTBUILDDIR)unshared/s_texture.o \ $(MESASWRASTBUILDDIR)unshared/s_triangle.o \ $(MESASWRASTBUILDDIR)unshared/s_zoom.o #else MESA_SWRAST_UOBJS = $(MESA_SWRAST_OBJS) #endif MESA_SWRAST_DOBJS = $(MESASWRASTBUILDDIR)debugger/s_aaline.o \ $(MESASWRASTBUILDDIR)debugger/s_aatriangle.o \ $(MESASWRASTBUILDDIR)debugger/s_accum.o \ $(MESASWRASTBUILDDIR)debugger/s_alpha.o \ $(MESASWRASTBUILDDIR)debugger/s_atifragshader.o \ $(MESASWRASTBUILDDIR)debugger/s_bitmap.o \ $(MESASWRASTBUILDDIR)debugger/s_blend.o \ $(MESASWRASTBUILDDIR)debugger/s_buffers.o \ $(MESASWRASTBUILDDIR)debugger/s_context.o \ $(MESASWRASTBUILDDIR)debugger/s_copypix.o \ $(MESASWRASTBUILDDIR)debugger/s_depth.o \ $(MESASWRASTBUILDDIR)debugger/s_drawpix.o \ $(MESASWRASTBUILDDIR)debugger/s_feedback.o \ $(MESASWRASTBUILDDIR)debugger/s_fog.o \ $(MESASWRASTBUILDDIR)debugger/s_imaging.o \ $(MESASWRASTBUILDDIR)debugger/s_lines.o \ $(MESASWRASTBUILDDIR)debugger/s_logic.o \ $(MESASWRASTBUILDDIR)debugger/s_masking.o \ $(MESASWRASTBUILDDIR)debugger/s_nvfragprog.o \ $(MESASWRASTBUILDDIR)debugger/s_pixeltex.o \ $(MESASWRASTBUILDDIR)debugger/s_points.o \ $(MESASWRASTBUILDDIR)debugger/s_readpix.o \ $(MESASWRASTBUILDDIR)debugger/s_span.o \ $(MESASWRASTBUILDDIR)debugger/s_stencil.o \ $(MESASWRASTBUILDDIR)debugger/s_texstore.o \ $(MESASWRASTBUILDDIR)debugger/s_texture.o \ $(MESASWRASTBUILDDIR)debugger/s_triangle.o \ $(MESASWRASTBUILDDIR)debugger/s_zoom.o MESA_SWRAST_POBJS = $(MESASWRASTBUILDDIR)profiled/s_aaline.o \ $(MESASWRASTBUILDDIR)profiled/s_aatriangle.o \ $(MESASWRASTBUILDDIR)profiled/s_accum.o \ $(MESASWRASTBUILDDIR)profiled/s_alpha.o \ $(MESASWRASTBUILDDIR)profiled/s_atifragshader.o \ $(MESASWRASTBUILDDIR)profiled/s_bitmap.o \ $(MESASWRASTBUILDDIR)profiled/s_blend.o \ $(MESASWRASTBUILDDIR)profiled/s_buffers.o \ $(MESASWRASTBUILDDIR)profiled/s_context.o \ $(MESASWRASTBUILDDIR)profiled/s_copypix.o \ $(MESASWRASTBUILDDIR)profiled/s_depth.o \ $(MESASWRASTBUILDDIR)profiled/s_drawpix.o \ $(MESASWRASTBUILDDIR)profiled/s_feedback.o \ $(MESASWRASTBUILDDIR)profiled/s_fog.o \ $(MESASWRASTBUILDDIR)profiled/s_imaging.o \ $(MESASWRASTBUILDDIR)profiled/s_lines.o \ $(MESASWRASTBUILDDIR)profiled/s_logic.o \ $(MESASWRASTBUILDDIR)profiled/s_masking.o \ $(MESASWRASTBUILDDIR)profiled/s_nvfragprog.o \ $(MESASWRASTBUILDDIR)profiled/s_pixeltex.o \ $(MESASWRASTBUILDDIR)profiled/s_points.o \ $(MESASWRASTBUILDDIR)profiled/s_readpix.o \ $(MESASWRASTBUILDDIR)profiled/s_span.o \ $(MESASWRASTBUILDDIR)profiled/s_stencil.o \ $(MESASWRASTBUILDDIR)profiled/s_texstore.o \ $(MESASWRASTBUILDDIR)profiled/s_texture.o \ $(MESASWRASTBUILDDIR)profiled/s_triangle.o \ $(MESASWRASTBUILDDIR)profiled/s_zoom.o nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/swrast_setup/Imakefile0000644000000000000000000000152513614532331022401 0ustar #include #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaSwrastSetupBuildDir /**/ #include "Imakefile.inc" SRCS = $(MESA_SWR_SETUP_SRCS) OBJS = $(MESA_SWR_SETUP_OBJS) INCLUDES = -I$(MESASRCDIR)/src/mesa \ -I$(MESASRCDIR)/src/mesa/main \ -I$(MESASRCDIR)/src/mesa/glapi \ -I$(MESASRCDIR)/src/mesa/swrast_setup \ -I$(MESASRCDIR)/include \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ -I$(LIBSRC)/GL/include \ -I$(XF86SRC) -I$(INCLUDESRC) DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ NormalLibraryObjectRule() SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) DependTarget() #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/swrast_setup/Imakefile.inc0000644000000000000000000000214313614532331023146 0ustar MESASWRSETUPDIR = MesaSwrastSetupBuildDir MESA_SWR_SETUP_SRCS = $(MESASWRSETUPDIR)ss_context.c \ $(MESASWRSETUPDIR)ss_triangle.c #ifdef NeedToLinkMesaSrc LinkSourceFile(ss_context.c, $(MESASRCDIR)/src/mesa/swrast_setup) LinkSourceFile(ss_context.h, $(MESASRCDIR)/src/mesa/swrast_setup) LinkSourceFile(ss_triangle.c, $(MESASRCDIR)/src/mesa/swrast_setup) LinkSourceFile(ss_triangle.h, $(MESASRCDIR)/src/mesa/swrast_setup) LinkSourceFile(ss_tritmp.h, $(MESASRCDIR)/src/mesa/swrast_setup) LinkSourceFile(swrast_setup.h, $(MESASRCDIR)/src/mesa/swrast_setup) #endif MESA_SWR_SETUP_OBJS = $(MESASWRSETUPDIR)ss_context.o \ $(MESASWRSETUPDIR)ss_triangle.o #if defined(DoSharedLib) && DoSharedLib MESA_SWR_SETUP_UOBJS = $(MESASWRSETUPDIR)unshared/ss_context.o \ $(MESASWRSETUPDIR)unshared/ss_triangle.o #else MESA_SWR_SETUP_UOBJS = $(MESA_SWR_SETUP_OBJS) #endif MESA_SWR_SETUP_DOBJS = $(MESASWRSETUPDIR)debugger/ss_context.o \ $(MESASWRSETUPDIR)debugger/ss_triangle.o MESA_SWR_SETUP_POBJS = $(MESASWRSETUPDIR)profiled/ss_context.o \ $(MESASWRSETUPDIR)profiled/ss_triangle.o nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/tnl/Imakefile0000644000000000000000000000217413614532331020434 0ustar /* Large PIC tables needed for Solaris/SPARC builds */ #if defined(SunArchitecture) && defined(SparcArchitecture) && defined(LargePositionIndependentCFlags) PICFLAGS = LargePositionIndependentCFlags #endif #include #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaTnlBuildDir /**/ #include "Imakefile.inc" SRCS = $(MESA_TNL_SRCS) OBJS = $(MESA_TNL_OBJS) INCLUDES = -I$(MESASRCDIR)/src/mesa \ -I$(MESASRCDIR)/src/mesa/array_cache \ -I$(MESASRCDIR)/src/mesa/math \ -I$(MESASRCDIR)/src/mesa/main \ -I$(MESASRCDIR)/src/mesa/glapi \ -I$(MESASRCDIR)/src/mesa/shader \ -I$(MESASRCDIR)/src/mesa/tnl \ -I$(MESASRCDIR)/include \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ -I$(LIBSRC)/GL/include \ -I$(XF86SRC) -I$(INCLUDESRC) DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ NormalLibraryObjectRule() SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) DependTarget() #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/tnl/Imakefile.inc0000644000000000000000000002354013614532331021204 0ustar MESATNLBUILDDIR = MesaTnlBuildDir MESA_TNL_SRCS = $(MESATNLBUILDDIR)t_array_api.c \ $(MESATNLBUILDDIR)t_array_import.c \ $(MESATNLBUILDDIR)t_context.c \ $(MESATNLBUILDDIR)t_pipeline.c \ $(MESATNLBUILDDIR)t_save_api.c \ $(MESATNLBUILDDIR)t_save_loopback.c \ $(MESATNLBUILDDIR)t_save_playback.c \ $(MESATNLBUILDDIR)t_vb_arbprogram.c \ $(MESATNLBUILDDIR)t_vb_arbprogram_sse.c \ $(MESATNLBUILDDIR)t_vb_fog.c \ $(MESATNLBUILDDIR)t_vb_cull.c \ $(MESATNLBUILDDIR)t_vb_light.c \ $(MESATNLBUILDDIR)t_vb_normals.c \ $(MESATNLBUILDDIR)t_vb_points.c \ $(MESATNLBUILDDIR)t_vb_program.c \ $(MESATNLBUILDDIR)t_vb_render.c \ $(MESATNLBUILDDIR)t_vb_texgen.c \ $(MESATNLBUILDDIR)t_vb_texmat.c \ $(MESATNLBUILDDIR)t_vb_vertex.c \ $(MESATNLBUILDDIR)t_vertex.c \ $(MESATNLBUILDDIR)t_vertex_generic.c \ $(MESATNLBUILDDIR)t_vertex_sse.c \ $(MESATNLBUILDDIR)t_vp_build.c \ $(MESATNLBUILDDIR)t_vtx_api.c \ $(MESATNLBUILDDIR)t_vtx_eval.c \ $(MESATNLBUILDDIR)t_vtx_exec.c \ $(MESATNLBUILDDIR)t_vtx_generic.c #if defined(i386Architecture) && MesaUseX86Asm MESA_TNL_SRCS += MesaTnlAsmSrcs $(MESATNLBUILDDIR)t_vtx_x86.c \ $(MESATNLBUILDDIR)t_vtx_x86_gcc.S #endif #ifdef NeedToLinkMesaSrc LinkSourceFile(t_array_api.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_array_api.h, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_array_import.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_array_import.h, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_context.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_context.h, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(tnl.h, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_pipeline.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_pipeline.h, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_save_api.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_save_api.h, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_save_loopback.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_save_playback.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_arbprogram.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_arbprogram.h, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_arbprogram_sse.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_cliptmp.h, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_fog.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_cull.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_light.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_lighttmp.h, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_normals.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_points.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_program.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_render.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_rendertmp.h, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_texgen.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_texmat.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vb_vertex.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vertex.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vertex.h, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vertex_generic.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vertex_sse.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vp_build.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vp_build.h, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vtx_api.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vtx_api.h, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vtx_eval.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vtx_exec.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vtx_generic.c, $(MESASRCDIR)/src/mesa/tnl) #if defined(i386Architecture) && MesaUseX86Asm LinkSourceFile(t_vtx_x86.c, $(MESASRCDIR)/src/mesa/tnl) LinkSourceFile(t_vtx_x86_gcc.S, $(MESASRCDIR)/src/mesa/tnl) #endif #endif MESA_TNL_OBJS = $(MESATNLBUILDDIR)t_array_api.o \ $(MESATNLBUILDDIR)t_array_import.o \ $(MESATNLBUILDDIR)t_context.o \ $(MESATNLBUILDDIR)t_pipeline.o \ $(MESATNLBUILDDIR)t_save_api.o \ $(MESATNLBUILDDIR)t_save_loopback.o \ $(MESATNLBUILDDIR)t_save_playback.o \ $(MESATNLBUILDDIR)t_vb_arbprogram.o \ $(MESATNLBUILDDIR)t_vb_arbprogram_sse.o \ $(MESATNLBUILDDIR)t_vb_fog.o \ $(MESATNLBUILDDIR)t_vb_cull.o \ $(MESATNLBUILDDIR)t_vb_light.o \ $(MESATNLBUILDDIR)t_vb_normals.o \ $(MESATNLBUILDDIR)t_vb_points.o \ $(MESATNLBUILDDIR)t_vb_program.o \ $(MESATNLBUILDDIR)t_vb_render.o \ $(MESATNLBUILDDIR)t_vb_texgen.o \ $(MESATNLBUILDDIR)t_vb_texmat.o \ $(MESATNLBUILDDIR)t_vb_vertex.o \ $(MESATNLBUILDDIR)t_vertex.o \ $(MESATNLBUILDDIR)t_vertex_generic.o \ $(MESATNLBUILDDIR)t_vertex_sse.o \ $(MESATNLBUILDDIR)t_vp_build.o \ $(MESATNLBUILDDIR)t_vtx_api.o \ $(MESATNLBUILDDIR)t_vtx_eval.o \ $(MESATNLBUILDDIR)t_vtx_exec.o \ $(MESATNLBUILDDIR)t_vtx_generic.o #if defined(i386Architecture) && MesaUseX86Asm MESA_TNL_OBJS += $(MESATNLBUILDDIR)t_vtx_x86.o \ $(MESATNLBUILDDIR)t_vtx_x86_gcc.o #endif #if defined(DoSharedLib) && DoSharedLib MESA_TNL_UOBJS = $(MESATNLBUILDDIR)unshared/t_array_api.o \ $(MESATNLBUILDDIR)unshared/t_array_import.o \ $(MESATNLBUILDDIR)unshared/t_context.o \ $(MESATNLBUILDDIR)unshared/t_pipeline.o \ $(MESATNLBUILDDIR)unshared/t_save_api.o \ $(MESATNLBUILDDIR)unshared/t_save_loopback.o \ $(MESATNLBUILDDIR)unshared/t_save_playback.o \ $(MESATNLBUILDDIR)unshared/t_vb_arbprogram.o \ $(MESATNLBUILDDIR)unshared/t_vb_arbprogram_sse.o \ $(MESATNLBUILDDIR)unshared/t_vb_fog.o \ $(MESATNLBUILDDIR)unshared/t_vb_cull.o \ $(MESATNLBUILDDIR)unshared/t_vb_light.o \ $(MESATNLBUILDDIR)unshared/t_vb_normals.o \ $(MESATNLBUILDDIR)unshared/t_vb_points.o \ $(MESATNLBUILDDIR)unshared/t_vb_program.o \ $(MESATNLBUILDDIR)unshared/t_vb_render.o \ $(MESATNLBUILDDIR)unshared/t_vb_texgen.o \ $(MESATNLBUILDDIR)unshared/t_vb_texmat.o \ $(MESATNLBUILDDIR)unshared/t_vb_vertex.o \ $(MESATNLBUILDDIR)unshared/t_vertex.o \ $(MESATNLBUILDDIR)unshared/t_vertex_generic.o \ $(MESATNLBUILDDIR)unshared/t_vertex_sse.o \ $(MESATNLBUILDDIR)unshared/t_vp_build.o \ $(MESATNLBUILDDIR)unshared/t_vtx_api.o \ $(MESATNLBUILDDIR)unshared/t_vtx_eval.o \ $(MESATNLBUILDDIR)unshared/t_vtx_exec.o \ $(MESATNLBUILDDIR)unshared/t_vtx_generic.o #if defined(i386Architecture) && MesaUseX86Asm MESA_TNL_UOBJS += $(MESATNLBUILDDIR)unshared/t_vtx_x86.o \ $(MESATNLBUILDDIR)t_vtx_x86_gcc.o #endif #else MESA_TNL_UOBJS = $(MESA_TNL_OBJS) #endif MESA_TNL_DOBJS = $(MESATNLBUILDDIR)debugger/t_array_api.o \ $(MESATNLBUILDDIR)debugger/t_array_import.o \ $(MESATNLBUILDDIR)debugger/t_context.o \ $(MESATNLBUILDDIR)debugger/t_pipeline.o \ $(MESATNLBUILDDIR)debugger/t_save_api.o \ $(MESATNLBUILDDIR)debugger/t_save_loopback.o \ $(MESATNLBUILDDIR)debugger/t_save_playback.o \ $(MESATNLBUILDDIR)debugger/t_vb_arbprogram.o \ $(MESATNLBUILDDIR)debugger/t_vb_arbprogram_sse.o \ $(MESATNLBUILDDIR)debugger/t_vb_fog.o \ $(MESATNLBUILDDIR)debugger/t_vb_cull.o \ $(MESATNLBUILDDIR)debugger/t_vb_light.o \ $(MESATNLBUILDDIR)debugger/t_vb_normals.o \ $(MESATNLBUILDDIR)debugger/t_vb_points.o \ $(MESATNLBUILDDIR)debugger/t_vb_program.o \ $(MESATNLBUILDDIR)debugger/t_vb_render.o \ $(MESATNLBUILDDIR)debugger/t_vb_texgen.o \ $(MESATNLBUILDDIR)debugger/t_vb_texmat.o \ $(MESATNLBUILDDIR)debugger/t_vb_vertex.o \ $(MESATNLBUILDDIR)debugger/t_vertex.o \ $(MESATNLBUILDDIR)debugger/t_vertex_generic.o \ $(MESATNLBUILDDIR)debugger/t_vertex_sse.o \ $(MESATNLBUILDDIR)debugger/t_vp_build.o \ $(MESATNLBUILDDIR)debugger/t_vtx_api.o \ $(MESATNLBUILDDIR)debugger/t_vtx_eval.o \ $(MESATNLBUILDDIR)debugger/t_vtx_exec.o \ $(MESATNLBUILDDIR)debugger/t_vtx_generic.o #if defined(i386Architecture) && MesaUseX86Asm MESA_TNL_DOBJS += $(MESATNLBUILDDIR)debugger/t_vtx_x86.o \ $(MESATNLBUILDDIR)debugger/t_vtx_x86_gcc.o #endif MESA_TNL_POBJS = $(MESATNLBUILDDIR)profiled/t_array_api.o \ $(MESATNLBUILDDIR)profiled/t_array_import.o \ $(MESATNLBUILDDIR)profiled/t_context.o \ $(MESATNLBUILDDIR)profiled/t_pipeline.o \ $(MESATNLBUILDDIR)profiled/t_save_api.o \ $(MESATNLBUILDDIR)profiled/t_save_loopback.o \ $(MESATNLBUILDDIR)profiled/t_save_playback.o \ $(MESATNLBUILDDIR)profiled/t_vb_arbprogram.o \ $(MESATNLBUILDDIR)profiled/t_vb_arbprogram_sse.o \ $(MESATNLBUILDDIR)profiled/t_vb_fog.o \ $(MESATNLBUILDDIR)profiled/t_vb_cull.o \ $(MESATNLBUILDDIR)profiled/t_vb_light.o \ $(MESATNLBUILDDIR)profiled/t_vb_normals.o \ $(MESATNLBUILDDIR)profiled/t_vb_points.o \ $(MESATNLBUILDDIR)profiled/t_vb_program.o \ $(MESATNLBUILDDIR)profiled/t_vb_render.o \ $(MESATNLBUILDDIR)profiled/t_vb_texgen.o \ $(MESATNLBUILDDIR)profiled/t_vb_texmat.o \ $(MESATNLBUILDDIR)profiled/t_vb_vertex.o \ $(MESATNLBUILDDIR)profiled/t_vertex.o \ $(MESATNLBUILDDIR)profiled/t_vertex_generic.o \ $(MESATNLBUILDDIR)profiled/t_vertex_sse.o \ $(MESATNLBUILDDIR)profiled/t_vp_build.o \ $(MESATNLBUILDDIR)profiled/t_vtx_api.o \ $(MESATNLBUILDDIR)profiled/t_vtx_eval.o \ $(MESATNLBUILDDIR)profiled/t_vtx_exec.o \ $(MESATNLBUILDDIR)profiled/t_vtx_generic.o #if defined(i386Architecture) && MesaUseX86Asm MESA_TNL_POBJS += $(MESATNLBUILDDIR)profiled/t_vtx_x86.o \ $(MESATNLBUILDDIR)profiled/t_vtx_x86_gcc.o #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/X/Imakefile0000644000000000000000000000305613614532331020046 0ustar #include #define NeedAllMesaSrc #define NeedToLinkMesaSrc #define MesaXBuildDir /**/ #define MesaInXServer #include "Imakefile.inc" LinkSourceFile(compsize.c,$(MESASRCDIR)/src/glx/x11) DRIVER_SRCS = $(XMESA_SRCS) DRIVER_OBJS = $(XMESA_OBJS) COMMON_SRCS = driverfuncs.c COMMON_OBJS = driverfuncs.o GLX_SRCS = xf86glx.c xf86glx_util.c compsize.c GLX_OBJS = xf86glx.o xf86glx_util.o compsize.o SRCS = $(DRIVER_SRCS) $(GLX_SRCS) $(COMMON_SRCS) OBJS = $(DRIVER_OBJS) $(GLX_OBJS) $(COMMON_OBJS) INCLUDES = -I$(SERVERSRC)/GL/mesa/X -I$(XINCLUDESRC) \ -I$(EXTINCSRC) \ -I$(MESASRCDIR)/src/mesa \ -I$(MESASRCDIR)/src/mesa/main \ -I$(MESASRCDIR)/src/mesa/glapi \ -I$(MESASRCDIR)/src/mesa/shader \ -I$(MESASRCDIR)/src -I$(MESASRCDIR)/src/mesa/drivers/x11 \ -I$(MESASRCDIR)/include \ -I$(LIBSRC)/GL/glx -I$(LIBSRC)/GL/include \ -I$(SERVERSRC)/include -I$(SERVERSRC)/GL/include \ -I$(SERVERSRC)/GL/glx \ -I$(XF86OSSRC) \ -I$(DRMSRCDIR)/shared-core \ `pkg-config --cflags-only-I pixman-1` DEFINES = $(GLX_DEFINES) $(GLXSRV_DEFINES) -DNXAGENT_SERVER /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ NormalLibraryObjectRule() SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) DependTarget() #ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif #ifndef MesaDrvSrcDir #define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri #endif MESADRVSRCDIR = MesaDrvSrcDir LinkSourceFile(driverfuncs.c, $(MESADRVSRCDIR)/../common) LinkSourceFile(driverfuncs.h, $(MESADRVSRCDIR)/../common) nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/X/Imakefile.inc0000644000000000000000000000607113614532331020616 0ustar MESAXBUILDDIR = MesaXBuildDir #ifndef MesaInXServer XMESA_GLX_SRCS = $(MESAXBUILDDIR)fakeglx.c \ $(MESAXBUILDDIR)glxapi.c \ $(MESAXBUILDDIR)realglx.c \ $(MESAXBUILDDIR)xfonts.c #endif XMESA_SRCS = $(XMESA_GLX_SRCS) \ $(MESAXBUILDDIR)xm_api.c \ $(MESAXBUILDDIR)xm_buffer.c \ $(MESAXBUILDDIR)xm_dd.c \ $(MESAXBUILDDIR)xm_line.c \ $(MESAXBUILDDIR)xm_span.c \ $(MESAXBUILDDIR)xm_tri.c #ifdef NeedToLinkMesaSrc #ifndef MesaInXServer LinkSourceFile(fakeglx.c, $(MESASRCDIR)/src/mesa/drivers/x11) LinkSourceFile(glxapi.c, $(MESASRCDIR)/src/mesa/drivers/x11) LinkSourceFile(glxapi.h, $(MESASRCDIR)/src/mesa/drivers/x11) LinkSourceFile(realglx.c, $(MESASRCDIR)/src/mesa/drivers/x11) LinkSourceFile(xfonts.c, $(MESASRCDIR)/src/mesa/drivers/x11) #endif LinkSourceFile(xm_api.c, $(MESASRCDIR)/src/mesa/drivers/x11) LinkSourceFile(xm_buffer.c, $(MESASRCDIR)/src/mesa/drivers/x11) LinkSourceFile(xm_dd.c, $(MESASRCDIR)/src/mesa/drivers/x11) LinkSourceFile(xm_line.c, $(MESASRCDIR)/src/mesa/drivers/x11) LinkSourceFile(xm_span.c, $(MESASRCDIR)/src/mesa/drivers/x11) LinkSourceFile(xm_tri.c, $(MESASRCDIR)/src/mesa/drivers/x11) #endif #ifndef MesaInXServer XMESA_GLX_OBJS = $(MESAXBUILDDIR)fakeglx.o \ $(MESAXBUILDDIR)glxapi.o \ $(MESAXBUILDDIR)realglx.o \ $(MESAXBUILDDIR)xfonts.o #endif XMESA_OBJS = $(XMESA_GLX_OBJS) \ $(MESAXBUILDDIR)xm_api.o \ $(MESAXBUILDDIR)xm_buffer.o \ $(MESAXBUILDDIR)xm_dd.o \ $(MESAXBUILDDIR)xm_line.o \ $(MESAXBUILDDIR)xm_span.o \ $(MESAXBUILDDIR)xm_tri.o #if defined(DoSharedLib) && DoSharedLib #ifndef MesaInXServer XMESA_GLX_UOBJS = $(MESAXBUILDDIR)unshared/fakeglx.o \ $(MESAXBUILDDIR)unshared/glxapi.o \ $(MESAXBUILDDIR)unshared/realglx.o \ $(MESAXBUILDDIR)unshared/xfonts.o #endif XMESA_UOBJS = $(XMESA_GLX_UOBJS) \ $(MESAXBUILDDIR)unshared/xm_api.o \ $(MESAXBUILDDIR)unshared/xm_buffer.o \ $(MESAXBUILDDIR)unshared/xm_dd.o \ $(MESAXBUILDDIR)unshared/xm_line.o \ $(MESAXBUILDDIR)unshared/xm_span.o \ $(MESAXBUILDDIR)unshared/xm_tri.o #else XMESA_GLX_UOBJS = $(XMESA_GLX_OBJS) XMESA_UOBJS = $(XMESA_OBJS) #endif #ifndef MesaInXServer XMESA_GLX_DOBJS = $(MESAXBUILDDIR)debugger/fakeglx.o \ $(MESAXBUILDDIR)debugger/glxapi.o \ $(MESAXBUILDDIR)debugger/realglx.o \ $(MESAXBUILDDIR)debugger/xfonts.o #endif XMESA_DOBJS = $(XMESA_GLX_DOBJS) \ $(MESAXBUILDDIR)debugger/xm_api.o \ $(MESAXBUILDDIR)debugger/xm_buffer.o \ $(MESAXBUILDDIR)debugger/xm_dd.o \ $(MESAXBUILDDIR)debugger/xm_line.o \ $(MESAXBUILDDIR)debugger/xm_span.o \ $(MESAXBUILDDIR)debugger/xm_tri.o #ifndef MesaInXServer XMESA_GLX_POBJS = $(MESAXBUILDDIR)profiled/fakeglx.o \ $(MESAXBUILDDIR)profiled/glxapi.o \ $(MESAXBUILDDIR)profiled/realglx.o \ $(MESAXBUILDDIR)profiled/xfonts.o #endif XMESA_POBJS = $(XMESA_GLX_POBJS) \ $(MESAXBUILDDIR)profiled/xm_api.o \ $(MESAXBUILDDIR)profiled/xm_buffer.o \ $(MESAXBUILDDIR)profiled/xm_dd.o \ $(MESAXBUILDDIR)profiled/xm_line.o \ $(MESAXBUILDDIR)profiled/xm_span.o \ $(MESAXBUILDDIR)profiled/xm_tri.o nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/X/xf86glx.c0000644000000000000000000006657413614532331017725 0ustar /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Kevin E. Martin * Brian E. Paul * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include "xf86glxint.h" #include "context.h" #include "xmesaP.h" #include "context.h" /* * This define is for the glcore.h header file. * If you add it here, then make sure you also add it in * ../../../glx/Imakefile. */ #if 0 #define DEBUG #include #undef DEBUG #else #include #endif #include "glcontextmodes.h" #ifdef NXAGENT_SERVER #include "../main/WSDrawBuffer.h" #endif /* * This structure is statically allocated in the __glXScreens[] * structure. This struct is not used anywhere other than in * __glXScreenInit to initialize each of the active screens * (__glXActiveScreens[]). Several of the fields must be initialized by * the screenProbe routine before they are copied to the active screens * struct. In particular, the contextCreate, pGlxVisual, numVisuals, * and numUsableVisuals fields must be initialized. */ static __GLXscreenInfo __glDDXScreenInfo = { __MESA_screenProbe, /* Must be generic and handle all screens */ __MESA_createContext, /* Substitute screen's createContext routine */ __MESA_createBuffer, /* Substitute screen's createBuffer routine */ NULL, /* Set up modes in probe */ NULL, /* Set up pVisualPriv in probe */ 0, /* Set up numVisuals in probe */ 0, /* Set up numUsableVisuals in probe */ NULL, /* GLextensions is overwritten by __glXScreenInit */ "Vendor String", /* GLXvendor is overwritten by __glXScreenInit */ "Version String", /* GLXversion is overwritten by __glXScreenInit */ "Extensions String", /* GLXextensions is overwritten by __glXScreenInit */ NULL /* WrappedPositionWindow is overwritten */ }; #ifdef NXAGENT_SERVER WSDrawBufferPtr pWSDrawBuffer = NULL; void AddWSDrawBuffer(GLframebuffer *mesa_buffer) { WSDrawBufferPtr prevWSDB; WSDrawBufferPtr newWSDB; WSDrawBufferPtr p; prevWSDB = NULL; newWSDB = NULL; p = pWSDrawBuffer; while (p != NULL) { prevWSDB = p; if (prevWSDB -> DrawBuffer == mesa_buffer) { return; } p = p -> next; } newWSDB = malloc(sizeof(WSDrawBufferRec)); newWSDB -> DrawBuffer = mesa_buffer; newWSDB -> next = NULL; if (pWSDrawBuffer == NULL) pWSDrawBuffer = newWSDB; else prevWSDB -> next = newWSDB; } #endif void *__glXglDDXScreenInfo(void) { return &__glDDXScreenInfo; } static __GLXextensionInfo __glDDXExtensionInfo = { GL_CORE_MESA, __MESA_resetExtension, __MESA_initVisuals, __MESA_setVisualConfigs }; void *__glXglDDXExtensionInfo(void) { return &__glDDXExtensionInfo; } static __MESA_screen MESAScreens[MAXSCREENS]; static __GLcontext *MESA_CC = NULL; static int numConfigs = 0; static __GLXvisualConfig *visualConfigs = NULL; static void **visualPrivates = NULL; static int count_bits(unsigned int n) { int bits = 0; while (n > 0) { if (n & 1) bits++; n >>= 1; } return bits; } static XMesaVisual find_mesa_visual(int screen, VisualID vid) { __MESA_screen * const pMScr = &MESAScreens[screen]; const __GLcontextModes *modes; unsigned i = 0; for ( modes = pMScr->modes ; modes != NULL ; modes = modes->next ) { if ( modes->visualID == vid ) { break; } i++; } return (modes != NULL) ? pMScr->xm_vis[i] : NULL; } /* * In the case the driver defines no GLX visuals we'll use these. * Note that for TrueColor and DirectColor visuals, bufferSize is the * sum of redSize, greenSize, blueSize and alphaSize, which may be larger * than the nplanes/rootDepth of the server's X11 visuals */ #define NUM_FALLBACK_CONFIGS 5 static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { /* [0] = RGB, double buffered, Z */ { -1, /* vid */ -1, /* class */ True, /* rgba */ -1, -1, -1, 0, /* rgba sizes */ -1, -1, -1, 0, /* rgba masks */ 0, 0, 0, 0, /* rgba accum sizes */ True, /* doubleBuffer */ False, /* stereo */ -1, /* bufferSize */ 16, /* depthSize */ 0, /* stencilSize */ 0, /* auxBuffers */ 0, /* level */ GLX_NONE, /* visualRating */ GLX_NONE, /* transparentPixel */ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ 0 /* transparentIndex */ }, /* [1] = RGB, double buffered, Z, stencil, accum */ { -1, /* vid */ -1, /* class */ True, /* rgba */ -1, -1, -1, 0, /* rgba sizes */ -1, -1, -1, 0, /* rgba masks */ 16, 16, 16, 0, /* rgba accum sizes */ True, /* doubleBuffer */ False, /* stereo */ -1, /* bufferSize */ 16, /* depthSize */ 8, /* stencilSize */ 0, /* auxBuffers */ 0, /* level */ GLX_NONE, /* visualRating */ GLX_NONE, /* transparentPixel */ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ 0 /* transparentIndex */ }, /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */ { -1, /* vid */ -1, /* class */ True, /* rgba */ -1, -1, -1, 8, /* rgba sizes */ -1, -1, -1, -1, /* rgba masks */ 16, 16, 16, 16, /* rgba accum sizes */ True, /* doubleBuffer */ False, /* stereo */ -1, /* bufferSize */ 16, /* depthSize */ 8, /* stencilSize */ 0, /* auxBuffers */ 0, /* level */ GLX_NONE, /* visualRating */ GLX_NONE, /* transparentPixel */ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ 0 /* transparentIndex */ }, /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */ { -1, /* vid */ -1, /* class */ True, /* rgba */ -1, -1, -1, 8, /* rgba sizes */ -1, -1, -1, -1, /* rgba masks */ 16, 16, 16, 16, /* rgba accum sizes */ False, /* doubleBuffer */ False, /* stereo */ -1, /* bufferSize */ 16, /* depthSize */ 8, /* stencilSize */ 0, /* auxBuffers */ 0, /* level */ GLX_NONE, /* visualRating */ GLX_NONE, /* transparentPixel */ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ 0 /* transparentIndex */ }, /* [4] = CI, double buffered, Z */ { -1, /* vid */ -1, /* class */ False, /* rgba? (false = color index) */ -1, -1, -1, 0, /* rgba sizes */ -1, -1, -1, 0, /* rgba masks */ 0, 0, 0, 0, /* rgba accum sizes */ True, /* doubleBuffer */ False, /* stereo */ -1, /* bufferSize */ 16, /* depthSize */ 0, /* stencilSize */ 0, /* auxBuffers */ 0, /* level */ GLX_NONE, /* visualRating */ GLX_NONE, /* transparentPixel */ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ 0 /* transparentIndex */ }, }; static Bool init_visuals(int *nvisualp, VisualPtr *visualp, VisualID *defaultVisp, int ndepth, DepthPtr pdepth, int rootDepth) { int numRGBconfigs; int numCIconfigs; int numVisuals = *nvisualp; int numNewVisuals; int numNewConfigs; VisualPtr pVisual = *visualp; VisualPtr pVisualNew = NULL; VisualID *orig_vid = NULL; __GLcontextModes *modes; __GLXvisualConfig *pNewVisualConfigs = NULL; void **glXVisualPriv; void **pNewVisualPriv; int found_default; int i, j, k; if (numConfigs > 0) numNewConfigs = numConfigs; else numNewConfigs = NUM_FALLBACK_CONFIGS; /* Alloc space for the list of new GLX visuals */ pNewVisualConfigs = (__GLXvisualConfig *) malloc(numNewConfigs * sizeof(__GLXvisualConfig)); if (!pNewVisualConfigs) { return FALSE; } /* Alloc space for the list of new GLX visual privates */ pNewVisualPriv = (void **) malloc(numNewConfigs * sizeof(void *)); if (!pNewVisualPriv) { free(pNewVisualConfigs); return FALSE; } /* ** If SetVisualConfigs was not called, then use default GLX ** visual configs. */ if (numConfigs == 0) { memcpy(pNewVisualConfigs, FallbackConfigs, NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); } else { /* copy driver's visual config info */ for (i = 0; i < numConfigs; i++) { pNewVisualConfigs[i] = visualConfigs[i]; pNewVisualPriv[i] = visualPrivates[i]; } } /* Count the number of RGB and CI visual configs */ numRGBconfigs = 0; numCIconfigs = 0; for (i = 0; i < numNewConfigs; i++) { if (pNewVisualConfigs[i].rgba) numRGBconfigs++; else numCIconfigs++; } /* Count the total number of visuals to compute */ numNewVisuals = 0; for (i = 0; i < numVisuals; i++) { numNewVisuals += (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor) ? numRGBconfigs : numCIconfigs; } /* Reset variables for use with the next screen/driver's visual configs */ visualConfigs = NULL; numConfigs = 0; /* Alloc temp space for the list of orig VisualIDs for each new visual */ orig_vid = (VisualID *)malloc(numNewVisuals * sizeof(VisualID)); if (!orig_vid) { free(pNewVisualPriv); free(pNewVisualConfigs); return FALSE; } /* Alloc space for the list of glXVisuals */ modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); if (modes == NULL) { free(orig_vid); free(pNewVisualPriv); free(pNewVisualConfigs); return FALSE; } /* Alloc space for the list of glXVisualPrivates */ glXVisualPriv = (void **)malloc(numNewVisuals * sizeof(void *)); if (!glXVisualPriv) { _gl_context_modes_destroy( modes ); free(orig_vid); free(pNewVisualPriv); free(pNewVisualConfigs); return FALSE; } /* Alloc space for the new list of the X server's visuals */ pVisualNew = (VisualPtr)malloc(numNewVisuals * sizeof(VisualRec)); if (!pVisualNew) { free(glXVisualPriv); _gl_context_modes_destroy( modes ); free(orig_vid); free(pNewVisualPriv); free(pNewVisualConfigs); return FALSE; } /* Initialize the new visuals */ found_default = FALSE; MESAScreens[screenInfo.numScreens-1].modes = modes; for (i = j = 0; i < numVisuals; i++) { int is_rgb = (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor); for (k = 0; k < numNewConfigs; k++) { if (pNewVisualConfigs[k].rgba != is_rgb) continue; assert( modes != NULL ); /* Initialize the new visual */ pVisualNew[j] = pVisual[i]; pVisualNew[j].vid = FakeClientID(0); /* Check for the default visual */ if (!found_default && pVisual[i].vid == *defaultVisp) { *defaultVisp = pVisualNew[j].vid; found_default = TRUE; } /* Save the old VisualID */ orig_vid[j] = pVisual[i].vid; /* Initialize the glXVisual */ _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); modes->visualID = pVisualNew[j].vid; /* * If the class is -1, then assume the X visual information * is identical to what GLX needs, and take them from the X * visual. NOTE: if class != -1, then all other fields MUST * be initialized. */ if (modes->visualType == GLX_NONE) { modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); modes->redBits = count_bits(pVisual[i].redMask); modes->greenBits = count_bits(pVisual[i].greenMask); modes->blueBits = count_bits(pVisual[i].blueMask); modes->alphaBits = modes->alphaBits; modes->redMask = pVisual[i].redMask; modes->greenMask = pVisual[i].greenMask; modes->blueMask = pVisual[i].blueMask; modes->alphaMask = modes->alphaMask; modes->rgbBits = (is_rgb) ? (modes->redBits + modes->greenBits + modes->blueBits + modes->alphaBits) : rootDepth; } /* Save the device-dependent private for this visual */ glXVisualPriv[j] = pNewVisualPriv[k]; j++; modes = modes->next; } } assert(j <= numNewVisuals); /* Save the GLX visuals in the screen structure */ MESAScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; MESAScreens[screenInfo.numScreens-1].private = glXVisualPriv; /* Set up depth's VisualIDs */ for (i = 0; i < ndepth; i++) { int numVids = 0; VisualID *pVids = NULL; int k, n = 0; /* Count the new number of VisualIDs at this depth */ for (j = 0; j < pdepth[i].numVids; j++) for (k = 0; k < numNewVisuals; k++) if (pdepth[i].vids[j] == orig_vid[k]) numVids++; /* Allocate a new list of VisualIDs for this depth */ pVids = (VisualID *)malloc(numVids * sizeof(VisualID)); /* Initialize the new list of VisualIDs for this depth */ for (j = 0; j < pdepth[i].numVids; j++) for (k = 0; k < numNewVisuals; k++) if (pdepth[i].vids[j] == orig_vid[k]) pVids[n++] = pVisualNew[k].vid; /* Update this depth's list of VisualIDs */ free(pdepth[i].vids); pdepth[i].vids = pVids; pdepth[i].numVids = numVids; } /* Update the X server's visuals */ *nvisualp = numNewVisuals; *visualp = pVisualNew; /* Free the old list of the X server's visuals */ free(pVisual); /* Clean up temporary allocations */ free(orig_vid); free(pNewVisualPriv); free(pNewVisualConfigs); /* Free the private list created by DDX HW driver */ if (visualPrivates) free(visualPrivates); visualPrivates = NULL; return TRUE; } void __MESA_setVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **privates) { numConfigs = nconfigs; visualConfigs = configs; visualPrivates = privates; } Bool __MESA_initVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp, int *ndepthp, int *rootDepthp, VisualID *defaultVisp, unsigned long sizes, int bitsPerRGB) { /* * Setup the visuals supported by this particular screen. */ return init_visuals(nvisualp, visualp, defaultVisp, *ndepthp, *depthp, *rootDepthp); } static void fixup_visuals(int screen) { ScreenPtr pScreen = screenInfo.screens[screen]; __MESA_screen *pMScr = &MESAScreens[screen]; int j; __GLcontextModes *modes; for ( modes = pMScr->modes ; modes != NULL ; modes = modes->next ) { const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); const int nplanes = (modes->rgbBits - modes->alphaBits); const VisualPtr pVis = pScreen->visuals; /* Find a visual that matches the GLX visual's class and size */ for (j = 0; j < pScreen->numVisuals; j++) { if (pVis[j].class == vis_class && pVis[j].nplanes == nplanes) { /* Fixup the masks */ modes->redMask = pVis[j].redMask; modes->greenMask = pVis[j].greenMask; modes->blueMask = pVis[j].blueMask; /* Recalc the sizes */ modes->redBits = count_bits(modes->redMask); modes->greenBits = count_bits(modes->greenMask); modes->blueBits = count_bits(modes->blueMask); } } } } static void init_screen_visuals(int screen) { ScreenPtr pScreen = screenInfo.screens[screen]; __GLcontextModes *modes; XMesaVisual *pXMesaVisual; int *used; int i, j; /* Alloc space for the list of XMesa visuals */ pXMesaVisual = (XMesaVisual *)malloc(MESAScreens[screen].num_vis * sizeof(XMesaVisual)); memset(pXMesaVisual, 0, MESAScreens[screen].num_vis * sizeof(XMesaVisual)); /* FIXME: Change 'used' to be a array of bits (rather than of ints), * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less * FIXME: than 64 or 128 the stack array can be used instead of calling * FIXME: malloc / free. If nothing else, convert 'used' to * FIXME: array of bytes instead of ints! */ used = (int *)malloc(pScreen->numVisuals * sizeof(int)); memset(used, 0, pScreen->numVisuals * sizeof(int)); i = 0; for ( modes = MESAScreens[screen].modes ; modes != NULL ; modes = modes->next ) { const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); const int nplanes = (modes->rgbBits - modes->alphaBits); const VisualPtr pVis = pScreen->visuals; for (j = 0; j < pScreen->numVisuals; j++) { if (pVis[j].class == vis_class && pVis[j].nplanes == nplanes && pVis[j].redMask == modes->redMask && pVis[j].greenMask == modes->greenMask && pVis[j].blueMask == modes->blueMask && !used[j]) { /* Create the XMesa visual */ pXMesaVisual[i] = XMesaCreateVisual(pScreen, pVis, modes->rgbMode, (modes->alphaBits > 0), modes->doubleBufferMode, modes->stereoMode, GL_TRUE, /* ximage_flag */ modes->depthBits, modes->stencilBits, modes->accumRedBits, modes->accumGreenBits, modes->accumBlueBits, modes->accumAlphaBits, modes->samples, modes->level, modes->visualRating); /* Set the VisualID */ modes->visualID = pVis[j].vid; /* Mark this visual used */ used[j] = 1; break; } } if ( j == pScreen->numVisuals ) { ErrorF("No matching visual for __GLcontextMode with " "visual class = %d (%d), nplanes = %u\n", vis_class, modes->visualType, (modes->rgbBits - modes->alphaBits) ); } else if ( modes->visualID == -1 ) { FatalError( "Matching visual found, but visualID still -1!\n" ); } i++; } free(used); MESAScreens[screen].xm_vis = pXMesaVisual; } Bool __MESA_screenProbe(int screen) { /* * Set up the current screen's visuals. */ __glDDXScreenInfo.modes = MESAScreens[screen].modes; __glDDXScreenInfo.pVisualPriv = MESAScreens[screen].private; __glDDXScreenInfo.numVisuals = __glDDXScreenInfo.numUsableVisuals = MESAScreens[screen].num_vis; /* * Set the current screen's createContext routine. This could be * wrapped by a DDX GLX context creation routine. */ __glDDXScreenInfo.createContext = __MESA_createContext; /* * The ordering of the rgb compenents might have been changed by the * driver after mi initialized them. */ fixup_visuals(screen); /* * Find the GLX visuals that are supported by this screen and create * XMesa's visuals. */ init_screen_visuals(screen); return TRUE; } extern void __MESA_resetExtension(void) { int i, j; XMesaReset(); for (i = 0; i < screenInfo.numScreens; i++) { for (j = 0; j < MESAScreens[i].num_vis; j++) { if (MESAScreens[i].xm_vis[j]) { XMesaDestroyVisual(MESAScreens[i].xm_vis[j]); MESAScreens[i].xm_vis[j] = NULL; } } _gl_context_modes_destroy( MESAScreens[i].modes ); MESAScreens[i].modes = NULL; free(MESAScreens[i].private); MESAScreens[i].private = NULL; free(MESAScreens[i].xm_vis); MESAScreens[i].xm_vis = NULL; MESAScreens[i].num_vis = 0; } __glDDXScreenInfo.modes = NULL; MESA_CC = NULL; } void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv) { DrawablePtr pDraw = glxPriv->pDraw; XMesaVisual xm_vis = find_mesa_visual(pDraw->pScreen->myNum, glxPriv->modes->visualID); __GLdrawablePrivate *glPriv = &glxPriv->glPriv; __MESA_buffer buf; if (xm_vis == NULL) { ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n", glxPriv->modes->visualID); } buf = (__MESA_buffer)malloc(sizeof(struct __MESA_bufferRec)); /* Create Mesa's buffers */ if (glxPriv->type == DRAWABLE_WINDOW) { buf->xm_buf = (void *)XMesaCreateWindowBuffer(xm_vis, (WindowPtr)pDraw); } else { buf->xm_buf = (void *)XMesaCreatePixmapBuffer(xm_vis, (PixmapPtr)pDraw, 0); } /* Wrap the front buffer's resize routine */ buf->fbresize = glPriv->frontBuffer.resize; glPriv->frontBuffer.resize = __MESA_resizeBuffers; /* Wrap the swap buffers routine */ buf->fbswap = glxPriv->swapBuffers; glxPriv->swapBuffers = __MESA_swapBuffers; /* Save Mesa's private buffer structure */ glPriv->private = (void *)buf; glPriv->freePrivate = __MESA_destroyBuffer; } GLboolean __MESA_resizeBuffers(__GLdrawableBuffer *buffer, GLint x, GLint y, GLuint width, GLuint height, __GLdrawablePrivate *glPriv, GLuint bufferMask) { __MESA_buffer buf = (__MESA_buffer)glPriv->private; if (buf->xm_buf) XMesaResizeBuffers(buf->xm_buf); return (*buf->fbresize)(buffer, x, y, width, height, glPriv, bufferMask); } GLboolean __MESA_swapBuffers(__GLXdrawablePrivate *glxPriv) { __MESA_buffer buf = (__MESA_buffer)glxPriv->glPriv.private; /* ** Do not call the wrapped swap buffers routine since Mesa has ** already done the swap. */ XMesaSwapBuffers(buf->xm_buf); return GL_TRUE; } void __MESA_destroyBuffer(__GLdrawablePrivate *glPriv) { __MESA_buffer buf = (__MESA_buffer)glPriv->private; __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other; #ifdef NXAGENT_SERVER AddWSDrawBuffer(& (buf -> xm_buf -> mesa_buffer) ); #endif /* Destroy Mesa's buffers */ if (buf->xm_buf) XMesaDestroyBuffer(buf->xm_buf); /* Unwrap these routines */ glxPriv->swapBuffers = buf->fbswap; glPriv->frontBuffer.resize = buf->fbresize; free(glPriv->private); glPriv->private = NULL; } __GLinterface *__MESA_createContext(__GLimports *imports, __GLcontextModes *modes, __GLinterface *shareGC) { __GLcontext *gl_ctx = NULL; __GLcontext *m_share = NULL; __GLXcontext *glxc = (__GLXcontext *)imports->other; XMesaVisual xm_vis; if (shareGC) m_share = (__GLcontext *)shareGC; xm_vis = find_mesa_visual(glxc->pScreen->myNum, glxc->modes->visualID); if (xm_vis) { XMesaContext xmshare = m_share ? m_share->DriverCtx : 0; XMesaContext xmctx = XMesaCreateContext(xm_vis, xmshare); gl_ctx = xmctx ? &xmctx->mesa : 0; } else { ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n", glxc->modes->visualID); } if (!gl_ctx) return NULL; gl_ctx->imports = *imports; gl_ctx->exports.destroyContext = __MESA_destroyContext; gl_ctx->exports.loseCurrent = __MESA_loseCurrent; gl_ctx->exports.makeCurrent = __MESA_makeCurrent; gl_ctx->exports.shareContext = __MESA_shareContext; gl_ctx->exports.copyContext = __MESA_copyContext; gl_ctx->exports.forceCurrent = __MESA_forceCurrent; gl_ctx->exports.notifyResize = __MESA_notifyResize; gl_ctx->exports.notifyDestroy = __MESA_notifyDestroy; gl_ctx->exports.notifySwapBuffers = __MESA_notifySwapBuffers; gl_ctx->exports.dispatchExec = __MESA_dispatchExec; gl_ctx->exports.beginDispatchOverride = __MESA_beginDispatchOverride; gl_ctx->exports.endDispatchOverride = __MESA_endDispatchOverride; return (__GLinterface *)gl_ctx; } GLboolean __MESA_destroyContext(__GLcontext *gc) { XMesaContext xmesa = (XMesaContext) gc->DriverCtx; XMesaDestroyContext( xmesa ); return GL_TRUE; } GLboolean __MESA_loseCurrent(__GLcontext *gc) { XMesaContext xmesa = (XMesaContext) gc->DriverCtx; MESA_CC = NULL; __glXLastContext = NULL; return XMesaLoseCurrent(xmesa); } GLboolean __MESA_makeCurrent(__GLcontext *gc) { __GLdrawablePrivate *drawPriv = gc->imports.getDrawablePrivate( gc ); __MESA_buffer drawBuf = (__MESA_buffer)drawPriv->private; __GLdrawablePrivate *readPriv = gc->imports.getReadablePrivate( gc ); __MESA_buffer readBuf = (__MESA_buffer)readPriv->private; XMesaContext xmesa = (XMesaContext) gc->DriverCtx; MESA_CC = gc; return XMesaMakeCurrent2(xmesa, drawBuf->xm_buf, readBuf->xm_buf); } GLboolean __MESA_shareContext(__GLcontext *gc, __GLcontext *gcShare) { /* NOT_DONE */ /* XXX I don't see where/how this could ever be called */ ErrorF("__MESA_shareContext\n"); return GL_FALSE; } GLboolean __MESA_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask) { XMesaContext xm_dst = (XMesaContext) dst->DriverCtx; const XMesaContext xm_src = (const XMesaContext) src->DriverCtx; _mesa_copy_context(&xm_src->mesa, &xm_dst->mesa, mask); return GL_TRUE; } GLboolean __MESA_forceCurrent(__GLcontext *gc) { XMesaContext xmesa = (XMesaContext) gc->DriverCtx; MESA_CC = gc; return XMesaForceCurrent(xmesa); } GLboolean __MESA_notifyResize(__GLcontext *gc) { /* NOT_DONE */ ErrorF("__MESA_notifyResize\n"); return GL_FALSE; } void __MESA_notifyDestroy(__GLcontext *gc) { /* NOT_DONE */ ErrorF("__MESA_notifyDestroy\n"); return; } void __MESA_notifySwapBuffers(__GLcontext *gc) { _mesa_notifySwapBuffers(gc); } struct __GLdispatchStateRec *__MESA_dispatchExec(__GLcontext *gc) { /* NOT_DONE */ ErrorF("__MESA_dispatchExec\n"); return NULL; } void __MESA_beginDispatchOverride(__GLcontext *gc) { /* NOT_DONE */ ErrorF("__MESA_beginDispatchOverride\n"); return; } void __MESA_endDispatchOverride(__GLcontext *gc) { /* NOT_DONE */ ErrorF("__MESA_endDispatchOverride\n"); return; } /* * Server-side GLX uses these functions which are normally defined * in the OpenGL SI. */ GLuint __glFloorLog2(GLuint val) { int c = 0; while (val > 1) { c++; val >>= 1; } return c; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/X/xf86glxint.h0000644000000000000000000000727213614532331020433 0ustar /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Kevin E. Martin * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _XF86GLXINT_H_ #define _XF86GLXINT_H_ #include #include #include typedef struct __MESA_screenRec __MESA_screen; struct __MESA_screenRec { int num_vis; __GLcontextModes *modes; XMesaVisual *xm_vis; void **private; }; typedef struct __MESA_bufferRec *__MESA_buffer; struct __MESA_bufferRec { XMesaBuffer xm_buf; GLboolean (*fbresize)(__GLdrawableBuffer *buf, GLint x, GLint y, GLuint width, GLuint height, __GLdrawablePrivate *glPriv, GLuint bufferMask); GLboolean (*fbswap)(__GLXdrawablePrivate *glxPriv); }; extern void __MESA_setVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **privates); extern Bool __MESA_initVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp, int *ndepthp, int *rootDepthp, VisualID *defaultVisp, unsigned long sizes, int bitsPerRGB); extern Bool __MESA_screenProbe(int screen); extern void __MESA_resetExtension(void); extern void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv); extern GLboolean __MESA_resizeBuffers(__GLdrawableBuffer *buf, GLint x, GLint y, GLuint width, GLuint height, __GLdrawablePrivate *glPriv, GLuint bufferMask); extern GLboolean __MESA_swapBuffers(__GLXdrawablePrivate *glxPriv); extern void __MESA_destroyBuffer(__GLdrawablePrivate *glPriv); extern __GLinterface *__MESA_createContext(__GLimports *imports, __GLcontextModes *modes, __GLinterface *shareGC); extern GLboolean __MESA_destroyContext(__GLcontext *gc); extern GLboolean __MESA_loseCurrent(__GLcontext *gc); extern GLboolean __MESA_makeCurrent(__GLcontext *gc); extern GLboolean __MESA_shareContext(__GLcontext *gc, __GLcontext *gcShare); extern GLboolean __MESA_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask); extern GLboolean __MESA_forceCurrent(__GLcontext *gc); extern GLboolean __MESA_notifyResize(__GLcontext *gc); extern void __MESA_notifyDestroy(__GLcontext *gc); extern void __MESA_notifySwapBuffers(__GLcontext *gc); extern struct __GLdispatchStateRec *__MESA_dispatchExec(__GLcontext *gc); extern void __MESA_beginDispatchOverride(__GLcontext *gc); extern void __MESA_endDispatchOverride(__GLcontext *gc); extern GLuint __glFloorLog2(GLuint val); #endif /* _XF86GLXINT_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c0000644000000000000000000000757313614532331020754 0ustar /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Kevin E. Martin * Brian Paul */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "pixmapstr.h" #include "xf86glx_util.h" #include #ifdef ROUNDUP #undef ROUNDUP #endif #define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3)) XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height, char *data) { XMesaImage *image; image = (XMesaImage *)malloc(sizeof(XMesaImage)); if (image) { image->width = width; image->height = height; image->data = data; /* Always pad to 32 bits */ image->bytes_per_line = ROUNDUP((bitsPerPixel * width), 32); image->bits_per_pixel = bitsPerPixel; } return image; } void XMesaDestroyImage(XMesaImage *image) { if (image->data) free(image->data); free(image); } unsigned long XMesaGetPixel(XMesaImage *image, int x, int y) { CARD8 *row = (CARD8 *)(image->data + y*image->bytes_per_line); CARD8 *i8; CARD16 *i16; CARD32 *i32; switch (image->bits_per_pixel) { case 8: i8 = (CARD8 *)row; return i8[x]; break; case 15: case 16: i16 = (CARD16 *)row; return i16[x]; break; case 24: /* WARNING: architecture specific code */ i8 = (CARD8 *)row; return (((CARD32)i8[x*3]) | (((CARD32)i8[x*3+1])<<8) | (((CARD32)i8[x*3+2])<<16)); break; case 32: i32 = (CARD32 *)row; return i32[x]; break; } return 0; } #ifndef XMESA_USE_PUTPIXEL_MACRO void XMesaPutPixel(XMesaImage *image, int x, int y, unsigned long pixel) { CARD8 *row = (CARD8 *)(image->data + y*image->bytes_per_line); CARD8 *i8; CARD16 *i16; CARD32 *i32; switch (image->bits_per_pixel) { case 8: i8 = (CARD8 *)row; i8[x] = (CARD8)pixel; break; case 15: case 16: i16 = (CARD16 *)row; i16[x] = (CARD16)pixel; break; case 24: /* WARNING: architecture specific code */ i8 = (CARD8 *)__row; i8[x*3] = (CARD8)(p); i8[x*3+1] = (CARD8)(p>>8); i8[x*3+2] = (CARD8)(p>>16); case 32: i32 = (CARD32 *)row; i32[x] = (CARD32)pixel; break; } } #endif void XMesaPutImageHelper(ScreenPtr display, DrawablePtr d, GCPtr gc, XMesaImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height) { /* NOT_DONE: Verify that the following works for all depths */ char *src = (image->data + src_y * image->bytes_per_line + ((src_x * image->bits_per_pixel) >> 3)); ValidateGC(d, gc); (*gc->ops->PutImage)(d, gc, d->depth, dest_x, dest_y, width, height, 0, ZPixmap, src); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.h0000644000000000000000000000603013614532331020744 0ustar /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /* * Authors: * Kevin E. Martin * Brian Paul */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _XF86GLX_UTIL_H_ #define _XF86GLX_UTIL_H_ #ifdef __CYGWIN__ #undef WIN32 #undef _WIN32 #endif #include #include #include #include "GL/xmesa.h" #define XMESA_USE_PUTPIXEL_MACRO struct _XMesaImageRec { int width, height; char *data; int bytes_per_line; /* Padded to 32 bits */ int bits_per_pixel; }; extern XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height, char *data); extern void XMesaDestroyImage(XMesaImage *image); extern unsigned long XMesaGetPixel(XMesaImage *image, int x, int y); #ifdef XMESA_USE_PUTPIXEL_MACRO #define XMesaPutPixel(__i,__x,__y,__p) \ { \ CARD8 *__row = (CARD8 *)(__i->data + __y*__i->bytes_per_line); \ CARD8 *__i8; \ CARD16 *__i16; \ CARD32 *__i32; \ switch (__i->bits_per_pixel) { \ case 8: \ __i8 = (CARD8 *)__row; \ __i8[__x] = (CARD8)__p; \ break; \ case 15: \ case 16: \ __i16 = (CARD16 *)__row; \ __i16[__x] = (CARD16)__p; \ break; \ case 24: /* WARNING: architecture specific code */ \ __i8 = (CARD8 *)__row; \ __i8[__x*3] = (CARD8)(__p); \ __i8[__x*3+1] = (CARD8)(__p>>8); \ __i8[__x*3+2] = (CARD8)(__p>>16); \ break; \ case 32: \ __i32 = (CARD32 *)__row; \ __i32[__x] = (CARD32)__p; \ break; \ } \ } #else extern void XMesaPutPixel(XMesaImage *image, int x, int y, unsigned long pixel); #endif extern void XMesaPutImageHelper(ScreenPtr display, DrawablePtr d, GCPtr gc, XMesaImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height); #endif /* _XF86GLX_UTIL_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Agent.h0000644000000000000000000001144013614532331020064 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright (c) 1995 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef __Agent_H__ #define __Agent_H__ /* * Machines with a 64 bit library interface and a 32 bit * server require name changes to protect the guilty. */ #ifdef _XSERVER64 #define _XSERVER64_tmp #undef _XSERVER64 typedef unsigned long XID64; typedef unsigned long Mask64; typedef unsigned long Atom64; typedef unsigned long VisualID64; typedef unsigned long Time64; #define XID XID64 #define Mask Mask64 #define Atom Atom64 #define VisualID VisualID64 #define Time Time64 typedef XID Window64; typedef XID Drawable64; typedef XID Font64; typedef XID Pixmap64; typedef XID Cursor64; typedef XID Colormap64; typedef XID GContext64; typedef XID KeySym64; #define Window Window64 #define Drawable Drawable64 #define Font Font64 #define Pixmap Pixmap64 #define Cursor Cursor64 #define Colormap Colormap64 #define GContext GContext64 #define KeySym KeySym64 #define XlibAtom Atom64 #define XlibWindow Window64 #define XlibPixmap Pixmap64 #define XlibFont Font64 #define XlibKeySym KeySym64 #define XlibXID XID64 #else /*_XSERVER64*/ #define XlibAtom Atom #define XlibWindow Window #define XlibPixmap Pixmap #define XlibFont Font #define XlibKeySym KeySym #define XlibXID XID #endif /*_XSERVER64*/ #define NX_TRANS_SOCKET #define GC XlibGC #include #include #undef GC #ifdef _XSERVER64_tmp #define _XSERVER64 #undef _XSERVER64_tmp #undef XID #undef Mask #undef Atom #undef VisualID #undef Time #undef Window #undef Drawable #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef KeySym #endif /*_XSERVER64_tmp*/ #endif /* __Agent_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Args.c0000644000000000000000000016720313614532331017726 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #include #include #include #include #ifdef __sun #include #endif #include "X.h" #include "Xproto.h" #include "screenint.h" #include "input.h" #include "misc.h" #include "globals.h" #include "scrnintstr.h" #include "dixstruct.h" #include "servermd.h" #include "opaque.h" #include "Init.h" #include "Agent.h" #include "Display.h" #include "Args.h" #include "Options.h" #include "Binder.h" #include "Trap.h" #include "Screen.h" #include "Image.h" #ifdef RENDER #include "Render.h" #endif #include "Handlers.h" #include "Error.h" #include "Reconnect.h" #include "Utils.h" /* * NX includes and definitions. */ #include "compext/Compext.h" #include /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG #undef WATCH #ifdef WATCH #include "unistd.h" #endif #ifdef PANORAMIX #define PANORAMIX_DISABLED_COND (noPanoramiXExtension || PanoramiXExtensionDisabledHack) #else #define PANORAMIX_DISABLED_COND TRUE #endif #ifdef RANDR #define RRXINERAMA_DISABLED_COND noRRXineramaExtension #else #define RRXINERAMA_DISABLED_COND TRUE #endif /* * Define this to force the dispatcher * to always use the dumb scheduler. */ #undef DISABLE_SMART_SCHEDULE int nxagentUserDefinedFontPath = 0; /* * From X11/ImUtil.c. */ extern int _XGetBitsPerPixel(Display *dpy, int depth); extern char dispatchExceptionAtReset; const char *nxagentProgName = NULL; char nxagentDisplayName[NXAGENTDISPLAYNAMELENGTH]; Bool nxagentSynchronize = False; Bool nxagentRealWindowProp = False; Bool nxagentAutoDPI = False; char nxagentShadowDisplayName[NXAGENTSHADOWDISPLAYNAMELENGTH] = {0}; char nxagentWindowName[NXAGENTWINDOWNAMELENGTH]; char nxagentDialogName[NXAGENTDIALOGNAMELENGTH]; char nxagentSessionId[NXAGENTSESSIONIDLENGTH] = {0}; char *nxagentOptionsFilenameOrString; Bool nxagentFullGeneration = False; int nxagentDefaultClass = TrueColor; Bool nxagentUserDefaultClass = False; int nxagentDefaultDepth; Bool nxagentUserDefaultDepth = False; struct UserGeometry nxagentUserGeometry = {0, 0, 0, 0, 0}; Bool nxagentUserBorderWidth = False; int nxagentNumScreens = 0; Bool nxagentReportWindowIds = False; Bool nxagentReportPrivateWindowIds = False; Bool nxagentDoDirectColormaps = False; Window nxagentParentWindow = 0; int nxagentLockDeferLevel = 0; Bool nxagentResizeDesktopAtStartup = False; Bool nxagentUseNXTrans = False; Bool nxagentForceNXTrans = False; int nxagentMaxAllowedResets = 0; char *nxagentKeyboard = NULL; Bool nxagentOnce = True; int nxagentRemoteMajor = -1; static void nxagentParseOptionString(char*); /* * Get the caption to be used for helper dialogs * from agent's window name passed as parameter. */ static int nxagentGetDialogName(void); char nxagentVerbose = 0; char *nxagentKeystrokeFile = NULL; int ddxProcessArgument(int argc, char *argv[], int i) { /* * The flavour can never change, so only set it once. * * FIXME: ddxProcessArgument() is called once for every command line * argument, with argv[0] being the argument and not the program * name! We should move this check somewhere else. */ if (nxagentProgName == NULL) { char *basec = strdup(argv[0]); nxagentProgName = strdup(basename(basec)); SAFE_free(basec); /* * Check if we are running as X2Go Agent */ checkX2goAgent(); } #ifdef TEST fprintf(stderr, "%s: argv[0] [%s] nxagentProgName [%s]\n", __func__, argv[0], nxagentProgName); #endif /* * Ensure that the options are set to their defaults. */ static Bool resetOptions = True; if (resetOptions == True) { char *envOptions = NULL; nxagentInitOptions(); resetOptions = False; /* * Ensure the correct order of options evaluation: the environment * first, then those included in the options file and, last, the * command line options. */ char *envDisplay = getenv("DISPLAY"); if (envDisplay != NULL && strlen(envDisplay) == 0) { envDisplay = NULL; } for (int j = 0; j < argc; j++) { if ((!strcmp(argv[j], "-display")) && (j + 1 < argc)) { envOptions = strdup(argv[j + 1]); #ifdef WARNING if (envOptions == NULL) { fprintf(stderr, "ddxProcessArgument: WARNING! failed string allocation.\n"); } #endif break; } } if ((envOptions == NULL) && (envDisplay != NULL)) { envOptions = strdup(envDisplay); #ifdef WARNING if (envOptions == NULL) { fprintf(stderr, "ddxProcessArgument: WARNING! failed string allocation.\n"); } #endif } if (envOptions != NULL) { nxagentParseOptionString(envOptions); SAFE_free(envOptions); } for (int j = 0; j < argc; j++) { if ((!strcmp(argv[j], "-options") || !strcmp(argv[j], "-option")) && j + 1 < argc) { SAFE_free(nxagentOptionsFilenameOrString); if (-1 == asprintf(&nxagentOptionsFilenameOrString, "%s", argv[j + 1])) { FatalError("malloc failed"); } break; } } nxagentProcessOptions(nxagentOptionsFilenameOrString); } /* if (resetOptions == True) */ if (!strcmp(argv[i], "-B")) { #ifdef TEST fprintf(stderr, "ddxProcessArgument: Checking the NX binder option.\n"); #endif if (nxagentCheckBinder(argc, argv, i) > 0) { /* * We are going to run the agent with the 'binder' option. Go * straight to the proxy loop. */ #ifdef TEST fprintf(stderr, "ddxProcessArgument: Entering the NX proxy binder loop.\n"); #endif nxagentBinderLoop(); /* * This will make an exit. */ nxagentBinderExit(0); } else { /* * Exit with an error. */ nxagentBinderExit(1); } } if (!strcmp(argv[i], "-display")) { if (++i < argc) { snprintf(nxagentDisplayName, NXAGENTDISPLAYNAMELENGTH, "%s", argv[i]); return 2; } return 0; } if (!strcmp(argv[i], "-id")) { if (++i < argc) { snprintf(nxagentSessionId, NXAGENTSESSIONIDLENGTH, "%s", argv[i]); return 2; } return 0; } if (!strcmp(argv[i], "-version")) { nxagentShowVersionInfo(); exit(0); } /* * This had to be '-options' since the beginning * but was '-option' by mistake. Now we have to * handle the backward compatibility. */ if (!strcmp(argv[i], "-options") || !strcmp(argv[i], "-option")) { if (++i < argc) { SAFE_free(nxagentOptionsFilenameOrString); if (-1 == asprintf(&nxagentOptionsFilenameOrString, "%s", argv[i])) { FatalError("malloc failed"); } return 2; } return 0; } if (!strcmp(argv[i], "-sync")) { nxagentSynchronize = True; return 1; } if (!strcmp(argv[i], "-nxrealwindowprop")) { nxagentRealWindowProp = True; return 1; } if (!strcmp(argv[i], "-reportwids")) { nxagentReportWindowIds = True; return 1; } if (!strcmp(argv[i], "-reportprivatewids")) { nxagentReportPrivateWindowIds = True; return 1; } if (!strcmp(argv[i], "-full")) { nxagentFullGeneration = True; return 1; } if (!strcmp(argv[i], "-class")) { if (++i < argc) { if (!strcmp(argv[i], "StaticGray")) { nxagentDefaultClass = StaticGray; nxagentUserDefaultClass = True; return 2; } else if (!strcmp(argv[i], "GrayScale")) { nxagentDefaultClass = GrayScale; nxagentUserDefaultClass = True; return 2; } else if (!strcmp(argv[i], "StaticColor")) { nxagentDefaultClass = StaticColor; nxagentUserDefaultClass = True; return 2; } else if (!strcmp(argv[i], "PseudoColor")) { nxagentDefaultClass = PseudoColor; nxagentUserDefaultClass = True; return 2; } else if (!strcmp(argv[i], "TrueColor")) { nxagentDefaultClass = TrueColor; nxagentUserDefaultClass = True; return 2; } else if (!strcmp(argv[i], "DirectColor")) { nxagentDefaultClass = DirectColor; nxagentUserDefaultClass = True; return 2; } } return 0; } if (!strcmp(argv[i], "-cc")) { if (++i < argc && sscanf(argv[i], "%i", &nxagentDefaultClass) == 1) { if (nxagentDefaultClass >= 0 && nxagentDefaultClass <= 5) { nxagentUserDefaultClass = True; /* let the OS layer process it as well, so return 0 */ } } return 0; } if (!strcmp(argv[i], "-depth")) { if (++i < argc && sscanf(argv[i], "%i", &nxagentDefaultDepth) == 1) { if (nxagentDefaultDepth > 0) { nxagentUserDefaultDepth = True; return 2; } } return 0; } /* * These options are now useless and are parsed only for * compatibility with older versions. */ if (!strcmp(argv[i], "-fast") || !strcmp(argv[i], "-slow") || !strcmp(argv[i], "-hint") || !strcmp(argv[i], "-sss")) { fprintf(stderr, "Warning: Ignoring deprecated command line option '%s'.\n", argv[i]); return 1; } if (!strcmp(argv[i], "-backingstore")) { if (++i < argc) { if (!strcmp(argv[i], "0")) { nxagentChangeOption(BackingStore, BackingStoreNever); } else { nxagentChangeOption(BackingStore, BackingStoreForce); } return 2; } return 0; } if (!strcmp(argv[i], "-streaming")) { if (++i < argc) { if (!strcmp(argv[i], "0")) { nxagentChangeOption(Streaming, 0); } else { nxagentChangeOption(Streaming, 1); } return 2; } return 0; } if (!strcmp(argv[i], "-defer")) { int level; if (++i < argc && sscanf(argv[i], "%i", &level) == 1 && level >= 0 && level <= 2) { if (nxagentOption(Shadow) == 0) { nxagentChangeOption(DeferLevel, level); /* * The defer level set with the command line is not changed * when the session is resumed. */ nxagentLockDeferLevel = 1; } return 2; } return 0; } if (!strcmp(argv[i], "-irlimit")) { int limit; if (++i < argc && sscanf(argv[i], "%i", &limit) == 1) { nxagentChangeOption(ImageRateLimit, limit); return 2; } return 0; } if (!strcmp(argv[i], "-tile")) { int width, height; if (++i < argc && sscanf(argv[i], "%ix%i", &width, &height) == 2 && width >= 32 && height >= 32) { nxagentChangeOption(TileWidth, width); nxagentChangeOption(TileHeight, height); return 2; } return 0; } if (strcmp(argv[i], "-fp") == 0) { if(++i < argc) { #ifdef TEST fprintf(stderr, "ddxProcessArgument: User defined font path [%s].\n", argv[i]); #endif nxagentUserDefinedFontPath = 1; defaultFontPath = argv[i]; } else { UseMsg(); } } if (!strcmp(argv[i], "-geometry")) { if (++i < argc) { if (!strcmp(argv[i],"fullscreen")) { nxagentChangeOption(Fullscreen, True); nxagentChangeOption(AllScreens, True); } else { if (nxagentUserGeometry.flag == 0) { nxagentUserGeometry.flag = XParseGeometry(argv[i], &nxagentUserGeometry.X, &nxagentUserGeometry.Y, &nxagentUserGeometry.Width, &nxagentUserGeometry.Height); } } if (nxagentUserGeometry.flag || (nxagentOption(Fullscreen) == 1)) { return 2; } } return 0; } if (!strcmp(argv[i], "-bw")) { int bw; if (++i < argc && sscanf(argv[i], "%i", &bw) == 1) { nxagentChangeOption(BorderWidth, bw); if (bw >= 0) { nxagentUserBorderWidth = True; return 2; } } return 0; } if (!strcmp(argv[i], "-name")) { if (++i < argc) { snprintf(nxagentWindowName, NXAGENTWINDOWNAMELENGTH, "%s", argv[i]); return 2; } return 0; } if (!strcmp(argv[i], "-scrns")) { if (++i < argc && sscanf(argv[i], "%i", &nxagentNumScreens) == 1) { if (nxagentNumScreens > 0) { if (nxagentNumScreens > MAXSCREENS) { ErrorF("Maximum number of screens is %d.\n", MAXSCREENS); nxagentNumScreens = MAXSCREENS; } return 2; } } return 0; } if (!strcmp(argv[i], "-install")) { nxagentDoDirectColormaps = True; return 1; } if (!strcmp(argv[i], "-parent")) { if (++i < argc) { nxagentParentWindow = (XID) strtol (argv[i], (char**)NULL, 0); return 2; } } if (!strcmp(argv[i], "-forcenx")) { nxagentForceNXTrans = True; return 1; } if (!strcmp(argv[i], "-norootlessexit")) { nxagentChangeOption(NoRootlessExit, True); return 1; } if (!strcmp(argv[i], "-nomagicpixel")) { nxagentChangeOption(MagicPixel, 0); return 1; } if (!strcmp(argv[i], "-noonce")) { nxagentOnce = False; return 1; } if (!strcmp(argv[i], "-kbtype") || !strcmp(argv[i], "-keyboard")) { if (++i < argc) { SAFE_free(nxagentKeyboard); if (nxagentX2go && strcmp(argv[i], "null/null") == 0) { #ifdef TEST fprintf(stderr, "%s: changing nxagentKeyboard from [null/null] to [clone].\n", __func__); #endif SAFE_free(nxagentKeyboard); nxagentKeyboard = strdup("clone"); } else { nxagentKeyboard = strdup(argv[i]); } if (nxagentKeyboard == NULL) { FatalError("malloc failed"); } return 2; } return 0; } if (!strcmp(argv[i], "-extensions")) { return 1; } #ifdef RENDER if (!strcmp(argv[i], "-norender")) { nxagentRenderEnable = False; return 1; } #endif if (!strcmp(argv[i], "-nocomposite")) { nxagentChangeOption(Composite, 0); return 1; } if (!strcmp(argv[i], "-nodamage")) { nxagentChangeOption(UseDamage, 0); return 1; } if (!strcmp(argv[i], "-autodpi")) { nxagentAutoDPI = True; return 1; } /* * The original -noreset option, disabling dispatchExceptionAtReset, * is the default. Use this option to restore the original * behaviour. */ if (!strcmp(argv[i], "-reset")) { nxagentChangeOption(Reset, True); return 1; } if (!strcmp(argv[i], "-persistent")) { nxagentChangeOption(Persistent, True); return 1; } if (!strcmp(argv[i], "-nopersistent")) { nxagentChangeOption(Persistent, False); return 1; } if (!strcmp(argv[i], "-noshmem")) { nxagentChangeOption(SharedMemory, False); return 1; } if (!strcmp(argv[i], "-shmem")) { nxagentChangeOption(SharedMemory, True); return 1; } if (!strcmp(argv[i], "-noignore")) { nxagentChangeOption(DeviceControl, True); nxagentChangeOption(DeviceControlUserDefined , True); return 1; } if (!strcmp(argv[i], "-nokbreset")) { nxagentChangeOption(ResetKeyboardAtResume, False); return 1; } if (!strcmp(argv[i], "-noxkblock")) { nxagentChangeOption(InhibitXkb, 0); return 1; } /* * Enable pseudo-rootless mode. */ if (!strcmp(argv[i], "-R")) { if (nxagentOption(Binder) == UNDEFINED || nxagentOption(Desktop) == UNDEFINED || nxagentOption(Rootless) == UNDEFINED) { nxagentChangeOption(Binder, False); nxagentChangeOption(Desktop, False); nxagentChangeOption(Rootless, True); } return 1; } /* * Enable the "desktop" mode. This is the default. */ if (!strcmp(argv[i], "-D")) { nxagentChangeOption(Binder, False); nxagentChangeOption(Rootless, False); nxagentChangeOption(Desktop, True); return 1; } /* * Enable the "shadow" mode. */ if (!strcmp(argv[i], "-S")) { nxagentChangeOption(Shadow, 1); nxagentChangeOption(DeferLevel, 0); nxagentChangeOption(Persistent, 0); return 1; } if (!strcmp(argv[i], "-shadow")) { if (++i < argc) { snprintf(nxagentShadowDisplayName, NXAGENTSHADOWDISPLAYNAMELENGTH, "%s", argv[i]); if (strcmp(nxagentShadowDisplayName, "") == 0) { FatalError("Invalid shadow display option"); } return 2; } return 0; } if (!strcmp(argv[i], "-shadowmode")) { if (++i < argc) { if (!strcmp(argv[i], "0")) { nxagentChangeOption(ViewOnly, 1); } else { nxagentChangeOption(ViewOnly, 0); } return 2; } return 0; } /* * Enable the auto-disconnect timeout. */ if (!strcmp(argv[i], "-timeout")) { int seconds; if (++i < argc && sscanf(argv[i], "%i", &seconds) == 1) { if (seconds >= 0) { if (seconds > 0 && seconds < 60) { seconds = 60; } nxagentChangeOption(Timeout, seconds); return 2; } } return 0; } /* * The return value for -query, -broadcast and -indirect must be 0 * to let the dix layer process these options. */ if (!strcmp(argv[i], "-query")) { nxagentChangeOption(Desktop, True); nxagentChangeOption(Xdmcp, True); nxagentMaxAllowedResets = 0; return 0; } if (!strcmp(argv[i], "-broadcast")) { nxagentChangeOption(Desktop, True); nxagentChangeOption(Xdmcp, True); nxagentMaxAllowedResets = 0; return 0; } if (!strcmp(argv[i], "-indirect")) { nxagentChangeOption(Desktop, True); nxagentChangeOption(Xdmcp, True); nxagentMaxAllowedResets = 1; return 0; } if (!strcmp(argv[i], "-noshpix")) { nxagentChangeOption(SharedPixmaps, False); return 1; } if (!strcmp(argv[i], "-shpix")) { nxagentChangeOption(SharedPixmaps, True); return 1; } if (!strcmp(argv[i], "-clipboard")) { if ((!strcmp(argv[i+1], "both")) || (!strcmp(argv[i+1], "1"))) { nxagentChangeOption(Clipboard, ClipboardBoth); } else if (!strcmp(argv[i+1], "client")) { nxagentChangeOption(Clipboard, ClipboardClient); } else if (!strcmp(argv[i+1], "server")) { nxagentChangeOption(Clipboard, ClipboardServer); } else if ((!strcmp(argv[i+1], "none")) || (!strcmp(argv[i+1], "0"))) { nxagentChangeOption(Clipboard, ClipboardNone); } else { nxagentChangeOption(Clipboard, ClipboardBoth); } return 2; } if (!strcmp(argv[i], "-bs")) { nxagentChangeOption(BackingStore, BackingStoreNever); return 1; } if (!strcmp(argv[i], "-verbose")) { nxagentVerbose = 1; return 1; } if (!strcmp(argv[i], "-keystrokefile")) { if (i + 1 < argc) { if (NULL != (nxagentKeystrokeFile = strdup(argv[i + 1]))) { return 2; } else { FatalError("malloc failed"); } } return 0; } if (!strcmp(argv[i], "-autograb")) { nxagentChangeOption(AutoGrab, True); return 1; } /* * Disable Xinerama (i.e. fake it in Screen.c) if somehow Xinerama support * has been disabled on the cmdline. */ if (PANORAMIX_DISABLED_COND && RRXINERAMA_DISABLED_COND) nxagentChangeOption(Xinerama, 0); return 0; } /* copy from nxcomp's Loop.cpp */ static int hexval(char c) { if ((c >= '0') && (c <= '9')) return c - '0'; if ((c >= 'a') && (c <= 'f')) return c - 'a' + 10; if ((c >= 'A') && (c <= 'F')) return c - 'A' + 10; return -1; } static void URLDecodeInPlace(char *str) { if (str) { char *to = str; while (str[0]) { if ((str[0] == '%') && (hexval(str[1]) >= 0) && (hexval(str[2]) >= 0)) { *(to++) = hexval(str[1]) * 16 + hexval(str[2]); str += 3; } else *(to++) = *(str++); } *to = '\0'; } } static void nxagentParseSingleOption(char *name, char *value) { int argc; char *argv[2] = { NULL, NULL }; #ifdef TEST fprintf(stderr, "nxagentParseSingleOption: Processing option '%s' = '%s'.\n", validateString(name), validateString(value)); #endif URLDecodeInPlace(value); if (!value) value = ""; if (!strcmp(name, "kbtype") || !strcmp(name, "keyboard") || !strcmp(name, "id") || !strcmp(name, "display") || !strcmp(name, "clipboard") || !strcmp(name, "geometry") || !strcmp(name, "option") || !strcmp(name, "options") || !strcmp(name, "shadow") || !strcmp(name, "shadowmode") || !strcmp(name, "streaming") || !strcmp(name, "defer") || !strcmp(name, "tile")) { argv[1] = value; argc = 2; } else if (!strcmp(name, "R") && !strcmp(value, "1")) { argc = 1; } else if (!strcmp(name, "fast") || !strcmp(name, "slow")) { fprintf(stderr, "Warning: Ignoring deprecated option '%s'.\n", name); return; } else if (!strcmp(name, "render")) { if (nxagentReconnectTrap == True) { #ifdef DEBUG fprintf(stderr, "nxagentParseSingleOption: Ignoring option 'render' at reconnection.\n"); #endif } else if (nxagentRenderEnable == UNDEFINED) { if (!strcmp(value, "1")) { nxagentRenderEnable = True; } else if (!strcmp(value, "0")) { nxagentRenderEnable = False; } else { fprintf(stderr, "Warning: Ignoring bad value '%s' for option 'render'.\n", validateString(value)); } } return; } else if (!strcmp(name, "state")) { setStatePath(value); return; } else if (!strcmp(name, "fullscreen")) { if (nxagentReconnectTrap == True) { #ifdef DEBUG fprintf(stderr, "nxagentParseSingleOption: Ignoring option 'fullscreen' at reconnection.\n"); #endif } else if (!strcmp(value, "1")) { nxagentChangeOption(Fullscreen, True); nxagentChangeOption(AllScreens, True); } else if (!strcmp(value, "0")) { nxagentChangeOption(Fullscreen, False); nxagentChangeOption(AllScreens, False); } else { fprintf(stderr, "Warning: Ignoring bad value '%s' for option 'fullscreen'.\n", validateString(value)); } return; } else if (!strcmp(name, "shpix")) { if (!strcmp(value, "1")) { nxagentChangeOption(SharedPixmaps, True); } else if (!strcmp(value, "0")) { nxagentChangeOption(SharedPixmaps, False); } else { fprintf(stderr, "Warning: Ignoring bad value '%s' for option 'shpix'.\n", validateString(value)); } return; } else if (!strcmp(name, "shmem")) { if (!strcmp(value, "1")) { nxagentChangeOption(SharedMemory, True); } else if (!strcmp(value, "0")) { nxagentChangeOption(SharedMemory, False); } else { fprintf(stderr, "Warning: Ignoring bad value '%s' for option 'shmem'.\n", validateString(value)); } return; } else if (!strcmp(name, "composite")) { if (!strcmp(value, "1")) { nxagentChangeOption(Composite, 1); } else if (!strcmp(value, "0")) { nxagentChangeOption(Composite, 0); } else { fprintf(stderr, "Warning: Ignoring bad value '%s' for option 'composite'.\n", validateString(value)); } return; } else if (!strcmp(name, "xinerama")) { #if !defined(PANORAMIX) && !defined(RANDR) nxagentChangeOption(Xinerama, 0); fprintf(stderr, "Warning: No Xinerama support compiled into %s.\n", nxagentProgName); return; #else if (PANORAMIX_DISABLED_COND && RRXINERAMA_DISABLED_COND) { nxagentChangeOption(Xinerama, 0); fprintf(stderr, "Warning: XINERAMA extension has been disabled on %s startup.\n", nxagentProgName); return; } if (!strcmp(value, "1")) { nxagentChangeOption(Xinerama, 1); return; } else if (!strcmp(value, "0")) { nxagentChangeOption(Xinerama, 0); } else { fprintf(stderr, "Warning: Ignoring bad value '%s' for option 'xinerama'.\n", validateString(value)); } return; #endif } else if (!strcmp(name, "resize")) { if (nxagentOption(DesktopResize) == 0 || strcmp(value, "0") == 0) { nxagentResizeDesktopAtStartup = 0; } else if (strcmp(value, "1") == 0) { nxagentResizeDesktopAtStartup = 1; } else { fprintf(stderr, "Warning: Ignoring bad value '%s' for option 'resize'.\n", validateString(value)); } return; } else if (!strcmp(name, "backingstore")) { if (!strcmp(value, "0")) { nxagentChangeOption(BackingStore, BackingStoreNever); } else { nxagentChangeOption(BackingStore, BackingStoreForce); } return; } else if (!strcmp(name, "menu")) { if (!strcmp(value, "0")) { nxagentChangeOption(Menu, 0); } else { nxagentChangeOption(Menu, 1); } return; } else if (!strcmp(name, "magicpixel")) { if (!strcmp(value, "0")) { nxagentChangeOption(MagicPixel, 0); } else { nxagentChangeOption(MagicPixel, 1); } return; } else if (!strcmp(name, "autodpi")) { if (nxagentReconnectTrap == True) { #ifdef DEBUG fprintf(stderr, "nxagentParseSingleOption: Ignoring option 'autodpi' at reconnection.\n"); #endif } else if (!strcmp(value, "0")) { nxagentAutoDPI = False; } else { nxagentAutoDPI = True; } return; } else if (strcmp(name, "shadowuid") == 0) { nxagentShadowUid = atoi(value); return; } else if (strcmp(name, "clients") == 0) { char *new = strdup(value); if (new) { SAFE_free(nxagentClientsLogName); nxagentClientsLogName = new; } else { fprintf(stderr, "Warning: Ignoring option [%s] because of memory problems\n", validateString(name)); } return; } else if (strcmp(name, "client") == 0) { if (strcmp(value, "winnt") == 0 || strcmp(value, "windows") == 0) { nxagentChangeOption(ClientOs, ClientOsWinnt); } else if (strcmp(value, "linux") == 0) { nxagentChangeOption(ClientOs, ClientOsLinux); } else if (strcmp(value, "solaris") == 0) { nxagentChangeOption(ClientOs, ClientOsSolaris); } else if (strcmp(value, "macosx") == 0) { nxagentChangeOption(ClientOs, ClientOsMac); } return; } else if (strcmp(name, "copysize") == 0) { nxagentChangeOption(CopyBufferSize, atoi(value)); return; } else if (!strcmp(name, "sleep")) { errno = 0; long sleep_parse = strtol(value, NULL, 10); if ((errno) && (0 == sleep_parse)) { fprintf(stderr, "Unable to convert value [%s] of option [%s]. " "Ignoring option.\n", validateString(value), validateString(name)); return; } if ((long) UINT_MAX < sleep_parse) { sleep_parse = UINT_MAX; fprintf(stderr, "Warning: value [%s] of option [%s] " "out of range, clamped to [%lu].\n", validateString(value), validateString(name), sleep_parse); } if (0 > sleep_parse) { sleep_parse = 0; fprintf(stderr, "Warning: value [%s] of option [%s] " "out of range, clamped to [%lu].\n", validateString(value), validateString(name), sleep_parse); } nxagentChangeOption(SleepTime, sleep_parse); return; } else if (!strcmp(name, "tolerancechecks")) { if (strcmp(value, "strict") == 0) { nxagentChangeOption(ReconnectTolerance, ToleranceChecksStrict); } else if (strcmp(value, "safe") == 0) { nxagentChangeOption(ReconnectTolerance, ToleranceChecksSafe); } else if (strcmp(value, "risky") == 0) { nxagentChangeOption(ReconnectTolerance, ToleranceChecksRisky); } else if (strcmp(value, "bypass") == 0) { nxagentChangeOption(ReconnectTolerance, ToleranceChecksBypass); } else { /* * Check for a matching integer. Or any integer, really. */ errno = 0; long tolerance_parse = strtol(value, NULL, 10); if ((errno) && (0 == tolerance_parse)) { fprintf(stderr, "Unable to convert value [%s] of option [%s]. " "Ignoring option.\n", validateString(value), validateString(name)); return; } if ((long) UINT_MAX < tolerance_parse) { tolerance_parse = UINT_MAX; fprintf(stderr, "Warning: value [%s] of option [%s] " "out of range, clamped to [%lu].\n", validateString(value), validateString(name), tolerance_parse); } if (0 > tolerance_parse) { tolerance_parse = 0; fprintf(stderr, "Warning: value [%s] of option [%s] " "out of range, clamped to [%lu].\n", validateString(value), validateString(name), tolerance_parse); } #ifdef TEST switch (tolerance_parse) { case ToleranceChecksStrict: case ToleranceChecksSafe: case ToleranceChecksRisky: case ToleranceChecksBypass: break; default: fprintf(stderr, "%s: Warning: value [%s] of " "option [%s] unknown, will be mapped to " "\"Bypass\" [%u] value internally.\n", __func__, validateString(value), validateString(name), (unsigned int)ToleranceChecksBypass); } #endif nxagentChangeOption(ReconnectTolerance, tolerance_parse); } return; } else if (!strcmp(name, "keyconv")) { if (!strcmp(value, "off")) { nxagentChangeOption(KeycodeConversion, KeycodeConversionOff); } else if (!strcmp(value, "on")) { nxagentChangeOption(KeycodeConversion, KeycodeConversionOn); } else if (!strcmp(value, "auto")) { nxagentChangeOption(KeycodeConversion, KeycodeConversionAuto); } else { fprintf(stderr, "Warning: Ignoring bad value '%s' for option 'keyconv'.\n", validateString(value)); } return; } else if (!strcmp(name, "autograb")) { if (!strcmp(value, "0")) { nxagentChangeOption(AutoGrab, False); } else { nxagentChangeOption(AutoGrab, True); } return; } else { #ifdef DEBUG fprintf(stderr, "nxagentParseSingleOption: Ignored option [%s] with value [%s].\n", validateString(name), validateString(value)); #endif return; } /* * Before passing the not yet evaluated options to * ddxProcessArgument(), we have to add a dash as prefix. */ int size = strlen(name) + 1; if (size > 1) { if ((argv[0] = malloc(size + 1)) == NULL) { fprintf(stderr, "Warning: Ignoring option '%s' due to lack of memory.\n", name); return; } *argv[0] = '-'; memcpy(argv[0] + 1, name, size); } ddxProcessArgument(argc, argv, 0); SAFE_free(argv[0]); } static void nxagentParseOptionString(char *string) { char *value = NULL; char *option = NULL; /* * we must not modify string, but strtok will insert \0. So let's * work with a copy */ char *dup = strdup(string); /* * Remove the port specification. */ char *delimiter = rindex(dup, ':'); if (delimiter) { #ifdef DEBUG fprintf(stderr, "%s: stripping port specification [%s]\n", __func__, delimiter); #endif *delimiter = '\0'; } else { fprintf(stderr, "Warning: Option file doesn't contain a port specification.\n"); } while ((option = strtok(option ? NULL : dup, ","))) { delimiter = rindex(option, '='); if (delimiter) { *delimiter = '\0'; value = delimiter + 1; } else { value = NULL; } nxagentParseSingleOption(option, value); } SAFE_free(dup); } char *nxagentSkipNXMarker(char *string) { if (strncasecmp(string, "nx/nx,", 6) == 0 || strncasecmp(string, "nx/nx:", 6) == 0) { #ifdef DEBUG fprintf(stderr, "%s: skipping [%6.6s]\n", __func__, string); #endif return string + 6; } else if (strncasecmp(string, "nx,", 3) == 0 || strncasecmp(string, "nx:", 3) == 0) { #ifdef DEBUG fprintf(stderr, "%s: skipping [%3.3s]\n", __func__, string); #endif return string + 3; } else { return string; } } void nxagentProcessOptions(char * string) { if (!string) return; #ifdef DEBUG fprintf(stderr, "%s: Going to process option string/filename [%s].\n", __func__, validateString(string)); #endif /* if the "filename" starts with an nx marker treat it as an option _string_ instead of a filename */ char *skipped = nxagentSkipNXMarker(string); if (skipped != string) { nxagentParseOptionString(skipped); } else { nxagentProcessOptionsFile(string); } } void nxagentProcessOptionsFile(char * filename) { FILE *file = NULL; char *data = NULL; int sizeOfFile; int maxFileSize = 1024; #ifdef DEBUG fprintf(stderr, "nxagentProcessOptionsFile: Going to process option file [%s].\n", validateString(filename)); #endif /* * Init statePath */ setStatePath(""); if (filename == NULL) { return; } if ((file = fopen(filename, "r")) == NULL) { fprintf(stderr, "Warning: Couldn't open option file '%s'. Error is '%s'.\n", validateString(filename), strerror(errno)); goto nxagentProcessOptionsFileExit; } if (fseek(file, 0, SEEK_END) != 0) { fprintf(stderr, "Warning: Couldn't position inside option file '%s'. Error is '%s'.\n", validateString(filename), strerror(errno)); goto nxagentProcessOptionsFileExit; } if ((sizeOfFile = ftell(file)) == -1) { fprintf(stderr, "Warning: Couldn't get the size of option file '%s'. Error is '%s'.\n", validateString(filename), strerror(errno)); goto nxagentProcessOptionsFileExit; } #ifdef DEBUG fprintf(stderr, "nxagentProcessOptionsFile: Processing option file [%s].\n", validateString(filename)); #endif rewind(file); if (sizeOfFile > maxFileSize) { fprintf(stderr, "Warning: Maximum file size exceeded for options '%s'.\n", validateString(filename)); goto nxagentProcessOptionsFileExit; } if ((data = malloc(sizeOfFile + 1)) == NULL) { fprintf(stderr, "Warning: Memory allocation failed processing file '%s'.\n", validateString(filename)); goto nxagentProcessOptionsFileExit; } int offset = 0; int size = 0; for (;;) { size_t result = fread(data + offset, 1, sizeOfFile, file); if (ferror(file) != 0) { fprintf(stderr, "Warning: Error reading the option file '%s'.\n", validateString(filename)); goto nxagentProcessOptionsFileExit; } size += result; offset += result; if (feof(file) != 0 || (size == sizeOfFile)) { break; } } if (size != sizeOfFile) { fprintf(stderr, "Warning: Premature end of option file '%s' while reading.\n", validateString(filename)); goto nxagentProcessOptionsFileExit; } /* * Truncate the buffer to the first line. */ for (offset = 0; (offset < sizeOfFile) && (data[offset] != '\n'); offset++); data[offset] = '\0'; #ifdef DEBUG fprintf(stderr, "%s: first line of options file [%s]\n", __func__, data); #endif nxagentParseOptionString(nxagentSkipNXMarker(data)); nxagentProcessOptionsFileExit: SAFE_free(data); if (file) { if (fclose(file) != 0) { fprintf(stderr, "Warning: Couldn't close option file '%s'. Error is '%s'.\n", validateString(filename), strerror(errno)); } } return; } /* * FIXME: Transport initialization, shouldn't depend upon * argv[], because we call it at every reconnection. */ Bool nxagentPostProcessArgs(char* name, Display* dpy, Screen* scr) { Bool useNXTrans = False; #ifdef WATCH fprintf(stderr, "nxagentPostProcessArgs: Watchpoint 2.\n"); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio ------- ----- ------ ------- -------- ---------- ----- N/A */ sleep(30); #endif if ((nxagentOption(Rootless) == 1) && nxagentOption(Fullscreen) == 1) { #ifdef TEST fprintf(stderr, "WARNING: Ignoring fullscreen option for rootless session.\n"); #endif nxagentChangeOption(Fullscreen, False); } /* * Ensure we have a valid name for children dialogs. */ nxagentGetDialogName(); /* * Ensure we have a valid name for window name. */ if (*nxagentWindowName == '\0') { if(nxagentX2go) { snprintf(nxagentWindowName, NXAGENTWINDOWNAMELENGTH, "X2Go Agent"); } else { snprintf(nxagentWindowName, NXAGENTWINDOWNAMELENGTH, "NX Agent"); } } /* * Note that use of NX packed images as well as * render extension could be later disabled due * to the fact that session is running nested * in a nxagent server. */ if (nxagentForceNXTrans) { useNXTrans = True; } else if ((strncasecmp(name, "nx/", 3) == 0) || (strncasecmp(name, "nx:", 3) == 0) || (strncasecmp(name, "nx,", 3) == 0) || (strcasecmp(name, "nx") == 0)) { useNXTrans = True; } if (useNXTrans == True) { unsigned int linkType = LINK_TYPE_NONE; unsigned int localMajor = 0; unsigned int localMinor = 0; unsigned int localPatch = 0; unsigned int remoteMajor = 0; unsigned int remoteMinor = 0; unsigned int remotePatch = 0; int splitTimeout = 0; int motionTimeout = 0; int splitMode = 0; int splitSize = 0; unsigned int packMethod = PACK_NONE; unsigned int packQuality = 9; int dataLevel = 0; int streamLevel = 0; int deltaLevel = 0; unsigned int loadCache = 0; unsigned int saveCache = 0; unsigned int startupCache = 0; unsigned int clientSegment = 0; unsigned int serverSegment = 0; unsigned int clientSize = 0; unsigned int serverSize = 0; if (NXGetControlParameters(dpy, &linkType, &localMajor, &localMinor, &localPatch, &remoteMajor, &remoteMinor, &remotePatch, &splitTimeout, &motionTimeout, &splitMode, &splitSize, &packMethod, &packQuality, &dataLevel, &streamLevel, &deltaLevel, &loadCache, &saveCache, &startupCache) == 0) { fprintf(stderr, "Warning: Failed to get the control parameters.\n"); } nxagentChangeOption(LinkType, linkType); #ifdef TEST fprintf(stderr, "nxagentPostProcessArgs: Got local version [%d.%d.%d] remote version [%d.%d.%d].\n", localMajor, localMinor, localPatch, remoteMajor, remoteMinor, remotePatch); fprintf(stderr, "nxagentPostProcessArgs: Got split timeout [%d] motion timeout [%d].\n", splitTimeout, motionTimeout); fprintf(stderr, "nxagentPostProcessArgs: Got split mode [%d] split size [%d].\n", splitMode, splitSize); fprintf(stderr, "nxagentPostProcessArgs: Got preferred pack method [%d] and quality [%d].\n", packMethod, packQuality); #endif if (remoteMajor < 2) { #ifdef TEST fprintf(stderr, "nxagentPostProcessArgs: WARNING! Using backward compatible alpha encoding.\n"); #endif nxagentAlphaCompat = 1; } else { nxagentAlphaCompat = 0; } nxagentRemoteMajor = remoteMajor; if (nxagentPackMethod == -1) { nxagentPackMethod = packMethod; } if (nxagentPackQuality == -1) { nxagentPackQuality = packQuality; } /* * Set the minimum size of images being streamed. */ if (nxagentSplitThreshold == -1) { nxagentSplitThreshold = splitSize; } /* * Let the remote proxy use the shared memory extension, if * supported by the X server. The client part is not useful and * not implemented. The size of the segment is chosen by the * user. The only purpose of the message is to reserve the XID * that will be used by the remote. */ unsigned int enableClient = 0; unsigned int enableServer = 1; if (NXGetShmemParameters(dpy, &enableClient, &enableServer, &clientSegment, &serverSegment, &clientSize, &serverSize) == 0) { fprintf(stderr, "Warning: Failed to get the shared memory parameters.\n"); } if (enableServer == 1) { fprintf(stderr, "Info: Using shared memory parameters %d/%d/%d/%dK.\n", nxagentOption(SharedMemory), nxagentOption(SharedPixmaps), enableServer, serverSize / 1024); } else { fprintf(stderr, "Info: Using shared memory parameters %d/%d/0/0K.\n", nxagentOption(SharedMemory), nxagentOption(SharedPixmaps)); } /* * We don't need the NoExpose events. Block them at the proxy * side. */ NXSetExposeParameters(nxagentDisplay, 1, 1, 0); } else { /* * We don't have a proxy on the remote side. */ nxagentChangeOption(LinkType, LINK_TYPE_NONE); } /* * Set the lossless and lossy pack methods based on the user's * preferences and the selected link type. */ nxagentSetPackMethod(); /* * If not set, set the defer level and the synchronization timeout * based on the link type. */ nxagentSetDeferLevel(); /* * Also set the display output buffer size. */ nxagentSetBufferSize(); /* * Select the preferred scheduler. */ nxagentSetScheduler(); /* * Select the buffer coalescence timeout. */ nxagentSetCoalescence(); /* * Set the other defaults. */ if (nxagentOption(Fullscreen) == UNDEFINED) { nxagentChangeOption(Fullscreen, False); } if (nxagentOption(AllScreens) == UNDEFINED) { nxagentChangeOption(AllScreens, False); } if (nxagentOption(Binder) == UNDEFINED) { nxagentChangeOption(Binder, False); } if (nxagentOption(Rootless) == UNDEFINED) { nxagentChangeOption(Rootless, False); } if (nxagentOption(Desktop) == UNDEFINED) { nxagentChangeOption(Desktop, True); } /* * The enableBackingStore flag is defined * in window.c in the dix. */ /* FIXME: In rootless mode the backing-store support is not functional yet. */ if (nxagentOption(Rootless)) { enableBackingStore = 0; } else if (nxagentOption(BackingStore) == BackingStoreUndefined || nxagentOption(BackingStore) == BackingStoreForce) { enableBackingStore = 1; } else if (nxagentOption(BackingStore) == BackingStoreNever) { enableBackingStore = 0; } /* * need to check if this was set on the command line as this has * the priority over the option file. */ if (nxagentRenderEnable == UNDEFINED) { nxagentRenderEnable = True; } if (nxagentRenderEnable == True) { nxagentAlphaEnabled = True; } else { nxagentAlphaEnabled = False; } if ((nxagentOption(Rootless) == 1) && nxagentOption(Xdmcp)) { FatalError("PANIC! Cannot start a XDMCP session in rootless mode.\n"); } /* * We enable server reset only for indirect XDMCP sessions. */ if (nxagentOption(Reset) == True && nxagentMaxAllowedResets == 0) { #ifdef WARNING fprintf(stderr, "nxagentPostProcessArgs: Disabling the server reset.\n"); #endif nxagentChangeOption(Reset, False); dispatchExceptionAtReset = 0; } /* * We skip server reset by default. This should be equivalent to * passing the -noreset option to a standard XFree86 server. */ if (nxagentOption(Reset) == False) { #ifdef TEST fprintf(stderr, "nxagentPostProcessArgs: Disabling dispatch of exception at server reset.\n"); #endif dispatchExceptionAtReset = 0; } /* * Check if the user activated the auto-disconect feature. */ if (nxagentOption(Timeout) > 0) { fprintf(stderr, "Info: Using auto-disconnect timeout of %d seconds.\n", nxagentOption(Timeout)); nxagentAutoDisconnectTimeout = nxagentOption(Timeout) * MILLI_PER_SECOND; } #ifdef WATCH fprintf(stderr, "nxagentPostProcessArgs: Watchpoint 3.\n"); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio ------- ----- ------ ------- -------- ---------- ----- #16 1 256 bits (0 KB) -> 12 bits (0 KB) -> 256/1 -> 12/1 = 21.333:1 #233 A 1 256 bits (0 KB) -> 131 bits (0 KB) -> 256/1 -> 131/1 = 1.954:1 #245 A 2 512 bits (0 KB) -> 19 bits (0 KB) -> 256/1 -> 10/1 = 26.947:1 */ sleep(30); #endif return useNXTrans; } void ddxUseMsg(void) { ErrorF("-full utilize full regeneration\n"); ErrorF("-class string default visual class\n"); ErrorF("-depth int default depth\n"); ErrorF("-geometry WxH+X+Y window size and position\n"); ErrorF("-bw int window border width\n"); ErrorF("-name string window name\n"); ErrorF("-scrns int number of screens to generate\n"); ErrorF("-install install colormaps directly\n"); ErrorF("\nThe NX system adds the following arguments:\n"); ErrorF("-options file|string file or string containing nx/nx options\n"); ErrorF("-forcenx force use of NX protocol messages assuming communication through nxproxy\n"); ErrorF("-timeout int auto-disconnect timeout in seconds (minimum allowed: 60)\n"); ErrorF("-norootlessexit don't exit if there are no clients in rootless mode\n"); ErrorF("-nomagicpixel disable nxagent's magic pixel\n"); ErrorF("-autodpi detect real server's DPI and use that in the session\n"); ErrorF("-display string display name of the real server\n"); ErrorF("-sync synchronize with the real server\n"); #ifdef RENDER ErrorF("-norender disable the use of the render extension\n"); ErrorF("-nocomposite disable the use of the composite extension\n"); #endif ErrorF("-nopersistent disable disconnection/reconnection to the X display on SIGHUP\n"); ErrorF("-noshmem disable use of shared memory extension\n"); ErrorF("-shmem enable use of shared memory extension\n"); ErrorF("-noshpix disable use of shared pixmaps\n"); ErrorF("-shpix enable use of shared pixmaps\n"); ErrorF("-noignore don't ignore pointer and keyboard configuration changes mandated by clients\n"); ErrorF("-nokbreset don't reset keyboard device if the session is resumed\n"); ErrorF("-noxkblock always allow applications to change layout through XKEYBOARD\n"); ErrorF("-autograb enable autograb\n"); ErrorF("-tile WxH size of image tiles (minimum allowed: 32x32)\n"); ErrorF("-keystrokefile file file with keyboard shortcut definitions\n"); ErrorF("-verbose print more warning and error messages\n"); ErrorF("-D enable desktop mode\n"); ErrorF("-R enable rootless mode\n"); ErrorF("-S enable shadow mode\n"); ErrorF("-B enable proxy binding mode\n"); ErrorF("-version show version information and exit\n"); } static int nxagentGetDialogName(void) { if (*nxagentSessionId != '\0') { int length = strlen(nxagentSessionId); /* if the session id contains an MD5 hash in a well-known format cut it off */ if (length > (MD5_LENGTH * 2 + 1) && *(nxagentSessionId + (length - (MD5_LENGTH * 2 + 1))) == '-') { length -= (MD5_LENGTH * 2 + 1); } snprintf(nxagentDialogName, NXAGENTDIALOGNAMELENGTH, "NX - %.*s", length, nxagentSessionId); return 1; } snprintf(nxagentDialogName, NXAGENTDIALOGNAMELENGTH, "NX"); return 0; } void nxagentSetPackMethod(void) { unsigned char supportedMethods[NXNumberOfPackMethods]; unsigned int entries = NXNumberOfPackMethods; if (nxagentOption(LinkType) == LINK_TYPE_NONE) { nxagentChangeOption(Streaming, 0); nxagentPackMethod = PACK_NONE; nxagentPackLossless = PACK_NONE; nxagentSplitThreshold = 0; return; } /* * Check if we need to select the lossy and lossless pack methods * based on the link type. */ int method = nxagentPackMethod; if (method == PACK_ADAPTIVE) { #ifdef TEST fprintf(stderr, "nxagentSetPackMethod: Using adaptive mode for image compression.\n"); #endif nxagentChangeOption(Adaptive, 1); } else { #ifdef TEST fprintf(stderr, "nxagentSetPackMethod: Not using adaptive mode for image compression.\n"); #endif nxagentChangeOption(Adaptive, 0); } if (method == PACK_LOSSY || method == PACK_ADAPTIVE) { nxagentPackMethod = PACK_JPEG_16M_COLORS; } else if (method == PACK_LOSSLESS) { switch (nxagentOption(LinkType)) { case LINK_TYPE_MODEM: case LINK_TYPE_ISDN: case LINK_TYPE_ADSL: case LINK_TYPE_WAN: { nxagentPackMethod = PACK_BITMAP_16M_COLORS; break; } case LINK_TYPE_LAN: { nxagentPackMethod = PACK_RLE_16M_COLORS; break; } default: { fprintf(stderr, "Warning: Unknown link type '%d' while setting the pack method.\n", nxagentOption(LinkType)); break; } } } /* * Query the remote proxy to determine whether the selected methods * are supported. */ if (NXGetUnpackParameters(nxagentDisplay, &entries, supportedMethods) == 0 || entries != NXNumberOfPackMethods) { fprintf(stderr, "Warning: Unable to retrieve the supported pack methods.\n"); nxagentPackMethod = PACK_NONE; nxagentPackLossless = PACK_NONE; } else { if (nxagentPackMethod == PACK_BITMAP_16M_COLORS || nxagentPackMethod == PACK_RLE_16M_COLORS || nxagentPackMethod == PACK_RGB_16M_COLORS || nxagentPackMethod == PACK_NONE) { nxagentPackLossless = nxagentPackMethod; } else { if (nxagentOption(LinkType) == LINK_TYPE_LAN) { nxagentPackLossless = PACK_RLE_16M_COLORS; } else { nxagentPackLossless = PACK_BITMAP_16M_COLORS; } } if (supportedMethods[nxagentPackLossless] == 0) { nxagentPackLossless = PACK_NONE; } #ifdef TEST fprintf(stderr, "nxagentSetPackMethod: Using method [%d] for lossless compression.\n", nxagentPackLossless); #endif if (supportedMethods[nxagentPackMethod] == 0) { fprintf(stderr, "Warning: Pack method '%d' not supported by the proxy.\n", nxagentPackMethod); fprintf(stderr, "Warning: Replacing with lossless pack method '%d'.\n", nxagentPackLossless); nxagentPackMethod = nxagentPackLossless; } } if (nxagentPackMethod == nxagentPackLossless) { nxagentPackQuality = 9; } #ifdef TEST fprintf(stderr, "nxagentSetPackMethod: Assuming pack methods [%d] and [%d] with " "quality [%d].\n", nxagentPackMethod, nxagentPackLossless, nxagentPackQuality); #endif } /* * Each defer level adds the following rules to the previous ones: * * Level 0 Eager encoding. * * Level 1 No data is put or copied on pixmaps, marking them always * as corrupted and synchronizing them on demand, i.e. when * a copy area to a window is requested, the source is syn- * chronized before copying it. * * Level 2 The put images over the windows are skipped marking the * destination as corrupted. The same happens for copy area * and composite operations, spreading the corrupted regions * of involved drawables. */ void nxagentSetDeferLevel(void) { /* defaults */ int deferLevel = 0; int tileWidth = 64; int tileHeight = 64; int deferTimeout = 200; /* * Streaming is only partly implemented and is not available in this * version of the agent. */ if (nxagentOption(Streaming) == 1) { fprintf(stderr, "Warning: Streaming of images not available in this agent.\n"); nxagentChangeOption(Streaming, 0); } switch (nxagentOption(LinkType)) { case LINK_TYPE_MODEM: case LINK_TYPE_ISDN: { deferLevel = 2; tileWidth = 64; tileHeight = 64; break; } case LINK_TYPE_ADSL: { deferLevel = 2; tileWidth = 4096; tileHeight = 4096; break; } case LINK_TYPE_WAN: { deferLevel = 1; tileWidth = 4096; tileHeight = 4096; break; } case LINK_TYPE_NONE: case LINK_TYPE_LAN: { deferLevel = 0; tileWidth = 4096; tileHeight = 4096; break; } default: { fprintf(stderr, "Warning: Unknown link type [%d] processing the defer option.\n", nxagentOption(LinkType)); break; } } /* * Set the defer timeout. */ if (nxagentOption(Shadow) == 1) { #ifdef TEST fprintf(stderr, "nxagentSetDeferLevel: Ignoring defer timeout parameter in shadow mode.\n"); #endif } else { nxagentChangeOption(DeferTimeout, deferTimeout); } /* * Set the defer level. */ if (nxagentOption(Shadow) == 1) { #ifdef TEST fprintf(stderr, "nxagentSetDeferLevel: Ignoring defer parameter in shadow mode.\n"); #endif } else if (nxagentOption(DeferLevel) != UNDEFINED) { #ifdef TEST fprintf(stderr, "nxagentSetDeferLevel: Not overriding the [defer] option " "with value [%d]. Defer timeout is [%ld] ms.\n", nxagentOption(DeferLevel), nxagentOption(DeferTimeout)); #endif } else { nxagentChangeOption(DeferLevel, deferLevel); #ifdef TEST fprintf(stderr, "nxagentSetDeferLevel: Assuming defer level [%d] with timeout of [%ld] ms.\n", nxagentOption(DeferLevel), nxagentOption(DeferTimeout)); #endif } /* * Set the tile width. */ if (nxagentOption(TileWidth) != UNDEFINED) { #ifdef TEST fprintf(stderr, "nxagentSetDeferLevel: Not overriding the [tile] option " "width value [%d].\n", nxagentOption(TileWidth)); #endif } else { nxagentChangeOption(TileWidth, tileWidth); #ifdef TEST fprintf(stderr, "nxagentSetDeferLevel: Assuming tile width [%d].\n", nxagentOption(TileWidth)); #endif } /* * Set the tile height. */ if (nxagentOption(TileHeight) != UNDEFINED) { #ifdef TEST fprintf(stderr, "nxagentSetDeferLevel: Not overriding the [tile] option " "height value [%d].\n", nxagentOption(TileHeight)); #endif } else { nxagentChangeOption(TileHeight, tileHeight); #ifdef TEST fprintf(stderr, "nxagentSetDeferLevel: Assuming tile height [%d].\n", nxagentOption(TileHeight)); #endif } } void nxagentSetBufferSize(void) { int size = 16384; switch (nxagentOption(LinkType)) { case LINK_TYPE_MODEM: { size = 4096; break; } case LINK_TYPE_ISDN: { size = 4096; break; } case LINK_TYPE_ADSL: { size = 8192; break; } case LINK_TYPE_WAN: { size = 16384; break; } case LINK_TYPE_NONE: case LINK_TYPE_LAN: { size = 16384; break; } default: { fprintf(stderr, "Warning: Unknown link type '%d' while setting the display buffer size.\n", nxagentOption(LinkType)); break; } } nxagentChangeOption(DisplayBuffer, size); nxagentBuffer = size; if (NXSetDisplayBuffer(nxagentDisplay, nxagentBuffer) < 0) { fprintf(stderr, "Warning: Can't set the display buffer size to [%d].\n", nxagentBuffer); } } void nxagentSetScheduler(void) { /* * The smart scheduler is the default. */ if (nxagentOption(Shadow) == 1) { #ifdef TEST fprintf(stderr, "nxagentSetScheduler: Using the dumb scheduler in shadow mode.\n"); #endif nxagentDisableTimer(); } } void nxagentSetCoalescence(void) { int timeout = 0; switch (nxagentOption(LinkType)) { case LINK_TYPE_MODEM: { timeout = 50; break; } case LINK_TYPE_ISDN: { timeout = 20; break; } case LINK_TYPE_ADSL: { timeout = 10; break; } case LINK_TYPE_WAN: { timeout = 5; break; } case LINK_TYPE_NONE: case LINK_TYPE_LAN: { timeout = 0; break; } default: { fprintf(stderr, "Warning: Unknown link type '%d' while setting the display coalescence.\n", nxagentOption(LinkType)); break; } } #ifdef TEST fprintf(stderr, "nxagentSetCoalescence: Using coalescence timeout of [%d] ms.\n", timeout); #endif nxagentChangeOption(DisplayCoalescence, timeout); } void nxagentShowVersionInfo(void) { ErrorF("NXAGENT - Version " NX_VERSION_CURRENT_STRING "\n"); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Args.h0000644000000000000000000001011113614532331017714 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #ifndef __Args_H__ #define __Args_H__ #define MD5_LENGTH 16 struct UserGeometry{ int flag; int X; int Y; unsigned int Width; unsigned int Height; }; extern Bool nxagentUseNXTrans; #define NXAGENTSESSIONIDLENGTH 256 #define NXAGENTDISPLAYNAMELENGTH 1024 #define NXAGENTSHADOWDISPLAYNAMELENGTH 1024 #define NXAGENTWINDOWNAMELENGTH 256 #define NXAGENTDIALOGNAMELENGTH 256 extern char nxagentSessionId[NXAGENTSESSIONIDLENGTH]; extern char nxagentDisplayName[NXAGENTDISPLAYNAMELENGTH]; extern char nxagentShadowDisplayName[NXAGENTSHADOWDISPLAYNAMELENGTH]; extern char nxagentWindowName[NXAGENTWINDOWNAMELENGTH]; extern char nxagentDialogName[NXAGENTDIALOGNAMELENGTH]; extern Bool nxagentSynchronize; extern Bool nxagentRealWindowProp; extern Bool nxagentFullGeneration; extern int nxagentDefaultClass; extern Bool nxagentUserDefaultClass; extern int nxagentDefaultDepth; extern Bool nxagentUserDefaultDepth; extern int nxagentX; extern int nxagentY; extern unsigned int nxagentWidth; extern unsigned int nxagentHeight; extern struct UserGeometry nxagentUserGeometry; extern Bool nxagentUserBorderWidth; extern int nxagentNumScreens; extern Bool nxagentDoDirectColormaps; extern Window nxagentParentWindow; extern int nxagentMaxAllowedReset; extern Bool nxagentResizeDesktopAtStartup; extern int nxagentLockDeferLevel; Bool nxagentPostProcessArgs(char *name, Display *dpy, Screen *scr); void nxagentProcessOptions(char * string); void nxagentProcessOptionsFile(char * filename); void nxagentSetPackMethod(void); void nxagentSetDeferLevel(void); void nxagentSetBufferSize(void); void nxagentSetScheduler(void); void nxagentSetCoalescence(void); void nxagentShowVersionInfo(void); extern int nxagentUserDefinedFontPath; extern int nxagentRemoteMajor; extern char *nxagentKeystrokeFile; #endif /* __Args_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Atoms.c0000644000000000000000000005026213614532331020111 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "scrnintstr.h" #include "Agent.h" #include "Xutil.h" #include "Xatom.h" #include "Xlib.h" #include "misc.h" #include "scrnintstr.h" #include "resource.h" #include #include "Atoms.h" #include "Args.h" #include "Image.h" #include "Display.h" #include "Screen.h" #include "Options.h" #include "Agent.h" #include "Utils.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG /* * These values should be moved in * the option repository. */ Bool nxagentWMIsRunning; static void startWMDetection(void); static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet); #ifdef DEBUG static void nxagentPrintAtomMapInfo(char *message); #else #define nxagentPrintAtomMapInfo(arg) #endif Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS]; static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] = { "NX_IDENTITY", /* 0 */ /* NX_IDENTITY was used in earlier nx versions to communicate the version to NXwin. Got dropped between nxagent 1.5.0-45 and 1.5.0-112. */ "WM_PROTOCOLS", /* 1 */ /* standard ICCCM Atom */ "WM_DELETE_WINDOW", /* 2 */ /* standard ICCCM Atom */ "WM_NX_READY", /* 3 */ /* nxagent takes the ownership of the selection with this name to signal the nxclient (or any other watching program) it is ready. */ "MCOPGLOBALS", /* 4 */ /* used for artsd support. */ "NX_CUT_BUFFER_SERVER", /* 5 */ /* this is the name of a property on nxagent's window on the real X server. This property is used for passing clipboard content from clients of the real X server to nxagent's clients Unfortunately we cannot rename this to NX_SELTRANS_TO_AGENT because nomachine's nxclient is depending on this selection */ "TARGETS", /* 6 */ /* used to request a list of supported data formats from the selection owner. Standard ICCCM Atom */ "TEXT", /* 7 */ /* one of the supported data formats for selections. Standard ICCCM Atom */ "NX_AGENT_SIGNATURE", /* 8 */ /* this is used to set a property on nxagent's window if nxagent is started with the fullscreen option set. Unsure, what this is used for. */ "NXDARWIN", /* 9 */ /* this was an Atom in nxdarwin, nomachine's X server for MacOS. */ "CLIPBOARD", /* 10 */ /* Atom for the clipboard selection. PRIMARY is fixed in X11 but CLIPBOARD is not. Standard ICCCM Atom. */ "TIMESTAMP", /* 11 */ /* used to request the time a selection has been owned. Standard ICCCM Atom */ "UTF8_STRING", /* 12 */ /* one of the supported data formats for selections. Standard ICCCM Atom */ "_NET_WM_STATE", /* 13 */ /* standard ICCCM Atom */ "_NET_WM_STATE_FULLSCREEN", /* 14 */ /* standard ICCCM Atom */ "NX_SELTRANS_FROM_AGENT", /* 15 */ /* this is the name of a property on nxagent's window on the real X server. This property is used for passing clipboard content from nxagent's clients to clients on the real X server */ "COMPOUND_TEXT", /* 16 */ /* one of the supported data formats for selections. Standard ICCCM Atom */ NULL, NULL }; static XErrorHandler previousErrorHandler = NULL; static void catchAndRedirect(Display* dpy, XErrorEvent* X) { if (X -> error_code == BadAccess && X -> request_code == X_ChangeWindowAttributes && X -> resourceid == DefaultRootWindow(dpy)) { nxagentWMIsRunning = True; } else { previousErrorHandler(dpy, X); } } static void startWMDetection(void) { /* * We are trying to detect if is there any client * that is listening for 'WM' events on the root * window. */ nxagentWMIsRunning = False; previousErrorHandler = XSetErrorHandler((XErrorHandler)&catchAndRedirect); /* * After this request we need to Sync with * the X server to be sure we get any error * that is generated. */ XSelectInput(nxagentDisplay, RootWindow (nxagentDisplay, 0), SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask); } static void finishWMDetection(Bool verbose) { XSetErrorHandler(previousErrorHandler); if (nxagentWMIsRunning) { if (verbose == 1) { fprintf(stderr, "Info: Detected window manager running.\n"); } } else { if (verbose == 1) { fprintf(stderr, "Info: Not found a window manager running.\n"); } /* * We are not really interested on root window events. */ XSelectInput(nxagentDisplay, RootWindow (nxagentDisplay, 0), 0); } } void nxagentWMDetect() { /* FIXME: verbose is always false, there's no code to set it to true */ Bool verbose = False; Bool windowManagerWasRunning = nxagentWMIsRunning; startWMDetection(); XSync(nxagentDisplay, 0); if (windowManagerWasRunning != nxagentWMIsRunning) { verbose = False; } finishWMDetection(verbose); } void nxagentInitAtoms() { /* * Value of nxagentAtoms[8] is "NX_AGENT_SIGNATURE". * * We don't need to save the atom's value. It will * be checked by other agents to find if they are * run nested. */ Atom atom = MakeAtom(nxagentAtomNames[8], strlen(nxagentAtomNames[8]), 1); if (atom == None) { #ifdef PANIC fprintf(stderr, "%s: PANIC! Could not create [%s] atom.\n", __func__, nxagentAtomNames[8]); #endif } else { #ifdef TEST fprintf(stderr, "nxagentInitAtoms: atom [%s] created with value [%d].\n", nxagentAtomNames[8], atom); #endif } } int nxagentQueryAtoms(ScreenPtr pScreen) { static unsigned long atomGeneration = 1; int num_of_atoms = NXAGENT_NUMBER_OF_ATOMS; char *names[NXAGENT_NUMBER_OF_ATOMS]; #ifdef TEST fprintf(stderr, "%s: Going to create the intern atoms on real display.\n", __func__); #endif nxagentPrintAtomMapInfo("nxagentQueryAtoms: Entering"); for (int i = 0; i < num_of_atoms; i++) { names[i] = nxagentAtomNames[i]; nxagentAtoms[i] = None; } if (nxagentSessionId[0]) { names[num_of_atoms - 1] = nxagentSessionId; } else { num_of_atoms--; } startWMDetection(); nxagentInitAtomMap(names, num_of_atoms, nxagentAtoms); /* * We need to be synchronized with the X server * in order to detect the Window Manager, since * after a reset the XInternAtom could be cached * by Xlib. */ if (atomGeneration != serverGeneration) { #ifdef WARNING fprintf(stderr, "%s: The nxagent has been reset with server %ld atom %ld.\n", __func__, serverGeneration, atomGeneration); fprintf(stderr, "%s: Forcing a sync to detect the window manager.\n", __func__); #endif atomGeneration = serverGeneration; XSync(nxagentDisplay, 0); } finishWMDetection(False); /* * Value of nxagentAtoms[9] is "NXDARWIN". * * We check if it was created by the NX client. */ if (nxagentAtoms[9] > nxagentAtoms[0]) { nxagentAtoms[9] = None; } /* * Value of nxagentAtoms[8] is "NX_AGENT_SIGNATURE". * * This atom is created internally by the agent server at * startup to let other agents determine if they are run * nested. If agent is run nested, in fact, at the time it * will create the NX_AGENT_SIGNATURE atom on the real X * server it will find the existing atom with a value less * than any NX_IDENTITY created but itself. */ if (nxagentAtoms[8] > nxagentAtoms[0]) { nxagentAtoms[8] = None; } if (nxagentAtoms[8] != None) { /* * We are running nested in another agent * server. */ nxagentChangeOption(Nested, 1); /* * Avoid the image degradation caused by * multiple lossy encoding. */ fprintf(stderr, "Warning: Disabling use of lossy encoding in nested mode.\n"); nxagentPackMethod = nxagentPackLossless; } #ifdef TEST for (int i = 0; i < num_of_atoms; i++) { fprintf(stderr, "%s: Created intern atom [%s] with id [%ld].\n", __func__, names[i], nxagentAtoms[i]); } #endif nxagentPrintAtomMapInfo("nxagentQueryAtoms: Exiting"); return 1; } #define NXAGENT_ATOM_MAP_SIZE_INCREMENT 256 typedef struct { Atom local; XlibAtom remote; const char *string; int length; } AtomMap; static AtomMap *privAtomMap = NULL; static unsigned int privAtomMapSize = 0; static unsigned int privLastAtom = 0; static void nxagentExpandCache(void); static void nxagentWriteAtom(Atom, XlibAtom, const char*, Bool); static AtomMap* nxagentFindAtomByRemoteValue(XlibAtom); static AtomMap* nxagentFindAtomByLocalValue(Atom); static AtomMap* nxagentFindAtomByName(char*, unsigned); static void nxagentExpandCache(void) { privAtomMapSize += NXAGENT_ATOM_MAP_SIZE_INCREMENT; privAtomMap = realloc(privAtomMap, privAtomMapSize * sizeof(AtomMap)); if (privAtomMap == NULL) { FatalError("nxagentExpandCache: realloc failed\n"); } } /* * Check if there is space left on the map and manage the possible * consequent allocation, then cache the atom-couple. */ static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string, Bool duplicate) { const char *s; /* * We could remove this string duplication if we knew for sure that * the server will not reset, since only at reset the dix layer * frees all the atom names. */ if (duplicate) { s = strdup(string); #ifdef WARNING if (s == NULL) { fprintf(stderr, "nxagentWriteAtom: Malloc failed.\n"); } #endif } else { s = string; } if (privLastAtom == privAtomMapSize) { nxagentExpandCache(); } privAtomMap[privLastAtom].local = local; privAtomMap[privLastAtom].remote = remote; privAtomMap[privLastAtom].string = s; privAtomMap[privLastAtom].length = strlen(s); privLastAtom++; } /* * FIXME: We should clean up the atom map at nxagent reset, in order * to cancel all the local atoms but still maintaining the Xserver * values and the atom names. */ void nxagentResetAtomMap(void) { nxagentPrintAtomMapInfo("nxagentResetAtomMap: Entering"); for (unsigned int i = 0; i < privLastAtom; i++) { privAtomMap[i].local = None; } nxagentPrintAtomMapInfo("nxagentResetAtomMap: Exiting"); } /* * Init map. * Initializing the atomNameList all in one. */ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet) { unsigned int i; int list_size = count + privLastAtom; nxagentPrintAtomMapInfo("nxagentInitAtomMap: Entering"); XlibAtom *atom_list = malloc((list_size) * sizeof(*atom_list)); char **name_list = malloc((list_size) * sizeof(char*)); if ((atom_list == NULL) || (name_list == NULL)) { FatalError("nxagentInitAtomMap: malloc failed\n"); } for (i = 0; i < count; i++) { name_list[i] = atomNameList[i]; atom_list[i] = None; } for (i = 0; i < privLastAtom; i++) { name_list[count + i] = (char *)privAtomMap[i].string; atom_list[count + i] = None; } /* * Ask X-Server for our Atoms * ... if successful cache them too. */ int ret_value = XInternAtoms(nxagentDisplay, name_list, list_size, False, atom_list); if (ret_value == 0) { #ifdef TEST fprintf(stderr, "nxagentInitAtomMap: WARNING! XInternAtoms request failed.\n"); #endif SAFE_free(atom_list); SAFE_free(name_list); return 0; } for (i = 0; i < list_size; i++) { AtomMap *aMap = nxagentFindAtomByName(name_list[i], strlen(name_list[i])); if (aMap == NULL) { Atom local = MakeAtom(name_list[i], strlen(name_list[i]), True); if (ValidAtom(local)) { nxagentWriteAtom(local, atom_list[i], name_list[i], False); } else { #ifdef WARNING fprintf(stderr, "nxagentInitAtomMap: WARNING MakeAtom failed.\n"); #endif } } else { aMap -> remote = atom_list[i]; if (i < count && aMap -> local == None) { aMap -> local = MakeAtom(name_list[i], strlen(name_list[i]), True); } } if (i < count) { atomsRet[i] = atom_list[i]; } } SAFE_free(atom_list); SAFE_free(name_list); nxagentPrintAtomMapInfo("nxagentInitAtomMap: Exiting"); return 1; } /* * If the nxagent has been reset, the local value of the atoms stored * in cache could have the value None, do not call this function with * None. */ static AtomMap* nxagentFindAtomByLocalValue(Atom local) { if (!ValidAtom(local)) { return NULL; } for (unsigned int i = 0; i < privLastAtom; i++) { if (local == privAtomMap[i].local) { return (privAtomMap + i); } } return NULL; } static AtomMap* nxagentFindAtomByRemoteValue(XlibAtom remote) { if (remote == None || remote == BAD_RESOURCE) { return NULL; } for (unsigned int i = 0; i < privLastAtom; i++) { if (remote == privAtomMap[i].remote) { return (privAtomMap + i); } } return NULL; } static AtomMap* nxagentFindAtomByName(char *string, unsigned int length) { for (unsigned int i = 0; i < privLastAtom; i++) { if ((length == privAtomMap[i].length) && (strcmp(string, privAtomMap[i].string) == 0)) { return (privAtomMap + i); } } return NULL; } /* * Convert local atom's name to X-server value. * Reading them from map, if they have been already cached or * really asking to X-server and caching them. * FIXME: I don't really know if is better to allocate * an automatic variable like ret_value and write it, instead of make all * these return!, perhaps this way the code is a little bit easyer to read. * I think this and the 2 .*Find.* are the only functions to look for performances. */ XlibAtom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit) { AtomMap *current; /* * Surely MakeAtom is faster than * our nxagentFindAtomByName. */ Atom local = MakeAtom(string, length, Makeit); if (!ValidAtom(local)) { return None; } if (local <= XA_LAST_PREDEFINED) { return local; } if ((current = nxagentFindAtomByLocalValue(local))) { /* * Found cached by value. */ return current->remote; } if ((current = nxagentFindAtomByName(string, length))) { /* * Found cached by name. * It means that nxagent has been reset, * but not the xserver so we still have cached its atoms. */ current->local = local; return current->remote; } /* * We really have to ask the Xserver for it. */ { XlibAtom remote = XInternAtom(nxagentDisplay, string, !Makeit); if (remote == None) { #ifdef WARNING fprintf(stderr, "nxagentMakeAtom: WARNING XInternAtom failed.\n"); #endif return None; } nxagentWriteAtom(local, remote, string, True); return remote; } } XlibAtom nxagentLocalToRemoteAtom(Atom local) { #ifdef TEST fprintf(stderr, "%s: entering\n", __func__); #endif if (!ValidAtom(local)) { #ifdef DEBUG fprintf(stderr, "%s: local [%d] is no valid - returning None\n", __func__, local); #endif return None; } if (local <= XA_LAST_PREDEFINED) { #ifdef DEBUG fprintf(stderr, "%s: local [%d] is < XA_LAST_PREDEFINED [%d]\n", __func__, local, XA_LAST_PREDEFINED); #endif return local; } AtomMap *current = nxagentFindAtomByLocalValue(local); if (current) { #ifdef TEST fprintf(stderr, "%s: local [%d] -> remote [%d]\n", __func__, local, current->remote); #endif return current->remote; } const char *string = NameForAtom(local); XlibAtom remote = XInternAtom(nxagentDisplay, string, False); if (remote == None) { #ifdef WARNING fprintf(stderr, "nxagentLocalToRemoteAtom: WARNING XInternAtom failed.\n"); #endif return None; } nxagentWriteAtom(local, remote, string, True); #ifdef TEST fprintf(stderr, "%s: local [%d] -> remote [%d (%s)]\n", __func__, local, remote, string); #endif return remote; } Atom nxagentRemoteToLocalAtom(XlibAtom remote) { if (remote == None || remote == BAD_RESOURCE) { #ifdef DEBUG fprintf(stderr, "%s: remote [%d] is None or BAD_RESOURCE\n", __func__, remote); #endif return None; } if (remote <= XA_LAST_PREDEFINED) { #ifdef DEBUG fprintf(stderr, "%s: remote [%d] is <= XA_LAST_PREDEFINED [%d]\n", __func__, remote, XA_LAST_PREDEFINED); #endif return remote; } AtomMap *current = nxagentFindAtomByRemoteValue(remote); if (current) { if (!ValidAtom(current->local)) { Atom local = MakeAtom(current->string, current->length, True); if (ValidAtom(local)) { current->local = local; } else { #ifdef WARNING fprintf(stderr, "nxagentRemoteToLocalAtom: WARNING MakeAtom failed.\n"); #endif current->local = None; } } #ifdef DEBUG fprintf(stderr, "%s: remote [%d] -> local [%d]\n", __func__, remote, current->local); #endif return current->local; } char *string = XGetAtomName(nxagentDisplay, remote); if (string) { Atom local = MakeAtom(string, strlen(string), True); if (!ValidAtom(local)) { #ifdef WARNING fprintf(stderr, "%s: WARNING MakeAtom failed.\n", __func__); #endif local = None; } nxagentWriteAtom(local, remote, string, True); #ifdef TEST fprintf(stderr, "%s: remote [%d (%s)] -> local [%d]\n", __func__, remote, string, local); #endif SAFE_XFree(string); return local; } #ifdef WARNING fprintf(stderr, "%s: WARNING failed to get name from remote atom.\n", __func__); #endif return None; } #ifdef DEBUG static void nxagentPrintAtomMapInfo(char *message) { fprintf(stderr, "--------------- Atom map in context [%s] ----------------------\n", message); fprintf(stderr, "nxagentPrintAtomMapInfo: Map at [%p] size [%d] number of entry [%d] auto increment [%d].\n", (void*) privAtomMap, privLastAtom, privAtomMapSize, NXAGENT_ATOM_MAP_SIZE_INCREMENT); for (unsigned int i = 0; i < privLastAtom; i++) { fprintf(stderr, "[%5.1d] local: %6.1u - remote: %6.1u - [%p] %s\n", i, privAtomMap[i].local, privAtomMap[i].remote, privAtomMap[i].string, validateString(privAtomMap[i].string)); } fprintf(stderr, "---------------------------------------------\n"); } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Atoms.h0000644000000000000000000000554613614532331020123 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Atoms_H__ #define __Atoms_H__ #include "X.h" #include "../../include/window.h" #include "screenint.h" #define NXAGENT_NUMBER_OF_ATOMS 18 extern Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS]; extern Bool nxagentWMIsRunning; /* * Create the required atoms internally * to the agent server. */ void nxagentInitAtoms(); /* * Query and create all the required atoms * on the remote X server using a single * round trip. */ int nxagentQueryAtoms(ScreenPtr pScreen); void nxagentResetAtomMap(void); void nxagentWMDetect(void); #ifdef XlibAtom /* * only provide these protoypes if the including file knows about Xlib * types. This allows us including Atoms.h without having to use the * Xlib type magic of Agent.h */ /* * Create the atoms on the remote X server * and cache the couple local-remote atoms. */ XlibAtom nxagentMakeAtom(char *, unsigned, Bool); /* * Converts local atoms in remote atoms and * viceversa. */ Atom nxagentRemoteToLocalAtom(XlibAtom); XlibAtom nxagentLocalToRemoteAtom(Atom); #endif #endif /* __Atoms_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Binder.c0000644000000000000000000001175713614532331020237 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include #include #include #include #include "Binder.h" #include "Options.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG int nxagentCheckBinder(int argc, char *argv[], int i) { if (++i < argc) { char *display = argv[i]; /* * Check if a display specification follows the -B switch. */ char *found = rindex(display, ':'); if (found == NULL || *(found + 1) == '\0' || isdigit(*(found + 1)) == 0) { fprintf(stderr, "Error: Can't identify the display port in string '%s'.\n", display); return 0; } int port = atoi(found + 1); #ifdef TEST fprintf(stderr, "nxagentCheckBinder: Identified agent display port [%d].\n", port); #endif /* * The NX options must be specified in the DISPLAY * environment. Check if the display specified on the command line * matches the NX virtual display. */ display = getenv("DISPLAY"); if (display == NULL || *display == '\0') { fprintf(stderr, "Error: No DISPLAY environment found.\n"); return 0; } found = rindex(display, ':'); if (found == NULL || *(found + 1) == '\0' || isdigit(*(found + 1)) == 0 || atoi(found + 1) != port) { fprintf(stderr, "Error: The NX display doesn't match the agent display :%d.\n", port); return 0; } #ifdef TEST fprintf(stderr, "nxagentCheckBinder: Identified NX display port [%d].\n", atoi(found + 1)); #endif /* * Save the proxy options. They will be later used to create the * transport. */ nxagentChangeOption(Rootless, False); nxagentChangeOption(Desktop, False); nxagentChangeOption(Binder, True); /* * FIXME: This now points to the buffer that was returned by * getenv(). It is to be decided how to handle the values of type * string in the Options repository. */ nxagentChangeOption(BinderOptions, display); return 2; } fprintf(stderr, "Error: No display port specified in command.\n"); return 0; } int nxagentBinderLoop(void) { struct timeval timeout; char *options = nxagentOption(BinderOptions); #ifdef TEST fprintf(stderr, "nxagentBinderLoop: Creating the NX transport.\n"); #endif if (NXTransCreate(NX_FD_ANY, NX_MODE_CLIENT, options) < 0) { #ifdef TEST fprintf(stderr, "nxagentBinderLoop: PANIC! Error creating the NX transport.\n"); #endif return -1; } #ifdef TEST fprintf(stderr, "nxagentBinderLoop: Yielding control to the NX entry point.\n"); #endif while (NXTransRunning(NX_FD_ANY)) { #ifdef DEBUG fprintf(stderr, "nxagentBinderLoop: Going to run a new NX proxy loop.\n"); #endif timeout.tv_sec = 10; timeout.tv_usec = 0; NXTransContinue(&timeout); #ifdef DEBUG fprintf(stderr, "nxagentBinderLoop: Completed execution of the NX loop.\n"); #endif } #ifdef TEST fprintf(stderr, "nxagentBinderLoop: Exiting the NX proxy binder loop.\n"); #endif return 1; } void nxagentBinderExit(int code) { NXTransExit(code); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Binder.h0000644000000000000000000000376713614532331020246 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Binder_H__ #define __Binder_H__ int nxagentCheckBinder(int argc, char *argv[], int i); int nxagentBinderLoop(void); void nxagentBinderExit(int code); #endif /* __Binder_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/BitmapUtils.c0000644000000000000000000000720113614532331021256 0ustar /* Copyright 1990, 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * Author: Keith Packard, MIT X Consortium */ /* * Derived from libXfont1's utilbitmap.c (available via fontmisc.h). */ /* Utility functions for reformating font bitmaps */ static const unsigned char _reverse_byte[0x100] = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff }; /* * Invert bit order within each BYTE of an array. */ void nxagentBitOrderInvert(unsigned char *buf, int nbytes) { const unsigned char *rev = _reverse_byte; for (; --nbytes >= 0; buf++) *buf = rev[*buf]; } /* * Invert byte order within each 16-bits of an array. */ void nxagentTwoByteSwap(unsigned char *buf, int nbytes) { unsigned char c; for (; nbytes > 0; nbytes -= 2, buf += 2) { c = buf[0]; buf[0] = buf[1]; buf[1] = c; } } /* * Invert byte order within each 32-bits of an array. */ void nxagentFourByteSwap(unsigned char *buf, int nbytes) { unsigned char c; for (; nbytes > 0; nbytes -= 4, buf += 4) { c = buf[0]; buf[0] = buf[3]; buf[3] = c; c = buf[1]; buf[1] = buf[2]; buf[2] = c; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Client.c0000644000000000000000000003357013614532331020247 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Used in handling of karma on lost focus. */ #include #include #include #include #include "Xatom.h" #include "dixstruct.h" #include "scrnintstr.h" #include "windowstr.h" #include "osdep.h" /* * NX specific includes and definitions. */ #include "Agent.h" #include "Args.h" #include "Display.h" #include "Client.h" #include "Dialog.h" #include "Handlers.h" #include "Events.h" #include "Drawable.h" #include "Utils.h" /* * Need to include this after the stub definition of GC in Agent.h. */ #include "compext/Compext.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG /* * Returns the last signal delivered to the process. */ extern int _X11TransSocketCheckSignal(void); /* * Time in milliseconds of first iteration through the dispatcher. */ unsigned long nxagentStartTime = -1; /* * If defined, add a function checking if we need a null timeout after * a client wakeup. */ #undef CHECK_RESTARTED_CLIENTS #ifdef CHECK_RESTARTED_CLIENTS void nxagentCheckRestartedClients(struct timeval **timeout); #endif /* * Allow attaching private members to the client. */ int nxagentClientPrivateIndex; /* * The master nxagent holds in nxagentShadowCounter the number of * shadow nxagents connected to itself. */ int nxagentShadowCounter = 0; void nxagentInitClientPrivates(ClientPtr client) { if (nxagentClientPriv(client)) { nxagentClientPriv(client) -> clientState = 0; nxagentClientPriv(client) -> clientBytes = 0; nxagentClientPriv(client) -> clientHint = UNKNOWN; } } /* * Guess the running application based on the properties attached to * its main window. */ void nxagentGuessClientHint(ClientPtr client, Atom property, char *data) { #ifdef TEST fprintf(stderr, "++++++nxagentGuessClientHint: Client [%d] setting property [%s] as [%s].\n", client -> index, validateString(NameForAtom(property)), validateString(data)); #endif if (nxagentClientPriv(client) -> clientHint == UNKNOWN) { if (property == XA_WM_CLASS) { if (strcmp(data, "nxclient") == 0) { #ifdef TEST fprintf(stderr, "++++++nxagentGuessClientHint: Detected nxclient as [%d].\n", client -> index); #endif nxagentClientHint(client) = NXCLIENT_WINDOW; } else if (strstr(data, "java")) { #ifdef TEST fprintf(stderr, "++++++nxagentGuessClientHint: Detected java as [%d].\n", client -> index); #endif nxagentClientHint(client) = JAVA_WINDOW; } } } if (nxagentClientPriv(client) -> clientHint == NXCLIENT_WINDOW) { if (property == MakeAtom("WM_WINDOW_ROLE", 14, True) && strncmp(data, "msgBox", 6) == 0) { #ifdef TEST fprintf(stderr, "++++++nxagentGuessClientHint: Detected nxclient dialog as [%d].\n", client -> index); #endif nxagentClientHint(client) = NXCLIENT_DIALOG; } } } void nxagentGuessShadowHint(ClientPtr client, Atom property) { #ifdef DEBUG fprintf(stderr, "nxagentGuessShadowHint: Client [%d] setting property [%s].\n", client -> index, validateString(NameForAtom(property))); #endif if (nxagentClientPriv(client) -> clientHint == UNKNOWN) { if (strcmp(validateString(NameForAtom(property)), "_NX_SHADOW") == 0) { #ifdef TEST fprintf(stderr, "nxagentGuessShadowHint: nxagentShadowCounter [%d].\n", nxagentShadowCounter); fprintf(stderr, "nxagentGuessShadowHint: Detected shadow nxagent as client [%d].\n", client -> index); #endif nxagentClientHint(client) = NXAGENT_SHADOW; nxagentShadowCounter++; #ifdef TEST fprintf(stderr, "nxagentGuessShadowHint: nxagentShadowCounter [%d].\n", nxagentShadowCounter); #endif /* * From this moment on we ignore the visibility checks to keep * the windows updated. */ nxagentChangeOption(IgnoreVisibility, 1); } } } void nxagentCheckIfShadowAgent(ClientPtr client) { if (nxagentClientPriv(client) -> clientHint == NXAGENT_SHADOW) { #ifdef TEST fprintf(stderr, "nxagentCheckIfShadowAgent: nxagentShadowCounter [%d].\n", nxagentShadowCounter); fprintf(stderr, "nxagentCheckIfShadowAgent: Shadow nxagent as client [%d] detached.\n", client -> index); fprintf(stderr, "nxagentCheckIfShadowAgent: Decreasing nxagentShadowCounter.\n"); #endif /* * We decrease nxagentShadowCounter. */ nxagentShadowCounter--; #ifdef TEST fprintf(stderr, "nxagentCheckIfShadowAgent: nxagentShadowCounter [%d].\n", nxagentShadowCounter); #endif if (nxagentShadowCounter == 0) { /* * The last shadow nxagent has been detached from master * nxagent. The master nxagent could do some action here. */ #ifdef TEST fprintf(stderr, "nxagentCheckIfShadowAgent: The last shadow nxagent has been detached.\n"); #endif nxagentChangeOption(IgnoreVisibility, 0); } } } void nxagentWakeupByReconnect(void) { #ifdef TEST fprintf(stderr, "++++++nxagentWakeupByReconnect: Going to wakeup all clients.\n"); #endif for (int i = 1; i < currentMaxClients; i++) { if (clients[i] != NULL) { nxagentWakeupByReset(clients[i]); } } } void nxagentWakeupByReset(ClientPtr client) { #ifdef TEST fprintf(stderr, "++++++nxagentWakeupByReset: Going to check client id [%d].\n", client -> index); #endif if (nxagentNeedWakeup(client)) { #ifdef TEST fprintf(stderr, "++++++nxagentWakeupByReset: Going to wakeup client id [%d].\n", client -> index); #endif if (client -> index < MAX_CONNECTIONS) { if (nxagentNeedWakeupBySplit(client)) { nxagentWakeupBySplit(client); } } } if (client -> index < MAX_CONNECTIONS) { #ifdef TEST fprintf(stderr, "++++++nxagentWakeupByReset: Going to reset bytes received for client id [%d].\n", client -> index); #endif nxagentClientBytes(client) = 0; } } /* * Wait for any event. */ #define WAIT_ALL_EVENTS #ifndef WAIT_ALL_EVENTS static Bool nxagentWaitWakeupBySplitPredicate(Display *disp, XEvent *event, XPointer ptr) { return (event -> type == ClientMessage && (event -> xclient.data.l[0] == NXNoSplitNotify || event -> xclient.data.l[0] == NXStartSplitNotify || event -> xclient.data.l[0] == NXCommitSplitNotify || event -> xclient.data.l[0] == NXEndSplitNotify || event -> xclient.data.l[0] == NXEmptySplitNotify) && event -> xclient.window == 0 && event -> xclient.message_type == 0 && event -> xclient.format == 32); } #endif #define USE_FINISH_SPLIT void nxagentWaitWakeupBySplit(ClientPtr client) { #ifdef TEST if (nxagentNeedWakeupBySplit(client) == 0) { fprintf(stderr, "++++++nxagentWaitWakeupBySplit: WARNING! The client [%d] is already awake.\n", client -> index); } fprintf(stderr, "++++++nxagentWaitWakeupBySplit: Going to wait for the client [%d].\n", client -> index); #endif /* * Be sure we intercept an I/O error as well as an interrupt. */ #ifdef USE_FINISH_SPLIT NXFinishSplit(nxagentDisplay, client -> index); #endif NXFlushDisplay(nxagentDisplay, NXFlushBuffer); for (;;) { /* * Can we handle all the possible events here or we need to select * only the split events? Handling all the possible events would * preempt the queue and make a better use of the link. */ #ifdef WAIT_ALL_EVENTS nxagentDispatchEvents(NULL); #else nxagentDispatchEvents(nxagentWaitWakeupBySplitPredicate); #endif if (nxagentNeedWakeupBySplit(client) == 0 || NXDisplayError(nxagentDisplay) == 1) { #ifdef TEST if (nxagentNeedWakeupBySplit(client) == 0) { fprintf(stderr, "++++++nxagentWaitWakeupBySplit: Client [%d] can now run.\n", client -> index); } else { fprintf(stderr, "++++++nxagentWaitWakeupBySplit: WARNING! Display error " "detected waiting for restart.\n"); } #endif return; } #ifdef TEST fprintf(stderr, "++++++nxagentWaitWakeupBySplit: Yielding control to the NX transport.\n"); #endif nxagentWaitEvents(nxagentDisplay, 0); } } int nxagentSuspendBySplit(ClientPtr client) { /* FIXME: Should record a serial number for the client, so that the client is not restarted because of an end of split of a previous client with the same index. */ if (client -> index < MAX_CONNECTIONS) { if (nxagentNeedWakeup(client) == 0) { #ifdef TEST fprintf(stderr, "++++++nxagentSuspendBySplit: Suspending client [%d] with agent sequence [%ld].\n", client -> index, NextRequest(nxagentDisplay) - 1); #endif if (client -> clientGone == 0) { #ifdef TEST fprintf(stderr, "++++++nxagentSuspendBySplit: Client [%d] suspended.\n", client -> index); #endif IgnoreClient(client); } } #ifdef TEST else { fprintf(stderr, "++++++nxagentSuspendBySplit: WARNING! Client [%d] already ignored with state [%x].\n", client -> index, nxagentClientPriv(client) -> clientState); } #endif nxagentClientPriv(client) -> clientState |= SleepingBySplit; return 1; } #ifdef WARNING fprintf(stderr, "++++++nxagentSuspendBySplit: WARNING! Invalid client [%d] provided to function.\n", client -> index); #endif return -1; } int nxagentWakeupBySplit(ClientPtr client) { /* FIXME: Should record a serial number for the client, so that the client is not restarted because of the end of the split for a previous client with the same index. */ if (client -> index < MAX_CONNECTIONS) { nxagentClientPriv(client) -> clientState &= ~SleepingBySplit; if (nxagentNeedWakeup(client) == 0) { #ifdef TEST fprintf(stderr, "++++++nxagentWakeupBySplit: Resuming client [%d] with agent sequence [%ld].\n", client -> index, NextRequest(nxagentDisplay) - 1); #endif if (client -> clientGone == 0) { AttendClient(client); } } #ifdef TEST else { fprintf(stderr, "++++++nxagentWakeupBySplit: WARNING! Client [%d] still suspended with state [%x].\n", client -> index, nxagentClientPriv(client) -> clientState); } #endif return 1; } #ifdef WARNING fprintf(stderr, "++++++nxagentWakeupBySplit: WARNING! Invalid client [%d] provided to function.\n", client -> index); #endif return -1; } #ifdef CHECK_RESTARTED_CLIENTS void nxagentCheckRestartedClients(struct timeval **timeout) { static struct timeval zero; /* * If any of the restarted clients had requests in input we'll need * to enter the select with a null timeout, or we will block until * any other client becomes available. */ for (int i = 1; i < currentMaxClients; i++) { if (clients[i] != NULL && clients[i] -> osPrivate != NULL && nxagentNeedWakeup(clients[i]) == 0) { int fd = ((OsCommPtr) clients[i] -> osPrivate) -> fd; if (FD_ISSET(fd, &ClientsWithInput)) { #ifdef WARNING fprintf(stderr, "nxagentCheckRestartedClients: WARNING! Client [%d] with fd [%d] has input.\n", clients[i] -> index, fd); #endif #ifdef DEBUG fprintf(stderr, "nxagentCheckRestartedClients: Setting a null timeout with former timeout [%ld] Ms.\n", (*timeout) -> tv_sec * 1000 + (*timeout) -> tv_usec / 1000); #endif if (*timeout != NULL) { (*timeout) -> tv_sec = 0; (*timeout) -> tv_usec = 0; } else { zero.tv_sec = 0; zero.tv_usec = 0; *timeout = &zero; } } } } } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Client.h0000644000000000000000000000754113614532331020253 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Client_H__ #define __Client_H__ #define MAX_CONNECTIONS 256 /* * The master nxagent holds in nxagentShadowCounter * the number of shadow nxagents connected to itself. */ extern int nxagentShadowCounter; enum ClientHint { UNKNOWN = 0, NXCLIENT_WINDOW, NXCLIENT_DIALOG, NXAGENT_SHADOW, JAVA_WINDOW }; typedef struct _PrivClientRec { int clientState; long clientBytes; enum ClientHint clientHint; } PrivClientRec; extern int nxagentClientPrivateIndex; #define nxagentClientPriv(pClient) \ ((PrivClientRec *)((pClient)->devPrivates[nxagentClientPrivateIndex].ptr)) void nxagentInitClientPrivates(ClientPtr); #define nxagentClientAddBytes(pClient, size) \ (nxagentClientPriv(pClient) -> clientBytes += (size)) #define nxagentClientBytes(pClient) \ (nxagentClientPriv(pClient) -> clientBytes) #define nxagentClientHint(pClient) \ (nxagentClientPriv(pClient) -> clientHint) #define nxagentClientIsDialog(pClient) \ (nxagentClientHint(pClient) == NXCLIENT_DIALOG) /* * The actual reason why the client * is sleeping. */ #define SleepingBySplit 1 #define nxagentNeedWakeup(client) \ ((nxagentClientPriv(client) -> \ clientState) != 0) #define nxagentNeedWakeupBySplit(client) \ (((nxagentClientPriv(client) -> \ clientState) & SleepingBySplit) != 0) void nxagentGuessClientHint(ClientPtr, Atom, char*); void nxagentGuessShadowHint(ClientPtr, Atom); void nxagentCheckIfShadowAgent(ClientPtr); /* * Suspend or restart the agent's * client. */ int nxagentSuspendBySplit(ClientPtr client); int nxagentWakeupBySplit(ClientPtr client); /* * Wait until the given client is * restarted. */ void nxagentWaitWakeupBySplit(ClientPtr client); /* FIXME: This must be moved to Drawable.h. */ void nxagentWaitDrawable(DrawablePtr pDrawable); /* * Wakeup all the sleeping clients. */ void nxagentWakeupByReconnect(void); /* * Reset the client state before * closing it down. */ void nxagentWakeupByReset(ClientPtr client); #endif /* __Client_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c0000644000000000000000000023160613614532331020730 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "X.h" #include "Xproto.h" #include "Xatom.h" #include "selection.h" #include "windowstr.h" #include "scrnintstr.h" #include "Agent.h" #include "Windows.h" #include "Atoms.h" #include "Args.h" #include "Trap.h" #include "Rootless.h" #include "Clipboard.h" #include "Utils.h" #include "gcstruct.h" #include "xfixeswire.h" #include "X11/include/Xfixes_nxagent.h" /* * Use asynchronous get property replies. */ #include "compext/Compext.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG /* * These are defined in the dispatcher. */ extern int NumCurrentSelections; extern Selection *CurrentSelections; int nxagentLastClipboardClient = -1; static int agentClipboardInitialized = False; #ifdef DEBUG static int clientAccum; #endif XlibAtom serverTransToAgentProperty; Atom clientCutProperty; static Window serverWindow; const int nxagentPrimarySelection = 0; const int nxagentClipboardSelection = 1; const int nxagentMaxSelections = 2; typedef struct _SelectionOwner { XlibAtom selection; /* _external_ Atom */ ClientPtr client; /* internal client */ Window window; /* internal window id */ WindowPtr windowPtr; /* internal window struct */ Time lastTimeChanged; /* internal time */ } SelectionOwner; /* * this contains the last selection owner in nxagent. The * lastTimeChanged is always an internal time. If .client is NULL the * owner is outside nxagent. .selection will _always_ contain the * external atom of the selection */ static SelectionOwner *lastSelectionOwner; static XlibAtom nxagentLastRequestedSelection; #define IS_INTERNAL_OWNER(lsoindex) (lastSelectionOwner[lsoindex].client != NULL) /* * Needed to handle the notify selection event to * be sent to client once the selection property * has been retrieved from the real X server. */ typedef enum { SelectionStageNone, SelectionStageQuerySize, SelectionStageWaitSize, SelectionStageQueryData, SelectionStageWaitData } ClientSelectionStage; static WindowPtr lastClientWindowPtr; static ClientPtr lastClientClientPtr; static Window lastClientRequestor; static Atom lastClientProperty; static Atom lastClientSelection; static Atom lastClientTarget; static Time lastClientTime; static Time lastClientReqTime; static unsigned long lastClientPropertySize; static ClientSelectionStage lastClientStage; static Window lastServerRequestor; static XlibAtom lastServerProperty; static XlibAtom lastServerTarget; static Time lastServerTime; static XlibAtom serverTARGETS; static XlibAtom serverTIMESTAMP; static XlibAtom serverTEXT; static XlibAtom serverCOMPOUND_TEXT; static XlibAtom serverUTF8_STRING; static XlibAtom serverTransFromAgentProperty; static Atom clientTARGETS; static Atom clientTIMESTAMP; static Atom clientTEXT; static Atom clientCOMPOUND_TEXT; static Atom clientUTF8_STRING; static Atom clientCLIPBOARD; static char szAgentTARGETS[] = "TARGETS"; static char szAgentTEXT[] = "TEXT"; static char szAgentTIMESTAMP[] = "TIMESTAMP"; static char szAgentCOMPOUND_TEXT[] = "COMPOUND_TEXT"; static char szAgentUTF8_STRING[] = "UTF8_STRING"; static char szAgentNX_CUT_BUFFER_CLIENT[] = "NX_CUT_BUFFER_CLIENT"; static char szAgentCLIPBOARD[] = "CLIPBOARD"; /* number of milliseconds to wait for a conversion from the real X server. */ #define CONVERSION_TIMEOUT 5000 #ifdef DEBUG /* * Time window (milliseconds) within to detect multiple conversion * calls of the same client. */ #define ACCUM_TIME 5000 #endif /* * some helpers for debugging output */ #ifdef DEBUG const char * GetClientSelectionStageString(int stage) { switch(stage) { case SelectionStageNone: return("None"); break;; case SelectionStageQuerySize: return("QuerySize"); break;; case SelectionStageWaitSize: return("WaitSize"); break;; case SelectionStageQueryData: return("QueryData"); break;; case SelectionStageWaitData: return("WaitData"); break;; default: return("UNKNOWN!"); break;; } } #define SetClientSelectionStage(stage) do {fprintf(stderr, "%s: Changing selection stage from [%s] to [%s]\n", __func__, GetClientSelectionStageString(lastClientStage), GetClientSelectionStageString(SelectionStage##stage)); lastClientStage = SelectionStage##stage;} while (0) #define PrintClientSelectionStage() do {fprintf(stderr, "%s: Current selection stage [%s]\n", __func__, GetClientSelectionStageString(lastClientStage));} while (0) #define WINDOWID(ptr) (ptr) ? (ptr->drawable.id) : 0 #define CLINDEX(clientptr) (clientptr) ? (clientptr->index) : -1 #else #define SetClientSelectionStage(stage) do {lastClientStage = SelectionStage##stage;} while (0) #define PrintClientSelectionStage() /* * see also nx-X11/lib/src/ErrDes.c * * We use our own version to avoid Xlib doing expensive calls. * FIXME: Must check if XGetErrorText() is really causing traffic over the wire. */ const char * GetXErrorString(int code) { switch(code) { case Success: return("Success"); break;; case BadRequest: return("BadRequest"); break;; case BadValue: return("BadValue"); break;; case BadWindow: return("BadWindow"); break;; case BadPixmap: return("BadPixmap"); break;; case BadAtom: return("BadAtom"); break;; case BadCursor: return("BadCursor"); break;; case BadFont: return("BadFont"); break;; case BadMatch: return("BadMatch"); break;; case BadDrawable: return("BadDrawable"); break;; case BadAccess: return("BadAccess"); break;; case BadAlloc: return("BadAlloc"); break;; case BadColor: return("BadColor"); break;; case BadGC: return("BadGC"); break;; case BadIDChoice: return("BadIDChoice"); break;; case BadName: return("BadName"); break;; case BadLength: return("BadLength"); break;; case BadImplementation: return("BadImplementation"); break;; default: return("UNKNOWN!"); break;; } } #endif /* * Save the values queried from X server. */ XFixesAgentInfoRec nxagentXFixesInfo = { -1, -1, -1, 0 }; extern Display *nxagentDisplay; Bool nxagentValidServerTargets(XlibAtom target); static void endTransfer(Bool success); #define SELECTION_SUCCESS True #define SELECTION_FAULT False void nxagentTransferSelection(int resource); void nxagentCollectPropertyEvent(int resource); void nxagentResetSelectionOwner(void); WindowPtr nxagentGetClipboardWindow(Atom property); void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, Atom selection, Atom target, Time time); int nxagentSendNotify(xEvent *event); void nxagentPrintClipboardStat(char *); #ifdef NXAGENT_TIMESTAMP extern unsigned long startTime; #endif #ifdef DEBUG void nxagentPrintSelectionStat(int sel) { SelectionOwner lOwner = lastSelectionOwner[sel]; Selection curSel = CurrentSelections[sel]; char *s = NULL; #ifdef CLIENTIDS fprintf(stderr, " lastSelectionOwner[].client [%p] index [%d] PID [%d] Cmd [%s]\n", (void *)lOwner.client, CLINDEX(lOwner.client), GetClientPid(lOwner.client), GetClientCmdName(lOwner.client)); #else fprintf(stderr, " lastSelectionOwner[].client [%p] index [%d]\n", (void *)lOwner.client, CLINDEX(lOwner.client)); #endif fprintf(stderr, " lastSelectionOwner[].window [0x%x]\n", lOwner.window); if (lOwner.windowPtr) fprintf(stderr, " lastSelectionOwner[].windowPtr [%p] ([0x%x]\n", (void *)lOwner.windowPtr, WINDOWID(lOwner.windowPtr)); else fprintf(stderr, " lastSelectionOwner[].windowPtr -\n"); fprintf(stderr, " lastSelectionOwner[].lastTimeChanged [%u]\n", lOwner.lastTimeChanged); /* print the selection name. */ if (lOwner.client) { fprintf(stderr, " lastSelectionOwner[].selection [% 4d][%s] (local)\n", lOwner.selection, NameForAtom(lOwner.selection)); } else { SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lOwner.selection); fprintf(stderr, " lastSelectionOwner[].selection [% 4d][%s] (remote)\n", lOwner.selection, validateString(s)); SAFE_XFree(s); } #ifdef CLIENTIDS fprintf(stderr, " CurrentSelections[].client [%p] index [%d] PID [%d] Cmd [%s]\n", (void *)curSel.client, CLINDEX(curSel.client), GetClientPid(curSel.client), GetClientCmdName(curSel.client)); #else fprintf(stderr, " CurrentSelections[].client [%p] index [%d]\n", (void *)curSel.client, CLINDEX(curSel.client); #endif fprintf(stderr, " CurrentSelections[].window [0x%x]\n", curSel.window); return; } #endif void nxagentPrintClipboardStat(char *header) { #ifdef DEBUG char *s = NULL; fprintf(stderr, "/----- Clipboard internal status - %s -----\n", header); fprintf(stderr, " current time (Time) [%u]\n", GetTimeInMillis()); fprintf(stderr, " agentClipboardInitialized (Bool) [%s]\n", agentClipboardInitialized ? "True" : "False"); fprintf(stderr, " clientAccum (int) [%d]\n", clientAccum); fprintf(stderr, " nxagentMaxSelections (int) [%d]\n", nxagentMaxSelections); fprintf(stderr, " NumCurrentSelections (int) [%d]\n", NumCurrentSelections); fprintf(stderr, " serverWindow (Window) [0x%x]\n", serverWindow); fprintf(stderr, " nxagentLastClipboardClient (int) [%d]\n", nxagentLastClipboardClient); fprintf(stderr, " Clipboard mode "); switch(nxagentOption(Clipboard)) { case ClipboardBoth: fprintf(stderr, "[Both]"); break;; case ClipboardClient: fprintf(stderr, "[Client]"); break;; case ClipboardServer: fprintf(stderr, "[Server]"); break;; case ClipboardNone: fprintf(stderr, "[None]"); break;; default: fprintf(stderr, "[UNKNOWN] (FAIL!)"); break;; } fprintf(stderr, "\n"); fprintf(stderr, "lastServer\n"); fprintf(stderr, " lastServerRequestor (Window) [0x%x]\n", lastServerRequestor); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lastServerProperty); fprintf(stderr, " lastServerProperty (Atom) [% 4d][%s]\n", lastServerProperty, s); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, lastServerTarget); fprintf(stderr, " lastServerTarget (Atom) [% 4d][%s]\n", lastServerTarget, s); fprintf(stderr, " lastServerTime (Time) [%u]\n", lastServerTime); fprintf(stderr, "lastClient\n"); if (lastClientWindowPtr) fprintf(stderr, " lastClientWindowPtr (WindowPtr) [%p] ([0x%x])\n", (void *)lastClientWindowPtr, WINDOWID(lastClientWindowPtr)); else fprintf(stderr, " lastClientWindowPtr (WindowPtr) -\n"); fprintf(stderr, " lastClientClientPtr (ClientPtr) [%p]\n", (void *)lastClientClientPtr); fprintf(stderr, " lastClientRequestor (Window) [0x%x]\n", lastClientRequestor); fprintf(stderr, " lastClientProperty (Atom) [% 4d][%s]\n", lastClientProperty, NameForAtom(lastClientProperty)); fprintf(stderr, " lastClientSelection (Atom) [% 4d][%s]\n", lastClientSelection, NameForAtom(lastClientSelection)); fprintf(stderr, " lastClientTarget (Atom) [% 4d][%s]\n", lastClientTarget, NameForAtom(lastClientTarget)); fprintf(stderr, " lastClientTime (Time) [%u]\n", lastClientTime); fprintf(stderr, " lastClientReqTime (Time) [%u]\n", lastClientReqTime); fprintf(stderr, " lastClientPropertySize (unsigned long) [%lu]\n", lastClientPropertySize); fprintf(stderr, " lastClientStage (ClientSelectionStage) [%d][%s]\n", lastClientStage, GetClientSelectionStageString(lastClientStage)); fprintf(stderr, "PRIMARY\n"); nxagentPrintSelectionStat(nxagentPrimarySelection); fprintf(stderr, "CLIPBOARD\n"); nxagentPrintSelectionStat(nxagentClipboardSelection); fprintf(stderr, "Atoms (server side)\n"); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTARGETS); fprintf(stderr, " serverTARGETS [% 4d][%s]\n", serverTARGETS, validateString(s)); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTEXT); fprintf(stderr, " serverTEXT [% d][%s]\n", serverTEXT, s); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverCOMPOUND_TEXT); fprintf(stderr, " serverCOMPOUND_TEXT [% d][%s]\n", serverCOMPOUND_TEXT, s); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverUTF8_STRING); fprintf(stderr, " serverUTF8_STRING [% 4d][%s]\n", serverUTF8_STRING, s); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTransToAgentProperty); fprintf(stderr, " serverTransToAgentProperty [% 4d][%s]\n", serverTransFromAgentProperty, s); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTransFromAgentProperty); fprintf(stderr, " serverTransFromAgentProperty [% 4d][%s]\n", serverTransToAgentProperty, s); SAFE_XFree(s); s = XGetAtomName(nxagentDisplay, serverTIMESTAMP); fprintf(stderr, " serverTIMESTAMP [% 4d][%s]\n", serverTIMESTAMP, s); fprintf(stderr, "Atoms (inside nxagent)\n"); fprintf(stderr, " clientTARGETS [% 4d][%s]\n", clientTARGETS, NameForAtom(clientTARGETS)); fprintf(stderr, " clientTIMESTAMP [% 4d][%s]\n", clientTIMESTAMP, NameForAtom(clientTIMESTAMP)); fprintf(stderr, " clientTEXT [% 4d][%s]\n", clientTEXT, NameForAtom(clientTEXT)); fprintf(stderr, " clientCOMPOUND_TEXT [% 4d][%s]\n", clientCOMPOUND_TEXT, NameForAtom(clientCOMPOUND_TEXT)); fprintf(stderr, " clientUTF8_STRING [% 4d][%s]\n", clientUTF8_STRING, NameForAtom(clientUTF8_STRING)); fprintf(stderr, " clientCLIPBOARD [% 4d][%s]\n", clientCLIPBOARD, NameForAtom(clientCLIPBOARD)); fprintf(stderr, " clientCutProperty [% 4d][%s]\n", clientCutProperty, NameForAtom(clientCutProperty)); fprintf(stderr, " nxagentLastRequestedSelection [% 4d][%s]\n", nxagentLastRequestedSelection, NameForAtom(nxagentLastRequestedSelection)); fprintf(stderr, "\\------------------------------------------------------------------------------\n"); SAFE_XFree(s); #endif } /* * This is from NXproperty.c. */ int GetWindowProperty(WindowPtr pWin, Atom property, long longOffset, long longLength, Bool delete, Atom type, Atom *actualType, int *format, unsigned long *nItems, unsigned long *bytesAfter, unsigned char **propData); /* * Send a SelectionNotify event to the real X server and do some error * handling (in DEBUG mode) */ Status SendSelectionNotifyEventToServer(XSelectionEvent *event_to_send) { Window w = event_to_send->requestor; event_to_send->type = SelectionNotify; event_to_send->send_event = True; event_to_send->display = nxagentDisplay; Status result = XSendEvent(nxagentDisplay, w, False, 0L, (XEvent *)event_to_send); #ifdef DEBUG /* * man XSendEvent: XSendEvent returns zero if the conversion to wire * protocol format failed and returns nonzero otherwise. XSendEvent * can generate BadValue and BadWindow errors. */ if (result == 0) { fprintf(stderr, "%s: XSendEvent to [0x%x] failed.\n", __func__, w); } else { if (result == BadValue || result == BadWindow) { fprintf(stderr, "%s: WARNING! XSendEvent to [0x%x] failed: %s\n", __func__, w, GetXErrorString(result)); } else { fprintf(stderr, "%s: XSendEvent() successfully sent to [0x%x]\n", __func__, w); } } #endif NXFlushDisplay(nxagentDisplay, NXFlushLink); return result; } int SendEventToClient(ClientPtr client, xEvent *pEvents) { return TryClientEvents (client, pEvents, 1, NoEventMask, NoEventMask, NullGrab); } int SendSelectionNotifyEventToClient(ClientPtr client, Time time, Window requestor, Atom selection, Atom target, Atom property) { xEvent x = {0}; x.u.u.type = SelectionNotify; x.u.selectionNotify.time = time; x.u.selectionNotify.requestor = requestor; x.u.selectionNotify.selection = selection; x.u.selectionNotify.target = target; x.u.selectionNotify.property = property; #ifdef DEBUG if (property == None) fprintf (stderr, "%s: Denying request to client [%d].\n", __func__, CLINDEX(client)); else fprintf (stderr, "%s: Sending event to client [%d].\n", __func__, CLINDEX(client)); #endif return SendEventToClient(client, &x); } /* * Check if target is a valid content type target sent by the real X * server, like .e.g XA_STRING or UTF8_STRING. Other, non content type * targets like "TARGETS" or "TIMESTAMP" will return false. */ Bool nxagentValidServerTargets(XlibAtom target) { if (target == XA_STRING) { #ifdef DEBUG fprintf(stderr, "%s: valid target [XA_STRING].\n", __func__); #endif return True; } else if (target == serverTEXT) { #ifdef DEBUG fprintf(stderr, "%s: valid target [TEXT].\n", __func__); #endif return True; } /* by dimbor */ else if (target == serverUTF8_STRING) { #ifdef DEBUG fprintf(stderr, "%s: valid target [UTF8_STRING].\n", __func__); #endif return True; } else if (target == serverCOMPOUND_TEXT) { #ifdef DEBUG fprintf(stderr, "%s: valid target [COMPOUND_TEXT].\n", __func__); #endif return True; } else if (target == serverTARGETS) { #ifdef DEBUG fprintf(stderr, "%s: special target [TARGETS].\n", __func__); #endif return False; } else if (target == serverTIMESTAMP) { #ifdef DEBUG fprintf(stderr, "%s: special target [TIMESTAMP].\n", __func__); #endif return False; } #ifdef DEBUG fprintf(stderr, "%s: invalid target [%u].\n", __func__, target); #endif return False; } void nxagentInitSelectionOwner(int index, Atom selection) { lastSelectionOwner[index].selection = selection; lastSelectionOwner[index].client = NullClient; lastSelectionOwner[index].window = screenInfo.screens[0]->root->drawable.id; lastSelectionOwner[index].windowPtr = NULL; lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis(); } /* there's no owner on nxagent side anymore */ void nxagentClearSelectionOwner(int index) { lastSelectionOwner[index].client = NULL; lastSelectionOwner[index].window = None; lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis(); /* FIXME: why is windowPtr not cleared in the function? */ } void nxagentStoreSelectionOwner(int index, Selection *sel) { lastSelectionOwner[index].client = sel->client; lastSelectionOwner[index].window = sel->window; lastSelectionOwner[index].windowPtr = sel->pWin; lastSelectionOwner[index].lastTimeChanged = GetTimeInMillis(); } Bool nxagentMatchSelectionOwner(int index, ClientPtr pClient, WindowPtr pWindow) { return ((pClient && lastSelectionOwner[index].client == pClient) || (pWindow && lastSelectionOwner[index].windowPtr == pWindow)); } void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) { #ifdef DEBUG fprintf(stderr, "%s: Called with client [%p] index [%d] window [%p] ([0x%x]).\n", __func__, (void *) pClient, CLINDEX(pClient), (void *) pWindow, WINDOWID(pWindow)); #endif nxagentPrintClipboardStat("before nxagentClearClipboard"); /* * Only for PRIMARY and CLIPBOARD selections. */ for (int i = 0; i < nxagentMaxSelections; i++) { if (nxagentMatchSelectionOwner(i, pClient, pWindow)) { #ifdef TEST fprintf(stderr, "%s: Resetting state with client [%p] window [%p].\n", __func__, (void *) pClient, (void *) pWindow); #endif /* FIXME: why is windowPtr not cleared in the function? */ nxagentClearSelectionOwner(i); lastSelectionOwner[i].windowPtr = NULL; lastClientWindowPtr = NULL; SetClientSelectionStage(None); lastServerRequestor = None; } } if (pWindow && pWindow == lastClientWindowPtr) { lastClientWindowPtr = NULL; SetClientSelectionStage(None); } nxagentPrintClipboardStat("after nxagentClearClipboard"); } /* * Find the index of the lastSelectionOwner with the selection * sel. sel is an atom on the real X server. */ int nxagentFindLastSelectionOwnerIndex(XlibAtom sel) { int i = 0; while (i < nxagentMaxSelections && lastSelectionOwner[i].selection != sel) { i++; } return i; } /* * Find the index of CurrentSelection with the selection * sel. sel is an internal atom. */ int nxagentFindCurrentSelectionIndex(Atom sel) { int i = 0; while (i < NumCurrentSelections && CurrentSelections[i].selection != sel) { i++; } return i; } /* * This is called from Events.c dispatch loop on reception of a * SelectionClear event. We receive this event if someone on the real * X server claims the selection ownership. */ void nxagentClearSelection(XEvent *X) { #ifdef DEBUG fprintf(stderr, "%s: SelectionClear event for selection [%lu].\n", __func__, X->xselectionclear.selection); #endif nxagentPrintClipboardStat("before nxagentClearSelection"); if (!agentClipboardInitialized) { #ifdef DEBUG fprintf(stderr, "%s: clipboard not initialized - doing nothing.\n", __func__); #endif return; } if (nxagentOption(Clipboard) == ClipboardServer) { #ifdef DEBUG fprintf(stderr, "%s: clipboard mode 'server' - doing nothing.\n", __func__); #endif return; } int i = nxagentFindLastSelectionOwnerIndex(X->xselectionclear.selection); if (i < nxagentMaxSelections) { if (IS_INTERNAL_OWNER(i)) { /* send a SelectionClear event to (our) previous owner */ xEvent x = {0}; x.u.u.type = SelectionClear; x.u.selectionClear.time = GetTimeInMillis(); x.u.selectionClear.window = lastSelectionOwner[i].window; x.u.selectionClear.atom = CurrentSelections[i].selection; SendEventToClient(lastSelectionOwner[i].client, &x); } /* * set the root window with the NullClient as selection owner. Our * clients asking for the owner via XGetSelectionOwner() will get * these for an answer */ CurrentSelections[i].window = screenInfo.screens[0]->root->drawable.id; CurrentSelections[i].client = NullClient; nxagentClearSelectionOwner(i); } lastClientWindowPtr = NULL; SetClientSelectionStage(None); nxagentPrintClipboardStat("after nxagentClearSelection"); } /* * Send a SelectionNotify event as reply to the RequestSelection * event X. If success is True take the property from the event, else * take None (which reports "failed/denied" to the requestor). */ void nxagentReplyRequestSelection(XEvent *X, Bool success) { XSelectionEvent eventSelection = { .requestor = X->xselectionrequest.requestor, .selection = X->xselectionrequest.selection, .target = X->xselectionrequest.target, .time = X->xselectionrequest.time, .property = X->xselectionrequest.property }; if (!success) { #ifdef DEBUG fprintf(stderr, "%s: denying request\n", __func__); #endif eventSelection.property = None; } SendSelectionNotifyEventToServer(&eventSelection); } /* * This is called from Events.c dispatch loop on reception of a * SelectionRequest event, meaning a client of the real X server wants * to have the selection content. The real X server knows the nxagent * as selection owner. But in reality one of our windows is the owner, * so we must pass the request on to the real owner. */ void nxagentRequestSelection(XEvent *X) { #ifdef DEBUG { char *strTarget = XGetAtomName(nxagentDisplay, X->xselectionrequest.target); char *strSelection = XGetAtomName(nxagentDisplay, X->xselectionrequest.selection); char *strProperty = XGetAtomName(nxagentDisplay, X->xselectionrequest.property); fprintf(stderr, "%s: Received SelectionRequest from real server: selection [%ld][%s] " \ "target [%ld][%s] requestor [%s/0x%lx] destination [%ld][%s] lastServerRequestor [0x%x]\n", __func__, X->xselectionrequest.selection, validateString(strSelection), X->xselectionrequest.target, validateString(strTarget), DisplayString(nxagentDisplay), X->xselectionrequest.requestor, X->xselectionrequest.property, validateString(strProperty), lastServerRequestor); SAFE_XFree(strTarget); SAFE_XFree(strSelection); SAFE_XFree(strProperty); } #endif nxagentPrintClipboardStat("before nxagentRequestSelection"); if (!agentClipboardInitialized) { #ifdef DEBUG fprintf(stderr, "%s: clipboard not initialized - doing nothing.\n", __func__); #endif return; } /* lastServerRequestor in non-NULL (= we are currently in the transfer phase) */ if (lastServerRequestor != None) { #ifdef DEBUG fprintf(stderr, "%s: denying additional request during transfer phase.\n", __func__); #endif nxagentReplyRequestSelection(X, False); return; } /* the selection in this request is none we own. */ { int i = nxagentFindLastSelectionOwnerIndex(X->xselectionrequest.selection); if (i == nxagentMaxSelections) { #ifdef DEBUG fprintf(stderr, "%s: not owning selection [%ld] - denying request.\n", __func__, X->xselectionrequest.selection); #endif nxagentReplyRequestSelection(X, False); return; } } /* this is a special request like TARGETS or TIMESTAMP */ if (!nxagentValidServerTargets(X->xselectionrequest.target)) { if (X->xselectionrequest.target == serverTARGETS) { /* * the selection request target is TARGETS. The requestor is * asking for a list of supported data formats. * * The selection does not matter here, we will return this for * PRIMARY and CLIPBOARD. * * The list is aligned with the one in nxagentConvertSelection. * * FIXME: the perfect solution should not just answer with * XA_STRING but ask the real owner what format it supports. The * should then be sent to the original requestor. */ long targets[] = {XA_STRING, serverUTF8_STRING, serverTEXT, serverCOMPOUND_TEXT, serverTARGETS, serverTIMESTAMP}; int numTargets = sizeof(targets) / sizeof(targets[0]); #ifdef DEBUG { fprintf(stderr, "%s: Sending %d available targets:\n", __func__, numTargets); for (int i = 0; i < numTargets; i++) { char *s = XGetAtomName(nxagentDisplay, targets[i]); fprintf(stderr, "%s: %ld %s\n", __func__, targets[i], s); SAFE_XFree(s); } fprintf(stderr, "\n"); } #endif /* * pass on the requested list by setting the property provided * by the requestor accordingly. */ XChangeProperty(nxagentDisplay, X->xselectionrequest.requestor, X->xselectionrequest.property, XInternAtom(nxagentDisplay, "ATOM", 0), 32, PropModeReplace, (unsigned char*)&targets, numTargets); nxagentReplyRequestSelection(X, True); } else if (X->xselectionrequest.target == serverTIMESTAMP) { /* * Section 2.6.2 of the ICCCM states: * TIMESTAMP - To avoid some race conditions, it is important * that requestors be able to discover the timestamp the owner * used to acquire ownership. Until and unless the protocol is * changed so that a GetSelectionOwner request returns the * timestamp used to acquire ownership, selection owners must * support conversion to TIMESTAMP, returning the timestamp they * used to obtain the selection. * * FIXME: ensure we are reporting an _external_ timestamp * FIXME: for a 32 bit property list we need to pass a "long" array, not "char"! */ int i = nxagentFindLastSelectionOwnerIndex(X->xselectionrequest.selection); if (i < nxagentMaxSelections) { XChangeProperty(nxagentDisplay, X->xselectionrequest.requestor, X->xselectionrequest.property, XA_INTEGER, 32, PropModeReplace, (unsigned char *) &lastSelectionOwner[i].lastTimeChanged, 1); nxagentReplyRequestSelection(X, True); } } else { /* * unknown special request - probably bug! Check if this code handles all cases * that are handled in nxagentValidServerTargets! */ #ifdef DEBUG fprintf(stderr, "%s: unknown special target [%ld] - denying request.\n", __func__, X->xselectionrequest.target); #endif nxagentReplyRequestSelection(X, False); } return; } /* * reaching this means the request is a normal, valid request. We * can process it now. */ /* * This is required for nxagentGetClipboardWindow. */ nxagentLastRequestedSelection = X->xselectionrequest.selection; /* find the index of the requested selection */ int i = nxagentFindLastSelectionOwnerIndex(X->xselectionrequest.selection); if (i < nxagentMaxSelections) { if (lastClientWindowPtr != NULL && IS_INTERNAL_OWNER(i)) { /* * Request the real X server to transfer the selection content * to the NX_CUT_BUFFER_SERVER property of the serverWindow. * FIXME: document how we can end up here */ XConvertSelection(nxagentDisplay, CurrentSelections[i].selection, X->xselectionrequest.target, serverTransToAgentProperty, serverWindow, lastClientTime); #ifdef DEBUG fprintf(stderr, "%s: Sent XConvertSelection.\n", __func__); #endif } else { /* * if one of our clients owns the selection we ask it to copy * the selection to the clientCutProperty on nxagent's root * window in the first step. We then later push that property's * content to the real X server. */ if (IS_INTERNAL_OWNER(i) && (nxagentOption(Clipboard) == ClipboardServer || nxagentOption(Clipboard) == ClipboardBoth)) { /* * store who on the real X server requested the data and how * and where it wants to have it */ lastServerProperty = X->xselectionrequest.property; lastServerRequestor = X->xselectionrequest.requestor; lastServerTarget = X->xselectionrequest.target; lastServerTime = X->xselectionrequest.time; /* by dimbor */ if (lastServerTarget != XA_STRING) lastServerTarget = serverUTF8_STRING; /* prepare the request (like XConvertSelection, but internally) */ xEvent x = {0}; x.u.u.type = SelectionRequest; x.u.selectionRequest.time = GetTimeInMillis(); x.u.selectionRequest.owner = lastSelectionOwner[i].window; x.u.selectionRequest.selection = CurrentSelections[i].selection; x.u.selectionRequest.property = clientCutProperty; x.u.selectionRequest.requestor = screenInfo.screens[0]->root->drawable.id; /* Fictitious window.*/ /* * Don't send the same window, some programs are clever and * verify cut and paste operations inside the same window and * don't Notify at all. * * x.u.selectionRequest.requestor = lastSelectionOwnerWindow; */ /* by dimbor (idea from zahvatov) */ if (X->xselectionrequest.target != XA_STRING) x.u.selectionRequest.target = clientUTF8_STRING; else x.u.selectionRequest.target = XA_STRING; SendEventToClient(lastSelectionOwner[i].client, &x); #ifdef DEBUG fprintf(stderr, "%s: sent SelectionRequest event to client [%d] property [%d][%s]" \ "target [%d][%s] requestor [0x%x].\n", __func__, CLINDEX(lastSelectionOwner[i].client), x.u.selectionRequest.property, NameForAtom(x.u.selectionRequest.property), x.u.selectionRequest.target, NameForAtom(x.u.selectionRequest.target), x.u.selectionRequest.requestor); #endif } else { /* deny the request */ nxagentReplyRequestSelection(X, False); } } } nxagentPrintClipboardStat("after nxagentRequestSelection"); } /* * end current selection transfer by sending a notification to the * client and resetting the corresponding variables and the state * machine. If success is False send a None reply, meaning "request * denied/failed" * Use SELECTION_SUCCESS and SELECTION_FAULT macros for success. */ static void endTransfer(Bool success) { if (lastClientClientPtr == NULL) { #ifdef DEBUG fprintf(stderr, "%s: lastClientClientPtr is NULL - doing nothing.\n", __func__); #endif return; } #ifdef DEBUG if (success == SELECTION_SUCCESS) fprintf(stderr, "%s: sending notification to client [%d], property [%d][%s]\n", __func__, CLINDEX(lastClientClientPtr), lastClientProperty, NameForAtom(lastClientProperty)); else fprintf(stderr, "%s: sending negative notification to client [%d]\n", __func__, CLINDEX(lastClientClientPtr)); #endif SendSelectionNotifyEventToClient(lastClientClientPtr, lastClientTime, lastClientRequestor, lastClientSelection, lastClientTarget, success == SELECTION_SUCCESS ? lastClientProperty : None); /* * Enable further requests from clients. */ lastClientWindowPtr = NULL; SetClientSelectionStage(None); } void nxagentTransferSelection(int resource) { if (lastClientClientPtr -> index != resource) { #ifdef DEBUG fprintf (stderr, "%s: WARNING! Inconsistent resource [%d] with current client [%d].\n", __func__, resource, CLINDEX(lastClientClientPtr)); #endif endTransfer(SELECTION_FAULT); return; } switch (lastClientStage) { case SelectionStageQuerySize: { int result; PrintClientSelectionStage(); /* * Don't get data yet, just get size. We skip this stage in * current implementation and go straight to the data. */ nxagentLastClipboardClient = NXGetCollectPropertyResource(nxagentDisplay); if (nxagentLastClipboardClient == -1) { #ifdef WARNING fprintf(stderr, "%s: WARNING! Asynchronous GetProperty queue full.\n", __func__); #endif result = -1; } else { result = NXCollectProperty(nxagentDisplay, nxagentLastClipboardClient, serverWindow, serverTransToAgentProperty, 0, 0, False, AnyPropertyType); } if (result == -1) { #ifdef DEBUG fprintf (stderr, "%s: Aborting selection notify procedure for client [%d].\n", __func__, CLINDEX(lastClientClientPtr)); #endif endTransfer(SELECTION_FAULT); return; } SetClientSelectionStage(WaitSize); NXFlushDisplay(nxagentDisplay, NXFlushLink); break; } case SelectionStageQueryData: { int result; PrintClientSelectionStage(); /* * Request the selection data now. */ #ifdef DEBUG fprintf(stderr, "%s: Getting property content from remote server.\n", __func__); #endif nxagentLastClipboardClient = NXGetCollectPropertyResource(nxagentDisplay); if (nxagentLastClipboardClient == -1) { #ifdef WARNING fprintf(stderr, "%s: WARNING! Asynchronous GetProperty queue full.\n", __func__); #endif result = -1; } else { result = NXCollectProperty(nxagentDisplay, nxagentLastClipboardClient, serverWindow, serverTransToAgentProperty, 0, lastClientPropertySize, False, AnyPropertyType); } if (result == -1) { #ifdef DEBUG fprintf (stderr, "%s: Aborting selection notify procedure for client [%d].\n", __func__, CLINDEX(lastClientClientPtr)); #endif endTransfer(SELECTION_FAULT); return; } SetClientSelectionStage(WaitData); /* we've seen situations where you had to move the mouse or press a key to let the transfer complete. Flushing here fixed it */ NXFlushDisplay(nxagentDisplay, NXFlushLink); break; } default: { #ifdef DEBUG fprintf (stderr, "%s: WARNING! Inconsistent state [%s] for client [%d].\n", __func__, GetClientSelectionStageString(lastClientStage), CLINDEX(lastClientClientPtr)); #endif break; } } } /* Called from Events.c/nxagentHandlePropertyNotify This event is generated after XChangeProperty(), XDeleteProperty() or XGetWindowProperty(delete=True) */ void nxagentCollectPropertyEvent(int resource) { Atom atomReturnType; int resultFormat; unsigned long ulReturnItems; unsigned long ulReturnBytesLeft; unsigned char *pszReturnData = NULL; int result; /* * We have received the notification so we can safely retrieve data * from the client structure. */ result = NXGetCollectedProperty(nxagentDisplay, resource, &atomReturnType, &resultFormat, &ulReturnItems, &ulReturnBytesLeft, &pszReturnData); nxagentLastClipboardClient = -1; if (result == 0) { #ifdef DEBUG fprintf (stderr, "%s: Failed to get reply data.\n", __func__); #endif endTransfer(SELECTION_FAULT); } else if (resultFormat != 8 && resultFormat != 16 && resultFormat != 32) { #ifdef DEBUG fprintf (stderr, "%s: WARNING! Invalid property format.\n", __func__); #endif endTransfer(SELECTION_FAULT); } else { switch (lastClientStage) { case SelectionStageWaitSize: { PrintClientSelectionStage(); #ifdef DEBUG fprintf (stderr, "%s: Got size notify event for client [%d].\n", __func__, CLINDEX(lastClientClientPtr)); #endif if (ulReturnBytesLeft == 0) { #ifdef DEBUG fprintf (stderr, "%s: Aborting selection notify procedure.\n", __func__); #endif endTransfer(SELECTION_FAULT); } else { #ifdef DEBUG fprintf(stderr, "%s: Got property size from remote server.\n", __func__); #endif /* * Request the selection data now. */ lastClientPropertySize = ulReturnBytesLeft; SetClientSelectionStage(QueryData); nxagentTransferSelection(resource); } break; } case SelectionStageWaitData: { PrintClientSelectionStage(); #ifdef DEBUG fprintf (stderr, "%s: Got data notify event for client [%d].\n", __func__, CLINDEX(lastClientClientPtr)); #endif if (ulReturnBytesLeft != 0) { #ifdef DEBUG fprintf (stderr, "%s: Aborting selection notify procedure.\n", __func__); #endif endTransfer(SELECTION_FAULT); } else { #ifdef DEBUG fprintf(stderr, "%s: Got property content from remote server.\n", __func__); #endif ChangeWindowProperty(lastClientWindowPtr, lastClientProperty, lastClientTarget, resultFormat, PropModeReplace, ulReturnItems, pszReturnData, 1); #ifdef DEBUG fprintf(stderr, "%s: Selection property [%d][%s] changed to [\"%*.*s\"...]\n", __func__, lastClientProperty, validateString(NameForAtom(lastClientProperty)), (int)(min(20, ulReturnItems * resultFormat / 8)), (int)(min(20, ulReturnItems * resultFormat / 8)), pszReturnData); #endif endTransfer(SELECTION_SUCCESS); } break; } default: { #ifdef DEBUG fprintf (stderr, "%s: WARNING! Inconsistent state [%s] for client [%d].\n", __func__, GetClientSelectionStageString(lastClientStage), CLINDEX(lastClientClientPtr)); #endif break; } } } SAFE_XFree(pszReturnData); } /* * This is _only_ called from Events.c dispatch loop on reception of a * SelectionNotify event from the real X server. These events are * sent out by nxagent itself! */ void nxagentHandleSelectionNotifyFromXServer(XEvent *X) { if (!agentClipboardInitialized) { #ifdef DEBUG fprintf(stderr, "%s: clipboard not initialized - doing nothing.\n", __func__); #endif return; } #ifdef DEBUG { XSelectionEvent * e = (XSelectionEvent *)X; char * s = XGetAtomName(nxagentDisplay, e->property); char * t = XGetAtomName(nxagentDisplay, e->target); fprintf(stderr, "%s: SelectionNotify event from real X server, property "\ "[%ld][%s] requestor [0x%lx] target [%ld][%s] time [%ld] send_event [%d].\n", __func__, e->property, validateString(s), e->requestor, e->target, validateString(t), e->time, e->send_event); SAFE_XFree(s); SAFE_XFree(t); } #endif PrintClientSelectionStage(); if (lastClientWindowPtr != NULL) { /* * We reach here after a paste inside the nxagent, triggered by * the XConvertSelection call in nxagentConvertSelection(). This * means that data we need has been transferred to the * serverTransToAgentProperty of the serverWindow (our window on * the real X server). We now need to transfer it to the original * requestor, which is stored in the lastClient* variables. */ if (lastClientStage == SelectionStageNone && X->xselection.property == serverTransToAgentProperty) { #ifdef DEBUG fprintf(stderr, "%s: Starting selection transferral for client [%d].\n", __func__, CLINDEX(lastClientClientPtr)); #endif /* * The state machine is able to work in two phases. In the first * phase we get the size of property data, in the second we get * the actual data. We save a round-trip by requesting a prede- * termined amount of data in a single GetProperty and by discar- * ding the remaining part. This is not the optimal solution (we * could get the remaining part if it doesn't fit in a single * reply) but, at least with text, it should work in most situa- * tions. */ SetClientSelectionStage(QueryData); lastClientPropertySize = 262144; nxagentTransferSelection(lastClientClientPtr -> index); } else { #ifdef DEBUG fprintf(stderr, "%s: WARNING! Resetting selection transferral for client [%d].\n", __func__, CLINDEX(lastClientClientPtr)); #endif endTransfer(SELECTION_FAULT); } } else { int i = nxagentFindLastSelectionOwnerIndex(X->xselection.selection); if (i < nxagentMaxSelections) { /* if the last owner was an internal one, read the * clientCutProperty and push the contents to the * lastServerRequestor on the real X server. */ if (IS_INTERNAL_OWNER(i) && lastSelectionOwner[i].windowPtr != NULL && X->xselection.property == serverTransFromAgentProperty) { Atom atomReturnType; int resultFormat; unsigned long ulReturnItems; unsigned long ulReturnBytesLeft; unsigned char *pszReturnData = NULL; /* first get size values ... */ int result = GetWindowProperty(lastSelectionOwner[i].windowPtr, clientCutProperty, 0, 0, False, AnyPropertyType, &atomReturnType, &resultFormat, &ulReturnItems, &ulReturnBytesLeft, &pszReturnData); #ifdef DEBUG fprintf(stderr, "%s: GetWindowProperty() window [0x%x] property [%d] returned [%s]\n", __func__, lastSelectionOwner[i].window, clientCutProperty, GetXErrorString(result)); #endif if (result == BadAlloc || result == BadAtom || result == BadWindow || result == BadValue) { lastServerProperty = None; } else { /* ... then use the size values for the actual request */ result = GetWindowProperty(lastSelectionOwner[i].windowPtr, clientCutProperty, 0, ulReturnBytesLeft, False, AnyPropertyType, &atomReturnType, &resultFormat, &ulReturnItems, &ulReturnBytesLeft, &pszReturnData); #ifdef DEBUG fprintf(stderr, "%s: GetWindowProperty() window [0x%x] property [%d] returned [%s]\n", __func__, lastSelectionOwner[i].window, clientCutProperty, GetXErrorString(result)); #endif if (result == BadAlloc || result == BadAtom || result == BadWindow || result == BadValue) { lastServerProperty = None; } else { /* Fill the property on the initial requestor with the requested data */ /* The XChangeProperty source code reveals it will always return 1, no matter what, so no need to check the result */ /* FIXME: better use the format returned by above request */ XChangeProperty(nxagentDisplay, lastServerRequestor, lastServerProperty, lastServerTarget, 8, PropModeReplace, pszReturnData, ulReturnItems); #ifdef DEBUG { char *s = XGetAtomName(nxagentDisplay, lastServerProperty); fprintf(stderr, "%s: XChangeProperty sent to window [0x%x] for property [%d][%s] value [\"%*.*s\"...]\n", __func__, lastServerRequestor, lastServerProperty, s, (int)(min(20, ulReturnItems * 8 / 8)), (int)(min(20, ulReturnItems * 8 / 8)), pszReturnData); SAFE_XFree(s); } #endif } /* FIXME: free it or not? */ /* * SAFE_XFree(pszReturnData); */ } /* * inform the initial requestor that the requested data has * arrived in the desired property. If we have been unable to * get the data from the owner XChangeProperty will not have * been called and lastServerProperty will be None which * effectively will send a "Request denied" to the initial * requestor. */ XSelectionEvent eventSelection = { .requestor = lastServerRequestor, .selection = X->xselection.selection, /* .target = X->xselection.target, */ .target = lastServerTarget, .property = lastServerProperty, .time = lastServerTime, /* .time = CurrentTime */ }; #ifdef DEBUG fprintf(stderr, "%s: Sending SelectionNotify event to requestor [%p].\n", __func__, (void *)eventSelection.requestor); #endif SendSelectionNotifyEventToServer(&eventSelection); lastServerRequestor = None; /* allow further request */ } } } } /* * Let nxagent's serverWindow acquire the selection. All requests from * the real X server (or its clients) will be sent to this window. The * real X server never communicates with our windows directly. */ void nxagentResetSelectionOwner(void) { if (lastServerRequestor != None) { /* * we are in the process of communicating back and forth between * real X server and nxagent's clients - let's not disturb. */ #if defined(TEST) || defined(DEBUG) fprintf(stderr, "%s: WARNING! Requestor window [0x%x] already found.\n", __func__, lastServerRequestor); #endif /* FIXME: maybe we should put back the event that lead us here. */ return; } /* * Only for PRIMARY and CLIPBOARD selections. */ for (int i = 0; i < nxagentMaxSelections; i++) { XSetSelectionOwner(nxagentDisplay, lastSelectionOwner[i].selection, serverWindow, CurrentTime); #ifdef DEBUG fprintf(stderr, "%s: Reset selection state for selection [%d].\n", __func__, i); #endif nxagentClearSelectionOwner(i); lastSelectionOwner[i].windowPtr = NULL; } lastClientWindowPtr = NULL; SetClientSelectionStage(None); /* Hmm, this is already None when reaching this */ lastServerRequestor = None; } #ifdef NXAGENT_CLIPBOARD /* * The callback is called from dix. This is the normal operation * mode. The callback is also called when nxagent gets XFixes events * from the real X server. In that case the Trap is set and the * callback will do nothing. */ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data, void *args) { /* * Only act if the trap is unset. The trap indicates that we are * triggered by an XFixes clipboard event originating from the real * X server. In that case we do not want to propagate back changes * to the real X server, because it already knows about them and we * would end up in an infinite loop of events. If there was a better * way to identify that situation during callback processing we * could get rid of the Trap... */ if (nxagentExternalClipboardEventTrap != 0) { #ifdef DEBUG fprintf(stderr, "%s: Trap is set, doing nothing\n", __func__); #endif return; } SelectionInfoRec *info = (SelectionInfoRec *)args; Selection * pCurSel = (Selection *)info->selection; #ifdef DEBUG fprintf(stderr, "%s: pCurSel->lastTimeChanged [%d]\n", __func__, pCurSel->lastTimeChanged.milliseconds); #endif if (info->kind == SelectionSetOwner) { #ifdef DEBUG fprintf(stderr, "%s: called with SelectionCallbackKind SelectionSetOwner\n", __func__); fprintf(stderr, "%s: pCurSel->pWin [0x%x]\n", __func__, WINDOWID(pCurSel->pWin)); fprintf(stderr, "%s: pCurSel->selection [%s]\n", __func__, NameForAtom(pCurSel->selection)); #endif if (pCurSel->pWin != NULL && nxagentOption(Clipboard) != ClipboardNone && /* FIXME: shouldn't we also check for != ClipboardClient? */ (pCurSel->selection == XA_PRIMARY || pCurSel->selection == clientCLIPBOARD)) { #ifdef DEBUG fprintf(stderr, "%s: calling nxagentSetSelectionOwner\n", __func__); #endif nxagentSetSelectionOwner(pCurSel); } } else if (info->kind == SelectionWindowDestroy) { #ifdef DEBUG fprintf(stderr, "%s: called with SelectionCallbackKind SelectionWindowDestroy\n", __func__); #endif } else if (info->kind == SelectionClientClose) { #ifdef DEBUG fprintf(stderr, "%s: called with SelectionCallbackKind SelectionClientClose\n", __func__); #endif } else { #ifdef DEBUG fprintf(stderr, "%s: called with unknown SelectionCallbackKind\n", __func__); #endif } } #endif /* * This is called from the nxagentSetSelectionCallback, so it is using * internal Atoms */ void nxagentSetSelectionOwner(Selection *pSelection) { if (!agentClipboardInitialized) { #ifdef DEBUG fprintf(stderr, "%s: clipboard not initialized - doing nothing.\n", __func__); #endif return; } #ifdef DEBUG fprintf(stderr, "%s: Setting selection owner to serverwindow ([0x%x]).\n", __func__, serverWindow); #endif #if defined(TEST) || defined(DEBUG) if (lastServerRequestor != None) { /* * we are in the process of communicating back and forth between * real X server and nxagent's clients - let's not disturb */ fprintf (stderr, "%s: WARNING! Requestor window [0x%x] already set.\n", __func__, lastServerRequestor); } #endif int i = nxagentFindCurrentSelectionIndex(pSelection->selection); if (i < NumCurrentSelections) { #ifdef DEBUG fprintf(stderr, "%s: lastSelectionOwner.client [%p] index [%d] -> [%p] index [%d]\n", __func__, (void *)lastSelectionOwner[i].client, CLINDEX(lastSelectionOwner[i].client), (void *)pSelection->client, CLINDEX(pSelection->client)); fprintf(stderr, "%s: lastSelectionOwner.window [0x%x] -> [0x%x]\n", __func__, lastSelectionOwner[i].window, pSelection->window); fprintf(stderr, "%s: lastSelectionOwner.windowPtr [%p] -> [%p] [0x%x] (serverWindow: [0x%x])\n", __func__, (void *)lastSelectionOwner[i].windowPtr, (void *)pSelection->pWin, nxagentWindow(pSelection->pWin), serverWindow); fprintf(stderr, "%s: lastSelectionOwner.lastTimeChanged [%d]\n", __func__, lastSelectionOwner[i].lastTimeChanged); #endif /* * inform the real X server that our serverWindow is the * clipboard owner. */ XSetSelectionOwner(nxagentDisplay, lastSelectionOwner[i].selection, serverWindow, CurrentTime); /* * The real owner window (inside nxagent) is stored in * lastSelectionOwner.window. lastSelectionOwner.windowPtr * points to the struct that contains all information about the * owner window. */ nxagentStoreSelectionOwner(i, pSelection); } lastClientWindowPtr = NULL; SetClientSelectionStage(None); lastServerRequestor = None; /* FIXME if (XGetSelectionOwner(nxagentDisplay,pSelection->selection) == serverWindow) { fprintf (stderr, "%s: SetSelectionOwner OK\n", __func__); lastSelectionOwnerSelection = pSelection; lastSelectionOwnerClient = pSelection->client; lastSelectionOwnerWindow = pSelection->window; lastSelectionOwnerWindowPtr = pSelection->pWin; lastClientWindowPtr = NULL; SetClientSelectionStage(None); lastServerRequestor = None; } else fprintf (stderr, "%s: SetSelectionOwner failed\n", __func__); */ } void nxagentNotifyConvertFailure(ClientPtr client, Window requestor, Atom selection, Atom target, Time time) { /* * Check if the client is still valid. */ if (clients[client -> index] != client) { #ifdef WARNING fprintf(stderr, "%s: WARNING! Invalid client pointer.", __func__); #endif return; } SendSelectionNotifyEventToClient(client, time, requestor, selection, target, None); } /* * This is called from dix (ProcConvertSelection) if an nxagent client * issues a ConvertSelection request. So all the Atoms are internal * return codes: * 0: let dix process the request * 1: don't let dix process the request */ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, Window requestor, Atom property, Atom target, Time time) { if (!agentClipboardInitialized) { #ifdef DEBUG fprintf(stderr, "%s: clipboard not initialized - doing nothing.\n", __func__); #endif return 0; } if (nxagentOption(Clipboard) == ClipboardServer) { #ifdef DEBUG fprintf(stderr, "%s: clipboard mode 'server' - doing nothing.\n", __func__); #endif return 0; } { int i = nxagentFindCurrentSelectionIndex(selection); if (i < NumCurrentSelections && IS_INTERNAL_OWNER(i)) { /* * There is a client owner on the agent side, let normal dix stuff happen. */ return 0; } } /* * if lastClientWindowPtr is set we are waiting for an answer from * the real X server. If that answer takes more than 5 seconds we * consider the conversion failed and tell our client about that. * The new request that lead us here is then processed. */ if (lastClientWindowPtr != NULL) { #ifdef TEST fprintf(stderr, "%s: lastClientWindowPtr != NULL.\n", __func__); #endif if ((GetTimeInMillis() - lastClientReqTime) >= CONVERSION_TIMEOUT) { #ifdef DEBUG fprintf(stderr, "%s: timeout expired on last request, " "notifying failure to client\n", __func__); #endif nxagentNotifyConvertFailure(lastClientClientPtr, lastClientRequestor, lastClientSelection, lastClientTarget, lastClientTime); lastClientWindowPtr = NULL; SetClientSelectionStage(None); } else { /* * we got another convert request while already waiting for an * answer from the real X server to a previous convert request, * which we cannot handle (yet). So return an error. */ #ifdef DEBUG fprintf(stderr, "%s: got request " "before timeout expired on last request, notifying failure to client\n", __func__); #endif nxagentNotifyConvertFailure(client, requestor, selection, target, time); return 1; } } #ifdef DEBUG fprintf(stderr, "%s: client [%d] requests sel [%s] " "on window [%x] prop [%d][%s] target [%d][%s].\n", __func__, CLINDEX(client), validateString(NameForAtom(selection)), requestor, property, validateString(NameForAtom(property)), target, validateString(NameForAtom(target))); #endif const char *strTarget = NameForAtom(target); if (strTarget == NULL) { #ifdef DEBUG fprintf(stderr, "%s: cannot find name for target Atom [%d] - returning\n", __func__, target); #endif return 1; } /* * The selection request target is TARGETS. The requestor is asking * for a list of supported data formats. * * The list is aligned with the one in nxagentRequestSelection. */ if (target == clientTARGETS) { Atom targets[] = {XA_STRING, clientUTF8_STRING, clientTEXT, clientCOMPOUND_TEXT, clientTARGETS, clientTIMESTAMP}; int numTargets = sizeof(targets) / sizeof(targets[0]); #ifdef DEBUG fprintf(stderr, "%s: available targets:\n", __func__); for (int i = 0; i < numTargets; i++) fprintf(stderr, "%s: %s\n", __func__, NameForAtom(targets[i])); fprintf(stderr, "\n"); #endif ChangeWindowProperty(pWin, property, MakeAtom("ATOM", 4, 1), sizeof(Atom)*8, PropModeReplace, numTargets, &targets, 1); SendSelectionNotifyEventToClient(client, time, requestor, selection, target, property); return 1; } /* * Section 2.6.2 of the ICCCM states: * "TIMESTAMP - To avoid some race conditions, it is important * that requestors be able to discover the timestamp the owner * used to acquire ownership. Until and unless the protocol is * changed so that a GetSelectionOwner request returns the * timestamp used to acquire ownership, selection owners must * support conversion to TIMESTAMP, returning the timestamp they * used to obtain the selection." */ if (target == clientTIMESTAMP) { int i = nxagentFindCurrentSelectionIndex(selection); if (i < NumCurrentSelections) { /* * "If the specified property is not None, the owner should place * the data resulting from converting the selection into the * specified property on the requestor window and should set the * property's type to some appropriate value, which need not be * the same as the specified target." */ ChangeWindowProperty(pWin, property, XA_INTEGER, 32, PropModeReplace, 1, (unsigned char *) &lastSelectionOwner[i].lastTimeChanged, 1); SendSelectionNotifyEventToClient(client, time, requestor, selection, target, property); return 1; } } #ifdef DEBUG if (lastClientClientPtr == client && (GetTimeInMillis() - lastClientReqTime < ACCUM_TIME)) { /* * The same client made consecutive requests of clipboard content * with less than 5 seconds time interval between them. * FIXME: this does not take the selection into account, so a * client requesting PRIMARY and CLIPBOARD would match here, too */ fprintf(stderr, "%s: Consecutives request from client [%p] selection [%u] " "elapsed time [%u] clientAccum [%d]\n", __func__, (void *) client, selection, GetTimeInMillis() - lastClientReqTime, clientAccum); clientAccum++; } else { /* reset clientAccum as now another client requested the clipboard content */ if (lastClientClientPtr != client) { clientAccum = 0; } } #endif if (target == clientTEXT || target == XA_STRING || target == clientCOMPOUND_TEXT || target == clientUTF8_STRING) { lastClientWindowPtr = pWin; SetClientSelectionStage(None); /* * store the original requestor, we need that later after * serverTransToAgentProperty contains the desired selection content */ lastClientRequestor = requestor; lastClientClientPtr = client; lastClientTime = time; lastClientProperty = property; lastClientSelection = selection; lastClientTarget = target; /* if the last client request time is more than 5s ago update it. Why? */ if ((GetTimeInMillis() - lastClientReqTime) >= CONVERSION_TIMEOUT) lastClientReqTime = GetTimeInMillis(); if (selection == clientCLIPBOARD) { selection = lastSelectionOwner[nxagentClipboardSelection].selection; } /* * we only convert to either UTF8 or XA_STRING, despite accepting * TEXT and COMPOUND_TEXT. */ if (target == clientUTF8_STRING) { #ifdef DEBUG fprintf(stderr, "%s: Sending XConvertSelection with target [%d][%s], property [%d][%s]\n", __func__, serverUTF8_STRING, szAgentUTF8_STRING, serverTransToAgentProperty, "NX_CUT_BUFFER_SERVER"); #endif XConvertSelection(nxagentDisplay, selection, serverUTF8_STRING, serverTransToAgentProperty, serverWindow, CurrentTime); } else { #ifdef DEBUG fprintf(stderr, "%s: Sending XConvertSelection with target [%d][%s], property [%d][%s]\n", __func__, XA_STRING, validateString(NameForAtom(XA_STRING)), serverTransToAgentProperty, "NX_CUT_BUFFER_SERVER"); #endif XConvertSelection(nxagentDisplay, selection, XA_STRING, serverTransToAgentProperty, serverWindow, CurrentTime); } /* FIXME: check returncode of XConvertSelection */ #ifdef DEBUG fprintf(stderr, "%s: Sent XConvertSelection with target [%s], property [%s]\n", __func__, validateString(NameForAtom(target)), validateString(NameForAtom(property))); #endif return 1; } else { /* deny request */ #ifdef DEBUG fprintf(stderr, "%s: Unsupported target [%d][%s] - denying request\n", __func__, target, validateString(NameForAtom(target))); #endif SendSelectionNotifyEventToClient(client, time, requestor, selection, target, None); return 1; } return 0; } /* * This is _only_ called from ProcSendEvent in NXevents.c. It is used * to send a SelectionNotify event to our server window which will * trigger the dispatch loop in Events.c to run * nxagentHandleSelectionNotifyFromXServer which in turn will take * care of transferring the selection content from the owning client * to a property of the server window. * * Returning 1 here means the client request will not be further * handled by dix. Returning 0 means a SelectionNotify event being * pushed out to our clients. * * From https://tronche.com/gui/x/xlib/events/client-communication/selection.html: * "This event is generated by the X server in response to a * ConvertSelection protocol request when there is no owner for the * selection. When there is an owner, it should be generated by the * owner of the selection by using XSendEvent()." */ int nxagentSendNotify(xEvent *event) { #ifdef DEBUG fprintf(stderr, "%s: Got called.\n", __func__); #endif if (!agentClipboardInitialized) { #ifdef DEBUG fprintf(stderr, "%s: clipboard not initialized - doing nothing.\n", __func__); #endif return 0; } #ifdef DEBUG fprintf(stderr, "%s: property is [%d][%s].\n", __func__, event->u.selectionNotify.property, NameForAtom(event->u.selectionNotify.property)); fprintf(stderr, "%s: requestor is [0x%x].\n", __func__, event->u.selectionNotify.requestor); fprintf(stderr, "%s: lastServerRequestor is [0x%x].\n", __func__, lastServerRequestor); #endif /* * If we have nested sessions there are situations where we do not * need to send out anything to the real X server because * communication happens completely between our own clients (some of * which can be nxagents themselves). In that case we return 0 (tell * dix to go on) and do nothing! */ if (event->u.selectionNotify.property != clientCutProperty || lastServerRequestor == None) { #ifdef DEBUG fprintf(stderr, "%s: sent nothing.\n", __func__); #endif return 0; } else { /* * Setup selection notify event to real server. * * .property must be a server-side Atom. As this property is only * set on our serverWindow and normally there are few other * properties except serverTransToAgentProperty, the only thing * we need to ensure is that the internal Atom clientCutProperty * differs from the server-side serverTransToAgentProperty * Atom. The actual name is not important. To be clean here we use * a separate serverTransFromAgentProperty. */ XSelectionEvent eventSelection = { .requestor = serverWindow, .selection = event->u.selectionNotify.selection, .target = event->u.selectionNotify.target, .property = serverTransFromAgentProperty, .time = CurrentTime, }; /* * On the real server, the right CLIPBOARD atom is * XInternAtom(nxagentDisplay, "CLIPBOARD", 1), which is stored in * lastSelectionOwner[nxagentClipboardSelection].selection. For * PRIMARY there's nothing to map because that is identical on all * X servers (defined in Xatom.h). */ if (event->u.selectionNotify.selection == clientCLIPBOARD) { eventSelection.selection = lastSelectionOwner[nxagentClipboardSelection].selection; } /* * .target must be translated, too, as a client on the real * server is requested to fill our property and it needs to know * the format. */ if (event->u.selectionNotify.target == clientUTF8_STRING) { eventSelection.target = serverUTF8_STRING; } else if (event->u.selectionNotify.target == clientTEXT) { eventSelection.target = serverTEXT; } else if (event->u.selectionNotify.target == clientCOMPOUND_TEXT) { eventSelection.target = serverCOMPOUND_TEXT; } else { eventSelection.target = XA_STRING; } #ifdef DEBUG fprintf(stderr, "%s: mapping local to remote Atom: [%d] -> [%ld] [%s]\n", __func__, event->u.selectionNotify.selection, eventSelection.selection, NameForAtom(event->u.selectionNotify.selection)); fprintf(stderr, "%s: mapping local to remote Atom: [%d] -> [%ld] [%s]\n", __func__, event->u.selectionNotify.target, eventSelection.target, NameForAtom(event->u.selectionNotify.target)); fprintf(stderr, "%s: mapping local to remote Atom: [%d] -> [%ld] [%s]\n", __func__, event->u.selectionNotify.property, eventSelection.property, NameForAtom(event->u.selectionNotify.property)); #endif SendSelectionNotifyEventToServer(&eventSelection); return 1; } } /* * This is called from NXproperty.c to determine if a client sets the * property we are waiting for. * FIXME: in addition we should check if the client is the one we expect */ WindowPtr nxagentGetClipboardWindow(Atom property) { int i = nxagentFindLastSelectionOwnerIndex(nxagentLastRequestedSelection); if (i < nxagentMaxSelections && property == clientCutProperty && lastSelectionOwner[i].windowPtr != NULL) { #ifdef DEBUG fprintf(stderr, "%s: Returning last [%d] selection owner window [%p] (0x%x).\n", __func__, lastSelectionOwner[i].selection, (void *)lastSelectionOwner[i].windowPtr, WINDOWID(lastSelectionOwner[i].windowPtr)); #endif return lastSelectionOwner[i].windowPtr; } else { return NULL; } } /* * Initialize the clipboard * Returns: True for success else False */ Bool nxagentInitClipboard(WindowPtr pWin) { #ifdef DEBUG fprintf(stderr, "%s: Got called.\n", __func__); #endif #ifdef NXAGENT_TIMESTAMP { fprintf(stderr, "%s: Clipboard init starts at [%ld] ms.\n", __func__, GetTimeInMillis() - startTime); } #endif agentClipboardInitialized = False; serverWindow = nxagentWindow(pWin); if (!nxagentReconnectTrap) { SAFE_free(lastSelectionOwner); lastSelectionOwner = (SelectionOwner *) malloc(nxagentMaxSelections * sizeof(SelectionOwner)); if (lastSelectionOwner == NULL) { FatalError("nxagentInitClipboard: Failed to allocate memory for the clipboard selections.\n"); } nxagentInitSelectionOwner(nxagentPrimarySelection, XA_PRIMARY); nxagentInitSelectionOwner(nxagentClipboardSelection, nxagentAtoms[10]); /* CLIPBOARD */ } else { /* the clipboard selection atom might have changed on a new X server. Primary is constant. */ lastSelectionOwner[nxagentClipboardSelection].selection = nxagentAtoms[10]; /* CLIPBOARD */ } serverTARGETS = nxagentAtoms[6]; /* TARGETS */ serverTEXT = nxagentAtoms[7]; /* TEXT */ serverCOMPOUND_TEXT = nxagentAtoms[16]; /* COMPOUND_TEXT */ serverUTF8_STRING = nxagentAtoms[12]; /* UTF8_STRING */ serverTIMESTAMP = nxagentAtoms[11]; /* TIMESTAMP */ /* * Server side properties to hold pasted data. * see nxagentSendNotify for an explanation */ serverTransFromAgentProperty = nxagentAtoms[15]; /* NX_SELTRANS_FROM_AGENT */ serverTransToAgentProperty = nxagentAtoms[5]; /* NX_CUT_BUFFER_SERVER */ if (serverTransToAgentProperty == None) { #ifdef PANIC fprintf(stderr, "%s: PANIC! Could not create %s atom\n", __func__, "NX_CUT_BUFFER_SERVER"); #endif return False; } #ifdef TEST fprintf(stderr, "%s: Setting owner of selection [%d][%s] on window 0x%x\n", __func__, (int) serverTransToAgentProperty, "NX_CUT_BUFFER_SERVER", serverWindow); #endif XSetSelectionOwner(nxagentDisplay, serverTransToAgentProperty, serverWindow, CurrentTime); if (XQueryExtension(nxagentDisplay, "XFIXES", &nxagentXFixesInfo.Opcode, &nxagentXFixesInfo.EventBase, &nxagentXFixesInfo.ErrorBase) == 0) { ErrorF("Unable to initialize XFixes extension.\n"); } else { #ifdef TEST fprintf(stderr, "%s: Registering for XFixesSelectionNotify events.\n", __func__); #endif for (int i = 0; i < nxagentMaxSelections; i++) { XFixesSelectSelectionInput(nxagentDisplay, serverWindow, lastSelectionOwner[i].selection, XFixesSetSelectionOwnerNotifyMask | XFixesSelectionWindowDestroyNotifyMask | XFixesSelectionClientCloseNotifyMask); } nxagentXFixesInfo.Initialized = 1; } /* The first paste from CLIPBOARD did not work directly after session start. Removing this code makes it work. It is unsure why it was introduced in the first place so it is possible that we see other effects by leaving out this code. Fixes X2Go bug #952, see https://bugs.x2go.org/952 for details . if (nxagentSessionId[0]) { #ifdef TEST fprintf(stderr, "%s: setting the ownership of %s to %lx" " and registering for PropertyChangeMask events\n", __func__, validateString(XGetAtomName(nxagentDisplay, nxagentAtoms[10])), serverWindow); #endif XSetSelectionOwner(nxagentDisplay, nxagentAtoms[10], serverWindow, CurrentTime); pWin -> eventMask |= PropertyChangeMask; nxagentChangeWindowAttributes(pWin, CWEventMask); } */ if (nxagentReconnectTrap) { if (nxagentOption(Clipboard) == ClipboardServer || nxagentOption(Clipboard) == ClipboardBoth) { for (int i = 0; i < nxagentMaxSelections; i++) { /* * if we have a selection inform the (new) real Xserver and * claim the ownership. Note that we report our serverWindow as * owner, not the real window! */ if (IS_INTERNAL_OWNER(i) && lastSelectionOwner[i].window) { XSetSelectionOwner(nxagentDisplay, lastSelectionOwner[i].selection, serverWindow, CurrentTime); } } } /* FIXME: Shouldn't we reset lastServer* and lastClient* here? */ } else { for (int i = 0; i < nxagentMaxSelections; i++) { nxagentClearSelectionOwner(i); } lastServerRequestor = None; lastClientWindowPtr = NULL; SetClientSelectionStage(None); lastClientReqTime = GetTimeInMillis(); clientTARGETS = MakeAtom(szAgentTARGETS, strlen(szAgentTARGETS), True); clientTEXT = MakeAtom(szAgentTEXT, strlen(szAgentTEXT), True); clientCOMPOUND_TEXT = MakeAtom(szAgentCOMPOUND_TEXT, strlen(szAgentCOMPOUND_TEXT), True); clientUTF8_STRING = MakeAtom(szAgentUTF8_STRING, strlen(szAgentUTF8_STRING), True); clientTIMESTAMP = MakeAtom(szAgentTIMESTAMP, strlen(szAgentTIMESTAMP), True); clientCLIPBOARD = MakeAtom(szAgentCLIPBOARD, strlen(szAgentCLIPBOARD), True); clientCutProperty = MakeAtom(szAgentNX_CUT_BUFFER_CLIENT, strlen(szAgentNX_CUT_BUFFER_CLIENT), True); if (clientCutProperty == None) { #ifdef PANIC fprintf(stderr, "%s: PANIC! " "Could not create %s atom.\n", __func__, szAgentNX_CUT_BUFFER_CLIENT); #endif return False; } } agentClipboardInitialized = True; #ifdef DEBUG fprintf(stderr, "%s: Clipboard initialization completed.\n", __func__); #endif #ifdef NXAGENT_TIMESTAMP { fprintf(stderr, "%s: Clipboard init ends at [%ld] ms.\n", __func__, GetTimeInMillis() - startTime); } #endif return True; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Clipboard.h0000644000000000000000000000561113614532331020730 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Clipboard_H__ #define __Clipboard_H__ /* * Queried at clipboard initialization. */ typedef struct _XFixesAgentInfo { int Opcode; int EventBase; int ErrorBase; int Initialized; } XFixesAgentInfoRec; extern XFixesAgentInfoRec nxagentXFixesInfo; /* * Create the NX_SELTRANS_FROM_AGENT atom and * initialize the required property to exchange * data with the X server. */ extern Bool nxagentInitClipboard(WindowPtr pWindow); /* * Called whenever a client or a window is * destroyed to let the clipboard code to * release any pointer to the referenced * structures. */ extern void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow); extern void nxagentSetSelectionOwner(Selection *pSelection); extern int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, Window requestor, Atom property, Atom target, Time time); void nxagentClearSelection(); void nxagentRequestSelection(); void nxagentHandleSelectionNotifyFromXServer(); int nxagentFindCurrentSelectionIndex(Atom sel); #endif /* __Clipboard_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Colormap.c0000644000000000000000000004177413614532331020612 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #include "X.h" #include "Xproto.h" #include "scrnintstr.h" #include "../../include/window.h" #include "windowstr.h" #include "colormapst.h" #include "resource.h" #include "Agent.h" #include "Display.h" #include "Screen.h" #include "Colormap.h" #include "Visual.h" #include "Windows.h" #include "Args.h" #include "Utils.h" #define PANIC #define WARNING #undef TEST #undef DEBUG static ColormapPtr InstalledMaps[MAXSCREENS]; static Bool nxagentInstalledDefaultColormap = False; Bool nxagentReconnectAllColormap(void *p0); Bool nxagentCreateColormap(ColormapPtr pCmap) { XColor *colors; Visual *visual; int class; #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "nxagentCreateColormap: Going to create new colormap with " " visual [%lu].\n", pCmap->pVisual); #endif VisualPtr pVisual = pCmap->pVisual; int ncolors = pVisual->ColormapEntries; pCmap->devPriv = (void *)malloc(sizeof(nxagentPrivColormap)); if (((visual = nxagentVisual(pVisual))) == NULL) { #ifdef WARNING fprintf(stderr, "nxagentCreateColormap: WARNING: Visual not found. Using default visual.\n"); #endif visual = nxagentVisuals[nxagentDefaultVisualIndex].visual; class = nxagentVisuals[nxagentDefaultVisualIndex].class; } else { class = pVisual->class; } nxagentColormapPriv(pCmap)->colormap = XCreateColormap(nxagentDisplay, nxagentDefaultWindows[pCmap->pScreen->myNum], visual, (class & DynamicClass) ? AllocAll : AllocNone); switch (class) { case StaticGray: /* read only */ colors = (XColor *)malloc(ncolors * sizeof(XColor)); for (int i = 0; i < ncolors; i++) colors[i].pixel = i; XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors); for (int i = 0; i < ncolors; i++) { pCmap->red[i].co.local.red = colors[i].red; pCmap->red[i].co.local.green = colors[i].red; pCmap->red[i].co.local.blue = colors[i].red; } SAFE_free(colors); break; case StaticColor: /* read only */ colors = (XColor *)malloc(ncolors * sizeof(XColor)); for (int i = 0; i < ncolors; i++) colors[i].pixel = i; XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors); for (int i = 0; i < ncolors; i++) { pCmap->red[i].co.local.red = colors[i].red; pCmap->red[i].co.local.green = colors[i].green; pCmap->red[i].co.local.blue = colors[i].blue; } SAFE_free(colors); break; case TrueColor: /* read only */ colors = (XColor *)malloc(ncolors * sizeof(XColor)); Pixel red = 0L, green = 0L, blue = 0L; Pixel redInc, greenInc, blueInc; redInc = lowbit(pVisual->redMask); greenInc = lowbit(pVisual->greenMask); blueInc = lowbit(pVisual->blueMask); for (int i = 0; i < ncolors; i++) { colors[i].pixel = red | green | blue; red += redInc; if (red > pVisual->redMask) red = 0L; green += greenInc; if (green > pVisual->greenMask) green = 0L; blue += blueInc; if (blue > pVisual->blueMask) blue = 0L; } XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors); for (int i = 0; i < ncolors; i++) { pCmap->red[i].co.local.red = colors[i].red; pCmap->green[i].co.local.green = colors[i].green; pCmap->blue[i].co.local.blue = colors[i].blue; } SAFE_free(colors); break; case GrayScale: /* read and write */ break; case PseudoColor: /* read and write */ break; case DirectColor: /* read and write */ break; } return True; } void nxagentDestroyColormap(ColormapPtr pCmap) { XFreeColormap(nxagentDisplay, nxagentColormap(pCmap)); SAFE_free(pCmap->devPriv); } #define SEARCH_PREDICATE \ (nxagentWindow(pWin) != None && wColormap(pWin) == icws->cmapIDs[i]) static int nxagentCountInstalledColormapWindows(WindowPtr pWin, void * ptr) { nxagentInstalledColormapWindows *icws = (nxagentInstalledColormapWindows *) ptr; for (int i = 0; i < icws->numCmapIDs; i++) { if (SEARCH_PREDICATE) { icws->numWindows++; return WT_DONTWALKCHILDREN; } } return WT_WALKCHILDREN; } static int nxagentGetInstalledColormapWindows(WindowPtr pWin, void * ptr) { nxagentInstalledColormapWindows *icws = (nxagentInstalledColormapWindows *)ptr; for (int i = 0; i < icws->numCmapIDs; i++) { if (SEARCH_PREDICATE) { icws->windows[icws->index++] = nxagentWindow(pWin); return WT_DONTWALKCHILDREN; } } return WT_WALKCHILDREN; } static Window *nxagentOldInstalledColormapWindows = NULL; static int nxagentNumOldInstalledColormapWindows = 0; static Bool nxagentSameInstalledColormapWindows(Window *windows, int numWindows) { if (nxagentNumOldInstalledColormapWindows != numWindows) return False; if (nxagentOldInstalledColormapWindows == windows) return True; if (nxagentOldInstalledColormapWindows == NULL || windows == NULL) return False; if (memcmp(nxagentOldInstalledColormapWindows, windows, numWindows * sizeof(Window))) return False; return True; } void nxagentSetInstalledColormapWindows(ScreenPtr pScreen) { nxagentInstalledColormapWindows icws; int numWindows; icws.cmapIDs = (Colormap *)malloc(pScreen->maxInstalledCmaps * sizeof(Colormap)); icws.numCmapIDs = nxagentListInstalledColormaps(pScreen, icws.cmapIDs); icws.numWindows = 0; WalkTree(pScreen, nxagentCountInstalledColormapWindows, (void *)&icws); if (icws.numWindows) { icws.windows = (Window *)malloc((icws.numWindows + 1) * sizeof(Window)); icws.index = 0; WalkTree(pScreen, nxagentGetInstalledColormapWindows, (void *)&icws); icws.windows[icws.numWindows] = nxagentDefaultWindows[pScreen->myNum]; numWindows = icws.numWindows + 1; } else { icws.windows = NULL; numWindows = 0; } SAFE_free(icws.cmapIDs); if (!nxagentSameInstalledColormapWindows(icws.windows, icws.numWindows)) { SAFE_free(nxagentOldInstalledColormapWindows); #ifdef _XSERVER64 { Window64 *windows = (Window64 *)malloc(numWindows * sizeof(Window64)); for(int i = 0; i < numWindows; ++i) windows[i] = icws.windows[i]; XSetWMColormapWindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], windows, numWindows); SAFE_free(windows); } #else XSetWMColormapWindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], icws.windows, numWindows); #endif nxagentOldInstalledColormapWindows = icws.windows; nxagentNumOldInstalledColormapWindows = icws.numWindows; #ifdef DUMB_WINDOW_MANAGERS /* This code is for dumb window managers. This will only work with default local visual colormaps. */ if (icws.numWindows) { ColormapPtr pCmap; WindowPtr pWin = nxagentWindowPtr(icws.windows[0]); Visual *visual = nxagentVisualFromID(pScreen, wVisual(pWin)); if (visual == nxagentDefaultVisual(pScreen)) pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP); else pCmap = (ColormapPtr)LookupIDByType(pScreen->defColormap, RT_COLORMAP); if (pCmap != NULL) { XSetWindowColormap(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], nxagentColormap(pCmap)); } #ifdef WARNING else { fprintf(stderr, "nxagentSetInstalledColormapWindows: WARNING! " "Window at [%p] has no colormap with class [%d].\n", (void *)pWin, pWin -> drawable.class); } #endif } #endif /* DUMB_WINDOW_MANAGERS */ } else SAFE_free(icws.windows); } void nxagentSetScreenSaverColormapWindow(ScreenPtr pScreen) { SAFE_free(nxagentOldInstalledColormapWindows); #ifdef _XSERVER64 { Window64 window; window = nxagentScreenSaverWindows[pScreen->myNum]; XSetWMColormapWindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &window, 1); nxagentScreenSaverWindows[pScreen->myNum] = window; } #else XSetWMColormapWindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &nxagentScreenSaverWindows[pScreen->myNum], 1); #endif /* _XSERVER64 */ nxagentOldInstalledColormapWindows = NULL; nxagentNumOldInstalledColormapWindows = 0; nxagentDirectUninstallColormaps(pScreen); } void nxagentDirectInstallColormaps(ScreenPtr pScreen) { Colormap pCmapIDs[MAXCMAPS]; if (!nxagentDoDirectColormaps) return; int n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs); for (int i = 0; i < n; i++) { ColormapPtr pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP); if (pCmap) XInstallColormap(nxagentDisplay, nxagentColormap(pCmap)); } } void nxagentDirectUninstallColormaps(ScreenPtr pScreen) { Colormap pCmapIDs[MAXCMAPS]; if (!nxagentDoDirectColormaps) return; int n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs); for (int i = 0; i < n; i++) { ColormapPtr pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP); if (pCmap) XUninstallColormap(nxagentDisplay, nxagentColormap(pCmap)); } } void nxagentInstallColormap(ColormapPtr pCmap) { int index = pCmap->pScreen->myNum; ColormapPtr pOldCmap = InstalledMaps[index]; if(pCmap != pOldCmap) { nxagentDirectUninstallColormaps(pCmap->pScreen); /* Uninstall pInstalledMap. Notify all interested parties. */ if(pOldCmap != (ColormapPtr)None) WalkTree(pCmap->pScreen, TellLostMap, (void *)&pOldCmap->mid); InstalledMaps[index] = pCmap; WalkTree(pCmap->pScreen, TellGainedMap, (void *)&pCmap->mid); nxagentSetInstalledColormapWindows(pCmap->pScreen); nxagentDirectInstallColormaps(pCmap->pScreen); } } void nxagentUninstallColormap(ColormapPtr pCmap) { int index = pCmap->pScreen->myNum; ColormapPtr pCurCmap = InstalledMaps[index]; if(pCmap == pCurCmap) { if ((unsigned int)pCmap->mid != pCmap->pScreen->defColormap) { pCurCmap = (ColormapPtr)LookupIDByType(pCmap->pScreen->defColormap, RT_COLORMAP); (*pCmap->pScreen->InstallColormap)(pCurCmap); } } } int nxagentListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIds) { if (nxagentInstalledDefaultColormap) { *pCmapIds = InstalledMaps[pScreen->myNum]->mid; return 1; } else { return 0; } } void nxagentStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors) { if (pCmap->pVisual->class & DynamicClass) #ifdef _XSERVER64 { XColor *pColors64 = (XColor *)malloc(nColors * sizeof(XColor) ); for(int i = 0; i < nColors; ++i) { pColors64[i].pixel = pColors[i].pixel; pColors64[i].red = pColors[i].red; pColors64[i].green = pColors[i].green; pColors64[i].blue = pColors[i].blue; pColors64[i].flags = pColors[i].flags; } XStoreColors(nxagentDisplay, nxagentColormap(pCmap), pColors64, nColors); SAFE_free(pColors64); } #else XStoreColors(nxagentDisplay, nxagentColormap(pCmap), (XColor *)pColors, nColors); #endif } void nxagentResolveColor(unsigned short *pRed, unsigned short *pGreen, unsigned short *pBlue, VisualPtr pVisual) { int shift = 16 - pVisual->bitsPerRGBValue; unsigned int lim = (1 << pVisual->bitsPerRGBValue) - 1; if ((pVisual->class == PseudoColor) || (pVisual->class == DirectColor)) { /* rescale to rgb bits */ *pRed = ((*pRed >> shift) * 65535) / lim; *pGreen = ((*pGreen >> shift) * 65535) / lim; *pBlue = ((*pBlue >> shift) * 65535) / lim; } else if (pVisual->class == GrayScale) { /* rescale to gray then rgb bits */ *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100; *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim; } else if (pVisual->class == StaticGray) { unsigned int limg = pVisual->ColormapEntries - 1; /* rescale to gray then [0..limg] then [0..65535] then rgb bits */ *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100; *pRed = ((((*pRed * (limg + 1))) >> 16) * 65535) / limg; *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim; } else { unsigned limr = pVisual->redMask >> pVisual->offsetRed; unsigned limg = pVisual->greenMask >> pVisual->offsetGreen; unsigned limb = pVisual->blueMask >> pVisual->offsetBlue; /* rescale to [0..limN] then [0..65535] then rgb bits */ *pRed = ((((((*pRed * (limr + 1)) >> 16) * 65535) / limr) >> shift) * 65535) / lim; *pGreen = ((((((*pGreen * (limg + 1)) >> 16) * 65535) / limg) >> shift) * 65535) / lim; *pBlue = ((((((*pBlue * (limb + 1)) >> 16) * 65535) / limb) >> shift) * 65535) / lim; } } Bool nxagentCreateDefaultColormap(ScreenPtr pScreen) { VisualPtr pVisual; ColormapPtr pCmap; unsigned short zero = 0, ones = 0xFFFF; #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "Debug: Searching for the root visual [%lu].\n", pScreen->rootVisual); #endif for (pVisual = pScreen->visuals; pVisual->vid != pScreen->rootVisual; pVisual++); if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &pCmap, (pVisual->class & DynamicClass) ? AllocNone : AllocAll, 0) != Success) return False; Pixel wp = pScreen->whitePixel; Pixel bp = pScreen->blackPixel; if ((AllocColor(pCmap, &ones, &ones, &ones, &wp, 0) != Success) || (AllocColor(pCmap, &zero, &zero, &zero, &bp, 0) != Success)) return FALSE; pScreen->whitePixel = wp; pScreen->blackPixel = bp; (*pScreen->InstallColormap)(pCmap); nxagentInstalledDefaultColormap = True; return True; } static void nxagentReconnectColormap(void * p0, XID x1, void * p2) { ColormapPtr pCmap = (ColormapPtr)p0; Bool* pBool = (Bool*)p2; #ifdef NXAGENT_RECONNECT_COLORMAP_DEBUG fprintf(stderr, "nxagentReconnectColormap: %p\n", pCmap); #endif if (!*pBool || !pCmap) return; VisualPtr pVisual = pCmap -> pVisual; nxagentColormapPriv(pCmap)->colormap = XCreateColormap(nxagentDisplay, nxagentDefaultWindows[pCmap->pScreen->myNum], nxagentVisual(pVisual), (pVisual->class & DynamicClass) ? AllocAll : AllocNone); #ifdef NXAGENT_RECONNECT_COLORMAP_DEBUG fprintf(stderr, "nxagentReconnectColormap: %p - ID %xl\n", pCmap, nxagentColormap(pCmap)); #endif } Bool nxagentReconnectAllColormap(void *p0) { Bool success = True; #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_COLORMAP_DEBUG) fprintf(stderr, "nxagentReconnectAllColormap\n"); #endif for (int cid = 0; (cid < MAXCLIENTS) && success; cid++) { if (clients[cid] && success) { FindClientResourcesByType(clients[cid], RT_COLORMAP, nxagentReconnectColormap, &success); } } return success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Colormap.h0000644000000000000000000000711413614532331020605 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #ifndef __Color_H__ #define __Color_H__ #define DUMB_WINDOW_MANAGERS #define MAXCMAPS 1 #define MINCMAPS 1 typedef struct { Colormap colormap; } nxagentPrivColormap; typedef struct { int numCmapIDs; Colormap *cmapIDs; int numWindows; Window *windows; int index; } nxagentInstalledColormapWindows; #define nxagentColormapPriv(pCmap) \ ((nxagentPrivColormap *)((pCmap)->devPriv)) #define nxagentColormap(pCmap) (nxagentColormapPriv(pCmap)->colormap) #define nxagentPixel(pixel) (pixel) Bool nxagentCreateColormap(ColormapPtr pCmap); void nxagentDestroyColormap(ColormapPtr pCmap); void nxagentSetInstalledColormapWindows(ScreenPtr pScreen); void nxagentSetScreenSaverColormapWindow(ScreenPtr pScreen); void nxagentDirectInstallColormaps(ScreenPtr pScreen); void nxagentDirectUninstallColormaps(ScreenPtr pScreen); void nxagentInstallColormap(ColormapPtr pCmap); void nxagentUninstallColormap(ColormapPtr pCmap); int nxagentListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIds); void nxagentStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors); void nxagentResolveColor(unsigned short *pRed, unsigned short *pGreen, unsigned short *pBlue, VisualPtr pVisual); Bool nxagentCreateDefaultColormap(ScreenPtr pScreen); #endif /* __Color_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Alpha.c0000644000000000000000000000477613614532331021543 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include "Compext.h" #include "Alpha.h" #include "Z.h" #define PANIC #define WARNING #undef TEST #undef DEBUG #define ALPHA_COMPRESSION_LEVEL 1 #define ALPHA_COMPRESSION_THRESHOLD 32 #define ALPHA_COMPRESSION_STRATEGY Z_RLE static int alphaCompressionLevel = ALPHA_COMPRESSION_LEVEL; static int alphaCompressionThreshold = ALPHA_COMPRESSION_THRESHOLD; static int alphaCompressionStrategy = ALPHA_COMPRESSION_STRATEGY; char *AlphaCompressData(const char *data, unsigned int size, unsigned int *compressed_size) { return ZCompressData(data, size, alphaCompressionThreshold, alphaCompressionLevel, alphaCompressionStrategy, compressed_size); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Alpha.h0000644000000000000000000000415213614532331021534 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Alpha_H #define Alpha_H #ifdef __cplusplus extern "C" { #endif extern char *AlphaCompressData( #if NeedFunctionPrototypes const char* /* data */, unsigned int /* size */, unsigned int* /* compressed_size */ #endif ); #ifdef __cplusplus } #endif #endif /* Alpha_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Bitmap.c0000644000000000000000000000735113614532331021722 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include #include "Compext.h" #include "Bitmap.h" #define PANIC #define WARNING #undef TEST #undef DEBUG char *BitmapCompressData(XImage *image, unsigned int *size) { if (image -> bits_per_pixel != 32) { #ifdef TEST fprintf(stderr, "******BitmapCompressData: Nothing to do with image of [%d] bpp and size [%d].\n", image -> bits_per_pixel, image -> bytes_per_line * image -> height); #endif *size = image -> bytes_per_line * image -> height; return image -> data; } else { /* * Remove the 4th byte from the bitmap. */ char *data; char *next_src; char *next_dst; #ifdef TEST if (image -> bytes_per_line != 4 * image -> width) { fprintf(stderr, "******BitmapCompressData: PANIC! Image as [%d] bytes per line with expected [%d].\n", image -> bytes_per_line, 4 * image -> width); return NULL; } #endif *size = image -> width * image -> height * 3; data = malloc(*size); if (data == NULL) { #ifdef PANIC fprintf(stderr, "******BitmapCompressData: PANIC! Failed to allocate [%d] bytes for the destination.\n", *size); #endif *size = image -> bytes_per_line * image -> height; return image -> data; } next_src = image -> data; next_dst = data; if (image -> byte_order == LSBFirst) { while (next_src < image -> data + image -> bytes_per_line * image -> height) { *next_dst++ = *next_src++; *next_dst++ = *next_src++; *next_dst++ = *next_src++; next_src++; } } else { while (next_src < image -> data + image -> bytes_per_line * image -> height) { next_src++; *next_dst++ = *next_src++; *next_dst++ = *next_src++; *next_dst++ = *next_src++; } } return data; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Bitmap.h0000644000000000000000000000413513614532331021724 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Bitmap_H #define Bitmap_H #ifdef __cplusplus extern "C" { #endif extern char *BitmapCompressData( #if NeedFunctionPrototypes XImage* /* image */, unsigned int* /* compressed_size */ #endif ); #ifdef __cplusplus } #endif #endif /* Bitmap_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Clean.c0000644000000000000000000002110713614532331021523 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include #include "os.h" #include "Compext.h" #include "Clean.h" #define PANIC #define WARNING #undef TEST #undef DEBUG int CleanXYImage(XImage *image) { int i, j, k, plane; int bitsToClean = (image -> bytes_per_line << 3) - image -> width - image -> xoffset; unsigned int bytesToClean = bitsToClean >> 3; bitsToClean &= 7; for (k = 0; k < image -> depth; k++) { plane = k * (image -> bytes_per_line * image -> height); for (i = 1; i <= image -> height; i++) { if (image -> byte_order == image -> bitmap_bit_order) { for (j = 1; j <= bytesToClean; j++) { image -> data[plane + i * (image -> bytes_per_line) - j] = 0x00; } } else { for (j = bytesToClean; j >= 1; j--) { image -> data[plane + i * (image -> bytes_per_line) - j] = 0x00; } } if (image -> bitmap_bit_order == MSBFirst) { image -> data[plane + i * (image -> bytes_per_line) - j] &= 0xff << bitsToClean; } else { image -> data[plane + i * (image -> bytes_per_line) - j] &= 0xff >> bitsToClean; } } } return 1; } int CleanZImage(XImage *image) { unsigned int bytesToClean; unsigned int imageLength; #ifdef TEST fprintf(stderr, "*****CleanZImage: Going to clean image of [%d] bits per pixel.\n", image -> bits_per_pixel); #endif switch (image -> bits_per_pixel) { case 32: { /* * The caller should pay attention at extracting * the alpha channel prior to cleaning the image. * Cleaning an image which is carrying the alpha * channel will result in the image being treated * as fully transparent. */ bytesToClean = image -> bytes_per_line * image -> height; #ifdef DEBUG fprintf(stderr, "*****CleanZImage: Cleaning [%d] bytes with bits per pixel [%d] " "width [%d] bytes per line [%d] height [%d].\n", bytesToClean, image -> bits_per_pixel, image -> width, image -> bytes_per_line, image -> height); #endif if (image -> byte_order == LSBFirst) { for (int i = 3; i < bytesToClean; i += 4) { ((unsigned char *) image -> data)[i] = 0x00; } } else { for (int i = 0; i < bytesToClean; i += 4) { ((unsigned char *) image -> data)[i] = 0x00; } } break; } case 24: case 15: case 16: case 8: { bytesToClean = image -> bytes_per_line - ((image -> width * image -> bits_per_pixel) >> 3); for (int i = 1; i <= image -> height; i++) { for (int j = bytesToClean; j > 0; j--) { ((unsigned char *) image -> data)[(i * image -> bytes_per_line) - j] = 0x00; } } break; } default: { #ifdef PANIC fprintf(stderr, "*****CleanZImage: PANIC! Cannot clean image with [%d] bits per pixel.\n", image -> bits_per_pixel); #endif } } /* * Clean the padding bytes at the real * end of the buffer. */ imageLength = image -> bytes_per_line * image -> height; bytesToClean = imageLength % 4; for (int j = 0; j < bytesToClean; j++) { ((unsigned char *)image -> data)[(imageLength + j)] = 0x00; } return 1; } /* * Copy a clean version of src_image into dst_image. * This code is not taking care of the image format. * The agent doesn't use it and you have to consider * it unsupported. */ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) { register long data_size; data_size = (src_image -> bytes_per_line * src_image -> height) >> 2; #ifdef WARNING fprintf(stderr, "******CleanImage: WARNING! Function called with image of [%d] bits per pixel.\n", src_image -> bits_per_pixel); #endif switch (src_image -> bits_per_pixel) { case 32: { unsigned int mask; if (src_image -> byte_order == MSBFirst) { mask = 0xffffff00; } else { mask = 0x00ffffff; } for (int i = 0; i < data_size; i++) { ((unsigned int *)dst_image -> data)[i] = ((unsigned int *)src_image -> data)[i] & mask; } break; } case 24: { unsigned int bytes_to_clean; for (int i = 0; i < data_size; i++) { ((unsigned int *)dst_image -> data)[i] = ((unsigned int *)src_image -> data)[i]; } bytes_to_clean = dst_image -> bytes_per_line - ((dst_image -> width * dst_image -> bits_per_pixel) >> 3); if (bytes_to_clean) { register unsigned int mask = 0xffffffff; register int line_size; line_size = dst_image -> bytes_per_line >> 2; if (dst_image -> byte_order == MSBFirst) { mask = mask << (bytes_to_clean << 3); } else { mask = mask >> (bytes_to_clean << 3); } for (int i = 0; i < dst_image -> height;) { ((unsigned char *)dst_image -> data)[(++i * line_size) -1] &= mask; } } break; } case 15: case 16: { for (int i = 0; i < data_size; i++) { ((unsigned int *) dst_image -> data)[i] = ((unsigned int *) src_image -> data)[i]; } if (src_image -> width & 0x00000001) { int card32_per_line = dst_image -> bytes_per_line >> 2; for (int i = 0; i < dst_image -> height;) { ((unsigned int *) dst_image -> data)[(++i * card32_per_line) -1] &= 0x0000ffff; } } break; } case 8: { unsigned int mask = 0x00000000; switch (dst_image -> width % 4) { case 3: { mask = 0x00ffffff; break; } case 2: { mask = 0x0000ffff; break; } case 1: { mask = 0x000000ff; break; } default: { /* * Nothing to clean. */ break; } } for (int i = 0; i < data_size; i++) { ((unsigned int *) dst_image -> data)[i] = ((unsigned int *) src_image -> data)[i]; } if (mask) { int card32_per_line; card32_per_line = dst_image -> bytes_per_line >> 2; for (int i = 0; i < dst_image -> height; i++) { ((unsigned int *) dst_image -> data)[(++i * card32_per_line) -1] &= mask; } } break; } default: { #ifdef PANIC fprintf(stderr, "******CleanImage: PANIC! Cannot clean image of [%d] bits per pixel.\n", src_image -> bits_per_pixel); #endif return 0; } } return 1; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Clean.h0000644000000000000000000000411613614532331021531 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Clean_H #define Clean_H #ifdef __cplusplus extern "C" { #endif #include int CleanXYImage(XImage *image); int CleanZImage(XImage *image); int CopyAndCleanImage(XImage *src_image, XImage *dst_image); #ifdef __cplusplus } #endif #endif /* Clean_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Colormap.c0000644000000000000000000000506513614532331022262 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include "Compext.h" #include "Colormap.h" #include "Z.h" #define PANIC #define WARNING #undef TEST #undef DEBUG #define COLORMAP_COMPRESSION_LEVEL 4 #define COLORMAP_COMPRESSION_THRESHOLD 32 #define COLORMAP_COMPRESSION_STRATEGY Z_DEFAULT_STRATEGY static int colormapCompressionLevel = COLORMAP_COMPRESSION_LEVEL; static int colormapCompressionThreshold = COLORMAP_COMPRESSION_THRESHOLD; static int colormapCompressionStrategy = COLORMAP_COMPRESSION_STRATEGY; char *ColormapCompressData(const char *data, unsigned int size, unsigned int *compressed_size) { return ZCompressData(data, size, colormapCompressionThreshold, colormapCompressionLevel, colormapCompressionStrategy, compressed_size); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Colormap.h0000644000000000000000000000420213614532331022257 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef ColormapComp_H #define ColormapComp_H #ifdef __cplusplus extern "C" { #endif extern char *ColormapCompressData( #if NeedFunctionPrototypes const char* /* data */, unsigned int /* size */, unsigned int* /* compressed_size */ #endif ); #ifdef __cplusplus } #endif #endif /* ColormapComp_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c0000644000000000000000000033061213614532331022124 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #undef _XSERVER64 #include #ifndef __sun #include #endif #include "dix.h" #include "os.h" /* * Needed to enable definition of the callback * functions. */ #define NX_TRANS_SOCKET #include #include #include #include "Compext.h" #include #include #include #include #include "Clean.h" #include "Mask.h" #include "Colormap.h" #include "Alpha.h" #include "Bitmap.h" #include "Jpeg.h" #include "Png.h" #include "Rgb.h" #include "Rle.h" #include "Z.h" #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP /* * Maximum number of colors allowed in * Png encoding. */ #define NB_COLOR_MAX 256 /* * Dummy error handlers used internally to catch * Xlib failures in replies. */ static int _NXInternalReplyErrorFunction(Display *dpy, XErrorEvent *error); static void _NXInternalLostSequenceFunction(Display *dpy, unsigned long newseq, unsigned long lastseq, unsigned int type); /* * Resource ids that can be requested by * the client for use in split or unpack * operations. */ static unsigned char _NXSplitResources[NXNumberOfResources]; static unsigned char _NXUnpackResources[NXNumberOfResources]; static Display *_NXDisplayInitialized = NULL; /* * Used in asynchronous handling of * GetImage replies. */ typedef struct { unsigned long sequence; unsigned int resource; unsigned long mask; int format; int width; int height; _XAsyncHandler *handler; XImage *image; } _NXCollectImageState; static _NXCollectImageState *_NXCollectedImages[NXNumberOfResources]; /* * Used in asynchronous handling of * GetProperty replies. */ typedef struct { unsigned long sequence; unsigned int resource; Window window; Atom property; Atom type; int format; unsigned long items; unsigned long after; _XAsyncHandler *handler; char *data; } _NXCollectPropertyState; static _NXCollectPropertyState *_NXCollectedProperties[NXNumberOfResources]; /* * Used in asynchronous handling of * GrabPointer replies. */ typedef struct { unsigned long sequence; unsigned int resource; int status; _XAsyncHandler *handler; } _NXCollectGrabPointerState; static _NXCollectGrabPointerState *_NXCollectedGrabPointers[NXNumberOfResources]; /* * Used in asynchronous handling of * GetInputFocus replies. */ typedef struct { unsigned long sequence; unsigned int resource; Window focus; int revert_to; _XAsyncHandler *handler; } _NXCollectInputFocusState; static _NXCollectInputFocusState *_NXCollectedInputFocuses[NXNumberOfResources]; /* * Used by functions handling cache of * packed images. */ #define MD5_LENGTH 16 typedef struct { md5_byte_t *md5; XImage *image; unsigned int method; } _NXImageCacheEntry; int NXImageCacheSize = 0; int NXImageCacheHits = 0; int NXImageCacheOps = 0; _NXImageCacheEntry *NXImageCache = NULL; #ifdef DUMP void _NXCacheDump(const char *label); void _NXDumpData(const unsigned char *buffer, unsigned int size); #endif /* * From X11/PutImage.c. * * Cancel a GetReq operation, before doing * _XSend or Data. */ #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #define UnGetReq(name)\ dpy->bufptr -= SIZEOF(x##name##Req);\ dpy->request-- #else #define UnGetReq(name)\ dpy->bufptr -= SIZEOF(x/**/name/**/Req);\ dpy->request-- #endif #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #define UnGetEmptyReq()\ dpy->bufptr -= 4;\ dpy->request-- #else #define UnGetEmptyReq(name)\ dpy->bufptr -= 4;\ dpy->request-- #endif /* * From X11/ImUtil.c. */ extern int _XGetBitsPerPixel(Display *dpy, int depth); extern int _XGetScanlinePad(Display *dpy, int depth); #define ROUNDUP(nbytes, pad) (((nbytes) + ((pad) - 1)) & \ ~(long)((pad) - 1)) static unsigned int DepthOnes(unsigned long mask) { register unsigned long y; y = (mask >> 1) &033333333333; y = mask - y - ((y >>1) & 033333333333); return ((unsigned int) (((y + (y >> 3)) & 030707070707) % 077)); } #define CanMaskImage(image, mask) \ \ (image -> format == ZPixmap && mask != NULL && \ (image -> depth == 32 || image -> depth == 24 || \ (image -> depth == 16 && (image -> red_mask == 0xf800 && \ image -> green_mask == 0x7e0 && image -> blue_mask == 0x1f)))) #define ShouldMaskImage(image, mask) (mask -> color_mask != 0xff) /* * Initialize and reset the internal structures. */ extern int _NXInternalInitResources(Display *dpy); extern int _NXInternalResetResources(Display *dpy); extern int _NXInternalInitEncoders(Display *dpy); extern int _NXInternalResetEncoders(Display *dpy); int NXInitDisplay(Display *dpy) { #ifdef TEST fprintf(stderr, "******NXInitDisplay: Called for display at [%p].\n", (void *) dpy); #endif if (_NXDisplayInitialized == NULL) { _NXInternalInitResources(dpy); _NXInternalInitEncoders(dpy); _NXDisplayInitialized = dpy; return 1; } #ifdef TEST fprintf(stderr, "******NXInitDisplay: WARNING! Internal structures already initialized.\n"); #endif return 0; } int NXResetDisplay(Display *dpy) { #ifdef TEST fprintf(stderr, "******NXResetDisplay: Called for display at [%p].\n", (void *) dpy); #endif if (_NXDisplayInitialized != NULL) { _NXInternalResetResources(dpy); _NXInternalResetEncoders(dpy); _NXDisplayInitialized = NULL; return 1; } #ifdef TEST fprintf(stderr, "******NXResetDisplay: WARNING! Internal structures already reset.\n"); #endif return 0; } int _NXInternalInitResources(Display *dpy) { return _NXInternalResetResources(dpy); } int _NXInternalResetResources(Display *dpy) { int i; #ifdef TEST fprintf(stderr, "******_NXInternalResetResources: Clearing all the internal structures.\n"); #endif for (i = 0; i < NXNumberOfResources; i++) { _NXSplitResources[i] = 0; _NXUnpackResources[i] = 0; if (_NXCollectedImages[i] != NULL) { #ifdef TEST fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect image data " "for resource [%d].\n", i); #endif if (_NXCollectedImages[i] -> handler != NULL) { DeqAsyncHandler(dpy, _NXCollectedImages[i] -> handler); free(_NXCollectedImages[i] -> handler); } if (_NXCollectedImages[i] -> image != NULL) { XDestroyImage(_NXCollectedImages[i] -> image); } free(_NXCollectedImages[i]); _NXCollectedImages[i] = NULL; } if (_NXCollectedProperties[i] != NULL) { #ifdef TEST fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect property data " "for resource [%d].\n", i); #endif if (_NXCollectedProperties[i] -> handler != NULL) { DeqAsyncHandler(dpy, _NXCollectedProperties[i] -> handler); free(_NXCollectedProperties[i] -> handler); } if (_NXCollectedProperties[i] -> data != NULL) { free(_NXCollectedProperties[i] -> data); } free(_NXCollectedProperties[i]); _NXCollectedProperties[i] = NULL; } if (_NXCollectedGrabPointers[i] != NULL) { #ifdef TEST fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing grab pointer data " "for resource [%d].\n", i); #endif if (_NXCollectedGrabPointers[i] -> handler != NULL) { DeqAsyncHandler(dpy, _NXCollectedGrabPointers[i] -> handler); free(_NXCollectedGrabPointers[i] -> handler); } free(_NXCollectedGrabPointers[i]); _NXCollectedGrabPointers[i] = NULL; } if (_NXCollectedInputFocuses[i] != NULL) { #ifdef TEST fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect input focus data " "for resource [%d].\n", i); #endif if (_NXCollectedInputFocuses[i] -> handler != NULL) { DeqAsyncHandler(dpy, _NXCollectedInputFocuses[i] -> handler); free(_NXCollectedInputFocuses[i] -> handler); } free(_NXCollectedInputFocuses[i]); _NXCollectedInputFocuses[i] = NULL; } } return 1; } int _NXInternalInitEncoders(Display *dpy) { ZInitEncoder(); return 1; } int _NXInternalResetEncoders(Display *dpy) { ZResetEncoder(); return 1; } int NXSetDisplayPolicy(Display *dpy, int policy) { if (policy == NXPolicyImmediate) { return NXTransPolicy(NX_FD_ANY, NX_POLICY_IMMEDIATE); } else { return NXTransPolicy(NX_FD_ANY, NX_POLICY_DEFERRED); } } int NXSetDisplayBuffer(Display *dpy, int size) { /* * This is not multi-thread safe, so, * if you have threads, be sure that * they are stopped. */ char *buffer; XFlush(dpy); if (dpy -> bufmax - size == dpy -> buffer) { #ifdef TEST fprintf(stderr, "******NXSetDisplayBuffer: Nothing to do with buffer size matching.\n"); #endif return 1; } else if (dpy -> bufptr != dpy -> buffer) { #ifdef PANIC fprintf(stderr, "******NXSetDisplayBuffer: PANIC! The display buffer is not empty.\n"); #endif return -1; } else if ((buffer = Xcalloc(1, size)) == NULL) { #ifdef PANIC fprintf(stderr, "******NXSetDisplayBuffer: PANIC! Can't allocate [%d] bytes for the buffer.\n", size); #endif return -1; } if (dpy -> buffer != NULL) { free(dpy -> buffer); } dpy -> buffer = buffer; dpy -> bufptr = dpy -> buffer; dpy -> bufmax = dpy -> bufptr + size; #ifdef TEST fprintf(stderr, "******NXSetDisplayBuffer: Set the display output buffer size to [%d].\n", size); #endif return 1; } /* * If set, the Popen() function in the X server * will remove the LD_LIBRARY_PATH variable from * the environment before calling the execl() * function on the child process. */ int NXUnsetLibraryPath(int value) { int previous = _NXUnsetLibraryPath; _NXUnsetLibraryPath = value; #ifdef TEST fprintf(stderr, "******NXUnsetLibraryPath: Set the flag to [%d] with previous value [%d].\n", value, previous); #endif return previous; } /* * If set, the Xlib I/O error handler will simply * return, instead of quitting the program. This * leaves to the application the responsibility * of checking the state of the XlibDisplayIOEr- * ror flag. */ int NXHandleDisplayError(int value) { int previous = _NXHandleDisplayError; _NXHandleDisplayError = value; #ifdef TEST fprintf(stderr, "******NXHandleDisplayError: Set the flag to [%d] with previous value [%d].\n", value, previous); #endif return previous; } /* * Shutdown the display descriptor and force Xlib * to set the I/O error flag. */ Bool NXForceDisplayError(Display *dpy) { if (dpy != NULL) { NXTransClose(dpy -> fd); if (!(dpy -> flags & XlibDisplayIOError)) { shutdown(dpy -> fd, SHUT_RDWR); _XIOError(dpy); } return 1; } return 0; } /* * Check if the display has become invalid. Similarly * to the modified Xlib, we call the predicate funct- * ion with the value of the XlibDisplayIOError flag * only if the I/O error was not encountered already. * The application can use this function to query the * XlibDisplayIOError flag because Xlib doesn't expose * the internals of the display structure to the appli- * cation. */ int NXDisplayError(Display *dpy) { if (dpy != NULL) { return (_XGetIOError(dpy) || (_NXDisplayErrorFunction != NULL && (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))); } return 1; } /* * Various queries related to the state of the * display connection. */ int NXDisplayReadable(Display *dpy) { int result; int readable; result = NXTransReadable(dpy -> fd, &readable); if (result == 0) { #ifdef DEBUG fprintf(stderr, "******NXDisplayReadable: Returning [%d] bytes readable from fd [%d].\n", readable, dpy -> fd); #endif return readable; } #ifdef DEBUG fprintf(stderr, "******NXDisplayReadable: WARNING! Error detected on display fd [%d].\n", dpy -> fd); #endif return -1; } int NXDisplayFlushable(Display *dpy) { #ifdef DEBUG int flushable; flushable = NXTransFlushable(dpy -> fd) + (dpy -> bufptr - dpy -> buffer); fprintf(stderr, "******NXDisplayFlushable: Returning [%d+%d=%d] bytes flushable " "to fd [%d].\n", (int) (dpy -> bufptr - dpy -> buffer), (int) (flushable - (dpy -> bufptr - dpy -> buffer)), flushable, dpy -> fd); return flushable; #else return NXTransFlushable(dpy -> fd) + (dpy -> bufptr - dpy -> buffer); #endif } int NXDisplayCongestion(Display *dpy) { #ifdef DEBUG int congestion = NXTransCongestion(dpy -> fd); fprintf(stderr, "******NXDisplayCongestion: Returning [%d] as congestion level for fd [%d].\n", congestion, dpy -> fd); return congestion; #else return NXTransCongestion(dpy -> fd); #endif } int NXFlushDisplay(Display *dpy, int what) { if (!(dpy -> flags & XlibDisplayWriting) && dpy -> bufptr - dpy -> buffer > 0) { #ifdef DEBUG fprintf(stderr, "******NXFlushDisplay: Writing with [%d] bytes in the buffer.\n", (int) (dpy -> bufptr - dpy -> buffer)); #endif XFlush(dpy); } if (what == NXFlushBuffer) { return 0; } #ifdef DEBUG fprintf(stderr, "******NXFlushDisplay: Flushing with [%d] bytes in the NX transport.\n", NXDisplayFlushable(dpy)); #endif return NXTransFlush(dpy -> fd); } NXDisplayErrorPredicate NXSetDisplayErrorPredicate(NXDisplayErrorPredicate predicate) { NXDisplayErrorPredicate previous = _NXDisplayErrorFunction; _NXDisplayErrorFunction = predicate; #ifdef TEST fprintf(stderr, "******NXSetDisplayErrorPredicate: Set the predicate to [%p] with previous value [%p].\n", predicate, previous); #endif return previous; } NXDisplayBlockHandler NXSetDisplayBlockHandler(NXDisplayBlockHandler handler) { NXDisplayBlockHandler previous = _NXDisplayBlockFunction; _NXDisplayBlockFunction = handler; #ifdef TEST fprintf(stderr, "******NXSetDisplayBlockHandler: Set the handler to [%p] with previous value [%p].\n", handler, previous); #endif return previous; } NXDisplayWriteHandler NXSetDisplayWriteHandler(NXDisplayWriteHandler handler) { NXDisplayWriteHandler previous = _NXDisplayWriteFunction; _NXDisplayWriteFunction = handler; #ifdef TEST fprintf(stderr, "******NXSetDisplayWriteHandler: Set the handler to [%p] with previous value [%p].\n", handler, previous); #endif return previous; } NXDisplayFlushHandler NXSetDisplayFlushHandler(NXDisplayFlushHandler handler, Display *display) { NXDisplayFlushHandler previous = _NXDisplayFlushFunction; _NXDisplayFlushFunction = handler; NXTransHandler(NX_FD_ANY, NX_HANDLER_FLUSH, (void (*)(void *, int)) handler, (void *) display); #ifdef TEST fprintf(stderr, "******NXSetDisplayFlushHandler: Set the handler to [%p] with display [%p] " "and previous value [%p].\n", handler, display, previous); #endif return previous; } NXDisplayStatisticsHandler NXSetDisplayStatisticsHandler(NXDisplayStatisticsHandler handler, char **buffer) { NXDisplayStatisticsHandler previous = _NXDisplayStatisticsFunction; _NXDisplayStatisticsFunction = handler; /* * Propagate the handler. */ NXTransHandler(NX_FD_ANY, NX_HANDLER_STATISTICS, (void (*)(void *, int)) handler, (void *) buffer); #ifdef TEST fprintf(stderr, "******NXSetDisplayStatisticsHandler: Set the handler to [%p] with buffer pointer [%p] " "and previous value [%p].\n", handler, buffer, previous); #endif return previous; } NXLostSequenceHandler NXSetLostSequenceHandler(NXLostSequenceHandler handler) { NXLostSequenceHandler previous = _NXLostSequenceFunction; _NXLostSequenceFunction = handler; #ifdef TEST fprintf(stderr, "******NXSetLostSequenceHandler: Set the handler to [%p] with previous value [%p].\n", handler, previous); #endif return previous; } int _NXInternalReplyErrorFunction(Display *dpy, XErrorEvent *error) { #ifdef TEST fprintf(stderr, "******_NXInternalReplyErrorFunction: Internal error handler called.\n"); #endif return 0; } void _NXInternalLostSequenceFunction(Display *dpy, unsigned long newseq, unsigned long lastseq, unsigned int type) { #ifdef TEST fprintf(stderr, "******_NXInternalLostSequenceFunction: WARNING! Sequence lost with new " "sequence %ld last request %ld.\n", newseq, dpy -> request); /* * TODO: Reply or event info must be implemented. * * fprintf(stderr, "******_NXInternalLostSequenceFunction: WARNING! Expected event or reply " * "was %ld with sequence %ld.\n", (long) rep -> type, (long) rep -> sequenceNumber); */ fprintf(stderr, "******_NXInternalLostSequenceFunction: WARNING! Last sequence read " "was %ld display request is %ld.\n", lastseq & 0xffff, dpy -> request & 0xffff); #endif } Status NXGetControlParameters(Display *dpy, unsigned int *link_type, unsigned int *local_major, unsigned int *local_minor, unsigned int *local_patch, unsigned int *remote_major, unsigned int *remote_minor, unsigned int *remote_patch, int *split_timeout, int *motion_timeout, int *split_mode, int *split_size, unsigned int *pack_method, unsigned int *pack_quality, int *data_level, int *stream_level, int *delta_level, unsigned int *load_cache, unsigned int *save_cache, unsigned int *startup_cache) { xNXGetControlParametersReply rep; _X_UNUSED register xReq *req; LockDisplay(dpy); GetEmptyReq(NXGetControlParameters, req); #ifdef TEST fprintf(stderr, "******NXGetControlParameters: Sending message opcode [%d].\n", X_NXGetControlParameters); #endif if (_XReply(dpy, (xReply *) &rep, 0, xTrue) == xFalse) { #ifdef TEST fprintf(stderr, "******NXGetControlParameters: Error receiving reply.\n"); #endif UnlockDisplay(dpy); SyncHandle(); return 0; } #ifdef TEST fprintf(stderr, "******NXGetControlParameters: Got reply with link type [%u].\n", rep.linkType); fprintf(stderr, "******NXGetControlParameters: Local protocol major [%u] minor [%u] patch [%u].\n", rep.localMajor, rep.localMinor, rep.localPatch); fprintf(stderr, "******NXGetControlParameters: Remote protocol major [%u] minor [%u] patch [%u].\n", rep.remoteMajor, rep.remoteMinor, rep.remotePatch); fprintf(stderr, "******NXGetControlParameters: Split timeout [%d] motion timeout [%d].\n", (int) rep.splitTimeout, (int) rep.motionTimeout); fprintf(stderr, "******NXGetControlParameters: Split mode [%d] split size [%d].\n", (int) rep.splitMode, (int) rep.splitSize); fprintf(stderr, "******NXGetControlParameters: Preferred pack method [%d] pack quality [%d].\n", (int) rep.packMethod, (int) rep.packQuality); fprintf(stderr, "******NXGetControlParameters: Data level [%d] stream level [%d] delta level [%d].\n", rep.dataLevel, rep.streamLevel, rep.deltaLevel); #endif *link_type = rep.linkType; *local_major = rep.localMajor; *local_minor = rep.localMinor; *local_patch = rep.localPatch; *remote_major = rep.remoteMajor; *remote_minor = rep.remoteMinor; *remote_patch = rep.remotePatch; *split_timeout = rep.splitTimeout; *motion_timeout = rep.motionTimeout; *split_mode = rep.splitMode; *split_size = rep.splitSize; *pack_method = rep.packMethod; *pack_quality = rep.packQuality; *data_level = rep.dataLevel; *stream_level = rep.streamLevel; *delta_level = rep.deltaLevel; *load_cache = rep.loadCache; *save_cache = rep.saveCache; *startup_cache = rep.startupCache; UnlockDisplay(dpy); SyncHandle(); /* * Install our internal out-of-sync handler. */ _NXLostSequenceFunction = _NXInternalLostSequenceFunction; return 1; } /* * Which unpack methods are supported by the * remote proxy? */ Status NXGetUnpackParameters(Display *dpy, unsigned int *entries, unsigned char supported_methods[]) { register xNXGetUnpackParametersReq *req; xNXGetUnpackParametersReply rep; register unsigned n; #ifdef TEST register unsigned i; #endif if (*entries < NXNumberOfPackMethods) { #ifdef TEST fprintf(stderr, "******NXGetUnpackParameters: Requested only [%d] entries while they should be [%d].\n", *entries, NXNumberOfPackMethods); #endif return 0; } LockDisplay(dpy); GetReq(NXGetUnpackParameters, req); req -> entries = *entries; #ifdef TEST fprintf(stderr, "******NXGetUnpackParameters: Sending message opcode [%d] with [%d] requested entries.\n", X_NXGetUnpackParameters, *entries); #endif if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == xFalse || rep.length == 0) { #ifdef TEST fprintf(stderr, "******NXGetUnpackParameters: Error receiving reply.\n"); #endif UnlockDisplay(dpy); SyncHandle(); return 0; } if ((n = rep.length << 2) > *entries) { #ifdef TEST fprintf(stderr, "******NXGetUnpackParameters: Got [%d] bytes of reply data while they should be [%d].\n", n, *entries); #endif _XEatData(dpy, (unsigned long) n); UnlockDisplay(dpy); SyncHandle(); return 0; } *entries = n; #ifdef TEST fprintf(stderr, "******NXGetUnpackParameters: Reading [%d] bytes of reply data.\n", n); #endif _XReadPad(dpy, (char *) supported_methods, n); #ifdef TEST fprintf(stderr, "******NXGetUnpackParameters: Got reply with methods: "); for (i = 0; i < n; i++) { if (supported_methods[i] != 0) { fprintf(stderr, "[%d]", i); } } fprintf(stderr, ".\n"); #endif UnlockDisplay(dpy); SyncHandle(); return 1; } /* * Query and enable the MIT-SHM support between the * proxy and the X server. The 'enable' flags must be * true if shared memory PutImages and PutPackedImages * are desired. On return the flags will say if support * has been successfully enabled. * * Note that the the client part is not useful and not * implemented. The size of the segment is chosen by * the proxy. The main purpose of the message is to * reserve the XID that will be used by the remote. */ Status NXGetShmemParameters(Display *dpy, unsigned int *enable_client, unsigned int *enable_server, unsigned int *client_segment, unsigned int *server_segment, unsigned int *client_size, unsigned int *server_size) { register xNXGetShmemParametersReq *req; register int stage; xNXGetShmemParametersReply rep; /* * Save the previous handler. */ int (*handler)(Display *, XErrorEvent *) = _XErrorFunction; *client_segment = 0; *server_segment = 0; if (*enable_client) { *client_segment = XAllocID(dpy); } if (*enable_server) { *server_segment = XAllocID(dpy); } LockDisplay(dpy); _XErrorFunction = _NXInternalReplyErrorFunction; for (stage = 0; stage < 3; stage++) { GetReq(NXGetShmemParameters, req); req -> stage = stage; req -> enableClient = (*enable_client != 0 ? 1 : 0); req -> enableServer = (*enable_server != 0 ? 1 : 0); req -> clientSegment = *client_segment; req -> serverSegment = *server_segment; #ifdef TEST fprintf(stderr, "******NXGetShmemParameters: Sending message opcode [%d] at stage [%d].\n", X_NXGetShmemParameters, stage); #endif #ifdef TEST if (stage == 0) { fprintf(stderr, "******NXGetShmemParameters: Enable client is [%u] enable server is [%u].\n", *enable_client, *enable_server); fprintf(stderr, "******NXGetShmemParameters: Client segment is [%u] server segment is [%u].\n", *client_segment, *server_segment); } #endif /* * There isn't X server reply in the second stage. * The procedure followed at X server side is: * * Stage 0: Send X_QueryExtension and masquerade * the reply. * * Stage 1: Allocate the shared memory and send * X_ShmAttach to the X server. * * Stage 2: Send X_GetInputFocus and masquerade * the reply. * * The last message is used to force a reply and * collect any X error caused by a failure in the * shared memory initialization. */ if (stage != 1) { /* * We are only interested in the final reply. */ if (_XReply(dpy, (xReply *) &rep, 0, xTrue) == xFalse) { #ifdef TEST fprintf(stderr, "******NXGetShmemParameters: Error receiving reply.\n"); #endif _XErrorFunction = handler; UnlockDisplay(dpy); SyncHandle(); return 0; } } } /* * Return the settings to client. */ *enable_client = rep.clientEnabled; *enable_server = rep.serverEnabled; *client_size = rep.clientSize; *server_size = rep.serverSize; #ifdef TEST fprintf(stderr, "******NXGetShmemParameters: Got final reply with enabled client [%u] and server [%u].\n", *enable_client, *enable_server); fprintf(stderr, "******NXGetShmemParameters: Client segment size [%u] server segment size [%u].\n", *client_size, *server_size); #endif _XErrorFunction = handler; UnlockDisplay(dpy); SyncHandle(); return 1; } /* * Get the path to the font server that can be used by the X * server to tunnel the font connections across the NX link. * The path actually represents the TCP port where the proxy * on the NX client side is listening. The agent can tempora- * rily enable the tunneling when it needs a font that is not * available on the client, for example when the session is * migrated from a different X server. * * Note that it is not advisable to use the font server chan- * nel for other purposes than restoring a font that is found * missing at the time the session is migrated to a different * display. This is because the agent implements a caching of * the list of fonts supported by the client as it needs to * advertise only the fonts that can be opened at both sides. */ Status NXGetFontParameters(Display *dpy, unsigned int path_length, char path_data[]) { _X_UNUSED register xNXGetFontParametersReq *req; xNXGetFontParametersReply rep; register unsigned n; #ifdef TEST register unsigned i; #endif if (path_length < 1) { #ifdef TEST fprintf(stderr, "******NXGetFontParameters: No room to store the reply.\n"); #endif return 0; } *path_data = '\0'; LockDisplay(dpy); GetReq(NXGetFontParameters, req); #ifdef TEST fprintf(stderr, "******NXGetFontParameters: Sending message opcode [%d].\n", X_NXGetFontParameters); #endif if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == xFalse || rep.length == 0) { #ifdef TEST fprintf(stderr, "******NXGetFontParameters: Error receiving reply.\n"); #endif UnlockDisplay(dpy); SyncHandle(); return 0; } if ((n = rep.length << 2) > path_length) { #ifdef TEST fprintf(stderr, "******NXGetFontParameters: Got [%d] bytes of reply data with only room for [%d].\n", n, path_length); #endif _XEatData(dpy, (unsigned long) n); UnlockDisplay(dpy); SyncHandle(); return 0; } #ifdef TEST fprintf(stderr, "******NXGetFontParameters: Reading [%d] bytes of reply data.\n", n); #endif _XReadPad(dpy, (char *) path_data, n); /* * Check if the string can be fully * contained by the buffer. */ if (*path_data > path_length - 1) { #ifdef TEST fprintf(stderr, "******NXGetFontParameters: Inconsistent length in the returned string.\n"); #endif UnlockDisplay(dpy); SyncHandle(); return 0; } #ifdef TEST fprintf(stderr, "******NXGetFontParameters: Got font path of [%d] bytes and value [", (int) *path_data); for (i = 0; i < *path_data; i++) { fprintf(stderr, "%c", *(path_data + i + 1)); } fprintf(stderr, "].\n"); #endif UnlockDisplay(dpy); SyncHandle(); return 1; } unsigned int NXAllocSplit(Display *dpy, unsigned int resource) { if (resource == NXAnyResource) { for (resource = 0; resource < NXNumberOfResources; resource++) { if (_NXSplitResources[resource] == 0) { _NXSplitResources[resource] = 1; #ifdef TEST fprintf(stderr, "******NXAllocSplit: Reserved resource [%u].\n", resource); #endif return resource; } } #ifdef TEST fprintf(stderr, "******NXAllocSplit: WARNING! Resource limit exausted.\n"); #endif return NXNoResource; } else if (resource >= 0 && resource < NXNumberOfResources) { #ifdef TEST if (_NXSplitResources[resource] == 0) { fprintf(stderr, "******NXAllocSplit: Reserved requested resource [%u].\n", resource); } else { fprintf(stderr, "******NXAllocSplit: Requested resource [%u] already reserved.\n", resource); } #endif _NXSplitResources[resource] = 1; } #ifdef PANIC fprintf(stderr, "******NXAllocSplit: PANIC! Can't reserve requested resource [%u].\n", resource); #endif return NXNoResource; } /* * Tell the proxy to split the next messages. */ int NXStartSplit(Display *dpy, unsigned int resource, unsigned int mode) { register xNXStartSplitReq *req; LockDisplay(dpy); GetReq(NXStartSplit, req); req -> resource = resource; req -> mode = mode; #ifdef TEST fprintf(stderr, "******NXStartSplit: Sending opcode [%d] with resource [%d] mode [%d].\n", X_NXStartSplit, resource, mode); #endif UnlockDisplay(dpy); SyncHandle(); return 1; } /* * Send the closure of the split sequence and * tell the proxy to send the results. */ int NXEndSplit(Display *dpy, unsigned int resource) { register xNXEndSplitReq *req; LockDisplay(dpy); GetReq(NXEndSplit, req); req -> resource = resource; #ifdef TEST fprintf(stderr, "******NXEndSplit: Sending opcode [%d] with resource [%d].\n", X_NXStartSplit, resource); #endif UnlockDisplay(dpy); SyncHandle(); return 1; } /* * This message must be sent whenever the proxy notifies * the client of the completion of a split. If the 'pro- * pagate' field is 0, the proxy will not send the ori- * ginal request to the X server, but will only free the * internal state. */ int NXCommitSplit(Display *dpy, unsigned int resource, unsigned int propagate, unsigned char request, unsigned int position) { register xNXCommitSplitReq *req; LockDisplay(dpy); GetReq(NXCommitSplit, req); req -> resource = resource; req -> propagate = propagate; req -> request = request; req -> position = position; #ifdef TEST fprintf(stderr, "******NXCommitSplit: Sending opcode [%d] with resource [%d] propagate [%d] " "request [%d] position [%d].\n", X_NXCommitSplit, resource, propagate, request, position); #endif UnlockDisplay(dpy); SyncHandle(); return 1; } int NXAbortSplit(Display *dpy, unsigned int resource) { register xNXAbortSplitReq *req; LockDisplay(dpy); GetReq(NXAbortSplit, req); #ifdef TEST fprintf(stderr, "******NXAbortSplit: Sending message opcode [%d] with resource [%u].\n", X_NXAbortSplit, resource); #endif req -> resource = resource; UnlockDisplay(dpy); SyncHandle(); return 1; } int NXFinishSplit(Display *dpy, unsigned int resource) { register xNXFinishSplitReq *req; LockDisplay(dpy); GetReq(NXFinishSplit, req); #ifdef TEST fprintf(stderr, "******NXFinishSplit: Sending message opcode [%d] with resource [%u].\n", X_NXFinishSplit, resource); #endif req -> resource = resource; UnlockDisplay(dpy); SyncHandle(); return 1; } int NXFreeSplit(Display *dpy, unsigned int resource) { register xNXFreeSplitReq *req; if (_NXSplitResources[resource] != 0) { LockDisplay(dpy); GetReq(NXFreeSplit, req); #ifdef TEST fprintf(stderr, "******NXFreeSplit: Sending message opcode [%d] with resource [%u].\n", X_NXFreeSplit, resource); #endif req -> resource = resource; UnlockDisplay(dpy); SyncHandle(); #ifdef TEST fprintf(stderr, "******NXFreeSplit: Making the resource [%u] newly available.\n", resource); #endif _NXSplitResources[resource] = 0; } #ifdef TEST else { fprintf(stderr, "******NXFreeSplit: Nothing to do for resource [%u].\n", resource); } #endif return 1; } /* * Tell to remote proxy to discard expose events * of one or more types. */ int NXSetExposeParameters(Display *dpy, int expose, int graphics_expose, int no_expose) { register xNXSetExposeParametersReq *req; LockDisplay(dpy); GetReq(NXSetExposeParameters, req); req -> expose = expose; req -> graphicsExpose = graphics_expose; req -> noExpose = no_expose; #ifdef TEST fprintf(stderr, "******NXSetExposeParameters: Sending message opcode [%d] with flags [%d][%d][%d].\n", X_NXSetExposeParameters, req -> expose, req -> graphicsExpose, req -> noExpose); #endif UnlockDisplay(dpy); SyncHandle(); return 1; } /* * Tell to the local proxy how to handle the next requests. */ int NXSetCacheParameters(Display *dpy, int enable_cache, int enable_split, int enable_save, int enable_load) { register xNXSetCacheParametersReq *req; LockDisplay(dpy); GetReq(NXSetCacheParameters, req); req -> enableCache = enable_cache; req -> enableSplit = enable_split; req -> enableSave = enable_save; req -> enableLoad = enable_load; #ifdef TEST fprintf(stderr, "******NXSetCacheParameters: Sending message opcode [%d] with " "flags [%d][%d][%d][%d].\n", X_NXSetCacheParameters, req -> enableCache, req -> enableSplit, req -> enableSave, req -> enableLoad); #endif UnlockDisplay(dpy); SyncHandle(); return 1; } unsigned int NXAllocUnpack(Display *dpy, unsigned int resource) { if (resource == NXAnyResource) { for (resource = 0; resource < NXNumberOfResources; resource++) { if (_NXUnpackResources[resource] == 0) { _NXUnpackResources[resource] = 1; #ifdef TEST fprintf(stderr, "******NXAllocUnpack: Reserved resource [%u].\n", resource); #endif return resource; } } #ifdef TEST fprintf(stderr, "******NXAllocUnpack: WARNING! Resource limit exausted.\n"); #endif return NXNoResource; } else if (resource >= 0 && resource < NXNumberOfResources) { #ifdef TEST if (_NXUnpackResources[resource] == 0) { fprintf(stderr, "******NXAllocUnpack: Reserved requested resource [%u].\n", resource); } else { fprintf(stderr, "******NXAllocUnpack: Requested resource [%u] already reserved.\n", resource); } #endif _NXUnpackResources[resource] = 1; } #ifdef PANIC fprintf(stderr, "******NXAllocUnpack: PANIC! Can't reserve requested resource [%u].\n", resource); #endif return NXNoResource; } int NXSetUnpackGeometry(Display *dpy, unsigned int resource, Visual *visual) { register xNXSetUnpackGeometryReq *req; LockDisplay(dpy); GetReq(NXSetUnpackGeometry, req); req -> resource = resource; req -> depth1Bpp = _XGetBitsPerPixel(dpy, 1); req -> depth4Bpp = _XGetBitsPerPixel(dpy, 4); req -> depth8Bpp = _XGetBitsPerPixel(dpy, 8); req -> depth16Bpp = _XGetBitsPerPixel(dpy, 16); req -> depth24Bpp = _XGetBitsPerPixel(dpy, 24); req -> depth32Bpp = _XGetBitsPerPixel(dpy, 32); if (visual != NULL) { req -> redMask = visual -> red_mask; req -> greenMask = visual -> green_mask; req -> blueMask = visual -> blue_mask; } else { #ifdef PANIC fprintf(stderr, "******NXSetUnpackGeometry: PANIC! Can't set the geometry without a visual.\n"); #endif UnGetReq(NXSetUnpackGeometry); UnlockDisplay(dpy); return -1; } #ifdef TEST fprintf(stderr, "******NXSetUnpackGeometry: Resource [%u] Depth/Bpp [1/%d][4/%d][8/%d]" "[16/%d][24/%d][32/%d].\n", resource, req -> depth1Bpp, req -> depth4Bpp, req -> depth8Bpp, req -> depth16Bpp, req -> depth24Bpp, req -> depth32Bpp); fprintf(stderr, "******NXSetUnpackGeometry: red [0x%x] green [0x%x] blue [0x%x].\n", (unsigned) req -> redMask, (unsigned) req -> greenMask, (unsigned) req -> blueMask); #endif UnlockDisplay(dpy); SyncHandle(); return 1; } /* * Store a colormap table on the remote side. * The colormap can then be used to unpack * an image. */ int NXSetUnpackColormap(Display *dpy, unsigned int resource, unsigned int method, unsigned int entries, const char *data, unsigned int data_length) { register xNXSetUnpackColormapReq *req; register int dst_data_length; LockDisplay(dpy); GetReq(NXSetUnpackColormap, req); req -> resource = resource; req -> method = method; req -> srcLength = data_length; req -> dstLength = entries << 2; dst_data_length = ROUNDUP(data_length, 4); req -> length += (dst_data_length >> 2); #ifdef TEST fprintf(stderr, "******NXSetUnpackColormap: Resource [%u] data size [%u] destination " "data size [%u].\n", resource, data_length, dst_data_length); #endif if (data_length > 0) { if (dpy -> bufptr + dst_data_length <= dpy -> bufmax) { /* * Clean the padding bytes in the request. */ *((int *) (dpy -> bufptr + dst_data_length - 4)) = 0x0; memcpy(dpy -> bufptr, data, data_length); dpy -> bufptr += dst_data_length; } else { /* * The _XSend() will pad the request for us. */ _XSend(dpy, data, data_length); } } UnlockDisplay(dpy); SyncHandle(); return 1; } /* * Store data of the alpha blending channel * that will be combined with the next image * to be unpacked. */ int NXSetUnpackAlpha(Display *dpy, unsigned int resource, unsigned int method, unsigned int entries, const char *data, unsigned int data_length) { register xNXSetUnpackAlphaReq *req; register unsigned int dst_data_length; LockDisplay(dpy); GetReq(NXSetUnpackAlpha, req); req -> resource = resource; req -> method = method; req -> srcLength = data_length; req -> dstLength = entries; dst_data_length = ROUNDUP(data_length, 4); req -> length += (dst_data_length >> 2); #ifdef TEST fprintf(stderr, "******NXSetUnpackAlpha: Resource [%u] data size [%u] destination data size [%u].\n", resource, data_length, dst_data_length); #endif if (data_length > 0) { if (dpy -> bufptr + dst_data_length <= dpy -> bufmax) { /* * Clean the padding bytes in the request. */ *((int *) (dpy -> bufptr + dst_data_length - 4)) = 0x0; memcpy(dpy -> bufptr, data, data_length); dpy -> bufptr += dst_data_length; } else { /* * The _XSend() will pad the request for us. */ _XSend(dpy, data, data_length); } } UnlockDisplay(dpy); SyncHandle(); return 1; } /* * Compatibility versions to be used when * connected to a 1.X.X proxy. */ /* * These are for compatibility with the 1.X.X * versions. */ #define sz_xNXSetUnpackColormapCompatReq 8 typedef struct _NXSetUnpackColormapCompatReq { CARD8 reqType; CARD8 resource; CARD16 length B16; CARD32 entries B32; } xNXSetUnpackColormapCompatReq; #define X_NXSetUnpackColormapCompat X_NXSetUnpackColormap int NXSetUnpackColormapCompat(Display *dpy, unsigned int resource, unsigned int entries, const char *data) { register xNXSetUnpackColormapCompatReq *req; register char *dst_data; register int dst_data_length; #ifdef DUMP int i; #endif LockDisplay(dpy); GetReq(NXSetUnpackColormapCompat, req); req -> resource = resource; req -> entries = entries; dst_data_length = entries << 2; req -> length += (dst_data_length >> 2); #ifdef TEST fprintf(stderr, "******NXSetUnpackColormapCompat: Resource [%u] number of entries [%u] " "destination data size [%u].\n", resource, entries, dst_data_length); #endif if (entries > 0) { if ((dpy -> bufptr + dst_data_length) <= dpy -> bufmax) { dst_data = dpy -> bufptr; } else { if ((dst_data = _XAllocScratch(dpy, dst_data_length)) == NULL) { #ifdef PANIC fprintf(stderr, "******NXSetUnpackColormapCompat: PANIC! Cannot allocate memory.\n"); #endif UnGetReq(NXSetUnpackColormapCompat); UnlockDisplay(dpy); return -1; } } memcpy(dst_data, data, entries << 2); #ifdef DUMP fprintf(stderr, "******NXSetUnpackColormapCompat: Dumping colormap entries:\n"); for (i = 0; i < entries; i++) { fprintf(stderr, "******NXSetUnpackColormapCompat: [%d] -> [0x%x].\n", i, *((int *) (dst_data + (i * 4)))); } #endif if (dst_data == dpy -> bufptr) { dpy -> bufptr += dst_data_length; } else { _XSend(dpy, dst_data, dst_data_length); } } UnlockDisplay(dpy); SyncHandle(); return 1; } #define sz_xNXSetUnpackAlphaCompatReq 8 typedef struct _NXSetUnpackAlphaCompatReq { CARD8 reqType; CARD8 resource; CARD16 length B16; CARD32 entries B32; } xNXSetUnpackAlphaCompatReq; #define X_NXSetUnpackAlphaCompat X_NXSetUnpackAlpha int NXSetUnpackAlphaCompat(Display *dpy, unsigned int resource, unsigned int entries, const char *data) { register xNXSetUnpackAlphaCompatReq *req; register char *dst_data; register unsigned int dst_data_length; #ifdef DUMP int i; #endif LockDisplay(dpy); GetReq(NXSetUnpackAlphaCompat, req); req -> resource = resource; req -> entries = entries; dst_data_length = ROUNDUP(entries, 4); req -> length += (dst_data_length >> 2); #ifdef TEST fprintf(stderr, "******NXSetUnpackAlphaCompat: Resource [%u] number of entries [%u] " "destination data size [%u].\n", resource, entries, dst_data_length); #endif if (entries > 0) { if ((dpy -> bufptr + dst_data_length) <= dpy -> bufmax) { dst_data = dpy -> bufptr; } else { if ((dst_data = _XAllocScratch(dpy, dst_data_length)) == NULL) { #ifdef PANIC fprintf(stderr, "******NXSetUnpackAlphaCompat: PANIC! Cannot allocate memory.\n"); #endif UnGetReq(NXSetUnpackAlphaCompat); UnlockDisplay(dpy); return -1; } } memcpy(dst_data, data, entries); if (dst_data_length != entries) { memset(dst_data + entries, 0, dst_data_length - entries); } #ifdef DUMP fprintf(stderr, "******NXSetUnpackAlphaCompat: Dumping alpha channel data:\n"); for (i = 0; i < dst_data_length; i++) { fprintf(stderr, "******NXSetUnpackAlphaCompat: [%d] -> [0x%02x].\n", i, ((unsigned int) *(dst_data + i)) & 0xff); } #endif if (dst_data == dpy -> bufptr) { dpy -> bufptr += dst_data_length; } else { _XSend(dpy, dst_data, dst_data_length); } } UnlockDisplay(dpy); SyncHandle(); return 1; } /* * Free any geometry, colormap and alpha channel * data stored by the remote proxy to unpack the * image. Resource, as usual, must be a value * between 0 and 255. */ int NXFreeUnpack(Display *dpy, unsigned int resource) { register xNXFreeUnpackReq *req; if (_NXUnpackResources[resource] != 0) { LockDisplay(dpy); GetReq(NXFreeUnpack, req); #ifdef TEST fprintf(stderr, "******NXFreeUnpack: Sending message opcode [%d] with resource [%u].\n", X_NXFreeUnpack, resource); #endif req -> resource = resource; UnlockDisplay(dpy); SyncHandle(); #ifdef TEST fprintf(stderr, "******NXFreeUnpack: Making the resource [%u] newly available.\n", resource); #endif _NXUnpackResources[resource] = 0; } #ifdef TEST else { fprintf(stderr, "******NXFreeUnpack: Nothing to do for resource [%u].\n", resource); } #endif return 1; } /* * Wrapper of XCreateImage(). Note that we use offset * field of XImage to store size of source image in * packed format. Note also that method is currently * not stored in the NXignored. */ NXPackedImage *NXCreatePackedImage(Display *dpy, Visual *visual, unsigned int method, unsigned int depth, int format, char *data, int data_length, unsigned int width, unsigned int height, int bitmap_pad, int bytes_per_line) { XImage* image; image = XCreateImage(dpy, visual, depth, format, 0, data, width, height, bitmap_pad, bytes_per_line); if (image != NULL) { image -> xoffset = data_length; } return (NXPackedImage *) image; } /* * Wrapper of XDestroyImage(). */ int NXDestroyPackedImage(NXPackedImage *image) { return XDestroyImage((XImage *) image); } /* * Clean the image data directly in the current buffer. */ int NXCleanImage(XImage *image) { #ifdef TEST fprintf(stderr, "******NXCleanImage: Cleaning image with format [%d] depth [%d] " "bits per pixel [%d].\n", image -> format, image -> depth, image -> bits_per_pixel); #endif if (image -> format == ZPixmap) { if (image -> depth == 1) { return CleanXYImage(image); } else { return CleanZImage(image); } } else { return CleanXYImage(image); } } NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method) { XImage *dst_image; const ColorMask *mask; unsigned int dst_data_size; unsigned int dst_packed_data_size; unsigned int dst_bits_per_pixel; unsigned int dst_packed_bits_per_pixel; #ifdef TEST fprintf(stderr, "******NXPackImage: Going to pack a new image with method [%d].\n", method); #endif /* * Get the mask out of the method and * check if the visual is supported by * the color reduction algorithm. */ mask = MethodColorMask(method); if (mask == NULL) { #ifdef PANIC fprintf(stderr, "******NXPackImage: WARNING! No mask to apply for pack method [%d].\n", method); #endif return NULL; } else if (CanMaskImage(src_image, mask) == 0) { #ifdef PANIC fprintf(stderr, "******NXPackImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", src_image -> format, src_image -> depth, src_image -> bits_per_pixel); fprintf(stderr, "******NXPackImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", src_image -> red_mask, src_image -> green_mask, src_image -> blue_mask); #endif return NULL; } /* * Create a destination image from * source and apply the color mask. */ if ((dst_image = (XImage *) malloc(sizeof(XImage))) == NULL) { #ifdef PANIC fprintf(stderr, "******NXPackImage: PANIC! Cannot allocate [%d] bytes for the image.\n", (int) sizeof(XImage)); #endif return NULL; } *dst_image = *src_image; #ifdef TEST fprintf(stderr, "******NXPackImage: Source width [%d], bytes per line [%d] with depth [%d].\n", src_image -> width, src_image -> bytes_per_line, src_image -> depth); #endif dst_data_size = src_image -> bytes_per_line * src_image -> height; dst_image -> data = malloc(dst_data_size); if (dst_image -> data == NULL) { #ifdef PANIC fprintf(stderr, "******NXPackImage: PANIC! Cannot allocate [%d] bytes for masked image data.\n", dst_data_size); #endif free(dst_image); return NULL; } /* * If the pixel resulting from the mask * needs more bits than available, then * just clean the padding bits in the * image. */ dst_bits_per_pixel = dst_image -> bits_per_pixel; dst_packed_bits_per_pixel = MethodBitsPerPixel(method); #ifdef TEST fprintf(stderr, "******NXPackImage: Destination depth [%d], bits per pixel [%d], packed bits per pixel [%d].\n", dst_image -> depth, dst_bits_per_pixel, dst_packed_bits_per_pixel); #endif if (dst_packed_bits_per_pixel > dst_bits_per_pixel || ShouldMaskImage(src_image, mask) == 0) { /* * Should use the same data for source * and destination to avoid the memcpy. */ if (CopyAndCleanImage(src_image, dst_image) <= 0) { #ifdef PANIC fprintf(stderr, "******NXPackImage: PANIC! Failed to clean the image.\n"); #endif free(dst_image -> data); free(dst_image); return NULL; } } else if (MaskImage(mask, src_image, dst_image) <= 0) { #ifdef PANIC fprintf(stderr, "******NXPackImage: PANIC! Failed to apply the color mask.\n"); #endif free(dst_image -> data); free(dst_image); return NULL; } /* * Let's pack the same pixels in fewer bytes. * Note that we save a new memory allocation * by using the same image as source and des- * tination. This means that PackImage() must * be able to handle ovelapping areas. */ #ifdef TEST fprintf(stderr, "******NXPackImage: Plain bits per pixel [%d], data size [%d].\n", dst_bits_per_pixel, dst_data_size); #endif dst_packed_data_size = dst_data_size * dst_packed_bits_per_pixel / dst_bits_per_pixel; #ifdef TEST fprintf(stderr, "******NXPackImage: Packed bits per pixel [%d], data size [%d].\n", dst_packed_bits_per_pixel, dst_packed_data_size); #endif if (PackImage(method, dst_data_size, dst_image, dst_packed_data_size, dst_image) <= 0) { #ifdef PANIC fprintf(stderr, "******NXPackImage: PANIC! Failed to pack image from [%d] to [%d] bits per pixel.\n", dst_bits_per_pixel, dst_packed_bits_per_pixel); #endif free(dst_image -> data); free(dst_image); return NULL; } /* * Save data size in xoffset field * to comply with NX packed images. */ dst_image -> xoffset = dst_packed_data_size; return dst_image; } /* * NXInPlacePackImage creates a NXPackedImage * from a XImage, sharing the same data buffer. * Is up to the caller to free the data buffer * only once. */ XImage *NXInPlacePackImage(Display *dpy, XImage *src_image, unsigned int method) { XImage *dst_image; const ColorMask *mask; unsigned int dst_data_size; unsigned int dst_packed_data_size; unsigned int dst_bits_per_pixel; unsigned int dst_packed_bits_per_pixel; #ifdef TEST fprintf(stderr, "******NXInPlacePackImage: Going to pack a new image with method [%d].\n", method); #endif /* * Get mask out of method and check if * visual is supported by current color * reduction algorithm. */ mask = MethodColorMask(method); if (mask == NULL) { #ifdef PANIC fprintf(stderr, "******NXInPlacePackImage: WARNING! No mask to apply for pack method [%d].\n", method); #endif return NULL; } else if (CanMaskImage(src_image, mask) == 0) { #ifdef PANIC fprintf(stderr, "******NXInPlacePackImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", src_image -> format, src_image -> depth, src_image -> bits_per_pixel); fprintf(stderr, "******NXInPlacePackImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", src_image -> red_mask, src_image -> green_mask, src_image -> blue_mask); #endif return NULL; } /* * Create a destination image from * source and apply the color mask. */ if ((dst_image = (XImage *) malloc(sizeof(XImage))) == NULL) { #ifdef PANIC fprintf(stderr, "******NXInPlacePackImage: PANIC! Cannot allocate [%d] bytes for the image.\n", (int) sizeof(XImage)); #endif return NULL; } *dst_image = *src_image; #ifdef TEST fprintf(stderr, "******NXInPlacePackImage: Source width [%d], bytes per line [%d] with depth [%d].\n", src_image -> width, src_image -> bytes_per_line, src_image -> depth); #endif dst_data_size = src_image -> bytes_per_line * src_image -> height; dst_image -> data = src_image -> data; /* * If pixel resulting from mask needs * more bits than available, then just * clean the pad bits in image. */ dst_bits_per_pixel = dst_image -> bits_per_pixel; dst_packed_bits_per_pixel = MethodBitsPerPixel(method); #ifdef TEST fprintf(stderr, "******NXInPlacePackImage: Destination depth [%d], bits per pixel [%d], packed bits per pixel [%d].\n", dst_image -> depth, dst_bits_per_pixel, dst_packed_bits_per_pixel); #endif if (dst_packed_bits_per_pixel > dst_bits_per_pixel || ShouldMaskImage(src_image, mask) == 0) { #ifdef TEST fprintf(stderr, "******NXInPlacePackImage: Just clean image packed_bits_per_pixel[%d], bits_per_pixel[%d].\n", dst_packed_bits_per_pixel, dst_bits_per_pixel); #endif if (NXCleanImage(dst_image) <= 0) { #ifdef PANIC fprintf(stderr, "******NXInPlacePackImage: PANIC! Failed to clean the image.\n"); #endif free(dst_image); return NULL; } } else if (MaskInPlaceImage(mask, dst_image) <= 0) { #ifdef PANIC fprintf(stderr, "******NXInPlacePackImage: PANIC! Failed to apply the color mask.\n"); #endif free(dst_image); return NULL; } /* * Let's pack the same pixels in fewer bytes. * Note that we save a new memory allocation * by using the same image as source and des- * tination. This means that PackImage() must * be able to handle ovelapping areas. */ #ifdef TEST fprintf(stderr, "******NXInPlacePackImage: Plain bits per pixel [%d], data size [%d].\n", dst_bits_per_pixel, dst_data_size); #endif dst_packed_data_size = dst_data_size * dst_packed_bits_per_pixel / dst_bits_per_pixel; #ifdef TEST fprintf(stderr, "******NXInPlacePackImage: Packed bits per pixel [%d], data size [%d].\n", dst_packed_bits_per_pixel, dst_packed_data_size); #endif /* * Save data size in xoffset field * to comply with NX packed images. */ dst_image -> xoffset = dst_packed_data_size; return dst_image; } int NXPutPackedImage(Display *dpy, unsigned int resource, Drawable drawable, void *gc, NXPackedImage *image, unsigned int method, unsigned int depth, int src_x, int src_y, int dst_x, int dst_y, unsigned int width, unsigned int height) { register xNXPutPackedImageReq *req; register unsigned int src_data_length; register unsigned int dst_data_length; LockDisplay(dpy); FlushGC(dpy, (GC) gc); GetReq(NXPutPackedImage, req); req -> resource = resource; req -> drawable = drawable; req -> gc = ((GC) gc) -> gid; #ifdef TEST fprintf(stderr, "******NXPutPackedImage: Image resource [%d] drawable [%d] gc [%d].\n", req -> resource, (int) req -> drawable, (int) req -> gc); #endif /* * There is no leftPad field in request. We only * support a leftPad of 0. Anyway, X imposes a * leftPad of 0 in case of ZPixmap format. */ req -> format = image -> format; /* * Source depth, as well as width and height, * are taken from the image structure. */ req -> srcDepth = image -> depth; req -> srcX = src_x; req -> srcY = src_y; req -> srcWidth = image -> width; req -> srcHeight = image -> height; /* * The destination depth is provided * by the caller. */ req -> dstDepth = depth; req -> dstX = dst_x; req -> dstY = dst_y; req -> dstWidth = width; req -> dstHeight = height; req -> method = method; #ifdef TEST fprintf(stderr, "******NXPutPackedImage: Source image depth [%d] destination depth [%d] " "method [%d].\n", req -> srcDepth, req -> dstDepth, req -> method); #endif /* * Source data length is the size of image in packed format, * as stored in xoffset field of XImage. Destination data * size is calculated according to bytes per line of target * image, so the caller must provide the right depth at the * time XImage structure is created. */ req -> srcLength = image -> xoffset; if (image -> width == (int) width && image -> height == (int) height) { req -> dstLength = image -> bytes_per_line * image -> height; } else if (image -> format == ZPixmap) { req -> dstLength = ROUNDUP((image -> bits_per_pixel * width), image -> bitmap_pad) * height >> 3; } else { req -> dstLength = ROUNDUP(width, image -> bitmap_pad) * height >> 3; } src_data_length = image -> xoffset; dst_data_length = ROUNDUP(src_data_length, 4); #ifdef TEST fprintf(stderr, "******NXPutPackedImage: Source data length [%d] request data length [%d].\n", src_data_length, dst_data_length); #endif req -> length += (dst_data_length >> 2); if (src_data_length > 0) { if (dpy -> bufptr + dst_data_length <= dpy -> bufmax) { /* * Clean the padding bytes in the request. */ *((int *) (dpy -> bufptr + dst_data_length - 4)) = 0x0; memcpy(dpy -> bufptr, image -> data, src_data_length); dpy -> bufptr += dst_data_length; } else { /* * The _XSend() will pad the request for us. */ _XSend(dpy, image -> data, src_data_length); } } UnlockDisplay(dpy); SyncHandle(); return 1; } int NXAllocColors(Display *dpy, Colormap colormap, unsigned int entries, XColor screens_in_out[], Bool results_in_out[]) { Status result = 0; xAllocColorReply rep; register xAllocColorReq *req; Bool alloc_error = False; register unsigned int i; LockDisplay(dpy); for (i = 0; i < entries; i++) { GetReq(AllocColor, req); req -> cmap = colormap; req -> red = screens_in_out[i].red; req -> green = screens_in_out[i].green; req -> blue = screens_in_out[i].blue; } for (i = 0; i < entries; i++) { result = _XReply(dpy, (xReply *) &rep, 0, xTrue); if (result) { screens_in_out[i].pixel = rep.pixel; screens_in_out[i].red = rep.red; screens_in_out[i].green = rep.green; screens_in_out[i].blue = rep.blue; results_in_out[i] = True; } else { results_in_out[i] = False; alloc_error = True; } } UnlockDisplay(dpy); SyncHandle(); return (alloc_error == False); } char *NXEncodeColormap(const char *src_data, unsigned int src_size, unsigned int *dst_size) { return ColormapCompressData(src_data, src_size, dst_size); } char *NXEncodeAlpha(const char *src_data, unsigned int src_size, unsigned int *dst_size) { return AlphaCompressData(src_data, src_size, dst_size); } NXPackedImage *NXEncodeRgb(XImage *src_image, unsigned int method, unsigned int quality) { NXPackedImage *dst_image = NULL; unsigned int dst_size; /* * Create a new image structure as a copy * of the source. */ if ((dst_image = (NXPackedImage *) malloc(sizeof(NXPackedImage))) == NULL) { #ifdef PANIC fprintf(stderr, "******NXEncodeRgb: PANIC! Cannot allocate [%d] bytes for the image.\n", (int) sizeof(XImage)); #endif return NULL; } *dst_image = *src_image; dst_image -> data = RgbCompressData(src_image, &dst_size); if (dst_image -> data == NULL) { #ifdef PANIC fprintf(stderr, "******NXEncodeRgb: PANIC! Rgb compression failed.\n"); #endif free(dst_image); return NULL; } /* * Store the Rgb size in the xoffset field. */ dst_image -> xoffset = dst_size; return dst_image; } NXPackedImage *NXEncodeRle(XImage *src_image, unsigned int method, unsigned int quality) { NXPackedImage *dst_image = NULL; unsigned int dst_size; /* * Create a new image structure as a copy * of the source. */ if ((dst_image = (NXPackedImage *) malloc(sizeof(NXPackedImage))) == NULL) { #ifdef PANIC fprintf(stderr, "******NXEncodeRle: PANIC! Cannot allocate [%d] bytes for the image.\n", (int) sizeof(XImage)); #endif return NULL; } *dst_image = *src_image; dst_image -> data = RleCompressData(src_image, &dst_size); if (dst_image -> data == NULL) { #ifdef PANIC fprintf(stderr, "******NXEncodeRle: PANIC! Rle compression failed.\n"); #endif free(dst_image); return NULL; } /* * Store the Rle size in the xoffset field. */ dst_image -> xoffset = dst_size; return dst_image; } NXPackedImage *NXEncodeBitmap(XImage *src_image, unsigned int method, unsigned int quality) { NXPackedImage *dst_image = NULL; unsigned int dst_size; /* * Create a new image structure as a copy * of the source. */ if ((dst_image = (NXPackedImage *) malloc(sizeof(NXPackedImage))) == NULL) { #ifdef PANIC fprintf(stderr, "******NXEncodeBitmap: PANIC! Cannot allocate [%d] bytes for the image.\n", (int) sizeof(XImage)); #endif return NULL; } *dst_image = *src_image; dst_image -> data = BitmapCompressData(src_image, &dst_size); if (dst_image -> data == NULL) { #ifdef PANIC fprintf(stderr, "******NXEncodeBitmap: PANIC! Bitmap compression failed.\n"); #endif free(dst_image); return NULL; } /* * Store the bitmap size in the xoffset field. */ dst_image -> xoffset = dst_size; return dst_image; } NXPackedImage *NXEncodeJpeg(XImage *src_image, unsigned int method, unsigned int quality) { NXPackedImage *dst_image = NULL; int size; /* * Check if the bpp of the image is valid * for the Jpeg compression. */ if (src_image -> bits_per_pixel < 15) { #ifdef PANIC fprintf(stderr, "******NXEncodeJpeg: PANIC! Invalid bpp for Jpeg compression [%d]\n.", src_image -> bits_per_pixel); #endif return NULL; } /* * Create the destination image as a copy * of the source. */ if ((dst_image = (NXPackedImage *) malloc(sizeof(NXPackedImage))) == NULL) { #ifdef PANIC fprintf(stderr, "******NXEncodeJpeg: PANIC! Cannot allocate [%d] bytes for the Jpeg image.\n", (int) sizeof(NXPackedImage)); #endif return NULL; } *dst_image = *src_image; dst_image -> data = JpegCompressData(src_image, quality, &size); if (dst_image -> data == NULL) { #ifdef PANIC fprintf(stderr, "******NXEncodeJpeg: PANIC! Jpeg compression failed.\n"); #endif free(dst_image); return NULL; } /* * Store the Jpeg size in the xoffset field. */ dst_image -> xoffset = size; return dst_image; } NXPackedImage *NXEncodePng(XImage *src_image, unsigned int method, unsigned int quality) { NXPackedImage *dst_image = NULL; int size; /* * Check if the bpp of the image is valid * for png compression. */ if (src_image -> bits_per_pixel < 15) { #ifdef PANIC fprintf(stderr, "******NXEncodePng: PANIC! Invalid bpp for Png compression [%d].\n", src_image -> bits_per_pixel); #endif return NULL; } if ((dst_image = (NXPackedImage *) malloc(sizeof(NXPackedImage))) == NULL) { #ifdef PANIC fprintf(stderr, "******NXEncodePng: PANIC! Cannot allocate [%d] bytes for the Png image.\n", (int) sizeof(NXPackedImage)); #endif return NULL; } *dst_image = *src_image; dst_image -> data = PngCompressData(dst_image, &size); if (dst_image -> data == NULL) { #ifdef PANIC fprintf(stderr, "******NXEncodePng: PANIC! Png compression failed.\n"); #endif free(dst_image); return NULL; } /* * Store the Png size in the xoffset field. */ dst_image -> xoffset = size; return dst_image; } int NXEncodeColors(XImage *src_image, NXColorTable *color_table, int nb_max) { int x, y, t, p; long pixel; /* * We need a smarter way to extract * the colors from the image and * create a color table. */ memset(color_table, 0, nb_max * sizeof(NXColorTable)); for (x = 0, p = 0; x < src_image -> width; x++) { for (y = 0; y < src_image -> height; y++) { pixel = XGetPixel(src_image, x, y); for (t = 0; t < nb_max; t++) { if ( color_table[t].found == 0) { color_table[t].pixel = pixel; color_table[t].found = 1; p++; break; } else if ((color_table[t].pixel) == pixel) { break; } } if (p == nb_max) { return nb_max + 1; } } } return p; } void NXMaskImage(XImage *image, unsigned int method) { unsigned int maskMethod; const ColorMask *mask; /* * Choose the correct mask method */ switch(method) { case PACK_JPEG_8_COLORS: case PACK_PNG_8_COLORS: { maskMethod = MASK_8_COLORS; #ifdef DEBUG fprintf(stderr, "******NXMaskImage: Method is MASK_8_COLORS\n"); #endif break; } case PACK_JPEG_64_COLORS: case PACK_PNG_64_COLORS: { maskMethod = MASK_64_COLORS; #ifdef DEBUG fprintf(stderr, "******NXMaskImage: Method is MASK_64K_COLORS\n"); #endif break; } case PACK_JPEG_256_COLORS: case PACK_PNG_256_COLORS: { maskMethod = MASK_256_COLORS; #ifdef DEBUG fprintf(stderr, "******NXMaskImage: Method is MASK_256_COLORS\n"); #endif break; } case PACK_JPEG_512_COLORS: case PACK_PNG_512_COLORS: { maskMethod = MASK_512_COLORS; #ifdef DEBUG fprintf(stderr, "******NXMaskImage: Method is MASK_512K_COLORS\n"); #endif break; } case PACK_JPEG_4K_COLORS: case PACK_PNG_4K_COLORS: { maskMethod = MASK_4K_COLORS; #ifdef DEBUG fprintf(stderr, "******NXMaskImage: Method is MASK_4K_COLORS\n"); #endif break; } case PACK_JPEG_32K_COLORS: case PACK_PNG_32K_COLORS: { maskMethod = MASK_32K_COLORS; #ifdef DEBUG fprintf(stderr, "******NXMaskImage: Method is MASK_32K_COLORS\n"); #endif break; } case PACK_JPEG_64K_COLORS: case PACK_PNG_64K_COLORS: { maskMethod = MASK_64K_COLORS; #ifdef DEBUG fprintf(stderr, "******NXMaskImage: Method is MASK_64K_COLORS\n"); #endif break; } case PACK_JPEG_256K_COLORS: case PACK_PNG_256K_COLORS: { maskMethod = MASK_256K_COLORS; #ifdef DEBUG fprintf(stderr, "******NXMaskImage: Method is MASK_256K_COLORS\n"); #endif break; } case PACK_JPEG_2M_COLORS: case PACK_PNG_2M_COLORS: { maskMethod = MASK_2M_COLORS; #ifdef DEBUG fprintf(stderr, "******NXMaskImage: Method is MASK_2M_COLORS\n"); #endif break; } case PACK_JPEG_16M_COLORS: case PACK_PNG_16M_COLORS: { maskMethod = MASK_16M_COLORS; #ifdef DEBUG fprintf(stderr, "******NXMaskImage: Method is MASK_16M_COLORS\n"); #endif break; } default: { #ifdef PANIC fprintf(stderr, "******NXMaskImage: PANIC! Cannot find mask method for pack method [%d]\n", method); #endif return; } } #ifdef TEST fprintf(stderr, "******NXMaskImage: packMethod[%d] => maskMethod[%d]\n", method, maskMethod); #endif /* * Get mask out of method and check if * visual is supported by current color * reduction algorithm. */ mask = MethodColorMask(maskMethod); if (mask == NULL) { #ifdef PANIC fprintf(stderr, "******NXMaskImage: PANIC! No mask to apply for pack method [%d].\n", method); #endif return; } else if (CanMaskImage(image, mask) == 0) { #ifdef PANIC fprintf(stderr, "******NXMaskImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", image -> format, image -> depth, image -> bits_per_pixel); fprintf(stderr, "******NXMaskImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", image -> red_mask, image -> green_mask, image -> blue_mask); #endif return; } /* * Calling ShouldMaskImage you get 0 in the case * of MASK_256_COLORS and MASK_64K_COLORS, which * means that the image should not be masked. */ if (ShouldMaskImage(image, mask) == 0) { #ifdef TEST fprintf(stderr, "******NXMaskImage: the image will not be masked\n"); #endif } else { if (MaskInPlaceImage(mask, image) <= 0) { #ifdef PANIC fprintf(stderr, "******NXMaskImage: PANIC! Failed to apply the color mask in place.\n"); #endif } } } /* * The display parameter is ignored. */ void NXInitCache(Display *dpy, int entries) { if (NXImageCache != NULL && NXImageCacheSize == entries) { #ifdef DEBUG fprintf(stderr, "******NXInitCache: Nothing to do with image cache at [%p] and [%d] entries.\n", NXImageCache, NXImageCacheSize); #endif return; } #ifdef DEBUG fprintf(stderr, "******NXInitCache: Initializing the cache with [%d] entries.\n", entries); #endif NXImageCacheSize = 0; if (NXImageCache != NULL) { free(NXImageCache); NXImageCache = NULL; } if (entries > 0) { NXImageCache = malloc(entries * sizeof(_NXImageCacheEntry)); if (NXImageCache != NULL) { memset(NXImageCache, 0, entries * sizeof(_NXImageCacheEntry)); NXImageCacheSize = entries; #ifdef DEBUG fprintf(stderr, "******NXInitCache: Image cache initialized with [%d] entries.\n", entries); #endif } } } #ifdef DUMP void _NXCacheDump(const char *label) { char s[MD5_LENGTH * 2 + 1]; int i; int j; #ifdef DEBUG fprintf(stderr, "%s: Dumping the content of image cache:\n", label); #endif for (i = 0; i < NXImageCacheSize; i++) { if (NXImageCache[i].image == NULL) { break; } for (j = 0; j < MD5_LENGTH; j++) { sprintf(s + (j * 2), "%02X", ((unsigned char *) NXImageCache[i].md5)[j]); } #ifdef DEBUG fprintf(stderr, "%s: [%d][%s].\n", label, i, s); #endif } } #endif XImage *NXCacheFindImage(NXPackedImage *src_image, unsigned int *method, unsigned char **md5) { md5_state_t new_state; md5_byte_t *new_md5; unsigned int data_size, i; if (NXImageCache == NULL) { return NULL; } /* * Will return the allocated checksum * if the image is not found. */ *md5 = NULL; if ((new_md5 = malloc(MD5_LENGTH)) == NULL) { #ifdef PANIC fprintf(stderr, "******NXCacheFindImage: Can't allocate memory for the checksum.\n"); #endif return NULL; } data_size = (src_image -> bytes_per_line * src_image -> height); md5_init(&new_state); md5_append(&new_state, (unsigned char *) &src_image -> width, sizeof(int)); md5_append(&new_state, (unsigned char *) &src_image -> height, sizeof(int)); md5_append(&new_state, (unsigned char *) src_image -> data, data_size); md5_finish(&new_state, new_md5); for (i = 0; i < NXImageCacheSize; i++) { if (NXImageCache[i].image != NULL) { if (memcmp(NXImageCache[i].md5, new_md5, MD5_LENGTH) == 0) { _NXImageCacheEntry found; found.image = NXImageCache[i].image; found.method = NXImageCache[i].method; found.md5 = NXImageCache[i].md5; *method = found.method; NXImageCacheHits++; #ifdef DEBUG fprintf(stderr, "******NXCacheFindImage: Found at position [%d] with hits [%d] and [%d] packs.\n", i, NXImageCacheHits, NXImageCacheOps); #endif free(new_md5); /* * Move the images down one slot, from * the head of the list, and place the * image just found at top. */ if (i > 16) { #ifdef DEBUG fprintf(stderr, "******NXCacheFindImage: Moving the image at the head of the list.\n"); #endif memmove(&NXImageCache[1], &NXImageCache[0], (i * sizeof(_NXImageCacheEntry))); NXImageCache[0].image = found.image; NXImageCache[0].method = found.method; NXImageCache[0].md5 = found.md5; #ifdef DUMP _NXCacheDump("******NXCacheFindImage"); #endif } /* * Return the checksum and image * structure allocated in cache. */ *md5 = found.md5; return found.image; } } else { break; } } *md5 = new_md5; return NULL; } /* * Add a packed image to the cache. A new image * structure is allocated and copied, data and * checksum are inherited from the passed image. */ int NXCacheAddImage(NXPackedImage *image, unsigned int method, unsigned char *md5) { unsigned int i; if (image == NULL || image -> data == NULL) { #ifdef PANIC fprintf(stderr, "******NXCacheAddImage: PANIC! Invalid image passed to function.\n"); #endif return -1; } i = (NXImageCacheOps < NXImageCacheSize) ? NXImageCacheOps : NXImageCacheSize; if (NXImageCacheOps >= NXImageCacheSize) { #ifdef DEBUG fprintf(stderr, "******NXCacheAddImage: Freeing up the oldest entry.\n"); #endif i--; free(NXImageCache[NXImageCacheSize - 1].image -> data); free(NXImageCache[NXImageCacheSize - 1].image); free(NXImageCache[NXImageCacheSize - 1].md5); } if (i > 0) { memmove(&NXImageCache[1], &NXImageCache[0], i * sizeof(_NXImageCacheEntry)); } NXImageCacheOps++; #ifdef DEBUG fprintf(stderr, "******NXCacheAddImage: Going to add new image with data size [%d].\n", image -> xoffset); #endif NXImageCache[0].image = image; NXImageCache[0].method = method; NXImageCache[0].md5 = md5; #ifdef DUMP _NXCacheDump("******NXCacheAddImage"); #endif return 1; } /* * The display parameter is ignored. */ void NXFreeCache(Display *dpy) { int i; if (NXImageCache == NULL) { #ifdef DEBUG fprintf(stderr, "******NXFreeCache: Nothing to do with a null image cache.\n"); #endif return; } #ifdef DEBUG fprintf(stderr, "******NXFreeCache: Freeing the cache with [%d] entries.\n", NXImageCacheSize); #endif for (i = 0; i < NXImageCacheSize; i++) { if (NXImageCache[i].image != NULL) { if (NXImageCache[i].image -> data != NULL) { free(NXImageCache[i].image -> data); } free(NXImageCache[i].image); NXImageCache[i].image = NULL; } if (NXImageCache[i].md5 != NULL) { free(NXImageCache[i].md5); NXImageCache[i].md5 = NULL; } } free(NXImageCache); NXImageCache = NULL; NXImageCacheSize = 0; NXImageCacheHits = 0; NXImageCacheOps = 0; } static void _NXNotifyImage(Display *dpy, int resource, Bool success) { XEvent async_event; /* * Enqueue an event to tell client * the result of GetImage. */ async_event.type = ClientMessage; async_event.xclient.serial = _NXCollectedImages[resource] -> sequence; async_event.xclient.window = 0; async_event.xclient.message_type = 0; async_event.xclient.format = 32; async_event.xclient.data.l[0] = NXCollectImageNotify; async_event.xclient.data.l[1] = resource; async_event.xclient.data.l[2] = success; XPutBackEvent(dpy, &async_event); } static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, int len, XPointer data) { register _NXCollectImageState *state; register xGetImageReply *async_rep; char *async_head; char *async_data; int async_size; state = (_NXCollectImageState *) data; if ((rep -> generic.sequenceNumber % 65536) != ((int)(state -> sequence) % 65536)) { #ifdef TEST fprintf(stderr, "******_NXCollectImageHandler: Unmatched sequence [%d] for opcode [%d] " "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, (int) rep -> generic.length << 2); #endif return False; } #ifdef TEST fprintf(stderr, "******_NXCollectImageHandler: Going to handle asynchronous GetImage reply.\n"); #endif /* * As even reply data is managed asynchronously, * we can use state to get to vector and vector * to get to handler. In this way, we can safely * dequeue and free the handler itself. */ DeqAsyncHandler(dpy, state -> handler); free(state -> handler); state -> handler = NULL; if (rep -> generic.type == X_Error) { #ifdef TEST fprintf(stderr, "******_NXCollectImageHandler: Error received from X server for resource [%d].\n", state -> resource); #endif _NXNotifyImage(dpy, state -> resource, False); _NXCollectedImages[state -> resource] = NULL; free(state); return False; } #ifdef TEST fprintf(stderr, "******_NXCollectImageHandler: Matched request with sequence [%ld].\n", state -> sequence); #endif async_size = SIZEOF(xGetImageReply); async_head = malloc(async_size); if (async_head == NULL) { #ifdef PANIC fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to allocate memory with resource [%d].\n", state -> resource); #endif _NXNotifyImage(dpy, state -> resource, False); _NXCollectedImages[state -> resource] = NULL; free(state); return False; } #ifdef TEST fprintf(stderr, "******_NXCollectImageHandler: Going to get reply with size [%d].\n", (int) rep -> generic.length << 2); #endif async_rep = (xGetImageReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); if (async_rep == NULL) { #ifdef PANIC fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to get reply with resource [%d].\n", state -> resource); #endif _NXNotifyImage(dpy, state -> resource, False); _NXCollectedImages[state -> resource] = NULL; free(state); free(async_head); return False; } #ifdef TEST fprintf(stderr, "******_NXCollectImageHandler: Got reply with depth [%d] visual [%d] size [%d].\n", async_rep -> depth, (int) async_rep -> visual, (int) async_rep -> length << 2); #endif async_size = async_rep -> length << 2; if (async_size > 0) { async_data = malloc(async_size); if (async_data == NULL) { #ifdef PANIC fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to allocate memory with resource [%d].\n", state -> resource); #endif _NXNotifyImage(dpy, state -> resource, False); _NXCollectedImages[state -> resource] = NULL; free(state); free(async_head); return False; } #ifdef TEST fprintf(stderr, "******_NXCollectImageHandler: Going to get data with size [%d].\n", async_size); #endif _XGetAsyncData(dpy, async_data, buf, len, SIZEOF(xGetImageReply), async_size, async_size); /* * From now on we can return True, as all * data has been consumed from buffer. */ if (state -> format == XYPixmap) { unsigned long depth = DepthOnes(state -> mask & (((unsigned long)0xFFFFFFFF) >> (32 - async_rep -> depth))); state -> image = XCreateImage(dpy, _XVIDtoVisual(dpy, async_rep -> visual), depth, XYPixmap, 0, async_data, state -> width, state -> height, dpy -> bitmap_pad, 0); } else { state -> image = XCreateImage(dpy, _XVIDtoVisual(dpy, async_rep -> visual), async_rep -> depth, ZPixmap, 0, async_data, state -> width, state -> height, _XGetScanlinePad(dpy, async_rep -> depth), 0); } if (state -> image == NULL) { #ifdef PANIC fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to create image for resource [%d].\n", state -> resource); #endif _NXNotifyImage(dpy, state -> resource, False); _NXCollectedImages[state -> resource] = NULL; free(state); free(async_head); free(async_data); return True; } #ifdef TEST fprintf(stderr, "******_NXCollectImageHandler: Successfully stored image data for resource [%d].\n", state -> resource); #endif } #ifdef WARNING else { fprintf(stderr, "******_NXCollectImageHandler: WARNING! Null image data stored for resource [%d].\n", state -> resource); } #endif _NXNotifyImage(dpy, state -> resource, True); free(async_head); return True; } int NXGetCollectImageResource(Display *dpy) { int i; for (i = 0; i < NXNumberOfResources; i++) { if (_NXCollectedImages[i] == NULL) { return i; } } return -1; } int NXCollectImage(Display *dpy, unsigned int resource, Drawable drawable, int src_x, int src_y, unsigned int width, unsigned int height, unsigned long plane_mask, int format) { register xGetImageReq *req; _NXCollectImageState *state; _XAsyncHandler *handler; if (resource >= NXNumberOfResources) { #ifdef PANIC fprintf(stderr, "******NXCollectImage: PANIC! Provided resource [%u] is out of range.\n", resource); #endif return -1; } state = _NXCollectedImages[resource]; if (state != NULL) { #ifdef PANIC fprintf(stderr, "******NXCollectImage: PANIC! Having to remove previous state for resource [%u].\n", resource); #endif if (state -> handler != NULL) { DeqAsyncHandler(dpy, state -> handler); free(state -> handler); } if (state -> image != NULL) { XDestroyImage(state -> image); } free(state); _NXCollectedImages[resource] = NULL; } LockDisplay(dpy); GetReq(GetImage, req); req -> format = format; req -> drawable = drawable; req -> x = src_x; req -> y = src_y; req -> width = width; req -> height = height; req -> planeMask = plane_mask; #ifdef TEST fprintf(stderr, "******NXCollectImage: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", X_GetImage, dpy -> request, resource); fprintf(stderr, "******NXCollectImage: Format [%d] drawable [%d] src_x [%d] src_y [%d].\n", req -> format, (int) req -> drawable, req -> x, req -> y); fprintf(stderr, "******NXCollectImage: Width [%d] height [%d] plane_mask [%x].\n", req -> width, req -> height, (int) req -> planeMask); #endif state = malloc(sizeof(_NXCollectImageState)); handler = malloc(sizeof(_XAsyncHandler)); if (state == NULL || handler == NULL) { #ifdef PANIC fprintf(stderr, "******NXCollectImage: PANIC! Failed to allocate memory with resource [%d].\n", resource); #endif UnGetReq(GetImage); if (state != NULL) { free(state); } if (handler != NULL) { free(handler); } UnlockDisplay(dpy); return -1; } state -> sequence = dpy -> request; state -> resource = resource; state -> mask = plane_mask; state -> format = format; state -> width = width; state -> height = height; state -> image = NULL; state -> handler = handler; handler -> next = dpy -> async_handlers; handler -> handler = _NXCollectImageHandler; handler -> data = (XPointer) state; dpy -> async_handlers = handler; _NXCollectedImages[resource] = state; UnlockDisplay(dpy); SyncHandle(); return 1; } int NXGetCollectedImage(Display *dpy, unsigned int resource, XImage **image) { register _NXCollectImageState *state; state = _NXCollectedImages[resource]; if (state == NULL) { #ifdef PANIC fprintf(stderr, "******NXGetCollectedImage: PANIC! No image collected for resource [%u].\n", resource); #endif return 0; } _NXCollectedImages[resource] = NULL; *image = state -> image; free(state); #ifdef TEST fprintf(stderr, "******NXGetCollectedImage: Returning GetImage data for resource [%u].\n", resource); #endif return 1; } static void _NXNotifyProperty(Display *dpy, int resource, Bool success) { XEvent async_event; /* * Enqueue an event to tell client * the result of GetProperty. */ async_event.type = ClientMessage; async_event.xclient.serial = _NXCollectedProperties[resource] -> sequence; async_event.xclient.window = 0; async_event.xclient.message_type = 0; async_event.xclient.format = 32; async_event.xclient.data.l[0] = NXCollectPropertyNotify; async_event.xclient.data.l[1] = resource; async_event.xclient.data.l[2] = success; XPutBackEvent(dpy, &async_event); } static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, int len, XPointer data) { register _NXCollectPropertyState *state; register xGetPropertyReply *async_rep; char *async_head; char *async_data; int async_size; state = (_NXCollectPropertyState *) data; if ((rep -> generic.sequenceNumber % 65536) != ((int)(state -> sequence) % 65536)) { #ifdef TEST fprintf(stderr, "******_NXCollectPropertyHandler: Unmatched sequence [%d] for opcode [%d] " "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, (int) rep -> generic.length << 2); #endif return False; } #ifdef TEST fprintf(stderr, "******_NXCollectPropertyHandler: Going to handle asynchronous GetProperty reply.\n"); #endif /* * Reply data is managed asynchronously. We can * use state to get to vector and vector to get * to handler. In this way, we can dequeue and * free the handler itself. */ DeqAsyncHandler(dpy, state -> handler); free(state -> handler); state -> handler = NULL; if (rep -> generic.type == X_Error) { #ifdef TEST fprintf(stderr, "******_NXCollectPropertyHandler: Error received from X server for resource [%d].\n", state -> resource); #endif _NXNotifyProperty(dpy, state -> resource, False); _NXCollectedProperties[state -> resource] = NULL; free(state); return False; } #ifdef TEST fprintf(stderr, "******_NXCollectPropertyHandler: Matched request with sequence [%ld].\n", state -> sequence); #endif async_size = SIZEOF(xGetPropertyReply); async_head = malloc(async_size); if (async_head == NULL) { #ifdef PANIC fprintf(stderr, "******_NXCollectPropertyHandler: PANIC! Failed to allocate memory with resource [%d].\n", state -> resource); #endif _NXNotifyProperty(dpy, state -> resource, False); _NXCollectedProperties[state -> resource] = NULL; free(state); return False; } #ifdef TEST fprintf(stderr, "******_NXCollectPropertyHandler: Going to get reply with size [%d].\n", (int) rep -> generic.length << 2); #endif async_rep = (xGetPropertyReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); if (async_rep == NULL) { #ifdef PANIC fprintf(stderr, "******_NXCollectPropertyHandler: PANIC! Failed to get reply with resource [%d].\n", state -> resource); #endif _NXNotifyProperty(dpy, state -> resource, False); _NXCollectedProperties[state -> resource] = NULL; free(state); free(async_head); return False; } #ifdef TEST fprintf(stderr, "******_NXCollectPropertyHandler: Got reply with format [%d] type [%d] size [%d].\n", async_rep -> format, (int) async_rep -> propertyType, (int) async_rep -> length << 2); fprintf(stderr, "******_NXCollectPropertyHandler: Bytes after [%d] number of items [%d].\n", (int) async_rep -> bytesAfter, (int) async_rep -> nItems); #endif state -> format = async_rep -> format; state -> type = async_rep -> propertyType; state -> items = async_rep -> nItems; state -> after = async_rep -> bytesAfter; async_size = async_rep -> length << 2; if (async_size > 0) { async_data = malloc(async_size); if (async_data == NULL) { #ifdef PANIC fprintf(stderr, "******_NXCollectPropertyHandler: PANIC! Failed to allocate memory with resource [%d].\n", state -> resource); #endif _NXNotifyProperty(dpy, state -> resource, False); _NXCollectedProperties[state -> resource] = NULL; free(state); free(async_head); return False; } #ifdef TEST fprintf(stderr, "******_NXCollectPropertyHandler: Going to get data with size [%d].\n", async_size); #endif _XGetAsyncData(dpy, async_data, buf, len, SIZEOF(xGetPropertyReply), async_size, async_size); /* * From now on we can return True, as all * data has been consumed from buffer. */ state -> data = async_data; #ifdef TEST fprintf(stderr, "******_NXCollectPropertyHandler: Successfully stored property data for resource [%d].\n", state -> resource); #endif } #ifdef TEST else { fprintf(stderr, "******_NXCollectPropertyHandler: WARNING! Null property data stored for resource [%d].\n", state -> resource); } #endif _NXNotifyProperty(dpy, state -> resource, True); free(async_head); return True; } int NXGetCollectPropertyResource(Display *dpy) { int i; for (i = 0; i < NXNumberOfResources; i++) { if (_NXCollectedProperties[i] == NULL) { return i; } } return -1; } int NXCollectProperty(Display *dpy, unsigned int resource, Window window, Atom property, long long_offset, long long_length, Bool delete, Atom req_type) { register xGetPropertyReq *req; _NXCollectPropertyState *state; _XAsyncHandler *handler; if (resource >= NXNumberOfResources) { #ifdef PANIC fprintf(stderr, "******NXCollectProperty: PANIC! Provided resource [%u] is out of range.\n", resource); #endif return -1; } state = _NXCollectedProperties[resource]; if (state != NULL) { #ifdef PANIC fprintf(stderr, "******NXCollectProperty: PANIC! Having to remove previous state for resource [%u].\n", resource); #endif if (state -> handler != NULL) { DeqAsyncHandler(dpy, state -> handler); free(state -> handler); } if (state -> data != NULL) { free(state -> data); } free(state); _NXCollectedProperties[resource] = NULL; } LockDisplay(dpy); GetReq(GetProperty, req); req -> delete = delete; req -> window = window; req -> property = property; req -> type = req_type; req -> longOffset = long_offset; req -> longLength = long_length; #ifdef TEST fprintf(stderr, "******NXCollectProperty: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", X_GetProperty, dpy -> request, resource); fprintf(stderr, "******NXCollectProperty: Delete [%u] window [%d] property [%d] type [%d].\n", req -> delete, (int) req -> window, (int) req -> property, (int) req -> type); fprintf(stderr, "******NXCollectProperty: Long offset [%d] long length [%d].\n", (int) req -> longOffset, (int) req -> longLength); #endif state = malloc(sizeof(_NXCollectPropertyState)); handler = malloc(sizeof(_XAsyncHandler)); if (state == NULL || handler == NULL) { #ifdef PANIC fprintf(stderr, "******NXCollectProperty: Failed to allocate memory with resource [%d].\n", resource); #endif if (state != NULL) { free(state); } if (handler != NULL) { free(handler); } UnGetReq(GetProperty); UnlockDisplay(dpy); return -1; } state -> sequence = dpy -> request; state -> resource = resource; state -> window = window; state -> property = property; state -> type = 0; state -> format = 0; state -> items = 0; state -> after = 0; state -> data = NULL; state -> handler = handler; handler -> next = dpy -> async_handlers; handler -> handler = _NXCollectPropertyHandler; handler -> data = (XPointer) state; dpy -> async_handlers = handler; _NXCollectedProperties[resource] = state; UnlockDisplay(dpy); SyncHandle(); return True; } int NXGetCollectedProperty(Display *dpy, unsigned int resource, Atom *actual_type_return, int *actual_format_return, unsigned long *nitems_return, unsigned long *bytes_after_return, unsigned char **data) { register _NXCollectPropertyState *state; state = _NXCollectedProperties[resource]; if (state == NULL) { #ifdef PANIC fprintf(stderr, "******NXGetCollectedProperty: PANIC! No data collected for resource [%u].\n", resource); #endif return 0; } *actual_type_return = state -> type; *actual_format_return = state -> format; *nitems_return = state -> items; *bytes_after_return = state -> after; *data = (unsigned char *) _NXCollectedProperties[resource] -> data; free(state); _NXCollectedProperties[resource] = NULL; #ifdef TEST fprintf(stderr, "******NXGetCollectedProperty: Returning GetProperty data for resource [%u].\n", resource); #endif return True; } static void _NXNotifyGrabPointer(Display *dpy, int resource, Bool success) { XEvent async_event; async_event.type = ClientMessage; async_event.xclient.serial = _NXCollectedGrabPointers[resource] -> sequence; async_event.xclient.window = 0; async_event.xclient.message_type = 0; async_event.xclient.format = 32; async_event.xclient.data.l[0] = NXCollectGrabPointerNotify; async_event.xclient.data.l[1] = resource; async_event.xclient.data.l[2] = success; XPutBackEvent(dpy, &async_event); } static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf, int len, XPointer data) { register _NXCollectGrabPointerState *state; register xGrabPointerReply *async_rep; char *async_head; int async_size; state = (_NXCollectGrabPointerState *) data; if ((rep -> generic.sequenceNumber % 65536) != ((int)(state -> sequence) % 65536)) { #ifdef TEST fprintf(stderr, "******_NXCollectGrabPointerHandler: Unmatched sequence [%d] for opcode [%d] " "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, (int) rep -> generic.length << 2); #endif return False; } #ifdef TEST fprintf(stderr, "******_NXCollectGrabPointerHandler: Going to handle asynchronous GrabPointer reply.\n"); #endif DeqAsyncHandler(dpy, state -> handler); free(state -> handler); state -> handler = NULL; if (rep -> generic.type == X_Error) { #ifdef TEST fprintf(stderr, "******_NXCollectGrabPointerHandler: Error received from X server for resource [%d].\n", state -> resource); #endif _NXNotifyGrabPointer(dpy, state -> resource, False); _NXCollectedGrabPointers[state -> resource] = NULL; free(state); return False; } #ifdef TEST fprintf(stderr, "******_NXCollectGrabPointerHandler: Matched request with sequence [%ld].\n", state -> sequence); #endif async_size = SIZEOF(xGrabPointerReply); async_head = malloc(async_size); if (async_head == NULL) { #ifdef PANIC fprintf(stderr, "******_NXCollectGrabPointerHandler: PANIC! Failed to allocate memory with resource [%d].\n", state -> resource); #endif _NXNotifyGrabPointer(dpy, state -> resource, False); _NXCollectedGrabPointers[state -> resource] = NULL; free(state); return False; } #ifdef TEST fprintf(stderr, "******_NXCollectGrabPointerHandler: Going to get reply with size [%d].\n", (int) rep -> generic.length << 2); #endif async_rep = (xGrabPointerReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); if (async_rep == NULL) { #ifdef PANIC fprintf(stderr, "******_NXCollectGrabPointerHandler: PANIC! Failed to get reply with resource [%d].\n", state -> resource); #endif _NXNotifyGrabPointer(dpy, state -> resource, False); _NXCollectedGrabPointers[state -> resource] = NULL; free(state); free(async_head); return False; } #ifdef TEST fprintf(stderr, "******_NXCollectGrabPointerHandler: Got reply with status [%d] size [%d].\n", async_rep -> status, (int) async_rep -> length << 2); #endif state -> status = async_rep -> status; _NXNotifyGrabPointer(dpy, state -> resource, True); free(async_head); return True; } int NXGetCollectGrabPointerResource(Display *dpy) { int i; for (i = 0; i < NXNumberOfResources; i++) { if (_NXCollectedGrabPointers[i] == NULL) { return i; } } return -1; } int NXCollectGrabPointer(Display *dpy, unsigned int resource, Window grab_window, Bool owner_events, unsigned int event_mask, int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor, Time time) { register xGrabPointerReq *req; _NXCollectGrabPointerState *state; _XAsyncHandler *handler; if (resource >= NXNumberOfResources) { #ifdef PANIC fprintf(stderr, "******NXCollectGrabPointer: PANIC! Provided resource [%u] is out of range.\n", resource); #endif return -1; } state = _NXCollectedGrabPointers[resource]; if (state != NULL) { #ifdef PANIC fprintf(stderr, "******NXCollectGrabPointer: PANIC! Having to remove previous state for resource [%u].\n", resource); #endif if (state -> handler != NULL) { DeqAsyncHandler(dpy, state -> handler); free(state -> handler); } free(state); _NXCollectedGrabPointers[resource] = NULL; } LockDisplay(dpy); GetReq(GrabPointer, req); req -> grabWindow = grab_window; req -> ownerEvents = owner_events; req -> eventMask = event_mask; req -> pointerMode = pointer_mode; req -> keyboardMode = keyboard_mode; req -> confineTo = confine_to; req -> cursor = cursor; req -> time = time; #ifdef TEST fprintf(stderr, "******NXCollectGrabPointer: Sending message opcode [%d] sequence [%ld] " "for resource [%d].\n", X_GrabPointer, dpy -> request, resource); #endif state = malloc(sizeof(_NXCollectGrabPointerState)); handler = malloc(sizeof(_XAsyncHandler)); if (state == NULL || handler == NULL) { #ifdef PANIC fprintf(stderr, "******NXCollectGrabPointer: Failed to allocate memory with resource [%d].\n", resource); #endif if (state != NULL) { free(state); } if (handler != NULL) { free(handler); } UnGetReq(GrabPointer); UnlockDisplay(dpy); return -1; } state -> sequence = dpy -> request; state -> resource = resource; state -> status = 0; state -> handler = handler; handler -> next = dpy -> async_handlers; handler -> handler = _NXCollectGrabPointerHandler; handler -> data = (XPointer) state; dpy -> async_handlers = handler; _NXCollectedGrabPointers[resource] = state; UnlockDisplay(dpy); SyncHandle(); return True; } int NXGetCollectedGrabPointer(Display *dpy, unsigned int resource, int *status) { register _NXCollectGrabPointerState *state; state = _NXCollectedGrabPointers[resource]; if (state == NULL) { #ifdef PANIC fprintf(stderr, "******NXGetCollectedGrabPointer: PANIC! No data collected for resource [%u].\n", resource); #endif return 0; } *status = state -> status; free(state); _NXCollectedGrabPointers[resource] = NULL; #ifdef TEST fprintf(stderr, "******NXGetCollectedGrabPointer: Returning GrabPointer data for resource [%u].\n", resource); #endif return True; } static void _NXNotifyInputFocus(Display *dpy, int resource, Bool success) { XEvent async_event; async_event.type = ClientMessage; async_event.xclient.serial = _NXCollectedInputFocuses[resource] -> sequence; async_event.xclient.window = 0; async_event.xclient.message_type = 0; async_event.xclient.format = 32; async_event.xclient.data.l[0] = NXCollectInputFocusNotify; async_event.xclient.data.l[1] = resource; async_event.xclient.data.l[2] = success; XPutBackEvent(dpy, &async_event); } static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf, int len, XPointer data) { register _NXCollectInputFocusState *state; register xGetInputFocusReply *async_rep; char *async_head; int async_size; state = (_NXCollectInputFocusState *) data; if ((rep -> generic.sequenceNumber % 65536) != ((int)(state -> sequence) % 65536)) { #ifdef TEST fprintf(stderr, "******_NXCollectInputFocusHandler: Unmatched sequence [%d] for opcode [%d] " "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, (int) rep -> generic.length << 2); #endif return False; } #ifdef TEST fprintf(stderr, "******_NXCollectInputFocusHandler: Going to handle asynchronous GetInputFocus reply.\n"); #endif DeqAsyncHandler(dpy, state -> handler); free(state -> handler); state -> handler = NULL; if (rep -> generic.type == X_Error) { #ifdef TEST fprintf(stderr, "******_NXCollectInputFocusHandler: Error received from X server for resource [%d].\n", state -> resource); #endif _NXNotifyInputFocus(dpy, state -> resource, False); _NXCollectedInputFocuses[state -> resource] = NULL; free(state); return False; } #ifdef TEST fprintf(stderr, "******_NXCollectInputFocusHandler: Matched request with sequence [%ld].\n", state -> sequence); #endif async_size = SIZEOF(xGetInputFocusReply); async_head = malloc(async_size); if (async_head == NULL) { #ifdef PANIC fprintf(stderr, "******_NXCollectInputFocusHandler: PANIC! Failed to allocate memory with resource [%d].\n", state -> resource); #endif _NXNotifyInputFocus(dpy, state -> resource, False); _NXCollectedInputFocuses[state -> resource] = NULL; free(state); return False; } #ifdef TEST fprintf(stderr, "******_NXCollectInputFocusHandler: Going to get reply with size [%d].\n", (int) rep -> generic.length << 2); #endif async_rep = (xGetInputFocusReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); if (async_rep == NULL) { #ifdef PANIC fprintf(stderr, "******_NXCollectInputFocusHandler: PANIC! Failed to get reply with resource [%d].\n", state -> resource); #endif _NXNotifyInputFocus(dpy, state -> resource, False); _NXCollectedInputFocuses[state -> resource] = NULL; free(state); free(async_head); return False; } #ifdef TEST fprintf(stderr, "******_NXCollectInputFocusHandler: Got reply with focus [%d] revert to [%d] " "size [%d].\n", (int) async_rep -> focus, (int) async_rep -> revertTo, (int) async_rep -> length << 2); #endif state -> focus = async_rep -> focus; state -> revert_to = async_rep -> revertTo; _NXNotifyInputFocus(dpy, state -> resource, True); free(async_head); return True; } int NXGetCollectInputFocusResource(Display *dpy) { int i; for (i = 0; i < NXNumberOfResources; i++) { if (_NXCollectedInputFocuses[i] == NULL) { return i; } } return -1; } int NXCollectInputFocus(Display *dpy, unsigned int resource) { _X_UNUSED register xReq *req; _NXCollectInputFocusState *state; _XAsyncHandler *handler; if (resource >= NXNumberOfResources) { #ifdef PANIC fprintf(stderr, "******NXCollectInputFocus: PANIC! Provided resource [%u] is out of range.\n", resource); #endif return -1; } state = _NXCollectedInputFocuses[resource]; if (state != NULL) { #ifdef PANIC fprintf(stderr, "******NXCollectInputFocus: PANIC! Having to remove previous state for resource [%u].\n", resource); #endif if (state -> handler != NULL) { DeqAsyncHandler(dpy, state -> handler); free(state -> handler); } free(state); _NXCollectedInputFocuses[resource] = NULL; } LockDisplay(dpy); GetEmptyReq(GetInputFocus, req); #ifdef TEST fprintf(stderr, "******NXCollectInputFocus: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", X_GetInputFocus, dpy -> request, resource); #endif state = malloc(sizeof(_NXCollectInputFocusState)); handler = malloc(sizeof(_XAsyncHandler)); if (state == NULL || handler == NULL) { #ifdef PANIC fprintf(stderr, "******NXCollectInputFocus: Failed to allocate memory with resource [%d].\n", resource); #endif if (state != NULL) { free(state); } if (handler != NULL) { free(handler); } UnGetEmptyReq(); UnlockDisplay(dpy); return -1; } state -> sequence = dpy -> request; state -> resource = resource; state -> focus = 0; state -> revert_to = 0; state -> handler = handler; handler -> next = dpy -> async_handlers; handler -> handler = _NXCollectInputFocusHandler; handler -> data = (XPointer) state; dpy -> async_handlers = handler; _NXCollectedInputFocuses[resource] = state; UnlockDisplay(dpy); SyncHandle(); return True; } int NXGetCollectedInputFocus(Display *dpy, unsigned int resource, Window *focus_return, int *revert_to_return) { register _NXCollectInputFocusState *state; state = _NXCollectedInputFocuses[resource]; if (state == NULL) { #ifdef PANIC fprintf(stderr, "******NXGetCollectedInputFocus: PANIC! No data collected for resource [%u].\n", resource); #endif return 0; } *focus_return = state -> focus; *revert_to_return = state -> revert_to; free(state); _NXCollectedInputFocuses[resource] = NULL; #ifdef TEST fprintf(stderr, "******NXGetCollectedInputFocus: Returning GetInputFocus data for resource [%u].\n", resource); #endif return True; } #ifdef DUMP void _NXDumpData(const unsigned char *buffer, unsigned int size) { if (buffer != NULL) { unsigned int i = 0; unsigned int ii; while (i < size) { fprintf(stderr, "[%d]\t", i); for (ii = 0; i < size && ii < 8; i++, ii++) { fprintf(stderr, "%d\t", (unsigned int) (buffer[i])); } fprintf(stderr, "\n"); } } } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.h0000644000000000000000000006150213614532331022130 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef NXlib_H #define NXlib_H #ifdef __cplusplus extern "C" { #endif #include #include #include #include #include #include /* * Maximum number of supported pack methods. */ #define NXNumberOfPackMethods 128 /* * Assume this as the limit of resources that * can be provided to the split and unpack * requests. */ #define NXNumberOfResources 256 #define NXNoResource 256 + 1 #define NXAnyResource 256 + 2 /* * Initialize the internal structures used by * the library. Should be executed again after * having reopened the display. */ extern int NXInitDisplay( #if NeedFunctionPrototypes Display* /* display */ #endif ); /* * Reset all the internal structures. Should be * executed after closing the display. */ extern int NXResetDisplay( #if NeedFunctionPrototypes Display* /* display */ #endif ); /* * Set the NX display flush policy. The policy can * be either NXFlushDeferred or NXFlushImmediate. */ extern int NXSetDisplayPolicy( #if NeedFunctionPrototypes Display* /* display */, int /* policy */ #endif ); /* * Set the display output buffer size. */ extern int NXSetDisplayBuffer( #if NeedFunctionPrototypes Display* /* display */, int /* size */ #endif ); /* * If set, the Popen() function in the X server * will remove the LD_LIBRARY_PATH variable from * the environment before calling the execl() * function on the child process. The function * returns the previous value. */ extern int NXUnsetLibraryPath( #if NeedFunctionPrototypes int /* value */ #endif ); /* * If the parameter is true, the Xlib I/O error * handler will return, instead of quitting the * program. The function returns the previous * value. */ extern int NXHandleDisplayError( #if NeedFunctionPrototypes int /* value */ #endif ); /* * Shutdown the display descriptor and force Xlib * to set the I/O error flag. */ extern Bool NXForceDisplayError( #if NeedFunctionPrototypes Display* /* display */ #endif ); /* * Check the value of the XlibDisplayIOError flag. * If not set, try to call the display error hand- * ler to give to the application a chance to see * whether it needs to close the connection. */ extern int NXDisplayError( #if NeedFunctionPrototypes Display* /* display */ #endif ); /* * Query the number of bytes readable from the * display connection. */ extern int NXDisplayReadable( #if NeedFunctionPrototypes Display* /* display */ #endif ); /* * Query the number of the outstanding bytes to * flush to the display connection. */ extern int NXDisplayFlushable( #if NeedFunctionPrototypes Display* /* display */ #endif ); /* * Return a value between 0 and 9 indicating the * congestion level of the NX transport based on * the tokens remaining. A value of 9 means that * the link is congested and no further data can * be sent. */ extern int NXDisplayCongestion( #if NeedFunctionPrototypes Display* /* display */ #endif ); /* * Flush the Xlib display buffer and/or the * outstanding data accumulated by the NX * transport. */ extern int NXFlushDisplay( #if NeedFunctionPrototypes Display* /* display */, int /* what */ #endif ); /* * Public interfaces used to set the handlers. * They all return the previous handler. */ extern NXDisplayErrorPredicate NXSetDisplayErrorPredicate( #if NeedFunctionPrototypes NXDisplayErrorPredicate /* predicate */ #endif ); /* * Called when the display blocks waiting to read or * write more data. */ extern NXDisplayBlockHandler NXSetDisplayBlockHandler( #if NeedFunctionPrototypes NXDisplayBlockHandler /* handler */ #endif ); /* * Called after more data is written to the display. * When the NX transport is running, data may be queued * until an explicit flush. */ extern NXDisplayWriteHandler NXSetDisplayWriteHandler( #if NeedFunctionPrototypes NXDisplayWriteHandler /* handler */ #endif ); /* * Called after more data is sent to the remote proxy. * * Here the display pointer is passed as the second * parameter to make clear that the function does not * tie the callback to the display, but, similarly to * all the Xlib error handlers, to a global variable * shared by all the Xlib functions. The display * pointer will be passed back by nxcomp at the time * it will call the handler. This is because nxcomp * doesn't have access to the display structure. */ extern NXDisplayFlushHandler NXSetDisplayFlushHandler( #if NeedFunctionPrototypes NXDisplayFlushHandler /* handler */, Display* /* display */ #endif ); /* * Get an arbitrary null terminated buffer to be added * to the NX statistics. */ extern NXDisplayStatisticsHandler NXSetDisplayStatisticsHandler( #if NeedFunctionPrototypes NXDisplayStatisticsHandler /* handler */, char ** /* buffer */ #endif ); /* * Redefine the function called by Xlib in the case of * an out-of-order sequence number received in the X * protocol stream. */ extern NXLostSequenceHandler NXSetLostSequenceHandler( #if NeedFunctionPrototypes NXLostSequenceHandler /* handler */ #endif ); /* * The agent should get the NX parameters at startup, just after * having opened the display. If the agent is not able to satisfy * the pack method set by user (because a method is not applica- * ble, it is not supported by the remote or it simply requires a * screen depth greater than the depth available), it should fall * back to the nearest method of the same type. */ extern Status NXGetControlParameters( #if NeedFunctionPrototypes Display* /* display */, unsigned int* /* link_type */, unsigned int* /* local_major */, unsigned int* /* local_minor */, unsigned int* /* local_patch */, unsigned int* /* remote_major */, unsigned int* /* remote_minor */, unsigned int* /* remote_patch */, int* /* frame_timeout */, int* /* ping_timeout */, int* /* split_mode */, int* /* split_size */, unsigned int* /* pack_method */, unsigned int* /* pack_quality */, int* /* data_level */, int* /* stream_level */, int* /* delta_level */, unsigned int* /* load_cache */, unsigned int* /* save_cache */, unsigned int* /* startup_cache */ #endif ); /* * Which unpack methods are supported by the remote proxy? */ extern Status NXGetUnpackParameters( #if NeedFunctionPrototypes Display* /* display */, unsigned int* /* entries */, unsigned char[] /* supported_methods */ #endif ); /* * Query and enable shared memory support on path agent to X * client proxy and X server proxy to real X server. At the * moment only the path proxy to real X server is implemented. * On return flags will say if support has been successfully * activated. Segments will contain the XID associated to the * shared memory blocks. A MIT-SHM compliant protocol is used * between proxy and the real server, while a simplified * version is used between the agent and the client proxy to * accommodate both packed images and plain X bitmaps. */ extern Status NXGetShmemParameters( #if NeedFunctionPrototypes Display* /* display */, unsigned int* /* enable_client */, unsigned int* /* enable_server */, unsigned int* /* client_segment */, unsigned int* /* server_segment */, unsigned int* /* client_size */, unsigned int* /* server_size */ #endif ); /* * Get the path to the font server that can be used by the X * server to tunnel the font connections across the NX link. * The path actually represents the TCP port where the proxy * on the NX client side is listening. The agent can tempora- * rily enable the tunneling when it needs a font that is not * available on the client, for example when the session is * migrated from a different X server. */ extern Status NXGetFontParameters( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* path_length */, char[] /* path_data */ #endif ); /* * This set of functions is used to leverage the image stream- * ing capabilities built in nxcomp. An image can be streamed * by sending a start-split message, followed by the X messages * that will have to be split by the proxy, followed by an end- * split closure. Usually, in the middle of a start-split/end- * split sequence there will be a single PutImage() or PutPack- * edImage(), that, in turn, can generate multiple partial * requests, like a SetUnpackColormap() and SetUnpackAlpha() * that will be later used to decompress the image to its ori- * ginal form. Multiple requests may be also generated because * of the maximum size of a X request being exceeded, so that * Xlib has to divide the single image in multiple sub-image re- * quests. The agent doesn't need to take care of these details * but will rather have to track the result of the split opera- * tion. By monitoring the notify events sent by the proxy, the * agent will have to implement its own strategy to deal with * the resources. For example, it will be able to: * * - Mark a drawable as dirty, if the image was not sent * synchronously, in the main X oputput stream. * * - Choose to commit or discard the original image, at the * time it will be recomposed at the remote side. This may * include all the messages that were part of the split * (the colormap, the alpha channel, etc.) * * - Mark the drawable as clean again, if the image was * committed and the drawable didn't change in the mean- * while. * * At the time the proxy receives the end-split, it reports the * result of the operation to the agent. The agent will be able * to identify the original split operation (the one referenced * in the start-split/end-split sequence) by the small integer * number (0-255) named 'resource' sent in the events. * * One of the following cases may be encountered: * * * NXNoSplitNotify All messages were sent in the main out- * put stream, so that no split actually * took place. * * NXStartSplitNotify One or more messages were split, so, * at discrection of the agent, the client * may be suspended until the transferral * is completed. * * NXCommitSplitNotify One of the requests that made up the * split was recomposed. The agent should * either commit the given request or tell * the proxy to discard it. * * NXEndSplitNotify The split was duly completed. The agent * can restart the client. * * NXEmptySplitNotify No more split operation are pending. * The agent can use this information to * implement specific strategies requiring * that all messages have been recomposed * at the remote end, like updating the * drawables that were not synchronized * because of the lazy encoding. * * The 'mode' field that is sent by the agent in the start-split * request, determines the strategy that the proxy will adopt to * deal with the image. If set to 'eager', the proxy will only * split the messages whose size exceeds the split threshold (the * current threshold can be found in the NXGetControlParameters() * reply). If the mode is set to lazy, the proxy will split any * image that would have generated an actual transfer of the data * part (in practice all images that are not found in the cache). * This second strategy can be leveraged by an agent to further * reduce the bandwidth requirements. For example, by setting the * mode to lazy and by monitoring the result, an agent can easi- * ly verify if the drawable was successfully updated, mark the * drawable if not, and synchronize it at later time. * * See NXproto.h for the definition of the available modes. */ extern unsigned int NXAllocSplit( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */ #endif ); extern int NXStartSplit( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, unsigned int /* mode */ #endif ); extern int NXEndSplit( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */ #endif ); extern int NXCommitSplit( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, unsigned int /* propagate */, unsigned char /* request */, unsigned int /* position */ #endif ); extern int NXAbortSplit( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */ #endif ); extern int NXFinishSplit( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */ #endif ); extern int NXFreeSplit( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */ #endif ); extern int NXSetExposeParameters( #if NeedFunctionPrototypes Display* /* display */, int /* expose */, int /* graphics_expose */, int /* no_expose */ #endif ); extern int NXSetCacheParameters( #if NeedFunctionPrototypes Display* /* display */, int /* enable_cache */, int /* enable_split */, int /* enable_save */, int /* enable_load */ #endif ); extern unsigned int NXAllocUnpack( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */ #endif ); extern int NXSetUnpackGeometry( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, Visual* /* visual */ #endif ); extern int NXSetUnpackColormap( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, unsigned int /* method */, unsigned int /* entries */, const char* /* data */, unsigned int /* data_length */ #endif ); extern int NXSetUnpackAlpha( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, unsigned int /* method */, unsigned int /* entries */, const char* /* data */, unsigned int /* data_length */ #endif ); extern int NXSetUnpackColormapCompat( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, unsigned int /* entries */, const char* /* data */ #endif ); extern int NXSetUnpackAlphaCompat( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, unsigned int /* entries */, const char* /* data */ #endif ); extern int NXFreeUnpack( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */ #endif ); /* * A packed image is a XImage but with * offset field containing total amount * of packed image data. */ typedef XImage NXPackedImage; NXPackedImage *NXCreatePackedImage( #if NeedFunctionPrototypes Display* /* display */, Visual* /* visual */, unsigned int /* method */, unsigned int /* depth */, int /* format */, char* /* data */, int /* data_length */, unsigned int /* width */, unsigned int /* height */, int /* bitmap_pad */, int /* bytes_per_line */ #endif ); extern int NXDestroyPackedImage( #if NeedFunctionPrototypes NXPackedImage* /* image */ #endif ); NXPackedImage *NXPackImage( #if NeedFunctionPrototypes Display* /* display */, XImage* /* src_image */, unsigned int /* method */ #endif ); NXPackedImage *NXInPlacePackImage( #if NeedFunctionPrototypes Display* /* display */, XImage* /* src_image */, unsigned int /* method */ #endif ); /* * GC is declared void * to get rid of mess * with different GC definitions in some X * server code (like in nxagent). */ extern int NXPutPackedImage( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, Drawable /* drawable */, void* /* gc */, NXPackedImage* /* image */, unsigned int /* method */, unsigned int /* depth */, int /* src_x */, int /* src_y */, int /* dst_x */, int /* dst_y */, unsigned int /* width */, unsigned int /* height */ #endif ); /* * Get multiple colors with a single call by * pipelining X_AllocColor requests/replies. */ extern int NXAllocColors( #if NeedFunctionPrototypes Display* /* display */, Colormap /* colormap */, unsigned int /* entries */, XColor[] /* screens_in_out */, Bool [] /* flags allocation errors */ #endif ); /* * Encode the data in the given format. */ extern char *NXEncodeColormap( #if NeedFunctionPrototypes const char* /* src_data */, unsigned int /* src_size */, unsigned int* /* dst_size */ #endif ); extern char *NXEncodeAlpha( #if NeedFunctionPrototypes const char* /* src_data */, unsigned int /* src_size */, unsigned int* /* dst_size */ #endif ); extern NXPackedImage *NXEncodeRgb( #if NeedFunctionPrototypes XImage* /* src_image */, unsigned int /* method */, unsigned int /* quality */ #endif ); extern NXPackedImage *NXEncodeRle( #if NeedFunctionPrototypes XImage* /* src_image */, unsigned int /* method */, unsigned int /* quality */ #endif ); extern NXPackedImage *NXEncodeJpeg( #if NeedFunctionPrototypes XImage* /* src_image */, unsigned int /* method */, unsigned int /* quality */ #endif ); typedef struct { long pixel; int found; } NXColorTable; extern int NXEncodeColors( #if NeedFunctionPrototypes XImage* /* src_image */, NXColorTable* /* color_table */, int /* nb_max */ #endif ); extern NXPackedImage *NXEncodePng( #if NeedFunctionPrototypes XImage* /* src_image */, unsigned int /* method */, unsigned int /* quality */ #endif ); extern NXPackedImage *NXEncodeBitmap( #if NeedFunctionPrototypes XImage* /* src_image */, unsigned int /* method */, unsigned int /* quality */ #endif ); extern int NXCleanImage( #if NeedFunctionPrototypes XImage* #endif ); extern void NXMaskImage( #if NeedFunctionPrototypes XImage* /* pointer to image to mask */ , unsigned int /* method */ #endif ); extern int NXImageCacheSize; extern void NXInitCache( #if NeedFunctionPrototypes Display* /* display */, int /* entries in image cache */ #endif ); extern void NXFreeCache( #if NeedFunctionPrototypes Display* /* display */ #endif ); extern XImage *NXCacheFindImage( #if NeedFunctionPrototypes NXPackedImage* /* packed image to find */, unsigned int* /* pointer to the pack method if found */, unsigned char** /* pointer to the calculated MD5 if found */ #endif ); extern int NXCacheAddImage( #if NeedFunctionPrototypes NXPackedImage* /* packed image to be added to the cache */, unsigned int /* pack method of the image to add */, unsigned char* /* pointer to MD5 of the original unpacked image */ #endif ); extern int NXGetCollectImageResource( #if NeedFunctionPrototypes Display* /* display */ #endif ); extern int NXCollectImage( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, Drawable /* drawable */, int /* src_x */, int /* src_y */, unsigned int /* width */, unsigned int /* height */, unsigned long /* plane_mask */, int /* format */ #endif ); extern int NXGetCollectedImage( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, XImage** /* image */ #endif ); extern int NXGetCollectPropertyResource( #if NeedFunctionPrototypes Display* /* display */ #endif ); extern int NXCollectProperty( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, Window /* window */, Atom /* property */, long /* long_offset */, long /* long_length */, Bool /* delete */, Atom /* req_type */ #endif ); extern int NXGetCollectedProperty( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, Atom* /* actual_type_return */, int* /* actual_format_return */, unsigned long* /* nitems_return */, unsigned long* /* bytes_after_return */, unsigned char** /* data */ #endif ); extern int NXGetCollectGrabPointerResource( #if NeedFunctionPrototypes Display* /* display */ #endif ); extern int NXCollectGrabPointer( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, Window /* grab_window */, Bool /* owner_events */, unsigned int /* event_mask */, int /* pointer_mode */, int /* keyboard_mode */, Window /* confine_to */, Cursor /* cursor */, Time /* time */ #endif ); extern int NXGetCollectedGrabPointer( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, int* /* status */ #endif ); extern int NXGetCollectInputFocusResource( #if NeedFunctionPrototypes Display* /* display */ #endif ); extern int NXCollectInputFocus( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */ #endif ); extern int NXGetCollectedInputFocus( #if NeedFunctionPrototypes Display* /* display */, unsigned int /* resource */, Window* /* focus_return */, int* /* revert_to_return */ #endif ); #ifdef __cplusplus } #endif #endif /* NXlib_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Imakefile0000644000000000000000000000153413614532331022150 0ustar NULL = #include SRCS = \ Alpha.c \ Bitmap.c \ Clean.c \ Colormap.c \ Compext.c \ Jpeg.c \ Mask.c \ Png.c \ Rgb.c \ Rle.c \ Z.c \ $(NULL) OBJS = \ Alpha.o \ Bitmap.o \ Clean.o \ Colormap.o \ Compext.o \ Jpeg.o \ Mask.o \ Png.o \ Rgb.o \ Rle.o \ Z.o \ $(NULL) INCLUDES = -I$(SERVERSRC)/include \ -I$(XBUILDINCDIR) \ -I../../../../../lib/include/X11 \ `pkg-config --cflags-only-I pixman-1` \ $$(pkg-config --exists 'zlib' >/dev/null 2>&1 && pkg-config --cflags-only-I 'zlib') \ `pkg-config --cflags-only-I libpng` \ $(NULL) LINTLIBS = $(SERVERSRC)/dix/llib-ldix.ln \ $(NULL) NormalLibraryObjectRule() NormalLibraryTarget(compext,$(OBJS)) LintLibraryTarget(compext,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.c0000644000000000000000000003314413614532331021372 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include #include #include #include #include #include #include "Compext.h" #include "Mask.h" #include "Jpeg.h" #define PANIC #define WARNING #undef TEST #undef DEBUG #define JPEG_DEST_SIZE(width, height) ((width) * 3 * (height) + 1024) /* * Local function prototypes. */ static void PrepareRowForJpeg(CARD8 *dst, int y, int count); static void PrepareRowForJpeg24(CARD8 *dst, int y, int count); static void PrepareRowForJpeg16(CARD8 *dst, int y, int count); static void PrepareRowForJpeg32(CARD8 *dst, int y, int count); static int JpegEmptyOutputBuffer(j_compress_ptr cinfo); static void JpegInitDestination(j_compress_ptr cinfo); static void JpegTermDestination(j_compress_ptr cinfo); static void JpegSetDstManager(j_compress_ptr cinfo); /* * Quality levels. */ static int jpegQuality[10] = {20, 30, 40, 50, 55, 60, 65, 70, 75, 80}; /* * Image characteristics. */ static int bytesPerLine; static CARD8 bitsPerPixel; static CARD16 redMax, greenMax, blueMax; static CARD8 redShift, greenShift, blueShift; static int byteOrder; /* * Other variables used for the Jpeg * encoding. */ static char *jpegBeforeBuf = NULL; static char *jpegCompBuf; static int jpegCompBufSize; static int jpegError; static int jpegDstDataLen; static struct jpeg_destination_mgr jpegDstManager; /* * Just for debugging purpose. */ #ifdef DEBUG static int jpegId; static char jpegName[10]; static FILE *jpegFile; #endif /* * Function declarations */ char *JpegCompressData(XImage *image, int level, int *compressed_size) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; CARD8 *srcBuf; JSAMPROW rowPointer[1]; int dy, w, h; *compressed_size = 0; /* * Initialize the image stuff */ bitsPerPixel = image -> bits_per_pixel; bytesPerLine = image -> bytes_per_line; byteOrder = image -> byte_order; #ifdef TEST fprintf(stderr, "******JpegCompressData: Image byte order [%d] bitmap bit order [%d].\n", image -> byte_order, image -> bitmap_bit_order); fprintf(stderr, "******JpegCompressData: Bits per pixel [%d] bytes per line [%d].\n", bitsPerPixel, bytesPerLine); #endif redShift = FindLSB(image -> red_mask) - 1; greenShift = FindLSB(image -> green_mask) - 1; blueShift = FindLSB(image -> blue_mask) - 1; #ifdef TEST fprintf(stderr, "******JpegCompressData: Red mask [0x%lx] green mask [0x%lx] blue mask [0x%lx].\n", image -> red_mask, image -> green_mask, image -> blue_mask); fprintf(stderr, "******JpegCompressData: Red shift [%d] green shift [%d] blue shift [%d].\n", redShift, greenShift, blueShift); #endif redMax = image -> red_mask >> redShift; greenMax = image -> green_mask >> greenShift; blueMax = image -> blue_mask >> blueShift; #ifdef TEST fprintf(stderr, "******JpegCompressData: Red max [0x%x] green max [0x%x] blue max [0x%x].\n", redMax, greenMax, blueMax); #endif w = image -> width; h = image -> height; jpegBeforeBuf = image -> data; #ifdef DEBUG fprintf(stderr, "******JpegCompressData: Width [%d] height [%d] level [%d].\n", w, h, level); #endif if (bitsPerPixel == 1 || bitsPerPixel == 8) { #ifdef PANIC fprintf(stderr, "******JpegCompressData: PANIC! Invalid bits per pixel [%d].\n", bitsPerPixel); #endif return NULL; } /* * Allocate space for one line of the * resulting image, 3 bytes per pixel. */ #ifdef DEBUG fprintf(stderr, "******JpegCompressData: Allocating [%d] bytes for the scanline.\n", w * 3); #endif srcBuf = (CARD8 *) malloc(w * 3); if (srcBuf == NULL) { #ifdef PANIC fprintf(stderr, "******JpegCompressData: PANIC! Cannot allocate [%d] bytes.\n", w * 3); #endif return NULL; } rowPointer[0] = srcBuf; cinfo.err = jpeg_std_error(&jerr); jpeg_create_compress(&cinfo); cinfo.image_width = w; cinfo.image_height = h; cinfo.input_components = 3; cinfo.in_color_space = JCS_RGB; jpeg_set_defaults(&cinfo); jpeg_set_quality(&cinfo, jpegQuality[level], 1); /* * Allocate memory for the destination * buffer. */ jpegCompBufSize = JPEG_DEST_SIZE(w, h); #ifdef TEST fprintf(stderr, "******JpegCompressData: Allocating [%d] bytes for the destination data.\n", jpegCompBufSize); #endif jpegCompBuf = malloc(jpegCompBufSize); if (jpegCompBuf == NULL) { #ifdef PANIC fprintf(stderr, "******JpegCompressData: PANIC! Error allocating [%d] bytes for the Jpeg data.\n", jpegCompBufSize); #endif return NULL; } JpegSetDstManager(&cinfo); jpeg_start_compress(&cinfo, 1); #ifdef DEBUG fprintf(stderr, "******JpegCompressedData: Initialization finished.\n"); #endif for (dy = 0; dy < h; dy++) { PrepareRowForJpeg(srcBuf, dy, w); jpeg_write_scanlines(&cinfo, rowPointer, 1); if (jpegError != 0) { break; } } #ifdef DEBUG fprintf(stderr, "******JpegCompressedData: Compression finished. Lines handled [%d,%d]. Error is [%d].\n", dy, h, jpegError); #endif if (jpegError == 0) { jpeg_finish_compress(&cinfo); } jpeg_destroy_compress(&cinfo); free((char *) srcBuf); if (jpegError != 0) { #ifdef PANIC fprintf(stderr, "******JpegCompressedData: PANIC! Compression failed. Error is [%d].\n", jpegError); #endif free(jpegCompBuf); return NULL; } /* * Check the size of the resulting data. */ if (jpegDstDataLen > 0) { /* * Save the image on disk to help with * the debug. */ #ifdef DEBUG int i = 0; fprintf(stderr, "******JpegCompressedData: Compressed size [%d].\n", jpegDstDataLen); jpegId++; sprintf(jpegName, "jpeg%d", jpegId); jpegFile = fopen(jpegName, "w"); for (i = 0; i < jpegDstDataLen; i++) { fprintf(jpegFile, "%c", *(jpegCompBuf + i)); } fclose(jpegFile); #endif *compressed_size = jpegDstDataLen; return jpegCompBuf; } else { #ifdef PANIC fprintf(stderr, "******JpegCompressedData: PANIC! Invalid size of the compressed data [%d].\n", jpegDstDataLen); #endif free(jpegCompBuf); return NULL; } } void PrepareRowForJpeg(CARD8 *dst, int y, int count) { if (bitsPerPixel == 32) { if (redMax == 0xff && greenMax == 0xff && blueMax == 0xff) { PrepareRowForJpeg24(dst, y, count); } else { PrepareRowForJpeg32(dst, y, count); } } else if (bitsPerPixel == 24) { memcpy(dst, jpegBeforeBuf + y * bytesPerLine, count * 3); } else { /* * 16 bpp assumed. */ PrepareRowForJpeg16(dst, y, count); } } void PrepareRowForJpeg24(CARD8 *dst, int y, int count) { CARD8 *fbptr; CARD32 pix; fbptr = (CARD8 *) (jpegBeforeBuf + y * bytesPerLine); while (count--) { if (byteOrder == LSBFirst) { pix = (CARD32) *(fbptr + 2); pix = (pix << 8) | (CARD32) *(fbptr+1); pix = (pix << 8) | (CARD32) *fbptr; } else { pix = (CARD32) *(fbptr + 1); pix = (pix << 8) | (CARD32) *(fbptr + 2); pix = (pix << 8) | (CARD32) *(fbptr + 3); } *dst++ = (CARD8)(pix >> redShift); *dst++ = (CARD8)(pix >> greenShift); *dst++ = (CARD8)(pix >> blueShift); fbptr+=4; } } #define DEFINE_JPEG_GET_ROW_FUNCTION(bpp) \ \ void PrepareRowForJpeg##bpp(CARD8 *dst, int y, int count) \ { \ CARD8 *fbptr; \ CARD##bpp pix; \ int inRed, inGreen, inBlue; \ int i; \ \ fbptr = (CARD8 *) (jpegBeforeBuf + y * bytesPerLine); \ \ while (count--) \ { \ pix = 0; \ \ if (byteOrder == LSBFirst) \ { \ for (i = (bpp >> 3) - 1; i >= 0; i--) \ { \ pix = (pix << 8) | (CARD32) *(fbptr + i); \ } \ } \ else \ { \ for (i = 0; i < (bpp >> 3); i++) \ { \ pix = (pix << 8) | (CARD32) *(fbptr + i); \ } \ } \ \ fbptr += bpp >> 3; \ \ inRed = (int) \ (pix >> redShift & redMax); \ inGreen = (int) \ (pix >> greenShift & greenMax); \ inBlue = (int) \ (pix >> blueShift & blueMax); \ \ *dst++ = (CARD8)((inRed * 255 + redMax / 2) / \ redMax); \ *dst++ = (CARD8)((inGreen * 255 + greenMax / 2) / \ greenMax); \ *dst++ = (CARD8)((inBlue * 255 + blueMax / 2) / \ blueMax); \ } \ } DEFINE_JPEG_GET_ROW_FUNCTION(16) DEFINE_JPEG_GET_ROW_FUNCTION(32) /* * Destination manager implementation for JPEG library. */ void JpegInitDestination(j_compress_ptr cinfo) { jpegError = 0; jpegDstManager.next_output_byte = (JOCTET *) jpegCompBuf; jpegDstManager.free_in_buffer = (size_t) jpegCompBufSize; } int JpegEmptyOutputBuffer(j_compress_ptr cinfo) { jpegError = 1; jpegDstManager.next_output_byte = (JOCTET *) jpegCompBuf; jpegDstManager.free_in_buffer = (size_t) jpegCompBufSize; return 1; } void JpegTermDestination(j_compress_ptr cinfo) { jpegDstDataLen = jpegCompBufSize - jpegDstManager.free_in_buffer; } void JpegSetDstManager(j_compress_ptr cinfo) { jpegDstManager.init_destination = JpegInitDestination; jpegDstManager.empty_output_buffer = JpegEmptyOutputBuffer; jpegDstManager.term_destination = JpegTermDestination; cinfo -> dest = &jpegDstManager; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.h0000644000000000000000000000420113614532331021367 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Jpeg_H #define Jpeg_H #ifdef __cplusplus extern "C" { #endif extern char *JpegCompressData( #if NeedFunctionPrototypes XImage* /* image */, int /* level */, int* /* compressed_size */ #endif ); #ifdef __cplusplus } #endif #endif /* Jpeg_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Mask.c0000644000000000000000000005215613614532331021404 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include #include #include "Mask.h" #define PANIC #define WARNING #undef TEST #undef DEBUG /* * Try first to reduce to a white or black * pixel. If not possible, apply the mask. * Note that correction is applied at the * time pixel is unpacked. */ #define MaskPixel(red, green, blue, mask) \ \ if (red > mask -> white_threshold && \ green > mask -> white_threshold && \ blue > mask -> white_threshold) \ { \ red = green = blue = 0xff; \ } \ else if (red < mask -> black_threshold && \ green < mask -> black_threshold && \ blue < mask -> black_threshold) \ { \ red = green = blue = 0x00; \ } \ else \ { \ red = red & mask -> color_mask; \ green = green & mask -> color_mask; \ blue = blue & mask -> color_mask; \ } int MaskImage(const ColorMask *mask, XImage *src_image, XImage *dst_image) { unsigned long pixel; register unsigned int red; register unsigned int green; register unsigned int blue; register unsigned long data_size; register unsigned int i; data_size = (src_image -> bytes_per_line * src_image -> height) >> 2; #ifdef TEST fprintf(stderr, "******MaskImage: Going to mask image with [%d] bits per pixel.\n", src_image -> bits_per_pixel); #endif if (src_image -> bits_per_pixel == 24 || src_image -> bits_per_pixel == 32) { register unsigned char *pixel_addr; for (i = 0; i < data_size; i++) { pixel = ((unsigned long *) src_image -> data)[i]; pixel_addr = (unsigned char *) &pixel; red = pixel_addr[2]; green = pixel_addr[1]; blue = pixel_addr[0]; #ifdef DEBUG fprintf(stderr, "******MaskImage: 24/32 bits original R [%d] G [%d] B [%d] A [%d].\n", red, green, blue, pixel_addr[3]); #endif MaskPixel(red, green, blue, mask); #ifdef DEBUG fprintf(stderr, "******MaskImage: 24/32 bits masked R [%d] G [%d] B [%d] A [%d].\n", red, green, blue, pixel_addr[3]); #endif #ifdef DEBUG fprintf(stderr, "******MaskImage: 24/32 bits pixel 0x%lx", pixel); #endif pixel_addr[2] = red; pixel_addr[1] = green; pixel_addr[0] = blue; ((unsigned long*)dst_image -> data)[i] = pixel; #ifdef DEBUG fprintf(stderr, " -> 0x%lx\n", pixel); #endif } return 1; } else if (src_image -> bits_per_pixel == 16) { /* * FIXME: Masking doesn't work in 16 bpp. * unsigned long src_addr, *dst_addr; unsigned short *src_pixels_addr, *dst_pixels_addr; for (i = 0; i < data_size; i++) { src_addr = ((unsigned long *)src_image -> data)[i]; dst_addr = (unsigned long *)((unsigned long *)dst_image -> data + i); src_pixels_addr = ((unsigned short *) &src_addr); dst_pixels_addr = ((unsigned short *) dst_addr); red = (src_pixels_addr[0] & src_image -> red_mask) >> 8; green = (src_pixels_addr[0] & src_image -> green_mask) >> 3; blue = (src_pixels_addr[0] & src_image -> blue_mask) << 3; #ifdef DEBUG fprintf(stderr, "******MaskImage: 16 bits original R [%d] G [%d] B [%d].\n", red, green, blue); #endif MaskPixel(red, green, blue, mask); #ifdef DEBUG fprintf(stderr, "******MaskImage: 16 bits masked R [%d] G [%d] B [%d].\n", red, green, blue); #endif dst_pixels_addr[0] = ((red << 8) & src_image -> red_mask) | ((green << 3) & src_image -> green_mask) | ((blue >> 3) & src_image -> blue_mask); #ifdef DEBUG fprintf(stderr, "******MaskImage: 16 bits pixel 0x%x", dst_pixels_addr[0]); #endif red = (src_pixels_addr[1] & src_image -> red_mask) >> 8; green = (src_pixels_addr[1] & src_image -> green_mask) >> 3; blue = (src_pixels_addr[1] & src_image -> blue_mask) << 3; #ifdef DEBUG fprintf(stderr, "******MaskImage: 16 bits original R [%d] G [%d] B [%d].\n", red, green, blue); #endif MaskPixel(red, green, blue, mask); #ifdef DEBUG fprintf(stderr, "******MaskImage: 16 bits masked R [%d] G [%d] B [%d].\n", red, green, blue); #endif dst_pixels_addr[1] = ((red << 8) & src_image -> red_mask) | ((green << 3) & src_image -> green_mask) | ((blue >> 3) & src_image -> blue_mask); #ifdef DEBUG fprintf(stderr, "******MaskImage: 16 bits pixel 0x%x", dst_pixels_addr[0]); #endif } if (dst_image -> width & 0x00000001) { int card32_per_line; int i; card32_per_line = dst_image -> bytes_per_line >> 2; for (i = 0; i < dst_image -> height;) { ((CARD32 *) dst_image -> data)[(++i * card32_per_line) - 1] &= 0x0000ffff; } } * * End of FIXME. */ } else { #ifdef TEST fprintf(stderr, "******MaskImage: PANIC! Cannot apply mask with [%d] bits per pixel.\n", src_image -> bits_per_pixel); #endif return 0; } return 1; } int MaskInPlaceImage(const ColorMask *mask, XImage *image) { unsigned long pixel; register unsigned int red; register unsigned int green; register unsigned int blue; register unsigned int i; register unsigned long data_size; data_size = (image -> bytes_per_line * image -> height)>>2; #ifdef TEST fprintf(stderr, "******MaskInPlaceImage: Going to mask image with [%d] bits per pixel.\n", image -> bits_per_pixel); #endif if (image -> bits_per_pixel == 24 || image -> bits_per_pixel == 32) { register unsigned char *pixel_addr; for (i = 0; i < data_size; i++) { pixel = ((unsigned long *) image -> data)[i]; pixel_addr = (unsigned char *) &pixel; red = pixel_addr[2]; green = pixel_addr[1]; blue = pixel_addr[0]; #ifdef DEBUG fprintf(stderr, "******MaskInPlaceImage: 24/32 bits original R [%d] G [%d] B [%d] A [%d].\n", red, green, blue, pixel_addr[3]); #endif MaskPixel(red, green, blue, mask); #ifdef DEBUG fprintf(stderr, "******MaskInPlaceImage: 24/32 bits masked R [%d] G [%d] B [%d] A [%d].\n", red, green, blue, pixel_addr[3]); #endif #ifdef DEBUG fprintf(stderr, "******MaskInPlaceImage: 24/32 bits pixel 0x%lx", pixel); #endif pixel_addr[2] = red; pixel_addr[1] = green; pixel_addr[0] = blue; ((unsigned long *) image -> data)[i] = pixel; #ifdef DEBUG fprintf(stderr, " -> 0x%lx\n", pixel); #endif } return 1; } else if (image -> bits_per_pixel == 16) { /* * FIXME: Mask doesn't still work for 16 bits. * unsigned long addr; register unsigned short *pixels_addr; for (i = 0; i < data_size; i++) { addr = ((unsigned long *) image -> data)[i]; pixels_addr = ((unsigned short *) &addr); red = (pixels_addr[0] & image -> red_mask) >> 8; green = (pixels_addr[0] & image -> green_mask) >> 3; blue = (pixels_addr[0] & image -> blue_mask) << 3; #ifdef DEBUG fprintf(stderr, "******MaskInPlaceImage: 16 bits original R [%d] G [%d] B [%d].\n", red, green, blue); #endif MaskPixel(red, green, blue, mask); #ifdef DEBUG fprintf(stderr, "******MaskInPlaceImage: 16 bits masked R [%d] G [%d] B [%d].\n", red, green, blue); #endif pixels_addr[0] = ((red << 8) & image -> red_mask) | ((green << 3) & image -> green_mask) | ((blue >> 3) & image -> blue_mask); #ifdef DEBUG fprintf(stderr, "******MaskInPlaceImage: 16 bits pixel 0x%x", pixels_addr[0]); #endif red = (pixels_addr[1] & image -> red_mask) >> 8; green = (pixels_addr[1] & image -> green_mask) >> 3; blue = (pixels_addr[1] & image -> blue_mask) << 3; #ifdef DEBUG fprintf(stderr, "******MaskInPlaceImage: 16 bits original R [%d] G [%d] B [%d].\n", red, green, blue); #endif MaskPixel(red, green, blue, mask); #ifdef DEBUG fprintf(stderr, "******MaskInPlaceImage: 16 bits masked R [%d] G [%d] B [%d].\n", red, green, blue); #endif pixels_addr[1] = ((red << 8) & image -> red_mask) | ((green << 3) & image -> green_mask) | ((blue >> 3) & image -> blue_mask); #ifdef DEBUG fprintf(stderr, "******MaskInPlaceImage: 16 bits pixel 0x%x", pixels_addr[1]); #endif } if (image -> width & 0x00000001) { int card32_per_line; int i; card32_per_line = image -> bytes_per_line >> 2; for (i = 0; i < image -> height;) { ((CARD32 *) image -> data)[(++i * card32_per_line) - 1] &= 0x0000ffff; } } * * End of FIXME. */ } else { #ifdef TEST fprintf(stderr, "******MaskImage: PANIC! Cannot apply mask with [%d] bits per pixel.\n", image -> bits_per_pixel); #endif return 0; } return 1; } static int Pack16To8(unsigned int src_data_size, XImage *src_image, XImage *dst_image) { unsigned short *src_pixel = (unsigned short *) src_image -> data; unsigned char *dst_pixel = (unsigned char *) dst_image -> data; #ifdef DEBUG unsigned int counter = 0; #endif while (src_pixel < ((unsigned short *) (src_image -> data + src_data_size))) { #ifdef DEBUG fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", counter, *src_pixel, (*src_pixel & 0xc000) >> 8, ((*src_pixel & 0x600) >> 3), (*src_pixel & 0x18) << 3); #endif if (*src_pixel == 0x0) { *dst_pixel = 0x0; } else if (*src_pixel == 0xffff) { *dst_pixel = 0xff; } else { *dst_pixel = ((*src_pixel & 0xc000) >> 10) | ((*src_pixel & 0x600) >> 7) | ((*src_pixel & 0x18) >> 3); } #ifdef DEBUG fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", counter++, *dst_pixel); #endif src_pixel++; dst_pixel++; } return 1; } static int Pack24To8(unsigned int src_data_size, XImage *src_image, XImage *dst_image) { unsigned char *src_pixel = (unsigned char *) src_image -> data; unsigned char *dst_pixel = (unsigned char *) dst_image -> data; int i; unsigned int bytes_per_line = src_image -> bytes_per_line; unsigned char *end_of_line = (unsigned char *) (src_pixel + bytes_per_line); #ifdef DEBUG unsigned int counter = 0; #endif for (i = 0; i < src_image -> height; i++ ) { #ifdef DEBUG fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x%x%x] red [0x%x] green [0x%x] blue [0x%x].\n", counter, src_pixel[0], src_pixel[1], src_pixel[2], src_pixel[0] & 0xc0, src_pixel[1] & 0xc0, src_pixel[2] & 0xc0); #endif while(src_pixel < end_of_line - 2) { if (src_pixel[0] == 0x00 && src_pixel[1] == 0x00 && src_pixel[2] == 0x00) { *dst_pixel = 0x0; } else if (src_pixel[0] == 0xff && src_pixel[1] == 0xff && src_pixel[2] == 0xff) { *dst_pixel = 0xff; } else { /* * Pixel layout: * * 24 bit RRRRR000 GGGGG000 BBBBB000 -> 8 bit 00RRGGBB */ *dst_pixel = (src_pixel[0] & 0xc0) >> 2 | ((src_pixel[1] & 0xc0) >> 4) | ((src_pixel[2] & 0xc0) >> 6); } #ifdef DEBUG fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", counter++, *dst_pixel); #endif src_pixel += 3; dst_pixel += 1; } src_pixel = end_of_line; end_of_line += bytes_per_line; } return 1; } static int Pack24To16(unsigned int src_data_size, XImage *src_image, XImage *dst_image) { unsigned char *src_pixel = (unsigned char *) src_image -> data; unsigned short *dst_pixel = (unsigned short *) dst_image -> data; int i; unsigned int bytes_per_line = src_image -> bytes_per_line; unsigned char *end_of_line = (unsigned char *) (src_pixel + bytes_per_line); #ifdef DEBUG unsigned int counter = 0; #endif for (i = 0; i < src_image -> height; i++ ) { while(src_pixel < end_of_line - 2) { #ifdef DEBUG fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x%x%x] red [0x%x] green [0x%x] blue [0x%x].\n", counter, src_pixel[0], src_pixel[1], src_pixel[2], src_pixel[0] & 0xf8, src_pixel[1] & 0xf8, src_pixel[2] & 0xf8); #endif if (src_pixel[0] == 0x00 && src_pixel[1] == 0x00 && src_pixel[2] == 0x00) { *dst_pixel = 0x0; } else if (src_pixel[0] == 0xff && src_pixel[1] == 0xff && src_pixel[2] == 0xff) { *dst_pixel = 0xffff; } else { /* * Pixel layout: * * 24 bit RRRRR000 GGGGG000 BBBBB000 -> 16 bit 0RRRRRGG GGGBBBBB */ *dst_pixel = ((src_pixel[0] & 0xf8) << 7) | ((src_pixel[1] & 0xf8) << 2) | ((src_pixel[2] & 0xf8) >> 3); } #ifdef DEBUG fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", counter++, *dst_pixel); #endif src_pixel += 3; dst_pixel += 1; } src_pixel = end_of_line; end_of_line += bytes_per_line; } return 1; } static int Pack32To8(unsigned int src_data_size, XImage *src_image, XImage *dst_image) { unsigned int *src_pixel = (unsigned int *) src_image -> data; unsigned char *dst_pixel = (unsigned char *) dst_image -> data; #ifdef DEBUG unsigned int counter = 0; #endif while (src_pixel < ((unsigned int *) (src_image -> data + src_data_size))) { #ifdef DEBUG fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", counter, *src_pixel, (*src_pixel & 0xc00000), (*src_pixel & 0xc000), (*src_pixel & 0xc0)); #endif if (*src_pixel == 0x0) { *dst_pixel = 0x0; } else if (*src_pixel == 0xffffff) { *dst_pixel = 0xff; } else { *dst_pixel = ((*src_pixel & 0xc00000) >> 18) | ((*src_pixel & 0xc000) >> 12) | ((*src_pixel & 0xc0) >> 6); } #ifdef DEBUG fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", counter++, *dst_pixel); #endif src_pixel++; dst_pixel++; } return 1; } static int Pack32To16(unsigned int src_data_size, XImage *src_image, XImage *dst_image) { unsigned int *src_pixel = (unsigned int *) src_image -> data; unsigned short *dst_pixel = (unsigned short *) dst_image -> data; #ifdef DEBUG unsigned int counter = 0; #endif while (src_pixel < ((unsigned int *) (src_image -> data + src_data_size))) { #ifdef DEBUG fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", counter, *src_pixel, (*src_pixel & 0xf80000), (*src_pixel & 0xf800), (*src_pixel & 0xf8)); #endif if (*src_pixel == 0x0) { *dst_pixel = 0x0; } else if (*src_pixel == 0xffffff) { *dst_pixel = 0xffff; } else { *dst_pixel = ((*src_pixel & 0xf80000) >> 9) | ((*src_pixel & 0xf800) >> 6) | ((*src_pixel & 0xf8) >> 3); } #ifdef DEBUG fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", counter++, *dst_pixel); #endif src_pixel++; dst_pixel++; } return 1; } static int Pack32To24(unsigned int src_data_size, XImage *src_image, XImage *dst_image) { unsigned int *src_pixel = (unsigned int *) src_image -> data; unsigned char *dst_pixel = (unsigned char *) dst_image -> data; #ifdef DEBUG unsigned int counter = 0; #endif while (src_pixel < ((unsigned int *) (src_image -> data + src_data_size))) { #ifdef DEBUG fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", counter, *src_pixel, ((*src_pixel & 0xff0000) >> 16), ((*src_pixel & 0x00ff00) >> 8), (*src_pixel & 0xff)); #endif if (*src_pixel == 0x0) { dst_pixel[0] = dst_pixel[1] = dst_pixel[2] = 0x0; } else if (*src_pixel == 0xffffff) { dst_pixel[0] = dst_pixel[1] = dst_pixel[2] = 0xff; } else { dst_pixel[0] = (*src_pixel & 0xff0000) >> 16; dst_pixel[1] = (*src_pixel & 0x00ff00) >> 8; dst_pixel[2] = (*src_pixel & 0x0000ff); } #ifdef DEBUG fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x], [0x%x], [0x%x].\n", counter++, dst_pixel[0], dst_pixel[1], dst_pixel[2]); #endif src_pixel += 1; dst_pixel += 3; } return 1; } int PackImage(unsigned int method, unsigned int src_data_size, XImage *src_image, unsigned int dst_data_size, XImage *dst_image) { unsigned int src_bits_per_pixel; unsigned int dst_bits_per_pixel; src_bits_per_pixel = src_image -> bits_per_pixel; dst_bits_per_pixel = MethodBitsPerPixel(method); #ifdef TEST fprintf(stderr, "******PackImage: Source bits per pixel [%d], destination bits per pixel [%d].\n", src_bits_per_pixel, dst_bits_per_pixel); fprintf(stderr, "******PackImage: Source data size [%d], destination data size [%d].\n", src_data_size, dst_data_size); #endif if (dst_bits_per_pixel >= src_bits_per_pixel) { #ifdef PANIC fprintf(stderr, "******PackImage: PANIC! Cannot pack image from [%d] to [%d] bytes per pixel.\n", src_bits_per_pixel, dst_bits_per_pixel); #endif return 0; } switch (src_bits_per_pixel) { case 16: { switch (dst_bits_per_pixel) { case 8: { return Pack16To8(src_data_size, src_image, dst_image); } default: { return 0; } } } case 24: { switch (dst_bits_per_pixel) { case 8: { return Pack24To8(src_data_size, src_image, dst_image); } case 16: { return Pack24To16(src_data_size, src_image, dst_image); } default: { return 0; } } } case 32: { switch (dst_bits_per_pixel) { case 8: { return Pack32To8(src_data_size, src_image, dst_image); } case 16: { return Pack32To16(src_data_size, src_image, dst_image); } case 24: { return Pack32To24(src_data_size, src_image, dst_image); } default: { return 0; } } } default: { return 0; } } } /* * Replace the ffs() call that may be not * present on some systems. */ int FindLSB(int word) { int t = word; int m = 1; int i = 0; for (; i < sizeof(word) << 3; i++, m <<= 1) { if (t & m) { return i + 1; } } return 0; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Mask.h0000644000000000000000000000442713614532331021407 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Mask_H #define Mask_H #ifdef __cplusplus extern "C" { #endif #include "Xlib.h" extern int MaskImage(const ColorMask *mask, XImage *src_image, XImage *dst_image); extern int MaskInPlaceImage(const ColorMask *mask, XImage *image); extern int PackImage(unsigned int method, unsigned int src_data_size, XImage *src_image, unsigned int dst_data_size, XImage *dst_image); int FindLSB(int word); #ifdef __cplusplus } #endif #endif /* Mask_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Png.c0000644000000000000000000004552013614532331021232 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include #include #include #include "Compext.h" #include "Mask.h" #include "Png.h" #define PANIC #define WARNING #undef TEST #undef DEBUG /* * Selected ZLIB compression level. */ #define PNG_Z_LEVEL 4 /* * Local function prototypes. */ static void PrepareRowForPng(CARD8 *dst, int y, int count); static void PrepareRowForPng24(CARD8 *dst, int y, int count); static void PrepareRowForPng16(CARD8 *dst, int y, int count); static void PrepareRowForPng32(CARD8 *dst, int y, int count); static void PngWriteData(png_structp png_ptr, png_bytep data, png_size_t length); static void PngFlushData(png_structp png_ptr); /* * Image characteristics. */ static int bytesPerLine; static int byteOrder; static CARD8 bitsPerPixel; static CARD16 redMax, greenMax, blueMax; static CARD8 redShift, greenShift, blueShift; /* * Other variables used for the Png * encoding. */ png_byte color_type; png_structp png_ptr; png_infop info_ptr; png_colorp palette; static char *pngCompBuf; static int pngDataLen; static char *pngBeforeBuf = NULL; /* * Allocate data for the compressed image. * We need to ensure that there is enough * space to include the palette and the * header. */ #define PNG_DEST_SIZE(width, height) ((width) * 3 * (height) + 1024 + 256) /* * Just for debug purposes. */ #ifdef DEBUG static int pngId; static char pngName[10]; static FILE *pngFile; #endif int PngCompareColorTable(NXColorTable *c1, NXColorTable *c2) { return (c1 -> pixel - c2 -> pixel); } #define NB_COLOR_MAX 256 int NXCreatePalette32(XImage *src_image, NXColorTable *color_table, CARD8 *image_index, int nb_max) { int x, y, t, p; CARD8 *fbptr; CARD32 pixel; fbptr = (CARD8 *) (src_image -> data); /* * TODO: Find a more intelligent way to * estimate the number of colors. */ memset(color_table, 0, nb_max * sizeof(NXColorTable)); for (x = 0, p = 0; x < src_image -> height; x++) { for (y = 0; y < src_image -> width; y++) { if (byteOrder == LSBFirst) { pixel = (CARD32) *(fbptr + 3); pixel = (pixel << 8) | (CARD32) *(fbptr + 2); pixel = (pixel << 8) | (CARD32) *(fbptr + 1); pixel = (pixel << 8) | (CARD32) *fbptr; } else { pixel = (CARD32) *fbptr; pixel = (pixel << 8) | (CARD32) *(fbptr + 1); pixel = (pixel << 8) | (CARD32) *(fbptr + 2); pixel = (pixel << 8) | (CARD32) *(fbptr + 3); } fbptr += 4; for (t = 0; t < nb_max; t++) { if (color_table[t].found == 0) { color_table[t].pixel = pixel; color_table[t].found = 1; p++; image_index[((x * src_image -> width) + y)] = t; break; } else if ((CARD32)(color_table[t].pixel) == pixel) { image_index[((x * src_image -> width) + y)] = t; break; } } if (p == nb_max) { return nb_max + 1; } } } return p; } int NXCreatePalette16(XImage *src_image, NXColorTable *color_table, CARD8 *image_index, int nb_max) { int x, y, t, p; CARD8 *fbptr; CARD16 pixel; fbptr = (CARD8 *) (src_image -> data); /* * TODO: Find a more intelligent way to * estimate the number of colors. */ memset(color_table, 0, nb_max * sizeof(NXColorTable)); for (x = 0, p = 0; x < src_image -> height; x++) { for (y = 0; y < src_image -> width; y++) { if (byteOrder == LSBFirst) { pixel = (CARD16) *(fbptr + 1); pixel = (pixel << 8) | (CARD16) *fbptr; } else { pixel = (CARD16) *fbptr; pixel = (pixel << 8) | (CARD16) *(fbptr + 1); } fbptr += 2; for (t = 0; t < nb_max; t++) { if (color_table[t].found == 0) { color_table[t].pixel = pixel; color_table[t].found = 1; p++; image_index[((x * src_image -> width) + y)] = t; break; } else if ((color_table[t].pixel) == pixel) { image_index[((x * src_image -> width) + y)] = t; break; } } /* * In case the number of 16bit words is not even * we have 2 padding bytes that we have to skip. */ if ((y == src_image -> width - 1) && (src_image -> width % 2 == 1)) fbptr += 2; if (p == nb_max) { return nb_max + 1; } } } return p; } char *PngCompressData(XImage *image, int *compressed_size) { unsigned int num = 0; CARD8 *srcBuf; int dy, w, h; int nb_colors; NXColorTable color_table[NB_COLOR_MAX]; CARD8 *image_index; *compressed_size = 0; pngDataLen = 0; /* * Initialize the image stuff. */ bitsPerPixel = image -> bits_per_pixel; bytesPerLine = image -> bytes_per_line; byteOrder = image -> byte_order; if (bitsPerPixel < 15) { #ifdef PANIC fprintf(stderr, "******PngCompressData: PANIC! Can't compress images with [%d] bits per pixel.\n", bitsPerPixel); #endif return NULL; } redShift = FindLSB(image -> red_mask) - 1; greenShift = FindLSB(image -> green_mask) - 1; blueShift = FindLSB(image -> blue_mask) - 1; redMax = image -> red_mask >> redShift; greenMax = image -> green_mask >> greenShift; blueMax = image -> blue_mask >> blueShift; w = image -> width; h = image -> height; pngBeforeBuf = image -> data; #ifdef DEBUG fprintf(stderr, "******PngCompressData: Compressing image with width [%d] height [%d].\n", w, h ); #endif /* * Initialize the PNG stuff. */ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) { #ifdef PANIC fprintf(stderr, "******PngCompressData: PANIC! Failed creating the png_create_write_struct.\n"); #endif return NULL; } info_ptr = png_create_info_struct(png_ptr); if (info_ptr == NULL) { #ifdef PANIC fprintf(stderr, "******PngCompressData: PANIC! Failed creating the png_create_info_struct.\n"); #endif png_destroy_write_struct(&png_ptr, NULL); return NULL; } if (setjmp(png_jmpbuf(png_ptr))) { #ifdef PANIC fprintf(stderr, "******PngCompressData: PANIC! Error during compression initialization.\n"); #endif png_destroy_write_struct(&png_ptr, &info_ptr); return NULL; } /* * Be sure we allocate enough data. */ #ifdef TEST fprintf(stderr, "******PngCompressData: Allocating [%d] bytes for the destination data.\n", PNG_DEST_SIZE(w, h)); #endif pngCompBuf = malloc(PNG_DEST_SIZE(w, h)); if (pngCompBuf == NULL) { #ifdef PANIC fprintf(stderr, "******PngCompressData: PANIC! Error allocating [%d] bytes for the Png data.\n", PNG_DEST_SIZE(w, h)); #endif return NULL; } png_set_write_fn(png_ptr, (void *) pngCompBuf, PngWriteData, PngFlushData); if (setjmp(png_jmpbuf(png_ptr))) { #ifdef PANIC fprintf(stderr, "******PngCompressData: PANIC! Error writing the header.\n"); #endif png_destroy_write_struct(&png_ptr, &info_ptr); free(pngCompBuf); return NULL; } image_index = (CARD8 *) calloc(1, (image -> height) * (image -> width) * sizeof(CARD8)); if (image_index == NULL) { #ifdef PANIC fprintf(stderr, "******PngCompressData: PANIC! Could not alloc image_index.\n"); #endif free(pngCompBuf); return NULL; } /* * TODO: Be sure the padded bytes are cleaned. * It would be better to set to zero the bytes * that are not aligned to the word boundary * at the end of the procedure. */ png_set_compression_level(png_ptr, PNG_Z_LEVEL); if (bitsPerPixel == 16) { nb_colors = NXCreatePalette16(image, color_table, image_index, NB_COLOR_MAX); } else { nb_colors = NXCreatePalette32(image, color_table, image_index, NB_COLOR_MAX); } if (nb_colors <= NB_COLOR_MAX) { color_type = PNG_COLOR_TYPE_PALETTE; } else { color_type = PNG_COLOR_TYPE_RGB; } png_set_IHDR(png_ptr, info_ptr, w, h, 8, color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); if (color_type == PNG_COLOR_TYPE_PALETTE) { palette = png_malloc(png_ptr, sizeof(*palette) * 256); /* * TODO: Do we need to clean these bytes? * * memset(palette, 0, sizeof(*palette) * 256); */ for (num = 0; num < 256 && color_table[num].found != 0; num++) { if (bitsPerPixel == 24) { palette[num].red = (color_table[num].pixel >> redShift) & redMax; palette[num].green = (color_table[num].pixel >> greenShift) & greenMax; palette[num].blue = color_table[num].pixel >> blueShift & blueMax; } else { int inRed, inGreen, inBlue; inRed = (color_table[num].pixel >> redShift) & redMax; inGreen = (color_table[num].pixel >> greenShift) & greenMax; inBlue = color_table[num].pixel >> blueShift & blueMax; palette[num].red = (CARD8)((inRed * 255 + redMax / 2) / redMax); palette[num].green = (CARD8)((inGreen * 255 + greenMax / 2) / greenMax); palette[num].blue = (CARD8)((inBlue * 255 + blueMax / 2) / blueMax); } #ifdef DEBUG fprintf(stderr, "******PngCompressData: pixel[%d] r[%d] g[%d] b[%d].\n", (int) color_table[num].pixel,palette[num].red,palette[num].green,palette[num].blue); #endif } png_set_PLTE(png_ptr, info_ptr, palette, num); #ifdef DEBUG fprintf(stderr, "******PngCompressedData: Setting palette.\n"); #endif } /* * End of palette. */ png_write_info(png_ptr, info_ptr); /* * Allocate space for one line of * the image, 3 bytes per pixel. */ #ifdef DEBUG fprintf(stderr, "******PngCompressedData: Initialization finished.\n"); #endif if (setjmp(png_jmpbuf(png_ptr))) { #ifdef PANIC fprintf(stderr, "******PngCompressData: PANIC! Error while writing the image rows.\n"); #endif png_destroy_write_struct(&png_ptr, &info_ptr); free(pngCompBuf); free(image_index); return NULL; } int count; if (color_type == PNG_COLOR_TYPE_PALETTE) { count = w; } else { count = 3 * w; } srcBuf = (CARD8 *) calloc(count, sizeof(CARD8)); if (srcBuf == NULL) { #ifdef PANIC fprintf(stderr, "******PngCompressData: PANIC! Cannot allocate [%d] bytes.\n", (int) (count * sizeof(CARD8))); #endif free(pngCompBuf); free(image_index); return NULL; } /* * TODO: Be sure the padded bytes are cleaned. * It would be better to set to zero the bytes * that are not aligned to the word boundary * at the end of the procedure. */ for (dy = 0; dy < h; dy++) { if (color_type == PNG_COLOR_TYPE_RGB) { PrepareRowForPng(srcBuf, dy, w); } else { memcpy(srcBuf, image_index + (dy * w), w); } png_write_row(png_ptr, srcBuf); } #ifdef DEBUG fprintf(stderr, "******PngCompressedData: Compression finished. Lines handled [%d,%d].\n", dy, h); #endif free(srcBuf); srcBuf = NULL; free(image_index); image_index = NULL; if (setjmp(png_jmpbuf(png_ptr))) { #ifdef PANIC fprintf(stderr, "******PngCompressData: PANIC! error during end of write.\n"); #endif png_destroy_write_struct(&png_ptr, &info_ptr); free(pngCompBuf); return NULL; } png_write_end(png_ptr, NULL); if (color_type == PNG_COLOR_TYPE_PALETTE) { png_free(png_ptr, palette); } png_destroy_write_struct(&png_ptr, &info_ptr); /* * Check the size of the resulting data. */ if (pngDataLen > 0) { #ifdef DEBUG int i = 0; fprintf(stderr, "******PngCompressedData: Compressed size [%d].\n", pngDataLen); pngId++; sprintf(pngName, "png%d", pngId); pngFile = fopen(pngName, "w"); for (i = 0; i < pngDataLen; i++) { fprintf(pngFile, "%c", *(pngCompBuf + i)); } fclose(pngFile); #endif *compressed_size = pngDataLen; return pngCompBuf; } else { #ifdef DEBUG fprintf(stderr, "******PngCompressedData: PANIC! Invalid size of the compressed data [%d].\n", pngDataLen); #endif free(pngCompBuf); return NULL; } } static void PngWriteData(png_structp png_ptr, png_bytep data, png_size_t length) { memcpy(((char *) png_get_io_ptr(png_ptr) + pngDataLen), data, length); pngDataLen += length; } static void PngFlushData(png_structp png_ptr) { } void PrepareRowForPng(CARD8 *dst, int y, int count) { if (bitsPerPixel == 32) { if (redMax == 0xff && greenMax == 0xff && blueMax == 0xff) { PrepareRowForPng24(dst, y, count); } else { PrepareRowForPng32(dst, y, count); } } else if (bitsPerPixel == 24) { memcpy(dst, pngBeforeBuf + y * bytesPerLine, count * 3); } else { /* * 16 bpp assumed. */ PrepareRowForPng16(dst, y, count); } } void PrepareRowForPng24(CARD8 *dst, int y, int count) { CARD8 *fbptr; CARD32 pix; fbptr = (CARD8 *) (pngBeforeBuf + y * bytesPerLine); while (count--) { if (byteOrder == LSBFirst) { pix = (CARD32) *(fbptr + 2); pix = (pix << 8) | (CARD32) *(fbptr+1); pix = (pix << 8) | (CARD32) *fbptr; } else { pix = (CARD32) *(fbptr + 1); pix = (pix << 8) | (CARD32) *(fbptr + 2); pix = (pix << 8) | (CARD32) *(fbptr + 3); } *dst++ = (CARD8)(pix >> redShift); *dst++ = (CARD8)(pix >> greenShift); *dst++ = (CARD8)(pix >> blueShift); fbptr+=4; } } #define DEFINE_PNG_GET_ROW_FUNCTION(bpp) \ \ void PrepareRowForPng##bpp(CARD8 *dst, int y, int count) \ { \ CARD8 *fbptr; \ CARD##bpp pix; \ int inRed, inGreen, inBlue; \ int i; \ \ fbptr = (CARD8 *) (pngBeforeBuf + y * bytesPerLine); \ \ while (count--) \ { \ pix = 0; \ \ if (byteOrder == LSBFirst) \ { \ for (i = (bpp >> 3) - 1; i >= 0; i--) \ { \ pix = (pix << 8) | (CARD32) *(fbptr + i); \ } \ } \ else \ { \ for (i = 0; i < (bpp >> 3); i++) \ { \ pix = (pix << 8) | (CARD32) *(fbptr + i); \ } \ } \ \ fbptr += (bpp >> 3); \ \ inRed = (int) \ (pix >> redShift & redMax); \ inGreen = (int) \ (pix >> greenShift & greenMax); \ inBlue = (int) \ (pix >> blueShift & blueMax); \ *dst++ = (CARD8)((inRed * 255 + redMax / 2) / \ redMax); \ *dst++ = (CARD8)((inGreen * 255 + greenMax / 2) / \ greenMax); \ *dst++ = (CARD8)((inBlue * 255 + blueMax / 2) / \ blueMax); \ } \ } DEFINE_PNG_GET_ROW_FUNCTION(16) DEFINE_PNG_GET_ROW_FUNCTION(32) nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Png.h0000644000000000000000000000533413614532331021236 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Png_H #define Png_H #ifdef __cplusplus extern "C" { #endif #include #include #include #include extern int PngCompareColorTable( #if NeedFunctionPrototypes NXColorTable* /* color_table_1 */, NXColorTable* /* color_table_2 */ #endif ); extern char *PngCompressData( #if NeedFunctionPrototypes XImage* /* image */, int* /* compressed_size */ #endif ); int NXCreatePalette16( #if NeedFunctionPrototypes XImage* /* src_image */, NXColorTable* /* color_table */, CARD8* /* image_index */, int /* nb_max */ #endif ); int NXCreatePalette32( #if NeedFunctionPrototypes XImage* /* src_image */, NXColorTable* /* color_table */, CARD8* /* image_index */, int /* nb_max */ #endif ); #ifdef __cplusplus } #endif #endif /* Png_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Rgb.c0000644000000000000000000000502013614532331021207 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include "Compext.h" #include "Rgb.h" #include "Z.h" #define PANIC #define WARNING #undef TEST #undef DEBUG #define RGB_COMPRESSION_LEVEL 4 #define RGB_COMPRESSION_THRESHOLD 32 #define RGB_COMPRESSION_STRATEGY Z_DEFAULT_STRATEGY static int rgbCompressionLevel = RGB_COMPRESSION_LEVEL; static int rgbCompressionThreshold = RGB_COMPRESSION_THRESHOLD; static int rgbCompressionStrategy = RGB_COMPRESSION_STRATEGY; char *RgbCompressData(XImage *image, unsigned int *size) { return ZCompressData(image -> data, image -> bytes_per_line * image -> height, rgbCompressionThreshold, rgbCompressionLevel, rgbCompressionStrategy, size); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Rgb.h0000644000000000000000000000412113614532331021215 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Rgb_H #define Rgb_H #ifdef __cplusplus extern "C" { #endif extern char *RgbCompressData( #if NeedFunctionPrototypes XImage* /* image */, unsigned int* /* compressed_size */ #endif ); #ifdef __cplusplus } #endif #endif /* Rgb_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Rle.c0000644000000000000000000000500313614532331021220 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include "Compext.h" #include "Rle.h" #include "Z.h" #define PANIC #define WARNING #undef TEST #undef DEBUG #define RLE_COMPRESSION_LEVEL 1 #define RLE_COMPRESSION_THRESHOLD 32 #define RLE_COMPRESSION_STRATEGY Z_RLE static int rleCompressionLevel = RLE_COMPRESSION_LEVEL; static int rleCompressionThreshold = RLE_COMPRESSION_THRESHOLD; static int rleCompressionStrategy = RLE_COMPRESSION_STRATEGY; char *RleCompressData(XImage *image, unsigned int *size) { return ZCompressData(image -> data, image -> bytes_per_line * image -> height, rleCompressionThreshold, rleCompressionLevel, rleCompressionStrategy, size); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Rle.h0000644000000000000000000000412113614532331021225 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Rle_H #define Rle_H #ifdef __cplusplus extern "C" { #endif extern char *RleCompressData( #if NeedFunctionPrototypes XImage* /* image */, unsigned int* /* compressed_size */ #endif ); #ifdef __cplusplus } #endif #endif /* Rle_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Z.c0000644000000000000000000001737413614532331020725 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include #include #include #include "Compext.h" #include "Z.h" #define PANIC #define WARNING #undef TEST #undef DEBUG #define Z_COMPRESSION_LEVEL 4 #define Z_COMPRESSION_THRESHOLD 32 #define Z_COMPRESSION_STRATEGY Z_DEFAULT_STRATEGY static int zCompressionLevel = Z_COMPRESSION_LEVEL; static int zCompressionStrategy = Z_COMPRESSION_STRATEGY; static z_stream *zStream; static int zInitialized; static int ZConfigure(int level, int strategy); static int ZDeflate(char *dest, unsigned int *destLen, const char *source, unsigned int sourceLen); char *ZCompressData(const char *plainData, unsigned int plainSize, int threshold, int level, int strategy, unsigned int *compressedSize) { char *compressedData; /* * Determine the size of the source image * data and make sure there is enough * space in the destination buffer. */ *compressedSize = plainSize + (plainSize / 1000) + 12 + 1; compressedData = malloc(*compressedSize); if (compressedData == NULL) { #ifdef PANIC fprintf(stderr, "******ZCompressData: PANIC! Failed to allocate [%d] bytes for the destination.\n", *compressedSize); #endif *compressedSize = 0; return NULL; } if (level == Z_NO_COMPRESSION || plainSize < threshold) { #ifdef TEST fprintf(stderr, "******ZCompressData: Not compressing [%d] bytes with level [%d] and " "threshold [%d].\n", plainSize, level, threshold); #endif /* * Tell in the first byte of the buffer * if the remaining data is compressed * or not. This same byte can be used * in future to store some other flag. */ *compressedData = 0; memcpy(compressedData + 1, plainData, plainSize); *compressedSize = plainSize + 1; return compressedData; } else { int result; /* * Reconfigure the stream if needed. */ if (zCompressionLevel != level || zCompressionStrategy != strategy) { ZConfigure(level, strategy); zCompressionLevel = level; zCompressionStrategy = strategy; } result = ZDeflate(compressedData + 1, compressedSize, plainData, plainSize); if (result != Z_OK) { #ifdef PANIC fprintf(stderr, "******ZCompressData: PANIC! Failed to compress [%d] bytes with error [%s].\n", plainSize, zError(result)); #endif free(compressedData); *compressedSize = 0; return NULL; } #ifdef TEST fprintf(stderr, "******ZCompressData: Source data of [%d] bytes compressed to [%d].\n", plainSize, *compressedSize); #endif *compressedData = 1; *compressedSize = *compressedSize + 1; return compressedData; } } int ZConfigure(int level, int strategy) { /* * ZLIB wants the avail_out to be * non zero, even if the stream was * already flushed. */ unsigned char dest[1]; zStream -> next_out = dest; zStream -> avail_out = 1; if (deflateParams(zStream, level, strategy) != Z_OK) { #ifdef PANIC fprintf(stderr, "******ZConfigure: PANIC! Failed to set level to [%d] and strategy to [%d].\n", level, strategy); #endif return -1; } #ifdef TEST else { fprintf(stderr, "******ZConfigure: Reconfigured the stream with level [%d] and strategy [%d].\n", level, strategy); } #endif return 1; } int ZDeflate(char *dest, unsigned int *destLen, const char *source, unsigned int sourceLen) { int saveOut; int result; /* * Deal with the possible overflow. */ if (zStream -> total_out & 0x80000000) { #ifdef TEST fprintf(stderr, "******ZDeflate: Reset Z stream counters with total in [%ld] total out [%ld].\n", zStream -> total_in, zStream -> total_out); #endif zStream -> total_in = 0; zStream -> total_out = 0; } saveOut = zStream -> total_out; zStream -> next_in = (Bytef *) source; zStream -> avail_in = (uInt) sourceLen; #ifdef MAXSEG_64K /* * Check if the source is greater * than 64K on a 16-bit machine. */ if ((uLong) zStream -> avail_in != sourceLen) return Z_BUF_ERROR; #endif zStream -> next_out = (unsigned char *) dest; zStream -> avail_out = (uInt) *destLen; if ((uLong) zStream -> avail_out != *destLen) return Z_BUF_ERROR; result = deflate(zStream, Z_FINISH); if (result != Z_STREAM_END) { deflateReset(zStream); return (result == Z_OK ? Z_BUF_ERROR : result); } *destLen = zStream -> total_out - saveOut; result = deflateReset(zStream); return result; } int ZInitEncoder(void) { if (zInitialized == 0) { int result; zStream = malloc(sizeof(z_stream)); if (zStream == NULL) { #ifdef PANIC fprintf(stderr, "******ZInitEncoder: PANIC! Failed to allocate memory for the stream.\n"); #endif return -1; } zStream -> zalloc = (alloc_func) 0; zStream -> zfree = (free_func) 0; zStream -> opaque = (voidpf) 0; #ifdef TEST fprintf(stderr, "******ZInitEncoder: Initializing compressor with level [%d] and strategy [%d].\n", zCompressionLevel, zCompressionStrategy); #endif result = deflateInit2(zStream, zCompressionLevel, Z_DEFLATED, 15, 9, zCompressionStrategy); if (result != Z_OK) { #ifdef PANIC fprintf(stderr, "******ZInitEncoder: Failed to initialize the compressor with error [%s].\n", zError(result)); #endif return -1; } zInitialized = 1; } return zInitialized; } int ZResetEncoder(void) { int result; if (zInitialized == 1) { result = deflateEnd(zStream); if (result != Z_OK) { #ifdef WARNING fprintf(stderr, "******ZResetEncoder: WARNING! Failed to deinitialize the compressor with error [%s].\n", zError(result)); #endif } free(zStream); } zInitialized = 0; return 1; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/compext/Z.h0000644000000000000000000000447113614532331020724 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef Z_H #define Z_H #ifdef __cplusplus extern "C" { #endif int ZInitEncoder( #if NeedFunctionPrototypes void #endif ); int ZResetEncoder( #if NeedFunctionPrototypes void #endif ); extern char *ZCompressData( #if NeedFunctionPrototypes const char* /* data */, unsigned int /* size */, int /* threshold */, int /* level */, int /* strategy */, unsigned int* /* compressed_size */ #endif ); #ifdef __cplusplus } #endif #endif /* Z_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Composite.c0000644000000000000000000001474413614532331020775 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "scrnintstr.h" #include "windowstr.h" #include "Agent.h" #include "Screen.h" #include "Display.h" #include "Options.h" #include "Windows.h" #include "X11/include/Xcomposite_nxagent.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG /* * Set if the composite extension is supported by the remote display. */ int nxagentCompositeEnable = UNDEFINED; void nxagentCompositeExtensionInit(void) { /* * Set the flag only if the initialization completes. */ nxagentCompositeEnable = 0; if (nxagentOption(Composite) == 1) { int eventBase, errorBase; #ifdef TEST fprintf(stderr, "nxagentCompositeExtensionInit: Checking if the composite extension is supported.\n"); #endif if (XCompositeQueryExtension(nxagentDisplay, &eventBase, &errorBase) == 1) { /* * At the moment we don't need to care the version of the * extension. */ #ifdef TEST int major = -1; int minor = -1; XCompositeQueryVersion(nxagentDisplay, &major, &minor); fprintf(stderr, "nxagentCompositeExtensionInit: The remote display supports version [%d] " "minor [%d].\n", major, minor); if (major < 0 || minor < 2) { #ifdef WARNING fprintf(stderr, "nxagentCompositeExtensionInit: WARNING! Potentially incompatible version " "[%d] minor [%d] detected.\n", major, minor); #endif } #endif #ifdef TEST fprintf(stderr, "nxagentCompositeExtensionInit: Enabling the use of the composite extension.\n"); #endif nxagentCompositeEnable = 1; } #ifdef TEST else { fprintf(stderr, "nxagentCompositeExtensionInit: Composite extension not supported on this display.\n"); } #endif } #ifdef TEST else { fprintf(stderr, "nxagentCompositeExtensionInit: Use of the composite extension not enabled.\n"); } #endif } void nxagentRedirectDefaultWindows(void) { if (nxagentOption(Rootless) == 1 || nxagentCompositeEnable == 0) { #ifdef TEST fprintf(stderr, "nxagentRedirectDefaultWindows: Not redirecting default " "windows with rootless mode [%d] and composite [%d].\n", nxagentOption(Rootless), nxagentCompositeEnable); #endif return; } for (int i = 0; i < screenInfo.numScreens; i++) { WindowPtr pWin = screenInfo.screens[i]->root; ScreenPtr pScreen = pWin -> drawable.pScreen; #ifdef TEST fprintf(stderr, "nxagentRedirectDefaultWindows: WARNING! Redirecting default window id [%ld] " "to off-screen memory.\n", (long int)nxagentDefaultWindows[pScreen->myNum]); #endif /* * When trying to redirect only the top level window, and not the * subwindows, we incur in a strange be- haviour. The top level is * unmapped, mapped, unmap- ped and then reparented. This at first * makes the agent think that the window manager is gone, then the * agent window disappears. To make thinks even more weird, this * happens only at reconnection. */ XCompositeRedirectSubwindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], CompositeRedirectAutomatic); } } void nxagentRedirectWindow(WindowPtr pWin) { if (nxagentOption(Rootless) == 0 || nxagentCompositeEnable == 0) { #ifdef TEST fprintf(stderr, "nxagentRedirectWindow: Not redirecting window id [%ld] " "to off-screen memory with rootless mode [%d] and composite [%d].\n", nxagentWindow(pWin), nxagentOption(Rootless), nxagentCompositeEnable); #endif return; } #ifdef TEST fprintf(stderr, "nxagentRedirectWindow: WARNING! Redirecting window id [%ld] " "to off-screen memory.\n", (long int)nxagentWindow(pWin)); #endif XCompositeRedirectWindow(nxagentDisplay, nxagentWindow(pWin), CompositeRedirectAutomatic); nxagentWindowPriv(pWin) -> isRedirected = 1; } void nxagentUnredirectWindow(WindowPtr pWin) { if (nxagentWindowPriv(pWin) -> isRedirected == 1) { #ifdef TEST fprintf(stderr, "nxagentUnredirectWindow: Disabling redirection of window id [%ld] " "to off-screen memory.\n", nxagentWindow(pWin)); #endif XCompositeUnredirectWindow(nxagentDisplay, nxagentWindow(pWin), CompositeRedirectAutomatic); nxagentWindowPriv(pWin) -> isRedirected = 0; } #ifdef WARNING else { fprintf(stderr, "nxagentUnredirectWindow: WARNING! The window id [%ld] " "was not redirected.\n", (long int)nxagentWindow(pWin)); } #endif } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Composite.h0000644000000000000000000000463613614532331021001 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Composite_H__ #define __Composite_H__ /* * Set if the extension is present and * its use is enabled. */ extern int nxagentCompositeEnable; /* * Query the composite extension on the * remote display and set the flag if * it is supported. */ void nxagentCompositeExtensionInit(void); /* * Let the X server redirect the window * on the off-screen memory. */ void nxagentRedirectDefaultWindows(void); /* * Enable or disabel the redirection of * the given window. */ void nxagentRedirectWindow(WindowPtr pWin); void nxagentUnredirectWindow(WindowPtr pWin); #endif /* __Composite_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Cursor.c0000644000000000000000000003645413614532331020312 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #include "X.h" #include "Xproto.h" #include "screenint.h" #include "input.h" #include "misc.h" #include "cursor.h" #include "cursorstr.h" #include "scrnintstr.h" #include "servermd.h" #include "inputstr.h" #include "Agent.h" #include "Display.h" #include "Options.h" #include "Screen.h" #include "Cursor.h" #include "Image.h" #include "Visual.h" #include "Keyboard.h" #include "Args.h" #include "Windows.h" #include "Events.h" #include "Render.h" #include "Client.h" #include "Utils.h" #include "windowstr.h" #include "resource.h" #include "compext/Compext.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG /* * Defined in Display.c. There are huge problems mixing the GC * definition in Xlib with the server code. This must be reworked. */ extern XlibGC nxagentBitmapGC; /* * From NXevents.c. */ extern CursorPtr GetSpriteCursor(void); void nxagentConstrainCursor(ScreenPtr pScreen, BoxPtr pBox) { #ifdef TEST int width = nxagentOption(RootWidth); int height = nxagentOption(RootHeight); if (pBox->x1 <= 0 && pBox->y1 <= 0 && pBox->x2 >= width && pBox->y2 >= height) { fprintf(stderr, "%s: Called with box [%d,%d,%d,%d]. Skipping the operation.\n", __func__, pBox->x1, pBox->y1, pBox->x2, pBox->y2); } else { fprintf(stderr, "%s: WARNING! Called with box [%d,%d,%d,%d].\n", __func__, pBox->x1, pBox->y1, pBox->x2, pBox->y2); } #endif } void nxagentCursorLimits(ScreenPtr pScreen, CursorPtr pCursor, BoxPtr pHotBox, BoxPtr pTopLeftBox) { *pTopLeftBox = *pHotBox; } Bool nxagentDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor) { /* * Don't define the root cursor so that nxagent root window inherits * the parent's cursor. */ Cursor cursor = (pCursor != rootCursor) ? nxagentCursor(pCursor, pScreen): None; if (nxagentOption(Rootless) == False) { XDefineCursor(nxagentDisplay, nxagentInputWindows[pScreen -> myNum], cursor); #ifdef TEST fprintf(stderr, "%s: Called for cursor at [%p] with private [%p].\n", __func__, (void *) pCursor, pCursor->devPriv[pScreen->myNum]); #endif } return True; } Bool nxagentRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) { #ifdef TEST fprintf(stderr, "%s: Called for cursor at [%p].\n", __func__, (void *) pCursor); #endif unsigned long valuemask = GCFunction | GCPlaneMask | GCForeground | GCBackground | GCClipMask; XGCValues values = { .function = GXcopy, .plane_mask = AllPlanes, .foreground = 1L, .background = 0L, .clip_mask = None, }; XChangeGC(nxagentDisplay, nxagentBitmapGC, valuemask, &values); Pixmap source = XCreatePixmap(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], pCursor->bits->width, pCursor->bits->height, 1); Pixmap mask = XCreatePixmap(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], pCursor->bits->width, pCursor->bits->height, 1); XImage *image = XCreateImage(nxagentDisplay, nxagentDefaultVisual(pScreen), 1, XYBitmap, 0, (char *)pCursor->bits->source, pCursor->bits->width, pCursor->bits->height, BitmapPad(nxagentDisplay), 0); /* * If we used nxagentImageNormalize() here, we'd swap our own cursor * data in place. Change byte_order and bitmap_bit_order in the * image struct to let Xlib do the swap for us. */ image -> byte_order = IMAGE_BYTE_ORDER; image -> bitmap_bit_order = BITMAP_BIT_ORDER; NXCleanImage(image); XPutImage(nxagentDisplay, source, nxagentBitmapGC, image, 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height); SAFE_XFree(image); image = XCreateImage(nxagentDisplay, nxagentDefaultVisual(pScreen), 1, XYBitmap, 0, (char *)pCursor->bits->mask, pCursor->bits->width, pCursor->bits->height, BitmapPad(nxagentDisplay), 0); image -> byte_order = IMAGE_BYTE_ORDER; image -> bitmap_bit_order = BITMAP_BIT_ORDER; NXCleanImage(image); XPutImage(nxagentDisplay, mask, nxagentBitmapGC, image, 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height); SAFE_XFree(image); XColor fg_color = { .red = pCursor->foreRed, .green = pCursor->foreGreen, .blue = pCursor->foreBlue, }; XColor bg_color = { .red = pCursor->backRed, .green = pCursor->backGreen, .blue = pCursor->backBlue, }; pCursor->devPriv[pScreen->myNum] = (void *) malloc(sizeof(nxagentPrivCursor)); nxagentCursorPriv(pCursor, pScreen)->cursor = XCreatePixmapCursor(nxagentDisplay, source, mask, &fg_color, &bg_color, pCursor->bits->xhot, pCursor->bits->yhot); nxagentCursorUsesRender(pCursor, pScreen) = 0; #ifdef TEST fprintf(stderr, "%s: Set cursor private at [%p] cursor is [%ld].\n", __func__, (void *) nxagentCursorPriv(pCursor, pScreen), nxagentCursorPriv(pCursor, pScreen) -> cursor); #endif XFreePixmap(nxagentDisplay, source); XFreePixmap(nxagentDisplay, mask); return True; } Bool nxagentUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) { if (nxagentCursorUsesRender(pCursor, pScreen)) { PicturePtr pPicture = nxagentCursorPicture(pCursor, pScreen); FreePicture(pPicture, pPicture -> id); } if (nxagentCursor(pCursor, pScreen) != None) { XFreeCursor(nxagentDisplay, nxagentCursor(pCursor, pScreen)); nxagentCursor(pCursor, pScreen) = None; } free(nxagentCursorPriv(pCursor, pScreen)); return True; } void nxagentRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed) { XColor fg_color = { .red = pCursor->foreRed, .green = pCursor->foreGreen, .blue = pCursor->foreBlue, }; XColor bg_color = { .red = pCursor->backRed, .green = pCursor->backGreen, .blue = pCursor->backBlue, }; XRecolorCursor(nxagentDisplay, nxagentCursor(pCursor, pScreen), &fg_color, &bg_color); } Bool (*nxagentSetCursorPositionW)(ScreenPtr pScreen, int x, int y, Bool generateEvent); Bool nxagentSetCursorPosition(ScreenPtr pScreen, int x, int y, Bool generateEvent) { if (generateEvent != 0) { return (*nxagentSetCursorPositionW)(pScreen, x, y, generateEvent); } else { /* * Calling miSetCursorPosition with generateEvent == 0 causes a * crash in miPoiterUpdate(). */ return 1; } } void nxagentReconnectCursor(void * p0, XID x1, void * p2) { Bool* pBool = (Bool*)p2; CursorPtr pCursor = (CursorPtr) p0; #if defined( TEST) || defined(NXAGENT_RECONNECT_CURSOR_DEBUG) fprintf(stderr, "%s: pCursor at [%p]\n", __func__, pCursor); #endif if (!*pBool || !pCursor) { return; } if (nxagentCursorPriv(pCursor, nxagentDefaultScreen) == 0) { if (nxagentIsAnimCursor(pCursor)) { #ifdef TEST fprintf(stderr, "%s: nxagentIsAnimCursor pCursor at [%p]\n", __func__, pCursor); #endif AnimCurPtr ac = nxagentGetAnimCursor(pCursor); for (int j = 0; j < ac->nelt; j++) { nxagentReconnectCursor (ac->elts[j].pCursor, x1, p2); #ifdef TEST fprintf(stderr, "%s: Iteration [%d] pCursor at [%p]\n", __func__, j, ac->elts[j].pCursor); #endif } } } else { if (nxagentCursorUsesRender(pCursor, nxagentDefaultScreen)) { PicturePtr pPicture = nxagentCursorPicture(pCursor, nxagentDefaultScreen); int ret = 1; nxagentReconnectPicture(pPicture, 0, &ret); nxagentRenderRealizeCursor(nxagentDefaultScreen, pCursor); } else { free(nxagentCursorPriv(pCursor, nxagentDefaultScreen)); if (!nxagentRealizeCursor(nxagentDefaultScreen, pCursor)) { fprintf(stderr, "%s: nxagentRealizeCursor failed\n", __func__); *pBool = False; } } } #ifdef NXAGENT_RECONNECT_CURSOR_DEBUG fprintf(stderr, "%s: %p - ID %lx\n", __func__, pCursor, nxagentCursor(pCursor, nxagentDefaultScreen)); #endif } /* * The parameter is ignored at the moment. */ void nxagentReDisplayCurrentCursor(void) { CursorPtr pCursor = GetSpriteCursor(); if (pCursor && nxagentCursorPriv(pCursor, nxagentDefaultScreen) && nxagentCursor(pCursor, nxagentDefaultScreen)) { nxagentDisplayCursor(nxagentDefaultScreen, pCursor); } } Bool nxagentReconnectAllCursor(void *p0) { Bool r = True; GrabPtr grab = inputInfo.pointer -> grab; #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_CURSOR_DEBUG) fprintf(stderr, "%s\n", __func__); #endif for (int i = 0; i < MAXCLIENTS; r = 1, i++) { if (clients[i]) { FindClientResourcesByType(clients[i], RT_CURSOR, nxagentReconnectCursor, &r); #ifdef WARNING if (r == False) { fprintf(stderr, "%s: WARNING! Failed to recreate " "cursor for client [%d].\n", __func__, i); } #endif } } if (grab) { nxagentReconnectCursor(grab -> cursor, 0, &r); } return r; } void nxagentDisconnectCursor(void * p0, XID x1, void * p2) { Bool* pBool = (Bool *) p2; CursorPtr pCursor = (CursorPtr) p0; if (!*pBool || !pCursor) { return; } if (nxagentCursorPriv(pCursor, nxagentDefaultScreen) == 0) { if (nxagentIsAnimCursor(pCursor)) { #ifdef TEST fprintf(stderr, "%s: nxagentIsAnimCursor pCursor at [%p]\n", __func__, pCursor); #endif AnimCurPtr ac = nxagentGetAnimCursor(pCursor); for (int j = 0; j < ac->nelt; j++) { nxagentDisconnectCursor (ac->elts[j].pCursor, x1, p2); #ifdef TEST fprintf(stderr, "%s: Iteration [%d] pCursor at [%p]\n", __func__, j, ac->elts[j].pCursor); #endif } } return; } #ifdef NXAGENT_RECONNECT_CURSOR_DEBUG fprintf(stderr, "%s: %p - ID %lx\n", __func__, pCursor, nxagentCursor(pCursor, nxagentDefaultScreen)); #endif #ifdef TEST fprintf(stderr, "%s: Called with bool [%d].\n", __func__, *pBool); fprintf(stderr, "%s: Pointer to cursor is [%p] with counter [%d].\n", __func__, (void *) pCursor, pCursor -> refcnt); fprintf(stderr, "%s: Dummy screen is at [%p].\n", __func__, (void *) nxagentDefaultScreen); fprintf(stderr, "%s: Cursor private is at [%p].\n", __func__, (void *) nxagentCursorPriv(pCursor, nxagentDefaultScreen)); #endif #ifdef TEST fprintf(stderr, "%s: Dummy screen number is [%d].\n", __func__, nxagentDefaultScreen -> myNum); fprintf(stderr, "%s: Cursor is [%ld].\n", __func__, nxagentCursor(pCursor, nxagentDefaultScreen)); #endif nxagentCursor(pCursor, nxagentDefaultScreen) = None; if (nxagentCursorUsesRender(pCursor, nxagentDefaultScreen)) { PicturePtr pPicture = nxagentCursorPicture(pCursor, nxagentDefaultScreen); int ret = 1; #if defined(NXAGENT_RECONNECT_CURSOR_DEBUG) || defined(NXAGENT_RECONNECT_PICTURE_DEBUG) fprintf(stderr, "%s: disconnecting attached picture %p\n", __func__, pPicture); #endif nxagentDisconnectPicture(pPicture, 0, &ret); } } void nxagentDisconnectAllCursor(void) { Bool r = True; GrabPtr grab = inputInfo.pointer -> grab; #ifdef TEST fprintf(stderr, "%s: Going to iterate through cursor resources.\n", __func__); #endif for (int i = 0; i < MAXCLIENTS; r = 1, i++) { if (clients[i]) { FindClientResourcesByType(clients[i], RT_CURSOR, nxagentDisconnectCursor, &r); #ifdef WARNING if (r == False) { fprintf(stderr, "%s: WARNING! Failed to disconnect " "cursor for client [%d].\n", __func__, i); } #endif } } if (grab) { nxagentDisconnectCursor(grab -> cursor, 0, &r); } return; } #ifdef NXAGENT_RECONNECT_CURSOR_DEBUG void nxagentPrintCursorInfo(CursorPtr pCursor, char msg[]) { fprintf(stderr, "%s: %p - ID %lx - ref count %d\n", msg, pCursor, nxagentCursor(pCursor, nxagentDefaultScreen), pCursor->refcnt); } void nxagentListCursor(void *p0, void *p1, void *p2) { CursorPtr pCursor = (CursorPtr)p0; nxagentPrintCursorInfo(pCursor, "CursorDebug:"); } void nxagentListCursors(void) { Bool r = True; for (int i = 0; i < MAXCLIENTS; r = 1, i++) { if (clients[i]) { FindClientResourcesByType(clients[i], RT_CURSOR, nxagentListCursor, &r); #ifdef WARNING if (r == False) { fprintf(stderr, "%s: WARNING! Failed to list cursor for client [%d].\n", __func__, i); } #endif } } return True; } #endif /* NXAGENT_RECONNECT_CURSOR_DEBUG */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Cursor.h0000644000000000000000000001077613614532331020316 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #ifndef __Cursor_H__ #define __Cursor_H__ #include "cursorstr.h" #include "picturestr.h" typedef struct { Cursor cursor; PicturePtr picture; int uses_render; int x; int y; } nxagentPrivCursor; /* * _AnimCurElt and _AnimCur already defined in animcur.c. */ typedef struct _AnimCurElt { CursorPtr pCursor; CARD32 delay; } AnimCurElt; typedef struct _AnimCur { int nelt; AnimCurElt *elts; } AnimCurRec, *AnimCurPtr; CursorBitsPtr nxagentAnimCursorBits; #define nxagentIsAnimCursor(c) ((c)->bits == nxagentAnimCursorBits) #define nxagentGetAnimCursor(c) ((AnimCurPtr) ((c) + 1)) #define nxagentCursorPriv(pCursor, pScreen) \ ((nxagentPrivCursor *)((pCursor)->devPriv[pScreen->myNum])) #define nxagentCursor(pCursor, pScreen) \ (nxagentCursorPriv(pCursor, pScreen)->cursor) #define nxagentCursorPicture(pCursor, pScreen) \ (nxagentCursorPriv(pCursor, pScreen)->picture) #define nxagentCursorUsesRender(pCursor, pScreen) \ (nxagentCursorPriv(pCursor, pScreen)->uses_render) #define nxagentCursorXOffset(pCursor, pScreen) \ (nxagentCursorPriv(pCursor, pScreen)->x) #define nxagentCursorYOffset(pCursor, pScreen) \ (nxagentCursorPriv(pCursor, pScreen)->y) void nxagentConstrainCursor(ScreenPtr pScreen, BoxPtr pBox); void nxagentCursorLimits(ScreenPtr pScreen, CursorPtr pCursor, BoxPtr pHotBox, BoxPtr pTopLeftBox); Bool nxagentDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor); Bool nxagentRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); Bool nxagentUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); void nxagentRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed); Bool nxagentSetCursorPosition(ScreenPtr pScreen, int x, int y, Bool generateEvent); extern Bool (*nxagentSetCursorPositionW)(ScreenPtr pScreen, int x, int y, Bool generateEvent); void nxagentDisconnectCursor(void * p0, XID x1, void * p2); void nxagentReconnectCursor(void * p0, XID x1, void * p2); void nxagentReDisplayCurrentCursor(void); Bool nxagentReconnectAllCursor(void *p0); void nxagentDisconnectAllCursor(void); #endif /* __Cursor_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Dialog.c0000644000000000000000000003610513614532331020225 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include #include #include #include #include #include "scrnintstr.h" #include "Agent.h" #include #include "opaque.h" #include "Args.h" #include "Display.h" #include "Dialog.h" #include "Utils.h" #include #include "compext/Compext.h" #include /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG int nxagentKillDialogPid = 0; int nxagentSuspendDialogPid = 0; int nxagentRootlessDialogPid = 0; int nxagentPulldownDialogPid = 0; int nxagentFontsReplacementDialogPid = 0; int nxagentEnableRandRModeDialogPid = 0; int nxagentDisableRandRModeDialogPid = 0; int nxagentEnableDeferModePid = 0; int nxagentDisableDeferModePid = 0; int nxagentEnableAutograbModePid = 0; int nxagentDisableAutograbModePid = 0; static int nxagentFailedReconnectionDialogPid = 0; char nxagentPulldownWindow[NXAGENTPULLDOWNWINDOWLENGTH]; char nxagentFailedReconnectionMessage[NXAGENTFAILEDRECONNECTIONMESSAGELENGTH]; void nxagentResetDialog(int pid) { if (pid == nxagentRootlessDialogPid) { #ifdef TEST fprintf(stderr, "nxagentResetDialog: Resetting rootless dialog pid [%d].\n", nxagentRootlessDialogPid); #endif nxagentRootlessDialogPid = 0; } else if (pid == nxagentPulldownDialogPid) { #ifdef TEST fprintf(stderr, "nxagentResetDialog: Resetting pulldown dialog pid [%d].\n", nxagentPulldownDialogPid); #endif nxagentPulldownDialogPid = 0; } else if (pid == nxagentFontsReplacementDialogPid) { #ifdef TEST fprintf(stderr, "nxagentResetDialog: Resetting fonts replacement dialog pid [%d].\n", nxagentFontsReplacementDialogPid); #endif nxagentFontsReplacementDialogPid = 0; } else if (pid == nxagentKillDialogPid) { #ifdef TEST fprintf(stderr, "nxagentResetDialog: Resetting kill dialog pid [%d].\n", nxagentKillDialogPid); #endif nxagentKillDialogPid = 0; } else if (pid == nxagentSuspendDialogPid) { #ifdef TEST fprintf(stderr, "nxagentResetDialog: Resetting suspend dialog pid [%d].\n", nxagentSuspendDialogPid); #endif nxagentSuspendDialogPid = 0; } else if (pid == nxagentFailedReconnectionDialogPid) { #ifdef TEST fprintf(stderr, "nxagentResetDialog: Resetting Failed Reconnection dialog pid [%d].\n", nxagentFailedReconnectionDialogPid); #endif nxagentFailedReconnectionDialogPid = 0; } else if (pid == nxagentEnableRandRModeDialogPid) { #ifdef TEST fprintf(stderr, "nxagentResetDialog: Resetting RandR mode dialog pid [%d].\n", nxagentEnableRandRModeDialogPid); #endif nxagentEnableRandRModeDialogPid = 0; } else if (pid == nxagentDisableRandRModeDialogPid) { #ifdef TEST fprintf(stderr, "nxagentResetDialog: Resetting NoRandR mode dialog pid [%d].\n", nxagentDisableRandRModeDialogPid); #endif nxagentDisableRandRModeDialogPid = 0; } else if (pid == nxagentEnableDeferModePid) { #ifdef TEST fprintf(stderr, "nxagentResetDialog: Resetting enable defer mode dialog pid [%d].\n", nxagentEnableDeferModePid); #endif nxagentEnableDeferModePid = 0; } else if (pid == nxagentDisableDeferModePid) { #ifdef TEST fprintf(stderr, "nxagentResetDialog: Resetting disable defer mode dialog pid [%d].\n", nxagentDisableDeferModePid); #endif nxagentDisableDeferModePid = 0; } else if (pid == nxagentEnableAutograbModePid) { #ifdef TEST fprintf(stderr, "nxagentResetDialog: Resetting enable autograb mode dialog pid [%d].\n", nxagentEnableAutograbModePid); #endif nxagentEnableAutograbModePid = 0; } else if (pid == nxagentDisableAutograbModePid) { #ifdef TEST fprintf(stderr, "nxagentResetDialog: Resetting disable autograb mode dialog pid [%d].\n", nxagentDisableAutograbModePid); #endif nxagentDisableAutograbModePid = 0; } } void nxagentLaunchDialog(DialogType dialogType) { sigset_t set, oldSet; int *pid; char *type; char *message; int local; const char *window = NULL; switch (dialogType) { case DIALOG_KILL_SESSION: { message = DIALOG_KILL_SESSION_MESSAGE; type = DIALOG_KILL_SESSION_TYPE; local = DIALOG_KILL_SESSION_LOCAL; pid = &nxagentKillDialogPid; break; } case DIALOG_SUSPEND_SESSION: { message = DIALOG_SUSPEND_SESSION_MESSAGE; type = DIALOG_SUSPEND_SESSION_TYPE; local = DIALOG_SUSPEND_SESSION_LOCAL; pid = &nxagentSuspendDialogPid; break; } case DIALOG_ROOTLESS: { message = DIALOG_ROOTLESS_MESSAGE; type = DIALOG_ROOTLESS_TYPE; local = DIALOG_ROOTLESS_LOCAL; pid = &nxagentRootlessDialogPid; break; } case DIALOG_PULLDOWN: { message = DIALOG_PULLDOWN_MESSAGE; type = DIALOG_PULLDOWN_TYPE; local = DIALOG_PULLDOWN_LOCAL; pid = &nxagentPulldownDialogPid; window = nxagentPulldownWindow; break; } case DIALOG_FONT_REPLACEMENT: { message = DIALOG_FONT_REPLACEMENT_MESSAGE; type = DIALOG_FONT_REPLACEMENT_TYPE; local = DIALOG_FONT_REPLACEMENT_LOCAL; pid = &nxagentFontsReplacementDialogPid; break; } case DIALOG_FAILED_RECONNECTION: { message = DIALOG_FAILED_RECONNECTION_MESSAGE; type = DIALOG_FAILED_RECONNECTION_TYPE; local = DIALOG_FAILED_RECONNECTION_LOCAL; pid = &nxagentFailedReconnectionDialogPid; break; } case DIALOG_ENABLE_DESKTOP_RESIZE_MODE: { message = DIALOG_ENABLE_DESKTOP_RESIZE_MODE_MESSAGE; type = DIALOG_ENABLE_DESKTOP_RESIZE_MODE_TYPE; local = DIALOG_ENABLE_DESKTOP_RESIZE_MODE_LOCAL; pid = &nxagentEnableRandRModeDialogPid; break; } case DIALOG_DISABLE_DESKTOP_RESIZE_MODE: { message = DIALOG_DISABLE_DESKTOP_RESIZE_MODE_MESSAGE; type = DIALOG_DISABLE_DESKTOP_RESIZE_MODE_TYPE; local = DIALOG_DISABLE_DESKTOP_RESIZE_MODE_LOCAL; pid = &nxagentDisableRandRModeDialogPid; break; } case DIALOG_ENABLE_DEFER_MODE: { message = DIALOG_ENABLE_DEFER_MODE_MESSAGE; type = DIALOG_ENABLE_DEFER_MODE_TYPE; local = DIALOG_ENABLE_DEFER_MODE_LOCAL; pid = &nxagentEnableDeferModePid; break; } case DIALOG_DISABLE_DEFER_MODE: { message = DIALOG_DISABLE_DEFER_MODE_MESSAGE; type = DIALOG_DISABLE_DEFER_MODE_TYPE; local = DIALOG_DISABLE_DEFER_MODE_LOCAL; pid = &nxagentDisableDeferModePid; break; } case DIALOG_ENABLE_AUTOGRAB_MODE: { message = DIALOG_ENABLE_AUTOGRAB_MODE_MESSAGE; type = DIALOG_ENABLE_AUTOGRAB_MODE_TYPE; local = DIALOG_ENABLE_AUTOGRAB_MODE_LOCAL; pid = &nxagentEnableAutograbModePid; break; } case DIALOG_DISABLE_AUTOGRAB_MODE: { message = DIALOG_DISABLE_AUTOGRAB_MODE_MESSAGE; type = DIALOG_DISABLE_AUTOGRAB_MODE_TYPE; local = DIALOG_DISABLE_AUTOGRAB_MODE_LOCAL; pid = &nxagentDisableAutograbModePid; break; } default: { #ifdef WARNING fprintf(stderr, "nxagentLaunchDialog: Unknown Dialog type [%d].\n", dialogType); #endif return; } } #ifdef TEST fprintf(stderr, "nxagentLaunchDialog: Launching dialog type [%d] message [%s].\n", type, message); #endif char *dialogDisplay = NULL; int len = 0; if (dialogType == DIALOG_FAILED_RECONNECTION) { len = asprintf(&dialogDisplay, "%s", nxagentDisplayName); } else { len = asprintf(&dialogDisplay, ":%s", display); } if (len == -1) { #ifdef DEBUG fprintf(stderr, "%s: could not allocate display string.\n", __func__); #endif return; } /* * We don't want to receive SIGCHLD before we store the child pid. */ sigemptyset(&set); sigaddset(&set, SIGCHLD); sigprocmask(SIG_BLOCK, &set, &oldSet); *pid = NXTransDialog(nxagentDialogName, message, window, type, local, dialogDisplay); #ifdef TEST fprintf(stderr, "nxagentLaunchDialog: Launched dialog %s with pid [%d] on display %s.\n", DECODE_DIALOG_TYPE(dialogType), *pid, dialogDisplay); #endif SAFE_free(dialogDisplay); /* * Restore the previous set of blocked signal. */ sigprocmask(SIG_SETMASK, &oldSet, NULL); } void nxagentPulldownDialog(Window wid) { snprintf(nxagentPulldownWindow, NXAGENTPULLDOWNWINDOWLENGTH, "%ld", (long int) wid); #ifdef TEST fprintf(stderr, "nxagentPulldownDialog: Going to launch pulldown " "dialog on window [%s].\n", nxagentPulldownWindow); #endif nxagentLaunchDialog(DIALOG_PULLDOWN); nxagentPulldownWindow[0] = '\0'; } void nxagentFailedReconnectionDialog(int alert, char *error) { if (alert == 0) { #ifdef WARNING fprintf(stderr, "nxagentFailedReconnectionDialog: WARNING! No valid alert provided. " "Using the default.\n"); #endif alert = FAILED_RESUME_DISPLAY_ALERT; } if (NXDisplayError(nxagentDisplay) == 0 && NXTransRunning(NX_FD_ANY) == 1) { NXTransAlert(alert, NX_ALERT_REMOTE); /* * Make it possible to interrupt the loop with a signal. */ while (NXDisplayError(nxagentDisplay) == 0 && NXTransRunning(NX_FD_ANY) == 1) { struct timeval timeout = { .tv_sec = 30, .tv_usec = 0, }; NXTransContinue(&timeout); } } else { int pid; int status; int options = 0; snprintf(nxagentFailedReconnectionMessage, NXAGENTFAILEDRECONNECTIONMESSAGELENGTH, "Reconnection failed: %s", error); nxagentLaunchDialog(DIALOG_FAILED_RECONNECTION); while ((pid = waitpid(nxagentFailedReconnectionDialogPid, &status, options)) == -1 && errno == EINTR); if (pid == -1) { if (errno == ECHILD) { #ifdef WARNING fprintf(stderr, "nxagentFailedReconnectionDialog: Got ECHILD waiting for child [%d].\n", nxagentFailedReconnectionDialogPid); #endif nxagentFailedReconnectionDialogPid = 0; } else { fprintf(stderr, "nxagentFailedReconnectionDialog: PANIC! Got unexpected error [%s] waiting " "for child [%d].\n", strerror(errno), nxagentFailedReconnectionDialogPid); } } else if (pid > 0) { if (WIFSTOPPED(status)) { #ifdef WARNING fprintf(stderr, "nxagentFailedReconnectionDialog: Child process [%d] was stopped " "with signal [%d].\n", pid, (WSTOPSIG(status))); #endif } else { #ifdef WARNING if (WIFEXITED(status)) { fprintf(stderr, "nxagentFailedReconnectionDialog: Child process [%d] exited " "with status [%d].\n", pid, (WEXITSTATUS(status))); } else if (WIFSIGNALED(status)) { fprintf(stderr, "nxagentFailedReconnectionDialog: Child process [%d] died " "because of signal [%d].\n", pid, (WTERMSIG(status))); } #endif nxagentResetDialog(pid); } } #ifdef WARNING else if (pid == 0) { fprintf(stderr, "nxagentFailedReconnectionDialog: No own child process exited.\n"); } #endif } } void nxagentTerminateDialog(DialogType type) { int pid; switch (type) { case DIALOG_KILL_SESSION: { pid = nxagentKillDialogPid; break; } case DIALOG_SUSPEND_SESSION: { pid = nxagentSuspendDialogPid; break; } case DIALOG_ROOTLESS: { pid = nxagentRootlessDialogPid; break; } case DIALOG_PULLDOWN: { pid = nxagentPulldownDialogPid; break; } case DIALOG_FONT_REPLACEMENT: { pid = nxagentFontsReplacementDialogPid; break; } case DIALOG_FAILED_RECONNECTION: { pid = nxagentFailedReconnectionDialogPid; break; } case DIALOG_ENABLE_DESKTOP_RESIZE_MODE: { pid = nxagentEnableRandRModeDialogPid; break; } case DIALOG_DISABLE_DESKTOP_RESIZE_MODE: { pid = nxagentDisableRandRModeDialogPid; break; } case DIALOG_ENABLE_DEFER_MODE: { pid = nxagentEnableDeferModePid; break; } case DIALOG_DISABLE_DEFER_MODE: { pid = nxagentDisableDeferModePid; break; } case DIALOG_ENABLE_AUTOGRAB_MODE: { pid = nxagentEnableAutograbModePid; break; } case DIALOG_DISABLE_AUTOGRAB_MODE: { pid = nxagentDisableAutograbModePid; break; } default: { #ifdef WARNING fprintf(stderr, "nxagentTerminateDialog: Unknown dialog type [%d].\n", type); #endif return; } } if (pid > 0) { if (kill(pid, SIGTERM) == -1) { #ifdef WARNING fprintf(stderr, "nxagentTerminateDialog: Failed to terminate dialog pid [%d]: %s.\n", pid, strerror(errno)); #endif } } #ifdef DEBUG else { fprintf(stderr, "nxagentTerminateDialog: Dialog type [%d] is not running.\n", type); } #endif } void nxagentTerminateDialogs(void) { #ifdef DEBUG fprintf(stderr, "nxagentTerminateDialogs: Terminating all the running dialogs.\n"); #endif for (DialogType type = DIALOG_FIRST_TAG; type < DIALOG_LAST_TAG; type++) { nxagentTerminateDialog(type); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Dialog.h0000644000000000000000000001737313614532331020240 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Dialog_H__ #define __Dialog_H__ #include "X11/X.h" typedef enum { DIALOG_FIRST_TAG, DIALOG_KILL_SESSION = DIALOG_FIRST_TAG, DIALOG_SUSPEND_SESSION, DIALOG_ROOTLESS, DIALOG_PULLDOWN, DIALOG_FONT_REPLACEMENT, DIALOG_ENABLE_DESKTOP_RESIZE_MODE, DIALOG_DISABLE_DESKTOP_RESIZE_MODE, DIALOG_FAILED_RECONNECTION, DIALOG_ENABLE_DEFER_MODE, DIALOG_DISABLE_DEFER_MODE, DIALOG_ENABLE_AUTOGRAB_MODE, DIALOG_DISABLE_AUTOGRAB_MODE, DIALOG_LAST_TAG } DialogType; extern int nxagentKillDialogPid; extern int nxagentSuspendDialogPid; extern int nxagentRootlessDialogPid; extern int nxagentPulldownDialogPid; extern int nxagentFontsReplacementDialogPid; extern int nxagentEnableRandRModeDialogPid; extern int nxagentDisableRandRModeDialogPid; extern int nxagentEnableDeferModePid; extern int nxagentDisableDeferModePid; extern int nxagentEnableAutograbModePid; extern int nxagentDisableAutograbModePid; #define NXAGENTFAILEDRECONNECTIONMESSAGELENGTH 256 extern char nxagentFailedReconnectionMessage[NXAGENTFAILEDRECONNECTIONMESSAGELENGTH]; #define NXAGENTPULLDOWNWINDOWLENGTH 16 extern char nxagentPulldownWindow[NXAGENTPULLDOWNWINDOWLENGTH]; extern void nxagentLaunchDialog(DialogType type); extern void nxagentResetDialog(int pid); extern void nxagentTerminateDialog(DialogType type); extern void nxagentFailedReconnectionDialog(int alert, char *error); extern void nxagentPulldownDialog(Window); extern void nxagentTerminateDialogs(void); #define nxagentNoDialogIsRunning \ (nxagentSuspendDialogPid == 0 && \ nxagentKillDialogPid == 0 && \ nxagentEnableRandRModeDialogPid == 0 && \ nxagentDisableRandRModeDialogPid == 0 && \ nxagentEnableDeferModePid == 0 && \ nxagentDisableDeferModePid == 0) #define DECODE_DIALOG_TYPE(type) \ ((type) == DIALOG_KILL_SESSION ? "DIALOG_KILL_SESSION" : \ (type) == DIALOG_SUSPEND_SESSION ? "DIALOG_SUSPEND_SESSION" : \ (type) == DIALOG_ROOTLESS ? "DIALOG_ROOTLESS" : \ (type) == DIALOG_PULLDOWN ? "DIALOG_PULLDOWN" : \ (type) == DIALOG_FONT_REPLACEMENT ? "DIALOG_FONT_REPLACEMENT" : \ (type) == DIALOG_ENABLE_DESKTOP_RESIZE_MODE ? "DIALOG_ENABLE_DESKTOP_RESIZE_MODE" :\ (type) == DIALOG_DISABLE_DESKTOP_RESIZE_MODE ? "DIALOG_DISABLE_DESKTOP_RESIZE_MODE" :\ (type) == DIALOG_FAILED_RECONNECTION ? "DIALOG_FAILED_RECONNECTION" : \ (type) == DIALOG_ENABLE_DEFER_MODE ? "DIALOG_ENABLE_DEFER_MODE" : \ (type) == DIALOG_DISABLE_DEFER_MODE ? "DIALOG_DISABLE_DEFER_MODE" : \ (type) == DIALOG_ENABLE_AUTOGRAB_MODE ? "DIALOG_ENABLE_AUTGRAB_MODE" : \ (type) == DIALOG_DISABLE_AUTOGRAB_MODE ? "DIALOG_DISABLE_AUTOGRAB_MODE" : \ "UNKNOWN_DIALOG") /* * Message to be showed to users when the close * button is pressed. The right message is chosen * according if session does or does not run in * persistent mode. */ #define DIALOG_KILL_SESSION_MESSAGE \ \ "\ Do you really want to close the session?\ " #define DIALOG_KILL_SESSION_TYPE "yesno" #define DIALOG_KILL_SESSION_LOCAL 0 #define DIALOG_SUSPEND_SESSION_MESSAGE \ \ "\ Press the disconnect button to disconnect the running session.\n\ You will be able to resume the session at later time. Press the\n\ terminate button to exit the session and close all the running\n\ programs.\ " #define DIALOG_SUSPEND_SESSION_TYPE "yesnosuspend" #define DIALOG_SUSPEND_SESSION_LOCAL 0 #define DIALOG_ROOTLESS_MESSAGE \ \ "\ All remote applications have been terminated.\n\ Do you want to close the session?\ " #define DIALOG_ROOTLESS_TYPE "yesno" #define DIALOG_ROOTLESS_LOCAL 0 #define DIALOG_PULLDOWN_MESSAGE \ \ nxagentPulldownWindow #define DIALOG_PULLDOWN_TYPE "pulldown" #define DIALOG_PULLDOWN_LOCAL 0 #define DIALOG_FONT_REPLACEMENT_MESSAGE \ \ "\ Unable to retrieve all the fonts currently in use. \n\ Missing fonts have been replaced.\ " #define DIALOG_FONT_REPLACEMENT_TYPE "ok" #define DIALOG_FONT_REPLACEMENT_LOCAL 0 #define DIALOG_FAILED_RECONNECTION_MESSAGE \ \ nxagentFailedReconnectionMessage #define DIALOG_FAILED_RECONNECTION_TYPE "ok" #define DIALOG_FAILED_RECONNECTION_LOCAL 0 #define DIALOG_ENABLE_DESKTOP_RESIZE_MODE_MESSAGE \ \ "\ The session is now running in desktop resize mode.\n\ You can resize the desktop by simply dragging the\n\ desktop window's border. You can press Ctrl+Alt+R\n\ again to disable this option.\ " #define DIALOG_ENABLE_DESKTOP_RESIZE_MODE_TYPE "ok" #define DIALOG_ENABLE_DESKTOP_RESIZE_MODE_LOCAL 0 #define DIALOG_DISABLE_DESKTOP_RESIZE_MODE_MESSAGE \ \ "\ The session is now running in viewport mode. You can\n\ navigate across different areas of the desktop window\n\ by dragging the desktop with the mouse or by using the\n\ arrows keys while pressing Ctrl+Alt. Press Ctrl+Alt+R\n\ again to return to the desktop resize mode.\ " #define DIALOG_DISABLE_DESKTOP_RESIZE_MODE_TYPE "ok" #define DIALOG_DISABLE_DESKTOP_RESIZE_MODE_LOCAL 0 #define DIALOG_ENABLE_DEFER_MODE_MESSAGE \ \ "\ Deferred screen updates are now enabled. You can press\n\ Ctrl+Alt+E again to disable this option.\ " #define DIALOG_ENABLE_DEFER_MODE_TYPE "ok" #define DIALOG_ENABLE_DEFER_MODE_LOCAL 0 #define DIALOG_DISABLE_DEFER_MODE_MESSAGE \ \ "\ Deferred screen updates are now disabled. You can press\n\ Ctrl+Alt+E to enable it again.\ " #define DIALOG_DISABLE_DEFER_MODE_TYPE "ok" #define DIALOG_DISABLE_DEFER_MODE_LOCAL 0 #define DIALOG_ENABLE_AUTOGRAB_MODE_MESSAGE \ \ "\ Keyboard auto-grabbing mode is now enabled. You can press\n\ Ctrl+Alt+G again to disable auto-grabbing.\ " #define DIALOG_ENABLE_AUTOGRAB_MODE_TYPE "ok" #define DIALOG_ENABLE_AUTOGRAB_MODE_LOCAL 0 #define DIALOG_DISABLE_AUTOGRAB_MODE_MESSAGE \ \ "\ Keyboard auto-grabbing mode is now disabled. You can press\n\ Ctrl+Alt+G again to re-enable auto-grabbing.\ " #define DIALOG_DISABLE_AUTOGRAB_MODE_TYPE "ok" #define DIALOG_DISABLE_AUTOGRAB_MODE_LOCAL 0 #endif /* __Dialog_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Display.c0000644000000000000000000022066313614532331020437 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #include #include #include #include #include #include #include #include #include #include #include #include "screenint.h" #include "input.h" #include "misc.h" #include "scrnintstr.h" #include "servermd.h" #include "windowstr.h" #include "dixstruct.h" #ifdef WATCH #include "unistd.h" #endif #include #include "Agent.h" #include "Display.h" #include "Visual.h" #include "Options.h" #include "Error.h" #include "Init.h" #include "Args.h" #include "Image.h" #include "Utils.h" #define Pixmap XlibPixmap #include "Icons.h" #undef Pixmap #include "Render.h" #include "Font.h" #include "Reconnect.h" #include "Events.h" #include "Dialog.h" #include "Client.h" #include "Splash.h" #include "Screen.h" #include "Handlers.h" #include #include "compext/Compext.h" #include NXAGENT_ICON_NAME #include X2GOAGENT_ICON_NAME /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG #undef WATCH Display *nxagentDisplay = NULL; XVisualInfo *nxagentVisuals = NULL; Bool nxagentTrue24 = False; int nxagentNumVisuals; int nxagentXConnectionNumber; int nxagentIOErrorHandler(Display *disp); static Bool nxagentDisplayInfoSaved = False; static Display *nxagentDisplayBackup = NULL; static XlibGC nxagentBitmapGCBackup = NULL; static XVisualInfo *nxagentVisualsRecBackup; static int nxagentNumVisualsRecBackup; static int nxagentNumDefaultColormapsRecBackup; static int *nxagentDepthsRecBackup; static int nxagentNumDepthsRecBackup; static int nxagentDefaultDepthRecBackup; static int nxagentDisplayWidthRecBackup; static int nxagentDisplayHeightRecBackup; static Bool nxagentRenderEnableRecBackup; static Bool *nxagentVisualHasBeenIgnored; static enum { NOTHING = 0, OPENED, GOT_VISUAL_INFO, ALLOC_DEF_COLORMAP, GOT_DEPTH_LIST, GOT_PIXMAP_FORMAT_LIST, EVERYTHING_DONE } reconnectDisplayState; int nxagentDefaultVisualIndex; Colormap *nxagentDefaultColormaps = NULL; int nxagentNumDefaultColormaps; int *nxagentDepths = NULL; int nxagentNumDepths; XPixmapFormatValues *nxagentPixmapFormats = NULL; XPixmapFormatValues *nxagentRemotePixmapFormats = NULL; int nxagentNumPixmapFormats; int nxagentRemoteNumPixmapFormats; Pixel nxagentBlackPixel; Pixel nxagentWhitePixel; Drawable nxagentDefaultDrawables[MAXDEPTH + 1]; Pixmap nxagentScreenSaverPixmap; /* * Also used in Cursor.c. There are huge problems using GC * definition. This is to be reworked. */ XlibGC nxagentBitmapGC; /* * The "confine" window is used in the nxagentConstrainCursor * procedure. We are currently overriding the original Xnest * behaviour. It is unclear what this window is used for. */ Window nxagentConfineWindow; Pixmap nxagentIconPixmap; Pixmap nxagentIconShape; Bool useXpmIcon = False; Bool nxagentMakeIcon(Display *disp, Pixmap *nxIcon, Pixmap *nxMask); static void nxagentInitVisuals(void); static void nxagentSetDefaultVisual(void); static void nxagentInitDepths(void); static void nxagentInitPixmapFormats(void); static int nxagentCheckForDefaultDepthCompatibility(void); static int nxagentCheckForDepthsCompatibility(void); static int nxagentCheckForPixmapFormatsCompatibility(void); static int nxagentInitAndCheckVisuals(int flexibility); static int nxagentCheckForColormapsCompatibility(int flexibility); /* * Save Internal implementation Also called in Reconnect.c. */ Display *nxagentInternalOpenDisplay(char *disp); #ifdef NXAGENT_TIMESTAMP unsigned long startTime; #endif /* * This is located in connection.c. */ extern void RejectWellKnownSockets(void); extern Bool nxagentReportWindowIds; int nxagentServerOrder(void) { int whichbyte = 1; if (*((char *) &whichbyte)) return LSBFirst; return MSBFirst; } /* * FIXME: This error handler is not printing anything in the session * log. This is OK once the session is started, because the error is * handled by the other layers, but not before that point, as the * agent would die without giving any feedback to the user (or, worse, * to the NX server). We should check how many requests have been * handled for this display and print a message if the display dies * before the session is up and running. */ /* * FIXME: This should be moved to Error.c, The other handlers should * be probably moved to Handlers.c. */ int nxagentIOErrorHandler(Display *disp) { #ifdef TEST fprintf(stderr, "nxagentIOErrorHandler: Got I/O error with nxagentException.ioError [%d].\n", nxagentException.ioError); #endif nxagentException.ioError++; #ifdef TEST fprintf(stderr, "nxagentIOErrorHandler: Set nxagentException.ioError to [%d].\n", nxagentException.ioError); #endif return 1; } /* * Force a shutdown of any connection attempt while connecting to the * remote display. This is needed to avoid a hang up in case of * loopback connections to our own listening sockets. */ static void nxagentRejectConnection(int signal) { #ifdef TEST fprintf(stderr, "nxagentRejectConnection: Going to reject client connections.\n"); #endif RejectWellKnownSockets(); #ifdef TEST fprintf(stderr, "nxagentRejectConnection: Setting new alarm to 5 seconds from now.\n"); #endif /* * A further timeout is unlikely to happen in the case of loopback * connections. */ alarm(5); } /* * Ignore the signal if the NX transport is not running. */ static void nxagentSigusrHandler(int signal) { #ifdef TEST fprintf(stderr, "nxagentSigusrHandler: Nothing to do with signal [%d].\n", signal); #endif } static void nxagentSighupHandler(int signal) { #ifdef TEST fprintf(stderr, "nxagentSighupHandler: Handling signal with state [%s] transport [%d] server " "generation [%ld].\n", DECODE_SESSION_STATE(nxagentSessionState), NXTransRunning(NX_FD_ANY), serverGeneration); #endif if (signal != SIGHUP) { #ifdef PANIC fprintf(stderr, "nxagentSighupHandler: PANIC! Invalid signal [%d] received in state [%s].\n", signal, DECODE_SESSION_STATE(nxagentSessionState)); #endif return; } if (dispatchException & DE_TERMINATE) { #ifdef TEST fprintf(stderr, "nxagentSighupHandler: Ignoring the signal while terminating the session.\n"); #endif return; } else if (nxagentSessionState == SESSION_UP) { if (nxagentOption(Persistent) == 1) { #ifdef TEST fprintf(stderr, "nxagentSighupHandler: Handling the signal by disconnecting the agent.\n"); #endif nxagentException.sigHup++; } else { #ifdef TEST fprintf(stderr, "nxagentSighupHandler: Ignoring the signal with persistency disabled.\n"); #endif } return; } else if (nxagentSessionState == SESSION_STARTING) { #ifdef TEST fprintf(stderr, "nxagentSighupHandler: Handling the signal by aborting the session.\n"); #endif nxagentException.sigHup++; return; } else if (nxagentSessionState == SESSION_DOWN) { if (NXTransRunning(NX_FD_ANY) == 1) { #ifdef TEST fprintf(stderr, "nxagentSighupHandler: Handling the signal by aborting the reconnection.\n"); #endif } else { #ifdef TEST fprintf(stderr, "nxagentSighupHandler: Handling the signal by resuming the session.\n"); #endif } nxagentException.sigHup++; return; } #ifdef WARNING fprintf(stderr, "nxagentSighupHandler: WARNING! Ignoring the signal in state [%s].\n", DECODE_SESSION_STATE(nxagentSessionState)); #endif } static void nxagentSigchldHandler(int signal) { int pid = 0; int status; #ifdef TEST fprintf(stderr, "nxagentSigchldHandler: Going to check the children processes.\n"); #endif int options = WNOHANG | WUNTRACED; /* * Try with the pid of the dialog process. Leave the other children * unaffected. */ if (nxagentRootlessDialogPid) { pid = waitpid(nxagentRootlessDialogPid, &status, options); if (pid == -1 && errno == ECHILD) { #ifdef WARNING fprintf(stderr, "nxagentSigchldHandler: Got ECHILD waiting for child %d (Rootless dialog).\n", nxagentRootlessDialogPid); #endif pid = nxagentRootlessDialogPid = 0; } } if (pid == 0 && nxagentPulldownDialogPid) { pid = waitpid(nxagentPulldownDialogPid, &status, options); if (pid == -1 && errno == ECHILD) { #ifdef WARNING fprintf(stderr, "nxagentSigchldHandler: Got ECHILD waiting for child %d (Pulldown dialog).\n", nxagentPulldownDialogPid); #endif pid = nxagentPulldownDialogPid = 0; } } if (pid == 0 && nxagentKillDialogPid) { pid = waitpid(nxagentKillDialogPid, &status, options); if (pid == -1 && errno == ECHILD) { #ifdef WARNING fprintf(stderr, "nxagentSigchldHandler: Got ECHILD waiting for child %d (Kill dialog).\n", nxagentKillDialogPid); #endif pid = nxagentKillDialogPid = 0; } } if (pid == 0 && nxagentSuspendDialogPid) { pid = waitpid(nxagentSuspendDialogPid, &status, options); if (pid == -1 && errno == ECHILD) { #ifdef WARNING fprintf(stderr, "nxagentSigchldHandler: Got ECHILD waiting for child %d (Suspend dialog).\n", nxagentSuspendDialogPid); #endif pid = nxagentSuspendDialogPid = 0; } } if (pid == 0 && nxagentFontsReplacementDialogPid) { pid = waitpid(nxagentFontsReplacementDialogPid, &status, options); if (pid == -1 && errno == ECHILD) { #ifdef WARNING fprintf(stderr, "nxagentSigchldHandler: Got ECHILD waiting for child %d (Fonts replacement).\n", nxagentFontsReplacementDialogPid); #endif pid = nxagentFontsReplacementDialogPid = 0; } } if (pid == 0 && nxagentEnableRandRModeDialogPid) { pid = waitpid(nxagentEnableRandRModeDialogPid, &status, options); if (pid == -1 && errno == ECHILD) { #ifdef WARNING fprintf(stderr, "nxagentSigchldHandler: Got ECHILD waiting for child %d (EnableRandRMode dialog).\n", nxagentEnableRandRModeDialogPid); #endif pid = nxagentEnableRandRModeDialogPid = 0; } } if (pid == 0 && nxagentDisableRandRModeDialogPid) { pid = waitpid(nxagentDisableRandRModeDialogPid, &status, options); if (pid == -1 && errno == ECHILD) { #ifdef WARNING fprintf(stderr, "nxagentSigchldHandler: Got ECHILD waiting for child %d (DisableRandRMode dialog).\n", nxagentDisableRandRModeDialogPid); #endif pid = nxagentDisableRandRModeDialogPid = 0; } } if (pid == 0 && nxagentEnableDeferModePid) { pid = waitpid(nxagentEnableDeferModePid, &status, options); if (pid == -1 && errno == ECHILD) { #ifdef WARNING fprintf(stderr, "nxagentSigchldHandler: Got ECHILD waiting for child %d (EnableDeferMode dialog).\n", nxagentEnableDeferModePid); #endif pid = nxagentEnableDeferModePid = 0; } } if (pid == 0 && nxagentDisableDeferModePid) { pid = waitpid(nxagentDisableDeferModePid, &status, options); if (pid == -1 && errno == ECHILD) { #ifdef WARNING fprintf(stderr, "nxagentSigchldHandler: Got ECHILD waiting for child %d (DisableDeferMode dialog).\n", nxagentDisableDeferModePid); #endif pid = nxagentDisableDeferModePid = 0; } } if (pid == -1) { FatalError("Got error '%s' waiting for the child.\n", strerror(errno)); } if (pid > 0) { if (WIFSTOPPED(status)) { #ifdef WARNING fprintf(stderr, "nxagentSigchldHandler: Child process [%d] was stopped " "with signal [%d].\n", pid, (WSTOPSIG(status))); #endif } else { #ifdef TEST if (WIFEXITED(status)) { fprintf(stderr, "nxagentSigchldHandler: Child process [%d] exited " "with status [%d].\n", pid, (WEXITSTATUS(status))); } else if (WIFSIGNALED(status)) { fprintf(stderr, "nxagentSigchldHandler: Child process [%d] died " "because of signal [%d].\n", pid, (WTERMSIG(status))); } #endif nxagentResetDialog(pid); } } else if (pid == 0) { #ifdef TEST fprintf(stderr, "nxagentSigchldHandler: Forwarding the signal to the NX transport.\n"); #endif NXTransSignal(SIGCHLD, NX_SIGNAL_RAISE); } return; } Display *nxagentInternalOpenDisplay(char *disp) { /* * Stop the smart schedule timer since it uses SIGALRM as we do. */ nxagentStopTimer(); /* * Install the handler rejecting a possible loopback connection. */ /* FIXME: Should print a warning if the user tries to let the agent impersonate the same display as the display where the agent is supposed to connect. We actually handle this by means of RejectWellKnownSockets() but without giving a friendly explanation for the error to the user. */ struct sigaction newAction = { .sa_handler = nxagentRejectConnection }; sigfillset(&newAction.sa_mask); newAction.sa_flags = 0; int result; struct sigaction oldAction; while (((result = sigaction(SIGALRM, &newAction, &oldAction)) == -1) && (errno == EINTR)); if (result == -1) { FatalError("Can't set alarm for rejecting connections."); } alarm(10); #ifdef TEST fprintf(stderr, "nxagentInternalOpenDisplay: Going to open the display [%s].\n", disp); #endif Display *newDisplay = XOpenDisplay(disp); alarm(0); while (((result = sigaction(SIGALRM, &oldAction, NULL)) == -1) && (errno == EINTR)); if (result == -1) { FatalError("Can't restore alarm for rejecting connections."); } #ifdef TEST fprintf(stderr, "nxagentInternalOpenDisplay: Setting the NX flush policy to immediate.\n"); #endif NXSetDisplayPolicy(nxagentDisplay, NXPolicyImmediate); #ifdef TEST fprintf(stderr, "nxagentInternalOpenDisplay: Function returned display at [%p].\n", (void *) newDisplay); #endif return newDisplay; } static void nxagentDisplayBlockHandler(Display *disp, int reason) { if (nxagentDisplay != NULL) { /* * Don't allow the smart schedule to interrupt the agent while * waiting for the remote display. */ #ifdef DEBUG fprintf(stderr, "nxagentDisplayBlockHandler: BLOCK! Stopping the smart schedule timer.\n"); #endif nxagentStopTimer(); if (reason == NXBlockRead) { #ifdef DEBUG fprintf(stderr, "nxagentDisplayBlockHandler: BLOCK! Display is blocking for [read].\n"); #endif } else { #ifdef DEBUG fprintf(stderr, "nxagentDisplayBlockHandler: BLOCK! Display is blocking for [write].\n"); #endif nxagentBlocking = 1; if (!SmartScheduleSignalEnable) { /* * Let the dispatch attend the next client. */ #ifdef DEBUG fprintf(stderr, "nxagentDisplayBlockHandler: BLOCK! Yielding with agent blocked.\n"); #endif nxagentDispatch.start = GetTimeInMillis(); nxagentDispatch.in = nxagentBytesIn; nxagentDispatch.out = nxagentBytesOut; } /* * Give a chance to the next client. */ isItTimeToYield = 1; } } } static void nxagentDisplayWriteHandler(Display *disp, int length) { if (nxagentDisplay != NULL) { #ifdef TEST fprintf(stderr, "nxagentDisplayWriteHandler: WRITE! Called with [%d] bytes written.\n", length); #endif /* * Notify the dispatch handler. */ nxagentDispatchHandler(NULL, 0, length); if (nxagentOption(LinkType) == LINK_TYPE_NONE) { nxagentFlush = GetTimeInMillis(); } } } static CARD32 nxagentRateTime = 5000; static CARD32 nxagentLastTime; static unsigned int nxagentRate = 0; int nxagentGetDataRate(void) { return nxagentRate; } static void nxagentDisplayFlushHandler(Display *disp, int length) { if (nxagentDisplay != NULL) { #ifdef TEST fprintf(stderr, "nxagentDisplayFlushHandler: FLUSH! Called with [%d] bytes flushed.\n", length); #endif nxagentCongestion = NXDisplayCongestion(nxagentDisplay); #ifdef TEST fprintf(stderr, "nxagentDisplayFlushHandler: FLUSH! Current congestion level is [%d].\n", nxagentCongestion); #endif if (nxagentOption(LinkType) != LINK_TYPE_NONE) { nxagentFlush = GetTimeInMillis(); CARD32 time = nxagentFlush - nxagentLastTime; if (time < nxagentRateTime) { nxagentRate = ((nxagentRate * (nxagentRateTime - time) + length) * 1000) / nxagentRateTime; } else { nxagentRate = (length * 1000) / nxagentRateTime; } nxagentLastTime = nxagentFlush; } } } /* * From the changelog for nx-X11-3.0.0-4: * "Added the _NXDisplayErrorPredicate function in XlibInt.c. It is * actually a pointer to a function called whenever Xlib is going to * perform a network operation. If the function returns true, the * call will be aborted and Xlib will return the control to the ap- * plication. It is up to the application to set the XlibDisplayIO- * Error flag after the _NXDisplayErrorPredicate returns true. The * function can be used to activate additional checks, besides the * normal failures detected by Xlib on the display socket. For exam- * ple, the application can set the funciton to verify if an inter- * rupt was received or if any other event occurred mandating the + end of the session." */ static int nxagentDisplayErrorPredicate(Display *disp, int error) { #ifdef TEST fprintf(stderr, "nxagentDisplayErrorPredicate: CHECK! Error is [%d] with [%d][%d][%d][%d][%d].\n", ((error == 1) || (dispatchException & DE_RESET) != 0 || (dispatchException & DE_TERMINATE) != 0 || nxagentException.sigHup > 0 || nxagentException.ioError > 0), error, (dispatchException & DE_RESET) != 0, (dispatchException & DE_TERMINATE), nxagentException.sigHup > 0, nxagentException.ioError > 0); #endif if (error == 0) { if ((dispatchException & DE_RESET) != 0 || (dispatchException & DE_TERMINATE)) { return 1; } else if (nxagentException.sigHup > 0 || nxagentException.ioError > 0) { NXForceDisplayError(disp); return 1; } } return error; } void nxagentInstallDisplayHandlers(void) { /* * If the display was already opened, be sure all structures are * freed. */ nxagentResetDisplayHandlers(); /* * We want the Xlib I/O error handler to return, instead of quitting * the application. Using setjmp()/longjmp() leaves the door open to * unexpected bugs when dealing with interaction with the other X * server layers. */ NXHandleDisplayError(1); NXSetDisplayBlockHandler(nxagentDisplayBlockHandler); NXSetDisplayWriteHandler(nxagentDisplayWriteHandler); NXSetDisplayFlushHandler(nxagentDisplayFlushHandler, NULL); /* * Override the default Xlib error handler. */ XSetIOErrorHandler(nxagentIOErrorHandler); /* * Let Xlib become aware of our interrupts. In theory we don't need * to have the error handler installed during the normal operations * and could simply let the dispatcher handle the interrupts. In * practice it's better to have Xlib invalidating the display as * soon as possible rather than incurring in the risk of entering a * loop that doesn't care checking the display errors explicitly. */ #ifdef TEST fprintf(stderr, "nxagentInstallDisplayHandlers: Installing the error function predicate.\n"); #endif NXSetDisplayErrorPredicate(nxagentDisplayErrorPredicate); } void nxagentPostInstallDisplayHandlers(void) { /* * This is executed after having opened the display, once we know * the display address. */ if (nxagentDisplay != NULL) { #ifdef TEST fprintf(stderr, "nxagentPostInstallDisplayHandlers: Initializing the NX display internals.\n"); #endif NXInitDisplay(nxagentDisplay); /* FIXME: What is the most appropriate number of elements? NXInitCache(nxagentDisplay, 128); */ NXInitCache(nxagentDisplay, 256); NXSetDisplayFlushHandler(nxagentDisplayFlushHandler, nxagentDisplay); } /* * Handler for the Xlib protocol errors. */ XSetErrorHandler(nxagentErrorHandler); } void nxagentResetDisplayHandlers(void) { if (nxagentDisplay != NULL) { /* * Free the internal nxcompext structures. */ NXResetDisplay(nxagentDisplay); /* * Remove the display descriptor from the listened sockets. */ nxagentRemoveXConnection(); /* * Restart the suspended clients. */ nxagentWakeupByReconnect(); nxagentReleaseAllSplits(); } /* * Reset the display to a healty state. */ nxagentBuffer = 0; nxagentBlocking = 0; nxagentCongestion = 0; /* * Reset the counter of synchronization requests pending. */ nxagentTokens.soft = 0; nxagentTokens.hard = 0; nxagentTokens.pending = 0; /* * Reset the current dispatch information. */ nxagentDispatch.client = UNDEFINED; nxagentDispatch.in = 0; nxagentDispatch.out = 0; nxagentDispatch.start = 0; } void nxagentInstallSignalHandlers(void) { #ifdef TEST fprintf(stderr, "nxagentInstallSignalHandlers: Installing the agent signal handlers.\n"); #endif /* * Keep the default X server's handlers for SIGINT and SIGTERM and * restore the other signals of interest to our defaults. */ struct sigaction newAction; /* * By default nxcomp installs its signal handlers. We need to * ensure that SIGUSR1 and SIGUSR2 are ignored if the NX transport * is not running. */ newAction.sa_handler = nxagentSigusrHandler; sigfillset(&newAction.sa_mask); newAction.sa_flags = 0; int result; while (((result = sigaction(SIGUSR1, &newAction, NULL)) == -1) && (errno == EINTR)); if (result == -1) { FatalError("Can't set the handler for user signal 1."); } while (((result = sigaction(SIGUSR2, &newAction, NULL)) == -1) && (errno == EINTR)); if (result == -1) { FatalError("Can't set the handler for user signal 2."); } /* * Reset the SIGALRM to the default. */ nxagentStopTimer(); newAction.sa_handler = SIG_DFL; sigfillset(&newAction.sa_mask); while (((result = sigaction(SIGALRM, &newAction, NULL)) == -1) && (errno == EINTR)); if (result == -1) { FatalError("Can't set the handler for alarm signal."); } /* * Let the smart schedule set the SIGALRM handler again. */ nxagentInitTimer(); /* * Install our own handler for the SIGHUP. */ newAction.sa_handler = nxagentSighupHandler; sigfillset(&newAction.sa_mask); newAction.sa_flags = 0; while (((result = sigaction(SIGHUP, &newAction, NULL)) == -1) && (errno == EINTR)); if (result == -1) { FatalError("Can't set the handler for session suspend."); } /* * We need to be notified about our children. */ newAction.sa_handler = nxagentSigchldHandler; sigfillset(&newAction.sa_mask); newAction.sa_flags = 0; while (((result = sigaction(SIGCHLD, &newAction, NULL)) == -1) && (errno == EINTR)); if (result == -1) { FatalError("Can't set the handler for children."); } } void nxagentPostInstallSignalHandlers(void) { #ifdef TEST fprintf(stderr, "nxagentPostInstallSignalHandlers: Dealing with the proxy signal handlers.\n"); #endif /* * Reconfigure our signal handlers to work well with the NX * transport. * * Let our handlers manage the SIGINT and SIGTERM. The following * calls will tell the NX transport to restore the old handlers * (those originally installed by us or the X server). */ NXTransSignal(SIGINT, NX_SIGNAL_DISABLE); NXTransSignal(SIGTERM, NX_SIGNAL_DISABLE); /* * Also tell the proxy to ignore the SIGHUP. */ NXTransSignal(SIGHUP, NX_SIGNAL_DISABLE); /* * Both the proxy and the agent need to catch their children, so * we'll have to send the signal to transport. */ NXTransSignal(SIGCHLD, NX_SIGNAL_DISABLE); /* * Let the NX transport take care of SIGUSR1 and SIGUSR2. */ } void nxagentResetSignalHandlers(void) { /* * Reset the signal handlers to a well known state. */ #ifdef TEST fprintf(stderr, "nxagentResetSignalHandlers: Resetting the agent the signal handlers.\n"); #endif /* * Reset the SIGALRM to the default. */ nxagentStopTimer(); struct sigaction newAction = { .sa_handler = SIG_DFL }; sigfillset(&newAction.sa_mask); int result; while (((result = sigaction(SIGALRM, &newAction, NULL)) == -1) && (errno == EINTR)); if (result == -1) { FatalError("Can't set the handler for alarm signal."); } /* * Let the smart schedule set the SIGALRM handler again. */ nxagentInitTimer(); } void nxagentOpenDisplay(int argc, char *argv[]) { if (!nxagentDoFullGeneration) return; #ifdef NXAGENT_TIMESTAMP startTime = GetTimeInMillis(); fprintf(stderr, "Display: Opening the display on real X server with time [%d] ms.\n", GetTimeInMillis() - startTime); #endif /* * Initialize the reconnector only in the case of persistent * sessions. */ if (nxagentOption(Persistent)) { nxagentInitReconnector(); } if (*nxagentDisplayName == '\0') { snprintf(nxagentDisplayName, NXAGENTDISPLAYNAMELENGTH, "%s", XDisplayName(NULL)); } nxagentCloseDisplay(); nxagentInstallSignalHandlers(); nxagentInstallDisplayHandlers(); nxagentDisplay = nxagentInternalOpenDisplay(nxagentDisplayName); nxagentPostInstallSignalHandlers(); nxagentPostInstallDisplayHandlers(); if (nxagentDisplay == NULL) { /* FIXME: The agent should never exit the program with a FatalError() but rather use a specific function that may eventually call FatalError() on its turn. */ FatalError("Unable to open display '%s'.\n", nxagentDisplayName); } if (nxagentSynchronize) XSynchronize(nxagentDisplay, True); nxagentXConnectionNumber = XConnectionNumber(nxagentDisplay); #ifdef TEST fprintf(stderr, "nxagentOpenDisplay: Display image order is [%d] bitmap order is [%d].\n", ImageByteOrder(nxagentDisplay), BitmapBitOrder(nxagentDisplay)); fprintf(stderr, "nxagentOpenDisplay: Display scanline unit is [%d] scanline pad is [%d].\n", BitmapUnit(nxagentDisplay), BitmapPad(nxagentDisplay)); #endif #ifdef WATCH fprintf(stderr, "nxagentOpenDisplay: Watchpoint 1.\n"); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio ------- ----- ------ ------- -------- ---------- ----- #1 U 1 1 256 bits (0 KB) -> 150 bits (0 KB) -> 256/1 -> 150/1 = 1.707:1 #20 1 1 119104 bits (15 KB) -> 28 bits (0 KB) -> 119104/1 -> 28/1 = 4253.714:1 #98 2 512 bits (0 KB) -> 84 bits (0 KB) -> 256/1 -> 42/1 = 6.095:1 */ sleep(60); #endif #ifdef NXAGENT_TIMESTAMP fprintf(stderr, "Display: Display on real X server opened with time [%d] ms.\n", GetTimeInMillis() - startTime); #endif nxagentUseNXTrans = nxagentPostProcessArgs(nxagentDisplayName, nxagentDisplay, DefaultScreenOfDisplay(nxagentDisplay)); /* * Processing the arguments all the timeouts have been set. Now we * have to change the screen-saver timeout. */ nxagentSetScreenSaverTime(); nxagentInitVisuals(); nxagentNumDefaultColormaps = nxagentNumVisuals; nxagentDefaultColormaps = (Colormap *)malloc(nxagentNumDefaultColormaps * sizeof(Colormap)); for (int i = 0; i < nxagentNumDefaultColormaps; i++) { nxagentDefaultColormaps[i] = XCreateColormap(nxagentDisplay, DefaultRootWindow(nxagentDisplay), nxagentVisuals[i].visual, AllocNone); } #ifdef WATCH fprintf(stderr, "nxagentOpenDisplay: Watchpoint 4.\n"); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio ------- ----- ------ ------- -------- ---------- ----- N/A */ sleep(30); #endif nxagentBlackPixel = BlackPixel(nxagentDisplay, DefaultScreen(nxagentDisplay)); nxagentWhitePixel = WhitePixel(nxagentDisplay, DefaultScreen(nxagentDisplay)); #ifdef WATCH fprintf(stderr, "nxagentOpenDisplay: Watchpoint 5.\n"); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio ------- ----- ------ ------- -------- ---------- ----- N/A */ sleep(30); #endif /* * Initialize the agent's event mask that will be requested for the * root and all the top level windows. If the nested window is a * child of an existing window, we will need to receive * StructureNotify events. If we are going to manage the changes in * root window's visibility we'll also need VisibilityChange events. */ /* FIXME: Use of nxagentParentWindow is strongly deprecated. We need also to clarify which events are selected in the different operating modes. */ nxagentInitDefaultEventMask(); /* * Initialize the pixmap depths and formats. */ nxagentInitDepths(); nxagentInitPixmapFormats(); (void) nxagentCheckForPixmapFormatsCompatibility(); /* * Create a pixmap for each depth matching the local supported * formats with format available on the remote display. */ nxagentSetDefaultDrawables(); #ifdef RENDER if (nxagentRenderEnable) { nxagentRenderExtensionInit(); } #endif /* * This GC is referenced in Cursor.c. It can be probably removed. */ nxagentBitmapGC = XCreateGC(nxagentDisplay, nxagentDefaultDrawables[1], 0L, NULL); /* * Note that this "confine window" is useless at the moment as we * reimplement nxagentConstrainCursor() to skip the "constrain" * stuff. */ #ifdef TEST fprintf(stderr, "nxagentOpenDisplay: Going to create agent's confine window.\n"); #endif nxagentConfineWindow = XCreateWindow(nxagentDisplay, DefaultRootWindow(nxagentDisplay), 0, 0, 1, 1, 0, 0, InputOnly, CopyFromParent, 0L, NULL); if (nxagentReportWindowIds) { fprintf(stderr, "NXAGENT_WINDOW_ID: CONFINEMENT_WINDOW,WID:[0x%x]\n", nxagentConfineWindow); } #ifdef TEST fprintf(stderr, "nxagentOpenDisplay: Created agent's confine window with id [0x%x].\n", nxagentConfineWindow); #endif if (!(nxagentUserGeometry.flag & XValue)) { nxagentChangeOption(RootX, 0); } if (!(nxagentUserGeometry.flag & YValue)) { nxagentChangeOption(RootY, 0); } if (nxagentParentWindow == 0) { if (!(nxagentUserGeometry.flag & WidthValue)) { if (nxagentOption(Fullscreen) || nxagentOption(Rootless)) { nxagentChangeOption(RootWidth, DisplayWidth(nxagentDisplay, DefaultScreen(nxagentDisplay))); } else { nxagentChangeOption(RootWidth, 3 * DisplayWidth(nxagentDisplay, DefaultScreen(nxagentDisplay)) / 4); } } if (!(nxagentUserGeometry.flag & HeightValue)) { if (nxagentOption(Fullscreen) || nxagentOption(Rootless)) { nxagentChangeOption(RootHeight, DisplayHeight(nxagentDisplay, DefaultScreen(nxagentDisplay))); } else { nxagentChangeOption(RootHeight, 3 * DisplayHeight(nxagentDisplay, DefaultScreen(nxagentDisplay)) / 4); } } } if (!nxagentUserBorderWidth) { nxagentChangeOption(BorderWidth, 1); } #ifdef WATCH fprintf(stderr, "nxagentOpenDisplay: Watchpoint 5.1.\n"); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio ------- ----- ------ ------- -------- ---------- ----- N/A */ sleep(30); #endif useXpmIcon = nxagentMakeIcon(nxagentDisplay, &nxagentIconPixmap, &nxagentIconShape); #ifdef WATCH fprintf(stderr, "nxagentOpenDisplay: Watchpoint 5.2.\n"); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio ------- ----- ------ ------- -------- ---------- ----- #84 2 512 bits (0 KB) -> 76 bits (0 KB) -> 256/1 -> 38/1 = 6.737:1 */ sleep(30); #endif #ifdef WATCH fprintf(stderr, "nxagentOpenDisplay: Watchpoint 6.\n"); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio ------- ----- ------ ------- -------- ---------- ----- N/A */ sleep(30); #endif #ifdef NXAGENT_TIMESTAMP fprintf(stderr, "Display: Open of the display finished with time [%d] ms.\n", GetTimeInMillis() - startTime); #endif if (nxagentOption(Persistent)) { reconnectDisplayState = EVERYTHING_DONE; } } void nxagentSetDefaultVisual(void) { if (nxagentUserDefaultClass || nxagentUserDefaultDepth) { nxagentDefaultVisualIndex = UNDEFINED; for (int i = 0; i < nxagentNumVisuals; i++) { if ((!nxagentUserDefaultClass || nxagentVisuals[i].class == nxagentDefaultClass) && (!nxagentUserDefaultDepth || nxagentVisuals[i].depth == nxagentDefaultDepth)) { nxagentDefaultVisualIndex = i; break; } } if (nxagentDefaultVisualIndex == UNDEFINED) { FatalError("Unable to find desired default visual.\n"); } } else { XVisualInfo vi = { .visualid = XVisualIDFromVisual(DefaultVisual(nxagentDisplay, DefaultScreen(nxagentDisplay))) }; nxagentDefaultVisualIndex = 0; for (int i = 0; i < nxagentNumVisuals; i++) { if (vi.visualid == nxagentVisuals[i].visualid) { nxagentDefaultVisualIndex = i; } } } } void nxagentInitVisuals(void) { long mask = VisualScreenMask; XVisualInfo vi = { .screen = DefaultScreen(nxagentDisplay), .depth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)) }; int viNumList; XVisualInfo *viList = XGetVisualInfo(nxagentDisplay, mask, &vi, &viNumList); nxagentVisuals = (XVisualInfo *) malloc(viNumList * sizeof(XVisualInfo)); nxagentNumVisuals = 0; for (int i = 0; i < viNumList; i++) { if (viList[i].depth == vi.depth) { if (nxagentVisuals != NULL) { memcpy(nxagentVisuals + nxagentNumVisuals, viList + i, sizeof(XVisualInfo)); } #ifdef DEBUG fprintf(stderr, "nxagentInitVisuals: Visual:\n"); fprintf(stderr, "\tdepth = %d\n", nxagentVisuals[nxagentNumVisuals].depth); fprintf(stderr, "\tclass = %d\n", nxagentVisuals[nxagentNumVisuals].class); fprintf(stderr, "\tmask = (%lu,%lu,%lu)\n", nxagentVisuals[nxagentNumVisuals].red_mask, nxagentVisuals[nxagentNumVisuals].green_mask, nxagentVisuals[nxagentNumVisuals].blue_mask); fprintf(stderr, "\tcolormap size = %d\n", nxagentVisuals[nxagentNumVisuals].colormap_size); fprintf(stderr, "\tbits_per_rgb = %d\n", nxagentVisuals[nxagentNumVisuals].bits_per_rgb); #endif nxagentNumVisuals++; } } if (nxagentVisuals != NULL) { nxagentVisuals = (XVisualInfo *) realloc(nxagentVisuals, nxagentNumVisuals * sizeof(XVisualInfo)); } SAFE_XFree(viList); if (nxagentNumVisuals == 0 || nxagentVisuals == NULL) { FatalError("Unable to find any visuals.\n"); } nxagentSetDefaultVisual(); } void nxagentInitDepths(void) { nxagentDepths = XListDepths(nxagentDisplay, DefaultScreen(nxagentDisplay), &nxagentNumDepths); if (nxagentDepths == NULL) { #ifdef PANIC fprintf(stderr, "nxagentInitDepths: PANIC! Failed to get available depths.\n"); #endif FatalError("Failed to get available depths and pixmap formats."); } #ifdef TEST else { fprintf(stderr, "nxagentInitDepths: Got [%d] available depths:\n", nxagentNumDepths); for (int i = 0; i < nxagentNumDepths; i++) { fprintf(stderr, " [%d]", nxagentDepths[i]); } fprintf(stderr, ".\n"); } #endif } void nxagentInitPixmapFormats(void) { /* * Formats are created with no care of which are supported on the * real display. Creating only formats supported by the remote end * makes troublesome handling migration of session from a display to * another. */ nxagentNumPixmapFormats = 0; /* XXX: Some X server doesn't list 1 among available depths... */ nxagentPixmapFormats = malloc((nxagentNumDepths + 1) * sizeof(XPixmapFormatValues)); for (int i = 1; i <= MAXDEPTH; i++) { int depth = 0; if (i == 1) { depth = 1; } else { for (int j = 0; j < nxagentNumDepths; j++) { if (nxagentDepths[j] == i) { depth = i; break; } } } if (depth != 0) { if (nxagentNumPixmapFormats >= MAXFORMATS) { FatalError("nxagentInitPixmapFormats: MAXFORMATS is too small for this server.\n"); } nxagentPixmapFormats[nxagentNumPixmapFormats].depth = depth; nxagentPixmapFormats[nxagentNumPixmapFormats].bits_per_pixel = nxagentBitsPerPixel(depth); nxagentPixmapFormats[nxagentNumPixmapFormats].scanline_pad = BITMAP_SCANLINE_PAD; #ifdef TEST fprintf(stderr, "nxagentInitPixmapFormats: Set format [%d] to depth [%d] " "bits per pixel [%d] scanline pad [%d].\n", nxagentNumPixmapFormats, depth, nxagentPixmapFormats[nxagentNumPixmapFormats].bits_per_pixel, BITMAP_SCANLINE_PAD); #endif nxagentNumPixmapFormats++; } } nxagentRemotePixmapFormats = XListPixmapFormats(nxagentDisplay, &nxagentRemoteNumPixmapFormats); if (nxagentRemotePixmapFormats == NULL) { #ifdef WARNING fprintf(stderr, "nxagentInitPixmapFormats: WARNING! Failed to get available remote pixmap formats.\n"); #endif } #ifdef TEST else { fprintf(stderr, "nxagentInitPixmapFormats: Got [%d] available remote pixmap formats:\n", nxagentRemoteNumPixmapFormats); for (int i = 0; i < nxagentRemoteNumPixmapFormats; i++) { fprintf(stderr, "nxagentInitPixmapFormats: Remote pixmap format [%d]: depth [%d] " "bits_per_pixel [%d] scanline_pad [%d].\n", i, nxagentRemotePixmapFormats[i].depth, nxagentRemotePixmapFormats[i].bits_per_pixel, nxagentRemotePixmapFormats[i].scanline_pad); } } #endif } void nxagentSetDefaultDrawables(void) { for (int i = 0; i <= MAXDEPTH; i++) { nxagentDefaultDrawables[i] = None; } for (int i = 0; i < nxagentNumPixmapFormats; i++) { #ifdef TEST fprintf(stderr, "nxagentSetDefaultDrawables: Checking remote pixmap format [%d] with depth [%d] " "bits per pixel [%d] scanline pad [%d].\n", i, nxagentPixmapFormats[i].depth, nxagentPixmapFormats[i].bits_per_pixel, nxagentPixmapFormats[i].scanline_pad); #endif if (nxagentPixmapFormats[i].depth == 24) { if (nxagentPixmapFormats[i].bits_per_pixel == 24) { #ifdef TEST fprintf(stderr, "nxagentSetDefaultDrawables: WARNING! Assuming remote pixmap " "format [%d] as true 24 bits.\n", i); #endif nxagentTrue24 = True; } } for (int j = 0; j < nxagentNumDepths; j++) { #ifdef TEST fprintf(stderr, "nxagentSetDefaultDrawables: Checking depth at index [%d] with pixmap depth [%d] " "and display depth [%d].\n", j, nxagentPixmapFormats[i].depth, nxagentDepths[j]); #endif if ((nxagentPixmapFormats[i].depth == 1 || nxagentPixmapFormats[i].depth == nxagentDepths[j]) && nxagentDefaultDrawables[nxagentPixmapFormats[i].depth] == None) { nxagentDefaultDrawables[nxagentPixmapFormats[i].depth] = XCreatePixmap(nxagentDisplay, DefaultRootWindow(nxagentDisplay), 1, 1, nxagentPixmapFormats[i].depth); #ifdef TEST fprintf(stderr, "nxagentSetDefaultDrawables: Created default drawable [%lu] for depth [%d].\n", nxagentDefaultDrawables[nxagentPixmapFormats[i].depth], nxagentPixmapFormats[i].depth); #endif } } if (nxagentDefaultDrawables[nxagentPixmapFormats[i].depth] == None) { #ifdef TEST fprintf(stderr, "nxagentSetDefaultDrawables: WARNING! Forcing default drawable for depth [%d].\n", nxagentPixmapFormats[i].depth); #endif nxagentDefaultDrawables[nxagentPixmapFormats[i].depth] = XCreatePixmap(nxagentDisplay, DefaultRootWindow(nxagentDisplay), 1, 1, nxagentPixmapFormats[i].depth); #ifdef TEST fprintf(stderr, "nxagentSetDefaultDrawables: Created default drawable [%lu] for depth [%d].\n", nxagentDefaultDrawables[nxagentPixmapFormats[i].depth], nxagentPixmapFormats[i].depth); #endif } } } void nxagentCloseDisplay(void) { #ifdef TEST fprintf(stderr, "nxagentCloseDisplay: Called with full generation [%d] and display [%p].\n", nxagentDoFullGeneration, (void *) nxagentDisplay); #endif if (nxagentDoFullGeneration == 0 || nxagentDisplay == NULL) { return; } /* * If nxagentDoFullGeneration is true, all the X resources will be * destroyed upon closing the display connection, so there is no * real need to generate additional traffic */ SAFE_free(nxagentDefaultColormaps); SAFE_free(nxagentDepths); SAFE_XFree(nxagentVisuals); SAFE_XFree(nxagentPixmapFormats); SAFE_XFree(nxagentRemotePixmapFormats); nxagentFreeFontCache(); /* FIXME: Is this needed? nxagentFreeFontMatchStuff(); */ /* * Free the image cache. This is useful for detecting memory leaks. */ if (nxagentDisplay != NULL) { NXFreeCache(nxagentDisplay); NXResetDisplay(nxagentDisplay); } /* * Kill all the running dialogs. */ nxagentTerminateDialogs(); #ifdef TEST fprintf(stderr, "nxagentCloseDisplay: Setting the display to NULL.\n"); #endif XCloseDisplay(nxagentDisplay); nxagentDisplay = NULL; } Bool nxagentMakeIcon(Display *disp, Pixmap *nxIcon, Pixmap *nxMask) { char** agentIconData; /* * selecting x2go icon when running as X2Go agent */ if (nxagentX2go) { agentIconData = x2goagentIconData; } else { agentIconData = nxagentIconData; } XlibPixmap IconPixmap; XlibPixmap IconShape; if (XpmSuccess == XpmCreatePixmapFromData(disp, DefaultRootWindow(disp), agentIconData, &IconPixmap, &IconShape, NULL)) { *nxIcon = IconPixmap; *nxMask = IconShape; return True; } else { #ifdef TEST fprintf(stderr, "%s: Xpm operation failed.\n", __func__); #endif return False; } } Bool nxagentXServerGeometryChanged(void) { return (WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) != WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplayBackup))) || (HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) != HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplayBackup))); } void nxagentBackupDisplayInfo(void) { if (nxagentDisplayInfoSaved) { return; } /* * Since we need the display structure in order to behave correctly * when no X connection is available, we must always have a good * display record. It can be discarded only when a new X connection * is available, so we store it in order to destroy whenever the * reconnection succeeds. */ nxagentDisplayBackup = nxagentDisplay; nxagentBitmapGCBackup = nxagentBitmapGC; nxagentDepthsRecBackup = nxagentDepths; nxagentNumDepthsRecBackup = nxagentNumDepths; nxagentNumDefaultColormapsRecBackup = nxagentNumDefaultColormaps; nxagentVisualsRecBackup = nxagentVisuals; nxagentNumVisualsRecBackup = nxagentNumVisuals; SAFE_free(nxagentVisualHasBeenIgnored); nxagentVisualHasBeenIgnored = malloc(nxagentNumVisuals * sizeof(Bool)); nxagentDefaultDepthRecBackup = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)); nxagentDisplayWidthRecBackup = DisplayWidth(nxagentDisplay, DefaultScreen(nxagentDisplay)); nxagentDisplayHeightRecBackup = DisplayHeight(nxagentDisplay, DefaultScreen(nxagentDisplay)); nxagentRenderEnableRecBackup = nxagentRenderEnable; nxagentDisplayInfoSaved = True; } void nxagentCleanupBackupDisplayInfo(void) { SAFE_free(nxagentDepthsRecBackup); SAFE_free(nxagentVisualsRecBackup); SAFE_free(nxagentVisualHasBeenIgnored); nxagentNumDefaultColormapsRecBackup = 0; nxagentDefaultDepthRecBackup = 0; nxagentDisplayWidthRecBackup = 0; nxagentDisplayHeightRecBackup = 0; if (nxagentDisplayBackup) { XCloseDisplay(nxagentDisplayBackup); nxagentDisplayBackup = NULL; } if (nxagentBitmapGCBackup) { if (nxagentDisplayBackup) { XFreeGC(nxagentDisplayBackup, nxagentBitmapGCBackup); } else { SAFE_free(nxagentBitmapGCBackup); } nxagentBitmapGCBackup = NULL; } nxagentDisplayInfoSaved = False; } void nxagentDisconnectDisplay(void) { switch (reconnectDisplayState) { case EVERYTHING_DONE: if (nxagentBitmapGC && nxagentBitmapGCBackup && (nxagentBitmapGC != nxagentBitmapGCBackup)) { XFreeGC(nxagentDisplay, nxagentBitmapGC); } nxagentBitmapGC = nxagentBitmapGCBackup; case GOT_PIXMAP_FORMAT_LIST: case GOT_DEPTH_LIST: case ALLOC_DEF_COLORMAP: if (nxagentDefaultColormaps) { for (int i = 0; i < nxagentNumDefaultColormaps; i++) { nxagentDefaultColormaps[i] = None; } } case GOT_VISUAL_INFO: case OPENED: /* * Actually we need the nxagentDisplay structure in order to let * the agent go when no X connection is available. */ if (nxagentDisplay && nxagentDisplayBackup && (nxagentDisplay != nxagentDisplayBackup)) { XCloseDisplay(nxagentDisplay); } case NOTHING: nxagentDisplay = nxagentDisplayBackup; break; default: FatalError("Display is in unknown state. Can't continue."); } reconnectDisplayState = NOTHING; } static int nxagentCheckForDefaultDepthCompatibility(void) { /* * Depending on the (reconnect) tolerance checks value, this * function checks stricter or looser: * - "Strict" means that the old and new default depth values * must match exactly. * - "Safe" or "Risky" means that the default depth values might differ, * but the new default depth value must be at least as * high as the former default depth value. This is * recommended, because it allows clients with a * higher default depth value to still connect, but * not lose functionality. * - "Bypass" means that all of these checks are essentially * deactivated. This is probably a very bad idea. */ int dDepth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)); const unsigned int tolerance = nxagentOption(ReconnectTolerance); if (ToleranceChecksBypass <= tolerance) { #ifdef WARNING fprintf(stderr, "nxagentCheckForDefaultDepthCompatibility: WARNING! Not proceeding with any checks, " "because tolerance [%u] higher than or equal [%u]. New default depth value " "is [%d], former default depth value is [%d].\n", tolerance, ToleranceChecksBypass, dDepth, nxagentDefaultDepthRecBackup); #endif return 1; } if (nxagentDefaultDepthRecBackup == dDepth) { #ifdef TEST fprintf(stderr, "nxagentCheckForDefaultDepthCompatibility: New default depth [%d] " "matches with old default depth.\n", dDepth); #endif return 1; } else if ((ToleranceChecksSafe <= tolerance) && (nxagentDefaultDepthRecBackup < dDepth)) { #ifdef WARNING fprintf(stderr, "nxagentCheckForDefaultDepthCompatibility: WARNING! New default depth [%d] " "higher than the old default depth [%d] at tolerance [%u].\n", dDepth, nxagentDefaultDepthRecBackup, tolerance); #endif return 1; } else { #ifdef WARNING fprintf(stderr, "nxagentCheckForDefaultDepthCompatibility: WARNING! New default depth [%d] " "doesn't match with old default depth [%d] at tolerance [%u].\n", dDepth, nxagentDefaultDepthRecBackup, tolerance); #endif return 0; } } static int nxagentCheckForDepthsCompatibility(void) { /* * Depending on the (reconnect) tolerance checks value, this * function checks stricter or looser: * - "Strict" means that the number of old and new depths must * match exactly and every old depth value must be * available in the new depth array. * - "Safe" means that the number of depths might diverge, * but all former depth must also be included in the * new depth array. This is recommended, because * it allows clients with more depths to still * connect, but not lose functionality. * - "Risky" means that the new depths array is allowed to be * smaller than the old depths array, but at least * one depth value must be included in both. * This is potentially unsafe. * - "Bypass" or higher means that all of these checks are * essentially deactivated. This is a very bad idea. */ const unsigned int tolerance = nxagentOption(ReconnectTolerance); if (ToleranceChecksBypass <= tolerance) { #ifdef WARNING fprintf(stderr, "nxagentCheckForDepthsCompatibility: WARNING! Not proceeding with any checks, " "because tolerance [%u] higher than or equal [%u]. Number of newly available depths " "is [%d], number of old depths is [%d].\n", tolerance, ToleranceChecksBypass, nxagentNumDepths, nxagentNumDepthsRecBackup); #endif return 1; } if ((ToleranceChecksStrict == tolerance) && (nxagentNumDepths != nxagentNumDepthsRecBackup)) { #ifdef WARNING fprintf(stderr, "nxagentCheckForDepthsCompatibility: WARNING! No tolerance allowed and " "number of new available depths [%d] doesn't match with number of old " "depths [%d].\n", nxagentNumDepths, nxagentNumDepthsRecBackup); #endif return 0; } if ((ToleranceChecksSafe == tolerance) && (nxagentNumDepths < nxagentNumDepthsRecBackup)) { #ifdef WARNING fprintf(stderr, "nxagentCheckForDepthsCompatibility: WARNING! Tolerance [%u] not " "high enough and number of new available depths [%d] " "lower than number of old depths [%d].\n", tolerance, nxagentNumDepths, nxagentNumDepthsRecBackup); #endif return 0; } /* * By now the tolerance is either: * - "Strict" and both depth numbers match * - "Safe" and: * o the number of old and new depths matches exactly, or * o the number of old depths is lower than the number * of new depths * - "Risky" */ bool compatible = true; bool one_match = false; int total_matches = 0; /* * FIXME: within this loop, we try to match all "new" depths * against the "old" depths. Depending upon the flexibility * value, either all "new" depths must have a corresponding * counterpart in the "old" array, or at least one value * must be included in both. * Is this safe enough though? * Shouldn't we better try to match entries in the "old" * depths array against the "new" depths array, such that * we know that all "old" values are covered by "new" * values? Or is it more important that "new" values are * covered by "old" ones, with potentially more "old" * values lingering around that cannot be displayed by the * connected client? * * This section probably needs a revisit at some point in time. */ for (int i = 0; i < nxagentNumDepths; ++i) { bool matched = false; for (int j = 0; j < nxagentNumDepthsRecBackup; ++j) { if (nxagentDepths[i] == nxagentDepthsRecBackup[j]) { matched = true; one_match = true; ++total_matches; break; } } if ((ToleranceChecksRisky > tolerance) && (!matched)) { #ifdef WARNING fprintf(stderr, "nxagentCheckForDepthsCompatibility: WARNING! Tolerance [%u] too low and " "failed to match available depth [%d].\n", tolerance, nxagentDepths[i]); #endif compatible = false; break; } } /* * At Risky tolerance, only one match is necessary to be "compatible". */ if (ToleranceChecksRisky == tolerance) { compatible = one_match; } int ret = (!(!compatible)); if (compatible) { #ifdef TEST fprintf(stderr, "nxagentCheckForDepthsCompatibility: Internal depths match with " "remote depths at tolerance [%u].\n", tolerance); #endif if (total_matches != nxagentNumDepths) { #ifdef WARNING fprintf(stderr, "nxagentCheckForDepthsCompatibility: only some [%d] of the new depths [%d] " "match with old depths [%d] at tolerance [%u].\n", total_matches, nxagentNumDepths, nxagentNumDepthsRecBackup, tolerance); #endif } } else { #ifdef WARNING fprintf(stderr, "nxagentCheckForDepthsCompatibility: WARNING! New available depths [%d] don't match " "with old depths [%d] at tolerance [%u]. Only [%d] depth values matched.\n", nxagentNumDepths, nxagentNumDepthsRecBackup, tolerance, total_matches); #endif } return (ret); } static int nxagentCheckForPixmapFormatsCompatibility(void) { /* * Depending on the (reconnect) tolerance checks value, this * function checks stricter or looser: * - "Strict" means that the number of internal and external * pixmap formats must match exactly and every * internal pixmap format must be available in the * external pixmap format array. * - "Safe" means that the number of pixmap formats might * diverge, but all internal pixmap formats must * also be included in the external pixmap formats * array. This is recommended, because it allows * clients with more pixmap formats to still connect, * but not lose functionality. * - "Risky" means that the internal pixmap formats array is * allowed to be smaller than the external pixmap * formats array, but at least one pixmap format must * be included in both. This is potentially unsafe. * - "Bypass" or higher means that all of these checks are * essentially deactivated. This is a very bad idea. */ const unsigned int tolerance = nxagentOption(ReconnectTolerance); if (ToleranceChecksBypass <= tolerance) { #ifdef WARNING fprintf(stderr, "nxagentCheckForPixmapFormatsCompatibility: WARNING! Not proceeding with any checks, " "because tolerance [%u] higher than or equal [%u]. Number of internally available " "pixmap formats is [%d], number of externally available pixmap formats is [%d].\n", tolerance, ToleranceChecksBypass, nxagentNumPixmapFormats, nxagentRemoteNumPixmapFormats); #endif return 1; } if ((ToleranceChecksStrict == tolerance) && (nxagentNumPixmapFormats != nxagentRemoteNumPixmapFormats)) { #ifdef DEBUG fprintf(stderr, "nxagentCheckForPixmapFormatsCompatibility: WARNING! No tolerance allowed and number " "of internal pixmap formats [%d] doesn't match with number of remote formats [%d].\n", nxagentNumPixmapFormats, nxagentRemoteNumPixmapFormats); #endif return 0; } if ((ToleranceChecksSafe == tolerance) && (nxagentNumPixmapFormats > nxagentRemoteNumPixmapFormats)) { #ifdef DEBUG fprintf(stderr, "nxagentCheckForPixmapFormatsCompatibility: WARNING! Tolerance [%u] too low " "and number of internal pixmap formats [%d] higher than number of external formats [%d].\n", tolerance, nxagentNumPixmapFormats, nxagentRemoteNumPixmapFormats); #endif return 0; } /* * By now the tolerance is either: * - "Strict" * - "Safe" and: * o the number of internal and external pixmap formats * matches exactly, or * o the number of external pixmap formats is higher than * the number of internal pixmap formats, * - "Risky" */ bool compatible = true; int total_matches = 0; for (int i = 0; i < nxagentNumPixmapFormats; ++i) { bool matched = false; for (int j = 0; j < nxagentRemoteNumPixmapFormats; ++j) { if (nxagentPixmapFormats[i].depth == nxagentRemotePixmapFormats[j].depth && nxagentPixmapFormats[i].bits_per_pixel == nxagentRemotePixmapFormats[j].bits_per_pixel && nxagentPixmapFormats[i].scanline_pad == nxagentRemotePixmapFormats[j].scanline_pad) { matched = true; ++total_matches; break; } } if ((ToleranceChecksRisky > tolerance) && (!matched)) { #ifdef WARNING fprintf(stderr, "nxagentCheckForPixmapFormatsCompatibility: WARNING! Tolerance [%u] too low " "and failed to match internal pixmap format (depth [%d] bpp [%d] pad [%d]).\n", tolerance, nxagentPixmapFormats[i].depth, nxagentPixmapFormats[i].bits_per_pixel, nxagentPixmapFormats[i].scanline_pad); #endif compatible = false; } } int ret = !(!(compatible)); if (compatible) { #ifdef TEST fprintf(stderr, "nxagentCheckForPixmapFormatsCompatibility: Internal pixmap formats match with " "remote pixmap formats at tolerance [%u].\n", tolerance); #endif if (total_matches != nxagentNumPixmapFormats) { #ifdef WARNING fprintf(stderr, "nxagentCheckForPixmapFormatsCompatibility: Only some [%d] of the internal " "pixmap formats [%d] match with external pixmap formats [%d] at tolerance [%u].\n", total_matches, nxagentNumPixmapFormats, nxagentRemoteNumPixmapFormats, tolerance); #endif } } else { #ifdef WARNING fprintf(stderr, "nxagentCheckForPixmapFormatsCompatibility: WARNING! Internally available " "pixmap formats [%d] don't match with external pixmap formats [%d] " "at tolerance [%u]. Only [%d] depth values matched.\n", nxagentNumPixmapFormats, nxagentRemoteNumPixmapFormats, tolerance, total_matches); #endif } return (ret); } static int nxagentInitAndCheckVisuals(int flexibility) { /* FIXME: does this also need work? */ bool compatible = true; long viMask = VisualScreenMask; XVisualInfo viTemplate = { .screen = DefaultScreen(nxagentDisplay), .depth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)), }; int viNumList; XVisualInfo *viList = XGetVisualInfo(nxagentDisplay, viMask, &viTemplate, &viNumList); XVisualInfo *newVisuals = malloc(sizeof(XVisualInfo) * nxagentNumVisuals); for (int i = 0; i < nxagentNumVisuals; i++) { bool matched = false; for (int n = 0; n < viNumList; n++) { if (nxagentCompareVisuals(nxagentVisuals[i], viList[n]) == 1) { /* FIXME: Should the visual be ignored in this case? We can flag the visuals with inverted masks, and use this information to switch the masks when contacting the remote X server. */ if (nxagentVisuals[i].red_mask == viList[n].blue_mask && nxagentVisuals[i].blue_mask == viList[n].red_mask) { #ifdef WARNING fprintf(stderr, "nxagentInitAndCheckVisuals: WARNING! Red and blue mask inverted. " "Forcing matching.\n"); #endif } matched = true; nxagentVisualHasBeenIgnored[i] = FALSE; memcpy(newVisuals + i, viList + n, sizeof(XVisualInfo)); break; } } if (!matched) { if (nxagentVisuals[i].class == DirectColor) { #ifdef WARNING fprintf(stderr, "nxagentInitAndCheckVisuals: WARNING! Ignoring not matched DirectColor visual.\n"); #endif nxagentVisualHasBeenIgnored[i] = TRUE; memcpy(newVisuals + i, nxagentVisuals + i, sizeof(XVisualInfo)); } else { #ifdef DEBUG fprintf(stderr, "nxagentInitAndCheckVisuals: WARNING! Failed to match this visual:\n"); fprintf(stderr, "\tdepth = %d\n", nxagentVisuals[i].depth); fprintf(stderr, "\tclass = %d\n", nxagentVisuals[i].class); fprintf(stderr, "\tmask = (%ld,%ld,%ld)\n", nxagentVisuals[i].red_mask, nxagentVisuals[i].green_mask, nxagentVisuals[i].blue_mask); fprintf(stderr, "\tcolormap size = %d\n", nxagentVisuals[i].colormap_size); fprintf(stderr, "\tbits_per_rgb = %d\n", nxagentVisuals[i].bits_per_rgb); #endif compatible = false; break; } } } SAFE_XFree(viList); if (compatible) { #ifdef TEST fprintf(stderr, "nxagentInitAndCheckVisuals: New visuals match with old visuals.\n"); #endif nxagentVisuals = newVisuals; } else { #ifdef WARNING fprintf(stderr, "nxagentInitAndCheckVisuals: New visuals don't match with old visuals.\n"); #endif SAFE_free(newVisuals); } return compatible; } static int nxagentCheckForColormapsCompatibility(int flexibility) { /* FIXME: does this also need work? */ if (nxagentNumDefaultColormaps == nxagentNumDefaultColormapsRecBackup) { #ifdef TEST fprintf(stderr, "nxagentCheckForColormapsCompatibility: Number of new colormaps [%d] " "matches with old colormaps.\n", nxagentNumDefaultColormaps); #endif return 1; } else { #ifdef WARNING fprintf(stderr, "nxagentCheckForColormapsCompatibility: WARNING! Number of new colormaps [%d] " "doesn't match with old colormaps [%d].\n", nxagentNumDefaultColormaps, nxagentNumDefaultColormapsRecBackup); #endif return 0; } } Bool nxagentReconnectDisplay(void *p0) { int flexibility = *(int*)p0; #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_DISPLAY_DEBUG) fprintf(stderr, "nxagentReconnectDisplay\n"); #endif if (reconnectDisplayState) { fprintf(stderr, "nxagentReconnectDisplay: Trying to reconnect a session " "uncleanly disconnected\n"); return False; } /* * Reset the values to their defaults. */ nxagentPackMethod = -1; nxagentPackQuality = -1; nxagentSplitThreshold = -1; nxagentRemoteMajor = -1; nxagentInstallSignalHandlers(); nxagentInstallDisplayHandlers(); nxagentDisplay = nxagentInternalOpenDisplay(nxagentDisplayName); nxagentPostInstallSignalHandlers(); nxagentPostInstallDisplayHandlers(); if (nxagentDisplay == NULL) { nxagentSetReconnectError(FAILED_RESUME_DISPLAY_ALERT, "Couldn't open the display."); return FALSE; } nxagentAddXConnection(); /* * Display is now open. */ reconnectDisplayState = OPENED; #ifdef NXAGENT_TIMESTAMP fprintf(stderr, "Display: Open of the display finished with time [%d] ms.\n", GetTimeInMillis() - startTime); #endif if (nxagentCheckForDefaultDepthCompatibility() == 0) { nxagentSetReconnectError(FAILED_RESUME_DISPLAY_ALERT, "Default display depth doesn't match."); return FALSE; } nxagentUseNXTrans = nxagentPostProcessArgs(nxagentDisplayName, nxagentDisplay, DefaultScreenOfDisplay(nxagentDisplay)); /* * After processing the arguments all the timeout values have been * set. Now we have to change the screen-saver timeout. */ nxagentSetScreenSaverTime(); /* * Init and compare the visuals. */ if (nxagentInitAndCheckVisuals(flexibility) == FALSE) { nxagentSetReconnectError(FAILED_RESUME_VISUALS_ALERT, "Couldn't restore the required visuals."); return FALSE; } reconnectDisplayState = GOT_VISUAL_INFO; nxagentSetDefaultVisual(); nxagentInitAlphaVisual(); /* * Re-allocate the colormaps. */ nxagentNumDefaultColormaps = nxagentNumVisuals; nxagentDefaultColormaps = (Colormap *) realloc(nxagentDefaultColormaps, nxagentNumDefaultColormaps * sizeof(Colormap)); if (nxagentDefaultColormaps == NULL) { FatalError("Can't allocate memory for the default colormaps\n"); } reconnectDisplayState = ALLOC_DEF_COLORMAP; for (int i = 0; i < nxagentNumDefaultColormaps; i++) { if (nxagentVisualHasBeenIgnored[i]) { nxagentDefaultColormaps[i] = (XID)0; } else { nxagentDefaultColormaps[i] = XCreateColormap(nxagentDisplay, DefaultRootWindow(nxagentDisplay), nxagentVisuals[i].visual, AllocNone); } } nxagentCheckForColormapsCompatibility(flexibility); /* * Check the display depth. */ nxagentInitDepths(); reconnectDisplayState = GOT_DEPTH_LIST; if (nxagentCheckForDepthsCompatibility() == 0) { nxagentSetReconnectError(FAILED_RESUME_DEPTHS_ALERT, "Couldn't restore all the required depths."); return False; } /* * nxagentPixmapFormats and nxagentRemotePixmapFormats * will be reallocated in nxagentInitPixmapFormats(). */ SAFE_XFree(nxagentPixmapFormats); SAFE_XFree(nxagentRemotePixmapFormats); /* * Check if all the required pixmap formats are supported. */ nxagentInitPixmapFormats(); if (nxagentCheckForPixmapFormatsCompatibility() == 0) { nxagentSetReconnectError(FAILED_RESUME_PIXMAPS_ALERT, "Couldn't restore all the required pixmap formats."); return False; } reconnectDisplayState = GOT_PIXMAP_FORMAT_LIST; /* * Create a pixmap for each depth matching the local supported * formats with format available on the remote display. */ nxagentSetDefaultDrawables(); #ifdef RENDER if (nxagentRenderEnable) { nxagentRenderExtensionInit(); } if (nxagentRenderEnableRecBackup != nxagentRenderEnable) { nxagentRenderEnable = nxagentRenderEnableRecBackup; nxagentSetReconnectError(FAILED_RESUME_RENDER_ALERT, "Render extension not available or incompatible version."); return False; } #endif nxagentBlackPixel = BlackPixel(nxagentDisplay, DefaultScreen(nxagentDisplay)); nxagentWhitePixel = WhitePixel(nxagentDisplay, DefaultScreen(nxagentDisplay)); /* * Initialize the agent's event mask that will be requested for the * root or all the top level windows. If the nested window is a * child of an existing window we will need to receive * StructureNotify events. If we are going to manage the changes in * root window's visibility we'll also need VisibilityChange events. */ nxagentInitDefaultEventMask(); nxagentBitmapGC = XCreateGC(nxagentDisplay, nxagentDefaultDrawables[1], 0L, NULL); #ifdef TEST fprintf(stderr, "nxagentReconnectDisplay: Going to create agent's confine window.\n"); #endif nxagentConfineWindow = XCreateWindow(nxagentDisplay, DefaultRootWindow(nxagentDisplay), 0, 0, 1, 1, 0, 0, InputOnly, CopyFromParent, 0L, NULL); if (nxagentReportWindowIds) { fprintf(stderr, "NXAGENT_WINDOW_ID: CONFINEMENT_WINDOW,WID:[0x%x]\n", nxagentConfineWindow); } #ifdef TEST fprintf(stderr, "nxagentReconnectDisplay: Created agent's confine window with id [0x%x].\n", nxagentConfineWindow); #endif useXpmIcon = nxagentMakeIcon(nxagentDisplay, &nxagentIconPixmap, &nxagentIconShape); /* * Everything went fine. We can continue handling our clients. */ reconnectDisplayState = EVERYTHING_DONE; return True; } void nxagentAddXConnection(void) { nxagentXConnectionNumber = XConnectionNumber(nxagentDisplay); #ifdef TEST fprintf(stderr, "nxagentAddXConnection: Adding the X connection [%d] " "to the device set.\n", nxagentXConnectionNumber); #endif SetNotifyFd(XConnectionNumber(nxagentDisplay), nxagentNotifyConnection, X_NOTIFY_READ, NULL); } void nxagentRemoveXConnection(void) { #ifdef TEST fprintf(stderr, "nxagentRemoveXConnection: Removing the X connection [%d] " "from the device set.\n", nxagentXConnectionNumber); #endif RemoveNotifyFd(nxagentXConnectionNumber); } /* * Force an I/O error and wait until the NX transport is gone. It must * be called before suspending or terminating a session to ensure that * the NX transport is terminated first. */ void nxagentWaitDisplay(void) { /* * Disable the smart scheduler's interrupts. */ #ifdef DEBUG fprintf(stderr, "nxagentWaitDisplay: Stopping the smart schedule timer.\n"); #endif nxagentStopTimer(); if (nxagentDisplay != NULL) { #ifdef TEST fprintf(stderr, "nxagentWaitDisplay: Going to shutdown the X connection [%d].\n", nxagentXConnectionNumber); #endif NXForceDisplayError(nxagentDisplay); XSync(nxagentDisplay, 0); } #ifdef TEST fprintf(stderr, "nxagentWaitDisplay: Going to wait for the NX transport.\n"); #endif NXTransDestroy(NX_FD_ANY); #ifdef TEST fprintf(stderr, "nxagentWaitDisplay: The NX transport is not running.\n"); #endif /* * Be sure the signal handlers are in a known state. */ nxagentResetSignalHandlers(); } /* * This has not to do with the remote display but with the X server * that the agent is impersonating. We have it here to be consistent * with the other cleanup procedures which have mainly to do with the * Xlib display connection. */ void nxagentAbortDisplay(void) { /* * Be sure the X server socket in .X11-unix is deleted otherwise * other users may to become unable to run a session on the same * display. */ #ifdef TEST fprintf(stderr, "nxagentAbortDisplay: Cleaning up the X server sockets.\n"); #endif CloseWellKnownConnections(); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Display.h0000644000000000000000000001276013614532331020441 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #ifndef __Display_H__ #define __Display_H__ #define MAXDEPTH 32 #define MAXVISUALSPERDEPTH 256 extern Display *nxagentDisplay; extern Display *nxagentShadowDisplay; extern XVisualInfo *nxagentVisuals; extern int nxagentNumVisuals; extern int nxagentDefaultVisualIndex; extern Colormap *nxagentDefaultColormaps; extern int nxagentNumDefaultColormaps; extern int *nxagentDepths; extern int nxagentNumDepths; extern XPixmapFormatValues *nxagentPixmapFormats; extern int nxagentNumPixmapFormats; extern Pixel nxagentBlackPixel; extern Pixel nxagentWhitePixel; extern Drawable nxagentDefaultDrawables[MAXDEPTH + 1]; extern Pixmap nxagentScreenSaverPixmap; /* * The "confine" window is used in nxagentConstrainCursor(). * We are currently overriding the original Xnest behaviour * and just skip the "constrain" stuff. */ extern Window nxagentConfineWindow; /* * Keyboard and pointer are handled as they were hardware * devices, that is we translate the key codes according to * our own transcripts. We inherit this behaviour from Xnest. * The following mask will contain the event mask selected * for the root window. All the keyboard and pointer events * are enqueued to the mi that translates and posts them to * managed clients. */ extern unsigned long nxagentEventMask; void nxagentOpenDisplay(int argc, char *argv[]); void nxagentWaitDisplay(void); void nxagentCloseDisplay(void); void nxagentAbortDisplay(void); void nxagentAddXConnection(void); void nxagentRemoveXConnection(void); Bool nxagentXServerGeometryChanged(void); /* * Create the default drawables. */ void nxagentGetDepthsAndPixmapFormats(void); void nxagentSetDefaultDrawables(void); extern Bool nxagentTrue24; void nxagentBackupDisplayInfo(void); void nxagentCleanupBackupDisplayInfo(void); void nxagentInstallDisplayHandlers(void); void nxagentPostInstallDisplayHandlers(void); void nxagentResetDisplayHandlers(void); void nxagentInstallSignalHandlers(void); void nxagentPostInstallSignalHandlers(void); void nxagentResetSignalHandlers(void); void nxagentDisconnectDisplay(void); Bool nxagentReconnectDisplay(void *p0); /* * Deal with the smart scheduler. */ #if HAVE_SETITIMER #define nxagentInitTimer() \ \ SmartScheduleInit(); #define nxagentStopTimer() \ \ SmartScheduleStopTimer(); \ #define nxagentStartTimer() \ \ SmartScheduleStartTimer(); #define nxagentDisableTimer() \ \ SmartScheduleStopTimer(); \ SmartScheduleSignalEnable = FALSE; #else #define nxagentInitTimer() #define nxagentStopTimer() #define nxagentStartTimer() #define nxagentDisableTimer() #endif /* HAVE_SETITIMER */ /* * File descriptor currently used by * Xlib for the agent display. */ extern int nxagentXConnectionNumber; /* * File descriptor currently used by * Xlib for the agent shadow display. */ extern int nxagentShadowXConnectionNumber; int nxagentServerOrder(void); int nxagentGetDataRate(void); #define nxagentClientOrder(client) \ ((client)->swapped ? !nxagentServerOrder() : nxagentServerOrder()) /* * Terminate the agent after the next * dispatch loop. */ #define nxagentTerminateSession() \ do \ { \ dispatchException |= DE_TERMINATE; \ \ isItTimeToYield = TRUE; \ } \ while (0) #endif /* __Display_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Drawable.c0000644000000000000000000026061513614532331020554 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "dixstruct.h" #include "../../fb/fb.h" #include "misc.h" #include "Agent.h" #include "Display.h" #include "Screen.h" #include "Trap.h" #include "Image.h" #include "Drawable.h" #include "Client.h" #include "Visual.h" #include "Events.h" #include "GCs.h" #include "Utils.h" #include "Handlers.h" #include "Pixels.h" #include "Reconnect.h" #include "GCOps.h" #include "Utils.h" #include "compext/Compext.h" #include "mibstorest.h" #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP /* * The list of rectangles composing a region s returned by * nxagentGetOptimizedRegion- Boxes() instead of RegionRects(). */ #define USE_OPTIMIZED_BOXES /* * The rectangles composing a region are de- fragmented to reduce the * number of synch- ronizing PutImage's. */ #define ADVANCED_BOXES_DEFRAG /* * If defined, send the XClearArea at the end of the loop * synchronizing the shadow pixmap. In this way, large images can be * split but the user will see more updates together. */ #undef COLLECTED_UPDATES #ifdef ADVANCED_BOXES_DEFRAG #define INCLUDE_MARGIN 10 #endif struct nxagentExposeBackground { PixmapPtr pBackground; RegionPtr pExpose; }; RESTYPE RT_NX_CORR_BACKGROUND; RESTYPE RT_NX_CORR_WINDOW; RESTYPE RT_NX_CORR_PIXMAP; int nxagentCorruptedPixmaps = 0; int nxagentCorruptedWindows = 0; int nxagentCorruptedBackgrounds = 0; int nxagentForceSynchronization = 0; _nxagentSynchronizationRec nxagentSynchronization = { (DrawablePtr) NULL, 0, 0, 0, 0, 0 }; RegionPtr nxagentDeferredBackgroundExposures = NullRegion; /* * Predicate functions used to synchronize the content of the remote * drawable with the data stored in the virtual frame-buffer. */ void nxagentSynchronizeDrawablePredicate(void *p0, XID x1, void *p2); void nxagentExposeBackgroundPredicate(void *p0, XID x1, void *p2); /* * Imported from NXresource.c */ extern int nxagentFindClientResource(int, RESTYPE, void *); unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel); unsigned long nxagentGetDrawableColor(DrawablePtr pDrawable); unsigned long nxagentGetRegionColor(DrawablePtr pDrawable, RegionPtr pRegion); int nxagentSkipImage = 0; static int nxagentTooManyImageData(void) { unsigned int limit = nxagentOption(ImageRateLimit); unsigned int r = nxagentGetDataRate() / 1000; #ifdef TEST if (r > limit) { fprintf(stderr, "Warning: Current bit rate is: %u kB/s.\n", r); } #endif return (r > limit); } int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int breakMask, WindowPtr owner) { pDrawable = nxagentSplitDrawable(pDrawable); if (nxagentLosslessTrap == 0) { if (nxagentDrawableStatus(pDrawable) == Synchronized) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeDrawable: Drawable [%s][%p] with id [%ld] already " "synchronized.\n", nxagentDrawableType(pDrawable), (void *) pDrawable, pDrawable -> id); #endif return 0; } } /* * What we want here is to avoid drawing on the framebuffer and just * perform the operation on the real X server. This is the purpose * of the FB trap. At the same time we also want to avoid a split, * so that the image will be transferred in a single operation. */ nxagentFBTrap = 1; nxagentSplitTrap = 1; int result = nxagentSynchronizeDrawableData(pDrawable, breakMask, owner); nxagentSplitTrap = 0; nxagentFBTrap = 0; if (wait == DO_WAIT && nxagentSplitResource(pDrawable) != NULL) { nxagentWaitDrawable(pDrawable); } #ifdef TEST if (nxagentDrawableStatus(pDrawable) == Synchronized) { fprintf(stderr, "nxagentSynchronizeDrawable: Drawable %s [%p] with id [%ld] now synchronized.\n", nxagentDrawableType(pDrawable), (void *) pDrawable, pDrawable -> id); } else { fprintf(stderr, "nxagentSynchronizeDrawable: Drawable %s [%p] with id [%ld] not fully synchronized.\n", nxagentDrawableType(pDrawable), (void *) pDrawable, pDrawable -> id); } #endif return result; } int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask, WindowPtr owner) { char *data = NULL; int success; if (pDrawable -> type == DRAWABLE_PIXMAP) { GCPtr pGC; unsigned int leftPad = 0; int width = pDrawable -> width; int height = pDrawable -> height; int depth = pDrawable -> depth; #ifdef TEST fprintf(stderr, "nxagentSynchronizeDrawableData: Synchronizing drawable (%s) with geometry [%d][%d][%d].\n", nxagentDrawableType(pDrawable), width, height, depth); #endif unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; int length = nxagentImageLength(width, height, format, leftPad, depth); if ((data = malloc(length)) == NULL) { #ifdef WARNING fprintf(stderr, "nxagentSynchronizeDrawableData: WARNING! Failed to allocate memory for the operation.\n"); #endif success = 0; goto nxagentSynchronizeDrawableDataEnd; } DrawablePtr pSrcDrawable = (pDrawable -> type == DRAWABLE_PIXMAP ? ((DrawablePtr) nxagentVirtualPixmap((PixmapPtr) pDrawable)) : pDrawable); /* * Synchronize the whole pixmap if we need to download a fresh * copy with lossless compression turned off. */ if (nxagentLosslessTrap == 1) { pGC = nxagentGetGraphicContext(pDrawable); if (pGC == NULL) { #ifdef WARNING fprintf(stderr, "nxagentSynchronizeDrawableData: WARNING! Failed to get the temporary GC.\n"); #endif success = 0; goto nxagentSynchronizeDrawableDataEnd; } ValidateGC(pDrawable, pGC); fbGetImage(pSrcDrawable, 0, 0, width, height, format, AllPlanes, data); #ifdef TEST fprintf(stderr, "nxagentSynchronizeDrawableData: Forcing synchronization of " "pixmap at [%p] with lossless compression.\n", (void *) pDrawable); #endif nxagentPutImage(pDrawable, pGC, depth, 0, 0, width, height, leftPad, format, data); success = 1; goto nxagentSynchronizeDrawableDataEnd; } else if (nxagentReconnectTrap == 1) { /* * The pixmap data is not synchronized unless we need it. We * noticed we have to reconnect the pixmaps used by the GC's * clip mask. The other data will be synchronized on demand. */ if (pDrawable -> depth == 1) { #ifdef TEST if (nxagentReconnectTrap == 1) { static int totalLength; static int totalReconnectedPixmaps; totalLength += length; totalReconnectedPixmaps++; fprintf(stderr, "nxagentSynchronizeDrawableData: Reconnecting pixmap at [%p] [%dx%d] " "Depth [%d] Size [%d]. Total size [%d]. Total reconnected pixmaps [%d].\n", (void *) pDrawable, width, height, depth, length, totalLength, totalReconnectedPixmaps); } #endif pGC = nxagentGetGraphicContext(pDrawable); if (pGC == NULL) { #ifdef WARNING fprintf(stderr, "nxagentSynchronizeDrawableData: WARNING! Failed to create the temporary GC.\n"); #endif success = 0; goto nxagentSynchronizeDrawableDataEnd; } ValidateGC(pDrawable, pGC); fbGetImage(pSrcDrawable, 0, 0, width, height, format, AllPlanes, data); nxagentPutImage(pDrawable, pGC, depth, 0, 0, width, height, leftPad, format, data); success = 1; goto nxagentSynchronizeDrawableDataEnd; } else { #ifdef TEST fprintf(stderr, "nxagentSynchronizeDrawableData: Skipping synchronization of " "pixmap at [%p][%p] during reconnection.\n", (void *) pDrawable, (void*) nxagentVirtualPixmap((PixmapPtr)pDrawable)); #endif nxagentMarkCorruptedRegion(pDrawable, NullRegion); success = 1; goto nxagentSynchronizeDrawableDataEnd; } } } /* * By calling this function with the NullRegion as parameter we are * requesting to synchronize the full visible corrupted region of * the drawable. */ success = nxagentSynchronizeRegion(pDrawable, NullRegion, breakMask, owner); nxagentSynchronizeDrawableDataEnd: SAFE_free(data); return success; } /* * If pRegion is NullRegion, all the viewable corrupted region will be * synchronized. */ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned int breakMask, WindowPtr owner) { DrawablePtr pSrcDrawable; int leftPad = 0; int success = 0; char *data = NULL; GCPtr pGC = NULL; RegionPtr clipRegion = NullRegion; #ifdef COLLECTED_UPDATES RegionRec collectedUpdates; RegionInit(&collectedUpdates, NullBox, 1); #endif RegionRec exposeRegion; RegionInit(&exposeRegion, NullBox, 1); if (nxagentDrawableBitmap(pDrawable) != NullPixmap && nxagentDrawableStatus((DrawablePtr) nxagentDrawableBitmap(pDrawable)) == Synchronized) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: WARNING! Drawable [%s] at [%p] has an already synchronized " "bitmap at [%p].\n", nxagentDrawableType(pDrawable), (void *) pDrawable, (void *) nxagentDrawableBitmap(pDrawable)); #endif nxagentDestroyDrawableBitmap(pDrawable); } /* * The stored bitmap may be used if we are going to synchronize the * full drawable. */ int useStoredBitmap = (nxagentDrawableBitmap(pDrawable) != NullPixmap && pRegion == NullRegion); if (useStoredBitmap != 0) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Drawable [%s] at [%p] has a synchronization bitmap at [%p] " "[%d,%d,%d,%d] with [%ld] rects.\n", nxagentDrawableType(pDrawable), (void *) pDrawable, (void *) nxagentDrawableBitmap(pDrawable), nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x1, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y1, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x2, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y2, RegionNumRects(nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)))); #endif clipRegion = nxagentCreateRegion(pDrawable, NULL, 0, 0, pDrawable -> width, pDrawable -> height); /* * Intersecting the viewable region of the drawable with the * region remaining from a previous loop. */ RegionIntersect(clipRegion, clipRegion, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable))); /* * The bitmap regions used in the synchronizations are only those * corrupted also on the drawable. In this way, if we put a tile * in a bad position (e.g. if the corrupted region moves), the * next synchronization will fix the error. */ RegionIntersect(clipRegion, clipRegion, nxagentCorruptedRegion(pDrawable)); /* * The bitmap to synchronize is clipped. */ if (RegionNil(clipRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: The bitmap region [%d,%d,%d,%d] is not viewable. " "Destroying it.\n", clipRegion -> extents.x1, clipRegion -> extents.y1, clipRegion -> extents.x2, clipRegion -> extents.y2); #endif nxagentDestroyDrawableBitmap(pDrawable); goto nxagentSynchronizeRegionFree; } /* * Using the saved bitmap as source, instead of the drawable * itself. */ pSrcDrawable = ((DrawablePtr) nxagentVirtualPixmap(nxagentDrawableBitmap(pDrawable))); } else { if (pRegion != NullRegion && RegionNil(pRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Region [%d,%d,%d,%d] is nil. Skipping synchronization.\n", pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2); #endif goto nxagentSynchronizeRegionFree; } if (nxagentDrawableStatus(pDrawable) == Synchronized) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: The [%s] at [%p] is already synchronized.\n", nxagentDrawableType(pDrawable), (void *) pDrawable); #endif goto nxagentSynchronizeRegionFree; } /* * Creating a region containing the viewable area of drawable. */ clipRegion = nxagentCreateRegion(pDrawable, NULL, 0, 0, pDrawable -> width, pDrawable -> height); /* * If the corrupted region is not viewable, we can skip the * synchronization. */ RegionIntersect(clipRegion, clipRegion, nxagentCorruptedRegion(pDrawable)); if (RegionNil(clipRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: The corrupted region [%d,%d,%d,%d] is not viewable " "on [%s] at [%p]. Skipping the synchronization.\n", clipRegion -> extents.x1, clipRegion -> extents.y1, clipRegion -> extents.x2, clipRegion -> extents.y2, nxagentDrawableType(pDrawable), (void *) pDrawable); #endif goto nxagentSynchronizeRegionFree; } /* * We can skip the synchronization if the requested region is not * corrupted. Specifying a NullRegion as parameter, all the * viewable corrupted region will be synchronized. */ if (pRegion != NullRegion) { RegionIntersect(clipRegion, clipRegion, pRegion); if (RegionNil(clipRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Region requested [%d,%d,%d,%d] already " "synchronized on [%s] at [%p].\n", pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2, nxagentDrawableType(pDrawable), (void *) pDrawable); #endif goto nxagentSynchronizeRegionFree; } } pSrcDrawable = (pDrawable -> type == DRAWABLE_PIXMAP ? ((DrawablePtr) nxagentVirtualPixmap((PixmapPtr) pDrawable)) : pDrawable); } #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Synchronizing region with coordinates [%d,%d,%d,%d] " "on [%s] at [%p].\n", clipRegion -> extents.x1, clipRegion -> extents.y1, clipRegion -> extents.x2, clipRegion -> extents.y2, nxagentDrawableType(pDrawable), (void *) pDrawable); #endif int saveTrap = nxagentGCTrap; nxagentGCTrap = 0; nxagentFBTrap = 1; nxagentSplitTrap = 1; pGC = nxagentGetGraphicContext(pDrawable); if (pGC == NULL) { #ifdef WARNING fprintf(stderr, "nxagentSynchronizeRegion: WARNING! Failed to create the temporary GC.\n"); #endif goto nxagentSynchronizeRegionFree; } ValidateGC(pDrawable, pGC); #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Going to synchronize [%ld] rects of [%s] at [%p].\n", RegionNumRects(clipRegion), nxagentDrawableType(pDrawable), (void *) pDrawable); fprintf(stderr, "nxagentSynchronizeRegion: Extents geometry [%d,%d,%d,%d].\n", clipRegion -> extents.x1, clipRegion -> extents.y1, clipRegion -> extents.x2, clipRegion -> extents.y2); fprintf(stderr, "nxagentSynchronizeRegion: Drawable geometry [%d,%d,%d,%d].\n", pDrawable -> x, pDrawable -> y, pDrawable -> width, pDrawable -> height); #endif /* * We are going to synchronize the corrupted area, so we use the * corrupted extents as maximum size of the image data. It's * important to avoid using the drawable size, because in case of a * huge window it had to result in a failed data memory allocation. */ int w, h, extentWidth, extentHeight, tileWidth, tileHeight; extentWidth = clipRegion -> extents.x2 - clipRegion -> extents.x1; extentHeight = clipRegion -> extents.y2 - clipRegion -> extents.y1; w = tileWidth = (nxagentOption(TileWidth) > extentWidth ? extentWidth : nxagentOption(TileWidth)); h = tileHeight = (nxagentOption(TileHeight) > extentHeight ? extentHeight : nxagentOption(TileHeight)); #ifdef DEBUG fprintf(stderr, "nxagentSynchronizeRegion: Using tiles of size [%dx%d].\n", tileWidth, tileHeight); #endif int length, format; data = nxagentAllocateImageData(w, h, pDrawable -> depth, &length, &format); if (data == NULL) { #ifdef WARNING fprintf(stderr, "nxagentSynchronizeRegion: WARNING! Failed to allocate memory for synchronization.\n"); /* * Print detailed information if the image length is zero. */ if (length == 0) { fprintf(stderr, "nxagentSynchronizeRegion: Drawable [%s] at [%p] with region geometry [%d][%d,%d,%d,%d].\n", nxagentDrawableType(pDrawable), (void *) pDrawable, RegionNumRects(clipRegion), clipRegion -> extents.x1, clipRegion -> extents.y1, clipRegion -> extents.x2, clipRegion -> extents.y2); } #endif goto nxagentSynchronizeRegionFree; } #ifndef USE_OPTIMIZED_BOXES BoxPtr pBox = RegionRects(clipRegion); #else BoxPtr pBox = nxagentGetOptimizedRegionBoxes(clipRegion); #endif /* USE_OPTIMIZED_BOXES */ int nBox = RegionNumRects(clipRegion); unsigned long now = GetTimeInMillis(); nxagentSynchronization.abort = 0; /* * Going to split the updated region into small blocks. */ for (int i = 0; i < nBox; i++) { #ifdef USE_OPTIMIZED_BOXES if (pBox[i].x1 == 0 && pBox[i].y1 == 0 && pBox[i].x2 == 0 && pBox[i].y2 == 0) { continue; } #endif BoxRec box = pBox[i]; for (int y = box.y1; y < box.y2; y += h) { h = min(box.y2 - y, tileHeight); for (int x = box.x1; x < box.x2; x += w) { w = min(box.x2 - x, tileWidth); /* * FIXME: This should not occur. */ if (nxagentDrawableStatus(pDrawable) == Synchronized) { #ifdef WARNING if (pDrawable -> type == DRAWABLE_WINDOW && pSrcDrawable != pDrawable) { fprintf(stderr, "nxagentSynchronizeRegion: WARNING! Trying to synchronize " "the clean drawable type [%d] at [%p] with source at [%p].\n", pDrawable -> type, (void *) pDrawable, (void *) pSrcDrawable); } #endif goto nxagentSynchronizeRegionStop; } if (canBreakOnTimeout(breakMask)) { /* * Abort the synchronization loop if it lasts for more than * DeferTimeout milliseconds. */ unsigned long elapsedTime = GetTimeInMillis() - now; if (elapsedTime > nxagentOption(DeferTimeout)) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Synchronization break with " "[%lu] ms elapsed.\n", elapsedTime); #endif nxagentSynchronization.abort = 1; goto nxagentSynchronizeRegionStop; } } /* * Abort the loop if we go out of bandwidth. */ if (breakOnCongestionDrawable(breakMask, pDrawable) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Synchronization break with " "congestion [%d] blocking [%d].\n", nxagentCongestion, nxagentBlocking); #endif nxagentSynchronization.abort = 1; goto nxagentSynchronizeRegionStop; } /* * Abort the loop if the display blocks. */ if (breakOnBlocking(breakMask) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Synchronization break with " "blocking [%d] congestion [%d].\n", nxagentBlocking, nxagentCongestion); #endif nxagentSynchronization.abort = 1; goto nxagentSynchronizeRegionStop; } BoxRec tileBox = {.x1 = x, .y1 = y, .x2 = x + w, .y2 = y + h}; #ifdef DEBUG fprintf(stderr, "nxagentSynchronizeRegion: Going to synchronize tile [%d,%d,%d,%d].\n", tileBox.x1, tileBox.y1, tileBox.x2, tileBox.y2); #endif nxagentGetImage(pSrcDrawable, x, y, w, h, format, AllPlanes, data); /* * Going to unmark the synchronized region. */ RegionRec tileRegion; RegionInit(&tileRegion, &tileBox, 1); RegionUnion(&exposeRegion, &exposeRegion, &tileRegion); #ifdef COLLECTED_UPDATES RegionAppend(&collectedUpdates, &tileRegion); #endif if (useStoredBitmap != 0) { /* * When a bitmap's tile is synchronized, we can clear the * corresponding region. We can't use the * nxagentUnmarkCorruptedRegion because we have not a * resource associated to this pixmap. */ RegionSubtract(nxagentPixmapCorruptedRegion(nxagentDrawableBitmap(pDrawable)), nxagentPixmapCorruptedRegion(nxagentDrawableBitmap(pDrawable)), &tileRegion); /* * The drawable's corrupted region can be cleared if the * bitmap's tile data matches the drawable's content at the * same position. */ if (nxagentDrawableStatus(pDrawable) == NotSynchronized) { int cmpLength, cmpFormat; char *cmpData = nxagentAllocateImageData(w, h, pDrawable -> depth, &cmpLength, &cmpFormat); if (cmpData != NULL) { nxagentGetImage(pDrawable, x, y, w, h, format, AllPlanes, cmpData); if (memcmp(data, cmpData, cmpLength) == 0) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Tile [%d,%d,%d,%d] matches drawable's data at same position.\n", x, y, x + w, y + h); #endif nxagentUnmarkCorruptedRegion(pDrawable, &tileRegion); } #ifdef TEST else { fprintf(stderr, "nxagentSynchronizeRegion: Tile [%d,%d,%d,%d] on drawable [%p] doesn't match.\n", x, y, x + w, y + h, (void *) pDrawable); } #endif } else { #ifdef WARNING fprintf(stderr, "nxagentSynchronizeRegion: WARNING! Failed to allocate memory to compare tiles.\n"); #endif } SAFE_free(cmpData); } } else { nxagentUnmarkCorruptedRegion(pDrawable, &tileRegion); if (nxagentDrawableBitmap(pDrawable) != NullPixmap) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Going to clean bitmap at [%p] with newer data.\n", (void *) nxagentDrawableBitmap(pDrawable)); #endif RegionSubtract(nxagentPixmapCorruptedRegion(nxagentDrawableBitmap(pDrawable)), nxagentPixmapCorruptedRegion(nxagentDrawableBitmap(pDrawable)), &tileRegion); } } /* * Realize the image after comparing the source data with the * bitmap data. */ nxagentRealizeImage(pDrawable, pGC, pDrawable -> depth, x, y, w, h, leftPad, format, data); RegionUninit(&tileRegion); #if !defined(COLLECTED_UPDATES) if (owner != NULL) { if (nxagentOption(Shadow) == 1 && (nxagentOption(XRatio) != DONT_SCALE || nxagentOption(YRatio) != DONT_SCALE)) { int scaledx = nxagentScale(x, nxagentOption(XRatio)); int scaledy = nxagentScale(y, nxagentOption(YRatio)); int scaledw = nxagentScale(x + w, nxagentOption(XRatio)) - scaledx; int scaledh = nxagentScale(y + h, nxagentOption(YRatio)) - scaledy; XClearArea(nxagentDisplay, nxagentWindow(owner), scaledx, scaledy, scaledw, scaledh, 0); } else { XClearArea(nxagentDisplay, nxagentWindow(owner), x, y, w, h, 0); } } #endif /* #if !defined(COLLECTED_UPDATES) */ /* * Abort the loop on the user's input. This is done here to * check for events read after the flush caused by the * PutImage. */ nxagentDispatchHandler((ClientPtr) 0, 0, 0); if (breakOnEvent(breakMask) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Synchronization break with " "new input events.\n"); #endif nxagentSynchronization.abort = 1; goto nxagentSynchronizeRegionStop; } } } } nxagentSynchronizeRegionStop: nxagentSplitTrap = 0; nxagentFBTrap = 0; nxagentGCTrap = saveTrap; success = 1; if (nxagentOption(Shadow) == 0) { if (nxagentSynchronization.abort == 1) { /* * Storing the pointer to the drawable we were synchronizing * when the loop aborted. It is used in * nxagentSynchronizeDrawablePredicate. */ nxagentSynchronization.pDrawable = pDrawable; nxagentSynchronization.drawableType = pDrawable -> type; if (nxagentDrawableBitmap(pDrawable) == NullPixmap) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Going to create the synchronization bitmap.\n"); #endif nxagentCreateDrawableBitmap(pDrawable); } } else { if (nxagentDrawableBitmap(pDrawable) != NullPixmap) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Synchronization loop finished. Going to destroy synchronization bitmap.\n"); #endif nxagentDestroyDrawableBitmap(pDrawable); } } if (pDrawable -> type == DRAWABLE_PIXMAP && nxagentIsCorruptedBackground((PixmapPtr) pDrawable) == 1 && RegionNil(&exposeRegion) == 0) { struct nxagentExposeBackground eb = { .pBackground = (PixmapPtr) pDrawable, .pExpose = &exposeRegion, }; for (int i = 0; i < MAXCLIENTS; i++) { if (clients[i] != NULL) { FindClientResourcesByType(clients[i], RT_WINDOW, nxagentExposeBackgroundPredicate, &eb); } } } } #ifdef COLLECTED_UPDATES else { if (owner != NULL) { int overlap = 0; RegionValidate(&collectedUpdates, &overlap); for (int i = 0; i < RegionNumRects(&collectedUpdates); i++) { int x = RegionRects(&collectedUpdates)[i].x1; int y = RegionRects(&collectedUpdates)[i].y1; int w = RegionRects(&collectedUpdates)[i].x2 - RegionRects(&collectedUpdates)[i].x1; int h = RegionRects(&collectedUpdates)[i].y2 - RegionRects(&collectedUpdates)[i].y1; if (nxagentOption(Shadow) == 1 && (nxagentOption(XRatio) != DONT_SCALE || nxagentOption(YRatio) != DONT_SCALE)) { int scaledx = nxagentScale(x, nxagentOption(XRatio)); int scaledy = nxagentScale(y, nxagentOption(YRatio)); int scaledw = nxagentScale(x + w, nxagentOption(XRatio)) - scaledx; int scaledh = nxagentScale(y + h, nxagentOption(YRatio)) - scaledy; XClearArea(nxagentDisplay, nxagentWindow(owner), scaledx, scaledy, scaledw, scaledh, 0); } else { XClearArea(nxagentDisplay, nxagentWindow(owner), x, y, w, h, 0); } } } } #endif /* #ifdef COLLECTED_UPDATES */ nxagentSynchronizeRegionFree: if (clipRegion != NullRegion) { nxagentFreeRegion(pDrawable, clipRegion); } SAFE_free(data); RegionUninit(&exposeRegion); #ifdef COLLECTED_UPDATES RegionUninit(&collectedUpdates); #endif /* #ifdef COLLECTED_UPDATES */ return success; } void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int breakMask) { if (nxagentDrawableStatus(pDrawable) == Synchronized) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeBox: The [%s] at [%p] is already synchronized.\n", nxagentDrawableType(pDrawable), (void *) pDrawable); #endif return; } if (pBox == NullBox) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeBox: Going to synchronize the whole [%s] at [%p].\n", nxagentDrawableType(pDrawable), (void *) pDrawable); #endif nxagentSynchronizeRegion(pDrawable, NullRegion, breakMask, NULL); } else { #ifdef TEST fprintf(stderr, "nxagentSynchronizeBox: Going to create a region from box [%d,%d,%d,%d].\n", pBox -> x1, pBox -> y1, pBox -> x2, pBox -> y2); #endif RegionPtr pRegion = nxagentCreateRegion(pDrawable, NULL, pBox -> x1, pBox -> y1, pBox -> x2 - pBox -> x1, pBox -> y2 - pBox -> y1); if (RegionNil(pRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeBox: Resulting region [%d,%d,%d,%d] is nil. Skipping synchronization.\n", pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2); #endif nxagentFreeRegion(pDrawable, pRegion); return; } #ifdef TEST fprintf(stderr, "nxagentSynchronizeBox: Going to synchronize the region [%d,%d,%d,%d] of " "[%s] at [%p].\n", pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2, nxagentDrawableType(pDrawable), (void *) pDrawable); #endif nxagentSynchronizeRegion(pDrawable, pRegion, breakMask, NULL); nxagentFreeRegion(pDrawable, pRegion); } } void nxagentSynchronizeDrawablePredicate(void *p0, XID x1, void *p2) { DrawablePtr pDrawable = (DrawablePtr) p0; unsigned int *breakMask = (unsigned int *) p2; int shouldClearHiddenRegion = 1; /* * The nxagentSynchronization.abort propagates a break condition * across the resources loop, in order to block also the subsequent * synchronizations. */ if (nxagentSynchronization.abort == 1 || nxagentDrawableStatus(pDrawable) == Synchronized) { return; } /* * In order to implement a kind of round-robin synchronization, the * previous incomplete drawable synchronization is saved to jump to * the next resource available of same type. */ if (nxagentSynchronization.pDrawable != NULL && pDrawable -> type == nxagentSynchronization.drawableType) { if (nxagentSynchronization.pDrawable != pDrawable) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeDrawablePredicate: Skipping drawable [%s][%p] while looking " "for last synchronized drawable [%p].\n", nxagentDrawableType(pDrawable), (void *) pDrawable, (void *) nxagentSynchronization.pDrawable); #endif return; } else { #ifdef TEST fprintf(stderr, "nxagentSynchronizeDrawablePredicate: Last synchronized drawable [%p] found. " "Skipping to the next resource.\n", (void *) nxagentSynchronization.pDrawable); #endif nxagentSynchronization.pDrawable = NULL; return; } } if (pDrawable -> type == DRAWABLE_PIXMAP) { /* * The pixmaps to be synchronized are those used as background or * used as source of any deferred operations for at least 2 times. */ if (NXAGENT_SHOULD_SYNCHRONIZE_PIXMAP(pDrawable) == 0) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeDrawablePredicate: Skipping pixmap at [%p] " "with usage [%d] background [%d].\n", (void *) pDrawable, nxagentPixmapUsageCounter((PixmapPtr) pDrawable), nxagentIsCorruptedBackground((PixmapPtr) pDrawable)); #endif return; } #ifdef TEST else { fprintf(stderr, "nxagentSynchronizeDrawablePredicate: Synchronizing pixmap at [%p] " "with usage [%d] background [%d].\n", (void *) pDrawable, nxagentPixmapUsageCounter((PixmapPtr) pDrawable), nxagentIsCorruptedBackground((PixmapPtr) pDrawable)); } #endif } else if (NXAGENT_SHOULD_SYNCHRONIZE_WINDOW(pDrawable) == 0) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeDrawablePredicate: Skipping not visible window at [%p].\n", (void *) pDrawable); #endif if (shouldClearHiddenRegion == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeDrawablePredicate: Clearing out the not visible window " "at [%p].\n", (void *) pDrawable); #endif nxagentCleanCorruptedDrawable(pDrawable); } return; } /* * Postpone the synchronization if we went out of bandwidth or if * the display blocks. The pixmap synchronization is more careful * with bandwidth usage. */ /* FIXME: This condition sounds only as a complication, as the break parameters are already checked while synchronizing the drawable. if (breakOnCongestion(*breakMask) == 1 || (pDrawable -> type == DRAWABLE_PIXMAP && *breakMask != NEVER_BREAK && nxagentCongestion > 0)) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeDrawablePredicate: WARNING! Breaking the " "synchronization with congestion [%d] blocking [%d].\n", nxagentCongestion, nxagentBlocking); #endif nxagentSynchronization.abort = 1; return; } */ #ifdef TEST fprintf(stderr, "nxagentSynchronizeDrawablePredicate: Synchronizing drawable [%s][%p] " "with geometry (%dx%d).\n", nxagentDrawableType(pDrawable), (void *) pDrawable, pDrawable -> width, pDrawable -> height); fprintf(stderr, "nxagentSynchronizeDrawablePredicate: Corrupted extents [%d,%d,%d,%d] " "with [%ld] rects.\n", nxagentCorruptedRegion(pDrawable) -> extents.x1, nxagentCorruptedRegion(pDrawable) -> extents.y1, nxagentCorruptedRegion(pDrawable) -> extents.x2, nxagentCorruptedRegion(pDrawable) -> extents.y2, RegionNumRects(nxagentCorruptedRegion(pDrawable))); #endif /* * The stored bitmap is destroyed inside the synchronization loop, * so we have to check here its presence to know if we can clear the * dirty windows. */ shouldClearHiddenRegion = (nxagentDrawableBitmap(pDrawable) == NullPixmap); nxagentSynchronizeDrawable(pDrawable, DONT_WAIT, *breakMask, NULL); if (nxagentDrawableStatus(pDrawable) == NotSynchronized) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeDrawablePredicate: Drawable [%s][%p] not fully synchronized.\n", nxagentDrawableType(pDrawable), (void *) pDrawable); #endif /* * If the remaining corrupted region is on an hidden section (not * viewable or outside of the pixmap's area) of a drawable, we can * clear it. */ if (nxagentSynchronization.abort == 0 && shouldClearHiddenRegion == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeDrawablePredicate: Clearing out the remaining corrupted " "[%s] at [%p].\n", nxagentDrawableType(pDrawable), (void *) pDrawable); #endif nxagentCleanCorruptedDrawable(pDrawable); } } } void nxagentSynchronizationLoop(unsigned int mask) { /* FIXME: All drawables should be set as synchronized and never marked as corrupted while the display is down. */ nxagentSkipImage = nxagentTooManyImageData(); if (nxagentOption(ImageRateLimit) && nxagentSkipImage) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeDrawable: Skipping due to bit rate limit reached.\n"); #endif return; } if (NXDisplayError(nxagentDisplay) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizationLoop: WARNING! Not synchronizing the drawables " "with the display down.\n"); #endif return; } #ifdef TEST fprintf(stderr, "nxagentSynchronizationLoop: Synchronizing [%d] windows [%d] pixmaps " "and [%d] backgrounds with mask [%u].\n", nxagentCorruptedWindows, nxagentCorruptedPixmaps, nxagentCorruptedBackgrounds, mask); fprintf(stderr, "nxagentSynchronizationLoop: Stored bitmaps [%d] windows [%d] pixmaps " "and [%d] backgrounds.\n", nxagentSynchronization.windowBitmaps, nxagentSynchronization.pixmapBitmaps, nxagentSynchronization.backgroundBitmaps); fprintf(stderr, "nxagentSynchronizationLoop: Starting loops with congestion [%d] " "blocking [%d].\n", nxagentCongestion, nxagentBlocking); #endif unsigned int breakMask = mask; /* * The resource counter can be reset if we have not aborted the * synchronization loop, if we are not skipping resources to do * round-robin and if the bitmaps are all synchronized. */ int doRoundRobin = (nxagentSynchronization.pDrawable != NULL); nxagentSynchronization.abort = 0; /* * Synchronize the windows. */ if (NXAGENT_SHOULD_SYNCHRONIZE_CORRUPTED_WINDOWS(mask)) { #ifdef TEST fprintf(stderr, "nxagentSynchronizationLoop: Going to loop through corrupted window resources.\n"); #endif FindClientResourcesByType(clients[serverClient -> index], RT_NX_CORR_WINDOW, nxagentSynchronizeDrawablePredicate, &breakMask); #ifdef TEST if (nxagentSynchronization.abort == 0 && nxagentSynchronization.windowBitmaps == 0 && doRoundRobin == 0) { if (nxagentCorruptedWindows > 0) { fprintf(stderr, "nxagentSynchronizationLoop: Closing the loop with [%d] " "corrupted windows.\n", nxagentCorruptedWindows); } nxagentCorruptedWindows = 0; } #endif } /* * Synchronize the backgrounds. */ if (nxagentSynchronization.abort == 0 && NXAGENT_SHOULD_SYNCHRONIZE_CORRUPTED_BACKGROUNDS(mask)) { #ifdef TEST fprintf(stderr, "nxagentSynchronizationLoop: Going to loop through corrupted background resources.\n"); #endif FindClientResourcesByType(clients[serverClient -> index], RT_NX_CORR_BACKGROUND, nxagentSynchronizeDrawablePredicate, &breakMask); #ifdef TEST if (nxagentSynchronization.abort == 0 && nxagentSynchronization.backgroundBitmaps == 0 && doRoundRobin == 0) { if (nxagentCorruptedBackgrounds > 0) { fprintf(stderr, "nxagentSynchronizationLoop: Closing the loop with [%d] " "corrupted backgrounds.\n", nxagentCorruptedBackgrounds); } nxagentCorruptedBackgrounds = 0; } #endif } /* * If there is bandwidth remaining, synchronize the * pixmaps. Synchronizing a pixmap doesn't produce any visible * results. Better is to synchronize them on demand, before using * the pixmap in a copy or in a composite operation. */ if (nxagentSynchronization.abort == 0 && NXAGENT_SHOULD_SYNCHRONIZE_CORRUPTED_PIXMAPS(mask)) { #ifdef TEST fprintf(stderr, "nxagentSynchronizationLoop: Going to loop through corrupted pixmap resources.\n"); #endif FindClientResourcesByType(clients[serverClient -> index], RT_NX_CORR_PIXMAP, nxagentSynchronizeDrawablePredicate, &breakMask); if (nxagentSynchronization.abort == 0 && nxagentSynchronization.pixmapBitmaps == 0 && doRoundRobin == 0) { #ifdef TEST if (nxagentCorruptedPixmaps > 0) { fprintf(stderr, "nxagentSynchronizationLoop: Closing the loop with [%d] " "corrupted pixmaps.\n", nxagentCorruptedPixmaps); } #endif nxagentCorruptedPixmaps = 0; } } /* * If the last synchronized drawable has been removed, we have to * reset the variable sto- ring its pointer. */ if (nxagentSynchronization.pDrawable != NULL && nxagentFindClientResource(serverClient -> index, RT_NX_CORR_WINDOW, nxagentSynchronization.pDrawable) == 0 && nxagentFindClientResource(serverClient -> index, RT_NX_CORR_BACKGROUND, nxagentSynchronization.pDrawable) == 0 && nxagentFindClientResource(serverClient -> index, RT_NX_CORR_PIXMAP, nxagentSynchronization.pDrawable) == 0) { #ifdef TEST fprintf(stderr, "nxagentSynchronizationLoop: Synchronization drawable [%p] removed from resources.\n", (void *) nxagentSynchronization.pDrawable); #endif nxagentSynchronization.pDrawable = NULL; } #ifdef TEST fprintf(stderr, "nxagentSynchronizationLoop: Closing loops with congestion [%d] " "blocking [%d].\n", nxagentCongestion, nxagentBlocking); fprintf(stderr, "nxagentSynchronizationLoop: There are now [%d] windows [%d] pixmaps " "and [%d] backgrounds to synchronize.\n", nxagentCorruptedWindows, nxagentCorruptedPixmaps, nxagentCorruptedBackgrounds); #endif } RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height) { BoxRec box = {.x1 = x, .y1 = y, .x2 = x + width, .y2 = y + height}; RegionPtr pRegion = RegionCreate(&box, 1); /* * Clipping the region. */ if (pDrawable -> type == DRAWABLE_PIXMAP) { /* * The region created doesn't need to be clipped if it has the * pixmap dimensions. */ if (x != 0 || y != 0 || width != pDrawable -> width || height != pDrawable -> height) { BoxRec tmpBox = {.x1 = 0, .y1 = 0, .x2 = pDrawable -> width, .y2 = pDrawable -> height}; RegionRec tmpRegion; RegionInit(&tmpRegion, &tmpBox, 1); RegionIntersect(pRegion, &tmpRegion, pRegion); RegionUninit(&tmpRegion); } } else { /* * We use the clipList because the borderClip contains also parts * of the window covered by its children. */ RegionTranslate(pRegion, pDrawable -> x, pDrawable -> y); if (nxagentWindowPriv((WindowPtr) pDrawable) -> hasTransparentChildren == 1) { RegionIntersect(pRegion, pRegion, &((WindowPtr) pDrawable) -> borderClip); } else { RegionIntersect(pRegion, pRegion, &((WindowPtr) pDrawable) -> clipList); } RegionTranslate(pRegion, -pDrawable -> x, -pDrawable -> y); } #ifdef TEST fprintf(stderr, "nxagentCreateRegion: New region created with coordinates [%d,%d,%d,%d].\n", pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2); #endif /* * If the pRegion is NIL we don't need to intersect it with the GC's * clipmask. */ if (RegionNil(pRegion) == 0 && pGC != NULL && pGC -> clientClip != NULL && pGC -> clientClipType == CT_REGION) { RegionRec clipRegion; RegionInit(&clipRegion, NullBox, 1); RegionCopy(&clipRegion, (RegionPtr) pGC -> clientClip); /* * The clip origin is relative to the origin of the destination * drawable. The clip mask coor- dinates are relative to the clip * origin. */ if (pGC -> clipOrg.x != 0 || pGC -> clipOrg.y != 0) { RegionTranslate(&clipRegion, pGC -> clipOrg.x, pGC -> clipOrg.y); } #ifdef TEST fprintf(stderr, "nxagentCreateRegion: Clipping region to the clip mask with coordinates [%d,%d,%d,%d].\n", clipRegion.extents.x1, clipRegion.extents.y1, clipRegion.extents.x2, clipRegion.extents.y2); #endif RegionIntersect(pRegion, pRegion, &clipRegion); RegionUninit(&clipRegion); } return pRegion; } void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) { if (pRegion != NullRegion && RegionNil(pRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentMarkCorruptedRegion: Region [%d,%d,%d,%d] is nil. Skipping operation.\n", pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2); #endif return; } /* * If the drawable was synchronized, the counter reporting the * number of corrupted drawables must be increased. Moreover the * corrupted ti- mestamp must be set. */ if (nxagentDrawableStatus(pDrawable) == Synchronized) { if (pDrawable -> type == DRAWABLE_WINDOW) { nxagentAllocateCorruptedResource(pDrawable, RT_NX_CORR_WINDOW); } nxagentSetCorruptedTimestamp(pDrawable); } if (pRegion == NullRegion) { int x = 0; int y = 0; int width = pDrawable -> width; int height = pDrawable -> height; #ifdef TEST fprintf(stderr, "nxagentMarkCorruptedRegion: Fully invalidating %s [%p] with " "coordinates [%d,%d][%d,%d].\n", nxagentDrawableType(pDrawable), (void *) pDrawable, x, y, width, height); #endif pRegion = nxagentCreateRegion(pDrawable, NULL, x, y, width, height); nxagentValidateSplit(pDrawable, pRegion); RegionUnion(nxagentCorruptedRegion(pDrawable), nxagentCorruptedRegion(pDrawable), pRegion); nxagentFreeRegion(pDrawable, pRegion); } else { #ifdef TEST x = pRegion -> extents.x1; y = pRegion -> extents.y1; width = pRegion -> extents.x2 - pRegion -> extents.x1; height = pRegion -> extents.y2 - pRegion -> extents.y1; fprintf(stderr, "nxagentMarkCorruptedRegion: Partly invalidating %s [%p] with " "coordinates [%d,%d][%d,%d].\n", nxagentDrawableType(pDrawable), (void *) pDrawable, x, y, width, height); #endif nxagentValidateSplit(pDrawable, pRegion); RegionUnion(nxagentCorruptedRegion(pDrawable), nxagentCorruptedRegion(pDrawable), pRegion); } } void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) { if (pRegion != NullRegion && RegionNil(pRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentUnmarkCorruptedRegion: Region [%d,%d,%d,%d] is nil. Skipping operation.\n", pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2); #endif return; } int oldStatus = nxagentDrawableStatus(pDrawable); if (oldStatus == Synchronized) { #ifdef TEST fprintf(stderr, "nxagentUnmarkCorruptedRegion: Drawable %s [%p] already synchronized.\n", nxagentDrawableType(pDrawable), (void *) pDrawable); #endif return; } if (pRegion == NullRegion) { #ifdef TEST fprintf(stderr, "nxagentUnmarkCorruptedRegion: Fully validating %s [%p].\n", nxagentDrawableType(pDrawable), (void *) pDrawable); #endif nxagentValidateSplit(pDrawable, NULL); RegionEmpty(nxagentCorruptedRegion(pDrawable)); } else { #ifdef TEST fprintf(stderr, "nxagentUnmarkCorruptedRegion: Validating %s [%p] with region [%d,%d,%d,%d].\n", nxagentDrawableType(pDrawable), (void *) pDrawable, pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2); #endif nxagentValidateSplit(pDrawable, pRegion); RegionSubtract(nxagentCorruptedRegion(pDrawable), nxagentCorruptedRegion(pDrawable), pRegion); } /* * If the drawable becomes synchronized, the counter reporting the * number of corrupted drawables must be decreased. Moreover the * corrupted timestamp must be reset. */ if (oldStatus == NotSynchronized && nxagentDrawableStatus(pDrawable) == Synchronized) { if (pDrawable -> type == DRAWABLE_PIXMAP) { nxagentDestroyCorruptedResource(pDrawable, RT_NX_CORR_BACKGROUND); nxagentDestroyCorruptedResource(pDrawable, RT_NX_CORR_PIXMAP); nxagentPixmapPriv(nxagentRealPixmap((PixmapPtr) pDrawable)) -> containTrapezoids = 0; } else { nxagentDestroyCorruptedResource(pDrawable, RT_NX_CORR_WINDOW); } nxagentResetCorruptedTimestamp(pDrawable); /* * If the resource is no longer dirty, the associated bitmap is * destroyed. */ if (nxagentDrawableBitmap(pDrawable) != NullPixmap) { nxagentDestroyDrawableBitmap(pDrawable); } } } void nxagentMoveCorruptedRegion(WindowPtr pWin, unsigned int mask) { /* * If a window is resized, its corrupted region is moved according * to the bit gravity. */ if (nxagentDrawableStatus((DrawablePtr) pWin) == NotSynchronized) { if (((mask & CWHeight) && nxagentWindowPriv(pWin) -> height != pWin -> drawable.height) || ((mask & CWWidth) && nxagentWindowPriv(pWin) -> width != pWin -> drawable.width)) { int nx, ny; GravityTranslate(0, 0, nxagentWindowPriv(pWin) -> x - pWin -> origin.x + wBorderWidth(pWin), nxagentWindowPriv(pWin) -> y - pWin -> origin.y + wBorderWidth(pWin), pWin -> drawable.width - nxagentWindowPriv(pWin) -> width, pWin -> drawable.height - nxagentWindowPriv(pWin) -> height, pWin -> bitGravity, &nx, &ny); #ifdef TEST fprintf(stderr, "nxagentMoveCorruptedRegion: Moving the corrupted region to [%d,%d] for window [%p].\n", nx, ny, (void *) pWin); #endif RegionTranslate(nxagentCorruptedRegion((DrawablePtr) pWin), nx, ny); /* * Having moved the corrupted region, we need to invalidate the * pending commits or otherwise the image will fall in the wrong * area. */ nxagentValidateSplit((DrawablePtr) pWin, NULL); /* * The window reconfiguration invalidates the synchronization * bitmap. */ nxagentDestroyDrawableBitmap((DrawablePtr) pWin); } } } /* * The DDX layer uses an 'Y-X banding' representation of regions: it * sorts all rectangles composing a region using first the * y-dimension, than the x-dimension; moreover it organizes the * rectangles in 'bands' sharing the same y-dimension. This * representation does not minimize the number of rectangles. For * example, the following region has 4 rectangles: * * +-----------+ * | | +---+ * | A | | B | * | | +---+ * +-----------+ * * The rectangle 'B' creates a band which splits the rectangle A in 3 * parts, for a total of 3 bands. The number of rectangles composing * the region is 4. * * This kind of representation is not advisable for the lazy * synchronization because, in the example above, the nxagent had to * send 4 put images instead of 2. * * To minimize the problem we use the following function: by * traversing the list of rectangles we merge all boxes with same x * coordinates and coincident y, in order to create an X-Y banding. * * Be careful: all the coordinates of boxes merged are set to 0, so * take care of this when looping through the box list returned by * this function. */ BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion) { BoxRec boxExtents; BoxPtr pBox = RegionRects(pRegion); int nBox = RegionNumRects(pRegion); #ifdef TEST fprintf(stderr, "nxagentGetOptimizedRegionBoxes: Going to optimize region at [%p] with [%d] rects.\n", (void *) pRegion, nBox); #endif if (nBox <= 1) { return pBox; } #ifdef DEBUG int nBoxOptim = nBox; #endif /* * The boxes are now grouped to grown as much as possible, using * their overlapping vertex as rule. */ for (int i = 0; i < nBox; i++) { /* * If the coordinates are (0,0) the box has been already merged, * so we can skip it. */ if (pBox[i].x1 == 0 && pBox[i].y1 == 0 && pBox[i].x2 == 0 && pBox[i].y2 == 0) { continue; } #ifdef DEBUG fprintf(stderr, "nxagentGetOptimizedRegionBoxes: Referential box [%d] has coordinates [%d,%d,%d,%d].\n", i, pBox[i].x1, pBox[i].y1, pBox[i].x2, pBox[i].y2); #endif #ifdef ADVANCED_BOXES_DEFRAG boxExtents.x1 = pBox[i].x1; boxExtents.y1 = pBox[i].y1; boxExtents.x2 = pBox[i].x2; #endif boxExtents.y2 = pBox[i].y2; for (int j = i+1; j < nBox; j++) { if (pBox[j].x1 == 0 && pBox[j].y1 == 0 && pBox[j].x2 == 0 && pBox[j].y2 == 0) { continue; } #ifdef DEBUG fprintf(stderr, "nxagentGetOptimizedRegionBoxes: Mergeable box [%d] has coordinates [%d,%d,%d,%d].\n", j, pBox[j].x1, pBox[j].y1, pBox[j].x2, pBox[j].y2); #endif /* * Each consequent box is merged if its higher side overlaps the * lower side of current box. In case of ADVANCED_BOXES_DEFRAG * the higher side must be included within a range defined by * INCLUDE_MARGIN. */ #ifndef ADVANCED_BOXES_DEFRAG if (pBox[j].y1 == boxExtents.y2 && pBox[j].x1 == pBox[i].x1 && pBox[j].x2 == pBox[i].x2) #else if (pBox[j].x1 > boxExtents.x1 - INCLUDE_MARGIN && pBox[j].x1 < boxExtents.x1 + INCLUDE_MARGIN && pBox[j].y1 > boxExtents.y2 - INCLUDE_MARGIN && pBox[j].y1 < boxExtents.y2 + INCLUDE_MARGIN && pBox[j].x2 > boxExtents.x2 - INCLUDE_MARGIN && pBox[j].x2 < boxExtents.x2 + INCLUDE_MARGIN) #endif { #ifdef DEBUG fprintf(stderr, "nxagentGetOptimizedRegionBoxes: Going to merge box at [%d] with box at [%d].\n", j, i); #endif #ifdef ADVANCED_BOXES_DEFRAG if (pBox[j].x1 < boxExtents.x1) { boxExtents.x1 = pBox[j].x1; } if (pBox[j].x2 > boxExtents.x2) { boxExtents.x2 = pBox[j].x2; } if (pBox[j].y1 < boxExtents.y1) { boxExtents.y1 = pBox[j].y1; } #endif if (pBox[j].y2 > boxExtents.y2) { boxExtents.y2 = pBox[j].y2; } /* * By appending a box to another, we have to remove it from * the box list. We do this by setting its coordinates to * (0,0) and by checking their value in the main loop. */ pBox[j].x1 = pBox[j].y1 = pBox[j].x2 = pBox[j].y2 = 0; #ifdef DEBUG nBoxOptim--; #endif } } /* * Extend the box height. */ #ifdef ADVANCED_BOXES_DEFRAG pBox[i].x1 = boxExtents.x1; pBox[i].y1 = boxExtents.y1; pBox[i].x2 = boxExtents.x2; #endif pBox[i].y2 = boxExtents.y2; } #ifdef ADVANCED_BOXES_DEFRAG /* * The new list need to be validated to avoid boxes * overlapping. This code may be improved to remove also the * partial- ly overlapping boxes. */ for (int i = 0; i < nBox; i++) { if (pBox[i].x1 == 0 && pBox[i].y1 == 0 && pBox[i].x2 == 0 && pBox[i].y2 == 0) { continue; } #ifdef DEBUG fprintf(stderr, "nxagentGetOptimizedRegionBoxes: Referential box [%d] has coordinates [%d,%d,%d,%d].\n", i, pBox[i].x1, pBox[i].y1, pBox[i].x2, pBox[i].y2); #endif boxExtents.x1 = pBox[i].x1; boxExtents.y1 = pBox[i].y1; boxExtents.x2 = pBox[i].x2; boxExtents.y2 = pBox[i].y2; for (int j = i+1; j < nBox; j++) { if (pBox[j].x1 == 0 && pBox[j].y1 == 0 && pBox[j].x2 == 0 && pBox[j].y2 == 0) { continue; } #ifdef DEBUG fprintf(stderr, "nxagentGetOptimizedRegionBoxes: Mergeable box [%d] has coordinates [%d,%d,%d,%d].\n", j, pBox[j].x1, pBox[j].y1, pBox[j].x2, pBox[j].y2); #endif if ((boxExtents.x1 <= pBox[j].x1 && boxExtents.x2 >= pBox[j].x2 && boxExtents.y1 <= pBox[j].y1 && boxExtents.y2 >= pBox[j].y2)) { /* * If a box is completely inside another, we set its * coordinates to 0 to consider it as merged. */ #ifdef DEBUG fprintf(stderr, "nxagentGetOptimizedRegionBoxes: Going to merge box [%d,%d,%d,%d] " "with its box container [%d,%d,%d,%d].\n", pBox[j].x1, pBox[j].y1, pBox[j].x2, pBox[j].y2, boxExtents.x1, boxExtents.y1, boxExtents.y1, boxExtents.y2); #endif pBox[j].x1 = pBox[j].y1 = pBox[j].x2 = pBox[j].y2 = 0; #ifdef DEBUG nBoxOptim--; #endif } } } #endif #ifdef DEBUG fprintf(stderr, "nxagentGetOptimizedRegionBoxes: Original boxes number [%d] Optimized boxes number [%d].\n", nBox, nBoxOptim); #endif return pBox; } unsigned long nxagentGetColor(DrawablePtr pDrawable, int xPixel, int yPixel) { int leftPad = 0; int depth = pDrawable -> depth; int format = (depth == 1) ? XYPixmap : ZPixmap; int length = nxagentImageLength(1, 1, format, leftPad, depth); char * data = malloc(length); if (data == NULL) { #ifdef WARNING fprintf(stderr, "nxagentGetColor: WARNING! Failed to allocate memory for the operation.\n"); #endif return -1; } Visual *pVisual = nxagentImageVisual(pDrawable, depth); if (pVisual == NULL) { #ifdef WARNING fprintf(stderr, "nxagentGetColor: WARNING! Visual not found. Using default visual.\n"); #endif pVisual = nxagentVisuals[nxagentDefaultVisualIndex].visual; } fbGetImage(pDrawable, xPixel, yPixel, 1, 1, format, AllPlanes, data); XImage *ximage = XCreateImage(nxagentDisplay, pVisual, depth, format, leftPad, (char *) data, 1, 1, BitmapPad(nxagentDisplay), nxagentImagePad(1, format, leftPad, 1)); if (ximage == NULL) { #ifdef WARNING fprintf(stderr, "nxagentGetColor: WARNING! Failed to create the XImage.\n"); #endif SAFE_free(data); return -1; } unsigned long pixel = XGetPixel(ximage, 0, 0); XDestroyImage(ximage); return pixel; } /* * This function could be used to determine the ClearArea color of * corrupted regions on screen. */ unsigned long nxagentGetRegionColor(DrawablePtr pDrawable, RegionPtr pRegion) { if (RegionNil(pRegion) == 1) { return nxagentGetDrawableColor(pDrawable); } /* * The pixel used as reference is the first outer pixel at the * bottom right corner of corrupted region extents. */ int xPicker = pRegion -> extents.x2 + 1; if (xPicker > pDrawable -> width) { xPicker = pDrawable -> width; } int yPicker = pRegion -> extents.y2 + 1; if (yPicker > pDrawable -> height) { yPicker = pDrawable -> height; } return nxagentGetColor(pDrawable, xPicker, yPicker); } unsigned long nxagentGetDrawableColor(DrawablePtr pDrawable) { /* * The pixel used to determine the color of a drawable is at * coordinates (x + width - 4, y + 4). */ return nxagentGetColor(pDrawable, pDrawable -> width - 4, 4); } void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion) { unsigned long backupPixel = 0; #ifdef DEBUG static int nBoxCleared; #endif if (pDrawable -> type != DRAWABLE_WINDOW) { #ifdef TEST fprintf(stderr, "nxagentClearRegion: Cannot clear a pixmap. Exiting.\n"); #endif return; } if (pRegion == NullRegion || RegionNil(pRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentClearRegion: The region is empty. Exiting.\n"); #endif return; } WindowPtr pWin = (WindowPtr) pDrawable; int restore = 0; /* * If the window has already a background, we can hope it will be * nice. */ if (pWin -> backgroundState != None) { #ifdef DEBUG fprintf(stderr, "nxagentClearRegion: Window at [%p] has background state [%u].\n", (void *) pWin, pWin -> backgroundState); #endif } else { /* * Save the original state. */ backupPixel = pWin -> background.pixel; unsigned long color = nxagentGetDrawableColor((DrawablePtr) pWin); if (color == -1) { color = 0xffffff; } pWin -> backgroundState = BackgroundPixel; pWin -> background.pixel = color; nxagentChangeWindowAttributes(pWin, CWBackPixel); #ifdef DEBUG fprintf(stderr, "nxagentClearRegion: Window at [%p] now has pixel background [%ld].\n", (void *) pWin, color); #endif restore = 1; } BoxPtr pBox = nxagentGetOptimizedRegionBoxes(pRegion); int nBox = RegionNumRects(pRegion); for (int i = 0; i < nBox; i++) { if (pBox[i].x1 == 0 && pBox[i].y1 == 0 && pBox[i].x2 == 0 && pBox[i].y2 == 0) { continue; } XClearArea(nxagentDisplay, nxagentWindow(pWin), pBox[i].x1, pBox[i].y1, pBox[i].x2 - pBox[i].x1, pBox[i].y2 - pBox[i].y1, False); #ifdef DEBUG nBoxCleared++; #endif } /* * Restore the old state. */ if (restore == 1) { pWin -> backgroundState = None; pWin -> background.pixel = backupPixel; } #ifdef DEBUG fprintf(stderr, "nxagentClearRegion: Number of cleared boxes is [%d].\n", nBoxCleared); #endif } void nxagentFillRemoteRegion(DrawablePtr pDrawable, RegionPtr pRegion) { if (RegionNil(pRegion) == 1) { return; } GCPtr pGC = nxagentGetGraphicContext(pDrawable); int nrects = RegionNumRects(pRegion); #ifdef TEST fprintf(stderr, "nxagentFillRemoteRegion: Going to fill remote region [%d,%d,%d,%d] rects [%d] with color [%lu].\n", pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2, nrects, pGC -> fgPixel); #endif if (nrects == 1) { XFillRectangle(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2 - pRegion -> extents.x1, pRegion -> extents.y2 - pRegion -> extents.y1); } else { BoxPtr pBox = RegionRects(pRegion); XRectangle *pRects = malloc(nrects * sizeof(XRectangle)); for (int i = 0; i < nrects; i++) { pRects[i].x = pBox[i].x1; pRects[i].y = pBox[i].y1; pRects[i].width = pBox[i].x2 - pBox[i].x1; pRects[i].height = pBox[i].y2 - pBox[i].y1; } XFillRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), pRects, nrects); SAFE_free(pRects); } } int nxagentDestroyCorruptedWindowResource(void * p, XID id) { #ifdef TEST fprintf(stderr, "nxagentDestroyCorruptedWindowResource: Removing corrupted window [%p] from resources.\n", (void *) p); #endif nxagentWindowPriv((WindowPtr) p) -> corruptedId = None; return 1; } int nxagentDestroyCorruptedPixmapResource(void * p, XID id) { #ifdef TEST fprintf(stderr, "nxagentDestroyCorruptedPixmapResource: Removing corrupted pixmap [%p] from resources.\n", (void *) p); #endif nxagentPixmapPriv((PixmapPtr) p) -> corruptedId = None; return 1; } int nxagentDestroyCorruptedBackgroundResource(void * p, XID id) { #ifdef TEST fprintf(stderr, "nxagentDestroyCorruptedBackgroundResource: Removing corrupted pixmap background [%p] from resources.\n", (void *) p); #endif nxagentPixmapPriv((PixmapPtr) p) -> corruptedBackgroundId = None; return 1; } void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode, int nPoints, xPoint *pPoints) { RegionPtr pRegion = RegionCreate(NullBox, 1); xPoint *xp = pPoints; for (int np = nPoints; np--; xp++) { BoxRec box; if (CoordModePrevious) { box.x1 = box.x2 = (xp-1) -> x + xp -> x; box.y1 = box.y2 = (xp-1) -> y + xp -> y; } else { box.x1 = box.x2 = xp -> x; box.y1 = box.y2 = xp -> y; } #ifdef TEST fprintf(stderr, "nxagentPointsToDirtyRegion: Adding the point (%d,%d) to the dirty region.\n", box.x1, box.y1); #endif /* * By using REGION_APPEND() and REGION_VALIDATE() * this loop could become less expensive. */ RegionRec tmpRegion; RegionInit(&tmpRegion, &box, 1); RegionUnion(pRegion, pRegion, &tmpRegion); RegionUninit(&tmpRegion); } BoxRec extents = *RegionExtents(pRegion); RegionReset(pRegion, &extents); #ifdef TEST fprintf(stderr, "nxagentPointsToDirtyRegion: The resulting dirty region has [%ld] rects and" " extents (%d,%d,%d,%d).\n", RegionNumRects(pRegion), extents.x1, extents.y1, extents.x2, extents.y2); #endif nxagentMarkCorruptedRegion(pDrawable, pRegion); RegionDestroy(pRegion); } #ifdef DUMP #define USE_MULTIPLE_COLORS void nxagentCorruptedRegionOnWindow(void *p0, XID x, void *p2) { WindowPtr pWin = (WindowPtr) p0; RegionPtr clipRegion; RegionRec visRegion; BoxPtr pBox; XlibGC gc; XGCValues value; static unsigned long color = 0xff000000; int nrectangles; int i; /* * There are no regions to draw. */ if (nxagentDrawableStatus((DrawablePtr) pWin) == Synchronized) { return; } /* * The window is not visible. */ if (nxagentWindowIsVisible(pWin) == 0) { return; } #ifdef TEST fprintf(stderr, "nxagentCorruptedRegionOnWindow: Going to draw on window at [%p].\n", (void *) pWin); #endif clipRegion = nxagentCreateRegion((DrawablePtr) pWin, NULL, 0, 0, pWin -> drawable.width, pWin -> drawable.height); RegionInit(&visRegion, NullBox, 1); RegionIntersect(&visRegion, clipRegion, nxagentCorruptedRegion((DrawablePtr) pWin)); nxagentFreeRegion(pWin -> drawable.pScreen, clipRegion); if (RegionNil(&visRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentCorruptedRegionOnWindow: The corrupted region of window at [%p] is hidden.\n", (void *) pWin); #endif RegionUninit(&visRegion); return; } nxagentClearRegion((DrawablePtr) pWin, &visRegion); #ifdef USE_MULTIPLE_COLORS color += nxagentWindow(pWin) * 5; if (color == 0 || color == 0xffffffff) { color = 0xff000000; } #endif value.foreground = color; value.subwindow_mode = IncludeInferiors; gc = XCreateGC(nxagentDisplay, nxagentWindow(pWin), GCForeground | GCSubwindowMode, &value); nrectangles = RegionNumRects(&visRegion); #ifdef TEST fprintf(stderr, "nxagentCorruptedRegionOnWindow: Going to draw the region with extents [%d,%d,%d,%d] and [%d] rects.\n", visRegion.extents.x1, visRegion.extents.y1, visRegion.extents.x2, visRegion.extents.y2, nrectangles); #endif pBox = nxagentGetOptimizedRegionBoxes(&visRegion); for (i = 0; i < nrectangles; i++) { if (pBox[i].x1 == 0 && pBox[i].y1 == 0 && pBox[i].x2 == 0 && pBox[i].y2 == 0) { continue; } XDrawRectangle(nxagentDisplay, nxagentWindow(pWin), gc, pBox[i].x1, pBox[i].y1, pBox[i].x2 - pBox[i].x1 - 1, pBox[i].y2 - pBox[i].y1 - 1); } XFreeGC(nxagentDisplay, gc); RegionUninit(&visRegion); } void nxagentRegionsOnScreen(void) { FindClientResourcesByType(clients[serverClient -> index], RT_NX_CORR_WINDOW, nxagentCorruptedRegionOnWindow, NULL); } #endif /* * If the synchronization loop breaks and the drawable synchronization * cannot be completed, the remaining data is stored in a bitmap. The * synchronization loop is then restarted using the bitmap as source * instead of the drawable. */ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable) { GCPtr pGC = NULL; RegionPtr pClipRegion = NullRegion; #ifdef TEST fprintf(stderr, "nxagentCreateDrawableBitmap: Creating synchronization bitmap for [%s] at [%p].\n", nxagentDrawableType(pDrawable), (void *) pDrawable); #endif /* * The bitmap is created only in the nxagent. */ int saveTrap = nxagentGCTrap; nxagentGCTrap = 1; if (nxagentDrawableStatus(pDrawable) == Synchronized) { #ifdef TEST fprintf(stderr, "nxagentCreateDrawableBitmap: The drawable is already synchronized. Skipping bitmap creation.\n"); #endif goto nxagentCreateDrawableBitmapEnd; } /* * Should create a function to append a bitmap to another, instead * of destroying the old one. */ if (nxagentDrawableBitmap(pDrawable) != NullPixmap) { #ifdef WARNING fprintf(stderr, "nxagentCreateDrawableBitmap: WARNING! Going to replace the bitmap at [%p] with corrupted [%d,%d,%d,%d].\n", (void *) nxagentDrawableBitmap(pDrawable), nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x1, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y1, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x2, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y2); #endif nxagentDestroyDrawableBitmap(pDrawable); } /* * Clipping to the visible area. */ pClipRegion = nxagentCreateRegion(pDrawable, NULL, 0, 0, pDrawable -> width, pDrawable -> height); RegionIntersect(pClipRegion, pClipRegion, nxagentCorruptedRegion(pDrawable)); if (RegionNil(pClipRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentCreateDrawableBitmap: The corrupted region is not visible. Skipping bitmap creation.\n"); #endif goto nxagentCreateDrawableBitmapEnd; } /* * FIXME: A better way it would be create the bitmap with the same * extents of the clipRegion. This requires to save the offset with * respect to the drawable origin like in the backing store. This * becomes particularly important when the drawable is a huge * window, because the pixmap creation would fail. */ PixmapPtr pBitmap; pBitmap = nxagentCreatePixmap(pDrawable -> pScreen, pDrawable -> width, pDrawable -> height, pDrawable -> depth, 0); if (pBitmap == NULL) { #ifdef WARNING fprintf(stderr, "nxagentCreateDrawableBitmap: Cannot create pixmap for the bitmap data.\n"); #endif goto nxagentCreateDrawableBitmapEnd; } pGC = GetScratchGC(pBitmap -> drawable.depth, pBitmap -> drawable.pScreen); ValidateGC((DrawablePtr) pBitmap, pGC); int x = pClipRegion -> extents.x1; int y = pClipRegion -> extents.y1; int w = pClipRegion -> extents.x2 - pClipRegion -> extents.x1; int h = pClipRegion -> extents.y2 - pClipRegion -> extents.y1; nxagentCopyArea(pDrawable, (DrawablePtr) pBitmap, pGC, x, y, w, h, x, y); RegionUnion(nxagentCorruptedRegion((DrawablePtr) pBitmap), nxagentCorruptedRegion((DrawablePtr) pBitmap), pClipRegion); if (pDrawable -> type == DRAWABLE_PIXMAP) { nxagentPixmapPriv(nxagentRealPixmap((PixmapPtr) pDrawable)) -> synchronizationBitmap = pBitmap; if (nxagentIsCorruptedBackground((PixmapPtr) pDrawable) == 1) { nxagentSynchronization.backgroundBitmaps++; } else { nxagentSynchronization.pixmapBitmaps++; } } else { nxagentWindowPriv((WindowPtr) pDrawable) -> synchronizationBitmap = pBitmap; nxagentSynchronization.windowBitmaps++; } #ifdef TEST fprintf(stderr, "nxagentCreateDrawableBitmap: Drawable [%p] has bitmap at [%p] with corrupted [%d,%d,%d,%d].\n", (void *) pDrawable, (void *) nxagentDrawableBitmap(pDrawable), nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x1, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y1, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x2, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y2); #endif nxagentCreateDrawableBitmapEnd: nxagentGCTrap = saveTrap; if (pClipRegion != NullRegion) { nxagentFreeRegion(pDrawable, pClipRegion); } if (pGC != NULL) { FreeScratchGC(pGC); } } void nxagentDestroyDrawableBitmap(DrawablePtr pDrawable) { if (nxagentDrawableBitmap(pDrawable) != NullPixmap) { #ifdef TEST fprintf(stderr, "nxagentDestroyDrawableBitmap: Destroying bitmap for drawable at [%p].\n", (void *) pDrawable); #endif nxagentDestroyPixmap(nxagentDrawableBitmap(pDrawable)); if (pDrawable -> type == DRAWABLE_PIXMAP) { nxagentPixmapPriv(nxagentRealPixmap((PixmapPtr) pDrawable)) -> synchronizationBitmap = NullPixmap; if (nxagentIsCorruptedBackground((PixmapPtr) pDrawable) == 1) { nxagentSynchronization.backgroundBitmaps--; } else { nxagentSynchronization.pixmapBitmaps--; } } else { nxagentWindowPriv((WindowPtr) pDrawable) -> synchronizationBitmap = NullPixmap; nxagentSynchronization.windowBitmaps--; } } } void nxagentIncreasePixmapUsageCounter(PixmapPtr pPixmap) { if (nxagentDrawableStatus((DrawablePtr) pPixmap) == Synchronized) { return; } #ifdef TEST fprintf(stderr, "nxagentIncreasePixmapUsageCounter: Pixmap usage counter was [%d].\n", nxagentPixmapUsageCounter(pPixmap)); #endif nxagentPixmapUsageCounter(pPixmap) += 1; nxagentAllocateCorruptedResource((DrawablePtr) pPixmap, RT_NX_CORR_PIXMAP); } void nxagentAllocateCorruptedResource(DrawablePtr pDrawable, RESTYPE type) { PixmapPtr pRealPixmap; if (nxagentSessionState == SESSION_DOWN) { #ifdef TEST fprintf(stderr, "nxagentAllocateCorruptedResource: WARNING! Not allocated corrupted resource " "[%s][%p] with the display down.\n", nxagentDrawableType(pDrawable), (void *) pDrawable); #endif return; } if (type == RT_NX_CORR_WINDOW) { if (nxagentWindowPriv((WindowPtr) pDrawable) -> corruptedId == 0) { #ifdef TEST fprintf(stderr, "nxagentAllocateCorruptedResource: New resource at [%p]. Corrupted " "windows counter was [%d].\n", (void *) pDrawable, nxagentCorruptedWindows); #endif nxagentCorruptedWindows++; nxagentWindowPriv((WindowPtr) pDrawable) -> corruptedId = FakeClientID(serverClient -> index); AddResource(nxagentWindowPriv((WindowPtr) pDrawable) -> corruptedId, RT_NX_CORR_WINDOW, (void *) pDrawable); } } else if (type == RT_NX_CORR_BACKGROUND) { pRealPixmap = nxagentRealPixmap((PixmapPtr) pDrawable); if (nxagentPixmapPriv(pRealPixmap) -> corruptedBackgroundId == 0) { /* * When a pixmap is added to the background corrupted resources, * it must be removed from the pixmap corrupted resources. */ nxagentDestroyCorruptedResource(pDrawable, RT_NX_CORR_PIXMAP); #ifdef TEST fprintf(stderr, "nxagentAllocateCorruptedResource: New resource at [%p]. Corrupted " "backgrounds counter was [%d].\n", (void *) pDrawable, nxagentCorruptedBackgrounds); #endif nxagentCorruptedBackgrounds++; nxagentPixmapPriv(pRealPixmap) -> corruptedBackgroundId = FakeClientID(serverClient -> index); AddResource(nxagentPixmapPriv(pRealPixmap) -> corruptedBackgroundId, RT_NX_CORR_BACKGROUND, (void *) pRealPixmap); } } else if (type == RT_NX_CORR_PIXMAP) { /* * The shared memory pixmaps are always dirty and shouldn't be * synchronized. */ if (nxagentPixmapUsageCounter((PixmapPtr) pDrawable) >= MINIMUM_PIXMAP_USAGE_COUNTER && nxagentIsShmPixmap((PixmapPtr) pDrawable) == 0) { pRealPixmap = nxagentRealPixmap((PixmapPtr) pDrawable); if (nxagentPixmapPriv(pRealPixmap) -> corruptedId == 0) { #ifdef TEST fprintf(stderr, "nxagentAllocateCorruptedResource: New resource at [%p]. Corrupted " "pixmaps counter was [%d].\n", (void *) pDrawable, nxagentCorruptedPixmaps); #endif nxagentCorruptedPixmaps++; nxagentPixmapPriv(pRealPixmap) -> corruptedId = FakeClientID(serverClient -> index); AddResource(nxagentPixmapPriv(pRealPixmap) -> corruptedId, RT_NX_CORR_PIXMAP, (void *) pRealPixmap); } } } } void nxagentDestroyCorruptedResource(DrawablePtr pDrawable, RESTYPE type) { PixmapPtr pRealPixmap; if (type == RT_NX_CORR_WINDOW) { if (nxagentWindowPriv((WindowPtr) pDrawable) -> corruptedId != 0) { #ifdef TEST fprintf(stderr, "nxagentDestroyCorruptedResource: Removing resource at [%p]. Corrupted " "windows counter was [%d].\n", (void *) pDrawable, nxagentCorruptedWindows); #endif if (nxagentCorruptedWindows > 0) { nxagentCorruptedWindows--; } FreeResource(nxagentWindowPriv((WindowPtr) pDrawable) -> corruptedId, RT_NONE); if (nxagentSynchronization.pDrawable == pDrawable) { nxagentSynchronization.pDrawable = NULL; } } } else if (type == RT_NX_CORR_BACKGROUND) { pRealPixmap = nxagentRealPixmap((PixmapPtr) pDrawable); if (nxagentPixmapPriv(pRealPixmap) -> corruptedBackgroundId != 0) { #ifdef TEST fprintf(stderr, "nxagentDestroyCorruptedResource: Removing resource at [%p]. Corrupted " "backgrounds counter was [%d].\n", (void *) pDrawable, nxagentCorruptedBackgrounds); #endif if (nxagentCorruptedBackgrounds > 0) { nxagentCorruptedBackgrounds--; } FreeResource(nxagentPixmapPriv(pRealPixmap) -> corruptedBackgroundId, RT_NONE); if (nxagentSynchronization.pDrawable == pDrawable) { nxagentSynchronization.pDrawable = NULL; } } } else if (type == RT_NX_CORR_PIXMAP) { pRealPixmap = nxagentRealPixmap((PixmapPtr) pDrawable); if (nxagentPixmapPriv(pRealPixmap) -> corruptedId != 0) { #ifdef TEST fprintf(stderr, "nxagentDestroyCorruptedResource: Removing resource at [%p]. Corrupted " "pixmaps counter was [%d].\n", (void *) pDrawable, nxagentCorruptedPixmaps); #endif if (nxagentCorruptedPixmaps > 0) { nxagentCorruptedPixmaps--; } FreeResource(nxagentPixmapPriv(pRealPixmap) -> corruptedId, RT_NONE); if (nxagentSynchronization.pDrawable == pDrawable) { nxagentSynchronization.pDrawable = NULL; } } } } void nxagentCleanCorruptedDrawable(DrawablePtr pDrawable) { if (nxagentDrawableStatus(pDrawable) == Synchronized) { return; } #ifdef TEST fprintf(stderr, "nxagentCleanCorruptedDrawable: Clearing out the corrupted drawable [%s][%p].\n", nxagentDrawableType(pDrawable), (void *) pDrawable); #endif nxagentUnmarkCorruptedRegion(pDrawable, NullRegion); if (nxagentDrawableBitmap(pDrawable) != NullPixmap) { nxagentDestroyDrawableBitmap(pDrawable); } } void nxagentUnmarkExposedRegion(WindowPtr pWin, RegionPtr pRegion, RegionPtr pOther) { RegionRec clipRegion; if (pRegion != NullRegion && RegionNil(pRegion) == 0 && nxagentDrawableStatus((DrawablePtr) pWin) == NotSynchronized) { RegionInit(&clipRegion, NullBox, 1); RegionCopy(&clipRegion, pRegion); if (pOther != NullRegion && RegionNil(pOther) == 0) { RegionUnion(&clipRegion, &clipRegion, pOther); } RegionTranslate(&clipRegion, -pWin -> drawable.x, -pWin -> drawable.y); #ifdef TEST fprintf(stderr, "nxagentUnmarkExposedRegion: Validating expose region [%d,%d,%d,%d] " "on window [%p].\n", clipRegion.extents.x1, clipRegion.extents.y1, clipRegion.extents.x2, clipRegion.extents.y2, (void *) pWin); #endif nxagentUnmarkCorruptedRegion((DrawablePtr) pWin, &clipRegion); RegionUninit(&clipRegion); } } int nxagentSynchronizationPredicate(void) { if (nxagentCorruptedWindows == 0 && nxagentCorruptedBackgrounds == 0 && nxagentCorruptedPixmaps == 0) { return NotNeeded; } if (nxagentBlocking == 0 && nxagentCongestion <= 4 && nxagentReady == 0 && nxagentUserInput(NULL) == 0) { return Needed; } /* * If there are resources to synchronize but the conditions to start * the loop are not satisfied, a little delay is requested to check * for a new loop as soon as possible. */ return Delayed; } void nxagentSendBackgroundExpose(WindowPtr pWin, PixmapPtr pBackground, RegionPtr pExpose) { RegionRec expose; miBSWindowPtr pBackingStore; RegionInit(&expose, NullBox, 1); #ifdef DEBUG fprintf(stderr, "nxagentSendBackgroundExpose: Original expose region is [%d,%d,%d,%d].\n", pExpose -> extents.x1, pExpose -> extents.y1, pExpose -> extents.x2, pExpose -> extents.y2); fprintf(stderr, "nxagentSendBackgroundExpose: Window clipList is [%d,%d,%d,%d].\n", pWin -> clipList.extents.x1, pWin -> clipList.extents.y1, pWin -> clipList.extents.x2, pWin -> clipList.extents.y2); #endif if (nxagentDrawableStatus((DrawablePtr) pBackground) == Synchronized && (pBackground -> drawable.width < pWin -> drawable.width || pBackground -> drawable.height < pWin -> drawable.height)) { #ifdef TEST fprintf(stderr, "nxagentSendBackgroundExpose: Pixmap background [%dx%d] is " "smaller than window [%dx%d]. Going to expose the winSize.\n", pBackground -> drawable.width, pBackground -> drawable.height, pWin -> drawable.width, pWin -> drawable.height); #endif RegionCopy(&expose, &pWin -> winSize); } else { RegionCopy(&expose, pExpose); RegionTranslate(&expose, pWin -> drawable.x, pWin -> drawable.y); } RegionSubtract(&expose, &expose, nxagentCorruptedRegion((DrawablePtr) pWin)); if (RegionNil(&pWin -> clipList) != 0) { #ifdef TEST fprintf(stderr, "nxagentSendBackgroundExpose: Exposures deferred because the window " "is hidden.\n"); #endif RegionUnion(nxagentDeferredBackgroundExposures, nxagentDeferredBackgroundExposures, &expose); nxagentWindowPriv(pWin) -> deferredBackgroundExpose = 1; goto nxagentSendBackgroundExposeEnd; } #ifdef TEST fprintf(stderr, "nxagentSendBackgroundExpose: Sending expose [%d,%d,%d,%d].\n", expose.extents.x1, expose.extents.y1, expose.extents.x2, expose.extents.y2); #endif /* * This prevents hidden region to be exposed. */ pBackingStore = (miBSWindowPtr)pWin->backStorage; if ((pBackingStore != NULL) && (RegionNil(&pBackingStore->SavedRegion) == 0)) { RegionTranslate(&expose, -pWin -> drawable.x, -pWin -> drawable.y); RegionSubtract(&expose, &expose, &pBackingStore -> SavedRegion); RegionTranslate(&expose, pWin -> drawable.x, pWin -> drawable.y); } RegionIntersect(&expose, &expose, &pWin -> clipList); /* * Reduce the overall region to expose. */ RegionTranslate(&expose, -pWin -> drawable.x, -pWin -> drawable.y); RegionSubtract(pExpose, pExpose, &expose); RegionTranslate(&expose, pWin -> drawable.x, pWin -> drawable.y); miWindowExposures(pWin, &expose, &expose); nxagentSendBackgroundExposeEnd: RegionUninit(&expose); } void nxagentExposeBackgroundPredicate(void *p0, XID x1, void *p2) { WindowPtr pWin = (WindowPtr) p0; struct nxagentExposeBackground *pPair = p2; if (RegionNil(pPair -> pExpose) != 0) { return; } if (pWin -> backgroundState == BackgroundPixmap && pWin -> background.pixmap == pPair -> pBackground) { #ifdef TEST fprintf(stderr, "nxagentExposeBackgroundPredicate: Window at [%p] uses pixmap [%p] " "as background.\n", (void *) pWin, (void *) pPair -> pBackground); #endif nxagentSendBackgroundExpose(pWin, pPair -> pBackground, pPair -> pExpose); } else if (pWin -> backgroundState == ParentRelative) { #ifdef TEST fprintf(stderr, "nxagentExposeBackgroundPredicate: Window [%p] uses parent's background.\n", (void *) pWin); #endif WindowPtr pParent = pWin -> parent; while (pParent != NULL) { if (pParent -> backgroundState == BackgroundPixmap && pParent -> background.pixmap == pPair -> pBackground) { #ifdef TEST fprintf(stderr, "nxagentExposeBackgroundPredicate: Parent window at [%p] uses pixmap [%p] " "as background.\n", (void *) pParent, (void *) pPair -> pBackground); #endif nxagentSendBackgroundExpose(pWin, pPair -> pBackground, pPair -> pExpose); break; } pParent = pParent -> parent; } } } /* * This function is similar to nxagentClipAndSendExpose(). */ int nxagentClipAndSendClearExpose(WindowPtr pWin, void * ptr) { RegionPtr remoteExposeRgn = (RegionRec *) ptr; if (nxagentWindowPriv(pWin) -> deferredBackgroundExpose == 1) { RegionPtr exposeRgn = RegionCreate(NULL, 1); #ifdef DEBUG BoxRec box = *RegionExtents(remoteExposeRgn); fprintf(stderr, "nxagentClipAndSendClearExpose: Background expose extents: [%d,%d,%d,%d].\n", box.x1, box.y1, box.x2, box.y2); box = *RegionExtents(&pWin -> clipList); fprintf(stderr, "nxagentClipAndSendClearExpose: Clip list extents for window at [%p]: [%d,%d,%d,%d].\n", (void *) pWin, box.x1, box.y1, box.x2, box.y2); #endif RegionIntersect(exposeRgn, remoteExposeRgn, &pWin -> clipList); /* * If the region will be synchronized, the expose on corrupted * regions can be ignored. */ RegionSubtract(exposeRgn, exposeRgn, nxagentCorruptedRegion((DrawablePtr) pWin)); if (RegionNotEmpty(exposeRgn)) { #ifdef DEBUG box = *RegionExtents(exposeRgn); fprintf(stderr, "nxagentClipAndSendClearExpose: Forwarding expose [%d,%d,%d,%d] to window at [%p] pWin.\n", box.x1, box.y1, box.x2, box.y2, (void *) pWin); #endif RegionSubtract(remoteExposeRgn, remoteExposeRgn, exposeRgn); miWindowExposures(pWin, exposeRgn, exposeRgn); } RegionDestroy(exposeRgn); nxagentWindowPriv(pWin) -> deferredBackgroundExpose = 0; } if (RegionNotEmpty(remoteExposeRgn)) { #ifdef DEBUG fprintf(stderr, "nxagentClipAndSendClearExpose: Region not empty. Walk children.\n"); #endif return WT_WALKCHILDREN; } else { #ifdef DEBUG fprintf(stderr, "nxagentClipAndSendClearExpose: Region empty. Stop walking.\n"); #endif return WT_STOPWALKING; } } void nxagentSendDeferredBackgroundExposures(void) { if (nxagentDeferredBackgroundExposures == NullRegion) { nxagentDeferredBackgroundExposures = RegionCreate(NullBox, 1); } if (RegionNotEmpty(nxagentDeferredBackgroundExposures) != 0) { #ifdef TEST fprintf(stderr, "nxagentSendDeferredBackgroundExposures: Going to send deferred exposures to the root window.\n"); #endif TraverseTree(screenInfo.screens[0]->root, nxagentClipAndSendClearExpose, (void *) nxagentDeferredBackgroundExposures); RegionEmpty(nxagentDeferredBackgroundExposures); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Drawable.h0000644000000000000000000001777613614532331020571 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Drawable_H__ #define __Drawable_H__ #include "resource.h" #include "Windows.h" #include "Pixmaps.h" /* * Structures and macros used to manage the Lazy encoding. */ typedef struct { DrawablePtr pDrawable; int drawableType; int abort; int windowBitmaps; int pixmapBitmaps; int backgroundBitmaps; } _nxagentSynchronizationRec; extern _nxagentSynchronizationRec nxagentSynchronization; enum DrawableStatus { Synchronized, NotSynchronized }; enum SynchronizationPredicate { Needed, NotNeeded, Delayed }; /* * Shall the synchronization wait for the * drawable wakening? */ #define DONT_WAIT 0 #define DO_WAIT 1 /* * How the synchronization loop can be * interrupted? A 0 mask means that the * loop can't be stopped. */ #define EVENT_BREAK (1 << 0) #define CONGESTION_BREAK (1 << 1) #define BLOCKING_BREAK (1 << 2) #define NEVER_BREAK 0 #define ALWAYS_BREAK (EVENT_BREAK | \ CONGESTION_BREAK | \ BLOCKING_BREAK) /* * Minimum value of usage counter which * a pixmap should have to be synchronized. */ #define MINIMUM_PIXMAP_USAGE_COUNTER 2 /* * This is the macro used to get the external XID * from a generic pointer to a drawable. */ #define nxagentDrawable(pDrawable) \ ((pDrawable)->type == DRAWABLE_WINDOW ? \ nxagentWindow((WindowPtr)pDrawable) : \ nxagentPixmap((PixmapPtr)pDrawable)) #define nxagentVirtualDrawable(pDrawable) \ (DrawablePtr)((pDrawable)->type == DRAWABLE_WINDOW ? \ NULL : nxagentVirtualPixmap((PixmapPtr)pDrawable)) #define nxagentDrawablePicture(pDrawable) \ ((DrawablePtr)((pDrawable)->type == DRAWABLE_WINDOW ? \ nxagentWindowPriv((WindowPtr)pDrawable) -> pPicture : \ nxagentPixmapPriv((PixmapPtr)pDrawable) -> pPicture)) #define nxagentCorruptedRegion(pDrawable) \ ((pDrawable) -> type == DRAWABLE_PIXMAP ? \ nxagentPixmapCorruptedRegion((PixmapPtr) pDrawable) : \ nxagentWindowCorruptedRegion((WindowPtr) pDrawable)) #define nxagentDrawableStatus(pDrawable) \ (RegionNil(nxagentCorruptedRegion(pDrawable)) ? \ Synchronized : NotSynchronized) #define nxagentDrawableContainGlyphs(pDrawable) \ ((pDrawable) -> type == DRAWABLE_PIXMAP ? \ nxagentPixmapContainGlyphs((PixmapPtr) (pDrawable)) : \ nxagentWindowContainGlyphs((WindowPtr) (pDrawable))) #define nxagentSetDrawableContainGlyphs(pDrawable, value) \ do \ { \ if ((pDrawable) -> type == DRAWABLE_PIXMAP) \ { \ nxagentPixmapContainGlyphs(nxagentRealPixmap((PixmapPtr) (pDrawable))) = (value); \ } \ else \ { \ nxagentWindowContainGlyphs((WindowPtr) (pDrawable)) = (value); \ } \ } while (0) #define nxagentDrawableBitmap(pDrawable) \ ((pDrawable) -> type == DRAWABLE_PIXMAP ? \ nxagentPixmapPriv(nxagentRealPixmap((PixmapPtr) (pDrawable))) -> synchronizationBitmap : \ nxagentWindowPriv((WindowPtr) (pDrawable)) -> synchronizationBitmap) #define nxagentDrawableTimestamp(pDrawable) \ ((pDrawable) -> type == DRAWABLE_PIXMAP ? \ nxagentPixmapTimestamp((PixmapPtr) pDrawable) : \ nxagentWindowTimestamp((WindowPtr) pDrawable)) #define nxagentDrawableType(pDrawable) \ ((pDrawable) -> type == DRAWABLE_PIXMAP ? "pixmap" : "window") extern RESTYPE RT_NX_CORR_BACKGROUND; extern RESTYPE RT_NX_CORR_WINDOW; extern RESTYPE RT_NX_CORR_PIXMAP; extern int nxagentCorruptedPixmaps; extern int nxagentCorruptedWindows; extern int nxagentCorruptedBackgrounds; extern int nxagentForceSynchronization; extern RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height); #define nxagentFreeRegion(pDrawable, pRegion) \ RegionDestroy(pRegion); extern void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion); extern void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion); extern void nxagentMoveCorruptedRegion(WindowPtr pWin, unsigned int mask); extern void nxagentIncreasePixmapUsageCounter(PixmapPtr pPixmap); extern int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned int breakMask, WindowPtr owner); extern void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int breakMask); extern int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int breakMask, WindowPtr owner); extern int nxagentSynchronizeDrawableData(DrawablePtr pDrawable, unsigned int breakMask, WindowPtr owner); extern void nxagentSynchronizationLoop(unsigned int mask); extern int nxagentSynchronizationPredicate(void); extern BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion); extern void nxagentCleanCorruptedDrawable(DrawablePtr pDrawable); extern void nxagentUnmarkExposedRegion(WindowPtr pWin, RegionPtr pRegion, RegionPtr pOther); extern void nxagentSendDeferredBackgroundExposures(void); extern void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion); extern void nxagentFillRemoteRegion(DrawablePtr pDrawable, RegionPtr pRegion); extern void nxagentAllocateCorruptedResource(DrawablePtr pDrawable, RESTYPE type); extern void nxagentDestroyCorruptedResource(DrawablePtr pDrawable, RESTYPE type); extern int nxagentDestroyCorruptedBackgroundResource(void * p, XID id); extern int nxagentDestroyCorruptedWindowResource(void * p, XID id); extern int nxagentDestroyCorruptedPixmapResource(void * p, XID id); extern void nxagentCreateDrawableBitmap(DrawablePtr pDrawable); extern void nxagentDestroyDrawableBitmap(DrawablePtr pDrawable); extern void nxagentRegionsOnScreen(void); #define PRINT_REGION_BOXES(pRegion, strRegion) \ do \ { \ int i; \ int numRects; \ BoxPtr pBox; \ \ if (pRegion == NullRegion) \ { \ fprintf(stderr, "printRegionBoxes:: Region " strRegion " is null.\n"); \ break; \ } \ \ numRects = RegionNumRects(pRegion); \ pBox = RegionRects(pRegion); \ \ fprintf(stderr, "printRegionBoxes:: Region " strRegion " at [%p] has [%d] boxes:\n", \ (void *) (pRegion), numRects); \ \ for (i = 0; i < numRects; i++) \ { \ fprintf(stderr, "[%d] [%d,%d,%d,%d]\n", \ i, pBox[i].x1, pBox[i].y1, pBox[i].x2, pBox[i].y2); \ } \ \ } while (0) #endif /* __Drawable_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Error.c0000644000000000000000000003432113614532331020115 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include #include #include #include #include #include #include "os.h" #include "scrnintstr.h" #include "Agent.h" #include "Xlib.h" #include "Xproto.h" #include "Error.h" #include "Args.h" #include "Utils.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG /* * Duplicated stderr file descriptor. */ static int nxagentStderrDup = -1; /* * Saved stderr file descriptor. */ static int nxagentStderrBackup = -1; /* * Clients log file descriptor. */ static int nxagentClientsLog = -1; /* * Clients log file name. */ char *nxagentClientsLogName = NULL; /* * User's home. */ static char *nxagentHomeDir = NULL; /* * NX root directory. */ static char *nxagentRootDir = NULL; /* * Session log Directory. */ static char *nxagentSessionDir = NULL; void nxagentGetClientsPath(void); static int nxagentPrintError(Display *dpy, XErrorEvent *event, FILE *fp); /* declare an error handler that does not exit when an error * event is caught. */ int nxagentErrorHandler(Display *dpy, XErrorEvent *event) { if (nxagentVerbose == 1) { nxagentPrintError(dpy, event, stderr); } return 0; } /* copied from XlibInt.c:_XprintDefaultError * We cannot use the whole function because it requires XlibInt * internals. And we cannot call _XPrintDefaultError because it * is not exported. */ static int nxagentPrintError(dpy, event, fp) Display *dpy; XErrorEvent *event; FILE *fp; { char buffer[BUFSIZ]; char mesg[BUFSIZ]; char number[32]; const char *mtype = "XlibMessage"; #ifndef NXAGENT_SERVER register _XExtension *ext = (_XExtension *)NULL; _XExtension *bext = (_XExtension *)NULL; #endif XGetErrorText(dpy, event->error_code, buffer, BUFSIZ); XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ); (void) fprintf(fp, "%s: %s\n ", mesg, buffer); XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d", mesg, BUFSIZ); (void) fprintf(fp, mesg, event->request_code); if (event->request_code < 128) { snprintf(number, sizeof(number), "%d", event->request_code); XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); } else { #ifndef NXAGENT_SERVER for (ext = dpy->ext_procs; ext && (ext->codes.major_opcode != event->request_code); ext = ext->next) ; if (ext) { strncpy(buffer, ext->name, BUFSIZ); buffer[BUFSIZ - 1] = '\0'; } else #endif buffer[0] = '\0'; } (void) fprintf(fp, " (%s)\n", buffer); if (event->request_code >= 128) { XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", mesg, BUFSIZ); fputs(" ", fp); (void) fprintf(fp, mesg, event->minor_code); #ifndef NXAGENT_SERVER if (ext) { snprintf(mesg, sizeof(mesg), "%s.%d", ext->name, event->minor_code); XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ); (void) fprintf(fp, " (%s)", buffer); } #endif fputs("\n", fp); } if (event->error_code >= 128) { /* kludge, try to find the extension that caused it */ buffer[0] = '\0'; #ifndef NXAGENT_SERVER for (ext = dpy->ext_procs; ext; ext = ext->next) { if (ext->error_string) (*ext->error_string)(dpy, event->error_code, &ext->codes, buffer, BUFSIZ); if (buffer[0]) { bext = ext; break; } if (ext->codes.first_error && ext->codes.first_error < (int)event->error_code && (!bext || ext->codes.first_error > bext->codes.first_error)) bext = ext; } if (bext) snprintf(buffer, sizeof(buffer), "%s.%d", bext->name, event->error_code - bext->codes.first_error); else #endif strcpy(buffer, "Value"); XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ); if (mesg[0]) { fputs(" ", fp); (void) fprintf(fp, mesg, event->resourceid); fputs("\n", fp); } /* let extensions try to print the values */ #ifndef NXAGENT_SERVER for (ext = dpy->ext_procs; ext; ext = ext->next) { if (ext->error_values) (*ext->error_values)(dpy, event, fp); } #endif } else if ((event->error_code == BadWindow) || (event->error_code == BadPixmap) || (event->error_code == BadCursor) || (event->error_code == BadFont) || (event->error_code == BadDrawable) || (event->error_code == BadColor) || (event->error_code == BadGC) || (event->error_code == BadIDChoice) || (event->error_code == BadValue) || (event->error_code == BadAtom)) { if (event->error_code == BadValue) XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", mesg, BUFSIZ); else if (event->error_code == BadAtom) XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", mesg, BUFSIZ); else XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", mesg, BUFSIZ); fputs(" ", fp); (void) fprintf(fp, mesg, event->resourceid); fputs("\n", fp); } XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", mesg, BUFSIZ); fputs(" ", fp); (void) fprintf(fp, mesg, event->serial); #ifndef NXAGENT_SERVER XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d", mesg, BUFSIZ); fputs("\n ", fp); (void) fprintf(fp, mesg, (unsigned long long)(X_DPY_GET_REQUEST(dpy))); #endif fputs("\n", fp); if (event->error_code == BadImplementation) return 0; return 1; } int nxagentExitHandler(const char *message) { FatalError("%s", message); return 0; } void nxagentOpenClientsLogFile(void) { if (!nxagentClientsLogName) { nxagentGetClientsPath(); } if (nxagentClientsLogName && *nxagentClientsLogName != '\0') { nxagentClientsLog = open(nxagentClientsLogName, O_RDWR | O_CREAT | O_APPEND, 0600); if (nxagentClientsLog == -1) { fprintf(stderr, "Warning: Failed to open clients log. Error is %d '%s'.\n", errno, strerror(errno)); } } else { #ifdef TEST fprintf(stderr, "nxagentOpenClientsLogFile: Cannot open clients log file. The path does not exist.\n"); #endif } } void nxagentCloseClientsLogFile(void) { close(nxagentClientsLog); } void nxagentStartRedirectToClientsLog(void) { nxagentOpenClientsLogFile(); if (nxagentClientsLog != -1) { if (nxagentStderrBackup == -1) { nxagentStderrBackup = dup(STDERR_FILENO); } if (nxagentStderrBackup != -1) { nxagentStderrDup = dup2(nxagentClientsLog, STDERR_FILENO); if (nxagentStderrDup == -1) { fprintf(stderr, "Warning: Failed to redirect stderr. Error is %d '%s'.\n", errno, strerror(errno)); } } else { fprintf(stderr, "Warning: Failed to backup stderr. Error is %d '%s'.\n", errno, strerror(errno)); } } } void nxagentEndRedirectToClientsLog(void) { if (nxagentStderrBackup != -1) { nxagentStderrDup = dup2(nxagentStderrBackup, STDERR_FILENO); if (nxagentStderrDup == -1) { fprintf(stderr, "Warning: Failed to restore stderr. Error is %d '%s'.\n", errno, strerror(errno)); } } nxagentCloseClientsLogFile(); } /* * returns a pointer to the static nxagentHomeDir. The caller must not free * this pointer! */ char *nxagentGetHomePath(void) { if (!nxagentHomeDir) { /* * Check the NX_HOME environment. */ char *homeEnv = getenv("NX_HOME"); if (!homeEnv || *homeEnv == '\0') { #ifdef TEST fprintf(stderr, "%s: No environment for NX_HOME.\n", __func__); #endif homeEnv = getenv("HOME"); if (!homeEnv || *homeEnv == '\0') { #ifdef PANIC fprintf(stderr, "%s: PANIC! No environment for HOME.\n", __func__); #endif return NULL; } } /* FIXME: this is currently never freed as it is thought to last over the complete runtime. We should add a free call at shutdown eventually... */ nxagentHomeDir = strdup(homeEnv); if (!nxagentHomeDir) { #ifdef PANIC fprintf(stderr, "%s: PANIC! Can't allocate memory for the home path.\n", __func__); #endif return NULL; } #ifdef TEST fprintf(stderr, "%s: Assuming NX user's home directory '%s'.\n", __func__, nxagentHomeDir); #endif } return nxagentHomeDir; } /* * returns a pointer to the static nxagentRootDir. The caller must not free * this pointer! */ char *nxagentGetRootPath(void) { if (!nxagentRootDir) { /* * Check the NX_ROOT environment. */ char *rootEnv = getenv("NX_ROOT"); if (!rootEnv || *rootEnv == '\0') { #ifdef TEST fprintf(stderr, "%s: WARNING! No environment for NX_ROOT.\n", __func__); #endif /* * We will determine the root NX directory based on the NX_HOME * or HOME directory settings. */ char *homeEnv = nxagentGetHomePath(); if (!homeEnv) { return NULL; } /* FIXME: this is currently never freed as it is thought to last over the complete runtime. We should add a free call at shutdown eventually... */ int len = asprintf(&nxagentRootDir, "%s/.nx", homeEnv); if (len == -1) { #ifdef PANIC fprintf(stderr, "%s: could not build NX Root Dir string\n", __func__); #endif return NULL; } #ifdef TEST fprintf(stderr, "%s: Assuming NX root directory in '%s'.\n", __func__, homeEnv); #endif /* * Create the NX root directory. */ struct stat dirStat; if ((stat(nxagentRootDir, &dirStat) == -1) && (errno == ENOENT)) { if (mkdir(nxagentRootDir, 0777) < 0 && (errno != EEXIST)) { #ifdef PANIC fprintf(stderr, "%s: PANIC! Can't create directory '%s'. Error is %d '%s'.\n", __func__, nxagentRootDir, errno, strerror(errno)); #endif return NULL; } } } else { /* FIXME: this is currently never freed as it is thought to last over the complete runtime. We should add a free call eventually... */ nxagentRootDir = strdup(rootEnv); } #ifdef TEST fprintf(stderr, "%s: Assuming NX root directory '%s'.\n", __func__, nxagentRootDir); #endif } return nxagentRootDir; } /* * returns a pointer to the static nxagentSessionDir. The caller must not free * this pointer! */ char *nxagentGetSessionPath(void) { if (!nxagentSessionDir) { /* * If nxagentSessionId does not exist we assume that the * sessionPath cannot be realized and do not use the clients log * file. */ if (*nxagentSessionId == '\0') { #ifdef TEST fprintf(stderr, "%s: Session id does not exist. Assuming session path NULL.\n", __func__); #endif return NULL; } char *rootPath = nxagentGetRootPath(); if (!rootPath) { return NULL; } /* FIXME: this is currently only freed if the dir cannot be created and will last over the runtime otherwise. We should add a free call eventually... */ int len = asprintf(&nxagentSessionDir, "%s/C-%s", rootPath, nxagentSessionId); if (len == -1) { #ifdef PANIC fprintf(stderr, "%s: PANIC!: Could not alloc sessiondir string'.\n", __func__); #endif return NULL; } struct stat dirStat; if ((stat(nxagentSessionDir, &dirStat) == -1) && (errno == ENOENT)) { if (mkdir(nxagentSessionDir, 0777) < 0 && (errno != EEXIST)) { #ifdef PANIC fprintf(stderr, "%s: PANIC! Can't create directory '%s'. Error is %d '%s'.\n", __func__, nxagentSessionDir, errno, strerror(errno)); #endif SAFE_free(nxagentSessionDir); return NULL; } } #ifdef TEST fprintf(stderr, "%s: NX session is '%s'.\n", __func__, nxagentSessionDir); #endif } return nxagentSessionDir; } void nxagentGetClientsPath(void) { if (!nxagentClientsLogName) { char *sessionPath = nxagentGetSessionPath(); if (!sessionPath) { return; } /* FIXME: this is currently never freed as it is thought to last over the complete runtime. We should add a free call at shutdown eventually... */ int len = asprintf(&nxagentClientsLogName, "%s/clients", sessionPath); if (len == -1) { #ifdef PANIC fprintf(stderr, "%s: PANIC! Could not alloc NX clients Log File Path.\n", __func__); #endif return; } } return; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Error.h0000644000000000000000000000430713614532331020123 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Error_H__ #define __Error_H__ /* * Clients log file name. */ extern char *nxagentClientsLogName; extern char nxagentVerbose; int nxagentErrorHandler(Display *dpy, XErrorEvent *event); int nxagentExitHandler(const char *message); void nxagentStartRedirectToClientsLog(void); void nxagentEndRedirectToClientsLog(void); char *nxagentGetSessionPath(void); #endif /* __Error_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Events.c0000644000000000000000000036274113614532331020302 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "X.h" #include "signal.h" #include "unistd.h" #include "Xproto.h" #include "screenint.h" #include "input.h" #include "dix.h" #include "misc.h" #include "scrnintstr.h" #include "windowstr.h" #include "servermd.h" #include "mi.h" #include "selection.h" #include "keysym.h" #include "fb.h" #include "mibstorest.h" #include "osdep.h" #include "Agent.h" #include "Args.h" #include "Atoms.h" #include "Colormap.h" #include "Display.h" #include "Screen.h" #include "Windows.h" #include "Pixmaps.h" #include "Keyboard.h" #include "Keystroke.h" #include "Events.h" #include "Pointer.h" #include "Rootless.h" #include "Splash.h" #include "Trap.h" #include "Dialog.h" #include "Client.h" #include "Clipboard.h" #include "Split.h" #include "Drawable.h" #include "Handlers.h" #include "Utils.h" #include "Error.h" #include #include #include #include "xfixesproto.h" #define Window XlibWindow #define Atom XlibAtom #define Time XlibXID #include "X11/include/Xfixes_nxagent.h" #undef Window #undef Atom #undef Time #ifdef NXAGENT_FIXKEYS #include "inputstr.h" #include "input.h" #endif #define Time XlibXID #include "XKBlib.h" #undef Time #define GC XlibGC #define Font XlibFont #define KeySym XlibKeySym #define XID XlibXID #include "Xlibint.h" #undef GC #undef Font #undef KeySym #undef XID #include #include #include "X11/include/Xrandr_nxagent.h" #include "compext/Compext.h" /* * Set here the required log level. Please note that if you want to * enable DEBUG here, then you need to enable DEBUG even in Rootless.c */ #define PANIC #define WARNING #undef TEST #undef DEBUG /* debug individual subsystems */ #undef DEBUG_AUTOGRAB /* aktivate subsystems if generic DEBUG is activated */ #ifdef DEBUG #ifndef DEBUG_AUTOGRAB #define DEBUG_AUTOGRAB #endif #endif /* * Log begin and end of the important handlers. */ #undef BLOCKS extern Bool nxagentOnce; extern WindowPtr nxagentRootTileWindow; extern int nxagentLastClipboardClient; #ifdef NX_DEBUG_INPUT int nxagentDebugInput = 0; #endif #ifdef DEBUG extern Bool nxagentRootlessTreesMatch(void); #endif extern Selection *CurrentSelections; extern int NumCurrentSelections; typedef union _XFixesSelectionEvent { int type; XFixesSelectionNotifyEvent xfixesselection; XEvent core; } XFixesSelectionEvent; Bool xkbdRunning = False; pid_t pidkbd; WindowPtr nxagentLastEnteredWindow = NULL; PropertyRequestRec nxagentPropertyRequests[NXNumberOfResources]; void nxagentHandleCollectPropertyEvent(XEvent*); /* * Finalize the asynchronous handling of the X_GrabPointer requests. */ void nxagentHandleCollectGrabPointerEvent(int resource); Bool nxagentCollectGrabPointerPredicate(Display *disp, XEvent *X, XPointer ptr); /* * Used in Handlers.c to synchronize the agent with the remote X * server. */ void nxagentHandleCollectInputFocusEvent(int resource); /* * Viewport navigation. */ static int viewportInc = 1; static enum HandleEventResult viewportLastKeyPressResult; static int viewportLastX; static int viewportLastY; static Cursor viewportCursor; #define MAX_INC 200 #define INC_STEP 5 #define nextinc(x) ((x) < MAX_INC ? (x) += INC_STEP : (x)) /* * Keyboard and pointer are handled as they were real devices by Xnest * and we inherit this behaviour. The following mask will contain the * event mask selected for the root window of the agent. All the * keyboard and pointer events will be translated by the agent and * sent to the internal clients according to events selected by the * inferior windows. */ static Mask defaultEventMask; static int lastEventSerial = 0; /* * Used to mask the appropriate bits in the state reported by * XkbStateNotify and XkbGetIndicatorState. */ #define CAPSFLAG_IN_REPLY 1 #define CAPSFLAG_IN_EVENT 2 #define NUMFLAG_IN_EVENT 16 #define NUMFLAG_IN_REPLY 2 CARD32 nxagentLastEventTime = 0; CARD32 nxagentLastKeyPressTime = 0; Time nxagentLastServerTime = 0; /* * Used for storing windows that need to receive expose events from * the agent. */ #define nxagentExposeQueueHead nxagentExposeQueue.exposures[nxagentExposeQueue.start] ExposeQueue nxagentExposeQueue; RegionPtr nxagentRemoteExposeRegion = NULL; static void nxagentForwardRemoteExpose(void); static int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr); /* * This is from NXproperty.c. */ int GetWindowProperty(WindowPtr pWin, Atom property, long longOffset, long longLength, Bool delete, Atom type, Atom *actualType, int *format, unsigned long *nItems, unsigned long *bytesAfter, unsigned char **propData); /* * Associate a resource to a drawable and store the region affected by * the split operation. */ SplitResourceRec nxagentSplitResources[NXNumberOfResources]; /* * Associate a resource to an unpack operation. */ UnpackResourceRec nxagentUnpackResources[NXNumberOfResources]; /* * We have to check these before launching * the terminate dialog in rootless mode. */ Bool nxagentLastWindowDestroyed = False; Time nxagentLastWindowDestroyedTime = 0; /* * Set this flag when an user input event is received. */ int nxagentInputEvent = 0; int nxagentKeyDown = 0; void nxagentSwitchResizeMode(ScreenPtr pScreen); int nxagentCheckWindowConfiguration(XConfigureEvent* X); #define nxagentMonitoredDuplicate(keysym) \ ((keysym) == XK_Left || (keysym) == XK_Up || \ (keysym) == XK_Right || (keysym) == XK_Down || \ (keysym) == XK_Page_Up || (keysym) == XK_Page_Down || \ (keysym) == XK_Delete || (keysym) == XK_BackSpace) void nxagentRemoveDuplicatedKeys(XEvent *X); void ProcessInputEvents(void) { #ifdef NX_DEBUG_INPUT if (nxagentDebugInput == 1) { fprintf(stderr, "%s: Processing input.\n", __func__); } #endif mieqProcessInputEvents(); } #ifdef DEBUG char * nxagentGetNotifyMode(int mode) { switch (mode) { case NotifyNormal: return "NotifyNormal"; case NotifyGrab: return "NotifyGrab"; case NotifyUngrab: return "NotifyUngrab"; case NotifyWhileGrabbed: return "NotifyWhileGrabbed"; } return "Unknown"; } #endif #ifdef DEBUG_TREE /* * Print ID and name of window. */ void nxagentRemoteWindowID(Window window, Bool newline) { #ifdef NO_I18N char *winName; #else XTextProperty tp; #endif fprintf(stderr, "0x%x", window); if (!window) { fprintf(stderr, " (none) "); } else { if (window == DefaultRootWindow(nxagentDisplay)) { fprintf(stderr, " (the root window) "); } #ifdef NO_I18N if (!XFetchName(nxagentDisplay, window, &winName)) { fprintf(stderr, " (has no name) "); } else if (winName) { fprintf(stderr, " \"%s\" ", winName); SAFE_XFree(winName); } #else if (XGetWMName(nxagentDisplay, window, &tp) == 0) { fprintf(stderr, " (has no name) "); } else if (tp.nitems > 0) { fprintf(stderr, " \""); int count = 0; char **list = NULL; int ret = XmbTextPropertyToTextList(nxagentDisplay, &tp, &list, &count); if ((ret == Success || ret > 0) && list != NULL) { for (int i = 0; i < count; i++) { fprintf(stderr, "%s", list[i]); } XFreeStringList(list); } else { fprintf(stderr, "%s", tp.value); } fprintf(stderr, "\" "); } #endif else { fprintf(stderr, " (has no name) "); } } if (newline) { fprintf(stderr, "\n"); } return; } /* * Print info about remote window. */ void nxagentRemoteWindowInfo(Window win, int indent, Bool newLine) { XWindowAttributes attributes; if (XGetWindowAttributes(nxagentDisplay, win, &attributes) == 0) { return; } fprintf(stderr, "%*sx=%d y=%d width=%d height=%d class=%s map_state=%s " "override_redirect=%s\n", indent, "", attributes.x, attributes.y, attributes.width, attributes.height, (attributes.class == 0) ? "CopyFromParent" : ((attributes.class == 1) ? "InputOutput" : "InputOnly"), (attributes.map_state == 0) ? "IsUnmapped" : (attributes.map_state == 1 ? "IsUnviewable" : "IsViewable"), (attributes.override_redirect == 0) ? "No" : "Yes" ); if (newLine) { fprintf(stderr, "\n"); } } /* * Walk remote windows tree. * * FIXME: * ========== nxagentRemoteWindowsTree ============ * * Root Window ID: 0x169 (the root window) (has no name) * Parent window ID: 0x2a00063 "NX Agent" * 0 children. * * ========== nxagentInternalWindowsTree ========== * Window ID=[0x9d] Remote ID=[0x2a0007e] Name: ( has no name ) * x=0 y=0 width=1440 height=810 class=InputOutput map_state=IsViewable override_redirect=No * * -> Internal root window's remote id is not listed in RemoteWindowsTree. */ void nxagentRemoteWindowsTree(Window window, int level) { unsigned long rootWin, parentWin; unsigned int numChildren; unsigned long *childList = NULL; if (!XQueryTree(nxagentDisplay, window, &rootWin, &parentWin, &childList, &numChildren)) { fprintf(stderr, "%s - XQueryTree failed.\n", __func__); return; } if (level == 0) { fprintf(stderr, "\n"); fprintf(stderr, " Root Window ID: "); nxagentRemoteWindowID(rootWin, TRUE); fprintf(stderr, " Parent window ID: "); nxagentRemoteWindowID(parentWin, TRUE); } if (level == 0 || numChildren > 0) { fprintf(stderr, "%*s", (level * 4) + 5, ""); /* 4 spaces per level */ fprintf(stderr, "%d child%s%s\n", numChildren, (numChildren == 1) ? "" : "ren", (numChildren == 1) ? ":" : "."); } for (int i = (int) numChildren - 1; i >= 0; i--) { fprintf(stderr, "%*s", (level * 5) + 6, ""); /* 5 spaces per level */ nxagentRemoteWindowID(childList[i], TRUE); nxagentRemoteWindowInfo(childList[i], (level * 5) + 6, TRUE); nxagentRemoteWindowsTree(childList[i], level + 1); } SAFE_XFree(childList); } /* * Print info about internal window. */ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine) { unsigned long ulReturnItems; unsigned long ulReturnBytesLeft; Atom atomReturnType; int iReturnFormat; unsigned char *pszReturnData = NULL; fprintf(stderr, "Window ID=[0x%x] %s Remote ID=[0x%x] ", pWin -> drawable.id, pWin->parent ? "" : "(the root window)", nxagentWindow(pWin)); int result = GetWindowProperty(pWin, MakeAtom("WM_NAME", 7, False) , 0, sizeof(CARD32), False, AnyPropertyType, &atomReturnType, &iReturnFormat, &ulReturnItems, &ulReturnBytesLeft, &pszReturnData); fprintf(stderr, "Name: "); if (result == Success && pszReturnData != NULL) { fprintf(stderr, "\"%*.*s\"\n", (int)ulReturnItems, (int)ulReturnItems, (char *) pszReturnData); } else { fprintf(stderr, "%s\n", "( has no name )"); } fprintf(stderr, "%*sx=%d y=%d width=%d height=%d class=%s map_state=%s " "override_redirect=%s", indent, "", pWin -> drawable.x, pWin -> drawable.y, pWin -> drawable.width, pWin -> drawable.height, (pWin -> drawable.class == 0) ? "CopyFromParent" : ((pWin -> drawable.class == 1) ? "InputOutput" : "InputOnly"), (pWin -> mapped == 0) ? "IsUnmapped" : (pWin -> realized == 0 ? "IsUnviewable" : "IsViewable"), (pWin -> overrideRedirect == 0) ? "No" : "Yes"); if (newLine) { fprintf(stderr, "\n"); } } /* * Walk internal windows tree. */ void nxagentInternalWindowsTree(WindowPtr pWin, int indent) { while (pWin) { WindowPtr pChild = pWin -> firstChild; fprintf(stderr, "%*s", indent, ""); nxagentInternalWindowInfo(pWin, indent, TRUE); fprintf(stderr, "\n"); nxagentInternalWindowsTree(pChild, indent + 4); pWin = pWin -> nextSib; } } #endif /* DEBUG_TREE */ void nxagentSwitchResizeMode(ScreenPtr pScreen) { #ifdef DEBUG fprintf(stderr, "%s: Called.\n", __func__); #endif int desktopResize = nxagentOption(DesktopResize); nxagentChangeOption(DesktopResize, !desktopResize); if (nxagentOption(DesktopResize) == 0) { fprintf(stderr,"Info: Disabled desktop resize mode in agent.\n"); nxagentLaunchDialog(DIALOG_DISABLE_DESKTOP_RESIZE_MODE); if (nxagentOption(Fullscreen) == 0) { nxagentSetWMNormalHintsMaxsize(pScreen, nxagentOption(RootWidth), nxagentOption(RootHeight)); } } else { fprintf(stderr,"Info: Enabled desktop resize mode in agent.\n"); nxagentLaunchDialog(DIALOG_ENABLE_DESKTOP_RESIZE_MODE); nxagentChangeScreenConfig(0, nxagentOption(Width), nxagentOption(Height)); if (nxagentOption(ClientOs) == ClientOsWinnt) { NXSetExposeParameters(nxagentDisplay, 0, 0, 0); } nxagentSetWMNormalHintsMaxsize(pScreen, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)), HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); } } void nxagentShadowSwitchResizeMode(ScreenPtr pScreen) { int desktopResize = nxagentOption(DesktopResize); nxagentChangeOption(DesktopResize, !desktopResize); if (nxagentOption(DesktopResize) == 0) { nxagentShadowSetRatio(1.0, 1.0); nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], screenInfo.screens[0]->root, screenInfo.screens[0]->root -> drawable.width, screenInfo.screens[0]->root -> drawable.height); nxagentSetWMNormalHintsMaxsize(pScreen, nxagentOption(RootWidth), nxagentOption(RootHeight)); fprintf(stderr,"Info: Disabled resize mode in shadow agent.\n"); } else { nxagentShadowSetRatio(nxagentOption(Width) * 1.0 / screenInfo.screens[0]->root -> drawable.width, nxagentOption(Height) * 1.0 / screenInfo.screens[0]->root -> drawable.height); nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], screenInfo.screens[0]->root, screenInfo.screens[0]->root -> drawable.width, screenInfo.screens[0]->root -> drawable.height); nxagentSetWMNormalHintsMaxsize(pScreen, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)), HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); fprintf(stderr,"Info: Enabled resize mode in shadow agent.\n"); } } static void nxagentSwitchDeferMode(void) { if (nxagentOption(DeferLevel) == 0) { nxagentChangeOption(DeferLevel, UNDEFINED); nxagentSetDeferLevel(); } else { nxagentChangeOption(DeferLevel, 0); } if (nxagentOption(DeferLevel) != 0) { nxagentLaunchDialog(DIALOG_ENABLE_DEFER_MODE); } else { nxagentLaunchDialog(DIALOG_DISABLE_DEFER_MODE); nxagentForceSynchronization = 1; } } static void nxagentEnableAutoGrab(void) { #ifdef DEBUG_AUTOGRAB fprintf(stderr, "enabling autograb\n"); #endif nxagentGrabPointerAndKeyboard(NULL); nxagentChangeOption(AutoGrab, True); nxagentLaunchDialog(DIALOG_ENABLE_AUTOGRAB_MODE); } static void nxagentDisableAutoGrab(void) { #ifdef DEBUG_AUTOGRAB fprintf(stderr, "disabling autograb\n"); #endif nxagentUngrabPointerAndKeyboard(NULL); nxagentChangeOption(AutoGrab, False); nxagentLaunchDialog(DIALOG_DISABLE_AUTOGRAB_MODE); } static void nxagentToggleAutoGrab(void) { /* autograb only works in windowed mode */ if (nxagentOption(Rootless) || nxagentOption(Fullscreen)) return; if (!nxagentOption(AutoGrab)) nxagentEnableAutoGrab(); else nxagentDisableAutoGrab(); } static Bool nxagentExposurePredicate(Display *disp, XEvent *event, XPointer window) { /* * Handle both Expose and ProcessedExpose events. The latters are * those not filtered by function nxagentWindowExposures(). */ if (window) { return ((event -> type == Expose || event -> type == ProcessedExpose) && event -> xexpose.window == *((Window *) window)); } else { return (event -> type == Expose || event -> type == ProcessedExpose); } } static int nxagentAnyEventPredicate(Display *disp, XEvent *event, XPointer parameter) { return 1; } int nxagentInputEventPredicate(Display *disp, XEvent *event, XPointer parameter) { switch (event -> type) { case KeyPress: case KeyRelease: case ButtonPress: case ButtonRelease: { return 1; } default: { return 0; } } } void nxagentInitDefaultEventMask(void) { Mask mask = NoEventMask; mask |= (StructureNotifyMask | VisibilityChangeMask); mask |= ExposureMask; mask |= NXAGENT_KEYBOARD_EVENT_MASK; mask |= NXAGENT_POINTER_EVENT_MASK; defaultEventMask = mask; } Mask nxagentGetDefaultEventMask(void) { return defaultEventMask; } void nxagentSetDefaultEventMask(Mask mask) { defaultEventMask = mask; } Mask nxagentGetEventMask(WindowPtr pWin) { Mask mask = NoEventMask; if (nxagentOption(Rootless)) { /* * mask = pWin -> eventMask & * ~(NXAGENT_KEYBOARD_EVENT_MASK | NXAGENT_POINTER_EVENT_MASK); */ if (pWin -> drawable.class == InputOutput) { if (nxagentWindowTopLevel(pWin)) { mask = defaultEventMask; } else { mask = ExposureMask | VisibilityChangeMask | PointerMotionMask; } } mask |= PropertyChangeMask; } else if (pWin -> drawable.class != InputOnly) { mask = ExposureMask | VisibilityChangeMask; } return mask; } static int nxagentChangeMapPrivate(WindowPtr pWin, void * ptr) { if (pWin && nxagentWindowPriv(pWin)) { nxagentWindowPriv(pWin) -> isMapped = *((Bool *) ptr); } return WT_WALKCHILDREN; } static int nxagentChangeVisibilityPrivate(WindowPtr pWin, void * ptr) { if (pWin && nxagentWindowPriv(pWin)) { nxagentWindowPriv(pWin) -> visibilityState = *((int *) ptr); } return WT_WALKCHILDREN; } void nxagentDispatchEvents(PredicateFuncPtr predicate) { XEvent X; xEvent x; ScreenPtr pScreen = NULL; Bool minimize = False; Bool closeSession = False; Bool switchFullscreen = False; Bool switchAllScreens = False; /* * Last entered top level window. */ static WindowPtr nxagentLastEnteredTopLevelWindow = NULL; #ifdef BLOCKS fprintf(stderr, "[Begin read]\n"); #endif #ifdef TEST fprintf(stderr, "%s: Going to handle new events with predicate [%p].\n", __func__, *(void **)&predicate); #endif if (nxagentRemoteExposeRegion == NULL) { nxagentInitRemoteExposeRegion(); } /* * We must read here, even if apparently there is nothing to * read. The ioctl() based readable function, in fact, is often * unable to detect a failure of the socket, in particular if the * agent was connected to the proxy and the proxy is gone. Thus we * must trust the wakeup handler that called us after the select(). */ #ifdef TEST if (nxagentPendingEvents(nxagentDisplay) == 0) { fprintf(stderr, "%s: PANIC! No event needs to be dispatched.\n", __func__); } #endif /* * We want to process all the events already in the queue, plus any * additional event that may be read from the network. If no event * can be read, we want to continue handling our clients without * flushing the output buffer. */ while (nxagentCheckEvents(nxagentDisplay, &X, predicate != NULL ? predicate : nxagentAnyEventPredicate, NULL) == 1) { #ifdef DEBUG fprintf(stderr, "%s: Going to handle new event type [%d].\n", __func__, X.type); #endif /* * Handle the incoming event. */ switch (X.type) { #ifdef NXAGENT_CLIPBOARD case SelectionClear: { #ifdef TEST fprintf(stderr, "%s: Going to handle new SelectionClear event.\n", __func__); #endif nxagentClearSelection(&X); break; } case SelectionRequest: { #ifdef TEST fprintf(stderr, "%s: Going to handle new SelectionRequest event.\n", __func__); #endif nxagentRequestSelection(&X); break; } case SelectionNotify: { #ifdef TEST fprintf(stderr, "%s: Going to handle new SelectionNotify event.\n", __func__); #endif nxagentHandleSelectionNotifyFromXServer(&X); break; } #endif /* NXAGENT_CLIPBOARD */ case PropertyNotify: { #ifdef TEST fprintf(stderr, "%s: PropertyNotify on prop %d[%s] window %lx state %d\n", __func__, (int)X.xproperty.atom, validateString(XGetAtomName(nxagentDisplay, X.xproperty.atom)), X.xproperty.window, X.xproperty.state); #endif nxagentHandlePropertyNotify(&X); break; } case KeyPress: { enum HandleEventResult result; #ifdef TEST fprintf(stderr, "%s: Going to handle new KeyPress event.\n", __func__); #endif nxagentInputEvent = 1; nxagentKeyDown++; nxagentHandleKeyPress(&X, &result); if (viewportLastKeyPressResult != result) { viewportInc = 1; viewportLastKeyPressResult = result; } if (result != doNothing) { pScreen = nxagentScreen(X.xkey.window); } switch (result) { case doNothing: { break; } #ifdef DEBUG_TREE case doDebugTree: { fprintf(stderr, "\n========== nxagentRemoteWindowsTree ============\n"); nxagentRemoteWindowsTree(nxagentWindow(screenInfo.screens[0]->root), 0); fprintf(stderr, "\n========== nxagentInternalWindowsTree ==========\n"); nxagentInternalWindowsTree(screenInfo.screens[0]->root, 0); break; } #endif /* DEBUG_TREE */ case doCloseSession: { closeSession = TRUE; break; } case doMinimize: { minimize = TRUE; break; } case doSwitchFullscreen: { switchFullscreen = TRUE; break; } case doSwitchAllScreens: { switchAllScreens = TRUE; break; } case doViewportMoveUp: { nxagentMoveViewport(pScreen, 0, -nxagentOption(Height)); break; } case doViewportMoveDown: { nxagentMoveViewport(pScreen, 0, nxagentOption(Height)); break; } case doViewportMoveLeft: { nxagentMoveViewport(pScreen, -nxagentOption(Width), 0); break; } case doViewportMoveRight: { nxagentMoveViewport(pScreen, nxagentOption(Width), 0); break; } case doViewportUp: { nxagentMoveViewport(pScreen, 0, -nextinc(viewportInc)); break; } case doViewportDown: { nxagentMoveViewport(pScreen, 0, +nextinc(viewportInc)); break; } case doViewportLeft: { nxagentMoveViewport(pScreen, -nextinc(viewportInc), 0); break; } case doViewportRight: { nxagentMoveViewport(pScreen, +nextinc(viewportInc), 0); break; } case doSwitchResizeMode: { if (nxagentOption(Shadow) == 0) { if (nxagentNoDialogIsRunning) { nxagentSwitchResizeMode(pScreen); } } else { nxagentShadowSwitchResizeMode(pScreen); } break; } case doSwitchDeferMode: { if (nxagentNoDialogIsRunning) { nxagentSwitchDeferMode(); } break; } case doAutoGrab: { nxagentToggleAutoGrab(); break; } default: { FatalError("nxagentDispatchEvent: handleKeyPress returned unknown value\n"); break; } } /* * Elide multiple KeyPress/KeyRelease events of the same key * and generate a single pair. This is intended to reduce the * impact of the latency on the key auto-repeat, handled by * the remote X server. We may optionally do that only if the * timestamps in the events show an exces- sive delay. */ KeySym keysym = XKeycodeToKeysym(nxagentDisplay, X.xkey.keycode, 0); if (nxagentMonitoredDuplicate(keysym) == 1) { nxagentRemoveDuplicatedKeys(&X); } if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow) == 1 && result == doNothing) { X.xkey.keycode = nxagentConvertKeycode(X.xkey.keycode); NXShadowEvent(nxagentDisplay, X); } break; } case KeyRelease: { enum HandleEventResult result; int sendKey = 0; /* FIXME: If we don't flush the queue here, it could happen that the inputInfo structure will not be up to date when we perform the following check on down keys. */ ProcessInputEvents(); /* FIXME: Don't enqueue the KeyRelease event if the key was not already pressed. This workaround avoids a fake KeyPress being enqueued by the XKEYBOARD extension. Another solution would be to let the events enqueued and to remove the KeyPress afterwards. */ if (BitIsOn(inputInfo.keyboard -> key -> down, nxagentConvertKeycode(X.xkey.keycode))) { sendKey = 1; } #ifdef TEST fprintf(stderr, "%s: Going to handle new KeyRelease event.\n", __func__); #endif nxagentInputEvent = 1; nxagentKeyDown--; if (nxagentKeyDown <= 0) { nxagentKeyDown = 0; } if (nxagentXkbState.Initialized == 0) { if (X.xkey.keycode == nxagentCapsLockKeycode) { nxagentXkbCapsTrap = 1; } else if (X.xkey.keycode == nxagentNumLockKeycode) { nxagentXkbNumTrap = 1; } nxagentInitXkbKeyboardState(); nxagentXkbCapsTrap = 0; nxagentXkbNumTrap = 0; } /* Calculate the time elapsed between this and the last event we received. Add this delta to time we recorded for the last KeyPress event we passed on to our clients. */ memset(&x, 0, sizeof(xEvent)); x.u.u.type = KeyRelease; x.u.u.detail = nxagentConvertKeycode(X.xkey.keycode); x.u.keyButtonPointer.time = nxagentLastKeyPressTime + (X.xkey.time - nxagentLastServerTime); nxagentLastServerTime = X.xkey.time; nxagentLastEventTime = GetTimeInMillis(); if (x.u.keyButtonPointer.time > nxagentLastEventTime) { x.u.keyButtonPointer.time = nxagentLastEventTime; } /* do not send a KeyRelease for a special keystroke since we also did not send a KeyPress event in that case */ if (!(nxagentCheckSpecialKeystroke(&X.xkey, &result)) && (sendKey == 1)) { #ifdef TEST fprintf(stderr, "%s: passing KeyRelease event to clients\n", __func__); #endif mieqEnqueue(&x); CriticalOutputPending = 1; if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow)) { X.xkey.keycode = nxagentConvertKeycode(X.xkey.keycode); NXShadowEvent(nxagentDisplay, X); } } else { #ifdef TEST fprintf(stderr, "%s: NOT passing KeyRelease event to clients\n", __func__); #endif } break; } case ButtonPress: { #ifdef NX_DEBUG_INPUT if (nxagentDebugInput == 1) { fprintf(stderr, "%s: Going to handle new ButtonPress event.\n", __func__); } #endif nxagentInputEvent = 1; if (nxagentOption(Fullscreen)) { if ( (nxagentOption(MagicPixel) == 1) && (nxagentMagicPixelZone(X.xbutton.x, X.xbutton.y)) ) { pScreen = nxagentScreen(X.xbutton.window); minimize = True; break; } } if (nxagentOption(DesktopResize) == False && (X.xbutton.state & (ControlMask | Mod1Mask)) == (ControlMask | Mod1Mask)) { /* * Start viewport navigation mode. */ int resource = nxagentWaitForResource(NXGetCollectGrabPointerResource, nxagentCollectGrabPointerPredicate); pScreen = nxagentScreen(X.xbutton.window); viewportCursor = XCreateFontCursor(nxagentDisplay, XC_fleur); NXCollectGrabPointer(nxagentDisplay, resource, nxagentDefaultWindows[pScreen -> myNum], True, NXAGENT_POINTER_EVENT_MASK, GrabModeAsync, GrabModeAsync, None, viewportCursor, CurrentTime); viewportLastX = X.xbutton.x; viewportLastY = X.xbutton.y; break; } if (!(nxagentOption(Fullscreen) && X.xbutton.window == nxagentFullscreenWindow && X.xbutton.subwindow == None)) { memset(&x, 0, sizeof(xEvent)); x.u.u.type = ButtonPress; x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button]]; x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis(); if (nxagentOption(Rootless)) { x.u.keyButtonPointer.rootX = X.xmotion.x_root; x.u.keyButtonPointer.rootY = X.xmotion.y_root; } else { x.u.keyButtonPointer.rootX = X.xmotion.x - nxagentOption(RootX); x.u.keyButtonPointer.rootY = X.xmotion.y - nxagentOption(RootY); } #ifdef NX_DEBUG_INPUT if (nxagentDebugInput == 1) { fprintf(stderr, "%s: Adding ButtonPress event.\n", __func__); } #endif mieqEnqueue(&x); CriticalOutputPending = 1; } if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow)) { X.xbutton.x -= nxagentOption(RootX); X.xbutton.y -= nxagentOption(RootY); if (nxagentOption(YRatio) != DONT_SCALE) { X.xbutton.x = (X.xbutton.x << PRECISION) / nxagentOption(YRatio); } if (nxagentOption(XRatio) != DONT_SCALE) { X.xbutton.y = (X.xbutton.y << PRECISION) / nxagentOption(YRatio); } NXShadowEvent(nxagentDisplay, X); } break; } case ButtonRelease: { #ifdef NX_DEBUG_INPUT if (nxagentDebugInput == 1) { fprintf(stderr, "%s: Going to handle new ButtonRelease event.\n", __func__); } #endif nxagentInputEvent = 1; if (viewportCursor) { /* * Leave viewport navigation mode. */ XUngrabPointer(nxagentDisplay, CurrentTime); XFreeCursor(nxagentDisplay, viewportCursor); viewportCursor = None; } if (minimize != True) { memset(&x, 0, sizeof(xEvent)); x.u.u.type = ButtonRelease; x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button]]; x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis(); if (nxagentOption(Rootless)) { x.u.keyButtonPointer.rootX = X.xmotion.x_root; x.u.keyButtonPointer.rootY = X.xmotion.y_root; } else { x.u.keyButtonPointer.rootX = X.xmotion.x - nxagentOption(RootX); x.u.keyButtonPointer.rootY = X.xmotion.y - nxagentOption(RootY); } #ifdef NX_DEBUG_INPUT if (nxagentDebugInput == 1) { fprintf(stderr, "%s: Adding ButtonRelease event.\n", __func__); } #endif mieqEnqueue(&x); CriticalOutputPending = 1; } if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow)) { X.xbutton.x -= nxagentOption(RootX); X.xbutton.y -= nxagentOption(RootY); if (nxagentOption(XRatio) != DONT_SCALE) { X.xbutton.x = (X.xbutton.x << PRECISION) / nxagentOption(XRatio); } if (nxagentOption(YRatio) != DONT_SCALE) { X.xbutton.y = (X.xbutton.y << PRECISION) / nxagentOption(YRatio); } NXShadowEvent(nxagentDisplay, X); } break; } case MotionNotify: { pScreen = nxagentScreen(X.xmotion.window); #ifdef TEST fprintf(stderr, "%s: Going to handle new MotionNotify event.\n", __func__); #endif #ifdef NX_DEBUG_INPUT if (nxagentDebugInput == 1) { fprintf(stderr, "%s: Handling motion notify window [%ld] root [%ld] child [%ld].\n", __func__, X.xmotion.window, X.xmotion.root, X.xmotion.subwindow); fprintf(stderr, "%s: Pointer at [%d][%d] relative root [%d][%d].\n", __func__, X.xmotion.x, X.xmotion.y, X.xmotion.x_root, X.xmotion.y_root); } #endif memset(&x, 0, sizeof(xEvent)); x.u.u.type = MotionNotify; if (nxagentOption(Rootless)) { WindowPtr pWin = nxagentWindowPtr(X.xmotion.window); if (pWin) { nxagentLastEnteredWindow = pWin; } if (nxagentPulldownDialogPid == 0 && nxagentLastEnteredTopLevelWindow && (X.xmotion.y_root < nxagentLastEnteredTopLevelWindow -> drawable.y + 4)) { if (pWin && nxagentClientIsDialog(wClient(pWin)) == 0 && nxagentLastEnteredTopLevelWindow -> parent == screenInfo.screens[0]->root && nxagentLastEnteredTopLevelWindow -> overrideRedirect == False && X.xmotion.x_root > (nxagentLastEnteredTopLevelWindow -> drawable.x + (nxagentLastEnteredTopLevelWindow -> drawable.width >> 1) - 50) && X.xmotion.x_root < (nxagentLastEnteredTopLevelWindow -> drawable.x + (nxagentLastEnteredTopLevelWindow -> drawable.width >> 1) + 50) && nxagentOption(Menu) == 1) { nxagentPulldownDialog(nxagentLastEnteredTopLevelWindow -> drawable.id); } } x.u.keyButtonPointer.rootX = X.xmotion.x_root; x.u.keyButtonPointer.rootY = X.xmotion.y_root; } else { x.u.keyButtonPointer.rootX = X.xmotion.x - nxagentOption(RootX); x.u.keyButtonPointer.rootY = X.xmotion.y - nxagentOption(RootY); } x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis(); if (viewportCursor == None && !(nxagentOption(Fullscreen) && X.xmotion.window == nxagentDefaultWindows[pScreen -> myNum] && X.xmotion.subwindow == None)) { #ifdef NX_DEBUG_INPUT if (nxagentDebugInput == 1) { fprintf(stderr, "%s: Adding motion event [%d, %d] to the queue.\n", __func__, x.u.keyButtonPointer.rootX, x.u.keyButtonPointer.rootY); } #endif mieqEnqueue(&x); } /* * This test is more complicated and probably not necessary, compared * to a simple check on viewportCursor. * * if (!nxagentOption(Fullscreen) && * (X.xmotion.state & (ControlMask | Mod1Mask | Button1Mask)) == * (ControlMask | Mod1Mask | Button1Mask)) */ if (viewportCursor) { /* * Pointer is in viewport navigation mode. */ nxagentMoveViewport(pScreen, viewportLastX - X.xmotion.x, viewportLastY - X.xmotion.y); viewportLastX = X.xmotion.x; viewportLastY = X.xmotion.y; } if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow) && !viewportCursor) { X.xmotion.x -= nxagentOption(RootX); X.xmotion.y -= nxagentOption(RootY); if (nxagentOption(XRatio) != DONT_SCALE) { X.xmotion.x = (X.xmotion.x << PRECISION) / nxagentOption(XRatio); } if (nxagentOption(YRatio) != DONT_SCALE) { X.xmotion.y = (X.xmotion.y << PRECISION) / nxagentOption(YRatio); } NXShadowEvent(nxagentDisplay, X); } if (nxagentOption(Shadow) == 0) { nxagentInputEvent = 1; } break; } case FocusIn: { WindowPtr pWin; #ifdef DEBUG fprintf(stderr, "%s: Going to handle new FocusIn event [0x%lx] mode: [%s]\n", __func__, X.xfocus.window, nxagentGetNotifyMode(X.xfocus.mode)); { XlibWindow w; int revert_to; XGetInputFocus(nxagentDisplay, &w, &revert_to); fprintf(stderr, "%s: (FocusIn): Event win [0x%lx] Focus owner [0x%lx] nxagentDefaultWindows[0] [0x%x]\n", __func__, X.xfocus.window, w, nxagentDefaultWindows[0]); } #else #ifdef TEST fprintf(stderr, "%s: Going to handle new FocusIn event\n", __func__); #endif #endif /* * Here we change the focus state in the agent. It looks like * this is needed only for rootless mode at present. */ if (nxagentOption(Rootless) && (pWin = nxagentWindowPtr(X.xfocus.window))) { SetInputFocus(serverClient, inputInfo.keyboard, pWin -> drawable.id, RevertToPointerRoot, GetTimeInMillis(), False); } if (X.xfocus.detail != NotifyInferior) { pScreen = nxagentScreen(X.xfocus.window); if (pScreen) { nxagentDirectInstallColormaps(pScreen); } } if (nxagentOption(AutoGrab) && !(nxagentOption(AllScreens) || nxagentOption(Fullscreen) || nxagentOption(Rootless))) { if (X.xfocus.window == nxagentDefaultWindows[0] && X.xfocus.mode == NotifyNormal) { #if defined(DEBUG) || defined(DEBUG_AUTOGRAB) fprintf(stderr, "%s: (FocusIn): grabbing\n", __func__); #endif nxagentGrabPointerAndKeyboard(NULL); } /* else { #if defined(DEBUG) || defined(DEBUG_AUTOGRAB) fprintf(stderr, "%s: (FocusIn): ungrabbing\n", __func__); #endif nxagentUngrabPointerAndKeyboard(NULL); } */ } break; } case FocusOut: { #ifdef DEBUG fprintf(stderr, "%s: Going to handle new FocusOut event [0x%lx] mode: [%s]\n", __func__, X.xfocus.window, nxagentGetNotifyMode(X.xfocus.mode)); #else #ifdef TEST fprintf(stderr, "%s: Going to handle new FocusOut event.\n", __func__); #endif #endif if (X.xfocus.detail != NotifyInferior) { pScreen = nxagentScreen(X.xfocus.window); if (pScreen) { nxagentDirectUninstallColormaps(pScreen); } } #ifdef NXAGENT_FIXKEYS { /* * Force the keys all up when focus is lost. */ for (int i = 0; i < DOWN_LENGTH; i++) /* input.h */ { CARD8 val = inputInfo.keyboard->key->down[i]; if (val != 0) { for (int k = 0; k < 8; k++) { if (val & (1 << k)) { #ifdef NXAGENT_FIXKEYS_DEBUG fprintf(stderr, "sending KeyRelease event for keycode: %x\n", i * 8 + k); #endif if (!nxagentOption(Rootless) || inputInfo.keyboard->key->modifierMap[i * 8 + k]) { memset(&x, 0, sizeof(xEvent)); x.u.u.type = KeyRelease; x.u.u.detail = i * 8 + k; x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis(); if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow)) { XEvent xM = {0}; xM.type = KeyRelease; xM.xkey.display = nxagentDisplay; xM.xkey.type = KeyRelease; xM.xkey.keycode = i * 8 + k; xM.xkey.state = inputInfo.keyboard->key->state; xM.xkey.time = GetTimeInMillis(); NXShadowEvent(nxagentDisplay, xM); } mieqEnqueue(&x); } } } } } nxagentKeyDown = 0; } #endif /* NXAGENT_FIXKEYS */ if (nxagentOption(AutoGrab) && !nxagentFullscreenWindow) { XlibWindow w; int revert_to; XGetInputFocus(nxagentDisplay, &w, &revert_to); if (w != nxagentDefaultWindows[0] && X.xfocus.mode == NotifyWhileGrabbed) { #if defined(DEBUG) || defined(DEBUG_AUTOGRAB) fprintf(stderr, "%s: (FocusOut): ungrabbing\n", __func__); #endif nxagentUngrabPointerAndKeyboard(NULL); } } break; } case KeymapNotify: { #ifdef TEST fprintf(stderr, "%s: Going to handle new KeymapNotify event.\n", __func__); #endif break; } case EnterNotify: { WindowPtr pWin; #ifdef TEST fprintf(stderr, "%s: Going to handle new EnterNotify event.\n", __func__); #endif if (nxagentOption(Rootless)) { WindowPtr pTLWin = NULL; pWin = nxagentWindowPtr(X.xcrossing.window); if (pWin != NULL) { for (pTLWin = pWin; pTLWin -> parent != pTLWin -> drawable.pScreen -> root; pTLWin = pTLWin -> parent); } if (pTLWin) { nxagentLastEnteredTopLevelWindow = pTLWin; } #ifdef TEST fprintf(stderr, "%s: nxagentLastEnteredTopLevelWindow [%p].\n", __func__, (void *)nxagentLastEnteredTopLevelWindow); #endif } if (nxagentOption(Rootless) && nxagentWMIsRunning && (pWin = nxagentWindowPtr(X.xcrossing.window)) && nxagentWindowTopLevel(pWin) && !pWin -> overrideRedirect && (pWin -> drawable.x != X.xcrossing.x_root - X.xcrossing.x - pWin -> borderWidth || pWin -> drawable.y != X.xcrossing.y_root - X.xcrossing.y - pWin -> borderWidth)) { /* * This code is useful for finding the window position. It * should be re-implemented by following the ICCCM 4.1.5 * recommendations. */ #ifdef TEST fprintf(stderr, "%s: pWin -> drawable.x [%d] pWin -> drawable.y [%d].\n", __func__, pWin -> drawable.x, pWin -> drawable.y); #endif XID values[4]; register XID *value = values; *value++ = (XID) (X.xcrossing.x_root - X.xcrossing.x - pWin -> borderWidth); *value++ = (XID) (X.xcrossing.y_root - X.xcrossing.y - pWin -> borderWidth); /* * nxagentWindowPriv(pWin)->x = (X.xcrossing.x_root - X.xcrossing.x); * nxagentWindowPriv(pWin)->y = (X.xcrossing.y_root - X.xcrossing.y); */ Mask mask = CWX | CWY; nxagentScreenTrap = 1; ConfigureWindow(pWin, mask, (XID *) values, wClient(pWin)); nxagentScreenTrap = 0; } if (nxagentOption(Fullscreen) == 1 && X.xcrossing.window == nxagentFullscreenWindow && X.xcrossing.detail != NotifyInferior) { nxagentGrabPointerAndKeyboard(&X); } if (X.xcrossing.detail != NotifyInferior) { pScreen = nxagentScreen(X.xcrossing.window); if (pScreen) { NewCurrentScreen(pScreen, X.xcrossing.x, X.xcrossing.y); memset(&x, 0, sizeof(xEvent)); x.u.u.type = MotionNotify; if (nxagentOption(Rootless)) { nxagentLastEnteredWindow = nxagentWindowPtr(X.xcrossing.window); x.u.keyButtonPointer.rootX = X.xcrossing.x_root; x.u.keyButtonPointer.rootY = X.xcrossing.y_root; } else { x.u.keyButtonPointer.rootX = X.xcrossing.x - nxagentOption(RootX); x.u.keyButtonPointer.rootY = X.xcrossing.y - nxagentOption(RootY); } x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis(); mieqEnqueue(&x); nxagentDirectInstallColormaps(pScreen); } } nxagentInputEvent = 1; break; } case LeaveNotify: { #ifdef TEST fprintf(stderr, "%s: Going to handle new LeaveNotify event.\n", __func__); #endif if (nxagentOption(Rootless) && X.xcrossing.mode == NotifyNormal && X.xcrossing.detail != NotifyInferior) { nxagentLastEnteredWindow = NULL; } if (!nxagentOption(AutoGrab)) { if (X.xcrossing.window == nxagentDefaultWindows[0] && X.xcrossing.detail != NotifyInferior && X.xcrossing.mode == NotifyNormal) { nxagentUngrabPointerAndKeyboard(&X); } } if (X.xcrossing.detail != NotifyInferior) { pScreen = nxagentScreen(X.xcrossing.window); if (pScreen) { nxagentDirectUninstallColormaps(pScreen); } } nxagentInputEvent = 1; break; } case DestroyNotify: { #ifdef TEST fprintf(stderr, "%s: Going to handle new DestroyNotify event.\n", __func__); #endif if (nxagentParentWindow != (Window) 0 && X.xdestroywindow.window == nxagentParentWindow) { fprintf(stderr, "Warning: Unhandled destroy notify event received in agent.\n"); } break; } case ClientMessage: { enum HandleEventResult result; #ifdef TEST fprintf(stderr, "%s: Going to handle new ClientMessage event.\n", __func__); #endif nxagentHandleClientMessageEvent(&X, &result); if (result == doCloseSession) { closeSession = TRUE; } break; } case VisibilityNotify: { #ifdef TEST fprintf(stderr, "%s: Going to handle new VisibilityNotify event.\n", __func__); #endif if (X.xvisibility.window != nxagentDefaultWindows[0]) { Window window = X.xvisibility.window; WindowPtr pWin = nxagentWindowPtr(window); if (pWin && nxagentWindowPriv(pWin)) { if (nxagentWindowPriv(pWin) -> visibilityState != X.xvisibility.state) { int value = X.xvisibility.state; if (nxagentOption(Rootless) == 1) { TraverseTree(pWin, nxagentChangeVisibilityPrivate, &value); } else { nxagentChangeVisibilityPrivate(pWin, &value); } } } #ifdef TEST fprintf(stderr, "%s: Suppressing visibility notify on window [%lx].\n", __func__, X.xvisibility.window); #endif break; } #ifdef TEST fprintf(stderr, "%s: Visibility notify state is [%d] with previous [%d].\n", __func__, X.xvisibility.state, nxagentVisibility); #endif nxagentVisibility = X.xvisibility.state; break; } case Expose: { #ifdef DEBUG fprintf(stderr, "%s: Going to handle new Expose event.\n", __func__); fprintf(stderr, "%s: WARNING! Received Expose event for drawable [%lx]" " geometry [%d, %d, %d, %d] count [%d].\n", __func__, X.xexpose.window, X.xexpose.x, X.xexpose.y, X.xexpose.width, X.xexpose.height, X.xexpose.count); #endif nxagentHandleExposeEvent(&X); break; } case GraphicsExpose: { #ifdef DEBUG fprintf(stderr, "%s: Going to handle new GraphicsExpose event.\n", __func__); fprintf(stderr, "%s: WARNING! Received GraphicsExpose event " "for drawable [%lx] geometry [%d, %d, %d, %d] count [%d].\n", __func__, X.xgraphicsexpose.drawable, X.xgraphicsexpose.x, X.xgraphicsexpose.y, X.xgraphicsexpose.width, X.xgraphicsexpose.height, X.xgraphicsexpose.count); #endif nxagentHandleGraphicsExposeEvent(&X); break; } case NoExpose: { #ifdef DEBUG fprintf(stderr, "%s: Going to handle new NoExpose event.\n", __func__); fprintf(stderr, "%s: WARNING! Received NoExpose event for drawable [%lx].\n", __func__, X.xnoexpose.drawable); #endif break; } case CirculateNotify: { #ifdef WARNING fprintf(stderr, "%s: Going to handle new CirculateNotify event.\n", __func__); #endif /* * FIXME: Do we need this? * * WindowPtr pWin = nxagentWindowPtr(X.xcirculate.window); * * if (!pWin) * { * pWin = nxagentRootlessTopLevelWindow(X.xcirculate.window); * } * * if (!pWin) * { * break; * } * * XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), * &root_return, &parent_return, &children_return, &nchildren_return); * * nxagentRootlessRestack(children_return, nchildren_return); */ break; } case ConfigureNotify: { #ifdef TEST fprintf(stderr, "%s: Going to handle new ConfigureNotify event.\n", __func__); #endif if (nxagentConfiguredSynchroWindow == X.xconfigure.window) { if (nxagentExposeQueue.exposures[nxagentExposeQueue.start].serial != X.xconfigure.x) { #ifdef WARNING if (nxagentVerbose == 1) { fprintf(stderr, "%s: Requested ConfigureNotify changes didn't take place.\n", __func__); } #endif } #ifdef TEST fprintf(stderr, "%s: Received ConfigureNotify and going to call nxagentSynchronizeExpose.\n", __func__); #endif nxagentSynchronizeExpose(); break; } nxagentHandleConfigureNotify(&X); break; } case GravityNotify: { #ifdef TEST fprintf(stderr, "%s: Going to handle new GravityNotify event.\n", __func__); #endif break; } case ReparentNotify: { #ifdef TEST fprintf(stderr, "%s: Going to handle new ReparentNotify event.\n", __func__); #endif nxagentHandleReparentNotify(&X); break; } case UnmapNotify: { #ifdef TEST fprintf(stderr, "%s: Going to handle new UnmapNotify event.\n", __func__); #endif if (nxagentOption(Rootless) == 1) { WindowPtr pWin; if ((pWin = nxagentRootlessTopLevelWindow(X.xunmap.window)) != NULL || ((pWin = nxagentWindowPtr(X.xunmap.window)) != NULL && nxagentWindowTopLevel(pWin) == 1)) { nxagentScreenTrap = 1; UnmapWindow(pWin, False); nxagentScreenTrap = 0; } } if (nxagentUseNXTrans == 1 && nxagentOption(Rootless) == 0 && nxagentOption(Nested) == 0 && X.xmap.window != nxagentIconWindow) { nxagentVisibility = VisibilityFullyObscured; } break; } case MapNotify: { #ifdef TEST fprintf(stderr, "%s: Going to handle new MapNotify event.\n", __func__); #endif if (nxagentOption(Rootless) == 1) { WindowPtr pWin; if ((pWin = nxagentRootlessTopLevelWindow(X.xmap.window)) != NULL || ((pWin = nxagentWindowPtr(X.xmap.window)) != NULL && nxagentWindowTopLevel(pWin) == 1)) { nxagentScreenTrap = 1; MapWindow(pWin, wClient(pWin)); nxagentScreenTrap = 0; } if (pWin != NULL) { Bool value = 1; TraverseTree(pWin, nxagentChangeMapPrivate, &value); } } if (nxagentOption(AllScreens) == 1) { if (X.xmap.window == nxagentIconWindow) { pScreen = nxagentScreen(X.xmap.window); nxagentMaximizeToFullScreen(pScreen); } } if (nxagentOption(Fullscreen) == 1) { nxagentVisibility = VisibilityUnobscured; nxagentVisibilityStop = False; nxagentVisibilityTimeout = GetTimeInMillis() + 2000; } /* * without window manager there will be no ConfigureNotify * event that would trigger xinerama updates. So we do that * once the nxagent window gets mapped. */ if (!nxagentWMIsRunning && X.xmap.window == nxagentDefaultWindows[nxagentScreen(X.xmap.window)->myNum]) { nxagentChangeScreenConfig(nxagentScreen(X.xmap.window)->myNum, nxagentOption(Width), nxagentOption(Height)); } break; } case MappingNotify: { XMappingEvent *mappingEvent = (XMappingEvent *) &X; #ifdef DEBUG fprintf(stderr, "%s: WARNING! Going to handle new MappingNotify event.\n", __func__); #endif if (mappingEvent -> request == MappingPointer) { nxagentInitPointerMap(); } break; } default: { /* * Let's check if this is a XKB state modification event. */ if (nxagentHandleXkbKeyboardStateEvent(&X) == 0 && nxagentHandleXFixesSelectionNotify(&X) == 0) { #ifdef TEST fprintf(stderr, "%s: WARNING! Unhandled event code [%d].\n", __func__, X.type); #endif } break; } } /* End of switch (X.type) */ if (X.xany.serial < lastEventSerial) { /* * Start over. */ nxagentDeleteStaticResizedWindow(0); } else { nxagentDeleteStaticResizedWindow(X.xany.serial - 1); } lastEventSerial = X.xany.serial; } /* End of while (...) */ /* * Send the exposed regions to the clients. */ nxagentForwardRemoteExpose(); /* * Handle the agent window's changes. */ if (closeSession) { if (nxagentOption(Persistent)) { if (nxagentNoDialogIsRunning) { nxagentLaunchDialog(DIALOG_SUSPEND_SESSION); } } else { if (nxagentNoDialogIsRunning) { nxagentLaunchDialog(DIALOG_KILL_SESSION); } } } if (minimize) { nxagentWMDetect(); if (nxagentWMIsRunning) { if (nxagentOption(AllScreens)) { nxagentMinimizeFromFullScreen(pScreen); } else { XIconifyWindow(nxagentDisplay, nxagentDefaultWindows[0], DefaultScreen(nxagentDisplay)); } } } if (switchFullscreen) { if (nxagentOption(AllScreens) == 1 && nxagentOption(Fullscreen) == 1) { nxagentSwitchAllScreens(pScreen, 0); } else { nxagentSwitchFullscreen(pScreen, !nxagentOption(Fullscreen)); } } if (switchAllScreens) { if (nxagentOption(AllScreens) == 0 && nxagentOption(Fullscreen) == 1) { nxagentSwitchFullscreen(pScreen, False); } else { nxagentSwitchAllScreens(pScreen, !nxagentOption(AllScreens)); } } #ifdef BLOCKS fprintf(stderr, "[End read]\n"); #endif /* * Let the underlying X server code process the input events. */ #ifdef BLOCKS fprintf(stderr, "[Begin events]\n"); #endif ProcessInputEvents(); #ifdef TEST fprintf(stderr, "%s: Output pending flag is [%d] critical [%d].\n", __func__, NewOutputPending, CriticalOutputPending); #endif /* * Write the events to our clients. We may flush only in the case of * critical output but this doesn't seem beneficial. * * if (CriticalOutputPending == 1) * { * FlushAllOutput(); * } */ if (NewOutputPending == 1) { #ifdef TEST fprintf(stderr, "%s: Flushed the processed events to clients.\n", __func__); #endif FlushAllOutput(); } #ifdef TEST if (nxagentPendingEvents(nxagentDisplay) > 0) { fprintf(stderr, "%s: WARNING! More events need to be dispatched.\n", __func__); } #endif #ifdef BLOCKS fprintf(stderr, "[End events]\n"); #endif } /* * Functions providing the ad-hoc handling of the remote X events. */ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) { if (nxagentXkbState.Initialized == 0) { if (X -> xkey.keycode == nxagentCapsLockKeycode) { nxagentXkbCapsTrap = 1; } else if (X -> xkey.keycode == nxagentNumLockKeycode) { nxagentXkbNumTrap = 1; } nxagentInitXkbKeyboardState(); nxagentXkbCapsTrap = 0; nxagentXkbNumTrap = 0; } if (nxagentCheckSpecialKeystroke(&X -> xkey, result)) { #ifdef TEST fprintf(stderr, "%s: NOT passing KeyPress event to clients\n", __func__); #endif return 1; } if (X -> xkey.keycode == nxagentCapsLockKeycode) { nxagentXkbState.Caps = (~nxagentXkbState.Caps & 1); } else if (X -> xkey.keycode == nxagentNumLockKeycode) { nxagentXkbState.Num = (~nxagentXkbState.Num & 1); } nxagentLastServerTime = X -> xkey.time; nxagentLastEventTime = nxagentLastKeyPressTime = GetTimeInMillis(); xEvent x = {0}; x.u.u.type = KeyPress; x.u.u.detail = nxagentConvertKeycode(X -> xkey.keycode); x.u.keyButtonPointer.time = nxagentLastKeyPressTime; #ifdef TEST fprintf(stderr, "%s: passing KeyPress event to clients\n", __func__); #endif mieqEnqueue(&x); CriticalOutputPending = 1; return 1; } int nxagentHandlePropertyNotify(XEvent *X) { if (nxagentOption(Rootless) && !nxagentNotifyMatchChangeProperty((XPropertyEvent *) X)) { #ifdef TEST fprintf(stderr, "%s: Property %ld on window %lx.\n", __func__, X -> xproperty.atom, X -> xproperty.window); #endif if (nxagentWindowPtr(X -> xproperty.window) != NULL) { int resource = NXGetCollectPropertyResource(nxagentDisplay); if (resource == -1) { #ifdef WARNING fprintf(stderr, "%s: WARNING! Asynchronous get property queue is full.\n", __func__); #endif return 0; } NXCollectProperty(nxagentDisplay, resource, X -> xproperty.window, X -> xproperty.atom, 0, MAX_RETRIEVED_PROPERTY_SIZE, False, AnyPropertyType); nxagentPropertyRequests[resource].window = X -> xproperty.window; nxagentPropertyRequests[resource].property = X -> xproperty.atom; } #ifdef TEST else { fprintf(stderr, "%s: Failed to look up remote window property.\n", __func__); } #endif } return 1; } int nxagentHandleExposeEvent(XEvent *X) { StaticResizedWindowStruct *resizedWinPtr = NULL; #ifdef DEBUG fprintf(stderr, "%s: Checking remote expose events.\n", __func__); fprintf(stderr, "%s: Looking for window id [%ld].\n", __func__, X -> xexpose.window); #endif Window window = X -> xexpose.window; WindowPtr pWin = nxagentWindowPtr(window); if (pWin != NULL) { RegionRec sum; RegionRec add; BoxRec box; RegionInit(&sum, (BoxRec *) NULL, 1); /* FIXME: This can be maybe optimized by consuming the events that do not match the predicate. */ do { #ifdef DEBUG fprintf(stderr, "%s: Adding event for window id [%ld].\n", __func__, X -> xexpose.window); #endif box.x1 = pWin -> drawable.x + wBorderWidth(pWin) + X -> xexpose.x; box.y1 = pWin -> drawable.y + wBorderWidth(pWin) + X -> xexpose.y; resizedWinPtr = nxagentFindStaticResizedWindow(X -> xany.serial); while (resizedWinPtr) { if (resizedWinPtr -> pWin == pWin) { box.x1 += resizedWinPtr -> offX; box.y1 += resizedWinPtr -> offY; } resizedWinPtr = resizedWinPtr -> prev; } box.x2 = box.x1 + X -> xexpose.width; box.y2 = box.y1 + X -> xexpose.height; RegionInit(&add, &box, 1); RegionAppend(&sum, &add); RegionUninit(&add); if (X -> xexpose.count == 0) { break; } } while (nxagentCheckEvents(nxagentDisplay, X, nxagentExposurePredicate, (XPointer) &window) == 1); int overlap = 0; RegionValidate(&sum, &overlap); RegionIntersect(&sum, &sum, &pWin->drawable.pScreen->root->winSize); #ifdef DEBUG fprintf(stderr, "%s: Sending events for window id [%ld].\n", __func__, X -> xexpose.window); #endif /* * If the agent has already sent auto-generated expose, * save received exposes for later processing. */ int index = nxagentLookupByWindow(pWin); if (index == -1) { miWindowExposures(pWin, &sum, NullRegion); } else { RegionTranslate(&sum, -pWin -> drawable.x, -pWin -> drawable.y); if (nxagentExposeQueue.exposures[index].remoteRegion == NullRegion) { nxagentExposeQueue.exposures[index].remoteRegion = RegionCreate(NULL, 1); } RegionUnion(nxagentExposeQueue.exposures[index].remoteRegion, nxagentExposeQueue.exposures[index].remoteRegion, &sum); #ifdef TEST fprintf(stderr, "%s: Added region for window [%u] to position [%d].\n", __func__, nxagentWindow(pWin), index); #endif if (X -> xexpose.count == 0) { nxagentExposeQueue.exposures[index].remoteRegionIsCompleted = True; } else { nxagentExposeQueue.exposures[index].remoteRegionIsCompleted = False; } } RegionUninit(&sum); } return 1; } int nxagentHandleGraphicsExposeEvent(XEvent *X) { /* * Send an expose event to client, instead of graphics expose. If * target drawable is a backing pixmap, send expose event for the * saved window, else do nothing. */ StoringPixmapPtr pStoringPixmapRec = NULL; miBSWindowPtr pBSwindow = NULL; int drawableType; WindowPtr pWin = nxagentWindowPtr(X -> xgraphicsexpose.drawable); if (pWin != NULL) { drawableType = DRAWABLE_WINDOW; } else { drawableType = DRAWABLE_PIXMAP; } if (drawableType == DRAWABLE_PIXMAP) { pStoringPixmapRec = nxagentFindItemBSPixmapList(X -> xgraphicsexpose.drawable); if (pStoringPixmapRec == NULL) { #ifdef TEST fprintf(stderr, "%s: WARNING! Storing pixmap not found.\n", __func__); #endif return 1; } pBSwindow = (miBSWindowPtr) pStoringPixmapRec -> pSavedWindow -> backStorage; if (pBSwindow == NULL) { #ifdef TEST fprintf(stderr, "%s: WARNING! Back storage not found.\n", __func__); #endif return 1; } pWin = pStoringPixmapRec -> pSavedWindow; } /* * Rectangle affected by GraphicsExpose event. */ BoxRec rect = { .x1 = X -> xgraphicsexpose.x, .y1 = X -> xgraphicsexpose.y, .x2 = rect.x1 + X -> xgraphicsexpose.width, .y2 = rect.y1 + X -> xgraphicsexpose.height, }; RegionPtr exposeRegion = RegionCreate(&rect, 0); if (drawableType == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "%s: Handling GraphicsExpose event on pixmap with id [%lu].\n", __func__, X -> xgraphicsexpose.drawable); #endif /* * The exposeRegion coordinates are relative to the pixmap to * which GraphicsExpose event refers. But the BS coordinates of * the savedRegion are relative to the window. */ RegionTranslate(exposeRegion, pStoringPixmapRec -> backingStoreX, pStoringPixmapRec -> backingStoreY); /* * We remove from SavedRegion the part affected by the * GraphicsExpose event. */ RegionSubtract(&(pBSwindow -> SavedRegion), &(pBSwindow -> SavedRegion), exposeRegion); } /* * Store the exposeRegion in order to send the expose event * later. The coordinates must be relative to the screen. */ RegionTranslate(exposeRegion, pWin -> drawable.x, pWin -> drawable.y); RegionUnion(nxagentRemoteExposeRegion, nxagentRemoteExposeRegion, exposeRegion); RegionDestroy(exposeRegion); return 1; } int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) { *result = doNothing; /* * If window is 0, message_type is 0 and format is 32 then we assume * event is coming from proxy. */ if (X -> xclient.window == 0 && X -> xclient.message_type == 0 && X -> xclient.format == 32) { #ifdef TEST fprintf(stderr, "%s: got nxproxy event\n", __func__); #endif nxagentHandleProxyEvent(X); return 1; } #ifdef TEST char * name = XGetAtomName(nxagentDisplay, X -> xclient.message_type); fprintf(stderr, "nxagentHandleClientMessageEvent: ClientMessage event window [0x%lx] with " "message_type [%ld][%s] format [%d] type [%d] source_indication [%ld][%s] timestamp [%ld] " "curwin [0x%lx].\n", X -> xclient.window, X -> xclient.message_type, name, X -> xclient.format, X -> xclient.type, X -> xclient.data.l[0], X -> xclient.data.l[0] == 1 ? "'application'" : X -> xclient.data.l[0] == 1 ? "'pager'" : "'none (old spec)'", X -> xclient.data.l[1], X -> xclient.data.l[2]); SAFE_XFree(name); #endif if (nxagentOption(Rootless)) { Atom message_type = nxagentRemoteToLocalAtom(X -> xclient.message_type); if (!ValidAtom(message_type)) { #ifdef WARNING fprintf(stderr, "%s: WARNING Invalid type in client message.\n", __func__); #endif return 0; } WindowPtr pWin = nxagentWindowPtr(X -> xclient.window); if (pWin == NULL) { /* * If some window on the real X server sends a * _NET_ACTIVE_WINDOW ClientMessage to indicate the active * window that window will be one not belonging to nxagent so * this situation is perfectly legal. For all other situations * we print a warning. */ #ifdef WARNING if (message_type != MakeAtom("_NET_ACTIVE_WINDOW", strlen("_NET_ACTIVE_WINDOW"), False)) { fprintf(stderr, "WARNING: Invalid window in ClientMessage xclient.window [0x%lx].\n", X->xclient.window); } #endif return 0; } if (message_type == MakeAtom("WM_PROTOCOLS", strlen("WM_PROTOCOLS"), False)) { xEvent x = {0}; x.u.u.type = ClientMessage; x.u.u.detail = X -> xclient.format; x.u.clientMessage.window = pWin -> drawable.id; x.u.clientMessage.u.l.type = message_type; x.u.clientMessage.u.l.longs0 = nxagentRemoteToLocalAtom(X -> xclient.data.l[0]); x.u.clientMessage.u.l.longs1 = GetTimeInMillis(); if (!ValidAtom(x.u.clientMessage.u.l.longs0)) { #ifdef WARNING fprintf(stderr, "%s: WARNING Invalid value in client message of type WM_PROTOCOLS.\n", __func__); #endif return 0; } #ifdef TEST else { fprintf(stderr, "%s: Sent client message of type WM_PROTOCOLS and value [%s].\n", __func__, validateString(NameForAtom(x.u.clientMessage.u.l.longs0))); } #endif TryClientEvents(wClient(pWin), &x, 1, 1, 1, 0); } else { #ifdef WARNING fprintf(stderr, "%s: Ignored message type %ld [%s].\n", __func__, (long int) message_type, validateString(NameForAtom(message_type))); #endif return 0; } return 1; } if (X -> xclient.message_type == nxagentAtoms[1]) /* WM_PROTOCOLS */ { Atom wmAtom = (Atom) X -> xclient.data.l[0]; Atom deleteWMatom = nxagentAtoms[2]; /* WM_DELETE_WINDOW */ if (wmAtom == deleteWMatom) { if (nxagentOnce && (nxagentClients == 0)) { GiveUp(0); } else { #ifdef TEST fprintf(stderr, "%s: WM_DELETE_WINDOW arrived Atom = %u.\n", __func__, wmAtom); #endif if (X -> xclient.window == nxagentIconWindow) { XMapRaised(nxagentDisplay, nxagentFullscreenWindow); XIconifyWindow(nxagentDisplay, nxagentIconWindow, DefaultScreen(nxagentDisplay)); } if (X -> xclient.window == (nxagentOption(Fullscreen) ? nxagentIconWindow : nxagentDefaultWindows[0]) || !nxagentWMIsRunning) { *result = doCloseSession; } } } } return 1; } int nxagentHandleXkbKeyboardStateEvent(XEvent *X) { XkbEvent *xkbev = (XkbEvent *) X; if (nxagentXkbInfo.EventBase != -1 && xkbev -> type == nxagentXkbInfo.EventBase + XkbEventCode && xkbev -> any.xkb_type == XkbStateNotify) { #ifdef TEST fprintf(stderr, "%s: Handling event with caps [%d] num [%d] locked [%d].\n", __func__, nxagentXkbState.Caps, nxagentXkbState.Num, nxagentXkbState.Locked); #endif nxagentXkbState.Locked = xkbev -> state.locked_mods; #ifdef TEST fprintf(stderr, "%s: Updated XKB locked modifier bits to [%x].\n", __func__, nxagentXkbState.Locked); #endif nxagentXkbState.Initialized = 1; if (nxagentXkbState.Caps == 0 && (nxagentXkbState.Locked & CAPSFLAG_IN_EVENT)) { nxagentXkbState.Caps = 1; #ifdef TEST fprintf(stderr, "%s: Sending fake key [66] to engage capslock.\n", __func__); #endif if (!nxagentXkbCapsTrap) { nxagentSendFakeKey(66); } } if (nxagentXkbState.Caps == 1 && !(nxagentXkbState.Locked & CAPSFLAG_IN_EVENT)) { nxagentXkbState.Caps = 0; #ifdef TEST fprintf(stderr, "%s: Sending fake key [66] to release capslock.\n", __func__); #endif nxagentSendFakeKey(66); } if (nxagentXkbState.Caps == 0 && !(nxagentXkbState.Locked & CAPSFLAG_IN_EVENT) && nxagentXkbCapsTrap) { #ifdef TEST fprintf(stderr, "%s: Sending fake key [66] to release capslock.\n", __func__); #endif nxagentSendFakeKey(66); } if (nxagentXkbState.Num == 0 && (nxagentXkbState.Locked & NUMFLAG_IN_EVENT)) { nxagentXkbState.Num = 1; #ifdef TEST fprintf(stderr, "%s: Sending fake key [77] to engage numlock.\n", __func__); #endif if (!nxagentXkbNumTrap) { nxagentSendFakeKey(77); } } if (nxagentXkbState.Num == 1 && !(nxagentXkbState.Locked & NUMFLAG_IN_EVENT)) { nxagentXkbState.Num = 0; #ifdef TEST fprintf(stderr, "%s: Sending fake key [77] to release numlock.\n", __func__); #endif nxagentSendFakeKey(77); } if (nxagentXkbState.Num == 0 && !(nxagentXkbState.Locked & NUMFLAG_IN_EVENT) && nxagentXkbNumTrap) { #ifdef TEST fprintf(stderr, "%s: Sending fake key [77] to release numlock.\n", __func__); #endif nxagentSendFakeKey(77); } return 1; } return 0; } int nxagentHandleXFixesSelectionNotify(XEvent *X) { XFixesSelectionEvent *xfixesEvent = (XFixesSelectionEvent *) X; if (nxagentXFixesInfo.Initialized == 0) { #ifdef DEBUG fprintf(stderr, "%s: XFixes not initialized - doing nothing.\n", __func__); #endif return 0; } if (xfixesEvent -> type != (nxagentXFixesInfo.EventBase + XFixesSelectionNotify)) { #ifdef DEBUG fprintf(stderr, "%s: event type is [%d] - doing nothing.\n", __func__, xfixesEvent->type); #endif return 0; } #ifdef TEST fprintf(stderr, "%s: Handling event.\n", __func__); #endif Atom local = nxagentRemoteToLocalAtom(xfixesEvent -> xfixesselection.selection); if (SelectionCallback) { int i = nxagentFindCurrentSelectionIndex(local); if (i < NumCurrentSelections) { if (CurrentSelections[i].client != 0) { #ifdef TEST fprintf(stderr, "%s: Do nothing.\n", __func__); #endif return 1; } #ifdef TEST fprintf(stderr, "%s: Calling callbacks for %d [%s] selection.\n", __func__, CurrentSelections[i].selection, NameForAtom(CurrentSelections[i].selection)); #endif #ifdef DEBUG fprintf(stderr, "%s: CurrentSelections[i].lastTimeChanged [%d]\n", __func__, CurrentSelections[i].lastTimeChanged.milliseconds); fprintf(stderr, "%s: Event timestamp [%ld]\n", __func__, xfixesEvent->xfixesselection.timestamp); fprintf(stderr, "%s: Event selection timestamp [%ld]\n", __func__, xfixesEvent->xfixesselection.selection_timestamp); fprintf(stderr, "%s: Event selection window [0x%lx]\n", __func__, xfixesEvent->xfixesselection.window); fprintf(stderr, "%s: Event selection owner [0x%lx]\n", __func__, xfixesEvent->xfixesselection.owner); fprintf(stderr, "%s: Event selection [%s]\n", __func__, NameForAtom(nxagentRemoteToLocalAtom(xfixesEvent->xfixesselection.selection))); fprintf(stderr, "%s: Subtype ", __func__); switch (xfixesEvent -> xfixesselection.subtype) { case SelectionSetOwner: fprintf(stderr, "SelectionSetOwner.\n"); break; case SelectionWindowDestroy: fprintf(stderr, "SelectionWindowDestroy.\n"); break; case SelectionClientClose: fprintf(stderr, "SelectionClientClose.\n"); break; default: fprintf(stderr, ".\n"); break; } #endif SelectionInfoRec info = { .selection = &CurrentSelections[i], .kind = xfixesEvent->xfixesselection.subtype }; /* * The trap indicates that we are triggered by a clipboard event * originating from the real X server. In that case we do not * want to propagate back changes to the real X server, because * it already knows about them and we would end up in an * infinite loop of events. If there was a better way to * identify that situation during Callback processing we could * get rid of the Trap... */ nxagentExternalClipboardEventTrap = 1; CallCallbacks(&SelectionCallback, &info); nxagentExternalClipboardEventTrap = 0; } } return 1; } int nxagentHandleProxyEvent(XEvent *X) { switch (X -> xclient.data.l[0]) { case NXNoSplitNotify: case NXStartSplitNotify: { /* * We should never receive such events in the event loop, as * they should be caught at the time the split is initiated. */ #ifdef PANIC int client = (int) X -> xclient.data.l[1]; if (X -> xclient.data.l[0] == NXNoSplitNotify) { fprintf(stderr, "%s: PANIC! NXNoSplitNotify received with client [%d].\n", __func__, client); } else { fprintf(stderr, "%s: PANIC! NXStartSplitNotify received with client [%d].\n", __func__, client); } #endif return 1; } case NXCommitSplitNotify: { /* * We need to commit an image. Image can be the result of a * PutSubImage() generated by Xlib, so there can be more than a * single image to commit, even if only one PutImage was perfor- * med by the agent. */ int client = (int) X -> xclient.data.l[1]; int request = (int) X -> xclient.data.l[2]; int position = (int) X -> xclient.data.l[3]; #ifdef TEST fprintf(stderr, "%s: NXCommitSplitNotify received with client [%d]" " request [%d] and position [%d].\n", __func__, client, request, position); #endif nxagentHandleCommitSplitEvent(client, request, position); return 1; } case NXEndSplitNotify: { /* * All images for the split were transferred and we need to * restart the client. */ int client = (int) X -> xclient.data.l[1]; #ifdef TEST fprintf(stderr, "%s: NXEndSplitNotify received with client [%d].\n", __func__, client); #endif nxagentHandleEndSplitEvent(client); return 1; } case NXEmptySplitNotify: { /* * All splits have been completed and none remain. */ #ifdef TEST fprintf(stderr, "%s: NXEmptySplitNotify received.\n", __func__); #endif nxagentHandleEmptySplitEvent(); return 1; } case NXCollectPropertyNotify: { #ifdef TEST int resource = (int) X -> xclient.data.l[1]; fprintf(stderr, "%s: NXCollectPropertyNotify received with resource [%d].\n", __func__, resource); #endif nxagentHandleCollectPropertyEvent(X); return 1; } case NXCollectGrabPointerNotify: { int resource = (int) X -> xclient.data.l[1]; #ifdef TEST fprintf(stderr, "%s: NXCollectGrabPointerNotify received with resource [%d].\n", __func__, resource); #endif nxagentHandleCollectGrabPointerEvent(resource); return 1; } case NXCollectInputFocusNotify: { int resource = (int) X -> xclient.data.l[1]; /* * This is not used at the present moment. */ #ifdef TEST fprintf(stderr, "%s: NXCollectInputFocusNotify received with resource [%d].\n", __func__, resource); #endif nxagentHandleCollectInputFocusEvent(resource); return 1; } default: { /* * Not a recognized ClientMessage event. */ #ifdef WARNING fprintf(stderr, "%s: WARNING! Not a recognized ClientMessage proxy event [%d].\n", __func__, (int) X -> xclient.data.l[0]); #endif return 0; } } } /* * In this function it is assumed that we never get a configure with * both stacking order and geometry changed, this way we can ignore * stacking changes if the geometry has changed. */ int nxagentCheckWindowConfiguration(XConfigureEvent* X) { static int x = 0; static int y = 0; static int width = 0; static int height = 0; static Window win = None; Bool geometryChanged = False; XlibWindow root_return = 0; XlibWindow parent_return = 0; XlibWindow *children_return = NULL; unsigned int nchildren_return = 0; Status result; if (win == X -> window) { if (x != X -> x || y != X -> y || width != X -> width || height != X -> height) { geometryChanged = True; } } win = X -> window; x = X -> x; y = X -> y; width = X -> width; height = X -> height; if (geometryChanged) { #ifdef TEST fprintf(stderr, "%s: Configure frame. No restack.\n", __func__); #endif return 1; } #ifdef TEST { fprintf(stderr, "%s: Before restacking top level window [%p]\n", __func__, (void *) nxagentWindowPtr(X -> window)); for (WindowPtr pSib = screenInfo.screens[0]->root -> firstChild; pSib; pSib = pSib -> nextSib) { fprintf(stderr, "%s: Top level window: [%p].\n", __func__, (void *) pSib); } } #endif result = XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), &root_return, &parent_return, &children_return, &nchildren_return); if (result) { nxagentRootlessRestack(children_return, nchildren_return); } else { #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed QueryTree request.\n", __func__); #endif } SAFE_XFree(children_return); #if 0 fprintf(stderr, "%s: Trees match: %s\n", __func__, nxagentRootlessTreesMatch() ? "Yes" : "No"); #endif return 1; } int nxagentHandleConfigureNotify(XEvent* X) { if (nxagentOption(Rootless) == True) { int sendEventAnyway = 0; WindowPtr pWinWindow = nxagentWindowPtr(X -> xconfigure.window); #ifdef TEST { WindowPtr pWinEvent = nxagentWindowPtr(X -> xconfigure.event); fprintf(stderr, "%s: Generating window is [%p][%ld] target [%p][%ld].\n", __func__, (void *) pWinEvent, X -> xconfigure.event, (void *) pWinWindow, X -> xconfigure.window); } #endif #ifdef TEST fprintf(stderr, "%s: New configuration for window [%p][%ld] is [%d][%d][%d][%d] send_event [%i].\n", __func__, (void *) pWinWindow, X -> xconfigure.window, X -> xconfigure.x, X -> xconfigure.y, X -> xconfigure.width, X -> xconfigure.height, X -> xconfigure.send_event); #endif WindowPtr pWin = nxagentRootlessTopLevelWindow(X -> xconfigure.window); if (pWin != NULL) { /* * Checking for new geometry or stacking order changes. */ nxagentCheckWindowConfiguration((XConfigureEvent*)X); return 1; } if (nxagentWindowTopLevel(pWinWindow) && !X -> xconfigure.override_redirect) { XID values[5]; register XID *value = values; Mask mask = CWHeight | CWWidth | CWBorderWidth; /* FIXME: override_redirect is always FALSE here */ if (X -> xconfigure.send_event || !nxagentWMIsRunning || X -> xconfigure.override_redirect) { *value++ = (XID)X -> xconfigure.x; *value++ = (XID)X -> xconfigure.y; /* * nxagentWindowPriv(pWinWindow)->x = X -> xconfigure.x; * nxagentWindowPriv(pWinWindow)->y = X -> xconfigure.y; */ mask |= CWX | CWY; } *value++ = (XID)X -> xconfigure.width; *value++ = (XID)X -> xconfigure.height; *value++ = (XID)X -> xconfigure.border_width; /* * We don't need width and height here. * * nxagentWindowPriv(pWinWindow)->width = X -> xconfigure.width; * nxagentWindowPriv(pWinWindow)->height = X -> xconfigure.height; */ nxagentScreenTrap = 1; ConfigureWindow(pWinWindow, mask, (XID *) values, wClient(pWinWindow)); nxagentScreenTrap = 0; nxagentCheckWindowConfiguration((XConfigureEvent*)X); /* * This workaround should help with Java 1.6.0 that seems to * ignore non-synthetic events. */ if (nxagentOption(ClientOs) == ClientOsWinnt) { #ifdef TEST fprintf(stderr, "%s: Apply workaround for NXWin.\n", __func__); #endif sendEventAnyway = 1; } if (sendEventAnyway || X -> xconfigure.send_event) { xEvent x = {0}; x.u.u.type = X -> xconfigure.type | 0x80; x.u.configureNotify.event = pWinWindow -> drawable.id; x.u.configureNotify.window = pWinWindow -> drawable.id; if (pWinWindow -> nextSib) { x.u.configureNotify.aboveSibling = pWinWindow -> nextSib -> drawable.id; } else { x.u.configureNotify.aboveSibling = None; } x.u.configureNotify.x = X -> xconfigure.x; x.u.configureNotify.y = X -> xconfigure.y; x.u.configureNotify.width = X -> xconfigure.width; x.u.configureNotify.height = X -> xconfigure.height; x.u.configureNotify.borderWidth = X -> xconfigure.border_width; x.u.configureNotify.override = X -> xconfigure.override_redirect; TryClientEvents(wClient(pWinWindow), &x, 1, 1, 1, 0); } return 1; } } else { /* * Save the position of the agent default window. Don't save the * values if the agent is in fullscreen mode. * * If we use these values to restore the position of a window * after that we have dynamically changed the fullscreen * attribute, depending on the behaviour of window manager, we * could be not able to place the window exactly in the requested * position, so let the window manager do the job for us. */ ScreenPtr pScreen = nxagentScreen(X -> xconfigure.window); Bool doRandR = False; if (X -> xconfigure.window == nxagentDefaultWindows[pScreen -> myNum]) { if (nxagentOption(AllScreens) == 0) { /* * - WITHOUT window manager any position change is relevant * - WITH window manager only synthetic position changes send * by the window manager are relevant, see ICCCM Chapter 4, * "Configuring the Window" */ Bool updatePos = (!nxagentWMIsRunning || X -> xconfigure.send_event != 0); int newX = X -> xconfigure.x; int newY = X -> xconfigure.y; if (nxagentOption(DesktopResize) == 1) { if (nxagentOption(Width) != X -> xconfigure.width || nxagentOption(Height) != X -> xconfigure.height || (updatePos && (nxagentOption(X) != newX || nxagentOption(Y) != newY))) { #ifdef DEBUG int count = 0; #endif Bool newEvents = False; doRandR = True; NXFlushDisplay(nxagentDisplay, NXFlushLink); do { newEvents = False; nxagentWaitEvents(nxagentDisplay, 500); /* * This should also flush the NX link for us. */ XSync(nxagentDisplay, 0); while (XCheckTypedWindowEvent(nxagentDisplay, nxagentDefaultWindows[pScreen -> myNum], ConfigureNotify, X)) { #ifdef DEBUG count++; #endif if (!nxagentWMIsRunning || X -> xconfigure.send_event) { updatePos = True; newX = X -> xconfigure.x; newY = X -> xconfigure.y; } newEvents = True; } } while (newEvents); #ifdef DEBUG fprintf(stderr, "%s: accumulated %d events\n", __func__, count); #endif } } if (updatePos) { #ifdef DEBUG fprintf(stderr, "%s: Updating nxagent window position [%d,%d]\n", __func__, newX, newY); #endif nxagentChangeOption(X, newX); nxagentChangeOption(Y, newY); } if (nxagentOption(Shadow) == 1 && nxagentOption(DesktopResize) == 1 && (nxagentOption(Width) != X -> xconfigure.width || nxagentOption(Height) != X -> xconfigure.height)) { nxagentShadowResize = 1; } nxagentChangeOption(Width, X -> xconfigure.width); nxagentChangeOption(Height, X -> xconfigure.height); nxagentChangeOption(ViewportXSpan, (int) X -> xconfigure.width - (int) nxagentOption(RootWidth)); nxagentChangeOption(ViewportYSpan, (int) X -> xconfigure.height - (int) nxagentOption(RootHeight)); nxagentMoveViewport(pScreen, 0, 0); /* if in shadowing mode or if neither size nor position have changed we do not need to adjust RandR */ /* FIXME: Comment makes no sense */ if (nxagentOption(Shadow) == 1 || (nxagentOption(Width) == nxagentOption(RootWidth) && nxagentOption(Height) == nxagentOption(RootHeight) && nxagentOption(X) == nxagentOption(RootX) && nxagentOption(Y) == nxagentOption(RootY))) { doRandR = False; } nxagentChangeOption(Width, X -> xconfigure.width); nxagentChangeOption(Height, X -> xconfigure.height); XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, X -> xconfigure.width, X -> xconfigure.height); if (nxagentOption(Fullscreen) == 0) { nxagentMoveViewport(pScreen, 0, 0); } else { nxagentChangeOption(RootX, (nxagentOption(Width) - nxagentOption(RootWidth)) / 2); nxagentChangeOption(RootY, (nxagentOption(Height) - nxagentOption(RootHeight)) / 2); nxagentChangeOption(ViewportXSpan, nxagentOption(Width) - nxagentOption(RootWidth)); nxagentChangeOption(ViewportYSpan, nxagentOption(Height) - nxagentOption(RootHeight)); nxagentUpdateViewportFrame(0, 0, nxagentOption(RootWidth), nxagentOption(RootHeight)); XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root), nxagentOption(RootX), nxagentOption(RootY)); } if (doRandR) { #ifdef TEST fprintf(stderr,"%s: Width %d Height %d.\n", __func__, nxagentOption(Width), nxagentOption(Height)); #endif nxagentChangeScreenConfig(0, nxagentOption(Width), nxagentOption(Height)); } } return 1; } else { if ( (X -> xconfigure.window == DefaultRootWindow(nxagentDisplay)) || nxagentFullscreenWindow ) { #ifdef TEST fprintf(stderr, "%s: remote root window has changed: %d,%d %dx%d\n", __func__, X -> xconfigure.x, X -> xconfigure.y, X -> xconfigure.width, X -> xconfigure.height); #endif nxagentChangeOption(RootX, X -> xconfigure.x); nxagentChangeOption(RootY, X -> xconfigure.y); nxagentChangeOption(RootWidth, X -> xconfigure.width); nxagentChangeOption(RootHeight, X -> xconfigure.height); nxagentChangeScreenConfig(0, nxagentOption(Width), nxagentOption(Height)); return 1; } } } return 0; } int nxagentHandleReparentNotify(XEvent* X) { #ifdef TEST fprintf(stderr, "%s: Going to handle a new reparent event.\n", __func__); #endif if (nxagentOption(Rootless)) { WindowPtr pWin = nxagentWindowPtr(X -> xreparent.window); #ifdef TEST { WindowPtr pParent = nxagentWindowPtr(X -> xreparent.parent); WindowPtr pEvent = nxagentWindowPtr(X -> xreparent.event); fprintf(stderr, "%s: event %p[%lx] window %p[%lx] parent %p[%lx] at (%d, %d)\n", __func__, (void*)pEvent, X -> xreparent.event, (void*)pWin, X -> xreparent.window, (void*)pParent, X -> xreparent.parent, X -> xreparent.x, X -> xreparent.y); } #endif if (nxagentWindowTopLevel(pWin)) { /* * If the window manager reparents our top level window, we need * to know the new top level ancestor. */ XlibWindow w = None; XlibWindow root_return = 0; XlibWindow *children_return = NULL; unsigned int nchildren_return = 0; Status result; XlibWindow parent_return = X -> xreparent.parent; while (parent_return != RootWindow(nxagentDisplay, 0)) { w = parent_return; result = XQueryTree(nxagentDisplay, w, &root_return, &parent_return, &children_return, &nchildren_return); SAFE_XFree(children_return); if (!result) { #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed QueryTree request.\n", __func__); #endif break; } } if (w && !nxagentWindowPtr(w)) { XSelectInput(nxagentDisplay, w, StructureNotifyMask); nxagentRootlessAddTopLevelWindow(pWin, w); #ifdef TEST fprintf(stderr, "%s: new top level window [%ld].\n", __func__, w); fprintf(stderr, "%s: reparented window [%ld].\n", __func__, X -> xreparent.window); #endif result = XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), &root_return, &parent_return, &children_return, &nchildren_return); if (result) { nxagentRootlessRestack(children_return, nchildren_return); } else { #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed QueryTree request.\n", __func__); #endif } SAFE_XFree(children_return); } else { #ifdef TEST fprintf(stderr, "%s: Window at [%p] has been reparented to [%ld] top level parent [%ld].\n", __func__, (void *) pWin, X -> xreparent.parent, w); #endif nxagentRootlessDelTopLevelWindow(pWin); } } return 1; } else if (nxagentWMIsRunning && nxagentOption(Fullscreen) == 0 && nxagentOption(WMBorderWidth) == -1) { /* * Calculate the absolute upper-left X e Y */ XWindowAttributes attributes; if ((XGetWindowAttributes(nxagentDisplay, X -> xreparent.window, &attributes) == 0)) { #ifdef WARNING fprintf(stderr, "%s: WARNING! XGetWindowAttributes failed.\n", __func__); #endif return 1; } int x = attributes.x; int y = attributes.y; XlibWindow junk; XTranslateCoordinates(nxagentDisplay, X -> xreparent.window, attributes.root, -attributes.border_width, -attributes.border_width, &x, &y, &junk); /* * Calculate the parent X and parent Y. */ XlibWindow w = X -> xreparent.parent; if (w != DefaultRootWindow(nxagentDisplay)) { XlibWindow rootReturn = 0; XlibWindow parentReturn = 0; XlibWindow *childrenReturn = NULL; unsigned int nchildrenReturn = 0; do { Status result = XQueryTree(nxagentDisplay, w, &rootReturn, &parentReturn, &childrenReturn, &nchildrenReturn); SAFE_XFree(childrenReturn); if (parentReturn == rootReturn || parentReturn == 0 || result == 0) { break; } w = parentReturn; } while (True); /* * WM reparented. Find edge of the frame. */ if (XGetWindowAttributes(nxagentDisplay, w, &attributes) == 0) { #ifdef WARNING fprintf(stderr, "%s: WARNING! XGetWindowAttributes failed for parent window.\n", __func__); #endif return 1; } /* * Difference between Absolute X and Parent X gives thickness of side frame. * Difference between Absolute Y and Parent Y gives thickness of title bar. */ nxagentChangeOption(WMBorderWidth, (x - attributes.x)); nxagentChangeOption(WMTitleHeight, (y - attributes.y)); } } return 1; } /* * Helper for nxagent(Enable|Disable)(Keyboard|Pointer)Events */ static void nxagentSwitchEventsAllScreens(Mask mask, Bool enable) { Mask newmask = nxagentGetDefaultEventMask(); if (enable) newmask |= mask; else newmask &= ~mask; nxagentSetDefaultEventMask(newmask); for (int i = 0; i < nxagentNumScreens; i++) { XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], newmask); } } void nxagentEnableKeyboardEvents(void) { nxagentSwitchEventsAllScreens(NXAGENT_KEYBOARD_EVENT_MASK, True); XkbSelectEvents(nxagentDisplay, XkbUseCoreKbd, NXAGENT_KEYBOARD_EXTENSION_EVENT_MASK, NXAGENT_KEYBOARD_EXTENSION_EVENT_MASK); } void nxagentDisableKeyboardEvents(void) { nxagentSwitchEventsAllScreens(NXAGENT_KEYBOARD_EVENT_MASK, False); XkbSelectEvents(nxagentDisplay, XkbUseCoreKbd, 0x0, 0x0); } void nxagentEnablePointerEvents(void) { nxagentSwitchEventsAllScreens(NXAGENT_POINTER_EVENT_MASK, True); } void nxagentDisablePointerEvents(void) { nxagentSwitchEventsAllScreens(NXAGENT_POINTER_EVENT_MASK, False); } void nxagentSendFakeKey(int key) { Time now = GetTimeInMillis(); xEvent fake = {0}; fake.u.u.type = KeyPress; fake.u.u.detail = key; fake.u.keyButtonPointer.time = now; mieqEnqueue(&fake); fake.u.u.type = KeyRelease; fake.u.u.detail = key; fake.u.keyButtonPointer.time = now; mieqEnqueue(&fake); } int nxagentInitXkbKeyboardState(void) { XEvent X = {0}; XkbEvent *xkbev = (XkbEvent *) &X; if (nxagentXkbInfo.EventBase == -1) { return 1; } #ifdef TEST fprintf(stderr, "%s: Initializing XKB state.\n", __func__); #endif unsigned int modifiers; XkbGetIndicatorState(nxagentDisplay, XkbUseCoreKbd, &modifiers); xkbev -> state.locked_mods = 0x0; if (modifiers & CAPSFLAG_IN_REPLY) { xkbev -> state.locked_mods |= CAPSFLAG_IN_EVENT; } if (modifiers & NUMFLAG_IN_REPLY) { xkbev -> state.locked_mods |= NUMFLAG_IN_EVENT; } #ifdef TEST fprintf(stderr, "%s: Assuming XKB locked modifier bits [%x].\n", __func__, xkbev -> state.locked_mods); #endif xkbev -> type = nxagentXkbInfo.EventBase + XkbEventCode; xkbev -> any.xkb_type = XkbStateNotify; nxagentHandleXkbKeyboardStateEvent(&X); return 1; } int nxagentWaitForResource(GetResourceFuncPtr pGetResource, PredicateFuncPtr pPredicate) { int resource; while ((resource = (*pGetResource)(nxagentDisplay)) == -1) { if (nxagentWaitEvents(nxagentDisplay, 0) == -1) { return -1; } nxagentDispatchEvents(pPredicate); } return resource; } void nxagentGrabPointerAndKeyboard(XEvent *X) { #ifdef TEST fprintf(stderr, "%s: Grabbing pointer and keyboard with event at [%p].\n", __func__, (void *) X); #endif unsigned long now; if (X != NULL) { now = X -> xcrossing.time; } else { now = CurrentTime; } #ifdef TEST fprintf(stderr, "%s: Going to grab the keyboard in context [B1].\n", __func__); #endif int result = XGrabKeyboard(nxagentDisplay, nxagentFullscreenWindow ? nxagentFullscreenWindow : RootWindow(nxagentDisplay, DefaultScreen(nxagentDisplay)), True, GrabModeAsync, GrabModeAsync, now); if (result != GrabSuccess) { #ifdef DEBUG fprintf(stderr, "%s: keyboard grab failed.\n", __func__); #endif return; } #ifdef DEBUG else { fprintf(stderr, "%s: keyboard grab successful.\n", __func__); } #endif /* * The smart scheduler could be stopped while waiting for the * reply. In this case we need to yield explicitly to avoid to be * stuck in the dispatch loop forever. */ isItTimeToYield = 1; #ifdef TEST fprintf(stderr, "%s: Going to grab the pointer in context [B2].\n", __func__); #endif int resource = nxagentWaitForResource(NXGetCollectGrabPointerResource, nxagentCollectGrabPointerPredicate); if (nxagentFullscreenWindow) NXCollectGrabPointer(nxagentDisplay, resource, nxagentFullscreenWindow, True, NXAGENT_POINTER_EVENT_MASK, GrabModeAsync, GrabModeAsync, None, None, now); /* * This should not be needed. * * XGrabKey(nxagentDisplay, AnyKey, AnyModifier, nxagentFullscreenWindow, * True, GrabModeAsync, GrabModeAsync); */ if (X != NULL) { #ifdef TEST fprintf(stderr, "%s: Going to force focus in context [B4].\n", __func__); #endif XSetInputFocus(nxagentDisplay, nxagentFullscreenWindow, RevertToParent, now); } } void nxagentUngrabPointerAndKeyboard(XEvent *X) { unsigned long now; #ifdef TEST fprintf(stderr, "%s: Ungrabbing pointer and keyboard with event at [%p].\n", __func__, (void *) X); #endif if (X != NULL) { now = X -> xcrossing.time; } else { now = CurrentTime; } #ifdef TEST fprintf(stderr, "%s: Going to ungrab the keyboard in context [B5].\n", __func__); #endif XUngrabKeyboard(nxagentDisplay, now); #ifdef TEST fprintf(stderr, "%s: Going to ungrab the pointer in context [B6].\n", __func__); #endif XUngrabPointer(nxagentDisplay, now); } void nxagentDeactivatePointerGrab(void) { GrabPtr grab = inputInfo.pointer -> grab; if (grab) { XButtonEvent X = { .type = ButtonRelease, .serial = 0, .send_event = FALSE, .time = currentTime.milliseconds, .display = nxagentDisplay, .window = nxagentWindow(grab -> window), .root = RootWindow(nxagentDisplay, 0), .subwindow = 0, .x = 0, .y = 0, .x_root = 0, .y_root = 0, .state = 0x100, .button = 1, .same_screen = TRUE, }; XPutBackEvent(nxagentDisplay, (XEvent*)&X); } } Bool nxagentCollectGrabPointerPredicate(Display *disp, XEvent *X, XPointer ptr) { return (X -> xclient.window == 0 && X -> xclient.message_type == 0 && X -> xclient.format == 32 && X -> xclient.data.l[0] == NXCollectGrabPointerNotify); } void nxagentHandleCollectGrabPointerEvent(int resource) { int status; if (NXGetCollectedGrabPointer(nxagentDisplay, resource, &status) == 0) { #ifdef PANIC fprintf(stderr, "%s: PANIC! Failed to get GrabPointer reply for resource [%d].\n", __func__, resource); #endif } } void nxagentHandleCollectPropertyEvent(XEvent *X) { int resource = X -> xclient.data.l[1]; if (X -> xclient.data.l[2] == False) { #ifdef DEBUG fprintf (stderr, "%s: Failed to get reply data for client [%d].\n", __func__, resource); #endif return; } if (resource == nxagentLastClipboardClient) { nxagentCollectPropertyEvent(resource); } else { Atom atomReturnType; int resultFormat; unsigned long ulReturnItems; unsigned long ulReturnBytesLeft; unsigned char *pszReturnData = NULL; int result = NXGetCollectedProperty(nxagentDisplay, resource, &atomReturnType, &resultFormat, &ulReturnItems, &ulReturnBytesLeft, &pszReturnData); if (result == True) { Window window = nxagentPropertyRequests[resource].window; Atom property = nxagentPropertyRequests[resource].property; nxagentImportProperty(window, property, atomReturnType, resultFormat, ulReturnItems, ulReturnBytesLeft, pszReturnData); } else { #ifdef DEBUG fprintf (stderr, "%s: Failed to get reply data for client [%d].\n", __func__, resource); #endif } SAFE_XFree(pszReturnData); return; } } void nxagentSynchronizeExpose(void) { if (nxagentExposeQueue.length <= 0) { #ifdef TEST fprintf(stderr, "%s: PANIC! Called with nxagentExposeQueue.length [%d].\n", __func__, nxagentExposeQueue.length); #endif return; } WindowPtr pWin = nxagentExposeQueueHead.pWindow; if (pWin) { if ((nxagentExposeQueueHead.localRegion) != NullRegion) { RegionTranslate((nxagentExposeQueueHead.localRegion), pWin -> drawable.x, pWin -> drawable.y); } if ((nxagentExposeQueueHead.remoteRegion) != NullRegion) { RegionTranslate((nxagentExposeQueueHead.remoteRegion), pWin -> drawable.x, pWin -> drawable.y); } if ((nxagentExposeQueueHead.localRegion) != NullRegion && (nxagentExposeQueueHead.remoteRegion) != NullRegion) { RegionSubtract((nxagentExposeQueueHead.remoteRegion), (nxagentExposeQueueHead.remoteRegion), (nxagentExposeQueueHead.localRegion)); if (RegionNil(nxagentExposeQueueHead.remoteRegion) == 0 && ((pWin -> eventMask|wOtherEventMasks(pWin)) & ExposureMask)) { #ifdef TEST fprintf(stderr, "%s: Going to call miWindowExposures for window [%d] - rects [%d].\n", __func__, nxagentWindow(pWin), RegionNumRects(nxagentExposeQueueHead.remoteRegion)); #endif miWindowExposures(pWin, nxagentExposeQueueHead.remoteRegion, NullRegion); } } } nxagentExposeQueueHead.pWindow = NULL; if (nxagentExposeQueueHead.localRegion != NullRegion) { RegionDestroy(nxagentExposeQueueHead.localRegion); } nxagentExposeQueueHead.localRegion = NullRegion; if (nxagentExposeQueueHead.remoteRegion != NullRegion) { RegionDestroy(nxagentExposeQueueHead.remoteRegion); } nxagentExposeQueueHead.remoteRegion = NullRegion; nxagentExposeQueueHead.remoteRegionIsCompleted = False; nxagentExposeQueue.start = (nxagentExposeQueue.start + 1) % EXPOSED_SIZE; nxagentExposeQueue.length--; return; } int nxagentLookupByWindow(WindowPtr pWin) { for (int j = 0; j < nxagentExposeQueue.length; j++) { int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE; if (nxagentExposeQueue.exposures[i].pWindow == pWin && !nxagentExposeQueue.exposures[i].remoteRegionIsCompleted) { return i; } } return -1; } void nxagentRemoveDuplicatedKeys(XEvent *X) { _XQEvent *qelt = nxagentDisplay -> head; KeyCode lastKeycode = X -> xkey.keycode; if (qelt == NULL) { #ifdef TEST fprintf(stderr, "%s: Trying to read more events from the X server.\n", __func__); if (nxagentReadEvents(nxagentDisplay) > 0) { fprintf(stderr, "%s: Successfully read more events from the X server.\n", __func__); } #else nxagentReadEvents(nxagentDisplay); #endif qelt = nxagentDisplay -> head; } if (qelt != NULL) { _XQEvent *prev; _XQEvent *qeltKeyRelease; _XQEvent *prevKeyRelease; prev = qeltKeyRelease = prevKeyRelease = NULL; LockDisplay(nxagentDisplay); while (qelt != NULL) { if (qelt -> event.type == KeyRelease || qelt -> event.type == KeyPress) { if (qelt -> event.xkey.keycode != lastKeycode || (qelt -> event.type == KeyPress && qeltKeyRelease == NULL) || (qelt -> event.type == KeyRelease && qeltKeyRelease != NULL)) { break; } if (qelt -> event.type == KeyRelease) { prevKeyRelease = prev; qeltKeyRelease = qelt; } else if (qelt -> event.type == KeyPress) { _XDeq(nxagentDisplay, prev, qelt); qelt = prev -> next; if (prev == qeltKeyRelease) { prev = prevKeyRelease; } _XDeq(nxagentDisplay, prevKeyRelease, qeltKeyRelease); qeltKeyRelease = prevKeyRelease = NULL; continue; } } prev = qelt; qelt = qelt -> next; } UnlockDisplay(nxagentDisplay); } } void nxagentInitRemoteExposeRegion(void) { if (nxagentRemoteExposeRegion == NULL) { nxagentRemoteExposeRegion = RegionCreate(NULL, 1); if (nxagentRemoteExposeRegion == NULL) { #ifdef PANIC fprintf(stderr, "%s: PANIC! Failed to create expose region.\n", __func__); #endif } } } void nxagentForwardRemoteExpose(void) { if (RegionNotEmpty(nxagentRemoteExposeRegion)) { #ifdef DEBUG fprintf(stderr, "%s: Going to forward events.\n", __func__); #endif TraverseTree(screenInfo.screens[0]->root, nxagentClipAndSendExpose, (void *)nxagentRemoteExposeRegion); /* * Now this region should be empty. */ RegionEmpty(nxagentRemoteExposeRegion); } } void nxagentAddRectToRemoteExposeRegion(BoxPtr rect) { if (nxagentRemoteExposeRegion == NULL) { return; } RegionRec exposeRegion; RegionInit(&exposeRegion, rect, 1); RegionUnion(nxagentRemoteExposeRegion, nxagentRemoteExposeRegion, &exposeRegion); RegionUninit(&exposeRegion); } int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr) { RegionPtr remoteExposeRgn = (RegionRec *) ptr; #ifdef DEBUG fprintf(stderr, "%s: Called.\n", __func__); #endif if (pWin -> drawable.class != InputOnly) { RegionPtr exposeRgn = RegionCreate(NULL, 1); #ifdef DEBUG BoxRec box = *RegionExtents(remoteExposeRgn); fprintf(stderr, "%s: Root expose extents: [%d] [%d] [%d] [%d].\n", __func__, box.x1, box.y1, box.x2, box.y2); box = *RegionExtents(&pWin -> clipList); fprintf(stderr, "%s: Clip list extents for window at [%p]: [%d] [%d] [%d] [%d].\n", __func__, (void *)pWin, box.x1, box.y1, box.x2, box.y2); #endif RegionIntersect(exposeRgn, remoteExposeRgn, &pWin -> clipList); if (RegionNotEmpty(exposeRgn)) { #ifdef DEBUG fprintf(stderr, "%s: Forwarding expose to window at [%p] pWin.\n", __func__, (void *)pWin); #endif /* * The miWindowExposures() clears out the region parameters, so * the subtract ope- ration must be done before calling it. */ RegionSubtract(remoteExposeRgn, remoteExposeRgn, exposeRgn); miWindowExposures(pWin, exposeRgn, NullRegion); } RegionDestroy(exposeRgn); } if (RegionNotEmpty(remoteExposeRgn)) { #ifdef DEBUG fprintf(stderr, "%s: Region not empty. Walk children.\n", __func__); #endif return WT_WALKCHILDREN; } else { #ifdef DEBUG fprintf(stderr, "%s: Region empty. Stop walking.\n", __func__); #endif return WT_STOPWALKING; } } int nxagentUserInput(void *p) { int result = 0; /* * This function is used as callback in the polling handler of agent * in shadow mode. When inside the polling loop the handlers are * never called, so we have to dispatch enqueued events to * eventually change the nxagentInputEvent status. */ if (nxagentOption(Shadow) == 1 && nxagentPendingEvents(nxagentDisplay) > 0) { nxagentDispatchEvents(NULL); } if (nxagentInputEvent == 1) { nxagentInputEvent = 0; result = 1; } /* * The agent working in shadow mode synchronizes the remote X server * even if a button/key is not released (i.e. when scrolling a long * browser's page), in order to update the screen smoothly. */ if (nxagentOption(Shadow) == 1) { return result; } if (result == 0) { /* * If there is at least one button/key down, we are receiving an * input. This is not a condition to break a synchronization loop * if there is enough bandwidth. */ if (nxagentCongestion > 0 && (inputInfo.pointer -> button -> buttonsDown > 0 || nxagentKeyDown > 0)) { #ifdef TEST fprintf(stderr, "%s: Buttons [%d] Keys [%d].\n", __func__, inputInfo.pointer -> button -> buttonsDown, nxagentKeyDown); #endif result = 1; } } return result; } int nxagentHandleRRScreenChangeNotify(XEvent *X) { XRRScreenChangeNotifyEvent *Xr = (XRRScreenChangeNotifyEvent *) X; #ifdef DEBUG fprintf(stderr, "%s: Called.\n", __func__); #endif nxagentResizeScreen(screenInfo.screens[DefaultScreen(nxagentDisplay)], Xr -> width, Xr -> height, Xr -> mwidth, Xr -> mheight); nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], screenInfo.screens[0]->root, Xr -> width, Xr -> height); nxagentShadowSetWindowsSize(); return 1; } /* * Returns true if there is any event waiting to be dispatched. This * function is critical for the performance because it is called very, * very often. It must also handle the case when the display is * down. The display descriptor, in fact, may have been reused by some * other client. */ int nxagentPendingEvents(Display *dpy) { if (_XGetIOError(dpy) != 0) { #ifdef DEBUG fprintf(stderr, "%s: Returning error with display down.\n", __func__); #endif return -1; } else if (XQLength(dpy) > 0) { #ifdef DEBUG fprintf(stderr, "%s: Returning true with [%d] events queued.\n", __func__, XQLength(dpy)); #endif return 1; } else { int readable; if (NXTransReadable(dpy -> fd, &readable) == 0) { if (readable > 0) { #ifdef DEBUG fprintf(stderr, "%s: Returning true with [%d] bytes readable.\n", __func__, readable); #endif return 1; } #ifdef DEBUG fprintf(stderr, "%s: Returning false with [%d] bytes readable.\n", __func__, readable); #endif return 0; } #ifdef TEST fprintf(stderr, "%s: WARNING! Error detected on the X display.\n", __func__); #endif NXForceDisplayError(dpy); return -1; } } /* * Blocks until an event becomes available. */ int nxagentWaitEvents(Display *dpy, useconds_t msec) { #ifdef DEBUG fprintf(stderr, "%s: Called.\n", __func__); #endif NXFlushDisplay(dpy, NXFlushLink); /* * If the transport is not running we have to rely on Xlib to wait * for an event. In this case the timeout is ignored. */ if (NXTransRunning(NX_FD_ANY) == 1) { if (msec > 0) { struct timeval tm = { .tv_sec = 0, .tv_usec = msec * 1000 }; NXTransContinue(&tm); } else { NXTransContinue(NULL); } } else { XEvent ev; XPeekEvent(dpy, &ev); } /* * Check if we encountered a display error. If we did, wait for the * time requested by the caller. */ if (NXDisplayError(dpy) == 1) { if (msec > 0) { usleep(msec * 1000); } return -1; } return 1; } #ifdef NX_DEBUG_INPUT void nxagentGuessDumpInputInfo(ClientPtr client, Atom property, char *data) { if (strcmp(validateString(NameForAtom(property)), "NX_DEBUG_INPUT") == 0) { if (*data != 0) { nxagentDebugInput = 1; } else { nxagentDebugInput = 0; } } } void nxagentDeactivateInputDevicesGrabs(void) { fprintf(stderr, "Info: Deactivating input devices grabs.\n"); if (inputInfo.pointer -> grab) { (*inputInfo.pointer -> DeactivateGrab)(inputInfo.pointer); } if (inputInfo.keyboard -> grab) { (*inputInfo.keyboard -> DeactivateGrab)(inputInfo.keyboard); } } static const char *nxagentGrabStateToString(int state) { switch (state) { case 0: return "NOT_GRABBED"; case 1: return "THAWED"; case 2: return "THAWED_BOTH"; case 3: return "FREEZE_NEXT_EVENT"; case 4: return "FREEZE_BOTH_NEXT_EVENT"; case 5: return "FROZEN_NO_EVENT"; case 6: return "FROZEN_WITH_EVENT"; case 7: return "THAW_OTHERS"; default: return "unknown state"; } } void nxagentDumpInputDevicesState(void) { WindowPtr pWin = NULL; fprintf(stderr, "\n*** Dump input devices state: BEGIN ***" "\nKeys down:"); DeviceIntPtr dev = inputInfo.keyboard; for (int i = 0; i < DOWN_LENGTH; i++) { CARD8 val = dev -> key -> down[i]; if (val != 0) { for (int k = 0; k < 8; k++) { if (val & (1 << k)) { fprintf(stderr, "\n\t[%d] [%s]", i * 8 + k, XKeysymToString(XKeycodeToKeysym(nxagentDisplay, i * 8 + k, 0))); } } } } fprintf(stderr, "\nKeyboard device state: \n\tdevice [%p]\n\tlast grab time [%u]" "\n\tfrozen [%s]\n\tstate [%s]\n\tother [%p]\n\tevent count [%d]" "\n\tfrom passive grab [%s]\n\tactivating key [%d]", (void *)dev, dev -> grabTime.milliseconds, dev -> sync.frozen ? "Yes": "No", nxagentGrabStateToString(dev -> sync.state), (void *)dev -> sync.other, dev -> sync.evcount, dev -> fromPassiveGrab ? "Yes" : "No", dev -> activatingKey); GrabPtr grab = dev -> grab; if (grab) { fprintf(stderr, "\nKeyboard grab state: \n\twindow pointer [%p]" "\n\towner events flag [%s]\n\tgrab mode [%s]", (void *)grab -> window, grab -> ownerEvents ? "True" : "False", grab -> keyboardMode ? "asynchronous" : "synchronous"); /* * Passive grabs. */ pWin = grab -> window; grab = wPassiveGrabs(pWin); while (grab) { fprintf(stderr, "\nPassive grab state: \n\tdevice [%p]\n\towner events flag [%s]" "\n\tpointer grab mode [%s]\n\tkeyboard grab mode [%s]\n\tevent type [%d]" "\n\tmodifiers [%x]\n\tbutton/key [%u]\n\tevent mask [%x]", (void *)grab -> device, grab -> ownerEvents ? "True" : "False", grab -> pointerMode ? "asynchronous" : "synchronous", grab -> keyboardMode ? "asynchronous" : "synchronous", grab -> type, grab -> modifiersDetail.exact, grab -> detail.exact, grab -> eventMask); grab = grab -> next; } } fprintf(stderr, "\nButtons down:"); dev = inputInfo.pointer; for (int i = 0; i < DOWN_LENGTH; i++) { CARD8 val = dev -> button -> down[i]; if (val != 0) { for (int k = 0; k < 8; k++) { if (val & (1 << k)) { fprintf(stderr, "\n\t[%d]", i * 8 + k); } } } } fprintf(stderr, "\nPointer device state: \n\tdevice [%p]\n\tlast grab time [%u]" "\n\tfrozen [%s]\n\tstate [%s]\n\tother [%p]\n\tevent count [%d]" "\n\tfrom passive grab [%s]\n\tactivating button [%d]", (void *)dev, dev -> grabTime.milliseconds, dev -> sync.frozen ? "Yes" : "No", nxagentGrabStateToString(dev -> sync.state), (void *)dev -> sync.other, dev -> sync.evcount, dev -> fromPassiveGrab ? "Yes" : "No", dev -> activatingKey); grab = dev -> grab; if (grab) { fprintf(stderr, "\nPointer grab state: \n\twindow pointer [%p]" "\n\towner events flag [%s]\n\tgrab mode [%s]", (void *)grab -> window, grab -> ownerEvents ? "True" : "False", grab -> pointerMode ? "asynchronous" : "synchronous"); if (grab -> window != pWin) { /* * Passive grabs. */ grab = wPassiveGrabs(grab -> window); while (grab) { fprintf(stderr, "\nPassive grab state: \n\tdevice [%p]\n\towner events flag [%s]" "\n\tpointer grab mode [%s]\n\tkeyboard grab mode [%s]\n\tevent type [%d]" "\n\tmodifiers [%x]\n\tbutton/key [%u]\n\tevent mask [%x]", (void *)grab -> device, grab -> ownerEvents ? "True" : "False", grab -> pointerMode ? "asynchronous" : "synchronous", grab -> keyboardMode ? "asynchronous" : "synchronous", grab -> type, grab -> modifiersDetail.exact, grab -> detail.exact, grab -> eventMask); grab = grab -> next; } } } fprintf(stderr, "\n*** Dump input devices state: FINISH ***\n"); } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Events.h0000644000000000000000000001513313614532331020275 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Events_H__ #define __Events_H__ #include #define ProcessedExpose (LASTEvent + 1) #define ProcessedNotify (LASTEvent + 2) #define EXPOSED_SIZE 256 enum HandleEventResult { doNothing = 0, doMinimize, doDebugTree, doCloseSession, doSwitchFullscreen, doSwitchAllScreens, doViewportMoveUp, doViewportMoveLeft, doViewportMoveRight, doViewportMoveDown, doViewportLeft, doViewportUp, doViewportRight, doViewportDown, doSwitchResizeMode, doSwitchDeferMode, doAutoGrab, }; extern CARD32 nxagentLastEventTime; /* * Manage incoming events. */ typedef Bool (*PredicateFuncPtr)(Display*, XEvent*, XPointer); extern void nxagentDispatchEvents(PredicateFuncPtr); typedef int (*GetResourceFuncPtr)(Display*); int nxagentWaitForResource(GetResourceFuncPtr, PredicateFuncPtr); Bool nxagentCollectGrabPointerPredicate(Display *disp, XEvent *X, XPointer ptr); int nxagentInputEventPredicate(Display *disp, XEvent *event, XPointer parameter); /* * Enable and disable notification of * remote X server events. */ extern void nxagentEnableKeyboardEvents(void); extern void nxagentEnablePointerEvents(void); extern void nxagentDisableKeyboardEvents(void); extern void nxagentDisablePointerEvents(void); /* * Manage default event mask. */ extern void nxagentInitDefaultEventMask(void); extern Mask nxagentGetDefaultEventMask(void); extern void nxagentSetDefaultEventMask(Mask mask); extern Mask nxagentGetEventMask(WindowPtr pWin); /* * Bring keyboard device in known state. It needs * a round-trip so it only gets called if a pre- * vious XKB event did not implicitly initialized * the internal state. This is unlikely to happen. */ extern int nxagentInitXkbKeyboardState(void); /* * Update the keyboard state according * to focus and XKB events received * from the remote X server. */ extern int nxagentHandleXkbKeyboardStateEvent(XEvent *X); /* * Handle sync and karma messages and * other notification event coming * from proxy. */ extern int nxagentHandleProxyEvent(XEvent *X); /* * Other functions providing the ad-hoc * handling of the remote X events. */ extern int nxagentHandleExposeEvent(XEvent *X); extern int nxagentHandleGraphicsExposeEvent(XEvent *X); extern int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult*); extern int nxagentHandlePropertyNotify(XEvent *X); extern int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult*); extern int nxagentHandleReparentNotify(XEvent *X); extern int nxagentHandleConfigureNotify(XEvent *X); extern int nxagentHandleXFixesSelectionNotify(XEvent *X); /* * Send a fake keystroke to the remote * X server. */ extern void nxagentSendFakeKey(int key); /* * Called to manage grab of pointer and * keyboard when running in fullscreen * mode. */ extern void nxagentGrabPointerAndKeyboard(XEvent *X); extern void nxagentUngrabPointerAndKeyboard(XEvent *X); extern void nxagentDeactivatePointerGrab(void); /* * Handle the selection property received * in the event loop. */ void nxagentCollectPropertyEvent(int resource); /* * Synchronize expose events between agent and * the real X server. */ typedef struct _ExposuresRec { WindowPtr pWindow; RegionPtr localRegion; RegionPtr remoteRegion; Bool remoteRegionIsCompleted; int serial; int synchronize; } ExposuresRec; extern RegionPtr nxagentRemoteExposeRegion; typedef struct _ExposeQueue { unsigned int start; int length; ExposuresRec exposures[EXPOSED_SIZE]; } ExposeQueue; extern void nxagentSynchronizeExpose(void); extern int nxagentLookupByWindow(WindowPtr pWin); extern void nxagentUpdateExposeArray(void); extern ExposeQueue nxagentExposeQueue; /* * Handle the split related notifications. */ int nxagentWaitSplitEvent(int resource); void nxagentHandleNoSplitEvent(int resource); void nxagentHandleStartSplitEvent(int resource); void nxagentHandleCommitSplitEvent(int resource, int request, int position); void nxagentHandleEndSplitEvent(int resource); void nxagentHandleEmptySplitEvent(void); void nxagentInitRemoteExposeRegion(void); void nxagentAddRectToRemoteExposeRegion(BoxPtr); extern int nxagentUserInput(void *p); /* * We have to check these before launching the terminate * dialog in rootless mode. */ extern Bool nxagentLastWindowDestroyed; extern Time nxagentLastWindowDestroyedTime; /* * Set this flag if an user input event is received. */ extern int nxagentInputEvent; /* * Event-handling utilities. */ Bool nxagentPendingEvents(Display *dpy); #define nxagentQueuedEvents(display) \ XQLength((display)) #define nxagentReadEvents(display) \ XEventsQueued((display), QueuedAfterReading) #define nxagentCheckEvents(display, event, predicate, argument) \ XCheckIfEventNoFlush((display), (event), (predicate), (argument)) int nxagentWaitEvents(Display *, useconds_t msec); #endif /* __Events_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Extensions.c0000644000000000000000000003150213614532331021161 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "micmap.h" #include "scrnintstr.h" #include "../../randr/randrstr.h" #include "Agent.h" #include "Display.h" #include "Screen.h" #include "Options.h" #include "Extensions.h" #include "Windows.h" void GlxExtensionInit(void); void GlxWrapInitVisuals(void *procPtr); static int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight); static int nxagentRandRInitSizes(ScreenPtr pScreen); #if RANDR_14_INTERFACE static Bool nxagentRandRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable); #endif #if RANDR_13_INTERFACE static Bool nxagentRandROutputGetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property); static Bool nxagentRandRGetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea, BoxPtr trackingArea, INT16 *border); static Bool nxagentRandRSetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea, BoxPtr trackingArea, INT16 *border); #endif #if RANDR_12_INTERFACE static Bool nxagentRandRCrtcSet (ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode, int x, int y, Rotation rotation, int numOutputs, RROutputPtr *outputs); #endif #ifdef __DARWIN__ void DarwinHandleGUI(int argc, char *argv[]) { } void DarwinGlxExtensionInit(void) { GlxExtensionInit(); } void DarwinGlxWrapInitVisuals(void *procPtr) { GlxWrapInitVisuals(procPtr); } #endif void nxagentInitGlxExtension(VisualPtr *visuals, DepthPtr *depths, int *numVisuals, int *numDepths, int *rootDepth, VisualID *defaultVisual) { /* * Initialize the visuals to use the GLX extension. */ miInitVisualsProcPtr initVisuals = NULL; GlxWrapInitVisuals(&initVisuals); if (initVisuals(visuals, depths, numVisuals, numDepths, rootDepth, defaultVisual, 0, 0, 0) == 0) { fprintf(stderr, "Warning: Failed to initialize the GLX extension.\n"); } } void nxagentInitRandRExtension(ScreenPtr pScreen) { rrScrPrivPtr pRandRScrPriv; if (RRScreenInit(pScreen) == 0) { fprintf(stderr, "Warning: Failed to initialize the RandR extension.\n"); } /* FIXME: do we need this at all with the new rand/xinerama stuff? */ nxagentRandRInitSizes(pScreen); /* * RRScreenInit sets these pointers to NULL, * so requiring the server to set up its own * replacements. */ pRandRScrPriv = rrGetScrPriv(pScreen); pRandRScrPriv -> rrGetInfo = nxagentRandRGetInfo; #if RANDR_15_INTERFACE /* nothing to be assigned here, so far */ #endif #if RANDR_14_INTERFACE /* no pixmap sharing in nx-X11 */ pScreen->ReplaceScanoutPixmap = nxagentRandRReplaceScanoutPixmap; pRandRScrPriv -> rrCrtcSetScanoutPixmap = NULL; /* only fake provider support in nx-X11, so far */ pRandRScrPriv -> provider = RRProviderCreate(pScreen, "default", 7); pRandRScrPriv -> rrProviderSetOutputSource = NULL; pRandRScrPriv -> rrProviderSetOffloadSink = NULL; pRandRScrPriv -> rrProviderGetProperty = NULL; pRandRScrPriv -> rrProviderSetProperty = NULL; #endif #if RANDR_13_INTERFACE pRandRScrPriv -> rrOutputGetProperty = nxagentRandROutputGetProperty; pRandRScrPriv -> rrGetPanning = nxagentRandRGetPanning; pRandRScrPriv -> rrSetPanning = nxagentRandRSetPanning; #endif #if RANDR_12_INTERFACE pRandRScrPriv -> rrScreenSetSize = nxagentRandRScreenSetSize; pRandRScrPriv -> rrCrtcSet = nxagentRandRCrtcSet; #endif #if RANDR_10_INTERFACE pRandRScrPriv -> rrSetConfig = nxagentRandRSetConfig; #endif } #if RANDR_14_INTERFACE static Bool nxagentRandRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable) { /* FALSE means: not supported */ #ifdef DEBUG fprintf(stderr, "nxagentRandRReplaceScanoutPixmap: NX's RANDR does not support scan-out pixmaps.\n"); #endif return FALSE; } #endif #if RANDR_13_INTERFACE static Bool nxagentRandROutputGetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property) { /* FALSE means: no property required to be modified on the fly here */ return FALSE; } static Bool nxagentRandRGetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea, BoxPtr trackingArea, INT16 *border) { /* FALSE means: no, panning is not supported at the moment... * Panning requires several modes to be available for * the NX output(s). * * FIXME: Add more modes per output than the current window size. * At least when in fullscreen mode. */ #ifdef DEBUG fprintf(stderr, "nxagentRandRGetPanning: RANDR Panning is currently not supported.\n"); #endif return FALSE; } static Bool nxagentRandRSetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea, BoxPtr trackingArea, INT16 *border) { /* FALSE means: no, panning is not supported at the moment... * Panning requires several modes to be available for * the NX output(s). * * FIXME: Add more modes per output than the current window size. * At least when in fullscreen mode. */ #ifdef DEBUG fprintf(stderr, "nxagentRandRSetPanning: RANDR Panning is currently not supported.\n"); #endif return FALSE; } #endif #if RANDR_12_INTERFACE /* * Request that the Crtc be reconfigured */ static Bool nxagentRandRCrtcSet (ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode, int x, int y, Rotation rotation, int numOutputs, RROutputPtr *outputs) { return RRCrtcNotify(crtc, mode, x, y, rotation, NULL, numOutputs, outputs); } #endif int nxagentRandRGetInfo(ScreenPtr pScreen, Rotation *pRotations) { /* * Rotation is not supported. */ *pRotations = RR_Rotate_0; return 1; } static int nxagentRandRInitSizes(ScreenPtr pScreen) { const int refresh_rate = 60; RRScreenSizePtr pSize = NULL; /* Index[0]: default size Index[nsizes-1]: current size Index[nsizes-2]: max size */ /* int w[] = {0, 160, 320, 640, 800, 1024, 1152, 1280, 1280, 1280, 1280, 1280, 1280, 1360, 1440, 1600, 1600, 1680, 1920, 1920, 0, 0}; int h[] = {0, 120, 240, 480, 600, 768, 864, 600, 720, 800, 854, 960, 1024, 768, 900, 900, 1200, 1050, 1080, 1200, 0, 0}; */ int w[] = {0, 320, 640, 640, 800, 800, 1024, 1024, 1152, 1280, 1280, 1280, 1360, 1440, 1600, 1600, 1680, 1920, 1920, 0, 0}; int h[] = {0, 240, 360, 480, 480, 600, 600, 768, 864, 720, 800, 1024, 768, 900, 900, 1200, 1050, 1080, 1200, 0, 0}; int maxWidth = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); int maxHeight = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); int nSizes = sizeof w / sizeof(int); /* * Add current and max sizes. */ w[nSizes - 1] = pScreen -> width; h[nSizes - 1] = pScreen -> height; w[nSizes - 2] = maxWidth; h[nSizes - 2] = maxHeight; /* * Compute default size. */ w[0] = w[1]; h[0] = h[1]; for (int i = 2; i < nSizes - 1; i++) { if ((w[i] <= maxWidth * 3 / 4) && (h[i] <= maxHeight * 3 / 4) && (w[i] >= w[0]) && (h[i] >= h[0])) { w[0] = w[i]; h[0] = h[i]; } } /* * Register all the supported sizes at a fixed refresh rate. */ for (int i = 0; i < nSizes; i++) { int mmWidth, mmHeight; if (monitorResolution < 0) { mmWidth = w[i] * DisplayWidthMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) / DisplayWidth(nxagentDisplay, DefaultScreen(nxagentDisplay)); mmHeight = h[i] * DisplayHeightMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) / DisplayHeight(nxagentDisplay, DefaultScreen(nxagentDisplay)); } else { mmWidth = (w[i] * 254 + monitorResolution * 5) / (monitorResolution * 10); mmHeight = (h[i] * 254 + monitorResolution * 5) / (monitorResolution * 10); } pSize = RRRegisterSize(pScreen, w[i], h[i], mmWidth < 1 ? 1 : mmWidth, mmHeight < 1 ? 1 : mmHeight); if (pSize == NULL) { return 0; } RRRegisterRate (pScreen, pSize, refresh_rate); } /* * the last registered size should be the current size */ if (pSize) { RRSetCurrentConfig(pScreen, RR_Rotate_0, refresh_rate, pSize); } return 1; } #if RANDR_10_INTERFACE int nxagentRandRSetConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { UpdateCurrentTime(); /* * Whatever size is OK for us. */ int r = nxagentResizeScreen(pScreen, pSize -> width, pSize -> height, pSize -> mmWidth, pSize -> mmHeight); nxagentMoveViewport(pScreen, 0, 0); return r; } #endif #if RANDR_12_INTERFACE void nxagentRandRSetWindowsSize(int width, int height) { if (width == 0) { if (nxagentOption(Fullscreen) == 1) { width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); } else { width = nxagentOption(Width); } } if (height == 0) { if (nxagentOption(Fullscreen) == 1) { height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); } else { height = nxagentOption(Height); } } XResizeWindow(nxagentDisplay, nxagentDefaultWindows[0], width, height); if (nxagentOption(Rootless) == 0) { XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, width, height); } } int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight) { UpdateCurrentTime(); if (nxagentOption(DesktopResize) == 1 && (nxagentOption(Fullscreen) == 1 || width > WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) || height > HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)))) { if (nxagentOption(ClientOs) != ClientOsWinnt /*&& nxagentOption(ClientOs) != ClientNXPlayer*/) { nxagentChangeOption(DesktopResize, 0); } } if (nxagentOption(DesktopResize) == 1 && nxagentOption(Fullscreen) == 0 && nxagentOption(AllScreens) == 0) { nxagentChangeOption(Width, width); nxagentChangeOption(Height, height); } int result = nxagentResizeScreen(pScreen, width, height, mmWidth, mmHeight); if (result == 1 && nxagentOption(DesktopResize) == 1 && nxagentOption(Fullscreen) == 0 && nxagentOption(AllScreens) == 0) { nxagentRandRSetWindowsSize(width, height); nxagentSetWMNormalHints(pScreen -> myNum, nxagentOption(Width), nxagentOption(Height)); } nxagentMoveViewport(pScreen, 0, 0); return result; } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Extensions.h0000644000000000000000000000455113614532331021172 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Initialize the additional extensions. */ void nxagentInitGlxExtension(VisualPtr *visuals, DepthPtr *depths, int *numVisuals, int *numDepths, int *rootDepth, VisualID *defaultVisual); void nxagentInitRandRExtension(ScreenPtr pScreen); /* * Basic interface to the RandR extension. */ int nxagentRandRGetInfo(ScreenPtr pScreen, Rotation *pRotations); int nxagentRandRSetConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize); nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Font.c0000644000000000000000000013103613614532331017733 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #include "scrnintstr.h" #include "dixstruct.h" #include #include #include "dixfontstr.h" #include "misc.h" #include "miscstruct.h" #include "opaque.h" #include "Agent.h" #include "Display.h" #include "Font.h" #include "Error.h" #include #include #include "resource.h" #include "Reconnect.h" #include "Args.h" #include "Utils.h" #include "compext/Compext.h" #include #include #include #define PANIC #define WARNING #undef TEST #undef DEBUG const char * nxagentFontDirs[] = { SYSTEMFONTDIR, "/usr/share/nx/fonts", "/usr/share/X11/fonts", "/usr/share/fonts/X11", "/usr/X11R6/lib/X11/fonts", NULL }; const char * nxagentFontSubdirs[] = { "Type1", "75dpi", "100dpi", "TTF", NULL }; #undef NXAGENT_FONTCACHE_DEBUG #undef NXAGENT_RECONNECT_FONT_DEBUG #undef NXAGENT_FONTMATCH_DEBUG #define FIELDS 14 static int reconnectFlexibility; static void nxagentCleanCacheAfterReconnect(void); static void nxagentFontReconnect(FontPtr, XID, void *); static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontPtr pFont); static XFontStruct *nxagentLoadQueryFont(register Display *dpy , char *fontName , FontPtr pFont); int nxagentFreeFont(XFontStruct *fs); static Bool nxagentGetFontServerPath(char * fontServerPath, int size); static char * nxagentMakeScalableFontName(const char *fontName, int scalableResolution); RESTYPE RT_NX_FONT; #ifdef NXAGENT_RECONNECT_FONT_DEBUG static void printFontCacheDump(char*); #endif typedef struct _nxagentFontRec { char *name; int status; } nxagentFontRec, *nxagentFontRecPtr; typedef struct _nxagentFontList { nxagentFontRecPtr *list; int length; int listSize; } nxagentFontList, *nxagentFontListPtr; nxagentFontList nxagentRemoteFontList = {NULL, (int)0, (int)0}; int nxagentFontPrivateIndex; typedef struct _nxCacheFontEntry { Atom atom; XFontStruct *font_struct; char *name; } nxCacheFontEntryRec, *nxCacheFontEntryRecPtr; static struct _nxagentFontCache { nxCacheFontEntryRecPtr *entry; int index; int size; } nxagentFontCache = { NULL, (int) 0, (int) 0 }; #define CACHE_ENTRY_PTR (nxagentFontCache.entry) #define CACHE_INDEX (nxagentFontCache.index) #define CACHE_SIZE (nxagentFontCache.size) #define CACHE_ENTRY(A) (CACHE_ENTRY_PTR[A]) #define CACHE_FSTRUCT(A) (CACHE_ENTRY(A) -> font_struct) #define CACHE_NAME(A) (CACHE_ENTRY(A) -> name) #define CACHE_ATOM(A) (CACHE_ENTRY(A) -> atom) static struct _nxagentFailedToReconnectFonts { FontPtr *font; XID *id; int size; int index; } nxagentFailedToReconnectFonts = {NULL, NULL, 0, 0}; /* * This is used if nxagentFullGeneration is true in CloseDisplay(). */ void nxagentFreeFontCache(void) { #ifdef NXAGENT_FONTCACHE_DEBUG fprintf(stderr, "Font: Freeing nxagent font cache\n"); #endif if (CACHE_INDEX == 0) return; #ifdef NXAGENT_FONTCACHE_DEBUG fprintf(stderr, "Font: Freeing nxagent font cache, there are [%d] entries.\n", CACHE_INDEX); #endif for (int i = 0; i < CACHE_INDEX; i++) { #ifdef NXAGENT_FONTCACHE_DEBUG fprintf(stderr, "Font: Freeing nxagent font cache entry [%d] entry pointer is [%p], name [%s]\n", i, CACHE_ENTRY(i), CACHE_NAME(i)); #endif if (CACHE_FSTRUCT(i)) { nxagentFreeFont(CACHE_FSTRUCT(i)); } SAFE_free(CACHE_NAME(i)); SAFE_free(CACHE_ENTRY(i)); } SAFE_free(CACHE_ENTRY_PTR); CACHE_ENTRY_PTR = NULL; CACHE_INDEX = 0; CACHE_SIZE = 0; #ifdef NXAGENT_FONTCACHE_DEBUG fprintf(stderr, "Font: nxagent font cache fully freed\n"); #endif return; } void nxagentListRemoteFonts(const char *searchPattern, const int maxNames) { char **xList; int xLen = 0; const char *patterns[] = {"*", "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"}; int patternsQt = 2; if (NXDisplayError(nxagentDisplay) == 1) { return; } /* * Avoid querying again the remote fonts. */ if (nxagentRemoteFontList.length > 0) { return; } /* * We can't retrieve the full remote font list with a single query, * because the number of dashes in the pattern acts as a rule to * select how to search for the font names, so the pattern '*' is * useful to retrieve the font aliases, while the other one will * select the 'real' fonts. */ for (int p = 0; p < patternsQt; p++) { xList = XListFonts(nxagentDisplay, patterns[p], maxNames, &xLen); #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "nxagentListRemoteFonts: NXagent remote list [%s] has %d elements.\n", patterns[p], xLen); #endif /* * Add the ListFont request pattern to the list with the last * requested maxnames. */ nxagentListRemoteAddName(searchPattern, maxNames); for (int i = 0; i < xLen; i++) { nxagentListRemoteAddName(xList[i], 1); } XFreeFontNames(xList); } #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "nxagentListRemoteFonts: Printing remote font list.\n"); for (int i = 0; i < nxagentRemoteFontList.length; i++) { fprintf(stderr, "Font# %d, \"%s\"\n", i, nxagentRemoteFontList.list[i]->name); } fprintf(stderr, "nxagentListRemoteFonts: End of list\n"); #endif } void nxagentListRemoteAddName(const char *name, int status) { int pos; if (nxagentFontFind(name, &pos)) { if (nxagentRemoteFontList.list[pos]->status < status) { nxagentRemoteFontList.list[pos]->status = status; #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "Font: Font# %d, [%s] change status to %s\n", pos, nxagentRemoteFontList.list[pos]->name,nxagentRemoteFontList.list[pos]->status?"OK":"deleted"); #endif } return; } if (nxagentRemoteFontList.length == nxagentRemoteFontList.listSize) { nxagentRemoteFontList.list = realloc(nxagentRemoteFontList.list, sizeof(nxagentFontRecPtr) * (nxagentRemoteFontList.listSize + 1000)); if (nxagentRemoteFontList.list == NULL) { FatalError("Font: remote list memory re-allocation failed!.\n"); } nxagentRemoteFontList.listSize += 1000; } if (pos < nxagentRemoteFontList.length) { #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "Font: Going to move list from %p to %p len = %d!.\n", &nxagentRemoteFontList.list[pos], &nxagentRemoteFontList.list[pos+1], (nxagentRemoteFontList.length - pos) * sizeof(nxagentFontRecPtr)); #endif memmove(&nxagentRemoteFontList.list[pos+1], &nxagentRemoteFontList.list[pos], (nxagentRemoteFontList.length - pos) * sizeof(nxagentFontRecPtr)); } if ((nxagentRemoteFontList.list[pos] = malloc(sizeof(nxagentFontRec)))) { nxagentRemoteFontList.list[pos]->name = strdup(name); if (nxagentRemoteFontList.list[pos]->name == NULL) { fprintf(stderr, "Font: remote list name memory allocation failed!.\n"); SAFE_free(nxagentRemoteFontList.list[pos]); return; } } else { fprintf(stderr, "Font: remote list record memory allocation failed!.\n"); return; } nxagentRemoteFontList.list[pos]->status = status; nxagentRemoteFontList.length++; #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "Font: remote font list added [%s] in position [%d] as %s !.\n", name, pos, status ? "OK" : "deleted"); fprintf(stderr, "Font: remote font list total len is [%d] Size is [%d] !.\n", nxagentRemoteFontList.length, nxagentRemoteFontList.listSize); #endif } static void nxagentFreeRemoteFontList(nxagentFontList *listRec) { for (int l = 0; l < listRec -> length; l++) { if (listRec -> list[l]) { SAFE_free(listRec -> list[l] -> name); SAFE_free(listRec -> list[l]); } } listRec -> length = listRec -> listSize = 0; SAFE_free(listRec -> list); return; } Bool nxagentFontFind(const char *name, int *pos) { if (!nxagentRemoteFontList.length) { *pos=0; return False; } int low = 0; int high = nxagentRemoteFontList.length - 1; int iter = 0; int res = 1; int lpos = nxagentRemoteFontList.length; while (low <= high) { *pos = (high + low)/2; iter ++; res = strcasecmp(nxagentRemoteFontList.list[*pos]->name,name); if (res > 0) { high = *pos - 1; lpos = *pos; continue; } else if (res < 0) { low = *pos + 1; lpos = low; continue; } break; } *pos = (res == 0)?*pos:lpos; #ifdef NXAGENT_FONTMATCH_DEBUG if (res == 0) fprintf(stderr, "Font: font found in %d iterations in pos = %d\n", iter, *pos); else fprintf(stderr, "Font: not font found in %d iterations insertion pos is = %d\n", iter, *pos); #endif return (res == 0); } Bool nxagentFontLookUp(const char *name) { int i; if (name != NULL && strlen(name) == 0) { return 0; } int result = nxagentFontFind(name, &i); char *scalable = NULL; /* * Let's try with the scalable font description. */ if (result == 0) { if ((scalable = nxagentMakeScalableFontName(name, 0)) != NULL) { result = nxagentFontFind(scalable, &i); SAFE_free(scalable); } } /* * Let's try again after replacing zero to xdpi and ydpi in the pattern. */ if (result == 0) { if ((scalable = nxagentMakeScalableFontName(name, 1)) != NULL) { result = nxagentFontFind(scalable, &i); SAFE_free(scalable); } } if (result == 0) { return 0; } else { return (nxagentRemoteFontList.list[i]->status > 0); } } Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont) { void * priv; Atom name_atom, value_atom; int nprops; FontPropPtr props; int i; const char *name; char *origName = (char*) pScreen; #ifdef HAS_XFONT2 xfont2_font_set_private(pFont, nxagentFontPrivateIndex, NULL); #else FontSetPrivate(pFont, nxagentFontPrivateIndex, NULL); #endif /* HAS_XFONT2 */ name_atom = MakeAtom("FONT", 4, True); value_atom = 0L; nprops = pFont->info.nprops; props = pFont->info.props; for (i = 0; i < nprops; i++) if ((Atom)props[i].name == name_atom) { value_atom = props[i].value; break; } if (!value_atom) return False; name = NameForAtom(value_atom); #ifdef NXAGENT_FONTCACHE_DEBUG fprintf(stderr, "Font: nxagentRealizeFont, realizing font: %s\n", validateString(name)); fprintf(stderr, " atom: %ld\n", value_atom); fprintf(stderr, "Font: Cache dump:\n"); for (i = 0; i < CACHE_INDEX; i++) { fprintf(stderr, "nxagentFontCache.entry[%d]->name: %s font_struct at %p\n", i, CACHE_NAME(i), CACHE_FSTRUCT(i)); } #endif if (!name) return False; if ((strcasecmp(origName, name) != 0) && !strchr(origName,'*')) { #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "Font: Changing font name to realize from [%s] to [%s]\n", validateString(name), origName); #endif name = origName; } priv = (void *)malloc(sizeof(nxagentPrivFont)); #ifdef HAS_XFONT2 xfont2_font_set_private(pFont, nxagentFontPrivateIndex, priv); #else FontSetPrivate(pFont, nxagentFontPrivateIndex, priv); #endif /* HAS_XFONT2 */ nxagentFontPriv(pFont) -> mirrorID = 0; for (i = 0; i < nxagentFontCache.index; i++) { /* if (value_atom == CACHE_ATOM(i))*/ if (strcasecmp(CACHE_NAME(i), name) == 0) { #ifdef NXAGENT_FONTCACHE_DEBUG fprintf(stderr, "Font: nxagentFontCache hit [%s] = [%s]!\n", CACHE_NAME(i), validateString(name)); #endif break; } } if (i < CACHE_INDEX) { nxagentFontPriv(pFont)->font_struct = CACHE_FSTRUCT(i); strcpy(nxagentFontPriv(pFont)->fontName, name); } else { #ifdef NXAGENT_FONTCACHE_DEBUG fprintf(stderr, "Font: nxagentFontCache fail.\n"); #endif if (CACHE_INDEX == CACHE_SIZE) { CACHE_ENTRY_PTR = realloc(CACHE_ENTRY_PTR, sizeof(nxCacheFontEntryRecPtr) * (CACHE_SIZE + 100)); if (CACHE_ENTRY_PTR == NULL) { FatalError("Font: Cache list memory re-allocation failed.\n"); } CACHE_SIZE += 100; } CACHE_ENTRY(CACHE_INDEX) = malloc(sizeof(nxCacheFontEntryRec)); if (CACHE_ENTRY(CACHE_INDEX) == NULL) { return False; } CACHE_NAME(CACHE_INDEX) = malloc(strlen(name) + 1); if (CACHE_NAME(CACHE_INDEX) == NULL) { return False; } #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "Font: Going to realize font [%s],[%s] on real X server.\n", validateString(name), origName); #endif if (nxagentRemoteFontList.length == 0 && (NXDisplayError(nxagentDisplay) == 0)) { nxagentListRemoteFonts("*", nxagentMaxFontNames); } nxagentFontPriv(pFont)->font_struct = nxagentLoadQueryFont(nxagentDisplay, (char *)name, pFont); strcpy(nxagentFontPriv(pFont)->fontName, name); if (nxagentFontPriv(pFont)->font_struct != NULL) { CACHE_ATOM(i) = value_atom; strcpy(CACHE_NAME(i), name); CACHE_FSTRUCT(i) = nxagentFontPriv(pFont)->font_struct; CACHE_INDEX++; nxagentFontPriv(pFont) -> mirrorID = FakeClientID(serverClient -> index); AddResource(nxagentFontPriv(pFont) -> mirrorID, RT_NX_FONT, pFont); #ifdef NXAGENT_FONTCACHE_DEBUG fprintf(stderr, "Font: nxagentFontCache adds font [%s] in pos. [%d].\n", validateString(name), CACHE_INDEX - 1); #endif } } #ifdef NXAGENT_FONTMATCH_DEBUG if (nxagentFontPriv(pFont)->font_struct == NULL) { if (nxagentFontLookUp(name) == False) { fprintf(stderr, "Font: nxagentRealizeFont failed with font Font=%s, not in our remote list\n", validateString(name)); } else { fprintf(stderr, "Font: nxagentRealizeFont failed with font Font=%s but the font is in our remote list\n", validateString(name)); } } else fprintf(stderr, "Font: nxagentRealizeFont OK realizing font Font=%s\n", validateString(name)); #endif return (nxagentFontPriv(pFont)->font_struct != NULL); } Bool nxagentUnrealizeFont(ScreenPtr pScreen, FontPtr pFont) { if (nxagentFontPriv(pFont)) { if (NXDisplayError(nxagentDisplay) == 0) { if (nxagentFontStruct(pFont)) { int i; for (i = 0; i < CACHE_INDEX; i++) { if (CACHE_FSTRUCT(i) == nxagentFontStruct(pFont)) { #ifdef NXAGENT_FONTCACHE_DEBUG fprintf(stderr, "nxagentUnrealizeFont: Not freeing the font in cache.\n"); #endif break; } } if (i == CACHE_INDEX) { /* * This font is not in the cache. */ #ifdef NXAGENT_FONTCACHE_DEBUG fprintf(stderr, "nxagentUnrealizeFont: Freeing font not found in cache '%d'\n", CACHE_ATOM(i)); #endif XFreeFont(nxagentDisplay, nxagentFontStruct(pFont)); } } } if (nxagentFontPriv(pFont) -> mirrorID) FreeResource(nxagentFontPriv(pFont) -> mirrorID, RT_NONE); free(nxagentFontPriv(pFont)); #ifdef HAS_XFONT2 xfont2_font_set_private(pFont, nxagentFontPrivateIndex, NULL); #else FontSetPrivate(pFont, nxagentFontPrivateIndex, NULL); #endif /* HAS_XFONT2 */ } return True; } int nxagentDestroyNewFontResourceType(void * p, XID id) { #ifdef TEST fprintf(stderr, "%s: Destroying mirror id [%ld] for font at [%p].\n", __func__, nxagentFontPriv((FontPtr) p) -> mirrorID, (void *) p); #endif /* FIXME: It happens that this resource had been already destroyed. We should verify if the same font is assigned both to the server client and another client. We had a crash when freeing server client resources. */ if (nxagentFontPriv((FontPtr) p) != NULL) { nxagentFontPriv((FontPtr) p) -> mirrorID = None; } return 1; } static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontPtr pFont) { XFontStruct *fontStruct; char substFontBuf[512];; /* X Logical Font Description Conventions require 14 fields in the * font names. * */ char *searchFields[FIELDS+1]; char *fontNameFields[FIELDS+1]; int numSearchFields = 0; int numFontFields = 0; int weight = 0; int tempWeight = 1; int fieldOrder[14] = { 4, /* Slant */ 11, /* Spacing */ 12, /* Width info */ 13, /* Charset */ 14, /* Language */ 7, /* Height */ 6, /* Add-style */ 3, /* Weight */ 2, /* Name */ 1, /* Foundry */ 9, /* DPI_x */ 5, /* Set-width */ 8, /* Point size */ 10 /* DPI_y */ }; #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentLoadBestQueryFont: Searching font '%s' .\n", fontName); #endif numFontFields = nxagentSplitString(fontName, fontNameFields, FIELDS + 1, "-"); snprintf(substFontBuf, sizeof(substFontBuf), "%s", "fixed"); if (numFontFields <= FIELDS) { #ifdef WARNING if (nxagentVerbose == 1) { fprintf(stderr, "nxagentLoadBestQueryFont: WARNING! Font name in non standard format. \n"); } #endif } else { for (int i = 1 ; i < nxagentRemoteFontList.length ; i++) { numSearchFields = nxagentSplitString(nxagentRemoteFontList.list[i]->name, searchFields, FIELDS+1, "-"); /* The following code attempts to find an accurate approximation * of the missing font. The current candidate and the missing font are * compared on the 14 fields of the X Logical Font Description Convention. * The selection is performed by the analysis of the matching fields, * shifting left the value of the Weight variable on the right matches * and shifting right the value of the Weight on the wrong ones; * due a probability of overmuch right shifting, the starting weight is set * to a high value. At the end of matching the selected font is the one * with the bigger final Weight. The shift operation has been used instead * of other operation for a performance issue. * In some check the shift is performed by more than one position, because * of the relevance of the field; for example a correct slant or a matching * charset is more relevant than the size. */ if (numSearchFields > FIELDS) { tempWeight = 0; for (int j = 0; j < FIELDS; j++) { if (strcasecmp(searchFields[fieldOrder[j]], fontNameFields[fieldOrder[j]]) == 0 || strcmp(searchFields[fieldOrder[j]], "") == 0 || strcmp(fontNameFields[fieldOrder[j]], "") != 0 || strcmp(searchFields[fieldOrder[j]], "*") == 0 || strcmp(fontNameFields[fieldOrder[j]], "*") == 0) { tempWeight ++; } tempWeight <<= 1; } } if (tempWeight > weight) { /* Found more accurate font */ weight = tempWeight; snprintf(substFontBuf, sizeof(substFontBuf), "%s", nxagentRemoteFontList.list[i]->name); #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentLoadBestQueryFont: Weight '%d' of more accurate font '%s' .\n", weight, substFontBuf); #endif } for (int j = 0; j < numSearchFields; j++) { SAFE_free(searchFields[j]); } } } #ifdef WARNING if (nxagentVerbose == 1) { fprintf(stderr, "nxagentLoadBestQueryFont: WARNING! Failed to load font '%s'. Replacing with '%s'.\n", fontName, substFontBuf); } #endif fontStruct = nxagentLoadQueryFont(dpy, substFontBuf, pFont); for (int j = 0; j < numFontFields; j++) { SAFE_free(fontNameFields[j]); } return fontStruct; } static void nxagentFontDisconnect(FontPtr pFont, XID param1, void * param2) { Bool *pBool = (Bool*)param2; if (pFont == NULL || !*pBool) return; nxagentPrivFont *privFont = nxagentFontPriv(pFont); #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentFontDisconnect: pFont %p, XID %lx\n", (void *) pFont, privFont -> font_struct ? nxagentFont(pFont) : 0); #endif for (int i = 0; i < CACHE_INDEX; i++) { if (strcasecmp(CACHE_NAME(i), privFont -> fontName) == 0) { #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentFontDisconnect: font %s found in cache at position %d\n", privFont -> fontName, i); #endif privFont -> font_struct = NULL; return; } } #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentFontDisconnect: WARNING font %s not found in cache freeing it now\n", privFont -> fontName); #endif if (privFont -> font_struct) { XFreeFont(nxagentDisplay, privFont -> font_struct); privFont -> font_struct = NULL; } } static void nxagentCollectFailedFont(FontPtr fpt, XID id) { if (nxagentFailedToReconnectFonts.font == NULL) { nxagentFailedToReconnectFonts.size = 8; nxagentFailedToReconnectFonts.font = malloc(nxagentFailedToReconnectFonts.size * sizeof(FontPtr)); nxagentFailedToReconnectFonts.id = malloc(nxagentFailedToReconnectFonts.size * sizeof(XID)); if (nxagentFailedToReconnectFonts.font == NULL || nxagentFailedToReconnectFonts.id == NULL) { SAFE_free(nxagentFailedToReconnectFonts.font); SAFE_free(nxagentFailedToReconnectFonts.id); FatalError("Font: font not reconnected memory allocation failed!.\n"); } #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentCollectFailedFont: allocated [%d] bytes.\n", 8 * (sizeof(FontPtr)+ sizeof(XID))); #endif } else if (nxagentFailedToReconnectFonts.index == nxagentFailedToReconnectFonts.size - 1) { nxagentFailedToReconnectFonts.size *= 2; nxagentFailedToReconnectFonts.font = realloc(nxagentFailedToReconnectFonts.font, nxagentFailedToReconnectFonts.size * sizeof(FontPtr)); nxagentFailedToReconnectFonts.id = realloc(nxagentFailedToReconnectFonts.id, nxagentFailedToReconnectFonts.size * sizeof(XID)); if (nxagentFailedToReconnectFonts.font == NULL || nxagentFailedToReconnectFonts.id == NULL) { FatalError("Font: font not reconnected memory re-allocation failed!.\n"); } #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr,"nxagentCollectFailedFont: reallocated memory.\n "); #endif } nxagentFailedToReconnectFonts.font[nxagentFailedToReconnectFonts.index] = fpt; nxagentFailedToReconnectFonts.id[nxagentFailedToReconnectFonts.index] = id; #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentCollectFailedFont: font not reconnected at [%p], " "put in nxagentFailedToReconnectFonts.font[%d] = [%p], with XID = [%lu].\n", (void*) fpt, nxagentFailedToReconnectFonts.index, (void *)nxagentFailedToReconnectFonts.font[nxagentFailedToReconnectFonts.index], nxagentFailedToReconnectFonts.id[nxagentFailedToReconnectFonts.index]); #endif nxagentFailedToReconnectFonts.index++; } static void nxagentFontReconnect(FontPtr pFont, XID param1, void * param2) { int i; Bool *pBool = (Bool*)param2; if (pFont == NULL) return; nxagentPrivFont *privFont = nxagentFontPriv(pFont); #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentFontReconnect: pFont %p - XID %lx - name %s\n", (void*) pFont, (privFont -> font_struct) ? nxagentFont(pFont) : 0, privFont -> fontName); #endif for (i = 0; i < CACHE_INDEX; i++) { if (strcasecmp(CACHE_NAME(i), privFont -> fontName) == 0) { #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "\tfound in cache"); #endif if (!CACHE_FSTRUCT(i)) { #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, " --- font struct not valid\n"); #endif break; } nxagentFontStruct(pFont) = CACHE_FSTRUCT(i); return; } } if (i == CACHE_INDEX) { FatalError("nxagentFontReconnect: font not found in cache."); } privFont -> font_struct = nxagentLoadQueryFont(nxagentDisplay, privFont -> fontName, pFont); if ((privFont -> font_struct == NULL) && reconnectFlexibility) { privFont -> font_struct = nxagentLoadBestQueryFont(nxagentDisplay, privFont -> fontName, pFont); } if (privFont->font_struct != NULL) { #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "\tXID %lx\n", privFont -> font_struct -> fid); #endif CACHE_FSTRUCT(i) = privFont -> font_struct; } else { #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentFontReconnect: failed\n"); #endif nxagentCollectFailedFont(pFont, param1); #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentFontReconnect: reconnection of font [%s] failed.\n", privFont -> fontName); #endif nxagentSetReconnectError(FAILED_RESUME_FONTS_ALERT, "Couldn't restore the font '%s'", privFont -> fontName); *pBool = False; } return; } static void nxagentFreeCacheBeforeReconnect(void) { #ifdef NXAGENT_RECONNECT_FONT_DEBUG printFontCacheDump("nxagentFreeCacheBeforeReconnect"); #endif for (int i = 0; i < CACHE_INDEX; i++) { if (CACHE_FSTRUCT(i)) { nxagentFreeFont(CACHE_FSTRUCT(i)); CACHE_FSTRUCT(i) = NULL; } } } static void nxagentCleanCacheAfterReconnect(void) { int real_size = CACHE_INDEX; #ifdef NXAGENT_RECONNECT_FONT_DEBUG printFontCacheDump("nxagentCleanCacheAfterReconnect"); #endif for (int i = 0; i < CACHE_INDEX; i++) { if(CACHE_FSTRUCT(i) == NULL) { SAFE_XFree(CACHE_NAME(i)); real_size--; } } for (int i = 0; i < real_size; i++) { int j; nxCacheFontEntryRecPtr swapEntryPtr; /* Find - first bad occurrence if exist. */ while ((i < real_size) && CACHE_FSTRUCT(i)) i++; /* Really nothing more to do. */ if (i == real_size) break; /* * Find - first good occurrence (moving backward from right end) entry in * order to replace the bad one. */ for (j = CACHE_INDEX - 1; CACHE_FSTRUCT(j) == NULL; j--); /* * Now we can swap the two entry and reduce the Cache index */ swapEntryPtr = CACHE_ENTRY(i); CACHE_ENTRY(i) = CACHE_ENTRY(j); CACHE_ENTRY(j) = swapEntryPtr; } CACHE_INDEX = real_size; } #ifdef NXAGENT_RECONNECT_FONT_DEBUG static void printFontCacheDump(char* msg) { fprintf(stderr, "%s - begin -\n", msg); for (int i = 0; i < CACHE_INDEX; i++) { if (CACHE_FSTRUCT(i)) { fprintf(stderr, "\tXID %lx - %s\n", CACHE_FSTRUCT(i) -> fid, CACHE_NAME(i)); } else { fprintf(stderr, "\tdestroyed - %s\n", CACHE_NAME(i)); } } fprintf(stderr, "%s - end -\n", msg); } #endif Bool nxagentReconnectAllFonts(void *p0) { Bool fontSuccess = True; reconnectFlexibility = *((int *) p0); #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_FONT_DEBUG) fprintf(stderr, "nxagentReconnectAllFonts\n"); #endif /* * The resource type RT_NX_FONT is created on the server client * only, so we can avoid to loop through all the clients. */ FindClientResourcesByType(clients[serverClient -> index], RT_NX_FONT, (FindResType) nxagentFontReconnect, &fontSuccess); for (int cid = 0; cid < MAXCLIENTS; cid++) { if (clients[cid]) { FindClientResourcesByType(clients[cid], RT_FONT, (FindResType) nxagentFontReconnect, &fontSuccess); } } if (fontSuccess) { nxagentCleanCacheAfterReconnect(); } return fontSuccess; } static void nxagentFailedFontReconnect(FontPtr pFont, XID param1, void * param2) { int i; nxagentPrivFont *privFont; Bool *pBool = (Bool*)param2; if (pFont == NULL) return; privFont = nxagentFontPriv(pFont); #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentFailedFontReconnect: pFont %p - XID %lx - name %s\n", (void*) pFont, (privFont -> font_struct) ? nxagentFont(pFont) : 0, privFont -> fontName); #endif for (i = 0; i < CACHE_INDEX; i++) { if (strcasecmp(CACHE_NAME(i), privFont -> fontName) == 0) { #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "\tfound in cache"); #endif if (!CACHE_FSTRUCT(i)) { #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, " --- font struct not valid\n"); #endif break; } nxagentFontStruct(pFont) = CACHE_FSTRUCT(i); return; } } if (i == CACHE_INDEX) { FatalError("nxagentFailedFontReconnect: font not found in cache."); } privFont -> font_struct = nxagentLoadQueryFont(nxagentDisplay, privFont -> fontName, pFont); if (privFont -> font_struct == NULL) { privFont -> font_struct = nxagentLoadBestQueryFont(nxagentDisplay, privFont -> fontName, pFont); } if (privFont->font_struct != NULL) { #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "\tXID %lx\n", privFont -> font_struct -> fid); #endif CACHE_FSTRUCT(i) = privFont -> font_struct; } else { #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentFailedFontReconnect: failed\n"); #endif #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentFailedFontReconnect: reconnection of font [%s] failed.\n", privFont -> fontName); #endif nxagentSetReconnectError(FAILED_RESUME_FONTS_ALERT, "Couldn't restore the font '%s'", privFont -> fontName); *pBool = False; } return; } static void nxagentFreeFailedToReconnectFonts(void) { SAFE_free(nxagentFailedToReconnectFonts.font); SAFE_free(nxagentFailedToReconnectFonts.id); nxagentFailedToReconnectFonts.size = 0; nxagentFailedToReconnectFonts.index = 0; } Bool nxagentReconnectFailedFonts(void *p0) { int attempt = 1; const int maxAttempt = 5; char **fontPaths, **localFontPaths, **newFontPaths; char fontServerPath[256] = ""; int nPaths = 0; Bool repeat = True; Bool fontSuccess = True; reconnectFlexibility = *((int *) p0); #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentReconnectFailedFonts: \n"); #endif if (nxagentGetFontServerPath(fontServerPath, sizeof(fontServerPath)) == False) { #ifdef WARNING fprintf(stderr, "nxagentReconnectFailedFonts: WARNING! " "Font server tunneling not retrieved.\n"); #endif } #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentReconnectFailedFonts: font server path [%s]\n", fontServerPath); #endif fontPaths = XGetFontPath(nxagentDisplay, &nPaths); if ((newFontPaths = malloc((nPaths + 1) * sizeof(char *))) == NULL) { FatalError("nxagentReconnectFailedFonts: malloc failed."); } memcpy(newFontPaths, fontPaths, nPaths * sizeof(char*)); localFontPaths = newFontPaths; localFontPaths += nPaths; *localFontPaths = fontServerPath; while(repeat) { #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentReconnectFailedFonts: attempt [%d].\n", attempt); #endif repeat = False; XSetFontPath(nxagentDisplay, newFontPaths, nPaths + 1); nxagentFreeRemoteFontList(&nxagentRemoteFontList); nxagentListRemoteFonts("*", nxagentMaxFontNames); for(int i = 0; i < nxagentFailedToReconnectFonts.index; i++) { fontSuccess = True; if(nxagentFailedToReconnectFonts.font[i]) { nxagentFailedFontReconnect(nxagentFailedToReconnectFonts.font[i], nxagentFailedToReconnectFonts.id[i], &fontSuccess); if (fontSuccess) { nxagentFailedToReconnectFonts.font[i] = NULL; } else { repeat = True; } } } attempt++; if (attempt > maxAttempt) { nxagentFreeFailedToReconnectFonts(); XSetFontPath(nxagentDisplay, fontPaths, nPaths); nxagentFreeRemoteFontList(&nxagentRemoteFontList); nxagentListRemoteFonts("*", nxagentMaxFontNames); XFreeFontPath(fontPaths); SAFE_free(newFontPaths); return False; } } nxagentFreeFailedToReconnectFonts(); XSetFontPath(nxagentDisplay, fontPaths, nPaths); XFreeFontPath(fontPaths); SAFE_free(newFontPaths); nxagentCleanCacheAfterReconnect(); return True; } Bool nxagentDisconnectAllFonts(void) { Bool fontSuccess = True; #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_FONT_DEBUG) fprintf(stderr, "nxagentDisconnectAllFonts\n"); #endif nxagentFreeRemoteFontList(&nxagentRemoteFontList); nxagentFreeCacheBeforeReconnect(); /* * The resource type RT_NX_FONT is created on the server client * only, so we can avoid to loop through all the clients. */ FindClientResourcesByType(clients[serverClient -> index], RT_NX_FONT, (FindResType) nxagentFontDisconnect, &fontSuccess); for(int cid = 0; cid < MAXCLIENTS; cid++) { if( clients[cid] && fontSuccess ) { FindClientResourcesByType(clients[cid], RT_FONT, (FindResType) nxagentFontDisconnect, &fontSuccess); } } return True; } static Bool nxagentGetFontServerPath(char * fontServerPath, int size) { char path[256] = {0}; if (NXGetFontParameters(nxagentDisplay, sizeof(path), path) == True) { /* the length is stored in the first byte and is therefore limited to 255 */ unsigned int len = *path; if (len) { snprintf(fontServerPath, min(size, len + 1), "%s", path + 1); #ifdef TEST fprintf(stderr, "%s: Got path [%s].\n", __func__, fontServerPath); #endif } else { #ifdef TEST fprintf(stderr, "%s: WARNING! Font server tunneling not enabled.\n", __func__); #endif return False; } } else { #ifdef TEST fprintf(stderr, "%s: WARNING! Failed to get path for font server tunneling.\n", __func__); #endif return False; } return True; } void nxagentVerifySingleFontPath(char **dest, const char *fontDir) { if (!dest || !*dest) return; #ifdef TEST fprintf(stderr, "%s: Assuming fonts in directory [%s].\n", __func__, validateString(fontDir)); #endif for (int i = 0; ; i++) { char *tmppath = NULL; int rc; const char *subdir = nxagentFontSubdirs[i]; if (subdir == NULL) return; if (**dest != '\0') { rc = asprintf(&tmppath, "%s,%s/%s", *dest, fontDir, subdir); } else { rc = asprintf(&tmppath, "%s/%s", fontDir, subdir); } if (rc == -1) return; SAFE_free(*dest); *dest = tmppath; tmppath = NULL; } } void nxagentVerifyDefaultFontPath(void) { static char *fontPath; #ifdef TEST fprintf(stderr, "%s: Going to search for one or more valid font paths.\n", __func__); #endif /* * Set the default font path as the first choice. */ if ((fontPath = strdup(defaultFontPath)) == NULL) { #ifdef WARNING fprintf(stderr, "%s: WARNING! Unable to allocate memory for a new font path. " "Using the default font path [%s].\n", __func__, validateString(defaultFontPath)); #endif return; } for (int i = 0; ; i++) { int j; const char *dir = nxagentFontDirs[i]; if (dir == NULL) { break; } else { for (j = 0; j <= i; j++) { //if (strcmp(nxagentFontDirs[j], dir) == 0) if (nxagentFontDirs[j] == dir) { break; } } if (j == i) { nxagentVerifySingleFontPath(&fontPath, dir); } #ifdef TEST else { fprintf(stderr, "%s: Skipping duplicate font dir [%s].\n", __func__, validateString(dir)); } #endif } } if (*fontPath == '\0') { #ifdef WARNING fprintf(stderr, "%s: WARNING! Can't find a valid font directory.\n", __func__); fprintf(stderr, "%s: WARNING! Using font path [%s].\n", __func__, validateString(defaultFontPath)); #endif } else { /* do _not_ free defaultFontPath here - it's either set at compile time or part of argv */ defaultFontPath = fontPath; #ifdef TEST fprintf(stderr, "%s: Using font path [%s].\n", __func__, validateString(defaultFontPath)); #endif } return; } XFontStruct* nxagentLoadQueryFont(register Display *dpy, char *name, FontPtr pFont) { XFontStruct* fs; xCharInfo *xcip; fs = (XFontStruct *) malloc (sizeof (XFontStruct)); if (fs == NULL) { #ifdef WARNING fprintf(stderr, "nxagentLoadQueryFont: WARNING! Failed allocation of XFontStruct.\n"); #endif return (XFontStruct *)NULL; } #ifdef NXAGENT_RECONNECT_FONT_DEBUG fprintf(stderr, "nxagentLoadQueryFont: Looking for font '%s'.\n", name); #endif if (nxagentFontLookUp(name) == 0) { #ifdef DEBUG fprintf(stderr, "nxagentLoadQueryFont: WARNING! Font not found '%s'.\n", name); #endif SAFE_free(fs); return (XFontStruct *) NULL; } fs -> ext_data = NULL; /* Hook for extension to hang data.*/ fs -> fid = XLoadFont(dpy, name); /* Font id for this font. */ fs -> direction = pFont->info.drawDirection; /* Hint about the direction font is painted. */ fs -> min_char_or_byte2 = pFont->info.firstCol; /* First character. */ fs -> max_char_or_byte2 = pFont->info.lastCol; /* Last character. */ fs -> min_byte1 = pFont->info.firstRow; /* First row that exists. */ fs -> max_byte1 = pFont->info.lastRow; /* Last row that exists. */ fs -> all_chars_exist = pFont->info.allExist; /* Flag if all characters have nonzero size. */ fs -> default_char = pFont->info.defaultCh; /* Char to print for undefined character. */ fs -> n_properties = pFont->info.nprops; /* How many properties there are. */ /* * If no properties defined for the font, then it is bad * font, but shouldn't try to read nothing. */ if (fs -> n_properties > 0) { register long nbytes; nbytes = pFont -> info.nprops * sizeof(XFontProp); fs -> properties = (XFontProp *) malloc((unsigned) nbytes); if (fs -> properties == NULL) { #ifdef WARNING fprintf(stderr, "nxagentLoadQueryFont: WARNING! Failed allocation of XFontProp."); #endif SAFE_free(fs); return (XFontStruct *) NULL; } memmove(fs -> properties, pFont -> info.props, nbytes); } xcip = (xCharInfo *) &pFont -> info.ink_minbounds; fs -> min_bounds.lbearing = cvtINT16toShort(xcip -> leftSideBearing); fs -> min_bounds.rbearing = cvtINT16toShort(xcip -> rightSideBearing); fs -> min_bounds.width = cvtINT16toShort(xcip -> characterWidth); fs -> min_bounds.ascent = cvtINT16toShort(xcip -> ascent); fs -> min_bounds.descent = cvtINT16toShort(xcip -> descent); fs -> min_bounds.attributes = xcip -> attributes; xcip = (xCharInfo *) &pFont -> info.ink_maxbounds; fs -> max_bounds.lbearing = cvtINT16toShort(xcip -> leftSideBearing); fs -> max_bounds.rbearing = cvtINT16toShort(xcip -> rightSideBearing); fs -> max_bounds.width = cvtINT16toShort(xcip -> characterWidth); fs -> max_bounds.ascent = cvtINT16toShort(xcip -> ascent); fs -> max_bounds.descent = cvtINT16toShort(xcip -> descent); fs -> max_bounds.attributes = xcip -> attributes; fs -> per_char = NULL; /* First_char to last_char information. */ fs -> ascent = pFont->info.fontAscent; /* Logical extent above baseline for spacing. */ fs -> descent = pFont->info.fontDescent; /* Logical decent below baseline for spacing. */ return fs; } int nxagentFreeFont(XFontStruct *fs) { if (fs->per_char) { #ifdef USE_XF86BIGFONT _XF86BigfontFreeFontMetrics(fs); #else SAFE_free(fs->per_char); #endif } SAFE_free(fs->properties); SAFE_XFree(fs); return 1; } int nxagentSplitString(char *string, char *fields[], int nfields, char *sep) { int seplen = strlen(sep); int len = strlen(string); char *current = string; int i = 0; int last = 0; for (;;) { char *next = NULL; if (current < string + len) { next = strstr(current, sep); } if (next == NULL) { next = string + len; last = 1; } int fieldlen = next - current; if (i < nfields) { fields[i] = strndup(current, fieldlen); } else { fields[i] = NULL; } current = next + seplen; i++; if (last == 1) { break; } } return i; } char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution) { char *scalableFontName; /* FIXME: use str(n)dup()? */ if ((scalableFontName = malloc(strlen(fontName) + 1)) == NULL) { #ifdef PANIC fprintf(stderr, "nxagentMakeScalableFontName: PANIC! malloc() failed.\n"); #endif return NULL; } scalableFontName[0] = '\0'; if (*fontName != '-') { goto MakeScalableFontNameError; } const char *s = fontName; int field = 0; while (s != NULL) { s = strchr(s + 1, '-'); if (s != NULL) { if (field == 6 || field == 7 || field == 11) { /* * PIXEL_SIZE || POINT_SIZE || AVERAGE_WIDTH */ strcat(scalableFontName, "-0"); } else if (scalableResolution == 1 && (field == 8 || field == 9)) { /* * RESOLUTION_X || RESOLUTION_Y */ strcat(scalableFontName, "-0"); } else { strncat(scalableFontName, fontName, s - fontName); } fontName = s; } else { strcat(scalableFontName, fontName); } field++; } if (field != 14) { goto MakeScalableFontNameError; } return scalableFontName; MakeScalableFontNameError: SAFE_free(scalableFontName); #ifdef DEBUG fprintf(stderr, "nxagentMakeScalableFontName: Invalid font name.\n"); #endif return NULL; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Font.h0000644000000000000000000000673413614532331017746 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #ifndef __Font_H__ #define __Font_H__ #include #include "resource.h" extern RESTYPE RT_NX_FONT; extern int nxagentFontPrivateIndex; typedef struct { XFontStruct *font_struct; char fontName[256]; XID mirrorID; } nxagentPrivFont; extern const int nxagentMaxFontNames; #define nxagentFontPriv(pFont) \ ((nxagentPrivFont *)FontGetPrivate(pFont, nxagentFontPrivateIndex)) #define nxagentFontStruct(pFont) (nxagentFontPriv(pFont)->font_struct) #define nxagentFont(pFont) (nxagentFontStruct(pFont)->fid) Bool nxagentRealizeFont(ScreenPtr pScreen, FontPtr pFont); Bool nxagentUnrealizeFont(ScreenPtr pScreen, FontPtr pFont); void nxagentFreeFontCache(void); void nxagentListRemoteFonts(const char *searchPattern, const int maxNames); int nxagentFontLookUp(const char *name); Bool nxagentFontFind(const char *name, int *pos); void nxagentListRemoteAddName(const char *name, int status); int nxagentDestroyNewFontResourceType(void * p, XID id); Bool nxagentDisconnectAllFonts(void); Bool nxagentReconnectAllFonts(void *p0); void nxagentVerifyDefaultFontPath(void); int nxagentSplitString(char *string, char *fields[], int nfields, char *sep); #endif /* __Font_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/GC.c0000644000000000000000000011560513614532331017322 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #include "X.h" #include "Xproto.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "dixstruct.h" #include #include "mistruct.h" #include "region.h" #include "Agent.h" #include "Display.h" #include "GCs.h" #include "GCOps.h" #include "Image.h" #include "Drawable.h" #include "Pixmaps.h" #include "Font.h" #include "Colormap.h" #include "Trap.h" #include "Screen.h" #include "Pixels.h" #include "Utils.h" #include "../../fb/fb.h" RESTYPE RT_NX_GC; /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG int nxagentGCPrivateIndex; nxagentGraphicContextsPtr nxagentGraphicContexts; int nxagentGraphicContextsSize; void nxagentDisconnectGraphicContexts(void); GCPtr nxagentCreateGraphicContext(int depth); static void nxagentReconnectGC(void*, XID, void*); static void nxagentReconnectClip(GCPtr, int, void *, int); static int nxagentCompareRegions(RegionPtr, RegionPtr); struct nxagentGCRec { GCPtr pGC; XlibGC gc; struct nxagentGCRec *next; }; static struct { struct nxagentGCRec *first; struct nxagentGCRec *last; int size; } nxagentGCList = { NULL, NULL, 0 }; static struct nxagentGCRec *nxagentGetFirstGC(void); static void nxagentRestoreGCList(void); static GCFuncs nxagentFuncs = { nxagentValidateGC, nxagentChangeGC, nxagentCopyGC, nxagentDestroyGC, nxagentChangeClip, nxagentDestroyClip, nxagentCopyClip, }; static GCOps nxagentOps = { nxagentFillSpans, nxagentSetSpans, nxagentPutImage, nxagentCopyArea, nxagentCopyPlane, nxagentPolyPoint, nxagentPolyLines, nxagentPolySegment, nxagentPolyRectangle, nxagentPolyArc, nxagentFillPolygon, nxagentPolyFillRect, nxagentPolyFillArc, nxagentPolyText8, nxagentPolyText16, nxagentImageText8, nxagentImageText16, nxagentImageGlyphBlt, nxagentPolyGlyphBlt, nxagentPushPixels }; Bool nxagentCreateGC(GCPtr pGC) { pGC->clientClipType = CT_NONE; pGC->clientClip = NULL; pGC->funcs = &nxagentFuncs; pGC->ops = &nxagentOps; pGC->miTranslate = 1; if (pGC -> stipple && !nxagentPixmapIsVirtual(pGC -> stipple)) { #ifdef DEBUG fprintf(stderr, "nxagentCreateGC: GC at [%p] got real stipple at [%p] switched to virtual.\n", (void*)pGC, (void*)pGC -> stipple); #endif pGC -> stipple = nxagentVirtualPixmap(pGC -> stipple); } /* * We create the GC based on the default drawables. The proxy knows * this and optimizes the encoding of the create GC message to * include the id of the drawable in the checksum. */ nxagentGCPriv(pGC)->gc = XCreateGC(nxagentDisplay, nxagentDefaultDrawables[pGC->depth], 0L, NULL); #ifdef TEST fprintf(stderr, "nxagentCreateGC: GC [%p]\n", (void *) pGC); #endif FbGCPrivPtr pPriv = (pGC)->devPrivates[fbGCPrivateIndex].ptr; fbGetRotatedPixmap(pGC) = 0; fbGetExpose(pGC) = 1; fbGetFreeCompClip(pGC) = 0; fbGetCompositeClip(pGC) = 0; pPriv->bpp = BitsPerPixel (pGC->depth); /* * Init to default GC values. */ memset(&(nxagentGCPriv(pGC) -> lastServerValues), 0, sizeof(XGCValues)); nxagentGCPriv(pGC) -> lastServerValues.background = 1; nxagentGCPriv(pGC) -> lastServerValues.plane_mask = ~0; nxagentGCPriv(pGC) -> lastServerValues.graphics_exposures = 1; nxagentGCPriv(pGC) -> lastServerValues.dashes = 4; nxagentGCPriv(pGC) -> nClipRects = 0; nxagentGCPriv(pGC) -> mid = FakeClientID(serverClient -> index); nxagentGCPriv(pGC) -> pPixmap = NULL; AddResource(nxagentGCPriv(pGC) -> mid, RT_NX_GC, (void *) pGC); return True; } void nxagentValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) { DrawablePtr pVirtual = (pDrawable -> type == DRAWABLE_PIXMAP) ? nxagentVirtualDrawable(pDrawable) : pDrawable; #ifdef TEST fprintf(stderr, "nxagentValidateGC: Going to validate GC at [%p] for drawable at [%p] with changes [%lx].\n", (void *) pGC, (void *) pDrawable, changes); #endif pGC->lastWinOrg.x = pDrawable->x; pGC->lastWinOrg.y = pDrawable->y; if (!pGC -> tileIsPixel && !nxagentPixmapIsVirtual(pGC -> tile.pixmap)) { pGC -> tile.pixmap = nxagentVirtualPixmap(pGC -> tile.pixmap); } PixmapPtr lastTile = pGC -> tile.pixmap; PixmapPtr lastStipple = pGC->stipple; if (lastStipple) { pGC->stipple = nxagentVirtualPixmap(pGC->stipple); } #ifdef TEST fprintf(stderr, "nxagentValidateGC: Drawable at [%p] has type [%s] virtual [%p] bits per pixel [%d].\n", (void *) pDrawable, (pDrawable -> type == DRAWABLE_PIXMAP) ? "PIXMAP" : "WINDOW", (void *) pVirtual, pVirtual -> bitsPerPixel); #endif if (pVirtual -> bitsPerPixel == 0) { /* * Don't enter fbValidateGC() with 0 bpp or agent will block in a * endless loop. */ #ifdef WARNING fprintf(stderr, "nxagentValidateGC: WARNING! Virtual drawable at [%p] has invalid bits per pixel.\n", (void *) pVirtual); fprintf(stderr, "nxagentValidateGC: WARNING! While validating GC at [%p] for drawable at [%p] with changes [%lx].\n", (void *) pGC, (void *) pDrawable, changes); fprintf(stderr, "nxagentValidateGC: WARNING! Bad drawable at [%p] has type [%s] virtual [%p] bits per pixel [%d].\n", (void *) pDrawable, (pDrawable -> type == DRAWABLE_PIXMAP) ? "PIXMAP" : "WINDOW", (void *) pVirtual, pVirtual -> bitsPerPixel); #endif } else { fbValidateGC(pGC, changes, pVirtual); } if (pGC->tile.pixmap != lastTile) { #ifdef WARNING fprintf(stderr, "nxagentValidateGC: WARNING! Transforming pixmap at [%p] virtual at [%p] " "in virtual pixmap.\n", (void *) nxagentPixmapPriv(pGC -> tile.pixmap) -> pRealPixmap, (void *) nxagentPixmapPriv(pGC -> tile.pixmap) -> pRealPixmap); #endif #ifdef TEST fprintf(stderr, "nxagentValidateGC: GC [%p] new tile [%p] from fb set as virtual\n", (void *) pGC, (void *) pGC->tile.pixmap); #endif nxagentPixmapIsVirtual(pGC->tile.pixmap) = True; nxagentRealPixmap(pGC->tile.pixmap) = nxagentRealPixmap(lastTile); if (nxagentRealPixmap(lastTile)) { nxagentPixmapPriv(nxagentRealPixmap(lastTile))->pVirtualPixmap = pGC->tile.pixmap; } } pGC->stipple = lastStipple; } #define CHECKGCVAL(cmask, member, val) do {if (mask & cmask) { values.member = (val); changeFlag += nxagentTestGC(values.member, member); } } while (0) void nxagentChangeGC(GCPtr pGC, unsigned long mask) { #ifdef TEST static int nDiscarded; #endif XGCValues values = {0}; int changeFlag = 0; CHECKGCVAL(GCFunction, function, pGC->alu); CHECKGCVAL(GCPlaneMask, plane_mask, pGC->planemask); CHECKGCVAL(GCForeground, foreground, nxagentPixel(pGC->fgPixel)); CHECKGCVAL(GCBackground, background, nxagentPixel(pGC->bgPixel)); CHECKGCVAL(GCLineWidth, line_width, pGC->lineWidth); CHECKGCVAL(GCLineStyle, line_style, pGC->lineStyle); CHECKGCVAL(GCCapStyle, cap_style, pGC->capStyle); CHECKGCVAL(GCJoinStyle, join_style, pGC->joinStyle); CHECKGCVAL(GCFillStyle, fill_style, pGC->fillStyle); CHECKGCVAL(GCFillRule, fill_rule, pGC->fillRule); if (mask & GCTile) { if (pGC->tileIsPixel) { mask &= ~GCTile; } else { if (nxagentDrawableStatus((DrawablePtr) pGC -> tile.pixmap) == NotSynchronized && nxagentGCTrap == 0) { /* * If the tile is corrupted and is not too large, it can be * synchronized immediately. In the other cases, the tile is * cleared with a solid color to become usable. This approach * should solve the high delay on slow links waiting for a * background tile to be synchronized. */ if (nxagentOption(DeferLevel) >= 2 && (pGC -> tile.pixmap -> drawable.width > 240 || pGC -> tile.pixmap -> drawable.height > 240)) { #ifdef TEST fprintf(stderr, "nxagentChangeGC: WARNING! Going to fill with solid color the corrupted tile at [%p] " "for GC at [%p] with size [%dx%d].\n", (void *) pGC -> tile.pixmap, (void *)pGC, ((DrawablePtr) pGC -> tile.pixmap) -> width, ((DrawablePtr) pGC -> tile.pixmap) -> height); #endif nxagentFillRemoteRegion((DrawablePtr) pGC -> tile.pixmap, nxagentCorruptedRegion((DrawablePtr) pGC -> tile.pixmap)); } else { #ifdef TEST fprintf(stderr, "nxagentChangeGC: WARNING! Synchronizing GC at [%p] due the tile at [%p] with size [%dx%d].\n", (void *)pGC, (void *)pGC -> tile.pixmap, ((DrawablePtr) pGC -> tile.pixmap) -> width, ((DrawablePtr) pGC -> tile.pixmap) -> height); #endif nxagentSynchronizeDrawable((DrawablePtr) pGC -> tile.pixmap, DO_WAIT, NEVER_BREAK, NULL); } } values.tile = nxagentPixmap(pGC->tile.pixmap); pGC->tile.pixmap = nxagentVirtualPixmap(pGC->tile.pixmap); #ifdef TEST fprintf(stderr, "nxagentChangeGC: New tile on GC [%p] tile is [%p]\n", (void *) pGC, (void *) pGC->tile.pixmap); #endif changeFlag += nxagentTestGC(values.tile, tile); } } if (mask & GCStipple) { if (nxagentDrawableStatus((DrawablePtr) pGC -> stipple) == NotSynchronized && nxagentGCTrap == 0) { #ifdef TEST fprintf(stderr, "nxagentChangeGC: WARNING! Synchronizing GC at [%p] due the stipple at [%p].\n", (void *)pGC, (void *)pGC -> stipple); #endif nxagentSynchronizeDrawable((DrawablePtr) pGC -> stipple, DO_WAIT, NEVER_BREAK, NULL); } values.stipple = nxagentPixmap(pGC->stipple); pGC->stipple = nxagentVirtualPixmap(pGC->stipple); #ifdef TEST fprintf(stderr, "nxagentChangeGC: New stipple on GC [%p] stipple is [%p]\n", (void *) pGC, (void *) pGC->stipple); #endif changeFlag += nxagentTestGC(values.stipple, stipple); } CHECKGCVAL(GCTileStipXOrigin, ts_x_origin, pGC->patOrg.x); CHECKGCVAL(GCTileStipYOrigin, ts_y_origin, pGC->patOrg.y); if (mask & GCFont) { if (!nxagentFontStruct(pGC -> font)) { mask &= ~GCFont; } else { values.font = nxagentFont(pGC->font); changeFlag += nxagentTestGC(values.font, font); } } CHECKGCVAL(GCSubwindowMode, subwindow_mode, pGC->subWindowMode); CHECKGCVAL(GCGraphicsExposures, graphics_exposures, pGC->graphicsExposures); CHECKGCVAL(GCClipXOrigin, clip_x_origin, pGC->clipOrg.x); CHECKGCVAL(GCClipYOrigin, clip_y_origin, pGC->clipOrg.y); if (mask & GCClipMask) { /* * This is handled in the change clip. */ mask &= ~GCClipMask; } CHECKGCVAL(GCDashOffset, dash_offset, pGC->dashOffset); if (mask & GCDashList) { mask &= ~GCDashList; if (nxagentGCTrap == 0) { XSetDashes(nxagentDisplay, nxagentGC(pGC), pGC->dashOffset, (char *)pGC->dash, pGC->numInDashList); } } CHECKGCVAL(GCArcMode, arc_mode, pGC->arcMode); if (nxagentGCTrap == 1) { #ifdef TEST fprintf(stderr, "nxagentChangeGC: Skipping change of GC at [%p] on the real X server.\n", (void *) pGC); #endif return; } if (mask && changeFlag) { XChangeGC(nxagentDisplay, nxagentGC(pGC), mask, &values); } #ifdef TEST else if (mask) { fprintf(stderr, "nxagentChangeGC: Discarded [%d] Mask [%lu]\n", ++nDiscarded, mask); } #endif } void nxagentCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) { #ifdef TEST fprintf(stderr, "nxagentCopyGC: Copying the GC with source at [%p] destination " "at [%p] mask [%lu].\n", (void *)pGCSrc, (void *)pGCDst, mask); #endif /* * The MI function doesn't do anything. * * miCopyGC(pGCSrc, mask, pGCDst); */ XCopyGC(nxagentDisplay, nxagentGC(pGCSrc), mask, nxagentGC(pGCDst)); /* * Copy the private foreground field of the GC if GCForeground is * set. */ nxagentCopyGCPriv(GCForeground,foreground,pGCSrc,mask,pGCDst); } void nxagentDestroyGC(GCPtr pGC) { #ifdef TEST fprintf(stderr, "nxagentDestroyGC: GC at [%p].\n", (void *) pGC); #endif if (nxagentGCPriv(pGC) -> mid != 0) { FreeResource(nxagentGCPriv(pGC) -> mid, RT_NONE); } XFreeGC(nxagentDisplay, nxagentGC(pGC)); miDestroyGC(pGC); } void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects) { int clipsMatch = 0; #ifdef TEST fprintf(stderr, "nxagentChangeClip: Going to change clip on GC [%p]\n", (void *) pGC); #endif switch (type) { case CT_NONE: { clipsMatch = (pGC -> clientClipType == None); break; } case CT_REGION: { clipsMatch = nxagentCompareRegions(pGC -> clientClip, (RegionPtr) pValue); break; } case CT_UNSORTED: case CT_YSORTED: case CT_YXSORTED: case CT_YXBANDED: { RegionPtr pReg = RegionFromRects(nRects, (xRectangle *)pValue, type); clipsMatch = nxagentCompareRegions(pGC -> clientClip, pReg); RegionDestroy(pReg); break; } default: { clipsMatch = 0; break; } } nxagentDestroyClipHelper(pGC); #ifdef TEST fprintf(stderr, "nxagentChangeClip: Type [%d] regions clipsMatch [%d].\n", type, clipsMatch); #endif switch (type) { case CT_NONE: { if (clipsMatch == 0 && nxagentGCTrap == 0) { XSetClipMask(nxagentDisplay, nxagentGC(pGC), None); } break; } case CT_REGION: { if (clipsMatch == 0 && nxagentGCTrap == 0) { XRectangle *pRects; nRects = RegionNumRects((RegionPtr)pValue); int size = nRects * sizeof(*pRects); pRects = (XRectangle *) malloc(size); BoxPtr pBox = RegionRects((RegionPtr)pValue); for (int i = nRects; i-- > 0;) { pRects[i].x = pBox[i].x1; pRects[i].y = pBox[i].y1; pRects[i].width = pBox[i].x2 - pBox[i].x1; pRects[i].height = pBox[i].y2 - pBox[i].y1; } XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC -> clipOrg.x, pGC -> clipOrg.y, pRects, nRects, Unsorted); SAFE_free(pRects); } break; } case CT_PIXMAP: { if (nxagentGCTrap == 0) { XSetClipMask(nxagentDisplay, nxagentGC(pGC), nxagentPixmap((PixmapPtr)pValue)); } pGC->clientClip = (void *) (*pGC->pScreen->BitmapToRegion)((PixmapPtr) pValue); nxagentGCPriv(pGC)->pPixmap = (PixmapPtr)pValue; pValue = pGC->clientClip; type = CT_REGION; break; } case CT_UNSORTED: { if (clipsMatch == 0 && nxagentGCTrap == 0) { XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC->clipOrg.x, pGC->clipOrg.y, (XRectangle *)pValue, nRects, Unsorted); } break; } case CT_YSORTED: { if (clipsMatch == 0 && nxagentGCTrap == 0) { XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC->clipOrg.x, pGC->clipOrg.y, (XRectangle *)pValue, nRects, YSorted); } break; } case CT_YXSORTED: { if (clipsMatch == 0 && nxagentGCTrap == 0) { XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC->clipOrg.x, pGC->clipOrg.y, (XRectangle *)pValue, nRects, YXSorted); } break; } case CT_YXBANDED: { if (clipsMatch == 0 && nxagentGCTrap == 0) { XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC->clipOrg.x, pGC->clipOrg.y, (XRectangle *)pValue, nRects, YXBanded); } break; } } switch(type) { case CT_UNSORTED: case CT_YSORTED: case CT_YXSORTED: case CT_YXBANDED: { /* * Other parts of the server can only deal with CT_NONE, * CT_PIXMAP and CT_REGION client clips. */ pGC->clientClip = (void *) RegionFromRects(nRects, (xRectangle *)pValue, type); SAFE_free(pValue); pValue = pGC->clientClip; type = CT_REGION; break; } default: { break; } } pGC->clientClipType = type; pGC->clientClip = pValue; nxagentGCPriv(pGC)->nClipRects = nRects; } void nxagentDestroyClip(GCPtr pGC) { miDestroyClip(pGC); if (pGC->clientClipType == CT_PIXMAP) { (*pGC->pScreen->DestroyPixmap)((PixmapPtr) (pGC->clientClip)); } nxagentDestroyClipHelper(pGC); if (nxagentGCTrap == 0) { XSetClipMask(nxagentDisplay, nxagentGC(pGC), None); } pGC->clientClipType = CT_NONE; pGC->clientClip = NULL; nxagentGCPriv(pGC)->nClipRects = 0; } void nxagentDestroyClipHelper(GCPtr pGC) { switch (pGC->clientClipType) { default: case CT_NONE: break; case CT_REGION: RegionDestroy(pGC->clientClip); break; case CT_PIXMAP: nxagentDestroyPixmap((PixmapPtr)pGC->clientClip); break; } if (nxagentGCPriv(pGC)->pPixmap != NULL) { nxagentDestroyPixmap(nxagentGCPriv(pGC)->pPixmap); nxagentGCPriv(pGC)->pPixmap = NULL; } } void nxagentCopyClip(GCPtr pGCDst, GCPtr pGCSrc) { #ifdef TEST fprintf(stderr, "nxagentCopyClip: Going to copy clip from GC [%p] to GC [%p]\n", (void *) pGCDst, (void *) pGCSrc); #endif switch (pGCSrc->clientClipType) { case CT_REGION: if (nxagentGCPriv(pGCSrc)->pPixmap == NULL) { RegionPtr pRgn = RegionCreate(NULL, 1); RegionCopy(pRgn, pGCSrc->clientClip); nxagentChangeClip(pGCDst, CT_REGION, pRgn, 0); } else { nxagentGCPriv(pGCSrc)->pPixmap->refcnt++; nxagentChangeClip(pGCDst, CT_PIXMAP, nxagentGCPriv(pGCSrc)->pPixmap, 0); } break; case CT_PIXMAP: #ifdef WARNING fprintf(stderr, "nxagentCopyClip: WARNING! Not incrementing counter for virtual pixmap at [%p].\n", (void *) nxagentVirtualPixmap((PixmapPtr) pGCSrc->clientClip)); #endif ((PixmapPtr) pGCSrc->clientClip)->refcnt++; nxagentChangeClip(pGCDst, CT_PIXMAP, pGCSrc->clientClip, 0); break; case CT_NONE: nxagentDestroyClip(pGCDst); break; } } static struct nxagentGCRec *nxagentGetFirstGC() { struct nxagentGCRec *tmp = nxagentGCList.first; if (nxagentGCList.size) { nxagentGCList.first = nxagentGCList.first -> next; nxagentGCList.size--; if (nxagentGCList.size == 0) { nxagentGCList.last = NULL; } } return tmp; } static void nxagentFreeGCRec(struct nxagentGCRec *t) { #ifdef TEST fprintf(stderr, "nxagentFreeGCRec: Freeing record at %p GC freed at %p.\n", (void *) t, (void *) t -> gc); #endif SAFE_free(t -> gc); SAFE_free(t); } static void nxagentRestoreGCRec(struct nxagentGCRec *t) { #ifdef TEST fprintf(stderr, "nxagentRestoreGCRec: Freeing record at %p GC freed at %p.\n", (void*)t, (void*)t -> gc); #endif SAFE_free(nxagentGC(t -> pGC)); nxagentGC(t -> pGC) = t -> gc; SAFE_free(t); } static void nxagentAddGCToList(GCPtr pGC) { struct nxagentGCRec *tempGC = malloc(sizeof(struct nxagentGCRec)); if (tempGC == NULL) { FatalError("nxagentAddGCToList: malloc failed."); } #ifdef TEST fprintf(stderr, "nxagentAddGCToList: Adding GC %p to list at memory %p list size is %d.\n", (void *) pGC, (void *) tempGC, nxagentGCList.size); #endif tempGC -> pGC = pGC; tempGC -> gc = nxagentGC(pGC); tempGC -> next = NULL; if (nxagentGCList.size == 0 || nxagentGCList.first == NULL || nxagentGCList.last == NULL) { nxagentGCList.first = tempGC; } else { nxagentGCList.last -> next = tempGC; } nxagentGCList.last = tempGC; nxagentGCList.size++; } void nxagentFreeGCList(void) { struct nxagentGCRec *tempGC; #ifdef TEST fprintf(stderr, "nxagentFreeGCList: List size is %d first elt at %p last elt at %p.\n", nxagentGCList.size, (void*)nxagentGCList.first, (void*)nxagentGCList.last); #endif while ((tempGC = nxagentGetFirstGC())) { nxagentFreeGCRec(tempGC); } } static void nxagentRestoreGCList(void) { struct nxagentGCRec *tempGC; #ifdef TEST fprintf(stderr, "nxagentRestoreGCList: List size is %d first elt at %p last elt at %p.\n", nxagentGCList.size, (void*)nxagentGCList.first, (void*)nxagentGCList.last); #endif while ((tempGC = nxagentGetFirstGC())) { nxagentRestoreGCRec(tempGC); } } int nxagentDestroyNewGCResourceType(void * p, XID id) { /* * Address of the destructor is set in Init.c. */ #ifdef TEST fprintf(stderr, "nxagentDestroyNewGCResourceType: Destroying mirror id [%u] for GC at [%p].\n", nxagentGCPriv((GCPtr) p) -> mid, (void *) p); #endif nxagentGCPriv((GCPtr) p) -> mid = None; return 1; } #define SETGCVAL(mask, member, val) valuemask |= mask; values.member = (val) static void nxagentReconnectGC(void *param0, XID param1, void * param2) { GCPtr pGC = (GCPtr) param0; Bool *pBool = (Bool*)param2; if (pGC == NULL || !*pBool) { return; } if (nxagentGC(pGC)) { nxagentAddGCToList(pGC); } else { #ifdef WARNING fprintf(stderr, "nxagentReconnectGC: GCRec %p doesn't have a valid pointer to GC data.\n", (void*)pGC); #endif } #ifdef DEBUG fprintf(stderr, "nxagentReconnectGC: GC at [%p].\n", (void *) pGC); #endif XGCValues values = {0}; unsigned long valuemask = 0; SETGCVAL(GCFunction, function, pGC->alu); SETGCVAL(GCPlaneMask, plane_mask, pGC->planemask); SETGCVAL(GCForeground, foreground, nxagentPixel(pGC->fgPixel)); SETGCVAL(GCBackground, background, nxagentPixel(pGC->bgPixel)); SETGCVAL(GCLineWidth, line_width, pGC->lineWidth); SETGCVAL(GCLineStyle, line_style, pGC->lineStyle); SETGCVAL(GCCapStyle, cap_style, pGC->capStyle); SETGCVAL(GCJoinStyle, join_style, pGC->joinStyle); SETGCVAL(GCFillStyle, fill_style, pGC->fillStyle); SETGCVAL(GCFillRule, fill_rule, pGC->fillRule); if (!pGC -> tileIsPixel && (pGC -> tile.pixmap != NULL)) { if (nxagentPixmapIsVirtual(pGC -> tile.pixmap)) { SETGCVAL(GCTile, tile, nxagentPixmap(nxagentRealPixmap(pGC -> tile.pixmap))); } else { SETGCVAL(GCTile, tile, nxagentPixmap(pGC -> tile.pixmap)); } } if (pGC->stipple != NULL) { if (nxagentPixmapIsVirtual(pGC -> stipple)) { #ifdef TEST fprintf(stderr, "nxagentReconnectGC: Reconnecting virtual stipple [%p] for GC [%p].\n", (void *) pGC -> stipple, (void *) pGC); #endif if (nxagentPixmap(nxagentRealPixmap(pGC -> stipple)) == 0) { nxagentReconnectPixmap(nxagentRealPixmap(pGC -> stipple), 0, pBool); } SETGCVAL(GCStipple, stipple, nxagentPixmap(nxagentRealPixmap(pGC -> stipple))); } else { #ifdef TEST fprintf(stderr, "nxagentReconnectGC: Reconnecting stipple [%p] for GC [%p].\n", (void *) pGC -> stipple, (void *) pGC); #endif if (nxagentPixmap(pGC -> stipple) == 0) { nxagentReconnectPixmap(pGC -> stipple, 0, pBool); } SETGCVAL(GCStipple, stipple, nxagentPixmap(pGC->stipple)); } } SETGCVAL(GCTileStipXOrigin, ts_x_origin, pGC->patOrg.x); SETGCVAL(GCTileStipYOrigin, ts_y_origin, pGC->patOrg.y); if (pGC->font != NULL) { SETGCVAL(GCFont, font, nxagentFont(pGC->font)); } SETGCVAL(GCSubwindowMode, subwindow_mode, pGC->subWindowMode); SETGCVAL(GCGraphicsExposures, graphics_exposures, pGC->graphicsExposures); SETGCVAL(GCClipXOrigin, clip_x_origin, pGC->clipOrg.x); SETGCVAL(GCClipYOrigin, clip_y_origin, pGC->clipOrg.y); valuemask |= GCClipMask; /* FIXME: where's the ClipMask pixmap?? */ SETGCVAL(GCDashOffset, dash_offset, pGC->dashOffset); if (pGC->dash != NULL) { SETGCVAL(GCDashList, dashes, *pGC->dash); } SETGCVAL(GCArcMode, arc_mode, pGC->arcMode); if ((nxagentGC(pGC) = XCreateGC(nxagentDisplay, nxagentDefaultDrawables[pGC->depth], valuemask, &values)) == NULL) { *pBool = False; } nxagentReconnectClip(pGC, pGC -> clientClipType, pGC -> clientClip, nxagentGCPriv(pGC) -> nClipRects); #ifdef DEBUG XSync(nxagentDisplay, 0); #endif } Bool nxagentReconnectAllGCs(void *p0) { Bool GCSuccess = True; #ifdef DEBUG fprintf(stderr, "nxagentReconnectAllGCs\n"); #endif /* * The resource type RT_NX_GC is created on the server client only, * so we can avoid to loop through all the clients. */ FindClientResourcesByType(clients[serverClient -> index], RT_NX_GC, nxagentReconnectGC, &GCSuccess); for (int cid = 0; (cid < MAXCLIENTS) && GCSuccess; cid++) { if (clients[cid]) { #ifdef TEST fprintf(stderr, "nxagentReconnectAllGCs: Going to reconnect GC of client [%d].\n", cid); #endif FindClientResourcesByType(clients[cid], RT_GC, nxagentReconnectGC, &GCSuccess); } } #ifdef TEST fprintf(stderr, "nxagentReconnectAllGCs: GCs reconnection completed.\n"); #endif return GCSuccess; } void nxagentDisconnectGC(void * p0, XID x1, void * p2) { GCPtr pGC = (GCPtr) p0; Bool* pBool = (Bool*) p2; if (!*pBool || !pGC) { if (!pGC) { #ifdef WARNING fprintf(stderr, "nxagentDisconnectGC: WARNING! pGC is NULL.\n"); #endif } return; } if (pGC -> stipple) { PixmapPtr pMap = pGC -> stipple; nxagentDisconnectPixmap(nxagentRealPixmap(pMap), 0, pBool); } } Bool nxagentDisconnectAllGCs(void) { Bool success = True; #ifdef DEBUG fprintf(stderr, "nxagentDisconnectAllGCs\n"); #endif /* * The resource type RT_NX_GC is created on the server client only, * so we can avoid to loop through all the clients. */ FindClientResourcesByType(clients[serverClient -> index], RT_NX_GC, (FindResType) nxagentDisconnectGC, &success); for (int cid = 0; (cid < MAXCLIENTS) && success; cid++) { if (clients[cid]) { #ifdef TEST fprintf(stderr, "nxagentDisconnectAllGCs: Going to disconnect GC of client [%d].\n", cid); #endif FindClientResourcesByType(clients[cid], RT_GC, (FindResType) nxagentDisconnectGC, &success); } } #ifdef TEST fprintf(stderr, "nxagentDisconnectAllGCs: GCs disconnection completed.\n"); #endif nxagentRestoreGCList(); nxagentDisconnectGraphicContexts(); return success; } static void nxagentReconnectClip(GCPtr pGC, int type, void * pValue, int nRects) { #ifdef TEST fprintf(stderr, "nxagentReconnectClip: going to change clip on GC [%p]\n", (void *) pGC); #endif #ifdef DEBUG fprintf(stderr, "nxagentReconnectClip: Type is [%s].\n", (type == CT_NONE) ? "CT_NONE" : (type == CT_REGION) ? "CT_REGION" : (type == CT_PIXMAP) ? "CT_REGION" : "UNKNOWN"); #endif switch(type) { case CT_NONE: XSetClipMask(nxagentDisplay, nxagentGC(pGC), None); break; case CT_REGION: if (nxagentGCPriv(pGC)->pPixmap == NULL) { nRects = RegionNumRects((RegionPtr)pValue); int size = nRects * sizeof(XRectangle *); XRectangle *pRects = (XRectangle *) malloc(size); BoxPtr pBox = RegionRects((RegionPtr)pValue); for (int i = nRects; i-- > 0;) { pRects[i].x = pBox[i].x1; pRects[i].y = pBox[i].y1; pRects[i].width = pBox[i].x2 - pBox[i].x1; pRects[i].height = pBox[i].y2 - pBox[i].y1; } /* * Originally, the clip origin area were 0,0 but it didn't * work with kedit and family, because it got the clip mask of * the pixmap all traslated. */ XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC -> clipOrg.x, pGC -> clipOrg.y, pRects, nRects, Unsorted); SAFE_free(pRects); } else { XSetClipMask(nxagentDisplay, nxagentGC(pGC), nxagentPixmap(nxagentGCPriv(pGC)->pPixmap)); XSetClipOrigin(nxagentDisplay, nxagentGC(pGC), pGC -> clipOrg.x, pGC -> clipOrg.y); } break; case CT_PIXMAP: XSetClipMask(nxagentDisplay, nxagentGC(pGC), nxagentPixmap((PixmapPtr)pValue)); XSetClipOrigin(nxagentDisplay, nxagentGC(pGC), pGC -> clipOrg.x, pGC -> clipOrg.y); pGC->clientClip = (void *) (*pGC->pScreen->BitmapToRegion)((PixmapPtr) pValue); nxagentGCPriv(pGC)->pPixmap = (PixmapPtr)pValue; pValue = pGC->clientClip; type = CT_REGION; break; case CT_UNSORTED: XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC->clipOrg.x, pGC->clipOrg.y, (XRectangle *)pValue, nRects, Unsorted); break; case CT_YSORTED: XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC->clipOrg.x, pGC->clipOrg.y, (XRectangle *)pValue, nRects, YSorted); break; case CT_YXSORTED: XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC->clipOrg.x, pGC->clipOrg.y, (XRectangle *)pValue, nRects, YXSorted); break; case CT_YXBANDED: XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC->clipOrg.x, pGC->clipOrg.y, (XRectangle *)pValue, nRects, YXBanded); break; } switch(type) { default: break; case CT_UNSORTED: case CT_YSORTED: case CT_YXSORTED: case CT_YXBANDED: /* * other parts of server can only deal with CT_NONE, CT_PIXMAP * and CT_REGION client clips. */ pGC->clientClip = (void *) RegionFromRects(nRects, (xRectangle *)pValue, type); SAFE_free(pValue); pValue = pGC->clientClip; type = CT_REGION; break; } pGC->clientClipType = type; pGC->clientClip = pValue; nxagentGCPriv(pGC)->nClipRects = nRects; } static int nxagentCompareRegions(RegionPtr r1, RegionPtr r2) { /* * It returns 1 if regions are equal, 0 otherwise */ if (r1 == NULL && r2 == NULL) { return 1; } if ((r1 == NULL) || (r2 == NULL)) { return 0; } if (RegionNumRects(r1) != RegionNumRects(r2)) { return 0; } else if (RegionNumRects(r1) == 0) { return 1; } else if ((*RegionExtents(r1)).x1 != (*RegionExtents(r2)).x1) return 0; else if ((*RegionExtents(r1)).x2 != (*RegionExtents(r2)).x2) return 0; else if ((*RegionExtents(r1)).y1 != (*RegionExtents(r2)).y1) return 0; else if ((*RegionExtents(r1)).y2 != (*RegionExtents(r2)).y2) return 0; else { for (int i = 0; i < RegionNumRects(r1); i++) { if (RegionRects(r1)[i].x1 != RegionRects(r2)[i].x1) return 0; else if (RegionRects(r1)[i].x2 != RegionRects(r2)[i].x2) return 0; else if (RegionRects(r1)[i].y1 != RegionRects(r2)[i].y1) return 0; else if (RegionRects(r1)[i].y2 != RegionRects(r2)[i].y2) return 0; } } return 1; } /* * This function have to be called in the place of GetScratchGC if the * GC will be used to perform operations also on the remote X Server. * This is why we call the XChangeGC at the end of the function. */ GCPtr nxagentGetScratchGC(unsigned depth, ScreenPtr pScreen) { /* * The GC trap is temporarily disabled in order to allow the remote * clipmask reset requested by GetScratchGC(). */ int nxagentSaveGCTrap = nxagentGCTrap; nxagentGCTrap = 0; GCPtr pGC = GetScratchGC(depth, pScreen); nxagentGCTrap = nxagentSaveGCTrap; if (pGC == NULL) { #ifdef WARNING fprintf(stderr, "nxagentGetScratchGC: Failed to retrieve the scratch GC.\n"); #endif return NULL; } unsigned long valuemask = 0; XGCValues values = {0}; SETGCVAL(GCFunction, function, pGC -> alu); SETGCVAL(GCPlaneMask, plane_mask, pGC -> planemask); SETGCVAL(GCForeground, foreground, nxagentPixel(pGC -> fgPixel)); SETGCVAL(GCBackground, background, nxagentPixel(pGC -> bgPixel)); SETGCVAL(GCLineWidth, line_width, pGC -> lineWidth); SETGCVAL(GCLineStyle, line_style, pGC -> lineStyle); SETGCVAL(GCCapStyle, cap_style, pGC -> capStyle); SETGCVAL(GCJoinStyle, join_style, pGC -> joinStyle); SETGCVAL(GCFillStyle, fill_style, pGC -> fillStyle); SETGCVAL(GCFillRule, fill_rule, pGC -> fillRule); SETGCVAL(GCArcMode, arc_mode, pGC -> arcMode); SETGCVAL(GCTileStipXOrigin, ts_x_origin, pGC -> patOrg.x); SETGCVAL(GCTileStipYOrigin, ts_y_origin, pGC -> patOrg.y); SETGCVAL(GCSubwindowMode, subwindow_mode, pGC -> subWindowMode); SETGCVAL(GCGraphicsExposures, graphics_exposures, pGC -> graphicsExposures); SETGCVAL(GCClipXOrigin, clip_x_origin, pGC -> clipOrg.x); SETGCVAL(GCClipYOrigin, clip_y_origin, pGC -> clipOrg.y); /* The GCClipMask is set to none inside the GetScratchGC() function. */ /* FIXME: What about GCDashOffset? */ XChangeGC(nxagentDisplay, nxagentGC(pGC), valuemask, &values); memset(&(nxagentGCPriv(pGC) -> lastServerValues), 0, sizeof(XGCValues)); return pGC; } /* * This function is only a wrapper for FreeScratchGC. */ void nxagentFreeScratchGC(GCPtr pGC) { if (pGC == NULL) { #ifdef WARNING fprintf(stderr, "nxagentFreeScratchGC: WARNING! pGC is NULL.\n"); #endif return; } FreeScratchGC(pGC); } /* * The GCs belonging to this list are used only in the synchronization * put images, to be sure they preserve the default values and to * avoid XChangeGC() requests. */ GCPtr nxagentGetGraphicContext(DrawablePtr pDrawable) { for (int i = 0; i < nxagentGraphicContextsSize; i++) { if (pDrawable -> depth == nxagentGraphicContexts[i].depth) { #ifdef DEBUG fprintf(stderr, "nxagentGetGraphicContext: Found a valid GC at [%p] for depth [%d].\n", (void *) nxagentGraphicContexts[i].pGC, pDrawable -> depth); #endif /* * Reconnect the GC if needed. */ if (nxagentGraphicContexts[i].dirty == 1) { #ifdef DEBUG fprintf(stderr, "nxagentGetGraphicContext: Going to reconnect the GC.\n"); #endif int result = 1; nxagentReconnectGC(nxagentGraphicContexts[i].pGC, (XID) 0, &result); if (result == 0) { #ifdef WARNING fprintf(stderr, "nxagentGetGraphicContext: WARNING! Failed to reconnect the GC.\n"); #endif return NULL; } nxagentGraphicContexts[i].dirty = 0; } return nxagentGraphicContexts[i].pGC; } } return nxagentCreateGraphicContext(pDrawable -> depth); } GCPtr nxagentCreateGraphicContext(int depth) { /* * We have not found a GC, so we have to spread the list and add a * new GC. */ nxagentGraphicContextsPtr nxagentGCs = realloc(nxagentGraphicContexts, (nxagentGraphicContextsSize + 1) * sizeof(nxagentGraphicContextsRec)); if (nxagentGCs == NULL) { #ifdef WARNING fprintf(stderr, "nxagentCreateGraphicContext: Cannot allocate memory for a GC.\n"); #endif return NULL; } nxagentGraphicContexts = nxagentGCs; GCPtr pGC = CreateScratchGC(nxagentDefaultScreen, depth); if (pGC == NULL) { #ifdef WARNING fprintf(stderr, "nxagentCreateGraphicContext: Failed to create a GC for depth [%d].\n", depth); #endif return NULL; } /* * Color used in nxagentFillRemoteRegion(). */ XID attributes[2]; attributes[0] = 0xc1c1c1; if (depth == 15 || depth == 16) { Color32to16(attributes[0]); } /* * The IncludeInferiors property is useful to solve problems when * synchronizing windows covered by an invisible child. */ attributes[1] = IncludeInferiors; ChangeGC(pGC, GCForeground | GCSubwindowMode, attributes); nxagentGraphicContexts[nxagentGraphicContextsSize].pGC = pGC; nxagentGraphicContexts[nxagentGraphicContextsSize].depth = depth; nxagentGraphicContexts[nxagentGraphicContextsSize].dirty = 0; nxagentGraphicContextsSize++; #ifdef DEBUG fprintf(stderr, "nxagentCreateGraphicContext: GC [%p] for depth [%d] added to the list of size [%d].\n", (void *) pGC, depth, nxagentGraphicContextsSize); #endif return pGC; } /* * This initialization is called in the InitOutput() function * immediately after opening the screen, which is used to create the * GCs. */ void nxagentAllocateGraphicContexts(void) { int *depths = nxagentDepths; for (int i = 0; i < nxagentNumDepths; i++) { nxagentCreateGraphicContext(*depths); depths++; } } void nxagentDisconnectGraphicContexts(void) { for (int i = 0; i < nxagentGraphicContextsSize; i++) { nxagentGraphicContexts[i].dirty = 1; } return; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/GCOps.c0000644000000000000000000017111213614532331017777 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #include "scrnintstr.h" #include "resource.h" #include "dixstruct.h" #include "../../fb/fb.h" #include "Agent.h" #include "Composite.h" #include "Display.h" #include "Visual.h" #include "Drawable.h" #include "Pixmaps.h" #include "GCs.h" #include "Image.h" #include "Font.h" #include "Events.h" #include "Client.h" #include "Trap.h" #include "Args.h" #include "Screen.h" #include "Utils.h" #include "compext/Compext.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP /* * Temporarily set/reset the trap. */ static int nxagentSaveGCTrap; #define SET_GC_TRAP() \ { \ nxagentSaveGCTrap = nxagentGCTrap;\ \ nxagentGCTrap = 1; \ } #define RESET_GC_TRAP() \ { \ nxagentGCTrap = nxagentSaveGCTrap; \ } /* * This is currently unused. */ RegionPtr nxagentBitBlitHelper(GC *pGC); /* * The NX agent implementation of the X server's graphics functions. */ void nxagentFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans, xPoint *pPoints, int *pWidths, int fSorted) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to FillSpans on FB pixmap [%p].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable)); #endif fbFillSpans(nxagentVirtualDrawable(pDrawable), pGC, nSpans, pPoints, pWidths, fSorted); } else { fbFillSpans(pDrawable, pGC, nSpans, pPoints, pWidths, fSorted); } } void nxagentSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc, xPoint *pPoints, int *pWidths, int nSpans, int fSorted) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to SetSpans on FB pixmap [%p].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable)); #endif fbSetSpans(nxagentVirtualDrawable(pDrawable), pGC, pSrc, pPoints, pWidths, nSpans, fSorted); } else { fbSetSpans(pDrawable, pGC, pSrc, pPoints, pWidths, nSpans, fSorted); } } void nxagentGetSpans(DrawablePtr pDrawable, int maxWidth, xPoint *pPoints, int *pWidths, int nSpans, char *pBuffer) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: going to GetSpans on FB pixmap [%p].\n", (void *) nxagentVirtualDrawable(pDrawable)); #endif fbGetSpans(nxagentVirtualDrawable(pDrawable), maxWidth, pPoints, pWidths, nSpans, pBuffer); } else { fbGetSpans(pDrawable, maxWidth, pPoints, pWidths, nSpans, pBuffer); } } void nxagentQueryBestSize(int class, unsigned short *pwidth, unsigned short *pheight, ScreenPtr pScreen) { unsigned width, test; switch(class) { case CursorShape: if (*pwidth > pScreen->width) *pwidth = pScreen->width; if (*pheight > pScreen->height) *pheight = pScreen->height; break; case TileShape: case StippleShape: width = *pwidth; if (!width) break; /* Return the closest power of two not less than what they gave me */ test = 0x80000000; /* Find the highest 1 bit in the width given */ while(!(test & width)) test >>= 1; /* If their number is greater than that, bump up to the next * power of two */ if((test - 1) & width) test <<= 1; *pwidth = test; /* We don't care what height they use */ break; } } RegionPtr nxagentBitBlitHelper(GC *pGC) { #ifdef TEST fprintf(stderr, "nxagentBitBlitHelper: Called for GC at [%p].\n", (void *) pGC); #endif /* * Force NullRegion. We consider enough the graphics expose events * generated internally by the nxagent server. */ #ifdef TEST fprintf(stderr, "nxagentBitBlitHelper: WARNING! Skipping check on exposures events.\n"); #endif return NullRegion; } /* * The deferring of X_RenderCompositeTrapezoids caused an ugly effect * on pulldown menu: as the background may be not synchronized, the * text floats in an invisible window. To avoid such effects, we use a * system to guess if the destination target of a copy area is a * popup, by assuming that those kind of windows use the override * redirect property. */ int nxagentWindowIsPopup(DrawablePtr pDrawable) { if (pDrawable -> type != DRAWABLE_WINDOW) { return 0; } int windowIsPopup = 0; if (((WindowPtr) pDrawable) -> overrideRedirect == 1) { windowIsPopup = 1; } else { WindowPtr parent = ((WindowPtr) pDrawable) -> parent; /* * Go up on the tree until a parent exists or 4 windows has been * checked. This seems a good limit to up children's popup. */ int level = 0; while (parent != NULL && ++level <= 4) { #ifdef DEBUG fprintf(stderr, "nxagentWindowIsPopup: Window [%p] has parent [%p] in tree with OverrideRedirect [%d] " " Level [%d].\n", (void *) pDrawable, (void *) parent, parent -> overrideRedirect, level); #endif if (parent -> overrideRedirect == 1) { windowIsPopup = 1; break; } parent = parent -> parent; } } #ifdef TEST fprintf(stderr, "nxagentWindowIsPopup: Window [%p] %s to be a popup.\n", (void *) pDrawable, windowIsPopup == 1 ? "seems" : "does not seem"); #endif return windowIsPopup; } /* * This function returns 1 if the XCopyArea request must be skipped. */ int nxagentDeferCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { /* * If the destination drawable is a popup window, we try to * synchronize the source drawable to show a nice menu. Anyway if * this synchronization breaks, the copy area is handled in the * normal way. */ /* FIXME: The popup could be synchronized with one single put image, clipped to the corrupted region. As an intermediate step, the pixmap to synchronize could be copied on a cleared scratch pixmap, in order to have a solid color in the clipped regions. */ if (nxagentOption(DeferLevel) >= 2 && pSrcDrawable -> type == DRAWABLE_PIXMAP && nxagentPixmapContainTrapezoids((PixmapPtr) pSrcDrawable) == 1 && nxagentWindowIsPopup(pDstDrawable) == 1) { RegionPtr pSrcRegion = nxagentCreateRegion(pSrcDrawable, NULL, srcx, srcy, width, height); #ifdef DEBUG fprintf(stderr, "nxagentDeferCopyArea: Copying to a popup menu. Source region [%d,%d,%d,%d].\n", pSrcRegion -> extents.x1, pSrcRegion -> extents.y1, pSrcRegion -> extents.x2, pSrcRegion -> extents.y2); #endif RegionRec corruptedRegion; RegionInit(&corruptedRegion, NullBox, 1); RegionIntersect(&corruptedRegion, pSrcRegion, nxagentCorruptedRegion(pSrcDrawable)); if (RegionNil(&corruptedRegion) == 0) { #ifdef TEST fprintf(stderr, "nxagentDeferCopyArea: Forcing the synchronization of source drawable at [%p].\n", (void *) pSrcDrawable); #endif nxagentSynchronizeRegion(pSrcDrawable, &corruptedRegion, EVENT_BREAK, NULL); } RegionUninit(&corruptedRegion); nxagentFreeRegion(pSrcDrawable, pSrcRegion); if (nxagentDrawableStatus(pSrcDrawable) == Synchronized) { return 0; } } /* * We are going to decide if the source drawable must be * synchronized before using it, or if the copy will be clipped to * the synchronized source region. */ if ((pDstDrawable -> type == DRAWABLE_PIXMAP && nxagentOption(DeferLevel) > 0) || nxagentOption(DeferLevel) >= 3) { RegionPtr pClipRegion = nxagentCreateRegion(pSrcDrawable, NULL, srcx, srcy, width, height); /* * We called this variable pCorruptedRegion because in the worst * case the corrupted region will be equal to the destination * region. The GC's clip mask is used to narrow the destination. */ RegionPtr pCorruptedRegion = nxagentCreateRegion(pDstDrawable, pGC, dstx, dsty, width, height); #ifdef DEBUG fprintf(stderr, "nxagentDeferCopyArea: Copy area source region is [%d,%d,%d,%d].\n", pClipRegion -> extents.x1, pClipRegion -> extents.y1, pClipRegion -> extents.x2, pClipRegion -> extents.y2); #endif RegionSubtract(pClipRegion, pClipRegion, nxagentCorruptedRegion(pSrcDrawable)); #ifdef DEBUG fprintf(stderr, "nxagentDeferCopyArea: Usable copy area source region is [%d,%d,%d,%d].\n", pClipRegion -> extents.x1, pClipRegion -> extents.y1, pClipRegion -> extents.x2, pClipRegion -> extents.y2); #endif if (pGC -> clientClip == NULL || pGC -> clientClipType != CT_REGION) { #ifdef WARNING if (pGC -> clientClipType != CT_NONE) { fprintf(stderr, "nxagentDeferCopyArea: WARNING! pGC [%p] has a clip type [%d].\n", (void *) pGC, pGC -> clientClipType); } #endif RegionTranslate(pClipRegion, dstx - srcx, dsty - srcy); } else { RegionRec tmpRegion; RegionInit(&tmpRegion, NullBox, 1); #ifdef DEBUG fprintf(stderr, "nxagentDeferCopyArea: Going to modify the original GC [%p] with clip mask " "[%d,%d,%d,%d] and origin [%d,%d].\n", (void *) pGC, ((RegionPtr) pGC -> clientClip) -> extents.x1, ((RegionPtr) pGC -> clientClip) -> extents.y1, ((RegionPtr) pGC -> clientClip) -> extents.x2, ((RegionPtr) pGC -> clientClip) -> extents.y2, pGC -> clipOrg.x, pGC -> clipOrg.y); #endif RegionCopy(&tmpRegion, (RegionPtr) pGC -> clientClip); if (pGC -> clipOrg.x != 0 || pGC -> clipOrg.y != 0) { RegionTranslate(&tmpRegion, pGC -> clipOrg.x, pGC -> clipOrg.y); } RegionTranslate(pClipRegion, dstx - srcx, dsty - srcy); RegionIntersect(pClipRegion, &tmpRegion, pClipRegion); RegionUninit(&tmpRegion); } /* * The corrupted region on the destination drawable is composed by * the areas of the destination that we are not going to copy. */ RegionSubtract(pCorruptedRegion, pCorruptedRegion, pClipRegion); #ifdef DEBUG fprintf(stderr, "nxagentDeferCopyArea: Recomputed clip region is [%d,%d,%d,%d][%d].\n", pClipRegion -> extents.x1, pClipRegion -> extents.y1, pClipRegion -> extents.x2, pClipRegion -> extents.y2, RegionNumRects(pClipRegion)); fprintf(stderr, "nxagentDeferCopyArea: Inherited corrupted region is [%d,%d,%d,%d][%d].\n", pCorruptedRegion -> extents.x1, pCorruptedRegion -> extents.y1, pCorruptedRegion -> extents.x2, pCorruptedRegion -> extents.y2, RegionNumRects(pCorruptedRegion)); #endif /* * The destination drawable inherits both the synchronized and the * corrupted region. */ if (RegionNil(pClipRegion) == 0) { nxagentUnmarkCorruptedRegion(pDstDrawable, pClipRegion); } if (RegionNil(pCorruptedRegion) == 0) { nxagentMarkCorruptedRegion(pDstDrawable, pCorruptedRegion); } if (RegionNil(pClipRegion) == 0) { Bool pClipRegionFree = True; /* * As we want to copy only the synchronized areas of the source * drawable, we create a new GC copying the original one and * setting a new clip mask. */ GCPtr targetGC = GetScratchGC(pDstDrawable -> depth, pDstDrawable -> pScreen); ValidateGC(pDstDrawable, targetGC); CopyGC(pGC, targetGC, GCFunction | GCPlaneMask | GCSubwindowMode | GCClipXOrigin | GCClipYOrigin | GCClipMask | GCForeground | GCBackground | GCGraphicsExposures); if (RegionNumRects(pClipRegion) == 1) { /* * If the region to copy is formed by one rectangle, we change * only the copy coordinates. */ srcx = srcx + pClipRegion -> extents.x1 - dstx; srcy = srcy + pClipRegion -> extents.y1 - dsty; dstx = pClipRegion -> extents.x1; dsty = pClipRegion -> extents.y1; width = pClipRegion -> extents.x2 - pClipRegion -> extents.x1; height = pClipRegion -> extents.y2 - pClipRegion -> extents.y1; } else { CARD32 targetAttributes[2]; /* * Setting the clip mask origin. This operation must precede * the clip change, because the origin information is used in * the XSetClipRectangles(). */ targetAttributes[0] = 0; targetAttributes[1] = 0; ChangeGC(targetGC, GCClipXOrigin | GCClipYOrigin, targetAttributes); /* * Setting the new clip mask. */ nxagentChangeClip(targetGC, CT_REGION, pClipRegion, 0); /* * Next call to nxagentChangeClip() will destroy pClipRegion, * so it has not to be freed. */ pClipRegionFree = False; #ifdef DEBUG fprintf(stderr, "nxagentDeferCopyArea: Going to execute a copy area with clip mask " "[%d,%d,%d,%d] and origin [%d,%d].\n", ((RegionPtr) targetGC -> clientClip) -> extents.x1, ((RegionPtr) targetGC -> clientClip) -> extents.y1, ((RegionPtr) targetGC -> clientClip) -> extents.x2, ((RegionPtr) targetGC -> clientClip) -> extents.y2, targetGC -> clipOrg.x, targetGC -> clipOrg.y); #endif } XCopyArea(nxagentDisplay, nxagentDrawable(pSrcDrawable), nxagentDrawable(pDstDrawable), nxagentGC(targetGC), srcx, srcy, width, height, dstx, dsty); nxagentChangeClip(targetGC, CT_NONE, NullRegion, 0); if (pClipRegionFree == True) { nxagentFreeRegion(pSrcDrawable, pClipRegion); } FreeScratchGC(targetGC); } else { #ifdef TEST fprintf(stderr, "nxagentDeferCopyArea: The clipped region is NIL. CopyArea skipped.\n"); #endif /* * The pClipRegion is destroyed calling nxagentChangeClip(), so * we deallocate it explicitly only if we don't change the clip. */ nxagentFreeRegion(pSrcDrawable, pClipRegion); } nxagentFreeRegion(pSrcDrawable, pCorruptedRegion); return 1; } else { RegionPtr pSrcRegion = nxagentCreateRegion(pSrcDrawable, NULL, srcx, srcy, width, height); #ifdef DEBUG fprintf(stderr, "nxagentDeferCopyArea: Source region [%d,%d,%d,%d].\n", pSrcRegion -> extents.x1, pSrcRegion -> extents.y1, pSrcRegion -> extents.x2, pSrcRegion -> extents.y2); #endif RegionRec corruptedRegion; RegionInit(&corruptedRegion, NullBox, 1); RegionIntersect(&corruptedRegion, pSrcRegion, nxagentCorruptedRegion(pSrcDrawable)); if (RegionNil(&corruptedRegion) == 0) { #ifdef TEST fprintf(stderr, "nxagentDeferCopyArea: Forcing the synchronization of source drawable at [%p].\n", (void *) pSrcDrawable); #endif nxagentSynchronizeRegion(pSrcDrawable, &corruptedRegion /*pSrcRegion*/, NEVER_BREAK, NULL); } RegionUninit(&corruptedRegion); nxagentFreeRegion(pSrcDrawable, pSrcRegion); } return 0; } RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { int skip = 0; #ifdef TEST fprintf(stderr, "nxagentCopyArea: Image src [%s:%p], dst [%s:%p] (%d,%d) -> (%d,%d) size (%d,%d)\n", (pSrcDrawable -> type == DRAWABLE_PIXMAP) ? "PIXMAP" : "WINDOW", (void *) pSrcDrawable, (pDstDrawable -> type == DRAWABLE_PIXMAP) ? "PIXMAP" : "WINDOW", (void *) pDstDrawable, srcx, srcy, dstx, dsty, width, height); #endif /* * Here, before using fbDoCopy() called by fbCopyArea(), it should be * provided that the cast in fbDoCopy() from int to short int would * not cut off significative bits. */ if (dstx + pDstDrawable->x + width > 32767) { #ifdef WARNING fprintf(stderr, "nxagentCopyArea: x2 exceeding short int.\n"); #endif width = 32767 - dstx - pDstDrawable->x; if (width <= 0) { #ifdef TEST fprintf(stderr, "nxagentCopyArea: Returning null on x2 check.\n"); #endif return NullRegion; } } if (dstx + pDstDrawable->x < -32768) { #ifdef WARNING fprintf(stderr, "nxagentCopyArea: x1 exceeding short int.\n"); #endif width += pDstDrawable->x + dstx + 32768; srcx -= pDstDrawable->x + dstx + 32768; dstx = -32768 - pDstDrawable->x; if (width <= 0) { #ifdef TEST fprintf(stderr, "nxagentCopyArea: Returning null on x1 check.\n"); #endif return NullRegion; } } if (dsty + pDstDrawable->y + height > 32767) { #ifdef WARNING fprintf(stderr, "nxagentCopyArea: y2 exceeding short int.\n"); #endif height = 32767 - dsty - pDstDrawable->y; if (height <= 0) { #ifdef TEST fprintf(stderr, "nxagentCopyArea: Returning null on y2 check.\n"); #endif return NullRegion; } } if (dsty + pDstDrawable->y < -32768) { #ifdef WARNING fprintf(stderr, "nxagentCopyArea: y1 exceeding short int.\n"); #endif height += 32768 + pDstDrawable->y + dsty; srcy -= 32768 + pDstDrawable->y + dsty; dsty = -32768 - pDstDrawable->y; if (height <= 0) { #ifdef TEST fprintf(stderr, "nxagentCopyArea: Returning null on y1 check.\n"); #endif return NullRegion; } } if (nxagentGCTrap == 1 || nxagentShmTrap == 1) { if (pSrcDrawable -> type == DRAWABLE_PIXMAP && pDstDrawable -> type == DRAWABLE_PIXMAP) { return fbCopyArea(nxagentVirtualDrawable(pSrcDrawable), nxagentVirtualDrawable(pDstDrawable), pGC, srcx, srcy, width, height, dstx, dsty); } else if (pSrcDrawable -> type == DRAWABLE_PIXMAP) { return fbCopyArea(nxagentVirtualDrawable(pSrcDrawable), pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); } else if (pDstDrawable -> type == DRAWABLE_PIXMAP) { return fbCopyArea(pSrcDrawable, nxagentVirtualDrawable(pDstDrawable), pGC, srcx, srcy, width, height, dstx, dsty); } else { return fbCopyArea(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); } return NullRegion; } /* * Try to detect if the copy area is to a window that is unmapped or * fully covered. Similarly to the check in Image.c, this is of * little use. */ if (nxagentOption(IgnoreVisibility) == 0 && pDstDrawable -> type == DRAWABLE_WINDOW && (nxagentWindowIsVisible((WindowPtr) pDstDrawable) == 0 || (nxagentDefaultWindowIsVisible() == 0 && nxagentCompositeEnable == 0))) { #ifdef TEST fprintf(stderr, "nxagentCopyArea: Prevented operation on fully obscured window at [%p].\n", (void *) pDstDrawable); #endif return NullRegion; } /* * If the pixmap is on shared memory, we can't know if the pixmap * content is changed and so have to translate the operation in a * put image operation. This can seriously affect the performance. */ if (pSrcDrawable -> type == DRAWABLE_PIXMAP && nxagentIsShmPixmap((PixmapPtr) pSrcDrawable)) { char *data; int depth = pSrcDrawable -> depth; unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; int length = nxagentImageLength(width, height, format, 0, depth); if ((data = malloc(length)) == NULL) { #ifdef WARNING fprintf(stderr, "nxagentCopyArea: WARNING! Failed to allocate memory for the operation.\n"); #endif return NullRegion; } unsigned long planeMask = 0xffffffff; fbGetImage(nxagentVirtualDrawable(pSrcDrawable), srcx, srcy, width, height, format, planeMask, data); /* * If the source is a shared memory pixmap, put the image directly * to the destination. */ nxagentPutImage(pDstDrawable, pGC, depth, dstx, dsty, width, height, 0, format, data); #ifdef TEST fprintf(stderr,"nxagentCopyArea: Realize Pixmap %p virtual %p x %d y %d w %d h %d\n", (void *) pSrcDrawable, (void *) nxagentVirtualDrawable(pSrcDrawable), srcx, srcy, width, height); #endif SAFE_free(data); /* * If the source is a shared memory pixmap, the content of the * framebuffer has been placed directly on the destination so we * can skip the copy area operation. */ skip = 1; } #ifdef TEST fprintf(stderr, "nxagentCopyArea: Image src [%s:%p], dst [%s:%p] sx %d sy %d dx %d dy %d size w %d h %d\n", ((pSrcDrawable)->type == DRAWABLE_PIXMAP) ? "PIXMAP" : "WINDOW", (void *) pSrcDrawable, ((pDstDrawable)->type == DRAWABLE_PIXMAP) ? "PIXMAP" : "WINDOW", (void *) pDstDrawable, srcx, srcy, dstx, dsty, width, height); #endif if (skip == 0 && nxagentDrawableStatus(pSrcDrawable) == NotSynchronized) { skip = nxagentDeferCopyArea(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); } #ifdef TEST else { fprintf(stderr, "nxagentCopyArea: Source drawable at [%p] already synchronized.\n", (void *) pSrcDrawable); } #endif if (skip == 0) { XCopyArea(nxagentDisplay, nxagentDrawable(pSrcDrawable), nxagentDrawable(pDstDrawable), nxagentGC(pGC), srcx, srcy, width, height, dstx, dsty); /* * The copy area restored the synchronization status of * destination drawable. */ if (nxagentDrawableStatus(pDstDrawable) == NotSynchronized) { RegionPtr pDstRegion = nxagentCreateRegion(pDstDrawable, pGC, dstx, dsty, width, height); nxagentUnmarkCorruptedRegion(pDstDrawable, pDstRegion); nxagentFreeRegion(pDstDrawable, pDstRegion); } } if (nxagentDrawableContainGlyphs(pSrcDrawable) == 1) { nxagentSetDrawableContainGlyphs(pDstDrawable, 1); } if (pSrcDrawable -> type == DRAWABLE_PIXMAP) { nxagentIncreasePixmapUsageCounter((PixmapPtr) pSrcDrawable); } if (pSrcDrawable -> type == DRAWABLE_PIXMAP && pDstDrawable -> type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "nxagentCopyArea: Going to copy area from virtual pixmap [%p] to [%p]\n", (void *) nxagentVirtualDrawable(pSrcDrawable), (void *) nxagentVirtualDrawable(pDstDrawable)); #endif return fbCopyArea(nxagentVirtualDrawable(pSrcDrawable), nxagentVirtualDrawable(pDstDrawable), pGC, srcx, srcy, width, height, dstx, dsty); } else if (pSrcDrawable -> type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "nxagentCopyArea: Going to copy area from virtual pixmap [%p] to window [%p]\n", (void *) nxagentVirtualDrawable(pSrcDrawable), (void *) pDstDrawable); #endif return fbCopyArea(nxagentVirtualDrawable(pSrcDrawable), pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); } else if (pDstDrawable -> type == DRAWABLE_PIXMAP) { /* * If we are here the source drawable must be a window. */ if (((WindowPtr) pSrcDrawable) -> viewable) { #ifdef TEST fprintf(stderr, "nxagentCopyArea: Going to copy area from window [%p] to virtual pixmap [%p]\n", (void *) pSrcDrawable, (void *) nxagentVirtualDrawable(pDstDrawable)); #endif return fbCopyArea(pSrcDrawable, nxagentVirtualDrawable(pDstDrawable), pGC, srcx, srcy, width, height, dstx, dsty); } } else { /* * If we are here the source drawable must be a window. */ if (((WindowPtr) pSrcDrawable) -> viewable) { #ifdef TEST fprintf(stderr, "nxagentCopyArea: Going to copy area from window [%p] to window [%p]\n", (void *) pSrcDrawable, (void *) pDstDrawable); #endif return fbCopyArea(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); } } return miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, 0); } RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long plane) { int skip = 0; #ifdef TEST fprintf(stderr, "nxagentCopyPlane: Image src [%s:%p], dst [%s:%p] (%d,%d) -> (%d,%d) size (%d,%d)\n", ((pSrcDrawable)->type == DRAWABLE_PIXMAP) ? "PIXMAP" : "WINDOW", (void *) pSrcDrawable, ((pDstDrawable)->type == DRAWABLE_PIXMAP) ? "PIXMAP" : "WINDOW", (void *) pDstDrawable, srcx, srcy, dstx, dsty, width, height); #endif if (nxagentGCTrap == 1 || nxagentShmTrap == 1) { if (pSrcDrawable -> type == DRAWABLE_PIXMAP && pDstDrawable -> type == DRAWABLE_PIXMAP) { return fbCopyPlane(nxagentVirtualDrawable(pSrcDrawable), nxagentVirtualDrawable(pDstDrawable), pGC, srcx, srcy, width, height, dstx, dsty, plane); } else if (pSrcDrawable -> type == DRAWABLE_PIXMAP) { return fbCopyPlane(nxagentVirtualDrawable(pSrcDrawable), pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, plane); } else if (pDstDrawable -> type == DRAWABLE_PIXMAP) { return fbCopyPlane(pSrcDrawable, nxagentVirtualDrawable(pDstDrawable), pGC, srcx, srcy, width, height, dstx, dsty, plane); } else { return fbCopyPlane(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, plane); } return NullRegion; } /* * If the pixmap is on shared memory, we can't know if the pixmap * content is changed and so have to translate the operation in a * put image operation. This can seriously affect the performance. */ if (pSrcDrawable -> type == DRAWABLE_PIXMAP && nxagentIsShmPixmap((PixmapPtr) pSrcDrawable)) { char *data; int depth = pSrcDrawable -> depth; unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; int length = nxagentImageLength(width, height, format, 0, depth); if ((data = malloc(length)) == NULL) { #ifdef DEBUG fprintf(stderr, "nxagentCopyPlane: WARNING! Failed to allocate memory for the operation.\n"); #endif return 0; } unsigned long planeMask = 0xffffffff; fbGetImage(nxagentVirtualDrawable(pSrcDrawable), srcx, srcy, width, height, format, planeMask, data); /* * If the source is a shared memory pixmap, put the image directly * to the destination. */ nxagentPutImage(pDstDrawable, pGC, depth, dstx, dsty, width, height, 0, format, data); #ifdef TEST fprintf(stderr,"nxagentCopyPlane: Synchronize Pixmap %p virtual %p x %d y %d w %d h %d \n", (void *) pSrcDrawable, (void *) nxagentVirtualDrawable(pSrcDrawable), srcx, srcy, width, height); #endif SAFE_free(data); /* * If the source is a shared memory pixmap, the content of the * framebuffer has been placed directly on the destination so we * can skip the copy plane operation. */ skip = 1; } if (skip == 0 && nxagentDrawableStatus(pSrcDrawable) == NotSynchronized) { if (pDstDrawable -> type == DRAWABLE_PIXMAP && nxagentOption(DeferLevel) > 0) { RegionPtr pDstRegion = nxagentCreateRegion(pDstDrawable, pGC, dstx, dsty, width, height); nxagentMarkCorruptedRegion(pDstDrawable, pDstRegion); nxagentFreeRegion(pDstDrawable, pDstRegion); skip = 1; } else { RegionPtr pSrcRegion = nxagentCreateRegion(pSrcDrawable, NULL, srcx, srcy, width, height); RegionRec corruptedRegion; RegionInit(&corruptedRegion, NullBox, 1); RegionIntersect(&corruptedRegion, pSrcRegion, nxagentCorruptedRegion(pSrcDrawable)); if (RegionNil(&corruptedRegion) == 0) { #ifdef TEST fprintf(stderr, "nxagentCopyPlane: Forcing the synchronization of source drawable at [%p].\n", (void *) pSrcDrawable); #endif nxagentSynchronizeRegion(pSrcDrawable, &corruptedRegion /*pSrcRegion*/, NEVER_BREAK, NULL); RegionPtr pDstRegion = nxagentCreateRegion(pDstDrawable, pGC, dstx, dsty, width, height); nxagentUnmarkCorruptedRegion(pDstDrawable, pDstRegion); nxagentFreeRegion(pDstDrawable, pDstRegion); } RegionUninit(&corruptedRegion); nxagentFreeRegion(pSrcDrawable, pSrcRegion); } } #ifdef TEST else { fprintf(stderr, "nxagentCopyPlane: Source drawable at [%p] already synchronized.\n", (void *) pSrcDrawable); } #endif if (skip == 0) { XCopyPlane(nxagentDisplay, nxagentDrawable(pSrcDrawable), nxagentDrawable(pDstDrawable), nxagentGC(pGC), srcx, srcy, width, height, dstx, dsty, plane); } if ((pSrcDrawable)->type == DRAWABLE_PIXMAP && (pDstDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "nxagentCopyPlane: going to copy plane from FB pixmap [%p] to [%p].\n", (void *) nxagentVirtualDrawable(pSrcDrawable), (void *) nxagentVirtualDrawable(pDstDrawable)); #endif return fbCopyPlane(nxagentVirtualDrawable(pSrcDrawable), nxagentVirtualDrawable(pDstDrawable), pGC, srcx, srcy, width, height, dstx, dsty, plane); } else if (pSrcDrawable -> type == DRAWABLE_PIXMAP) { return fbCopyPlane(nxagentVirtualDrawable(pSrcDrawable), pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, plane); } else if (pDstDrawable -> type == DRAWABLE_PIXMAP) { return fbCopyPlane(pSrcDrawable, nxagentVirtualDrawable(pDstDrawable), pGC, srcx, srcy, width, height, dstx, dsty, plane); } else { return fbCopyPlane(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, plane); } return miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, plane); } void nxagentPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints, xPoint *pPoints) { #ifdef TEST fprintf(stderr, "nxagentPolyPoint: Drawable at [%p] GC at [%p] Points [%d].\n", (void *) pDrawable, (void *) pGC, nPoints); #endif if (nxagentGCTrap == 1) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { fbPolyPoint(nxagentVirtualDrawable(pDrawable), pGC, mode, nPoints, pPoints); } else { fbPolyPoint(pDrawable, pGC, mode, nPoints, pPoints); } return; } if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to poly point on FB pixmap [%p].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable)); #endif if (nxagentPixmapIsVirtual((PixmapPtr) pDrawable)) { #ifdef TEST fprintf(stderr, "GCOps: poly point enters with virtual pixmap [%p] parent is [%p]\n", (void *) nxagentVirtualDrawable(pDrawable), (void *) nxagentRealPixmap((PixmapPtr) pDrawable)); #endif if (nxagentRealPixmap((PixmapPtr) pDrawable)) { XDrawPoints(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), nxagentGC(pGC), (XPoint *) pPoints, nPoints, mode); } } else { XDrawPoints(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XPoint *) pPoints, nPoints, mode); } fbPolyPoint(nxagentVirtualDrawable(pDrawable), pGC, mode, nPoints, pPoints); return; } else { XDrawPoints(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XPoint *) pPoints, nPoints, mode); fbPolyPoint(pDrawable, pGC, mode, nPoints, pPoints); } } void nxagentPolyLines(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints, xPoint *pPoints) { if (nxagentGCTrap == 1) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { fbPolyLine(nxagentVirtualDrawable(pDrawable), pGC, mode, nPoints, pPoints); } else { fbPolyLine(pDrawable, pGC, mode, nPoints, pPoints); } return; } if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to poly line on FB pixmap [%p].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable)); #endif if (nxagentPixmapIsVirtual((PixmapPtr) pDrawable)) { #ifdef TEST fprintf(stderr, "GCOps: poly lines enters with virtual pixmap = [%p] parent is = [%p]\n", (void *) nxagentVirtualDrawable(pDrawable), (void *) nxagentRealPixmap((PixmapPtr) pDrawable)); #endif if (nxagentRealPixmap((PixmapPtr) pDrawable)) { XDrawLines(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), nxagentGC(pGC), (XPoint *) pPoints, nPoints, mode); } } else { XDrawLines(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XPoint *) pPoints, nPoints, mode); } fbPolyLine(nxagentVirtualDrawable(pDrawable), pGC, mode, nPoints, pPoints); return; } else { XDrawLines(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XPoint *) pPoints, nPoints, mode); fbPolyLine(pDrawable, pGC, mode, nPoints, pPoints); } } void nxagentPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments, xSegment *pSegments) { #ifdef TEST if (nSegments == 1) { fprintf(stderr, "nxagentPolySegment: Drawable at [%p] GC at [%p] Segment [%d,%d,%d,%d].\n", (void *) pDrawable, (void *) pGC, pSegments -> x1, pSegments -> y1, pSegments -> x2, pSegments -> y2); } else { fprintf(stderr, "nxagentPolySegment: Drawable at [%p] GC at [%p] Segments [%d].\n", (void *) pDrawable, (void *) pGC, nSegments); } #endif if (nxagentGCTrap == 1) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { fbPolySegment(nxagentVirtualDrawable(pDrawable), pGC, nSegments, pSegments); } else { fbPolySegment(pDrawable, pGC, nSegments, pSegments); } return; } if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to poly segment on FB pixmap [%p].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable)); #endif if (nxagentPixmapIsVirtual((PixmapPtr) pDrawable)) { #ifdef TEST fprintf(stderr, "GCOps: poly segment enters with virtual pixmap = [%p] parent is = [%p]\n", (void *) nxagentVirtualDrawable(pDrawable), (void *) nxagentRealPixmap((PixmapPtr) pDrawable)); #endif if (nxagentRealPixmap((PixmapPtr) pDrawable)) { XDrawSegments(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), nxagentGC(pGC), (XSegment *) pSegments, nSegments); } } else { XDrawSegments(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XSegment *) pSegments, nSegments); } SET_GC_TRAP(); fbPolySegment(nxagentVirtualDrawable(pDrawable), pGC, nSegments, pSegments); RESET_GC_TRAP(); return; } else { XDrawSegments(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XSegment *) pSegments, nSegments); SET_GC_TRAP(); fbPolySegment(pDrawable, pGC, nSegments, pSegments); RESET_GC_TRAP(); } } void nxagentPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRectangles, xRectangle *pRectangles) { #ifdef TEST if (nRectangles == 1) { fprintf(stderr, "nxagentPolyRectangle: Drawable at [%p] GC at [%p] Rectangle [%d,%d][%d,%d].\n", (void *) pDrawable, (void *) pGC, pRectangles -> x, pRectangles -> y, pRectangles -> width, pRectangles -> height); } else { fprintf(stderr, "nxagentPolyRectangle: Drawable at [%p] GC at [%p] Rectangles [%d].\n", (void *) pDrawable, (void *) pGC, nRectangles); } #endif if (nxagentGCTrap == 1) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { miPolyRectangle(nxagentVirtualDrawable(pDrawable), pGC, nRectangles, pRectangles); } else { miPolyRectangle(pDrawable, pGC, nRectangles, pRectangles); } return; } if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to poly rectangle on FB pixmap [%p].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable)); #endif if (nxagentPixmapIsVirtual((PixmapPtr) pDrawable)) { #ifdef TEST fprintf(stderr, "GCOps: poly rectangle enters with virtual pixmap = [%p] parent is = [%p]\n", (void *) nxagentVirtualDrawable(pDrawable), (void *) nxagentRealPixmap((PixmapPtr) pDrawable)); #endif if (nxagentRealPixmap((PixmapPtr) pDrawable)) { XDrawRectangles(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), nxagentGC(pGC), (XRectangle *) pRectangles, nRectangles); } } else { XDrawRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XRectangle *) pRectangles, nRectangles); } SET_GC_TRAP(); miPolyRectangle(nxagentVirtualDrawable(pDrawable), pGC, nRectangles, pRectangles); RESET_GC_TRAP(); return; } else { XDrawRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XRectangle *) pRectangles, nRectangles); SET_GC_TRAP(); miPolyRectangle(pDrawable, pGC, nRectangles, pRectangles); RESET_GC_TRAP(); } } void nxagentPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs) { if (nxagentGCTrap == 1) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { fbPolyArc(nxagentVirtualDrawable(pDrawable), pGC, nArcs, pArcs); } else { fbPolyArc(pDrawable, pGC, nArcs, pArcs); } return; } if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to poly arc on FB pixmap [%p].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable)); #endif if (nxagentPixmapIsVirtual((PixmapPtr) pDrawable)) { #ifdef TEST fprintf(stderr, "GCOps: poly arc enters with virtual pixmap = [%p] parent is = [%p]\n", (void *) nxagentVirtualDrawable(pDrawable), (void *) nxagentRealPixmap((PixmapPtr) pDrawable)); #endif if (nxagentRealPixmap((PixmapPtr) pDrawable)) { XDrawArcs(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), nxagentGC(pGC), (XArc *) pArcs, nArcs); } } else { XDrawArcs(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XArc *) pArcs, nArcs); } fbPolyArc(nxagentVirtualDrawable(pDrawable), pGC, nArcs, pArcs); return; } else { XDrawArcs(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XArc *) pArcs, nArcs); fbPolyArc(pDrawable, pGC, nArcs, pArcs); } } void nxagentFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode, int nPoints, xPoint *pPoints) { xPoint *newPoints = NULL; if (nxagentGCTrap == 1) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { miFillPolygon(nxagentVirtualDrawable(pDrawable), pGC, shape, mode, nPoints, pPoints); } else { miFillPolygon(pDrawable, pGC, shape, mode, nPoints, pPoints); } return; } /* * The coordinate-mode must be CoordModePrevious to make better use * of differential encoding of X_FillPoly request by the side of * proxy. */ if (mode == CoordModeOrigin) { mode = CoordModePrevious; newPoints = malloc(nPoints * sizeof(xPoint)); /* * The first point is always relative to the drawable's origin. */ newPoints[0].x = pPoints[0].x; newPoints[0].y = pPoints[0].y; /* * If coordinate-mode is CoordModePrevious, the points following * the first are relative to the previous point. */ for (int i = 1; i < nPoints; i++) { newPoints[i].x = pPoints[i].x - pPoints[i-1].x; newPoints[i].y = pPoints[i].y - pPoints[i-1].y; } pPoints = newPoints; } if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to fill polygon on FB pixmap [%p].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable)); #endif if (nxagentPixmapIsVirtual((PixmapPtr) pDrawable)) { #ifdef TEST fprintf(stderr, "GCOps: fill polygon enters with virtual pixmap = [%p] parent is = [%p]\n", (void *) nxagentVirtualDrawable(pDrawable), (void *) nxagentRealPixmap((PixmapPtr) pDrawable)); #endif if (nxagentRealPixmap((PixmapPtr) pDrawable)) { XFillPolygon(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), nxagentGC(pGC), (XPoint *) pPoints, nPoints, shape, mode); } } else { XFillPolygon(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XPoint *) pPoints, nPoints, shape, mode); } SET_GC_TRAP(); miFillPolygon(nxagentVirtualDrawable(pDrawable), pGC, shape, mode, nPoints, pPoints); RESET_GC_TRAP(); } else { XFillPolygon(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XPoint *) pPoints, nPoints, shape, mode); SET_GC_TRAP(); miFillPolygon(pDrawable, pGC, shape, mode, nPoints, pPoints); RESET_GC_TRAP(); } SAFE_free(newPoints); } void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles, xRectangle *pRectangles) { #ifdef TEST if (nRectangles == 1) { fprintf(stderr, "nxagentPolyFillRect: Drawable at [%p] GC at [%p] FillStyle [%d] Rectangle [%d,%d][%d,%d].\n", (void *) pDrawable, (void *) pGC, pGC -> fillStyle, pRectangles -> x, pRectangles -> y, pRectangles -> width, pRectangles -> height); } else { fprintf(stderr, "nxagentPolyFillRect: Drawable at [%p] GC at [%p] FillStyle [%d] Rectangles [%d].\n", (void *) pDrawable, (void *) pGC, pGC -> fillStyle, nRectangles); } #endif if (nxagentGCTrap == 1) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { fbPolyFillRect(nxagentVirtualDrawable(pDrawable), pGC, nRectangles, pRectangles); } else { fbPolyFillRect(pDrawable, pGC, nRectangles, pRectangles); } return; } /* * The PolyFillRect acts in two ways: if the GC has a corrupted * tile, the operation propagates the corrupted region on the * destination. In other cases, because the PolyFillRect will cover * the destination, any corrupted region intersecting the target * will be cleared. */ int inheritCorruptedRegion = 0; if (pGC -> fillStyle == FillTiled && pGC -> tileIsPixel == 0 && pGC -> tile.pixmap != NULL) { nxagentIncreasePixmapUsageCounter(pGC -> tile.pixmap); if (nxagentDrawableStatus((DrawablePtr) pGC -> tile.pixmap) == NotSynchronized) { #ifdef TEST fprintf(stderr, "nxagentPolyFillRect: GC at [%p] uses corrupted tile pixmap at [%p]. Going to " "corrupt the destination [%s][%p].\n", (void *) pGC, (void *) pGC -> tile.pixmap, (pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pDrawable); #endif inheritCorruptedRegion = 1; } } if (inheritCorruptedRegion == 1 || nxagentDrawableStatus(pDrawable) == NotSynchronized) { RegionPtr rectRegion = RegionFromRects(nRectangles, pRectangles, CT_REGION); if (pGC -> clientClip != NULL) { RegionRec tmpRegion; RegionInit(&tmpRegion, NullBox, 1); RegionCopy(&tmpRegion, ((RegionPtr) pGC -> clientClip)); if (pGC -> clipOrg.x != 0 || pGC -> clipOrg.y != 0) { RegionTranslate(&tmpRegion, pGC -> clipOrg.x, pGC -> clipOrg.y); } RegionIntersect(rectRegion, rectRegion, &tmpRegion); RegionUninit(&tmpRegion); } if (inheritCorruptedRegion == 1) { /* * The fill style should affect the corrupted region * propagation: if the tile is not completely corrupted the * region should be 'tiled' over the destination. */ nxagentMarkCorruptedRegion(pDrawable, rectRegion); } else { if (pGC -> fillStyle != FillStippled && pGC -> fillStyle != FillOpaqueStippled) { nxagentUnmarkCorruptedRegion(pDrawable, rectRegion); } else { /* * The stipple mask computation could cause an high * fragmentation of the destination region. An analysis should * be done to examine the better solution (e.g.rdesktop uses * stipples to draw texts). */ #ifdef TEST fprintf(stderr, "nxagentPolyFillRect: Synchronizing the region [%d,%d,%d,%d] before using " "the stipple at [%p].\n", rectRegion -> extents.x1, rectRegion -> extents.y1, rectRegion -> extents.x2, rectRegion -> extents.y2, (void *) pGC -> stipple); #endif nxagentSynchronizeRegion(pDrawable, rectRegion, NEVER_BREAK, NULL); } } RegionDestroy(rectRegion); } if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to poly fill rect on FB pixmap [%p].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable)); #endif if (nxagentPixmapIsVirtual((PixmapPtr) pDrawable)) { #ifdef TEST fprintf(stderr, "GCOps: poly fill rect enters with virtual pixmap = [%p] parent is = [%p]\n", (void *) nxagentVirtualDrawable(pDrawable), (void *) nxagentRealPixmap((PixmapPtr) pDrawable)); #endif if (nxagentRealPixmap((PixmapPtr) pDrawable)) { XFillRectangles(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), nxagentGC(pGC), (XRectangle *) pRectangles, nRectangles); } } else { XFillRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XRectangle *) pRectangles, nRectangles); } fbPolyFillRect(nxagentVirtualDrawable(pDrawable), pGC, nRectangles, pRectangles); return; } else { XFillRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XRectangle *) pRectangles, nRectangles); fbPolyFillRect(pDrawable, pGC, nRectangles, pRectangles); } } void nxagentPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs) { if (nxagentGCTrap == 1) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { miPolyFillArc(nxagentVirtualDrawable(pDrawable), pGC, nArcs, pArcs); } else { miPolyFillArc(pDrawable, pGC, nArcs, pArcs); } return; } if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to poly fillarc on FB pixmap [%p].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable)); #endif if (nxagentPixmapIsVirtual((PixmapPtr) pDrawable)) { #ifdef TEST fprintf(stderr, "GCOps: poly fill arc enters with virtual pixmap = [%p] parent is = [%p]\n", (void *) nxagentVirtualDrawable(pDrawable), (void *) nxagentRealPixmap((PixmapPtr) pDrawable)); #endif if (nxagentRealPixmap((PixmapPtr) pDrawable)) { XFillArcs(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), nxagentGC(pGC), (XArc *) pArcs, nArcs); } } else { XFillArcs(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XArc *) pArcs, nArcs); } SET_GC_TRAP(); miPolyFillArc(nxagentVirtualDrawable(pDrawable), pGC, nArcs, pArcs); RESET_GC_TRAP(); return; } else { XFillArcs(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), (XArc *) pArcs, nArcs); SET_GC_TRAP(); miPolyFillArc(pDrawable, pGC, nArcs, pArcs); RESET_GC_TRAP(); } } int nxagentPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *string) { /* * While the session is suspended the font structure is NULL. */ if (nxagentFontStruct(pGC -> font) == NULL) { return x; } int width = XTextWidth(nxagentFontStruct(pGC->font), string, count); if (nxagentGCTrap == 1) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { miPolyText8(nxagentVirtualDrawable(pDrawable), pGC, x, y, count, string); } else { miPolyText8(pDrawable, pGC, x, y, count, string); } return width + x; } if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to poly text8 on FB pixmap [%p] with string [%s].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable), (char *) string); #endif if (nxagentPixmapIsVirtual((PixmapPtr) pDrawable)) { #ifdef TEST fprintf(stderr, "GCOps: poly text8 enters with virtual pixmap [%p] parent is [%p]\n", (void *) nxagentVirtualDrawable(pDrawable), (void *) nxagentRealPixmap((PixmapPtr) pDrawable)); #endif if (nxagentRealPixmap((PixmapPtr) pDrawable)) { XDrawString(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), nxagentGC(pGC), x, y, string, count); } } else { XDrawString(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), x, y, string, count); } miPolyText8(nxagentVirtualDrawable(pDrawable), pGC, x, y, count, string); return width + x; } else { XDrawString(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), x, y, string, count); miPolyText8(pDrawable, pGC, x, y, count, string); } return width + x; } int nxagentPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *string) { /* * While the session is suspended the font structure is NULL. */ if (nxagentFontStruct(pGC -> font) == NULL) { return x; } int width = XTextWidth16(nxagentFontStruct(pGC->font), (XChar2b *)string, count); if (nxagentGCTrap == 1) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { miPolyText16(nxagentVirtualDrawable(pDrawable), pGC, x, y, count, string); } else { miPolyText16(pDrawable, pGC, x, y, count, string); } return width + x; } if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to poly text16 on FB pixmap %p] with string [%s]\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable), (char *) string); #endif if (nxagentPixmapIsVirtual((PixmapPtr) pDrawable)) { #ifdef TEST fprintf(stderr, "GCOps: poly text16 enters with virtual pixmap = [%p] parent is = [%p]\n", (void *) nxagentVirtualDrawable(pDrawable), (void *) nxagentRealPixmap((PixmapPtr) pDrawable)); #endif if (nxagentRealPixmap((PixmapPtr) pDrawable)) { XDrawString16(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), nxagentGC(pGC), x, y, (XChar2b *)string, count); } } else { XDrawString16(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), x, y, (XChar2b *)string, count); } miPolyText16(nxagentVirtualDrawable(pDrawable), pGC, x, y, count, string); return width + x; } else { XDrawString16(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), x, y, (XChar2b *)string, count); miPolyText16(pDrawable, pGC, x, y, count, string); } return width + x; } void nxagentImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *string) { if (nxagentGCTrap == 1) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { miImageText8(nxagentVirtualDrawable(pDrawable), pGC, x, y, count, string); } else { miImageText8(pDrawable, pGC, x, y, count, string); } return; } if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to image text8 on FB pixmap [%p] with string [%s].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable), string); #endif if (nxagentPixmapIsVirtual((PixmapPtr) pDrawable)) { #ifdef TEST fprintf(stderr, "GCOps: poly image text8 enters with virtual pixmap [%p] parent is [%p]\n", (void *) nxagentVirtualDrawable(pDrawable), (void *) nxagentRealPixmap((PixmapPtr) pDrawable)); #endif if (nxagentRealPixmap((PixmapPtr) pDrawable)) { XDrawImageString(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), nxagentGC(pGC), x, y, string, count); } } else { XDrawImageString(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), x, y, string, count); } miImageText8(nxagentVirtualDrawable(pDrawable), pGC, x, y, count, string); return; } else { XDrawImageString(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), x, y, string, count); miImageText8(pDrawable, pGC, x, y, count, string); } } void nxagentImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *string) { if (nxagentGCTrap == 1) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { miImageText16(nxagentVirtualDrawable(pDrawable), pGC, x, y, count, string); } else { miImageText16(pDrawable, pGC, x, y, count, string); } return; } if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to image text16 on FB pixmap [%p] with string [%s].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable), (char *) string); #endif if (nxagentPixmapIsVirtual((PixmapPtr) pDrawable)) { #ifdef TEST fprintf(stderr, "GCOps: poly image text16 enters with virtual pixmap = [%p] parent is = [%p]\n", (void *) nxagentVirtualDrawable(pDrawable), (void *) nxagentRealPixmap((PixmapPtr) pDrawable)); #endif if (nxagentRealPixmap((PixmapPtr) pDrawable)) { XDrawImageString16(nxagentDisplay, nxagentDrawable((DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable)), nxagentGC(pGC), x, y, (XChar2b *)string, count); } } else { XDrawImageString16(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), x, y, (XChar2b *)string, count); } miImageText16(nxagentVirtualDrawable(pDrawable), pGC, x, y, count, string); return; } else { XDrawImageString16(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), x, y, (XChar2b *)string, count); miImageText16(pDrawable, pGC, x, y, count, string); } } void nxagentImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nGlyphs, CharInfoPtr *pCharInfo, void * pGlyphBase) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to imageGlyphBlt on FB pixmap [%p].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable)); #endif fbImageGlyphBlt(nxagentVirtualDrawable(pDrawable), pGC, x, y, nGlyphs, pCharInfo, pGlyphBase); } else { fbImageGlyphBlt(pDrawable, pGC, x, y, nGlyphs, pCharInfo, pGlyphBase); } } void nxagentPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nGlyphs, CharInfoPtr *pCharInfo, void * pGlyphBase) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to PolyGlyphBlt on FB pixmap [%p].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable)); #endif fbPolyGlyphBlt(nxagentVirtualDrawable(pDrawable), pGC, x, y, nGlyphs, pCharInfo, pGlyphBase); } else { fbPolyGlyphBlt(pDrawable, pGC, x, y, nGlyphs, pCharInfo, pGlyphBase); } } void nxagentPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable, int width, int height, int x, int y) { if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "GCOps: GC [%p] going to PushPixels on FB pixmap [%p].\n", (void *) pGC, (void *) nxagentVirtualDrawable(pDrawable)); #endif fbPushPixels(pGC, nxagentVirtualPixmap(pBitmap), (DrawablePtr) nxagentVirtualDrawable(pDrawable), width, height, x, y); } else { fbPushPixels(pGC, nxagentVirtualPixmap(pBitmap), (DrawablePtr) pDrawable, width, height, x, y); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/GCOps.h0000644000000000000000000001252513614532331020006 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #ifndef __GCOps_H__ #define __GCOps_H__ /* * Graphic operations. */ void nxagentFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans, xPoint *pPoints, int *pWidths, int fSorted); void nxagentSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc, xPoint *pPoints, int *pWidths, int nSpans, int fSorted); void nxagentGetSpans(DrawablePtr pDrawable, int maxWidth, xPoint *pPoints, int *pWidths, int nSpans, char *pBuffer); RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty); RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long plane); void nxagentQueryBestSize(int class, unsigned short *pwidth, unsigned short *pheight, ScreenPtr pScreen); void nxagentPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints, xPoint *pPoints); void nxagentPolyLines(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints, xPoint *pPoints); void nxagentPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments, xSegment *pSegments); void nxagentPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRectangles, xRectangle *pRectangles); void nxagentPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs); void nxagentFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode, int nPoints, xPoint *pPoints); void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles, xRectangle *pRectangles); void nxagentPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs); int nxagentPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *string); int nxagentPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *string); void nxagentImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *string); void nxagentImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *string); void nxagentImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nGlyphs, CharInfoPtr *pCharInfo, void * pGlyphBase); void nxagentPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nGlyphs, CharInfoPtr *pCharInfo, void * pGlyphBase); void nxagentPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable, int width, int height, int x, int y); #endif /* __GCOps_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/GCs.h0000644000000000000000000001050413614532331017502 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #ifndef __GC_H__ #define __GC_H__ extern RESTYPE RT_NX_GC; /* This file uses the GC definition form Xlib.h as XlibGC. */ typedef struct { XlibGC gc; int nClipRects; XGCValues lastServerValues; XID mid; PixmapPtr pPixmap; } nxagentPrivGC; extern int nxagentGCPrivateIndex; typedef struct _nxagentGraphicContextsRec { int depth; GCPtr pGC; int dirty; } nxagentGraphicContextsRec; typedef nxagentGraphicContextsRec *nxagentGraphicContextsPtr; extern nxagentGraphicContextsPtr nxagentGraphicContexts; extern int nxagentGraphicContextsSize; #define nxagentGCPriv(pGC) \ ((nxagentPrivGC *)((pGC) -> devPrivates[nxagentGCPrivateIndex].ptr)) #define nxagentGC(pGC) (nxagentGCPriv(pGC) -> gc) #define nxagentCopyGCPriv(valueMask, valueField, src, mask, dst) \ \ if (mask & valueMask) \ { \ nxagentGCPriv(dst) -> lastServerValues.valueField = \ nxagentGCPriv(src) -> lastServerValues.valueField; \ } #define nxagentTestGC(newValue, pvalue) \ \ ((nxagentGCPriv(pGC) -> lastServerValues.pvalue == newValue) ? 0 : 1); \ \ nxagentGCPriv(pGC) -> lastServerValues.pvalue = newValue Bool nxagentCreateGC(GCPtr pGC); void nxagentValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable); void nxagentChangeGC(GCPtr pGC, unsigned long mask); void nxagentCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); void nxagentDestroyGC(GCPtr pGC); void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects); void nxagentDestroyClip(GCPtr pGC); void nxagentDestroyClipHelper(GCPtr pGC); void nxagentCopyClip(GCPtr pGCDst, GCPtr pGCSrc); void nxagentDisconnectGC(void * p0, XID x1, void * p2); Bool nxagentDisconnectAllGCs(void); Bool nxagentReconnectAllGCs(void *p0); int nxagentDestroyNewGCResourceType(void * p, XID id); void nxagentFreeGCList(void); void nxagentInitGCSafeVector(void); GCPtr nxagentGetScratchGC(unsigned depth, ScreenPtr pScreen); void nxagentFreeScratchGC(GCPtr pGC); GCPtr nxagentGetGraphicContext(DrawablePtr pDrawable); void nxagentAllocateGraphicContexts(void); #endif /* __GC_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Handlers.c0000644000000000000000000007653213614532331020576 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "dixstruct.h" #include "scrnintstr.h" #include "windowstr.h" #include "osdep.h" #include "Agent.h" #include "Handlers.h" #include "Display.h" #include "Events.h" #include "Client.h" #include "Reconnect.h" #include "Dialog.h" #include "Drawable.h" #include "Splash.h" #include "Screen.h" #include "Millis.h" #define Window XlibWindow #include "compext/Compext.h" #undef Window #include /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP /* * Log begin and end of the important handlers. */ #undef BLOCKS /* * If not defined, flush immediately upon entering the block handler. */ #define FLUSH_AFTER_MULTIPLE_READS /* * The soft limit should roughly match the size of the Xlib I/O * buffer. */ #define BYTES_BEFORE_SOFT_TOKEN 2048 #define BYTES_BEFORE_HARD_TOKEN 65536 /* * Maximum number of synchronization requests before waiting for the * remote. */ #define TOKENS_PENDING_LIMIT 8 /* * Limits are very unobtrusive. We don't want to interfere with the * normal dispatching. */ #define BYTES_BEFORE_YIELD 1048576 #define TIME_BEFORE_YIELD 500 /* * Dynamically reduce the display buffer size after a congestion. */ #undef DYNAMIC_DISPLAY_BUFFER /* * Minimum display buffer size. */ #define MINIMUM_DISPLAY_BUFFER 512 #ifdef NX_DEBUG_INPUT extern int nxagentDebugInputDevices; extern unsigned long nxagentLastInputDevicesDumpTime; extern void nxagentDumpInputDevicesState(void); #endif /* * Used in the handling of the X desktop manager protocol. */ int nxagentXdmcpUp = 0; int nxagentXdmcpAlertUp = 0; /* * Also used in the block, wakeup and sync handlers. */ int nxagentBuffer; int nxagentBlocking; int nxagentCongestion; double nxagentBytesIn; double nxagentBytesOut; /* * Total number of descriptors ready as reported by the wakeup * handler. */ int nxagentReady; /* * Timestamp of the last write to the remote display. */ int nxagentFlush; /* * Arbitrate the bandwidth among our clients. */ struct _TokensRec nxagentTokens = { 0, 0, 0 }; struct _DispatchRec nxagentDispatch = { UNDEFINED, 0, 0, 0 }; /* * Called just before blocking, waiting for our clients or the X * server. */ extern int nxagentSkipImage; void nxagentBlockHandler(void * data, struct timeval **timeout, void * mask) { /* * Zero timeout. */ static struct timeval zero; /* * Current timestamp. */ static int now; /* * Pending bytes to write to the network. */ static int flushable; /* * Set if we need to synchronize any drawable. */ static int synchronize; #ifdef BLOCKS fprintf(stderr, "[Begin block]\n"); #endif now = GetTimeInMillis(); #ifdef NX_DEBUG_INPUT if (nxagentDebugInputDevices == 1 && now - nxagentLastInputDevicesDumpTime > 5000) { nxagentLastInputDevicesDumpTime = now; nxagentDumpInputDevicesState(); } #endif if (nxagentNeedConnectionChange() == 1) { #ifdef TEST fprintf(stderr, "nxagentBlockHandler: Calling nxagentHandleConnectionChanges " "with ioError [%d] sigHup [%d].\n", nxagentException.ioError, nxagentException.sigHup); #endif nxagentHandleConnectionChanges(); } if (nxagentOption(Rootless) && nxagentLastWindowDestroyed && nxagentRootlessDialogPid == 0 && now > nxagentLastWindowDestroyedTime + 30 * 1000 && !nxagentOption(NoRootlessExit)) { #ifdef WARNING fprintf(stderr, "nxagentBlockHandler: No application running. Closing the session.\n"); #endif nxagentTerminateSession(); } #ifdef TEST if (nxagentLastWindowDestroyed == 1) { fprintf(stderr, "nxagentBlockHandler: Elapsed time [%lu].\n", now - nxagentLastWindowDestroyedTime); } #endif /* * Slow down the agent if the session is not connected to a valid * display. */ if (NXDisplayError(nxagentDisplay) == 1 && nxagentShadowCounter == 0 && nxagentOption(SleepTime) > 0) { #ifdef TEST fprintf(stderr, "nxagentBlockHandler: sleeping for %d milliseconds for slowdown.\n", nxagentOption(SleepTime)); #endif usleep(nxagentOption(SleepTime) * 1000); now = GetTimeInMillis(); } #ifdef TEST else if (0 == nxagentOption(SleepTime)) { fprintf(stderr, "nxagentBlockHandler: not sleeping for slowdown.\n"); } #endif /* * Update the shadow display. This is only for test purposes. */ #ifdef DUMP nxagentPixmapOnShadowDisplay(NULL); nxagentFbOnShadowDisplay(); #endif /* * We need this here because some window configuration changes can * be generated by the X server outside the control of the DIX. */ nxagentFlushConfigureWindow(); /* * Check whether there is any drawable to synchronize. */ #ifdef TEST fprintf(stderr, "nxagentBlockHandler: Checking synchronization at %s with " "[%d][%d][%d].\n", GetTimeInMillisAsString(), nxagentCorruptedWindows, nxagentCorruptedBackgrounds, nxagentCorruptedPixmaps); #endif synchronize = (nxagentCorruptedWindows > 0 || nxagentCorruptedBackgrounds > 0 || nxagentCorruptedPixmaps > 0); /* * The synchronization function requires a mask as parameter: * * EVENT_BREAK Breaks if an user input, like a key press * or a mouse move, is detected. * * CONGESTION_BREAK Breaks if the congestion becomes greater * than 4. * * BLOCKING_BREAK Breaks if the display descriptor becomes * blocked for write during the loop. * * ALWAYS_BREAK Any of the previous conditions is met. * * NEVER_BREAK The loop continues until all the drawables * are synchronized. */ if (synchronize == 1) { /* * We should not enter the synchronization loop if there is any * user input pending, i.e. if we are in the middle of a scroll * operation. */ if (nxagentForceSynchronization == 1) { #ifdef TEST fprintf(stderr, "nxagentBlockHandler: Going to force a synchronization at %s.\n", GetTimeInMillisAsString()); #endif nxagentSynchronizationLoop(NEVER_BREAK); nxagentForceSynchronization = 0; } else if (nxagentUserInput(NULL) == 0 && nxagentBlocking == 0 && nxagentCongestion <= 4) { #ifdef TEST fprintf(stderr, "nxagentBlockHandler: Going to synchronize at %s.\n", GetTimeInMillisAsString()); #endif nxagentSynchronizationLoop(ALWAYS_BREAK); } #ifdef TEST else { fprintf(stderr, "nxagentBlockHandler: Not synchronizing with [%d][%d].\n", nxagentBlocking, nxagentCongestion); } #endif /* * Check if we have more corrupted resources and whether the * conditions are satisfied to continue with the synchronization. */ synchronize = (nxagentCongestion <= 4 && (nxagentCorruptedWindows > 0 || nxagentCorruptedBackgrounds > 0 || nxagentCorruptedPixmaps > 0)); if (nxagentSkipImage == 0 && synchronize == 1) { #ifdef TEST fprintf(stderr, "nxagentBlockHandler: Setting a zero timeout with [%d][%d][%d] and " "congestion [%d].\n", nxagentCorruptedWindows, nxagentCorruptedBackgrounds, nxagentCorruptedPixmaps, nxagentCongestion); #endif zero.tv_sec = 0; zero.tv_usec = 0; *timeout = &zero; } #ifdef TEST else { if (nxagentCorruptedWindows == 0 && nxagentCorruptedBackgrounds == 0 && nxagentCorruptedPixmaps == 0) { fprintf(stderr, "nxagentBlockHandler: Nothing more to synchronize at %s.\n", GetTimeInMillisAsString()); } else { fprintf(stderr, "nxagentBlockHandler: Delaying synchronization with [%d][%d][%d] and " "congestion [%d].\n", nxagentCorruptedWindows, nxagentCorruptedBackgrounds, nxagentCorruptedPixmaps, nxagentCongestion); } } #endif } /* * If the remote X server is blocking, reduce the amount of data * sent in a single display update by reducing the size of the * display buffer. */ #ifdef DYNAMIC_DISPLAY_BUFFER if (nxagentBlocking == 1 && nxagentBuffer > MINIMUM_DISPLAY_BUFFER) { nxagentBuffer >>= 1; if (nxagentBuffer < MINIMUM_DISPLAY_BUFFER) { nxagentBuffer = MINIMUM_DISPLAY_BUFFER; } #ifdef TEST fprintf(stderr, "nxagentBlockHandler: Reducing the display buffer to [%d] bytes.\n", nxagentBuffer); #endif NXSetDisplayBuffer(nxagentDisplay, nxagentBuffer); } else if (nxagentBuffer < nxagentOption(DisplayBuffer) && nxagentCongestion == 0) { nxagentBuffer = nxagentOption(DisplayBuffer); #ifdef TEST fprintf(stderr, "nxagentBlockHandler: Increasing the display buffer to [%d] bytes.\n", nxagentBuffer); #endif NXSetDisplayBuffer(nxagentDisplay, nxagentBuffer); } #endif /* #ifdef DYNAMIC_DISPLAY_BUFFER */ /* * Dispatch to the clients the events that may have become * available. */ if (nxagentPendingEvents(nxagentDisplay) > 0) { #ifdef TEST fprintf(stderr, "nxagentBlockHandler: Reading the events available.\n"); #endif nxagentDispatchEvents(NULL); } /* * Check if there is any data remaining, either in the display * buffer or in the NX transport. */ flushable = NXDisplayFlushable(nxagentDisplay); if (flushable > 0) { #ifdef FLUSH_AFTER_MULTIPLE_READS /* * Flush all the outstanding data if the wakeup handler didn't * detect any activity. */ if (nxagentReady == 0 || now - nxagentFlush >= nxagentOption(DisplayCoalescence)) { #ifdef DEBUG fprintf(stderr, "nxagentBlockHandler: Flushing the display with [%d] bytes to flush.\n", flushable); #endif NXFlushDisplay(nxagentDisplay, NXFlushLink); /* * New events may have become available after the flush. */ if (nxagentPendingEvents(nxagentDisplay) > 0) { #ifdef TEST fprintf(stderr, "nxagentBlockHandler: Reading the events available.\n"); #endif nxagentDispatchEvents(NULL); } } else { #ifdef DEBUG fprintf(stderr, "nxagentBlockHandler: Delaying flush with [%d][%d] and [%d] bytes.\n", synchronize, nxagentReady, flushable); #endif zero.tv_sec = 0; zero.tv_usec = 0; *timeout = &zero; } #else /* #ifdef FLUSH_AFTER_MULTIPLE_READS */ /* * We are entering the select. Tell the NX transport to write any * produced data to the remote end. */ NXFlushDisplay(nxagentDisplay, NXFlushLink); if (nxagentPendingEvents(nxagentDisplay) > 0) { #ifdef TEST fprintf(stderr, "nxagentBlockHandler: Reading the events available.\n"); #endif nxagentDispatchEvents(NULL); } #endif /* #ifdef FLUSH_AFTER_MULTIPLE_READS */ } else { #ifdef DEBUG fprintf(stderr, "nxagentBlockHandler: Nothing to flush with [%d][%d].\n", synchronize, nxagentReady); #endif if (NXDisplayError(nxagentDisplay) == 0 && nxagentQueuedEvents(nxagentDisplay) > 0) { #ifdef WARNING fprintf(stderr, "nxagentBlockHandler: WARNING! Forcing a null timeout with events queued.\n"); #endif zero.tv_sec = 0; zero.tv_usec = 0; *timeout = &zero; } } /* * WaitForSomething() sets a zero timeout if there are clients with * input, but doesn't stop the timer. The select is then interrupted * to update the schedule time even if, what the dispatcher cares, * is only the number of ticks at the time the client is scheduled * in. */ #ifdef DEBUG fprintf(stderr, "nxagentBlockHandler: Stopping the smart schedule timer.\n"); #endif nxagentStopTimer(); nxagentPrintGeometry(); #ifdef BLOCKS fprintf(stderr, "[End block]\n"); #endif } void nxagentWakeupHandler(void * data, int count, void * mask) { #ifdef BLOCKS fprintf(stderr, "[Begin wakeup]\n"); #endif if (nxagentException.sigHup || nxagentException.ioError) { #ifdef TEST fprintf(stderr,"nxagentWakeupHandler: Got SIGHUP or I/O error.\n"); #endif #ifdef TEST fprintf(stderr, "nxagentWakeupHandler: Calling nxagentHandleConnectionStates " "with ioError [%d] sigHup [%d].\n", nxagentException.ioError, nxagentException.sigHup); #endif nxagentHandleConnectionStates(); } if (!SmartScheduleSignalEnable) { #ifdef DEBUG fprintf(stderr, "nxagentWakeupHandler: Resetting the dispatch state after wakeup.\n"); #endif nxagentDispatch.start = GetTimeInMillis(); nxagentDispatch.in = nxagentBytesIn; nxagentDispatch.out = nxagentBytesOut; } /* * Can become true during the dispatch loop. */ nxagentBlocking = 0; /* * Check if we got new events. */ if (count > 0 && FD_ISSET(nxagentXConnectionNumber, (fd_set *) mask)) { #ifdef TEST fprintf(stderr, "nxagentWakeupHandler: Reading the X events with count [%d].\n", count); #endif nxagentDispatchEvents(NULL); #ifdef TEST fprintf(stderr, "nxagentWakeupHandler: Removing the X descriptor from the count.\n"); #endif FD_CLR(nxagentXConnectionNumber, (fd_set *) mask); count--; } else if (nxagentQueuedEvents(nxagentDisplay) == 1) { /* * We may have left some events in the queue. */ #ifdef TEST fprintf(stderr, "nxagentWakeupHandler: Reading the queued X events with count [%d].\n", count); #endif nxagentDispatchEvents(NULL); } /* * Save the number of descriptors ready. */ if (count <= 0) { count = (XFD_ANYSET(&ClientsWithInput) ? 1 : 0); } nxagentReady = count; #ifdef TEST if (nxagentReady == 0) { fprintf(stderr, "nxagentWakeupHandler: No X clients found to be processed.\n"); } #endif /* * If the XDM connection can't be established we'll need to create a * dialog to notify the user and give him/her a chance to terminate * the session. */ if (nxagentOption(Xdmcp) == 1 && nxagentXdmcpUp == 0) { #ifdef DEBUG fprintf(stderr, "nxagentWakeupHandler: XdmcpState [%d].\n", XdmcpState); #endif if (XdmcpState == XDM_RUN_SESSION) { nxagentXdmcpUp = 1; } if (nxagentXdmcpUp == 0) { #ifdef DEBUG fprintf(stderr, "nxagentWakeupHandler: XdmcpTime [%lu].\n", GetTimeInMillis() - XdmcpStartTime); #endif #ifdef DEBUG fprintf(stderr, "nxagentWakeupHandler: XdmcpTimeOutRtx [%d].\n", XdmcpTimeOutRtx); #endif if (nxagentXdmcpAlertUp == 0 && GetTimeInMillis() - XdmcpStartTime >= XDM_TIMEOUT) { #ifdef WARNING fprintf(stderr, "nxagentWakeupHandler: WARNING! The XDM session seems to be " "unable to start after [%ld] ms.\n",(long int)(GetTimeInMillis() - XdmcpStartTime)); #endif NXTransAlert(FAILED_XDMCP_CONNECTION_ALERT, NX_ALERT_REMOTE); nxagentXdmcpAlertUp = 1; } } } #ifdef BLOCKS fprintf(stderr, "[End wakeup]\n"); #endif } void nxagentShadowBlockHandler(void * data, struct timeval **timeout, void * mask) { static struct timeval zero; int changed; int suspended = 0; int width_, height_; #ifdef BLOCKS fprintf(stderr, "[Begin block]\n"); #endif if (nxagentNeedConnectionChange() == 1) { nxagentHandleConnectionChanges(); } if (nxagentSessionState == SESSION_DOWN && nxagentOption(SleepTime) > 0) { #ifdef TEST fprintf(stderr, "nxagentShadowBlockHandler: sleeping for %d milliseconds for slowdown.\n", nxagentOption(SleepTime)); #endif usleep(nxagentOption(SleepTime) * 1000); } #ifdef TEST else if (0 == nxagentOption(SleepTime)) { fprintf(stderr, "nxagentShadowBlockHandler: not sleeping for slowdown.\n"); } #endif if (nxagentReadEvents(nxagentDisplay) > 0 || nxagentReadEvents(nxagentShadowDisplay) > 0) { #ifdef TEST fprintf(stderr, "nxagentShadowBlockHandler: Reading X events queued.\n"); #endif nxagentDispatchEvents(NULL); } if (nxagentShadowResize == 1) { nxagentShadowResize = 0; nxagentShadowAdaptToRatio(); } changed = 0; NXShadowGetScreenSize(&width_, &height_); if (width_ != nxagentShadowWidth || height_ != nxagentShadowHeight) { /* * The master session has been resized. */ NXShadowSetScreenSize(&nxagentShadowWidth, &nxagentShadowHeight); nxagentShadowAdaptToRatio(); } nxagentShadowPoll(nxagentShadowPixmapPtr, nxagentShadowGCPtr, nxagentShadowDepth, nxagentShadowWidth, nxagentShadowHeight, nxagentShadowBuffer, &changed, &suspended); nxagentShadowSendUpdates(&suspended); if (nxagentBlocking == 0) { nxagentSynchronizeDrawable((DrawablePtr) nxagentShadowPixmapPtr, DONT_WAIT, ALWAYS_BREAK, nxagentShadowWindowPtr); } /* * We are entering the select. Tell the NX transport to write any * produced data to the remote end. */ /* FIXME: Must queue multiple writes and handle the events by resembling the ordinary block handler. */ NXFlushDisplay(nxagentDisplay, NXFlushLink); if (*timeout == NULL) { *timeout = &zero; } if (changed == 0) { (*timeout) -> tv_sec = 0; (*timeout) -> tv_usec = 50 * 1000; } else { (*timeout) -> tv_sec = 0; (*timeout) -> tv_usec = 0; } nxagentPrintGeometry(); #ifdef BLOCKS fprintf(stderr, "[End block]\n"); #endif } void nxagentShadowWakeupHandler(void * data, int count, void * mask) { #ifdef BLOCKS fprintf(stderr, "[Begin wakeup]\n"); #endif if (nxagentException.sigHup || nxagentException.ioError) { #ifdef TEST fprintf(stderr,"nxagentShadowWakeupHandler: Got SIGHUP or I/O error.\n"); #endif nxagentHandleConnectionStates(); } if (!SmartScheduleSignalEnable) { #ifdef DEBUG fprintf(stderr, "nxagentShadowWakeupHandler: Resetting the dispatch state after wakeup.\n"); #endif nxagentDispatch.start = GetTimeInMillis(); nxagentDispatch.in = nxagentBytesIn; nxagentDispatch.out = nxagentBytesOut; } /* * Can become true during the dispatch loop. */ nxagentBlocking = 0; /* * Check if we got new events. */ if (count > 0 && FD_ISSET(nxagentXConnectionNumber, (fd_set *) mask)) { #ifdef TEST fprintf(stderr, "nxagentShadowWakeupHandler: Reading the X events with count [%d].\n", count); #endif nxagentDispatchEvents(NULL); #ifdef TEST fprintf(stderr, "nxagentShadowWakeupHandler: Removing the X descriptor from the count.\n"); #endif FD_CLR(nxagentXConnectionNumber, (fd_set *) mask); count--; } else if (nxagentQueuedEvents(nxagentDisplay) == 1) { /* * We may have left some events in the queue. */ #ifdef TEST fprintf(stderr, "nxagentShadowWakeupHandler: Reading the queued X events with count [%d].\n", count); #endif nxagentDispatchEvents(NULL); } /* * Save the number of descriptors ready. */ if (count <= 0) { count = (XFD_ANYSET(&ClientsWithInput) ? 1 : 0); } nxagentReady = count; #ifdef TEST if (nxagentReady == 0) { fprintf(stderr, "nxagentShadowWakeupHandler: No X clients found to be processed.\n"); } #endif #ifdef BLOCKS fprintf(stderr, "[End wakeup]\n"); #endif } void nxagentHandleCollectInputFocusEvent(int resource) { /* * While we don't even need window or revert_to later on, a discrepancy in * data type sizes between the X server (Window being a 32bit ID) and * the Xlib (Window being a 64bit ID) will lead to stack corruption here. * Calling functions from CompExt from nxagent sounds like a very bad idea * to begin with, but let's assume that's necessary for now and work around * the corruption issue. * * Even though the CompExt header shows that the function expects a Window-sized * parameter, it's not the Window type as defined and used within the X.Org * Server, but an Xlib type. Hence, we'll be using the "XlibWindow" type here * and to avoid compiler warnings, "rewrite" the CompExt.h header file via * overriding the original "Window" type with the XlibWindow type, including * the header file and undefining the macro again, essentially unshadowing * the original type. */ XlibWindow window; int revert_to; if (NXGetCollectedInputFocus(nxagentDisplay, resource, &window, &revert_to) == 0) { #ifdef PANIC fprintf(stderr, "nxagentHandleCollectInputFocusEvent: PANIC! Failed to get the input focus " "reply for resource [%d].\n", resource); #endif } #ifdef DEBUG fprintf(stderr, "nxagentHandleCollectInputFocusEvent: Received a sync reply with [%d] pending.\n", nxagentTokens.pending); #endif nxagentTokens.pending--; nxagentCongestion = (nxagentTokens.pending >= TOKENS_PENDING_LIMIT / 2); #ifdef TEST fprintf(stderr, "nxagentHandleCollectInputFocusEvent: Current congestion level is [%d].\n", nxagentCongestion); #endif } Bool nxagentCollectInputFocusPredicate(Display *disp, XEvent *X, XPointer ptr) { return (X -> xclient.window == 0 && X -> xclient.message_type == 0 && X -> xclient.format == 32 && X -> xclient.data.l[0] == NXCollectInputFocusNotify); } void nxagentDispatchHandler(ClientPtr client, int in, int out) { /* * This function is called by the dispatcher (with 0 bytes out) * after a new request has been processed. It is also called by the * write handler (with 0 bytes in) after more data has been written * to the display. It may be optionally called in the block and * wakeup handlers. In this case both in and out must be 0. */ if (out > 0) { /* * Called by the display write callback. */ #ifdef DEBUG fprintf(stderr, "nxagentDispatchHandler: Called with [%d] bytes written.\n", out); #endif nxagentBytesOut += out; #ifdef DEBUG fprintf(stderr, "nxagentDispatchHandler: Total bytes are [%.0f] in [%.0f] out.\n", nxagentBytesIn, nxagentBytesOut); #endif /* * Don't take care of the synchronization if the NX transport is * running. The NX transport has its own token-based control flow. * * We can't produce more output here because we are in the middle * of the flush. We will take care of the sync requests when * called by the dispatcher. */ if (nxagentOption(LinkType) == LINK_TYPE_NONE) { nxagentTokens.soft += out; if (out > BYTES_BEFORE_HARD_TOKEN) { nxagentTokens.hard += out; } #ifdef DEBUG fprintf(stderr, "nxagentDispatchHandler: Sync bytes accumulated are [%d] and [%d].\n", nxagentTokens.soft, nxagentTokens.hard); #endif } if (!SmartScheduleSignalEnable) { /* * Pay attention to the next client if this client produced * enough output. */ if (nxagentBytesOut - nxagentDispatch.out > BYTES_BEFORE_YIELD) { #ifdef DEBUG fprintf(stderr, "nxagentDispatchHandler: Yielding with [%ld][%.0f][%.0f] for client [%d].\n", GetTimeInMillis() - nxagentDispatch.start, nxagentBytesIn - nxagentDispatch.in, nxagentBytesOut - nxagentDispatch.out, nxagentDispatch.client); #endif nxagentDispatch.start = GetTimeInMillis(); nxagentDispatch.in = nxagentBytesIn; nxagentDispatch.out = nxagentBytesOut; isItTimeToYield = 1; } #ifdef DEBUG else { fprintf(stderr, "nxagentDispatchHandler: Dispatching with [%ld][%.0f][%.0f] for client [%d].\n", GetTimeInMillis() - nxagentDispatch.start, nxagentBytesIn - nxagentDispatch.in, nxagentBytesOut - nxagentDispatch.out, nxagentDispatch.client); } #endif } return; } else if (in > 0) { /* * Called by the dispatcher. */ #ifdef DEBUG fprintf(stderr, "nxagentDispatchHandler: Called with [%d] bytes processed for client [%d].\n", in, client -> index); #endif /* * This is presently unused. * * nxagentClientAddBytes(client, in); * * #ifdef DEBUG * fprintf(stderr, "nxagentDispatchHandler: Bytes processed for client [%d] are [%ld].\n", * client -> index, nxagentClientBytes(client)); * #endif * */ nxagentBytesIn += in; #ifdef DEBUG fprintf(stderr, "nxagentDispatchHandler: Total bytes are [%.0f] in [%.0f] out.\n", nxagentBytesIn, nxagentBytesOut); #endif /* * When using the dumb scheduler, before reading from another * client, the dispatcher tries to drain all the input from the * client being processed. This means that, if isItTimeToYield is * never set and the client never produces any output, we'll stick * into the inner dispatch loop forever. */ if (!SmartScheduleSignalEnable) { if (client -> index != nxagentDispatch.client) { #ifdef DEBUG fprintf(stderr, "nxagentDispatchHandler: Resetting the dispatch state with [%d][%d].\n", nxagentDispatch.client, client -> index); #endif nxagentDispatch.client = client -> index; nxagentDispatch.start = GetTimeInMillis(); nxagentDispatch.in = nxagentBytesIn; nxagentDispatch.out = nxagentBytesOut; } else { static unsigned long int now; now = GetTimeInMillis(); if (now - nxagentDispatch.start > TIME_BEFORE_YIELD || nxagentBytesIn - nxagentDispatch.in > BYTES_BEFORE_YIELD) { #ifdef DEBUG fprintf(stderr, "nxagentDispatchHandler: Yielding with [%ld][%.0f][%.0f] for client [%d].\n", now - nxagentDispatch.start, nxagentBytesIn - nxagentDispatch.in, nxagentBytesOut - nxagentDispatch.out, nxagentDispatch.client); #endif nxagentDispatch.start = now; nxagentDispatch.in = nxagentBytesIn; nxagentDispatch.out = nxagentBytesOut; isItTimeToYield = 1; } #ifdef DEBUG else { fprintf(stderr, "nxagentDispatchHandler: Dispatching with [%ld][%.0f][%.0f] for client [%d].\n", now - nxagentDispatch.start, nxagentBytesIn - nxagentDispatch.in, nxagentBytesOut - nxagentDispatch.out, nxagentDispatch.client); } #endif } } } /* * Let's see if it's time to sync. */ if (nxagentOption(LinkType) == LINK_TYPE_NONE) { if (nxagentTokens.hard > BYTES_BEFORE_HARD_TOKEN) { #ifdef DEBUG fprintf(stderr, "nxagentDispatchHandler: Requesting a hard sync reply with [%d] bytes.\n", nxagentTokens.hard); #endif XSync(nxagentDisplay, 0); if (nxagentPendingEvents(nxagentDisplay) > 0) { nxagentDispatchEvents(NULL); } nxagentTokens.soft = 0; nxagentTokens.hard = 0; } else if (nxagentTokens.soft > BYTES_BEFORE_SOFT_TOKEN) { /* * Alternatively, the amounts of bytes accounted for each sync * request may be decreased according to the number of pending * replies already awaited. * * else if (nxagentTokens.soft > (BYTES_BEFORE_SOFT_TOKEN / (nxagentTokens.pending + 1))) */ int resource; /* * Wait eventually for the number of synchronization requests to * return below the limit. */ #ifdef TEST if (nxagentTokens.pending == TOKENS_PENDING_LIMIT) { fprintf(stderr, "nxagentDispatchHandler: WARNING! Waiting for the synchronization reply.\n"); } #endif while (nxagentTokens.pending == TOKENS_PENDING_LIMIT) { if (nxagentWaitEvents(nxagentDisplay, 0) == -1) { nxagentTokens.pending = 0; nxagentTokens.soft = 0; return; } nxagentDispatchEvents(NULL); nxagentBlocking = 1; } /* * Send a new synchronization request. */ resource = nxagentWaitForResource(NXGetCollectInputFocusResource, nxagentCollectInputFocusPredicate); if (resource == -1) { #ifdef PANIC fprintf(stderr, "nxagentDispatchHandler: PANIC! Cannot allocate any valid resource.\n"); #endif nxagentTokens.soft = 0; return; } #ifdef DEBUG fprintf(stderr, "nxagentDispatchHandler: Requesting a sync reply with [%d] bytes " "and [%d] pending.\n", nxagentTokens.soft, nxagentTokens.pending); #endif NXCollectInputFocus(nxagentDisplay, resource); NXFlushDisplay(nxagentDisplay, NXFlushBuffer); if (nxagentPendingEvents(nxagentDisplay) > 0) { nxagentDispatchEvents(NULL); } nxagentTokens.pending++; nxagentCongestion = (nxagentTokens.pending >= TOKENS_PENDING_LIMIT / 2); #ifdef TEST fprintf(stderr, "nxagentDispatchHandler: Current congestion level is [%d].\n", nxagentCongestion); #endif nxagentTokens.soft = 0; } } /* * Check if there are events to read. */ if (nxagentPendingEvents(nxagentDisplay) > 0) { nxagentDispatchEvents(NULL); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Handlers.h0000644000000000000000000000720213614532331020567 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Handlers_H__ #define __Handlers_H__ /* * Current size of the display buffer. */ extern int nxagentBuffer; /* * Set if we had to block waiting for * the display to become writable. */ extern int nxagentBlocking; /* * Current congestion level based on * the sync requests awaited or the * proxy tokens. */ extern int nxagentCongestion; /* * Bytes read from the agent's clients * and written to the display socket. */ extern double nxagentBytesIn; extern double nxagentBytesOut; /* * Total number of descriptors ready * as reported by the wakeup handler. */ extern int nxagentReady; /* * Timestamp of the last write to the * remote display. */ extern int nxagentFlush; /* * Let the dispatch loop yield control to * a different client after a fair amount * of time or after enough data has been * processed. */ struct _DispatchRec { int client; double in; double out; unsigned long start; }; extern struct _DispatchRec nxagentDispatch; /* * Ensure that we synchronize with the X * server after a given amount of output * is produced. */ struct _TokensRec { int soft; int hard; int pending; }; extern struct _TokensRec nxagentTokens; /* * The agent's block and wakeup handlers. */ void nxagentBlockHandler(void * data, struct timeval **timeout, void * mask); void nxagentWakeupHandler(void * data, int count, void * mask); /* * Executed after each request processed. */ void nxagentDispatchHandler(ClientPtr client, int in, int out); void nxagentShadowBlockHandler(void * data, struct timeval **timeout, void * mask); void nxagentShadowWakeupHandler(void * data, int count, void * mask); extern GCPtr nxagentShadowGCPtr; extern unsigned char nxagentShadowDepth; extern int nxagentShadowWidth; extern int nxagentShadowHeight; extern char *nxagentShadowBuffer; #endif /* __Handlers_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Icons.h0000644000000000000000000000403513614532331020103 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Icons_H__ #define __Icons_H__ #define Pixel XpmPixel #include "X11/include/xpm_nxagent.h" #undef Pixel #define NXAGENT_ICON_NAME "nxagent.xpm" #define X2GOAGENT_ICON_NAME "x2goagent.xpm" #endif /* __Icons_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Image.c0000644000000000000000000013461013614532331020050 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "scrnintstr.h" #include "resource.h" #include "dixstruct.h" #include "../../fb/fb.h" #include "Agent.h" #include "Composite.h" #include "Display.h" #include "Visual.h" #include "Drawable.h" #include "Pixmaps.h" #include "GCs.h" #include "Image.h" #include "Events.h" #include "Client.h" #include "Trap.h" #include "Split.h" #include "Args.h" #include "Screen.h" #include "Pixels.h" #include "Utils.h" #include "compext/Compext.h" #include /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP /* * Don't pack the images having a width, a height or a data size * smaller or equal to these thresholds. */ #define IMAGE_PACK_WIDTH 2 #define IMAGE_PACK_HEIGHT 2 #define IMAGE_PACK_LENGTH 512 /* * Compress the image with a lossless encoder if the percentage of * discrete pixels in the image is below this threshold. */ #define IMAGE_UNIQUE_RATIO 10 /* * Preferred pack and split parameters we got from the NX transport. */ int nxagentPackLossless = -1; int nxagentPackMethod = -1; int nxagentPackQuality = -1; int nxagentSplitThreshold = -1; /* * Set if images can use the alpha channel. */ int nxagentAlphaEnabled = 0; int nxagentAlphaCompat = 0; /* * Used to reformat image when connecting to displays having different * byte order. */ extern void nxagentBitOrderInvert(unsigned char *, int); extern void nxagentTwoByteSwap(unsigned char *, register int); extern void nxagentFourByteSwap(register unsigned char *, register int); extern ClientPtr nxagentRequestingClient; /* * Store the last visual used to unpack the images for the given * client. */ static VisualID nxagentUnpackVisualId[MAX_CONNECTIONS]; /* * Store the last alpha data set for the client. */ typedef struct _UnpackAlpha { char *data; int size; } UnpackAlphaRec; typedef UnpackAlphaRec *UnpackAlphaPtr; static UnpackAlphaPtr nxagentUnpackAlpha[MAX_CONNECTIONS]; /* * Encode the imade alpha channel by using a specific encoding, * separating it from the rest of the RGB data. */ static char *nxagentImageAlpha(XImage *ximage); static void nxagentSetUnpackAlpha(DrawablePtr pDrawable, XImage *pImage, ClientPtr pClient); /* * Copy the source data to the destination. */ static char *nxagentImageCopy(XImage *source, XImage *destination); /* * Return true if the image can be cached. Don't cache the images * packed with the bitmap method as the encoding is little more * expensive than a copy. */ #define nxagentNeedCache(image, method) ((method) != PACK_BITMAP_16M_COLORS) /* * With the bitmap encoding, if the image is 32 bits-per-pixel the 4th * byte is not transmitted, so we don't need to clean the image. */ #define nxagentNeedClean(image, method) \ \ ((method) == PACK_RLE_16M_COLORS || \ (method) == PACK_RGB_16M_COLORS || \ ((method) == PACK_BITMAP_16M_COLORS && \ image -> bits_per_pixel != 32)) /* * Collect the image cache statistics. */ typedef struct _ImageStatisticsRec { double partialLookups; double partialMatches; double partialEncoded; double partialAdded; double totalLookups; double totalMatches; double totalEncoded; double totalAdded; } ImageStatisticsRec; ImageStatisticsRec nxagentImageStatistics; int nxagentImageReformat(char *base, int nbytes, int bpp, int order) { /* * This is used whenever we need to swap the image data. If we got * an image from an X server having a different endianness, we will * need to reformat the image to match our own image-order so that * ProcGetImage can return the expected format to the client. */ switch (bpp) { case 1: { if (BITMAP_BIT_ORDER != order) { #ifdef TEST fprintf(stderr, "nxagentImageReformat: Bit order invert with size [%d] " "bits per pixel [%d] byte order [%d].\n", nbytes, bpp, order); #endif nxagentBitOrderInvert((unsigned char *) base, nbytes); } #if IMAGE_BYTE_ORDER != BITMAP_BIT_ORDER && BITMAP_SCANLINE_UNIT != 8 nxagentImageReformat(base, nbytes, BITMAP_SCANLINE_UNIT, order); #endif break; } case 4: case 8: { break; } case 16: { if (IMAGE_BYTE_ORDER != order) { #ifdef TEST fprintf(stderr, "nxagentImageReformat: Two bytes swap with size [%d] " "bits per pixel [%d] byte order [%d].\n", nbytes, bpp, order); #endif nxagentTwoByteSwap((unsigned char *) base, nbytes); } break; } case 32: { if (IMAGE_BYTE_ORDER != order) { #ifdef TEST fprintf(stderr, "nxagentImageReformat: Four bytes swap with size [%d] " "bits per pixel [%d] byte order [%d].\n", nbytes, bpp, order); #endif nxagentFourByteSwap((unsigned char *) base, nbytes); } break; } } return 1; } int nxagentImageLength(int width, int height, int format, int leftPad, int depth) { int line = 0; if (format == XYBitmap) { line = BitmapBytePad(width + leftPad); } else if (format == XYPixmap) { line = BitmapBytePad(width + leftPad); line *= depth; } else if (format == ZPixmap) { line = PixmapBytePad(width, depth); } return line * height; } int nxagentImagePad(int width, int format, int leftPad, int depth) { int line = 0; if (format == XYBitmap) { line = BitmapBytePad(width + leftPad); } else if (format == XYPixmap) { line = BitmapBytePad(width + leftPad); /* FIXME: shouldn't we multiply by depth here like in nxagentImageLength? */ } else if (format == ZPixmap) { line = PixmapBytePad(width, depth); } return line; } /* * Only copy the data, not the structure. The data pointed by the * destination is lost. Used to clone two images that point to the * same data. */ char *nxagentImageCopy(XImage *source, XImage *destination) { #ifdef DEBUG fprintf(stderr, "nxagentImageClone: Copying [%d] bytes of data from the source.\n", source -> bytes_per_line * source -> height); #endif destination -> data = malloc(source -> bytes_per_line * source -> height); if (destination -> data == NULL) { #ifdef PANIC fprintf(stderr, "nxagentImageCopy: PANIC! Cannot allocate memory for the copy.\n"); #endif } else { memcpy(destination -> data, source -> data, source -> bytes_per_line * source -> height); } return destination -> data; } char *nxagentImageAlpha(XImage *image) { /* * Use one byte per pixel. */ int size = (image -> bytes_per_line * image -> height) >> 2; char *pData = malloc(size); if (pData == NULL) { return NULL; } /* * The image is supposed to be in server order. */ int offset = (image -> byte_order == MSBFirst) ? 0 : 3; char *pSrcData = image -> data; char *pDstData = pData; while (size-- > 0) { *pDstData++ = *(pSrcData + offset); pSrcData += 4; } return pData; } /* * Write down the image cache statistics to the buffer. */ void nxagentImageStatisticsHandler(char **buffer, int type) { /* FIXME: Agent cache statistics have to be implemented. */ #ifdef TEST fprintf(stderr, "nxagentImageStatisticsHandler: STATISTICS! Statistics requested to the agent.\n"); #endif *buffer = NULL; } /* * This should be called only for drawables having a depth of 32. In * the other cases, it would only generate useless traffic. */ void nxagentSetUnpackAlpha(DrawablePtr pDrawable, XImage *pImage, ClientPtr pClient) { int resource = pClient -> index; unsigned int size = (pImage -> bytes_per_line * pImage -> height) >> 2; char *data = nxagentImageAlpha(pImage); if (data == NULL) { #ifdef PANIC fprintf(stderr, "nxagentSetUnpackAlpha: PANIC! Can't allocate data for the alpha channel.\n"); #endif return; } /* * If we are synchronizing the drawable, discard any unpack alpha * stored for the client. The alpha data, in fact, may be still * traveling and so we either wait until the end of the split or * send a fresh copy. */ /* FIXME: Here the split trap is always set and so the caching of the alpha channel is useless. I remember we set the trap because of the cursor but why is it always set now? */ #ifdef DEBUG fprintf(stderr, "nxagentSetUnpackAlpha: Checking alpha channel for client [%d] with trap [%d].\n", resource, nxagentSplitTrap); #endif if (nxagentSplitTrap == 1 || nxagentUnpackAlpha[resource] == NULL || nxagentUnpackAlpha[resource] -> size != size || memcmp(nxagentUnpackAlpha[resource] -> data, data, size) != 0) { #ifdef DEBUG fprintf(stderr, "nxagentSetUnpackAlpha: Sending alpha channel with width [%d] height [%d] " "bytes per line [%d] size [%d].\n", pImage -> width, pImage -> height, pImage -> bytes_per_line, size); #endif /* * Check if we are connected to a newer proxy version and so can * send the alpha data in compressed form. */ if (nxagentAlphaCompat == 0) { NXSetUnpackAlpha(nxagentDisplay, resource, PACK_NONE, size, data, size); } else { NXSetUnpackAlphaCompat(nxagentDisplay, resource, size, data); } if (nxagentUnpackAlpha[resource] != NULL) { SAFE_free(nxagentUnpackAlpha[resource] -> data); } else if ((nxagentUnpackAlpha[resource] = malloc(sizeof(UnpackAlphaRec))) == NULL) { #ifdef PANIC fprintf(stderr, "nxagentSetUnpackAlpha: PANIC! Can't allocate data for the alpha structure.\n"); #endif SAFE_free(data); return; } #ifdef DEBUG fprintf(stderr, "nxagentSetUnpackAlpha: Saved alpha channel for client [%d] with size [%d].\n", resource, size); #endif nxagentUnpackAlpha[resource] -> size = size; nxagentUnpackAlpha[resource] -> data = data; } else { #ifdef DEBUG fprintf(stderr, "nxagentSetUnpackAlpha: Matched alpha channel for client [%d] with size [%d].\n", resource, size); #endif SAFE_free(data); } } /* * The NX agent's implementation of the X server's image functions. */ void nxagentPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int dstX, int dstY, int dstWidth, int dstHeight, int leftPad, int format, char *data) { /* will be checked at nxagentPutImageEnd */ RegionPtr pRegion = NullRegion; int resource = 0; int split = 0; int cache = 1; #ifdef TEST fprintf(stderr, "nxagentPutImage: Image data at [%p] drawable [%s][%p] geometry [%d,%d,%d,%d].\n", data, (pDrawable -> type == DRAWABLE_PIXMAP ? "Pixmap" : "Window"), (void *) pDrawable, dstX, dstY, dstWidth, dstHeight); #endif /* * If the display is down and there is not an nxagent attached, * sleep for a while but still give a chance to the client to write * to the framebuffer. */ int length = nxagentImageLength(dstWidth, dstHeight, format, leftPad, depth); if (nxagentShadowCounter == 0 && NXDisplayError(nxagentDisplay) == 1 && nxagentOption(SleepTime) > 0) { int us = nxagentOption(SleepTime) * 4 * (length / 1024); us = (us < 10000 ? 10000 : (us > 1000000 ? 1000000 : us)); #ifdef DEBUG fprintf(stderr, "nxagentPutImage: Sleeping for [%d] milliseconds with length [%d] and link down.\n", us / 1000, length); #endif usleep(us); } /* * This is of little use because clients usually write to windows * only after an expose event, and, in the rare case they use a * direct put image to the window (for a media player it should be a * necessity), they are likely to monitor the visibility of the * window. */ if (nxagentOption(IgnoreVisibility) == 0 && pDrawable -> type == DRAWABLE_WINDOW && (nxagentWindowIsVisible((WindowPtr) pDrawable) == 0 || (nxagentDefaultWindowIsVisible() == 0 && nxagentCompositeEnable == 0))) { #ifdef TEST fprintf(stderr, "nxagentPutImage: WARNING! Prevented operation on fully obscured " "window at [%p].\n", (void *) pDrawable); #endif goto nxagentPutImageEnd; } /* * This is more interesting. Check if the operation will produce a * visible result based on the clip list of the window and the GC. */ pRegion = nxagentCreateRegion(pDrawable, pGC, dstX, dstY, dstWidth, dstHeight); if (RegionNil(pRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentPutImage: WARNING! Prevented operation on fully clipped " "region [%d,%d,%d,%d] for drawable at [%p].\n", pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2, (void *) pDrawable); #endif goto nxagentPutImageEnd; } /* FIXME: Should use these. int framebuffer = 1; int realize = 1; */ if (nxagentGCTrap == 1 && nxagentReconnectTrap == 0 && nxagentFBTrap == 0 && nxagentShmTrap == 0) { if (pDrawable -> type == DRAWABLE_PIXMAP) { fbPutImage(nxagentVirtualDrawable(pDrawable), pGC, depth, dstX, dstY, dstWidth, dstHeight, leftPad, format, data); } else { fbPutImage(pDrawable, pGC, depth, dstX, dstY, dstWidth, dstHeight, leftPad, format, data); } goto nxagentPutImageEnd; } if (nxagentReconnectTrap == 0 && nxagentSplitTrap == 0) { if (pDrawable -> type == DRAWABLE_PIXMAP && nxagentFBTrap == 0 && nxagentShmTrap == 0) { fbPutImage(nxagentVirtualDrawable(pDrawable), pGC, depth, dstX, dstY, dstWidth, dstHeight, leftPad, format, data); } else if (pDrawable -> type == DRAWABLE_WINDOW) { fbPutImage(pDrawable, pGC, depth, dstX, dstY, dstWidth, dstHeight, leftPad, format, data); } } /* * We are going to realize the operation on the real display. Let's * check if the link is down. */ if (NXDisplayError(nxagentDisplay) == 1) { goto nxagentPutImageEnd; } /* * Mark the region as corrupted and skip the operation if we went * out of bandwidth. The drawable will be synchronized at later * time. Don't do that if the image is likely to be a shape or a * clip mask, if we are here because we are actually synchronizing * the drawable or if the drawable's corrupted region is over-age. */ if (NXAGENT_SHOULD_DEFER_PUTIMAGE(pDrawable)) { if (pDrawable -> type == DRAWABLE_PIXMAP && pDrawable -> depth != 1 && nxagentOption(DeferLevel) >= 1) { /* -- changed by dimbor (small "bed-sheets" never need be prevented - always put) --*/ if (dstHeight > 16) { /* -------------------------------------------------------------------------------- */ #ifdef TEST fprintf(stderr, "nxagentPutImage: WARNING! Prevented operation on region [%d,%d,%d,%d] " "for drawable at [%p] with drawable pixmap.\n", pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2, (void *) pDrawable); #endif nxagentMarkCorruptedRegion(pDrawable, pRegion); goto nxagentPutImageEnd; /* --- changed by dimbor ---*/ } /* ------------------------- */ } if (pDrawable -> type == DRAWABLE_WINDOW && nxagentOption(DeferLevel) >= 2) { #ifdef TEST fprintf(stderr, "nxagentPutImage: WARNING! Prevented operation on region [%d,%d,%d,%d] " "for drawable at [%p] with drawable window.\n", pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2, (void *) pDrawable); #endif nxagentMarkCorruptedRegion(pDrawable, pRegion); goto nxagentPutImageEnd; } } #ifdef TEST else { fprintf(stderr, "nxagentPutImage: Operation on drawable [%p] not skipped with nxagentSplitTrap [%d].\n", (void *) pDrawable, nxagentSplitTrap); } #endif /* * Check whether we need to enclose the image in a split sequence. */ /* FIXME: Should we disable the split with link LAN? split = (nxagentOption(Streaming) == 1 && nxagentOption(LinkType) != LINK_TYPE_NONE && nxagentOption(LinkType) != LINK_TYPE_LAN */ split = (nxagentOption(Streaming) == 1 && nxagentOption(LinkType) != LINK_TYPE_NONE /* FIXME: Do we stream the images from GLX or Xv? If we do that, we should also write on the frame buffer, including the images put on windows, to be able to reconstruct the region that is out of sync. Surely we should not try to cache the GLX and Xv images in memory or save them in the image cache on disk. */ /* FIXME: Temporarily stream the GLX data. && nxagentGlxTrap == 0 && nxagentXvTrap == 0 */ ); /* * Never split images whose depth is less than 15. */ if (split == 1 && (nxagentSplitTrap == 1 || depth < 15)) { #ifdef TEST if (nxagentSplitTrap == 1 || nxagentReconnectTrap == 1) { fprintf(stderr, "nxagentPutImage: Not splitting with reconnection [%d] trap [%d] " "depth [%d].\n", nxagentSplitTrap, nxagentReconnectTrap, depth); } #endif split = 0; } #ifdef TEST else if (split == 1) { fprintf(stderr, "nxagentPutImage: Splitting with reconnection [%d] trap [%d] " "depth [%d].\n", nxagentSplitTrap, nxagentReconnectTrap, depth); } #endif #ifdef TEST if (split == 1) { fprintf(stderr, "nxagentPutImage: Splitting the image with size [%d] " "link [%d] GLX [%d] Xv [%d].\n", length, nxagentOption(LinkType), nxagentGlxTrap, nxagentXvTrap); } else if (nxagentOption(LinkType) != LINK_TYPE_NONE) { fprintf(stderr, "nxagentPutImage: Not splitting the image with size [%d] " "link [%d] GLX [%d] Xv [%d].\n", length, nxagentOption(LinkType), nxagentGlxTrap, nxagentXvTrap); } #endif /* * If the image was originated by a GLX or Xvideo request, * temporarily disable the use of the cache. */ if (nxagentOption(LinkType) != LINK_TYPE_NONE && (nxagentGlxTrap == 1 || nxagentXvTrap == 1)) { #ifdef TEST fprintf(stderr, "nxagentPutImage: Disabling the use of the cache with GLX or Xvideo.\n"); #endif NXSetCacheParameters(nxagentDisplay, 0, 1, 0, 0); cache = 0; } /* * Enclose the next messages in a split sequence. The proxy will * tell us if the split took place. */ if (split == 1) { /* * If the drawable is already being split, expand the * region. Currently drawables can't have more than a single split * region. */ if (nxagentSplitResource(pDrawable) != NULL) { #ifdef WARNING fprintf(stderr, "nxagentPutImage: WARNING! Expanding the region with drawable at [%p] streaming.\n", (void *) pDrawable); #endif /* FIXME: Should probably intersect the region with the region being split to also invalidate the commits. */ nxagentMarkCorruptedRegion(pDrawable, pRegion); goto nxagentPutImageEnd; } else { /* * Assign a new resource to the drawable. Will also assign the * GC to use for the operation. */ resource = nxagentCreateSplit(pDrawable, &pGC); #ifdef TEST fprintf(stderr, "nxagentPutImage: Resource [%d] assigned to drawable at [%p].\n", resource, (void *) pDrawable); #endif } NXStartSplit(nxagentDisplay, resource, NXSplitModeDefault); } nxagentRealizeImage(pDrawable, pGC, depth, dstX, dstY, dstWidth, dstHeight, leftPad, format, data); if (split == 1) { NXEndSplit(nxagentDisplay, resource); /* * Now we need to check if all the messages went straight through * the output stream or any of them required a split. If no split * will take place, we will remove the association with the * drawable and release the resource at the time we will handle * the no-split event. */ split = nxagentWaitSplitEvent(resource); if (split == 1) { #ifdef TEST fprintf(stderr, "nxagentPutImage: Marking corrupted region [%d,%d,%d,%d] for drawable at [%p].\n", pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2, (void *) pDrawable); #endif /* * Marking the corrupted region we will check if the region * intersects the split region, therefore the split region must * be added later. */ nxagentMarkCorruptedRegion(pDrawable, pRegion); /* * Assign the region to the drawable. */ nxagentRegionSplit(pDrawable, pRegion); pRegion = NullRegion; } } /* * The split value could be changed by a no-split event in the block * above, so here we have to check the value again. */ if (split == 0) { if (nxagentDrawableStatus(pDrawable) == NotSynchronized) { /* * We just covered the drawable with a solid image. We can * consider the overlapping region as synchronized. */ #ifdef TEST fprintf(stderr, "nxagentPutImage: Marking synchronized region [%d,%d,%d,%d] for drawable at [%p].\n", pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2, (void *) pDrawable); #endif nxagentUnmarkCorruptedRegion(pDrawable, pRegion); } } nxagentPutImageEnd: /* * Check if we disabled caching. */ if (cache == 0) { #ifdef TEST fprintf(stderr, "nxagentPutImage: Reenabling the use of the cache.\n"); #endif NXSetCacheParameters(nxagentDisplay, 1, 1, 1, 1); } if (pRegion != NullRegion) { nxagentFreeRegion(pDrawable, pRegion); } } void nxagentRealizeImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *data) { /* * NXPutPackedImage is longer than PutPackedImage so that we * subtract the bigger one to be sure. */ const int subSize = (MAX_REQUEST_SIZE << 2) - sizeof(xNXPutPackedImageReq); Visual *pVisual = NULL; RegionPtr clipRegion = NullRegion; XImage *image = NULL; if (NXDisplayError(nxagentDisplay) == 1) { #ifdef TEST fprintf(stderr, "nxagentRealizeImage: Returning on display error.\n"); #endif goto nxagentRealizeImageEnd; } /* * Get the visual according to the drawable and depth. */ pVisual = nxagentImageVisual(pDrawable, depth); if (pVisual == NULL) { #ifdef WARNING fprintf(stderr, "nxagentRealizeImage: WARNING! Visual not found. Using default visual.\n"); #endif pVisual = nxagentVisuals[nxagentDefaultVisualIndex].visual; } /* * Get bytes per line according to format. */ int bytesPerLine = nxagentImagePad(w, format, leftPad, depth); if (nxagentOption(Shadow) == 1 && format == ZPixmap && (nxagentOption(XRatio) != DONT_SCALE || nxagentOption(YRatio) != DONT_SCALE) && pDrawable == (DrawablePtr) nxagentShadowPixmapPtr) { image = XCreateImage(nxagentDisplay, pVisual, depth, ZPixmap, 0, data, w, h, BitmapPad(nxagentDisplay), bytesPerLine); if (image != NULL) { int scaledx; int scaledy; image -> byte_order = IMAGE_BYTE_ORDER; image -> bitmap_bit_order = BITMAP_BIT_ORDER; nxagentScaleImage(x, y, nxagentOption(XRatio), nxagentOption(YRatio), &image, &scaledx, &scaledy); x = scaledx; y = scaledy; w = image -> width; h = image -> height; data = image -> data; /* * Width of image has changed. */ bytesPerLine = nxagentImagePad(w, format, leftPad, depth); } #ifdef WARNING else { fprintf(stderr, "nxagentRealizeImage: Failed to create XImage for scaling.\n"); } #endif } if (w == 0 || h == 0) { goto nxagentRealizeImageEnd; } int totalHeight = h; int length = bytesPerLine * h; h = (subSize < length ? subSize : length) / bytesPerLine; int numSubImages = totalHeight / h + 1; while (numSubImages > 0) { if (pDrawable -> type == DRAWABLE_WINDOW) { clipRegion = nxagentCreateRegion(pDrawable, pGC, x, y, w, h); } if (clipRegion == NullRegion || RegionNil(clipRegion) == 0) { nxagentPutSubImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, data, pVisual); } #ifdef TEST else { fprintf(stderr, "nxagentRealizeImage: Skipping the put sub image with geometry " "[%d,%d,%d,%d] on hidden window at [%p].\n", x, y, w, h, (void *) pDrawable); } #endif if (clipRegion != NullRegion) { nxagentFreeRegion(pDrawable, clipRegion); } y += h; data += h * bytesPerLine; if (--numSubImages == 1) { h = totalHeight % h; if (h == 0) { break; } } } nxagentRealizeImageEnd: if (image != NULL) { XDestroyImage(image); } } void nxagentPutSubImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *data, Visual *pVisual) { NXPackedImage *packedImage = NULL; XImage *plainImage = NULL; unsigned char *packedChecksum = NULL; unsigned int packMethod = nxagentPackMethod; unsigned int packQuality = nxagentPackQuality; ClientPtr client; int lossless = 0; int clean = 0; int pack = 0; /* * XCreateImage is the place where the leftPad should be passed. * The image data is received from our client unmodified. In theory * what we would need to do is just creating an appropriate XImage * structure based on the incoming data and let Xlib do the * rest. Probably we don't have to pass leftPad again in the src_x * of XPutImage otherwise the src_x would make Xlib to take into * account the xoffset field twice. Unfortunately passing the * leftPad doesn't work. * * plainImage = XCreateImage(nxagentDisplay, pVisual, * depth, format, leftPad, data, * w, h, BitmapPad(nxagentDisplay), * nxagentImagePad(w, format, leftPad, depth)); */ if ((plainImage = XCreateImage(nxagentDisplay, pVisual, depth, format, leftPad, data, w, h, BitmapPad(nxagentDisplay), nxagentImagePad(w, format, leftPad, depth))) == NULL) { #ifdef WARNING fprintf(stderr, "nxagentPutSubImage: WARNING! Failed to create image.\n"); #endif goto nxagentPutSubImageEnd; } #ifdef DEBUG fprintf(stderr, "nxagentPutSubImage: Handling image with geometry [%d,%d] depth [%d].\n", w, h, depth); fprintf(stderr, "nxagentPutSubImage: Default pack method is [%d] quality is [%d].\n", packMethod, packQuality); #endif /* FIXME: Should use an unpack resource here. */ client = nxagentRequestingClient; if (client == NULL) { client = serverClient; #ifdef TEST fprintf(stderr, "nxagentPutSubImage: WARNING! Using the server client with index [%d].\n", client -> index); #endif } #ifdef TEST fprintf(stderr, "nxagentPutSubImage: Server order is [%d] client order is [%d].\n", nxagentServerOrder(), nxagentClientOrder(client)); #endif #ifdef TEST fprintf(stderr, "nxagentPutSubImage: Display image order is [%d] bitmap order is [%d].\n", ImageByteOrder(nxagentDisplay), BitmapBitOrder(nxagentDisplay)); #endif /* * We got the image data from the X client or from the frame-buffer * with our own endianness. Byte swap the image data if the display * has a different endianness than our own. */ if (nxagentImageNormalize(plainImage) != 0) { #ifdef TEST fprintf(stderr, "nxagentPutSubImage: WARNING! Reformatted the image with remote order [%d/%d].\n", plainImage -> byte_order, plainImage -> bitmap_bit_order); #endif } #ifdef TEST fprintf(stderr, "nxagentPutSubImage: Image has visual with RGB color masks [%0lx][%0lx][%0lx].\n", pVisual -> red_mask, pVisual -> green_mask, pVisual -> blue_mask); #endif /* * Check if the user requested to pack the image but don't pack it * if we are not connected to a proxy or if the depth is less than * 15 bpp. */ pack = (nxagentOption(LinkType) != LINK_TYPE_NONE && packMethod != PACK_NONE && depth > 8 && format == ZPixmap); lossless = (packMethod == nxagentPackLossless); if (pack == 1 && lossless == 0) { /* * Force the image to be sent as a plain bitmap if we don't have * any lossless encoder available. */ if (w <= IMAGE_PACK_WIDTH || h <= IMAGE_PACK_HEIGHT || nxagentImageLength(w, h, format, leftPad, depth) <= IMAGE_PACK_LENGTH || nxagentLosslessTrap == 1) { if (nxagentPackLossless == PACK_NONE) { #ifdef TEST fprintf(stderr, "nxagentPutSubImage: Disabling pack with lossless method [%d] " "trap [%d] size [%d].\n", nxagentPackLossless, nxagentLosslessTrap, nxagentImageLength(w, h, format, leftPad, depth)); #endif pack = 0; } else { #ifdef TEST fprintf(stderr, "nxagentPutSubImage: Lossless encoder with geometry [%d,%d] " "trap [%d] size [%d].\n", w, h, nxagentLosslessTrap, nxagentImageLength(w, h, format, leftPad, depth)); #endif packMethod = nxagentPackLossless; lossless = 1; } } } /* * Do we still want to pack the image? */ if (pack == 1) { /* * Set the geometry and alpha channel to be used for the unpacked * image. */ if (nxagentUnpackVisualId[client -> index] != pVisual -> visualid) { nxagentUnpackVisualId[client -> index] = pVisual -> visualid; #ifdef DEBUG fprintf(stderr, "nxagentPutSubImage: Sending new geometry for client [%d].\n", client -> index); #endif NXSetUnpackGeometry(nxagentDisplay, client -> index, pVisual); } /* * Check if the image is supposed to carry the alpha data in the * fourth byte and, if so, send the alpha channel using the * specific encoding. */ if (plainImage -> depth == 32) { nxagentSetUnpackAlpha(pDrawable, plainImage, client); } /* * If the image doesn't come from the XVideo or the GLX extension * try to locate it in the cache. The case of the lossless trap is * also special, as we want to eventually encode the image again * using a lossless compression. */ /* FIXME: Should try to locate the image anyway, if the lossless trap is set, and if the image was encoded by a lossy compressor, roll back the changes and encode the image again using the preferred method. */ if (nxagentNeedCache(plainImage, packMethod) && nxagentGlxTrap == 0 && nxagentXvTrap == 0 && nxagentLosslessTrap == 0 && NXImageCacheSize > 0) { /* * Be sure that the padding bits are cleaned before calculating * the MD5 checksum. */ /* FIXME: There should be a callback registered by the agent that provides a statistics report, in text format, telling for example how many images were searched in the cache, how many were found, how many drawables are to be synchronized, etc. This statistics report would be included by the proxy in its stat output. */ clean = 1; NXCleanImage(plainImage); /* * Will return a pointer to the image and checksum taken from * the cache, if found. If the image is not found, the function * returns a null image and a pointer to the calculated * checksum. It is up to the application to free the memory. We * will use the checksum to add the image in the cache. */ packedImage = NXCacheFindImage(plainImage, &packMethod, &packedChecksum); nxagentImageStatistics.partialLookups++; nxagentImageStatistics.totalLookups++; if (packedImage != NULL) { #ifdef DEBUG fprintf(stderr, "nxagentPutSubImage: Matched image of geometry [%d,%d] data size [%d] in cache.\n", w, h, packedImage -> xoffset); #endif NXPutPackedImage(nxagentDisplay, client -> index, nxagentDrawable(pDrawable), nxagentGC(pGC), packedImage, packMethod, depth, 0, 0, x, y, w, h); nxagentImageStatistics.partialMatches++; nxagentImageStatistics.totalMatches++; packedChecksum = NULL; packedImage = NULL; goto nxagentPutSubImageEnd; } #ifdef DEBUG else { fprintf(stderr, "nxagentPutSubImage: WARNING! Missed image of geometry [%d,%d] in cache.\n", w, h); } #endif } /* * If a specific encoder was not mandated, try to guess if a * lossless encoder will compress better. */ if (lossless == 0 && nxagentOption(Adaptive) == 1) { int ratio = nxagentUniquePixels(plainImage); if (ratio <= IMAGE_UNIQUE_RATIO) { #ifdef TEST fprintf(stderr, "nxagentPutSubImage: Lossless encoder with geometry [%d,%d] ratio [%d%%].\n", w, h, ratio); #endif packMethod = nxagentPackLossless; lossless = 1; } #ifdef TEST else { fprintf(stderr, "nxagentPutSubImage: Default encoder with geometry [%d,%d] ratio [%d%%].\n", w, h, ratio); } #endif } /* * Encode the image using the selected pack method. */ if (packMethod == PACK_RLE_16M_COLORS || packMethod == PACK_RGB_16M_COLORS || packMethod == PACK_BITMAP_16M_COLORS) { /* * Cleanup the image if we didn't do that yet. We assume that * the JPEG and PNG compression methods will actually ignore the * padding bytes. In other words, bitmap images producing the * same visual output should produce compressed images that are * bitwise the same regardless the padding bits. */ if (clean == 0) { if (nxagentNeedClean(plainImage, packMethod) == 1) { clean = 1; NXCleanImage(plainImage); } } switch (packMethod) { /* * If nothing is done by the bitmap encoder, it saves an * allocation and a memory copy by setting the data field of * the packed image to the original data. We need to check * this at the time we will free the packed image. */ case PACK_BITMAP_16M_COLORS: { packedImage = NXEncodeBitmap(plainImage, packMethod, packQuality); break; } case PACK_RGB_16M_COLORS: { packedImage = NXEncodeRgb(plainImage, packMethod, packQuality); break; } default: { packedImage = NXEncodeRle(plainImage, packMethod, packQuality); break; } } } else if (packMethod >= PACK_JPEG_8_COLORS && packMethod <= PACK_JPEG_16M_COLORS) { packedImage = NXEncodeJpeg(plainImage, packMethod, packQuality); } else if (packMethod >= PACK_PNG_8_COLORS && packMethod <= PACK_PNG_16M_COLORS) { packedImage = NXEncodePng(plainImage, packMethod, packQuality); } else if (packMethod != PACK_NONE) { #ifdef WARNING fprintf(stderr, "nxagentPutSubImage: WARNING! Ignoring deprecated pack method [%d].\n", packMethod); #endif packMethod = PACK_NONE; } } /* * If we didn't produce a valid packed image, send the image as a X * bitmap. */ if (packedImage != NULL) { nxagentImageStatistics.partialEncoded++; nxagentImageStatistics.totalEncoded++; #ifdef DEBUG fprintf(stderr, "nxagentPutSubImage: Using packed image with method [%d] quality [%d] " "geometry [%d,%d] data size [%d].\n", packMethod, packQuality, w, h, packedImage -> xoffset); #endif NXPutPackedImage(nxagentDisplay, client -> index, nxagentDrawable(pDrawable), nxagentGC(pGC), packedImage, packMethod, depth, 0, 0, x, y, w, h); /* * Add the image only if we have a valid checksum. This is the * case only if we originally tried to find the image in cache. */ if (NXImageCacheSize > 0 && packedChecksum != NULL) { #ifdef DEBUG fprintf(stderr, "nxagentPutSubImage: Adding image with geometry [%d,%d] data size [%d] " "to the cache.\n", w, h, packedImage -> xoffset); #endif /* * Check if both the plain and the packed image point to the * same data. In this case we need a copy. */ if (packedImage -> data == plainImage -> data && nxagentImageCopy(plainImage, packedImage) == NULL) { goto nxagentPutSubImageEnd; } NXCacheAddImage(packedImage, packMethod, packedChecksum); nxagentImageStatistics.partialAdded++; nxagentImageStatistics.totalAdded++; packedChecksum = NULL; packedImage = NULL; } } else { /* * Clean the image to help the proxy to match the checksum in its * cache. Do that only if the differential compression is enabled * and if the image is not supposed to carry the alpha data in the * fourth byte of the pixel. */ /* FIXME: If we failed to encode the image by any of the available methods, for example if we couldn't allocate memory, we may need to ripristinate the alpha channel, that in the meanwhile was sent in the unpack alpha message. This can be done here, if the clean flag is true and we are going to send a plain image. */ if (clean == 0) { clean = (nxagentOption(LinkType) != LINK_TYPE_NONE && nxagentOption(LinkType) != LINK_TYPE_LAN && depth != 32); if (clean == 1) { #ifdef DEBUG fprintf(stderr, "nxagentPutSubImage: Cleaning the image with link type [%d] and depth [%d].\n", nxagentOption(LinkType), depth); #endif NXCleanImage(plainImage); } #ifdef DEBUG else { fprintf(stderr, "nxagentPutSubImage: Not cleaning the image with link type [%d] and depth [%d].\n", nxagentOption(LinkType), depth); } #endif } #ifdef DEBUG fprintf(stderr, "nxagentPutSubImage: Calling XPutImage with geometry [%d,%d] and data size [%d].\n", w, h, plainImage -> bytes_per_line * plainImage -> height); #endif /* * Passing the leftPad value in src_x doesn't work. * * XPutImage(nxagentDisplay, nxagentDrawable(pDrawable), * nxagentGC(pGC), plainImage, leftPad, 0, x, y, w, h); */ XPutImage(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), plainImage, 0, 0, x, y, w, h); } nxagentPutSubImageEnd: #ifdef TEST fprintf(stderr, "nxagentPutSubImage: Performed [%.0f] lookups in the cache with [%.0f] matches.\n", nxagentImageStatistics.totalLookups, nxagentImageStatistics.totalMatches); fprintf(stderr, "nxagentPutSubImage: Encoded [%.0f] images with [%.0f] added to the cache.\n", nxagentImageStatistics.totalEncoded, nxagentImageStatistics.totalAdded); #endif SAFE_free(packedChecksum); if (packedImage != NULL) { if (packedImage -> data != NULL && packedImage -> data != plainImage -> data) { SAFE_free(packedImage -> data); } SAFE_free(packedImage); } SAFE_free(plainImage); } void nxagentGetImage(DrawablePtr pDrawable, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *data) { #ifdef TEST fprintf(stderr, "nxagentGetImage: Called with drawable at [%p] geometry [%d,%d,%d,%d].\n", (void *) pDrawable, x, y, w, h); fprintf(stderr, "nxagentGetImage: Format is [%d] plane mask is [%lx].\n", format, planeMask); #endif if ((pDrawable)->type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "nxagentGetImage: Going to get image from virtual pixmap at [%p].\n", (void *) nxagentVirtualDrawable(pDrawable)); #endif fbGetImage(nxagentVirtualDrawable(pDrawable), x, y, w, h, format, planeMask, data); } else { fbGetImage(pDrawable, x, y, w, h, format, planeMask, data); } } /* * We have to reset the visual cache before connecting to another * display, so that a new unpack geometry can be communicated to the * new proxy. */ void nxagentResetVisualCache(void) { for (int i = 0; i < MAX_CONNECTIONS; i++) { nxagentUnpackVisualId[i] = None; } } void nxagentResetAlphaCache(void) { for (int i = 0; i < MAX_CONNECTIONS; i++) { if (nxagentUnpackAlpha[i]) { SAFE_free(nxagentUnpackAlpha[i] -> data); SAFE_free(nxagentUnpackAlpha[i]); } } } int nxagentScaleImage(int x, int y, unsigned xRatio, unsigned yRatio, XImage **pImage, int *scaledx, int *scaledy) { XImage *image = *pImage; if (image == NULL) { return 0; } int x1 = (xRatio * x) >> PRECISION; int x2 = (xRatio * (x + image -> width)) >> PRECISION; int y1 = (yRatio * y) >> PRECISION; int y2 = (yRatio * (y + image -> height)) >> PRECISION; int newWidth = x2 - x1; int newHeight = y2 - y1; XImage *newImage = XCreateImage(nxagentDisplay, NULL, image -> depth, image -> format, 0, NULL, newWidth, newHeight, BitmapPad(nxagentDisplay), PixmapBytePad(newWidth, image -> depth)); if (newImage == NULL) { #ifdef PANIC fprintf(stderr, "nxagentScaleImage: PANIC! Failed to create the target image.\n"); #endif return 0; } newImage -> red_mask = image -> red_mask; newImage -> green_mask = image -> green_mask; newImage -> blue_mask = image -> blue_mask; newImage -> byte_order = IMAGE_BYTE_ORDER; newImage -> bitmap_bit_order = BITMAP_BIT_ORDER; newImage -> data = malloc(newImage -> bytes_per_line * newHeight); if (newImage -> data == NULL) { SAFE_free(newImage); #ifdef PANIC fprintf(stderr, "nxagentScaleImage: PANIC! Failed to create the target image data.\n"); #endif return 0; } newImage -> width = newWidth; newImage -> height = newHeight; for (int j = y; j < y + image -> height; j++) { int yy1 = (yRatio * j) >> PRECISION; int yy2 = (yRatio * (j + 1)) >> PRECISION; for (int i = x; i < x + image -> width; i++) { unsigned long val; #ifndef FAST_GET_PUT_PIXEL val = XGetPixel(image, i - x, j - y); #else char * srcPixel = &image -> data[(j * image -> bytes_per_line) + ((i * image -> bits_per_pixel) >> 3)]; char * dstPixel = (char *) &val; val = 0; for (int m = (image -> bits_per_pixel + 7) >> 3; --m >= 0; ) { *dstPixel++ = *srcPixel++; } #endif int xx1 = (xRatio * i) >> PRECISION; int xx2 = (xRatio * (i + 1)) >> PRECISION; for (int l = yy1; l < yy2; l++) { for (int k = xx1; k < xx2; k++) { #ifndef FAST_GET_PUT_PIXEL XPutPixel(newImage, k - x1, l - y1, val); #else char *dstPixel = &newImage -> data[((l - y1) * newImage -> bytes_per_line) + (((k - x1) * newImage -> bits_per_pixel) >> 3)]; char *srcPixel = (char *) &val; for (int m = (newImage -> bits_per_pixel + 7) >> 3; --m >= 0; ) { *dstPixel++ = *srcPixel++; } #endif } } } } SAFE_free(image -> obdata); SAFE_free(image); *pImage = newImage; *scaledx = x1; *scaledy = y1; return 1; } char *nxagentAllocateImageData(int width, int height, int depth, int *length, int *format) { *format = (depth == 1) ? XYPixmap : ZPixmap; *length = nxagentImageLength(width, height, *format, 0, depth); char *data = malloc(*length); if (data == NULL) { #ifdef WARNING fprintf(stderr, "nxagentAllocateImageData: WARNING! Failed to allocate [%d] bytes of memory.\n", *length); #endif } return data; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Image.h0000644000000000000000000001103413614532331020047 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Image_H__ #define __Image_H__ /* * Graphic operations. */ void nxagentPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int dstX, int dstY, int dstWidth, int dstHeight, int leftPad, int format, char *data); void nxagentRealizeImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *data); void nxagentPutSubImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *data, Visual *pVisual); void nxagentGetImage(DrawablePtr pDrawable, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *data); /* * Pack and split parameters we get * from the NX transport. */ extern int nxagentPackLossless; extern int nxagentPackMethod; extern int nxagentPackQuality; extern int nxagentSplitThreshold; /* * Set if images can use the alpha * channel and if the alpha channel * can be sent in compressed form. */ extern int nxagentAlphaEnabled; extern int nxagentAlphaCompat; /* * Reset the visual and alpha cache * before closing the screen or con- * necting to a different display. */ void nxagentResetVisualCache(void); void nxagentResetAlphaCache(void); /* * Always use the default visual for the * image related functions. */ #define nxagentImageVisual(pDrawable, depth) \ ((depth) == 32 ? &nxagentAlphaVisual : \ nxagentDefaultVisual(((pDrawable) -> pScreen))) /* * Byte swap the image if the display * uses a different endianness. */ #define nxagentImageNormalize(image) \ ((image) -> byte_order != IMAGE_BYTE_ORDER || \ (image) -> bitmap_bit_order != BITMAP_BIT_ORDER ? \ nxagentImageReformat((image) -> data, (image) -> bytes_per_line * \ (image) -> height * ((image) -> format == XYPixmap ? (image) -> depth : 1), \ ((image) -> format == ZPixmap ? \ BitsPerPixel((image) -> depth) : 1), \ (image) -> byte_order) : 0) /* * Other image related functions. */ int nxagentImageLength(int width, int height, int format, int leftPad, int depth); int nxagentImagePad(int width, int format, int leftPad, int depth); int nxagentImageReformat(char *base, int nbytes, int bpp, int order); void nxagentImageStatisticsHandler(char **buffer, int type); int nxagentScaleImage(int x, int y, unsigned xRatio, unsigned yRatio, XImage **pImage, int *scaledx, int *scaledy); char *nxagentAllocateImageData(int width, int height, int depth, int *length, int *format); #endif /* __Image_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Imakefile0000644000000000000000000001300713614532331020467 0ustar #include NULL = SUBDIRS = compext \ $(NULL) SRCS = \ NXwindow.c \ NXevents.c \ NXproperty.c \ NXdixfonts.c \ NXglyphcurs.c \ NXdispatch.c \ NXrender.c \ NXglyph.c \ NXpicture.c \ NXshm.c \ NXglxext.c \ NXxvdisp.c \ NXresource.c \ NXmitrap.c \ Args.c \ Binder.c \ BitmapUtils.c \ Colormap.c \ Cursor.c \ Dialog.c \ Display.c \ Events.c \ Font.c \ GC.c \ GCOps.c \ Millis.c \ Handlers.c \ Init.c \ Keyboard.c \ Keystroke.c \ Pointer.c \ Screen.c \ Visual.c \ Drawable.c \ Window.c \ Pixmap.c \ Render.c \ Client.c \ Rootless.c \ Extensions.c \ Options.c \ Clipboard.c \ Splash.c \ Split.c \ Reconnect.c \ Error.c \ Atoms.c \ Trap.c \ Image.c \ Composite.c \ Pixels.c \ stubs.c \ miinitext.c \ $(NULL) OBJS = \ NXwindow.o \ NXevents.o \ NXproperty.o \ NXdixfonts.o \ NXglyphcurs.o \ NXdispatch.o \ NXrender.o \ NXglyph.o \ NXpicture.o \ NXshm.o \ NXglxext.o \ NXxvdisp.o \ NXresource.o \ NXmitrap.o \ Args.o \ Binder.o \ BitmapUtils.o \ Colormap.o \ Cursor.o \ Dialog.o \ Display.o \ Events.o \ Font.o \ GC.o \ GCOps.o \ Millis.o \ Handlers.o \ Init.o \ Keyboard.o \ Keystroke.o \ Pointer.o \ Screen.o \ Visual.o \ Drawable.o \ Window.o \ Pixmap.o \ Render.o \ Client.o \ Rootless.o \ Extensions.o \ Options.o \ Clipboard.o \ Splash.o \ Split.o \ Reconnect.o \ Error.o \ Atoms.o \ Trap.o \ Image.o \ Composite.o \ Pixels.o \ stubs.o \ miinitext.o \ $(NULL) VFBINCLUDES = \ -I../../fb \ -I../../mfb \ -I../../render \ $(NULL) INCLUDES = \ -I. \ -I../../../../extras/Mesa/include \ -I$(XBUILDINCDIR) \ -I../../mi \ -I../../include \ -I../../os \ -I../../miext/cw \ -I../../GL/glx \ -I../../GL/include \ -I../../../../lib/GL/include \ -I../../Xext \ -I../../../../lib/include/X11 \ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ $(VFBINCLUDES) \ `pkg-config --cflags-only-I libxml-2.0` \ `pkg-config --cflags-only-I pixman-1` \ $(NULL) #ifdef SunArchitecture INCLUDES = \ -I. \ -I../../../../extras/Mesa/include \ -I$(XBUILDINCDIR) \ -I/usr/sfw/include \ -I../../mi \ -I../../include \ -I../../os \ -I../../GL/glx \ -I../../GL/include \ -I../../../../lib/GL/include \ -I../../Xext \ -I../../miext/cw \ -I../../../../lib/include/X11 \ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ $(VFBINCLUDES) \ `pkg-config --cflags-only-I libxml-2.0` \ `pkg-config --cflags-only-I pixman-1` \ $$(pkg-config --exists 'zlib' >/dev/null 2>&1 && pkg-config --cflags-only-I 'zlib') \ `pkg-config --cflags-only-I libpng` \ $(NULL) #else #ifdef cygwinArchitecture INCLUDES = \ -I. -I$(XBUILDINCDIR) \ -I../../mi \ -I../../include \ -I../../os \ -I../../GL/glx \ -I../../GL/include \ -I../../../../lib/GL/include \ -I../../Xext \ -I../../miext/cw \ -I../../../../../nxcomp \ -I../../../../../nxcompshad \ -I../../../../extras/Mesa/include \ -I../../../../lib/include/X11 \ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ $(VFBINCLUDES) \ `pkg-config --cflags-only-I libxml-2.0` \ `pkg-config --cflags-only-I pixman-1` \ $$(pkg-config --exists 'zlib' >/dev/null 2>&1 && pkg-config --cflags-only-I 'zlib') \ `pkg-config --cflags-only-I libpng` \ $(NULL) #endif #endif ### NXAGENT Defines: # # NXAGENT_SHAPE Old shape code # NXAGENT_SHAPE2 New shape code # NXAGENT_FIXKEYS Force the release of pressed key when losing focus # NXAGENT_CLIPBOARD Enables clipboard cut and paste function between X servers. # NXAGENT_RANDR_MODE_PREFIX Prefix for RandR modes (i.e., nx_x) (default: nx_) # NXAGENT_RANDR_XINERAMA_CLIPPING cut off invisible window parts in xinerama mode (you probably do not want this) # NXAGENT_TIMESTAMP print duration for some routines # ### macros not investigated yet: # # NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL # NXAGENT_RENDER_CLEANUP # NXAGENT_WAKEUP= # NXAGENT_ONSTART # NXAGENT_SPLASH # NXAGENT_ARTSD # ### Debug macros: # # DEBUG_COLORMAP # DEBUG_TREE # NXAGENT_DEBUG # NXAGENT_FIXKEYS_DEBUG # NXAGENT_FONTCACHE_DEBUG # NXAGENT_FONTMATCH_DEBUG # NXAGENT_LOGO_DEBUG # NXAGENT_RECONNECT_COLORMAP_DEBUG # NXAGENT_RECONNECT_CURSOR_DEBUG # NXAGENT_RECONNECT_DEBUG # NXAGENT_RECONNECT_DISPLAY_DEBUG # NXAGENT_RECONNECT_FONT_DEBUG # NXAGENT_RECONNECT_PICTFORMAT_DEBUG # NXAGENT_RECONNECT_PICTURE_DEBUG # NXAGENT_RECONNECT_SCREEN_DEBUG # NXAGENT_RECONNECT_WINDOW_DEBUG # NXAGENT_XKBD_DEBUG # NX_DEBUG_INPUT #if nxVersion NX_DEFINES = \ -DNX_VERSION_CURRENT="$(NX_VERSION_CURRENT)" \ -DNX_VERSION_CURRENT_STRING="\"$(NX_VERSION_CURRENT_STRING)\"" \ $(NULL) #endif DEFINES = \ -g $(OS_DEFINES) $(EXT_DEFINES) $(NX_DEFINES) \ -UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UXF86DRI \ -DNXAGENT_SERVER \ -DNXAGENT_RENDER_CLEANUP \ -DNXAGENT_SHAPE2 \ -DNXAGENT_FIXKEYS \ -DNXAGENT_CLIPBOARD \ -DNXAGENT_WAKEUP=1000 \ -DNXAGENT_ONSTART \ -DNXAGENT_ARTSD \ -UNX_DEBUG_INPUT \ -DRANDR_10_INTERFACE=1 \ -DRANDR_12_INTERFACE=1 \ -DRANDR_13_INTERFACE=1 \ -DRANDR_14_INTERFACE=1 \ -DRANDR_15_INTERFACE=1 \ -DPANORAMIX \ -UDEBUG_TREE \ -DSYSTEMFONTDIR=\"$(SYSTEMFONTDIR)\" \ $(NULL) all:: $(OBJS) LinkSourceFile(stubs.c,$(SERVERSRC)/Xi) LinkSourceFile(miinitext.c,$(SERVERSRC)/mi) SpecialCObjectRule(miinitext,$(ICONFIGFILES), $(_NOOP_)) NormalLibraryObjectRule() NormalLibraryTarget(nxagent,$(OBJS)) DependTarget() #define IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Init.c0000644000000000000000000003316613614532331017735 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #include #include #include #include "X.h" #include "Xproto.h" #include "screenint.h" #include "input.h" #include "misc.h" #include "scrnintstr.h" #include "windowstr.h" #include "servermd.h" #include "mi.h" #include #include "dixfontstr.h" #include "Agent.h" #include "Display.h" #include "Screen.h" #include "Pointer.h" #include "Keyboard.h" #include "Handlers.h" #include "Events.h" #include "Init.h" #include "Args.h" #include "Client.h" #include "Options.h" #include "Drawable.h" #include "Pixmaps.h" #include "GCs.h" #include "Font.h" #include "Millis.h" #include "Error.h" #include "Keystroke.h" #include "Atoms.h" #include #include "compext/Compext.h" #include "Reconnect.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP /* * ProcVector array defined in tables.c. */ extern int (*ProcVector[256])(ClientPtr); /* * From the fb code. */ extern int fbGCPrivateIndex; #ifdef DPMSExtension /* * Stubs for the DPMS extension. */ void DPMSSet(int level); int DPMSGet(int *level); Bool DPMSSupported(void); #endif /* * Our error logging function. */ void OsVendorVErrorFFunction(const char *f, va_list args); /* * True if this is a fatal error. */ extern int OsVendorVErrorFFatal; /* * Redirect the error output to a different file */ extern void (*OsVendorStartRedirectErrorFProc)(); extern void (*OsVendorEndRedirectErrorFProc)(); extern void SetVendorRelease(int release); void OsVendorStartRedirectErrorFFunction(); void OsVendorEndRedirectErrorFFunction(); /* * Called by InitGlobals() in the new X server tree. */ static void nxagentGrabServerCallback(CallbackListPtr *callbacks, void *data, void *args); #ifdef NXAGENT_CLIPBOARD extern void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data, void *args); #endif extern const char *nxagentProgName; void ddxInitGlobals(void) { /* * Install our error logging function. */ OsVendorVErrorFProc = OsVendorVErrorFFunction; OsVendorStartRedirectErrorFProc = OsVendorStartRedirectErrorFFunction; OsVendorEndRedirectErrorFProc = OsVendorEndRedirectErrorFFunction; } /* * Set if the remote display supports backing store. */ /* FIXME: These, if not removed, should at least be moved to Display.h and Display.c. */ int nxagentBackingStore; int nxagentSaveUnder; /* * This is true at startup and set to the value of * nxagentFullGeneration at the end of InitInput. * * InitOutput * nxagentOpenDisplay (if nxagentDoFullGeneration) * nxagentCloseDisplay (if (nxagentDoFullGeneration && nxagentDisplay)) * nxagentFree* * nxagentListRemoteFonts * AddScreen * nxagentOpenScreen * InitInput */ int nxagentDoFullGeneration = 1; /* * True if agent is running as X2goAgent * False if agent is running as NXAgent */ Bool nxagentX2go; /* * Check if agent is X2goAgent */ void checkX2goAgent(void) { #ifdef TEST fprintf(stderr, "%s: nxagentProgName [%s]\n", __func__, nxagentProgName); #endif if (strcasecmp(nxagentProgName,"x2goagent") == 0) { fprintf(stderr, "\nrunning as X2Go Agent\n"); nxagentX2go = True; } else nxagentX2go = False; } /* * Called at X server's initialization. */ void InitOutput(ScreenInfo *scrInfo, int argc, char *argv[]) { /* * Print our pid and version information. */ if (serverGeneration <= 1) { fprintf(stderr, "\nNXAGENT - Version " NX_VERSION_CURRENT_STRING "\n\n"); fprintf(stderr, "Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com)\n"); fprintf(stderr, "Copyright (c) 2008-2014 Oleksandr Shneyder \n"); fprintf(stderr, "Copyright (c) 2011-2016 Mike Gabriel \n"); fprintf(stderr, "Copyright (c) 2014-2016 Ulrich Sibiller \n"); fprintf(stderr, "Copyright (c) 2014-2016 Mihai Moldovan \n"); fprintf(stderr, "Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com)\n"); fprintf(stderr, "See https://github.com/ArcticaProject/nx-libs for more information.\n\n"); fprintf(stderr, "Info: Agent running with pid '%d'.\n", getpid()); fprintf(stderr, "Session: Starting session at '%s'.\n", GetTimeAsString()); saveAgentState("STARTING"); } /* * Avoid slowness due to buggy_repeat workaround in libcairo * versions >= 1.10. */ SetVendorRelease(70000000); /* * Init the time count for image rate. */ if (nxagentOption(ImageRateLimit) != 0) { fprintf(stderr, "Info: Image rate limit set to %u kB/s.\n", nxagentOption(ImageRateLimit)); } /* * Unset the LD_LIBRARY_PATH variable in Popen() before calling * execl() in the child process. */ NXUnsetLibraryPath(1); if (serverGeneration == 1) { AddCallback(&ServerGrabCallback, nxagentGrabServerCallback, NULL); } if (nxagentUserDefinedFontPath == 0) { #ifdef TEST fprintf(stderr, "InitOutput: Calling nxagentVerifyDefaultFontPath.\n"); #endif nxagentVerifyDefaultFontPath(); } #ifdef TEST else { fprintf(stderr, "InitOutput: User defined font path. Skipping the check on the fonts dir.\n"); } #endif char *authority = getenv("NX_XAUTHORITY"); if (authority) { #ifdef __sun char *environment = malloc(15 + strlen(authority)); sprintf(environment, "XAUTHORITY=%s", authority); if (putenv(environment) < 0) #else if (setenv("XAUTHORITY", authority, True) < 0) #endif { fprintf(stderr, "Warning: Couldn't set the XAUTHORITY environment to [%s]\n", authority); } } nxagentInitBSPixmapList(); /* * Open the display. We are at the early startup and the information * we'll get from the remote X server will mandate some of the * characteristics of the session, like the screen depth. Note that * this reliance on the remote display at session startup should be * removed. We should always operate at 32 bpp, internally, and do * the required translations as soon as the graphic operation needs * to be realized on the remote display. */ nxagentOpenDisplay(argc, argv); /* FIXME: These variables, if not removed at all because have probably become useless, should be moved to Display.h and Display.c. */ nxagentBackingStore = XDoesBackingStore(DefaultScreenOfDisplay(nxagentDisplay)); #ifdef TEST fprintf(stderr, "InitOutput: Remote display backing store support [%d].\n", nxagentBackingStore); #endif nxagentSaveUnder = XDoesSaveUnders(DefaultScreenOfDisplay(nxagentDisplay)); #ifdef TEST fprintf(stderr, "InitOutput: Remote display save under support [%d].\n", nxagentSaveUnder); #endif /* * Initialize the basic screen info. */ nxagentSetScreenInfo(scrInfo); /* * Initialize pixmap formats for this screen. */ nxagentSetPixmapFormats(scrInfo); /* * Get our own privates' index. */ nxagentWindowPrivateIndex = AllocateWindowPrivateIndex(); nxagentGCPrivateIndex = AllocateGCPrivateIndex(); RT_NX_GC = CreateNewResourceType(nxagentDestroyNewGCResourceType); #ifdef HAS_XFONT2 nxagentFontPrivateIndex = xfont2_allocate_font_private_index(); #else nxagentFontPrivateIndex = AllocateFontPrivateIndex(); #endif /* HAS_XFONT2 */ RT_NX_FONT = CreateNewResourceType(nxagentDestroyNewFontResourceType); nxagentClientPrivateIndex = AllocateClientPrivateIndex(); nxagentPixmapPrivateIndex = AllocatePixmapPrivateIndex(); RT_NX_PIXMAP = CreateNewResourceType(nxagentDestroyNewPixmapResourceType); RT_NX_CORR_BACKGROUND = CreateNewResourceType(nxagentDestroyCorruptedBackgroundResource); RT_NX_CORR_WINDOW = CreateNewResourceType(nxagentDestroyCorruptedWindowResource); RT_NX_CORR_PIXMAP = CreateNewResourceType(nxagentDestroyCorruptedPixmapResource); fbGCPrivateIndex = AllocateGCPrivateIndex(); if (nxagentNumScreens == 0) { nxagentNumScreens = 1; } for (int i = 0; i < nxagentNumScreens; i++) { AddScreen(nxagentOpenScreen, argc, argv); } nxagentNumScreens = scrInfo->numScreens; /* * Initialize the GCs used by the synchronization put images. We do * it here because we use the nxagentDefaultScreen. */ nxagentAllocateGraphicContexts(); nxagentDoFullGeneration = nxagentFullGeneration; /* * Use a solid black root window background. */ if (!whiteRoot) blackRoot = TRUE; nxagentInitKeystrokes(False); #ifdef NXAGENT_CLIPBOARD AddCallback(&SelectionCallback, nxagentSetSelectionCallback, NULL); #endif nxagentInitAtoms(); } void nxagentNotifyConnection(int fd, int ready, void *data) { nxagentDispatchEvents(NULL); } void InitInput(int argc, char *argv[]) { void *ptr, *kbd; ptr = AddInputDevice(nxagentPointerProc, True); kbd = AddInputDevice(nxagentKeyboardProc, True); RegisterPointerDevice(ptr); RegisterKeyboardDevice(kbd); mieqInit(kbd, ptr); /* * Add the display descriptor to the set of descriptors awaited by * the dispatcher. */ nxagentAddXConnection(); if (nxagentOption(Shadow)) { RegisterBlockAndWakeupHandlers(nxagentShadowBlockHandler, nxagentShadowWakeupHandler, NULL); } else { RegisterBlockAndWakeupHandlers(nxagentBlockHandler, nxagentWakeupHandler, NULL); } /* * We let the proxy flush the link on our behalf after having opened * the display. We are now entering the dispatcher. From now on * we'll flush the proxy link explicitly. */ #ifdef TEST fprintf(stderr, "InitInput: Setting the NX flush policy to deferred.\n"); #endif NXSetDisplayPolicy(nxagentDisplay, NXPolicyDeferred); } /* * DDX specific abort routine. This is called by AbortServer() that, * in turn, is called by FatalError(). */ void AbortDDX(void) { nxagentDoFullGeneration = True; nxagentCloseDisplay(); /* * Do the required finalization if we are not going through the * normal X server shutdown. */ if ((dispatchException & DE_TERMINATE) == 0) { nxagentAbortDisplay(); } } /* * Called by GiveUp(). */ void ddxGiveUp(void) { AbortDDX(); } void ddxBeforeReset(void) { } void OsVendorInit(void) { return; } void OsVendorFatalError(void) { /* * Let the session terminate gracely from an user's standpoint. */ fprintf(stderr, "Session: Aborting session at '%s'.\n", GetTimeAsString()); fprintf(stderr, "Session: Session aborted at '%s'.\n", GetTimeAsString()); } void OsVendorVErrorFFunction(const char *f, va_list args) { if (OsVendorVErrorFFatal == 0) { char buffer[1024]; vsnprintf(buffer, sizeof(buffer), f, args); nxagentStartRedirectToClientsLog(); fprintf(stderr, "%s", buffer); nxagentEndRedirectToClientsLog(); } else { LogVWrite(-1, f, args); } } void OsVendorStartRedirectErrorFFunction(void) { nxagentStartRedirectToClientsLog(); } void OsVendorEndRedirectErrorFFunction(void) { nxagentEndRedirectToClientsLog(); } ServerGrabInfoRec nxagentGrabServerInfo; static void nxagentGrabServerCallback(CallbackListPtr *callbacks, void *data, void *args) { ServerGrabInfoRec *grab = (ServerGrabInfoRec*)args; nxagentGrabServerInfo.client = grab->client; nxagentGrabServerInfo.grabstate = grab->grabstate; } #ifdef DPMSExtension void DPMSSet(int level) { } int DPMSGet(int *level) { return -1; } Bool DPMSSupported(void) { return 0; } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Init.h0000644000000000000000000000515313614532331017735 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #ifndef __Init_H__ #define __Init_H__ extern int nxagentDoFullGeneration; extern int nxagentBackingStore; extern int nxagentSaveUnder; extern int nxagentX2go; void checkX2goAgent(void); extern ServerGrabInfoRec nxagentGrabServerInfo; void nxagentNotifyConnection(int fd, int ready, void *data); #endif /* __Init_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c0000644000000000000000000012715213614532331020571 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #include #include #include #include #include #include "keysym.h" #include "screenint.h" #include "inputstr.h" #include "misc.h" #include "scrnintstr.h" #include "servermd.h" #include "extnsionst.h" #include "Agent.h" #include "Display.h" #include "Screen.h" #include "Keyboard.h" #include "Events.h" #include "Options.h" #include "Error.h" #include "Init.h" #include "Utils.h" #include "compext/Compext.h" #include #ifdef XKB #include /* we need the client side header here, xkbsrv.h will not work because server and libX11 have different struct sizes on 64bit. Interestingly upstream xnest does not take care of this. */ #include #include #include "Xatom.h" #include static void nxagentXkbGetNames(void); void nxagentKeycodeConversionSetup(void); static void nxagentWriteKeyboardDir(void); static void nxagentWriteKeyboardFile(char *rules, char *model, char *layout, char *variant, char *options); #endif /* XKB */ /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG #undef WATCH #ifdef WATCH #include "unistd.h" #endif /* * Unfortunately we cannot just include XKBlib.h. It conflicts with * the server side definitions of the same symbols. This is more a X * problem than our. */ #ifdef XKB extern Bool XkbQueryExtension( #if NeedFunctionPrototypes Display * /* dpy */, int * /* opcodeReturn */, int * /* eventBaseReturn */, int * /* errorBaseReturn */, int * /* majorRtrn */, int * /* minorRtrn */ #endif ); extern XkbDescPtr XkbGetKeyboard( #if NeedFunctionPrototypes Display * /* dpy */, unsigned int /* which */, unsigned int /* deviceSpec */ #endif ); extern Status XkbGetControls( #if NeedFunctionPrototypes Display * /* dpy */, unsigned long /* which */, XkbDescPtr /* desc */ #endif ); extern int XkbDfltRepeatDelay; extern int XkbDfltRepeatInterval; /* xkb configuration of the real X server */ static char *nxagentRemoteRules = NULL; static char *nxagentRemoteModel = NULL; static char *nxagentRemoteLayout = NULL; static char *nxagentRemoteVariant = NULL; static char *nxagentRemoteOptions = NULL; #endif /* XKB */ /* * Save the values queried from X server. */ XkbAgentInfoRec nxagentXkbInfo = { -1, -1, -1, -1, -1 }; /* * Keyboard status, updated through XKB events. */ XkbAgentStateRec nxagentXkbState = { 0, 0, 0, 0, 0 }; /* * Info for disabling/enabling Xkb extension. */ XkbWrapperRec nxagentXkbWrapper; extern char *nxagentKeyboard; unsigned int nxagentAltMetaMask; unsigned int nxagentAltMask; unsigned int nxagentMetaMask; unsigned int nxagentCapsMask; unsigned int nxagentNumlockMask; static void nxagentCheckModifierMasks(CARD8, int); CARD8 nxagentCapsLockKeycode = 66; CARD8 nxagentNumLockKeycode = 77; static void nxagentCheckRemoteKeycodes(void); static CARD8 nxagentConvertedKeycodes[] = { /* evdev pc105*/ /* 0 */ 0, /* 1 */ 1, /* 2 */ 2, /* 3 */ 3, /* 4 */ 4, /* 5 */ 5, /* 6 */ 6, /* 7 */ 7, /* 8 */ 8, /* 9 */ 9, /* 10 */ 10, /* 11 */ 11, /* 12 */ 12, /* 13 */ 13, /* 14 */ 14, /* 15 */ 15, /* 16 */ 16, /* 17 */ 17, /* 18 */ 18, /* 19 */ 19, /* 20 */ 20, /* 21 */ 21, /* 22 */ 22, /* 23 */ 23, /* 24 */ 24, /* 25 */ 25, /* 26 */ 26, /* 27 */ 27, /* 28 */ 28, /* 29 */ 29, /* 30 */ 30, /* 31 */ 31, /* 32 */ 32, /* 33 */ 33, /* 34 */ 34, /* 35 */ 35, /* 36 */ 36, /* 37 */ 37, /* 38 */ 38, /* 39 */ 39, /* 40 */ 40, /* 41 */ 41, /* 42 */ 42, /* 43 */ 43, /* 44 */ 44, /* 45 */ 45, /* 46 */ 46, /* 47 */ 47, /* 48 */ 48, /* 49 */ 49, /* 50 */ 50, /* 51 */ 51, /* 52 */ 52, /* 53 */ 53, /* 54 */ 54, /* 55 */ 55, /* 56 */ 56, /* 57 */ 57, /* 58 */ 58, /* 59 */ 59, /* 60 */ 60, /* 61 */ 61, /* 62 */ 62, /* 63 */ 63, /* 64 */ 64, /* 65 */ 65, /* 66 */ 66, /* 67 */ 67, /* 68 */ 68, /* 69 */ 69, /* 70 */ 70, /* 71 */ 71, /* 72 */ 72, /* 73 */ 73, /* 74 */ 74, /* 75 */ 75, /* 76 */ 76, /* 77 */ 77, /* 78 */ 78, /* 79 */ 79, /* 80 */ 80, /* 81 */ 81, /* 82 */ 82, /* 83 */ 83, /* 84 */ 84, /* 85 */ 85, /* 86 */ 86, /* 87 */ 87, /* 88 */ 88, /* 89 */ 89, /* 90 */ 90, /* 91 */ 91, /* 92 */ 124, /* 93 */ 93, /* 94 */ 94, /* 95 */ 95, /* 96 */ 96, /* 97 */ 211, /* 98 */ 98, /* 99 */ 99, /* 100 */ 100, /* 101 */ 208, /* 102 */ 102, /* 103 */ 103, /* 104 */ 108, /* 105 */ 109, /* 106 */ 112, /* 107 */ 111, /* 108 */ 113, /* 109 */ 109, /* 110 */ 97, /* 111 */ 98, /* 112 */ 99, /* 113 */ 100, /* 114 */ 102, /* 115 */ 103, /* 116 */ 104, /* 117 */ 105, /* 118 */ 106, /* 119 */ 107, /* 120 */ 120, /* 121 */ 121, /* 122 */ 122, /* 123 */ 123, /* 124 */ 124, /* 125 */ 126, /* 126 */ 126, /* 127 */ 110, /* 128 */ 128, /* 129 */ 129, /* 130 */ 130, /* 131 */ 131, /* 132 */ 133, /* 133 */ 115, /* 134 */ 116, /* 135 */ 117, /* 136 */ 136, /* 137 */ 137, /* 138 */ 138, /* 139 */ 139, /* 140 */ 140, /* 141 */ 141, /* 142 */ 142, /* 143 */ 143, /* 144 */ 144, /* 145 */ 145, /* 146 */ 146, /* 147 */ 147, /* 148 */ 148, /* 149 */ 149, /* 150 */ 150, /* 151 */ 151, /* 152 */ 152, /* 153 */ 153, /* 154 */ 154, /* 155 */ 155, /* 156 */ 156, /* 157 */ 157, /* 158 */ 158, /* 159 */ 159, /* 160 */ 160, /* 161 */ 161, /* 162 */ 162, /* 163 */ 163, /* 164 */ 164, /* 165 */ 165, /* 166 */ 166, /* 167 */ 167, /* 168 */ 168, /* 169 */ 169, /* 170 */ 170, /* 171 */ 171, /* 172 */ 172, /* 173 */ 173, /* 174 */ 174, /* 175 */ 175, /* 176 */ 176, /* 177 */ 177, /* 178 */ 178, /* 179 */ 179, /* 180 */ 180, /* 181 */ 181, /* 182 */ 182, /* 183 */ 183, /* 184 */ 184, /* 185 */ 185, /* 186 */ 186, /* 187 */ 187, /* 188 */ 188, /* 189 */ 189, /* 190 */ 190, /* 191 */ 118, /* 192 */ 119, /* 193 */ 120, /* 194 */ 121, /* 195 */ 122, /* 196 */ 196, /* 197 */ 197, /* 198 */ 198, /* 199 */ 199, /* 200 */ 200, /* 201 */ 201, /* 202 */ 202, /* 203 */ 93, /* 204 */ 125, /* 205 */ 156, /* 206 */ 127, /* 207 */ 128, /* 208 */ 208, /* 209 */ 209, /* 210 */ 210, /* 211 */ 211, /* 212 */ 212, /* 213 */ 213, /* 214 */ 214, /* 215 */ 215, /* 216 */ 216, /* 217 */ 217, /* 218 */ 218, /* 219 */ 219, /* 220 */ 220, /* 221 */ 221, /* 222 */ 222, /* 223 */ 223, /* 224 */ 224, /* 225 */ 225, /* 226 */ 226, /* 227 */ 227, /* 228 */ 228, /* 229 */ 229, /* 230 */ 230, /* 231 */ 231, /* 232 */ 232, /* 233 */ 233, /* 234 */ 234, /* 235 */ 235, /* 236 */ 236, /* 237 */ 237, /* 238 */ 238, /* 239 */ 239, /* 240 */ 240, /* 241 */ 241, /* 242 */ 242, /* 243 */ 243, /* 244 */ 244, /* 245 */ 245, /* 246 */ 246, /* 247 */ 247, /* 248 */ 248, /* 249 */ 249, /* 250 */ 250, /* 251 */ 251, /* 252 */ 252, /* 253 */ 253, /* 254 */ 254, /* 255 */ 255 }; static Bool nxagentKeycodeConversion = False; CARD8 nxagentConvertKeycode(CARD8 k) { if (nxagentKeycodeConversion) { #ifdef DEBUG if (k != nxagentConvertedKeycodes[k]) fprintf(stderr, "%s: converting keycode [%d] to [%d]\n", __func__, k, nxagentConvertedKeycodes[k]); #endif return nxagentConvertedKeycodes[k]; } else { return k; } } static int nxagentSaveKeyboardDeviceData(DeviceIntPtr dev, DeviceIntPtr devBackup); static int nxagentRestoreKeyboardDeviceData(DeviceIntPtr devBackup, DeviceIntPtr dev); static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev); void nxagentBell(int volume, DeviceIntPtr pDev, void * ctrl, int cls) { XBell(nxagentDisplay, volume); } void nxagentChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl) { #ifdef XKB if (!noXkbExtension) { XkbSrvInfoPtr xkbi = pDev -> key -> xkbInfo; XkbControlsPtr xkbc = xkbi -> desc -> ctrls; /* * We want to prevent agent generating auto-repeated * keystrokes. Let's intercept any attempt by appli- cations to * change the default timeouts on the nxagent device. */ #ifdef TEST fprintf(stderr, "%s: Repeat delay was [%d] interval was [%d].\n", __func__, xkbc -> repeat_delay, xkbc -> repeat_interval); #endif xkbc -> repeat_delay = ~ 0; xkbc -> repeat_interval = ~ 0; #ifdef TEST fprintf(stderr, "%s: Repeat delay is now [%d] interval is now [%d].\n", __func__, xkbc -> repeat_delay, xkbc -> repeat_interval); #endif } #endif /* * If enabled, propagate the changes to the devices attached to the * real X server. */ if (nxagentOption(DeviceControl)) { #ifdef TEST fprintf(stderr, "%s: WARNING! Propagating changes to keyboard settings.\n", __func__); #endif unsigned long value_mask = KBKeyClickPercent | KBBellPercent | KBBellPitch | KBBellDuration; XKeyboardControl values = { .key_click_percent = ctrl->click, .bell_percent = ctrl->bell, .bell_pitch = ctrl->bell_pitch, .bell_duration = ctrl->bell_duration, }; /* * Don't propagate the auto repeat mode. It is forced to be off in * the agent server. * * value_mask |= KBAutoRepeatMode; * values.auto_repeat_mode = ctrl->autoRepeat ? * AutoRepeatModeOn : AutoRepeatModeOff; */ XChangeKeyboardControl(nxagentDisplay, value_mask, &values); /* * At this point, we need to walk through the vector and compare * it to the current server vector. If there are differences, * report them. */ value_mask = KBLed | KBLedMode; for (int i = 1; i <= XkbNumIndicators; i++) { unsigned int mask = (unsigned int)1 << (i - 1); values.led = i; values.led_mode = (ctrl->leds & mask) ? LedModeOn : LedModeOff; XChangeKeyboardControl(nxagentDisplay, value_mask, &values); } return; } #ifdef TEST fprintf(stderr, "%s: WARNING! Not propagating changes to keyboard settings.\n", __func__); #endif } int nxagentKeyboardProc(DeviceIntPtr pDev, int onoff) { KeySym *keymap; int mapWidth; int min_keycode, max_keycode; CARD8 modmap[MAP_LENGTH]; XKeyboardState values; #ifdef XKB char *model = NULL, *layout = NULL; XkbDescPtr xkb = NULL; #endif switch (onoff) { case DEVICE_INIT: #ifdef TEST fprintf(stderr, "%s: Called for [DEVICE_INIT].\n", __func__); #endif if (NXDisplayError(nxagentDisplay) == 1) { return Success; } #ifdef WATCH fprintf(stderr, "%s: Watchpoint 9.\n", __func__); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio ------- ----- ------ ------- -------- ---------- ----- N/A */ sleep(30); #endif /* * Prevent agent from generating auto-repeat keystroke. Note * that this is working only if XKB is enabled. A better * solution should account cases where XKB is not * available. Check also the behaviour of the DeviceControl * nxagent option. */ XkbDfltRepeatDelay = ~ 0; XkbDfltRepeatInterval = ~ 0; #ifdef TEST fprintf(stderr, "%s: Set repeat delay to [%d] interval to [%d].\n", __func__, XkbDfltRepeatDelay, XkbDfltRepeatInterval); #endif XModifierKeymap *modifier_keymap = XGetModifierMapping(nxagentDisplay); if (modifier_keymap == NULL) { return -1; } XDisplayKeycodes(nxagentDisplay, &min_keycode, &max_keycode); #ifdef _XSERVER64 { KeySym64 *keymap64 = XGetKeyboardMapping(nxagentDisplay, min_keycode, max_keycode - min_keycode + 1, &mapWidth); if (keymap64 == NULL) { XFreeModifiermap(modifier_keymap); return -1; } int len = (max_keycode - min_keycode + 1) * mapWidth; keymap = (KeySym *)malloc(len * sizeof(KeySym)); for(int i = 0; i < len; ++i) { keymap[i] = keymap64[i]; } SAFE_XFree(keymap64); } #else /* #ifdef _XSERVER64 */ keymap = XGetKeyboardMapping(nxagentDisplay, min_keycode, max_keycode - min_keycode + 1, &mapWidth); if (keymap == NULL) { XFreeModifiermap(modifier_keymap); return -1; } #endif /* #ifdef _XSERVER64 */ nxagentAltMetaMask = 0; nxagentAltMask = 0; nxagentMetaMask = 0; nxagentCapsMask = 0; nxagentNumlockMask = 0; memset(modmap, 0, sizeof(modmap)); for (int j = 0; j < 8; j++) { for(int i = 0; i < modifier_keymap->max_keypermod; i++) { CARD8 keycode; if ((keycode = modifier_keymap-> modifiermap[j * modifier_keymap->max_keypermod + i])) { modmap[keycode] |= 1< 0) { nxagentCheckModifierMasks(keycode, j); } } } XFreeModifiermap(modifier_keymap); modifier_keymap = NULL; nxagentCheckRemoteKeycodes(); KeySymsRec keySyms = { .minKeyCode = min_keycode, .maxKeyCode = max_keycode, .mapWidth = mapWidth, .map = keymap, }; #ifdef XKB if (!nxagentGetRemoteXkbExtension()) { ErrorF("Unable to query XKEYBOARD extension.\n"); goto XkbError; } if (noXkbExtension) { #ifdef TEST fprintf(stderr, "%s: No XKB extension.\n", __func__); #endif XkbError: #ifdef TEST fprintf(stderr, "%s: XKB error.\n", __func__); #endif #endif XGetKeyboardControl(nxagentDisplay, &values); memmove((char *) defaultKeyboardControl.autoRepeats, (char *) values.auto_repeats, sizeof(values.auto_repeats)); #ifdef TEST { int ret = #endif InitKeyboardDeviceStruct((DevicePtr) pDev, &keySyms, modmap, nxagentBell, nxagentChangeKeyboardControl); #ifdef TEST fprintf(stderr, "%s: InitKeyboardDeviceStruct returns [%d].\n", __func__, ret); } #endif #ifdef XKB } else { /* if (noXkbExtension) */ XkbComponentNamesRec names = {0}; char *rules = NULL, *variant = NULL, *options = NULL; /* use xkb default */ /* handle empty string like the NULL pointer */ if (nxagentKeyboard && nxagentKeyboard[0] == '\0') { SAFE_free(nxagentKeyboard); } #ifdef TEST fprintf(stderr, "%s: Using XKB extension.\n", __func__); fprintf(stderr, "%s: nxagentKeyboard is [%s].\n", __func__, validateString(nxagentKeyboard)); #endif /* from nxagent changelog: 2.0.22: - Implemented handling of value "query" for nxagentKbtype. This value is passed by the NX client for MacOSX. If value of nxagentKbtype is "query" or NULL we init keyboard by core protocol functions reading the keyboard mapping of the X server. The property _XKB_RULES_NAMES is always set on the root window with default values of model and layout. */ if (nxagentKeyboard && (strcmp(nxagentKeyboard, "query") != 0) && (strcmp(nxagentKeyboard, "clone") != 0)) { int i; for (i = 0; nxagentKeyboard[i] != '/' && nxagentKeyboard[i] != '\0'; i++); if (nxagentKeyboard[i] == '\0' || nxagentKeyboard[i + 1] == '\0' || i == 0) { ErrorF("Warning: Wrong keyboard type: '%s'.\n", nxagentKeyboard); goto XkbError; } /* The original nxagent only supports model/layout values here. It uses these values together with the default rules and empty variant and options. We use a more or less compatible hack here: The special keyword rlmvo for model means that the layout part of the string will contain a full RMLVO config, separated by #, e.g. rlmvo/base#pc105#de,us#nodeadkeys#lv3:rwin_switch */ if (strncmp(nxagentKeyboard, "rlmvo/", 6) == 0) { const char * sep = "#"; char * rmlvo = strdup(&nxagentKeyboard[i+1]); char * tmp = rmlvo; /* strtok cannot handle empty fields, so use strsep */ rules = strdup(strsep(&tmp, sep)); model = strdup(strsep(&tmp, sep)); layout = strdup(strsep(&tmp, sep)); variant = strdup(strsep(&tmp, sep)); options = strdup(strsep(&tmp, sep)); SAFE_free(rmlvo); } else { model = strndup(nxagentKeyboard, i); layout = strdup(&nxagentKeyboard[i + 1]); } /* * There is no description for pc105 on Solaris. Need to * revert to the closest approximation. */ #ifdef TEST fprintf(stderr, "%s: Using [rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", __func__, rules, model, layout, variant, options); #endif #ifdef __sun if (strcmp(model, "pc105") == 0) { #ifdef TEST fprintf(stderr, "%s: WARNING! Keyboard model 'pc105' unsupported on Solaris.\n", __func__); fprintf(stderr, "%s: WARNING! Forcing keyboard model to 'pc104'.\n", __func__); #endif strcpy(model, "pc104"); } #endif } else { #ifdef TEST fprintf(stderr, "%s: Using default keyboard: model [%s] layout [%s].\n", __func__, model?model:"(default)", layout?layout:"(default)"); #endif } #ifdef TEST fprintf(stderr, "%s: Init XKB extension.\n", __func__); #endif if (nxagentRemoteRules && nxagentRemoteModel) { #ifdef DEBUG fprintf(stderr, "%s: Remote: [rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", __func__, nxagentRemoteRules, nxagentRemoteModel, nxagentRemoteLayout, nxagentRemoteVariant, nxagentRemoteOptions); #endif if (nxagentKeyboard && (strcmp(nxagentKeyboard, "clone") == 0)) { SAFE_free(rules); rules = strdup(nxagentRemoteRules); SAFE_free(model); model = strdup(nxagentRemoteModel); SAFE_free(layout); layout = strdup(nxagentRemoteLayout); SAFE_free(variant); variant = strdup(nxagentRemoteVariant); SAFE_free(options); options = strdup(nxagentRemoteOptions); /* Only setup keycode conversion if we are NOT in clone mode */ #ifdef DEBUG fprintf(stderr, "%s: nxagentKeyboard is [%s] - disabling keycode conversion.\n", __func__, nxagentKeyboard); #endif nxagentChangeOption(KeycodeConversion, KeycodeConversionOff); /* * when cloning we do not want X2Go to set the keyboard * via a keyboard file generated by nxagent. The defined * method for switching that off is the creation of a dir * instead of a file. */ if (nxagentX2go) { nxagentWriteKeyboardDir(); } } else { /* * Keyboard has always been tricky with nxagent. For that * reason X2Go offers "auto" keyboard configuration. You can * specify it in the client side session configuration. In * "auto" mode x2goserver expects nxagent to write the * remote keyboard config to a file on startup and * x2goserver would then pick that file and pass it to * setxkbmap. This functionality is obsoleted by the "clone" * stuff but we still need it because x2goserver does not * know about that yet. Once x2go starts using clone * we can drop this here. */ if (nxagentX2go) { nxagentWriteKeyboardFile(nxagentRemoteRules, nxagentRemoteModel, nxagentRemoteLayout, nxagentRemoteVariant, nxagentRemoteOptions); } } nxagentKeycodeConversionSetup(); } #ifdef DEBUG else { fprintf(stderr, "%s: Failed to retrieve remote rules.\n", __func__); } #endif xkb = XkbGetKeyboard(nxagentDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd); if (xkb && xkb->geom) { XkbGetControls(nxagentDisplay, XkbAllControlsMask, xkb); } #ifdef TEST else { fprintf(stderr, "%s: No current keyboard.\n", __func__); } #endif #ifdef DEBUG fprintf(stderr, "%s: Going to set rules and init device: " "[rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", __func__, rules?rules:"(default)", model?model:"(default)", layout?layout:"(default)", variant?variant:"(default)", options?options:"(default)"); #endif XkbSetRulesDflts(rules, model, layout, variant, options); XkbInitKeyboardDeviceStruct((void *)pDev, &names, &keySyms, modmap, nxagentBell, nxagentChangeKeyboardControl); if (nxagentKeyboard && strcmp(nxagentKeyboard, "query") == 0) { goto XkbError; } if (xkb && xkb->geom) { XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls); } if (nxagentOption(Shadow) == 1 && pDev && pDev->key) { NXShadowInitKeymap(&(pDev->key->curKeySyms)); } SAFE_free(rules); SAFE_free(variant); SAFE_free(options); } if (xkb) { XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); xkb = NULL; } SAFE_free(model); SAFE_free(layout); #endif #ifdef WATCH fprintf(stderr, "%s: Watchpoint 10.\n", __func__); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio ------- ----- ------ ------- -------- ---------- ----- #1 U 3 2 80320 bits (10 KB) -> 28621 bits (3 KB) -> 26773/1 -> 9540/1 = 2.806:1 #98 1 256 bits (0 KB) -> 27 bits (0 KB) -> 256/1 -> 27/1 = 9.481:1 #101 1 32000 bits (4 KB) -> 2940 bits (0 KB) -> 32000/1 -> 2940/1 = 10.884:1 #119 1 384 bits (0 KB) -> 126 bits (0 KB) -> 384/1 -> 126/1 = 3.048:1 */ sleep(30); #endif #ifdef _XSERVER64 SAFE_free(keymap); #else SAFE_XFree(keymap); #endif break; case DEVICE_ON: #ifdef TEST fprintf(stderr, "%s: Called for [DEVICE_ON].\n", __func__); #endif if (NXDisplayError(nxagentDisplay) == 1) { return Success; } #ifdef WATCH fprintf(stderr, "%s: Watchpoint 11.\n", __func__); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio ------- ----- ------ ------- -------- ---------- ----- #117 1 320 bits (0 KB) -> 52 bits (0 KB) -> 320/1 -> 52/1 = 6.154:1 */ sleep(30); #endif nxagentEnableKeyboardEvents(); break; case DEVICE_OFF: #ifdef TEST fprintf(stderr, "%s: Called for [DEVICE_OFF].\n", __func__); #endif if (NXDisplayError(nxagentDisplay) == 1) { return Success; } nxagentDisableKeyboardEvents(); break; case DEVICE_CLOSE: #ifdef TEST fprintf(stderr, "%s: Called for [DEVICE_CLOSE].\n", __func__); #endif break; } return Success; } Bool LegalModifier(key, pDev) unsigned int key; DevicePtr pDev; { return TRUE; } void nxagentNotifyKeyboardChanges(int oldMinKeycode, int oldMaxKeycode) { #ifdef XKB if (!noXkbExtension) { DeviceIntPtr dev; xkbNewKeyboardNotify nkn = {0}; dev = inputInfo.keyboard; nkn.deviceID = nkn.oldDeviceID = dev -> id; nkn.minKeyCode = 8; nkn.maxKeyCode = 255; nkn.oldMinKeyCode = oldMinKeycode; nkn.oldMaxKeyCode = oldMaxKeycode; nkn.requestMajor = XkbReqCode; nkn.requestMinor = X_kbGetKbdByName; nkn.changed = XkbNKN_KeycodesMask; XkbSendNewKeyboardNotify(dev, &nkn); } else { #endif xEvent event = {0}; event.u.u.type = MappingNotify; event.u.mappingNotify.request = MappingKeyboard; event.u.mappingNotify.firstKeyCode = inputInfo.keyboard -> key -> curKeySyms.minKeyCode; event.u.mappingNotify.count = inputInfo.keyboard -> key -> curKeySyms.maxKeyCode - inputInfo.keyboard -> key -> curKeySyms.minKeyCode; /* * 0 is the server client */ for (int i = 1; i < currentMaxClients; i++) { if (clients[i] && clients[i] -> clientState == ClientStateRunning) { event.u.u.sequenceNumber = clients[i] -> sequence; WriteEventsToClient(clients[i], 1, &event); } } #ifdef XKB } #endif } int nxagentResetKeyboard(void) { DeviceIntPtr dev = inputInfo.keyboard; DeviceIntPtr devBackup; int oldMinKeycode = 8; int oldMaxKeycode = 255; if (NXDisplayError(nxagentDisplay) == 1) { return 0; } /* * Save bell settings. */ int savedBellPercent = inputInfo.keyboard -> kbdfeed -> ctrl.bell; int savedBellPitch = inputInfo.keyboard -> kbdfeed -> ctrl.bell_pitch; int savedBellDuration = inputInfo.keyboard -> kbdfeed -> ctrl.bell_duration; #ifdef TEST fprintf(stderr, "%s: bellPercent [%d] bellPitch [%d] bellDuration [%d].\n", __func__, savedBellPercent, savedBellPitch, savedBellDuration); #endif if (!(devBackup = calloc(1, sizeof(DeviceIntRec)))) { #ifdef PANIC fprintf(stderr, "%s: PANIC! Can't allocate backup structure.\n", __func__); #endif } nxagentSaveKeyboardDeviceData(dev, devBackup); if (dev->key) { #ifdef XKB if (noXkbExtension == 0 && dev->key->xkbInfo) { oldMinKeycode = dev->key->xkbInfo -> desc -> min_key_code; oldMaxKeycode = dev->key->xkbInfo -> desc -> max_key_code; } #endif dev->key = NULL; } dev->focus = NULL; dev->kbdfeed = NULL; #ifdef XKB nxagentTuneXkbWrapper(); #endif int result = (*inputInfo.keyboard -> deviceProc)(inputInfo.keyboard, DEVICE_INIT); if (result == Success && inputInfo.keyboard -> key != NULL) { /* * Restore bell settings. */ inputInfo.keyboard -> kbdfeed -> ctrl.bell = savedBellPercent; inputInfo.keyboard -> kbdfeed -> ctrl.bell_pitch = savedBellPitch; inputInfo.keyboard -> kbdfeed -> ctrl.bell_duration = savedBellDuration; nxagentNotifyKeyboardChanges(oldMinKeycode, oldMaxKeycode); nxagentFreeKeyboardDeviceData(devBackup); SAFE_free(devBackup); return 1; } else { #ifdef WARNING fprintf(stderr, "%s: Can't initialize the keyboard device.\n", __func__); #endif nxagentRestoreKeyboardDeviceData(devBackup, dev); return 0; } } void nxagentCheckModifierMasks(CARD8 keycode, int j) { if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Meta_L)) { nxagentAltMetaMask |= 1 << j; nxagentMetaMask |= 1 << j; } if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Meta_R)) { nxagentAltMetaMask |= 1 << j; nxagentMetaMask |= 1 << j; } if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Alt_L)) { nxagentAltMetaMask |= 1 << j; nxagentAltMask |= 1 << j; } if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Alt_R)) { nxagentAltMetaMask |= 1 << j; nxagentAltMask |= 1 << j; } if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Num_Lock)) { nxagentNumlockMask |= 1 << j; } if (keycode == XKeysymToKeycode(nxagentDisplay, XK_Caps_Lock) || keycode == XKeysymToKeycode(nxagentDisplay, XK_Shift_Lock) ) { nxagentCapsMask |= 1 << j; } } void nxagentCheckRemoteKeycodes(void) { nxagentCapsLockKeycode = XKeysymToKeycode(nxagentDisplay, XK_Caps_Lock); nxagentNumLockKeycode = XKeysymToKeycode(nxagentDisplay, XK_Num_Lock); #ifdef DEBUG fprintf(stderr, "%s: Remote keycodes: CapsLock [%d] NumLock [%d].\n", __func__, nxagentCapsLockKeycode,nxagentNumLockKeycode); #endif } static int nxagentSaveKeyboardDeviceData(DeviceIntPtr dev, DeviceIntPtr devBackup) { if (!devBackup) { #ifdef PANIC fprintf(stderr, "%s: PANIC! Pointer to backup structure is null.\n", __func__); #endif return -1; } devBackup -> key = dev -> key; devBackup -> focus = dev -> focus; devBackup -> kbdfeed = dev -> kbdfeed; #ifdef DEBUG fprintf(stderr, "%s: Saved device data.\n", __func__); #endif return 1; } static int nxagentRestoreKeyboardDeviceData(DeviceIntPtr devBackup, DeviceIntPtr dev) { if (!devBackup) { #ifdef PANIC fprintf(stderr, "%s: PANIC! Pointer to backup structure is null.\n", __func__); #endif return -1; } dev -> key = devBackup -> key; dev -> focus = devBackup -> focus; dev -> kbdfeed = devBackup -> kbdfeed; #ifdef DEBUG fprintf(stderr, "%s: Restored device data.\n", __func__); #endif return 1; } static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev) { if (!dev) { #ifdef PANIC fprintf(stderr, "%s: PANIC! Pointer to device structure is null.\n", __func__); #endif return -1; } if (dev->key) { #ifdef XKB if (noXkbExtension == 0 && dev->key->xkbInfo) { XkbFreeInfo(dev->key->xkbInfo); dev->key->xkbInfo = NULL; } #endif SAFE_free(dev->key->curKeySyms.map); SAFE_free(dev->key->modifierKeyMap); SAFE_free(dev->key); } if (dev->focus) { SAFE_free(dev->focus->trace); SAFE_free(dev->focus); } if (dev->kbdfeed) { for (KbdFeedbackPtr k = dev->kbdfeed, knext; k; k = knext) { knext = k->next; #ifdef XKB if (k->xkb_sli) XkbFreeSrvLedInfo(k->xkb_sli); #endif SAFE_free(k); } dev->kbdfeed = NULL; } #ifdef DEBUG fprintf(stderr, "%s: Freed device data.\n", __func__); #endif return 1; } #if XKB int ProcXkbInhibited(register ClientPtr client) { #ifdef TEST fprintf(stderr, "%s: Called.\n", __func__); #endif unsigned char majorop = ((xReq *)client->requestBuffer)->reqType; #ifdef PANIC if (majorop != (unsigned char)nxagentXkbWrapper.base) { fprintf(stderr, "%s: MAJOROP is [%d] but should be [%d].\n", __func__, majorop, nxagentXkbWrapper.base); } #endif unsigned char minorop = *((unsigned char *) client->requestBuffer + 1); #ifdef TEST fprintf(stderr, "%s: MAJOROP is [%d] MINOROP is [%d].\n", __func__, majorop, minorop); #endif switch (minorop) { case X_kbLatchLockState: case X_kbSetControls: case X_kbSetCompatMap: case X_kbSetIndicatorMap: case X_kbSetNamedIndicator: case X_kbSetNames: case X_kbSetGeometry: case X_kbSetDebuggingFlags: case X_kbSetMap: { return client->noClientException; } case X_kbGetKbdByName: { return BadAccess; } case X_kbBell: case X_kbGetCompatMap: case X_kbGetControls: case X_kbGetDeviceInfo: case X_kbGetGeometry: case X_kbGetIndicatorMap: case X_kbGetIndicatorState: case X_kbGetMap: case X_kbGetNamedIndicator: case X_kbGetNames: case X_kbGetState: case X_kbListComponents: case X_kbPerClientFlags: case X_kbSelectEvents: case X_kbSetDeviceInfo: case X_kbUseExtension: { return (client->swapped ? nxagentXkbWrapper.SProcXkbDispatchBackup(client) : nxagentXkbWrapper.ProcXkbDispatchBackup(client)); } default: { /* Just make sure that it works in case xkb gets extended in future */ return BadImplementation; } } } void nxagentInitXkbWrapper(void) { ExtensionEntry * extension; #ifdef TEST fprintf(stderr, "%s: Called.\n", __func__); #endif if (!nxagentOption(InhibitXkb)) { #ifdef TEST fprintf(stderr, "%s: Nothing to do.\n", __func__); #endif return; } memset(&nxagentXkbWrapper, 0, sizeof(XkbWrapperRec)); if ((extension = CheckExtension("XKEYBOARD"))) { nxagentXkbWrapper.base = extension -> base; nxagentXkbWrapper.eventBase = extension -> eventBase; nxagentXkbWrapper.errorBase = extension -> errorBase; nxagentXkbWrapper.ProcXkbDispatchBackup = NULL; nxagentXkbWrapper.SProcXkbDispatchBackup = NULL; #ifdef TEST fprintf(stderr, "%s: base [%d] eventBase [%d] errorBase [%d].\n", __func__, extension -> base, extension -> eventBase, extension -> errorBase); #endif } else { nxagentXkbWrapper.base = -1; #ifdef TEST fprintf(stderr, "%s: XKEYBOARD extension not found.\n", __func__); #endif } } void nxagentDisableXkbExtension(void) { #ifdef TEST fprintf(stderr, "%s: Called.\n", __func__); #endif if (nxagentXkbWrapper.base > 0) { if (!nxagentXkbWrapper.ProcXkbDispatchBackup) { nxagentXkbWrapper.ProcXkbDispatchBackup = ProcVector[nxagentXkbWrapper.base]; ProcVector[nxagentXkbWrapper.base] = ProcXkbInhibited; } #ifdef TEST else { fprintf(stderr, "%s: Nothing to be done for ProcXkbDispatch.\n", __func__); } #endif if (!nxagentXkbWrapper.SProcXkbDispatchBackup) { nxagentXkbWrapper.SProcXkbDispatchBackup = SwappedProcVector[nxagentXkbWrapper.base]; SwappedProcVector[nxagentXkbWrapper.base] = ProcXkbInhibited; } #ifdef TEST else { fprintf(stderr, "%s: Nothing to be done for SProcXkbDispatch.\n", __func__); } #endif } } void nxagentEnableXkbExtension(void) { #ifdef TEST fprintf(stderr, "%s: Called.\n", __func__); #endif if (nxagentXkbWrapper.base > 0) { if (nxagentXkbWrapper.ProcXkbDispatchBackup) { ProcVector[nxagentXkbWrapper.base] = nxagentXkbWrapper.ProcXkbDispatchBackup; nxagentXkbWrapper.ProcXkbDispatchBackup = NULL; } #ifdef TEST else { fprintf(stderr, "%s: Nothing to be done for ProcXkbDispatch.\n", __func__); } #endif if (nxagentXkbWrapper.SProcXkbDispatchBackup) { SwappedProcVector[nxagentXkbWrapper.base] = nxagentXkbWrapper.SProcXkbDispatchBackup; nxagentXkbWrapper.SProcXkbDispatchBackup = NULL; } #ifdef TEST else { fprintf(stderr, "%s: Nothing to be done for SProcXkbDispatch.\n", __func__); } #endif } } /* from nxagent-3.0.0-88 changelog: - Fixed TR10D01539. Some XKEYBOARD requests are disabled if the option 'keyboard' has value 'query'. This locks the initial keyboard map. Enabling/disabling of XKEYBOARD requests is done at run time. - Added -noxkblock command line option enabling the XKEYBOARD requests even if the option 'keyboard' value is 'query'. */ void nxagentTuneXkbWrapper(void) { if (!nxagentOption(InhibitXkb)) { #ifdef TEST fprintf(stderr, "%s: Nothing to do.\n", __func__); #endif return; } if (nxagentKeyboard && strcmp(nxagentKeyboard, "query") == 0) { nxagentDisableXkbExtension(); } else { nxagentEnableXkbExtension(); } } void nxagentXkbClearNames(void) { SAFE_free(nxagentRemoteRules); SAFE_free(nxagentRemoteModel); SAFE_free(nxagentRemoteLayout); SAFE_free(nxagentRemoteVariant); SAFE_free(nxagentRemoteOptions); } static void nxagentXkbGetNames(void) { if (nxagentRemoteRules) return; XlibAtom rulesprop = XInternAtom(nxagentDisplay, "_XKB_RULES_NAMES", 1); if (rulesprop == 0) { return; } XlibAtom type; int format; unsigned long n; unsigned long after; char *data = NULL; Status result = XGetWindowProperty(nxagentDisplay, DefaultRootWindow(nxagentDisplay), rulesprop, 0, 256, 0, XA_STRING, &type, &format, &n, &after, (unsigned char **)&data); if (result != Success || !data) { return; } if ((after > 0) || (type != XA_STRING) || (format != 8)) { if (data) { SAFE_XFree(data); return; } } char *name = data; if (name < data + n) { nxagentRemoteRules = strdup(name); name += strlen(name) + 1; } if (name < data + n) { nxagentRemoteModel = strdup(name); name += strlen(name) + 1; } if (name < data + n) { nxagentRemoteLayout = strdup(name); name += strlen(name) + 1; } if (name < data + n) { nxagentRemoteVariant = strdup(name); name += strlen(name) + 1; } if (name < data + n) { nxagentRemoteOptions = strdup(name); name += strlen(name) + 1; } SAFE_XFree(data); return; } static void writeKeyboardfileData(FILE *out, char *rules, char *model, char *layout, char *variant, char *options) { /* How to set "empty" values with setxkbmap, result of trial and error: - model and layout: empty strings are accepted by setxkbmap. - rules: setxkbmap will fail if rules is an empty string (code will intercept in an earlier stage in that case) - variant: the variant line must be omitted completely. - options: prepend value with "," to override, otherwise options will be added. */ fprintf(out, "rules=\"%s\"\n", rules); fprintf(out, "model=\"%s\"\n", model ? model : ""); fprintf(out, "layout=\"%s\"\n", layout ? layout : ""); if (variant && variant[0] != '\0') fprintf(out, "variant=\"%s\"\n", variant); fprintf(out, "options=\",%s\"\n", options ? options : ""); } static char* getKeyboardFilePath(void) { char *keyboard_file_path = NULL; char *sessionpath = nxagentGetSessionPath(); if (sessionpath) { if ((asprintf(&keyboard_file_path, "%s/keyboard", sessionpath) == -1)) { FatalError("malloc for keyboard file path failed."); } } else { fprintf(stderr, "Warning: Failed to determine keyboard file path: SessionPath not defined\n"); } return keyboard_file_path; } static void nxagentWriteKeyboardDir(void) { char *keyboard_file_path = getKeyboardFilePath(); if (keyboard_file_path) { /* * special case: if rules is NULL create a directory instead of * a file. This is the defined method to disable x2gosetkeyboard. */ if (mkdir(keyboard_file_path, 0555) < 0) { int save_err = errno; fprintf(stderr, "Warning: Failed to create keyboard blocking directory '%s': %s\n", keyboard_file_path, strerror(save_err)); } else { fprintf(stderr, "Info: keyboard blocking directory created: '%s'\n", keyboard_file_path); } SAFE_free(keyboard_file_path); } } static void nxagentWriteKeyboardFile(char *rules, char *model, char *layout, char *variant, char *options) { if (rules && rules[0] != '\0') { #ifdef DEBUG writeKeyboardfileData(stderr, rules, model, layout, variant, options); #endif char *keyboard_file_path = getKeyboardFilePath(); if (keyboard_file_path) { FILE *keyboard_file; if ((keyboard_file = fopen(keyboard_file_path, "w"))) { writeKeyboardfileData(keyboard_file, rules, model, layout, variant, options); fclose(keyboard_file); fprintf(stderr, "Info: keyboard file created: '%s'\n", keyboard_file_path); } else { int save_err = errno; fprintf(stderr, "Error: keyboard file not created: %s\n", strerror(save_err)); } SAFE_free(keyboard_file_path); } } } void nxagentKeycodeConversionSetup(void) { nxagentKeycodeConversion = False; if (nxagentXkbInfo.Opcode == -1) return; if (nxagentOption(KeycodeConversion) == KeycodeConversionOff) { fprintf(stderr, "Info: Keycode conversion is off\n"); } else if (nxagentOption(KeycodeConversion) == KeycodeConversionOn) { fprintf(stderr, "Info: Keycode conversion is on\n"); nxagentKeycodeConversion = True; } else { if (nxagentRemoteRules && nxagentRemoteModel && (strcmp(nxagentRemoteRules, "evdev") == 0 || strcmp(nxagentRemoteModel, "evdev") == 0)) { #ifdef DEBUG fprintf(stderr, "%s: Activating KeyCode conversion.\n", __func__); #endif fprintf(stderr, "Info: Keycode conversion auto-determined as on\n"); nxagentKeycodeConversion = True; } else { #ifdef DEBUG fprintf(stderr, "%s: Deactivating KeyCode conversion.\n", __func__); #endif fprintf(stderr, "Info: Keycode conversion auto-determined as off\n"); } } } Bool nxagentGetRemoteXkbExtension(void) { nxagentXkbInfo.Opcode = nxagentXkbInfo.EventBase = nxagentXkbInfo.ErrorBase = nxagentXkbInfo.MajorVersion = nxagentXkbInfo.MinorVersion = -1; nxagentXkbClearNames(); Bool result = XkbQueryExtension(nxagentDisplay, &nxagentXkbInfo.Opcode, &nxagentXkbInfo.EventBase, &nxagentXkbInfo.ErrorBase, &nxagentXkbInfo.MajorVersion, &nxagentXkbInfo.MinorVersion); if (result) { nxagentXkbGetNames(); } #ifdef WARNING else { fprintf(stderr, "%s: WARNING! Failed to query XKB extension.\n", __func__); } #endif return result; } #endif /* XKB */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Keyboard.h0000644000000000000000000001016313614532331020567 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #ifndef __Keyboard_H__ #define __Keyboard_H__ #define NXAGENT_KEYBOARD_EVENT_MASK \ (KeyPressMask | KeyReleaseMask | FocusChangeMask | KeymapStateMask) #define NXAGENT_KEYBOARD_EXTENSION_EVENT_MASK \ (XkbStateNotifyMask) /* * Queried at XKB initialization. */ typedef struct _XkbAgentInfo { int Opcode; int EventBase; int ErrorBase; int MajorVersion; int MinorVersion; } XkbAgentInfoRec; extern XkbAgentInfoRec nxagentXkbInfo; typedef struct _XkbAgentState { int Locked; int Caps; int Num; int Focus; int Initialized; } XkbAgentStateRec; extern XkbAgentStateRec nxagentXkbState; /* * Info for enabling/disabling Xkb. */ typedef struct _XkbWrapper { int base; int eventBase; int errorBase; int (* ProcXkbDispatchBackup)(ClientPtr); int (* SProcXkbDispatchBackup)(ClientPtr); } XkbWrapperRec; extern XkbWrapperRec nxagentXkbWrapper; extern char *nxagentKeyboard; /* * Keyboard device procedure * and utility functions. */ void nxagentBell(int volume, DeviceIntPtr pDev, void * ctrl, int cls); int nxagentKeyboardProc(DeviceIntPtr pDev, int onoff); void nxagentChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl); void nxagentNotifyKeyboardChanges(int oldMinKeycode, int oldMaxKeycode); int nxagentResetKeyboard(void); #ifdef XKB void nxagentInitXkbWrapper(void); void nxagentDisableXkbExtension(void); void nxagentEnableXkbExtension(void); void nxagentTuneXkbWrapper(void); void nxagentKeycodeConversionSetup(void); Bool nxagentGetRemoteXkbExtension(void); #endif CARD8 nxagentConvertKeycode(CARD8 k); extern CARD8 nxagentCapsLockKeycode; extern CARD8 nxagentNumLockKeycode; extern unsigned int nxagentAltMetaMask; extern unsigned int nxagentAltMask; extern unsigned int nxagentMetaMask; extern unsigned int nxagentCapsMask; extern unsigned int nxagentNumlockMask; #endif /* __Keyboard_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c0000644000000000000000000005167613614532331021020 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "X.h" #include "keysym.h" #include "screenint.h" #include "scrnintstr.h" #include "Agent.h" #include "Display.h" #include "Events.h" #include "Options.h" #include "Keyboard.h" #include "Drawable.h" #include "Init.h" /* extern int nxagentX2go */ #include "Utils.h" #include #include #include extern Bool nxagentWMIsRunning; extern char *nxagentKeystrokeFile; #ifdef NX_DEBUG_INPUT int nxagentDebugInputDevices = False; unsigned long nxagentLastInputDevicesDumpTime = 0; extern void nxagentDeactivateInputDevicesGrabs(); #endif /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP /* must be included _after_ DUMP */ #include "Keystroke.h" /* this table is used to parse actions given on the command line or in the * config file, therefore indices have to match the enum in Keystroke.h */ char * nxagentSpecialKeystrokeNames[] = { "end_marker", "close_session", "switch_all_screens", "fullscreen", "minimize", "defer", "ignore", "force_synchronization", #ifdef DEBUG_TREE "debug_tree", #endif #ifdef DUMP "regions_on_screen", #endif #ifdef NX_DEBUG_INPUT "test_input", "deactivate_input_devices_grab", #endif "resize", "viewport_move_left", "viewport_move_up", "viewport_move_right", "viewport_move_down", "viewport_scroll_left", "viewport_scroll_up", "viewport_scroll_right", "viewport_scroll_down", "reread_keystrokes", "autograb", NULL, }; struct nxagentSpecialKeystrokeMap default_map[] = { /* stroke, modifierMask, modifierAltMeta, keysym */ #ifdef DEBUG_TREE {KEYSTROKE_DEBUG_TREE, ControlMask, True, XK_q}, #endif {KEYSTROKE_CLOSE_SESSION, ControlMask, True, XK_t}, {KEYSTROKE_SWITCH_ALL_SCREENS, ControlMask, True, XK_f}, {KEYSTROKE_FULLSCREEN, ControlMask | ShiftMask, True, XK_f}, {KEYSTROKE_MINIMIZE, ControlMask, True, XK_m}, {KEYSTROKE_DEFER, ControlMask, True, XK_e}, {KEYSTROKE_FORCE_SYNCHRONIZATION, ControlMask, True, XK_j}, #ifdef DUMP {KEYSTROKE_REGIONS_ON_SCREEN, ControlMask, True, XK_a}, #endif #ifdef NX_DEBUG_INPUT {KEYSTROKE_TEST_INPUT, ControlMask, True, XK_x}, {KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB, ControlMask, True, XK_y}, #endif {KEYSTROKE_RESIZE, ControlMask, True, XK_r}, {KEYSTROKE_VIEWPORT_MOVE_LEFT, ControlMask | ShiftMask, True, XK_Left}, {KEYSTROKE_VIEWPORT_MOVE_LEFT, ControlMask | ShiftMask, True, XK_KP_Left}, {KEYSTROKE_VIEWPORT_MOVE_UP, ControlMask | ShiftMask, True, XK_Up}, {KEYSTROKE_VIEWPORT_MOVE_UP, ControlMask | ShiftMask, True, XK_KP_Up}, {KEYSTROKE_VIEWPORT_MOVE_RIGHT, ControlMask | ShiftMask, True, XK_Right}, {KEYSTROKE_VIEWPORT_MOVE_RIGHT, ControlMask | ShiftMask, True, XK_KP_Right}, {KEYSTROKE_VIEWPORT_MOVE_DOWN, ControlMask | ShiftMask, True, XK_Down}, {KEYSTROKE_VIEWPORT_MOVE_DOWN, ControlMask | ShiftMask, True, XK_KP_Down}, {KEYSTROKE_VIEWPORT_SCROLL_LEFT, ControlMask, True, XK_Left}, {KEYSTROKE_VIEWPORT_SCROLL_LEFT, ControlMask, True, XK_KP_Left}, {KEYSTROKE_VIEWPORT_SCROLL_UP, ControlMask, True, XK_Up}, {KEYSTROKE_VIEWPORT_SCROLL_UP, ControlMask, True, XK_KP_Up}, {KEYSTROKE_VIEWPORT_SCROLL_RIGHT, ControlMask, True, XK_Right}, {KEYSTROKE_VIEWPORT_SCROLL_RIGHT, ControlMask, True, XK_KP_Right}, {KEYSTROKE_VIEWPORT_SCROLL_DOWN, ControlMask, True, XK_Down}, {KEYSTROKE_VIEWPORT_SCROLL_DOWN, ControlMask, True, XK_KP_Down}, {KEYSTROKE_REREAD_KEYSTROKES, ControlMask, True, XK_k}, {KEYSTROKE_AUTOGRAB, ControlMask, True, XK_g}, {KEYSTROKE_END_MARKER, 0, False, NoSymbol}, }; struct nxagentSpecialKeystrokeMap *map = default_map; static Bool modifier_matches(unsigned int mask, int compare_alt_meta, unsigned int state) { /* nxagentAltMetaMask needs special handling * it seems to me its an and-ed mask of all possible meta and alt keys * somehow... * * otherwise this function would be just a simple bitop */ Bool ret = True; if (compare_alt_meta) { if (! (state & nxagentAltMetaMask)) { ret = False; } mask &= ~nxagentAltMetaMask; state &= ~nxagentAltMetaMask; } /* ignore CapsLock and/or Numlock if the keystroke does not explicitly require them */ if ( !(mask & nxagentCapsMask) ) state &= ~nxagentCapsMask; if ( !(mask & nxagentNumlockMask) ) state &= ~nxagentNumlockMask; /* all modifiers except meta/alt have to match exactly, extra bits are evil */ if (mask != state) { ret = False; } return ret; } static Bool read_binding_from_xmlnode(xmlNode *node, struct nxagentSpecialKeystrokeMap *ret) { /* init the struct to have proper values in case not all attributes are found */ struct nxagentSpecialKeystrokeMap newkm = { .stroke = KEYSTROKE_NOTHING, .modifierMask = 0, .modifierAltMeta = False, .keysym = NoSymbol }; for (xmlAttr *attr = node->properties; attr; attr = attr->next) { /* ignore attributes without data (which should never happen anyways) */ if (attr->children->content == NULL) { #ifdef DEBUG char *aname = (attr->name)?((char *)attr->name):"unknown"; fprintf(stderr, "attribute %s with NULL value", aname); #endif continue; } if (strcmp((char *)attr->name, "action") == 0) { newkm.stroke = KEYSTROKE_NOTHING; for (int i = 0; nxagentSpecialKeystrokeNames[i] != NULL; i++) { if (strcmp(nxagentSpecialKeystrokeNames[i], (char *)attr->children->content) == 0) { /* this relies on the values of enum nxagentSpecialKeystroke and the * indices of nxagentSpecialKeystrokeNames being in sync */ newkm.stroke = i; break; } } if (newkm.stroke == KEYSTROKE_NOTHING) fprintf(stderr, "Info: ignoring unknown keystroke action '%s'.\n", (char *)attr->children->content); continue; } else if (strcmp((char *)attr->name, "key") == 0) { newkm.keysym = XStringToKeysym((char *)attr->children->content); continue; } else { /* ignore attributes with value="0" or "false", everything else is interpreted as true */ if (strcmp((char *)attr->children->content, "0") == 0 || strcmp((char *)attr->children->content, "false") == 0) continue; if (strcmp((char *)attr->name, "Mod1") == 0) { newkm.modifierMask |= Mod1Mask; } else if (strcmp((char *)attr->name, "Mod2") == 0) { newkm.modifierMask |= Mod2Mask; } else if (strcmp((char *)attr->name, "Mod3") == 0) { newkm.modifierMask |= Mod3Mask; } else if (strcmp((char *)attr->name, "Mod4") == 0) { newkm.modifierMask |= Mod4Mask; } else if (strcmp((char *)attr->name, "Mod5") == 0) { newkm.modifierMask |= Mod5Mask; } else if (strcmp((char *)attr->name, "Control") == 0) { newkm.modifierMask |= ControlMask; } else if (strcmp((char *)attr->name, "Shift") == 0) { newkm.modifierMask |= ShiftMask; } else if (strcmp((char *)attr->name, "Lock") == 0) { newkm.modifierMask |= LockMask; } else if (strcmp((char *)attr->name, "AltMeta") == 0) { newkm.modifierAltMeta = True; } } } if (newkm.stroke != KEYSTROKE_NOTHING && newkm.keysym != NoSymbol) { /* keysym and stroke are required, everything else is optional */ memcpy(ret, &newkm, sizeof(struct nxagentSpecialKeystrokeMap)); return True; } else return False; } char *checkKeystrokeFile(char *filename) { if (!filename) return NULL; if (access(filename, R_OK) == 0) { return filename; } else { #ifdef WARNING fprintf(stderr, "Warning: Cannot read keystroke file '%s'.\n", filename); #endif return NULL; } } /* * searches a keystroke xml file * * search order: * - '-keystrokefile' commandline parameter * - $NXAGENT_KEYSTROKEFILE environment variable * - $HOME/.nx/config/keystrokes.cfg * - /etc/nxagent/keystrokes.cfg * - hardcoded traditional NX default settings * If run in x2go flavour different filenames and varnames are used. */ void nxagentInitKeystrokes(Bool force) { char *filename = NULL; char *homefile; char *etcfile; char *envvar; /* used for tracking if the config file parsing has already been done (regardless of the result) */ static Bool done = False; if (force) { if (map != default_map) { SAFE_free(map); map = default_map; } fprintf(stderr, "Info: re-reading keystrokes configuration\n"); } else { if (done) return; } done = True; if (nxagentX2go) { homefile = "/.x2go/config/keystrokes.cfg"; etcfile = "/etc/x2go/keystrokes.cfg"; envvar = "X2GO_KEYSTROKEFILE"; } else { homefile = "/.nx/config/keystrokes.cfg"; etcfile = "/etc/nxagent/keystrokes.cfg"; envvar = "NXAGENT_KEYSTROKEFILE"; } char *homepath = NULL; char *homedir = getenv("HOME"); if (homedir) { if (-1 == asprintf(&homepath, "%s%s", homedir, homefile)) { fprintf(stderr, "malloc failed"); exit(EXIT_FAILURE); } } /* if any of the files can be read we have our candidate */ if ((filename = checkKeystrokeFile(nxagentKeystrokeFile)) || (filename = checkKeystrokeFile(getenv(envvar))) || (filename = checkKeystrokeFile(homepath)) || (filename = checkKeystrokeFile(etcfile))) { LIBXML_TEST_VERSION xmlDoc *doc = xmlReadFile(filename, NULL, 0); if (doc) { fprintf(stderr, "Info: using keystrokes file '%s'\n", filename); for (xmlNode *cur = xmlDocGetRootElement(doc); cur; cur = cur->next) { if (cur->type == XML_ELEMENT_NODE && strcmp((char *)cur->name, "keystrokes") == 0) { xmlNode *bindings; int num = 0; int idx = 0; for (bindings = cur->children; bindings; bindings = bindings->next) { if (bindings->type == XML_ELEMENT_NODE && strcmp((char *)bindings->name, "keystroke") == 0) { num++; } } #ifdef DEBUG fprintf(stderr, "%s: found %d keystrokes in %s\n", __func__, num, filename); #endif if (!(map = calloc(num+1, sizeof(struct nxagentSpecialKeystrokeMap)))) { fprintf(stderr, "calloc failed"); exit(EXIT_FAILURE); } for (bindings = cur->children; bindings; bindings = bindings->next) { map[idx].stroke = KEYSTROKE_NOTHING; if (bindings->type == XML_ELEMENT_NODE && strcmp((char *)bindings->name, "keystroke") == 0 && read_binding_from_xmlnode(bindings, &(map[idx]))) { Bool store = True; for (int j = 0; j < idx; j++) { if (map[j].stroke != KEYSTROKE_NOTHING && map[idx].keysym != NoSymbol && map[j].keysym == map[idx].keysym && map[j].modifierMask == map[idx].modifierMask && map[j].modifierAltMeta == map[idx].modifierAltMeta) { #ifdef WARNING fprintf(stderr, "Warning: ignoring keystroke '%s' (already in use by '%s')\n", nxagentSpecialKeystrokeNames[map[idx].stroke], nxagentSpecialKeystrokeNames[map[j].stroke]); #endif store = False; break; } } if (store) idx++; else map[idx].stroke = KEYSTROKE_NOTHING; } } #ifdef DEBUG fprintf(stderr, "%s: read %d keystrokes", __func__, idx); #endif map[idx].stroke = KEYSTROKE_END_MARKER; } } xmlFreeDoc(doc); xmlCleanupParser(); } #ifdef WARNING else /* if (doc) */ { fprintf(stderr, "Warning: could not read/parse keystrokes file '%s'\n", filename); } #endif filename = NULL; } SAFE_free(homepath); if (map == default_map) { fprintf(stderr, "Info: Using builtin keystrokes.\n"); } nxagentDumpKeystrokes(); } void nxagentDumpKeystrokes(void) { int maxlen = 0; for (int i = 0; nxagentSpecialKeystrokeNames[i]; i++) maxlen = max(maxlen, strlen(nxagentSpecialKeystrokeNames[i])); fprintf(stderr, "Currently known keystrokes:\n"); for (struct nxagentSpecialKeystrokeMap *cur = map; cur->stroke != KEYSTROKE_END_MARKER; cur++) { unsigned int mask = cur->modifierMask; fprintf(stderr, " %-*s ", maxlen, nxagentSpecialKeystrokeNames[cur->stroke]); if (mask & ControlMask) {fprintf(stderr, "Ctrl+"); mask &= ~ControlMask;} if (mask & ShiftMask) {fprintf(stderr, "Shift+"); mask &= ~ShiftMask;} /* these are only here for better readable modifier names. Normally they are covered by the Mod and Lock lines below */ if (cur->modifierAltMeta) {fprintf(stderr, "Alt+"); mask &= ~(cur->modifierAltMeta);} if (mask & nxagentCapsMask) {fprintf(stderr, "CapsLock+"); mask &= ~nxagentCapsMask;} if (mask & nxagentNumlockMask) {fprintf(stderr, "NumLock+"); mask &= ~nxagentNumlockMask;} if (mask & Mod1Mask) {fprintf(stderr, "Mod1+"); mask &= ~Mod1Mask;} if (mask & Mod2Mask) {fprintf(stderr, "Mod2+"); mask &= ~Mod2Mask;} if (mask & Mod3Mask) {fprintf(stderr, "Mod3+"); mask &= ~Mod3Mask;} if (mask & Mod4Mask) {fprintf(stderr, "Mod4+"); mask &= ~Mod4Mask;} if (mask & Mod5Mask) {fprintf(stderr, "Mod5+"); mask &= ~Mod5Mask;} if (mask & LockMask) {fprintf(stderr, "Lock+"); mask &= ~LockMask;} fprintf(stderr, "%s\n", XKeysymToString(cur->keysym)); } } static enum nxagentSpecialKeystroke find_keystroke(XKeyEvent *X) { enum nxagentSpecialKeystroke ret = KEYSTROKE_NOTHING; KeySym keysym = XKeycodeToKeysym(nxagentDisplay, X->keycode, 0); #ifdef DEBUG fprintf(stderr, "%s: got keysym '%c' (%d)\n", __func__, keysym, keysym); #endif for (struct nxagentSpecialKeystrokeMap *cur = map; cur->stroke != KEYSTROKE_END_MARKER; cur++) { #ifdef DEBUG fprintf(stderr,"%s: keysym %d stroke %d, type %d\n", __func__, cur->keysym, cur->stroke, X->type); #endif if (cur->keysym == keysym && modifier_matches(cur->modifierMask, cur->modifierAltMeta, X->state)) { #ifdef DEBUG fprintf(stderr, "%s: match including modifiers for keysym '%c' (%d), stroke %d (%s)\n", __func__, cur->keysym, cur->keysym, cur->stroke, nxagentSpecialKeystrokeNames[cur->stroke]); #endif return cur->stroke; } } return ret; } /* * returns True if a special keystroke has been pressed. *result will contain the action. */ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result) { enum nxagentSpecialKeystroke stroke = find_keystroke(X); *result = doNothing; #ifdef TEST if (stroke != KEYSTROKE_NOTHING && stroke != KEYSTROKE_END_MARKER) fprintf(stderr, "nxagentCheckSpecialKeystroke: got code %x - state %x - stroke %d (%s)\n", X -> keycode, X -> state, stroke, nxagentSpecialKeystrokeNames[stroke]); else fprintf(stderr, "nxagentCheckSpecialKeystroke: got code %x - state %x - stroke %d (unused)\n", X -> keycode, X -> state, stroke); #endif if (stroke == KEYSTROKE_NOTHING) return False; /* * Check special keys. */ /* * FIXME: We should use the keysym instead that the keycode * here. */ switch (stroke) { #ifdef DEBUG_TREE case KEYSTROKE_DEBUG_TREE: *result = doDebugTree; break; #endif case KEYSTROKE_CLOSE_SESSION: *result = doCloseSession; break; case KEYSTROKE_SWITCH_ALL_SCREENS: if (!nxagentOption(Rootless)) { *result = doSwitchAllScreens; } break; case KEYSTROKE_MINIMIZE: if (!nxagentOption(Rootless)) { *result = doMinimize; } break; case KEYSTROKE_DEFER: *result = doSwitchDeferMode; break; case KEYSTROKE_IGNORE: /* this is used e.g. to ignore C-A-Backspace aka XK_Terminate_Server */ return True; break; case KEYSTROKE_FORCE_SYNCHRONIZATION: nxagentForceSynchronization = 1; break; #ifdef DUMP case KEYSTROKE_REGIONS_ON_SCREEN: nxagentRegionsOnScreen(); break; #endif #ifdef NX_DEBUG_INPUT case KEYSTROKE_TEST_INPUT: /* * Used to test the input devices state. */ if (X -> type == KeyPress) { if (!nxagentDebugInputDevices) { fprintf(stderr, "Info: Turning input devices debug ON.\n"); nxagentDebugInputDevices = True; } else { fprintf(stderr, "Info: Turning input devices debug OFF.\n"); nxagentDebugInputDevices = False; nxagentLastInputDevicesDumpTime = 0; } } return True; break; case KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB: if (X->type == KeyPress) { nxagentDeactivateInputDevicesGrab(); } return True; break; #endif case KEYSTROKE_FULLSCREEN: if (!nxagentOption(Rootless)) { *result = doSwitchFullscreen; } break; case KEYSTROKE_RESIZE: if (!nxagentOption(Rootless)) { *result = doSwitchResizeMode; } break; case KEYSTROKE_VIEWPORT_MOVE_LEFT: if (!nxagentOption(Rootless) && !nxagentOption(DesktopResize)) { *result = doViewportMoveLeft; } break; case KEYSTROKE_VIEWPORT_MOVE_UP: if (!nxagentOption(Rootless) && !nxagentOption(DesktopResize)) { *result = doViewportMoveUp; } break; case KEYSTROKE_VIEWPORT_MOVE_RIGHT: if (!nxagentOption(Rootless) && !nxagentOption(DesktopResize)) { *result = doViewportMoveRight; } break; case KEYSTROKE_VIEWPORT_MOVE_DOWN: if (!nxagentOption(Rootless) && !nxagentOption(DesktopResize)) { *result = doViewportMoveDown; } break; case KEYSTROKE_VIEWPORT_SCROLL_LEFT: if (!nxagentOption(Rootless) && !nxagentOption(DesktopResize)) { *result = doViewportLeft; } break; case KEYSTROKE_VIEWPORT_SCROLL_UP: if (!nxagentOption(Rootless) && !nxagentOption(DesktopResize)) { *result = doViewportUp; } break; case KEYSTROKE_VIEWPORT_SCROLL_RIGHT: if (!nxagentOption(Rootless) && !nxagentOption(DesktopResize)) { *result = doViewportRight; } break; case KEYSTROKE_VIEWPORT_SCROLL_DOWN: if (!nxagentOption(Rootless) && !nxagentOption(DesktopResize)) { *result = doViewportDown; } break; case KEYSTROKE_REREAD_KEYSTROKES: /* two reasons to check on KeyRelease: - this code is called for KeyPress and KeyRelease, so we would read the keystroke file twice - if the keystroke file changes settings for this key this might lead to unexpected behaviour */ if (X->type == KeyRelease) nxagentInitKeystrokes(True); break; case KEYSTROKE_AUTOGRAB: *result = doAutoGrab; break; case KEYSTROKE_NOTHING: /* do nothing. difference to KEYSTROKE_IGNORE is the return value */ case KEYSTROKE_END_MARKER: /* just to make gcc STFU */ case KEYSTROKE_MAX: break; } return (*result != doNothing); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h0000644000000000000000000000730613614532331021014 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Keystroke_H__ #define __Keystroke_H__ #include "Events.h" extern Bool nxagentCheckSpecialKeystroke(XKeyEvent*, enum HandleEventResult*); extern void nxagentDumpKeystrokes(void); extern void nxagentInitKeystrokes(Bool force); /* keep this sorted, do not rely on any numerical value in this enum, and be aware * that KEYSTROKE_MAX may be used in a malloc */ /* also be aware that if changing any numerical values, you also need to change values * Keystroke.c nxagentSpecialKeystrokeNames */ enum nxagentSpecialKeystroke { /* 0 is used as end marker */ KEYSTROKE_END_MARKER, KEYSTROKE_CLOSE_SESSION, KEYSTROKE_SWITCH_ALL_SCREENS, KEYSTROKE_FULLSCREEN, KEYSTROKE_MINIMIZE, KEYSTROKE_DEFER, KEYSTROKE_IGNORE, KEYSTROKE_FORCE_SYNCHRONIZATION, /* stuff used for debugging, probably not useful for most people */ #ifdef DEBUG_TREE KEYSTROKE_DEBUG_TREE, #endif #ifdef DUMP KEYSTROKE_REGIONS_ON_SCREEN, #endif #ifdef NX_DEBUG_INPUT KEYSTROKE_TEST_INPUT, KEYSTROKE_DEACTIVATE_INPUT_DEVICES_GRAB, #endif /* all the viewport stuff */ KEYSTROKE_RESIZE, KEYSTROKE_VIEWPORT_MOVE_LEFT, KEYSTROKE_VIEWPORT_MOVE_UP, KEYSTROKE_VIEWPORT_MOVE_RIGHT, KEYSTROKE_VIEWPORT_MOVE_DOWN, KEYSTROKE_VIEWPORT_SCROLL_LEFT, KEYSTROKE_VIEWPORT_SCROLL_UP, KEYSTROKE_VIEWPORT_SCROLL_RIGHT, KEYSTROKE_VIEWPORT_SCROLL_DOWN, KEYSTROKE_REREAD_KEYSTROKES, KEYSTROKE_AUTOGRAB, KEYSTROKE_NOTHING, /* insert more here and in the string translation */ KEYSTROKE_MAX, }; struct nxagentSpecialKeystrokeMap { enum nxagentSpecialKeystroke stroke; unsigned int modifierMask; /* everything except alt/meta */ Bool modifierAltMeta; /* modifier combination should include alt/meta */ KeySym keysym; }; #endif /* __Keystroke_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Literals.h0000644000000000000000000001250613614532331020611 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Simple table used to translate a request * opcode to the name of the X request. */ static char *nxagentRequestLiteral[] = { "None", "CreateWindow", "ChangeWindowAttributes", "GetWindowAttributes", "DestroyWindow", "DestroySubwindows", "ChangeSaveSet", "ReparentWindow", "MapWindow", "MapSubwindows", "UnmapWindow", "UnmapSubwindows", "ConfigureWindow", "CirculateWindow", "GetGeometry", "QueryTree", "InternAtom", "GetAtomName", "ChangeProperty", "DeleteProperty", "GetProperty", "ListProperties", "SetSelectionOwner", "GetSelectionOwner", "ConvertSelection", "SendEvent", "GrabPointer", "UngrabPointer", "GrabButton", "UngrabButton", "ChangeActivePointerGrab", "GrabKeyboard", "UngrabKeyboard", "GrabKey", "UngrabKey", "AllowEvents", "GrabServer", "UngrabServer", "QueryPointer", "GetMotionEvents", "TranslateCoords", "WarpPointer", "SetInputFocus", "GetInputFocus", "QueryKeymap", "OpenFont", "CloseFont", "QueryFont", "QueryTextExtents", "ListFonts", "ListFontsWithInfo", "SetFontPath", "GetFontPath", "CreatePixmap", "FreePixmap", "CreateGC", "ChangeGC", "CopyGC", "SetDashes", "SetClipRectangles", "FreeGC", "ClearArea", "CopyArea", "CopyPlane", "PolyPoint", "PolyLine", "PolySegment", "PolyRectangle", "PolyArc", "FillPoly", "PolyFillRectangle", "PolyFillArc", "PutImage", "GetImage", "PolyText8", "PolyText16", "ImageText8", "ImageText16", "CreateColormap", "FreeColormap", "CopyColormapAndFree", "InstallColormap", "UninstallColormap", "ListInstalledColormaps", "AllocColor", "AllocNamedColor", "AllocColorCells", "AllocColorPlanes", "FreeColors", "StoreColors", "StoreNamedColor", "QueryColors", "LookupColor", "CreateCursor", "CreateGlyphCursor", "FreeCursor", "RecolorCursor", "QueryBestSize", "QueryExtension", "ListExtensions", "ChangeKeyboardMapping", "GetKeyboardMapping", "ChangeKeyboardControl", "GetKeyboardControl", "Bell", "ChangePointerControl", "GetPointerControl", "SetScreenSaver", "GetScreenSaver", "ChangeHosts", "ListHosts", "SetAccessControl", "SetCloseDownMode", "KillClient", "RotateProperties", "ForceScreenSaver", "SetPointerMapping", "GetPointerMapping", "SetModifierMapping", "GetModifierMapping", "", "", "", "", "", "", "", "NoOperation" }; static char *nxagentRenderRequestLiteral[] = { "RenderQueryVersion", "RenderQueryPictFormats", "RenderQueryPictIndexValues", "RenderQueryDithers", "RenderCreatePicture", "RenderChangePicture", "RenderSetPictureClipRectangles", "RenderFreePicture", "RenderComposite", "RenderScale", "RenderTrapezoids", "RenderTriangles", "RenderTriStrip", "RenderTriFan", "RenderColorTrapezoids", "RenderColorTriangles", "RenderTransform", "RenderCreateGlyphSet", "RenderReferenceGlyphSet", "RenderFreeGlyphSet", "RenderAddGlyphs", "RenderAddGlyphsFromPicture", "RenderFreeGlyphs", "RenderCompositeGlyphs", "RenderCompositeGlyphs", "RenderCompositeGlyphs", "RenderFillRectangles", "RenderCreateCursor", "RenderSetPictureTransform", "RenderQueryFilters", "RenderSetPictureFilter", "RenderCreateAnimCursor", "RenderAddTraps", "RenderCreateSolidFill", "RenderCreateLinearGradient", "RenderCreateRadialGradient", "RenderCreateConicalGradient" }; static char *nxagentShmRequestLiteral[] = { "ShmQueryVersion", "ShmAttach", "ShmDetach", "ShmPutImage", "ShmGetImage", "ShmCreatePixmap" }; nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.10000644000000000000000000013430113614532331021160 0ustar .\" Copyright 1984 - 1991, 1993, 1994, 1998 The Open Group .\" Copyright 2011 - 2016, Mike Gabriel .\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. .ds q \N'34' .TH nxagent 1 "Jan 2020" "Version 3.5.99.23" "NX Agent (Xserver)" .SH NAME nxagent \- nested Xserver optimized for remote computing .SH SYNOPSIS .B nxagent .I "[options]" .SH DESCRIPTION \fBnxagent\fR is an X server for remote application/desktop access similar to Xnest or Xephyr. .PP \fBnxagent\fR implements a very efficient compression of the X11 protocol, called the NX protocol. .PP The NX protocol increases performance when using X applications over high latency and low bandwidth networks, while providing a local (LAN-like) usage experience even if connecting from off-site locations (via cable modem or GSM). .PP \fBnxagent\fR can be used standalone as a nested X server (with NX protocol disabled), but its real benefits are gained when using it over remote connections via the nxcomp compression library. The counterpart application on the other end (i.e. the client) is called \fBnxproxy\fR. .PP When used in proxy <-> agent mode, \fBnxagent\fR adds the feature of being suspendible. Sessions can be started from one client, suspended and then resumed from another (or the same) client. .PP \fBnxagent\fR and \fBnxproxy\fR are utilized by various remote application/desktop frameworks for providing server-side GUI application access from remote client systems. .PP Currently, \fBnxagent\fR is co-maintained by three of these projects: The Arctica Project, TheQVD and X2Go. .PP .SH "STARTING THE SERVER" \fBnxagent\fR should be run in user space. Other than the system's local X.org server, \fBnxagent\fR does not require to be run as root. When bundled with a remote application framework, you normally don't have to launch \fBnxagent\fR manually. \fBnxagent\fR startup is usually managed by the underlying framework (e.g. Arctica Session Manager, X2Go Server, etc.). .PP When \fBnxagent\fR starts up (e.g. by typing 'nxagent -ac :1' in a terminal window), it typically launches in "windowed desktop" mode. On your local X server a new window appears being an X server itself. .PP However, \fBnxagent\fR also supports rootless (or seamless) application mode and a shadow session mode (similar to what VNC does). .PP Example: You can launch a complete desktop session inside this nested X server now: .TP 8 The Debian way... .PP .nf $ export DISPLAY=:1 $ STARTUP=mate-session /etc/X11/Xsession .fi .TP 8 The Fedora / Gentoo / openSUSE way... .PP .nf ### FIXME / TODO ### .fi .PP However, \fBnxagent\fR also supports rootless (or seamless) application mode and a shadow session mode (similar to what VNC does). .SH OPTIONS \fBnxagent\fR accepts a range of default X server options as described below. Those default options have to be provided via the command line. Furthermore, \fBnxagent\fR accepts some nx-X11 specific options, described further below. Last but not least, \fBnxagent\fR accepts several more options, the so-called nx/nx options, provided via the $DISPLAY environment variable or the \fB-options\fR command line option. See below for further details. .SH STANDARD XSERVER OPTIONS .TP 8 .B :\fIdisplaynumber\fP The X server runs as the given \fIdisplaynumber\fP, which by default is 0. If multiple X servers are to run simultaneously on a host, each must have a unique display number. See the DISPLAY NAMES section of the \fIX\fP(__miscmansuffix__) manual page to learn how to specify which display number clients should try to use. .TP 8 .B \-a \fInumber\fP sets pointer acceleration (i.e. the ratio of how much is reported to how much the user actually moved the pointer). .TP 8 .B \-ac disables host-based access control mechanisms. Enables access by any host, and permits any host to modify the access control list. Use with extreme caution. This option exists primarily for running test suites remotely. .TP 8 .B \-audit \fIlevel\fP sets the audit trail level. The default level is 1, meaning only connection rejections are reported. Level 2 additionally reports all successful connections and disconnects. Level 4 enables messages from the SECURITY extension, if present, including generation and revocation of authorizations and violations of the security policy. Level 0 turns off the audit trail. Audit lines are sent as standard error output. .TP 8 .B \-auth \fIauthorization-file\fP specifies a file which contains a collection of authorization records used to authenticate access. See also the \fIxdm\fP(1) and \fIXsecurity\fP(__miscmansuffix__) manual pages. .TP 8 .B \-bs disables backing store support on all screens. .TP 8 .B \-br sets the default root window to solid black (default). .TP 8 .B \-wr sets the default root window to solid white. .TP 8 .B \-c turns off key-click. .TP 8 .B c \fIvolume\fP sets key-click volume (allowable range: 0-100). .TP 8 .B \-cc \fIclass\fP sets the visual class for the root window of color screens. The class numbers are as specified in the X protocol. Not obeyed by all servers. .TP 8 .B \-co \fIfilename\fP This used to be the option for specifying the path to the RGB color database file. As the RGB color database is now embedded into the binary this option has no effect but is kept for compatibility. Deprecated. .ig .TP 8 .B \-config \fIfilename\fP reads more options from the given file. Options in the file may be separated by newlines if desired. If a '#' character appears on a line, all characters between it and the next newline are ignored, providing a simple commenting facility. The \fB\-config\fR option itself may appear in the file. .BR NOTE : This option is disabled when the Xserver is run with an effective uid different from the user's real uid. .. .TP 8 .B \-core causes the server to generate a core dump on fatal errors. .TP 8 .B \-displayfd \fIfd\fP specifies a file descriptor in the launching process. Rather than specifying a display number, the X server will attempt to listen on successively higher display numbers, and upon finding a free one, will write the port number back on this file descriptor as a newline-terminated string. The \fB\-pn\fR option is ignored when using \fB\-displayfd\fR. nxagent specific: (1) Other than in X.org's Xserver, you can use \fB\-displayfd\fR in conjunction with an explicit display number. If the explicit display number is not available (i.e., already in use), nxagent tries to figure out the next available display number, e.g.: \fBnxagent\fR \fI\-displayfd 2 :50\fR (2) If \fB\-displayfd\fR is given with equaling 2 (STDERR), then the display number string written to STDERR is beautified with some human-readable (machine-parseable) text. .TP 8 .B \-sync This option tells \fBnxagent\fR to synchronize its window and graphics operations with the real server. This is a useful option for debugging, but it will slow down \fBnxagent\fR's performance considerably. It should not be used unless absolutely necessary. .TP 8 .B \-full This option tells \fBnxagent\fR to utilize full regeneration of real server objects and reopen a new connection to the real server each time \fBnxagent\fR regenerates. The sample server implementation regenerates all objects in the server when the last client of this server terminates. When this happens, \fBnxagent\fR by default maintains the same top-level window and the same real server connection in each new generation. If the user selects full regeneration, even the top-level window and the connection to the real server will be regenerated for each server generation. .TP 8 .B \-class \fIstring\fP This option specifies the default visual class of the nested server. It is similar to the .B \-cc option from the set of standard options except that it will accept a string rather than a number for the visual class specification. The .I string must be one of the following six values: .BR StaticGray , .BR GrayScale , .BR StaticColor , .BR PseudoColor , .BR TrueColor , or .BR DirectColor . If both the .B \-class and .B \-cc options are specified, the last instance of either option takes precedence. The class of the default visual of the nested server need not be the same as the class of the default visual of the real server, but it must be supported by the real server. Use .BR xdpyinfo (__appmansuffix__) to obtain a list of supported visual classes on the real server before starting \fBnxagent\fR. If the user chooses a static class, all the colors in the default color map will be preallocated. If the user chooses a dynamic class, colors in the default color map will be available to individual clients for allocation. .TP 8 .B \-deferglyphs \fIwhichfonts\fP specifies the types of fonts for which the server should attempt to use deferred glyph loading. \fIwhichfonts\fP can be all (all fonts), none (no fonts), or 16 (16 bit fonts only). .TP 8 .B \-depth \fIint\fP This option specifies the default visual depth of the nested server. The depth of the default visual of the nested server need not be the same as the depth of the default visual of the real server, but it must be supported by the real server. Use .BR xdpyinfo (__appmansuffix__) to obtain a list of supported visual depths on the real server before starting \fBnxagent\fR. .TP 8 .B \-geometry \fIW\fBx\fIH\fB+\fIX\fB+\fIY\fP This option specifies the geometry parameters for the top-level \fBnxagent\fR window. See \(lqGEOMETRY SPECIFICATIONS\(rq in .BR X (__miscmansuffix__) for a discusson of this option's syntax. This window corresponds to the root window of the nested server. The width .I W and height .I H specified with this option will be the maximum width and height of each top-level \fBnxagent\fR window. \fBnxagent\fR will allow the user to make any top-level window smaller, but it will not actually change the size of the nested server root window. If this option is not specified, \fBnxagent\fR will choose .I W and .I H to be 3/4ths the dimensions of the root window of the real server. .TP 8 .B \-dpi \fIresolution\fP sets the resolution for all screens, in dots per inch. If this option is not specified \fBnxagent\fR will assume 96. There's also .B \-autodpi which will clone the real server's dpi. Note that the resolution specified via .B \-dpi is a per session setting. It cannot be changed on reconnect! This means that clients may look "wrong" when reconnecting a session that had been started with a different dpi than the current real xserver. .TP 8 .B dpms enables DPMS (display power management services), where supported. The default state is platform and configuration specific. .TP 8 .B \-dpms disables DPMS (display power management services). The default state is platform and configuration specific. .TP 8 .B \-f \fIvolume\fP sets feep (bell) volume (allowable range: 0-100). .TP 8 .B \-fc \fIcursorFont\fP sets default cursor font. .TP 8 .B \-fn \fIfont\fP sets the default font. .TP 8 .B \-fp \fIfontPath\fP sets the search path for fonts. This path is a comma separated list of directories which the X server searches for font databases. See the FONTS section of this manual page for more information and the default list. .TP 8 .B \-help prints a usage message. .TP 8 .B \-I causes all remaining command line arguments to be ignored. .TP 8 .B \-maxbigreqsize \fIsize\fP sets the maximum big request to .I size MB. .TP 8 .B \-name string This option specifies the name of the top-level \fBnxagent\fR window as .IR string . The default value is the program name. .TP 8 .B \-nolisten \fItrans-type\fP disables a transport type. For example, TCP/IP connections can be disabled with .BR "\-nolisten tcp" . This option may be issued multiple times to disable listening to different transport types. .TP 8 .B \-noreset prevents a server reset when the last client connection is closed. This overrides a previous .B \-terminate command line option. .TP 8 .B \-p \fIminutes\fP sets screen-saver pattern cycle time in minutes. .TP 8 .B \-pn permits the server to continue running if it fails to establish all of its well-known sockets (connection points for clients), but establishes at least one. This option is set by default. .TP 8 .B \-nopn causes the server to exit if it fails to establish all of its well-known sockets (connection points for clients). .TP 8 .B \-r turns off auto-repeat. .TP 8 .B r turns on auto-repeat. .TP 8 .B \-s \fIminutes\fP sets screen-saver timeout time in minutes. .TP 8 .B \-su disables save under support on all screens. .TP 8 .B \-t \fInumber\fP sets pointer acceleration threshold in pixels (i.e. after how many pixels pointer acceleration should take effect). .TP 8 .B \-terminate causes the server to terminate at server reset, instead of continuing to run. This overrides a previous .B \-noreset command line option. .TP 8 .B \-to \fIseconds\fP sets default connection timeout in seconds. .TP 8 .B \-tst disables all testing extensions. .TP 8 .B v sets video-off screen-saver preference. .TP 8 .B \-v sets video-on screen-saver preference. .TP 8 .B \-wm forces the default backing-store of all windows to be WhenMapped. This is a backdoor way of getting backing-store to apply to all windows. Although all mapped windows will have backing store, the backing store attribute value reported by the server for a window will be the last value established by a client. If it has never been set by a client, the server will report the default value, NotUseful. This behavior is required by the X protocol, which allows the server to exceed the client's backing store expectations but does not provide a way to tell the client that it is doing so. .TP 8 .B [+-]xinerama enables(+) or disables(-) XINERAMA provided via the PanoramiX extension. This is set to off by default. .TP 8 .B [+-]rrxinerama enables(+) or disables(-) XINERAMA provided via the RandR extension. By default, this feature is enabled. To disable XINERAMA completely, make sure to use both options (\fB\-xinerama\fR and \fB\-rrxinerama\fR) on the command line. .SH SERVER DEPENDENT OPTIONS \fBnxagent\fR additionally accepts the following non-standard options: .TP 8 .B \-logo turns on the X Window System logo display in the screen-saver. There is currently no way to change this from a client. .TP 8 .B nologo turns off the X Window System logo display in the screen-saver. There is currently no way to change this from a client. .TP 8 .B \-render .BR default | mono | gray | color sets the color allocation policy that will be used by the render extension. .RS 8 .TP 8 .I default selects the default policy defined for the display depth of the X server. .TP 8 .I mono don't use any color cell. .TP 8 .I gray use a gray map of 13 color cells for the X render extension. .TP 8 .I color use a color cube of at most 4*4*4 colors (that is 64 color cells). .RE .TP 8 .B \-dumbSched disables smart scheduling on platforms that support the smart scheduler. .TP .B \-schedInterval \fIinterval\fP sets the smart scheduler's scheduling interval to .I interval milliseconds. .SH NXAGENT SPECIFIC OPTIONS The nx-X11 system adds the following command line arguments: .TP 8 .B \-forcenx force use of NX protocol messages assuming communication through \fBnxproxy\fR .TP 8 .B \-autograb enable autograb mode on \fBnxagent\fR startup. The autograb feature can be toggled via nxagent keystrokes .TP 8 .B \-nxrealwindowprop set property NX_REAL_WINDOW for each X11 client inside \fBnxagent\fR, providing the window XID of the corresponding window object on the X server that \fBnxagent\fR runs on .TP 8 .B \-reportwids explicitly tell \fBnxagent\fR to report its externally exposed X11 window IDs to the session log (in machine readable form), so that external parsers can obtain that information from there .TP 8 .B \-reportprivatewids explicitly tell \fBnxagent\fR to report X11 window IDs of internally created window objects to the session log (in machine readable form), so that external parsers can obtain that information from there; this creates a lot of output and may affect performance .TP 8 .B \-timeout \fIint\fP auto-disconnect timeout in seconds (minimum allowed: 60) .TP 8 .B \-norootlessexit don't exit if there are no clients in rootless mode .TP 8 .B \-autodpi detect real server's DPI and set it in the agent session; the .B \-dpi\fP cmdline option overrides .B \-autodpi\fP. Note that using .B \-autodpi will also adapt the DPI on reconnect which will cause newly started clients respecting the new DPI while clients that had been started before the reconnect still use the old DPI. This may lead to applications looking "weird". .TP 8 .B \-nomagicpixel disable magic pixel support at session startup, can be re-enabled via nx/nx option on session resumption .TP 8 .B \-norender disable the use of the render extension .TP 8 .B \-nocomposite disable the use of the composite extension .TP 8 .B \-nopersistent disable disconnection/reconnection to the X display on SIGHUP .TP 8 .B \-noshmem disable use of shared memory extension .TP 8 .B \-shmem enable use of shared memory extension (default) .TP 8 .B \-noshpix disable use of shared pixmaps .TP 8 .B \-shpix enable use of shared pixmaps (default) .TP 8 .B \-noignore don't ignore pointer and keyboard configuration changes mandated by clients. As a result, configuration commands like disabling the keyboard bell (xset -b) will also affect the real X server. .TP 8 .B \-nokbreset don't reset keyboard device if the session is resumed .TP 8 .B \-noxkblock this is only relevant if you also specify \-keyboard=query. In that case \fBnxagent\fR will lock the keyboard settings and clients will get an error when trying to change keyboard settings via XKEYBOARD. With \-noxkblock the lock is not applied and clients are allowed to change the keyboard settings through XKEYBOARD. .TP 8 .B \-tile WxH size of image tiles (minimum allowed: 32x32) .TP 8 .B \-D enable desktop mode (default) .TP 8 .B \-R enable rootless mode .TP 8 .B \-S enable shadow mode .TP 8 .B \-B enable proxy binding mode .TP 8 .B \-version show version information and exit .TP 8 .B \-options \fIfilename\fP path to an options file containing nx/nx options (see below). .PP Other than the command line options, \fBnxagent\fR can be configured at session startup and at runtime (i.e. when resuming a suspended session) by so-called nx/nx options. .PP As nx/nx options all options supported by nxcomp (see \fBnxproxy\fR man page) and all \fBnxagent\fR nx/nx options (see below) can be used. . When launching an nxcomp based \fBnxagent\fR session (i.e. proxy <-> agent), you will normally set the $DISPLAY variable like this: .PP .nf $ export DISPLAY=nx/nx,listen=,options=: $ nxagent : .fi .PP The value for is some value of a not-yet-used X11 display (e.g. :50). .PP Using an options file is recommended, but you can also put available nx/nx options (see below) into the DISPLAY variable directly. Note, that the $DISPLAY variable field is of limited length. .PP As you can pick an arbitrary (unused) TCP port or Unix socket file path. This is the port / socket that you have to connect to with the \fBnxproxy\fR application. .PP The right hand side of an option (the part following the "=" character) can include URL encoded characters. It is required to URL encode at least "," (as %2D) and "=" (as %3D) to avoid wrong parsing of the options string. .PP Available \fBnxagent\fR options (as an addition to nx/nx options supported by nxcomp already): .TP 8 .B options= read options from file, this text file can contain a single loooong line with comma-separated nx/nx options .TP 8 .B rootless= start \fBnxagent\fR in rootless mode, matches \-R given on the command line, no-op when resuming (default: \fI0\fR, disabled) .TP 8 .B geometry= desktop geometry when starting or resuming a session, no-op in rootless mode (default 66% of the underlying X server geometry) .TP 8 .B resize= set resizing support (default: \fI1\fR, enabled) .TP 8 .B fullscreen= start or resume a session in fullscreen mode (default: \fI0\fR, off) .TP 8 .B keyboard= or kbtype= .BR query | clone | / | rmlvo/#### .RS 8 .TP 8 .I query use the default XKB keyboard layout (see below) and only allow clients to query the settings but prevent any changes. \fIquery\fR is especially helpful for setups where you need to set/modify the actual keyboard layout using core X protocol functions (e.g. via \fBxmodmap\fR). It is used for MacOS X clients to handle some keyboard problems that are special for this platform. Note that in this case XKEYBOARD will always report the default layout which will most likely not match the experienced settings. .TP 8 .I clone ask the real X server for the keyboard settings using XKEYBOARD protocol functions and clone them. This is the recommended setting. For compatibility reasons it is not the default. .TP 8 .I / use the given model and layout. A value of \fInull/null\fR is equivalent to \fIclone\fR. You can not modify keyboard rules, variant or options this way. Instead preset values are used. These are \fIbase\fR for rules and empty strings for variant and options. .TP 8 .I rmlvo/#### configure the keyboard according to the rmlvo (Rules+Model+Layout+Variant+Options) description given after the / and separated by #. This can be used to fully pass the keyboard configuration of \fBnxagent\fR right after the start. Example: rmlvo/base#pc105#de,us#nodeadkeys#lv3:rwin_switch .RE .TP 8 .PP If \fIkeyboard\fR is omitted the internal defaults of \fBnxagent\fR will be used (rules: \fIbase\fR, layout: \fIus\fR, model: \fIpc102\fR, empty variant and options). .TP 8 .B keyconv= set keycode conversion mode .BR auto | on | off by default (\fIauto\fR) \fBnxagent\fR will activate keycode conversion if it detects an evdev XKEYBOARD setup on the client side (the standard on linux systems nowadays). Keycode conversion means that certain keycodes are mapped to make the keyboard appear as an pc105 model. Using \fIoff\fR this conversion can be suppressed and with \fIon\fR it will be forced. .TP 8 .B clipboard= .BR both | client | server | none .RS 8 .TP 8 .I both Allow clipboard data exchange both from nxagent to real X server and vice-versa. This is the default. .TP 8 .I client Limit clipboard data exchange to work only in one direction: from real X server to nxagent. Clipboard will still work inside nxagent. This setting effectively prevents data leakage from the nxagent session to the outside. .TP 8 .I server Limit clipboard data exchange to work only in one direction: from nxagent to real X server. .TP 8 .I none Disable any clipboard data exchange. Clipboard will still work inside the nxagent and on the real X server, but no data exchange will be possible. .RE .TP 8 .B streaming= enable (set to \fI1\fR) or disable (set to \fI0\fR) streaming support for images, not fully implemented yet and thus non-functional. (default: disabled) .TP 8 .B backingstore= disable (set to \fI0\fR) or enforce (set to \fI1\fR) backing store support (default: enforced). In rootless mode backingstore is always disabled. .TP 8 .B composite= enable (set to \fI1\fR) or disable (set to \fI0\fR) Composite support in \fBnxagent\fR (default: enabled) .TP 8 .B xinerama= enable (set to \fI1\fR) or disable (set to \fI0\fR) XINERAMA support in \fBnxagent\fR (default: enabled) .TP 8 .B shmem= enable/disable using shared memory. Accepted values: \fI1\fR (enable, default), \fI0\fR (disable) .TP 8 .B shpix= enable/disable shared pixmaps support. Accepted values: \fI1\fR (enable, default), \fI0\fR (disable) .TP 8 .B client= type of connecting operating system (supported: \fIlinux\fR, \fIwindows\fR, \fIsolaris\fR and \fImacosx\fR) .TP 8 .B shadow= define the display that should be shadowed .TP 8 .B shadowuid= unique identifier for the shadow session .TP 8 .B shadowmode= full access (set to \fI1\fR) or viewing-only (set to \fI0\fR, default) .TP 8 .B defer= defer image updates (enabled for all connection types except LAN), accepts values \fI0\fR, \fI1\fR and \fI2\fR The default value can be set via the command line (\-defer). The value provided as nx/nx option is set when resuming a session, thus it overrides the command line default. Each defer level adds the following rules to the previous ones: .RS 8 .TP 8 .I 0 Eager encoding. .TP 8 .I 1 No data is put or copied on pixmaps, marking them always as corrupted and synchronizing them on demand, i.e. when a copy area to a window is requested, the source is syn- chronized before copying it. .TP 8 .I 2 The put images over the windows are skipped marking the destination as corrupted. The same happens for copy area and composite operations, spreading the corrupted regions of involved drawables. .RE .TP 8 .B tile= set the tile size in pixels (\fIx\fR) for bitmap data sent over the wire The default value can be set via the command line (\-tile). The value provided as nx/nx option is set when resuming a session, thus it overrides the command line default. .TP 8 .B menu= support pulldown menu in \fBnxagent\fR session (only available on proxy <-> agent remote sessions) (default: \fI1\fR, enabled) .TP 8 .B magicpixel= enable/disable magic pixel support in fullscreen mode (default: \fI1\fR, enabled) .TP 8 .B autodpi= enable/disable deriving session DPI automatically from real server (default: \fI0\fR, disabled); only takes effect on session startups, gets ignored when reconnecting to a suspended session .TP 8 .B sleep= delay X server operations when suspended (provided in msec), set to \fI0\fR to keep \fBnxagent\fR session fully functional when suspended (e.g. useful when mirroring an \fBnxagent\fR session via VNC) .TP 8 .B tolerancechecks= .BR strict|safe|risky|bypass .RS 8 .TP 8 .I strict means that the number of internal and external pixmap formats must match exactly and every internal pixmap format must be available in the external pixmap format array. This is the default. .TP 8 .I safe means that the number of pixmap formats might diverge, but all internal pixmap formats must also be included in the external pixmap formats array. This is recommended, because it allows clients with more pixmap formats to still connect, but not lose functionality. .TP 8 .I risky means that the internal pixmap formats array is allowed to be smaller than the external pixmap formats array, but at least one pixmap format must be included in both. This is potentially unsafe. .TP 8 .I bypass means that all of these checks are essentially deactivated. This is a very bad idea. .RE .TP 8 .B autograb= enable or disable autograb (default: \fI0\fR, disabled) .RE If you want to use \fBnxagent\fR as a replacement for Xnest or Xephyr you can pass options like this: .PP .nf $ echo nx/nx,fullscreen=1$DISPLAY >/tmp/opt $ nxagent -options /tmp/opt : .fi .SH XDMCP OPTIONS X servers that support XDMCP have the following options. See the \fIX Display Manager Control Protocol\fP specification for more information. .TP 8 .B \-query \fIhostname\fP enables XDMCP and sends Query packets to the specified .IR hostname . .TP 8 .B \-broadcast enable XDMCP and broadcasts BroadcastQuery packets to the network. The first responding display manager will be chosen for the session. .TP 8 .B \-multicast [\fIaddress\fP [\fIhop count\fP]] Enable XDMCP and multicast BroadcastQuery packets to the network. The first responding display manager is chosen for the session. If an address is specified, the multicast is sent to that address. If no address is specified, the multicast is sent to the default XDMCP IPv6 multicast group. If a hop count is specified, it is used as the maximum hop count for the multicast. If no hop count is specified, the multicast is set to a maximum of 1 hop, to prevent the multicast from being routed beyond the local network. .TP 8 .B \-indirect \fIhostname\fP enables XDMCP and send IndirectQuery packets to the specified .IR hostname . .TP 8 .B \-port \fIport-number\fP uses the specified \fIport-number\fP for XDMCP packets, instead of the default. This option must be specified before any \-query, \-broadcast, \-multicast, or \-indirect options. .TP 8 .B \-from \fIlocal-address\fP specifies the local address to connect from (useful if the connecting host has multiple network interfaces). The \fIlocal-address\fP may be expressed in any form acceptable to the host platform's \fIgethostbyname\fP(3) implementation. .TP 8 .B \-once causes the server to terminate (rather than reset) when the XDMCP session ends. .TP 8 .B \-class \fIdisplay-class\fP XDMCP has an additional display qualifier used in resource lookup for display-specific options. This option sets that value, by default it is "MIT-Unspecified" (not a very useful value). .TP 8 .B \-cookie \fIxdm-auth-bits\fP When testing XDM-AUTHENTICATION-1, a private key is shared between the server and the manager. This option sets the value of that private data (not that it is very private, being on the command line!). .TP 8 .B \-displayID \fIdisplay-id\fP Yet another XDMCP specific value, this one allows the display manager to identify each display so that it can locate the shared key. .SH XKEYBOARD OPTIONS X servers that support the XKEYBOARD (a.k.a. \*qXKB\*q) extension accept the following options. All layout files specified on the command line must be located in the XKB base directory or a subdirectory, and specified as the relative path from the XKB base directory. The default XKB base directory is .IR /usr/share/X11/xkb . .TP 8 .B [+-]kb enables(+) or disables(-) the XKEYBOARD extension. .TP 8 .BR [+-]accessx " [ \fItimeout\fP [ \fItimeout_mask\fP [ \fIfeedback\fP [ \fIoptions_mask\fP ] ] ] ]" enables(+) or disables(-) AccessX key sequences. .TP 8 .B \-xkbdir \fIdirectory\fP base directory for keyboard layout files. This option is not available for setuid X servers (i.e., when the X server's real and effective uids are different). .TP 8 .B \-ardelay \fImilliseconds\fP sets the autorepeat delay (length of time in milliseconds that a key must be depressed before autorepeat starts). .TP 8 .B \-arinterval \fImilliseconds\fP sets the autorepeat interval (length of time in milliseconds that should elapse between autorepeat-generated keystrokes). .TP 8 .B \-xkbmap \fIfilename\fP loads keyboard description in \fIfilename\fP on server startup. .SH SECURITY EXTENSION OPTIONS X servers that support the SECURITY extension accept the following option: .TP 8 .B \-sp \fIfilename\fP causes the server to attempt to read and interpret filename as a security policy file with the format described below. The file is read at server startup and reread at each server reset. .PP The syntax of the security policy file is as follows. Notation: "*" means zero or more occurrences of the preceding element, and "+" means one or more occurrences. To interpret , ignore the text after the /; it is used to distinguish between instances of in the next section. .PP .nf ::= * ::= '\en' ::= | | | ::= # * '\en' ::= '\en' ::= sitepolicy '\en' ::= property '\en' ::= ::= any | root | ::= | ::= = ::= [ | | ]* ::= r | w | d ::= a | i | e ::= | | ::= " * " ::= ' * ' ::= + ::= [ ' ' | '\et' ]* Character sets: ::= any character except '\en' ::= any character except " ::= any character except ' ::= any character except those in .fi .PP The semantics associated with the above syntax are as follows. .PP , the first line in the file, specifies the file format version. If the server does not recognize the version , it ignores the rest of the file. The version string for the file format described here is "version-1" . .PP Once past the , lines that do not match the above syntax are ignored. .PP lines are ignored. .PP lines are currently ignored. They are intended to specify the site policies used by the XC-QUERY-SECURITY-1 authorization method. .PP lines specify how the server should react to untrusted client requests that affect the X Window property named . The rest of this section describes the interpretation of an . .PP For an to apply to a given instance of , must be on a window that is in the set of windows specified by . If is any, the rule applies to on any window. If is root, the rule applies to only on root windows. .PP If is , the following apply. If is a , the rule applies when the window also has that , regardless of its value. If is a , must also have the value specified by . In this case, the property must have type STRING and format 8, and should contain one or more null-terminated strings. If any of the strings match , the rule applies. .PP The definition of string matching is simple case-sensitive string comparison with one elaboration: the occurrence of the character '*' in is a wildcard meaning "any string." A can contain multiple wildcards anywhere in the string. For example, "x*" matches strings that begin with x, "*x" matches strings that end with x, "*x*" matches strings containing x, and "x*y*" matches strings that start with x and subsequently contain y. .PP There may be multiple lines for a given . The rules are tested in the order that they appear in the file. The first rule that applies is used. .PP specify operations that untrusted clients may attempt, and the actions that the server should take in response to those operations. .PP can be r (read), w (write), or d (delete). The following table shows how X Protocol property requests map to these operations in The Open Group server implementation. .PP .nf GetProperty r, or r and d if delete = True ChangeProperty w RotateProperties r and w DeleteProperty d ListProperties none, untrusted clients can always list all properties .fi .PP can be a (allow), i (ignore), or e (error). Allow means execute the request as if it had been issued by a trusted client. Ignore means treat the request as a no-op. In the case of GetProperty, ignore means return an empty property value if the property exists, regardless of its actual value. Error means do not execute the request and return a BadAtom error with the atom set to the property name. Error is the default action for all properties, including those not listed in the security policy file. .PP An applies to all s that follow it, until the next is encountered. Thus, irwad means ignore read and write, allow delete. .PP GetProperty and RotateProperties may do multiple operations (r and d, or r and w). If different actions apply to the operations, the most severe action is applied to the whole request; there is no partial request execution. The severity ordering is: allow < ignore < error. Thus, if the for a property are ired (ignore read, error delete), and an untrusted client attempts GetProperty on that property with delete = True, an error is returned, but the property value is not. Similarly, if any of the properties in a RotateProperties do not allow both read and write, an error is returned without changing any property values. .PP Here is an example security policy file. .PP .ta 3i 4i .nf version-1 # Allow reading of application resources, but not writing. property RESOURCE_MANAGER root ar iw property SCREEN_RESOURCES root ar iw # Ignore attempts to use cut buffers. Giving errors causes apps to crash, # and allowing access may give away too much information. property CUT_BUFFER0 root irw property CUT_BUFFER1 root irw property CUT_BUFFER2 root irw property CUT_BUFFER3 root irw property CUT_BUFFER4 root irw property CUT_BUFFER5 root irw property CUT_BUFFER6 root irw property CUT_BUFFER7 root irw # If you are using Motif, you probably want these. property _MOTIF_DEFAULT_BINDINGS root ar iw property _MOTIF_DRAG_WINDOW root ar iw property _MOTIF_DRAG_TARGETS any ar iw property _MOTIF_DRAG_ATOMS any ar iw property _MOTIF_DRAG_ATOM_PAIRS any ar iw # The next two rules let xwininfo -tree work when untrusted. property WM_NAME any ar # Allow read of WM_CLASS, but only for windows with WM_NAME. # This might be more restrictive than necessary, but demonstrates # the facility, and is also an attempt to # say "top level windows only." property WM_CLASS WM_NAME ar # These next three let xlsclients work untrusted. Think carefully # before including these; giving away the client machine name and command # may be exposing too much. property WM_STATE WM_NAME ar property WM_CLIENT_MACHINE WM_NAME ar property WM_COMMAND WM_NAME ar # To let untrusted clients use the standard colormaps created by # xstdcmap, include these lines. property RGB_DEFAULT_MAP root ar property RGB_BEST_MAP root ar property RGB_RED_MAP root ar property RGB_GREEN_MAP root ar property RGB_BLUE_MAP root ar property RGB_GRAY_MAP root ar # To let untrusted clients use the color management database created # by xcmsdb, include these lines. property XDCCC_LINEAR_RGB_CORRECTION root ar property XDCCC_LINEAR_RGB_MATRICES root ar property XDCCC_GRAY_SCREENWHITEPOINT root ar property XDCCC_GRAY_CORRECTION root ar # To let untrusted clients use the overlay visuals that many vendors # support, include this line. property SERVER_OVERLAY_VISUALS root ar # Dumb examples to show other capabilities. # oddball property names and explicit specification of error conditions property "property with spaces" 'property with "' aw er ed # Allow deletion of Woo-Hoo if window also has property OhBoy with value # ending in "son". Reads and writes will cause an error. property Woo-Hoo OhBoy = "*son" ad .fi .SH "NETWORK CONNECTIONS" The X server supports client connections via a platform-dependent subset of the following transport types: TCP\/IP, Unix Domain sockets and several varieties of SVR4 local connections. See the DISPLAY NAMES section of the \fIX\fP(__miscmansuffix__) manual page to learn how to specify which transport type clients should try to use. .SH GRANTING ACCESS The X server implements a platform-dependent subset of the following authorization protocols: MIT-MAGIC-COOKIE-1, XDM-AUTHORIZATION-1, XDM-AUTHORIZATION-2, SUN-DES-1, and MIT-KERBEROS-5. See the \fIXsecurity\fP(__miscmansuffix__) manual page for information on the operation of these protocols. .PP Authorization data required by the above protocols is passed to the server in a private file named with the \fB\-auth\fR command line option. Each time the server is about to accept the first connection after a reset (or when the server is starting), it reads this file. If this file contains any authorization records, the local host is not automatically allowed access to the server, and only clients which send one of the authorization records contained in the file in the connection setup information will be allowed access. See the \fIXau\fP manual page for a description of the binary format of this file. See \fIxauth\fP(1) for maintenance of this file, and distribution of its contents to remote hosts. .PP The X server also uses a host-based access control list for deciding whether or not to accept connections from clients on a particular machine. If no other authorization mechanism is being used, this list initially consists of the host on which the server is running as well as any machines listed in the file \fI/etc/X\fBn\fI.hosts\fR, where \fBn\fP is the display number of the server. Each line of the file should contain either an Internet hostname (e.g. expo.lcs.mit.edu) or a complete name in the format \fIfamily\fP:\fIname\fP as described in the \fIxhost\fP(1) manual page. There should be no leading or trailing spaces on any lines. For example: .sp .in +8 .nf joesworkstation corporate.company.com star:: inet:bigcpu local: .fi .in -8 .PP Users can add or remove hosts from this list and enable or disable access control using the \fIxhost\fP command from the same machine as the server. .PP If the X FireWall Proxy (\fIxfwp\fP) is being used without a sitepolicy, host-based authorization must be turned on for clients to be able to connect to the X server via the \fIxfwp\fP. If \fIxfwp\fP is run without a configuration file and thus no sitepolicy is defined, if \fIxfwp\fP is using an X server where xhost + has been run to turn off host-based authorization checks, when a client tries to connect to this X server via \fIxfwp\fP, the X server will deny the connection. See \fIxfwp\fP(1) for more information about this proxy. .PP The X protocol intrinsically does not have any notion of window operation permissions or place any restrictions on what a client can do; if a program can connect to a display, it has full run of the screen. X servers that support the SECURITY extension fare better because clients can be designated untrusted via the authorization they use to connect; see the \fIxauth\fP(1) manual page for details. Restrictions are imposed on untrusted clients that curtail the mischief they can do. See the SECURITY extension specification for a complete list of these restrictions. .PP Sites that have better authentication and authorization systems might wish to make use of the hooks in the libraries and the server to provide additional security models. .SH SIGNALS The X server attaches special meaning to the following signals: .TP 8 .I SIGHUP This signal causes the server to close all existing connections, free all resources, and restore all defaults. It is sent by the display manager whenever the main user's main application (usually an \fIxterm\fP or window manager) exits to force the server to clean up and prepare for the next user. .TP 8 .I SIGTERM This signal causes the server to exit cleanly. .TP 8 .I SIGUSR1 This signal is used quite differently from either of the above. When the server starts, it checks to see if it has inherited SIGUSR1 as SIG_IGN instead of the usual SIG_DFL. In this case, the server sends a SIGUSR1 to its parent process after it has set up the various connection schemes. \fIXdm\fP uses this feature to recognize when connecting to the server is possible. .SH FONTS The X server can obtain fonts from directories and/or from font servers. The list of directories and font servers the X server uses when trying to open a font is controlled by the \fIfont path\fP. .LP The default font path is __default_font_path__ . .LP The font path can be set with the \fB\-fp\fR option or by \fIxset\fP(1) after the server has started. .SH FILES .TP 30 .I /etc/X\fBn\fP.hosts Initial access control list for display number \fBn\fP .TP 30 .IR /usr/share/fonts/X11/misc, /usr/share/fonts/X11/75dpi, /usr/share/fonts/X11/100dpi Bitmap font directories .TP 30 .IR /usr/share/fonts/X11/Type1 Outline font directories .TP 30 .I /usr/share/nx/rgb Color database .TP 30 .I /tmp/.X11-unix/X\fBn\fP Unix domain socket for display number \fBn\fP .TP 30 .IR /tmp/rcX\fBn\fP Kerberos 5 replay cache for display number \fBn\fP .SH "SEE ALSO" Protocols: .I "X Window System Protocol," .I "NX Compression Protocol," .I "The X Font Service Protocol," .I "X Display Manager Control Protocol" .PP Fonts: \fIbdftopcf\fP(1), \fImkfontdir\fP(1), \fImkfontscale\fP(1), \fIxfs\fP(1), \fIxlsfonts\fP(1), \fIxfontsel\fP(1), \fIxfd\fP(1), .I "X Logical Font Description Conventions" .PP Security: \fIXsecurity\fP(__miscmansuffix__), \fIxauth\fP(1), \fIXau\fP(1), \fIxdm\fP(1), \fIxhost\fP(1), \fIxfwp\fP(1), .I "Security Extension Specification" .PP Starting the server: \fIxdm\fP(1), \fIxinit\fP(1) .PP Controlling the server once started: \fIxset\fP(1), \fIxsetroot\fP(1), \fIxhost\fP(1) .PP Server-specific man pages: \fIXdec\fP(1), \fIXmacII\fP(1), \fIXsun\fP(1), \fIXnest\fP(1), \fIXvfb\fP(1), \fIXFree86\fP(1), \fIXDarwin\fP(1). .PP Server internal documentation: .I "Definition of the Porting Layer for the X v11 Sample Server" .SH AUTHORS The first sample X server was originally written by Susan Angebranndt, Raymond Drewry, Philip Karlton, and Todd Newman, from Digital Equipment Corporation, with support from a large cast. It has since been extensively rewritten by Keith Packard and Bob Scheifler, from MIT. Dave Wiggins took over post-R5 and made substantial improvements. .PP The first implementation of nx-X11 (version 1.x up to 3.5.x) was written by NoMachine (maintained until 2011). .PP The current implementation of nx-X11 is maintained by various projects, amongst others The Arctica Project, TheQVD (Qindel Group) and X2Go. .PP This manual page was written by Per Hansen , and modified by Marcelo Boveto Shima and Mike Gabriel . In 2016, the original Xserver.man page shipped with nx-X11 was merged into the \fBnxagent\fR man page and received a major update by Mike Gabriel . nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Millis.c0000644000000000000000000000454613614532331020263 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include #include "Xos.h" #include "Millis.h" const char *GetTimeAsString() { char *value; struct timeval ts; X_GETTIMEOFDAY(&ts); value = ctime((time_t *) &ts.tv_sec); *(value + strlen(value) - 1) = '\0'; return value; } const char *GetTimeInMillisAsString() { char *value; char tb[25]; struct timeval ts; X_GETTIMEOFDAY(&ts); value = ctime((time_t *) &ts.tv_sec); sprintf(tb, "%.8s:%3.3f", value + 11, (float) ts.tv_usec / 1000); strncpy(value, tb, 24); return value; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Millis.h0000644000000000000000000000374113614532331020264 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Millis_H__ #define __Millis_H__ #include "Xmd.h" const char *GetTimeInMillisAsString(void); const char *GetTimeAsString(void); #endif /* __Millis_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/nxagent.xpm0000644000000000000000000004126313614532331021055 0ustar /* XPM */ static char * nxagentIconData[] = { "128 128 8 1", " c None", ". c #000200", "+ c #313330", "@ c #535552", "# c #757774", "$ c #9D9F9C", "% c #C4C7C3", "& c #FDFFFC", " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", " ++++++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&++++++ ", " ++++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++++ ", "++++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++++", "++++&&&############################%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%##########&&&++++", "+++&&&&#...........................+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+.........#&&&&+++", "+++&&&&&@...........................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.........@&&&&&+++", "+++&&&&&%+...........................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$.........+&&&&&&+++", "++&&&&&&&$............................%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$.........+%&&&&&&+++", "++&&&&&&&&#...........................+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+.........$&&&&&&&+++", "++&&&&&&&&&@...........................#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.........#&&&&&&&&+++", "++&&&&&&&&&%+...........................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#.........@&&&&&&&&&+++", "++&&&&&&&&&&$...........................+%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$.........+%&&&&&&&&&+++", "++&&&&&&&&&&&@...........................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%..........%&&&&&&&&&&+++", "++&&&&+&&&&&&&+...........................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+.........$&&&&&&&&&&&+++", "++&&&&&&&&&&&&%............................%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+.........@&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&$...........................+%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#.........@&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&#...........................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$.........+%&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&+...........................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%..........%&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&%............................%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+.........$&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&$...........................+%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.........#&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&#...........................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$.........@%&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&%@...........................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$.........+%&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&%...........................+%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+.........$&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&$...........................@%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+.........#&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&@...........................#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#.........@&&&&&&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&&&&&%+...........................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$.........+&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&%...........................+%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$..........%&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&#...........................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+.........$&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&@...........................#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+.........$&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&+...........................%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.........#&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&%............................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#.........+%&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&&&&&&&&&&$...........................+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$+........+%&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&@...........................#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+.........$&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&%+...........................%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.........#&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&$...........................+%&&&&&&&&&&&&&&&&&&&&&&&&&&&#.........@&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&#...........................#&&&&&&&&&&&&&&&&&&&&&&&&&&$.........+%&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@...........................$&&&&&&&&&&&&&&&&&&&&&&&&%..........%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&&&&&&&&&&&&&&%+..........................+%&&&&&&&&&&&&&&&&&&&&&&&+.........$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$...........................+&&&&&&&&&&&&&&&&&&&&&&@.........#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#...........................#&&&&&&&&&&&&&&&&&&&&#.........@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+...........................%&&&&&&&&&&&&&&&&&&$..........%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&............................&&&&&&&&&&&&&&&&&%..........%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%...........................+&&&&&&&&&&&&&&&&+.........$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#...........................#&&&&&&&&&&&&&&@.........#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+...........................%&&&&&&&&&&&&#.........@%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+...........................&&&&&&&&&&&$+........+%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$...........................@&&&&&&&&&%+.........$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#...........................#&&&&&&&&+.........#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+..........................+$&&&&&&#.........@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+..........................+%&&&&$.........+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#...........................#&&&%..........%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@..........................+%&&..........%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+.........................$&&+.........#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%........................#&&#.........@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$......................@&&$.........+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@....................+&&$+.........%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+...................%&%+.........$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%..................$&&@.........#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$................$&&#.........@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@..............@&&$..........+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+............+&&&............#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$............%&&+.............$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@..........%&&@..............+%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+.........#&&$................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+.........@&&$..................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.........+%&%+...................%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#.........+%&%+.....................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%..........$&&#......................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&..........#&&#........................#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+.........+&&%..........................%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@..........&&%+..........................+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$..........%&&%............................@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%..........$&&&&$............................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+.........#&&&&&&@...........................+$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.........@&&&&&&&%+...........................+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#.........+%&&&&&&&&%............................#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$..........%&&&&&&&&&&#............................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+.........$&&&&&&&&&&&&@............................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+.........#&&&&&&&&&&&&&&............................+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.........+&&&&&&&&&&&&&&&%............................#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$.........+%&&&&&&&&&&&&&&&&$............................%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%..........%&&&&&&&&&&&&&&&&&&@............................%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&..........#&&&&&&&&&&&&&&&&&&&%+...........................+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+.........@&&&&&&&&&&&&&&&&&&&&&%............................#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.........@&&&&&&&&&&&&&&&&&&&&&&&#............................$&&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&&&&&&&&&&&&&&&$.........+%&&&&&&&&&&&&&&&&&&&&&&&&@...........................+%&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%..........%&&&&&&&&&&&&&&&&&&&&&&&&&%+...........................@&&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+.........$&&&&&&&&&&&&&&&&&&&&&&&&&&&$............................$&&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&&@.........@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#............................%&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&&#.........@%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+...........................+&&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&&$.........+%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&............................#&&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&&&&&&&&&&%+.........$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$............................$&&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&&+.........#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#............................%&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&&#.........@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@...........................+&&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&&$.........+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+...........................@&&&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&&$..........%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$............................$&&&&&&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&&&&&&%+.........%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#...........................+%&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&&+.........$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@...........................+&&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&&@.........@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+...........................#&&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&&$.........+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$............................$&&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&&$+........+%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#...........................+%&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&%@.........$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+...........................@&&&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&&&@.........#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+...........................$&&&&&&&&&&&&&&&+++", "++&&&&+&&&&&&&&&&&$.........@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$............................%&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&&$.........+%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#...........................+&&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&%+.........%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+...........................@&&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&&+.........$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&............................#&&&&&&&&&&&&+++", "++&&&&&&&&&&&&&@.........#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%............................%&&&&&&&&&&&+++", "++&&&&&&&&&&&&#.........@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#...........................+&&&&&&&&&&&+++", "++&&&&+&&&&&&%.........+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+...........................@&&&&&&&&&&+++", "++&&&&&&&&&&%+.........%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+...........................$&&&&&&&&&+++", "++&&&&&&&&&&@.........$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$............................%&&&&&&&&+++", "++&&&&&&&&&#.........#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#...........................+&&&&&&&&+++", "++&&&&&&&&$.........@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%+...........................#&&&&&&&+++", "++&&&&&&&%+........+%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%............................$&&&&&&+++", "++&&&&&&&+.........%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$...........................+%&&&&&+++", "+++&&&&&@.........$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@...........................@&&&&&+++", "+++&&&&#.........@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+...........................#&&&&+++", "+++&&&&##########&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%############################&&&++++", "++++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&++++", "+++++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&++++ ", " +++++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&++++++ ", " +++++++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&++++++++ ", " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ", " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "}; nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c0000644000000000000000000010264713614532331021100 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /************************************************************ Copyright 1987, 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* The panoramix components contained the following notice */ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #ifdef __sun #define False 0 #define True 1 #endif #include #define GC XlibGC #include #undef GC #include "../../dix/dispatch.c" #include "windowstr.h" #include "Atoms.h" #include "Splash.h" #include "Client.h" #include "Clipboard.h" #include "Reconnect.h" #include "Millis.h" #include "Font.h" #include #include "Handlers.h" #include "Keyboard.h" const int nxagentMaxFontNames = 10000; /* * This allows the agent to exit if no * client is connected within a timeout. */ int nxagentClients = 0; void nxagentWaitDisplay(void); void nxagentListRemoteFonts(const char *, int); /* * Timeouts based on screen saver time. */ int nxagentAutoDisconnectTimeout = 0; #include "Xatom.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef WATCH /* * Log begin and end of the important handlers. */ #undef BLOCKS #ifdef WATCH #include "unistd.h" #endif #ifdef TEST #include "Literals.h" #endif #ifdef VIEWPORT_FRAME extern WindowPtr nxagentViewportFrameLeft; extern WindowPtr nxagentViewportFrameRight; extern WindowPtr nxagentViewportFrameAbove; extern WindowPtr nxagentViewportFrameBelow; #define IsViewportFrame(pWin) ((pWin) == nxagentViewportFrameLeft || \ (pWin) == nxagentViewportFrameRight || \ (pWin) == nxagentViewportFrameAbove || \ (pWin) == nxagentViewportFrameBelow) #else #define IsViewportFrame(pWin) (0) #endif /* #ifdef VIEWPORT_FRAME */ extern int nxagentMaxAllowedResets; extern int nxagentFindClientResource(int, RESTYPE, void *); #ifdef NXAGENT_CLIPBOARD extern int nxagentPrimarySelection; extern int nxagentClipboardSelection; extern int nxagentMaxSelections; #endif extern int nxOpenFont(ClientPtr, XID, Mask, unsigned, char*); /* * This used to be a dix variable used only by XPRINT, so xorg dropped it. */ ClientPtr nxagentRequestingClient; void InitSelections(void) { xorg_InitSelections(); #ifdef NXAGENT_CLIPBOARD { Selection *newsels; newsels = (Selection *)malloc(nxagentMaxSelections * sizeof(Selection)); if (!newsels) return; NumCurrentSelections += nxagentMaxSelections; CurrentSelections = newsels; CurrentSelections[nxagentPrimarySelection].selection = XA_PRIMARY; CurrentSelections[nxagentPrimarySelection].lastTimeChanged = ClientTimeToServerTime(0); CurrentSelections[nxagentPrimarySelection].window = screenInfo.screens[0]->root->drawable.id; CurrentSelections[nxagentPrimarySelection].pWin = NULL; CurrentSelections[nxagentPrimarySelection].client = NullClient; CurrentSelections[nxagentClipboardSelection].selection = MakeAtom("CLIPBOARD", 9, 1); CurrentSelections[nxagentClipboardSelection].lastTimeChanged = ClientTimeToServerTime(0); CurrentSelections[nxagentClipboardSelection].window = screenInfo.screens[0]->root->drawable.id; CurrentSelections[nxagentClipboardSelection].pWin = NULL; CurrentSelections[nxagentClipboardSelection].client = NullClient; } #endif } #define MAJOROP ((xReq *)client->requestBuffer)->reqType void Dispatch(void) { register int *clientReady; /* array of request ready clients */ register int result; register ClientPtr client; register int nready; register HWEventQueuePtr* icheck = checkForInput; long start_tick; nextFreeClientID = 1; InitSelections(); nClients = 0; #ifdef NXAGENT_SERVER /* * The agent initialization was successfully * completed. We can now handle our clients. */ #ifdef XKB nxagentInitXkbWrapper(); nxagentTuneXkbWrapper(); #endif #ifdef NXAGENT_ONSTART /* * Set NX_WM property (used by NX client to identify the agent's * window) three seconds since the first client connects. */ unsigned int nxagentWMtimeout = GetTimeInMillis() + 3000; #endif #endif /* NXAGENT_SERVER */ clientReady = (int *) malloc(sizeof(int) * MaxClients); if (!clientReady) return; #ifdef NXAGENT_SERVER #ifdef WATCH fprintf(stderr, "Dispatch: Watchpoint 12.\n"); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio ------- ----- ------ ------- -------- ---------- ----- #3 1 352 bits (0 KB) -> 236 bits (0 KB) -> 352/1 -> 236/1 = 1.492:1 #14 1 256 bits (0 KB) -> 101 bits (0 KB) -> 256/1 -> 101/1 = 2.535:1 #16 1 256 bits (0 KB) -> 26 bits (0 KB) -> 256/1 -> 26/1 = 9.846:1 #20 2 2 12256 bits (1 KB) -> 56 bits (0 KB) -> 6128/1 -> 28/1 = 218.857:1 #43 1 256 bits (0 KB) -> 45 bits (0 KB) -> 256/1 -> 45/1 = 5.689:1 #47 2 2 42304 bits (5 KB) -> 49 bits (0 KB) -> 21152/1 -> 24/1 = 863.347:1 #98 1 256 bits (0 KB) -> 34 bits (0 KB) -> 256/1 -> 34/1 = 7.529:1 */ sleep(30); #endif #ifdef TEST fprintf(stderr, "Dispatch: Value of dispatchException is [%x].\n", dispatchException); fprintf(stderr, "Dispatch: Value of dispatchExceptionAtReset is [%x].\n", dispatchExceptionAtReset); #endif if (!(dispatchException & DE_TERMINATE)) dispatchException = 0; #endif /* NXAGENT_SERVER */ while (!dispatchException) { if (*icheck[0] != *icheck[1]) { ProcessInputEvents(); FlushIfCriticalOutputPending(); } #ifdef NXAGENT_SERVER /* * Ensure we remove the splash after the timeout. * Initializing clientReady[0] to -1 will tell * WaitForSomething() to yield control after the * timeout set in clientReady[1]. */ clientReady[0] = 0; if (nxagentSplashWindow != None || (nxagentOption(Xdmcp) == 1 && nxagentXdmcpUp == 0)) { #ifdef TEST fprintf(stderr, "******Dispatch: Requesting a timeout of [%d] Ms.\n", NXAGENT_WAKEUP); #endif clientReady[0] = -1; clientReady[1] = NXAGENT_WAKEUP; } if (serverGeneration > nxagentMaxAllowedResets && nxagentSessionState == SESSION_STARTING && (nxagentOption(Xdmcp) == 0 || nxagentXdmcpUp == 1)) { #ifdef NX_DEBUG_INPUT fprintf(stderr, "Session: Session started at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis()); #else fprintf(stderr, "Session: Session started at '%s'.\n", GetTimeAsString()); #endif nxagentSessionState = SESSION_UP; saveAgentState("RUNNING"); } #ifdef BLOCKS fprintf(stderr, "[End dispatch]\n"); #endif #endif /* NXAGENT_SERVER */ nready = WaitForSomething(clientReady); #ifdef NXAGENT_SERVER #ifdef BLOCKS fprintf(stderr, "[Begin dispatch]\n"); #endif #ifdef TEST fprintf(stderr, "******Dispatch: Running with [%d] clients ready.\n", nready); #endif #ifdef NXAGENT_ONSTART /* * If the timeout is expired set the selection informing the * NX client that the agent is ready. */ if (nxagentWMtimeout < GetTimeInMillis()) { nxagentRemoveSplashWindow(); } nxagentClients = nClients; #endif #endif /* NXAGENT_SERVER */ if (nready) { clientReady[0] = SmartScheduleClient (clientReady, nready); nready = 1; } /***************** * Handle events in round robin fashion, doing input between * each round *****************/ while (!dispatchException && (--nready >= 0)) { client = clients[clientReady[nready]]; if (! client) { /* KillClient can cause this to happen */ continue; } /* GrabServer activation can cause this to be true */ if (grabState == GrabKickout) { grabState = GrabActive; break; } isItTimeToYield = FALSE; #ifdef NXAGENT_SERVER nxagentRequestingClient = client; #endif start_tick = SmartScheduleTime; while (!isItTimeToYield) { if (*icheck[0] != *icheck[1]) { ProcessInputEvents(); FlushIfCriticalOutputPending(); } if ((SmartScheduleTime - start_tick) >= SmartScheduleSlice) { /* Penalize clients which consume ticks */ if (client->smart_priority > SMART_MIN_PRIORITY) client->smart_priority--; break; } /* now, finally, deal with client requests */ /* Update currentTime so request time checks, such as for input * device grabs, are calculated correctly */ UpdateCurrentTimeIf(); #ifdef NXAGENT_SERVER #ifdef TEST fprintf(stderr, "******Dispatch: Reading request from client [%d].\n", client->index); #endif #endif /* NXAGENT_SERVER */ result = ReadRequestFromClient(client); if (result <= 0) { if (result < 0) CloseDownClient(client); break; } #ifdef NXAGENT_SERVER #ifdef TEST else { if (MAJOROP > 127) { fprintf(stderr, "******Dispatch: Read [Extension] request OPCODE#%d MINOR#%d " "size [%d] client [%d].\n", MAJOROP, *((char *) client->requestBuffer + 1), client->req_len << 2, client->index); } else { fprintf(stderr, "******Dispatch: Read [%s] request OPCODE#%d size [%d] client [%d].\n", nxagentRequestLiteral[MAJOROP], MAJOROP, client->req_len << 2, client->index); } } #endif #endif client->sequence++; if (result > (maxBigRequestSize << 2)) result = BadLength; else { result = (* client->requestVector[MAJOROP])(client); #ifdef NXAGENT_SERVER #ifdef TEST if (MAJOROP > 127) { fprintf(stderr, "******Dispatch: Handled [Extension] request OPCODE#%d MINOR#%d " "size [%d] client [%d] result [%d].\n", MAJOROP, *((char *) client->requestBuffer + 1), client->req_len << 2, client->index, result); } else { fprintf(stderr, "******Dispatch: Handled [%s] request OPCODE#%d size [%d] client [%d] " "result [%d].\n", nxagentRequestLiteral[MAJOROP], MAJOROP, client->req_len << 2, client->index, result); } #endif /* * Can set isItTimeToYield to force * the dispatcher to pay attention * to another client. */ nxagentDispatchHandler(client, client->req_len << 2, 0); #endif } if (!SmartScheduleSignalEnable) SmartScheduleTime = GetTimeInMillis(); if (result != Success) { if (client->noClientException != Success) CloseDownClient(client); else SendErrorToClient(client, MAJOROP, MinorOpcodeOfRequest(client), client->errorValue, result); break; } #ifdef DAMAGEEXT FlushIfCriticalOutputPending (); #endif } FlushAllOutput(); client = clients[clientReady[nready]]; if (client) client->smart_stop_tick = SmartScheduleTime; #ifdef NXAGENT_SERVER nxagentRequestingClient = NULL; #endif } dispatchException &= ~DE_PRIORITYCHANGE; } #if defined(DDXBEFORERESET) ddxBeforeReset (); #endif #ifdef NXAGENT_SERVER /* FIXME: maybe move the code up to the KillAllClients() call to ddxBeforeReset? */ if ((dispatchException & DE_RESET) && (serverGeneration > nxagentMaxAllowedResets)) { dispatchException &= ~DE_RESET; dispatchException |= DE_TERMINATE; fprintf(stderr, "Info: Reached threshold of maximum allowed resets.\n"); } nxagentResetAtomMap(); if (serverGeneration > nxagentMaxAllowedResets) { /* * The session is terminating. Force an I/O * error on the display and wait until the * NX transport is gone. */ fprintf(stderr, "Session: Terminating session at '%s'.\n", GetTimeAsString()); saveAgentState("TERMINATING"); nxagentWaitDisplay(); fprintf(stderr, "Session: Session terminated at '%s'.\n", GetTimeAsString()); } if (nxagentOption(Shadow) == 1) { NXShadowDestroy(); } saveAgentState("TERMINATED"); #endif /* NXAGENT_SERVER */ KillAllClients(); free(clientReady); dispatchException &= ~DE_RESET; } #undef MAJOROP int ProcReparentWindow(register ClientPtr client) { register WindowPtr pWin, pParent; REQUEST(xReparentWindowReq); register int result; REQUEST_SIZE_MATCH(xReparentWindowReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixWriteAccess); if (!pWin) return(BadWindow); #ifdef NXAGENT_SERVER nxagentRemoveSplashWindow(); #endif pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, DixWriteAccess); if (!pParent) return(BadWindow); if (SAME_SCREENS(pWin->drawable, pParent->drawable)) { if ((pWin->backgroundState == ParentRelative) && (pParent->drawable.depth != pWin->drawable.depth)) return BadMatch; if ((pWin->drawable.class != InputOnly) && (pParent->drawable.class == InputOnly)) return BadMatch; result = ReparentWindow(pWin, pParent, (short)stuff->x, (short)stuff->y, client); if (client->noClientException != Success) return(client->noClientException); else return(result); } else return (BadMatch); } int ProcQueryTree(register ClientPtr client) { xQueryTreeReply reply = {0}; int numChildren = 0; register WindowPtr pChild, pWin, pHead; Window *childIDs = (Window *)NULL; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, DixReadAccess); if (!pWin) return(BadWindow); reply.type = X_Reply; reply.root = pWin->drawable.pScreen->root->drawable.id; reply.sequenceNumber = client->sequence; if (pWin->parent) reply.parent = pWin->parent->drawable.id; else reply.parent = (Window)None; pHead = RealChildHead(pWin); for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) #ifdef NXAGENT_SERVER { if (!IsViewportFrame(pChild)) { numChildren++; } } #else numChildren++; #endif if (numChildren) { int curChild = 0; childIDs = (Window *) malloc(numChildren * sizeof(Window)); if (!childIDs) return BadAlloc; for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) #ifdef NXAGENT_SERVER { if (!IsViewportFrame(pChild)) { childIDs[curChild++] = pChild->drawable.id; } } #else childIDs[curChild++] = pChild->drawable.id; #endif } reply.nChildren = numChildren; reply.length = (numChildren * sizeof(Window)) >> 2; WriteReplyToClient(client, sizeof(xQueryTreeReply), &reply); if (numChildren) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs); free(childIDs); } return(client->noClientException); } int ProcConvertSelection(register ClientPtr client) { Bool paramsOkay; xEvent event; WindowPtr pWin; REQUEST(xConvertSelectionReq); REQUEST_SIZE_MATCH(xConvertSelectionReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->requestor, client, DixReadAccess); if (!pWin) return(BadWindow); #ifdef NXAGENT_CLIPBOARD if (((stuff->selection == XA_PRIMARY) || (stuff->selection == MakeAtom("CLIPBOARD", 9, 0))) && nxagentOption(Clipboard) != ClipboardNone) { int i = nxagentFindCurrentSelectionIndex(stuff->selection); if ((i < NumCurrentSelections) && (CurrentSelections[i].window != None)) { if (nxagentConvertSelection(client, pWin, stuff->selection, stuff->requestor, stuff->property, stuff->target, stuff->time)) { return (client->noClientException); } } } #endif paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target)); if (stuff->property != None) paramsOkay &= ValidAtom(stuff->property); if (paramsOkay) { int i; i = 0; while ((i < NumCurrentSelections) && CurrentSelections[i].selection != stuff->selection) i++; if ((i < NumCurrentSelections) && #ifdef NXAGENT_SERVER (CurrentSelections[i].window != None) && (CurrentSelections[i].client != NullClient) #else (CurrentSelections[i].window != None)) #endif #ifdef XCSECURITY && (!client->CheckAccess || (* client->CheckAccess)(client, CurrentSelections[i].window, RT_WINDOW, DixReadAccess, CurrentSelections[i].pWin)) #endif ) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = SelectionRequest; event.u.selectionRequest.time = stuff->time; event.u.selectionRequest.owner = CurrentSelections[i].window; event.u.selectionRequest.requestor = stuff->requestor; event.u.selectionRequest.selection = stuff->selection; event.u.selectionRequest.target = stuff->target; event.u.selectionRequest.property = stuff->property; if (TryClientEvents( CurrentSelections[i].client, &event, 1, NoEventMask, NoEventMask /* CantBeFiltered */, NullGrab)) return (client->noClientException); } memset(&event, 0, sizeof(xEvent)); event.u.u.type = SelectionNotify; event.u.selectionNotify.time = stuff->time; event.u.selectionNotify.requestor = stuff->requestor; event.u.selectionNotify.selection = stuff->selection; event.u.selectionNotify.target = stuff->target; event.u.selectionNotify.property = None; (void) TryClientEvents(client, &event, 1, NoEventMask, NoEventMask /* CantBeFiltered */, NullGrab); return (client->noClientException); } else { client->errorValue = stuff->property; return (BadAtom); } } int ProcOpenFont(register ClientPtr client) { int err; REQUEST(xOpenFontReq); REQUEST_FIXED_SIZE(xOpenFontReq, stuff->nbytes); client->errorValue = stuff->fid; LEGAL_NEW_RESOURCE(stuff->fid, client); #ifdef NXAGENT_SERVER char fontReq[256]; memcpy(fontReq,(char *)&stuff[1],(stuff->nbytes<256)?stuff->nbytes:255); fontReq[stuff->nbytes]=0; if (strchr(fontReq,'*') || strchr(fontReq,'?')) { #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "Dispatch: ProcOpenFont try to find a common font with font pattern=%s\n",fontReq); #endif nxagentListRemoteFonts(fontReq, nxagentMaxFontNames); err = nxOpenFont(client, stuff->fid, (Mask) 0, stuff->nbytes, (char *)&stuff[1]); } else #endif err = OpenFont(client, stuff->fid, (Mask) 0, stuff->nbytes, (char *)&stuff[1]); if (err == Success) { return(client->noClientException); } else return err; } int ProcCloseFont(register ClientPtr client) { FontPtr pFont; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, DixDestroyAccess); if ( pFont != (FontPtr)NULL) /* id was valid */ { #ifdef NXAGENT_SERVER /* * When a client closes a font the resource * should not be lost if the reference counter * is not 0, otherwise the server will not be * able to find this font looping through the * resources. */ if (pFont -> refcnt > 0) { if (nxagentFindClientResource(serverClient -> index, RT_NX_FONT, pFont) == 0) { #ifdef TEST fprintf(stderr, "ProcCloseFont: Switching resource for font at [%p].\n", (void *) pFont); #endif nxagentFontPriv(pFont) -> mirrorID = FakeClientID(serverClient -> index); AddResource(nxagentFontPriv(pFont) -> mirrorID, RT_NX_FONT, pFont); } #ifdef TEST else { fprintf(stderr, "ProcCloseFont: Found duplicated font at [%p], " "resource switching skipped.\n", (void *) pFont); } #endif } #endif FreeResource(stuff->id, RT_NONE); return(client->noClientException); } else { client->errorValue = stuff->id; return (BadFont); } } int ProcListFonts(register ClientPtr client) { REQUEST(xListFontsReq); REQUEST_FIXED_SIZE(xListFontsReq, stuff->nbytes); #ifdef NXAGENT_SERVER char tmp[256]; memcpy(tmp,(unsigned char *) &stuff[1],(stuff->nbytes<256)?stuff->nbytes:255); tmp[stuff->nbytes]=0; #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "Dispatch: ListFont request with pattern %s max_names=%d\n",tmp,stuff->maxNames); #endif nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames : stuff->maxNames); #endif return ListFonts(client, (unsigned char *) &stuff[1], stuff->nbytes, stuff->maxNames); } int ProcListFontsWithInfo(register ClientPtr client) { REQUEST(xListFontsWithInfoReq); REQUEST_FIXED_SIZE(xListFontsWithInfoReq, stuff->nbytes); #ifdef NXAGENT_SERVER char tmp[256]; memcpy(tmp,(unsigned char *) &stuff[1],(stuff->nbytes<256)?stuff->nbytes:255); tmp[stuff->nbytes]=0; #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "Dispatch: ListFont with info request with pattern %s max_names=%d\n",tmp,stuff->maxNames); #endif nxagentListRemoteFonts(tmp, stuff -> maxNames < nxagentMaxFontNames ? nxagentMaxFontNames :stuff->maxNames); #endif return StartListFontsWithInfo(client, stuff->nbytes, (unsigned char *) &stuff[1], stuff->maxNames); } int ProcFreePixmap(register ClientPtr client) { PixmapPtr pMap; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pMap = (PixmapPtr)SecurityLookupIDByType(client, stuff->id, RT_PIXMAP, DixDestroyAccess); if (pMap) { #ifdef NXAGENT_SERVER /* * When a client releases a pixmap the resource * should not be lost if the reference counter * is not 0, otherwise the server will not be * able to find this pixmap looping through the * resources. */ if (pMap -> refcnt > 0) { if (nxagentFindClientResource(serverClient -> index, RT_NX_PIXMAP, pMap) == 0) { #ifdef TEST fprintf(stderr, "ProcFreePixmap: Switching resource for pixmap at [%p].\n", (void *) pMap); #endif nxagentPixmapPriv(pMap) -> mid = FakeClientID(serverClient -> index); AddResource(nxagentPixmapPriv(pMap) -> mid, RT_NX_PIXMAP, pMap); } #ifdef TEST else { fprintf(stderr, "ProcFreePixmap: Found duplicated pixmap at [%p], " "resource switching skipped.\n", (void *) pMap); } #endif } #endif FreeResource(stuff->id, RT_NONE); return(client->noClientException); } else { client->errorValue = stuff->id; return (BadPixmap); } } int ProcSetScreenSaver (register ClientPtr client) { int blankingOption, exposureOption; REQUEST(xSetScreenSaverReq); REQUEST_SIZE_MATCH(xSetScreenSaverReq); blankingOption = stuff->preferBlank; if ((blankingOption != DontPreferBlanking) && (blankingOption != PreferBlanking) && (blankingOption != DefaultBlanking)) { client->errorValue = blankingOption; return BadValue; } exposureOption = stuff->allowExpose; if ((exposureOption != DontAllowExposures) && (exposureOption != AllowExposures) && (exposureOption != DefaultExposures)) { client->errorValue = exposureOption; return BadValue; } if (stuff->timeout < -1) { client->errorValue = stuff->timeout; return BadValue; } if (stuff->interval < -1) { client->errorValue = stuff->interval; return BadValue; } #ifdef NXAGENT_SERVER /* * The NX agent uses the screen saver procedure * to monitor the user activities and launch its * handlers (like timeout feature), so we can't * always allow the clients to change our values. */ #ifdef TEST fprintf(stderr, "ProcSetScreenSaver: Called with timeout [%d] interval [%d] Blanking [%d] Exposure [%d].\n", stuff -> timeout, stuff -> interval, blankingOption, exposureOption); #endif if (nxagentOption(Timeout) == 0) { #endif if (blankingOption == DefaultBlanking) { ScreenSaverBlanking = defaultScreenSaverBlanking; } else { ScreenSaverBlanking = blankingOption; } if (exposureOption == DefaultExposures) { ScreenSaverAllowExposures = defaultScreenSaverAllowExposures; } else { ScreenSaverAllowExposures = exposureOption; } if (stuff->timeout >= 0) { ScreenSaverTime = stuff->timeout * MILLI_PER_SECOND; } else { ScreenSaverTime = defaultScreenSaverTime; } if (stuff->interval >= 0) { ScreenSaverInterval = stuff->interval * MILLI_PER_SECOND; } else { ScreenSaverInterval = defaultScreenSaverInterval; } SetScreenSaverTimer(); #ifdef NXAGENT_SERVER } #ifdef TEST else { fprintf(stderr, "ProcSetScreenSaver: Keeping auto-disconnect timeout set to [%d] seconds.\n", nxagentOption(Timeout)); } #endif #endif return (client->noClientException); } int ProcForceScreenSaver(register ClientPtr client) { REQUEST(xForceScreenSaverReq); REQUEST_SIZE_MATCH(xForceScreenSaverReq); if ((stuff->mode != ScreenSaverReset) && (stuff->mode != ScreenSaverActive)) { client->errorValue = stuff->mode; return BadValue; } #ifdef NXAGENT_SERVER /* * The NX agent uses the screen saver procedure * to monitor the user activities and launch its * handlers (like timeout feature), so we can't * always allow the clients to force the screen * saver handler execution. */ if (nxagentOption(Timeout) == 0) { #endif SaveScreens(SCREEN_SAVER_FORCER, (int)stuff->mode); #ifdef NXAGENT_SERVER } #ifdef TEST else { fprintf(stderr, "ProcForceScreenSaver: Ignoring the client request with mode [%d].\n", stuff -> mode); } #endif #endif return client->noClientException; } /********************** * CloseDownClient * * Client can either mark his resources destroy or retain. If retained and * then killed again, the client is really destroyed. *********************/ void CloseDownClient(register ClientPtr client) { #ifdef NXAGENT_SERVER /* * There must be a better way to hook a * call-back function to be called any * time a client is going to be closed. */ nxagentClearClipboard(client, NULL); /* * Need to reset the karma counter and * get rid of the pending sync replies. */ nxagentWakeupByReset(client); /* * Check if the client * is a shadow nxagent. */ nxagentCheckIfShadowAgent(client); #endif xorg_CloseDownClient(client); } /* FIXME: Instead of having a own function use the provided Callback mechanism */ int InitClientPrivates(ClientPtr client) { int ret = xorg_InitClientPrivates(client); #ifdef NXAGENT_SERVER if (ret == 1) { /* * Initialize the private members. */ nxagentInitClientPrivates(client); } #endif return ret; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c0000644000000000000000000012331213614532331021127 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /************************************************************************ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************/ /* The panoramix components contained the following notice */ /* Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #include "dixstruct.h" #include "dixfontstr.h" static Bool doOpenFont(ClientPtr client, OFclosurePtr c); static Bool doListFontsAndAliases(ClientPtr client, LFclosurePtr c); #include "../../dix/dixfonts.c" /* #define NXAGENT_DEBUG */ #include "Agent.h" #include "Font.h" #ifdef NXAGENT_SERVER #define NXFONTPATHLENGTH 1024 char _NXFontPath[NXFONTPATHLENGTH]; /* * Override the default font path and make * it configurable at run time, based on * the NX_FONT environment. */ static const char *_NXGetFontPath(const char *path) { /* * Check the environment only once. */ if (_NXFontPath[0] != '\0') { return _NXFontPath; } const char *fontEnv = getenv("NX_FONT"); if (fontEnv != NULL && *fontEnv != '\0') { if (strlen(fontEnv) + 1 > NXFONTPATHLENGTH) { #ifdef TEST fprintf(stderr, "_NXGetFontPath: WARNING! Maximum length of font path exceeded.\n"); #endif goto _NXGetFontPathError; } snprintf(_NXFontPath, NXFONTPATHLENGTH, "%s", fontEnv); #ifdef TEST fprintf(stderr, "_NXGetFontPath: Using NX font path [%s].\n", _NXFontPath); #endif return _NXFontPath; } _NXGetFontPathError: snprintf(_NXFontPath, NXFONTPATHLENGTH, "%s", path); #ifdef TEST fprintf(stderr, "_NXGetFontPath: Using default font path [%s].\n", _NXFontPath); #endif return _NXFontPath; } #endif static Bool doOpenFont(ClientPtr client, OFclosurePtr c) { FontPtr pfont = NullFont; FontPathElementPtr fpe = NULL; ScreenPtr pScr; int err = Successful; int i; char *alias, *newname; int newlen; int aliascount = 20; char nxagentOrigFontName[256]; int nxagentOrigFontNameLen; /* * Decide at runtime what FontFormat to use. */ Mask FontFormat = ((screenInfo.imageByteOrder == LSBFirst) ? BitmapFormatByteOrderLSB : BitmapFormatByteOrderMSB) | ((screenInfo.bitmapBitOrder == LSBFirst) ? BitmapFormatBitOrderLSB : BitmapFormatBitOrderMSB) | BitmapFormatImageRectMin | #if GLYPHPADBYTES == 1 BitmapFormatScanlinePad8 | #endif #if GLYPHPADBYTES == 2 BitmapFormatScanlinePad16 | #endif #if GLYPHPADBYTES == 4 BitmapFormatScanlinePad32 | #endif #if GLYPHPADBYTES == 8 BitmapFormatScanlinePad64 | #endif BitmapFormatScanlineUnit8; nxagentOrigFontNameLen = (c -> origFontNameLen < sizeof(nxagentOrigFontName) ? c -> origFontNameLen : sizeof(nxagentOrigFontName) - 1); memcpy(nxagentOrigFontName, c -> origFontName, nxagentOrigFontNameLen); nxagentOrigFontName[nxagentOrigFontNameLen] = 0; if (client->clientGone) { if (c->current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current_fpe]; #ifdef HAS_XFONT2 (*fpe_functions[fpe->type]->client_died) ((void *) client, fpe); #else (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); #endif /* HAS_XFONT2 */ } err = Successful; goto bail; } while (c->current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current_fpe]; #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->open_font) #else err = (*fpe_functions[fpe->type].open_font) #endif /* HAS_XFONT2 */ ((void *) client, fpe, c->flags, c->fontname, c->fnamelen, FontFormat, BitmapFormatMaskByte | BitmapFormatMaskBit | BitmapFormatMaskImageRectangle | BitmapFormatMaskScanLinePad | BitmapFormatMaskScanLineUnit, c->fontid, &pfont, &alias, c->non_cachable_font && c->non_cachable_font->fpe == fpe ? c->non_cachable_font : (FontPtr)0); if (err == FontNameAlias && alias) { newlen = strlen(alias); newname = (char *) realloc(c->fontname, newlen); if (!newname) { err = AllocError; break; } memmove(newname, alias, newlen); c->fontname = newname; c->fnamelen = newlen; c->current_fpe = 0; if (--aliascount <= 0) break; continue; } if (err == BadFontName) { c->current_fpe++; continue; } if (err == Suspended) { if (!c->slept) { c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)doOpenFont, (void *) c); #ifdef NXAGENT_DEBUG fprintf(stderr, " NXdixfonts: doOpenFont: client [%lx] sleeping.\n", client); #endif } return TRUE; } break; } if (err != Successful) goto bail; if (!pfont) { err = BadFontName; goto bail; } /* check values for firstCol, lastCol, firstRow, and lastRow */ if (pfont->info.firstCol > pfont->info.lastCol || pfont->info.firstRow > pfont->info.lastRow || pfont->info.lastCol - pfont->info.firstCol > 255) { err = AllocError; goto bail; } if (!pfont->fpe) pfont->fpe = fpe; pfont->refcnt++; if (pfont->refcnt == 1) { UseFPE(pfont->fpe); for (i = 0; i < screenInfo.numScreens; i++) { pScr = screenInfo.screens[i]; if (pScr->RealizeFont) { /* NXAGENT uses useless screen pointer to pass the original font name * to realizeFont, could be a source of problems in the future. */ if (!(*pScr->RealizeFont) ((ScreenPtr)nxagentOrigFontName, pfont)) { CloseFont (pfont, (Font) 0); err=BadFontName; goto bail; } } } } if (!AddResource(c->fontid, RT_FONT, (void *) pfont)) { err = AllocError; goto bail; } if( nxagentFontPriv(pfont) -> mirrorID == 0 ) { extern RESTYPE RT_NX_FONT; nxagentFontPriv(pfont) -> mirrorID = FakeClientID(0); if (!AddResource(nxagentFontPriv(pfont) -> mirrorID, RT_NX_FONT, (void *) pfont)) { FreeResource(c->fontid, RT_NONE); err = AllocError; goto bail; } } if (patternCache && pfont != c->non_cachable_font) #ifdef HAS_XFONT2 xfont2_cache_font_pattern(patternCache, nxagentOrigFontName, nxagentOrigFontNameLen, #else CacheFontPattern(patternCache, nxagentOrigFontName, nxagentOrigFontNameLen, #endif /* HAS_XFONT2 */ pfont); bail: if (err != Successful && c->client != serverClient) { SendErrorToClient(c->client, X_OpenFont, 0, c->fontid, FontToXError(err)); } if (c->slept) { ClientWakeup(c->client); #ifdef NXAGENT_DEBUG fprintf(stderr, " NXdixfonts: doOpenFont: client [%lx] wakeup.\n", client); #endif } for (i = 0; i < c->num_fpes; i++) { FreeFPE(c->fpe_list[i]); } free(c->fpe_list); free(c->fontname); free(c); return TRUE; } static Bool doListFontsAndAliases(ClientPtr client, LFclosurePtr c) { FontPathElementPtr fpe; int err = Successful; FontNamesPtr names = NULL; char *name, *resolved=NULL; int namelen, resolvedlen; int nnames; int stringLens; int i; xListFontsReply reply = {0}; char *bufptr; char *bufferStart; int aliascount = 0; if (client->clientGone) { if (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; #ifdef HAS_XFONT2 (*fpe_functions[fpe->type]->client_died) ((void *) client, fpe); #else (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); #endif /* HAS_XFONT2 */ } err = Successful; goto bail; } if (!c->current.patlen) goto finish; while (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; err = Successful; #ifdef HAS_XFONT2 if (!fpe_functions[fpe->type]->start_list_fonts_and_aliases) #else if (!fpe_functions[fpe->type].start_list_fonts_and_aliases) #endif /* HAS_XFONT2 */ { /* This FPE doesn't support/require list_fonts_and_aliases */ #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->list_fonts) #else err = (*fpe_functions[fpe->type].list_fonts) #endif /* HAS_XFONT2 */ ((void *) c->client, fpe, c->current.pattern, c->current.patlen, c->current.max_names - c->names->nnames, c->names); if (err == Suspended) { if (!c->slept) { c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)doListFontsAndAliases, (void *) c); #ifdef NXAGENT_DEBUG fprintf(stderr, " NXdixfonts: doListFont (1): client [%lx] sleeping.\n", client); #endif } return TRUE; } err = BadFontName; } else { /* Start of list_fonts_and_aliases functionality. Modeled after list_fonts_with_info in that it resolves aliases, except that the information collected from FPEs is just names, not font info. Each list_next_font_or_alias() returns either a name into name/namelen or an alias into name/namelen and its target name into resolved/resolvedlen. The code at this level then resolves the alias by polling the FPEs. */ if (!c->current.list_started) { #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->start_list_fonts_and_aliases) #else err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases) #endif /* HAS_XFONT2 */ ((void *) c->client, fpe, c->current.pattern, c->current.patlen, c->current.max_names - c->names->nnames, &c->current.private); if (err == Suspended) { if (!c->slept) { ClientSleep(client, (ClientSleepProcPtr)doListFontsAndAliases, (void *) c); c->slept = TRUE; } return TRUE; } if (err == Successful) c->current.list_started = TRUE; } if (err == Successful) { char *tmpname; name = 0; #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->list_next_font_or_alias) #else err = (*fpe_functions[fpe->type].list_next_font_or_alias) #endif /* HAS_XFONT2 */ ((void *) c->client, fpe, &name, &namelen, &tmpname, &resolvedlen, c->current.private); if (err == Suspended) { if (!c->slept) { ClientSleep(client, (ClientSleepProcPtr)doListFontsAndAliases, (void *) c); c->slept = TRUE; #ifdef NXAGENT_DEBUG fprintf(stderr, " NXdixfonts: doListFont (2): client [%lx] sleeping.\n", client); #endif #ifdef NXAGENT_DEBUG fprintf(stderr, " NXdixfonts: doListFont (3): client [%lx] sleeping.\n", client); #endif } return TRUE; } if (err == FontNameAlias) { free(resolved); resolved = (char *) malloc(resolvedlen + 1); if (resolved) memmove(resolved, tmpname, resolvedlen + 1); } } if (err == Successful) { if (c->haveSaved) { if (c->savedName) #ifdef HAS_XFONT2 (void)xfont2_add_font_names_name(c->names, c->savedName, #else (void)AddFontNamesName(c->names, c->savedName, #endif /* HAS_XFONT2 */ c->savedNameLen); } else #ifdef HAS_XFONT2 (void)xfont2_add_font_names_name(c->names, name, namelen); #else (void)AddFontNamesName(c->names, name, namelen); #endif /* HAS_XFONT2 */ } /* * When we get an alias back, save our state and reset back to * the start of the FPE looking for the specified name. As * soon as a real font is found for the alias, pop back to the * old state */ else if (err == FontNameAlias) { char tmp_pattern[XLFDMAXFONTNAMELEN]; /* * when an alias recurses, we need to give * the last FPE a chance to clean up; so we call * it again, and assume that the error returned * is BadFontName, indicating the alias resolution * is complete. */ memmove(tmp_pattern, resolved, resolvedlen); if (c->haveSaved) { char *tmpname; int tmpnamelen; tmpname = 0; #ifdef HAS_XFONT2 (void) (*fpe_functions[fpe->type]->list_next_font_or_alias) #else (void) (*fpe_functions[fpe->type].list_next_font_or_alias) #endif /* HAS_XFONT2 */ ((void *) c->client, fpe, &tmpname, &tmpnamelen, &tmpname, &tmpnamelen, c->current.private); if (--aliascount <= 0) { err = BadFontName; goto ContBadFontName; } } else { c->saved = c->current; c->haveSaved = TRUE; free(c->savedName); c->savedName = (char *)malloc(namelen + 1); if (c->savedName) memmove(c->savedName, name, namelen + 1); c->savedNameLen = namelen; aliascount = 20; } memmove(c->current.pattern, tmp_pattern, resolvedlen); c->current.patlen = resolvedlen; c->current.max_names = c->names->nnames + 1; c->current.current_fpe = -1; c->current.private = 0; err = BadFontName; } } /* * At the end of this FPE, step to the next. If we've finished * processing an alias, pop state back. If we've collected enough * font names, quit. */ if (err == BadFontName) { ContBadFontName: ; c->current.list_started = FALSE; c->current.current_fpe++; err = Successful; if (c->haveSaved) { if (c->names->nnames == c->current.max_names || c->current.current_fpe == c->num_fpes) { c->haveSaved = FALSE; c->current = c->saved; /* Give the saved namelist a chance to clean itself up */ continue; } } if (c->names->nnames == c->current.max_names) break; } } /* * send the reply */ if (err != Successful) { SendErrorToClient(client, X_ListFonts, 0, 0, FontToXError(err)); goto bail; } finish: names = c->names; nnames = names->nnames; client = c->client; stringLens = 0; for (i = 0; i < nnames; i++) stringLens += (names->length[i] <= 255) ? names->length[i] : 0; reply.type = X_Reply; reply.length = (stringLens + nnames + 3) >> 2; reply.nFonts = nnames; reply.sequenceNumber = client->sequence; bufptr = bufferStart = (char *) calloc(1, reply.length << 2); if (!bufptr && reply.length) { SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc); goto bail; } /* * since WriteToClient long word aligns things, copy to temp buffer and * write all at once */ for (i = 0; i < nnames; i++) { if (names->length[i] > 255) reply.nFonts--; else { { /* dirty hack: don't list to client fonts not existing on the remote side */ char tmp[256]; memcpy(tmp, names->names[i], names->length[i]); tmp[ names->length[i] ] = 0; if (nxagentFontLookUp(tmp) == 0) { #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "doListFontsAndAliases:\n"); fprintf(stderr, " removing font: %s \n", tmp); #endif reply.nFonts--; stringLens -= names->length[i]; continue; } } *bufptr++ = names->length[i]; memmove( bufptr, names->names[i], names->length[i]); bufptr += names->length[i]; } } nnames = reply.nFonts; reply.length = (stringLens + nnames + 3) >> 2; client->pSwapReplyFunc = ReplySwapVector[X_ListFonts]; WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply); WriteToClient(client, stringLens + nnames, bufferStart); free(bufferStart); bail: if (c->slept) { ClientWakeup(client); #ifdef NXAGENT_DEBUG fprintf(stderr, " NXdixfonts: doListFont: client [%lx] wakeup.\n", client); #endif } for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); free(c->fpe_list); free(c->savedName); #ifdef HAS_XFONT2 xfont2_free_font_names(names); #else FreeFontNames(names); #endif /* HAS_XFONT2 */ free(c); free(resolved); return TRUE; } int ListFonts(ClientPtr client, unsigned char *pattern, unsigned length, unsigned max_names) { int i; LFclosurePtr c; /* * The right error to return here would be BadName, however the * specification does not allow for a Name error on this request. * Perhaps a better solution would be to return a nil list, i.e. * a list containing zero fontnames. */ if (length > XLFDMAXFONTNAMELEN) return BadAlloc; if (!(c = (LFclosurePtr) calloc(1, sizeof *c))) return BadAlloc; c->fpe_list = (FontPathElementPtr *) malloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { free(c); return BadAlloc; } #ifdef HAS_XFONT2 c->names = xfont2_make_font_names_record(max_names < nxagentMaxFontNames ? max_names : nxagentMaxFontNames); #else c->names = MakeFontNamesRecord(max_names < nxagentMaxFontNames ? max_names : nxagentMaxFontNames); #endif /* HAS_XFONT2 */ if (!c->names) { free(c->fpe_list); free(c); return BadAlloc; } memmove( c->current.pattern, pattern, length); for (i = 0; i < num_fpes; i++) { c->fpe_list[i] = font_path_elements[i]; UseFPE(c->fpe_list[i]); } c->client = client; c->num_fpes = num_fpes; c->current.patlen = length; c->current.current_fpe = 0; c->current.max_names = max_names; c->current.list_started = FALSE; c->current.private = 0; c->haveSaved = FALSE; c->slept = FALSE; c->savedName = 0; doListFontsAndAliases(client, c); return Success; } int doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) { FontPathElementPtr fpe; int err = Successful; char *name; int namelen; int numFonts; FontInfoRec fontInfo, *pFontInfo; xListFontsWithInfoReply *reply; int length; xFontProp *pFP; int i; int aliascount = 0; xListFontsWithInfoReply finalReply = {0}; if (client->clientGone) { if (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; #ifdef HAS_XFONT2 (*fpe_functions[fpe->type]->client_died) ((void *) client, fpe); #else (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); #endif /* HAS_XFONT2 */ } err = Successful; goto bail; } client->pSwapReplyFunc = ReplySwapVector[X_ListFontsWithInfo]; if (!c->current.patlen) goto finish; while (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; err = Successful; if (!c->current.list_started) { #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->start_list_fonts_with_info) #else err = (*fpe_functions[fpe->type].start_list_fonts_with_info) #endif /* HAS_XFONT2 */ (client, fpe, c->current.pattern, c->current.patlen, c->current.max_names, &c->current.private); if (err == Suspended) { if (!c->slept) { ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c); c->slept = TRUE; #ifdef NXAGENT_DEBUG fprintf(stderr, " NXdixfonts: doListFontWinfo (1): client [%lx] sleeping.\n", client); #endif } return TRUE; } if (err == Successful) c->current.list_started = TRUE; } if (err == Successful) { name = 0; pFontInfo = &fontInfo; #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->list_next_font_with_info) #else err = (*fpe_functions[fpe->type].list_next_font_with_info) #endif /* HAS_XFONT2 */ (client, fpe, &name, &namelen, &pFontInfo, &numFonts, c->current.private); if (err == Suspended) { if (!c->slept) { ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c); c->slept = TRUE; #ifdef NXAGENT_DEBUG fprintf(stderr, " NXdixfonts: doListFontWinfo (2): client [%lx] sleeping.\n", client); #endif } return TRUE; } } /* * When we get an alias back, save our state and reset back to the * start of the FPE looking for the specified name. As soon as a real * font is found for the alias, pop back to the old state */ if (err == FontNameAlias) { /* * when an alias recurses, we need to give * the last FPE a chance to clean up; so we call * it again, and assume that the error returned * is BadFontName, indicating the alias resolution * is complete. */ if (c->haveSaved) { char *tmpname; int tmpnamelen; FontInfoPtr tmpFontInfo; tmpname = 0; tmpFontInfo = &fontInfo; #ifdef HAS_XFONT2 (void) (*fpe_functions[fpe->type]->list_next_font_with_info) #else (void) (*fpe_functions[fpe->type].list_next_font_with_info) #endif /* HAS_XFONT2 */ (client, fpe, &tmpname, &tmpnamelen, &tmpFontInfo, &numFonts, c->current.private); if (--aliascount <= 0) { err = BadFontName; goto ContBadFontName; } } else { c->saved = c->current; c->haveSaved = TRUE; c->savedNumFonts = numFonts; free(c->savedName); c->savedName = (char *)malloc(namelen + 1); if (c->savedName) memmove(c->savedName, name, namelen + 1); aliascount = 20; } memmove(c->current.pattern, name, namelen); c->current.patlen = namelen; c->current.max_names = 1; c->current.current_fpe = 0; c->current.private = 0; c->current.list_started = FALSE; } /* * At the end of this FPE, step to the next. If we've finished * processing an alias, pop state back. If we've sent enough font * names, quit. Always wait for BadFontName to let the FPE * have a chance to clean up. */ else if (err == BadFontName) { ContBadFontName: ; c->current.list_started = FALSE; c->current.current_fpe++; err = Successful; if (c->haveSaved) { if (c->current.max_names == 0 || c->current.current_fpe == c->num_fpes) { c->haveSaved = FALSE; c->saved.max_names -= (1 - c->current.max_names); c->current = c->saved; } } else if (c->current.max_names == 0) break; } else if (err == Successful) { if (c->haveSaved) { numFonts = c->savedNumFonts; name = c->savedName; namelen = strlen(name); } if (nxagentFontLookUp(name) == 0) { #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "doListFontsAndAliases (with info):\n"); fprintf(stderr, " removing font: %s \n", name); #endif continue; } length = sizeof(*reply) + pFontInfo->nprops * sizeof(xFontProp); reply = c->reply; if (c->length < length) { reply = (xListFontsWithInfoReply *) realloc(c->reply, length); if (!reply) { err = AllocError; break; } memset(reply + c->length, 0, length - c->length); c->reply = reply; c->length = length; } reply->type = X_Reply; reply->length = (sizeof *reply - sizeof(xGenericReply) + pFontInfo->nprops * sizeof(xFontProp) + namelen + 3) >> 2; reply->sequenceNumber = client->sequence; reply->nameLength = namelen; reply->minBounds = pFontInfo->ink_minbounds; reply->maxBounds = pFontInfo->ink_maxbounds; reply->minCharOrByte2 = pFontInfo->firstCol; reply->maxCharOrByte2 = pFontInfo->lastCol; reply->defaultChar = pFontInfo->defaultCh; reply->nFontProps = pFontInfo->nprops; reply->drawDirection = pFontInfo->drawDirection; reply->minByte1 = pFontInfo->firstRow; reply->maxByte1 = pFontInfo->lastRow; reply->allCharsExist = pFontInfo->allExist; reply->fontAscent = pFontInfo->fontAscent; reply->fontDescent = pFontInfo->fontDescent; reply->nReplies = numFonts; pFP = (xFontProp *) (reply + 1); for (i = 0; i < pFontInfo->nprops; i++) { pFP->name = pFontInfo->props[i].name; pFP->value = pFontInfo->props[i].value; pFP++; } WriteSwappedDataToClient(client, length, reply); WriteToClient(client, namelen, name); if (pFontInfo == &fontInfo) { free(fontInfo.props); free(fontInfo.isStringProp); } --c->current.max_names; } } finish: length = sizeof(xListFontsWithInfoReply); finalReply.type = X_Reply; finalReply.sequenceNumber = client->sequence; finalReply.length = (sizeof(xListFontsWithInfoReply) - sizeof(xGenericReply)) >> 2; WriteSwappedDataToClient(client, length, &finalReply); bail: if (c->slept) { ClientWakeup(client); #ifdef NXAGENT_DEBUG fprintf(stderr, " NXdixfonts: doListFontWinfo: client [%lx] wakeup.\n", client); #endif } for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); free(c->reply); free(c->fpe_list); free(c->savedName); free(c); return TRUE; } int SetDefaultFontPath(char *path) { char *temp_path, *start, *end; unsigned char *cp, *pp, *nump, *newpath; int num = 1, len, err, size = 0, bad; #ifdef NXAGENT_SERVER path = (char *) _NXGetFontPath(path); #endif /* NXAGENT_SERVER */ start = path; /* ensure temp_path contains "built-ins" */ while (1) { start = strstr(start, "built-ins"); if (start == NULL) break; end = start + strlen("built-ins"); if ((start == path || start[-1] == ',') && (!*end || *end == ',')) break; start = end; } if (!start) { if (asprintf(&temp_path, "%s%sbuilt-ins", path, *path ? "," : "") == -1) temp_path = NULL; } else { temp_path = strdup(path); } if (!temp_path) return BadAlloc; /* get enough for string, plus values -- use up commas */ len = strlen(temp_path) + 1; nump = cp = newpath = (unsigned char *) malloc(len); if (!newpath) { free(temp_path); return BadAlloc; } pp = (unsigned char *) temp_path; cp++; while (*pp) { if (*pp == ',') { *nump = (unsigned char) size; nump = cp++; pp++; num++; size = 0; } else { *cp++ = *pp++; size++; } } *nump = (unsigned char) size; err = SetFontPathElements(num, newpath, &bad, TRUE); free(newpath); free(temp_path); return err; } typedef struct { LFclosurePtr c; OFclosurePtr oc; } nxFs,*nxFsPtr; static Bool #if NeedFunctionPrototypes nxdoListFontsAndAliases(ClientPtr client, nxFsPtr fss) #else nxdoListFontsAndAliases(client, fss) ClientPtr client; nxFsPtr fss; #endif { LFclosurePtr c=fss->c; OFclosurePtr oc=fss->oc; FontPathElementPtr fpe; int err = Successful; char *name, *resolved=NULL; int namelen, resolvedlen; int i; int aliascount = 0; char tmp[256]; tmp[0]=0; if (client->clientGone) { if (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; #ifdef HAS_XFONT2 (*fpe_functions[fpe->type]->client_died) ((void *) client, fpe); #else (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); #endif /* HAS_XFONT2 */ } err = Successful; goto bail; } if (!c->current.patlen) goto finish; while (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; err = Successful; #ifdef HAS_XFONT2 if (!fpe_functions[fpe->type]->start_list_fonts_and_aliases) #else if (!fpe_functions[fpe->type].start_list_fonts_and_aliases) #endif /* HAS_XFONT2 */ { /* This FPE doesn't support/require list_fonts_and_aliases */ #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->list_fonts) #else err = (*fpe_functions[fpe->type].list_fonts) #endif /* HAS_XFONT2 */ ((void *) c->client, fpe, c->current.pattern, c->current.patlen, c->current.max_names - c->names->nnames, c->names); if (err == Suspended) { if (!c->slept) { c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)nxdoListFontsAndAliases, (void *) fss); #ifdef NXAGENT_DEBUG fprintf(stderr, " NXdixfonts: nxdoListFont (1): client [%lx] sleeping.\n", client); #endif } return TRUE; } err = BadFontName; } else { /* Start of list_fonts_and_aliases functionality. Modeled after list_fonts_with_info in that it resolves aliases, except that the information collected from FPEs is just names, not font info. Each list_next_font_or_alias() returns either a name into name/namelen or an alias into name/namelen and its target name into resolved/resolvedlen. The code at this level then resolves the alias by polling the FPEs. */ if (!c->current.list_started) { #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->start_list_fonts_and_aliases) #else err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases) #endif /* HAS_XFONT2 */ ((void *) c->client, fpe, c->current.pattern, c->current.patlen, c->current.max_names - c->names->nnames, &c->current.private); if (err == Suspended) { if (!c->slept) { ClientSleep(client, (ClientSleepProcPtr)nxdoListFontsAndAliases, (void *) fss); c->slept = TRUE; #ifdef NXAGENT_DEBUG fprintf(stderr, " NXdixfonts: nxdoListFont (2): client [%lx] sleeping.\n", client); #endif } return TRUE; } if (err == Successful) c->current.list_started = TRUE; } if (err == Successful) { char *tmpname; name = 0; #ifdef HAS_XFONT2 err = (*fpe_functions[fpe->type]->list_next_font_or_alias) #else err = (*fpe_functions[fpe->type].list_next_font_or_alias) #endif /* HAS_XFONT2 */ ((void *) c->client, fpe, &name, &namelen, &tmpname, &resolvedlen, c->current.private); if (err == Suspended) { if (!c->slept) { ClientSleep(client, (ClientSleepProcPtr)nxdoListFontsAndAliases, (void *) fss); c->slept = TRUE; #ifdef NXAGENT_DEBUG fprintf(stderr, " NXdixfonts: nxdoListFont (3): client [%lx] sleeping.\n", client); #endif } return TRUE; } if (err == FontNameAlias) { free(resolved); resolved = (char *) malloc(resolvedlen + 1); if (resolved) { memmove(resolved, tmpname, resolvedlen); resolved[resolvedlen] = '\0'; } } } if (err == Successful) { if (c->haveSaved) { if (c->savedName) { memcpy(tmp,c->savedName,c->savedNameLen>255?255:c->savedNameLen); tmp[c->savedNameLen>255?255:c->savedNameLen]=0; if (nxagentFontLookUp(tmp)) break; else tmp[0]=0; } } else { memcpy(tmp,name,namelen>255?255:namelen); tmp[namelen>255?255:namelen]=0; if (nxagentFontLookUp(tmp)) break; else tmp[0]=0; } } /* * When we get an alias back, save our state and reset back to * the start of the FPE looking for the specified name. As * soon as a real font is found for the alias, pop back to the * old state */ else if (err == FontNameAlias) { char tmp_pattern[XLFDMAXFONTNAMELEN]; /* * when an alias recurses, we need to give * the last FPE a chance to clean up; so we call * it again, and assume that the error returned * is BadFontName, indicating the alias resolution * is complete. */ memmove(tmp_pattern, resolved, resolvedlen); if (c->haveSaved) { char *tmpname; int tmpnamelen; tmpname = 0; #ifdef HAS_XFONT2 (void) (*fpe_functions[fpe->type]->list_next_font_or_alias) #else (void) (*fpe_functions[fpe->type].list_next_font_or_alias) #endif /* HAS_XFONT2 */ ((void *) c->client, fpe, &tmpname, &tmpnamelen, &tmpname, &tmpnamelen, c->current.private); if (--aliascount <= 0) { err = BadFontName; goto ContBadFontName; } } else { c->saved = c->current; c->haveSaved = TRUE; free(c->savedName); c->savedName = (char *)malloc(namelen + 1); if (c->savedName) { memmove(c->savedName, name, namelen); c->savedName[namelen] = '\0'; } c->savedNameLen = namelen; aliascount = 20; } memmove(c->current.pattern, tmp_pattern, resolvedlen); c->current.patlen = resolvedlen; c->current.max_names = c->names->nnames + 1; c->current.current_fpe = -1; c->current.private = 0; err = BadFontName; } } /* * At the end of this FPE, step to the next. If we've finished * processing an alias, pop state back. If we've collected enough * font names, quit. */ if (err == BadFontName) { ContBadFontName: ; c->current.list_started = FALSE; c->current.current_fpe++; err = Successful; if (c->haveSaved) { if (c->names->nnames == c->current.max_names || c->current.current_fpe == c->num_fpes) { c->haveSaved = FALSE; c->current = c->saved; /* Give the saved namelist a chance to clean itself up */ continue; } } if (c->names->nnames == c->current.max_names) break; } } /* * send the reply */ bail: finish: if (strlen(tmp)) { #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "nxListFont changed (0) font to %s\n",tmp); #endif memcpy(oc->fontname, tmp, strlen(tmp)); oc->fnamelen = strlen(tmp); oc->origFontName = oc->fontname; oc->origFontNameLen = oc->fnamelen; } else { for (i = 0; i < c->names->nnames; i++) { if (c->names->length[i] > 255) continue; else { memcpy(tmp, c->names->names[i], c->names->length[i]); tmp[ c->names->length[i] ] = 0; if (nxagentFontLookUp(tmp) == 0) continue; memcpy(oc->fontname, tmp, strlen(tmp)); oc->fnamelen = strlen(tmp); oc->origFontName = oc->fontname; oc->origFontNameLen = oc->fnamelen; #ifdef NXAGENT_FONTMATCH_DEBUG fprintf(stderr, "nxListFont changed (1) font to %s\n",tmp); #endif break; } } } if (c->slept) { ClientWakeup(client); #ifdef NXAGENT_DEBUG fprintf(stderr, " NXdixfonts: nxdoListFont: client [%lx] wakeup.\n", client); #endif } for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); free(c->fpe_list); free(c->savedName); #ifdef HAS_XFONT2 xfont2_free_font_names(c->names); #else FreeFontNames(c->names); #endif /* HAS_XFONT2 */ free(c); free(fss); free(resolved); return doOpenFont(client, oc); } int nxOpenFont(client, fid, flags, lenfname, pfontname) ClientPtr client; XID fid; Mask flags; unsigned lenfname; char *pfontname; { nxFsPtr fss; LFclosurePtr c; OFclosurePtr oc; int i; FontPtr cached = (FontPtr)0; #ifdef FONTDEBUG char *f; f = (char *)malloc(lenfname + 1); memmove(f, pfontname, lenfname); f[lenfname] = '\0'; ErrorF("OpenFont: fontname is \"%s\"\n", f); free(f); #endif if (!lenfname || lenfname > XLFDMAXFONTNAMELEN) return BadName; if (patternCache) { /* ** Check name cache. If we find a cached version of this font that ** is cachable, immediately satisfy the request with it. If we find ** a cached version of this font that is non-cachable, we do not ** satisfy the request with it. Instead, we pass the FontPtr to the ** FPE's open_font code (the fontfile FPE in turn passes the ** information to the rasterizer; the fserve FPE ignores it). ** ** Presumably, the font is marked non-cachable because the FPE has ** put some licensing restrictions on it. If the FPE, using ** whatever logic it relies on, determines that it is willing to ** share this existing font with the client, then it has the option ** to return the FontPtr we passed it as the newly-opened font. ** This allows the FPE to exercise its licensing logic without ** having to create another instance of a font that already exists. */ #ifdef HAS_XFONT2 cached = xfont2_find_cached_font_pattern(patternCache, pfontname, lenfname); #else cached = FindCachedFontPattern(patternCache, pfontname, lenfname); #endif /* HAS_XFONT2 */ if (cached && cached->info.cachable) { if (!AddResource(fid, RT_FONT, (void *) cached)) return BadAlloc; cached->refcnt++; return Success; } } if (!(fss = (nxFsPtr) malloc(sizeof(nxFs)))) return BadAlloc; if (!(c = (LFclosurePtr) malloc(sizeof *c))) { free(fss); return BadAlloc; } c->fpe_list = (FontPathElementPtr *) malloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { free(c); free(fss); return BadAlloc; } #ifdef HAS_XFONT2 c->names = xfont2_make_font_names_record(100); #else c->names = MakeFontNamesRecord(100); #endif /* HAS_XFONT2 */ if (!c->names) { free(c->fpe_list); free(c); free(fss); return BadAlloc; } memmove( c->current.pattern, pfontname, lenfname); for (i = 0; i < num_fpes; i++) { c->fpe_list[i] = font_path_elements[i]; UseFPE(c->fpe_list[i]); } c->client = client; c->num_fpes = num_fpes; c->current.patlen = lenfname; c->current.current_fpe = 0; c->current.max_names = nxagentMaxFontNames; c->current.list_started = FALSE; c->current.private = 0; c->haveSaved = FALSE; c->slept = FALSE; c->savedName = 0; oc = (OFclosurePtr) malloc(sizeof(OFclosureRec)); if (!oc) { for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); free(c->fpe_list); free(c); free(fss); return BadAlloc; } oc->fontname = (char *) malloc(256);/* I don't want to deal with future reallocs errors */ oc->origFontName = pfontname; oc->origFontNameLen = lenfname; if (!oc->fontname) { for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); free(c->fpe_list); free(c); free(oc); free(fss); return BadAlloc; } /* * copy the current FPE list, so that if it gets changed by another client * while we're blocking, the request still appears atomic */ oc->fpe_list = (FontPathElementPtr *) malloc(sizeof(FontPathElementPtr) * num_fpes); if (!oc->fpe_list) { free(oc->fontname); free(oc); for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); free(c->fpe_list); free(c); free(fss); return BadAlloc; } memmove(oc->fontname, pfontname, lenfname); for (i = 0; i < num_fpes; i++) { oc->fpe_list[i] = font_path_elements[i]; UseFPE(oc->fpe_list[i]); } oc->client = client; oc->fontid = fid; oc->current_fpe = 0; oc->num_fpes = num_fpes; oc->fnamelen = lenfname; oc->slept = FALSE; oc->flags = flags; oc->non_cachable_font = cached; fss->c=c; fss->oc=oc; nxdoListFontsAndAliases(client, fss); return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXevents.c0000644000000000000000000003633213614532331020602 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* The panoramix components contained the following notice */ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /***************************************************************** Copyright 2003-2005 Sun Microsystems, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. ******************************************************************/ #include #define XYWINDOWCALLBACK #include "../../dix/events.c" #include "compext/Compext.h" #include "Events.h" #include "Windows.h" #include "Args.h" extern Display *nxagentDisplay; extern WindowPtr nxagentLastEnteredWindow; #ifdef VIEWPORT_FRAME extern void nxagentInitViewportFrame(ScreenPtr, WindowPtr); #endif extern int nxagentShadowInit(ScreenPtr, WindowPtr); #ifdef NXAGENT_CLIPBOARD extern int nxagentSendNotify(xEvent*); #endif void ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, TimeStamp time, Bool autoGrab) { xorg_ActivatePointerGrab(mouse, grab, time, autoGrab); #ifdef NXAGENT_SERVER /* * If grab is synchronous, events are delivered to clients only if they send * an AllowEvent request. If mode field in AllowEvent request is SyncPointer, the * delivered event is saved in a queue and replayed later, when grab is released. * We should export sync grab to X as async in order to avoid events to be * queued twice, in the agent and in the X server. This solution have a drawback: * replayed events are not delivered to that application that are not clients of * the agent. * A different solution could be to make the grab asynchronous in the agent and * to export it as synchronous. But this seems to be less safe. * * To make internal grab asynchronous, change previous line as follows. * * if (nxagentOption(Rootless)) * { * CheckGrabForSyncs(mouse, GrabModeAsync, (Bool)grab->keyboardMode); * } * else * { * CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode); * } */ if (nxagentOption(Rootless) == 1) { /* * from nxagent-1.5.0-20 changelog: * In rootless mode, grabs exported to X in * ActivatePointerGrab() are always made asynchronous. The * synchronous behaviour is implemented by the agent, so that * requiring a further synchronous grab down to the real X * server is of little use and potentially harmful. */ /* * FIXME: We should use the correct value for the * cursor. Temporarily we set it to None. */ int resource = nxagentWaitForResource(NXGetCollectGrabPointerResource, nxagentCollectGrabPointerPredicate); NXCollectGrabPointer(nxagentDisplay, resource, nxagentWindow(grab -> window), 1, grab -> eventMask & PointerGrabMask, GrabModeAsync, GrabModeAsync, (grab -> confineTo) ? nxagentWindow(grab -> confineTo) : None, None, CurrentTime); } #endif /* NXAGENT_SERVER */ } void DeactivatePointerGrab(register DeviceIntPtr mouse) { xorg_DeactivatePointerGrab(mouse); #ifdef NXAGENT_SERVER /* * excerpt from nxagent-1.5.0-20 changelog: * In DeactivatePointerGrab() function, mouse button state is set * to up if the window entered by the pointer is the root window * and the agent is in rootless mode. This change is needed * because the subsequent KeyRelease event could be not received * by the agent (for example if the focus had left the window), so * that agent could be unable to update the mouse button state. */ if (nxagentOption(Rootless) == 1) { XUngrabPointer(nxagentDisplay, CurrentTime); if (sprite.win == ROOT) { mouse -> button -> state &= ~(Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask); } } #endif } int ProcAllowEvents(register ClientPtr client) { int rc = xorg_ProcAllowEvents(client); if (rc != Success) return rc; /* * This is not necessary if we export grab to X as asynchronous. * * if (nxagentOption(Rootless) && stuff -> mode != ReplayKeyboard && * stuff -> mode != SyncKeyboard && stuff -> mode != AsyncKeyboard) * { * XAllowEvents(nxagentDisplay, stuff -> mode, CurrentTime); * } */ return Success; } /* * called from XYToWindow to determine where XYToWindow() should start * going through the list. */ static WindowPtr GetXYStartWindow(WindowPtr pWin) { if (nxagentOption(Rootless)) { /* * explanation from the original changelog for nxagent-1.5.0-20: * Modified function XYToWindow() in order to manage the case * that mouse pointer is located on the title bar of a top level * window in rootless mode. */ if (nxagentLastEnteredWindow == NULL) { return ROOT; } /* * explanation from the original changelog for nxagent-1.5.0-17: * In rootless mode, now function XYToWindow() starts search from * the last window originated an EnterNotify event. In this way, we * can prevent shaded windows from getting mouse events. */ pWin = ROOT->lastChild; while (pWin && pWin != ROOT->firstChild && pWin != nxagentLastEnteredWindow) { pWin = pWin->prevSib; } } return pWin; } static Bool CheckMotion(xEvent *xE) { WindowPtr prevSpriteWin = sprite.win; #ifdef PANORAMIX if(!noPanoramiXExtension) return XineramaCheckMotion(xE); #endif if (xE && !syncEvents.playingEvents) { if (sprite.hot.pScreen != sprite.hotPhys.pScreen) { sprite.hot.pScreen = sprite.hotPhys.pScreen; ROOT = sprite.hot.pScreen->root; } sprite.hot.x = XE_KBPTR.rootX; sprite.hot.y = XE_KBPTR.rootY; if (sprite.hot.x < sprite.physLimits.x1) sprite.hot.x = sprite.physLimits.x1; else if (sprite.hot.x >= sprite.physLimits.x2) sprite.hot.x = sprite.physLimits.x2 - 1; if (sprite.hot.y < sprite.physLimits.y1) sprite.hot.y = sprite.physLimits.y1; else if (sprite.hot.y >= sprite.physLimits.y2) sprite.hot.y = sprite.physLimits.y2 - 1; #ifdef SHAPE if (sprite.hotShape) ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y); #endif sprite.hotPhys = sprite.hot; #ifdef NXAGENT_SERVER /* * This code force cursor position to be inside the * root window of the agent. We can't view a reason * to do this and it interacts in an undesirable way * with toggling fullscreen. * * if ((sprite.hotPhys.x != XE_KBPTR.rootX) || * (sprite.hotPhys.y != XE_KBPTR.rootY)) * { * (*sprite.hotPhys.pScreen->SetCursorPosition)( * sprite.hotPhys.pScreen, * sprite.hotPhys.x, sprite.hotPhys.y, FALSE); * } */ #else if ((sprite.hotPhys.x != XE_KBPTR.rootX) || (sprite.hotPhys.y != XE_KBPTR.rootY)) { (*sprite.hotPhys.pScreen->SetCursorPosition)( sprite.hotPhys.pScreen, sprite.hotPhys.x, sprite.hotPhys.y, FALSE); } #endif XE_KBPTR.rootX = sprite.hot.x; XE_KBPTR.rootY = sprite.hot.y; } sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y); #ifdef notyet if (!(sprite.win->deliverableEvents & Motion_Filter(inputInfo.pointer->button)) !syncEvents.playingEvents) { /* XXX Do PointerNonInterestBox here */ } #endif if (sprite.win != prevSpriteWin) { if (prevSpriteWin != NullWindow) { if (!xE) UpdateCurrentTimeIf(); DoEnterLeaveEvents(prevSpriteWin, sprite.win, NotifyNormal); } PostNewCursor(); return FALSE; } return TRUE; } void DefineInitialRootWindow(register WindowPtr win) { register ScreenPtr pScreen = win->drawable.pScreen; xorg_DefineInitialRootWindow(win); #ifdef VIEWPORT_FRAME nxagentInitViewportFrame(pScreen, win); #endif if (nxagentOption(Shadow)) { if (nxagentShadowInit(pScreen, win) == -1) { FatalError("Failed to connect to display '%s'", nxagentShadowDisplayName); } } } int ProcSendEvent(ClientPtr client) { #ifdef NXAGENT_CLIPBOARD REQUEST(xSendEventReq); REQUEST_SIZE_MATCH(xSendEventReq); if (stuff -> event.u.u.type == SelectionNotify) { if (nxagentSendNotify(&stuff->event) == 1) return Success; } #endif return xorg_ProcSendEvent(client); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXglxext.c0000644000000000000000000000711013614532331020601 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* ** The contents of this file are subject to the GLX Public License Version 1.0 ** (the "License"). You may not use this file except in compliance with the ** License. You may obtain a copy of the License at Silicon Graphics, Inc., ** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 ** or at http://www.sgi.com/software/opensource/glx/license.html. ** ** Software distributed under the License is distributed on an "AS IS" ** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY ** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR ** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific ** language governing rights and limitations under the License. ** ** The Original Software is GLX version 1.2 source code, released February, ** 1999. The developer of the Original Software is Silicon Graphics, Inc. ** Those portions of the Subject Software created by Silicon Graphics, Inc. ** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. ** */ #include "../../GL/glx/glxext.c" #include "Trap.h" #define PANIC #define WARNING #undef TEST #undef DEBUG /* ** Top level dispatcher; all commands are executed from here down. */ static int __glXDispatch(ClientPtr client) { int retval; /* * Report upstream that we are * dispatching a GLX operation. */ nxagentGlxTrap = 1; #ifdef TEST fprintf(stderr, "__glXDispatch: Going to dispatch GLX operation [%d] for client [%d].\n", opcode, client -> index); #endif retval = xorg__glXDispatch(client); nxagentGlxTrap = 0; #ifdef TEST fprintf(stderr, "__glXDispatch: Dispatched GLX operation [%d] for client [%d].\n", opcode, client -> index); #endif return retval; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c0000644000000000000000000002722713614532331020424 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #include "../../render/glyph.c" #ifdef NXAGENT_SERVER #include "Render.h" #define PANIC #define WARNING #undef DEBUG #undef TEST #endif GlyphRefPtr FindGlyphRef (GlyphHashPtr hash, CARD32 signature, Bool match, GlyphPtr compare) { CARD32 elt, step, s; GlyphPtr glyph; GlyphRefPtr table, gr, del; CARD32 tableSize = hash->hashSet->size; table = hash->table; elt = signature % tableSize; step = 0; del = 0; for (;;) { gr = &table[elt]; s = gr->signature; glyph = gr->glyph; if (!glyph) { if (del) gr = del; break; } if (glyph == DeletedGlyph) { if (!del) del = gr; else if (gr == del) break; } #ifdef NXAGENT_SERVER else if (s == signature && match && glyph->size != compare->size) { /* * if the glyphsize is different there's no need to do a memcmp * because it will surely report difference. And even worse: * it will read beyond the end of glyph under some * circumstances, which can be detected when compiling with * -fsanitize=address. */ } #endif else if (s == signature && (!match || memcmp (&compare->info, &glyph->info, compare->size) == 0)) { break; } if (!step) { step = signature % hash->hashSet->rehash; if (!step) step = 1; } elt += step; if (elt >= tableSize) elt -= tableSize; } return gr; } void AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id) { GlyphRefPtr gr; CARD32 hash; CheckDuplicates (&globalGlyphs[glyphSet->fdepth], "AddGlyph top global"); /* Locate existing matching glyph */ hash = HashGlyph (glyph); gr = FindGlyphRef (&globalGlyphs[glyphSet->fdepth], hash, TRUE, glyph); if (gr->glyph && gr->glyph != DeletedGlyph) { free (glyph); glyph = gr->glyph; } else { gr->glyph = glyph; gr->signature = hash; globalGlyphs[glyphSet->fdepth].tableEntries++; } /* Insert/replace glyphset value */ gr = FindGlyphRef (&glyphSet->hash, id, FALSE, 0); ++glyph->refcnt; if (gr->glyph && gr->glyph != DeletedGlyph) FreeGlyph (gr->glyph, glyphSet->fdepth); else glyphSet->hash.tableEntries++; gr->glyph = glyph; gr->signature = id; #ifdef NXAGENT_SERVER gr -> corruptedGlyph = 1; #endif CheckDuplicates (&globalGlyphs[glyphSet->fdepth], "AddGlyph bottom"); } GlyphPtr FindGlyph (GlyphSetPtr glyphSet, Glyph id) { GlyphPtr glyph; #ifdef NXAGENT_SERVER GlyphRefPtr gr = FindGlyphRef (&glyphSet->hash, id, FALSE, 0); glyph = gr -> glyph; #else glyph = FindGlyphRef (&glyphSet->hash, id, FALSE, 0)->glyph; #endif if (glyph == DeletedGlyph) { glyph = 0; } #ifdef NXAGENT_SERVER else if (gr -> corruptedGlyph == 1) { #ifdef DEBUG fprintf(stderr, "FindGlyphRef: Going to synchronize the glyph [%p] for glyphset [%p].\n", (void *) glyph, (void *) glyphSet); #endif nxagentAddGlyphs(glyphSet, &id, &(glyph -> info), 1, (CARD8*)(glyph + 1), glyph -> size - sizeof(xGlyphInfo)); } #endif return glyph; } Bool ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global) { CARD32 tableEntries; GlyphHashSetPtr hashSet; GlyphHashRec newHash; GlyphRefPtr gr; GlyphPtr glyph; int i; int oldSize; CARD32 s; tableEntries = hash->tableEntries + change; hashSet = FindGlyphHashSet (tableEntries); if (hashSet == hash->hashSet) return TRUE; if (global) CheckDuplicates (hash, "ResizeGlyphHash top"); if (!AllocateGlyphHash (&newHash, hashSet)) return FALSE; if (hash->table) { oldSize = hash->hashSet->size; for (i = 0; i < oldSize; i++) { glyph = hash->table[i].glyph; if (glyph && glyph != DeletedGlyph) { s = hash->table[i].signature; #ifdef NXAGENT_SERVER CARD32 c = hash->table[i].corruptedGlyph; #endif gr = FindGlyphRef (&newHash, s, global, glyph); gr->signature = s; gr->glyph = glyph; #ifdef NXAGENT_SERVER gr -> corruptedGlyph = c; #endif ++newHash.tableEntries; } } free (hash->table); } *hash = newHash; if (global) CheckDuplicates (hash, "ResizeGlyphHash bottom"); return TRUE; } void miGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr *glyphs) { PixmapPtr pPixmap = 0; PicturePtr pPicture; PixmapPtr pMaskPixmap = 0; PicturePtr pMask; ScreenPtr pScreen = pDst->pDrawable->pScreen; int width = 0, height = 0; int x, y; int xDst = list->xOff, yDst = list->yOff; int n; GlyphPtr glyph; int error; BoxRec extents; CARD32 component_alpha; #ifdef NXAGENT_SERVER /* * Get rid of the warning. */ extents.x1 = 0; extents.y1 = 0; #endif if (maskFormat) { GCPtr pGC; xRectangle rect; #ifdef NXAGENT_SERVER if (nxagentGlyphsExtents != NullBox) { memcpy(&extents, nxagentGlyphsExtents, sizeof(BoxRec)); } else { nxagentGlyphsExtents = (BoxPtr) malloc(sizeof(BoxRec)); GlyphExtents (nlist, list, glyphs, &extents); memcpy(nxagentGlyphsExtents, &extents, sizeof(BoxRec)); } #else GlyphExtents (nlist, list, glyphs, &extents); #endif if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1) return; width = extents.x2 - extents.x1; height = extents.y2 - extents.y1; pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, maskFormat->depth, CREATE_PIXMAP_USAGE_SCRATCH); if (!pMaskPixmap) return; component_alpha = NeedsComponent(maskFormat->format); pMask = CreatePicture (0, &pMaskPixmap->drawable, maskFormat, CPComponentAlpha, &component_alpha, serverClient, &error); if (!pMask) { (*pScreen->DestroyPixmap) (pMaskPixmap); return; } pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen); ValidateGC (&pMaskPixmap->drawable, pGC); rect.x = 0; rect.y = 0; rect.width = width; rect.height = height; (*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect); FreeScratchGC (pGC); x = -extents.x1; y = -extents.y1; } else { pMask = pDst; x = 0; y = 0; } pPicture = 0; while (nlist--) { x += list->xOff; y += list->yOff; n = list->len; while (n--) { glyph = *glyphs++; if (!pPicture) { pPixmap = GetScratchPixmapHeader (pScreen, glyph->info.width, glyph->info.height, list->format->depth, list->format->depth, 0, (void *) (glyph + 1)); if (!pPixmap) return; component_alpha = NeedsComponent(list->format->format); pPicture = CreatePicture (0, &pPixmap->drawable, list->format, CPComponentAlpha, &component_alpha, serverClient, &error); if (!pPicture) { FreeScratchPixmapHeader (pPixmap); return; } } (*pScreen->ModifyPixmapHeader) (pPixmap, glyph->info.width, glyph->info.height, 0, 0, -1, (void *) (glyph + 1)); #ifdef NXAGENT_SERVER /* * The following line fixes a problem with glyphs that appeared * as clipped. It was a side effect due the validate function * "ValidatePicture" that makes a check on the Drawable serial * number instead of the picture serial number, failing thus * the clip mask update. */ pPicture->pDrawable->serialNumber = NEXT_SERIAL_NUMBER; #endif pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (maskFormat) { CompositePicture (PictOpAdd, pPicture, None, pMask, 0, 0, 0, 0, x - glyph->info.x, y - glyph->info.y, glyph->info.width, glyph->info.height); } else { CompositePicture (op, pSrc, pPicture, pDst, xSrc + (x - glyph->info.x) - xDst, ySrc + (y - glyph->info.y) - yDst, 0, 0, x - glyph->info.x, y - glyph->info.y, glyph->info.width, glyph->info.height); } x += glyph->info.xOff; y += glyph->info.yOff; } list++; if (pPicture) { FreeScratchPixmapHeader (pPixmap); FreePicture ((void *) pPicture, 0); pPicture = 0; pPixmap = 0; } } if (maskFormat) { x = extents.x1; y = extents.y1; CompositePicture (op, pSrc, pMask, pDst, xSrc + x - xDst, ySrc + y - yDst, 0, 0, x, y, width, height); FreePicture ((void *) pMask, (XID) 0); (*pScreen->DestroyPixmap) (pMaskPixmap); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c0000644000000000000000000001570613614532331021320 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /************************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************/ #include "../../dix/glyphcurs.c" #include "../../fb/fb.h" #include "Pixmaps.h" #ifndef True #define True 1 #endif /* get the bits out of the font in a portable way. to avoid dealing with padding and such-like, we draw the glyph into a bitmap, then read the bits out with GetImage, which uses server-natural format. since all screens return the same bitmap format, we'll just use the first one we find. the character origin lines up with the hotspot in the cursor metrics. */ int ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, unsigned char **ppbits) { register ScreenPtr pScreen; register GCPtr pGC; xRectangle rect; PixmapPtr ppix; long nby; char *pbits; ChangeGCVal gcval[3]; unsigned char char2b[2]; /* turn glyph index into a protocol-format char2b */ char2b[0] = (unsigned char)(ch >> 8); char2b[1] = (unsigned char)(ch & 0xff); pScreen = screenInfo.screens[0]; nby = BitmapBytePad(cm->width) * (long)cm->height; pbits = (char *)malloc(nby); if (!pbits) return BadAlloc; /* zeroing the (pad) bits seems to help some ddx cursor handling */ bzero(pbits, nby); ppix = fbCreatePixmap(pScreen, cm->width, cm->height, 1, CREATE_PIXMAP_USAGE_SCRATCH); pGC = GetScratchGC(1, pScreen); if (!ppix || !pGC) { if (ppix) fbDestroyPixmap(ppix); if (pGC) FreeScratchGC(pGC); free(pbits); return BadAlloc; } #ifdef TEST fprintf(stderr, "ServerBitsFromGlyph: Created virtual pixmap at [%p] with width [%d] height [%d] depth [%d].\n", (void *) ppix, cm->width, cm->height, 1); #endif nxagentPixmapPriv(ppix) -> id = 0; nxagentPixmapPriv(ppix) -> mid = 0; nxagentPixmapPriv(ppix) -> isVirtual = True; nxagentPixmapPriv(ppix) -> pRealPixmap = NULL; nxagentPixmapPriv(ppix) -> pVirtualPixmap = NULL; rect.x = 0; rect.y = 0; rect.width = cm->width; rect.height = cm->height; /* fill the pixmap with 0 */ gcval[0].val = GXcopy; gcval[1].val = 0; gcval[2].ptr = (void *)pfont; dixChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFont, NULL, gcval); ValidateGC((DrawablePtr)ppix, pGC); fbPolyFillRect((DrawablePtr)ppix, pGC, 1, &rect); /* draw the glyph */ gcval[0].val = 1; dixChangeGC(NullClient, pGC, GCForeground, NULL, gcval); ValidateGC((DrawablePtr)ppix, pGC); miPolyText16((DrawablePtr)ppix, pGC, (int)cm->xhot, (int)cm->yhot, (int)1, (unsigned short*)char2b); fbGetImage((DrawablePtr)ppix, 0, 0, cm->width, cm->height, XYPixmap, 1, pbits); *ppbits = (unsigned char *)pbits; FreeScratchGC(pGC); fbDestroyPixmap(ppix); #ifdef TEST fprintf(stderr, "ServerBitsFromGlyph: Destroyed virtual pixmap at [%p].\n", (void *) ppix); #endif return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXglyphstr_GlyphRef.h0000644000000000000000000000635713614532331022763 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ /* this header file gets included into Xserver/render/glyphstr.h */ #ifndef NX_GLYPHSTR_GLYPHREF_H #define NX_GLYPHSTR_GLYPHREF_H 1 typedef struct _GlyphRef { CARD32 signature; GlyphPtr glyph; CARD16 corruptedGlyph; } GlyphRefRec, *GlyphRefPtr; #endif /* NX_GLYPHSTR_GLYPHREF_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXglyphstr_GlyphSet.h0000644000000000000000000000655013614532331022775 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ /* this header file gets included into Xserver/render/glyphstr.h */ #ifndef NX_GLYPHSTR_GLYPHSET_H #define NX_GLYPHSTR_GLYPHSET_H 1 typedef struct _GlyphSet { CARD32 refcnt; PictFormatPtr format; int fdepth; GlyphHashRec hash; int maxPrivate; void **devPrivates; CARD32 remoteID; } GlyphSetRec, *GlyphSetPtr; #endif /* NX_GLYPHSTR_GLYPHSET_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXmitrap.c0000644000000000000000000001200613614532331020562 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #include "Render.h" #include "../../render/mitrap.c" void miTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps) { ScreenPtr pScreen = pDst->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); /* * Check for solid alpha add */ if (op == PictOpAdd && miIsSolidAlpha (pSrc)) { for (; ntrap; ntrap--, traps++) (*ps->RasterizeTrapezoid) (pDst, traps, 0, 0); } else if (maskFormat) { PicturePtr pPicture; BoxRec bounds; INT16 xDst, yDst; INT16 xRel, yRel; xDst = traps[0].left.p1.x >> 16; yDst = traps[0].left.p1.y >> 16; #ifdef NXAGENT_SERVER if (nxagentTrapezoidExtents != NullBox) { memcpy(&bounds, nxagentTrapezoidExtents, sizeof(BoxRec)); } else { nxagentTrapezoidExtents = (BoxPtr) malloc(sizeof(BoxRec)); miTrapezoidBounds (ntrap, traps, &bounds); memcpy(nxagentTrapezoidExtents, &bounds, sizeof(BoxRec)); } #else miTrapezoidBounds (ntrap, traps, &bounds); #endif if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2) return; pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); if (!pPicture) return; for (; ntrap; ntrap--, traps++) (*ps->RasterizeTrapezoid) (pPicture, traps, -bounds.x1, -bounds.y1); xRel = bounds.x1 + xSrc - xDst; yRel = bounds.y1 + ySrc - yDst; CompositePicture (op, pSrc, pPicture, pDst, xRel, yRel, 0, 0, bounds.x1, bounds.y1, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); FreePicture (pPicture, 0); } else { if (pDst->polyEdge == PolyEdgeSharp) maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1); else maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8); for (; ntrap; ntrap--, traps++) miTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c0000644000000000000000000004706613614532331020757 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #include "picturestr.h" #include "Screen.h" #include "Pixmaps.h" #include "Drawable.h" #include "Render.h" /* prototypes */ PictFormatPtr PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp); PicturePtr AllocatePicture (ScreenPtr pScreen); PicturePtr CreatePicture (Picture pid, DrawablePtr pDrawable, PictFormatPtr pFormat, Mask vmask, XID *vlist, ClientPtr client, int *error); static PicturePtr createSourcePicture(void); int FreePicture (void *value, XID pid); #include "../../render/picture.c" #define PANIC #define WARNING #undef TEST #undef DEBUG void *nxagentVisualFromID(ScreenPtr pScreen, VisualID visual); void *nxagentMatchingFormats(PictFormatPtr pForm); void nxagentPictureCreateDefaultFormats(ScreenPtr pScreen, FormatInitRec *formats, int *nformats); extern int nxagentPicturePrivateIndex; PictFormatPtr PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) { int nformats, f; PictFormatPtr pFormats; FormatInitRec formats[1024]; CARD32 format; nformats = 0; nxagentPictureCreateDefaultFormats(pScreen, formats, &nformats); pFormats = (PictFormatPtr) calloc (nformats, sizeof (PictFormatRec)); if (!pFormats) return 0; for (f = 0; f < nformats; f++) { pFormats[f].id = FakeClientID (0); pFormats[f].depth = formats[f].depth; format = formats[f].format; pFormats[f].format = format; switch (PICT_FORMAT_TYPE(format)) { case PICT_TYPE_ARGB: pFormats[f].type = PictTypeDirect; pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format)); if (pFormats[f].direct.alphaMask) pFormats[f].direct.alpha = (PICT_FORMAT_R(format) + PICT_FORMAT_G(format) + PICT_FORMAT_B(format)); pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format)); pFormats[f].direct.red = (PICT_FORMAT_G(format) + PICT_FORMAT_B(format)); pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format)); pFormats[f].direct.green = PICT_FORMAT_B(format); pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format)); pFormats[f].direct.blue = 0; break; case PICT_TYPE_ABGR: pFormats[f].type = PictTypeDirect; pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format)); if (pFormats[f].direct.alphaMask) pFormats[f].direct.alpha = (PICT_FORMAT_B(format) + PICT_FORMAT_G(format) + PICT_FORMAT_R(format)); pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format)); pFormats[f].direct.blue = (PICT_FORMAT_G(format) + PICT_FORMAT_R(format)); pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format)); pFormats[f].direct.green = PICT_FORMAT_R(format); pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format)); pFormats[f].direct.red = 0; break; case PICT_TYPE_A: pFormats[f].type = PictTypeDirect; pFormats[f].direct.alpha = 0; pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format)); /* remaining fields already set to zero */ break; case PICT_TYPE_COLOR: case PICT_TYPE_GRAY: pFormats[f].type = PictTypeIndexed; pFormats[f].index.vid = pScreen->visuals[PICT_FORMAT_VIS(format)].vid; break; } if (nxagentMatchingFormats(&pFormats[f]) != NULL) { #ifdef DEBUG fprintf(stderr, "PictureCreateDefaultFormats: Format with type [%d] depth [%d] rgb [%d,%d,%d] " "mask rgb [%d,%d,%d] alpha [%d] alpha mask [%d] matches.\n", pFormats[f].type, pFormats[f].depth, pFormats[f].direct.red, pFormats[f].direct.green, pFormats[f].direct.blue, pFormats[f].direct.redMask, pFormats[f].direct.greenMask, pFormats[f].direct.blueMask, pFormats[f].direct.alpha, pFormats[f].direct.alphaMask); #endif } else { #ifdef DEBUG fprintf(stderr, "PictureCreateDefaultFormats: Format with type [%d] depth [%d] rgb [%d,%d,%d] " "mask rgb [%d,%d,%d] alpha [%d] alpha mask [%d] doesn't match.\n", pFormats[f].type, pFormats[f].depth, pFormats[f].direct.red, pFormats[f].direct.green, pFormats[f].direct.blue, pFormats[f].direct.redMask, pFormats[f].direct.greenMask, pFormats[f].direct.blueMask, pFormats[f].direct.alpha, pFormats[f].direct.alphaMask); #endif } } *nformatp = nformats; return pFormats; } PicturePtr AllocatePicture (ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreen(pScreen); PicturePtr pPicture; char *ptr; DevUnion *ppriv; unsigned int *sizes; unsigned int size; int i; pPicture = (PicturePtr) calloc(1, ps->totalPictureSize); if (!pPicture) return 0; ppriv = (DevUnion *)(pPicture + 1); pPicture->devPrivates = ppriv; sizes = ps->PicturePrivateSizes; ptr = (char *)(ppriv + ps->PicturePrivateLen); for (i = ps->PicturePrivateLen; --i >= 0; ppriv++, sizes++) { if ( (size = *sizes) ) { ppriv->ptr = (void *)ptr; ptr += size; } else ppriv->ptr = (void *)NULL; } #ifdef NXAGENT_SERVER nxagentPicturePriv(pPicture) -> picture = 0; #endif return pPicture; } PicturePtr CreatePicture (Picture pid, DrawablePtr pDrawable, PictFormatPtr pFormat, Mask vmask, XID *vlist, ClientPtr client, int *error) { PicturePtr pPicture; PictureScreenPtr ps = GetPictureScreen(pDrawable->pScreen); pPicture = AllocatePicture (pDrawable->pScreen); if (!pPicture) { *error = BadAlloc; return 0; } pPicture->id = pid; pPicture->pDrawable = pDrawable; pPicture->pFormat = pFormat; pPicture->format = pFormat->format | (pDrawable->bitsPerPixel << 24); if (pDrawable->type == DRAWABLE_PIXMAP) { #ifdef NXAGENT_SERVER /* * Let picture always point to the virtual pixmap. * For sure this is not the best way to deal with * the virtual frame-buffer. */ pPicture->pDrawable = nxagentVirtualDrawable(pDrawable); #endif ++((PixmapPtr)pDrawable)->refcnt; pPicture->pNext = 0; } else { pPicture->pNext = GetPictureWindow(((WindowPtr) pDrawable)); SetPictureWindow(((WindowPtr) pDrawable), pPicture); } SetPictureToDefaults (pPicture); if (vmask) *error = ChangePicture (pPicture, vmask, vlist, 0, client); else *error = Success; if (*error == Success) *error = (*ps->CreatePicture) (pPicture); if (*error != Success) { FreePicture (pPicture, (XID) 0); pPicture = 0; } return pPicture; } PicturePtr CreateSolidPicture (Picture pid, xRenderColor *color, int *error) { PicturePtr pPicture; pPicture = createSourcePicture(); if (!pPicture) { *error = BadAlloc; return 0; } pPicture->id = pid; pPicture->pSourcePict = (SourcePictPtr) calloc(1, sizeof(PictSolidFill)); if (!pPicture->pSourcePict) { *error = BadAlloc; free(pPicture); return 0; } pPicture->pSourcePict->type = SourcePictTypeSolidFill; pPicture->pSourcePict->solidFill.color = xRenderColorToCard32(*color); pPicture->pSourcePict->solidFill.fullColor.alpha=color->alpha; pPicture->pSourcePict->solidFill.fullColor.red=color->red; pPicture->pSourcePict->solidFill.fullColor.green=color->green; pPicture->pSourcePict->solidFill.fullColor.blue=color->blue; return pPicture; } static PicturePtr createSourcePicture(void) { /* * Compute size of entire PictureRect, plus privates. */ unsigned int totalPictureSize = sizeof(PictureRec) + picturePrivateCount * sizeof(DevUnion) + sizeof(nxagentPrivPictureRec); PicturePtr pPicture = (PicturePtr) calloc(1, totalPictureSize); if (!pPicture) return 0; if (pPicture != NULL) { DevUnion *ppriv = (DevUnion *) (pPicture + 1); for (int i = 0; i < picturePrivateCount; ++i) { /* * Other privates are inaccessible. */ ppriv[i].ptr = NULL; } char *privPictureRecAddr = (char *) &ppriv[picturePrivateCount]; ppriv[nxagentPicturePrivateIndex].ptr = (void *) privPictureRecAddr; pPicture -> devPrivates = ppriv; nxagentPicturePriv(pPicture) -> picture = 0; } pPicture->pDrawable = 0; pPicture->pFormat = 0; pPicture->pNext = 0; SetPictureToDefaults(pPicture); return pPicture; } int FreePicture (void * value, XID pid) { PicturePtr pPicture = (PicturePtr) value; if (--pPicture->refcnt == 0) { nxagentDestroyPicture(pPicture); if (pPicture->transform) free (pPicture->transform); if (!pPicture->pDrawable) { if (pPicture->pSourcePict) { if (pPicture->pSourcePict->type != SourcePictTypeSolidFill) free(pPicture->pSourcePict->linear.stops); free(pPicture->pSourcePict); } } else { ScreenPtr pScreen = pPicture->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); if (pPicture->alphaMap) FreePicture ((void *) pPicture->alphaMap, (XID) 0); (*ps->DestroyPicture) (pPicture); (*ps->DestroyPictureClip) (pPicture); if (pPicture->pDrawable->type == DRAWABLE_WINDOW) { WindowPtr pWindow = (WindowPtr) pPicture->pDrawable; PicturePtr *pPrev; for (pPrev = (PicturePtr *) &((pWindow)->devPrivates[PictureWindowPrivateIndex].ptr); *pPrev; pPrev = &(*pPrev)->pNext) { if (*pPrev == pPicture) { *pPrev = pPicture->pNext; break; } } } else if (pPicture->pDrawable->type == DRAWABLE_PIXMAP) { (*pScreen->DestroyPixmap) ((PixmapPtr)pPicture->pDrawable); } } free (pPicture); } return Success; } #ifndef True # define True 1 #endif #ifndef False # define False 0 #endif void nxagentReconnectPictFormat(void*, XID, void*); Bool nxagentReconnectAllPictFormat(void *p) { PictFormatPtr formats_old, formats; int nformats, nformats_old; VisualPtr pVisual; Bool success = True; Bool matched; int i, n; CARD32 type, a, r, g, b; #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_PICTFORMAT_DEBUG) fprintf(stderr, "nxagentReconnectAllPictFormat\n"); #endif formats_old = GetPictureScreen(nxagentDefaultScreen) -> formats; nformats_old = GetPictureScreen(nxagentDefaultScreen) -> nformats; /* * TODO: We could copy PictureCreateDefaultFormats, * in order not to waste ID with FakeClientID(). */ formats = PictureCreateDefaultFormats (nxagentDefaultScreen, &nformats); if (!formats) return False; for (n = 0; n < nformats; n++) { if (formats[n].type == PictTypeIndexed) { pVisual = nxagentVisualFromID(nxagentDefaultScreen, formats[n].index.vid); if ((pVisual->class | DynamicClass) == PseudoColor) type = PICT_TYPE_COLOR; else type = PICT_TYPE_GRAY; a = r = g = b = 0; } else { if ((formats[n].direct.redMask| formats[n].direct.blueMask| formats[n].direct.greenMask) == 0) type = PICT_TYPE_A; else if (formats[n].direct.red > formats[n].direct.blue) type = PICT_TYPE_ARGB; else type = PICT_TYPE_ABGR; a = Ones (formats[n].direct.alphaMask); r = Ones (formats[n].direct.redMask); g = Ones (formats[n].direct.greenMask); b = Ones (formats[n].direct.blueMask); } formats[n].format = PICT_FORMAT(0,type,a,r,g,b); } for (n = 0; n < nformats_old; n++) { for (i = 0, matched = False; (!matched) && (i < nformats); i++) { if (formats_old[n].format == formats[i].format && formats_old[n].type == formats[i].type && formats_old[n].direct.red == formats[i].direct.red && formats_old[n].direct.green == formats[i].direct.green && formats_old[n].direct.blue == formats[i].direct.blue && formats_old[n].direct.redMask == formats[i].direct.redMask && formats_old[n].direct.greenMask == formats[i].direct.greenMask && formats_old[n].direct.blueMask == formats[i].direct.blueMask && formats_old[n].direct.alpha == formats[i].direct.alpha && formats_old[n].direct.alphaMask == formats[i].direct.alphaMask) { /* * Regard depth 16 and 15 as were the same, if all other values match. */ if ((formats_old[n].depth == formats[i].depth) || ((formats_old[n].depth == 15 || formats_old[n].depth == 16) && (formats[i].depth == 15 || formats[i].depth == 16))) { matched = True; } } } if (!matched) { return False; } } free(formats); /* TODO: Perhaps do i have to do PictureFinishInit ?. */ /* TODO: We have to check for new Render protocol version. */ for (i = 0; (i < MAXCLIENTS) && (success); i++) { if (clients[i]) { FindClientResourcesByType(clients[i], PictFormatType, nxagentReconnectPictFormat, &success); } } return success; } /* * It seem we don't have nothing * to do for reconnect PictureFormat. */ void nxagentReconnectPictFormat(void *p0, XID x1, void *p2) { #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_PICTFORMAT_DEBUG) fprintf(stderr, "nxagentReconnectPictFormat.\n"); #endif } /* * The set of picture formats may change considerably * between different X servers. This poses a problem * while migrating NX sessions, because a requisite to * successfully reconnect the session is that all pic- * ture formats have to be available on the new X server. * To reduce such problems, we use a limited set of * pictures available on the most X servers. */ void nxagentPictureCreateDefaultFormats(ScreenPtr pScreen, FormatInitRec *formats, int *nformats) { DepthPtr pDepth; VisualPtr pVisual; CARD32 format; CARD8 depth; int r, g, b; int bpp; int d; int v; formats[*nformats].format = PICT_a1; formats[*nformats].depth = 1; *nformats += 1; formats[*nformats].format = PICT_a4; formats[*nformats].depth = 4; *nformats += 1; formats[*nformats].format = PICT_a8; formats[*nformats].depth = 8; *nformats += 1; formats[*nformats].format = PICT_a8r8g8b8; formats[*nformats].depth = 32; *nformats += 1; /* * This format should be required by the * protocol, but it's not used by Xgl. * * formats[*nformats].format = PICT_x8r8g8b8; * formats[*nformats].depth = 32; * *nformats += 1; */ /* now look through the depths and visuals adding other formats */ for (v = 0; v < pScreen->numVisuals; v++) { pVisual = &pScreen->visuals[v]; depth = visualDepth (pScreen, pVisual); if (!depth) continue; bpp = BitsPerPixel (depth); switch (pVisual->class) { case DirectColor: case TrueColor: r = Ones (pVisual->redMask); g = Ones (pVisual->greenMask); b = Ones (pVisual->blueMask); if (pVisual->offsetBlue == 0 && pVisual->offsetGreen == b && pVisual->offsetRed == b + g) { format = PICT_FORMAT(bpp, PICT_TYPE_ARGB, 0, r, g, b); *nformats = addFormat (formats, *nformats, format, depth); } break; case StaticColor: case PseudoColor: case StaticGray: case GrayScale: break; } } for (d = 0; d < pScreen -> numDepths; d++) { pDepth = &pScreen -> allowedDepths[d]; bpp = BitsPerPixel(pDepth -> depth); switch (bpp) { case 16: if (pDepth->depth == 15) { *nformats = addFormat (formats, *nformats, PICT_x1r5g5b5, pDepth->depth); } if (pDepth->depth == 16) { *nformats = addFormat (formats, *nformats, PICT_r5g6b5, pDepth->depth); } break; case 24: if (pDepth->depth == 24) { *nformats = addFormat (formats, *nformats, PICT_r8g8b8, pDepth->depth); } break; case 32: if (pDepth->depth == 24) { *nformats = addFormat (formats, *nformats, PICT_x8r8g8b8, pDepth->depth); } break; } } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXpicturestr_PictSolidFill.h0000644000000000000000000000651313614532331024266 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * $Id: picturestr.h,v 1.15 2005/12/09 18:35:21 ajax Exp $ * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ /* this header file gets included into Xserver/render/picturestr.h */ #ifndef NX_PICTURESTR_PICTSOLIDFILL_H #define NX_PICTURESTR_PICTSOLIDFILL_H 1 typedef struct _PictSolidFill { unsigned int type; CARD32 color; xRenderColor fullColor; } PictSolidFill, *PictSolidFillPtr; #endif /* NX_PICTURESTR_PICTSOLIDFILL_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c0000644000000000000000000004342613614532331021164 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "../../dix/property.c" #include "Options.h" #include "Rootless.h" #include "Client.h" #include "Windows.h" extern Atom clientCutProperty; #ifdef NXAGENT_SERVER typedef struct { CARD32 state; Window icon; } nxagentWMStateRec; #endif #define PANIC #define WARNING #undef TEST #undef DEBUG #ifdef NXAGENT_CLIPBOARD extern WindowPtr nxagentGetClipboardWindow(Atom); #endif #ifdef NXAGENT_ARTSD extern Atom mcop_local_atom; #endif int ProcChangeProperty(ClientPtr client) { WindowPtr pWin; char format, mode; unsigned long len; int sizeInBytes; int totalSize; int err; REQUEST(xChangePropertyReq); REQUEST_AT_LEAST_SIZE(xChangePropertyReq); UpdateCurrentTime(); format = stuff->format; mode = stuff->mode; if ((mode != PropModeReplace) && (mode != PropModeAppend) && (mode != PropModePrepend)) { client->errorValue = mode; return BadValue; } if ((format != 8) && (format != 16) && (format != 32)) { client->errorValue = format; return BadValue; } len = stuff->nUnits; if (len > ((0xffffffff - sizeof(xChangePropertyReq)) >> 2)) return BadLength; sizeInBytes = format>>3; totalSize = len * sizeInBytes; REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize); #ifdef NXAGENT_CLIPBOARD pWin = nxagentGetClipboardWindow(stuff->property); if (pWin == NULL) #endif pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixWriteAccess); if (!pWin) return(BadWindow); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return(BadAtom); } if (!ValidAtom(stuff->type)) { client->errorValue = stuff->type; return(BadAtom); } #ifdef XCSECURITY switch (SecurityCheckPropertyAccess(client, pWin, stuff->property, DixWriteAccess)) { case SecurityErrorOperation: client->errorValue = stuff->property; return BadAtom; case SecurityIgnoreOperation: return Success; } #endif #ifdef NXAGENT_ARTSD { /* Do not process MCOPGLOBALS property changes, they are already set reflecting the server side settings. Just return success. */ if (stuff->property == mcop_local_atom) return client->noClientException; } #endif #ifdef NXAGENT_SERVER /* prevent clients from changing the NX_AGENT_VERSION property */ { Atom prop = MakeAtom("NX_AGENT_VERSION", strlen("NX_AGENT_VERSION"), True); if (stuff->property == prop) return client->noClientException; } #endif err = ChangeWindowProperty(pWin, stuff->property, stuff->type, (int)format, (int)mode, len, (void *)&stuff[1], TRUE); if (err != Success) return err; else { if (nxagentOption(Rootless) == 1) { nxagentExportProperty(pWin, stuff->property, stuff->type, (int) format, (int) mode, len, (void *) &stuff[1]); } nxagentGuessClientHint(client, stuff->property, (char *) &stuff[1]); nxagentGuessShadowHint(client, stuff->property); #ifdef NX_DEBUG_INPUT nxagentGuessDumpInputInfo(client, stuff->property, (char *) &stuff[1]); #endif return client->noClientException; } } int ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, int mode, unsigned long len, void * value, Bool sendevent) { int sizeInBytes = format>>3; int totalSize = len * sizeInBytes; int copySize = nxagentOption(CopyBufferSize); if (copySize != COPY_UNLIMITED && property == clientCutProperty) { if (totalSize > copySize) { totalSize = copySize; totalSize = totalSize - (totalSize % sizeInBytes); len = totalSize / sizeInBytes; } } return Xorg_ChangeWindowProperty(pWin, property, type, format, mode, len, value, sendevent); } /***************** * GetProperty * If type Any is specified, returns the property from the specified * window regardless of its type. If a type is specified, returns the * property only if its type equals the specified type. * If delete is True and a property is returned, the property is also * deleted from the window and a PropertyNotify event is generated on the * window. *****************/ int ProcGetProperty(ClientPtr client) { PropertyPtr pProp, prevProp; unsigned long n, len, ind; WindowPtr pWin; xGetPropertyReply reply; REQUEST(xGetPropertyReq); REQUEST_SIZE_MATCH(xGetPropertyReq); if (stuff->delete) UpdateCurrentTime(); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixReadAccess); if (!pWin) return BadWindow; if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return(BadAtom); } if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) { client->errorValue = stuff->delete; return(BadValue); } if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type)) { client->errorValue = stuff->type; return(BadAtom); } pProp = wUserProps (pWin); prevProp = (PropertyPtr)NULL; while (pProp) { if (pProp->propertyName == stuff->property) break; prevProp = pProp; pProp = pProp->next; } memset(&reply, 0, sizeof(xGetPropertyReply)); reply.type = X_Reply; reply.sequenceNumber = client->sequence; #ifdef NXAGENT_SERVER /* * Creating a reply for WM_STATE property if it doesn't exist. * This is intended to allow drag & drop work in JAva 1.6 when * the agent is connected to NXWin in multiwindow mode. */ if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin) && (!pProp) && strcmp(NameForAtom(stuff->property), "WM_STATE") == 0) { nxagentWMStateRec wmState; nxagentWMStateRec *wmsP = &wmState; memset(&wmState, 0, sizeof(nxagentWMStateRec)); wmState.state = 1; wmState.icon = None; if (ChangeWindowProperty(pWin, stuff->property, stuff->property, 32, 0, 2, &wmState, 1) == Success) { nxagentExportProperty(pWin, stuff->property, stuff->property, 32, 0, 2, &wmState); } n = 8; ind = stuff->longOffset << 2; if (n < ind) { client->errorValue = stuff->longOffset; return BadValue; } len = min(n - ind, 4 * stuff->longLength); reply.bytesAfter = n - (ind + len); reply.length = (len + 3) >> 2; reply.format = 32; reply.nItems = len / 4; reply.propertyType = stuff->property; WriteReplyToClient(client, sizeof(xGenericReply), &reply); if (len) { client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; WriteSwappedDataToClient(client, len, (char *)wmsP + ind); } return(client->noClientException); } #endif if (!pProp) return NullPropertyReply(client, None, 0, &reply); #ifdef XCSECURITY { Mask access_mode = DixReadAccess; if (stuff->delete) access_mode |= DixDestroyAccess; switch(SecurityCheckPropertyAccess(client, pWin, stuff->property, access_mode)) { case SecurityErrorOperation: client->errorValue = stuff->property; return BadAtom;; case SecurityIgnoreOperation: return NullPropertyReply(client, pProp->type, pProp->format, &reply); } } #endif /* If the request type and actual type don't match. Return the property information, but not the data. */ if (((stuff->type != pProp->type) && (stuff->type != AnyPropertyType)) ) { reply.bytesAfter = pProp->size; reply.format = pProp->format; reply.length = 0; reply.nItems = 0; reply.propertyType = pProp->type; WriteReplyToClient(client, sizeof(xGenericReply), &reply); return(Success); } /* * Return type, format, value to client */ n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */ ind = stuff->longOffset << 2; /* If longOffset is invalid such that it causes "len" to be negative, it's a value error. */ if (n < ind) { client->errorValue = stuff->longOffset; return BadValue; } len = min(n - ind, 4 * stuff->longLength); reply.bytesAfter = n - (ind + len); reply.format = pProp->format; reply.length = (len + 3) >> 2; reply.nItems = len / (pProp->format / 8 ); reply.propertyType = pProp->type; if (stuff->delete && (reply.bytesAfter == 0)) { /* send the event */ xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.u.type = PropertyNotify; event.u.property.window = pWin->drawable.id; event.u.property.state = PropertyDelete; event.u.property.atom = pProp->propertyName; event.u.property.time = currentTime.milliseconds; DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); } WriteReplyToClient(client, sizeof(xGenericReply), &reply); if (len) { switch (reply.format) { case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break; case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break; default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break; } WriteSwappedDataToClient(client, len, (char *)pProp->data + ind); } if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */ if (prevProp == (PropertyPtr)NULL) /* takes care of head */ { if (!(pWin->optional->userProps = pProp->next)) CheckWindowOptionalNeed (pWin); } else prevProp->next = pProp->next; free(pProp->data); free(pProp); } return(client->noClientException); } #ifdef NXAGENT_CLIPBOARD /* GetWindowProperty clipboard use only */ /* FIXME: that's wrong, it is also called in Window.c and Events. */ /* FIXME: should be moved to a different file, is not derived from dix */ int GetWindowProperty(pWin, property, longOffset, longLength, delete, type, actualType, format, nItems, bytesAfter, propData ) WindowPtr pWin; Atom property; long longOffset; long longLength; Bool delete; Atom type; Atom *actualType; int *format; unsigned long *nItems; unsigned long *bytesAfter; unsigned char **propData; { PropertyPtr pProp, prevProp; unsigned long n, len, ind; if (!pWin) { #ifdef DEBUG fprintf(stderr, "%s: invalid window\n", __func__); #endif return BadWindow; } if (!ValidAtom(property)) { #ifdef DEBUG fprintf(stderr, "%s: invalid atom [%d]\n", __func__, property); #endif return(BadAtom); } if ((type != AnyPropertyType) && !ValidAtom(type)) { #ifdef DEBUG fprintf(stderr, "%s: invalid type [%d]\n", __func__, type); #endif return(BadAtom); } pProp = wUserProps (pWin); prevProp = (PropertyPtr)NULL; while (pProp) { if (pProp->propertyName == property) break; prevProp = pProp; pProp = pProp->next; } if (!pProp) { #ifdef DEBUG fprintf(stderr, "%s: property not found [%d]\n", __func__, property); #endif return (BadAtom); } /* If the request type and actual type don't match. Return the property information, but not the data. */ if (((type != pProp->type) && (type != AnyPropertyType)) ) { *bytesAfter = pProp->size; *format = pProp->format; *nItems = 0; *actualType = pProp->type; return(Success); } /* * Return type, format, value to client */ n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */ ind = longOffset << 2; /* If longOffset is invalid such that it causes "len" to be negative, it's a value error. */ if (n < ind) { #ifdef DEBUG fprintf(stderr, "%s: negative property len\n", __func__); #endif return BadValue; } len = min(n - ind, 4 * longLength); *bytesAfter = n - (ind + len); *format = pProp->format; *nItems = len / (pProp->format / 8 ); *actualType = pProp->type; if (delete && (*bytesAfter == 0)) { /* send the event */ xEvent event = {0}; event.u.u.type = PropertyNotify; event.u.property.window = pWin->drawable.id; event.u.property.state = PropertyDelete; event.u.property.atom = pProp->propertyName; event.u.property.time = currentTime.milliseconds; DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); } if (len) { *propData = (unsigned char *)(pProp->data) + ind; } if (delete && (*bytesAfter == 0)) { /* delete the Property */ if (prevProp == (PropertyPtr)NULL) /* takes care of head */ { if (!(pWin->optional->userProps = pProp->next)) CheckWindowOptionalNeed (pWin); } else prevProp->next = pProp->next; free(pProp->data); free(pProp); } return(Success); } #endif int ProcDeleteProperty(register ClientPtr client) { WindowPtr pWin; REQUEST(xDeletePropertyReq); int result; REQUEST_SIZE_MATCH(xDeletePropertyReq); UpdateCurrentTime(); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixWriteAccess); if (!pWin) return(BadWindow); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return (BadAtom); } #ifdef XCSECURITY switch(SecurityCheckPropertyAccess(client, pWin, stuff->property, DixDestroyAccess)) { case SecurityErrorOperation: client->errorValue = stuff->property; return BadAtom;; case SecurityIgnoreOperation: return Success; } #endif #ifdef NXAGENT_SERVER /* prevent clients from deleting the NX_AGENT_VERSION property */ { Atom prop = MakeAtom("NX_AGENT_VERSION", strlen("NX_AGENT_VERSION"), True); if (stuff->property == prop) return client->noClientException; } #endif result = DeleteProperty(pWin, stuff->property); if (client->noClientException != Success) return(client->noClientException); else return(result); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXrender.c0000644000000000000000000014054613614532331020560 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #include "../render/render.c" #include "Trap.h" #include "Render.h" #include "Pixmaps.h" #include "Options.h" #include "Screen.h" #include "Cursor.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG #ifdef TEST #include "Literals.h" #endif /* * From NXglyph.c. */ extern void GlyphExtents(int nlist, GlyphListPtr list, GlyphPtr *glyphs, BoxPtr extents); /* * From NXmitrap.c. */ extern void miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box); /* * Functions from Render.c. */ extern int nxagentCursorSaveRenderInfo(ScreenPtr, CursorPtr); extern void nxagentCursorPostSaveRenderInfo(CursorPtr, ScreenPtr, PicturePtr, int, int); extern void nxagentRenderRealizeCursor(ScreenPtr, CursorPtr); extern int nxagentCreatePicture(PicturePtr, Mask); extern void nxagentChangePicture(PicturePtr, Mask); extern int nxagentChangePictureClip(PicturePtr, int, int, xRectangle *, int, int); extern void nxagentComposite(CARD8, PicturePtr, PicturePtr, PicturePtr, INT16, INT16, INT16, INT16, INT16, INT16, CARD16, CARD16); extern void nxagentCompositeRects(CARD8, PicturePtr, xRenderColor *, int, xRectangle *); extern void nxagentCreateGlyphSet(GlyphSetPtr glyphSet); extern void nxagentReferenceGlyphSet(GlyphSetPtr glyphSet); extern void nxagentFreeGlyphs(GlyphSetPtr glyphSet, CARD32 *gids, int nglyph); extern void nxagentFreeGlyphSet(GlyphSetPtr glyphSet); extern void nxagentSetPictureTransform(PicturePtr pPicture, void * transform); extern void nxagentSetPictureFilter(PicturePtr pPicture, char *filter, int name_size, void * params, int nparams); extern void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps); extern void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color); extern void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1, xPointFixed *p2, int nStops, xFixed *stops, xRenderColor *colors); extern void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner, xPointFixed *outer, xFixed innerRadius, xFixed outerRadius, int nStops, xFixed *stops, xRenderColor *colors); extern void nxagentRenderCreateConicalGradient(PicturePtr pPicture, xPointFixed *center, xFixed angle, int nStops, xFixed *stops, xRenderColor *colors); #ifdef NXAGENT_SERVER extern int nxagentAlphaEnabled; #endif /* * The void pointer is actually a XGlyphElt8. */ void nxagentGlyphs(CARD8, PicturePtr, PicturePtr, PictFormatPtr, INT16, INT16, int, void *, int, GlyphPtr *); static int ProcRenderQueryVersion (ClientPtr client) { RenderClientPtr pRenderClient = GetRenderClient (client); xRenderQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, #ifdef NXAGENT_SERVER .majorVersion = nxagentRenderVersionMajor, .minorVersion = nxagentRenderVersionMinor #else .majorVersion = SERVER_RENDER_MAJOR_VERSION, .minorVersion = SERVER_RENDER_MINOR_VERSION #endif }; REQUEST(xRenderQueryVersionReq); REQUEST_SIZE_MATCH(xRenderQueryVersionReq); pRenderClient->major_version = stuff->majorVersion; pRenderClient->minor_version = stuff->minorVersion; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.majorVersion); swapl(&rep.minorVersion); } WriteToClient(client, sizeof(xRenderQueryVersionReply), &rep); return (client->noClientException); } static int ProcRenderQueryPictFormats (ClientPtr client) { RenderClientPtr pRenderClient = GetRenderClient (client); xRenderQueryPictFormatsReply *reply; xPictScreen *pictScreen; xPictDepth *pictDepth; xPictVisual *pictVisual; xPictFormInfo *pictForm; CARD32 *pictSubpixel; ScreenPtr pScreen; VisualPtr pVisual; DepthPtr pDepth; int v, d; PictureScreenPtr ps; PictFormatPtr pFormat; int nformat; int ndepth; int nvisual; int rlength; int s; int numScreens; int numSubpixel; /* REQUEST(xRenderQueryPictFormatsReq); */ REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq); #ifdef PANORAMIX if (noPanoramiXExtension) numScreens = screenInfo.numScreens; else numScreens = ((xConnSetup *)ConnectionInfo)->numRoots; #else numScreens = screenInfo.numScreens; #endif ndepth = nformat = nvisual = 0; for (s = 0; s < numScreens; s++) { pScreen = screenInfo.screens[s]; for (d = 0; d < pScreen->numDepths; d++) { pDepth = pScreen->allowedDepths + d; ++ndepth; for (v = 0; v < pDepth->numVids; v++) { pVisual = findVisual (pScreen, pDepth->vids[v]); if (pVisual && PictureMatchVisual (pScreen, pDepth->depth, pVisual)) ++nvisual; } } ps = GetPictureScreenIfSet(pScreen); if (ps) nformat += ps->nformats; } if (pRenderClient->major_version == 0 && pRenderClient->minor_version < 6) numSubpixel = 0; else numSubpixel = numScreens; rlength = (sizeof (xRenderQueryPictFormatsReply) + nformat * sizeof (xPictFormInfo) + numScreens * sizeof (xPictScreen) + ndepth * sizeof (xPictDepth) + nvisual * sizeof (xPictVisual) + numSubpixel * sizeof (CARD32)); reply = (xRenderQueryPictFormatsReply *) malloc (rlength); if (!reply) return BadAlloc; memset(reply, 0, rlength); reply->type = X_Reply; reply->sequenceNumber = client->sequence; reply->length = (rlength - sizeof(xGenericReply)) >> 2; reply->numFormats = nformat; reply->numScreens = numScreens; reply->numDepths = ndepth; reply->numVisuals = nvisual; reply->numSubpixel = numSubpixel; pictForm = (xPictFormInfo *) (reply + 1); for (s = 0; s < numScreens; s++) { pScreen = screenInfo.screens[s]; ps = GetPictureScreenIfSet(pScreen); if (ps) { for (nformat = 0, pFormat = ps->formats; nformat < ps->nformats; nformat++, pFormat++) { pictForm->id = pFormat->id; pictForm->type = pFormat->type; pictForm->depth = pFormat->depth; pictForm->direct.red = pFormat->direct.red; pictForm->direct.redMask = pFormat->direct.redMask; pictForm->direct.green = pFormat->direct.green; pictForm->direct.greenMask = pFormat->direct.greenMask; pictForm->direct.blue = pFormat->direct.blue; pictForm->direct.blueMask = pFormat->direct.blueMask; #ifdef NXAGENT_SERVER pictForm->direct.alpha = nxagentAlphaEnabled ? pFormat->direct.alpha : 0; #else pictForm->direct.alpha = pFormat->direct.alpha; #endif pictForm->direct.alphaMask = pFormat->direct.alphaMask; if (pFormat->type == PictTypeIndexed && pFormat->index.pColormap) pictForm->colormap = pFormat->index.pColormap->mid; else pictForm->colormap = None; if (client->swapped) { swapl (&pictForm->id); swaps (&pictForm->direct.red); swaps (&pictForm->direct.redMask); swaps (&pictForm->direct.green); swaps (&pictForm->direct.greenMask); swaps (&pictForm->direct.blue); swaps (&pictForm->direct.blueMask); swaps (&pictForm->direct.alpha); swaps (&pictForm->direct.alphaMask); swapl (&pictForm->colormap); } pictForm++; } } } pictScreen = (xPictScreen *) pictForm; for (s = 0; s < numScreens; s++) { pScreen = screenInfo.screens[s]; pictDepth = (xPictDepth *) (pictScreen + 1); ndepth = 0; for (d = 0; d < pScreen->numDepths; d++) { pictVisual = (xPictVisual *) (pictDepth + 1); pDepth = pScreen->allowedDepths + d; nvisual = 0; for (v = 0; v < pDepth->numVids; v++) { pVisual = findVisual (pScreen, pDepth->vids[v]); if (pVisual && (pFormat = PictureMatchVisual (pScreen, pDepth->depth, pVisual))) { pictVisual->visual = pVisual->vid; pictVisual->format = pFormat->id; if (client->swapped) { swapl (&pictVisual->visual); swapl (&pictVisual->format); } pictVisual++; nvisual++; } } pictDepth->depth = pDepth->depth; pictDepth->nPictVisuals = nvisual; if (client->swapped) { swaps (&pictDepth->nPictVisuals); } ndepth++; pictDepth = (xPictDepth *) pictVisual; } pictScreen->nDepth = ndepth; ps = GetPictureScreenIfSet(pScreen); if (ps) pictScreen->fallback = ps->fallback->id; else pictScreen->fallback = 0; if (client->swapped) { swapl (&pictScreen->nDepth); swapl (&pictScreen->fallback); } pictScreen = (xPictScreen *) pictDepth; } pictSubpixel = (CARD32 *) pictScreen; for (s = 0; s < numSubpixel; s++) { pScreen = screenInfo.screens[s]; ps = GetPictureScreenIfSet(pScreen); if (ps) *pictSubpixel = ps->subpixel; else *pictSubpixel = SubPixelUnknown; if (client->swapped) { swapl (pictSubpixel); } ++pictSubpixel; } if (client->swapped) { swaps (&reply->sequenceNumber); swapl (&reply->length); swapl (&reply->numFormats); swapl (&reply->numScreens); swapl (&reply->numDepths); swapl (&reply->numVisuals); swapl (&reply->numSubpixel); } WriteToClient(client, rlength, reply); free (reply); return client->noClientException; } static int ProcRenderCreatePicture (ClientPtr client) { PicturePtr pPicture; DrawablePtr pDrawable; PictFormatPtr pFormat; int len; int error; REQUEST(xRenderCreatePictureReq); REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); LEGAL_NEW_RESOURCE(stuff->pid, client); SECURITY_VERIFY_DRAWABLE(pDrawable, stuff->drawable, client, DixWriteAccess); pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, DixReadAccess); if (!pFormat) { client->errorValue = stuff->format; return RenderErrBase + BadPictFormat; } if (pFormat->depth != pDrawable->depth) return BadMatch; len = client->req_len - (sizeof(xRenderCreatePictureReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; pPicture = CreatePicture (stuff->pid, pDrawable, pFormat, stuff->mask, (XID *) (stuff + 1), client, &error); if (!pPicture) return error; #ifdef NXAGENT_SERVER /* FIXME: shouldn't this be integrated into CreatePicture? */ nxagentCreatePicture(pPicture, stuff -> mask); #endif if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } static int ProcRenderChangePicture (ClientPtr client) { PicturePtr pPicture; REQUEST(xRenderChangePictureReq); int len; REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); len = client->req_len - (sizeof(xRenderChangePictureReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; #ifdef NXAGENT_SERVER { int error = ChangePicture (pPicture, stuff->mask, (XID *) (stuff + 1), (DevUnion *) 0, client); nxagentChangePicture(pPicture, stuff->mask); return error; } #else return ChangePicture (pPicture, stuff->mask, (XID *) (stuff + 1), (DevUnion *) 0, client); #endif } static int ProcRenderSetPictureClipRectangles (ClientPtr client) { REQUEST(xRenderSetPictureClipRectanglesReq); PicturePtr pPicture; int nr; int result; REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pPicture->pDrawable) return BadDrawable; #ifdef NXAGENT_SERVER /* * The original code used sizeof(xRenderChangePictureReq). * This was harmless, as both structures have the same size. * * nr = (client->req_len << 2) - sizeof(xRenderChangePictureReq); */ nr = (client->req_len << 2) - sizeof(xRenderSetPictureClipRectanglesReq); #else nr = (client->req_len << 2) - sizeof(xRenderChangePictureReq); #endif if (nr & 4) return BadLength; nr >>= 3; result = SetPictureClipRects (pPicture, stuff->xOrigin, stuff->yOrigin, nr, (xRectangle *) &stuff[1]); #ifdef NXAGENT_SERVER nxagentChangePictureClip (pPicture, CT_NONE, nr, (xRectangle *) &stuff[1], (int)stuff -> xOrigin, (int)stuff -> yOrigin); #endif if (client->noClientException != Success) return(client->noClientException); else return(result); } /* * Check if both pictures have drawables which are * virtual pixmaps. See the corresponding define * in NXpicture.c */ #define NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL #ifdef NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL #define nxagentCompositePredicate(pSrc, pDst) TRUE #else /* * This is still under development. The final * goal is to let pictures point to the real * pixmaps instead of pointing to virtuals. */ int nxagentCompositePredicate(PicturePtr pSrc, PicturePtr pDst) { PixmapPtr pPixmap1; PixmapPtr pPixmap2; pPixmap1 = (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? ((PixmapPtr) pSrc -> pDrawable) : NULL); pPixmap2 = (pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? ((PixmapPtr) pDst -> pDrawable) : NULL); if (pPixmap1 == NULL || pPixmap2 == NULL) { #ifdef TEST fprintf(stderr, "nxagentCompositePredicate: Case 0.\n"); #endif return FALSE; } else { #ifdef TEST fprintf(stderr, "nxagentCompositePredicate: Case 1.\n"); #endif if (nxagentPixmapIsVirtual(pPixmap1) == 1 && nxagentPixmapIsVirtual(pPixmap2) == 1) { #ifdef TEST fprintf(stderr, "nxagentCompositePredicate: Case 2.\n"); #endif return TRUE; } } #ifdef TEST fprintf(stderr, "nxagentCompositePredicate: Case 3.\n"); #endif return FALSE; } #endif static int ProcRenderComposite (ClientPtr client) { PicturePtr pSrc, pMask, pDst; REQUEST(xRenderCompositeReq); REQUEST_SIZE_MATCH(xRenderCompositeReq); if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_ALPHA (pMask, stuff->mask, client, DixReadAccess, RenderErrBase + BadPicture); if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) || (pMask && pMask->pDrawable && pDst->pDrawable->pScreen != pMask->pDrawable->pScreen)) return BadMatch; ValidatePicture (pSrc); if (pMask) ValidatePicture (pMask); ValidatePicture (pDst); #ifdef NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL if (nxagentCompositePredicate(pSrc, pDst)) { #ifdef TEST fprintf(stderr, "ProcRenderComposite: Going to composite with " "source at [%p] mask at [%p] and destination at [%p].\n", (void *) pSrc, (void *) pMask, (void *) pDst); #endif CompositePicture (stuff->op, pSrc, pMask, pDst, stuff->xSrc, stuff->ySrc, stuff->xMask, stuff->yMask, stuff->xDst, stuff->yDst, stuff->width, stuff->height); } #else if (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP && pDst -> pDrawable -> type == DRAWABLE_PIXMAP && (!pMask || pMask -> pDrawable -> type == DRAWABLE_PIXMAP)) { PixmapPtr pVirtualPixmapSrc; PixmapPtr pVirtualPixmapDst; PixmapPtr pVirtualPixmapMask; PicturePtr pVirtualPictureSrc; PicturePtr pVirtualPictureDst; PicturePtr pVirtualPictureMask; pVirtualPixmapSrc = (PixmapPtr) pSrc -> pDrawable; pVirtualPictureSrc = nxagentPixmapPriv(pVirtualPixmapSrc) -> pPicture; pVirtualPixmapDst = (PixmapPtr) pDst -> pDrawable; pVirtualPictureDst = nxagentPixmapPriv(pVirtualPixmapDst) -> pPicture; if (pMask) { pVirtualPixmapMask = (PixmapPtr) pMask -> pDrawable; pVirtualPictureMask = nxagentPixmapPriv(pVirtualPixmapMask) -> pPicture; } else { pVirtualPixmapMask = NULL; pVirtualPictureMask = NULL; } if (pVirtualPictureSrc && pVirtualPictureDst) { #ifdef TEST fprintf(stderr, "ProcRenderComposite: Going to composite with " "source at [%p] mask at [%p] and destination at [%p].\n", (void *) pVirtualPixmapSrc, (void *) pVirtualPixmapMask, (void *) pVirtualPixmapDst); #endif CompositePicture (stuff->op, pVirtualPictureSrc, pVirtualPictureMask, pVirtualPictureDst, stuff->xSrc, stuff->ySrc, stuff->xMask, stuff->yMask, stuff->xDst, stuff->yDst, stuff->width, stuff->height); } } #endif nxagentComposite (stuff -> op, pSrc, pMask, pDst, stuff -> xSrc, stuff -> ySrc, stuff -> xMask, stuff -> yMask, stuff -> xDst, stuff -> yDst, stuff -> width, stuff -> height); return Success; } static int ProcRenderTrapezoids (ClientPtr client) { int ntraps; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrapezoidsReq); REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq); if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; return RenderErrBase + BadPictFormat; } } else pFormat = 0; ntraps = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq); if (ntraps % sizeof (xTrapezoid)) return BadLength; ntraps /= sizeof (xTrapezoid); if (ntraps) #ifdef NXAGENT_SERVER { if (pFormat != NULL) { if (nxagentTrapezoidExtents && nxagentTrapezoidExtents != NullBox) free(nxagentTrapezoidExtents); nxagentTrapezoidExtents = (BoxPtr) malloc(sizeof(BoxRec)); miTrapezoidBounds (ntraps, (xTrapezoid *) &stuff[1], nxagentTrapezoidExtents); } if (nxagentCompositePredicate(pSrc, pDst) == 1) { CompositeTrapezoids (stuff->op, pSrc, pDst, pFormat, stuff->xSrc, stuff->ySrc, ntraps, (xTrapezoid *) &stuff[1]); } nxagentTrapezoids (stuff->op, pSrc, pDst, pFormat, stuff->xSrc, stuff->ySrc, ntraps, (xTrapezoid *) &stuff[1]); if (nxagentTrapezoidExtents != NullBox) { free(nxagentTrapezoidExtents); nxagentTrapezoidExtents = NullBox; } } #else CompositeTrapezoids (stuff->op, pSrc, pDst, pFormat, stuff->xSrc, stuff->ySrc, ntraps, (xTrapezoid *) &stuff[1]); #endif return client->noClientException; } static int ProcRenderCreateGlyphSet (ClientPtr client) { GlyphSetPtr glyphSet; PictFormatPtr format; int f; REQUEST(xRenderCreateGlyphSetReq); REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq); LEGAL_NEW_RESOURCE(stuff->gsid, client); format = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, DixReadAccess); if (!format) { client->errorValue = stuff->format; return RenderErrBase + BadPictFormat; } switch (format->depth) { case 1: f = GlyphFormat1; break; case 4: f = GlyphFormat4; break; case 8: f = GlyphFormat8; break; case 16: f = GlyphFormat16; break; case 32: f = GlyphFormat32; break; default: return BadMatch; } if (format->type != PictTypeDirect) return BadMatch; glyphSet = AllocateGlyphSet (f, format); if (!glyphSet) return BadAlloc; if (!AddResource (stuff->gsid, GlyphSetType, (void *)glyphSet)) return BadAlloc; #ifdef NXAGENT_SERVER nxagentCreateGlyphSet(glyphSet); #endif return Success; } static int ProcRenderReferenceGlyphSet (ClientPtr client) { GlyphSetPtr glyphSet; REQUEST(xRenderReferenceGlyphSetReq); REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq); LEGAL_NEW_RESOURCE(stuff->gsid, client); glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->existing, GlyphSetType, DixWriteAccess); if (!glyphSet) { client->errorValue = stuff->existing; return RenderErrBase + BadGlyphSet; } glyphSet->refcnt++; #ifdef NXAGENT_SERVER nxagentReferenceGlyphSet(glyphSet); #endif if (!AddResource (stuff->gsid, GlyphSetType, (void *)glyphSet)) return BadAlloc; return client->noClientException; } static int ProcRenderFreeGlyphSet (ClientPtr client) { GlyphSetPtr glyphSet; REQUEST(xRenderFreeGlyphSetReq); REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, DixDestroyAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; return RenderErrBase + BadGlyphSet; } #ifdef NXAGENT_SERVER nxagentFreeGlyphSet(glyphSet); #endif FreeResource (stuff->glyphset, RT_NONE); return client->noClientException; } static int ProcRenderFreeGlyphs (ClientPtr client) { REQUEST(xRenderFreeGlyphsReq); GlyphSetPtr glyphSet; int nglyph; CARD32 *gids; CARD32 glyph; REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, DixWriteAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; return RenderErrBase + BadGlyphSet; } nglyph = ((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)) >> 2; gids = (CARD32 *) (stuff + 1); #ifdef NXAGENT_SERVER nxagentFreeGlyphs(glyphSet, gids, nglyph); #endif while (nglyph-- > 0) { glyph = *gids++; if (!DeleteGlyph (glyphSet, glyph)) { client->errorValue = glyph; return RenderErrBase + BadGlyph; } } return client->noClientException; } typedef struct XGlyphElt8{ GlyphSet glyphset; _Xconst char *chars; int nchars; int xOff; int yOff; } XGlyphElt8; static int ProcRenderCompositeGlyphs (ClientPtr client) { GlyphSetPtr glyphSet; GlyphSet gs; PicturePtr pSrc, pDst; PictFormatPtr pFormat; GlyphListRec listsLocal[NLOCALDELTA]; GlyphListPtr lists, listsBase; GlyphPtr glyphsLocal[NLOCALGLYPH]; Glyph glyph; GlyphPtr *glyphs, *glyphsBase; xGlyphElt *elt; CARD8 *buffer, *end; int nglyph; int nlist; int space; int size; int n; #ifdef NXAGENT_SERVER XGlyphElt8 *elements, *elementsBase; #endif REQUEST(xRenderCompositeGlyphsReq); REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq); switch (stuff->renderReqType) { default: size = 1; break; case X_RenderCompositeGlyphs16: size = 2; break; case X_RenderCompositeGlyphs32: size = 4; break; } if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; return RenderErrBase + BadPictFormat; } } else pFormat = 0; glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, DixReadAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; return RenderErrBase + BadGlyphSet; } buffer = (CARD8 *) (stuff + 1); end = (CARD8 *) stuff + (client->req_len << 2); nglyph = 0; nlist = 0; while (buffer + sizeof (xGlyphElt) < end) { elt = (xGlyphElt *) buffer; buffer += sizeof (xGlyphElt); if (elt->len == 0xff) { buffer += 4; } else { nlist++; nglyph += elt->len; space = size * elt->len; if (space & 3) space += 4 - (space & 3); buffer += space; } } if (nglyph <= NLOCALGLYPH) glyphsBase = glyphsLocal; else { glyphsBase = (GlyphPtr *) malloc (nglyph * sizeof (GlyphPtr)); if (!glyphsBase) return BadAlloc; } if (nlist <= NLOCALDELTA) listsBase = listsLocal; else { listsBase = (GlyphListPtr) malloc (nlist * sizeof (GlyphListRec)); if (!listsBase) { if (glyphsBase != glyphsLocal) free(glyphsBase); return BadAlloc; } } #ifdef NXAGENT_SERVER elementsBase = malloc(nlist * sizeof(XGlyphElt8)); if (!elementsBase) { if (glyphsBase != glyphsLocal) free(glyphsBase); if (listsBase != listsLocal) free(listsBase); return BadAlloc; } elements = elementsBase; #endif buffer = (CARD8 *) (stuff + 1); glyphs = glyphsBase; lists = listsBase; while (buffer + sizeof (xGlyphElt) < end) { elt = (xGlyphElt *) buffer; buffer += sizeof (xGlyphElt); if (elt->len == 0xff) { #ifdef NXAGENT_SERVER #ifdef DEBUG fprintf(stderr, "ProcRenderCompositeGlyphs: Glyphset change with base size [%d].\n", size); #endif #endif if (buffer + sizeof (GlyphSet) < end) { memcpy(&gs, buffer, sizeof(GlyphSet)); glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, gs, GlyphSetType, DixReadAccess); if (!glyphSet) { client->errorValue = gs; if (glyphsBase != glyphsLocal) free (glyphsBase); if (listsBase != listsLocal) free (listsBase); #ifdef NXAGENT_SERVER free(elementsBase); #endif return RenderErrBase + BadGlyphSet; } } buffer += 4; } else { lists->xOff = elt->deltax; lists->yOff = elt->deltay; lists->format = glyphSet->format; lists->len = 0; #ifdef NXAGENT_SERVER if (glyphSet -> remoteID == 0) { #ifdef TEST fprintf(stderr, "ProcRenderCompositeGlyphs: Going to reconnect glyphset at [%p].\n", (void *) glyphSet); #endif nxagentReconnectGlyphSet(glyphSet, (XID) 0, (void*) NULL); } elements -> glyphset = glyphSet -> remoteID; elements -> chars = (char *) buffer; elements -> nchars = elt->len; elements -> xOff = elt->deltax; elements -> yOff = elt->deltay; #endif n = elt->len; while (n--) { if (buffer + size <= end) { switch (size) { case 1: glyph = *((CARD8 *)buffer); break; case 2: glyph = *((CARD16 *)buffer); break; case 4: default: glyph = *((CARD32 *)buffer); break; } if ((*glyphs = FindGlyph (glyphSet, glyph))) { lists->len++; glyphs++; } } buffer += size; } space = size * elt->len; if (space & 3) buffer += 4 - (space & 3); lists++; #ifdef NXAGENT_SERVER elements++; #endif } } if (buffer > end) { if (glyphsBase != glyphsLocal) free(glyphsBase); if (listsBase != listsLocal) free(listsBase); #ifdef NXAGENT_SERVER free(elementsBase); #endif return BadLength; } #ifdef NXAGENT_SERVER /* * We need to know the glyphs extents to synchronize * the drawables involved in the composite text ope- * ration. Also we need to synchronize only the back- * ground of the text we are going to render, so the * operations on the framebuffer must be executed * after the X requests. */ nxagentGlyphsExtents = (BoxPtr) malloc(sizeof(BoxRec)); GlyphExtents(nlist, listsBase, glyphsBase, nxagentGlyphsExtents); nxagentGlyphs(stuff -> op, pSrc, pDst, pFormat, stuff -> xSrc, stuff -> ySrc, nlist, elementsBase, size, glyphsBase); if (nxagentCompositePredicate(pSrc, pDst) == 1) { #ifdef TEST fprintf(stderr, "ProcRenderCompositeGlyphs: Going to composite glyphs with " "source at [%p] and destination at [%p].\n", (void *) pSrc, (void *) pDst); #endif CompositeGlyphs(stuff -> op, pSrc, pDst, pFormat, stuff -> xSrc, stuff -> ySrc, nlist, listsBase, glyphsBase); } free(nxagentGlyphsExtents); nxagentGlyphsExtents = NullBox; free(elementsBase); #else CompositeGlyphs (stuff->op, pSrc, pDst, pFormat, stuff->xSrc, stuff->ySrc, nlist, listsBase, glyphsBase); #endif if (glyphsBase != glyphsLocal) free (glyphsBase); if (listsBase != listsLocal) free (listsBase); return client->noClientException; } static int ProcRenderFillRectangles (ClientPtr client) { PicturePtr pDst; int things; REQUEST(xRenderFillRectanglesReq); REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq); if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; things = (client->req_len << 2) - sizeof(xRenderFillRectanglesReq); if (things & 4) return(BadLength); things >>= 3; CompositeRects (stuff->op, pDst, &stuff->color, things, (xRectangle *) &stuff[1]); #ifdef NXAGENT_SERVER ValidatePicture (pDst); nxagentCompositeRects(stuff -> op, pDst, &stuff -> color, things, (xRectangle *) &stuff[1]); #endif return client->noClientException; } static int ProcRenderCreateCursor (ClientPtr client) { REQUEST(xRenderCreateCursorReq); PicturePtr pSrc; ScreenPtr pScreen; unsigned short width, height; CARD32 *argbbits, *argb; unsigned char *srcbits, *srcline; unsigned char *mskbits, *mskline; int stride; int x, y; int nbytes_mono; CursorMetricRec cm; CursorPtr pCursor; CARD32 twocolor[3]; int ncolor; REQUEST_SIZE_MATCH (xRenderCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); if (!pSrc->pDrawable) return BadDrawable; pScreen = pSrc->pDrawable->pScreen; width = pSrc->pDrawable->width; height = pSrc->pDrawable->height; if (height && width > UINT32_MAX/(height*sizeof(CARD32))) return BadAlloc; if ( stuff->x > width || stuff->y > height ) return (BadMatch); argbbits = malloc (width * height * sizeof (CARD32)); if (!argbbits) return (BadAlloc); stride = BitmapBytePad(width); nbytes_mono = stride*height; srcbits = (unsigned char *)malloc(nbytes_mono); if (!srcbits) { free (argbbits); return (BadAlloc); } mskbits = (unsigned char *)malloc(nbytes_mono); if (!mskbits) { free(argbbits); free(srcbits); return (BadAlloc); } bzero ((char *) mskbits, nbytes_mono); bzero ((char *) srcbits, nbytes_mono); if (pSrc->format == PICT_a8r8g8b8) { (*pScreen->GetImage) (pSrc->pDrawable, 0, 0, width, height, ZPixmap, 0xffffffff, (void *) argbbits); } else { PixmapPtr pPixmap; PicturePtr pPicture; PictFormatPtr pFormat; int error; pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8); if (!pFormat) { free (argbbits); free (srcbits); free (mskbits); return (BadImplementation); } pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32, CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) { free (argbbits); free (srcbits); free (mskbits); return (BadAlloc); } pPicture = CreatePicture (0, &pPixmap->drawable, pFormat, 0, 0, client, &error); if (!pPicture) { free (argbbits); free (srcbits); free (mskbits); return error; } (*pScreen->DestroyPixmap) (pPixmap); CompositePicture (PictOpSrc, pSrc, 0, pPicture, 0, 0, 0, 0, 0, 0, width, height); (*pScreen->GetImage) (pPicture->pDrawable, 0, 0, width, height, ZPixmap, 0xffffffff, (void *) argbbits); FreePicture (pPicture, 0); } /* * Check whether the cursor can be directly supported by * the core cursor code */ ncolor = 0; argb = argbbits; for (y = 0; ncolor <= 2 && y < height; y++) { for (x = 0; ncolor <= 2 && x < width; x++) { CARD32 p = *argb++; CARD32 a = (p >> 24); if (a == 0) /* transparent */ continue; if (a == 0xff) /* opaque */ { int n; for (n = 0; n < ncolor; n++) if (p == twocolor[n]) break; if (n == ncolor) twocolor[ncolor++] = p; } else ncolor = 3; } } /* * Convert argb image to two plane cursor */ srcline = srcbits; mskline = mskbits; argb = argbbits; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { CARD32 p = *argb++; if (ncolor <= 2) { CARD32 a = ((p >> 24)); SetBit (mskline, x, a != 0); SetBit (srcline, x, a != 0 && p == twocolor[0]); } else { CARD32 a = ((p >> 24) * DITHER_SIZE + 127) / 255; CARD32 i = ((CvtR8G8B8toY15(p) >> 7) * DITHER_SIZE + 127) / 255; CARD32 d = orderedDither[y&(DITHER_DIM-1)][x&(DITHER_DIM-1)]; /* Set mask from dithered alpha value */ SetBit(mskline, x, a > d); /* Set src from dithered intensity value */ SetBit(srcline, x, a > d && i <= d); } } srcline += stride; mskline += stride; } /* * Dither to white and black if the cursor has more than two colors */ if (ncolor > 2) { twocolor[0] = 0xff000000; twocolor[1] = 0xffffffff; } else { free (argbbits); argbbits = 0; } #define GetByte(p,s) (((p) >> (s)) & 0xff) #define GetColor(p,s) (GetByte(p,s) | (GetByte(p,s) << 8)) cm.width = width; cm.height = height; cm.xhot = stuff->x; cm.yhot = stuff->y; #ifdef NXAGENT_SERVER /* * This cursor uses RENDER, so we make sure * that it is allocated in a way that allows * the mi and dix layers to handle it but we * later create it on the server by mirror- * ing the RENDER operation we got from the * client. */ RealizeCursorProcPtr saveRealizeCursor = pScreen -> RealizeCursor; pScreen -> RealizeCursor = nxagentCursorSaveRenderInfo; #endif pCursor = AllocCursorARGB (srcbits, mskbits, argbbits, &cm, GetColor(twocolor[0], 16), GetColor(twocolor[0], 8), GetColor(twocolor[0], 0), GetColor(twocolor[1], 16), GetColor(twocolor[1], 8), GetColor(twocolor[1], 0)); #ifdef NXAGENT_SERVER pScreen -> RealizeCursor = saveRealizeCursor; /* * Store into the private data members the * information needed to recreate it at * reconnection. This is done in two steps * as in the first step we don't have the * picture info. */ if (pCursor == NULL) { return BadAlloc; } nxagentCursorPostSaveRenderInfo(pCursor, pScreen, pSrc, stuff -> x, stuff -> y); nxagentRenderRealizeCursor(pScreen, pCursor); #endif if (pCursor && AddResource(stuff->cid, RT_CURSOR, (void *)pCursor)) return (client->noClientException); return BadAlloc; } static int ProcRenderSetPictureTransform (ClientPtr client) { REQUEST(xRenderSetPictureTransformReq); PicturePtr pPicture; int result; REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); result = SetPictureTransform (pPicture, (PictTransform *) &stuff->transform); #ifdef NXAGENT_SERVER nxagentSetPictureTransform(pPicture, &stuff->transform); #endif if (client->noClientException != Success) return(client->noClientException); else return(result); } static int ProcRenderSetPictureFilter (ClientPtr client) { REQUEST (xRenderSetPictureFilterReq); PicturePtr pPicture; int result; xFixed *params; int nparams; char *name; REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq); VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); name = (char *) (stuff + 1); params = (xFixed *) (name + ((stuff->nbytes + 3) & ~3)); nparams = ((xFixed *) stuff + client->req_len) - params; result = SetPictureFilter (pPicture, name, stuff->nbytes, params, nparams); #ifdef NXAGENT_SERVER nxagentSetPictureFilter(pPicture, name, stuff->nbytes, params, nparams); #endif return result; } static int ProcRenderCreateAnimCursor (ClientPtr client) { REQUEST(xRenderCreateAnimCursorReq); CursorPtr *cursors; CARD32 *deltas; CursorPtr pCursor; int ncursor; xAnimCursorElt *elt; int i; int ret; REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); if (client->req_len & 1) return BadLength; ncursor = (client->req_len - (SIZEOF(xRenderCreateAnimCursorReq) >> 2)) >> 1; cursors = malloc (ncursor * (sizeof (CursorPtr) + sizeof (CARD32))); if (!cursors) return BadAlloc; deltas = (CARD32 *) (cursors + ncursor); elt = (xAnimCursorElt *) (stuff + 1); for (i = 0; i < ncursor; i++) { cursors[i] = (CursorPtr)SecurityLookupIDByType(client, elt->cursor, RT_CURSOR, DixReadAccess); if (!cursors[i]) { free (cursors); client->errorValue = elt->cursor; return BadCursor; } deltas[i] = elt->delay; elt++; } ret = AnimCursorCreate (cursors, deltas, ncursor, &pCursor); free (cursors); if (ret != Success) return ret; #ifdef NXAGENT_SERVER nxagentAnimCursorBits = pCursor -> bits; for (i = 0; i < MAXSCREENS; i++) { pCursor -> devPriv[i] = NULL; } #endif if (AddResource (stuff->cid, RT_CURSOR, (void *)pCursor)) return client->noClientException; return BadAlloc; } static int ProcRenderCreateSolidFill(ClientPtr client) { PicturePtr pPicture; int error = 0; REQUEST(xRenderCreateSolidFillReq); REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq); LEGAL_NEW_RESOURCE(stuff->pid, client); pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error); if (!pPicture) return error; #ifdef NXAGENT_SERVER nxagentRenderCreateSolidFill(pPicture, &stuff -> color); #endif if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } static int ProcRenderCreateLinearGradient (ClientPtr client) { PicturePtr pPicture; int len; int error = 0; xFixed *stops; xRenderColor *colors; REQUEST(xRenderCreateLinearGradientReq); REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq); LEGAL_NEW_RESOURCE(stuff->pid, client); len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq); if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; stops = (xFixed *)(stuff + 1); colors = (xRenderColor *)(stops + stuff->nStops); pPicture = CreateLinearGradientPicture (stuff->pid, &stuff->p1, &stuff->p2, stuff->nStops, stops, colors, &error); if (!pPicture) return error; #ifdef NXAGENT_SERVER nxagentRenderCreateLinearGradient(pPicture, &stuff->p1, &stuff->p2, stuff->nStops, stops, colors); #endif if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } static int ProcRenderCreateRadialGradient (ClientPtr client) { PicturePtr pPicture; int len; int error = 0; xFixed *stops; xRenderColor *colors; REQUEST(xRenderCreateRadialGradientReq); REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq); LEGAL_NEW_RESOURCE(stuff->pid, client); len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq); if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; stops = (xFixed *)(stuff + 1); colors = (xRenderColor *)(stops + stuff->nStops); pPicture = CreateRadialGradientPicture (stuff->pid, &stuff->inner, &stuff->outer, stuff->inner_radius, stuff->outer_radius, stuff->nStops, stops, colors, &error); if (!pPicture) return error; #ifdef NXAGENT_SERVER nxagentRenderCreateRadialGradient(pPicture, &stuff->inner, &stuff->outer, stuff->inner_radius, stuff->outer_radius, stuff->nStops, stops, colors); #endif if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } static int ProcRenderCreateConicalGradient (ClientPtr client) { PicturePtr pPicture; int len; int error = 0; xFixed *stops; xRenderColor *colors; REQUEST(xRenderCreateConicalGradientReq); REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq); LEGAL_NEW_RESOURCE(stuff->pid, client); len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq); if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; stops = (xFixed *)(stuff + 1); colors = (xRenderColor *)(stops + stuff->nStops); pPicture = CreateConicalGradientPicture (stuff->pid, &stuff->center, stuff->angle, stuff->nStops, stops, colors, &error); if (!pPicture) return error; #ifdef NXAGENT_SERVER nxagentRenderCreateConicalGradient(pPicture, &stuff->center, stuff->angle, stuff->nStops, stops, colors); #endif if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } static int ProcRenderDispatch (ClientPtr client) { #ifdef TEST REQUEST(xReq); if (stuff->data < RenderNumberRequests) { fprintf(stderr, "%s: Request [%s] OPCODE#%d.\n", __func__, nxagentRenderRequestLiteral[stuff->data], stuff->data); } #endif /* * Set the nxagentGCTrap flag while dispatching a render * operation to avoid reentrancy in GCOps.c. */ nxagentGCTrap = 1; int result = xorg_ProcRenderDispatch(client); nxagentGCTrap = 0; return result; } static int SProcRenderDispatch (ClientPtr client) { #ifdef TEST REQUEST(xReq); if (stuff->data < RenderNumberRequests) { fprintf(stderr, "%s: Request [%s] OPCODE#%d.\n", __func__, nxagentRenderRequestLiteral[stuff->data], stuff->data); } #endif /* * Set the nxagentGCTrap flag while dispatching a render * operation to avoid reentrancy in GCOps.c. */ nxagentGCTrap = 1; int result = xorg_SProcRenderDispatch(client); nxagentGCTrap = 0; return result; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXresource.c0000644000000000000000000004324713614532331021130 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* The panoramix components contained the following notice */ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* $TOG: resource.c /main/41 1998/02/09 14:20:31 kaleb $ */ /* Routines to manage various kinds of resources: * * CreateNewResourceType, CreateNewResourceClass, InitClientResources, * FakeClientID, AddResource, FreeResource, FreeClientResources, * FreeAllResources, LookupIDByType, LookupIDByClass, GetXIDRange */ /* * A resource ID is a 32 bit quantity, the upper 2 bits of which are * off-limits for client-visible resources. The next 8 bits are * used as client ID, and the low 22 bits come from the client. * A resource ID is "hashed" by extracting and xoring subfields * (varying with the size of the hash table). * * It is sometimes necessary for the server to create an ID that looks * like it belongs to a client. This ID, however, must not be one * the client actually can create, or we have the potential for conflict. * The 31st bit of the ID is reserved for the server's use for this * purpose. By setting CLIENT_ID(id) to the client, the SERVER_BIT to * 1, and an otherwise arbitrary ID in the low 22 bits, we can create a * resource "owned" by the client. */ #include "../../dix/resource.c" #include "Agent.h" #include "Font.h" #include "Pixmaps.h" #include "GCs.h" #define PANIC #define WARNING #undef TEST #undef DEBUG #ifdef NXAGENT_SERVER static int nxagentResChangedFlag = 0; #endif #ifdef NXAGENT_SERVER int nxagentFindClientResource(int client, RESTYPE type, void * value) { ResourcePtr pResource; ResourcePtr *resources; int i; for (i = 0; i < clientTable[client].buckets; i++) { resources = clientTable[client].resources; for (pResource = resources[i]; pResource; pResource = pResource -> next) { if (pResource -> type == type && pResource -> value == value) { #ifdef TEST fprintf(stderr, "nxagentFindClientResource: Found resource [%p] type [%lu] " "for client [%d].\n", (void *) value, pResource -> type, client); #endif return 1; } } } return 0; } int nxagentSwitchResourceType(int client, RESTYPE type, void * value) { ResourcePtr pResource; ResourcePtr *resources; RESTYPE internalType = 0; int i; if (type == RT_PIXMAP) { internalType = RT_NX_PIXMAP; } else if (type == RT_GC) { internalType = RT_NX_GC; } else if (type == RT_FONT) { internalType = RT_NX_FONT; } else { return 0; } if (client == serverClient -> index) { #ifdef TEST fprintf(stderr, "nxagentSwitchResourceType: Requesting client is [%d]. Skipping the resource switch.\n", client); #endif return 0; } for (i = 0; i < clientTable[serverClient -> index].buckets; i++) { resources = clientTable[serverClient -> index].resources; for (pResource = resources[i]; pResource; pResource = pResource -> next) { if (pResource -> type == internalType && pResource -> value == value) { #ifdef TEST fprintf(stderr, "nxagentSwitchResourceType: Changing resource [%p] type from [%lu] to " "[%lu] for server client [%d].\n", (void *) value, (unsigned long) pResource -> type, (unsigned long) type, serverClient -> index); #endif FreeResource(pResource -> id, RT_NONE); return 1; } } } return 0; } #endif /* NXAGENT_SERVER */ Bool AddResource(XID id, RESTYPE type, void * value) { int client; register ClientResourceRec *rrec; register ResourcePtr res, *head; client = CLIENT_ID(id); rrec = &clientTable[client]; if (!rrec->buckets) { ErrorF("AddResource(%lx, %lx, %lx), client=%d \n", (unsigned long)id, type, (unsigned long)value, client); FatalError("client not in use\n"); } #ifdef NXAGENT_SERVER nxagentSwitchResourceType(client, type, value); #ifdef TEST fprintf(stderr, "AddResource: Adding resource for client [%d] type [%lu] value [%p] id [%lu].\n", client, (unsigned long) type, (void *) value, (unsigned long) id); #endif #endif if ((rrec->elements >= 4*rrec->buckets) && (rrec->hashsize < MAXHASHSIZE)) RebuildTable(client); head = &rrec->resources[Hash(client, id)]; res = (ResourcePtr)malloc(sizeof(ResourceRec)); if (!res) { (*DeleteFuncs[type & TypeMask])(value, id); return FALSE; } res->next = *head; res->id = id; res->type = type; res->value = value; *head = res; rrec->elements++; #ifdef NXAGENT_SERVER nxagentResChangedFlag = 1; #endif if (!(id & SERVER_BIT) && (id >= rrec->expectID)) rrec->expectID = id + 1; return TRUE; } void FreeResource(XID id, RESTYPE skipDeleteFuncType) { int cid; register ResourcePtr res; register ResourcePtr *prev, *head; register int *eltptr; int elements; Bool gotOne = FALSE; #ifdef NXAGENT_SERVER #ifdef TEST fprintf(stderr, "FreeResource: Freeing resource id [%lu].\n", (unsigned long) id); #endif #endif if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { head = &clientTable[cid].resources[Hash(cid, id)]; eltptr = &clientTable[cid].elements; prev = head; while ( (res = *prev) ) { if (res->id == id) { RESTYPE rtype = res->type; *prev = res->next; elements = --*eltptr; #ifdef NXAGENT_SERVER nxagentResChangedFlag = 1; #endif if (rtype != skipDeleteFuncType) (*DeleteFuncs[rtype & TypeMask])(res->value, res->id); free(res); if (*eltptr != elements) prev = head; /* prev may no longer be valid */ gotOne = TRUE; } else prev = &res->next; } } if (!gotOne) ErrorF("Freeing resource id=%lX which isn't there.\n", (unsigned long)id); } void FreeResourceByType(XID id, RESTYPE type, Bool skipFree) { int cid; register ResourcePtr res; register ResourcePtr *prev, *head; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { head = &clientTable[cid].resources[Hash(cid, id)]; prev = head; while ( (res = *prev) ) { if (res->id == id && res->type == type) { *prev = res->next; #ifdef NXAGENT_SERVER nxagentResChangedFlag = 1; #endif if (!skipFree) (*DeleteFuncs[type & TypeMask])(res->value, res->id); free(res); break; } else prev = &res->next; } } } /* Note: if func adds or deletes resources, then func can get called * more than once for some resources. If func adds new resources, * func might or might not get called for them. func cannot both * add and delete an equal number of resources! */ void FindClientResourcesByType( ClientPtr client, RESTYPE type, FindResType func, void * cdata ){ register ResourcePtr *resources; register ResourcePtr this, next; int i, elements; register int *eltptr; #ifdef NXAGENT_SERVER register ResourcePtr **resptr; #endif if (!client) client = serverClient; /* * If func triggers a resource table * rebuild then restart the loop. */ #ifdef NXAGENT_SERVER RestartLoop: #endif resources = clientTable[client->index].resources; #ifdef NXAGENT_SERVER resptr = &clientTable[client->index].resources; #endif eltptr = &clientTable[client->index].elements; for (i = 0; i < clientTable[client->index].buckets; i++) { for (this = resources[i]; this; this = next) { next = this->next; if (!type || this->type == type) { elements = *eltptr; /* * FIXME: * It is not safe to let a function change the resource * table we are reading! */ #ifdef NXAGENT_SERVER nxagentResChangedFlag = 0; #endif (*func)(this->value, this->id, cdata); /* * Avoid that a call to RebuildTable() could invalidate the * pointer. This is safe enough, because in RebuildTable() * the new pointer is allocated just before the old one is * freed, so it can't point to the same address. */ #ifdef NXAGENT_SERVER if (*resptr != resources) goto RestartLoop; #endif /* * It's not enough to check if the number of elements has * changed, because it could happen that the number of * resources that have been added matches the number of * the freed ones. * 'nxagentResChangedFlag' is set if a resource has been * added or freed. */ #ifdef NXAGENT_SERVER if (*eltptr != elements || nxagentResChangedFlag) #else if (*eltptr != elements) #endif next = resources[i]; /* start over */ } } } } void FindAllClientResources( ClientPtr client, FindAllRes func, void * cdata ){ register ResourcePtr *resources; register ResourcePtr this, next; int i, elements; register int *eltptr; #ifdef NXAGENT_SERVER register ResourcePtr **resptr; #endif if (!client) client = serverClient; /* * If func triggers a resource table * rebuild then restart the loop. */ #ifdef NXAGENT_SERVER RestartLoop: #endif resources = clientTable[client->index].resources; #ifdef NXAGENT_SERVER resptr = &clientTable[client->index].resources; #endif eltptr = &clientTable[client->index].elements; for (i = 0; i < clientTable[client->index].buckets; i++) { for (this = resources[i]; this; this = next) { next = this->next; elements = *eltptr; /* * FIXME: * It is not safe to let a function change the resource * table we are reading! */ #ifdef NXAGENT_SERVER nxagentResChangedFlag = 0; #endif (*func)(this->value, this->id, this->type, cdata); /* * Avoid that a call to RebuildTable() could invalidate the * pointer. This is safe enough, because in RebuildTable() * the new pointer is allocated just before the old one is * freed, so it can't point to the same address. */ #ifdef NXAGENT_SERVER if (*resptr != resources) goto RestartLoop; #endif /* * It's not enough to check if the number of elements has * changed, because it could happen that the number of * resources that have been added matches the number of * the freed ones. * 'nxagentResChangedFlag' is set if a resource has been * added or freed. */ #ifdef NXAGENT_SERVER if (*eltptr != elements || nxagentResChangedFlag) #else if (*eltptr != elements) #endif next = resources[i]; /* start over */ } } } void * LookupClientResourceComplex( ClientPtr client, RESTYPE type, FindComplexResType func, void * cdata ){ ResourcePtr *resources; ResourcePtr this; int i; #ifdef NXAGENT_SERVER ResourcePtr **resptr; Bool res; #endif if (!client) client = serverClient; /* * If func triggers a resource table * rebuild then restart the loop. */ #ifdef NXAGENT_SERVER RestartLoop: #endif resources = clientTable[client->index].resources; #ifdef NXAGENT_SERVER resptr = &clientTable[client->index].resources; #endif for (i = 0; i < clientTable[client->index].buckets; i++) { for (this = resources[i]; this; this = this->next) { if (!type || this->type == type) { #ifdef NXAGENT_SERVER res = (*func)(this->value, this->id, cdata); if (*resptr != resources) goto RestartLoop; if (res) return this->value; #else if((*func)(this->value, this->id, cdata)) return this->value; #endif } } } return NULL; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXshm.c0000644000000000000000000003526013614532331020064 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ********************************************************/ /* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ #include #include "Trap.h" #include "Agent.h" #include "Drawable.h" #include "Pixmaps.h" #include "../../Xext/shm.c" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG #ifdef TEST #include "Literals.h" #endif extern void fbGetImage(DrawablePtr pDrw, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *d); extern void fbPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage); extern int nxagentImageLength(int, int, int, int, int); void ShmExtensionInit(void) { ExtensionEntry *extEntry; int i; #ifdef MUST_CHECK_FOR_SHM_SYSCALL if (!CheckForShmSyscall()) { ErrorF("MIT-SHM extension disabled due to lack of kernel support\n"); return; } #endif #ifdef NXAGENT_SERVER if (nxagentOption(SharedMemory) == False) { return; } #endif sharedPixmaps = xFalse; pixmapFormat = 0; { #ifdef NXAGENT_SERVER sharedPixmaps = nxagentOption(SharedPixmaps); #else sharedPixmaps = xTrue; #endif pixmapFormat = shmPixFormat[0]; for (i = 0; i < screenInfo.numScreens; i++) { if (!shmFuncs[i]) { #ifdef TEST fprintf(stderr, "ShmExtensionInit: Registering shmFuncs as miFuncs.\n"); #endif shmFuncs[i] = &miFuncs; } if (!shmFuncs[i]->CreatePixmap) sharedPixmaps = xFalse; if (shmPixFormat[i] && (shmPixFormat[i] != pixmapFormat)) { sharedPixmaps = xFalse; pixmapFormat = 0; } } if (!pixmapFormat) pixmapFormat = ZPixmap; if (sharedPixmaps) { for (i = 0; i < screenInfo.numScreens; i++) { destroyPixmap[i] = screenInfo.screens[i]->DestroyPixmap; screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap; } #ifdef PIXPRIV shmPixmapPrivate = AllocatePixmapPrivateIndex(); for (i = 0; i < screenInfo.numScreens; i++) { if (!AllocatePixmapPrivate(screenInfo.screens[i], shmPixmapPrivate, 0)) return; } #endif } } ShmSegType = CreateNewResourceType(ShmDetachSegment); if (ShmSegType && (extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors, ProcShmDispatch, SProcShmDispatch, ShmResetProc, StandardMinorOpcode))) { ShmReqCode = (unsigned char)extEntry->base; ShmCompletionCode = extEntry->eventBase; BadShmSegCode = extEntry->errorBase; EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent; } } static void miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) DrawablePtr dst; GCPtr pGC; int depth, w, h, sx, sy, sw, sh, dx, dy; unsigned int format; char *data; { /* Careful! This wrapper DEACTIVATES the trap! */ nxagentShmTrap = 0; xorg_miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data); nxagentShmTrap = 1; return; } static void fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) DrawablePtr dst; GCPtr pGC; int depth, w, h, sx, sy, sw, sh, dx, dy; unsigned int format; char *data; { #ifdef NXAGENT_SERVER int length; char *newdata; #ifdef TEST fprintf(stderr, "fbShmPutImage: Called with drawable at [%p] GC at [%p] data at [%p].\n", (void *) dst, (void *) pGC, (void *) data); #endif #endif if ((format == ZPixmap) || (depth == 1)) { PixmapPtr pPixmap; pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth, BitsPerPixel(depth), PixmapBytePad(w, depth), (void *)data); if (!pPixmap) return; if (format == XYBitmap) (void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy, 1L); else (void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy); #ifdef NXAGENT_SERVER /* * We updated the internal framebuffer, * now we want to go on the real X. */ #ifdef TEST fprintf(stderr, "fbShmPutImage: Realizing the PutImage with depth [%d] " " format [%d] w [%d] h [%d] sx [%d] sy [%d] sw [%d] " " sh [%d] dx [%d].\n", depth, format, w, h, sx, sy, sw, sh, dx); #endif length = nxagentImageLength(sw, sh, format, 0, depth); if ((newdata = calloc(1, length)) != NULL) { fbGetImage((DrawablePtr) pPixmap, sx, sy, sw, sh, format, AllPlanes, newdata); (*pGC->ops->PutImage)(dst, pGC, depth, dx, dy, sw, sh, 0, format, newdata); free(newdata); } else { #ifdef WARNING fprintf(stderr, "fbShmPutImage: WARNING! Data allocation failed.\n"); #endif } #endif /* NXAGENT_SERVER */ FreeScratchPixmapHeader(pPixmap); } else { #ifdef TEST fprintf(stderr, "fbShmPutImage: Calling miShmPutImage().\n"); #endif miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data); } } static int ProcShmPutImage(client) register ClientPtr client; { register GCPtr pGC; register DrawablePtr pDraw; long length; ShmDescPtr shmdesc; REQUEST(xShmPutImageReq); REQUEST_SIZE_MATCH(xShmPutImageReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client); if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse)) return BadValue; if (stuff->format == XYBitmap) { if (stuff->depth != 1) return BadMatch; length = PixmapBytePad(stuff->totalWidth, 1); } else if (stuff->format == XYPixmap) { if (pDraw->depth != stuff->depth) return BadMatch; length = PixmapBytePad(stuff->totalWidth, 1); length *= stuff->depth; } else if (stuff->format == ZPixmap) { if (pDraw->depth != stuff->depth) return BadMatch; length = PixmapBytePad(stuff->totalWidth, stuff->depth); } else { client->errorValue = stuff->format; return BadValue; } /* * There's a potential integer overflow in this check: * VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight, * client); * the version below ought to avoid it */ if (stuff->totalHeight != 0 && length > (shmdesc->size - stuff->offset)/stuff->totalHeight) { client->errorValue = stuff->totalWidth; return BadValue; } if (stuff->srcX > stuff->totalWidth) { client->errorValue = stuff->srcX; return BadValue; } if (stuff->srcY > stuff->totalHeight) { client->errorValue = stuff->srcY; return BadValue; } if ((stuff->srcX + stuff->srcWidth) > stuff->totalWidth) { client->errorValue = stuff->srcWidth; return BadValue; } if ((stuff->srcY + stuff->srcHeight) > stuff->totalHeight) { client->errorValue = stuff->srcHeight; return BadValue; } #ifdef TEST fprintf(stderr, "ProcShmPutImage: Format [%d] srcX [%d] srcY [%d], " "totalWidth [%d] totalHeight [%d]\n", stuff->format, stuff->srcX, stuff->srcY, stuff->totalWidth, stuff->totalHeight); #endif #ifndef NXAGENT_SERVER /* It seems like this code was removed for a good reason. Including it leads to very strange issues when coupled with libXcomp and using connection speed settings lower than LAN (and even on LAN some icons are not showing up correctly, e.g., when using MATE). Further investigation on why this happens pending and might happen at a later time. See also ArcticaProject/nx-libs#656 */ if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) || ((stuff->format != ZPixmap) && (stuff->srcX < screenInfo.bitmapScanlinePad) && ((stuff->format == XYBitmap) || ((stuff->srcY == 0) && (stuff->srcHeight == stuff->totalHeight))))) && ((stuff->srcX + stuff->srcWidth) == stuff->totalWidth)) (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY, stuff->totalWidth, stuff->srcHeight, stuff->srcX, stuff->format, shmdesc->addr + stuff->offset + (stuff->srcY * length)); else #endif { #ifdef TEST fprintf(stderr, "ProcShmPutImage: Calling (*shmFuncs[pDraw->pScreen->myNum]->PutImage)().\n"); #endif (*shmFuncs[pDraw->pScreen->myNum]->PutImage)( pDraw, pGC, stuff->depth, stuff->format, stuff->totalWidth, stuff->totalHeight, stuff->srcX, stuff->srcY, stuff->srcWidth, stuff->srcHeight, stuff->dstX, stuff->dstY, shmdesc->addr + stuff->offset); } if (stuff->sendEvent) { xShmCompletionEvent ev; memset(&ev, 0, sizeof(xShmCompletionEvent)); ev.type = ShmCompletionCode; ev.drawable = stuff->drawable; ev.minorEvent = X_ShmPutImage; ev.majorEvent = ShmReqCode; ev.shmseg = stuff->shmseg; ev.offset = stuff->offset; WriteEventsToClient(client, 1, (xEvent *) &ev); } return (client->noClientException); } static PixmapPtr nxagent_fbShmCreatePixmap (pScreen, width, height, depth, addr) ScreenPtr pScreen; int width; int height; int depth; char *addr; { register PixmapPtr pPixmap; pPixmap = (*pScreen->CreatePixmap)(pScreen, width, height, depth, 0); if (!pPixmap) { return NullPixmap; } #if defined(NXAGENT_SERVER) && defined(TEST) fprintf(stderr,"fbShmCreatePixmap: Width [%d] Height [%d] Depth [%d] Hint[%d]\n", width, height, depth, 0); #endif if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth, BitsPerPixel(depth), PixmapBytePad(width, depth), (void *)addr)) { #if defined(NXAGENT_SERVER) && defined(WARNING) fprintf(stderr,"fbShmCreatePixmap: Return Null Pixmap.\n"); #endif (*pScreen->DestroyPixmap)(pPixmap); return NullPixmap; } return pPixmap; } static PixmapPtr fbShmCreatePixmap (pScreen, width, height, depth, addr) ScreenPtr pScreen; int width; int height; int depth; char *addr; { PixmapPtr result; nxagentShmPixmapTrap = 1; result = nxagent_fbShmCreatePixmap(pScreen, width, height, depth, addr); nxagentShmPixmapTrap = 0; return result; } /* A wrapper that handles the trap. This construct is used to keep the derived code closer to the original */ static int ProcShmDispatch (register ClientPtr client) { int result; #ifdef TEST REQUEST(xReq); if (stuff->data <= X_ShmCreatePixmap) { fprintf(stderr, "ProcShmDispatch: Request [%s] OPCODE [%d] for client [%d].\n", nxagentShmRequestLiteral[stuff->data], stuff->data, client->index); } #endif nxagentShmTrap = 1; result = xorg_ProcShmDispatch(client); nxagentShmTrap = 0; return result; } static int SProcShmDispatch (register ClientPtr client) { int result; #ifdef TEST REQUEST(xReq); if (stuff->data <= X_ShmCreatePixmap) { fprintf(stderr, "SProcShmDispatch: Request [%s] OPCODE [%d] for client [%d].\n", nxagentShmRequestLiteral[stuff->data], stuff->data, client->index); } #endif nxagentShmTrap = 1; result = xorg_SProcShmDispatch(client); nxagentShmTrap = 0; return result; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c0000644000000000000000000006355513614532331020614 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* The panoramix components contained the following notice */ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #include "selection.h" #include "Screen.h" #include "Options.h" #include "Clipboard.h" #include "Splash.h" #include "Rootless.h" #include "Composite.h" #include "Drawable.h" #include "Colormap.h" #include "../../dix/window.c" extern Bool nxagentWMIsRunning; extern Bool nxagentScreenTrap; /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG extern void nxagentSetVersionProperty(WindowPtr pWin); void InitRootWindow(WindowPtr pWin) { /* * A root window is created for each screen by main * and the pointer is saved in screenInfo.screens as * in the following snippet: * * for (i = 0; i < screenInfo.numScreens; i++) * InitRootWindow(screenInfo.screens[i]->root); * * Our root window on the real display was already * created at the time the screen was opened, so it * is unclear how this window (or the other window, * if you prefer) fits in the big picture. */ if (nxagentOption(Rootless)) { #ifdef TEST fprintf(stderr, "InitRootWindow: Assigned agent root to window at [%p][%ld] with parent [%p].\n", (void *) pWin, nxagentWindowPriv(pWin)->window, (void *) pWin -> parent); #endif nxagentRootlessWindow = pWin; } xorg_InitRootWindow(pWin); /* * Map both the root and the default agent window. */ #ifdef TEST fprintf(stderr, "InitRootWindow: Mapping default windows.\n"); #endif nxagentInitClipboard(pWin); nxagentMapDefaultWindows(); nxagentRedirectDefaultWindows(); #ifdef NXAGENT_ARTSD { char artsd_port[10]; short int nPort = atoi(display) + 7000; sprintf(artsd_port,"%d", nPort); nxagentPropagateArtsdProperties(pWin->drawable.pScreen, artsd_port); } #endif nxagentSetVersionProperty(pWin); } /* XXX need to retile border on each window with ParentRelative origin */ void ResizeChildrenWinSize(register WindowPtr pWin, int dx, int dy, int dw, int dh) { register ScreenPtr pScreen; register WindowPtr pSib, pChild; Bool resized = (dw || dh); pScreen = pWin->drawable.pScreen; for (pSib = pWin->firstChild; pSib; pSib = pSib->nextSib) { if (resized && (pSib->winGravity > NorthWestGravity)) { int cwsx, cwsy; cwsx = pSib->origin.x; cwsy = pSib->origin.y; GravityTranslate (cwsx, cwsy, cwsx - dx, cwsy - dy, dw, dh, pSib->winGravity, &cwsx, &cwsy); if (cwsx != pSib->origin.x || cwsy != pSib->origin.y) { xEvent event = {0}; event.u.u.type = GravityNotify; event.u.gravity.window = pSib->drawable.id; event.u.gravity.x = cwsx - wBorderWidth (pSib); event.u.gravity.y = cwsy - wBorderWidth (pSib); DeliverEvents (pSib, &event, 1, NullWindow); pSib->origin.x = cwsx; pSib->origin.y = cwsy; } } pSib->drawable.x = pWin->drawable.x + pSib->origin.x; pSib->drawable.y = pWin->drawable.y + pSib->origin.y; SetWinSize (pSib); SetBorderSize (pSib); #ifdef NXAGENT_SERVER /* * Don't force X to move children. It will position them * according with gravity. * * (*pScreen->PositionWindow)(pSib, pSib->drawable.x, pSib->drawable.y); */ /* * Update pSib privates, as this window is moved by X. */ nxagentAddConfiguredWindow(pSib, CW_Update); #else (*pScreen->PositionWindow)(pSib, pSib->drawable.x, pSib->drawable.y); #endif if ( (pChild = pSib->firstChild) ) { while (1) { pChild->drawable.x = pChild->parent->drawable.x + pChild->origin.x; pChild->drawable.y = pChild->parent->drawable.y + pChild->origin.y; SetWinSize (pChild); SetBorderSize (pChild); (*pScreen->PositionWindow)(pChild, pChild->drawable.x, pChild->drawable.y); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } while (!pChild->nextSib && (pChild != pSib)) pChild = pChild->parent; if (pChild == pSib) break; pChild = pChild->nextSib; } } } } /***** * ConfigureWindow *****/ int ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientPtr client) { #define RESTACK_WIN 0 #define MOVE_WIN 1 #define RESIZE_WIN 2 #define REBORDER_WIN 3 register WindowPtr pSib = NullWindow; register WindowPtr pParent = pWin->parent; Window sibwid = 0; Mask index2, tmask; register XID *pVlist; short x, y, beforeX, beforeY; unsigned short w = pWin->drawable.width, h = pWin->drawable.height, bw = pWin->borderWidth; int action, smode = Above; xEvent event = {0}; if ((pWin->drawable.class == InputOnly) && (mask & IllegalInputOnlyConfigureMask)) return(BadMatch); if ((mask & CWSibling) && !(mask & CWStackMode)) return(BadMatch); pVlist = vlist; if (pParent) { x = pWin->drawable.x - pParent->drawable.x - (int)bw; y = pWin->drawable.y - pParent->drawable.y - (int)bw; } else { x = pWin->drawable.x; y = pWin->drawable.y; } beforeX = x; beforeY = y; action = RESTACK_WIN; if ((mask & (CWX | CWY)) && (!(mask & (CWHeight | CWWidth)))) { GET_INT16(CWX, x); GET_INT16(CWY, y); action = MOVE_WIN; } /* or should be resized */ else if (mask & (CWX | CWY | CWWidth | CWHeight)) { GET_INT16(CWX, x); GET_INT16(CWY, y); GET_CARD16(CWWidth, w); GET_CARD16 (CWHeight, h); if (!w || !h) { client->errorValue = 0; return BadValue; } action = RESIZE_WIN; } tmask = mask & ~ChangeMask; while (tmask) { index2 = (Mask)lowbit (tmask); tmask &= ~index2; switch (index2) { case CWBorderWidth: GET_CARD16(CWBorderWidth, bw); break; case CWSibling: sibwid = (Window ) *pVlist; pVlist++; pSib = (WindowPtr )SecurityLookupIDByType(client, sibwid, RT_WINDOW, DixReadAccess); if (!pSib) { client->errorValue = sibwid; return(BadWindow); } if (pSib->parent != pParent) return(BadMatch); if (pSib == pWin) return(BadMatch); break; case CWStackMode: GET_CARD8(CWStackMode, smode); if ((smode != TopIf) && (smode != BottomIf) && (smode != Opposite) && (smode != Above) && (smode != Below)) { client->errorValue = smode; return(BadValue); } break; default: client->errorValue = mask; return(BadValue); } } /* root really can't be reconfigured, so just return */ if (!pParent) return Success; /* Figure out if the window should be moved. Doesn't make the changes to the window if event sent */ #ifdef NXAGENT_SERVER #ifdef TEST if (nxagentWindowTopLevel(pWin)) { fprintf(stderr, "ConfigureWindow: pWin [%p] mask [%lu] client [%p]\n", pWin, mask, client); fprintf(stderr, "ConfigureWindow: x [%d] y [%d] w [%d] h [%d] CWStackMode [%d] " "smode [%d] pSib [%p]\n", x, y, w, h, (mask & CWStackMode) ? 1 : 0, smode, pSib); } #endif if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin) && pWin -> overrideRedirect == 0 && nxagentScreenTrap == 0) { nxagentConfigureRootlessWindow(pWin, x, y, w, h, bw, pSib, smode, mask); return Success; } #endif if (mask & CWStackMode) pSib = WhereDoIGoInTheStack(pWin, pSib, pParent->drawable.x + x, pParent->drawable.y + y, w + (bw << 1), h + (bw << 1), smode); else pSib = pWin->nextSib; if ((!pWin->overrideRedirect) && (RedirectSend(pParent) )) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = ConfigureRequest; event.u.configureRequest.window = pWin->drawable.id; if (mask & CWSibling) event.u.configureRequest.sibling = sibwid; else event.u.configureRequest.sibling = None; if (mask & CWStackMode) event.u.u.detail = smode; else event.u.u.detail = Above; event.u.configureRequest.x = x; event.u.configureRequest.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension && (!pParent || !pParent->parent)) { event.u.configureRequest.x += panoramiXdataPtr[0].x; event.u.configureRequest.y += panoramiXdataPtr[0].y; } #endif event.u.configureRequest.width = w; event.u.configureRequest.height = h; event.u.configureRequest.borderWidth = bw; event.u.configureRequest.valueMask = mask; event.u.configureRequest.parent = pParent->drawable.id; if (MaybeDeliverEventsToClient(pParent, &event, 1, SubstructureRedirectMask, client) == 1) return(Success); } if (action == RESIZE_WIN) { Bool size_change = (w != pWin->drawable.width) || (h != pWin->drawable.height); if (size_change && ((pWin->eventMask|wOtherEventMasks(pWin)) & ResizeRedirectMask)) { xEvent eventT = {0}; eventT.u.u.type = ResizeRequest; eventT.u.resizeRequest.window = pWin->drawable.id; eventT.u.resizeRequest.width = w; eventT.u.resizeRequest.height = h; if (MaybeDeliverEventsToClient(pWin, &eventT, 1, ResizeRedirectMask, client) == 1) { /* if event is delivered, leave the actual size alone. */ w = pWin->drawable.width; h = pWin->drawable.height; size_change = FALSE; } } if (!size_change) { if (mask & (CWX | CWY)) action = MOVE_WIN; else if (mask & (CWStackMode | CWBorderWidth)) action = RESTACK_WIN; else /* really nothing to do */ return(Success) ; } } if (action == RESIZE_WIN) /* we've already checked whether there's really a size change */ goto ActuallyDoSomething; if ((mask & CWX) && (x != beforeX)) goto ActuallyDoSomething; if ((mask & CWY) && (y != beforeY)) goto ActuallyDoSomething; if ((mask & CWBorderWidth) && (bw != wBorderWidth (pWin))) goto ActuallyDoSomething; if (mask & CWStackMode) { #ifndef ROOTLESS /* See above for why we always reorder in rootless mode. */ if (pWin->nextSib != pSib) #endif goto ActuallyDoSomething; } return(Success); ActuallyDoSomething: if (SubStrSend(pWin, pParent)) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = ConfigureNotify; event.u.configureNotify.window = pWin->drawable.id; if (pSib) event.u.configureNotify.aboveSibling = pSib->drawable.id; else event.u.configureNotify.aboveSibling = None; event.u.configureNotify.x = x; event.u.configureNotify.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension && (!pParent || !pParent->parent)) { event.u.configureNotify.x += panoramiXdataPtr[0].x; event.u.configureNotify.y += panoramiXdataPtr[0].y; } #endif event.u.configureNotify.width = w; event.u.configureNotify.height = h; event.u.configureNotify.borderWidth = bw; event.u.configureNotify.override = pWin->overrideRedirect; DeliverEvents(pWin, &event, 1, NullWindow); } if (mask & CWBorderWidth) { if (action == RESTACK_WIN) { action = MOVE_WIN; pWin->borderWidth = bw; } else if ((action == MOVE_WIN) && (beforeX + wBorderWidth (pWin) == x + (int)bw) && (beforeY + wBorderWidth (pWin) == y + (int)bw)) { action = REBORDER_WIN; (*pWin->drawable.pScreen->ChangeBorderWidth)(pWin, bw); } else pWin->borderWidth = bw; } if (action == MOVE_WIN) (*pWin->drawable.pScreen->MoveWindow)(pWin, x, y, pSib, (mask & CWBorderWidth) ? VTOther : VTMove); else if (action == RESIZE_WIN) (*pWin->drawable.pScreen->ResizeWindow)(pWin, x, y, w, h, pSib); else if (mask & CWStackMode) ReflectStackChange(pWin, pSib, VTOther); if (action != RESTACK_WIN) CheckCursorConfinement(pWin); #ifdef NXAGENT_SERVER nxagentFlushConfigureWindow(); #endif return(Success); #undef RESTACK_WIN #undef MOVE_WIN #undef RESIZE_WIN #undef REBORDER_WIN } /***** * ReparentWindow *****/ int ReparentWindow(register WindowPtr pWin, register WindowPtr pParent, int x, int y, ClientPtr client) { WindowPtr pPrev, pPriorParent; Bool WasMapped = (Bool)(pWin->mapped); xEvent event = {0}; int bw = wBorderWidth (pWin); register ScreenPtr pScreen; pScreen = pWin->drawable.pScreen; if (TraverseTree(pWin, CompareWIDs, (void *)&pParent->drawable.id) == WT_STOPWALKING) return(BadMatch); if (!MakeWindowOptional(pWin)) return(BadAlloc); if (WasMapped) UnmapWindow(pWin, FALSE); event.u.u.type = ReparentNotify; event.u.reparent.window = pWin->drawable.id; event.u.reparent.parent = pParent->drawable.id; event.u.reparent.x = x; event.u.reparent.y = y; #ifdef PANORAMIX if(!noPanoramiXExtension && !pParent->parent) { event.u.reparent.x += panoramiXdataPtr[0].x; event.u.reparent.y += panoramiXdataPtr[0].y; } #endif event.u.reparent.override = pWin->overrideRedirect; DeliverEvents(pWin, &event, 1, pParent); /* take out of sibling chain */ pPriorParent = pPrev = pWin->parent; if (pPrev->firstChild == pWin) pPrev->firstChild = pWin->nextSib; if (pPrev->lastChild == pWin) pPrev->lastChild = pWin->prevSib; if (pWin->nextSib) pWin->nextSib->prevSib = pWin->prevSib; if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; /* insert at beginning of pParent */ pWin->parent = pParent; pPrev = RealChildHead(pParent); #ifdef NXAGENT_SERVER if (pWin->parent == screenInfo.screens[0]->root) { nxagentSetTopLevelEventMask(pWin); } #endif if (pPrev) { pWin->nextSib = pPrev->nextSib; if (pPrev->nextSib) pPrev->nextSib->prevSib = pWin; else pParent->lastChild = pWin; pPrev->nextSib = pWin; pWin->prevSib = pPrev; } else { pWin->nextSib = pParent->firstChild; pWin->prevSib = NullWindow; if (pParent->firstChild) pParent->firstChild->prevSib = pWin; else pParent->lastChild = pWin; pParent->firstChild = pWin; } pWin->origin.x = x + bw; pWin->origin.y = y + bw; pWin->drawable.x = x + bw + pParent->drawable.x; pWin->drawable.y = y + bw + pParent->drawable.y; /* clip to parent */ SetWinSize (pWin); SetBorderSize (pWin); if (pScreen->ReparentWindow) (*pScreen->ReparentWindow)(pWin, pPriorParent); (*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y); ResizeChildrenWinSize(pWin, 0, 0, 0, 0); CheckWindowOptionalNeed(pWin); if (WasMapped) MapWindow(pWin, client); RecalculateDeliverableEvents(pWin); return(Success); } /***** * MapWindow * If some other client has selected SubStructureReDirect on the parent * and override-redirect is xFalse, then a MapRequest event is generated, * but the window remains unmapped. Otherwise, the window is mapped and a * MapNotify event is generated. *****/ int MapWindow(register WindowPtr pWin, ClientPtr client) { register ScreenPtr pScreen; register WindowPtr pParent; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; #ifdef NXAGENT_SERVER #ifdef TEST if (nxagentWindowTopLevel(pWin)) { fprintf(stderr, "MapWindow: pWin [%p] client [%p]\n", pWin, client); } #endif #endif if (pWin->mapped) return(Success); #ifdef XCSECURITY /* don't let an untrusted client map a child-of-trusted-window, InputOnly * window; too easy to steal device input */ if ( (client->trustLevel != XSecurityClientTrusted) && (pWin->drawable.class == InputOnly) && (wClient(pWin->parent)->trustLevel == XSecurityClientTrusted) ) return Success; #endif pScreen = pWin->drawable.pScreen; if ( (pParent = pWin->parent) ) { xEvent event; Bool anyMarked; if ((!pWin->overrideRedirect) && (RedirectSend(pParent) )) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = MapRequest; event.u.mapRequest.window = pWin->drawable.id; event.u.mapRequest.parent = pParent->drawable.id; if (MaybeDeliverEventsToClient(pParent, &event, 1, SubstructureRedirectMask, client) == 1) return(Success); } pWin->mapped = TRUE; if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) { memset(&event, 0, sizeof(xEvent)); event.u.u.type = MapNotify; event.u.mapNotify.window = pWin->drawable.id; event.u.mapNotify.override = pWin->overrideRedirect; DeliverEvents(pWin, &event, 1, NullWindow); } if (!pParent->realized) return(Success); RealizeTree(pWin); if (pWin->viewable) { anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pWin->nextSib); } #endif /* DO_SAVE_UNDERS */ if (anyMarked) { (*pScreen->ValidateTree)(pLayerWin->parent, pLayerWin, VTMap); (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, pWin->nextSib); #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pLayerWin, VTMap); } WindowsRestructured (); } else { RegionRec temp; pWin->mapped = TRUE; pWin->realized = TRUE; /* for roots */ pWin->viewable = pWin->drawable.class == InputOutput; /* We SHOULD check for an error value here XXX */ (*pScreen->RealizeWindow)(pWin); if (pScreen->ClipNotify) (*pScreen->ClipNotify) (pWin, 0, 0); if (pScreen->PostValidateTree) (*pScreen->PostValidateTree)(NullWindow, pWin, VTMap); RegionNull(&temp); RegionCopy(&temp, &pWin->clipList); (*pScreen->WindowExposures) (pWin, &temp, NullRegion); RegionUninit(&temp); } #ifdef NXAGENT_SERVER nxagentFlushConfigureWindow(); #endif return(Success); } void SaveScreens(int on, int mode) { int i; int what; int type; if (on == SCREEN_SAVER_FORCER) { if (mode == ScreenSaverReset) what = SCREEN_SAVER_OFF; else what = SCREEN_SAVER_ON; type = what; } else { what = on; type = what; if (what == screenIsSaved) type = SCREEN_SAVER_CYCLE; } for (i = 0; i < screenInfo.numScreens; i++) { if (on == SCREEN_SAVER_FORCER) (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], on); if (savedScreenInfo[i].ExternalScreenSaver) { #ifdef NXAGENT_SERVER if (nxagentOption(Timeout) != 0) { #ifdef TEST fprintf(stderr, "SaveScreens: An external screen-saver handler is installed. " "Ignoring it to let the auto-disconnect feature work.\n"); #endif } else #endif { if ((*savedScreenInfo[i].ExternalScreenSaver) (screenInfo.screens[i], type, on == SCREEN_SAVER_FORCER)) continue; } } if (type == screenIsSaved) continue; switch (type) { case SCREEN_SAVER_OFF: if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED) { (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], what); } else if (HasSaverWindow (i)) { savedScreenInfo[i].pWindow = NullWindow; FreeResource(savedScreenInfo[i].wid, RT_NONE); } break; case SCREEN_SAVER_CYCLE: if (savedScreenInfo[i].blanked == SCREEN_IS_TILED) { WindowPtr pWin = savedScreenInfo[i].pWindow; /* make it look like screen saver is off, so that * NotClippedByChildren will compute a clip list * for the root window, so miPaintWindow works */ screenIsSaved = SCREEN_SAVER_OFF; #ifndef NOLOGOHACK if (logoScreenSaver) (*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, FALSE); #endif (*pWin->drawable.pScreen->MoveWindow)(pWin, (short)(-(rand() % RANDOM_WIDTH)), (short)(-(rand() % RANDOM_WIDTH)), pWin->nextSib, VTMove); #ifndef NOLOGOHACK if (logoScreenSaver) DrawLogo(pWin); #endif screenIsSaved = SCREEN_SAVER_ON; } /* * Call the DDX saver in case it wants to do something * at cycle time */ else if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED) { (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], type); } break; case SCREEN_SAVER_ON: if (ScreenSaverBlanking != DontPreferBlanking) { if ((* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], what)) { savedScreenInfo[i].blanked = SCREEN_IS_BLANKED; continue; } if ((ScreenSaverAllowExposures != DontAllowExposures) && TileScreenSaver(i, SCREEN_IS_BLACK)) { savedScreenInfo[i].blanked = SCREEN_IS_BLACK; continue; } } if ((ScreenSaverAllowExposures != DontAllowExposures) && TileScreenSaver(i, SCREEN_IS_TILED)) { savedScreenInfo[i].blanked = SCREEN_IS_TILED; } else savedScreenInfo[i].blanked = SCREEN_ISNT_SAVED; break; } } screenIsSaved = what; if (mode == ScreenSaverReset) SetScreenSaverTimer(); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c0000644000000000000000000001045013614532331020604 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /*********************************************************** Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "Trap.h" #include "misc.h" extern int xorg_ProcXvDispatch(ClientPtr); extern int xorg_SProcXvDispatch(ClientPtr); #undef TEST #undef DEBUG /* ** ProcXvDispatch ** ** ** */ int ProcXvDispatch(ClientPtr client) { int result; /* * Report upstream that we are * dispatching a XVideo operation. */ #ifdef TEST fprintf(stderr, "ProcXvDispatch: Going to dispatch XVideo operation [%d] for client [%d].\n", stuff->data, client -> index); #endif nxagentXvTrap = 1; result = xorg_ProcXvDispatch(client); nxagentXvTrap = 0; #ifdef TEST fprintf(stderr, "ProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n", stuff->data, client -> index); #endif return result; } int SProcXvDispatch(ClientPtr client) { int result; /* * Report upstream that we are * dispatching a XVideo operation. */ #ifdef TEST fprintf(stderr, "SProcXvDispatch: Going to dispatch XVideo operation [%d] for client [%d].\n", stuff->data, client -> index); #endif nxagentXvTrap = 1; result = xorg_SProcXvDispatch(client); nxagentXvTrap = 0; #ifdef TEST fprintf(stderr, "SProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n", stuff->data, client -> index); #endif return result; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Options.c0000644000000000000000000001364013614532331020460 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include #include "X.h" #include "Agent.h" #include "Args.h" #include "Options.h" #include "Utils.h" /* * Instead of having a single options repository data could be * attached to the display or the screen. The macro nxagentOption() * should make the transition simple. */ AgentOptionsRec nxagentOptions; AgentOptionsRec nxagentOptionsBackup; AgentOptionsPtr nxagentOptionsPtr = &nxagentOptions; /* * If this is set, print the geometry in the block handler. */ unsigned int nxagentPrintGeometryFlags = 0; /* * This must be called at startup to initialize the options repository * to the default values. */ void nxagentInitOptions(void) { nxagentOptions.LinkType = UNDEFINED; nxagentOptions.Desktop = UNDEFINED; nxagentOptions.Persistent = 1; nxagentOptions.Rootless = UNDEFINED; nxagentOptions.Fullscreen = UNDEFINED; nxagentOptions.NoRootlessExit = False; nxagentOptions.X = 0; nxagentOptions.Y = 0; nxagentOptions.Width = 0; nxagentOptions.Height = 0; nxagentOptions.BorderWidth = 0; nxagentOptions.WMBorderWidth = -1; nxagentOptions.WMTitleHeight = -1; nxagentOptions.SavedX = 0; nxagentOptions.SavedY = 0; nxagentOptions.SavedWidth = 0; nxagentOptions.SavedHeight = 0; nxagentOptions.Timeout = 0; nxagentOptions.Nested = 0; nxagentOptions.BackingStore = BackingStoreUndefined; nxagentOptions.Clipboard = ClipboardBoth; nxagentOptions.SharedMemory = 1; nxagentOptions.SharedPixmaps = 1; nxagentOptions.DeviceControl = 0; nxagentOptions.DeviceControlUserDefined = 0; nxagentOptions.ResetKeyboardAtResume = 1; nxagentOptions.Reset = 0; nxagentOptions.RootX = 0; nxagentOptions.RootY = 0; nxagentOptions.RootWidth = 0; nxagentOptions.RootHeight = 0; nxagentOptions.ViewportXSpan = 0; nxagentOptions.ViewportYSpan = 0; nxagentOptions.DesktopResize = 1; nxagentOptions.Ratio = DONT_SCALE; nxagentOptions.XRatio = DONT_SCALE; nxagentOptions.YRatio = DONT_SCALE; nxagentOptions.FloatRatio = 1.0; nxagentOptions.FloatXRatio = 1.0; nxagentOptions.FloatYRatio = 1.0; nxagentOptions.UseDamage = 1; nxagentOptions.Binder = UNDEFINED; nxagentOptions.BinderOptions = NULL; nxagentOptions.Xdmcp = 0; nxagentOptions.DisplayBuffer = UNDEFINED; nxagentOptions.DisplayCoalescence = 0; nxagentOptions.Composite = 1; nxagentOptions.IgnoreVisibility = 0; nxagentOptions.ViewOnly = 0; nxagentOptions.Adaptive = 0; nxagentOptions.Streaming = 0; nxagentOptions.DeferLevel = UNDEFINED; nxagentOptions.DeferTimeout = 200; nxagentOptions.TileWidth = UNDEFINED; nxagentOptions.TileHeight = UNDEFINED; nxagentOptions.Menu = 1; nxagentOptions.MagicPixel = 1; nxagentOptions.ClientOs = UNDEFINED; nxagentOptions.InhibitXkb = 1; nxagentOptions.CopyBufferSize = COPY_UNLIMITED; nxagentOptions.ImageRateLimit = 0; nxagentOptions.Xinerama = 1; nxagentOptions.SleepTime = DEFAULT_SLEEP_TIME; nxagentOptions.ReconnectTolerance = DEFAULT_TOLERANCE; nxagentOptions.KeycodeConversion = DEFAULT_KEYCODE_CONVERSION; nxagentOptions.AutoGrab = False; } /* * This is called at session reconnection to reset some options to * their default values. The reason to avoid calling the * nxagentInitOptions() is that not all the options can change value * when reconnecting. */ void nxagentResetOptions(void) { if (nxagentLockDeferLevel == 0) { nxagentOptions.DeferLevel = UNDEFINED; } nxagentOptions.DeferTimeout = 200; nxagentOptions.TileWidth = UNDEFINED; nxagentOptions.TileHeight = UNDEFINED; nxagentOptions.WMBorderWidth = -1; nxagentOptions.WMTitleHeight = -1; nxagentOptions.KeycodeConversion = DEFAULT_KEYCODE_CONVERSION; } void nxagentSaveOptions(void) { memcpy(&nxagentOptionsBackup, &nxagentOptions, sizeof(AgentOptionsRec)); } void nxagentRestoreOptions(void) { nxagentOptions.DeferLevel = nxagentOptionsBackup.DeferLevel; nxagentOptions.DeferTimeout = nxagentOptionsBackup.DeferTimeout; nxagentOptions.TileWidth = nxagentOptionsBackup.TileWidth; nxagentOptions.TileHeight = nxagentOptionsBackup.TileHeight; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Options.h0000644000000000000000000002332013614532331020461 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Options_H__ #define __Options_H__ #ifndef True #define True 1 #endif #ifndef False #define False 0 #endif #define UNDEFINED -1 #define COPY_UNLIMITED -1 #define DEFAULT_SLEEP_TIME 50 extern unsigned int nxagentPrintGeometryFlags; typedef enum _BackingStoreMode { BackingStoreUndefined = -1, BackingStoreNever, BackingStoreWhenRequested, BackingStoreForce } BackingStoreMode; /* since nx 2.0.0-32 clipboard data exchange can be limited. Client here means "nxclient": Enable or disable copy and paste operations from the user's desktop to the NX session or vice versa. This option can take four values: client The content copied on the client can be pasted inside the NX session. server The content copied inside the NX session can be pasted on the client. both The copy & paste operations are allowed both between the client and the NX session and viceversa. none The copy&paste operations between the client and the NX session are never allowed. */ typedef enum _ClipboardMode { ClipboardBoth, ClipboardClient, ClipboardServer, ClipboardNone } ClipboardMode; typedef enum _ClientOsType { ClientOsWinnt = 0, ClientOsLinux, ClientOsSolaris, ClientOsMac } ClientOsType; typedef enum _ToleranceChecksMode { ToleranceChecksStrict = 0, ToleranceChecksSafe = 1, ToleranceChecksRisky = 2, ToleranceChecksBypass = 3 } ToleranceChecksMode; #define DEFAULT_TOLERANCE ToleranceChecksStrict typedef enum _KeycodeConversion { KeycodeConversionOn = 0, KeycodeConversionOff = 1, KeycodeConversionAuto = 2 } KeycodeConversionMode; #define DEFAULT_KEYCODE_CONVERSION KeycodeConversionAuto /* * Set of options affecting agent operations. */ typedef struct _AgentOptions { /* * Link type of the NX connection or none, if this is a direct X11 * connection. */ int LinkType; /* * Is agent running in desktop mode? This is presently the default. */ int Desktop; /* * True if user activated rootless mode. */ int Rootless; /* * True for shadow mode. */ int Shadow; /* * True if user activated persistent mode. */ int Persistent; /* * True if user activated fullscreen mode. */ int Fullscreen; /* * True if the fullscreen NX session will extend on all available * screens. */ int AllScreens; /* * Set to the auto-disconnect timeout, if the user activated this * feature. */ int Timeout; /* * Geometry of the agent's window. */ int X, Y, Width, Height; int BorderWidth; /* * Geometry of the agent's window in window mode. Used to restore * window size when switching back to window mode from fullscreen. */ int WMBorderWidth; int WMTitleHeight; int SavedX, SavedY, SavedWidth, SavedHeight; int SavedRootWidth, SavedRootHeight; /* * Set if agent is running nested in another agent X server. */ int Nested; /* * Selected backing-store mode. */ BackingStoreMode BackingStore; /* * Selected clipboard mode. */ ClipboardMode Clipboard; /* * Enable agent to use the MITSHM extension in path from remote * proxy to the real X server. */ int SharedMemory; /* * Enable agent to use shared Pixmaps */ int SharedPixmaps; /* * Enable agent to propagate keyboard and pointer device * configuration to the remote X server. */ int DeviceControl; /* * Explicitly asked config propagation. */ int DeviceControlUserDefined; /* * Resuming keyboard device corrects keymap if session migrates * across platforms with different keycode layout. */ int ResetKeyboardAtResume; /* * Reset server when the last client disconnects. */ int Reset; /* * Geometry of the agent root window, relative to the agent default * window. */ int RootX, RootY, RootWidth, RootHeight; /* * Horizontal and vertical span of the agent viewport. */ int ViewportXSpan, ViewportYSpan; /* * True if the user can resize the desktop by dragging the window * border. */ int DesktopResize; /* * The scaling ratio of the shadow agent. */ int Ratio, XRatio, YRatio; float FloatRatio, FloatXRatio, FloatYRatio; /* * The shadow agent uses the Damage extension. */ int UseDamage; /* * Was the agent run with the -B option? */ int Binder; char *BinderOptions; /* * Set if the agent has to connect to a desktop manager to start the * session. */ int Xdmcp; /* * Size of the Xlib display buffer. The default is set according to * the link type. */ int DisplayBuffer; /* * Buffer coalescence timeout. */ int DisplayCoalescence; /* * Use the composite extension when available on the remote display. */ int Composite; /* * If set, don't skip internal operations when the agent window is * not fully visible. */ int IgnoreVisibility; /* * If set, prevent the shadow session to interact with master * display. */ int ViewOnly; /* * If true select a lossy or lossless compression method based on * the characteristics of the image. */ int Adaptive; /* * Stream the images and update the display when the image has been * completely transerred. */ int Streaming; /* * Use a lazy approach in updating the remote display. This means * delaying the bandwidth consuming graphic operations and * synchronizing the screen at idle time. */ int DeferLevel; /* * Maximum elapsed time before a new full synchronization. */ unsigned long DeferTimeout; /* * Maximum size of the tile used when sending an image to the remote * display. */ int TileWidth, TileHeight; /* * Enabling/disabling the pulldown menu. */ int Menu; /* * Enabling/disabling the magic pixel. */ int MagicPixel; /* * Specify the Operative System of the client. */ int ClientOs; /* * Inhibit some XKEYBOARD requests. */ int InhibitXkb; /* * Maximum number of bytes that can be pasted from an NX session * into an external application. */ int CopyBufferSize; /* * Max image data rate to the encoder input. */ int ImageRateLimit; /* * True if agent should not exit if there are no clients in rootless * mode */ int NoRootlessExit; /* * Store if the user wants Xinerama. There are variables called * noPanoramiXExtension and noRRXineramaExtensison in os/utils.c but * we cannot rely on them because RandR and PanoramiX change their * values when trying to initialize. So we use this variable to save * the user preference provided by the -/+(rr)xinerama parameter(s) * before initializing those extensions. */ int Xinerama; /* * Sleep delay in microseconds. */ unsigned int SleepTime; /* * Tolerance - tightens or loosens reconnect checks. */ ToleranceChecksMode ReconnectTolerance; /* * Convert evdev keycodes to pc105. */ KeycodeConversionMode KeycodeConversion; /* * True if agent should grab the input in windowed mode whenever the * agent window gets the focus */ int AutoGrab; /* Should be Bool but I do not want to include Xlib.h here */ } AgentOptionsRec; typedef AgentOptionsRec *AgentOptionsPtr; extern AgentOptionsPtr nxagentOptionsPtr; /* * Macros and functions giving access to options. */ #define nxagentOption(option) \ (nxagentOptionsPtr -> option) #define nxagentChangeOption(option, value) \ (nxagentOptionsPtr -> option = (value)) #define nxagentOptions() \ (nxagentOptionsPtr) /* * Initialize the options to the default values. */ extern void nxagentInitOptions(void); /* * Initialize some options to the default values at reconnection. */ extern void nxagentResetOptions(void); /* * Save a copy of the current option repository. */ extern void nxagentSaveOptions(void); /* * Restore the options reset by nxagentResetOptions to their backup * value. */ extern void nxagentRestoreOptions(void); #endif /* __Options_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Pixels.c0000644000000000000000000002027613614532331020274 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include #include "Xmd.h" #include "Xlib.h" #define PANIC #define WARNING #undef TEST #undef DEBUG #define PIXEL_ELEMENTS 256 #define PIXEL_THRESHOLD 8 #define PIXEL_STEP 7 unsigned int Get16(const char *buffer, int order); unsigned int Get24(const char *buffer, int order); unsigned int Get32(const char *buffer, int order); void Put16(unsigned int value, char *buffer, int order); void Put24(unsigned int value, char *buffer, int order); void Put32(unsigned int value, char *buffer, int order); static int nxagentComparePixels(const void *p1, const void *p2) { int pixel1 = *((int *) p1); int pixel2 = *((int *) p2); return (pixel1 < pixel2 ? -1 : (pixel1 == pixel2 ? 0 : 1)); } int nxagentUniquePixels(XImage *image) { int pixels[PIXEL_ELEMENTS]; int elements = PIXEL_ELEMENTS; int unique = 0; int last = -1; const char *next = image -> data; #ifdef TEST fprintf(stderr, "nxagentUniquePixels: Image geometry [%d,%d] depth [%d] bits per pixel [%d].\n", image -> width, image -> height, image -> depth, image -> bits_per_pixel); #endif /* * Take at most 256 pixels from the image. */ int total = image -> width * image -> height; int step = total / elements; if (step < PIXEL_STEP) { step = PIXEL_STEP; } #ifdef TEST fprintf(stderr, "nxagentUniquePixels: Step is [%d] with [%d] pixels and [%d] elements.\n", step, total, elements); #endif /* * Shift at the left after each scanline. */ if (image -> bytes_per_line % step == 0) { step++; #ifdef TEST fprintf(stderr, "nxagentUniquePixels: Increasing step to [%d] with [%d] bytes per line.\n", step, image -> bytes_per_line); #endif } elements = total / step; if (elements > PIXEL_ELEMENTS) { elements = PIXEL_ELEMENTS; } #ifdef TEST fprintf(stderr, "nxagentUniquePixels: Step is now [%d] with [%d] elements.\n", step, elements); #endif if (elements < PIXEL_THRESHOLD) { #ifdef TEST fprintf(stderr, "nxagentUniquePixels: Assuming ratio [100] with only [%d] elements.\n", elements); #endif return 100; } #ifdef TEST fprintf(stderr, "nxagentUniquePixels: Scanning [%d] pixels out of [%d] with step [%d].\n", elements, total, step); #endif /* * Take one pixel every n from the image and add it to the array. */ switch (image -> bits_per_pixel) { case 32: { for (int i = 0; i < elements; i++) { pixels[i] = Get32(next, image -> byte_order); next += (4 * step); #ifdef DEBUG fprintf(stderr, "nxagentUniquePixels: pixels[%d][0x%08x].\n", i, pixels[i]); #endif } break; } case 24: { for (int i = 0; i < elements; i++) { pixels[i] = Get24(next, image -> byte_order); next += (3 * step); #ifdef DEBUG fprintf(stderr, "nxagentUniquePixels: pixels[%d][0x%08x].\n", i, pixels[i]); #endif } break; } case 16: case 15: { /* * Note that the padding bytes at the end of the scanline are * included in the set. This is not a big problem. What we want * to find out is just how compressible is the image data. */ for (int i = 0; i < elements; i++) { pixels[i] = Get16(next, image -> byte_order); next += (2 * step); #ifdef DEBUG fprintf(stderr, "nxagentUniquePixels: pixels[%d][0x%08x].\n", i, pixels[i]); #endif } break; } default: { #ifdef PANIC fprintf(stderr, "nxagentUniquePixels: PANIC! Assuming ratio [100] with [%d] bits per pixel.\n", image -> bits_per_pixel); #endif return 100; } } #ifdef TEST fprintf(stderr, "nxagentUniquePixels: Sorting [%d] elements in the list.\n", i); #endif qsort(pixels, elements, sizeof(int), nxagentComparePixels); for (int i = 0; i < elements; i++) { if (last != pixels[i]) { unique++; last = pixels[i]; } #ifdef DEBUG fprintf(stderr, "nxagentUniquePixels: pixels[%d][0x%08x].\n", i, pixels[i]); #endif } int ratio = unique * 100 / elements; #ifdef TEST fprintf(stderr, "nxagentUniquePixels: Found [%d] unique pixels out of [%d] with ratio [%d%%].\n", unique, elements, ratio); #endif return ratio; } unsigned int Get16(const char *buffer, int order) { unsigned int result; if (order == MSBFirst) { result = *buffer; result <<= 8; result += buffer[1]; } else { result = buffer[1]; result <<= 8; result += *buffer; } return result; } unsigned int Get24(const char *buffer, int order) { const char *next = (order == MSBFirst ? buffer : buffer + 2); unsigned int result = 0; for (int i = 0; i < 3; i++) { result <<= 8; result += *next; if (order == MSBFirst) { next++; } else { next--; } } return result; } unsigned int Get32(const char *buffer, int order) { const char *next = (order == MSBFirst ? buffer : buffer + 3); unsigned int result = 0; for (int i = 0; i < 4; i++) { result <<= 8; result += *next; if (order == MSBFirst) { next++; } else { next--; } } return result; } void Put16(unsigned int value, char *buffer, int order) { if (order == MSBFirst) { buffer[1] = (unsigned char) (value & 0xff); value >>= 8; *buffer = (unsigned char) value; } else { *buffer = (unsigned char) (value & 0xff); value >>= 8; buffer[1] = (unsigned char) value; } } void Put24(unsigned int value, char *buffer, int order) { if (order == MSBFirst) { buffer += 2; for (int i = 3; i > 0; i--) { *buffer-- = (unsigned char) (value & 0xff); value >>= 8; } } else { for (int i = 3; i > 0; i--) { *buffer++ = (unsigned char) (value & 0xff); value >>= 8; } } } void Put32(unsigned int value, char *buffer, int order) { if (order == MSBFirst) { buffer += 3; for (int i = 4; i > 0; i--) { *buffer-- = (unsigned char) (value & 0xff); value >>= 8; } } else { for (int i = 4; i > 0; i--) { *buffer++ = (unsigned char) (value & 0xff); value >>= 8; } } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Pixels.h0000644000000000000000000001733313614532331020301 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Pixels_H__ #define __Pixels_H__ #include "Visual.h" #include "Drawable.h" #include "Composite.h" /* * Count how many pixels are different * in the image. */ int nxagentUniquePixels(XImage *image); /* * Convert a 32 bit pixel to 16 bit. */ #define Color32to16(color) \ do \ { \ Visual *pVisual; \ \ pVisual = nxagentDefaultVisual(nxagentDefaultScreen); \ \ if (pVisual -> green_mask == 0x7e0) \ { \ /* \ * bit mask 5-6-5 \ */ \ \ color = (((color & (pVisual -> blue_mask << 3)) >> 3) | \ ((color & (pVisual -> green_mask << 5)) >> 5) | \ ((color & (pVisual -> red_mask << 8)) >> 8)); \ } \ else \ { \ /* \ * bit mask 5-5-5 \ */ \ \ color = (((color & (pVisual -> blue_mask << 3)) >> 3) | \ ((color & (pVisual -> green_mask << 6)) >> 6) | \ ((color & (pVisual -> red_mask << 9)) >> 9)); \ } \ } \ while (0) /* * Rules to break the synchronization loop. */ #define breakOnBlocking(mask) \ (((mask) != NEVER_BREAK) && ((mask) & BLOCKING_BREAK) && \ nxagentBlocking == 1) #define breakOnCongestion(mask) \ (((mask) != NEVER_BREAK) && ((mask) & CONGESTION_BREAK) && \ nxagentCongestion > 4) #define breakOnBlockingOrCongestion(mask) \ (breakOnBlocking(mask) != 0 || breakOnCongestion(mask) != 0) #define breakOnCongestionDrawable(mask, pDrawable) \ (((mask) != NEVER_BREAK) && ((mask) & CONGESTION_BREAK) && \ (nxagentCongestion > 4 || \ ((pDrawable) -> type == DRAWABLE_PIXMAP && \ nxagentCongestion > 1))) #define breakOnEvent(mask) \ (((mask) != NEVER_BREAK) && ((mask) & EVENT_BREAK) && \ nxagentUserInput(NULL) == 1) #define canBreakOnTimeout(mask) \ (((mask) != NEVER_BREAK) && nxagentOption(Shadow) == 0) /* * Macros defining the conditions to * defer X requests. */ #define NXAGENT_SHOULD_DEFER_TRAPEZOIDS(pDrawable) \ (nxagentOption(DeferLevel) >= 2 && \ nxagentDrawableContainGlyphs(pDrawable) == 0 && \ nxagentOption(LinkType) < LINK_TYPE_ADSL && \ nxagentCongestion > 4) /* FIXME: The condition checking for the render version is a workaround implemented to avoid problems with the render composite on XFree86 remote server. */ /* FIXME: Changed macro: NXAGENT_SHOULD_DEFER_COMPOSITE to handle situation, when pSrc -> pDrawable is NULL. This case happens with gradients and solid fill. #define NXAGENT_SHOULD_DEFER_COMPOSITE(pSrc, pMask, pDst) \ ((nxagentRenderVersionMajor == 0 && \ nxagentRenderVersionMinor == 8 && \ (pDst) -> pDrawable -> type == DRAWABLE_PIXMAP) || \ ((pDst) -> pDrawable -> type == DRAWABLE_PIXMAP && \ (nxagentDrawableStatus((pSrc) -> pDrawable) == NotSynchronized || \ ((pMask) && nxagentDrawableStatus((pMask) -> pDrawable) == NotSynchronized)) && \ nxagentOption(DeferLevel) == 1) || \ (nxagentOption(DeferLevel) >= 2 && \ nxagentOption(LinkType) < LINK_TYPE_ADSL)) */ #define NXAGENT_SHOULD_DEFER_COMPOSITE(pSrc, pMask, pDst) \ ((nxagentRenderVersionMajor == 0 && \ nxagentRenderVersionMinor == 8 && \ (pDst) -> pDrawable -> type == DRAWABLE_PIXMAP) || \ (nxagentOption(DeferLevel) >= 2 && \ nxagentOption(LinkType) < LINK_TYPE_ADSL) || \ (nxagentOption(DeferLevel) == 1 && \ (pDst) -> pDrawable -> type == DRAWABLE_PIXMAP && \ (((pSrc) -> pDrawable && nxagentDrawableStatus((pSrc) -> pDrawable) == NotSynchronized) || \ ((pMask) && (pMask) -> pDrawable && nxagentDrawableStatus((pMask) -> pDrawable) == NotSynchronized)))) #define NXAGENT_SHOULD_DEFER_PUTIMAGE(pDrawable) \ (nxagentSplitTrap == 0 && \ nxagentOption(DeferLevel) > 0) /* * Macros defining the conditions to * start the synchronization loops of * resources. */ #define NXAGENT_SHOULD_SYNCHRONIZE_CORRUPTED_WINDOWS(mask) \ ((nxagentCorruptedWindows > 0 && breakOnBlockingOrCongestion(mask) == 0) || \ mask == NEVER_BREAK) #define NXAGENT_SHOULD_SYNCHRONIZE_CORRUPTED_BACKGROUNDS(mask) \ ((nxagentCorruptedWindows == 0 && nxagentCorruptedBackgrounds > 0 && \ breakOnBlockingOrCongestion(mask) == 0) || mask == NEVER_BREAK) #define NXAGENT_SHOULD_SYNCHRONIZE_CORRUPTED_PIXMAPS(mask) \ ((nxagentCorruptedWindows == 0 && nxagentCorruptedPixmaps > 0 && \ nxagentCongestion == 0 && nxagentBlocking == 0) || \ mask == NEVER_BREAK) /* * Macros defining the conditions to * synchronize a single resource. */ #define NXAGENT_SHOULD_SYNCHRONIZE_WINDOW(pDrawable) \ (nxagentWindowIsVisible((WindowPtr) pDrawable) == 1 && \ (nxagentDefaultWindowIsVisible() == 1 || nxagentCompositeEnable == 1)) #define MINIMUM_PIXMAP_USAGE_COUNTER 2 #define NXAGENT_SHOULD_SYNCHRONIZE_PIXMAP(pDrawable) \ (nxagentPixmapUsageCounter((PixmapPtr) pDrawable) >= \ MINIMUM_PIXMAP_USAGE_COUNTER || \ nxagentIsCorruptedBackground((PixmapPtr) pDrawable) == 1) #endif /* __Pixels_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c0000644000000000000000000011571613614532331020272 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "scrnintstr.h" #include "miscstruct.h" #include "pixmapstr.h" #include "dixstruct.h" #include "regionstr.h" #include "../../include/gc.h" #include "servermd.h" #include "mi.h" #include "../../fb/fb.h" #include "Agent.h" #include "Display.h" #include "Screen.h" #include "Pixmaps.h" #include "Trap.h" #include "GCs.h" #include "GCOps.h" #include "Image.h" #include "Split.h" #include "Drawable.h" #include "Visual.h" #include "Client.h" #include "Events.h" #include "Args.h" #include "Utils.h" #include "compext/Compext.h" #include RESTYPE RT_NX_PIXMAP; /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG #undef DUMP #ifdef TEST #include "Font.h" #endif int nxagentPixmapPrivateIndex; int nxagentCorruptedPixmaps; int nxagentCorruptedBackgrounds; /* * Force deallocation of the virtual pixmap. */ static Bool nxagentDestroyVirtualPixmap(PixmapPtr pPixmap); /* * This serves as a tool to check the synchronization * between pixmaps in framebuffer and the correspondent * pixmaps in the real X server. */ #ifdef TEST Bool nxagentCheckPixmapIntegrity(PixmapPtr pPixmap); #endif struct nxagentPixmapPair { Pixmap pixmap; PixmapPtr pMap; }; PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint) { #ifdef DEBUG fprintf(stderr, "nxagentCreatePixmap: Creating pixmap with width [%d] " "height [%d] depth [%d] and allocation hint [%d].\n", width, height, depth, usage_hint); #endif /* * Create the pixmap structure but do not allocate memory for the * data. */ PixmapPtr pPixmap = AllocatePixmap(pScreen, 0); if (!pPixmap) { #ifdef WARNING fprintf(stderr, "nxagentCreatePixmap: WARNING! Failed to create pixmap with " "width [%d] height [%d] depth [%d] and allocation hint [%d].\n", width, height, depth, usage_hint); #endif return NullPixmap; } /* * Initialize the core members. */ pPixmap -> drawable.type = DRAWABLE_PIXMAP; pPixmap -> drawable.class = 0; pPixmap -> drawable.pScreen = pScreen; pPixmap -> drawable.depth = depth; pPixmap -> drawable.bitsPerPixel = BitsPerPixel(depth); pPixmap -> drawable.id = 0; pPixmap -> drawable.serialNumber = NEXT_SERIAL_NUMBER; pPixmap -> drawable.x = 0; pPixmap -> drawable.y = 0; pPixmap -> drawable.width = width; pPixmap -> drawable.height = height; pPixmap -> devKind = 0; pPixmap -> refcnt = 1; pPixmap -> devPrivate.ptr = NULL; pPixmap -> usage_hint = usage_hint; /* * Initialize the privates of the real picture. */ nxagentPrivPixmapPtr pPixmapPriv = nxagentPixmapPriv(pPixmap); pPixmapPriv -> isVirtual = False; pPixmapPriv -> isShared = nxagentShmPixmapTrap; /* * The shared memory pixmaps are never * synchronized with the remote X Server. */ if (pPixmapPriv -> isShared == 1) { BoxRec box = { .x1 = 0, .y1 = 0, .x2 = width, .y2 = height }; pPixmapPriv -> corruptedRegion = RegionCreate(&box, 1); } else { pPixmapPriv -> corruptedRegion = RegionCreate((BoxRec *) NULL, 1); } pPixmapPriv -> corruptedBackground = 0; pPixmapPriv -> containGlyphs = 0; pPixmapPriv -> containTrapezoids = 0; /* * The lazy encoding policy generally does not send on remote X * server the off-screen images, by preferring to synchronize the * windows content. Anyway this behaviour may be inadvisable if a * pixmap is used, for example, for multiple copy areas on screen. * This counter serves the purpose, taking into account the number * of times the pixmap has been used as source for a deferred * operation. */ pPixmapPriv -> usageCounter = 0; pPixmapPriv -> corruptedBackgroundId = 0; pPixmapPriv -> corruptedId = 0; pPixmapPriv -> synchronizationBitmap = NullPixmap; pPixmapPriv -> corruptedTimestamp = 0; pPixmapPriv -> splitResource = NULL; pPixmapPriv -> isBackingPixmap = 0; /* * Create the pixmap based on the default windows. The proxy knows * this and uses this information to optimize encode the create * pixmap message by including the id of the drawable in the * checksum. */ if (width != 0 && height != 0 && nxagentGCTrap == 0) { pPixmapPriv -> id = XCreatePixmap(nxagentDisplay, nxagentDefaultWindows[pScreen -> myNum], width, height, depth); } else { pPixmapPriv -> id = 0; #ifdef TEST fprintf(stderr, "nxagentCreatePixmap: Skipping the creation of pixmap at [%p] on real " "X server with nxagentGCTrap [%d].\n", (void *) pPixmap, nxagentGCTrap); #endif } pPixmapPriv -> mid = FakeClientID(serverClient -> index); AddResource(pPixmapPriv -> mid, RT_NX_PIXMAP, pPixmap); pPixmapPriv -> pRealPixmap = pPixmap; pPixmapPriv -> pVirtualPixmap = NULL; pPixmapPriv -> pPicture = NULL; /* * Create the pixmap in the virtual framebuffer. */ PixmapPtr pVirtual = fbCreatePixmap(pScreen, width, height, depth, usage_hint); if (pVirtual == NULL) { #ifdef PANIC fprintf(stderr, "nxagentCreatePixmap: PANIC! Failed to create virtual pixmap with " "width [%d] height [%d] depth [%d] and allocation hint [%d].\n", width, height, depth, usage_hint); #endif nxagentDestroyPixmap(pPixmap); return NullPixmap; } #ifdef TEST fprintf(stderr, "nxagentCreatePixmap: Allocated memory for the Virtual %sPixmap %p of real Pixmap %p (%dx%d),", "allocation hint [%d].\n", nxagentShmPixmapTrap ? "Shm " : "", (void *) pVirtual, (void *) pPixmap, width, height, usage_hint); #endif pPixmapPriv -> pVirtualPixmap = pVirtual; /* * Initialize the privates of the virtual picture. We could avoid to * use a flag and just check the pointer to the virtual pixmap that, * if the pixmap is actually virtual, will be NULL. Unfortunately * the flag can be changed in nxagentValidateGC(). That code should * be removed in future. */ nxagentPrivPixmapPtr pVirtualPriv = nxagentPixmapPriv(pVirtual); pVirtualPriv -> isVirtual = True; pVirtualPriv -> isShared = nxagentShmPixmapTrap; pVirtualPriv -> corruptedRegion = RegionCreate((BoxRec *) NULL, 1); pVirtualPriv -> corruptedBackground = 0; pVirtualPriv -> containGlyphs = 0; pVirtualPriv -> containTrapezoids = 0; pVirtualPriv -> usageCounter = 0; pVirtualPriv -> corruptedBackgroundId = 0; pVirtualPriv -> corruptedId = 0; pVirtualPriv -> synchronizationBitmap = NullPixmap; pVirtualPriv -> corruptedTimestamp = 0; pVirtualPriv -> splitResource = NULL; /* * We might distinguish real and virtual pixmaps by checking the * pointers to pVirtualPixmap. We should also remove the copy of id * and use the one of the real pixmap. */ pVirtualPriv -> id = pPixmapPriv -> id; pVirtualPriv -> mid = 0; /* * Storing a pointer back to the real pixmap is silly. Unfortunately * this is the way it has been originally implemented. See also the * comment in destroy of the pixmap. */ pVirtualPriv -> pRealPixmap = pPixmap; pVirtualPriv -> pVirtualPixmap = NULL; pVirtualPriv -> pPicture = NULL; #ifdef TEST fprintf(stderr, "nxagentCreatePixmap: Created pixmap at [%p] virtual at [%p] with width [%d] " "height [%d] depth [%d] and allocation hint [%d].\n", (void *) pPixmap, (void *) pVirtual, width, height, depth, usage_hint); #endif return pPixmap; } Bool nxagentDestroyPixmap(PixmapPtr pPixmap) { if (!pPixmap) { #ifdef PANIC fprintf(stderr, "nxagentDestroyPixmap: PANIC! Invalid attempt to destroy " "a null pixmap pointer.\n"); #endif return False; } nxagentPrivPixmapPtr pPixmapPriv = nxagentPixmapPriv(pPixmap); PixmapPtr pVirtual = pPixmapPriv -> pVirtualPixmap; #ifdef TEST fprintf(stderr, "nxagentDestroyPixmap: Destroying pixmap at [%p] with virtual at [%p].\n", (void *) pPixmap, (void *) pVirtual); #endif if (pPixmapPriv -> isVirtual) { /* * For some pixmaps we receive the destroy only for the * virtual. Infact to draw in the framebuffer we can use the * virtual pixmap instead of the pointer to the real one. As the * virtual pixmap can collect references, we must transfer those * references to the real pixmap so we can continue as the destroy * had been requested for it. */ pVirtual = pPixmap; pPixmap = pPixmapPriv -> pRealPixmap; pPixmapPriv = nxagentPixmapPriv(pPixmap); /* * Move the references accumulated by the virtual pixmap into the * references of the real one. */ int refcnt = pVirtual -> refcnt - 1; #ifdef TEST fprintf(stderr, "nxagentDestroyPixmap: Adding [%d] references to pixmap at [%p].\n", refcnt, (void *) pPixmap); #endif pPixmap -> refcnt += refcnt; pVirtual -> refcnt -= refcnt; } --pPixmap -> refcnt; #ifdef TEST fprintf(stderr, "nxagentDestroyPixmap: Pixmap has now [%d] references with virtual pixmap [%d].\n", pPixmap -> refcnt, pVirtual -> refcnt); if (pVirtual != NULL && pVirtual -> refcnt != 1) { fprintf(stderr, "nxagentDestroyPixmap: PANIC! Virtual pixmap has [%d] references.\n", pVirtual -> refcnt); } #endif if (pPixmap -> refcnt > 0) { return True; } #ifdef TEST fprintf(stderr, "nxagentDestroyPixmap: Managing to destroy the pixmap at [%p]\n", (void *) pPixmap); #endif nxagentRemoveItemBSPixmapList(nxagentPixmap(pPixmap)); nxagentDestroyVirtualPixmap(pPixmap); if (pPixmapPriv -> corruptedRegion != NullRegion) { RegionDestroy(pPixmapPriv -> corruptedRegion); pPixmapPriv -> corruptedRegion = NullRegion; } if (nxagentSynchronization.pDrawable == (DrawablePtr) pPixmap) { nxagentSynchronization.pDrawable = NULL; #ifdef TEST fprintf(stderr, "nxagentDestroyPixmap: Synchronization drawable [%p] removed from resources.\n", (void *) pPixmap); #endif } nxagentDestroyCorruptedResource((DrawablePtr) pPixmap, RT_NX_CORR_BACKGROUND); nxagentDestroyCorruptedResource((DrawablePtr) pPixmap, RT_NX_CORR_PIXMAP); nxagentDestroyDrawableBitmap((DrawablePtr) pPixmap); if (pPixmapPriv -> splitResource != NULL) { nxagentReleaseSplit((DrawablePtr) pPixmap); } /* * A pixmap with width and height set to 0 is * created at the beginning. To this pixmap is * not assigned an id. This is likely a scratch * pixmap used by the X server. */ if (pPixmapPriv -> id) { XFreePixmap(nxagentDisplay, pPixmapPriv -> id); } if (pPixmapPriv -> mid) { FreeResource(pPixmapPriv -> mid, RT_NONE); } SAFE_free(pPixmap); return True; } Bool nxagentDestroyVirtualPixmap(PixmapPtr pPixmap) { PixmapPtr pVirtual = nxagentPixmapPriv(pPixmap) -> pVirtualPixmap; /* * Force the routine to get rid of the virtual * pixmap. */ if (pVirtual != NULL) { pVirtual -> refcnt = 1; nxagentPrivPixmapPtr pVirtualPriv = nxagentPixmapPriv(pVirtual); if (pVirtualPriv -> corruptedRegion != NullRegion) { RegionDestroy(pVirtualPriv -> corruptedRegion); pVirtualPriv -> corruptedRegion = NullRegion; } fbDestroyPixmap(pVirtual); } return True; } RegionPtr nxagentPixmapToRegion(PixmapPtr pPixmap) { #ifdef TEST fprintf(stderr, "nxagentPixmapToRegion: Pixmap = [%p] nxagentVirtualPixmap = [%p]\n", (void *) pPixmap, (void *) nxagentVirtualPixmap(pPixmap)); #endif return fbPixmapToRegion(nxagentVirtualPixmap(pPixmap)); } Bool nxagentModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, void * pPixData) { /* * See miModifyPixmapHeader() in miscrinit.c. This function is used * to recycle the scratch pixmap for this screen. We let it refer to * the virtual pixmap. */ if (!pPixmap) { return False; } if (nxagentPixmapIsVirtual(pPixmap)) { #ifdef PANIC fprintf(stderr, "nxagentModifyPixmapHeader: PANIC! Pixmap at [%p] is virtual.\n", (void *) pPixmap); #endif FatalError("nxagentModifyPixmapHeader: PANIC! Pixmap is virtual."); } PixmapPtr pVirtualPixmap = nxagentVirtualPixmap(pPixmap); #ifdef TEST fprintf(stderr, "nxagentModifyPixmapHeader: Pixmap at [%p] Virtual at [%p].\n", (void *) pPixmap, (void *) pVirtualPixmap); fprintf(stderr, "nxagentModifyPixmapHeader: Pixmap has width [%d] height [%d] depth [%d] " "bits-per-pixel [%d] devKind [%d] pPixData [%p].\n", pPixmap->drawable.width, pPixmap->drawable.height, pPixmap->drawable.depth, pPixmap->drawable.bitsPerPixel, pPixmap->devKind, (void *) pPixmap->devPrivate.ptr); fprintf(stderr, "nxagentModifyPixmapHeader: New parameters are width [%d] height [%d] depth [%d] " "bits-per-pixel [%d] devKind [%d] pPixData [%p].\n", width, height, depth, bitsPerPixel, devKind, (void *) pPixData); #endif /* * ignore return code, because the only case where this will return * FALSE is pPixmap == NULL, which we have already caught above. */ miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind, pPixData); miModifyPixmapHeader(pVirtualPixmap, width, height, depth, bitsPerPixel, devKind, pPixData); #ifdef PANIC if (!((width > 0) && (height > 0) && (depth > 0) && (bitsPerPixel > 0) && (devKind > 0) && pPixData)) { if (pPixmap->drawable.x != 0 || pPixmap->drawable.y != 0) { fprintf(stderr, "nxagentModifyPixmapHeader: PANIC! Pixmap at [%p] has x [%d] and y [%d].\n", (void *) pPixmap, pPixmap->drawable.x, pPixmap->drawable.y); FatalError("nxagentModifyPixmapHeader: PANIC! Pixmap has x or y greater than zero."); } } #endif return True; } static void nxagentPixmapMatchID(void *p0, XID x1, void *p2) { PixmapPtr pPixmap = (PixmapPtr)p0; struct nxagentPixmapPair *pPair = p2; if ((pPair -> pMap == NULL) && (nxagentPixmap(pPixmap) == pPair -> pixmap)) { pPair -> pMap = pPixmap; } } PixmapPtr nxagentPixmapPtr(Pixmap pixmap) { if (pixmap == None) { return NULL; } struct nxagentPixmapPair pair = { .pixmap = pixmap, .pMap = NULL }; FindClientResourcesByType(clients[serverClient -> index], RT_NX_PIXMAP, nxagentPixmapMatchID, &pair); for (int i = 0; (pair.pMap == NULL) && (i < MAXCLIENTS); i++) { if (clients[i]) { FindClientResourcesByType(clients[i], RT_PIXMAP, nxagentPixmapMatchID, &pair); } } #ifdef WARNING if (pair.pMap == NULL) { fprintf(stderr, "nxagentPixmapPtr: WARNING! Failed to find " "remote pixmap [%ld].\n", (long int) pair.pixmap); } else if (nxagentDrawableStatus((DrawablePtr) pair.pMap) == NotSynchronized) { fprintf(stderr, "WARNING! Rootless icon at [%p] [%d,%d] is not synchronized.\n", (void *) pair.pMap, pair.pMap -> drawable.width, pair.pMap -> drawable.height); } #endif return pair.pMap; } /* * Reconnection stuff. */ int nxagentDestroyNewPixmapResourceType(void * p, XID id) { /* * Address of the destructor is set in Init.c. */ #ifdef TEST fprintf(stderr, "nxagentDestroyNewPixmapResourceType: Destroying mirror id [%ld] for pixmap at [%p].\n", nxagentPixmapPriv((PixmapPtr) p) -> mid, (void *) p); #endif nxagentPixmapPriv((PixmapPtr) p) -> mid = None; return True; } void nxagentDisconnectPixmap(void *p0, XID x1, void *p2) { PixmapPtr pPixmap = (PixmapPtr) p0; #ifdef TEST Bool *pBool = (Bool*) p2; fprintf(stderr, "nxagentDisconnectPixmap: Called with bool [%d] and pixmap at [%p].\n", *pBool, (void *) pPixmap); fprintf(stderr, "nxagentDisconnectPixmap: Virtual pixmap is [%ld].\n", nxagentPixmap(pPixmap)); #endif nxagentPixmap(pPixmap) = None; if (nxagentDrawableStatus((DrawablePtr) pPixmap) == NotSynchronized) { nxagentDestroyCorruptedResource((DrawablePtr) pPixmap, RT_NX_CORR_BACKGROUND); nxagentDestroyCorruptedResource((DrawablePtr) pPixmap, RT_NX_CORR_PIXMAP); } } void nxagentDisconnectAllPixmaps(void) { int r; #ifdef TEST fprintf(stderr, "nxagentDisconnectAllPixmaps: Going to iterate through pixmap resources.\n"); #endif /* * The RT_NX_PIXMAP resource type is allocated only on the server * client, so we don't need to find it through the other clients * too. */ r = 1; FindClientResourcesByType(clients[serverClient -> index], RT_NX_PIXMAP, nxagentDisconnectPixmap, &r); #ifdef WARNING /* Note: nxagentDisconnectPixmap() does not modify r - so this check can never succeed */ if (r == 0) { fprintf(stderr, "nxagentDisconnectAllPixmaps: WARNING! Failed to disconnect " "pixmap for client [%d].\n", serverClient -> index); } #endif for (int i = 0; i < MAXCLIENTS; i++) { if (clients[i]) { #ifdef TEST fprintf(stderr, "nxagentDisconnectAllPixmaps: Going to disconnect pixmaps of client [%d].\n", i); #endif r = 1; FindClientResourcesByType(clients[i], RT_PIXMAP, nxagentDisconnectPixmap, &r); #ifdef WARNING /* Note: nxagentDisconnectPixmap() does not modify r - so this check can never succeed */ if (r == 0) { fprintf(stderr, "nxagentDisconnectAllPixmaps: WARNING! Failed to disconnect " "pixmap for client [%d].\n", i); } #endif } } #ifdef TEST fprintf(stderr, "nxagentDisconnectAllPixmaps: Pixmaps disconnection completed.\n"); #endif return; } void nxagentReconnectPixmap(void *p0, XID x1, void *p2) { PixmapPtr pPixmap = (PixmapPtr) p0; Bool *pBool = (Bool*) p2; if (!*pBool || pPixmap == NULL || NXDisplayError(nxagentDisplay) == 1) { *pBool = False; #ifdef TEST fprintf(stderr, "nxagentReconnectPixmap: Ignoring pixmap at [%p] while " "recovering from the error.\n", (void *) pPixmap); #endif return; } else if (pPixmap == nxagentDefaultScreen -> pScratchPixmap) { /* * Every time the scratch pixmap is used its data is changed, so * we don't need to reconnect it. */ #ifdef TEST fprintf(stderr, "nxagentReconnectPixmap: Ignoring scratch pixmap at [%p].\n", (void *) pPixmap); #endif return; } #ifdef TEST fprintf(stderr, "nxagentReconnectPixmap: Called with result [%d] and pixmap at [%p].\n", *pBool, (void *) pPixmap); fprintf(stderr, "nxagentReconnectPixmap: Virtual pixmap is at [%p] picture is at [%p].\n", (void *) nxagentPixmapPriv(pPixmap) -> pVirtualPixmap, (void *) nxagentPixmapPriv(pPixmap) -> pPicture); #endif nxagentPrivPixmapPtr pPixmapPriv = nxagentPixmapPriv(pPixmap); if (pPixmap -> drawable.width && pPixmap -> drawable.height) { pPixmapPriv -> id = XCreatePixmap(nxagentDisplay, nxagentDefaultWindows[pPixmap -> drawable.pScreen -> myNum], pPixmap -> drawable.width, pPixmap -> drawable.height, pPixmap -> drawable.depth); nxagentPixmap(pPixmapPriv -> pVirtualPixmap) = pPixmapPriv -> id; #ifdef TEST fprintf(stderr, "nxagentReconnectPixmap: Created virtual pixmap with id [%ld] for pixmap at [%p].\n", nxagentPixmap(pPixmap), (void *) pPixmap); #endif if (pPixmap == (PixmapPtr) nxagentDefaultScreen -> devPrivate) { #ifdef WARNING fprintf(stderr, "nxagentReconnectPixmap: WARNING! Pixmap is root screen. Returning.\n"); #endif return; } nxagentSplitTrap = 1; *pBool = nxagentSynchronizeDrawableData((DrawablePtr) pPixmap, NEVER_BREAK, NULL); nxagentSplitTrap = 0; if (!*pBool) { #ifdef PANIC fprintf(stderr, "nxagentReconnectPixmap: PANIC! Failed to synchronize the pixmap.\n"); #endif } if (nxagentDrawableStatus((DrawablePtr) pPixmap) == NotSynchronized) { if (nxagentIsCorruptedBackground(pPixmap) == 1) { nxagentAllocateCorruptedResource((DrawablePtr) pPixmap, RT_NX_CORR_BACKGROUND); nxagentFillRemoteRegion((DrawablePtr) pPixmap, nxagentCorruptedRegion((DrawablePtr) pPixmap)); } else { nxagentAllocateCorruptedResource((DrawablePtr) pPixmap, RT_NX_CORR_PIXMAP); } } } } Bool nxagentReconnectAllPixmaps(void *p0) { Bool result = 1; #ifdef TEST fprintf(stderr, "nxagentReconnectAllPixmaps: Going to recreate all pixmaps.\n"); #endif /* * Reset the geometry and alpha information * used by proxy to unpack the packed images. */ nxagentResetVisualCache(); nxagentResetAlphaCache(); /* * The RT_NX_PIXMAP resource type is allocated only on the server * client, so we don't need to find it through the other clients * too. */ FindClientResourcesByType(clients[serverClient -> index], RT_NX_PIXMAP, nxagentReconnectPixmap, &result); #ifdef WARNING if (result == 0) { fprintf(stderr, "nxagentReconnectAllPixmaps: WARNING! Failed to reconnect " "pixmap for client [%d].\n", serverClient -> index); } #endif /* * FIXME: This is a bit cumbersome: at the end of each iteration * result will be reset to 1. Therefore at loop exit result will * always be 1 meaning the whole function will always return 1... */ result = 1; for (int i = 0; i < MAXCLIENTS; result = 1, i++) { if (clients[i] != NULL) { #ifdef TEST fprintf(stderr, "nxagentReconnectAllPixmaps: Going to reconnect pixmaps of client [%d].\n", i); #endif /* * Let the pixmap be reconnected as it was an image request * issued by the client owning the resource. The client index is * used as a subscript by the image routines to cache the data * per-client. */ FindClientResourcesByType(clients[i], RT_PIXMAP, nxagentReconnectPixmap, &result); #ifdef WARNING if (result == 0) { fprintf(stderr, "nxagentReconnectAllPixmaps: WARNING! Failed to reconnect " "pixmap for client [%d].\n", serverClient -> index); } #endif } } #ifdef TEST fprintf(stderr, "nxagentReconnectAllPixmaps: Pixmaps reconnection completed.\n"); #endif return result; } #ifdef TEST static void nxagentCheckOnePixmapIntegrity(void *p0, XID x1, void *p2) { PixmapPtr pPixmap = (PixmapPtr) p0; Bool *pBool = (Bool*) p2; if (!*pBool) { return; } if (pPixmap == nxagentDefaultScreen -> devPrivate) { #ifdef TEST fprintf(stderr, "nxagentCheckOnePixmapIntegrity: pixmap %p is screen.\n", (void *) pPixmap); #endif return; } if (pPixmap == nxagentDefaultScreen -> PixmapPerDepth[0]) { #ifdef TEST fprintf(stderr, "nxagentCheckOnePixmapIntegrity: pixmap %p is default stipple of screen.\n", (void *) pPixmap); #endif return; } *pBool = nxagentCheckPixmapIntegrity(pPixmap); } Bool nxagentCheckPixmapIntegrity(PixmapPtr pPixmap) { Bool integrity = True; unsigned long plane_mask = AllPlanes; PixmapPtr pVirtual = nxagentVirtualPixmap(pPixmap); unsigned int width = pPixmap -> drawable.width; unsigned int height = pPixmap -> drawable.height; unsigned int depth = pPixmap -> drawable.depth; int format = (depth == 1) ? XYPixmap : ZPixmap; if (width && height) { unsigned int length = nxagentImageLength(width, height, format, 0, depth); char *data = malloc(length); if (data == NULL) { FatalError("nxagentCheckPixmapIntegrity: Failed to allocate a buffer of size %d.\n", length); } XImage *image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), 0, 0, width, height, plane_mask, format); if (image == NULL) { FatalError("XGetImage: Failed.\n"); SAFE_free(data); return False; } #ifdef WARNING fprintf(stderr, "nxagentCheckPixmapIntegrity: Image from X has length [%d] and checksum [0x%s].\n", length, nxagentChecksum(image->data, length)); #endif NXCleanImage(image); #ifdef WARNING fprintf(stderr, "nxagentCheckPixmapIntegrity: Image after clean has checksum [0x%s].\n", nxagentChecksum(image->data, length)); #endif fbGetImage((DrawablePtr) pVirtual, 0, 0, width, height, format, plane_mask, data); #ifdef WARNING fprintf(stderr, "nxagentCheckPixmapIntegrity: Image from FB has length [%d] and checksum [0x%s].\n", length, nxagentChecksum(data, length)); #endif if (image != NULL && memcmp(image -> data, data, length) != 0) { integrity = False; } else { integrity = True; #ifdef TEST fprintf(stderr, "nxagentCheckPixmapIntegrity: Pixmap at [%p] has been realized. " "Now remote and framebuffer data are synchronized.\n", (void *) pPixmap); #endif } #ifdef WARNING if (!integrity) { char *p = image -> data; char *q = data; for (int i = 0; i < length; i++) { if (p[i] != q[i]) { fprintf(stderr, "nxagentCheckPixmapIntegrity: Byte [%d] image -> data [%d] data [%d]. " "Buffers differ!\n", i, p[i], q[i]); } else { fprintf(stderr, "nxagentCheckPixmapIntegrity: Byte [%d] image -> data [%d] data [%d].\n", i, p[i], q[i]); } } fprintf(stderr, "nxagentCheckPixmapIntegrity: Pixmap at [%p] width [%d], height [%d], has been realized " "but the data buffer still differs.\n", (void *) pPixmap, width, height); fprintf(stderr, "nxagentCheckPixmapIntegrity: bytes_per_line [%d] byte pad [%d] format [%d].\n", image -> bytes_per_line, nxagentImagePad(width, height, 0, depth), image -> format); FatalError("nxagentCheckPixmapIntegrity: Image is corrupted!!\n"); } #endif if (image != NULL) { XDestroyImage(image); } SAFE_free(data); } else { #ifdef WARNING fprintf(stderr, "nxagentCheckPixmapIntegrity: Ignored pixmap at [%p] with geometry [%d] [%d].\n", (void *) pPixmap, width, height); #endif } return integrity; } Bool nxagentCheckAllPixmapIntegrity(void) { Bool imageIsGood = True; #ifdef TEST fprintf(stderr, "nxagentCheckAllPixmapIntegrity\n"); #endif FindClientResourcesByType(clients[serverClient -> index], RT_NX_PIXMAP, nxagentCheckOnePixmapIntegrity, &imageIsGood); for (int i = 0; (i < MAXCLIENTS) && (imageIsGood); i++) { if (clients[i]) { FindClientResourcesByType(clients[i], RT_PIXMAP, nxagentCheckOnePixmapIntegrity, &imageIsGood); } } #ifdef TEST fprintf(stderr, "nxagentCheckAllPixmapIntegrity: pixmaps integrity = %d.\n", imageIsGood); #endif return imageIsGood; } #endif void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict, int wPict, int hPict) { if (pDrawable -> type == DRAWABLE_PIXMAP && nxagentIsShmPixmap((PixmapPtr) pDrawable) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeShmPixmap: WARNING! Synchronizing shared pixmap at [%p].\n", (void *) pDrawable); #endif GCPtr pGC = nxagentGetScratchGC(pDrawable -> depth, pDrawable -> pScreen); CARD32 attributes[3]; attributes[0] = 0x228b22; attributes[1] = 0xffffff; attributes[2] = FillSolid; ChangeGC(pGC, GCForeground | GCBackground | GCFillStyle, attributes); ValidateGC(pDrawable, pGC); int width = (wPict != 0 && wPict <= pDrawable -> width) ? wPict : pDrawable -> width; int height = (hPict != 0 && hPict <= pDrawable -> height) ? hPict : pDrawable -> height; int depth = pDrawable -> depth; int format = (depth == 1) ? XYPixmap : ZPixmap; int length = nxagentImageLength(width, height, format, 0, depth); int saveTrap = nxagentGCTrap; nxagentGCTrap = 0; nxagentSplitTrap = 1; nxagentFBTrap = 1; char *data = malloc(length); if (data) { fbGetImage(nxagentVirtualDrawable(pDrawable), xPict, yPict, width, height, format, 0xffffffff, data); nxagentPutImage(pDrawable, pGC, depth, xPict, yPict, width, height, 0, format, data); SAFE_free(data); } #ifdef WARNING else { fprintf(stderr, "nxagentSynchronizeShmPixmap: WARNING! Failed to allocate memory for the operation.\n"); } #endif nxagentGCTrap = saveTrap; nxagentSplitTrap = 0; nxagentFBTrap = 0; nxagentFreeScratchGC(pGC); } } #ifdef DUMP /* * This function is useful to visualize a pixmap and check * its data consistency. To avoid the creation of many * windows, one pixmap only can be monitored at a time. */ Bool nxagentPixmapOnShadowDisplay(PixmapPtr pMap) { static Display *shadow; static Window win; static int init = True; static int showTime; static PixmapPtr pPixmap; static int depth; static int width; static int height; static int length; static unsigned int format; if (init) { if (pMap == NULL) { return False; } else { pPixmap = pMap; } depth = pPixmap -> drawable.depth; width = pPixmap -> drawable.width; height = pPixmap -> drawable.height; format = (depth == 1) ? XYPixmap : ZPixmap; shadow = XOpenDisplay("localhost:0"); if (shadow == NULL) { #ifdef WARNING fprintf(stderr, "nxagentPixmapOnShadowDisplay: WARNING! Shadow display not opened.\n"); #endif return False; } init = False; win = XCreateSimpleWindow(shadow, DefaultRootWindow(shadow), 0, 0, width, height, 0, 0xFFCC33, 0xFF); XMapWindow(shadow, win); XClearWindow(shadow, win); } /* FIXME: If the pixmap has a different depth from the window, the XPutImage returns a BadMatch. For example this may happen if the Render extension is enabled. Can we fix this creating a new pixmap? */ if (DisplayPlanes(shadow, DefaultScreen(shadow)) != depth) { #ifdef WARNING fprintf(stderr, "nxagentPixmapOnShadowDisplay: Pixmap and Window depths [%d - %d] are not equals!\n", depth, DisplayPlanes(shadow, DefaultScreen(shadow))); #endif return False; } /* * If the framebuffer is updated continuously, the nxagent * visualization becomes much too slow. */ if ((GetTimeInMillis() - showTime) < 500) { return False; } showTime = GetTimeInMillis(); length = nxagentImageLength(width, height, format, 0, depth); char * data = malloc(length); if (data == NULL) { #ifdef WARNING fprintf(stderr, "nxagentPixmapOnShadowDisplay: WARNING! Failed to allocate memory for the operation.\n"); #endif return False; } fbGetImage((DrawablePtr) nxagentVirtualPixmap(pPixmap), 0, 0, width, height, format, AllPlanes, data); Visual *pVisual = nxagentImageVisual((DrawablePtr) pPixmap, depth); if (pVisual == NULL) { #ifdef WARNING fprintf(stderr, "nxagentPixmapOnShadowDisplay: WARNING! Visual not found. Using default visual.\n"); #endif pVisual = nxagentVisuals[nxagentDefaultVisualIndex].visual; } XImage *image = XCreateImage(nxagentDisplay, pVisual, depth, format, 0, (char *) data, width, height, BitmapPad(nxagentDisplay), nxagentImagePad(width, format, 0, depth)); if (image == NULL) { #ifdef WARNING fprintf(stderr, "nxagentPixmapOnShadowDisplay: XCreateImage failed.\n"); #endif SAFE_free(data); return False; } XGCValues value = { .foreground = 0xff0000, .background = 0x000000, .plane_mask = 0xffffff, .fill_style = FillSolid }; XlibGC gc = XCreateGC(shadow, win, GCBackground | GCForeground | GCFillStyle | GCPlaneMask, &value); NXCleanImage(image); XPutImage(shadow, win, gc, image, 0, 0, 0, 0, width, height); XFreeGC(shadow, gc); if (image != NULL) { XDestroyImage(image); } return True; } Bool nxagentFbOnShadowDisplay(void) { static Display *shadow; static Window win; static int init = True; static int showTime; static int prevWidth, prevHeight; WindowPtr pWin = screenInfo.screens[0]->root; if (pWin == NULL) { #ifdef WARNING fprintf(stderr, "nxagentFbOnShadowDisplay: The parent window is NULL.\n"); #endif return False; } int depth = pWin -> drawable.depth; int width = pWin -> drawable.width; int height = pWin -> drawable.height; unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; if (init) { shadow = XOpenDisplay("localhost:0"); if (shadow == NULL) { #ifdef WARNING fprintf(stderr, "nxagentFbOnShadowDisplay: WARNING! Shadow display not opened.\n"); #endif return False; } init = False; prevWidth = width; prevHeight = height; win = XCreateSimpleWindow(shadow, DefaultRootWindow(shadow), 0, 0, width, height, 0, 0xFFCC33, 0xFF); XMapWindow(shadow, win); XClearWindow(shadow, win); } if (DisplayPlanes(shadow, DefaultScreen(shadow)) != depth) { #ifdef WARNING fprintf(stderr, "nxagentFbOnShadowDisplay: Depths [%d - %d] are not equals!\n", depth, DisplayPlanes(shadow, DefaultScreen(shadow))); #endif return False; } /* * If the framebuffer is updated continuously, the nxagent * visualization becomes too much slow. */ if ((GetTimeInMillis() - showTime) < 500) { return False; } showTime = GetTimeInMillis(); /* * If the root window is resized, also the window on shadow * display must be resized. */ if (prevWidth != width || prevHeight != height) { prevWidth = width; prevHeight = height; XWindowChanges values = { .width = width, .height = height }; XConfigureWindow(shadow, win, CWWidth | CWHeight, &values); } int length = nxagentImageLength(width, height, format, 0, depth); char *data = malloc(length); if (data == NULL) { #ifdef WARNING fprintf(stderr, "nxagentFbOnShadowDisplay: WARNING! Failed to allocate memory for the operation.\n"); #endif return False; } fbGetImage((DrawablePtr)pWin, 0, 0, width, height, format, AllPlanes, data); Visual *pVisual = nxagentImageVisual((DrawablePtr) pWin, depth); if (pVisual == NULL) { #ifdef WARNING fprintf(stderr, "nxagentFbOnShadowDisplay: WARNING! Visual not found. Using default visual.\n"); #endif pVisual = nxagentVisuals[nxagentDefaultVisualIndex].visual; } XImage *image = XCreateImage(nxagentDisplay, pVisual, depth, format, 0, (char *) data, width, height, BitmapPad(nxagentDisplay), nxagentImagePad(width, format, 0, depth)); if (image == NULL) { #ifdef WARNING fprintf(stderr, "nxagentFbOnShadowDisplay: XCreateImage failed.\n"); #endif SAFE_free(data); return False; } XGCValues value = { .foreground = 0xff0000, .background = 0x000000, .plane_mask = 0xffffff, .fill_style = FillSolid }; XlibGC gc = XCreateGC(shadow, win, GCBackground | GCForeground | GCFillStyle | GCPlaneMask, &value); NXCleanImage(image); XPutImage(shadow, win, gc, image, 0, 0, 0, 0, width, height); XFreeGC(shadow, gc); if (image != NULL) { XDestroyImage(image); } return True; } #endif #ifdef DEBUG void nxagentPrintResourceTypes(void) { fprintf(stderr, "nxagentPrintResourceTypes: RT_PIXMAP [%lu].\n", (unsigned long) RT_PIXMAP); fprintf(stderr, "nxagentPrintResourceTypes: RT_NX_PIXMAP [%lu].\n", (unsigned long) RT_NX_PIXMAP); fprintf(stderr, "nxagentPrintResourceTypes: RT_GC [%lu].\n", (unsigned long) RT_GC); fprintf(stderr, "nxagentPrintResourceTypes: RT_NX_GC [%lu].\n", (unsigned long) RT_NX_GC); fprintf(stderr, "nxagentPrintResourceTypes: RT_FONT [%lu].\n", (unsigned long) RT_FONT); fprintf(stderr, "nxagentPrintResourceTypes: RT_NX_FONT [%lu].\n", (unsigned long) RT_NX_FONT); fprintf(stderr, "nxagentPrintResourceTypes: RT_CURSOR [%lu].\n", (unsigned long) RT_CURSOR); fprintf(stderr, "nxagentPrintResourceTypes: RT_WINDOW [%lu].\n", (unsigned long) RT_WINDOW); fprintf(stderr, "nxagentPrintResourceTypes: RT_COLORMAP [%lu].\n", (unsigned long) RT_COLORMAP); } void nxagentPrintResourcePredicate(void *value, XID id, XID type, void *cdata) { fprintf(stderr, "nxagentPrintResourcePredicate: Resource [%p] id [%lu] type [%lu].\n", (void *) value, (unsigned long) id, (unsigned long) type); } void nxagentPrintResources(void) { nxagentPrintResourceTypes(); for (int i = 0; i < MAXCLIENTS; i++) { if (clients[i]) { Bool result; fprintf(stderr, "nxagentPrintResources: Printing resources for client [%d]:\n", i); FindAllClientResources(clients[i], nxagentPrintResourcePredicate, &result); } } } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Pixmaps.h0000644000000000000000000001164013614532331020451 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Pixmap_H__ #define __Pixmap_H__ #include "resource.h" #include "Split.h" extern RESTYPE RT_NX_PIXMAP; /* * Pixmap privates structure. */ typedef struct { Pixmap id; XID mid; Bool isVirtual; Bool isShared; PixmapPtr pVirtualPixmap; PixmapPtr pRealPixmap; void *pPicture; RegionPtr corruptedRegion; int corruptedBackground; int containGlyphs; int containTrapezoids; int usageCounter; XID corruptedBackgroundId; XID corruptedId; PixmapPtr synchronizationBitmap; Time corruptedTimestamp; SplitResourcePtr splitResource; int isBackingPixmap; } nxagentPrivPixmapRec; typedef nxagentPrivPixmapRec *nxagentPrivPixmapPtr; extern int nxagentPixmapPrivateIndex; /* * Pixmap privates macro. */ #define nxagentPixmapPriv(pPixmap) \ ((nxagentPrivPixmapPtr)((pPixmap) -> devPrivates[nxagentPixmapPrivateIndex].ptr)) #define nxagentPixmap(pPixmap) (nxagentPixmapPriv(pPixmap) -> id) #define nxagentPixmapIsVirtual(pPixmap) \ (nxagentPixmapPriv(pPixmap) -> isVirtual) #define nxagentIsShmPixmap(pPixmap) \ (nxagentPixmapPriv(pPixmap) -> isShared) #define nxagentRealPixmap(pPixmap) \ (nxagentPixmapPriv(pPixmap) -> pRealPixmap) #define nxagentVirtualPixmap(pPixmap) \ (nxagentPixmapPriv(pPixmap) -> isVirtual ? pPixmap : \ nxagentPixmapPriv(pPixmap) -> pVirtualPixmap) #define nxagentPixmapCorruptedRegion(pPixmap) \ (nxagentPixmapPriv(nxagentRealPixmap(pPixmap)) -> corruptedRegion) #define nxagentPixmapContainGlyphs(pPixmap) \ (nxagentPixmapPriv(nxagentRealPixmap(pPixmap)) -> containGlyphs) #define nxagentPixmapContainTrapezoids(pPixmap) \ (nxagentPixmapPriv(nxagentRealPixmap(pPixmap)) -> containTrapezoids) #define nxagentIsCorruptedBackground(pPixmap) \ (nxagentPixmapPriv(nxagentRealPixmap(pPixmap)) -> corruptedBackground) #define nxagentPixmapUsageCounter(pPixmap) \ (nxagentPixmapPriv(nxagentRealPixmap(pPixmap)) -> usageCounter) #define nxagentPixmapTimestamp(pPixmap) \ (nxagentPixmapPriv(nxagentRealPixmap(pPixmap)) -> corruptedTimestamp) PixmapPtr nxagentPixmapPtr(Pixmap pixmap); PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint); Bool nxagentDestroyPixmap(PixmapPtr pPixmap); RegionPtr nxagentPixmapToRegion(PixmapPtr pPixmap); Bool nxagentModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, void * pPixData); RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height); void nxagentReconnectPixmap(void *p0, XID x1, void *p2); Bool nxagentReconnectAllPixmaps(void *p0); void nxagentDisconnectPixmap(void *p0, XID x1, void* p2); void nxagentDisconnectAllPixmaps(void); int nxagentDestroyNewPixmapResourceType(void * p, XID id); void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict, int wPict, int hPict); Bool nxagentPixmapOnShadowDisplay(PixmapPtr pMap); Bool nxagentFbOnShadowDisplay(); #endif /* __Pixmap_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Pointer.c0000644000000000000000000001306413614532331020445 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #include "X.h" #include "Xproto.h" #include "screenint.h" #include "inputstr.h" #include "misc.h" #include "scrnintstr.h" #include "servermd.h" #include "mipointer.h" #include "Agent.h" #include "Args.h" #include "Display.h" #include "Screen.h" #include "Pointer.h" #include "Events.h" #include "Options.h" #include "compext/Compext.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG /* * The nxagentReversePointerMap array is used to memorize remote * display pointer map. */ unsigned char nxagentReversePointerMap[MAXBUTTONS]; void nxagentChangePointerControl(DeviceIntPtr pDev, PtrCtrl *ctrl) { /* * The original behaviour was to reset the pointer settings * (acceleration and alas) to the default values. What the average * user expects, on the contrary, is to have agent inheriting * whatever value is set on the real X display. Having to reflect * changes made inside the agent session, the correct behavior would * be saving the original values and restoring them as soon as focus * leaves the agent's window. */ if (nxagentOption(DeviceControl) == True) { #ifdef TEST fprintf(stderr, "%s: WARNING! Propagating changes to pointer settings.\n", __func__); #endif XChangePointerControl(nxagentDisplay, True, True, ctrl->num, ctrl->den, ctrl->threshold); return; } #ifdef TEST fprintf(stderr, "%s: WARNING! Not propagating changes to pointer settings.\n", __func__); #endif } int nxagentPointerProc(DeviceIntPtr pDev, int onoff) { switch (onoff) { case DEVICE_INIT: #ifdef TEST fprintf(stderr, "%s: Called for [DEVICE_INIT].\n", __func__); #endif if (NXDisplayError(nxagentDisplay) == 1) { return Success; } CARD8 map[MAXBUTTONS]; int nmap = XGetPointerMapping(nxagentDisplay, map, MAXBUTTONS); for (int i = 0; i <= nmap; i++) map[i] = i; /* buttons are already mapped */ InitPointerDeviceStruct((DevicePtr) pDev, map, nmap, miPointerGetMotionEvents, nxagentChangePointerControl, miPointerGetMotionBufferSize()); break; case DEVICE_ON: #ifdef TEST fprintf(stderr, "%s: Called for [DEVICE_ON].\n", __func__); #endif if (NXDisplayError(nxagentDisplay) == 1) { return Success; } nxagentInitPointerMap(); nxagentEnablePointerEvents(); break; case DEVICE_OFF: #ifdef TEST fprintf(stderr, "%s: Called for [DEVICE_OFF].\n", __func__); #endif if (NXDisplayError(nxagentDisplay) == 1) { return Success; } nxagentDisablePointerEvents(); break; case DEVICE_CLOSE: #ifdef TEST fprintf(stderr, "%s: Called for [DEVICE_CLOSE].\n", __func__); #endif break; } return Success; } void nxagentInitPointerMap(void) { unsigned char pointerMap[MAXBUTTONS]; #ifdef DEBUG fprintf(stderr, "%s: Going to retrieve the " "pointer map from remote display.\n", __func__); #endif int numButtons = XGetPointerMapping(nxagentDisplay, pointerMap, MAXBUTTONS); /* * Computing reverse pointer map. */ for (int i = 1; i <= numButtons; i++) { nxagentReversePointerMap[pointerMap[i - 1]] = i; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Pointer.h0000644000000000000000000000552113614532331020451 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #ifndef __Pointer_H__ #define __Pointer_H__ #define MAXBUTTONS 256 #define NXAGENT_POINTER_EVENT_MASK \ (ButtonPressMask | ButtonReleaseMask | PointerMotionMask | \ EnterWindowMask | LeaveWindowMask) /* * The nxagentReversePointerMap array is used to * memorize remote display pointer map. */ extern unsigned char nxagentReversePointerMap[MAXBUTTONS]; void nxagentChangePointerControl(DeviceIntPtr pDev, PtrCtrl *ctrl); int nxagentPointerProc(DeviceIntPtr pDev, int onoff); void nxagentInitPointerMap(void); #endif /* __Pointer_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c0000644000000000000000000005257513614532331020757 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include "X.h" #include "Xproto.h" #include "Xpoll.h" #include "mi.h" #include "fb.h" #include "inputstr.h" #include "Agent.h" #include "Atoms.h" #include "Drawable.h" #include "Client.h" #include "Reconnect.h" #include "Display.h" #include "Dialog.h" #include "Screen.h" #include "Windows.h" #include "Events.h" #include "Dialog.h" #include "Args.h" #include "Font.h" #include "GCs.h" #include "Trap.h" #include "Keyboard.h" #include "Composite.h" #include "Millis.h" #include "Splash.h" #include "Error.h" #include "Keystroke.h" #include "Utils.h" #ifdef XKB #include "XKBsrv.h" #endif #include #include "compext/Compext.h" #include /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG #define NXAGENT_RECONNECT_DEFAULT_MESSAGE_SIZE 32 extern Bool nxagentReconnectAllCursor(void*); extern Bool nxagentReconnectAllColormap(void*); extern Bool nxagentReconnectAllWindows(void*); extern Bool nxagentReconnectAllGlyphSet(void*); extern Bool nxagentReconnectAllPictFormat(void*); extern Bool nxagentReconnectAllPicture(void*); extern Bool nxagentDisconnectAllPicture(void); extern Bool nxagentDisconnectAllWindows(void); extern void nxagentDisconnectAllCursor(void); extern Bool nxagentReconnectFailedFonts(void*); extern Bool nxagentInstallFontServerPath(void); extern Bool nxagentUninstallFontServerPath(void); extern void nxagentRemoveXConnection(void); extern void nxagentInitPointerMap(void); static char *nxagentGetReconnectError(void); void nxagentInitializeRecLossyLevel(void); static char *nxagentReconnectErrorMessage = NULL; static int nxagentReconnectErrorId; extern Bool nxagentRenderEnable; extern char *nxagentKeyboard; extern char *nxagentOptionsFilenameOrString; enum SESSION_STATE nxagentSessionState = SESSION_STARTING; struct nxagentExceptionStruct nxagentException = {0, 0}; enum RECONNECTION_STEP { DISPLAY_STEP = 0, SCREEN_STEP, FONT_STEP, PIXMAP_STEP, GC_STEP, CURSOR_STEP, COLORMAP_STEP, WINDOW_STEP, GLYPHSET_STEP, PICTFORMAT_STEP, PICTURE_STEP, STEP_NONE }; void *reconnectLossyLevel[STEP_NONE]; static enum RECONNECTION_STEP failedStep; #include /* * Path of state File */ char stateFile[PATH_MAX] = {0}; void setStatePath(char* path) { snprintf(stateFile, PATH_MAX, "%s", path); } void saveAgentState(char* state) { FILE* fptr; if(strlen(stateFile)) { fptr=fopen(stateFile, "w"); if(!fptr) return; fprintf(fptr,"%s", state); fclose(fptr); } } int nxagentHandleConnectionStates(void) { #ifdef TEST fprintf(stderr, "nxagentHandleConnectionStates: Handling Exception with " "state [%s] and transport [%d] and generation [%ld].\n", DECODE_SESSION_STATE(nxagentSessionState), NXTransRunning(NX_FD_ANY), serverGeneration); fprintf(stderr, "nxagentHandleConnectionStates: Entering with nxagentException.sigHup = [%d], " "nxagentException.ioError = [%d]\n", nxagentException.sigHup, nxagentException.ioError); #endif if (nxagentException.sigHup > 0) { #ifdef TEST fprintf(stderr, "nxagentHandleConnectionStates: Got SIGHUP in the exception flags.\n"); #endif nxagentException.sigHup = 0; if (nxagentSessionState == SESSION_UP) { if (nxagentOption(Persistent)) { nxagentSessionState = SESSION_GOING_DOWN; #ifdef TEST fprintf(stderr, "nxagentHandleConnectionStates: Handling " "signal [SIGHUP] by disconnecting the agent.\n"); #endif } else { nxagentTerminateSession(); } } else if (nxagentSessionState == SESSION_STARTING) { nxagentTerminateSession(); #ifdef WARNING fprintf(stderr, "nxagentHandleConnectionStates: Handling signal [SIGHUP] by terminating the agent.\n"); #endif } else if (nxagentSessionState == SESSION_DOWN && NXTransRunning(NX_FD_ANY) == 0) { nxagentSessionState = SESSION_GOING_UP; #ifdef TEST fprintf(stderr, "nxagentHandleConnectionStates: Handling signal [SIGHUP] by reconnecting the agent.\n"); #endif } else { #ifdef TEST fprintf(stderr, "nxagentHandleConnectionStates: Handling signal with state [%s] and exception [%d].\n", DECODE_SESSION_STATE(nxagentSessionState), dispatchException); #endif } } if (nxagentNeedConnectionChange() == 1) { #ifdef TEST fprintf(stderr, "nxagentHandleConnectionStates: Calling nxagentHandleConnectionChanges " "with ioError [%d] sigHup [%d].\n", nxagentException.ioError, nxagentException.sigHup); #endif nxagentHandleConnectionChanges(); } if (nxagentException.ioError > 0) { #ifdef TEST fprintf(stderr, "nxagentHandleConnectionStates: Got I/O error in the exception flags.\n"); #endif /* TODO: This should be reset only when the state became SESSION_DOWN. */ nxagentException.ioError = 0; if (nxagentOption(Persistent) == 1 && nxagentSessionState != SESSION_STARTING) { if (nxagentSessionState == SESSION_UP) { if ((dispatchException & DE_TERMINATE) == 0) { fprintf(stderr, "Session: Display failure detected at '%s'.\n", GetTimeAsString()); fprintf(stderr, "Session: Suspending session at '%s'.\n", GetTimeAsString()); saveAgentState("SUSPENDING"); } nxagentDisconnectSession(); } else if (nxagentSessionState == SESSION_GOING_DOWN) { #ifdef TEST fprintf(stderr, "nxagentHandleConnectionStates: Got I/O error with session " "[SESSION_GOING_DOWN].\n"); #endif } else if (nxagentSessionState == SESSION_GOING_UP) { #ifdef TEST fprintf(stderr, "nxagentHandleConnectionStates: Got I/O error with session " "[SESSION_GOING_UP].\n"); #endif nxagentSessionState = SESSION_GOING_DOWN; nxagentSetReconnectError(FAILED_RESUME_DISPLAY_BROKEN_ALERT, "Got I/O error during reconnect."); nxagentChangeOption(Fullscreen, False); return 1; } else if (nxagentSessionState == SESSION_DOWN) { #ifdef TEST fprintf(stderr, "nxagentHandleConnectionStates: Got I/O error with session " "[SESSION_DOWN]. Ignoring.\n"); #endif return 1; } else { #ifdef TEST fprintf(stderr, "nxagentHandleConnectionStates: Got I/O error with session " "[%d].\n", nxagentSessionState); #endif } nxagentSessionState = SESSION_DOWN; if ((dispatchException & DE_TERMINATE) == 0) { #ifdef NX_DEBUG_INPUT fprintf(stderr, "Session: Session suspended at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis()); #else fprintf(stderr, "Session: Session suspended at '%s'.\n", GetTimeAsString()); #endif } saveAgentState("SUSPENDED"); nxagentResetDisplayHandlers(); return 1; } fprintf(stderr, "Info: Disconnected from display '%s'.\n", nxagentDisplayName); nxagentTerminateSession(); return -1; } return 0; } void nxagentInitializeRecLossyLevel(void) { *(int *)reconnectLossyLevel[DISPLAY_STEP] = 0; *(int *)reconnectLossyLevel[SCREEN_STEP] = 0; *(int *)reconnectLossyLevel[FONT_STEP] = 0; *(int *)reconnectLossyLevel[PIXMAP_STEP] = 0; *(int *)reconnectLossyLevel[GC_STEP] = 0; *(int *)reconnectLossyLevel[CURSOR_STEP] = 0; *(int *)reconnectLossyLevel[COLORMAP_STEP] = 0; *(int *)reconnectLossyLevel[WINDOW_STEP] = 0; *(int *)reconnectLossyLevel[GLYPHSET_STEP] = 0; *(int *)reconnectLossyLevel[PICTFORMAT_STEP] = 0; *(int *)reconnectLossyLevel[PICTURE_STEP] = 0; } void nxagentInitReconnector(void) { nxagentReconnectTrap = 0; reconnectLossyLevel[DISPLAY_STEP] = malloc(sizeof(int)); reconnectLossyLevel[SCREEN_STEP] = malloc(sizeof(int)); reconnectLossyLevel[FONT_STEP] = malloc(sizeof(int)); reconnectLossyLevel[PIXMAP_STEP] = malloc(sizeof(int)); reconnectLossyLevel[GC_STEP] = malloc(sizeof(int)); reconnectLossyLevel[CURSOR_STEP] = malloc(sizeof(int)); reconnectLossyLevel[COLORMAP_STEP] = malloc(sizeof(int)); reconnectLossyLevel[WINDOW_STEP] = malloc(sizeof(int)); reconnectLossyLevel[GLYPHSET_STEP] = malloc(sizeof(int)); reconnectLossyLevel[PICTFORMAT_STEP] = malloc(sizeof(int)); reconnectLossyLevel[PICTURE_STEP] = malloc(sizeof(int)); } void nxagentDisconnectSession(void) { #ifdef TEST fprintf(stderr, "nxagentDisconnectSession: Disconnecting session with state [%s].\n", DECODE_SESSION_STATE(nxagentSessionState)); #endif /* * Force an I/O error on the display * and wait until the NX transport * is gone. */ #ifdef TEST fprintf(stderr, "nxagentDisconnectSession: Disconnecting the X display.\n"); #endif nxagentWaitDisplay(); /* * Prepare for the next reconnection. */ #ifdef TEST fprintf(stderr, "nxagentDisconnectSession: Disconnecting all X resources.\n"); #endif nxagentInitializeRecLossyLevel(); nxagentBackupDisplayInfo(); if (nxagentOption(Rootless)) { nxagentFreePropertyList(); } if (nxagentRenderEnable) { nxagentDisconnectAllPicture(); } nxagentEmptyAllBackingStoreRegions(); nxagentDisconnectAllWindows(); nxagentDisconnectAllCursor(); nxagentDisconnectAllPixmaps(); nxagentDisconnectAllGCs(); nxagentDisconnectDisplay(); nxagentWMIsRunning = False; #ifdef TEST fprintf(stderr, "nxagentDisconnectSession: Disconnection completed. SigHup is [%d]. IoError is [%d].\n", nxagentException.sigHup, nxagentException.ioError); #endif } Bool nxagentReconnectSession(void) { char *nxagentOldKeyboard = NULL; nxagentResizeDesktopAtStartup = False; /* * Propagate device settings if explicitly asked for. */ nxagentChangeOption(DeviceControl, nxagentOption(DeviceControlUserDefined)); /* * We need to zero out every new XID * created by the disconnected display. */ nxagentDisconnectSession(); /* * Set this in order to let the screen * function to behave differently at * reconnection time. */ nxagentReconnectTrap = True; nxagentSetReconnectError(0, NULL); if (nxagentKeyboard != NULL) { nxagentOldKeyboard = strndup(nxagentKeyboard, strlen(nxagentKeyboard)); if (nxagentOldKeyboard == NULL) { /* 0 means reconnection failed */ return 0; } SAFE_free(nxagentKeyboard); } nxagentSaveOptions(); nxagentResetOptions(); nxagentProcessOptions(nxagentOptionsFilenameOrString); if (nxagentReconnectDisplay(reconnectLossyLevel[DISPLAY_STEP]) == 0) { failedStep = DISPLAY_STEP; #ifdef TEST fprintf(stderr, "nxagentReconnectSession: WARNING! Failed display reconnection.\n"); #endif goto nxagentReconnectError; } if (nxagentReconnectScreen(reconnectLossyLevel[SCREEN_STEP]) == 0) { failedStep = SCREEN_STEP; goto nxagentReconnectError; } nxagentDisconnectAllFonts(); nxagentListRemoteFonts("*", nxagentMaxFontNames); if (nxagentReconnectAllFonts(reconnectLossyLevel[FONT_STEP]) == 0) { if (nxagentReconnectFailedFonts(reconnectLossyLevel[FONT_STEP]) == 0) { failedStep = FONT_STEP; goto nxagentReconnectError; } else { #ifdef WARNING fprintf(stderr, "nxagentReconnectSession: WARNING! Unable to retrieve all the fonts currently in use. " "Missing fonts have been replaced.\n"); #endif nxagentLaunchDialog(DIALOG_FONT_REPLACEMENT); } } /* * Map the main window and send a * SetSelectionOwner request to * notify of the agent start. */ nxagentMapDefaultWindows(); /* * Ensure that the SetSelectionOwner * request is sent through the link. */ XFlush(nxagentDisplay); NXTransContinue(NULL); nxagentEmptyBSPixmapList(); /* FIXME: nxagentReconnectAllPixmaps will always return 1 */ if (nxagentReconnectAllPixmaps(reconnectLossyLevel[PIXMAP_STEP]) == 0) { failedStep = PIXMAP_STEP; goto nxagentReconnectError; } if (nxagentReconnectAllGCs(reconnectLossyLevel[GC_STEP]) == 0) { failedStep = GC_STEP; goto nxagentReconnectError; } if (nxagentReconnectAllColormap(reconnectLossyLevel[COLORMAP_STEP]) == 0) { failedStep = COLORMAP_STEP; goto nxagentReconnectError; } if (nxagentReconnectAllWindows(reconnectLossyLevel[WINDOW_STEP]) == 0) { failedStep = WINDOW_STEP; goto nxagentReconnectError; } if (nxagentRenderEnable) { if (nxagentReconnectAllGlyphSet(reconnectLossyLevel[GLYPHSET_STEP]) == 0) { failedStep = GLYPHSET_STEP; goto nxagentReconnectError; } if (nxagentReconnectAllPictFormat(reconnectLossyLevel[PICTFORMAT_STEP]) == 0) { failedStep = PICTFORMAT_STEP; goto nxagentReconnectError; } if (nxagentReconnectAllPicture(reconnectLossyLevel[PICTURE_STEP]) == 0) { failedStep = PICTURE_STEP; goto nxagentReconnectError; } } if (nxagentReconnectAllCursor(reconnectLossyLevel[CURSOR_STEP]) == 0) { failedStep = CURSOR_STEP; goto nxagentReconnectError; } if (nxagentSetWindowCursors(reconnectLossyLevel[WINDOW_STEP]) == 0) { failedStep = WINDOW_STEP; goto nxagentReconnectError; } /* Update remote XKB information */ nxagentGetRemoteXkbExtension(); /* if there's no keyboard definition in the options file restore the previous value. */ #ifdef DEBUG fprintf(stderr, "%s: nxagentKeyboard [%s] nxagentOldKeyboard [%s]\n", __func__, nxagentKeyboard, nxagentOldKeyboard); #endif if (nxagentKeyboard == NULL) { nxagentKeyboard = nxagentOldKeyboard; nxagentOldKeyboard = NULL; } /* Reset the keyboard only if we detect any changes. */ if (nxagentOption(ResetKeyboardAtResume) == 1) { if (nxagentKeyboard == NULL || nxagentOldKeyboard == NULL || strcmp(nxagentKeyboard, nxagentOldKeyboard) != 0 || strcmp(nxagentKeyboard, "query") == 0 || strcmp(nxagentKeyboard, "clone") == 0) { if (nxagentResetKeyboard() == 0) { #ifdef WARNING if (nxagentVerbose == 1) { fprintf(stderr, "%s: Failed to reset keyboard device.\n", __func__); } #endif failedStep = WINDOW_STEP; goto nxagentReconnectError; } } else { #ifdef DEBUG fprintf(stderr, "%s: keyboard unchanged - skipping keyboard reset.\n", __func__); #endif } } nxagentXkbState.Initialized = 0; SAFE_free(nxagentOldKeyboard); nxagentInitPointerMap(); nxagentDeactivatePointerGrab(); nxagentWakeupByReconnect(); nxagentFreeGCList(); nxagentRedirectDefaultWindows(); if (nxagentResizeDesktopAtStartup || nxagentOption(Rootless) == True || nxagentOption(Xinerama) == True) { nxagentChangeScreenConfig(0, nxagentOption(RootWidth), nxagentOption(RootHeight)); nxagentResizeDesktopAtStartup = False; } nxagentReconnectTrap = False; nxagentExposeArrayIsInitialized = False; if (nxagentSessionState != SESSION_GOING_UP) { #ifdef WARNING fprintf(stderr, "nxagentReconnectSession: WARNING! Unexpected session state [%s] while reconnecting.\n", DECODE_SESSION_STATE(nxagentSessionState)); #endif goto nxagentReconnectError; } /* Re-read keystrokes definitions in case the keystrokes file has changed while being suspended */ nxagentInitKeystrokes(True); #ifdef NX_DEBUG_INPUT fprintf(stderr, "Session: Session resumed at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis()); #else fprintf(stderr, "Session: Session resumed at '%s'.\n", GetTimeAsString()); #endif saveAgentState("RUNNING"); nxagentRemoveSplashWindow(); /* * We let the proxy flush the link on our behalf * after having opened the display. We are now * entering again the dispatcher so can flush * the link explicitly. */ #ifdef TEST fprintf(stderr, "nxagentReconnectSession: Setting the NX flush policy to deferred.\n"); #endif NXSetDisplayPolicy(nxagentDisplay, NXPolicyDeferred); nxagentCleanupBackupDisplayInfo(); return 1; nxagentReconnectError: if (failedStep == DISPLAY_STEP) { #ifdef TEST fprintf(stderr, "nxagentReconnectSession: Reconnection failed in display step. Restoring options.\n"); #endif nxagentRestoreOptions(); } else { nxagentCleanupBackupDisplayInfo(); } if (*nxagentGetReconnectError() == '\0') { #ifdef WARNING if (nxagentVerbose == 1) { fprintf(stderr, "nxagentReconnectSession: WARNING! The reconnect error message is not set. Failed step is [%d].\n", failedStep); } #endif #ifdef TEST fprintf(stderr, "nxagentReconnectSession: Reconnection failed due to a display error.\n"); #endif } else { #ifdef TEST fprintf(stderr, "nxagentReconnectSession: Reconnection failed with reason '%s'\n", nxagentGetReconnectError()); #endif } if (NXDisplayError(nxagentDisplay) == 0) { nxagentUnmapWindows(); nxagentFailedReconnectionDialog(nxagentReconnectErrorId, nxagentGetReconnectError()); } #ifdef TEST else { fprintf(stderr, "nxagentReconnectSession: Cannot launch the dialog without a valid display.\n"); } #endif if (failedStep == FONT_STEP) { *((int *) reconnectLossyLevel[FONT_STEP]) = 1; } if (nxagentDisplay == NULL) { nxagentDisconnectDisplay(); } SAFE_free(nxagentOldKeyboard); return 0; } void nxagentSetReconnectError(int id, char *format, ...) { static int size = 0; va_list ap; int n; if (format == NULL) { nxagentSetReconnectError(id, ""); return; } nxagentReconnectErrorId = id; while (1) { va_start (ap, format); n = vsnprintf(nxagentReconnectErrorMessage, size, format, ap); va_end(ap); if (n > -1 && n < size) { break; } if (n > -1) { size = n + 1; } else { /* * The vsnprintf() in glibc 2.0.6 would return * -1 when the output was truncated. See section * NOTES on printf(3). */ size = (size ? size * 2 : NXAGENT_RECONNECT_DEFAULT_MESSAGE_SIZE); } nxagentReconnectErrorMessage = realloc(nxagentReconnectErrorMessage, size); if (nxagentReconnectErrorMessage == NULL) { FatalError("realloc failed"); } } return; } static char* nxagentGetReconnectError() { if (nxagentReconnectErrorMessage == NULL) { nxagentSetReconnectError(nxagentReconnectErrorId, ""); } return nxagentReconnectErrorMessage; } void nxagentHandleConnectionChanges(void) { #ifdef TEST fprintf(stderr, "nxagentHandleConnectionChanges: Called.\n"); #endif if (nxagentSessionState == SESSION_GOING_DOWN) { fprintf(stderr, "Session: Suspending session at '%s'.\n", GetTimeAsString()); saveAgentState("SUSPENDING"); nxagentDisconnectSession(); } else if (nxagentSessionState == SESSION_GOING_UP) { fprintf(stderr, "Session: Resuming session at '%s'.\n", GetTimeAsString()); saveAgentState("RESUMING"); if (nxagentReconnectSession()) { nxagentSessionState = SESSION_UP; } else { nxagentSessionState = SESSION_GOING_DOWN; fprintf(stderr, "Session: Display failure detected at '%s'.\n", GetTimeAsString()); fprintf(stderr, "Session: Suspending session at '%s'.\n", GetTimeAsString()); saveAgentState("SUSPENDING"); nxagentDisconnectSession(); } } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Reconnect.h0000644000000000000000000000614113614532331020750 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Reconnect_H__ #define __Reconnect_H__ extern Display *nxagentDisplayState; struct nxagentExceptionStruct { int sigHup; int ioError; }; extern struct nxagentExceptionStruct nxagentException; void nxagentSetReconnectError(int id, char *format, ...); void nxagentInitReconnector(void); Bool nxagentReconnectSession(void); int nxagentHandleConnectionStates(void); void nxagentHandleConnectionChanges(void); void setStatePath(char*); void saveAgentState(char*); enum SESSION_STATE { SESSION_STARTING, SESSION_UP, SESSION_DOWN, SESSION_GOING_DOWN, SESSION_GOING_UP }; extern enum SESSION_STATE nxagentSessionState; #define DECODE_SESSION_STATE(state) \ ((state) == SESSION_STARTING ? "SESSION_STARTING" : \ (state) == SESSION_UP ? "SESSION_UP" : \ (state) == SESSION_GOING_UP? "SESSION_GOING_UP" : \ (state) == SESSION_DOWN ? "SESSION_DOWN" : \ (state) == SESSION_GOING_DOWN? "SESSION_GOING_DOWN" : \ "UNKNOWN") /* * Use this macro in the block and wakeup * handlers to save a function call. */ #define nxagentNeedConnectionChange() \ (nxagentSessionState == SESSION_GOING_DOWN || \ nxagentSessionState == SESSION_GOING_UP) void nxagentDisconnectSession(void); #endif /* __Reconnect_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Render.c0000644000000000000000000023511313614532331020245 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "picturestr.h" #include "glyphstr.h" #include "Render.h" #include "X.h" #include "Xproto.h" #include "render.h" #include "renderproto.h" #include "mi.h" #include "fb.h" #include "mipict.h" #include "fbpict.h" #include "dixstruct.h" #include "protocol-versions.h" #include "Agent.h" #include "Drawable.h" #include "Trap.h" #include "Args.h" #include "Utils.h" #define Atom XlibAtom #define Pixmap XlibPixmap #include "X11/include/Xrenderint_nxagent.h" #undef Atom #undef Pixmap #include "region.h" #include #include "Display.h" #include "Pixmaps.h" #include "Cursor.h" #include "Client.h" #include "Image.h" #include "Pixels.h" #include "Handlers.h" #include #define MAX_FORMATS 255 #define NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL /* * Define if you want split multiple glyph lists * into multiple RenderCompositeGlyphs requests. */ #undef SPLIT_GLYPH_LISTS /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG /* FIXME: Most operations don't seem to produce any visible result but still generate tons of traffic. */ #undef SKIP_LOUSY_RENDER_OPERATIONS #undef SKIP_REALLY_ALL_LOUSY_RENDER_OPERATIONS /* * Margin added around the glyphs extent (in pixels). */ #define GLYPH_BOX_MARGIN 2 int nxagentRenderEnable = UNDEFINED; int nxagentRenderVersionMajor; int nxagentRenderVersionMinor; int nxagentPicturePrivateIndex = 0; static int nxagentNumFormats = 0; static XRenderPictFormat nxagentArrayFormats[MAX_FORMATS]; XRenderPictFormat *nxagentMatchingFormats(PictFormatPtr pForm); BoxPtr nxagentGlyphsExtents; BoxPtr nxagentTrapezoidExtents; static void nxagentPrintFormat(XRenderPictFormat *pFormat); /* * From NXglyph.c. */ extern const CARD8 glyphDepths[]; /* * From BitmapUtils.c. */ extern void nxagentBitOrderInvert(unsigned char *data, int nbytes); /* * Other functions defined here. */ void nxagentQueryFormats(void); void nxagentCreateGlyphSet(GlyphSetPtr pGly); int nxagentCursorSaveRenderInfo(ScreenPtr pScreen, CursorPtr pCursor); void nxagentCursorPostSaveRenderInfo(CursorPtr pCursor, ScreenPtr pScreen, PicturePtr pPicture, int x, int y); int nxagentCreatePicture(PicturePtr pPicture, Mask mask); int nxagentChangePictureClip(PicturePtr pPicture, int clipType, int nRects, xRectangle *rects, int xOrigin, int yOrigin); void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlists, XGlyphElt8 *elts, int sizeID, GlyphPtr *glyphsBase); void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects); void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps); void nxagentChangePicture(PicturePtr pPicture, Mask mask); void nxagentReferenceGlyphSet(GlyphSetPtr glyphSet); void nxagentFreeGlyphs(GlyphSetPtr glyphSet, CARD32 *gids, int nglyph); void nxagentFreeGlyphSet(GlyphSetPtr glyphSet); void nxagentSetPictureTransform(PicturePtr pPicture, void * transform); void nxagentSetPictureFilter(PicturePtr pPicture, char *filter, int name_size, void * params, int nparams); Bool nxagentReconnectAllGlyphSet(void *p); Bool nxagentReconnectAllPicture(void *); Bool nxagentDisconnectAllPicture(void); #ifdef NXAGENT_RENDER_CLEANUP #include #define ROUNDUP(nbits, pad) ((((nbits) + ((pad)-1)) / (pad)) * ((pad)>>3)) void nxagentCleanGlyphs(xGlyphInfo *gi, int nglyphs, CARD8 *images, int depth, Display *dpy) { int widthInBits; int bytesPerLine; int bytesToClean; int bitsToClean; int widthInBytes; int height = gi -> height; #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: Found a Glyph with Depth %d, width %d, pad %d.\n", depth, gi -> width, BitmapPad(dpy)); #endif while (nglyphs > 0) { if (depth == 24) { widthInBits = gi -> width * 32; bytesPerLine = ROUNDUP(widthInBits, BitmapPad(dpy)); bytesToClean = bytesPerLine * height; #ifdef DUBUG fprintf(stderr, "nxagentCleanGlyphs: Found glyph with depth 24, bytes to clean is %d" "width in bits is %d bytes per line [%d] height [%d].\n", bytesToClean, widthInBits, bytesPerLine, height); #endif if (ImageByteOrder(dpy) == LSBFirst) { for (int i = 3; i < bytesToClean; i += 4) { images[i] = 0x00; } } else { for (int i = 0; i < bytesToClean; i += 4) { images[i] = 0x00; } } #ifdef DUMP fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean); for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); } fprintf(stderr,"\n"); #endif images += bytesToClean; gi++; nglyphs--; } else if (depth == 1) { widthInBits = gi -> width; bytesPerLine = ROUNDUP(widthInBits, BitmapPad(dpy)); bitsToClean = (bytesPerLine << 3) - (gi -> width); #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: Found glyph with depth 1, width [%d], height [%d], bitsToClean [%d]," " bytesPerLine [%d].\n", gi -> width, height, bitsToClean, bytesPerLine); #endif bytesToClean = bitsToClean >> 3; bitsToClean &= 7; #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: bitsToClean &=7 is %d, bytesToCLean is %d." " byte_order is %d, bitmap_bit_order is %d.\n", bitsToClean, bytesToClean, ImageByteOrder(dpy), BitmapBitOrder(dpy)); #endif for (int i = 1; i <= height; i++) { int j; if (ImageByteOrder(dpy) == BitmapBitOrder(dpy)) { for (j = 1; j <= bytesToClean; j++) { images[i * bytesPerLine - j] = 0x00; #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: byte_order == bitmap_bit_order, cleaning %d, i=%d, j=%d.\n" , (i * bytesPerLine - j), i, j); #endif } } else { for (j = bytesToClean; j >= 1; j--) { images[i * bytesPerLine - j] = 0x00; #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: byte_order %d, bitmap_bit_order %d, cleaning %d, i=%d, j=%d.\n" , ImageByteOrder(dpy), BitmapBitOrder(dpy), (i * bytesPerLine - j), i, j); #endif } } if (BitmapBitOrder(dpy) == MSBFirst) { images[i * bytesPerLine - j] &= 0xff << bitsToClean; #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: byte_order MSBFirst, cleaning %d, i=%d, j=%d.\n" , (i * bytesPerLine - j), i, j); #endif } else { images[i * bytesPerLine - j] &= 0xff >> bitsToClean; #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: byte_order LSBFirst, cleaning %d, i=%d, j=%d.\n" , (i * bytesPerLine - j), i, j); #endif } } #ifdef DUMP fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean); for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); } fprintf(stderr,"\n"); #endif images += bytesPerLine * height; gi++; nglyphs--; } else if ((depth == 8) || (depth == 16) ) { widthInBits = gi -> width * depth; bytesPerLine = ROUNDUP(widthInBits, BitmapPad(dpy)); widthInBytes = (widthInBits >> 3); bytesToClean = bytesPerLine - widthInBytes; #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: nglyphs is %d, width of glyph in bits is %d, in bytes is %d.\n", nglyphs, widthInBits, widthInBytes); fprintf(stderr, "nxagentCleanGlyphs: bytesPerLine is %d bytes, there are %d scanlines.\n", bytesPerLine, height); fprintf(stderr, "nxagentCleanGlyphs: Bytes to clean for each scanline are %d.\n", bytesToClean); #endif if (bytesToClean > 0) { while (height > 0) { int count = bytesToClean; while (count > 0) { *(images + (bytesPerLine - count)) = 0; #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: cleaned a byte.\n"); #endif count--; } #ifdef DUMP fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean); for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); } fprintf(stderr,"\n"); #endif images += bytesPerLine; height--; } } gi++; nglyphs--; #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: Breaking Out.\n"); #endif } else if (depth == 32) { #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: Found glyph with depth 32.\n"); #endif gi++; nglyphs--; } else { #ifdef WARNING fprintf(stderr, "nxagentCleanGlyphs: Unrecognized glyph, depth is not 8/16/24/32, it appears to be %d.\n", depth); #endif gi++; nglyphs--; } } } #endif /* #ifdef NXAGENT_RENDER_CLEANUP */ void nxagentRenderExtensionInit(void) { int first_event, first_error; int major_version, minor_version; if (XRenderQueryExtension(nxagentDisplay, &first_event, &first_error)) { XRenderQueryVersion(nxagentDisplay, &major_version, &minor_version); /* * As the RENDER requests are passed directly to the remote X * server this can cause problems if our RENDER version is * different from the version supported by the remote. For this * reasons let's advertise to our clients the lowest between the * two versions. */ if (major_version > SERVER_RENDER_MAJOR_VERSION || (major_version == SERVER_RENDER_MAJOR_VERSION && minor_version > SERVER_RENDER_MINOR_VERSION)) { #ifdef TEST fprintf(stderr, "nxagentRenderExtensionInit: Using render version [%d.%d] with " "remote version [%d.%d].\n", SERVER_RENDER_MAJOR_VERSION, SERVER_RENDER_MINOR_VERSION, major_version, minor_version); #endif nxagentRenderVersionMajor = SERVER_RENDER_MAJOR_VERSION; nxagentRenderVersionMinor = SERVER_RENDER_MINOR_VERSION; } else if (major_version < SERVER_RENDER_MAJOR_VERSION || (major_version == SERVER_RENDER_MAJOR_VERSION && minor_version < SERVER_RENDER_MINOR_VERSION)) { #ifdef TEST fprintf(stderr, "Info: Local render version %d.%d is higher " "than remote version %d.%d.\n", SERVER_RENDER_MAJOR_VERSION, SERVER_RENDER_MINOR_VERSION, major_version, minor_version); fprintf(stderr, "Info: Lowering the render version reported to clients.\n"); #endif nxagentRenderVersionMajor = major_version; nxagentRenderVersionMinor = minor_version; } else { #ifdef TEST fprintf(stderr, "nxagentRenderExtensionInit: Local render version %d.%d " "matches remote version %d.%d.\n", SERVER_RENDER_MAJOR_VERSION, SERVER_RENDER_MINOR_VERSION, major_version, minor_version); #endif nxagentRenderVersionMajor = major_version; nxagentRenderVersionMinor = minor_version; } } else { #ifdef WARNING fprintf(stderr, "Warning: Render not available on the remote display.\n"); #endif nxagentRenderEnable = False; } } int nxagentCursorSaveRenderInfo(ScreenPtr pScreen, CursorPtr pCursor) { pCursor -> devPriv[pScreen -> myNum] = malloc(sizeof(nxagentPrivCursor)); if (nxagentCursorPriv(pCursor, pScreen) == NULL) { FatalError("malloc failed"); } nxagentCursorUsesRender(pCursor, pScreen) = 1; nxagentCursorPicture(pCursor, pScreen) = NULL; return 1; } void nxagentCursorPostSaveRenderInfo(CursorPtr pCursor, ScreenPtr pScreen, PicturePtr pPicture, int x, int y) { nxagentCursorPicture(pCursor, pScreen) = pPicture; nxagentCursorXOffset(pCursor, pScreen) = x; nxagentCursorYOffset(pCursor, pScreen) = y; } void nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) { PicturePtr pPicture = nxagentCursorPicture(pCursor, pScreen); pPicture -> refcnt++; int x = nxagentCursorXOffset(pCursor, pScreen); int y = nxagentCursorYOffset(pCursor, pScreen); #ifdef TEST fprintf(stderr, "%s: Forcing the synchronization of the cursor.\n", __func__); #endif nxagentMarkCorruptedRegion(pPicture -> pDrawable, NULL); /* * Set the lossless trap so that the image functions will not try to * encode the image using a lossy compression. Drawables should have * a quality flag, telling if they were originally encoded with a * lossy algorithm. This would allow us to skip the synchronization * if the cursor was already encoded with the best quality. */ nxagentLosslessTrap = 1; nxagentSynchronizeDrawable(pPicture -> pDrawable, DO_WAIT, NEVER_BREAK, NULL); nxagentLosslessTrap = 0; nxagentCursor(pCursor, pScreen) = XRenderCreateCursor(nxagentDisplay, nxagentPicture(pPicture), x, y); } int nxagentCreatePicture(PicturePtr pPicture, Mask mask) { XRenderPictureAttributes attributes; unsigned long valuemask=0; #ifdef DEBUG fprintf(stderr, "nxagentCreatePicture: Function called with picture at [%p] and mask [%ld].\n", (void *) pPicture, mask); #endif if (pPicture == NULL) { return 0; } #ifdef DEBUG if (pPicture -> pDrawable -> type == DRAWABLE_PIXMAP) { if (nxagentIsShmPixmap((PixmapPtr)pPicture -> pDrawable)) { fprintf (stderr, "nxagentCreatePicture: Picture uses a shared pixmap.\n"); } else { fprintf (stderr, "nxagentCreatePicture: Picture uses a plain pixmap.\n"); } } else { fprintf (stderr, "nxagentCreatePicture: Picture uses a window.\n"); } #endif /* * All the picture default values are 0. */ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, sizeof(XRenderPictureAttributes)); if (mask & CPRepeat) { attributes.repeat = (Bool)pPicture -> repeat; valuemask |= CPRepeat; nxagentSetPictureRemoteValue(pPicture, repeat, attributes.repeat); } if (mask & CPAlphaMap) { attributes.alpha_map = nxagentPicturePriv(pPicture -> alphaMap) -> picture; valuemask |= CPAlphaMap; nxagentSetPictureRemoteValue(pPicture, alpha_map, attributes.alpha_map); } if (mask & CPAlphaXOrigin) { attributes.alpha_x_origin = pPicture -> alphaOrigin.x; valuemask |= CPAlphaXOrigin; nxagentSetPictureRemoteValue(pPicture, alpha_x_origin, attributes.alpha_x_origin); } if (mask & CPAlphaYOrigin) { attributes.alpha_y_origin = pPicture -> alphaOrigin.y; valuemask |= CPAlphaYOrigin; nxagentSetPictureRemoteValue(pPicture, alpha_y_origin, attributes.alpha_y_origin); } if (mask & CPClipXOrigin) { attributes.clip_x_origin = pPicture -> clipOrigin.x; valuemask |= CPClipXOrigin; nxagentSetPictureRemoteValue(pPicture, clip_x_origin, attributes.clip_x_origin); } if (mask & CPClipYOrigin) { attributes.clip_y_origin = pPicture -> clipOrigin.y; valuemask |= CPClipYOrigin; nxagentSetPictureRemoteValue(pPicture, clip_y_origin, attributes.clip_y_origin); } if (mask & CPGraphicsExposure) { attributes.graphics_exposures = (Bool)pPicture -> graphicsExposures; valuemask |= CPGraphicsExposure; nxagentSetPictureRemoteValue(pPicture, graphics_exposures, attributes.graphics_exposures); } if (mask & CPSubwindowMode) { attributes.subwindow_mode = pPicture -> subWindowMode; valuemask |= CPSubwindowMode; nxagentSetPictureRemoteValue(pPicture, subwindow_mode, attributes.subwindow_mode); } if (mask & CPClipMask) { attributes.clip_mask = None; valuemask |= CPClipMask; nxagentSetPictureRemoteValue(pPicture, clip_mask, attributes.clip_mask); } if (mask & CPPolyEdge) { attributes.poly_edge = pPicture -> polyEdge; valuemask |= CPPolyEdge; nxagentSetPictureRemoteValue(pPicture, poly_edge, attributes.poly_edge); } if (mask & CPPolyMode) { attributes.poly_mode = pPicture -> polyMode; valuemask |= CPPolyMode; nxagentSetPictureRemoteValue(pPicture, poly_mode, attributes.poly_mode); } if (mask & CPDither) { attributes.dither = pPicture -> dither; valuemask |= CPDither; nxagentSetPictureRemoteValue(pPicture, dither, attributes.dither); } if (mask & CPComponentAlpha) { attributes.component_alpha = pPicture -> componentAlpha; valuemask |= CPComponentAlpha; nxagentSetPictureRemoteValue(pPicture, component_alpha, attributes.component_alpha); } XRenderPictFormat *pForm = NULL; if (pPicture -> pFormat != NULL) { pForm = nxagentMatchingFormats(pPicture -> pFormat); nxagentPrintFormat(pForm); } if (pForm == NULL) { fprintf(stderr, "nxagentCreatePicture: WARNING! The requested format was not found.\n"); return 0; } Picture id = XRenderCreatePicture(nxagentDisplay, nxagentDrawable(pPicture -> pDrawable), pForm, valuemask, &attributes); #ifdef TEST fprintf(stderr, "nxagentCreatePicture: Created picture at [%p] with drawable at [%p].\n", (void *) pPicture, (void *) pPicture -> pDrawable); #endif #ifdef DEBUG XSync(nxagentDisplay, 0); #endif nxagentPicturePriv(pPicture) -> picture = id; if (nxagentAlphaEnabled == 1 && pPicture -> pDrawable->depth == 32 && pPicture -> pFormat -> direct.alpha != 0) { if (pPicture -> pDrawable -> type == DRAWABLE_PIXMAP) { nxagentPixmapPriv(nxagentRealPixmap((PixmapPtr) pPicture -> pDrawable)) -> pPicture = pPicture; } else if (pPicture -> pDrawable -> type == DRAWABLE_WINDOW) { nxagentWindowPriv((WindowPtr) pPicture -> pDrawable) -> pPicture = pPicture; } } return 1; } XRenderPictFormat *nxagentMatchingFormats(PictFormatPtr pFormat) { for (int i = 0; i < nxagentNumFormats; i++) { if (pFormat -> type == nxagentArrayFormats[i].type && pFormat -> depth == nxagentArrayFormats[i].depth && pFormat -> direct.red == nxagentArrayFormats[i].direct.red && pFormat -> direct.green == nxagentArrayFormats[i].direct.green && pFormat -> direct.blue == nxagentArrayFormats[i].direct.blue && pFormat -> direct.redMask == nxagentArrayFormats[i].direct.redMask && pFormat -> direct.greenMask == nxagentArrayFormats[i].direct.greenMask && pFormat -> direct.blueMask == nxagentArrayFormats[i].direct.blueMask && pFormat -> direct.alpha == nxagentArrayFormats[i].direct.alpha && pFormat -> direct.alphaMask == nxagentArrayFormats[i].direct.alphaMask) { return &nxagentArrayFormats[i]; } } #ifdef DEBUG fprintf(stderr, "nxagentMatchingFormats: The requested format was not found.\n"); #endif return NULL; } void nxagentDestroyPicture(PicturePtr pPicture) { if (pPicture == NULL || nxagentPicturePriv(pPicture) -> picture == 0) { return; } #ifdef TEST fprintf(stderr, "nxagentDestroyPicture: Going to destroy picture at [%p].\n", (void *) pPicture); #endif XRenderFreePicture(nxagentDisplay, nxagentPicturePriv(pPicture) -> picture); #ifdef DEBUG XSync(nxagentDisplay, 0); #endif } int nxagentChangePictureClip(PicturePtr pPicture, int clipType, int nRects, xRectangle *rects, int xOrigin, int yOrigin) { #ifdef TEST fprintf(stderr, "nxagentChangePictureClip: Going to change clip of picture at [%p].\n", (void *) pPicture); #endif #ifdef DEBUG fprintf(stderr, "nxagentChangePictureClip: clipType [%d] nRects [%d] xRectangle [%p] " "xOrigin [%d] yOrigin [%d].\n", clipType, nRects, (void *) rects, xOrigin, yOrigin); #endif if (pPicture == NULL) { return 0; } switch (clipType) { case CT_PIXMAP: { #ifdef DEBUG fprintf(stderr, "nxagentChangePictureClip: Clip type is [CT_PIXMAP].\n"); #endif /* * if(!nRects) * { * return 0; * } */ /* FIXME: Is this useful or just a waste of bandwidth? Apparently useless with QT. */ #ifndef SKIP_LOUSY_RENDER_OPERATIONS XRenderSetPictureClipRectangles(nxagentDisplay, nxagentPicturePriv(pPicture) -> picture, xOrigin, yOrigin, (XRectangle*)rects, nRects); nxagentSetPictureRemoteValue(pPicture, clip_x_origin, xOrigin); nxagentSetPictureRemoteValue(pPicture, clip_y_origin, yOrigin); nxagentSetPictureRemoteValue(pPicture, clip_mask, 1); #endif #ifdef DEBUG XSync(nxagentDisplay, 0); #endif break; } case CT_NONE: { #ifdef DEBUG fprintf(stderr, "nxagentChangePictureClip: Clip type is [CT_NONE].\n"); #endif /* FIXME: Is this useful or just a waste of bandwidth? Apparently useless with QT. */ #ifndef SKIP_LOUSY_RENDER_OPERATIONS XRenderSetPictureClipRectangles(nxagentDisplay, nxagentPicturePriv(pPicture) -> picture, xOrigin, yOrigin, (XRectangle*)rects, nRects); nxagentSetPictureRemoteValue(pPicture, clip_x_origin, xOrigin); nxagentSetPictureRemoteValue(pPicture, clip_y_origin, yOrigin); nxagentSetPictureRemoteValue(pPicture, clip_mask, 1); #endif #ifdef DEBUG XSync(nxagentDisplay, 0); #endif break; } case CT_REGION: { Region reg; XRectangle rectangle; int index; #ifdef DEBUG fprintf(stderr, "nxagentChangePictureClip: Clip type is [CT_REGION].\n"); #endif reg = XCreateRegion(); for (index = 0; index <= nRects; index++, rects++) { rectangle.x = rects -> x; rectangle.y = rects -> y; rectangle.width = rects -> width; rectangle.height = rects -> height; XUnionRectWithRegion(&rectangle, reg, reg); } /* FIXME: Is this useful or just a waste of bandwidth? Apparently useless with QT. */ #ifndef SKIP_LOUSY_RENDER_OPERATIONS XRenderSetPictureClipRegion(nxagentDisplay, nxagentPicturePriv(pPicture) -> picture, reg); nxagentSetPictureRemoteValue(pPicture, clip_x_origin, xOrigin); nxagentSetPictureRemoteValue(pPicture, clip_y_origin, yOrigin); nxagentSetPictureRemoteValue(pPicture, clip_mask, 1); #endif #ifdef DEBUG XSync(nxagentDisplay, 0); #endif XDestroyRegion(reg); break; } default: { #ifdef DEBUG fprintf(stderr, "nxagentChangePictureClip: clipType not found\n"); #endif break; } } return 1; } void nxagentChangePicture(PicturePtr pPicture, Mask mask) { XRenderPictureAttributes attributes; unsigned long valuemask = 0; #ifdef DEBUG fprintf(stderr, "nxagentChangePicture: Going to change picture at [%p] with mask [%ld].\n", (void *) pPicture, mask); #endif if (pPicture == NULL) { return; } if (mask & CPRepeat) { attributes.repeat = (Bool)pPicture -> repeat; if (nxagentCheckPictureRemoteValue(pPicture, repeat, attributes.repeat) == 0) { valuemask |= CPRepeat; nxagentSetPictureRemoteValue(pPicture, repeat, attributes.repeat); } } if (mask & CPAlphaMap) { attributes.alpha_map = nxagentPicturePriv(pPicture -> alphaMap) -> picture; if (nxagentCheckPictureRemoteValue(pPicture, alpha_map, attributes.alpha_map) == 0) { valuemask |= CPAlphaMap; nxagentSetPictureRemoteValue(pPicture, alpha_map, attributes.alpha_map); } } if (mask & CPAlphaXOrigin) { attributes.alpha_x_origin = pPicture -> alphaOrigin.x; if (nxagentCheckPictureRemoteValue(pPicture, alpha_x_origin, attributes.alpha_x_origin) == 0) { valuemask |= CPAlphaXOrigin; nxagentSetPictureRemoteValue(pPicture, alpha_x_origin, attributes.alpha_x_origin); } } if (mask & CPAlphaYOrigin) { attributes.alpha_y_origin = pPicture -> alphaOrigin.y; if (nxagentCheckPictureRemoteValue(pPicture, alpha_y_origin, attributes.alpha_y_origin) == 0) { valuemask |= CPAlphaYOrigin; nxagentSetPictureRemoteValue(pPicture, alpha_y_origin, attributes.alpha_y_origin); } } if (mask & CPClipXOrigin) { attributes.clip_x_origin = pPicture -> clipOrigin.x; if (nxagentCheckPictureRemoteValue(pPicture, clip_x_origin, attributes.clip_x_origin) == 0) { valuemask |= CPClipXOrigin; nxagentSetPictureRemoteValue(pPicture, clip_x_origin, attributes.clip_x_origin); } } if (mask & CPClipYOrigin) { attributes.clip_y_origin = pPicture -> clipOrigin.y; if (nxagentCheckPictureRemoteValue(pPicture, clip_y_origin, attributes.clip_y_origin) == 0) { valuemask |= CPClipYOrigin; nxagentSetPictureRemoteValue(pPicture, clip_y_origin, attributes.clip_y_origin); } } if (mask & CPGraphicsExposure) { attributes.graphics_exposures = (Bool)pPicture -> graphicsExposures; if (nxagentCheckPictureRemoteValue(pPicture, graphics_exposures, attributes.graphics_exposures) == 0) { valuemask |= CPGraphicsExposure; nxagentSetPictureRemoteValue(pPicture, graphics_exposures, attributes.graphics_exposures); } } if (mask & CPSubwindowMode) { attributes.subwindow_mode = pPicture -> subWindowMode; if (nxagentCheckPictureRemoteValue(pPicture, subwindow_mode, attributes.subwindow_mode) == 0) { valuemask |= CPSubwindowMode; nxagentSetPictureRemoteValue(pPicture, subwindow_mode, attributes.subwindow_mode); } } if (mask & CPClipMask) { /* * The nxagent doesn't know the remote id of the picture's clip * mask, so the clip_mask value is used as a boolean: it is set to * 0 when the clip_mask is None, otherwise it is 1. */ attributes.clip_mask = None; if (nxagentPicturePriv(pPicture) -> lastServerValues.clip_mask != 0) { valuemask |= CPClipMask; nxagentSetPictureRemoteValue(pPicture, clip_mask, 0); } } if (mask & CPPolyEdge) { attributes.poly_edge = pPicture -> polyEdge; if (nxagentCheckPictureRemoteValue(pPicture, poly_edge, attributes.poly_edge) == 0) { valuemask |= CPPolyEdge; nxagentSetPictureRemoteValue(pPicture, poly_edge, attributes.poly_edge); } } if (mask & CPPolyMode) { attributes.poly_mode = pPicture -> polyMode; if (nxagentCheckPictureRemoteValue(pPicture, poly_mode, attributes.poly_mode) == 0) { valuemask |= CPPolyMode; nxagentSetPictureRemoteValue(pPicture, poly_mode, attributes.poly_mode); } } if (mask & CPDither) { attributes.dither = pPicture -> dither; if (nxagentCheckPictureRemoteValue(pPicture, dither, attributes.dither) == 0) { valuemask |= CPDither; nxagentSetPictureRemoteValue(pPicture, dither, attributes.dither); } } if (mask & CPComponentAlpha) { attributes.component_alpha = pPicture -> componentAlpha; if (nxagentCheckPictureRemoteValue(pPicture, component_alpha, attributes.component_alpha) == 0) { valuemask |= CPComponentAlpha; nxagentSetPictureRemoteValue(pPicture, component_alpha, attributes.component_alpha); } } #ifdef TEST if (pPicture && pPicture->pDrawable && pPicture -> pDrawable -> type == DRAWABLE_PIXMAP) { fprintf(stderr, "nxagentChangePicture: %sPixmap [%p] Picture [%p][%p].\n", nxagentIsShmPixmap((PixmapPtr)pPicture -> pDrawable) ? "Shared " : "", (void *) pPicture -> pDrawable, (void *) nxagentPicturePriv(pPicture) -> picture, (void *) pPicture); } #endif /* FIXME: Is this useful or just a waste of bandwidth? Apparently useless with QT. Without this the text is not rendered on GTK/Cairo. */ #ifndef SKIP_REALLY_ALL_LOUSY_RENDER_OPERATIONS if (valuemask != 0) { XRenderChangePicture(nxagentDisplay, nxagentPicturePriv(pPicture) -> picture, valuemask, &attributes); } #ifdef TEST else { fprintf(stderr, "nxagentChangePicture: Skipping change of picture [%p] on remote X server.\n", (void *) pPicture); } #endif #endif /* SKIP_REALLY_ALL_LOUSY_RENDER_OPERATIONS */ #ifdef DEBUG XSync(nxagentDisplay, 0); #endif } void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { if (pSrc == NULL || pDst == NULL) { return; } #ifdef DEBUG if (pSrc && pSrc -> pDrawable != NULL) { fprintf(stderr, "nxagentComposite: Source Picture [%lu][%p] with drawable [%s%s][%p].\n", nxagentPicturePriv(pSrc) -> picture, (void *) pSrc, (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP && nxagentIsShmPixmap((PixmapPtr) pSrc -> pDrawable)) ? "Shared " : "", pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "Pixmap" : "Window", (void *) pSrc -> pDrawable); } if (pDst && pDst->pDrawable) { fprintf(stderr, "nxagentComposite: Destination Picture [%lu][%p] with drawable [%s%s][%p].\n", nxagentPicturePriv(pDst) -> picture, (void *) pDst, (pDst -> pDrawable -> type == DRAWABLE_PIXMAP && nxagentIsShmPixmap((PixmapPtr) pDst -> pDrawable)) ? "Shared " : "", pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "Pixmap" : "Window", (void *) pDst -> pDrawable); } if (pMask && pMask->pDrawable) { fprintf(stderr, "nxagentComposite: Mask Picture [%lu][%p] with drawable [%s%s][%p].\n", nxagentPicturePriv(pMask) -> picture, (void *) pMask, (pMask -> pDrawable -> type == DRAWABLE_PIXMAP && nxagentIsShmPixmap((PixmapPtr) pMask -> pDrawable)) ? "Shared " : "", pMask -> pDrawable -> type == DRAWABLE_PIXMAP ? "Pixmap" : "Window", (void *) pMask -> pDrawable); } #endif if (NXAGENT_SHOULD_DEFER_COMPOSITE(pSrc, pMask, pDst)) { RegionPtr pDstRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, xDst, yDst, width, height); #ifdef TEST if ((pDstRegion) && (pDst && pDst->pDrawable)) { fprintf(stderr, "nxagentComposite: WARNING! Prevented operation on region [%d,%d,%d,%d] " "for drawable at [%p] with type [%s].\n", pDstRegion -> extents.x1, pDstRegion -> extents.y1, pDstRegion -> extents.x2, pDstRegion -> extents.y2, (void *) pDst -> pDrawable, pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"); } #endif nxagentMarkCorruptedRegion(pDst -> pDrawable, pDstRegion); nxagentFreeRegion(pDst -> pDrawable, pDstRegion); return; } /* * Synchronize the content of the shared memory pixmap but pay * attention at not doing this more than once. We need to wait * until the image data has been recom- posed at the X server side * or the operation will use the wrong data. */ if (pSrc -> pDrawable != NULL) { nxagentSynchronizeShmPixmap(pSrc -> pDrawable, xSrc, ySrc, width, height); if (nxagentDrawableStatus(pSrc -> pDrawable) == NotSynchronized) { #ifdef TEST fprintf(stderr, "nxagentComposite: Synchronizing the source drawable [%p].\n", (void *) pSrc -> pDrawable); #endif nxagentSynchronizeDrawable(pSrc -> pDrawable, DO_WAIT, NEVER_BREAK, NULL); } } if (pDst -> pDrawable != pSrc -> pDrawable) { nxagentSynchronizeShmPixmap(pDst -> pDrawable, xDst, yDst, width, height); if (nxagentDrawableStatus(pDst -> pDrawable) == NotSynchronized) { #ifdef TEST fprintf(stderr, "nxagentComposite: Synchronizing the destination drawable [%p].\n", (void *) pDst -> pDrawable); #endif nxagentSynchronizeDrawable(pDst -> pDrawable, DO_WAIT, NEVER_BREAK, NULL); } } if (pMask != NULL && pMask -> pDrawable != NULL && pMask -> pDrawable != pSrc -> pDrawable && pMask -> pDrawable != pDst -> pDrawable) { nxagentSynchronizeShmPixmap(pMask -> pDrawable, xMask, yMask, width, height); if (nxagentDrawableStatus(pMask -> pDrawable) == NotSynchronized) { #ifdef TEST fprintf(stderr, "nxagentComposite: Synchronizing the mask drawable [%p].\n", (void *) pMask -> pDrawable); #endif nxagentSynchronizeDrawable(pMask -> pDrawable, DO_WAIT, NEVER_BREAK, NULL); } } /* * The glyphs flag have to be propagated between drawables, in order * to avoid to encode the text with lossy algorithms (like * JPEG). Unlu- ckily we have verified that if the render com- * posite propagates the flag, the deferring of render trapezoids * doesn't work well. Moreover, by commenting out this code we have * not noticed any visual problems. * * if (nxagentDrawableContainGlyphs(pSrc -> pDrawable) == 1) * { * nxagentSetDrawableContainGlyphs(pDst -> pDrawable, 1); * } */ XRenderComposite(nxagentDisplay, op, nxagentPicturePriv(pSrc) -> picture, pMask ? nxagentPicturePriv(pMask) -> picture : 0, nxagentPicturePriv(pDst) -> picture, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); #ifdef DEBUG XSync(nxagentDisplay, 0); #endif } void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlists, XGlyphElt8 *elts, int sizeID, GlyphPtr *glyphsBase) { BoxRec glyphBox; XGlyphElt8 *elements; if (pSrc == NULL || pDst == NULL) { return; } #ifdef TEST if ((pSrc && pSrc->pDrawable) && (pDst && pDst->pDrawable)) { fprintf(stderr, "nxagentGlyphs: Called with source [%s][%p] destination [%s][%p] and size id [%d].\n", (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pSrc, (pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pDst, sizeID); } #endif XRenderPictFormat *pForm = NULL; if (maskFormat != NULL) { pForm = nxagentMatchingFormats(maskFormat); nxagentPrintFormat(pForm); if (pForm == NULL) { return; } } if (nxagentGlyphsExtents != NullBox) { glyphBox.x1 = nxagentGlyphsExtents -> x1; glyphBox.y1 = nxagentGlyphsExtents -> y1; glyphBox.x2 = nxagentGlyphsExtents -> x2; glyphBox.y2 = nxagentGlyphsExtents -> y2; /* * By extending the glyph extents the visual aspect looks nicer * because the synchronized region is not glued to the fonts. */ if (glyphBox.x2 != glyphBox.x1) { glyphBox.x1 -= GLYPH_BOX_MARGIN; glyphBox.x2 += GLYPH_BOX_MARGIN; } if (glyphBox.y2 != glyphBox.y1) { glyphBox.y1 -= GLYPH_BOX_MARGIN; glyphBox.y2 += GLYPH_BOX_MARGIN; } } /* * If the destination window is hidden, the operation can be * prevented. */ if (pDst -> pDrawable -> type == DRAWABLE_WINDOW) { RegionPtr pRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, glyphBox.x1, glyphBox.y1, glyphBox.x2 - glyphBox.x1, glyphBox.y2 - glyphBox.y1); if (RegionNil(pRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentGlyphs: WARNING! Glyphs prevented on hidden window at [%p].\n", (void *) pDst -> pDrawable); #endif nxagentFreeRegion(pDst -> pDrawable, pRegion); return; } nxagentFreeRegion(pDst -> pDrawable, pRegion); } /* * Need to synchronize the pixmaps involved in the operation before * rendering the glyphs on the real X server. */ if (pSrc -> pDrawable != NULL && nxagentDrawableStatus(pSrc -> pDrawable) == NotSynchronized) { #ifdef TEST if (pSrc && pSrc->pDrawable) { fprintf(stderr, "nxagentGlyphs: Synchronizing source [%s] at [%p].\n", pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window", (void *) pSrc -> pDrawable); } #endif /* * If the source drawable is going to be repeated over the * destination drawable during the composite operation, we need to * synchronize the whole drawable to avoid graphical problems. */ if (pSrc -> repeat == 1 || nxagentGlyphsExtents == NullBox) { #ifdef DEBUG if (pSrc && pSrc->pDrawable) { fprintf(stderr, "nxagentGlyphs: Synchronizing source [%s] at [%p] " "with geometry [%d,%d,%d,%d].\n", (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pSrc -> pDrawable, pSrc -> pDrawable -> x, pSrc -> pDrawable -> y, pSrc -> pDrawable -> x + pSrc -> pDrawable -> width, pSrc -> pDrawable -> y + pSrc -> pDrawable -> height); } #endif nxagentSynchronizeBox(pSrc -> pDrawable, NullBox, NEVER_BREAK); } else { #ifdef DEBUG if (pSrc && pSrc->pDrawable) { fprintf(stderr, "nxagentGlyphs: Synchronizing region [%d,%d,%d,%d] of source [%s] at [%p] " "with geometry [%d,%d,%d,%d].\n", glyphBox.x1, glyphBox.y1, glyphBox.x2, glyphBox.y2, (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pSrc -> pDrawable, pSrc -> pDrawable -> x, pSrc -> pDrawable -> y, pSrc -> pDrawable -> x + pSrc -> pDrawable -> width, pSrc -> pDrawable -> y + pSrc -> pDrawable -> height); } #endif nxagentSynchronizeBox(pSrc -> pDrawable, &glyphBox, NEVER_BREAK); } if (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP) { nxagentIncreasePixmapUsageCounter((PixmapPtr) pSrc -> pDrawable); } } if (pSrc -> pDrawable != pDst -> pDrawable && nxagentDrawableStatus(pDst -> pDrawable) == NotSynchronized) { #ifdef TEST if (pDst && pDst->pDrawable) { fprintf(stderr, "nxagentGlyphs: Synchronizing destination [%s] at [%p].\n", pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window", (void *) pDst -> pDrawable); } #endif if (nxagentGlyphsExtents == NullBox) { #ifdef DEBUG if (pDst && pDst->pDrawable) { fprintf(stderr, "nxagentGlyphs: Synchronizing destination [%s] at [%p] " "with geometry [%d,%d,%d,%d].\n", (pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pDst -> pDrawable, pDst -> pDrawable -> x, pDst -> pDrawable -> y, pDst -> pDrawable -> x + pDst -> pDrawable -> width, pDst -> pDrawable -> y + pDst -> pDrawable -> height); } #endif nxagentSynchronizeBox(pDst -> pDrawable, NullBox, NEVER_BREAK); } else { #ifdef DEBUG if (pDst && pDst->pDrawable) { fprintf(stderr, "nxagentGlyphs: Synchronizing region [%d,%d,%d,%d] of destination [%s] at [%p] " "with geometry [%d,%d,%d,%d].\n", glyphBox.x1, glyphBox.y1, glyphBox.x2, glyphBox.y2, (pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pDst -> pDrawable, pDst -> pDrawable -> x, pDst -> pDrawable -> y, pDst -> pDrawable -> x + pDst -> pDrawable -> width, pDst -> pDrawable -> y + pDst -> pDrawable -> height); } #endif nxagentSynchronizeBox(pDst -> pDrawable, &glyphBox, NEVER_BREAK); } if (pDst -> pDrawable -> type == DRAWABLE_PIXMAP) { nxagentIncreasePixmapUsageCounter((PixmapPtr) pDst -> pDrawable); } } nxagentSetDrawableContainGlyphs(pDst -> pDrawable, 1); #ifdef TEST if (pDst && pDst->pDrawable) { fprintf(stderr, "nxagentGlyphs: Glyph flag set on drawable [%s][%p].\n", pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window", (void *) pDst -> pDrawable); } #endif #ifdef SPLIT_GLYPH_LISTS GlyphPtr glyph; /* * We split glyphs lists here and recalculate the offsets of each * list to make them ab- solute and not relatives to the prior list. * This way each time we call XRenderComposi- teText it has to deal * only with a list of glyphs. This is done to further improve * caching. */ elements = elts; if (nlists > 1) { int x; int y; for (int j = 1; j < nlists; j++) { x = elements -> xOff; y = elements -> yOff; #ifdef TEST fprintf(stderr, "nxagentGlyphs: Element [%d] of [%d] has offset [%d,%d].\n", j, nlists, elements -> xOff, elements -> yOff); #endif for (int i = 0; i < elements -> nchars; i++) { glyph = *glyphsBase++; x += glyph -> info.xOff; y += glyph -> info.yOff; #ifdef TEST fprintf(stderr, "nxagentGlyphs: Glyph at index [%d] has offset [%d,%d] and " "position [%d,%d].\n", i, elements -> nchars, glyph -> info.xOff, glyph -> info.yOff, x, y); #endif } elements++; elements -> xOff += x; elements -> yOff += y; #ifdef TEST fprintf(stderr, "nxagentGlyphs: New offset for list at [%p] is [%d,%d].\n", elements, elements -> xOff, elements -> yOff); #endif } elements = elts; } switch (sizeID) { case 1: { for (int j = 0; j < nlists; j++) { XRenderCompositeText8(nxagentDisplay, op, nxagentPicturePriv(pSrc)->picture, nxagentPicturePriv(pDst)->picture, pForm, xSrc, ySrc, elements -> xOff, elements -> yOff, (XGlyphElt8*) elements, 1); elements++; } break; } case 2: { for (int j = 0; j < nlists; j++) { XRenderCompositeText16(nxagentDisplay, op, nxagentPicturePriv(pSrc) -> picture, nxagentPicturePriv(pDst) -> picture, pForm, xSrc, ySrc, elements -> xOff, elements -> yOff, (XGlyphElt16*) elements, 1); elements++; } break; } case 4: { for (int j = 0; j < nlists; j++) { XRenderCompositeText32(nxagentDisplay, op, nxagentPicturePriv(pSrc) -> picture, nxagentPicturePriv(pDst) -> picture, pForm, xSrc, ySrc, elements -> xOff, elements -> yOff, (XGlyphElt32*) elements, 1); elements++; } break; } default: { #ifdef WARNING fprintf(stderr, "nxagentGlyphs: WARNING! Invalid size id [%d].\n", sizeID); #endif break; } } #else /* #ifdef SPLIT_GLYPH_LISTS */ elements = elts; switch (sizeID) { case 1: { XRenderCompositeText8(nxagentDisplay, op, nxagentPicturePriv(pSrc)->picture, nxagentPicturePriv(pDst)->picture, pForm, xSrc, ySrc, elements -> xOff, elements -> yOff, (XGlyphElt8*) elements, nlists); break; } case 2: { XRenderCompositeText16(nxagentDisplay, op, nxagentPicturePriv(pSrc) -> picture, nxagentPicturePriv(pDst) -> picture, pForm, xSrc, ySrc, elements -> xOff, elements -> yOff, (XGlyphElt16*) elements, nlists); break; } case 4: { XRenderCompositeText32(nxagentDisplay, op, nxagentPicturePriv(pSrc) -> picture, nxagentPicturePriv(pDst) -> picture, pForm, xSrc, ySrc, elements -> xOff, elements -> yOff, (XGlyphElt32*) elements, nlists); break; } default: { #ifdef WARNING fprintf(stderr, "nxagentGlyphs: WARNING! Invalid size id [%d].\n", sizeID); #endif break; } } #endif /* #ifdef SPLIT_GLYPH_LISTS */ } void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects) { if (pDst == NULL) { return; } #ifdef TEST if (pDst && pDst->pDrawable) { fprintf(stderr, "nxagentCompositeRects: Called for picture at [%p] with [%s] at [%p].\n", (void *) pDst, (pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), (void *) pDst -> pDrawable); } #endif /* * The CompositeRects() clears the destination's * corrupted region like the PolyFillRects() does. * As this case is harder to handle, at the moment * we only check for two ops. */ if (nxagentDrawableStatus(pDst -> pDrawable) == NotSynchronized && (op == PictOpSrc || (op == PictOpOver && color -> alpha == 0xffff))) { RegionPtr rectRegion = RegionFromRects(nRect, rects, CT_REGION); if (pDst -> clientClipType != CT_NONE) { RegionRec tmpRegion; RegionInit(&tmpRegion, NullBox, 1); RegionCopy(&tmpRegion, (RegionPtr) pDst -> clientClip); if (pDst -> clipOrigin.x != 0 || pDst -> clipOrigin.y != 0) { RegionTranslate(&tmpRegion, pDst -> clipOrigin.x, pDst -> clipOrigin.y); } RegionIntersect(rectRegion, rectRegion, &tmpRegion); RegionUninit(&tmpRegion); } #ifdef TEST fprintf(stderr, "nxagentCompositeRects: Going to clean the drawable with extents [%d,%d,%d,%d].\n", rectRegion -> extents.x1, rectRegion -> extents.y1, rectRegion -> extents.x2, rectRegion -> extents.y2); #endif nxagentUnmarkCorruptedRegion(pDst -> pDrawable, rectRegion); RegionDestroy(rectRegion); } XRenderFillRectangles(nxagentDisplay, op, (Picture)nxagentPicturePriv(pDst) -> picture, (XRenderColor *) color, (XRectangle *) rects, nRect); #ifdef DEBUG XSync(nxagentDisplay, 0); #endif } void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps) { XTrapezoid *current = (XTrapezoid *) traps; int remaining = ntrap; #ifdef TEST fprintf(stderr, "nxagentTrapezoids: Source [%p] destination [%p] coordinates " "[%d,%d] elements [%d].\n", (void *) pSrc, (void *) pDst, xSrc, ySrc, ntrap); #endif if (pSrc == NULL || pDst == NULL) { return; } XRenderPictFormat *pForm = NULL; if (maskFormat != NULL) { pForm = nxagentMatchingFormats(maskFormat); nxagentPrintFormat(pForm); if (pForm == NULL) { return; } } /* FIXME: Is this useful or just a waste of bandwidth? Apparently useless with QT. */ #ifndef SKIP_LOUSY_RENDER_OPERATIONS #ifdef TEST if (pSrc->pDrawable) { fprintf(stderr, "nxagentTrapezoids: Source is a [%s] of geometry [%d,%d].\n", (pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), pSrc -> pDrawable -> width, pSrc -> pDrawable -> height); } if (pSrc ->pDrawable != pDst -> pDrawable) { fprintf(stderr, "nxagentTrapezoids: Destination is a [%s] of geometry [%d,%d].\n", (pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"), pDst -> pDrawable -> width, pDst -> pDrawable -> height); } #endif /* * If the destination drawable is not synchronized * but the trapezoids extents are included in the * dirty region, we can defer the operation. */ if (nxagentDrawableStatus(pDst -> pDrawable) == NotSynchronized && RegionContainsRect(nxagentCorruptedRegion(pDst -> pDrawable), nxagentTrapezoidExtents) == rgnIN) { #ifdef TEST if (pDst && pDst->pDrawable) { fprintf(stderr, "nxagentTrapezoids: WARNING! Prevented operation on region [%d,%d,%d,%d] already dirty " "for drawable [%s][%p].\n", nxagentTrapezoidExtents -> x1, nxagentTrapezoidExtents -> y1, nxagentTrapezoidExtents -> x2, nxagentTrapezoidExtents -> y2, pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window", (void *) pDst -> pDrawable); } #endif if (pDst -> pDrawable -> type == DRAWABLE_PIXMAP) { nxagentPixmapContainTrapezoids((PixmapPtr) pDst -> pDrawable) = 1; } return; } /* * If the destination doesn't contain any glyphs, * we can defer the trapezoids drawing by marking * the destination as dirty. */ if (NXAGENT_SHOULD_DEFER_TRAPEZOIDS(pDst -> pDrawable)) { RegionPtr pDstRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, nxagentTrapezoidExtents -> x1, nxagentTrapezoidExtents -> y1, nxagentTrapezoidExtents -> x2 - nxagentTrapezoidExtents -> x1, nxagentTrapezoidExtents -> y2 - nxagentTrapezoidExtents -> y1); #ifdef TEST if (pDst && pDst->pDrawable) { fprintf(stderr, "nxagentTrapezoids: WARNING! Prevented operation on region [%d,%d,%d,%d] " "for drawable [%s][%p].\n", pDstRegion -> extents.x1, pDstRegion -> extents.y1, pDstRegion -> extents.x2, pDstRegion -> extents.y2, pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window", (void *) pDst -> pDrawable); } #endif nxagentMarkCorruptedRegion(pDst -> pDrawable, pDstRegion); nxagentFreeRegion(pDst -> pDrawable, pDstRegion); if (pDst -> pDrawable -> type == DRAWABLE_PIXMAP) { nxagentPixmapContainTrapezoids((PixmapPtr) pDst -> pDrawable) = 1; } return; } if (pSrc -> pDrawable != NULL && nxagentDrawableStatus(pSrc -> pDrawable) == NotSynchronized) { #ifdef TEST fprintf(stderr, "nxagentTrapezoids: Going to synchronize the source drawable at [%p].\n", (void *) pSrc -> pDrawable); #endif nxagentSynchronizeBox(pSrc -> pDrawable, NullBox, NEVER_BREAK); } if (nxagentDrawableStatus(pDst -> pDrawable) == NotSynchronized) { #ifdef TEST fprintf(stderr, "nxagentTrapezoids: Going to synchronize the destination drawable at [%p].\n", (void *) pDst -> pDrawable); #endif nxagentSynchronizeBox(pDst -> pDrawable, nxagentTrapezoidExtents, NEVER_BREAK); } XRenderCompositeTrapezoids(nxagentDisplay, op, nxagentPicturePriv(pSrc) -> picture, nxagentPicturePriv(pDst) -> picture, pForm, xSrc, ySrc, (XTrapezoid *) current,remaining); #endif #ifdef DEBUG XSync(nxagentDisplay, 0); #endif } void nxagentQueryFormats(void) { #ifdef DEBUG fprintf(stderr, "nxagentQueryFormats.\n"); #endif if (XRenderQueryFormats(nxagentDisplay)) { int i; #ifdef DEBUG XSync(nxagentDisplay, 0); #endif XExtDisplayInfo *info = (XExtDisplayInfo *) XRenderFindDisplay(nxagentDisplay); #ifdef DEBUG XSync(nxagentDisplay, 0); #endif XRenderInfo *xri = (XRenderInfo *) info -> data; XRenderPictFormat *pformat = xri -> format; for (i = 0; i < xri -> nformat; i++) { nxagentArrayFormats[i] = *pformat; #ifdef DEBUG fprintf(stderr, "nxagentQueryFormats: Added format type [%d] depth [%d] rgb [%d,%d,%d] " "mask rgb [%d,%d,%d] alpha [%d] alpha mask [%d].\n", nxagentArrayFormats[i].type, nxagentArrayFormats[i].depth, nxagentArrayFormats[i].direct.red, nxagentArrayFormats[i].direct.green, nxagentArrayFormats[i].direct.blue, nxagentArrayFormats[i].direct.redMask, nxagentArrayFormats[i].direct.greenMask, nxagentArrayFormats[i].direct.blueMask, nxagentArrayFormats[i].direct.alpha, nxagentArrayFormats[i].direct.alphaMask); #endif pformat++; } #ifdef DEBUG if (nxagentNumFormats == 0) { fprintf(stderr, "nxagentQueryFormats: Number of formats is [%d].\n", i); } else { fprintf(stderr, "nxagentQueryFormats: Old number of formats is [%d]. New number of formats is [%d].\n", nxagentNumFormats, i); } #endif nxagentNumFormats = i; } } void nxagentCreateGlyphSet(GlyphSetPtr pGly) { #ifdef DEBUG fprintf(stderr, "nxagentCreateGlyphSet: Glyphset at [%p].\n", (void *) pGly); #endif XRenderPictFormat *pForm = NULL; if (pGly -> format != NULL) { pForm = nxagentMatchingFormats(pGly -> format); nxagentPrintFormat(pForm); if (pForm == NULL) { return; } } pGly -> remoteID = XRenderCreateGlyphSet(nxagentDisplay, pForm); #ifdef DEBUG XSync(nxagentDisplay, 0); #endif } void nxagentReferenceGlyphSet(GlyphSetPtr glyphSet) { if (glyphSet -> remoteID == 0) { #ifdef TEST fprintf(stderr, "nxagentReferenceGlyphSet: Operation deferred because glyphset at [%p] is corrupted.\n", (void *) glyphSet); #endif return; } XRenderReferenceGlyphSet (nxagentDisplay, glyphSet -> remoteID); } void nxagentFreeGlyphSet(GlyphSetPtr glyphSet) { if (glyphSet -> remoteID == 0) { #ifdef TEST fprintf(stderr, "nxagentFreeGlyphs: Operation ignored because glyphset at [%p] is corrupted.\n", (void *) glyphSet); #endif return; } XRenderFreeGlyphSet(nxagentDisplay, glyphSet -> remoteID); } void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, int nglyphs, CARD8 *images, int sizeImages) { #ifdef DEBUG fprintf(stderr, "nxagentAddGlyphs: Glyphset at [%p]. Number of glyphs [%d].\n", (void *) glyphSet, nglyphs); #endif if (glyphSet -> remoteID == 0) { #ifdef TEST fprintf(stderr, "nxagentAddGlyphs: Going to reconnect the glyhpset at [%p] before adding glyphs.\n", (void *) glyphSet); #endif nxagentReconnectGlyphSet(glyphSet, (XID) 0, (void*) NULL); } /* * By adding a glyph to a glyphset on * remote X server we mark its reference * as synchronized. */ for (int i = 0; i < nglyphs; i++) { Glyph *tempGids = gids; GlyphRefPtr gr = FindGlyphRef(&glyphSet -> hash, *tempGids, 0, 0); if (gr && gr -> glyph != DeletedGlyph) { #ifdef DEBUG fprintf(stderr, "nxagentAddGlyphs: Added Glyph [%p][%ld] to glyphset [%p].\n", (void *) gr -> glyph, *tempGids, (void *) glyphSet); #endif gr -> corruptedGlyph = 0; } tempGids++; } CARD8 *normalizedImages = NULL; if (sizeImages > 0) { normalizedImages = malloc(sizeImages); if (normalizedImages != NULL) { memcpy(normalizedImages, images, sizeImages); if (glyphDepths[glyphSet -> fdepth] == 1 && nxagentServerOrder() != BitmapBitOrder(nxagentDisplay)) { nxagentBitOrderInvert ((unsigned char *) normalizedImages, sizeImages); } } else { #ifdef PANIC fprintf(stderr, "nxagentAddGlyphs: PANIC! Allocation of normalized glyph images failed.\n"); #endif } } if (normalizedImages == NULL) { normalizedImages = images; } #ifdef NXAGENT_RENDER_CLEANUP nxagentCleanGlyphs(gi, nglyphs, normalizedImages, glyphDepths[glyphSet -> fdepth], nxagentDisplay); #endif /* NXAGENT_RENDER_CLEANUP */ XRenderAddGlyphs(nxagentDisplay, glyphSet -> remoteID, gids, (XGlyphInfo*)(gi), nglyphs, (char*) normalizedImages, sizeImages); if (normalizedImages != images) { SAFE_free(normalizedImages); } #ifdef DEBUG XSync(nxagentDisplay, 0); #endif } void nxagentFreeGlyphs(GlyphSetPtr glyphSet, CARD32 *gids, int nglyph) { GlyphRefPtr gr; Glyph gid; if (glyphSet -> remoteID == 0) { #ifdef TEST fprintf(stderr, "nxagentFreeGlyphs: Operation ignored because glyphset at [%p] is corrupted.\n", (void *) glyphSet); #endif return; } /* * We loop across the list of glyphs id * to establish if they have been added * to glyphset on remote X server, so * they can be freed. */ CARD32 *tempGids = gids; for (int i = 0; i < nglyph; i++) { gid = (Glyph)*tempGids; if ((gr = FindGlyphRef(&glyphSet -> hash, *tempGids, 0, 0)) && gr -> glyph != DeletedGlyph && gr -> corruptedGlyph == 0) { XRenderFreeGlyphs(nxagentDisplay, glyphSet -> remoteID, &gid, 1); } tempGids++; } } void nxagentSetPictureTransform(PicturePtr pPicture, void * transform) { #ifdef TEST fprintf(stderr, "nxagentSetPictureTransform: Going to set transform [%p] to picture at [%p].\n", (void *) transform, (void *) pPicture); #endif /* FIXME: Is this useful or just a waste of bandwidth? Apparently useless with QT. */ #ifndef SKIP_LOUSY_RENDER_OPERATIONS XRenderSetPictureTransform(nxagentDisplay, nxagentPicturePriv(pPicture) -> picture, (XTransform *) transform); #endif } void nxagentSetPictureFilter(PicturePtr pPicture, char *filter, int name_size, void * params, int nparams) { char *szFilter = Xmalloc(name_size + 1); if (szFilter == NULL) { #ifdef WARNING fprintf(stderr, "nxagentSetPictureFilter: error allocating memory for filter name.\n"); #endif return; } strncpy(szFilter, filter, name_size); szFilter[name_size] = 0; #ifdef TEST fprintf(stderr, "nxagentSetPictureFilter: Going to set filter [%s] to picture at [%p].\n", szFilter, (void *) pPicture); #endif /* FIXME: Is this useful or just a waste of bandwidth? Apparently useless with QT. */ #ifndef SKIP_LOUSY_RENDER_OPERATIONS XRenderSetPictureFilter(nxagentDisplay, nxagentPicturePriv(pPicture) -> picture, szFilter, (XFixed *) params, nparams); #endif SAFE_free(szFilter); } Bool nxagentPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) { #ifdef RENDER #ifdef DEBUG fprintf(stderr, "nxagentPictureInit: Screen [%p].\n", (void *) pScreen); #endif nxagentQueryFormats(); if (fbPictureInit(pScreen, formats, nformats) == 0) { return FALSE; } nxagentPicturePrivateIndex = AllocatePicturePrivateIndex(); AllocatePicturePrivate(pScreen, nxagentPicturePrivateIndex, sizeof(nxagentPrivPictureRec)); #endif return TRUE; } static void nxagentPrintFormat(XRenderPictFormat *pFormat) { #ifdef DEBUG if (pFormat == NULL) { fprintf(stderr, "nxagentPrintFormat: WARNING! null pointer passed to function.\n"); return; } fprintf(stderr, "nxagentPrintFormat: Dumping information for format at [%p]:\n\ type=%d\n\ depth=%d\n\ red=%d\n\ redMask=%d\n\ green=%d\n\ greenMask=%d\n\ blue=%d\n\ blueMask=%d\n\ alpha=%d\n\ alphaMask=%d\n", (void *) pFormat, pFormat -> type, pFormat -> depth, pFormat -> direct.red, pFormat -> direct.redMask, pFormat -> direct.green, pFormat -> direct.greenMask, pFormat -> direct.blue, pFormat -> direct.blueMask, pFormat -> direct.alpha, pFormat -> direct.alphaMask); #endif } Bool nxagentFillGlyphSet(GlyphSetPtr pGly) { #ifdef DEBUG fprintf(stderr, "nxagentFillGlyphSet: GlyphSet at [%p] Refcount [%ld] Glyphs [%ld] " "Format [%p] FDepth [%d] RemoteID [%ld].\n", (void *) pGly, pGly -> refcnt, pGly -> hash.hashSet -> size, (void *) pGly -> format, pGly -> fdepth, pGly -> remoteID); #endif /* * The glyphs are synchronized when they * are used in a composite text. During * the reconnection we have only to mark * corrupted the glyphs for each glyphset. */ for (int i = 0; i < pGly -> hash.hashSet -> size; i++) { GlyphPtr glyph = pGly -> hash.table[i].glyph; if (glyph && (glyph != DeletedGlyph)) { pGly -> hash.table[i].corruptedGlyph = 1; } } return TRUE; } void nxagentReconnectGlyphSet(void* p0, XID x1, void *p2) { GlyphSetPtr pGly = (GlyphSetPtr) p0; if (nxagentReconnectTrap == 0) { int i; XRenderPictFormat *pForm = NULL; #ifdef DEBUG fprintf(stderr, "nxagentReconnectGlyphSet: GlyphSet at [%p].\n", (void *) pGly); #endif if (pGly -> format) { pForm = nxagentMatchingFormats(pGly -> format); } pGly -> remoteID = XRenderCreateGlyphSet(nxagentDisplay, pForm); /* * If we have deferred the operation, we * have to check the number of references * to the glyphset to update the X server. */ if ((i = pGly -> refcnt) > 1) { while (i-- > 1) { nxagentReferenceGlyphSet(pGly); } } #ifdef DEBUG XSync(nxagentDisplay, 0); #endif nxagentFillGlyphSet(pGly); } else { pGly -> remoteID = 0; } } Bool nxagentReconnectAllGlyphSet(void *p) { Bool success = True; nxagentQueryFormats(); #ifdef DEBUG fprintf(stderr, "nxagentReconnectAllGlyphSet\n"); #endif for (int i = 0; (i < MAXCLIENTS) && (success); i++) { if (clients[i]) { FindClientResourcesByType(clients[i], GlyphSetType, nxagentReconnectGlyphSet, &success); } } return success; } void nxagentReconnectPicture(void * p0, XID x1, void *p2) { PicturePtr pPicture = (PicturePtr) p0; Bool *pBool = (Bool *) p2; unsigned long mask = 0; XRenderPictureAttributes attributes; #ifdef TEST fprintf(stderr, "nxagentReconnectPicture: Called with bool [%d] and picture at [%p].\n", *pBool, (void *) pPicture); fprintf(stderr, "nxagentReconnectPicture: Virtual picture is [%ld].\n", nxagentPicture(pPicture)); #endif /* * Check if a previous operation has failed * and that the involved objects are valid. */ if (!*pBool || pPicture == NULL || nxagentPicture(pPicture) != 0) { return; } if (pPicture -> repeat) { attributes.repeat = (Bool) pPicture -> repeat; mask |= CPRepeat; } if (pPicture -> alphaMap) { if (!nxagentPicture(pPicture -> alphaMap)) { nxagentReconnectPicture(pPicture -> alphaMap, 0, pBool); if (!*pBool || !nxagentPicture(pPicture -> alphaMap)) { return; } } attributes.alpha_map = nxagentPicture(pPicture -> alphaMap); attributes.alpha_x_origin = pPicture -> alphaOrigin.x; attributes.alpha_y_origin = pPicture -> alphaOrigin.y; mask |= (CPAlphaMap | CPAlphaXOrigin | CPAlphaYOrigin); } if (pPicture -> graphicsExposures) { attributes.graphics_exposures = pPicture -> graphicsExposures; mask |= CPGraphicsExposure; } attributes.subwindow_mode = pPicture -> subWindowMode; mask |= CPSubwindowMode; attributes.poly_edge = pPicture -> polyEdge; mask |= CPPolyEdge; attributes.poly_mode = pPicture -> polyMode; mask |= CPPolyMode; attributes.dither = pPicture -> dither; mask |= CPDither; attributes.component_alpha = pPicture -> componentAlpha; mask |= CPComponentAlpha; XRenderPictFormat *pForm = NULL; if (pPicture -> pFormat) { pForm = nxagentMatchingFormats(pPicture -> pFormat); nxagentPrintFormat(pForm); } if (!pForm && pPicture->pSourcePict) { /*possible we need to add support for other picture types, for example gradients...*/ switch(pPicture->pSourcePict->type) { case SourcePictTypeSolidFill: nxagentPicturePriv(pPicture) -> picture = XRenderCreateSolidFill(nxagentDisplay, (const XRenderColor*) &pPicture->pSourcePict->solidFill.fullColor); break; } return; } #ifdef TEST fprintf(stderr, "nxagentReconnectPicture: Creating picture at [%p] with drawable [%ld] at [%p].\n", (void *) pPicture, nxagentDrawable(pPicture -> pDrawable), (void *) pPicture -> pDrawable); fprintf(stderr, "nxagentReconnectPicture: Format is at [%p] mask is [%ld] attributes are at [%p].\n", (void *) pForm, mask, (void *) &attributes); #endif nxagentPicture(pPicture) = XRenderCreatePicture(nxagentDisplay, nxagentDrawable(pPicture -> pDrawable), pForm, mask, &attributes); #ifdef TEST XSync(nxagentDisplay, 0); #endif #ifdef TEST fprintf(stderr, "nxagentReconnectPicture: Reconnected picture at [%p] with value [%ld].\n", (void *) pPicture, nxagentPicture(pPicture)); #endif if (nxagentAlphaEnabled == 1 && pPicture -> pDrawable -> depth == 32 && pPicture -> pFormat -> direct.alpha != 0) { if (pPicture -> pDrawable -> type == DRAWABLE_PIXMAP) { nxagentPixmapPriv((PixmapPtr) pPicture -> pDrawable) -> pPicture = pPicture; } else if (pPicture -> pDrawable -> type == DRAWABLE_WINDOW) { nxagentWindowPriv((WindowPtr) pPicture -> pDrawable) -> pPicture = pPicture; } } } Bool nxagentReconnectAllPicture(void *p) { Bool r = True; #ifdef TEST fprintf(stderr, "nxagentReconnectAllPicture: Going to recreate all pictures.\n"); #endif for (int i = 0; i < MAXCLIENTS; i++) { if (clients[i]) { FindClientResourcesByType(clients[i], PictureType, nxagentReconnectPicture, &r); #ifdef WARNING if (!r) { fprintf(stderr, "nxagentReconnectAllPicture: WARNING! Failed to recreate " "picture for client [%d].\n", i); } #endif } } return True; } void nxagentDisconnectPicture(void * p0, XID x1, void* p2) { PicturePtr pPicture = (PicturePtr) p0; Bool *pBool = (Bool *) p2; #ifdef TEST fprintf(stderr, "nxagentDisconnectPicture: Called with bool [%d] and picture at [%p].\n", *pBool, (void *) pPicture); fprintf(stderr, "nxagentDisconnectPicture: Virtual picture is [%ld].\n", nxagentPicture(pPicture)); #endif if (!*pBool || !pPicture) { return; } #ifdef DEBUG fprintf(stderr, "nxagentDisconnectPicture: %p - XID %lx\n", (void *) pPicture, nxagentPicture(pPicture)); #endif nxagentPicture(pPicture) = None; } Bool nxagentDisconnectAllPicture(void) { Bool r = True; #ifdef DEBUG fprintf(stderr, "nxagentDisconnectAllPicture.\n"); #endif for (int i = 0; i < MAXCLIENTS; i++) { if (clients[i]) { FindClientResourcesByType(clients[i], PictureType, nxagentDisconnectPicture, &r); #ifdef WARNING if (!r) { fprintf(stderr, "nxagentDisconnectAllPicture: WARNING! Failed to disconnect " "picture for client [%d].\n", i); } #endif } } return True; } void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color) { if (nxagentRenderEnable == False) { return; } #ifdef DEBUG fprintf(stderr, "nxagentRenderCreateSolidFill: Got called.\n"); if (pPicture == NULL) { fprintf(stderr, "nxagentRenderCreateSolidFill: WARNING! pPicture pointer is NULL.\n"); } if (color == NULL) { fprintf(stderr, "nxagentRenderCreateSolidFill: WARNING! color pointer is NULL.\n"); } #endif /* #ifdef DEBUG */ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, sizeof(XRenderPictureAttributes_)); Picture id = XRenderCreateSolidFill(nxagentDisplay, (XRenderColor *) color); #ifdef DEBUG XSync(nxagentDisplay, 0); #endif #ifdef TEST fprintf(stderr, "nxagentRenderCreateSolidFill: Created solid fill xid [%lu].\n", id); #endif nxagentPicturePriv(pPicture) -> picture = id; } void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1, xPointFixed *p2, int nStops, xFixed *stops, xRenderColor *colors) { if (nxagentRenderEnable == False) { return; } #ifdef DEBUG fprintf(stderr, "nxagentRenderCreateLinearGradient: Got called.\n"); if (pPicture == NULL) { fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! pPicture pointer is NULL.\n"); } if (p1 == NULL) { fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! p1 pointer is NULL.\n"); } if (p2 == NULL) { fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! p2 pointer is NULL.\n"); } if (stops == NULL) { fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! stops pointer is NULL.\n"); } if (colors == NULL) { fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! colors pointer is NULL.\n"); } #endif /* #ifdef DEBUG */ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, sizeof(XRenderPictureAttributes_)); XLinearGradient linearGradient; linearGradient.p1.x = (XFixed) p1 -> x; linearGradient.p1.y = (XFixed) p1 -> y; linearGradient.p2.x = (XFixed) p2 -> x; linearGradient.p2.y = (XFixed) p2 -> y; Picture id = XRenderCreateLinearGradient(nxagentDisplay, &linearGradient, (XFixed *) stops, (XRenderColor *) colors, nStops); #ifdef DEBUG XSync(nxagentDisplay, 0); #endif #ifdef TEST fprintf(stderr, "nxagentRenderCreateLinearGradient: Created linear gradient xid [%lu].\n", id); #endif nxagentPicturePriv(pPicture) -> picture = id; } void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner, xPointFixed *outer, xFixed innerRadius, xFixed outerRadius, int nStops, xFixed *stops, xRenderColor *colors) { if (nxagentRenderEnable == False) { return; } #ifdef DEBUG fprintf(stderr, "nxagentRenderCreateRadialGradient: Got called.\n"); if (pPicture == NULL) { fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! pPicture pointer is NULL.\n"); } if (inner == NULL) { fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! inner pointer is NULL.\n"); } if (outer == NULL) { fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! outer pointer is NULL.\n"); } if (stops == NULL) { fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! stops pointer is NULL.\n"); } if (colors == NULL) { fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! colors pointer is NULL.\n"); } #endif /* #ifdef DEBUG */ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, sizeof(XRenderPictureAttributes_)); XRadialGradient radialGradient; radialGradient.inner.x = (XFixed) inner -> x; radialGradient.inner.y = (XFixed) inner -> y; radialGradient.inner.radius = (XFixed) innerRadius; radialGradient.outer.x = (XFixed) outer -> x; radialGradient.outer.y = (XFixed) outer -> y; radialGradient.outer.radius = (XFixed) outerRadius; Picture id = XRenderCreateRadialGradient(nxagentDisplay, &radialGradient, (XFixed *) stops, (XRenderColor *) colors, nStops); #ifdef DEBUG XSync(nxagentDisplay, 0); #endif #ifdef TEST fprintf(stderr, "nxagentRenderCreateRadialGradient: Created radial gradient xid [%lu].\n", id); #endif nxagentPicturePriv(pPicture) -> picture = id; } void nxagentRenderCreateConicalGradient(PicturePtr pPicture, xPointFixed *center, xFixed angle, int nStops, xFixed *stops, xRenderColor *colors) { if (nxagentRenderEnable == False) { return; } #ifdef DEBUG fprintf(stderr, "nxagentRenderCreateConicalGradient: Got called.\n"); if (pPicture == NULL) { fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! pPicture pointer is NULL.\n"); } if (center == NULL) { fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! center pointer is NULL.\n"); } if (stops == NULL) { fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! stops pointer is NULL.\n"); } if (colors == NULL) { fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! colors pointer is NULL.\n"); } #endif /* #ifdef DEBUG */ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, sizeof(XRenderPictureAttributes_)); XConicalGradient conicalGradient; conicalGradient.center.x = (XFixed) center -> x; conicalGradient.center.y = (XFixed) center -> y; conicalGradient.angle = (XFixed) angle; Picture id = XRenderCreateConicalGradient(nxagentDisplay, &conicalGradient, (XFixed *) stops, (XRenderColor *) colors, nStops); #ifdef DEBUG XSync(nxagentDisplay, 0); #endif #ifdef TEST fprintf(stderr, "nxagentRenderCreateConicalGradient: Created conical gradient xid [%lu].\n", id); #endif nxagentPicturePriv(pPicture) -> picture = id; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Render.h0000644000000000000000000001061113614532331020244 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Render_H__ #define __Render_H__ #include "screenint.h" #include "cursor.h" #include "picture.h" #include "renderproto.h" #include "glyphstr.h" #include "Agent.h" extern int nxagentRenderEnable; extern int nxagentRenderVersionMajor; extern int nxagentRenderVersionMinor; extern int nxagentPicturePrivateIndex; extern BoxPtr nxagentGlyphsExtents; extern BoxPtr nxagentTrapezoidExtents; /* * Structure imported from Xrender.h. We don't * include Xrender.h at this point because of * clashes of definition. */ /* * Xlib Pixmap and Atom types are 8 bytes long * on 64-bit archs, whilst they are 4 bytes long * on 32-bit ones. At this point, Pixmap and Atom * are not Xlib types but Xserver ones: here they * are always 4 bytes long. So that we use XlibID * symbols defined below to fill the structure with * fields having the right size. */ typedef struct { int repeat; Picture alpha_map; int alpha_x_origin; int alpha_y_origin; int clip_x_origin; int clip_y_origin; XlibPixmap clip_mask; Bool graphics_exposures; int subwindow_mode; int poly_edge; int poly_mode; XlibAtom dither; Bool component_alpha; } XRenderPictureAttributes_; typedef struct { Picture picture; XRenderPictureAttributes_ lastServerValues; } nxagentPrivPictureRec; typedef nxagentPrivPictureRec *nxagentPrivPicturePtr; #define nxagentPicturePriv(pPicture) \ ((nxagentPrivPicturePtr) ((pPicture) -> devPrivates[nxagentPicturePrivateIndex].ptr)) #define nxagentPicture(pPicture) (nxagentPicturePriv(pPicture) -> picture) #define nxagentSetPictureRemoteValue(pPicture, pvalue, value) \ do \ { \ nxagentPicturePriv(pPicture) -> lastServerValues.pvalue = value; \ } \ while (0) #define nxagentCheckPictureRemoteValue(pPicture, pvalue, value) \ (nxagentPicturePriv(pPicture) -> lastServerValues.pvalue == value) void nxagentRenderExtensionInit(void); Bool nxagentPictureInit(ScreenPtr, PictFormatPtr, int); void nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, int nglyphs, CARD8 *images, int sizeImages); void nxagentReconnectPicture(void * p0, XID x1, void *p2); void nxagentDisconnectPicture(void * p0, XID x1, void* p2); void nxagentReconnectGlyphSet(void* p0, XID x1, void *p2); void nxagentDestroyPicture(PicturePtr pPicture); #endif /* __Render_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Rootless.c0000644000000000000000000010022013614532331020626 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "X.h" #include "../../include/window.h" #include "windowstr.h" #include "colormapst.h" #include "scrnintstr.h" #include "propertyst.h" #include "Agent.h" #include "Display.h" #include "Drawable.h" #include "Windows.h" #include "Pixmaps.h" #include "Atoms.h" #include "Trap.h" #include "Utils.h" #include "compext/Compext.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG /* * Assigned at the time the root window is initialized. */ typedef struct { CARD32 flags; CARD32 input; CARD32 initial_state; CARD32 icon_pixmap; CARD32 icon_window; INT32 icon_x; INT32 icon_y; CARD32 icon_mask; CARD32 window_group; } nxagentWMHints; /* * This structure is compatible with 32 and 64 bit library * interface. It has been copied from Xatomtype.h and it's a parameter * of XChangeProperty(). */ typedef struct { unsigned long flags; long input; long initialState; unsigned long iconPixmap; unsigned long iconWindow; long iconX; long iconY; unsigned long iconMask; unsigned long windowGroup; } nxagentPropWMHints; WindowPtr nxagentRootlessWindow = NULL; #define TOP_LEVEL_TABLE_UNIT 100 typedef struct { Window xid; WindowPtr pWin; } TopLevelParentRec; typedef struct { TopLevelParentRec *elt; int next; int size; } TopLevelParentMap; static TopLevelParentMap topLevelParentMap = { NULL, 0, 0 }; static void nxagentRemovePropertyFromList(void); #if 0 /* * This is currently unused. */ #ifdef TEST static void nxagentPrintRootlessTopLevelWindowMap(void); void nxagentPrintRootlessTopLevelWindowMap(void) { fprintf(stderr, "%s: Map size is [%d] num of entry [%d].\n", __func__, topLevelParentMap.size, topLevelParentMap.next); for (int i = 0; i < topLevelParentMap.next; i++) { fprintf(stderr, "%s:: [%d] pWin at [%p] XID at [%ld].\n", __func__, i, (void *) topLevelParentMap.elt[i].pWin, (long int) topLevelParentMap.elt[i].xid); } } #endif #endif void nxagentRootlessAddTopLevelWindow(WindowPtr pWin, Window w) { for (int i = 0; i < topLevelParentMap.next; i++) { if (topLevelParentMap.elt[i].pWin == pWin) { #ifdef TEST fprintf(stderr, "%s: WARNING! Trying to add duplicated entry window at [%p] xid [%d].\n", __func__, (void *) pWin, w); #endif topLevelParentMap.elt[i].xid = w; return; } } if (topLevelParentMap.next == topLevelParentMap.size) { TopLevelParentRec *ptr = topLevelParentMap.elt; size_t size = (topLevelParentMap.size += TOP_LEVEL_TABLE_UNIT); ptr = realloc(ptr, size * sizeof(TopLevelParentRec)); if (ptr == NULL) { #ifdef WARNING fprintf(stderr, "%s: Warning failed to allocate memory.\n", __func__); #endif return; } topLevelParentMap.elt = ptr; topLevelParentMap.size = size; } topLevelParentMap.elt[topLevelParentMap.next].xid = w; topLevelParentMap.elt[topLevelParentMap.next].pWin = pWin; topLevelParentMap.next++; } WindowPtr nxagentRootlessTopLevelWindow(Window w) { for (int i = 0; i < topLevelParentMap.next; i++) { if (w == topLevelParentMap.elt[i].xid) { return topLevelParentMap.elt[i].pWin; } } return NULL; } void nxagentRootlessDelTopLevelWindow(WindowPtr pWin) { for (int i = 0; i < topLevelParentMap.next; i++) { if (pWin == topLevelParentMap.elt[i].pWin) { topLevelParentMap.elt[i] = topLevelParentMap.elt[topLevelParentMap.next - 1]; topLevelParentMap.next--; return; } } } void nxagentConfigureRootlessWindow(WindowPtr pWin, int x, int y, int w, int h, int bw, WindowPtr pSib, int stack_mode, Mask mask) { XWindowChanges changes = { .x = x, .y = y, .width = w, .height = h, .border_width = bw, .stack_mode = stack_mode }; if (pSib) { changes.sibling = nxagentWindow(pSib); } XConfigureWindow(nxagentDisplay, nxagentWindow(pWin), mask, &changes); } void nxagentCirculateRootlessWindows(int direction) { XCirculateSubwindows(nxagentDisplay, DefaultRootWindow(nxagentDisplay), direction); } #ifdef DEBUG Bool nxagentRootlessTreesMatch(void) { XlibWindow root_return; XlibWindow parent_return; XlibWindow *children_return = NULL; unsigned int nChildrenReturn; WindowPtr pTestWin = screenInfo.screens[0]->root -> firstChild; Bool treesMatch = True; Status result = XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), &root_return, &parent_return, &children_return, &nChildrenReturn); if (!result) { #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed QueryTree request.\n", __func__); #endif return False; } while (nChildrenReturn > 0) { WindowPtr pW = nxagentWindowPtr(children_return[--nChildrenReturn]); if (!pW) { pW = nxagentRootlessTopLevelWindow(children_return[nChildrenReturn]); } if (pW && pW != screenInfo.screens[0]->root) { if (treesMatch && pTestWin && pTestWin == pW) { pTestWin = pTestWin -> nextSib; } else { treesMatch = False; } } } SAFE_XFree(children_return); return treesMatch; } #endif #ifndef _XSERVER64 void nxagentRootlessRestack(Window children[], unsigned int nchildren) #else void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren) #endif { WindowPtr *toplevel = malloc(sizeof(WindowPtr) * nchildren); if (!toplevel) { /* FIXME: Is this too much and we should simply return here? */ FatalError("nxagentRootlessRestack: malloc() failed."); } unsigned int ntoplevel = 0; for(int i = 0; i < nchildren; i++) { WindowPtr pWin = nxagentWindowPtr(children[i]); if (!pWin) { pWin = nxagentRootlessTopLevelWindow(children[i]); } if (pWin && pWin != screenInfo.screens[0]->root) { toplevel[ntoplevel++] = pWin; } } if (!ntoplevel) { SAFE_free(toplevel); return; } #ifdef DEBUG fprintf(stderr, "%s: External top level windows before restack:\n", __func__); for (int i = 0; i < ntoplevel; i++) { fprintf(stderr, "%s: [%p]\n", __func__, (void *)toplevel[i]); } fprintf(stderr, "%s: Internal top level windows before restack:\n", __func__); for (WindowPtr pWin = screenInfo.screens[0]->root -> firstChild; pWin != NULL; pWin = pWin -> nextSib) { fprintf(stderr, "%s: [%p]\n", __func__, (void *)pWin); } #endif WindowPtr pWin = screenInfo.screens[0]->root -> firstChild; for (int i = ntoplevel; i-- && pWin; pWin = toplevel[i] -> nextSib) { XID values[2] = {0, (XID) Above}; if (toplevel[i] != pWin) { Mask mask = CWSibling | CWStackMode; values[0] = pWin -> drawable.id; ClientPtr pClient = wClient(toplevel[i]); nxagentScreenTrap = 1; ConfigureWindow(toplevel[i], mask, (XID *) values, pClient); nxagentScreenTrap = 0; #ifdef TEST fprintf(stderr, "%s: Restacked window [%p].\n", __func__, (void*) toplevel[i]); #endif } } #ifdef DEBUG fprintf(stderr, "%s: External top level windows after restack:\n", __func__); for (int i = 0; i < ntoplevel; i++) { fprintf(stderr, "%s: [%p]\n", __func__, (void *)toplevel[i]); } fprintf(stderr, "%s: Internal top level windows after restack:\n", __func__); for (pWin = screenInfo.screens[0]->root -> firstChild; pWin != NULL; pWin = pWin -> nextSib) { fprintf(stderr, "%s: [%p]\n", __func__, (void *)pWin); } #endif SAFE_free(toplevel); return; } /* * Determine if window is a top-level window. */ Window nxagentRootlessWindowParent(WindowPtr pWin) { #ifdef TEST fprintf(stderr, "%s: Called for window at [%p][%d] with parent [%p][%d].\n", __func__, (void *) pWin, nxagentWindowPriv(pWin)->window, (void *) pWin->parent, (pWin->parent ? nxagentWindowPriv(pWin->parent)->window : 0)); #endif if (pWin -> parent == NULL) { return DefaultRootWindow(nxagentDisplay); } else if (pWin -> parent == nxagentRootlessWindow) { return DefaultRootWindow(nxagentDisplay); } else { return nxagentWindow(pWin -> parent); } } int nxagentExportAllProperty(WindowPtr pWin) { int total = 0; for (PropertyPtr pProp = wUserProps(pWin); pProp; pProp = pProp->next) { total += nxagentExportProperty(pWin, pProp->propertyName, pProp->type, pProp->format, PropModeReplace, pProp->size, pProp->data); } return total; } int nxagentExportProperty(WindowPtr pWin, Atom property, Atom type, int format, int mode, unsigned long nUnits, void *value) { char *output = NULL; Bool export = False; Bool freeMem = False; if (NXDisplayError(nxagentDisplay) == 1) { return 0; } const char *propertyS = NameForAtom(property); const char *typeS = NameForAtom(type); if (strncmp(propertyS, "WM_", 3) != 0 && strncmp(propertyS, "_NET_", 5) != 0 && strcmp(propertyS, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR") != 0) { #ifdef TEST fprintf(stderr, "%s: WARNING! Ignored ChangeProperty on %swindow [0x%x] property [%s] " "type [%s] nUnits [%ld] format [%d]\n", __func__, nxagentWindowTopLevel(pWin) ? "toplevel " : "", nxagentWindow(pWin), validateString(propertyS), validateString(typeS), nUnits, format); #endif } else if (strcmp(typeS, "STRING") == 0 || #ifndef _XSERVER64 strcmp(typeS, "CARDINAL") == 0 || strcmp(typeS, "WM_SIZE_HINTS") == 0 || #endif strcmp(typeS, "UTF8_STRING") == 0) { output = value; export = True; } #ifdef _XSERVER64 else if (strcmp(typeS, "CARDINAL") == 0 || strcmp(typeS, "WM_SIZE_HINTS") == 0) { unsigned long *buffer = malloc(nUnits * sizeof(*buffer)); if (buffer == NULL) { FatalError("%s: malloc() failed.", __func__); } int *input = value; if (buffer) { freeMem = True; export = True; output = (char*) buffer; for (int i = 0; i < nUnits; i++) { buffer[i] = input[i]; } } } #endif else if (strcmp(typeS, "WM_HINTS") == 0) { ClientPtr pClient = wClient(pWin); nxagentWMHints wmHints = *(nxagentWMHints*)value; wmHints.flags |= InputHint; wmHints.input = True; /* * Initialize the structure used in XChangeProperty(). */ nxagentPropWMHints propHints = { .flags = wmHints.flags, .input = (wmHints.input == True ? 1 : 0), .initialState = wmHints.initial_state, .iconPixmap = wmHints.icon_pixmap, .iconWindow = wmHints.icon_window, .iconX = wmHints.icon_x, .iconY = wmHints.icon_y, .iconMask = wmHints.icon_mask, .windowGroup = wmHints.window_group }; output = (char*) &propHints; export = True; if ((wmHints.flags & IconPixmapHint) && (wmHints.icon_pixmap != None)) { PixmapPtr icon = (PixmapPtr)SecurityLookupIDByType(pClient, wmHints.icon_pixmap, RT_PIXMAP, DixDestroyAccess); if (icon) { if (nxagentDrawableStatus((DrawablePtr) icon) == NotSynchronized) { nxagentSynchronizeRegion((DrawablePtr) icon, NullRegion, NEVER_BREAK, NULL); } propHints.iconPixmap = nxagentPixmap(icon); } else { propHints.flags &= ~IconPixmapHint; #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed to look up icon pixmap [0x%x] from hint " "exporting property [%s] type [%s] on window [%p].\n", __func__, (unsigned int) wmHints.icon_pixmap, propertyS, typeS, (void *) pWin); #endif } } if ((wmHints.flags & IconWindowHint) && (wmHints.icon_window != None)) { WindowPtr icon = (WindowPtr)SecurityLookupWindow(wmHints.icon_window, pClient, DixDestroyAccess); if (icon) { propHints.iconWindow = nxagentWindow(icon); } else { propHints.flags &= ~IconWindowHint; #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed to look up icon window [0x%x] from hint " "exporting property [%s] type [%s] on window [%p].\n", __func__, (unsigned int) wmHints.icon_window, propertyS, typeS, (void *) pWin); #endif } } if ((wmHints.flags & IconMaskHint) && (wmHints.icon_mask != None)) { PixmapPtr icon = (PixmapPtr)SecurityLookupIDByType(pClient, wmHints.icon_mask, RT_PIXMAP, DixDestroyAccess); if (icon) { propHints.iconMask = nxagentPixmap(icon); } else { propHints.flags &= ~IconMaskHint; #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed to look up icon mask [0x%x] from hint " "exporting property [%s] type [%s] on window [%p].\n", __func__, (unsigned int) wmHints.icon_mask, propertyS, typeS, (void *) pWin); #endif } } if ((wmHints.flags & WindowGroupHint) && (wmHints.window_group != None)) { WindowPtr window = (WindowPtr)SecurityLookupWindow(wmHints.window_group, pClient, DixDestroyAccess); if (window) { propHints.windowGroup = nxagentWindow(window); } else { propHints.flags &= ~WindowGroupHint; #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed to look up window group [0x%x] from hint " "exporting property [%s] type [%s] on window [%p].\n", __func__, (unsigned int) wmHints.window_group, propertyS, typeS, (void *) pWin); #endif } } } else if (strcmp(typeS, "ATOM") == 0) { XlibAtom *atoms = malloc(nUnits * sizeof(*atoms)); Atom *input = value; const char *atomName = NULL; int j = 0; if (!atoms) { #ifdef WARNING fprintf(stderr, "%s: WARNING! malloc() failed for '[%s]'- bailing out.\n", __func__, typeS); #endif return False; } freeMem = True; export = True; output = (char *) atoms; for (int i = 0; i < nUnits; i++) { /* * Exporting the _NET_WM_PING property could result in rootless * windows being grayed out when the compiz window manager is * running. * * Better solution would probably be to handle the communication * with the window manager instead of just getting rid of the * property. */ if ((atomName = NameForAtom(input[i])) != NULL && strcmp(atomName, "_NET_WM_PING") != 0) { atoms[j] = nxagentLocalToRemoteAtom(input[i]); if (atoms[j] == None) { #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed to convert local atom [%ld] [%s].\n", __func__, (long int) input[i], validateString(atomName)); #endif } j++; } #ifdef TEST else { fprintf(stderr, "%s: WARNING! " "Not exporting the _NET_WM_PING property.\n", __func__); } #endif } nUnits = j; } else if (strcmp(typeS, "WINDOW") == 0) { Window *input = value; XlibWindow *wind = malloc(nUnits * sizeof(*wind)); ClientPtr pClient = wClient(pWin); if (!wind) { #ifdef WARNING fprintf(stderr, "%s: WARNING! malloc() failed for '[%s]' - bailing out.\n", __func__, typeS); #endif return False; } freeMem = True; export = True; output = (char*) wind; for (int i = 0; i < nUnits; i++) { WindowPtr pWindow = (WindowPtr)SecurityLookupWindow(input[i], pClient, DixDestroyAccess); if ((input[i] != None) && pWindow) { wind[i] = nxagentWindow(pWindow); } else { #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed to look up window [%ld] " "exporting property [%s] type [%s] on window [%p].\n", __func__, (long int) input[i], propertyS, typeS, (void *) pWin); #endif /* * It seems that clients specify strange windows, perhaps are * not real windows so we can try to let them pass anyway. * * wind[i] = None; */ } } } if (export) { XlibAtom propertyX = nxagentLocalToRemoteAtom(property); XlibAtom typeX = nxagentLocalToRemoteAtom(type); if (propertyX == None || typeX == None) { #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed to convert local atom.\n", __func__); #endif export = 0; } else { #ifdef TEST fprintf(stderr, "%s: Property [%u] format [%i] units [%lu].\n", __func__, propertyX, format, nUnits); #endif if ((format >> 3) * nUnits + sizeof(xChangePropertyReq) < (MAX_REQUEST_SIZE << 2)) { XChangeProperty(nxagentDisplay, nxagentWindow(pWin), propertyX, typeX, format, mode, (void*)output, nUnits); } else if (mode == PropModeReplace) { char * data = (char *) output; XDeleteProperty(nxagentDisplay, nxagentWindow(pWin), propertyX); while (nUnits > 0) { int n; if ((format >> 3) * nUnits + sizeof(xChangePropertyReq) < (MAX_REQUEST_SIZE << 2)) { n = nUnits; } else { n = ((MAX_REQUEST_SIZE << 2) - sizeof(xChangePropertyReq)) / (format >> 3); } XChangeProperty(nxagentDisplay, nxagentWindow(pWin), propertyX, typeX, format, PropModeAppend, (void*) data, n); nUnits -= n; data = (char *) data + n * (format >> 3); } } else { #ifdef WARNING fprintf(stderr, "%s: WARNING! Property [%lu] too long.\n", __func__, (long unsigned int)propertyX); #endif goto nxagentExportPropertyError; } nxagentAddPropertyToList(propertyX, pWin); } } else { #ifdef TEST fprintf(stderr, "%s: WARNING! Ignored ChangeProperty on %swindow [0x%x] property [%s] " "type [%s] nUnits [%ld] format [%d]\n", __func__, nxagentWindowTopLevel(pWin) ? "toplevel " : "", nxagentWindow(pWin), validateString(propertyS), validateString(typeS), nUnits, format); #endif } nxagentExportPropertyError: if (freeMem) { SAFE_free(output); } return export; } void nxagentImportProperty(Window window, XlibAtom property, XlibAtom type, int format, unsigned long nitems, unsigned long bytes_after, unsigned char *buffer) { Bool import = False; Bool freeMem = False; typedef struct { CARD32 state; Window icon; } WMState; WMState wmState; char *output = NULL; WindowPtr pWin = nxagentWindowPtr(window); if (pWin == NULL) { #ifdef TEST fprintf(stderr, "%s: Failed to look up remote window [0x%x] property [%d] exiting.\n", __func__, window, property); #endif return; } Atom propertyL = nxagentRemoteToLocalAtom(property); if (!ValidAtom(propertyL)) { #ifdef TEST fprintf(stderr, "%s: Failed to convert remote property atom.\n", __func__); #endif return; } #ifdef TEST fprintf(stderr, "%s: Window [0x%x] property [%d]: [%s]\n", __func__, window, property, validateString(NameForAtom(propertyL))); #endif /* * We settle a property size limit of 256K beyond which we simply * ignore them. */ Atom typeL = nxagentRemoteToLocalAtom(type); const char *typeS = NameForAtom(typeL); if (buffer == NULL && (nitems > 0)) { #ifdef WARNING fprintf(stderr, "%s: Failed to retrieve remote property [%ld] [%s] on Window [%ld]\n", __func__, (long int) property, validateString(NameForAtom(propertyL)), (long int) window); #endif } else if (bytes_after != 0) { #ifdef WARNING fprintf(stderr, "%s: Remote property bigger than maximum limits.\n", __func__); #endif } else if (!ValidAtom(typeL)) { #ifdef WARNING fprintf(stderr, "%s: Failed to convert remote atoms [%ld].\n", __func__, (long int) type); #endif } else if (nitems == 0) { #ifdef TEST fprintf(stderr, "%s: Importing void property.\n", __func__); #endif import = True; } else if (strcmp(typeS, "STRING") == 0 || strcmp(typeS, "UTF8_STRING") == 0 || strcmp(typeS, "CARDINAL") == 0 || strcmp(typeS, "WM_SIZE_HINTS") == 0) { output = (char*)buffer; import = True; } else if (strcmp(typeS, "WM_STATE") == 0) { /* * Contents of property of type WM_STATE are {CARD32 state, WINDOW * icon}. Only the icon field has to be modified before importing * the property. */ wmState = *(WMState*)buffer; WindowPtr pIcon = nxagentWindowPtr(wmState.icon); if (pIcon || wmState.icon == None) { import = True; output = (char*) &wmState; wmState.icon = pIcon ? nxagentWindow(pIcon) : None; } else if (wmState.icon) { #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed to convert remote window [%ld] importing property [%ld]" " of type WM_STATE", __func__, (long int) wmState.icon, (long int) property); #endif } } else if (strcmp(typeS, "WM_HINTS") == 0) { nxagentWMHints wmHints = *(nxagentWMHints*)buffer; output = (char*) &wmHints; import = True; if ((wmHints.flags & IconPixmapHint) && (wmHints.icon_pixmap != None)) { PixmapPtr icon = nxagentPixmapPtr(wmHints.icon_pixmap); if (icon) { wmHints.icon_pixmap = icon -> drawable.id; } else { wmHints.flags &= ~IconPixmapHint; #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed to look up remote icon pixmap [%d] from hint importing" " property [%ld] type [%s] on window [%p].\n", __func__, (unsigned int) wmHints.icon_pixmap, (long int) property, typeS, (void *) pWin); #endif } } if ((wmHints.flags & IconWindowHint) && (wmHints.icon_window != None)) { WindowPtr icon = nxagentWindowPtr(wmHints.icon_window); if (icon) { wmHints.icon_window = icon -> drawable.id; } else { wmHints.flags &= ~IconWindowHint; #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed to look up remote icon window [0x%x] from hint importing" " property [%ld] type [%s] on window [%p].\n", __func__, (unsigned int) wmHints.icon_window, (long int) property, typeS, (void *) pWin); #endif } } if ((wmHints.flags & IconMaskHint) && (wmHints.icon_mask != None)) { PixmapPtr icon = nxagentPixmapPtr(wmHints.icon_mask); if (icon) { wmHints.icon_mask = icon -> drawable.id; } else { wmHints.flags &= ~IconMaskHint; #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed to look up remote icon mask [0x%x] from hint importing" " property [%ld] type [%s] on window [%p].\n", __func__, (unsigned int) wmHints.icon_mask, (long int) property, typeS, (void *) pWin); #endif } } if ((wmHints.flags & WindowGroupHint) && (wmHints.window_group != None)) { WindowPtr group = nxagentWindowPtr(wmHints.window_group); if (group) { wmHints.window_group = group -> drawable.id; } else { wmHints.flags &= ~WindowGroupHint; #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed to look up remote window group [0x%x] from hint importing" " property [%ld] type [%s] on window [%p].\n", __func__, (unsigned int) wmHints.window_group, (long int) property, typeS, (void *) pWin); #endif } } } else if (strcmp(typeS, "ATOM") == 0) { Atom *atoms = malloc(nitems * sizeof(Atom)); CARD32 *input = (CARD32*) buffer; if (atoms == NULL) { #ifdef WARNING fprintf(stderr, "%s: WARNING! malloc() failed for '[%s]' - bailing out.\n", __func__, typeS); #endif return; } freeMem = True; import = True; output = (char *) atoms; for (int i = 0; i < nitems; i++) { atoms[i] = nxagentRemoteToLocalAtom((XlibAtom)input[i]); if (atoms[i] == None) { #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed to convert remote atom [%ld].\n", __func__, (long int) input[i]); #endif } } } else if (strcmp(typeS, "WINDOW") == 0) { Window *input = (Window*) buffer; Window *wind = malloc(nitems * sizeof(Window)); WindowPtr pWindow; if (!wind) { #ifdef WARNING fprintf(stderr, "%s: WARNING! malloc() failed for '[%s]' - bailing out.\n", __func__, typeS); #endif return; } freeMem = True; import = True; output = (char*) wind; for (int i = 0; i < nitems; i++) { pWindow = nxagentWindowPtr(input[i]); if (pWindow) { wind[i] = pWindow -> drawable.id; } else { #ifdef WARNING fprintf(stderr, "%s: WARNING! Failed to look up remote window [0x%lx] importing property [%ld]" " type [%s] on window [%p].\n", __func__, (long int) input[i], (long int) property, typeS, (void*)pWin); #endif wind[i] = None; } } } if (import) { #ifdef TEST fprintf(stderr, "%s: ChangeProperty on window [0x%x] property [%d] type [%s]" " nitems [%ld] format [%d]\n", __func__, window, property, typeS, nitems, format); #endif ChangeWindowProperty(pWin, propertyL, typeL, format, PropModeReplace, nitems, output, 1); } else { #ifdef TEST fprintf(stderr, "%s: WARNING! Ignored ChangeProperty on window [0x%x] property [%d] type [%s]" " ntems [%ld] format [%d]\n", __func__, window, property, validateString(typeS), nitems, format); #endif } if (freeMem) { SAFE_free(output); } return; } /* * We want to import all properties changed by external clients to * reflect properties of our internal windows but we must ignore all * the property notify events generated by our own requests. For this * purpose we implement a FIFO to record every change property request * that we dispatch. In this way, when processing a property notify, * we can distinguish between the notifications generated by our * requests from those generated by other clients connected to the * real X server. */ struct nxagentPropertyRec{ Window window; XlibAtom property; struct nxagentPropertyRec *next; }; static struct{ struct nxagentPropertyRec *first; struct nxagentPropertyRec *last; int size; } nxagentPropertyList = {NULL, NULL, 0}; /* * Removing first element from list. */ void nxagentRemovePropertyFromList(void) { struct nxagentPropertyRec *tmp = nxagentPropertyList.first; #ifdef TEST fprintf(stderr, "%s: Property [%d] on Window [0x%x] to list, list size is [%d].\n", __func__, nxagentPropertyList.first -> property, nxagentPropertyList.first -> window, nxagentPropertyList.size); #endif if (nxagentPropertyList.first) { nxagentPropertyList.first = nxagentPropertyList.first -> next; if (--nxagentPropertyList.size == 0) { nxagentPropertyList.last = NULL; } SAFE_free(tmp); } } /* * Add the record to the list. */ void nxagentAddPropertyToList(XlibAtom property, WindowPtr pWin) { if (NXDisplayError(nxagentDisplay) == 1) { return; } struct nxagentPropertyRec *tmp = malloc(sizeof(struct nxagentPropertyRec)); if (tmp == NULL) { FatalError("%s: malloc() failed.", __func__); } #ifdef TEST fprintf(stderr, "%s: Adding record Property [%d] - Window [0x%x][%p] to list, list" " size is [%d].\n", __func__, property, nxagentWindow(pWin), (void*) pWin, nxagentPropertyList.size); #endif tmp -> property = property; tmp -> window = nxagentWindow(pWin); tmp -> next = NULL; if (nxagentPropertyList.size == 0) { nxagentPropertyList.first = tmp; } else { nxagentPropertyList.last -> next = tmp; } nxagentPropertyList.last = tmp; nxagentPropertyList.size++; } void nxagentFreePropertyList(void) { while (nxagentPropertyList.size != 0) { nxagentRemovePropertyFromList(); } } /* * We are trying to distinguish notifications generated by an external * client from those genarated by our own requests. */ Bool nxagentNotifyMatchChangeProperty(void *p) { struct nxagentPropertyRec *first = nxagentPropertyList.first; XPropertyEvent *X = p; #ifdef TEST fprintf(stderr, "%s: Property notify on window [0x%lx] property [%ld].\n", __func__, X -> window, X -> atom); if (first) { fprintf(stderr, "%s: First element on list is window [0x%x] property [%d] list size is [%d].\n", __func__, first -> window, first -> property, nxagentPropertyList.size); } else { fprintf(stderr, "%s: List is empty.\n", __func__); } #endif if (first == NULL || X -> window != first -> window || X -> atom != first -> property) { return False; } nxagentRemovePropertyFromList(); return True; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Rootless.h0000644000000000000000000001003113614532331020633 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Rootless_H__ #define __Rootless_H__ #include "window.h" /* * The real X server's root window if we * are in rootless mode. */ extern WindowPtr nxagentRootlessWindow; /* * We want to import all properties changed by external clients to * reflect properties of our internal windows but we must ignore * all the property notify events generated by our own requests. * For this purpose we implement a FIFO to record every change pro- * perty request that we dispatch. In this way, when processing a * property notify, we can distinguish between the notifications * generated by our requests from those generated by other clients * connected to the real X server. */ #ifdef XlibAtom typedef struct { Window window; XlibAtom property; } PropertyRequestRec; extern PropertyRequestRec nxagentPropertyRequests[256]; #endif Window nxagentRootlessWindowParent(WindowPtr pWin); void nxagentRootlessAddTopLevelWindow(WindowPtr pWin, Window w); void nxagentRootlessDelTopLevelWindow(WindowPtr pWin); WindowPtr nxagentRootlessTopLevelWindow(Window w); #ifndef _XSERVER64 void nxagentRootlessRestack(Window *toplevel, unsigned int ntoplevel); #else void nxagentRootlessRestack(unsigned long *toplevel, unsigned int ntoplevel); #endif int nxagentExportAllProperty(WindowPtr pWin); int nxagentExportProperty(WindowPtr pWin, Atom property, Atom type, int format, int mode, unsigned long nUnits, void * value); #define MAX_RETRIEVED_PROPERTY_SIZE 256 * 1024 #ifdef XlibAtom void nxagentImportProperty(Window window, XlibAtom property, XlibAtom type, int format, unsigned long nitems, unsigned long bytes_after, unsigned char *buffer); #endif /* * Push last ChangeProperty to the list. */ #ifdef XlibAtom void nxagentAddPropertyToList(XlibAtom property, WindowPtr pWin); #endif /* * Check if a PropertyNotify match the top * of the list. */ Bool nxagentNotifyMatchChangeProperty(void *X); void nxagentConfigureRootlessWindow(WindowPtr pWin, int x, int y, int w, int h, int bw, WindowPtr pSib, int stack_mode, Mask mask); void nxagentCirculateRootlessWindows(int direction); void nxagentFreePropertyList(void); #endif /* __Rootless_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Screen.c0000644000000000000000000042026013614532331020244 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ /* * Used by the auto-disconnect feature. */ #include #include "scrnintstr.h" #include "dix.h" #include "dixstruct.h" #include "mi.h" #include "micmap.h" #include "colormapst.h" #include "resource.h" #include "mipointer.h" #include "../../fb/fb.h" #include "../../randr/randrstr.h" #include "inputstr.h" #include "mivalidate.h" #include "misc.h" #include "Agent.h" #include "Display.h" #include "Screen.h" #include "Extensions.h" #include "Atoms.h" #include "GCs.h" #include "GCOps.h" #include "Image.h" #include "Drawable.h" #include "Font.h" #include "Colormap.h" #include "Cursor.h" #include "Visual.h" #include "Events.h" #include "Init.h" #include "Args.h" #include "Client.h" #include "Options.h" #include "Splash.h" #include "Render.h" #include "Trap.h" #include "Keyboard.h" #include "Pointer.h" #include "Reconnect.h" #include "Composite.h" #include #include "Utils.h" #include #include "X11/include/Xinerama_nxagent.h" #define GC XlibGC #define Font XlibFont #define KeySym XlibKeySym #define XID XlibXID #include #undef GC #undef Font #undef KeySym #undef XID #include "Xatom.h" #include "Xproto.h" #include "compext/Compext.h" #include "mibstorest.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG #undef WATCH #undef DUMP /* * Display a pixmap on an shadow * display used for debug. */ #ifdef DUMP void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height); void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc, int width, int height, int xDst, int yDst) #endif #ifdef WATCH #include "unistd.h" #endif extern Pixmap nxagentIconPixmap; extern Pixmap nxagentIconShape; extern Bool useXpmIcon; extern Bool nxagentReportWindowIds; #ifdef NXAGENT_TIMESTAMP extern unsigned long startTime; #endif Window nxagentDefaultWindows[MAXSCREENS]; Window nxagentInputWindows[MAXSCREENS]; Window nxagentScreenSaverWindows[MAXSCREENS]; #ifdef NXAGENT_ONSTART XlibAtom nxagentReadyAtom; #endif ScreenPtr nxagentDefaultScreen = NULL; int nxagentArgc = 0; char **nxagentArgv = NULL; #ifdef NXAGENT_ARTSD char mcop_atom[] = "MCOPGLOBALS"; Atom mcop_local_atom = None; unsigned char fromHexNibble(char c); void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port); #endif Window nxagentIconWindow = None; Window nxagentFullscreenWindow = None; #ifdef VIEWPORT_FRAME WindowPtr nxagentViewportFrameLeft; WindowPtr nxagentViewportFrameRight; WindowPtr nxagentViewportFrameAbove; WindowPtr nxagentViewportFrameBelow; #endif /* #ifdef VIEWPORT_FRAME */ Bool nxagentCreateScreenResources(ScreenPtr pScreen); void nxagentPrintAgentGeometry(char *hdrMessage, char *prefix); /* * These variables are for shadowing feature. */ int nxagentShadowResize = 0; WindowPtr nxagentShadowWindowPtr = NULL; static XID accessPixmapID; static Window accessWindowID; static int imageByteOrder; static unsigned char nxagentMasterDepth; static unsigned char nxagentCheckDepth = 0; static unsigned int nxagentBppShadow; static unsigned int nxagentBppMaster; int nxagentShadowXConnectionNumber; GCPtr nxagentShadowGCPtr = NULL; PixmapPtr nxagentShadowPixmapPtr = NULL; char * nxagentShadowBuffer; unsigned char nxagentShadowDepth; int nxagentShadowWidth; int nxagentShadowHeight; Display * nxagentShadowDisplay; short nxagentShadowUid = -1; void nxagentShadowAdaptDepth(unsigned int, unsigned int, unsigned int, char **); RegionRec nxagentShadowUpdateRegion; #define NXAGENT_DEFAULT_DPI 96 #define NXAGENT_AUTO_DPI -1 #ifndef NXAGENT_RANDR_MODE_PREFIX #define NXAGENT_RANDR_MODE_PREFIX nx_ #endif extern Bool nxagentAutoDPI; extern char *nxagentKeyboard; /* * From randr/randr.c. This was originally static * but we need it here. */ int TellChanged(WindowPtr pWin, void * value); int nxagentBitsPerPixel(int depth) { if (depth == 1) return 1; else if (depth <= 8) return 8; else if (depth <= 16) return 16; else return 32; } void nxagentSetScreenInfo(ScreenInfo *scrInfo) { /* * Setup global screen info parameters. In the Xnest * server this stuff is done after having opened the * real display as Xnest lets the screen reflect the * order of the remote end. Agent will instead set * the order according to local endianness and swap * data whenever it is appropriate. * * From a standard implementation: * * scrInfo->imageByteOrder = IMAGE_BYTE_ORDER; * scrInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; * scrInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; * scrInfo->bitmapBitOrder = BITMAP_BIT_ORDER; * * From Xnest implementation: * * scrInfo -> imageByteOrder = ImageByteOrder(nxagentDisplay); * scrInfo -> bitmapScanlineUnit = BitmapUnit(nxagentDisplay); * scrInfo -> bitmapScanlinePad = BitmapPad(nxagentDisplay); * scrInfo -> bitmapBitOrder = BitmapBitOrder(nxagentDisplay); */ scrInfo -> imageByteOrder = IMAGE_BYTE_ORDER; scrInfo -> bitmapScanlinePad = BITMAP_SCANLINE_PAD; scrInfo -> bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; scrInfo -> bitmapBitOrder = BITMAP_BIT_ORDER; #ifdef TEST fprintf(stderr, "nxagentSetScreenInfo: Server image order is [%d] bitmap order is [%d].\n", scrInfo -> imageByteOrder, scrInfo -> bitmapBitOrder); fprintf(stderr, "nxagentSetScreenInfo: Server scanline unit is [%d] scanline pad is [%d].\n", scrInfo -> bitmapScanlineUnit, scrInfo -> bitmapScanlinePad); #endif } void nxagentSetPixmapFormats(ScreenInfo *scrInfo) { /* * Formats are created with no care of which are supported * on the real display. Creating only formats supported * by the remote end makes troublesome handling migration * of session from a display to another. */ scrInfo -> numPixmapFormats = nxagentNumPixmapFormats; for (int i = 0; i < nxagentNumPixmapFormats; i++) { scrInfo -> formats[i].depth = nxagentPixmapFormats[i].depth; scrInfo -> formats[i].bitsPerPixel = nxagentPixmapFormats[i].bits_per_pixel; scrInfo -> formats[i].scanlinePad = nxagentPixmapFormats[i].scanline_pad; #ifdef TEST fprintf(stderr, "nxagentSetPixmapFormats: Set format at index [%d] to depth [%d] " "bits per pixel [%d] scanline pad [%d].\n", i, scrInfo -> formats[i].depth, scrInfo -> formats[i].bitsPerPixel, scrInfo -> formats[i].scanlinePad); #endif } } /* check if possible_parent is parent of candidate */ Bool nxagentIsParentOf(Display *d, XlibWindow possible_parent, XlibWindow candidate) { XlibWindow parent, root, *children = NULL; unsigned int num_children; if (XQueryTree(d, candidate, &root, &parent, &children, &num_children)) { SAFE_XFree(children); #ifdef TEST fprintf(stderr, "%s: parent of full screen window [%p] root [%p] possible_parent [%p] candidate [%p]\n", __func__, parent, root, possible_parent, candidate); #endif return (parent == possible_parent); } else { return False; } } /* * Pressing the minimize keystroke while in fullscreen mode will call * this function. It will unmap the fullscreen window and iconify the * previously created icon window immediately. The window manager may * decide how to show an iconified window. kwin e.g. shows it in the * task bar. */ void nxagentMinimizeFromFullScreen(ScreenPtr pScreen) { XUnmapWindow(nxagentDisplay, nxagentFullscreenWindow); XIconifyWindow(nxagentDisplay, nxagentIconWindow, DefaultScreen(nxagentDisplay)); } /* * This is the opposite function to nxagentMinimizeFromFullscreen. It * will map the fullscreen window and unmap the icon window. It is * only called if fullscreen mode was active when the minimize * keystroke was pressed. * Some window managers tend to do 'interesting' things with the * icon window, which we try to counterfeit here. */ void nxagentMaximizeToFullScreen(ScreenPtr pScreen) { /* XUnmapWindow(nxagentDisplay, nxagentIconWindow); */ Window root = RootWindow(nxagentDisplay, DefaultScreen(nxagentDisplay)); /* FIXME: We'll check for ReparentNotify and LeaveNotify events after XReparentWindow() in order to avoid the session window being iconified. We could avoid the session window being iconified when a LeaveNotify event is received, so this check would be unnecessary. */ /* only reparent if necessary. FIXME: also check if the desired coordinates match */ if (!nxagentIsParentOf(nxagentDisplay, root, nxagentFullscreenWindow)) { XReparentWindow(nxagentDisplay, nxagentFullscreenWindow, root, 0, 0); for (int i = 0; i < 100 && nxagentWMIsRunning; i++) { XEvent e; #ifdef TEST fprintf(stderr, "nxagentMaximizeToFullscreen: WARNING! Going to wait for the ReparentNotify event [%d].\n", i); #endif if (XCheckTypedWindowEvent(nxagentDisplay, nxagentFullscreenWindow, ReparentNotify, &e)) { break; } XSync(nxagentDisplay, 0); nxagentWaitEvents(nxagentDisplay, 50); } } else { #ifdef TEST fprintf(stderr, "%s: FullscreenWindow already is child of root window - skipping reparenting,\n", __func__); #endif } XMapRaised(nxagentDisplay, nxagentFullscreenWindow); XIconifyWindow(nxagentDisplay, nxagentIconWindow, DefaultScreen(nxagentDisplay)); /* swallow all LeaveNotify events for the FullscreenWindow; Normally this does not swallow anything these days, but when using fvwm you see one of these events here. */ while (1) { XEvent e; if (!XCheckTypedWindowEvent(nxagentDisplay, nxagentFullscreenWindow, LeaveNotify, &e)) break; #ifdef TEST fprintf(stderr, "%s: swallowing LeaveNotify event\n", __func__); #endif } /* XMapWindow(nxagentDisplay, nxagentIconWindow); */ } Window nxagentCreateIconWindow(void) { /* * Create icon window. */ XSetWindowAttributes attributes = { .override_redirect = False, .colormap = DefaultColormap(nxagentDisplay, DefaultScreen(nxagentDisplay)), .background_pixmap = nxagentScreenSaverPixmap, }; unsigned long valuemask = CWOverrideRedirect | CWBackPixmap | CWColormap; #ifdef TEST fprintf(stderr, "nxagentCreateIconWindow: Going to create new icon window.\n"); #endif Window w = XCreateWindow(nxagentDisplay, DefaultRootWindow(nxagentDisplay), 0, 0, 1, 1, 0, DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)), InputOutput, DefaultVisual(nxagentDisplay, DefaultScreen(nxagentDisplay)), valuemask, &attributes); if (nxagentReportWindowIds) { fprintf(stderr, "NXAGENT_WINDOW_ID: ICON_WINDOW,WID:[0x%x]\n", w); } #ifdef TEST fprintf(stderr, "nxagentCreateIconWindow: Created new icon window with id [0x%x].\n", w); #endif /* * Set hints to the window manager for the icon window. */ XSizeHints* sizeHints = XAllocSizeHints(); if (sizeHints) { sizeHints->flags = PMinSize | PMaxSize; sizeHints->min_width = sizeHints->max_width = 1; sizeHints->min_height = sizeHints->max_height = 1; } XWMHints* wmHints = XAllocWMHints();; if (wmHints) { wmHints->flags = StateHint | IconPixmapHint; wmHints->initial_state = IconicState; wmHints->icon_pixmap = nxagentIconPixmap; if (useXpmIcon) { wmHints->flags |= IconMaskHint; wmHints->icon_mask = nxagentIconShape; } } Xutf8SetWMProperties(nxagentDisplay, w, nxagentWindowName, nxagentWindowName, NULL , 0 , sizeHints, wmHints, NULL); SAFE_XFree(sizeHints); SAFE_XFree(wmHints); /* * Enable events from the icon window. */ Mask mask = nxagentGetDefaultEventMask(); XSelectInput(nxagentDisplay, w, (mask & ~(KeyPressMask | KeyReleaseMask)) | StructureNotifyMask); /* * Notify to client if user closes icon window. */ if (nxagentWMIsRunning && !nxagentOption(Rootless)) { XlibAtom deleteWMAtom = nxagentAtoms[2]; /* WM_DELETE_WINDOW */ XSetWMProtocols(nxagentDisplay, w, &deleteWMAtom, 1); } return w; } Bool nxagentMagicPixelZone(int x, int y) { return (x >= nxagentOption(Width) - 1 && y < 1); } void nxagentSetScreenSaverTime(void) { #ifdef TEST fprintf(stderr, "nxagentSetScreenSaverTime: ScreenSaverTime was [%lu], ScreenSaverInterval was [%lu].\n", (long unsigned int)ScreenSaverTime, (long unsigned int)ScreenSaverInterval); #endif /* * More than one timeout could be used here, * to make use of screen-saver handler not * only for the timeout feature. In a case * like this, the lower timeout have to be * used as ScreenSaverTime. */ if (nxagentAutoDisconnectTimeout > 0) { ScreenSaverTime = nxagentAutoDisconnectTimeout; } ScreenSaverInterval = ScreenSaverTime; #ifdef TEST fprintf(stderr, "nxagentSetScreenSaverTime: ScreenSaverTime now is [%lu], ScreenSaverInterval now is [%lu].\n", (long unsigned int)ScreenSaverTime, (long unsigned int)ScreenSaverInterval); #endif } static Bool nxagentSaveScreen(ScreenPtr pScreen, int what) { #ifdef TEST fprintf(stderr, "nxagentSaveScreen: Called for screen at [%p] with parameter [%d].\n", (void *) pScreen, what); fprintf(stderr, "nxagentSaveScreen: SCREEN_SAVER_ON is [%d] SCREEN_SAVER_OFF is [%d] " "SCREEN_SAVER_FORCER is [%d] SCREEN_SAVER_CYCLE is [%d].\n", SCREEN_SAVER_ON, SCREEN_SAVER_OFF, SCREEN_SAVER_FORCER, SCREEN_SAVER_CYCLE); #endif /* * We need only to reset the timeouts * in this case. */ if (what == SCREEN_SAVER_OFF) { nxagentAutoDisconnectTimeout = nxagentOption(Timeout) * MILLI_PER_SECOND; return 1; } /* * The lastDeviceEventTime is updated every time * a device event is received, and it is used by * WaitForSomething() to know when the SaveScreens() * function should be called. This solution doesn't * take care of a pointer button not released, so * we have to handle this case by ourselves. */ /* FIXME: Do we need to check the key grab if the autorepeat feature is disabled? */ if (inputInfo.pointer -> button -> buttonsDown > 0) { #ifdef TEST fprintf(stderr, "nxagentSaveScreen: Ignoring timeout, there is a pointer button down.\n"); #endif /* * Returning 0 the SaveScreens() function * (which calls this one) tries to build * a screen-saver creating a new window. * We don't want this, so we return 1 in * any case. */ return 1; } /* * Handling the auto-disconnect feature. * If there is any client attached and the persisten- * ce is allowed then leave the session running, else * terminate it. It should use something less brutal, * though raising a signal should ensure that the code * follows the usual execution path. */ if (nxagentOption(Timeout) > 0) { #ifdef TEST fprintf(stderr, "nxagentSaveScreen: Auto-disconnect timeout was [%d].\n", nxagentAutoDisconnectTimeout); #endif nxagentAutoDisconnectTimeout -= ScreenSaverTime; #ifdef TEST fprintf(stderr, "nxagentSaveScreen: Auto-disconnect timeout is [%d].\n", nxagentAutoDisconnectTimeout); #endif if (nxagentSessionState == SESSION_UP && nxagentAutoDisconnectTimeout <= 0) { nxagentAutoDisconnectTimeout = nxagentOption(Timeout) * MILLI_PER_SECOND; if (nxagentClients == 0) { fprintf(stderr, "Info: Terminating session with no client running.\n"); raise(SIGTERM); } else if (nxagentOption(Persistent) == 0) { fprintf(stderr, "Info: Terminating session with persistence not allowed.\n"); raise(SIGTERM); } else { fprintf(stderr, "Info: Suspending session with %d clients running.\n", nxagentClients); raise(SIGHUP); } } } return 1; } Bool nxagentCreateScreenResources(ScreenPtr pScreen) { CreatePixmapProcPtr savedCreatePixmap = pScreen->CreatePixmap; ModifyPixmapHeaderProcPtr savedModifyPixmapHeader = pScreen->ModifyPixmapHeader; pScreen->CreatePixmap = fbCreatePixmap; pScreen->ModifyPixmapHeader = miModifyPixmapHeader; Bool ret = miCreateScreenResources(pScreen); pScreen->CreatePixmap = savedCreatePixmap; pScreen->ModifyPixmapHeader = savedModifyPixmapHeader; return ret; } static Bool nxagentCursorOffScreen(ScreenPtr *pPtrScreen, int *x, int *y) { return False; } static void nxagentCrossScreen(ScreenPtr pScreen, Bool entering) { } static miPointerScreenFuncRec nxagentPointerCursorFuncs = { nxagentCursorOffScreen, nxagentCrossScreen, miPointerWarpCursor }; #ifdef VIEWPORT_FRAME void nxagentInitViewportFrame(ScreenPtr pScreen, WindowPtr pRootWin) { int error = Success; VisualID visual = 0; XID xid; if (nxagentOption(Rootless)) { return; } for (int i = 0; i < pScreen -> numDepths; i++) { if (pScreen -> allowedDepths[i].depth == pRootWin -> drawable.depth) { visual = pScreen -> allowedDepths[i].vids[0]; break; } } /* * It is not necessary create the windows on the real X server. But this * windows are not visible. Create them it is not a great effort, and avoids * many errors. * * nxagentScreenTrap = True; */ xid = FakeClientID(serverClient -> index); #ifdef TEST fprintf(stderr, "nxagentInitViewportFrame: XID = [%lx]\n", xid); #endif nxagentViewportFrameLeft = CreateWindow(xid, pRootWin, -NXAGENT_FRAME_WIDTH, 0, NXAGENT_FRAME_WIDTH, pRootWin -> drawable.height, 0, InputOutput, 0, NULL, pRootWin -> drawable.depth, serverClient, visual, &error); AddResource(xid, RT_WINDOW, (void *) nxagentViewportFrameLeft); if (error != Success) { #ifdef WARNING fprintf(stderr, "nxagentInitViewportFrame: Error creating nxagentViewportFrameLeft.\n"); #endif error = Success; } xid = FakeClientID(serverClient -> index); #ifdef TEST fprintf(stderr, "nxagentInitViewportFrame: XID = [%lx]\n", xid); #endif nxagentViewportFrameRight = CreateWindow(xid, pRootWin, pRootWin -> drawable.width, 0, NXAGENT_FRAME_WIDTH, pRootWin -> drawable.height, 0, InputOutput, 0, NULL, pRootWin -> drawable.depth, serverClient, visual, &error); AddResource(xid, RT_WINDOW, (void *) nxagentViewportFrameRight); if (error != Success) { #ifdef WARNING fprintf(stderr, "nxagentInitViewportFrame: Error creating nxagentViewportFrameRight.\n"); #endif error = Success; } xid = FakeClientID(serverClient -> index); #ifdef TEST fprintf(stderr, "nxagentInitViewportFrame: XID = [%lx]\n", xid); #endif nxagentViewportFrameAbove = CreateWindow(xid, pRootWin, 0, -NXAGENT_FRAME_WIDTH, pRootWin -> drawable.width, NXAGENT_FRAME_WIDTH, 0, InputOutput, 0, NULL, pRootWin -> drawable.depth, serverClient, visual, &error); AddResource(xid, RT_WINDOW, (void *) nxagentViewportFrameAbove); if (error != Success) { #ifdef WARNING fprintf(stderr, "nxagentInitViewportFrame: Error creating nxagentViewportFrameAbove.\n"); #endif error = Success; } xid = FakeClientID(serverClient -> index); #ifdef TEST fprintf(stderr, "nxagentInitViewportFrame: XID = [%lx]\n", xid); #endif nxagentViewportFrameBelow = CreateWindow(xid, pRootWin, 0, pRootWin -> drawable.height, pRootWin -> drawable.width, NXAGENT_FRAME_WIDTH, 0, InputOutput, 0, NULL, pRootWin -> drawable.depth, serverClient, visual, &error); AddResource(xid, RT_WINDOW, (void *) nxagentViewportFrameBelow); if (error != Success) { #ifdef WARNING fprintf(stderr, "nxagentInitViewportFrame: Error creating nxagentViewportFrameBelow.\n"); #endif } nxagentViewportFrameLeft -> overrideRedirect = 1; nxagentViewportFrameRight -> overrideRedirect = 1; nxagentViewportFrameAbove -> overrideRedirect = 1; nxagentViewportFrameBelow -> overrideRedirect = 1; MapWindow(nxagentViewportFrameLeft, serverClient); MapWindow(nxagentViewportFrameRight, serverClient); MapWindow(nxagentViewportFrameAbove, serverClient); MapWindow(nxagentViewportFrameBelow, serverClient); /* * nxagentScreenTrap = False; */ } #endif /* #ifdef VIEWPORT_FRAME */ void nxagentPrintAgentGeometry(char *hdrMessage, char *prefix) { #ifdef WARNING if (prefix == NULL) { prefix = ""; } if (hdrMessage) { fprintf(stderr, "--------------- %s -----------------.\n", hdrMessage); } fprintf(stderr, "%s Root window at offset (%d,%d) size (%d,%d).\n", prefix, nxagentOption(RootX), nxagentOption(RootY), nxagentOption(RootWidth), nxagentOption(RootHeight)); fprintf(stderr, "%s Default window at offset (%d,%d) size (%d,%d) border size %d.\n", prefix, nxagentOption(X), nxagentOption(Y), nxagentOption(Width), nxagentOption(Height), nxagentOption(BorderWidth)); fprintf(stderr, "%s Span between root window and default window is (%d,%d).\n", prefix, nxagentOption(ViewportXSpan), nxagentOption(ViewportYSpan)); fprintf(stderr, "%s Default window in window mode has offset (%d,%d) and size (%d,%d).\n", prefix, nxagentOption(SavedX), nxagentOption(SavedY), nxagentOption(SavedWidth), nxagentOption(SavedHeight)); fprintf(stderr, "%s Fullscreen is %s.\n", prefix, nxagentOption(Fullscreen) ? "ON" : "OFF"); fprintf(stderr, "%s Desktop resize mode is %s.\n", prefix, nxagentOption(DesktopResize) ? "ON" : "OFF"); fprintf(stderr, "%s Resize desktop at startup is %s.\n", prefix, nxagentResizeDesktopAtStartup ? "ON" : "OFF"); #endif } static int nxagentColorOffset(unsigned long mask) { int count; for (count = 0; !(mask & 1) && count < 32; count++) { mask >>= 1; } return count; } void freeDepths(DepthPtr depths, int num) { for (int i = 0; i < num; i++) { #ifdef DEBUG fprintf(stderr, "%s: freeing depth [%d] index [%d] vids [%p]\n", __func__, depths[i].depth, i, (void*) depths[i].vids); #endif SAFE_free(depths[i].vids); } SAFE_free(depths); } Bool nxagentOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) { VisualPtr visuals; DepthPtr depths; int numVisuals, numDepths; int depthIndex; unsigned long valuemask; XSetWindowAttributes attributes; XWindowAttributes gattributes; Mask mask; Bool resetAgentPosition = False; VisualID defaultVisual; int rootDepth; void * pFrameBufferBits; int bitsPerPixel; int sizeInBytes; int defaultVisualIndex = 0; #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Called for screen index [%d].\n", pScreen->myNum); #endif if (nxagentRenderEnable && nxagentReconnectTrap == False) { PictureScreenPrivateIndex = -1; } nxagentDefaultScreen = pScreen; nxagentQueryAtoms(pScreen); #ifdef NXAGENT_ONSTART nxagentReadyAtom = nxagentAtoms[3]; /* WM_NX_READY */ #endif /* * Force geometry parameter to user geometry except if in rootless mode. */ if (nxagentResizeDesktopAtStartup && !nxagentOption(Rootless)) { if (nxagentUserGeometry.flag & XValue) { nxagentChangeOption(X, nxagentUserGeometry.X); } if (nxagentUserGeometry.flag & YValue) { nxagentChangeOption(Y, nxagentUserGeometry.Y); } if (nxagentUserGeometry.flag & WidthValue) { int uw = nxagentUserGeometry.Width; nxagentChangeOption(Width, uw); nxagentChangeOption(RootWidth, uw); nxagentChangeOption(SavedWidth, min(nxagentOption(SavedWidth), uw)); } if (nxagentUserGeometry.flag & HeightValue) { int uh = nxagentUserGeometry.Height; nxagentChangeOption(Height, uh); nxagentChangeOption(RootHeight, uh); nxagentChangeOption(SavedHeight, min(nxagentOption(SavedHeight), uh)); } } /* * This is first time the screen is initialized. * Filling the geometry parameter from user geometry. * we do not need this in rootless mode since we ignore * user geometry then. */ if (nxagentReconnectTrap == False && !nxagentOption(Rootless)) { if (nxagentUserGeometry.flag & XValue) { nxagentChangeOption(X, nxagentUserGeometry.X); } if (nxagentUserGeometry.flag & YValue) { nxagentChangeOption(Y, nxagentUserGeometry.Y); } if (nxagentUserGeometry.flag & WidthValue) { nxagentChangeOption(RootWidth, nxagentUserGeometry.Width); } if (nxagentUserGeometry.flag & HeightValue) { nxagentChangeOption(RootHeight, nxagentUserGeometry.Height); } } else if (nxagentWMIsRunning && !nxagentOption(Rootless) && !nxagentOption(Fullscreen)) { /* * At reconnection, try to estimate the shift due to WM reparenting. */ if (nxagentOption(X) >= 6) { nxagentChangeOption(X, nxagentOption(X) - 6); } if (nxagentOption(Y) >= 25) { nxagentChangeOption(Y, nxagentOption(Y) - 25); } } /* * Determine the size of the root window. It is the maximum size of * the screen if we are either in rootless or in fullscreen mode. */ if (nxagentOption(Rootless) == False && !nxagentWMIsRunning) { #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Forcing fullscreen mode with no window manager running.\n"); #endif nxagentChangeOption(Fullscreen, True); if (nxagentOption(ClientOs) == ClientOsWinnt && (nxagentReconnectTrap == False || nxagentResizeDesktopAtStartup)) { NXSetExposeParameters(nxagentDisplay, 0, 0, 0); } } if (nxagentOption(Fullscreen) && nxagentWMIsRunning && nxagentReconnectTrap && nxagentResizeDesktopAtStartup == False && nxagentXServerGeometryChanged()) { #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Forcing window mode with server geometry changed.\n"); #endif nxagentChangeOption(Fullscreen, False); nxagentChangeOption(AllScreens, False); nxagentFullscreenWindow = 0; resetAgentPosition = True; } nxagentChangeOption(BorderWidth, 0); /* get the screen size of the real X server once */ int w = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); int h = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); if (nxagentOption(Fullscreen)) { nxagentChangeOption(X, 0); nxagentChangeOption(Y, 0); nxagentChangeOption(Width, w); nxagentChangeOption(Height, h); /* first time screen initialization or resize during reconnect */ if (nxagentReconnectTrap == False || nxagentResizeDesktopAtStartup) { if (nxagentOption(RootWidth) >= w) { nxagentChangeOption(SavedWidth, w * 3 / 4); } else { nxagentChangeOption(SavedWidth, nxagentOption(RootWidth)); } if (nxagentOption(RootHeight) >= h) { nxagentChangeOption(SavedHeight, h * 3 / 4); } else { nxagentChangeOption(SavedHeight, nxagentOption(RootHeight)); } nxagentChangeOption(RootWidth, w); nxagentChangeOption(RootHeight, h); nxagentChangeOption(RootX, 0); nxagentChangeOption(RootY, 0); } else { /* center */ nxagentChangeOption(RootX, (w - nxagentOption(RootWidth)) / 2); nxagentChangeOption(RootY, (h - nxagentOption(RootHeight)) / 2); } } else if (nxagentOption(Rootless)) { nxagentChangeOption(X, 0); nxagentChangeOption(Y, 0); nxagentChangeOption(RootX, 0); nxagentChangeOption(RootY, 0); nxagentChangeOption(RootWidth, w); nxagentChangeOption(RootHeight, h); nxagentChangeOption(Width, w); nxagentChangeOption(Height, h); } else /* window mode */ { /* * screen is initialized for the first time. */ if (nxagentReconnectTrap == False) { nxagentChangeOption(RootX, 0); nxagentChangeOption(RootY, 0); nxagentChangeOption(Width, nxagentOption(RootWidth)); nxagentChangeOption(Height, nxagentOption(RootHeight)); } /* * Ensure that the agent window won't be bigger * than the root window. */ nxagentChangeOption(Width, min(nxagentOption(Width), nxagentOption(RootWidth))); nxagentChangeOption(Height, min(nxagentOption(Height), nxagentOption(RootHeight))); /* * Be sure that the agent window won't be bigger * than the X server root window. */ if (nxagentOption(Width) > w) { nxagentChangeOption(Width, w * 3 / 4); } if (nxagentOption(Height) > h) { nxagentChangeOption(Height, h * 3 / 4); } /* * Forcing the agent window geometry to be equal to the root * window geometry the first time the screen is initialized if the * geometry hasn't been explicitly set in the option file and if * the root window isn't bigger than the X server root window.. */ if (nxagentReconnectTrap == False) { if ((nxagentOption(RootWidth) < w) && !(nxagentUserGeometry.flag & WidthValue)) { nxagentChangeOption(Width, nxagentOption(RootWidth)); } if ((nxagentOption(RootHeight) < h) && !(nxagentUserGeometry.flag & HeightValue)) { nxagentChangeOption(Height, nxagentOption(RootHeight)); } } if (resetAgentPosition) { /* center */ nxagentChangeOption(X, (w - nxagentOption(Width)) / 2); nxagentChangeOption(Y, (h - nxagentOption(Height)) / 2); } nxagentChangeOption(SavedWidth, nxagentOption(RootWidth)); nxagentChangeOption(SavedHeight, nxagentOption(RootHeight)); } nxagentChangeOption(SavedRootWidth, nxagentOption(RootWidth)); nxagentChangeOption(SavedRootHeight, nxagentOption(RootHeight)); nxagentChangeOption(ViewportXSpan, nxagentOption(Width) - nxagentOption(RootWidth)); nxagentChangeOption(ViewportYSpan, nxagentOption(Height) - nxagentOption(RootHeight)); if (nxagentReconnectTrap == 0) { if (nxagentOption(Persistent)) { nxagentArgc = argc; nxagentArgv = argv; } #ifdef NXAGENT_TIMESTAMP fprintf(stderr, "Screen: going to open screen, time is [%d] milliseconds.\n", GetTimeInMillis() - startTime); #endif /* * Initialize all our privates. */ if (AllocateWindowPrivate(pScreen, nxagentWindowPrivateIndex, sizeof(nxagentPrivWindowRec)) == 0 || AllocateGCPrivate(pScreen, nxagentGCPrivateIndex, sizeof(nxagentPrivGC)) == 0 || AllocateClientPrivate(nxagentClientPrivateIndex, sizeof(PrivClientRec)) == 0 || AllocatePixmapPrivate(pScreen, nxagentPixmapPrivateIndex, sizeof(nxagentPrivPixmapRec)) == 0) { return False; } /* * Initialize the depths. */ depths = (DepthPtr) malloc(nxagentNumDepths * sizeof(DepthRec)); for (int i = 0; i < nxagentNumDepths; i++) { depths[i].depth = nxagentDepths[i]; depths[i].numVids = 0; depths[i].vids = (VisualID *) malloc(MAXVISUALSPERDEPTH * sizeof(VisualID)); } /* * Initialize the visuals. */ #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "Debug: Setting up visuals. Original array has size " "[%d].\n", nxagentNumVisuals); #endif numVisuals = 0; numDepths = nxagentNumDepths; visuals = (VisualPtr) malloc(nxagentNumVisuals * sizeof(VisualRec)); for (int i = 0; i < nxagentNumVisuals; i++) { visuals[numVisuals].vid = FakeClientID(0); visuals[numVisuals].class = nxagentVisuals[i].class; visuals[numVisuals].bitsPerRGBValue = nxagentVisuals[i].bits_per_rgb; visuals[numVisuals].ColormapEntries = nxagentVisuals[i].colormap_size; visuals[numVisuals].nplanes = nxagentVisuals[i].depth; visuals[numVisuals].redMask = nxagentVisuals[i].red_mask; visuals[numVisuals].greenMask = nxagentVisuals[i].green_mask; visuals[numVisuals].blueMask = nxagentVisuals[i].blue_mask; visuals[numVisuals].offsetRed = nxagentColorOffset(nxagentVisuals[i].red_mask); visuals[numVisuals].offsetGreen = nxagentColorOffset(nxagentVisuals[i].green_mask); visuals[numVisuals].offsetBlue = nxagentColorOffset(nxagentVisuals[i].blue_mask); /* * Check for and remove the duplicates. */ if (i == nxagentDefaultVisualIndex) { defaultVisualIndex = numVisuals; #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "Debug: Set default visual index [%d].\n" , defaultVisualIndex); #endif } else { int j; for (j = 0; j < numVisuals; j++) { if (visuals[numVisuals].class == visuals[j].class && visuals[numVisuals].bitsPerRGBValue == visuals[j].bitsPerRGBValue && visuals[numVisuals].ColormapEntries == visuals[j].ColormapEntries && visuals[numVisuals].nplanes == visuals[j].nplanes && visuals[numVisuals].redMask == visuals[j].redMask && visuals[numVisuals].greenMask == visuals[j].greenMask && visuals[numVisuals].blueMask == visuals[j].blueMask && visuals[numVisuals].offsetRed == visuals[j].offsetRed && visuals[numVisuals].offsetGreen == visuals[j].offsetGreen && visuals[numVisuals].offsetBlue == visuals[j].offsetBlue) break; } if (j < numVisuals) continue; } depthIndex = UNDEFINED; #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "Debug: Added visual [%lu].\n" , (long unsigned int)visuals[numVisuals].vid); #endif for (int j = 0; j < numDepths; j++) { if (depths[j].depth == nxagentVisuals[i].depth) { depthIndex = j; break; } } if (depthIndex == UNDEFINED) { #ifdef WARNING fprintf(stderr, "nxagentOpenScreen: WARNING! Can't find a matching depth for visual depth [%d].\n", nxagentVisuals[i].depth); #endif depthIndex = numDepths; depths[depthIndex].depth = nxagentVisuals[i].depth; depths[depthIndex].numVids = 0; depths[depthIndex].vids = (VisualID *) malloc(MAXVISUALSPERDEPTH * sizeof(VisualID)); numDepths++; } if (depths[depthIndex].numVids >= MAXVISUALSPERDEPTH) { FatalError("Visual table overflow"); } depths[depthIndex].vids[depths[depthIndex].numVids] = visuals[numVisuals].vid; depths[depthIndex].numVids++; #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "Debug: Registered visual [%lu] for depth [%d (%d)].\n" , (long unsigned int)visuals[numVisuals].vid, depthIndex, depths[depthIndex].depth); #endif numVisuals++; } #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "Debug: Setting default visual [%d (%lu)].\n", defaultVisualIndex, (long unsigned int)visuals[defaultVisualIndex].vid); fprintf(stderr, "Debug: Setting root depth [%d].\n", visuals[defaultVisualIndex].nplanes); #endif defaultVisual = visuals[defaultVisualIndex].vid; rootDepth = visuals[defaultVisualIndex].nplanes; nxagentInitAlphaVisual(); bitsPerPixel = nxagentBitsPerPixel(rootDepth); if (bitsPerPixel == 1) { sizeInBytes = PixmapBytePad(nxagentOption(RootWidth), rootDepth) * nxagentOption(RootHeight); } else { sizeInBytes = PixmapBytePad(nxagentOption(RootWidth), rootDepth) * nxagentOption(RootHeight) * bitsPerPixel/8; } #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Frame buffer allocated. rootDepth " "[%d] bitsPerPixel [%d] sizeInBytes [%d]\n", rootDepth, bitsPerPixel, sizeInBytes); #endif pFrameBufferBits = (char *) malloc(sizeInBytes); if (!pFrameBufferBits) { freeDepths(depths, numDepths); SAFE_free(visuals); return FALSE; } #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "nxagentOpenScreen: Before fbScreenInit numVisuals [%d] numDepths [%d] " "rootDepth [%d] defaultVisual [%lu].\n", numVisuals, numDepths, rootDepth, (long unsigned int)defaultVisual); #endif if ((monitorResolution < 1) && (nxagentAutoDPI == False)) { monitorResolution = NXAGENT_DEFAULT_DPI; } else if ((monitorResolution < 1) && (nxagentAutoDPI == True)) { monitorResolution = NXAGENT_AUTO_DPI; } if (!fbScreenInit(pScreen, pFrameBufferBits, nxagentOption(RootWidth), nxagentOption(RootHeight), monitorResolution, monitorResolution, PixmapBytePad(nxagentOption(RootWidth), rootDepth), bitsPerPixel)) { freeDepths(depths, numDepths); SAFE_free(visuals); return FALSE; } #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "nxagentOpenScreen: After fbScreenInit numVisuals [%d] numDepths [%d] " "rootDepth [%d] defaultVisual [%lu].\n", numVisuals, numDepths, rootDepth, (long unsigned int)defaultVisual); #endif /* * Complete the initialization of the GLX * extension. This will add the GLX visuals * and will modify numVisuals and numDepths. */ #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "nxagentOpenScreen: Before GLX numVisuals [%d] numDepths [%d] " "rootDepth [%d] defaultVisual [%lu].\n", numVisuals, numDepths, rootDepth, (long unsigned int)defaultVisual); #endif nxagentInitGlxExtension(&visuals, &depths, &numVisuals, &numDepths, &rootDepth, &defaultVisual); #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "nxagentOpenScreen: After GLX numVisuals [%d] numDepths [%d] " "rootDepth [%d] defaultVisual [%lu].\n", numVisuals, numDepths, rootDepth, (long unsigned int)defaultVisual); #endif /* * Replace the visuals and depths initialized * by fbScreenInit with our own. */ freeDepths(pScreen->allowedDepths, pScreen->numDepths); pScreen -> allowedDepths = depths; pScreen -> numDepths = numDepths; pScreen -> rootDepth = rootDepth; SAFE_free(pScreen -> visuals); pScreen -> visuals = visuals; pScreen -> numVisuals = numVisuals; pScreen -> rootVisual = defaultVisual; /* * Set up the internal structures used for * tracking the proxy resources associated * to the unpack and split operations. */ nxagentInitSplitResources(); nxagentInitUnpackResources(); #ifdef WATCH fprintf(stderr, "nxagentOpenScreen: Watchpoint 7.\n"); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio ------- ----- ------ ------- -------- ---------- ----- N/A */ sleep(30); #endif if (nxagentParentWindow != 0) { /* * This would cause a GetWindowAttributes * and a GetGeometry (asynchronous) reply. */ XGetWindowAttributes(nxagentDisplay, nxagentParentWindow, &gattributes); nxagentChangeOption(Width, gattributes.width); nxagentChangeOption(Height, gattributes.height); } if (nxagentOption(AllScreens)) { attributes.override_redirect = True; } if (nxagentOption(Fullscreen)) { /* * We need to disable the host's screensaver or * it will otherwise grab the screen even if it * is under agent's control. */ XSetScreenSaver(nxagentDisplay, 0, 0, DefaultExposures, DefaultBlanking); } if (nxagentTrue24) { fbGetScreenPrivate(pScreen) -> win32bpp = visuals[nxagentDefaultVisualIndex].nplanes; fbGetScreenPrivate(pScreen) -> pix32bpp = visuals[nxagentDefaultVisualIndex].nplanes; } else { fbGetScreenPrivate(pScreen) -> win32bpp = 32; fbGetScreenPrivate(pScreen) -> pix32bpp = 32; } /* * We call miScreenInit with NULL in place of the screen area if we * don't want to initialize the frame buffer. * * if (!miScreenInit(pScreen, NULL, nxagentOption(RootWidth), * nxagentOption(RootHeight), 1, 1, nxagentOption(RootWidth), * visuals[nxagentDefaultVisualIndex].nplanes, / * Root depth. * / * numDepths, depths, * visuals[nxagentDefaultVisualIndex].vid,* Root visual. * / * numVisuals, visuals)) * return FALSE; */ if (monitorResolution < 0) { pScreen->mmWidth = nxagentOption(RootWidth) * DisplayWidthMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) / DisplayWidth(nxagentDisplay, DefaultScreen(nxagentDisplay)); pScreen->mmHeight = nxagentOption(RootHeight) * DisplayHeightMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) / DisplayHeight(nxagentDisplay, DefaultScreen(nxagentDisplay)); } pScreen->defColormap = (Colormap) FakeClientID(0); pScreen->minInstalledCmaps = MINCMAPS; pScreen->maxInstalledCmaps = MAXCMAPS; pScreen->whitePixel = nxagentWhitePixel; pScreen->blackPixel = nxagentBlackPixel; /* rgf */ /* GCperDepth */ /* PixmapPerDepth */ /* WindowPrivateLen */ /* WindowPrivateSizes */ /* totalWindowSize */ /* GCPrivateLen */ /* GCPrivateSizes */ /* totalGCSize */ /* * Random screen procedures. */ pScreen->CloseScreen = nxagentCloseScreen; pScreen->QueryBestSize = nxagentQueryBestSize; pScreen->SaveScreen = nxagentSaveScreen; pScreen->GetImage = nxagentGetImage; pScreen->GetSpans = nxagentGetSpans; pScreen->PointerNonInterestBox = (void (*)()) 0; pScreen->SourceValidate = (void (*)()) 0; pScreen->CreateScreenResources = nxagentCreateScreenResources; /* * Window Procedures. * * Note that the following functions are not * replaced with nxagent counterparts: * * ValidateTreeProcPtr ValidateTree; * ClearToBackgroundProcPtr ClearToBackground; * * Note also that the ConfigureWindow procedure * has not a pointer in the screen structure. */ pScreen->CreateWindow = nxagentCreateWindow; pScreen->DestroyWindow = nxagentDestroyWindow; pScreen->PositionWindow = nxagentPositionWindow; pScreen->ChangeWindowAttributes = nxagentChangeWindowAttributes; pScreen->RealizeWindow = nxagentRealizeWindow; pScreen->UnrealizeWindow = nxagentUnrealizeWindow; pScreen->PostValidateTree = nxagentPostValidateTree; pScreen->WindowExposures = nxagentWindowExposures; pScreen->PaintWindowBackground = nxagentPaintWindowBackground; pScreen->PaintWindowBorder = nxagentPaintWindowBorder; pScreen->CopyWindow = nxagentCopyWindow; pScreen->ClipNotify = nxagentClipNotify; pScreen->RestackWindow = nxagentRestackWindow; pScreen->ReparentWindow = nxagentReparentWindow; /* * Pixmap procedures. */ pScreen->CreatePixmap = nxagentCreatePixmap; pScreen->DestroyPixmap = nxagentDestroyPixmap; /* * This is originally miModifyPixmapHeader() * from miscrinit.c. It is used to recycle * the scratch pixmap for this screen. */ pScreen->ModifyPixmapHeader = nxagentModifyPixmapHeader; /* * Font procedures. */ pScreen->RealizeFont = nxagentRealizeFont; pScreen->UnrealizeFont = nxagentUnrealizeFont; /* * GC procedures. */ pScreen->CreateGC = nxagentCreateGC; pScreen->BitmapToRegion = nxagentPixmapToRegion; /* * Colormap procedures. */ pScreen->CreateColormap = nxagentCreateColormap; pScreen->DestroyColormap = nxagentDestroyColormap; pScreen->InstallColormap = nxagentInstallColormap; pScreen->UninstallColormap = nxagentUninstallColormap; pScreen->ListInstalledColormaps = nxagentListInstalledColormaps; pScreen->StoreColors = nxagentStoreColors; pScreen->ResolveColor = nxagentResolveColor; /* * Backing store procedures. */ pScreen->SaveDoomedAreas = (void (*)()) 0; pScreen->RestoreAreas = (RegionPtr (*)()) 0; pScreen->ExposeCopy = (void (*)()) 0; pScreen->TranslateBackingStore = (RegionPtr (*)()) 0; pScreen->ClearBackingStore = (RegionPtr (*)()) 0; pScreen->DrawGuarantee = (void (*)()) 0; if (enableBackingStore == 1) { #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Going to initialize backing store.\n"); #endif pScreen -> BackingStoreFuncs.SaveAreas = nxagentSaveAreas; pScreen -> BackingStoreFuncs.RestoreAreas = nxagentRestoreAreas; pScreen -> BackingStoreFuncs.SetClipmaskRgn = 0; pScreen -> BackingStoreFuncs.GetImagePixmap = 0; pScreen -> BackingStoreFuncs.GetSpansPixmap = 0; miInitializeBackingStore(pScreen); } /* * OS layer procedures. */ pScreen->BlockHandler = (ScreenBlockHandlerProcPtr) NoopDDA; pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr) NoopDDA; pScreen->blockData = NULL; pScreen->wakeupData = NULL; #ifdef RENDER /* * Initialize picture support. This have to be * placed here because miDCInitialize calls * DamageSetup, that should wrap the picture * screen functions. So PictureInit has to be * called before. */ if (nxagentRenderEnable && !nxagentReconnectTrap) { if (!nxagentPictureInit(pScreen, 0, 0)) { nxagentRenderEnable = False; return FALSE; } if (nxagentAlphaEnabled) { fprintf(stderr, "Info: Using alpha channel in render extension.\n"); } } #endif /* RENDER */ /* * From misprite.c: called from device-dependent screen * initialization proc after all of the function pointers * have been stored in the screen structure. */ miDCInitialize(pScreen, &nxagentPointerCursorFuncs); /* * Cursor Procedures. */ pScreen->ConstrainCursor = nxagentConstrainCursor; pScreen->CursorLimits = nxagentCursorLimits; pScreen->DisplayCursor = nxagentDisplayCursor; pScreen->RealizeCursor = nxagentRealizeCursor; pScreen->UnrealizeCursor = nxagentUnrealizeCursor; pScreen->RecolorCursor = nxagentRecolorCursor; nxagentSetCursorPositionW = pScreen->SetCursorPosition; pScreen->SetCursorPosition = nxagentSetCursorPosition; #define POSITION_OFFSET (pScreen->myNum * (nxagentOption(Width) + \ nxagentOption(Height)) / 32) /* * Complete the initialization of the RANDR * extension. */ nxagentInitRandRExtension(pScreen); } #ifdef TEST nxagentPrintAgentGeometry(NULL, "nxagentOpenScreen:"); #endif if (nxagentDoFullGeneration == 1 || nxagentReconnectTrap == 1) { valuemask = CWBackPixel | CWEventMask | CWColormap | (nxagentOption(AllScreens) == 1 ? CWOverrideRedirect : 0); attributes.background_pixel = nxagentBlackPixel; attributes.event_mask = nxagentGetDefaultEventMask(); attributes.colormap = nxagentDefaultVisualColormap(nxagentDefaultVisual(pScreen)); if (nxagentOption(AllScreens) == 1) { attributes.override_redirect = True; } if (nxagentOption(Fullscreen) == 1) { if (nxagentReconnectTrap) { /* * We need to disable the host's screensaver or * it will otherwise grab the screen even if it * is under agent's control. */ XSetScreenSaver(nxagentDisplay, 0, 0, DefaultExposures, DefaultBlanking); } } /* * This would be used when running agent * embedded into another X window. */ if (nxagentParentWindow != 0) { nxagentDefaultWindows[pScreen->myNum] = nxagentParentWindow; mask = nxagentGetDefaultEventMask(); XSelectInput(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], mask); } else { /* * Create any top-level window as a child of the * real root of the remote display. See also the * InitRootWindow() procedure and the function * handling the splash screen. */ if (nxagentOption(Rootless) == True) { nxagentDefaultWindows[pScreen->myNum] = DefaultRootWindow(nxagentDisplay); #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Using root window id [%ld].\n", (long int)nxagentDefaultWindows[pScreen->myNum]); #endif } #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Going to create new default window.\n"); #endif nxagentDefaultWindows[pScreen->myNum] = XCreateWindow(nxagentDisplay, DefaultRootWindow(nxagentDisplay), nxagentOption(X) + POSITION_OFFSET, nxagentOption(Y) + POSITION_OFFSET, nxagentOption(Width), nxagentOption(Height), nxagentOption(BorderWidth), pScreen->rootDepth, InputOutput, nxagentDefaultVisual(pScreen), valuemask, &attributes); if (nxagentReportWindowIds) { fprintf(stderr, "NXAGENT_WINDOW_ID: SCREEN_WINDOW:[%d],WID:[0x%x]\n", pScreen->myNum, nxagentDefaultWindows[pScreen->myNum]); } #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Created new default window for screen [%d] with id [0x%x].\n", pScreen->myNum, nxagentDefaultWindows[pScreen->myNum]); #endif if (nxagentOption(Rootless) == 0) { valuemask = CWEventMask; mask = PointerMotionMask; attributes.event_mask = mask; nxagentInputWindows[pScreen->myNum] = XCreateWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], 0, 0, nxagentOption(Width), nxagentOption(Height), 0, 0, InputOnly, nxagentDefaultVisual(pScreen), valuemask , &attributes); if (nxagentReportWindowIds) { fprintf(stderr, "NXAGENT_WINDOW_ID: INPUT_WINDOW:[%d],WID:[0x%x]\n", pScreen->myNum, nxagentInputWindows[pScreen->myNum]); } #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Created new input window for screen [%d] with id [0x%x].\n", pScreen->myNum, nxagentInputWindows[pScreen->myNum]); #endif } /* * Setting WM_CLASS to "X2GoAgent" when running in X2Go Agent mode * we need it to properly display all window parameters by some WMs * (for example on Maemo) */ { #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Setting WM_CLASS and WM_NAME for window with id [%ld].\n", (long int)nxagentDefaultWindows[pScreen->myNum]); #endif XClassHint hint; if(nxagentX2go) { hint.res_name = strdup("X2GoAgent"); hint.res_class = strdup("X2GoAgent"); } else { hint.res_name = strdup("NXAgent"); hint.res_class = strdup("NXAgent"); } XSetClassHint(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &hint); SAFE_free(hint.res_name); SAFE_free(hint.res_class); } if (nxagentOption(Fullscreen)) { nxagentFullscreenWindow = nxagentDefaultWindows[pScreen->myNum]; } } if (nxagentOption(Fullscreen)) { /* * FIXME: Do we still need to set this property? */ if (nxagentAtoms[8] != 0) { XChangeProperty(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], nxagentAtoms[8], /* NX_AGENT_SIGNATURE */ XA_STRING, 8, PropModeReplace, (unsigned char*) "X-AGENT", strlen("X-AGENT")); } mask = nxagentGetDefaultEventMask(); XSelectInput(nxagentDisplay, nxagentFullscreenWindow, mask); } XSizeHints* sizeHints = XAllocSizeHints(); if (sizeHints) { sizeHints->flags = PPosition | PMinSize | PMaxSize; sizeHints->x = nxagentOption(X) + POSITION_OFFSET; sizeHints->y = nxagentOption(Y) + POSITION_OFFSET; sizeHints->min_width = MIN_NXAGENT_WIDTH; sizeHints->min_height = MIN_NXAGENT_HEIGHT; sizeHints->width = nxagentOption(RootWidth); sizeHints->height = nxagentOption(RootHeight); if (nxagentOption(DesktopResize) == 1 || nxagentOption(Fullscreen) == 1) { sizeHints->max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); sizeHints->max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); } else { sizeHints->max_width = nxagentOption(RootWidth); sizeHints->max_height = nxagentOption(RootHeight); } if (nxagentUserGeometry.flag & XValue || nxagentUserGeometry.flag & YValue) sizeHints->flags |= USPosition; if (nxagentUserGeometry.flag & WidthValue || nxagentUserGeometry.flag & HeightValue) sizeHints->flags |= USSize; } XWMHints* wmHints = XAllocWMHints(); if (wmHints) { wmHints->flags = IconPixmapHint; wmHints->icon_pixmap = nxagentIconPixmap; if (useXpmIcon) { wmHints->flags |= IconMaskHint; wmHints->icon_mask = nxagentIconShape; } } Xutf8SetWMProperties(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], nxagentWindowName, nxagentWindowName, argv , argc , sizeHints, wmHints, NULL); SAFE_XFree(sizeHints); SAFE_XFree(wmHints); /* * Clear the window but let it unmapped. We'll map it * at the time the we'll initialize our screen root * and only if we are not running in rootless mode. */ XClearWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum]); if (nxagentOption(AllScreens)) { if (nxagentReconnectTrap) { XGrabKeyboard(nxagentDisplay, nxagentFullscreenWindow, True, GrabModeAsync, GrabModeAsync, CurrentTime); } nxagentIconWindow = nxagentCreateIconWindow(); } else { nxagentIconWindow = None; } /* * When we don't have window manager we grab keyboard * to let nxagent get keyboard events. */ if (!nxagentWMIsRunning && !nxagentOption(Fullscreen)) { #ifdef TEST fprintf(stderr, "nxagentOpenScreen: No window manager, we call XGrabKeyboard.\n"); #endif XGrabKeyboard(nxagentDisplay, RootWindow (nxagentDisplay, 0), True, GrabModeAsync, GrabModeAsync, CurrentTime); } } if (!nxagentCreateDefaultColormap(pScreen)) { #ifdef PANIC fprintf(stderr, "nxagentOpenScreen: Failed to create default colormap for screen.\n"); #endif return False; } /* * The purpose of this check is to verify if there * is a window manager running. Unfortunately due * to the way we manage the intern atoms call, the * atom will always exist. */ if (nxagentWMIsRunning) { XlibAtom deleteWMatom = nxagentAtoms[2]; /* WM_DELETE_WINDOW */ #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Found WM, delete window atom [%ld].\n", deleteWMatom); #endif /* FIXME: This doing the same thing in both cases. The comments do not seem accurate (anymore?) */ if (nxagentOption(Rootless) == False) { /* * Set the WM_DELETE_WINDOW protocol for the main agent * window and, if we are in fullscreen mode, include the * icon window. */ XSetWMProtocols(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &deleteWMatom, 1); } else { /* * We need to register the ICCCM WM_DELETE_WINDOW * protocol for any top-level window or the agent * will be killed if any window is closed. */ XSetWMProtocols(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &deleteWMatom, 1); #ifdef TEST fprintf(stderr, "Warning: Not setting the WM_DELETE_WINDOW protocol.\n"); #endif } } else { /* * We should always enable the configuration of the * remote X server's devices if we are running full- * screen and there is no WM running. */ if (nxagentOption(Fullscreen)) { #ifdef TEST fprintf(stderr, "nxagentOpenScreen: WARNING! Forcing propagation of device control changes.\n"); #endif nxagentChangeOption(DeviceControl, True); } } /* * Inform the user whether the agent's clients will * be able to change the real X server's keyboard * and pointer settings. */ if (nxagentOption(DeviceControl) == False) { fprintf(stderr, "Info: Not using local device configuration changes.\n"); } else { fprintf(stderr, "Info: Using local device configuration changes.\n"); } #ifdef RENDER /* * if (nxagentRenderEnable && !nxagentReconnectTrap) * { * if (!nxagentPictureInit(pScreen, 0, 0)) * { * nxagentRenderEnable = False; * * return FALSE; * } * * if (nxagentAlphaEnabled) * { * fprintf(stderr, "Info: Using alpha channel in render extension.\n"); * } * } */ #endif /* RENDER */ /* * Check if the composite extension is * supported on the remote display and * prepare the agent for its use. */ nxagentCompositeExtensionInit(); /* We use this to get informed about RandR changes on the real display. FIXME: It would probably be better to use an RRScreenChangeNotifyEvent here. */ XSelectInput(nxagentDisplay, DefaultRootWindow(nxagentDisplay), StructureNotifyMask); #ifdef NXAGENT_TIMESTAMP fprintf(stderr, "Screen: open screen finished, time is [%d] milliseconds.\n", GetTimeInMillis() - startTime); #endif #ifdef WATCH fprintf(stderr, "nxagentOpenScreen: Watchpoint 8.\n"); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio ------- ----- ------ ------- -------- ---------- ----- #1 U 2 1 5344 bits (1 KB) -> 2344 bits (0 KB) -> 2672/1 -> 1172/1 = 2.280:1 #16 11 2816 bits (0 KB) -> 197 bits (0 KB) -> 256/1 -> 18/1 = 14.294:1 #91 1 16640 bits (2 KB) -> 12314 bits (2 KB) -> 16640/1 -> 12314/1 = 1.351:1 #98 2 512 bits (0 KB) -> 57 bits (0 KB) -> 256/1 -> 28/1 = 8.982:1 */ sleep(30); #endif return True; } Bool nxagentCloseScreen(ScreenPtr pScreen) { #ifdef DEBUG fprintf(stderr, "running nxagentCloseScreen()\n"); #endif /* * We have called fbScreenInit() in nxagenOpenScreen, which in turn * called fbOpenScreen. But we are not using the data as created by * fbOpenScreen but have freed it and replaced by our own. So we free * our own stuff here and take care that fbCloseScreen will not free * them again. */ freeDepths(pScreen->allowedDepths, pScreen->numDepths); pScreen->allowedDepths = NULL; pScreen->numDepths = 0; /* * Free the frame buffer. */ SAFE_free(((PixmapPtr)pScreen -> devPrivate) -> devPrivate.ptr); SAFE_free(pScreen->devPrivate); SAFE_free(pScreen->visuals); fbCloseScreen(pScreen); /* * Reset the geometry and alpha information * used by proxy to unpack the packed images. */ nxagentResetVisualCache(); nxagentResetAlphaCache(); nxagentReleaseAllSplits(); /* * The assumption is that all X resources will be * destroyed upon closing the display connection. * There is no need to generate extra protocol. */ return True; } /* * This function comes from the xfree86 Xserver. */ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable) { WindowPtr pWin = pScreen->root; Bool WasViewable = (Bool)(pWin->viewable); Bool anyMarked = FALSE; RegionPtr pOldClip = NULL; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; if (WasViewable) { for (WindowPtr pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { (void) (*pScreen->MarkOverlappedWindows)(pChild, pChild, &pLayerWin); } (*pScreen->MarkWindow) (pWin); anyMarked = TRUE; if (pWin->valdata) { if (HasBorder (pWin)) { RegionPtr borderVisible = RegionCreate(NullBox, 1); RegionSubtract(borderVisible, &pWin->borderClip, &pWin->winSize); pWin->valdata->before.borderVisible = borderVisible; } pWin->valdata->before.resized = TRUE; } } /* * Use REGION_BREAK to avoid optimizations in ValidateTree * that assume the root borderClip can't change. Well, normally * it doesn't...) */ if (enable) { BoxRec box = {.x1 = 0, .y1 = 0, .x2 = pScreen->width, .y2 = pScreen->height}; RegionInit(&pWin->winSize, &box, 1); RegionInit(&pWin->borderSize, &box, 1); if (WasViewable) RegionReset(&pWin->borderClip, &box); pWin->drawable.width = pScreen->width; pWin->drawable.height = pScreen->height; RegionBreak(&pWin->clipList); } else { RegionEmpty(&pWin->borderClip); RegionBreak(&pWin->clipList); } ResizeChildrenWinSize (pWin, 0, 0, 0, 0); if (WasViewable) { if (pWin->backStorage) { pOldClip = RegionCreate(NullBox, 1); RegionCopy(pOldClip, &pWin->clipList); } if (pWin->firstChild) { anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild, pWin->firstChild, (WindowPtr *)NULL); } else { (*pScreen->MarkWindow) (pWin); anyMarked = TRUE; } #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin); } #endif /* DO_SAVE_UNDERS */ if (anyMarked) (*pScreen->ValidateTree)(pWin, NullWindow, VTOther); } if (pWin->backStorage && pOldClip && ((pWin->backingStore == Always) || WasViewable)) { if (!WasViewable) pOldClip = &pWin->clipList; /* a convenient empty region */ RegionPtr bsExposed = (*pScreen->TranslateBackingStore) (pWin, 0, 0, pOldClip, pWin->drawable.x, pWin->drawable.y); if (WasViewable) RegionDestroy(pOldClip); if (bsExposed) { RegionPtr valExposed = NullRegion; if (pWin->valdata) valExposed = &pWin->valdata->after.exposed; (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); if (valExposed) RegionEmpty(valExposed); RegionDestroy(bsExposed); } } if (WasViewable) { if (anyMarked) (*pScreen->HandleExposures)(pWin); #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin); #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther); } if (pWin->realized) WindowsRestructured (); FlushAllOutput (); } Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height, int mmWidth, int mmHeight) { #ifdef TEST nxagentPrintAgentGeometry("Before Resize Screen", "nxagentResizeScreen:"); #endif /* * Change screen properties. */ int oldWidth = pScreen -> width; int oldHeight = pScreen -> height; int oldMmWidth = pScreen -> mmWidth; int oldMmHeight = pScreen -> mmHeight; pScreen -> width = width; pScreen -> height = height; /* * Compute screen dimensions if they aren't given. */ if (mmWidth == 0) { if (monitorResolution < 0) { mmWidth = width * DisplayWidthMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) / DisplayWidth(nxagentDisplay, DefaultScreen(nxagentDisplay)); } else { mmWidth = (width * 254 + monitorResolution * 5) / (monitorResolution * 10); } if (mmWidth < 1) { mmWidth = 1; } } if (mmHeight == 0) { if (monitorResolution < 0) { mmHeight = height * DisplayHeightMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) / DisplayHeight(nxagentDisplay, DefaultScreen(nxagentDisplay)); } else { mmHeight = (height * 254 + monitorResolution * 5) / (monitorResolution * 10); } if (mmHeight < 1) { mmHeight = 1; } } pScreen -> mmWidth = mmWidth; pScreen -> mmHeight = mmHeight; PixmapPtr pPixmap = fbGetScreenPixmap(pScreen); char *fbBits = realloc(pPixmap -> devPrivate.ptr, PixmapBytePad(width, pScreen->rootDepth) * height * BitsPerPixel(pScreen->rootDepth) / 8); if (fbBits == NULL) { pScreen -> width = oldWidth; pScreen -> height = oldHeight; pScreen -> mmWidth = oldMmWidth; pScreen -> mmHeight = oldMmHeight; goto nxagentResizeScreenError; } if (!miModifyPixmapHeader(pPixmap, width, height, pScreen->rootDepth, BitsPerPixel(pScreen->rootDepth), PixmapBytePad(width, pScreen->rootDepth), fbBits)) { /* FIXME: We should try to restore the previously reallocated frame buffer pixmap. */ pScreen -> width = oldWidth; pScreen -> height = oldHeight; pScreen -> mmWidth = oldMmWidth; pScreen -> mmHeight = oldMmHeight; goto nxagentResizeScreenError; } nxagentChangeOption(RootWidth, width); nxagentChangeOption(RootHeight, height); if (nxagentOption(Fullscreen)) { nxagentChangeOption(RootX, (nxagentOption(Width) - nxagentOption(RootWidth)) / 2); nxagentChangeOption(RootY, (nxagentOption(Height) - nxagentOption(RootHeight)) / 2); } else { nxagentChangeOption(RootX, 0); nxagentChangeOption(RootY, 0); } nxagentChangeOption(ViewportXSpan, nxagentOption(Width) - nxagentOption(RootWidth)); nxagentChangeOption(ViewportYSpan, nxagentOption(Height) - nxagentOption(RootHeight)); /* * Change agent window size and size hints. */ if ((nxagentOption(Fullscreen) == 0 && nxagentOption(AllScreens) == 0)) { nxagentSetWMNormalHints(pScreen->myNum, width, height); XResizeWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], width, height); if (nxagentOption(Rootless) == 0) { XResizeWindow(nxagentDisplay, nxagentInputWindows[pScreen -> myNum], width, height); } } /* * Set properties for the agent root window. */ BoxRec box = {.x1 = 0, .y1 = 0, .x2 = width, .y2 = height}; pScreen->root -> drawable.width = width; pScreen->root -> drawable.height = height; pScreen->root -> drawable.x = 0; pScreen->root -> drawable.y = 0; RegionInit(&pScreen->root -> borderSize, &box, 1); RegionInit(&pScreen->root -> winSize, &box, 1); RegionInit(&pScreen->root -> clipList, &box, 1); RegionInit(&pScreen->root -> borderClip, &box, 1); (*pScreen -> PositionWindow)(pScreen->root, 0, 0); nxagentSetRootClip(pScreen, 1); XMoveWindow(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), nxagentOption(RootX), nxagentOption(RootY)); nxagentMoveViewport(pScreen, 0, 0); /* * Update pointer bounds. */ ScreenRestructured(pScreen); #ifdef TEST nxagentPrintAgentGeometry("After Resize Screen", "nxagentResizeScreen:"); #endif nxagentSetPrintGeometry(pScreen -> myNum); return 1; nxagentResizeScreenError: return 0; } void nxagentShadowSetRatio(float floatXRatio, float floatYRatio) { if (floatXRatio == 0) { floatXRatio = 1.0; } if (floatYRatio == 0) { floatYRatio = 1.0; } int intXRatio = floatXRatio * (1 << PRECISION); int intYRatio = floatYRatio * (1 << PRECISION); nxagentChangeOption(FloatXRatio, floatXRatio); nxagentChangeOption(FloatYRatio, floatYRatio); nxagentChangeOption(XRatio, intXRatio); nxagentChangeOption(YRatio, intYRatio); #ifdef TEST fprintf(stderr, "Info: Using X ratio [%f] Y ratio [%f].\n", nxagentOption(FloatXRatio), nxagentOption(FloatYRatio)); #endif } void nxagentShadowSetWindowsSize(void) { XResizeWindow(nxagentDisplay, nxagentDefaultWindows[0], nxagentOption(Width), nxagentOption(Height)); XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, nxagentOption(Width), nxagentOption(Height)); } void nxagentShadowSetWindowOptions(void) { nxagentChangeOption(RootWidth, nxagentScale(nxagentShadowWidth, nxagentOption(XRatio))); nxagentChangeOption(RootHeight, nxagentScale(nxagentShadowHeight, nxagentOption(YRatio))); nxagentChangeOption(SavedRootWidth, nxagentOption(RootWidth)); nxagentChangeOption(SavedRootHeight, nxagentOption(RootHeight)); nxagentChangeOption(RootX, (nxagentOption(Width) - nxagentOption(RootWidth)) >> 1); nxagentChangeOption(RootY, (nxagentOption(Height) - nxagentOption(RootHeight)) >> 1); } int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin) { char *layout = NULL; #ifdef TEST fprintf(stderr, "Info: Init shadow session. nxagentDisplayName [%s] " "nxagentDisplay [%p] nxagentShadowDisplayName [%s].\n", nxagentDisplayName, (void *) nxagentDisplay, nxagentShadowDisplayName); #endif if (nxagentKeyboard != NULL) { int i; for (i = 0; nxagentKeyboard[i] != '/' && nxagentKeyboard[i] != 0; i++); if(nxagentKeyboard[i] == 0 || nxagentKeyboard[i + 1] == 0 || i == 0) { #ifdef WARNING fprintf(stderr,"WARNING! Wrong keyboard type: %s.\n", nxagentKeyboard); #endif } else { layout = strdup(&nxagentKeyboard[i + 1]); } } #ifdef DEBUG fprintf(stderr, "nxagentShadowInit: Setting the master uid [%d].\n", nxagentShadowUid); #endif if (nxagentShadowUid != -1) { NXShadowSetDisplayUid(nxagentShadowUid); } if (nxagentOption(UseDamage) == 0) { NXShadowDisableDamage(); } if (NXShadowCreate(nxagentDisplay, layout, nxagentShadowDisplayName, (void *) &nxagentShadowDisplay) != 1) { #ifdef PANIC fprintf(stderr, "nxagentShadowInit: PANIC! Failed to initialize shadow " "display [%s].\n", nxagentShadowDisplayName); #endif return -1; } /* * The shadow nxagent sets the _NX_SHADOW property on the master X * server root window in order to notify its presence. */ XlibAtom nxagentShadowAtom = XInternAtom(nxagentShadowDisplay, "_NX_SHADOW", False); XChangeProperty(nxagentShadowDisplay, DefaultRootWindow(nxagentShadowDisplay), nxagentShadowAtom, XA_STRING, 8, PropModeReplace, NULL, 0); if (NXShadowAddUpdaterDisplay(nxagentDisplay, &nxagentShadowWidth, &nxagentShadowHeight, &nxagentMasterDepth) == 0) { #ifdef PANIC fprintf(stderr, "nxagentShadowInit: PANIC! Failed to add display [%s].\n", nxagentDisplayName); #endif return -1; } if (nxagentOption(Fullscreen) == 1) { nxagentShadowSetRatio(WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) * 1.0 / nxagentShadowWidth, HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) * 1.0 / nxagentShadowHeight); } else if (nxagentUserGeometry.flag != 0) { nxagentShadowSetRatio(nxagentOption(RootWidth) * 1.0 / nxagentShadowWidth, nxagentOption(RootHeight) * 1.0 / nxagentShadowHeight); } if (DefaultVisualOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) -> class != TrueColor) { #ifdef PANIC fprintf(stderr, "nxagentShadowInit: PANIC! The visual class of the remote " "X server is not TrueColor.\n"); #endif return -1; } if (DefaultVisualOfScreen(DefaultScreenOfDisplay(nxagentShadowDisplay)) -> class != TrueColor) { #ifdef PANIC const char *className; switch (DefaultVisualOfScreen(DefaultScreenOfDisplay(nxagentShadowDisplay)) -> class) { case StaticGray: { className = "StaticGray"; break; } case StaticColor: { className = "StaticColor"; break; } case PseudoColor: { className = "PseudoColor"; break; } case DirectColor: { className = "DirectColor"; break; } case GrayScale: { className = "GrayScale"; break; } default: { className = ""; break; } } fprintf(stderr, "nxagentShadowInit: PANIC! Cannot shadow the display. " "%s visual class is not supported. Only TrueColor visuals " "are supported.\n", className); #endif /* #endif PANIC */ return -1; } nxagentShadowDepth = pScreen -> rootDepth; switch (nxagentMasterDepth) { case 32: case 24: { if (nxagentShadowDepth == 16) { nxagentCheckDepth = 1; } else if (nxagentShadowDepth == 8) { #ifdef PANIC fprintf(stderr, "nxagentShadowInit: PANIC! Unable to shadow a %d bit " "display with a 8 bit screen depth.\n", nxagentMasterDepth); #endif return -1; } nxagentBppMaster = 4; break; } case 16: { if (nxagentShadowDepth > 16) { nxagentCheckDepth = 1; } else if (nxagentShadowDepth == 8) { #ifdef PANIC fprintf(stderr, "nxagentShadowInit: PANIC! Unable to shadow a 16 bit " "display with a 8 bit screen depth.\n"); #endif return -1; } nxagentBppMaster = 2; break; } case 8: { if (nxagentShadowDepth != 8) { #ifdef PANIC fprintf(stderr, "nxagentShadowInit: PANIC! Unable to shadow a 8 bit " "display with a %d bit screen depth.\n", nxagentShadowDepth); #endif return -1; } nxagentBppMaster = 1; break; } default: { #ifdef PANIC fprintf(stderr, "nxagentShadowInit: PANIC! The depth is not 32, 24, 16 or 8 bit.\n"); #endif return -1; } } if (nxagentShadowDepth >= 24) { nxagentBppShadow = 4; } else if (nxagentShadowDepth == 16) { nxagentBppShadow = 2; } else if (nxagentShadowDepth == 8) { nxagentBppShadow = 1; } imageByteOrder = nxagentShadowDisplay -> byte_order; nxagentShadowXConnectionNumber = XConnectionNumber(nxagentShadowDisplay); #ifdef TEST fprintf(stderr, "nxagentShadowInit: Adding the X connection [%d] " "to the device set.\n", nxagentShadowXConnectionNumber); #endif SetNotifyFd(nxagentShadowXConnectionNumber, nxagentNotifyConnection, X_NOTIFY_READ, NULL); accessPixmapID = FakeClientID(serverClient -> index); AddResource(accessPixmapID, RT_PIXMAP, (void *)nxagentShadowPixmapPtr); accessWindowID = FakeClientID(serverClient -> index); AddResource(accessWindowID, RT_WINDOW, (void *)nxagentShadowWindowPtr); nxagentResizeScreen(pScreen, nxagentShadowWidth, nxagentShadowHeight, pScreen -> mmWidth, pScreen -> mmHeight); nxagentShadowCreateMainWindow(pScreen, pWin, nxagentShadowWidth, nxagentShadowHeight); if (nxagentRemoteMajor <= 3) { nxagentShadowSetWindowsSize(); nxagentSetWMNormalHints(0, nxagentOption(Width), nxagentOption(Height)); } XMapWindow(nxagentDisplay, nxagentDefaultWindows[0]); /* * Clean up the main window. */ XGCValues value = { .foreground = 0x00000000, .background = 0x00000000, .plane_mask = 0xffffffff, .fill_style = FillSolid, }; XlibGC gc = XCreateGC(nxagentDisplay, nxagentPixmap(nxagentShadowPixmapPtr), GCBackground | GCForeground | GCFillStyle | GCPlaneMask, &value); XFillRectangle(nxagentDisplay, nxagentPixmap(nxagentShadowPixmapPtr), gc, 0, 0, nxagentShadowWidth, nxagentShadowHeight); XFreeGC(nxagentDisplay, gc); RegionInit(&nxagentShadowUpdateRegion, (BoxRec*)NULL, 1); return 0; } int nxagentShadowCreateMainWindow(ScreenPtr pScreen, WindowPtr pWin, int width, int height) { nxagentShadowWidth = width; nxagentShadowHeight = height; NXShadowUpdateBuffer((void *)&nxagentShadowBuffer); #ifdef TEST fprintf(stderr, "nxagentShadowCreateMainWindow: Update frame buffer [%p].\n", nxagentShadowBuffer); #endif nxagentShadowSetWindowOptions(); if (nxagentShadowPixmapPtr != NULL) { nxagentDestroyPixmap(nxagentShadowPixmapPtr); } if (nxagentShadowWindowPtr != NULL) { DeleteWindow(nxagentShadowWindowPtr, accessWindowID); } nxagentShadowPixmapPtr = nxagentCreatePixmap(pScreen, nxagentShadowWidth, nxagentShadowHeight, nxagentShadowDepth, 0); if (nxagentShadowPixmapPtr) { ChangeResourceValue(accessPixmapID, RT_PIXMAP, (void *) nxagentShadowPixmapPtr); nxagentShadowPixmapPtr -> drawable.id = accessPixmapID; #ifdef TEST fprintf(stderr, "nxagentShadowCreateMainWindow: nxagentShadowPixmapPtr [%p] PixmapM -> drawable.id [%lu].\n", (void *)nxagentShadowPixmapPtr, nxagentShadowPixmapPtr -> drawable.id); fprintf(stderr, "nxagentShadowCreateMainWindow: Create pixmap with width [%d] height [%d] depth [%d].\n", nxagentShadowWidth, nxagentShadowHeight, (int)nxagentShadowDepth); #endif } else { #ifdef PANIC fprintf(stderr, "nxagentShadowCreateMainWindow: PANIC! Failed to create pixmap with width [%d] height [%d] depth [%d].\n", nxagentShadowWidth, nxagentShadowHeight, (int)nxagentShadowDepth); #endif } XFreePixmap(nxagentDisplay, nxagentPixmap(nxagentVirtualPixmap(nxagentShadowPixmapPtr))); XID xid = XCreatePixmap(nxagentDisplay, nxagentDefaultWindows[0], nxagentScale(nxagentShadowWidth, nxagentOption(XRatio)), nxagentScale(nxagentShadowHeight, nxagentOption(YRatio)), nxagentShadowDepth); nxagentPixmap(nxagentVirtualPixmap(nxagentShadowPixmapPtr)) = xid; nxagentPixmap(nxagentRealPixmap(nxagentShadowPixmapPtr)) = xid; if (nxagentShadowGCPtr != NULL) { FreeScratchGC(nxagentShadowGCPtr); } /* * FIXME: Should use CreateGC. */ nxagentShadowGCPtr = GetScratchGC(nxagentShadowPixmapPtr -> drawable.depth, nxagentShadowPixmapPtr -> drawable.pScreen); if (nxagentShadowGCPtr) { #ifdef TEST fprintf(stderr, "nxagentShadowCreateMainWindow: Created GC with pGC[%p]\n", (void *) nxagentShadowGCPtr); #endif ValidateGC((DrawablePtr)nxagentShadowPixmapPtr, nxagentShadowGCPtr); } else { #ifdef PANIC fprintf(stderr, "nxagentShadowCreateMainWindow: PANIC! Failed to create GC."); #endif } Mask mask = CWBackPixmap | CWEventMask | CWCursor; Mask maskb = nxagentGetDefaultEventMask() | ResizeRedirectMask | ExposureMask; XID values[4]; XID *vlist = values; *vlist++ = (XID)nxagentShadowPixmapPtr -> drawable.id; *vlist++ = (XID)maskb; *vlist = (XID)None; int error; nxagentShadowWindowPtr = CreateWindow(accessWindowID, pWin, 0, 0, nxagentShadowWidth, nxagentShadowHeight, 0, InputOutput, mask, (XID *)values, nxagentShadowDepth, serverClient, CopyFromParent, &error); mask = CWWidth | CWHeight; XWindowChanges changes = { .width = nxagentScale(nxagentShadowWidth, nxagentOption(XRatio)), .height = nxagentScale(nxagentShadowHeight, nxagentOption(YRatio)) }; XConfigureWindow(nxagentDisplay, nxagentWindow(nxagentShadowWindowPtr), mask, &changes); nxagentMoveViewport(pScreen, 0, 0); if (nxagentShadowWindowPtr && !error) { #ifdef TEST fprintf(stderr, "nxagentShadowCreateMainWindow: Create window with nxagentShadowWindowPtr [%p]" "nxagentShadowWindowPtr -> drawable.id [%lu].\n", (void *) nxagentShadowWindowPtr, nxagentShadowWindowPtr -> drawable.id); fprintf(stderr, "nxagentShadowCreateMainWindow: parent nxagentShadowWindowPtr [%p] parent -> drawable.id [%lu].\n", (void *)nxagentShadowWindowPtr->parent, nxagentShadowWindowPtr -> parent -> drawable.id); #endif ChangeResourceValue(accessWindowID, RT_WINDOW, (void *) nxagentShadowWindowPtr); } else { #ifdef PANIC fprintf(stderr, "nxagentShadowCreateMainWindow: PANIC! Failed to create window.\n"); #endif } XMapWindow(nxagentDisplay, nxagentWindow(nxagentShadowWindowPtr)); MapWindow(nxagentShadowWindowPtr, serverClient); mask = CWX | CWY | CWWidth | CWHeight; changes.x = nxagentOption(RootX); changes.y = nxagentOption(RootY); changes.width = nxagentScale(nxagentShadowWidth, nxagentOption(XRatio)); changes.height = nxagentScale(nxagentShadowHeight, nxagentOption(YRatio)); XConfigureWindow(nxagentDisplay, nxagentWindow(pWin), mask, &changes); #ifdef TEST fprintf(stderr, "nxagentShadowCreateMainWindow: Completed mapping of Access window.\n"); #endif return 0; } int nxagentShadowSendUpdates(int *suspended) { *suspended = 0; if (RegionNil(&nxagentShadowUpdateRegion) == 1) { return 0; } nxagentMarkCorruptedRegion((DrawablePtr)nxagentShadowPixmapPtr, &nxagentShadowUpdateRegion); RegionEmpty(&nxagentShadowUpdateRegion); return 1; } int nxagentShadowPoll(PixmapPtr shadowPixmapPtr, GCPtr shadowGCPtr, unsigned char shadowDepth, int shadowWidth, int shadowHeight, char *shadowBuffer, int *changed, int *suspended) { RegionRec updateRegion; RegionRec tempRegion; RegionNull(&updateRegion); RegionNull(&tempRegion); int result = NXShadowHasChanged(nxagentUserInput, NULL, suspended); *changed = result; if (result == 1) { char *tBuffer = NULL; char *iBuffer, *ptBox; nxagentRemoveSplashWindow(); long numRects; NXShadowExportChanges(&numRects, &ptBox); BoxRec *pBox = (BoxRec *)ptBox; #ifdef TEST fprintf(stderr, "nxagentShadowPoll: nRects[%ld], pBox[%p] depth[%d].\n", numRects, (void *) pBox, shadowDepth); #endif for (int n = 0; n < numRects; n++) { /* * The BoxRec struct defined in the Xserver has a different * variable order in comparison with the BoxRec struct in the Xlib. * the second and third field are inverted. */ int x = pBox[n].x1; int y = pBox[n].x2; int y2 = pBox[n].y2; unsigned int width = pBox[n].y1 - pBox[n].x1;/* y1 = x2 */ unsigned int height = y2 - pBox[n].x2; /* x2 = y1 */ if((x + width) > shadowWidth || (y + height) > shadowHeight) { /* * Out of bounds. Maybe a resize of the master session is going on. */ continue; } int line = PixmapBytePad(width, nxagentMasterDepth); #ifdef DEBUG fprintf(stderr, "nxagentShadowPoll: Rectangle Number[%d] - x[%d]y[%d]W[%u]H[%u].\n", n+1, x, y, width, height); #endif unsigned int length = nxagentImageLength(width, height, ZPixmap, 0, nxagentMasterDepth); SAFE_free(tBuffer); tBuffer = malloc(length); if (tBuffer == NULL) { #ifdef PANIC fprintf(stderr, "nxagentShadowPoll: malloc failed.\n"); #endif return -1; } iBuffer = tBuffer; for (int c = 0; c + y < y2; c++) { memcpy(tBuffer, shadowBuffer + x * nxagentBppMaster + (y + c) * shadowWidth * nxagentBppMaster, line); tBuffer += line; } tBuffer = iBuffer; if (nxagentCheckDepth == 1) { nxagentShadowAdaptDepth(width, height, line, &tBuffer); } fbPutImage(nxagentVirtualDrawable((DrawablePtr)shadowPixmapPtr), shadowGCPtr, shadowDepth, x, y, width, height, 0, ZPixmap, tBuffer); BoxRec box = {.x1 = x, .x2 = x + width, .y1 = y, .y2 = y + height}; RegionInit(&tempRegion, &box, 1); RegionAppend(&updateRegion, &tempRegion); RegionUninit(&tempRegion); int overlap; RegionValidate(&updateRegion, &overlap); RegionUnion(&nxagentShadowUpdateRegion, &nxagentShadowUpdateRegion, &updateRegion); } SAFE_free(tBuffer); RegionUninit(&updateRegion); } else if (result == -1) { #ifdef TEST fprintf(stderr, "nxagentShadowPoll: polling failed!\n"); #endif usleep(50 * 1000); return -1; } return 0; } void nxagentShadowAdaptDepth(unsigned int width, unsigned int height, unsigned int lineMaster, char **buffer) { unsigned char * tBuffer = (unsigned char *) *buffer; unsigned int length = nxagentImageLength(width, height, ZPixmap, 0, nxagentShadowDepth); unsigned char *cBuffer = malloc(length); unsigned char *icBuffer = cBuffer; Visual *pVisual = nxagentImageVisual((DrawablePtr) nxagentShadowPixmapPtr, nxagentShadowDepth); if (pVisual == NULL) { #ifdef WARNING fprintf(stderr, "nxagentCorrectDepthShadow: WARNING! Visual not found. Using default visual.\n"); #endif pVisual = nxagentVisuals[nxagentDefaultVisualIndex].visual; } #ifdef TEST fprintf(stderr, "nxagentCorrectDepthShadow: Shadow redMask [%lu] greenMask[%lu] blueMask[%lu].\n", pVisual -> red_mask, pVisual -> green_mask, pVisual -> blue_mask); #endif unsigned long redMask = nxagentShadowDisplay -> screens[0].root_visual[0].red_mask; unsigned long greenMask = nxagentShadowDisplay -> screens[0].root_visual[0].green_mask; unsigned long blueMask = nxagentShadowDisplay -> screens[0].root_visual[0].blue_mask; #ifdef TEST fprintf(stderr, "nxagentCorrectDepthShadow: Master redMask [%lu] greenMask[%lu] blueMask[%lu].\n", redMask, greenMask, blueMask); #endif switch(nxagentMasterDepth) { /* * The Shadow agent has 24 bit depth. */ case 16: { unsigned int pad = lineMaster - nxagentBppMaster * width; #ifdef TEST fprintf(stderr, "nxagentCorrectDepthShadow: line [%d] width[%d] pad[%d].\n", lineMaster, width, pad); #endif while (height > 0) { for (unsigned int c = 0; c < width ; c++) { unsigned char red; unsigned char green; unsigned char blue; unsigned short color16; if (imageByteOrder == LSBFirst) { color16 = *tBuffer++; color16 |= (*tBuffer << 8); } else { color16 = (*tBuffer++) << 8; color16 |= *tBuffer; } blue = ((short) blueMask & color16) << 3; blue |= 0x3; if (greenMask == 0x7e0) { /* * bit mask 5-6-5 */ green = ((short) greenMask & color16) >> 3; green |= 0x2; red = ((short) redMask & color16) >> 8; red |= 0x3; } else { /* * bit mask 5-5-5 */ green = ((short) greenMask & color16) >> 2; green |= 0x3; red = ((short) redMask & color16) >> 7; red |= 0x3; } tBuffer++; if (nxagentDisplay -> byte_order == LSBFirst) { *cBuffer++ = blue; *cBuffer++ = green; *cBuffer++ = red; cBuffer++; } else { cBuffer++; *cBuffer++ = red; *cBuffer++ = green; *cBuffer++ = blue; } } tBuffer += pad; height--; } break; } /* * The Shadow agent has 16 bit depth. */ case 24: { unsigned int lineShadow = PixmapBytePad(width, nxagentShadowDepth); unsigned int pad = lineShadow - nxagentBppShadow * width; #ifdef TEST fprintf(stderr, "nxagentCorrectDepthShadow: line [%d] width[%d] pad[%d].\n", lineShadow, width, pad); #endif while (height > 0) { for (unsigned int c = 0; c < width; c++) { unsigned short color16; unsigned int color32; if (imageByteOrder == LSBFirst) { color32 = *tBuffer++; color32 |= (*tBuffer++ << 8); color32 |= (*tBuffer++ << 16); tBuffer++; } else { tBuffer++; color32 = (*tBuffer++ << 16); color32 |= (*tBuffer++ << 8); color32 |= *tBuffer++; } color16 = (color32 & (pVisual -> blue_mask << 3)) >> 3; if (pVisual -> green_mask == 0x7e0) { /* * bit mask 5-6-5 */ color16 |= (color32 & (pVisual -> green_mask << 5)) >> 5; color16 |= (color32 & (pVisual -> red_mask << 8)) >> 8; } else { /* * bit mask 5-5-5 */ color16 |= (color32 & (pVisual -> green_mask << 6)) >> 6; color16 |= (color32 & (pVisual -> red_mask << 9)) >> 9; } if (nxagentDisplay -> byte_order == LSBFirst) { *cBuffer++ = color16 & 0xff; *cBuffer++ = (color16 & 0xff00) >> 8; } else { *cBuffer++ = (color16 & 0xff00) >> 8; *cBuffer++ = color16 & 0xff; } } cBuffer += pad; height--; } break; } } cBuffer = (unsigned char *) *buffer; *buffer = (char *) icBuffer; SAFE_free(cBuffer); } #ifdef NXAGENT_ARTSD unsigned char fromHexNibble(char c) { int uc = (unsigned char)c; if(uc >= '0' && uc <= '9') return uc - (unsigned char)'0'; if(uc >= 'a' && uc <= 'f') return uc + 10 - (unsigned char)'a'; if(uc >= 'A' && uc <= 'F') return uc + 10 - (unsigned char)'A'; return 16; /*error*/ } void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port) { char tchar[] = " "; /* FIXME: The port information is not used at the moment and produces a warning on recent gcc versions. Do we need such information to run the audio forwarding? char *chport; char hex[] = "0123456789abcdef"; */ Window rootWin = DefaultRootWindow(nxagentDisplay); XlibAtom propAtom = nxagentAtoms[4]; /* MCOPGLOBALS */ XlibAtom atomReturnType; int iReturnFormat; unsigned long ulReturnItems; unsigned long ulReturnBytesLeft; unsigned char *pszReturnData = NULL; /* * Get at most 64KB of data. */ int iReturn = XGetWindowProperty(nxagentDisplay, rootWin, propAtom, 0, 65536 / 4, False, XA_STRING, &atomReturnType, &iReturnFormat, &ulReturnItems, &ulReturnBytesLeft, &pszReturnData); if (iReturn == Success && atomReturnType != None && ulReturnItems > 0 && pszReturnData != NULL) { #ifdef TEST fprintf(stderr, "nxagentPropagateArtsdProperties: Got [%ld] elements of format [%d] with [%ld] bytes left.\n", ulReturnItems, iReturnFormat, ulReturnBytesLeft); #endif #ifdef WARNING if (ulReturnBytesLeft > 0) { fprintf(stderr, "nxagentPropagateArtsdProperties: WARNING! Could not get the whole ARTSD property data.\n"); } #endif char *local_buf = (char *) malloc(strlen((char*)pszReturnData) + 100); if (local_buf) { memset(local_buf, 0, strlen((char *) pszReturnData)); int i, in; for (i = 0, in = 0; pszReturnData[i] != '\0'; i++) { local_buf[in] = pszReturnData[i]; if(pszReturnData[i] == ':') { i++; while(pszReturnData[i] != '\n') { unsigned char h = fromHexNibble(pszReturnData[i]); i++; if (pszReturnData[i] == '\0') continue; unsigned char l = fromHexNibble(pszReturnData[i]); i++; if(h >= 16 || l >= 16) continue; /* * FIXME: The array tchar[] was used uninitialized. It's * not clear to me the original purpose of the piece of * code using it. To be removed in future versions. */ tchar[0] = tchar[1]; tchar[1] = tchar[2]; tchar[2] = tchar[3]; tchar[3] = (h << 4) + l; tchar[4] ='\0'; if (strncmp(tchar, "tcp:", 4) == 0) { local_buf[in - 7] = '1'; local_buf[in - 6] = strlen(port) + 47; in++; local_buf[in] = pszReturnData[i - 2]; in++; local_buf[in] = pszReturnData[i - 1]; /* "localhost:" */ strcat(local_buf,"6c6f63616c686f73743a"); in += 20; /* FIXME: The port information is not used at the moment and produces a warning on recent gcc versions. Do we need such information to run the audio forawrding? chport = &port[0]; while(*chport != '\0') { in++; local_buf[in] = hex[(*chport >> 4) & 0xf]; in++; local_buf[in] = hex[*chport & 0xf]; *chport++; } */ strcat(local_buf,"00"); in += 2; while(pszReturnData[i] != '\n') { i++; } } else { in++; local_buf[in] = pszReturnData[i - 2]; in++; local_buf[in] = pszReturnData[i - 1]; } } in++; local_buf[in] = pszReturnData[i]; } in++; } local_buf[in] = 0; if (strlen(local_buf)) { mcop_local_atom = MakeAtom(mcop_atom, strlen(mcop_atom), 1); ChangeWindowProperty(pScreen->root, mcop_local_atom, XA_STRING, iReturnFormat, PropModeReplace, strlen(local_buf), local_buf, 1); } SAFE_free(local_buf); } } } #endif Bool nxagentReconnectScreen(void *p0) { PixmapPtr pPixmap = (PixmapPtr)nxagentDefaultScreen->devPrivate; #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_SCREEN_DEBUG) fprintf(stderr, "nxagentReconnectScreen\n"); #endif if (!nxagentOpenScreen(nxagentDefaultScreen, nxagentArgc, nxagentArgv)) { return False; } nxagentPixmap(pPixmap) = XCreatePixmap(nxagentDisplay, nxagentDefaultWindows[nxagentDefaultScreen->myNum], pPixmap -> drawable.width, pPixmap -> drawable.height, pPixmap -> drawable.depth); #ifdef NXAGENT_RECONNECT_SCREEN_DEBUG fprintf(stderr, "nxagentReconnectScreen: recreated %p - ID %lx\n", pPixmap, nxagentPixmap( pPixmap )); #endif CARD16 w = 16; CARD16 h = 16; (*nxagentDefaultScreen->QueryBestSize)(StippleShape, &w, &h, nxagentDefaultScreen); if (!(nxagentPixmap(nxagentDefaultScreen->PixmapPerDepth[0]) = XCreatePixmap(nxagentDisplay, nxagentDefaultDrawables[1], w, h, 1))); Mask mask = nxagentGetDefaultEventMask(); mask |= NXAGENT_KEYBOARD_EVENT_MASK | NXAGENT_POINTER_EVENT_MASK; nxagentSetDefaultEventMask(mask); XSelectInput(nxagentDisplay, nxagentDefaultWindows[0], mask); /* * Turn off the screen-saver and reset the * time to the next auto-disconnection. */ SaveScreens(SCREEN_SAVER_OFF, ScreenSaverActive); lastDeviceEventTime.milliseconds = GetTimeInMillis(); return True; } /* intersect two rectangles */ Bool intersect(int ax1, int ay1, unsigned int aw, unsigned int ah, int bx1, int by1, unsigned int bw, unsigned int bh, int *x, int *y, unsigned int *w, unsigned int *h) { int ax2 = ax1 + aw; int ay2 = ay1 + ah; int bx2 = bx1 + bw; int by2 = by1 + bh; /* thanks to http://silentmatt.com/rectangle-intersection */ /* check if there's any intersection at all */ if (ax2 < bx1 || bx2 < ax1 || ay2 < by1 || by2 < ay1) { #ifdef DEBUG fprintf(stderr, "intersect: the given rectangles do not intersect at all\n"); #endif return FALSE; } int tx1 = max(ax1, bx1); int ty1 = max(ay1, by1); int tx2 = min(ax2, bx2); int ty2 = min(ay2, by2); int ix = tx1 - ax1; int iy = ty1 - ay1; unsigned int iw = tx2 - tx1; unsigned int ih = ty2 - ty1; /* check if the resulting rectangle is feasible */ if (iw <= 0 || ih <= 0) { #ifdef DEBUG fprintf(stderr, "intersect: intersection rectangle not feasible\n"); #endif return FALSE; } *x = ix; *y = iy; *w = iw; *h = ih; #ifdef DEBUG fprintf(stderr, "intersect: intersection is: ([%d],[%d]) [ %d x %d ]\n", *x, *y, *w, *h); #endif return TRUE; } #ifndef NXAGENT_RANDR_XINERAMA_CLIPPING /* intersect two rectangles, return aw/ah for w/h if resulting rectangle is (partly) outside of bounding box */ Bool intersect_bb(int ax1, int ay1, unsigned int aw, unsigned int ah, int bx1, int by1, unsigned int bw, unsigned int bh, int bbx1, int bby1, int bbx2, int bby2, int *x, int *y, unsigned int *w, unsigned int *h) { #ifdef DEBUG fprintf(stderr, "intersect_bb: session window: ([%d],[%d]) [ %d x %d ]\n", ax1, ay1, aw, ah); fprintf(stderr, "intersect_bb: crtc: ([%d],[%d]) [ %d x %d ]\n", bx1, by1, bw, bh); fprintf(stderr, "intersect_bb: bounding box: ([%d],[%d]) [ %d x %d ]\n", bbx1, bby1, bbx2-bbx1, bby2-bby1); #endif Bool result = intersect(ax1, ay1, aw, ah, bx1, by1, bw, bh, x, y, w, h); if (result == TRUE) { /* * ###### The X-Coordinate ###### */ /* check if outside-left of bounding box */ if (bx1 == bbx1 && ax1 < bbx1) { *w += bbx1 - ax1; *x = 0; #ifdef DEBUG fprintf(stderr, "intersect_bb: session box is outside-left of the bounding box - width gets adapted to [%d]\n", *w); #endif } /* check if outside-right of bounding box */ if (bx1 + bw == bbx2 && ax1 + aw > bbx2) { *w += ax1 + aw - bbx2; #ifdef DEBUG fprintf(stderr, "intersect_bb: session box is outside-right of the bounding box - width gets adapted to [%d]\n", *w); #endif } /* * ###### The Y-Coordinate ###### */ /* check if outside-above of bounding box */ if (by1 == bby1 && ay1 < bby1) { *h += bby1 - ay1; *y = 0; #ifdef DEBUG fprintf(stderr, "intersect_bb: session box is outside-above of the bounding box - height gets adapted to [%d]\n", *h); #endif } /* check if outside-below of bounding box */ if (by1 + bh == bby2 && ay1 + ah > bby2) { *h += ay1 + ah - bby2; #ifdef DEBUG fprintf(stderr, "intersect_bb: session box is outside-below of the bounding box - height gets adapted to [%d]\n", *h); #endif } } return result; } #endif RRModePtr nxagentRRCustomMode = NULL; /* This is basically the code that was used on screen resize before xinerama was implemented. We need it as fallback if the user disables xinerama */ void nxagentAdjustCustomMode(ScreenPtr pScreen) { rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen); if (pScrPriv) { RROutputPtr output = RRFirstOutput(pScreen); if (output && output -> crtc) { const int refresh = 60; int width = nxagentOption(Width); int height = nxagentOption(Height); RRCrtcPtr crtc = output -> crtc; for (int c = 0; c < pScrPriv -> numCrtcs; c++) { RRCrtcSet(pScrPriv -> crtcs[c], NULL, 0, 0, RR_Rotate_0, 0, NULL); } char name[100]; sprintf(name, "%dx%d", width, height); xRRModeInfo modeInfo = { .width = width, .height = height, .hTotal = width, .vTotal = height, .dotClock = ((CARD32) width * (CARD32) height * (CARD32) refresh), .nameLength = strlen(name) }; if (nxagentRRCustomMode != NULL) { RROutputDeleteUserMode(output, nxagentRRCustomMode); FreeResource(nxagentRRCustomMode -> mode.id, 0); if (crtc != NULL && crtc -> mode == nxagentRRCustomMode) { RRCrtcSet(crtc, NULL, 0, 0, RR_Rotate_0, 0, NULL); } #ifdef TEST fprintf(stderr, "%s: Going to destroy mode %p with refcnt %d.\n", __func__, nxagentRRCustomMode, nxagentRRCustomMode->refcnt); #endif RRModeDestroy(nxagentRRCustomMode); } nxagentRRCustomMode = RRModeGet(&modeInfo, name); RROutputAddUserMode(output, nxagentRRCustomMode); RRCrtcSet(crtc, nxagentRRCustomMode, 0, 0, RR_Rotate_0, 1, &output); RROutputChanged(output, 1); } pScrPriv -> lastSetTime = currentTime; pScrPriv->changed = 1; pScrPriv->configChanged = 1; } /* if (pScrPriv) */ RRScreenSizeNotify(pScreen); } int nxagentChangeScreenConfig(int screen, int width, int height) { #ifdef DEBUG fprintf(stderr, "nxagentChangeScreenConfig: called for screen [%d], width [%d] height [%d]\n", screen, width, height); #endif #ifdef TEST fprintf(stderr, "nxagentChangeScreenConfig: screenInfo.screens[%d]->root [%p]\n", screen, (void *) screenInfo.screens[screen]); #endif if (screenInfo.screens[screen]->root == NULL) { return 0; } UpdateCurrentTime(); #ifdef DEBUG if (nxagentGrabServerInfo.grabstate == SERVER_GRABBED) fprintf(stderr, "nxagentChangeScreenConfig: grabstate [SERVER_GRABBED], client [%p]\n", (void *) nxagentGrabServerInfo.client); else if (nxagentGrabServerInfo.grabstate == SERVER_UNGRABBED) fprintf(stderr, "nxagentChangeScreenConfig: grabstate [SERVER_UNGRABBED], client [%p]\n", (void *) nxagentGrabServerInfo.client); else if (nxagentGrabServerInfo.grabstate == CLIENT_PERVIOUS) fprintf(stderr, "nxagentChangeScreenConfig: grabstate [CLIENT_PERVIOUS], client [%p]\n", (void *) nxagentGrabServerInfo.client); else if (nxagentGrabServerInfo.grabstate == CLIENT_IMPERVIOUS) fprintf(stderr, "nxagentChangeScreenConfig: grabstate [CLIENT_IMPERVIOUS], client [%p]\n", (void *) nxagentGrabServerInfo.client); else fprintf(stderr, "nxagentChangeScreenConfig: grabstate [UNKNOWN], client [%p]\n", (void *) nxagentGrabServerInfo.client); #endif if (nxagentGrabServerInfo.grabstate == SERVER_GRABBED && nxagentGrabServerInfo.client != NULL) { /* * If any client grabbed the server it won't expect screen * configuration changes until it releases the grab. That could * lead to an X error because available modes are changed * in the meantime. */ #ifdef TEST fprintf(stderr, "nxagentChangeScreenConfig: Cancel with grabbed server (grab held by [%p]).\n", (void *) nxagentGrabServerInfo.client); #endif return 0; } ScreenPtr pScreen = screenInfo.screens[screen] -> root -> drawable.pScreen; #ifdef TEST fprintf(stderr, "nxagentChangeScreenConfig: Changing config to %d x %d\n", width, height); #endif int r = nxagentResizeScreen(pScreen, width, height, 0, 0); if (r != 0) { if (nxagentOption(Xinerama) && (noRRXineramaExtension == FALSE)) { nxagentAdjustRandRXinerama(pScreen); } else { #ifdef DEBUG fprintf(stderr, "%s: Xinerama is disabled\n", __func__); #endif nxagentAdjustCustomMode(pScreen); } } #ifdef DEBUG fprintf(stderr, "nxagentChangeScreenConfig: current geometry: %d,%d %dx%d\n", nxagentOption(X), nxagentOption(Y), nxagentOption(Width), nxagentOption(Height)); fprintf(stderr, "nxagentChangeScreenConfig: returning [%d]\n", r); #endif return r; } /* Destroy an output after removing it from any crtc that might reference it */ void nxagentDropOutput(RROutputPtr o) { RRCrtcPtr c = o->crtc; if (c) { for (int i = 0; i < c->numOutputs; i++) { if (c->outputs[i] == o) { #ifdef DEBUG fprintf(stderr, "nxagentDropOutput: output [%s] is in use by crtc [%p], removing it from there\n", o->name, c); #endif RRCrtcSet(c, NULL, 0, 0, RR_Rotate_0, 0, NULL); } } } #ifdef DEBUG fprintf(stderr, "nxagentDropOutput: destroying output [%s]\n", o->name); #endif RROutputDestroy(o); } int nxagentAdjustRandRXinerama(ScreenPtr pScreen) { int width = nxagentOption(Width); int height = nxagentOption(Height); rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen); if (pScrPriv) { int number = 0; XineramaScreenInfo *screeninfo = XineramaQueryScreens(nxagentDisplay, &number); if (number) { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: XineramaQueryScreens() returned [%d] screens:\n", number); for (int i = 0; i < number; i++) { fprintf(stderr, "nxagentAdjustRandRXinerama: screen_number [%d] x_org [%d] y_org [%d] width [%d] height [%d]\n", screeninfo[i].screen_number, screeninfo[i].x_org, screeninfo[i].y_org, screeninfo[i].width, screeninfo[i].height); } #endif } else { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: XineramaQueryScreens() failed - continuing without Xinerama\n"); #endif } /* * if there's no xinerama on the real server or xinerama is * disabled in nxagent we only report one big screen. Clients * still see xinerama enabled but it will report only one (big) * screen. This is consistent with the way rrxinerama always * behaved. The single PanoramiX/Xinerama extension however * disables xinerama if only one screen exists. */ if (number == 0) { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: faking xinerama\n"); #endif number = 1; SAFE_free(screeninfo); if (!(screeninfo = malloc(sizeof(XineramaScreenInfo)))) { return FALSE; } /* fake a xinerama screeninfo that covers the whole screen */ screeninfo->screen_number = 0; screeninfo->x_org = nxagentOption(X); screeninfo->y_org = nxagentOption(Y); screeninfo->width = nxagentOption(Width); screeninfo->height = nxagentOption(Height); } #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: numCrtcs [%d], numOutputs [%d]\n", pScrPriv->numCrtcs, pScrPriv->numOutputs); { /* * Convert old RANDR 1.0 data (if any) to current structure. This * is needed once at the first run of this function. If we don't * do this here it will be done implicitly later and add mode(s) to * our crtc(s)! */ Bool rrgetinfo = RRGetInfo(pScreen, FALSE); fprintf(stderr, "nxagentAdjustRandRXinerama: RRGetInfo returned [%d]\n", rrgetinfo); } #else /* we are not interested in the return code */ RRGetInfo(pScreen, FALSE); #endif #ifndef NXAGENT_RANDR_XINERAMA_CLIPPING /* calculate bounding box (outer edges) */ int bbx2, bbx1, bby1, bby2; bbx2 = bby2 = 0; bbx1 = bby1 = INT_MAX; for (int i = 0; i < number; i++) { bbx2 = max(bbx2, screeninfo[i].x_org + screeninfo[i].width); bby2 = max(bby2, screeninfo[i].y_org + screeninfo[i].height); bbx1 = min(bbx1, screeninfo[i].x_org); bby1 = min(bby1, screeninfo[i].y_org); } #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: bounding box: left [%d] right [%d] top [%d] bottom [%d]\n", bbx1, bbx2, bby1, bby2); #endif #endif #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: numCrtcs [%d], numOutputs [%d]\n", pScrPriv->numCrtcs, pScrPriv->numOutputs); #endif /* adjust the number of CRTCs to match the number of reported xinerama screens on the real server */ while (number != pScrPriv->numCrtcs) { if (number < pScrPriv->numCrtcs) { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: destroying crtc\n"); #endif /* first reset the crtc to free possible outputs, then destroy the crtc */ RRCrtcSet(pScrPriv->crtcs[pScrPriv->numCrtcs - 1], NULL, 0, 0, RR_Rotate_0, 0, NULL); RRCrtcDestroy(pScrPriv->crtcs[pScrPriv->numCrtcs - 1]); } else { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: adding crtc\n"); #endif RRCrtcCreate(pScreen, NULL); } } #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: numCrtcs [%d], numOutputs [%d]\n", pScrPriv->numCrtcs, pScrPriv->numOutputs); #endif /* set gamma. Currently the only reason for doing this is preventing the xrandr command from complaining about missing gamma. */ for (int i = 0; i < pScrPriv->numCrtcs; i++) { if (pScrPriv->crtcs[i]->gammaSize == 0) { CARD16 gamma = 0; RRCrtcGammaSetSize(pScrPriv->crtcs[i], 1); RRCrtcGammaSet(pScrPriv->crtcs[i], &gamma, &gamma, &gamma); RRCrtcGammaNotify(pScrPriv->crtcs[i]); } } /* delete superfluous non-NX outputs */ for (int i = pScrPriv->numOutputs - 1; i >= 0; i--) if (strncmp(pScrPriv->outputs[i]->name, "NX", 2)) nxagentDropOutput(pScrPriv->outputs[i]); /* at this stage only NX outputs are left - we delete the superfluous ones */ for (int i = pScrPriv->numOutputs - 1; i >= number; i--) nxagentDropOutput(pScrPriv->outputs[i]); /* add and init outputs */ for (int i = 0; i < number; i++) { RROutputPtr output; if (i >= pScrPriv->numOutputs) { char name[100]; sprintf(name, "NX%d", i+1); output = RROutputCreate(pScreen, name, strlen(name), NULL); /* will be done later RROutputSetConnection(output, RR_Disconnected); */ #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: created new output [%s]\n", name); #endif } else { output = pScrPriv->outputs[i]; } #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: adjusting output [%s]\n", pScrPriv->outputs[i]->name); #endif RROutputSetCrtcs(output, &(pScrPriv->crtcs[i]), 1); /* FIXME: Isn't there a function for setting this? */ output->crtc = pScrPriv->crtcs[i]; /* FIXME: get SubPixelOrder from real X server */ RROutputSetSubpixelOrder(output, SubPixelUnknown); /* FIXME: What is the correct physical size here? */ RROutputSetPhysicalSize(output, 0, 0); } for (int i = 0; i < pScrPriv->numOutputs; i++) { int new_x = 0; int new_y = 0; unsigned int new_w = 0; unsigned int new_h = 0; /* if there's no intersection disconnect the output */ #ifdef NXAGENT_RANDR_XINERAMA_CLIPPING Bool disable_output = !intersect(nxagentOption(X), nxagentOption(Y), width, height, screeninfo[i].x_org, screeninfo[i].y_org, screeninfo[i].width, screeninfo[i].height, &new_x, &new_y, &new_w, &new_h); #else Bool disable_output = !intersect_bb(nxagentOption(X), nxagentOption(Y), width, height, screeninfo[i].x_org, screeninfo[i].y_org, screeninfo[i].width, screeninfo[i].height, bbx1, bby1, bbx2, bby2, &new_x, &new_y, &new_w, &new_h); #endif /* save previous mode */ RRModePtr prevmode = pScrPriv->crtcs[i]->mode; #ifdef DEBUG if (prevmode) { fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: prevmode [%s] ([%p]) refcnt [%d]\n", i, pScrPriv->outputs[i]->name, prevmode->name, (void *)prevmode, prevmode->refcnt); } else { fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: no prevmode\n", i, pScrPriv->outputs[i]->name); } #endif RROutputSetCrtcs(pScrPriv->outputs[i], &(pScrPriv->crtcs[i]), 1); if (disable_output) { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: no (valid) intersection - disconnecting\n", i, pScrPriv->outputs[i]->name); #endif RROutputSetConnection(pScrPriv->outputs[i], RR_Disconnected); /* * Tests revealed that some window managers (e.g. LXDE) also * take disconnected outputs into account when calculating * stuff like wallpaper tile size and maximum window * size. This is problematic when a disconnected output is * smaller than any of the connected ones. Solution: unset the * mode of the output's crtc. This also leads to xinerama not * showing the disconnected head anymore. */ if (prevmode) { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: removing mode from output [%d] name [%s]\n", i, pScrPriv->outputs[i]->name); #endif RROutputSetModes(pScrPriv->outputs[i], NULL, 0, 0); #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: removing mode from ctrc [%d]\n", i); #endif RRCrtcSet(pScrPriv->crtcs[i], NULL, 0, 0, RR_Rotate_0, 1, &(pScrPriv->outputs[i])); } } else { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: intersection is x [%d] y [%d] width [%d] height [%d]\n", i, pScrPriv->outputs[i]->name, new_x, new_y, new_w, new_h); #endif RROutputSetConnection(pScrPriv->outputs[i], RR_Connected); /* avoid collisions with pre-existing default modes by using a separate namespace. If we'd simply use XxY we could not distinguish between pre-existing modes which should stay and our own modes that should be removed after use. */ char name[100]; sprintf(name, "%s%dx%d", QUOTE(NXAGENT_RANDR_MODE_PREFIX), new_w, new_h); const int refresh = 60; xRRModeInfo modeInfo = { .width = new_w, .height = new_h, .hTotal = new_w, .vTotal = new_h, .dotClock = ((CARD32) new_w * (CARD32) new_h * (CARD32) refresh), .nameLength = strlen(name) }; RRModePtr mymode = RRModeGet(&modeInfo, name); #ifdef DEBUG if (mymode) { fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: mode [%s] ([%p]) created/received, refcnt [%d]\n", i, pScrPriv->outputs[i]->name, name, (void *) mymode, mymode->refcnt); } else { /* FIXME: what is the correct behaviour in this case? */ fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: mode [%s] creation failed!\n", i, pScrPriv->outputs[i]->name, name); } #endif if (prevmode && mymode == prevmode) { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: mymode [%s] ([%p]) == prevmode [%s] ([%p])\n", mymode->name, (void *) mymode, prevmode->name, (void *)prevmode); #endif /* if they are the same RRModeGet() has increased the refcnt by 1. We decrease it again by calling only RRModeDestroy() and forget about prevmode */ RRModeDestroy(mymode); } else { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: setting mode [%s] ([%p]) refcnt [%d] for output %d [%s]\n", mymode->name, (void *) mymode, mymode->refcnt, i, pScrPriv->outputs[i]->name); #endif RROutputSetModes(pScrPriv->outputs[i], &mymode, 1, 0); } #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: setting mode [%s] ([%p]) refcnt [%d] for crtc %d\n", mymode->name, (void *) mymode, mymode->refcnt, i); #endif RRCrtcSet(pScrPriv->crtcs[i], mymode, new_x, new_y, RR_Rotate_0, 1, &(pScrPriv->outputs[i])); } /* if disable_output */ /* throw away the mode if otherwise unused. We do not need it anymore. We call FreeResource() to ensure the system will not try to free it again on shutdown */ if (prevmode && prevmode->refcnt == 1) { #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: destroying prevmode [%s]\n", prevmode->name); #endif FreeResource(prevmode->mode.id, 0); } RROutputChanged(pScrPriv->outputs[i], TRUE); RRCrtcChanged(pScrPriv->crtcs[i], TRUE); } /* release allocated memory */ SAFE_free(screeninfo); #ifdef DEBUG for (i = 0; i < pScrPriv->numCrtcs; i++) { RRModePtr mode = pScrPriv->crtcs[i]->mode; if (mode) { fprintf(stderr, "nxagentAdjustRandRXinerama: crtc [%d] ([%p]) has mode [%s] ([%p]), refcnt [%d] and [%d] outputs:\n", i, (void *) pScrPriv->crtcs[i], pScrPriv->crtcs[i]->mode->name, (void *)pScrPriv->crtcs[i]->mode, pScrPriv->crtcs[i]->mode->refcnt, pScrPriv->crtcs[i]->numOutputs); } else { fprintf(stderr, "nxagentAdjustRandRXinerama: crtc [%d] ([%p]) has no mode and [%d] outputs:\n", i, (void *) pScrPriv->crtcs[i], pScrPriv->crtcs[i]->numOutputs); } if (pScrPriv->crtcs[i]->numOutputs > 0) for (int j=0; j < pScrPriv->crtcs[i]->numOutputs; j++) fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]->crtc=[%p]\n", j, pScrPriv->crtcs[i]->outputs[j]->name, (void *)pScrPriv->crtcs[i]->outputs[j]->crtc); } #endif pScrPriv -> lastSetTime = currentTime; pScrPriv->changed = TRUE; pScrPriv->configChanged = TRUE; } /* * Adjust screen size according the newly set modes. * Not calling this function leads to the initial screen size left in place, * which is not what we want in case the window is resizable. */ RRScreenSizeNotify(pScreen); /* FIXME: adjust maximum screen size according to remote randr/xinerama setup */ #ifdef DEBUG fprintf(stderr, "nxagentAdjustRandRXinerama: Min %dx%d, Max %dx%d \n", pScrPriv->minWidth, pScrPriv->minHeight, pScrPriv->maxWidth, pScrPriv->maxHeight); #endif return TRUE; } void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, WindowPtr pWin) { miBSWindowPtr pBackingStore = (miBSWindowPtr) pWin -> backStorage; PixmapPtr pVirtualPixmap = nxagentVirtualPixmap(pPixmap); nxagentPrivPixmapPtr pPrivPixmap = nxagentPixmapPriv(pPixmap); pPrivPixmap -> isBackingPixmap = 1; fbCopyWindowProc(&pWin -> drawable, &pVirtualPixmap -> drawable, 0, RegionRects(prgnSave), RegionNumRects(prgnSave), xorg, yorg, FALSE, FALSE, 0, 0); XGCValues values = {.subwindow_mode = IncludeInferiors}; XlibGC gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values); /* * Initialize to the corrupted region. * Coordinates are relative to the window. */ RegionRec cleanRegion; RegionInit(&cleanRegion, NullBox, 1); RegionCopy(&cleanRegion, nxagentCorruptedRegion((DrawablePtr) pWin)); /* * Subtract the corrupted region from the saved region. */ RegionSubtract(&pBackingStore -> SavedRegion, &pBackingStore -> SavedRegion, &cleanRegion); /* * Translate the corrupted region. Coordinates * are relative to the backing store pixmap. */ RegionTranslate(&cleanRegion, -pBackingStore -> x, -pBackingStore -> y); /* * Compute the clean region to be saved: subtract * the corrupted region from the region to be saved. */ RegionSubtract(&cleanRegion, prgnSave, &cleanRegion); int nRects = RegionNumRects(&cleanRegion); int size = nRects * sizeof(XRectangle); XRectangle *pRects = (XRectangle *) malloc(size); BoxPtr pBox = RegionRects(&cleanRegion); for (int i = nRects; i-- > 0;) { pRects[i].x = pBox[i].x1; pRects[i].y = pBox[i].y1; pRects[i].width = pBox[i].x2 - pBox[i].x1; pRects[i].height = pBox[i].y2 - pBox[i].y1; } XSetClipRectangles(nxagentDisplay, gc, 0, 0, pRects, nRects, Unsorted); SAFE_free(pRects); BoxRec extents = *RegionExtents(&cleanRegion); RegionUninit(&cleanRegion); int xDst = extents.x1; int yDst = extents.y1; /* * Left here the wrong solution. The window could be not * configured yet on the real X, whilst the x and y in the * WindowRec are the new coordinates. The right solution * is the other, as it is independent from the window * coordinates. * * xSrc = xDst + xorg - pWin -> drawable.x; * ySrc = yDst + yorg - pWin -> drawable.y; */ int xSrc = xDst + pBackingStore -> x; int ySrc = yDst + pBackingStore -> y; int w = extents.x2 - extents.x1; int h = extents.y2 - extents.y1; XCopyArea(nxagentDisplay, nxagentWindow(pWin), nxagentPixmap(pPixmap), gc, xSrc, ySrc, w, h, xDst, yDst); nxagentAddItemBSPixmapList(nxagentPixmap(pPixmap), pPixmap, pWin, pBackingStore -> x, pBackingStore -> y); #ifdef TEST fprintf(stderr,"nxagentSaveAreas: Added pixmap [%p] with id [%d] on window [%p] to BSPixmapList.\n", (void *) pPixmap, nxagentPixmap(pPixmap), (void *) pWin); #endif XFreeGC(nxagentDisplay, gc); return; } void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, int yorg, WindowPtr pWin) { /* * Limit the area to restore to the * root window size. */ RegionIntersect(prgnRestore, prgnRestore, &pWin -> drawable.pScreen -> root -> winSize); miBSWindowPtr pBackingStore = (miBSWindowPtr) pWin -> backStorage; PixmapPtr pVirtualPixmap = nxagentVirtualPixmap(pPixmap); fbCopyWindowProc(&pVirtualPixmap -> drawable, &pWin -> drawable, 0, RegionRects(prgnRestore), RegionNumRects(prgnRestore), -xorg, -yorg, FALSE, FALSE, 0, 0); XGCValues values = {.subwindow_mode = ClipByChildren}; XlibGC gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values); /* * Translate the reference point to the origin of the window. */ RegionTranslate(prgnRestore, -pWin -> drawable.x - pWin -> borderWidth, -pWin -> drawable.y - pWin -> borderWidth); RegionPtr clipRegion = prgnRestore; if (nxagentDrawableStatus((DrawablePtr) pPixmap) == NotSynchronized) { clipRegion = RegionCreate(NullBox, 1); RegionCopy(clipRegion, nxagentCorruptedRegion((DrawablePtr) pPixmap)); /* * Translate the reference point to the origin of the window. */ RegionTranslate(clipRegion, pBackingStore -> x, pBackingStore -> y); RegionIntersect(clipRegion, prgnRestore, clipRegion); /* * Subtract the corrupted region from the saved areas. * miBSRestoreAreas will return the exposure region. */ RegionSubtract(&pBackingStore->SavedRegion, &pBackingStore->SavedRegion, clipRegion); /* * Store the corrupted region to send expose later. */ if (nxagentRemoteExposeRegion != NULL) { RegionTranslate(clipRegion, pWin -> drawable.x, pWin -> drawable.y); RegionUnion(nxagentRemoteExposeRegion, nxagentRemoteExposeRegion, clipRegion); RegionTranslate(clipRegion, -pWin -> drawable.x, -pWin -> drawable.y); } /* * Compute the region to be restored. */ RegionSubtract(clipRegion, prgnRestore, clipRegion); } int nRects = RegionNumRects(clipRegion); int size = nRects * sizeof(XRectangle); XRectangle *pRects = (XRectangle *) malloc(size); BoxPtr pBox = RegionRects(clipRegion); for (int i = nRects; i-- > 0;) { pRects[i].x = pBox[i].x1; pRects[i].y = pBox[i].y1; pRects[i].width = pBox[i].x2 - pBox[i].x1; pRects[i].height = pBox[i].y2 - pBox[i].y1; } XSetClipRectangles(nxagentDisplay, gc, 0, 0, pRects, nRects, Unsorted); SAFE_free(pRects); BoxRec extents = *RegionExtents(clipRegion); int xDst = extents.x1; int yDst = extents.y1; int xSrc = xDst - xorg + pWin -> drawable.x; int ySrc = yDst - yorg + pWin -> drawable.y; int w = extents.x2 - extents.x1; int h = extents.y2 - extents.y1; nxagentFlushConfigureWindow(); XCopyArea(nxagentDisplay, nxagentPixmap(pPixmap), nxagentWindow(pWin), gc, xSrc, ySrc, w, h, xDst, yDst); XFreeGC(nxagentDisplay, gc); if (clipRegion != NULL && clipRegion != prgnRestore) { RegionDestroy(clipRegion); } /* * Restore the reference point to the origin of the screen. */ RegionTranslate(prgnRestore, pWin -> drawable.x - pWin -> borderWidth, pWin -> drawable.y + pWin -> borderWidth); return; } void nxagentSetWMNormalHints(int screen, int width, int height) { XSizeHints* sizeHints = XAllocSizeHints(); if (!sizeHints) return; /* * Change agent window size and size hints. */ sizeHints->flags = PPosition | PMinSize | PMaxSize; sizeHints->x = nxagentOption(X); sizeHints->y = nxagentOption(Y); sizeHints->min_width = MIN_NXAGENT_WIDTH; sizeHints->min_height = MIN_NXAGENT_HEIGHT; sizeHints->width = width; sizeHints->height = height; if (nxagentOption(DesktopResize) == 1) { sizeHints->max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); sizeHints->max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); } else { sizeHints->max_width = nxagentOption(RootWidth); sizeHints->max_height = nxagentOption(RootHeight); } if (nxagentUserGeometry.flag & XValue || nxagentUserGeometry.flag & YValue) { sizeHints->flags |= USPosition; } if (nxagentUserGeometry.flag & WidthValue || nxagentUserGeometry.flag & HeightValue) { sizeHints->flags |= USSize; } XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[screen], sizeHints); SAFE_XFree(sizeHints); } /* set maxsize in WMNormalSizeHints Note: this will _drop_ all existing hints since XSetWMNormalHints() replaces any existing property */ void nxagentSetWMNormalHintsMaxsize(ScreenPtr pScreen, int maxwidth, int maxheight) { XSizeHints* sizeHints = XAllocSizeHints(); if (sizeHints) { sizeHints->flags = PMaxSize; sizeHints->max_width = maxwidth; sizeHints->max_height = maxheight; XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], sizeHints); SAFE_XFree(sizeHints); } } void nxagentShadowAdaptToRatio(void) { ScreenPtr pScreen = screenInfo.screens[0]; nxagentShadowSetRatio(nxagentOption(Width) * 1.0 / nxagentShadowWidth, nxagentOption(Height) * 1.0 / nxagentShadowHeight); nxagentShadowCreateMainWindow(pScreen, screenInfo.screens[0]->root, nxagentShadowWidth, nxagentShadowHeight); nxagentSetWMNormalHintsMaxsize(pScreen, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)), HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); BoxRec box = { .x1 = 0, .y1 = 0, .x2 = nxagentShadowPixmapPtr -> drawable.width, .y2 = nxagentShadowPixmapPtr -> drawable.height }; RegionRec region; RegionInit(®ion, &box, 1); nxagentMarkCorruptedRegion((DrawablePtr)nxagentShadowPixmapPtr, ®ion); RegionUninit(®ion); } void nxagentPrintGeometry(void) { for (int i = 0; i < screenInfo.numScreens; i++) { if (nxagentPrintGeometryFlags & (1 << i)) { fprintf(stderr, "Info: Screen [%d] resized to geometry [%dx%d] " "fullscreen [%d].\n", i, screenInfo.screens[i] -> width, screenInfo.screens[i] -> height, nxagentOption(Fullscreen)); } } nxagentPrintGeometryFlags = 0; } #ifdef DUMP void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height) { static int init = 1; static Display *shadow = NULL; static Window win = 0; int depth = pPixmap -> drawable.depth; /* int pixmapWidth = pPixmap -> drawable.width; int pixmapHeight = pPixmap -> drawable.height; */ unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; if (init) { shadow = XOpenDisplay("localhost:0"); if (shadow == NULL) { #ifdef WARNING fprintf(stderr, "nxagentShowPixmap: WARNING! Shadow display not opened.\n"); #endif return; } init = False; } if (win == 0) { win = XCreateSimpleWindow(shadow, DefaultRootWindow(shadow), 0, 0, width, height, 0, 0xFFCC33, 0xFF); XSelectInput(shadow, win, StructureNotifyMask); XMapWindow(shadow, win); for(;;) { XEvent e; XNextEvent(shadow, &e); if (e.type == MapNotify) { break; } } } else { XResizeWindow(nxagentDisplay, win, width, height); XRaiseWindow(nxagentDisplay, win); } int length = nxagentImageLength(width, height, format, 0, depth); char *data = malloc(length); if (data == NULL) { #ifdef WARNING fprintf(stderr, "nxagentShowPixmap: malloc failed.\n"); #endif return; } /* FIXME XImage *image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), x, y, width, height, AllPlanes, format); */ XImage *image = XGetImage(nxagentDisplay, RootWindow(nxagentDisplay, 0), 0, 0, width, height, AllPlanes, format); if (image == NULL) { #ifdef WARNING fprintf(stderr, "nxagentShowPixmap: XGetImage failed.\n"); #endif SAFE_free(data); return; } fbGetImage((DrawablePtr)pPixmap, 0, 0, width, height, format, AllPlanes, data); memcpy(image -> data, data, length); XGCValues value = { .foreground = 0xffffff, .background = 0x000000, .plane_mask = 0xffffff, .fill_style = FillSolid }; XlibGC gc = XCreateGC(shadow, win, GCBackground | GCForeground | GCFillStyle | GCPlaneMask, &value); XSync(shadow, 0); NXCleanImage(image); XPutImage(shadow, win, gc, image, 0, 0, 0, 0, width, height); XFlush(shadow); XFreeGC(shadow, gc); if (image != NULL) { XDestroyImage(image); } SAFE_free(data); /* FIXME if (win != NULL) { XDestroyWindow(shadow, win); } */ } void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc, int width, int height, int xDst, int yDst) { Display *shadow = nxagentDisplay; int depth = pPixmap -> drawable.depth; /* int pixmapWidth = pPixmap -> drawable.width; int pixmapHeight = pPixmap -> drawable.height; */ unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; int length = nxagentImageLength(width, height, format, 0, depth); char *data = malloc(length); if (data == NULL) { #ifdef WARNING fprintf(stderr, "nxagentFbRestoreArea: malloc failed.\n"); #endif return; } XImage *image = NULL; /* XImage *image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), xSrc, ySrc, width, height, AllPlanes, format); */ if (image == NULL) { #ifdef WARNING fprintf(stderr, "nxagentFbRestoreArea: XGetImage failed.\n"); #endif SAFE_free(data); return; } fbGetImage((DrawablePtr)pPixmap, xSrc, ySrc, width, height, format, AllPlanes, data); /* FIXME */ Visual *pVisual = nxagentImageVisual((DrawablePtr) pPixmap, depth); if (pVisual == NULL) { #ifdef WARNING fprintf(stderr, "nxagentFbRestoreArea: WARNING! Visual not found. Using default visual.\n"); #endif pVisual = nxagentVisuals[nxagentDefaultVisualIndex].visual; } image = XCreateImage(nxagentDisplay, pVisual, depth, format, 0, (char *) data, width, height, BitmapPad(nxagentDisplay), nxagentImagePad(width, format, 0, depth)); /* FIXME memcpy(image -> data, data, length); */ fprintf(stderr, "nxagentFbRestoreArea: Cleaning %d bytes of image.\n", length); XGCValues value = { .foreground = 0xffffff, .background = 0x000000, .plane_mask = 0xffffff, .fill_style = FillSolid, .function = GXcopy }; XlibGC gc = XCreateGC(shadow, nxagentWindow(screenInfo.screens[0]->root), GCBackground | GCForeground | GCFillStyle | GCPlaneMask | GCFunction, &value); NXCleanImage(image); XPutImage(shadow, nxagentWindow(pWin), gc, image, 0, 0, xDst, yDst, width, height); /* FIXME */ XFlush(shadow); XFreeGC(shadow, gc); if (image) { XDestroyImage(image); } /* FIXME SAFE_free(data); */ } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Screen.h0000644000000000000000000001220713614532331020247 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #ifndef __Screen_H__ #define __Screen_H__ #include "scrnintstr.h" #define MIN_NXAGENT_WIDTH 80 #define MIN_NXAGENT_HEIGHT 60 #define NXAGENT_FRAME_WIDTH 2000 #define nxagentSetPrintGeometry(screen) \ nxagentPrintGeometryFlags = (1 << (screen)); #ifdef NXAGENT_ONSTART #ifdef XlibAtom extern XlibAtom nxagentReadyAtom; #endif #endif extern int nxagentClients; extern int nxagentAutoDisconnectTimeout; extern ScreenPtr nxagentDefaultScreen; extern Pixmap nxagentPixmapLogo; extern Window nxagentIconWindow; extern Window nxagentFullscreenWindow; extern RegionRec nxagentShadowUpdateRegion; extern WindowPtr nxagentShadowWindowPtr; extern int nxagentShadowResize; extern short nxagentShadowUid; void nxagentSetScreenInfo(ScreenInfo *screenInfo); void nxagentSetPixmapFormats(ScreenInfo *screenInfo); void nxagentPrintGeometry(); extern Window nxagentDefaultWindows[MAXSCREENS]; extern Window nxagentInputWindows[MAXSCREENS]; extern Window nxagentScreenSaverWindows[MAXSCREENS]; #ifdef VIEWPORT_FRAME void nxagentInitViewportFrame(ScreenPtr pScreen, WindowPtr pRootWin); #else /* #ifdef VIEWPORT_FRAME */ #define nxagentInitViewportFrame(pScreen, pRootWin) #endif /* #ifdef VIEWPORT_FRAME */ Bool nxagentOpenScreen(ScreenPtr pScreen, int argc, char *argv[]); Bool nxagentCloseScreen(ScreenPtr pScreen); #define nxagentScreen(window) nxagentDefaultScreen extern int nxagentBitsPerPixel(int depth); void nxagentSetScreenSaverTime(void); void nxagentMinimizeFromFullScreen(ScreenPtr pScreen); void nxagentMaximizeToFullScreen(ScreenPtr pScreen); Window nxagentCreateIconWindow(void); Bool nxagentMagicPixelZone(int x, int y); Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height, int mmWidth, int mmHeight); int nxagentChangeScreenConfig(int screen, int width, int height); int nxagentAdjustRandRXinerama(ScreenPtr pScreen); extern Bool nxagentReconnectScreen(void *p0); void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, WindowPtr pWin); void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, int yorg, WindowPtr pWin); extern int monitorResolution; int nxagentShadowCreateMainWindow( ScreenPtr pScreen, WindowPtr pWin,int width, int height); int nxagentShadowSendUpdates(int *); int nxagentShadowPoll(PixmapPtr, GCPtr, unsigned char, int, int, char *, int *, int *); void nxagentShadowSetWindowsSize(void); void nxagentSetWMNormalHints(int, int, int); void nxagentSetWMNormalHintsMaxsize(ScreenPtr, int, int); void nxagentShadowSetRatio(float, float); void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port); /* * Change window settings to adapt to a ratio. */ extern void nxagentShadowAdaptToRatio(void); /* * The pixmap shadowing the real frame buffer. */ extern PixmapPtr nxagentShadowPixmapPtr; #endif /* __Screen_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/screensaver0000644000000000000000000014764413614532331021140 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #define screensaver_width 256 #define screensaver_height 256 static unsigned char screensaver_bits[] = { 0xa8, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x80, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x00, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x2a, 0x80, 0x02, 0x80, 0xaa, 0xaa, 0x82, 0x0a, 0xa8, 0x28, 0x80, 0x8a, 0x80, 0x2a, 0x80, 0x80, 0x8a, 0xa2, 0x82, 0x0a, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x80, 0x82, 0x41, 0x40, 0x00, 0x50, 0x55, 0x41, 0x00, 0x00, 0x04, 0x00, 0x54, 0x40, 0x10, 0x00, 0x40, 0x00, 0x51, 0x55, 0x00, 0x15, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x10, 0x14, 0x00, 0x00, 0x00, 0xa8, 0x8a, 0x02, 0x00, 0x02, 0x00, 0x20, 0xa2, 0x00, 0x80, 0x00, 0x08, 0x00, 0xaa, 0x2a, 0x00, 0x2a, 0x08, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x01, 0x00, 0x01, 0x50, 0x45, 0x05, 0x00, 0x01, 0x10, 0x10, 0x40, 0x11, 0x40, 0x00, 0x44, 0x00, 0x50, 0x15, 0x01, 0x15, 0x04, 0x00, 0x40, 0x00, 0x05, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x50, 0x20, 0x00, 0x00, 0xa2, 0xaa, 0x2a, 0x00, 0x00, 0x02, 0x00, 0xa0, 0x08, 0x00, 0x00, 0x00, 0x00, 0xa2, 0xaa, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x01, 0x40, 0x44, 0x15, 0x10, 0x01, 0x10, 0x10, 0x40, 0x01, 0x40, 0x00, 0x00, 0x00, 0x54, 0x55, 0x41, 0x45, 0x04, 0x00, 0x40, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x54, 0x20, 0x80, 0x00, 0x82, 0xaa, 0x0a, 0x00, 0x00, 0x22, 0x00, 0x80, 0x0a, 0x00, 0x00, 0x82, 0x00, 0xa0, 0x8a, 0x22, 0x02, 0x00, 0x08, 0x20, 0x00, 0xa8, 0x00, 0x00, 0x20, 0x00, 0x80, 0x00, 0x2a, 0x10, 0x40, 0x00, 0x01, 0x54, 0x45, 0x10, 0x00, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x01, 0x00, 0x50, 0x45, 0x05, 0x41, 0x00, 0x04, 0x10, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x28, 0x00, 0xaa, 0xaa, 0x0a, 0x0a, 0x00, 0x20, 0x08, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0xa8, 0xa2, 0x22, 0x2a, 0x00, 0x00, 0x0a, 0x00, 0xa8, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x0a, 0x50, 0x05, 0x00, 0x01, 0x55, 0x45, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x40, 0x55, 0x11, 0x00, 0x00, 0x54, 0x01, 0x00, 0x44, 0x01, 0x00, 0x00, 0x05, 0x40, 0x00, 0x05, 0x00, 0x08, 0x00, 0x80, 0xaa, 0xaa, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x80, 0x00, 0x80, 0xaa, 0x28, 0x20, 0x00, 0x00, 0x02, 0x00, 0x80, 0x02, 0x00, 0x00, 0x28, 0x00, 0x80, 0x02, 0x10, 0x10, 0x00, 0x01, 0x54, 0x45, 0x01, 0x00, 0x41, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x10, 0x55, 0x14, 0x00, 0x00, 0x04, 0x04, 0x00, 0x40, 0x01, 0x00, 0x00, 0x40, 0x40, 0x40, 0x01, 0x08, 0x00, 0x80, 0x00, 0xa8, 0xa2, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00, 0x20, 0xa0, 0xaa, 0x00, 0x80, 0x28, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x80, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x14, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x40, 0x00, 0x00, 0x08, 0x20, 0x80, 0x00, 0x08, 0x08, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x8a, 0x8a, 0x00, 0x02, 0x02, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x10, 0x10, 0x00, 0x01, 0x10, 0x45, 0x55, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x20, 0xa2, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x80, 0x00, 0x02, 0x04, 0x00, 0x40, 0x00, 0x04, 0x04, 0x40, 0x40, 0x00, 0x01, 0x00, 0x04, 0x04, 0x00, 0x00, 0x01, 0x00, 0x51, 0x45, 0x05, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x45, 0x01, 0x2a, 0x80, 0xaa, 0xaa, 0x82, 0xaa, 0x2a, 0xa0, 0x02, 0x02, 0x80, 0xa8, 0x00, 0x2a, 0xa0, 0x02, 0x80, 0xa2, 0x00, 0xa0, 0xa0, 0x0a, 0xa0, 0x00, 0x00, 0x00, 0x80, 0x88, 0x02, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x41, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x05, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x15, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x0a, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x15, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x2a, 0x20, 0x00, 0x00, 0x41, 0x05, 0x55, 0x54, 0x11, 0x04, 0x00, 0x14, 0x40, 0x10, 0x44, 0x15, 0x15, 0x00, 0x00, 0x50, 0x01, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x10, 0x50, 0x40, 0x82, 0x08, 0x02, 0x08, 0x20, 0x08, 0x00, 0x22, 0xa0, 0x20, 0x88, 0x00, 0x22, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x08, 0x88, 0x20, 0x44, 0x10, 0x01, 0x04, 0x50, 0x04, 0x00, 0x41, 0x10, 0x11, 0x44, 0x00, 0x41, 0x00, 0x00, 0x54, 0x41, 0x00, 0x40, 0x55, 0x15, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0x54, 0x11, 0x04, 0x11, 0x80, 0x20, 0x02, 0x08, 0xa0, 0x08, 0x00, 0x02, 0x88, 0x20, 0x88, 0x00, 0x82, 0x00, 0x00, 0x2a, 0x22, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x08, 0x08, 0x20, 0x40, 0x10, 0x01, 0x04, 0x50, 0x04, 0x00, 0x01, 0x04, 0x41, 0x44, 0x00, 0x41, 0x00, 0x00, 0x15, 0x05, 0x14, 0x15, 0x50, 0x10, 0x05, 0x40, 0x41, 0x41, 0x10, 0x45, 0x05, 0x50, 0x04, 0x04, 0x10, 0x80, 0x20, 0x02, 0x08, 0xa0, 0x08, 0x00, 0x02, 0x08, 0x22, 0x82, 0x00, 0x82, 0x00, 0x00, 0x0a, 0x2a, 0x22, 0x8a, 0x22, 0x22, 0x08, 0x80, 0x22, 0x22, 0x88, 0x88, 0x02, 0x28, 0x02, 0x08, 0x20, 0x40, 0x10, 0x15, 0x54, 0x10, 0x05, 0x00, 0x14, 0x04, 0x41, 0x44, 0x05, 0x41, 0x00, 0x00, 0x05, 0x50, 0x01, 0x41, 0x04, 0x05, 0x11, 0x00, 0x05, 0x44, 0x44, 0x50, 0x00, 0x10, 0x05, 0x50, 0x10, 0x80, 0x0a, 0x02, 0x08, 0x20, 0x0a, 0x00, 0x20, 0xa8, 0x82, 0x82, 0x00, 0x2a, 0x00, 0x80, 0x02, 0x22, 0x02, 0x82, 0x20, 0x20, 0x08, 0x20, 0x88, 0x82, 0x88, 0x8a, 0x00, 0x88, 0x0a, 0x80, 0x20, 0x40, 0x04, 0x01, 0x04, 0x10, 0x05, 0x00, 0x40, 0x04, 0x41, 0x41, 0x00, 0x11, 0x00, 0x40, 0x01, 0x41, 0x41, 0x41, 0x14, 0x15, 0x11, 0x40, 0x44, 0x04, 0x44, 0x40, 0x00, 0x44, 0x15, 0x00, 0x11, 0x80, 0x08, 0x02, 0x08, 0x20, 0x0a, 0x00, 0x80, 0x08, 0x82, 0x82, 0x00, 0x22, 0x00, 0xa0, 0x00, 0x22, 0x22, 0x82, 0x20, 0x22, 0x0a, 0x20, 0x28, 0x82, 0x82, 0x88, 0x00, 0x88, 0x2a, 0x00, 0x22, 0x44, 0x10, 0x01, 0x04, 0x10, 0x04, 0x00, 0x41, 0x04, 0x01, 0x41, 0x00, 0x41, 0x00, 0x50, 0x01, 0x14, 0x14, 0x01, 0x55, 0x10, 0x15, 0x40, 0x45, 0x05, 0x01, 0x45, 0x00, 0x04, 0x55, 0x04, 0x11, 0x82, 0x20, 0x02, 0x08, 0x20, 0x08, 0x00, 0x22, 0x08, 0x82, 0x80, 0x00, 0x82, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xaa, 0x88, 0x20, 0x41, 0x10, 0x55, 0x54, 0x11, 0x04, 0x00, 0x14, 0x04, 0x01, 0x41, 0x15, 0x41, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x54, 0x51, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x54, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xa8, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x50, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x80, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x05, 0x14, 0x40, 0x01, 0x41, 0x40, 0x01, 0x14, 0x10, 0x01, 0x00, 0x40, 0x01, 0x04, 0x14, 0x14, 0x14, 0x10, 0x04, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xaa, 0x00, 0x00, 0x00, 0x80, 0x82, 0xa0, 0x20, 0x82, 0xa2, 0x20, 0x02, 0x22, 0x28, 0x02, 0x00, 0x08, 0x8a, 0x22, 0x08, 0x08, 0x22, 0x28, 0x0a, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x44, 0x54, 0x01, 0x00, 0x00, 0x40, 0x41, 0x40, 0x10, 0x04, 0x11, 0x11, 0x04, 0x41, 0x10, 0x04, 0x00, 0x04, 0x04, 0x40, 0x10, 0x00, 0x41, 0x10, 0x11, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xaa, 0x02, 0x00, 0x00, 0xa0, 0x82, 0x80, 0x08, 0x08, 0x02, 0x08, 0x88, 0x80, 0x08, 0x08, 0x00, 0x08, 0x08, 0x20, 0x20, 0x80, 0x80, 0x20, 0x00, 0x00, 0x10, 0x50, 0x14, 0x14, 0x45, 0x05, 0x40, 0x05, 0x41, 0x14, 0x15, 0x50, 0x41, 0x01, 0x04, 0x00, 0x01, 0x04, 0x50, 0x00, 0x11, 0x04, 0x00, 0x14, 0x00, 0x40, 0x10, 0x44, 0x00, 0x11, 0x00, 0x00, 0xa0, 0x88, 0x22, 0xa2, 0x88, 0x08, 0x00, 0x2a, 0x82, 0x22, 0x22, 0xa8, 0x80, 0x0a, 0x08, 0x00, 0x02, 0xa8, 0x8a, 0xaa, 0x08, 0x08, 0x00, 0xa8, 0x00, 0x2a, 0x20, 0x80, 0xaa, 0x20, 0x00, 0x00, 0x00, 0x05, 0x04, 0x15, 0x55, 0x04, 0x40, 0x04, 0x50, 0x54, 0x01, 0x54, 0x00, 0x54, 0x04, 0x00, 0x01, 0x04, 0x40, 0x00, 0x10, 0x04, 0x00, 0x40, 0x05, 0x41, 0x40, 0x40, 0x00, 0x10, 0x00, 0x00, 0x80, 0x08, 0x02, 0x82, 0x80, 0x08, 0x80, 0x20, 0x02, 0x02, 0x02, 0x2a, 0x00, 0xa0, 0x08, 0x00, 0x02, 0x08, 0x80, 0x00, 0x08, 0x08, 0x00, 0x00, 0x8a, 0x20, 0x20, 0x82, 0x00, 0x20, 0x00, 0x00, 0x10, 0x45, 0x04, 0x11, 0x51, 0x04, 0x50, 0x44, 0x44, 0x44, 0x01, 0x15, 0x00, 0x40, 0x05, 0x00, 0x01, 0x04, 0x40, 0x00, 0x10, 0x04, 0x00, 0x00, 0x54, 0x40, 0x40, 0x41, 0x00, 0x10, 0x00, 0x00, 0xa0, 0x28, 0x02, 0x0a, 0x8a, 0x08, 0x20, 0x0a, 0x0a, 0x28, 0x02, 0x0a, 0x00, 0x80, 0x08, 0x00, 0x02, 0x08, 0x80, 0x00, 0x08, 0x08, 0x00, 0x00, 0x88, 0x20, 0x80, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x05, 0x40, 0x00, 0x11, 0x00, 0x01, 0x10, 0x10, 0x01, 0x11, 0x04, 0x00, 0x04, 0x50, 0x40, 0x41, 0x01, 0x01, 0x11, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x80, 0x02, 0x80, 0x80, 0x20, 0x02, 0x02, 0x20, 0x08, 0x82, 0x08, 0x08, 0x00, 0x08, 0x88, 0x20, 0x80, 0x00, 0x82, 0x20, 0x00, 0x00, 0x00, 0x40, 0x01, 0x10, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x40, 0x01, 0x40, 0x14, 0x40, 0x41, 0x05, 0x40, 0x01, 0x14, 0x14, 0x14, 0x00, 0x44, 0x01, 0x45, 0x00, 0x00, 0x14, 0x54, 0x00, 0x00, 0x00, 0x80, 0x02, 0x08, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x04, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x02, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x15, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x8a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x01, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x02, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xa2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x05, 0x50, 0x00, 0x50, 0x40, 0x45, 0x11, 0x00, 0x50, 0x40, 0x41, 0x01, 0x00, 0x14, 0x00, 0x51, 0x40, 0x40, 0x00, 0x05, 0x14, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0a, 0x88, 0x02, 0xaa, 0xa8, 0x80, 0x00, 0x00, 0xaa, 0xa8, 0xa2, 0x02, 0x00, 0xa2, 0xa0, 0x22, 0xa8, 0xa0, 0xa0, 0x8a, 0x2a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x14, 0x04, 0x01, 0x45, 0x51, 0x04, 0x40, 0x00, 0x45, 0x41, 0x51, 0x01, 0x00, 0x41, 0x50, 0x54, 0x50, 0x50, 0x50, 0x14, 0x14, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x82, 0xa2, 0xa0, 0x02, 0xa0, 0x88, 0x82, 0xa0, 0x88, 0x02, 0x80, 0x82, 0x28, 0x28, 0xa0, 0x20, 0x28, 0x08, 0x8a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x45, 0x54, 0x00, 0x14, 0x40, 0x41, 0x50, 0x05, 0x51, 0x10, 0x41, 0x41, 0x41, 0x01, 0x00, 0x05, 0x14, 0x10, 0x50, 0x40, 0x10, 0x14, 0x54, 0x04, 0x00, 0x41, 0x55, 0x04, 0x45, 0x01, 0x04, 0x20, 0x02, 0x08, 0x00, 0x2a, 0xa0, 0x00, 0xa0, 0x8a, 0x20, 0xa8, 0xa2, 0xa0, 0xa0, 0x00, 0x80, 0x0a, 0x28, 0x28, 0xa0, 0x20, 0x28, 0x0a, 0x2a, 0x00, 0x00, 0x22, 0x0a, 0x80, 0x88, 0x02, 0x88, 0x04, 0x50, 0x01, 0x00, 0x54, 0x40, 0x01, 0x50, 0x15, 0x10, 0x14, 0x51, 0x40, 0x41, 0x01, 0x00, 0x15, 0x14, 0x14, 0x40, 0x11, 0x14, 0x05, 0x14, 0x00, 0x40, 0x10, 0x00, 0x15, 0x45, 0x04, 0x01, 0x00, 0x00, 0x08, 0x00, 0xa8, 0xa0, 0x00, 0x28, 0x8a, 0x08, 0x0a, 0x28, 0xa0, 0xa0, 0x00, 0x00, 0x2a, 0x0a, 0x28, 0xa0, 0x08, 0x8a, 0x02, 0x0a, 0x00, 0x80, 0x00, 0x08, 0x80, 0x00, 0x00, 0x82, 0x44, 0x11, 0x00, 0x00, 0x50, 0x50, 0x00, 0x10, 0x05, 0x40, 0x15, 0x05, 0x50, 0x50, 0x00, 0x00, 0x14, 0x14, 0x14, 0x40, 0x11, 0x54, 0x00, 0x05, 0x00, 0x00, 0x11, 0x00, 0x01, 0x40, 0x04, 0x44, 0x80, 0x20, 0x0a, 0x00, 0xa0, 0xa0, 0x00, 0x88, 0x82, 0xa8, 0x0a, 0x00, 0xa0, 0xa0, 0x00, 0x00, 0x28, 0x0a, 0x0a, 0xa0, 0x08, 0x0a, 0x00, 0x0a, 0x00, 0x00, 0x22, 0x0a, 0xa2, 0x00, 0x00, 0x88, 0x01, 0x40, 0x15, 0x00, 0x50, 0x51, 0x40, 0x00, 0x01, 0x51, 0x15, 0x00, 0x50, 0x50, 0x00, 0x00, 0x54, 0x14, 0x54, 0x40, 0x05, 0x14, 0x00, 0x05, 0x00, 0x40, 0x41, 0x15, 0x14, 0x45, 0x04, 0x05, 0x00, 0x00, 0x00, 0x80, 0xa0, 0xa0, 0x20, 0x88, 0x80, 0xaa, 0x08, 0x82, 0x28, 0x28, 0x02, 0x20, 0x28, 0x0a, 0x2a, 0xa0, 0x02, 0x0a, 0x88, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x40, 0x11, 0x44, 0x00, 0x55, 0x14, 0x44, 0x50, 0x50, 0x01, 0x40, 0x10, 0x54, 0x15, 0x40, 0x01, 0x14, 0x04, 0x45, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x22, 0xa0, 0x0a, 0x00, 0x00, 0x0a, 0x2a, 0x20, 0x28, 0xa8, 0x00, 0xa0, 0x08, 0xa8, 0x08, 0xa0, 0x00, 0xa8, 0x82, 0x82, 0x02, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x05, 0x00, 0x00, 0x54, 0x55, 0x10, 0x50, 0x50, 0x00, 0x00, 0x05, 0x50, 0x04, 0x40, 0x00, 0x50, 0x40, 0x05, 0x05, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0a, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x01, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x14, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x28, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0a, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x55, 0x50, 0x15, 0x55, 0x11, 0x55, 0x00, 0x15, 0x00, 0x54, 0x01, 0x00, 0x54, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x20, 0x82, 0x20, 0x08, 0x82, 0x00, 0x22, 0x80, 0x08, 0x08, 0x28, 0xa2, 0x28, 0x20, 0x08, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xa2, 0x00, 0x04, 0x41, 0x10, 0x04, 0x11, 0x00, 0x40, 0x10, 0x14, 0x10, 0x54, 0x54, 0x11, 0x10, 0x00, 0x01, 0x00, 0x50, 0x14, 0x15, 0x05, 0x45, 0x01, 0x50, 0x50, 0x44, 0x14, 0x05, 0x00, 0x04, 0x40, 0x20, 0x02, 0x22, 0x02, 0x22, 0x08, 0x20, 0x20, 0x00, 0x08, 0x20, 0xa8, 0x28, 0x22, 0x08, 0x80, 0x02, 0x00, 0x88, 0x22, 0xa2, 0x88, 0x28, 0x02, 0x88, 0x80, 0x22, 0xa2, 0x08, 0x00, 0x08, 0x22, 0x00, 0x04, 0x41, 0x00, 0x04, 0x00, 0x01, 0x40, 0x00, 0x10, 0x40, 0x04, 0x11, 0x10, 0x04, 0x10, 0x05, 0x00, 0x10, 0x04, 0x01, 0x55, 0x45, 0x04, 0x10, 0x50, 0x44, 0x15, 0x01, 0x00, 0x14, 0x10, 0x00, 0x2a, 0xa0, 0x02, 0x2a, 0x20, 0x22, 0x80, 0x02, 0x22, 0x20, 0x02, 0x0a, 0xa0, 0x02, 0x08, 0x0a, 0x00, 0x20, 0x02, 0x82, 0x80, 0x20, 0x02, 0x80, 0x88, 0x28, 0x82, 0x00, 0x00, 0xa8, 0x20, 0x00, 0x44, 0x40, 0x01, 0x14, 0x00, 0x04, 0x00, 0x05, 0x10, 0x40, 0x00, 0x11, 0x10, 0x05, 0x04, 0x14, 0x00, 0x44, 0x44, 0x01, 0x51, 0x44, 0x04, 0x10, 0x45, 0x14, 0x11, 0x01, 0x00, 0x50, 0x11, 0x00, 0x82, 0x20, 0x02, 0x22, 0x20, 0x28, 0x20, 0x08, 0x2a, 0x80, 0x02, 0x02, 0x20, 0x08, 0x00, 0x00, 0x00, 0x28, 0x28, 0x02, 0x8a, 0x22, 0x02, 0xa0, 0xa8, 0x08, 0x8a, 0x00, 0x00, 0x80, 0x22, 0x00, 0x04, 0x41, 0x10, 0x04, 0x01, 0x10, 0x00, 0x10, 0x41, 0x40, 0x01, 0x11, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x51, 0x20, 0x82, 0x20, 0x00, 0x02, 0x20, 0x28, 0x20, 0x88, 0x20, 0x80, 0x00, 0x82, 0x20, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x10, 0x04, 0x45, 0x10, 0x04, 0x01, 0x10, 0x40, 0x04, 0x40, 0x00, 0x00, 0x41, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x41, 0x8a, 0x0a, 0xaa, 0x8a, 0xaa, 0xa8, 0x20, 0xa0, 0x82, 0xa2, 0x80, 0x80, 0xaa, 0xa8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xa2, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x10, 0x50, 0x41, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0xa0, 0x80, 0x02, 0xa8, 0x28, 0x0a, 0xa0, 0x02, 0xa8, 0x00, 0x8a, 0x02, 0x28, 0x00, 0x00, 0x00, 0x0a, 0x28, 0x80, 0x2a, 0x80, 0x22, 0x80, 0x0a, 0x00, 0xa8, 0x00, 0x28, 0x2a, 0x00, 0x05, 0x00, 0x50, 0x00, 0x00, 0x55, 0x51, 0x14, 0x14, 0x54, 0x54, 0x01, 0x54, 0x01, 0x50, 0x50, 0x05, 0x00, 0x05, 0x00, 0x50, 0x55, 0x40, 0x51, 0x50, 0x15, 0x00, 0x54, 0x05, 0x14, 0x55, 0x00, 0x0a, 0x00, 0xa0, 0x00, 0x80, 0xaa, 0x2a, 0x2a, 0x08, 0x2a, 0xa8, 0x02, 0xaa, 0x02, 0xa0, 0xa0, 0x02, 0x00, 0x0a, 0x00, 0xa8, 0xaa, 0x80, 0x2a, 0xa8, 0x2a, 0x80, 0xaa, 0x0a, 0xa8, 0xaa, 0x01, 0x05, 0x00, 0x50, 0x05, 0x40, 0x55, 0x55, 0x14, 0x00, 0x14, 0x50, 0x05, 0x54, 0x01, 0x40, 0x51, 0x01, 0x00, 0x55, 0x00, 0x54, 0x55, 0x41, 0x15, 0x54, 0x55, 0x40, 0x55, 0x15, 0x54, 0x55, 0x02, 0x0a, 0x00, 0xa0, 0x0a, 0xa0, 0x02, 0x2a, 0x2a, 0x00, 0x0a, 0x88, 0x0a, 0x2a, 0x00, 0x80, 0xaa, 0x00, 0x00, 0xaa, 0x00, 0xaa, 0xa0, 0xa2, 0x0a, 0x2a, 0xa8, 0xa0, 0x0a, 0x0a, 0xaa, 0xa0, 0x01, 0x14, 0x01, 0x40, 0x55, 0x50, 0x01, 0x14, 0x14, 0x00, 0x05, 0x04, 0x15, 0x15, 0x00, 0x00, 0x51, 0x00, 0x00, 0x54, 0x05, 0x14, 0x40, 0x45, 0x05, 0x15, 0x50, 0x41, 0x01, 0x14, 0x54, 0x40, 0x02, 0xa8, 0x00, 0x80, 0xaa, 0xa8, 0x00, 0x2a, 0x28, 0x88, 0x02, 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x0a, 0x0a, 0xa0, 0xa2, 0x82, 0x0a, 0xa0, 0xa0, 0x00, 0x28, 0x2a, 0xa0, 0x01, 0x50, 0x00, 0x00, 0x55, 0x50, 0x00, 0x14, 0x54, 0x54, 0x05, 0x15, 0x14, 0x15, 0x00, 0x00, 0x11, 0x00, 0x00, 0x50, 0x05, 0x15, 0x00, 0x40, 0x01, 0x05, 0x40, 0x51, 0x00, 0x14, 0x14, 0x40, 0x00, 0xa8, 0x00, 0x00, 0xa8, 0x28, 0x00, 0x28, 0x28, 0xa8, 0x02, 0x80, 0x0a, 0x0a, 0x00, 0x80, 0x08, 0x00, 0x00, 0x80, 0x8a, 0x0a, 0x00, 0xa0, 0x80, 0xaa, 0xaa, 0xa8, 0xaa, 0x2a, 0x0a, 0xa0, 0x01, 0x44, 0x01, 0x00, 0x50, 0x55, 0x00, 0x14, 0x50, 0x14, 0x01, 0x00, 0x15, 0x05, 0x00, 0x40, 0x15, 0x00, 0x00, 0x00, 0x15, 0x05, 0x00, 0x50, 0x41, 0x55, 0x55, 0x51, 0x55, 0x15, 0x15, 0x40, 0x00, 0x80, 0x02, 0x00, 0xa0, 0x28, 0x00, 0x0a, 0x28, 0x0a, 0x02, 0x00, 0x8a, 0x0a, 0x00, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x8a, 0x0a, 0x00, 0xa0, 0x80, 0xaa, 0xaa, 0xa8, 0xaa, 0x2a, 0x0a, 0xa0, 0x01, 0x40, 0x01, 0x00, 0x50, 0x55, 0x00, 0x14, 0x50, 0x05, 0x00, 0x00, 0x14, 0x05, 0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x15, 0x05, 0x00, 0x50, 0x40, 0x55, 0x55, 0x51, 0x55, 0x15, 0x05, 0x50, 0x00, 0x80, 0x02, 0x2a, 0xa8, 0x28, 0x00, 0x0a, 0xa8, 0x0a, 0x80, 0xaa, 0x82, 0x02, 0x00, 0x20, 0xa0, 0x00, 0xa0, 0x82, 0x8a, 0x0a, 0x00, 0xa0, 0x80, 0x02, 0x00, 0x28, 0x00, 0x00, 0x0a, 0xa0, 0x00, 0x00, 0x05, 0x14, 0x50, 0x54, 0x00, 0x15, 0x50, 0x05, 0x40, 0x55, 0x01, 0x05, 0x00, 0x10, 0x40, 0x01, 0x40, 0x01, 0x05, 0x15, 0x50, 0x51, 0x40, 0x01, 0x00, 0x50, 0x00, 0x00, 0x05, 0x50, 0x00, 0x00, 0x0a, 0x2a, 0xa8, 0xa8, 0x80, 0x0a, 0xa0, 0x02, 0x80, 0x0a, 0x80, 0x02, 0x00, 0x08, 0x80, 0x02, 0xa0, 0x82, 0x0a, 0x2a, 0xa8, 0xa0, 0x80, 0x02, 0x2a, 0xa8, 0x80, 0x8a, 0x0a, 0xa0, 0x00, 0x00, 0x00, 0x54, 0x55, 0x50, 0x55, 0x05, 0x50, 0x01, 0x00, 0x00, 0x44, 0x05, 0x00, 0x04, 0x00, 0x05, 0x40, 0x55, 0x05, 0x54, 0x55, 0x50, 0x00, 0x55, 0x15, 0x50, 0x55, 0x05, 0x05, 0x50, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0xa0, 0xaa, 0x0a, 0xa0, 0x00, 0x08, 0x00, 0x8a, 0x02, 0x00, 0x0a, 0x00, 0x00, 0x80, 0xaa, 0x02, 0xaa, 0x2a, 0x28, 0x80, 0xaa, 0x0a, 0xa0, 0xaa, 0x82, 0x02, 0x28, 0x00, 0x00, 0x00, 0x50, 0x15, 0x40, 0x55, 0x05, 0x40, 0x01, 0x10, 0x00, 0x55, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x55, 0x01, 0x54, 0x15, 0x50, 0x00, 0x55, 0x05, 0x40, 0x55, 0x01, 0x05, 0x50, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x80, 0x0a, 0x0a, 0xa0, 0x00, 0x00, 0xa0, 0xaa, 0x02, 0x80, 0x0a, 0x00, 0x00, 0x00, 0x2a, 0x00, 0xa0, 0x0a, 0x28, 0x00, 0xa8, 0x00, 0x80, 0x2a, 0x80, 0x02, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x8a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x45, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x22, 0xa0, 0x22, 0xa8, 0x0a, 0xa8, 0x00, 0xa8, 0xa0, 0x28, 0x80, 0xaa, 0x22, 0x28, 0xa0, 0x02, 0x2a, 0x2a, 0xa0, 0x02, 0x8a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x15, 0x50, 0x15, 0x54, 0x15, 0x54, 0x01, 0x55, 0x41, 0x55, 0x00, 0x55, 0x11, 0x54, 0x50, 0x05, 0x54, 0x54, 0x54, 0x05, 0x54, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x08, 0x08, 0x20, 0x08, 0x02, 0x82, 0x82, 0x82, 0x82, 0x00, 0xaa, 0x08, 0x20, 0x20, 0x08, 0x08, 0x08, 0x0a, 0x0a, 0x28, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x10, 0x04, 0x10, 0x10, 0x00, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x54, 0x14, 0x11, 0x00, 0x10, 0x10, 0x04, 0x04, 0x04, 0x10, 0x00, 0x14, 0x51, 0x10, 0x44, 0x01, 0x50, 0x44, 0x44, 0x14, 0xa0, 0x00, 0x02, 0x08, 0x08, 0x80, 0x00, 0x82, 0x00, 0x82, 0x80, 0x00, 0xa8, 0x28, 0x00, 0xa0, 0x0a, 0x20, 0x08, 0x02, 0x08, 0x08, 0x00, 0x00, 0x20, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x05, 0x04, 0x00, 0x10, 0x00, 0x55, 0x45, 0x55, 0x41, 0x40, 0x00, 0x54, 0x54, 0x00, 0x50, 0x05, 0x10, 0x04, 0x55, 0x05, 0x04, 0x00, 0x44, 0x10, 0x14, 0x45, 0x04, 0x10, 0x54, 0x54, 0x04, 0x00, 0x0a, 0x02, 0x00, 0x08, 0x80, 0xaa, 0x82, 0xaa, 0x82, 0x80, 0x00, 0x2a, 0xaa, 0x00, 0x08, 0x08, 0x20, 0x02, 0xaa, 0x0a, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x10, 0x14, 0x04, 0x00, 0x04, 0x00, 0x01, 0x40, 0x00, 0x40, 0x40, 0x00, 0x15, 0x45, 0x15, 0x04, 0x04, 0x10, 0x01, 0x01, 0x00, 0x04, 0x00, 0x05, 0x15, 0x10, 0x44, 0x04, 0x14, 0x14, 0x41, 0x04, 0x08, 0x08, 0x0a, 0x08, 0x08, 0x80, 0x02, 0x82, 0x80, 0x20, 0x20, 0x80, 0x8a, 0x8a, 0x22, 0x02, 0x02, 0xa0, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x05, 0x54, 0x15, 0x55, 0x01, 0x55, 0x01, 0x55, 0x51, 0x51, 0x01, 0x45, 0x05, 0x00, 0x54, 0x15, 0x40, 0x00, 0x54, 0x45, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0xa8, 0x82, 0xaa, 0x00, 0xaa, 0x00, 0x2a, 0xa8, 0xa8, 0x80, 0x82, 0x22, 0x20, 0xa8, 0x0a, 0x20, 0x00, 0xa8, 0x80, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x15, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x2a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x54, 0x55, 0x01, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0xa8, 0xaa, 0x02, 0x00, 0x80, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0a, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x0a, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x14, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x28, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x02, 0x08, 0x00, 0x10, 0x50, 0x50, 0x50, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x50, 0x00, 0x50, 0x00, 0x05, 0x04, 0x01, 0x05, 0x50, 0x40, 0x54, 0x05, 0x04, 0x05, 0x8a, 0x20, 0x20, 0x88, 0xa0, 0x28, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x20, 0x00, 0x82, 0x82, 0x08, 0x8a, 0x82, 0x08, 0x88, 0xa0, 0xa8, 0x0a, 0x22, 0x28, 0x00, 0x41, 0x00, 0x04, 0x41, 0x44, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x10, 0x00, 0x01, 0x41, 0x10, 0x44, 0x44, 0x10, 0x04, 0x41, 0x50, 0x15, 0x11, 0x10, 0x80, 0x80, 0x00, 0x02, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x80, 0x00, 0x02, 0x22, 0x20, 0x08, 0x20, 0x20, 0x02, 0x22, 0xa0, 0x2a, 0x22, 0x20, 0x00, 0x41, 0x10, 0x01, 0x44, 0x00, 0x00, 0x40, 0x41, 0x51, 0x04, 0x14, 0x15, 0x00, 0x11, 0x44, 0x50, 0x54, 0x40, 0x01, 0x05, 0x10, 0x00, 0x04, 0x10, 0x40, 0x01, 0x44, 0x10, 0x15, 0x51, 0x00, 0xa8, 0x80, 0x00, 0xaa, 0x82, 0x00, 0x00, 0x20, 0x22, 0x8a, 0xa2, 0x22, 0x22, 0x80, 0xa0, 0x88, 0x88, 0x88, 0x88, 0x02, 0x2a, 0x20, 0x00, 0x08, 0xa0, 0x2a, 0xaa, 0x22, 0x20, 0x8a, 0xa0, 0x02, 0x04, 0x01, 0x01, 0x01, 0x40, 0x00, 0x00, 0x40, 0x10, 0x10, 0x41, 0x54, 0x11, 0x00, 0x11, 0x40, 0x54, 0x05, 0x04, 0x05, 0x50, 0x11, 0x00, 0x04, 0x10, 0x00, 0x01, 0x40, 0x10, 0x45, 0x00, 0x15, 0x82, 0x80, 0x08, 0x02, 0x80, 0x00, 0x00, 0x00, 0x22, 0x88, 0x02, 0x02, 0x22, 0x00, 0x82, 0x08, 0x02, 0x08, 0x02, 0x0a, 0x80, 0x22, 0x00, 0x08, 0x20, 0x00, 0x02, 0x20, 0x20, 0xa2, 0x00, 0x28, 0x01, 0x01, 0x05, 0x01, 0x40, 0x00, 0x00, 0x40, 0x14, 0x51, 0x41, 0x44, 0x11, 0x40, 0x04, 0x11, 0x04, 0x05, 0x01, 0x14, 0x00, 0x15, 0x00, 0x04, 0x10, 0x00, 0x01, 0x40, 0x10, 0x51, 0x01, 0x50, 0x82, 0x00, 0x02, 0x02, 0x80, 0x00, 0x00, 0x80, 0xa2, 0x88, 0x2a, 0x28, 0x22, 0x80, 0x02, 0x28, 0x8a, 0x88, 0x00, 0x28, 0x00, 0x22, 0x00, 0x08, 0x20, 0x00, 0x02, 0x20, 0xa0, 0xa8, 0x02, 0x20, 0x01, 0x05, 0x05, 0x04, 0x44, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x00, 0x00, 0x00, 0x01, 0x44, 0x00, 0x04, 0x40, 0x40, 0x04, 0x44, 0x10, 0x51, 0x15, 0x40, 0x82, 0x00, 0x02, 0x08, 0x82, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x00, 0x00, 0x00, 0x02, 0x82, 0x08, 0x08, 0x80, 0x20, 0x08, 0x22, 0xa0, 0xa0, 0x2a, 0x20, 0x14, 0x01, 0x00, 0x50, 0x50, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x15, 0x00, 0x05, 0x50, 0x50, 0x50, 0x40, 0x15, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x80, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x54, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xa8, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x50, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x55, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x15, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x2a, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x15, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0xa2, 0x00, 0x80, 0x02, 0x0a, 0xa2, 0x82, 0x02, 0x0a, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xa8, 0xa0, 0x80, 0x82, 0xa0, 0x11, 0x01, 0x00, 0x04, 0x11, 0x50, 0x41, 0x04, 0x11, 0x10, 0x00, 0x14, 0x44, 0x40, 0x00, 0x41, 0x11, 0x00, 0x14, 0x00, 0x44, 0x05, 0x05, 0x04, 0x45, 0x00, 0x10, 0x44, 0x11, 0x11, 0x04, 0x44, 0xa2, 0x02, 0x20, 0x80, 0x20, 0x28, 0x20, 0x08, 0x02, 0x20, 0x80, 0x22, 0xa8, 0xa8, 0xa0, 0x82, 0x28, 0x00, 0x28, 0x80, 0x22, 0x08, 0x82, 0x0a, 0x22, 0x80, 0x00, 0x82, 0x20, 0x00, 0x88, 0x8a, 0x51, 0x05, 0x50, 0x00, 0x10, 0x11, 0x11, 0x10, 0x01, 0x50, 0x40, 0x10, 0x54, 0x04, 0x11, 0x04, 0x41, 0x00, 0x50, 0x40, 0x10, 0x04, 0x44, 0x10, 0x44, 0x40, 0x01, 0x01, 0x10, 0x10, 0x44, 0x14, 0xa2, 0x00, 0xa0, 0x00, 0xa8, 0x02, 0xa0, 0x0a, 0x02, 0xa0, 0xa0, 0x00, 0x0a, 0x82, 0x08, 0x82, 0x20, 0x00, 0xa0, 0x20, 0x20, 0x08, 0x22, 0x08, 0x02, 0x80, 0x02, 0x02, 0x20, 0xa8, 0x8a, 0x82, 0x51, 0x01, 0x40, 0x01, 0x55, 0x01, 0x10, 0x00, 0x01, 0x40, 0x41, 0x00, 0x04, 0x54, 0x50, 0x41, 0x40, 0x00, 0x40, 0x10, 0x10, 0x04, 0x41, 0x05, 0x01, 0x00, 0x05, 0x01, 0x10, 0x10, 0x40, 0x50, 0xa2, 0x08, 0x80, 0x82, 0xa0, 0x8a, 0x20, 0x00, 0x02, 0x80, 0x22, 0x00, 0x02, 0x0a, 0x28, 0x80, 0x20, 0x00, 0x80, 0x20, 0x08, 0x88, 0xa0, 0x00, 0x02, 0x00, 0x0a, 0x02, 0x20, 0x08, 0x80, 0xa0, 0x51, 0x01, 0x00, 0x44, 0x50, 0x11, 0x10, 0x00, 0x01, 0x00, 0x11, 0x00, 0x01, 0x01, 0x04, 0x40, 0x10, 0x00, 0x40, 0x11, 0x10, 0x10, 0x11, 0x00, 0x01, 0x00, 0x10, 0x01, 0x10, 0x10, 0x40, 0x50, 0xa2, 0x08, 0x00, 0x88, 0x80, 0x08, 0x20, 0x00, 0x02, 0x02, 0x22, 0x00, 0x02, 0x02, 0x08, 0x20, 0x20, 0x00, 0x80, 0x08, 0x08, 0x88, 0x20, 0x80, 0x00, 0x00, 0x20, 0x02, 0x20, 0x28, 0x80, 0xa0, 0x51, 0x11, 0x10, 0x44, 0x40, 0x50, 0x40, 0x10, 0x01, 0x00, 0x11, 0x00, 0x01, 0x01, 0x04, 0x40, 0x10, 0x00, 0x01, 0x11, 0x04, 0x50, 0x10, 0x00, 0x01, 0x40, 0x10, 0x04, 0x11, 0x50, 0x00, 0x01, 0xa2, 0x28, 0x20, 0x82, 0x0a, 0x20, 0xa0, 0x0a, 0x02, 0x02, 0x22, 0x88, 0x00, 0x82, 0x08, 0x22, 0x08, 0x80, 0x80, 0x28, 0x08, 0x28, 0x20, 0x88, 0x00, 0x80, 0x08, 0xaa, 0x20, 0xa0, 0x82, 0xaa, 0x41, 0x50, 0x50, 0x01, 0x55, 0x00, 0x00, 0x05, 0x05, 0x05, 0x51, 0x04, 0x01, 0x45, 0x14, 0x11, 0x50, 0x00, 0x41, 0x50, 0x04, 0x10, 0x50, 0x44, 0x00, 0x40, 0x05, 0x50, 0x50, 0x40, 0x01, 0x14, 0xaa, 0xaa, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xa0, 0x82, 0x00, 0x2a, 0xa8, 0x20, 0x28, 0x80, 0x2a, 0x20, 0x08, 0x08, 0xa0, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0x80, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x40, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x02, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x55, 0x05, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x2a, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x15, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x8a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x45, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x88, 0xa2, 0x22, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x80, 0xaa, 0x2a, 0x0a, 0x00, 0x0a, 0x08, 0x02, 0x22, 0xa0, 0x80, 0x08, 0x00, 0xa0, 0x00, 0x20, 0xa0, 0xa0, 0xa0, 0x41, 0x01, 0x51, 0x45, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x55, 0x55, 0x14, 0x00, 0x11, 0x14, 0x05, 0x45, 0x10, 0x41, 0x11, 0x00, 0x40, 0x01, 0x14, 0x41, 0x40, 0x10, 0x82, 0x28, 0xa2, 0xaa, 0x80, 0xa2, 0xa2, 0xa0, 0xa8, 0x00, 0x28, 0x28, 0x08, 0xa2, 0x02, 0xaa, 0xa8, 0x80, 0x20, 0x88, 0x88, 0x0a, 0x08, 0x82, 0x20, 0x00, 0x80, 0x0a, 0x00, 0x82, 0x00, 0x08, 0x04, 0x51, 0x51, 0x55, 0x45, 0x44, 0x11, 0x11, 0x11, 0x01, 0x50, 0x44, 0x04, 0x11, 0x05, 0x55, 0x41, 0x41, 0x40, 0x10, 0x40, 0x55, 0x04, 0x44, 0x40, 0x00, 0x00, 0x14, 0x00, 0x01, 0x01, 0x04, 0x88, 0xa8, 0xa8, 0x2a, 0x2a, 0x20, 0x08, 0x0a, 0x0a, 0x02, 0xa0, 0x80, 0x88, 0x08, 0xa2, 0xaa, 0x02, 0x22, 0x00, 0x08, 0xa0, 0x8a, 0x02, 0x88, 0x20, 0x00, 0x00, 0x20, 0x00, 0x82, 0x20, 0x02, 0x05, 0x55, 0x54, 0x55, 0x44, 0x40, 0x50, 0x51, 0x11, 0x01, 0x04, 0x51, 0x10, 0x51, 0x41, 0x55, 0x05, 0x44, 0x00, 0x10, 0x00, 0x50, 0x54, 0x45, 0x40, 0x00, 0x00, 0x40, 0x50, 0x01, 0x01, 0x54, 0x80, 0x2a, 0xaa, 0x0a, 0x28, 0x28, 0x08, 0x08, 0x08, 0x02, 0x88, 0x88, 0x80, 0x08, 0xa8, 0xaa, 0x0a, 0x28, 0x00, 0x08, 0xa0, 0x02, 0x02, 0x80, 0x20, 0x00, 0x00, 0x80, 0x08, 0x02, 0x02, 0x02, 0x00, 0x15, 0x55, 0x15, 0x44, 0x44, 0x10, 0x11, 0x11, 0x01, 0x04, 0x45, 0x50, 0x10, 0x51, 0x55, 0x15, 0x44, 0x00, 0x10, 0x00, 0x01, 0x04, 0x40, 0x40, 0x00, 0x00, 0x40, 0x04, 0x01, 0x11, 0x04, 0x80, 0x0a, 0xaa, 0x2a, 0x82, 0x22, 0xa0, 0xa0, 0x08, 0x02, 0xa8, 0xa8, 0x20, 0xa0, 0xa8, 0xaa, 0x0a, 0x28, 0x00, 0x08, 0x80, 0x00, 0x02, 0x80, 0x20, 0x00, 0x00, 0x80, 0x02, 0x02, 0x0a, 0x02, 0x00, 0x04, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x55, 0x15, 0x44, 0x00, 0x10, 0x10, 0x00, 0x04, 0x40, 0x40, 0x00, 0x00, 0x40, 0x04, 0x01, 0x04, 0x04, 0x08, 0x02, 0xa8, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x28, 0x82, 0x00, 0x08, 0xa8, 0x80, 0x08, 0x88, 0x20, 0x00, 0x20, 0x20, 0x02, 0x0a, 0x0a, 0x08, 0x44, 0x00, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x51, 0x01, 0x11, 0x10, 0x54, 0x41, 0x10, 0x44, 0x40, 0x00, 0x40, 0x10, 0x04, 0x01, 0x04, 0x10, 0x00, 0x00, 0xa0, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x08, 0x00, 0x00, 0x00, 0xaa, 0x08, 0x00, 0x0a, 0x2a, 0x2a, 0x0a, 0xa0, 0xa0, 0xa0, 0x00, 0x20, 0x0a, 0x28, 0x02, 0x00, 0xa0, 0x50, 0x01, 0x50, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Splash.c0000644000000000000000000003312413614532331020256 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "windowstr.h" #include "scrnintstr.h" #include "Agent.h" #include "Xlib.h" #include "Xutil.h" #include "Display.h" #include "Splash.h" #include "Screen.h" #include "Windows.h" #include "Atoms.h" #include "Trap.h" #include "Init.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG /* * Colors used to paint the splash screen. */ #define nxagentLogoWhite 0xffffff #define nxagentLogoBlack 0x000000 #define nxagentLogoDarkGray 0x222222 #define nxagentLogoLightGray 0xbbbbbb Pixmap nxagentPixmapLogo; Window nxagentSplashWindow = None; Bool nxagentWMPassed = False; static void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height); void nxagentShowSplashWindow(Window parentWindow) { XWindowAttributes getAttributes; XWindowChanges values; XSetWindowAttributes attributes; /* * Show splash window only when running as X2Go Agent */ if(!nxagentX2go) return; #ifdef TEST fprintf(stderr, "%s: Got called.\n", __func__); #endif #ifdef NXAGENT_TIMESTAMP { extern unsigned long startTime; fprintf(stderr, "%s: Initializing splash start at [%d] milliseconds.\n", __func__, GetTimeInMillis() - startTime); } #endif #ifdef NXAGENT_ONSTART XSetSelectionOwner(nxagentDisplay, nxagentReadyAtom, None, CurrentTime); #endif nxagentWMPassed = False; /* * This would cause a GetWindowAttributes and a * GetGeometry (asynchronous) reply. We use instead * the geometry requested by the user for the agent * window. * * XGetWindowAttributes(nxagentDisplay, parentWindow, &getAttributes); */ /* * During reconnection we draw the splash over * the default window and not over the root * window because it would be hidden by other * windows. */ if (nxagentReconnectTrap) { getAttributes.x = nxagentOption(RootX); getAttributes.y = nxagentOption(RootY); } else { getAttributes.x = 0; getAttributes.y = 0; } getAttributes.width = nxagentOption(RootWidth); getAttributes.height = nxagentOption(RootHeight); #ifdef TEST fprintf(stderr, "%s: Going to create new splash window.\n", __func__); #endif nxagentSplashWindow = XCreateSimpleWindow(nxagentDisplay, parentWindow, getAttributes.x, getAttributes.y, getAttributes.width, getAttributes.height, 0, WhitePixel (nxagentDisplay, 0), BlackPixel (nxagentDisplay, 0)); #ifdef TEST fprintf(stderr, "%s: Created new splash window with id [%ld].\n", __func__, nxagentSplashWindow); #endif XlibGC gc = XCreateGC(nxagentDisplay, nxagentSplashWindow, 0, NULL); nxagentPaintLogo(nxagentSplashWindow, gc, 1, getAttributes.width, getAttributes.height); XMapRaised (nxagentDisplay, nxagentSplashWindow); values.stack_mode = Above; XConfigureWindow(nxagentDisplay, nxagentSplashWindow, CWStackMode, &values); attributes.override_redirect = True; XChangeWindowAttributes(nxagentDisplay, nxagentSplashWindow, CWOverrideRedirect, &attributes); XFreeGC(nxagentDisplay, gc); #ifdef NXAGENT_TIMESTAMP { extern unsigned long startTime; fprintf(stderr, "%s: Splash ends [%d] milliseconds.\n", __func__, GetTimeInMillis() - startTime); } #endif } void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height) { int depth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)); #ifdef DEBUG fprintf(stderr, "%s: Got called.\n", __func__); #endif #ifdef NXAGENT_LOGO_DEBUG fprintf(stderr, "%s: begin\n", __func__); fprintf(stderr, "%s: gen params are: w=%d h=%d d=%d w=%x b=%x g1=%x g2=%x \n", __func__, width, height, depth, nxagentLogoWhite, nxagentLogoBlack, nxagentLogoDarkGray, nxagentLogoLightGray); #endif int w = width/scale; int h = height/scale; int w2 = w/2; int h2 = h/2; int c; if (height > width) { c = w/30; } else { c = w/48; } XSetFunction(nxagentDisplay, gc, GXcopy); XSetFillStyle(nxagentDisplay, gc, FillSolid); nxagentPixmapLogo = XCreatePixmap(nxagentDisplay, win, width, height, depth); if (!nxagentPixmapLogo) { return; } if (blackRoot) { XSetForeground(nxagentDisplay, gc, nxagentLogoBlack); XSetBackground(nxagentDisplay, gc, nxagentLogoWhite); } else { XSetForeground(nxagentDisplay, gc, nxagentLogoWhite); XSetBackground(nxagentDisplay, gc, nxagentLogoBlack); } XPoint rect[4]; rect[0].x = 0; rect[0].y = 0; rect[1].x = 0; rect[1].y = h; rect[2].x = w; rect[2].y = h; rect[3].x = w; rect[3].y = 0; /* paint background */ XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); #ifdef NXAGENT_LOGO_DEBUG fprintf(stderr, "%s: filled first poly\n", __func__); #endif /* * Draw X2GO Logo */ if (blackRoot) XSetForeground(nxagentDisplay, gc, nxagentLogoDarkGray); else XSetForeground(nxagentDisplay, gc, nxagentLogoLightGray); /* * Start 'X'. */ rect[0].x = w2-7*c; rect[0].y = h2-5*c; rect[1].x = w2-8*c; rect[1].y = h2-5*c; rect[2].x = w2-4*c; rect[2].y = h2+3*c; rect[3].x = w2-3*c; rect[3].y = h2+3*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); rect[0].x = w2-4*c; rect[0].y = h2-5*c; rect[1].x = w2-3*c; rect[1].y = h2-5*c; rect[2].x = w2-7*c; rect[2].y = h2+3*c; rect[3].x = w2-8*c; rect[3].y = h2+3*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* * End 'X'. */ /* * Start '2'. */ rect[0].x = w2-2*c; rect[0].y = h2-5*c; rect[1].x = w2-1*c; rect[1].y = h2-5*c; rect[2].x = w2-1*c; rect[2].y = h2-3*c; rect[3].x = w2-2*c; rect[3].y = h2-3*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); rect[0].x = w2-2*c; rect[0].y = h2-5*c; rect[1].x = w2+2*c; rect[1].y = h2-5*c; rect[2].x = w2+2*c; rect[2].y = h2-4*c; rect[3].x = w2-2*c; rect[3].y = h2-4*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); rect[0].x = w2+1*c; rect[0].y = h2-5*c; rect[1].x = w2+2*c; rect[1].y = h2-5*c; rect[2].x = w2+2*c; rect[2].y = h2-2*c; rect[3].x = w2+1*c; rect[3].y = h2-2*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); rect[0].x = w2+2*c; rect[0].y = h2-2*c; rect[1].x = w2+1*c; rect[1].y = h2-2*c; rect[2].x = w2-2*c; rect[2].y = h2+2*c; rect[3].x = w2-1*c; rect[3].y = h2+2*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); rect[0].x = w2-2*c; rect[0].y = h2+2*c; rect[1].x = w2+2*c; rect[1].y = h2+2*c; rect[2].x = w2+2*c; rect[2].y = h2+3*c; rect[3].x = w2-2*c; rect[3].y = h2+3*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* * End '2'. */ /* * Start 'G'. */ rect[0].x = w2+3*c; rect[0].y = h2-5*c; rect[1].x = w2+7*c; rect[1].y = h2-5*c; rect[2].x = w2+7*c; rect[2].y = h2-4*c; rect[3].x = w2+3*c; rect[3].y = h2-4*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); rect[0].x = w2+3*c; rect[0].y = h2-5*c; rect[1].x = w2+4*c; rect[1].y = h2-5*c; rect[2].x = w2+4*c; rect[2].y = h2+3*c; rect[3].x = w2+3*c; rect[3].y = h2+3*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); rect[0].x = w2+3*c; rect[0].y = h2+2*c; rect[1].x = w2+7*c; rect[1].y = h2+2*c; rect[2].x = w2+7*c; rect[2].y = h2+3*c; rect[3].x = w2+3*c; rect[3].y = h2+3*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); rect[0].x = w2+6*c; rect[0].y = h2-5*c; rect[1].x = w2+7*c; rect[1].y = h2-5*c; rect[2].x = w2+7*c; rect[2].y = h2-3*c; rect[3].x = w2+6*c; rect[3].y = h2-3*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); rect[0].x = w2+6*c; rect[0].y = h2-0*c; rect[1].x = w2+7*c; rect[1].y = h2-0*c; rect[2].x = w2+7*c; rect[2].y = h2+3*c; rect[3].x = w2+6*c; rect[3].y = h2+3*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); rect[0].x = w2+5*c; rect[0].y = h2-1*c; rect[1].x = w2+7*c; rect[1].y = h2-1*c; rect[2].x = w2+7*c; rect[2].y = h2+0*c; rect[3].x = w2+5*c; rect[3].y = h2+0*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* * End 'G'. */ /* * Start 'O'. */ rect[0].x = w2+8*c; rect[0].y = h2-5*c; rect[1].x = w2+12*c; rect[1].y = h2-5*c; rect[2].x = w2+12*c; rect[2].y = h2-4*c; rect[3].x = w2+8*c; rect[3].y = h2-4*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); rect[0].x = w2+8*c; rect[0].y = h2+3*c; rect[1].x = w2+12*c; rect[1].y = h2+3*c; rect[2].x = w2+12*c; rect[2].y = h2+2*c; rect[3].x = w2+8*c; rect[3].y = h2+2*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); rect[0].x = w2+8*c; rect[0].y = h2-5*c; rect[1].x = w2+9*c; rect[1].y = h2-5*c; rect[2].x = w2+9*c; rect[2].y = h2+3*c; rect[3].x = w2+8*c; rect[3].y = h2+3*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); rect[0].x = w2+11*c; rect[0].y = h2-5*c; rect[1].x = w2+12*c; rect[1].y = h2-5*c; rect[2].x = w2+12*c; rect[2].y = h2+3*c; rect[3].x = w2+11*c; rect[3].y = h2+3*c; XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* * End 'O'. */ XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo); #ifdef NXAGENT_LOGO_DEBUG fprintf(stderr, "%s: end\n", __func__); #endif } void nxagentRemoveSplashWindow(void) { if (nxagentWMPassed) return; if (nxagentReconnectTrap) return; #ifdef TEST fprintf(stderr, "%s: Destroying the splash window.\n", __func__); #endif if (!nxagentWMPassed) { #ifdef NXAGENT_ONSTART XSetSelectionOwner(nxagentDisplay, nxagentReadyAtom, nxagentDefaultWindows[0], CurrentTime); #endif nxagentWMPassed = True; } if (nxagentSplashWindow != None) { XDestroyWindow(nxagentDisplay, nxagentSplashWindow); nxagentSplashWindow = None; nxagentRefreshWindows(screenInfo.screens[0]->root); #ifdef TEST fprintf(stderr, "%s: setting the ownership of %s (%d) on window 0x%lx\n", __func__ "NX_CUT_BUFFER_SERVER", (int)serverTransToAgentProperty, nxagentWindow(screenInfo.screens[0]->root)); #endif XSetSelectionOwner(nxagentDisplay, serverTransToAgentProperty, nxagentWindow(screenInfo.screens[0]->root), CurrentTime); } if (nxagentPixmapLogo) { XFreePixmap(nxagentDisplay, nxagentPixmapLogo); nxagentPixmapLogo = (Pixmap) 0; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Splash.h0000644000000000000000000000432213614532331020261 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Splash_H__ #define __Splash_H__ #include "Windows.h" #include "X11/Xdmcp.h" #include #define XDM_TIMEOUT 20000 extern xdmcp_states XdmcpState; extern int XdmcpTimeOutRtx; extern int XdmcpStartTime; extern int nxagentXdmcpUp; extern Window nxagentSplashWindow; extern void nxagentShowSplashWindow(Window); extern void nxagentRemoveSplashWindow(); #endif /* __Splash_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Split.c0000644000000000000000000010775213614532331020130 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "scrnintstr.h" #include "pixmapstr.h" #include "windowstr.h" #include "gcstruct.h" #include "Agent.h" #include "Display.h" #include "Drawable.h" #include "Events.h" #include "GCs.h" #include "compext/Compext.h" /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG /* * This should be a macro but for now we make it a real function to * log a warning in the logs. */ DrawablePtr nxagentSplitDrawable(DrawablePtr pDrawable) { if (pDrawable -> type == DRAWABLE_PIXMAP && nxagentPixmapIsVirtual((PixmapPtr) pDrawable)) { #ifdef TEST fprintf(stderr, "nxagentSplitDrawable: WARNING! The drawable at [%p] is " "virtual. Assuming real at [%p].\n", (void *) pDrawable, (void *) nxagentRealPixmap((PixmapPtr) pDrawable)); #endif return (DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable); } else { return pDrawable; } } void nxagentInitSplitResources(void) { #ifdef TEST fprintf(stderr, "nxagentInitSplitResources: Initializing the split resources.\n"); #endif for (int resource = 0; resource < NXNumberOfResources; resource++) { SplitResourcePtr pResource = &nxagentSplitResources[resource]; pResource -> pending = 0; pResource -> commit = 0; pResource -> split = NXNoResource; pResource -> unpack = NXNoResource; pResource -> drawable = NULL; pResource -> region = NullRegion; pResource -> gc = NULL; } } SplitResourcePtr nxagentAllocSplitResource(void) { int resource; for (;;) { resource = NXAllocSplit(nxagentDisplay, NXAnyResource); if (resource != NXNoResource) { #ifdef TEST fprintf(stderr, "nxagentAllocSplitResource: Reserving resource [%d] for the next split.\n", resource); #endif break; } else { #ifdef PANIC fprintf(stderr, "nxagentAllocSplitResource: PANIC! No more resources for the next split.\n"); #endif /* FIXME: Must deal with the case all resources are exausted. */ FatalError("nxagentAllocSplitResource: PANIC! No more resources for the next split.\n"); } } SplitResourcePtr pResource = &nxagentSplitResources[resource]; if (pResource -> pending != 0 || pResource -> split != NXNoResource || pResource -> unpack != NXNoResource || pResource -> drawable != NULL || pResource -> region != NullRegion || pResource -> commit != 0 || pResource -> gc != NULL) { /* * This is really an unrecoverable error. */ #ifdef PANIC fprintf(stderr, "nxagentAllocSplitResource: PANIC! Invalid record for resource [%d] with " "pending [%d] split [%d] unpack [%d] drawable [%p] region [%p] commit [%d] gc [%p].\n", resource, pResource -> pending, pResource -> split, pResource -> unpack, (void *) pResource -> drawable, (void *) pResource -> region, pResource -> commit, (void *) pResource -> gc); #endif FatalError("nxagentAllocSplitResource: PANIC! Invalid record for resource [%d] with " "pending [%d] split [%d] unpack [%d] drawable [%p] region [%p] commit [%d] gc [%p].\n", resource, pResource -> pending, pResource -> split, pResource -> unpack, (void *) pResource -> drawable, (void *) pResource -> region, pResource -> commit, (void *) pResource -> gc); } pResource -> pending = 1; pResource -> split = resource; return pResource; } void nxagentFreeSplitResource(SplitResourcePtr pResource) { if (pResource -> pending == 0 || pResource -> split == NXNoResource || pResource -> drawable != NULL || pResource -> region != NullRegion || pResource -> gc != NULL) { #ifdef PANIC fprintf(stderr, "nxagentFreeSplitResource: PANIC! Invalid record provided with values " "pending [%d] split [%d] unpack [%d] drawable [%p] region [%p] commit [%d] gc [%p].\n", pResource -> pending, pResource -> split, pResource -> unpack, (void *) pResource -> drawable, (void *) pResource -> region, pResource -> commit, (void *) pResource -> gc); #endif FatalError("nxagentFreeSplitResource: PANIC! Invalid record provided with values " "pending [%d] split [%d] unpack [%d] drawable [%p] region [%p] commit [%d] gc [%p].\n", pResource -> pending, pResource -> split, pResource -> unpack, (void *) pResource -> drawable, (void *) pResource -> region, pResource -> commit, (void *) pResource -> gc); } #ifdef TEST fprintf(stderr, "nxagentFreeSplitResource: Clearing the record for resource [%d].\n", pResource -> split); #endif NXFreeSplit(nxagentDisplay, pResource -> split); pResource -> pending = 0; pResource -> commit = 0; pResource -> split = NXNoResource; pResource -> unpack = NXNoResource; pResource -> drawable = NULL; pResource -> region = NullRegion; pResource -> gc = NULL; } void nxagentInitUnpackResources(void) { /* FIXME: This must be implemented. */ } UnpackResourcePtr nxagentAllocUnpackResource(void) { /* FIXME: This must be implemented. */ return NULL; } void nxagentFreeUnpackResource(UnpackResourcePtr pResource) { /* FIXME: This must be implemented. */ } void nxagentReleaseAllSplits(void) { #ifdef TEST fprintf(stderr, "nxagentReleaseAllSplits: Going to release all the split resources.\n"); #endif for (int resource = 0; resource < NXNumberOfResources; resource++) { SplitResourcePtr pResource = &nxagentSplitResources[resource]; if (pResource != NULL && pResource -> pending == 1) { DrawablePtr pDrawable = pResource -> drawable; if (pDrawable != NULL) { #ifdef TEST fprintf(stderr, "nxagentReleaseAllSplits: Releasing the drawable at [%p] for " "resource [%d].\n", (void *) pDrawable, pResource -> split); #endif nxagentReleaseSplit(pDrawable); } #ifdef TEST fprintf(stderr, "nxagentReleaseAllSplits: Freeing the resource [%d].\n", resource); #endif nxagentFreeSplitResource(pResource); } } } /* * Check the coherency of the split record. */ #ifdef TEST static void nxagentCheckSplit(DrawablePtr pDrawable, SplitResourcePtr pResource) { if (pResource == NULL) { #ifdef PANIC fprintf(stderr, "nxagentCheckSplit: PANIC! No record associated to drawable at [%p].\n", (void *) pDrawable); #endif FatalError("nxagentCheckSplit: PANIC! No record associated to drawable at [%p].\n", (void *) pDrawable); } else if (pResource -> drawable != pDrawable || pResource -> split == NXNoResource) { #ifdef PANIC fprintf(stderr, "nxagentCheckSplit: PANIC! The record [%d] doesn't match the drawable at [%p].\n", pResource -> split, (void *) pDrawable); #endif FatalError("nxagentCheckSplit: PANIC! The record [%d] doesn't match the drawable at [%p].\n", pResource -> split, (void *) pDrawable); } else if (pResource -> commit == 1 && pResource -> gc == NULL) { #ifdef PANIC fprintf(stderr, "nxagentCheckSplit: PANIC! The record [%d] doesn't have a valid GC.\n", pResource -> split); #endif FatalError("nxagentCheckSplit: PANIC! The record [%d] doesn't have a valid GC.\n", pResource -> split); } } static void nxagentCheckResource(SplitResourcePtr pResource, int resource) { if (pResource == NULL) { #ifdef PANIC fprintf(stderr, "nxagentCheckResource: PANIC! No record associated to resource [%d].\n", resource); #endif FatalError("nxagentCheckResource: PANIC! No record associated to resource [%d].\n", resource); } else if ((pResource -> split != resource || pResource -> pending != 1) || (pResource -> commit == 1 && (pResource -> drawable == NULL || pResource -> gc == NULL))) { #ifdef PANIC fprintf(stderr, "nxagentCheckResource: PANIC! Invalid record for resource [%d] with " "pending [%d] split [%d] unpack [%d] drawable [%p] region [%p] commit [%d] gc [%p].\n", resource, pResource -> pending, pResource -> split, pResource -> unpack, (void *) pResource -> drawable, (void *) pResource -> region, pResource -> commit, (void *) pResource -> gc); #endif FatalError("nxagentCheckResource: PANIC! Invalid record for resource [%d] with " "pending [%d] split [%d] unpack [%d] drawable [%p] region [%p] commit [%d] gc [%p].\n", resource, pResource -> pending, pResource -> split, pResource -> unpack, (void *) pResource -> drawable, (void *) pResource -> region, pResource -> commit, (void *) pResource -> gc); } } #endif int nxagentCreateSplit(DrawablePtr pDrawable, GCPtr *pGC) { pDrawable = nxagentSplitDrawable(pDrawable); SplitResourcePtr pResource = nxagentAllocSplitResource(); if (pDrawable -> type == DRAWABLE_PIXMAP) { nxagentPixmapPriv((PixmapPtr) pDrawable) -> splitResource = pResource; } else { nxagentWindowPriv((WindowPtr) pDrawable) -> splitResource = pResource; } pResource -> drawable = pDrawable; pResource -> commit = 1; /* * Make a copy of the GC so the client can safely remove it. */ pResource -> gc = CreateScratchGC(pDrawable -> pScreen, pDrawable -> depth); /* FIXME: What do we do here? */ if (pResource -> gc == NULL) { #ifdef PANIC fprintf(stderr, "nxagentCreateSplit: PANIC! Failed to create split GC for resource [%d].\n", pResource -> split); #endif FatalError("nxagentCreateSplit: PANIC! Failed to create split GC for resource [%d].\n", pResource -> split); } else if (CopyGC(*pGC, pResource -> gc, GCFunction | GCPlaneMask | GCSubwindowMode | GCClipXOrigin | GCClipYOrigin | GCClipMask | GCForeground | GCBackground) != Success) { /* FIXME: What do we do here? */ #ifdef PANIC fprintf(stderr, "nxagentCreateSplit: PANIC! Failed to copy split GC for resource [%d].\n", pResource -> split); #endif FatalError("nxagentCreateSplit: PANIC! Failed to copy split GC for resource [%d].\n", pResource -> split); } #ifdef TEST fprintf(stderr, "nxagentCreateSplit: Associated GC at [%p] to resource [%d] " "with id [%lu].\n", (void *) pResource -> gc, pResource -> split, (unsigned long) nxagentGC(pResource -> gc)); #endif *pGC = pResource -> gc; #ifdef TEST fprintf(stderr, "nxagentCreateSplit: Associated resource [%d] to drawable at [%p].\n", pResource -> split, (void *) pResource -> drawable); #endif return pResource -> split; } /* * Set the region to be the current streaming region. */ void nxagentRegionSplit(DrawablePtr pDrawable, RegionPtr pRegion) { pDrawable = nxagentSplitDrawable(pDrawable); SplitResourcePtr pResource = nxagentSplitResource(pDrawable); #ifdef TEST fprintf(stderr, "nxagentRegionSplit: Associating region to resource [%d] drawable at [%p].\n", pResource -> split, (void *) pDrawable); nxagentCheckSplit(pDrawable, pResource); #endif if (pResource == NULL) { #ifdef PANIC fprintf(stderr, "nxagentRegionSplit: PANIC! No valid split record for drawable at [%p].\n", (void *) pDrawable); #endif return; } #ifdef TEST fprintf(stderr, "nxagentRegionSplit: Associated region [%d,%d,%d,%d] to drawable at [%p] " "with resource [%d].\n", pRegion -> extents.x1, pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2, (void *) pDrawable, pResource -> split); #endif pResource -> region = pRegion; } /* * Remove the association between the drawable and the split * resource. The resource is not deallocated until the end of the * split. */ void nxagentReleaseSplit(DrawablePtr pDrawable) { pDrawable = nxagentSplitDrawable(pDrawable); SplitResourcePtr pResource = nxagentSplitResource(pDrawable); if (pResource == NULL) { #ifdef TEST fprintf(stderr, "nxagentReleaseSplit: No split resources for drawable at [%p].\n", (void *) pDrawable); #endif return; } #ifdef TEST fprintf(stderr, "nxagentReleaseSplit: Going to release resource [%d] for drawable at [%p].\n", pResource -> split, (void *) pDrawable); nxagentCheckSplit(pDrawable, pResource); #endif if (pResource -> region != NullRegion) { /* * If we have a region the commits had to be still valid. In this * case tell the proxy to abort the data transfer. */ #ifdef TEST if (pResource -> commit == 0) { #ifdef PANIC fprintf(stderr, "nxagentReleaseSplit: PANIC! Found a region for resource [%d] but the " "commits are invalid.\n", pResource -> split); #endif FatalError("nxagentReleaseSplit: PANIC! Found a region for resource [%d] but the " "commits are invalid.\n", pResource -> split); } #endif #ifdef TEST fprintf(stderr, "nxagentReleaseSplit: Aborting the data transfer for resource [%d].\n", pResource -> split); #endif NXAbortSplit(nxagentDisplay, pResource -> split); #ifdef TEST fprintf(stderr, "nxagentReleaseSplit: Freeing the region for drawable at [%p].\n", (void *) pDrawable); #endif RegionDestroy(pResource -> region); pResource -> region = NullRegion; } if (pResource -> gc != NULL) { #ifdef TEST fprintf(stderr, "nxagentReleaseSplit: Freeing the split GC for drawable at [%p].\n", (void *) pDrawable); #endif FreeScratchGC(pResource -> gc); pResource -> gc = NULL; } /* * Remove the association between the drawable and the resource * record. */ #ifdef TEST fprintf(stderr, "nxagentReleaseSplit: Removing association to drawable at [%p].\n", (void *) pDrawable); #endif if (pDrawable -> type == DRAWABLE_PIXMAP) { nxagentPixmapPriv((PixmapPtr) pDrawable) -> splitResource = NULL; } else { nxagentWindowPriv((WindowPtr) pDrawable) -> splitResource = NULL; } /* * Invalidate the commits and remove the association between the * resource and the drawable. */ pResource -> drawable = NULL; pResource -> commit = 0; } void nxagentValidateSplit(DrawablePtr pDrawable, RegionPtr pRegion) { pDrawable = nxagentSplitDrawable(pDrawable); SplitResourcePtr pResource = nxagentSplitResource(pDrawable); if (pResource == NULL) { #ifdef TEST fprintf(stderr, "nxagentValidateSplit: No split resource for drawable at [%p].\n", (void *) pDrawable); #endif return; } else if (pResource -> region == NullRegion) { #ifdef TEST fprintf(stderr, "nxagentValidateSplit: No split region yet for drawable at [%p].\n", (void *) pDrawable); #endif return; } else if (pResource -> commit == 0) { #ifdef TEST fprintf(stderr, "nxagentValidateSplit: WARNING! Split for drawable at [%p] was " "already invalidated.\n", (void *) pDrawable); #endif return; } #ifdef TEST fprintf(stderr, "nxagentValidateSplit: Going to validate resource [%d] drawable at [%p].\n", pResource -> split, (void *) pDrawable); nxagentCheckSplit(pDrawable, pResource); #endif #ifdef TEST fprintf(stderr, "nxagentValidateSplit: Checking the region for resource [%d] " "and drawable at [%p].\n", pResource -> split, (void *) pDrawable); #endif /* * If a null region is passed as parameter, we assume that all the * commits have to be discarded. */ if (pRegion == NullRegion) { #ifdef TEST fprintf(stderr, "nxagentValidateSplit: Forcing all commits as invalid for " "drawable at [%p].\n", (void *) pDrawable); #endif nxagentReleaseSplit(pDrawable); } else { RegionRec tmpRegion; /* * Check if the provided region overlaps the area covered by the * image being streamed. */ RegionInit(&tmpRegion, NullBox, 1); RegionIntersect(&tmpRegion, pResource -> region, pRegion); if (RegionNil(&tmpRegion) == 0) { #ifdef TEST fprintf(stderr, "nxagentValidateSplit: Marking the overlapping commits as invalid " "for drawable at [%p].\n", (void *) pDrawable); #endif nxagentReleaseSplit(pDrawable); } #ifdef TEST else { fprintf(stderr, "nxagentValidateSplit: Leaving the commits as valid for " "drawable at [%p].\n", (void *) pDrawable); } #endif RegionUninit(&tmpRegion); } } void nxagentFreeSplit(int resource) { DrawablePtr pDrawable; SplitResourcePtr pResource = &nxagentSplitResources[resource]; if (pResource == NULL) { #ifdef PANIC fprintf(stderr, "nxagentFreeSplit: PANIC! No valid split record for resource [%d].\n", resource); #endif FatalError("nxagentFreeSplit: PANIC! No valid split record for resource [%d].\n", resource); } else if (pResource -> split != resource) { #ifdef PANIC fprintf(stderr, "nxagentFreeSplit: PANIC! The record [%d] doesn't match the resource [%d].\n", pResource -> split, resource); #endif FatalError("nxagentFreeSplit: PANIC! The record [%d] doesn't match the resource [%d].\n", pResource -> split, resource); } pDrawable = pResource -> drawable; if (pDrawable != NULL) { #ifdef TEST fprintf(stderr, "nxagentFreeSplit: Removing association to drawable at [%p].\n", (void *) pDrawable); #endif nxagentReleaseSplit(pDrawable); } #ifdef TEST else { /* * The end of the split has come after we have invalidated the * operation and removed the association to the drawable. This * happens, for example, if the drawable is destroyed. */ fprintf(stderr, "nxagentFreeSplit: WARNING! Releasing invalidated resource [%d].\n", pResource -> split); } #endif #ifdef TEST fprintf(stderr, "nxagentFreeSplit: Freeing the record for resource [%d].\n", pResource -> split); #endif nxagentFreeSplitResource(pResource); } /* FIXME: This must be enabled when the vanilla synchronization procedure is working. */ #define USE_FINISH_SPLIT void nxagentWaitDrawable(DrawablePtr pDrawable) { SplitResourcePtr pResource; pDrawable = nxagentSplitDrawable(pDrawable); pResource = nxagentSplitResource(pDrawable); if (pResource == NULL) { #ifdef TEST fprintf(stderr, "nxagentWaitDrawable: WARNING! The drawable at [%p] is already awake.\n", (void *) pDrawable); #endif return; } #ifdef TEST fprintf(stderr, "nxagentWaitDrawable: Waiting drawable at [%p] with resource [%d].\n", (void *) pDrawable, pResource -> split); #endif /* * Be sure we intercept an I/O error as well as an interrupt. */ #ifdef USE_FINISH_SPLIT NXFinishSplit(nxagentDisplay, pResource -> split); #endif NXFlushDisplay(nxagentDisplay, NXFlushBuffer); for (;;) { /* * Handling all the possible events here preempts the queue and * makes a better use of the link. * * We should better use XIfEvent() instead of looping again and * again through the event queue. */ nxagentDispatchEvents(NULL); /* * Wait indefinitely until the resource is released or the display * is shut down. */ if (nxagentSplitResource(pDrawable) == NULL || NXDisplayError(nxagentDisplay) == 1) { #ifdef TEST if (NXDisplayError(nxagentDisplay) == 1) { fprintf(stderr, "nxagentWaitDrawable: WARNING! Display error detected while " "waiting for the drawable.\n"); } else { fprintf(stderr, "nxagentWaitDrawable: Drawable at [%p] can now be restarted.\n", (void *) pDrawable); } #endif return; } #ifdef TEST fprintf(stderr, "nxagentWaitDrawable: Yielding control to the NX transport.\n"); #endif nxagentWaitEvents(nxagentDisplay, 0); } } static Bool nxagentCommitSplitPredicate(Display *disp, XEvent *event, XPointer ptr) { return (event -> type == ClientMessage && event -> xclient.data.l[0] == NXCommitSplitNotify && event -> xclient.window == 0 && event -> xclient.message_type == 0 && event -> xclient.format == 32); } void nxagentWaitCommitEvent(int resource) { XEvent event; /* * Check if there is any commit pending. As we are at it, handle any * commit, even those commits pertaining to other resources. * * We can receive some commits even if we'll later receive a * no-split event. The proxy, in fact, may have missed to find the * image in the memory cache and could have loaded it from disk (so * requiring a commit) before we marked the end of the split * sequence. */ while (nxagentCheckEvents(nxagentDisplay, &event, nxagentCommitSplitPredicate, NULL) == 1) { int client = event.xclient.data.l[1]; int request = event.xclient.data.l[2]; int position = event.xclient.data.l[3]; #ifdef TEST fprintf(stderr, "nxagentWaitCommitEvent: Commit event received with " "client [%d] request [%d] and position [%d].\n", client, request, position); #endif nxagentHandleCommitSplitEvent(client, request, position); } } static Bool nxagentWaitSplitPredicate(Display *disp, XEvent *event, XPointer ptr) { return (event -> type == ClientMessage && (event -> xclient.data.l[0] == NXNoSplitNotify || event -> xclient.data.l[0] == NXStartSplitNotify) && event -> xclient.window == 0 && event -> xclient.message_type == 0 && event -> xclient.format == 32); } int nxagentWaitSplitEvent(int resource) { XEvent event; int split = 0; /* * Don't flush the link. We only want to query the NX transport to * check whether the operation caused a split. */ NXFlushDisplay(nxagentDisplay, NXFlushBuffer); for (;;) { #ifdef TEST fprintf(stderr, "nxagentWaitSplitEvent: Waiting for the split event for resource [%d].\n", resource); #endif XIfEvent(nxagentDisplay, &event, nxagentWaitSplitPredicate, NULL); if (NXDisplayError(nxagentDisplay) == 1) { #ifdef TEST fprintf(stderr, "nxagentWaitSplitEvent: WARNING! Error detected reading the event.\n"); #endif nxagentHandleNoSplitEvent(resource); break; } #ifdef TEST fprintf(stderr, "nxagentWaitSplitEvent: Going to process the split event.\n"); #endif if (resource != (int) event.xclient.data.l[1]) { #ifdef PANIC fprintf(stderr, "nxagentWaitSplitEvent: PANIC! Got event for resource [%d] while " "waiting for resource [%d].\n", (int) event.xclient.data.l[1], resource); fprintf(stderr, "nxagentWaitSplitEvent: PANIC! Restarting resource [%d] due to the " "missing split event.\n", resource); #endif nxagentHandleNoSplitEvent(resource); break; } else if (event.xclient.data.l[0] == NXNoSplitNotify) { nxagentHandleNoSplitEvent(resource); break; } else { nxagentHandleStartSplitEvent(resource); split = 1; break; } } return split; } void nxagentHandleNoSplitEvent(int resource) { if (resource >= 0 && resource < NXNumberOfResources) { #ifdef TEST SplitResourcePtr pResource = &nxagentSplitResources[resource]; fprintf(stderr, "nxagentHandleNoSplitEvent: Received event for resource [%d].\n", resource); nxagentCheckResource(pResource, resource); #endif #ifdef TEST fprintf(stderr, "nxagentHandleNoSplitEvent: Checking if there is any commit pending.\n"); #endif nxagentWaitCommitEvent(resource); #ifdef TEST fprintf(stderr, "nxagentHandleNoSplitEvent: No streaming was required with resource [%d] " "and drawable at [%p].\n", resource, (void *) pResource -> drawable); #endif /* * Release the resource. */ nxagentFreeSplit(resource); } #ifdef PANIC else { fprintf(stderr, "nxagentHandleNoSplitEvent: PANIC! Invalid resource identifier [%d] " " received in event.\n", resource); } #endif } void nxagentHandleStartSplitEvent(int resource) { if (resource >= 0 && resource < NXNumberOfResources) { #ifdef TEST SplitResourcePtr pResource = &nxagentSplitResources[resource]; fprintf(stderr, "nxagentHandleStartSplitEvent: Received event for resource [%d].\n", resource); nxagentCheckResource(pResource, resource); #endif #ifdef TEST fprintf(stderr, "nxagentHandleStartSplitEvent: Checking if there is any commit pending.\n"); #endif nxagentWaitCommitEvent(resource); #ifdef TEST fprintf(stderr, "nxagentHandleStartSplitEvent: Streaming started with resource [%d] " "and drawable at [%p].\n", resource, (void *) pResource -> drawable); #endif } #ifdef PANIC else { fprintf(stderr, "nxagentHandleStartSplitEvent: PANIC! Invalid resource identifier [%d] " " received in event.\n", resource); } #endif } void nxagentHandleCommitSplitEvent(int resource, int request, int position) { if (resource >= 0 && resource < NXNumberOfResources && request >= 0 && position >= 0) { SplitResourcePtr pResource = &nxagentSplitResources[resource]; #ifdef TEST fprintf(stderr, "nxagentHandleCommitSplitEvent: Received event for resource [%d].\n", resource); #endif if (pResource != NULL && pResource -> commit == 1) { #ifdef TEST nxagentCheckResource(pResource, resource); fprintf(stderr, "nxagentHandleCommitSplitEvent: Committing request [%d] with " "position [%d] for resource [%d].\n", request, position, resource); #endif NXCommitSplit(nxagentDisplay, resource, 1, request, position); } else { #ifdef TEST fprintf(stderr, "nxagentHandleCommitSplitEvent: Discarding request [%d] for " "resource [%d] with position [%d].\n", request, resource, position); #endif NXCommitSplit(nxagentDisplay, resource, 0, request, position); } } #ifdef PANIC else { fprintf(stderr, "nxagentHandleCommitSplitEvent: PANIC! Invalid commit event with " "request [%d] and position [%d] for resource [%d].\n", request, position, resource); } #endif } void nxagentHandleEndSplitEvent(int resource) { if (resource >= 0 && resource < NXNumberOfResources) { SplitResourcePtr pResource = &nxagentSplitResources[resource]; #ifdef TEST fprintf(stderr, "nxagentHandleEndSplitEvent: Received event for resource [%d].\n", resource); nxagentCheckResource(pResource, resource); #endif #ifdef TEST fprintf(stderr, "nxagentHandleEndSplitEvent: Checking if there is any commit pending.\n"); #endif nxagentWaitCommitEvent(resource); if (pResource != NULL && pResource -> commit == 1) { #ifdef TEST fprintf(stderr, "nxagentHandleEndSplitEvent: Checking the split region at [%p] " "for drawable at [%p].\n", (void *) pResource -> drawable, (void *) pResource -> region); if (pResource -> region == NULL) { #ifdef PANIC fprintf(stderr, "nxagentHandleEndSplitEvent: PANIC! Invalid region [%p] for drawable at [%p].\n", (void *) pResource -> region, (void *) pResource -> drawable); #endif FatalError("nxagentHandleEndSplitEvent: PANIC! Invalid region [%p] for drawable at [%p].\n", (void *) pResource -> region, (void *) pResource -> drawable); } else if (pResource -> gc == NULL) { #ifdef PANIC fprintf(stderr, "nxagentHandleEndSplitEvent: PANIC! Invalid GC [%p] for drawable at [%p].\n", (void *) pResource -> gc, (void *) pResource -> drawable); #endif FatalError("nxagentHandleEndSplitEvent: PANIC! Invalid GC [%p] for drawable at [%p].\n", (void *) pResource -> gc, (void *) pResource -> drawable); } #endif if (pResource -> drawable != NULL && pResource -> region != NullRegion) { if (RegionNil(pResource -> region) == 0) { RegionSubtract( nxagentCorruptedRegion(pResource -> drawable), nxagentCorruptedRegion(pResource -> drawable), pResource -> region); /* FIXME: Implementing the valid region policy nxagentExpandValidRegion(pResource -> drawable, pResource -> region); */ #ifdef TEST fprintf(stderr, "nxagentHandleEndSplitEvent: Synchronized region [%d,%d,%d,%d] " "for drawable at [%p].\n", pResource -> region -> extents.x1, pResource -> region -> extents.y1, pResource -> region -> extents.x2, pResource -> region -> extents.y2, (void *) pResource -> drawable); #endif } else { #ifdef PANIC fprintf(stderr, "nxagentHandleEndSplitEvent: PANIC! The region [%d,%d,%d,%d] for drawable " "at [%p] is empty.\n", pResource -> region -> extents.x1, pResource -> region -> extents.y1, pResource -> region -> extents.x2, pResource -> region -> extents.y2, (void *) pResource -> drawable); #endif FatalError("nxagentHandleEndSplitEvent: PANIC! The region [%d,%d,%d,%d] for drawable " "at [%p] is empty.\n", pResource -> region -> extents.x1, pResource -> region -> extents.y1, pResource -> region -> extents.x2, pResource -> region -> extents.y2, (void *) pResource -> drawable); } } else { #ifdef PANIC fprintf(stderr, "nxagentHandleEndSplitEvent: PANIC! Invalid record for resource [%d] with " "pending [%d] split [%d] unpack [%d] drawable [%p] region [%p] commit [%d] gc [%p].\n", resource, pResource -> pending, pResource -> split, pResource -> unpack, (void *) pResource -> drawable, (void *) pResource -> region, pResource -> commit, (void *) pResource -> gc); #endif FatalError("nxagentHandleEndSplitEvent: PANIC! Invalid record for resource [%d] with " "pending [%d] split [%d] unpack [%d] drawable [%p] region [%p] commit [%d] gc [%p].\n", resource, pResource -> pending, pResource -> split, pResource -> unpack, (void *) pResource -> drawable, (void *) pResource -> region, pResource -> commit, (void *) pResource -> gc); } } /* * Release the resource. */ nxagentFreeSplit(resource); } #ifdef TEST else { fprintf(stderr, "nxagentHandleEndSplitEvent: WARNING! Ignoring split event " "for resource [%d].\n", resource); } #endif } void nxagentHandleEmptySplitEvent(void) { /* FIXME: Should run a consistency check here. */ #ifdef TEST fprintf(stderr, "nxagentHandleEmptySplitEvent: No more split event to handle.\n"); #endif } /* * The drawable is going to become corrupted. */ void nxagentSetCorruptedTimestamp(DrawablePtr pDrawable) { if (nxagentDrawableStatus(pDrawable) == Synchronized) { if (pDrawable -> type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "nxagentSetCorruptedTimestamp: Corruption timestamp for pixmap at [%p] was [%lu].\n", (void *) pDrawable, nxagentPixmapPriv((PixmapPtr) pDrawable) -> corruptedTimestamp); #endif nxagentPixmapPriv((PixmapPtr) pDrawable) -> corruptedTimestamp = GetTimeInMillis(); #ifdef TEST fprintf(stderr, "nxagentSetCorruptedTimestamp: New corruption timestamp for pixmap at [%p] is [%lu].\n", (void *) pDrawable, nxagentPixmapPriv((PixmapPtr) pDrawable) -> corruptedTimestamp); #endif } else { #ifdef TEST fprintf(stderr, "nxagentSetCorruptedTimestamp: Corruption timestamp for window at [%p] was [%lu].\n", (void *) pDrawable, nxagentWindowPriv((WindowPtr) pDrawable) -> corruptedTimestamp); #endif nxagentWindowPriv((WindowPtr) pDrawable) -> corruptedTimestamp = GetTimeInMillis(); #ifdef TEST fprintf(stderr, "nxagentSetCorruptedTimestamp: New corruption timestamp for window at [%p] is [%lu].\n", (void *) pDrawable, nxagentWindowPriv((WindowPtr) pDrawable) -> corruptedTimestamp); #endif } } } /* * Reset the timestamp taken when the drawable became initially * corrupted. The timestamp is reset only after the drawable has been * fully synchronized. */ void nxagentResetCorruptedTimestamp(DrawablePtr pDrawable) { if (nxagentDrawableStatus(pDrawable) == Synchronized) { if (pDrawable -> type == DRAWABLE_PIXMAP) { #ifdef TEST fprintf(stderr, "nxagentResetCorruptedTimestamp: Corruption timestamp for pixmap at [%p] was [%lu].\n", (void *) pDrawable, nxagentPixmapPriv((PixmapPtr) pDrawable) -> corruptedTimestamp); #endif nxagentPixmapPriv((PixmapPtr) pDrawable) -> corruptedTimestamp = 0; } else { #ifdef TEST fprintf(stderr, "nxagentResetCorruptedTimestamp: Corruption timestamp for window at [%p] was [%lu].\n", (void *) pDrawable, nxagentWindowPriv((WindowPtr) pDrawable) -> corruptedTimestamp); #endif nxagentWindowPriv((WindowPtr) pDrawable) -> corruptedTimestamp = 0; } } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Split.h0000644000000000000000000000725213614532331020127 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Split_H__ #define __Split_H__ typedef struct _SplitResourceRec { int pending; int split; int unpack; DrawablePtr drawable; RegionPtr region; GCPtr gc; int commit; } SplitResourceRec; typedef SplitResourceRec *SplitResourcePtr; extern SplitResourceRec nxagentSplitResources[]; typedef struct _UnpackResourceRec { int pending; int unpack; DrawablePtr drawable; } UnpackResourceRec; typedef UnpackResourceRec *UnpackResourcePtr; extern UnpackResourceRec nxagentUnpackResources[]; void nxagentInitSplitResources(); void nxagentInitUnpackResources(); SplitResourcePtr nxagentAllocSplitResource(); void nxagentFreeSplitResource(SplitResourcePtr pResource); UnpackResourcePtr nxagentAllocUnpackResource(); void nxagentFreeUnpackResource(UnpackResourcePtr pResource); #define nxagentSplitResource(pDrawable) \ ((pDrawable) -> type == DRAWABLE_PIXMAP ? \ (nxagentPixmapPriv(nxagentRealPixmap((PixmapPtr) pDrawable)) -> splitResource) : \ (nxagentWindowPriv((WindowPtr) pDrawable) -> splitResource)) /* FIXME: Make it a real function to log a warning in the logs. #define nxagentSplitDrawable(pDrawable) \ (((pDrawable) -> type == DRAWABLE_PIXMAP && \ nxagentPixmapIsVirtual((PixmapPtr) pDrawable)) ? \ (DrawablePtr) nxagentRealPixmap((PixmapPtr) pDrawable) : pDrawable) */ DrawablePtr nxagentSplitDrawable(DrawablePtr pDrawable); int nxagentCreateSplit(DrawablePtr pDrawable, GCPtr *pGC); void nxagentRegionSplit(DrawablePtr pDrawable, RegionPtr pRegion); void nxagentValidateSplit(DrawablePtr pDrawable, RegionPtr pRegion); void nxagentReleaseSplit(DrawablePtr pDrawable); void nxagentReleaseAllSplits(void); void nxagentSetCorruptedTimestamp(DrawablePtr pDrawable); void nxagentResetCorruptedTimestamp(DrawablePtr pDrawable); #endif /* __Split_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Trap.c0000644000000000000000000000670413614532331017736 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include "Trap.h" /* * Set if we are dispatching a render * extension request. Used to avoid * reentrancy in GC operations. */ int nxagentGCTrap = 0; /* * Set if we are enqueing an internal * operation, CreateWindow and Reparent- * Window. Used to remove any screen operation. */ int nxagentScreenTrap = 0; /* * Set if we are executing a GC operation * only on the X side. Used to avoid * reentrancy in FB layer. */ int nxagentFBTrap = 0; /* * Set if we are dispatching a shared * memory extension request. */ int nxagentShmTrap = 0; /* * Set if a shared pixmap operation is * requested by the client. */ int nxagentShmPixmapTrap = 0; /* * Set if we are dispatching a XVideo * extension request. */ int nxagentXvTrap = 0; /* * Set if we are dispatching a GLX * extension request. */ int nxagentGlxTrap = 0; /* * Set while we are resuming the session. */ int nxagentReconnectTrap = 0; /* * Set if we need to realize a drawable * by using a lossless encoding. */ int nxagentLosslessTrap = 0; /* * Set to force the synchronization of * a drawable. */ int nxagentSplitTrap = 0; /* * Set to avoid CapsLock synchronization * problems when CapsLock is the first * key to be pressed in the session. */ int nxagentXkbCapsTrap = 0; /* * Set to avoid NumLock synchronization * problems when NumLock is the first * key to be pressed in the session. */ int nxagentXkbNumTrap = 0; /* * Set to indicate we are processing a clipboard event triggered by * the real X server. This is used to avoid endless loops if callbacks * would trigger another event by the real X server */ int nxagentExternalClipboardEventTrap = 0; nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Trap.h0000644000000000000000000000675313614532331017747 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Traps_H__ #define __Traps_H__ /* * Set if we are dispatching a render extension request. Used to avoid * reentrancy in GC operations. */ extern int nxagentGCTrap; /* * Set if we are enqueing an internal operation, CreateWindow and * Reparent- Window. Used to remove any screen operation. */ extern int nxagentScreenTrap; /* * Set if we are executing a GC operation only on the X side. Used to * avoid reentrancy in FB layer. */ extern int nxagentFBTrap; /* * Set if we are dispatching a shared memory extension request. */ extern int nxagentShmTrap; /* * Set if a shared pixmap operation is requested by the client. */ extern int nxagentShmPixmapTrap; /* * Set if we are dispatching a XVideo extension request. */ extern int nxagentXvTrap; /* * Set if we are dispatching a GLX extension request. */ extern int nxagentGlxTrap; /* * Set while we are resuming the session. */ extern int nxagentReconnectTrap; /* * Set if we need to realize a drawable by using a lossless encoding. */ extern int nxagentLosslessTrap; /* * Set to force the synchronization of a drawable. */ extern int nxagentSplitTrap; /* * Set to avoid CapsLock synchronization problems when CapsLock is the * first key to be pressed in the session. */ extern int nxagentXkbCapsTrap; /* * Set to avoid NumLock synchronization problems when NumLock is the * first key to be pressed in the session. */ extern int nxagentXkbNumTrap; /* * Set to indicate we are processing a clipboard event triggered by * the real X server. This is used to avoid endless loops if callbacks * would trigger another event by the real X server */ extern int nxagentExternalClipboardEventTrap; #endif /* __Trap_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Utils.h0000644000000000000000000000532113614532331020127 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Utils_H__ #define __Utils_H__ /* * Number of bits in fixed point operations. */ #define PRECISION 16 /* * "1" ratio means "don't scale". */ #define DONT_SCALE (1 << PRECISION) #define nxagentScale(i, ratio) (((i) * (ratio)) >> (PRECISION)) static inline const char * validateString(const char *str) { return str ? str : "(null)"; } /* * nxagentChecksum used to be in Holder.c but was broken beyond * repair. As Holder.c was removed we put it here as a stub until we * need it for debugging. */ static inline const char *nxagentChecksum(char *data, int size) { return "not_implemented"; } #define SAFE_XFree(what) do {if (what) {XFree(what); what = NULL;}} while (0) #define SAFE_free(what) do {free(what); what = NULL;} while (0) /* some helper macros to produce a quoted string from other macros */ #define QUOTEEXP(str) #str #define QUOTE(str) QUOTEEXP(str) #endif /* __Utils_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Visual.c0000644000000000000000000001136713614532331020274 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #include "scrnintstr.h" #include "dix.h" #include "mi.h" #include "mibstore.h" #include "resource.h" #include "X.h" #include "Xproto.h" #include "Agent.h" #include "Display.h" #include "Visual.h" #define PANIC #define WARNING #undef TEST #undef DEBUG /* * Predefined visual used for drawables * having a 32 bits depth. */ Visual nxagentAlphaVisual; Visual *nxagentVisual(VisualPtr pVisual) { XVisualInfo visual = { .class = pVisual->class, .bits_per_rgb = pVisual->bitsPerRGBValue, .colormap_size = pVisual->ColormapEntries, .depth = pVisual->nplanes, .red_mask = pVisual->redMask, .green_mask = pVisual->greenMask, .blue_mask = pVisual->blueMask }; for (int i = 0; i < nxagentNumVisuals; i++) { if (nxagentCompareVisuals(visual, nxagentVisuals[i]) == 1) { return nxagentVisuals[i].visual; } } return NULL; } Visual *nxagentVisualFromID(ScreenPtr pScreen, VisualID visual) { for (int i = 0; i < pScreen->numVisuals; i++) { if (pScreen->visuals[i].vid == visual) { return nxagentVisual(&pScreen->visuals[i]); } } return NULL; } Colormap nxagentDefaultVisualColormap(Visual *visual) { for (int i = 0; i < nxagentNumVisuals; i++) { if (nxagentVisuals[i].visual == visual) { return nxagentDefaultColormaps[i]; } } return None; } #if 0 /* * This is currently unused. It should serve the scope of matching a * visual whenever a drawable has a different depth than the real * display. */ Visual *nxagentVisualFromDepth(ScreenPtr pScreen, int depth) { for (int i = 0; i < pScreen->numVisuals; i++) { if (pScreen->visuals[i].nplanes == depth) { return nxagentVisual(&pScreen->visuals[i]); } } return NULL; } #endif /* * Create a fake 32 bits depth visual and initialize it based on the * endianness of the remote display. */ void nxagentInitAlphaVisual(void) { nxagentAlphaVisual.visualid = XAllocID(nxagentDisplay); /* * Color masks are referred to bits inside the pixel. This is * independent from the endianness. */ nxagentAlphaVisual.red_mask = 0x00ff0000; nxagentAlphaVisual.green_mask = 0x0000ff00; nxagentAlphaVisual.blue_mask = 0x000000ff; #ifdef TEST fprintf(stderr,"nxagentInitAlphaVisual: Set alpha visual with id [0x%lx] mask [0x%lx,0x%lx,0x%lx].\n", nxagentAlphaVisual.visualid, nxagentAlphaVisual.red_mask, nxagentAlphaVisual.green_mask, nxagentAlphaVisual.blue_mask); #endif } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Visual.h0000644000000000000000000000707013614532331020275 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1993 by Davor Matic Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Davor Matic makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. */ #ifndef __Visual_H__ #define __Visual_H__ Visual *nxagentVisual(VisualPtr pVisual); Visual *nxagentVisualFromID(ScreenPtr pScreen, VisualID visual); #if 0 Visual *nxagentVisualFromDepth(ScreenPtr pScreen, int depth); #endif Colormap nxagentDefaultVisualColormap(Visual *visual); #define nxagentDefaultVisual(pScreen) \ nxagentVisualFromID((pScreen), (pScreen) -> rootVisual) /* * Visual generated by Xorg and Xfree86 at 16-bit depth differs on the * bits_per_rgb value, so we avoid checking it. */ /* * Some Solaris X servers uses the color masks inverted, so that the * red and the blue mask are switched. To reconnect the session on * this displays, we do a double check, as workaround. */ #define nxagentCompareVisuals(v1, v2) \ ((v1).depth == (v2).depth && \ /*(v1).bits_per_rgb == (v2).bits_per_rgb &&*/ \ (v1).class == (v2).class && \ ((v1).red_mask == (v2).red_mask || \ (v1).red_mask == (v2).blue_mask) && \ (v1).green_mask == (v2).green_mask && \ ((v1).blue_mask == (v2).blue_mask || \ (v1).blue_mask == (v2).red_mask) && \ (v1).colormap_size == (v2).colormap_size) Visual nxagentAlphaVisual; void nxagentInitAlphaVisual(); #endif /* __Visual_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Window.c0000644000000000000000000032220513614532331020274 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #include "X.h" #include "Xproto.h" #include "gcstruct.h" #include "../../include/window.h" #include "windowstr.h" #include "pixmapstr.h" #include "colormapst.h" #include "scrnintstr.h" #include "region.h" #include "dixstruct.h" #include "selection.h" #include "mi.h" #include "fb.h" #include "mibstorest.h" #include "Agent.h" #include "Display.h" #include "Screen.h" #include "GCs.h" #include "GCOps.h" #include "Drawable.h" #include "Colormap.h" #include "Cursor.h" #include "Visual.h" #include "Events.h" #include "Clipboard.h" #include "Args.h" #include "Trap.h" #include "Rootless.h" #include "Atoms.h" #include "Client.h" #include "Reconnect.h" #include "Dialog.h" #include "Splash.h" #include "Init.h" #include "Composite.h" #include "Events.h" #include "Utils.h" #include #include "compext/Compext.h" #include "Xatom.h" /* * Used to register the window's privates. */ int nxagentWindowPrivateIndex; /* * Number of windows which need synchronization. */ int nxagentCorruptedWindows; /* * Used to track nxagent window's visibility. */ int nxagentVisibility = VisibilityUnobscured; unsigned long nxagentVisibilityTimeout = 0; Bool nxagentVisibilityStop = False; /* * Set here the required log level. */ #define PANIC #define WARNING #undef TEST #undef DEBUG /* * Useful to test the window configuration * failures. */ #ifdef TEST #define MAKE_SYNC_CONFIGURE_WINDOW XSync(nxagentDisplay, 0) #else #define MAKE_SYNC_CONFIGURE_WINDOW #endif extern WindowPtr nxagentViewportFrameLeft; extern WindowPtr nxagentViewportFrameRight; extern WindowPtr nxagentViewportFrameAbove; extern WindowPtr nxagentViewportFrameBelow; extern WindowPtr nxagentRootTileWindow; extern Bool nxagentReportPrivateWindowIds; #define RECTLIMIT 25 #define BSPIXMAPLIMIT 128 Bool nxagentExposeArrayIsInitialized = False; Window nxagentConfiguredSynchroWindow; static int nxagentExposeSerial = 0; StoringPixmapPtr nxagentBSPixmapList[BSPIXMAPLIMIT]; /* * Used to walk through the window hierarchy * to find a window */ typedef struct _WindowMatch { WindowPtr pWin; Window id; } WindowMatchRec; Bool nxagentReconnectAllWindows(void *); Bool nxagentDisconnectAllWindows(void); Bool nxagentIsIconic(WindowPtr); /* * From NXproperty.c. */ int GetWindowProperty(WindowPtr, Atom, long, long, Bool, Atom, Atom*, int*, unsigned long*, unsigned long*, unsigned char**); /* * Other local functions. */ static Bool nxagentSomeWindowsAreMapped(void); static void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what); static void nxagentTraverseWindow(WindowPtr, void(*)(void *, XID, void *), void *); static void nxagentDisconnectWindow(void *, XID, void *); static Bool nxagentLoopOverWindows(void(*)(void *, XID, void *)); static void nxagentReconfigureWindowCursor(void *, XID, void *); static void nxagentReconnectWindow(void *, XID, void *); static void nxagentReconfigureWindow(void *, XID, void *); static int nxagentForceExposure(WindowPtr pWin, void * ptr); /* by dimbor */ typedef struct { CARD32 state; Window icon; } nxagentWMStateRec; /* * This is currently unused. */ #ifdef TEST static Bool nxagentCheckWindowIntegrity(WindowPtr pWin); #endif WindowPtr nxagentGetWindowFromID(Window id) { WindowPtr pWin = screenInfo.screens[0]->root; while (pWin && nxagentWindowPriv(pWin)) { if (nxagentWindow(pWin) == id) { return pWin; } if (pWin -> nextSib) { pWin = pWin -> nextSib; } else { pWin = pWin -> firstChild; } } return NULL; } static int nxagentFindWindowMatch(WindowPtr pWin, void * ptr) { WindowMatchRec *match = (WindowMatchRec *) ptr; if (match -> id == nxagentWindow(pWin)) { match -> pWin = pWin; return WT_STOPWALKING; } else { return WT_WALKCHILDREN; } } WindowPtr nxagentWindowPtr(Window window) { WindowMatchRec match = {.pWin = NullWindow, .id = window}; for (int i = 0; i < nxagentNumScreens; i++) { WalkTree(screenInfo.screens[i], nxagentFindWindowMatch, (void *) &match); if (match.pWin) { break; } } return match.pWin; } /* * from "Definition of the Porting Layer for X v11 Sample Server": * * This routine is a hook for when DIX creates a window. It should * fill in the "Window Procedures in the WindowRec" below and also * allocate the devPrivate block for it. * * See Xserver/fb/fbwindow.c for the sample server implementation. */ Bool nxagentCreateWindow(WindowPtr pWin) { unsigned long mask; XSetWindowAttributes attributes; Visual *visual; ColormapPtr pCmap; if (nxagentScreenTrap) { return True; } if (pWin->drawable.class == InputOnly) { mask = CWEventMask; visual = CopyFromParent; } else { mask = CWEventMask | CWBackingStore; if (pWin->optional) { mask |= CWBackingPlanes | CWBackingPixel; attributes.backing_planes = pWin->optional->backingBitPlanes; attributes.backing_pixel = pWin->optional->backingPixel; } attributes.backing_store = NotUseful; #ifdef TEST fprintf(stderr, "nxagentCreateWindow: Backing store on window at [%p] is [%d].\n", (void*)pWin, attributes.backing_store); #endif /* FIXME: We need to set save under on the real display? */ if (nxagentSaveUnder) { mask |= CWSaveUnder; attributes.save_under = False; } if (pWin->parent) { if (pWin->optional && pWin->optional->visual != wVisual(pWin->parent)) { visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); mask |= CWColormap; if (pWin->optional->colormap) { pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP); attributes.colormap = nxagentColormap(pCmap); } else { attributes.colormap = nxagentDefaultVisualColormap(visual); } } else if (pWin->optional) { visual = CopyFromParent; } else { visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); mask |= CWColormap; attributes.colormap = nxagentDefaultVisualColormap(visual); } } else { /* root windows have their own colormaps at creation time */ visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP); mask |= CWColormap; attributes.colormap = nxagentColormap(pCmap); } } if (mask & CWEventMask) { attributes.event_mask = nxagentGetEventMask(pWin); } #ifdef WARNING else { attributes.event_mask = NoEventMask; } #endif /* * Select the event mask if window is a top level * window. This at least makes the keyboard barely * work. */ #ifdef TEST fprintf(stderr, "nxagentCreateWindow: Going to create new window.\n"); #endif #ifdef TEST fprintf(stderr, "nxagentCreateWindow: Creating %swindow at %p current event mask = %lX mask & CWEventMask = %ld " "event_mask = %lX\n", nxagentWindowTopLevel(pWin) ? "toplevel " : "", (void*)pWin, pWin -> eventMask, mask & CWEventMask, attributes.event_mask); fprintf(stderr, "nxagentCreateWindow: position [%d,%d] size [%d,%d] depth [%d] border [%d] class [%d].\n", pWin->origin.x - wBorderWidth(pWin), pWin->origin.y - wBorderWidth(pWin), pWin->drawable.width, pWin->drawable.height, pWin->drawable.depth, pWin->borderWidth, pWin->drawable.class); #endif nxagentWindowPriv(pWin)->window = XCreateWindow(nxagentDisplay, nxagentWindowParent(pWin), pWin->origin.x - wBorderWidth(pWin), pWin->origin.y - wBorderWidth(pWin), pWin->drawable.width, pWin->drawable.height, pWin->borderWidth, pWin->drawable.depth, pWin->drawable.class, visual, mask, &attributes); nxagentWindowPriv(pWin) -> isMapped = 0; nxagentWindowPriv(pWin) -> isRedirected = 0; nxagentWindowPriv(pWin) -> visibilityState = VisibilityUnobscured; nxagentWindowPriv(pWin) -> corruptedRegion = RegionCreate(NULL, 1); nxagentWindowPriv(pWin) -> hasTransparentChildren = 0; nxagentWindowPriv(pWin) -> containGlyphs = 0; nxagentWindowPriv(pWin) -> corruptedId = 0; nxagentWindowPriv(pWin) -> deferredBackgroundExpose = 0; nxagentWindowPriv(pWin) -> synchronizationBitmap = NullPixmap; nxagentWindowPriv(pWin) -> corruptedTimestamp = 0; nxagentWindowPriv(pWin) -> splitResource = NULL; if (nxagentOption(Rootless) == 1) { if (pWin != nxagentRootlessWindow) { WindowPtr pParent = pWin -> parent; if (pParent && nxagentWindowPriv(pParent) -> isMapped == 1) { nxagentWindowPriv(pWin) -> isMapped = 1; } else { nxagentWindowPriv(pWin) -> isMapped = 0; } } else { nxagentWindowPriv(pWin) -> isMapped = 0; } } if (nxagentReportPrivateWindowIds) { fprintf(stderr, "NXAGENT_WINDOW_ID: PRIVATE_WINDOW,WID:[0x%x],INT:[0x%x]\n", nxagentWindowPriv(pWin)->window, pWin->drawable.id); } #ifdef TEST fprintf(stderr, "nxagentCreateWindow: Created new window with id [0x%x].\n", nxagentWindowPriv(pWin)->window); #endif /* * Set the WM_DELETE_WINDOW protocols on every * top level window. Also redirect the window * if it is a top level. */ if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin)) { XlibAtom prop = nxagentMakeAtom("WM_PROTOCOLS", strlen("WM_PROTOCOLS"), True); XlibAtom atom = nxagentMakeAtom("WM_DELETE_WINDOW", strlen("WM_DELETE_WINDOW"), True); XSetWMProtocols(nxagentDisplay, nxagentWindowPriv(pWin)->window, &atom, 1); nxagentAddPropertyToList(prop, pWin); /* * Redirect the window to the off-screen * memory, if the composite extension is * supported on the display. */ /* FIXME: Do all the windows for which nxagentWindowTopLevel(pWin) returns true need to be redirected? */ nxagentRedirectWindow(pWin); } if ((nxagentRealWindowProp) && (!nxagentWindowTopLevel(pWin))) { Atom prop = MakeAtom("NX_REAL_WINDOW", strlen("NX_REAL_WINDOW"), True); if (ChangeWindowProperty(pWin, prop, XA_WINDOW, 32, PropModeReplace, 1, nxagentWindowPriv(pWin), 1) != Success) { fprintf(stderr, "nxagentCreateWindow: Adding NX_REAL_WINDOW failed.\n"); } #ifdef DEBUG else { fprintf(stderr, "nxagentCreateWindow: Added NX_REAL_WINDOW for Window ID [%x].\n", nxagentWindowPriv(pWin)->window); } #endif } nxagentWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin); nxagentWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin); nxagentWindowPriv(pWin)->width = pWin->drawable.width; nxagentWindowPriv(pWin)->height = pWin->drawable.height; nxagentWindowPriv(pWin)->borderWidth = pWin->borderWidth; nxagentWindowPriv(pWin)->siblingAbove = None; nxagentWindowPriv(pWin)->pPicture = NULL; if (pWin->nextSib) { nxagentWindowPriv(pWin->nextSib)->siblingAbove = nxagentWindow(pWin); } #ifdef SHAPE #ifdef NXAGENT_SHAPE2 nxagentWindowPriv(pWin)->boundingShape = NULL; nxagentWindowPriv(pWin)->clipShape = NULL; #else nxagentWindowPriv(pWin)->boundingShape = RegionCreate(NULL, 1); nxagentWindowPriv(pWin)->clipShape = RegionCreate(NULL, 1); #endif #endif /* SHAPE */ fbCreateWindow(pWin); /* * Only the root window will have * the right colormap. */ if (!pWin->parent) { nxagentSetInstalledColormapWindows(pWin->drawable.pScreen); } return True; } /* set the NX_AGENT_VERSION property for the given window (normally the root window) */ void nxagentSetVersionProperty(WindowPtr pWin) { char *name = "NX_AGENT_VERSION"; Atom prop = MakeAtom(name, strlen(name), True); if (ChangeWindowProperty(pWin, prop, XA_STRING, 8, PropModeReplace, strlen(NX_VERSION_CURRENT_STRING), NX_VERSION_CURRENT_STRING, True) != Success) { fprintf(stderr, "%s: Adding property [%s], value [%s] failed.\n", __func__, name, NX_VERSION_CURRENT_STRING); } #ifdef DEBUG else { fprintf(stderr, "%s: Added property [%s], value [%s] for root window [%x].\n", __func__, name, NX_VERSION_CURRENT_STRING, pWin); } #endif } Bool nxagentSomeWindowsAreMapped(void) { WindowPtr pWin = screenInfo.screens[0]->root -> firstChild; while (pWin) { if ((pWin -> mapped || nxagentIsIconic(pWin)) && pWin -> drawable.class == InputOutput) { return True; } pWin = pWin -> nextSib; } return False; } /* * from "Definition of the Porting Layer for X v11 Sample Server": * * This routine is a hook for when DIX destroys a window. It should * deallocate the devPrivate block for it and any other blocks that * need to be freed, besides doing other cleanup actions. * * See Xserver/fb/fbwindow.c for the sample server implementation. */ Bool nxagentDestroyWindow(WindowPtr pWin) { nxagentPrivWindowPtr pWindowPriv; if (nxagentScreenTrap == 1) { return 1; } nxagentClearClipboard(NULL, pWin); for (int j = 0; j < nxagentExposeQueue.length; j++) { int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE; if (nxagentExposeQueue.exposures[i].pWindow == pWin) { if (nxagentExposeQueue.exposures[i].localRegion != NullRegion) { RegionDestroy(nxagentExposeQueue.exposures[i].localRegion); } nxagentExposeQueue.exposures[i].localRegion = NullRegion; if (nxagentExposeQueue.exposures[i].remoteRegion != NullRegion) { RegionDestroy(nxagentExposeQueue.exposures[i].remoteRegion); } nxagentExposeQueue.exposures[i].remoteRegion = NullRegion; } } nxagentDeleteConfiguredWindow(pWin); pWindowPriv = nxagentWindowPriv(pWin); if (pWin->nextSib) { nxagentWindowPriv(pWin->nextSib)->siblingAbove = pWindowPriv->siblingAbove; } #ifdef NXAGENT_SHAPE2 #ifdef SHAPE if (pWindowPriv->boundingShape) { RegionDestroy(pWindowPriv->boundingShape); } if (pWindowPriv->clipShape) { RegionDestroy(pWindowPriv->clipShape); } #endif #else RegionDestroy(pWindowPriv->boundingShape); RegionDestroy(pWindowPriv->clipShape); #endif if (pWindowPriv -> corruptedRegion) { RegionDestroy(pWindowPriv -> corruptedRegion); pWindowPriv -> corruptedRegion = NULL; } if (nxagentSynchronization.pDrawable == (DrawablePtr) pWin) { nxagentSynchronization.pDrawable = NULL; #ifdef TEST fprintf(stderr, "nxagentDestroyWindow: Synchronization drawable [%p] removed from resources.\n", (void *) pWin); #endif } nxagentDestroyCorruptedResource((DrawablePtr) pWin, RT_NX_CORR_WINDOW); nxagentDestroyDrawableBitmap((DrawablePtr) pWin); if (pWindowPriv -> splitResource != NULL) { nxagentReleaseSplit((DrawablePtr) pWin); } XDestroyWindow(nxagentDisplay, nxagentWindow(pWin)); if (nxagentOption(Rootless)) { nxagentRootlessDelTopLevelWindow(pWin); } pWindowPriv->window = None; if (pWin -> optional) { pWin -> optional -> userProps = NULL; } if (nxagentOption(Rootless) && nxagentRootlessDialogPid == 0 && nxagentLastWindowDestroyed == False && nxagentSomeWindowsAreMapped() == False) { #ifdef TEST fprintf(stderr, "nxagentDestroyWindow: Last mapped window as been destroyed.\n"); #endif nxagentLastWindowDestroyed = True; nxagentLastWindowDestroyedTime = GetTimeInMillis(); } return True; } /* * from "Definition of the Porting Layer for X v11 Sample Server": * * This routine is a hook for when DIX moves or resizes a window. It * should do whatever private operations need to be done when a window * is moved or resized. For instance, if DDX keeps a pixmap tile used * for drawing the background or border, and it keeps the tile rotated * such that it is longword aligned to longword locations in the frame * buffer, then you should rotate your tiles here. The actual graphics * involved in moving the pixels on the screen and drawing the border * are handled by CopyWindow(), below. * * See Xserver/fb/fbwindow.c for the sample server implementation. */ Bool nxagentPositionWindow(WindowPtr pWin, int x, int y) { if (nxagentScreenTrap == 1) { return True; } #ifdef TEST fprintf(stderr, "nxagentPositionWindow: Changing position of window [%p][%ld] to [%d,%d].\n", (void *) pWin, nxagentWindow(pWin), x, y); #endif nxagentAddConfiguredWindow(pWin, CWSibling | CWX | CWY | CWWidth | CWHeight | CWBorderWidth); return True; } void nxagentRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib) { if (nxagentScreenTrap == 1) { return; } nxagentAddConfiguredWindow(pWin, CW_RootlessRestack); } void nxagentSwitchFullscreen(ScreenPtr pScreen, Bool switchOn) { if (nxagentOption(Rootless) == 1) { return; } if (!switchOn) { nxagentWMDetect(); /* * The smart scheduler could be stopped while * waiting for the reply. In this case we need * to yield explicitly to avoid to be stuck in * the dispatch loop forever. */ isItTimeToYield = 1; if (!nxagentWMIsRunning) { #ifdef WARNING fprintf(stderr, "Warning: Can't switch to window mode, no window manager " "has been detected.\n"); #endif return; } } #ifdef TEST fprintf(stderr, "nxagentSwitchFullscreen: Switching to %s mode.\n", switchOn ? "fullscreen" : "windowed"); #endif nxagentChangeOption(Fullscreen, switchOn); XEvent e = { .xclient.type = ClientMessage, .xclient.message_type = nxagentAtoms[13], /* _NET_WM_STATE */ .xclient.display = nxagentDisplay, .xclient.window = nxagentDefaultWindows[pScreen -> myNum], .xclient.format = 32, .xclient.data.l[0] = nxagentOption(Fullscreen) ? 1 : 0, .xclient.data.l[1] = nxagentAtoms[14] /* _NET_WM_STATE_FULLSCREEN */ }; XSendEvent(nxagentDisplay, DefaultRootWindow(nxagentDisplay), False, SubstructureRedirectMask, &e); if (switchOn) { nxagentFullscreenWindow = nxagentDefaultWindows[pScreen -> myNum]; nxagentGrabPointerAndKeyboard(NULL); } else { nxagentFullscreenWindow = None; /* if we had AutoGrab before entering fullscreen reactivate it now */ if (nxagentOption(AutoGrab)) nxagentGrabPointerAndKeyboard(NULL); else nxagentUngrabPointerAndKeyboard(NULL); } } void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) { Window w; XSetWindowAttributes attributes; unsigned long valuemask; if (nxagentOption(Rootless)) { return; } if (!switchOn) { nxagentWMDetect(); if (!nxagentWMIsRunning) { #ifdef WARNING fprintf(stderr, "Warning: Can't switch to window mode, no window manager has been detected.\n"); #endif return; } } w = nxagentDefaultWindows[pScreen -> myNum]; /* * override_redirect makes the window manager ignore the window and * not add decorations, see ICCCM) */ attributes.override_redirect = switchOn; valuemask = CWOverrideRedirect; XUnmapWindow(nxagentDisplay, w); XChangeWindowAttributes(nxagentDisplay, w, valuemask, &attributes); XReparentWindow(nxagentDisplay, w, DefaultRootWindow(nxagentDisplay), 0, 0); if (switchOn) { /* * Change to fullscreen mode. */ int i; XEvent e; /* * Wait for window manager reparenting the default window. */ for (i = 0; i < 100 && nxagentWMIsRunning; i++) { #ifdef TEST fprintf(stderr, "nxagentSwitchAllScreens: WARNING! Going to wait for the ReparentNotify event.\n"); #endif if (XCheckTypedWindowEvent(nxagentDisplay, w, ReparentNotify, &e)) { break; } /* * This should also flush the NX link for us. */ XSync(nxagentDisplay, 0); nxagentWaitEvents(nxagentDisplay, 50); } if (i < 100) { /* * The window manager has done with the reparent * operation. We can resize and map the window. */ nxagentChangeOption(Fullscreen, True); nxagentChangeOption(AllScreens, True); /* * Save the window-mode configuration. */ nxagentChangeOption(SavedX, nxagentOption(X)); nxagentChangeOption(SavedY, nxagentOption(Y)); nxagentChangeOption(SavedWidth, nxagentOption(Width)); nxagentChangeOption(SavedHeight, nxagentOption(Height)); nxagentChangeOption(SavedRootWidth, nxagentOption(RootWidth)); nxagentChangeOption(SavedRootHeight, nxagentOption(RootHeight)); /* * Reconf the Default window. */ nxagentChangeOption(X, 0); nxagentChangeOption(Y, 0); nxagentChangeOption(Width, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); nxagentChangeOption(Height, HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); /* * Move the root window. */ nxagentChangeOption(RootX, (nxagentOption(Width) - nxagentOption(RootWidth)) / 2); nxagentChangeOption(RootY, (nxagentOption(Height) - nxagentOption(RootHeight)) / 2); nxagentChangeOption(ViewportXSpan, nxagentOption(Width) - nxagentOption(RootWidth)); nxagentChangeOption(ViewportYSpan, nxagentOption(Height) - nxagentOption(RootHeight)); XMoveResizeWindow(nxagentDisplay, w, nxagentOption(X), nxagentOption(Y), nxagentOption(Width), nxagentOption(Height)); nxagentUpdateViewportFrame(0, 0, nxagentOption(RootWidth), nxagentOption(RootHeight)); XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root), nxagentOption(RootX), nxagentOption(RootY)); /* * We disable the screensaver when changing * mode to fullscreen. Is it really needed? */ XSetScreenSaver(nxagentDisplay, 0, 0, DefaultExposures, DefaultBlanking); if (nxagentIconWindow == None) { nxagentIconWindow = nxagentCreateIconWindow(); XMapWindow(nxagentDisplay, nxagentIconWindow); } XMapRaised(nxagentDisplay, w); XSetInputFocus(nxagentDisplay, w, RevertToParent, CurrentTime); XCheckTypedWindowEvent(nxagentDisplay, w, LeaveNotify, &e); nxagentFullscreenWindow = w; if (nxagentOption(DesktopResize) == 1) { if (nxagentOption(Shadow) == 0) { nxagentChangeScreenConfig(0, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)), HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); } else { nxagentShadowAdaptToRatio(); } } } else { /* * We have waited for a reparent event unsuccessfully. * Something happened to the window manager. */ #ifdef WARNING fprintf(stderr, "nxagentSwitchAllScreens: WARNING! Expected ReparentNotify event missing.\n"); #endif nxagentWMIsRunning = False; attributes.override_redirect = False; XChangeWindowAttributes(nxagentDisplay, w, valuemask, &attributes); XMapWindow(nxagentDisplay, w); } } else { /* * FIXME: * It could be necessary: * - To restore screensaver. * - To set or reset nxagentForceBackingStore flag. * - To propagate device settings to the X server if no WM is running. */ /* * Change to windowed mode. */ nxagentChangeOption(Fullscreen, False); nxagentChangeOption(AllScreens, False); XDestroyWindow(nxagentDisplay, nxagentIconWindow); nxagentIconWindow = nxagentFullscreenWindow = None; if (nxagentOption(DesktopResize) == 1) { nxagentChangeOption(RootWidth, nxagentOption(SavedRootWidth)); nxagentChangeOption(RootHeight, nxagentOption(SavedRootHeight)); if (nxagentOption(Shadow) == 0) { nxagentChangeScreenConfig(0, nxagentOption(RootWidth), nxagentOption(RootHeight)); } } /* * FIXME: These are 0 most of the time nowadays. The effect is, * that the window is moving a bit to right/bottom every time * fullscreen mode is left. To fix this query the frame extents * from the window manager via _NET_REQUEST_FRAME_EXTENTS */ if (nxagentOption(WMBorderWidth) > 0) { nxagentChangeOption(X, nxagentOption(SavedX) - nxagentOption(WMBorderWidth)); } else { nxagentChangeOption(X, nxagentOption(SavedX)); } if (nxagentOption(WMTitleHeight) > 0) { nxagentChangeOption(Y, nxagentOption(SavedY) - nxagentOption(WMTitleHeight)); } else { nxagentChangeOption(Y, nxagentOption(SavedY)); } nxagentChangeOption(Width, nxagentOption(SavedWidth)); nxagentChangeOption(Height, nxagentOption(SavedHeight)); if (nxagentOption(Shadow) == 1 && nxagentOption(DesktopResize) == 1) { nxagentShadowAdaptToRatio(); } XMoveResizeWindow(nxagentDisplay, w, nxagentOption(X), nxagentOption(Y), nxagentOption(Width), nxagentOption(Height)); nxagentUpdateViewportFrame(0, 0, nxagentOption(Width), nxagentOption(Height)); XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root), 0, 0); XMapWindow(nxagentDisplay, w); nxagentChangeOption(RootX, 0); nxagentChangeOption(RootY, 0); } XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, nxagentOption(Width), nxagentOption(Height)); /* if we had AutoGrab before entering fullscreen reactivate it now */ if (nxagentOption(AutoGrab)) nxagentGrabPointerAndKeyboard(NULL); nxagentSetPrintGeometry(pScreen -> myNum); } #ifdef VIEWPORT_FRAME void nxagentUpdateViewportFrame(int x, int y, int w, int h) { /* * Four virtual windows make a frame around the viewport. We move the frame * with the viewport together. The areas going into the viewport were covered by * the frame and become exposed. This make the agent send expose events to his * clients. */ XID values[3]; Mask mask; /* * nxagentScreenTrap = True; */ values[2] = Above; values[1] = nxagentOption(RootHeight); mask = CWX | CWHeight | CWStackMode; values[0] = x - NXAGENT_FRAME_WIDTH; ConfigureWindow(nxagentViewportFrameLeft, mask, (XID *) &values, serverClient); values[0] = x + w; ConfigureWindow(nxagentViewportFrameRight, mask, (XID *) &values, serverClient); values[1] = nxagentOption(RootWidth); mask = CWY | CWWidth | CWStackMode; values[0] = y - NXAGENT_FRAME_WIDTH; ConfigureWindow(nxagentViewportFrameAbove, mask, (XID *) &values, serverClient); values[0] = y + h; ConfigureWindow(nxagentViewportFrameBelow, mask, (XID *) &values, serverClient); /* * nxagentScreenTrap = False; */ } #endif /* #ifdef VIEWPORT_FRAME */ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift) { int newX, newY, oldX = 0, oldY = 0; Bool doMove = False; if (nxagentOption(Rootless)) { return; } /* * We must keep x coordinate between viewportXSpan and zero, if viewportXSpan * is less then zero. If viewportXSpan is greater or equal to zero, it means * the agent root window has a size smaller than the agent default window. * In this case we keep the old coordinate. */ #ifdef DEBUG fprintf(stderr, "nxagentMoveViewport: RootX[%i] RootY[%i], hShift[%i] vShift[%i].\n", nxagentOption(RootX), nxagentOption(RootY), hShift, vShift); #endif nxagentChangeOption(ViewportXSpan, nxagentOption(Width) - nxagentOption(RootWidth)); nxagentChangeOption(ViewportYSpan, nxagentOption(Height) - nxagentOption(RootHeight)); if (nxagentOption(ViewportXSpan) < 0) { newX = nxagentOption(RootX) - hShift; if (newX > 0) { newX = 0; } else if (newX < nxagentOption(ViewportXSpan)) { newX = nxagentOption(ViewportXSpan); } } else if (nxagentOption(ViewportXSpan) == 0) { newX = 0; } else { newX = nxagentOption(RootX); } if (nxagentOption(ViewportYSpan) < 0) { newY = nxagentOption(RootY) - vShift; if (newY > 0) { newY = 0; } else if (newY < nxagentOption(ViewportYSpan)) { newY = nxagentOption(ViewportYSpan); } } else if (nxagentOption(ViewportYSpan) == 0) { newY = 0; } else { newY = nxagentOption(RootY); } oldX = nxagentOption(RootX); if (newX != nxagentOption(RootX)) { nxagentChangeOption(RootX, newX); doMove = True; } oldY = nxagentOption(RootY); if (newY != nxagentOption(RootY)) { nxagentChangeOption(RootY, newY); doMove = True; } if (doMove) { #ifdef TEST fprintf(stderr, "nxagentMoveViewport: New viewport geometry: (%d, %d)-" "(%d, %d)\n", -nxagentOption(RootX), -nxagentOption(RootY), -nxagentOption(RootX) + nxagentOption(Width), -nxagentOption(RootY) + nxagentOption(Height)); fprintf(stderr, "nxagentMoveViewport: Root geometry x=[%d] y=[%d]\n", pScreen->root -> drawable.x, pScreen->root -> drawable.y ); #endif XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root), nxagentOption(RootX), nxagentOption(RootY)); if (nxagentOption(ClientOs) == ClientOsWinnt) { /* * If doMove is True we add exposed rectangles * to the remote expose region. This is done to * refresh the areas showed newly in the viewport. * We create two rectangles, one for horizontal * pan and one for vertical pan. */ BoxRec hRect = {.x1 = -newX, .y1 = -newY}; if (hShift < 0) { hRect.x2 = -oldX; hRect.y2 = -newY + nxagentOption(Height); } else if (hShift > 0) { hRect.x1 = -oldX + nxagentOption(Width); hRect.x2 = -newX + nxagentOption(Width); hRect.y2 = -newY + nxagentOption(Height); } #ifdef DEBUG fprintf(stderr, "nxagentMoveViewport: hRect p1[%i, %i] - p2[%i, %i].\n", hRect.x1, hRect.y1, hRect.x2, hRect.y2); #endif BoxRec vRect = {.x1 = -newX, .y1 = -newY}; if (vShift < 0) { vRect.x2 = -newX + nxagentOption(Width); vRect.y2 = -oldY; } else if (vShift > 0) { vRect.y1 = -oldY + nxagentOption(Height); vRect.x2 = -newX + nxagentOption(Width); vRect.y2 = -newY + nxagentOption(Height); } #ifdef DEBUG fprintf(stderr, "nxagentMoveViewport: vRect p1[%i, %i] - p2[%i, %i].\n", vRect.x1, vRect.y1, vRect.x2, vRect.y2); #endif if (oldX != newX && hRect.x1 != hRect.x2 && hRect.y1 != hRect.y2) { nxagentAddRectToRemoteExposeRegion(&hRect); } if (oldY != newY && vRect.x1 != vRect.x2 && vRect.y1 != vRect.y2) { nxagentAddRectToRemoteExposeRegion(&vRect); } } } nxagentUpdateViewportFrame(-nxagentOption(RootX), -nxagentOption(RootY), nxagentOption(Width), nxagentOption(Height)); } /* * This will update the window on the real X server by calling * XConfigureWindow()/XMapWindow()/XLowerWindow()/XRaiseWindow(). * mask defines the values that need to be updated, see e.g. * man XConfigureWindow. * * In addition to the bit flags known to Xorg it uses these * self-defined ones: CW_Update, CW_Shape, CW_Map, CW_RootlessRestack. */ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) { unsigned int valuemask; XWindowChanges values; int offX = nxagentWindowPriv(pWin)->x - pWin->origin.x; int offY = nxagentWindowPriv(pWin)->y - pWin->origin.y; if (nxagentScreenTrap == 1) { #ifdef TEST fprintf(stderr, "nxagentConfigureWindow: WARNING: Called with the screen trap set.\n"); #endif return; } if (nxagentOption(Rootless) == 1 && nxagentWindowTopLevel(pWin) == 1) { mask &= ~(CWSibling | CWStackMode); } else { if (mask & CW_RootlessRestack) { mask = CWStackMode; } } #ifdef TEST fprintf(stderr, "nxagentConfigureWindow: Called with window [%p][%ld] and mask [%x].\n", (void *) pWin, nxagentWindow(pWin), mask); #endif nxagentMoveCorruptedRegion(pWin, mask); valuemask = 0; if (mask & CW_Update) { mask |= CWX | CWY | CWWidth | CWHeight | CWBorderWidth | CWStackMode; } if (mask & CWX) { valuemask |= CWX; values.x = nxagentWindowPriv(pWin)->x = pWin->origin.x - wBorderWidth(pWin); } if (mask & CWY) { valuemask |= CWY; values.y = nxagentWindowPriv(pWin)->y = pWin->origin.y - wBorderWidth(pWin); } if (mask & CWWidth) { valuemask |= CWWidth; values.width = nxagentWindowPriv(pWin)->width = pWin->drawable.width; } if (mask & CWHeight) { valuemask |= CWHeight; values.height = nxagentWindowPriv(pWin)->height = pWin->drawable.height; } if (mask & CWBorderWidth) { valuemask |= CWBorderWidth; values.border_width = nxagentWindowPriv(pWin)->borderWidth = pWin->borderWidth; } if (mask & CW_Update) { valuemask = 0; } if (valuemask) { #ifdef TEST fprintf(stderr, "nxagentConfigureWindow: Going to configure window [%p][%ld] with mask [%x].\n", (void *) pWin, nxagentWindow(pWin), valuemask); #endif if (pWin->bitGravity == StaticGravity && ((mask & CWX) || (mask & CWY)) && ((mask & CWWidth) || (mask & CWHeight))) { #ifdef TEST fprintf(stderr, "nxagentConfigureWindow: Window has StaticGravity. Going to translate Expose events by offset [%d, %d].\n", offX, offY); #endif nxagentAddStaticResizedWindow(pWin, XNextRequest(nxagentDisplay), offX, offY); for (int j = 0; j < nxagentExposeQueue.length; j++) { int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE; if (nxagentExposeQueue.exposures[i].pWindow == pWin && nxagentExposeQueue.exposures[i].remoteRegion != NullRegion) { RegionTranslate(nxagentExposeQueue.exposures[i].remoteRegion, offX, offY); } } } XConfigureWindow(nxagentDisplay, nxagentWindow(pWin), valuemask, &values); MAKE_SYNC_CONFIGURE_WINDOW; } if (mask & CWStackMode && nxagentWindowPriv(pWin)->siblingAbove != nxagentWindowSiblingAbove(pWin)) { WindowPtr pSib; /* * Find the top sibling. */ for (pSib = pWin; pSib->prevSib != NullWindow; pSib = pSib->prevSib); /* * Configure the top sibling. */ valuemask = CWStackMode; values.stack_mode = Above; #ifdef TEST fprintf(stderr, "nxagentConfigureWindow: Going to configure top sibling [%ld] " "with mask [%x] and parent [%ld].\n", nxagentWindow(pSib), valuemask, nxagentWindowParent(pWin)); #endif XConfigureWindow(nxagentDisplay, nxagentWindow(pSib), valuemask, &values); MAKE_SYNC_CONFIGURE_WINDOW; nxagentWindowPriv(pSib)->siblingAbove = None; /* * Configure the rest of siblings. */ valuemask = CWSibling | CWStackMode; values.stack_mode = Below; for (pSib = pSib->nextSib; pSib != NullWindow; pSib = pSib->nextSib) { values.sibling = nxagentWindowSiblingAbove(pSib); #ifdef TEST fprintf(stderr, "nxagentConfigureWindow: Going to configure other sibling [%ld] " "with mask [%x] and parent [%ld] below [%ld].\n", nxagentWindow(pSib), valuemask, nxagentWindowParent(pWin), nxagentWindowSiblingAbove(pSib)); #endif XConfigureWindow(nxagentDisplay, nxagentWindow(pSib), valuemask, &values); MAKE_SYNC_CONFIGURE_WINDOW; nxagentWindowPriv(pSib)->siblingAbove = nxagentWindowSiblingAbove(pSib); } #ifdef TEST { Window root_return; Window parent_return; Window *children_return = NULL; unsigned int nchildren_return; Status result; result = XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), &root_return, &parent_return, &children_return, &nchildren_return); if (result) { fprintf(stderr, "nxagentConfigureWindow: Children of the root: "); while(nchildren_return > 0) { pSib = nxagentWindowPtr(children_return[--nchildren_return]); if (pSib) { fprintf(stderr, "%lu ", children_return[nchildren_return]); } } fprintf(stderr, "\n"); } else { fprintf(stderr, "nxagentConfigureWindow: Failed QueryTree request.\n "); } SAFE_XFree(children_return); } #endif } /* * This should bring again the splash window * on top, so why the else clause? Is this * really needed? * * * else if (mask & CWStackMode) * { * if (nxagentSplashWindow) * { * valuemask = CWStackMode; * * values.stack_mode = Above; * * #ifdef TEST * fprintf(stderr, "nxagentConfigureWindow: Going to configure splash window [%ld].\n", * nxagentSplashWindow); * #endif * * XConfigureWindow(nxagentDisplay, nxagentSplashWindow, valuemask, &values); * * MAKE_SYNC_CONFIGURE_WINDOW; * } * } */ if (mask & CW_RootlessRestack) { if (!pWin -> prevSib) { #ifdef TEST fprintf(stderr, "nxagentConfigureWindow: Raising window [%p][%ld].\n", (void *) pWin, nxagentWindow(pWin)); #endif XRaiseWindow(nxagentDisplay, nxagentWindow(pWin)); } else if (!pWin -> nextSib) { #ifdef TEST fprintf(stderr, "nxagentConfigureWindow: Lowering window [%p][%ld].\n", (void *) pWin, nxagentWindow(pWin)); #endif XLowerWindow(nxagentDisplay, nxagentWindow(pWin)); } else { XlibWindow windowList[2]; #ifdef TEST fprintf(stderr, "nxagentConfigureWindow: Putting window [%p][%ld] in the middle.\n", (void *) pWin, nxagentWindow(pWin)); #endif windowList[0] = nxagentWindow(pWin->prevSib); windowList[1] = nxagentWindow(pWin); XRestackWindows(nxagentDisplay, windowList, 2); } } #ifdef SHAPE if (mask & CW_Shape) { nxagentShapeWindow(pWin); } #endif if (mask & CW_Map && (!nxagentOption(Rootless) || nxagentRootlessWindow != pWin)) { XMapWindow(nxagentDisplay, nxagentWindow(pWin)); return; } } /* * from "Definition of the Porting Layer for X v11 Sample Server": * * This function will be called when a window is reparented. At the * time of the call, pWin will already be spliced into its new * position in the window tree, and pPriorParent is its previous * parent. This function can be NULL. * * We simply pass this pver to the real X server. */ void nxagentReparentWindow(WindowPtr pWin, WindowPtr pOldParent) { if (nxagentScreenTrap) { return; } #ifdef TEST fprintf(stderr, "nxagentReparentWindow: window at %p [%lx] previous parent at %p [%lx].\n", (void*)pWin, nxagentWindow(pWin), (void*)pOldParent, nxagentWindow(pOldParent)); #endif XReparentWindow(nxagentDisplay, nxagentWindow(pWin), nxagentWindowParent(pWin), pWin->origin.x - wBorderWidth(pWin), pWin->origin.y - wBorderWidth(pWin)); } /* * from "Definition of the Porting Layer for X v11 Sample Server": * * ChangeWindowAttributes is called whenever DIX changes window * attributes, such as the size, front-to-back ordering, title, or * anything of lesser severity that affects the window itself. The * sample server implements this routine. It computes accelerators for * quickly putting up background and border tiles. (See description of * the set of routines stored in the WindowRec.) */ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) { XSetWindowAttributes attributes; #ifdef TEST fprintf(stderr, "nxagentChangeWindowAttributes: Changing attributes for window at [%p] with mask [%lu].\n", (void *) pWin, mask); #endif if (nxagentScreenTrap) { return True; } if (mask & CWBackPixmap) { switch (pWin->backgroundState) { case None: { attributes.background_pixmap = None; attributes.background_pixel = nxagentWhitePixel; /* * One of problems faced during the implementation of lazy * encoding policies was due to the presence of windows with * transparent background, usually created by X clients to * cover some sensible areas (i.e. checkboxes used by * Konqueror 3.5). The sequence of operations consists in * drawing the underneath part before covering it with the * transparent window, so when we synchronize the deferred * drawing operation we have to bear in mind that the dest- * ination area is covered by a window. By using the Inclu- * deInferiors GC's property and by clipping the region to * synchronize to the borderClip instead of clipList (to * include the areas covered by children) we can easily take * care of this situation, but there is a drawback: if the * children are not transparent, we are going to synchronize * invisible areas. To avoid this we have added the 'has- * TransparentChildren' flag, which is set when a window has * at least one child with background None. The problem is * that we don't know when to reset the flag. This solution, * also, doesn't take care of transparent windows which don't * have childhood relationships with underneath windows. * We tried to mark the whole windows as dirty when they are * created to force the synchronization of transparent windows * with the content of underneath windows, but, of course, * this works only with the first synchronization because the * transparent windows will be never marked again as dirty. */ if (pWin -> parent != NULL) { nxagentWindowPriv(pWin -> parent) -> hasTransparentChildren = 1; #ifdef DEBUG fprintf(stderr, "nxagentChangeWindowAttributes: WARNING! Window at [%p] got the " "hasTransparentChildren flag.\n", (void *) pWin); #endif } break; } case ParentRelative: { attributes.background_pixmap = ParentRelative; break; } case BackgroundPixmap: { /* * If a window background is corrupted, we grant * its usability by clearing it with a solid co- * lor. When the pixmap will be fully synchroni- * zed, an expose will be sent to the window's * hierarchy. */ if (nxagentDrawableStatus((DrawablePtr) pWin -> background.pixmap) == NotSynchronized) { #ifdef TEST fprintf(stderr, "nxagentChangeWindowAttributes: The window at [%p] has the background at [%p] " "not synchronized.\n", (void *) pWin, (void *) pWin -> background.pixmap); #endif if (nxagentIsCorruptedBackground(pWin -> background.pixmap) == 0) { nxagentIsCorruptedBackground(pWin -> background.pixmap) = 1; nxagentAllocateCorruptedResource((DrawablePtr) pWin -> background.pixmap, RT_NX_CORR_BACKGROUND); /* * Clearing the remote background to * make it usable. */ nxagentFillRemoteRegion((DrawablePtr) pWin -> background.pixmap, nxagentCorruptedRegion((DrawablePtr) pWin -> background.pixmap)); } } attributes.background_pixmap = nxagentPixmap(pWin -> background.pixmap); break; } case BackgroundPixel: { mask &= ~CWBackPixmap; break; } } } if (mask & CWBackPixel) { if (pWin -> backgroundState == BackgroundPixel) { attributes.background_pixel = nxagentPixel(pWin -> background.pixel); } else { mask &= ~CWBackPixel; } } if (mask & CWBorderPixmap) { if (pWin -> borderIsPixel != 0) { mask &= ~CWBorderPixmap; } else { attributes.border_pixmap = nxagentPixmap(pWin -> border.pixmap); } } if (mask & CWBorderPixel) { if (pWin -> borderIsPixel != 0) { attributes.border_pixel = nxagentPixel(pWin -> border.pixel); } else { mask &= ~CWBorderPixel; } } if (mask & CWBitGravity) { attributes.bit_gravity = pWin -> bitGravity; } /* * As we set this bit, we must change dix in * order not to perform PositionWindow and let * X move children windows for us. */ if (mask & CWWinGravity) { attributes.win_gravity = pWin -> winGravity; } /* FIXME: Do we need to set the attribute on the remote display? */ if (mask & CWBackingStore) { attributes.backing_store = pWin -> backingStore; #ifdef TEST fprintf(stderr, "nxagentChangeWindowAttributes: Changing backing store value to %d" " for window at %p.\n", pWin -> backingStore, (void*)pWin); #endif } if (mask & CWBackingPlanes) { if ((nxagentBackingStore == NotUseful) || (pWin -> optional == NULL)) { mask &= ~CWBackingPlanes; } else { attributes.backing_planes = pWin -> optional -> backingBitPlanes; } } if (mask & CWBackingPixel) { if ((nxagentBackingStore == NotUseful) || (pWin -> optional == NULL)) { mask &= ~CWBackingPixel; } else { attributes.backing_pixel = pWin -> optional -> backingPixel; } } if (mask & CWOverrideRedirect) { attributes.override_redirect = pWin -> overrideRedirect; } /* FIXME: Do we need to set the attribute on the remote display? */ if (mask & CWSaveUnder) { attributes.save_under = pWin -> saveUnder; } /* * Events are handled elsewhere. */ if (mask & CWEventMask) { mask &= ~CWEventMask; } if (mask & CWDontPropagate) { mask &= ~CWDontPropagate; } if (mask & CWColormap) { ColormapPtr pCmap = (ColormapPtr) LookupIDByType(wColormap(pWin), RT_COLORMAP); /* FIXME: When the caller is nxagentReconfigureWindow sometimes wColormap(pWin) is 0. Could a window have no colormap? */ if (pCmap != NULL) { attributes.colormap = nxagentColormap(pCmap); nxagentSetInstalledColormapWindows(pWin -> drawable.pScreen); } else { #ifdef WARNING fprintf(stderr, "nxagentChangeWindowAttributes: WARNING! Bad colormap " "[%lu] for window at [%p].\n", wColormap(pWin), (void *) pWin); #endif mask &= ~CWColormap; } } if (mask & CWCursor) { if (nxagentOption(Rootless)) { if (pWin->cursorIsNone == 0 && pWin->optional != NULL && pWin->optional->cursor != NULL && nxagentCursorPriv(pWin -> optional -> cursor, pWin -> drawable.pScreen) != NULL) { attributes.cursor = nxagentCursor(pWin -> optional -> cursor, pWin -> drawable.pScreen); } else { attributes.cursor = None; } } else { /* * This is handled in cursor code */ mask &= ~CWCursor; } } if (mask != 0) { XChangeWindowAttributes(nxagentDisplay, nxagentWindow(pWin), mask, &attributes); } return 1; } /* Set the WM_STATE property of pWin to the desired value */ void nxagentSetWMState(WindowPtr pWin, CARD32 desired) { Atom prop = MakeAtom("WM_STATE", strlen("WM_STATE"), True); nxagentWMStateRec wmState = {.state = desired, .icon = None}; if (ChangeWindowProperty(pWin, prop, prop, 32, 0, 2, &wmState, 1) != Success) { #ifdef WARNING fprintf(stderr, "%s: Changing WM_STATE failed.\n", __func__); #endif } } /* * from "Definition of the Porting Layer for X v11 Sample Server": * * RealizeWindow/UnRealizeWindow: * These routines are hooks for when DIX maps (makes visible) and * unmaps (makes invisible) a window. It should do whatever private * operations need to be done when these happen, such as allocating or * deallocating structures that are only needed for visible * windows. RealizeWindow does NOT draw the window border, background * or contents; UnrealizeWindow does NOT erase the window or generate * exposure events for underlying windows; this is taken care of by * DIX. DIX does, however, call PaintWindowBackground() and * PaintWindowBorder() to perform some of these. -+ */ Bool nxagentRealizeWindow(WindowPtr pWin) { if (nxagentScreenTrap == 1) { return True; } /* * Not needed. * * nxagentConfigureWindow(pWin, CWStackMode); * * nxagentFlushConfigureWindow(); */ nxagentAddConfiguredWindow(pWin, CWStackMode); nxagentAddConfiguredWindow(pWin, CW_Shape); /* add by dimbor */ if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin)) { nxagentSetWMState(pWin, NormalState); } /* * Not needed. * #ifdef SHAPE nxagentShapeWindow(pWin); #endif */ #ifdef TEST if (nxagentOption(Rootless) && nxagentLastWindowDestroyed) { fprintf(stderr, "%s: Window realized. Stopped termination for rootless session.\n", __func__); } #endif nxagentAddConfiguredWindow(pWin, CW_Map); nxagentLastWindowDestroyed = False; return True; } /* See nxagentRealizeWindow for a description */ Bool nxagentUnrealizeWindow(WindowPtr pWin) { if (nxagentScreenTrap) { return True; } /* add by dimbor */ if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin)) { /* * The original _comment_ was WithdrawnState, while the _value_ * was 3, which is IconicState. */ nxagentSetWMState(pWin, IconicState); } XUnmapWindow(nxagentDisplay, nxagentWindow(pWin)); return True; } void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) { if (pWin->backgroundState == BackgroundPixmap) { pWin->background.pixmap = nxagentVirtualPixmap(pWin->background.pixmap); } if (pWin->borderIsPixel == False) { pWin->border.pixmap = nxagentVirtualPixmap(pWin->border.pixmap); } /* * Call fbPaintWindow(). We need to temporarily replace * PaintWindowBackground() by ourself because fbPaintWindow() is * recursively calling it for parent windows, too. */ { void (*PaintWindowBackgroundBackup)(WindowPtr, RegionPtr, int); PaintWindowBackgroundBackup = pWin->drawable.pScreen -> PaintWindowBackground; pWin->drawable.pScreen -> PaintWindowBackground = nxagentFrameBufferPaintWindow; fbPaintWindow(pWin, pRegion, what); pWin->drawable.pScreen -> PaintWindowBackground = PaintWindowBackgroundBackup; } if (pWin->backgroundState == BackgroundPixmap) { pWin->background.pixmap = nxagentRealPixmap(pWin->background.pixmap); } if (pWin->borderIsPixel == False) { pWin->border.pixmap = nxagentRealPixmap(pWin->border.pixmap); } } void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) { RegionRec temp; if (pWin -> realized) { BoxPtr pBox = RegionRects(pRegion); for (int i = 0; i < RegionNumRects(pRegion); i++) { XClearArea(nxagentDisplay, nxagentWindow(pWin), pBox[i].x1 - pWin->drawable.x, pBox[i].y1 - pWin->drawable.y, pBox[i].x2 - pBox[i].x1, pBox[i].y2 - pBox[i].y1, False); } } #ifdef TEST else { fprintf(stderr, "nxagentPaintWindowBackground: Saving the operation with window " "at [%p] not realized.\n", (void *) pWin); } #endif /* * The framebuffer operations don't take care of * clipping to the actual area of the framebuffer * so we need to clip ourselves. */ RegionInit(&temp, NullBox, 1); RegionIntersect(&temp, pRegion, &pWin -> clipList); nxagentFrameBufferPaintWindow(pWin, &temp, what); RegionUninit(&temp); } void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) { RegionRec temp; /* * The framebuffer operations don't take care of * clipping to the actual area of the framebuffer * so we need to clip ourselves. */ RegionInit(&temp, NullBox, 1); RegionIntersect(&temp, pRegion, &pWin -> borderClip); nxagentFrameBufferPaintWindow(pWin, &temp, what); RegionUninit(&temp); } /* * from "Definition of the Porting Layer for X v11 Sample Server": * * CopyWindow is called when a window is moved, and graphically moves * to pixels of a window on the screen. It should not change any other * state within DDX (see PositionWindow(), above). * * oldpt is the old location of the upper-left corner. oldRegion is * the old region it is coming from. The new location and new region * is stored in the WindowRec. oldRegion might modified in place by * this routine (the sample implementation does this). * * CopyArea could be used, except that this operation has more * complications. First of all, you do not want to copy a rectangle * onto a rectangle. The original window may be obscured by other * windows, and the new window location may be similarly * obscured. Second, some hardware supports multiple windows with * multiple depths, and your routine needs to take care of that. * * The pixels in oldRegion (with reference point oldpt) are copied to * the window's new region (pWin->borderClip). pWin->borderClip is * gotten directly from the window, rather than passing it as a * parameter. * * The sample server implementation is in Xserver/fb/fbwindow.c. */ void nxagentCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion) { fbCopyWindow(pWin, oldOrigin, oldRegion); } /* * from "Definition of the Porting Layer for X v11 Sample Server": * * Whenever the cliplist for a window is changed, this function is * called to perform whatever hardware manipulations might be * necessary. When called, the clip list and border clip regions in * the window are set to the new values. dx,dy are the distance that * the window has been moved (if at all). */ void nxagentClipNotify(WindowPtr pWin, int dx, int dy) { /* * nxagentConfigureWindow(pWin, CWStackMode); */ nxagentAddConfiguredWindow(pWin, CWStackMode); nxagentAddConfiguredWindow(pWin, CW_Shape); #ifndef NXAGENT_SHAPE #ifdef SHAPE /* * nxagentShapeWindow(pWin); */ #endif /* SHAPE */ #endif /* NXAGENT_SHAPE */ } /* * from "Definition of the Porting Layer for X v11 Sample Server": * * The WindowExposures() routine paints the border and generates * exposure events for the window. pRegion is an unoccluded region of * the window, and pBSRegion is an occluded region that has backing * store. Since exposure events include a rectangle describing what * was exposed, this routine may have to send back a series of * exposure events, one for each rectangle of the region. The count * field in the expose event is a hint to the client as to the number * of regions that are after this one. This routine must be * provided. The sample server has a machine-independent version in * Xserver/mi/miexpose.c. */ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed) { /* * The problem: we want to synthetize the expose events internally, so * that we reduce the time between a window operation and the corresp- * onding graphical output, but at the same time we need to take care * of the remote exposures, as we need to handle those cases where our * windows are covered by the windows on the real display. Handling * both the local and the remote exposures we would generate the same * redraws twice, something we call "double refreshes", so we must be * able to identify which events have been already sent to our clients. * * Here is how the algorithm is working: * * - We collect the exposures that the agent sent to its clients in a * region (the "local-region") and store the region for a given win- * dow in a vector. * * - Another region collects the expose that were received from the * real X server (the "remote-region") for the same window. * * - We create a "fake" off-screen window. For every generated region * we send a ConfigureWindow request for that window to synchronize * ourselves with both the remote X server and/or the window manager. * * - When the ConfigureNotify is received, we calculate the difference * between the "remote-region" and the "local-region" for the window * that had collected exposures. * * - Finally we send the resulting exposures to our clients. * * As you may have guessed, the windows are synchronized per-region, * that is there is a single region for a set of exposures. The regions * are handled in order. This means that we can always calculate the * final region by referring to the first element of the vector. */ RegionRec temp; BoxRec box; if (nxagentSessionState != SESSION_DOWN) { if (nxagentExposeArrayIsInitialized == 0) { #ifdef TEST fprintf(stderr, "nxagentWindowExposures: Initializing expose queue.\n"); #endif for (int i = 0; i < EXPOSED_SIZE; i++) { nxagentExposeQueue.exposures[i].pWindow = NULL; nxagentExposeQueue.exposures[i].localRegion = NullRegion; nxagentExposeQueue.exposures[i].remoteRegion = NullRegion; nxagentExposeQueue.exposures[i].remoteRegionIsCompleted = False; nxagentExposeQueue.exposures[i].serial = 0; } nxagentExposeQueue.start = 0; nxagentExposeQueue.length = 0; nxagentExposeSerial = 0; XSetWindowAttributes attributes = {.event_mask = StructureNotifyMask}; nxagentConfiguredSynchroWindow = XCreateWindow(nxagentDisplay, DefaultRootWindow(nxagentDisplay), 0, 0, 1, 1, 0, 0, InputOutput, 0, CWEventMask, &attributes); nxagentInitRemoteExposeRegion(); nxagentExposeArrayIsInitialized = 1; } RegionInit(&temp, (BoxRec *) NULL, 1); if (pRgn != NULL) { if (RegionNumRects(pRgn) > RECTLIMIT) { box = *RegionExtents(pRgn); RegionEmpty(pRgn); RegionInit(pRgn, &box, 1); } RegionUnion(&temp, &temp, pRgn); } if (other_exposed != NULL) { RegionUnion(&temp, &temp, other_exposed); } if (RegionNil(&temp) == 0) { RegionTranslate(&temp, -(pWin -> drawable.x), -(pWin -> drawable.y)); if (nxagentExposeQueue.length < EXPOSED_SIZE) { int index = (nxagentExposeQueue.start + nxagentExposeQueue.length) % EXPOSED_SIZE; nxagentExposeQueue.exposures[index].pWindow = pWin; nxagentExposeQueue.exposures[index].localRegion = RegionCreate(NULL, 1); if (nxagentOption(Rootless) && nxagentWindowPriv(pWin) && (nxagentWindowPriv(pWin) -> isMapped == 0 || nxagentWindowPriv(pWin) -> visibilityState != VisibilityUnobscured)) { nxagentExposeQueue.exposures[index].remoteRegion = RegionCreate(NULL, 1); RegionUnion(nxagentExposeQueue.exposures[index].remoteRegion, nxagentExposeQueue.exposures[index].remoteRegion, &temp); #ifdef TEST fprintf(stderr, "nxagentWindowExposures: Added region to remoteRegion for window [%ld] to position [%d].\n", nxagentWindow(pWin), nxagentExposeQueue.length); #endif } else { RegionUnion(nxagentExposeQueue.exposures[index].localRegion, nxagentExposeQueue.exposures[index].localRegion, &temp); #ifdef TEST fprintf(stderr, "nxagentWindowExposures: Added region to localRegion for window [%ld] to position [%d].\n", nxagentWindow(pWin), nxagentExposeQueue.length); #endif } nxagentExposeSerial = (nxagentExposeSerial - 1) % EXPOSED_SIZE; nxagentExposeQueue.exposures[index].serial = nxagentExposeSerial; #ifdef TEST fprintf(stderr, "nxagentWindowExposures: Added region to queue with serial [%d].\n", nxagentExposeSerial); #endif /* * Mark this region for sending a synchro, * in nxagentFlushConfigureWindow(). */ nxagentExposeQueue.exposures[index].synchronize = 1; nxagentExposeQueue.length++; if (nxagentOption(Rootless) && nxagentWindowPriv(pWin) && (nxagentWindowPriv(pWin) -> isMapped == 0 || nxagentWindowPriv(pWin) -> visibilityState != VisibilityUnobscured)) { RegionUninit(&temp); return; } } else { RegionUninit(&temp); #ifdef TEST fprintf(stderr, "nxagentWindowExposures: WARNING! Reached maximum size of collect exposures vector.\n"); #endif if ((pRgn != NULL && RegionNotEmpty(pRgn) != 0) || (other_exposed != NULL && RegionNotEmpty(other_exposed) != 0)) { nxagentUnmarkExposedRegion(pWin, pRgn, other_exposed); miWindowExposures(pWin, pRgn, other_exposed); } return; } } RegionUninit(&temp); } if ((pRgn != NULL && RegionNotEmpty(pRgn) != 0) || (other_exposed != NULL && RegionNotEmpty(other_exposed) != 0)) { nxagentUnmarkExposedRegion(pWin, pRgn, other_exposed); miWindowExposures(pWin, pRgn, other_exposed); } return; } #ifdef SHAPE static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2) { BoxPtr pBox1, pBox2; unsigned int n1, n2; if (pReg1 == pReg2) { return True; } if (pReg1 == NullRegion || pReg2 == NullRegion) { return False; } pBox1 = RegionRects(pReg1); n1 = RegionNumRects(pReg1); pBox2 = RegionRects(pReg2); n2 = RegionNumRects(pReg2); if (n1 != n2) { return False; } if (pBox1 == pBox2) { return True; } if (memcmp(pBox1, pBox2, n1 * sizeof(BoxRec))) { return False; } return True; } void nxagentShapeWindow(WindowPtr pWin) { Region reg; BoxPtr pBox; if (NXDisplayError(nxagentDisplay) == 1) { return; } #ifdef DEBUG fprintf(stderr, "nxagentShapeWindow: Window at [%p][%ld].\n", (void *) pWin, nxagentWindow(pWin)); #endif /* FIXME: this is the same code as below, just with another shape. Maybe move this code to a helper function? */ if (!nxagentRegionEqual(nxagentWindowPriv(pWin)->boundingShape, wBoundingShape(pWin))) { #ifdef DEBUG fprintf(stderr, "nxagentShapeWindow: Bounding shape differs.\n"); #endif if (wBoundingShape(pWin)) { #ifdef DEBUG fprintf(stderr, "nxagentShapeWindow: wBounding shape has [%ld] rects.\n", RegionNumRects(wBoundingShape(pWin))); #endif #ifdef NXAGENT_SHAPE2 if (!nxagentWindowPriv(pWin)->boundingShape) { nxagentWindowPriv(pWin)->boundingShape = RegionCreate(NULL, 1); } #endif RegionCopy(nxagentWindowPriv(pWin)->boundingShape, wBoundingShape(pWin)); reg = XCreateRegion(); pBox = RegionRects(nxagentWindowPriv(pWin)->boundingShape); for (int i = 0; i < RegionNumRects(nxagentWindowPriv(pWin)->boundingShape); i++) { XRectangle rect = { .x = pBox[i].x1, .y = pBox[i].y1, .width = pBox[i].x2 - pBox[i].x1, .height = pBox[i].y2 - pBox[i].y1 }; XUnionRectWithRegion(&rect, reg, reg); } #ifndef NXAGENT_SHAPE XShapeCombineRegion(nxagentDisplay, nxagentWindow(pWin), ShapeBounding, 0, 0, reg, ShapeSet); #endif XDestroyRegion(reg); } else { #ifdef DEBUG fprintf(stderr, "nxagentShapeWindow: wBounding shape does not exist. Removing the shape.\n"); #endif RegionEmpty(nxagentWindowPriv(pWin)->boundingShape); #ifndef NXAGENT_SHAPE XShapeCombineMask(nxagentDisplay, nxagentWindow(pWin), ShapeBounding, 0, 0, None, ShapeSet); #endif } } if (!nxagentRegionEqual(nxagentWindowPriv(pWin)->clipShape, wClipShape(pWin))) { #ifdef DEBUG fprintf(stderr, "nxagentShapeWindow: Clip shape differs.\n"); #endif if (wClipShape(pWin)) { #ifdef DEBUG fprintf(stderr, "nxagentShapeWindow: wClip shape has [%ld] rects.\n", RegionNumRects(wClipShape(pWin))); #endif #ifdef NXAGENT_SHAPE2 if (!nxagentWindowPriv(pWin)->clipShape) { nxagentWindowPriv(pWin)->clipShape = RegionCreate(NULL, 1); } #endif RegionCopy(nxagentWindowPriv(pWin)->clipShape, wClipShape(pWin)); reg = XCreateRegion(); pBox = RegionRects(nxagentWindowPriv(pWin)->clipShape); for (int i = 0; i < RegionNumRects(nxagentWindowPriv(pWin)->clipShape); i++) { XRectangle rect = { .x = pBox[i].x1, .y = pBox[i].y1, .width = pBox[i].x2 - pBox[i].x1, .height = pBox[i].y2 - pBox[i].y1 }; XUnionRectWithRegion(&rect, reg, reg); } #ifndef NXAGENT_SHAPE XShapeCombineRegion(nxagentDisplay, nxagentWindow(pWin), ShapeClip, 0, 0, reg, ShapeSet); #endif XDestroyRegion(reg); } else { #ifdef DEBUG fprintf(stderr, "nxagentShapeWindow: wClip shape does not exist. Removing the shape.\n"); #endif RegionEmpty(nxagentWindowPriv(pWin)->clipShape); #ifndef NXAGENT_SHAPE XShapeCombineMask(nxagentDisplay, nxagentWindow(pWin), ShapeClip, 0, 0, None, ShapeSet); #endif } } } #endif /* SHAPE */ static int nxagentForceExposure(WindowPtr pWin, void * ptr) { if (pWin -> drawable.class != InputOnly) { WindowPtr pRoot = pWin->drawable.pScreen->root; BoxRec Box = { .x1 = pWin->drawable.x, .y1 = pWin->drawable.y, .x2 = Box.x1 + pWin->drawable.width, .y2 = Box.y1 + pWin->drawable.height, }; RegionPtr exposedRgn = RegionCreate(&Box, 1); RegionIntersect(exposedRgn, exposedRgn, &pRoot->winSize); if (exposedRgn != NULL && RegionNotEmpty(exposedRgn) != 0) { miWindowExposures(pWin, exposedRgn, NullRegion); } RegionDestroy(exposedRgn); } return WT_WALKCHILDREN; } void nxagentRefreshWindows(WindowPtr pWin) { int action = 1; TraverseTree(pWin, nxagentForceExposure, &action); } void nxagentUnmapWindows(void) { if (nxagentOption(Fullscreen) == 1) { for (int i = 0; i < screenInfo.numScreens; i++) { if (nxagentDefaultWindows[i]) { XUnmapWindow(nxagentDisplay, nxagentDefaultWindows[i]); } } } NXFlushDisplay(nxagentDisplay, NXFlushLink); } void nxagentMapDefaultWindows(void) { for (int i = 0; i < screenInfo.numScreens; i++) { WindowPtr pWin = screenInfo.screens[i]->root; ScreenPtr pScreen = pWin -> drawable.pScreen; /* * InitRootWindow does that already, but as MapWindow() is * idempotent we keep it here, too */ MapWindow(pWin, serverClient); if (nxagentOption(Rootless) == 0) { /* * Show the NX splash screen. */ #ifdef TEST fprintf(stderr, "nxagentMapDefaultWindows: Showing the splash window.\n"); #endif nxagentShowSplashWindow(nxagentDefaultWindows[pScreen->myNum]); /* * Map the default window. Defer the mapping if the session is * of shadow type. If no WM is running on the remote display, * map the window soon anyway: this avoids a flickering effect * on the !M logo if the shadow session is displayed from a * Windows client. */ if (nxagentOption(Shadow) == 0 || !nxagentWMIsRunning) { #ifdef TEST fprintf(stderr, "nxagentMapDefaultWindows: Mapping default window id [%ld].\n", nxagentDefaultWindows[pScreen->myNum]); #endif XMapWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum]); if (nxagentOption(Fullscreen) == 1 && nxagentWMIsRunning) { nxagentMaximizeToFullScreen(pScreen); } } /* * Map and raise the input window. */ XMapWindow(nxagentDisplay, nxagentInputWindows[pScreen->myNum]); /* * At reconnection the Input Window is * raised in nxagentReconnectAllWindows, * after the Root Window is mapped. */ if (nxagentReconnectTrap == 0) { XRaiseWindow(nxagentDisplay, nxagentInputWindows[pScreen->myNum]); } } /* * Send a SetSelectionOwner request * to notify of the agent start. */ XSetSelectionOwner(nxagentDisplay, serverTransToAgentProperty, nxagentDefaultWindows[i], CurrentTime); } /* * Map the icon window. */ if (nxagentIconWindow != None) { #ifdef TEST fprintf(stderr, "nxagentMapDefaultWindows: Mapping icon window id [%ld].\n", nxagentIconWindow); #endif XMapWindow(nxagentDisplay, nxagentIconWindow); } /* * Ensure that the fullscreen window gets the focus. */ if (nxagentFullscreenWindow != 0) { XSetInputFocus(nxagentDisplay, nxagentFullscreenWindow, RevertToParent, CurrentTime); } #ifdef TEST fprintf(stderr, "nxagentMapDefaultWindows: Completed mapping of default windows.\n"); #endif } Bool nxagentDisconnectAllWindows(void) { Bool succeeded = True; #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_WINDOW_DEBUG) fprintf(stderr, "nxagentDisconnectAllWindows\n"); #endif for (int i = 0; i < screenInfo.numScreens; i++) { WindowPtr pWin = screenInfo.screens[i]->root; nxagentTraverseWindow( pWin, nxagentDisconnectWindow, &succeeded); nxagentDefaultWindows[i] = None; } #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG fprintf(stderr, "nxagentDisconnectAllWindows: all windows disconnected\n"); #endif return succeeded; } /* * FIXME: We are giving up reconnecting those void * * that are not resource, and we are just disconnecting them. * Perhaps we could do better and reconnect them. */ void nxagentDisconnectWindow(void * p0, XID x1, void * p2) { WindowPtr pWin = (WindowPtr)p0; Bool* pBool = (Bool*)p2; CursorPtr pCursor = wCursor(pWin); ScreenPtr pScreen = pWin -> drawable.pScreen; if ((pCursor = wCursor(pWin)) && nxagentCursorPriv(pCursor, pScreen) && nxagentCursor(pCursor, pScreen)) { #ifdef NXAGENT_RECONNECT_CURSOR_DEBUG char msg[] = "nxagentDisconnectWindow:"; nxagentPrintCursorInfo(pCursor, msg); #endif #ifdef NXAGENT_RECONNECT_CURSOR_DEBUG fprintf(stderr, "nxagentDisconnectWindow: window %p - disconnecting cursor %p ID %lx\n", pWin, pCursor, nxagentCursor(pCursor, pScreen)); #endif nxagentDisconnectCursor(pCursor, (XID)0, pBool); if (!*pBool) { #ifdef WARNING fprintf(stderr, "nxagentDisconnectWindow: WARNING failed disconnection of cursor at [%p]" " for window at [%p]: ignoring it.\n", (void*)pCursor, (void*)pWin); #endif *pBool = True; } } #ifdef NXAGENT_RECONNECT_CURSOR_DEBUG else if (pCursor) { fprintf(stderr, "nxagentDisconnectWindow: window %p - cursor %p already disconnected\n", pWin, pCursor); } #endif if ((nxagentRealWindowProp) && (!nxagentWindowTopLevel(pWin))) { Atom prop = MakeAtom("NX_REAL_WINDOW", strlen("NX_REAL_WINDOW"), True); if (DeleteProperty(pWin, prop) != Success) { fprintf(stderr, "nxagentDisconnectWindow: Deleting NX_REAL_WINDOW failed.\n"); } #ifdef DEBUG else { fprintf(stderr, "nxagentDisconnectWindow: Deleting NX_REAL_WINDOW from Window ID [%x].\n", nxagentWindowPriv(pWin)->window); } #endif } nxagentWindow(pWin) = None; if (nxagentDrawableStatus((DrawablePtr) pWin) == NotSynchronized) { nxagentDestroyCorruptedResource((DrawablePtr) pWin, RT_NX_CORR_WINDOW); } } Bool nxagentReconnectAllWindows(void *p0) { /* access the parameter like this if this function needs it in future: int flexibility = *(int *) p0; */ #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_WINDOW_DEBUG) fprintf(stderr, "nxagentReconnectAllWindows\n"); #endif if (screenInfo.screens[0]->root -> backgroundState == BackgroundPixmap && screenInfo.screens[0]->root -> background.pixmap == NULL) { FatalError("nxagentReconnectAllWindows: correct the FIXME\n"); } if (nxagentOption(Fullscreen)) { screenInfo.screens[0]->root -> origin.x = nxagentOption(RootX); screenInfo.screens[0]->root -> origin.y = nxagentOption(RootY); } if (!nxagentLoopOverWindows(nxagentReconnectWindow)) { #ifdef WARNING fprintf(stderr, "nxagentReconnectAllWindows: couldn't recreate windows\n"); #endif return False; } #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG XSync(nxagentDisplay, 0); fprintf(stderr, "nxagentReconnectAllWindows: all windows recreated\n"); #endif if (!nxagentLoopOverWindows(nxagentReconfigureWindow)) { #ifdef WARNING fprintf(stderr, "nxagentReconnectAllWindows: couldn't reconfigure windows\n"); #endif return False; } /* * After the Root Window has * been mapped, the Input * Windows is raised. */ if (nxagentOption(Rootless) == 0) { for (int i = 0; i < screenInfo.numScreens; i++) { XRaiseWindow(nxagentDisplay, nxagentInputWindows[i]); } } nxagentFlushConfigureWindow(); if (nxagentOption(Fullscreen)) { screenInfo.screens[0]->root -> origin.x = 0; screenInfo.screens[0]->root -> origin.y = 0; } #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG XSync(nxagentDisplay, 0); fprintf(stderr, "nxagentReconnectAllWindows: All windows reconfigured.\n"); #endif if (!nxagentInitClipboard(screenInfo.screens[0]->root)) { #ifdef WARNING fprintf(stderr, "nxagentReconnectAllWindows: WARNING! Couldn't initialize the clipboard.\n"); #endif return False; } #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG XSync(nxagentDisplay, 0); fprintf(stderr, "nxagentReconnectAllWindows: Clipboard initialized.\n"); #endif #ifdef VIEWPORT_FRAME /* * We move the viewport frames out of the way on the X server side. */ if (nxagentViewportFrameLeft && nxagentViewportFrameRight && nxagentViewportFrameAbove && nxagentViewportFrameBelow) { XMoveWindow(nxagentDisplay, nxagentWindow(nxagentViewportFrameLeft), -NXAGENT_FRAME_WIDTH, 0); XMoveWindow(nxagentDisplay, nxagentWindow(nxagentViewportFrameRight), nxagentOption(RootWidth), 0); XMoveWindow(nxagentDisplay, nxagentWindow(nxagentViewportFrameAbove), 0, -NXAGENT_FRAME_WIDTH); XMoveWindow(nxagentDisplay, nxagentWindow(nxagentViewportFrameBelow), 0, nxagentOption(RootHeight)); } #endif /* #ifdef VIEWPORT_FRAME */ return True; } Bool nxagentSetWindowCursors(void *p0) { /* access the parameter like this if this function needs it in future: int flexibility = *(int *) p0; */ #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_WINDOW_DEBUG) fprintf(stderr, "nxagentSetWindowCursors: Going to loop over the windows.\n"); #endif if (!nxagentLoopOverWindows(nxagentReconfigureWindowCursor)) { #ifdef WARNING fprintf(stderr, "nxagentSetWindowCursors: WARNING! Couldn't configure all windows' cursors.\n"); #endif return False; } #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG fprintf(stderr, "nxagentSetWindowCursors: All cursors configured.\n"); #endif nxagentReDisplayCurrentCursor(); return True; } static void nxagentTraverseWindow( WindowPtr pWin, void (*pF)(void *, XID, void *), void * p) { pF(pWin, 0, p); if (pWin -> nextSib) { nxagentTraverseWindow(pWin -> nextSib, pF, p); } if (pWin -> firstChild) { nxagentTraverseWindow(pWin -> firstChild, pF, p); } } static Bool nxagentLoopOverWindows(void (*pF)(void *, XID, void *)) { Bool windowSuccess = True; for (int i = 0; i < screenInfo.numScreens; i++) { nxagentTraverseWindow(screenInfo.screens[i]->root, pF, &windowSuccess); } return windowSuccess; } static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer) { WindowPtr pWin = (WindowPtr)param0; Bool *pBool = (Bool*)data_buffer; Visual *visual; unsigned long mask; XSetWindowAttributes attributes; ColormapPtr pCmap; if (!pWin || !*pBool) { return; } #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG fprintf(stderr, "nxagentReconnectWindow: %p - ID %lx\n", pWin, nxagentWindow(pWin)); #endif if (pWin->drawable.class == InputOnly) { mask = CWEventMask; visual = CopyFromParent; } else { mask = CWEventMask | CWBackingStore; attributes.backing_store = NotUseful; if (pWin->optional) { mask |= CWBackingPlanes | CWBackingPixel; attributes.backing_planes = pWin->optional->backingBitPlanes; attributes.backing_pixel = pWin->optional->backingPixel; } /* FIXME: Do we need to set save unders attribute here? */ if (nxagentSaveUnder) { mask |= CWSaveUnder; attributes.save_under = pWin->saveUnder; } if (pWin->parent) { if (pWin->optional && pWin->optional->visual != wVisual(pWin->parent)) { visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); mask |= CWColormap; if (pWin->optional->colormap) { pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP); attributes.colormap = nxagentColormap(pCmap); } else { attributes.colormap = nxagentDefaultVisualColormap(visual); } } else { visual = CopyFromParent; } } else { /* root windows have their own colormaps at creation time */ visual = nxagentVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP); mask |= CWColormap; attributes.colormap = nxagentColormap(pCmap); } } if (mask & CWEventMask) { attributes.event_mask = nxagentGetEventMask(pWin); } #ifdef WARNING else { attributes.event_mask = NoEventMask; } #endif #ifdef TEST fprintf(stderr, "nxagentReconnectWindow: Going to create new window.\n"); fprintf(stderr, "nxagentReconnectWindow: Recreating %swindow at %p current event mask = %lX mask & CWEventMask = %ld " "event_mask = %lX\n", nxagentWindowTopLevel(pWin) ? "toplevel " : "", (void*)pWin, pWin -> eventMask, mask & CWEventMask, attributes.event_mask); #endif /* * FIXME: This quick hack is intended to solve a * problem of NXWin X server for windows. * The NXWin minimize the windows moving them * out of the screen area, this behaviour * can cause problem when a rootless session * is disconnected and an apps is minimized. * It will be solved with new Xorg version of * the NXWin server. */ if (nxagentOption(Rootless)) { if (pWin -> drawable.x == -32000 && pWin -> drawable.y == -32000) { pWin -> drawable.x = (pWin -> drawable.pScreen -> width - pWin -> drawable.width) / 2; pWin -> drawable.y = (pWin -> drawable.pScreen -> height - pWin -> drawable.height) /2; } if (pWin -> origin.x == -32000 && pWin -> origin.y == -32000) { pWin -> origin.x = (pWin -> drawable.pScreen -> width - pWin -> drawable.width) / 2; pWin -> origin.y = (pWin -> drawable.pScreen -> height - pWin -> drawable.height) / 2; } } nxagentWindow(pWin) = XCreateWindow(nxagentDisplay, nxagentWindowParent(pWin), pWin->origin.x - wBorderWidth(pWin), pWin->origin.y - wBorderWidth(pWin), pWin->drawable.width, pWin->drawable.height, pWin->borderWidth, pWin->drawable.depth, pWin->drawable.class, visual, mask, &attributes); if (nxagentReportPrivateWindowIds) { fprintf(stderr, "NXAGENT_WINDOW_ID: PRIVATE_WINDOW,WID:[0x%x],INT:[0x%x]\n", nxagentWindowPriv(pWin)->window, pWin->drawable.id); } #ifdef TEST fprintf(stderr, "nxagentReconnectWindow: Created new window with id [0x%x].\n", nxagentWindowPriv(pWin)->window); #endif /* * We have to set the WM_DELETE_WINDOW protocols * on every top level window, because we don't know * if a client handles this. */ if (nxagentOption(Rootless) && (pWin != screenInfo.screens[0]->root)) { if (nxagentWindowTopLevel(pWin)) { XlibAtom prop = nxagentMakeAtom("WM_PROTOCOLS", strlen("WM_PROTOCOLS"), True); XlibAtom atom = nxagentMakeAtom("WM_DELETE_WINDOW", strlen("WM_DELETE_WINDOW"), True); XSetWMProtocols(nxagentDisplay, nxagentWindow(pWin), &atom, 1); nxagentAddPropertyToList(prop, pWin); } nxagentExportAllProperty(pWin); if (nxagentWindowTopLevel(pWin)) { int ret; Atom type; int format; unsigned long nItems, bytesLeft; XSizeHints hints = {0}; unsigned char *data = NULL; #ifdef _XSERVER64 unsigned char *data64 = NULL; #endif ret = GetWindowProperty(pWin, XA_WM_NORMAL_HINTS, 0, sizeof(XSizeHints), False, XA_WM_SIZE_HINTS, &type, &format, &nItems, &bytesLeft, &data); /* * 72 is the number of bytes returned by * sizeof(XSizeHints) on 32 bit platforms. */ if (ret == Success && ((format >> 3) * nItems) == 72 && bytesLeft == 0 && type == XA_WM_SIZE_HINTS) { XSizeHints *props; #ifdef TEST fprintf(stderr, "nxagentReconnectWindow: setting WMSizeHints on window %p [%lx - %lx].\n", (void*)pWin, pWin -> drawable.id, nxagentWindow(pWin)); #endif #ifdef _XSERVER64 data64 = (unsigned char *) malloc(sizeof(XSizeHints) + 4); for (int i = 0; i < 4; i++) { *(data64 + i) = *(data + i); } *(((int *) data64) + 1) = 0; for (int i = 8; i < sizeof(XSizeHints) + 4; i++) { *(data64 + i) = *(data + i - 4); } props = (XSizeHints *) data64; #else props = (XSizeHints *) data; #endif /* _XSERVER64 */ hints = *props; } else { #ifdef WARNING fprintf(stderr, "nxagentReconnectWindow: Failed to get property WM_NORMAL_HINTS on window %p\n", (void*)pWin); #endif } hints.flags |= (USPosition | PWinGravity); hints.x = pWin -> drawable.x; hints.y = pWin -> drawable.y; hints.win_gravity = StaticGravity; XSetWMNormalHints(nxagentDisplay, nxagentWindow(pWin), &hints); #ifdef _XSERVER64 SAFE_free(data64); #endif } } if ((nxagentRealWindowProp) && (!nxagentWindowTopLevel(pWin))) { Atom prop = MakeAtom("NX_REAL_WINDOW", strlen("NX_REAL_WINDOW"), True); if (ChangeWindowProperty(pWin, prop, XA_WINDOW, 32, PropModeReplace, 1, nxagentWindowPriv(pWin), 1) != Success) { fprintf(stderr, "nxagentReconnectWindow: Updating NX_REAL_WINDOW failed.\n"); } #ifdef DEBUG else { fprintf(stderr, "nxagentReconnectWindow: Updated NX_REAL_WINDOW for Window ID [%x].\n", nxagentWindowPriv(pWin)->window); } #endif } if (nxagentDrawableStatus((DrawablePtr) pWin) == NotSynchronized) { nxagentAllocateCorruptedResource((DrawablePtr) pWin, RT_NX_CORR_WINDOW); } } static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * data_buffer) { WindowPtr pWin = (WindowPtr)param0; Bool *pBool = (Bool*)data_buffer; CursorPtr pCursor; ScreenPtr pScreen; if (!pWin || !*pBool || !(pCursor = wCursor(pWin))) { return; } pScreen = pWin -> drawable.pScreen; if (!(nxagentCursorPriv(pCursor, pScreen))) { return; } #ifdef DEBUG fprintf(stderr, "nxagentReconfigureWindowCursor: %p - ID %lx geometry (%d,%d,%d,%d) " "cursor %p - ID %lx\n", pWin, nxagentWindow(pWin), pWin -> drawable.x, pWin -> drawable.y, pWin -> drawable.width, pWin -> drawable.height, pCursor, nxagentCursor(pCursor, pScreen)); #endif if (nxagentCursor(pCursor, pScreen) == None) { #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG fprintf(stderr, "nxagentReconfigureWindowCursor: reconnecting valid cursor %lx\n", (void*)pCursor); #endif nxagentReconnectCursor(pCursor, 0, pBool); if (!*pBool) { #ifdef WARNING fprintf(stderr, "nxagentReconfigureWindowCursor: WARNING " "failed reconnection of cursor at [%p] for window at [%p]: ignoring it.\n", (void*)pCursor, (void*)pWin); #endif *pBool = True; } } if (nxagentOption(Rootless)) { XDefineCursor(nxagentDisplay,nxagentWindow(pWin),nxagentCursor(pCursor,pScreen)); } } static void nxagentReconfigureWindow(void * param0, XID param1, void * data_buffer) { WindowPtr pWin = (WindowPtr)param0; unsigned long mask = 0; #ifdef DEBUG fprintf(stderr, "nxagentReconfigureWindow: pWin %p - ID %lx\n", pWin, nxagentWindow(pWin)); #endif if (pWin -> drawable.class == InputOnly) { mask = CWWinGravity | CWEventMask | CWDontPropagate | CWOverrideRedirect | CWCursor; } else { mask = CWBackPixmap | CWBackPixel | CWBorderPixmap | CWBorderPixel | CWBitGravity | CWWinGravity | CWBackingStore | CWBackingPlanes | CWBackingPixel | CWOverrideRedirect | CWSaveUnder | CWEventMask | CWDontPropagate | CWColormap | CWCursor; } nxagentChangeWindowAttributes(pWin, mask); #ifdef SHAPE if (nxagentWindowPriv(pWin) -> boundingShape) { RegionDestroy(nxagentWindowPriv(pWin) -> boundingShape); nxagentWindowPriv(pWin) -> boundingShape = NULL; } if (nxagentWindowPriv(pWin) -> clipShape) { RegionDestroy(nxagentWindowPriv(pWin) -> clipShape); nxagentWindowPriv(pWin) -> clipShape = NULL; } nxagentShapeWindow(pWin); #endif if (pWin != screenInfo.screens[0]->root) { if (pWin->realized) { nxagentRealizeWindow (pWin); } /* XXX: This would break Motif menus. If pWin is mapped but not realized, a following UnmapWindow() wouldn't do anything, leaving this mapped window around. XMapWindow() is called in nxagentRealizeWindow() and there it is enough. else if (pWin->mapped) { XMapWindow(nxagentDisplay, nxagentWindow(pWin)); } */ else if (nxagentOption(Rootless) && pWin -> overrideRedirect == 0 && nxagentWindowTopLevel(pWin) && nxagentIsIconic(pWin)) { MapWindow(pWin, serverClient); XIconifyWindow(nxagentDisplay, nxagentWindow(pWin), pWin -> drawable.pScreen -> myNum); } } else if (nxagentOption(Rootless) == 0) { /* * Map the root window. */ XMoveWindow(nxagentDisplay, nxagentWindow(pWin), nxagentOption(RootX), nxagentOption(RootY)); XMapWindow(nxagentDisplay, nxagentWindow(pWin)); } } Bool nxagentCheckIllegalRootMonitoring(WindowPtr pWin, Mask mask) { Mask invalidMask = SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask; if (nxagentOption(Rootless) && pWin == screenInfo.screens[0]->root && (mask & invalidMask)) { return True; } return False; } #ifdef TEST Bool nxagentCheckWindowIntegrity(WindowPtr pWin) { Bool integrity = True; XImage *image; char *data; int format; unsigned long plane_mask = AllPlanes; unsigned int width, height, length, depth; width = pWin -> drawable.width; height = pWin -> drawable.height; depth = pWin -> drawable.depth; format = (depth == 1) ? XYPixmap : ZPixmap; if (width && height) { length = nxagentImageLength(width, height, format, 0, depth); data = calloc(1, length); if (data == NULL) { FatalError("nxagentCheckWindowIntegrity: Failed to allocate a buffer of size %d.\n", length); } image = XGetImage(nxagentDisplay, nxagentWindow(pWin), 0, 0, width, height, plane_mask, format); if (image == NULL) { fprintf(stderr, "XGetImage: Failed.\n"); return False; } fbGetImage((DrawablePtr)pWin, 0, 0, width, height, format, plane_mask, data); if (image && memcmp(image->data, data, length) != 0) { integrity = False; #ifdef TEST char *p = image->data, *q = data; for (int i = 0; i < length; i++) { if (p[i] != q[i]) { fprintf(stderr, "[%d] %d - %d !!!!!!!!!!!!!!!!!!! **************** !!!!!!!!!!!!!!!!!\n", i, p[i], q[i]); } else { fprintf(stderr, "[%d] %d - %d\n", i, p[i], q[i]); } } #endif #ifdef WARNING fprintf(stderr, "nxagentCheckWindowIntegrity: Window %p width %d, height %d, has been realized " "but the data buffer still differs.\n", (void*) pWin, width, height); fprintf(stderr, "nxagentCheckWindowIntegrity: bytes_per_line = %d byte pad %d format %d.\n", image -> bytes_per_line, nxagentImagePad(width, height, 0, depth), image->format); fprintf(stderr, "nxagentCheckWindowIntegrity: image is corrupted!!\n"); #endif } else { #ifdef WARNING fprintf(stderr, "nxagentCheckWindowIntegrity: Window %p has been realized " "now remote and framebuffer data are synchronized.\n", (void*) pWin); #endif } if (image) { XDestroyImage(image); } SAFE_free(data); } else { #ifdef WARNING fprintf(stderr, "nxagentCheckWindowIntegrity: ignored window %p with geometry (%d,%d).\n", (void*) pWin, width, height); #endif } return integrity; } #endif /* TEST */ Bool nxagentIsIconic(WindowPtr pWin) { int iReturn; unsigned long ulReturnItems; unsigned long ulReturnBytesLeft; Atom atomReturnType; int iReturnFormat; unsigned char *pszReturnData = NULL; if (!wUserProps (pWin)) { return 0; } iReturn = GetWindowProperty(pWin, MakeAtom("WM_STATE", 8, False), 0, sizeof(CARD32), False, AnyPropertyType, &atomReturnType, &iReturnFormat, &ulReturnItems, &ulReturnBytesLeft, &pszReturnData); if (iReturn == Success) { return (((CARD32 *)pszReturnData)[0] == IconicState); } else { return 0; } } /* pass Eventmask to the real X server (for the rootless toplevel window only) */ void nxagentSetTopLevelEventMask(WindowPtr pWin) { if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin)) { XSetWindowAttributes attributes = {.event_mask = nxagentGetEventMask(pWin)}; XChangeWindowAttributes(nxagentDisplay, nxagentWindow(pWin), CWEventMask, &attributes); } } /* * Run nxagentConfigureWindow() on all windows in * nxagentConfiguredWindowList and move them from the list * afterwards. The list will be empty then. * * This is also taking care of entries in nxagentExposeQueue that need * to be synchronized with the real X server. */ void nxagentFlushConfigureWindow(void) { ConfiguredWindowStruct *index = nxagentConfiguredWindowList; while (index) { if (index -> next == NULL) { break; } index = index -> next; } while (index) { WindowPtr pWin = index -> pWin; unsigned int valuemask = index -> valuemask; if (pWin && valuemask) { nxagentConfigureWindow(pWin, valuemask); } if (index == nxagentConfiguredWindowList) { SAFE_free(index); break; } else { ConfiguredWindowStruct *tmp = index; index = index -> prev; SAFE_free(tmp); } } nxagentConfiguredWindowList = NULL; for (int j = 0; j < nxagentExposeQueue.length; j++) { int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE; if (nxagentExposeQueue.exposures[i].synchronize == 1) { XWindowChanges changes = { .x = nxagentExposeQueue.exposures[i].serial, .y = -2 }; #ifdef DEBUG fprintf(stderr, "nxagentFlushConfigureWindow: Sending synch ConfigureWindow for " "index [%d] serial [%d].\n", i, nxagentExposeQueue.exposures[i].serial); #endif XConfigureWindow(nxagentDisplay, nxagentConfiguredSynchroWindow, CWX | CWY, &changes); nxagentExposeQueue.exposures[i].synchronize = 0; } } nxagentSendDeferredBackgroundExposures(); return; } /* * from "Definition of the Porting Layer for X v11 Sample Server": * * If this routine is not NULL, DIX calls it shortly after calling * ValidateTree, passing it the same arguments. This is useful for * managing multi-layered framebuffers. The sample server sets this to * NULL. */ void nxagentPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind) { /* FIXME: Do we need this here? nxagentFlushConfigureWindow(); */ return; } /* * Add the given window to the beginning of * nxagentconfiguredWindowList. This list collects all windows that * need to be reconfigured on the real X server. valuemask defines * what changes need to be done. The required values (like position, * size, ...) are already stored in pWin). * * Note that we just add the window to the list here. The actual work * will be done by nxagentFlushConfigureWindow() later. */ void nxagentAddConfiguredWindow(WindowPtr pWin, unsigned int valuemask) { unsigned int mask; mask = valuemask & (CWSibling | CWX | CWY | CWWidth | CWHeight | CWBorderWidth | CWStackMode | CW_Map | CW_Update | CW_Shape); valuemask &= ~(CWSibling | CWX | CWY | CWWidth | CWHeight | CWBorderWidth | CWStackMode); if (mask & CWX && nxagentWindowPriv(pWin)->x != pWin->origin.x - wBorderWidth(pWin)) { valuemask |= CWX; } if (mask & CWY && nxagentWindowPriv(pWin)->y != pWin->origin.y - wBorderWidth(pWin)) { valuemask |= CWY; } if (mask & CWWidth && nxagentWindowPriv(pWin)->width != pWin->drawable.width) { valuemask |= CWWidth; } if (mask & CWHeight && nxagentWindowPriv(pWin)->height != pWin->drawable.height) { valuemask |= CWHeight; } if (mask & CWBorderWidth && nxagentWindowPriv(pWin)->borderWidth != pWin->borderWidth) { valuemask |= CWBorderWidth; } if (mask & CWStackMode && nxagentWindowPriv(pWin)->siblingAbove != nxagentWindowSiblingAbove(pWin)) { valuemask |= CWStackMode; } { ConfiguredWindowStruct *tmp = nxagentConfiguredWindowList; nxagentConfiguredWindowList = malloc(sizeof(ConfiguredWindowStruct)); nxagentConfiguredWindowList -> next = tmp; /* can be NULL */ nxagentConfiguredWindowList -> prev = NULL; nxagentConfiguredWindowList -> pWin = pWin; nxagentConfiguredWindowList -> valuemask = valuemask; if (tmp) { tmp -> prev = nxagentConfiguredWindowList; } } return; } /* * remove pWin from nxgentConfigureWindowList * * This is just updating the linked list and freeing the * given entry. It will not perform any X stuff */ void nxagentDeleteConfiguredWindow(WindowPtr pWin) { ConfiguredWindowStruct *index, *previous, *tmp; index = nxagentConfiguredWindowList; while (index) { WindowPtr pDel = index -> pWin; if (pDel == pWin) { if (index -> prev == NULL && index -> next == NULL) { SAFE_free(nxagentConfiguredWindowList); return; } else if (index -> prev == NULL) { tmp = nxagentConfiguredWindowList; index = nxagentConfiguredWindowList = tmp -> next; SAFE_free(tmp); nxagentConfiguredWindowList -> prev = NULL; continue; } else if (index -> next == NULL) { tmp = index; index = index -> prev; SAFE_free(tmp); index -> next = NULL; return; } previous = index -> prev; tmp = index; index = index -> next; previous -> next = index; index -> prev = previous; SAFE_free(tmp); continue; } index = index -> next; } return; } void nxagentAddStaticResizedWindow(WindowPtr pWin, unsigned long sequence, int offX, int offY) { StaticResizedWindowStruct *tmp = nxagentStaticResizedWindowList; nxagentStaticResizedWindowList = malloc(sizeof(StaticResizedWindowStruct)); nxagentStaticResizedWindowList -> next = tmp; nxagentStaticResizedWindowList -> prev = NULL; if (tmp) { tmp -> prev = nxagentStaticResizedWindowList; } nxagentStaticResizedWindowList -> pWin = pWin; nxagentStaticResizedWindowList -> sequence = sequence; nxagentStaticResizedWindowList -> offX = offX; nxagentStaticResizedWindowList -> offY = offY; } void nxagentDeleteStaticResizedWindow(unsigned long sequence) { StaticResizedWindowStruct *index, *previous, *tmp; index = nxagentStaticResizedWindowList; while (index) { if (index -> sequence <= sequence) { if (index -> prev == NULL && index -> next == NULL) { SAFE_free(nxagentStaticResizedWindowList); return; } else if (index -> prev == NULL) { tmp = nxagentStaticResizedWindowList; index = nxagentStaticResizedWindowList = tmp -> next; SAFE_free(tmp); nxagentStaticResizedWindowList -> prev = NULL; continue; } else if (index -> next == NULL) { tmp = index; index = index -> prev; SAFE_free(tmp); index -> next = NULL; return; } previous = index -> prev; tmp = index; index = index -> next; previous -> next = index; index -> prev = previous; SAFE_free(tmp); continue; } index = index -> next; } return; } StaticResizedWindowStruct *nxagentFindStaticResizedWindow(unsigned long sequence) { StaticResizedWindowStruct *index; StaticResizedWindowStruct *ret = NULL; if (nxagentStaticResizedWindowList == NULL) { return NULL; } index = nxagentStaticResizedWindowList; while (index && index -> sequence > sequence) { ret = index; index = index -> next; } return ret; } void nxagentEmptyBackingStoreRegion(void * param0, XID param1, void * data_buffer) { WindowPtr pWin = (WindowPtr) param0; miBSWindowPtr pBackingStore = (miBSWindowPtr)pWin->backStorage; if (pBackingStore != NULL) { RegionEmpty(&pBackingStore->SavedRegion); #ifdef TEST fprintf(stderr, "nxagentEmptyBackingStoreRegion: Emptying saved region for window at [%p].\n", (void*) pWin); #endif if (pBackingStore -> pBackingPixmap != NULL) { #ifdef TEST fprintf(stderr, "nxagentEmptyBackingStoreRegion: Emptying corrupted region for drawable at [%p].\n", (void*) pBackingStore -> pBackingPixmap); #endif nxagentUnmarkCorruptedRegion((DrawablePtr) pBackingStore -> pBackingPixmap, NullRegion); } } } void nxagentEmptyAllBackingStoreRegions(void) { if (nxagentLoopOverWindows(nxagentEmptyBackingStoreRegion) == 0) { #ifdef WARNING fprintf(stderr, "nxagentEmptyAllSavedRegions: Failed to empty backing store saved regions.\n"); #endif } } void nxagentInitBSPixmapList(void) { memset(nxagentBSPixmapList, 0, BSPIXMAPLIMIT * sizeof( StoringPixmapPtr)); } int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pWin, int bsx, int bsy) { for (int i = 0; i < BSPIXMAPLIMIT; i++) { if (nxagentBSPixmapList[i] == NULL) { nxagentBSPixmapList[i] = malloc(sizeof(StoringPixmapRec)); if (nxagentBSPixmapList[i] == NULL) { FatalError("nxagentAddItemBSPixmapList: Failed to allocate memory for nxagentBSPixmapList.\n"); } nxagentBSPixmapList[i] -> storingPixmapId = id; nxagentBSPixmapList[i] -> pStoringPixmap = pPixmap; nxagentBSPixmapList[i] -> pSavedWindow = pWin; nxagentBSPixmapList[i] -> backingStoreX = bsx; nxagentBSPixmapList[i] -> backingStoreY = bsy; #ifdef TEST fprintf(stderr, "nxagentAddItemBSPixmapList: Added Pixmap with id [%lu] to nxagentBSPixmapList.\n", id); #endif return 1; } if (nxagentBSPixmapList[i] -> storingPixmapId == id) { nxagentBSPixmapList[i] -> pStoringPixmap = pPixmap; nxagentBSPixmapList[i] -> pSavedWindow = pWin; nxagentBSPixmapList[i] -> backingStoreX = bsx; nxagentBSPixmapList[i] -> backingStoreY = bsy; #ifdef TEST fprintf(stderr, "nxagentAddItemBSPixmapList: Updated existing item for id [%lu].\n", id); #endif return 1; } } #ifdef TEST fprintf(stderr, "nxagentAddItemBSPixmapList: WARNING! List item full.\n"); #endif return 0; } int nxagentRemoveItemBSPixmapList(unsigned long pixmapId) { if (pixmapId == 0 || nxagentBSPixmapList[0] == NULL) { return 0; } for (int i = 0; i < BSPIXMAPLIMIT; i++) { if ((nxagentBSPixmapList[i] != NULL) && (nxagentBSPixmapList[i] -> storingPixmapId == pixmapId)) { SAFE_free(nxagentBSPixmapList[i]); if (i < BSPIXMAPLIMIT - 1) { int j; for (j = i; j < BSPIXMAPLIMIT -1; j++) { nxagentBSPixmapList[j] = nxagentBSPixmapList[j + 1]; } if (nxagentBSPixmapList[j] == nxagentBSPixmapList[j - 1]) { nxagentBSPixmapList[j] = NULL; } } #ifdef TEST fprintf(stderr, "nxagentRemoveItemBSPixmapList: Removed Pixmap with id [%lu] from list.\n", pixmapId); #endif return 1; } } #ifdef TEST fprintf(stderr, "nxagentRemoveItemBSPixmapList: WARNING! Can't remove item [%lu]: item not found.\n", pixmapId); #endif return 0; } int nxagentEmptyBSPixmapList(void) { for (int i = 0; i < BSPIXMAPLIMIT; i++) { SAFE_free(nxagentBSPixmapList[i]); } return 1; } StoringPixmapPtr nxagentFindItemBSPixmapList(unsigned long pixmapId) { for (int i = 0; i < BSPIXMAPLIMIT; i++) { if ((nxagentBSPixmapList[i] != NULL) && (nxagentBSPixmapList[i] -> storingPixmapId == pixmapId)) { #ifdef TEST fprintf(stderr, "%s: pixmapId [%lu].\n", __func__, pixmapId); fprintf(stderr, "%s: nxagentBSPixmapList[%d] = [%p].\n", __func__, i, (void *) nxagentBSPixmapList[i]); fprintf(stderr, "%s: nxagentBSPixmapList[%d] -> storingPixmapId [%lu].\n", __func__, i, nxagentBSPixmapList[i] -> storingPixmapId); #endif return nxagentBSPixmapList[i]; } } #ifdef WARNING fprintf(stderr, "%s: WARNING! Item not found.\n", __func__); #endif #ifdef TEST fprintf(stderr, "%s: Pixmap with id [%lu] not found.\n", __func__, pixmapId); #endif return NULL; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/Windows.h0000644000000000000000000002126313614532331020464 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #ifndef __Window_H__ #define __Window_H__ #include "Options.h" #include "Rootless.h" #include "Pixmaps.h" #include "validate.h" typedef struct { Window window; int x; int y; unsigned int width; unsigned int height; unsigned int borderWidth; Window siblingAbove; int backingStore; #ifdef SHAPE RegionPtr boundingShape; RegionPtr clipShape; #endif /* SHAPE */ void *pPicture; /* * Set if the window is mapped * on the remote server. */ int isMapped; /* * Set if the window on the remote * server is redirected by using * the composite extension. */ int isRedirected; int visibilityState; RegionPtr corruptedRegion; int hasTransparentChildren; int containGlyphs; int deferredBackgroundExpose; XID corruptedId; PixmapPtr synchronizationBitmap; Time corruptedTimestamp; SplitResourcePtr splitResource; } nxagentPrivWindowRec; typedef nxagentPrivWindowRec *nxagentPrivWindowPtr; typedef struct { unsigned long storingPixmapId; PixmapPtr pStoringPixmap; WindowPtr pSavedWindow; int backingStoreX; int backingStoreY; } StoringPixmapRec; typedef StoringPixmapRec *StoringPixmapPtr; int nxagentAddItemBSPixmapList(unsigned long, PixmapPtr, WindowPtr, int, int); int nxagentRemoveItemBSPixmapList(unsigned long); void nxagentInitBSPixmapList(void); int nxagentEmptyBSPixmapList(void); StoringPixmapPtr nxagentFindItemBSPixmapList (unsigned long); extern int nxagentWindowPrivateIndex; #define nxagentWindowPriv(pWin) \ ((nxagentPrivWindowPtr)((pWin)->devPrivates[nxagentWindowPrivateIndex].ptr)) #define nxagentWindow(pWin) (nxagentWindowPriv(pWin)->window) /* * Window is either a child of our root * or a child of the root of the real X * server. */ #define nxagentWindowParent(pWin) \ (nxagentOption(Rootless) ? \ nxagentRootlessWindowParent(pWin) : \ ((pWin)->parent ? \ nxagentWindow((pWin)->parent) : \ nxagentDefaultWindows[pWin->drawable.pScreen->myNum])) /* * True if this is a top level window. */ #define nxagentWindowTopLevel(pWin) \ (pWin && (pWin -> parent == NULL || \ pWin->parent == nxagentRootlessWindow)) #define nxagentWindowSiblingAbove(pWin) \ ((pWin)->prevSib ? nxagentWindow((pWin)->prevSib) : None) #define nxagentWindowSiblingBelow(pWin) \ ((pWin)->nextSib ? nxagentWindow((pWin)->nextSib) : None) #define nxagentWindowCorruptedRegion(pWin) \ (nxagentWindowPriv(pWin) -> corruptedRegion) #define nxagentWindowContainGlyphs(pWin) \ (nxagentWindowPriv(pWin) -> containGlyphs) #define nxagentWindowTimestamp(pWin) \ (nxagentWindowPriv(pWin) -> corruptedTimestamp) #define nxagentWindowIsVisible(pWin) \ ((pWin) -> viewable == 1 && \ (pWin) -> drawable.class != InputOnly && \ (pWin) -> visibility != VisibilityFullyObscured) #define nxagentDefaultWindowIsVisible() \ (nxagentVisibility != VisibilityFullyObscured) #define CW_Map (1 << 15) #define CW_Update (1 << 16) #define CW_Shape (1 << 17) #define CW_RootlessRestack (1 << 18) /* * This force the agent to send exposures * for all windows. */ #define nxagentRefreshScreen() \ do\ {\ nxagentRefreshWindows(screenInfo.screens[0]->root);\ } while (0) WindowPtr nxagentWindowPtr(Window window); #ifdef XlibAtom extern XlibAtom serverTransToAgentProperty; #endif /* * If the rectangles in an exposed region exceed * the number of 4, we let the function decide if * it is better to send the window extents rather * than the rectangles in the region. */ int nxagentExtentsPredicate(int total); /* * Agent's nested window procedures. Look also * at Rootless.h for the rootless counterparts. */ Bool nxagentCreateWindow(WindowPtr pWin); Bool nxagentDestroyWindow(WindowPtr pWin); Bool nxagentPositionWindow(WindowPtr pWin, int x, int y); Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask); Bool nxagentRealizeWindow(WindowPtr pWin); Bool nxagentUnrealizeWindow(WindowPtr pWin); Bool nxagentCheckIllegalRootMonitoring(WindowPtr pWin, Mask mask); void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed); void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what); void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what); void nxagentCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion); void nxagentClipNotify(WindowPtr pWin, int dx, int dy); void nxagentRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib); void nxagentReparentWindow(WindowPtr pWin, WindowPtr pOldParent); void nxagentRefreshWindows(WindowPtr pWin); void nxagentSetTopLevelEventMask(WindowPtr pWin); void nxagentSwitchFullscreen(ScreenPtr pScreen, Bool switchOn); void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn); void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift); #ifdef VIEWPORT_FRAME void nxagentUpdateViewportFrame(int x, int y, int w, int h); #else /* #ifdef VIEWPORT_FRAME */ #define nxagentUpdateViewportFrame(x, y, w, h) #endif /* #ifdef VIEWPORT_FRAME */ void nxagentUnmapWindows(void); void nxagentMapDefaultWindows(void); Bool nxagentSetWindowCursors(void *p0); /* * The ConfigureWindow procedure has not * a pointer in the screen structure. */ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask); /* * Used to track nxagent window's visibility. */ extern int nxagentVisibility; extern unsigned long nxagentVisibilityTimeout; extern Bool nxagentVisibilityStop; /* * Return the pointer to the window given the * remote id. It tries to match the id from * the last matched window before iterating * through the hierarchy. */ WindowPtr nxagentGetWindowFromID(Window id); /* * Handle the shape bitmap for windows. */ #ifdef SHAPE void nxagentShapeWindow(WindowPtr pWin); #endif extern Window nxagentConfiguredSynchroWindow; extern Bool nxagentExposeArrayIsInitialized; typedef struct _ConfiguredWindow { WindowPtr pWin; struct _ConfiguredWindow *next; struct _ConfiguredWindow *prev; unsigned int valuemask; } ConfiguredWindowStruct; ConfiguredWindowStruct *nxagentConfiguredWindowList; typedef struct _StaticResizedWindow { WindowPtr pWin; struct _StaticResizedWindow *next; struct _StaticResizedWindow *prev; unsigned long sequence; int offX; int offY; } StaticResizedWindowStruct; StaticResizedWindowStruct *nxagentStaticResizedWindowList; void nxagentPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind); void nxagentFlushConfigureWindow(void); void nxagentAddConfiguredWindow(WindowPtr pWin, unsigned int valuemask); void nxagentDeleteConfiguredWindow(WindowPtr pWin); void nxagentAddStaticResizedWindow(WindowPtr pWin, unsigned long sequence, int offX, int offY); void nxagentDeleteStaticResizedWindow(unsigned long sequence); StaticResizedWindowStruct *nxagentFindStaticResizedWindow(unsigned long sequence); void nxagentEmptyAllBackingStoreRegions(void); #endif /* __Window_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/X11/include/Xcomposite_nxagent.h0000644000000000000000000001033213614532331024677 0ustar /* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /* * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* * This file is a reduced version of the header file of * * * This copy of code has been introduced to allow a clear namespace * separation between and header files. * * This version of the Xcomposite library header file only contains symbols * required by nxagent and strictly avoids indirectly including * from an X11 library that is also shipped in nx-X11/lib/. * * When using instead for inclusion in * nxagent, it will attempt pulling in the . * However, the headers of the same name from should be * used instead. * * FIXME: Once the nxagent Xserver starts using libX11 from X.Org, this * hack can be removed. * * 2016/04/07, Mike Gabriel */ #ifndef _XCOMPOSITE_H_ #define _XCOMPOSITE_H_ #include #include /* * This revision number also appears in configure.ac, they have * to be manually synchronized */ #define XCOMPOSITE_MAJOR COMPOSITE_MAJOR #define XCOMPOSITE_MINOR COMPOSITE_MINOR #define XCOMPOSITE_REVISION 2 #define XCOMPOSITE_VERSION ((XCOMPOSITE_MAJOR * 10000) + (XCOMPOSITE_MINOR * 100) + (XCOMPOSITE_REVISION)) _XFUNCPROTOBEGIN Bool XCompositeQueryExtension (Display *dpy, int *event_base_return, int *error_base_return); Status XCompositeQueryVersion (Display *dpy, int *major_version_return, int *minor_version_return); void XCompositeRedirectWindow (Display *dpy, Window window, int update); void XCompositeRedirectSubwindows (Display *dpy, Window window, int update); void XCompositeUnredirectWindow (Display *dpy, Window window, int update); void XCompositeUnredirectSubwindows (Display *dpy, Window window, int update); _XFUNCPROTOEND #endif /* _XCOMPOSITE_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/X11/include/Xfixes_nxagent.h0000644000000000000000000000717413614532331024025 0ustar /* * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /* * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* * This file is a reduced version of the header file of * * * This copy of code has been introduced to allow a clear namespace * separation between and header files. * * This version of the Xfixes library header file only contains symbols * required by nxagent and strictly avoids indirectly including * from an X11 library that is also shipped in nx-X11/lib/. * * When using instead for inclusion in * nxagent, it will attempt pulling in the . * However, the headers of the same name from should be * used instead. * * FIXME: Once the nxagent Xserver starts using libX11 from X.Org, this * hack can be removed. * * 2015/12/28, Mike Gabriel */ #ifndef _XFIXES_H_ #define _XFIXES_H_ typedef struct { int type; /* event base */ unsigned long serial; Bool send_event; Display *display; Window window; int subtype; Window owner; Atom selection; Time timestamp; Time selection_timestamp; } XFixesSelectionNotifyEvent; void XFixesSelectSelectionInput (Display *dpy, Window win, Atom selection, unsigned long eventMask); #endif /* _XFIXES_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/X11/include/Xinerama_nxagent.h0000644000000000000000000000365713614532331024325 0ustar /* Copyright 2003 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef _Xinerama_h #define _Xinerama_h #include typedef struct { int screen_number; short x_org; short y_org; short width; short height; } XineramaScreenInfo; _XFUNCPROTOBEGIN Bool XineramaQueryExtension ( Display *dpy, int *event_base, int *error_base ); Status XineramaQueryVersion( Display *dpy, int *major_versionp, int *minor_versionp ); Bool XineramaIsActive(Display *dpy); /* Returns the number of heads and a pointer to an array of structures describing the position and size of the individual heads. Returns NULL and number = 0 if Xinerama is not active. Returned array should be freed with XFree(). */ XineramaScreenInfo * XineramaQueryScreens( Display *dpy, int *number ); _XFUNCPROTOEND #endif /* _Xinerama_h */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/X11/include/xpm_nxagent.h0000644000000000000000000002237513614532331023363 0ustar /* * Copyright (C) 1989-95 GROUPE BULL * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of GROUPE BULL shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from GROUPE BULL. */ /*****************************************************************************\ * xpm.h: * * * * XPM library * * Include file * * * * Developed by Arnaud Le Hors * \*****************************************************************************/ /* * This file is a reduced version of the header file of * * * This copy of code has been introduced to allow a clear namespace * separation between and header files. * * This version of the Xpm library header file only contains symbols * required by nxagent and strictly avoids indirectly including * from an X11 library that is also shipped in nx-X11/lib/. * * When using instead for inclusion in nxagent, it will * attempt pulling in the header file. * However, the headers of the same name from should be * used instead. * * FIXME: Once the nxagent Xserver starts using libX11 from X.Org, this * hack can be removed. * * 2015/06/26, Mike Gabriel */ #ifndef XPM_h #define XPM_h /* * first some identification numbers: * the version and revision numbers are determined with the following rule: * SO Major number = LIB minor version number. * SO Minor number = LIB sub-minor version number. * e.g: Xpm version 3.2f * we forget the 3 which is the format number, 2 gives 2, and f gives 6. * thus we have XpmVersion = 2 and XpmRevision = 6 * which gives SOXPMLIBREV = 2.6 * * Then the XpmIncludeVersion number is built from these numbers. */ #define XpmFormat 3 #define XpmVersion 4 #define XpmRevision 11 #define XpmIncludeVersion ((XpmFormat * 100 + XpmVersion) * 100 + XpmRevision) #ifndef XPM_NUMBERS /* let's define Pixel if it is not done yet */ #if ! defined(_XtIntrinsic_h) && ! defined(PIXEL_ALREADY_TYPEDEFED) typedef unsigned long Pixel; /* Index into colormap */ # define PIXEL_ALREADY_TYPEDEFED #endif /* include headers from instead of */ #include #include /* Return ErrorStatus codes: * null if full success * positive if partial success * negative if failure */ #define XpmColorError 1 #define XpmSuccess 0 #define XpmOpenFailed -1 #define XpmFileInvalid -2 #define XpmNoMemory -3 #define XpmColorFailed -4 typedef struct { char *name; /* Symbolic color name */ char *value; /* Color value */ Pixel pixel; /* Color pixel */ } XpmColorSymbol; typedef struct { char *name; /* name of the extension */ unsigned int nlines; /* number of lines in this extension */ char **lines; /* pointer to the extension array of strings */ } XpmExtension; typedef struct { char *string; /* characters string */ char *symbolic; /* symbolic name */ char *m_color; /* monochrom default */ char *g4_color; /* 4 level grayscale default */ char *g_color; /* other level grayscale default */ char *c_color; /* color default */ } XpmColor; typedef struct { unsigned int width; /* image width */ unsigned int height; /* image height */ unsigned int cpp; /* number of characters per pixel */ unsigned int ncolors; /* number of colors */ XpmColor *colorTable; /* list of related colors */ unsigned int *data; /* image data */ } XpmImage; typedef struct { unsigned long valuemask; /* Specifies which attributes are defined */ char *hints_cmt; /* Comment of the hints section */ char *colors_cmt; /* Comment of the colors section */ char *pixels_cmt; /* Comment of the pixels section */ unsigned int x_hotspot; /* Returns the x hotspot's coordinate */ unsigned int y_hotspot; /* Returns the y hotspot's coordinate */ unsigned int nextensions; /* number of extensions */ XpmExtension *extensions; /* pointer to array of extensions */ } XpmInfo; typedef int (*XpmAllocColorFunc)( Display* /* display */, Colormap /* colormap */, char* /* colorname */, XColor* /* xcolor */, void* /* closure */ ); typedef int (*XpmFreeColorsFunc)( Display* /* display */, Colormap /* colormap */, Pixel* /* pixels */, int /* npixels */, void* /* closure */ ); /* required struct for hw/nxagent/Holder.c */ typedef struct { unsigned long valuemask; /* Specifies which attributes are defined */ Visual *visual; /* Specifies the visual to use */ Colormap colormap; /* Specifies the colormap to use */ unsigned int depth; /* Specifies the depth */ unsigned int width; /* Returns the width of the created pixmap */ unsigned int height; /* Returns the height of the created pixmap */ unsigned int x_hotspot; /* Returns the x hotspot's coordinate */ unsigned int y_hotspot; /* Returns the y hotspot's coordinate */ unsigned int cpp; /* Specifies the number of char per pixel */ Pixel *pixels; /* List of used color pixels */ unsigned int npixels; /* Number of used pixels */ XpmColorSymbol *colorsymbols; /* List of color symbols to override */ unsigned int numsymbols; /* Number of symbols */ char *rgb_fname; /* RGB text file name */ unsigned int nextensions; /* Number of extensions */ XpmExtension *extensions; /* List of extensions */ unsigned int ncolors; /* Number of colors */ XpmColor *colorTable; /* List of colors */ /* 3.2 backward compatibility code */ char *hints_cmt; /* Comment of the hints section */ char *colors_cmt; /* Comment of the colors section */ char *pixels_cmt; /* Comment of the pixels section */ /* end 3.2 bc */ unsigned int mask_pixel; /* Color table index of transparent color */ /* Color Allocation Directives */ Bool exactColors; /* Only use exact colors for visual */ unsigned int closeness; /* Allowable RGB deviation */ unsigned int red_closeness; /* Allowable red deviation */ unsigned int green_closeness; /* Allowable green deviation */ unsigned int blue_closeness; /* Allowable blue deviation */ int color_key; /* Use colors from this color set */ Pixel *alloc_pixels; /* Returns the list of alloc'ed color pixels */ int nalloc_pixels; /* Returns the number of alloc'ed color pixels */ Bool alloc_close_colors; /* Specify whether close colors should be allocated using XAllocColor or not */ int bitmap_format; /* Specify the format of 1bit depth images: ZPixmap or XYBitmap */ /* Color functions */ XpmAllocColorFunc alloc_color; /* Application color allocator */ XpmFreeColorsFunc free_colors; /* Application color de-allocator */ void *color_closure; /* Application private data to pass to alloc_color and free_colors */ } XpmAttributes; /* XpmAttributes value masks bits */ /* required masks bits for hw/nxagent/Holder.c */ #define XpmDepth (1L<<2) #define XpmSize (1L<<3) /* width & height */ /* macros for forward declarations of functions with prototypes */ #define FUNC(f, t, p) extern t f p #define LFUNC(f, t, p) static t f p /* * functions declarations (for building nxagent against system wide libXpm4, * but also against libNX_X11 (as opposed to system-wide libX11). */ _XFUNCPROTOBEGIN /* Keep for hw/nxagent/Display.c */ FUNC(XpmCreatePixmapFromData, int, (Display *display, Drawable d, char **data, Pixmap *pixmap_return, Pixmap *shapemask_return, XpmAttributes *attributes)); _XFUNCPROTOEND #endif /* XPM_NUMBERS */ #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/X11/include/Xrandr_nxagent.h0000644000000000000000000000625213614532331024011 0ustar /* * Copyright © 2000 Compaq Computer Corporation, Inc. * Copyright © 2002 Hewlett-Packard Company, Inc. * Copyright © 2006 Intel Corporation * Copyright © 2008 Red Hat, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc. * Keith Packard, Intel Corporation */ /* * This file is a reduced version of the header file of * * * This copy of code has been introduced to allow a clear namespace * separation between and header files. * * This version of the Xrandr library header file only contains symbols * required by nxagent and strictly avoids indirectly including * from an X11 library that is also shipped in nx-X11/lib/. * * When using instead for inclusion in * nxagent, it will attempt pulling in the * header which in turn will include . However, the headers of * the same name from should be used instead. * * FIXME: Once the nxagent Xserver starts using libXrender from X.Org, this * hack can be removed. * * 2015/06/26, Mike Gabriel */ #ifndef _XRANDR_H_ #define _XRANDR_H_ #include #include _XFUNCPROTOBEGIN /* * Events. */ typedef struct { int type; /* event base */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* window which selected for this event */ Window root; /* Root window for changed screen */ Time timestamp; /* when the screen change occurred */ Time config_timestamp; /* when the last configuration change */ SizeID size_index; SubpixelOrder subpixel_order; Rotation rotation; int width; int height; int mwidth; int mheight; } XRRScreenChangeNotifyEvent; _XFUNCPROTOEND #endif /* _XRANDR_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/X11/include/Xrenderint_nxagent.h0000644000000000000000000000644713614532331024703 0ustar /* * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifndef _XRENDERINT_H_ #define _XRENDERINT_H_ #include #include #include #include "Xrender_nxagent.h" typedef struct { Visual *visual; XRenderPictFormat *format; } XRenderVisual; typedef struct { int depth; int nvisuals; XRenderVisual *visuals; } XRenderDepth; typedef struct { XRenderDepth *depths; int ndepths; XRenderPictFormat *fallback; int subpixel; } XRenderScreen; typedef struct _XRenderInfo { int major_version; int minor_version; XRenderPictFormat *format; int nformat; XRenderScreen *screen; int nscreen; XRenderDepth *depth; int ndepth; XRenderVisual *visual; int nvisual; int *subpixel; int nsubpixel; char **filter; int nfilter; short *filter_alias; int nfilter_alias; } XRenderInfo; /* replaces XRenderExtDisplayInfo */ typedef struct _XRenderExtDisplayInfo { struct _XRenderExtDisplayInfo *next; /* keep a linked list */ Display *display; /* which display this is */ XExtCodes *codes; /* the extension protocol codes */ XRenderInfo *info; /* extra data for the extension to use */ } XRenderExtDisplayInfo; /* replaces XExtensionInfo */ typedef struct _XRenderExtInfo { XRenderExtDisplayInfo *head; /* start of the list */ XRenderExtDisplayInfo *cur; /* most recently used */ int ndisplays; /* number of displays */ } XRenderExtInfo; extern XRenderExtInfo XRenderExtensionInfo; extern char XRenderExtensionName[]; XRenderExtDisplayInfo * XRenderFindDisplay (Display *dpy); #define RenderHasExtension(i) ((i) && ((i)->codes)) #define RenderCheckExtension(dpy,i,val) \ if (!RenderHasExtension(i)) { return val; } #define RenderSimpleCheckExtension(dpy,i) \ if (!RenderHasExtension(i)) { return; } /* * Xlib uses long for 32-bit values. Xrender uses int. This * matters on alpha. Note that this macro assumes that int is 32 bits. */ #define DataInt32(dpy,d,len) Data(dpy,(char *) (d),len) #endif /* _XRENDERINT_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/X11/include/Xrender_nxagent.h0000644000000000000000000003102413614532331024155 0ustar /* * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifndef _XRENDER_H_ #define _XRENDER_H_ #include #include #include #include #include typedef struct { short red; short redMask; short green; short greenMask; short blue; short blueMask; short alpha; short alphaMask; } XRenderDirectFormat; typedef struct { PictFormat id; int type; int depth; XRenderDirectFormat direct; Colormap colormap; } XRenderPictFormat; #define PictFormatID (1 << 0) #define PictFormatType (1 << 1) #define PictFormatDepth (1 << 2) #define PictFormatRed (1 << 3) #define PictFormatRedMask (1 << 4) #define PictFormatGreen (1 << 5) #define PictFormatGreenMask (1 << 6) #define PictFormatBlue (1 << 7) #define PictFormatBlueMask (1 << 8) #define PictFormatAlpha (1 << 9) #define PictFormatAlphaMask (1 << 10) #define PictFormatColormap (1 << 11) typedef struct _XRenderPictureAttributes { int repeat; Picture alpha_map; int alpha_x_origin; int alpha_y_origin; int clip_x_origin; int clip_y_origin; Pixmap clip_mask; Bool graphics_exposures; int subwindow_mode; int poly_edge; int poly_mode; Atom dither; Bool component_alpha; } XRenderPictureAttributes; typedef struct { unsigned short red; unsigned short green; unsigned short blue; unsigned short alpha; } XRenderColor; typedef struct _XGlyphInfo { unsigned short width; unsigned short height; short x; short y; short xOff; short yOff; } XGlyphInfo; typedef struct _XGlyphElt8 { GlyphSet glyphset; _Xconst char *chars; int nchars; int xOff; int yOff; } XGlyphElt8; typedef struct _XGlyphElt16 { GlyphSet glyphset; _Xconst unsigned short *chars; int nchars; int xOff; int yOff; } XGlyphElt16; typedef struct _XGlyphElt32 { GlyphSet glyphset; _Xconst unsigned int *chars; int nchars; int xOff; int yOff; } XGlyphElt32; typedef double XDouble; typedef struct _XPointDouble { XDouble x, y; } XPointDouble; #define XDoubleToFixed(f) ((XFixed) ((f) * 65536)) #define XFixedToDouble(f) (((XDouble) (f)) / 65536) typedef int XFixed; typedef struct _XPointFixed { XFixed x, y; } XPointFixed; typedef struct _XLineFixed { XPointFixed p1, p2; } XLineFixed; typedef struct _XTriangle { XPointFixed p1, p2, p3; } XTriangle; typedef struct _XCircle { XFixed x; XFixed y; XFixed radius; } XCircle; typedef struct _XTrapezoid { XFixed top, bottom; XLineFixed left, right; } XTrapezoid; typedef struct _XTransform { XFixed matrix[3][3]; } XTransform; typedef struct _XFilters { int nfilter; char **filter; int nalias; short *alias; } XFilters; typedef struct _XIndexValue { unsigned long pixel; unsigned short red, green, blue, alpha; } XIndexValue; typedef struct _XAnimCursor { Cursor cursor; unsigned long delay; } XAnimCursor; typedef struct _XSpanFix { XFixed left, right, y; } XSpanFix; typedef struct _XTrap { XSpanFix top, bottom; } XTrap; typedef struct _XLinearGradient { XPointFixed p1; XPointFixed p2; } XLinearGradient; typedef struct _XRadialGradient { XCircle inner; XCircle outer; } XRadialGradient; typedef struct _XConicalGradient { XPointFixed center; XFixed angle; /* in degrees */ } XConicalGradient; _XFUNCPROTOBEGIN Bool XRenderQueryExtension (Display *dpy, int *event_basep, int *error_basep); Status XRenderQueryVersion (Display *dpy, int *major_versionp, int *minor_versionp); Status XRenderQueryFormats (Display *dpy); int XRenderQuerySubpixelOrder (Display *dpy, int screen); Bool XRenderSetSubpixelOrder (Display *dpy, int screen, int subpixel); XRenderPictFormat * XRenderFindVisualFormat (Display *dpy, _Xconst Visual *visual); XRenderPictFormat * XRenderFindFormat (Display *dpy, unsigned long mask, _Xconst XRenderPictFormat *templ, int count); #define PictStandardARGB32 0 #define PictStandardRGB24 1 #define PictStandardA8 2 #define PictStandardA4 3 #define PictStandardA1 4 #define PictStandardNUM 5 XRenderPictFormat * XRenderFindStandardFormat (Display *dpy, int format); XIndexValue * XRenderQueryPictIndexValues(Display *dpy, _Xconst XRenderPictFormat *format, int *num); Picture XRenderCreatePicture (Display *dpy, Drawable drawable, _Xconst XRenderPictFormat *format, unsigned long valuemask, _Xconst XRenderPictureAttributes *attributes); void XRenderChangePicture (Display *dpy, Picture picture, unsigned long valuemask, _Xconst XRenderPictureAttributes *attributes); void XRenderSetPictureClipRectangles (Display *dpy, Picture picture, int xOrigin, int yOrigin, _Xconst XRectangle *rects, int n); void XRenderSetPictureClipRegion (Display *dpy, Picture picture, Region r); void XRenderSetPictureTransform (Display *dpy, Picture picture, XTransform *transform); void XRenderFreePicture (Display *dpy, Picture picture); void XRenderComposite (Display *dpy, int op, Picture src, Picture mask, Picture dst, int src_x, int src_y, int mask_x, int mask_y, int dst_x, int dst_y, unsigned int width, unsigned int height); GlyphSet XRenderCreateGlyphSet (Display *dpy, _Xconst XRenderPictFormat *format); GlyphSet XRenderReferenceGlyphSet (Display *dpy, GlyphSet existing); void XRenderFreeGlyphSet (Display *dpy, GlyphSet glyphset); void XRenderAddGlyphs (Display *dpy, GlyphSet glyphset, _Xconst Glyph *gids, _Xconst XGlyphInfo *glyphs, int nglyphs, _Xconst char *images, int nbyte_images); void XRenderFreeGlyphs (Display *dpy, GlyphSet glyphset, _Xconst Glyph *gids, int nglyphs); void XRenderCompositeString8 (Display *dpy, int op, Picture src, Picture dst, _Xconst XRenderPictFormat *maskFormat, GlyphSet glyphset, int xSrc, int ySrc, int xDst, int yDst, _Xconst char *string, int nchar); void XRenderCompositeString16 (Display *dpy, int op, Picture src, Picture dst, _Xconst XRenderPictFormat *maskFormat, GlyphSet glyphset, int xSrc, int ySrc, int xDst, int yDst, _Xconst unsigned short *string, int nchar); void XRenderCompositeString32 (Display *dpy, int op, Picture src, Picture dst, _Xconst XRenderPictFormat *maskFormat, GlyphSet glyphset, int xSrc, int ySrc, int xDst, int yDst, _Xconst unsigned int *string, int nchar); void XRenderCompositeText8 (Display *dpy, int op, Picture src, Picture dst, _Xconst XRenderPictFormat *maskFormat, int xSrc, int ySrc, int xDst, int yDst, _Xconst XGlyphElt8 *elts, int nelt); void XRenderCompositeText16 (Display *dpy, int op, Picture src, Picture dst, _Xconst XRenderPictFormat *maskFormat, int xSrc, int ySrc, int xDst, int yDst, _Xconst XGlyphElt16 *elts, int nelt); void XRenderCompositeText32 (Display *dpy, int op, Picture src, Picture dst, _Xconst XRenderPictFormat *maskFormat, int xSrc, int ySrc, int xDst, int yDst, _Xconst XGlyphElt32 *elts, int nelt); void XRenderFillRectangle (Display *dpy, int op, Picture dst, _Xconst XRenderColor *color, int x, int y, unsigned int width, unsigned int height); void XRenderFillRectangles (Display *dpy, int op, Picture dst, _Xconst XRenderColor *color, _Xconst XRectangle *rectangles, int n_rects); void XRenderCompositeTrapezoids (Display *dpy, int op, Picture src, Picture dst, _Xconst XRenderPictFormat *maskFormat, int xSrc, int ySrc, _Xconst XTrapezoid *traps, int ntrap); void XRenderCompositeTriangles (Display *dpy, int op, Picture src, Picture dst, _Xconst XRenderPictFormat *maskFormat, int xSrc, int ySrc, _Xconst XTriangle *triangles, int ntriangle); void XRenderCompositeTriStrip (Display *dpy, int op, Picture src, Picture dst, _Xconst XRenderPictFormat *maskFormat, int xSrc, int ySrc, _Xconst XPointFixed *points, int npoint); void XRenderCompositeTriFan (Display *dpy, int op, Picture src, Picture dst, _Xconst XRenderPictFormat *maskFormat, int xSrc, int ySrc, _Xconst XPointFixed *points, int npoint); void XRenderCompositeDoublePoly (Display *dpy, int op, Picture src, Picture dst, _Xconst XRenderPictFormat *maskFormat, int xSrc, int ySrc, int xDst, int yDst, _Xconst XPointDouble *fpoints, int npoints, int winding); Status XRenderParseColor(Display *dpy, char *spec, XRenderColor *def); Cursor XRenderCreateCursor (Display *dpy, Picture source, unsigned int x, unsigned int y); XFilters * XRenderQueryFilters (Display *dpy, Drawable drawable); void XRenderSetPictureFilter (Display *dpy, Picture picture, const char *filter, XFixed *params, int nparams); Cursor XRenderCreateAnimCursor (Display *dpy, int ncursor, XAnimCursor *cursors); void XRenderAddTraps (Display *dpy, Picture picture, int xOff, int yOff, _Xconst XTrap *traps, int ntrap); Picture XRenderCreateSolidFill (Display *dpy, const XRenderColor *color); Picture XRenderCreateLinearGradient (Display *dpy, const XLinearGradient *gradient, const XFixed *stops, const XRenderColor *colors, int nstops); Picture XRenderCreateRadialGradient (Display *dpy, const XRadialGradient *gradient, const XFixed *stops, const XRenderColor *colors, int nstops); Picture XRenderCreateConicalGradient (Display *dpy, const XConicalGradient *gradient, const XFixed *stops, const XRenderColor *colors, int nstops); _XFUNCPROTOEND #endif /* _XRENDER_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/x11.svg0000644000000000000000000000214413614532331020010 0ustar nx-libs-3.5.99.23/nx-X11/programs/Xserver/hw/nxagent/x2goagent.xpm0000644000000000000000000004371513614532331021313 0ustar /* XPM */ static char *x2goagentIconData[]={ "128 128 18 1", ". c None", ": c #FFFFFF", "m c #323232", "l c #323232", "f c #323232", "e c #323232", "o c #323232", "# c #323232", "h c #323232", "i c #323232", "n c #323232", "d c #323232", "a c #323232", "g c #323232", "j c #323232", "b c #323232", "k c #323232", "c c #323232", ".....#abccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccbde.....", "...fbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccgf...", "..#ccccaheeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeijccckf..", ".ecccgl::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ejcckf.", ".bccd:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mdccg.", "#cca:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mjcce", "gckm::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::eccd", "ccn::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::jcb", "cce::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::icc", "ccm::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::meeee::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::eeeeeeeeoiiiiiiiinggggggggjccccccccccccc::::#ggggggggggggggggggggggggggggf:::::::::::::ggggggggggggggggggggggf::::ecc", "cc::::meeeeoiiiiiiiinggggggggjccccccccccccccccccccc::::icccccccccccccccccccccccccccce:::::::::::::cccccccccccccccccccccce::::ecc", "cc::::::::::::::::::::::::::::::::::::meeeeeeeeoiii::::icccccccccccccccccccccccccccce:::::::::::::cccccccccccccccccccccce::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::menbccccccccccccccccccbhe::::::::::::::::::logccccccccccccghe:::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::iccccccccccccccccdm:::::::::::::::::::::::#cccccccccke::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::lee:::::::::::#cccccccccccccckm:::::::::::::::::::::::::jccccccckm:::::::::::ecc", "cc::::::::feeeeeeeeoiiiiiiiiiaggggggggjcccccccccccc::::::::::::icccccccccccccd::::::::::::::::::::::::::icccccccf::::::::::::ecc", "cc::::meeeeeoiiiiiiiinggggggggjcccccccccccccccccccciiiiii#m:::::jcccccccccccci::::::::::::::::::::::::::icccccci:::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::eeeeeeeeeiiiiiiiiigl::::eccccccccccccd::::::::::::::::::::::::::dcccccj::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::dcccccccccccj::::::::::::::::::::::::::bccccce::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::lccccccccccccl::::::::::::::::::::::::lccccca:::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::meeeeeeee#iiiie::::dccccccccccch::::::::::::::::::::::::icccccl:::::::::::::::ecc", "cc:::::::::meeeeeeeeoiiiiiiiinggggggggjccccccccccccccccccccccb::::ecccccccccccb::::::::::::::::::::::::bccccn::::::::::::::::ecc", "cc::::meeeeiiiiiiiiiaggggggggbcccccccccccccccccccccccccccccccc#::::gccccccccccco::::::::::::::::::::::#cccckm::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::meeeeeeeeeiiiiiiiiiaggggd::::#cccccccccccg::::::::::::::::::::::bcccci:::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::bcccccccccccf::::::::::::::::::::#cccckm:::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::hcccccccccccd:::::::::::::::::::mkcccci::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::meeeeeeeeoiiiiiiiil:::mkcccccccccccl::::::::::::::::::icccckm::::::::::::::::::ecc", "cc:::::::::eeeeeeeeoiiiiiiiinggggggggjccccccccccccccccccccccccccn::::dccccccccccci:::::::::::::::::mkcccci:::::::::::::::::::ecc", "cc::::meeeeeiiiiiiiiiaggggggggbccccccccccccccccccccccccccccccccckm:::lccccccccccck:::::::::::::::::icccckm:::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::leeeeeeeeoiiiiiiiiigggggggo::::accccccccccc#:::::::::::::::mkcccch::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecccccccccccb:::::::::::::::iccccb:::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::jccccccccccce:::::::::::::mkcccc#:::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::meeeeeeeeehiiiiiiii#::::#ccccccccccca:::::::::::::nccccb::::::::::::::::::::::ecc", "cc::::::::feeeeeeee#iiiiiiiiigggggggggkccccccccccccccccccccccccccccl::::kcccccccccccl:::::::::::lccccc#::::::::::::::::::::::ecc", "cc::::meeeeeoiiiiiiiiigggggggggkcccccccccccccccccccccccccccccccccccd::::icccccccccccd:::::::::::dccccb:::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::leeeeeeeeoiiiiiiiingggggggga::::mccccccccccckm:::::::::lccccc#:::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::dccccccccccch:::::::::dccccb::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::lcccccccccccb::::::::lccccc#::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::meeeeeeeeoiiiiiiiingggo::::gccccccccccc#:::::::dccccg:::::::::::::::::::::::::ecc", "cc:::::::::meeeeeeeeoiiiiiiiinggggggggjccccccccccccccccccccccccccccccg::::occcccccccccg::::::lccccce:::::::::::::::::::::::::ecc", "cc::::meeeeiiiiiiiiiaggggggggbcccccccccccccccccccccccccccccccccccccccce::::bccccccccccce:::::gccccg::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::meeeeeeeeeiiiiiiiiigggggggggkcccd::::#cccccccccccd::::eccccce::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mkcccccccccccl:::gccccg:::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::nccccccccccci..eccccce:::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::meeeeeeeeoiiiiiiiingggggggm:::lccccccccccckm.gccccg::::::::::::::::::::::::::::ecc", "cc:::::::::eeeeeeeeoiiiiiiiinggggggggjcccccccccccccccccccccccccccccccccc#::::dccccccccccc#eccccce::::::::::::::::::::::::::::ecc", "cc::::meeeeeiiiiiiiiiaggggggggkcccccccccccccccccccccccccccccccccccccccccb::::ecccccccccccbgccccg:::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::leeeeeeeeoiiiiiiiiigggggggggkccccco::::gccccccccccccccccl:::::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#cccccccccccccccd::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::bccccccccccccccl::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::leeeeeeeeeiiiiiiiiiagggggggi::::icccccccccccccd:::::::::::::::::::::::::::::::ecc", "cc::::::::feeeeeeee#iiiiiiiingggggggggkccccccccccccccccccccccccccccccccccckm:::mkccccccccccccl:::::::::::::::::::::::::::::::ecc", "cc::::meeeeeoiiiiiiiiigggggggggkccccccccccccccccccccccccccccccccccccccccccci::::dccccccccccca::::::::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::leeeeeeeeoiiiiiiiiigggggggggccccccck::::lccccccccccckm:::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::accccccccccc#:::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecccccccccccb:::::::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::leeeeeeeeeiiiiiiiiiaggggggggbcce::::bccccccccccce::::::::::::::::::::::::::::::ecc", "cc:::::::feeeeeeee#iiiiiiiiigggggggggkcccccccccccccccccccccccccccccccccccccccd::::#cccccccccccg::::::::::::::::::::::::::::::ecc", "cc::::meeeeeeoiiiiiiiingggggggggccccccccccccccccccccccccccccccccccccccccccccccl::::kcccccccccccl:::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::feeeeeeeehiiiiiiiidggggggggbccccccccci::::ncccccccccccd:::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mm::::bccccccccccccm::::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#ccccccccccccci::::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::leeeeeeee#iiiiiiiidggggggggbcccccl::::bccccccccccccck::::::::::::::::::::::::::::ecc", "cc::::::feeeeeeeehiiiiiiiiaggggggggkccccccccccccccccccccccccccccccccccccccccd::::#ccccccccccccccc#:::::::::::::::::::::::::::ecc", "cc::::meeeeeee#iiiiiiiidggggggggjcccccccccccccccccccccccccccccccccccccccccccl::::bcccccccccccccccb:::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::meeeeeeeeeiiiiiiiiigggggggggkcccccd::::#cccccbccccccccccce::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::bccccdhcccccccccccg::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#ccccclmkcccccccccccl:::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::meeeeeeeeeiiiiiiiiiaggggggggbkm::::bccccd..ncccccccccccd:::::::::::::::::::::::::ecc", "cc:::::leeeeeeeeoiiiiiiiiigggggggggkccccccccccccccccccccccccccccccccccccci::::hcccckl..lccccccccccccm::::::::::::::::::::::::ecc", "cc::::meeeeeeeehiiiiiiiidggggggggbcccccccccccccccccccccccccccccccccccccckm:::mkcccci::::dccccccccccci::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::leeeeeeee#iiiiiiiinggggggggjcci::::icccckm::::eccccccccccck::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mkcccci::::::gccccccccccc#:::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::icccckm::::::#cccccccccccb:::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::leeeeeeeeoiiiiiiiiigggggggga::::mkcccci::::::::bccccccccccce::::::::::::::::::::::ecc", "cc::::meeeeeeeeoiiiiiiiiigggggggggkccccccccccccccccccccccccccccccccccci::::icccckm::::::::hcccccccccccg::::::::::::::::::::::ecc", "cc:::::feeeeeeeehiiiiiiiiaggggggggkcccccccccccccccccccccccccccccccccckm:::mkcccci:::::::::mkcccccccccccl:::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::feeeeeeeehiiiiiiiiagggggggh::::icccckm::::::::::icccccccccccd:::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mkcccci:::::::::::lccccccccccccm::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::icccckm::::::::::::dccccccccccci::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::eeeeeeeeehiiiiiiiidggga::::mkcccci:::::::::::::fccccccccccck::::::::::::::::::::ecc", "cc::::::feeeeeeee#iiiiiiiingggggggggccccccccccccccccccccccccccccccci::::iccccb:::::::::::::::gccccccccccc#:::::::::::::::::::ecc", "cc::::meeeeeeeoiiiiiiiiigggggggggbcccccccccccccccccccccccccccccccckm:::mkcccc#:::::::::::::::occcccccccccb:::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::meeeeeeeeeiiiiiiiiidgggg#::::iccccb:::::::::::::::::bccccccccccce::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mkcccc#:::::::::::::::::#cccccccccccg::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::iccccb::::::::::::::::::mkcccccccccccl:::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::eeeeeeeeeiiiiiiiiiaga::::mkcccc#:::::::::::::::::::icccccccccccd:::::::::::::::::ecc", "cc:::::leeeeeeee#iiiiiiiinggggggggjccccccccccccccccccccccccccccci::::iccccb::::::::::::::::::::lccccccccccccm::::::::::::::::ecc", "cc::::meeeeeeee#iiiiiiiiigggggggggkcccccccccccccccccccccccccccckm:::mkcccc#:::::::::::::::::::::dccccccccccci::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::leeeeeeeeoiiiiiiiiiah::::iccccb::::::::::::::::::::::lccccccccccck::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mkcccc#:::::::::::::::::::::::gccccccccccc#:::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::dccccj::::::::::::::::::::::::ecccccccccccj:::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::leeeeeeeeeiiiiiiih::::lccccce:::::::::::::::::::::::::bccccccccccce::::::::::::::ecc", "cc::::meeeeeeeeeiiiiiiiiidgggggggggcccccccccccccccccccccccccci::::dccccg::::::::::::::::::::::::::#ccccccccccca::::::::::::::ecc", "cc:::::feeeeeeeeiiiiiiiinggggggggbcccccccccccccccccccccccccckm:::lccccce:::::::::::::::::::::::::::kcccccccccccl:::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::leeeeeeeehiiiiiiiih::::dccccg::::::::::::::::::::::::::::ncccccccccccd:::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::lccccce::::::::::::::::::::::::::::fccccccccccccf::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::dccccb::::::::::::::::::::::::::::::jcccccccccccg::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::meeeeeeeeoiiiiil::::lcccccn::::::::::::::::::::::::::::::icccccccccccce:::::::::::ecc", "cc::::::feeeeeeeehiiiiiiiigggggggggccccccccccccccccjgggggo:::::gccccc#::::::::::::::::::::::::::::::eccccccccccccbm::::::::::ecc", "cc::::meeeeeeeoiiiiiiiiidgggggggggccccccccccccccccc:::::::::::hcccccco:::::::::::::::::::::::::::::::cccccccccccccn::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::leeeeeee::::::::::ecccccccn::::::::::::::::::::::::::::::lcccccccccccccc#:::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#kccccccckf:::::::::::::::::::::::::::::nccccccccccccccc#::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::ldcccccccccck#m:::::::::::::::::::::::::lncccccccccccccccccdl::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::feeeeeee::::ogjcccccccccccccccggi::::::::::::::::::oggbcccccccccccccccccccccja::::ecc", "cc:::::leeeeeeee#iiiiiiiidggggggggbcccccccccccccccc::::icccccccccccccccccccg::::::::::::::::::icccccccccccccccccccccccccc::::ecc", "cc::::meeeeeeeehiiiiiiiiaggggggggkccccccccccccccccc::::icccccccccccccccccccg::::::::::::::::::icccccccccccccccccccccccccc::::ecc", "cc::::::::::::::::::::::::::::::::::::::::feeeeeeee::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cce::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::hcc", "ccn::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::acb", "jcb:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::lcca", "hcci::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::acc#", "mkcc#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::dccb.", ".occci:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::macccf.", "..#cccbne:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::menkccc#..", "...okccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccbe...", "....mhjccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccg#....."}; /**************************************************************************/ /* */ /* Copyright 2008 Heinz-M. Graesing */ /* Copyright 2018 Mike Gabriel */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /**************************************************************************/ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Imakefile0000644000000000000000000004466513614532331016423 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Server Master Makefile */ NULL = #include /* On most systems the linker requires the libraries in dependency order. But we have no real order because there are cycles. We fix this by adding some libraries twice on the commandline. dependLib will add the dependency library to the commandline if the link order is important */ #if 1 /* This is currently enabled for all systems */ #define dependLib(x) x #else #define dependLib(x) #endif #if defined(XorgVersion) /* Do not strip server binaries */ INSTPGMFLAGS = #endif #define PreFbLibs $(DIX) $(OS) $(XPDDX) #define BarePostFbLibs $(XPFBLIBS) $(MI) #define PostFbLibs BarePostFbLibs $(EXTENSIONS) #if !BuildXinerama #define FbPostFbLibs $(FB) BarePostFbLibs $(EXTENSIONS) #else #define FbPostFbLibs $(FB) $(EXTENSIONS) BarePostFbLibs $(EXTENSIONS) #endif #define FBLibs PreFbLibs FbPostFbLibs #define MiExtLibs $(SHADOW) #define AllFBLibs PreFbLibs $(FB) PostFbLibs #if BuildGlxExt GLXLIB = GL/glx/ModuleLibraryTargetName(glx) \ GL/mesa/GLcore/ModuleLibraryTargetName(GLcore) GLXDIR = GL GLXEXT = $(GLXLIB) #endif #if BuildXInputExt XINPUTEXT = Xi/LibraryTargetName(xinput) XIDIR = Xi #endif #if BuildXKB XKBEXT = xkb/LibraryTargetName(xkb) dependLib($(OS)) XKBDIR = xkb #if defined(XorgVersion) XF86XKBOBJS = xkb/xf86KillSrv.o xkb/xf86VT.o xkb/xf86Private.o #endif #endif #if BuildDBE DBEEXT = dbe/LibraryTargetName(dbe) #endif #if BuildDBE DBEDIR = dbe #endif #if BuildRECORD RECORDEXT = record/LibraryTargetName(record) #endif #if BuildRECORD || BuildRECORDlib RECORDDIR = record #endif #ifdef SiteExtensionLibs SITEEXTS = SiteExtensionLibs #endif #ifdef SiteExtensionDirs SITEEXTDIRS = SiteExtensionDirs #endif LIBREGEX = RegexLibrary #if BuildRender RENDERDIR = render RENDERLIB = $(RENDERDIR)/librender.a #endif #if BuildRandR RANDRDIR = randr RANDRLIB = $(RANDRDIR)/librandr.a #endif #if BuildXfixes FIXESDIR = xfixes FIXESLIB = $(FIXESDIR)/libxfixes.a #endif #if BuildDamage DAMAGEDIR = damageext DAMAGELIB = $(DAMAGEDIR)/libdamageext.a #endif #if BuildComposite CWDIR = miext/cw COMPOSITEDIR = composite COMPOSITELIB = $(COMPOSITEDIR)/libcomposite.a CW = miext/cw/LibraryTargetName(cw) #endif EXTENSIONS = $(COMPOSITELIB) $(DAMAGELIB) $(DAMAGE) $(FIXESLIB) $(CW) \ $(OTHEREXTS) $(GLXEXT) $(RANDRLIB) $(RENDERLIB) OTHEREXTS = Xext/LibraryTargetName(ext) $(XKBEXT) $(XINPUTEXT) \ $(DBEEXT) $(RECORDEXT) $(SITEEXTS) EXTDIRS = Xext $(XKBDIR) $(XIDIR) $(GLXDIR) \ $(DBEDIR) $(RECORDDIR) $(SITEEXTDIRS) \ $(RANDRDIR) $(RENDERDIR) $(XPCONFIGDIR) \ $(FIXESDIR) $(DAMAGEDIR) $(CWDIR) $(COMPOSITEDIR) OS = os/LibraryTargetName(os) BSDEMUL = $(DEPXBSDLIB) FB = fb/LibraryTargetName(fb) DAMAGE = miext/damage/LibraryTargetName(damage) SHADOW = miext/shadow/LibraryTargetName(shadow) LAYER = miext/layer/LibraryTargetName(layer) #if !HasFfs && (defined(mingwArchitecture) || defined(cygwinArchitecture)) /* Order of libraries is important when linking in mingw or * cygwin. libmi.a requires ffs from libdix.a. So it is added * after libmi.a on the commandline */ MI = mi/LibraryTargetName(mi) $(DIX) #else MI = mi/LibraryTargetName(mi) #endif MIINITEXTOBJ = mi/miinitext.o DIX = dix/LibraryTargetName(dix) #if UsbMouseSupport #if !HasLibUsb USB = $(XF86OSSRC)/bsd/libusb/LibraryTargetName(usb) #else USB = UsbHidLib #endif #endif #ifdef ServerExtraSysLibs EXTRASYSLIBS = ServerExtraSysLibs #endif #if HasPam && HasPamMisc PAMLIBS = PamLibraries PamMiscLibraries #endif SYSLIBS = $(ZLIB) MathLibrary $(USB) \ $(PAMLIBS) $(EXTRASYSLIBS) #if !HasCbrt CBRT = mi/LibraryTargetName(cbrt) #endif STDDIRS = include dix os mi $(XPDDXDIR) $(EXTDIRS) FBDIR = fb XCOMM XCOMM This turns off the default rule for compiling .c files because XCOMM this makefile does not really know how to build it. This is really XCOMM just a hack because of the Sun version of make and nfs. XCOMM .c.o: .s.o: #if HasParallelMake XCOMM XCOMM force non-parallel build of XF86 servers to prevent MUTEX overrides XCOMM #if defined(NXAgentServer) && NXAgentServer NXAGENT = nxagent #endif #if defined(NXWinServer) && NXWinServer NXWIN = NXWin #endif #if (defined(NXAgentServer) && NXAgentServer) || \ (defined(NXWinServer) && NXWinServer) MakeMutex($(NXAGENT) $(NXWIN)) #endif MakeMutex($(STDDIRS) fb) #endif #if defined(NXAgentServer) && NXAgentServer XCOMM XCOMM Nested server with NXlib-based ddx and compressed transport. XCOMM FBSUBDIR = fb MIDAMAGEDIR = miext/damage FBDIR = fb #ifndef Win32Architecture NXAGENTDDXDIR = hw/nxagent #else NXAGENTDDXDIR = hw #endif NXAGENTDIRS = $(STDDIRS) $(FBDIR) $(MIDAMAGEDIR) $(NXAGENTDDXDIR) $(DEPDIRS) NX_XCOMP_HEADERS = \ ../../../nxcomp/include/MD5.h \ ../../../nxcomp/include/NXalert.h \ ../../../nxcomp/include/NX.h \ ../../../nxcomp/include/NXpack.h \ ../../../nxcomp/include/NXproto.h \ ../../../nxcomp/include/NXvars.h \ $(NULL) NX_XCOMPSHAD_HEADERS = \ ../../../nxcompshad/include/Shadow.h \ $(NULL) NX_HEADERS = \ $(NX_XCOMP_HEADERS) \ $(NX_XCOMPSHAD_HEADERS) \ $(NULL) BuildIncludes($(NX_HEADERS),nx,..) #if defined(SunArchitecture) || \ defined(SparcArchitecture) NXAGENTOBJS = hw/nxagent/miinitext.o \ hw/nxagent/NXwindow.o \ hw/nxagent/NXevents.o \ hw/nxagent/NXproperty.o \ hw/nxagent/NXdixfonts.o \ hw/nxagent/NXglyphcurs.o \ hw/nxagent/NXdispatch.o \ hw/nxagent/NXrender.o \ hw/nxagent/NXglyph.o \ hw/nxagent/NXpicture.o \ hw/nxagent/NXglxext.o \ hw/nxagent/NXresource.o \ $(NULL) #elif !defined(Win32Architecture) NXAGENTOBJS = hw/nxagent/miinitext.o \ hw/nxagent/NXwindow.o \ hw/nxagent/NXevents.o \ hw/nxagent/NXproperty.o \ hw/nxagent/NXdixfonts.o \ hw/nxagent/NXglyphcurs.o \ hw/nxagent/NXdispatch.o \ hw/nxagent/NXrender.o \ hw/nxagent/NXglyph.o \ hw/nxagent/NXpicture.o \ hw/nxagent/NXglxext.o \ hw/nxagent/NXxvdisp.o \ hw/nxagent/NXresource.o \ $(NULL) #else NXAGENTOBJS = hw/nxagent/miinitext.o \ hw/nxagent/NXwindow.o \ hw/nxagent/NXevents.o \ hw/nxagent/NXproperty.o \ hw/nxagent/NXdixfonts.o \ hw/nxagent/NXglyphcurs.o \ hw/nxagent/NXdispatch.o \ hw/nxagent/NXrender.o \ hw/nxagent/NXglyph.o \ hw/nxagent/NXpicture.o \ hw/nxagent/NXglxext.o \ hw/nxagent/NXxvdisp.o \ hw/nxagent/NXresource.o \ dix/main.o \ $(NULL) #endif XPMLIB = -lXpm XMLLIB = `pkg-config --libs libxml-2.0` PIXMANLIB = `pkg-config --libs pixman-1` ZLIB = $$(pkg-config --exists 'zlib' >/dev/null 2>&1 && pkg-config --libs 'zlib' || printf '%s' '-lz') PNGLIB = `pkg-config --libs libpng` JPEGLIB = -ljpeg TIRPC_LIB = #if HasSecureRPC #if UseTIRPC TIRPC_LIB = $$(pkg-config --libs 'libtirpc') #endif #endif NXAGENT = hw/nxagent/LibraryTargetName(nxagent) NXCOMPEXT = hw/nxagent/compext/LibraryTargetName(compext) NXAGENTLIBS = PreFbLibs $(NXAGENT) FbPostFbLibs $(NXCOMPEXT) $(NXAGENT) $(MI) NXAGENTSYSLIBS = $(XLIB) $(SYSLIBS) $(XPMLIB) $(XMLLIB) $(PIXMANLIB) $(TIRPC_LIB) NXCOMPEXTSYSLIBS = $(ZLIB) $(PNGLIB) $(JPEGLIB) #if HasParallelMake MakeMutex($(NXAGENTDIRS) $(NXCOMPEXT) $(NXAGENTOBJS) $(NXAGENTLIBS) $(NXCOMPEXTSYSLIBS) $(NXAGENTSYSLIBS)) #endif #if ForceServerRemake $(NXAGENTOBJS) $(NXAGENTLIBS):: $(NXAGENTDIRS) @if [ -f $@ ]; then touch $@ >/dev/null 2>&1 || exit 0; fi #endif #if NXLibraries /* * We need this as the linker will try to locate dependencies of X11 and Xext. */ #if defined(SunArchitecture) NXAGENTNXLIBS = -L/usr/sfw/lib \ -L../../../nxcomp/src/.libs \ -L../../../nxcompshad/src/.libs \ -L../../lib/src/.libs \ -lrt \ -lX11 \ -lXcomp \ -lXcompshad \ -lXrender \ -lXfixes \ $(XFONTLIB) \ -lXcomposite \ -lXinerama \ -lXdmcp \ -lNX_X11 \ -lXext \ $(NULL) #elif defined(cygwinArchitecture) NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ -L../../../nxcompshad/src/.libs \ -L../../lib/src/.libs \ -lX11 \ -lXcomp \ -lXcompshad \ -lXrender \ -lXfixes \ $(XFONTLIB) \ -lXcomposite \ -lXdmcp \ -lNX_X11 \ -lXext \ $(NULL) #elif defined(OpenBSDArchitecture) NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ -L../../../nxcompshad/src/.libs \ -L../../lib/src/.libs \ -lkvm \ -lX11 \ -lXcomp \ -lXcompshad \ -lXrender \ -lXfixes \ $(XFONTLIB) \ -lXcomposite \ -lXinerama \ -lXdmcp \ -lNX_X11 \ -lXext \ $(NULL) #else NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ -L../../../nxcompshad/src/.libs \ -L../../lib/src/.libs \ -lX11 \ -lXcomp \ -lXcompshad \ -lXrender \ -lXfixes \ $(XFONTLIB) \ -lXcomposite \ -lXinerama \ -lXdmcp \ -lNX_X11 \ -lXext \ $(NULL) #endif #endif #ifdef cygwinArchitecture NX_XSHADOWLIBNAME = cygXcompshad.dll #else NX_XSHADOWLIBNAME = libXcompshad.so #endif ServerTarget(nxagent,$(NXAGENTDIRS),$(NXAGENTOBJS), \ $(LIBCWRAPPER) $(NXCOMPEXT) $(NXAGENTLIBS) $(LOADABLEEXTS),$(NXAGENTNXLIBS) $(NXAGENTSYSLIBS) $(NXCOMPEXTSYSLIBS)) LibX11Links() /* * Hard coded target to build a static nxagent server. */ nxagent_static: nxagent if [ -f nxagent_static ]; then set -x; \ $(MV) nxagent_static nxagent_static.bak; \ else exit 0; fi $(CCLINK) -o nxagent_static -static $(LDOPTIONS) $(NXAGENTOBJS) \ $(LIBCWRAPPER) $(NXCOMPEXT) $(NXAGENTLIBS) $(LOADABLEEXTS) $(LDLIBS) \ $(NXCOMPEXTSYSLIBS) $(NXAGENTSYSLIBS) $(EXTRA_INSTALL_LOAD_FLAGS) /* * Hard coded target to build a static nxagent server except for libX11 and libXext. */ nxagent_static_nolibs: nxagent if [ -f nxagent_static_nolibs ]; then set -x; \ $(MV) nxagent__static_nolibs nxagent_static_nolibs.bak; \ else exit 0; fi $(CCLINK) -o nxagent_static_nolibs -Wl,-Bstatic $(LDOPTIONS) $(NXAGENTOBJS) \ $(NXAGENTLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER) $(LDLIBS) \ $(LDPRELIBS) $(SYSLIBS) -Wl,-Bdynamic -lNX_X11 -lXext $(EXTRA_INSTALL_LOAD_FLAGS) #endif /* NXAgentServer */ #if defined(NXWinServer) && NXWinServer XCOMM XCOMM X Server for MS Windows XCOMM FBSUBDIR = fb MIDAMAGEDIR = miext/damage SHADOWDIR = miext/shadow #if BuildXWinLayer LAYERDIR = miext/layer XWINLAYERLIB = $(LAYER) #else LAYERDIR = XWINLAYERLIB = #endif #if BuildXWinMultiWindowExtWM ROOTLESSDIR = miext/rootless ROOTLESSLIB = $(ROOTLESSDIR)/LibraryTargetName(rootless) \ $(ROOTLESSDIR)/safeAlpha/LibraryTargetName(safeAlpha) \ $(ROOTLESSDIR)/accel/LibraryTargetName(rlAccel) #else ROOTLESSDIR = ROOTLESSLIB = #endif NXWINDDXDIR = hw/nxwin #if BuildXWinXF86Config XWINPARSERDIR = hw/xfree86/parser XWINPARSERLIB = $(XWINPARSERDIR)/LibraryTargetName(xf86config) #else XWINPARSERDIR = XWINPARSERLIB = #endif XWINOPENGLLIB = NXWINLIB = $(NXWINDDXDIR)/LibraryTargetName(NXWin) NXWINDIRS = $(STDDIRS) $(FBDIR) $(SHADOWDIR) $(LAYERDIR) $(NXWINDDXDIR) \ $(DEPDIRS) $(XWINPARSERDIR) $(ROOTLESSDIR) $(MIDAMAGEDIR) NXWINOBJS = $(NXWINDDXDIR)/stubs.o $(NXWINDDXDIR)/NXWin.res NXWINLIBS = PreFbLibs $(NXWINLIB) FbPostFbLibs $(NXWINLIB) $(XWINLAYERLIB) \ $(SHADOW) $(XWINPARSERLIB) $(ROOTLESSLIB) $(OS) #if BuildXWinMultiWindow || BuildXWinClipboard XWINX11 = $(XONLYLIB) # if defined(Win32Architecture) PTHREADLIB = -lpthreadGC # endif #endif #if defined(Win32Architecture) XWINW32 = -lgdi32 -lwsock32 $(PTHREADLIB) #else XWINW32 = -lgdi32 #endif NXWINSYSLIBS = $(LDPRELIBS) $(XWINX11) $(SYSLIBS) $(XWINW32) NXWINNXLIBS = -L../../../nxcomp -lXcomp /* * These flags cause NXWin.exe to be a Windows executable, which * prevents NXWin.exe from opening a Command Prompt window when it is * started. However, the flags also prevent NXWin.exe from outputting * its status and error message to a Command Prompt; thus, one most * implement a method to redirect status and error messages to a file * before enabling these flags. */ EXTRA_LDOPTIONS = -e _mainCRTStartup #if HasParallelMake MakeMutex($(NXWINDIRS) $(NXWINOBJS) $(NXWINLIB) $(NXWINLIBS) $(NXWINSYSLIBS) $(NXWINNXLIBS)) #endif #if ForceServerRemake $(NXWINOBJS) $(NXWINLIB) $(NXWINLIBS):: $(NXWINDIRS) @if [ -f $@ ]; then touch $@ >/dev/null 2>&1 || exit 0; fi #endif #ifdef mingwArchitecture NXWINSERVERNAME=NXming #else NXWINSERVERNAME=NXWin #endif ServerTarget($(NXWINSERVERNAME),$(NXWINDIRS),$(NXWINOBJS), \ $(LIBCWRAPPER) $(NXWINLIBS) $(LOADABLEEXTS),$(NXWINSYSLIBS) $(NXWINNXLIBS)) #ifndef ServerToInstall # define ServerToInstall $(NXWINSERVERNAME) #endif #endif /* NXWinServer */ #if 0 #if defined(NXWinServer) && NXWinServer XCOMM XCOMM X Server for MS Windows XCOMM FBDIR = fb SHADOWDIR = miext/shadow LAYERDIR = miext/layer NXWINDDXDIR = hw/nxwin XWINPARSERDIR = hw/xfree86/parser XWINPARSERLIB = $(XWINPARSERDIR)/LibraryTargetName(xf86config) NXWINLIB = $(NXWINDDXDIR)/LibraryTargetName(nxwin) NXWINDIRS = $(STDDIRS) $(FBDIR) $(SHADOWDIR) $(LAYERDIR) $(NXWINDDXDIR) \ $(DEPDIRS) $(XWINPARSERDIR) #NXWINOBJS = $(NXWINDDXDIR)/stubs.o $(NXWINDDXDIR)/NX.res \ $(NXWINDDXDIR)/NXwindow.o \ $(NXWINDDXDIR)/NXdispatch.o $(NXWINDDXDIR)/NXproperty.o \ $(NXWINDDXDIR)/NXevents.o NXWINOBJS = $(NXWINDDXDIR)/stubs.o $(NXWINDDXDIR)/NX.res NXWINLIBS = PreFbLibs $(NXWINLIB) FbPostFbLibs $(LAYER) $(SHADOW) \ $(XWINPARSERLIB) NXWINSYSLIBS = $(LDPRELIBS) $(XLIB) $(SYSLIBS) -lgdi32 -lddraw NXWINNXLIBS = -L../../../nxcomp -lXcomp /* * These flags cause NXWin.exe to be a Windows executable, which * prevents NXWin.exe from opening a Command Prompt window when it is * started. However, the flags also prevent NXWin.exe from outputting * its status and error message to a Command Prompt; thus, one most * implement a method to redirect status and error messages to a file * before enabling these flags. */ EXTRA_LDOPTIONS = -mwindows -e _mainCRTStartup #if HasParallelMake MakeMutex($(NXWINDIRS) $(NXWINOBJS) $(NXWINLIB) $(NXWINLIBS) $(NXWINSYSLIBS) $(NXWINNXLIBS)) #endif #if ForceServerRemake $(NXWINOBJS) $(NXWINLIB) $(NXWINLIBS):: $(NXWINDIRS) @if [ -f $@ ]; then touch $@ >/dev/null 2>&1 || exit 0; fi #endif ServerTarget(NXWin,$(NXWINDIRS),$(NXWINOBJS), \ $(NXWINLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER),$(NXWINSYSLIBS) $(NXWINNXLIBS)) #ifndef ServerToInstall #define ServerToInstall NXWin #endif #endif /* NXWinServer */ #endif MIEXTDIRS = $(SHADOWDIR) $(LAYERDIR) $(ROOTLESSDIR) $(MIDAMAGEDIR) IPLANDIRS = $(IPLAN2P2DIR) $(IPLAN2P4DIR) $(IPLAN2P8DIR) DDXDIRS = $(DECWSDDXDIR) $(SUNDDXDIR) \ $(HPDDXDIR) $(XFREE86DDXDIR) \ $(NXAGENTDDXDIR) $(NXWINDDXDIR) SUBDIRS = $(STDDIRS) \ $(IPLANDIRS) $(ILBMDIR) \ $(DDXDIRS) $(FBSUBDIR) $(KDRIVEDIRS) $(MIEXTDIRS) #if defined(ServerToInstall) install:: -(cd $(DESTDIR)$(BINDIR); $(RM) X; $(LN) ServerToInstall X) #endif #define IHaveSubdirs DependSubdirs($(SUBDIRS)) MakeLintLibSubdirs($(SUBDIRS)) LintSubdirs($(SUBDIRS)) ForceSubdirs($(DEPDIRS) $(SUBDIRS)) DEFAULTFONTPATH = DefaultFontPath EXTRAMANDEFS = -D__default_font_path__="`echo $(DEFAULTFONTPATH) | sed -e 's/,/, /g'`" nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/bstore.h0000644000000000000000000000127513614532331017672 0ustar /* * Copyright (c) 1987 by the Regents of the University of California * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies. The University of * California makes no representations about the suitability of this software * for any purpose. It is provided "as is" without express or implied * warranty. */ /* * Moved here from mi to allow wrapping of lower level backing store functions. * -- 1997.10.27 Marc Aurele La France (tsi@xfree86.org) */ #ifndef _BSTORE_H_ #define _BSTORE_H_ #include "bstorestr.h" #endif /* _BSTORE_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/bstorestr.h0000644000000000000000000000312413614532331020416 0ustar /* * Copyright (c) 1987 by the Regents of the University of California * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies. The University of * California makes no representations about the suitability of this software * for any purpose. It is provided "as is" without express or implied * warranty. */ /* * Moved here from mi to allow wrapping of lower level backing store functions. * -- 1997.10.27 Marc Aurele La France (tsi@xfree86.org) */ #ifndef _BSTORESTR_H_ #define _BSTORESTR_H_ #include "gc.h" #include "pixmap.h" #include "region.h" #include "window.h" typedef void (* BackingStoreSaveAreasProcPtr)( PixmapPtr /*pBackingPixmap*/, RegionPtr /*pObscured*/, int /*x*/, int /*y*/, WindowPtr /*pWin*/); typedef void (* BackingStoreRestoreAreasProcPtr)( PixmapPtr /*pBackingPixmap*/, RegionPtr /*pExposed*/, int /*x*/, int /*y*/, WindowPtr /*pWin*/); typedef void (* BackingStoreSetClipmaskRgnProcPtr)( GCPtr /*pBackingGC*/, RegionPtr /*pbackingCompositeClip*/); typedef PixmapPtr (* BackingStoreGetImagePixmapProcPtr)(void); typedef PixmapPtr (* BackingStoreGetSpansPixmapProcPtr)(void); typedef struct _BSFuncs { BackingStoreSaveAreasProcPtr SaveAreas; BackingStoreRestoreAreasProcPtr RestoreAreas; BackingStoreSetClipmaskRgnProcPtr SetClipmaskRgn; BackingStoreGetImagePixmapProcPtr GetImagePixmap; BackingStoreGetSpansPixmapProcPtr GetSpansPixmap; } BSFuncRec, *BSFuncPtr; #endif /* _BSTORESTR_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/client.h0000644000000000000000000000500613614532331017646 0ustar /* * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). All * rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /* Author: Rami Ylimäki */ #ifndef CLIENT_H #define CLIENT_H #ifdef HAVE_DIX_CONFIG_H #include #endif /* HAVE_DIX_CONFIG_H */ #include #include /* Client IDs. Use GetClientPid, GetClientCmdName and GetClientCmdArgs * instead of accessing the fields directly. */ typedef struct { pid_t pid; /* process ID, -1 if not available */ const char *cmdname; /* process name, NULL if not available */ const char *cmdargs; /* process arguments, NULL if not available */ } ClientIdRec, *ClientIdPtr; struct _Client; /* Initialize and clean up. */ void ReserveClientIds(struct _Client *client); void ReleaseClientIds(struct _Client *client); /* Determine client IDs for caching. Exported on purpose for * extensions such as SELinux. */ extern _X_EXPORT pid_t DetermineClientPid(struct _Client *client); extern _X_EXPORT void DetermineClientCmd(pid_t, const char **cmdname, const char **cmdargs); /* Query cached client IDs. Exported on purpose for drivers. */ extern _X_EXPORT pid_t GetClientPid(struct _Client *client); extern _X_EXPORT const char *GetClientCmdName(struct _Client *client); extern _X_EXPORT const char *GetClientCmdArgs(struct _Client *client); #endif /* CLIENT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/closestr.h0000644000000000000000000000712313614532331020230 0ustar /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef CLOSESTR_H #define CLOSESTR_H #include #include "closure.h" #include "dix.h" #include "misc.h" #include "gcstruct.h" /* closure structures */ /* OpenFont */ typedef struct _OFclosure { ClientPtr client; short current_fpe; short num_fpes; FontPathElementPtr *fpe_list; Mask flags; Bool slept; /* XXX -- get these from request buffer instead? */ char *origFontName; int origFontNameLen; XID fontid; char *fontname; int fnamelen; FontPtr non_cachable_font; } OFclosureRec; /* ListFontsWithInfo */ #define XLFDMAXFONTNAMELEN 256 typedef struct _LFWIstate { char pattern[XLFDMAXFONTNAMELEN]; int patlen; int current_fpe; int max_names; Bool list_started; void * private; } LFWIstateRec, *LFWIstatePtr; typedef struct _LFWIclosure { ClientPtr client; int num_fpes; FontPathElementPtr *fpe_list; xListFontsWithInfoReply *reply; int length; LFWIstateRec current; LFWIstateRec saved; int savedNumFonts; Bool haveSaved; Bool slept; char *savedName; } LFWIclosureRec; /* ListFonts */ typedef struct _LFclosure { ClientPtr client; int num_fpes; FontPathElementPtr *fpe_list; FontNamesPtr names; LFWIstateRec current; LFWIstateRec saved; Bool haveSaved; Bool slept; char *savedName; int savedNameLen; } LFclosureRec; /* PolyText */ typedef int (* PolyTextPtr)( DrawablePtr /* pDraw */, GCPtr /* pGC */, int /* x */, int /* y */, int /* count */, void * /* chars or shorts */ ); typedef struct _PTclosure { ClientPtr client; DrawablePtr pDraw; GC *pGC; unsigned char *pElt; unsigned char *endReq; unsigned char *data; int xorg; int yorg; CARD8 reqType; PolyTextPtr polyText; int itemSize; XID did; int err; Bool slept; } PTclosureRec; /* ImageText */ typedef void (* ImageTextPtr)( DrawablePtr /* pDraw */, GCPtr /* pGC */, int /* x */, int /* y */, int /* count */, void * /* chars or shorts */ ); typedef struct _ITclosure { ClientPtr client; DrawablePtr pDraw; GC *pGC; BYTE nChars; unsigned char *data; int xorg; int yorg; CARD8 reqType; ImageTextPtr imageText; int itemSize; XID did; Bool slept; } ITclosureRec; #endif /* CLOSESTR_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/closure.h0000644000000000000000000000477213614532331020055 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef CLOSURE_H #define CLOSURE_H 1 typedef struct _LFclosure *LFclosurePtr; typedef struct _LFWIclosure *LFWIclosurePtr; typedef struct _OFclosure *OFclosurePtr; typedef struct _PTclosure *PTclosurePtr; typedef struct _ITclosure *ITclosurePtr; #endif /* CLOSURE_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/colormap.h0000644000000000000000000001203313614532331020202 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef CMAP_H #define CMAP_H 1 #include #include "screenint.h" #include "window.h" /* these follow X.h's AllocNone and AllocAll */ #define CM_PSCREEN 2 #define CM_PWIN 3 /* Passed internally in colormap.c */ #define REDMAP 0 #define GREENMAP 1 #define BLUEMAP 2 #define PSEUDOMAP 3 #define AllocPrivate (-1) #define AllocTemporary (-2) #define DynamicClass 1 /* Values for the flags field of a colormap. These should have 1 bit set * and not overlap */ #define IsDefault 1 #define AllAllocated 2 #define BeingCreated 4 typedef CARD32 Pixel; typedef struct _CMEntry *EntryPtr; /* moved to screenint.h: typedef struct _ColormapRec *ColormapPtr */ typedef struct _colorResource *colorResourcePtr; extern int CreateColormap( Colormap /*mid*/, ScreenPtr /*pScreen*/, VisualPtr /*pVisual*/, ColormapPtr* /*ppcmap*/, int /*alloc*/, int /*client*/); extern int FreeColormap( void * /*pmap*/, XID /*mid*/); extern int TellLostMap( WindowPtr /*pwin*/, void * /* Colormap *pmid */); extern int TellGainedMap( WindowPtr /*pwin*/, void * /* Colormap *pmid */); extern int CopyColormapAndFree( Colormap /*mid*/, ColormapPtr /*pSrc*/, int /*client*/); extern int AllocColor( ColormapPtr /*pmap*/, unsigned short* /*pred*/, unsigned short* /*pgreen*/, unsigned short* /*pblue*/, Pixel* /*pPix*/, int /*client*/); extern void FakeAllocColor( ColormapPtr /*pmap*/, xColorItem * /*item*/); extern void FakeFreeColor( ColormapPtr /*pmap*/, Pixel /*pixel*/); typedef int (*ColorCompareProcPtr)( EntryPtr /*pent*/, xrgb * /*prgb*/); extern int FindColor( ColormapPtr /*pmap*/, EntryPtr /*pentFirst*/, int /*size*/, xrgb* /*prgb*/, Pixel* /*pPixel*/, int /*channel*/, int /*client*/, ColorCompareProcPtr /*comp*/); extern int QueryColors( ColormapPtr /*pmap*/, int /*count*/, Pixel* /*ppixIn*/, xrgb* /*prgbList*/); extern int FreeClientPixels( void * /*pcr*/, XID /*fakeid*/); extern int AllocColorCells( int /*client*/, ColormapPtr /*pmap*/, int /*colors*/, int /*planes*/, Bool /*contig*/, Pixel* /*ppix*/, Pixel* /*masks*/); extern int AllocColorPlanes( int /*client*/, ColormapPtr /*pmap*/, int /*colors*/, int /*r*/, int /*g*/, int /*b*/, Bool /*contig*/, Pixel* /*pixels*/, Pixel* /*prmask*/, Pixel* /*pgmask*/, Pixel* /*pbmask*/); extern int FreeColors( ColormapPtr /*pmap*/, int /*client*/, int /*count*/, Pixel* /*pixels*/, Pixel /*mask*/); extern int StoreColors( ColormapPtr /*pmap*/, int /*count*/, xColorItem* /*defs*/); extern int IsMapInstalled( Colormap /*map*/, WindowPtr /*pWin*/); extern Bool ResizeVisualArray(ScreenPtr /* pScreen */ , int /* new_vis_count */ , DepthPtr /* depth */ ); #endif /* CMAP_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/colormapst.h0000644000000000000000000001031713614532331020554 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef CMAPSTRUCT_H #define CMAPSTRUCT_H 1 #include #include "colormap.h" #include "screenint.h" /* Shared color -- the color is used by AllocColorPlanes */ typedef struct { unsigned short color; short refcnt; } SHAREDCOLOR; /* LOCO -- a local color for a PseudoColor cell. DirectColor maps always * use the first value (called red) in the structure. What channel they * are really talking about depends on which map they are in. */ typedef struct { unsigned short red, green, blue; } LOCO; /* SHCO -- a shared color for a PseudoColor cell. Used with AllocColorPlanes. * DirectColor maps always use the first value (called red) in the structure. * What channel they are really talking about depends on which map they * are in. */ typedef struct { SHAREDCOLOR *red, *green, *blue; } SHCO; /* color map entry */ typedef struct _CMEntry { union { LOCO local; SHCO shco; } co; short refcnt; Bool fShared; } Entry; /* * COLORMAPs can be used for either Direct or Pseudo color. PseudoColor * only needs one cell table, we arbitrarily pick red. We keep track * of that table with freeRed, numPixelsRed, and clientPixelsRed * * The padN variables are unfortunate ABI BC. See fdo bug #6924. */ typedef struct _ColormapRec { VisualPtr pVisual; short class; /* PseudoColor or DirectColor */ #if defined(_XSERVER64) short pad0; XID pad1; #endif XID mid; /* client's name for colormap */ #if defined(_XSERVER64) && (X_BYTE_ORDER == X_LITTLE_ENDIAN) XID pad2; #endif ScreenPtr pScreen; /* screen map is associated with */ short flags; /* 1 = IsDefault * 2 = AllAllocated */ int freeRed; int freeGreen; int freeBlue; int *numPixelsRed; int *numPixelsGreen; int *numPixelsBlue; Pixel **clientPixelsRed; Pixel **clientPixelsGreen; Pixel **clientPixelsBlue; Entry *red; Entry *green; Entry *blue; void * devPriv; DevUnion *devPrivates; /* dynamic devPrivates added after devPriv already existed - must keep devPriv */ } ColormapRec; #endif /* COLORMAP_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/cursor.h0000644000000000000000000001070013614532331017702 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef CURSOR_H #define CURSOR_H #include "misc.h" #include "screenint.h" #include "window.h" #define NullCursor ((CursorPtr)NULL) /* Provide support for alpha composited cursors */ #ifdef RENDER #define ARGB_CURSOR #endif typedef struct _Cursor *CursorPtr; typedef struct _CursorMetric *CursorMetricPtr; extern CursorPtr rootCursor; extern int FreeCursor( void * /*pCurs*/, XID /*cid*/); /* Quartz support on Mac OS X pulls in the QuickDraw framework whose AllocCursor function conflicts here. */ #ifdef __DARWIN__ #define AllocCursor Darwin_X_AllocCursor #endif extern CursorPtr AllocCursor( unsigned char* /*psrcbits*/, unsigned char* /*pmaskbits*/, CursorMetricPtr /*cm*/, unsigned /*foreRed*/, unsigned /*foreGreen*/, unsigned /*foreBlue*/, unsigned /*backRed*/, unsigned /*backGreen*/, unsigned /*backBlue*/); extern CursorPtr AllocCursorARGB( unsigned char* /*psrcbits*/, unsigned char* /*pmaskbits*/, CARD32* /*argb*/, CursorMetricPtr /*cm*/, unsigned /*foreRed*/, unsigned /*foreGreen*/, unsigned /*foreBlue*/, unsigned /*backRed*/, unsigned /*backGreen*/, unsigned /*backBlue*/); extern int AllocGlyphCursor( Font /*source*/, unsigned int /*sourceChar*/, Font /*mask*/, unsigned int /*maskChar*/, unsigned /*foreRed*/, unsigned /*foreGreen*/, unsigned /*foreBlue*/, unsigned /*backRed*/, unsigned /*backGreen*/, unsigned /*backBlue*/, CursorPtr* /*ppCurs*/, ClientPtr /*client*/); extern CursorPtr CreateRootCursor( char* /*pfilename*/, unsigned int /*glyph*/); extern int ServerBitsFromGlyph( FontPtr /*pfont*/, unsigned int /*ch*/, register CursorMetricPtr /*cm*/, unsigned char ** /*ppbits*/); extern Bool CursorMetricsFromGlyph( FontPtr /*pfont*/, unsigned /*ch*/, CursorMetricPtr /*cm*/); extern void CheckCursorConfinement( WindowPtr /*pWin*/); extern void NewCurrentScreen( ScreenPtr /*newScreen*/, int /*x*/, int /*y*/); extern Bool PointerConfinedToScreen(void); extern void GetSpritePosition( int * /*px*/, int * /*py*/); #ifdef PANORAMIX extern int XineramaGetCursorScreen(void); #endif /* PANORAMIX */ #endif /* CURSOR_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/cursorstr.h0000644000000000000000000000667513614532331020453 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef CURSORSTRUCT_H #define CURSORSTRUCT_H #include "cursor.h" /* * device-independent cursor storage */ /* * source and mask point directly to the bits, which are in the server-defined * bitmap format. */ typedef struct _CursorBits { unsigned char *source; /* points to bits */ unsigned char *mask; /* points to bits */ Bool emptyMask; /* all zeros mask */ unsigned short width, height, xhot, yhot; /* metrics */ int refcnt; /* can be shared */ void * devPriv[MAXSCREENS]; /* set by pScr->RealizeCursor*/ #ifdef ARGB_CURSOR CARD32 *argb; /* full-color alpha blended */ #endif } CursorBits, *CursorBitsPtr; typedef struct _Cursor { CursorBitsPtr bits; unsigned short foreRed, foreGreen, foreBlue; /* device-independent color */ unsigned short backRed, backGreen, backBlue; /* device-independent color */ int refcnt; void * devPriv[MAXSCREENS]; /* set by pScr->RealizeCursor*/ #ifdef XFIXES CARD32 serialNumber; Atom name; #endif } CursorRec; typedef struct _CursorMetric { unsigned short width, height, xhot, yhot; } CursorMetricRec; typedef struct { int x, y; ScreenPtr pScreen; } HotSpot; #endif /* CURSORSTRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/dixevents.h0000644000000000000000000000616613614532331020411 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef DIXEVENTS_H #define DIXEVENTS_H extern void SetCriticalEvent(int /* event */); extern CursorPtr GetSpriteCursor(void); extern int ProcAllowEvents(ClientPtr /* client */); extern int MaybeDeliverEventsToClient( WindowPtr /* pWin */, xEvent * /* pEvents */, int /* count */, Mask /* filter */, ClientPtr /* dontClient */); extern int ProcWarpPointer(ClientPtr /* client */); #if 0 extern void #ifdef XKB CoreProcessKeyboardEvent ( #else ProcessKeyboardEvent ( #endif xEvent * /* xE */, DeviceIntPtr /* keybd */, int /* count */); extern void #ifdef XKB CoreProcessPointerEvent ( #else ProcessPointerEvent ( #endif xEvent * /* xE */, DeviceIntPtr /* mouse */, int /* count */); #endif extern int EventSelectForWindow( WindowPtr /* pWin */, ClientPtr /* client */, Mask /* mask */); extern int EventSuppressForWindow( WindowPtr /* pWin */, ClientPtr /* client */, Mask /* mask */, Bool * /* checkOptional */); extern int ProcSetInputFocus(ClientPtr /* client */); extern int ProcGetInputFocus(ClientPtr /* client */); extern int ProcGrabPointer(ClientPtr /* client */); extern int ProcChangeActivePointerGrab(ClientPtr /* client */); extern int ProcUngrabPointer(ClientPtr /* client */); extern int ProcGrabKeyboard(ClientPtr /* client */); extern int ProcUngrabKeyboard(ClientPtr /* client */); extern int ProcQueryPointer(ClientPtr /* client */); extern int ProcSendEvent(ClientPtr /* client */); extern int ProcUngrabKey(ClientPtr /* client */); extern int ProcGrabKey(ClientPtr /* client */); extern int ProcGrabButton(ClientPtr /* client */); extern int ProcUngrabButton(ClientPtr /* client */); extern int ProcRecolorCursor(ClientPtr /* client */); #endif /* DIXEVENTS_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/dixfont.h0000644000000000000000000001162613614532331020050 0ustar /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef DIXFONT_H #define DIXFONT_H 1 #include "dix.h" #include #include "closure.h" #include #ifdef HAS_XFONT2 # include #else # include #endif /* HAS XFONT2 */ #define NullDIXFontProp ((DIXFontPropPtr)0) typedef struct _DIXFontProp *DIXFontPropPtr; #ifdef HAS_XFONT2 xfont2_fpe_funcs_rec const **fpe_functions; #else extern FPEFunctions *fpe_functions; #endif /* HAS_XFONT2 */ extern int FontToXError(int /*err*/); extern Bool SetDefaultFont(char * /*defaultfontname*/); extern void QueueFontWakeup(FontPathElementPtr /*fpe*/); extern void RemoveFontWakeup(FontPathElementPtr /*fpe*/); extern void FontWakeup(void * /*data*/, int /*count*/, void * /*LastSelectMask*/); extern int OpenFont(ClientPtr /*client*/, XID /*fid*/, Mask /*flags*/, unsigned /*lenfname*/, char * /*pfontname*/); extern int CloseFont(void * /*pfont*/, XID /*fid*/); typedef struct _xQueryFontReply *xQueryFontReplyPtr; extern void QueryFont(FontPtr /*pFont*/, xQueryFontReplyPtr /*pReply*/, int /*nProtoCCIStructs*/); extern int ListFonts(ClientPtr /*client*/, unsigned char * /*pattern*/, unsigned int /*length*/, unsigned int /*max_names*/); int doListFontsWithInfo(ClientPtr /*client*/, LFWIclosurePtr /*c*/); extern int doPolyText(ClientPtr /*client*/, PTclosurePtr /*c*/ ); extern int PolyText(ClientPtr /*client*/, DrawablePtr /*pDraw*/, GCPtr /*pGC*/, unsigned char * /*pElt*/, unsigned char * /*endReq*/, int /*xorg*/, int /*yorg*/, int /*reqType*/, XID /*did*/); extern int doImageText(ClientPtr /*client*/, ITclosurePtr /*c*/); extern int ImageText(ClientPtr /*client*/, DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*nChars*/, unsigned char * /*data*/, int /*xorg*/, int /*yorg*/, int /*reqType*/, XID /*did*/); extern int SetFontPath(ClientPtr /*client*/, int /*npaths*/, unsigned char * /*paths*/); extern int SetDefaultFontPath(char * /*path*/); extern unsigned char *GetFontPath(int * /*count*/, int * /*length*/); extern int LoadGlyphs(ClientPtr /*client*/, FontPtr /*pfont*/, unsigned /*nchars*/, int /*item_size*/, unsigned char * /*data*/); extern void DeleteClientFontStuff(ClientPtr /*client*/); /* Quartz support on Mac OS X pulls in the QuickDraw framework whose InitFonts function conflicts here. */ #ifdef __DARWIN__ #define InitFonts Darwin_X_InitFonts #endif extern void InitFonts(void); extern void FreeFonts(void); #ifdef HAS_XFONT2 extern void GetGlyphs(FontPtr /*font */ , unsigned long /*count */ , unsigned char * /*chars */ , FontEncoding /*fontEncoding */ , unsigned long * /*glyphcount */ , CharInfoPtr * /*glyphs */ ); #else extern FontPtr find_old_font(XID /*id*/); #define GetGlyphs dixGetGlyphs extern void dixGetGlyphs(FontPtr /*font*/, unsigned long /*count*/, unsigned char * /*chars*/, FontEncoding /*fontEncoding*/, unsigned long * /*glyphcount*/, CharInfoPtr * /*glyphs*/); #ifdef LEGACY_XFONT1 extern void BuiltinRegisterFpeFunctions(void); #else extern void register_fpe_functions(void); #endif extern void QueryGlyphExtents(FontPtr /*pFont*/, CharInfoPtr * /*charinfo*/, unsigned long /*count*/, ExtentInfoPtr /*info*/); extern Bool QueryTextExtents(FontPtr /*pFont*/, unsigned long /*count*/, unsigned char * /*chars*/, ExtentInfoPtr /*info*/); #endif /* HAS_XFONT2 */ extern Bool ParseGlyphCachingMode(char * /*str*/); extern void InitGlyphCaching(void); extern void SetGlyphCachingMode(int /*newmode*/); #endif /* DIXFONT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/dixfontstr.h0000644000000000000000000000672613614532331020606 0ustar /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef DIXFONTSTRUCT_H #define DIXFONTSTRUCT_H #include "servermd.h" #include "dixfont.h" #include #ifdef HAS_XFONT2 # include #endif /* HAS_XFONT2 */ #include "closure.h" #include /* for xQueryFontReply */ #define FONTCHARSET(font) (font) #define FONTMAXBOUNDS(font,field) (font)->info.maxbounds.field #define FONTMINBOUNDS(font,field) (font)->info.minbounds.field #define TERMINALFONT(font) (font)->info.terminalFont #define FONTASCENT(font) (font)->info.fontAscent #define FONTDESCENT(font) (font)->info.fontDescent #define FONTGLYPHS(font) 0 #define FONTCONSTMETRICS(font) (font)->info.constantMetrics #define FONTCONSTWIDTH(font) (font)->info.constantWidth #define FONTALLEXIST(font) (font)->info.allExist #define FONTFIRSTCOL(font) (font)->info.firstCol #define FONTLASTCOL(font) (font)->info.lastCol #define FONTFIRSTROW(font) (font)->info.firstRow #define FONTLASTROW(font) (font)->info.lastRow #define FONTDEFAULTCH(font) (font)->info.defaultCh #define FONTINKMIN(font) (&((font)->info.ink_minbounds)) #define FONTINKMAX(font) (&((font)->info.ink_maxbounds)) #define FONTPROPS(font) (font)->info.props #define FONTGLYPHBITS(base,pci) ((unsigned char *) (pci)->bits) #define FONTINFONPROPS(font) (font)->info.nprops /* some things haven't changed names, but we'll be careful anyway */ #define FONTREFCNT(font) (font)->refcnt /* * for linear char sets */ #define N1dChars(pfont) (FONTLASTCOL(pfont) - FONTFIRSTCOL(pfont) + 1) /* * for 2D char sets */ #define N2dChars(pfont) (N1dChars(pfont) * \ (FONTLASTROW(pfont) - FONTFIRSTROW(pfont) + 1)) #ifndef GLYPHPADBYTES #define GLYPHPADBYTES -1 #endif #if GLYPHPADBYTES == 0 || GLYPHPADBYTES == 1 #define GLYPHWIDTHBYTESPADDED(pci) (GLYPHWIDTHBYTES(pci)) #define PADGLYPHWIDTHBYTES(w) (((w)+7)>>3) #endif #if GLYPHPADBYTES == 2 #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+1) & ~0x1) #define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+1) & ~0x1) #endif #if GLYPHPADBYTES == 4 #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+3) & ~0x3) #define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+3) & ~0x3) #endif #if GLYPHPADBYTES == 8 /* for a cray? */ #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+7) & ~0x7) #define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+7) & ~0x7) #endif #endif /* DIXFONTSTRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/dixgrabs.h0000644000000000000000000000355613614532331020203 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef DIXGRABS_H #define DIXGRABS_H 1 extern GrabPtr CreateGrab( int /* client */, DeviceIntPtr /* device */, WindowPtr /* window */, Mask /* eventMask */, Bool /* ownerEvents */, Bool /* keyboardMode */, Bool /* pointerMode */, DeviceIntPtr /* modDevice */, unsigned short /* modifiers */, int /* type */, KeyCode /* keybut */, WindowPtr /* confineTo */, CursorPtr /* cursor */); extern int DeletePassiveGrab( void * /* value */, XID /* id */); extern Bool GrabMatchesSecond( GrabPtr /* pFirstGrab */, GrabPtr /* pSecondGrab */); extern int AddPassiveGrabToList( GrabPtr /* pGrab */); extern Bool DeletePassiveGrabFromList( GrabPtr /* pMinuendGrab */); #endif /* DIXGRABS_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/dix.h0000644000000000000000000004656313614532331017171 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef DIX_H #define DIX_H #include #include "gc.h" #include "window.h" #include "input.h" #define EARLIER -1 #define SAMETIME 0 #define LATER 1 #define NullClient ((ClientPtr) 0) #define REQUEST(type) \ register type *stuff = (type *)client->requestBuffer #define REQUEST_SIZE_MATCH(req)\ if ((sizeof(req) >> 2) != client->req_len)\ return(BadLength) #define REQUEST_AT_LEAST_SIZE(req) \ if ((sizeof(req) >> 2) > client->req_len )\ return(BadLength) #define REQUEST_AT_LEAST_EXTRA_SIZE(req, extra) \ if (((sizeof(req) + ((uint64_t) extra)) >> 2) > client->req_len ) \ return(BadLength) #define REQUEST_FIXED_SIZE(req, n)\ if (((sizeof(req) >> 2) > client->req_len) || \ ((n >> 2) >= client->req_len) || \ ((((uint64_t) sizeof(req) + (n) + 3) >> 2) != (uint64_t) client->req_len)) \ return(BadLength) #define LEGAL_NEW_RESOURCE(id,client)\ if (!LegalNewID(id,client)) \ {\ client->errorValue = id;\ return(BadIDChoice);\ } /* XXX if you are using this macro, you are probably not generating Match * errors where appropriate */ #define LOOKUP_DRAWABLE(did, client)\ ((DrawablePtr)LookupDrawable(did, client)) #ifdef XCSECURITY #define SECURITY_VERIFY_DRAWABLE(pDraw, did, client, mode)\ {\ pDraw = (DrawablePtr) SecurityLookupIDByClass(client, did, \ RC_DRAWABLE, mode);\ if (!pDraw) \ {\ client->errorValue = did; \ return BadDrawable;\ }\ if (pDraw->type == UNDRAWABLE_WINDOW)\ return BadMatch;\ } #define SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, mode)\ {\ pDraw = (DrawablePtr) SecurityLookupIDByClass(client, did, \ RC_DRAWABLE, mode);\ if (!pDraw) \ {\ client->errorValue = did; \ return BadDrawable;\ }\ } #define SECURITY_VERIFY_GC(pGC, rid, client, mode)\ pGC = (GC *) SecurityLookupIDByType(client, rid, RT_GC, mode);\ if (!pGC)\ {\ client->errorValue = rid;\ return (BadGC);\ } #define VERIFY_DRAWABLE(pDraw, did, client)\ SECURITY_VERIFY_DRAWABLE(pDraw, did, client, DixUnknownAccess) #define VERIFY_GEOMETRABLE(pDraw, did, client)\ SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, DixUnknownAccess) #define VERIFY_GC(pGC, rid, client)\ SECURITY_VERIFY_GC(pGC, rid, client, DixUnknownAccess) #else /* not XCSECURITY */ #define VERIFY_DRAWABLE(pDraw, did, client)\ {\ pDraw = (DrawablePtr) LookupIDByClass(did, RC_DRAWABLE);\ if (!pDraw) \ {\ client->errorValue = did; \ return BadDrawable;\ }\ if (pDraw->type == UNDRAWABLE_WINDOW)\ return BadMatch;\ } #define VERIFY_GEOMETRABLE(pDraw, did, client)\ {\ pDraw = (DrawablePtr) LookupIDByClass(did, RC_DRAWABLE);\ if (!pDraw) \ {\ client->errorValue = did; \ return BadDrawable;\ }\ } #define VERIFY_GC(pGC, rid, client)\ pGC = (GC *)LookupIDByType(rid, RT_GC);\ if (!pGC)\ {\ client->errorValue = rid;\ return (BadGC);\ } #define SECURITY_VERIFY_DRAWABLE(pDraw, did, client, mode)\ VERIFY_DRAWABLE(pDraw, did, client) #define SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, mode)\ VERIFY_GEOMETRABLE(pDraw, did, client) #define SECURITY_VERIFY_GC(pGC, rid, client, mode)\ VERIFY_GC(pGC, rid, client) #endif /* XCSECURITY */ /* * We think that most hardware implementations of DBE will want * LookupID*(dbe_back_buffer_id) to return the window structure that the * id is a back buffer for. Since both front and back buffers will * return the same structure, you need to be able to distinguish * somewhere what kind of buffer (front/back) was being asked for, so * that ddx can render to the right place. That's the problem that the * following code solves. Note: we couldn't embed this in the LookupID* * functions because the VALIDATE_DRAWABLE_AND_GC macro often circumvents * those functions by checking a one-element cache. That's why we're * mucking with VALIDATE_DRAWABLE_AND_GC. * * If you put -DNEED_DBE_BUF_BITS into PervasiveDBEDefines, the window * structure will have two additional bits defined, srcBuffer and * dstBuffer, and their values will be maintained via the macros * SET_DBE_DSTBUF and SET_DBE_SRCBUF (below). If you also * put -DNEED_DBE_BUF_VALIDATE into PervasiveDBEDefines, the function * DbeValidateBuffer will be called any time the bits change to give you * a chance to do some setup. See the DBE code for more details on this * function. We put in these levels of conditionality so that you can do * just what you need to do, and no more. If neither of these defines * are used, the bits won't be there, and VALIDATE_DRAWABLE_AND_GC will * be unchanged. dpw */ #if defined(NEED_DBE_BUF_BITS) #define SET_DBE_DSTBUF(_pDraw, _drawID) \ SET_DBE_BUF(_pDraw, _drawID, dstBuffer, TRUE) #define SET_DBE_SRCBUF(_pDraw, _drawID) \ SET_DBE_BUF(_pDraw, _drawID, srcBuffer, FALSE) #if defined (NEED_DBE_BUF_VALIDATE) #define SET_DBE_BUF(_pDraw, _drawID, _whichBuffer, _dstbuf) \ if (_pDraw->type == DRAWABLE_WINDOW)\ {\ int thisbuf = (_pDraw->id == _drawID);\ if (thisbuf != ((WindowPtr)_pDraw)->_whichBuffer)\ {\ ((WindowPtr)_pDraw)->_whichBuffer = thisbuf;\ DbeValidateBuffer((WindowPtr)_pDraw, _drawID, _dstbuf);\ }\ } #else /* want buffer bits, but don't need to call DbeValidateBuffer */ #define SET_DBE_BUF(_pDraw, _drawID, _whichBuffer, _dstbuf) \ if (_pDraw->type == DRAWABLE_WINDOW)\ {\ ((WindowPtr)_pDraw)->_whichBuffer = (_pDraw->id == _drawID);\ } #endif /* NEED_DBE_BUF_VALIDATE */ #else /* don't want buffer bits in window */ #define SET_DBE_DSTBUF(_pDraw, _drawID) /**/ #define SET_DBE_SRCBUF(_pDraw, _drawID) /**/ #endif /* NEED_DBE_BUF_BITS */ #define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, pGC, client)\ {\ SECURITY_VERIFY_GEOMETRABLE(pDraw, drawID, client, DixWriteAccess);\ SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixReadAccess);\ if ((pGC->depth != pDraw->depth) ||\ (pGC->pScreen != pDraw->pScreen))\ return (BadMatch);\ }\ SET_DBE_DSTBUF(pDraw, drawID);\ if (pGC->serialNumber != pDraw->serialNumber)\ ValidateGC(pDraw, pGC); #define WriteReplyToClient(pClient, size, pReply) { \ if ((pClient)->swapped) \ (*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \ (pClient, (int)(size), pReply); \ else WriteToClient(pClient, (int)(size), (pReply)); } #define WriteSwappedDataToClient(pClient, size, pbuf) \ if ((pClient)->swapped) \ (*(pClient)->pSwapReplyFunc)(pClient, (int)(size), pbuf); \ else WriteToClient (pClient, (int)(size), (pbuf)); typedef struct _TimeStamp *TimeStampPtr; #ifndef _XTYPEDEF_CLIENTPTR typedef struct _Client *ClientPtr; /* also in misc.h */ #define _XTYPEDEF_CLIENTPTR #endif typedef struct _WorkQueue *WorkQueuePtr; extern ClientPtr *clients; extern ClientPtr serverClient; extern int currentMaxClients; typedef int HWEventQueueType; typedef HWEventQueueType* HWEventQueuePtr; extern HWEventQueuePtr checkForInput[2]; typedef struct _TimeStamp { CARD32 months; /* really ~49.7 days */ CARD32 milliseconds; } TimeStamp; /* dispatch.c */ extern void SetInputCheck( HWEventQueuePtr /*c0*/, HWEventQueuePtr /*c1*/); extern void CloseDownClient( ClientPtr /*client*/); extern void UpdateCurrentTime(void); extern void UpdateCurrentTimeIf(void); extern void InitSelections(void); extern int dixDestroyPixmap( void * /*value*/, XID /*pid*/); extern void CloseDownRetainedResources(void); extern void InitClient( ClientPtr /*client*/, int /*i*/, void * /*ospriv*/); extern ClientPtr NextAvailableClient( void * /*ospriv*/); extern void SendErrorToClient( ClientPtr /*client*/, unsigned int /*majorCode*/, unsigned int /*minorCode*/, XID /*resId*/, int /*errorCode*/); extern void DeleteWindowFromAnySelections( WindowPtr /*pWin*/); extern void MarkClientException( ClientPtr /*client*/); extern int GetGeometry( ClientPtr /*client*/, xGetGeometryReply* /* wa */); extern int SendConnSetup( ClientPtr /*client*/, char* /*reason*/); extern int DoGetImage( ClientPtr /*client*/, int /*format*/, Drawable /*drawable*/, int /*x*/, int /*y*/, int /*width*/, int /*height*/, Mask /*planemask*/, xGetImageReply ** /*im_return*/); #if defined(DDXBEFORERESET) extern void ddxBeforeReset (void); #endif /* dixutils.c */ extern void CopyISOLatin1Lowered( char * /*dest*/, const char * /*source*/, int /*length*/); extern int CompareISOLatin1Lowered( unsigned char * /*a*/, int alen, unsigned char * /*b*/, int blen); #ifdef XCSECURITY extern WindowPtr SecurityLookupWindow( XID /*rid*/, ClientPtr /*client*/, Mask /*access_mode*/); extern void * SecurityLookupDrawable( XID /*rid*/, ClientPtr /*client*/, Mask /*access_mode*/); extern WindowPtr LookupWindow( XID /*rid*/, ClientPtr /*client*/); extern void * LookupDrawable( XID /*rid*/, ClientPtr /*client*/); #else extern WindowPtr LookupWindow( XID /*rid*/, ClientPtr /*client*/); extern void * LookupDrawable( XID /*rid*/, ClientPtr /*client*/); #define SecurityLookupWindow(rid, client, access_mode) \ LookupWindow(rid, client) #define SecurityLookupDrawable(rid, client, access_mode) \ LookupDrawable(rid, client) #endif /* XCSECURITY */ extern ClientPtr LookupClient( XID /*rid*/, ClientPtr /*client*/); extern void NoopDDA(void); extern int AlterSaveSetForClient( ClientPtr /*client*/, WindowPtr /*pWin*/, unsigned /*mode*/, Bool /*toRoot*/, Bool /*remap*/); extern void DeleteWindowFromAnySaveSet( WindowPtr /*pWin*/); extern void BlockHandler( void * /*pTimeout*/, void * /*pReadmask*/); extern void WakeupHandler( int /*result*/, void * /*pReadmask*/); typedef void (* WakeupHandlerProcPtr)( void * /* blockData */, int /* result */, void * /* pReadmask */); extern Bool RegisterBlockAndWakeupHandlers( BlockHandlerProcPtr /*blockHandler*/, WakeupHandlerProcPtr /*wakeupHandler*/, void * /*blockData*/); extern void RemoveBlockAndWakeupHandlers( BlockHandlerProcPtr /*blockHandler*/, WakeupHandlerProcPtr /*wakeupHandler*/, void * /*blockData*/); extern void InitBlockAndWakeupHandlers(void); extern void ProcessWorkQueue(void); extern void ProcessWorkQueueZombies(void); extern Bool QueueWorkProc( Bool (* /*function*/)( ClientPtr /*clientUnused*/, void * /*closure*/), ClientPtr /*client*/, void * /*closure*/ ); typedef Bool (* ClientSleepProcPtr)( ClientPtr /*client*/, void * /*closure*/); extern Bool ClientSleep( ClientPtr /*client*/, ClientSleepProcPtr /* function */, void * /*closure*/); #ifndef ___CLIENTSIGNAL_DEFINED___ #define ___CLIENTSIGNAL_DEFINED___ extern Bool ClientSignal( ClientPtr /*client*/); #endif /* ___CLIENTSIGNAL_DEFINED___ */ extern void ClientWakeup( ClientPtr /*client*/); extern Bool ClientIsAsleep( ClientPtr /*client*/); /* atom.c */ extern Atom MakeAtom( const char * /*string*/, unsigned /*len*/, Bool /*makeit*/); extern Bool ValidAtom( Atom /*atom*/); extern const char *NameForAtom( Atom /*atom*/); extern void AtomError(void); extern void FreeAllAtoms(void); extern void InitAtoms(void); /* events.c */ extern void SetMaskForEvent( Mask /* mask */, int /* event */); extern Bool IsParent( WindowPtr /* maybeparent */, WindowPtr /* child */); extern WindowPtr GetCurrentRootWindow(void); extern WindowPtr GetSpriteWindow(void); extern void NoticeEventTime(xEventPtr /* xE */); extern void EnqueueEvent( xEventPtr /* xE */, DeviceIntPtr /* device */, int /* count */); extern void ComputeFreezes(void); extern void CheckGrabForSyncs( DeviceIntPtr /* dev */, Bool /* thisMode */, Bool /* otherMode */); extern void ActivatePointerGrab( DeviceIntPtr /* mouse */, GrabPtr /* grab */, TimeStamp /* time */, Bool /* autoGrab */); extern void DeactivatePointerGrab( DeviceIntPtr /* mouse */); extern void ActivateKeyboardGrab( DeviceIntPtr /* keybd */, GrabPtr /* grab */, TimeStamp /* time */, Bool /* passive */); extern void DeactivateKeyboardGrab( DeviceIntPtr /* keybd */); extern void AllowSome( ClientPtr /* client */, TimeStamp /* time */, DeviceIntPtr /* thisDev */, int /* newState */); extern void ReleaseActiveGrabs( ClientPtr client); extern int DeliverEventsToWindow( WindowPtr /* pWin */, xEventPtr /* pEvents */, int /* count */, Mask /* filter */, GrabPtr /* grab */, int /* mskidx */); extern int DeliverDeviceEvents( WindowPtr /* pWin */, xEventPtr /* xE */, GrabPtr /* grab */, WindowPtr /* stopAt */, DeviceIntPtr /* dev */, int /* count */); extern void DefineInitialRootWindow( WindowPtr /* win */); extern void WindowHasNewCursor( WindowPtr /* pWin */); extern Bool CheckDeviceGrabs( DeviceIntPtr /* device */, xEventPtr /* xE */, int /* checkFirst */, int /* count */); extern void DeliverFocusedEvent( DeviceIntPtr /* keybd */, xEventPtr /* xE */, WindowPtr /* window */, int /* count */); extern void DeliverGrabbedEvent( xEventPtr /* xE */, DeviceIntPtr /* thisDev */, Bool /* deactivateGrab */, int /* count */); #ifdef XKB extern void FixKeyState( xEvent * /* xE */, DeviceIntPtr /* keybd */); #endif /* XKB */ extern void RecalculateDeliverableEvents( WindowPtr /* pWin */); extern int OtherClientGone( void * /* value */, XID /* id */); extern void DoFocusEvents( DeviceIntPtr /* dev */, WindowPtr /* fromWin */, WindowPtr /* toWin */, int /* mode */); extern int SetInputFocus( ClientPtr /* client */, DeviceIntPtr /* dev */, Window /* focusID */, CARD8 /* revertTo */, Time /* ctime */, Bool /* followOK */); extern int GrabDevice( ClientPtr /* client */, DeviceIntPtr /* dev */, unsigned /* this_mode */, unsigned /* other_mode */, Window /* grabWindow */, unsigned /* ownerEvents */, Time /* ctime */, Mask /* mask */, CARD8 * /* status */); extern void InitEvents(void); extern void CloseDownEvents(void); extern void DeleteWindowFromAnyEvents( WindowPtr /* pWin */, Bool /* freeResources */); extern Mask EventMaskForClient( WindowPtr /* pWin */, ClientPtr /* client */); extern int DeliverEvents( WindowPtr /*pWin*/, xEventPtr /*xE*/, int /*count*/, WindowPtr /*otherParent*/); extern void WriteEventsToClient( ClientPtr /*pClient*/, int /*count*/, xEventPtr /*events*/); extern int TryClientEvents( ClientPtr /*client*/, xEventPtr /*pEvents*/, int /*count*/, Mask /*mask*/, Mask /*filter*/, GrabPtr /*grab*/); extern void WindowsRestructured(void); #ifdef RANDR void ScreenRestructured (ScreenPtr pScreen); #endif extern void ResetClientPrivates(void); extern int AllocateClientPrivateIndex(void); extern Bool AllocateClientPrivate( int /*index*/, unsigned /*amount*/); /* * callback manager stuff */ #ifndef _XTYPEDEF_CALLBACKLISTPTR typedef struct _CallbackList *CallbackListPtr; /* also in misc.h */ #define _XTYPEDEF_CALLBACKLISTPTR #endif typedef void (*CallbackProcPtr) ( CallbackListPtr *, void *, void *); typedef Bool (*AddCallbackProcPtr) ( CallbackListPtr *, CallbackProcPtr, void *); typedef Bool (*DeleteCallbackProcPtr) ( CallbackListPtr *, CallbackProcPtr, void *); typedef void (*CallCallbacksProcPtr) ( CallbackListPtr *, void *); typedef void (*DeleteCallbackListProcPtr) ( CallbackListPtr *); typedef struct _CallbackProcs { AddCallbackProcPtr AddCallback; DeleteCallbackProcPtr DeleteCallback; CallCallbacksProcPtr CallCallbacks; DeleteCallbackListProcPtr DeleteCallbackList; } CallbackFuncsRec, *CallbackFuncsPtr; extern Bool CreateCallbackList( CallbackListPtr * /*pcbl*/, CallbackFuncsPtr /*cbfuncs*/); extern Bool AddCallback( CallbackListPtr * /*pcbl*/, CallbackProcPtr /*callback*/, void * /*data*/); extern Bool DeleteCallback( CallbackListPtr * /*pcbl*/, CallbackProcPtr /*callback*/, void * /*data*/); extern void CallCallbacks( CallbackListPtr * /*pcbl*/, void * /*call_data*/); extern void DeleteCallbackList( CallbackListPtr * /*pcbl*/); extern void InitCallbackManager(void); /* * ServerGrabCallback stuff */ extern CallbackListPtr ServerGrabCallback; typedef enum {SERVER_GRABBED, SERVER_UNGRABBED, CLIENT_PERVIOUS, CLIENT_IMPERVIOUS } ServerGrabState; typedef struct { ClientPtr client; ServerGrabState grabstate; } ServerGrabInfoRec; /* * EventCallback stuff */ extern CallbackListPtr EventCallback; typedef struct { ClientPtr client; xEventPtr events; int count; } EventInfoRec; /* * DeviceEventCallback stuff */ extern CallbackListPtr DeviceEventCallback; typedef struct { xEventPtr events; int count; } DeviceEventInfoRec; /* * SelectionCallback stuff */ extern CallbackListPtr SelectionCallback; typedef enum { SelectionSetOwner, SelectionWindowDestroy, SelectionClientClose } SelectionCallbackKind; typedef struct { struct _Selection *selection; SelectionCallbackKind kind; } SelectionInfoRec; #endif /* DIX_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/dixstruct.h0000644000000000000000000001344513614532331020427 0ustar /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef DIXSTRUCT_H #define DIXSTRUCT_H #include "client.h" #include "dix.h" #include "resource.h" #include "cursor.h" #include "gc.h" #include "pixmap.h" #include /* * direct-mapped hash table, used by resource manager to store * translation from client ids to server addresses. */ extern CallbackListPtr ClientStateCallback; typedef struct { ClientPtr client; xConnSetupPrefix *prefix; xConnSetup *setup; } NewClientInfoRec; typedef void (*ReplySwapPtr) ( ClientPtr /* pClient */, int /* size */, void * /* pbuf */); extern void ReplyNotSwappd ( ClientPtr /* pClient */, int /* size */, void * /* pbuf */); typedef enum {ClientStateInitial, ClientStateAuthenticating, ClientStateRunning, ClientStateRetained, ClientStateGone, ClientStateCheckingSecurity, ClientStateCheckedSecurity} ClientState; #ifdef XFIXES typedef struct _saveSet { struct _Window *windowPtr; Bool toRoot; Bool remap; } SaveSetElt; #define SaveSetWindow(ss) ((ss).windowPtr) #define SaveSetToRoot(ss) ((ss).toRoot) #define SaveSetRemap(ss) ((ss).remap) #define SaveSetAssignWindow(ss,w) ((ss).windowPtr = (w)) #define SaveSetAssignToRoot(ss,tr) ((ss).toRoot = (tr)) #define SaveSetAssignRemap(ss,rm) ((ss).remap = (rm)) #else typedef struct _Window *SaveSetElt; #define SaveSetWindow(ss) (ss) #define SaveSetToRoot(ss) FALSE #define SaveSetRemap(ss) TRUE #define SaveSetAssignWindow(ss,w) ((ss) = (w)) #define SaveSetAssignToRoot(ss,tr) #define SaveSetAssignRemap(ss,rm) #endif typedef struct _Client { int index; Mask clientAsMask; void *requestBuffer; void *osPrivate; /* for OS layer, including scheduler */ Bool swapped; Bool local; ReplySwapPtr pSwapReplyFunc; XID errorValue; int sequence; int closeDownMode; int clientGone; int noClientException; /* this client died or needs to be * killed */ SaveSetElt *saveSet; int numSaved; void *screenPrivate[MAXSCREENS]; int (**requestVector) ( ClientPtr /* pClient */); CARD32 req_len; /* length of current request */ Bool big_requests; /* supports large requests */ int priority; ClientState clientState; DevUnion *devPrivates; #ifdef XKB unsigned short xkbClientFlags; unsigned short mapNotifyMask; unsigned short newKeyboardNotifyMask; unsigned short vMajor,vMinor; KeyCode minKC,maxKC; #endif unsigned long replyBytesRemaining; #ifdef XCSECURITY XID authId; unsigned int trustLevel; void * (* CheckAccess)( ClientPtr /*pClient*/, XID /*id*/, RESTYPE /*classes*/, Mask /*access_mode*/, void * /*resourceval*/); #endif struct _FontResolution * (*fontResFunc) ( /* no need for font.h */ ClientPtr /* pClient */, int * /* num */); int smart_priority; long smart_start_tick; long smart_stop_tick; long smart_check_tick; ClientIdPtr clientIds; } ClientRec; /* * Scheduling interface */ extern long SmartScheduleTime; extern long SmartScheduleInterval; extern long SmartScheduleSlice; extern long SmartScheduleMaxSlice; #ifdef HAVE_SETITIMER #if HAVE_SETITIMER extern Bool SmartScheduleSignalEnable; #else #define SmartScheduleSignalEnable FALSE #endif #endif extern void SmartScheduleStartTimer(void); extern void SmartScheduleStopTimer(void); #define SMART_MAX_PRIORITY (20) #define SMART_MIN_PRIORITY (-20) extern void SmartScheduleInit(void); /* This prototype is used pervasively in Xext, dix */ #define DISPATCH_PROC(func) int func(ClientPtr /* client */) typedef struct _WorkQueue { struct _WorkQueue *next; Bool (*function) ( ClientPtr /* pClient */, void * /* closure */ ); ClientPtr client; void *closure; } WorkQueueRec; extern TimeStamp currentTime; extern TimeStamp lastDeviceEventTime; extern int CompareTimeStamps( TimeStamp /*a*/, TimeStamp /*b*/); extern TimeStamp ClientTimeToServerTime(CARD32 /*c*/); typedef struct _CallbackRec { CallbackProcPtr proc; void * data; Bool deleted; struct _CallbackRec *next; } CallbackRec, *CallbackPtr; typedef struct _CallbackList { CallbackFuncsRec funcs; int inCallback; Bool deleted; int numDeleted; CallbackPtr list; } CallbackListRec; /* proc vectors */ extern int (* InitialVector[3]) (ClientPtr /*client*/); extern int (* ProcVector[256]) (ClientPtr /*client*/); extern int (* SwappedProcVector[256]) (ClientPtr /*client*/); extern ReplySwapPtr ReplySwapVector[256]; extern int ProcBadRequest(ClientPtr /*client*/); #endif /* DIXSTRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/exevents.h0000644000000000000000000001403413614532331020232 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /******************************************************************** * Interface of 'exevents.c' */ #ifndef EXEVENTS_H #define EXEVENTS_H extern void RegisterOtherDevice ( DeviceIntPtr /* device */); extern void ProcessOtherEvent ( xEventPtr /* FIXME deviceKeyButtonPointer * xE */, DeviceIntPtr /* other */, int /* count */); extern int InitProximityClassDeviceStruct( DeviceIntPtr /* dev */); extern void InitValuatorAxisStruct( DeviceIntPtr /* dev */, int /* axnum */, int /* minval */, int /* maxval */, int /* resolution */, int /* min_res */, int /* max_res */); extern void DeviceFocusEvent( DeviceIntPtr /* dev */, int /* type */, int /* mode */, int /* detail */, WindowPtr /* pWin */); extern int GrabButton( ClientPtr /* client */, DeviceIntPtr /* dev */, BYTE /* this_device_mode */, BYTE /* other_devices_mode */, CARD16 /* modifiers */, DeviceIntPtr /* modifier_device */, CARD8 /* button */, Window /* grabWindow */, BOOL /* ownerEvents */, Cursor /* rcursor */, Window /* rconfineTo */, Mask /* eventMask */); extern int GrabKey( ClientPtr /* client */, DeviceIntPtr /* dev */, BYTE /* this_device_mode */, BYTE /* other_devices_mode */, CARD16 /* modifiers */, DeviceIntPtr /* modifier_device */, CARD8 /* key */, Window /* grabWindow */, BOOL /* ownerEvents */, Mask /* mask */); extern int SelectForWindow( DeviceIntPtr /* dev */, WindowPtr /* pWin */, ClientPtr /* client */, Mask /* mask */, Mask /* exclusivemasks */, Mask /* validmasks */); extern int AddExtensionClient ( WindowPtr /* pWin */, ClientPtr /* client */, Mask /* mask */, int /* mskidx */); extern void RecalculateDeviceDeliverableEvents( WindowPtr /* pWin */); extern int InputClientGone( WindowPtr /* pWin */, XID /* id */); extern int SendEvent ( ClientPtr /* client */, DeviceIntPtr /* d */, Window /* dest */, Bool /* propagate */, xEvent * /* ev */, Mask /* mask */, int /* count */); extern int SetButtonMapping ( ClientPtr /* client */, DeviceIntPtr /* dev */, int /* nElts */, BYTE * /* map */); extern int SetModifierMapping( ClientPtr /* client */, DeviceIntPtr /* dev */, int /* len */, int /* rlen */, int /* numKeyPerModifier */, KeyCode * /* inputMap */, KeyClassPtr * /* k */); extern void SendDeviceMappingNotify( CARD8 /* request, */, KeyCode /* firstKeyCode */, CARD8 /* count */, DeviceIntPtr /* dev */); extern int ChangeKeyMapping( ClientPtr /* client */, DeviceIntPtr /* dev */, unsigned /* len */, int /* type */, KeyCode /* firstKeyCode */, CARD8 /* keyCodes */, CARD8 /* keySymsPerKeyCode */, KeySym * /* map */); extern void DeleteWindowFromAnyExtEvents( WindowPtr /* pWin */, Bool /* freeResources */); extern void DeleteDeviceFromAnyExtEvents( WindowPtr /* pWin */, DeviceIntPtr /* dev */); extern int MaybeSendDeviceMotionNotifyHint ( deviceKeyButtonPointer * /* pEvents */, Mask /* mask */); extern void CheckDeviceGrabAndHintWindow ( WindowPtr /* pWin */, int /* type */, deviceKeyButtonPointer * /* xE */, GrabPtr /* grab */, ClientPtr /* client */, Mask /* deliveryMask */); extern Mask DeviceEventMaskForClient( DeviceIntPtr /* dev */, WindowPtr /* pWin */, ClientPtr /* client */); extern void MaybeStopDeviceHint( DeviceIntPtr /* dev */, ClientPtr /* client */); extern int DeviceEventSuppressForWindow( WindowPtr /* pWin */, ClientPtr /* client */, Mask /* mask */, int /* maskndx */); #endif /* EXEVENTS_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/extension.h0000644000000000000000000000560413614532331020410 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef EXTENSION_H #define EXTENSION_H _XFUNCPROTOBEGIN extern unsigned short StandardMinorOpcode(ClientPtr /*client*/); extern unsigned short MinorOpcodeOfRequest(ClientPtr /*client*/); extern Bool EnableDisableExtension(char *name, Bool enable); extern void EnableDisableExtensionError(char *name, Bool enable); extern void ResetExtensionPrivates(void); extern int AllocateExtensionPrivateIndex(void); extern Bool AllocateExtensionPrivate( int /*index*/, unsigned /*amount*/); extern void InitExtensions(int argc, char **argv); extern void InitVisualWrap(void); extern void CloseDownExtensions(void); _XFUNCPROTOEND #endif /* EXTENSION_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/extinit.h0000644000000000000000000000635013614532331020057 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /******************************************************************** * Interface of extinit.c */ #ifndef EXTINIT_H #define EXTINIT_H #include "extnsionst.h" void XInputExtensionInit( void ); int ProcIDispatch ( ClientPtr /* client */ ); int SProcIDispatch( ClientPtr /* client */ ); void SReplyIDispatch ( ClientPtr /* client */, int /* len */, xGrabDeviceReply * /* rep */ ); void SEventIDispatch ( xEvent * /* from */, xEvent * /* to */ ); void SEventDeviceValuator ( deviceValuator * /* from */, deviceValuator * /* to */ ); void SEventFocus ( deviceFocus * /* from */, deviceFocus * /* to */ ); void SDeviceStateNotifyEvent ( deviceStateNotify * /* from */, deviceStateNotify * /* to */ ); void SDeviceKeyStateNotifyEvent ( deviceKeyStateNotify * /* from */, deviceKeyStateNotify * /* to */ ); void SDeviceButtonStateNotifyEvent ( deviceButtonStateNotify * /* from */, deviceButtonStateNotify * /* to */ ); void SChangeDeviceNotifyEvent ( changeDeviceNotify * /* from */, changeDeviceNotify * /* to */ ); void SDeviceMappingNotifyEvent ( deviceMappingNotify * /* from */, deviceMappingNotify * /* to */ ); void FixExtensionEvents ( ExtensionEntry * /* extEntry */ ); void RestoreExtensionEvents ( void ); void IResetProc( ExtensionEntry * /* unused */ ); void AssignTypeAndName ( DeviceIntPtr /* dev */, Atom /* type */, char * /* name */ ); void MakeDeviceTypeAtoms ( void ); DeviceIntPtr LookupDeviceIntRec ( CARD8 /* id */ ); void SetExclusiveAccess ( Mask /* mask */ ); void AllowPropagateSuppress ( Mask /* mask */ ); Mask GetNextExtEventMask ( void ); void SetMaskForExtEvent( Mask /* mask */, int /* event */ ); void SetEventInfo( Mask /* mask */, int /* constant */ ); #endif /* EXTINIT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/extnsionst.h0000644000000000000000000001151013614532331020603 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef EXTENSIONSTRUCT_H #define EXTENSIONSTRUCT_H #include "dix.h" #include "misc.h" #include "screenint.h" #include "extension.h" #include "gc.h" typedef struct _ExtensionEntry { int index; void (* CloseDown)( /* called at server shutdown */ struct _ExtensionEntry * /* extension */); char *name; /* extension name */ int base; /* base request number */ int eventBase; int eventLast; int errorBase; int errorLast; int num_aliases; char **aliases; void * extPrivate; unsigned short (* MinorOpcode)( /* called for errors */ ClientPtr /* client */); #ifdef XCSECURITY Bool secure; /* extension visible to untrusted clients? */ #endif DevUnion *devPrivates; } ExtensionEntry; /* * The arguments may be different for extension event swapping functions. * Deal with this by casting when initializing the event's EventSwapVector[] * entries. */ typedef void (*EventSwapPtr) (xEvent *, xEvent *); extern EventSwapPtr EventSwapVector[128]; extern void NotImplemented ( /* FIXME: this may move to another file... */ xEvent *, xEvent *); typedef void (* ExtensionLookupProc)( #ifdef EXTENSION_PROC_ARGS EXTENSION_PROC_ARGS #else /* args no longer indeterminate */ char *name, GCPtr pGC #endif ); typedef struct _ProcEntry { char *name; ExtensionLookupProc proc; } ProcEntryRec, *ProcEntryPtr; typedef struct _ScreenProcEntry { int num; ProcEntryPtr procList; } ScreenProcEntry; #define SetGCVector(pGC, VectorElement, NewRoutineAddress, Atom) \ pGC->VectorElement = NewRoutineAddress; #define GetGCValue(pGC, GCElement) (pGC->GCElement) extern ExtensionEntry *AddExtension( char* /*name*/, int /*NumEvents*/, int /*NumErrors*/, int (* /*MainProc*/)(ClientPtr /*client*/), int (* /*SwappedMainProc*/)(ClientPtr /*client*/), void (* /*CloseDownProc*/)(ExtensionEntry * /*extension*/), unsigned short (* /*MinorOpcodeProc*/)(ClientPtr /*client*/) ); extern Bool AddExtensionAlias( char* /*alias*/, ExtensionEntry * /*extension*/); extern ExtensionEntry *CheckExtension(const char *extname); extern ExtensionEntry *GetExtensionEntry(int major); extern ExtensionLookupProc LookupProc( char* /*name*/, GCPtr /*pGC*/); extern Bool RegisterProc( char* /*name*/, GCPtr /*pGC*/, ExtensionLookupProc /*proc*/); extern Bool RegisterScreenProc( char* /*name*/, ScreenPtr /*pScreen*/, ExtensionLookupProc /*proc*/); extern void DeclareExtensionSecurity( char * /*extname*/, Bool /*secure*/); #endif /* EXTENSIONSTRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/gc.h0000644000000000000000000001237013614532331016763 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef GC_H #define GC_H #include /* for GContext, Mask */ #ifndef _XTYPEDEF_POINTER /* Don't let Xdefs.h define 'pointer' */ #define _XTYPEDEF_POINTER 1 #endif /* _XTYPEDEF_POINTER */ /* FIXME: for building this code against Xlib versions older than apprx. 04/2014 * we still have to define the pointer type via Xdefs.h. * * The nx-libs code itself does not require the pointer definition. */ #undef _XTYPEDEF_POINTER #include /* for Bool */ #include #include "screenint.h" /* for ScreenPtr */ #include "pixmap.h" /* for DrawablePtr */ /* clientClipType field in GC */ #define CT_NONE 0 #define CT_PIXMAP 1 #define CT_REGION 2 #define CT_UNSORTED 6 #define CT_YSORTED 10 #define CT_YXSORTED 14 #define CT_YXBANDED 18 #define GCQREASON_VALIDATE 1 #define GCQREASON_CHANGE 2 #define GCQREASON_COPY_SRC 3 #define GCQREASON_COPY_DST 4 #define GCQREASON_DESTROY 5 #define GC_CHANGE_SERIAL_BIT (((unsigned long)1)<<31) #define GC_CALL_VALIDATE_BIT (1L<<30) #define GCExtensionInterest (1L<<29) #define DRAWABLE_SERIAL_BITS (~(GC_CHANGE_SERIAL_BIT)) #define MAX_SERIAL_NUM (1L<<28) #define NEXT_SERIAL_NUMBER ((++globalSerialNumber) > MAX_SERIAL_NUM ? \ (globalSerialNumber = 1): globalSerialNumber) typedef struct _GCInterest *GCInterestPtr; typedef struct _GC *GCPtr; typedef struct _GCOps *GCOpsPtr; extern void ValidateGC( DrawablePtr /*pDraw*/, GCPtr /*pGC*/); extern int ChangeGC( GCPtr/*pGC*/, BITS32 /*mask*/, XID* /*pval*/); extern int DoChangeGC( GCPtr/*pGC*/, BITS32 /*mask*/, XID* /*pval*/, int /*fPointer*/); typedef union { CARD32 val; void * ptr; } ChangeGCVal, *ChangeGCValPtr; extern int dixChangeGC( ClientPtr /*client*/, GCPtr /*pGC*/, BITS32 /*mask*/, CARD32 * /*pval*/, ChangeGCValPtr /*pCGCV*/); extern GCPtr CreateGC( DrawablePtr /*pDrawable*/, BITS32 /*mask*/, XID* /*pval*/, int* /*pStatus*/); extern int CopyGC( GCPtr/*pgcSrc*/, GCPtr/*pgcDst*/, BITS32 /*mask*/); extern int FreeGC( void * /*pGC*/, XID /*gid*/); extern void SetGCMask( GCPtr /*pGC*/, Mask /*selectMask*/, Mask /*newDataMask*/); extern GCPtr CreateScratchGC( ScreenPtr /*pScreen*/, unsigned /*depth*/); extern void FreeGCperDepth( int /*screenNum*/); extern Bool CreateGCperDepth( int /*screenNum*/); extern Bool CreateDefaultStipple( int /*screenNum*/); extern void FreeDefaultStipple( int /*screenNum*/); extern int SetDashes( GCPtr /*pGC*/, unsigned /*offset*/, unsigned /*ndash*/, unsigned char* /*pdash*/); extern int VerifyRectOrder( int /*nrects*/, xRectangle* /*prects*/, int /*ordering*/); extern int SetClipRects( GCPtr /*pGC*/, int /*xOrigin*/, int /*yOrigin*/, int /*nrects*/, xRectangle* /*prects*/, int /*ordering*/); extern GCPtr GetScratchGC( unsigned /*depth*/, ScreenPtr /*pScreen*/); extern void FreeScratchGC( GCPtr /*pGC*/); #endif /* GC_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/gcstruct.h0000644000000000000000000002004213614532331020223 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef GCSTRUCT_H #define GCSTRUCT_H #include "gc.h" #include "regionstr.h" #include "region.h" #include "pixmap.h" #include "screenint.h" #include /* * functions which modify the state of the GC */ typedef struct _GCFuncs { void (* ValidateGC)( GCPtr /*pGC*/, unsigned long /*stateChanges*/, DrawablePtr /*pDrawable*/); void (* ChangeGC)( GCPtr /*pGC*/, unsigned long /*mask*/); void (* CopyGC)( GCPtr /*pGCSrc*/, unsigned long /*mask*/, GCPtr /*pGCDst*/); void (* DestroyGC)( GCPtr /*pGC*/); void (* ChangeClip)( GCPtr /*pGC*/, int /*type*/, void * /*pvalue*/, int /*nrects*/); void (* DestroyClip)( GCPtr /*pGC*/); void (* CopyClip)( GCPtr /*pgcDst*/, GCPtr /*pgcSrc*/); DevUnion devPrivate; } GCFuncs; /* * graphics operations invoked through a GC */ typedef struct _GCOps { void (* FillSpans)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/); void (* SetSpans)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, char * /*psrc*/, DDXPointPtr /*ppt*/, int * /*pwidth*/, int /*nspans*/, int /*fSorted*/); void (* PutImage)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*depth*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int /*leftPad*/, int /*format*/, char * /*pBits*/); RegionPtr (* CopyArea)( DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, GCPtr /*pGC*/, int /*srcx*/, int /*srcy*/, int /*w*/, int /*h*/, int /*dstx*/, int /*dsty*/); RegionPtr (* CopyPlane)( DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr /*pGC*/, int /*srcx*/, int /*srcy*/, int /*width*/, int /*height*/, int /*dstx*/, int /*dsty*/, unsigned long /*bitPlane*/); void (* PolyPoint)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/); void (* Polylines)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/); void (* PolySegment)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegs*/); void (* PolyRectangle)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nrects*/, xRectangle * /*pRects*/); void (* PolyArc)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/); void (* FillPolygon)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*shape*/, int /*mode*/, int /*count*/, DDXPointPtr /*pPts*/); void (* PolyFillRect)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nrectFill*/, xRectangle * /*prectInit*/); void (* PolyFillArc)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/); int (* PolyText8)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, char * /*chars*/); int (* PolyText16)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, unsigned short * /*chars*/); void (* ImageText8)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, char * /*chars*/); void (* ImageText16)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, unsigned short * /*chars*/); void (* ImageGlyphBlt)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, void * /*pglyphBase*/); void (* PolyGlyphBlt)( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, void * /*pglyphBase*/); void (* PushPixels)( GCPtr /*pGC*/, PixmapPtr /*pBitMap*/, DrawablePtr /*pDst*/, int /*w*/, int /*h*/, int /*x*/, int /*y*/); #ifdef NEED_LINEHELPER void (* LineHelper)(); #endif DevUnion devPrivate; } GCOps; /* there is padding in the bit fields because the Sun compiler doesn't * force alignment to 32-bit boundaries. losers. */ typedef struct _GC { ScreenPtr pScreen; unsigned char depth; unsigned char alu; unsigned short lineWidth; unsigned short dashOffset; unsigned short numInDashList; unsigned char *dash; unsigned int lineStyle : 2; unsigned int capStyle : 2; unsigned int joinStyle : 2; unsigned int fillStyle : 2; unsigned int fillRule : 1; unsigned int arcMode : 1; unsigned int subWindowMode : 1; unsigned int graphicsExposures : 1; unsigned int clientClipType : 2; /* CT_ */ unsigned int miTranslate:1; /* should mi things translate? */ unsigned int tileIsPixel:1; /* tile is solid pixel */ unsigned int fExpose:1; /* Call exposure handling */ unsigned int freeCompClip:1; /* Free composite clip */ unsigned int unused:14; /* see comment above */ unsigned long planemask; unsigned long fgPixel; unsigned long bgPixel; /* * alas -- both tile and stipple must be here as they * are independently specifiable */ PixUnion tile; PixmapPtr stipple; DDXPointRec patOrg; /* origin for (tile, stipple) */ struct _Font *font; DDXPointRec clipOrg; DDXPointRec lastWinOrg; /* position of window last validated */ void * clientClip; unsigned long stateChanges; /* masked with GC_ */ unsigned long serialNumber; GCFuncs *funcs; GCOps *ops; DevUnion *devPrivates; /* * The following were moved here from private storage to allow device- * independent access to them from screen wrappers. * --- 1997.11.03 Marc Aurele La France (tsi@xfree86.org) */ PixmapPtr pRotatedPixmap; /* tile/stipple rotated for alignment */ RegionPtr pCompositeClip; /* fExpose & freeCompClip defined above */ } GC; #endif /* GCSTRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/globals.h0000644000000000000000000000510713614532331020015 0ustar #ifndef _XSERV_GLOBAL_H_ #define _XSERV_GLOBAL_H_ #include "window.h" /* for WindowPtr */ /* Global X server variables that are visible to mi, dix, os, and ddx */ extern CARD32 defaultScreenSaverTime; extern CARD32 defaultScreenSaverInterval; extern CARD32 ScreenSaverTime; extern CARD32 ScreenSaverInterval; #ifdef SCREENSAVER extern Bool screenSaverSuspended; #endif extern char *defaultFontPath; extern int monitorResolution; extern Bool loadableFonts; extern int defaultColorVisualClass; extern int GrabInProgress; extern char *ConnectionInfo; extern Bool noTestExtensions; extern DDXPointRec dixScreenOrigins[MAXSCREENS]; #ifdef DPMSExtension extern CARD32 defaultDPMSStandbyTime; extern CARD32 defaultDPMSSuspendTime; extern CARD32 defaultDPMSOffTime; extern CARD32 DPMSStandbyTime; extern CARD32 DPMSSuspendTime; extern CARD32 DPMSOffTime; extern CARD16 DPMSPowerLevel; extern Bool defaultDPMSEnabled; extern Bool DPMSEnabled; extern Bool DPMSEnabledSwitch; extern Bool DPMSDisabledSwitch; extern Bool DPMSCapableFlag; #endif #ifdef PANORAMIX extern Bool PanoramiXMapped; extern Bool PanoramiXVisibilityNotifySent; extern Bool PanoramiXWindowExposureSent; extern Bool PanoramiXOneExposeRequest; extern Bool PanoramiXExtensionDisabledHack; #endif #ifdef BIGREQS extern Bool noBigReqExtension; #endif #ifdef COMPOSITE extern Bool noCompositeExtension; #endif #ifdef DAMAGE extern Bool noDamageExtension; #endif #ifdef DBE extern Bool noDbeExtension; #endif #ifdef DPMSExtension extern Bool noDPMSExtension; #endif #ifdef GLXEXT extern Bool noGlxExtension; #endif #ifdef SCREENSAVER extern Bool noScreenSaverExtension; #endif #ifdef MITSHM extern Bool noMITShmExtension; #endif #ifdef RANDR extern Bool noRRExtension; extern Bool noRRXineramaExtension; #endif #ifdef RENDER extern Bool noRenderExtension; #endif #ifdef SHAPE extern Bool noShapeExtension; #endif #ifdef XCSECURITY extern Bool noSecurityExtension; #endif #ifdef XSYNC extern Bool noSyncExtension; #endif #ifdef RES extern Bool noResExtension; #endif #ifdef XCMISC extern Bool noXCMiscExtension; #endif #ifdef XF86BIGFONT extern Bool noXFree86BigfontExtension; #endif #ifdef XF86DRI extern Bool noXFree86DRIExtension; #endif #ifdef XFIXES extern Bool noXFixesExtension; #endif #ifdef XKB /* |noXkbExtension| is defined in xc/programs/Xserver/xkb/xkbInit.c */ extern Bool noXkbExtension; #endif #ifdef PANORAMIX extern Bool noPanoramiXExtension; #endif #ifdef XINPUT extern Bool noXInputExtension; #endif #ifdef XIDLE extern Bool noXIdleExtension; #endif #ifdef XV extern Bool noXvExtension; #endif #endif /* !_XSERV_GLOBAL_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/Imakefile0000644000000000000000000000505713614532331020036 0ustar HEADERS = os.h misc.h #if defined(XorgVersion) \ || defined(BSDOSArchitecture) #endif LinkSourceFile(osdep.h,../os) #ifdef cygwinArchitecture LinkFile(xxwindow.h,window.h) #endif all:: depend:: InstallDriverSDKNonExecFile(XIstubs.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(Xprintf.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(bstore.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(bstorestr.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(client.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(colormap.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(colormapst.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(cursor.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(cursorstr.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(dix.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(dixstruct.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(exevents.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(extension.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(extnsionst.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(gc.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(gcstruct.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(globals.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(input.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(inputstr.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(list.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(misc.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(miscstruct.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(opaque.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(os.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(pixmap.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(pixmapstr.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(property.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(propertyst.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(region.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(regionstr.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(resource.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(screenint.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(scrnintstr.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(servermd.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(validate.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(window.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(windowstr.h,$(DRIVERSDKINCLUDEDIR)) BuildIncludes($(HEADERS),nx-X11,..) InstallMultipleFlags($(HEADERS),$(INCDIR)/nx-X11,$(INSTINCFLAGS)) nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/input.h0000644000000000000000000002374413614532331017540 0ustar /************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef INPUT_H #define INPUT_H #include "misc.h" #include "screenint.h" #include #include #include "window.h" /* for WindowPtr */ #define DEVICE_INIT 0 #define DEVICE_ON 1 #define DEVICE_OFF 2 #define DEVICE_CLOSE 3 #define MAP_LENGTH 256 #define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */ #define NullGrab ((GrabPtr)NULL) #define PointerRootWin ((WindowPtr)PointerRoot) #define NoneWin ((WindowPtr)None) #define NullDevice ((DevicePtr)NULL) #ifndef FollowKeyboard #define FollowKeyboard 3 #endif #ifndef FollowKeyboardWin #define FollowKeyboardWin ((WindowPtr) FollowKeyboard) #endif #ifndef RevertToFollowKeyboard #define RevertToFollowKeyboard 3 #endif typedef unsigned long Leds; typedef struct _OtherClients *OtherClientsPtr; typedef struct _InputClients *InputClientsPtr; typedef struct _DeviceIntRec *DeviceIntPtr; typedef int (*DeviceProc)( DeviceIntPtr /*device*/, int /*what*/); typedef void (*ProcessInputProc)( xEventPtr /*events*/, DeviceIntPtr /*device*/, int /*count*/); typedef Bool (*DeviceHandleProc)( DeviceIntPtr /*device*/, void* /*data*/ ); typedef void (*DeviceUnwrapProc)( DeviceIntPtr /*device*/, DeviceHandleProc /*proc*/, void* /*data*/ ); typedef struct _DeviceRec { void * devicePrivate; ProcessInputProc processInputProc; /* current */ ProcessInputProc realInputProc; /* deliver */ ProcessInputProc enqueueInputProc; /* enqueue */ Bool on; /* used by DDX to keep state */ } DeviceRec, *DevicePtr; typedef struct { int click, bell, bell_pitch, bell_duration; Bool autoRepeat; unsigned char autoRepeats[32]; Leds leds; unsigned char id; } KeybdCtrl; typedef struct { KeySym *map; KeyCode minKeyCode, maxKeyCode; int mapWidth; } KeySymsRec, *KeySymsPtr; typedef struct { int num, den, threshold; unsigned char id; } PtrCtrl; typedef struct { int resolution, min_value, max_value; int integer_displayed; unsigned char id; } IntegerCtrl; typedef struct { int max_symbols, num_symbols_supported; int num_symbols_displayed; KeySym *symbols_supported; KeySym *symbols_displayed; unsigned char id; } StringCtrl; typedef struct { int percent, pitch, duration; unsigned char id; } BellCtrl; typedef struct { Leds led_values; Mask led_mask; unsigned char id; } LedCtrl; extern int AllocateDevicePrivateIndex(void); extern Bool AllocateDevicePrivate(DeviceIntPtr device, int index); extern void ResetDevicePrivateIndex(void); extern KeybdCtrl defaultKeyboardControl; extern PtrCtrl defaultPointerControl; #undef AddInputDevice extern DevicePtr AddInputDevice( DeviceProc /*deviceProc*/, Bool /*autoStart*/); #define AddInputDevice(deviceProc, autoStart) \ _AddInputDevice(deviceProc, autoStart) extern DeviceIntPtr _AddInputDevice( DeviceProc /*deviceProc*/, Bool /*autoStart*/); extern Bool EnableDevice( DeviceIntPtr /*device*/); extern Bool DisableDevice( DeviceIntPtr /*device*/); extern int InitAndStartDevices(void); extern void CloseDownDevices(void); extern void RemoveDevice( DeviceIntPtr /*dev*/); extern int NumMotionEvents(void); #undef RegisterPointerDevice extern void RegisterPointerDevice( DevicePtr /*device*/); #define RegisterPointerDevice(device) \ _RegisterPointerDevice(device) extern void _RegisterPointerDevice( DeviceIntPtr /*device*/); #undef RegisterKeyboardDevice extern void RegisterKeyboardDevice( DevicePtr /*device*/); #define RegisterKeyboardDevice(device) \ _RegisterKeyboardDevice(device) extern void _RegisterKeyboardDevice( DeviceIntPtr /*device*/); extern DevicePtr LookupKeyboardDevice(void); extern DevicePtr LookupPointerDevice(void); extern DevicePtr LookupDevice( int /* id */); extern void QueryMinMaxKeyCodes( KeyCode* /*minCode*/, KeyCode* /*maxCode*/); extern Bool SetKeySymsMap( KeySymsPtr /*dst*/, KeySymsPtr /*src*/); extern Bool InitKeyClassDeviceStruct( DeviceIntPtr /*device*/, KeySymsPtr /*pKeySyms*/, CARD8 /*pModifiers*/[]); extern Bool InitButtonClassDeviceStruct( DeviceIntPtr /*device*/, int /*numButtons*/, CARD8* /*map*/); typedef int (*ValuatorMotionProcPtr)( DeviceIntPtr /*pdevice*/, xTimecoord * /*coords*/, unsigned long /*start*/, unsigned long /*stop*/, ScreenPtr /*pScreen*/); extern Bool InitValuatorClassDeviceStruct( DeviceIntPtr /*device*/, int /*numAxes*/, ValuatorMotionProcPtr /* motionProc */, int /*numMotionEvents*/, int /*mode*/); extern Bool InitFocusClassDeviceStruct( DeviceIntPtr /*device*/); typedef void (*BellProcPtr)( int /*percent*/, DeviceIntPtr /*device*/, void * /*ctrl*/, int); typedef void (*KbdCtrlProcPtr)( DeviceIntPtr /*device*/, KeybdCtrl * /*ctrl*/); extern Bool InitKbdFeedbackClassDeviceStruct( DeviceIntPtr /*device*/, BellProcPtr /*bellProc*/, KbdCtrlProcPtr /*controlProc*/); typedef void (*PtrCtrlProcPtr)( DeviceIntPtr /*device*/, PtrCtrl * /*ctrl*/); extern Bool InitPtrFeedbackClassDeviceStruct( DeviceIntPtr /*device*/, PtrCtrlProcPtr /*controlProc*/); typedef void (*StringCtrlProcPtr)( DeviceIntPtr /*device*/, StringCtrl * /*ctrl*/); extern Bool InitStringFeedbackClassDeviceStruct( DeviceIntPtr /*device*/, StringCtrlProcPtr /*controlProc*/, int /*max_symbols*/, int /*num_symbols_supported*/, KeySym* /*symbols*/); typedef void (*BellCtrlProcPtr)( DeviceIntPtr /*device*/, BellCtrl * /*ctrl*/); extern Bool InitBellFeedbackClassDeviceStruct( DeviceIntPtr /*device*/, BellProcPtr /*bellProc*/, BellCtrlProcPtr /*controlProc*/); typedef void (*LedCtrlProcPtr)( DeviceIntPtr /*device*/, LedCtrl * /*ctrl*/); extern Bool InitLedFeedbackClassDeviceStruct( DeviceIntPtr /*device*/, LedCtrlProcPtr /*controlProc*/); typedef void (*IntegerCtrlProcPtr)( DeviceIntPtr /*device*/, IntegerCtrl * /*ctrl*/); extern Bool InitIntegerFeedbackClassDeviceStruct( DeviceIntPtr /*device*/, IntegerCtrlProcPtr /*controlProc*/); extern Bool InitPointerDeviceStruct( DevicePtr /*device*/, CARD8* /*map*/, int /*numButtons*/, ValuatorMotionProcPtr /*motionProc*/, PtrCtrlProcPtr /*controlProc*/, int /*numMotionEvents*/); extern Bool InitKeyboardDeviceStruct( DevicePtr /*device*/, KeySymsPtr /*pKeySyms*/, CARD8 /*pModifiers*/[], BellProcPtr /*bellProc*/, KbdCtrlProcPtr /*controlProc*/); extern void SendMappingNotify( unsigned int /*request*/, unsigned int /*firstKeyCode*/, unsigned int /*count*/, ClientPtr /* client */); extern Bool BadDeviceMap( BYTE* /*buff*/, int /*length*/, unsigned /*low*/, unsigned /*high*/, XID* /*errval*/); extern Bool AllModifierKeysAreUp( DeviceIntPtr /*device*/, CARD8* /*map1*/, int /*per1*/, CARD8* /*map2*/, int /*per2*/); extern void NoteLedState( DeviceIntPtr /*keybd*/, int /*led*/, Bool /*on*/); extern void MaybeStopHint( DeviceIntPtr /*device*/, ClientPtr /*client*/); extern void ProcessPointerEvent( xEventPtr /*xE*/, DeviceIntPtr /*mouse*/, int /*count*/); extern void ProcessKeyboardEvent( xEventPtr /*xE*/, DeviceIntPtr /*keybd*/, int /*count*/); #ifdef XKB extern void CoreProcessPointerEvent( xEventPtr /*xE*/, DeviceIntPtr /*mouse*/, int /*count*/); extern void CoreProcessKeyboardEvent( xEventPtr /*xE*/, DeviceIntPtr /*keybd*/, int /*count*/); #endif extern Bool LegalModifier( unsigned int /*key*/, DevicePtr /*pDev*/); extern void ProcessInputEvents(void); extern void InitInput( int /*argc*/, char ** /*argv*/); #endif /* INPUT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/inputstr.h0000644000000000000000000002312613614532331020263 0ustar /************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef INPUTSTRUCT_H #define INPUTSTRUCT_H #include "input.h" #include "window.h" #include "dixstruct.h" #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))) #define SameClient(obj,client) \ (CLIENT_BITS((obj)->resource) == (client)->clientAsMask) #define MAX_DEVICES 20 #define EMASKSIZE MAX_DEVICES /* Kludge: OtherClients and InputClients must be compatible, see code */ typedef struct _OtherClients { OtherClientsPtr next; XID resource; /* id for putting into resource manager */ Mask mask; } OtherClients; typedef struct _InputClients { InputClientsPtr next; XID resource; /* id for putting into resource manager */ Mask mask[EMASKSIZE]; } InputClients; typedef struct _OtherInputMasks { Mask deliverableEvents[EMASKSIZE]; Mask inputEvents[EMASKSIZE]; Mask dontPropagateMask[EMASKSIZE]; InputClientsPtr inputClients; } OtherInputMasks; /* * The following structure gets used for both active and passive grabs. For * active grabs some of the fields (e.g. modifiers) are not used. However, * that is not much waste since there aren't many active grabs (one per * keyboard/pointer device) going at once in the server. */ #define MasksPerDetailMask 8 /* 256 keycodes and 256 possible modifier combinations, but only 3 buttons. */ typedef struct _DetailRec { /* Grab details may be bit masks */ unsigned short exact; Mask *pMask; } DetailRec; typedef struct _GrabRec { GrabPtr next; /* for chain of passive grabs */ XID resource; DeviceIntPtr device; WindowPtr window; unsigned ownerEvents:1; unsigned keyboardMode:1; unsigned pointerMode:1; unsigned coreGrab:1; /* grab is on core device */ unsigned coreMods:1; /* modifiers are on core keyboard */ CARD8 type; /* event type */ DetailRec modifiersDetail; DeviceIntPtr modifierDevice; DetailRec detail; /* key or button */ WindowPtr confineTo; /* always NULL for keyboards */ CursorPtr cursor; /* always NULL for keyboards */ Mask eventMask; } GrabRec; typedef struct _KeyClassRec { CARD8 down[DOWN_LENGTH]; KeyCode *modifierKeyMap; KeySymsRec curKeySyms; int modifierKeyCount[8]; CARD8 modifierMap[MAP_LENGTH]; CARD8 maxKeysPerModifier; unsigned short state; unsigned short prev_state; #ifdef XKB struct _XkbSrvInfo *xkbInfo; #endif } KeyClassRec, *KeyClassPtr; typedef struct _AxisInfo { int resolution; int min_resolution; int max_resolution; int min_value; int max_value; } AxisInfo, *AxisInfoPtr; typedef struct _ValuatorClassRec { ValuatorMotionProcPtr GetMotionProc; int numMotionEvents; WindowPtr motionHintWindow; AxisInfoPtr axes; unsigned short numAxes; int *axisVal; /* the next two are only written by xtest and never read currently. They exist to satisfy the compiler. Once Xi is updated, too, they will be a regular member anyway */ int lastx, lasty; /* last event recorded, not posted to * client; see dix/devices.c */ CARD8 mode; } ValuatorClassRec, *ValuatorClassPtr; typedef struct _ButtonClassRec { CARD8 numButtons; CARD8 buttonsDown; /* number of buttons currently down */ unsigned short state; Mask motionMask; CARD8 down[DOWN_LENGTH]; CARD8 map[MAP_LENGTH]; #ifdef XKB union _XkbAction * xkb_acts; #endif } ButtonClassRec, *ButtonClassPtr; typedef struct _FocusClassRec { WindowPtr win; int revert; TimeStamp time; WindowPtr *trace; int traceSize; int traceGood; } FocusClassRec, *FocusClassPtr; typedef struct _ProximityClassRec { char pad; } ProximityClassRec, *ProximityClassPtr; typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr; typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr; typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr; typedef struct _StringFeedbackClassRec *StringFeedbackPtr; typedef struct _BellFeedbackClassRec *BellFeedbackPtr; typedef struct _LedFeedbackClassRec *LedFeedbackPtr; typedef struct _KbdFeedbackClassRec { BellProcPtr BellProc; KbdCtrlProcPtr CtrlProc; KeybdCtrl ctrl; KbdFeedbackPtr next; #ifdef XKB struct _XkbSrvLedInfo *xkb_sli; #endif } KbdFeedbackClassRec; typedef struct _PtrFeedbackClassRec { PtrCtrlProcPtr CtrlProc; PtrCtrl ctrl; PtrFeedbackPtr next; } PtrFeedbackClassRec; typedef struct _IntegerFeedbackClassRec { IntegerCtrlProcPtr CtrlProc; IntegerCtrl ctrl; IntegerFeedbackPtr next; } IntegerFeedbackClassRec; typedef struct _StringFeedbackClassRec { StringCtrlProcPtr CtrlProc; StringCtrl ctrl; StringFeedbackPtr next; } StringFeedbackClassRec; typedef struct _BellFeedbackClassRec { BellProcPtr BellProc; BellCtrlProcPtr CtrlProc; BellCtrl ctrl; BellFeedbackPtr next; } BellFeedbackClassRec; typedef struct _LedFeedbackClassRec { LedCtrlProcPtr CtrlProc; LedCtrl ctrl; LedFeedbackPtr next; #ifdef XKB struct _XkbSrvLedInfo *xkb_sli; #endif } LedFeedbackClassRec; /* states for devices */ #define NOT_GRABBED 0 #define THAWED 1 #define THAWED_BOTH 2 /* not a real state */ #define FREEZE_NEXT_EVENT 3 #define FREEZE_BOTH_NEXT_EVENT 4 #define FROZEN 5 /* any state >= has device frozen */ #define FROZEN_NO_EVENT 5 #define FROZEN_WITH_EVENT 6 #define THAW_OTHERS 7 typedef struct _DeviceIntRec { DeviceRec public; DeviceIntPtr next; TimeStamp grabTime; Bool startup; /* true if needs to be turned on at server intialization time */ DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is used to initialize, turn on, or turn off the device */ Bool inited; /* TRUE if INIT returns Success */ GrabPtr grab; /* the grabber - used by DIX */ struct { Bool frozen; int state; GrabPtr other; /* if other grab has this frozen */ xEvent *event; /* saved to be replayed */ int evcount; } sync; Atom type; char *name; CARD8 id; CARD8 activatingKey; Bool fromPassiveGrab; GrabRec activeGrab; void (*ActivateGrab) ( DeviceIntPtr /*device*/, GrabPtr /*grab*/, TimeStamp /*time*/, Bool /*autoGrab*/); void (*DeactivateGrab)( DeviceIntPtr /*device*/); KeyClassPtr key; ValuatorClassPtr valuator; ButtonClassPtr button; FocusClassPtr focus; ProximityClassPtr proximity; KbdFeedbackPtr kbdfeed; PtrFeedbackPtr ptrfeed; IntegerFeedbackPtr intfeed; StringFeedbackPtr stringfeed; BellFeedbackPtr bell; LedFeedbackPtr leds; #ifdef XKB struct _XkbInterest * xkb_interest; #endif DevUnion *devPrivates; int nPrivates; DeviceUnwrapProc unwrapProc; } DeviceIntRec; typedef struct { int numDevices; /* total number of devices */ DeviceIntPtr devices; /* all devices turned on */ DeviceIntPtr off_devices; /* all devices turned off */ DeviceIntPtr keyboard; /* the main one for the server */ DeviceIntPtr pointer; } InputInfo; extern InputInfo inputInfo; /* for keeping the events for devices grabbed synchronously */ typedef struct _QdEvent *QdEventPtr; typedef struct _QdEvent { QdEventPtr next; DeviceIntPtr device; ScreenPtr pScreen; /* what screen the pointer was on */ unsigned long months; /* milliseconds is in the event */ xEvent *event; int evcount; } QdEventRec; #endif /* INPUTSTRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/list.h0000644000000000000000000003546413614532331017356 0ustar /* * Copyright © 2010 Intel Corporation * Copyright © 2010 Francisco Jerez * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * */ #ifndef _XORG_LIST_H_ #define _XORG_LIST_H_ #include /* offsetof() */ /** * @file Classic doubly-link circular list implementation. * For real usage examples of the linked list, see the file test/list.c * * Example: * We need to keep a list of struct foo in the parent struct bar, i.e. what * we want is something like this. * * struct bar { * ... * struct foo *list_of_foos; -----> struct foo {}, struct foo {}, struct foo{} * ... * } * * We need one list head in bar and a list element in all list_of_foos (both are of * data type 'struct xorg_list'). * * struct bar { * ... * struct xorg_list list_of_foos; * ... * } * * struct foo { * ... * struct xorg_list entry; * ... * } * * Now we initialize the list head: * * struct bar bar; * ... * xorg_list_init(&bar.list_of_foos); * * Then we create the first element and add it to this list: * * struct foo *foo = malloc(...); * .... * xorg_list_add(&foo->entry, &bar.list_of_foos); * * Repeat the above for each element you want to add to the list. Deleting * works with the element itself. * xorg_list_del(&foo->entry); * free(foo); * * Note: calling xorg_list_del(&bar.list_of_foos) will set bar.list_of_foos to an empty * list again. * * Looping through the list requires a 'struct foo' as iterator and the * name of the field the subnodes use. * * struct foo *iterator; * xorg_list_for_each_entry(iterator, &bar.list_of_foos, entry) { * if (iterator->something == ...) * ... * } * * Note: You must not call xorg_list_del() on the iterator if you continue the * loop. You need to run the safe for-each loop instead: * * struct foo *iterator, *next; * xorg_list_for_each_entry_safe(iterator, next, &bar.list_of_foos, entry) { * if (...) * xorg_list_del(&iterator->entry); * } * */ /** * The linkage struct for list nodes. This struct must be part of your * to-be-linked struct. struct xorg_list is required for both the head of the * list and for each list node. * * Position and name of the struct xorg_list field is irrelevant. * There are no requirements that elements of a list are of the same type. * There are no requirements for a list head, any struct xorg_list can be a list * head. */ struct xorg_list { struct xorg_list *next, *prev; }; /** * Initialize the list as an empty list. * * Example: * xorg_list_init(&bar->list_of_foos); * * @param list The list to initialize */ static inline void xorg_list_init(struct xorg_list *list) { list->next = list->prev = list; } static inline void __xorg_list_add(struct xorg_list *entry, struct xorg_list *prev, struct xorg_list *next) { next->prev = entry; entry->next = next; entry->prev = prev; prev->next = entry; } /** * Insert a new element after the given list head. The new element does not * need to be initialised as empty list. * The list changes from: * head → some element → ... * to * head → new element → older element → ... * * Example: * struct foo *newfoo = malloc(...); * xorg_list_add(&newfoo->entry, &bar->list_of_foos); * * @param entry The new element to prepend to the list. * @param head The existing list. */ static inline void xorg_list_add(struct xorg_list *entry, struct xorg_list *head) { __xorg_list_add(entry, head, head->next); } /** * Append a new element to the end of the list given with this list head. * * The list changes from: * head → some element → ... → lastelement * to * head → some element → ... → lastelement → new element * * Example: * struct foo *newfoo = malloc(...); * xorg_list_append(&newfoo->entry, &bar->list_of_foos); * * @param entry The new element to prepend to the list. * @param head The existing list. */ static inline void xorg_list_append(struct xorg_list *entry, struct xorg_list *head) { __xorg_list_add(entry, head->prev, head); } static inline void __xorg_list_del(struct xorg_list *prev, struct xorg_list *next) { next->prev = prev; prev->next = next; } /** * Remove the element from the list it is in. Using this function will reset * the pointers to/from this element so it is removed from the list. It does * NOT free the element itself or manipulate it otherwise. * * Using xorg_list_del on a pure list head (like in the example at the top of * this file) will NOT remove the first element from * the list but rather reset the list as empty list. * * Example: * xorg_list_del(&foo->entry); * * @param entry The element to remove. */ static inline void xorg_list_del(struct xorg_list *entry) { __xorg_list_del(entry->prev, entry->next); xorg_list_init(entry); } /** * Check if the list is empty. * * Example: * xorg_list_is_empty(&bar->list_of_foos); * * @return True if the list contains one or more elements or False otherwise. */ static inline int xorg_list_is_empty(struct xorg_list *head) { return head->next == head; } /** * Returns a pointer to the container of this list element. * * Example: * struct foo* f; * f = container_of(&foo->entry, struct foo, entry); * assert(f == foo); * * @param ptr Pointer to the struct xorg_list. * @param type Data type of the list element. * @param member Member name of the struct xorg_list field in the list element. * @return A pointer to the data struct containing the list head. */ #ifndef container_of #define container_of(ptr, type, member) \ (type *)((char *)(ptr) - offsetof(type, member)) #endif /** * Alias of container_of */ #define xorg_list_entry(ptr, type, member) \ container_of(ptr, type, member) /** * Retrieve the first list entry for the given list pointer. * * Example: * struct foo *first; * first = xorg_list_first_entry(&bar->list_of_foos, struct foo, list_of_foos); * * @param ptr The list head * @param type Data type of the list element to retrieve * @param member Member name of the struct xorg_list field in the list element. * @return A pointer to the first list element. */ #define xorg_list_first_entry(ptr, type, member) \ xorg_list_entry((ptr)->next, type, member) /** * Retrieve the last list entry for the given listpointer. * * Example: * struct foo *first; * first = xorg_list_last_entry(&bar->list_of_foos, struct foo, list_of_foos); * * @param ptr The list head * @param type Data type of the list element to retrieve * @param member Member name of the struct xorg_list field in the list element. * @return A pointer to the last list element. */ #define xorg_list_last_entry(ptr, type, member) \ xorg_list_entry((ptr)->prev, type, member) #ifdef HAVE_TYPEOF #define __container_of(ptr, sample, member) \ container_of(ptr, typeof(*sample), member) #else /* This implementation of __container_of has undefined behavior according * to the C standard, but it works in many cases. If your compiler doesn't * support typeof() and fails with this implementation, please try a newer * compiler. */ #define __container_of(ptr, sample, member) \ (void *)((char *)(ptr) \ - ((char *)&(sample)->member - (char *)(sample))) #endif /** * Loop through the list given by head and set pos to struct in the list. * * Example: * struct foo *iterator; * xorg_list_for_each_entry(iterator, &bar->list_of_foos, entry) { * [modify iterator] * } * * This macro is not safe for node deletion. Use xorg_list_for_each_entry_safe * instead. * * @param pos Iterator variable of the type of the list elements. * @param head List head * @param member Member name of the struct xorg_list in the list elements. * */ #define xorg_list_for_each_entry(pos, head, member) \ for (pos = NULL, \ pos = __container_of((head)->next, pos, member); \ &pos->member != (head); \ pos = __container_of(pos->member.next, pos, member)) /** * Loop through the list, keeping a backup pointer to the element. This * macro allows for the deletion of a list element while looping through the * list. * * See xorg_list_for_each_entry for more details. */ #define xorg_list_for_each_entry_safe(pos, tmp, head, member) \ for (pos = NULL, \ pos = __container_of((head)->next, pos, member), \ tmp = __container_of(pos->member.next, pos, member); \ &pos->member != (head); \ pos = tmp, tmp = __container_of(pos->member.next, tmp, member)) /* NULL-Terminated List Interface * * The interface below does _not_ use the struct xorg_list as described above. * It is mainly for legacy structures that cannot easily be switched to * struct xorg_list. * * This interface is for structs like * struct foo { * [...] * struct foo *next; * [...] * }; * * The position and field name of "next" are arbitrary. */ /** * Init the element as null-terminated list. * * Example: * struct foo *list = malloc(); * nt_list_init(list, next); * * @param list The list element that will be the start of the list * @param member Member name of the field pointing to next struct */ #define nt_list_init(_list, _member) \ (_list)->_member = NULL /** * Returns the next element in the list or NULL on termination. * * Example: * struct foo *element = list; * while ((element = nt_list_next(element, next)) { } * * This macro is not safe for node deletion. Use nt_list_for_each_entry_safe * instead. * * @param list The list or current element. * @param member Member name of the field pointing to next struct. */ #define nt_list_next(_list, _member) \ (_list)->_member /** * Iterate through each element in the list. * * Example: * struct foo *iterator; * nt_list_for_each_entry(iterator, list, next) { * [modify iterator] * } * * @param entry Assigned to the current list element * @param list The list to iterate through. * @param member Member name of the field pointing to next struct. */ #define nt_list_for_each_entry(_entry, _list, _member) \ for (_entry = _list; _entry; _entry = (_entry)->_member) /** * Iterate through each element in the list, keeping a backup pointer to the * element. This macro allows for the deletion of a list element while * looping through the list. * * See nt_list_for_each_entry for more details. * * @param entry Assigned to the current list element * @param tmp The pointer to the next element * @param list The list to iterate through. * @param member Member name of the field pointing to next struct. */ #define nt_list_for_each_entry_safe(_entry, _tmp, _list, _member) \ for (_entry = _list, _tmp = (_entry) ? (_entry)->_member : NULL;\ _entry; \ _entry = _tmp, _tmp = (_tmp) ? (_tmp)->_member: NULL) /** * Append the element to the end of the list. This macro may be used to * merge two lists. * * Example: * struct foo *elem = malloc(...); * nt_list_init(elem, next) * nt_list_append(elem, list, struct foo, next); * * Resulting list order: * list_item_0 -> list_item_1 -> ... -> elem_item_0 -> elem_item_1 ... * * @param entry An entry (or list) to append to the list * @param list The list to append to. This list must be a valid list, not * NULL. * @param type The list type * @param member Member name of the field pointing to next struct */ #define nt_list_append(_entry, _list, _type, _member) \ do { \ _type *__iterator = _list; \ while (__iterator->_member) { __iterator = __iterator->_member;}\ __iterator->_member = _entry; \ } while (0) /** * Insert the element at the next position in the list. This macro may be * used to insert a list into a list. * * struct foo *elem = malloc(...); * nt_list_init(elem, next) * nt_list_insert(elem, list, struct foo, next); * * Resulting list order: * list_item_0 -> elem_item_0 -> elem_item_1 ... -> list_item_1 -> ... * * @param entry An entry (or list) to append to the list * @param list The list to insert to. This list must be a valid list, not * NULL. * @param type The list type * @param member Member name of the field pointing to next struct */ #define nt_list_insert(_entry, _list, _type, _member) \ do { \ nt_list_append((_list)->_member, _entry, _type, _member); \ (_list)->_member = _entry; \ } while (0) /** * Delete the entry from the list by iterating through the list and * removing any reference from the list to the entry. * * Example: * struct foo *elem = * nt_list_del(elem, list, struct foo, next); * * @param entry The entry to delete from the list. entry is always * re-initialized as a null-terminated list. * @param list The list containing the entry, set to the new list without * the removed entry. * @param type The list type * @param member Member name of the field pointing to the next entry */ #define nt_list_del(_entry, _list, _type, _member) \ do { \ _type *__e = _entry; \ if (__e == NULL || _list == NULL) break; \ if ((_list) == __e) { \ _list = __e->_member; \ } else { \ _type *__prev = _list; \ while (__prev->_member && __prev->_member != __e) \ __prev = nt_list_next(__prev, _member); \ if (__prev->_member) \ __prev->_member = __e->_member; \ } \ nt_list_init(__e, _member); \ } while(0) /** * DO NOT USE THIS. * This is a remainder of the xfree86 DDX attempt of having a set of generic * list functions. Unfortunately, the xf86OptionRec uses it and we can't * easily get rid of it. Do not use for new code. */ typedef struct generic_list_rec { void *next; } GenericListRec, *GenericListPtr, *glp; #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/misc.h0000644000000000000000000002635613614532331017336 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Copyright 1992, 1993 Data General Corporation; Copyright 1992, 1993 OMRON Corporation Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that neither the name OMRON or DATA GENERAL be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission of the party whose name is to be used. Neither OMRON or DATA GENERAL make any representation about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. OMRON AND DATA GENERAL EACH DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL OMRON OR DATA GENERAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef MISC_H #define MISC_H 1 /* * X internal definitions * */ extern unsigned long globalSerialNumber; extern unsigned long serverGeneration; #include #include #include #include #include #ifndef _XTYPEDEF_POINTER /* Don't let Xdefs.h define 'pointer' */ #define _XTYPEDEF_POINTER 1 #endif /* _XTYPEDEF_POINTER */ /* FIXME: for building this code against Xlib versions older than apprx. 04/2014 * we still have to define the pointer type via Xdefs.h. * * The nx-libs code itself does not require the pointer definition. * */ #undef _XTYPEDEF_POINTER #include #ifndef NULL #include #endif #ifndef MAXSCREENS #define MAXSCREENS 16 #endif #define MAXCLIENTS 256 #define MAXDITS 1 #define MAXEXTENSIONS 128 #define MAXFORMATS 8 #define MAXVISUALS_PER_SCREEN 50 typedef unsigned long PIXEL; typedef unsigned long ATOM; #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif #ifndef _XTYPEDEF_CALLBACKLISTPTR typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */ #define _XTYPEDEF_CALLBACKLISTPTR #endif typedef struct _xReq *xReqPtr; #include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */ #include /* for bcopy, bzero, and bcmp */ #define NullBox ((BoxPtr)0) #define MILLI_PER_MIN (1000 * 60) #define MILLI_PER_SECOND (1000) /* this next is used with None and ParentRelative to tell PaintWin() what to use to paint the background. Also used in the macro IS_VALID_PIXMAP */ #define USE_BACKGROUND_PIXEL 3 #define USE_BORDER_PIXEL 3 /* byte swap a 32-bit literal */ #define lswapl(x) ((((x) & 0xff) << 24) |\ (((x) & 0xff00) << 8) |\ (((x) & 0xff0000) >> 8) |\ (((x) >> 24) & 0xff)) /* byte swap a short literal */ #define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff)) #undef min #undef max #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b)) /* abs() is a function, not a macro; include the file declaring * it in case we haven't done that yet. */ #include #ifndef Fabs #define Fabs(a) ((a) > 0.0 ? (a) : -(a)) /* floating absolute value */ #endif #define sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0)) /* this assumes b > 0 */ #define modulus(a, b, d) if (((d) = (a) % (b)) < 0) (d) += (b) /* * return the least significant bit in x which is set * * This works on 1's complement and 2's complement machines. * If you care about the extra instruction on 2's complement * machines, change to ((x) & (-(x))) */ #define lowbit(x) ((x) & (~(x) + 1)) /* XXX Not for modules */ #include #if !defined(MAXSHORT) || !defined(MINSHORT) || \ !defined(MAXINT) || !defined(MININT) /* * Some implementations #define these through , so preclude * #include'ing it later. */ #include #endif #undef MAXSHORT #define MAXSHORT SHRT_MAX #undef MINSHORT #define MINSHORT SHRT_MIN #undef MAXINT #define MAXINT INT_MAX #undef MININT #define MININT INT_MIN #include #include #include /* for fopen, etc... */ /** * Calculate the number of bytes needed to hold bits. * @param bits The minimum number of bits needed. * @return The number of bytes needed to hold bits. */ static __inline__ int bits_to_bytes(const int bits) { return ((bits + 7) >> 3); } /** * Calculate the number of 4-byte units needed to hold the given number of * bytes. * @param bytes The minimum number of bytes needed. * @return The number of 4-byte units needed to hold bytes. */ static __inline__ int bytes_to_int32(const int bytes) { return (((bytes) + 3) >> 2); } /** * Calculate the number of bytes (in multiples of 4) needed to hold bytes. * @param bytes The minimum number of bytes needed. * @return The closest multiple of 4 that is equal or higher than bytes. */ static __inline__ int pad_to_int32(const int bytes) { return (((bytes) + 3) & ~3); } /** * Compare the two version numbers comprising of major.minor. * * @return A value less than 0 if a is less than b, 0 if a is equal to b, * or a value greater than 0 */ static inline int version_compare(uint32_t a_major, uint32_t a_minor, uint32_t b_major, uint32_t b_minor) { if (a_major > b_major) return 1; if (a_major < b_major) return -1; if (a_minor > b_minor) return 1; if (a_minor < b_minor) return -1; return 0; } /* some macros to help swap requests, replies, and events */ #define LengthRestB(stuff) \ ((client->req_len << 2) - sizeof(*stuff)) #define LengthRestS(stuff) \ ((client->req_len << 1) - (sizeof(*stuff) >> 1)) #define LengthRestL(stuff) \ (client->req_len - (sizeof(*stuff) >> 2)) #define SwapRestS(stuff) \ SwapShorts((short *)(stuff + 1), LengthRestS(stuff)) #define SwapRestL(stuff) \ SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff)) #if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) void __attribute__ ((error("wrong sized variable passed to swap"))) wrong_size(void); #else static inline void wrong_size(void) { } #endif #if !(defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) static inline int __builtin_constant_p(int x) { return 0; } #endif /* byte swap a 64-bit value */ static inline void swap_uint64(uint64_t *x) { char n; n = ((char *) x)[0]; ((char *) x)[0] = ((char *) x)[7]; ((char *) x)[7] = n; n = ((char *) x)[1]; ((char *) x)[1] = ((char *) x)[6]; ((char *) x)[6] = n; n = ((char *) x)[2]; ((char *) x)[2] = ((char *) x)[5]; ((char *) x)[5] = n; n = ((char *) x)[3]; ((char *) x)[3] = ((char *) x)[4]; ((char *) x)[4] = n; } #define swapll(x) do { \ if (sizeof(*(x)) != 8) \ wrong_size(); \ swap_uint64((uint64_t *)(x)); \ } while (0) /* byte swap a 32-bit value */ static inline void swap_uint32(uint32_t * x) { char n = ((char *) x)[0]; ((char *) x)[0] = ((char *) x)[3]; ((char *) x)[3] = n; n = ((char *) x)[1]; ((char *) x)[1] = ((char *) x)[2]; ((char *) x)[2] = n; } #define swapl(x) do { \ if (sizeof(*(x)) != 4) \ wrong_size(); \ if (__builtin_constant_p((uintptr_t)(x) & 3) && ((uintptr_t)(x) & 3) == 0) \ *(x) = lswapl(*(x)); \ else \ swap_uint32((uint32_t *)(x)); \ } while (0) /* byte swap a 16-bit value */ static inline void swap_uint16(uint16_t * x) { char n = ((char *) x)[0]; ((char *) x)[0] = ((char *) x)[1]; ((char *) x)[1] = n; } #define swaps(x) do { \ if (sizeof(*(x)) != 2) \ wrong_size(); \ if (__builtin_constant_p((uintptr_t)(x) & 1) && ((uintptr_t)(x) & 1) == 0) \ *(x) = lswaps(*(x)); \ else \ swap_uint16((uint16_t *)(x)); \ } while (0) /* copy 32-bit value from src to dst byteswapping on the way */ #define cpswapl(src, dst) do { \ if (sizeof((src)) != 4 || sizeof((dst)) != 4) \ wrong_size(); \ (dst) = lswapl((src)); \ } while (0) /* copy short from src to dst byteswapping on the way */ #define cpswaps(src, dst) do { \ if (sizeof((src)) != 2 || sizeof((dst)) != 2) \ wrong_size(); \ (dst) = lswaps((src)); \ } while (0) extern void SwapLongs( CARD32 *list, unsigned long count); extern void SwapShorts( short *list, unsigned long count); extern void MakePredeclaredAtoms(void); extern int Ones( unsigned long /*mask*/); typedef struct _xPoint *DDXPointPtr; typedef struct pixman_box16 *BoxPtr; typedef struct _xEvent *xEventPtr; typedef struct _xRectangle *xRectanglePtr; typedef struct _GrabRec *GrabPtr; /* typedefs from other places - duplicated here to minimize the amount * of unnecessary junk that one would normally have to include to get * these symbols defined */ #ifndef _XTYPEDEF_CHARINFOPTR typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */ #define _XTYPEDEF_CHARINFOPTR #endif #endif /* MISC_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/miscstruct.h0000644000000000000000000000575113614532331020577 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef MISCSTRUCT_H #define MISCSTRUCT_H 1 #include #include "misc.h" #include #include "gc.h" typedef xPoint DDXPointRec; typedef struct pixman_box16 BoxRec; typedef union _DevUnion { void * ptr; long val; unsigned long uval; RegionPtr (*fptr)( DrawablePtr /* pSrcDrawable */, DrawablePtr /* pDstDrawable */, GCPtr /* pGC */, int /* srcx */, int /* srcy */, int /* width */, int /* height */, int /* dstx */, int /* dsty */, unsigned long /* bitPlane */); } DevUnion; #endif /* MISCSTRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/opaque.h0000644000000000000000000000454513614532331017671 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef OPAQUE_H #define OPAQUE_H #include #include "globals.h" extern char *defaultTextFont; extern char *defaultCursorFont; extern int MaxClients; extern volatile char isItTimeToYield; extern volatile char dispatchException; /* bit values for dispatchException */ #define DE_RESET 1 #define DE_TERMINATE 2 #define DE_PRIORITYCHANGE 4 /* set when a client's priority changes */ extern CARD32 TimeOutValue; extern int ScreenSaverBlanking; extern int ScreenSaverAllowExposures; extern int defaultScreenSaverBlanking; extern int defaultScreenSaverAllowExposures; extern int argcGlobal; extern char **argvGlobal; extern char *display; extern int displayfd; extern Bool explicit_display; extern int defaultBackingStore; extern Bool disableBackingStore; extern Bool enableBackingStore; extern Bool disableSaveUnders; extern Bool PartialNetwork; #ifndef NOLOGOHACK extern int logoScreenSaver; #endif #ifdef RLIMIT_DATA extern int limitDataSpace; #endif #ifdef RLIMIT_STACK extern int limitStackSpace; #endif #ifdef RLIMIT_NOFILE extern int limitNoFile; #endif extern Bool defeatAccessControl; extern long maxBigRequestSize; extern Bool blackRoot; extern Bool whiteRoot; extern Bool CoreDump; extern Bool NoListenAll; #endif /* OPAQUE_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/os.h0000644000000000000000000003745213614532331017023 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef OS_H #define OS_H #include "misc.h" #include #define NullFID ((FID) 0) #define SCREEN_SAVER_ON 0 #define SCREEN_SAVER_OFF 1 #define SCREEN_SAVER_FORCER 2 #define SCREEN_SAVER_CYCLE 3 #ifndef MAX_REQUEST_SIZE #define MAX_REQUEST_SIZE 65535 #endif #ifndef MAX_BIG_REQUEST_SIZE #define MAX_BIG_REQUEST_SIZE 4194303 #endif typedef void * FID; typedef struct _FontPathRec *FontPathPtr; typedef struct _NewClientRec *NewClientPtr; #ifndef xnfalloc #define xnfalloc(size) XNFalloc((unsigned long)(size)) #define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size)) #define xnfrealloc(ptr, size) XNFrealloc((void *)(ptr), (unsigned long)(size)) #define xstrdup(s) Xstrdup(s) #define xnfstrdup(s) XNFstrdup(s) #define xallocarray(num, size) reallocarray(NULL, (num), (size)) #endif #ifdef __SCO__ #include #endif #include /* have to put $(SIGNAL_DEFINES) in DEFINES in Imakefile to get this right */ #ifdef SIGNALRETURNSINT #define SIGVAL int #else #define SIGVAL void #endif extern void (*OsVendorVErrorFProc)(const char *, va_list args); extern int WaitForSomething( int* /*pClientsReady*/ ); extern int ReadRequestFromClient(ClientPtr /*client*/); extern Bool InsertFakeRequest( ClientPtr /*client*/, char* /*data*/, int /*count*/); extern void ResetCurrentRequest(ClientPtr /*client*/); extern void FlushAllOutput(void); extern void FlushIfCriticalOutputPending(void); extern void SetCriticalOutputPending(void); extern int WriteToClient(ClientPtr /*who*/, int /*count*/, const void* /*__buf*/); extern void ResetOsBuffers(void); extern void InitConnectionLimits(void); extern void NotifyParentProcess(void); extern void CreateWellKnownSockets(void); extern void ResetWellKnownSockets(void); extern void CloseWellKnownConnections(void); extern XID AuthorizationIDOfClient(ClientPtr /*client*/); extern char *ClientAuthorized( ClientPtr /*client*/, unsigned int /*proto_n*/, char* /*auth_proto*/, unsigned int /*string_n*/, char* /*auth_string*/); extern void CheckConnections(void); extern void CloseDownConnection(ClientPtr /*client*/); typedef void (*NotifyFdProcPtr)(int fd, int ready, void *data); #define X_NOTIFY_NONE 0 #define X_NOTIFY_READ 1 #define X_NOTIFY_WRITE 2 extern Bool SetNotifyFd(int fd, NotifyFdProcPtr notify_fd, int mask, void *data); static inline void RemoveNotifyFd(int fd) { (void) SetNotifyFd(fd, NULL, X_NOTIFY_NONE, NULL); } extern void OnlyListenToOneClient(ClientPtr /*client*/); extern void ListenToAllClients(void); extern void IgnoreClient(ClientPtr /*client*/); extern void AttendClient(ClientPtr /*client*/); extern void MakeClientGrabImpervious(ClientPtr /*client*/); extern void MakeClientGrabPervious(ClientPtr /*client*/); extern void AvailableClientInput(ClientPtr /* client */); extern CARD32 GetTimeInMillis(void); extern void AdjustWaitForDelay( void * /*waitTime*/, unsigned long /*newdelay*/); typedef struct _OsTimerRec *OsTimerPtr; typedef CARD32 (*OsTimerCallback)( OsTimerPtr /* timer */, CARD32 /* time */, void * /* arg */); extern void TimerInit(void); extern Bool TimerForce(OsTimerPtr /* timer */); #define TimerAbsolute (1<<0) #define TimerForceOld (1<<1) extern OsTimerPtr TimerSet( OsTimerPtr /* timer */, int /* flags */, CARD32 /* millis */, OsTimerCallback /* func */, void * /* arg */); extern void TimerCheck(void); extern void TimerCancel(OsTimerPtr /* pTimer */); extern void TimerFree(OsTimerPtr /* pTimer */); extern void SetScreenSaverTimer(void); extern void FreeScreenSaverTimer(void); #ifdef DPMSExtension extern void SetDPMSTimers(void); extern void FreeDPMSTimers(void); #endif extern SIGVAL AutoResetServer(int /*sig*/); extern SIGVAL GiveUp(int /*sig*/); extern void UseMsg(void); extern void InitGlobals(void); extern void ProcessCommandLine(int /*argc*/, char* /*argv*/[]); extern int set_font_authorizations( char ** /* authorizations */, int * /*authlen */, void * /* client */); extern void * XNFalloc(unsigned long /*amount*/); extern void * XNFcalloc(unsigned long /*amount*/); extern void * XNFrealloc(void * /*ptr*/, unsigned long /*amount*/); extern void OsInitAllocator(void); extern char *Xstrdup(const char *s); extern char *XNFstrdup(const char *s); /* Include new X*asprintf API */ #include "Xprintf.h" /* Older api deprecated in favor of the asprintf versions */ extern _X_EXPORT char *Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED; extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED; extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED; extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED; typedef SIGVAL (*OsSigHandlerPtr)(int /* sig */); extern OsSigHandlerPtr OsSignal(int /* sig */, OsSigHandlerPtr /* handler */); extern int auditTrailLevel; #ifdef SERVER_LOCK extern void LockServer(void); extern void UnlockServer(void); #endif extern int OsLookupColor( int /*screen*/, char * /*name*/, unsigned /*len*/, unsigned short * /*pred*/, unsigned short * /*pgreen*/, unsigned short * /*pblue*/); extern void OsInit(void); extern void OsCleanup(Bool); extern void OsVendorFatalError(void); extern void OsVendorInit(void); extern int OsInitColors(void); void OsBlockSignals (void); void OsReleaseSignals (void); #if !defined(WIN32) extern int System(char *); extern void * Popen(char *, char *); extern int Pclose(void *); extern void * Fopen(char *, char *); extern int Fclose(void *); #else #define System(a) system(a) #define Popen(a,b) popen(a,b) #define Pclose(a) pclose(a) #define Fopen(a,b) fopen(a,b) #define Fclose(a) fclose(a) #endif extern void CheckUserParameters(int argc, char **argv, char **envp); extern void CheckUserAuthorization(void); extern int AddHost( ClientPtr /*client*/, int /*family*/, unsigned /*length*/, void * /*pAddr*/); extern Bool ForEachHostInFamily ( int /*family*/, Bool (* /*func*/ )( unsigned char * /* addr */, short /* len */, void * /* closure */), void * /*closure*/); extern int RemoveHost( ClientPtr /*client*/, int /*family*/, unsigned /*length*/, void * /*pAddr*/); extern int GetHosts( void ** /*data*/, int * /*pnHosts*/, int * /*pLen*/, BOOL * /*pEnabled*/); typedef struct sockaddr * sockaddrPtr; extern int InvalidHost(sockaddrPtr /*saddr*/, int /*len*/, ClientPtr client); extern int LocalClientCred(ClientPtr, int *, int *); #define LCC_UID_SET (1 << 0) #define LCC_GID_SET (1 << 1) #define LCC_PID_SET (1 << 2) #define LCC_ZID_SET (1 << 3) typedef struct { int fieldsSet; /* Bit mask of fields set */ int euid; /* Effective uid */ int egid; /* Primary effective group id */ int nSuppGids; /* Number of supplementary group ids */ int *pSuppGids; /* Array of supplementary group ids */ int pid; /* Process id */ int zoneid; /* Only set on Solaris 10 & later */ } LocalClientCredRec; extern int GetLocalClientCreds(ClientPtr, LocalClientCredRec **); extern void FreeLocalClientCreds(LocalClientCredRec *); extern int ChangeAccessControl(ClientPtr /*client*/, int /*fEnabled*/); extern int GetAccessControl(void); extern void AddLocalHosts(void); extern void ResetHosts(char *display); extern void EnableLocalHost(void); extern void DisableLocalHost(void); extern void AccessUsingXdmcp(void); extern void DefineSelf(int /*fd*/); extern void AugmentSelf(void * /*from*/, int /*len*/); extern void InitAuthorization(char * /*filename*/); /* extern int LoadAuthorization(void); */ extern void RegisterAuthorizations(void); extern XID AuthorizationToID ( unsigned short name_length, char *name, unsigned short data_length, char *data); extern int AuthorizationFromID ( XID id, unsigned short *name_lenp, char **namep, unsigned short *data_lenp, char **datap); extern XID CheckAuthorization( unsigned int /*namelength*/, char * /*name*/, unsigned int /*datalength*/, char * /*data*/, ClientPtr /*client*/, char ** /*reason*/ ); extern void ResetAuthorization(void); extern int RemoveAuthorization ( unsigned short name_length, char *name, unsigned short data_length, char *data); extern int AddAuthorization( unsigned int /*name_length*/, char * /*name*/, unsigned int /*data_length*/, char * /*data*/); extern XID GenerateAuthorization( unsigned int /* name_length */, char * /* name */, unsigned int /* data_length */, char * /* data */, unsigned int * /* data_length_return */, char ** /* data_return */); #ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS extern void ExpandCommandLine(int * /*pargc*/, char *** /*pargv*/); #endif extern void ddxInitGlobals(void); extern int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/); extern void ddxUseMsg(void); /* * idiom processing stuff */ extern xReqPtr PeekNextRequest(xReqPtr req, ClientPtr client, Bool readmore); extern void SkipRequests(xReqPtr req, ClientPtr client, int numskipped); /* int ReqLen(xReq *req, ClientPtr client) * Given a pointer to a *complete* request, return its length in bytes. * Note that if the request is a big request (as defined in the Big * Requests extension), the macro lies by returning 4 less than the * length that it actually occupies in the request buffer. This is so you * can blindly compare the length with the various sz_ constants * in Xproto.h without having to know/care about big requests. */ #define ReqLen(_pxReq, _client) \ ((_pxReq->length ? \ (_client->swapped ? lswaps(_pxReq->length) : _pxReq->length) \ : ((_client->swapped ? \ lswapl(((CARD32*)_pxReq)[1]) : ((CARD32*)_pxReq)[1])-1) \ ) << 2) /* otherReqTypePtr CastxReq(xReq *req, otherReqTypePtr) * Cast the given request to one of type otherReqTypePtr to access * fields beyond the length field. */ #define CastxReq(_pxReq, otherReqTypePtr) \ (_pxReq->length ? (otherReqTypePtr)_pxReq \ : (otherReqTypePtr)(((CARD32*)_pxReq)+1)) /* stuff for SkippedRequestsCallback */ extern CallbackListPtr SkippedRequestsCallback; typedef struct { xReqPtr req; ClientPtr client; int numskipped; } SkippedRequestInfoRec; /* stuff for ReplyCallback */ extern CallbackListPtr ReplyCallback; typedef struct { ClientPtr client; const void * replyData; unsigned long dataLenBytes; unsigned long bytesRemaining; Bool startOfReply; } ReplyInfoRec; /* stuff for FlushCallback */ extern CallbackListPtr FlushCallback; extern void AbortDDX(void); extern void ddxGiveUp(void); extern int TimeSinceLastInputEvent(void); #ifndef HAVE_REALLOCARRAY #define reallocarray xreallocarray extern _X_EXPORT void * reallocarray(void *optr, size_t nmemb, size_t size); #endif #ifndef HAVE_STRLCPY extern _X_EXPORT size_t strlcpy(char *dst, const char *src, size_t siz); extern _X_EXPORT size_t strlcat(char *dst, const char *src, size_t siz); #endif #ifndef HAVE_TIMINGSAFE_MEMCMP extern _X_EXPORT int timingsafe_memcmp(const void *b1, const void *b2, size_t len); #endif /* Logging. */ typedef enum _LogParameter { XLOG_FLUSH, XLOG_SYNC, XLOG_VERBOSITY, XLOG_FILE_VERBOSITY } LogParameter; /* Flags for log messages. */ typedef enum { X_PROBED, /* Value was probed */ X_CONFIG, /* Value was given in the config file */ X_DEFAULT, /* Value is a default */ X_CMDLINE, /* Value was given on the command line */ X_NOTICE, /* Notice */ X_ERROR, /* Error message */ X_WARNING, /* Warning message */ X_INFO, /* Informational message */ X_NONE, /* No prefix */ X_NOT_IMPLEMENTED, /* Not implemented */ X_UNKNOWN = -1 /* unknown -- this must always be last */ } MessageType; /* XXX Need to check which GCC versions have the format(printf) attribute. */ #if defined(__GNUC__) && \ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4))) #define _printf_attribute(a,b) __attribute((format(__printf__,a,b))) #else #define _printf_attribute(a,b) /**/ #endif extern const char *LogInit(const char *fname, const char *backup); extern void LogSetDisplay(void); extern void LogClose(void); extern Bool LogSetParameter(LogParameter param, int value); extern void LogVWrite(int verb, const char *f, va_list args); extern void LogWrite(int verb, const char *f, ...) _printf_attribute(2,3); extern void LogVMessageVerb(MessageType type, int verb, const char *format, va_list args); extern void LogMessageVerb(MessageType type, int verb, const char *format, ...) _printf_attribute(3,4); extern void LogMessage(MessageType type, const char *format, ...) _printf_attribute(2,3); extern void FreeAuditTimer(void); extern void AuditF(const char *f, ...) _printf_attribute(1,2); extern void VAuditF(const char *f, va_list args); extern void FatalError(const char *f, ...) _printf_attribute(1,2) #if defined(__GNUC__) && \ ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4))) __attribute((noreturn)) #endif ; extern void VErrorF(const char *f, va_list args); extern void ErrorF(const char *f, ...) _printf_attribute(1,2); extern void Error(char *str); extern void LogPrintMarkers(void); #if defined(NEED_SNPRINTF) extern int snprintf(char *str, size_t size, const char *format, ...) _printf_attribute(3,4); extern int vsnprintf(char *str, size_t size, const char *format, va_list ap); #endif #ifdef DEBUG #define DebugF ErrorF #else #define DebugF(...) /* */ #endif #endif /* OS_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/pixmap.h0000644000000000000000000000707413614532331017675 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef PIXMAP_H #define PIXMAP_H #include "misc.h" #include "screenint.h" /* types for Drawable */ #define DRAWABLE_WINDOW 0 #define DRAWABLE_PIXMAP 1 #define UNDRAWABLE_WINDOW 2 #define DRAWABLE_BUFFER 3 /* flags to PaintWindow() */ #define PW_BACKGROUND 0 #define PW_BORDER 1 #define NullPixmap ((PixmapPtr)0) typedef struct _Drawable *DrawablePtr; typedef struct _Pixmap *PixmapPtr; typedef union _PixUnion { PixmapPtr pixmap; unsigned long pixel; } PixUnion; #define SamePixUnion(a,b,isPixel)\ ((isPixel) ? (a).pixel == (b).pixel : (a).pixmap == (b).pixmap) #define EqualPixUnion(as, a, bs, b) \ ((as) == (bs) && (SamePixUnion (a, b, as))) #define OnScreenDrawable(type) \ ((type == DRAWABLE_WINDOW) || (type == DRAWABLE_BUFFER)) #define WindowDrawable(type) \ ((type == DRAWABLE_WINDOW) || (type == UNDRAWABLE_WINDOW)) extern PixmapPtr GetScratchPixmapHeader( ScreenPtr /*pScreen*/, int /*width*/, int /*height*/, int /*depth*/, int /*bitsPerPixel*/, int /*devKind*/, void * /*pPixData*/); extern void FreeScratchPixmapHeader( PixmapPtr /*pPixmap*/); extern Bool CreateScratchPixmapsForScreen( int /*scrnum*/); extern void FreeScratchPixmapsForScreen( int /*scrnum*/); extern PixmapPtr AllocatePixmap( ScreenPtr /*pScreen*/, int /*pixDataSize*/); #endif /* PIXMAP_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/pixmapstr.h0000644000000000000000000000656613614532331020433 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef PIXMAPSTRUCT_H #define PIXMAPSTRUCT_H #include #include "pixmap.h" #include "screenint.h" #include "regionstr.h" /* * The padN members are unfortunate ABI BC. See fdo bug #6924. */ typedef struct _Drawable { unsigned char type; /* DRAWABLE_ */ unsigned char class; /* specific to type */ unsigned char depth; unsigned char bitsPerPixel; #if defined(_XSERVER64) XID pad0; #endif XID id; /* resource id */ #if defined(_XSERVER64) XID pad1; #endif short x; /* window: screen absolute, pixmap: 0 */ short y; /* window: screen absolute, pixmap: 0 */ unsigned short width; unsigned short height; ScreenPtr pScreen; unsigned long serialNumber; } DrawableRec; /* * PIXMAP -- device dependent */ typedef struct _Pixmap { DrawableRec drawable; int refcnt; int devKind; DevUnion devPrivate; #ifdef PIXPRIV DevUnion *devPrivates; /* real devPrivates like gcs & windows */ #endif #ifdef COMPOSITE short screen_x; short screen_y; #endif unsigned usage_hint; /* see CREATE_PIXMAP_USAGE_* */ } PixmapRec; #endif /* PIXMAPSTRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/property.h0000644000000000000000000000531113614532331020253 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef PROPERTY_H #define PROPERTY_H #include "window.h" typedef struct _Property *PropertyPtr; extern int ChangeWindowProperty( WindowPtr /*pWin*/, Atom /*property*/, Atom /*type*/, int /*format*/, int /*mode*/, unsigned long /*len*/, void * /*value*/, Bool /*sendevent*/); extern int DeleteProperty( WindowPtr /*pWin*/, Atom /*propName*/); extern void DeleteAllWindowProperties( WindowPtr /*pWin*/); #endif /* PROPERTY_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/propertyst.h0000644000000000000000000000532113614532331020623 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef PROPERTYSTRUCT_H #define PROPERTYSTRUCT_H #include "misc.h" #include "property.h" /* * PROPERTY -- property element */ typedef struct _Property { struct _Property *next; ATOM propertyName; ATOM type; /* ignored by server */ short format; /* format of data for swapping - 8,16,32 */ long size; /* size of data in (format/8) bytes */ void *data; /* private to client */ } PropertyRec; #endif /* PROPERTYSTRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/protocol-versions.h0000644000000000000000000001225213614532331022100 0ustar /* * Copyright © 2009 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * */ /** * This file specifies the server-supported protocol versions. */ #ifndef PROTOCOL_VERSIONS_H #define PROTOCOL_VERSIONS_H #ifdef NXAGENT_SERVER # define XTRANS_SEND_FDS 0 #endif /* Composite */ #define SERVER_COMPOSITE_MAJOR_VERSION 0 #define SERVER_COMPOSITE_MINOR_VERSION 4 /* Damage */ #define SERVER_DAMAGE_MAJOR_VERSION 1 #ifndef NXAGENT_SERVER #define SERVER_DAMAGE_MINOR_VERSION 1 #else /* !defined(NXAGENT_SERVER) */ #define SERVER_DAMAGE_MINOR_VERSION 0 #endif /* !defined(NXAGENT_SERVER) */ #ifndef NXAGENT_SERVER /* DRI3 */ #define SERVER_DRI3_MAJOR_VERSION 1 #define SERVER_DRI3_MINOR_VERSION 0 #endif /* !defined(NXAGENT_SERVER) */ #ifndef NXAGENT_SERVER /* DMX */ #define SERVER_DMX_MAJOR_VERSION 2 #define SERVER_DMX_MINOR_VERSION 2 #define SERVER_DMX_PATCH_VERSION 20040604 #endif /* !defined(NXAGENT_SERVER) */ #ifndef NXAGENT_SERVER /* Generic event extension */ #define SERVER_GE_MAJOR_VERSION 1 #define SERVER_GE_MINOR_VERSION 0 #endif /* !defined(NXAGENT_SERVER) */ /* GLX */ #define SERVER_GLX_MAJOR_VERSION 1 #ifndef NXAGENT_SERVER #define SERVER_GLX_MINOR_VERSION 4 #else #define SERVER_GLX_MINOR_VERSION 2 #endif /* Xinerama */ #define SERVER_PANORAMIX_MAJOR_VERSION 1 #define SERVER_PANORAMIX_MINOR_VERSION 1 #ifndef NXAGENT_SERVER /* Present */ #define SERVER_PRESENT_MAJOR_VERSION 1 #define SERVER_PRESENT_MINOR_VERSION 0 #endif /* !defined(NXAGENT_SERVER) */ /* RandR */ #define SERVER_RANDR_MAJOR_VERSION 1 #define SERVER_RANDR_MINOR_VERSION 5 /* Record */ #define SERVER_RECORD_MAJOR_VERSION 1 #define SERVER_RECORD_MINOR_VERSION 13 /* Render */ #define SERVER_RENDER_MAJOR_VERSION 0 #ifndef NXAGENT_SERVER #define SERVER_RENDER_MINOR_VERSION 11 #else /* !defined(NXAGENT_SERVER) */ #define SERVER_RENDER_MINOR_VERSION 10 #endif /* !defined(NXAGENT_SERVER) */ /* RandR Xinerama */ #define SERVER_RRXINERAMA_MAJOR_VERSION 1 #define SERVER_RRXINERAMA_MINOR_VERSION 1 /* Screensaver */ #define SERVER_SAVER_MAJOR_VERSION 1 #define SERVER_SAVER_MINOR_VERSION 1 /* Security */ #define SERVER_SECURITY_MAJOR_VERSION 1 #define SERVER_SECURITY_MINOR_VERSION 0 /* Shape */ #define SERVER_SHAPE_MAJOR_VERSION 1 #define SERVER_SHAPE_MINOR_VERSION 1 /* SHM */ #define SERVER_SHM_MAJOR_VERSION 1 #ifndef NXAGENT_SERVER #if XTRANS_SEND_FDS #define SERVER_SHM_MINOR_VERSION 2 #else #define SERVER_SHM_MINOR_VERSION 1 #endif #else /* !defined(NXAGENT_SERVER) */ #define SERVER_SHM_MINOR_VERSION 1 #endif /* !defined(NXAGENT_SERVER) */ /* Sync */ #define SERVER_SYNC_MAJOR_VERSION 3 #ifndef NXAGENT_SERVER #define SERVER_SYNC_MINOR_VERSION 1 #else /* !defined(NXAGENT_SERVER) */ #define SERVER_SYNC_MINOR_VERSION 0 #endif /* !defined(NXAGENT_SERVER) */ /* Big Font */ #define SERVER_XF86BIGFONT_MAJOR_VERSION 1 #define SERVER_XF86BIGFONT_MINOR_VERSION 1 #ifndef NXAGENT_SERVER /* Vidmode */ #define SERVER_XF86VIDMODE_MAJOR_VERSION 2 #define SERVER_XF86VIDMODE_MINOR_VERSION 2 #endif /* !defined(NXAGENT_SERVER) */ /* Fixes */ #ifndef NXAGENT_SERVER #define SERVER_XFIXES_MAJOR_VERSION 5 #define SERVER_XFIXES_MINOR_VERSION 0 #else /* !defined(NXAGENT_SERVER) */ #define SERVER_XFIXES_MAJOR_VERSION 4 #define SERVER_XFIXES_MINOR_VERSION 0 #endif /* !defined(NXAGENT_SERVER) */ /* X Input */ #ifndef NXAGENT_SERVER #define SERVER_XI_MAJOR_VERSION 2 #define SERVER_XI_MINOR_VERSION 3 #else /* !defined(NXAGENT_SERVER) */ #define SERVER_XI_MAJOR_VERSION 1 #define SERVER_XI_MINOR_VERSION 3 #endif /* !defined(NXAGENT_SERVER) */ /* XKB */ #define SERVER_XKB_MAJOR_VERSION 1 #define SERVER_XKB_MINOR_VERSION 0 /* Resource */ #define SERVER_XRES_MAJOR_VERSION 1 #ifndef NXAGENT_SERVER #define SERVER_XRES_MINOR_VERSION 2 #else /* !defined(NXAGENT_SERVER) */ #define SERVER_XRES_MINOR_VERSION 0 #endif /* !defined(NXAGENT_SERVER) */ #ifndef NXAGENT_SERVER /* XvMC */ #define SERVER_XVMC_MAJOR_VERSION 1 #define SERVER_XVMC_MINOR_VERSION 1 #endif /* !defined(NXAGENT_SERVER) */ #endif /* PROTOCOL_VERSIONS_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/region.h0000644000000000000000000000447313614532331017662 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef REGION_H #define REGION_H #include "regionstr.h" #endif /* REGION_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/regionstr.h0000644000000000000000000002600113614532331020402 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef REGIONSTRUCT_H #define REGIONSTRUCT_H #include typedef struct pixman_region16 RegionRec, *RegionPtr; #include #include #include "miscstruct.h" /* Return values from RectIn() */ #define rgnOUT 0 #define rgnIN 1 #define rgnPART 2 #define NullRegion ((RegionPtr)0) /* * clip region */ typedef struct pixman_region16_data RegDataRec, *RegDataPtr; extern BoxRec RegionEmptyBox; extern RegDataRec RegionEmptyData; extern RegDataRec RegionBrokenData; static inline Bool RegionNil(RegionPtr reg) { return ((reg)->data && !(reg)->data->numRects); } static inline Bool RegionNar(RegionPtr reg) { return ((reg)->data == &RegionBrokenData); } static inline int RegionNumRects(RegionPtr reg) { return ((reg)->data ? (reg)->data->numRects : 1); } static inline int RegionSize(RegionPtr reg) { return ((reg)->data ? (reg)->data->size : 0); } static inline BoxPtr RegionRects(RegionPtr reg) { return ((reg)->data ? (BoxPtr)((reg)->data + 1) : &(reg)->extents); } static inline BoxPtr RegionBoxptr(RegionPtr reg) { return ((BoxPtr)((reg)->data + 1)); } static inline BoxPtr RegionBox(RegionPtr reg, int i) { return (&RegionBoxptr(reg)[i]); } static inline BoxPtr RegionTop(RegionPtr reg) { return RegionBox(reg, (reg)->data->numRects); } static inline BoxPtr RegionEnd(RegionPtr reg) { return RegionBox(reg, (reg)->data->numRects - 1); } static inline size_t RegionSizeof(int n) { return (sizeof(RegDataRec) + ((n) * sizeof(BoxRec))); } static inline void RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size) { if ((_rect) != NULL) { (_pReg)->extents = *(_rect); (_pReg)->data = (RegDataPtr)NULL; } else { (_pReg)->extents = RegionEmptyBox; if (((_size) > 1) && ((_pReg)->data = (RegDataPtr)malloc(RegionSizeof(_size)))) { (_pReg)->data->size = (_size); (_pReg)->data->numRects = 0; } else (_pReg)->data = &RegionEmptyData; } } static inline void RegionUninit(RegionPtr _pReg) { if ((_pReg)->data && (_pReg)->data->size) { free((_pReg)->data); (_pReg)->data = NULL; } } static inline void RegionReset(RegionPtr _pReg, BoxPtr _pBox) { (_pReg)->extents = *(_pBox); RegionUninit(_pReg); (_pReg)->data = (RegDataPtr)NULL; } static inline Bool RegionNotEmpty(RegionPtr _pReg) { return !RegionNil(_pReg); } static inline Bool RegionBroken(RegionPtr _pReg) { return RegionNar(_pReg); } static inline void RegionEmpty(RegionPtr _pReg) { RegionUninit(_pReg); (_pReg)->extents.x2 = (_pReg)->extents.x1; (_pReg)->extents.y2 = (_pReg)->extents.y1; (_pReg)->data = &RegionEmptyData; } static inline BoxPtr RegionExtents(RegionPtr _pReg) { return (&(_pReg)->extents); } static inline void RegionNull(RegionPtr _pReg) { (_pReg)->extents = RegionEmptyBox; (_pReg)->data = &RegionEmptyData; } static inline Bool RegionCopy(RegionPtr dst, RegionPtr src) { return pixman_region_copy (dst, src); } static inline Bool RegionIntersect( RegionPtr newReg, /* destination Region */ RegionPtr reg1, RegionPtr reg2 /* source regions */ ) { return pixman_region_intersect (newReg, reg1, reg2); } static inline Bool RegionUnion( RegionPtr newReg, /* destination Region */ RegionPtr reg1, RegionPtr reg2 /* source regions */ ) { return pixman_region_union (newReg, reg1, reg2); } /* *----------------------------------------------------------------------- * Subtract -- * Subtract regS from regM and leave the result in regD. * S stands for subtrahend, M for minuend and D for difference. * * Results: * TRUE if successful. * * Side Effects: * regD is overwritten. * *----------------------------------------------------------------------- */ static inline Bool RegionSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS) { return pixman_region_subtract (regD, regM, regS); } /* *----------------------------------------------------------------------- * Inverse -- * Take a region and a box and return a region that is everything * in the box but not in the region. The careful reader will note * that this is the same as subtracting the region from the box... * * Results: * TRUE. * * Side Effects: * newReg is overwritten. * *----------------------------------------------------------------------- */ static inline Bool RegionInverse( RegionPtr newReg, /* Destination region */ RegionPtr reg1, /* Region to invert */ BoxPtr invRect /* Bounding box for inversion */ ) { return pixman_region_inverse (newReg, reg1, invRect); } static inline int RegionContainsRect(RegionPtr region, BoxPtr prect) { return pixman_region_contains_rectangle (region, prect); } /* TranslateRegion(pReg, x, y) * translates in place */ static inline void RegionTranslate(RegionPtr pReg, int x, int y) { pixman_region_translate (pReg, x, y); } static inline Bool RegionContainsPoint( RegionPtr pReg, int x, int y, BoxPtr box /* "return" value */ ) { return pixman_region_contains_point (pReg, x, y, box); } static inline Bool RegionEqual(RegionPtr reg1, RegionPtr reg2) { return pixman_region_equal (reg1, reg2); } extern RegionPtr RegionCreate( BoxPtr /*rect*/, int /*size*/); extern void RegionInit( RegionPtr /*pReg*/, BoxPtr /*rect*/, int /*size*/); extern void RegionDestroy( RegionPtr /*pReg*/); extern void RegionUninit( RegionPtr /*pReg*/); extern Bool RegionCopy( RegionPtr /*dst*/, RegionPtr /*src*/); extern Bool RegionIntersect( RegionPtr /*newReg*/, RegionPtr /*reg1*/, RegionPtr /*reg2*/); extern Bool RegionUnion( RegionPtr /*newReg*/, RegionPtr /*reg1*/, RegionPtr /*reg2*/); extern Bool RegionAppend( RegionPtr /*dstrgn*/, RegionPtr /*rgn*/); extern Bool RegionValidate( RegionPtr /*badreg*/, Bool * /*pOverlap*/); extern RegionPtr RegionFromRects( int /*nrects*/, xRectanglePtr /*prect*/, int /*ctype*/); extern Bool RegionSubtract( RegionPtr /*regD*/, RegionPtr /*regM*/, RegionPtr /*regS*/); extern Bool RegionInverse( RegionPtr /*newReg*/, RegionPtr /*reg1*/, BoxPtr /*invRect*/); extern int RegionContainsRect( RegionPtr /*region*/, BoxPtr /*prect*/); extern void RegionTranslate( RegionPtr /*pReg*/, int /*x*/, int /*y*/); extern void RegionReset( RegionPtr /*pReg*/, BoxPtr /*pBox*/); extern Bool RegionBreak( RegionPtr /*pReg*/); extern Bool RegionContainsPoint( RegionPtr /*pReg*/, int /*x*/, int /*y*/, BoxPtr /*box*/); extern Bool RegionEqual( RegionPtr /*pReg1*/, RegionPtr /*pReg2*/); extern Bool RegionNotEmpty( RegionPtr /*pReg*/); extern void RegionEmpty( RegionPtr /*pReg*/); extern BoxPtr RegionExtents( RegionPtr /*pReg*/); #define INCLUDE_LEGACY_REGION_DEFINES #ifdef INCLUDE_LEGACY_REGION_DEFINES #define REGION_NIL RegionNil #define REGION_NAR RegionNar #define REGION_NUM_RECTS RegionNumRects #define REGION_SIZE RegionSize #define REGION_RECTS RegionRects #define REGION_BOXPTR RegionBoxptr #define REGION_BOX RegionBox #define REGION_TOP RegionTop #define REGION_END RegionEnd #define REGION_SZOF RegionSizeof #define BitmapToRegion BitmapToRegion #define REGION_CREATE(pScreen, r, s) RegionCreate(r,s) #define REGION_COPY(pScreen, d, r) RegionCopy(d, r) #define REGION_DESTROY(pScreen, r) RegionDestroy(r) #define REGION_INTERSECT(pScreen, res, r1, r2) RegionIntersect(res, r1, r2) #define REGION_UNION(pScreen, res, r1, r2) RegionUnion(res, r1, r2) #define REGION_SUBTRACT(pScreen, res, r1, r2) RegionSubtract(res, r1, r2) #define REGION_INVERSE(pScreen, n, r, b) RegionInverse(n, r, b) #define REGION_TRANSLATE(pScreen, r, x, y) RegionTranslate(r, x, y) #define RECT_IN_REGION(pScreen, r, b) RegionContainsRect(r, b) #define POINT_IN_REGION(pScreen, r, x, y, b) RegionContainsPoint(r, x, y, b) #define REGION_EQUAL(pScreen, r1, r2) RegionEqual(r1, r2) #define REGION_APPEND(pScreen, d, r) RegionAppend(d, r) #define REGION_VALIDATE(pScreen, r, o) RegionValidate(r, o) #define RECTS_TO_REGION(pScreen, n, r, c) RegionFromRects(n, r, c) #define REGION_BREAK(pScreen, r) RegionBreak(r) #define REGION_INIT(pScreen, r, b, s) RegionInit(r, b, s) #define REGION_UNINIT(pScreen, r) RegionUninit(r) #define REGION_RESET(pScreen, r, b) RegionReset(r, b) #define REGION_NOTEMPTY(pScreen, r) RegionNotEmpty(r) #define REGION_BROKEN(pScreen, r) RegionBroken(r) #define REGION_EMPTY(pScreen, r) RegionEmpty(r) #define REGION_EXTENTS(pScreen, r) RegionExtents(r) #define REGION_NULL(pScreen, r) RegionNull(r) #endif /* INCLUDE_LEGACY_REGION_DEFINES */ #endif /* REGIONSTRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/resource.h0000644000000000000000000001745113614532331020226 0ustar /*********************************************************** Copyright 1987, 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef RESOURCE_H #define RESOURCE_H 1 #include "misc.h" /***************************************************************** * STUFF FOR RESOURCES *****************************************************************/ /* classes for Resource routines */ typedef unsigned long RESTYPE; #define RC_VANILLA ((RESTYPE)0) #define RC_CACHED ((RESTYPE)1<<31) #define RC_DRAWABLE ((RESTYPE)1<<30) /* Use class RC_NEVERRETAIN for resources that should not be retained * regardless of the close down mode when the client dies. (A client's * event selections on objects that it doesn't own are good candidates.) * Extensions can use this too! */ #define RC_NEVERRETAIN ((RESTYPE)1<<29) #define RC_LASTPREDEF RC_NEVERRETAIN #define RC_ANY (~(RESTYPE)0) /* types for Resource routines */ #define RT_WINDOW ((RESTYPE)1|RC_DRAWABLE) #define RT_PIXMAP ((RESTYPE)2|RC_DRAWABLE) #define RT_GC ((RESTYPE)3) #undef RT_FONT #undef RT_CURSOR #define RT_FONT ((RESTYPE)4) #define RT_CURSOR ((RESTYPE)5) #define RT_COLORMAP ((RESTYPE)6) #define RT_CMAPENTRY ((RESTYPE)7) #define RT_OTHERCLIENT ((RESTYPE)8|RC_NEVERRETAIN) #define RT_PASSIVEGRAB ((RESTYPE)9|RC_NEVERRETAIN) #define RT_LASTPREDEF ((RESTYPE)9) #define RT_NONE ((RESTYPE)0) /* bits and fields within a resource id */ #define RESOURCE_AND_CLIENT_COUNT 29 /* 29 bits for XIDs */ #if MAXCLIENTS == 64 #define RESOURCE_CLIENT_BITS 6 #endif #if MAXCLIENTS == 128 #define RESOURCE_CLIENT_BITS 7 #endif #if MAXCLIENTS == 256 #define RESOURCE_CLIENT_BITS 8 #endif #if MAXCLIENTS == 512 #define RESOURCE_CLIENT_BITS 9 #endif /* client field offset */ #define CLIENTOFFSET (RESOURCE_AND_CLIENT_COUNT - RESOURCE_CLIENT_BITS) /* resource field */ #define RESOURCE_ID_MASK ((1 << CLIENTOFFSET) - 1) /* client field */ #define RESOURCE_CLIENT_MASK (((1 << RESOURCE_CLIENT_BITS) - 1) << CLIENTOFFSET) /* extract the client mask from an XID */ #define CLIENT_BITS(id) ((id) & RESOURCE_CLIENT_MASK) /* extract the client id from an XID */ #define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET)) #define SERVER_BIT (Mask)0x40000000 /* use illegal bit */ #ifdef INVALID #undef INVALID /* needed on HP/UX */ #endif /* Invalid resource id */ #define INVALID (0) #define BAD_RESOURCE 0xe0000000 typedef int (*DeleteType)( void * /*value*/, XID /*id*/); typedef void (*FindResType)( void * /*value*/, XID /*id*/, void * /*cdata*/); typedef void (*FindAllRes)( void * /*value*/, XID /*id*/, RESTYPE /*type*/, void * /*cdata*/); typedef Bool (*FindComplexResType)( void * /*value*/, XID /*id*/, void * /*cdata*/); extern RESTYPE CreateNewResourceType( DeleteType /*deleteFunc*/); extern RESTYPE CreateNewResourceClass(void); extern Bool InitClientResources( ClientPtr /*client*/); extern XID FakeClientID( int /*client*/); /* Quartz support on Mac OS X uses the CarbonCore framework whose AddResource function conflicts here. */ #ifdef __DARWIN__ #define AddResource Darwin_X_AddResource #endif extern Bool AddResource( XID /*id*/, RESTYPE /*type*/, void * /*value*/); extern void FreeResource( XID /*id*/, RESTYPE /*skipDeleteFuncType*/); extern void FreeResourceByType( XID /*id*/, RESTYPE /*type*/, Bool /*skipFree*/); extern Bool ChangeResourceValue( XID /*id*/, RESTYPE /*rtype*/, void * /*value*/); extern void FindClientResourcesByType( ClientPtr /*client*/, RESTYPE /*type*/, FindResType /*func*/, void * /*cdata*/); extern void FindAllClientResources( ClientPtr /*client*/, FindAllRes /*func*/, void * /*cdata*/); extern void FreeClientNeverRetainResources( ClientPtr /*client*/); extern void FreeClientResources( ClientPtr /*client*/); extern void FreeAllResources(void); extern Bool LegalNewID( XID /*id*/, ClientPtr /*client*/); extern void * LookupIDByType( XID /*id*/, RESTYPE /*rtype*/); extern void * LookupIDByClass( XID /*id*/, RESTYPE /*classes*/); extern void * LookupClientResourceComplex( ClientPtr client, RESTYPE type, FindComplexResType func, void * cdata); /* These are the access modes that can be passed in the last parameter * to SecurityLookupIDByType/Class. The Security extension doesn't * currently make much use of these; they're mainly provided as an * example of what you might need for discretionary access control. * You can or these values together to indicate multiple modes * simultaneously. */ #define DixUnknownAccess 0 /* don't know intentions */ #define DixReadAccess (1<<0) /* inspecting the object */ #define DixWriteAccess (1<<1) /* changing the object */ #define DixDestroyAccess (1<<2) /* destroying the object */ #ifdef XCSECURITY extern void * SecurityLookupIDByType( ClientPtr /*client*/, XID /*id*/, RESTYPE /*rtype*/, Mask /*access_mode*/); extern void * SecurityLookupIDByClass( ClientPtr /*client*/, XID /*id*/, RESTYPE /*classes*/, Mask /*access_mode*/); #else /* not XCSECURITY */ #define SecurityLookupIDByType(client, id, rtype, access_mode) \ LookupIDByType(id, rtype) #define SecurityLookupIDByClass(client, id, classes, access_mode) \ LookupIDByClass(id, classes) #endif /* XCSECURITY */ extern void GetXIDRange( int /*client*/, Bool /*server*/, XID * /*minp*/, XID * /*maxp*/); extern unsigned int GetXIDList( ClientPtr /*client*/, unsigned int /*count*/, XID * /*pids*/); extern RESTYPE lastResourceType; extern RESTYPE TypeMask; #ifdef XResExtension extern Atom *ResourceNames; void RegisterResourceName(RESTYPE type, char* name); #endif #endif /* RESOURCE_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/rgb.h0000644000000000000000000000453113614532331017144 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef RGB_H #define RGB_H typedef struct _RGB { unsigned short red, green, blue; } RGB; #endif /* RGB_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/screenint.h0000644000000000000000000000702013614532331020360 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef SCREENINT_H #define SCREENINT_H #include "misc.h" typedef struct _PixmapFormat *PixmapFormatPtr; typedef struct _Visual *VisualPtr; typedef struct _Depth *DepthPtr; typedef struct _Screen *ScreenPtr; extern void ResetScreenPrivates(void); extern int AllocateScreenPrivateIndex(void); extern void ResetWindowPrivates(void); extern int AllocateWindowPrivateIndex(void); extern Bool AllocateWindowPrivate( ScreenPtr /* pScreen */, int /* index */, unsigned /* amount */); extern void ResetGCPrivates(void); extern int AllocateGCPrivateIndex(void); extern Bool AllocateGCPrivate( ScreenPtr /* pScreen */, int /* index */, unsigned /* amount */); extern int AddScreen( Bool (* /*pfnInit*/)( ScreenPtr /*pScreen*/, int /*argc*/, char ** /*argv*/), int /*argc*/, char** /*argv*/); #ifdef PIXPRIV extern void ResetPixmapPrivates(void); extern int AllocatePixmapPrivateIndex(void); extern Bool AllocatePixmapPrivate( ScreenPtr /* pScreen */, int /* index */, unsigned /* amount */); #endif /* PIXPRIV */ extern void ResetColormapPrivates(void); typedef struct _ColormapRec *ColormapPtr; typedef int (*InitCmapPrivFunc)(ColormapPtr, int); extern int AllocateColormapPrivateIndex( InitCmapPrivFunc /* initPrivFunc */); #endif /* SCREENINT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/scrnintstr.h0000644000000000000000000004677113614532331020617 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef SCREENINTSTRUCT_H #define SCREENINTSTRUCT_H #include "screenint.h" #include "regionstr.h" #include "bstore.h" #include "colormap.h" #include "cursor.h" #include "validate.h" #include #include "dix.h" typedef struct _PixmapFormat { unsigned char depth; unsigned char bitsPerPixel; unsigned char scanlinePad; } PixmapFormatRec; typedef struct _Visual { VisualID vid; short class; short bitsPerRGBValue; short ColormapEntries; short nplanes;/* = log2 (ColormapEntries). This does not * imply that the screen has this many planes. * it may have more or fewer */ unsigned long redMask, greenMask, blueMask; int offsetRed, offsetGreen, offsetBlue; } VisualRec; typedef struct _Depth { unsigned char depth; short numVids; VisualID *vids; /* block of visual ids for this depth */ } DepthRec; /* * There is a typedef for each screen function void * so that code that * needs to declare a screen function void * (e.g. in a screen private * or as a local variable) can easily do so and retain full type checking. */ typedef Bool (* CloseScreenProcPtr)( ScreenPtr /*pScreen*/); typedef void (* QueryBestSizeProcPtr)( int /*class*/, unsigned short * /*pwidth*/, unsigned short * /*pheight*/, ScreenPtr /*pScreen*/); typedef Bool (* SaveScreenProcPtr)( ScreenPtr /*pScreen*/, int /*on*/); typedef void (* GetImageProcPtr)( DrawablePtr /*pDrawable*/, int /*sx*/, int /*sy*/, int /*w*/, int /*h*/, unsigned int /*format*/, unsigned long /*planeMask*/, char * /*pdstLine*/); typedef void (* GetSpansProcPtr)( DrawablePtr /*pDrawable*/, int /*wMax*/, DDXPointPtr /*ppt*/, int* /*pwidth*/, int /*nspans*/, char * /*pdstStart*/); typedef void (* PointerNonInterestBoxProcPtr)( ScreenPtr /*pScreen*/, BoxPtr /*pBox*/); typedef void (* SourceValidateProcPtr)( DrawablePtr /*pDrawable*/, int /*x*/, int /*y*/, int /*width*/, int /*height*/); typedef Bool (* CreateWindowProcPtr)( WindowPtr /*pWindow*/); typedef Bool (* DestroyWindowProcPtr)( WindowPtr /*pWindow*/); typedef Bool (* PositionWindowProcPtr)( WindowPtr /*pWindow*/, int /*x*/, int /*y*/); typedef Bool (* ChangeWindowAttributesProcPtr)( WindowPtr /*pWindow*/, unsigned long /*mask*/); typedef Bool (* RealizeWindowProcPtr)( WindowPtr /*pWindow*/); typedef Bool (* UnrealizeWindowProcPtr)( WindowPtr /*pWindow*/); typedef void (* RestackWindowProcPtr)( WindowPtr /*pWindow*/, WindowPtr /*pOldNextSib*/); typedef int (* ValidateTreeProcPtr)( WindowPtr /*pParent*/, WindowPtr /*pChild*/, VTKind /*kind*/); typedef void (* PostValidateTreeProcPtr)( WindowPtr /*pParent*/, WindowPtr /*pChild*/, VTKind /*kind*/); typedef void (* WindowExposuresProcPtr)( WindowPtr /*pWindow*/, RegionPtr /*prgn*/, RegionPtr /*other_exposed*/); typedef void (* PaintWindowProcPtr)( WindowPtr /*pWindow*/, RegionPtr /*pRegion*/, int /*what*/); typedef PaintWindowProcPtr PaintWindowBackgroundProcPtr; typedef PaintWindowProcPtr PaintWindowBorderProcPtr; typedef void (* CopyWindowProcPtr)( WindowPtr /*pWindow*/, DDXPointRec /*ptOldOrg*/, RegionPtr /*prgnSrc*/); typedef void (* ClearToBackgroundProcPtr)( WindowPtr /*pWindow*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, Bool /*generateExposures*/); typedef void (* ClipNotifyProcPtr)( WindowPtr /*pWindow*/, int /*dx*/, int /*dy*/); /* pixmap will exist only for the duration of the current rendering operation */ #define CREATE_PIXMAP_USAGE_SCRATCH 1 /* pixmap will be the backing pixmap for a redirected window */ #define CREATE_PIXMAP_USAGE_BACKING_PIXMAP 2 /* pixmap will contain a glyph */ #define CREATE_PIXMAP_USAGE_GLYPH_PICTURE 3 typedef PixmapPtr (* CreatePixmapProcPtr)( ScreenPtr /*pScreen*/, int /*width*/, int /*height*/, int /*depth*/, unsigned /*usage_hint*/); typedef Bool (* DestroyPixmapProcPtr)( PixmapPtr /*pPixmap*/); typedef void (* SaveDoomedAreasProcPtr)( WindowPtr /*pWindow*/, RegionPtr /*prgnSave*/, int /*xorg*/, int /*yorg*/); typedef RegionPtr (* RestoreAreasProcPtr)( WindowPtr /*pWindow*/, RegionPtr /*prgnRestore*/); typedef void (* ExposeCopyProcPtr)( WindowPtr /*pSrc*/, DrawablePtr /*pDst*/, GCPtr /*pGC*/, RegionPtr /*prgnExposed*/, int /*srcx*/, int /*srcy*/, int /*dstx*/, int /*dsty*/, unsigned long /*plane*/); typedef RegionPtr (* TranslateBackingStoreProcPtr)( WindowPtr /*pWindow*/, int /*windx*/, int /*windy*/, RegionPtr /*oldClip*/, int /*oldx*/, int /*oldy*/); typedef RegionPtr (* ClearBackingStoreProcPtr)( WindowPtr /*pWindow*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, Bool /*generateExposures*/); typedef void (* DrawGuaranteeProcPtr)( WindowPtr /*pWindow*/, GCPtr /*pGC*/, int /*guarantee*/); typedef Bool (* RealizeFontProcPtr)( ScreenPtr /*pScreen*/, FontPtr /*pFont*/); typedef Bool (* UnrealizeFontProcPtr)( ScreenPtr /*pScreen*/, FontPtr /*pFont*/); typedef void (* ConstrainCursorProcPtr)( ScreenPtr /*pScreen*/, BoxPtr /*pBox*/); typedef void (* CursorLimitsProcPtr)( ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, BoxPtr /*pHotBox*/, BoxPtr /*pTopLeftBox*/); typedef Bool (* DisplayCursorProcPtr)( ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/); typedef Bool (* RealizeCursorProcPtr)( ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/); typedef Bool (* UnrealizeCursorProcPtr)( ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/); typedef void (* RecolorCursorProcPtr)( ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, Bool /*displayed*/); typedef Bool (* SetCursorPositionProcPtr)( ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, Bool /*generateEvent*/); typedef Bool (* CreateGCProcPtr)( GCPtr /*pGC*/); typedef Bool (* CreateColormapProcPtr)( ColormapPtr /*pColormap*/); typedef void (* DestroyColormapProcPtr)( ColormapPtr /*pColormap*/); typedef void (* InstallColormapProcPtr)( ColormapPtr /*pColormap*/); typedef void (* UninstallColormapProcPtr)( ColormapPtr /*pColormap*/); typedef int (* ListInstalledColormapsProcPtr) ( ScreenPtr /*pScreen*/, XID* /*pmaps */); typedef void (* StoreColorsProcPtr)( ColormapPtr /*pColormap*/, int /*ndef*/, xColorItem * /*pdef*/); typedef void (* ResolveColorProcPtr)( unsigned short* /*pred*/, unsigned short* /*pgreen*/, unsigned short* /*pblue*/, VisualPtr /*pVisual*/); #ifdef NEED_SCREEN_REGIONS typedef RegionPtr (* RegionCreateProcPtr)( BoxPtr /*rect*/, int /*size*/); typedef void (* RegionInitProcPtr)( RegionPtr /*pReg*/, BoxPtr /*rect*/, int /*size*/); typedef Bool (* RegionCopyProcPtr)( RegionPtr /*dst*/, RegionPtr /*src*/); typedef void (* RegionDestroyProcPtr)( RegionPtr /*pReg*/); typedef void (* RegionUninitProcPtr)( RegionPtr /*pReg*/); typedef Bool (* IntersectProcPtr)( RegionPtr /*newReg*/, RegionPtr /*reg1*/, RegionPtr /*reg2*/); typedef Bool (* UnionProcPtr)( RegionPtr /*newReg*/, RegionPtr /*reg1*/, RegionPtr /*reg2*/); typedef Bool (* SubtractProcPtr)( RegionPtr /*regD*/, RegionPtr /*regM*/, RegionPtr /*regS*/); typedef Bool (* InverseProcPtr)( RegionPtr /*newReg*/, RegionPtr /*reg1*/, BoxPtr /*invRect*/); typedef void (* RegionResetProcPtr)( RegionPtr /*pReg*/, BoxPtr /*pBox*/); typedef void (* TranslateRegionProcPtr)( RegionPtr /*pReg*/, int /*x*/, int /*y*/); typedef int (* RectInProcPtr)( RegionPtr /*region*/, BoxPtr /*prect*/); typedef Bool (* PointInRegionProcPtr)( RegionPtr /*pReg*/, int /*x*/, int /*y*/, BoxPtr /*box*/); typedef Bool (* RegionNotEmptyProcPtr)( RegionPtr /*pReg*/); typedef Bool (* RegionEqualProcPtr)( RegionPtr /*pReg1*/, RegionPtr /*pReg2*/); typedef Bool (* RegionBrokenProcPtr)( RegionPtr /*pReg*/); typedef Bool (* RegionBreakProcPtr)( RegionPtr /*pReg*/); typedef void (* RegionEmptyProcPtr)( RegionPtr /*pReg*/); typedef BoxPtr (* RegionExtentsProcPtr)( RegionPtr /*pReg*/); typedef Bool (* RegionAppendProcPtr)( RegionPtr /*dstrgn*/, RegionPtr /*rgn*/); typedef Bool (* RegionValidateProcPtr)( RegionPtr /*badreg*/, Bool* /*pOverlap*/); #endif /* NEED_SCREEN_REGIONS */ typedef RegionPtr (* BitmapToRegionProcPtr)( PixmapPtr /*pPix*/); #ifdef NEED_SCREEN_REGIONS typedef RegionPtr (* RectsToRegionProcPtr)( int /*nrects*/, xRectangle* /*prect*/, int /*ctype*/); #endif /* NEED_SCREEN_REGIONS */ typedef void (* SendGraphicsExposeProcPtr)( ClientPtr /*client*/, RegionPtr /*pRgn*/, XID /*drawable*/, int /*major*/, int /*minor*/); typedef void (* ScreenBlockHandlerProcPtr)( int /*screenNum*/, void * /*blockData*/, void * /*pTimeout*/, void * /*pReadmask*/); typedef void (* ScreenWakeupHandlerProcPtr)( int /*screenNum*/, void * /*wakeupData*/, unsigned long /*result*/, void * /*pReadMask*/); typedef Bool (* CreateScreenResourcesProcPtr)( ScreenPtr /*pScreen*/); typedef Bool (* ModifyPixmapHeaderProcPtr)( PixmapPtr /*pPixmap*/, int /*width*/, int /*height*/, int /*depth*/, int /*bitsPerPixel*/, int /*devKind*/, void * /*pPixData*/); typedef PixmapPtr (* GetWindowPixmapProcPtr)( WindowPtr /*pWin*/); typedef void (* SetWindowPixmapProcPtr)( WindowPtr /*pWin*/, PixmapPtr /*pPix*/); typedef PixmapPtr (* GetScreenPixmapProcPtr)( ScreenPtr /*pScreen*/); typedef void (* SetScreenPixmapProcPtr)( PixmapPtr /*pPix*/); typedef void (* MarkWindowProcPtr)( WindowPtr /*pWin*/); typedef Bool (* MarkOverlappedWindowsProcPtr)( WindowPtr /*parent*/, WindowPtr /*firstChild*/, WindowPtr * /*pLayerWin*/); typedef Bool (* ChangeSaveUnderProcPtr)( WindowPtr /*pLayerWin*/, WindowPtr /*firstChild*/); typedef void (* PostChangeSaveUnderProcPtr)( WindowPtr /*pLayerWin*/, WindowPtr /*firstChild*/); typedef void (* MoveWindowProcPtr)( WindowPtr /*pWin*/, int /*x*/, int /*y*/, WindowPtr /*pSib*/, VTKind /*kind*/); typedef void (* ResizeWindowProcPtr)( WindowPtr /*pWin*/, int /*x*/, int /*y*/, unsigned int /*w*/, unsigned int /*h*/, WindowPtr /*pSib*/ ); typedef WindowPtr (* GetLayerWindowProcPtr)( WindowPtr /*pWin*/ ); typedef void (* HandleExposuresProcPtr)( WindowPtr /*pWin*/); typedef void (* ReparentWindowProcPtr)( WindowPtr /*pWin*/, WindowPtr /*pPriorParent*/); #ifdef SHAPE typedef void (* SetShapeProcPtr)( WindowPtr /*pWin*/); #endif /* SHAPE */ typedef void (* ChangeBorderWidthProcPtr)( WindowPtr /*pWin*/, unsigned int /*width*/); typedef void (* MarkUnrealizedWindowProcPtr)( WindowPtr /*pChild*/, WindowPtr /*pWin*/, Bool /*fromConfigure*/); typedef void (*ConstrainCursorHarderProcPtr)( ScreenPtr, /*pScreen*/ int, /*mode*/ int *, /*x*/ int * /*y*/); typedef Bool (*ReplaceScanoutPixmapProcPtr)( DrawablePtr, /*pDrawable*/ PixmapPtr, /*pPixmap*/ Bool /*enable*/); typedef struct _Screen { int myNum; /* index of this instance in Screens[] */ ATOM id; short width, height; short mmWidth, mmHeight; short numDepths; unsigned char rootDepth; DepthPtr allowedDepths; unsigned long rootVisual; unsigned long defColormap; short minInstalledCmaps, maxInstalledCmaps; char backingStoreSupport, saveUnderSupport; unsigned long whitePixel, blackPixel; unsigned long rgf; /* array of flags; she's -- HUNGARIAN */ GCPtr GCperDepth[MAXFORMATS+1]; /* next field is a stipple to use as default in a GC. we don't build default tiles of all depths because they are likely to be of a color different from the default fg pixel, so we don't win anything by building a standard one. */ PixmapPtr PixmapPerDepth[1]; void * devPrivate; short numVisuals; VisualPtr visuals; WindowPtr root; int WindowPrivateLen; unsigned *WindowPrivateSizes; unsigned totalWindowSize; int GCPrivateLen; unsigned *GCPrivateSizes; unsigned totalGCSize; /* Random screen procedures */ CloseScreenProcPtr CloseScreen; QueryBestSizeProcPtr QueryBestSize; SaveScreenProcPtr SaveScreen; GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; PointerNonInterestBoxProcPtr PointerNonInterestBox; SourceValidateProcPtr SourceValidate; /* Window Procedures */ CreateWindowProcPtr CreateWindow; DestroyWindowProcPtr DestroyWindow; PositionWindowProcPtr PositionWindow; ChangeWindowAttributesProcPtr ChangeWindowAttributes; RealizeWindowProcPtr RealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow; ValidateTreeProcPtr ValidateTree; PostValidateTreeProcPtr PostValidateTree; WindowExposuresProcPtr WindowExposures; PaintWindowBackgroundProcPtr PaintWindowBackground; PaintWindowBorderProcPtr PaintWindowBorder; CopyWindowProcPtr CopyWindow; ClearToBackgroundProcPtr ClearToBackground; ClipNotifyProcPtr ClipNotify; RestackWindowProcPtr RestackWindow; /* Pixmap procedures */ CreatePixmapProcPtr CreatePixmap; DestroyPixmapProcPtr DestroyPixmap; /* Backing store procedures */ SaveDoomedAreasProcPtr SaveDoomedAreas; RestoreAreasProcPtr RestoreAreas; ExposeCopyProcPtr ExposeCopy; TranslateBackingStoreProcPtr TranslateBackingStore; ClearBackingStoreProcPtr ClearBackingStore; DrawGuaranteeProcPtr DrawGuarantee; /* * A read/write copy of the lower level backing store vector is needed now * that the functions can be wrapped. */ BSFuncRec BackingStoreFuncs; /* Font procedures */ RealizeFontProcPtr RealizeFont; UnrealizeFontProcPtr UnrealizeFont; /* Cursor Procedures */ ConstrainCursorProcPtr ConstrainCursor; ConstrainCursorHarderProcPtr ConstrainCursorHarder; CursorLimitsProcPtr CursorLimits; DisplayCursorProcPtr DisplayCursor; RealizeCursorProcPtr RealizeCursor; UnrealizeCursorProcPtr UnrealizeCursor; RecolorCursorProcPtr RecolorCursor; SetCursorPositionProcPtr SetCursorPosition; /* GC procedures */ CreateGCProcPtr CreateGC; /* Colormap procedures */ CreateColormapProcPtr CreateColormap; DestroyColormapProcPtr DestroyColormap; InstallColormapProcPtr InstallColormap; UninstallColormapProcPtr UninstallColormap; ListInstalledColormapsProcPtr ListInstalledColormaps; StoreColorsProcPtr StoreColors; ResolveColorProcPtr ResolveColor; /* Region procedures */ #ifdef NEED_SCREEN_REGIONS RegionCreateProcPtr RegionCreate; RegionInitProcPtr RegionInit; RegionCopyProcPtr RegionCopy; RegionDestroyProcPtr RegionDestroy; RegionUninitProcPtr RegionUninit; IntersectProcPtr Intersect; UnionProcPtr Union; SubtractProcPtr Subtract; InverseProcPtr Inverse; RegionResetProcPtr RegionReset; TranslateRegionProcPtr TranslateRegion; RectInProcPtr RectIn; PointInRegionProcPtr PointInRegion; RegionNotEmptyProcPtr RegionNotEmpty; RegionEqualProcPtr RegionEqual; RegionBrokenProcPtr RegionBroken; RegionBreakProcPtr RegionBreak; RegionEmptyProcPtr RegionEmpty; RegionExtentsProcPtr RegionExtents; RegionAppendProcPtr RegionAppend; RegionValidateProcPtr RegionValidate; #endif /* NEED_SCREEN_REGIONS */ BitmapToRegionProcPtr BitmapToRegion; #ifdef NEED_SCREEN_REGIONS RectsToRegionProcPtr RectsToRegion; #endif /* NEED_SCREEN_REGIONS */ SendGraphicsExposeProcPtr SendGraphicsExpose; /* os layer procedures */ ScreenBlockHandlerProcPtr BlockHandler; ScreenWakeupHandlerProcPtr WakeupHandler; void * blockData; void * wakeupData; /* anybody can get a piece of this array */ DevUnion *devPrivates; CreateScreenResourcesProcPtr CreateScreenResources; ModifyPixmapHeaderProcPtr ModifyPixmapHeader; GetWindowPixmapProcPtr GetWindowPixmap; SetWindowPixmapProcPtr SetWindowPixmap; GetScreenPixmapProcPtr GetScreenPixmap; SetScreenPixmapProcPtr SetScreenPixmap; PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */ #ifdef PIXPRIV int PixmapPrivateLen; unsigned int *PixmapPrivateSizes; unsigned int totalPixmapSize; #endif MarkWindowProcPtr MarkWindow; MarkOverlappedWindowsProcPtr MarkOverlappedWindows; ChangeSaveUnderProcPtr ChangeSaveUnder; PostChangeSaveUnderProcPtr PostChangeSaveUnder; MoveWindowProcPtr MoveWindow; ResizeWindowProcPtr ResizeWindow; GetLayerWindowProcPtr GetLayerWindow; HandleExposuresProcPtr HandleExposures; ReparentWindowProcPtr ReparentWindow; #ifdef SHAPE SetShapeProcPtr SetShape; #endif /* SHAPE */ ChangeBorderWidthProcPtr ChangeBorderWidth; MarkUnrealizedWindowProcPtr MarkUnrealizedWindow; ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap; } ScreenRec; static inline RegionPtr BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix) { return (*(_pScreen)->BitmapToRegion)(pPix); /* no mi version?! */ } typedef struct _ScreenInfo { int imageByteOrder; int bitmapScanlineUnit; int bitmapScanlinePad; int bitmapBitOrder; int numPixmapFormats; PixmapFormatRec formats[MAXFORMATS]; int arraySize; int numScreens; ScreenPtr screens[MAXSCREENS]; int unused; } ScreenInfo; extern ScreenInfo screenInfo; extern void InitOutput( ScreenInfo * /*pScreenInfo*/, int /*argc*/, char ** /*argv*/); #endif /* SCREENINTSTRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/selection.h0000644000000000000000000000501413614532331020354 0ustar #ifndef SELECTION_H #define SELECTION_H 1 /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "dixstruct.h" /* * * Selection data structures */ typedef struct _Selection { Atom selection; TimeStamp lastTimeChanged; Window window; WindowPtr pWin; ClientPtr client; } Selection; #endif /* SELECTION_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/servermd.h0000644000000000000000000001146113614532331020221 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef SERVERMD_H #define SERVERMD_H 1 #include /* for X_LITTLE_ENDIAN/X_BIG_ENDIAN */ #if X_BYTE_ORDER == X_LITTLE_ENDIAN #define IMAGE_BYTE_ORDER LSBFirst #define BITMAP_BIT_ORDER LSBFirst #elif X_BYTE_ORDER == X_BIG_ENDIAN #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #else #error "Too weird to live." #endif #ifndef GLYPHPADBYTES #define GLYPHPADBYTES 4 #endif /* size of buffer to use with GetImage, measured in bytes. There's obviously * a trade-off between the amount of stack (or whatever ALLOCATE_LOCAL gives * you) used and the number of times the ddx routine has to be called. */ #ifndef IMAGE_BUFSIZE #define IMAGE_BUFSIZE (64*1024) #endif /* pad scanline to a longword */ #ifndef BITMAP_SCANLINE_UNIT #define BITMAP_SCANLINE_UNIT 32 #endif #ifndef BITMAP_SCANLINE_PAD #define BITMAP_SCANLINE_PAD 32 #define LOG2_BITMAP_PAD 5 #define LOG2_BYTES_PER_SCANLINE_PAD 2 #endif /* * This returns the number of padding units, for depth d and width w. * For bitmaps this can be calculated with the macros above. * Other depths require either grovelling over the formats field of the * screenInfo or hardwired constants. */ typedef struct _PaddingInfo { int padRoundUp; /* pixels per pad unit - 1 */ int padPixelsLog2; /* log 2 (pixels per pad unit) */ int padBytesLog2; /* log 2 (bytes per pad unit) */ int notPower2; /* bitsPerPixel not a power of 2 */ int bytesPerPixel; /* only set when notPower2 is TRUE */ int bitsPerPixel; /* bits per pixel */ } PaddingInfo; extern PaddingInfo PixmapWidthPaddingInfo[]; /* The only portable way to get the bpp from the depth is to look it up */ #define BitsPerPixel(d) (PixmapWidthPaddingInfo[d].bitsPerPixel) #define PixmapWidthInPadUnits(w, d) \ (PixmapWidthPaddingInfo[d].notPower2 ? \ (((int)(w) * PixmapWidthPaddingInfo[d].bytesPerPixel + \ PixmapWidthPaddingInfo[d].bytesPerPixel) >> \ PixmapWidthPaddingInfo[d].padBytesLog2) : \ ((int)((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \ PixmapWidthPaddingInfo[d].padPixelsLog2)) /* * Return the number of bytes to which a scanline of the given * depth and width will be padded. */ #define PixmapBytePad(w, d) \ (PixmapWidthInPadUnits(w, d) << PixmapWidthPaddingInfo[d].padBytesLog2) #define BitmapBytePad(w) \ (((int)((w) + BITMAP_SCANLINE_PAD - 1) >> LOG2_BITMAP_PAD) << LOG2_BYTES_PER_SCANLINE_PAD) #define PixmapWidthInPadUnitsProto(w, d) PixmapWidthInPadUnits(w, d) #define PixmapBytePadProto(w, d) PixmapBytePad(w, d) #define BitmapBytePadProto(w) BitmapBytePad(w) #endif /* SERVERMD_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/site.h0000644000000000000000000001133713614532331017340 0ustar /************************************************************ Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef SITE_H #define SITE_H /* * The vendor string identifies the vendor responsible for the * server executable. */ #ifndef VENDOR_STRING #define VENDOR_STRING "The X.Org Group" #endif /* * The vendor release number identifies, for the purpose of submitting * traceable bug reports, the release number of software produced * by the vendor. */ #ifndef VENDOR_RELEASE #define VENDOR_RELEASE 6600 #endif /* * The following constant is provided solely as a last line of defense. The * normal build ALWAYS overrides it using a special rule given in * server/dix/Imakefile. If you want to change this constant, you should set * the DefaultFontPath configuration parameter. * DO NOT CHANGE THESE VALUES OR THE DIX IMAKEFILE! */ #ifndef COMPILEDDEFAULTFONTPATH #define COMPILEDDEFAULTFONTPATH "/usr/lib/X11/fonts/misc/" #endif /* * The following constants contain default values for all of the variables * that can be initialized on the server command line or in the environment. */ #define COMPILEDDEFAULTFONT "fixed" #define COMPILEDCURSORFONT "cursor" #ifndef COMPILEDDISPLAYCLASS #define COMPILEDDISPLAYCLASS "MIT-unspecified" #endif #define DEFAULT_TIMEOUT 60 /* seconds */ #define DEFAULT_KEYBOARD_CLICK 0 #define DEFAULT_BELL 50 #define DEFAULT_BELL_PITCH 400 #define DEFAULT_BELL_DURATION 100 #ifdef XKB #define DEFAULT_AUTOREPEAT TRUE #else #define DEFAULT_AUTOREPEAT FALSE #endif #define DEFAULT_AUTOREPEATS {\ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} #define DEFAULT_LEDS 0x0 /* all off */ #define DEFAULT_LEDS_MASK 0xffffffff /* 32 */ #define DEFAULT_INT_RESOLUTION 1000 #define DEFAULT_INT_MIN_VALUE 0 #define DEFAULT_INT_MAX_VALUE 100 #define DEFAULT_INT_DISPLAYED 0 #define DEFAULT_PTR_NUMERATOR 2 #define DEFAULT_PTR_DENOMINATOR 1 #define DEFAULT_PTR_THRESHOLD 4 #define DEFAULT_SCREEN_SAVER_TIME (10 * (60 * 1000)) #define DEFAULT_SCREEN_SAVER_INTERVAL (10 * (60 * 1000)) #define DEFAULT_SCREEN_SAVER_BLANKING PreferBlanking #define DEFAULT_SCREEN_SAVER_EXPOSURES AllowExposures #ifndef NOLOGOHACK #define DEFAULT_LOGO_SCREEN_SAVER 1 #endif #ifndef DEFAULT_ACCESS_CONTROL #define DEFAULT_ACCESS_CONTROL TRUE #endif /* Default logging parameters. */ #ifndef DEFAULT_LOG_VERBOSITY #define DEFAULT_LOG_VERBOSITY 0 #endif #ifndef DEFAULT_LOG_FILE_VERBOSITY #define DEFAULT_LOG_FILE_VERBOSITY 3 #endif #endif /* SITE_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/swaprep.h0000644000000000000000000001773513614532331020065 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef SWAPREP_H #define SWAPREP_H 1 extern void Swap32Write( ClientPtr /* pClient */, int /* size */, CARD32 * /* pbuf */); extern void CopySwap32Write( ClientPtr /* pClient */, int /* size */, CARD32 * /* pbuf */); extern void CopySwap16Write( ClientPtr /* pClient */, int /* size */, short * /* pbuf */); extern void SGenericReply( ClientPtr /* pClient */, int /* size */, xGenericReply * /* pRep */); extern void SGetWindowAttributesReply( ClientPtr /* pClient */, int /* size */, xGetWindowAttributesReply * /* pRep */); extern void SGetGeometryReply( ClientPtr /* pClient */, int /* size */, xGetGeometryReply * /* pRep */); extern void SQueryTreeReply( ClientPtr /* pClient */, int /* size */, xQueryTreeReply * /* pRep */); extern void SInternAtomReply( ClientPtr /* pClient */, int /* size */, xInternAtomReply * /* pRep */); extern void SGetAtomNameReply( ClientPtr /* pClient */, int /* size */, xGetAtomNameReply * /* pRep */); extern void SGetPropertyReply( ClientPtr /* pClient */, int /* size */, xGetPropertyReply * /* pRep */); extern void SListPropertiesReply( ClientPtr /* pClient */, int /* size */, xListPropertiesReply * /* pRep */); extern void SGetSelectionOwnerReply( ClientPtr /* pClient */, int /* size */, xGetSelectionOwnerReply * /* pRep */); extern void SQueryPointerReply( ClientPtr /* pClient */, int /* size */, xQueryPointerReply * /* pRep */); extern void SwapTimecoord( xTimecoord * /* pCoord */); extern void SwapTimeCoordWrite( ClientPtr /* pClient */, int /* size */, xTimecoord * /* pRep */); extern void SGetMotionEventsReply( ClientPtr /* pClient */, int /* size */, xGetMotionEventsReply * /* pRep */); extern void STranslateCoordsReply( ClientPtr /* pClient */, int /* size */, xTranslateCoordsReply * /* pRep */); extern void SGetInputFocusReply( ClientPtr /* pClient */, int /* size */, xGetInputFocusReply * /* pRep */); extern void SQueryKeymapReply( ClientPtr /* pClient */, int /* size */, xQueryKeymapReply * /* pRep */); extern void SQueryFontReply( ClientPtr /* pClient */, int /* size */, xQueryFontReply * /* pRep */); extern void SQueryTextExtentsReply( ClientPtr /* pClient */, int /* size */, xQueryTextExtentsReply * /* pRep */); extern void SListFontsReply( ClientPtr /* pClient */, int /* size */, xListFontsReply * /* pRep */); extern void SListFontsWithInfoReply( ClientPtr /* pClient */, int /* size */, xListFontsWithInfoReply * /* pRep */); extern void SGetFontPathReply( ClientPtr /* pClient */, int /* size */, xGetFontPathReply * /* pRep */); extern void SGetImageReply( ClientPtr /* pClient */, int /* size */, xGetImageReply * /* pRep */); extern void SListInstalledColormapsReply( ClientPtr /* pClient */, int /* size */, xListInstalledColormapsReply * /* pRep */); extern void SAllocColorReply( ClientPtr /* pClient */, int /* size */, xAllocColorReply * /* pRep */); extern void SAllocNamedColorReply( ClientPtr /* pClient */, int /* size */, xAllocNamedColorReply * /* pRep */); extern void SAllocColorCellsReply( ClientPtr /* pClient */, int /* size */, xAllocColorCellsReply * /* pRep */); extern void SAllocColorPlanesReply( ClientPtr /* pClient */, int /* size */, xAllocColorPlanesReply * /* pRep */); extern void SwapRGB( xrgb * /* prgb */); extern void SQColorsExtend( ClientPtr /* pClient */, int /* size */, xrgb * /* prgb */); extern void SQueryColorsReply( ClientPtr /* pClient */, int /* size */, xQueryColorsReply * /* pRep */); extern void SLookupColorReply( ClientPtr /* pClient */, int /* size */, xLookupColorReply * /* pRep */); extern void SQueryBestSizeReply( ClientPtr /* pClient */, int /* size */, xQueryBestSizeReply * /* pRep */); extern void SListExtensionsReply( ClientPtr /* pClient */, int /* size */, xListExtensionsReply * /* pRep */); extern void SGetKeyboardMappingReply( ClientPtr /* pClient */, int /* size */, xGetKeyboardMappingReply * /* pRep */); extern void SGetPointerMappingReply( ClientPtr /* pClient */, int /* size */, xGetPointerMappingReply * /* pRep */); extern void SGetModifierMappingReply( ClientPtr /* pClient */, int /* size */, xGetModifierMappingReply * /* pRep */); extern void SGetKeyboardControlReply( ClientPtr /* pClient */, int /* size */, xGetKeyboardControlReply * /* pRep */); extern void SGetPointerControlReply( ClientPtr /* pClient */, int /* size */, xGetPointerControlReply * /* pRep */); extern void SGetScreenSaverReply( ClientPtr /* pClient */, int /* size */, xGetScreenSaverReply * /* pRep */); extern void SLHostsExtend( ClientPtr /* pClient */, int /* size */, char * /* buf */); extern void SListHostsReply( ClientPtr /* pClient */, int /* size */, xListHostsReply * /* pRep */); extern void SErrorEvent( xError * /* from */, xError * /* to */); extern void SwapConnSetupInfo( char * /* pInfo */, char * /* pInfoTBase */); extern void WriteSConnectionInfo( ClientPtr /* pClient */, unsigned long /* size */, char * /* pInfo */); extern void SwapConnSetup( xConnSetup * /* pConnSetup */, xConnSetup * /* pConnSetupT */); extern void SwapWinRoot( xWindowRoot * /* pRoot */, xWindowRoot * /* pRootT */); extern void SwapVisual( xVisualType * /* pVis */, xVisualType * /* pVisT */); extern void SwapConnSetupPrefix( xConnSetupPrefix * /* pcspFrom */, xConnSetupPrefix * /* pcspTo */); extern void WriteSConnSetupPrefix( ClientPtr /* pClient */, xConnSetupPrefix * /* pcsp */); #undef SWAPREP_PROC #define SWAPREP_PROC(func) void func(xEvent * /* from */, xEvent * /* to */) SWAPREP_PROC(SCirculateEvent); SWAPREP_PROC(SClientMessageEvent); SWAPREP_PROC(SColormapEvent); SWAPREP_PROC(SConfigureNotifyEvent); SWAPREP_PROC(SConfigureRequestEvent); SWAPREP_PROC(SCreateNotifyEvent); SWAPREP_PROC(SDestroyNotifyEvent); SWAPREP_PROC(SEnterLeaveEvent); SWAPREP_PROC(SExposeEvent); SWAPREP_PROC(SFocusEvent); SWAPREP_PROC(SGraphicsExposureEvent); SWAPREP_PROC(SGravityEvent); SWAPREP_PROC(SKeyButtonPtrEvent); SWAPREP_PROC(SKeymapNotifyEvent); SWAPREP_PROC(SMapNotifyEvent); SWAPREP_PROC(SMapRequestEvent); SWAPREP_PROC(SMappingEvent); SWAPREP_PROC(SNoExposureEvent); SWAPREP_PROC(SPropertyEvent); SWAPREP_PROC(SReparentEvent); SWAPREP_PROC(SResizeRequestEvent); SWAPREP_PROC(SSelectionClearEvent); SWAPREP_PROC(SSelectionNotifyEvent); SWAPREP_PROC(SSelectionRequestEvent); SWAPREP_PROC(SUnmapNotifyEvent); SWAPREP_PROC(SVisibilityEvent); #undef SWAPREP_PROC #endif /* SWAPREP_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/swapreq.h0000644000000000000000000000751613614532331020062 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef SWAPREQ_H #define SWAPREQ_H 1 /* The first two are in misc.h */ #if 0 extern void SwapLongs ( CARD32 * /* list */, unsigned long /* count */); extern void SwapShorts ( short * /* list */, unsigned long /* count */); #endif extern void SwapColorItem( xColorItem * /* pItem */); extern void SwapConnClientPrefix( xConnClientPrefix * /* pCCP */); #undef SWAPREQ_PROC #define SWAPREQ_PROC(func) int func(ClientPtr /* client */) SWAPREQ_PROC(SProcAllocColor); SWAPREQ_PROC(SProcAllocColorCells); SWAPREQ_PROC(SProcAllocColorPlanes); SWAPREQ_PROC(SProcAllocNamedColor); SWAPREQ_PROC(SProcChangeActivePointerGrab); SWAPREQ_PROC(SProcChangeGC); SWAPREQ_PROC(SProcChangeHosts); SWAPREQ_PROC(SProcChangeKeyboardControl); SWAPREQ_PROC(SProcChangeKeyboardMapping); SWAPREQ_PROC(SProcChangePointerControl); SWAPREQ_PROC(SProcChangeProperty); SWAPREQ_PROC(SProcChangeWindowAttributes); SWAPREQ_PROC(SProcClearToBackground); SWAPREQ_PROC(SProcConfigureWindow); SWAPREQ_PROC(SProcConvertSelection); SWAPREQ_PROC(SProcCopyArea); SWAPREQ_PROC(SProcCopyColormapAndFree); SWAPREQ_PROC(SProcCopyGC); SWAPREQ_PROC(SProcCopyPlane); SWAPREQ_PROC(SProcCreateColormap); SWAPREQ_PROC(SProcCreateCursor); SWAPREQ_PROC(SProcCreateGC); SWAPREQ_PROC(SProcCreateGlyphCursor); SWAPREQ_PROC(SProcCreatePixmap); SWAPREQ_PROC(SProcCreateWindow); SWAPREQ_PROC(SProcDeleteProperty); SWAPREQ_PROC(SProcFillPoly); SWAPREQ_PROC(SProcFreeColors); SWAPREQ_PROC(SProcGetImage); SWAPREQ_PROC(SProcGetMotionEvents); SWAPREQ_PROC(SProcGetProperty); SWAPREQ_PROC(SProcGrabButton); SWAPREQ_PROC(SProcGrabKey); SWAPREQ_PROC(SProcGrabKeyboard); SWAPREQ_PROC(SProcGrabPointer); SWAPREQ_PROC(SProcImageText); SWAPREQ_PROC(SProcInternAtom); SWAPREQ_PROC(SProcListFonts); SWAPREQ_PROC(SProcListFontsWithInfo); SWAPREQ_PROC(SProcLookupColor); SWAPREQ_PROC(SProcNoOperation); SWAPREQ_PROC(SProcOpenFont); SWAPREQ_PROC(SProcPoly); SWAPREQ_PROC(SProcPolyText); SWAPREQ_PROC(SProcPutImage); SWAPREQ_PROC(SProcQueryBestSize); SWAPREQ_PROC(SProcQueryColors); SWAPREQ_PROC(SProcQueryExtension); SWAPREQ_PROC(SProcRecolorCursor); SWAPREQ_PROC(SProcReparentWindow); SWAPREQ_PROC(SProcResourceReq); SWAPREQ_PROC(SProcRotateProperties); SWAPREQ_PROC(SProcSendEvent); SWAPREQ_PROC(SProcSetClipRectangles); SWAPREQ_PROC(SProcSetDashes); SWAPREQ_PROC(SProcSetFontPath); SWAPREQ_PROC(SProcSetInputFocus); SWAPREQ_PROC(SProcSetScreenSaver); SWAPREQ_PROC(SProcSetSelectionOwner); SWAPREQ_PROC(SProcSimpleReq); SWAPREQ_PROC(SProcStoreColors); SWAPREQ_PROC(SProcStoreNamedColor); SWAPREQ_PROC(SProcTranslateCoords); SWAPREQ_PROC(SProcUngrabButton); SWAPREQ_PROC(SProcUngrabKey); SWAPREQ_PROC(SProcWarpPointer); #undef SWAPREQ_PROC #endif /* SWAPREQ_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/validate.h0000644000000000000000000000272213614532331020163 0ustar /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef VALIDATE_H #define VALIDATE_H #include "miscstruct.h" #include "regionstr.h" typedef enum { VTOther, VTStack, VTMove, VTUnmap, VTMap, VTBroken } VTKind; /* union _Validate is now device dependent; see mivalidate.h for an example */ typedef union _Validate *ValidatePtr; #define UnmapValData ((ValidatePtr)1) #endif /* VALIDATE_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/window.h0000644000000000000000000001567713614532331017716 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef WINDOW_H #define WINDOW_H #include "misc.h" #include "region.h" #include "screenint.h" #include #define TOTALLY_OBSCURED 0 #define UNOBSCURED 1 #define OBSCURED 2 #define VisibilityNotViewable 3 /* return values for tree-walking callback procedures */ #define WT_STOPWALKING 0 #define WT_WALKCHILDREN 1 #define WT_DONTWALKCHILDREN 2 #define WT_NOMATCH 3 #define NullWindow ((WindowPtr) 0) typedef struct _BackingStore *BackingStorePtr; typedef struct _Window *WindowPtr; typedef int (*VisitWindowProcPtr)( WindowPtr /*pWin*/, void * /*data*/); extern int TraverseTree( WindowPtr /*pWin*/, VisitWindowProcPtr /*func*/, void * /*data*/); extern int WalkTree( ScreenPtr /*pScreen*/, VisitWindowProcPtr /*func*/, void * /*data*/); extern WindowPtr AllocateWindow( ScreenPtr /*pScreen*/); extern Bool CreateRootWindow( ScreenPtr /*pScreen*/); extern void InitRootWindow( WindowPtr /*pWin*/); extern void ClippedRegionFromBox( WindowPtr /*pWin*/, RegionPtr /*Rgn*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/); typedef WindowPtr (* RealChildHeadProc) (WindowPtr pWin); void RegisterRealChildHeadProc (RealChildHeadProc proc); extern WindowPtr RealChildHead( WindowPtr /*pWin*/); extern WindowPtr CreateWindow( Window /*wid*/, WindowPtr /*pParent*/, int /*x*/, int /*y*/, unsigned int /*w*/, unsigned int /*h*/, unsigned int /*bw*/, unsigned int /*class*/, Mask /*vmask*/, XID* /*vlist*/, int /*depth*/, ClientPtr /*client*/, VisualID /*visual*/, int* /*error*/); extern int DeleteWindow( void * /*pWin*/, XID /*wid*/); extern void DestroySubwindows( WindowPtr /*pWin*/, ClientPtr /*client*/); /* Quartz support on Mac OS X uses the HIToolbox framework whose ChangeWindowAttributes function conflicts here. */ #ifdef __DARWIN__ #define ChangeWindowAttributes Darwin_X_ChangeWindowAttributes #endif extern int ChangeWindowAttributes( WindowPtr /*pWin*/, Mask /*vmask*/, XID* /*vlist*/, ClientPtr /*client*/); /* Quartz support on Mac OS X uses the HIToolbox framework whose GetWindowAttributes function conflicts here. */ #ifdef __DARWIN__ #define GetWindowAttributes(w,c,x) Darwin_X_GetWindowAttributes(w,c,x) extern void Darwin_X_GetWindowAttributes( #else extern void GetWindowAttributes( #endif WindowPtr /*pWin*/, ClientPtr /*client*/, xGetWindowAttributesReply* /* wa */); extern RegionPtr CreateUnclippedWinSize( WindowPtr /*pWin*/); extern void GravityTranslate( int /*x*/, int /*y*/, int /*oldx*/, int /*oldy*/, int /*dw*/, int /*dh*/, unsigned /*gravity*/, int* /*destx*/, int* /*desty*/); extern int ConfigureWindow( WindowPtr /*pWin*/, Mask /*mask*/, XID* /*vlist*/, ClientPtr /*client*/); extern int CirculateWindow( WindowPtr /*pParent*/, int /*direction*/, ClientPtr /*client*/); extern int ReparentWindow( WindowPtr /*pWin*/, WindowPtr /*pParent*/, int /*x*/, int /*y*/, ClientPtr /*client*/); extern int MapWindow( WindowPtr /*pWin*/, ClientPtr /*client*/); extern void MapSubwindows( WindowPtr /*pParent*/, ClientPtr /*client*/); extern int UnmapWindow( WindowPtr /*pWin*/, Bool /*fromConfigure*/); extern void UnmapSubwindows( WindowPtr /*pWin*/); extern void HandleSaveSet( ClientPtr /*client*/); extern Bool VisibleBoundingBoxFromPoint( WindowPtr /*pWin*/, int /*x*/, int /*y*/, BoxPtr /*box*/); extern Bool PointInWindowIsVisible( WindowPtr /*pWin*/, int /*x*/, int /*y*/); extern RegionPtr NotClippedByChildren( WindowPtr /*pWin*/); extern void SendVisibilityNotify( WindowPtr /*pWin*/); extern void SaveScreens( int /*on*/, int /*mode*/); extern WindowPtr FindWindowWithOptional( WindowPtr /*w*/); extern void CheckWindowOptionalNeed( WindowPtr /*w*/); extern Bool MakeWindowOptional( WindowPtr /*pWin*/); extern void DisposeWindowOptional( WindowPtr /*pWin*/); extern WindowPtr MoveWindowInStack( WindowPtr /*pWin*/, WindowPtr /*pNextSib*/); void SetWinSize( WindowPtr /*pWin*/); void SetBorderSize( WindowPtr /*pWin*/); void ResizeChildrenWinSize( WindowPtr /*pWin*/, int /*dx*/, int /*dy*/, int /*dw*/, int /*dh*/); extern void SendShapeNotify( WindowPtr /* pWin */, int /* which */ ); extern RegionPtr CreateBoundingShape( WindowPtr /* pWin */ ); extern RegionPtr CreateClipShape( WindowPtr /* pWin */ ); extern void DisableMapUnmapEvents( WindowPtr /* pWin */ ); extern void EnableMapUnmapEvents( WindowPtr /* pWin */ ); extern Bool MapUnmapEventsEnabled( WindowPtr /* pWin */ ); #endif /* WINDOW_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/windowstr.h0000644000000000000000000002212113614532331020425 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef WINDOWSTRUCT_H #define WINDOWSTRUCT_H #include "window.h" #include "pixmapstr.h" #include "regionstr.h" #include "cursor.h" #include "property.h" #include "resource.h" /* for ROOT_WINDOW_ID_BASE */ #include "dix.h" #include "miscstruct.h" #include #include "opaque.h" #define GuaranteeNothing 0 #define GuaranteeVisBack 1 #define SameBackground(as, a, bs, b) \ ((as) == (bs) && ((as) == None || \ (as) == ParentRelative || \ SamePixUnion(a,b,as == BackgroundPixel))) #define SameBorder(as, a, bs, b) \ EqualPixUnion(as, a, bs, b) typedef struct _WindowOpt { VisualID visual; /* default: same as parent */ CursorPtr cursor; /* default: window.cursorNone */ Colormap colormap; /* default: same as parent */ Mask dontPropagateMask; /* default: window.dontPropagate */ Mask otherEventMasks; /* default: 0 */ struct _OtherClients *otherClients; /* default: NULL */ struct _GrabRec *passiveGrabs; /* default: NULL */ PropertyPtr userProps; /* default: NULL */ unsigned long backingBitPlanes; /* default: ~0L */ unsigned long backingPixel; /* default: 0 */ #ifdef SHAPE RegionPtr boundingShape; /* default: NULL */ RegionPtr clipShape; /* default: NULL */ RegionPtr inputShape; /* default: NULL */ #endif #ifdef XINPUT struct _OtherInputMasks *inputMasks; /* default: NULL */ #endif } WindowOptRec, *WindowOptPtr; #define BackgroundPixel 2L #define BackgroundPixmap 3L /* * The redirectDraw field can have one of three values: * * RedirectDrawNone * A normal window; painted into the same pixmap as the parent * and clipping parent and siblings to its geometry. These * windows get a clip list equal to the intersection of their * geometry with the parent geometry, minus the geometry * of overlapping None and Clipped siblings. * RedirectDrawAutomatic * A redirected window which clips parent and sibling drawing. * Contents for these windows are manage inside the server. * These windows get an internal clip list equal to their * geometry. * RedirectDrawManual * A redirected window which does not clip parent and sibling * drawing; the window must be represented within the parent * geometry by the client performing the redirection management. * Contents for these windows are managed outside the server. * These windows get an internal clip list equal to their * geometry. */ #define RedirectDrawNone 0 #define RedirectDrawAutomatic 1 #define RedirectDrawManual 2 typedef struct _Window { DrawableRec drawable; WindowPtr parent; /* ancestor chain */ WindowPtr nextSib; /* next lower sibling */ WindowPtr prevSib; /* next higher sibling */ WindowPtr firstChild; /* top-most child */ WindowPtr lastChild; /* bottom-most child */ RegionRec clipList; /* clipping rectangle for output */ RegionRec borderClip; /* NotClippedByChildren + border */ union _Validate *valdata; RegionRec winSize; RegionRec borderSize; DDXPointRec origin; /* position relative to parent */ unsigned short borderWidth; unsigned short deliverableEvents; Mask eventMask; PixUnion background; PixUnion border; void * backStorage; /* null when BS disabled */ WindowOptPtr optional; unsigned backgroundState:2; /* None, Relative, Pixel, Pixmap */ unsigned borderIsPixel:1; unsigned cursorIsNone:1; /* else real cursor (might inherit) */ unsigned backingStore:2; unsigned saveUnder:1; unsigned DIXsaveUnder:1; unsigned bitGravity:4; unsigned winGravity:4; unsigned overrideRedirect:1; unsigned visibility:2; unsigned mapped:1; unsigned realized:1; /* ancestors are all mapped */ unsigned viewable:1; /* realized && InputOutput */ unsigned dontPropagate:3;/* index into DontPropagateMasks */ unsigned forcedBS:1; /* system-supplied backingStore */ #ifdef NEED_DBE_BUF_BITS #define DBE_FRONT_BUFFER 1 #define DBE_BACK_BUFFER 0 unsigned dstBuffer:1; /* destination buffer for rendering */ unsigned srcBuffer:1; /* source buffer for rendering */ #endif #ifdef COMPOSITE unsigned redirectDraw:2; /* rendering is redirected from here */ #endif DevUnion *devPrivates; } WindowRec; /* * Ok, a bunch of macros for accessing the optional record * fields (or filling the appropriate default value) */ extern Mask DontPropagateMasks[]; #define wTrackParent(w,field) ((w)->optional ? \ (w)->optional->field \ : FindWindowWithOptional(w)->optional->field) #define wUseDefault(w,field,def) ((w)->optional ? \ (w)->optional->field \ : def) #define wVisual(w) wTrackParent(w, visual) #define wCursor(w) ((w)->cursorIsNone ? None : wTrackParent(w, cursor)) #define wColormap(w) ((w)->drawable.class == InputOnly ? None : wTrackParent(w, colormap)) #define wDontPropagateMask(w) wUseDefault(w, dontPropagateMask, DontPropagateMasks[(w)->dontPropagate]) #define wOtherEventMasks(w) wUseDefault(w, otherEventMasks, 0) #define wOtherClients(w) wUseDefault(w, otherClients, NULL) #ifdef XINPUT #define wOtherInputMasks(w) wUseDefault(w, inputMasks, NULL) #else #define wOtherInputMasks(w) NULL #endif #define wPassiveGrabs(w) wUseDefault(w, passiveGrabs, NULL) #define wUserProps(w) wUseDefault(w, userProps, NULL) #define wBackingBitPlanes(w) wUseDefault(w, backingBitPlanes, ~0L) #define wBackingPixel(w) wUseDefault(w, backingPixel, 0) #ifdef SHAPE #define wBoundingShape(w) wUseDefault(w, boundingShape, NULL) #define wClipShape(w) wUseDefault(w, clipShape, NULL) #define wInputShape(w) wUseDefault(w, inputShape, NULL) #endif #define wClient(w) (clients[CLIENT_ID((w)->drawable.id)]) #define wBorderWidth(w) ((int) (w)->borderWidth) /* true when w needs a border drawn. */ #ifdef SHAPE #define HasBorder(w) ((w)->borderWidth || wClipShape(w)) #else #define HasBorder(w) ((w)->borderWidth) #endif typedef struct _ScreenSaverStuff { WindowPtr pWindow; XID wid; char blanked; Bool (*ExternalScreenSaver)( ScreenPtr /*pScreen*/, int /*xstate*/, Bool /*force*/); } ScreenSaverStuffRec, *ScreenSaverStuffPtr; #define SCREEN_IS_BLANKED 0 #define SCREEN_ISNT_SAVED 1 #define SCREEN_IS_TILED 2 #define SCREEN_IS_BLACK 3 #define HasSaverWindow(i) (savedScreenInfo[i].pWindow != NullWindow) extern int screenIsSaved; extern ScreenSaverStuffRec savedScreenInfo[MAXSCREENS]; /* * this is the configuration parameter "NO_BACK_SAVE" * it means that any existant backing store should not * be used to implement save unders. */ #ifndef NO_BACK_SAVE #define DO_SAVE_UNDERS(pWin) ((pWin)->drawable.pScreen->saveUnderSupport ==\ USE_DIX_SAVE_UNDERS) /* * saveUnderSupport is set to this magic value when using DIXsaveUnders */ #define USE_DIX_SAVE_UNDERS 0x40 #endif extern int numSaveUndersViewable; extern int deltaSaveUndersViewable; #endif /* WINDOWSTRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/XIstubs.h0000644000000000000000000000440513614532331017773 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef XI_STUBS_H #define XI_STUBS_H 1 int ChangeKeyboardDevice ( DeviceIntPtr /* old_dev */, DeviceIntPtr /* new_dev */); int ChangePointerDevice ( DeviceIntPtr /* old_dev */, DeviceIntPtr /* new_dev */, unsigned char /* x */, unsigned char /* y */); void CloseInputDevice ( DeviceIntPtr /* d */, ClientPtr /* client */); void AddOtherInputDevices (void); void OpenInputDevice ( DeviceIntPtr /* dev */, ClientPtr /* client */, int * /* status */); int SetDeviceMode ( ClientPtr /* client */, DeviceIntPtr /* dev */, int /* mode */); int SetDeviceValuators ( ClientPtr /* client */, DeviceIntPtr /* dev */, int * /* valuators */, int /* first_valuator */, int /* num_valuators */); int ChangeDeviceControl ( ClientPtr /* client */, DeviceIntPtr /* dev */, xDeviceCtl * /* control */); #endif /* XI_STUBS_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/xkbfile.h0000644000000000000000000002534313614532331020022 0ustar #ifndef _XKBFILE_H_ #define _XKBFILE_H_ 1 /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /***====================================================================***/ #define XkbXKMFile 0 #define XkbCFile 1 #define XkbXKBFile 2 #define XkbMessage 3 #define XkbMapDefined (1<<0) #define XkbStateDefined (1<<1) typedef struct _XkbFileInfo { unsigned type; unsigned defined; XkbDescPtr xkb; } XkbFileInfo,*XkbFileInfoPtr; typedef void (*XkbFileAddOnFunc)( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, int /* fileSection */, void * /* priv */ ); /***====================================================================***/ #define _XkbSuccess 0 #define _XkbErrMissingNames 1 #define _XkbErrMissingTypes 2 #define _XkbErrMissingReqTypes 3 #define _XkbErrMissingSymbols 4 #define _XkbErrMissingVMods 5 #define _XkbErrMissingIndicators 6 #define _XkbErrMissingCompatMap 7 #define _XkbErrMissingSymInterps 8 #define _XkbErrMissingGeometry 9 #define _XkbErrIllegalDoodad 10 #define _XkbErrIllegalTOCType 11 #define _XkbErrIllegalContents 12 #define _XkbErrEmptyFile 13 #define _XkbErrFileNotFound 14 #define _XkbErrFileCannotOpen 15 #define _XkbErrBadValue 16 #define _XkbErrBadMatch 17 #define _XkbErrBadTypeName 18 #define _XkbErrBadTypeWidth 19 #define _XkbErrBadFileType 20 #define _XkbErrBadFileVersion 21 #define _XkbErrBadFileFormat 22 #define _XkbErrBadAlloc 23 #define _XkbErrBadLength 24 #define _XkbErrXReqFailure 25 #define _XkbErrBadImplementation 26 extern const char * _XkbErrMessages[]; extern unsigned _XkbErrCode; extern const char * _XkbErrLocation; extern unsigned _XkbErrData; /***====================================================================***/ _XFUNCPROTOBEGIN extern char * XkbIndentText( unsigned /* size */ ); extern char * XkbAtomText( Display * /* dpy */, Atom /* atm */, unsigned /* format */ ); extern char * XkbKeysymText( KeySym /* sym */, unsigned /* format */ ); extern char * XkbStringText( char * /* str */, unsigned /* format */ ); extern char * XkbKeyNameText( char * /* name */, unsigned /* format */ ); extern char * XkbModIndexText( unsigned /* ndx */, unsigned /* format */ ); extern char * XkbModMaskText( unsigned /* mask */, unsigned /* format */ ); extern char * XkbVModIndexText( Display * /* dpy */, XkbDescPtr /* xkb */, unsigned /* ndx */, unsigned /* format */ ); extern char * XkbVModMaskText( Display * /* dpy */, XkbDescPtr /* xkb */, unsigned /* modMask */, unsigned /* mask */, unsigned /* format */ ); extern char * XkbConfigText( unsigned /* config */, unsigned /* format */ ); extern char * XkbSIMatchText( unsigned /* type */, unsigned /* format */ ); extern char * XkbIMWhichStateMaskText( unsigned /* use_which */, unsigned /* format */ ); extern char * XkbAccessXDetailText( unsigned /* state */, unsigned /* format */ ); extern char * XkbNKNDetailMaskText( unsigned /* detail */, unsigned /* format */ ); extern char * XkbControlsMaskText( unsigned /* ctrls */, unsigned /* format */ ); extern char * XkbGeomFPText( int /* val */, unsigned /* format */ ); extern char * XkbDoodadTypeText( unsigned /* type */, unsigned /* format */ ); extern char * XkbActionTypeText( unsigned /* type */, unsigned /* format */ ); extern char * XkbActionText( Display * /* dpy */, XkbDescPtr /* xkb */, XkbAction * /* action */, unsigned /* format */ ); extern char * XkbBehaviorText( XkbDescPtr /* xkb */, XkbBehavior * /* behavior */, unsigned /* format */ ); /***====================================================================***/ #define _XkbKSLower (1<<0) #define _XkbKSUpper (1<<1) #define XkbKSIsLower(k) (_XkbKSCheckCase(k)&_XkbKSLower) #define XkbKSIsUpper(k) (_XkbKSCheckCase(k)&_XkbKSUpper) #define XkbKSIsKeypad(k) (((k)>=XK_KP_Space)&&((k)<=XK_KP_Equal)) #define XkbKSIsDeadKey(k) \ (((k)>=XK_dead_grave)&&((k)<=XK_dead_semivoiced_sound)) extern unsigned _XkbKSCheckCase( KeySym /* sym */ ); extern int XkbFindKeycodeByName( XkbDescPtr /* xkb */, char * /* name */, Bool /* use_aliases */ ); extern Bool XkbLookupGroupAndLevel( XkbDescPtr /* xkb */, int /* key */, int * /* mods_inout */, int * /* grp_inout */, int * /* lvl_rtrn */ ); /***====================================================================***/ extern char * XkbAtomGetString( Display * /* dpy */, Atom /* atm */ ); extern Atom XkbInternAtom( Display * /* dpy */, char * /* name */, Bool /* onlyIfExists */ ); extern Status XkbChangeKbdDisplay( Display * /* newDpy */, XkbFileInfo * /* result */ ); extern Atom XkbChangeAtomDisplay( Display * /* oldDpy */, Display * /* newDpy */, Atom /* atm */ ); extern void XkbInitAtoms( Display * /* dpy */ ); /***====================================================================***/ #ifdef _XKBGEOM_H_ #define XkbDW_Unknown 0 #define XkbDW_Doodad 1 #define XkbDW_Section 2 typedef struct _XkbDrawable { int type; int priority; union { XkbDoodadPtr doodad; XkbSectionPtr section; } u; struct _XkbDrawable * next; } XkbDrawableRec,*XkbDrawablePtr; extern XkbDrawablePtr XkbGetOrderedDrawables( XkbGeometryPtr /* geom */, XkbSectionPtr /* section */ ); extern void XkbFreeOrderedDrawables( XkbDrawablePtr /* draw */ ); #endif /***====================================================================***/ extern unsigned XkbConvertGetByNameComponents( Bool /* toXkm */, unsigned /* orig */ ); extern unsigned XkbConvertXkbComponents( Bool /* toXkm */, unsigned /* orig */ ); extern Bool XkbDetermineFileType( XkbFileInfo * /* xkb */, int /* format */, int * /* opts_missing */ ); extern Bool XkbNameMatchesPattern( char * /* name */, char * /* pattern */ ); /***====================================================================***/ extern Bool XkbWriteXKBKeycodes( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBKeyTypes( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBCompatMap( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBSymbols( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBGeometry( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBSemantics( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBLayout( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBKeymap( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteXKBFile( FILE * /* file */, XkbFileInfo * /* result */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ); extern Bool XkbWriteCFile( FILE * /* file */, char * /* name */, XkbFileInfo * /* info */ ); extern Bool XkbWriteXKMFile( FILE * /* file */, XkbFileInfo * /* result */ ); extern Bool XkbWriteToServer( XkbFileInfo * /* result */ ); extern void XkbEnsureSafeMapName( char * /* name */ ); extern Bool XkbWriteXKBKeymapForNames( FILE * /* file */, XkbComponentNamesPtr /* names */, Display * /* dpy */, XkbDescPtr /* xkb */, unsigned /* want */, unsigned /* need */ ); extern Status XkbMergeFile( XkbDescPtr /* xkb */, XkbFileInfo /* finfo */ ); /***====================================================================***/ extern Bool XkmProbe( FILE * /* file */ ); extern unsigned XkbReadFromServer( Display * /* dpy */, unsigned /* need */, unsigned /* want */, XkbFileInfo * /* result */ ); extern unsigned XkmReadFile( FILE * /* file */, unsigned /* need */, unsigned /* want */, XkbFileInfo * /* result */ ); #ifdef _XKMFORMAT_H_ extern Bool XkmReadTOC( FILE * /* file */, xkmFileInfo * /* file_info */, int /* max_toc */, xkmSectionInfo * /* toc */ ); extern xkmSectionInfo *XkmFindTOCEntry( xkmFileInfo * /* finfo */, xkmSectionInfo * /* toc */, unsigned /* type */ ); extern Bool XkmReadFileSection( FILE * /* file */, xkmSectionInfo * /* toc */, XkbFileInfo * /* result */, unsigned * /* loaded_rtrn */ ); extern char * XkmReadFileSectionName( FILE * /* file */, xkmSectionInfo * /* toc */ ); #endif /* _XKMFORMAT_H */ _XFUNCPROTOEND #endif /* _XKBFILE_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/xkbrules.h0000644000000000000000000001134313614532331020230 0ustar #ifndef _XKBRULES_H_ #define _XKBRULES_H_ 1 /************************************************************ Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /***====================================================================***/ typedef struct _XkbRF_VarDefs { char * model; char * layout; char * variant; char * options; unsigned short sz_extra; unsigned short num_extra; char * extra_names; char ** extra_values; } XkbRF_VarDefsRec,*XkbRF_VarDefsPtr; typedef struct _XkbRF_VarDesc { char * name; char * desc; } XkbRF_VarDescRec, *XkbRF_VarDescPtr; typedef struct _XkbRF_DescribeVars { int sz_desc; int num_desc; XkbRF_VarDescPtr desc; } XkbRF_DescribeVarsRec,*XkbRF_DescribeVarsPtr; typedef struct _XkbRF_Rule { int number; int layout_num; int variant_num; char * model; char * layout; char * variant; char * option; /* yields */ char * keycodes; char * symbols; char * types; char * compat; char * geometry; char * keymap; unsigned flags; } XkbRF_RuleRec,*XkbRF_RulePtr; typedef struct _XkbRF_Group { int number; char * name; char * words; } XkbRF_GroupRec, *XkbRF_GroupPtr; #define XkbRF_PendingMatch (1L<<1) #define XkbRF_Option (1L<<2) #define XkbRF_Append (1L<<3) #define XkbRF_Normal (1L<<4) #define XkbRF_Invalid (1L<<5) typedef struct _XkbRF_Rules { XkbRF_DescribeVarsRec models; XkbRF_DescribeVarsRec layouts; XkbRF_DescribeVarsRec variants; XkbRF_DescribeVarsRec options; unsigned short sz_extra; unsigned short num_extra; char ** extra_names; XkbRF_DescribeVarsPtr extra; unsigned short sz_rules; unsigned short num_rules; XkbRF_RulePtr rules; unsigned short sz_groups; unsigned short num_groups; XkbRF_GroupPtr groups; } XkbRF_RulesRec, *XkbRF_RulesPtr; /***====================================================================***/ _XFUNCPROTOBEGIN extern Bool XkbRF_GetComponents( XkbRF_RulesPtr /* rules */, XkbRF_VarDefsPtr /* var_defs */, XkbComponentNamesPtr /* names */ ); extern XkbRF_RulePtr XkbRF_AddRule( XkbRF_RulesPtr /* rules */ ); extern XkbRF_GroupPtr XkbRF_AddGroup(XkbRF_RulesPtr rules); extern Bool XkbRF_LoadRules( FILE * /* file */, XkbRF_RulesPtr /* rules */ ); extern Bool XkbRF_LoadRulesByName( char * /* base */, char * /* locale */, XkbRF_RulesPtr /* rules */ ); /***====================================================================***/ extern XkbRF_VarDescPtr XkbRF_AddVarDesc( XkbRF_DescribeVarsPtr /* vars */ ); extern XkbRF_VarDescPtr XkbRF_AddVarDescCopy( XkbRF_DescribeVarsPtr /* vars */, XkbRF_VarDescPtr /* copy_from */ ); extern XkbRF_DescribeVarsPtr XkbRF_AddVarToDescribe( XkbRF_RulesPtr /* rules */, char * /* name */ ); extern Bool XkbRF_LoadDescriptions( FILE * /* file */, XkbRF_RulesPtr /* rules */ ); extern Bool XkbRF_LoadDescriptionsByName( char * /* base */, char * /* locale */, XkbRF_RulesPtr /* rules */ ); extern XkbRF_RulesPtr XkbRF_Load( char * /* base */, char * /* locale */, Bool /* wantDesc */, Bool /* wantRules */ ); extern XkbRF_RulesPtr XkbRF_Create( int /* sz_rules */, int /* sz_extra */ ); /***====================================================================***/ extern void XkbRF_Free( XkbRF_RulesPtr /* rules */, Bool /* freeRules */ ); /***====================================================================***/ #define _XKB_RF_NAMES_PROP_ATOM "_XKB_RULES_NAMES" #define _XKB_RF_NAMES_PROP_MAXLEN 1024 _XFUNCPROTOEND #endif /* _XKBRULES_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/xkbsrv.h0000644000000000000000000006202413614532331017712 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBSRV_H_ #define _XKBSRV_H_ #define XkbAllocClientMap SrvXkbAllocClientMap #define XkbAllocServerMap SrvXkbAllocServerMap #define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey #define XkbCopyKeyTypes SrvXkbCopyKeyTypes #define XkbFreeClientMap SrvXkbFreeClientMap #define XkbFreeServerMap SrvXkbFreeServerMap #define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols #define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey #define XkbResizeKeyActions SrvXkbResizeKeyActions #define XkbResizeKeySyms SrvXkbResizeKeySyms #define XkbResizeKeyType SrvXkbResizeKeyType #define XkbAllocCompatMap SrvXkbAllocCompatMap #define XkbAllocControls SrvXkbAllocControls #define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps #define XkbAllocKeyboard SrvXkbAllocKeyboard #define XkbAllocNames SrvXkbAllocNames #define XkbFreeCompatMap SrvXkbFreeCompatMap #define XkbFreeKeyboard SrvXkbFreeKeyboard #define XkbFreeNames SrvXkbFreeNames #define XkbLatchModifiers SrvXkbLatchModifiers #define XkbLatchGroup SrvXkbLatchGroup #define XkbVirtualModsToReal SrvXkbVirtualModsToReal #define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange #define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges #include #include "xkbstr.h" #include "inputstr.h" typedef struct _XkbInterest { DeviceIntPtr dev; ClientPtr client; XID resource; struct _XkbInterest * next; CARD16 extDevNotifyMask; CARD16 stateNotifyMask; CARD16 namesNotifyMask; CARD32 ctrlsNotifyMask; CARD8 compatNotifyMask; BOOL bellNotifyMask; BOOL actionMessageMask; CARD16 accessXNotifyMask; CARD32 iStateNotifyMask; CARD32 iMapNotifyMask; CARD16 altSymsNotifyMask; CARD32 autoCtrls; CARD32 autoCtrlValues; } XkbInterestRec,*XkbInterestPtr; typedef struct _XkbRadioGroup { CARD8 flags; CARD8 nMembers; CARD8 dfltDown; CARD8 currentDown; CARD8 members[XkbRGMaxMembers]; } XkbRadioGroupRec, *XkbRadioGroupPtr; typedef struct _XkbEventCause { CARD8 kc; CARD8 event; CARD8 mjr; CARD8 mnr; ClientPtr client; } XkbEventCauseRec,*XkbEventCausePtr; #define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\ (c)->mjr= (c)->mnr= 0; \ (c)->client= NULL; } #define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\ (c)->mjr= (j),(c)->mnr= (n);\ (c)->client= (cl); } #define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl) #define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl) #define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0) #define _OFF_TIMER 0 #define _KRG_WARN_TIMER 1 #define _KRG_TIMER 2 #define _SK_TIMEOUT_TIMER 3 #define _ALL_TIMEOUT_TIMER 4 #define _BEEP_NONE 0 #define _BEEP_FEATURE_ON 1 #define _BEEP_FEATURE_OFF 2 #define _BEEP_FEATURE_CHANGE 3 #define _BEEP_SLOW_WARN 4 #define _BEEP_SLOW_PRESS 5 #define _BEEP_SLOW_ACCEPT 6 #define _BEEP_SLOW_REJECT 7 #define _BEEP_SLOW_RELEASE 8 #define _BEEP_STICKY_LATCH 9 #define _BEEP_STICKY_LOCK 10 #define _BEEP_STICKY_UNLOCK 11 #define _BEEP_LED_ON 12 #define _BEEP_LED_OFF 13 #define _BEEP_LED_CHANGE 14 #define _BEEP_BOUNCE_REJECT 15 typedef struct _XkbSrvInfo { XkbStateRec prev_state; XkbStateRec state; XkbDescPtr desc; DeviceIntPtr device; KbdCtrlProcPtr kbdProc; XkbRadioGroupPtr radioGroups; CARD8 nRadioGroups; CARD8 clearMods; CARD8 setMods; INT16 groupChange; CARD16 dfltPtrDelta; double mouseKeysCurve; double mouseKeysCurveFactor; INT16 mouseKeysDX; INT16 mouseKeysDY; CARD8 mouseKeysFlags; Bool mouseKeysAccel; CARD8 mouseKeysCounter; CARD8 lockedPtrButtons; CARD8 shiftKeyCount; KeyCode mouseKey; KeyCode inactiveKey; KeyCode slowKey; KeyCode repeatKey; CARD8 krgTimerActive; CARD8 beepType; CARD8 beepCount; CARD32 flags; CARD32 lastPtrEventTime; CARD32 lastShiftEventTime; OsTimerPtr beepTimer; OsTimerPtr mouseKeyTimer; OsTimerPtr slowKeysTimer; OsTimerPtr bounceKeysTimer; OsTimerPtr repeatKeyTimer; OsTimerPtr krgTimer; } XkbSrvInfoRec, *XkbSrvInfoPtr; #define XkbSLI_IsDefault (1L<<0) #define XkbSLI_HasOwnState (1L<<1) typedef struct _XkbSrvLedInfo { CARD16 flags; CARD16 class; CARD16 id; union { KbdFeedbackPtr kf; LedFeedbackPtr lf; } fb; CARD32 physIndicators; CARD32 autoState; CARD32 explicitState; CARD32 effectiveState; CARD32 mapsPresent; CARD32 namesPresent; XkbIndicatorMapPtr maps; Atom * names; CARD32 usesBase; CARD32 usesLatched; CARD32 usesLocked; CARD32 usesEffective; CARD32 usesCompat; CARD32 usesControls; CARD32 usedComponents; } XkbSrvLedInfoRec, *XkbSrvLedInfoPtr; /* * Settings for xkbClientFlags field (used by DIX) * These flags _must_ not overlap with XkbPCF_* */ #define _XkbClientInitialized (1<<15) #define _XkbWantsDetectableAutoRepeat(c)\ ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask) /* * Settings for flags field */ #define _XkbStateNotifyInProgress (1<<0) typedef struct { ProcessInputProc processInputProc; ProcessInputProc realInputProc; DeviceUnwrapProc unwrapProc; } xkbDeviceInfoRec, *xkbDeviceInfoPtr; #define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ device->public.processInputProc = proc; \ oldprocs->processInputProc = \ oldprocs->realInputProc = device->public.realInputProc; \ device->public.realInputProc = proc; \ oldprocs->unwrapProc = device->unwrapProc; \ device->unwrapProc = unwrapproc; #define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ if (device->public.processInputProc == device->public.realInputProc)\ device->public.processInputProc = proc; \ oldprocs->processInputProc = \ oldprocs->realInputProc = device->public.realInputProc; \ device->public.realInputProc = proc; \ oldprocs->unwrapProc = device->unwrapProc; \ device->unwrapProc = unwrapproc; #define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs) \ device->public.processInputProc = oldprocs->processInputProc; \ device->public.realInputProc = oldprocs->realInputProc; \ device->unwrapProc = oldprocs->unwrapProc; #define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr) (dev)->devPrivates[xkbDevicePrivateIndex].ptr) /***====================================================================***/ extern void XkbFreePrivates(DeviceIntPtr); /***====================================================================***/ #define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask) #define XkbAllFilteredEventsMask \ (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask) /***====================================================================***/ extern int XkbReqCode; extern int XkbEventBase; extern int XkbDisableLockActions; extern char * XkbBaseDirectory; extern char * XkbBinDirectory; extern int _XkbClientMajor; extern int _XkbClientMinor; extern unsigned int XkbXIUnsupported; extern Bool noXkbExtension; extern void * XkbLastRepeatEvent; extern CARD32 xkbDebugFlags; #define _XkbAlloc(s) malloc((s)) #define _XkbCalloc(n,s) calloc((n), (s)) #define _XkbRealloc(o,s) realloc((o),(s)) #define _XkbTypedAlloc(t) ((t *)malloc(sizeof(t))) #define _XkbTypedCalloc(n,t) ((t *)calloc((n), sizeof(t))) #define _XkbTypedRealloc(o,n,t) \ ((o)?(t *)realloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) #define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) #define _XkbFree(p) free(p) #define _XkbLibError(c,l,d) \ { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } #define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) #define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) #define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) extern int DeviceKeyPress,DeviceKeyRelease; extern int DeviceButtonPress,DeviceButtonRelease; #ifdef XINPUT #define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress)) #define _XkbIsReleaseEvent(t) (((t)==KeyRelease)||((t)==DeviceKeyRelease)) #else #define _XkbIsPressEvent(t) ((t)==KeyPress) #define _XkbIsReleaseEvent(t) ((t)==KeyRelease) #endif #define _XkbCoreKeycodeInRange(c,k) (((k)>=(c)->curKeySyms.minKeyCode)&&\ ((k)<=(c)->curKeySyms.maxKeyCode)) #define _XkbCoreNumKeys(c) ((c)->curKeySyms.maxKeyCode-\ (c)->curKeySyms.minKeyCode+1) #define XConvertCase(s,l,u) XkbConvertCase(s,l,u) #undef IsKeypadKey #define IsKeypadKey(s) XkbKSIsKeypad(s) #define Status int #define XPointer void * #define Display struct _XDisplay #ifndef True #define True 1 #define False 0 #endif #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN #else #define PATH_MAX 1024 #endif #endif _XFUNCPROTOBEGIN extern void XkbUseMsg( void ); extern int XkbProcessArguments( int /* argc */, char ** /* argv */, int /* i */ ); extern void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc); extern void XkbFreeCompatMap( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ ); extern void XkbFreeNames( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ ); extern DeviceIntPtr _XkbLookupAnyDevice( int /* id */, int * /* why_rtrn */ ); extern DeviceIntPtr _XkbLookupKeyboard( int /* id */, int * /* why_rtrn */ ); extern DeviceIntPtr _XkbLookupBellDevice( int /* id */, int * /* why_rtrn */ ); extern DeviceIntPtr _XkbLookupLedDevice( int /* id */, int * /* why_rtrn */ ); extern DeviceIntPtr _XkbLookupButtonDevice( int /* id */, int * /* why_rtrn */ ); extern XkbDescPtr XkbAllocKeyboard( void ); extern Status XkbAllocClientMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nTypes */ ); extern Status XkbAllocServerMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nNewActions */ ); extern void XkbFreeClientMap( XkbDescPtr /* xkb */, unsigned int /* what */, Bool /* freeMap */ ); extern void XkbFreeServerMap( XkbDescPtr /* xkb */, unsigned int /* what */, Bool /* freeMap */ ); extern Status XkbAllocIndicatorMaps( XkbDescPtr /* xkb */ ); extern Status XkbAllocCompatMap( XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nInterpret */ ); extern Status XkbAllocNames( XkbDescPtr /* xkb */, unsigned int /* which */, int /* nTotalRG */, int /* nTotalAliases */ ); extern Status XkbAllocControls( XkbDescPtr /* xkb */, unsigned int /* which*/ ); extern Status XkbCopyKeyTypes( XkbKeyTypePtr /* from */, XkbKeyTypePtr /* into */, int /* num_types */ ); extern Status XkbResizeKeyType( XkbDescPtr /* xkb */, int /* type_ndx */, int /* map_count */, Bool /* want_preserve */, int /* new_num_lvls */ ); extern void XkbFreeKeyboard( XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeDesc */ ); extern void XkbSetActionKeyMods( XkbDescPtr /* xkb */, XkbAction * /* act */, unsigned int /* mods */ ); extern Bool XkbCheckActionVMods( XkbDescPtr /* xkb */, XkbAction * /* act */, unsigned int /* changed */ ); extern Bool XkbApplyVModChanges( XkbSrvInfoPtr /* xkbi */, unsigned int /* changed */, XkbChangesPtr /* pChanges */, unsigned int * /* needChecksRtrn */, XkbEventCausePtr /* cause */ ); extern void XkbApplyVModChangesToAllDevices( DeviceIntPtr /* dev */, XkbDescPtr /* xkb */, unsigned int /* changed */, XkbEventCausePtr /* cause */ ); extern unsigned int XkbMaskForVMask( XkbDescPtr /* xkb */, unsigned int /* vmask */ ); extern Bool XkbVirtualModsToReal( XkbDescPtr /* xkb */, unsigned int /* virtua_mask */, unsigned int * /* mask_rtrn */ ); extern unsigned int XkbAdjustGroup( int /* group */, XkbControlsPtr /* ctrls */ ); extern KeySym *XkbResizeKeySyms( XkbDescPtr /* xkb */, int /* key */, int /* needed */ ); extern XkbAction *XkbResizeKeyActions( XkbDescPtr /* xkb */, int /* key */, int /* needed */ ); extern void XkbUpdateKeyTypesFromCore( DeviceIntPtr /* pXDev */, KeyCode /* first */, CARD8 /* num */, XkbChangesPtr /* pChanges */ ); extern void XkbUpdateDescActions( XkbDescPtr /* xkb */, KeyCode /* first */, CARD8 /* num */, XkbChangesPtr /* changes */ ); extern void XkbUpdateActions( DeviceIntPtr /* pXDev */, KeyCode /* first */, CARD8 /* num */, XkbChangesPtr /* pChanges */, unsigned int * /* needChecksRtrn */, XkbEventCausePtr /* cause */ ); extern void XkbUpdateCoreDescription( DeviceIntPtr /* keybd */, Bool /* resize */ ); extern void XkbApplyMappingChange( DeviceIntPtr /* pXDev */, CARD8 /* request */, KeyCode /* firstKey */, CARD8 /* num */, ClientPtr /* client */ ); extern void XkbSetIndicators( DeviceIntPtr /* pXDev */, CARD32 /* affect */, CARD32 /* values */, XkbEventCausePtr /* cause */ ); extern void XkbUpdateIndicators( DeviceIntPtr /* keybd */, CARD32 /* changed */, Bool /* check_edevs */, XkbChangesPtr /* pChanges */, XkbEventCausePtr /* cause */ ); extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo( DeviceIntPtr /* dev */, KbdFeedbackPtr /* kf */, LedFeedbackPtr /* lf */, unsigned int /* needed_parts */ ); extern XkbSrvLedInfoPtr XkbFindSrvLedInfo( DeviceIntPtr /* dev */, unsigned int /* class */, unsigned int /* id */, unsigned int /* needed_parts */ ); extern void XkbApplyLedNameChanges( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* changed_names */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbApplyLedMapChanges( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* changed_maps */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbApplyLedStateChanges( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* changed_leds */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbFlushLedEvents( DeviceIntPtr /* dev */, DeviceIntPtr /* kbd */, XkbSrvLedInfoPtr /* sli */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern unsigned int XkbIndicatorsToUpdate( DeviceIntPtr /* dev */, unsigned long /* state_changes */, Bool /* enabled_ctrl_changes */ ); extern void XkbComputeDerivedState( XkbSrvInfoPtr /* xkbi */ ); extern void XkbCheckSecondaryEffects( XkbSrvInfoPtr /* xkbi */, unsigned int /* which */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void XkbCheckIndicatorMaps( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* which */ ); extern unsigned int XkbStateChangedFlags( XkbStatePtr /* old */, XkbStatePtr /* new */ ); extern void XkbSendStateNotify( DeviceIntPtr /* kbd */, xkbStateNotify * /* pSN */ ); extern void XkbSendMapNotify( DeviceIntPtr /* kbd */, xkbMapNotify * /* ev */ ); extern int XkbComputeControlsNotify( DeviceIntPtr /* kbd */, XkbControlsPtr /* old */, XkbControlsPtr /* new */, xkbControlsNotify * /* pCN */, Bool /* forceCtrlProc */ ); extern void XkbSendControlsNotify( DeviceIntPtr /* kbd */, xkbControlsNotify * /* ev */ ); extern void XkbSendCompatMapNotify( DeviceIntPtr /* kbd */, xkbCompatMapNotify * /* ev */ ); extern void XkbHandleBell( BOOL /* force */, BOOL /* eventOnly */, DeviceIntPtr /* kbd */, CARD8 /* percent */, void * /* ctrl */, CARD8 /* class */, Atom /* name */, WindowPtr /* pWin */, ClientPtr /* pClient */ ); extern void XkbSendAccessXNotify( DeviceIntPtr /* kbd */, xkbAccessXNotify * /* pEv */ ); extern void XkbSendNamesNotify( DeviceIntPtr /* kbd */, xkbNamesNotify * /* ev */ ); extern void XkbSendCompatNotify( DeviceIntPtr /* kbd */, xkbCompatMapNotify * /* ev */ ); extern void XkbSendActionMessage( DeviceIntPtr /* kbd */, xkbActionMessage * /* ev */ ); extern void XkbSendExtensionDeviceNotify( DeviceIntPtr /* kbd */, ClientPtr /* client */, xkbExtensionDeviceNotify * /* ev */ ); extern void XkbSendNotification( DeviceIntPtr /* kbd */, XkbChangesPtr /* pChanges */, XkbEventCausePtr /* cause */ ); extern void XkbProcessKeyboardEvent( struct _xEvent * /* xE */, DeviceIntPtr /* keybd */, int /* count */ ); extern void XkbProcessOtherEvent( struct _xEvent * /* xE */, DeviceIntPtr /* keybd */, int /* count */ ); extern void XkbHandleActions( DeviceIntPtr /* dev */, DeviceIntPtr /* kbd */, struct _xEvent * /* xE */, int /* count */ ); extern Bool XkbEnableDisableControls( XkbSrvInfoPtr /* xkbi */, unsigned long /* change */, unsigned long /* newValues */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ ); extern void AccessXInit( DeviceIntPtr /* dev */ ); extern Bool AccessXFilterPressEvent( register struct _xEvent * /* xE */, register DeviceIntPtr /* keybd */, int /* count */ ); extern Bool AccessXFilterReleaseEvent( register struct _xEvent * /* xE */, register DeviceIntPtr /* keybd */, int /* count */ ); extern void AccessXCancelRepeatKey( XkbSrvInfoPtr /* xkbi */, KeyCode /* key */ ); extern void AccessXComputeCurveFactor( XkbSrvInfoPtr /* xkbi */, XkbControlsPtr /* ctrls */ ); extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo( XkbDeviceInfoPtr /* devi */, unsigned int /* ledClass */, unsigned int /* ledId */ ); extern XkbDeviceInfoPtr XkbAllocDeviceInfo( unsigned int /* deviceSpec */, unsigned int /* nButtons */, unsigned int /* szLeds */ ); extern void XkbFreeDeviceInfo( XkbDeviceInfoPtr /* devi */, unsigned int /* which */, Bool /* freeDevI */ ); extern Status XkbResizeDeviceButtonActions( XkbDeviceInfoPtr /* devi */, unsigned int /* newTotal */ ); extern XkbInterestPtr XkbFindClientResource( DevicePtr /* inDev */, ClientPtr /* client */ ); extern XkbInterestPtr XkbAddClientResource( DevicePtr /* inDev */, ClientPtr /* client */, XID /* id */ ); extern int XkbRemoveClient( DevicePtr /* inDev */, ClientPtr /* client */ ); extern int XkbRemoveResourceClient( DevicePtr /* inDev */, XID /* id */ ); extern int XkbDDXInitDevice( DeviceIntPtr /* dev */ ); extern int XkbDDXAccessXBeep( DeviceIntPtr /* dev */, unsigned int /* what */, unsigned int /* which */ ); extern void XkbDDXKeyClick( DeviceIntPtr /* dev */, int /* keycode */, int /* synthetic */ ); extern int XkbDDXUsesSoftRepeat( DeviceIntPtr /* dev */ ); extern void XkbDDXKeybdCtrlProc( DeviceIntPtr /* dev */, KeybdCtrl * /* ctrl */ ); extern void XkbDDXChangeControls( DeviceIntPtr /* dev */, XkbControlsPtr /* old */, XkbControlsPtr /* new */ ); extern void XkbDDXUpdateDeviceIndicators( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, CARD32 /* newState */ ); extern void XkbDDXFakePointerButton( int /* event */, int /* button */ ); extern void XkbDDXFakePointerMotion( unsigned int /* flags */, int /* x */, int /* y */ ); extern void XkbDDXFakeDeviceButton( DeviceIntPtr /* dev */, Bool /* press */, int /* button */ ); extern int XkbDDXTerminateServer( DeviceIntPtr /* dev */, KeyCode /* key */, XkbAction * /* act */ ); extern int XkbDDXSwitchScreen( DeviceIntPtr /* dev */, KeyCode /* key */, XkbAction * /* act */ ); extern int XkbDDXPrivate( DeviceIntPtr /* dev */, KeyCode /* key */, XkbAction * /* act */ ); extern void XkbDisableComputedAutoRepeats( DeviceIntPtr /* pXDev */, unsigned int /* key */ ); extern void XkbSetRepeatKeys( DeviceIntPtr /* pXDev */, int /* key */, int /* onoff */ ); extern int XkbLatchModifiers( DeviceIntPtr /* pXDev */, CARD8 /* mask */, CARD8 /* latches */ ); extern int XkbLatchGroup( DeviceIntPtr /* pXDev */, int /* group */ ); extern void XkbClearAllLatchesAndLocks( DeviceIntPtr /* dev */, XkbSrvInfoPtr /* xkbi */, Bool /* genEv */, XkbEventCausePtr /* cause */ ); extern void XkbSetRulesDflts( char * /* rulesFile */, char * /* model */, char * /* layout */, char * /* variant */, char * /* options */ ); extern void XkbInitDevice( DeviceIntPtr /* pXDev */ ); extern Bool XkbInitKeyboardDeviceStruct( DeviceIntPtr /* pXDev */, XkbComponentNamesPtr /* pNames */, KeySymsPtr /* pSyms */, CARD8 /* pMods */[], BellProcPtr /* bellProc */, KbdCtrlProcPtr /* ctrlProc */ ); extern int SProcXkbDispatch( ClientPtr /* client */ ); extern XkbGeometryPtr XkbLookupNamedGeometry( DeviceIntPtr /* dev */, Atom /* name */, Bool * /* shouldFree */ ); extern void XkbConvertCase( KeySym /* sym */, KeySym * /* lower */, KeySym * /* upper */ ); extern Status XkbChangeKeycodeRange( XkbDescPtr /* xkb */, int /* minKC */, int /* maxKC */, XkbChangesPtr /* changes */ ); extern int XkbFinishDeviceInit( DeviceIntPtr /* pXDev */ ); extern void XkbFreeSrvLedInfo( XkbSrvLedInfoPtr /* sli */ ); extern void XkbFreeInfo( XkbSrvInfoPtr /* xkbi */ ); extern Status XkbChangeTypesOfKey( XkbDescPtr /* xkb */, int /* key */, int /* nGroups */, unsigned int /* groups */, int * /* newTypesIn */, XkbMapChangesPtr /* changes */ ); extern XkbKeyTypePtr XkbAddKeyType( XkbDescPtr /* xkb */, Atom /* name */, int /* map_count */, Bool /* want_preserve */, int /* num_lvls */ ); extern Status XkbInitCanonicalKeyTypes( XkbDescPtr /* xkb */, unsigned int /* which */, int /* keypadVMod */ ); extern int XkbKeyTypesForCoreSymbols( XkbDescPtr /* xkb */, int /* map_width */, KeySym * /* core_syms */, unsigned int /* protected */, int * /* types_inout */, KeySym * /* xkb_syms_rtrn */ ); extern Bool XkbApplyCompatMapToKey( XkbDescPtr /* xkb */, KeyCode /* key */, XkbChangesPtr /* changes */ ); extern Bool XkbUpdateMapFromCore( XkbDescPtr /* xkb */, KeyCode /* first_key */, int /* num_keys */, int /* map_width */, KeySym * /* core_keysyms */, XkbChangesPtr /* changes */ ); extern Bool XkbApplyVirtualModChanges( XkbDescPtr /* xkb */, unsigned int /* changed */, XkbChangesPtr /* changes */ ); extern void XkbSendNewKeyboardNotify( DeviceIntPtr /* kbd */, xkbNewKeyboardNotify * /* pNKN */ ); #include #include "xkbfile.h" #include "xkbrules.h" #define _XkbListKeymaps 0 #define _XkbListKeycodes 1 #define _XkbListTypes 2 #define _XkbListCompat 3 #define _XkbListSymbols 4 #define _XkbListGeometry 5 #define _XkbListNumComponents 6 typedef struct _XkbSrvListInfo { int szPool; int nPool; char * pool; int maxRtrn; int nTotal; char * pattern[_XkbListNumComponents]; int nFound[_XkbListNumComponents]; } XkbSrvListInfoRec,*XkbSrvListInfoPtr; extern Status XkbDDXList( DeviceIntPtr /* dev */, XkbSrvListInfoPtr /* listing */, ClientPtr /* client */ ); extern unsigned int XkbDDXLoadKeymapByNames( DeviceIntPtr /* keybd */, XkbComponentNamesPtr /* names */, unsigned int /* want */, unsigned int /* need */, XkbFileInfoPtr /* finfoRtrn */, char * /* keymapNameRtrn */, int /* keymapNameRtrnLen */ ); extern Bool XkbDDXNamesFromRules( DeviceIntPtr /* keybd */, char * /* rules */, XkbRF_VarDefsPtr /* defs */, XkbComponentNamesPtr /* names */ ); extern Bool XkbDDXApplyConfig( XPointer /* cfg_in */, XkbSrvInfoPtr /* xkbi */ ); extern XPointer XkbDDXPreloadConfig( char ** /* rulesFileRtrn */, XkbRF_VarDefsPtr /* defs */, XkbComponentNamesPtr /* names */, DeviceIntPtr /* dev */ ); extern int _XkbStrCaseCmp( char * /* str1 */, char * /* str2 */ ); _XFUNCPROTOEND #endif /* _XKBSRV_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/xkbstr.h0000644000000000000000000004320313614532331017706 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBSTR_H_ #define _XKBSTR_H_ #include #define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f)) #define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff))) #define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l))) /* * Common data structures and access macros */ typedef struct _XkbStateRec { unsigned char group; unsigned char locked_group; unsigned short base_group; unsigned short latched_group; unsigned char mods; unsigned char base_mods; unsigned char latched_mods; unsigned char locked_mods; unsigned char compat_state; unsigned char grab_mods; unsigned char compat_grab_mods; unsigned char lookup_mods; unsigned char compat_lookup_mods; unsigned short ptr_buttons; } XkbStateRec,*XkbStatePtr; #define XkbModLocks(s) ((s)->locked_mods) #define XkbStateMods(s) ((s)->base_mods|(s)->latched_mods|XkbModLocks(s)) #define XkbGroupLock(s) ((s)->locked_group) #define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s)) #define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group) #define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group) typedef struct _XkbMods { unsigned char mask; /* effective mods */ unsigned char real_mods; unsigned short vmods; } XkbModsRec,*XkbModsPtr; typedef struct _XkbKTMapEntry { Bool active; unsigned char level; XkbModsRec mods; } XkbKTMapEntryRec,*XkbKTMapEntryPtr; typedef struct _XkbKeyType { XkbModsRec mods; unsigned char num_levels; unsigned char map_count; XkbKTMapEntryPtr map; XkbModsPtr preserve; Atom name; Atom * level_names; } XkbKeyTypeRec, *XkbKeyTypePtr; #define XkbNumGroups(g) ((g)&0x0f) #define XkbOutOfRangeGroupInfo(g) ((g)&0xf0) #define XkbOutOfRangeGroupAction(g) ((g)&0xc0) #define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4) #define XkbSetGroupInfo(g,w,n) (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f)) #define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f)) /* * Structures and access macros used primarily by the server */ typedef struct _XkbBehavior { unsigned char type; unsigned char data; } XkbBehavior; #define XkbAnyActionDataSize 7 typedef struct _XkbAnyAction { unsigned char type; unsigned char data[XkbAnyActionDataSize]; } XkbAnyAction; typedef struct _XkbModAction { unsigned char type; unsigned char flags; unsigned char mask; unsigned char real_mods; unsigned char vmods1; unsigned char vmods2; } XkbModAction; #define XkbModActionVMods(a) \ ((short)(((a)->vmods1<<8)|((a)->vmods2))) #define XkbSetModActionVMods(a,v) \ (((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff)) typedef struct _XkbGroupAction { unsigned char type; unsigned char flags; char group_XXX; } XkbGroupAction; #define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX)) #define XkbSASetGroup(a,g) ((a)->group_XXX=(g)) typedef struct _XkbISOAction { unsigned char type; unsigned char flags; unsigned char mask; unsigned char real_mods; char group_XXX; unsigned char affect; unsigned char vmods1; unsigned char vmods2; } XkbISOAction; typedef struct _XkbPtrAction { unsigned char type; unsigned char flags; unsigned char high_XXX; unsigned char low_XXX; unsigned char high_YYY; unsigned char low_YYY; } XkbPtrAction; #define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX)) #define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY)) #define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX)) #define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY)) typedef struct _XkbPtrBtnAction { unsigned char type; unsigned char flags; unsigned char count; unsigned char button; } XkbPtrBtnAction; typedef struct _XkbPtrDfltAction { unsigned char type; unsigned char flags; unsigned char affect; char valueXXX; } XkbPtrDfltAction; #define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX)) #define XkbSASetPtrDfltValue(a,c) ((a)->valueXXX= ((c)&0xff)) typedef struct _XkbSwitchScreenAction { unsigned char type; unsigned char flags; char screenXXX; } XkbSwitchScreenAction; #define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX)) #define XkbSASetScreen(a,s) ((a)->screenXXX= ((s)&0xff)) typedef struct _XkbCtrlsAction { unsigned char type; unsigned char flags; unsigned char ctrls3; unsigned char ctrls2; unsigned char ctrls1; unsigned char ctrls0; } XkbCtrlsAction; #define XkbActionSetCtrls(a,c) (((a)->ctrls3=(((c)>>24)&0xff)),\ ((a)->ctrls2=(((c)>>16)&0xff)),\ ((a)->ctrls1=(((c)>>8)&0xff)),\ ((a)->ctrls0=((c)&0xff))) #define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\ (((unsigned int)(a)->ctrls2)<<16)|\ (((unsigned int)(a)->ctrls1)<<8)|\ ((unsigned int)((a)->ctrls0))) typedef struct _XkbMessageAction { unsigned char type; unsigned char flags; unsigned char message[6]; } XkbMessageAction; typedef struct _XkbRedirectKeyAction { unsigned char type; unsigned char new_key; unsigned char mods_mask; unsigned char mods; unsigned char vmods_mask0; unsigned char vmods_mask1; unsigned char vmods0; unsigned char vmods1; } XkbRedirectKeyAction; #define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\ ((unsigned int)(a)->vmods0)) #define XkbSARedirectSetVMods(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ ((a)->vmods_mask0=((m)&0xff))) #define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|\ ((unsigned int)(a)->vmods_mask0)) #define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ ((a)->vmods_mask0=((m)&0xff))) typedef struct _XkbDeviceBtnAction { unsigned char type; unsigned char flags; unsigned char count; unsigned char button; unsigned char device; } XkbDeviceBtnAction; typedef struct _XkbDeviceValuatorAction { unsigned char type; unsigned char device; unsigned char v1_what; unsigned char v1_ndx; unsigned char v1_value; unsigned char v2_what; unsigned char v2_ndx; unsigned char v2_value; } XkbDeviceValuatorAction; typedef union _XkbAction { XkbAnyAction any; XkbModAction mods; XkbGroupAction group; XkbISOAction iso; XkbPtrAction ptr; XkbPtrBtnAction btn; XkbPtrDfltAction dflt; XkbSwitchScreenAction screen; XkbCtrlsAction ctrls; XkbMessageAction msg; XkbRedirectKeyAction redirect; XkbDeviceBtnAction devbtn; XkbDeviceValuatorAction devval; unsigned char type; } XkbAction; typedef struct _XkbControls { unsigned char mk_dflt_btn; unsigned char num_groups; unsigned char groups_wrap; XkbModsRec internal; XkbModsRec ignore_lock; unsigned int enabled_ctrls; unsigned short repeat_delay; unsigned short repeat_interval; unsigned short slow_keys_delay; unsigned short debounce_delay; unsigned short mk_delay; unsigned short mk_interval; unsigned short mk_time_to_max; unsigned short mk_max_speed; short mk_curve; unsigned short ax_options; unsigned short ax_timeout; unsigned short axt_opts_mask; unsigned short axt_opts_values; unsigned int axt_ctrls_mask; unsigned int axt_ctrls_values; unsigned char per_key_repeat[XkbPerKeyBitArraySize]; } XkbControlsRec, *XkbControlsPtr; #define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask) #define XkbAX_NeedOption(c,w) ((c)->ax_options&(w)) #define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w)) typedef struct _XkbServerMapRec { unsigned short num_acts; unsigned short size_acts; XkbAction *acts; XkbBehavior *behaviors; unsigned short *key_acts; #if defined(__cplusplus) || defined(c_plusplus) /* explicit is a C++ reserved word */ unsigned char *c_explicit; #else unsigned char *explicit; #endif unsigned char vmods[XkbNumVirtualMods]; unsigned short *vmodmap; } XkbServerMapRec, *XkbServerMapPtr; #define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]]) /* * Structures and access macros used primarily by clients */ typedef struct _XkbSymMapRec { unsigned char kt_index[XkbNumKbdGroups]; unsigned char group_info; unsigned char width; unsigned short offset; } XkbSymMapRec, *XkbSymMapPtr; typedef struct _XkbClientMapRec { unsigned char size_types; unsigned char num_types; XkbKeyTypePtr types; unsigned short size_syms; unsigned short num_syms; KeySym *syms; XkbSymMapPtr key_sym_map; unsigned char *modmap; } XkbClientMapRec, *XkbClientMapPtr; #define XkbCMKeyGroupInfo(m,k) ((m)->key_sym_map[k].group_info) #define XkbCMKeyNumGroups(m,k) (XkbNumGroups((m)->key_sym_map[k].group_info)) #define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels) #define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width) #define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3]) #define XkbCMKeyType(m,k,g) (&(m)->types[XkbCMKeyTypeIndex(m,k,g)]) #define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k)) #define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset) #define XkbCMKeySymsPtr(m,k) (&(m)->syms[XkbCMKeySymsOffset(m,k)]) /* * Compatibility structures and access macros */ typedef struct _XkbSymInterpretRec { KeySym sym; unsigned char flags; unsigned char match; unsigned char mods; unsigned char virtual_mod; XkbAnyAction act; } XkbSymInterpretRec,*XkbSymInterpretPtr; typedef struct _XkbCompatMapRec { XkbSymInterpretPtr sym_interpret; XkbModsRec groups[XkbNumKbdGroups]; unsigned short num_si; unsigned short size_si; } XkbCompatMapRec, *XkbCompatMapPtr; typedef struct _XkbIndicatorMapRec { unsigned char flags; unsigned char which_groups; unsigned char groups; unsigned char which_mods; XkbModsRec mods; unsigned int ctrls; } XkbIndicatorMapRec, *XkbIndicatorMapPtr; #define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&\ (((i)->which_groups&&(i)->groups)||\ ((i)->which_mods&&(i)->mods.mask)||\ ((i)->ctrls))) #define XkbIM_InUse(i) (((i)->flags)||((i)->which_groups)||\ ((i)->which_mods)||((i)->ctrls)) typedef struct _XkbIndicatorRec { unsigned long phys_indicators; XkbIndicatorMapRec maps[XkbNumIndicators]; } XkbIndicatorRec,*XkbIndicatorPtr; typedef struct _XkbKeyNameRec { char name[XkbKeyNameLength]; } XkbKeyNameRec,*XkbKeyNamePtr; typedef struct _XkbKeyAliasRec { char real[XkbKeyNameLength]; char alias[XkbKeyNameLength]; } XkbKeyAliasRec,*XkbKeyAliasPtr; /* * Names for everything */ typedef struct _XkbNamesRec { Atom keycodes; Atom geometry; Atom symbols; Atom types; Atom compat; Atom vmods[XkbNumVirtualMods]; Atom indicators[XkbNumIndicators]; Atom groups[XkbNumKbdGroups]; XkbKeyNamePtr keys; XkbKeyAliasPtr key_aliases; Atom *radio_groups; Atom phys_symbols; unsigned char num_keys; unsigned char num_key_aliases; unsigned short num_rg; } XkbNamesRec,*XkbNamesPtr; typedef struct _XkbGeometry *XkbGeometryPtr; /* * Tie it all together into one big keyboard description */ typedef struct _XkbDesc { struct _XDisplay * dpy; unsigned short flags; unsigned short device_spec; KeyCode min_key_code; KeyCode max_key_code; XkbControlsPtr ctrls; XkbServerMapPtr server; XkbClientMapPtr map; XkbIndicatorPtr indicators; XkbNamesPtr names; XkbCompatMapPtr compat; XkbGeometryPtr geom; } XkbDescRec, *XkbDescPtr; #define XkbKeyKeyTypeIndex(d,k,g) (XkbCMKeyTypeIndex((d)->map,k,g)) #define XkbKeyKeyType(d,k,g) (XkbCMKeyType((d)->map,k,g)) #define XkbKeyGroupWidth(d,k,g) (XkbCMKeyGroupWidth((d)->map,k,g)) #define XkbKeyGroupsWidth(d,k) (XkbCMKeyGroupsWidth((d)->map,k)) #define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k))) #define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k))) #define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k))) #define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k))) #define XkbKeySym(d,k,n) (XkbKeySymsPtr(d,k)[n]) #define XkbKeySymEntry(d,k,sl,g) \ (XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl)))) #define XkbKeyAction(d,k,n) \ (XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL) #define XkbKeyActionEntry(d,k,sl,g) \ (XkbKeyHasActions(d,k)?\ XkbKeyAction(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))):NULL) #define XkbKeyHasActions(d,k) ((d)->server->key_acts[k]!=0) #define XkbKeyNumActions(d,k) (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1) #define XkbKeyActionsPtr(d,k) (XkbSMKeyActionsPtr((d)->server,k)) #define XkbKeycodeInRange(d,k) (((k)>=(d)->min_key_code)&&\ ((k)<=(d)->max_key_code)) #define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1) /* * The following structures can be used to track changes * to a keyboard device */ typedef struct _XkbMapChanges { unsigned short changed; KeyCode min_key_code; KeyCode max_key_code; unsigned char first_type; unsigned char num_types; KeyCode first_key_sym; unsigned char num_key_syms; KeyCode first_key_act; unsigned char num_key_acts; KeyCode first_key_behavior; unsigned char num_key_behaviors; KeyCode first_key_explicit; unsigned char num_key_explicit; KeyCode first_modmap_key; unsigned char num_modmap_keys; KeyCode first_vmodmap_key; unsigned char num_vmodmap_keys; unsigned char pad; unsigned short vmods; } XkbMapChangesRec,*XkbMapChangesPtr; typedef struct _XkbControlsChanges { unsigned int changed_ctrls; unsigned int enabled_ctrls_changes; Bool num_groups_changed; } XkbControlsChangesRec,*XkbControlsChangesPtr; typedef struct _XkbIndicatorChanges { unsigned int state_changes; unsigned int map_changes; } XkbIndicatorChangesRec,*XkbIndicatorChangesPtr; typedef struct _XkbNameChanges { unsigned int changed; unsigned char first_type; unsigned char num_types; unsigned char first_lvl; unsigned char num_lvls; unsigned char num_aliases; unsigned char num_rg; unsigned char first_key; unsigned char num_keys; unsigned short changed_vmods; unsigned long changed_indicators; unsigned char changed_groups; } XkbNameChangesRec,*XkbNameChangesPtr; typedef struct _XkbCompatChanges { unsigned char changed_groups; unsigned short first_si; unsigned short num_si; } XkbCompatChangesRec,*XkbCompatChangesPtr; typedef struct _XkbChanges { unsigned short device_spec; unsigned short state_changes; XkbMapChangesRec map; XkbControlsChangesRec ctrls; XkbIndicatorChangesRec indicators; XkbNameChangesRec names; XkbCompatChangesRec compat; } XkbChangesRec, *XkbChangesPtr; /* * These data structures are used to construct a keymap from * a set of components or to list components in the server * database. */ typedef struct _XkbComponentNames { char * keymap; char * keycodes; char * types; char * compat; char * symbols; char * geometry; } XkbComponentNamesRec, *XkbComponentNamesPtr; typedef struct _XkbComponentName { unsigned short flags; char * name; } XkbComponentNameRec,*XkbComponentNamePtr; typedef struct _XkbComponentList { int num_keymaps; int num_keycodes; int num_types; int num_compat; int num_symbols; int num_geometry; XkbComponentNamePtr keymaps; XkbComponentNamePtr keycodes; XkbComponentNamePtr types; XkbComponentNamePtr compat; XkbComponentNamePtr symbols; XkbComponentNamePtr geometry; } XkbComponentListRec, *XkbComponentListPtr; /* * The following data structures describe and track changes to a * non-keyboard extension device */ typedef struct _XkbDeviceLedInfo { unsigned short led_class; unsigned short led_id; unsigned int phys_indicators; unsigned int maps_present; unsigned int names_present; unsigned int state; Atom names[XkbNumIndicators]; XkbIndicatorMapRec maps[XkbNumIndicators]; } XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr; typedef struct _XkbDeviceInfo { char * name; Atom type; unsigned short device_spec; Bool has_own_state; unsigned short supported; unsigned short unsupported; unsigned short num_btns; XkbAction * btn_acts; unsigned short sz_leds; unsigned short num_leds; unsigned short dflt_kbd_fb; unsigned short dflt_led_fb; XkbDeviceLedInfoPtr leds; } XkbDeviceInfoRec,*XkbDeviceInfoPtr; #define XkbXI_DevHasBtnActs(d) (((d)->num_btns>0)&&((d)->btn_acts!=NULL)) #define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns)) #define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL)) typedef struct _XkbDeviceLedChanges { unsigned short led_class; unsigned short led_id; unsigned int defined; /* names or maps changed */ struct _XkbDeviceLedChanges *next; } XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr; typedef struct _XkbDeviceChanges { unsigned int changed; unsigned short first_btn; unsigned short num_btns; XkbDeviceLedChangesRec leds; } XkbDeviceChangesRec,*XkbDeviceChangesPtr; #endif /* _XKBSTR_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/include/Xprintf.h0000644000000000000000000000614013614532331020022 0ustar /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef XPRINTF_H #define XPRINTF_H #include #include #include #ifndef _X_RESTRICT_KYWD #if defined(restrict) /* assume autoconf set it correctly */ || \ (defined(__STDC__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */ #define _X_RESTRICT_KYWD restrict #elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */ #define _X_RESTRICT_KYWD __restrict__ #else #define _X_RESTRICT_KYWD #endif #endif /* * These functions provide a portable implementation of the common (but not * yet universal) asprintf & vasprintf routines to allocate a buffer big * enough to sprintf the arguments to. The XNF variants terminate the server * if the allocation fails. * The buffer allocated is returned in the pointer provided in the first * argument. The return value is the size of the allocated buffer, or -1 * on failure. */ extern _X_EXPORT int Xasprintf(char **ret, const char *_X_RESTRICT_KYWD fmt, ...) _X_ATTRIBUTE_PRINTF(2, 3); extern _X_EXPORT int Xvasprintf(char **ret, const char *_X_RESTRICT_KYWD fmt, va_list va) _X_ATTRIBUTE_PRINTF(2, 0); extern _X_EXPORT int XNFasprintf(char **ret, const char *_X_RESTRICT_KYWD fmt, ...) _X_ATTRIBUTE_PRINTF(2, 3); extern _X_EXPORT int XNFvasprintf(char **ret, const char *_X_RESTRICT_KYWD fmt, va_list va) _X_ATTRIBUTE_PRINTF(2, 0); #if !defined(HAVE_ASPRINTF) && !defined(HAVE_VASPRINTF) #define asprintf Xasprintf #define vasprintf Xvasprintf #endif /* * These functions provide a portable implementation of the linux kernel * scnprintf & vscnprintf routines that return the number of bytes actually * copied during a snprintf, (excluding the final '\0'). */ extern _X_EXPORT int Xscnprintf(char *s, int n, const char * _X_RESTRICT_KYWD fmt, ...) _X_ATTRIBUTE_PRINTF(3,4); extern _X_EXPORT int Xvscnprintf(char *s, int n, const char * _X_RESTRICT_KYWD fmt, va_list va) _X_ATTRIBUTE_PRINTF(3,0); #endif /* XPRINTF_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/cbrt.c0000644000000000000000000000275713614532331016311 0ustar /* Copyright 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* simple cbrt, in case your math library doesn't have a good one */ /* * Would normally include for this, but for the sake of compiler * warnings, we don't want to get duplicate declarations for cbrt(). */ double pow(double, double); double cbrt(double); double cbrt(double x) { if (x > 0.0) return pow(x, 1.0/3.0); else return -pow(-x, 1.0/3.0); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/miext/cw/cw.c0000644000000000000000000004323313614532331017114 0ustar /* * Copyright © 2004 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* $Header: /cvs/xorg/xc/programs/Xserver/miext/cw/cw.c,v 1.23 2005/10/02 08:28:26 anholt Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "gcstruct.h" #include "windowstr.h" #include "cw.h" #define CW_DEBUG 1 #if CW_DEBUG #define CW_ASSERT(x) do { \ if (!(x)) { \ ErrorF("composite wrapper: assertion failed at %s:%d\n", __FUNC__, \ __LINE__); \ } \ } while (0) #else #define CW_ASSERT(x) do {} while (0) #endif int cwGCIndex; int cwScreenIndex; int cwWindowIndex; #ifdef RENDER int cwPictureIndex; #endif static Bool cwDisabled[MAXSCREENS]; static unsigned long cwGeneration = 0; extern GCOps cwGCOps; static Bool cwCloseScreen (ScreenPtr pScreen); static void cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable); static void cwChangeGC(GCPtr pGC, unsigned long mask); static void cwCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); static void cwDestroyGC(GCPtr pGC); static void cwChangeClip(GCPtr pGC, int type, void * pvalue, int nrects); static void cwCopyClip(GCPtr pgcDst, GCPtr pgcSrc); static void cwDestroyClip(GCPtr pGC); GCFuncs cwGCFuncs = { cwValidateGC, cwChangeGC, cwCopyGC, cwDestroyGC, cwChangeClip, cwDestroyClip, cwCopyClip, }; /* Find the real drawable to draw to, and provide offsets that will translate * window coordinates to backing pixmap coordinates. */ DrawablePtr cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off) { PixmapPtr pPixmap; if (pDrawable->type == DRAWABLE_WINDOW && (pPixmap = getCwPixmap ((WindowPtr) pDrawable))) { *x_off = pDrawable->x - pPixmap->screen_x; *y_off = pDrawable->y - pPixmap->screen_y; return &pPixmap->drawable; } else { *x_off = *y_off = 0; return pDrawable; } } #define FUNC_PROLOGUE(pGC, pPriv) do { \ (pGC)->funcs = (pPriv)->wrapFuncs; \ (pGC)->ops = (pPriv)->wrapOps; \ } while (0) #define FUNC_EPILOGUE(pGC, pPriv) do { \ (pPriv)->wrapFuncs = (pGC)->funcs; \ (pPriv)->wrapOps = (pGC)->ops; \ (pGC)->funcs = &cwGCFuncs; \ (pGC)->ops = &cwGCOps; \ } while (0) static Bool cwCreateBackingGC(GCPtr pGC, DrawablePtr pDrawable) { cwGCRec *pPriv = getCwGC(pGC); int status, x_off, y_off; XID noexpose = xFalse; DrawablePtr pBackingDrawable; pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off); pPriv->pBackingGC = CreateGC(pBackingDrawable, GCGraphicsExposures, &noexpose, &status); if (status != Success) return FALSE; pPriv->serialNumber = 0; pPriv->stateChanges = (1 << (GCLastBit + 1)) - 1; return TRUE; } static void cwDestroyBackingGC(GCPtr pGC) { cwGCPtr pPriv; pPriv = (cwGCPtr) getCwGC (pGC); if (pPriv->pBackingGC) { FreeGC(pPriv->pBackingGC, (XID)0); pPriv->pBackingGC = NULL; } } static void cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable) { GCPtr pBackingGC; cwGCPtr pPriv; DrawablePtr pBackingDrawable; int x_off, y_off; pPriv = (cwGCPtr) getCwGC (pGC); FUNC_PROLOGUE(pGC, pPriv); /* * Must call ValidateGC to ensure pGC->pCompositeClip is valid */ (*pGC->funcs->ValidateGC)(pGC, stateChanges, pDrawable); if (!cwDrawableIsRedirWindow(pDrawable)) { cwDestroyBackingGC(pGC); FUNC_EPILOGUE(pGC, pPriv); return; } else { if (!pPriv->pBackingGC && !cwCreateBackingGC(pGC, pDrawable)) { FUNC_EPILOGUE(pGC, pPriv); return; } } pBackingGC = pPriv->pBackingGC; pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off); pPriv->stateChanges |= stateChanges; /* * Copy the composite clip into the backing GC if either * the drawable clip list has changed or the client has changed * the client clip data */ if (pDrawable->serialNumber != pPriv->serialNumber || (pPriv->stateChanges & (GCClipXOrigin|GCClipYOrigin|GCClipMask))) { XID vals[2]; RegionPtr pCompositeClip; pCompositeClip = RegionCreate(NULL, 0); RegionCopy(pCompositeClip, pGC->pCompositeClip); /* Either the drawable has changed, or the clip list in the drawable has * changed. Copy the new clip list over and set the new translated * offset for it. */ (*pBackingGC->funcs->ChangeClip) (pBackingGC, CT_REGION, (void *) pCompositeClip, 0); vals[0] = x_off - pDrawable->x; vals[1] = y_off - pDrawable->y; dixChangeGC(NullClient, pBackingGC, (GCClipXOrigin | GCClipYOrigin), vals, NULL); pPriv->serialNumber = pDrawable->serialNumber; /* * Mask off any client clip changes to make sure * the clip list set above remains in effect */ pPriv->stateChanges &= ~(GCClipXOrigin|GCClipYOrigin|GCClipMask); } if (pPriv->stateChanges) { CopyGC(pGC, pBackingGC, pPriv->stateChanges); pPriv->stateChanges = 0; } if ((pGC->patOrg.x + x_off) != pBackingGC->patOrg.x || (pGC->patOrg.y + y_off) != pBackingGC->patOrg.y) { XID vals[2]; vals[0] = pGC->patOrg.x + x_off; vals[1] = pGC->patOrg.y + y_off; dixChangeGC(NullClient, pBackingGC, (GCTileStipXOrigin | GCTileStipYOrigin), vals, NULL); } ValidateGC(pBackingDrawable, pBackingGC); FUNC_EPILOGUE(pGC, pPriv); } static void cwChangeGC(GCPtr pGC, unsigned long mask) { cwGCPtr pPriv = (cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr; FUNC_PROLOGUE(pGC, pPriv); (*pGC->funcs->ChangeGC) (pGC, mask); FUNC_EPILOGUE(pGC, pPriv); } static void cwCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) { cwGCPtr pPriv = (cwGCPtr)(pGCDst)->devPrivates[cwGCIndex].ptr; FUNC_PROLOGUE(pGCDst, pPriv); (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); FUNC_EPILOGUE(pGCDst, pPriv); } static void cwDestroyGC(GCPtr pGC) { cwGCPtr pPriv = (cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr; FUNC_PROLOGUE(pGC, pPriv); cwDestroyBackingGC(pGC); (*pGC->funcs->DestroyGC) (pGC); /* leave it unwrapped */ } static void cwChangeClip(GCPtr pGC, int type, void * pvalue, int nrects) { cwGCPtr pPriv = (cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr; FUNC_PROLOGUE(pGC, pPriv); (*pGC->funcs->ChangeClip)(pGC, type, pvalue, nrects); FUNC_EPILOGUE(pGC, pPriv); } static void cwCopyClip(GCPtr pgcDst, GCPtr pgcSrc) { cwGCPtr pPriv = (cwGCPtr)(pgcDst)->devPrivates[cwGCIndex].ptr; FUNC_PROLOGUE(pgcDst, pPriv); (*pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); FUNC_EPILOGUE(pgcDst, pPriv); } static void cwDestroyClip(GCPtr pGC) { cwGCPtr pPriv = (cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr; FUNC_PROLOGUE(pGC, pPriv); (*pGC->funcs->DestroyClip)(pGC); FUNC_EPILOGUE(pGC, pPriv); } /* * Screen wrappers. */ #define SCREEN_PROLOGUE(pScreen, field) \ ((pScreen)->field = getCwScreen(pScreen)->field) #define SCREEN_EPILOGUE(pScreen, field, wrapper) do { \ getCwScreen(pScreen)->field = (pScreen)->field; \ (pScreen)->field = (wrapper); \ } while (0) static Bool cwCreateGC(GCPtr pGC) { cwGCPtr pPriv = getCwGC(pGC); ScreenPtr pScreen = pGC->pScreen; Bool ret; bzero(pPriv, sizeof(cwGCRec)); SCREEN_PROLOGUE(pScreen, CreateGC); if ( (ret = (*pScreen->CreateGC)(pGC)) ) FUNC_EPILOGUE(pGC, pPriv); SCREEN_EPILOGUE(pScreen, CreateGC, cwCreateGC); return ret; } static void cwGetImage(DrawablePtr pSrc, int x, int y, int w, int h, unsigned int format, unsigned long planemask, char *pdstLine) { ScreenPtr pScreen = pSrc->pScreen; DrawablePtr pBackingDrawable; int src_off_x, src_off_y; SCREEN_PROLOGUE(pScreen, GetImage); pBackingDrawable = cwGetBackingDrawable(pSrc, &src_off_x, &src_off_y); CW_OFFSET_XY_SRC(x, y); (*pScreen->GetImage)(pBackingDrawable, x, y, w, h, format, planemask, pdstLine); SCREEN_EPILOGUE(pScreen, GetImage, cwGetImage); } static void cwGetSpans(DrawablePtr pSrc, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart) { ScreenPtr pScreen = pSrc->pScreen; DrawablePtr pBackingDrawable; int i; int src_off_x, src_off_y; SCREEN_PROLOGUE(pScreen, GetSpans); pBackingDrawable = cwGetBackingDrawable(pSrc, &src_off_x, &src_off_y); for (i = 0; i < nspans; i++) CW_OFFSET_XY_SRC(ppt[i].x, ppt[i].y); (*pScreen->GetSpans)(pBackingDrawable, wMax, ppt, pwidth, nspans, pdstStart); SCREEN_EPILOGUE(pScreen, GetSpans, cwGetSpans); } static void cwFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion, unsigned long pixel) { ScreenPtr pScreen = pDrawable->pScreen; GCPtr pGC; BoxPtr pBox; int nbox, i; ChangeGCVal v[3]; pGC = GetScratchGC(pDrawable->depth, pScreen); v[0].val = GXcopy; v[1].val = pixel; v[2].val = FillSolid; dixChangeGC(NullClient, pGC, (GCFunction | GCForeground | GCFillStyle), NULL, v); ValidateGC(pDrawable, pGC); pBox = RegionRects(pRegion); nbox = RegionNumRects(pRegion); for (i = 0; i < nbox; i++, pBox++) { xRectangle rect; rect.x = pBox->x1; rect.y = pBox->y1; rect.width = pBox->x2 - pBox->x1; rect.height = pBox->y2 - pBox->y1; (*pGC->ops->PolyFillRect)(pDrawable, pGC, 1, &rect); } FreeScratchGC(pGC); } static void cwFillRegionTiled(DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile, int x_off, int y_off) { ScreenPtr pScreen = pDrawable->pScreen; GCPtr pGC; BoxPtr pBox; int nbox, i; ChangeGCVal v[5]; pGC = GetScratchGC(pDrawable->depth, pScreen); v[0].val = GXcopy; v[1].val = FillTiled; v[2].ptr = (void *) pTile; v[3].val = x_off; v[4].val = y_off; dixChangeGC(NullClient, pGC, (GCFunction | GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin), NULL, v); ValidateGC(pDrawable, pGC); pBox = RegionRects(pRegion); nbox = RegionNumRects(pRegion); for (i = 0; i < nbox; i++, pBox++) { xRectangle rect; rect.x = pBox->x1; rect.y = pBox->y1; rect.width = pBox->x2 - pBox->x1; rect.height = pBox->y2 - pBox->y1; (*pGC->ops->PolyFillRect)(pDrawable, pGC, 1, &rect); } FreeScratchGC(pGC); } static void cwPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) { ScreenPtr pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE(pScreen, PaintWindowBackground); if (!cwDrawableIsRedirWindow((DrawablePtr)pWin)) { (*pScreen->PaintWindowBackground)(pWin, pRegion, what); } else { DrawablePtr pBackingDrawable; int x_off, y_off, x_screen, y_screen; while (pWin->backgroundState == ParentRelative) pWin = pWin->parent; pBackingDrawable = cwGetBackingDrawable((DrawablePtr)pWin, &x_off, &y_off); x_screen = x_off - pWin->drawable.x; y_screen = y_off - pWin->drawable.y; if (pWin && (pWin->backgroundState == BackgroundPixel || pWin->backgroundState == BackgroundPixmap)) { RegionTranslate(pRegion, x_screen, y_screen); if (pWin->backgroundState == BackgroundPixel) { cwFillRegionSolid(pBackingDrawable, pRegion, pWin->background.pixel); } else { cwFillRegionTiled(pBackingDrawable, pRegion, pWin->background.pixmap, x_off, y_off); } RegionTranslate(pRegion, -x_screen, -y_screen); } } SCREEN_EPILOGUE(pScreen, PaintWindowBackground, cwPaintWindowBackground); } static void cwPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) { ScreenPtr pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE(pScreen, PaintWindowBorder); if (!cwDrawableIsRedirWindow((DrawablePtr)pWin)) { (*pScreen->PaintWindowBorder)(pWin, pRegion, what); } else { DrawablePtr pBackingDrawable; int x_off, y_off, x_screen, y_screen; pBackingDrawable = cwGetBackingDrawable((DrawablePtr)pWin, &x_off, &y_off); x_screen = x_off - pWin->drawable.x; y_screen = y_off - pWin->drawable.y; RegionTranslate(pRegion, x_screen, y_screen); if (pWin->borderIsPixel) { cwFillRegionSolid(pBackingDrawable, pRegion, pWin->border.pixel); } else { cwFillRegionTiled(pBackingDrawable, pRegion, pWin->border.pixmap, x_off, y_off); } RegionTranslate(pRegion, -x_screen, -y_screen); } SCREEN_EPILOGUE(pScreen, PaintWindowBorder, cwPaintWindowBorder); } static void cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE(pScreen, CopyWindow); if (!cwDrawableIsRedirWindow((DrawablePtr)pWin)) { (*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc); } else { GCPtr pGC; BoxPtr pExtents; int x_off, y_off; int dx, dy; PixmapPtr pBackingPixmap; RegionPtr pClip; int src_x, src_y, dst_x, dst_y, w, h; dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; pExtents = RegionExtents(prgnSrc); pBackingPixmap = (PixmapPtr) cwGetBackingDrawable((DrawablePtr)pWin, &x_off, &y_off); src_x = pExtents->x1 - pBackingPixmap->screen_x; src_y = pExtents->y1 - pBackingPixmap->screen_y; w = pExtents->x2 - pExtents->x1; h = pExtents->y2 - pExtents->y1; dst_x = src_x - dx; dst_y = src_y - dy; /* Translate region (as required by API) */ RegionTranslate(prgnSrc, -dx, -dy); pGC = GetScratchGC(pBackingPixmap->drawable.depth, pScreen); /* * Copy region to GC as clip, aligning as dest clip */ pClip = RegionCreate(NULL, 0); RegionIntersect(pClip, &pWin->borderClip, prgnSrc); RegionTranslate(pClip, -pBackingPixmap->screen_x, -pBackingPixmap->screen_y); (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0); ValidateGC(&pBackingPixmap->drawable, pGC); (*pGC->ops->CopyArea) (&pBackingPixmap->drawable, &pBackingPixmap->drawable, pGC, src_x, src_y, w, h, dst_x, dst_y); (*pGC->funcs->DestroyClip) (pGC); FreeScratchGC(pGC); } SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow); } static PixmapPtr cwGetWindowPixmap (WindowPtr pWin) { PixmapPtr pPixmap = getCwPixmap (pWin); if (!pPixmap) { ScreenPtr pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE(pScreen, GetWindowPixmap); if (pScreen->GetWindowPixmap) pPixmap = (*pScreen->GetWindowPixmap) (pWin); SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap); } return pPixmap; } static void cwSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap) { ScreenPtr pScreen = pWindow->drawable.pScreen; if (pPixmap == (*pScreen->GetScreenPixmap) (pScreen)) pPixmap = NULL; setCwPixmap (pWindow, pPixmap); } /* Screen initialization/teardown */ void miInitializeCompositeWrapper(ScreenPtr pScreen) { cwScreenPtr pScreenPriv; if (cwDisabled[pScreen->myNum]) return; if (cwGeneration != serverGeneration) { cwScreenIndex = AllocateScreenPrivateIndex(); if (cwScreenIndex < 0) return; cwGCIndex = AllocateGCPrivateIndex(); cwWindowIndex = AllocateWindowPrivateIndex(); #ifdef RENDER cwPictureIndex = AllocatePicturePrivateIndex(); #endif cwGeneration = serverGeneration; } if (!AllocateGCPrivate(pScreen, cwGCIndex, sizeof(cwGCRec))) return; if (!AllocateWindowPrivate(pScreen, cwWindowIndex, 0)) return; #ifdef RENDER if (!AllocatePicturePrivate(pScreen, cwPictureIndex, 0)) return; #endif pScreenPriv = (cwScreenPtr)malloc(sizeof(cwScreenRec)); if (!pScreenPriv) return; pScreen->devPrivates[cwScreenIndex].ptr = (void *)pScreenPriv; SCREEN_EPILOGUE(pScreen, CloseScreen, cwCloseScreen); SCREEN_EPILOGUE(pScreen, GetImage, cwGetImage); SCREEN_EPILOGUE(pScreen, GetSpans, cwGetSpans); SCREEN_EPILOGUE(pScreen, CreateGC, cwCreateGC); SCREEN_EPILOGUE(pScreen, PaintWindowBackground, cwPaintWindowBackground); SCREEN_EPILOGUE(pScreen, PaintWindowBorder, cwPaintWindowBorder); SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow); SCREEN_EPILOGUE(pScreen, SetWindowPixmap, cwSetWindowPixmap); SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap); #ifdef RENDER if (GetPictureScreen (pScreen)) cwInitializeRender(pScreen); #endif } void miDisableCompositeWrapper(ScreenPtr pScreen) { cwDisabled[pScreen->myNum] = TRUE; } static Bool cwCloseScreen (ScreenPtr pScreen) { cwScreenPtr pScreenPriv; #ifdef RENDER PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif pScreenPriv = (cwScreenPtr)pScreen->devPrivates[cwScreenIndex].ptr; pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->GetImage = pScreenPriv->GetImage; pScreen->GetSpans = pScreenPriv->GetSpans; pScreen->CreateGC = pScreenPriv->CreateGC; pScreen->PaintWindowBackground = pScreenPriv->PaintWindowBackground; pScreen->PaintWindowBorder = pScreenPriv->PaintWindowBorder; pScreen->CopyWindow = pScreenPriv->CopyWindow; #ifdef RENDER if (ps) cwFiniRender(pScreen); #endif free((void *)pScreenPriv); return (*pScreen->CloseScreen)(pScreen); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/miext/cw/cw.h0000644000000000000000000001235013614532331017115 0ustar /* * Copyright © 2004 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* $Header: /cvs/xorg/xc/programs/Xserver/miext/cw/cw.h,v 1.14 2005/12/09 18:32:46 ajax Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "gcstruct.h" #include "picturestr.h" /* * One of these structures is allocated per GC that gets used with a window with * backing pixmap. */ typedef struct { GCPtr pBackingGC; /* Copy of the GC but with graphicsExposures * set FALSE and the clientClip set to * clip output to the valid regions of the * backing pixmap. */ unsigned long serialNumber; /* clientClip computed time */ unsigned long stateChanges; /* changes in parent gc since last copy */ GCOps *wrapOps; /* wrapped ops */ GCFuncs *wrapFuncs; /* wrapped funcs */ } cwGCRec, *cwGCPtr; extern int cwGCIndex; #define getCwGC(pGC) ((cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr) #define setCwGC(pGC,p) ((pGC)->devPrivates[cwGCIndex].ptr = (void *) (p)) /* * One of these structures is allocated per Picture that gets used with a * window with a backing pixmap */ typedef struct { PicturePtr pBackingPicture; unsigned long serialNumber; unsigned long stateChanges; } cwPictureRec, *cwPicturePtr; #define getCwPicture(pPicture) \ (pPicture->pDrawable ? (cwPicturePtr)(pPicture)->devPrivates[cwPictureIndex].ptr : 0) #define setCwPicture(pPicture,p) ((pPicture)->devPrivates[cwPictureIndex].ptr = (void *) (p)) extern int cwPictureIndex; extern int cwWindowIndex; #define cwWindowPrivate(pWindow) ((pWindow)->devPrivates[cwWindowIndex].ptr) #define getCwPixmap(pWindow) ((PixmapPtr) cwWindowPrivate(pWindow)) #define setCwPixmap(pWindow,pPixmap) (cwWindowPrivate(pWindow) = (void *) (pPixmap)) #define cwDrawableIsRedirWindow(pDraw) \ ((pDraw)->type == DRAWABLE_WINDOW && \ getCwPixmap((WindowPtr) (pDraw)) != NULL) typedef struct { /* * screen func wrappers */ CloseScreenProcPtr CloseScreen; GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; CreateGCProcPtr CreateGC; PaintWindowBackgroundProcPtr PaintWindowBackground; PaintWindowBorderProcPtr PaintWindowBorder; CopyWindowProcPtr CopyWindow; GetWindowPixmapProcPtr GetWindowPixmap; SetWindowPixmapProcPtr SetWindowPixmap; #ifdef RENDER DestroyPictureProcPtr DestroyPicture; ChangePictureClipProcPtr ChangePictureClip; DestroyPictureClipProcPtr DestroyPictureClip; ChangePictureProcPtr ChangePicture; ValidatePictureProcPtr ValidatePicture; CompositeProcPtr Composite; CompositeRectsProcPtr CompositeRects; TrapezoidsProcPtr Trapezoids; TrianglesProcPtr Triangles; TriStripProcPtr TriStrip; TriFanProcPtr TriFan; RasterizeTrapezoidProcPtr RasterizeTrapezoid; #endif } cwScreenRec, *cwScreenPtr; extern int cwScreenIndex; #define getCwScreen(pScreen) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr) #define setCwScreen(pScreen,p) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr = (p)) #define CW_OFFSET_XYPOINTS(ppt, npt) do { \ DDXPointPtr _ppt = (DDXPointPtr)(ppt); \ int _i; \ for (_i = 0; _i < npt; _i++) { \ _ppt[_i].x += dst_off_x; \ _ppt[_i].y += dst_off_y; \ } \ } while (0) #define CW_OFFSET_RECTS(prect, nrect) do { \ int _i; \ for (_i = 0; _i < nrect; _i++) { \ (prect)[_i].x += dst_off_x; \ (prect)[_i].y += dst_off_y; \ } \ } while (0) #define CW_OFFSET_ARCS(parc, narc) do { \ int _i; \ for (_i = 0; _i < narc; _i++) { \ (parc)[_i].x += dst_off_x; \ (parc)[_i].y += dst_off_y; \ } \ } while (0) #define CW_OFFSET_XY_DST(x, y) do { \ (x) = (x) + dst_off_x; \ (y) = (y) + dst_off_y; \ } while (0) #define CW_OFFSET_XY_SRC(x, y) do { \ (x) = (x) + src_off_x; \ (y) = (y) + src_off_y; \ } while (0) /* cw.c */ DrawablePtr cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off); /* cw_render.c */ void cwInitializeRender (ScreenPtr pScreen); void cwFiniRender (ScreenPtr pScreen); /* cw.c */ void miInitializeCompositeWrapper(ScreenPtr pScreen); /* Must be called before miInitializeCompositeWrapper */ void miDisableCompositeWrapper(ScreenPtr pScreen); nx-libs-3.5.99.23/nx-X11/programs/Xserver/miext/cw/cw_ops.c0000644000000000000000000002712513614532331017777 0ustar /* * Copyright © 2004 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* $Header: /cvs/xorg/xc/programs/Xserver/miext/cw/cw_ops.c,v 1.9 2005/07/03 07:02:01 daniels Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "gcstruct.h" #include "cw.h" #define SETUP_BACKING_DST(_pDst, _pGC) \ cwGCPtr pGCPrivate = getCwGC (_pGC); \ int dst_off_x, dst_off_y; \ DrawablePtr pBackingDst = cwGetBackingDrawable(pDst, &dst_off_x, \ &dst_off_y); \ GCPtr pBackingGC = pGCPrivate->pBackingGC ? pGCPrivate->pBackingGC : _pGC #define SETUP_BACKING_SRC(pSrc, pGC) \ int src_off_x, src_off_y; \ DrawablePtr pBackingSrc = cwGetBackingDrawable(pSrc, &src_off_x, \ &src_off_y) #define PROLOGUE(pGC) do { \ pGC->funcs = pGCPrivate->wrapFuncs;\ pGC->ops = pGCPrivate->wrapOps;\ } while (0) #define EPILOGUE(pGC) do { \ pGCPrivate->wrapFuncs = (pGC)->funcs; \ pGCPrivate->wrapOps = (pGC)->ops; \ (pGC)->funcs = &cwGCFuncs; \ (pGC)->ops = &cwGCOps; \ } while (0) extern GCFuncs cwGCFuncs; /* * GC ops -- wrap each GC operation with our own function */ static void cwFillSpans(DrawablePtr pDst, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted); static void cwSetSpans(DrawablePtr pDst, GCPtr pGC, char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted); static void cwPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pBits); static RegionPtr cwCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty); static RegionPtr cwCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long plane); static void cwPolyPoint(DrawablePtr pDst, GCPtr pGC, int mode, int npt, xPoint *pptInit); static void cwPolylines(DrawablePtr pDst, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit); static void cwPolySegment(DrawablePtr pDst, GCPtr pGC, int nseg, xSegment *pSegs); static void cwPolyRectangle(DrawablePtr pDst, GCPtr pGC, int nrects, xRectangle *pRects); static void cwPolyArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc *parcs); static void cwFillPolygon(DrawablePtr pDst, GCPtr pGC, int shape, int mode, int count, DDXPointPtr pPts); static void cwPolyFillRect(DrawablePtr pDst, GCPtr pGC, int nrectFill, xRectangle *prectInit); static void cwPolyFillArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc *parcs); static int cwPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars); static int cwPolyText16(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, unsigned short *chars); static void cwImageText8(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, char *chars); static void cwImageText16(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, unsigned short *chars); static void cwImageGlyphBlt(DrawablePtr pDst, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void * pglyphBase); static void cwPolyGlyphBlt(DrawablePtr pDst, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void * pglyphBase); static void cwPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, int w, int h, int x, int y); GCOps cwGCOps = { cwFillSpans, cwSetSpans, cwPutImage, cwCopyArea, cwCopyPlane, cwPolyPoint, cwPolylines, cwPolySegment, cwPolyRectangle, cwPolyArc, cwFillPolygon, cwPolyFillRect, cwPolyFillArc, cwPolyText8, cwPolyText16, cwImageText8, cwImageText16, cwImageGlyphBlt, cwPolyGlyphBlt, cwPushPixels }; static void cwFillSpans(DrawablePtr pDst, GCPtr pGC, int nspans, DDXPointPtr ppt, int *pwidth, int fSorted) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_XYPOINTS(ppt, nspans); (*pBackingGC->ops->FillSpans)(pBackingDst, pBackingGC, nspans, ppt, pwidth, fSorted); EPILOGUE(pGC); } static void cwSetSpans(DrawablePtr pDst, GCPtr pGC, char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_XYPOINTS(ppt, nspans); (*pBackingGC->ops->SetSpans)(pBackingDst, pBackingGC, psrc, ppt, pwidth, nspans, fSorted); EPILOGUE(pGC); } static void cwPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pBits) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_XY_DST(x, y); (*pBackingGC->ops->PutImage)(pBackingDst, pBackingGC, depth, x, y, w, h, leftPad, format, pBits); EPILOGUE(pGC); } static RegionPtr cwCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty) { int odstx, odsty; RegionPtr exposed = NULL; SETUP_BACKING_DST(pDst, pGC); SETUP_BACKING_SRC(pSrc, pGC); PROLOGUE(pGC); odstx = dstx; odsty = dsty; CW_OFFSET_XY_DST(dstx, dsty); CW_OFFSET_XY_SRC(srcx, srcy); exposed = (*pBackingGC->ops->CopyArea)(pBackingSrc, pBackingDst, pBackingGC, srcx, srcy, w, h, dstx, dsty); if (exposed != NULL) RegionTranslate(exposed, odstx - dstx, odsty - dsty); EPILOGUE(pGC); return exposed; } static RegionPtr cwCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long plane) { int odstx, odsty; RegionPtr exposed = NULL; SETUP_BACKING_DST(pDst, pGC); SETUP_BACKING_SRC(pSrc, pGC); PROLOGUE(pGC); odstx = dstx; odsty = dsty; CW_OFFSET_XY_DST(dstx, dsty); CW_OFFSET_XY_SRC(srcx, srcy); exposed = (*pBackingGC->ops->CopyPlane)(pBackingSrc, pBackingDst, pBackingGC, srcx, srcy, w, h, dstx, dsty, plane); if (exposed != NULL) RegionTranslate(exposed, odstx - dstx, odsty - dsty); EPILOGUE(pGC); return exposed; } static void cwPolyPoint(DrawablePtr pDst, GCPtr pGC, int mode, int npt, xPoint *ppt) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); if (mode == CoordModeOrigin) CW_OFFSET_XYPOINTS(ppt, npt); else CW_OFFSET_XYPOINTS(ppt, 1); (*pBackingGC->ops->PolyPoint)(pBackingDst, pBackingGC, mode, npt, ppt); EPILOGUE(pGC); } static void cwPolylines(DrawablePtr pDst, GCPtr pGC, int mode, int npt, DDXPointPtr ppt) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); if (mode == CoordModeOrigin) CW_OFFSET_XYPOINTS(ppt, npt); else CW_OFFSET_XYPOINTS(ppt, 1); (*pBackingGC->ops->Polylines)(pBackingDst, pBackingGC, mode, npt, ppt); EPILOGUE(pGC); } static void cwPolySegment(DrawablePtr pDst, GCPtr pGC, int nseg, xSegment *pSegs) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_XYPOINTS(pSegs, nseg * 2); (*pBackingGC->ops->PolySegment)(pBackingDst, pBackingGC, nseg, pSegs); EPILOGUE(pGC); } static void cwPolyRectangle(DrawablePtr pDst, GCPtr pGC, int nrects, xRectangle *pRects) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_RECTS(pRects, nrects); (*pBackingGC->ops->PolyRectangle)(pBackingDst, pBackingGC, nrects, pRects); EPILOGUE(pGC); } static void cwPolyArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc *pArcs) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_RECTS(pArcs, narcs); (*pBackingGC->ops->PolyArc)(pBackingDst, pBackingGC, narcs, pArcs); EPILOGUE(pGC); } static void cwFillPolygon(DrawablePtr pDst, GCPtr pGC, int shape, int mode, int npt, DDXPointPtr ppt) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); if (mode == CoordModeOrigin) CW_OFFSET_XYPOINTS(ppt, npt); else CW_OFFSET_XYPOINTS(ppt, 1); (*pBackingGC->ops->FillPolygon)(pBackingDst, pBackingGC, shape, mode, npt, ppt); EPILOGUE(pGC); } static void cwPolyFillRect(DrawablePtr pDst, GCPtr pGC, int nrects, xRectangle *pRects) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_RECTS(pRects, nrects); (*pBackingGC->ops->PolyFillRect)(pBackingDst, pBackingGC, nrects, pRects); EPILOGUE(pGC); } static void cwPolyFillArc(DrawablePtr pDst, GCPtr pGC, int narcs, xArc *parcs) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_RECTS(parcs, narcs); (*pBackingGC->ops->PolyFillArc)(pBackingDst, pBackingGC, narcs, parcs); EPILOGUE(pGC); } static int cwPolyText8(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, char *chars) { int result; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_XY_DST(x, y); result = (*pBackingGC->ops->PolyText8)(pBackingDst, pBackingGC, x, y, count, chars); EPILOGUE(pGC); return result; } static int cwPolyText16(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, unsigned short *chars) { int result; SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_XY_DST(x, y); result = (*pBackingGC->ops->PolyText16)(pBackingDst, pBackingGC, x, y, count, chars); EPILOGUE(pGC); return result; } static void cwImageText8(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, char *chars) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_XY_DST(x, y); (*pBackingGC->ops->ImageText8)(pBackingDst, pBackingGC, x, y, count, chars); EPILOGUE(pGC); } static void cwImageText16(DrawablePtr pDst, GCPtr pGC, int x, int y, int count, unsigned short *chars) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_XY_DST(x, y); (*pBackingGC->ops->ImageText16)(pBackingDst, pBackingGC, x, y, count, chars); EPILOGUE(pGC); } static void cwImageGlyphBlt(DrawablePtr pDst, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void * pglyphBase) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_XY_DST(x, y); (*pBackingGC->ops->ImageGlyphBlt)(pBackingDst, pBackingGC, x, y, nglyph, ppci, pglyphBase); EPILOGUE(pGC); } static void cwPolyGlyphBlt(DrawablePtr pDst, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void * pglyphBase) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_XY_DST(x, y); (*pBackingGC->ops->PolyGlyphBlt)(pBackingDst, pBackingGC, x, y, nglyph, ppci, pglyphBase); EPILOGUE(pGC); } static void cwPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, int w, int h, int x, int y) { SETUP_BACKING_DST(pDst, pGC); PROLOGUE(pGC); CW_OFFSET_XY_DST(x, y); (*pBackingGC->ops->PushPixels)(pBackingGC, pBitMap, pBackingDst, w, h, x, y); EPILOGUE(pGC); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/miext/cw/cw_render.c0000644000000000000000000003145313614532331020454 0ustar /* * Copyright © 2004 Eric Anholt * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Eric Anholt not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Eric Anholt makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* $Header: /cvs/xorg/xc/programs/Xserver/miext/cw/cw_render.c,v 1.14 2005/07/03 07:02:01 daniels Exp $ */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "gcstruct.h" #include "windowstr.h" #include "cw.h" #ifdef RENDER #define cwPsDecl(pScreen) \ PictureScreenPtr ps = GetPictureScreen (pScreen); \ cwScreenPtr pCwScreen = getCwScreen (pScreen) #define cwPicturePrivate \ cwPicturePtr pPicturePrivate = getCwPicture(pPicture) #define cwSrcPictureDecl \ int src_picture_x_off, src_picture_y_off; \ PicturePtr pBackingSrcPicture = cwGetBackingPicture(pSrcPicture, \ &src_picture_x_off,\ &src_picture_y_off) #define cwDstPictureDecl \ int dst_picture_x_off, dst_picture_y_off; \ PicturePtr pBackingDstPicture = cwGetBackingPicture(pDstPicture, \ &dst_picture_x_off,\ &dst_picture_y_off) #define cwMskPictureDecl \ int msk_picture_x_off = 0, msk_picture_y_off = 0; \ PicturePtr pBackingMskPicture = (!pMskPicture ? 0 : \ cwGetBackingPicture(pMskPicture, \ &msk_picture_x_off,\ &msk_picture_y_off)) #define cwPsUnwrap(elt) { \ ps->elt = pCwScreen->elt; \ } #define cwPsWrap(elt,func) { \ pCwScreen->elt = ps->elt; \ ps->elt = func; \ } static cwPicturePtr cwCreatePicturePrivate (PicturePtr pPicture) { WindowPtr pWindow = (WindowPtr) pPicture->pDrawable; PixmapPtr pPixmap = getCwPixmap (pWindow); int error; cwPicturePtr pPicturePrivate; pPicturePrivate = malloc (sizeof (cwPictureRec)); if (!pPicturePrivate) return NULL; pPicturePrivate->pBackingPicture = CreatePicture (0, &pPixmap->drawable, pPicture->pFormat, 0, 0, serverClient, &error); if (!pPicturePrivate->pBackingPicture) { free (pPicturePrivate); return NULL; } /* * Ensure that this serial number does not match the window's */ pPicturePrivate->serialNumber = pPixmap->drawable.serialNumber; pPicturePrivate->stateChanges = (1 << (CPLastBit + 1)) - 1; setCwPicture(pPicture, pPicturePrivate); return pPicturePrivate; } static void cwDestroyPicturePrivate (PicturePtr pPicture) { cwPicturePrivate; if (pPicturePrivate) { if (pPicturePrivate->pBackingPicture) FreePicture (pPicturePrivate->pBackingPicture, 0); free (pPicturePrivate); setCwPicture(pPicture, NULL); } } static PicturePtr cwGetBackingPicture (PicturePtr pPicture, int *x_off, int *y_off) { cwPicturePrivate; if (pPicturePrivate) { DrawablePtr pDrawable = pPicture->pDrawable; WindowPtr pWindow = (WindowPtr) pDrawable; PixmapPtr pPixmap = getCwPixmap (pWindow); *x_off = pDrawable->x - pPixmap->screen_x; *y_off = pDrawable->y - pPixmap->screen_y; return pPicturePrivate->pBackingPicture; } else { *x_off = *y_off = 0; return pPicture; } } static void cwDestroyPicture (PicturePtr pPicture) { ScreenPtr pScreen = pPicture->pDrawable->pScreen; cwPsDecl(pScreen); cwPsUnwrap(DestroyPicture); cwDestroyPicturePrivate (pPicture); (*ps->DestroyPicture) (pPicture); cwPsWrap(DestroyPicture, cwDestroyPicture); } static void cwChangePicture (PicturePtr pPicture, Mask mask) { ScreenPtr pScreen = pPicture->pDrawable->pScreen; cwPsDecl(pScreen); cwPicturePtr pPicturePrivate = getCwPicture(pPicture); cwPsUnwrap(ChangePicture); (*ps->ChangePicture) (pPicture, mask); if (pPicturePrivate) pPicturePrivate->stateChanges |= mask; cwPsWrap(ChangePicture, cwChangePicture); } static void cwValidatePicture (PicturePtr pPicture, Mask mask) { DrawablePtr pDrawable = pPicture->pDrawable; ScreenPtr pScreen = pDrawable->pScreen; cwPsDecl(pScreen); cwPicturePrivate; cwPsUnwrap(ValidatePicture); /* * Must call ValidatePicture to ensure pPicture->pCompositeClip is valid */ (*ps->ValidatePicture) (pPicture, mask); if (!cwDrawableIsRedirWindow (pDrawable)) { if (pPicturePrivate) cwDestroyPicturePrivate (pPicture); } else { PicturePtr pBackingPicture; DrawablePtr pBackingDrawable; int x_off, y_off; pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off); if (pPicturePrivate && pPicturePrivate->pBackingPicture->pDrawable != pBackingDrawable) { cwDestroyPicturePrivate (pPicture); pPicturePrivate = 0; } if (!pPicturePrivate) { pPicturePrivate = cwCreatePicturePrivate (pPicture); if (!pPicturePrivate) { cwPsWrap(ValidatePicture, cwValidatePicture); return; } } pBackingPicture = pPicturePrivate->pBackingPicture; /* * Always copy transform and filters because there's no * indication of when they've changed */ SetPictureTransform(pBackingPicture, pPicture->transform); if (pBackingPicture->filter != pPicture->filter || pPicture->filter_nparams > 0) { char *filter = PictureGetFilterName (pPicture->filter); SetPictureFilter(pBackingPicture, filter, strlen (filter), pPicture->filter_params, pPicture->filter_nparams); } pPicturePrivate->stateChanges |= mask; if (pPicturePrivate->serialNumber != pDrawable->serialNumber || (pPicturePrivate->stateChanges & (CPClipXOrigin|CPClipYOrigin|CPClipMask))) { SetPictureClipRegion (pBackingPicture, x_off - pDrawable->x, y_off - pDrawable->y, pPicture->pCompositeClip); pPicturePrivate->serialNumber = pDrawable->serialNumber; pPicturePrivate->stateChanges &= ~(CPClipXOrigin | CPClipYOrigin | CPClipMask); } CopyPicture(pPicture, pPicturePrivate->stateChanges, pBackingPicture); ValidatePicture (pBackingPicture); } cwPsWrap(ValidatePicture, cwValidatePicture); } static void cwComposite (CARD8 op, PicturePtr pSrcPicture, PicturePtr pMskPicture, PicturePtr pDstPicture, INT16 xSrc, INT16 ySrc, INT16 xMsk, INT16 yMsk, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { ScreenPtr pScreen = pDstPicture->pDrawable->pScreen; cwPsDecl(pScreen); cwSrcPictureDecl; cwMskPictureDecl; cwDstPictureDecl; cwPsUnwrap(Composite); (*ps->Composite) (op, pBackingSrcPicture, pBackingMskPicture, pBackingDstPicture, xSrc + src_picture_x_off, ySrc + src_picture_y_off, xMsk + msk_picture_x_off, yMsk + msk_picture_y_off, xDst + dst_picture_x_off, yDst + dst_picture_y_off, width, height); cwPsWrap(Composite, cwComposite); } static void cwCompositeRects (CARD8 op, PicturePtr pDstPicture, xRenderColor *color, int nRect, xRectangle *rects) { ScreenPtr pScreen = pDstPicture->pDrawable->pScreen; cwPsDecl(pScreen); cwDstPictureDecl; int i; cwPsUnwrap(CompositeRects); for (i = 0; i < nRect; i++) { rects[i].x += dst_picture_x_off; rects[i].y += dst_picture_y_off; } (*ps->CompositeRects) (op, pBackingDstPicture, color, nRect, rects); cwPsWrap(CompositeRects, cwCompositeRects); } static void cwTrapezoids (CARD8 op, PicturePtr pSrcPicture, PicturePtr pDstPicture, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps) { ScreenPtr pScreen = pDstPicture->pDrawable->pScreen; cwPsDecl(pScreen); cwSrcPictureDecl; cwDstPictureDecl; int i; cwPsUnwrap(Trapezoids); if (dst_picture_x_off || dst_picture_y_off) { for (i = 0; i < ntrap; i++) { traps[i].top += dst_picture_y_off << 16; traps[i].bottom += dst_picture_y_off << 16; traps[i].left.p1.x += dst_picture_x_off << 16; traps[i].left.p1.y += dst_picture_y_off << 16; traps[i].left.p2.x += dst_picture_x_off << 16; traps[i].left.p2.y += dst_picture_y_off << 16; traps[i].right.p1.x += dst_picture_x_off << 16; traps[i].right.p1.y += dst_picture_y_off << 16; traps[i].right.p2.x += dst_picture_x_off << 16; traps[i].right.p2.y += dst_picture_y_off << 16; } } (*ps->Trapezoids) (op, pBackingSrcPicture, pBackingDstPicture, maskFormat, xSrc + src_picture_x_off, ySrc + src_picture_y_off, ntrap, traps); cwPsWrap(Trapezoids, cwTrapezoids); } static void cwTriangles (CARD8 op, PicturePtr pSrcPicture, PicturePtr pDstPicture, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntri, xTriangle *tris) { ScreenPtr pScreen = pDstPicture->pDrawable->pScreen; cwPsDecl(pScreen); cwSrcPictureDecl; cwDstPictureDecl; int i; cwPsUnwrap(Triangles); if (dst_picture_x_off || dst_picture_y_off) { for (i = 0; i < ntri; i++) { tris[i].p1.x += dst_picture_x_off << 16; tris[i].p1.y += dst_picture_y_off << 16; tris[i].p2.x += dst_picture_x_off << 16; tris[i].p2.y += dst_picture_y_off << 16; tris[i].p3.x += dst_picture_x_off << 16; tris[i].p3.y += dst_picture_y_off << 16; } } (*ps->Triangles) (op, pBackingSrcPicture, pBackingDstPicture, maskFormat, xSrc + src_picture_x_off, ySrc + src_picture_y_off, ntri, tris); cwPsWrap(Triangles, cwTriangles); } static void cwTriStrip (CARD8 op, PicturePtr pSrcPicture, PicturePtr pDstPicture, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points) { ScreenPtr pScreen = pDstPicture->pDrawable->pScreen; cwPsDecl(pScreen); cwSrcPictureDecl; cwDstPictureDecl; int i; cwPsUnwrap(TriStrip); if (dst_picture_x_off || dst_picture_y_off) { for (i = 0; i < npoint; i++) { points[i].x += dst_picture_x_off << 16; points[i].y += dst_picture_y_off << 16; } } (*ps->TriStrip) (op, pBackingSrcPicture, pBackingDstPicture, maskFormat, xSrc + src_picture_x_off, ySrc + src_picture_y_off, npoint, points); cwPsWrap(TriStrip, cwTriStrip); } static void cwTriFan (CARD8 op, PicturePtr pSrcPicture, PicturePtr pDstPicture, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points) { ScreenPtr pScreen = pDstPicture->pDrawable->pScreen; cwPsDecl(pScreen); cwSrcPictureDecl; cwDstPictureDecl; int i; cwPsUnwrap(TriFan); if (dst_picture_x_off || dst_picture_y_off) { for (i = 0; i < npoint; i++) { points[i].x += dst_picture_x_off << 16; points[i].y += dst_picture_y_off << 16; } } (*ps->TriFan) (op, pBackingSrcPicture, pBackingDstPicture, maskFormat, xSrc + src_picture_x_off, ySrc + src_picture_y_off, npoint, points); cwPsWrap(TriFan, cwTriFan); } void cwInitializeRender (ScreenPtr pScreen) { cwPsDecl (pScreen); cwPsWrap(DestroyPicture, cwDestroyPicture); cwPsWrap(ChangePicture, cwChangePicture); cwPsWrap(ValidatePicture, cwValidatePicture); cwPsWrap(Composite, cwComposite); cwPsWrap(CompositeRects, cwCompositeRects); cwPsWrap(Trapezoids, cwTrapezoids); cwPsWrap(Triangles, cwTriangles); cwPsWrap(TriStrip, cwTriStrip); cwPsWrap(TriFan, cwTriFan); /* There is no need to wrap AddTraps as far as we can tell. AddTraps can * only be done on alpha-only pictures, and we won't be getting * alpha-only window pictures, so there's no need to translate. */ } void cwFiniRender (ScreenPtr pScreen) { cwPsDecl (pScreen); cwPsUnwrap(DestroyPicture); cwPsUnwrap(ChangePicture); cwPsUnwrap(ValidatePicture); cwPsUnwrap(Composite); cwPsUnwrap(CompositeRects); cwPsUnwrap(Trapezoids); cwPsUnwrap(Triangles); cwPsUnwrap(TriStrip); cwPsUnwrap(TriFan); } #endif /* RENDER */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/miext/cw/Imakefile0000644000000000000000000000107013614532331020141 0ustar #include SRCS = cw.c cw_ops.c cw_render.c OBJS = cw.o cw_ops.o cw_render.o INCLUDES = -I../../mi -I../../fb -I../../render -I../../composite \ -I../../include -I$(XINCLUDESRC) $(EXTRAINCLUDES) \ -I$(EXTINCSRC) \ `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \ ../../mi/llib-lmi.ln NormalLibraryObjectRule() NormalLibraryTarget(cw,$(OBJS)) LintLibraryTarget(cw,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() InstallDriverSDKNonExecFile(cw.h,$(DRIVERSDKINCLUDEDIR)) nx-libs-3.5.99.23/nx-X11/programs/Xserver/miext/damage/damage.c0000644000000000000000000013760513614532331020535 0ustar /* * $Id: damage.c,v 1.19 2005/10/06 21:55:41 anholt Exp $ * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "scrnintstr.h" #include "windowstr.h" #include #include "dixfontstr.h" #include #ifdef HAS_XFONT2 # include #else # include #endif /* HAS_XFONT2 */ #include "mi.h" #include "regionstr.h" #include "globals.h" #include "gcstruct.h" #include "damage.h" #include "damagestr.h" #ifdef COMPOSITE #include "cw.h" #endif #define wrap(priv, real, mem, func) {\ priv->mem = real->mem; \ real->mem = func; \ } #define unwrap(priv, real, mem) {\ real->mem = priv->mem; \ } #define BOX_SAME(a,b) \ ((a)->x1 == (b)->x1 && \ (a)->y1 == (b)->y1 && \ (a)->x2 == (b)->x2 && \ (a)->y2 == (b)->y2) #define DAMAGE_VALIDATE_ENABLE 0 #define DAMAGE_DEBUG_ENABLE 0 #if DAMAGE_DEBUG_ENABLE #define DAMAGE_DEBUG(x) ErrorF x #else #define DAMAGE_DEBUG(x) #endif #define getPixmapDamageRef(pPixmap) \ ((DamagePtr *) &(pPixmap->devPrivates[damagePixPrivateIndex].ptr)) #define pixmapDamage(pPixmap) damagePixPriv(pPixmap) static DamagePtr * getDrawableDamageRef (DrawablePtr pDrawable) { PixmapPtr pPixmap; if (pDrawable->type == DRAWABLE_WINDOW) { ScreenPtr pScreen = pDrawable->pScreen; pPixmap = 0; if (pScreen->GetWindowPixmap #ifdef ROOTLESS_WORKAROUND && ((WindowPtr)pDrawable)->viewable #endif ) pPixmap = (*pScreen->GetWindowPixmap) ((WindowPtr)pDrawable); if (!pPixmap) { damageScrPriv(pScreen); return &pScrPriv->pScreenDamage; } } else pPixmap = (PixmapPtr) pDrawable; return getPixmapDamageRef (pPixmap); } #define getDrawableDamage(pDrawable) (*getDrawableDamageRef (pDrawable)) #define getWindowDamage(pWin) getDrawableDamage(&(pWin)->drawable) #define drawableDamage(pDrawable) \ DamagePtr pDamage = getDrawableDamage(pDrawable) #define windowDamage(pWin) drawableDamage(&(pWin)->drawable) #define winDamageRef(pWindow) \ DamagePtr *pPrev = (DamagePtr *) \ &(pWindow->devPrivates[damageWinPrivateIndex].ptr) #if DAMAGE_DEBUG_ENABLE static void _damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, int subWindowMode, const char *where) #define damageDamageRegion(d,r,c,m) _damageDamageRegion(d,r,c,m,__FUNCTION__) #else static void damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, int subWindowMode) #endif { ScreenPtr pScreen = pDrawable->pScreen; damageScrPriv(pScreen); drawableDamage(pDrawable); DamagePtr pNext; RegionRec clippedRec; RegionPtr pDamageRegion; RegionRec pixClip; Bool was_empty; RegionRec tmpRegion; BoxRec tmpBox; int draw_x, draw_y; #ifdef COMPOSITE int screen_x = 0, screen_y = 0; #endif /* short circuit for empty regions */ if (!RegionNotEmpty(pRegion)) return; #ifdef COMPOSITE /* * When drawing to a pixmap which is storing window contents, * the region presented is in pixmap relative coordinates which * need to be converted to screen relative coordinates */ if (pDrawable->type != DRAWABLE_WINDOW) { screen_x = ((PixmapPtr) pDrawable)->screen_x - pDrawable->x; screen_y = ((PixmapPtr) pDrawable)->screen_y - pDrawable->y; } if (screen_x || screen_y) RegionTranslate(pRegion, screen_x, screen_y); #endif if (pDrawable->type == DRAWABLE_WINDOW && ((WindowPtr)(pDrawable))->backingStore == NotUseful) { if (subWindowMode == ClipByChildren) { RegionIntersect(pRegion, pRegion, &((WindowPtr)(pDrawable))->clipList); } else if (subWindowMode == IncludeInferiors) { RegionPtr pTempRegion = NotClippedByChildren((WindowPtr)(pDrawable)); RegionIntersect(pRegion, pRegion, pTempRegion); RegionDestroy(pTempRegion); } /* If subWindowMode is set to an invalid value, don't perform * any drawable-based clipping. */ } RegionNull(&clippedRec); for (; pDamage; pDamage = pNext) { pNext = pDamage->pNext; /* * Check for internal damage and don't send events */ if (pScrPriv->internalLevel > 0 && !pDamage->isInternal) { DAMAGE_DEBUG (("non internal damage, skipping at %d\n", pScrPriv->internalLevel)); continue; } /* * Check for unrealized windows */ if (pDamage->pDrawable->type == DRAWABLE_WINDOW && !((WindowPtr) (pDamage->pDrawable))->realized) { #if 0 DAMAGE_DEBUG (("damage while window unrealized\n")); #endif continue; } draw_x = pDamage->pDrawable->x; draw_y = pDamage->pDrawable->y; #ifdef COMPOSITE /* * Need to move everyone to screen coordinates * XXX what about off-screen pixmaps with non-zero x/y? */ if (pDamage->pDrawable->type != DRAWABLE_WINDOW) { draw_x += ((PixmapPtr) pDamage->pDrawable)->screen_x; draw_y += ((PixmapPtr) pDamage->pDrawable)->screen_y; } #endif /* * Clip against border or pixmap bounds */ pDamageRegion = pRegion; if (clip || pDamage->pDrawable != pDrawable) { pDamageRegion = &clippedRec; if (pDamage->pDrawable->type == DRAWABLE_WINDOW) { RegionIntersect(pDamageRegion, pRegion, &((WindowPtr)(pDamage->pDrawable))->borderClip); } else { BoxRec box; box.x1 = draw_x; box.y1 = draw_y; box.x2 = draw_x + pDamage->pDrawable->width; box.y2 = draw_y + pDamage->pDrawable->height; RegionInit(&pixClip, &box, 1); RegionIntersect(pDamageRegion, pRegion, &pixClip); RegionUninit(&pixClip); } /* * Short circuit empty results */ if (!RegionNotEmpty(pDamageRegion)) continue; } DAMAGE_DEBUG (("%s %d x %d +%d +%d (target 0x%lx monitor 0x%lx)\n", where, pDamageRegion->extents.x2 - pDamageRegion->extents.x1, pDamageRegion->extents.y2 - pDamageRegion->extents.y1, pDamageRegion->extents.x1, pDamageRegion->extents.y1, pDrawable->id, pDamage->pDrawable->id)); /* * Move region to target coordinate space */ if (draw_x || draw_y) RegionTranslate(pDamageRegion, -draw_x, -draw_y); switch (pDamage->damageLevel) { case DamageReportRawRegion: (*pDamage->damageReport) (pDamage, pDamageRegion, pDamage->closure); break; case DamageReportDeltaRegion: RegionNull(&tmpRegion); RegionSubtract(&tmpRegion, pDamageRegion, &pDamage->damage); if (RegionNotEmpty(&tmpRegion)) { RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion); (*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure); } RegionUninit(&tmpRegion); break; case DamageReportBoundingBox: tmpBox = *RegionExtents(&pDamage->damage); RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion); if (!BOX_SAME (&tmpBox, RegionExtents(&pDamage->damage))) (*pDamage->damageReport) (pDamage, &pDamage->damage, pDamage->closure); break; case DamageReportNonEmpty: was_empty = !RegionNotEmpty(&pDamage->damage); RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion); if (was_empty && RegionNotEmpty(&pDamage->damage)) (*pDamage->damageReport) (pDamage, &pDamage->damage, pDamage->closure); break; case DamageReportNone: RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion); break; } /* * translate original region back */ if (pDamageRegion == pRegion && (draw_x || draw_y)) RegionTranslate(pDamageRegion, draw_x, draw_y); } #ifdef COMPOSITE if (screen_x || screen_y) RegionTranslate(pRegion, -screen_x, -screen_y); #endif RegionUninit(&clippedRec); } #if DAMAGE_DEBUG_ENABLE #define damageDamageBox(d,b,m) _damageDamageBox(d,b,m,__FUNCTION__) static void _damageDamageBox (DrawablePtr pDrawable, BoxPtr pBox, int subWindowMode, const char *where) #else static void damageDamageBox (DrawablePtr pDrawable, BoxPtr pBox, int subWindowMode) #endif { RegionRec region; RegionInit(®ion, pBox, 1); #if DAMAGE_DEBUG_ENABLE _damageDamageRegion (pDrawable, ®ion, TRUE, subWindowMode, where); #else damageDamageRegion (pDrawable, ®ion, TRUE, subWindowMode); #endif RegionUninit(®ion); } static void damageValidateGC(GCPtr, unsigned long, DrawablePtr); static void damageChangeGC(GCPtr, unsigned long); static void damageCopyGC(GCPtr, unsigned long, GCPtr); static void damageDestroyGC(GCPtr); static void damageChangeClip(GCPtr, int, void *, int); static void damageDestroyClip(GCPtr); static void damageCopyClip(GCPtr, GCPtr); GCFuncs damageGCFuncs = { damageValidateGC, damageChangeGC, damageCopyGC, damageDestroyGC, damageChangeClip, damageDestroyClip, damageCopyClip }; extern GCOps damageGCOps; static Bool damageCreateGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; damageScrPriv(pScreen); damageGCPriv(pGC); Bool ret; pGC->pCompositeClip = 0; unwrap (pScrPriv, pScreen, CreateGC); if((ret = (*pScreen->CreateGC) (pGC))) { pGCPriv->ops = NULL; pGCPriv->funcs = pGC->funcs; pGC->funcs = &damageGCFuncs; } wrap (pScrPriv, pScreen, CreateGC, damageCreateGC); return ret; } #ifdef NOTUSED static void damageWrapGC (GCPtr pGC) { damageGCPriv(pGC); pGCPriv->ops = NULL; pGCPriv->funcs = pGC->funcs; pGC->funcs = &damageGCFuncs; } static void damageUnwrapGC (GCPtr pGC) { damageGCPriv(pGC); pGC->funcs = pGCPriv->funcs; if (pGCPriv->ops) pGC->ops = pGCPriv->ops; } #endif #define DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable) \ damageGCPriv(pGC); \ GCFuncs *oldFuncs = pGC->funcs; \ unwrap(pGCPriv, pGC, funcs); \ unwrap(pGCPriv, pGC, ops); \ #define DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable) \ wrap(pGCPriv, pGC, funcs, oldFuncs); \ wrap(pGCPriv, pGC, ops, &damageGCOps) #define DAMAGE_GC_FUNC_PROLOGUE(pGC) \ damageGCPriv(pGC); \ unwrap(pGCPriv, pGC, funcs); \ if (pGCPriv->ops) unwrap(pGCPriv, pGC, ops) #define DAMAGE_GC_FUNC_EPILOGUE(pGC) \ wrap(pGCPriv, pGC, funcs, &damageGCFuncs); \ if (pGCPriv->ops) wrap(pGCPriv, pGC, ops, &damageGCOps) static void damageValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) { DAMAGE_GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ValidateGC)(pGC, changes, pDrawable); pGCPriv->ops = pGC->ops; /* just so it's not NULL */ DAMAGE_GC_FUNC_EPILOGUE (pGC); } static void damageDestroyGC(GCPtr pGC) { DAMAGE_GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->DestroyGC)(pGC); DAMAGE_GC_FUNC_EPILOGUE (pGC); } static void damageChangeGC (GCPtr pGC, unsigned long mask) { DAMAGE_GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeGC) (pGC, mask); DAMAGE_GC_FUNC_EPILOGUE (pGC); } static void damageCopyGC (GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) { DAMAGE_GC_FUNC_PROLOGUE (pGCDst); (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); DAMAGE_GC_FUNC_EPILOGUE (pGCDst); } static void damageChangeClip (GCPtr pGC, int type, void *pvalue, int nrects) { DAMAGE_GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); DAMAGE_GC_FUNC_EPILOGUE (pGC); } static void damageCopyClip(GCPtr pgcDst, GCPtr pgcSrc) { DAMAGE_GC_FUNC_PROLOGUE (pgcDst); (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); DAMAGE_GC_FUNC_EPILOGUE (pgcDst); } static void damageDestroyClip(GCPtr pGC) { DAMAGE_GC_FUNC_PROLOGUE (pGC); (* pGC->funcs->DestroyClip)(pGC); DAMAGE_GC_FUNC_EPILOGUE (pGC); } #define TRIM_BOX(box, pGC) if (pGC->pCompositeClip) { \ BoxPtr extents = &pGC->pCompositeClip->extents;\ if(box.x1 < extents->x1) box.x1 = extents->x1; \ if(box.x2 > extents->x2) box.x2 = extents->x2; \ if(box.y1 < extents->y1) box.y1 = extents->y1; \ if(box.y2 > extents->y2) box.y2 = extents->y2; \ } #define TRANSLATE_BOX(box, pDrawable) { \ box.x1 += pDrawable->x; \ box.x2 += pDrawable->x; \ box.y1 += pDrawable->y; \ box.y2 += pDrawable->y; \ } #define TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC) { \ TRANSLATE_BOX(box, pDrawable); \ TRIM_BOX(box, pGC); \ } #define BOX_NOT_EMPTY(box) \ (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0)) #define checkGCDamage(d,g) (getDrawableDamage(d) && \ (!g->pCompositeClip ||\ RegionNotEmpty(\ g->pCompositeClip))) #ifdef RENDER #define TRIM_PICTURE_BOX(box, pDst) { \ BoxPtr extents = &pDst->pCompositeClip->extents;\ if(box.x1 < extents->x1) box.x1 = extents->x1; \ if(box.x2 > extents->x2) box.x2 = extents->x2; \ if(box.y1 < extents->y1) box.y1 = extents->y1; \ if(box.y2 > extents->y2) box.y2 = extents->y2; \ } #define checkPictureDamage(p) (getDrawableDamage(p->pDrawable) && \ RegionNotEmpty(p->pCompositeClip)) static void damageComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { ScreenPtr pScreen = pDst->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); damageScrPriv(pScreen); if (checkPictureDamage (pDst)) { BoxRec box; box.x1 = xDst + pDst->pDrawable->x; box.y1 = yDst + pDst->pDrawable->y; box.x2 = box.x1 + width; box.y2 = box.y1 + height; TRIM_PICTURE_BOX(box, pDst); if (BOX_NOT_EMPTY(box)) damageDamageBox (pDst->pDrawable, &box, pDst->subWindowMode); } unwrap (pScrPriv, ps, Composite); (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); wrap (pScrPriv, ps, Composite, damageComposite); } static void damageGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr *glyphs) { ScreenPtr pScreen = pDst->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); damageScrPriv(pScreen); if (checkPictureDamage (pDst)) { int nlistTmp = nlist; GlyphListPtr listTmp = list; GlyphPtr *glyphsTmp = glyphs; int x, y; int n; GlyphPtr glyph; BoxRec box; int x1, y1, x2, y2; box.x1 = 32767; box.y1 = 32767; box.x2 = -32767; box.y2 = -32767; x = pDst->pDrawable->x; y = pDst->pDrawable->y; while (nlistTmp--) { x += listTmp->xOff; y += listTmp->yOff; n = listTmp->len; while (n--) { glyph = *glyphsTmp++; x1 = x - glyph->info.x; y1 = y - glyph->info.y; x2 = x1 + glyph->info.width; y2 = y1 + glyph->info.height; if (x1 < box.x1) box.x1 = x1; if (y1 < box.y1) box.y1 = y1; if (x2 > box.x2) box.x2 = x2; if (y2 > box.y2) box.y2 = y2; x += glyph->info.xOff; y += glyph->info.yOff; } listTmp++; } TRIM_PICTURE_BOX (box, pDst); if (BOX_NOT_EMPTY(box)) damageDamageBox (pDst->pDrawable, &box, pDst->subWindowMode); } unwrap (pScrPriv, ps, Glyphs); (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); wrap (pScrPriv, ps, Glyphs, damageGlyphs); } #endif /**********************************************************/ static void damageFillSpans(DrawablePtr pDrawable, GC *pGC, int npt, DDXPointPtr ppt, int *pwidth, int fSorted) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (npt && checkGCDamage (pDrawable, pGC)) { int nptTmp = npt; DDXPointPtr pptTmp = ppt; int *pwidthTmp = pwidth; BoxRec box; box.x1 = pptTmp->x; box.x2 = box.x1 + *pwidthTmp; box.y2 = box.y1 = pptTmp->y; while(--nptTmp) { pptTmp++; pwidthTmp++; if(box.x1 > pptTmp->x) box.x1 = pptTmp->x; if(box.x2 < (pptTmp->x + *pwidthTmp)) box.x2 = pptTmp->x + *pwidthTmp; if(box.y1 > pptTmp->y) box.y1 = pptTmp->y; else if(box.y2 < pptTmp->y) box.y2 = pptTmp->y; } box.y2++; if(!pGC->miTranslate) { TRANSLATE_BOX(box, pDrawable); } TRIM_BOX(box, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->FillSpans)(pDrawable, pGC, npt, ppt, pwidth, fSorted); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static void damageSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pcharsrc, DDXPointPtr ppt, int *pwidth, int npt, int fSorted) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (npt && checkGCDamage (pDrawable, pGC)) { DDXPointPtr pptTmp = ppt; int *pwidthTmp = pwidth; int nptTmp = npt; BoxRec box; box.x1 = pptTmp->x; box.x2 = box.x1 + *pwidthTmp; box.y2 = box.y1 = pptTmp->y; while(--nptTmp) { pptTmp++; pwidthTmp++; if(box.x1 > pptTmp->x) box.x1 = pptTmp->x; if(box.x2 < (pptTmp->x + *pwidthTmp)) box.x2 = pptTmp->x + *pwidthTmp; if(box.y1 > pptTmp->y) box.y1 = pptTmp->y; else if(box.y2 < pptTmp->y) box.y2 = pptTmp->y; } box.y2++; if(!pGC->miTranslate) { TRANSLATE_BOX(box, pDrawable); } TRIM_BOX(box, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->SetSpans)(pDrawable, pGC, pcharsrc, ppt, pwidth, npt, fSorted); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static void damagePutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (checkGCDamage (pDrawable, pGC)) { BoxRec box; box.x1 = x + pDrawable->x; box.x2 = box.x1 + w; box.y1 = y + pDrawable->y; box.y2 = box.y1 + h; TRIM_BOX(box, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PutImage)(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pImage); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static RegionPtr damageCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { RegionPtr ret; DAMAGE_GC_OP_PROLOGUE(pGC, pDst); /* The driver will only call SourceValidate() when pSrc != pDst, * but the software sprite (misprite.c) always need to know when a * drawable is copied so it can remove the sprite. See #1030. */ if ((pSrc == pDst) && pSrc->pScreen->SourceValidate && pSrc->type == DRAWABLE_WINDOW && ((WindowPtr)pSrc)->viewable) { (*pSrc->pScreen->SourceValidate) (pSrc, srcx, srcy, width, height); } if (checkGCDamage (pDst, pGC)) { BoxRec box; box.x1 = dstx + pDst->x; box.x2 = box.x1 + width; box.y1 = dsty + pDst->y; box.y2 = box.y1 + height; TRIM_BOX(box, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDst, &box, pGC->subWindowMode); } ret = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty); DAMAGE_GC_OP_EPILOGUE(pGC, pDst); return ret; } static RegionPtr damageCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitPlane) { RegionPtr ret; DAMAGE_GC_OP_PROLOGUE(pGC, pDst); /* The driver will only call SourceValidate() when pSrc != pDst, * but the software sprite (misprite.c) always need to know when a * drawable is copied so it can remove the sprite. See #1030. */ if ((pSrc == pDst) && pSrc->pScreen->SourceValidate && pSrc->type == DRAWABLE_WINDOW && ((WindowPtr)pSrc)->viewable) { (*pSrc->pScreen->SourceValidate) (pSrc, srcx, srcy, width, height); } if (checkGCDamage (pDst, pGC)) { BoxRec box; box.x1 = dstx + pDst->x; box.x2 = box.x1 + width; box.y1 = dsty + pDst->y; box.y2 = box.y1 + height; TRIM_BOX(box, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDst, &box, pGC->subWindowMode); } ret = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); DAMAGE_GC_OP_EPILOGUE(pGC, pDst); return ret; } static void damagePolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, xPoint *ppt) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (npt && checkGCDamage (pDrawable, pGC)) { BoxRec box; int nptTmp = npt; xPoint *pptTmp = ppt; box.x2 = box.x1 = pptTmp->x; box.y2 = box.y1 = pptTmp->y; /* this could be slow if the points were spread out */ while(--nptTmp) { pptTmp++; if(box.x1 > pptTmp->x) box.x1 = pptTmp->x; else if(box.x2 < pptTmp->x) box.x2 = pptTmp->x; if(box.y1 > pptTmp->y) box.y1 = pptTmp->y; else if(box.y2 < pptTmp->y) box.y2 = pptTmp->y; } box.x2++; box.y2++; TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolyPoint)(pDrawable, pGC, mode, npt, ppt); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static void damagePolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (npt && checkGCDamage (pDrawable, pGC)) { int nptTmp = npt; DDXPointPtr pptTmp = ppt; BoxRec box; int extra = pGC->lineWidth >> 1; box.x2 = box.x1 = pptTmp->x; box.y2 = box.y1 = pptTmp->y; if(nptTmp > 1) { if(pGC->joinStyle == JoinMiter) extra = 6 * pGC->lineWidth; else if(pGC->capStyle == CapProjecting) extra = pGC->lineWidth; } if(mode == CoordModePrevious) { int x = box.x1; int y = box.y1; while(--nptTmp) { pptTmp++; x += pptTmp->x; y += pptTmp->y; if(box.x1 > x) box.x1 = x; else if(box.x2 < x) box.x2 = x; if(box.y1 > y) box.y1 = y; else if(box.y2 < y) box.y2 = y; } } else { while(--nptTmp) { pptTmp++; if(box.x1 > pptTmp->x) box.x1 = pptTmp->x; else if(box.x2 < pptTmp->x) box.x2 = pptTmp->x; if(box.y1 > pptTmp->y) box.y1 = pptTmp->y; else if(box.y2 < pptTmp->y) box.y2 = pptTmp->y; } } box.x2++; box.y2++; if(extra) { box.x1 -= extra; box.x2 += extra; box.y1 -= extra; box.y2 += extra; } TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->Polylines)(pDrawable, pGC, mode, npt, ppt); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static void damagePolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSeg, xSegment *pSeg) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (nSeg && checkGCDamage (pDrawable, pGC)) { BoxRec box; int extra = pGC->lineWidth; int nsegTmp = nSeg; xSegment *pSegTmp = pSeg; if(pGC->capStyle != CapProjecting) extra >>= 1; if(pSegTmp->x2 > pSegTmp->x1) { box.x1 = pSegTmp->x1; box.x2 = pSegTmp->x2; } else { box.x2 = pSegTmp->x1; box.x1 = pSegTmp->x2; } if(pSegTmp->y2 > pSegTmp->y1) { box.y1 = pSegTmp->y1; box.y2 = pSegTmp->y2; } else { box.y2 = pSegTmp->y1; box.y1 = pSegTmp->y2; } while(--nsegTmp) { pSegTmp++; if(pSegTmp->x2 > pSegTmp->x1) { if(pSegTmp->x1 < box.x1) box.x1 = pSegTmp->x1; if(pSegTmp->x2 > box.x2) box.x2 = pSegTmp->x2; } else { if(pSegTmp->x2 < box.x1) box.x1 = pSegTmp->x2; if(pSegTmp->x1 > box.x2) box.x2 = pSegTmp->x1; } if(pSegTmp->y2 > pSegTmp->y1) { if(pSegTmp->y1 < box.y1) box.y1 = pSegTmp->y1; if(pSegTmp->y2 > box.y2) box.y2 = pSegTmp->y2; } else { if(pSegTmp->y2 < box.y1) box.y1 = pSegTmp->y2; if(pSegTmp->y1 > box.y2) box.y2 = pSegTmp->y1; } } box.x2++; box.y2++; if(extra) { box.x1 -= extra; box.x2 += extra; box.y1 -= extra; box.y2 += extra; } TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolySegment)(pDrawable, pGC, nSeg, pSeg); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static void damagePolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRects, xRectangle *pRects) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (nRects && checkGCDamage (pDrawable, pGC)) { BoxRec box; int offset1, offset2, offset3; int nRectsTmp = nRects; xRectangle *pRectsTmp = pRects; offset2 = pGC->lineWidth; if(!offset2) offset2 = 1; offset1 = offset2 >> 1; offset3 = offset2 - offset1; while(nRectsTmp--) { box.x1 = pRectsTmp->x - offset1; box.y1 = pRectsTmp->y - offset1; box.x2 = box.x1 + pRectsTmp->width + offset2; box.y2 = box.y1 + offset2; TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); box.x1 = pRectsTmp->x - offset1; box.y1 = pRectsTmp->y + offset3; box.x2 = box.x1 + offset2; box.y2 = box.y1 + pRectsTmp->height - offset2; TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); box.x1 = pRectsTmp->x + pRectsTmp->width - offset1; box.y1 = pRectsTmp->y + offset3; box.x2 = box.x1 + offset2; box.y2 = box.y1 + pRectsTmp->height - offset2; TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); box.x1 = pRectsTmp->x - offset1; box.y1 = pRectsTmp->y + pRectsTmp->height - offset1; box.x2 = box.x1 + pRectsTmp->width + offset2; box.y2 = box.y1 + offset2; TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); pRectsTmp++; } } (*pGC->ops->PolyRectangle)(pDrawable, pGC, nRects, pRects); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static void damagePolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (nArcs && checkGCDamage (pDrawable, pGC)) { int extra = pGC->lineWidth >> 1; BoxRec box; int nArcsTmp = nArcs; xArc *pArcsTmp = pArcs; box.x1 = pArcsTmp->x; box.x2 = box.x1 + pArcsTmp->width; box.y1 = pArcsTmp->y; box.y2 = box.y1 + pArcsTmp->height; while(--nArcsTmp) { pArcsTmp++; if(box.x1 > pArcsTmp->x) box.x1 = pArcsTmp->x; if(box.x2 < (pArcsTmp->x + pArcsTmp->width)) box.x2 = pArcsTmp->x + pArcsTmp->width; if(box.y1 > pArcsTmp->y) box.y1 = pArcsTmp->y; if(box.y2 < (pArcsTmp->y + pArcsTmp->height)) box.y2 = pArcsTmp->y + pArcsTmp->height; } if(extra) { box.x1 -= extra; box.x2 += extra; box.y1 -= extra; box.y2 += extra; } box.x2++; box.y2++; TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolyArc)(pDrawable, pGC, nArcs, pArcs); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static void damageFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode, int npt, DDXPointPtr ppt) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (npt > 2 && checkGCDamage (pDrawable, pGC)) { DDXPointPtr pptTmp = ppt; int nptTmp = npt; BoxRec box; box.x2 = box.x1 = pptTmp->x; box.y2 = box.y1 = pptTmp->y; if(mode != CoordModeOrigin) { int x = box.x1; int y = box.y1; while(--nptTmp) { pptTmp++; x += pptTmp->x; y += pptTmp->y; if(box.x1 > x) box.x1 = x; else if(box.x2 < x) box.x2 = x; if(box.y1 > y) box.y1 = y; else if(box.y2 < y) box.y2 = y; } } else { while(--nptTmp) { pptTmp++; if(box.x1 > pptTmp->x) box.x1 = pptTmp->x; else if(box.x2 < pptTmp->x) box.x2 = pptTmp->x; if(box.y1 > pptTmp->y) box.y1 = pptTmp->y; else if(box.y2 < pptTmp->y) box.y2 = pptTmp->y; } } box.x2++; box.y2++; TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->FillPolygon)(pDrawable, pGC, shape, mode, npt, ppt); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static void damagePolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRects, xRectangle *pRects) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (nRects && checkGCDamage (pDrawable, pGC)) { BoxRec box; xRectangle *pRectsTmp = pRects; int nRectsTmp = nRects; box.x1 = pRectsTmp->x; box.x2 = box.x1 + pRectsTmp->width; box.y1 = pRectsTmp->y; box.y2 = box.y1 + pRectsTmp->height; while(--nRectsTmp) { pRectsTmp++; if(box.x1 > pRectsTmp->x) box.x1 = pRectsTmp->x; if(box.x2 < (pRectsTmp->x + pRectsTmp->width)) box.x2 = pRectsTmp->x + pRectsTmp->width; if(box.y1 > pRectsTmp->y) box.y1 = pRectsTmp->y; if(box.y2 < (pRectsTmp->y + pRectsTmp->height)) box.y2 = pRectsTmp->y + pRectsTmp->height; } TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolyFillRect)(pDrawable, pGC, nRects, pRects); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static void damagePolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (nArcs && checkGCDamage (pDrawable, pGC)) { BoxRec box; int nArcsTmp = nArcs; xArc *pArcsTmp = pArcs; box.x1 = pArcsTmp->x; box.x2 = box.x1 + pArcsTmp->width; box.y1 = pArcsTmp->y; box.y2 = box.y1 + pArcsTmp->height; while(--nArcsTmp) { pArcsTmp++; if(box.x1 > pArcsTmp->x) box.x1 = pArcsTmp->x; if(box.x2 < (pArcsTmp->x + pArcsTmp->width)) box.x2 = pArcsTmp->x + pArcsTmp->width; if(box.y1 > pArcsTmp->y) box.y1 = pArcsTmp->y; if(box.y2 < (pArcsTmp->y + pArcsTmp->height)) box.y2 = pArcsTmp->y + pArcsTmp->height; } TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolyFillArc)(pDrawable, pGC, nArcs, pArcs); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } /* * general Poly/Image text function. Extract glyph information, * compute bounding box and remove cursor if it is overlapped. */ static void damageDamageChars (DrawablePtr pDrawable, FontPtr font, int x, int y, unsigned int n, CharInfoPtr *charinfo, Bool imageblt, int subWindowMode) { ExtentInfoRec extents; BoxRec box; #ifdef HAS_XFONT2 xfont2_query_glyph_extents(font, charinfo, n, &extents); #else QueryGlyphExtents(font, charinfo, n, &extents); #endif /* HAS_XFONT2 */ if (imageblt) { if (extents.overallWidth > extents.overallRight) extents.overallRight = extents.overallWidth; if (extents.overallWidth < extents.overallLeft) extents.overallLeft = extents.overallWidth; if (extents.overallLeft > 0) extents.overallLeft = 0; if (extents.fontAscent > extents.overallAscent) extents.overallAscent = extents.fontAscent; if (extents.fontDescent > extents.overallDescent) extents.overallDescent = extents.fontDescent; } box.x1 = x + extents.overallLeft; box.y1 = y - extents.overallAscent; box.x2 = x + extents.overallRight; box.y2 = y + extents.overallDescent; damageDamageBox (pDrawable, &box, subWindowMode); } /* * values for textType: */ #define TT_POLY8 0 #define TT_IMAGE8 1 #define TT_POLY16 2 #define TT_IMAGE16 3 static void damageText (DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned long count, char *chars, FontEncoding fontEncoding, Bool textType) { CharInfoPtr *charinfo; unsigned long i; unsigned int n; Bool imageblt; imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16); if (!checkGCDamage(pDrawable, pGC)) return; charinfo = (CharInfoPtr *) malloc(count * sizeof(CharInfoPtr)); if (!charinfo) return; GetGlyphs(pGC->font, count, (unsigned char *)chars, fontEncoding, &i, charinfo); n = (unsigned int)i; if (n != 0) { damageDamageChars (pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y, n, charinfo, imageblt, pGC->subWindowMode); } free(charinfo); } static int damagePolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit, TT_POLY8); x = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); return x; } static int damagePolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, TT_POLY16); x = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); return x; } static void damageImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); damageText (pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit, TT_IMAGE8); (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static void damageImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, TT_IMAGE16); (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static void damageImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void * pglyphBase) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); damageDamageChars (pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y, nglyph, ppci, TRUE, pGC->subWindowMode); (*pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static void damagePolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void * pglyphBase) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); damageDamageChars (pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y, nglyph, ppci, FALSE, pGC->subWindowMode); (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static void damagePushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if(checkGCDamage (pDrawable, pGC)) { BoxRec box; box.x1 = xOrg; box.y1 = yOrg; if(!pGC->miTranslate) { box.x1 += pDrawable->x; box.y1 += pDrawable->y; } box.x2 = box.x1 + dx; box.y2 = box.y1 + dy; TRIM_BOX(box, pGC); if(BOX_NOT_EMPTY(box)) damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PushPixels)(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } static void damageRemoveDamage (DamagePtr *pPrev, DamagePtr pDamage) { while (*pPrev) { if (*pPrev == pDamage) { *pPrev = pDamage->pNext; return; } pPrev = &(*pPrev)->pNext; } #if DAMAGE_VALIDATE_ENABLE ErrorF ("Damage not on list\n"); abort (); #endif } static void damageInsertDamage (DamagePtr *pPrev, DamagePtr pDamage) { #if DAMAGE_VALIDATE_ENABLE DamagePtr pOld; for (pOld = *pPrev; pOld; pOld = pOld->pNext) if (pOld == pDamage) { ErrorF ("Damage already on list\n"); abort (); } #endif pDamage->pNext = *pPrev; *pPrev = pDamage; } static Bool damageDestroyPixmap (PixmapPtr pPixmap) { ScreenPtr pScreen = pPixmap->drawable.pScreen; damageScrPriv(pScreen); if (pPixmap->refcnt == 1) { DamagePtr *pPrev = getPixmapDamageRef (pPixmap); DamagePtr pDamage; while ((pDamage = *pPrev)) { damageRemoveDamage (pPrev, pDamage); if (!pDamage->isWindow) DamageDestroy (pDamage); } } unwrap (pScrPriv, pScreen, DestroyPixmap); (*pScreen->DestroyPixmap) (pPixmap); wrap (pScrPriv, pScreen, DestroyPixmap, damageDestroyPixmap); return TRUE; } static void damagePaintWindow(WindowPtr pWindow, RegionPtr prgn, int what) { ScreenPtr pScreen = pWindow->drawable.pScreen; damageScrPriv(pScreen); /* * Painting background none doesn't actually *do* anything, so * no damage is recorded */ if ((what != PW_BACKGROUND || pWindow->backgroundState != None) && getWindowDamage (pWindow)) damageDamageRegion (&pWindow->drawable, prgn, FALSE, -1); if(what == PW_BACKGROUND) { unwrap (pScrPriv, pScreen, PaintWindowBackground); (*pScreen->PaintWindowBackground) (pWindow, prgn, what); wrap (pScrPriv, pScreen, PaintWindowBackground, damagePaintWindow); } else { unwrap (pScrPriv, pScreen, PaintWindowBorder); (*pScreen->PaintWindowBorder) (pWindow, prgn, what); wrap (pScrPriv, pScreen, PaintWindowBorder, damagePaintWindow); } } static void damageCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWindow->drawable.pScreen; damageScrPriv(pScreen); if (getWindowDamage (pWindow)) { int dx = pWindow->drawable.x - ptOldOrg.x; int dy = pWindow->drawable.y - ptOldOrg.y; /* * The region comes in source relative, but the damage occurs * at the destination location. Translate back and forth. */ RegionTranslate(prgnSrc, dx, dy); damageDamageRegion (&pWindow->drawable, prgnSrc, FALSE, -1); RegionTranslate(prgnSrc, -dx, -dy); } unwrap (pScrPriv, pScreen, CopyWindow); (*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc); wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow); } GCOps damageGCOps = { damageFillSpans, damageSetSpans, damagePutImage, damageCopyArea, damageCopyPlane, damagePolyPoint, damagePolylines, damagePolySegment, damagePolyRectangle, damagePolyArc, damageFillPolygon, damagePolyFillRect, damagePolyFillArc, damagePolyText8, damagePolyText16, damageImageText8, damageImageText16, damageImageGlyphBlt, damagePolyGlyphBlt, damagePushPixels, #ifdef NEED_LINEHELPER NULL, #endif {NULL} /* devPrivate */ }; static void damageRestoreAreas (PixmapPtr pPixmap, RegionPtr prgn, int xorg, int yorg, WindowPtr pWindow) { ScreenPtr pScreen = pWindow->drawable.pScreen; damageScrPriv(pScreen); damageDamageRegion (&pWindow->drawable, prgn, FALSE, -1); unwrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas); (*pScreen->BackingStoreFuncs.RestoreAreas) (pPixmap, prgn, xorg, yorg, pWindow); wrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas, damageRestoreAreas); } static void damageSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap) { DamagePtr pDamage; ScreenPtr pScreen = pWindow->drawable.pScreen; damageScrPriv(pScreen); if ((pDamage = damageGetWinPriv(pWindow))) { PixmapPtr pOldPixmap = (*pScreen->GetWindowPixmap) (pWindow); DamagePtr *pPrev = getPixmapDamageRef(pOldPixmap); while (pDamage) { damageRemoveDamage (pPrev, pDamage); pDamage = pDamage->pNextWin; } } unwrap (pScrPriv, pScreen, SetWindowPixmap); (*pScreen->SetWindowPixmap) (pWindow, pPixmap); wrap (pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap); if ((pDamage = damageGetWinPriv(pWindow))) { DamagePtr *pPrev = getPixmapDamageRef(pPixmap); while (pDamage) { damageInsertDamage (pPrev, pDamage); pDamage = pDamage->pNextWin; } } } static Bool damageDestroyWindow (WindowPtr pWindow) { DamagePtr pDamage; ScreenPtr pScreen = pWindow->drawable.pScreen; Bool ret; damageScrPriv(pScreen); while ((pDamage = damageGetWinPriv(pWindow))) { DamageUnregister (&pWindow->drawable, pDamage); DamageDestroy (pDamage); } unwrap (pScrPriv, pScreen, DestroyWindow); ret = (*pScreen->DestroyWindow) (pWindow); wrap (pScrPriv, pScreen, DestroyWindow, damageDestroyWindow); return ret; } static Bool damageCloseScreen (ScreenPtr pScreen) { damageScrPriv(pScreen); unwrap (pScrPriv, pScreen, DestroyPixmap); unwrap (pScrPriv, pScreen, CreateGC); unwrap (pScrPriv, pScreen, PaintWindowBackground); unwrap (pScrPriv, pScreen, PaintWindowBorder); unwrap (pScrPriv, pScreen, CopyWindow); unwrap (pScrPriv, pScreen, CloseScreen); unwrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas); free (pScrPriv); return (*pScreen->CloseScreen) (pScreen); } int damageScrPrivateIndex; int damagePixPrivateIndex; int damageGCPrivateIndex; int damageWinPrivateIndex; int damageGeneration; Bool DamageSetup (ScreenPtr pScreen) { DamageScrPrivPtr pScrPriv; #ifdef RENDER PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif if (damageGeneration != serverGeneration) { damageScrPrivateIndex = AllocateScreenPrivateIndex (); if (damageScrPrivateIndex == -1) return FALSE; damageGCPrivateIndex = AllocateGCPrivateIndex (); if (damageGCPrivateIndex == -1) return FALSE; damagePixPrivateIndex = AllocatePixmapPrivateIndex (); if (damagePixPrivateIndex == -1) return FALSE; damageWinPrivateIndex = AllocateWindowPrivateIndex (); if (damageWinPrivateIndex == -1) return FALSE; damageGeneration = serverGeneration; } if (pScreen->devPrivates[damageScrPrivateIndex].ptr) return TRUE; if (!AllocateGCPrivate (pScreen, damageGCPrivateIndex, sizeof (DamageGCPrivRec))) return FALSE; if (!AllocatePixmapPrivate (pScreen, damagePixPrivateIndex, 0)) return FALSE; if (!AllocateWindowPrivate (pScreen, damageWinPrivateIndex, 0)) return FALSE; pScrPriv = (DamageScrPrivPtr) malloc (sizeof (DamageScrPrivRec)); if (!pScrPriv) return FALSE; #ifdef COMPOSITE /* This is a kludge to ensure wrapping order with the composite wrapper. * If it's done from compinit.c, then DamageSetup may be called before the * extension init phase, so that cw will be higher in the wrapping chain and * rewrite drawables before damage gets to it, causing confusion. */ if (!noCompositeExtension) miInitializeCompositeWrapper (pScreen); #endif pScrPriv->internalLevel = 0; pScrPriv->pScreenDamage = 0; wrap (pScrPriv, pScreen, DestroyPixmap, damageDestroyPixmap); wrap (pScrPriv, pScreen, CreateGC, damageCreateGC); wrap (pScrPriv, pScreen, PaintWindowBackground, damagePaintWindow); wrap (pScrPriv, pScreen, PaintWindowBorder, damagePaintWindow); wrap (pScrPriv, pScreen, DestroyWindow, damageDestroyWindow); wrap (pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap); wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow); wrap (pScrPriv, pScreen, CloseScreen, damageCloseScreen); wrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas, damageRestoreAreas); #ifdef RENDER if (ps) { wrap (pScrPriv, ps, Glyphs, damageGlyphs); wrap (pScrPriv, ps, Composite, damageComposite); } #endif pScreen->devPrivates[damageScrPrivateIndex].ptr = (void *) pScrPriv; return TRUE; } DamagePtr DamageCreate (DamageReportFunc damageReport, DamageDestroyFunc damageDestroy, DamageReportLevel damageLevel, Bool isInternal, ScreenPtr pScreen, void *closure) { DamagePtr pDamage; pDamage = malloc (sizeof (DamageRec)); if (!pDamage) return 0; pDamage->pNext = 0; pDamage->pNextWin = 0; RegionNull(&pDamage->damage); pDamage->damageLevel = damageLevel; pDamage->isInternal = isInternal; pDamage->closure = closure; pDamage->isWindow = FALSE; pDamage->pDrawable = 0; pDamage->damageReport = damageReport; pDamage->damageDestroy = damageDestroy; return pDamage; } void DamageRegister (DrawablePtr pDrawable, DamagePtr pDamage) { if (pDrawable->type == DRAWABLE_WINDOW) { WindowPtr pWindow = (WindowPtr) pDrawable; winDamageRef(pWindow); #if DAMAGE_VALIDATE_ENABLE DamagePtr pOld; for (pOld = *pPrev; pOld; pOld = pOld->pNextWin) if (pOld == pDamage) { ErrorF ("Damage already on window list\n"); abort (); } #endif pDamage->pNextWin = *pPrev; *pPrev = pDamage; pDamage->isWindow = TRUE; } else pDamage->isWindow = FALSE; pDamage->pDrawable = pDrawable; damageInsertDamage (getDrawableDamageRef (pDrawable), pDamage); } void DamageDrawInternal (ScreenPtr pScreen, Bool enable) { damageScrPriv (pScreen); pScrPriv->internalLevel += enable ? 1 : -1; } void DamageUnregister (DrawablePtr pDrawable, DamagePtr pDamage) { if (pDrawable->type == DRAWABLE_WINDOW) { WindowPtr pWindow = (WindowPtr) pDrawable; winDamageRef (pWindow); #if DAMAGE_VALIDATE_ENABLE int found = 0; #endif while (*pPrev) { if (*pPrev == pDamage) { *pPrev = pDamage->pNextWin; #if DAMAGE_VALIDATE_ENABLE found = 1; #endif break; } pPrev = &(*pPrev)->pNextWin; } #if DAMAGE_VALIDATE_ENABLE if (!found) { ErrorF ("Damage not on window list\n"); abort (); } #endif } pDamage->pDrawable = 0; damageRemoveDamage (getDrawableDamageRef (pDrawable), pDamage); } void DamageDestroy (DamagePtr pDamage) { if (pDamage->damageDestroy) (*pDamage->damageDestroy) (pDamage, pDamage->closure); RegionUninit(&pDamage->damage); free (pDamage); } Bool DamageSubtract (DamagePtr pDamage, const RegionPtr pRegion) { RegionPtr pClip; RegionRec pixmapClip; DrawablePtr pDrawable = pDamage->pDrawable; RegionSubtract(&pDamage->damage, &pDamage->damage, pRegion); if (pDrawable) { if (pDrawable->type == DRAWABLE_WINDOW) pClip = &((WindowPtr) pDrawable)->borderClip; else { BoxRec box; box.x1 = pDrawable->x; box.y1 = pDrawable->y; box.x2 = pDrawable->x + pDrawable->width; box.y2 = pDrawable->y + pDrawable->height; RegionInit(&pixmapClip, &box, 1); pClip = &pixmapClip; } RegionTranslate(&pDamage->damage, pDrawable->x, pDrawable->y); RegionIntersect(&pDamage->damage, &pDamage->damage, pClip); RegionTranslate(&pDamage->damage, -pDrawable->x, -pDrawable->y); if (pDrawable->type != DRAWABLE_WINDOW) RegionUninit(&pixmapClip); } return RegionNotEmpty(&pDamage->damage); } void DamageEmpty (DamagePtr pDamage) { RegionEmpty(&pDamage->damage); } RegionPtr DamageRegion (DamagePtr pDamage) { return &pDamage->damage; } void DamageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion) { damageDamageRegion (pDrawable, pRegion, FALSE, -1); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/miext/damage/damage.h0000644000000000000000000000464413614532331020536 0ustar /* * $Id: damage.h,v 1.4 2005/07/03 07:02:01 daniels Exp $ * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _DAMAGE_H_ #define _DAMAGE_H_ typedef struct _damage *DamagePtr; typedef enum _damageReportLevel { DamageReportRawRegion, DamageReportDeltaRegion, DamageReportBoundingBox, DamageReportNonEmpty, DamageReportNone } DamageReportLevel; typedef void (*DamageReportFunc) (DamagePtr pDamage, RegionPtr pRegion, void *closure); typedef void (*DamageDestroyFunc) (DamagePtr pDamage, void *closure); Bool DamageSetup (ScreenPtr pScreen); DamagePtr DamageCreate (DamageReportFunc damageReport, DamageDestroyFunc damageDestroy, DamageReportLevel damageLevel, Bool isInternal, ScreenPtr pScreen, void * closure); void DamageDrawInternal (ScreenPtr pScreen, Bool enable); void DamageRegister (DrawablePtr pDrawable, DamagePtr pDamage); void DamageUnregister (DrawablePtr pDrawable, DamagePtr pDamage); void DamageDestroy (DamagePtr pDamage); Bool DamageSubtract (DamagePtr pDamage, const RegionPtr pRegion); void DamageEmpty (DamagePtr pDamage); RegionPtr DamageRegion (DamagePtr pDamage); void DamageDamageRegion (DrawablePtr pDrawable, const RegionPtr pRegion); #endif /* _DAMAGE_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/miext/damage/damagestr.h0000644000000000000000000000676613614532331021276 0ustar /* * $Id: damagestr.h,v 1.6 2005/07/03 07:02:01 daniels Exp $ * * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _DAMAGESTR_H_ #define _DAMAGESTR_H_ #include "damage.h" #include "gcstruct.h" #ifdef RENDER # include "picturestr.h" #endif typedef struct _damage { DamagePtr pNext; DamagePtr pNextWin; RegionRec damage; DamageReportLevel damageLevel; Bool isInternal; void *closure; Bool isWindow; DrawablePtr pDrawable; DamageReportFunc damageReport; DamageDestroyFunc damageDestroy; } DamageRec; typedef struct _damageScrPriv { int internalLevel; /* * For DDXen which don't provide GetScreenPixmap, this provides * a place to hook damage for windows on the screen */ DamagePtr pScreenDamage; PaintWindowBackgroundProcPtr PaintWindowBackground; PaintWindowBorderProcPtr PaintWindowBorder; CopyWindowProcPtr CopyWindow; CloseScreenProcPtr CloseScreen; CreateGCProcPtr CreateGC; DestroyPixmapProcPtr DestroyPixmap; SetWindowPixmapProcPtr SetWindowPixmap; DestroyWindowProcPtr DestroyWindow; #ifdef RENDER CompositeProcPtr Composite; GlyphsProcPtr Glyphs; #endif BSFuncRec BackingStoreFuncs; } DamageScrPrivRec, *DamageScrPrivPtr; typedef struct _damageGCPriv { GCOps *ops; GCFuncs *funcs; } DamageGCPrivRec, *DamageGCPrivPtr; extern int damageScrPrivateIndex; extern int damagePixPrivateIndex; extern int damageGCPrivateIndex; extern int damageWinPrivateIndex; #define damageGetScrPriv(pScr) \ ((DamageScrPrivPtr) (pScr)->devPrivates[damageScrPrivateIndex].ptr) #define damageScrPriv(pScr) \ DamageScrPrivPtr pScrPriv = damageGetScrPriv(pScr) #define damageGetPixPriv(pPix) \ ((DamagePtr) (pPix)->devPrivates[damagePixPrivateIndex].ptr) #define damgeSetPixPriv(pPix,v) \ ((pPix)->devPrivates[damagePixPrivateIndex].ptr = (void * ) (v)) #define damagePixPriv(pPix) \ DamagePtr pDamage = damageGetPixPriv(pPix) #define damageGetGCPriv(pGC) \ ((DamageGCPrivPtr) (pGC)->devPrivates[damageGCPrivateIndex].ptr) #define damageGCPriv(pGC) \ DamageGCPrivPtr pGCPriv = damageGetGCPriv(pGC) #define damageGetWinPriv(pWin) \ ((DamagePtr) (pWin)->devPrivates[damageWinPrivateIndex].ptr) #define damageSetWinPriv(pWin,d) \ ((pWin)->devPrivates[damageWinPrivateIndex].ptr = (d)) #endif /* _DAMAGESTR_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/miext/damage/Imakefile0000644000000000000000000000117713614532331020756 0ustar #define IHaveModules #include #if BuildRootless DEFINES = -DROOTLESS_WORKAROUND #endif SRCS = damage.c OBJS = damage.o INCLUDES = -I. -I../../mi -I../../fb -I../../include -I$(XINCLUDESRC) \ -I$(XF86SRC)/common $(EXTRAINCLUDES) \ -I../../render -I../cw -I$(EXTINCSRC) \ `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \ ../../mi/llib-lmi.ln NormalLibraryObjectRule() NormalLibraryTarget(damage,$(OBJS)) LintLibraryTarget(damage,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() InstallDriverSDKNonExecFile(damage.h,$(DRIVERSDKINCLUDEDIR)) nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/Imakefile0000644000000000000000000001471113614532331017015 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ NULL = #include #if ! HasCbrt CBRT_SRC = cbrt.c CBRT_OBJ = cbrt.o #endif #if HasFfs FFS_DEFINES = -DHAS_FFS #endif MIINITEXTSRC = miinitext.c MIINITEXTOBJ = miinitext.o SRCS = $(CBRT_SRC) \ mivaltree.c \ mipolyseg.c \ mipolyrect.c \ mipoly.c \ mipolycon.c \ mipolygen.c \ mipolyutil.c \ mifillrct.c \ miwideline.c \ mispans.c \ miarc.c \ mizerarc.c \ mifillarc.c \ miwindow.c \ micursor.c \ mipolytext.c \ mibitblt.c \ mipolypnt.c \ mipushpxl.c \ miglblt.c \ mizerline.c \ mizerclip.c \ mifpolycon.c \ midash.c \ mibstore.c \ $(MIINITEXTSRC) \ mieq.c \ mipointer.c \ misprite.c \ midispcur.c \ miscrinit.c \ migc.c \ micmap.c \ mioverlay.c \ miexpose.c \ $(NULL) OBJS = $(CBRT_OBJ) \ mivaltree.o \ mipolyseg.o \ mipolyrect.o \ mipoly.o \ mipolycon.o \ mipolygen.o \ mipolyutil.o \ mifillrct.o \ miwideline.o \ mispans.o \ miarc.o \ mizerarc.o \ mifillarc.o \ miwindow.o \ micursor.o \ mipolytext.o \ mibitblt.o \ mipolypnt.o \ mipushpxl.o \ miglblt.o \ mizerline.o \ mizerclip.o \ mifpolycon.o \ midash.o \ mibstore.o \ $(MIINITEXTOBJ) \ mieq.o \ mipointer.o \ misprite.o \ midispcur.o \ miscrinit.o \ migc.o \ micmap.o \ mioverlay.o \ miexpose.o \ $(NULL) #if defined(XorgVersion) /* * Make sure XINPUT, XF86VidTune, etc aren't defined for the miinitext.o * used by Xnest, Xvfb */ #if NXLibraries /* * To build the NX agent we need the XINPUT symbol * in order to build the XInputExtension, since we * don't use the XF86 module loader. */ EXT_DEFINES = ExtensionDefines \ $(NULL) #else EXT_DEFINES = ExtensionDefines \ -UXINPUT \ $(NULL) #endif #endif INCLUDES = -I. \ -I../include \ -I../render \ -I../xfixes \ -I../damageext \ -I../miext/damage \ -I$(XINCLUDESRC) \ -I$(EXTINCSRC) \ -I$(SERVERSRC)/Xext \ `pkg-config --cflags-only-I pixman-1` \ $(NULL) LINTLIBS = \ ../dix/llib-ldix.ln \ ../os/llib-los.ln \ $(NULL) DEFINES = $(FFS_DEFINES) NormalLibraryObjectRule() NormalLibraryTarget(mi,$(OBJS)) LintLibraryTarget(mi,$(SRCS)) NormalLintTarget($(SRCS)) #ifndef Win32Architecture NormalLibraryTarget(cbrt,cbrt.o) #endif SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES)) SpecialCObjectRule(miscrinit,$(ICONFIGFILES),$(EXT_DEFINES)) #ifdef ItsyCompilerBug SpecialCObjectRule(mipolycon,$(_NOOP_),-O0) #endif #if defined(OpenBSDArchitecture) && defined(Sparc64Architecture) SpecialCObjectRule(mizerclip,NullParameter,-O0) #endif AllTarget($(EXTRAMIINITEXTOBJ)) DependTarget() InstallDriverSDKNonExecFile(mi.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(mibstore.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(micmap.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(migc.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(miline.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(mipointer.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(mipointrst.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(mizerarc.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(micoord.h,$(DRIVERSDKINCLUDEDIR)) nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/miarc.c0000644000000000000000000025026413614532331016450 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* Author: Keith Packard and Bob Scheifler */ /* Warning: this code is toxic, do not dally very long here. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #if defined(_XOPEN_SOURCE) \ || (defined(sun) && defined(__SVR4)) #include #else #define _XOPEN_SOURCE /* to get prototype for hypot on some systems */ #include #undef _XOPEN_SOURCE #endif #include #include #include "misc.h" #include "gcstruct.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "windowstr.h" #include "mifpoly.h" #include "mi.h" #include "mifillarc.h" #include static double miDsin(double a); static double miDcos(double a); static double miDasin(double v); static double miDatan2(double dy, double dx); double cbrt(double); #ifdef ICEILTEMPDECL ICEILTEMPDECL #endif /* * some interesting sematic interpretation of the protocol: * * Self intersecting arcs (i.e. those spanning 360 degrees) * never join with other arcs, and are drawn without caps * (unless on/off dashed, in which case each dash segment * is capped, except when the last segment meets the * first segment, when no caps are drawn) * * double dash arcs are drawn in two parts, first the * odd dashes (drawn in background) then the even dashes * (drawn in foreground). This means that overlapping * sections of foreground/background are drawn twice, * first in background then in foreground. The double-draw * occurs even when the function uses the destination values * (e.g. xor mode). This is the same way the wide-line * code works and should be "fixed". * */ #undef max #undef min #if defined (__GNUC__) && !defined (__STRICT_ANSI__) #define USE_INLINE #endif #ifdef USE_INLINE inline static const int max (const int x, const int y) { return x>y? x:y; } inline static const int min (const int x, const int y) { return xy? x:y; } static int min (int x, int y) { return xlineWidth; int a0, a1, startAngle, endAngle; miArcFacePtr temp; if (!l) l = 1; if (tarc.width == 0 || tarc.height == 0) { drawZeroArc (pDraw, pGC, &tarc, l, left, right); return; } if (pGC->miTranslate) { tarc.x += pDraw->x; tarc.y += pDraw->y; } a0 = tarc.angle1; a1 = tarc.angle2; if (a1 > FULLCIRCLE) a1 = FULLCIRCLE; else if (a1 < -FULLCIRCLE) a1 = -FULLCIRCLE; if (a1 < 0) { startAngle = a0 + a1; endAngle = a0; temp = right; right = left; left = temp; } else { startAngle = a0; endAngle = a0 + a1; } /* * bounds check the two angles */ if (startAngle < 0) startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE; if (startAngle >= FULLCIRCLE) startAngle = startAngle % FULLCIRCLE; if (endAngle < 0) endAngle = FULLCIRCLE - (-endAngle) % FULLCIRCLE; if (endAngle > FULLCIRCLE) endAngle = (endAngle-1) % FULLCIRCLE + 1; if ((startAngle == endAngle) && a1) { startAngle = 0; endAngle = FULLCIRCLE; } drawArc (&tarc, l, startAngle, endAngle, right, left); } /* Three equations combine to describe the boundaries of the arc x^2/w^2 + y^2/h^2 = 1 ellipse itself (X-x)^2 + (Y-y)^2 = r^2 circle at (x, y) on the ellipse (Y-y) = (X-x)*w^2*y/(h^2*x) normal at (x, y) on the ellipse These lead to a quartic relating Y and y y^4 - (2Y)y^3 + (Y^2 + (h^4 - w^2*r^2)/(w^2 - h^2))y^2 - (2Y*h^4/(w^2 - h^2))y + (Y^2*h^4)/(w^2 - h^2) = 0 The reducible cubic obtained from this quartic is z^3 - (3N)z^2 - 2V = 0 where N = (Y^2 + (h^4 - w^2*r^2/(w^2 - h^2)))/6 V = w^2*r^2*Y^2*h^4/(4 *(w^2 - h^2)^2) Let t = z - N p = -N^2 q = -N^3 - V Then we get t^3 + 3pt + 2q = 0 The discriminant of this cubic is D = q^2 + p^3 When D > 0, a real root is obtained as z = N + cbrt(-q+sqrt(D)) + cbrt(-q-sqrt(D)) When D < 0, a real root is obtained as z = N - 2m*cos(acos(-q/m^3)/3) where m = sqrt(|p|) * sign(q) Given a real root Z of the cubic, the roots of the quartic are the roots of the two quadratics y^2 + ((b+A)/2)y + (Z + (bZ - d)/A) = 0 where A = +/- sqrt(8Z + b^2 - 4c) b, c, d are the cubic, quadratic, and linear coefficients of the quartic Some experimentation is then required to determine which solutions correspond to the inner and outer boundaries. */ typedef struct { short lx, lw, rx, rw; } miArcSpan; typedef struct { miArcSpan *spans; int count1, count2, k; char top, bot, hole; } miArcSpanData; typedef struct { unsigned long lrustamp; unsigned short lw; unsigned short width, height; miArcSpanData *spdata; } arcCacheRec; #define CACHESIZE 25 static void drawQuadrant(struct arc_def *def, struct accelerators *acc, int a0, int a1, int mask, miArcFacePtr right, miArcFacePtr left, miArcSpanData *spdata); static arcCacheRec arcCache[CACHESIZE]; static unsigned long lrustamp; static arcCacheRec *lastCacheHit = &arcCache[0]; static RESTYPE cacheType; /* * External so it can be called when low on memory. * Call with a zero ID in that case. */ /*ARGSUSED*/ int miFreeArcCache (data, id) void * data; XID id; { int k; arcCacheRec *cent; if (id) cacheType = 0; for (k = CACHESIZE, cent = &arcCache[0]; --k >= 0; cent++) { if (cent->spdata) { cent->lrustamp = 0; cent->lw = 0; free(cent->spdata); cent->spdata = NULL; } } lrustamp = 0; return Success; } static void miComputeCircleSpans( int lw, xArc *parc, miArcSpanData *spdata) { register miArcSpan *span; int doinner; register int x, y, e; int xk, yk, xm, ym, dx, dy; register int slw, inslw; int inx = 0, iny, ine = 0; int inxk = 0, inyk = 0, inxm = 0, inym = 0; doinner = -lw; slw = parc->width - doinner; y = parc->height >> 1; dy = parc->height & 1; dx = 1 - dy; MIWIDEARCSETUP(x, y, dy, slw, e, xk, xm, yk, ym); inslw = parc->width + doinner; if (inslw > 0) { spdata->hole = spdata->top; MIWIDEARCSETUP(inx, iny, dy, inslw, ine, inxk, inxm, inyk, inym); } else { spdata->hole = FALSE; doinner = -y; } spdata->count1 = -doinner - spdata->top; spdata->count2 = y + doinner; span = spdata->spans; while (y) { MIFILLARCSTEP(slw); span->lx = dy - x; if (++doinner <= 0) { span->lw = slw; span->rx = 0; span->rw = span->lx + slw; } else { MIFILLINARCSTEP(inslw); span->lw = x - inx; span->rx = dy - inx + inslw; span->rw = inx - x + slw - inslw; } span++; } if (spdata->bot) { if (spdata->count2) spdata->count2--; else { if (lw > (int)parc->height) span[-1].rx = span[-1].rw = -((lw - (int)parc->height) >> 1); else span[-1].rw = 0; spdata->count1--; } } } static void miComputeEllipseSpans( int lw, xArc *parc, miArcSpanData *spdata) { register miArcSpan *span; double w, h, r, xorg; double Hs, Hf, WH, K, Vk, Nk, Fk, Vr, N, Nc, Z, rs; double A, T, b, d, x, y, t, inx, outx = 0.0, hepp, hepm; int flip, solution; w = (double)parc->width / 2.0; h = (double)parc->height / 2.0; r = lw / 2.0; rs = r * r; Hs = h * h; WH = w * w - Hs; Nk = w * r; Vk = (Nk * Hs) / (WH + WH); Hf = Hs * Hs; Nk = (Hf - Nk * Nk) / WH; Fk = Hf / WH; hepp = h + EPSILON; hepm = h - EPSILON; K = h + ((lw - 1) >> 1); span = spdata->spans; if (parc->width & 1) xorg = .5; else xorg = 0.0; if (spdata->top) { span->lx = 0; span->lw = 1; span++; } spdata->count1 = 0; spdata->count2 = 0; spdata->hole = (spdata->top && (int)parc->height * lw <= (int)(parc->width * parc->width) && lw < (int)parc->height); for (; K > 0.0; K -= 1.0) { N = (K * K + Nk) / 6.0; Nc = N * N * N; Vr = Vk * K; t = Nc + Vr * Vr; d = Nc + t; if (d < 0.0) { d = Nc; b = N; if ( (b < 0.0) == (t < 0.0) ) { b = -b; d = -d; } Z = N - 2.0 * b * cos(acos(-t / d) / 3.0); if ( (Z < 0.0) == (Vr < 0.0) ) flip = 2; else flip = 1; } else { d = Vr * sqrt(d); Z = N + cbrt(t + d) + cbrt(t - d); flip = 0; } A = sqrt((Z + Z) - Nk); T = (Fk - Z) * K / A; inx = 0.0; solution = FALSE; b = -A + K; d = b * b - 4 * (Z + T); if (d >= 0) { d = sqrt(d); y = (b + d) / 2; if ((y >= 0.0) && (y < hepp)) { solution = TRUE; if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) t = sqrt(rs - (t * t)); else t = 0; if (flip == 2) inx = x - t; else outx = x + t; } } b = A + K; d = b * b - 4 * (Z - T); /* Because of the large magnitudes involved, we lose enough precision * that sometimes we end up with a negative value near the axis, when * it should be positive. This is a workaround. */ if (d < 0 && !solution) d = 0.0; if (d >= 0) { d = sqrt(d); y = (b + d) / 2; if (y < hepp) { if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) inx = x - sqrt(rs - (t * t)); else inx = x; } y = (b - d) / 2; if (y >= 0.0) { if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) t = sqrt(rs - (t * t)); else t = 0; if (flip == 1) inx = x - t; else outx = x + t; } } span->lx = ICEIL(xorg - outx); if (inx <= 0.0) { spdata->count1++; span->lw = ICEIL(xorg + outx) - span->lx; span->rx = ICEIL(xorg + inx); span->rw = -ICEIL(xorg - inx); } else { spdata->count2++; span->lw = ICEIL(xorg - inx) - span->lx; span->rx = ICEIL(xorg + inx); span->rw = ICEIL(xorg + outx) - span->rx; } span++; } if (spdata->bot) { outx = w + r; if (r >= h && r <= w) inx = 0.0; else if (Nk < 0.0 && -Nk < Hs) { inx = w * sqrt(1 + Nk / Hs) - sqrt(rs + Nk); if (inx > w - r) inx = w - r; } else inx = w - r; span->lx = ICEIL(xorg - outx); if (inx <= 0.0) { span->lw = ICEIL(xorg + outx) - span->lx; span->rx = ICEIL(xorg + inx); span->rw = -ICEIL(xorg - inx); } else { span->lw = ICEIL(xorg - inx) - span->lx; span->rx = ICEIL(xorg + inx); span->rw = ICEIL(xorg + outx) - span->rx; } } if (spdata->hole) { span = &spdata->spans[spdata->count1]; span->lw = -span->lx; span->rx = 1; span->rw = span->lw; spdata->count1--; spdata->count2++; } } static double tailX( double K, struct arc_def *def, struct arc_bound *bounds, struct accelerators *acc) { double w, h, r; double Hs, Hf, WH, Vk, Nk, Fk, Vr, N, Nc, Z, rs; double A, T, b, d, x, y, t, hepp, hepm; int flip, solution; double xs[2]; double *xp; w = def->w; h = def->h; r = def->l; rs = r * r; Hs = acc->h2; WH = -acc->h2mw2; Nk = def->w * r; Vk = (Nk * Hs) / (WH + WH); Hf = acc->h4; Nk = (Hf - Nk * Nk) / WH; if (K == 0.0) { if (Nk < 0.0 && -Nk < Hs) { xs[0] = w * sqrt(1 + Nk / Hs) - sqrt(rs + Nk); xs[1] = w - r; if (acc->left.valid && boundedLe(K, bounds->left) && !boundedLe(K, bounds->outer) && xs[0] >= 0.0 && xs[1] >= 0.0) return xs[1]; if (acc->right.valid && boundedLe(K, bounds->right) && !boundedLe(K, bounds->inner) && xs[0] <= 0.0 && xs[1] <= 0.0) return xs[1]; return xs[0]; } return w - r; } Fk = Hf / WH; hepp = h + EPSILON; hepm = h - EPSILON; N = (K * K + Nk) / 6.0; Nc = N * N * N; Vr = Vk * K; xp = xs; xs[0] = 0.0; t = Nc + Vr * Vr; d = Nc + t; if (d < 0.0) { d = Nc; b = N; if ( (b < 0.0) == (t < 0.0) ) { b = -b; d = -d; } Z = N - 2.0 * b * cos(acos(-t / d) / 3.0); if ( (Z < 0.0) == (Vr < 0.0) ) flip = 2; else flip = 1; } else { d = Vr * sqrt(d); Z = N + cbrt(t + d) + cbrt(t - d); flip = 0; } A = sqrt((Z + Z) - Nk); T = (Fk - Z) * K / A; solution = FALSE; b = -A + K; d = b * b - 4 * (Z + T); if (d >= 0 && flip == 2) { d = sqrt(d); y = (b + d) / 2; if ((y >= 0.0) && (y < hepp)) { solution = TRUE; if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) t = sqrt(rs - (t * t)); else t = 0; *xp++ = x - t; } } b = A + K; d = b * b - 4 * (Z - T); /* Because of the large magnitudes involved, we lose enough precision * that sometimes we end up with a negative value near the axis, when * it should be positive. This is a workaround. */ if (d < 0 && !solution) d = 0.0; if (d >= 0) { d = sqrt(d); y = (b + d) / 2; if (y < hepp) { if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) *xp++ = x - sqrt(rs - (t * t)); else *xp++ = x; } y = (b - d) / 2; if (y >= 0.0 && flip == 1) { if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) t = sqrt(rs - (t * t)); else t = 0; *xp++ = x - t; } } if (xp > &xs[1]) { if (acc->left.valid && boundedLe(K, bounds->left) && !boundedLe(K, bounds->outer) && xs[0] >= 0.0 && xs[1] >= 0.0) return xs[1]; if (acc->right.valid && boundedLe(K, bounds->right) && !boundedLe(K, bounds->inner) && xs[0] <= 0.0 && xs[1] <= 0.0) return xs[1]; } return xs[0]; } static miArcSpanData * miComputeWideEllipse( int lw, register xArc *parc, Bool *mustFree) { register miArcSpanData *spdata; register arcCacheRec *cent, *lruent; register int k; arcCacheRec fakeent; if (!lw) lw = 1; if (parc->height <= 1500) { *mustFree = FALSE; cent = lastCacheHit; if (cent->lw == lw && cent->width == parc->width && cent->height == parc->height) { cent->lrustamp = ++lrustamp; return cent->spdata; } lruent = &arcCache[0]; for (k = CACHESIZE, cent = lruent; --k >= 0; cent++) { if (cent->lw == lw && cent->width == parc->width && cent->height == parc->height) { cent->lrustamp = ++lrustamp; lastCacheHit = cent; return cent->spdata; } if (cent->lrustamp < lruent->lrustamp) lruent = cent; } if (!cacheType) { cacheType = CreateNewResourceType(miFreeArcCache); (void) AddResource(FakeClientID(0), cacheType, NULL); } } else { lruent = &fakeent; lruent->spdata = NULL; *mustFree = TRUE; } k = (parc->height >> 1) + ((lw - 1) >> 1); spdata = lruent->spdata; if (!spdata || spdata->k != k) { if (spdata) free(spdata); spdata = (miArcSpanData *)malloc(sizeof(miArcSpanData) + sizeof(miArcSpan) * (k + 2)); lruent->spdata = spdata; if (!spdata) { lruent->lrustamp = 0; lruent->lw = 0; return spdata; } spdata->spans = (miArcSpan *)(spdata + 1); spdata->k = k; } spdata->top = !(lw & 1) && !(parc->width & 1); spdata->bot = !(parc->height & 1); lruent->lrustamp = ++lrustamp; lruent->lw = lw; lruent->width = parc->width; lruent->height = parc->height; if (lruent != &fakeent) lastCacheHit = lruent; if (parc->width == parc->height) miComputeCircleSpans(lw, parc, spdata); else miComputeEllipseSpans(lw, parc, spdata); return spdata; } static void miFillWideEllipse( DrawablePtr pDraw, GCPtr pGC, xArc *parc) { DDXPointPtr points; register DDXPointPtr pts; int *widths; register int *wids; miArcSpanData *spdata; Bool mustFree; register miArcSpan *span; register int xorg, yorgu, yorgl; register int n; yorgu = parc->height + pGC->lineWidth; n = (sizeof(int) * 2) * yorgu; widths = (int *)malloc(n + (sizeof(DDXPointRec) * 2) * yorgu); if (!widths) return; points = (DDXPointPtr)((char *)widths + n); spdata = miComputeWideEllipse((int)pGC->lineWidth, parc, &mustFree); if (!spdata) { free(widths); return; } pts = points; wids = widths; span = spdata->spans; xorg = parc->x + (parc->width >> 1); yorgu = parc->y + (parc->height >> 1); yorgl = yorgu + (parc->height & 1); if (pGC->miTranslate) { xorg += pDraw->x; yorgu += pDraw->y; yorgl += pDraw->y; } yorgu -= spdata->k; yorgl += spdata->k; if (spdata->top) { pts->x = xorg; pts->y = yorgu - 1; pts++; *wids++ = 1; span++; } for (n = spdata->count1; --n >= 0; ) { pts[0].x = xorg + span->lx; pts[0].y = yorgu; wids[0] = span->lw; pts[1].x = pts[0].x; pts[1].y = yorgl; wids[1] = wids[0]; yorgu++; yorgl--; pts += 2; wids += 2; span++; } if (spdata->hole) { pts[0].x = xorg; pts[0].y = yorgl; wids[0] = 1; pts++; wids++; } for (n = spdata->count2; --n >= 0; ) { pts[0].x = xorg + span->lx; pts[0].y = yorgu; wids[0] = span->lw; pts[1].x = xorg + span->rx; pts[1].y = pts[0].y; wids[1] = span->rw; pts[2].x = pts[0].x; pts[2].y = yorgl; wids[2] = wids[0]; pts[3].x = pts[1].x; pts[3].y = pts[2].y; wids[3] = wids[1]; yorgu++; yorgl--; pts += 4; wids += 4; span++; } if (spdata->bot) { if (span->rw <= 0) { pts[0].x = xorg + span->lx; pts[0].y = yorgu; wids[0] = span->lw; pts++; wids++; } else { pts[0].x = xorg + span->lx; pts[0].y = yorgu; wids[0] = span->lw; pts[1].x = xorg + span->rx; pts[1].y = pts[0].y; wids[1] = span->rw; pts += 2; wids += 2; } } if (mustFree) free(spdata); (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); free(widths); } /* * miPolyArc strategy: * * If arc is zero width and solid, we don't have to worry about the rasterop * or join styles. For wide solid circles, we use a fast integer algorithm. * For wide solid ellipses, we use special case floating point code. * Otherwise, we set up pDrawTo and pGCTo according to the rasterop, then * draw using pGCTo and pDrawTo. If the raster-op was "tricky," that is, * if it involves the destination, then we use PushPixels to move the bits * from the scratch drawable to pDraw. (See the wide line code for a * fuller explanation of this.) */ void miPolyArc(pDraw, pGC, narcs, parcs) DrawablePtr pDraw; GCPtr pGC; int narcs; xArc *parcs; { register int i; xArc *parc; int xMin, xMax, yMin, yMax; int pixmapWidth = 0, pixmapHeight = 0; int xOrg = 0, yOrg = 0; int width; Bool fTricky; DrawablePtr pDrawTo; CARD32 fg, bg; GCPtr pGCTo; miPolyArcPtr polyArcs; int cap[2], join[2]; int iphase; int halfWidth; width = pGC->lineWidth; if(width == 0 && pGC->lineStyle == LineSolid) { for(i = narcs, parc = parcs; --i >= 0; parc++) miArcSegment( pDraw, pGC, *parc, (miArcFacePtr) 0, (miArcFacePtr) 0 ); fillSpans (pDraw, pGC); } else { if ((pGC->lineStyle == LineSolid) && narcs) { while (parcs->width && parcs->height && (parcs->angle2 >= FULLCIRCLE || parcs->angle2 <= -FULLCIRCLE)) { miFillWideEllipse(pDraw, pGC, parcs); if (!--narcs) return; parcs++; } } /* Set up pDrawTo and pGCTo based on the rasterop */ switch(pGC->alu) { case GXclear: /* 0 */ case GXcopy: /* src */ case GXcopyInverted: /* NOT src */ case GXset: /* 1 */ fTricky = FALSE; pDrawTo = pDraw; pGCTo = pGC; break; default: fTricky = TRUE; /* find bounding box around arcs */ xMin = yMin = MAXSHORT; xMax = yMax = MINSHORT; for(i = narcs, parc = parcs; --i >= 0; parc++) { xMin = min (xMin, parc->x); yMin = min (yMin, parc->y); xMax = max (xMax, (parc->x + (int) parc->width)); yMax = max (yMax, (parc->y + (int) parc->height)); } /* expand box to deal with line widths */ halfWidth = (width + 1)/2; xMin -= halfWidth; yMin -= halfWidth; xMax += halfWidth; yMax += halfWidth; /* compute pixmap size; limit it to size of drawable */ xOrg = max(xMin, 0); yOrg = max(yMin, 0); pixmapWidth = min(xMax, pDraw->width) - xOrg; pixmapHeight = min(yMax, pDraw->height) - yOrg; /* if nothing left, return */ if ( (pixmapWidth <= 0) || (pixmapHeight <= 0) ) return; for(i = narcs, parc = parcs; --i >= 0; parc++) { parc->x -= xOrg; parc->y -= yOrg; } if (pGC->miTranslate) { xOrg += pDraw->x; yOrg += pDraw->y; } /* set up scratch GC */ pGCTo = GetScratchGC(1, pDraw->pScreen); if (!pGCTo) return; gcvals[GCValsFunction] = GXcopy; gcvals[GCValsForeground] = 1; gcvals[GCValsBackground] = 0; gcvals[GCValsLineWidth] = pGC->lineWidth; gcvals[GCValsCapStyle] = pGC->capStyle; gcvals[GCValsJoinStyle] = pGC->joinStyle; dixChangeGC(NullClient, pGCTo, GCValsMask, gcvals, NULL); /* allocate a 1 bit deep pixmap of the appropriate size, and * validate it */ pDrawTo = (DrawablePtr)(*pDraw->pScreen->CreatePixmap) (pDraw->pScreen, pixmapWidth, pixmapHeight, 1, CREATE_PIXMAP_USAGE_SCRATCH); if (!pDrawTo) { FreeScratchGC(pGCTo); return; } ValidateGC(pDrawTo, pGCTo); miClearDrawable(pDrawTo, pGCTo); } fg = pGC->fgPixel; bg = pGC->bgPixel; if ((pGC->fillStyle == FillTiled) || (pGC->fillStyle == FillOpaqueStippled)) bg = fg; /* the protocol sez these don't cause color changes */ polyArcs = miComputeArcs (parcs, narcs, pGC); if (!polyArcs) { if (fTricky) { (*pDraw->pScreen->DestroyPixmap) ((PixmapPtr)pDrawTo); FreeScratchGC (pGCTo); } return; } cap[0] = cap[1] = 0; join[0] = join[1] = 0; for (iphase = ((pGC->lineStyle == LineDoubleDash) ? 1 : 0); iphase >= 0; iphase--) { if (iphase == 1) { dixChangeGC (NullClient, pGC, GCForeground, &bg, NULL); ValidateGC (pDraw, pGC); } else if (pGC->lineStyle == LineDoubleDash) { dixChangeGC (NullClient, pGC, GCForeground, &fg, NULL); ValidateGC (pDraw, pGC); } for (i = 0; i < polyArcs[iphase].narcs; i++) { miArcDataPtr arcData; arcData = &polyArcs[iphase].arcs[i]; miArcSegment(pDrawTo, pGCTo, arcData->arc, &arcData->bounds[RIGHT_END], &arcData->bounds[LEFT_END]); if (polyArcs[iphase].arcs[i].render) { fillSpans (pDrawTo, pGCTo); /* * don't cap self-joining arcs */ if (polyArcs[iphase].arcs[i].selfJoin && cap[iphase] < polyArcs[iphase].arcs[i].cap) cap[iphase]++; while (cap[iphase] < polyArcs[iphase].arcs[i].cap) { int arcIndex, end; miArcDataPtr arcData0; arcIndex = polyArcs[iphase].caps[cap[iphase]].arcIndex; end = polyArcs[iphase].caps[cap[iphase]].end; arcData0 = &polyArcs[iphase].arcs[arcIndex]; miArcCap (pDrawTo, pGCTo, &arcData0->bounds[end], end, arcData0->arc.x, arcData0->arc.y, (double) arcData0->arc.width / 2.0, (double) arcData0->arc.height / 2.0); ++cap[iphase]; } while (join[iphase] < polyArcs[iphase].arcs[i].join) { int arcIndex0, arcIndex1, end0, end1; int phase0, phase1; miArcDataPtr arcData0, arcData1; miArcJoinPtr joinp; joinp = &polyArcs[iphase].joins[join[iphase]]; arcIndex0 = joinp->arcIndex0; end0 = joinp->end0; arcIndex1 = joinp->arcIndex1; end1 = joinp->end1; phase0 = joinp->phase0; phase1 = joinp->phase1; arcData0 = &polyArcs[phase0].arcs[arcIndex0]; arcData1 = &polyArcs[phase1].arcs[arcIndex1]; miArcJoin (pDrawTo, pGCTo, &arcData0->bounds[end0], &arcData1->bounds[end1], arcData0->arc.x, arcData0->arc.y, (double) arcData0->arc.width / 2.0, (double) arcData0->arc.height / 2.0, arcData1->arc.x, arcData1->arc.y, (double) arcData1->arc.width / 2.0, (double) arcData1->arc.height / 2.0); ++join[iphase]; } if (fTricky) { if (pGC->serialNumber != pDraw->serialNumber) ValidateGC (pDraw, pGC); (*pGC->ops->PushPixels) (pGC, (PixmapPtr)pDrawTo, pDraw, pixmapWidth, pixmapHeight, xOrg, yOrg); miClearDrawable ((DrawablePtr) pDrawTo, pGCTo); } } } } miFreeArcs(polyArcs, pGC); if(fTricky) { (*pGCTo->pScreen->DestroyPixmap)((PixmapPtr)pDrawTo); FreeScratchGC(pGCTo); } } } static double angleBetween (SppPointRec center, SppPointRec point1, SppPointRec point2) { double a1, a2, a; /* * reflect from X coordinates back to ellipse * coordinates -- y increasing upwards */ a1 = miDatan2 (- (point1.y - center.y), point1.x - center.x); a2 = miDatan2 (- (point2.y - center.y), point2.x - center.x); a = a2 - a1; if (a <= -180.0) a += 360.0; else if (a > 180.0) a -= 360.0; return a; } static void translateBounds ( miArcFacePtr b, int x, int y, double fx, double fy) { fx += x; fy += y; b->clock.x -= fx; b->clock.y -= fy; b->center.x -= fx; b->center.y -= fy; b->counterClock.x -= fx; b->counterClock.y -= fy; } static void miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft, miArcFacePtr pRight, int xOrgLeft, int yOrgLeft, double xFtransLeft, double yFtransLeft, int xOrgRight, int yOrgRight, double xFtransRight, double yFtransRight) { SppPointRec center, corner, otherCorner; SppPointRec poly[5], e; SppPointPtr pArcPts; int cpt; SppArcRec arc; miArcFaceRec Right, Left; int polyLen = 0; int xOrg, yOrg; double xFtrans, yFtrans; double a; double ae, ac2, ec2, bc2, de; double width; xOrg = (xOrgRight + xOrgLeft) / 2; yOrg = (yOrgRight + yOrgLeft) / 2; xFtrans = (xFtransLeft + xFtransRight) / 2; yFtrans = (yFtransLeft + yFtransRight) / 2; Right = *pRight; translateBounds (&Right, xOrg - xOrgRight, yOrg - yOrgRight, xFtrans - xFtransRight, yFtrans - yFtransRight); Left = *pLeft; translateBounds (&Left, xOrg - xOrgLeft, yOrg - yOrgLeft, xFtrans - xFtransLeft, yFtrans - yFtransLeft); pRight = &Right; pLeft = &Left; if (pRight->clock.x == pLeft->counterClock.x && pRight->clock.y == pLeft->counterClock.y) return; center = pRight->center; if (0 <= (a = angleBetween (center, pRight->clock, pLeft->counterClock)) && a <= 180.0) { corner = pRight->clock; otherCorner = pLeft->counterClock; } else { a = angleBetween (center, pLeft->clock, pRight->counterClock); corner = pLeft->clock; otherCorner = pRight->counterClock; } switch (pGC->joinStyle) { case JoinRound: width = (pGC->lineWidth ? (double)pGC->lineWidth : (double)1); arc.x = center.x - width/2; arc.y = center.y - width/2; arc.width = width; arc.height = width; arc.angle1 = -miDatan2 (corner.y - center.y, corner.x - center.x); arc.angle2 = a; pArcPts = (SppPointPtr) malloc (3 * sizeof (SppPointRec)); if (!pArcPts) return; pArcPts[0].x = otherCorner.x; pArcPts[0].y = otherCorner.y; pArcPts[1].x = center.x; pArcPts[1].y = center.y; pArcPts[2].x = corner.x; pArcPts[2].y = corner.y; if( (cpt = miGetArcPts(&arc, 3, &pArcPts)) ) { /* by drawing with miFillSppPoly and setting the endpoints of the arc * to be the corners, we assure that the cap will meet up with the * rest of the line */ miFillSppPoly(pDraw, pGC, cpt, pArcPts, xOrg, yOrg, xFtrans, yFtrans); } free(pArcPts); return; case JoinMiter: /* * don't miter arcs with less than 11 degrees between them */ if (a < 169.0) { poly[0] = corner; poly[1] = center; poly[2] = otherCorner; bc2 = (corner.x - otherCorner.x) * (corner.x - otherCorner.x) + (corner.y - otherCorner.y) * (corner.y - otherCorner.y); ec2 = bc2 / 4; ac2 = (corner.x - center.x) * (corner.x - center.x) + (corner.y - center.y) * (corner.y - center.y); ae = sqrt (ac2 - ec2); de = ec2 / ae; e.x = (corner.x + otherCorner.x) / 2; e.y = (corner.y + otherCorner.y) / 2; poly[3].x = e.x + de * (e.x - center.x) / ae; poly[3].y = e.y + de * (e.y - center.y) / ae; poly[4] = corner; polyLen = 5; break; } case JoinBevel: poly[0] = corner; poly[1] = center; poly[2] = otherCorner; poly[3] = corner; polyLen = 4; break; } miFillSppPoly (pDraw, pGC, polyLen, poly, xOrg, yOrg, xFtrans, yFtrans); } /*ARGSUSED*/ static void miArcCap ( DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pFace, int end, int xOrg, int yOrg, double xFtrans, double yFtrans) { SppPointRec corner, otherCorner, center, endPoint, poly[5]; corner = pFace->clock; otherCorner = pFace->counterClock; center = pFace->center; switch (pGC->capStyle) { case CapProjecting: poly[0].x = otherCorner.x; poly[0].y = otherCorner.y; poly[1].x = corner.x; poly[1].y = corner.y; poly[2].x = corner.x - (center.y - corner.y); poly[2].y = corner.y + (center.x - corner.x); poly[3].x = otherCorner.x - (otherCorner.y - center.y); poly[3].y = otherCorner.y + (otherCorner.x - center.x); poly[4].x = otherCorner.x; poly[4].y = otherCorner.y; miFillSppPoly (pDraw, pGC, 5, poly, xOrg, yOrg, xFtrans, yFtrans); break; case CapRound: /* * miRoundCap just needs these to be unequal. */ endPoint = center; endPoint.x = endPoint.x + 100; miRoundCap (pDraw, pGC, center, endPoint, corner, otherCorner, 0, -xOrg, -yOrg, xFtrans, yFtrans); break; } } /* MIROUNDCAP -- a private helper function * Put Rounded cap on end. pCenter is the center of this end of the line * pEnd is the center of the other end of the line. pCorner is one of the * two corners at this end of the line. * NOTE: pOtherCorner must be counter-clockwise from pCorner. */ /*ARGSUSED*/ static void miRoundCap( DrawablePtr pDraw, GCPtr pGC, SppPointRec pCenter, SppPointRec pEnd, SppPointRec pCorner, SppPointRec pOtherCorner, int fLineEnd, int xOrg, int yOrg, double xFtrans, double yFtrans) { int cpt; double width; SppArcRec arc; SppPointPtr pArcPts; width = (pGC->lineWidth ? (double)pGC->lineWidth : (double)1); arc.x = pCenter.x - width/2; arc.y = pCenter.y - width/2; arc.width = width; arc.height = width; arc.angle1 = -miDatan2 (pCorner.y - pCenter.y, pCorner.x - pCenter.x); if(PTISEQUAL(pCenter, pEnd)) arc.angle2 = - 180.0; else { arc.angle2 = -miDatan2 (pOtherCorner.y - pCenter.y, pOtherCorner.x - pCenter.x) - arc.angle1; if (arc.angle2 < 0) arc.angle2 += 360.0; } pArcPts = (SppPointPtr) NULL; if( (cpt = miGetArcPts(&arc, 0, &pArcPts)) ) { /* by drawing with miFillSppPoly and setting the endpoints of the arc * to be the corners, we assure that the cap will meet up with the * rest of the line */ miFillSppPoly(pDraw, pGC, cpt, pArcPts, -xOrg, -yOrg, xFtrans, yFtrans); } free(pArcPts); } /* * To avoid inaccuracy at the cardinal points, use trig functions * which are exact for those angles */ #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #ifndef M_PI_2 #define M_PI_2 1.57079632679489661923 #endif # define Dsin(d) ((d) == 0.0 ? 0.0 : ((d) == 90.0 ? 1.0 : sin(d*M_PI/180.0))) # define Dcos(d) ((d) == 0.0 ? 1.0 : ((d) == 90.0 ? 0.0 : cos(d*M_PI/180.0))) # define mod(a,b) ((a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) static double miDcos (double a) { int i; if (floor (a/90) == a/90) { i = (int) (a/90.0); switch (mod (i, 4)) { case 0: return 1; case 1: return 0; case 2: return -1; case 3: return 0; } } return cos (a * M_PI / 180.0); } static double miDsin (double a) { int i; if (floor (a/90) == a/90) { i = (int) (a/90.0); switch (mod (i, 4)) { case 0: return 0; case 1: return 1; case 2: return 0; case 3: return -1; } } return sin (a * M_PI / 180.0); } static double miDasin (double v) { if (v == 0) return 0.0; if (v == 1.0) return 90.0; if (v == -1.0) return -90.0; return asin(v) * (180.0 / M_PI); } static double miDatan2 (double dy, double dx) { if (dy == 0) { if (dx >= 0) return 0.0; return 180.0; } else if (dx == 0) { if (dy > 0) return 90.0; return -90.0; } else if (Fabs (dy) == Fabs (dx)) { if (dy > 0) { if (dx > 0) return 45.0; return 135.0; } else { if (dx > 0) return 315.0; return 225.0; } } else { return atan2 (dy, dx) * (180.0 / M_PI); } } /* MIGETARCPTS -- Converts an arc into a set of line segments -- a helper * routine for filled arc and line (round cap) code. * Returns the number of points in the arc. Note that it takes a pointer * to a pointer to where it should put the points and an index (cpt). * This procedure allocates the space necessary to fit the arc points. * Sometimes it's convenient for those points to be at the end of an existing * array. (For example, if we want to leave a spare point to make sectors * instead of segments.) So we pass in the malloc()ed chunk that contains the * array and an index saying where we should start stashing the points. * If there isn't an array already, we just pass in a null pointer and * count on realloc() to handle the null pointer correctly. */ static int miGetArcPts( SppArcPtr parc, /* points to an arc */ int cpt, /* number of points already in arc list */ SppPointPtr *ppPts) /* pointer to pointer to arc-list -- modified */ { double st, /* Start Theta, start angle */ et, /* End Theta, offset from start theta */ dt, /* Delta Theta, angle to sweep ellipse */ cdt, /* Cos Delta Theta, actually 2 cos(dt) */ x0, y0, /* the recurrence formula needs two points to start */ x1, y1, x2, y2, /* this will be the new point generated */ xc, yc; /* the center point */ int count, i; SppPointPtr poly; /* The spec says that positive angles indicate counterclockwise motion. * Given our coordinate system (with 0,0 in the upper left corner), * the screen appears flipped in Y. The easiest fix is to negate the * angles given */ st = - parc->angle1; et = - parc->angle2; /* Try to get a delta theta that is within 1/2 pixel. Then adjust it * so that it divides evenly into the total. * I'm just using cdt 'cause I'm lazy. */ cdt = parc->width; if (parc->height > cdt) cdt = parc->height; cdt /= 2.0; if(cdt <= 0) return 0; if (cdt < 1.0) cdt = 1.0; dt = miDasin ( 1.0 / cdt ); /* minimum step necessary */ count = et/dt; count = abs(count) + 1; dt = et/count; count++; cdt = 2 * miDcos(dt); if (!(poly = (SppPointPtr) realloc((void *)*ppPts, (cpt + count) * sizeof(SppPointRec)))) return(0); *ppPts = poly; xc = parc->width/2.0; /* store half width and half height */ yc = parc->height/2.0; x0 = xc * miDcos(st); y0 = yc * miDsin(st); x1 = xc * miDcos(st + dt); y1 = yc * miDsin(st + dt); xc += parc->x; /* by adding initial point, these become */ yc += parc->y; /* the center point */ poly[cpt].x = (xc + x0); poly[cpt].y = (yc + y0); poly[cpt + 1].x = (xc + x1); poly[cpt + 1].y = (yc + y1); for(i = 2; i < count; i++) { x2 = cdt * x1 - x0; y2 = cdt * y1 - y0; poly[cpt + i].x = (xc + x2); poly[cpt + i].y = (yc + y2); x0 = x1; y0 = y1; x1 = x2; y1 = y2; } /* adjust the last point */ if (abs(parc->angle2) >= 360.0) poly[cpt +i -1] = poly[0]; else { poly[cpt +i -1].x = (miDcos(st + et) * parc->width/2.0 + xc); poly[cpt +i -1].y = (miDsin(st + et) * parc->height/2.0 + yc); } return(count); } struct arcData { double x0, y0, x1, y1; int selfJoin; }; # define ADD_REALLOC_STEP 20 static void addCap ( miArcCapPtr *capsp, int *ncapsp, int *sizep, int end, int arcIndex) { int newsize; miArcCapPtr cap; if (*ncapsp == *sizep) { newsize = *sizep + ADD_REALLOC_STEP; cap = (miArcCapPtr) realloc (*capsp, newsize * sizeof (**capsp)); if (!cap) return; *sizep = newsize; *capsp = cap; } cap = &(*capsp)[*ncapsp]; cap->end = end; cap->arcIndex = arcIndex; ++*ncapsp; } static void addJoin ( miArcJoinPtr *joinsp, int *njoinsp, int *sizep, int end0, int index0, int phase0, int end1, int index1, int phase1) { int newsize; miArcJoinPtr join; if (*njoinsp == *sizep) { newsize = *sizep + ADD_REALLOC_STEP; join = (miArcJoinPtr) realloc (*joinsp, newsize * sizeof (**joinsp)); if (!join) return; *sizep = newsize; *joinsp = join; } join = &(*joinsp)[*njoinsp]; join->end0 = end0; join->arcIndex0 = index0; join->phase0 = phase0; join->end1 = end1; join->arcIndex1 = index1; join->phase1 = phase1; ++*njoinsp; } static miArcDataPtr addArc ( miArcDataPtr *arcsp, int *narcsp, int *sizep, xArc *xarc) { int newsize; miArcDataPtr arc; if (*narcsp == *sizep) { newsize = *sizep + ADD_REALLOC_STEP; arc = (miArcDataPtr) realloc (*arcsp, newsize * sizeof (**arcsp)); if (!arc) return (miArcDataPtr)NULL; *sizep = newsize; *arcsp = arc; } arc = &(*arcsp)[*narcsp]; arc->arc = *xarc; ++*narcsp; return arc; } static void miFreeArcs( miPolyArcPtr arcs, GCPtr pGC) { int iphase; for (iphase = ((pGC->lineStyle == LineDoubleDash) ? 1 : 0); iphase >= 0; iphase--) { if (arcs[iphase].narcs > 0) free(arcs[iphase].arcs); if (arcs[iphase].njoins > 0) free(arcs[iphase].joins); if (arcs[iphase].ncaps > 0) free(arcs[iphase].caps); } free(arcs); } /* * map angles to radial distance. This only deals with the first quadrant */ /* * a polygonal approximation to the arc for computing arc lengths */ # define DASH_MAP_SIZE 91 # define dashIndexToAngle(di) ((((double) (di)) * 90.0) / ((double) DASH_MAP_SIZE - 1)) # define xAngleToDashIndex(xa) ((((long) (xa)) * (DASH_MAP_SIZE - 1)) / (90 * 64)) # define dashIndexToXAngle(di) ((((long) (di)) * (90 * 64)) / (DASH_MAP_SIZE - 1)) # define dashXAngleStep (((double) (90 * 64)) / ((double) (DASH_MAP_SIZE - 1))) typedef struct { double map[DASH_MAP_SIZE]; } dashMap; static int computeAngleFromPath(int startAngle, int endAngle, dashMap *map, int *lenp, int backwards); static void computeDashMap ( xArc *arcp, dashMap *map) { int di; double a, x, y, prevx = 0.0, prevy = 0.0, dist; for (di = 0; di < DASH_MAP_SIZE; di++) { a = dashIndexToAngle (di); x = ((double) arcp->width / 2.0) * miDcos (a); y = ((double) arcp->height / 2.0) * miDsin (a); if (di == 0) { map->map[di] = 0.0; } else { dist = hypot (x - prevx, y - prevy); map->map[di] = map->map[di - 1] + dist; } prevx = x; prevy = y; } } typedef enum {HORIZONTAL, VERTICAL, OTHER} arcTypes; /* this routine is a bit gory */ static miPolyArcPtr miComputeArcs ( xArc *parcs, int narcs, GCPtr pGC) { int isDashed, isDoubleDash; int dashOffset; miPolyArcPtr arcs; int start, i, j, k = 0, nexti, nextk = 0; int joinSize[2]; int capSize[2]; int arcSize[2]; int angle2; double a0, a1; struct arcData *data; miArcDataPtr arc; xArc xarc; int iphase, prevphase = 0, joinphase; int arcsJoin; int selfJoin; int iDash = 0, dashRemaining = 0; int iDashStart = 0, dashRemainingStart = 0, iphaseStart; int startAngle, spanAngle, endAngle, backwards = 0; int prevDashAngle, dashAngle; dashMap map; isDashed = !(pGC->lineStyle == LineSolid); isDoubleDash = (pGC->lineStyle == LineDoubleDash); dashOffset = pGC->dashOffset; data = (struct arcData *) malloc (narcs * sizeof (struct arcData)); if (!data) return (miPolyArcPtr)NULL; arcs = (miPolyArcPtr) malloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1)); if (!arcs) { free(data); return (miPolyArcPtr)NULL; } for (i = 0; i < narcs; i++) { a0 = todeg (parcs[i].angle1); angle2 = parcs[i].angle2; if (angle2 > FULLCIRCLE) angle2 = FULLCIRCLE; else if (angle2 < -FULLCIRCLE) angle2 = -FULLCIRCLE; data[i].selfJoin = angle2 == FULLCIRCLE || angle2 == -FULLCIRCLE; a1 = todeg (parcs[i].angle1 + angle2); data[i].x0 = parcs[i].x + (double) parcs[i].width / 2 * (1 + miDcos (a0)); data[i].y0 = parcs[i].y + (double) parcs[i].height / 2 * (1 - miDsin (a0)); data[i].x1 = parcs[i].x + (double) parcs[i].width / 2 * (1 + miDcos (a1)); data[i].y1 = parcs[i].y + (double) parcs[i].height / 2 * (1 - miDsin (a1)); } for (iphase = 0; iphase < (isDoubleDash ? 2 : 1); iphase++) { arcs[iphase].njoins = 0; arcs[iphase].joins = 0; joinSize[iphase] = 0; arcs[iphase].ncaps = 0; arcs[iphase].caps = 0; capSize[iphase] = 0; arcs[iphase].narcs = 0; arcs[iphase].arcs = 0; arcSize[iphase] = 0; } iphase = 0; if (isDashed) { iDash = 0; dashRemaining = pGC->dash[0]; while (dashOffset > 0) { if (dashOffset >= dashRemaining) { dashOffset -= dashRemaining; iphase = iphase ? 0 : 1; iDash++; if (iDash == pGC->numInDashList) iDash = 0; dashRemaining = pGC->dash[iDash]; } else { dashRemaining -= dashOffset; dashOffset = 0; } } iDashStart = iDash; dashRemainingStart = dashRemaining; } iphaseStart = iphase; for (i = narcs - 1; i >= 0; i--) { j = i + 1; if (j == narcs) j = 0; if (data[i].selfJoin || i == j || (UNEQUAL (data[i].x1, data[j].x0) || UNEQUAL (data[i].y1, data[j].y0))) { if (iphase == 0 || isDoubleDash) addCap (&arcs[iphase].caps, &arcs[iphase].ncaps, &capSize[iphase], RIGHT_END, 0); break; } } start = i + 1; if (start == narcs) start = 0; i = start; for (;;) { j = i + 1; if (j == narcs) j = 0; nexti = i+1; if (nexti == narcs) nexti = 0; if (isDashed) { /* ** deal with dashed arcs. Use special rules for certain 0 area arcs. ** Presumably, the other 0 area arcs still aren't done right. */ arcTypes arcType = OTHER; CARD16 thisLength; if (parcs[i].height == 0 && (parcs[i].angle1 % FULLCIRCLE) == 0x2d00 && parcs[i].angle2 == 0x2d00) arcType = HORIZONTAL; else if (parcs[i].width == 0 && (parcs[i].angle1 % FULLCIRCLE) == 0x1680 && parcs[i].angle2 == 0x2d00) arcType = VERTICAL; if (arcType == OTHER) { /* * precompute an approximation map */ computeDashMap (&parcs[i], &map); /* * compute each individual dash segment using the path * length function */ startAngle = parcs[i].angle1; spanAngle = parcs[i].angle2; if (spanAngle > FULLCIRCLE) spanAngle = FULLCIRCLE; else if (spanAngle < -FULLCIRCLE) spanAngle = -FULLCIRCLE; if (startAngle < 0) startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE; if (startAngle >= FULLCIRCLE) startAngle = startAngle % FULLCIRCLE; endAngle = startAngle + spanAngle; backwards = spanAngle < 0; } else { xarc = parcs[i]; if (arcType == VERTICAL) { xarc.angle1 = 0x1680; startAngle = parcs[i].y; endAngle = startAngle + parcs[i].height; } else { xarc.angle1 = 0x2d00; startAngle = parcs[i].x; endAngle = startAngle + parcs[i].width; } } dashAngle = startAngle; selfJoin = data[i].selfJoin && (iphase == 0 || isDoubleDash); /* * add dashed arcs to each bucket */ arc = 0; while (dashAngle != endAngle) { prevDashAngle = dashAngle; if (arcType == OTHER) { dashAngle = computeAngleFromPath (prevDashAngle, endAngle, &map, &dashRemaining, backwards); /* avoid troubles with huge arcs and small dashes */ if (dashAngle == prevDashAngle) { if (backwards) dashAngle--; else dashAngle++; } } else { thisLength = (dashAngle + dashRemaining <= endAngle) ? dashRemaining : endAngle - dashAngle; if (arcType == VERTICAL) { xarc.y = dashAngle; xarc.height = thisLength; } else { xarc.x = dashAngle; xarc.width = thisLength; } dashAngle += thisLength; dashRemaining -= thisLength; } if (iphase == 0 || isDoubleDash) { if (arcType == OTHER) { xarc = parcs[i]; spanAngle = prevDashAngle; if (spanAngle < 0) spanAngle = FULLCIRCLE - (-spanAngle) % FULLCIRCLE; if (spanAngle >= FULLCIRCLE) spanAngle = spanAngle % FULLCIRCLE; xarc.angle1 = spanAngle; spanAngle = dashAngle - prevDashAngle; if (backwards) { if (dashAngle > prevDashAngle) spanAngle = - FULLCIRCLE + spanAngle; } else { if (dashAngle < prevDashAngle) spanAngle = FULLCIRCLE + spanAngle; } if (spanAngle > FULLCIRCLE) spanAngle = FULLCIRCLE; if (spanAngle < -FULLCIRCLE) spanAngle = -FULLCIRCLE; xarc.angle2 = spanAngle; } arc = addArc (&arcs[iphase].arcs, &arcs[iphase].narcs, &arcSize[iphase], &xarc); if (!arc) goto arcfail; /* * cap each end of an on/off dash */ if (!isDoubleDash) { if (prevDashAngle != startAngle) { addCap (&arcs[iphase].caps, &arcs[iphase].ncaps, &capSize[iphase], RIGHT_END, arc - arcs[iphase].arcs); } if (dashAngle != endAngle) { addCap (&arcs[iphase].caps, &arcs[iphase].ncaps, &capSize[iphase], LEFT_END, arc - arcs[iphase].arcs); } } arc->cap = arcs[iphase].ncaps; arc->join = arcs[iphase].njoins; arc->render = 0; arc->selfJoin = 0; if (dashAngle == endAngle) arc->selfJoin = selfJoin; } prevphase = iphase; if (dashRemaining <= 0) { ++iDash; if (iDash == pGC->numInDashList) iDash = 0; iphase = iphase ? 0:1; dashRemaining = pGC->dash[iDash]; } } /* * make sure a place exists for the position data when * drawing a zero-length arc */ if (startAngle == endAngle) { prevphase = iphase; if (!isDoubleDash && iphase == 1) prevphase = 0; arc = addArc (&arcs[prevphase].arcs, &arcs[prevphase].narcs, &arcSize[prevphase], &parcs[i]); if (!arc) goto arcfail; arc->join = arcs[prevphase].njoins; arc->cap = arcs[prevphase].ncaps; arc->selfJoin = data[i].selfJoin; } } else { arc = addArc (&arcs[iphase].arcs, &arcs[iphase].narcs, &arcSize[iphase], &parcs[i]); if (!arc) goto arcfail; arc->join = arcs[iphase].njoins; arc->cap = arcs[iphase].ncaps; arc->selfJoin = data[i].selfJoin; prevphase = iphase; } if (prevphase == 0 || isDoubleDash) k = arcs[prevphase].narcs - 1; if (iphase == 0 || isDoubleDash) nextk = arcs[iphase].narcs; if (nexti == start) { nextk = 0; if (isDashed) { iDash = iDashStart; iphase = iphaseStart; dashRemaining = dashRemainingStart; } } arcsJoin = narcs > 1 && i != j && ISEQUAL (data[i].x1, data[j].x0) && ISEQUAL (data[i].y1, data[j].y0) && !data[i].selfJoin && !data[j].selfJoin; if (arc) { if (arcsJoin) arc->render = 0; else arc->render = 1; } if (arcsJoin && (prevphase == 0 || isDoubleDash) && (iphase == 0 || isDoubleDash)) { joinphase = iphase; if (isDoubleDash) { if (nexti == start) joinphase = iphaseStart; /* * if the join is right at the dash, * draw the join in foreground * This is because the foreground * arcs are computed second, the results * of which are needed to draw the join */ if (joinphase != prevphase) joinphase = 0; } if (joinphase == 0 || isDoubleDash) { addJoin (&arcs[joinphase].joins, &arcs[joinphase].njoins, &joinSize[joinphase], LEFT_END, k, prevphase, RIGHT_END, nextk, iphase); arc->join = arcs[prevphase].njoins; } } else { /* * cap the left end of this arc * unless it joins itself */ if ((prevphase == 0 || isDoubleDash) && !arc->selfJoin) { addCap (&arcs[prevphase].caps, &arcs[prevphase].ncaps, &capSize[prevphase], LEFT_END, k); arc->cap = arcs[prevphase].ncaps; } if (isDashed && !arcsJoin) { iDash = iDashStart; iphase = iphaseStart; dashRemaining = dashRemainingStart; } nextk = arcs[iphase].narcs; if (nexti == start) { nextk = 0; iDash = iDashStart; iphase = iphaseStart; dashRemaining = dashRemainingStart; } /* * cap the right end of the next arc. If the * next arc is actually the first arc, only * cap it if it joins with this arc. This * case will occur when the final dash segment * of an on/off dash is off. Of course, this * cap will be drawn at a strange time, but that * hardly matters... */ if ((iphase == 0 || isDoubleDash) && (nexti != start || (arcsJoin && isDashed))) addCap (&arcs[iphase].caps, &arcs[iphase].ncaps, &capSize[iphase], RIGHT_END, nextk); } i = nexti; if (i == start) break; } /* * make sure the last section is rendered */ for (iphase = 0; iphase < (isDoubleDash ? 2 : 1); iphase++) if (arcs[iphase].narcs > 0) { arcs[iphase].arcs[arcs[iphase].narcs-1].render = 1; arcs[iphase].arcs[arcs[iphase].narcs-1].join = arcs[iphase].njoins; arcs[iphase].arcs[arcs[iphase].narcs-1].cap = arcs[iphase].ncaps; } free(data); return arcs; arcfail: miFreeArcs(arcs, pGC); free(data); return (miPolyArcPtr)NULL; } static double angleToLength ( int angle, dashMap *map) { double len, excesslen, sidelen = map->map[DASH_MAP_SIZE - 1], totallen; int di; int excess; Bool oddSide = FALSE; totallen = 0; if (angle >= 0) { while (angle >= 90 * 64) { angle -= 90 * 64; totallen += sidelen; oddSide = !oddSide; } } else { while (angle < 0) { angle += 90 * 64; totallen -= sidelen; oddSide = !oddSide; } } if (oddSide) angle = 90 * 64 - angle; di = xAngleToDashIndex (angle); excess = angle - dashIndexToXAngle (di); len = map->map[di]; /* * linearly interpolate between this point and the next */ if (excess > 0) { excesslen = (map->map[di + 1] - map->map[di]) * ((double) excess) / dashXAngleStep; len += excesslen; } if (oddSide) totallen += (sidelen - len); else totallen += len; return totallen; } /* * len is along the arc, but may be more than one rotation */ static int lengthToAngle ( double len, dashMap *map) { double sidelen = map->map[DASH_MAP_SIZE - 1]; int angle, angleexcess; Bool oddSide = FALSE; int a0, a1, a; angle = 0; /* * step around the ellipse, subtracting sidelens and * adding 90 degrees. oddSide will tell if the * map should be interpolated in reverse */ if (len >= 0) { if (sidelen == 0) return 2 * FULLCIRCLE; /* infinity */ while (len >= sidelen) { angle += 90 * 64; len -= sidelen; oddSide = !oddSide; } } else { if (sidelen == 0) return -2 * FULLCIRCLE; /* infinity */ while (len < 0) { angle -= 90 * 64; len += sidelen; oddSide = !oddSide; } } if (oddSide) len = sidelen - len; a0 = 0; a1 = DASH_MAP_SIZE - 1; /* * binary search for the closest pre-computed length */ while (a1 - a0 > 1) { a = (a0 + a1) / 2; if (len > map->map[a]) a0 = a; else a1 = a; } angleexcess = dashIndexToXAngle (a0); /* * linearly interpolate to the next point */ angleexcess += (len - map->map[a0]) / (map->map[a0+1] - map->map[a0]) * dashXAngleStep; if (oddSide) angle += (90 * 64) - angleexcess; else angle += angleexcess; return angle; } /* * compute the angle of an ellipse which cooresponds to * the given path length. Note that the correct solution * to this problem is an eliptic integral, we'll punt and * approximate (it's only for dashes anyway). This * approximation uses a polygon. * * The remaining portion of len is stored in *lenp - * this will be negative if the arc extends beyond * len and positive if len extends beyond the arc. */ static int computeAngleFromPath ( int startAngle, int endAngle, /* normalized absolute angles in *64 degrees */ dashMap *map, int *lenp, int backwards) { int a0, a1, a; double len0; int len; a0 = startAngle; a1 = endAngle; len = *lenp; if (backwards) { /* * flip the problem around to always be * forwards */ a0 = FULLCIRCLE - a0; a1 = FULLCIRCLE - a1; } if (a1 < a0) a1 += FULLCIRCLE; len0 = angleToLength (a0, map); a = lengthToAngle (len0 + len, map); if (a > a1) { a = a1; len -= angleToLength (a1, map) - len0; } else len = 0; if (backwards) a = FULLCIRCLE - a; *lenp = len; return a; } /* * scan convert wide arcs. */ /* * draw zero width/height arcs */ static void drawZeroArc ( DrawablePtr pDraw, GCPtr pGC, xArc *tarc, int lw, miArcFacePtr left, miArcFacePtr right) { double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0, w, h, x, y; double xmax, ymax, xmin, ymin; int a0, a1; double a, startAngle, endAngle; double l, lx, ly; l = lw / 2.0; a0 = tarc->angle1; a1 = tarc->angle2; if (a1 > FULLCIRCLE) a1 = FULLCIRCLE; else if (a1 < -FULLCIRCLE) a1 = -FULLCIRCLE; w = (double)tarc->width / 2.0; h = (double)tarc->height / 2.0; /* * play in X coordinates right away */ startAngle = - ((double) a0 / 64.0); endAngle = - ((double) (a0 + a1) / 64.0); xmax = -w; xmin = w; ymax = -h; ymin = h; a = startAngle; for (;;) { x = w * miDcos(a); y = h * miDsin(a); if (a == startAngle) { x0 = x; y0 = y; } if (a == endAngle) { x1 = x; y1 = y; } if (x > xmax) xmax = x; if (x < xmin) xmin = x; if (y > ymax) ymax = y; if (y < ymin) ymin = y; if (a == endAngle) break; if (a1 < 0) /* clockwise */ { if (floor (a / 90.0) == floor (endAngle / 90.0)) a = endAngle; else a = 90 * (floor (a/90.0) + 1); } else { if (ceil (a / 90.0) == ceil (endAngle / 90.0)) a = endAngle; else a = 90 * (ceil (a/90.0) - 1); } } lx = ly = l; if ((x1 - x0) + (y1 - y0) < 0) lx = ly = -l; if (h) { ly = 0.0; lx = -lx; } else lx = 0.0; if (right) { right->center.x = x0; right->center.y = y0; right->clock.x = x0 - lx; right->clock.y = y0 - ly; right->counterClock.x = x0 + lx; right->counterClock.y = y0 + ly; } if (left) { left->center.x = x1; left->center.y = y1; left->clock.x = x1 + lx; left->clock.y = y1 + ly; left->counterClock.x = x1 - lx; left->counterClock.y = y1 - ly; } x0 = xmin; x1 = xmax; y0 = ymin; y1 = ymax; if (ymin != y1) { xmin = -l; xmax = l; } else { ymin = -l; ymax = l; } if (xmax != xmin && ymax != ymin) { int minx, maxx, miny, maxy; xRectangle rect; minx = ICEIL (xmin + w) + tarc->x; maxx = ICEIL (xmax + w) + tarc->x; miny = ICEIL (ymin + h) + tarc->y; maxy = ICEIL (ymax + h) + tarc->y; rect.x = minx; rect.y = miny; rect.width = maxx - minx; rect.height = maxy - miny; (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &rect); } } /* * this computes the ellipse y value associated with the * bottom of the tail. */ static void tailEllipseY ( struct arc_def *def, struct accelerators *acc) { double t; acc->tail_y = 0.0; if (def->w == def->h) return; t = def->l * def->w; if (def->w > def->h) { if (t < acc->h2) return; } else { if (t > acc->h2) return; } t = 2.0 * def->h * t; t = (CUBED_ROOT_4 * acc->h2 - cbrt(t * t)) / acc->h2mw2; if (t > 0.0) acc->tail_y = def->h / CUBED_ROOT_2 * sqrt(t); } /* * inverse functions -- compute edge coordinates * from the ellipse */ static double outerXfromXY ( double x, double y, struct arc_def *def, struct accelerators *acc) { return x + (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4); } static double outerYfromXY ( double x, double y, struct arc_def *def, struct accelerators *acc) { return y + (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4); } static double innerXfromXY ( double x, double y, struct arc_def *def, struct accelerators *acc) { return x - (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4); } static double innerYfromXY ( double x, double y, struct arc_def *def, struct accelerators *acc) { return y - (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4); } static double innerYfromY ( double y, struct arc_def *def, struct accelerators *acc) { double x; x = (def->w / def->h) * sqrt (acc->h2 - y*y); return y - (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4); } static void computeLine ( double x1, double y1, double x2, double y2, struct line *line) { if (y1 == y2) line->valid = 0; else { line->m = (x1 - x2) / (y1 - y2); line->b = x1 - y1 * line->m; line->valid = 1; } } /* * compute various accelerators for an ellipse. These * are simply values that are used repeatedly in * the computations */ static void computeAcc ( xArc *tarc, int lw, struct arc_def *def, struct accelerators *acc) { def->w = ((double) tarc->width) / 2.0; def->h = ((double) tarc->height) / 2.0; def->l = ((double) lw) / 2.0; acc->h2 = def->h * def->h; acc->w2 = def->w * def->w; acc->h4 = acc->h2 * acc->h2; acc->w4 = acc->w2 * acc->w2; acc->h2l = acc->h2 * def->l; acc->w2l = acc->w2 * def->l; acc->h2mw2 = acc->h2 - acc->w2; acc->fromIntX = (tarc->width & 1) ? 0.5 : 0.0; acc->fromIntY = (tarc->height & 1) ? 0.5 : 0.0; acc->xorg = tarc->x + (tarc->width >> 1); acc->yorgu = tarc->y + (tarc->height >> 1); acc->yorgl = acc->yorgu + (tarc->height & 1); tailEllipseY (def, acc); } /* * compute y value bounds of various portions of the arc, * the outer edge, the ellipse and the inner edge. */ static void computeBound ( struct arc_def *def, struct arc_bound *bound, struct accelerators *acc, miArcFacePtr right, miArcFacePtr left) { double t; double innerTaily; double tail_y; struct bound innerx, outerx; struct bound ellipsex; bound->ellipse.min = Dsin (def->a0) * def->h; bound->ellipse.max = Dsin (def->a1) * def->h; if (def->a0 == 45 && def->w == def->h) ellipsex.min = bound->ellipse.min; else ellipsex.min = Dcos (def->a0) * def->w; if (def->a1 == 45 && def->w == def->h) ellipsex.max = bound->ellipse.max; else ellipsex.max = Dcos (def->a1) * def->w; bound->outer.min = outerYfromXY (ellipsex.min, bound->ellipse.min, def, acc); bound->outer.max = outerYfromXY (ellipsex.max, bound->ellipse.max, def, acc); bound->inner.min = innerYfromXY (ellipsex.min, bound->ellipse.min, def, acc); bound->inner.max = innerYfromXY (ellipsex.max, bound->ellipse.max, def, acc); outerx.min = outerXfromXY (ellipsex.min, bound->ellipse.min, def, acc); outerx.max = outerXfromXY (ellipsex.max, bound->ellipse.max, def, acc); innerx.min = innerXfromXY (ellipsex.min, bound->ellipse.min, def, acc); innerx.max = innerXfromXY (ellipsex.max, bound->ellipse.max, def, acc); /* * save the line end points for the * cap code to use. Careful here, these are * in cartesean coordinates (y increasing upwards) * while the cap code uses inverted coordinates * (y increasing downwards) */ if (right) { right->counterClock.y = bound->outer.min; right->counterClock.x = outerx.min; right->center.y = bound->ellipse.min; right->center.x = ellipsex.min; right->clock.y = bound->inner.min; right->clock.x = innerx.min; } if (left) { left->clock.y = bound->outer.max; left->clock.x = outerx.max; left->center.y = bound->ellipse.max; left->center.x = ellipsex.max; left->counterClock.y = bound->inner.max; left->counterClock.x = innerx.max; } bound->left.min = bound->inner.max; bound->left.max = bound->outer.max; bound->right.min = bound->inner.min; bound->right.max = bound->outer.min; computeLine (innerx.min, bound->inner.min, outerx.min, bound->outer.min, &acc->right); computeLine (innerx.max, bound->inner.max, outerx.max, bound->outer.max, &acc->left); if (bound->inner.min > bound->inner.max) { t = bound->inner.min; bound->inner.min = bound->inner.max; bound->inner.max = t; } tail_y = acc->tail_y; if (tail_y > bound->ellipse.max) tail_y = bound->ellipse.max; else if (tail_y < bound->ellipse.min) tail_y = bound->ellipse.min; innerTaily = innerYfromY (tail_y, def, acc); if (bound->inner.min > innerTaily) bound->inner.min = innerTaily; if (bound->inner.max < innerTaily) bound->inner.max = innerTaily; bound->inneri.min = ICEIL(bound->inner.min - acc->fromIntY); bound->inneri.max = floor(bound->inner.max - acc->fromIntY); bound->outeri.min = ICEIL(bound->outer.min - acc->fromIntY); bound->outeri.max = floor(bound->outer.max - acc->fromIntY); } /* * this section computes the x value of the span at y * intersected with the specified face of the ellipse. * * this is the min/max X value over the set of normal * lines to the entire ellipse, the equation of the * normal lines is: * * ellipse_x h^2 h^2 * x = ------------ y + ellipse_x (1 - --- ) * ellipse_y w^2 w^2 * * compute the derivative with-respect-to ellipse_y and solve * for zero: * * (w^2 - h^2) ellipse_y^3 + h^4 y * 0 = - ---------------------------------- * h w ellipse_y^2 sqrt (h^2 - ellipse_y^2) * * ( h^4 y ) * ellipse_y = ( ---------- ) ^ (1/3) * ( (h^2 - w^2) ) * * The other two solutions to the equation are imaginary. * * This gives the position on the ellipse which generates * the normal with the largest/smallest x intersection point. * * Now compute the second derivative to check whether * the intersection is a minimum or maximum: * * h (y0^3 (w^2 - h^2) + h^2 y (3y0^2 - 2h^2)) * - ------------------------------------------- * w y0^3 (sqrt (h^2 - y^2)) ^ 3 * * as we only care about the sign, * * - (y0^3 (w^2 - h^2) + h^2 y (3y0^2 - 2h^2)) * * or (to use accelerators), * * y0^3 (h^2 - w^2) - h^2 y (3y0^2 - 2h^2) * */ /* * computes the position on the ellipse whose normal line * intersects the given scan line maximally */ static double hookEllipseY ( double scan_y, struct arc_bound *bound, struct accelerators *acc, int left) { double ret; if (acc->h2mw2 == 0) { if ( (scan_y > 0 && !left) || (scan_y < 0 && left) ) return bound->ellipse.min; return bound->ellipse.max; } ret = (acc->h4 * scan_y) / (acc->h2mw2); if (ret >= 0) return cbrt (ret); else return -cbrt (-ret); } /* * computes the X value of the intersection of the * given scan line with the right side of the lower hook */ static double hookX ( double scan_y, struct arc_def *def, struct arc_bound *bound, struct accelerators *acc, int left) { double ellipse_y, x; double maxMin; if (def->w != def->h) { ellipse_y = hookEllipseY (scan_y, bound, acc, left); if (boundedLe (ellipse_y, bound->ellipse)) { /* * compute the value of the second * derivative */ maxMin = ellipse_y*ellipse_y*ellipse_y * acc->h2mw2 - acc->h2 * scan_y * (3 * ellipse_y*ellipse_y - 2*acc->h2); if ((left && maxMin > 0) || (!left && maxMin < 0)) { if (ellipse_y == 0) return def->w + left ? -def->l : def->l; x = (acc->h2 * scan_y - ellipse_y * acc->h2mw2) * sqrt (acc->h2 - ellipse_y * ellipse_y) / (def->h * def->w * ellipse_y); return x; } } } if (left) { if (acc->left.valid && boundedLe (scan_y, bound->left)) { x = intersectLine (scan_y, acc->left); } else { if (acc->right.valid) x = intersectLine (scan_y, acc->right); else x = def->w - def->l; } } else { if (acc->right.valid && boundedLe (scan_y, bound->right)) { x = intersectLine (scan_y, acc->right); } else { if (acc->left.valid) x = intersectLine (scan_y, acc->left); else x = def->w - def->l; } } return x; } /* * generate the set of spans with * the given y coordinate */ static void arcSpan ( int y, int lx, int lw, int rx, int rw, struct arc_def *def, struct arc_bound *bounds, struct accelerators *acc, int mask) { int linx, loutx, rinx, routx; double x, altx; if (boundedLe (y, bounds->inneri)) { linx = -(lx + lw); rinx = rx; } else { /* * intersection with left face */ x = hookX (y + acc->fromIntY, def, bounds, acc, 1); if (acc->right.valid && boundedLe (y + acc->fromIntY, bounds->right)) { altx = intersectLine (y + acc->fromIntY, acc->right); if (altx < x) x = altx; } linx = -ICEIL(acc->fromIntX - x); rinx = ICEIL(acc->fromIntX + x); } if (boundedLe (y, bounds->outeri)) { loutx = -lx; routx = rx + rw; } else { /* * intersection with right face */ x = hookX (y + acc->fromIntY, def, bounds, acc, 0); if (acc->left.valid && boundedLe (y + acc->fromIntY, bounds->left)) { altx = x; x = intersectLine (y + acc->fromIntY, acc->left); if (x < altx) x = altx; } loutx = -ICEIL(acc->fromIntX - x); routx = ICEIL(acc->fromIntX + x); } if (routx > rinx) { if (mask & 1) newFinalSpan (acc->yorgu - y, acc->xorg + rinx, acc->xorg + routx); if (mask & 8) newFinalSpan (acc->yorgl + y, acc->xorg + rinx, acc->xorg + routx); } if (loutx > linx) { if (mask & 2) newFinalSpan (acc->yorgu - y, acc->xorg - loutx, acc->xorg - linx); if (mask & 4) newFinalSpan (acc->yorgl + y, acc->xorg - loutx, acc->xorg - linx); } } static void arcSpan0 ( int lx, int lw, int rx, int rw, struct arc_def *def, struct arc_bound *bounds, struct accelerators *acc, int mask) { double x; if (boundedLe (0, bounds->inneri) && acc->left.valid && boundedLe (0, bounds->left) && acc->left.b > 0) { x = def->w - def->l; if (acc->left.b < x) x = acc->left.b; lw = ICEIL(acc->fromIntX - x) - lx; rw += rx; rx = ICEIL(acc->fromIntX + x); rw -= rx; } arcSpan (0, lx, lw, rx, rw, def, bounds, acc, mask); } static void tailSpan ( int y, int lw, int rw, struct arc_def *def, struct arc_bound *bounds, struct accelerators *acc, int mask) { double yy, xalt, x, lx, rx; int n; if (boundedLe(y, bounds->outeri)) arcSpan (y, 0, lw, -rw, rw, def, bounds, acc, mask); else if (def->w != def->h) { yy = y + acc->fromIntY; x = tailX(yy, def, bounds, acc); if (yy == 0.0 && x == -rw - acc->fromIntX) return; if (acc->right.valid && boundedLe (yy, bounds->right)) { rx = x; lx = -x; xalt = intersectLine (yy, acc->right); if (xalt >= -rw - acc->fromIntX && xalt <= rx) rx = xalt; n = ICEIL(acc->fromIntX + lx); if (lw > n) { if (mask & 2) newFinalSpan (acc->yorgu - y, acc->xorg + n, acc->xorg + lw); if (mask & 4) newFinalSpan (acc->yorgl + y, acc->xorg + n, acc->xorg + lw); } n = ICEIL(acc->fromIntX + rx); if (n > -rw) { if (mask & 1) newFinalSpan (acc->yorgu - y, acc->xorg - rw, acc->xorg + n); if (mask & 8) newFinalSpan (acc->yorgl + y, acc->xorg - rw, acc->xorg + n); } } arcSpan (y, ICEIL(acc->fromIntX - x), 0, ICEIL(acc->fromIntX + x), 0, def, bounds, acc, mask); } } /* * create whole arcs out of pieces. This code is * very bad. */ static struct finalSpan **finalSpans = NULL; static int finalMiny = 0, finalMaxy = -1; static int finalSize = 0; static int nspans = 0; /* total spans, not just y coords */ struct finalSpan { struct finalSpan *next; int min, max; /* x values */ }; static struct finalSpan *freeFinalSpans, *tmpFinalSpan; # define allocFinalSpan() (freeFinalSpans ?\ ((tmpFinalSpan = freeFinalSpans), \ (freeFinalSpans = freeFinalSpans->next), \ (tmpFinalSpan->next = 0), \ tmpFinalSpan) : \ realAllocSpan ()) # define SPAN_CHUNK_SIZE 128 struct finalSpanChunk { struct finalSpan data[SPAN_CHUNK_SIZE]; struct finalSpanChunk *next; }; static struct finalSpanChunk *chunks; struct finalSpan * realAllocSpan () { register struct finalSpanChunk *newChunk; register struct finalSpan *span; register int i; newChunk = (struct finalSpanChunk *) malloc (sizeof (struct finalSpanChunk)); if (!newChunk) return (struct finalSpan *) NULL; newChunk->next = chunks; chunks = newChunk; freeFinalSpans = span = newChunk->data + 1; for (i = 1; i < SPAN_CHUNK_SIZE-1; i++) { span->next = span+1; span++; } span->next = 0; span = newChunk->data; span->next = 0; return span; } static void disposeFinalSpans (void) { struct finalSpanChunk *chunk, *next; for (chunk = chunks; chunk; chunk = next) { next = chunk->next; free (chunk); } chunks = 0; freeFinalSpans = 0; free(finalSpans); finalSpans = 0; } static void fillSpans ( DrawablePtr pDrawable, GCPtr pGC) { register struct finalSpan *span; register DDXPointPtr xSpan; register int *xWidth; register int i; register struct finalSpan **f; register int spany; DDXPointPtr xSpans; int *xWidths; if (nspans == 0) return; xSpan = xSpans = (DDXPointPtr) malloc (nspans * sizeof (DDXPointRec)); xWidth = xWidths = (int *) malloc (nspans * sizeof (int)); if (xSpans && xWidths) { i = 0; f = finalSpans; for (spany = finalMiny; spany <= finalMaxy; spany++, f++) { for (span = *f; span; span=span->next) { if (span->max <= span->min) continue; xSpan->x = span->min; xSpan->y = spany; ++xSpan; *xWidth++ = span->max - span->min; ++i; } } (*pGC->ops->FillSpans) (pDrawable, pGC, i, xSpans, xWidths, TRUE); } disposeFinalSpans (); if (xSpans) free (xSpans); if (xWidths) free (xWidths); finalMiny = 0; finalMaxy = -1; finalSize = 0; nspans = 0; } # define SPAN_REALLOC 100 # define findSpan(y) ((finalMiny <= (y) && (y) <= finalMaxy) ? \ &finalSpans[(y) - finalMiny] : \ realFindSpan (y)) static struct finalSpan ** realFindSpan (int y) { struct finalSpan **newSpans; int newSize, newMiny, newMaxy; int change; int i; if (y < finalMiny || y > finalMaxy) { if (!finalSize) { finalMiny = y; finalMaxy = y - 1; } if (y < finalMiny) change = finalMiny - y; else change = y - finalMaxy; if (change >= SPAN_REALLOC) change += SPAN_REALLOC; else change = SPAN_REALLOC; newSize = finalSize + change; newSpans = (struct finalSpan **) malloc (newSize * sizeof (struct finalSpan *)); if (!newSpans) return (struct finalSpan **)NULL; newMiny = finalMiny; newMaxy = finalMaxy; if (y < finalMiny) newMiny = finalMiny - change; else newMaxy = finalMaxy + change; if (finalSpans) { memmove(((char *) newSpans) + (finalMiny-newMiny) * sizeof (struct finalSpan *), (char *) finalSpans, finalSize * sizeof (struct finalSpan *)); free (finalSpans); } if ((i = finalMiny - newMiny) > 0) bzero ((char *)newSpans, i * sizeof (struct finalSpan *)); if ((i = newMaxy - finalMaxy) > 0) bzero ((char *)(newSpans + newSize - i), i * sizeof (struct finalSpan *)); finalSpans = newSpans; finalMaxy = newMaxy; finalMiny = newMiny; finalSize = newSize; } return &finalSpans[y - finalMiny]; } static void newFinalSpan ( int y, register int xmin, register int xmax) { register struct finalSpan *x; register struct finalSpan **f; struct finalSpan *oldx; struct finalSpan *prev; f = findSpan (y); if (!f) return; oldx = 0; for (;;) { prev = 0; for (x = *f; x; x=x->next) { if (x == oldx) { prev = x; continue; } if (x->min <= xmax && xmin <= x->max) { if (oldx) { oldx->min = min (x->min, xmin); oldx->max = max (x->max, xmax); if (prev) prev->next = x->next; else *f = x->next; --nspans; } else { x->min = min (x->min, xmin); x->max = max (x->max, xmax); oldx = x; } xmin = oldx->min; xmax = oldx->max; break; } prev = x; } if (!x) break; } if (!oldx) { x = allocFinalSpan (); if (x) { x->min = xmin; x->max = xmax; x->next = *f; *f = x; ++nspans; } } } static void mirrorSppPoint ( int quadrant, SppPointPtr sppPoint) { switch (quadrant) { case 0: break; case 1: sppPoint->x = -sppPoint->x; break; case 2: sppPoint->x = -sppPoint->x; sppPoint->y = -sppPoint->y; break; case 3: sppPoint->y = -sppPoint->y; break; } /* * and translate to X coordinate system */ sppPoint->y = -sppPoint->y; } /* * split an arc into pieces which are scan-converted * in the first-quadrant and mirrored into position. * This is necessary as the scan-conversion code can * only deal with arcs completely contained in the * first quadrant. */ static void drawArc ( xArc *tarc, int l, int a0, int a1, miArcFacePtr right, miArcFacePtr left) /* save end line points */ { struct arc_def def; struct accelerators acc; int startq, endq, curq; int rightq, leftq = 0, righta = 0, lefta = 0; miArcFacePtr passRight, passLeft; int q0 = 0, q1 = 0, mask; struct band { int a0, a1; int mask; } band[5], sweep[20]; int bandno, sweepno; int i, j; int flipRight = 0, flipLeft = 0; int copyEnd = 0; miArcSpanData *spdata; Bool mustFree; spdata = miComputeWideEllipse(l, tarc, &mustFree); if (!spdata) return; if (a1 < a0) a1 += 360 * 64; startq = a0 / (90 * 64); if (a0 == a1) endq = startq; else endq = (a1-1) / (90 * 64); bandno = 0; curq = startq; rightq = -1; for (;;) { switch (curq) { case 0: if (a0 > 90 * 64) q0 = 0; else q0 = a0; if (a1 < 360 * 64) q1 = min (a1, 90 * 64); else q1 = 90 * 64; if (curq == startq && a0 == q0 && rightq < 0) { righta = q0; rightq = curq; } if (curq == endq && a1 == q1) { lefta = q1; leftq = curq; } break; case 1: if (a1 < 90 * 64) q0 = 0; else q0 = 180 * 64 - min (a1, 180 * 64); if (a0 > 180 * 64) q1 = 90 * 64; else q1 = 180 * 64 - max (a0, 90 * 64); if (curq == startq && 180 * 64 - a0 == q1) { righta = q1; rightq = curq; } if (curq == endq && 180 * 64 - a1 == q0) { lefta = q0; leftq = curq; } break; case 2: if (a0 > 270 * 64) q0 = 0; else q0 = max (a0, 180 * 64) - 180 * 64; if (a1 < 180 * 64) q1 = 90 * 64; else q1 = min (a1, 270 * 64) - 180 * 64; if (curq == startq && a0 - 180*64 == q0) { righta = q0; rightq = curq; } if (curq == endq && a1 - 180 * 64 == q1) { lefta = q1; leftq = curq; } break; case 3: if (a1 < 270 * 64) q0 = 0; else q0 = 360 * 64 - min (a1, 360 * 64); q1 = 360 * 64 - max (a0, 270 * 64); if (curq == startq && 360 * 64 - a0 == q1) { righta = q1; rightq = curq; } if (curq == endq && 360 * 64 - a1 == q0) { lefta = q0; leftq = curq; } break; } band[bandno].a0 = q0; band[bandno].a1 = q1; band[bandno].mask = 1 << curq; bandno++; if (curq == endq) break; curq++; if (curq == 4) { a0 = 0; a1 -= 360 * 64; curq = 0; endq -= 4; } } sweepno = 0; for (;;) { q0 = 90 * 64; mask = 0; /* * find left-most point */ for (i = 0; i < bandno; i++) if (band[i].a0 <= q0) { q0 = band[i].a0; q1 = band[i].a1; mask = band[i].mask; } if (!mask) break; /* * locate next point of change */ for (i = 0; i < bandno; i++) if (!(mask & band[i].mask)) { if (band[i].a0 == q0) { if (band[i].a1 < q1) q1 = band[i].a1; mask |= band[i].mask; } else if (band[i].a0 < q1) q1 = band[i].a0; } /* * create a new sweep */ sweep[sweepno].a0 = q0; sweep[sweepno].a1 = q1; sweep[sweepno].mask = mask; sweepno++; /* * subtract the sweep from the affected bands */ for (i = 0; i < bandno; i++) if (band[i].a0 == q0) { band[i].a0 = q1; /* * check if this band is empty */ if (band[i].a0 == band[i].a1) band[i].a1 = band[i].a0 = 90 * 64 + 1; } } computeAcc (tarc, l, &def, &acc); for (j = 0; j < sweepno; j++) { mask = sweep[j].mask; passRight = passLeft = 0; if (mask & (1 << rightq)) { if (sweep[j].a0 == righta) passRight = right; else if (sweep[j].a1 == righta) { passLeft = right; flipRight = 1; } } if (mask & (1 << leftq)) { if (sweep[j].a1 == lefta) { if (passLeft) copyEnd = 1; passLeft = left; } else if (sweep[j].a0 == lefta) { if (passRight) copyEnd = 1; passRight = left; flipLeft = 1; } } drawQuadrant (&def, &acc, sweep[j].a0, sweep[j].a1, mask, passRight, passLeft, spdata); } /* * when copyEnd is set, both ends of the arc were computed * at the same time; drawQuadrant only takes one end though, * so the left end will be the only one holding the data. Copy * it from there. */ if (copyEnd) *right = *left; /* * mirror the coordinates generated for the * faces of the arc */ if (right) { mirrorSppPoint (rightq, &right->clock); mirrorSppPoint (rightq, &right->center); mirrorSppPoint (rightq, &right->counterClock); if (flipRight) { SppPointRec temp; temp = right->clock; right->clock = right->counterClock; right->counterClock = temp; } } if (left) { mirrorSppPoint (leftq, &left->counterClock); mirrorSppPoint (leftq, &left->center); mirrorSppPoint (leftq, &left->clock); if (flipLeft) { SppPointRec temp; temp = left->clock; left->clock = left->counterClock; left->counterClock = temp; } } if (mustFree) free(spdata); } static void drawQuadrant ( struct arc_def *def, struct accelerators *acc, int a0, int a1, int mask, miArcFacePtr right, miArcFacePtr left, miArcSpanData *spdata) { struct arc_bound bound; double yy, x, xalt; int y, miny, maxy; int n; miArcSpan *span; def->a0 = ((double) a0) / 64.0; def->a1 = ((double) a1) / 64.0; computeBound (def, &bound, acc, right, left); yy = bound.inner.min; if (bound.outer.min < yy) yy = bound.outer.min; miny = ICEIL(yy - acc->fromIntY); yy = bound.inner.max; if (bound.outer.max > yy) yy = bound.outer.max; maxy = floor(yy - acc->fromIntY); y = spdata->k; span = spdata->spans; if (spdata->top) { if (a1 == 90 * 64 && (mask & 1)) newFinalSpan (acc->yorgu - y - 1, acc->xorg, acc->xorg + 1); span++; } for (n = spdata->count1; --n >= 0; ) { if (y < miny) return; if (y <= maxy) { arcSpan (y, span->lx, -span->lx, 0, span->lx + span->lw, def, &bound, acc, mask); if (span->rw + span->rx) tailSpan (y, -span->rw, -span->rx, def, &bound, acc, mask); } y--; span++; } if (y < miny) return; if (spdata->hole) { if (y <= maxy) arcSpan (y, 0, 0, 0, 1, def, &bound, acc, mask & 0xc); } for (n = spdata->count2; --n >= 0; ) { if (y < miny) return; if (y <= maxy) arcSpan (y, span->lx, span->lw, span->rx, span->rw, def, &bound, acc, mask); y--; span++; } if (spdata->bot && miny <= y && y <= maxy) { n = mask; if (y == miny) n &= 0xc; if (span->rw <= 0) { arcSpan0 (span->lx, -span->lx, 0, span->lx + span->lw, def, &bound, acc, n); if (span->rw + span->rx) tailSpan (y, -span->rw, -span->rx, def, &bound, acc, n); } else arcSpan0 (span->lx, span->lw, span->rx, span->rw, def, &bound, acc, n); y--; } while (y >= miny) { yy = y + acc->fromIntY; if (def->w == def->h) { xalt = def->w - def->l; x = -sqrt(xalt * xalt - yy * yy); } else { x = tailX(yy, def, &bound, acc); if (acc->left.valid && boundedLe (yy, bound.left)) { xalt = intersectLine (yy, acc->left); if (xalt < x) x = xalt; } if (acc->right.valid && boundedLe (yy, bound.right)) { xalt = intersectLine (yy, acc->right); if (xalt < x) x = xalt; } } arcSpan (y, ICEIL(acc->fromIntX - x), 0, ICEIL(acc->fromIntX + x), 0, def, &bound, acc, mask); y--; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mibitblt.c0000644000000000000000000006131113614532331017154 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* Author: Todd Newman (aided and abetted by Mr. Drewry) */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "scrnintstr.h" #include "mi.h" #include "regionstr.h" #include #include "servermd.h" #ifndef HAS_FFS extern int ffs(int); #endif /* MICOPYAREA -- public entry for the CopyArea request * For each rectangle in the source region * get the pixels with GetSpans * set them in the destination with SetSpans * We let SetSpans worry about clipping to the destination. */ RegionPtr miCopyArea(pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut) register DrawablePtr pSrcDrawable; register DrawablePtr pDstDrawable; GCPtr pGC; int xIn, yIn; int widthSrc, heightSrc; int xOut, yOut; { DDXPointPtr ppt, pptFirst; unsigned int *pwidthFirst, *pwidth, *pbits; BoxRec srcBox, *prect; /* may be a new region, or just a copy */ RegionPtr prgnSrcClip; /* non-0 if we've created a src clip */ RegionPtr prgnExposed; int realSrcClip = 0; int srcx, srcy, dstx, dsty, i, j, y, width, height, xMin, xMax, yMin, yMax; unsigned int *ordering; int numRects; BoxPtr boxes; srcx = xIn + pSrcDrawable->x; srcy = yIn + pSrcDrawable->y; /* If the destination isn't realized, this is easy */ if (pDstDrawable->type == DRAWABLE_WINDOW && !((WindowPtr)pDstDrawable)->realized) return (RegionPtr)NULL; /* clip the source */ if (pSrcDrawable->type == DRAWABLE_PIXMAP) { BoxRec box; box.x1 = pSrcDrawable->x; box.y1 = pSrcDrawable->y; box.x2 = pSrcDrawable->x + (int) pSrcDrawable->width; box.y2 = pSrcDrawable->y + (int) pSrcDrawable->height; prgnSrcClip = RegionCreate(&box, 1); realSrcClip = 1; } else { if (pGC->subWindowMode == IncludeInferiors) { prgnSrcClip = NotClippedByChildren ((WindowPtr) pSrcDrawable); realSrcClip = 1; } else prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList; } /* If the src drawable is a window, we need to translate the srcBox so * that we can compare it with the window's clip region later on. */ srcBox.x1 = srcx; srcBox.y1 = srcy; srcBox.x2 = srcx + widthSrc; srcBox.y2 = srcy + heightSrc; dstx = xOut; dsty = yOut; if (pGC->miTranslate) { dstx += pDstDrawable->x; dsty += pDstDrawable->y; } pptFirst = ppt = (DDXPointPtr) malloc(heightSrc * sizeof(DDXPointRec)); pwidthFirst = pwidth = (unsigned int *) malloc(heightSrc * sizeof(unsigned int)); numRects = RegionNumRects(prgnSrcClip); boxes = RegionRects(prgnSrcClip); ordering = (unsigned int *) malloc(numRects * sizeof(unsigned int)); if(!pptFirst || !pwidthFirst || !ordering) { if (ordering) free(ordering); if (pwidthFirst) free(pwidthFirst); if (pptFirst) free(pptFirst); return (RegionPtr)NULL; } /* If not the same drawable then order of move doesn't matter. Following assumes that boxes are sorted from top to bottom and left to right. */ if ((pSrcDrawable != pDstDrawable) && ((pGC->subWindowMode != IncludeInferiors) || (pSrcDrawable->type == DRAWABLE_PIXMAP) || (pDstDrawable->type == DRAWABLE_PIXMAP))) for (i=0; i < numRects; i++) ordering[i] = i; else { /* within same drawable, must sequence moves carefully! */ if (dsty <= srcBox.y1) { /* Scroll up or stationary vertical. Vertical order OK */ if (dstx <= srcBox.x1) /* Scroll left or stationary horizontal. Horizontal order OK as well */ for (i=0; i < numRects; i++) ordering[i] = i; else { /* scroll right. must reverse horizontal banding of rects. */ for (i=0, j=1, xMax=0; i < numRects; j=i+1, xMax=i) { /* find extent of current horizontal band */ y=boxes[i].y1; /* band has this y coordinate */ while ((j < numRects) && (boxes[j].y1 == y)) j++; /* reverse the horizontal band in the output ordering */ for (j-- ; j >= xMax; j--, i++) ordering[i] = j; } } } else { /* Scroll down. Must reverse vertical banding. */ if (dstx < srcBox.x1) { /* Scroll left. Horizontal order OK. */ for (i=numRects-1, j=i-1, yMin=i, yMax=0; i >= 0; j=i-1, yMin=i) { /* find extent of current horizontal band */ y=boxes[i].y1; /* band has this y coordinate */ while ((j >= 0) && (boxes[j].y1 == y)) j--; /* reverse the horizontal band in the output ordering */ for (j++ ; j <= yMin; j++, i--, yMax++) ordering[yMax] = j; } } else /* Scroll right or horizontal stationary. Reverse horizontal order as well (if stationary, horizontal order can be swapped without penalty and this is faster to compute). */ for (i=0, j=numRects-1; i < numRects; i++, j--) ordering[i] = j; } } for(i = 0; i < numRects; i++) { prect = &boxes[ordering[i]]; xMin = max(prect->x1, srcBox.x1); xMax = min(prect->x2, srcBox.x2); yMin = max(prect->y1, srcBox.y1); yMax = min(prect->y2, srcBox.y2); /* is there anything visible here? */ if(xMax <= xMin || yMax <= yMin) continue; ppt = pptFirst; pwidth = pwidthFirst; y = yMin; height = yMax - yMin; width = xMax - xMin; for(j = 0; j < height; j++) { /* We must untranslate before calling GetSpans */ ppt->x = xMin; ppt++->y = y++; *pwidth++ = width; } pbits = (unsigned int *)malloc(height * PixmapBytePad(width, pSrcDrawable->depth)); if (pbits) { (*pSrcDrawable->pScreen->GetSpans)(pSrcDrawable, width, pptFirst, (int *)pwidthFirst, height, (char *)pbits); ppt = pptFirst; pwidth = pwidthFirst; xMin -= (srcx - dstx); y = yMin - (srcy - dsty); for(j = 0; j < height; j++) { ppt->x = xMin; ppt++->y = y++; *pwidth++ = width; } (*pGC->ops->SetSpans)(pDstDrawable, pGC, (char *)pbits, pptFirst, (int *)pwidthFirst, height, TRUE); free(pbits); } } prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut, (unsigned long)0); if(realSrcClip) RegionDestroy(prgnSrcClip); free(ordering); free(pwidthFirst); free(pptFirst); return prgnExposed; } /* MIGETPLANE -- gets a bitmap representing one plane of pDraw * A helper used for CopyPlane and XY format GetImage * No clever strategy here, we grab a scanline at a time, pull out the * bits and then stuff them in a 1 bit deep map. */ /* * This should be replaced with something more general. mi shouldn't have to * care about such things as scanline padding et alia. */ static MiBits * miGetPlane( DrawablePtr pDraw, int planeNum, /* number of the bitPlane */ int sx, int sy, int w, int h, MiBits *result) { int i, j, k, width, bitsPerPixel, widthInBytes; DDXPointRec pt = {0, 0}; MiBits pixel; MiBits bit; unsigned char *pCharsOut = NULL; #if BITMAP_SCANLINE_UNIT == 8 #define OUT_TYPE unsigned char #endif #if BITMAP_SCANLINE_UNIT == 16 #define OUT_TYPE CARD16 #endif #if BITMAP_SCANLINE_UNIT == 32 #define OUT_TYPE CARD32 #endif #if BITMAP_SCANLINE_UNIT == 64 #define OUT_TYPE CARD64 #endif OUT_TYPE *pOut; int delta = 0; sx += pDraw->x; sy += pDraw->y; widthInBytes = BitmapBytePad(w); if(!result) result = (MiBits *)malloc(h * widthInBytes); if (!result) return (MiBits *)NULL; bitsPerPixel = pDraw->bitsPerPixel; bzero((char *)result, h * widthInBytes); pOut = (OUT_TYPE *) result; if(bitsPerPixel == 1) { pCharsOut = (unsigned char *) result; width = w; } else { delta = (widthInBytes / (BITMAP_SCANLINE_UNIT / 8)) - (w / BITMAP_SCANLINE_UNIT); width = 1; #if IMAGE_BYTE_ORDER == MSBFirst planeNum += (32 - bitsPerPixel); #endif } pt.y = sy; for (i = h; --i >= 0; pt.y++) { pt.x = sx; if(bitsPerPixel == 1) { (*pDraw->pScreen->GetSpans)(pDraw, width, &pt, &width, 1, (char *)pCharsOut); pCharsOut += widthInBytes; } else { k = 0; for(j = w; --j >= 0; pt.x++) { /* Fetch the next pixel */ (*pDraw->pScreen->GetSpans)(pDraw, width, &pt, &width, 1, (char *)&pixel); /* * Now get the bit and insert into a bitmap in XY format. */ bit = (pixel >> planeNum) & 1; #ifndef XFree86Server /* XXX assuming bit order == byte order */ #if BITMAP_BIT_ORDER == LSBFirst bit <<= k; #else bit <<= ((BITMAP_SCANLINE_UNIT - 1) - k); #endif #else /* XXX assuming byte order == LSBFirst */ if (screenInfo.bitmapBitOrder == LSBFirst) bit <<= k; else bit <<= ((screenInfo.bitmapScanlineUnit - 1) - (k % screenInfo.bitmapScanlineUnit)) + ((k / screenInfo.bitmapScanlineUnit) * screenInfo.bitmapScanlineUnit); #endif *pOut |= (OUT_TYPE) bit; k++; if (k == BITMAP_SCANLINE_UNIT) { pOut++; k = 0; } } pOut += delta; } } return(result); } /* MIOPQSTIPDRAWABLE -- use pbits as an opaque stipple for pDraw. * Drawing through the clip mask we SetSpans() the bits into a * bitmap and stipple those bits onto the destination drawable by doing a * PolyFillRect over the whole drawable, * then we invert the bitmap by copying it onto itself with an alu of * GXinvert, invert the foreground/background colors of the gc, and draw * the background bits. * Note how the clipped out bits of the bitmap are always the background * color so that the stipple never causes FillRect to draw them. */ void miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty) DrawablePtr pDraw; GCPtr pGC; RegionPtr prgnSrc; MiBits *pbits; int srcx, w, h, dstx, dsty; { int oldfill, i; unsigned long oldfg; int *pwidth, *pwidthFirst; ChangeGCVal gcv[6]; PixmapPtr pStipple, pPixmap; DDXPointRec oldOrg; GCPtr pGCT; DDXPointPtr ppt, pptFirst; xRectangle rect; RegionPtr prgnSrcClip; pPixmap = (*pDraw->pScreen->CreatePixmap) (pDraw->pScreen, w + srcx, h, 1, CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) return; /* Put the image into a 1 bit deep pixmap */ pGCT = GetScratchGC(1, pDraw->pScreen); if (!pGCT) { (*pDraw->pScreen->DestroyPixmap)(pPixmap); return; } /* First set the whole pixmap to 0 */ gcv[0].val = 0; dixChangeGC(NullClient, pGCT, GCBackground, NULL, gcv); ValidateGC((DrawablePtr)pPixmap, pGCT); miClearDrawable((DrawablePtr)pPixmap, pGCT); ppt = pptFirst = (DDXPointPtr)malloc(h * sizeof(DDXPointRec)); pwidth = pwidthFirst = (int *)malloc(h * sizeof(int)); if(!pptFirst || !pwidthFirst) { if (pwidthFirst) free(pwidthFirst); if (pptFirst) free(pptFirst); FreeScratchGC(pGCT); return; } /* we need a temporary region because ChangeClip must be assumed to destroy what it's sent. note that this means we don't have to free prgnSrcClip ourselves. */ prgnSrcClip = RegionCreate(NULL, 0); RegionCopy(prgnSrcClip, prgnSrc); RegionTranslate(prgnSrcClip, srcx, 0); (*pGCT->funcs->ChangeClip)(pGCT, CT_REGION, prgnSrcClip, 0); ValidateGC((DrawablePtr)pPixmap, pGCT); /* Since we know pDraw is always a pixmap, we never need to think * about translation here */ for(i = 0; i < h; i++) { ppt->x = 0; ppt++->y = i; *pwidth++ = w + srcx; } (*pGCT->ops->SetSpans)((DrawablePtr)pPixmap, pGCT, (char *)pbits, pptFirst, pwidthFirst, h, TRUE); free(pwidthFirst); free(pptFirst); /* Save current values from the client GC */ oldfill = pGC->fillStyle; pStipple = pGC->stipple; if(pStipple) pStipple->refcnt++; oldOrg = pGC->patOrg; /* Set a new stipple in the drawable */ gcv[0].val = FillStippled; gcv[1].ptr = pPixmap; gcv[2].val = dstx - srcx; gcv[3].val = dsty; dixChangeGC(NullClient, pGC, GCFillStyle | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin, NULL, gcv); ValidateGC(pDraw, pGC); /* Fill the drawable with the stipple. This will draw the * foreground color whereever 1 bits are set, leaving everything * with 0 bits untouched. Note that the part outside the clip * region is all 0s. */ rect.x = dstx; rect.y = dsty; rect.width = w; rect.height = h; (*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect); /* Invert the tiling pixmap. This sets 0s for 1s and 1s for 0s, only * within the clipping region, the part outside is still all 0s */ gcv[0].val = GXinvert; dixChangeGC(NullClient, pGCT, GCFunction, NULL, gcv); ValidateGC((DrawablePtr)pPixmap, pGCT); (*pGCT->ops->CopyArea)((DrawablePtr)pPixmap, (DrawablePtr)pPixmap, pGCT, 0, 0, w + srcx, h, 0, 0); /* Swap foreground and background colors on the GC for the drawable. * Now when we fill the drawable, we will fill in the "Background" * values */ oldfg = pGC->fgPixel; gcv[0].val = pGC->bgPixel; gcv[1].val = oldfg; gcv[2].ptr = pPixmap; dixChangeGC(NullClient, pGC, GCForeground | GCBackground | GCStipple, NULL, gcv); ValidateGC(pDraw, pGC); /* PolyFillRect might have bashed the rectangle */ rect.x = dstx; rect.y = dsty; rect.width = w; rect.height = h; (*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect); /* Now put things back */ if(pStipple) pStipple->refcnt--; gcv[0].val = oldfg; gcv[1].val = pGC->fgPixel; gcv[2].val = oldfill; gcv[3].ptr = pStipple; gcv[4].val = oldOrg.x; gcv[5].val = oldOrg.y; dixChangeGC(NullClient, pGC, GCForeground | GCBackground | GCFillStyle | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin, NULL, gcv); ValidateGC(pDraw, pGC); /* put what we hope is a smaller clip region back in the scratch gc */ (*pGCT->funcs->ChangeClip)(pGCT, CT_NONE, NULL, 0); FreeScratchGC(pGCT); (*pDraw->pScreen->DestroyPixmap)(pPixmap); } /* MICOPYPLANE -- public entry for the CopyPlane request. * strategy: * First build up a bitmap out of the bits requested * build a source clip * Use the bitmap we've built up as a Stipple for the destination */ RegionPtr miCopyPlane(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane) DrawablePtr pSrcDrawable; DrawablePtr pDstDrawable; GCPtr pGC; int srcx, srcy; int width, height; int dstx, dsty; unsigned long bitPlane; { MiBits *ptile; BoxRec box; RegionPtr prgnSrc, prgnExposed; /* incorporate the source clip */ box.x1 = srcx + pSrcDrawable->x; box.y1 = srcy + pSrcDrawable->y; box.x2 = box.x1 + width; box.y2 = box.y1 + height; /* clip to visible drawable */ if (box.x1 < pSrcDrawable->x) box.x1 = pSrcDrawable->x; if (box.y1 < pSrcDrawable->y) box.y1 = pSrcDrawable->y; if (box.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) box.x2 = pSrcDrawable->x + (int) pSrcDrawable->width; if (box.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) box.y2 = pSrcDrawable->y + (int) pSrcDrawable->height; if (box.x1 > box.x2) box.x2 = box.x1; if (box.y1 > box.y2) box.y2 = box.y1; prgnSrc = RegionCreate(&box, 1); if (pSrcDrawable->type != DRAWABLE_PIXMAP) { /* clip to visible drawable */ if (pGC->subWindowMode == IncludeInferiors) { RegionPtr clipList = NotClippedByChildren ((WindowPtr) pSrcDrawable); RegionIntersect(prgnSrc, prgnSrc, clipList); RegionDestroy(clipList); } else RegionIntersect(prgnSrc, prgnSrc, &((WindowPtr)pSrcDrawable)->clipList); } box = *RegionExtents(prgnSrc); RegionTranslate(prgnSrc, -box.x1, -box.y1); if ((box.x2 > box.x1) && (box.y2 > box.y1)) { /* minimize the size of the data extracted */ /* note that we convert the plane mask bitPlane into a plane number */ box.x1 -= pSrcDrawable->x; box.x2 -= pSrcDrawable->x; box.y1 -= pSrcDrawable->y; box.y2 -= pSrcDrawable->y; ptile = miGetPlane(pSrcDrawable, ffs(bitPlane) - 1, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1, (MiBits *) NULL); if (ptile) { miOpqStipDrawable(pDstDrawable, pGC, prgnSrc, ptile, 0, box.x2 - box.x1, box.y2 - box.y1, dstx + box.x1 - srcx, dsty + box.y1 - srcy); free(ptile); } } prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); RegionDestroy(prgnSrc); return prgnExposed; } /* MIGETIMAGE -- public entry for the GetImage Request * We're getting the image into a memory buffer. While we have to use GetSpans * to read a line from the device (since we don't know what that looks like), * we can just write into the destination buffer * * two different strategies are used, depending on whether we're getting the * image in Z format or XY format * Z format: * Line at a time, GetSpans a line into the destination buffer, then if the * planemask is not all ones, we do a SetSpans into a temporary buffer (to get * bits turned off) and then another GetSpans to get stuff back (because * pixmaps are opaque, and we are passed in the memory to write into). This is * pretty ugly and slow but works. Life is hard. * XY format: * get the single plane specified in planemask */ void miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst) DrawablePtr pDraw; int sx, sy, w, h; unsigned int format; unsigned long planeMask; char * pDst; { unsigned char depth; int i, linelength, width, srcx, srcy; DDXPointRec pt = {0, 0}; XID gcv[2]; PixmapPtr pPixmap = (PixmapPtr)NULL; GCPtr pGC = NULL; depth = pDraw->depth; if(format == ZPixmap) { if ( (((1<pScreen); if (!pGC) return; pPixmap = (*pDraw->pScreen->CreatePixmap) (pDraw->pScreen, w, 1, depth, CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) { FreeScratchGC(pGC); return; } /* * Clear the pixmap before doing anything else */ ValidateGC((DrawablePtr)pPixmap, pGC); xpt.x = xpt.y = 0; width = w; (*pGC->ops->FillSpans)((DrawablePtr)pPixmap, pGC, 1, &xpt, &width, TRUE); /* alu is already GXCopy */ gcv[0] = (XID)planeMask; DoChangeGC(pGC, GCPlaneMask, gcv, 0); ValidateGC((DrawablePtr)pPixmap, pGC); } linelength = PixmapBytePad(w, depth); srcx = sx + pDraw->x; srcy = sy + pDraw->y; for(i = 0; i < h; i++) { pt.x = srcx; pt.y = srcy + i; width = w; (*pDraw->pScreen->GetSpans)(pDraw, w, &pt, &width, 1, pDst); if (pPixmap) { pt.x = 0; pt.y = 0; width = w; (*pGC->ops->SetSpans)((DrawablePtr)pPixmap, pGC, pDst, &pt, &width, 1, TRUE); (*pDraw->pScreen->GetSpans)((DrawablePtr)pPixmap, w, &pt, &width, 1, pDst); } pDst += linelength; } if (pPixmap) { (*pGC->pScreen->DestroyPixmap)(pPixmap); FreeScratchGC(pGC); } } else { (void) miGetPlane(pDraw, ffs(planeMask) - 1, sx, sy, w, h, (MiBits *)pDst); } } /* MIPUTIMAGE -- public entry for the PutImage request * Here we benefit from knowing the format of the bits pointed to by pImage, * even if we don't know how pDraw represents them. * Three different strategies are used depending on the format * XYBitmap Format: * we just use the Opaque Stipple helper function to cover the destination * Note that this covers all the planes of the drawable with the * foreground color (masked with the GC planemask) where there are 1 bits * and the background color (masked with the GC planemask) where there are * 0 bits * XYPixmap format: * what we're called with is a series of XYBitmaps, but we only want * each XYPixmap to update 1 plane, instead of updating all of them. * we set the foreground color to be all 1s and the background to all 0s * then for each plane, we set the plane mask to only effect that one * plane and recursive call ourself with the format set to XYBitmap * (This clever idea courtesy of RGD.) * ZPixmap format: * This part is simple, just call SetSpans */ void miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage) DrawablePtr pDraw; GCPtr pGC; int depth, x, y, w, h, leftPad; int format; char *pImage; { DDXPointPtr pptFirst, ppt; int *pwidthFirst, *pwidth; RegionPtr prgnSrc; BoxRec box; unsigned long oldFg, oldBg; XID gcv[3]; unsigned long oldPlanemask; unsigned long i; long bytesPer; if (!w || !h) return; switch(format) { case XYBitmap: box.x1 = 0; box.y1 = 0; box.x2 = w; box.y2 = h; prgnSrc = RegionCreate(&box, 1); miOpqStipDrawable(pDraw, pGC, prgnSrc, (MiBits *) pImage, leftPad, w, h, x, y); RegionDestroy(prgnSrc); break; case XYPixmap: depth = pGC->depth; oldPlanemask = pGC->planemask; oldFg = pGC->fgPixel; oldBg = pGC->bgPixel; gcv[0] = (XID)~0; gcv[1] = (XID)0; DoChangeGC(pGC, GCForeground | GCBackground, gcv, 0); bytesPer = (long)h * BitmapBytePad(w + leftPad); for (i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer) { if (i & oldPlanemask) { gcv[0] = (XID)i; DoChangeGC(pGC, GCPlaneMask, gcv, 0); ValidateGC(pDraw, pGC); (*pGC->ops->PutImage)(pDraw, pGC, 1, x, y, w, h, leftPad, XYBitmap, (char *)pImage); } } gcv[0] = (XID)oldPlanemask; gcv[1] = (XID)oldFg; gcv[2] = (XID)oldBg; DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0); ValidateGC(pDraw, pGC); break; case ZPixmap: ppt = pptFirst = (DDXPointPtr)malloc(h * sizeof(DDXPointRec)); pwidth = pwidthFirst = (int *)malloc(h * sizeof(int)); if(!pptFirst || !pwidthFirst) { if (pwidthFirst) free(pwidthFirst); if (pptFirst) free(pptFirst); return; } if (pGC->miTranslate) { x += pDraw->x; y += pDraw->y; } for(i = 0; i < h; i++) { ppt->x = x; ppt->y = y + i; ppt++; *pwidth++ = w; } (*pGC->ops->SetSpans)(pDraw, pGC, (char *)pImage, pptFirst, pwidthFirst, h, TRUE); free(pwidthFirst); free(pptFirst); break; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mibstore.c0000644000000000000000000031451113614532331017175 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by the Regents of the University of California All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name The Open Group not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The University of California makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "regionstr.h" #include "scrnintstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include #include "dixfontstr.h" #include "mi.h" #include "mibstorest.h" /* * When the server fails to allocate a backing store pixmap, if you want * it to dynamically retry to allocate backing store on every subsequent * graphics op, you can enable BSEAGER; otherwise, backing store will be * disabled on the window until it is unmapped and then remapped. */ /* #define BSEAGER */ /*- * NOTES ON USAGE: * * The functions in this file implement a machine-independent backing-store * scheme. To use it, the output library must do the following: * - Provide a SaveAreas function that takes a destination pixmap, a * region of the areas to save (in the pixmap's coordinate system) * and the screen origin of the region. It should copy the areas from * the screen into the pixmap. * - Provide a RestoreAreas function that takes a source pixmap, a region * of the areas to restore (in the screen's coordinate system) and the * origin of the pixmap on the screen. It should copy the areas from * the pixmap into the screen. * - Provide a SetClipmaskRgn function that takes a gc and a region * and merges the region into any CT_PIXMAP client clip that * is specified in the GC. This routine is only needed if * miValidateBackingStore will see CT_PIXMAP clip lists; not * true for any of the sample servers (which convert the PIXMAP * clip lists into CT_REGION clip lists; an expensive but simple * to code option). * - The function placed in a window's ClearToBackground vector must call * pScreen->ClearBackingStore with the window, followed by * the window-relative x and y coordinates, followed by the width and * height of the area to be cleared, followed by the generateExposures * flag. This has been taken care of in miClearToBackground. * - Whatever determines GraphicsExpose events for the CopyArea and * CopyPlane requests should call pWin->backStorage->ExposeCopy * with the source and destination drawables, the GC used, a source- * window-relative region of exposed areas, the source and destination * coordinates and the bitplane copied, if CopyPlane, or 0, if * CopyArea. * * JUSTIFICATION * This is a cross between saving everything and just saving the * obscued areas (as in Pike's layers.) This method has the advantage * of only doing each output operation once per pixel, visible or * invisible, and avoids having to do all the crufty storage * management of keeping several separate rectangles. Since the * ddx layer ouput primitives are required to draw through clipping * rectangles anyway, sending multiple drawing requests for each of * several rectangles isn't necessary. (Of course, it could be argued * that the ddx routines should just take one rectangle each and * get called multiple times, but that would make taking advantage of * smart hardware harder, and probably be slower as well.) */ #define SETUP_BACKING_TERSE(pGC) \ miBSGCPtr pGCPrivate = (miBSGCPtr)(pGC)->devPrivates[miBSGCIndex].ptr; \ GCFuncs *oldFuncs = pGC->funcs; #define SETUP_BACKING(pDrawable,pGC) \ miBSWindowPtr pBackingStore = \ (miBSWindowPtr)((WindowPtr)(pDrawable))->backStorage; \ DrawablePtr pBackingDrawable = (DrawablePtr) \ pBackingStore->pBackingPixmap; \ SETUP_BACKING_TERSE(pGC) \ GCPtr pBackingGC = pGCPrivate->pBackingGC; #define PROLOGUE(pGC) { \ pGC->ops = pGCPrivate->wrapOps;\ pGC->funcs = pGCPrivate->wrapFuncs; \ } #define EPILOGUE(pGC) { \ pGCPrivate->wrapOps = (pGC)->ops; \ (pGC)->ops = &miBSGCOps; \ (pGC)->funcs = oldFuncs; \ } static void miCreateBSPixmap(WindowPtr pWin, BoxPtr pExtents); static void miDestroyBSPixmap(WindowPtr pWin); static void miTileVirtualBS(WindowPtr pWin); static void miBSAllocate(WindowPtr pWin), miBSFree(WindowPtr pWin); static Bool miBSCreateGCPrivate(GCPtr pGC); static void miBSClearBackingRegion(WindowPtr pWin, RegionPtr pRgn); #define MoreCopy0 ; #define MoreCopy2 *dstCopy++ = *srcCopy++; *dstCopy++ = *srcCopy++; #define MoreCopy4 MoreCopy2 MoreCopy2 #define copyData(src,dst,n,morecopy) \ { \ register short *srcCopy = (short *)(src); \ register short *dstCopy = (short *)(dst); \ register int i; \ register int bsx = pBackingStore->x; \ register int bsy = pBackingStore->y; \ for (i = n; --i >= 0; ) \ { \ *dstCopy++ = *srcCopy++ - bsx; \ *dstCopy++ = *srcCopy++ - bsy; \ morecopy \ } \ } #define copyPoints(src,dst,n,mode) \ if (mode == CoordModeOrigin) \ { \ copyData(src,dst,n,MoreCopy0); \ } \ else \ { \ memmove((char *)(dst), (char *)(src), (n) << 2); \ *((short *)(dst)) -= pBackingStore->x; \ *((short *)(dst) + 1) -= pBackingStore->y; \ } /* * wrappers for screen funcs */ static int miBSScreenIndex; static unsigned long miBSGeneration = 0; static Bool miBSCloseScreen(ScreenPtr pScreen); static void miBSGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planemask, char *pdstLine); static void miBSGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart); static Bool miBSChangeWindowAttributes(WindowPtr pWin, unsigned long mask); static Bool miBSCreateGC(GCPtr pGC); static Bool miBSDestroyWindow(WindowPtr pWin); /* * backing store screen functions */ static void miBSSaveDoomedAreas(WindowPtr pWin, RegionPtr pObscured, int dx, int dy); static RegionPtr miBSRestoreAreas(WindowPtr pWin, RegionPtr prgnExposed); static void miBSExposeCopy(WindowPtr pSrc, DrawablePtr pDst, GCPtr pGC, RegionPtr prgnExposed, int srcx, int srcy, int dstx, int dsty, unsigned long plane); static RegionPtr miBSTranslateBackingStore(WindowPtr pWin, int windx, int windy, RegionPtr oldClip, int oldx, int oldy); static RegionPtr miBSClearBackingStore(WindowPtr pWin, int x, int y, int w, int h, Bool generateExposures); static void miBSDrawGuarantee(WindowPtr pWin, GCPtr pGC, int guarantee); /* * wrapper vectors for GC funcs and ops */ static int miBSGCIndex; static void miBSValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable); static void miBSCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); static void miBSDestroyGC(GCPtr pGC); static void miBSChangeGC(GCPtr pGC, unsigned long mask); static void miBSChangeClip(GCPtr pGC, int type, void * pvalue, int nrects); static void miBSDestroyClip(GCPtr pGC); static void miBSCopyClip(GCPtr pgcDst, GCPtr pgcSrc); static GCFuncs miBSGCFuncs = { miBSValidateGC, miBSChangeGC, miBSCopyGC, miBSDestroyGC, miBSChangeClip, miBSDestroyClip, miBSCopyClip, }; static void miBSFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted); static void miBSSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted); static void miBSPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pBits); static RegionPtr miBSCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty); static RegionPtr miBSCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long plane); static void miBSPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, xPoint *pptInit); static void miBSPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit); static void miBSPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs); static void miBSPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, xRectangle *pRects); static void miBSPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs); static void miBSFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode, int count, DDXPointPtr pPts); static void miBSPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit); static void miBSPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs); static int miBSPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars); static int miBSPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars); static void miBSImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars); static void miBSImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars); static void miBSImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void * pglyphBase); static void miBSPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, void * pglyphBase); static void miBSPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, int w, int h, int x, int y); #ifdef NEED_LINEHELPER static void miBSLineHelper(void); #endif static GCOps miBSGCOps = { miBSFillSpans, miBSSetSpans, miBSPutImage, miBSCopyArea, miBSCopyPlane, miBSPolyPoint, miBSPolylines, miBSPolySegment, miBSPolyRectangle, miBSPolyArc, miBSFillPolygon, miBSPolyFillRect, miBSPolyFillArc, miBSPolyText8, miBSPolyText16, miBSImageText8, miBSImageText16, miBSImageGlyphBlt, miBSPolyGlyphBlt, miBSPushPixels #ifdef NEED_LINEHELPER , miBSLineHelper #endif }; #define FUNC_PROLOGUE(pGC, pPriv) \ ((pGC)->funcs = pPriv->wrapFuncs),\ ((pGC)->ops = pPriv->wrapOps) #define FUNC_EPILOGUE(pGC, pPriv) \ ((pGC)->funcs = &miBSGCFuncs),\ ((pGC)->ops = &miBSGCOps) /* * every GC in the server is initially wrapped with these * "cheap" functions. This allocates no memory and is used * to discover GCs used with windows which have backing * store enabled */ static void miBSCheapValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable); static void miBSCheapCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); static void miBSCheapDestroyGC(GCPtr pGC); static void miBSCheapChangeGC(GCPtr pGC, unsigned long mask); static void miBSCheapChangeClip(GCPtr pGC, int type, void * pvalue, int nrects); static void miBSCheapDestroyClip(GCPtr pGC); static void miBSCheapCopyClip(GCPtr pgcDst, GCPtr pgcSrc); static GCFuncs miBSCheapGCFuncs = { miBSCheapValidateGC, miBSCheapChangeGC, miBSCheapCopyGC, miBSCheapDestroyGC, miBSCheapChangeClip, miBSCheapDestroyClip, miBSCheapCopyClip, }; #define CHEAP_FUNC_PROLOGUE(pGC) \ ((pGC)->funcs = (GCFuncs *) (pGC)->devPrivates[miBSGCIndex].ptr) #define CHEAP_FUNC_EPILOGUE(pGC) \ ((pGC)->funcs = &miBSCheapGCFuncs) /* * called from device screen initialization proc. Gets a GCPrivateIndex * and wraps appropriate per-screen functions. pScreen->BackingStoreFuncs * must be previously initialized. */ void miInitializeBackingStore (pScreen) ScreenPtr pScreen; { miBSScreenPtr pScreenPriv; if (miBSGeneration != serverGeneration) { miBSScreenIndex = AllocateScreenPrivateIndex (); if (miBSScreenIndex < 0) return; miBSGCIndex = AllocateGCPrivateIndex (); miBSGeneration = serverGeneration; } if (!AllocateGCPrivate(pScreen, miBSGCIndex, 0)) return; pScreenPriv = (miBSScreenPtr) malloc (sizeof (miBSScreenRec)); if (!pScreenPriv) return; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreenPriv->GetImage = pScreen->GetImage; pScreenPriv->GetSpans = pScreen->GetSpans; pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes; pScreenPriv->CreateGC = pScreen->CreateGC; pScreenPriv->DestroyWindow = pScreen->DestroyWindow; pScreen->CloseScreen = miBSCloseScreen; pScreen->GetImage = miBSGetImage; pScreen->GetSpans = miBSGetSpans; pScreen->ChangeWindowAttributes = miBSChangeWindowAttributes; pScreen->CreateGC = miBSCreateGC; pScreen->DestroyWindow = miBSDestroyWindow; pScreen->SaveDoomedAreas = miBSSaveDoomedAreas; pScreen->RestoreAreas = miBSRestoreAreas; pScreen->ExposeCopy = miBSExposeCopy; pScreen->TranslateBackingStore = miBSTranslateBackingStore; pScreen->ClearBackingStore = miBSClearBackingStore; pScreen->DrawGuarantee = miBSDrawGuarantee; pScreen->devPrivates[miBSScreenIndex].ptr = (void *) pScreenPriv; } /* * Screen function wrappers */ #define SCREEN_PROLOGUE(pScreen, field)\ ((pScreen)->field = \ ((miBSScreenPtr) \ (pScreen)->devPrivates[miBSScreenIndex].ptr)->field) #define SCREEN_EPILOGUE(pScreen, field, wrapper)\ ((pScreen)->field = wrapper) /* * CloseScreen wrapper -- unwrap everything, free the private data * and call the wrapped function */ static Bool miBSCloseScreen (pScreen) ScreenPtr pScreen; { miBSScreenPtr pScreenPriv; pScreenPriv = (miBSScreenPtr) pScreen->devPrivates[miBSScreenIndex].ptr; pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->GetImage = pScreenPriv->GetImage; pScreen->GetSpans = pScreenPriv->GetSpans; pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes; pScreen->CreateGC = pScreenPriv->CreateGC; free ((void *) pScreenPriv); return (*pScreen->CloseScreen) (pScreen); } static void miBSFillVirtualBits(DrawablePtr pDrawable, GCPtr pGC, RegionPtr pRgn, int x, int y, int state, PixUnion pixunion, unsigned long planemask); static void miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine) DrawablePtr pDrawable; int sx, sy, w, h; unsigned int format; unsigned long planemask; char *pdstLine; { ScreenPtr pScreen = pDrawable->pScreen; BoxRec bounds; unsigned char depth; SCREEN_PROLOGUE (pScreen, GetImage); if (pDrawable->type != DRAWABLE_PIXMAP && ((WindowPtr) pDrawable)->visibility != VisibilityUnobscured) { PixmapPtr pPixmap; miBSWindowPtr pWindowPriv; GCPtr pGC = NULL; WindowPtr pWin, pSrcWin; int xoff, yoff; RegionRec Remaining; RegionRec Border; RegionRec Inside; BoxPtr pBox; int n; pWin = (WindowPtr) pDrawable; pPixmap = 0; depth = pDrawable->depth; bounds.x1 = sx + pDrawable->x; bounds.y1 = sy + pDrawable->y; bounds.x2 = bounds.x1 + w; bounds.y2 = bounds.y1 + h; RegionInit(&Remaining, &bounds, 0); for (;;) { bounds.x1 = sx + pDrawable->x - pWin->drawable.x; bounds.y1 = sy + pDrawable->y - pWin->drawable.y; bounds.x2 = bounds.x1 + w; bounds.y2 = bounds.y1 + h; if (pWin->viewable && pWin->backStorage && pWin->drawable.depth == depth && (RegionContainsRect(&(pWindowPriv = (miBSWindowPtr) pWin->backStorage)->SavedRegion, &bounds) != rgnOUT || RegionContainsRect(&Remaining, RegionExtents(&pWin->borderSize)) != rgnOUT)) { if (!pPixmap) { XID subWindowMode = IncludeInferiors; int x, y; pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, depth, CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) goto punt; pGC = GetScratchGC (depth, pScreen); if (!pGC) { (*pScreen->DestroyPixmap) (pPixmap); goto punt; } ChangeGC (pGC, GCSubwindowMode, &subWindowMode); ValidateGC ((DrawablePtr)pPixmap, pGC); RegionNull(&Border); RegionNull(&Inside); pSrcWin = (WindowPtr) pDrawable; x = sx; y = sy; if (pSrcWin->parent) { x += pSrcWin->origin.x; y += pSrcWin->origin.y; pSrcWin = pSrcWin->parent; } (*pGC->ops->CopyArea) ((DrawablePtr)pSrcWin, (DrawablePtr)pPixmap, pGC, x, y, w, h, 0, 0); RegionSubtract(&Remaining, &Remaining, &((WindowPtr) pDrawable)->borderClip); } RegionIntersect(&Inside, &Remaining, &pWin->winSize); RegionTranslate(&Inside, -pWin->drawable.x, -pWin->drawable.y); RegionIntersect(&Inside, &Inside, &pWindowPriv->SavedRegion); /* offset of sub-window in GetImage pixmap */ xoff = pWin->drawable.x - pDrawable->x - sx; yoff = pWin->drawable.y - pDrawable->y - sy; if (RegionNumRects(&Inside) > 0) { switch (pWindowPriv->status) { case StatusContents: pBox = RegionRects(&Inside); for (n = RegionNumRects(&Inside); --n >= 0;) { (*pGC->ops->CopyArea) ( (DrawablePtr)pWindowPriv->pBackingPixmap, (DrawablePtr)pPixmap, pGC, pBox->x1 - pWindowPriv->x, pBox->y1 - pWindowPriv->y, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + xoff, pBox->y1 + yoff); ++pBox; } break; case StatusVirtual: case StatusVDirty: if (pWindowPriv->backgroundState == BackgroundPixmap || pWindowPriv->backgroundState == BackgroundPixel) miBSFillVirtualBits ((DrawablePtr) pPixmap, pGC, &Inside, xoff, yoff, (int) pWindowPriv->backgroundState, pWindowPriv->background, ~0L); break; } } RegionSubtract(&Border, &pWin->borderSize, &pWin->winSize); RegionIntersect(&Border, &Border, &Remaining); if (RegionNumRects(&Border) > 0) { RegionTranslate(&Border, -pWin->drawable.x, -pWin->drawable.y); miBSFillVirtualBits ((DrawablePtr) pPixmap, pGC, &Border, xoff, yoff, pWin->borderIsPixel ? (int)BackgroundPixel : (int)BackgroundPixmap, pWin->border, ~0L); } } if (pWin->viewable && pWin->firstChild) pWin = pWin->firstChild; else { while (!pWin->nextSib && pWin != (WindowPtr) pDrawable) pWin = pWin->parent; if (pWin == (WindowPtr) pDrawable) break; pWin = pWin->nextSib; } } RegionUninit(&Remaining); if (pPixmap) { RegionUninit(&Border); RegionUninit(&Inside); (*pScreen->GetImage) ((DrawablePtr) pPixmap, 0, 0, w, h, format, planemask, pdstLine); (*pScreen->DestroyPixmap) (pPixmap); FreeScratchGC (pGC); } else { goto punt; } } else { punt: ; (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); } SCREEN_EPILOGUE (pScreen, GetImage, miBSGetImage); } static void miBSGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart) DrawablePtr pDrawable; int wMax; DDXPointPtr ppt; int *pwidth; int nspans; char *pdstStart; { ScreenPtr pScreen = pDrawable->pScreen; BoxRec bounds; int i; WindowPtr pWin; int dx, dy; SCREEN_PROLOGUE (pScreen, GetSpans); if (pDrawable->type != DRAWABLE_PIXMAP && ((WindowPtr) pDrawable)->backStorage) { PixmapPtr pPixmap; miBSWindowPtr pWindowPriv; GCPtr pGC; pWin = (WindowPtr) pDrawable; pWindowPriv = (miBSWindowPtr) pWin->backStorage; pPixmap = pWindowPriv->pBackingPixmap; bounds.x1 = ppt->x; bounds.y1 = ppt->y; bounds.x2 = bounds.x1 + *pwidth; bounds.y2 = ppt->y; for (i = 0; i < nspans; i++) { if (ppt[i].x < bounds.x1) bounds.x1 = ppt[i].x; if (ppt[i].x + pwidth[i] > bounds.x2) bounds.x2 = ppt[i].x + pwidth[i]; if (ppt[i].y < bounds.y1) bounds.y1 = ppt[i].y; else if (ppt[i].y > bounds.y2) bounds.y2 = ppt[i].y; } switch (RegionContainsRect(&pWindowPriv->SavedRegion, &bounds)) { case rgnPART: if (!pPixmap) { miCreateBSPixmap (pWin, NullBox); if (!(pPixmap = pWindowPriv->pBackingPixmap)) break; } pWindowPriv->status = StatusNoPixmap; pGC = GetScratchGC(pPixmap->drawable.depth, pPixmap->drawable.pScreen); if (pGC) { ValidateGC ((DrawablePtr) pPixmap, pGC); (*pGC->ops->CopyArea) (pDrawable, (DrawablePtr) pPixmap, pGC, bounds.x1, bounds.y1, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1, bounds.x1 + pPixmap->drawable.x - pWin->drawable.x - pWindowPriv->x, bounds.y1 + pPixmap->drawable.y - pWin->drawable.y - pWindowPriv->y); FreeScratchGC(pGC); } pWindowPriv->status = StatusContents; /* fall through */ case rgnIN: if (!pPixmap) { miCreateBSPixmap (pWin, NullBox); if (!(pPixmap = pWindowPriv->pBackingPixmap)) break; } dx = pPixmap->drawable.x - pWin->drawable.x - pWindowPriv->x; dy = pPixmap->drawable.y - pWin->drawable.y - pWindowPriv->y; for (i = 0; i < nspans; i++) { ppt[i].x += dx; ppt[i].y += dy; } (*pScreen->GetSpans) ((DrawablePtr) pPixmap, wMax, ppt, pwidth, nspans, pdstStart); break; case rgnOUT: (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); break; } } else { (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); } SCREEN_EPILOGUE (pScreen, GetSpans, miBSGetSpans); } static Bool miBSChangeWindowAttributes (pWin, mask) WindowPtr pWin; unsigned long mask; { ScreenPtr pScreen; Bool ret; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, ChangeWindowAttributes); ret = (*pScreen->ChangeWindowAttributes) (pWin, mask); if (ret && (mask & CWBackingStore)) { if (pWin->backingStore != NotUseful || pWin->DIXsaveUnder) miBSAllocate (pWin); else miBSFree (pWin); } SCREEN_EPILOGUE (pScreen, ChangeWindowAttributes, miBSChangeWindowAttributes); return ret; } /* * GC Create wrapper. Set up the cheap GC func wrappers to track * GC validation on BackingStore windows */ static Bool miBSCreateGC (pGC) GCPtr pGC; { ScreenPtr pScreen = pGC->pScreen; Bool ret; SCREEN_PROLOGUE (pScreen, CreateGC); if ( (ret = (*pScreen->CreateGC) (pGC)) ) { pGC->devPrivates[miBSGCIndex].ptr = (void *) pGC->funcs; pGC->funcs = &miBSCheapGCFuncs; } SCREEN_EPILOGUE (pScreen, CreateGC, miBSCreateGC); return ret; } static Bool miBSDestroyWindow (pWin) WindowPtr pWin; { ScreenPtr pScreen = pWin->drawable.pScreen; Bool ret; SCREEN_PROLOGUE (pScreen, DestroyWindow); ret = (*pScreen->DestroyWindow) (pWin); miBSFree (pWin); SCREEN_EPILOGUE (pScreen, DestroyWindow, miBSDestroyWindow); return ret; } /* * cheap GC func wrappers. Simply track validation on windows * with backing store to enable the real func/op wrappers */ static void miBSCheapValidateGC (pGC, stateChanges, pDrawable) GCPtr pGC; unsigned long stateChanges; DrawablePtr pDrawable; { CHEAP_FUNC_PROLOGUE (pGC); if (pDrawable->type != DRAWABLE_PIXMAP && ((WindowPtr) pDrawable)->backStorage != NULL && miBSCreateGCPrivate (pGC)) { (*pGC->funcs->ValidateGC) (pGC, stateChanges, pDrawable); } else { (*pGC->funcs->ValidateGC) (pGC, stateChanges, pDrawable); /* rewrap funcs as Validate may have changed them */ pGC->devPrivates[miBSGCIndex].ptr = (void *) pGC->funcs; CHEAP_FUNC_EPILOGUE (pGC); } } static void miBSCheapChangeGC (pGC, mask) GCPtr pGC; unsigned long mask; { CHEAP_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeGC) (pGC, mask); CHEAP_FUNC_EPILOGUE (pGC); } static void miBSCheapCopyGC (pGCSrc, mask, pGCDst) GCPtr pGCSrc, pGCDst; unsigned long mask; { CHEAP_FUNC_PROLOGUE (pGCDst); (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); CHEAP_FUNC_EPILOGUE (pGCDst); } static void miBSCheapDestroyGC (pGC) GCPtr pGC; { CHEAP_FUNC_PROLOGUE (pGC); (*pGC->funcs->DestroyGC) (pGC); /* leave it unwrapped */ } static void miBSCheapChangeClip (pGC, type, pvalue, nrects) GCPtr pGC; int type; void * pvalue; int nrects; { CHEAP_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); CHEAP_FUNC_EPILOGUE (pGC); } static void miBSCheapCopyClip(pgcDst, pgcSrc) GCPtr pgcDst, pgcSrc; { CHEAP_FUNC_PROLOGUE (pgcDst); (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); CHEAP_FUNC_EPILOGUE (pgcDst); } static void miBSCheapDestroyClip(pGC) GCPtr pGC; { CHEAP_FUNC_PROLOGUE (pGC); (* pGC->funcs->DestroyClip)(pGC); CHEAP_FUNC_EPILOGUE (pGC); } /* * create the full func/op wrappers for a GC */ static Bool miBSCreateGCPrivate (pGC) GCPtr pGC; { miBSGCRec *pPriv; pPriv = (miBSGCRec *) malloc (sizeof (miBSGCRec)); if (!pPriv) return FALSE; pPriv->pBackingGC = NULL; pPriv->guarantee = GuaranteeNothing; pPriv->serialNumber = 0; pPriv->stateChanges = (1 << (GCLastBit + 1)) - 1; pPriv->wrapOps = pGC->ops; pPriv->wrapFuncs = pGC->funcs; pGC->funcs = &miBSGCFuncs; pGC->ops = &miBSGCOps; pGC->devPrivates[miBSGCIndex].ptr = (void *) pPriv; return TRUE; } static void miBSDestroyGCPrivate (GCPtr pGC) { miBSGCRec *pPriv; pPriv = (miBSGCRec *) pGC->devPrivates[miBSGCIndex].ptr; if (pPriv) { pGC->devPrivates[miBSGCIndex].ptr = (void *) pPriv->wrapFuncs; pGC->funcs = &miBSCheapGCFuncs; pGC->ops = pPriv->wrapOps; if (pPriv->pBackingGC) FreeGC (pPriv->pBackingGC, (GContext) 0); free ((void *) pPriv); } } /* * GC ops -- wrap each GC operation with our own function */ /*- *----------------------------------------------------------------------- * miBSFillSpans -- * Perform a FillSpans, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSFillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GCPtr pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { DDXPointPtr pptCopy, pptReset; int *pwidthCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pptCopy = (DDXPointPtr)malloc(nInit*sizeof(DDXPointRec)); pwidthCopy=(int *)malloc(nInit*sizeof(int)); if (pptCopy && pwidthCopy) { copyData(pptInit, pptCopy, nInit, MoreCopy0); memmove((char *)pwidthCopy,(char *)pwidthInit,nInit*sizeof(int)); (* pGC->ops->FillSpans)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); if (pGC->miTranslate) { int dx, dy; int nReset; pptReset = pptCopy; dx = pDrawable->x - pBackingDrawable->x; dy = pDrawable->y - pBackingDrawable->y; nReset = nInit; while (nReset--) { pptReset->x -= dx; pptReset->y -= dy; ++pptReset; } } (* pBackingGC->ops->FillSpans)(pBackingDrawable, pBackingGC, nInit, pptCopy, pwidthCopy, fSorted); } if (pwidthCopy) free(pwidthCopy); if (pptCopy) free(pptCopy); EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSSetSpans -- * Perform a SetSpans, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSSetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted) DrawablePtr pDrawable; GCPtr pGC; char *psrc; register DDXPointPtr ppt; int *pwidth; int nspans; int fSorted; { DDXPointPtr pptCopy, pptReset; int *pwidthCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pptCopy = (DDXPointPtr)malloc(nspans*sizeof(DDXPointRec)); pwidthCopy=(int *)malloc(nspans*sizeof(int)); if (pptCopy && pwidthCopy) { copyData(ppt, pptCopy, nspans, MoreCopy0); memmove((char *)pwidthCopy,(char *)pwidth,nspans*sizeof(int)); (* pGC->ops->SetSpans)(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); if (pGC->miTranslate) { int dx, dy; int nReset; pptReset = pptCopy; dx = pDrawable->x - pBackingDrawable->x; dy = pDrawable->y - pBackingDrawable->y; nReset = nspans; while (nReset--) { pptReset->x -= dx; pptReset->y -= dy; ++pptReset; } } (* pBackingGC->ops->SetSpans)(pBackingDrawable, pBackingGC, psrc, pptCopy, pwidthCopy, nspans, fSorted); } if (pwidthCopy) free(pwidthCopy); if (pptCopy) free(pptCopy); EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPutImage -- * Perform a PutImage, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits) DrawablePtr pDrawable; GCPtr pGC; int depth; int x; int y; int w; int h; int leftPad; int format; char *pBits; { SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); (*pGC->ops->PutImage)(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits); (*pBackingGC->ops->PutImage)(pBackingDrawable, pBackingGC, depth, x - pBackingStore->x, y - pBackingStore->y, w, h, leftPad, format, pBits); EPILOGUE (pGC); } typedef RegionPtr (* CopyAreaProcPtr)(DrawablePtr, DrawablePtr, GCPtr, int, int, int, int, int, int); typedef RegionPtr (* CopyPlaneProcPtr)(DrawablePtr, DrawablePtr, GCPtr, int, int, int, int, int, int, unsigned long bitPlane); /*- *----------------------------------------------------------------------- * miBSDoCopy -- * Perform a CopyArea or CopyPlane within a window that has backing * store enabled. * * Results: * TRUE if the copy was performed or FALSE if a regular one should * be done. * * Side Effects: * Things are copied (no s***!) * * Notes: * The idea here is to form two regions that cover the source box. * One contains the exposed rectangles while the other contains * the obscured ones. An array of pairs is then * formed where the indicates the area to be copied and the * indicates from where it is to be copied (exposed regions * come from the screen while obscured ones come from the backing * pixmap). The array 'sequence' is then filled with the indices of * the pairs in the order in which they should be copied to prevent * things from getting screwed up. A call is also made through the * backingGC to take care of any copying into the backing pixmap. * *----------------------------------------------------------------------- */ static Bool miBSDoCopy( WindowPtr pWin, /* Window being scrolled */ GCPtr pGC, /* GC we're called through */ int srcx, /* X of source rectangle */ int srcy, /* Y of source rectangle */ int w, /* Width of source rectangle */ int h, /* Height of source rectangle */ int dstx, /* X of destination rectangle */ int dsty, /* Y of destination rectangle */ unsigned long plane, /* Plane to copy (0 for CopyArea) */ CopyPlaneProcPtr copyProc, /* Procedure to call to perform the copy */ RegionPtr *ppRgn) /* resultant Graphics Expose region */ { RegionPtr pRgnExp; /* Exposed region */ RegionPtr pRgnObs; /* Obscured region */ BoxRec box; /* Source box (screen coord) */ struct BoxDraw { BoxPtr pBox; /* Source box */ enum { win, pix } source; /* Place from which to copy */ } *boxes; /* Array of box/drawable pairs covering * source box. */ int *sequence; /* Sequence of boxes to move */ register int i, j, k, l, y; register BoxPtr pBox; int dx, dy, nrects; Bool graphicsExposures; CopyPlaneProcPtr pixCopyProc; int numRectsExp, numRectsObs; BoxPtr pBoxExp, pBoxObs; SETUP_BACKING (pWin, pGC); (void)oldFuncs; /* * Create a region of exposed boxes in pRgnExp. */ box.x1 = srcx + pWin->drawable.x; box.x2 = box.x1 + w; box.y1 = srcy + pWin->drawable.y; box.y2 = box.y1 + h; pRgnExp = RegionCreate(&box, 1); RegionIntersect(pRgnExp, pRgnExp, &pWin->clipList); pRgnObs = RegionCreate(NULL, 1); RegionInverse(pRgnObs, pRgnExp, &box); /* * Translate regions into window coordinates for proper calls * to the copyProc, then make sure none of the obscured region sticks * into invalid areas of the backing pixmap. */ RegionTranslate(pRgnExp, -pWin->drawable.x, -pWin->drawable.y); RegionTranslate(pRgnObs, -pWin->drawable.x, -pWin->drawable.y); RegionIntersect(pRgnObs, pRgnObs, &pBackingStore->SavedRegion); /* * If the obscured region is empty, there's no point being fancy. */ if (!RegionNotEmpty(pRgnObs)) { RegionDestroy(pRgnExp); RegionDestroy(pRgnObs); return (FALSE); } numRectsExp = RegionNumRects(pRgnExp); pBoxExp = RegionRects(pRgnExp); pBoxObs = RegionRects(pRgnObs); numRectsObs = RegionNumRects(pRgnObs); nrects = numRectsExp + numRectsObs; boxes = (struct BoxDraw *)malloc(nrects * sizeof(struct BoxDraw)); sequence = (int *) malloc(nrects * sizeof(int)); *ppRgn = NULL; if (!boxes || !sequence) { if (sequence) free(sequence); if (boxes) free(boxes); RegionDestroy(pRgnExp); RegionDestroy(pRgnObs); return(TRUE); } /* * Order the boxes in the two regions so we know from which drawable * to copy which box, storing the result in the boxes array */ for (i = 0, j = 0, k = 0; (i < numRectsExp) && (j < numRectsObs); k++) { if (pBoxExp[i].y1 < pBoxObs[j].y1) { boxes[k].pBox = &pBoxExp[i]; boxes[k].source = win; i++; } else if ((pBoxObs[j].y1 < pBoxExp[i].y1) || (pBoxObs[j].x1 < pBoxExp[i].x1)) { boxes[k].pBox = &pBoxObs[j]; boxes[k].source = pix; j++; } else { boxes[k].pBox = &pBoxExp[i]; boxes[k].source = win; i++; } } /* * Catch any leftover boxes from either region (note that only * one can have leftover boxes...) */ if (i != numRectsExp) { do { boxes[k].pBox = &pBoxExp[i]; boxes[k].source = win; i++; k++; } while (i < numRectsExp); } else { do { boxes[k].pBox = &pBoxObs[j]; boxes[k].source = pix; j++; k++; } while (j < numRectsObs); } if (dsty <= srcy) { /* * Scroll up or vertically stationary, so vertical order is ok. */ if (dstx <= srcx) { /* * Scroll left or horizontally stationary, so horizontal order * is ok as well. */ for (i = 0; i < nrects; i++) { sequence[i] = i; } } else { /* * Scroll right. Need to reverse the rectangles within each * band. */ for (i = 0, j = 1, k = 0; i < nrects; j = i + 1, k = i) { y = boxes[i].pBox->y1; while ((j < nrects) && (boxes[j].pBox->y1 == y)) { j++; } for (j--; j >= k; j--, i++) { sequence[i] = j; } } } } else { /* * Scroll down. Must reverse vertical banding, at least. */ if (dstx < srcx) { /* * Scroll left. Horizontal order is ok. */ for (i = nrects - 1, j = i - 1, k = i, l = 0; i >= 0; j = i - 1, k = i) { /* * Find extent of current horizontal band, then reverse * the order of the whole band. */ y = boxes[i].pBox->y1; while ((j >= 0) && (boxes[j].pBox->y1 == y)) { j--; } for (j++; j <= k; j++, i--, l++) { sequence[l] = j; } } } else { /* * Scroll right or horizontal stationary. * Reverse horizontal order as well (if stationary, horizontal * order can be swapped without penalty and this is faster * to compute). */ for (i = 0, j = nrects - 1; i < nrects; i++, j--) { sequence[i] = j; } } } /* * XXX: To avoid getting multiple NoExpose events from this operation, * we turn OFF graphicsExposures in the gc and deal with any uncopied * areas later, if there's something not in backing-store. */ graphicsExposures = pGC->graphicsExposures; pGC->graphicsExposures = FALSE; dx = dstx - srcx; dy = dsty - srcy; /* * Figure out which copy procedure to use from the backing GC. Note we * must do this because some implementations (sun's, e.g.) have * pBackingGC a fake GC with the real one below it, thus the devPriv for * pBackingGC won't be what the output library expects. */ if (plane != 0) { pixCopyProc = pBackingGC->ops->CopyPlane; } else { pixCopyProc = (CopyPlaneProcPtr)pBackingGC->ops->CopyArea; } for (i = 0; i < nrects; i++) { pBox = boxes[sequence[i]].pBox; /* * If we're copying from the pixmap, we need to place its contents * onto the screen before scrolling the pixmap itself. If we're copying * from the window, we need to copy its contents into the pixmap before * we scroll the window itself. */ if (boxes[sequence[i]].source == pix) { (void) (* copyProc) (pBackingDrawable, &(pWin->drawable), pGC, pBox->x1 - pBackingStore->x, pBox->y1 - pBackingStore->y, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx, pBox->y1 + dy, plane); (void) (* pixCopyProc) (pBackingDrawable, pBackingDrawable, pBackingGC, pBox->x1 - pBackingStore->x, pBox->y1 - pBackingStore->y, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx - pBackingStore->x, pBox->y1 + dy - pBackingStore->y, plane); } else { (void) (* pixCopyProc) (&(pWin->drawable), pBackingDrawable, pBackingGC, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx - pBackingStore->x, pBox->y1 + dy - pBackingStore->y, plane); (void) (* copyProc) (&(pWin->drawable), &(pWin->drawable), pGC, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx, pBox->y1 + dy, plane); } } free(sequence); free(boxes); pGC->graphicsExposures = graphicsExposures; /* * Form union of rgnExp and rgnObs and see if covers entire area * to be copied. Store the resultant region for miBSCopyArea * to return to dispatch which will send the appropriate expose * events. */ RegionUnion(pRgnExp, pRgnExp, pRgnObs); box.x1 = srcx; box.x2 = srcx + w; box.y1 = srcy; box.y2 = srcy + h; if (RegionContainsRect(pRgnExp, &box) == rgnIN) { RegionEmpty(pRgnExp); } else { RegionInverse(pRgnExp, pRgnExp, &box); RegionTranslate(pRgnExp, dx + pWin->drawable.x, dy + pWin->drawable.y); RegionIntersect(pRgnObs, pRgnExp, &pWin->clipList); (*pWin->drawable.pScreen->PaintWindowBackground) (pWin, pRgnObs, PW_BACKGROUND); RegionTranslate(pRgnExp, -pWin->drawable.x, -pWin->drawable.y); miBSClearBackingRegion (pWin, pRgnExp); } if (graphicsExposures) *ppRgn = pRgnExp; else RegionDestroy(pRgnExp); RegionDestroy(pRgnObs); return (TRUE); } /*- *----------------------------------------------------------------------- * miBSCopyArea -- * Perform a CopyArea from the source to the destination, extracting * from the source's backing-store and storing into the destination's * backing-store without messing anything up. If the source and * destination are different, there's not too much to worry about: * we can just issue several calls to the regular CopyArea function. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static RegionPtr miBSCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty) DrawablePtr pSrc; DrawablePtr pDst; GCPtr pGC; int srcx; int srcy; int w; int h; int dstx; int dsty; { BoxPtr pExtents; long dx, dy; int bsrcx, bsrcy, bw, bh, bdstx, bdsty; RegionPtr pixExposed = 0, winExposed = 0; SETUP_BACKING(pDst, pGC); PROLOGUE(pGC); if ((pSrc != pDst) || (!miBSDoCopy((WindowPtr)pSrc, pGC, srcx, srcy, w, h, dstx, dsty, (unsigned long) 0, (CopyPlaneProcPtr)pGC->ops->CopyArea, &winExposed))) { /* * always copy to the backing store first, miBSDoCopy * returns FALSE if the *source* region is disjoint * from the backing store saved region. So, copying * *to* the backing store is always safe */ if (pGC->clientClipType != CT_PIXMAP) { /* * adjust srcx, srcy, w, h, dstx, dsty to be clipped to * the backing store. An unnecessary optimisation, * but a useful one when GetSpans is slow. */ pExtents = RegionExtents( (RegionPtr)pBackingGC->clientClip); bsrcx = srcx; bsrcy = srcy; bw = w; bh = h; bdstx = dstx; bdsty = dsty; dx = pExtents->x1 - bdstx; if (dx > 0) { bsrcx += dx; bdstx += dx; bw -= dx; } dy = pExtents->y1 - bdsty; if (dy > 0) { bsrcy += dy; bdsty += dy; bh -= dy; } dx = (bdstx + bw) - pExtents->x2; if (dx > 0) bw -= dx; dy = (bdsty + bh) - pExtents->y2; if (dy > 0) bh -= dy; if (bw > 0 && bh > 0) pixExposed = (* pBackingGC->ops->CopyArea) (pSrc, pBackingDrawable, pBackingGC, bsrcx, bsrcy, bw, bh, bdstx - pBackingStore->x, bdsty - pBackingStore->y); } else pixExposed = (* pBackingGC->ops->CopyArea) (pSrc, pBackingDrawable, pBackingGC, srcx, srcy, w, h, dstx - pBackingStore->x, dsty - pBackingStore->y); winExposed = (* pGC->ops->CopyArea) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); } /* * compute the composite graphics exposure region */ if (winExposed) { if (pixExposed){ RegionUnion(winExposed, winExposed, pixExposed); RegionDestroy(pixExposed); } } else winExposed = pixExposed; EPILOGUE (pGC); return winExposed; } /*- *----------------------------------------------------------------------- * miBSCopyPlane -- * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static RegionPtr miBSCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane) DrawablePtr pSrc; DrawablePtr pDst; register GC *pGC; int srcx, srcy; int w, h; int dstx, dsty; unsigned long plane; { BoxPtr pExtents; long dx, dy; int bsrcx, bsrcy, bw, bh, bdstx, bdsty; RegionPtr winExposed = 0, pixExposed = 0; SETUP_BACKING(pDst, pGC); PROLOGUE(pGC); if ((pSrc != pDst) || (!miBSDoCopy((WindowPtr)pSrc, pGC, srcx, srcy, w, h, dstx, dsty, plane, pGC->ops->CopyPlane, &winExposed))) { /* * always copy to the backing store first, miBSDoCopy * returns FALSE if the *source* region is disjoint * from the backing store saved region. So, copying * *to* the backing store is always safe */ if (pGC->clientClipType != CT_PIXMAP) { /* * adjust srcx, srcy, w, h, dstx, dsty to be clipped to * the backing store. An unnecessary optimisation, * but a useful one when GetSpans is slow. */ pExtents = RegionExtents( (RegionPtr)pBackingGC->clientClip); bsrcx = srcx; bsrcy = srcy; bw = w; bh = h; bdstx = dstx; bdsty = dsty; dx = pExtents->x1 - bdstx; if (dx > 0) { bsrcx += dx; bdstx += dx; bw -= dx; } dy = pExtents->y1 - bdsty; if (dy > 0) { bsrcy += dy; bdsty += dy; bh -= dy; } dx = (bdstx + bw) - pExtents->x2; if (dx > 0) bw -= dx; dy = (bdsty + bh) - pExtents->y2; if (dy > 0) bh -= dy; if (bw > 0 && bh > 0) pixExposed = (* pBackingGC->ops->CopyPlane) (pSrc, pBackingDrawable, pBackingGC, bsrcx, bsrcy, bw, bh, bdstx - pBackingStore->x, bdsty - pBackingStore->y, plane); } else pixExposed = (* pBackingGC->ops->CopyPlane) (pSrc, pBackingDrawable, pBackingGC, srcx, srcy, w, h, dstx - pBackingStore->x, dsty - pBackingStore->y, plane); winExposed = (* pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane); } /* * compute the composite graphics exposure region */ if (winExposed) { if (pixExposed) { RegionUnion(winExposed, winExposed, pixExposed); RegionDestroy(pixExposed); } } else winExposed = pixExposed; EPILOGUE (pGC); return winExposed; } /*- *----------------------------------------------------------------------- * miBSPolyPoint -- * Perform a PolyPoint, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolyPoint (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; /* Origin or Previous */ int npt; xPoint *pptInit; { xPoint *pptCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pptCopy = (xPoint *)malloc(npt*sizeof(xPoint)); if (pptCopy) { copyPoints(pptInit, pptCopy, npt, mode); (* pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pptInit); (* pBackingGC->ops->PolyPoint) (pBackingDrawable, pBackingGC, mode, npt, pptCopy); free(pptCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolyLines -- * Perform a Polylines, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolylines (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; int npt; DDXPointPtr pptInit; { DDXPointPtr pptCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pptCopy = (DDXPointPtr)malloc(npt*sizeof(DDXPointRec)); if (pptCopy) { copyPoints(pptInit, pptCopy, npt, mode); (* pGC->ops->Polylines)(pDrawable, pGC, mode, npt, pptInit); (* pBackingGC->ops->Polylines)(pBackingDrawable, pBackingGC, mode, npt, pptCopy); free(pptCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolySegment -- * Perform a PolySegment, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolySegment(pDrawable, pGC, nseg, pSegs) DrawablePtr pDrawable; GCPtr pGC; int nseg; xSegment *pSegs; { xSegment *pSegsCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pSegsCopy = (xSegment *)malloc(nseg*sizeof(xSegment)); if (pSegsCopy) { copyData(pSegs, pSegsCopy, nseg << 1, MoreCopy0); (* pGC->ops->PolySegment)(pDrawable, pGC, nseg, pSegs); (* pBackingGC->ops->PolySegment)(pBackingDrawable, pBackingGC, nseg, pSegsCopy); free(pSegsCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolyRectangle -- * Perform a PolyRectangle, routing output to backing-store as needed. * * Results: * None * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolyRectangle(pDrawable, pGC, nrects, pRects) DrawablePtr pDrawable; GCPtr pGC; int nrects; xRectangle *pRects; { xRectangle *pRectsCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pRectsCopy =(xRectangle *)malloc(nrects*sizeof(xRectangle)); if (pRectsCopy) { copyData(pRects, pRectsCopy, nrects, MoreCopy2); (* pGC->ops->PolyRectangle)(pDrawable, pGC, nrects, pRects); (* pBackingGC->ops->PolyRectangle)(pBackingDrawable, pBackingGC, nrects, pRectsCopy); free(pRectsCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolyArc -- * Perform a PolyArc, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolyArc(pDrawable, pGC, narcs, parcs) DrawablePtr pDrawable; GCPtr pGC; int narcs; xArc *parcs; { xArc *pArcsCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pArcsCopy = (xArc *)malloc(narcs*sizeof(xArc)); if (pArcsCopy) { copyData(parcs, pArcsCopy, narcs, MoreCopy4); (* pGC->ops->PolyArc)(pDrawable, pGC, narcs, parcs); (* pBackingGC->ops->PolyArc)(pBackingDrawable, pBackingGC, narcs, pArcsCopy); free(pArcsCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSFillPolygon -- * Perform a FillPolygon, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSFillPolygon(pDrawable, pGC, shape, mode, count, pPts) DrawablePtr pDrawable; register GCPtr pGC; int shape, mode; register int count; DDXPointPtr pPts; { DDXPointPtr pPtsCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pPtsCopy = (DDXPointPtr)malloc(count*sizeof(DDXPointRec)); if (pPtsCopy) { copyPoints(pPts, pPtsCopy, count, mode); (* pGC->ops->FillPolygon)(pDrawable, pGC, shape, mode, count, pPts); (* pBackingGC->ops->FillPolygon)(pBackingDrawable, pBackingGC, shape, mode, count, pPtsCopy); free(pPtsCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolyFillRect -- * Perform a PolyFillRect, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolyFillRect(pDrawable, pGC, nrectFill, prectInit) DrawablePtr pDrawable; GCPtr pGC; int nrectFill; /* number of rectangles to fill */ xRectangle *prectInit; /* Pointer to first rectangle to fill */ { xRectangle *pRectCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pRectCopy = (xRectangle *)malloc(nrectFill*sizeof(xRectangle)); if (pRectCopy) { copyData(prectInit, pRectCopy, nrectFill, MoreCopy2); (* pGC->ops->PolyFillRect)(pDrawable, pGC, nrectFill, prectInit); (* pBackingGC->ops->PolyFillRect)(pBackingDrawable, pBackingGC, nrectFill, pRectCopy); free(pRectCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolyFillArc -- * Perform a PolyFillArc, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolyFillArc(pDrawable, pGC, narcs, parcs) DrawablePtr pDrawable; GCPtr pGC; int narcs; xArc *parcs; { xArc *pArcsCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pArcsCopy = (xArc *)malloc(narcs*sizeof(xArc)); if (pArcsCopy) { copyData(parcs, pArcsCopy, narcs, MoreCopy4); (* pGC->ops->PolyFillArc)(pDrawable, pGC, narcs, parcs); (* pBackingGC->ops->PolyFillArc)(pBackingDrawable, pBackingGC, narcs, pArcsCopy); free(pArcsCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolyText8 -- * Perform a PolyText8, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static int miBSPolyText8(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; char *chars; { int result; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); result = (* pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars); (* pBackingGC->ops->PolyText8)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, count, chars); EPILOGUE (pGC); return result; } /*- *----------------------------------------------------------------------- * miBSPolyText16 -- * Perform a PolyText16, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static int miBSPolyText16(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; unsigned short *chars; { int result; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); result = (* pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars); (* pBackingGC->ops->PolyText16)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, count, chars); EPILOGUE (pGC); return result; } /*- *----------------------------------------------------------------------- * miBSImageText8 -- * Perform a ImageText8, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSImageText8(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; char *chars; { SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); (* pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars); (* pBackingGC->ops->ImageText8)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, count, chars); EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSImageText16 -- * Perform a ImageText16, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSImageText16(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; unsigned short *chars; { SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); (* pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars); (* pBackingGC->ops->ImageText16)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, count, chars); EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSImageGlyphBlt -- * Perform a ImageGlyphBlt, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ void * pglyphBase; /* start of array of glyphs */ { SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); (* pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); (* pBackingGC->ops->ImageGlyphBlt)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, nglyph, ppci, pglyphBase); EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolyGlyphBlt -- * Perform a PolyGlyphBlt, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ void * pglyphBase; /* start of array of glyphs */ { SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); (* pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); (* pBackingGC->ops->PolyGlyphBlt)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, nglyph, ppci, pglyphBase); EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPushPixels -- * Perform a PushPixels, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPushPixels(pGC, pBitMap, pDst, w, h, x, y) GCPtr pGC; PixmapPtr pBitMap; DrawablePtr pDst; int w, h, x, y; { SETUP_BACKING (pDst, pGC); PROLOGUE(pGC); (* pGC->ops->PushPixels)(pGC, pBitMap, pDst, w, h, x, y); if (pGC->miTranslate) { x -= pDst->x; y -= pDst->y; } (* pBackingGC->ops->PushPixels)(pBackingGC, pBitMap, pBackingDrawable, w, h, x - pBackingStore->x, y - pBackingStore->y); EPILOGUE (pGC); } #ifdef NEED_LINEHELPER /*- *----------------------------------------------------------------------- * miBSLineHelper -- * * Results: should never be called * * Side Effects: server dies * *----------------------------------------------------------------------- */ static void miBSLineHelper() { FatalError("miBSLineHelper called\n"); } #endif /*- *----------------------------------------------------------------------- * miBSClearBackingStore -- * Clear the given area of the backing pixmap with the background of * the window, whatever it is. If generateExposures is TRUE, generate * exposure events for the area. Note that if the area has any * part outside the saved portions of the window, we do not allow the * count in the expose events to be 0, since there will be more * expose events to come. * * Results: * None. * * Side Effects: * Areas of pixmap are cleared and Expose events are generated. * *----------------------------------------------------------------------- */ static RegionPtr miBSClearBackingStore(pWin, x, y, w, h, generateExposures) WindowPtr pWin; int x; int y; int w; int h; Bool generateExposures; { RegionPtr pRgn; int i; miBSWindowPtr pBackingStore; ScreenPtr pScreen; GCPtr pGC; int ts_x_origin, ts_y_origin; void *gcvalues[4]; unsigned long gcmask; xRectangle *rects; BoxPtr pBox; BoxRec box; PixUnion background; char backgroundState; int numRects; pBackingStore = (miBSWindowPtr)pWin->backStorage; pScreen = pWin->drawable.pScreen; if ((pBackingStore->status == StatusNoPixmap) || (pBackingStore->status == StatusBadAlloc)) return NullRegion; if (w == 0) w = (int) pWin->drawable.width - x; if (h == 0) h = (int) pWin->drawable.height - y; box.x1 = x; box.y1 = y; box.x2 = x + w; box.y2 = y + h; pRgn = RegionCreate(&box, 1); if (!pRgn) return NullRegion; RegionIntersect(pRgn, pRgn, &pBackingStore->SavedRegion); if (RegionNotEmpty(pRgn)) { /* * if clearing entire window, simply make new virtual * tile. For the root window, we also destroy the pixmap * to save a pile of memory */ if (x == 0 && y == 0 && w == pWin->drawable.width && h == pWin->drawable.height) { if (!pWin->parent) miDestroyBSPixmap (pWin); if (pBackingStore->status != StatusContents) miTileVirtualBS (pWin); } ts_x_origin = ts_y_origin = 0; backgroundState = pWin->backgroundState; background = pWin->background; if (backgroundState == ParentRelative) { WindowPtr pParent; pParent = pWin; while (pParent->backgroundState == ParentRelative) { ts_x_origin -= pParent->origin.x; ts_y_origin -= pParent->origin.y; pParent = pParent->parent; } backgroundState = pParent->backgroundState; background = pParent->background; } if ((backgroundState != None) && ((pBackingStore->status == StatusContents) || !SameBackground (pBackingStore->backgroundState, pBackingStore->background, backgroundState, background))) { if (!pBackingStore->pBackingPixmap) miCreateBSPixmap(pWin, NullBox); pGC = GetScratchGC(pWin->drawable.depth, pScreen); if (pGC && pBackingStore->pBackingPixmap) { /* * First take care of any ParentRelative stuff by altering the * tile/stipple origin to match the coordinates of the upper-left * corner of the first ancestor without a ParentRelative background. * This coordinate is, of course, negative. */ if (backgroundState == BackgroundPixel) { gcvalues[0] = (void *) background.pixel; gcvalues[1] = (void *)FillSolid; gcmask = GCForeground|GCFillStyle; } else { gcvalues[0] = (void *)FillTiled; gcvalues[1] = (void *) background.pixmap; gcmask = GCFillStyle|GCTile; } gcvalues[2] = (void *)(long)(ts_x_origin - pBackingStore->x); gcvalues[3] = (void *)(long)(ts_y_origin - pBackingStore->y); gcmask |= GCTileStipXOrigin|GCTileStipYOrigin; DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE); ValidateGC((DrawablePtr)pBackingStore->pBackingPixmap, pGC); /* * Figure out the array of rectangles to fill and fill them with * PolyFillRect in the proper mode, as set in the GC above. */ numRects = RegionNumRects(pRgn); rects = (xRectangle *)malloc(numRects*sizeof(xRectangle)); if (rects) { for (i = 0, pBox = RegionRects(pRgn); i < numRects; i++, pBox++) { rects[i].x = pBox->x1 - pBackingStore->x; rects[i].y = pBox->y1 - pBackingStore->y; rects[i].width = pBox->x2 - pBox->x1; rects[i].height = pBox->y2 - pBox->y1; } (* pGC->ops->PolyFillRect) ( (DrawablePtr)pBackingStore->pBackingPixmap, pGC, numRects, rects); free(rects); } FreeScratchGC(pGC); } } if (!generateExposures) { RegionDestroy(pRgn); pRgn = NULL; } else { /* * result must be screen relative, but is currently * drawable relative. */ RegionTranslate(pRgn, pWin->drawable.x, pWin->drawable.y); } } else { RegionDestroy(pRgn); pRgn = NULL; } return pRgn; } static void miBSClearBackingRegion (pWin, pRgn) WindowPtr pWin; RegionPtr pRgn; { BoxPtr pBox; int i; i = RegionNumRects(pRgn); pBox = RegionRects(pRgn); while (i--) { (void) miBSClearBackingStore(pWin, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, FALSE); pBox++; } } /* * fill a region of the destination with virtual bits * * pRgn is to be translated by (x,y) */ static void miBSFillVirtualBits (pDrawable, pGC, pRgn, x, y, state, pixunion, planeMask) DrawablePtr pDrawable; GCPtr pGC; RegionPtr pRgn; int x, y; int state; PixUnion pixunion; unsigned long planeMask; { int i; BITS32 gcmask; void * gcval[5]; xRectangle *pRect; BoxPtr pBox; WindowPtr pWin; int numRects; if (state == None) return; numRects = RegionNumRects(pRgn); pRect = (xRectangle *)malloc(numRects * sizeof(xRectangle)); if (!pRect) return; pWin = 0; if (pDrawable->type != DRAWABLE_PIXMAP) { pWin = (WindowPtr) pDrawable; if (!pWin->backStorage) pWin = 0; } i = 0; gcmask = 0; gcval[i++] = (void *)planeMask; gcmask |= GCPlaneMask; if (state == BackgroundPixel) { if (pGC->fgPixel != pixunion.pixel) { gcval[i++] = (void *)pixunion.pixel; gcmask |= GCForeground; } if (pGC->fillStyle != FillSolid) { gcval[i++] = (void *)FillSolid; gcmask |= GCFillStyle; } } else { if (pGC->fillStyle != FillTiled) { gcval[i++] = (void *)FillTiled; gcmask |= GCFillStyle; } if (pGC->tileIsPixel || pGC->tile.pixmap != pixunion.pixmap) { gcval[i++] = (void *)pixunion.pixmap; gcmask |= GCTile; } if (pGC->patOrg.x != x) { gcval[i++] = (void *)(long)x; gcmask |= GCTileStipXOrigin; } if (pGC->patOrg.y != y) { gcval[i++] = (void *)(long)y; gcmask |= GCTileStipYOrigin; } } if (gcmask) DoChangeGC (pGC, gcmask, (XID *)gcval, 1); if (pWin) (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack); if (pDrawable->serialNumber != pGC->serialNumber) ValidateGC (pDrawable, pGC); pBox = RegionRects(pRgn); for (i = numRects; --i >= 0; pBox++, pRect++) { pRect->x = pBox->x1 + x; pRect->y = pBox->y1 + y; pRect->width = pBox->x2 - pBox->x1; pRect->height = pBox->y2 - pBox->y1; } pRect -= numRects; (*pGC->ops->PolyFillRect) (pDrawable, pGC, numRects, pRect); if (pWin) (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing); free (pRect); } /*- *----------------------------------------------------------------------- * miBSAllocate -- * Create and install backing store info for a window * *----------------------------------------------------------------------- */ static void miBSAllocate(pWin) WindowPtr pWin; { register miBSWindowPtr pBackingStore; if (pWin->drawable.pScreen->backingStoreSupport == NotUseful) return; if (!(pBackingStore = (miBSWindowPtr)pWin->backStorage)) { pBackingStore = (miBSWindowPtr)malloc(sizeof(miBSWindowRec)); if (!pBackingStore) return; pBackingStore->pBackingPixmap = NullPixmap; pBackingStore->x = 0; pBackingStore->y = 0; RegionNull(&pBackingStore->SavedRegion); pBackingStore->viewable = (char)pWin->viewable; pBackingStore->status = StatusNoPixmap; pBackingStore->backgroundState = None; pWin->backStorage = (void *) pBackingStore; } /* * Now want to initialize the backing pixmap and SavedRegion if * necessary. The initialization consists of finding all the * currently-obscured regions, by taking the inverse of the window's * clip list, storing the result in SavedRegion, and exposing those * areas of the window. */ if (pBackingStore->status == StatusNoPixmap && ((pWin->backingStore == WhenMapped && pWin->viewable) || (pWin->backingStore == Always))) { BoxRec box; RegionPtr pSavedRegion; pSavedRegion = &pBackingStore->SavedRegion; box.x1 = pWin->drawable.x; box.x2 = box.x1 + (int) pWin->drawable.width; box.y1 = pWin->drawable.y; box.y2 = pWin->drawable.y + (int) pWin->drawable.height; RegionInverse(pSavedRegion, &pWin->clipList, &box); RegionTranslate(pSavedRegion, -pWin->drawable.x, -pWin->drawable.y); #ifdef SHAPE if (wBoundingShape (pWin)) RegionIntersect(pSavedRegion, pSavedRegion, wBoundingShape (pWin)); if (wClipShape (pWin)) RegionIntersect(pSavedRegion, pSavedRegion, wClipShape (pWin)); #endif /* if window is already on-screen, assume it has been drawn to */ if (pWin->viewable) pBackingStore->status = StatusVDirty; miTileVirtualBS (pWin); /* * deliver all the newly available regions * as exposure events to the window */ miSendExposures(pWin, pSavedRegion, 0, 0); } else if (!pWin->viewable) { /* * Turn off backing store when we're not supposed to * be saving anything */ if (pBackingStore->status != StatusNoPixmap) { RegionEmpty(&pBackingStore->SavedRegion); miDestroyBSPixmap (pWin); } } } /*- *----------------------------------------------------------------------- * miBSFree -- * Destroy and free all the stuff associated with the backing-store * for the given window. * * Results: * None. * * Side Effects: * The backing pixmap and all the regions and GC's are destroyed. * *----------------------------------------------------------------------- */ static void miBSFree(pWin) WindowPtr pWin; { miBSWindowPtr pBackingStore; pBackingStore = (miBSWindowPtr)pWin->backStorage; if (pBackingStore) { miDestroyBSPixmap (pWin); RegionUninit(&pBackingStore->SavedRegion); free(pBackingStore); pWin->backStorage = NULL; } } /*- *----------------------------------------------------------------------- * miResizeBackingStore -- * Alter the size of the backing pixmap as necessary when the * SavedRegion changes size. The contents of the old pixmap are * copied/shifted into the new/same pixmap. * * Results: * The new Pixmap is created as necessary. * * Side Effects: * The old pixmap is destroyed. * *----------------------------------------------------------------------- */ static void miResizeBackingStore( WindowPtr pWin, int dx, /* bits are moving this far */ int dy, /* bits are moving this far */ Bool saveBits) /* bits are useful */ { miBSWindowPtr pBackingStore; PixmapPtr pBackingPixmap; ScreenPtr pScreen; GC *pGC; BoxPtr extents; PixmapPtr pNewPixmap; int nx, ny; int nw, nh; pBackingStore = (miBSWindowPtr)(pWin->backStorage); pBackingPixmap = pBackingStore->pBackingPixmap; if (!pBackingPixmap) return; pScreen = pWin->drawable.pScreen; extents = RegionExtents(&pBackingStore->SavedRegion); pNewPixmap = pBackingPixmap; nw = extents->x2 - extents->x1; nh = extents->y2 - extents->y1; /* the policy here could be more sophisticated */ if (nw != pBackingPixmap->drawable.width || nh != pBackingPixmap->drawable.height) { if (!saveBits || !nw || !nh) { pNewPixmap = NullPixmap; pBackingStore->status = StatusNoPixmap; } else { pNewPixmap = (PixmapPtr)(*pScreen->CreatePixmap) (pScreen, nw, nh, pWin->drawable.depth, 0); if (!pNewPixmap) { #ifdef BSEAGER pBackingStore->status = StatusNoPixmap; #else pBackingStore->status = StatusBadAlloc; #endif } } } if (!pNewPixmap) { pBackingStore->x = 0; pBackingStore->y = 0; } else { nx = pBackingStore->x - extents->x1 + dx; ny = pBackingStore->y - extents->y1 + dy; pBackingStore->x = extents->x1; pBackingStore->y = extents->y1; if (saveBits && (pNewPixmap != pBackingPixmap || nx != 0 || ny != 0)) { pGC = GetScratchGC(pNewPixmap->drawable.depth, pScreen); if (pGC) { ValidateGC((DrawablePtr)pNewPixmap, pGC); /* if we implement a policy where the pixmap can be larger than * the region extents, we might want to optimize this copyarea * by only copying the old extents, rather than the entire * pixmap */ (*pGC->ops->CopyArea)((DrawablePtr)pBackingPixmap, (DrawablePtr)pNewPixmap, pGC, 0, 0, pBackingPixmap->drawable.width, pBackingPixmap->drawable.height, nx, ny); FreeScratchGC(pGC); } } } /* SavedRegion is used in the backingGC clip; force an update */ pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pNewPixmap != pBackingPixmap) { (* pScreen->DestroyPixmap)(pBackingPixmap); pBackingStore->pBackingPixmap = pNewPixmap; } } /*- *----------------------------------------------------------------------- * miBSSaveDoomedAreas -- * Saved the areas of the given window that are about to be * obscured. If the window has moved, pObscured is expected to * be at the new screen location and (dx,dy) is expected to be the offset * to the window's previous location. * * Results: * None. * * Side Effects: * The region is copied from the screen into pBackingPixmap and * SavedRegion is updated. * *----------------------------------------------------------------------- */ static void miBSSaveDoomedAreas(pWin, pObscured, dx, dy) register WindowPtr pWin; RegionPtr pObscured; int dx, dy; { miBSWindowPtr pBackingStore; ScreenPtr pScreen; int x, y; pBackingStore = (miBSWindowPtr)pWin->backStorage; pScreen = pWin->drawable.pScreen; /* * If the window isn't realized, it's being unmapped, thus we don't * want to save anything if backingStore isn't Always. */ if (!pWin->realized) { pBackingStore->viewable = (char)pWin->viewable; if (pWin->backingStore != Always) { RegionEmpty(&pBackingStore->SavedRegion); miDestroyBSPixmap (pWin); return; } if (pBackingStore->status == StatusBadAlloc) pBackingStore->status = StatusNoPixmap; } /* Don't even pretend to save anything for a virtual background None */ if ((pBackingStore->status == StatusVirtual) && (pBackingStore->backgroundState == None)) return; if (RegionNotEmpty(pObscured)) { BoxRec oldExtents; x = pWin->drawable.x; y = pWin->drawable.y; RegionTranslate(pObscured, -x, -y); oldExtents = *RegionExtents(&pBackingStore->SavedRegion); RegionUnion(&pBackingStore->SavedRegion, &pBackingStore->SavedRegion, pObscured); /* * only save the bits if we've actually * started using backing store */ if (pBackingStore->status != StatusVirtual) { if (!pBackingStore->pBackingPixmap) miCreateBSPixmap (pWin, &oldExtents); else miResizeBackingStore(pWin, 0, 0, TRUE); if (pBackingStore->pBackingPixmap) { if (pBackingStore->x | pBackingStore->y) { RegionTranslate(pObscured, -pBackingStore->x, -pBackingStore->y); x += pBackingStore->x; y += pBackingStore->y; } (* pScreen->BackingStoreFuncs.SaveAreas) (pBackingStore->pBackingPixmap, pObscured, x - dx, y - dy, pWin); } } RegionTranslate(pObscured, x, y); } else { if (RegionBroken(pObscured)) { RegionEmpty(&pBackingStore->SavedRegion); miDestroyBSPixmap (pWin); return; } } } /*- *----------------------------------------------------------------------- * miBSRestoreAreas -- * Restore areas from backing-store that are no longer obscured. * expects prgnExposed to contain a screen-relative area. * * Results: * The region to generate exposure events on (which may be * different from the region to paint). * * Side Effects: * Areas are copied from pBackingPixmap to the screen. prgnExposed * is altered to contain the region that could not be restored from * backing-store. * * Notes: * This is called before sending any exposure events to the client, * and so might be called if the window has grown. Changing the backing * pixmap doesn't require revalidating the backingGC because the * client's next output request will result in a call to ValidateGC, * since the window clip region has changed, which will in turn call * miValidateBackingStore. *----------------------------------------------------------------------- */ static RegionPtr miBSRestoreAreas(pWin, prgnExposed) register WindowPtr pWin; RegionPtr prgnExposed; { PixmapPtr pBackingPixmap; miBSWindowPtr pBackingStore; RegionPtr prgnSaved; RegionPtr prgnRestored; register ScreenPtr pScreen; RegionPtr exposures = prgnExposed; pScreen = pWin->drawable.pScreen; pBackingStore = (miBSWindowPtr)pWin->backStorage; pBackingPixmap = pBackingStore->pBackingPixmap; prgnSaved = &pBackingStore->SavedRegion; if (pBackingStore->status == StatusContents) { RegionTranslate(prgnSaved, pWin->drawable.x, pWin->drawable.y); prgnRestored = RegionCreate((BoxPtr)NULL, 1); RegionIntersect(prgnRestored, prgnExposed, prgnSaved); /* * Since prgnExposed is no longer obscured, we no longer * will have a valid copy of it in backing-store, but there is a valid * copy of it on screen, so subtract the area we just restored from * from the area to be exposed. */ if (RegionNotEmpty(prgnRestored)) { RegionSubtract(prgnSaved, prgnSaved, prgnExposed); RegionSubtract(prgnExposed, prgnExposed, prgnRestored); /* * Do the actual restoration */ (* pScreen->BackingStoreFuncs.RestoreAreas) (pBackingPixmap, prgnRestored, pWin->drawable.x + pBackingStore->x, pWin->drawable.y + pBackingStore->y, pWin); /* * if the saved region is completely empty, dispose of the * backing pixmap, otherwise, retranslate the saved * region to window relative */ if (RegionNotEmpty(prgnSaved)) { RegionTranslate(prgnSaved, -pWin->drawable.x, -pWin->drawable.y); miResizeBackingStore(pWin, 0, 0, TRUE); } else miDestroyBSPixmap (pWin); } else RegionTranslate(prgnSaved, -pWin->drawable.x, -pWin->drawable.y); RegionDestroy(prgnRestored); } else if ((pBackingStore->status == StatusVirtual) || (pBackingStore->status == StatusVDirty)) { RegionTranslate(prgnSaved, pWin->drawable.x, pWin->drawable.y); exposures = RegionCreate(NullBox, 1); if (SameBackground (pBackingStore->backgroundState, pBackingStore->background, pWin->backgroundState, pWin->background)) { RegionSubtract(exposures, prgnExposed, prgnSaved); } else { miTileVirtualBS(pWin); /* we need to expose all we have (virtually) retiled */ RegionUnion(exposures, prgnExposed, prgnSaved); } RegionSubtract(prgnSaved, prgnSaved, prgnExposed); RegionTranslate(prgnSaved, -pWin->drawable.x, -pWin->drawable.y); } else if (pWin->viewable && !pBackingStore->viewable && pWin->backingStore != Always) { /* * The window was just mapped and nothing has been saved in * backing-store from the last time it was mapped. We want to capture * any output to regions that are already obscured but there are no * bits to snag off the screen, so we initialize things just as we did * in miBSAllocate, above. */ BoxRec box; prgnSaved = &pBackingStore->SavedRegion; box.x1 = pWin->drawable.x; box.x2 = box.x1 + (int) pWin->drawable.width; box.y1 = pWin->drawable.y; box.y2 = box.y1 + (int) pWin->drawable.height; RegionInverse(prgnSaved, &pWin->clipList, &box); RegionTranslate(prgnSaved, -pWin->drawable.x, -pWin->drawable.y); #ifdef SHAPE if (wBoundingShape (pWin)) RegionIntersect(prgnSaved, prgnSaved, wBoundingShape (pWin)); if (wClipShape (pWin)) RegionIntersect(prgnSaved, prgnSaved, wClipShape (pWin)); #endif miTileVirtualBS(pWin); exposures = RegionCreate(&box, 1); } pBackingStore->viewable = (char)pWin->viewable; return exposures; } /*- *----------------------------------------------------------------------- * miBSTranslateBackingStore -- * Shift the backing-store in the given direction. Called when bit * gravity is shifting things around. * * Results: * An occluded region of the window which should be sent exposure events. * This region should be in absolute coordinates (i.e. include * new window position). * * Side Effects: * If the window changed size as well as position, the backing pixmap * is resized. The contents of the backing pixmap are shifted * * Warning: * Bob and I have rewritten this routine quite a few times, each * time it gets a few more cases correct, and introducing some * interesting bugs. Naturally, I think the code is correct this * time. * * Let me try to explain what this routine is for: * * It's called from SlideAndSizeWindow whenever a window * with backing store is resized. There are two separate * possibilities: * * a) The window has ForgetGravity * * In this case, windx, windy will be 0 and oldClip will * be NULL. This indicates that all of the window contents * currently saved offscreen should be discarded, and the * entire window exposed. TranslateBackingStore, then, should * prepare a completely new backing store region based on the * new window clipList and return that region for exposure. * * b) The window has some other gravity * * In this case, windx, windy will be set to the distance * that the bits should move within the window. oldClip * will be set to the old visible portion of the window. * TranslateBackingStore, then, should adjust the backing * store to accommodate the portion of the existing backing * store bits which coorespond to backing store bits which * will still be occluded in the new configuration. oldx,oldy * are set to the old position of the window on the screen. * * Furthermore, in this case any contents of the screen which * are about to become occluded should be fetched from the screen * and placed in backing store. This is to avoid the eventual * occlusion by the win gravity shifting the child window bits around * on top of this window, and potentially losing information * * It's also called from SetShape, but I think (he says not * really knowing for sure) that this code will even work * in that case. *----------------------------------------------------------------------- */ static RegionPtr miBSTranslateBackingStore(pWin, windx, windy, oldClip, oldx, oldy) WindowPtr pWin; int windx; /* bit translation distance in window */ int windy; RegionPtr oldClip; /* Region being copied */ int oldx; /* old window position */ int oldy; { register miBSWindowPtr pBackingStore; register RegionPtr pSavedRegion; register RegionPtr newSaved, doomed; register ScreenPtr pScreen; BoxRec extents; int scrdx; /* bit translation distance on screen */ int scrdy; int dx; /* distance window moved on screen */ int dy; pScreen = pWin->drawable.pScreen; pBackingStore = (miBSWindowPtr)(pWin->backStorage); if ((pBackingStore->status == StatusNoPixmap) || (pBackingStore->status == StatusBadAlloc)) return NullRegion; /* * Compute the new saved region */ newSaved = RegionCreate(NullBox, 1); extents.x1 = pWin->drawable.x; extents.x2 = pWin->drawable.x + (int) pWin->drawable.width; extents.y1 = pWin->drawable.y; extents.y2 = pWin->drawable.y + (int) pWin->drawable.height; RegionInverse(newSaved, &pWin->clipList, &extents); RegionTranslate(newSaved, -pWin->drawable.x, -pWin->drawable.y); #ifdef SHAPE if (wBoundingShape (pWin) || wClipShape (pWin)) { if (wBoundingShape (pWin)) RegionIntersect(newSaved, newSaved, wBoundingShape (pWin)); if (wClipShape (pWin)) RegionIntersect(newSaved, newSaved, wClipShape (pWin)); } #endif pSavedRegion = &pBackingStore->SavedRegion; /* now find any visible areas we can save from the screen */ /* and then translate newSaved to old local coordinates */ if (oldClip) { /* bit gravity makes things virtually too hard, punt */ if (((windx != 0) || (windy != 0)) && (pBackingStore->status != StatusContents)) miCreateBSPixmap(pWin, NullBox); /* * The window is moving this far on the screen */ dx = pWin->drawable.x - oldx; dy = pWin->drawable.y - oldy; /* * The bits will be moving on the screen by the * amount the window is moving + the amount the * bits are moving within the window */ scrdx = windx + dx; scrdy = windy + dy; /* * intersect at old bit position to discover the * bits on the screen which can be put into the * new backing store */ RegionTranslate(oldClip, windx - oldx, windy - oldy); doomed = RegionCreate(NullBox, 1); RegionIntersect(doomed, oldClip, newSaved); RegionTranslate(oldClip, oldx - windx, oldy - windy); /* * Translate the old saved region to the position in the * window where it will appear to be */ RegionTranslate(pSavedRegion, windx, windy); /* * Add the old saved region to the new saved region, so * that calls to RestoreAreas will be able to fetch those * bits back */ RegionUnion(newSaved, newSaved, pSavedRegion); /* * Swap the new saved region into the window */ { RegionRec tmp; tmp = *pSavedRegion; *pSavedRegion = *newSaved; *newSaved = tmp; } miResizeBackingStore (pWin, windx, windy, TRUE); /* * Compute the newly enabled region * of backing store. This region will be * set to background in the backing pixmap and * sent as exposure events to the client. */ RegionSubtract(newSaved, pSavedRegion, newSaved); /* * Fetch bits which will be obscured from * the screen */ if (RegionNotEmpty(doomed)) { /* * Don't clear regions which have bits on the * screen */ RegionSubtract(newSaved, newSaved, doomed); /* * Make the region to SaveDoomedAreas absolute, instead * of window relative. */ RegionTranslate(doomed, pWin->drawable.x, pWin->drawable.y); (* pScreen->SaveDoomedAreas) (pWin, doomed, scrdx, scrdy); } RegionDestroy(doomed); /* * and clear whatever there is that's new */ if (RegionNotEmpty(newSaved)) { miBSClearBackingRegion (pWin, newSaved); /* * Make the exposed region absolute */ RegionTranslate(newSaved, pWin->drawable.x, pWin->drawable.y); } else { RegionDestroy(newSaved); newSaved = NullRegion; } } else { /* * ForgetGravity: just reset backing store and * expose the whole mess */ RegionCopy(pSavedRegion, newSaved); RegionTranslate(newSaved, pWin->drawable.x, pWin->drawable.y); miResizeBackingStore (pWin, 0, 0, FALSE); (void) miBSClearBackingStore (pWin, 0, 0, 0, 0, FALSE); } return newSaved; } /* * Inform the backing store layer that you are about to validate * a gc with a window, and that subsequent output to the window * is (or is not) guaranteed to be already clipped to the visible * regions of the window. */ static void miBSDrawGuarantee (pWin, pGC, guarantee) WindowPtr pWin; GCPtr pGC; int guarantee; { miBSGCPtr pPriv; if (pWin->backStorage) { pPriv = (miBSGCPtr)pGC->devPrivates[miBSGCIndex].ptr; if (!pPriv) (void) miBSCreateGCPrivate (pGC); pPriv = (miBSGCPtr)pGC->devPrivates[miBSGCIndex].ptr; if (pPriv) { /* * XXX KLUDGE ALERT * * when the GC is Cheap pPriv will point * at some device's gc func structure. guarantee * will point at the ChangeGC entry of that struct * and will never match a valid guarantee value. */ switch (pPriv->guarantee) { case GuaranteeNothing: case GuaranteeVisBack: pPriv->guarantee = guarantee; break; } } } } #define noBackingCopy (GCGraphicsExposures|GCClipXOrigin|GCClipYOrigin| \ GCClipMask|GCSubwindowMode| \ GCTileStipXOrigin|GCTileStipYOrigin) /*- *----------------------------------------------------------------------- * miBSValidateGC -- * Wrapper around output-library's ValidateGC routine * * Results: * None. * * Side Effects: * * Notes: * The idea here is to perform several functions: * - All the output calls must be intercepted and routed to * backing-store as necessary. * - pGC in the window's devBackingStore must be set up with the * clip list appropriate for writing to pBackingPixmap (i.e. * the inverse of the window's clipList intersected with the * clientClip of the GC). Since the destination for this GC is * a pixmap, it is sufficient to set the clip list as its * clientClip. *----------------------------------------------------------------------- */ static void miBSValidateGC (pGC, stateChanges, pDrawable) GCPtr pGC; unsigned long stateChanges; DrawablePtr pDrawable; { GCPtr pBackingGC; miBSWindowPtr pWindowPriv = NULL; miBSGCPtr pPriv; WindowPtr pWin; int lift_functions; RegionPtr backingCompositeClip = NULL; if (pDrawable->type != DRAWABLE_PIXMAP) { pWin = (WindowPtr) pDrawable; pWindowPriv = (miBSWindowPtr) pWin->backStorage; lift_functions = (pWindowPriv == (miBSWindowPtr) NULL); } else { pWin = (WindowPtr) NULL; lift_functions = TRUE; } pPriv = (miBSGCPtr)pGC->devPrivates[miBSGCIndex].ptr; FUNC_PROLOGUE (pGC, pPriv); (*pGC->funcs->ValidateGC) (pGC, stateChanges, pDrawable); /* * rewrap funcs and ops as Validate may have changed them */ pPriv->wrapFuncs = pGC->funcs; pPriv->wrapOps = pGC->ops; if (!lift_functions && ((pPriv->guarantee == GuaranteeVisBack) || (pWindowPriv->status == StatusNoPixmap) || (pWindowPriv->status == StatusBadAlloc))) lift_functions = TRUE; /* * check to see if a new backingCompositeClip region must * be generated */ if (!lift_functions && ((pDrawable->serialNumber != pPriv->serialNumber) || (stateChanges&(GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)))) { if (RegionNotEmpty(&pWindowPriv->SavedRegion)) { backingCompositeClip = RegionCreate(NULL, 1); if ((pGC->clientClipType == CT_NONE) || (pGC->clientClipType == CT_PIXMAP)) { RegionCopy(backingCompositeClip, &pWindowPriv->SavedRegion); } else { /* * Make a new copy of the client clip, translated to * its proper origin. */ RegionCopy(backingCompositeClip, pGC->clientClip); RegionTranslate(backingCompositeClip, pGC->clipOrg.x, pGC->clipOrg.y); RegionIntersect(backingCompositeClip, backingCompositeClip, &pWindowPriv->SavedRegion); } if (pGC->subWindowMode == IncludeInferiors) { RegionPtr translatedClip; /* XXX * any output in IncludeInferiors mode will not * be redirected to Inferiors backing store. This * can be fixed only at great cost to the shadow routines. */ translatedClip = NotClippedByChildren (pWin); RegionTranslate(translatedClip, -pDrawable->x, -pDrawable->y); RegionSubtract(backingCompositeClip, backingCompositeClip, translatedClip); RegionDestroy(translatedClip); } if (!RegionNotEmpty(backingCompositeClip)) lift_functions = TRUE; } else { lift_functions = TRUE; } /* Reset the status when drawing to an unoccluded window so that * future SaveAreas will actually copy bits from the screen. Note that * output to root window in IncludeInferiors mode will not cause this * to change. This causes all transient graphics by the window * manager to the root window to not enable backing store. */ if (lift_functions && (pWindowPriv->status == StatusVirtual) && (pWin->parent || pGC->subWindowMode != IncludeInferiors)) pWindowPriv->status = StatusVDirty; } /* * if no backing store has been allocated, and it's needed, * create it now. */ if (!lift_functions && !pWindowPriv->pBackingPixmap) { miCreateBSPixmap (pWin, NullBox); if (!pWindowPriv->pBackingPixmap) lift_functions = TRUE; } /* * create the backing GC if needed, lift functions * if the creation fails */ if (!lift_functions && !pPriv->pBackingGC) { int status; XID noexpose = xFalse; /* We never want ops with the backingGC to generate GraphicsExpose */ pBackingGC = CreateGC ((DrawablePtr)pWindowPriv->pBackingPixmap, GCGraphicsExposures, &noexpose, &status); if (status != Success) lift_functions = TRUE; else pPriv->pBackingGC = pBackingGC; } pBackingGC = pPriv->pBackingGC; pPriv->stateChanges |= stateChanges; if (lift_functions) { if (backingCompositeClip) RegionDestroy(backingCompositeClip); /* unwrap the GC again */ miBSDestroyGCPrivate (pGC); return; } /* * the rest of this function gets the pBackingGC * into shape for possible draws */ pPriv->stateChanges &= ~noBackingCopy; if (pPriv->stateChanges) CopyGC(pGC, pBackingGC, pPriv->stateChanges); if ((pGC->patOrg.x - pWindowPriv->x) != pBackingGC->patOrg.x || (pGC->patOrg.y - pWindowPriv->y) != pBackingGC->patOrg.y) { XID vals[2]; vals[0] = pGC->patOrg.x - pWindowPriv->x; vals[1] = pGC->patOrg.y - pWindowPriv->y; DoChangeGC(pBackingGC, GCTileStipXOrigin|GCTileStipYOrigin, vals, 0); } pPriv->stateChanges = 0; if (backingCompositeClip) { XID vals[2]; if (pGC->clientClipType == CT_PIXMAP) { (*pBackingGC->funcs->CopyClip)(pBackingGC, pGC); RegionTranslate(backingCompositeClip, -pGC->clipOrg.x, -pGC->clipOrg.y); vals[0] = pGC->clipOrg.x - pWindowPriv->x; vals[1] = pGC->clipOrg.y - pWindowPriv->y; DoChangeGC(pBackingGC, GCClipXOrigin|GCClipYOrigin, vals, 0); (* pGC->pScreen->BackingStoreFuncs.SetClipmaskRgn) (pBackingGC, backingCompositeClip); RegionDestroy(backingCompositeClip); } else { vals[0] = -pWindowPriv->x; vals[1] = -pWindowPriv->y; DoChangeGC(pBackingGC, GCClipXOrigin|GCClipYOrigin, vals, 0); (*pBackingGC->funcs->ChangeClip) (pBackingGC, CT_REGION, backingCompositeClip, 0); } pPriv->serialNumber = pDrawable->serialNumber; } if (pWindowPriv->pBackingPixmap->drawable.serialNumber != pBackingGC->serialNumber) { ValidateGC((DrawablePtr)pWindowPriv->pBackingPixmap, pBackingGC); } if (pBackingGC->clientClip == 0) ErrorF ("backing store clip list nil"); FUNC_EPILOGUE (pGC, pPriv); } static void miBSChangeGC (pGC, mask) GCPtr pGC; unsigned long mask; { miBSGCPtr pPriv = (miBSGCPtr) (pGC)->devPrivates[miBSGCIndex].ptr; FUNC_PROLOGUE (pGC, pPriv); (*pGC->funcs->ChangeGC) (pGC, mask); FUNC_EPILOGUE (pGC, pPriv); } static void miBSCopyGC (pGCSrc, mask, pGCDst) GCPtr pGCSrc, pGCDst; unsigned long mask; { miBSGCPtr pPriv = (miBSGCPtr) (pGCDst)->devPrivates[miBSGCIndex].ptr; FUNC_PROLOGUE (pGCDst, pPriv); (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); FUNC_EPILOGUE (pGCDst, pPriv); } static void miBSDestroyGC (pGC) GCPtr pGC; { miBSGCPtr pPriv = (miBSGCPtr) (pGC)->devPrivates[miBSGCIndex].ptr; FUNC_PROLOGUE (pGC, pPriv); if (pPriv->pBackingGC) FreeGC(pPriv->pBackingGC, (GContext)0); (*pGC->funcs->DestroyGC) (pGC); FUNC_EPILOGUE (pGC, pPriv); free(pPriv); } static void miBSChangeClip(pGC, type, pvalue, nrects) GCPtr pGC; int type; void * pvalue; int nrects; { miBSGCPtr pPriv = (miBSGCPtr) (pGC)->devPrivates[miBSGCIndex].ptr; FUNC_PROLOGUE (pGC, pPriv); (* pGC->funcs->ChangeClip)(pGC, type, pvalue, nrects); FUNC_EPILOGUE (pGC, pPriv); } static void miBSCopyClip(pgcDst, pgcSrc) GCPtr pgcDst, pgcSrc; { miBSGCPtr pPriv = (miBSGCPtr) (pgcDst)->devPrivates[miBSGCIndex].ptr; FUNC_PROLOGUE (pgcDst, pPriv); (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); FUNC_EPILOGUE (pgcDst, pPriv); } static void miBSDestroyClip(pGC) GCPtr pGC; { miBSGCPtr pPriv = (miBSGCPtr) (pGC)->devPrivates[miBSGCIndex].ptr; FUNC_PROLOGUE (pGC, pPriv); (* pGC->funcs->DestroyClip)(pGC); FUNC_EPILOGUE (pGC, pPriv); } static void miDestroyBSPixmap (pWin) WindowPtr pWin; { miBSWindowPtr pBackingStore; ScreenPtr pScreen; pScreen = pWin->drawable.pScreen; pBackingStore = (miBSWindowPtr) pWin->backStorage; if (pBackingStore->pBackingPixmap) (* pScreen->DestroyPixmap)(pBackingStore->pBackingPixmap); pBackingStore->pBackingPixmap = NullPixmap; pBackingStore->x = 0; pBackingStore->y = 0; if (pBackingStore->backgroundState == BackgroundPixmap) (* pScreen->DestroyPixmap)(pBackingStore->background.pixmap); pBackingStore->backgroundState = None; pBackingStore->status = StatusNoPixmap; pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; } static void miTileVirtualBS (pWin) WindowPtr pWin; { miBSWindowPtr pBackingStore; pBackingStore = (miBSWindowPtr) pWin->backStorage; if (pBackingStore->backgroundState == BackgroundPixmap) (* pWin->drawable.pScreen->DestroyPixmap) (pBackingStore->background.pixmap); pBackingStore->backgroundState = pWin->backgroundState; pBackingStore->background = pWin->background; if (pBackingStore->backgroundState == BackgroundPixmap) pBackingStore->background.pixmap->refcnt++; if (pBackingStore->status != StatusVDirty) pBackingStore->status = StatusVirtual; /* * punt parent relative tiles and do it now */ if (pBackingStore->backgroundState == ParentRelative) miCreateBSPixmap (pWin, NullBox); } #ifdef DEBUG static int BSAllocationsFailed = 0; #define FAILEDSIZE 32 static struct { int w, h; } failedRecord[FAILEDSIZE]; static int failedIndex; #endif static void miCreateBSPixmap (pWin, pExtents) WindowPtr pWin; BoxPtr pExtents; { miBSWindowPtr pBackingStore; ScreenPtr pScreen; PixUnion background; char backgroundState = 0; BoxPtr extents; Bool backSet; pScreen = pWin->drawable.pScreen; pBackingStore = (miBSWindowPtr) pWin->backStorage; if (pBackingStore->status == StatusBadAlloc) return; backSet = ((pBackingStore->status == StatusVirtual) || (pBackingStore->status == StatusVDirty)); extents = RegionExtents(&pBackingStore->SavedRegion); if (!pBackingStore->pBackingPixmap && extents->x2 != extents->x1 && extents->y2 != extents->y1) { /* the policy here could be more sophisticated */ pBackingStore->x = extents->x1; pBackingStore->y = extents->y1; pBackingStore->pBackingPixmap = (PixmapPtr)(* pScreen->CreatePixmap) (pScreen, extents->x2 - extents->x1, extents->y2 - extents->y1, pWin->drawable.depth, 0); } if (!pBackingStore->pBackingPixmap) { #ifdef DEBUG BSAllocationsFailed++; /* * record failed allocations */ failedRecord[failedIndex].w = pWin->drawable.width; failedRecord[failedIndex].h = pWin->drawable.height; failedIndex++; if (failedIndex == FAILEDSIZE) failedIndex = 0; #endif #ifdef BSEAGER pBackingStore->status = StatusNoPixmap; #else pBackingStore->status = StatusBadAlloc; #endif return; } pBackingStore->status = StatusContents; if (backSet) { backgroundState = pWin->backgroundState; background = pWin->background; pWin->backgroundState = pBackingStore->backgroundState; pWin->background = pBackingStore->background; if (pWin->backgroundState == BackgroundPixmap) pWin->background.pixmap->refcnt++; } if (!pExtents) pExtents = extents; if (pExtents->y1 != pExtents->y2) { RegionPtr exposed; exposed = miBSClearBackingStore(pWin, pExtents->x1, pExtents->y1, pExtents->x2 - pExtents->x1, pExtents->y2 - pExtents->y1, !backSet); if (exposed) { miSendExposures(pWin, exposed, pWin->drawable.x, pWin->drawable.y); RegionDestroy(exposed); } } if (backSet) { if (pWin->backgroundState == BackgroundPixmap) (* pScreen->DestroyPixmap) (pWin->background.pixmap); pWin->backgroundState = backgroundState; pWin->background = background; if (pBackingStore->backgroundState == BackgroundPixmap) (* pScreen->DestroyPixmap) (pBackingStore->background.pixmap); pBackingStore->backgroundState = None; } } /*- *----------------------------------------------------------------------- * miBSExposeCopy -- * Handle the restoration of areas exposed by graphics operations. * * Results: * None. * * Side Effects: * prgnExposed has the areas exposed from backing-store removed * from it. * *----------------------------------------------------------------------- */ static void miBSExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane) WindowPtr pSrc; DrawablePtr pDst; GCPtr pGC; RegionPtr prgnExposed; int srcx, srcy; int dstx, dsty; unsigned long plane; { RegionRec tempRgn; miBSWindowPtr pBackingStore; CopyPlaneProcPtr copyProc; GCPtr pScratchGC; register BoxPtr pBox; register int i; register int dx, dy; BITS32 gcMask; if (!RegionNotEmpty(prgnExposed)) return; pBackingStore = (miBSWindowPtr)pSrc->backStorage; if ((pBackingStore->status == StatusNoPixmap) || (pBackingStore->status == StatusBadAlloc)) return; RegionNull(&tempRgn); RegionIntersect(&tempRgn, prgnExposed, &pBackingStore->SavedRegion); RegionSubtract(prgnExposed, prgnExposed, &tempRgn); if (plane != 0) { copyProc = pGC->ops->CopyPlane; } else { copyProc = (CopyPlaneProcPtr)pGC->ops->CopyArea; } dx = dstx - srcx; dy = dsty - srcy; switch (pBackingStore->status) { case StatusVirtual: case StatusVDirty: pScratchGC = GetScratchGC (pDst->depth, pDst->pScreen); if (pScratchGC) { gcMask = 0; if (pGC->alu != pScratchGC->alu) gcMask = GCFunction; if (pGC->planemask != pScratchGC->planemask) gcMask |= GCPlaneMask; if (gcMask) CopyGC (pGC, pScratchGC, gcMask); miBSFillVirtualBits (pDst, pScratchGC, &tempRgn, dx, dy, (int) pBackingStore->backgroundState, pBackingStore->background, ~0L); FreeScratchGC (pScratchGC); } break; case StatusContents: for (i = RegionNumRects(&tempRgn), pBox = RegionRects(&tempRgn); --i >= 0; pBox++) { (* copyProc) (&(pBackingStore->pBackingPixmap->drawable), pDst, pGC, pBox->x1 - pBackingStore->x, pBox->y1 - pBackingStore->y, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx, pBox->y1 + dy, plane); } break; } RegionUninit(&tempRgn); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mibstore.h0000644000000000000000000000140513614532331017175 0ustar /*- * mibstore.h -- * Header file for users of the MI backing-store scheme. * * Copyright (c) 1987 by the Regents of the University of California * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without * fee is hereby granted, provided that the above copyright * notice appear in all copies. The University of California * makes no representations about the suitability of this * software for any purpose. It is provided "as is" without * express or implied warranty. * * "$Xorg: mibstore.h,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ #ifndef _MIBSTORE_H #define _MIBSTORE_H #include "screenint.h" extern void miInitializeBackingStore( ScreenPtr /*pScreen*/ ); #endif /* _MIBSTORE_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mibstorest.h0000644000000000000000000000632713614532331017554 0ustar /* * mibstorest.h * * internal structure definitions for mi backing store */ /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "mibstore.h" #include "regionstr.h" /* * One of these structures is allocated per GC used with a backing-store * drawable. */ typedef struct { GCPtr pBackingGC; /* Copy of the GC but with graphicsExposures * set FALSE and the clientClip set to * clip output to the valid regions of the * backing pixmap. */ int guarantee; /* GuaranteeNothing, etc. */ unsigned long serialNumber; /* clientClip computed time */ unsigned long stateChanges; /* changes in parent gc since last copy */ GCOps *wrapOps; /* wrapped ops */ GCFuncs *wrapFuncs; /* wrapped funcs */ } miBSGCRec, *miBSGCPtr; /* * one of these structures is allocated per Window with backing store */ typedef struct { PixmapPtr pBackingPixmap; /* Pixmap for saved areas */ short x; /* origin of pixmap relative to window */ short y; RegionRec SavedRegion; /* Valid area in pBackingPixmap */ char viewable; /* Tracks pWin->viewable so SavedRegion may * be initialized correctly when the window * is first mapped */ char status; /* StatusNoPixmap, etc. */ char backgroundState; /* background type */ PixUnion background; /* background pattern */ } miBSWindowRec, *miBSWindowPtr; #define StatusNoPixmap 1 /* pixmap has not been created */ #define StatusVirtual 2 /* pixmap is virtual, tiled with background */ #define StatusVDirty 3 /* pixmap is virtual, visiblt has contents */ #define StatusBadAlloc 4 /* pixmap create failed, do not try again */ #define StatusContents 5 /* pixmap is created, has valid contents */ typedef struct { /* * screen func wrappers */ CloseScreenProcPtr CloseScreen; GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; ChangeWindowAttributesProcPtr ChangeWindowAttributes; CreateGCProcPtr CreateGC; DestroyWindowProcPtr DestroyWindow; } miBSScreenRec, *miBSScreenPtr; nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/micmap.c0000644000000000000000000004333413614532331016621 0ustar /* $XConsortium: cfbcmap.c,v 4.19 94/04/17 20:28:46 dpw Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright no- tice appear in all copies and that both that copyright no- tice and this permission notice appear in supporting docu- mentation, and that the names of Sun or X Consortium not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Sun and X Consortium make no representations about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* * This is based on cfbcmap.c. The functions here are useful independently * of cfb, which is the reason for including them here. How "mi" these * are may be debatable. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "scrnintstr.h" #include "colormapst.h" #include "resource.h" #include "globals.h" #include "micmap.h" ColormapPtr miInstalledMaps[MAXSCREENS]; static Bool miDoInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp, int *ndepthp, int *rootDepthp, VisualID *defaultVisp, unsigned long sizes, int bitsPerRGB, int preferredVis); miInitVisualsProcPtr miInitVisualsProc = miDoInitVisuals; int miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps) { if (miInstalledMaps[pScreen->myNum]) { *pmaps = miInstalledMaps[pScreen->myNum]->mid; return (1); } return 0; } void miInstallColormap(ColormapPtr pmap) { int index = pmap->pScreen->myNum; ColormapPtr oldpmap = miInstalledMaps[index]; if(pmap != oldpmap) { /* Uninstall pInstalledMap. No hardware changes required, just * notify all interested parties. */ if(oldpmap != (ColormapPtr)None) WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid); /* Install pmap */ miInstalledMaps[index] = pmap; WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid); } } void miUninstallColormap(ColormapPtr pmap) { int index = pmap->pScreen->myNum; ColormapPtr curpmap = miInstalledMaps[index]; if(pmap == curpmap) { if (pmap->mid != pmap->pScreen->defColormap) { curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, RT_COLORMAP); (*pmap->pScreen->InstallColormap)(curpmap); } } } void miResolveColor(unsigned short *pred, unsigned short *pgreen, unsigned short *pblue, VisualPtr pVisual) { int shift = 16 - pVisual->bitsPerRGBValue; unsigned lim = (1 << pVisual->bitsPerRGBValue) - 1; if ((pVisual->class | DynamicClass) == GrayScale) { /* rescale to gray then rgb bits */ *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100; *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim; } else { /* rescale to rgb bits */ *pred = ((*pred >> shift) * 65535) / lim; *pgreen = ((*pgreen >> shift) * 65535) / lim; *pblue = ((*pblue >> shift) * 65535) / lim; } } Bool miInitializeColormap(ColormapPtr pmap) { register unsigned i; register VisualPtr pVisual; unsigned lim, maxent, shift; pVisual = pmap->pVisual; lim = (1 << pVisual->bitsPerRGBValue) - 1; shift = 16 - pVisual->bitsPerRGBValue; maxent = pVisual->ColormapEntries - 1; if (pVisual->class == TrueColor) { unsigned limr, limg, limb; limr = pVisual->redMask >> pVisual->offsetRed; limg = pVisual->greenMask >> pVisual->offsetGreen; limb = pVisual->blueMask >> pVisual->offsetBlue; for(i = 0; i <= maxent; i++) { /* rescale to [0..65535] then rgb bits */ pmap->red[i].co.local.red = ((((i * 65535) / limr) >> shift) * 65535) / lim; pmap->green[i].co.local.green = ((((i * 65535) / limg) >> shift) * 65535) / lim; pmap->blue[i].co.local.blue = ((((i * 65535) / limb) >> shift) * 65535) / lim; } } else if (pVisual->class == StaticColor) { unsigned limr, limg, limb; limr = pVisual->redMask >> pVisual->offsetRed; limg = pVisual->greenMask >> pVisual->offsetGreen; limb = pVisual->blueMask >> pVisual->offsetBlue; for(i = 0; i <= maxent; i++) { /* rescale to [0..65535] then rgb bits */ pmap->red[i].co.local.red = ((((((i & pVisual->redMask) >> pVisual->offsetRed) * 65535) / limr) >> shift) * 65535) / lim; pmap->red[i].co.local.green = ((((((i & pVisual->greenMask) >> pVisual->offsetGreen) * 65535) / limg) >> shift) * 65535) / lim; pmap->red[i].co.local.blue = ((((((i & pVisual->blueMask) >> pVisual->offsetBlue) * 65535) / limb) >> shift) * 65535) / lim; } } else if (pVisual->class == StaticGray) { for(i = 0; i <= maxent; i++) { /* rescale to [0..65535] then rgb bits */ pmap->red[i].co.local.red = ((((i * 65535) / maxent) >> shift) * 65535) / lim; pmap->red[i].co.local.green = pmap->red[i].co.local.red; pmap->red[i].co.local.blue = pmap->red[i].co.local.red; } } return TRUE; } /* When simulating DirectColor on PseudoColor hardware, multiple entries of the colormap must be updated */ #define AddElement(mask) { \ pixel = red | green | blue; \ for (i = 0; i < nresult; i++) \ if (outdefs[i].pixel == pixel) \ break; \ if (i == nresult) \ { \ nresult++; \ outdefs[i].pixel = pixel; \ outdefs[i].flags = 0; \ } \ outdefs[i].flags |= (mask); \ outdefs[i].red = pmap->red[red >> pVisual->offsetRed].co.local.red; \ outdefs[i].green = pmap->green[green >> pVisual->offsetGreen].co.local.green; \ outdefs[i].blue = pmap->blue[blue >> pVisual->offsetBlue].co.local.blue; \ } int miExpandDirectColors(ColormapPtr pmap, int ndef, xColorItem *indefs, xColorItem *outdefs) { register int red, green, blue; int maxred, maxgreen, maxblue; int stepred, stepgreen, stepblue; VisualPtr pVisual; register int pixel; register int nresult; register int i; pVisual = pmap->pVisual; stepred = 1 << pVisual->offsetRed; stepgreen = 1 << pVisual->offsetGreen; stepblue = 1 << pVisual->offsetBlue; maxred = pVisual->redMask; maxgreen = pVisual->greenMask; maxblue = pVisual->blueMask; nresult = 0; for (;ndef--; indefs++) { if (indefs->flags & DoRed) { red = indefs->pixel & pVisual->redMask; for (green = 0; green <= maxgreen; green += stepgreen) { for (blue = 0; blue <= maxblue; blue += stepblue) { AddElement (DoRed) } } } if (indefs->flags & DoGreen) { green = indefs->pixel & pVisual->greenMask; for (red = 0; red <= maxred; red += stepred) { for (blue = 0; blue <= maxblue; blue += stepblue) { AddElement (DoGreen) } } } if (indefs->flags & DoBlue) { blue = indefs->pixel & pVisual->blueMask; for (red = 0; red <= maxred; red += stepred) { for (green = 0; green <= maxgreen; green += stepgreen) { AddElement (DoBlue) } } } } return nresult; } Bool miCreateDefColormap(ScreenPtr pScreen) { /* * In the following sources PC X server vendors may want to delete * "_not_tog" from "#ifdef WIN32_not_tog" */ #ifdef WIN32_not_tog /* * these are the MS-Windows desktop colors, adjusted for X's 16-bit * color specifications. */ static xColorItem citems[] = { { 0, 0, 0, 0, 0, 0 }, { 1, 0x8000, 0, 0, 0, 0 }, { 2, 0, 0x8000, 0, 0, 0 }, { 3, 0x8000, 0x8000, 0, 0, 0 }, { 4, 0, 0, 0x8000, 0, 0 }, { 5, 0x8000, 0, 0x8000, 0, 0 }, { 6, 0, 0x8000, 0x8000, 0, 0 }, { 7, 0xc000, 0xc000, 0xc000, 0, 0 }, { 8, 0xc000, 0xdc00, 0xc000, 0, 0 }, { 9, 0xa600, 0xca00, 0xf000, 0, 0 }, { 246, 0xff00, 0xfb00, 0xf000, 0, 0 }, { 247, 0xa000, 0xa000, 0xa400, 0, 0 }, { 248, 0x8000, 0x8000, 0x8000, 0, 0 }, { 249, 0xff00, 0, 0, 0, 0 }, { 250, 0, 0xff00, 0, 0, 0 }, { 251, 0xff00, 0xff00, 0, 0, 0 }, { 252, 0, 0, 0xff00, 0, 0 }, { 253, 0xff00, 0, 0xff00, 0, 0 }, { 254, 0, 0xff00, 0xff00, 0, 0 }, { 255, 0xff00, 0xff00, 0xff00, 0, 0 } }; #define NUM_DESKTOP_COLORS sizeof citems / sizeof citems[0] int i; #else unsigned short zero = 0, ones = 0xFFFF; #endif Pixel wp, bp; VisualPtr pVisual; ColormapPtr cmap; int alloctype; for (pVisual = pScreen->visuals; pVisual->vid != pScreen->rootVisual; pVisual++) ; if (pScreen->rootDepth == 1 || (pVisual->class & DynamicClass)) alloctype = AllocNone; else alloctype = AllocAll; if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &cmap, alloctype, 0) != Success) return FALSE; if (pScreen->rootDepth > 1) { wp = pScreen->whitePixel; bp = pScreen->blackPixel; #ifdef WIN32_not_tog for (i = 0; i < NUM_DESKTOP_COLORS; i++) { if (AllocColor (cmap, &citems[i].red, &citems[i].green, &citems[i].blue, &citems[i].pixel, 0) != Success) return FALSE; } #else if ((AllocColor(cmap, &ones, &ones, &ones, &wp, 0) != Success) || (AllocColor(cmap, &zero, &zero, &zero, &bp, 0) != Success)) return FALSE; pScreen->whitePixel = wp; pScreen->blackPixel = bp; #endif } (*pScreen->InstallColormap)(cmap); return TRUE; } /* * Default true color bitmasks, should be overridden by * driver */ #define _RZ(d) ((d + 2) / 3) #define _RS(d) 0 #define _RM(d) ((1 << _RZ(d)) - 1) #define _GZ(d) ((d - _RZ(d) + 1) / 2) #define _GS(d) _RZ(d) #define _GM(d) (((1 << _GZ(d)) - 1) << _GS(d)) #define _BZ(d) (d - _RZ(d) - _GZ(d)) #define _BS(d) (_RZ(d) + _GZ(d)) #define _BM(d) (((1 << _BZ(d)) - 1) << _BS(d)) #define _CE(d) (1 << _RZ(d)) typedef struct _miVisuals { struct _miVisuals *next; int depth; int bitsPerRGB; int visuals; int count; int preferredCVC; Pixel redMask, greenMask, blueMask; } miVisualsRec, *miVisualsPtr; static int miVisualPriority[] = { PseudoColor, GrayScale, StaticColor, TrueColor, DirectColor, StaticGray }; #define NUM_PRIORITY 6 static miVisualsPtr miVisuals; void miClearVisualTypes() { miVisualsPtr v; while ((v = miVisuals)) { miVisuals = v->next; free(v); } } Bool miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB, int preferredCVC, Pixel redMask, Pixel greenMask, Pixel blueMask) { miVisualsPtr new, *prev, v; int count; new = (miVisualsPtr) malloc (sizeof *new); if (!new) return FALSE; if (!redMask || !greenMask || !blueMask) { redMask = _RM(depth); greenMask = _GM(depth); blueMask = _BM(depth); } new->next = 0; new->depth = depth; new->visuals = visuals; new->bitsPerRGB = bitsPerRGB; new->preferredCVC = preferredCVC; new->redMask = redMask; new->greenMask = greenMask; new->blueMask = blueMask; count = (visuals >> 1) & 033333333333; count = visuals - count - ((count >> 1) & 033333333333); count = (((count + (count >> 3)) & 030707070707) % 077); /* HAKMEM 169 */ new->count = count; for (prev = &miVisuals; (v = *prev); prev = &v->next); *prev = new; return TRUE; } Bool miSetVisualTypes(int depth, int visuals, int bitsPerRGB, int preferredCVC) { return miSetVisualTypesAndMasks (depth, visuals, bitsPerRGB, preferredCVC, 0, 0, 0); } int miGetDefaultVisualMask(int depth) { if (depth > MAX_PSEUDO_DEPTH) return LARGE_VISUALS; else if (depth >= MIN_TRUE_DEPTH) return ALL_VISUALS; else if (depth == 1) return StaticGrayMask; else return SMALL_VISUALS; } static Bool miVisualTypesSet (int depth) { miVisualsPtr visuals; for (visuals = miVisuals; visuals; visuals = visuals->next) if (visuals->depth == depth) return TRUE; return FALSE; } Bool miSetPixmapDepths (void) { int d, f; /* Add any unlisted depths from the pixmap formats */ for (f = 0; f < screenInfo.numPixmapFormats; f++) { d = screenInfo.formats[f].depth; if (!miVisualTypesSet (d)) { if (!miSetVisualTypes (d, 0, 0, -1)) return FALSE; } } return TRUE; } Bool miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp, int *ndepthp, int *rootDepthp, VisualID *defaultVisp, unsigned long sizes, int bitsPerRGB, int preferredVis) { if (miInitVisualsProc) return miInitVisualsProc(visualp, depthp, nvisualp, ndepthp, rootDepthp, defaultVisp, sizes, bitsPerRGB, preferredVis); else return FALSE; } /* * Distance to least significant one bit */ static int maskShift (Pixel p) { int s; if (!p) return 0; s = 0; while (!(p & 1)) { s++; p >>= 1; } return s; } /* * Given a list of formats for a screen, create a list * of visuals and depths for the screen which corespond to * the set which can be used with this version of cfb. */ static Bool miDoInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp, int *ndepthp, int *rootDepthp, VisualID *defaultVisp, unsigned long sizes, int bitsPerRGB, int preferredVis) { int i, j = 0, k; VisualPtr visual; DepthPtr depth; VisualID *vid; int d, b; int f; int ndepth, nvisual; int nvtype; int vtype; miVisualsPtr visuals, nextVisuals; int *preferredCVCs, *prefp; int first_depth; /* none specified, we'll guess from pixmap formats */ if (!miVisuals) { for (f = 0; f < screenInfo.numPixmapFormats; f++) { d = screenInfo.formats[f].depth; b = screenInfo.formats[f].bitsPerPixel; if (sizes & (1 << (b - 1))) vtype = miGetDefaultVisualMask(d); else vtype = 0; if (!miSetVisualTypes (d, vtype, bitsPerRGB, -1)) return FALSE; } } nvisual = 0; ndepth = 0; for (visuals = miVisuals; visuals; visuals = nextVisuals) { nextVisuals = visuals->next; ndepth++; nvisual += visuals->count; } depth = (DepthPtr) malloc (ndepth * sizeof (DepthRec)); visual = (VisualPtr) malloc (nvisual * sizeof (VisualRec)); preferredCVCs = (int *)malloc(ndepth * sizeof(int)); if (!depth || !visual || !preferredCVCs) { free (depth); free (visual); free (preferredCVCs); return FALSE; } *depthp = depth; *visualp = visual; *ndepthp = ndepth; *nvisualp = nvisual; prefp = preferredCVCs; for (visuals = miVisuals; visuals; visuals = nextVisuals) { nextVisuals = visuals->next; d = visuals->depth; vtype = visuals->visuals; nvtype = visuals->count; *prefp = visuals->preferredCVC; prefp++; vid = NULL; if (nvtype) { vid = (VisualID *) malloc (nvtype * sizeof (VisualID)); if (!vid) { free(preferredCVCs); return FALSE; } } depth->depth = d; depth->numVids = nvtype; depth->vids = vid; depth++; for (i = 0; i < NUM_PRIORITY; i++) { if (! (vtype & (1 << miVisualPriority[i]))) continue; visual->class = miVisualPriority[i]; visual->bitsPerRGBValue = visuals->bitsPerRGB; visual->ColormapEntries = 1 << d; visual->nplanes = d; visual->vid = *vid = FakeClientID (0); switch (visual->class) { case PseudoColor: case GrayScale: case StaticGray: visual->redMask = 0; visual->greenMask = 0; visual->blueMask = 0; visual->offsetRed = 0; visual->offsetGreen = 0; visual->offsetBlue = 0; break; case DirectColor: case TrueColor: visual->ColormapEntries = _CE(d); /* fall through */ case StaticColor: visual->redMask = visuals->redMask; visual->greenMask = visuals->greenMask; visual->blueMask = visuals->blueMask; visual->offsetRed = maskShift (visuals->redMask); visual->offsetGreen = maskShift (visuals->greenMask); visual->offsetBlue = maskShift (visuals->blueMask); } vid++; visual++; } free (visuals); } miVisuals = NULL; visual = *visualp; depth = *depthp; /* * if we did not supplyied by a preferred visual class * check if there is a preferred class in one of the depth * structures - if there is, we want to start looking for the * default visual/depth from that depth. */ first_depth = 0; if (preferredVis < 0 && defaultColorVisualClass < 0 ) { for (i = 0; i < ndepth; i++) { if (preferredCVCs[i] >= 0) { first_depth = i; break; } } } for (i = first_depth; i < ndepth; i++) { int prefColorVisualClass = -1; if (defaultColorVisualClass >= 0) prefColorVisualClass = defaultColorVisualClass; else if (preferredVis >= 0) prefColorVisualClass = preferredVis; else if (preferredCVCs[i] >= 0) prefColorVisualClass = preferredCVCs[i]; if (*rootDepthp && *rootDepthp != depth[i].depth) continue; for (j = 0; j < depth[i].numVids; j++) { for (k = 0; k < nvisual; k++) if (visual[k].vid == depth[i].vids[j]) break; if (k == nvisual) continue; if (prefColorVisualClass < 0 || visual[k].class == prefColorVisualClass) break; } if (j != depth[i].numVids) break; } if (i == ndepth) { i = 0; j = 0; } *rootDepthp = depth[i].depth; *defaultVisp = depth[i].vids[j]; free(preferredCVCs); return TRUE; } void miResetInitVisuals() { miInitVisualsProc = miDoInitVisuals; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/micmap.h0000644000000000000000000000353513614532331016625 0ustar #include "colormapst.h" #ifndef _MICMAP_H_ #define _MICMAP_H_ extern ColormapPtr miInstalledMaps[MAXSCREENS]; typedef Bool (* miInitVisualsProcPtr)(VisualPtr *, DepthPtr *, int *, int *, int *, VisualID *, unsigned long, int, int); extern miInitVisualsProcPtr miInitVisualsProc; int miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps); void miInstallColormap(ColormapPtr pmap); void miUninstallColormap(ColormapPtr pmap); void miResolveColor(unsigned short *, unsigned short *, unsigned short *, VisualPtr); Bool miInitializeColormap(ColormapPtr); int miExpandDirectColors(ColormapPtr, int, xColorItem *, xColorItem *); Bool miCreateDefColormap(ScreenPtr); void miClearVisualTypes(void); Bool miSetVisualTypes(int, int, int, int); Bool miSetPixmapDepths(void); Bool miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB, int preferredCVC, Pixel redMask, Pixel greenMask, Pixel blueMask); int miGetDefaultVisualMask(int); Bool miInitVisuals(VisualPtr *, DepthPtr *, int *, int *, int *, VisualID *, unsigned long, int, int); void miResetInitVisuals(void); void miHookInitVisuals(void (**old)(miInitVisualsProcPtr *), void (*new)(miInitVisualsProcPtr *)); #define MAX_PSEUDO_DEPTH 10 #define MIN_TRUE_DEPTH 6 #define StaticGrayMask (1 << StaticGray) #define GrayScaleMask (1 << GrayScale) #define StaticColorMask (1 << StaticColor) #define PseudoColorMask (1 << PseudoColor) #define TrueColorMask (1 << TrueColor) #define DirectColorMask (1 << DirectColor) #define ALL_VISUALS (StaticGrayMask|\ GrayScaleMask|\ StaticColorMask|\ PseudoColorMask|\ TrueColorMask|\ DirectColorMask) #define LARGE_VISUALS (TrueColorMask|\ DirectColorMask) #define SMALL_VISUALS (StaticGrayMask|\ GrayScaleMask|\ StaticColorMask|\ PseudoColorMask) #endif /* _MICMAP_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/micoord.h0000644000000000000000000000532313614532331017010 0ustar /* * Copyright (C) 2000 The XFree86 Project, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. * */ #ifndef _MICOORD_H_ #define _MICOORD_H_ 1 #include "servermd.h" /* Macros which handle a coordinate in a single register */ /* * Most compilers will convert divisions by 65536 into shifts, if signed * shifts exist. If your machine does arithmetic shifts and your compiler * can't get it right, add to this line. */ /* * mips compiler - what a joke - it CSEs the 65536 constant into a reg * forcing as to use div instead of shift. Let's be explicit. */ #if defined(mips) || \ defined(sparc) || defined(__sparc64__) || \ defined(__alpha) || defined(__alpha__) || \ defined(__i386__) || defined(i386) || \ defined(__ia64__) || defined(ia64) || \ defined(__s390x__) || defined(__s390__) || \ defined(__amd64__) || defined(amd64) || defined(__amd64) #define GetHighWord(x) (((int) (x)) >> 16) #else #define GetHighWord(x) (((int) (x)) / 65536) #endif #if IMAGE_BYTE_ORDER == MSBFirst #define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int) ((short) (i)))) #define coordToInt(x,y) (((x) << 16) | ((y) & 0xffff)) #define intToX(i) (GetHighWord(i)) #define intToY(i) ((int) ((short) i)) #else #define intToCoord(i,x,y) (((x) = (int) ((short) (i))), ((y) = GetHighWord(i))) #define coordToInt(x,y) (((y) << 16) | ((x) & 0xffff)) #define intToX(i) ((int) ((short) (i))) #define intToY(i) (GetHighWord(i)) #endif #endif /* _MICOORD_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/micursor.c0000644000000000000000000000540113614532331017207 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "scrnintstr.h" #include "cursor.h" #include "misc.h" #include "mi.h" void miRecolorCursor( pScr, pCurs, displayed) ScreenPtr pScr; CursorPtr pCurs; Bool displayed; { /* * This is guaranteed to correct any color-dependent state which may have * been bound up in private state created by RealizeCursor */ pScr->UnrealizeCursor(pScr, pCurs); pScr->RealizeCursor(pScr, pCurs); if (displayed) pScr->DisplayCursor(pScr, pCurs); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/midash.c0000644000000000000000000001670313614532331016620 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "regionstr.h" #include "mistruct.h" #include "mifpoly.h" static miDashPtr CheckDashStorage(miDashPtr *ppseg, int nseg, int *pnsegMax); /* return a list of DashRec. there will be an extra entry at the end holding the last point of the polyline. this means that the code that actually draws dashes can get a pair of points for every dash. only the point in the last dash record is useful; the other fields are not used. nseg is the number of segments, not the number of points. example: dash1.start dash2.start dash3.start last-point defines a list of segments (dash1.pt, dash2.pt) (dash2.pt, dash3.pt) (dash3.pt, last-point) and nseg == 3. NOTE: EVEN_DASH == ~ODD_DASH NOTE ALSO: miDashLines may return 0 segments, going from pt[0] to pt[0] with one dash. */ miDashPtr miDashLine(npt, ppt, nDash, pDash, offset, pnseg) int npt; DDXPointPtr ppt; unsigned int nDash; unsigned char *pDash; unsigned int offset; int *pnseg; { DDXPointRec pt1, pt2; int lenCur; /* npt used from this dash */ int lenMax; /* npt in this dash */ int iDash = 0; /* index of current dash */ int which; /* EVEN_DASH or ODD_DASH */ miDashPtr pseg; /* list of dash segments */ miDashPtr psegBase; /* start of list */ int nseg = 0; /* number of dashes so far */ int nsegMax = 0; /* num segs we can fit in this list */ int x, y, len; int adx, ady, signdx, signdy; int du, dv, e1, e2, e, base_e = 0; lenCur = offset; which = EVEN_DASH; while(lenCur >= pDash[iDash]) { lenCur -= pDash[iDash]; iDash++; if (iDash >= nDash) iDash = 0; which = ~which; } lenMax = pDash[iDash]; psegBase = (miDashPtr)NULL; pt2 = ppt[0]; /* just in case there is only one point */ while(--npt) { if (PtEqual(ppt[0], ppt[1])) { ppt++; continue; /* no duplicated points in polyline */ } pt1 = *ppt++; pt2 = *ppt; adx = pt2.x - pt1.x; ady = pt2.y - pt1.y; signdx = sign(adx); signdy = sign(ady); adx = abs(adx); ady = abs(ady); if (adx > ady) { du = adx; dv = ady; len = adx; } else { du = ady; dv = adx; len = ady; } e1 = dv * 2; e2 = e1 - 2*du; e = e1 - du; x = pt1.x; y = pt1.y; nseg++; pseg = CheckDashStorage(&psegBase, nseg, &nsegMax); if (!pseg) return (miDashPtr)NULL; pseg->pt = pt1; pseg->e1 = e1; pseg->e2 = e2; base_e = pseg->e = e; pseg->which = which; pseg->newLine = 1; while (len--) { if (adx > ady) { /* X_AXIS */ if (((signdx > 0) && (e < 0)) || ((signdx <=0) && (e <=0)) ) { e += e1; } else { y += signdy; e += e2; } x += signdx; } else { /* Y_AXIS */ if (((signdx > 0) && (e < 0)) || ((signdx <=0) && (e <=0)) ) { e +=e1; } else { x += signdx; e += e2; } y += signdy; } lenCur++; if (lenCur >= lenMax && (len || npt <= 1)) { nseg++; pseg = CheckDashStorage(&psegBase, nseg, &nsegMax); if (!pseg) return (miDashPtr)NULL; pseg->pt.x = x; pseg->pt.y = y; pseg->e1 = e1; pseg->e2 = e2; pseg->e = e; which = ~which; pseg->which = which; pseg->newLine = 0; /* move on to next dash */ iDash++; if (iDash >= nDash) iDash = 0; lenMax = pDash[iDash]; lenCur = 0; } } /* while len-- */ } /* while --npt */ if (lenCur == 0 && nseg != 0) { nseg--; which = ~which; } *pnseg = nseg; pseg = CheckDashStorage(&psegBase, nseg+1, &nsegMax); if (!pseg) return (miDashPtr)NULL; pseg->pt = pt2; pseg->e = base_e; pseg->which = which; pseg->newLine = 0; return psegBase; } #define NSEGDELTA 16 /* returns a pointer to the pseg[nseg-1], growing the storage as necessary. this interface seems unnecessarily cumbersome. */ static miDashPtr CheckDashStorage( miDashPtr *ppseg, /* base pointer */ int nseg, /* number of segment we want to write to */ int *pnsegMax) /* size (in segments) of list so far */ { if (nseg > *pnsegMax) { miDashPtr newppseg; *pnsegMax += NSEGDELTA; newppseg = (miDashPtr)realloc(*ppseg, (*pnsegMax)*sizeof(miDashRec)); if (!newppseg) { free(*ppseg); return (miDashPtr)NULL; } *ppseg = newppseg; } return(*ppseg+(nseg-1)); } void miStepDash (dist, pDashIndex, pDash, numInDashList, pDashOffset) int dist; /* distance to step */ int *pDashIndex; /* current dash */ unsigned char *pDash; /* dash list */ int numInDashList; /* total length of dash list */ int *pDashOffset; /* offset into current dash */ { int dashIndex, dashOffset; int totallen; int i; dashIndex = *pDashIndex; dashOffset = *pDashOffset; if (dist < pDash[dashIndex] - dashOffset) { *pDashOffset = dashOffset + dist; return; } dist -= pDash[dashIndex] - dashOffset; if (++dashIndex == numInDashList) dashIndex = 0; totallen = 0; for (i = 0; i < numInDashList; i++) totallen += pDash[i]; if (totallen <= dist) dist = dist % totallen; while (dist >= pDash[dashIndex]) { dist -= pDash[dashIndex]; if (++dashIndex == numInDashList) dashIndex = 0; } *pDashIndex = dashIndex; *pDashOffset = dist; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/midispcur.c0000644000000000000000000005176113614532331017355 0ustar /* * midispcur.c * * machine independent cursor display routines */ /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif # include # include "misc.h" # include "input.h" # include "cursorstr.h" # include "windowstr.h" # include "regionstr.h" # include "dixstruct.h" # include "scrnintstr.h" # include "servermd.h" # include "mipointer.h" # include "misprite.h" # include "gcstruct.h" #ifdef ARGB_CURSOR # include "picturestr.h" #endif /* per-screen private data */ static int miDCScreenIndex; static unsigned long miDCGeneration = 0; static Bool miDCCloseScreen(ScreenPtr pScreen); typedef struct { GCPtr pSourceGC, pMaskGC; GCPtr pSaveGC, pRestoreGC; GCPtr pMoveGC; GCPtr pPixSourceGC, pPixMaskGC; CloseScreenProcPtr CloseScreen; PixmapPtr pSave, pTemp; #ifdef ARGB_CURSOR PicturePtr pRootPicture; PicturePtr pTempPicture; #endif } miDCScreenRec, *miDCScreenPtr; /* per-cursor per-screen private data */ typedef struct { PixmapPtr sourceBits; /* source bits */ PixmapPtr maskBits; /* mask bits */ #ifdef ARGB_CURSOR PicturePtr pPicture; #endif } miDCCursorRec, *miDCCursorPtr; /* * sprite/cursor method table */ static Bool miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); static Bool miDCUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); static Bool miDCPutUpCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y, unsigned long source, unsigned long mask); static Bool miDCSaveUnderCursor(ScreenPtr pScreen, int x, int y, int w, int h); static Bool miDCRestoreUnderCursor(ScreenPtr pScreen, int x, int y, int w, int h); static Bool miDCMoveCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y, int w, int h, int dx, int dy, unsigned long source, unsigned long mask); static Bool miDCChangeSave(ScreenPtr pScreen, int x, int y, int w, int h, int dx, int dy); static miSpriteCursorFuncRec miDCFuncs = { miDCRealizeCursor, miDCUnrealizeCursor, miDCPutUpCursor, miDCSaveUnderCursor, miDCRestoreUnderCursor, miDCMoveCursor, miDCChangeSave, }; Bool miDCInitialize (pScreen, screenFuncs) ScreenPtr pScreen; miPointerScreenFuncPtr screenFuncs; { miDCScreenPtr pScreenPriv; if (miDCGeneration != serverGeneration) { miDCScreenIndex = AllocateScreenPrivateIndex (); if (miDCScreenIndex < 0) return FALSE; miDCGeneration = serverGeneration; } pScreenPriv = (miDCScreenPtr) malloc (sizeof (miDCScreenRec)); if (!pScreenPriv) return FALSE; /* * initialize the entire private structure to zeros */ pScreenPriv->pSourceGC = pScreenPriv->pMaskGC = pScreenPriv->pSaveGC = pScreenPriv->pRestoreGC = pScreenPriv->pMoveGC = pScreenPriv->pPixSourceGC = pScreenPriv->pPixMaskGC = NULL; #ifdef ARGB_CURSOR pScreenPriv->pRootPicture = NULL; pScreenPriv->pTempPicture = NULL; #endif pScreenPriv->pSave = pScreenPriv->pTemp = NULL; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = miDCCloseScreen; pScreen->devPrivates[miDCScreenIndex].ptr = (void *) pScreenPriv; if (!miSpriteInitialize (pScreen, &miDCFuncs, screenFuncs)) { free ((void *) pScreenPriv); return FALSE; } return TRUE; } #define tossGC(gc) (gc ? FreeGC (gc, (GContext) 0) : 0) #define tossPix(pix) (pix ? (*pScreen->DestroyPixmap) (pix) : TRUE) #define tossPict(pict) (pict ? FreePicture (pict, 0) : 0) static Bool miDCCloseScreen (pScreen) ScreenPtr pScreen; { miDCScreenPtr pScreenPriv; pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pScreen->CloseScreen = pScreenPriv->CloseScreen; tossGC (pScreenPriv->pSourceGC); tossGC (pScreenPriv->pMaskGC); tossGC (pScreenPriv->pSaveGC); tossGC (pScreenPriv->pRestoreGC); tossGC (pScreenPriv->pMoveGC); tossGC (pScreenPriv->pPixSourceGC); tossGC (pScreenPriv->pPixMaskGC); tossPix (pScreenPriv->pSave); tossPix (pScreenPriv->pTemp); #ifdef ARGB_CURSOR tossPict (pScreenPriv->pRootPicture); tossPict (pScreenPriv->pTempPicture); #endif free ((void *) pScreenPriv); return (*pScreen->CloseScreen) (pScreen); } static Bool miDCRealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { if (pCursor->bits->refcnt <= 1) pCursor->bits->devPriv[pScreen->myNum] = (void *)NULL; return TRUE; } #ifdef ARGB_CURSOR #define EnsurePicture(picture,draw,win) (picture || miDCMakePicture(&picture,draw,win)) static VisualPtr miDCGetWindowVisual (WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; VisualID vid = wVisual (pWin); int i; for (i = 0; i < pScreen->numVisuals; i++) if (pScreen->visuals[i].vid == vid) return &pScreen->visuals[i]; return 0; } static PicturePtr miDCMakePicture (PicturePtr *ppPicture, DrawablePtr pDraw, WindowPtr pWin) { ScreenPtr pScreen = pDraw->pScreen; VisualPtr pVisual; PictFormatPtr pFormat; XID subwindow_mode = IncludeInferiors; PicturePtr pPicture; int error; pVisual = miDCGetWindowVisual (pWin); if (!pVisual) return 0; pFormat = PictureMatchVisual (pScreen, pDraw->depth, pVisual); if (!pFormat) return 0; pPicture = CreatePicture (0, pDraw, pFormat, CPSubwindowMode, &subwindow_mode, serverClient, &error); *ppPicture = pPicture; return pPicture; } #endif static miDCCursorPtr miDCRealize ( ScreenPtr pScreen, CursorPtr pCursor) { miDCCursorPtr pPriv; GCPtr pGC; XID gcvals[3]; pPriv = (miDCCursorPtr) malloc (sizeof (miDCCursorRec)); if (!pPriv) return (miDCCursorPtr)NULL; #ifdef ARGB_CURSOR if (pCursor->bits->argb) { PixmapPtr pPixmap; PictFormatPtr pFormat; int error; pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8); if (!pFormat) { free ((void *) pPriv); return (miDCCursorPtr)NULL; } pPriv->sourceBits = 0; pPriv->maskBits = 0; pPixmap = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 32, CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) { free ((void *) pPriv); return (miDCCursorPtr)NULL; } pGC = GetScratchGC (32, pScreen); if (!pGC) { (*pScreen->DestroyPixmap) (pPixmap); free ((void *) pPriv); return (miDCCursorPtr)NULL; } ValidateGC (&pPixmap->drawable, pGC); (*pGC->ops->PutImage) (&pPixmap->drawable, pGC, 32, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, ZPixmap, (char *) pCursor->bits->argb); FreeScratchGC (pGC); pPriv->pPicture = CreatePicture (0, &pPixmap->drawable, pFormat, 0, 0, serverClient, &error); (*pScreen->DestroyPixmap) (pPixmap); if (!pPriv->pPicture) { free ((void *) pPriv); return (miDCCursorPtr)NULL; } pCursor->bits->devPriv[pScreen->myNum] = (void *) pPriv; return pPriv; } pPriv->pPicture = 0; #endif pPriv->sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0); if (!pPriv->sourceBits) { free ((void *) pPriv); return (miDCCursorPtr)NULL; } pPriv->maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0); if (!pPriv->maskBits) { (*pScreen->DestroyPixmap) (pPriv->sourceBits); free ((void *) pPriv); return (miDCCursorPtr)NULL; } pCursor->bits->devPriv[pScreen->myNum] = (void *) pPriv; /* create the two sets of bits, clipping as appropriate */ pGC = GetScratchGC (1, pScreen); if (!pGC) { (void) miDCUnrealizeCursor (pScreen, pCursor); return (miDCCursorPtr)NULL; } ValidateGC ((DrawablePtr)pPriv->sourceBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr)pPriv->sourceBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *)pCursor->bits->source); gcvals[0] = GXand; ChangeGC (pGC, GCFunction, gcvals); ValidateGC ((DrawablePtr)pPriv->sourceBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr)pPriv->sourceBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *)pCursor->bits->mask); /* mask bits -- pCursor->mask & ~pCursor->source */ gcvals[0] = GXcopy; ChangeGC (pGC, GCFunction, gcvals); ValidateGC ((DrawablePtr)pPriv->maskBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr)pPriv->maskBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *)pCursor->bits->mask); gcvals[0] = GXandInverted; ChangeGC (pGC, GCFunction, gcvals); ValidateGC ((DrawablePtr)pPriv->maskBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr)pPriv->maskBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *)pCursor->bits->source); FreeScratchGC (pGC); return pPriv; } static Bool miDCUnrealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { miDCCursorPtr pPriv; pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; if (pPriv && (pCursor->bits->refcnt <= 1)) { if (pPriv->sourceBits) (*pScreen->DestroyPixmap) (pPriv->sourceBits); if (pPriv->maskBits) (*pScreen->DestroyPixmap) (pPriv->maskBits); #ifdef ARGB_CURSOR if (pPriv->pPicture) FreePicture (pPriv->pPicture, 0); #endif free ((void *) pPriv); pCursor->bits->devPriv[pScreen->myNum] = (void *)NULL; } return TRUE; } static void miDCPutBits ( DrawablePtr pDrawable, miDCCursorPtr pPriv, GCPtr sourceGC, GCPtr maskGC, int x_org, int y_org, unsigned w, unsigned h, unsigned long source, unsigned long mask) { XID gcvals[1]; int x, y; if (sourceGC->fgPixel != source) { gcvals[0] = source; DoChangeGC (sourceGC, GCForeground, gcvals, 0); } if (sourceGC->serialNumber != pDrawable->serialNumber) ValidateGC (pDrawable, sourceGC); if(sourceGC->miTranslate) { x = pDrawable->x + x_org; y = pDrawable->y + y_org; } else { x = x_org; y = y_org; } (*sourceGC->ops->PushPixels) (sourceGC, pPriv->sourceBits, pDrawable, w, h, x, y); if (maskGC->fgPixel != mask) { gcvals[0] = mask; DoChangeGC (maskGC, GCForeground, gcvals, 0); } if (maskGC->serialNumber != pDrawable->serialNumber) ValidateGC (pDrawable, maskGC); if(maskGC->miTranslate) { x = pDrawable->x + x_org; y = pDrawable->y + y_org; } else { x = x_org; y = y_org; } (*maskGC->ops->PushPixels) (maskGC, pPriv->maskBits, pDrawable, w, h, x, y); } #define EnsureGC(gc,win) (gc || miDCMakeGC(&gc, win)) static GCPtr miDCMakeGC( GCPtr *ppGC, WindowPtr pWin) { GCPtr pGC; int status; XID gcvals[2]; gcvals[0] = IncludeInferiors; gcvals[1] = FALSE; pGC = CreateGC((DrawablePtr)pWin, GCSubwindowMode|GCGraphicsExposures, gcvals, &status); if (pGC && pWin->drawable.pScreen->DrawGuarantee) (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack); *ppGC = pGC; return pGC; } static Bool miDCPutUpCursor (pScreen, pCursor, x, y, source, mask) ScreenPtr pScreen; CursorPtr pCursor; int x, y; unsigned long source, mask; { miDCScreenPtr pScreenPriv; miDCCursorPtr pPriv; WindowPtr pWin; pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; if (!pPriv) { pPriv = miDCRealize(pScreen, pCursor); if (!pPriv) return FALSE; } pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pWin = pScreen->root; #ifdef ARGB_CURSOR if (pPriv->pPicture) { if (!EnsurePicture(pScreenPriv->pRootPicture, &pWin->drawable, pWin)) return FALSE; CompositePicture (PictOpOver, pPriv->pPicture, NULL, pScreenPriv->pRootPicture, 0, 0, 0, 0, x, y, pCursor->bits->width, pCursor->bits->height); } else #endif { if (!EnsureGC(pScreenPriv->pSourceGC, pWin)) return FALSE; if (!EnsureGC(pScreenPriv->pMaskGC, pWin)) { FreeGC (pScreenPriv->pSourceGC, (GContext) 0); pScreenPriv->pSourceGC = 0; return FALSE; } miDCPutBits ((DrawablePtr)pWin, pPriv, pScreenPriv->pSourceGC, pScreenPriv->pMaskGC, x, y, pCursor->bits->width, pCursor->bits->height, source, mask); } return TRUE; } static Bool miDCSaveUnderCursor (pScreen, x, y, w, h) ScreenPtr pScreen; int x, y, w, h; { miDCScreenPtr pScreenPriv; PixmapPtr pSave; WindowPtr pWin; GCPtr pGC; pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pSave = pScreenPriv->pSave; pWin = pScreen->root; if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h) { if (pSave) (*pScreen->DestroyPixmap) (pSave); pScreenPriv->pSave = pSave = (*pScreen->CreatePixmap) (pScreen, w, h, pScreen->rootDepth, 0); if (!pSave) return FALSE; } if (!EnsureGC(pScreenPriv->pSaveGC, pWin)) return FALSE; pGC = pScreenPriv->pSaveGC; if (pSave->drawable.serialNumber != pGC->serialNumber) ValidateGC ((DrawablePtr) pSave, pGC); (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, x, y, w, h, 0, 0); return TRUE; } static Bool miDCRestoreUnderCursor (pScreen, x, y, w, h) ScreenPtr pScreen; int x, y, w, h; { miDCScreenPtr pScreenPriv; PixmapPtr pSave; WindowPtr pWin; GCPtr pGC; pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pSave = pScreenPriv->pSave; pWin = pScreen->root; if (!pSave) return FALSE; if (!EnsureGC(pScreenPriv->pRestoreGC, pWin)) return FALSE; pGC = pScreenPriv->pRestoreGC; if (pWin->drawable.serialNumber != pGC->serialNumber) ValidateGC ((DrawablePtr) pWin, pGC); (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, 0, 0, w, h, x, y); return TRUE; } static Bool miDCChangeSave (pScreen, x, y, w, h, dx, dy) ScreenPtr pScreen; int x, y, w, h, dx, dy; { miDCScreenPtr pScreenPriv; PixmapPtr pSave; WindowPtr pWin; GCPtr pGC; int sourcex, sourcey, destx, desty, copyw, copyh; pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pSave = pScreenPriv->pSave; pWin = pScreen->root; /* * restore the bits which are about to get trashed */ if (!pSave) return FALSE; if (!EnsureGC(pScreenPriv->pRestoreGC, pWin)) return FALSE; pGC = pScreenPriv->pRestoreGC; if (pWin->drawable.serialNumber != pGC->serialNumber) ValidateGC ((DrawablePtr) pWin, pGC); /* * copy the old bits to the screen. */ if (dy > 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, 0, h - dy, w, dy, x + dx, y + h); } else if (dy < 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, 0, 0, w, -dy, x + dx, y + dy); } if (dy >= 0) { desty = y + dy; sourcey = 0; copyh = h - dy; } else { desty = y; sourcey = - dy; copyh = h + dy; } if (dx > 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, w - dx, sourcey, dx, copyh, x + w, desty); } else if (dx < 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, 0, sourcey, -dx, copyh, x + dx, desty); } if (!EnsureGC(pScreenPriv->pSaveGC, pWin)) return FALSE; pGC = pScreenPriv->pSaveGC; if (pSave->drawable.serialNumber != pGC->serialNumber) ValidateGC ((DrawablePtr) pSave, pGC); /* * move the bits that are still valid within the pixmap */ if (dx >= 0) { sourcex = 0; destx = dx; copyw = w - dx; } else { destx = 0; sourcex = - dx; copyw = w + dx; } if (dy >= 0) { sourcey = 0; desty = dy; copyh = h - dy; } else { desty = 0; sourcey = -dy; copyh = h + dy; } (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pSave, pGC, sourcex, sourcey, copyw, copyh, destx, desty); /* * copy the new bits from the screen into the remaining areas of the * pixmap */ if (dy > 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, x, y, w, dy, 0, 0); } else if (dy < 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, x, y + h + dy, w, -dy, 0, h + dy); } if (dy >= 0) { desty = dy; sourcey = y + dy; copyh = h - dy; } else { desty = 0; sourcey = y; copyh = h + dy; } if (dx > 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, x, sourcey, dx, copyh, 0, desty); } else if (dx < 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, x + w + dx, sourcey, -dx, copyh, w + dx, desty); } return TRUE; } static Bool miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask) ScreenPtr pScreen; CursorPtr pCursor; int x, y, w, h, dx, dy; unsigned long source, mask; { miDCCursorPtr pPriv; miDCScreenPtr pScreenPriv; int status; WindowPtr pWin; GCPtr pGC; XID gcval = FALSE; PixmapPtr pTemp; pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; if (!pPriv) { pPriv = miDCRealize(pScreen, pCursor); if (!pPriv) return FALSE; } pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pWin = pScreen->root; pTemp = pScreenPriv->pTemp; if (!pTemp || pTemp->drawable.width != pScreenPriv->pSave->drawable.width || pTemp->drawable.height != pScreenPriv->pSave->drawable.height) { if (pTemp) (*pScreen->DestroyPixmap) (pTemp); #ifdef ARGB_CURSOR if (pScreenPriv->pTempPicture) { FreePicture (pScreenPriv->pTempPicture, 0); pScreenPriv->pTempPicture = 0; } #endif pScreenPriv->pTemp = pTemp = (*pScreen->CreatePixmap) (pScreen, w, h, pScreenPriv->pSave->drawable.depth, 0); if (!pTemp) return FALSE; } if (!pScreenPriv->pMoveGC) { pScreenPriv->pMoveGC = CreateGC ((DrawablePtr)pTemp, GCGraphicsExposures, &gcval, &status); if (!pScreenPriv->pMoveGC) return FALSE; } /* * copy the saved area to a temporary pixmap */ pGC = pScreenPriv->pMoveGC; if (pGC->serialNumber != pTemp->drawable.serialNumber) ValidateGC ((DrawablePtr) pTemp, pGC); (*pGC->ops->CopyArea)((DrawablePtr)pScreenPriv->pSave, (DrawablePtr)pTemp, pGC, 0, 0, w, h, 0, 0); /* * draw the cursor in the temporary pixmap */ #ifdef ARGB_CURSOR if (pPriv->pPicture) { if (!EnsurePicture(pScreenPriv->pTempPicture, &pTemp->drawable, pWin)) return FALSE; CompositePicture (PictOpOver, pPriv->pPicture, NULL, pScreenPriv->pTempPicture, 0, 0, 0, 0, dx, dy, pCursor->bits->width, pCursor->bits->height); } else #endif { if (!pScreenPriv->pPixSourceGC) { pScreenPriv->pPixSourceGC = CreateGC ((DrawablePtr)pTemp, GCGraphicsExposures, &gcval, &status); if (!pScreenPriv->pPixSourceGC) return FALSE; } if (!pScreenPriv->pPixMaskGC) { pScreenPriv->pPixMaskGC = CreateGC ((DrawablePtr)pTemp, GCGraphicsExposures, &gcval, &status); if (!pScreenPriv->pPixMaskGC) return FALSE; } miDCPutBits ((DrawablePtr)pTemp, pPriv, pScreenPriv->pPixSourceGC, pScreenPriv->pPixMaskGC, dx, dy, pCursor->bits->width, pCursor->bits->height, source, mask); } /* * copy the temporary pixmap onto the screen */ if (!EnsureGC(pScreenPriv->pRestoreGC, pWin)) return FALSE; pGC = pScreenPriv->pRestoreGC; if (pWin->drawable.serialNumber != pGC->serialNumber) ValidateGC ((DrawablePtr) pWin, pGC); (*pGC->ops->CopyArea) ((DrawablePtr) pTemp, (DrawablePtr) pWin, pGC, 0, 0, w, h, x, y); return TRUE; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mieq.c0000644000000000000000000001315013614532331016277 0ustar /* * $Xorg: mieq.c,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ * Copyright 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * * Author: Keith Packard, MIT X Consortium */ /* * mieq.c * * Machine independent event queue * */ # include # include # include # include "misc.h" # include "windowstr.h" # include "pixmapstr.h" # include "inputstr.h" # include "mi.h" # include "scrnintstr.h" #ifdef DPMSExtension # include "dpmsproc.h" # define DPMS_SERVER # include #endif #define QUEUE_SIZE 256 typedef struct _Event { xEvent event; ScreenPtr pScreen; } EventRec, *EventPtr; typedef struct _EventQueue { HWEventQueueType head, tail; /* long for SetInputCheck */ CARD32 lastEventTime; /* to avoid time running backwards */ Bool lastMotion; EventRec events[QUEUE_SIZE]; /* static allocation for signals */ DevicePtr pKbd, pPtr; /* device pointer, to get funcs */ ScreenPtr pEnqueueScreen; /* screen events are being delivered to */ ScreenPtr pDequeueScreen; /* screen events are being dispatched to */ } EventQueueRec, *EventQueuePtr; static EventQueueRec miEventQueue; Bool mieqInit (pKbd, pPtr) DevicePtr pKbd, pPtr; { miEventQueue.head = miEventQueue.tail = 0; miEventQueue.lastEventTime = GetTimeInMillis (); miEventQueue.pKbd = pKbd; miEventQueue.pPtr = pPtr; miEventQueue.lastMotion = FALSE; miEventQueue.pEnqueueScreen = screenInfo.screens[0]; miEventQueue.pDequeueScreen = miEventQueue.pEnqueueScreen; SetInputCheck (&miEventQueue.head, &miEventQueue.tail); return TRUE; } /* * Must be reentrant with ProcessInputEvents. Assumption: mieqEnqueue * will never be interrupted. If this is called from both signal * handlers and regular code, make sure the signal is suspended when * called from regular code. */ void mieqEnqueue (e) xEvent *e; { HWEventQueueType oldtail, newtail; Bool isMotion; oldtail = miEventQueue.tail; isMotion = e->u.u.type == MotionNotify; if (isMotion && miEventQueue.lastMotion && oldtail != miEventQueue.head) { if (oldtail == 0) oldtail = QUEUE_SIZE; oldtail = oldtail - 1; } else { newtail = oldtail + 1; if (newtail == QUEUE_SIZE) newtail = 0; /* Toss events which come in late */ if (newtail == miEventQueue.head) return; miEventQueue.tail = newtail; } miEventQueue.lastMotion = isMotion; miEventQueue.events[oldtail].event = *e; /* * Make sure that event times don't go backwards - this * is "unnecessary", but very useful */ if (e->u.keyButtonPointer.time < miEventQueue.lastEventTime && miEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000) { miEventQueue.events[oldtail].event.u.keyButtonPointer.time = miEventQueue.lastEventTime; } miEventQueue.lastEventTime = miEventQueue.events[oldtail].event.u.keyButtonPointer.time; miEventQueue.events[oldtail].pScreen = miEventQueue.pEnqueueScreen; } void mieqSwitchScreen (pScreen, fromDIX) ScreenPtr pScreen; Bool fromDIX; { miEventQueue.pEnqueueScreen = pScreen; if (fromDIX) miEventQueue.pDequeueScreen = pScreen; } /* * Call this from ProcessInputEvents() */ void mieqProcessInputEvents () { EventRec *e; int x, y; xEvent xe; while (miEventQueue.head != miEventQueue.tail) { if (screenIsSaved == SCREEN_SAVER_ON) SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset); #ifdef DPMSExtension else if (DPMSPowerLevel != DPMSModeOn) SetScreenSaverTimer(); if (DPMSPowerLevel != DPMSModeOn) DPMSSet(DPMSModeOn); #endif e = &miEventQueue.events[miEventQueue.head]; /* * Assumption - screen switching can only occur on motion events */ if (e->pScreen != miEventQueue.pDequeueScreen) { miEventQueue.pDequeueScreen = e->pScreen; x = e->event.u.keyButtonPointer.rootX; y = e->event.u.keyButtonPointer.rootY; if (miEventQueue.head == QUEUE_SIZE - 1) miEventQueue.head = 0; else ++miEventQueue.head; NewCurrentScreen (miEventQueue.pDequeueScreen, x, y); } else { xe = e->event; if (miEventQueue.head == QUEUE_SIZE - 1) miEventQueue.head = 0; else ++miEventQueue.head; switch (xe.u.u.type) { case KeyPress: case KeyRelease: (*miEventQueue.pKbd->processInputProc) (&xe, (DeviceIntPtr)miEventQueue.pKbd, 1); break; default: (*miEventQueue.pPtr->processInputProc) (&xe, (DeviceIntPtr)miEventQueue.pPtr, 1); break; } } } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/miexpose.c0000644000000000000000000006140713614532331017205 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "regionstr.h" #include "scrnintstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmap.h" #include "input.h" #include "dixstruct.h" #include "mi.h" #include #include "globals.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #endif /* machine-independent graphics exposure code. any device that uses the region package can call this. */ #ifndef RECTLIMIT #define RECTLIMIT 25 /* pick a number, any number > 8 */ #endif /* miHandleExposures generate a region for exposures for areas that were copied from obscured or non-existent areas to non-obscured areas of the destination. Paint the background for the region, if the destination is a window. NOTE: this should generally be called, even if graphicsExposures is false, because this is where bits get recovered from backing store. NOTE: added argument 'plane' is used to indicate how exposures from backing store should be accomplished. If plane is 0 (i.e. no bit plane), CopyArea should be used, else a CopyPlane of the indicated plane will be used. The exposing is done by the backing store's GraphicsExpose function, of course. */ RegionPtr miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, plane) register DrawablePtr pSrcDrawable; register DrawablePtr pDstDrawable; GCPtr pGC; int srcx, srcy; int width, height; int dstx, dsty; unsigned long plane; { register ScreenPtr pscr; RegionPtr prgnSrcClip; /* drawable-relative source clip */ RegionRec rgnSrcRec; RegionPtr prgnDstClip; /* drawable-relative dest clip */ RegionRec rgnDstRec; BoxRec srcBox; /* unclipped source */ RegionRec rgnExposed; /* exposed region, calculated source- relative, made dst relative to intersect with visible parts of dest and send events to client, and then screen relative to paint the window background */ WindowPtr pSrcWin; BoxRec expBox = { 0, }; Bool extents; /* This prevents warning about pscr not being used. */ pGC->pScreen = pscr = pGC->pScreen; /* avoid work if we can */ if (!pGC->graphicsExposures && (pDstDrawable->type == DRAWABLE_PIXMAP) && ((pSrcDrawable->type == DRAWABLE_PIXMAP) || (((WindowPtr)pSrcDrawable)->backStorage == NULL))) return NULL; srcBox.x1 = srcx; srcBox.y1 = srcy; srcBox.x2 = srcx+width; srcBox.y2 = srcy+height; if (pSrcDrawable->type != DRAWABLE_PIXMAP) { BoxRec TsrcBox; TsrcBox.x1 = srcx + pSrcDrawable->x; TsrcBox.y1 = srcy + pSrcDrawable->y; TsrcBox.x2 = TsrcBox.x1 + width; TsrcBox.y2 = TsrcBox.y1 + height; pSrcWin = (WindowPtr) pSrcDrawable; if (pGC->subWindowMode == IncludeInferiors) { prgnSrcClip = NotClippedByChildren (pSrcWin); if ((RegionContainsRect(prgnSrcClip, &TsrcBox)) == rgnIN) { RegionDestroy(prgnSrcClip); return NULL; } } else { if ((RegionContainsRect(&pSrcWin->clipList, &TsrcBox)) == rgnIN) return NULL; prgnSrcClip = &rgnSrcRec; RegionNull(prgnSrcClip); RegionCopy(prgnSrcClip, &pSrcWin->clipList); } RegionTranslate(prgnSrcClip, -pSrcDrawable->x, -pSrcDrawable->y); } else { BoxRec box; if ((srcBox.x1 >= 0) && (srcBox.y1 >= 0) && (srcBox.x2 <= pSrcDrawable->width) && (srcBox.y2 <= pSrcDrawable->height)) return NULL; box.x1 = 0; box.y1 = 0; box.x2 = pSrcDrawable->width; box.y2 = pSrcDrawable->height; prgnSrcClip = &rgnSrcRec; RegionInit(prgnSrcClip, &box, 1); pSrcWin = (WindowPtr)NULL; } if (pDstDrawable == pSrcDrawable) { prgnDstClip = prgnSrcClip; } else if (pDstDrawable->type != DRAWABLE_PIXMAP) { if (pGC->subWindowMode == IncludeInferiors) { prgnDstClip = NotClippedByChildren((WindowPtr)pDstDrawable); } else { prgnDstClip = &rgnDstRec; RegionNull(prgnDstClip); RegionCopy(prgnDstClip, &((WindowPtr)pDstDrawable)->clipList); } RegionTranslate(prgnDstClip, -pDstDrawable->x, -pDstDrawable->y); } else { BoxRec box; box.x1 = 0; box.y1 = 0; box.x2 = pDstDrawable->width; box.y2 = pDstDrawable->height; prgnDstClip = &rgnDstRec; RegionInit(prgnDstClip, &box, 1); } /* drawable-relative source region */ RegionInit(&rgnExposed, &srcBox, 1); /* now get the hidden parts of the source box*/ RegionSubtract(&rgnExposed, &rgnExposed, prgnSrcClip); if (pSrcWin && pSrcWin->backStorage) { /* * Copy any areas from the source backing store. Modifies * rgnExposed. */ (* pSrcWin->drawable.pScreen->ExposeCopy) ((WindowPtr)pSrcDrawable, pDstDrawable, pGC, &rgnExposed, srcx, srcy, dstx, dsty, plane); } /* move them over the destination */ RegionTranslate(&rgnExposed, dstx-srcx, dsty-srcy); /* intersect with visible areas of dest */ RegionIntersect(&rgnExposed, &rgnExposed, prgnDstClip); /* * If we have LOTS of rectangles, we decide to take the extents * and force an exposure on that. This should require much less * work overall, on both client and server. This is cheating, but * isn't prohibited by the protocol ("spontaneous combustion" :-) * for windows. */ extents = pGC->graphicsExposures && (RegionNumRects(&rgnExposed) > RECTLIMIT) && (pDstDrawable->type != DRAWABLE_PIXMAP); #ifdef SHAPE if (pSrcWin) { RegionPtr region; if (!(region = wClipShape (pSrcWin))) region = wBoundingShape (pSrcWin); /* * If you try to CopyArea the extents of a shaped window, compacting the * exposed region will undo all our work! */ if (extents && pSrcWin && region && (RegionContainsRect(region, &srcBox) != rgnIN)) extents = FALSE; } #endif if (extents) { WindowPtr pWin = (WindowPtr)pDstDrawable; expBox = *RegionExtents(&rgnExposed); RegionReset(&rgnExposed, &expBox); /* need to clear out new areas of backing store */ if (pWin->backStorage) (void) (* pWin->drawable.pScreen->ClearBackingStore)( pWin, expBox.x1, expBox.y1, expBox.x2 - expBox.x1, expBox.y2 - expBox.y1, FALSE); } if ((pDstDrawable->type != DRAWABLE_PIXMAP) && (((WindowPtr)pDstDrawable)->backgroundState != None)) { WindowPtr pWin = (WindowPtr)pDstDrawable; /* make the exposed area screen-relative */ RegionTranslate(&rgnExposed, pDstDrawable->x, pDstDrawable->y); if (extents) { /* PaintWindowBackground doesn't clip, so we have to */ RegionIntersect(&rgnExposed, &rgnExposed, &pWin->clipList); } (*pWin->drawable.pScreen->PaintWindowBackground)( (WindowPtr)pDstDrawable, &rgnExposed, PW_BACKGROUND); if (extents) { RegionReset(&rgnExposed, &expBox); } else RegionTranslate(&rgnExposed, -pDstDrawable->x, -pDstDrawable->y); } if (prgnDstClip == &rgnDstRec) { RegionUninit(prgnDstClip); } else if (prgnDstClip != prgnSrcClip) { RegionDestroy(prgnDstClip); } if (prgnSrcClip == &rgnSrcRec) { RegionUninit(prgnSrcClip); } else { RegionDestroy(prgnSrcClip); } if (pGC->graphicsExposures) { /* don't look */ RegionPtr exposed = RegionCreate(NullBox, 0); *exposed = rgnExposed; return exposed; } else { RegionUninit(&rgnExposed); return NULL; } } /* send GraphicsExpose events, or a NoExpose event, based on the region */ void miSendGraphicsExpose (client, pRgn, drawable, major, minor) ClientPtr client; RegionPtr pRgn; XID drawable; int major; int minor; { if (pRgn && !RegionNil(pRgn)) { xEvent *pEvent; register xEvent *pe; register BoxPtr pBox; register int i; int numRects; numRects = RegionNumRects(pRgn); pBox = RegionRects(pRgn); if(!(pEvent = (xEvent *)calloc(numRects, sizeof(xEvent)))) return; pe = pEvent; for (i=1; i<=numRects; i++, pe++, pBox++) { pe->u.u.type = GraphicsExpose; pe->u.graphicsExposure.drawable = drawable; pe->u.graphicsExposure.x = pBox->x1; pe->u.graphicsExposure.y = pBox->y1; pe->u.graphicsExposure.width = pBox->x2 - pBox->x1; pe->u.graphicsExposure.height = pBox->y2 - pBox->y1; pe->u.graphicsExposure.count = numRects - i; pe->u.graphicsExposure.majorEvent = major; pe->u.graphicsExposure.minorEvent = minor; } TryClientEvents(client, pEvent, numRects, (Mask)0, NoEventMask, NullGrab); free(pEvent); } else { xEvent event = {0}; event.u.u.type = NoExpose; event.u.noExposure.drawable = drawable; event.u.noExposure.majorEvent = major; event.u.noExposure.minorEvent = minor; TryClientEvents(client, &event, 1, (Mask)0, NoEventMask, NullGrab); } } void miSendExposures(pWin, pRgn, dx, dy) WindowPtr pWin; RegionPtr pRgn; register int dx, dy; { register BoxPtr pBox; int numRects; register xEvent *pEvent, *pe; register int i; pBox = RegionRects(pRgn); numRects = RegionNumRects(pRgn); if(!(pEvent = (xEvent *) calloc(numRects, sizeof(xEvent)))) return; for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++) { pe->u.u.type = Expose; pe->u.expose.window = pWin->drawable.id; pe->u.expose.x = pBox->x1 - dx; pe->u.expose.y = pBox->y1 - dy; pe->u.expose.width = pBox->x2 - pBox->x1; pe->u.expose.height = pBox->y2 - pBox->y1; pe->u.expose.count = i; } #ifdef PANORAMIX if(!noPanoramiXExtension) { int scrnum = pWin->drawable.pScreen->myNum; int x = 0, y = 0; XID realWin = 0; if(!pWin->parent) { x = panoramiXdataPtr[scrnum].x; y = panoramiXdataPtr[scrnum].y; pWin = screenInfo.screens[0]->root; realWin = pWin->drawable.id; } else if (scrnum) { PanoramiXRes *win; win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, scrnum); if(!win) { free(pEvent); return; } realWin = win->info[0].id; pWin = LookupIDByType(realWin, RT_WINDOW); } if(x || y || scrnum) for (i = 0; i < numRects; i++) { pEvent[i].u.expose.window = realWin; pEvent[i].u.expose.x += x; pEvent[i].u.expose.y += y; } } #endif DeliverEvents(pWin, pEvent, numRects, NullWindow); free(pEvent); } void miWindowExposures(pWin, prgn, other_exposed) WindowPtr pWin; register RegionPtr prgn, other_exposed; { RegionPtr exposures = prgn; if (pWin->backStorage && prgn) /* * in some cases, backing store will cause a different * region to be exposed than needs to be repainted * (like when a window is mapped). RestoreAreas is * allowed to return a region other than prgn, * in which case this routine will free the resultant * region. If exposures is null, then no events will * be sent to the client; if prgn is empty * no areas will be repainted. */ exposures = (*pWin->drawable.pScreen->RestoreAreas)(pWin, prgn); if ((prgn && !RegionNil(prgn)) || (exposures && !RegionNil(exposures)) || other_exposed) { RegionRec expRec; int clientInterested; /* * Restore from backing-store FIRST. */ clientInterested = (pWin->eventMask|wOtherEventMasks(pWin)) & ExposureMask; if (other_exposed) { if (exposures) { RegionUnion(other_exposed, exposures, other_exposed); if (exposures != prgn) RegionDestroy(exposures); } exposures = other_exposed; } if (clientInterested && exposures && (RegionNumRects(exposures) > RECTLIMIT)) { /* * If we have LOTS of rectangles, we decide to take the extents * and force an exposure on that. This should require much less * work overall, on both client and server. This is cheating, but * isn't prohibited by the protocol ("spontaneous combustion" :-). */ BoxRec box; box = *RegionExtents(exposures); if (exposures == prgn) { exposures = &expRec; RegionInit(exposures, &box, 1); RegionReset(prgn, &box); } else { RegionReset(exposures, &box); RegionUnion(prgn, prgn, exposures); } /* PaintWindowBackground doesn't clip, so we have to */ RegionIntersect(prgn, prgn, &pWin->clipList); /* need to clear out new areas of backing store, too */ if (pWin->backStorage) (void) (* pWin->drawable.pScreen->ClearBackingStore)( pWin, box.x1 - pWin->drawable.x, box.y1 - pWin->drawable.y, box.x2 - box.x1, box.y2 - box.y1, FALSE); } if (prgn && !RegionNil(prgn)) (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, prgn, PW_BACKGROUND); if (clientInterested && exposures && !RegionNil(exposures)) miSendExposures(pWin, exposures, pWin->drawable.x, pWin->drawable.y); if (exposures == &expRec) { RegionUninit(exposures); } else if (exposures && exposures != prgn && exposures != other_exposed) RegionDestroy(exposures); if (prgn) RegionEmpty(prgn); } else if (exposures && exposures != prgn) RegionDestroy(exposures); } /* this code is highly unlikely. it is not haile selassie. there is some hair here. we can't just use the window's clip region as it is, because if we are painting the border, the border is not in the client area and so we will be excluded when we validate the GC, and if we are painting a parent-relative background, the area we want to paint is in some other window. since we trust the code calling us to tell us to paint only areas that are really ours, we will temporarily give the window a clipList the size of the whole screen and an origin at (0,0). this more or less assumes that ddX code will do translation based on the window's absolute position, and that ValidateGC will look at clipList, and that no other fields from the window will be used. it's not possible to just draw in the root because it may be a different depth. to get the tile to align correctly we set the GC's tile origin to be the (x,y) of the window's upper left corner, after which we get the right bits when drawing into the root. because the clip_mask is being set to None, we may call DoChangeGC with fPointer set true, thus we no longer need to install the background or border tile in the resource table. */ static RESTYPE ResType = 0; static int numGCs = 0; static GCPtr screenContext[MAXSCREENS]; /*ARGSUSED*/ static int tossGC ( void * value, XID id) { GCPtr pGC = (GCPtr)value; screenContext[pGC->pScreen->myNum] = (GCPtr)NULL; FreeGC (pGC, id); numGCs--; if (!numGCs) ResType = 0; return 0; } void miPaintWindow(pWin, prgn, what) register WindowPtr pWin; RegionPtr prgn; int what; { int status; Bool usingScratchGC = FALSE; WindowPtr pRoot; #define FUNCTION 0 #define FOREGROUND 1 #define TILE 2 #define FILLSTYLE 3 #define ABSX 4 #define ABSY 5 #define CLIPMASK 6 #define SUBWINDOW 7 #define COUNT_BITS 8 ChangeGCVal gcval[7]; ChangeGCVal newValues [COUNT_BITS] = {{ 0 }}; BITS32 gcmask, index, mask; RegionRec prgnWin = {0}; DDXPointRec oldCorner = {0}; BoxRec box = {0}; WindowPtr pBgWin; GCPtr pGC; register int i; register BoxPtr pbox; register ScreenPtr pScreen = pWin->drawable.pScreen; register xRectangle *prect; int numRects; gcmask = 0; if (what == PW_BACKGROUND) { switch (pWin->backgroundState) { case None: return; case ParentRelative: (*pWin->parent->drawable.pScreen->PaintWindowBackground)(pWin->parent, prgn, what); return; case BackgroundPixel: newValues[FOREGROUND].val = pWin->background.pixel; newValues[FILLSTYLE].val = FillSolid; gcmask |= GCForeground | GCFillStyle; break; case BackgroundPixmap: newValues[TILE].ptr = (void *)pWin->background.pixmap; newValues[FILLSTYLE].val = FillTiled; gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin; break; } } else { if (pWin->borderIsPixel) { newValues[FOREGROUND].val = pWin->border.pixel; newValues[FILLSTYLE].val = FillSolid; gcmask |= GCForeground | GCFillStyle; } else { newValues[TILE].ptr = (void *)pWin->border.pixmap; newValues[FILLSTYLE].val = FillTiled; gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin; } } prect = (xRectangle *)calloc(RegionNumRects(prgn), sizeof(xRectangle)); if (!prect) return; newValues[FUNCTION].val = GXcopy; gcmask |= GCFunction | GCClipMask; i = pScreen->myNum; pRoot = screenInfo.screens[i]->root; pBgWin = pWin; if (what == PW_BORDER) { while (pBgWin->backgroundState == ParentRelative) pBgWin = pBgWin->parent; } if ((pWin->drawable.depth != pRoot->drawable.depth) || (pWin->drawable.bitsPerPixel != pRoot->drawable.bitsPerPixel)) { usingScratchGC = TRUE; pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); if (!pGC) { free(prect); return; } /* * mash the clip list so we can paint the border by * mangling the window in place, pretending it * spans the entire screen */ if (what == PW_BORDER) { prgnWin = pWin->clipList; oldCorner.x = pWin->drawable.x; oldCorner.y = pWin->drawable.y; pWin->drawable.x = pWin->drawable.y = 0; box.x1 = 0; box.y1 = 0; box.x2 = pScreen->width; box.y2 = pScreen->height; RegionInit(&pWin->clipList, &box, 1); pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; newValues[ABSX].val = pBgWin->drawable.x; newValues[ABSY].val = pBgWin->drawable.y; } else { newValues[ABSX].val = 0; newValues[ABSY].val = 0; } } else { /* * draw the background to the root window */ if (screenContext[i] == (GCPtr)NULL) { if (!ResType && !(ResType = CreateNewResourceType(tossGC))) { free(prect); return; } screenContext[i] = CreateGC((DrawablePtr)pWin, (BITS32) 0, (XID *)NULL, &status); if (!screenContext[i]) { free(prect); return; } numGCs++; if (!AddResource(FakeClientID(0), ResType, (void *)screenContext[i])) { free(prect); return; } } pGC = screenContext[i]; newValues[SUBWINDOW].val = IncludeInferiors; newValues[ABSX].val = pBgWin->drawable.x; newValues[ABSY].val = pBgWin->drawable.y; gcmask |= GCSubwindowMode; pWin = pRoot; } if (pWin->backStorage) (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack); mask = gcmask; gcmask = 0; i = 0; while (mask) { index = lowbit (mask); mask &= ~index; switch (index) { case GCFunction: if (pGC->alu != newValues[FUNCTION].val) { gcmask |= index; gcval[i++].val = newValues[FUNCTION].val; } break; case GCTileStipXOrigin: if ( pGC->patOrg.x != newValues[ABSX].val) { gcmask |= index; gcval[i++].val = newValues[ABSX].val; } break; case GCTileStipYOrigin: if ( pGC->patOrg.y != newValues[ABSY].val) { gcmask |= index; gcval[i++].val = newValues[ABSY].val; } break; case GCClipMask: if ( pGC->clientClipType != CT_NONE) { gcmask |= index; gcval[i++].val = CT_NONE; } break; case GCSubwindowMode: if ( pGC->subWindowMode != newValues[SUBWINDOW].val) { gcmask |= index; gcval[i++].val = newValues[SUBWINDOW].val; } break; case GCTile: if (pGC->tileIsPixel || pGC->tile.pixmap != newValues[TILE].ptr) { gcmask |= index; gcval[i++].ptr = newValues[TILE].ptr; } break; case GCFillStyle: if ( pGC->fillStyle != newValues[FILLSTYLE].val) { gcmask |= index; gcval[i++].val = newValues[FILLSTYLE].val; } break; case GCForeground: if ( pGC->fgPixel != newValues[FOREGROUND].val) { gcmask |= index; gcval[i++].val = newValues[FOREGROUND].val; } break; } } if (gcmask) dixChangeGC(NullClient, pGC, gcmask, NULL, gcval); if (pWin->drawable.serialNumber != pGC->serialNumber) ValidateGC((DrawablePtr)pWin, pGC); numRects = RegionNumRects(prgn); pbox = RegionRects(prgn); for (i= numRects; --i >= 0; pbox++, prect++) { prect->x = pbox->x1 - pWin->drawable.x; prect->y = pbox->y1 - pWin->drawable.y; prect->width = pbox->x2 - pbox->x1; prect->height = pbox->y2 - pbox->y1; } prect -= numRects; (*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect); free(prect); if (pWin->backStorage) (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing); if (usingScratchGC) { if (what == PW_BORDER) { RegionUninit(&pWin->clipList); pWin->clipList = prgnWin; pWin->drawable.x = oldCorner.x; pWin->drawable.y = oldCorner.y; pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; } FreeScratchGC(pGC); } } /* MICLEARDRAWABLE -- sets the entire drawable to the background color of * the GC. Useful when we have a scratch drawable and need to initialize * it. */ void miClearDrawable(pDraw, pGC) DrawablePtr pDraw; GCPtr pGC; { XID fg = pGC->fgPixel; XID bg = pGC->bgPixel; xRectangle rect = {0}; rect.x = 0; rect.y = 0; rect.width = pDraw->width; rect.height = pDraw->height; DoChangeGC(pGC, GCForeground, &bg, 0); ValidateGC(pDraw, pGC); (*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect); DoChangeGC(pGC, GCForeground, &fg, 0); ValidateGC(pDraw, pGC); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mifillarc.c0000644000000000000000000004173613614532331017321 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Author: Bob Scheifler, MIT X Consortium ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "regionstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "mifpoly.h" #include "mi.h" #include "mifillarc.h" #define QUADRANT (90 * 64) #define HALFCIRCLE (180 * 64) #define QUADRANT3 (270 * 64) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #define Dsin(d) sin((double)d*(M_PI/11520.0)) #define Dcos(d) cos((double)d*(M_PI/11520.0)) void miFillArcSetup(arc, info) register xArc *arc; register miFillArcRec *info; { info->y = arc->height >> 1; info->dy = arc->height & 1; info->yorg = arc->y + info->y; info->dx = arc->width & 1; info->xorg = arc->x + (arc->width >> 1) + info->dx; info->dx = 1 - info->dx; if (arc->width == arc->height) { /* (2x - 2xorg)^2 = d^2 - (2y - 2yorg)^2 */ /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */ info->ym = 8; info->xm = 8; info->yk = info->y << 3; if (!info->dx) { info->xk = 0; info->e = -1; } else { info->y++; info->yk += 4; info->xk = -4; info->e = - (info->y << 3); } } else { /* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */ /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */ info->ym = (arc->width * arc->width) << 3; info->xm = (arc->height * arc->height) << 3; info->yk = info->y * info->ym; if (!info->dy) info->yk -= info->ym >> 1; if (!info->dx) { info->xk = 0; info->e = - (info->xm >> 3); } else { info->y++; info->yk += info->ym; info->xk = -(info->xm >> 1); info->e = info->xk - info->yk; } } } void miFillArcDSetup(arc, info) register xArc *arc; register miFillArcDRec *info; { /* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */ /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */ info->y = arc->height >> 1; info->dy = arc->height & 1; info->yorg = arc->y + info->y; info->dx = arc->width & 1; info->xorg = arc->x + (arc->width >> 1) + info->dx; info->dx = 1 - info->dx; info->ym = ((double)arc->width) * (arc->width * 8); info->xm = ((double)arc->height) * (arc->height * 8); info->yk = info->y * info->ym; if (!info->dy) info->yk -= info->ym / 2.0; if (!info->dx) { info->xk = 0; info->e = - (info->xm / 8.0); } else { info->y++; info->yk += info->ym; info->xk = -info->xm / 2.0; info->e = info->xk - info->yk; } } static void miGetArcEdge( register xArc *arc, register miSliceEdgePtr edge, int k, Bool top, Bool left ) { register int xady, y; y = arc->height >> 1; if (!(arc->width & 1)) y++; if (!top) { y = -y; if (arc->height & 1) y--; } xady = k + y * edge->dx; if (xady <= 0) edge->x = - ((-xady) / edge->dy + 1); else edge->x = (xady - 1) / edge->dy; edge->e = xady - edge->x * edge->dy; if ((top && (edge->dx < 0)) || (!top && (edge->dx > 0))) edge->e = edge->dy - edge->e + 1; if (left) edge->x++; edge->x += arc->x + (arc->width >> 1); if (edge->dx > 0) { edge->deltax = 1; edge->stepx = edge->dx / edge->dy; edge->dx = edge->dx % edge->dy; } else { edge->deltax = -1; edge->stepx = - ((-edge->dx) / edge->dy); edge->dx = (-edge->dx) % edge->dy; } if (!top) { edge->deltax = -edge->deltax; edge->stepx = -edge->stepx; } } void miEllipseAngleToSlope (angle, width, height, dxp, dyp, d_dxp, d_dyp) int angle; int width; int height; int *dxp; int *dyp; double *d_dxp; double *d_dyp; { int dx, dy; double d_dx, d_dy, scale; Bool negative_dx, negative_dy; switch (angle) { case 0: *dxp = -1; *dyp = 0; if (d_dxp) { *d_dxp = width / 2.0; *d_dyp = 0; } break; case QUADRANT: *dxp = 0; *dyp = 1; if (d_dxp) { *d_dxp = 0; *d_dyp = - height / 2.0; } break; case HALFCIRCLE: *dxp = 1; *dyp = 0; if (d_dxp) { *d_dxp = - width / 2.0; *d_dyp = 0; } break; case QUADRANT3: *dxp = 0; *dyp = -1; if (d_dxp) { *d_dxp = 0; *d_dyp = height / 2.0; } break; default: d_dx = Dcos(angle) * width; d_dy = Dsin(angle) * height; if (d_dxp) { *d_dxp = d_dx / 2.0; *d_dyp = - d_dy / 2.0; } negative_dx = FALSE; if (d_dx < 0.0) { d_dx = -d_dx; negative_dx = TRUE; } negative_dy = FALSE; if (d_dy < 0.0) { d_dy = -d_dy; negative_dy = TRUE; } scale = d_dx; if (d_dy > d_dx) scale = d_dy; dx = floor ((d_dx * 32768) / scale + 0.5); if (negative_dx) dx = -dx; *dxp = dx; dy = floor ((d_dy * 32768) / scale + 0.5); if (negative_dy) dy = -dy; *dyp = dy; break; } } static void miGetPieEdge( register xArc *arc, register int angle, register miSliceEdgePtr edge, Bool top, Bool left ) { register int k; int dx, dy; miEllipseAngleToSlope (angle, arc->width, arc->height, &dx, &dy, 0, 0); if (dy == 0) { edge->x = left ? -65536 : 65536; edge->stepx = 0; edge->e = 0; edge->dx = -1; return; } if (dx == 0) { edge->x = arc->x + (arc->width >> 1); if (left && (arc->width & 1)) edge->x++; else if (!left && !(arc->width & 1)) edge->x--; edge->stepx = 0; edge->e = 0; edge->dx = -1; return; } if (dy < 0) { dx = -dx; dy = -dy; } k = (arc->height & 1) ? dx : 0; if (arc->width & 1) k += dy; edge->dx = dx << 1; edge->dy = dy << 1; miGetArcEdge(arc, edge, k, top, left); } void miFillArcSliceSetup(arc, slice, pGC) register xArc *arc; register miArcSliceRec *slice; GCPtr pGC; { register int angle1, angle2; angle1 = arc->angle1; if (arc->angle2 < 0) { angle2 = angle1; angle1 += arc->angle2; } else angle2 = angle1 + arc->angle2; while (angle1 < 0) angle1 += FULLCIRCLE; while (angle1 >= FULLCIRCLE) angle1 -= FULLCIRCLE; while (angle2 < 0) angle2 += FULLCIRCLE; while (angle2 >= FULLCIRCLE) angle2 -= FULLCIRCLE; slice->min_top_y = 0; slice->max_top_y = arc->height >> 1; slice->min_bot_y = 1 - (arc->height & 1); slice->max_bot_y = slice->max_top_y - 1; slice->flip_top = FALSE; slice->flip_bot = FALSE; if (pGC->arcMode == ArcPieSlice) { slice->edge1_top = (angle1 < HALFCIRCLE); slice->edge2_top = (angle2 <= HALFCIRCLE); if ((angle2 == 0) || (angle1 == HALFCIRCLE)) { if (angle2 ? slice->edge2_top : slice->edge1_top) slice->min_top_y = slice->min_bot_y; else slice->min_top_y = arc->height; slice->min_bot_y = 0; } else if ((angle1 == 0) || (angle2 == HALFCIRCLE)) { slice->min_top_y = slice->min_bot_y; if (angle1 ? slice->edge1_top : slice->edge2_top) slice->min_bot_y = arc->height; else slice->min_bot_y = 0; } else if (slice->edge1_top == slice->edge2_top) { if (angle2 < angle1) { slice->flip_top = slice->edge1_top; slice->flip_bot = !slice->edge1_top; } else if (slice->edge1_top) { slice->min_top_y = 1; slice->min_bot_y = arc->height; } else { slice->min_bot_y = 0; slice->min_top_y = arc->height; } } miGetPieEdge(arc, angle1, &slice->edge1, slice->edge1_top, !slice->edge1_top); miGetPieEdge(arc, angle2, &slice->edge2, slice->edge2_top, slice->edge2_top); } else { double w2, h2, x1, y1, x2, y2, dx, dy, scale; int signdx, signdy, y, k; Bool isInt1 = TRUE, isInt2 = TRUE; w2 = (double)arc->width / 2.0; h2 = (double)arc->height / 2.0; if ((angle1 == 0) || (angle1 == HALFCIRCLE)) { x1 = angle1 ? -w2 : w2; y1 = 0.0; } else if ((angle1 == QUADRANT) || (angle1 == QUADRANT3)) { x1 = 0.0; y1 = (angle1 == QUADRANT) ? h2 : -h2; } else { isInt1 = FALSE; x1 = Dcos(angle1) * w2; y1 = Dsin(angle1) * h2; } if ((angle2 == 0) || (angle2 == HALFCIRCLE)) { x2 = angle2 ? -w2 : w2; y2 = 0.0; } else if ((angle2 == QUADRANT) || (angle2 == QUADRANT3)) { x2 = 0.0; y2 = (angle2 == QUADRANT) ? h2 : -h2; } else { isInt2 = FALSE; x2 = Dcos(angle2) * w2; y2 = Dsin(angle2) * h2; } dx = x2 - x1; dy = y2 - y1; if (arc->height & 1) { y1 -= 0.5; y2 -= 0.5; } if (arc->width & 1) { x1 += 0.5; x2 += 0.5; } if (dy < 0.0) { dy = -dy; signdy = -1; } else signdy = 1; if (dx < 0.0) { dx = -dx; signdx = -1; } else signdx = 1; if (isInt1 && isInt2) { slice->edge1.dx = dx * 2; slice->edge1.dy = dy * 2; } else { scale = (dx > dy) ? dx : dy; slice->edge1.dx = floor((dx * 32768) / scale + .5); slice->edge1.dy = floor((dy * 32768) / scale + .5); } if (!slice->edge1.dy) { if (signdx < 0) { y = floor(y1 + 1.0); if (y >= 0) { slice->min_top_y = y; slice->min_bot_y = arc->height; } else { slice->max_bot_y = -y - (arc->height & 1); } } else { y = floor(y1); if (y >= 0) slice->max_top_y = y; else { slice->min_top_y = arc->height; slice->min_bot_y = -y - (arc->height & 1); } } slice->edge1_top = TRUE; slice->edge1.x = 65536; slice->edge1.stepx = 0; slice->edge1.e = 0; slice->edge1.dx = -1; slice->edge2 = slice->edge1; slice->edge2_top = FALSE; } else if (!slice->edge1.dx) { if (signdy < 0) x1 -= 1.0; slice->edge1.x = ceil(x1); slice->edge1_top = signdy < 0; slice->edge1.x += arc->x + (arc->width >> 1); slice->edge1.stepx = 0; slice->edge1.e = 0; slice->edge1.dx = -1; slice->edge2_top = !slice->edge1_top; slice->edge2 = slice->edge1; } else { if (signdx < 0) slice->edge1.dx = -slice->edge1.dx; if (signdy < 0) slice->edge1.dx = -slice->edge1.dx; k = ceil(((x1 + x2) * slice->edge1.dy - (y1 + y2) * slice->edge1.dx) / 2.0); slice->edge2.dx = slice->edge1.dx; slice->edge2.dy = slice->edge1.dy; slice->edge1_top = signdy < 0; slice->edge2_top = !slice->edge1_top; miGetArcEdge(arc, &slice->edge1, k, slice->edge1_top, !slice->edge1_top); miGetArcEdge(arc, &slice->edge2, k, slice->edge2_top, slice->edge2_top); } } } #define ADDSPANS() \ pts->x = xorg - x; \ pts->y = yorg - y; \ *wids = slw; \ pts++; \ wids++; \ if (miFillArcLower(slw)) \ { \ pts->x = xorg - x; \ pts->y = yorg + y + dy; \ pts++; \ *wids++ = slw; \ } static void miFillEllipseI( DrawablePtr pDraw, GCPtr pGC, xArc *arc ) { register int x, y, e; int yk, xk, ym, xm, dx, dy, xorg, yorg; int slw; miFillArcRec info; DDXPointPtr points; register DDXPointPtr pts; int *widths; register int *wids; points = (DDXPointPtr)malloc(sizeof(DDXPointRec) * arc->height); if (!points) return; widths = (int *)malloc(sizeof(int) * arc->height); if (!widths) { free(points); return; } miFillArcSetup(arc, &info); MIFILLARCSETUP(); if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; } pts = points; wids = widths; while (y > 0) { MIFILLARCSTEP(slw); ADDSPANS(); } (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); free(widths); free(points); } static void miFillEllipseD( DrawablePtr pDraw, GCPtr pGC, xArc *arc ) { register int x, y; int xorg, yorg, dx, dy, slw; double e, yk, xk, ym, xm; miFillArcDRec info; DDXPointPtr points; register DDXPointPtr pts; int *widths; register int *wids; points = (DDXPointPtr)malloc(sizeof(DDXPointRec) * arc->height); if (!points) return; widths = (int *)malloc(sizeof(int) * arc->height); if (!widths) { free(points); return; } miFillArcDSetup(arc, &info); MIFILLARCSETUP(); if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; } pts = points; wids = widths; while (y > 0) { MIFILLARCSTEP(slw); ADDSPANS(); } (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); free(widths); free(points); } #define ADDSPAN(l,r) \ if (r >= l) \ { \ pts->x = l; \ pts->y = ya; \ pts++; \ *wids++ = r - l + 1; \ } #define ADDSLICESPANS(flip) \ if (!flip) \ { \ ADDSPAN(xl, xr); \ } \ else \ { \ xc = xorg - x; \ ADDSPAN(xc, xr); \ xc += slw - 1; \ ADDSPAN(xl, xc); \ } static void miFillArcSliceI( DrawablePtr pDraw, GCPtr pGC, xArc *arc ) { int yk, xk, ym, xm, dx, dy, xorg, yorg, slw; register int x, y, e; miFillArcRec info; miArcSliceRec slice; int ya, xl, xr, xc; DDXPointPtr points; register DDXPointPtr pts; int *widths; register int *wids; miFillArcSetup(arc, &info); miFillArcSliceSetup(arc, &slice, pGC); MIFILLARCSETUP(); slw = arc->height; if (slice.flip_top || slice.flip_bot) slw += (arc->height >> 1) + 1; points = (DDXPointPtr)malloc(sizeof(DDXPointRec) * slw); if (!points) return; widths = (int *)malloc(sizeof(int) * slw); if (!widths) { free(points); return; } if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; slice.edge1.x += pDraw->x; slice.edge2.x += pDraw->x; } pts = points; wids = widths; while (y > 0) { MIFILLARCSTEP(slw); MIARCSLICESTEP(slice.edge1); MIARCSLICESTEP(slice.edge2); if (miFillSliceUpper(slice)) { ya = yorg - y; MIARCSLICEUPPER(xl, xr, slice, slw); ADDSLICESPANS(slice.flip_top); } if (miFillSliceLower(slice)) { ya = yorg + y + dy; MIARCSLICELOWER(xl, xr, slice, slw); ADDSLICESPANS(slice.flip_bot); } } (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); free(widths); free(points); } static void miFillArcSliceD( DrawablePtr pDraw, GCPtr pGC, xArc *arc ) { register int x, y; int dx, dy, xorg, yorg, slw; double e, yk, xk, ym, xm; miFillArcDRec info; miArcSliceRec slice; int ya, xl, xr, xc; DDXPointPtr points; register DDXPointPtr pts; int *widths; register int *wids; miFillArcDSetup(arc, &info); miFillArcSliceSetup(arc, &slice, pGC); MIFILLARCSETUP(); slw = arc->height; if (slice.flip_top || slice.flip_bot) slw += (arc->height >> 1) + 1; points = (DDXPointPtr)malloc(sizeof(DDXPointRec) * slw); if (!points) return; widths = (int *)malloc(sizeof(int) * slw); if (!widths) { free(points); return; } if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; slice.edge1.x += pDraw->x; slice.edge2.x += pDraw->x; } pts = points; wids = widths; while (y > 0) { MIFILLARCSTEP(slw); MIARCSLICESTEP(slice.edge1); MIARCSLICESTEP(slice.edge2); if (miFillSliceUpper(slice)) { ya = yorg - y; MIARCSLICEUPPER(xl, xr, slice, slw); ADDSLICESPANS(slice.flip_top); } if (miFillSliceLower(slice)) { ya = yorg + y + dy; MIARCSLICELOWER(xl, xr, slice, slw); ADDSLICESPANS(slice.flip_bot); } } (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); free(widths); free(points); } /* MIPOLYFILLARC -- The public entry for the PolyFillArc request. * Since we don't have to worry about overlapping segments, we can just * fill each arc as it comes. */ void miPolyFillArc(pDraw, pGC, narcs, parcs) DrawablePtr pDraw; GCPtr pGC; int narcs; xArc *parcs; { register int i; register xArc *arc; for(i = narcs, arc = parcs; --i >= 0; arc++) { if (miFillArcEmpty(arc)) continue;; if ((arc->angle2 >= FULLCIRCLE) || (arc->angle2 <= -FULLCIRCLE)) { if (miCanFillArc(arc)) miFillEllipseI(pDraw, pGC, arc); else miFillEllipseD(pDraw, pGC, arc); } else { if (miCanFillArc(arc)) miFillArcSliceI(pDraw, pGC, arc); else miFillArcSliceD(pDraw, pGC, arc); } } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mifillarc.h0000644000000000000000000001162713614532331017322 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ********************************************************/ #ifndef __MIFILLARC_H__ #define __MIFILLARC_H__ #define FULLCIRCLE (360 * 64) typedef struct _miFillArc { int xorg, yorg; int y; int dx, dy; int e; int ym, yk, xm, xk; } miFillArcRec; /* could use 64-bit integers */ typedef struct _miFillArcD { int xorg, yorg; int y; int dx, dy; double e; double ym, yk, xm, xk; } miFillArcDRec; #define miFillArcEmpty(arc) (!(arc)->angle2 || \ !(arc)->width || !(arc)->height || \ (((arc)->width == 1) && ((arc)->height & 1))) #define miCanFillArc(arc) (((arc)->width == (arc)->height) || \ (((arc)->width <= 800) && ((arc)->height <= 800))) #define MIFILLARCSETUP() \ x = 0; \ y = info.y; \ e = info.e; \ xk = info.xk; \ xm = info.xm; \ yk = info.yk; \ ym = info.ym; \ dx = info.dx; \ dy = info.dy; \ xorg = info.xorg; \ yorg = info.yorg #define MIFILLARCSTEP(slw) \ e += yk; \ while (e >= 0) \ { \ x++; \ xk -= xm; \ e += xk; \ } \ y--; \ yk -= ym; \ slw = (x << 1) + dx; \ if ((e == xk) && (slw > 1)) \ slw-- #define MIFILLCIRCSTEP(slw) MIFILLARCSTEP(slw) #define MIFILLELLSTEP(slw) MIFILLARCSTEP(slw) #define miFillArcLower(slw) (((y + dy) != 0) && ((slw > 1) || (e != xk))) typedef struct _miSliceEdge { int x; int stepx; int deltax; int e; int dy; int dx; } miSliceEdgeRec, *miSliceEdgePtr; typedef struct _miArcSlice { miSliceEdgeRec edge1, edge2; int min_top_y, max_top_y; int min_bot_y, max_bot_y; Bool edge1_top, edge2_top; Bool flip_top, flip_bot; } miArcSliceRec; #define MIARCSLICESTEP(edge) \ edge.x -= edge.stepx; \ edge.e -= edge.dx; \ if (edge.e <= 0) \ { \ edge.x -= edge.deltax; \ edge.e += edge.dy; \ } #define miFillSliceUpper(slice) \ ((y >= slice.min_top_y) && (y <= slice.max_top_y)) #define miFillSliceLower(slice) \ ((y >= slice.min_bot_y) && (y <= slice.max_bot_y)) #define MIARCSLICEUPPER(xl,xr,slice,slw) \ xl = xorg - x; \ xr = xl + slw - 1; \ if (slice.edge1_top && (slice.edge1.x < xr)) \ xr = slice.edge1.x; \ if (slice.edge2_top && (slice.edge2.x > xl)) \ xl = slice.edge2.x; #define MIARCSLICELOWER(xl,xr,slice,slw) \ xl = xorg - x; \ xr = xl + slw - 1; \ if (!slice.edge1_top && (slice.edge1.x > xl)) \ xl = slice.edge1.x; \ if (!slice.edge2_top && (slice.edge2.x < xr)) \ xr = slice.edge2.x; #define MIWIDEARCSETUP(x,y,dy,slw,e,xk,xm,yk,ym) \ x = 0; \ y = slw >> 1; \ yk = y << 3; \ xm = 8; \ ym = 8; \ if (dy) \ { \ xk = 0; \ if (slw & 1) \ e = -1; \ else \ e = -(y << 2) - 2; \ } \ else \ { \ y++; \ yk += 4; \ xk = -4; \ if (slw & 1) \ e = -(y << 2) - 3; \ else \ e = - (y << 3); \ } #define MIFILLINARCSTEP(slw) \ ine += inyk; \ while (ine >= 0) \ { \ inx++; \ inxk -= inxm; \ ine += inxk; \ } \ iny--; \ inyk -= inym; \ slw = (inx << 1) + dx; \ if ((ine == inxk) && (slw > 1)) \ slw-- #define miFillInArcLower(slw) (((iny + dy) != 0) && \ ((slw > 1) || (ine != inxk))) extern int miFreeArcCache( void * /*data*/, XID /*id*/ ); extern struct finalSpan *realAllocSpan( void ); extern void miFillArcSetup( xArc * /*arc*/, miFillArcRec * /*info*/ ); extern void miFillArcDSetup( xArc * /*arc*/, miFillArcDRec * /*info*/ ); extern void miEllipseAngleToSlope( int /*angle*/, int /*width*/, int /*height*/, int * /*dxp*/, int * /*dyp*/, double * /*d_dxp*/, double * /*d_dyp*/ ); extern void miFillArcSliceSetup( xArc * /*arc*/, miArcSliceRec * /*slice*/, GCPtr /*pGC*/ ); #endif /* __MIFILLARC_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mifillrct.c0000644000000000000000000001045613614532331017337 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "gcstruct.h" #include "windowstr.h" #include "pixmap.h" #include "mi.h" #include "misc.h" /* mi rectangles written by newman, with debts to all and sundry */ /* MIPOLYFILLRECT -- public entry for PolyFillRect request * very straight forward: translate rectangles if necessary * then call FillSpans to fill each rectangle. We let FillSpans worry about * clipping to the destination */ void miPolyFillRect(pDrawable, pGC, nrectFill, prectInit) DrawablePtr pDrawable; GCPtr pGC; int nrectFill; /* number of rectangles to fill */ xRectangle *prectInit; /* Pointer to first rectangle to fill */ { int i; register int height; register int width; register xRectangle *prect; int xorg; register int yorg; int maxheight; DDXPointPtr pptFirst; register DDXPointPtr ppt; int *pwFirst; register int *pw; if (pGC->miTranslate) { xorg = pDrawable->x; yorg = pDrawable->y; prect = prectInit; maxheight = 0; for (i = 0; ix += xorg; prect->y += yorg; maxheight = max(maxheight, prect->height); } } else { prect = prectInit; maxheight = 0; for (i = 0; iheight); } pptFirst = (DDXPointPtr) malloc(maxheight * sizeof(DDXPointRec)); pwFirst = (int *) malloc(maxheight * sizeof(int)); if(!pptFirst || !pwFirst) { if (pwFirst) free(pwFirst); if (pptFirst) free(pptFirst); return; } prect = prectInit; while(nrectFill--) { ppt = pptFirst; pw = pwFirst; height = prect->height; width = prect->width; xorg = prect->x; yorg = prect->y; while(height--) { *pw++ = width; ppt->x = xorg; ppt->y = yorg; ppt++; yorg++; } (* pGC->ops->FillSpans)(pDrawable, pGC, prect->height, pptFirst, pwFirst, 1); prect++; } free(pwFirst); free(pptFirst); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mifpolycon.c0000644000000000000000000002037413614532331017531 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "mifpoly.h" static int GetFPolyYBounds(register SppPointPtr pts, int n, double yFtrans, int *by, int *ty); #ifdef ICEILTEMPDECL ICEILTEMPDECL #endif /* * Written by Todd Newman; April. 1987. * * Fill a convex polygon. If the given polygon * is not convex, then the result is undefined. * The algorithm is to order the edges from smallest * y to largest by partitioning the array into a left * edge list and a right edge list. The algorithm used * to traverse each edge is digital differencing analyzer * line algorithm with y as the major axis. There's some funny linear * interpolation involved because of the subpixel postioning. */ void miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans) DrawablePtr dst; GCPtr pgc; int count; /* number of points */ SppPointPtr ptsIn; /* the points */ int xTrans, yTrans; /* Translate each point by this */ double xFtrans, yFtrans; /* translate before conversion by this amount. This provides a mechanism to match rounding errors with any shape that must meet the polygon exactly. */ { double xl = 0.0, xr = 0.0, /* x vals of left and right edges */ ml = 0.0, /* left edge slope */ mr = 0.0, /* right edge slope */ dy, /* delta y */ i; /* loop counter */ int y, /* current scanline */ j, imin, /* index of vertex with smallest y */ ymin, /* y-extents of polygon */ ymax, *width, *FirstWidth, /* output buffer */ *Marked; /* set if this vertex has been used */ register int left, right, /* indices to first endpoints */ nextleft, nextright; /* indices to second endpoints */ DDXPointPtr ptsOut, FirstPoint; /* output buffer */ if (pgc->miTranslate) { xTrans += dst->x; yTrans += dst->y; } imin = GetFPolyYBounds(ptsIn, count, yFtrans, &ymin, &ymax); y = ymax - ymin + 1; if ((count < 3) || (y <= 0)) return; ptsOut = FirstPoint = (DDXPointPtr)malloc(sizeof(DDXPointRec) * y); width = FirstWidth = (int *) malloc(sizeof(int) * y); Marked = (int *) malloc(sizeof(int) * count); if(!ptsOut || !width || !Marked) { if (Marked) free(Marked); if (width) free(width); if (ptsOut) free(ptsOut); return; } for(j = 0; j < count; j++) Marked[j] = 0; nextleft = nextright = imin; Marked[imin] = -1; y = ICEIL(ptsIn[nextleft].y + yFtrans); /* * loop through all edges of the polygon */ do { /* add a left edge if we need to */ if ((y > (ptsIn[nextleft].y + yFtrans) || ISEQUAL(y, ptsIn[nextleft].y + yFtrans)) && Marked[nextleft] != 1) { Marked[nextleft]++; left = nextleft++; /* find the next edge, considering the end conditions */ if (nextleft >= count) nextleft = 0; /* now compute the starting point and slope */ dy = ptsIn[nextleft].y - ptsIn[left].y; if (dy != 0.0) { ml = (ptsIn[nextleft].x - ptsIn[left].x) / dy; dy = y - (ptsIn[left].y + yFtrans); xl = (ptsIn[left].x + xFtrans) + ml * max(dy, 0); } } /* add a right edge if we need to */ if ((y > ptsIn[nextright].y + yFtrans) || (ISEQUAL(y, ptsIn[nextright].y + yFtrans) && Marked[nextright] != 1)) { Marked[nextright]++; right = nextright--; /* find the next edge, considering the end conditions */ if (nextright < 0) nextright = count - 1; /* now compute the starting point and slope */ dy = ptsIn[nextright].y - ptsIn[right].y; if (dy != 0.0) { mr = (ptsIn[nextright].x - ptsIn[right].x) / dy; dy = y - (ptsIn[right].y + yFtrans); xr = (ptsIn[right].x + xFtrans) + mr * max(dy, 0); } } /* * generate scans to fill while we still have * a right edge as well as a left edge. */ i = (min(ptsIn[nextleft].y, ptsIn[nextright].y) + yFtrans) - y; if (i < EPSILON) { if(Marked[nextleft] && Marked[nextright]) { /* Arrgh, we're trapped! (no more points) * Out, we've got to get out of here before this decadence saps * our will completely! */ break; } continue; } else { j = (int) i; if(!j) j++; } while (j > 0) { int cxl, cxr; ptsOut->y = (y) + yTrans; cxl = ICEIL(xl); cxr = ICEIL(xr); /* reverse the edges if necessary */ if (xl < xr) { *(width++) = cxr - cxl; (ptsOut++)->x = cxl + xTrans; } else { *(width++) = cxl - cxr; (ptsOut++)->x = cxr + xTrans; } y++; /* increment down the edges */ xl += ml; xr += mr; j--; } } while (y <= ymax); /* Finally, fill the spans we've collected */ (*pgc->ops->FillSpans)(dst, pgc, ptsOut-FirstPoint, FirstPoint, FirstWidth, 1); free(Marked); free(FirstWidth); free(FirstPoint); } /* Find the index of the point with the smallest y.also return the * smallest and largest y */ static int GetFPolyYBounds( register SppPointPtr pts, int n, double yFtrans, int *by, int *ty) { register SppPointPtr ptMin; double ymin, ymax; SppPointPtr ptsStart = pts; ptMin = pts; ymin = ymax = (pts++)->y; while (--n > 0) { if (pts->y < ymin) { ptMin = pts; ymin = pts->y; } if(pts->y > ymax) ymax = pts->y; pts++; } *by = ICEIL(ymin + yFtrans); *ty = ICEIL(ymax + yFtrans - 1); return(ptMin-ptsStart); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mifpoly.h0000644000000000000000000000754513614532331017043 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef __MIFPOLY_H__ #define __MIFPOLY_H__ #define EPSILON 0.000001 #define ISEQUAL(a,b) (Fabs((a) - (b)) <= EPSILON) #define UNEQUAL(a,b) (Fabs((a) - (b)) > EPSILON) #define WITHINHALF(a, b) (((a) - (b) > 0.0) ? (a) - (b) < 0.5 : \ (b) - (a) <= 0.5) #define ROUNDTOINT(x) ((int) (((x) > 0.0) ? ((x) + 0.5) : ((x) - 0.5))) #define ISZERO(x) (Fabs((x)) <= EPSILON) #define PTISEQUAL(a,b) (ISEQUAL(a.x,b.x) && ISEQUAL(a.y,b.y)) #define PTUNEQUAL(a,b) (UNEQUAL(a.x,b.x) || UNEQUAL(a.y,b.y)) #define PtEqual(a, b) (((a).x == (b).x) && ((a).y == (b).y)) #define NotEnd 0 #define FirstEnd 1 #define SecondEnd 2 #define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - for 11o miter cutoff */ #define D2SECANT 5.21671526231167 /* 1/2*sin(11/2) - max extension per width */ #ifdef NOINLINEICEIL #define ICEIL(x) ((int)ceil(x)) #else #ifdef __GNUC__ static __inline int ICEIL(double x) { int _cTmp = x; return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1; } #else #define ICEIL(x) ((((x) == (_cTmp = (x))) || ((x) < 0.0)) ? _cTmp : _cTmp+1) #define ICEILTEMPDECL static int _cTmp; #endif #endif /* Point with sub-pixel positioning. In this case we use doubles, but * see mifpolycon.c for other suggestions */ typedef struct _SppPoint { double x, y; } SppPointRec, *SppPointPtr; typedef struct _SppArc { double x, y, width, height; double angle1, angle2; } SppArcRec, *SppArcPtr; /* mifpolycon.c */ extern void miFillSppPoly( DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*count*/, SppPointPtr /*ptsIn*/, int /*xTrans*/, int /*yTrans*/, double /*xFtrans*/, double /*yFtrans*/ ); #endif /* __MIFPOLY_H__ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/migc.c0000644000000000000000000001666013614532331016274 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "regionstr.h" #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "migc.h" /* ARGSUSED */ void miChangeGC(pGC, mask) GCPtr pGC; unsigned long mask; { return; } void miDestroyGC(pGC) GCPtr pGC; { if (pGC->pRotatedPixmap) (*pGC->pScreen->DestroyPixmap) (pGC->pRotatedPixmap); if (pGC->freeCompClip) RegionDestroy(pGC->pCompositeClip); miDestroyGCOps(pGC->ops); } /* * create a private op array for a gc */ GCOpsPtr miCreateGCOps(prototype) GCOpsPtr prototype; { GCOpsPtr ret; ret = malloc(sizeof(GCOps)); if (!ret) return NULL; *ret = *prototype; ret->devPrivate.val = 1; return ret; } void miDestroyGCOps(ops) GCOpsPtr ops; { if (ops->devPrivate.val) free(ops); } void miDestroyClip(pGC) GCPtr pGC; { if (pGC->clientClipType == CT_NONE) return; else if (pGC->clientClipType == CT_PIXMAP) { (*pGC->pScreen->DestroyPixmap) ((PixmapPtr) (pGC->clientClip)); } else { /* * we know we'll never have a list of rectangles, since ChangeClip * immediately turns them into a region */ RegionDestroy(pGC->clientClip); } pGC->clientClip = NULL; pGC->clientClipType = CT_NONE; } void miChangeClip(pGC, type, pvalue, nrects) GCPtr pGC; int type; void *pvalue; int nrects; { (*pGC->funcs->DestroyClip) (pGC); if (type == CT_PIXMAP) { /* convert the pixmap to a region */ pGC->clientClip = (void *) BitmapToRegion(pGC->pScreen, (PixmapPtr) pvalue); (*pGC->pScreen->DestroyPixmap) (pvalue); } else if (type == CT_REGION) { /* stuff the region in the GC */ pGC->clientClip = pvalue; } else if (type != CT_NONE) { pGC->clientClip = (void *) RegionFromRects(nrects, (xRectangle *) pvalue, type); free(pvalue); } pGC->clientClipType = (type != CT_NONE && pGC->clientClip) ? CT_REGION : CT_NONE; pGC->stateChanges |= GCClipMask; } void miCopyClip(pgcDst, pgcSrc) GCPtr pgcDst, pgcSrc; { RegionPtr prgnNew; switch (pgcSrc->clientClipType) { case CT_PIXMAP: ((PixmapPtr) pgcSrc->clientClip)->refcnt++; /* Fall through !! */ case CT_NONE: (*pgcDst->funcs->ChangeClip) (pgcDst, (int) pgcSrc->clientClipType, pgcSrc->clientClip, 0); break; case CT_REGION: prgnNew = RegionCreate(NULL, 1); RegionCopy(prgnNew, (RegionPtr) (pgcSrc->clientClip)); (*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, (void *) prgnNew, 0); break; } } /* ARGSUSED */ void miCopyGC(pGCSrc, changes, pGCDst) GCPtr pGCSrc; unsigned long changes; GCPtr pGCDst; { return; } void miComputeCompositeClip(pGC, pDrawable) GCPtr pGC; DrawablePtr pDrawable; { ScreenPtr pScreen; /* This prevents warnings about pScreen not being used. */ pGC->pScreen = pScreen = pGC->pScreen; if (pDrawable->type == DRAWABLE_WINDOW) { WindowPtr pWin = (WindowPtr) pDrawable; RegionPtr pregWin; Bool freeTmpClip, freeCompClip; if (pGC->subWindowMode == IncludeInferiors) { pregWin = NotClippedByChildren(pWin); freeTmpClip = TRUE; } else { pregWin = &pWin->clipList; freeTmpClip = FALSE; } freeCompClip = pGC->freeCompClip; /* * if there is no client clip, we can get by with just keeping the * pointer we got, and remembering whether or not should destroy (or * maybe re-use) it later. this way, we avoid unnecessary copying of * regions. (this wins especially if many clients clip by children * and have no client clip.) */ if (pGC->clientClipType == CT_NONE) { if (freeCompClip) RegionDestroy(pGC->pCompositeClip); pGC->pCompositeClip = pregWin; pGC->freeCompClip = freeTmpClip; } else { /* * we need one 'real' region to put into the composite clip. if * pregWin the current composite clip are real, we can get rid of * one. if pregWin is real and the current composite clip isn't, * use pregWin for the composite clip. if the current composite * clip is real and pregWin isn't, use the current composite * clip. if neither is real, create a new region. */ RegionTranslate(pGC->clientClip, pDrawable->x + pGC->clipOrg.x, pDrawable->y + pGC->clipOrg.y); if (freeCompClip) { RegionIntersect(pGC->pCompositeClip, pregWin, pGC->clientClip); if (freeTmpClip) RegionDestroy(pregWin); } else if (freeTmpClip) { RegionIntersect(pregWin, pregWin, pGC->clientClip); pGC->pCompositeClip = pregWin; } else { pGC->pCompositeClip = RegionCreate(NullBox, 0); RegionIntersect(pGC->pCompositeClip, pregWin, pGC->clientClip); } pGC->freeCompClip = TRUE; RegionTranslate(pGC->clientClip, -(pDrawable->x + pGC->clipOrg.x), -(pDrawable->y + pGC->clipOrg.y)); } } /* end of composite clip for a window */ else { BoxRec pixbounds; /* XXX should we translate by drawable.x/y here ? */ /* If you want pixmaps in offscreen memory, yes */ pixbounds.x1 = pDrawable->x; pixbounds.y1 = pDrawable->y; pixbounds.x2 = pDrawable->x + pDrawable->width; pixbounds.y2 = pDrawable->y + pDrawable->height; if (pGC->freeCompClip) { RegionReset(pGC->pCompositeClip, &pixbounds); } else { pGC->freeCompClip = TRUE; pGC->pCompositeClip = RegionCreate(&pixbounds, 1); } if (pGC->clientClipType == CT_REGION) { if(pDrawable->x || pDrawable->y) { RegionTranslate(pGC->clientClip, pDrawable->x + pGC->clipOrg.x, pDrawable->y + pGC->clipOrg.y); RegionIntersect(pGC->pCompositeClip, pGC->pCompositeClip, pGC->clientClip); RegionTranslate(pGC->clientClip, -(pDrawable->x + pGC->clipOrg.x), -(pDrawable->y + pGC->clipOrg.y)); } else { RegionTranslate(pGC->pCompositeClip, -pGC->clipOrg.x, -pGC->clipOrg.y); RegionIntersect(pGC->pCompositeClip, pGC->pCompositeClip, pGC->clientClip); RegionTranslate(pGC->pCompositeClip, pGC->clipOrg.x, pGC->clipOrg.y); } } } /* end of composite clip for pixmap */ } /* end miComputeCompositeClip */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/migc.h0000644000000000000000000000343013614532331016270 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ extern void miChangeGC( GCPtr /*pGC*/, unsigned long /*mask*/ ); extern void miDestroyGC( GCPtr /*pGC*/ ); extern GCOpsPtr miCreateGCOps( GCOpsPtr /*prototype*/ ); extern void miDestroyGCOps( GCOpsPtr /*ops*/ ); extern void miDestroyClip( GCPtr /*pGC*/ ); extern void miChangeClip( GCPtr /*pGC*/, int /*type*/, void * /*pvalue*/, int /*nrects*/ ); extern void miCopyClip( GCPtr /*pgcDst*/, GCPtr /*pgcSrc*/ ); extern void miCopyGC( GCPtr /*pGCSrc*/, unsigned long /*changes*/, GCPtr /*pGCDst*/ ); extern void miComputeCompositeClip( GCPtr /*pGC*/, DrawablePtr /*pDrawable*/ ); nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/miglblt.c0000644000000000000000000002010113614532331016770 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include #ifdef HAS_XFONT2 # include #else # include #endif /* HAS_XFONT2 */ #include "dixfontstr.h" #include "gcstruct.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmap.h" #include "servermd.h" #include "mi.h" /* machine-independent glyph blt. assumes that glyph bits in snf are written in bytes, have same bit order as the server's bitmap format, and are byte padded. this corresponds to the snf distributed with the sample server. get a scratch GC. in the scratch GC set alu = GXcopy, fg = 1, bg = 0 allocate a bitmap big enough to hold the largest glyph in the font validate the scratch gc with the bitmap for each glyph carefully put the bits of the glyph in a buffer, padded to the server pixmap scanline padding rules fake a call to PutImage from the buffer into the bitmap use the bitmap in a call to PushPixels */ void miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GC *pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ void *pglyphBase; /* start of array of glyphs */ { int width, height; PixmapPtr pPixmap; int nbyLine; /* bytes per line of padded pixmap */ FontPtr pfont; GCPtr pGCtmp; register int i; register int j; unsigned char *pbits; /* buffer for PutImage */ register unsigned char *pb; /* temp pointer into buffer */ register CharInfoPtr pci; /* currect char info */ register unsigned char *pglyph; /* pointer bits in glyph */ int gWidth, gHeight; /* width and height of glyph */ register int nbyGlyphWidth; /* bytes per scanline of glyph */ int nbyPadGlyph; /* server padded line of glyph */ XID gcvals[3]; if (pGC->miTranslate) { x += pDrawable->x; y += pDrawable->y; } pfont = pGC->font; width = FONTMAXBOUNDS(pfont,rightSideBearing) - FONTMINBOUNDS(pfont,leftSideBearing); height = FONTMAXBOUNDS(pfont,ascent) + FONTMAXBOUNDS(pfont,descent); pPixmap = (*pDrawable->pScreen->CreatePixmap)(pDrawable->pScreen, width, height, 1, CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) return; pGCtmp = GetScratchGC(1, pDrawable->pScreen); if (!pGCtmp) { (*pDrawable->pScreen->DestroyPixmap)(pPixmap); return; } gcvals[0] = GXcopy; gcvals[1] = 1; gcvals[2] = 0; DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0); nbyLine = BitmapBytePad(width); pbits = (unsigned char *)malloc(height*nbyLine); if (!pbits) { (*pDrawable->pScreen->DestroyPixmap)(pPixmap); FreeScratchGC(pGCtmp); return; } while(nglyph--) { pci = *ppci++; pglyph = FONTGLYPHBITS(pglyphBase, pci); gWidth = GLYPHWIDTHPIXELS(pci); gHeight = GLYPHHEIGHTPIXELS(pci); if (gWidth && gHeight) { nbyGlyphWidth = GLYPHWIDTHBYTESPADDED(pci); nbyPadGlyph = BitmapBytePad(gWidth); if (nbyGlyphWidth == nbyPadGlyph #if GLYPHPADBYTES != 4 && (((int) pglyph) & 3) == 0 #endif ) { pb = pglyph; } else { for (i=0, pb = pbits; iserialNumber) != (pPixmap->drawable.serialNumber)) ValidateGC((DrawablePtr)pPixmap, pGCtmp); (*pGCtmp->ops->PutImage)((DrawablePtr)pPixmap, pGCtmp, pPixmap->drawable.depth, 0, 0, gWidth, gHeight, 0, XYBitmap, (char *)pb); if ((pGC->serialNumber) != (pDrawable->serialNumber)) ValidateGC(pDrawable, pGC); (*pGC->ops->PushPixels)(pGC, pPixmap, pDrawable, gWidth, gHeight, x + pci->metrics.leftSideBearing, y - pci->metrics.ascent); } x += pci->metrics.characterWidth; } (*pDrawable->pScreen->DestroyPixmap)(pPixmap); free(pbits); FreeScratchGC(pGCtmp); } void miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GC *pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ void *pglyphBase; /* start of array of glyphs */ { ExtentInfoRec info; /* used by xfont2_query_glyph_extents (libXfont2) resp. QueryGlyphExtents() (libXfont1) */ XID gcvals[3]; int oldAlu, oldFS; unsigned long oldFG; xRectangle backrect; #ifdef HAS_XFONT2 xfont2_query_glyph_extents(pGC->font, ppci, (unsigned long) nglyph, &info); #else QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info); #endif /* HAS_XFONT2 */ if (info.overallWidth >= 0) { backrect.x = x; backrect.width = info.overallWidth; } else { backrect.x = x + info.overallWidth; backrect.width = -info.overallWidth; } backrect.y = y - FONTASCENT(pGC->font); backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); oldAlu = pGC->alu; oldFG = pGC->fgPixel; oldFS = pGC->fillStyle; /* fill in the background */ gcvals[0] = GXcopy; gcvals[1] = pGC->bgPixel; gcvals[2] = FillSolid; DoChangeGC(pGC, GCFunction|GCForeground|GCFillStyle, gcvals, 0); ValidateGC(pDrawable, pGC); (*pGC->ops->PolyFillRect)(pDrawable, pGC, 1, &backrect); /* put down the glyphs */ gcvals[0] = oldFG; DoChangeGC(pGC, GCForeground, gcvals, 0); ValidateGC(pDrawable, pGC); (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); /* put all the toys away when done playing */ gcvals[0] = oldAlu; gcvals[1] = oldFG; gcvals[2] = oldFS; DoChangeGC(pGC, GCFunction|GCForeground|GCFillStyle, gcvals, 0); ValidateGC(pDrawable, pGC); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mi.h0000644000000000000000000002760013614532331015763 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef MI_H #define MI_H #include #include "region.h" #include "validate.h" #include "window.h" #include "gc.h" #include #include "input.h" #include "cursor.h" #define MiBits CARD32 typedef struct _miDash *miDashPtr; #define EVEN_DASH 0 #define ODD_DASH ~0 /* miarc.c */ extern void miPolyArc( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ ); /* mibitblt.c */ extern RegionPtr miCopyArea( DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr /*pGC*/, int /*xIn*/, int /*yIn*/, int /*widthSrc*/, int /*heightSrc*/, int /*xOut*/, int /*yOut*/ ); extern void miOpqStipDrawable( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, RegionPtr /*prgnSrc*/, MiBits * /*pbits*/, int /*srcx*/, int /*w*/, int /*h*/, int /*dstx*/, int /*dsty*/ ); extern RegionPtr miCopyPlane( DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr /*pGC*/, int /*srcx*/, int /*srcy*/, int /*width*/, int /*height*/, int /*dstx*/, int /*dsty*/, unsigned long /*bitPlane*/ ); extern void miGetImage( DrawablePtr /*pDraw*/, int /*sx*/, int /*sy*/, int /*w*/, int /*h*/, unsigned int /*format*/, unsigned long /*planeMask*/, char * /*pdstLine*/ ); extern void miPutImage( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*depth*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int /*leftPad*/, int /*format*/, char * /*pImage*/ ); /* micursor.c */ extern void miRecolorCursor( ScreenPtr /*pScr*/, CursorPtr /*pCurs*/, Bool /*displayed*/ ); /* midash.c */ extern miDashPtr miDashLine( int /*npt*/, DDXPointPtr /*ppt*/, unsigned int /*nDash*/, unsigned char * /*pDash*/, unsigned int /*offset*/, int * /*pnseg*/ ); extern void miStepDash( int /*dist*/, int * /*pDashIndex*/, unsigned char * /*pDash*/, int /*numInDashList*/, int * /*pDashOffset*/ ); /* mieq.c */ #ifndef INPUT_H typedef struct _DeviceRec *DevicePtr; #endif extern Bool mieqInit( DevicePtr /*pKbd*/, DevicePtr /*pPtr*/ ); extern void mieqEnqueue( xEventPtr /*e*/ ); extern void mieqSwitchScreen( ScreenPtr /*pScreen*/, Bool /*fromDIX*/ ); extern void mieqProcessInputEvents( void ); /* miexpose.c */ extern RegionPtr miHandleExposures( DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr /*pGC*/, int /*srcx*/, int /*srcy*/, int /*width*/, int /*height*/, int /*dstx*/, int /*dsty*/, unsigned long /*plane*/ ); extern void miSendGraphicsExpose( ClientPtr /*client*/, RegionPtr /*pRgn*/, XID /*drawable*/, int /*major*/, int /*minor*/ ); extern void miSendExposures( WindowPtr /*pWin*/, RegionPtr /*pRgn*/, int /*dx*/, int /*dy*/ ); extern void miWindowExposures( WindowPtr /*pWin*/, RegionPtr /*prgn*/, RegionPtr /*other_exposed*/ ); extern void miPaintWindow( WindowPtr /*pWin*/, RegionPtr /*prgn*/, int /*what*/ ); extern void miClearDrawable( DrawablePtr /*pDraw*/, GCPtr /*pGC*/ ); /* mifillrct.c */ extern void miPolyFillRect( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nrectFill*/, xRectangle * /*prectInit*/ ); /* miglblt.c */ extern void miPolyGlyphBlt( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, void * /*pglyphBase*/ ); extern void miImageGlyphBlt( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, void * /*pglyphBase*/ ); /* mipoly.c */ extern void miFillPolygon( DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*shape*/, int /*mode*/, int /*count*/, DDXPointPtr /*pPts*/ ); /* mipolycon.c */ extern Bool miFillConvexPoly( DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*count*/, DDXPointPtr /*ptsIn*/ ); /* mipolygen.c */ extern Bool miFillGeneralPoly( DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*count*/, DDXPointPtr /*ptsIn*/ ); /* mipolypnt.c */ extern void miPolyPoint( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, xPoint * /*pptInit*/ ); /* mipolyrect.c */ extern void miPolyRectangle( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*nrects*/, xRectangle * /*pRects*/ ); /* mipolyseg.c */ extern void miPolySegment( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegs*/ ); /* mipolytext.c */ extern int miPolyText( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, char * /*chars*/, FontEncoding /*fontEncoding*/ ); extern int miPolyText8( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, char * /*chars*/ ); extern int miPolyText16( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, unsigned short * /*chars*/ ); extern int miImageText( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, char * /*chars*/, FontEncoding /*fontEncoding*/ ); extern void miImageText8( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, char * /*chars*/ ); extern void miImageText16( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, unsigned short * /*chars*/ ); /* mipushpxl.c */ extern void miPushPixels( GCPtr /*pGC*/, PixmapPtr /*pBitMap*/, DrawablePtr /*pDrawable*/, int /*dx*/, int /*dy*/, int /*xOrg*/, int /*yOrg*/ ); /* see also region.h */ extern Bool RegionRectAlloc( RegionPtr /*pRgn*/, int /*n*/ ); extern void RegionSetExtents( RegionPtr /*pReg*/ ); extern int miFindMaxBand( RegionPtr /*prgn*/ ); #ifdef DEBUG extern Bool RegionIsValid( RegionPtr /*prgn*/ ); #endif extern Bool RegionBroken(RegionPtr pReg); /* miscrinit.c */ extern Bool miModifyPixmapHeader( PixmapPtr /*pPixmap*/, int /*width*/, int /*height*/, int /*depth*/, int /*bitsPerPixel*/, int /*devKind*/, void * /*pPixData*/ ); extern Bool miCloseScreen( ScreenPtr /*pScreen*/ ); extern Bool miCreateScreenResources( ScreenPtr /*pScreen*/ ); extern Bool miScreenDevPrivateInit( ScreenPtr /*pScreen*/, int /*width*/, void * /*pbits*/ ); extern Bool miScreenInit( ScreenPtr /*pScreen*/, void * /*pbits*/, int /*xsize*/, int /*ysize*/, int /*dpix*/, int /*dpiy*/, int /*width*/, int /*rootDepth*/, int /*numDepths*/, DepthPtr /*depths*/, VisualID /*rootVisual*/, int /*numVisuals*/, VisualPtr /*visuals*/ ); extern int miAllocateGCPrivateIndex( void ); extern PixmapPtr miGetScreenPixmap( ScreenPtr pScreen ); extern void miSetScreenPixmap( PixmapPtr pPix ); /* mivaltree.c */ extern int miShapedWindowIn( ScreenPtr /*pScreen*/, RegionPtr /*universe*/, RegionPtr /*bounding*/, BoxPtr /*rect*/, int /*x*/, int /*y*/ ); typedef void (*SetRedirectBorderClipProcPtr) (WindowPtr pWindow, RegionPtr pRegion); typedef RegionPtr (*GetRedirectBorderClipProcPtr) (WindowPtr pWindow); void miRegisterRedirectBorderClipProc (SetRedirectBorderClipProcPtr setBorderClip, GetRedirectBorderClipProcPtr getBorderClip); extern int miValidateTree( WindowPtr /*pParent*/, WindowPtr /*pChild*/, VTKind /*kind*/ ); extern void miWideLine( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pPts*/ ); extern void miWideDash( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pPts*/ ); extern void miMiter( void ); extern void miNotMiter( void ); /* miwindow.c */ extern void miClearToBackground( WindowPtr /*pWin*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, Bool /*generateExposures*/ ); extern Bool miChangeSaveUnder( WindowPtr /*pWin*/, WindowPtr /*first*/ ); extern void miPostChangeSaveUnder( WindowPtr /*pWin*/, WindowPtr /*pFirst*/ ); extern void miMarkWindow( WindowPtr /*pWin*/ ); extern Bool miMarkOverlappedWindows( WindowPtr /*pWin*/, WindowPtr /*pFirst*/, WindowPtr * /*ppLayerWin*/ ); extern void miHandleValidateExposures( WindowPtr /*pWin*/ ); extern void miMoveWindow( WindowPtr /*pWin*/, int /*x*/, int /*y*/, WindowPtr /*pNextSib*/, VTKind /*kind*/ ); extern void miSlideAndSizeWindow( WindowPtr /*pWin*/, int /*x*/, int /*y*/, unsigned int /*w*/, unsigned int /*h*/, WindowPtr /*pSib*/ ); extern WindowPtr miGetLayerWindow( WindowPtr /*pWin*/ ); extern void miSetShape( WindowPtr /*pWin*/ ); extern void miChangeBorderWidth( WindowPtr /*pWin*/, unsigned int /*width*/ ); extern void miMarkUnrealizedWindow( WindowPtr /*pChild*/, WindowPtr /*pWin*/, Bool /*fromConfigure*/ ); extern void miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth); /* mizerarc.c */ extern void miZeroPolyArc( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ ); /* mizerline.c */ extern void miZeroLine( DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*mode*/, int /*nptInit*/, DDXPointRec * /*pptInit*/ ); extern void miZeroDashLine( DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*mode*/, int /*nptInit*/, DDXPointRec * /*pptInit*/ ); extern void miPolyFillArc( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ ); #endif /* MI_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/miinitext.c0000644000000000000000000002643513614532331017370 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifdef HAVE_XORG_CONFIG_H #include #endif #ifdef HAVE_DMX_CONFIG_H #include #endif #ifdef HAVE_XNEST_CONFIG_H #include #undef DPMSExtension #endif #include "misc.h" #include "extension.h" #include "micmap.h" extern Bool noTestExtensions; #ifdef BIGREQS extern Bool noBigReqExtension; #endif #ifdef COMPOSITE extern Bool noCompositeExtension; #endif #ifdef DAMAGE extern Bool noDamageExtension; #endif #ifdef DBE extern Bool noDbeExtension; #endif #ifdef DPMSExtension extern Bool noDPMSExtension; #endif #ifdef GLXEXT extern Bool noGlxExtension; #endif #ifdef SCREENSAVER extern Bool noScreenSaverExtension; #endif #ifdef MITSHM extern Bool noMITShmExtension; #endif #ifdef RANDR extern Bool noRRExtension; #endif #ifdef RENDER extern Bool noRenderExtension; #endif #ifdef SHAPE extern Bool noShapeExtension; #endif #ifdef XCSECURITY extern Bool noSecurityExtension; #endif #ifdef XSYNC extern Bool noSyncExtension; #endif #ifdef RES extern Bool noResExtension; #endif #ifdef XCMISC extern Bool noXCMiscExtension; #endif #ifdef XF86BIGFONT extern Bool noXFree86BigfontExtension; #endif #ifdef XF86DRI extern Bool noXFree86DRIExtension; #endif #ifdef XFIXES extern Bool noXFixesExtension; #endif #ifdef XKB /* |noXkbExtension| is defined in xc/programs/Xserver/xkb/xkbInit.c */ extern Bool noXkbExtension; #endif #ifdef PANORAMIX extern Bool noPanoramiXExtension; #endif #ifdef XINPUT extern Bool noXInputExtension; #endif #ifdef XIDLE extern Bool noXIdleExtension; #endif #ifdef XV extern Bool noXvExtension; #endif typedef void (*InitExtension)(void); #ifdef MITSHM #define _XSHM_SERVER_ #ifdef LEGACY_XEXT_PROTO #include #else #include #endif #endif #ifdef XTEST #define _XTEST_SERVER_ #include #endif #ifdef XKB #include #endif #ifdef XCSECURITY #define _SECURITY_SERVER #include #endif #ifdef PANORAMIX #include #endif #ifdef XF86BIGFONT #include #endif #ifdef RES #include #endif /* FIXME: this whole block of externs should be from the appropriate headers */ #ifdef SHAPE extern void ShapeExtensionInit(void); #endif #ifdef MITSHM extern void ShmExtensionInit(void); #endif #ifdef PANORAMIX extern void PanoramiXExtensionInit(void); #endif #ifdef XINPUT extern void XInputExtensionInit(void); #endif #ifdef XTEST extern void XTestExtensionInit(void); #endif #ifdef BIGREQS extern void BigReqExtensionInit(void); #endif #ifdef XIDLE extern void XIdleExtensionInit(void); #endif #ifdef SCREENSAVER extern void ScreenSaverExtensionInit (void); #endif #ifdef XV extern void XvExtensionInit(void); extern void XvMCExtensionInit(void); #endif #ifdef XSYNC extern void SyncExtensionInit(void); #endif #ifdef XKB extern void XkbExtensionInit(void); #endif #ifdef XCMISC extern void XCMiscExtensionInit(void); #endif #ifdef XRECORD extern void RecordExtensionInit(void); #endif #ifdef DBE extern void DbeExtensionInit(void); #endif #ifdef XCSECURITY extern void SecurityExtensionInit(void); #endif #ifdef XF86BIGFONT extern void XFree86BigfontExtensionInit(void); #endif #ifdef GLXEXT /* typedef struct __GLXprovider __GLXprovider; extern __GLXprovider __glXMesaProvider; extern void GlxPushProvider(__GLXprovider *impl); */ #ifndef __DARWIN__ extern void GlxExtensionInit(void); #else extern void DarwinGlxExtensionInit(void); extern void DarwinGlxWrapInitVisuals(miInitVisualsProcPtr *); #endif #endif #ifdef XF86DRI extern void XFree86DRIExtensionInit(void); #endif #ifdef DPMSExtension extern void DPMSExtensionInit(void); #endif #ifdef RENDER extern void RenderExtensionInit(void); #endif #ifdef RANDR extern void RRExtensionInit(void); #endif #ifdef RES extern void ResExtensionInit(void); #endif #ifdef DMXEXT extern void DMXExtensionInit(void); #endif #ifdef XFIXES extern void XFixesExtensionInit(void); #endif #ifdef DAMAGE extern void DamageExtensionInit(void); #endif #ifdef COMPOSITE extern void CompositeExtensionInit(void); #endif /* The following is only a small first step towards run-time * configurable extensions. */ typedef struct { char *name; Bool *disablePtr; } ExtensionToggle; static ExtensionToggle ExtensionToggleList[] = { /* sort order is extension name string as shown in xdpyinfo */ #ifdef BIGREQS { "BIG-REQUESTS", &noBigReqExtension }, #endif #ifdef COMPOSITE { "Composite", &noCompositeExtension }, #endif #ifdef DAMAGE { "DAMAGE", &noDamageExtension }, #endif #ifdef DBE { "DOUBLE-BUFFER", &noDbeExtension }, #endif #ifdef DPMSExtension { "DPMS", &noDPMSExtension }, #endif #ifdef GLXEXT { "GLX", &noGlxExtension }, #endif #ifdef SCREENSAVER { "MIT-SCREEN-SAVER", &noScreenSaverExtension }, #endif #ifdef MITSHM { SHMNAME, &noMITShmExtension }, #endif #ifdef RANDR { "RANDR", &noRRExtension }, #endif #ifdef RENDER { "RENDER", &noRenderExtension }, #endif #ifdef SHAPE { "SHAPE", &noShapeExtension }, #endif #ifdef XCSECURITY { "SECURITY", &noSecurityExtension }, #endif #ifdef XSYNC { "SYNC", &noSyncExtension }, #endif #ifdef RES { "X-Resource", &noResExtension }, #endif #ifdef XCMISC { "XC-MISC", &noXCMiscExtension }, #endif #ifdef XF86BIGFONT { "XFree86-Bigfont", &noXFree86BigfontExtension }, #endif #ifdef XF86DRI { "XFree86-DRI", &noXFree86DRIExtension }, #endif #ifdef XFIXES { "XFIXES", &noXFixesExtension }, #endif #ifdef PANORAMIX { "XINERAMA", &noPanoramiXExtension }, #endif #ifdef XINPUT { "XInputExtension", &noXInputExtension }, #endif #ifdef XKB { "XKEYBOARD", &noXkbExtension }, #endif { "XTEST", &noTestExtensions }, #ifdef XV { "XVideo", &noXvExtension }, #endif { NULL, NULL } }; Bool EnableDisableExtension(char *name, Bool enable) { ExtensionToggle *ext = &ExtensionToggleList[0]; for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) { if (strcmp(name, ext->name) == 0) { *ext->disablePtr = !enable; return TRUE; } } return FALSE; } void EnableDisableExtensionError(char *name, Bool enable) { ExtensionToggle *ext = &ExtensionToggleList[0]; ErrorF("Extension \"%s\" is not recognized\n", name); ErrorF("Only the following extensions can be run-time %s:\n", enable ? "enabled" : "disabled"); for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) ErrorF(" %s\n", ext->name); } /*ARGSUSED*/ void InitExtensions(argc, argv) int argc; char *argv[]; { #ifdef PANORAMIX # if !defined(PRINT_ONLY_SERVER) && !defined(NO_PANORAMIX) if (!noPanoramiXExtension) PanoramiXExtensionInit(); # endif #endif #ifdef SHAPE if (!noShapeExtension) ShapeExtensionInit(); #endif #ifdef MITSHM if (!noMITShmExtension) ShmExtensionInit(); #endif #if defined(XINPUT) && !defined(NO_HW_ONLY_EXTS) if (!noXInputExtension) XInputExtensionInit(); #endif #ifdef XTEST if (!noTestExtensions) XTestExtensionInit(); #endif #ifdef BIGREQS if (!noBigReqExtension) BigReqExtensionInit(); #endif #ifdef XIDLE if (!noXIdleExtension) XIdleExtensionInit(); #endif #if defined(SCREENSAVER) && !defined(PRINT_ONLY_SERVER) if (!noScreenSaverExtension) ScreenSaverExtensionInit (); #endif #ifdef XV if (!noXvExtension) { XvExtensionInit(); XvMCExtensionInit(); } #endif #ifdef XSYNC if (!noSyncExtension) SyncExtensionInit(); #endif #if defined(XKB) && !defined(PRINT_ONLY_SERVER) && !defined(NO_HW_ONLY_EXTS) if (!noXkbExtension) XkbExtensionInit(); #endif #ifdef XCMISC if (!noXCMiscExtension) XCMiscExtensionInit(); #endif #ifdef XRECORD if (!noTestExtensions) RecordExtensionInit(); #endif #ifdef DBE if (!noDbeExtension) DbeExtensionInit(); #endif #ifdef XCSECURITY if (!noSecurityExtension) SecurityExtensionInit(); #endif #if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS) if (!noDPMSExtension) DPMSExtensionInit(); #endif #ifdef XF86BIGFONT if (!noXFree86BigfontExtension) XFree86BigfontExtensionInit(); #endif #if !defined(PRINT_ONLY_SERVER) && !defined(NO_HW_ONLY_EXTS) #ifdef XF86DRI if (!noXFree86DRIExtension) XFree86DRIExtensionInit(); #endif #endif #ifdef GLXEXT /* GlxPushProvider(&__glXMesaProvider); */ #ifndef __DARWIN__ if (!noGlxExtension) GlxExtensionInit(); #else if (!noGlxExtension) DarwinGlxExtensionInit(); #endif #endif #ifdef XFIXES /* must be before Render to layer DisplayCursor correctly */ if (!noXFixesExtension) XFixesExtensionInit(); #endif #ifdef RENDER if (!noRenderExtension) RenderExtensionInit(); #endif #ifdef RANDR if (!noRRExtension) RRExtensionInit(); #endif #ifdef RES if (!noResExtension) ResExtensionInit(); #endif #ifdef DMXEXT DMXExtensionInit(); /* server-specific extension, cannot be disabled */ #endif #ifdef COMPOSITE if (!noCompositeExtension) CompositeExtensionInit(); #endif #ifdef DAMAGE if (!noDamageExtension) DamageExtensionInit(); #endif } void InitVisualWrap() { miResetInitVisuals(); #ifdef GLXEXT #ifdef __DARWIN__ DarwinGlxWrapInitVisuals(&miInitVisualsProc); #endif #endif } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/miline.h0000644000000000000000000001173013614532331016630 0ustar /* Copyright 1994, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef MILINE_H #include "screenint.h" /* * Public definitions used for configuring basic pixelization aspects * of the sample implementation line-drawing routines provided in * {mfb,mi,cfb*} at run-time. */ #define XDECREASING 4 #define YDECREASING 2 #define YMAJOR 1 #define OCTANT1 (1 << (YDECREASING)) #define OCTANT2 (1 << (YDECREASING|YMAJOR)) #define OCTANT3 (1 << (XDECREASING|YDECREASING|YMAJOR)) #define OCTANT4 (1 << (XDECREASING|YDECREASING)) #define OCTANT5 (1 << (XDECREASING)) #define OCTANT6 (1 << (XDECREASING|YMAJOR)) #define OCTANT7 (1 << (YMAJOR)) #define OCTANT8 (1 << (0)) #define XMAJOROCTANTS (OCTANT1 | OCTANT4 | OCTANT5 | OCTANT8) #define DEFAULTZEROLINEBIAS (OCTANT2 | OCTANT3 | OCTANT4 | OCTANT5) /* * Devices can configure the rendering of routines in mi, mfb, and cfb* * by specifying a thin line bias to be applied to a particular screen * using the following function. The bias parameter is an OR'ing of * the appropriate OCTANT constants defined above to indicate which * octants to bias a line to prefer an axial step when the Bresenham * error term is exactly zero. The octants are mapped as follows: * * \ | / * \ 3 | 2 / * \ | / * 4 \ | / 1 * \|/ * ----------- * /|\ * 5 / | \ 8 * / | \ * / 6 | 7 \ * / | \ * * For more information, see "Ambiguities in Incremental Line Rastering," * Jack E. Bresenham, IEEE CG&A, May 1987. */ extern void miSetZeroLineBias( ScreenPtr /* pScreen */, unsigned int /* bias */ ); /* * Private definitions needed for drawing thin (zero width) lines * Used by the mi, mfb, and all cfb* components. */ #define X_AXIS 0 #define Y_AXIS 1 #define OUT_LEFT 0x08 #define OUT_RIGHT 0x04 #define OUT_ABOVE 0x02 #define OUT_BELOW 0x01 #define OUTCODES(_result, _x, _y, _pbox) \ if ( (_x) < (_pbox)->x1) (_result) |= OUT_LEFT; \ else if ( (_x) >= (_pbox)->x2) (_result) |= OUT_RIGHT; \ if ( (_y) < (_pbox)->y1) (_result) |= OUT_ABOVE; \ else if ( (_y) >= (_pbox)->y2) (_result) |= OUT_BELOW; #define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \ {\ if (x < xmin) outcode |= OUT_LEFT;\ if (x > xmax) outcode |= OUT_RIGHT;\ if (y < ymin) outcode |= OUT_ABOVE;\ if (y > ymax) outcode |= OUT_BELOW;\ } #define SWAPINT(i, j) \ { register int _t = i; i = j; j = _t; } #define SWAPPT(i, j) \ { DDXPointRec _t; _t = i; i = j; j = _t; } #define SWAPINT_PAIR(x1, y1, x2, y2)\ { int t = x1; x1 = x2; x2 = t;\ t = y1; y1 = y2; y2 = t;\ } #define miGetZeroLineBias(_pScreen) \ ((miZeroLineScreenIndex < 0) ? \ 0 : ((_pScreen)->devPrivates[miZeroLineScreenIndex].uval)) #define CalcLineDeltas(_x1,_y1,_x2,_y2,_adx,_ady,_sx,_sy,_SX,_SY,_octant) \ (_octant) = 0; \ (_sx) = (_SX); \ if (((_adx) = (_x2) - (_x1)) < 0) { \ (_adx) = -(_adx); \ (_sx = -(_sx)); \ (_octant) |= XDECREASING; \ } \ (_sy) = (_SY); \ if (((_ady) = (_y2) - (_y1)) < 0) { \ (_ady) = -(_ady); \ (_sy = -(_sy)); \ (_octant) |= YDECREASING; \ } #define SetYMajorOctant(_octant) ((_octant) |= YMAJOR) #define FIXUP_ERROR(_e, _octant, _bias) \ (_e) -= (((_bias) >> (_octant)) & 1) #define IsXMajorOctant(_octant) (!((_octant) & YMAJOR)) #define IsYMajorOctant(_octant) ((_octant) & YMAJOR) #define IsXDecreasingOctant(_octant) ((_octant) & XDECREASING) #define IsYDecreasingOctant(_octant) ((_octant) & YDECREASING) extern int miZeroLineScreenIndex; extern int miZeroClipLine( int /*xmin*/, int /*ymin*/, int /*xmax*/, int /*ymax*/, int * /*new_x1*/, int * /*new_y1*/, int * /*new_x2*/, int * /*new_y2*/, unsigned int /*adx*/, unsigned int /*ady*/, int * /*pt1_clipped*/, int * /*pt2_clipped*/, int /*octant*/, unsigned int /*bias*/, int /*oc1*/, int /*oc2*/ ); #endif /* MILINE_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mioverlay.c0000644000000000000000000015322013614532331017356 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "scrnintstr.h" #include "validate.h" #include "windowstr.h" #include "mi.h" #include "gcstruct.h" #include "regionstr.h" #include "mivalidate.h" #include "mioverlay.h" #include "migc.h" #include "globals.h" typedef struct { RegionRec exposed; RegionRec borderExposed; RegionPtr borderVisible; DDXPointRec oldAbsCorner; } miOverlayValDataRec, *miOverlayValDataPtr; typedef struct _TreeRec { WindowPtr pWin; struct _TreeRec *parent; struct _TreeRec *firstChild; struct _TreeRec *lastChild; struct _TreeRec *prevSib; struct _TreeRec *nextSib; RegionRec borderClip; RegionRec clipList; unsigned visibility; miOverlayValDataPtr valdata; } miOverlayTreeRec, *miOverlayTreePtr; typedef struct { miOverlayTreePtr tree; } miOverlayWindowRec, *miOverlayWindowPtr; typedef struct { CloseScreenProcPtr CloseScreen; CreateWindowProcPtr CreateWindow; DestroyWindowProcPtr DestroyWindow; UnrealizeWindowProcPtr UnrealizeWindow; RealizeWindowProcPtr RealizeWindow; miOverlayTransFunc MakeTransparent; miOverlayInOverlayFunc InOverlay; Bool underlayMarked; Bool copyUnderlay; } miOverlayScreenRec, *miOverlayScreenPtr; static unsigned long miOverlayGeneration = 0; int miOverlayWindowIndex = -1; int miOverlayScreenIndex = -1; static void RebuildTree(WindowPtr); static Bool HasUnderlayChildren(WindowPtr); static void MarkUnderlayWindow(WindowPtr); static Bool CollectUnderlayChildrenRegions(WindowPtr, RegionPtr); static Bool miOverlayCloseScreen(ScreenPtr); static Bool miOverlayCreateWindow(WindowPtr); static Bool miOverlayDestroyWindow(WindowPtr); static Bool miOverlayUnrealizeWindow(WindowPtr); static Bool miOverlayRealizeWindow(WindowPtr); static void miOverlayMarkWindow(WindowPtr); static void miOverlayReparentWindow(WindowPtr, WindowPtr); static void miOverlayRestackWindow(WindowPtr, WindowPtr); static Bool miOverlayMarkOverlappedWindows(WindowPtr, WindowPtr, WindowPtr*); static void miOverlayMarkUnrealizedWindow(WindowPtr, WindowPtr, Bool); static int miOverlayValidateTree(WindowPtr, WindowPtr, VTKind); static void miOverlayHandleExposures(WindowPtr); static void miOverlayMoveWindow(WindowPtr, int, int, WindowPtr, VTKind); static void miOverlayWindowExposures(WindowPtr, RegionPtr, RegionPtr); static void miOverlayResizeWindow(WindowPtr, int, int, unsigned int, unsigned int, WindowPtr); static void miOverlayClearToBackground(WindowPtr, int, int, int, int, Bool); #ifdef SHAPE static void miOverlaySetShape(WindowPtr); #endif static void miOverlayChangeBorderWidth(WindowPtr, unsigned int); #define MIOVERLAY_GET_SCREEN_PRIVATE(pScreen) \ ((miOverlayScreenPtr)((pScreen)->devPrivates[miOverlayScreenIndex].ptr)) #define MIOVERLAY_GET_WINDOW_PRIVATE(pWin) \ ((miOverlayWindowPtr)((pWin)->devPrivates[miOverlayWindowIndex].ptr)) #define MIOVERLAY_GET_WINDOW_TREE(pWin) \ (MIOVERLAY_GET_WINDOW_PRIVATE(pWin)->tree) #define IN_UNDERLAY(w) MIOVERLAY_GET_WINDOW_TREE(w) #define IN_OVERLAY(w) !MIOVERLAY_GET_WINDOW_TREE(w) #define MARK_OVERLAY(w) miMarkWindow(w) #define MARK_UNDERLAY(w) MarkUnderlayWindow(w) #define HasParentRelativeBorder(w) (!(w)->borderIsPixel && \ HasBorder(w) && \ (w)->backgroundState == ParentRelative) Bool miInitOverlay( ScreenPtr pScreen, miOverlayInOverlayFunc inOverlayFunc, miOverlayTransFunc transFunc ){ miOverlayScreenPtr pScreenPriv; if(!inOverlayFunc || !transFunc) return FALSE; if(miOverlayGeneration != serverGeneration) { if(((miOverlayScreenIndex = AllocateScreenPrivateIndex()) < 0) || ((miOverlayWindowIndex = AllocateWindowPrivateIndex()) < 0)) return FALSE; miOverlayGeneration = serverGeneration; } if(!AllocateWindowPrivate(pScreen, miOverlayWindowIndex, sizeof(miOverlayWindowRec))) return FALSE; if(!(pScreenPriv = malloc(sizeof(miOverlayScreenRec)))) return FALSE; pScreen->devPrivates[miOverlayScreenIndex].ptr = (void *)pScreenPriv; pScreenPriv->InOverlay = inOverlayFunc; pScreenPriv->MakeTransparent = transFunc; pScreenPriv->underlayMarked = FALSE; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreenPriv->CreateWindow = pScreen->CreateWindow; pScreenPriv->DestroyWindow = pScreen->DestroyWindow; pScreenPriv->UnrealizeWindow = pScreen->UnrealizeWindow; pScreenPriv->RealizeWindow = pScreen->RealizeWindow; pScreen->CloseScreen = miOverlayCloseScreen; pScreen->CreateWindow = miOverlayCreateWindow; pScreen->DestroyWindow = miOverlayDestroyWindow; pScreen->UnrealizeWindow = miOverlayUnrealizeWindow; pScreen->RealizeWindow = miOverlayRealizeWindow; pScreen->ReparentWindow = miOverlayReparentWindow; pScreen->RestackWindow = miOverlayRestackWindow; pScreen->MarkOverlappedWindows = miOverlayMarkOverlappedWindows; pScreen->MarkUnrealizedWindow = miOverlayMarkUnrealizedWindow; pScreen->ValidateTree = miOverlayValidateTree; pScreen->HandleExposures = miOverlayHandleExposures; pScreen->MoveWindow = miOverlayMoveWindow; pScreen->WindowExposures = miOverlayWindowExposures; pScreen->ResizeWindow = miOverlayResizeWindow; pScreen->MarkWindow = miOverlayMarkWindow; pScreen->ClearToBackground = miOverlayClearToBackground; #ifdef SHAPE pScreen->SetShape = miOverlaySetShape; #endif pScreen->ChangeBorderWidth = miOverlayChangeBorderWidth; return TRUE; } static Bool miOverlayCloseScreen(ScreenPtr pScreen) { miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->CreateWindow = pScreenPriv->CreateWindow; pScreen->DestroyWindow = pScreenPriv->DestroyWindow; pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow; pScreen->RealizeWindow = pScreenPriv->RealizeWindow; free(pScreenPriv); return (*pScreen->CloseScreen)(pScreen); } static Bool miOverlayCreateWindow(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); miOverlayWindowPtr pWinPriv = MIOVERLAY_GET_WINDOW_PRIVATE(pWin); miOverlayTreePtr pTree = NULL; Bool result = TRUE; pWinPriv->tree = NULL; if(!pWin->parent || !((*pScreenPriv->InOverlay)(pWin))) { if(!(pTree = (miOverlayTreePtr)calloc(1, sizeof(miOverlayTreeRec)))) return FALSE; } if(pScreenPriv->CreateWindow) { pScreen->CreateWindow = pScreenPriv->CreateWindow; result = (*pScreen->CreateWindow)(pWin); pScreen->CreateWindow = miOverlayCreateWindow; } if (pTree) { if(result) { pTree->pWin = pWin; pTree->visibility = VisibilityNotViewable; pWinPriv->tree = pTree; if(pWin->parent) { RegionNull(&(pTree->borderClip)); RegionNull(&(pTree->clipList)); RebuildTree(pWin); } else { BoxRec fullBox; fullBox.x1 = 0; fullBox.y1 = 0; fullBox.x2 = pScreen->width; fullBox.y2 = pScreen->height; RegionInit(&(pTree->borderClip), &fullBox, 1); RegionInit(&(pTree->clipList), &fullBox, 1); } } else free(pTree); } return TRUE; } static Bool miOverlayDestroyWindow(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); Bool result = TRUE; if (pTree) { if(pTree->prevSib) pTree->prevSib->nextSib = pTree->nextSib; else if(pTree->parent) pTree->parent->firstChild = pTree->nextSib; if(pTree->nextSib) pTree->nextSib->prevSib = pTree->prevSib; else if(pTree->parent) pTree->parent->lastChild = pTree->prevSib; RegionUninit(&(pTree->borderClip)); RegionUninit(&(pTree->clipList)); free(pTree); } if(pScreenPriv->DestroyWindow) { pScreen->DestroyWindow = pScreenPriv->DestroyWindow; result = (*pScreen->DestroyWindow)(pWin); pScreen->DestroyWindow = miOverlayDestroyWindow; } return result; } static Bool miOverlayUnrealizeWindow(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); Bool result = TRUE; if(pTree) pTree->visibility = VisibilityNotViewable; if(pScreenPriv->UnrealizeWindow) { pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow; result = (*pScreen->UnrealizeWindow)(pWin); pScreen->UnrealizeWindow = miOverlayUnrealizeWindow; } return result; } static Bool miOverlayRealizeWindow(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); Bool result = TRUE; if(pScreenPriv->RealizeWindow) { pScreen->RealizeWindow = pScreenPriv->RealizeWindow; result = (*pScreen->RealizeWindow)(pWin); pScreen->RealizeWindow = miOverlayRealizeWindow; } /* we only need to catch the root window realization */ if(result && !pWin->parent && !((*pScreenPriv->InOverlay)(pWin))) { BoxRec box; box.x1 = box.y1 = 0; box.x2 = pWin->drawable.width; box.y2 = pWin->drawable.height; (*pScreenPriv->MakeTransparent)(pScreen, 1, &box); } return result; } static void miOverlayReparentWindow(WindowPtr pWin, WindowPtr pPriorParent) { if(IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)) { /* This could probably be more optimal */ RebuildTree(pWin->drawable.pScreen->root->firstChild); } } static void miOverlayRestackWindow(WindowPtr pWin, WindowPtr oldNextSib) { if(IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)) { /* This could probably be more optimal */ RebuildTree(pWin); } } static Bool miOverlayMarkOverlappedWindows( WindowPtr pWin, WindowPtr pFirst, WindowPtr *pLayerWin ){ ScreenPtr pScreen = pWin->drawable.pScreen; WindowPtr pChild, pLast; Bool overMarked, underMarked, doUnderlay, markAll; miOverlayTreePtr pTree = NULL, tLast, tChild; BoxPtr box; overMarked = underMarked = markAll = FALSE; if(pLayerWin) *pLayerWin = pWin; /* hah! */ doUnderlay = (IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)); box = RegionExtents(&pWin->borderSize); if((pChild = pFirst)) { pLast = pChild->parent->lastChild; while (1) { if (pChild == pWin) markAll = TRUE; if(doUnderlay && IN_UNDERLAY(pChild)) pTree = MIOVERLAY_GET_WINDOW_TREE(pChild); if(pChild->viewable) { if (RegionBroken(&pChild->winSize)) SetWinSize (pChild); if (RegionBroken(&pChild->borderSize)) SetBorderSize (pChild); if (markAll || RegionContainsRect(&pChild->borderSize, box)) { MARK_OVERLAY(pChild); overMarked = TRUE; if(doUnderlay && IN_UNDERLAY(pChild)) { MARK_UNDERLAY(pChild); underMarked = TRUE; } if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } } while (!pChild->nextSib && (pChild != pLast)) { pChild = pChild->parent; if(doUnderlay && IN_UNDERLAY(pChild)) pTree = MIOVERLAY_GET_WINDOW_TREE(pChild); } if(pChild == pWin) markAll = FALSE; if (pChild == pLast) break; pChild = pChild->nextSib; } if(overMarked) MARK_OVERLAY(pWin->parent); } if(doUnderlay && !pTree) { if(!(pTree = MIOVERLAY_GET_WINDOW_TREE(pWin))) { pChild = pWin->lastChild; while(1) { if((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild))) break; if(pChild->lastChild) { pChild = pChild->lastChild; continue; } while(!pChild->prevSib) pChild = pChild->parent; pChild = pChild->prevSib; } } } if(pTree && pTree->nextSib) { tChild = pTree->parent->lastChild; tLast = pTree->nextSib; while(1) { if(tChild->pWin->viewable) { if (RegionBroken(&tChild->pWin->winSize)) SetWinSize (tChild->pWin); if (RegionBroken(&tChild->pWin->borderSize)) SetBorderSize (tChild->pWin); if(RegionContainsRect(&(tChild->pWin->borderSize), box)) { MARK_UNDERLAY(tChild->pWin); underMarked = TRUE; } } if(tChild->lastChild) { tChild = tChild->lastChild; continue; } while(!tChild->prevSib && (tChild != tLast)) tChild = tChild->parent; if(tChild == tLast) break; tChild = tChild->prevSib; } } if(underMarked) { MARK_UNDERLAY(pTree->parent->pWin); MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->underlayMarked = TRUE; } return (underMarked || overMarked); } static void miOverlayComputeClips( WindowPtr pParent, RegionPtr universe, VTKind kind, RegionPtr exposed ){ ScreenPtr pScreen = pParent->drawable.pScreen; int oldVis, newVis, dx, dy; BoxRec borderSize; RegionPtr borderVisible; RegionRec childUniverse, childUnion; miOverlayTreePtr tParent = MIOVERLAY_GET_WINDOW_TREE(pParent); miOverlayTreePtr tChild; Bool overlap; borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent); borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent); dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent); if (dx > 32767) dx = 32767; borderSize.x2 = dx; dy = (int) pParent->drawable.y + (int) pParent->drawable.height + wBorderWidth(pParent); if (dy > 32767) dy = 32767; borderSize.y2 = dy; oldVis = tParent->visibility; switch (RegionContainsRect(universe, &borderSize)) { case rgnIN: newVis = VisibilityUnobscured; break; case rgnPART: newVis = VisibilityPartiallyObscured; #ifdef SHAPE { RegionPtr pBounding; if ((pBounding = wBoundingShape (pParent))) { switch (miShapedWindowIn (pScreen, universe, pBounding, &borderSize, pParent->drawable.x, pParent->drawable.y)) { case rgnIN: newVis = VisibilityUnobscured; break; case rgnOUT: newVis = VisibilityFullyObscured; break; } } } #endif break; default: newVis = VisibilityFullyObscured; break; } tParent->visibility = newVis; dx = pParent->drawable.x - tParent->valdata->oldAbsCorner.x; dy = pParent->drawable.y - tParent->valdata->oldAbsCorner.y; switch (kind) { case VTMap: case VTStack: case VTUnmap: break; case VTMove: if ((oldVis == newVis) && ((oldVis == VisibilityFullyObscured) || (oldVis == VisibilityUnobscured))) { tChild = tParent; while (1) { if (tChild->pWin->viewable) { if (tChild->visibility != VisibilityFullyObscured) { RegionTranslate(&tChild->borderClip, dx, dy); RegionTranslate(&tChild->clipList, dx, dy); tChild->pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pScreen->ClipNotify) (* pScreen->ClipNotify) (tChild->pWin, dx, dy); } if (tChild->valdata) { RegionNull(&tChild->valdata->borderExposed); if (HasParentRelativeBorder(tChild->pWin)){ RegionSubtract( &tChild->valdata->borderExposed, &tChild->borderClip, &tChild->pWin->winSize); } RegionNull(&tChild->valdata->exposed); } if (tChild->firstChild) { tChild = tChild->firstChild; continue; } } while (!tChild->nextSib && (tChild != tParent)) tChild = tChild->parent; if (tChild == tParent) break; tChild = tChild->nextSib; } return; } /* fall through */ default: if (dx || dy) { RegionTranslate(&tParent->borderClip, dx, dy); RegionTranslate(&tParent->clipList, dx, dy); } break; case VTBroken: RegionEmpty(&tParent->borderClip); RegionEmpty(&tParent->clipList); break; } borderVisible = tParent->valdata->borderVisible; RegionNull(&tParent->valdata->borderExposed); RegionNull(&tParent->valdata->exposed); if (HasBorder (pParent)) { if (borderVisible) { RegionSubtract(exposed, universe, borderVisible); RegionDestroy(borderVisible); } else RegionSubtract(exposed, universe, &tParent->borderClip); if (HasParentRelativeBorder(pParent) && (dx || dy)) RegionSubtract(&tParent->valdata->borderExposed, universe, &pParent->winSize); else RegionSubtract(&tParent->valdata->borderExposed, exposed, &pParent->winSize); RegionCopy(&tParent->borderClip, universe); RegionIntersect(universe, universe, &pParent->winSize); } else RegionCopy(&tParent->borderClip, universe); if ((tChild = tParent->firstChild) && pParent->mapped) { RegionNull(&childUniverse); RegionNull(&childUnion); for (; tChild; tChild = tChild->nextSib) { if (tChild->pWin->viewable) RegionAppend(&childUnion, &tChild->pWin->borderSize); } RegionValidate(&childUnion, &overlap); for (tChild = tParent->firstChild; tChild; tChild = tChild->nextSib) { if (tChild->pWin->viewable) { if (tChild->valdata) { RegionIntersect(&childUniverse, universe, &tChild->pWin->borderSize); miOverlayComputeClips (tChild->pWin, &childUniverse, kind, exposed); } if (overlap) RegionSubtract(universe, universe, &tChild->pWin->borderSize); } } if (!overlap) RegionSubtract(universe, universe, &childUnion); RegionUninit(&childUnion); RegionUninit(&childUniverse); } if (oldVis == VisibilityFullyObscured || oldVis == VisibilityNotViewable) { RegionCopy(&tParent->valdata->exposed, universe); } else if (newVis != VisibilityFullyObscured && newVis != VisibilityNotViewable) { RegionSubtract(&tParent->valdata->exposed, universe, &tParent->clipList); } /* HACK ALERT - copying contents of regions, instead of regions */ { RegionRec tmp; tmp = tParent->clipList; tParent->clipList = *universe; *universe = tmp; } pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pScreen->ClipNotify) (* pScreen->ClipNotify) (pParent, dx, dy); } static void miOverlayMarkWindow(WindowPtr pWin) { miOverlayTreePtr pTree = NULL; WindowPtr pChild, pGrandChild; miMarkWindow(pWin); /* look for UnmapValdata among immediate children */ if(!(pChild = pWin->firstChild)) return; for( ; pChild; pChild = pChild->nextSib) { if(pChild->valdata == UnmapValData) { if(IN_UNDERLAY(pChild)) { pTree = MIOVERLAY_GET_WINDOW_TREE(pChild); pTree->valdata = (miOverlayValDataPtr)UnmapValData; continue; } else { if(!(pGrandChild = pChild->firstChild)) continue; while(1) { if(IN_UNDERLAY(pGrandChild)) { pTree = MIOVERLAY_GET_WINDOW_TREE(pGrandChild); pTree->valdata = (miOverlayValDataPtr)UnmapValData; } else if(pGrandChild->firstChild) { pGrandChild = pGrandChild->firstChild; continue; } while(!pGrandChild->nextSib && (pGrandChild != pChild)) pGrandChild = pGrandChild->parent; if(pChild == pGrandChild) break; pGrandChild = pGrandChild->nextSib; } } } } if(pTree) { MARK_UNDERLAY(pTree->parent->pWin); MIOVERLAY_GET_SCREEN_PRIVATE( pWin->drawable.pScreen)->underlayMarked = TRUE; } } static void miOverlayMarkUnrealizedWindow( WindowPtr pChild, WindowPtr pWin, Bool fromConfigure ){ if ((pChild != pWin) || fromConfigure) { miOverlayTreePtr pTree; RegionEmpty(&pChild->clipList); if (pChild->drawable.pScreen->ClipNotify) (* pChild->drawable.pScreen->ClipNotify)(pChild, 0, 0); RegionEmpty(&pChild->borderClip); if((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild))) { if(pTree->valdata != (miOverlayValDataPtr)UnmapValData) { RegionEmpty(&pTree->clipList); RegionEmpty(&pTree->borderClip); } } } } static int miOverlayValidateTree( WindowPtr pParent, WindowPtr pChild, /* first child effected */ VTKind kind ){ ScreenPtr pScreen = pParent->drawable.pScreen; miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); RegionRec totalClip, childClip, exposed; miOverlayTreePtr tParent, tChild, tWin; Bool overlap; WindowPtr newParent; if(!pPriv->underlayMarked) goto SKIP_UNDERLAY; if (!pChild) pChild = pParent->firstChild; RegionNull(&totalClip); RegionNull(&childClip); RegionNull(&exposed); newParent = pParent; while(IN_OVERLAY(newParent)) newParent = newParent->parent; tParent = MIOVERLAY_GET_WINDOW_TREE(newParent); if(IN_UNDERLAY(pChild)) tChild = MIOVERLAY_GET_WINDOW_TREE(pChild); else tChild = tParent->firstChild; if (RegionBroken(&tParent->clipList) && !RegionBroken(&tParent->borderClip)) { kind = VTBroken; RegionCopy(&totalClip, &tParent->borderClip); RegionIntersect(&totalClip, &totalClip, &tParent->pWin->winSize); for (tWin = tParent->firstChild; tWin != tChild; tWin = tWin->nextSib) { if (tWin->pWin->viewable) RegionSubtract(&totalClip, &totalClip, &tWin->pWin->borderSize); } RegionEmpty(&tParent->clipList); } else { for(tWin = tChild; tWin; tWin = tWin->nextSib) { if(tWin->valdata) RegionAppend(&totalClip, &tWin->borderClip); } RegionValidate(&totalClip, &overlap); } if(kind != VTStack) RegionUnion(&totalClip, &totalClip, &tParent->clipList); for(tWin = tChild; tWin; tWin = tWin->nextSib) { if(tWin->valdata) { if(tWin->pWin->viewable) { RegionIntersect(&childClip, &totalClip, &tWin->pWin->borderSize); miOverlayComputeClips(tWin->pWin, &childClip, kind, &exposed); RegionSubtract(&totalClip, &totalClip, &tWin->pWin->borderSize); } else { /* Means we are unmapping */ RegionEmpty(&tWin->clipList); RegionEmpty(&tWin->borderClip); tWin->valdata = NULL; } } } RegionUninit(&childClip); if(!((*pPriv->InOverlay)(newParent))) { RegionNull(&tParent->valdata->exposed); RegionNull(&tParent->valdata->borderExposed); } switch (kind) { case VTStack: break; default: if(!((*pPriv->InOverlay)(newParent))) RegionSubtract(&tParent->valdata->exposed, &totalClip, &tParent->clipList); /* fall through */ case VTMap: RegionCopy(&tParent->clipList, &totalClip); if(!((*pPriv->InOverlay)(newParent))) newParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; break; } RegionUninit(&totalClip); RegionUninit(&exposed); SKIP_UNDERLAY: miValidateTree(pParent, pChild, kind); return 1; } static void miOverlayHandleExposures(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); WindowPtr pChild; ValidatePtr val; void (* WindowExposures)(WindowPtr, RegionPtr, RegionPtr); WindowExposures = pWin->drawable.pScreen->WindowExposures; if(pPriv->underlayMarked) { miOverlayTreePtr pTree; miOverlayValDataPtr mival; pChild = pWin; while(IN_OVERLAY(pChild)) pChild = pChild->parent; pTree = MIOVERLAY_GET_WINDOW_TREE(pChild); while (1) { if((mival = pTree->valdata)) { if(!((*pPriv->InOverlay)(pTree->pWin))) { if (RegionNotEmpty(&mival->borderExposed)) (*pWin->drawable.pScreen->PaintWindowBorder)( pTree->pWin, &mival->borderExposed, PW_BORDER); RegionUninit(&mival->borderExposed); (*WindowExposures)(pTree->pWin,&mival->exposed,NullRegion); RegionUninit(&mival->exposed); } free(mival); pTree->valdata = NULL; if (pTree->firstChild) { pTree = pTree->firstChild; continue; } } while (!pTree->nextSib && (pTree->pWin != pChild)) pTree = pTree->parent; if (pTree->pWin == pChild) break; pTree = pTree->nextSib; } pPriv->underlayMarked = FALSE; } pChild = pWin; while (1) { if ( (val = pChild->valdata) ) { if(!((*pPriv->InOverlay)(pChild))) { RegionUnion(&val->after.exposed, &val->after.exposed, &val->after.borderExposed); if (RegionNotEmpty(&val->after.exposed)) { (*(MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->MakeTransparent))( pScreen, RegionNumRects(&val->after.exposed), RegionRects(&val->after.exposed)); } } else { if (RegionNotEmpty(&val->after.borderExposed)) (*pChild->drawable.pScreen->PaintWindowBorder)(pChild, &val->after.borderExposed, PW_BORDER); (*WindowExposures)(pChild, &val->after.exposed, NullRegion); } RegionUninit(&val->after.borderExposed); RegionUninit(&val->after.exposed); free(val); pChild->valdata = (ValidatePtr)NULL; if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } } static void miOverlayMoveWindow( WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind ){ ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); WindowPtr pParent, windowToValidate; Bool WasViewable = (Bool)(pWin->viewable); short bw; RegionRec overReg, underReg; DDXPointRec oldpt; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif if (!(pParent = pWin->parent)) return ; bw = wBorderWidth (pWin); oldpt.x = pWin->drawable.x; oldpt.y = pWin->drawable.y; if (WasViewable) { RegionNull(&overReg); RegionNull(&underReg); if(pTree) { RegionCopy(&overReg, &pWin->borderClip); RegionCopy(&underReg, &pTree->borderClip); } else { RegionCopy(&overReg, &pWin->borderClip); CollectUnderlayChildrenRegions(pWin, &underReg); } (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL); } pWin->origin.x = x + (int)bw; pWin->origin.y = y + (int)bw; x = pWin->drawable.x = pParent->drawable.x + x + (int)bw; y = pWin->drawable.y = pParent->drawable.y + y + (int)bw; SetWinSize (pWin); SetBorderSize (pWin); (*pScreen->PositionWindow)(pWin, x, y); windowToValidate = MoveWindowInStack(pWin, pNextSib); ResizeChildrenWinSize(pWin, x - oldpt.x, y - oldpt.y, 0, 0); if (WasViewable) { miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); (*pScreen->MarkOverlappedWindows) (pWin, windowToValidate, NULL); #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) dosave = (*pScreen->ChangeSaveUnder)(pWin, windowToValidate); #endif /* DO_SAVE_UNDERS */ (*pScreen->ValidateTree)(pWin->parent, NullWindow, kind); if(RegionNotEmpty(&underReg)) { pPriv->copyUnderlay = TRUE; (* pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, &underReg); } RegionUninit(&underReg); if(RegionNotEmpty(&overReg)) { pPriv->copyUnderlay = FALSE; (* pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, &overReg); } RegionUninit(&overReg); (*pScreen->HandleExposures)(pWin->parent); #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pWin, windowToValidate); #endif /* DO_SAVE_UNDERS */ if (pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pWin->parent, NullWindow, kind); } if (pWin->realized) WindowsRestructured (); } #ifndef RECTLIMIT #define RECTLIMIT 25 #endif static void miOverlayWindowExposures( WindowPtr pWin, register RegionPtr prgn, RegionPtr other_exposed ){ RegionPtr exposures = prgn; ScreenPtr pScreen = pWin->drawable.pScreen; if (pWin->backStorage && prgn) exposures = (*pScreen->RestoreAreas)(pWin, prgn); if ((prgn && !RegionNil(prgn)) || (exposures && !RegionNil(exposures)) || other_exposed) { RegionRec expRec; int clientInterested; clientInterested = (pWin->eventMask|wOtherEventMasks(pWin)) & ExposureMask; if (other_exposed) { if (exposures) { RegionUnion(other_exposed, exposures, other_exposed); if (exposures != prgn) RegionDestroy(exposures); } exposures = other_exposed; } if (clientInterested && exposures && (RegionNumRects(exposures) > RECTLIMIT)) { miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); BoxRec box; box = *RegionExtents(exposures); if (exposures == prgn) { exposures = &expRec; RegionInit(exposures, &box, 1); RegionReset(prgn, &box); } else { RegionReset(exposures, &box); RegionUnion(prgn, prgn, exposures); } /* This is the only reason why we are replacing mi's version of this file */ if(!((*pPriv->InOverlay)(pWin))) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); RegionIntersect(prgn, prgn, &pTree->clipList); } else RegionIntersect(prgn, prgn, &pWin->clipList); /* need to clear out new areas of backing store, too */ if (pWin->backStorage) (void) (*pScreen->ClearBackingStore)( pWin, box.x1 - pWin->drawable.x, box.y1 - pWin->drawable.y, box.x2 - box.x1, box.y2 - box.y1, FALSE); } if (prgn && !RegionNil(prgn)) (*pScreen->PaintWindowBackground)( pWin, prgn, PW_BACKGROUND); if (clientInterested && exposures && !RegionNil(exposures)) miSendExposures(pWin, exposures, pWin->drawable.x, pWin->drawable.y); if (exposures == &expRec) { RegionUninit(exposures); } else if (exposures && exposures != prgn && exposures != other_exposed) RegionDestroy(exposures); if (prgn) RegionEmpty(prgn); } else if (exposures && exposures != prgn) RegionDestroy(exposures); } typedef struct { RegionPtr over; RegionPtr under; } miOverlayTwoRegions; static int miOverlayRecomputeExposures ( WindowPtr pWin, void * value ){ register ScreenPtr pScreen; miOverlayTwoRegions *pValid = (miOverlayTwoRegions*)value; miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); /* This prevents warning about pScreen not being used. */ pWin->drawable.pScreen = pScreen = pWin->drawable.pScreen; if (pWin->valdata) { /* * compute exposed regions of this window */ RegionSubtract(&pWin->valdata->after.exposed, &pWin->clipList, pValid->over); /* * compute exposed regions of the border */ RegionSubtract(&pWin->valdata->after.borderExposed, &pWin->borderClip, &pWin->winSize); RegionSubtract(&pWin->valdata->after.borderExposed, &pWin->valdata->after.borderExposed, pValid->over); } if(pTree && pTree->valdata) { RegionSubtract(&pTree->valdata->exposed, &pTree->clipList, pValid->under); RegionSubtract(&pTree->valdata->borderExposed, &pTree->borderClip, &pWin->winSize); RegionSubtract(&pTree->valdata->borderExposed, &pTree->valdata->borderExposed, pValid->under); } else if (!pWin->valdata) return WT_NOMATCH; return WT_WALKCHILDREN; } static void miOverlayResizeWindow( WindowPtr pWin, int x, int y, unsigned int w, unsigned int h, WindowPtr pSib ){ ScreenPtr pScreen = pWin->drawable.pScreen; WindowPtr pParent; miOverlayTreePtr tChild, pTree; Bool WasViewable = (Bool)(pWin->viewable); unsigned short width = pWin->drawable.width; unsigned short height = pWin->drawable.height; short oldx = pWin->drawable.x; short oldy = pWin->drawable.y; int bw = wBorderWidth (pWin); short dw, dh; DDXPointRec oldpt; RegionPtr oldRegion = NULL, oldRegion2 = NULL; WindowPtr pFirstChange; register WindowPtr pChild; RegionPtr gravitate[StaticGravity + 1]; RegionPtr gravitate2[StaticGravity + 1]; register unsigned g; int nx, ny; /* destination x,y */ int newx, newy; /* new inner window position */ RegionPtr pRegion = NULL; RegionPtr destClip, destClip2; RegionPtr oldWinClip = NULL, oldWinClip2 = NULL; RegionPtr borderVisible = NullRegion; RegionPtr borderVisible2 = NullRegion; RegionPtr bsExposed = NullRegion; /* backing store exposures */ Bool shrunk = FALSE; /* shrunk in an inner dimension */ Bool moved = FALSE; /* window position changed */ #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif Bool doUnderlay; /* if this is a root window, can't be resized */ if (!(pParent = pWin->parent)) return ; pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); doUnderlay = ((pTree) || HasUnderlayChildren(pWin)); newx = pParent->drawable.x + x + bw; newy = pParent->drawable.y + y + bw; if (WasViewable) { /* * save the visible region of the window */ oldRegion = RegionCreate(NullBox, 1); RegionCopy(oldRegion, &pWin->winSize); if(doUnderlay) { oldRegion2 = RegionCreate(NullBox, 1); RegionCopy(oldRegion2, &pWin->winSize); } /* * categorize child windows into regions to be moved */ for (g = 0; g <= StaticGravity; g++) gravitate[g] = gravitate2[g] = NULL; for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { g = pChild->winGravity; if (g != UnmapGravity) { if (!gravitate[g]) gravitate[g] = RegionCreate(NullBox, 1); RegionUnion(gravitate[g], gravitate[g], &pChild->borderClip); if(doUnderlay) { if (!gravitate2[g]) gravitate2[g] = RegionCreate(NullBox, 0); if((tChild = MIOVERLAY_GET_WINDOW_TREE(pChild))) { RegionUnion(gravitate2[g], gravitate2[g], &tChild->borderClip); } else CollectUnderlayChildrenRegions(pChild, gravitate2[g]); } } else { UnmapWindow(pChild, TRUE); } } (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL); oldWinClip = oldWinClip2 = NULL; if (pWin->bitGravity != ForgetGravity) { oldWinClip = RegionCreate(NullBox, 1); RegionCopy(oldWinClip, &pWin->clipList); if(pTree) { oldWinClip2 = RegionCreate(NullBox, 1); RegionCopy(oldWinClip2, &pTree->clipList); } } /* * if the window is changing size, borderExposed * can't be computed correctly without some help. */ if (pWin->drawable.height > h || pWin->drawable.width > w) shrunk = TRUE; if (newx != oldx || newy != oldy) moved = TRUE; if ((pWin->drawable.height != h || pWin->drawable.width != w) && HasBorder (pWin)) { borderVisible = RegionCreate(NullBox, 1); if(pTree) borderVisible2 = RegionCreate(NullBox, 1); /* for tiled borders, we punt and draw the whole thing */ if (pWin->borderIsPixel || !moved) { if (shrunk || moved) RegionSubtract(borderVisible, &pWin->borderClip, &pWin->winSize); else RegionCopy(borderVisible, &pWin->borderClip); if(pTree) { if (shrunk || moved) RegionSubtract(borderVisible, &pTree->borderClip, &pWin->winSize); else RegionCopy(borderVisible, &pTree->borderClip); } } } } pWin->origin.x = x + bw; pWin->origin.y = y + bw; pWin->drawable.height = h; pWin->drawable.width = w; x = pWin->drawable.x = newx; y = pWin->drawable.y = newy; SetWinSize (pWin); SetBorderSize (pWin); dw = (int)w - (int)width; dh = (int)h - (int)height; ResizeChildrenWinSize(pWin, x - oldx, y - oldy, dw, dh); /* let the hardware adjust background and border pixmaps, if any */ (*pScreen->PositionWindow)(pWin, x, y); pFirstChange = MoveWindowInStack(pWin, pSib); if (WasViewable) { pRegion = RegionCreate(NullBox, 1); if (pWin->backStorage) RegionCopy(pRegion, &pWin->clipList); (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange, NULL); pWin->valdata->before.resized = TRUE; pWin->valdata->before.borderVisible = borderVisible; if(pTree) pTree->valdata->borderVisible = borderVisible2; #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) dosave = (*pScreen->ChangeSaveUnder)(pWin, pFirstChange); #endif /* DO_SAVE_UNDERS */ (*pScreen->ValidateTree)(pWin->parent, pFirstChange, VTOther); /* * the entire window is trashed unless bitGravity * recovers portions of it */ RegionCopy(&pWin->valdata->after.exposed, &pWin->clipList); if(pTree) RegionCopy(&pTree->valdata->exposed, &pTree->clipList); } GravityTranslate (x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny); if (pWin->backStorage && ((pWin->backingStore == Always) || WasViewable)) { if (!WasViewable) pRegion = &pWin->clipList; /* a convenient empty region */ if (pWin->bitGravity == ForgetGravity) bsExposed = (*pScreen->TranslateBackingStore) (pWin, 0, 0, NullRegion, oldx, oldy); else bsExposed = (*pScreen->TranslateBackingStore) (pWin, nx - x, ny - y, pRegion, oldx, oldy); } if (WasViewable) { miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); miOverlayTwoRegions TwoRegions; /* avoid the border */ if (HasBorder (pWin)) { int offx, offy, dx, dy; /* kruft to avoid double translates for each gravity */ offx = 0; offy = 0; for (g = 0; g <= StaticGravity; g++) { if (!gravitate[g] && !gravitate2[g]) continue; /* align winSize to gravitate[g]. * winSize is in new coordinates, * gravitate[g] is still in old coordinates */ GravityTranslate (x, y, oldx, oldy, dw, dh, g, &nx, &ny); dx = (oldx - nx) - offx; dy = (oldy - ny) - offy; if (dx || dy) { RegionTranslate(&pWin->winSize, dx, dy); offx += dx; offy += dy; } if(gravitate[g]) RegionIntersect(gravitate[g], gravitate[g], &pWin->winSize); if(gravitate2[g]) RegionIntersect(gravitate2[g], gravitate2[g], &pWin->winSize); } /* get winSize back where it belongs */ if (offx || offy) RegionTranslate(&pWin->winSize, -offx, -offy); } /* * add screen bits to the appropriate bucket */ if (oldWinClip2) { RegionCopy(pRegion, oldWinClip2); RegionTranslate(pRegion, nx - oldx, ny - oldy); RegionIntersect(oldWinClip2, pRegion, &pTree->clipList); for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) { if (gravitate2[g]) RegionSubtract(oldWinClip2, oldWinClip2, gravitate2[g]); } RegionTranslate(oldWinClip2, oldx - nx, oldy - ny); g = pWin->bitGravity; if (!gravitate2[g]) gravitate2[g] = oldWinClip2; else { RegionUnion(gravitate2[g],gravitate2[g],oldWinClip2); RegionDestroy(oldWinClip2); } } if (oldWinClip) { /* * clip to new clipList */ RegionCopy(pRegion, oldWinClip); RegionTranslate(pRegion, nx - oldx, ny - oldy); RegionIntersect(oldWinClip, pRegion, &pWin->clipList); /* * don't step on any gravity bits which will be copied after this * region. Note -- this assumes that the regions will be copied * in gravity order. */ for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) { if (gravitate[g]) RegionSubtract(oldWinClip, oldWinClip, gravitate[g]); } RegionTranslate(oldWinClip, oldx - nx, oldy - ny); g = pWin->bitGravity; if (!gravitate[g]) gravitate[g] = oldWinClip; else { RegionUnion(gravitate[g], gravitate[g], oldWinClip); RegionDestroy(oldWinClip); } } /* * move the bits on the screen */ destClip = destClip2 = NULL; for (g = 0; g <= StaticGravity; g++) { if (!gravitate[g] && !gravitate2[g]) continue; GravityTranslate (x, y, oldx, oldy, dw, dh, g, &nx, &ny); oldpt.x = oldx + (x - nx); oldpt.y = oldy + (y - ny); /* Note that gravitate[g] is *translated* by CopyWindow */ /* only copy the remaining useful bits */ if(gravitate[g]) RegionIntersect(gravitate[g], gravitate[g], oldRegion); if(gravitate2[g]) RegionIntersect(gravitate2[g], gravitate2[g], oldRegion2); /* clip to not overwrite already copied areas */ if (destClip && gravitate[g]) { RegionTranslate(destClip, oldpt.x - x, oldpt.y - y); RegionSubtract(gravitate[g], gravitate[g], destClip); RegionTranslate(destClip, x - oldpt.x, y - oldpt.y); } if (destClip2 && gravitate2[g]) { RegionTranslate(destClip2, oldpt.x - x, oldpt.y - y); RegionSubtract(gravitate2[g],gravitate2[g],destClip2); RegionTranslate(destClip2, x - oldpt.x, y - oldpt.y); } /* and move those bits */ if (oldpt.x != x || oldpt.y != y) { if(gravitate2[g]) { pPriv->copyUnderlay = TRUE; (*pWin->drawable.pScreen->CopyWindow)( pWin, oldpt, gravitate2[g]); } if(gravitate[g]) { pPriv->copyUnderlay = FALSE; (*pWin->drawable.pScreen->CopyWindow)( pWin, oldpt, gravitate[g]); } } /* remove any overwritten bits from the remaining useful bits */ if(gravitate[g]) RegionSubtract(oldRegion, oldRegion, gravitate[g]); if(gravitate2[g]) RegionSubtract(oldRegion2, oldRegion2, gravitate2[g]); /* * recompute exposed regions of child windows */ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->winGravity != g) continue; TwoRegions.over = gravitate[g]; TwoRegions.under = gravitate2[g]; TraverseTree (pChild, miOverlayRecomputeExposures, (void *)(&TwoRegions)); } /* * remove the successfully copied regions of the * window from its exposed region */ if (g == pWin->bitGravity) { if(gravitate[g]) RegionSubtract(&pWin->valdata->after.exposed, &pWin->valdata->after.exposed, gravitate[g]); if(gravitate2[g] && pTree) RegionSubtract(&pTree->valdata->exposed, &pTree->valdata->exposed, gravitate2[g]); } if(gravitate[g]) { if (!destClip) destClip = gravitate[g]; else { RegionUnion(destClip, destClip, gravitate[g]); RegionDestroy(gravitate[g]); } } if(gravitate2[g]) { if (!destClip2) destClip2 = gravitate2[g]; else { RegionUnion(destClip2, destClip2, gravitate2[g]); RegionDestroy(gravitate2[g]); } } } RegionDestroy(pRegion); RegionDestroy(oldRegion); if(doUnderlay) RegionDestroy(oldRegion2); if (destClip) RegionDestroy(destClip); if (destClip2) RegionDestroy(destClip2); if (bsExposed) { RegionPtr valExposed = NullRegion; if (pWin->valdata) valExposed = &pWin->valdata->after.exposed; (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); if (valExposed) RegionEmpty(valExposed); RegionDestroy(bsExposed); } (*pScreen->HandleExposures)(pWin->parent); #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pWin, pFirstChange); #endif /* DO_SAVE_UNDERS */ if (pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pWin->parent, pFirstChange, VTOther); } else if (bsExposed) { (*pScreen->WindowExposures) (pWin, NullRegion, bsExposed); RegionDestroy(bsExposed); } if (pWin->realized) WindowsRestructured (); } #ifdef SHAPE static void miOverlaySetShape(WindowPtr pWin) { Bool WasViewable = (Bool)(pWin->viewable); ScreenPtr pScreen = pWin->drawable.pScreen; RegionPtr pOldClip = NULL, bsExposed; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif if (WasViewable) { (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL); if (HasBorder (pWin)) { RegionPtr borderVisible; borderVisible = RegionCreate(NullBox, 1); RegionSubtract(borderVisible, &pWin->borderClip, &pWin->winSize); pWin->valdata->before.borderVisible = borderVisible; pWin->valdata->before.resized = TRUE; if(IN_UNDERLAY(pWin)) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); RegionPtr borderVisible2; borderVisible2 = RegionCreate(NULL, 1); RegionSubtract(borderVisible2, &pTree->borderClip, &pWin->winSize); pTree->valdata->borderVisible = borderVisible2; } } } SetWinSize (pWin); SetBorderSize (pWin); ResizeChildrenWinSize(pWin, 0, 0, 0, 0); if (WasViewable) { if (pWin->backStorage) { pOldClip = RegionCreate(NullBox, 1); RegionCopy(pOldClip, &pWin->clipList); } (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL); #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) dosave = (*pScreen->ChangeSaveUnder)(pWin, pWin); #endif /* DO_SAVE_UNDERS */ (*pScreen->ValidateTree)(pWin->parent, NullWindow, VTOther); } if (pWin->backStorage && ((pWin->backingStore == Always) || WasViewable)) { if (!WasViewable) pOldClip = &pWin->clipList; /* a convenient empty region */ bsExposed = (*pScreen->TranslateBackingStore) (pWin, 0, 0, pOldClip, pWin->drawable.x, pWin->drawable.y); if (WasViewable) RegionDestroy(pOldClip); if (bsExposed) { RegionPtr valExposed = NullRegion; if (pWin->valdata) valExposed = &pWin->valdata->after.exposed; (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); if (valExposed) RegionEmpty(valExposed); RegionDestroy(bsExposed); } } if (WasViewable) { (*pScreen->HandleExposures)(pWin->parent); #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pWin, pWin); #endif /* DO_SAVE_UNDERS */ if (pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pWin->parent, NullWindow, VTOther); } if (pWin->realized) WindowsRestructured (); CheckCursorConfinement(pWin); } #endif static void miOverlayChangeBorderWidth( WindowPtr pWin, unsigned int width ){ int oldwidth; register ScreenPtr pScreen; Bool WasViewable = (Bool)(pWin->viewable); Bool HadBorder; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif oldwidth = wBorderWidth (pWin); if (oldwidth == width) return; HadBorder = HasBorder(pWin); pScreen = pWin->drawable.pScreen; if (WasViewable && (width < oldwidth)) (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL); pWin->borderWidth = width; SetBorderSize (pWin); if (WasViewable) { if (width > oldwidth) { (*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL); if (HadBorder) { RegionPtr borderVisible; borderVisible = RegionCreate(NULL, 1); RegionSubtract(borderVisible, &pWin->borderClip, &pWin->winSize); pWin->valdata->before.borderVisible = borderVisible; if(IN_UNDERLAY(pWin)) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); RegionPtr borderVisible2; borderVisible2 = RegionCreate(NULL, 1); RegionSubtract(borderVisible2, &pTree->borderClip, &pWin->winSize); pTree->valdata->borderVisible = borderVisible2; } } } #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) dosave = (*pScreen->ChangeSaveUnder)(pWin, pWin->nextSib); #endif /* DO_SAVE_UNDERS */ (*pScreen->ValidateTree)(pWin->parent, pWin, VTOther); (*pScreen->HandleExposures)(pWin->parent); #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pWin, pWin->nextSib); #endif /* DO_SAVE_UNDERS */ if (pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pWin->parent, pWin, VTOther); } if (pWin->realized) WindowsRestructured (); } /* We need this as an addition since the xf86 common code doesn't know about the second tree which is static to this file. */ void miOverlaySetRootClip(ScreenPtr pScreen, Bool enable) { WindowPtr pRoot = pScreen->root; miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pRoot); MARK_UNDERLAY(pRoot); if(enable) { BoxRec box; box.x1 = 0; box.y1 = 0; box.x2 = pScreen->width; box.y2 = pScreen->height; RegionReset(&pTree->borderClip, &box); } else RegionEmpty(&pTree->borderClip); RegionBreak(&pTree->clipList); } static void miOverlayClearToBackground( WindowPtr pWin, int x, int y, int w, int h, Bool generateExposures ) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); BoxRec box; RegionRec reg; RegionPtr pBSReg = NullRegion; ScreenPtr pScreen = pWin->drawable.pScreen; miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); RegionPtr clipList; BoxPtr extents; int x1, y1, x2, y2; x1 = pWin->drawable.x + x; y1 = pWin->drawable.y + y; if (w) x2 = x1 + (int) w; else x2 = x1 + (int) pWin->drawable.width - (int) x; if (h) y2 = y1 + h; else y2 = y1 + (int) pWin->drawable.height - (int) y; clipList = ((*pScreenPriv->InOverlay)(pWin)) ? &pWin->clipList : &pTree->clipList; extents = RegionExtents(clipList); if (x1 < extents->x1) x1 = extents->x1; if (x2 > extents->x2) x2 = extents->x2; if (y1 < extents->y1) y1 = extents->y1; if (y2 > extents->y2) y2 = extents->y2; if (x2 <= x1 || y2 <= y1) x2 = x1 = y2 = y1 = 0; box.x1 = x1; box.x2 = x2; box.y1 = y1; box.y2 = y2; RegionInit(®, &box, 1); if (pWin->backStorage) { pBSReg = (* pScreen->ClearBackingStore)(pWin, x, y, w, h, generateExposures); } RegionIntersect(®, ®, clipList); if (generateExposures) (*pScreen->WindowExposures)(pWin, ®, pBSReg); else if (pWin->backgroundState != None) (*pScreen->PaintWindowBackground)(pWin, ®, PW_BACKGROUND); RegionUninit(®); if (pBSReg) RegionDestroy(pBSReg); } /****************************************************************/ /* not used */ Bool miOverlayGetPrivateClips( WindowPtr pWin, RegionPtr *borderClip, RegionPtr *clipList ){ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); if(pTree) { *borderClip = &(pTree->borderClip); *clipList = &(pTree->clipList); return TRUE; } *borderClip = *clipList = NULL; return FALSE; } void miOverlaySetTransFunction ( ScreenPtr pScreen, miOverlayTransFunc transFunc ){ MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->MakeTransparent = transFunc; } Bool miOverlayCopyUnderlay(ScreenPtr pScreen) { return MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->copyUnderlay; } void miOverlayComputeCompositeClip(GCPtr pGC, WindowPtr pWin) { ScreenPtr pScreen = pGC->pScreen; miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); RegionPtr pregWin; Bool freeTmpClip, freeCompClip; if(!pTree) { miComputeCompositeClip(pGC, &pWin->drawable); return; } if (pGC->subWindowMode == IncludeInferiors) { pregWin = RegionCreate(NullBox, 1); freeTmpClip = TRUE; if (pWin->parent || (screenIsSaved != SCREEN_SAVER_ON) || !HasSaverWindow (pScreen->myNum)) { RegionIntersect(pregWin,&pTree->borderClip,&pWin->winSize); } } else { pregWin = &pTree->clipList; freeTmpClip = FALSE; } freeCompClip = pGC->freeCompClip; if (pGC->clientClipType == CT_NONE) { if (freeCompClip) RegionDestroy(pGC->pCompositeClip); pGC->pCompositeClip = pregWin; pGC->freeCompClip = freeTmpClip; } else { RegionTranslate(pGC->clientClip, pWin->drawable.x + pGC->clipOrg.x, pWin->drawable.y + pGC->clipOrg.y); if (freeCompClip) { RegionIntersect(pGC->pCompositeClip, pregWin, pGC->clientClip); if (freeTmpClip) RegionDestroy(pregWin); } else if (freeTmpClip) { RegionIntersect(pregWin, pregWin, pGC->clientClip); pGC->pCompositeClip = pregWin; } else { pGC->pCompositeClip = RegionCreate(NullBox, 0); RegionIntersect(pGC->pCompositeClip, pregWin, pGC->clientClip); } pGC->freeCompClip = TRUE; RegionTranslate(pGC->clientClip, -(pWin->drawable.x + pGC->clipOrg.x), -(pWin->drawable.y + pGC->clipOrg.y)); } } Bool miOverlayCollectUnderlayRegions( WindowPtr pWin, RegionPtr *region ){ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); if(pTree) { *region = &pTree->borderClip; return FALSE; } *region = RegionCreate(NullBox, 0); CollectUnderlayChildrenRegions(pWin, *region); return TRUE; } static miOverlayTreePtr DoLeaf( WindowPtr pWin, miOverlayTreePtr parent, miOverlayTreePtr prevSib ){ miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); pTree->parent = parent; pTree->firstChild = NULL; pTree->lastChild = NULL; pTree->prevSib = prevSib; pTree->nextSib = NULL; if(prevSib) prevSib->nextSib = pTree; if(!parent->firstChild) parent->firstChild = parent->lastChild = pTree; else if(parent->lastChild == prevSib) parent->lastChild = pTree; return pTree; } static void RebuildTree(WindowPtr pWin) { miOverlayTreePtr parent, prevSib, tChild; WindowPtr pChild; prevSib = tChild = NULL; pWin = pWin->parent; while(IN_OVERLAY(pWin)) pWin = pWin->parent; parent = MIOVERLAY_GET_WINDOW_TREE(pWin); pChild = pWin->firstChild; parent->firstChild = parent->lastChild = NULL; while(1) { if(IN_UNDERLAY(pChild)) prevSib = tChild = DoLeaf(pChild, parent, prevSib); if(pChild->firstChild) { if(IN_UNDERLAY(pChild)) { parent = tChild; prevSib = NULL; } pChild = pChild->firstChild; continue; } while(!pChild->nextSib) { pChild = pChild->parent; if(pChild == pWin) return; if(IN_UNDERLAY(pChild)) { prevSib = tChild = MIOVERLAY_GET_WINDOW_TREE(pChild); parent = tChild->parent; } } pChild = pChild->nextSib; } } static Bool HasUnderlayChildren(WindowPtr pWin) { WindowPtr pChild; if(!(pChild = pWin->firstChild)) return FALSE; while(1) { if(IN_UNDERLAY(pChild)) return TRUE; if(pChild->firstChild) { pChild = pChild->firstChild; continue; } while(!pChild->nextSib && (pWin != pChild)) pChild = pChild->parent; if(pChild == pWin) break; pChild = pChild->nextSib; } return FALSE; } static Bool CollectUnderlayChildrenRegions(WindowPtr pWin, RegionPtr pReg) { WindowPtr pChild; miOverlayTreePtr pTree; Bool hasUnderlay; if(!(pChild = pWin->firstChild)) return FALSE; hasUnderlay = FALSE; while(1) { if((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild))) { RegionAppend(pReg, &pTree->borderClip); hasUnderlay = TRUE; } else if(pChild->firstChild) { pChild = pChild->firstChild; continue; } while(!pChild->nextSib && (pWin != pChild)) pChild = pChild->parent; if(pChild == pWin) break; pChild = pChild->nextSib; } if(hasUnderlay) { Bool overlap; RegionValidate(pReg, &overlap); } return hasUnderlay; } static void MarkUnderlayWindow(WindowPtr pWin) { miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin); if(pTree->valdata) return; pTree->valdata = (miOverlayValDataPtr)xnfalloc(sizeof(miOverlayValDataRec)); pTree->valdata->oldAbsCorner.x = pWin->drawable.x; pTree->valdata->oldAbsCorner.y = pWin->drawable.y; pTree->valdata->borderVisible = NullRegion; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mioverlay.h0000644000000000000000000000132213614532331017356 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef __MIOVERLAY_H #define __MIOVERLAY_H typedef void (*miOverlayTransFunc)(ScreenPtr, int, BoxPtr); typedef Bool (*miOverlayInOverlayFunc)(WindowPtr); Bool miInitOverlay( ScreenPtr pScreen, miOverlayInOverlayFunc inOverlay, miOverlayTransFunc trans ); Bool miOverlayGetPrivateClips( WindowPtr pWin, RegionPtr *borderClip, RegionPtr *clipList ); Bool miOverlayCollectUnderlayRegions(WindowPtr, RegionPtr*); void miOverlayComputeCompositeClip(GCPtr, WindowPtr); Bool miOverlayCopyUnderlay(ScreenPtr); void miOverlaySetTransFunction(ScreenPtr, miOverlayTransFunc); void miOverlaySetRootClip(ScreenPtr, Bool); #endif /* __MIOVERLAY_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mipointer.c0000644000000000000000000003341113614532331017354 0ustar /* * mipointer.c */ /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif # include # include # include # include "misc.h" # include "windowstr.h" # include "pixmapstr.h" # include "mi.h" # include "scrnintstr.h" # include "mipointrst.h" # include "cursorstr.h" # include "dixstruct.h" # include int miPointerScreenIndex; static unsigned long miPointerGeneration = 0; #define GetScreenPrivate(s) ((miPointerScreenPtr) ((s)->devPrivates[miPointerScreenIndex].ptr)) #define SetupScreen(s) miPointerScreenPtr pScreenPriv = GetScreenPrivate(s) /* * until more than one pointer device exists. */ static miPointerRec miPointer; static Bool miPointerRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); static Bool miPointerUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); static Bool miPointerDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor); static void miPointerConstrainCursor(ScreenPtr pScreen, BoxPtr pBox); static void miPointerPointerNonInterestBox(ScreenPtr pScreen, BoxPtr pBox); static void miPointerCursorLimits(ScreenPtr pScreen, CursorPtr pCursor, BoxPtr pHotBox, BoxPtr pTopLeftBox); static Bool miPointerSetCursorPosition(ScreenPtr pScreen, int x, int y, Bool generateEvent); static Bool miPointerCloseScreen(ScreenPtr pScreen); static void miPointerMove(ScreenPtr pScreen, int x, int y, unsigned long time); Bool miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate) ScreenPtr pScreen; miPointerSpriteFuncPtr spriteFuncs; miPointerScreenFuncPtr screenFuncs; Bool waitForUpdate; { miPointerScreenPtr pScreenPriv; if (miPointerGeneration != serverGeneration) { miPointerScreenIndex = AllocateScreenPrivateIndex(); if (miPointerScreenIndex < 0) return FALSE; miPointerGeneration = serverGeneration; } pScreenPriv = (miPointerScreenPtr) malloc (sizeof (miPointerScreenRec)); if (!pScreenPriv) return FALSE; pScreenPriv->spriteFuncs = spriteFuncs; pScreenPriv->screenFuncs = screenFuncs; /* * check for uninitialized methods */ if (!screenFuncs->EnqueueEvent) screenFuncs->EnqueueEvent = mieqEnqueue; if (!screenFuncs->NewEventScreen) screenFuncs->NewEventScreen = mieqSwitchScreen; pScreenPriv->waitForUpdate = waitForUpdate; pScreenPriv->showTransparent = FALSE; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = miPointerCloseScreen; pScreen->devPrivates[miPointerScreenIndex].ptr = (void *) pScreenPriv; /* * set up screen cursor method table */ pScreen->ConstrainCursor = miPointerConstrainCursor; pScreen->CursorLimits = miPointerCursorLimits; pScreen->DisplayCursor = miPointerDisplayCursor; pScreen->RealizeCursor = miPointerRealizeCursor; pScreen->UnrealizeCursor = miPointerUnrealizeCursor; pScreen->SetCursorPosition = miPointerSetCursorPosition; pScreen->RecolorCursor = miRecolorCursor; pScreen->PointerNonInterestBox = miPointerPointerNonInterestBox; /* * set up the pointer object */ miPointer.pScreen = NULL; miPointer.pSpriteScreen = NULL; miPointer.pCursor = NULL; miPointer.pSpriteCursor = NULL; miPointer.limits.x1 = 0; miPointer.limits.x2 = 32767; miPointer.limits.y1 = 0; miPointer.limits.y2 = 32767; miPointer.confined = FALSE; miPointer.x = 0; miPointer.y = 0; miPointer.history_start = miPointer.history_end = 0; return TRUE; } static Bool miPointerCloseScreen (pScreen) ScreenPtr pScreen; { SetupScreen(pScreen); if (pScreen == miPointer.pScreen) miPointer.pScreen = 0; if (pScreen == miPointer.pSpriteScreen) miPointer.pSpriteScreen = 0; pScreen->CloseScreen = pScreenPriv->CloseScreen; free ((void *) pScreenPriv); return (*pScreen->CloseScreen) (pScreen); } /* * DIX/DDX interface routines */ static Bool miPointerRealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { SetupScreen(pScreen); return (*pScreenPriv->spriteFuncs->RealizeCursor) (pScreen, pCursor); } static Bool miPointerUnrealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { SetupScreen(pScreen); return (*pScreenPriv->spriteFuncs->UnrealizeCursor) (pScreen, pCursor); } static Bool miPointerDisplayCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { miPointer.pCursor = pCursor; miPointer.pScreen = pScreen; miPointerUpdate (); return TRUE; } static void miPointerConstrainCursor (pScreen, pBox) ScreenPtr pScreen; BoxPtr pBox; { miPointer.limits = *pBox; miPointer.confined = PointerConfinedToScreen(); } /*ARGSUSED*/ static void miPointerPointerNonInterestBox (pScreen, pBox) ScreenPtr pScreen; BoxPtr pBox; { /* until DIX uses this, this will remain a stub */ } /*ARGSUSED*/ static void miPointerCursorLimits(pScreen, pCursor, pHotBox, pTopLeftBox) ScreenPtr pScreen; CursorPtr pCursor; BoxPtr pHotBox; BoxPtr pTopLeftBox; { *pTopLeftBox = *pHotBox; } static Bool GenerateEvent; static Bool miPointerSetCursorPosition(pScreen, x, y, generateEvent) ScreenPtr pScreen; int x, y; Bool generateEvent; { SetupScreen (pScreen); GenerateEvent = generateEvent; if (pScreen->ConstrainCursorHarder) pScreen->ConstrainCursorHarder(pScreen, Absolute, &x, &y); /* device dependent - must pend signal and call miPointerWarpCursor */ (*pScreenPriv->screenFuncs->WarpCursor) (pScreen, x, y); if (!generateEvent) miPointerUpdate(); return TRUE; } /* Once signals are ignored, the WarpCursor function can call this */ void miPointerWarpCursor (pScreen, x, y) ScreenPtr pScreen; int x, y; { SetupScreen (pScreen); if (miPointer.pScreen != pScreen) (*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, TRUE); if (GenerateEvent) { miPointerMove (pScreen, x, y, GetTimeInMillis()); } else { /* everything from miPointerMove except the event and history */ if (!pScreenPriv->waitForUpdate && pScreen == miPointer.pSpriteScreen) { miPointer.devx = x; miPointer.devy = y; if(!miPointer.pCursor->bits->emptyMask) (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y); } miPointer.x = x; miPointer.y = y; miPointer.pScreen = pScreen; } } /* * Pointer/CursorDisplay interface routines */ int miPointerGetMotionBufferSize () { return MOTION_SIZE; } int miPointerGetMotionEvents (pPtr, coords, start, stop, pScreen) DeviceIntPtr pPtr; xTimecoord *coords; unsigned long start, stop; ScreenPtr pScreen; { int i; int count = 0; miHistoryPtr h; for (i = miPointer.history_start; i != miPointer.history_end;) { h = &miPointer.history[i]; if (h->event.time >= stop) break; if (h->event.time >= start) { *coords++ = h->event; count++; } if (++i == MOTION_SIZE) i = 0; } return count; } /* * miPointerUpdate * * Syncronize the sprite with the cursor - called from ProcessInputEvents */ void miPointerUpdate () { ScreenPtr pScreen; miPointerScreenPtr pScreenPriv; CursorPtr pCursor; int x, y, devx, devy; pScreen = miPointer.pScreen; x = miPointer.x; y = miPointer.y; devx = miPointer.devx; devy = miPointer.devy; if (!pScreen) return; pScreenPriv = GetScreenPrivate (pScreen); /* * if the cursor has switched screens, disable the sprite * on the old screen */ if (pScreen != miPointer.pSpriteScreen) { if (miPointer.pSpriteScreen) { miPointerScreenPtr pOldPriv; pOldPriv = GetScreenPrivate (miPointer.pSpriteScreen); if (miPointer.pCursor) { (*pOldPriv->spriteFuncs->SetCursor) (miPointer.pSpriteScreen, NullCursor, 0, 0); } (*pOldPriv->screenFuncs->CrossScreen) (miPointer.pSpriteScreen, FALSE); } (*pScreenPriv->screenFuncs->CrossScreen) (pScreen, TRUE); (*pScreenPriv->spriteFuncs->SetCursor) (pScreen, miPointer.pCursor, x, y); miPointer.devx = x; miPointer.devy = y; miPointer.pSpriteCursor = miPointer.pCursor; miPointer.pSpriteScreen = pScreen; } /* * if the cursor has changed, display the new one */ else if (miPointer.pCursor != miPointer.pSpriteCursor) { pCursor = miPointer.pCursor; if (pCursor->bits->emptyMask && !pScreenPriv->showTransparent) pCursor = NullCursor; (*pScreenPriv->spriteFuncs->SetCursor) (pScreen, pCursor, x, y); miPointer.devx = x; miPointer.devy = y; miPointer.pSpriteCursor = miPointer.pCursor; } else if (x != devx || y != devy) { miPointer.devx = x; miPointer.devy = y; if(!miPointer.pCursor->bits->emptyMask) (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y); } } /* * miPointerDeltaCursor. The void * has moved dx,dy from it's previous * position. */ void miPointerDeltaCursor (dx, dy, time) int dx, dy; unsigned long time; { miPointerAbsoluteCursor (miPointer.x + dx, miPointer.y + dy, time); } void miPointerSetNewScreen(int screen_no, int x, int y) { miPointerScreenPtr pScreenPriv; ScreenPtr pScreen; pScreen = screenInfo.screens[screen_no]; pScreenPriv = GetScreenPrivate (pScreen); (*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, FALSE); NewCurrentScreen (pScreen, x, y); miPointer.limits.x2 = pScreen->width; miPointer.limits.y2 = pScreen->height; } ScreenPtr miPointerCurrentScreen () { return (miPointer.pScreen); } /* * miPointerAbsoluteCursor. The void * has moved to x,y */ void miPointerAbsoluteCursor (x, y, time) int x, y; unsigned long time; { miPointerScreenPtr pScreenPriv; ScreenPtr pScreen; ScreenPtr newScreen; pScreen = miPointer.pScreen; if (!pScreen) return; /* called before ready */ if (x < 0 || x >= pScreen->width || y < 0 || y >= pScreen->height) { pScreenPriv = GetScreenPrivate (pScreen); if (!miPointer.confined) { newScreen = pScreen; (*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, &x, &y); if (newScreen != pScreen) { pScreen = newScreen; (*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, FALSE); pScreenPriv = GetScreenPrivate (pScreen); /* Smash the confine to the new screen */ miPointer.limits.x2 = pScreen->width; miPointer.limits.y2 = pScreen->height; } } } /* * constrain the hot-spot to the current * limits */ if (x < miPointer.limits.x1) x = miPointer.limits.x1; if (x >= miPointer.limits.x2) x = miPointer.limits.x2 - 1; if (y < miPointer.limits.y1) y = miPointer.limits.y1; if (y >= miPointer.limits.y2) y = miPointer.limits.y2 - 1; if (miPointer.x == x && miPointer.y == y && miPointer.pScreen == pScreen) return; miPointerMove (pScreen, x, y, time); } void miPointerPosition (x, y) int *x, *y; { *x = miPointer.x; *y = miPointer.y; } /* * miPointerMove. The void * has moved to x,y on current screen */ static void miPointerMove (pScreen, x, y, time) ScreenPtr pScreen; int x, y; unsigned long time; { SetupScreen(pScreen); xEvent xE; miHistoryPtr history; int prev, end, start; if (!pScreenPriv->waitForUpdate && pScreen == miPointer.pSpriteScreen) { miPointer.devx = x; miPointer.devy = y; if(!miPointer.pCursor->bits->emptyMask) (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y); } miPointer.x = x; miPointer.y = y; miPointer.pScreen = pScreen; xE.u.u.type = MotionNotify; xE.u.keyButtonPointer.rootX = x; xE.u.keyButtonPointer.rootY = y; xE.u.keyButtonPointer.time = time; (*pScreenPriv->screenFuncs->EnqueueEvent) (&xE); end = miPointer.history_end; start = miPointer.history_start; prev = end - 1; if (end == 0) prev = MOTION_SIZE - 1; history = &miPointer.history[prev]; if (end == start || history->event.time != time) { history = &miPointer.history[end]; if (++end == MOTION_SIZE) end = 0; if (end == start) { start = end + 1; if (start == MOTION_SIZE) start = 0; miPointer.history_start = start; } miPointer.history_end = end; } history->event.x = x; history->event.y = y; history->event.time = time; history->pScreen = pScreen; } void _miRegisterPointerDevice (pScreen, pDevice) ScreenPtr pScreen; DeviceIntPtr pDevice; { miPointer.pPointer = (DevicePtr)pDevice; } /* obsolete: for binary compatibility */ #ifdef miRegisterPointerDevice #undef miRegisterPointerDevice void miRegisterPointerDevice (pScreen, pDevice) ScreenPtr pScreen; DevicePtr pDevice; { miPointer.pPointer = pDevice; } #endif /* miRegisterPointerDevice */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mipointer.h0000644000000000000000000001007613614532331017363 0ustar /* * mipointer.h * */ /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifndef MIPOINTER_H #define MIPOINTER_H #include "cursor.h" #include "input.h" typedef struct _miPointerSpriteFuncRec { Bool (*RealizeCursor)( ScreenPtr /* pScr */, CursorPtr /* pCurs */ ); Bool (*UnrealizeCursor)( ScreenPtr /* pScr */, CursorPtr /* pCurs */ ); void (*SetCursor)( ScreenPtr /* pScr */, CursorPtr /* pCurs */, int /* x */, int /* y */ ); void (*MoveCursor)( ScreenPtr /* pScr */, int /* x */, int /* y */ ); } miPointerSpriteFuncRec, *miPointerSpriteFuncPtr; typedef struct _miPointerScreenFuncRec { Bool (*CursorOffScreen)( ScreenPtr* /* ppScr */, int* /* px */, int* /* py */ ); void (*CrossScreen)( ScreenPtr /* pScr */, int /* entering */ ); void (*WarpCursor)( ScreenPtr /* pScr */, int /* x */, int /* y */ ); void (*EnqueueEvent)( xEventPtr /* event */ ); void (*NewEventScreen)( ScreenPtr /* pScr */, Bool /* fromDIX */ ); } miPointerScreenFuncRec, *miPointerScreenFuncPtr; extern Bool miDCInitialize( ScreenPtr /*pScreen*/, miPointerScreenFuncPtr /*screenFuncs*/ ); extern Bool miPointerInitialize( ScreenPtr /*pScreen*/, miPointerSpriteFuncPtr /*spriteFuncs*/, miPointerScreenFuncPtr /*screenFuncs*/, Bool /*waitForUpdate*/ ); extern void miPointerWarpCursor( ScreenPtr /*pScreen*/, int /*x*/, int /*y*/ ); extern int miPointerGetMotionBufferSize( void ); extern int miPointerGetMotionEvents( DeviceIntPtr /*pPtr*/, xTimecoord * /*coords*/, unsigned long /*start*/, unsigned long /*stop*/, ScreenPtr /*pScreen*/ ); extern void miPointerUpdate( void ); extern void miPointerDeltaCursor( int /*dx*/, int /*dy*/, unsigned long /*time*/ ); extern void miPointerAbsoluteCursor( int /*x*/, int /*y*/, unsigned long /*time*/ ); extern void miPointerPosition( int * /*x*/, int * /*y*/ ); #undef miRegisterPointerDevice extern void miRegisterPointerDevice( ScreenPtr /*pScreen*/, DevicePtr /*pDevice*/ ); extern void miPointerSetNewScreen( int, /*screen_no*/ int, /*x*/ int /*y*/ ); extern ScreenPtr miPointerCurrentScreen( void ); #define miRegisterPointerDevice(pScreen,pDevice) \ _miRegisterPointerDevice(pScreen,pDevice) extern void _miRegisterPointerDevice( ScreenPtr /*pScreen*/, DeviceIntPtr /*pDevice*/ ); extern int miPointerScreenIndex; #endif /* MIPOINTER_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mipointrst.h0000644000000000000000000000444013614532331017563 0ustar /* * mipointrst.h * */ /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #include "mipointer.h" #include "scrnintstr.h" #define MOTION_SIZE 256 typedef struct { xTimecoord event; ScreenPtr pScreen; } miHistoryRec, *miHistoryPtr; typedef struct { ScreenPtr pScreen; /* current screen */ ScreenPtr pSpriteScreen;/* screen containing current sprite */ CursorPtr pCursor; /* current cursor */ CursorPtr pSpriteCursor;/* cursor on screen */ BoxRec limits; /* current constraints */ Bool confined; /* pointer can't change screens */ int x, y; /* hot spot location */ int devx, devy; /* sprite position */ DevicePtr pPointer; /* pointer device structure */ miHistoryRec history[MOTION_SIZE]; int history_start, history_end; } miPointerRec, *miPointerPtr; typedef struct { miPointerSpriteFuncPtr spriteFuncs; /* sprite-specific methods */ miPointerScreenFuncPtr screenFuncs; /* screen-specific methods */ CloseScreenProcPtr CloseScreen; Bool waitForUpdate; /* don't move cursor in SIGIO */ Bool showTransparent; /* show empty cursors */ } miPointerScreenRec, *miPointerScreenPtr; nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mipoly.c0000644000000000000000000000735413614532331016666 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* * mipoly.c * * Written by Brian Kelleher; June 1986 * * Draw polygons. This routine translates the point by the * origin if pGC->miTranslate is non-zero, and calls * to the appropriate routine to actually scan convert the * polygon. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "windowstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "mi.h" #include "regionstr.h" void miFillPolygon(dst, pgc, shape, mode, count, pPts) DrawablePtr dst; register GCPtr pgc; int shape, mode; register int count; DDXPointPtr pPts; { int i; register int xorg, yorg; register DDXPointPtr ppt; if (count == 0) return; ppt = pPts; if (pgc->miTranslate) { xorg = dst->x; yorg = dst->y; if (mode == CoordModeOrigin) { for (i = 0; ix += xorg; ppt++->y += yorg; } } else { ppt->x += xorg; ppt++->y += yorg; for (i = 1; ix += (ppt-1)->x; ppt->y += (ppt-1)->y; ppt++; } } } else { if (mode == CoordModePrevious) { ppt++; for (i = 1; ix += (ppt-1)->x; ppt->y += (ppt-1)->y; ppt++; } } } if (shape == Convex) miFillConvexPoly(dst, pgc, count, pPts); else miFillGeneralPoly(dst, pgc, count, pPts); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mipolycon.c0000644000000000000000000001750113614532331017361 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "gcstruct.h" #include "pixmap.h" #include "mi.h" #include "miscanfill.h" static int getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty); /* * convexpoly.c * * Written by Brian Kelleher; Dec. 1985. * * Fill a convex polygon. If the given polygon * is not convex, then the result is undefined. * The algorithm is to order the edges from smallest * y to largest by partitioning the array into a left * edge list and a right edge list. The algorithm used * to traverse each edge is an extension of Bresenham's * line algorithm with y as the major axis. * For a derivation of the algorithm, see the author of * this code. */ Bool miFillConvexPoly(dst, pgc, count, ptsIn) DrawablePtr dst; GCPtr pgc; int count; /* number of points */ DDXPointPtr ptsIn; /* the points */ { register int xl = 0, xr = 0; /* x vals of left and right edges */ register int dl = 0, dr = 0; /* decision variables */ register int ml = 0, m1l = 0;/* left edge slope and slope+1 */ int mr = 0, m1r = 0; /* right edge slope and slope+1 */ int incr1l = 0, incr2l = 0; /* left edge error increments */ int incr1r = 0, incr2r = 0; /* right edge error increments */ int dy; /* delta y */ int y; /* current scanline */ int left, right; /* indices to first endpoints */ int i; /* loop counter */ int nextleft, nextright; /* indices to second endpoints */ DDXPointPtr ptsOut, FirstPoint; /* output buffer */ int *width, *FirstWidth; /* output buffer */ int imin; /* index of smallest vertex (in y) */ int ymin; /* y-extents of polygon */ int ymax; /* * find leftx, bottomy, rightx, topy, and the index * of bottomy. Also translate the points. */ imin = getPolyYBounds(ptsIn, count, &ymin, &ymax); dy = ymax - ymin + 1; if ((count < 3) || (dy < 0)) return(TRUE); ptsOut = FirstPoint = (DDXPointPtr )malloc(sizeof(DDXPointRec)*dy); width = FirstWidth = (int *)malloc(sizeof(int) * dy); if(!FirstPoint || !FirstWidth) { if (FirstWidth) free(FirstWidth); if (FirstPoint) free(FirstPoint); return(FALSE); } nextleft = nextright = imin; y = ptsIn[nextleft].y; /* * loop through all edges of the polygon */ do { /* * add a left edge if we need to */ if (ptsIn[nextleft].y == y) { left = nextleft; /* * find the next edge, considering the end * conditions of the array. */ nextleft++; if (nextleft >= count) nextleft = 0; /* * now compute all of the random information * needed to run the iterative algorithm. */ BRESINITPGON(ptsIn[nextleft].y-ptsIn[left].y, ptsIn[left].x,ptsIn[nextleft].x, xl, dl, ml, m1l, incr1l, incr2l); } /* * add a right edge if we need to */ if (ptsIn[nextright].y == y) { right = nextright; /* * find the next edge, considering the end * conditions of the array. */ nextright--; if (nextright < 0) nextright = count-1; /* * now compute all of the random information * needed to run the iterative algorithm. */ BRESINITPGON(ptsIn[nextright].y-ptsIn[right].y, ptsIn[right].x,ptsIn[nextright].x, xr, dr, mr, m1r, incr1r, incr2r); } /* * generate scans to fill while we still have * a right edge as well as a left edge. */ i = min(ptsIn[nextleft].y, ptsIn[nextright].y) - y; /* in case we're called with non-convex polygon */ if(i < 0) { free(FirstWidth); free(FirstPoint); return(TRUE); } while (i-- > 0) { ptsOut->y = y; /* * reverse the edges if necessary */ if (xl < xr) { *(width++) = xr - xl; (ptsOut++)->x = xl; } else { *(width++) = xl - xr; (ptsOut++)->x = xr; } y++; /* increment down the edges */ BRESINCRPGON(dl, xl, ml, m1l, incr1l, incr2l); BRESINCRPGON(dr, xr, mr, m1r, incr1r, incr2r); } } while (y != ymax); /* * Finally, fill the spans */ (*pgc->ops->FillSpans)(dst, pgc, ptsOut-FirstPoint,FirstPoint,FirstWidth, 1); free(FirstWidth); free(FirstPoint); return(TRUE); } /* * Find the index of the point with the smallest y. */ static int getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty) { register DDXPointPtr ptMin; int ymin, ymax; DDXPointPtr ptsStart = pts; ptMin = pts; ymin = ymax = (pts++)->y; while (--n > 0) { if (pts->y < ymin) { ptMin = pts; ymin = pts->y; } if(pts->y > ymax) ymax = pts->y; pts++; } *by = ymin; *ty = ymax; return(ptMin-ptsStart); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mipolygen.c0000644000000000000000000001711513614532331017354 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "gcstruct.h" #include "miscanfill.h" #include "mipoly.h" #include "pixmap.h" #include "mi.h" /* * * Written by Brian Kelleher; Oct. 1985 * * Routine to fill a polygon. Two fill rules are * supported: frWINDING and frEVENODD. * * See fillpoly.h for a complete description of the algorithm. */ Bool miFillGeneralPoly(dst, pgc, count, ptsIn) DrawablePtr dst; GCPtr pgc; int count; /* number of points */ DDXPointPtr ptsIn; /* the points */ { register EdgeTableEntry *pAET; /* the Active Edge Table */ register int y; /* the current scanline */ register int nPts = 0; /* number of pts in buffer */ register EdgeTableEntry *pWETE; /* Winding Edge Table */ register ScanLineList *pSLL; /* Current ScanLineList */ register DDXPointPtr ptsOut; /* ptr to output buffers */ int *width; DDXPointRec FirstPoint[NUMPTSTOBUFFER]; /* the output buffers */ int FirstWidth[NUMPTSTOBUFFER]; EdgeTableEntry *pPrevAET; /* previous AET entry */ EdgeTable ET; /* Edge Table header node */ EdgeTableEntry AET; /* Active ET header node */ EdgeTableEntry *pETEs; /* Edge Table Entries buff */ ScanLineListBlock SLLBlock; /* header for ScanLineList */ int fixWAET = 0; if (count < 3) return(TRUE); if(!(pETEs = (EdgeTableEntry *) malloc(sizeof(EdgeTableEntry) * count))) return(FALSE); ptsOut = FirstPoint; width = FirstWidth; if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock)) { free(pETEs); return(FALSE); } pSLL = ET.scanlines.next; if (pgc->fillRule == EvenOddRule) { /* * for each scanline */ for (y = ET.ymin; y < ET.ymax; y++) { /* * Add a new edge to the active edge table when we * get to the next edge. */ if (pSLL && y == pSLL->scanline) { miloadAET(&AET, pSLL->edgelist); pSLL = pSLL->next; } pPrevAET = &AET; pAET = AET.next; /* * for each active edge */ while (pAET) { ptsOut->x = pAET->bres.minor; ptsOut++->y = y; *width++ = pAET->next->bres.minor - pAET->bres.minor; nPts++; /* * send out the buffer when its full */ if (nPts == NUMPTSTOBUFFER) { (*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1); ptsOut = FirstPoint; width = FirstWidth; nPts = 0; } EVALUATEEDGEEVENODD(pAET, pPrevAET, y) EVALUATEEDGEEVENODD(pAET, pPrevAET, y); } miInsertionSort(&AET); } } else /* default to WindingNumber */ { /* * for each scanline */ for (y = ET.ymin; y < ET.ymax; y++) { /* * Add a new edge to the active edge table when we * get to the next edge. */ if (pSLL && y == pSLL->scanline) { miloadAET(&AET, pSLL->edgelist); micomputeWAET(&AET); pSLL = pSLL->next; } pPrevAET = &AET; pAET = AET.next; pWETE = pAET; /* * for each active edge */ while (pAET) { /* * if the next edge in the active edge table is * also the next edge in the winding active edge * table. */ if (pWETE == pAET) { ptsOut->x = pAET->bres.minor; ptsOut++->y = y; *width++ = pAET->nextWETE->bres.minor - pAET->bres.minor; nPts++; /* * send out the buffer */ if (nPts == NUMPTSTOBUFFER) { (*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1); ptsOut = FirstPoint; width = FirstWidth; nPts = 0; } pWETE = pWETE->nextWETE; while (pWETE != pAET) EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET); pWETE = pWETE->nextWETE; } EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET); } /* * reevaluate the Winding active edge table if we * just had to resort it or if we just exited an edge. */ if (miInsertionSort(&AET) || fixWAET) { micomputeWAET(&AET); fixWAET = 0; } } } /* * Get any spans that we missed by buffering */ (*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1); free(pETEs); miFreeStorage(SLLBlock.next); return(TRUE); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mipoly.h0000644000000000000000000001576213614532331016675 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * fill.h * * Created by Brian Kelleher; Oct 1985 * * Include file for filled polygon routines. * * These are the data structures needed to scan * convert regions. Two different scan conversion * methods are available -- the even-odd method, and * the winding number method. * The even-odd rule states that a point is inside * the polygon if a ray drawn from that point in any * direction will pass through an odd number of * path segments. * By the winding number rule, a point is decided * to be inside the polygon if a ray drawn from that * point in any direction passes through a different * number of clockwise and counter-clockwise path * segments. * * These data structures are adapted somewhat from * the algorithm in (Foley/Van Dam) for scan converting * polygons. * The basic algorithm is to start at the top (smallest y) * of the polygon, stepping down to the bottom of * the polygon by incrementing the y coordinate. We * keep a list of edges which the current scanline crosses, * sorted by x. This list is called the Active Edge Table (AET) * As we change the y-coordinate, we update each entry in * in the active edge table to reflect the edges new xcoord. * This list must be sorted at each scanline in case * two edges intersect. * We also keep a data structure known as the Edge Table (ET), * which keeps track of all the edges which the current * scanline has not yet reached. The ET is basically a * list of ScanLineList structures containing a list of * edges which are entered at a given scanline. There is one * ScanLineList per scanline at which an edge is entered. * When we enter a new edge, we move it from the ET to the AET. * * From the AET, we can implement the even-odd rule as in * (Foley/Van Dam). * The winding number rule is a little trickier. We also * keep the EdgeTableEntries in the AET linked by the * nextWETE (winding EdgeTableEntry) link. This allows * the edges to be linked just as before for updating * purposes, but only uses the edges linked by the nextWETE * link as edges representing spans of the polygon to * drawn (as with the even-odd rule). */ /* * for the winding number rule */ #define CLOCKWISE 1 #define COUNTERCLOCKWISE -1 typedef struct _EdgeTableEntry { int ymax; /* ycoord at which we exit this edge. */ BRESINFO bres; /* Bresenham info to run the edge */ struct _EdgeTableEntry *next; /* next in the list */ struct _EdgeTableEntry *back; /* for insertion sort */ struct _EdgeTableEntry *nextWETE; /* for winding num rule */ int ClockWise; /* flag for winding number rule */ } EdgeTableEntry; typedef struct _ScanLineList{ int scanline; /* the scanline represented */ EdgeTableEntry *edgelist; /* header node */ struct _ScanLineList *next; /* next in the list */ } ScanLineList; typedef struct { int ymax; /* ymax for the polygon */ int ymin; /* ymin for the polygon */ ScanLineList scanlines; /* header node */ } EdgeTable; /* * Here is a struct to help with storage allocation * so we can allocate a big chunk at a time, and then take * pieces from this heap when we need to. */ #define SLLSPERBLOCK 25 typedef struct _ScanLineListBlock { ScanLineList SLLs[SLLSPERBLOCK]; struct _ScanLineListBlock *next; } ScanLineListBlock; /* * number of points to buffer before sending them off * to scanlines() : Must be an even number */ #define NUMPTSTOBUFFER 200 /* * * a few macros for the inner loops of the fill code where * performance considerations don't allow a procedure call. * * Evaluate the given edge at the given scanline. * If the edge has expired, then we leave it and fix up * the active edge table; otherwise, we increment the * x value to be ready for the next scanline. * The winding number rule is in effect, so we must notify * the caller when the edge has been removed so he * can reorder the Winding Active Edge Table. */ #define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) { \ if (pAET->ymax == y) { /* leaving this edge */ \ pPrevAET->next = pAET->next; \ pAET = pPrevAET->next; \ fixWAET = 1; \ if (pAET) \ pAET->back = pPrevAET; \ } \ else { \ BRESINCRPGONSTRUCT(pAET->bres); \ pPrevAET = pAET; \ pAET = pAET->next; \ } \ } /* * Evaluate the given edge at the given scanline. * If the edge has expired, then we leave it and fix up * the active edge table; otherwise, we increment the * x value to be ready for the next scanline. * The even-odd rule is in effect. */ #define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \ if (pAET->ymax == y) { /* leaving this edge */ \ pPrevAET->next = pAET->next; \ pAET = pPrevAET->next; \ if (pAET) \ pAET->back = pPrevAET; \ } \ else { \ BRESINCRPGONSTRUCT(pAET->bres); \ pPrevAET = pAET; \ pAET = pAET->next; \ } \ } /* mipolyutil.c */ extern Bool miInsertEdgeInET( EdgeTable * /*ET*/, EdgeTableEntry * /*ETE*/, int /*scanline*/, ScanLineListBlock ** /*SLLBlock*/, int * /*iSLLBlock*/ ); extern Bool miCreateETandAET( int /*count*/, DDXPointPtr /*pts*/, EdgeTable * /*ET*/, EdgeTableEntry * /*AET*/, EdgeTableEntry * /*pETEs*/, ScanLineListBlock * /*pSLLBlock*/ ); extern void miloadAET( EdgeTableEntry * /*AET*/, EdgeTableEntry * /*ETEs*/ ); extern void micomputeWAET( EdgeTableEntry * /*AET*/ ); extern int miInsertionSort( EdgeTableEntry * /*AET*/ ); extern void miFreeStorage( ScanLineListBlock * /*pSLLBlock*/ ); nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mipolypnt.c0000644000000000000000000000723113614532331017402 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "pixmapstr.h" #include "gcstruct.h" #include "windowstr.h" #include "mi.h" void miPolyPoint(pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; /* Origin or Previous */ int npt; xPoint *pptInit; { int xorg; int yorg; int nptTmp; XID fsOld, fsNew; int *pwidthInit, *pwidth; int i; register xPoint *ppt; /* make pointlist origin relative */ if (mode == CoordModePrevious) { ppt = pptInit; nptTmp = npt; nptTmp--; while(nptTmp--) { ppt++; ppt->x += (ppt-1)->x; ppt->y += (ppt-1)->y; } } if(pGC->miTranslate) { ppt = pptInit; nptTmp = npt; xorg = pDrawable->x; yorg = pDrawable->y; while(nptTmp--) { ppt->x += xorg; ppt++->y += yorg; } } fsOld = pGC->fillStyle; fsNew = FillSolid; if(pGC->fillStyle != FillSolid) { DoChangeGC(pGC, GCFillStyle, &fsNew, 0); ValidateGC(pDrawable, pGC); } if(!(pwidthInit = (int *)malloc(npt * sizeof(int)))) return; pwidth = pwidthInit; for(i = 0; i < npt; i++) *pwidth++ = 1; (*pGC->ops->FillSpans)(pDrawable, pGC, npt, pptInit, pwidthInit, FALSE); if(fsOld != FillSolid) { DoChangeGC(pGC, GCFillStyle, &fsOld, 0); ValidateGC(pDrawable, pGC); } free(pwidthInit); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mipolyrect.c0000644000000000000000000001236713614532331017544 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "regionstr.h" #include "gcstruct.h" #include "pixmap.h" #include "mi.h" void miPolyRectangle(pDraw, pGC, nrects, pRects) DrawablePtr pDraw; GCPtr pGC; int nrects; xRectangle *pRects; { int i; xRectangle *pR = pRects; DDXPointRec rect[5]; int bound_tmp; #define MINBOUND(dst,eqn) bound_tmp = eqn; \ if (bound_tmp < -32768) \ bound_tmp = -32768; \ dst = bound_tmp; #define MAXBOUND(dst,eqn) bound_tmp = eqn; \ if (bound_tmp > 32767) \ bound_tmp = 32767; \ dst = bound_tmp; #define MAXUBOUND(dst,eqn) bound_tmp = eqn; \ if (bound_tmp > 65535) \ bound_tmp = 65535; \ dst = bound_tmp; if (pGC->lineStyle == LineSolid && pGC->joinStyle == JoinMiter && pGC->lineWidth != 0) { xRectangle *tmp, *t; int ntmp; int offset1, offset2, offset3; int x, y, width, height; ntmp = (nrects << 2); offset2 = pGC->lineWidth; offset1 = offset2 >> 1; offset3 = offset2 - offset1; tmp = (xRectangle *) malloc(ntmp * sizeof (xRectangle)); if (!tmp) return; t = tmp; for (i = 0; i < nrects; i++) { x = pR->x; y = pR->y; width = pR->width; height = pR->height; pR++; if (width == 0 && height == 0) { rect[0].x = x; rect[0].y = y; rect[1].x = x; rect[1].y = y; (*pGC->ops->Polylines)(pDraw, pGC, CoordModeOrigin, 2, rect); } else if (height < offset2 || width < offset1) { if (height == 0) { t->x = x; t->width = width; } else { MINBOUND (t->x, x - offset1) MAXUBOUND (t->width, width + offset2) } if (width == 0) { t->y = y; t->height = height; } else { MINBOUND (t->y, y - offset1) MAXUBOUND (t->height, height + offset2) } t++; } else { MINBOUND(t->x, x - offset1) MINBOUND(t->y, y - offset1) MAXUBOUND(t->width, width + offset2) t->height = offset2; t++; MINBOUND(t->x, x - offset1) MAXBOUND(t->y, y + offset3); t->width = offset2; t->height = height - offset2; t++; MAXBOUND(t->x, x + width - offset1); MAXBOUND(t->y, y + offset3) t->width = offset2; t->height = height - offset2; t++; MINBOUND(t->x, x - offset1) MAXBOUND(t->y, y + height - offset1) MAXUBOUND(t->width, width + offset2) t->height = offset2; t++; } } (*pGC->ops->PolyFillRect) (pDraw, pGC, t - tmp, tmp); free ((void *) tmp); } else { for (i=0; ix; rect[0].y = pR->y; MAXBOUND(rect[1].x, pR->x + (int) pR->width) rect[1].y = rect[0].y; rect[2].x = rect[1].x; MAXBOUND(rect[2].y, pR->y + (int) pR->height); rect[3].x = rect[0].x; rect[3].y = rect[2].y; rect[4].x = rect[0].x; rect[4].y = rect[0].y; (*pGC->ops->Polylines)(pDraw, pGC, CoordModeOrigin, 5, rect); pR++; } } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mipolyseg.c0000644000000000000000000000603013614532331017353 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "regionstr.h" #include "gcstruct.h" #include "pixmap.h" #include "mi.h" /***************************************************************** * miPolySegment * * For each segment, draws a line between (x1, y1) and (x2, y2). The * lines are drawn in the order listed. * * Walks the segments, compressing them into format for PolyLines. * *****************************************************************/ void miPolySegment(pDraw, pGC, nseg, pSegs) DrawablePtr pDraw; GCPtr pGC; int nseg; xSegment *pSegs; { int i; for (i=0; iops->Polylines)(pDraw, pGC, CoordModeOrigin, 2,(DDXPointPtr)pSegs); pSegs++; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mipolytext.c0000644000000000000000000001365113614532331017570 0ustar /******************************************************************* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************/ /* * mipolytext.c - text routines * * Author: haynes * Digital Equipment Corporation * Western Software Laboratory * Date: Thu Feb 5 1987 */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "gcstruct.h" #include #include "dixfontstr.h" #include "mi.h" int miPolyText(pDraw, pGC, x, y, count, chars, fontEncoding) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; char *chars; FontEncoding fontEncoding; { unsigned long n, i; int w; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars, fontEncoding, &n, charinfo); w = 0; for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth; if (n != 0) (*pGC->ops->PolyGlyphBlt)( pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); return x+w; } int miPolyText8(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; char *chars; { unsigned long n, i; int w; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars, Linear8Bit, &n, charinfo); w = 0; for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth; if (n != 0) (*pGC->ops->PolyGlyphBlt)( pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); return x+w; } int miPolyText16(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; unsigned short *chars; { unsigned long n, i; int w; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars, (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit, &n, charinfo); w = 0; for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth; if (n != 0) (*pGC->ops->PolyGlyphBlt)( pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); return x+w; } int miImageText(pDraw, pGC, x, y, count, chars, fontEncoding) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; char *chars; FontEncoding fontEncoding; { unsigned long n, i; FontPtr font = pGC->font; int w; CharInfoPtr charinfo[255]; GetGlyphs(font, (unsigned long)count, (unsigned char *)chars, fontEncoding, &n, charinfo); w = 0; for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth; if (n !=0 ) (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font)); return x+w; } void miImageText8(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; char *chars; { unsigned long n; FontPtr font = pGC->font; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ GetGlyphs(font, (unsigned long)count, (unsigned char *)chars, Linear8Bit, &n, charinfo); if (n !=0 ) (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font)); } void miImageText16(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; unsigned short *chars; { unsigned long n; FontPtr font = pGC->font; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ GetGlyphs(font, (unsigned long)count, (unsigned char *)chars, (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit, &n, charinfo); if (n !=0 ) (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font)); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mipolyutil.c0000644000000000000000000002451713614532331017564 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "regionstr.h" #include "gc.h" #include "miscanfill.h" #include "mipoly.h" #include "misc.h" /* MAXINT */ /* * fillUtils.c * * Written by Brian Kelleher; Oct. 1985 * * This module contains all of the utility functions * needed to scan convert a polygon. * */ /* * InsertEdgeInET * * Insert the given edge into the edge table. * First we must find the correct bucket in the * Edge table, then find the right slot in the * bucket. Finally, we can insert it. * */ Bool miInsertEdgeInET(ET, ETE, scanline, SLLBlock, iSLLBlock) EdgeTable *ET; EdgeTableEntry *ETE; int scanline; ScanLineListBlock **SLLBlock; int *iSLLBlock; { register EdgeTableEntry *start, *prev; register ScanLineList *pSLL, *pPrevSLL; ScanLineListBlock *tmpSLLBlock; /* * find the right bucket to put the edge into */ pPrevSLL = &ET->scanlines; pSLL = pPrevSLL->next; while (pSLL && (pSLL->scanline < scanline)) { pPrevSLL = pSLL; pSLL = pSLL->next; } /* * reassign pSLL (pointer to ScanLineList) if necessary */ if ((!pSLL) || (pSLL->scanline > scanline)) { if (*iSLLBlock > SLLSPERBLOCK-1) { tmpSLLBlock = (ScanLineListBlock *)malloc(sizeof(ScanLineListBlock)); if (!tmpSLLBlock) return FALSE; (*SLLBlock)->next = tmpSLLBlock; tmpSLLBlock->next = (ScanLineListBlock *)NULL; *SLLBlock = tmpSLLBlock; *iSLLBlock = 0; } pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]); pSLL->next = pPrevSLL->next; pSLL->edgelist = (EdgeTableEntry *)NULL; pPrevSLL->next = pSLL; } pSLL->scanline = scanline; /* * now insert the edge in the right bucket */ prev = (EdgeTableEntry *)NULL; start = pSLL->edgelist; while (start && (start->bres.minor < ETE->bres.minor)) { prev = start; start = start->next; } ETE->next = start; if (prev) prev->next = ETE; else pSLL->edgelist = ETE; return TRUE; } /* * CreateEdgeTable * * This routine creates the edge table for * scan converting polygons. * The Edge Table (ET) looks like: * * EdgeTable * -------- * | ymax | ScanLineLists * |scanline|-->------------>-------------->... * -------- |scanline| |scanline| * |edgelist| |edgelist| * --------- --------- * | | * | | * V V * list of ETEs list of ETEs * * where ETE is an EdgeTableEntry data structure, * and there is one ScanLineList per scanline at * which an edge is initially entered. * */ Bool miCreateETandAET(count, pts, ET, AET, pETEs, pSLLBlock) register int count; register DDXPointPtr pts; EdgeTable *ET; EdgeTableEntry *AET; register EdgeTableEntry *pETEs; ScanLineListBlock *pSLLBlock; { register DDXPointPtr top, bottom; register DDXPointPtr PrevPt, CurrPt; int iSLLBlock = 0; int dy; if (count < 2) return TRUE; /* * initialize the Active Edge Table */ AET->next = (EdgeTableEntry *)NULL; AET->back = (EdgeTableEntry *)NULL; AET->nextWETE = (EdgeTableEntry *)NULL; AET->bres.minor = MININT; /* * initialize the Edge Table. */ ET->scanlines.next = (ScanLineList *)NULL; ET->ymax = MININT; ET->ymin = MAXINT; pSLLBlock->next = (ScanLineListBlock *)NULL; PrevPt = &pts[count-1]; /* * for each vertex in the array of points. * In this loop we are dealing with two vertices at * a time -- these make up one edge of the polygon. */ while (count--) { CurrPt = pts++; /* * find out which point is above and which is below. */ if (PrevPt->y > CurrPt->y) { bottom = PrevPt, top = CurrPt; pETEs->ClockWise = 0; } else { bottom = CurrPt, top = PrevPt; pETEs->ClockWise = 1; } /* * don't add horizontal edges to the Edge table. */ if (bottom->y != top->y) { pETEs->ymax = bottom->y-1; /* -1 so we don't get last scanline */ /* * initialize integer edge algorithm */ dy = bottom->y - top->y; BRESINITPGONSTRUCT(dy, top->x, bottom->x, pETEs->bres); if (!miInsertEdgeInET(ET, pETEs, top->y, &pSLLBlock, &iSLLBlock)) { miFreeStorage(pSLLBlock->next); return FALSE; } ET->ymax = max(ET->ymax, PrevPt->y); ET->ymin = min(ET->ymin, PrevPt->y); pETEs++; } PrevPt = CurrPt; } return TRUE; } /* * loadAET * * This routine moves EdgeTableEntries from the * EdgeTable into the Active Edge Table, * leaving them sorted by smaller x coordinate. * */ void miloadAET(AET, ETEs) register EdgeTableEntry *AET, *ETEs; { register EdgeTableEntry *pPrevAET; register EdgeTableEntry *tmp; pPrevAET = AET; AET = AET->next; while (ETEs) { while (AET && (AET->bres.minor < ETEs->bres.minor)) { pPrevAET = AET; AET = AET->next; } tmp = ETEs->next; ETEs->next = AET; if (AET) AET->back = ETEs; ETEs->back = pPrevAET; pPrevAET->next = ETEs; pPrevAET = ETEs; ETEs = tmp; } } /* * computeWAET * * This routine links the AET by the * nextWETE (winding EdgeTableEntry) link for * use by the winding number rule. The final * Active Edge Table (AET) might look something * like: * * AET * ---------- --------- --------- * |ymax | |ymax | |ymax | * | ... | |... | |... | * |next |->|next |->|next |->... * |nextWETE| |nextWETE| |nextWETE| * --------- --------- ^-------- * | | | * V-------------------> V---> ... * */ void micomputeWAET(AET) register EdgeTableEntry *AET; { register EdgeTableEntry *pWETE; register int inside = 1; register int isInside = 0; AET->nextWETE = (EdgeTableEntry *)NULL; pWETE = AET; AET = AET->next; while (AET) { if (AET->ClockWise) isInside++; else isInside--; if ((!inside && !isInside) || ( inside && isInside)) { pWETE->nextWETE = AET; pWETE = AET; inside = !inside; } AET = AET->next; } pWETE->nextWETE = (EdgeTableEntry *)NULL; } /* * InsertionSort * * Just a simple insertion sort using * pointers and back pointers to sort the Active * Edge Table. * */ int miInsertionSort(AET) register EdgeTableEntry *AET; { register EdgeTableEntry *pETEchase; register EdgeTableEntry *pETEinsert; register EdgeTableEntry *pETEchaseBackTMP; register int changed = 0; AET = AET->next; while (AET) { pETEinsert = AET; pETEchase = AET; while (pETEchase->back->bres.minor > AET->bres.minor) pETEchase = pETEchase->back; AET = AET->next; if (pETEchase != pETEinsert) { pETEchaseBackTMP = pETEchase->back; pETEinsert->back->next = AET; if (AET) AET->back = pETEinsert->back; pETEinsert->next = pETEchase; pETEchase->back->next = pETEinsert; pETEchase->back = pETEinsert; pETEinsert->back = pETEchaseBackTMP; changed = 1; } } return(changed); } /* * Clean up our act. */ void miFreeStorage(pSLLBlock) register ScanLineListBlock *pSLLBlock; { register ScanLineListBlock *tmpSLLBlock; while (pSLLBlock) { tmpSLLBlock = pSLLBlock->next; free(pSLLBlock); pSLLBlock = tmpSLLBlock; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mipushpxl.c0000644000000000000000000002005313614532331017375 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "gcstruct.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "mi.h" #include "servermd.h" #define NPT 128 /* These were stolen from mfb. They don't really belong here. */ #define LONG2CHARSSAMEORDER(x) ((MiBits)(x)) #define LONG2CHARSDIFFORDER( x ) ( ( ( ( x ) & (MiBits)0x000000FF ) << 0x18 ) \ | ( ( ( x ) & (MiBits)0x0000FF00 ) << 0x08 ) \ | ( ( ( x ) & (MiBits)0x00FF0000 ) >> 0x08 ) \ | ( ( ( x ) & (MiBits)0xFF000000 ) >> 0x18 ) ) #define PGSZB 4 #define PPW (PGSZB<<3) /* assuming 8 bits per byte */ #define PGSZ PPW #define PLST (PPW-1) #define PIM PLST #define PWSH 5 /* miPushPixels -- squeegees the fill style of pGC through pBitMap * into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may * be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit * is set in the bitmap, the fill style is put onto the drawable using * the GC's logical function. The drawable is not changed where the bitmap * has a zero bit or outside the area covered by the stencil. WARNING: this code works if the 1-bit deep pixmap format returned by GetSpans is the same as the format defined by the mfb code (i.e. 32-bit padding per scanline, scanline unit = 32 bits; later, this might mean bitsizeof(int) padding and sacnline unit == bitsizeof(int).) */ /* * in order to have both (MSB_FIRST and LSB_FIRST) versions of this * in the server, we need to rename one of them */ void miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg) GCPtr pGC; PixmapPtr pBitMap; DrawablePtr pDrawable; int dx, dy, xOrg, yOrg; { int h, dxDivPPW, ibEnd; MiBits *pwLineStart; register MiBits *pw, *pwEnd; register MiBits msk; register int ib, w; register int ipt; /* index into above arrays */ Bool fInBox; DDXPointRec pt[NPT], ptThisLine; int width[NPT]; #ifdef XFree86Server MiBits startmask; if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER) if (screenInfo.bitmapBitOrder == LSBFirst) startmask = (MiBits)(-1) ^ LONG2CHARSSAMEORDER((MiBits)(-1) << 1); else startmask = (MiBits)(-1) ^ LONG2CHARSSAMEORDER((MiBits)(-1) >> 1); else if (screenInfo.bitmapBitOrder == LSBFirst) startmask = (MiBits)(-1) ^ LONG2CHARSDIFFORDER((MiBits)(-1) << 1); else startmask = (MiBits)(-1) ^ LONG2CHARSDIFFORDER((MiBits)(-1) >> 1); #endif pwLineStart = (MiBits *)malloc(BitmapBytePad(dx)); if (!pwLineStart) return; ipt = 0; dxDivPPW = dx/PPW; for(h = 0, ptThisLine.x = 0, ptThisLine.y = 0; h < dy; h++, ptThisLine.y++) { (*pBitMap->drawable.pScreen->GetSpans)((DrawablePtr)pBitMap, dx, &ptThisLine, &dx, 1, (char *)pwLineStart); pw = pwLineStart; /* Process all words which are fully in the pixmap */ fInBox = FALSE; pwEnd = pwLineStart + dxDivPPW; while(pw < pwEnd) { w = *pw; #ifdef XFree86Server msk = startmask; #else msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1); #endif for(ib = 0; ib < PPW; ib++) { if(w & msk) { if(!fInBox) { pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg; pt[ipt].y = h + yOrg; /* start new box */ fInBox = TRUE; } } else { if(fInBox) { width[ipt] = ((pw - pwLineStart) << PWSH) + ib + xOrg - pt[ipt].x; if (++ipt >= NPT) { (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE); ipt = 0; } /* end box */ fInBox = FALSE; } } #ifdef XFree86Server /* This is not quite right, but it'll do for now */ if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER) if (screenInfo.bitmapBitOrder == LSBFirst) msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) << 1); else msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) >> 1); else if (screenInfo.bitmapBitOrder == LSBFirst) msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) << 1); else msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1); #else msk = SCRRIGHT(msk, 1); #endif } pw++; } ibEnd = dx & PIM; if(ibEnd) { /* Process final partial word on line */ w = *pw; #ifdef XFree86Server msk = startmask; #else msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1); #endif for(ib = 0; ib < ibEnd; ib++) { if(w & msk) { if(!fInBox) { /* start new box */ pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg; pt[ipt].y = h + yOrg; fInBox = TRUE; } } else { if(fInBox) { /* end box */ width[ipt] = ((pw - pwLineStart) << PWSH) + ib + xOrg - pt[ipt].x; if (++ipt >= NPT) { (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE); ipt = 0; } fInBox = FALSE; } } #ifdef XFree86Server /* This is not quite right, but it'll do for now */ if (screenInfo.bitmapBitOrder == IMAGE_BYTE_ORDER) if (screenInfo.bitmapBitOrder == LSBFirst) msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) << 1); else msk = LONG2CHARSSAMEORDER(LONG2CHARSSAMEORDER(msk) >> 1); else if (screenInfo.bitmapBitOrder == LSBFirst) msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) << 1); else msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1); #else msk = SCRRIGHT(msk, 1); #endif } } /* If scanline ended with last bit set, end the box */ if(fInBox) { width[ipt] = dx + xOrg - pt[ipt].x; if (++ipt >= NPT) { (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE); ipt = 0; } } } free(pwLineStart); /* Flush any remaining spans */ if (ipt) { (*pGC->ops->FillSpans)(pDrawable, pGC, ipt, pt, width, TRUE); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/miscanfill.h0000644000000000000000000001143413614532331017475 0ustar /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef SCANFILLINCLUDED #define SCANFILLINCLUDED /* * scanfill.h * * Written by Brian Kelleher; Jan 1985 * * This file contains a few macros to help track * the edge of a filled object. The object is assumed * to be filled in scanline order, and thus the * algorithm used is an extension of Bresenham's line * drawing algorithm which assumes that y is always the * major axis. * Since these pieces of code are the same for any filled shape, * it is more convenient to gather the library in one * place, but since these pieces of code are also in * the inner loops of output primitives, procedure call * overhead is out of the question. * See the author for a derivation if needed. */ /* * In scan converting polygons, we want to choose those pixels * which are inside the polygon. Thus, we add .5 to the starting * x coordinate for both left and right edges. Now we choose the * first pixel which is inside the pgon for the left edge and the * first pixel which is outside the pgon for the right edge. * Draw the left pixel, but not the right. * * How to add .5 to the starting x coordinate: * If the edge is moving to the right, then subtract dy from the * error term from the general form of the algorithm. * If the edge is moving to the left, then add dy to the error term. * * The reason for the difference between edges moving to the left * and edges moving to the right is simple: If an edge is moving * to the right, then we want the algorithm to flip immediately. * If it is moving to the left, then we don't want it to flip until * we traverse an entire pixel. */ #define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \ int dx; /* local storage */ \ \ /* \ * if the edge is horizontal, then it is ignored \ * and assumed not to be processed. Otherwise, do this stuff. \ */ \ if ((dy) != 0) { \ xStart = (x1); \ dx = (x2) - xStart; \ if (dx < 0) { \ m = dx / (dy); \ m1 = m - 1; \ incr1 = -2 * dx + 2 * (dy) * m1; \ incr2 = -2 * dx + 2 * (dy) * m; \ d = 2 * m * (dy) - 2 * dx - 2 * (dy); \ } else { \ m = dx / (dy); \ m1 = m + 1; \ incr1 = 2 * dx - 2 * (dy) * m1; \ incr2 = 2 * dx - 2 * (dy) * m; \ d = -2 * m * (dy) + 2 * dx; \ } \ } \ } #define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \ if (m1 > 0) { \ if (d > 0) { \ minval += m1; \ d += incr1; \ } \ else { \ minval += m; \ d += incr2; \ } \ } else {\ if (d >= 0) { \ minval += m1; \ d += incr1; \ } \ else { \ minval += m; \ d += incr2; \ } \ } \ } /* * This structure contains all of the information needed * to run the bresenham algorithm. * The variables may be hardcoded into the declarations * instead of using this structure to make use of * register declarations. */ typedef struct { int minor; /* minor axis */ int d; /* decision variable */ int m, m1; /* slope and slope+1 */ int incr1, incr2; /* error increments */ } BRESINFO; #define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \ BRESINITPGON(dmaj, min1, min2, bres.minor, bres.d, \ bres.m, bres.m1, bres.incr1, bres.incr2) #define BRESINCRPGONSTRUCT(bres) \ BRESINCRPGON(bres.d, bres.minor, bres.m, bres.m1, bres.incr1, bres.incr2) #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/miscrinit.c0000644000000000000000000002462613614532331017357 0ustar /* Copyright 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "servermd.h" #include "misc.h" #include "mi.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "dix.h" #include "miline.h" #ifdef MITSHM #include "shmint.h" #endif /* We use this structure to propogate some information from miScreenInit to * miCreateScreenResources. miScreenInit allocates the structure, fills it * in, and puts it into pScreen->devPrivate. miCreateScreenResources * extracts the info and frees the structure. We could've accomplished the * same thing by adding fields to the screen structure, but they would have * ended up being redundant, and would have exposed this mi implementation * detail to the whole server. */ typedef struct { void * pbits; /* pointer to framebuffer */ int width; /* delta to add to a framebuffer addr to move one row down */ } miScreenInitParmsRec, *miScreenInitParmsPtr; /* this plugs into pScreen->ModifyPixmapHeader */ Bool miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind, pPixData) PixmapPtr pPixmap; int width; int height; int depth; int bitsPerPixel; int devKind; void *pPixData; { if (!pPixmap) return FALSE; /* * If all arguments are specified, reinitialize everything (including * validated state). */ if ((width > 0) && (height > 0) && (depth > 0) && (bitsPerPixel > 0) && (devKind > 0) && pPixData) { pPixmap->drawable.depth = depth; pPixmap->drawable.bitsPerPixel = bitsPerPixel; pPixmap->drawable.id = 0; pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pPixmap->drawable.x = 0; pPixmap->drawable.y = 0; pPixmap->drawable.width = width; pPixmap->drawable.height = height; pPixmap->devKind = devKind; pPixmap->refcnt = 1; pPixmap->devPrivate.ptr = pPixData; } else { /* * Only modify specified fields, keeping all others intact. */ if (width > 0) pPixmap->drawable.width = width; if (height > 0) pPixmap->drawable.height = height; if (depth > 0) pPixmap->drawable.depth = depth; if (bitsPerPixel > 0) pPixmap->drawable.bitsPerPixel = bitsPerPixel; else if ((bitsPerPixel < 0) && (depth > 0)) pPixmap->drawable.bitsPerPixel = BitsPerPixel(depth); /* * CAVEAT: Non-SI DDXen may use devKind and devPrivate fields for * other purposes. */ if (devKind > 0) pPixmap->devKind = devKind; else if ((devKind < 0) && ((width > 0) || (depth > 0))) pPixmap->devKind = PixmapBytePad(pPixmap->drawable.width, pPixmap->drawable.depth); if (pPixData) pPixmap->devPrivate.ptr = pPixData; } return TRUE; } /*ARGSUSED*/ Bool miCloseScreen (pScreen) ScreenPtr pScreen; { return ((*pScreen->DestroyPixmap)((PixmapPtr)pScreen->devPrivate)); } /* With the introduction of pixmap privates, the "screen pixmap" can no * longer be created in miScreenInit, since all the modules that could * possibly ask for pixmap private space have not been initialized at * that time. pScreen->CreateScreenResources is called after all * possible private-requesting modules have been inited; we create the * screen pixmap here. */ Bool miCreateScreenResources(pScreen) ScreenPtr pScreen; { miScreenInitParmsPtr pScrInitParms; void * value; pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate; /* if width is non-zero, pScreen->devPrivate will be a pixmap * else it will just take the value pbits */ if (pScrInitParms->width) { PixmapPtr pPixmap; /* create a pixmap with no data, then redirect it to point to * the screen */ pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0); if (!pPixmap) return FALSE; if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width, pScreen->height, pScreen->rootDepth, BitsPerPixel(pScreen->rootDepth), PixmapBytePad(pScrInitParms->width, pScreen->rootDepth), pScrInitParms->pbits)) return FALSE; value = (void *)pPixmap; } else { value = pScrInitParms->pbits; } free(pScreen->devPrivate); /* freeing miScreenInitParmsRec */ pScreen->devPrivate = value; /* pPixmap or pbits */ return TRUE; } Bool miScreenDevPrivateInit(pScreen, width, pbits) register ScreenPtr pScreen; int width; void * pbits; { miScreenInitParmsPtr pScrInitParms; /* Stash pbits and width in a short-lived miScreenInitParmsRec attached * to the screen, until CreateScreenResources can put them in the * screen pixmap. */ pScrInitParms = (miScreenInitParmsPtr)malloc(sizeof(miScreenInitParmsRec)); if (!pScrInitParms) return FALSE; pScrInitParms->pbits = pbits; pScrInitParms->width = width; pScreen->devPrivate = (void *)pScrInitParms; return TRUE; } Bool miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, rootDepth, numDepths, depths, rootVisual, numVisuals, visuals) register ScreenPtr pScreen; void * pbits; /* pointer to screen bits */ int xsize, ysize; /* in pixels */ int dpix, dpiy; /* dots per inch */ int width; /* pixel width of frame buffer */ int rootDepth; /* depth of root window */ int numDepths; /* number of depths supported */ DepthRec *depths; /* supported depths */ VisualID rootVisual; /* root visual */ int numVisuals; /* number of visuals supported */ VisualRec *visuals; /* supported visuals */ { pScreen->width = xsize; pScreen->height = ysize; pScreen->mmWidth = (xsize * 254 + dpix * 5) / (dpix * 10); pScreen->mmHeight = (ysize * 254 + dpiy * 5) / (dpiy * 10); pScreen->numDepths = numDepths; pScreen->rootDepth = rootDepth; pScreen->allowedDepths = depths; pScreen->rootVisual = rootVisual; /* defColormap */ pScreen->minInstalledCmaps = 1; pScreen->maxInstalledCmaps = 1; pScreen->backingStoreSupport = NotUseful; pScreen->saveUnderSupport = NotUseful; /* whitePixel, blackPixel */ pScreen->ModifyPixmapHeader = miModifyPixmapHeader; pScreen->CreateScreenResources = miCreateScreenResources; pScreen->GetScreenPixmap = miGetScreenPixmap; pScreen->SetScreenPixmap = miSetScreenPixmap; pScreen->numVisuals = numVisuals; pScreen->visuals = visuals; if (width) { #ifdef MITSHM ShmRegisterFbFuncs(pScreen); #endif pScreen->CloseScreen = miCloseScreen; } /* else CloseScreen */ /* QueryBestSize, SaveScreen, GetImage, GetSpans */ pScreen->PointerNonInterestBox = (PointerNonInterestBoxProcPtr) 0; pScreen->SourceValidate = (SourceValidateProcPtr) 0; /* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */ /* RealizeWindow, UnrealizeWindow */ pScreen->ValidateTree = miValidateTree; pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0; pScreen->WindowExposures = miWindowExposures; /* PaintWindowBackground, PaintWindowBorder, CopyWindow */ pScreen->ClearToBackground = miClearToBackground; pScreen->ClipNotify = (ClipNotifyProcPtr) 0; pScreen->RestackWindow = (RestackWindowProcPtr) 0; /* CreatePixmap, DestroyPixmap */ /* RealizeFont, UnrealizeFont */ /* CreateGC */ /* CreateColormap, DestroyColormap, InstallColormap, UninstallColormap */ /* ListInstalledColormaps, StoreColors, ResolveColor */ /* BitmapToRegion */ pScreen->SendGraphicsExpose = miSendGraphicsExpose; pScreen->BlockHandler = (ScreenBlockHandlerProcPtr)NoopDDA; pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr)NoopDDA; pScreen->blockData = (void *)0; pScreen->wakeupData = (void *)0; pScreen->MarkWindow = miMarkWindow; pScreen->MarkOverlappedWindows = miMarkOverlappedWindows; pScreen->ChangeSaveUnder = miChangeSaveUnder; pScreen->PostChangeSaveUnder = miPostChangeSaveUnder; pScreen->MoveWindow = miMoveWindow; pScreen->ResizeWindow = miSlideAndSizeWindow; pScreen->GetLayerWindow = miGetLayerWindow; pScreen->HandleExposures = miHandleValidateExposures; pScreen->ReparentWindow = (ReparentWindowProcPtr) 0; pScreen->ChangeBorderWidth = miChangeBorderWidth; #ifdef SHAPE pScreen->SetShape = miSetShape; #endif pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow; pScreen->SaveDoomedAreas = 0; pScreen->RestoreAreas = 0; pScreen->ExposeCopy = 0; pScreen->TranslateBackingStore = 0; pScreen->ClearBackingStore = 0; pScreen->DrawGuarantee = 0; miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS); return miScreenDevPrivateInit(pScreen, width, pbits); } int miAllocateGCPrivateIndex() { static int privateIndex = -1; static unsigned long miGeneration = 0; if (miGeneration != serverGeneration) { privateIndex = AllocateGCPrivateIndex(); miGeneration = serverGeneration; } return privateIndex; } int miZeroLineScreenIndex; unsigned int miZeroLineGeneration = 0; void miSetZeroLineBias(pScreen, bias) ScreenPtr pScreen; unsigned int bias; { if (miZeroLineGeneration != serverGeneration) { miZeroLineScreenIndex = AllocateScreenPrivateIndex(); miZeroLineGeneration = serverGeneration; } if (miZeroLineScreenIndex >= 0) pScreen->devPrivates[miZeroLineScreenIndex].uval = bias; } PixmapPtr miGetScreenPixmap(pScreen) ScreenPtr pScreen; { return (PixmapPtr)(pScreen->devPrivate); } void miSetScreenPixmap(pPix) PixmapPtr pPix; { if (pPix) pPix->drawable.pScreen->devPrivate = (void *)pPix; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mispans.c0000644000000000000000000003451213614532331017023 0ustar /*********************************************************** Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "misc.h" #include "pixmapstr.h" #include "gcstruct.h" #include "mispans.h" /* These routines maintain lists of Spans, in order to implement the ``touch-each-pixel-once'' rules of wide lines and arcs. Written by Joel McCormack, Summer 1989. */ void miInitSpanGroup(spanGroup) SpanGroup *spanGroup; { spanGroup->size = 0; spanGroup->count = 0; spanGroup->group = NULL; spanGroup->ymin = MAXSHORT; spanGroup->ymax = MINSHORT; } /* InitSpanGroup */ #define YMIN(spans) (spans->points[0].y) #define YMAX(spans) (spans->points[spans->count-1].y) void miSubtractSpans (spanGroup, sub) SpanGroup *spanGroup; Spans *sub; { int i, subCount, spansCount; int ymin, ymax, xmin, xmax; Spans *spans; DDXPointPtr subPt, spansPt; int *subWid, *spansWid; int extra; ymin = YMIN(sub); ymax = YMAX(sub); spans = spanGroup->group; for (i = spanGroup->count; i; i--, spans++) { if (YMIN(spans) <= ymax && ymin <= YMAX(spans)) { subCount = sub->count; subPt = sub->points; subWid = sub->widths; spansCount = spans->count; spansPt = spans->points; spansWid = spans->widths; extra = 0; for (;;) { while (spansCount && spansPt->y < subPt->y) { spansPt++; spansWid++; spansCount--; } if (!spansCount) break; while (subCount && subPt->y < spansPt->y) { subPt++; subWid++; subCount--; } if (!subCount) break; if (subPt->y == spansPt->y) { xmin = subPt->x; xmax = xmin + *subWid; if (xmin >= spansPt->x + *spansWid || spansPt->x >= xmax) { ; } else if (xmin <= spansPt->x) { if (xmax >= spansPt->x + *spansWid) { memmove (spansPt, spansPt + 1, sizeof *spansPt * (spansCount - 1)); memmove (spansWid, spansWid + 1, sizeof *spansWid * (spansCount - 1)); spansPt--; spansWid--; spans->count--; extra++; } else { *spansWid = *spansWid - (xmax - spansPt->x); spansPt->x = xmax; } } else { if (xmax >= spansPt->x + *spansWid) { *spansWid = xmin - spansPt->x; } else { if (!extra) { DDXPointPtr newPt; int *newwid; #define EXTRA 8 newPt = (DDXPointPtr) realloc (spans->points, (spans->count + EXTRA) * sizeof (DDXPointRec)); if (!newPt) break; spansPt = newPt + (spansPt - spans->points); spans->points = newPt; newwid = (int *) realloc (spans->widths, (spans->count + EXTRA) * sizeof (int)); if (!newwid) break; spansWid = newwid + (spansWid - spans->widths); spans->widths = newwid; extra = EXTRA; } memmove (spansPt + 1, spansPt, sizeof *spansPt * (spansCount)); memmove (spansWid + 1, spansWid, sizeof *spansWid * (spansCount)); spans->count++; extra--; *spansWid = xmin - spansPt->x; spansWid++; spansPt++; *spansWid = *spansWid - (xmax - spansPt->x); spansPt->x = xmax; } } } spansPt++; spansWid++; spansCount--; } } } } void miAppendSpans(spanGroup, otherGroup, spans) SpanGroup *spanGroup; SpanGroup *otherGroup; Spans *spans; { register int ymin, ymax; register int spansCount; spansCount = spans->count; if (spansCount > 0) { if (spanGroup->size == spanGroup->count) { spanGroup->size = (spanGroup->size + 8) * 2; spanGroup->group = (Spans *) realloc(spanGroup->group, sizeof(Spans) * spanGroup->size); } spanGroup->group[spanGroup->count] = *spans; (spanGroup->count)++; ymin = spans->points[0].y; if (ymin < spanGroup->ymin) spanGroup->ymin = ymin; ymax = spans->points[spansCount - 1].y; if (ymax > spanGroup->ymax) spanGroup->ymax = ymax; if (otherGroup && otherGroup->ymin < ymax && ymin < otherGroup->ymax) { miSubtractSpans (otherGroup, spans); } } else { free (spans->points); free (spans->widths); } } /* AppendSpans */ void miFreeSpanGroup(spanGroup) SpanGroup *spanGroup; { if (spanGroup->group != NULL) free(spanGroup->group); } static void QuickSortSpansX( register DDXPointRec points[], register int widths[], register int numSpans ) { register int x; register int i, j, m; register DDXPointPtr r; /* Always called with numSpans > 1 */ /* Sorts only by x, as all y should be the same */ #define ExchangeSpans(a, b) \ { \ DDXPointRec tpt; \ register int tw; \ \ tpt = points[a]; points[a] = points[b]; points[b] = tpt; \ tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \ } do { if (numSpans < 9) { /* Do insertion sort */ register int xprev; xprev = points[0].x; i = 1; do { /* while i != numSpans */ x = points[i].x; if (xprev > x) { /* points[i] is out of order. Move into proper location. */ DDXPointRec tpt; int tw, k; for (j = 0; x >= points[j].x; j++) {} tpt = points[i]; tw = widths[i]; for (k = i; k != j; k--) { points[k] = points[k-1]; widths[k] = widths[k-1]; } points[j] = tpt; widths[j] = tw; x = points[i].x; } /* if out of order */ xprev = x; i++; } while (i != numSpans); return; } /* Choose partition element, stick in location 0 */ m = numSpans / 2; if (points[m].x > points[0].x) ExchangeSpans(m, 0); if (points[m].x > points[numSpans-1].x) ExchangeSpans(m, numSpans-1); if (points[m].x > points[0].x) ExchangeSpans(m, 0); x = points[0].x; /* Partition array */ i = 0; j = numSpans; do { r = &(points[i]); do { r++; i++; } while (i != numSpans && r->x < x); r = &(points[j]); do { r--; j--; } while (x < r->x); if (i < j) ExchangeSpans(i, j); } while (i < j); /* Move partition element back to middle */ ExchangeSpans(0, j); /* Recurse */ if (numSpans-j-1 > 1) QuickSortSpansX(&points[j+1], &widths[j+1], numSpans-j-1); numSpans = j; } while (numSpans > 1); } /* QuickSortSpans */ static int UniquifySpansX( Spans *spans, register DDXPointRec *newPoints, register int *newWidths ) { register int newx1, newx2, oldpt, i, y; register DDXPointRec *oldPoints; register int *oldWidths; int *startNewWidths; /* Always called with numSpans > 1 */ /* Uniquify the spans, and stash them into newPoints and newWidths. Return the number of unique spans. */ startNewWidths = newWidths; oldPoints = spans->points; oldWidths = spans->widths; y = oldPoints->y; newx1 = oldPoints->x; newx2 = newx1 + *oldWidths; for (i = spans->count-1; i != 0; i--) { oldPoints++; oldWidths++; oldpt = oldPoints->x; if (oldpt > newx2) { /* Write current span, start a new one */ newPoints->x = newx1; newPoints->y = y; *newWidths = newx2 - newx1; newPoints++; newWidths++; newx1 = oldpt; newx2 = oldpt + *oldWidths; } else { /* extend current span, if old extends beyond new */ oldpt = oldpt + *oldWidths; if (oldpt > newx2) newx2 = oldpt; } } /* for */ /* Write final span */ newPoints->x = newx1; *newWidths = newx2 - newx1; newPoints->y = y; return (newWidths - startNewWidths) + 1; } /* UniquifySpansX */ void miDisposeSpanGroup (spanGroup) SpanGroup *spanGroup; { int i; Spans *spans; for (i = 0; i < spanGroup->count; i++) { spans = spanGroup->group + i; free (spans->points); free (spans->widths); } } void miFillUniqueSpanGroup(pDraw, pGC, spanGroup) DrawablePtr pDraw; GCPtr pGC; SpanGroup *spanGroup; { register int i; register Spans *spans; register Spans *yspans; register int *ysizes; register int ymin, ylength; /* Outgoing spans for one big call to FillSpans */ register DDXPointPtr points; register int *widths; register int count; if (spanGroup->count == 0) return; if (spanGroup->count == 1) { /* Already should be sorted, unique */ spans = spanGroup->group; (*pGC->ops->FillSpans) (pDraw, pGC, spans->count, spans->points, spans->widths, TRUE); free(spans->points); free(spans->widths); } else { /* Yuck. Gross. Radix sort into y buckets, then sort x and uniquify */ /* This seems to be the fastest thing to do. I've tried sorting on both x and y at the same time rather than creating into all those y buckets, but it was somewhat slower. */ ymin = spanGroup->ymin; ylength = spanGroup->ymax - ymin + 1; /* Allocate Spans for y buckets */ yspans = (Spans *) malloc(ylength * sizeof(Spans)); ysizes = (int *) malloc(ylength * sizeof (int)); if (!yspans || !ysizes) { if (yspans) free (yspans); if (ysizes) free (ysizes); miDisposeSpanGroup (spanGroup); return; } for (i = 0; i != ylength; i++) { ysizes[i] = 0; yspans[i].count = 0; yspans[i].points = NULL; yspans[i].widths = NULL; } /* Go through every single span and put it into the correct bucket */ count = 0; for (i = 0, spans = spanGroup->group; i != spanGroup->count; i++, spans++) { int index; int j; for (j = 0, points = spans->points, widths = spans->widths; j != spans->count; j++, points++, widths++) { index = points->y - ymin; if (index >= 0 && index < ylength) { Spans *newspans = &(yspans[index]); if (newspans->count == ysizes[index]) { DDXPointPtr newpoints; int *newwidths; ysizes[index] = (ysizes[index] + 8) * 2; newpoints = (DDXPointPtr) realloc( newspans->points, ysizes[index] * sizeof(DDXPointRec)); newwidths = (int *) realloc( newspans->widths, ysizes[index] * sizeof(int)); if (!newpoints || !newwidths) { int k; for (k = 0; k < ylength; k++) { free (yspans[k].points); free (yspans[k].widths); } free (yspans); free (ysizes); miDisposeSpanGroup (spanGroup); return; } newspans->points = newpoints; newspans->widths = newwidths; } newspans->points[newspans->count] = *points; newspans->widths[newspans->count] = *widths; (newspans->count)++; } /* if y value of span in range */ } /* for j through spans */ count += spans->count; free(spans->points); spans->points = NULL; free(spans->widths); spans->widths = NULL; } /* for i thorough Spans */ /* Now sort by x and uniquify each bucket into the final array */ points = (DDXPointPtr) malloc(count * sizeof(DDXPointRec)); widths = (int *) malloc(count * sizeof(int)); if (!points || !widths) { for (i = 0; i < ylength; i++) { free (yspans[i].points); free (yspans[i].widths); } free (yspans); free (ysizes); if (points) free (points); if (widths) free (widths); return; } count = 0; for (i = 0; i != ylength; i++) { int ycount = yspans[i].count; if (ycount > 0) { if (ycount > 1) { QuickSortSpansX(yspans[i].points, yspans[i].widths, ycount); count += UniquifySpansX (&(yspans[i]), &(points[count]), &(widths[count])); } else { points[count] = yspans[i].points[0]; widths[count] = yspans[i].widths[0]; count++; } free(yspans[i].points); free(yspans[i].widths); } } (*pGC->ops->FillSpans) (pDraw, pGC, count, points, widths, TRUE); free(points); free(widths); free(yspans); free(ysizes); } spanGroup->count = 0; spanGroup->ymin = MAXSHORT; spanGroup->ymax = MINSHORT; } void miFillSpanGroup(pDraw, pGC, spanGroup) DrawablePtr pDraw; GCPtr pGC; SpanGroup *spanGroup; { register int i; register Spans *spans; for (i = 0, spans = spanGroup->group; i != spanGroup->count; i++, spans++) { (*pGC->ops->FillSpans) (pDraw, pGC, spans->count, spans->points, spans->widths, TRUE); free(spans->points); free(spans->widths); } spanGroup->count = 0; spanGroup->ymin = MAXSHORT; spanGroup->ymax = MINSHORT; } /* FillSpanGroup */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mispans.h0000644000000000000000000000772613614532331017037 0ustar /*********************************************************** Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ typedef struct { int count; /* number of spans */ DDXPointPtr points; /* pointer to list of start points */ int *widths; /* pointer to list of widths */ } Spans; typedef struct { int size; /* Total number of *Spans allocated */ int count; /* Number of *Spans actually in group */ Spans *group; /* List of Spans */ int ymin, ymax; /* Min, max y values encountered */ } SpanGroup; /* Initialize SpanGroup. MUST BE DONE before use. */ extern void miInitSpanGroup( SpanGroup * /*spanGroup*/ ); /* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */ extern void miAppendSpans( SpanGroup * /*spanGroup*/, SpanGroup * /*otherGroup*/, Spans * /*spans*/ ); /* Paint a span group, possibly with some overlap */ extern void miFillSpanGroup( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, SpanGroup * /*spanGroup*/ ); /* Paint a span group, insuring that each pixel is painted at most once */ extern void miFillUniqueSpanGroup( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, SpanGroup * /*spanGroup*/ ); /* Free up data in a span group. MUST BE DONE or you'll suffer memory leaks */ extern void miFreeSpanGroup( SpanGroup * /*spanGroup*/ ); extern void miSubtractSpans( SpanGroup * /*spanGroup*/, Spans * /*sub*/ ); extern void miDisposeSpanGroup( SpanGroup * /*spanGroup*/ ); extern int RegionClipSpans( RegionPtr /*prgnDst*/, DDXPointPtr /*ppt*/, int * /*pwidth*/, int /*nspans*/, DDXPointPtr /*pptNew*/, int * /*pwidthNew*/, int /*fSorted*/ ); /* Rops which must use span groups */ #define miSpansCarefulRop(rop) (((rop) & 0xc) == 0x8 || ((rop) & 0x3) == 0x2) #define miSpansEasyRop(rop) (!miSpansCarefulRop(rop)) nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/misprite.c0000644000000000000000000005513213614532331017206 0ustar /* * misprite.c * * machine independent software sprite routines */ /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif # include # include # include "misc.h" # include "pixmapstr.h" # include "input.h" # include "mi.h" # include "cursorstr.h" # include # include "scrnintstr.h" # include "colormapst.h" # include "windowstr.h" # include "gcstruct.h" # include "mipointer.h" # include "mispritest.h" # include "dixfontstr.h" # include #ifdef RENDER # include "mipict.h" #endif # include "damage.h" #define SPRITE_DEBUG_ENABLE 0 #if SPRITE_DEBUG_ENABLE #define SPRITE_DEBUG(x) ErrorF x #else #define SPRITE_DEBUG(x) #endif /* * screen wrappers */ static int miSpriteScreenIndex; static unsigned long miSpriteGeneration = 0; static Bool miSpriteCloseScreen(ScreenPtr pScreen); static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planemask, char *pdstLine); static void miSpriteGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart); static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y, int width, int height); static void miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc); static void miSpriteBlockHandler(int i, void * blockData, void * pTimeout, void * pReadMask); static void miSpriteInstallColormap(ColormapPtr pMap); static void miSpriteStoreColors(ColormapPtr pMap, int ndef, xColorItem *pdef); static void miSpriteSaveDoomedAreas(WindowPtr pWin, RegionPtr pObscured, int dx, int dy); static void miSpriteComputeSaved(ScreenPtr pScreen); #define SCREEN_PROLOGUE(pScreen, field)\ ((pScreen)->field = \ ((miSpriteScreenPtr) (pScreen)->devPrivates[miSpriteScreenIndex].ptr)->field) #define SCREEN_EPILOGUE(pScreen, field)\ ((pScreen)->field = miSprite##field) /* * pointer-sprite method table */ static Bool miSpriteRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); static Bool miSpriteUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); static void miSpriteSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y); static void miSpriteMoveCursor(ScreenPtr pScreen, int x, int y); miPointerSpriteFuncRec miSpritePointerFuncs = { miSpriteRealizeCursor, miSpriteUnrealizeCursor, miSpriteSetCursor, miSpriteMoveCursor, }; /* * other misc functions */ static void miSpriteRemoveCursor(ScreenPtr pScreen); static void miSpriteRestoreCursor(ScreenPtr pScreen); static void miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure) { ScreenPtr pScreen = closure; miSpriteScreenPtr pScreenPriv; pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pScreenPriv->isUp && RegionContainsRect(pRegion, &pScreenPriv->saved) != rgnOUT) { SPRITE_DEBUG(("Damage remove\n")); miSpriteRemoveCursor (pScreen); } } /* * miSpriteInitialize -- called from device-dependent screen * initialization proc after all of the function pointers have * been stored in the screen structure. */ Bool miSpriteInitialize (pScreen, cursorFuncs, screenFuncs) ScreenPtr pScreen; miSpriteCursorFuncPtr cursorFuncs; miPointerScreenFuncPtr screenFuncs; { miSpriteScreenPtr pScreenPriv; VisualPtr pVisual; if (!DamageSetup (pScreen)) return FALSE; if (miSpriteGeneration != serverGeneration) { miSpriteScreenIndex = AllocateScreenPrivateIndex (); if (miSpriteScreenIndex < 0) return FALSE; miSpriteGeneration = serverGeneration; } pScreenPriv = (miSpriteScreenPtr) malloc (sizeof (miSpriteScreenRec)); if (!pScreenPriv) return FALSE; pScreenPriv->pDamage = DamageCreate (miSpriteReportDamage, (DamageDestroyFunc) 0, DamageReportRawRegion, TRUE, pScreen, (void *) pScreen); if (!miPointerInitialize (pScreen, &miSpritePointerFuncs, screenFuncs,TRUE)) { free ((void *) pScreenPriv); return FALSE; } for (pVisual = pScreen->visuals; pVisual->vid != pScreen->rootVisual; pVisual++) ; pScreenPriv->pVisual = pVisual; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreenPriv->GetImage = pScreen->GetImage; pScreenPriv->GetSpans = pScreen->GetSpans; pScreenPriv->SourceValidate = pScreen->SourceValidate; pScreenPriv->CopyWindow = pScreen->CopyWindow; pScreenPriv->SaveDoomedAreas = pScreen->SaveDoomedAreas; pScreenPriv->InstallColormap = pScreen->InstallColormap; pScreenPriv->StoreColors = pScreen->StoreColors; pScreenPriv->BlockHandler = pScreen->BlockHandler; pScreenPriv->pCursor = NULL; pScreenPriv->x = 0; pScreenPriv->y = 0; pScreenPriv->isUp = FALSE; pScreenPriv->shouldBeUp = FALSE; pScreenPriv->pCacheWin = NullWindow; pScreenPriv->isInCacheWin = FALSE; pScreenPriv->checkPixels = TRUE; pScreenPriv->pInstalledMap = NULL; pScreenPriv->pColormap = NULL; pScreenPriv->funcs = cursorFuncs; pScreenPriv->colors[SOURCE_COLOR].red = 0; pScreenPriv->colors[SOURCE_COLOR].green = 0; pScreenPriv->colors[SOURCE_COLOR].blue = 0; pScreenPriv->colors[MASK_COLOR].red = 0; pScreenPriv->colors[MASK_COLOR].green = 0; pScreenPriv->colors[MASK_COLOR].blue = 0; pScreen->devPrivates[miSpriteScreenIndex].ptr = (void *) pScreenPriv; pScreen->CloseScreen = miSpriteCloseScreen; pScreen->GetImage = miSpriteGetImage; pScreen->GetSpans = miSpriteGetSpans; pScreen->SourceValidate = miSpriteSourceValidate; pScreen->CopyWindow = miSpriteCopyWindow; pScreen->SaveDoomedAreas = miSpriteSaveDoomedAreas; pScreen->InstallColormap = miSpriteInstallColormap; pScreen->StoreColors = miSpriteStoreColors; pScreen->BlockHandler = miSpriteBlockHandler; return TRUE; } /* * Screen wrappers */ /* * CloseScreen wrapper -- unwrap everything, free the private data * and call the wrapped function */ static Bool miSpriteCloseScreen (pScreen) ScreenPtr pScreen; { miSpriteScreenPtr pScreenPriv; pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->GetImage = pScreenPriv->GetImage; pScreen->GetSpans = pScreenPriv->GetSpans; pScreen->SourceValidate = pScreenPriv->SourceValidate; pScreen->BlockHandler = pScreenPriv->BlockHandler; pScreen->InstallColormap = pScreenPriv->InstallColormap; pScreen->StoreColors = pScreenPriv->StoreColors; pScreen->SaveDoomedAreas = pScreenPriv->SaveDoomedAreas; miSpriteIsUpFALSE (pScreen, pScreenPriv); DamageDestroy (pScreenPriv->pDamage); free ((void *) pScreenPriv); return (*pScreen->CloseScreen) (pScreen); } static void miSpriteGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine) DrawablePtr pDrawable; int sx, sy, w, h; unsigned int format; unsigned long planemask; char *pdstLine; { ScreenPtr pScreen = pDrawable->pScreen; miSpriteScreenPtr pScreenPriv; SCREEN_PROLOGUE (pScreen, GetImage); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pDrawable->type == DRAWABLE_WINDOW && pScreenPriv->isUp && ORG_OVERLAP(&pScreenPriv->saved,pDrawable->x,pDrawable->y, sx, sy, w, h)) { SPRITE_DEBUG (("GetImage remove\n")); miSpriteRemoveCursor (pScreen); } (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); SCREEN_EPILOGUE (pScreen, GetImage); } static void miSpriteGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart) DrawablePtr pDrawable; int wMax; DDXPointPtr ppt; int *pwidth; int nspans; char *pdstStart; { ScreenPtr pScreen = pDrawable->pScreen; miSpriteScreenPtr pScreenPriv; SCREEN_PROLOGUE (pScreen, GetSpans); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pDrawable->type == DRAWABLE_WINDOW && pScreenPriv->isUp) { register DDXPointPtr pts; register int *widths; register int nPts; register int xorg, yorg; xorg = pDrawable->x; yorg = pDrawable->y; for (pts = ppt, widths = pwidth, nPts = nspans; nPts--; pts++, widths++) { if (SPN_OVERLAP(&pScreenPriv->saved,pts->y+yorg, pts->x+xorg,*widths)) { SPRITE_DEBUG (("GetSpans remove\n")); miSpriteRemoveCursor (pScreen); break; } } } (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); SCREEN_EPILOGUE (pScreen, GetSpans); } static void miSpriteSourceValidate (pDrawable, x, y, width, height) DrawablePtr pDrawable; int x, y, width, height; { ScreenPtr pScreen = pDrawable->pScreen; miSpriteScreenPtr pScreenPriv; SCREEN_PROLOGUE (pScreen, SourceValidate); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pDrawable->type == DRAWABLE_WINDOW && pScreenPriv->isUp && ORG_OVERLAP(&pScreenPriv->saved, pDrawable->x, pDrawable->y, x, y, width, height)) { SPRITE_DEBUG (("SourceValidate remove\n")); miSpriteRemoveCursor (pScreen); } if (pScreen->SourceValidate) (*pScreen->SourceValidate) (pDrawable, x, y, width, height); SCREEN_EPILOGUE (pScreen, SourceValidate); } static void miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWindow->drawable.pScreen; miSpriteScreenPtr pScreenPriv; SCREEN_PROLOGUE (pScreen, CopyWindow); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; /* * Damage will take care of destination check */ if (pScreenPriv->isUp && RegionContainsRect(prgnSrc, &pScreenPriv->saved) != rgnOUT) { SPRITE_DEBUG (("CopyWindow remove\n")); miSpriteRemoveCursor (pScreen); } (*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc); SCREEN_EPILOGUE (pScreen, CopyWindow); } static void miSpriteBlockHandler (i, blockData, pTimeout, pReadmask) int i; void * blockData; void * pTimeout; void * pReadmask; { ScreenPtr pScreen = screenInfo.screens[i]; miSpriteScreenPtr pPriv; pPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; SCREEN_PROLOGUE(pScreen, BlockHandler); (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); SCREEN_EPILOGUE(pScreen, BlockHandler); if (!pPriv->isUp && pPriv->shouldBeUp) { SPRITE_DEBUG (("BlockHandler restore\n")); miSpriteRestoreCursor (pScreen); } } static void miSpriteInstallColormap (pMap) ColormapPtr pMap; { ScreenPtr pScreen = pMap->pScreen; miSpriteScreenPtr pPriv; pPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; SCREEN_PROLOGUE(pScreen, InstallColormap); (*pScreen->InstallColormap) (pMap); SCREEN_EPILOGUE(pScreen, InstallColormap); pPriv->pInstalledMap = pMap; if (pPriv->pColormap != pMap) { pPriv->checkPixels = TRUE; if (pPriv->isUp) miSpriteRemoveCursor (pScreen); } } static void miSpriteStoreColors (pMap, ndef, pdef) ColormapPtr pMap; int ndef; xColorItem *pdef; { ScreenPtr pScreen = pMap->pScreen; miSpriteScreenPtr pPriv; int i; int updated; VisualPtr pVisual; pPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; SCREEN_PROLOGUE(pScreen, StoreColors); (*pScreen->StoreColors) (pMap, ndef, pdef); SCREEN_EPILOGUE(pScreen, StoreColors); if (pPriv->pColormap == pMap) { updated = 0; pVisual = pMap->pVisual; if (pVisual->class == DirectColor) { /* Direct color - match on any of the subfields */ #define MaskMatch(a,b,mask) (((a) & (pVisual->mask)) == ((b) & (pVisual->mask))) #define UpdateDAC(plane,dac,mask) {\ if (MaskMatch (pPriv->colors[plane].pixel,pdef[i].pixel,mask)) {\ pPriv->colors[plane].dac = pdef[i].dac; \ updated = 1; \ } \ } #define CheckDirect(plane) \ UpdateDAC(plane,red,redMask) \ UpdateDAC(plane,green,greenMask) \ UpdateDAC(plane,blue,blueMask) for (i = 0; i < ndef; i++) { CheckDirect (SOURCE_COLOR) CheckDirect (MASK_COLOR) } } else { /* PseudoColor/GrayScale - match on exact pixel */ for (i = 0; i < ndef; i++) { if (pdef[i].pixel == pPriv->colors[SOURCE_COLOR].pixel) { pPriv->colors[SOURCE_COLOR] = pdef[i]; if (++updated == 2) break; } if (pdef[i].pixel == pPriv->colors[MASK_COLOR].pixel) { pPriv->colors[MASK_COLOR] = pdef[i]; if (++updated == 2) break; } } } if (updated) { pPriv->checkPixels = TRUE; if (pPriv->isUp) miSpriteRemoveCursor (pScreen); } } } static void miSpriteFindColors (ScreenPtr pScreen) { miSpriteScreenPtr pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; CursorPtr pCursor; xColorItem *sourceColor, *maskColor; pCursor = pScreenPriv->pCursor; sourceColor = &pScreenPriv->colors[SOURCE_COLOR]; maskColor = &pScreenPriv->colors[MASK_COLOR]; if (pScreenPriv->pColormap != pScreenPriv->pInstalledMap || !(pCursor->foreRed == sourceColor->red && pCursor->foreGreen == sourceColor->green && pCursor->foreBlue == sourceColor->blue && pCursor->backRed == maskColor->red && pCursor->backGreen == maskColor->green && pCursor->backBlue == maskColor->blue)) { pScreenPriv->pColormap = pScreenPriv->pInstalledMap; sourceColor->red = pCursor->foreRed; sourceColor->green = pCursor->foreGreen; sourceColor->blue = pCursor->foreBlue; FakeAllocColor (pScreenPriv->pColormap, sourceColor); maskColor->red = pCursor->backRed; maskColor->green = pCursor->backGreen; maskColor->blue = pCursor->backBlue; FakeAllocColor (pScreenPriv->pColormap, maskColor); /* "free" the pixels right away, don't let this confuse you */ FakeFreeColor(pScreenPriv->pColormap, sourceColor->pixel); FakeFreeColor(pScreenPriv->pColormap, maskColor->pixel); } pScreenPriv->checkPixels = FALSE; } /* * BackingStore wrappers */ static void miSpriteSaveDoomedAreas (pWin, pObscured, dx, dy) WindowPtr pWin; RegionPtr pObscured; int dx, dy; { ScreenPtr pScreen; miSpriteScreenPtr pScreenPriv; BoxRec cursorBox; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, SaveDoomedAreas); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pScreenPriv->isUp) { cursorBox = pScreenPriv->saved; if (dx || dy) { cursorBox.x1 += dx; cursorBox.y1 += dy; cursorBox.x2 += dx; cursorBox.y2 += dy; } if (RegionContainsRect(pObscured, &cursorBox) != rgnOUT) miSpriteRemoveCursor (pScreen); } (*pScreen->SaveDoomedAreas) (pWin, pObscured, dx, dy); SCREEN_EPILOGUE (pScreen, SaveDoomedAreas); } /* * miPointer interface routines */ #define SPRITE_PAD 8 static Bool miSpriteRealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { miSpriteScreenPtr pScreenPriv; pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pCursor == pScreenPriv->pCursor) pScreenPriv->checkPixels = TRUE; return (*pScreenPriv->funcs->RealizeCursor) (pScreen, pCursor); } static Bool miSpriteUnrealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { miSpriteScreenPtr pScreenPriv; pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; return (*pScreenPriv->funcs->UnrealizeCursor) (pScreen, pCursor); } static void miSpriteSetCursor (pScreen, pCursor, x, y) ScreenPtr pScreen; CursorPtr pCursor; int x; int y; { miSpriteScreenPtr pScreenPriv; pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (!pCursor) { pScreenPriv->shouldBeUp = FALSE; if (pScreenPriv->isUp) miSpriteRemoveCursor (pScreen); pScreenPriv->pCursor = 0; return; } pScreenPriv->shouldBeUp = TRUE; if (pScreenPriv->x == x && pScreenPriv->y == y && pScreenPriv->pCursor == pCursor && !pScreenPriv->checkPixels) { return; } pScreenPriv->x = x; pScreenPriv->y = y; pScreenPriv->pCacheWin = NullWindow; if (pScreenPriv->checkPixels || pScreenPriv->pCursor != pCursor) { pScreenPriv->pCursor = pCursor; miSpriteFindColors (pScreen); } if (pScreenPriv->isUp) { int sx, sy; /* * check to see if the old saved region * encloses the new sprite, in which case we use * the flicker-free MoveCursor primitive. */ sx = pScreenPriv->x - (int)pCursor->bits->xhot; sy = pScreenPriv->y - (int)pCursor->bits->yhot; if (sx + (int) pCursor->bits->width >= pScreenPriv->saved.x1 && sx < pScreenPriv->saved.x2 && sy + (int) pCursor->bits->height >= pScreenPriv->saved.y1 && sy < pScreenPriv->saved.y2 && (int) pCursor->bits->width + (2 * SPRITE_PAD) == pScreenPriv->saved.x2 - pScreenPriv->saved.x1 && (int) pCursor->bits->height + (2 * SPRITE_PAD) == pScreenPriv->saved.y2 - pScreenPriv->saved.y1 ) { DamageDrawInternal (pScreen, TRUE); miSpriteIsUpFALSE (pScreen, pScreenPriv); if (!(sx >= pScreenPriv->saved.x1 && sx + (int)pCursor->bits->width < pScreenPriv->saved.x2 && sy >= pScreenPriv->saved.y1 && sy + (int)pCursor->bits->height < pScreenPriv->saved.y2)) { int oldx1, oldy1, dx, dy; oldx1 = pScreenPriv->saved.x1; oldy1 = pScreenPriv->saved.y1; dx = oldx1 - (sx - SPRITE_PAD); dy = oldy1 - (sy - SPRITE_PAD); pScreenPriv->saved.x1 -= dx; pScreenPriv->saved.y1 -= dy; pScreenPriv->saved.x2 -= dx; pScreenPriv->saved.y2 -= dy; (void) (*pScreenPriv->funcs->ChangeSave) (pScreen, pScreenPriv->saved.x1, pScreenPriv->saved.y1, pScreenPriv->saved.x2 - pScreenPriv->saved.x1, pScreenPriv->saved.y2 - pScreenPriv->saved.y1, dx, dy); } (void) (*pScreenPriv->funcs->MoveCursor) (pScreen, pCursor, pScreenPriv->saved.x1, pScreenPriv->saved.y1, pScreenPriv->saved.x2 - pScreenPriv->saved.x1, pScreenPriv->saved.y2 - pScreenPriv->saved.y1, sx - pScreenPriv->saved.x1, sy - pScreenPriv->saved.y1, pScreenPriv->colors[SOURCE_COLOR].pixel, pScreenPriv->colors[MASK_COLOR].pixel); miSpriteIsUpTRUE (pScreen, pScreenPriv); DamageDrawInternal (pScreen, FALSE); } else { SPRITE_DEBUG (("SetCursor remove\n")); miSpriteRemoveCursor (pScreen); } } if (!pScreenPriv->isUp && pScreenPriv->pCursor) { SPRITE_DEBUG (("SetCursor restore\n")); miSpriteRestoreCursor (pScreen); } } static void miSpriteMoveCursor (pScreen, x, y) ScreenPtr pScreen; int x, y; { miSpriteScreenPtr pScreenPriv; pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; miSpriteSetCursor (pScreen, pScreenPriv->pCursor, x, y); } /* * undraw/draw cursor */ static void miSpriteRemoveCursor (pScreen) ScreenPtr pScreen; { miSpriteScreenPtr pScreenPriv; DamageDrawInternal (pScreen, TRUE); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; miSpriteIsUpFALSE (pScreen, pScreenPriv); pScreenPriv->pCacheWin = NullWindow; if (!(*pScreenPriv->funcs->RestoreUnderCursor) (pScreen, pScreenPriv->saved.x1, pScreenPriv->saved.y1, pScreenPriv->saved.x2 - pScreenPriv->saved.x1, pScreenPriv->saved.y2 - pScreenPriv->saved.y1)) { miSpriteIsUpTRUE (pScreen, pScreenPriv); } DamageDrawInternal (pScreen, FALSE); } /* * Called from the block handler, restores the cursor * before waiting for something to do. */ static void miSpriteRestoreCursor (pScreen) ScreenPtr pScreen; { miSpriteScreenPtr pScreenPriv; int x, y; CursorPtr pCursor; DamageDrawInternal (pScreen, TRUE); miSpriteComputeSaved (pScreen); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; pCursor = pScreenPriv->pCursor; x = pScreenPriv->x - (int)pCursor->bits->xhot; y = pScreenPriv->y - (int)pCursor->bits->yhot; if ((*pScreenPriv->funcs->SaveUnderCursor) (pScreen, pScreenPriv->saved.x1, pScreenPriv->saved.y1, pScreenPriv->saved.x2 - pScreenPriv->saved.x1, pScreenPriv->saved.y2 - pScreenPriv->saved.y1)) { if (pScreenPriv->checkPixels) miSpriteFindColors (pScreen); if ((*pScreenPriv->funcs->PutUpCursor) (pScreen, pCursor, x, y, pScreenPriv->colors[SOURCE_COLOR].pixel, pScreenPriv->colors[MASK_COLOR].pixel)) { miSpriteIsUpTRUE (pScreen, pScreenPriv); } } DamageDrawInternal (pScreen, FALSE); } /* * compute the desired area of the screen to save */ static void miSpriteComputeSaved (pScreen) ScreenPtr pScreen; { miSpriteScreenPtr pScreenPriv; int x, y, w, h; int wpad, hpad; CursorPtr pCursor; pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; pCursor = pScreenPriv->pCursor; x = pScreenPriv->x - (int)pCursor->bits->xhot; y = pScreenPriv->y - (int)pCursor->bits->yhot; w = pCursor->bits->width; h = pCursor->bits->height; wpad = SPRITE_PAD; hpad = SPRITE_PAD; pScreenPriv->saved.x1 = x - wpad; pScreenPriv->saved.y1 = y - hpad; pScreenPriv->saved.x2 = pScreenPriv->saved.x1 + w + wpad * 2; pScreenPriv->saved.y2 = pScreenPriv->saved.y1 + h + hpad * 2; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/misprite.h0000644000000000000000000000446313614532331017214 0ustar /* * misprite.h * * software-sprite/sprite drawing interface spec * * mi versions of these routines exist. */ /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ typedef struct { Bool (*RealizeCursor)( ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/ ); Bool (*UnrealizeCursor)( ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/ ); Bool (*PutUpCursor)( ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, int /*x*/, int /*y*/, unsigned long /*source*/, unsigned long /*mask*/ ); Bool (*SaveUnderCursor)( ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/ ); Bool (*RestoreUnderCursor)( ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/ ); Bool (*MoveCursor)( ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int /*dx*/, int /*dy*/, unsigned long /*source*/, unsigned long /*mask*/ ); Bool (*ChangeSave)( ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int /*dx*/, int /*dy*/ ); } miSpriteCursorFuncRec, *miSpriteCursorFuncPtr; extern Bool miSpriteInitialize( ScreenPtr /*pScreen*/, miSpriteCursorFuncPtr /*cursorFuncs*/, miPointerScreenFuncPtr /*screenFuncs*/ ); nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mispritest.h0000644000000000000000000000774613614532331017572 0ustar /* * mispritest.h * * mi sprite structures */ /* Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _MISPRITEST_H_ #define _MISPRITEST_H_ # include "misprite.h" #ifdef RENDER # include "picturestr.h" #endif # include "damage.h" /* * per screen information */ typedef struct { /* screen procedures */ CloseScreenProcPtr CloseScreen; GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; SourceValidateProcPtr SourceValidate; /* window procedures */ CopyWindowProcPtr CopyWindow; /* backing store procedures */ SaveDoomedAreasProcPtr SaveDoomedAreas; /* colormap procedures */ InstallColormapProcPtr InstallColormap; StoreColorsProcPtr StoreColors; /* os layer procedures */ ScreenBlockHandlerProcPtr BlockHandler; CursorPtr pCursor; int x; /* cursor hotspot */ int y; BoxRec saved; /* saved area from the screen */ Bool isUp; /* cursor in frame buffer */ Bool shouldBeUp; /* cursor should be displayed */ WindowPtr pCacheWin; /* window the cursor last seen in */ Bool isInCacheWin; Bool checkPixels; /* check colormap collision */ xColorItem colors[2]; ColormapPtr pInstalledMap; ColormapPtr pColormap; VisualPtr pVisual; miSpriteCursorFuncPtr funcs; DamagePtr pDamage; /* damage tracking structure */ } miSpriteScreenRec, *miSpriteScreenPtr; #define SOURCE_COLOR 0 #define MASK_COLOR 1 #define miSpriteIsUpTRUE(pScreen, pScreenPriv) if (!pScreenPriv->isUp) { \ pScreenPriv->isUp = TRUE; \ DamageRegister (&(*pScreen->GetScreenPixmap) (pScreen)->drawable, pScreenPriv->pDamage); \ } #define miSpriteIsUpFALSE(pScreen, pScreenPriv) if (pScreenPriv->isUp) { \ DamageUnregister (&(*pScreen->GetScreenPixmap) (pScreen)->drawable, pScreenPriv->pDamage); \ pScreenPriv->isUp = FALSE; \ } /* * Overlap BoxPtr and Box elements */ #define BOX_OVERLAP(pCbox,X1,Y1,X2,Y2) \ (((pCbox)->x1 <= (X2)) && ((X1) <= (pCbox)->x2) && \ ((pCbox)->y1 <= (Y2)) && ((Y1) <= (pCbox)->y2)) /* * Overlap BoxPtr, origins, and rectangle */ #define ORG_OVERLAP(pCbox,xorg,yorg,x,y,w,h) \ BOX_OVERLAP((pCbox),(x)+(xorg),(y)+(yorg),(x)+(xorg)+(w),(y)+(yorg)+(h)) /* * Overlap BoxPtr, origins and RectPtr */ #define ORGRECT_OVERLAP(pCbox,xorg,yorg,pRect) \ ORG_OVERLAP((pCbox),(xorg),(yorg),(pRect)->x,(pRect)->y, \ (int)((pRect)->width), (int)((pRect)->height)) /* * Overlap BoxPtr and horizontal span */ #define SPN_OVERLAP(pCbox,y,x,w) BOX_OVERLAP((pCbox),(x),(y),(x)+(w),(y)) #define LINE_SORT(x1,y1,x2,y2) \ { int _t; \ if (x1 > x2) { _t = x1; x1 = x2; x2 = _t; } \ if (y1 > y2) { _t = y1; y1 = y2; y2 = _t; } } #define LINE_OVERLAP(pCbox,x1,y1,x2,y2,lw2) \ BOX_OVERLAP((pCbox), (x1)-(lw2), (y1)-(lw2), (x2)+(lw2), (y2)+(lw2)) #endif /* _MISPRITEST_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mistruct.h0000644000000000000000000000521013614532331017221 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef MISTRUCT_H #define MISTRUCT_H #include "mi.h" #include "regionstr.h" /* information about dashes */ typedef struct _miDash { DDXPointRec pt; int e1, e2; /* keep these, so we don't have to do it again */ int e; /* bresenham error term for this point on line */ int which; int newLine;/* 0 if part of same original line as previous dash */ } miDashRec; #endif /* MISTRUCT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mivalidate.h0000644000000000000000000000331513614532331017472 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef MIVALIDATE_H #define MIVALIDATE_H #include "regionstr.h" typedef union _Validate { struct BeforeValidate { DDXPointRec oldAbsCorner; /* old window position */ RegionPtr borderVisible; /* visible region of border, */ /* non-null when size changes */ Bool resized; /* unclipped winSize has changed - */ /* don't call SaveDoomedAreas */ } before; struct AfterValidate { RegionRec exposed; /* exposed regions, absolute pos */ RegionRec borderExposed; } after; } ValidateRec; #endif /* MIVALIDATE_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mivaltree.c0000644000000000000000000005661113614532331017345 0ustar /* * mivaltree.c -- * Functions for recalculating window clip lists. Main function * is miValidateTree. * Copyright 1987, 1988, 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * * Copyright 1987, 1988, 1989 by * Digital Equipment Corporation, Maynard, Massachusetts, * * All Rights Reserved * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and that * both that copyright notice and this permission notice appear in * supporting documentation, and that the name of Digital not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. * * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * ******************************************************************/ /* The panoramix components contained the following notice */ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* * Aug '86: Susan Angebranndt -- original code * July '87: Adam de Boor -- substantially modified and commented * Summer '89: Joel McCormack -- so fast you wouldn't believe it possible. * In particular, much improved code for window mapping and * circulating. * Bob Scheifler -- avoid miComputeClips for unmapped windows, * valdata changes */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "scrnintstr.h" #include "validate.h" #include "windowstr.h" #include "mi.h" #include "regionstr.h" #include "mivalidate.h" #include "globals.h" #ifdef SHAPE /* * Compute the visibility of a shaped window */ int miShapedWindowIn (pScreen, universe, bounding, rect, x, y) ScreenPtr pScreen; RegionPtr universe, bounding; BoxPtr rect; register int x, y; { BoxRec box; register BoxPtr boundBox; int nbox; Bool someIn, someOut; register int t, x1, y1, x2, y2; nbox = RegionNumRects (bounding); boundBox = RegionRects (bounding); someIn = someOut = FALSE; x1 = rect->x1; y1 = rect->y1; x2 = rect->x2; y2 = rect->y2; while (nbox--) { if ((t = boundBox->x1 + x) < x1) t = x1; box.x1 = t; if ((t = boundBox->y1 + y) < y1) t = y1; box.y1 = t; if ((t = boundBox->x2 + x) > x2) t = x2; box.x2 = t; if ((t = boundBox->y2 + y) > y2) t = y2; box.y2 = t; if (box.x1 > box.x2) box.x2 = box.x1; if (box.y1 > box.y2) box.y2 = box.y1; switch (RegionContainsRect(universe, &box)) { case rgnIN: if (someOut) return rgnPART; someIn = TRUE; break; case rgnOUT: if (someIn) return rgnPART; someOut = TRUE; break; default: return rgnPART; } boundBox++; } if (someIn) return rgnIN; return rgnOUT; } #endif static GetRedirectBorderClipProcPtr miGetRedirectBorderClipProc; static SetRedirectBorderClipProcPtr miSetRedirectBorderClipProc; void miRegisterRedirectBorderClipProc (SetRedirectBorderClipProcPtr setBorderClip, GetRedirectBorderClipProcPtr getBorderClip) { miSetRedirectBorderClipProc = setBorderClip; miGetRedirectBorderClipProc = getBorderClip; } #define HasParentRelativeBorder(w) (!(w)->borderIsPixel && \ HasBorder(w) && \ (w)->backgroundState == ParentRelative) /* *----------------------------------------------------------------------- * miComputeClips -- * Recompute the clipList, borderClip, exposed and borderExposed * regions for pParent and its children. Only viewable windows are * taken into account. * * Results: * None. * * Side Effects: * clipList, borderClip, exposed and borderExposed are altered. * A VisibilityNotify event may be generated on the parent window. * *----------------------------------------------------------------------- */ static void miComputeClips ( register WindowPtr pParent, register ScreenPtr pScreen, register RegionPtr universe, VTKind kind, RegionPtr exposed ) /* for intermediate calculations */ { int dx, dy; RegionRec childUniverse; register WindowPtr pChild; int oldVis, newVis; BoxRec borderSize; RegionRec childUnion; Bool overlap; RegionPtr borderVisible; Bool resized; /* * Figure out the new visibility of this window. * The extent of the universe should be the same as the extent of * the borderSize region. If the window is unobscured, this rectangle * will be completely inside the universe (the universe will cover it * completely). If the window is completely obscured, none of the * universe will cover the rectangle. */ borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent); borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent); dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent); if (dx > 32767) dx = 32767; borderSize.x2 = dx; dy = (int) pParent->drawable.y + (int) pParent->drawable.height + wBorderWidth(pParent); if (dy > 32767) dy = 32767; borderSize.y2 = dy; #ifdef COMPOSITE /* * In redirected drawing case, reset universe to borderSize */ if (pParent->redirectDraw) { if (miSetRedirectBorderClipProc) (*miSetRedirectBorderClipProc) (pParent, universe); RegionCopy(universe, &pParent->borderSize); } #endif oldVis = pParent->visibility; switch (RegionContainsRect(universe, &borderSize)) { case rgnIN: newVis = VisibilityUnobscured; break; case rgnPART: newVis = VisibilityPartiallyObscured; #ifdef SHAPE { RegionPtr pBounding; if ((pBounding = wBoundingShape (pParent))) { switch (miShapedWindowIn (pScreen, universe, pBounding, &borderSize, pParent->drawable.x, pParent->drawable.y)) { case rgnIN: newVis = VisibilityUnobscured; break; case rgnOUT: newVis = VisibilityFullyObscured; break; } } } #endif break; default: newVis = VisibilityFullyObscured; break; } pParent->visibility = newVis; if (oldVis != newVis && ((pParent->eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask)) SendVisibilityNotify(pParent); dx = pParent->drawable.x - pParent->valdata->before.oldAbsCorner.x; dy = pParent->drawable.y - pParent->valdata->before.oldAbsCorner.y; /* * avoid computations when dealing with simple operations */ switch (kind) { case VTMap: case VTStack: case VTUnmap: break; case VTMove: if ((oldVis == newVis) && ((oldVis == VisibilityFullyObscured) || (oldVis == VisibilityUnobscured))) { pChild = pParent; while (1) { if (pChild->viewable) { if (pChild->visibility != VisibilityFullyObscured) { RegionTranslate(&pChild->borderClip, dx, dy); RegionTranslate(&pChild->clipList, dx, dy); pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pScreen->ClipNotify) (* pScreen->ClipNotify) (pChild, dx, dy); } if (pChild->valdata) { RegionNull( &pChild->valdata->after.borderExposed); if (HasParentRelativeBorder(pChild)) { RegionSubtract( &pChild->valdata->after.borderExposed, &pChild->borderClip, &pChild->winSize); } RegionNull(&pChild->valdata->after.exposed); } if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pParent)) pChild = pChild->parent; if (pChild == pParent) break; pChild = pChild->nextSib; } return; } /* fall through */ default: /* * To calculate exposures correctly, we have to translate the old * borderClip and clipList regions to the window's new location so there * is a correspondence between pieces of the new and old clipping regions. */ if (dx || dy) { /* * We translate the old clipList because that will be exposed or copied * if gravity is right. */ RegionTranslate(&pParent->borderClip, dx, dy); RegionTranslate(&pParent->clipList, dx, dy); } break; case VTBroken: RegionEmpty(&pParent->borderClip); RegionEmpty(&pParent->clipList); break; } borderVisible = pParent->valdata->before.borderVisible; resized = pParent->valdata->before.resized; RegionNull(&pParent->valdata->after.borderExposed); RegionNull(&pParent->valdata->after.exposed); /* * Since the borderClip must not be clipped by the children, we do * the border exposure first... * * 'universe' is the window's borderClip. To figure the exposures, remove * the area that used to be exposed from the new. * This leaves a region of pieces that weren't exposed before. */ if (HasBorder (pParent)) { if (borderVisible) { /* * when the border changes shape, the old visible portions * of the border will be saved by DIX in borderVisible -- * use that region and destroy it */ RegionSubtract(exposed, universe, borderVisible); RegionDestroy(borderVisible); } else { RegionSubtract(exposed, universe, &pParent->borderClip); } if (HasParentRelativeBorder(pParent) && (dx || dy)) RegionSubtract(&pParent->valdata->after.borderExposed, universe, &pParent->winSize); else RegionSubtract(&pParent->valdata->after.borderExposed, exposed, &pParent->winSize); RegionCopy(&pParent->borderClip, universe); /* * To get the right clipList for the parent, and to make doubly sure * that no child overlaps the parent's border, we remove the parent's * border from the universe before proceeding. */ RegionIntersect(universe, universe, &pParent->winSize); } else RegionCopy(&pParent->borderClip, universe); if ((pChild = pParent->firstChild) && pParent->mapped) { RegionNull(&childUniverse); RegionNull(&childUnion); if ((pChild->drawable.y < pParent->lastChild->drawable.y) || ((pChild->drawable.y == pParent->lastChild->drawable.y) && (pChild->drawable.x < pParent->lastChild->drawable.x))) { for (; pChild; pChild = pChild->nextSib) { if (pChild->viewable) RegionAppend(&childUnion, &pChild->borderSize); } } else { for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib) { if (pChild->viewable) RegionAppend(&childUnion, &pChild->borderSize); } } RegionValidate(&childUnion, &overlap); for (pChild = pParent->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->viewable) { /* * If the child is viewable, we want to remove its extents * from the current universe, but we only re-clip it if * it's been marked. */ if (pChild->valdata) { /* * Figure out the new universe from the child's * perspective and recurse. */ RegionIntersect(&childUniverse, universe, &pChild->borderSize); miComputeClips (pChild, pScreen, &childUniverse, kind, exposed); } /* * Once the child has been processed, we remove its extents * from the current universe, thus denying its space to any * other sibling. */ if (overlap) RegionSubtract(universe, universe, &pChild->borderSize); } } if (!overlap) RegionSubtract(universe, universe, &childUnion); RegionUninit(&childUnion); RegionUninit(&childUniverse); } /* if any children */ /* * 'universe' now contains the new clipList for the parent window. * * To figure the exposure of the window we subtract the old clip from the * new, just as for the border. */ if (oldVis == VisibilityFullyObscured || oldVis == VisibilityNotViewable) { RegionCopy(&pParent->valdata->after.exposed, universe); } else if (newVis != VisibilityFullyObscured && newVis != VisibilityNotViewable) { RegionSubtract(&pParent->valdata->after.exposed, universe, &pParent->clipList); } /* * One last thing: backing storage. We have to try to save what parts of * the window are about to be obscured. We can just subtract the universe * from the old clipList and get the areas that were in the old but aren't * in the new and, hence, are about to be obscured. */ if (pParent->backStorage && !resized) { RegionSubtract(exposed, &pParent->clipList, universe); (* pScreen->SaveDoomedAreas)(pParent, exposed, dx, dy); } /* HACK ALERT - copying contents of regions, instead of regions */ { RegionRec tmp; tmp = pParent->clipList; pParent->clipList = *universe; *universe = tmp; } #ifdef NOTDEF RegionCopy(&pParent->clipList, universe); #endif pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pScreen->ClipNotify) (* pScreen->ClipNotify) (pParent, dx, dy); } static void miTreeObscured( register WindowPtr pParent ) { register WindowPtr pChild; register int oldVis; pChild = pParent; while (1) { if (pChild->viewable) { oldVis = pChild->visibility; if (oldVis != (pChild->visibility = VisibilityFullyObscured) && ((pChild->eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask)) SendVisibilityNotify(pChild); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pParent)) pChild = pChild->parent; if (pChild == pParent) break; pChild = pChild->nextSib; } } /* *----------------------------------------------------------------------- * miValidateTree -- * Recomputes the clip list for pParent and all its inferiors. * * Results: * Always returns 1. * * Side Effects: * The clipList, borderClip, exposed, and borderExposed regions for * each marked window are altered. * * Notes: * This routine assumes that all affected windows have been marked * (valdata created) and their winSize and borderSize regions * adjusted to correspond to their new positions. The borderClip and * clipList regions should not have been touched. * * The top-most level is treated differently from all lower levels * because pParent is unchanged. For the top level, we merge the * regions taken up by the marked children back into the clipList * for pParent, thus forming a region from which the marked children * can claim their areas. For lower levels, where the old clipList * and borderClip are invalid, we can't do this and have to do the * extra operations done in miComputeClips, but this is much faster * e.g. when only one child has moved... * *----------------------------------------------------------------------- */ /*ARGSUSED*/ int miValidateTree (pParent, pChild, kind) WindowPtr pParent; /* Parent to validate */ WindowPtr pChild; /* First child of pParent that was * affected */ VTKind kind; /* What kind of configuration caused call */ { RegionRec totalClip; /* Total clipping region available to * the marked children. pParent's clipList * merged with the borderClips of all * the marked children. */ RegionRec childClip; /* The new borderClip for the current * child */ RegionRec childUnion; /* the space covered by borderSize for * all marked children */ RegionRec exposed; /* For intermediate calculations */ register ScreenPtr pScreen; register WindowPtr pWin; Bool overlap; int viewvals; Bool forward; pScreen = pParent->drawable.pScreen; if (pChild == NullWindow) pChild = pParent->firstChild; RegionNull(&childClip); RegionNull(&exposed); /* * compute the area of the parent window occupied * by the marked children + the parent itself. This * is the area which can be divied up among the marked * children in their new configuration. */ RegionNull(&totalClip); viewvals = 0; if (RegionBroken(&pParent->clipList) && !RegionBroken(&pParent->borderClip)) { kind = VTBroken; /* * When rebuilding clip lists after out of memory, * assume everything is busted. */ forward = TRUE; RegionCopy(&totalClip, &pParent->borderClip); RegionIntersect(&totalClip, &totalClip, &pParent->winSize); for (pWin = pParent->firstChild; pWin != pChild; pWin = pWin->nextSib) { if (pWin->viewable) RegionSubtract(&totalClip, &totalClip, &pWin->borderSize); } for (pWin = pChild; pWin; pWin = pWin->nextSib) if (pWin->valdata && pWin->viewable) viewvals++; RegionEmpty(&pParent->clipList); } else { if ((pChild->drawable.y < pParent->lastChild->drawable.y) || ((pChild->drawable.y == pParent->lastChild->drawable.y) && (pChild->drawable.x < pParent->lastChild->drawable.x))) { forward = TRUE; for (pWin = pChild; pWin; pWin = pWin->nextSib) { if (pWin->valdata) { RegionPtr pBorderClip = &pWin->borderClip; #ifdef COMPOSITE if (pWin->redirectDraw && miGetRedirectBorderClipProc) pBorderClip = (*miGetRedirectBorderClipProc)(pWin); #endif RegionAppend(&totalClip, pBorderClip ); if (pWin->viewable) viewvals++; } } } else { forward = FALSE; pWin = pParent->lastChild; while (1) { if (pWin->valdata) { RegionPtr pBorderClip = &pWin->borderClip; #ifdef COMPOSITE if (pWin->redirectDraw && miGetRedirectBorderClipProc) pBorderClip = (*miGetRedirectBorderClipProc)(pWin); #endif RegionAppend(&totalClip, pBorderClip ); if (pWin->viewable) viewvals++; } if (pWin == pChild) break; pWin = pWin->prevSib; } } RegionValidate(&totalClip, &overlap); } /* * Now go through the children of the root and figure their new * borderClips from the totalClip, passing that off to miComputeClips * to handle recursively. Once that's done, we remove the child * from the totalClip to clip any siblings below it. */ overlap = TRUE; if (kind != VTStack) { RegionUnion(&totalClip, &totalClip, &pParent->clipList); if (viewvals > 1) { /* * precompute childUnion to discover whether any of them * overlap. This seems redundant, but performance studies * have demonstrated that the cost of this loop is * lower than the cost of multiple Subtracts in the * loop below. */ RegionNull(&childUnion); if (forward) { for (pWin = pChild; pWin; pWin = pWin->nextSib) if (pWin->valdata && pWin->viewable) RegionAppend(&childUnion, &pWin->borderSize); } else { pWin = pParent->lastChild; while (1) { if (pWin->valdata && pWin->viewable) RegionAppend(&childUnion, &pWin->borderSize); if (pWin == pChild) break; pWin = pWin->prevSib; } } RegionValidate(&childUnion, &overlap); if (overlap) RegionUninit(&childUnion); } } for (pWin = pChild; pWin != NullWindow; pWin = pWin->nextSib) { if (pWin->viewable) { if (pWin->valdata) { RegionIntersect(&childClip, &totalClip, &pWin->borderSize); miComputeClips (pWin, pScreen, &childClip, kind, &exposed); if (overlap) { RegionSubtract(&totalClip, &totalClip, &pWin->borderSize); } } else if (pWin->visibility == VisibilityNotViewable) { miTreeObscured(pWin); } } else { if (pWin->valdata) { RegionEmpty(&pWin->clipList); if (pScreen->ClipNotify) (* pScreen->ClipNotify) (pWin, 0, 0); RegionEmpty(&pWin->borderClip); pWin->valdata = (ValidatePtr)NULL; } } } RegionUninit(&childClip); if (!overlap) { RegionSubtract(&totalClip, &totalClip, &childUnion); RegionUninit(&childUnion); } RegionNull(&pParent->valdata->after.exposed); RegionNull(&pParent->valdata->after.borderExposed); /* * each case below is responsible for updating the * clipList and serial number for the parent window */ switch (kind) { case VTStack: break; default: /* * totalClip contains the new clipList for the parent. Figure out * exposures and obscures as per miComputeClips and reset the parent's * clipList. */ RegionSubtract(&pParent->valdata->after.exposed, &totalClip, &pParent->clipList); /* fall through */ case VTMap: if (pParent->backStorage) { RegionSubtract(&exposed, &pParent->clipList, &totalClip); (* pScreen->SaveDoomedAreas)(pParent, &exposed, 0, 0); } RegionCopy(&pParent->clipList, &totalClip); pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; break; } RegionUninit(&totalClip); RegionUninit(&exposed); if (pScreen->ClipNotify) (*pScreen->ClipNotify) (pParent, 0, 0); return (1); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/miwideline.c0000644000000000000000000014101613614532331017475 0ustar /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* Author: Keith Packard, MIT X Consortium */ /* * Mostly integer wideline code. Uses a technique similar to * bresenham zero-width lines, except walks an X edge */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #ifdef _XOPEN_SOURCE #include #else #define _XOPEN_SOURCE /* to get prototype for hypot on some systems */ #include #undef _XOPEN_SOURCE #endif #include #include "windowstr.h" #include "gcstruct.h" #include "regionstr.h" #include "miwideline.h" #include "mi.h" #ifdef ICEILTEMPDECL ICEILTEMPDECL #endif static void miLineArc(DrawablePtr pDraw, register GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, register LineFacePtr leftFace, register LineFacePtr rightFace, double xorg, double yorg, Bool isInt); /* * spans-based polygon filler */ void miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height, left, right, left_count, right_count) DrawablePtr pDrawable; GCPtr pGC; unsigned long pixel; SpanDataPtr spanData; int y; /* start y coordinate */ int overall_height; /* height of entire segment */ PolyEdgePtr left, right; int left_count, right_count; { register int left_x = 0, left_e = 0; int left_stepx = 0; int left_signdx = 0; int left_dy = 0, left_dx = 0; register int right_x = 0, right_e = 0; int right_stepx = 0; int right_signdx = 0; int right_dy = 0, right_dx = 0; int height = 0; int left_height = 0, right_height = 0; register DDXPointPtr ppt; DDXPointPtr pptInit = NULL; register int *pwidth; int *pwidthInit = NULL; XID oldPixel; int xorg; Spans spanRec; left_height = 0; right_height = 0; if (!spanData) { pptInit = (DDXPointPtr) malloc (overall_height * sizeof(*ppt)); if (!pptInit) return; pwidthInit = (int *) malloc (overall_height * sizeof(*pwidth)); if (!pwidthInit) { free (pptInit); return; } ppt = pptInit; pwidth = pwidthInit; oldPixel = pGC->fgPixel; if (pixel != oldPixel) { XID tmpPixel = (XID)pixel; DoChangeGC (pGC, GCForeground, &tmpPixel, FALSE); ValidateGC (pDrawable, pGC); } } else { spanRec.points = (DDXPointPtr) malloc (overall_height * sizeof (*ppt)); if (!spanRec.points) return; spanRec.widths = (int *) malloc (overall_height * sizeof (int)); if (!spanRec.widths) { free (spanRec.points); return; } ppt = spanRec.points; pwidth = spanRec.widths; } xorg = 0; if (pGC->miTranslate) { y += pDrawable->y; xorg = pDrawable->x; } while ((left_count || left_height) && (right_count || right_height)) { MIPOLYRELOADLEFT MIPOLYRELOADRIGHT height = left_height; if (height > right_height) height = right_height; left_height -= height; right_height -= height; while (--height >= 0) { if (right_x >= left_x) { ppt->y = y; ppt->x = left_x + xorg; ppt++; *pwidth++ = right_x - left_x + 1; } y++; MIPOLYSTEPLEFT MIPOLYSTEPRIGHT } } if (!spanData) { (*pGC->ops->FillSpans) (pDrawable, pGC, ppt - pptInit, pptInit, pwidthInit, TRUE); free (pwidthInit); free (pptInit); if (pixel != oldPixel) { DoChangeGC (pGC, GCForeground, &oldPixel, FALSE); ValidateGC (pDrawable, pGC); } } else { spanRec.count = ppt - spanRec.points; AppendSpanGroup (pGC, pixel, &spanRec, spanData) } } static void miFillRectPolyHelper ( DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, int x, int y, int w, int h) { register DDXPointPtr ppt; register int *pwidth; XID oldPixel; Spans spanRec; xRectangle rect; if (!spanData) { rect.x = x; rect.y = y; rect.width = w; rect.height = h; oldPixel = pGC->fgPixel; if (pixel != oldPixel) { XID tmpPixel = (XID)pixel; DoChangeGC (pGC, GCForeground, &tmpPixel, FALSE); ValidateGC (pDrawable, pGC); } (*pGC->ops->PolyFillRect) (pDrawable, pGC, 1, &rect); if (pixel != oldPixel) { DoChangeGC (pGC, GCForeground, &oldPixel, FALSE); ValidateGC (pDrawable, pGC); } } else { spanRec.points = (DDXPointPtr) malloc (h * sizeof (*ppt)); if (!spanRec.points) return; spanRec.widths = (int *) malloc (h * sizeof (int)); if (!spanRec.widths) { free (spanRec.points); return; } ppt = spanRec.points; pwidth = spanRec.widths; if (pGC->miTranslate) { y += pDrawable->y; x += pDrawable->x; } while (h--) { ppt->x = x; ppt->y = y; ppt++; *pwidth++ = w; y++; } spanRec.count = ppt - spanRec.points; AppendSpanGroup (pGC, pixel, &spanRec, spanData) } } /* static */ int miPolyBuildEdge (x0, y0, k, dx, dy, xi, yi, left, edge) double x0, y0; double k; /* x0 * dy - y0 * dx */ register int dx, dy; int xi, yi; int left; register PolyEdgePtr edge; { int x, y, e; int xady; if (dy < 0) { dy = -dy; dx = -dx; k = -k; } #ifdef NOTDEF { double realk, kerror; realk = x0 * dy - y0 * dx; kerror = Fabs (realk - k); if (kerror > .1) printf ("realk: %g k: %g\n", realk, k); } #endif y = ICEIL (y0); xady = ICEIL (k) + y * dx; if (xady <= 0) x = - (-xady / dy) - 1; else x = (xady - 1) / dy; e = xady - x * dy; if (dx >= 0) { edge->signdx = 1; edge->stepx = dx / dy; edge->dx = dx % dy; } else { edge->signdx = -1; edge->stepx = - (-dx / dy); edge->dx = -dx % dy; e = dy - e + 1; } edge->dy = dy; edge->x = x + left + xi; edge->e = e - dy; /* bias to compare against 0 instead of dy */ return y + yi; } #define StepAround(v, incr, max) (((v) + (incr) < 0) ? (max - 1) : ((v) + (incr) == max) ? 0 : ((v) + (incr))) /* static */ int miPolyBuildPoly (vertices, slopes, count, xi, yi, left, right, pnleft, pnright, h) register PolyVertexPtr vertices; register PolySlopePtr slopes; int count; int xi, yi; PolyEdgePtr left, right; int *pnleft, *pnright; int *h; { int top, bottom; double miny, maxy; register int i; int j; int clockwise; int slopeoff; register int s; register int nright, nleft; int y, lasty = 0, bottomy, topy = 0; /* find the top of the polygon */ maxy = miny = vertices[0].y; bottom = top = 0; for (i = 1; i < count; i++) { if (vertices[i].y < miny) { top = i; miny = vertices[i].y; } if (vertices[i].y >= maxy) { bottom = i; maxy = vertices[i].y; } } clockwise = 1; slopeoff = 0; i = top; j = StepAround (top, -1, count); if (slopes[j].dy * slopes[i].dx > slopes[i].dy * slopes[j].dx) { clockwise = -1; slopeoff = -1; } bottomy = ICEIL (maxy) + yi; nright = 0; s = StepAround (top, slopeoff, count); i = top; while (i != bottom) { if (slopes[s].dy != 0) { y = miPolyBuildEdge (vertices[i].x, vertices[i].y, slopes[s].k, slopes[s].dx, slopes[s].dy, xi, yi, 0, &right[nright]); if (nright != 0) right[nright-1].height = y - lasty; else topy = y; nright++; lasty = y; } i = StepAround (i, clockwise, count); s = StepAround (s, clockwise, count); } if (nright != 0) right[nright-1].height = bottomy - lasty; if (slopeoff == 0) slopeoff = -1; else slopeoff = 0; nleft = 0; s = StepAround (top, slopeoff, count); i = top; while (i != bottom) { if (slopes[s].dy != 0) { y = miPolyBuildEdge (vertices[i].x, vertices[i].y, slopes[s].k, slopes[s].dx, slopes[s].dy, xi, yi, 1, &left[nleft]); if (nleft != 0) left[nleft-1].height = y - lasty; nleft++; lasty = y; } i = StepAround (i, -clockwise, count); s = StepAround (s, -clockwise, count); } if (nleft != 0) left[nleft-1].height = bottomy - lasty; *pnleft = nleft; *pnright = nright; *h = bottomy - topy; return topy; } static void miLineOnePoint ( DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, int x, int y) { DDXPointRec pt; int wid; unsigned long oldPixel; MILINESETPIXEL (pDrawable, pGC, pixel, oldPixel); if (pGC->fillStyle == FillSolid) { pt.x = x; pt.y = y; (*pGC->ops->PolyPoint) (pDrawable, pGC, CoordModeOrigin, 1, &pt); } else { wid = 1; if (pGC->miTranslate) { x += pDrawable->x; y += pDrawable->y; } pt.x = x; pt.y = y; (*pGC->ops->FillSpans) (pDrawable, pGC, 1, &pt, &wid, TRUE); } MILINERESETPIXEL (pDrawable, pGC, pixel, oldPixel); } static void miLineJoin ( DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, register LineFacePtr pLeft, register LineFacePtr pRight) { double mx = 0, my = 0; double denom = 0.0; PolyVertexRec vertices[4]; PolySlopeRec slopes[4]; int edgecount; PolyEdgeRec left[4], right[4]; int nleft, nright; int y, height; int swapslopes; int joinStyle = pGC->joinStyle; int lw = pGC->lineWidth; if (lw == 1 && !spanData) { /* See if one of the lines will draw the joining pixel */ if (pLeft->dx > 0 || (pLeft->dx == 0 && pLeft->dy > 0)) return; if (pRight->dx > 0 || (pRight->dx == 0 && pRight->dy > 0)) return; if (joinStyle != JoinRound) { denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy; if (denom == 0) return; /* no join to draw */ } if (joinStyle != JoinMiter) { miLineOnePoint (pDrawable, pGC, pixel, spanData, pLeft->x, pLeft->y); return; } } else { if (joinStyle == JoinRound) { miLineArc(pDrawable, pGC, pixel, spanData, pLeft, pRight, (double)0.0, (double)0.0, TRUE); return; } denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy; if (denom == 0.0) return; /* no join to draw */ } swapslopes = 0; if (denom > 0) { pLeft->xa = -pLeft->xa; pLeft->ya = -pLeft->ya; pLeft->dx = -pLeft->dx; pLeft->dy = -pLeft->dy; } else { swapslopes = 1; pRight->xa = -pRight->xa; pRight->ya = -pRight->ya; pRight->dx = -pRight->dx; pRight->dy = -pRight->dy; } vertices[0].x = pRight->xa; vertices[0].y = pRight->ya; slopes[0].dx = -pRight->dy; slopes[0].dy = pRight->dx; slopes[0].k = 0; vertices[1].x = 0; vertices[1].y = 0; slopes[1].dx = pLeft->dy; slopes[1].dy = -pLeft->dx; slopes[1].k = 0; vertices[2].x = pLeft->xa; vertices[2].y = pLeft->ya; if (joinStyle == JoinMiter) { my = (pLeft->dy * (pRight->xa * pRight->dy - pRight->ya * pRight->dx) - pRight->dy * (pLeft->xa * pLeft->dy - pLeft->ya * pLeft->dx )) / denom; if (pLeft->dy != 0) { mx = pLeft->xa + (my - pLeft->ya) * (double) pLeft->dx / (double) pLeft->dy; } else { mx = pRight->xa + (my - pRight->ya) * (double) pRight->dx / (double) pRight->dy; } /* check miter limit */ if ((mx * mx + my * my) * 4 > SQSECANT * lw * lw) joinStyle = JoinBevel; } if (joinStyle == JoinMiter) { slopes[2].dx = pLeft->dx; slopes[2].dy = pLeft->dy; slopes[2].k = pLeft->k; if (swapslopes) { slopes[2].dx = -slopes[2].dx; slopes[2].dy = -slopes[2].dy; slopes[2].k = -slopes[2].k; } vertices[3].x = mx; vertices[3].y = my; slopes[3].dx = pRight->dx; slopes[3].dy = pRight->dy; slopes[3].k = pRight->k; if (swapslopes) { slopes[3].dx = -slopes[3].dx; slopes[3].dy = -slopes[3].dy; slopes[3].k = -slopes[3].k; } edgecount = 4; } else { double scale, dx, dy, adx, ady; adx = dx = pRight->xa - pLeft->xa; ady = dy = pRight->ya - pLeft->ya; if (adx < 0) adx = -adx; if (ady < 0) ady = -ady; scale = ady; if (adx > ady) scale = adx; slopes[2].dx = (dx * 65536) / scale; slopes[2].dy = (dy * 65536) / scale; slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy - (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0; edgecount = 3; } y = miPolyBuildPoly (vertices, slopes, edgecount, pLeft->x, pLeft->y, left, right, &nleft, &nright, &height); miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, height, left, right, nleft, nright); } static int miLineArcI ( DrawablePtr pDraw, GCPtr pGC, int xorg, int yorg, DDXPointPtr points, int *widths) { register DDXPointPtr tpts, bpts; register int *twids, *bwids; register int x, y, e, ex, slw; tpts = points; twids = widths; if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; } slw = pGC->lineWidth; if (slw == 1) { tpts->x = xorg; tpts->y = yorg; *twids = 1; return 1; } bpts = tpts + slw; bwids = twids + slw; y = (slw >> 1) + 1; if (slw & 1) e = - ((y << 2) + 3); else e = - (y << 3); ex = -4; x = 0; while (y) { e += (y << 3) - 4; while (e >= 0) { x++; e += (ex = -((x << 3) + 4)); } y--; slw = (x << 1) + 1; if ((e == ex) && (slw > 1)) slw--; tpts->x = xorg - x; tpts->y = yorg - y; tpts++; *twids++ = slw; if ((y != 0) && ((slw > 1) || (e != ex))) { bpts--; bpts->x = xorg - x; bpts->y = yorg + y; *--bwids = slw; } } return (pGC->lineWidth); } #define CLIPSTEPEDGE(edgey,edge,edgeleft) \ if (ybase == edgey) \ { \ if (edgeleft) \ { \ if (edge->x > xcl) \ xcl = edge->x; \ } \ else \ { \ if (edge->x < xcr) \ xcr = edge->x; \ } \ edgey++; \ edge->x += edge->stepx; \ edge->e += edge->dx; \ if (edge->e > 0) \ { \ edge->x += edge->signdx; \ edge->e -= edge->dy; \ } \ } static int miLineArcD ( DrawablePtr pDraw, GCPtr pGC, double xorg, double yorg, DDXPointPtr points, int *widths, PolyEdgePtr edge1, int edgey1, Bool edgeleft1, PolyEdgePtr edge2, int edgey2, Bool edgeleft2) { register DDXPointPtr pts; register int *wids; double radius, x0, y0, el, er, yk, xlk, xrk, k; int xbase, ybase, y, boty, xl, xr, xcl, xcr; int ymin, ymax; Bool edge1IsMin, edge2IsMin; int ymin1, ymin2; pts = points; wids = widths; xbase = floor(xorg); x0 = xorg - xbase; ybase = ICEIL (yorg); y0 = yorg - ybase; if (pGC->miTranslate) { xbase += pDraw->x; ybase += pDraw->y; edge1->x += pDraw->x; edge2->x += pDraw->x; edgey1 += pDraw->y; edgey2 += pDraw->y; } xlk = x0 + x0 + 1.0; xrk = x0 + x0 - 1.0; yk = y0 + y0 - 1.0; radius = ((double)pGC->lineWidth) / 2.0; y = floor(radius - y0 + 1.0); ybase -= y; ymin = ybase; ymax = 65536; edge1IsMin = FALSE; ymin1 = edgey1; if (edge1->dy >= 0) { if (!edge1->dy) { if (edgeleft1) edge1IsMin = TRUE; else ymax = edgey1; edgey1 = 65536; } else { if ((edge1->signdx < 0) == edgeleft1) edge1IsMin = TRUE; } } edge2IsMin = FALSE; ymin2 = edgey2; if (edge2->dy >= 0) { if (!edge2->dy) { if (edgeleft2) edge2IsMin = TRUE; else ymax = edgey2; edgey2 = 65536; } else { if ((edge2->signdx < 0) == edgeleft2) edge2IsMin = TRUE; } } if (edge1IsMin) { ymin = ymin1; if (edge2IsMin && ymin1 > ymin2) ymin = ymin2; } else if (edge2IsMin) ymin = ymin2; el = radius * radius - ((y + y0) * (y + y0)) - (x0 * x0); er = el + xrk; xl = 1; xr = 0; if (x0 < 0.5) { xl = 0; el -= xlk; } boty = (y0 < -0.5) ? 1 : 0; if (ybase + y - boty > ymax) boty = ymax - ybase - y; while (y > boty) { k = (y << 1) + yk; er += k; while (er > 0.0) { xr++; er += xrk - (xr << 1); } el += k; while (el >= 0.0) { xl--; el += (xl << 1) - xlk; } y--; ybase++; if (ybase < ymin) continue; xcl = xl + xbase; xcr = xr + xbase; CLIPSTEPEDGE(edgey1, edge1, edgeleft1); CLIPSTEPEDGE(edgey2, edge2, edgeleft2); if (xcr >= xcl) { pts->x = xcl; pts->y = ybase; pts++; *wids++ = xcr - xcl + 1; } } er = xrk - (xr << 1) - er; el = (xl << 1) - xlk - el; boty = floor(-y0 - radius + 1.0); if (ybase + y - boty > ymax) boty = ymax - ybase - y; while (y > boty) { k = (y << 1) + yk; er -= k; while ((er >= 0.0) && (xr >= 0)) { xr--; er += xrk - (xr << 1); } el -= k; while ((el > 0.0) && (xl <= 0)) { xl++; el += (xl << 1) - xlk; } y--; ybase++; if (ybase < ymin) continue; xcl = xl + xbase; xcr = xr + xbase; CLIPSTEPEDGE(edgey1, edge1, edgeleft1); CLIPSTEPEDGE(edgey2, edge2, edgeleft2); if (xcr >= xcl) { pts->x = xcl; pts->y = ybase; pts++; *wids++ = xcr - xcl + 1; } } return (pts - points); } int miRoundJoinFace (face, edge, leftEdge) register LineFacePtr face; register PolyEdgePtr edge; Bool *leftEdge; { int y; int dx, dy; double xa, ya; Bool left; dx = -face->dy; dy = face->dx; xa = face->xa; ya = face->ya; left = 1; if (ya > 0) { ya = 0.0; xa = 0.0; } if (dy < 0 || (dy == 0 && dx > 0)) { dx = -dx; dy = -dy; left = !left; } if (dx == 0 && dy == 0) dy = 1; if (dy == 0) { y = ICEIL (face->ya) + face->y; edge->x = -32767; edge->stepx = 0; edge->signdx = 0; edge->e = -1; edge->dy = 0; edge->dx = 0; edge->height = 0; } else { y = miPolyBuildEdge (xa, ya, 0.0, dx, dy, face->x, face->y, !left, edge); edge->height = 32767; } *leftEdge = !left; return y; } void miRoundJoinClip (pLeft, pRight, edge1, edge2, y1, y2, left1, left2) register LineFacePtr pLeft, pRight; PolyEdgePtr edge1, edge2; int *y1, *y2; Bool *left1, *left2; { double denom; denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy; if (denom >= 0) { pLeft->xa = -pLeft->xa; pLeft->ya = -pLeft->ya; } else { pRight->xa = -pRight->xa; pRight->ya = -pRight->ya; } *y1 = miRoundJoinFace (pLeft, edge1, left1); *y2 = miRoundJoinFace (pRight, edge2, left2); } int miRoundCapClip (face, isInt, edge, leftEdge) register LineFacePtr face; Bool isInt; register PolyEdgePtr edge; Bool *leftEdge; { int y; register int dx, dy; double xa, ya, k; Bool left; dx = -face->dy; dy = face->dx; xa = face->xa; ya = face->ya; k = 0.0; if (!isInt) k = face->k; left = 1; if (dy < 0 || (dy == 0 && dx > 0)) { dx = -dx; dy = -dy; xa = -xa; ya = -ya; left = !left; } if (dx == 0 && dy == 0) dy = 1; if (dy == 0) { y = ICEIL (face->ya) + face->y; edge->x = -32767; edge->stepx = 0; edge->signdx = 0; edge->e = -1; edge->dy = 0; edge->dx = 0; edge->height = 0; } else { y = miPolyBuildEdge (xa, ya, k, dx, dy, face->x, face->y, !left, edge); edge->height = 32767; } *leftEdge = !left; return y; } static void miLineArc ( DrawablePtr pDraw, register GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, register LineFacePtr leftFace, register LineFacePtr rightFace, double xorg, double yorg, Bool isInt) { DDXPointPtr points; int *widths; int xorgi = 0, yorgi = 0; XID oldPixel; Spans spanRec; int n; PolyEdgeRec edge1, edge2; int edgey1, edgey2; Bool edgeleft1, edgeleft2; if (isInt) { xorgi = leftFace ? leftFace->x : rightFace->x; yorgi = leftFace ? leftFace->y : rightFace->y; } edgey1 = 65536; edgey2 = 65536; edge1.x = 0; /* not used, keep memory checkers happy */ edge1.dy = -1; edge2.x = 0; /* not used, keep memory checkers happy */ edge2.dy = -1; edgeleft1 = FALSE; edgeleft2 = FALSE; if ((pGC->lineStyle != LineSolid || pGC->lineWidth > 2) && ((pGC->capStyle == CapRound && pGC->joinStyle != JoinRound) || (pGC->joinStyle == JoinRound && pGC->capStyle == CapButt))) { if (isInt) { xorg = (double) xorgi; yorg = (double) yorgi; } if (leftFace && rightFace) { miRoundJoinClip (leftFace, rightFace, &edge1, &edge2, &edgey1, &edgey2, &edgeleft1, &edgeleft2); } else if (leftFace) { edgey1 = miRoundCapClip (leftFace, isInt, &edge1, &edgeleft1); } else if (rightFace) { edgey2 = miRoundCapClip (rightFace, isInt, &edge2, &edgeleft2); } isInt = FALSE; } if (!spanData) { points = (DDXPointPtr)malloc(sizeof(DDXPointRec) * pGC->lineWidth); if (!points) return; widths = (int *)malloc(sizeof(int) * pGC->lineWidth); if (!widths) { free(points); return; } oldPixel = pGC->fgPixel; if (pixel != oldPixel) { XID tmpPixel = (XID)pixel; DoChangeGC(pGC, GCForeground, &tmpPixel, FALSE); ValidateGC (pDraw, pGC); } } else { points = (DDXPointPtr) malloc (pGC->lineWidth * sizeof (DDXPointRec)); if (!points) return; widths = (int *) malloc (pGC->lineWidth * sizeof (int)); if (!widths) { free (points); return; } spanRec.points = points; spanRec.widths = widths; } if (isInt) n = miLineArcI(pDraw, pGC, xorgi, yorgi, points, widths); else n = miLineArcD(pDraw, pGC, xorg, yorg, points, widths, &edge1, edgey1, edgeleft1, &edge2, edgey2, edgeleft2); if (!spanData) { (*pGC->ops->FillSpans)(pDraw, pGC, n, points, widths, TRUE); free(widths); free(points); if (pixel != oldPixel) { DoChangeGC(pGC, GCForeground, &oldPixel, FALSE); ValidateGC (pDraw, pGC); } } else { spanRec.count = n; AppendSpanGroup (pGC, pixel, &spanRec, spanData) } } void miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg, isInt) DrawablePtr pDrawable; register GCPtr pGC; unsigned long pixel; SpanDataPtr spanData; register LineFacePtr face; Bool isLeft; double xorg, yorg; Bool isInt; { int xorgi = 0, yorgi = 0; int lw; PolyEdgeRec lefts[4], rights[4]; int lefty, righty, topy, bottomy; PolyEdgePtr left, right; PolyEdgePtr top, bottom; double xa,ya; double k; double xap, yap; int dx, dy; double projectXoff, projectYoff; double maxy; int finaly; if (isInt) { xorgi = face->x; yorgi = face->y; } lw = pGC->lineWidth; dx = face->dx; dy = face->dy; k = face->k; if (dy == 0) { lefts[0].height = lw; lefts[0].x = xorgi; if (isLeft) lefts[0].x -= (lw >> 1); lefts[0].stepx = 0; lefts[0].signdx = 1; lefts[0].e = -lw; lefts[0].dx = 0; lefts[0].dy = lw; rights[0].height = lw; rights[0].x = xorgi; if (!isLeft) rights[0].x += ((lw + 1) >> 1); rights[0].stepx = 0; rights[0].signdx = 1; rights[0].e = -lw; rights[0].dx = 0; rights[0].dy = lw; miFillPolyHelper (pDrawable, pGC, pixel, spanData, yorgi - (lw >> 1), lw, lefts, rights, 1, 1); } else if (dx == 0) { if (dy < 0) { dy = -dy; isLeft = !isLeft; } topy = yorgi; bottomy = yorgi + dy; if (isLeft) topy -= (lw >> 1); else bottomy += (lw >> 1); lefts[0].height = bottomy - topy; lefts[0].x = xorgi - (lw >> 1); lefts[0].stepx = 0; lefts[0].signdx = 1; lefts[0].e = -dy; lefts[0].dx = dx; lefts[0].dy = dy; rights[0].height = bottomy - topy; rights[0].x = lefts[0].x + (lw-1); rights[0].stepx = 0; rights[0].signdx = 1; rights[0].e = -dy; rights[0].dx = dx; rights[0].dy = dy; miFillPolyHelper (pDrawable, pGC, pixel, spanData, topy, bottomy - topy, lefts, rights, 1, 1); } else { xa = face->xa; ya = face->ya; projectXoff = -ya; projectYoff = xa; if (dx < 0) { right = &rights[1]; left = &lefts[0]; top = &rights[0]; bottom = &lefts[1]; } else { right = &rights[0]; left = &lefts[1]; top = &lefts[0]; bottom = &rights[1]; } if (isLeft) { righty = miPolyBuildEdge (xa, ya, k, dx, dy, xorgi, yorgi, 0, right); xa = -xa; ya = -ya; k = -k; lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, k, dx, dy, xorgi, yorgi, 1, left); if (dx > 0) { ya = -ya; xa = -xa; } xap = xa - projectXoff; yap = ya - projectYoff; topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, -dy, dx, xorgi, yorgi, dx > 0, top); bottomy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, xorgi, yorgi, dx < 0, bottom); maxy = -ya; } else { righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, k, dx, dy, xorgi, yorgi, 0, right); xa = -xa; ya = -ya; k = -k; lefty = miPolyBuildEdge (xa, ya, k, dx, dy, xorgi, yorgi, 1, left); if (dx > 0) { ya = -ya; xa = -xa; } xap = xa - projectXoff; yap = ya - projectYoff; topy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, xorgi, xorgi, dx > 0, top); bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, -dy, dx, xorgi, xorgi, dx < 0, bottom); maxy = -ya + projectYoff; } finaly = ICEIL(maxy) + yorgi; if (dx < 0) { left->height = bottomy - lefty; right->height = finaly - righty; top->height = righty - topy; } else { right->height = bottomy - righty; left->height = finaly - lefty; top->height = lefty - topy; } bottom->height = finaly - bottomy; miFillPolyHelper (pDrawable, pGC, pixel, spanData, topy, bottom->height + bottomy - topy, lefts, rights, 2, 2); } } static void miWideSegment ( DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, SpanDataPtr spanData, register int x1, register int y1, register int x2, register int y2, Bool projectLeft, Bool projectRight, register LineFacePtr leftFace, register LineFacePtr rightFace) { double l, L, r; double xa, ya; double projectXoff = 0.0, projectYoff = 0.0; double k; double maxy; int x, y; int dx, dy; int finaly; PolyEdgePtr left, right; PolyEdgePtr top, bottom; int lefty, righty, topy, bottomy; int signdx; PolyEdgeRec lefts[4], rights[4]; LineFacePtr tface; int lw = pGC->lineWidth; /* draw top-to-bottom always */ if (y2 < y1 || (y2 == y1 && x2 < x1)) { x = x1; x1 = x2; x2 = x; y = y1; y1 = y2; y2 = y; x = projectLeft; projectLeft = projectRight; projectRight = x; tface = leftFace; leftFace = rightFace; rightFace = tface; } dy = y2 - y1; signdx = 1; dx = x2 - x1; if (dx < 0) signdx = -1; leftFace->x = x1; leftFace->y = y1; leftFace->dx = dx; leftFace->dy = dy; rightFace->x = x2; rightFace->y = y2; rightFace->dx = -dx; rightFace->dy = -dy; if (dy == 0) { rightFace->xa = 0; rightFace->ya = (double) lw / 2.0; rightFace->k = -(double) (lw * dx) / 2.0; leftFace->xa = 0; leftFace->ya = -rightFace->ya; leftFace->k = rightFace->k; x = x1; if (projectLeft) x -= (lw >> 1); y = y1 - (lw >> 1); dx = x2 - x; if (projectRight) dx += ((lw + 1) >> 1); dy = lw; miFillRectPolyHelper (pDrawable, pGC, pixel, spanData, x, y, dx, dy); } else if (dx == 0) { leftFace->xa = (double) lw / 2.0; leftFace->ya = 0; leftFace->k = (double) (lw * dy) / 2.0; rightFace->xa = -leftFace->xa; rightFace->ya = 0; rightFace->k = leftFace->k; y = y1; if (projectLeft) y -= lw >> 1; x = x1 - (lw >> 1); dy = y2 - y; if (projectRight) dy += ((lw + 1) >> 1); dx = lw; miFillRectPolyHelper (pDrawable, pGC, pixel, spanData, x, y, dx, dy); } else { l = ((double) lw) / 2.0; L = hypot ((double) dx, (double) dy); if (dx < 0) { right = &rights[1]; left = &lefts[0]; top = &rights[0]; bottom = &lefts[1]; } else { right = &rights[0]; left = &lefts[1]; top = &lefts[0]; bottom = &rights[1]; } r = l / L; /* coord of upper bound at integral y */ ya = -r * dx; xa = r * dy; if (projectLeft | projectRight) { projectXoff = -ya; projectYoff = xa; } /* xa * dy - ya * dx */ k = l * L; leftFace->xa = xa; leftFace->ya = ya; leftFace->k = k; rightFace->xa = -xa; rightFace->ya = -ya; rightFace->k = k; if (projectLeft) righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, k, dx, dy, x1, y1, 0, right); else righty = miPolyBuildEdge (xa, ya, k, dx, dy, x1, y1, 0, right); /* coord of lower bound at integral y */ ya = -ya; xa = -xa; /* xa * dy - ya * dx */ k = - k; if (projectLeft) lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, k, dx, dy, x1, y1, 1, left); else lefty = miPolyBuildEdge (xa, ya, k, dx, dy, x1, y1, 1, left); /* coord of top face at integral y */ if (signdx > 0) { ya = -ya; xa = -xa; } if (projectLeft) { double xap = xa - projectXoff; double yap = ya - projectYoff; topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, -dy, dx, x1, y1, dx > 0, top); } else topy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, x1, y1, dx > 0, top); /* coord of bottom face at integral y */ if (projectRight) { double xap = xa + projectXoff; double yap = ya + projectYoff; bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, -dy, dx, x2, y2, dx < 0, bottom); maxy = -ya + projectYoff; } else { bottomy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, x2, y2, dx < 0, bottom); maxy = -ya; } finaly = ICEIL (maxy) + y2; if (dx < 0) { left->height = bottomy - lefty; right->height = finaly - righty; top->height = righty - topy; } else { right->height = bottomy - righty; left->height = finaly - lefty; top->height = lefty - topy; } bottom->height = finaly - bottomy; miFillPolyHelper (pDrawable, pGC, pixel, spanData, topy, bottom->height + bottomy - topy, lefts, rights, 2, 2); } } SpanDataPtr miSetupSpanData (pGC, spanData, npt) register GCPtr pGC; SpanDataPtr spanData; int npt; { if ((npt < 3 && pGC->capStyle != CapRound) || miSpansEasyRop(pGC->alu)) return (SpanDataPtr) NULL; if (pGC->lineStyle == LineDoubleDash) miInitSpanGroup (&spanData->bgGroup); miInitSpanGroup (&spanData->fgGroup); return spanData; } void miCleanupSpanData (pDrawable, pGC, spanData) DrawablePtr pDrawable; GCPtr pGC; SpanDataPtr spanData; { if (pGC->lineStyle == LineDoubleDash) { XID oldPixel, pixel; pixel = pGC->bgPixel; oldPixel = pGC->fgPixel; if (pixel != oldPixel) { DoChangeGC (pGC, GCForeground, &pixel, FALSE); ValidateGC (pDrawable, pGC); } miFillUniqueSpanGroup (pDrawable, pGC, &spanData->bgGroup); miFreeSpanGroup (&spanData->bgGroup); if (pixel != oldPixel) { DoChangeGC (pGC, GCForeground, &oldPixel, FALSE); ValidateGC (pDrawable, pGC); } } miFillUniqueSpanGroup (pDrawable, pGC, &spanData->fgGroup); miFreeSpanGroup (&spanData->fgGroup); } void miWideLine (pDrawable, pGC, mode, npt, pPts) DrawablePtr pDrawable; register GCPtr pGC; int mode; register int npt; register DDXPointPtr pPts; { int x1, y1, x2, y2; SpanDataRec spanDataRec; SpanDataPtr spanData; unsigned long pixel; Bool projectLeft, projectRight; LineFaceRec leftFace, rightFace, prevRightFace; LineFaceRec firstFace; register int first; Bool somethingDrawn = FALSE; Bool selfJoin; spanData = miSetupSpanData (pGC, &spanDataRec, npt); pixel = pGC->fgPixel; x2 = pPts->x; y2 = pPts->y; first = TRUE; selfJoin = FALSE; if (npt > 1) { if (mode == CoordModePrevious) { int nptTmp; DDXPointPtr pPtsTmp; x1 = x2; y1 = y2; nptTmp = npt; pPtsTmp = pPts + 1; while (--nptTmp) { x1 += pPtsTmp->x; y1 += pPtsTmp->y; ++pPtsTmp; } if (x2 == x1 && y2 == y1) selfJoin = TRUE; } else if (x2 == pPts[npt-1].x && y2 == pPts[npt-1].y) { selfJoin = TRUE; } } projectLeft = pGC->capStyle == CapProjecting && !selfJoin; projectRight = FALSE; while (--npt) { x1 = x2; y1 = y2; ++pPts; x2 = pPts->x; y2 = pPts->y; if (mode == CoordModePrevious) { x2 += x1; y2 += y1; } if (x1 != x2 || y1 != y2) { somethingDrawn = TRUE; if (npt == 1 && pGC->capStyle == CapProjecting && !selfJoin) projectRight = TRUE; miWideSegment (pDrawable, pGC, pixel, spanData, x1, y1, x2, y2, projectLeft, projectRight, &leftFace, &rightFace); if (first) { if (selfJoin) firstFace = leftFace; else if (pGC->capStyle == CapRound) { if (pGC->lineWidth == 1 && !spanData) miLineOnePoint (pDrawable, pGC, pixel, spanData, x1, y1); else miLineArc (pDrawable, pGC, pixel, spanData, &leftFace, (LineFacePtr) NULL, (double)0.0, (double)0.0, TRUE); } } else { miLineJoin (pDrawable, pGC, pixel, spanData, &leftFace, &prevRightFace); } prevRightFace = rightFace; first = FALSE; projectLeft = FALSE; } if (npt == 1 && somethingDrawn) { if (selfJoin) miLineJoin (pDrawable, pGC, pixel, spanData, &firstFace, &rightFace); else if (pGC->capStyle == CapRound) { if (pGC->lineWidth == 1 && !spanData) miLineOnePoint (pDrawable, pGC, pixel, spanData, x2, y2); else miLineArc (pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, &rightFace, (double)0.0, (double)0.0, TRUE); } } } /* handle crock where all points are coincedent */ if (!somethingDrawn) { projectLeft = pGC->capStyle == CapProjecting; miWideSegment (pDrawable, pGC, pixel, spanData, x2, y2, x2, y2, projectLeft, projectLeft, &leftFace, &rightFace); if (pGC->capStyle == CapRound) { miLineArc (pDrawable, pGC, pixel, spanData, &leftFace, (LineFacePtr) NULL, (double)0.0, (double)0.0, TRUE); rightFace.dx = -1; /* sleezy hack to make it work */ miLineArc (pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, &rightFace, (double)0.0, (double)0.0, TRUE); } } if (spanData) miCleanupSpanData (pDrawable, pGC, spanData); } #define V_TOP 0 #define V_RIGHT 1 #define V_BOTTOM 2 #define V_LEFT 3 static void miWideDashSegment ( DrawablePtr pDrawable, register GCPtr pGC, SpanDataPtr spanData, int *pDashOffset, int *pDashIndex, int x1, int y1, int x2, int y2, Bool projectLeft, Bool projectRight, LineFacePtr leftFace, LineFacePtr rightFace) { int dashIndex, dashRemain; unsigned char *pDash; double L, l; double k; PolyVertexRec vertices[4]; PolyVertexRec saveRight, saveBottom; PolySlopeRec slopes[4]; PolyEdgeRec left[4], right[4]; LineFaceRec lcapFace, rcapFace; int nleft, nright; int h; int y; int dy, dx; unsigned long pixel; double LRemain; double r; double rdx, rdy; double dashDx, dashDy; double saveK = 0.0; Bool first = TRUE; double lcenterx, lcentery, rcenterx = 0.0, rcentery = 0.0; unsigned long fgPixel, bgPixel; dx = x2 - x1; dy = y2 - y1; dashIndex = *pDashIndex; pDash = pGC->dash; dashRemain = pDash[dashIndex] - *pDashOffset; fgPixel = pGC->fgPixel; bgPixel = pGC->bgPixel; if (pGC->fillStyle == FillOpaqueStippled || pGC->fillStyle == FillTiled) { bgPixel = fgPixel; } l = ((double) pGC->lineWidth) / 2.0; if (dx == 0) { L = dy; rdx = 0; rdy = l; if (dy < 0) { L = -dy; rdy = -l; } } else if (dy == 0) { L = dx; rdx = l; rdy = 0; if (dx < 0) { L = -dx; rdx = -l; } } else { L = hypot ((double) dx, (double) dy); r = l / L; rdx = r * dx; rdy = r * dy; } k = l * L; LRemain = L; /* All position comments are relative to a line with dx and dy > 0, * but the code does not depend on this */ /* top */ slopes[V_TOP].dx = dx; slopes[V_TOP].dy = dy; slopes[V_TOP].k = k; /* right */ slopes[V_RIGHT].dx = -dy; slopes[V_RIGHT].dy = dx; slopes[V_RIGHT].k = 0; /* bottom */ slopes[V_BOTTOM].dx = -dx; slopes[V_BOTTOM].dy = -dy; slopes[V_BOTTOM].k = k; /* left */ slopes[V_LEFT].dx = dy; slopes[V_LEFT].dy = -dx; slopes[V_LEFT].k = 0; /* preload the start coordinates */ vertices[V_RIGHT].x = vertices[V_TOP].x = rdy; vertices[V_RIGHT].y = vertices[V_TOP].y = -rdx; vertices[V_BOTTOM].x = vertices[V_LEFT].x = -rdy; vertices[V_BOTTOM].y = vertices[V_LEFT].y = rdx; if (projectLeft) { vertices[V_TOP].x -= rdx; vertices[V_TOP].y -= rdy; vertices[V_LEFT].x -= rdx; vertices[V_LEFT].y -= rdy; slopes[V_LEFT].k = rdx * dx + rdy * dy; } lcenterx = x1; lcentery = y1; if (pGC->capStyle == CapRound) { lcapFace.dx = dx; lcapFace.dy = dy; lcapFace.x = x1; lcapFace.y = y1; rcapFace.dx = -dx; rcapFace.dy = -dy; rcapFace.x = x1; rcapFace.y = y1; } while (LRemain > dashRemain) { dashDx = (dashRemain * dx) / L; dashDy = (dashRemain * dy) / L; rcenterx = lcenterx + dashDx; rcentery = lcentery + dashDy; vertices[V_RIGHT].x += dashDx; vertices[V_RIGHT].y += dashDy; vertices[V_BOTTOM].x += dashDx; vertices[V_BOTTOM].y += dashDy; slopes[V_RIGHT].k = vertices[V_RIGHT].x * dx + vertices[V_RIGHT].y * dy; if (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1)) { if (pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapProjecting) { saveRight = vertices[V_RIGHT]; saveBottom = vertices[V_BOTTOM]; saveK = slopes[V_RIGHT].k; if (!first) { vertices[V_TOP].x -= rdx; vertices[V_TOP].y -= rdy; vertices[V_LEFT].x -= rdx; vertices[V_LEFT].y -= rdy; slopes[V_LEFT].k = vertices[V_LEFT].x * slopes[V_LEFT].dy - vertices[V_LEFT].y * slopes[V_LEFT].dx; } vertices[V_RIGHT].x += rdx; vertices[V_RIGHT].y += rdy; vertices[V_BOTTOM].x += rdx; vertices[V_BOTTOM].y += rdy; slopes[V_RIGHT].k = vertices[V_RIGHT].x * slopes[V_RIGHT].dy - vertices[V_RIGHT].y * slopes[V_RIGHT].dx; } y = miPolyBuildPoly (vertices, slopes, 4, x1, y1, left, right, &nleft, &nright, &h); pixel = (dashIndex & 1) ? bgPixel : fgPixel; miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, h, left, right, nleft, nright); if (pGC->lineStyle == LineOnOffDash) { switch (pGC->capStyle) { case CapProjecting: vertices[V_BOTTOM] = saveBottom; vertices[V_RIGHT] = saveRight; slopes[V_RIGHT].k = saveK; break; case CapRound: if (!first) { if (dx < 0) { lcapFace.xa = -vertices[V_LEFT].x; lcapFace.ya = -vertices[V_LEFT].y; lcapFace.k = slopes[V_LEFT].k; } else { lcapFace.xa = vertices[V_TOP].x; lcapFace.ya = vertices[V_TOP].y; lcapFace.k = -slopes[V_LEFT].k; } miLineArc (pDrawable, pGC, pixel, spanData, &lcapFace, (LineFacePtr) NULL, lcenterx, lcentery, FALSE); } if (dx < 0) { rcapFace.xa = vertices[V_BOTTOM].x; rcapFace.ya = vertices[V_BOTTOM].y; rcapFace.k = slopes[V_RIGHT].k; } else { rcapFace.xa = -vertices[V_RIGHT].x; rcapFace.ya = -vertices[V_RIGHT].y; rcapFace.k = -slopes[V_RIGHT].k; } miLineArc (pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, &rcapFace, rcenterx, rcentery, FALSE); break; } } } LRemain -= dashRemain; ++dashIndex; if (dashIndex == pGC->numInDashList) dashIndex = 0; dashRemain = pDash[dashIndex]; lcenterx = rcenterx; lcentery = rcentery; vertices[V_TOP] = vertices[V_RIGHT]; vertices[V_LEFT] = vertices[V_BOTTOM]; slopes[V_LEFT].k = -slopes[V_RIGHT].k; first = FALSE; } if (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1)) { vertices[V_TOP].x -= dx; vertices[V_TOP].y -= dy; vertices[V_LEFT].x -= dx; vertices[V_LEFT].y -= dy; vertices[V_RIGHT].x = rdy; vertices[V_RIGHT].y = -rdx; vertices[V_BOTTOM].x = -rdy; vertices[V_BOTTOM].y = rdx; if (projectRight) { vertices[V_RIGHT].x += rdx; vertices[V_RIGHT].y += rdy; vertices[V_BOTTOM].x += rdx; vertices[V_BOTTOM].y += rdy; slopes[V_RIGHT].k = vertices[V_RIGHT].x * slopes[V_RIGHT].dy - vertices[V_RIGHT].y * slopes[V_RIGHT].dx; } else slopes[V_RIGHT].k = 0; if (!first && pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapProjecting) { vertices[V_TOP].x -= rdx; vertices[V_TOP].y -= rdy; vertices[V_LEFT].x -= rdx; vertices[V_LEFT].y -= rdy; slopes[V_LEFT].k = vertices[V_LEFT].x * slopes[V_LEFT].dy - vertices[V_LEFT].y * slopes[V_LEFT].dx; } else slopes[V_LEFT].k += dx * dx + dy * dy; y = miPolyBuildPoly (vertices, slopes, 4, x2, y2, left, right, &nleft, &nright, &h); pixel = (dashIndex & 1) ? pGC->bgPixel : pGC->fgPixel; miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, h, left, right, nleft, nright); if (!first && pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapRound) { lcapFace.x = x2; lcapFace.y = y2; if (dx < 0) { lcapFace.xa = -vertices[V_LEFT].x; lcapFace.ya = -vertices[V_LEFT].y; lcapFace.k = slopes[V_LEFT].k; } else { lcapFace.xa = vertices[V_TOP].x; lcapFace.ya = vertices[V_TOP].y; lcapFace.k = -slopes[V_LEFT].k; } miLineArc (pDrawable, pGC, pixel, spanData, &lcapFace, (LineFacePtr) NULL, rcenterx, rcentery, FALSE); } } dashRemain = ((double) dashRemain) - LRemain; if (dashRemain == 0) { dashIndex++; if (dashIndex == pGC->numInDashList) dashIndex = 0; dashRemain = pDash[dashIndex]; } leftFace->x = x1; leftFace->y = y1; leftFace->dx = dx; leftFace->dy = dy; leftFace->xa = rdy; leftFace->ya = -rdx; leftFace->k = k; rightFace->x = x2; rightFace->y = y2; rightFace->dx = -dx; rightFace->dy = -dy; rightFace->xa = -rdy; rightFace->ya = rdx; rightFace->k = k; *pDashIndex = dashIndex; *pDashOffset = pDash[dashIndex] - dashRemain; } void miWideDash (pDrawable, pGC, mode, npt, pPts) DrawablePtr pDrawable; register GCPtr pGC; int mode; register int npt; register DDXPointPtr pPts; { int x1, y1, x2, y2; unsigned long pixel; Bool projectLeft, projectRight; LineFaceRec leftFace, rightFace, prevRightFace; LineFaceRec firstFace; int first; int dashIndex, dashOffset; register int prevDashIndex; SpanDataRec spanDataRec; SpanDataPtr spanData; Bool somethingDrawn = FALSE; Bool selfJoin; Bool endIsFg = FALSE, startIsFg = FALSE; Bool firstIsFg = FALSE, prevIsFg = FALSE; #ifndef XFree86Server /* XXX backward compatibility */ if (pGC->lineWidth == 0) { miZeroDashLine (pDrawable, pGC, mode, npt, pPts); return; } #endif if (pGC->lineStyle == LineDoubleDash && (pGC->fillStyle == FillOpaqueStippled || pGC->fillStyle == FillTiled)) { miWideLine (pDrawable, pGC, mode, npt, pPts); return; } if (npt == 0) return; spanData = miSetupSpanData (pGC, &spanDataRec, npt); x2 = pPts->x; y2 = pPts->y; first = TRUE; selfJoin = FALSE; if (mode == CoordModePrevious) { int nptTmp; DDXPointPtr pPtsTmp; x1 = x2; y1 = y2; nptTmp = npt; pPtsTmp = pPts + 1; while (--nptTmp) { x1 += pPtsTmp->x; y1 += pPtsTmp->y; ++pPtsTmp; } if (x2 == x1 && y2 == y1) selfJoin = TRUE; } else if (x2 == pPts[npt-1].x && y2 == pPts[npt-1].y) { selfJoin = TRUE; } projectLeft = pGC->capStyle == CapProjecting && !selfJoin; projectRight = FALSE; dashIndex = 0; dashOffset = 0; miStepDash ((int)pGC->dashOffset, &dashIndex, pGC->dash, (int)pGC->numInDashList, &dashOffset); while (--npt) { x1 = x2; y1 = y2; ++pPts; x2 = pPts->x; y2 = pPts->y; if (mode == CoordModePrevious) { x2 += x1; y2 += y1; } if (x1 != x2 || y1 != y2) { somethingDrawn = TRUE; if (npt == 1 && pGC->capStyle == CapProjecting && (!selfJoin || !firstIsFg)) projectRight = TRUE; prevDashIndex = dashIndex; miWideDashSegment (pDrawable, pGC, spanData, &dashOffset, &dashIndex, x1, y1, x2, y2, projectLeft, projectRight, &leftFace, &rightFace); startIsFg = !(prevDashIndex & 1); endIsFg = (dashIndex & 1) ^ (dashOffset != 0); if (pGC->lineStyle == LineDoubleDash || startIsFg) { pixel = startIsFg ? pGC->fgPixel : pGC->bgPixel; if (first || (pGC->lineStyle == LineOnOffDash && !prevIsFg)) { if (first && selfJoin) { firstFace = leftFace; firstIsFg = startIsFg; } else if (pGC->capStyle == CapRound) miLineArc (pDrawable, pGC, pixel, spanData, &leftFace, (LineFacePtr) NULL, (double)0.0, (double)0.0, TRUE); } else { miLineJoin (pDrawable, pGC, pixel, spanData, &leftFace, &prevRightFace); } } prevRightFace = rightFace; prevIsFg = endIsFg; first = FALSE; projectLeft = FALSE; } if (npt == 1 && somethingDrawn) { if (pGC->lineStyle == LineDoubleDash || endIsFg) { pixel = endIsFg ? pGC->fgPixel : pGC->bgPixel; if (selfJoin && (pGC->lineStyle == LineDoubleDash || firstIsFg)) { miLineJoin (pDrawable, pGC, pixel, spanData, &firstFace, &rightFace); } else { if (pGC->capStyle == CapRound) miLineArc (pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, &rightFace, (double)0.0, (double)0.0, TRUE); } } else { /* glue a cap to the start of the line if * we're OnOffDash and ended on odd dash */ if (selfJoin && firstIsFg) { pixel = pGC->fgPixel; if (pGC->capStyle == CapProjecting) miLineProjectingCap (pDrawable, pGC, pixel, spanData, &firstFace, TRUE, (double)0.0, (double)0.0, TRUE); else if (pGC->capStyle == CapRound) miLineArc (pDrawable, pGC, pixel, spanData, &firstFace, (LineFacePtr) NULL, (double)0.0, (double)0.0, TRUE); } } } } /* handle crock where all points are coincident */ if (!somethingDrawn && (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1))) { /* not the same as endIsFg computation above */ pixel = (dashIndex & 1) ? pGC->bgPixel : pGC->fgPixel; switch (pGC->capStyle) { case CapRound: miLineArc (pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, (LineFacePtr) NULL, (double)x2, (double)y2, FALSE); break; case CapProjecting: x1 = pGC->lineWidth; miFillRectPolyHelper (pDrawable, pGC, pixel, spanData, x2 - (x1 >> 1), y2 - (x1 >> 1), x1, x1); break; } } if (spanData) miCleanupSpanData (pDrawable, pGC, spanData); } /* these are stubs to allow old ddx ValidateGCs to work without change */ void miMiter() { } void miNotMiter() { } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/miwideline.h0000644000000000000000000001354213614532331017504 0ustar /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* Author: Keith Packard, MIT X Consortium */ #include "mispans.h" #include "mifpoly.h" /* for ICEIL */ /* * interface data to span-merging polygon filler */ typedef struct _SpanData { SpanGroup fgGroup, bgGroup; } SpanDataRec, *SpanDataPtr; #define AppendSpanGroup(pGC, pixel, spanPtr, spanData) { \ SpanGroup *group, *othergroup = NULL; \ if (pixel == pGC->fgPixel) \ { \ group = &spanData->fgGroup; \ if (pGC->lineStyle == LineDoubleDash) \ othergroup = &spanData->bgGroup; \ } \ else \ { \ group = &spanData->bgGroup; \ othergroup = &spanData->fgGroup; \ } \ miAppendSpans (group, othergroup, spanPtr); \ } /* * Polygon edge description for integer wide-line routines */ typedef struct _PolyEdge { int height; /* number of scanlines to process */ int x; /* starting x coordinate */ int stepx; /* fixed integral dx */ int signdx; /* variable dx sign */ int e; /* initial error term */ int dy; int dx; } PolyEdgeRec, *PolyEdgePtr; #define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - miter limit constant */ /* * types for general polygon routines */ typedef struct _PolyVertex { double x, y; } PolyVertexRec, *PolyVertexPtr; typedef struct _PolySlope { int dx, dy; double k; /* x0 * dy - y0 * dx */ } PolySlopeRec, *PolySlopePtr; /* * Line face description for caps/joins */ typedef struct _LineFace { double xa, ya; int dx, dy; int x, y; double k; } LineFaceRec, *LineFacePtr; /* * macros for polygon fillers */ #define MIPOLYRELOADLEFT if (!left_height && left_count) { \ left_height = left->height; \ left_x = left->x; \ left_stepx = left->stepx; \ left_signdx = left->signdx; \ left_e = left->e; \ left_dy = left->dy; \ left_dx = left->dx; \ --left_count; \ ++left; \ } #define MIPOLYRELOADRIGHT if (!right_height && right_count) { \ right_height = right->height; \ right_x = right->x; \ right_stepx = right->stepx; \ right_signdx = right->signdx; \ right_e = right->e; \ right_dy = right->dy; \ right_dx = right->dx; \ --right_count; \ ++right; \ } #define MIPOLYSTEPLEFT left_x += left_stepx; \ left_e += left_dx; \ if (left_e > 0) \ { \ left_x += left_signdx; \ left_e -= left_dy; \ } #define MIPOLYSTEPRIGHT right_x += right_stepx; \ right_e += right_dx; \ if (right_e > 0) \ { \ right_x += right_signdx; \ right_e -= right_dy; \ } #define MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \ oldPixel = pGC->fgPixel; \ if (pixel != oldPixel) { \ DoChangeGC (pGC, GCForeground, (XID *) &pixel, FALSE); \ ValidateGC (pDrawable, pGC); \ } \ } #define MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \ if (pixel != oldPixel) { \ DoChangeGC (pGC, GCForeground, (XID *) &oldPixel, FALSE); \ ValidateGC (pDrawable, pGC); \ } \ } extern void miFillPolyHelper( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, unsigned long /*pixel*/, SpanDataPtr /*spanData*/, int /*y*/, int /*overall_height*/, PolyEdgePtr /*left*/, PolyEdgePtr /*right*/, int /*left_count*/, int /*right_count*/ ); extern int miRoundJoinFace( LineFacePtr /*face*/, PolyEdgePtr /*edge*/, Bool * /*leftEdge*/ ); extern void miRoundJoinClip( LineFacePtr /*pLeft*/, LineFacePtr /*pRight*/, PolyEdgePtr /*edge1*/, PolyEdgePtr /*edge2*/, int * /*y1*/, int * /*y2*/, Bool * /*left1*/, Bool * /*left2*/ ); extern int miRoundCapClip( LineFacePtr /*face*/, Bool /*isInt*/, PolyEdgePtr /*edge*/, Bool * /*leftEdge*/ ); extern void miLineProjectingCap( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, unsigned long /*pixel*/, SpanDataPtr /*spanData*/, LineFacePtr /*face*/, Bool /*isLeft*/, double /*xorg*/, double /*yorg*/, Bool /*isInt*/ ); extern SpanDataPtr miSetupSpanData( GCPtr /*pGC*/, SpanDataPtr /*spanData*/, int /*npt*/ ); extern void miCleanupSpanData( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, SpanDataPtr /*spanData*/ ); extern int miPolyBuildEdge(double x0, double y0, double k, int dx, int dy, int xi, int yi, int left, PolyEdgePtr edge); extern int miPolyBuildPoly(PolyVertexPtr vertices, PolySlopePtr slopes, int count, int xi, int yi, PolyEdgePtr left, PolyEdgePtr right, int *pnleft, int *pnright, int *h); nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/miwindow.c0000644000000000000000000007537013614532331017215 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "regionstr.h" #include "region.h" #include "mi.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "mivalidate.h" void miClearToBackground(pWin, x, y, w, h, generateExposures) WindowPtr pWin; int x,y; int w,h; Bool generateExposures; { BoxRec box; RegionRec reg; RegionPtr pBSReg = NullRegion; ScreenPtr pScreen; BoxPtr extents; int x1, y1, x2, y2; /* compute everything using ints to avoid overflow */ x1 = pWin->drawable.x + x; y1 = pWin->drawable.y + y; if (w) x2 = x1 + (int) w; else x2 = x1 + (int) pWin->drawable.width - (int) x; if (h) y2 = y1 + h; else y2 = y1 + (int) pWin->drawable.height - (int) y; extents = &pWin->clipList.extents; /* clip the resulting rectangle to the window clipList extents. This * makes sure that the result will fit in a box, given that the * screen is < 32768 on a side. */ if (x1 < extents->x1) x1 = extents->x1; if (x2 > extents->x2) x2 = extents->x2; if (y1 < extents->y1) y1 = extents->y1; if (y2 > extents->y2) y2 = extents->y2; if (x2 <= x1 || y2 <= y1) { x2 = x1 = 0; y2 = y1 = 0; } box.x1 = x1; box.x2 = x2; box.y1 = y1; box.y2 = y2; pScreen = pWin->drawable.pScreen; RegionInit(®, &box, 1); if (pWin->backStorage) { /* * If the window has backing-store on, call through the * ClearToBackground vector to handle the special semantics * (i.e. things backing store is to be cleared out and * an Expose event is to be generated for those areas in backing * store if generateExposures is TRUE). */ pBSReg = (* pScreen->ClearBackingStore)(pWin, x, y, w, h, generateExposures); } RegionIntersect(®, ®, &pWin->clipList); if (generateExposures) (*pScreen->WindowExposures)(pWin, ®, pBSReg); else if (pWin->backgroundState != None) (*pScreen->PaintWindowBackground)(pWin, ®, PW_BACKGROUND); RegionUninit(®); if (pBSReg) RegionDestroy(pBSReg); } /* * For SaveUnders using backing-store. The idea is that when a window is mapped * with saveUnder set TRUE, any windows it obscures will have its backing * store turned on setting the DIXsaveUnder bit, * The backing-store code must be written to allow for this */ /*- *----------------------------------------------------------------------- * miCheckSubSaveUnder -- * Check all the inferiors of a window for coverage by saveUnder * windows. Called from ChangeSaveUnder and CheckSaveUnder. * This code is very inefficient. * * Results: * TRUE if any windows need to have backing-store removed. * * Side Effects: * Windows may have backing-store turned on or off. * *----------------------------------------------------------------------- */ static Bool miCheckSubSaveUnder( register WindowPtr pParent, /* Parent to check */ WindowPtr pFirst, /* first reconfigured window */ RegionPtr pRegion) /* Initial area obscured by saveUnder */ { register WindowPtr pChild; /* Current child */ register ScreenPtr pScreen; /* Screen to use */ RegionRec SubRegion; /* Area of children obscured */ Bool res = FALSE; /* result */ Bool subInited=FALSE;/* SubRegion initialized */ pScreen = pParent->drawable.pScreen; if ( (pChild = pParent->firstChild) ) { /* * build region above first changed window */ for (; pChild != pFirst; pChild = pChild->nextSib) if (pChild->viewable && pChild->saveUnder) RegionUnion(pRegion, pRegion, &pChild->borderSize); /* * check region below and including first changed window */ for (; pChild; pChild = pChild->nextSib) { if (pChild->viewable) { /* * don't save under nephew/niece windows; * use a separate region */ if (pChild->firstChild) { if (!subInited) { RegionNull(&SubRegion); subInited = TRUE; } RegionCopy(&SubRegion, pRegion); res |= miCheckSubSaveUnder(pChild, pChild->firstChild, &SubRegion); } else { res |= miCheckSubSaveUnder(pChild, pChild->firstChild, pRegion); } if (pChild->saveUnder) RegionUnion(pRegion, pRegion, &pChild->borderSize); } } if (subInited) RegionUninit(&SubRegion); } /* * Check the state of this window. DIX save unders are * enabled for viewable windows with some client expressing * exposure interest and which intersect the save under region */ if (pParent->viewable && ((pParent->eventMask | wOtherEventMasks(pParent)) & ExposureMask) && RegionNotEmpty(&pParent->borderSize) && RegionContainsRect(pRegion, RegionExtents( &pParent->borderSize)) != rgnOUT) { if (!pParent->DIXsaveUnder) { pParent->DIXsaveUnder = TRUE; (*pScreen->ChangeWindowAttributes) (pParent, CWBackingStore); } } else { if (pParent->DIXsaveUnder) { res = TRUE; pParent->DIXsaveUnder = FALSE; } } return res; } /*- *----------------------------------------------------------------------- * miChangeSaveUnder -- * Change the save-under state of a tree of windows. Called when * a window with saveUnder TRUE is mapped/unmapped/reconfigured. * * Results: * TRUE if any windows need to have backing-store removed (which * means that PostChangeSaveUnder needs to be called later to * finish the job). * * Side Effects: * Windows may have backing-store turned on or off. * *----------------------------------------------------------------------- */ Bool miChangeSaveUnder(pWin, first) register WindowPtr pWin; WindowPtr first; /* First window to check. * Used when pWin was restacked */ { RegionRec rgn; /* Area obscured by saveUnder windows */ Bool res; if (!deltaSaveUndersViewable && !numSaveUndersViewable) return FALSE; numSaveUndersViewable += deltaSaveUndersViewable; deltaSaveUndersViewable = 0; RegionNull(&rgn); res = miCheckSubSaveUnder (pWin->parent, pWin->saveUnder ? first : pWin->nextSib, &rgn); RegionUninit(&rgn); return res; } /*- *----------------------------------------------------------------------- * miPostChangeSaveUnder -- * Actually turn backing-store off for those windows that no longer * need to have it on. * * Results: * None. * * Side Effects: * Backing-store and SAVE_UNDER_CHANGE_BIT are turned off for those * windows affected. * *----------------------------------------------------------------------- */ void miPostChangeSaveUnder(pWin, pFirst) WindowPtr pWin; WindowPtr pFirst; { register WindowPtr pParent, pChild; ChangeWindowAttributesProcPtr ChangeWindowAttributes; if (!(pParent = pWin->parent)) return; ChangeWindowAttributes = pParent->drawable.pScreen->ChangeWindowAttributes; if (!pParent->DIXsaveUnder && (pParent->backingStore == NotUseful) && pParent->backStorage) (*ChangeWindowAttributes)(pParent, CWBackingStore); if (!(pChild = pFirst)) return; while (1) { if (!pChild->DIXsaveUnder && (pChild->backingStore == NotUseful) && pChild->backStorage) (*ChangeWindowAttributes)(pChild, CWBackingStore); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } while (!pChild->nextSib) { pChild = pChild->parent; if (pChild == pParent) return; } pChild = pChild->nextSib; } } void miMarkWindow(pWin) register WindowPtr pWin; { register ValidatePtr val; if (pWin->valdata) return; val = (ValidatePtr)xnfalloc(sizeof(ValidateRec)); val->before.oldAbsCorner.x = pWin->drawable.x; val->before.oldAbsCorner.y = pWin->drawable.y; val->before.borderVisible = NullRegion; val->before.resized = FALSE; pWin->valdata = val; } Bool miMarkOverlappedWindows(pWin, pFirst, ppLayerWin) WindowPtr pWin; WindowPtr pFirst; WindowPtr *ppLayerWin; { register BoxPtr box; register WindowPtr pChild, pLast; Bool anyMarked = FALSE; MarkWindowProcPtr MarkWindow = pWin->drawable.pScreen->MarkWindow; /* single layered systems are easy */ if (ppLayerWin) *ppLayerWin = pWin; if (pWin == pFirst) { /* Blindly mark pWin and all of its inferiors. This is a slight * overkill if there are mapped windows that outside pWin's border, * but it's better than wasting time on RectIn checks. */ pChild = pWin; while (1) { if (pChild->viewable) { if (RegionBroken(&pChild->winSize)) SetWinSize (pChild); if (RegionBroken(&pChild->borderSize)) SetBorderSize (pChild); (* MarkWindow)(pChild); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } anyMarked = TRUE; pFirst = pFirst->nextSib; } if ( (pChild = pFirst) ) { box = RegionExtents(&pWin->borderSize); pLast = pChild->parent->lastChild; while (1) { if (pChild->viewable) { if (RegionBroken(&pChild->winSize)) SetWinSize (pChild); if (RegionBroken(&pChild->borderSize)) SetBorderSize (pChild); if (RegionContainsRect(&pChild->borderSize, box)) { (* MarkWindow)(pChild); anyMarked = TRUE; if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } } while (!pChild->nextSib && (pChild != pLast)) pChild = pChild->parent; if (pChild == pLast) break; pChild = pChild->nextSib; } } if (anyMarked) (* MarkWindow)(pWin->parent); return anyMarked; } /***** * miHandleValidateExposures(pWin) * starting at pWin, draw background in any windows that have exposure * regions, translate the regions, restore any backing store, * and then send any regions still exposed to the client *****/ void miHandleValidateExposures(pWin) WindowPtr pWin; { register WindowPtr pChild; register ValidatePtr val; WindowExposuresProcPtr WindowExposures; pChild = pWin; WindowExposures = pChild->drawable.pScreen->WindowExposures; while (1) { if ( (val = pChild->valdata) ) { if (RegionNotEmpty(&val->after.borderExposed)) (*pChild->drawable.pScreen->PaintWindowBorder)(pChild, &val->after.borderExposed, PW_BORDER); RegionUninit(&val->after.borderExposed); (*WindowExposures)(pChild, &val->after.exposed, NullRegion); RegionUninit(&val->after.exposed); free(val); pChild->valdata = (ValidatePtr)NULL; if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } } void miMoveWindow(pWin, x, y, pNextSib, kind) register WindowPtr pWin; int x,y; WindowPtr pNextSib; VTKind kind; { WindowPtr pParent; Bool WasViewable = (Bool)(pWin->viewable); short bw; RegionPtr oldRegion = NULL; DDXPointRec oldpt; Bool anyMarked = FALSE; register ScreenPtr pScreen; WindowPtr windowToValidate; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; /* if this is a root window, can't be moved */ if (!(pParent = pWin->parent)) return ; pScreen = pWin->drawable.pScreen; bw = wBorderWidth (pWin); oldpt.x = pWin->drawable.x; oldpt.y = pWin->drawable.y; if (WasViewable) { oldRegion = RegionCreate(NullBox, 1); RegionCopy(oldRegion, &pWin->borderClip); anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); } pWin->origin.x = x + (int)bw; pWin->origin.y = y + (int)bw; x = pWin->drawable.x = pParent->drawable.x + x + (int)bw; y = pWin->drawable.y = pParent->drawable.y + y + (int)bw; SetWinSize (pWin); SetBorderSize (pWin); (*pScreen->PositionWindow)(pWin, x, y); windowToValidate = MoveWindowInStack(pWin, pNextSib); ResizeChildrenWinSize(pWin, x - oldpt.x, y - oldpt.y, 0, 0); if (WasViewable) { if (pLayerWin == pWin) anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, windowToValidate, (WindowPtr *)NULL); else anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, pLayerWin, (WindowPtr *)NULL); #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, windowToValidate); } #endif /* DO_SAVE_UNDERS */ if (anyMarked) { (*pScreen->ValidateTree)(pLayerWin->parent, NullWindow, kind); (* pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, oldRegion); RegionDestroy(oldRegion); /* XXX need to retile border if ParentRelative origin */ (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, windowToValidate); #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, NullWindow, kind); } if (pWin->realized) WindowsRestructured (); } /* * pValid is a region of the screen which has been * successfully copied -- recomputed exposed regions for affected windows */ static int miRecomputeExposures ( register WindowPtr pWin, void * value) /* must conform to VisitWindowProcPtr */ { RegionPtr pValid = (RegionPtr)value; if (pWin->valdata) { /* * compute exposed regions of this window */ RegionSubtract(&pWin->valdata->after.exposed, &pWin->clipList, pValid); /* * compute exposed regions of the border */ RegionSubtract(&pWin->valdata->after.borderExposed, &pWin->borderClip, &pWin->winSize); RegionSubtract(&pWin->valdata->after.borderExposed, &pWin->valdata->after.borderExposed, pValid); return WT_WALKCHILDREN; } return WT_NOMATCH; } void miSlideAndSizeWindow(pWin, x, y, w, h, pSib) register WindowPtr pWin; int x,y; unsigned int w, h; WindowPtr pSib; { WindowPtr pParent; Bool WasViewable = (Bool)(pWin->viewable); unsigned short width = pWin->drawable.width, height = pWin->drawable.height; short oldx = pWin->drawable.x, oldy = pWin->drawable.y; int bw = wBorderWidth (pWin); short dw, dh; DDXPointRec oldpt; RegionPtr oldRegion = NULL; Bool anyMarked = FALSE; register ScreenPtr pScreen; WindowPtr pFirstChange; register WindowPtr pChild; RegionPtr gravitate[StaticGravity + 1]; register unsigned g; int nx, ny; /* destination x,y */ int newx, newy; /* new inner window position */ RegionPtr pRegion = NULL; RegionPtr destClip; /* portions of destination already written */ RegionPtr oldWinClip = NULL; /* old clip list for window */ RegionPtr borderVisible = NullRegion; /* visible area of the border */ RegionPtr bsExposed = NullRegion; /* backing store exposures */ Bool shrunk = FALSE; /* shrunk in an inner dimension */ Bool moved = FALSE; /* window position changed */ #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; /* if this is a root window, can't be resized */ if (!(pParent = pWin->parent)) return ; pScreen = pWin->drawable.pScreen; newx = pParent->drawable.x + x + bw; newy = pParent->drawable.y + y + bw; if (WasViewable) { anyMarked = FALSE; /* * save the visible region of the window */ oldRegion = RegionCreate(NullBox, 1); RegionCopy(oldRegion, &pWin->winSize); /* * categorize child windows into regions to be moved */ for (g = 0; g <= StaticGravity; g++) gravitate[g] = (RegionPtr) NULL; for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { g = pChild->winGravity; if (g != UnmapGravity) { if (!gravitate[g]) gravitate[g] = RegionCreate(NullBox, 1); RegionUnion(gravitate[g], gravitate[g], &pChild->borderClip); } else { UnmapWindow(pChild, TRUE); anyMarked = TRUE; } } anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); oldWinClip = NULL; if (pWin->bitGravity != ForgetGravity) { oldWinClip = RegionCreate(NullBox, 1); RegionCopy(oldWinClip, &pWin->clipList); } /* * if the window is changing size, borderExposed * can't be computed correctly without some help. */ if (pWin->drawable.height > h || pWin->drawable.width > w) shrunk = TRUE; if (newx != oldx || newy != oldy) moved = TRUE; if ((pWin->drawable.height != h || pWin->drawable.width != w) && HasBorder (pWin)) { borderVisible = RegionCreate(NullBox, 1); /* for tiled borders, we punt and draw the whole thing */ if (pWin->borderIsPixel || !moved) { if (shrunk || moved) RegionSubtract(borderVisible, &pWin->borderClip, &pWin->winSize); else RegionCopy(borderVisible, &pWin->borderClip); } } } pWin->origin.x = x + bw; pWin->origin.y = y + bw; pWin->drawable.height = h; pWin->drawable.width = w; x = pWin->drawable.x = newx; y = pWin->drawable.y = newy; SetWinSize (pWin); SetBorderSize (pWin); dw = (int)w - (int)width; dh = (int)h - (int)height; ResizeChildrenWinSize(pWin, x - oldx, y - oldy, dw, dh); /* let the hardware adjust background and border pixmaps, if any */ (*pScreen->PositionWindow)(pWin, x, y); pFirstChange = MoveWindowInStack(pWin, pSib); if (WasViewable) { pRegion = RegionCreate(NullBox, 1); if (pWin->backStorage) RegionCopy(pRegion, &pWin->clipList); if (pLayerWin == pWin) anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange, (WindowPtr *)NULL); else anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pLayerWin, (WindowPtr *)NULL); if (pWin->valdata) { pWin->valdata->before.resized = TRUE; pWin->valdata->before.borderVisible = borderVisible; } #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pFirstChange); } #endif /* DO_SAVE_UNDERS */ if (anyMarked) (*pScreen->ValidateTree)(pLayerWin->parent, pFirstChange, VTOther); /* * the entire window is trashed unless bitGravity * recovers portions of it */ RegionCopy(&pWin->valdata->after.exposed, &pWin->clipList); } GravityTranslate (x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny); if (pWin->backStorage && ((pWin->backingStore == Always) || WasViewable)) { if (!WasViewable) pRegion = &pWin->clipList; /* a convenient empty region */ if (pWin->bitGravity == ForgetGravity) bsExposed = (*pScreen->TranslateBackingStore) (pWin, 0, 0, NullRegion, oldx, oldy); else { bsExposed = (*pScreen->TranslateBackingStore) (pWin, nx - x, ny - y, pRegion, oldx, oldy); } } if (WasViewable) { /* avoid the border */ if (HasBorder (pWin)) { int offx, offy, dx, dy; /* kruft to avoid double translates for each gravity */ offx = 0; offy = 0; for (g = 0; g <= StaticGravity; g++) { if (!gravitate[g]) continue; /* align winSize to gravitate[g]. * winSize is in new coordinates, * gravitate[g] is still in old coordinates */ GravityTranslate (x, y, oldx, oldy, dw, dh, g, &nx, &ny); dx = (oldx - nx) - offx; dy = (oldy - ny) - offy; if (dx || dy) { RegionTranslate(&pWin->winSize, dx, dy); offx += dx; offy += dy; } RegionIntersect(gravitate[g], gravitate[g], &pWin->winSize); } /* get winSize back where it belongs */ if (offx || offy) RegionTranslate(&pWin->winSize, -offx, -offy); } /* * add screen bits to the appropriate bucket */ if (oldWinClip) { /* * clip to new clipList */ RegionCopy(pRegion, oldWinClip); RegionTranslate(pRegion, nx - oldx, ny - oldy); RegionIntersect(oldWinClip, pRegion, &pWin->clipList); /* * don't step on any gravity bits which will be copied after this * region. Note -- this assumes that the regions will be copied * in gravity order. */ for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) { if (gravitate[g]) RegionSubtract(oldWinClip, oldWinClip, gravitate[g]); } RegionTranslate(oldWinClip, oldx - nx, oldy - ny); g = pWin->bitGravity; if (!gravitate[g]) gravitate[g] = oldWinClip; else { RegionUnion(gravitate[g], gravitate[g], oldWinClip); RegionDestroy(oldWinClip); } } /* * move the bits on the screen */ destClip = NULL; for (g = 0; g <= StaticGravity; g++) { if (!gravitate[g]) continue; GravityTranslate (x, y, oldx, oldy, dw, dh, g, &nx, &ny); oldpt.x = oldx + (x - nx); oldpt.y = oldy + (y - ny); /* Note that gravitate[g] is *translated* by CopyWindow */ /* only copy the remaining useful bits */ RegionIntersect(gravitate[g], gravitate[g], oldRegion); /* clip to not overwrite already copied areas */ if (destClip) { RegionTranslate(destClip, oldpt.x - x, oldpt.y - y); RegionSubtract(gravitate[g], gravitate[g], destClip); RegionTranslate(destClip, x - oldpt.x, y - oldpt.y); } /* and move those bits */ if (oldpt.x != x || oldpt.y != y #ifdef COMPOSITE || pWin->redirectDraw #endif ) { (*pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, gravitate[g]); } /* remove any overwritten bits from the remaining useful bits */ RegionSubtract(oldRegion, oldRegion, gravitate[g]); /* * recompute exposed regions of child windows */ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->winGravity != g) continue; RegionIntersect(pRegion, &pChild->borderClip, gravitate[g]); TraverseTree (pChild, miRecomputeExposures, (void *)pRegion); } /* * remove the successfully copied regions of the * window from its exposed region */ if (g == pWin->bitGravity) RegionSubtract(&pWin->valdata->after.exposed, &pWin->valdata->after.exposed, gravitate[g]); if (!destClip) destClip = gravitate[g]; else { RegionUnion(destClip, destClip, gravitate[g]); RegionDestroy(gravitate[g]); } } RegionDestroy(oldRegion); RegionDestroy(pRegion); if (destClip) RegionDestroy(destClip); if (bsExposed) { RegionPtr valExposed = NullRegion; if (pWin->valdata) valExposed = &pWin->valdata->after.exposed; (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); if (valExposed) RegionEmpty(valExposed); RegionDestroy(bsExposed); } if (anyMarked) (*pScreen->HandleExposures)(pLayerWin->parent); #ifdef DO_SAVE_UNDERS if (dosave) { (*pScreen->PostChangeSaveUnder)(pLayerWin, pFirstChange); } #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstChange, VTOther); } else if (bsExposed) { (*pScreen->WindowExposures) (pWin, NullRegion, bsExposed); RegionDestroy(bsExposed); } if (pWin->realized) WindowsRestructured (); } WindowPtr miGetLayerWindow(pWin) WindowPtr pWin; { return pWin->firstChild; } #ifdef SHAPE /****** * * miSetShape * The border/window shape has changed. Recompute winSize/borderSize * and send appropriate exposure events */ void miSetShape(pWin) register WindowPtr pWin; { Bool WasViewable = (Bool)(pWin->viewable); register ScreenPtr pScreen = pWin->drawable.pScreen; Bool anyMarked = FALSE; RegionPtr pOldClip = NULL, bsExposed; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; if (WasViewable) { anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); if (pWin->valdata) { if (HasBorder (pWin)) { RegionPtr borderVisible; borderVisible = RegionCreate(NullBox, 1); RegionSubtract(borderVisible, &pWin->borderClip, &pWin->winSize); pWin->valdata->before.borderVisible = borderVisible; } pWin->valdata->before.resized = TRUE; } } SetWinSize (pWin); SetBorderSize (pWin); ResizeChildrenWinSize(pWin, 0, 0, 0, 0); if (WasViewable) { if (pWin->backStorage) { pOldClip = RegionCreate(NullBox, 1); RegionCopy(pOldClip, &pWin->clipList); } anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin, (WindowPtr *)NULL); #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin); } #endif /* DO_SAVE_UNDERS */ if (anyMarked) (*pScreen->ValidateTree)(pLayerWin->parent, NullWindow, VTOther); } if (pWin->backStorage && ((pWin->backingStore == Always) || WasViewable)) { if (!WasViewable) pOldClip = &pWin->clipList; /* a convenient empty region */ bsExposed = (*pScreen->TranslateBackingStore) (pWin, 0, 0, pOldClip, pWin->drawable.x, pWin->drawable.y); #ifdef NXAGENT_SERVER /* * Applies to NXAGENT_SERVER builds: * * We got a few, rare, segfaults here after having * started using the backing store. It may be a * different bug but miChangeSaveUnder() calls mi- * CheckSubSaveUnder() that, in turn, can change * the backing store attribute of the window. This * means that we may try to destroy the region * even if it was not created at the beginning of * this function as, at the time, the backing store * was off. miCheckSubSaveUnder() appear to get a * pointer to the parent, so maybe doesn't change * the attribute of the window itself. This is to * be better investigated. * Update: Red Hat fixed this bug the same way (BZ 676270). */ if (WasViewable && pOldClip) #else if (WasViewable) #endif RegionDestroy(pOldClip); if (bsExposed) { RegionPtr valExposed = NullRegion; if (pWin->valdata) valExposed = &pWin->valdata->after.exposed; (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); if (valExposed) RegionEmpty(valExposed); RegionDestroy(bsExposed); } } if (WasViewable) { if (anyMarked) (*pScreen->HandleExposures)(pLayerWin->parent); #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin); #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, NullWindow, VTOther); } if (pWin->realized) WindowsRestructured (); CheckCursorConfinement(pWin); } #endif /* Keeps the same inside(!) origin */ void miChangeBorderWidth(pWin, width) register WindowPtr pWin; unsigned int width; { int oldwidth; Bool anyMarked = FALSE; register ScreenPtr pScreen; Bool WasViewable = (Bool)(pWin->viewable); Bool HadBorder; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; oldwidth = wBorderWidth (pWin); if (oldwidth == width) return; HadBorder = HasBorder(pWin); pScreen = pWin->drawable.pScreen; if (WasViewable && width < oldwidth) anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); pWin->borderWidth = width; SetBorderSize (pWin); if (WasViewable) { if (width > oldwidth) { anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); /* * save the old border visible region to correctly compute * borderExposed. */ if (pWin->valdata && HadBorder) { RegionPtr borderVisible; borderVisible = RegionCreate(NULL, 1); RegionSubtract(borderVisible, &pWin->borderClip, &pWin->winSize); pWin->valdata->before.borderVisible = borderVisible; } } #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pWin->nextSib); } #endif /* DO_SAVE_UNDERS */ if (anyMarked) { (*pScreen->ValidateTree)(pLayerWin->parent, pLayerWin, VTOther); (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, pWin->nextSib); #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pLayerWin, VTOther); } if (pWin->realized) WindowsRestructured (); } void miMarkUnrealizedWindow(pChild, pWin, fromConfigure) WindowPtr pChild; WindowPtr pWin; Bool fromConfigure; { if ((pChild != pWin) || fromConfigure) { RegionEmpty(&pChild->clipList); if (pChild->drawable.pScreen->ClipNotify) (* pChild->drawable.pScreen->ClipNotify)(pChild, 0, 0); RegionEmpty(&pChild->borderClip); } } void miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth) { WindowPtr pChild; for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->drawable.depth == depth) RegionUnion(pReg, pReg, &pChild->borderClip); if (pChild->firstChild) miSegregateChildren(pChild, pReg, depth); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mizerarc.c0000644000000000000000000004671013614532331017170 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Author: Bob Scheifler, MIT X Consortium ********************************************************/ /* Derived from: * "Algorithm for drawing ellipses or hyperbolae with a digital plotter" * by M. L. V. Pitteway * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289 */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "regionstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "mi.h" #include "mizerarc.h" #define FULLCIRCLE (360 * 64) #define OCTANT (45 * 64) #define QUADRANT (90 * 64) #define HALFCIRCLE (180 * 64) #define QUADRANT3 (270 * 64) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #define Dsin(d) ((d) == 0 ? 0.0 : ((d) == QUADRANT ? 1.0 : \ ((d) == HALFCIRCLE ? 0.0 : \ ((d) == QUADRANT3 ? -1.0 : sin((double)d*(M_PI/11520.0)))))) #define Dcos(d) ((d) == 0 ? 1.0 : ((d) == QUADRANT ? 0.0 : \ ((d) == HALFCIRCLE ? -1.0 : \ ((d) == QUADRANT3 ? 0.0 : cos((double)d*(M_PI/11520.0)))))) #define EPSILON45 64 typedef struct { int skipStart; int haveStart; DDXPointRec startPt; int haveLast; int skipLast; DDXPointRec endPt; int dashIndex; int dashOffset; int dashIndexInit; int dashOffsetInit; } DashInfo; static miZeroArcPtRec oob = {65536, 65536, 0}; /* * (x - l)^2 / (W/2)^2 + (y + H/2)^2 / (H/2)^2 = 1 * * where l is either 0 or .5 * * alpha = 4(W^2) * beta = 4(H^2) * gamma = 0 * u = 2(W^2)H * v = 4(H^2)l * k = -4(H^2)(l^2) * */ Bool miZeroArcSetup(arc, info, ok360) register xArc *arc; register miZeroArcRec *info; Bool ok360; { int l; int angle1, angle2; int startseg, endseg; int startAngle, endAngle; int i, overlap; miZeroArcPtRec start, end; l = arc->width & 1; if (arc->width == arc->height) { info->alpha = 4; info->beta = 4; info->k1 = -8; info->k3 = -16; info->b = 12; info->a = (arc->width << 2) - 12; info->d = 17 - (arc->width << 1); if (l) { info->b -= 4; info->a += 4; info->d -= 7; } } else if (!arc->width || !arc->height) { info->alpha = 0; info->beta = 0; info->k1 = 0; info->k3 = 0; info->a = -(int)arc->height; info->b = 0; info->d = -1; } else { /* initial conditions */ info->alpha = (arc->width * arc->width) << 2; info->beta = (arc->height * arc->height) << 2; info->k1 = info->beta << 1; info->k3 = info->k1 + (info->alpha << 1); info->b = l ? 0 : -info->beta; info->a = info->alpha * arc->height; info->d = info->b - (info->a >> 1) - (info->alpha >> 2); if (l) info->d -= info->beta >> 2; info->a -= info->b; /* take first step, d < 0 always */ info->b -= info->k1; info->a += info->k1; info->d += info->b; /* octant change, b < 0 always */ info->k1 = -info->k1; info->k3 = -info->k3; info->b = -info->b; info->d = info->b - info->a - info->d; info->a = info->a - (info->b << 1); } info->dx = 1; info->dy = 0; info->w = (arc->width + 1) >> 1; info->h = arc->height >> 1; info->xorg = arc->x + (arc->width >> 1); info->yorg = arc->y; info->xorgo = info->xorg + l; info->yorgo = info->yorg + arc->height; if (!arc->width) { if (!arc->height) { info->x = 0; info->y = 0; info->initialMask = 0; info->startAngle = 0; info->endAngle = 0; info->start = oob; info->end = oob; return FALSE; } info->x = 0; info->y = 1; } else { info->x = 1; info->y = 0; } angle1 = arc->angle1; angle2 = arc->angle2; if ((angle1 == 0) && (angle2 >= FULLCIRCLE)) { startAngle = 0; endAngle = 0; } else { if (angle2 > FULLCIRCLE) angle2 = FULLCIRCLE; else if (angle2 < -FULLCIRCLE) angle2 = -FULLCIRCLE; if (angle2 < 0) { startAngle = angle1 + angle2; endAngle = angle1; } else { startAngle = angle1; endAngle = angle1 + angle2; } if (startAngle < 0) startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE; if (startAngle >= FULLCIRCLE) startAngle = startAngle % FULLCIRCLE; if (endAngle < 0) endAngle = FULLCIRCLE - (-endAngle) % FULLCIRCLE; if (endAngle >= FULLCIRCLE) endAngle = endAngle % FULLCIRCLE; } info->startAngle = startAngle; info->endAngle = endAngle; if (ok360 && (startAngle == endAngle) && arc->angle2 && arc->width && arc->height) { info->initialMask = 0xf; info->start = oob; info->end = oob; return TRUE; } startseg = startAngle / OCTANT; if (!arc->height || (((startseg + 1) & 2) && arc->width)) { start.x = Dcos(startAngle) * ((arc->width + 1) / 2.0); if (start.x < 0) start.x = -start.x; start.y = -1; } else { start.y = Dsin(startAngle) * (arc->height / 2.0); if (start.y < 0) start.y = -start.y; start.y = info->h - start.y; start.x = 65536; } endseg = endAngle / OCTANT; if (!arc->height || (((endseg + 1) & 2) && arc->width)) { end.x = Dcos(endAngle) * ((arc->width + 1) / 2.0); if (end.x < 0) end.x = -end.x; end.y = -1; } else { end.y = Dsin(endAngle) * (arc->height / 2.0); if (end.y < 0) end.y = -end.y; end.y = info->h - end.y; end.x = 65536; } info->firstx = start.x; info->firsty = start.y; info->initialMask = 0; overlap = arc->angle2 && (endAngle <= startAngle); for (i = 0; i < 4; i++) { if (overlap ? ((i * QUADRANT <= endAngle) || ((i + 1) * QUADRANT > startAngle)) : ((i * QUADRANT <= endAngle) && ((i + 1) * QUADRANT > startAngle))) info->initialMask |= (1 << i); } start.mask = info->initialMask; end.mask = info->initialMask; startseg >>= 1; endseg >>= 1; overlap = overlap && (endseg == startseg); if (start.x != end.x || start.y != end.y || !overlap) { if (startseg & 1) { if (!overlap) info->initialMask &= ~(1 << startseg); if (start.x > end.x || start.y > end.y) end.mask &= ~(1 << startseg); } else { start.mask &= ~(1 << startseg); if (((start.x < end.x || start.y < end.y) || (start.x == end.x && start.y == end.y && (endseg & 1))) && !overlap) end.mask &= ~(1 << startseg); } if (endseg & 1) { end.mask &= ~(1 << endseg); if (((start.x > end.x || start.y > end.y) || (start.x == end.x && start.y == end.y && !(startseg & 1))) && !overlap) start.mask &= ~(1 << endseg); } else { if (!overlap) info->initialMask &= ~(1 << endseg); if (start.x < end.x || start.y < end.y) start.mask &= ~(1 << endseg); } } /* take care of case when start and stop are both near 45 */ /* handle here rather than adding extra code to pixelization loops */ if (startAngle && ((start.y < 0 && end.y >= 0) || (start.y >= 0 && end.y < 0))) { i = (startAngle + OCTANT) % OCTANT; if (i < EPSILON45 || i > OCTANT - EPSILON45) { i = (endAngle + OCTANT) % OCTANT; if (i < EPSILON45 || i > OCTANT - EPSILON45) { if (start.y < 0) { i = Dsin(startAngle) * (arc->height / 2.0); if (i < 0) i = -i; if (info->h - i == end.y) start.mask = end.mask; } else { i = Dsin(endAngle) * (arc->height / 2.0); if (i < 0) i = -i; if (info->h - i == start.y) end.mask = start.mask; } } } } if (startseg & 1) { info->start = start; info->end = oob; } else { info->end = start; info->start = oob; } if (endseg & 1) { info->altend = end; if (info->altend.x < info->end.x || info->altend.y < info->end.y) { miZeroArcPtRec tmp; tmp = info->altend; info->altend = info->end; info->end = tmp; } info->altstart = oob; } else { info->altstart = end; if (info->altstart.x < info->start.x || info->altstart.y < info->start.y) { miZeroArcPtRec tmp; tmp = info->altstart; info->altstart = info->start; info->start = tmp; } info->altend = oob; } if (!info->start.x || !info->start.y) { info->initialMask = info->start.mask; info->start = info->altstart; } if (!arc->width && (arc->height == 1)) { /* kludge! */ info->initialMask |= info->end.mask; info->initialMask |= info->initialMask << 1; info->end.x = 0; info->end.mask = 0; } return FALSE; } #define Pixelate(xval,yval) \ { \ pts->x = xval; \ pts->y = yval; \ pts++; \ } #define DoPix(idx,xval,yval) if (mask & (1 << idx)) Pixelate(xval, yval); DDXPointPtr miZeroArcPts(arc, pts) xArc *arc; register DDXPointPtr pts; { miZeroArcRec info; register int x, y, a, b, d, mask; register int k1, k3, dx, dy; Bool do360; do360 = miZeroArcSetup(arc, &info, TRUE); MIARCSETUP(); mask = info.initialMask; if (!(arc->width & 1)) { DoPix(1, info.xorgo, info.yorg); DoPix(3, info.xorgo, info.yorgo); } if (!info.end.x || !info.end.y) { mask = info.end.mask; info.end = info.altend; } if (do360 && (arc->width == arc->height) && !(arc->width & 1)) { int yorgh = info.yorg + info.h; int xorghp = info.xorg + info.h; int xorghn = info.xorg - info.h; while (1) { Pixelate(info.xorg + x, info.yorg + y); Pixelate(info.xorg - x, info.yorg + y); Pixelate(info.xorg - x, info.yorgo - y); Pixelate(info.xorg + x, info.yorgo - y); if (a < 0) break; Pixelate(xorghp - y, yorgh - x); Pixelate(xorghn + y, yorgh - x); Pixelate(xorghn + y, yorgh + x); Pixelate(xorghp - y, yorgh + x); MIARCCIRCLESTEP(;); } if (x > 1 && pts[-1].x == pts[-5].x && pts[-1].y == pts[-5].y) pts -= 4; x = info.w; y = info.h; } else if (do360) { while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(;); Pixelate(info.xorg + x, info.yorg + y); Pixelate(info.xorgo - x, info.yorg + y); Pixelate(info.xorgo - x, info.yorgo - y); Pixelate(info.xorg + x, info.yorgo - y); MIARCSTEP(;,;); } } else { while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(;); if ((x == info.start.x) || (y == info.start.y)) { mask = info.start.mask; info.start = info.altstart; } DoPix(0, info.xorg + x, info.yorg + y); DoPix(1, info.xorgo - x, info.yorg + y); DoPix(2, info.xorgo - x, info.yorgo - y); DoPix(3, info.xorg + x, info.yorgo - y); if ((x == info.end.x) || (y == info.end.y)) { mask = info.end.mask; info.end = info.altend; } MIARCSTEP(;,;); } } if ((x == info.start.x) || (y == info.start.y)) mask = info.start.mask; DoPix(0, info.xorg + x, info.yorg + y); DoPix(2, info.xorgo - x, info.yorgo - y); if (arc->height & 1) { DoPix(1, info.xorgo - x, info.yorg + y); DoPix(3, info.xorg + x, info.yorgo - y); } return pts; } #undef DoPix #define DoPix(idx,xval,yval) \ if (mask & (1 << idx)) \ { \ arcPts[idx]->x = xval; \ arcPts[idx]->y = yval; \ arcPts[idx]++; \ } static void miZeroArcDashPts( GCPtr pGC, xArc *arc, DashInfo *dinfo, register DDXPointPtr points, int maxPts, register DDXPointPtr *evenPts, register DDXPointPtr *oddPts ) { miZeroArcRec info; register int x, y, a, b, d, mask; register int k1, k3, dx, dy; int dashRemaining; DDXPointPtr arcPts[4]; DDXPointPtr startPts[5], endPts[5]; int deltas[5]; DDXPointPtr startPt, pt, lastPt, pts; int i, j, delta, ptsdelta, seg, startseg; for (i = 0; i < 4; i++) arcPts[i] = points + (i * maxPts); (void)miZeroArcSetup(arc, &info, FALSE); MIARCSETUP(); mask = info.initialMask; startseg = info.startAngle / QUADRANT; startPt = arcPts[startseg]; if (!(arc->width & 1)) { DoPix(1, info.xorgo, info.yorg); DoPix(3, info.xorgo, info.yorgo); } if (!info.end.x || !info.end.y) { mask = info.end.mask; info.end = info.altend; } while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(;); if ((x == info.firstx) || (y == info.firsty)) startPt = arcPts[startseg]; if ((x == info.start.x) || (y == info.start.y)) { mask = info.start.mask; info.start = info.altstart; } DoPix(0, info.xorg + x, info.yorg + y); DoPix(1, info.xorgo - x, info.yorg + y); DoPix(2, info.xorgo - x, info.yorgo - y); DoPix(3, info.xorg + x, info.yorgo - y); if ((x == info.end.x) || (y == info.end.y)) { mask = info.end.mask; info.end = info.altend; } MIARCSTEP(;,;); } if ((x == info.firstx) || (y == info.firsty)) startPt = arcPts[startseg]; if ((x == info.start.x) || (y == info.start.y)) mask = info.start.mask; DoPix(0, info.xorg + x, info.yorg + y); DoPix(2, info.xorgo - x, info.yorgo - y); if (arc->height & 1) { DoPix(1, info.xorgo - x, info.yorg + y); DoPix(3, info.xorg + x, info.yorgo - y); } for (i = 0; i < 4; i++) { seg = (startseg + i) & 3; pt = points + (seg * maxPts); if (seg & 1) { startPts[i] = pt; endPts[i] = arcPts[seg]; deltas[i] = 1; } else { startPts[i] = arcPts[seg] - 1; endPts[i] = pt - 1; deltas[i] = -1; } } startPts[4] = startPts[0]; endPts[4] = startPt; startPts[0] = startPt; if (startseg & 1) { if (startPts[4] != endPts[4]) endPts[4]--; deltas[4] = 1; } else { if (startPts[0] > startPts[4]) startPts[0]--; if (startPts[4] < endPts[4]) endPts[4]--; deltas[4] = -1; } if (arc->angle2 < 0) { DDXPointPtr tmps, tmpe; int tmpd; tmpd = deltas[0]; tmps = startPts[0] - tmpd; tmpe = endPts[0] - tmpd; startPts[0] = endPts[4] - deltas[4]; endPts[0] = startPts[4] - deltas[4]; deltas[0] = -deltas[4]; startPts[4] = tmpe; endPts[4] = tmps; deltas[4] = -tmpd; tmpd = deltas[1]; tmps = startPts[1] - tmpd; tmpe = endPts[1] - tmpd; startPts[1] = endPts[3] - deltas[3]; endPts[1] = startPts[3] - deltas[3]; deltas[1] = -deltas[3]; startPts[3] = tmpe; endPts[3] = tmps; deltas[3] = -tmpd; tmps = startPts[2] - deltas[2]; startPts[2] = endPts[2] - deltas[2]; endPts[2] = tmps; deltas[2] = -deltas[2]; } for (i = 0; i < 5 && startPts[i] == endPts[i]; i++) ; if (i == 5) return; pt = startPts[i]; for (j = 4; startPts[j] == endPts[j]; j--) ; lastPt = endPts[j] - deltas[j]; if (dinfo->haveLast && (pt->x == dinfo->endPt.x) && (pt->y == dinfo->endPt.y)) { startPts[i] += deltas[i]; } else { dinfo->dashIndex = dinfo->dashIndexInit; dinfo->dashOffset = dinfo->dashOffsetInit; } if (!dinfo->skipStart && (info.startAngle != info.endAngle)) { dinfo->startPt = *pt; dinfo->haveStart = TRUE; } else if (!dinfo->skipLast && dinfo->haveStart && (lastPt->x == dinfo->startPt.x) && (lastPt->y == dinfo->startPt.y) && (lastPt != startPts[i])) endPts[j] = lastPt; if (info.startAngle != info.endAngle) { dinfo->haveLast = TRUE; dinfo->endPt = *lastPt; } dashRemaining = pGC->dash[dinfo->dashIndex] - dinfo->dashOffset; for (i = 0; i < 5; i++) { pt = startPts[i]; lastPt = endPts[i]; delta = deltas[i]; while (pt != lastPt) { if (dinfo->dashIndex & 1) { pts = *oddPts; ptsdelta = -1; } else { pts = *evenPts; ptsdelta = 1; } while ((pt != lastPt) && --dashRemaining >= 0) { *pts = *pt; pts += ptsdelta; pt += delta; } if (dinfo->dashIndex & 1) *oddPts = pts; else *evenPts = pts; if (dashRemaining <= 0) { if (++(dinfo->dashIndex) == pGC->numInDashList) dinfo->dashIndex = 0; dashRemaining = pGC->dash[dinfo->dashIndex]; } } } dinfo->dashOffset = pGC->dash[dinfo->dashIndex] - dashRemaining; } void miZeroPolyArc(pDraw, pGC, narcs, parcs) DrawablePtr pDraw; GCPtr pGC; int narcs; xArc *parcs; { int maxPts = 0; register int n, maxw = 0; register xArc *arc; register int i; DDXPointPtr points, pts, oddPts = NULL; register DDXPointPtr pt; int numPts; Bool dospans; int *widths = NULL; XID fgPixel = pGC->fgPixel; DashInfo dinfo; for (arc = parcs, i = narcs; --i >= 0; arc++) { if (!miCanZeroArc(arc)) miPolyArc(pDraw, pGC, 1, arc); else { if (arc->width > arc->height) n = arc->width + (arc->height >> 1); else n = arc->height + (arc->width >> 1); if (n > maxPts) maxPts = n; } } if (!maxPts) return; numPts = maxPts << 2; dospans = (pGC->fillStyle != FillSolid); if (dospans) { widths = (int *)malloc(sizeof(int) * numPts); if (!widths) return; maxw = 0; } if (pGC->lineStyle != LineSolid) { numPts <<= 1; dinfo.haveStart = FALSE; dinfo.skipStart = FALSE; dinfo.haveLast = FALSE; dinfo.dashIndexInit = 0; dinfo.dashOffsetInit = 0; miStepDash((int)pGC->dashOffset, &dinfo.dashIndexInit, (unsigned char *) pGC->dash, (int)pGC->numInDashList, &dinfo.dashOffsetInit); } points = (DDXPointPtr)malloc(sizeof(DDXPointRec) * numPts); if (!points) { if (dospans) { free(widths); } return; } for (arc = parcs, i = narcs; --i >= 0; arc++) { if (miCanZeroArc(arc)) { if (pGC->lineStyle == LineSolid) pts = miZeroArcPts(arc, points); else { pts = points; oddPts = &points[(numPts >> 1) - 1]; dinfo.skipLast = i; miZeroArcDashPts(pGC, arc, &dinfo, oddPts + 1, maxPts, &pts, &oddPts); dinfo.skipStart = TRUE; } n = pts - points; if (!dospans) (*pGC->ops->PolyPoint)(pDraw, pGC, CoordModeOrigin, n, points); else { if (n > maxw) { while (maxw < n) widths[maxw++] = 1; } if (pGC->miTranslate) { for (pt = points; pt != pts; pt++) { pt->x += pDraw->x; pt->y += pDraw->y; } } (*pGC->ops->FillSpans)(pDraw, pGC, n, points, widths, FALSE); } if (pGC->lineStyle != LineDoubleDash) continue; if ((pGC->fillStyle == FillSolid) || (pGC->fillStyle == FillStippled)) { DoChangeGC(pGC, GCForeground, (XID *)&pGC->bgPixel, 0); ValidateGC(pDraw, pGC); } pts = &points[numPts >> 1]; oddPts++; n = pts - oddPts; if (!dospans) (*pGC->ops->PolyPoint)(pDraw, pGC, CoordModeOrigin, n, oddPts); else { if (n > maxw) { while (maxw < n) widths[maxw++] = 1; } if (pGC->miTranslate) { for (pt = oddPts; pt != pts; pt++) { pt->x += pDraw->x; pt->y += pDraw->y; } } (*pGC->ops->FillSpans)(pDraw, pGC, n, oddPts, widths, FALSE); } if ((pGC->fillStyle == FillSolid) || (pGC->fillStyle == FillStippled)) { DoChangeGC(pGC, GCForeground, &fgPixel, 0); ValidateGC(pDraw, pGC); } } } free(points); if (dospans) { free(widths); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mizerarc.h0000644000000000000000000000556213614532331017175 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ********************************************************/ typedef struct { int x; int y; int mask; } miZeroArcPtRec; typedef struct { int x, y, k1, k3, a, b, d, dx, dy; int alpha, beta; int xorg, yorg; int xorgo, yorgo; int w, h; int initialMask; miZeroArcPtRec start, altstart, end, altend; int firstx, firsty; int startAngle, endAngle; } miZeroArcRec; #define miCanZeroArc(arc) (((arc)->width == (arc)->height) || \ (((arc)->width <= 800) && ((arc)->height <= 800))) #define MIARCSETUP() \ x = info.x; \ y = info.y; \ k1 = info.k1; \ k3 = info.k3; \ a = info.a; \ b = info.b; \ d = info.d; \ dx = info.dx; \ dy = info.dy #define MIARCOCTANTSHIFT(clause) \ if (a < 0) \ { \ if (y == info.h) \ { \ d = -1; \ a = b = k1 = 0; \ } \ else \ { \ dx = (k1 << 1) - k3; \ k1 = dx - k1; \ k3 = -k3; \ b = b + a - (k1 >> 1); \ d = b + ((-a) >> 1) - d + (k3 >> 3); \ if (dx < 0) \ a = -((-dx) >> 1) - a; \ else \ a = (dx >> 1) - a; \ dx = 0; \ dy = 1; \ clause \ } \ } #define MIARCSTEP(move1,move2) \ b -= k1; \ if (d < 0) \ { \ x += dx; \ y += dy; \ a += k1; \ d += b; \ move1 \ } \ else \ { \ x++; \ y++; \ a += k3; \ d -= a; \ move2 \ } #define MIARCCIRCLESTEP(clause) \ b -= k1; \ x++; \ if (d < 0) \ { \ a += k1; \ d += b; \ } \ else \ { \ y++; \ a += k3; \ d -= a; \ clause \ } /* mizerarc.c */ extern Bool miZeroArcSetup( xArc * /*arc*/, miZeroArcRec * /*info*/, Bool /*ok360*/ ); extern DDXPointPtr miZeroArcPts( xArc * /*arc*/, DDXPointPtr /*pts*/ ); nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mizerclip.c0000644000000000000000000004702113614532331017346 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "misc.h" #include "scrnintstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmap.h" #include "mi.h" #include "miline.h" /* The bresenham error equation used in the mi/mfb/cfb line routines is: e = error dx = difference in raw X coordinates dy = difference in raw Y coordinates M = # of steps in X direction N = # of steps in Y direction B = 0 to prefer diagonal steps in a given octant, 1 to prefer axial steps in a given octant For X major lines: e = 2Mdy - 2Ndx - dx - B -2dx <= e < 0 For Y major lines: e = 2Ndx - 2Mdy - dy - B -2dy <= e < 0 At the start of the line, we have taken 0 X steps and 0 Y steps, so M = 0 and N = 0: X major e = 2Mdy - 2Ndx - dx - B = -dx - B Y major e = 2Ndx - 2Mdy - dy - B = -dy - B At the end of the line, we have taken dx X steps and dy Y steps, so M = dx and N = dy: X major e = 2Mdy - 2Ndx - dx - B = 2dxdy - 2dydx - dx - B = -dx - B Y major e = 2Ndx - 2Mdy - dy - B = 2dydx - 2dxdy - dy - B = -dy - B Thus, the error term is the same at the start and end of the line. Let us consider clipping an X coordinate. There are 4 cases which represent the two independent cases of clipping the start vs. the end of the line and an X major vs. a Y major line. In any of these cases, we know the number of X steps (M) and we wish to find the number of Y steps (N). Thus, we will solve our error term equation. If we are clipping the start of the line, we will find the smallest N that satisfies our error term inequality. If we are clipping the end of the line, we will find the largest number of Y steps that satisfies the inequality. In that case, since we are representing the Y steps as (dy - N), we will actually want to solve for the smallest N in that equation. Case 1: X major, starting X coordinate moved by M steps -2dx <= 2Mdy - 2Ndx - dx - B < 0 2Ndx <= 2Mdy - dx - B + 2dx 2Ndx > 2Mdy - dx - B 2Ndx <= 2Mdy + dx - B N > (2Mdy - dx - B) / 2dx N <= (2Mdy + dx - B) / 2dx Since we are trying to find the smallest N that satisfies these equations, we should use the > inequality to find the smallest: N = floor((2Mdy - dx - B) / 2dx) + 1 = floor((2Mdy - dx - B + 2dx) / 2dx) = floor((2Mdy + dx - B) / 2dx) Case 1b: X major, ending X coordinate moved to M steps Same derivations as Case 1, but we want the largest N that satisfies the equations, so we use the <= inequality: N = floor((2Mdy + dx - B) / 2dx) Case 2: X major, ending X coordinate moved by M steps -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0 -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0 -2dx <= 2Ndx - 2Mdy - dx - B < 0 2Ndx >= 2Mdy + dx + B - 2dx 2Ndx < 2Mdy + dx + B 2Ndx >= 2Mdy - dx + B N < (2Mdy + dx + B) / 2dx N >= (2Mdy - dx + B) / 2dx Since we are trying to find the highest number of Y steps that satisfies these equations, we need to find the smallest N, so we should use the >= inequality to find the smallest: N = ceiling((2Mdy - dx + B) / 2dx) = floor((2Mdy - dx + B + 2dx - 1) / 2dx) = floor((2Mdy + dx + B - 1) / 2dx) Case 2b: X major, starting X coordinate moved to M steps from end Same derivations as Case 2, but we want the smallest number of Y steps, so we want the highest N, so we use the < inequality: N = ceiling((2Mdy + dx + B) / 2dx) - 1 = floor((2Mdy + dx + B + 2dx - 1) / 2dx) - 1 = floor((2Mdy + dx + B + 2dx - 1 - 2dx) / 2dx) = floor((2Mdy + dx + B - 1) / 2dx) Case 3: Y major, starting X coordinate moved by M steps -2dy <= 2Ndx - 2Mdy - dy - B < 0 2Ndx >= 2Mdy + dy + B - 2dy 2Ndx < 2Mdy + dy + B 2Ndx >= 2Mdy - dy + B N < (2Mdy + dy + B) / 2dx N >= (2Mdy - dy + B) / 2dx Since we are trying to find the smallest N that satisfies these equations, we should use the >= inequality to find the smallest: N = ceiling((2Mdy - dy + B) / 2dx) = floor((2Mdy - dy + B + 2dx - 1) / 2dx) = floor((2Mdy - dy + B - 1) / 2dx) + 1 Case 3b: Y major, ending X coordinate moved to M steps Same derivations as Case 3, but we want the largest N that satisfies the equations, so we use the < inequality: N = ceiling((2Mdy + dy + B) / 2dx) - 1 = floor((2Mdy + dy + B + 2dx - 1) / 2dx) - 1 = floor((2Mdy + dy + B + 2dx - 1 - 2dx) / 2dx) = floor((2Mdy + dy + B - 1) / 2dx) Case 4: Y major, ending X coordinate moved by M steps -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0 -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0 -2dy <= 2Mdy - 2Ndx - dy - B < 0 2Ndx <= 2Mdy - dy - B + 2dy 2Ndx > 2Mdy - dy - B 2Ndx <= 2Mdy + dy - B N > (2Mdy - dy - B) / 2dx N <= (2Mdy + dy - B) / 2dx Since we are trying to find the highest number of Y steps that satisfies these equations, we need to find the smallest N, so we should use the > inequality to find the smallest: N = floor((2Mdy - dy - B) / 2dx) + 1 Case 4b: Y major, starting X coordinate moved to M steps from end Same analysis as Case 4, but we want the smallest number of Y steps which means the largest N, so we use the <= inequality: N = floor((2Mdy + dy - B) / 2dx) Now let's try the Y coordinates, we have the same 4 cases. Case 5: X major, starting Y coordinate moved by N steps -2dx <= 2Mdy - 2Ndx - dx - B < 0 2Mdy >= 2Ndx + dx + B - 2dx 2Mdy < 2Ndx + dx + B 2Mdy >= 2Ndx - dx + B M < (2Ndx + dx + B) / 2dy M >= (2Ndx - dx + B) / 2dy Since we are trying to find the smallest M, we use the >= inequality: M = ceiling((2Ndx - dx + B) / 2dy) = floor((2Ndx - dx + B + 2dy - 1) / 2dy) = floor((2Ndx - dx + B - 1) / 2dy) + 1 Case 5b: X major, ending Y coordinate moved to N steps Same derivations as Case 5, but we want the largest M that satisfies the equations, so we use the < inequality: M = ceiling((2Ndx + dx + B) / 2dy) - 1 = floor((2Ndx + dx + B + 2dy - 1) / 2dy) - 1 = floor((2Ndx + dx + B + 2dy - 1 - 2dy) / 2dy) = floor((2Ndx + dx + B - 1) / 2dy) Case 6: X major, ending Y coordinate moved by N steps -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0 -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0 -2dx <= 2Ndx - 2Mdy - dx - B < 0 2Mdy <= 2Ndx - dx - B + 2dx 2Mdy > 2Ndx - dx - B 2Mdy <= 2Ndx + dx - B M > (2Ndx - dx - B) / 2dy M <= (2Ndx + dx - B) / 2dy Largest # of X steps means smallest M, so use the > inequality: M = floor((2Ndx - dx - B) / 2dy) + 1 Case 6b: X major, starting Y coordinate moved to N steps from end Same derivations as Case 6, but we want the smallest # of X steps which means the largest M, so use the <= inequality: M = floor((2Ndx + dx - B) / 2dy) Case 7: Y major, starting Y coordinate moved by N steps -2dy <= 2Ndx - 2Mdy - dy - B < 0 2Mdy <= 2Ndx - dy - B + 2dy 2Mdy > 2Ndx - dy - B 2Mdy <= 2Ndx + dy - B M > (2Ndx - dy - B) / 2dy M <= (2Ndx + dy - B) / 2dy To find the smallest M, use the > inequality: M = floor((2Ndx - dy - B) / 2dy) + 1 = floor((2Ndx - dy - B + 2dy) / 2dy) = floor((2Ndx + dy - B) / 2dy) Case 7b: Y major, ending Y coordinate moved to N steps Same derivations as Case 7, but we want the largest M that satisfies the equations, so use the <= inequality: M = floor((2Ndx + dy - B) / 2dy) Case 8: Y major, ending Y coordinate moved by N steps -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0 -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0 -2dy <= 2Mdy - 2Ndx - dy - B < 0 2Mdy >= 2Ndx + dy + B - 2dy 2Mdy < 2Ndx + dy + B 2Mdy >= 2Ndx - dy + B M < (2Ndx + dy + B) / 2dy M >= (2Ndx - dy + B) / 2dy To find the highest X steps, find the smallest M, use the >= inequality: M = ceiling((2Ndx - dy + B) / 2dy) = floor((2Ndx - dy + B + 2dy - 1) / 2dy) = floor((2Ndx + dy + B - 1) / 2dy) Case 8b: Y major, starting Y coordinate moved to N steps from the end Same derivations as Case 8, but we want to find the smallest # of X steps which means the largest M, so we use the < inequality: M = ceiling((2Ndx + dy + B) / 2dy) - 1 = floor((2Ndx + dy + B + 2dy - 1) / 2dy) - 1 = floor((2Ndx + dy + B + 2dy - 1 - 2dy) / 2dy) = floor((2Ndx + dy + B - 1) / 2dy) So, our equations are: 1: X major move x1 to x1+M floor((2Mdy + dx - B) / 2dx) 1b: X major move x2 to x1+M floor((2Mdy + dx - B) / 2dx) 2: X major move x2 to x2-M floor((2Mdy + dx + B - 1) / 2dx) 2b: X major move x1 to x2-M floor((2Mdy + dx + B - 1) / 2dx) 3: Y major move x1 to x1+M floor((2Mdy - dy + B - 1) / 2dx) + 1 3b: Y major move x2 to x1+M floor((2Mdy + dy + B - 1) / 2dx) 4: Y major move x2 to x2-M floor((2Mdy - dy - B) / 2dx) + 1 4b: Y major move x1 to x2-M floor((2Mdy + dy - B) / 2dx) 5: X major move y1 to y1+N floor((2Ndx - dx + B - 1) / 2dy) + 1 5b: X major move y2 to y1+N floor((2Ndx + dx + B - 1) / 2dy) 6: X major move y2 to y2-N floor((2Ndx - dx - B) / 2dy) + 1 6b: X major move y1 to y2-N floor((2Ndx + dx - B) / 2dy) 7: Y major move y1 to y1+N floor((2Ndx + dy - B) / 2dy) 7b: Y major move y2 to y1+N floor((2Ndx + dy - B) / 2dy) 8: Y major move y2 to y2-N floor((2Ndx + dy + B - 1) / 2dy) 8b: Y major move y1 to y2-N floor((2Ndx + dy + B - 1) / 2dy) We have the following constraints on all of the above terms: 0 < M,N <= 2^15 2^15 can be imposed by miZeroClipLine 0 <= dx/dy <= 2^16 - 1 0 <= B <= 1 The floor in all of the above equations can be accomplished with a simple C divide operation provided that both numerator and denominator are positive. Since dx,dy >= 0 and since moving an X coordinate implies that dx != 0 and moving a Y coordinate implies dy != 0, we know that the denominators are all > 0. For all lines, (-B) and (B-1) are both either 0 or -1, depending on the bias. Thus, we have to show that the 2MNdxy +/- dxy terms are all >= 1 or > 0 to prove that the numerators are positive (or zero). For X Major lines we know that dx > 0 and since 2Mdy is >= 0 due to the constraints, the first four equations all have numerators >= 0. For the second four equations, M > 0, so 2Mdy >= 2dy so (2Mdy - dy) >= dy So (2Mdy - dy) > 0, since they are Y major lines. Also, (2Mdy + dy) >= 3dy or (2Mdy + dy) > 0. So all of their numerators are >= 0. For the third set of four equations, N > 0, so 2Ndx >= 2dx so (2Ndx - dx) >= dx > 0. Similarly (2Ndx + dx) >= 3dx > 0. So all numerators >= 0. For the fourth set of equations, dy > 0 and 2Ndx >= 0, so all numerators are > 0. To consider overflow, consider the case of 2 * M,N * dx,dy + dx,dy. This is bounded <= 2 * 2^15 * (2^16 - 1) + (2^16 - 1) <= 2^16 * (2^16 - 1) + (2^16 - 1) <= 2^32 - 2^16 + 2^16 - 1 <= 2^32 - 1 Since the (-B) and (B-1) terms are all 0 or -1, the maximum value of the numerator is therefore (2^32 - 1), which does not overflow an unsigned 32 bit variable. */ /* Bit codes for the terms of the 16 clipping equations defined below. */ #define T_2NDX (1 << 0) #define T_2MDY (0) /* implicit term */ #define T_DXNOTY (1 << 1) #define T_DYNOTX (0) /* implicit term */ #define T_SUBDXORY (1 << 2) #define T_ADDDX (T_DXNOTY) /* composite term */ #define T_SUBDX (T_DXNOTY | T_SUBDXORY) /* composite term */ #define T_ADDDY (T_DYNOTX) /* composite term */ #define T_SUBDY (T_DYNOTX | T_SUBDXORY) /* composite term */ #define T_BIASSUBONE (1 << 3) #define T_SUBBIAS (0) /* implicit term */ #define T_DIV2DX (1 << 4) #define T_DIV2DY (0) /* implicit term */ #define T_ADDONE (1 << 5) /* Bit masks defining the 16 equations used in miZeroClipLine. */ #define EQN1 (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX) #define EQN1B (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX) #define EQN2 (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX) #define EQN2B (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX) #define EQN3 (T_2MDY | T_SUBDY | T_BIASSUBONE | T_DIV2DX | T_ADDONE) #define EQN3B (T_2MDY | T_ADDDY | T_BIASSUBONE | T_DIV2DX) #define EQN4 (T_2MDY | T_SUBDY | T_SUBBIAS | T_DIV2DX | T_ADDONE) #define EQN4B (T_2MDY | T_ADDDY | T_SUBBIAS | T_DIV2DX) #define EQN5 (T_2NDX | T_SUBDX | T_BIASSUBONE | T_DIV2DY | T_ADDONE) #define EQN5B (T_2NDX | T_ADDDX | T_BIASSUBONE | T_DIV2DY) #define EQN6 (T_2NDX | T_SUBDX | T_SUBBIAS | T_DIV2DY | T_ADDONE) #define EQN6B (T_2NDX | T_ADDDX | T_SUBBIAS | T_DIV2DY) #define EQN7 (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY) #define EQN7B (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY) #define EQN8 (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY) #define EQN8B (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY) /* miZeroClipLine * * returns: 1 for partially clipped line * -1 for completely clipped line * */ int miZeroClipLine(xmin, ymin, xmax, ymax, new_x1, new_y1, new_x2, new_y2, adx, ady, pt1_clipped, pt2_clipped, octant, bias, oc1, oc2) int xmin, ymin, xmax, ymax; int *new_x1, *new_y1, *new_x2, *new_y2; int *pt1_clipped, *pt2_clipped; unsigned int adx, ady; int octant; unsigned int bias; int oc1, oc2; { int swapped = 0; int clipDone = 0; CARD32 utmp = 0; int clip1, clip2; int x1, y1, x2, y2; int x1_orig, y1_orig, x2_orig, y2_orig; int xmajor; int negslope = 0, anchorval = 0; unsigned int eqn = 0; x1 = x1_orig = *new_x1; y1 = y1_orig = *new_y1; x2 = x2_orig = *new_x2; y2 = y2_orig = *new_y2; clip1 = 0; clip2 = 0; xmajor = IsXMajorOctant(octant); bias = ((bias >> octant) & 1); while (1) { if ((oc1 & oc2) != 0) /* trivial reject */ { clipDone = -1; clip1 = oc1; clip2 = oc2; break; } else if ((oc1 | oc2) == 0) /* trivial accept */ { clipDone = 1; if (swapped) { SWAPINT_PAIR(x1, y1, x2, y2); SWAPINT(clip1, clip2); } break; } else /* have to clip */ { /* only clip one point at a time */ if (oc1 == 0) { SWAPINT_PAIR(x1, y1, x2, y2); SWAPINT_PAIR(x1_orig, y1_orig, x2_orig, y2_orig); SWAPINT(oc1, oc2); SWAPINT(clip1, clip2); swapped = !swapped; } clip1 |= oc1; if (oc1 & OUT_LEFT) { negslope = IsYDecreasingOctant(octant); utmp = xmin - x1_orig; if (utmp <= 32767) /* clip based on near endpt */ { if (xmajor) eqn = (swapped) ? EQN2 : EQN1; else eqn = (swapped) ? EQN4 : EQN3; anchorval = y1_orig; } else /* clip based on far endpt */ { utmp = x2_orig - xmin; if (xmajor) eqn = (swapped) ? EQN1B : EQN2B; else eqn = (swapped) ? EQN3B : EQN4B; anchorval = y2_orig; negslope = !negslope; } x1 = xmin; } else if (oc1 & OUT_ABOVE) { negslope = IsXDecreasingOctant(octant); utmp = ymin - y1_orig; if (utmp <= 32767) /* clip based on near endpt */ { if (xmajor) eqn = (swapped) ? EQN6 : EQN5; else eqn = (swapped) ? EQN8 : EQN7; anchorval = x1_orig; } else /* clip based on far endpt */ { utmp = y2_orig - ymin; if (xmajor) eqn = (swapped) ? EQN5B : EQN6B; else eqn = (swapped) ? EQN7B : EQN8B; anchorval = x2_orig; negslope = !negslope; } y1 = ymin; } else if (oc1 & OUT_RIGHT) { negslope = IsYDecreasingOctant(octant); utmp = x1_orig - xmax; if (utmp <= 32767) /* clip based on near endpt */ { if (xmajor) eqn = (swapped) ? EQN2 : EQN1; else eqn = (swapped) ? EQN4 : EQN3; anchorval = y1_orig; } else /* clip based on far endpt */ { /* * Technically since the equations can handle * utmp == 32768, this overflow code isn't * needed since X11 protocol can't generate * a line which goes more than 32768 pixels * to the right of a clip rectangle. */ utmp = xmax - x2_orig; if (xmajor) eqn = (swapped) ? EQN1B : EQN2B; else eqn = (swapped) ? EQN3B : EQN4B; anchorval = y2_orig; negslope = !negslope; } x1 = xmax; } else if (oc1 & OUT_BELOW) { negslope = IsXDecreasingOctant(octant); utmp = y1_orig - ymax; if (utmp <= 32767) /* clip based on near endpt */ { if (xmajor) eqn = (swapped) ? EQN6 : EQN5; else eqn = (swapped) ? EQN8 : EQN7; anchorval = x1_orig; } else /* clip based on far endpt */ { /* * Technically since the equations can handle * utmp == 32768, this overflow code isn't * needed since X11 protocol can't generate * a line which goes more than 32768 pixels * below the bottom of a clip rectangle. */ utmp = ymax - y2_orig; if (xmajor) eqn = (swapped) ? EQN5B : EQN6B; else eqn = (swapped) ? EQN7B : EQN8B; anchorval = x2_orig; negslope = !negslope; } y1 = ymax; } if (swapped) negslope = !negslope; utmp <<= 1; /* utmp = 2N or 2M */ if (eqn & T_2NDX) utmp = (utmp * adx); else /* (eqn & T_2MDY) */ utmp = (utmp * ady); if (eqn & T_DXNOTY) if (eqn & T_SUBDXORY) utmp -= adx; else utmp += adx; else /* (eqn & T_DYNOTX) */ if (eqn & T_SUBDXORY) utmp -= ady; else utmp += ady; if (eqn & T_BIASSUBONE) utmp += bias - 1; else /* (eqn & T_SUBBIAS) */ utmp -= bias; if (eqn & T_DIV2DX) utmp /= (adx << 1); else /* (eqn & T_DIV2DY) */ utmp /= (ady << 1); if (eqn & T_ADDONE) utmp++; if (negslope) utmp = -utmp; if (eqn & T_2NDX) /* We are calculating X steps */ x1 = anchorval + utmp; else /* else, Y steps */ y1 = anchorval + utmp; oc1 = 0; MIOUTCODES(oc1, x1, y1, xmin, ymin, xmax, ymax); } } *new_x1 = x1; *new_y1 = y1; *new_x2 = x2; *new_y2 = y2; *pt1_clipped = clip1; *pt2_clipped = clip2; return clipDone; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/mi/mizerline.c0000644000000000000000000002305613614532331017350 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "misc.h" #include "scrnintstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmap.h" #include "mi.h" #include "miline.h" /* Draw lineSolid, fillStyle-independent zero width lines. * * Must keep X and Y coordinates in "ints" at least until after they're * translated and clipped to accomodate CoordModePrevious lines with very * large coordinates. * * Draws the same pixels regardless of sign(dx) or sign(dy). * * Ken Whaley * */ /* largest positive value that can fit into a component of a point. * Assumes that the point structure is {type x, y;} where type is * a signed type. */ #define MAX_COORDINATE ((1 << (((sizeof(DDXPointRec) >> 1) << 3) - 1)) - 1) #define MI_OUTPUT_POINT(xx, yy)\ {\ if ( !new_span && yy == current_y)\ {\ if (xx < spans->x)\ spans->x = xx;\ ++*widths;\ }\ else\ {\ ++Nspans;\ ++spans;\ ++widths;\ spans->x = xx;\ spans->y = yy;\ *widths = 1;\ current_y = yy;\ new_span = FALSE;\ }\ } void miZeroLine(pDraw, pGC, mode, npt, pptInit) DrawablePtr pDraw; GCPtr pGC; int mode; /* Origin or Previous */ int npt; /* number of points */ DDXPointPtr pptInit; { int Nspans, current_y = 0; DDXPointPtr ppt; DDXPointPtr pspanInit, spans; int *pwidthInit, *widths, list_len; int xleft, ytop, xright, ybottom; int new_x1, new_y1, new_x2, new_y2; int x = 0, y = 0, x1, y1, x2, y2, xstart, ystart; int oc1, oc2; int result; int pt1_clipped, pt2_clipped = 0; Bool new_span; int signdx, signdy; int clipdx, clipdy; int width, height; int adx, ady; int octant; unsigned int bias = miGetZeroLineBias(pDraw->pScreen); int e, e1, e2, e3; /* Bresenham error terms */ int length; /* length of lines == # of pixels on major axis */ xleft = pDraw->x; ytop = pDraw->y; xright = pDraw->x + pDraw->width - 1; ybottom = pDraw->y + pDraw->height - 1; if (!pGC->miTranslate) { /* do everything in drawable-relative coordinates */ xleft = 0; ytop = 0; xright -= pDraw->x; ybottom -= pDraw->y; } /* it doesn't matter whether we're in drawable or screen coordinates, * FillSpans simply cannot take starting coordinates outside of the * range of a DDXPointRec component. */ if (xright > MAX_COORDINATE) xright = MAX_COORDINATE; if (ybottom > MAX_COORDINATE) ybottom = MAX_COORDINATE; /* since we're clipping to the drawable's boundaries & coordinate * space boundaries, we're guaranteed that the larger of width/height * is the longest span we'll need to output */ width = xright - xleft + 1; height = ybottom - ytop + 1; list_len = (height >= width) ? height : width; pspanInit = (DDXPointPtr)malloc(list_len * sizeof(DDXPointRec)); pwidthInit = (int *)malloc(list_len * sizeof(int)); if (!pspanInit || !pwidthInit) { free(pspanInit); free(pwidthInit); return; } Nspans = 0; new_span = TRUE; spans = pspanInit - 1; widths = pwidthInit - 1; ppt = pptInit; xstart = ppt->x; ystart = ppt->y; if (pGC->miTranslate) { xstart += pDraw->x; ystart += pDraw->y; } /* x2, y2, oc2 copied to x1, y1, oc1 at top of loop to simplify * iteration logic */ x2 = xstart; y2 = ystart; oc2 = 0; MIOUTCODES(oc2, x2, y2, xleft, ytop, xright, ybottom); while (--npt > 0) { if (Nspans > 0) (*pGC->ops->FillSpans)(pDraw, pGC, Nspans, pspanInit, pwidthInit, FALSE); Nspans = 0; new_span = TRUE; spans = pspanInit - 1; widths = pwidthInit - 1; x1 = x2; y1 = y2; oc1 = oc2; ++ppt; x2 = ppt->x; y2 = ppt->y; if (pGC->miTranslate && (mode != CoordModePrevious)) { x2 += pDraw->x; y2 += pDraw->y; } else if (mode == CoordModePrevious) { x2 += x1; y2 += y1; } oc2 = 0; MIOUTCODES(oc2, x2, y2, xleft, ytop, xright, ybottom); CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); if (adx > ady) { e1 = ady << 1; e2 = e1 - (adx << 1); e = e1 - adx; length = adx; /* don't draw endpoint in main loop */ FIXUP_ERROR(e, octant, bias); new_x1 = x1; new_y1 = y1; new_x2 = x2; new_y2 = y2; pt1_clipped = 0; pt2_clipped = 0; if ((oc1 | oc2) != 0) { result = miZeroClipLine(xleft, ytop, xright, ybottom, &new_x1, &new_y1, &new_x2, &new_y2, adx, ady, &pt1_clipped, &pt2_clipped, octant, bias, oc1, oc2); if (result == -1) continue; length = abs(new_x2 - new_x1); /* if we've clipped the endpoint, always draw the full length * of the segment, because then the capstyle doesn't matter */ if (pt2_clipped) length++; if (pt1_clipped) { /* must calculate new error terms */ clipdx = abs(new_x1 - x1); clipdy = abs(new_y1 - y1); e += (clipdy * e2) + ((clipdx - clipdy) * e1); } } /* draw the segment */ x = new_x1; y = new_y1; e3 = e2 - e1; e = e - e1; while (length--) { MI_OUTPUT_POINT(x, y); e += e1; if (e >= 0) { y += signdy; e += e3; } x += signdx; } } else /* Y major line */ { e1 = adx << 1; e2 = e1 - (ady << 1); e = e1 - ady; length = ady; /* don't draw endpoint in main loop */ SetYMajorOctant(octant); FIXUP_ERROR(e, octant, bias); new_x1 = x1; new_y1 = y1; new_x2 = x2; new_y2 = y2; pt1_clipped = 0; pt2_clipped = 0; if ((oc1 | oc2) != 0) { result = miZeroClipLine(xleft, ytop, xright, ybottom, &new_x1, &new_y1, &new_x2, &new_y2, adx, ady, &pt1_clipped, &pt2_clipped, octant, bias, oc1, oc2); if (result == -1) continue; length = abs(new_y2 - new_y1); /* if we've clipped the endpoint, always draw the full length * of the segment, because then the capstyle doesn't matter */ if (pt2_clipped) length++; if (pt1_clipped) { /* must calculate new error terms */ clipdx = abs(new_x1 - x1); clipdy = abs(new_y1 - y1); e += (clipdx * e2) + ((clipdy - clipdx) * e1); } } /* draw the segment */ x = new_x1; y = new_y1; e3 = e2 - e1; e = e - e1; while (length--) { MI_OUTPUT_POINT(x, y); e += e1; if (e >= 0) { x += signdx; e += e3; } y += signdy; } } } /* only do the capnotlast check on the last segment * and only if the endpoint wasn't clipped. And then, if the last * point is the same as the first point, do not draw it, unless the * line is degenerate */ if ( (! pt2_clipped) && (pGC->capStyle != CapNotLast) && (((xstart != x2) || (ystart != y2)) || (ppt == pptInit + 1))) { MI_OUTPUT_POINT(x, y); } if (Nspans > 0) (*pGC->ops->FillSpans)(pDraw, pGC, Nspans, pspanInit, pwidthInit, FALSE); free(pwidthInit); free(pspanInit); } void miZeroDashLine(dst, pgc, mode, nptInit, pptInit) DrawablePtr dst; GCPtr pgc; int mode; int nptInit; /* number of points in polyline */ DDXPointRec *pptInit; /* points in the polyline */ { /* XXX kludge until real zero-width dash code is written */ pgc->lineWidth = 1; miWideDash (dst, pgc, mode, nptInit, pptInit); pgc->lineWidth = 0; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/access.c0000644000000000000000000015374213614532331016635 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Copyright 2004 Sun Microsystems, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. X Window System is a trademark of The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #define XSERV_t #define TRANS_SERVER #define TRANS_REOPEN #include #include #include #include #include "misc.h" #include "site.h" #include #include #include #include #include #if defined(TCPCONN) #include #endif /* TCPCONN */ #ifdef HAS_GETPEERUCRED # include # ifdef sun # include # endif #endif #if defined(SVR4) || (defined(SYSV) && defined(__i386__)) || defined(__GNU__) # include #endif #if defined(SYSV) && defined(__i386__) # include #endif #ifdef __GNU__ #undef SIOCGIFCONF #include #else /*!__GNU__*/ # include #endif /*__GNU__ */ #ifdef SVR4 #include #include #endif #include #ifdef CSRG_BASED #include #if (BSD >= 199103) #define VARIABLE_IFREQ #endif #endif #ifdef BSD44SOCKETS #ifndef VARIABLE_IFREQ #define VARIABLE_IFREQ #endif #endif #ifdef HAS_GETIFADDRS #include #endif /* Solaris provides an extended interface SIOCGLIFCONF. Other systems * may have this as well, but the code has only been tested on Solaris * so far, so we only enable it there. Other platforms may be added as * needed. * * Test for Solaris commented out -- TSI @ UQV 2003.06.13 */ #ifdef SIOCGLIFCONF /* #if defined(sun) */ #define USE_SIOCGLIFCONF /* #endif */ #endif #ifndef PATH_MAX #include #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN #else #define PATH_MAX 1024 #endif #endif #endif #define X_INCLUDE_NETDB_H #include #include "dixstruct.h" #include "osdep.h" #ifdef XCSECURITY #define _SECURITY_SERVER #include #endif #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN #else #define PATH_MAX 1024 #endif #endif Bool defeatAccessControl = FALSE; #define acmp(a1, a2, len) memcmp((char *)(a1), (char *)(a2), len) #define acopy(a1, a2, len) memmove((char *)(a2), (char *)(a1), len) #define addrEqual(fam, address, length, host) \ ((fam) == (host)->family &&\ (length) == (host)->len &&\ !acmp (address, (host)->addr, length)) static int ConvertAddr(struct sockaddr * /*saddr*/, int * /*len*/, void ** /*addr*/); static int CheckAddr(int /*family*/, void * /*pAddr*/, unsigned /*length*/); static Bool NewHost(int /*family*/, void * /*addr*/, int /*len*/, int /* addingLocalHosts */); /* XFree86 bug #156: To keep track of which hosts were explicitly requested in /etc/X.hosts, we've added a requested field to the HOST struct, and a LocalHostRequested variable. These default to FALSE, but are set to TRUE in ResetHosts when reading in /etc/X.hosts. They are checked in DisableLocalHost(), which is called to disable the default local host entries when stronger authentication is turned on. */ typedef struct _host { short family; short len; unsigned char *addr; struct _host *next; int requested; } HOST; #define MakeHost(h,l) (h)=(HOST *) malloc(sizeof *(h)+(l));\ if (h) { \ (h)->addr=(unsigned char *) ((h) + 1);\ (h)->requested = FALSE; \ } #define FreeHost(h) free(h) static HOST *selfhosts = NULL; static HOST *validhosts = NULL; static int AccessEnabled = DEFAULT_ACCESS_CONTROL; static int LocalHostEnabled = FALSE; static int LocalHostRequested = FALSE; static int UsingXdmcp = FALSE; /* FamilyServerInterpreted implementation */ static Bool siAddrMatch(int family, void * addr, int len, HOST *host, ClientPtr client); static int siCheckAddr(const char *addrString, int length); static void siTypesInitialize(void); /* * called when authorization is not enabled to add the * local host to the access list */ void EnableLocalHost (void) { if (!UsingXdmcp) { LocalHostEnabled = TRUE; AddLocalHosts (); } } /* * called when authorization is enabled to keep us secure */ void DisableLocalHost (void) { HOST *self; if (!LocalHostRequested) /* Fix for XFree86 bug #156 */ LocalHostEnabled = FALSE; for (self = selfhosts; self; self = self->next) { if (!self->requested) /* Fix for XFree86 bug #156 */ (void) RemoveHost ((ClientPtr)NULL, self->family, self->len, (void *)self->addr); } } /* * called at init time when XDMCP will be used; xdmcp always * adds local hosts manually when needed */ void AccessUsingXdmcp (void) { UsingXdmcp = TRUE; LocalHostEnabled = FALSE; } #if ((defined(SVR4) && !defined(SCO325) && !defined(sun) && !defined(NCR))) && defined(SIOCGIFCONF) && !defined(USE_SIOCGLIFCONF) /* Deal with different SIOCGIFCONF ioctl semantics on these OSs */ static int ifioctl (int fd, int cmd, char *arg) { struct strioctl ioc; int ret; bzero((char *) &ioc, sizeof(ioc)); ioc.ic_cmd = cmd; ioc.ic_timout = 0; if (cmd == SIOCGIFCONF) { ioc.ic_len = ((struct ifconf *) arg)->ifc_len; ioc.ic_dp = ((struct ifconf *) arg)->ifc_buf; } else { ioc.ic_len = sizeof(struct ifreq); ioc.ic_dp = arg; } ret = ioctl(fd, I_STR, (char *) &ioc); if (ret >= 0 && cmd == SIOCGIFCONF) #ifdef SVR4 ((struct ifconf *) arg)->ifc_len = ioc.ic_len; #endif return(ret); } #else /* Case sun, SCO325 NCR and others */ #define ifioctl ioctl #endif /* ((SVR4 && !sun !SCO325 !NCR)) && SIOCGIFCONF */ /* * DefineSelf (fd): * * Define this host for access control. Find all the hosts the OS knows about * for this fd and add them to the selfhosts list. */ #ifdef WINTCP /* NCR Wollongong based TCP */ #include #include #include #include #include #include #include #include #include void DefineSelf (int fd) { /* * The Wolongong drivers used by NCR SVR4/MP-RAS don't understand the * socket IO calls that most other drivers seem to like. Because of * this, this routine must be special cased for NCR. Eventually, * this will be cleared up. */ struct ipb ifnet; struct in_ifaddr ifaddr; struct strioctl str; unsigned char *addr; register HOST *host; int family, len; if ((fd = open ("/dev/ip", O_RDWR, 0 )) < 0) Error ("Getting interface configuration (1)"); /* Indicate that we want to start at the begining */ ifnet.ib_next = (struct ipb *) 1; while (ifnet.ib_next) { str.ic_cmd = IPIOC_GETIPB; str.ic_timout = 0; str.ic_len = sizeof (struct ipb); str.ic_dp = (char *) &ifnet; if (ioctl (fd, (int) I_STR, (char *) &str) < 0) { close (fd); Error ("Getting interface configuration (2)"); } ifaddr.ia_next = (struct in_ifaddr *) ifnet.if_addrlist; str.ic_cmd = IPIOC_GETINADDR; str.ic_timout = 0; str.ic_len = sizeof (struct in_ifaddr); str.ic_dp = (char *) &ifaddr; if (ioctl (fd, (int) I_STR, (char *) &str) < 0) { close (fd); Error ("Getting interface configuration (3)"); } len = sizeof(struct sockaddr_in); family = ConvertAddr (IA_SIN(&ifaddr), &len, (void **)&addr); if (family == -1 || family == FamilyLocal) continue; for (host = selfhosts; host && !addrEqual (family, addr, len, host); host = host->next) ; if (host) continue; MakeHost(host,len) if (host) { host->family = family; host->len = len; acopy(addr, host->addr, len); host->next = selfhosts; selfhosts = host; } #ifdef XDMCP { struct sockaddr broad_addr; /* * If this isn't an Internet Address, don't register it. */ if (family != FamilyInternet) continue; /* * Ignore 'localhost' entries as they're not useful * on the other end of the wire. */ if (len == 4 && addr[0] == 127 && addr[1] == 0 && addr[2] == 0 && addr[3] == 1) continue; /* * Ignore '0.0.0.0' entries as they are * returned by some OSes for unconfigured NICs but they are * not useful on the other end of the wire. */ if (len == 4 && addr[0] == 0 && addr[1] == 0 && addr[2] == 0 && addr[3] == 0) continue; XdmcpRegisterConnection (family, (char *)addr, len); #define IA_BROADADDR(ia) ((struct sockaddr_in *)(&((struct in_ifaddr *)ia)->ia_broadaddr)) XdmcpRegisterBroadcastAddress ( (struct sockaddr_in *) IA_BROADADDR(&ifaddr)); #undef IA_BROADADDR } #endif /* XDMCP */ } close(fd); /* * add something of FamilyLocalHost */ for (host = selfhosts; host && !addrEqual(FamilyLocalHost, "", 0, host); host = host->next); if (!host) { MakeHost(host, 0); if (host) { host->family = FamilyLocalHost; host->len = 0; acopy("", host->addr, 0); host->next = selfhosts; selfhosts = host; } } } #else /* WINTCP */ #if !defined(SIOCGIFCONF) void DefineSelf (int fd) { #if !defined(TCPCONN) && !defined(UNIXCONN) return; #else register int n; int len; caddr_t addr; int family; register HOST *host; struct utsname name; register struct hostent *hp; union { struct sockaddr sa; struct sockaddr_in in; #if defined(IPv6) && defined(AF_INET6) struct sockaddr_in6 in6; #endif } saddr; struct sockaddr_in *inetaddr; struct sockaddr_in6 *inet6addr; struct sockaddr_in broad_addr; #ifdef XTHREADS_NEEDS_BYNAMEPARAMS _Xgethostbynameparams hparams; #endif /* Why not use gethostname()? Well, at least on my system, I've had to * make an ugly kernel patch to get a name longer than 8 characters, and * uname() lets me access to the whole string (it smashes release, you * see), whereas gethostname() kindly truncates it for me. */ uname(&name); hp = _XGethostbyname(name.nodename, hparams); if (hp != NULL) { saddr.sa.sa_family = hp->h_addrtype; switch (hp->h_addrtype) { case AF_INET: inetaddr = (struct sockaddr_in *) (&(saddr.sa)); acopy ( hp->h_addr, &(inetaddr->sin_addr), hp->h_length); len = sizeof(saddr.sa); break; #if defined(IPv6) && defined(AF_INET6) case AF_INET6: inet6addr = (struct sockaddr_in6 *) (&(saddr.sa)); acopy ( hp->h_addr, &(inet6addr->sin6_addr), hp->h_length); len = sizeof(saddr.in6); break; #endif default: goto DefineLocalHost; } family = ConvertAddr ( &(saddr.sa), &len, (void **)&addr); if ( family != -1 && family != FamilyLocal ) { for (host = selfhosts; host && !addrEqual (family, addr, len, host); host = host->next) ; if (!host) { /* add this host to the host list. */ MakeHost(host,len) if (host) { host->family = family; host->len = len; acopy ( addr, host->addr, len); host->next = selfhosts; selfhosts = host; } #ifdef XDMCP /* * If this is an Internet Address, but not the localhost * address (127.0.0.1), nor the bogus address (0.0.0.0), * register it. */ if (family == FamilyInternet && !(len == 4 && ((addr[0] == 127 && addr[1] == 0 && addr[2] == 0 && addr[3] == 1) || (addr[0] == 0 && addr[1] == 0 && addr[2] == 0 && addr[3] == 0))) ) { XdmcpRegisterConnection (family, (char *)addr, len); broad_addr = *inetaddr; ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr = htonl (INADDR_BROADCAST); XdmcpRegisterBroadcastAddress ((struct sockaddr_in *) &broad_addr); } #if defined(IPv6) && defined(AF_INET6) else if (family == FamilyInternet6 && !(IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr))) { XdmcpRegisterConnection (family, (char *)addr, len); } #endif #endif /* XDMCP */ } } } /* * now add a host of family FamilyLocalHost... */ DefineLocalHost: for (host = selfhosts; host && !addrEqual(FamilyLocalHost, "", 0, host); host = host->next); if (!host) { MakeHost(host, 0); if (host) { host->family = FamilyLocalHost; host->len = 0; acopy("", host->addr, 0); host->next = selfhosts; selfhosts = host; } } #endif /* !TCPCONN && !UNIXCONN */ } #else #ifdef USE_SIOCGLIFCONF #define ifr_type struct lifreq #else #define ifr_type struct ifreq #endif #ifdef VARIABLE_IFREQ #define ifr_size(p) (sizeof (struct ifreq) + \ (p->ifr_addr.sa_len > sizeof (p->ifr_addr) ? \ p->ifr_addr.sa_len - sizeof (p->ifr_addr) : 0)) #define ifraddr_size(a) (a.sa_len) #else #define ifr_size(p) (sizeof (ifr_type)) #define ifraddr_size(a) (sizeof (a)) #endif #if defined(DEF_SELF_DEBUG) || (defined(IPv6) && defined(AF_INET6)) #include #endif #if defined(IPv6) && defined(AF_INET6) static void in6_fillscopeid(struct sockaddr_in6 *sin6) { #if defined(__KAME__) if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { sin6->sin6_scope_id = ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]); sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0; } #endif } #endif void DefineSelf (int fd) { #ifndef HAS_GETIFADDRS char buf[2048], *cp, *cplim; void * bufptr = buf; #ifdef USE_SIOCGLIFCONF struct lifconf ifc; register struct lifreq *ifr; #ifdef SIOCGLIFNUM struct lifnum ifn; #endif #else struct ifconf ifc; register struct ifreq *ifr; #endif #else struct ifaddrs * ifap, *ifr; #endif int len; unsigned char * addr; int family; register HOST *host; #ifndef HAS_GETIFADDRS len = sizeof(buf); #ifdef USE_SIOCGLIFCONF #ifdef SIOCGLIFNUM ifn.lifn_family = AF_UNSPEC; ifn.lifn_flags = 0; if (ioctl (fd, SIOCGLIFNUM, (char *) &ifn) < 0) Error ("Getting interface count"); if (len < (ifn.lifn_count * sizeof(struct lifreq))) { len = ifn.lifn_count * sizeof(struct lifreq); bufptr = malloc(len); } #endif ifc.lifc_family = AF_UNSPEC; ifc.lifc_flags = 0; ifc.lifc_len = len; ifc.lifc_buf = bufptr; #define IFC_IOCTL_REQ SIOCGLIFCONF #define IFC_IFC_REQ ifc.lifc_req #define IFC_IFC_LEN ifc.lifc_len #define IFR_IFR_ADDR ifr->lifr_addr #define IFR_IFR_NAME ifr->lifr_name #else /* Use SIOCGIFCONF */ ifc.ifc_len = len; ifc.ifc_buf = bufptr; #define IFC_IOCTL_REQ SIOCGIFCONF #define IFC_IFC_REQ ifc.ifc_req #define IFC_IFC_LEN ifc.ifc_len #define IFR_IFR_ADDR ifr->ifr_addr #define IFR_IFR_NAME ifr->ifr_name #endif if (ifioctl (fd, IFC_IOCTL_REQ, (void *) &ifc) < 0) Error ("Getting interface configuration (4)"); cplim = (char *) IFC_IFC_REQ + IFC_IFC_LEN; for (cp = (char *) IFC_IFC_REQ; cp < cplim; cp += ifr_size (ifr)) { ifr = (ifr_type *) cp; len = ifraddr_size (IFR_IFR_ADDR); family = ConvertAddr ((struct sockaddr *) &IFR_IFR_ADDR, &len, (void **)&addr); if (family == -1 || family == FamilyLocal) continue; #if defined(IPv6) && defined(AF_INET6) if (family == FamilyInternet6) in6_fillscopeid((struct sockaddr_in6 *)&IFR_IFR_ADDR); #endif #ifdef DEF_SELF_DEBUG if (family == FamilyInternet) ErrorF("Xserver: DefineSelf(): ifname = %s, addr = %d.%d.%d.%d\n", IFR_IFR_NAME, addr[0], addr[1], addr[2], addr[3]); #if defined(IPv6) && defined(AF_INET6) else if (family == FamilyInternet6) { char cp[INET6_ADDRSTRLEN] = ""; inet_ntop(AF_INET6, addr, cp, sizeof(cp)); ErrorF("Xserver: DefineSelf(): ifname = %s, addr = %s\n", IFR_IFR_NAME, cp); } #endif #endif /* DEF_SELF_DEBUG */ for (host = selfhosts; host && !addrEqual (family, addr, len, host); host = host->next) ; if (host) continue; MakeHost(host,len) if (host) { host->family = family; host->len = len; acopy(addr, host->addr, len); host->next = selfhosts; selfhosts = host; } #ifdef XDMCP { #ifdef USE_SIOCGLIFCONF struct sockaddr_storage broad_addr; #else struct sockaddr broad_addr; #endif /* * If this isn't an Internet Address, don't register it. */ if (family != FamilyInternet #if defined(IPv6) && defined(AF_INET6) && family != FamilyInternet6 #endif ) continue; /* * ignore 'localhost' entries as they're not useful * on the other end of the wire */ if (family == FamilyInternet && addr[0] == 127 && addr[1] == 0 && addr[2] == 0 && addr[3] == 1) continue; #if defined(IPv6) && defined(AF_INET6) else if (family == FamilyInternet6 && IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr)) continue; #endif /* * Ignore '0.0.0.0' entries as they are * returned by some OSes for unconfigured NICs but they are * not useful on the other end of the wire. */ if (len == 4 && addr[0] == 0 && addr[1] == 0 && addr[2] == 0 && addr[3] == 0) continue; XdmcpRegisterConnection (family, (char *)addr, len); #if defined(IPv6) && defined(AF_INET6) /* IPv6 doesn't support broadcasting, so we drop out here */ if (family == FamilyInternet6) continue; #endif broad_addr = IFR_IFR_ADDR; ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr = htonl (INADDR_BROADCAST); #if defined(USE_SIOCGLIFCONF) && defined(SIOCGLIFBRDADDR) { struct lifreq broad_req; broad_req = *ifr; if (ioctl (fd, SIOCGLIFFLAGS, (char *) &broad_req) != -1 && (broad_req.lifr_flags & IFF_BROADCAST) && (broad_req.lifr_flags & IFF_UP) ) { broad_req = *ifr; if (ioctl (fd, SIOCGLIFBRDADDR, &broad_req) != -1) broad_addr = broad_req.lifr_broadaddr; else continue; } else continue; } #elif defined(SIOCGIFBRDADDR) { struct ifreq broad_req; broad_req = *ifr; if (ifioctl (fd, SIOCGIFFLAGS, (void *) &broad_req) != -1 && (broad_req.ifr_flags & IFF_BROADCAST) && (broad_req.ifr_flags & IFF_UP) ) { broad_req = *ifr; if (ifioctl (fd, SIOCGIFBRDADDR, (void *) &broad_req) != -1) broad_addr = broad_req.ifr_addr; else continue; } else continue; } #endif /* SIOCGIFBRDADDR */ #ifdef DEF_SELF_DEBUG ErrorF("Xserver: DefineSelf(): ifname = %s, baddr = %s\n", IFR_IFR_NAME, inet_ntoa(((struct sockaddr_in *) &broad_addr)->sin_addr)); #endif /* DEF_SELF_DEBUG */ XdmcpRegisterBroadcastAddress ((struct sockaddr_in *) &broad_addr); } #endif /* XDMCP */ } if (bufptr != buf) free(bufptr); #else /* HAS_GETIFADDRS */ if (getifaddrs(&ifap) < 0) { ErrorF("Warning: getifaddrs returns %s\n", strerror(errno)); return; } for (ifr = ifap; ifr != NULL; ifr = ifr->ifa_next) { if (!ifr->ifa_addr) continue; len = sizeof(*(ifr->ifa_addr)); family = ConvertAddr(ifr->ifa_addr, &len, (void **)&addr); if (family == -1 || family == FamilyLocal) continue; #if defined(IPv6) && defined(AF_INET6) if (family == FamilyInternet6) in6_fillscopeid((struct sockaddr_in6 *)ifr->ifa_addr); #endif #ifdef DEF_SELF_DEBUG if (family == FamilyInternet) ErrorF("Xserver: DefineSelf(): ifname = %s, addr = %d.%d.%d.%d\n", ifr->ifa_name, addr[0], addr[1], addr[2], addr[3]); #if defined(IPv6) && defined(AF_INET6) else if (family == FamilyInternet6) { char cp[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, addr, cp, sizeof(cp)); ErrorF("Xserver: DefineSelf(): ifname = %s addr = %s\n", ifr->ifa_name, cp); } #endif #endif /* DEF_SELF_DEBUG */ for (host = selfhosts; host != NULL && !addrEqual(family, addr, len, host); host = host->next) ; if (host != NULL) continue; MakeHost(host, len); if (host != NULL) { host->family = family; host->len = len; acopy(addr, host->addr, len); host->next = selfhosts; selfhosts = host; } #ifdef XDMCP { struct sockaddr broad_addr; /* * If this isn't an Internet Address, don't register it. */ if (family != FamilyInternet #if defined(IPv6) && defined(AF_INET6) && family != FamilyInternet6 #endif ) continue; /* * ignore 'localhost' entries as they're not useful * on the other end of the wire */ if (ifr->ifa_flags & IFF_LOOPBACK) continue; if (family == FamilyInternet && addr[0] == 127 && addr[1] == 0 && addr[2] == 0 && addr[3] == 1) continue; /* * Ignore '0.0.0.0' entries as they are * returned by some OSes for unconfigured NICs but they are * not useful on the other end of the wire. */ if (len == 4 && addr[0] == 0 && addr[1] == 0 && addr[2] == 0 && addr[3] == 0) continue; #if defined(IPv6) && defined(AF_INET6) else if (family == FamilyInternet6 && IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr)) continue; #endif XdmcpRegisterConnection(family, (char *)addr, len); #if defined(IPv6) && defined(AF_INET6) if (family == FamilyInternet6) /* IPv6 doesn't support broadcasting, so we drop out here */ continue; #endif if ((ifr->ifa_flags & IFF_BROADCAST) && (ifr->ifa_flags & IFF_UP)) broad_addr = *ifr->ifa_broadaddr; else continue; #ifdef DEF_SELF_DEBUG ErrorF("Xserver: DefineSelf(): ifname = %s, baddr = %s\n", ifr->ifa_name, inet_ntoa(((struct sockaddr_in *) &broad_addr)->sin_addr)); #endif /* DEF_SELF_DEBUG */ XdmcpRegisterBroadcastAddress((struct sockaddr_in *) &broad_addr); } #endif /* XDMCP */ } /* for */ freeifaddrs(ifap); #endif /* HAS_GETIFADDRS */ /* * add something of FamilyLocalHost */ for (host = selfhosts; host && !addrEqual(FamilyLocalHost, "", 0, host); host = host->next); if (!host) { MakeHost(host, 0); if (host) { host->family = FamilyLocalHost; host->len = 0; acopy("", host->addr, 0); host->next = selfhosts; selfhosts = host; } } } #endif /* !SIOCGIFCONF */ #endif /* WINTCP */ #ifdef XDMCP void AugmentSelf(void * from, int len) { int family; void * addr; register HOST *host; family = ConvertAddr(from, &len, (void **)&addr); if (family == -1 || family == FamilyLocal) return; for (host = selfhosts; host; host = host->next) { if (addrEqual(family, addr, len, host)) return; } MakeHost(host,len) if (!host) return; host->family = family; host->len = len; acopy(addr, host->addr, len); host->next = selfhosts; selfhosts = host; } #endif void AddLocalHosts (void) { HOST *self; for (self = selfhosts; self; self = self->next) /* Fix for XFree86 bug #156: pass addingLocal = TRUE to * NewHost to tell that we are adding the default local * host entries and not to flag the entries as being * explicitely requested */ (void) NewHost (self->family, self->addr, self->len, TRUE); } /* Reset access control list to initial hosts */ void ResetHosts (char *display) { register HOST *host; char lhostname[120], ohostname[120]; char *hostname = ohostname; char fname[PATH_MAX + 1]; int fnamelen; FILE *fd; char *ptr; int i, hostlen; #if (defined(TCPCONN) && (!defined(IPv6) || !defined(AF_INET6))) union { struct sockaddr sa; #if defined(TCPCONN) struct sockaddr_in in; #endif /* TCPCONN */ } saddr; #endif int family = 0; void *addr = NULL; int len; siTypesInitialize(); AccessEnabled = defeatAccessControl ? FALSE : DEFAULT_ACCESS_CONTROL; LocalHostEnabled = FALSE; while ((host = validhosts) != 0) { validhosts = host->next; FreeHost (host); } #define ETC_HOST_PREFIX "/etc/X" #define ETC_HOST_SUFFIX ".hosts" fnamelen = strlen(ETC_HOST_PREFIX) + strlen(ETC_HOST_SUFFIX) + strlen(display) + 1; if (fnamelen > sizeof(fname)) FatalError("Display name `%s' is too long\n", display); sprintf(fname, ETC_HOST_PREFIX "%s" ETC_HOST_SUFFIX, display); if ((fd = fopen (fname, "r")) != 0) { while (fgets (ohostname, sizeof (ohostname), fd)) { family = FamilyWild; if (*ohostname == '#') continue; if ((ptr = strchr(ohostname, '\n')) != 0) *ptr = 0; hostlen = strlen(ohostname) + 1; for (i = 0; i < hostlen; i++) lhostname[i] = tolower(ohostname[i]); hostname = ohostname; if (!strncmp("local:", lhostname, 6)) { family = FamilyLocalHost; NewHost(family, "", 0, FALSE); LocalHostRequested = TRUE; /* Fix for XFree86 bug #156 */ } #if defined(TCPCONN) else if (!strncmp("inet:", lhostname, 5)) { family = FamilyInternet; hostname = ohostname + 5; } #if defined(IPv6) && defined(AF_INET6) else if (!strncmp("inet6:", lhostname, 6)) { family = FamilyInternet6; hostname = ohostname + 6; } #endif #endif #ifdef SECURE_RPC else if (!strncmp("nis:", lhostname, 4)) { family = FamilyNetname; hostname = ohostname + 4; } #endif else if (!strncmp("si:", lhostname, 3)) { family = FamilyServerInterpreted; hostname = ohostname + 3; hostlen -= 3; } if (family == FamilyServerInterpreted) { len = siCheckAddr(hostname, hostlen); if (len >= 0) { NewHost(family, hostname, len, FALSE); } } else #ifdef SECURE_RPC if ((family == FamilyNetname) || (strchr(hostname, '@'))) { SecureRPCInit (); (void) NewHost (FamilyNetname, hostname, strlen (hostname), FALSE); } else #endif /* SECURE_RPC */ #if defined(TCPCONN) { #if defined(IPv6) && defined(AF_INET6) if ( (family == FamilyInternet) || (family == FamilyInternet6) || (family == FamilyWild) ) { struct addrinfo *addresses; struct addrinfo *a; int f; if (getaddrinfo(hostname, NULL, NULL, &addresses) == 0) { for (a = addresses ; a != NULL ; a = a->ai_next) { len = a->ai_addrlen; f = ConvertAddr(a->ai_addr,&len,(void **)&addr); if (addr && ((family == f) || ((family == FamilyWild) && (f != -1)))) { NewHost(f, addr, len, FALSE); } } freeaddrinfo(addresses); } } #else #ifdef XTHREADS_NEEDS_BYNAMEPARAMS _Xgethostbynameparams hparams; #endif register struct hostent *hp; /* host name */ if ((family == FamilyInternet && ((hp = _XGethostbyname(hostname, hparams)) != 0)) || ((hp = _XGethostbyname(hostname, hparams)) != 0)) { saddr.sa.sa_family = hp->h_addrtype; len = sizeof(saddr.sa); if ((family = ConvertAddr (&saddr.sa, &len, (void **)&addr)) != -1) { #ifdef h_addr /* new 4.3bsd version of gethostent */ char **list; /* iterate over the addresses */ for (list = hp->h_addr_list; *list; list++) (void) NewHost (family, (void *)*list, len, FALSE); #else (void) NewHost (family, (void *)hp->h_addr, len, FALSE); #endif } } #endif /* IPv6 */ } #endif /* TCPCONN */ family = FamilyWild; } fclose (fd); } } /* Is client on the local host */ Bool ComputeLocalClient(ClientPtr client) { int alen, family, notused; Xtransaddr *from = NULL; void *addr; register HOST *host; OsCommPtr oc = (OsCommPtr) client->osPrivate; if (!oc->trans_conn) return FALSE; #ifdef XCSECURITY /* untrusted clients can't change host access */ if (client->trustLevel != XSecurityClientTrusted) { SecurityAudit("client %d attempted to change host access\n", client->index); return FALSE; } #endif if (!_XSERVTransGetPeerAddr (oc->trans_conn, ¬used, &alen, &from)) { family = ConvertAddr ((struct sockaddr *) from, &alen, (void **)&addr); if (family == -1) { free(from); return FALSE; } if (family == FamilyLocal) { free(from); return TRUE; } for (host = selfhosts; host; host = host->next) { if (addrEqual (family, addr, alen, host)) { free(from); return TRUE; } } free(from); } return FALSE; } /* * Return the uid and gid of a connected local client * * Used by XShm to test access rights to shared memory segments */ int LocalClientCred(ClientPtr client, int *pUid, int *pGid) { LocalClientCredRec *lcc; int ret = GetLocalClientCreds(client, &lcc); if (ret == 0) { #ifdef HAVE_GETZONEID /* only local if in the same zone */ if ((lcc->fieldsSet & LCC_ZID_SET) && (lcc->zoneid != getzoneid())) { FreeLocalClientCreds(lcc); return -1; } #endif if ((lcc->fieldsSet & LCC_UID_SET) && (pUid != NULL)) *pUid = lcc->euid; if ((lcc->fieldsSet & LCC_GID_SET) && (pGid != NULL)) *pGid = lcc->egid; FreeLocalClientCreds(lcc); } return ret; } /* * Return the uid and all gids of a connected local client * Allocates a LocalClientCredRec - caller must call FreeLocalClientCreds * * Used by localuser & localgroup ServerInterpreted access control forms below * Used by AuthAudit to log where local connections came from */ int GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp) { #if defined(HAS_GETPEEREID) || defined(HAS_GETPEERUCRED) || defined(SO_PEERCRED) int fd; XtransConnInfo ci; LocalClientCredRec *lcc; #ifdef HAS_GETPEEREID uid_t uid; gid_t gid; #elif defined(HAS_GETPEERUCRED) ucred_t *peercred = NULL; const gid_t *gids; #elif defined(SO_PEERCRED) struct ucred peercred; socklen_t so_len = sizeof(peercred); #endif if (client == NULL) return -1; ci = ((OsCommPtr)client->osPrivate)->trans_conn; #if !(defined(sun) && defined(HAS_GETPEERUCRED)) /* Most implementations can only determine peer credentials for Unix * domain sockets - Solaris getpeerucred can work with a bit more, so * we just let it tell us if the connection type is supported or not */ if (!_XSERVTransIsLocal(ci)) { return -1; } #endif *lccp = calloc(1, sizeof(LocalClientCredRec)); if (*lccp == NULL) return -1; lcc = *lccp; fd = _XSERVTransGetConnectionNumber(ci); #ifdef HAS_GETPEEREID if (getpeereid(fd, &uid, &gid) == -1) { FreeLocalClientCreds(lcc); return -1; } lcc->euid = uid; lcc->egid = gid; lcc->fieldsSet = LCC_UID_SET | LCC_GID_SET; return 0; #elif defined(HAS_GETPEERUCRED) if (getpeerucred(fd, &peercred) < 0) { FreeLocalClientCreds(lcc); return -1; } lcc->euid = ucred_geteuid(peercred); if (lcc->euid != -1) lcc->fieldsSet |= LCC_UID_SET; lcc->egid = ucred_getegid(peercred); if (lcc->egid != -1) lcc->fieldsSet |= LCC_GID_SET; lcc->pid = ucred_getpid(peercred); if (lcc->pid != -1) lcc->fieldsSet |= LCC_PID_SET; #ifdef HAVE_GETZONEID lcc->zoneid = ucred_getzoneid(peercred); if (lcc->zoneid != -1) lcc->fieldsSet |= LCC_ZID_SET; #endif lcc->nSuppGids = ucred_getgroups(peercred, &gids); if (lcc->nSuppGids > 0) { lcc->pSuppGids = calloc((lcc->nSuppGids), sizeof(int)); if (lcc->pSuppGids == NULL) { lcc->nSuppGids = 0; } else { int i; for (i = 0 ; i < lcc->nSuppGids; i++) { (lcc->pSuppGids)[i] = (int) gids[i]; } } } else { lcc->nSuppGids = 0; } ucred_free(peercred); return 0; #elif defined(SO_PEERCRED) if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) == -1) { FreeLocalClientCreds(lcc); return -1; } lcc->euid = peercred.uid; lcc->egid = peercred.gid; lcc->pid = peercred.pid; lcc->fieldsSet = LCC_UID_SET | LCC_GID_SET | LCC_PID_SET; return 0; #endif #else /* No system call available to get the credentials of the peer */ #define NO_LOCAL_CLIENT_CRED return -1; #endif } void FreeLocalClientCreds(LocalClientCredRec *lcc) { if (lcc != NULL) { if (lcc->nSuppGids > 0) { free(lcc->pSuppGids); } free(lcc); } } static Bool AuthorizedClient(ClientPtr client) { if (!client || defeatAccessControl) return TRUE; return client->local ? Success : BadAccess; } /* Add a host to the access control list. This is the external interface * called from the dispatcher */ int AddHost (ClientPtr client, int family, unsigned length, /* of bytes in pAddr */ void *pAddr) { int len; if (!AuthorizedClient(client)) return(BadAccess); switch (family) { case FamilyLocalHost: len = length; LocalHostEnabled = TRUE; break; #ifdef SECURE_RPC case FamilyNetname: len = length; SecureRPCInit (); break; #endif case FamilyInternet: #if defined(IPv6) && defined(AF_INET6) case FamilyInternet6: #endif case FamilyChaos: case FamilyServerInterpreted: if ((len = CheckAddr (family, pAddr, length)) < 0) { client->errorValue = length; return (BadValue); } break; case FamilyLocal: default: client->errorValue = family; return (BadValue); } if (NewHost (family, pAddr, len, FALSE)) return Success; return BadAlloc; } Bool ForEachHostInFamily (int family, Bool (*func)( unsigned char * /* addr */, short /* len */, void * /* closure */), void * closure) { HOST *host; for (host = validhosts; host; host = host->next) if (family == host->family && func (host->addr, host->len, closure)) return TRUE; return FALSE; } /* Add a host to the access control list. This is the internal interface * called when starting or resetting the server */ static Bool NewHost (int family, void *addr, int len, int addingLocalHosts) { register HOST *host; for (host = validhosts; host; host = host->next) { if (addrEqual (family, addr, len, host)) return TRUE; } if (!addingLocalHosts) { /* Fix for XFree86 bug #156 */ for (host = selfhosts; host; host = host->next) { if (addrEqual (family, addr, len, host)) { host->requested = TRUE; break; } } } MakeHost(host,len) if (!host) return FALSE; host->family = family; host->len = len; acopy(addr, host->addr, len); host->next = validhosts; validhosts = host; return TRUE; } /* Remove a host from the access control list */ int RemoveHost ( ClientPtr client, int family, unsigned length, /* of bytes in pAddr */ void *pAddr) { int len; register HOST *host, **prev; if (!AuthorizedClient(client)) return(BadAccess); switch (family) { case FamilyLocalHost: len = length; LocalHostEnabled = FALSE; break; #ifdef SECURE_RPC case FamilyNetname: len = length; break; #endif case FamilyInternet: #if defined(IPv6) && defined(AF_INET6) case FamilyInternet6: #endif case FamilyChaos: case FamilyServerInterpreted: if ((len = CheckAddr (family, pAddr, length)) < 0) { client->errorValue = length; return(BadValue); } break; case FamilyLocal: default: client->errorValue = family; return(BadValue); } for (prev = &validhosts; (host = *prev) && (!addrEqual (family, pAddr, len, host)); prev = &host->next) ; if (host) { *prev = host->next; FreeHost (host); } return (Success); } /* Get all hosts in the access control list */ int GetHosts ( void * *data, int *pnHosts, int *pLen, BOOL *pEnabled) { int len; register int n = 0; register unsigned char *ptr; register HOST *host; int nHosts = 0; *pEnabled = AccessEnabled ? EnableAccess : DisableAccess; for (host = validhosts; host; host = host->next) { nHosts++; n += (((host->len + 3) >> 2) << 2) + sizeof(xHostEntry); /* Could check for INT_MAX, but in reality having more than 1mb of hostnames in the access list is ridiculous */ if (n >= 1024*1024) break; } if (n) { *data = ptr = (void *) malloc (n); if (!ptr) { return(BadAlloc); } for (host = validhosts; host; host = host->next) { len = host->len; if ((ptr + sizeof(xHostEntry) + len) > ((unsigned char *) *data + n)) break; ((xHostEntry *)ptr)->family = host->family; ((xHostEntry *)ptr)->length = len; ptr += sizeof(xHostEntry); acopy (host->addr, ptr, len); ptr += ((len + 3) >> 2) << 2; } } else { *data = NULL; } *pnHosts = nHosts; *pLen = n; return(Success); } /* Check for valid address family and length, and return address length. */ /*ARGSUSED*/ static int CheckAddr ( int family, void * pAddr, unsigned length) { int len; switch (family) { #if defined(TCPCONN) case FamilyInternet: if (length == sizeof (struct in_addr)) len = length; else len = -1; break; #if defined(IPv6) && defined(AF_INET6) case FamilyInternet6: if (length == sizeof (struct in6_addr)) len = length; else len = -1; break; #endif #endif case FamilyServerInterpreted: len = siCheckAddr(pAddr, length); break; default: len = -1; } return (len); } /* Check if a host is not in the access control list. * Returns 1 if host is invalid, 0 if we've found it. */ int InvalidHost ( register struct sockaddr *saddr, int len, ClientPtr client) { int family; void *addr = NULL; register HOST *selfhost, *host; if (!AccessEnabled) /* just let them in */ return(0); family = ConvertAddr (saddr, &len, (void **)&addr); if (family == -1) return 1; if (family == FamilyLocal) { if (!LocalHostEnabled) { /* * check to see if any local address is enabled. This * implicitly enables local connections. */ for (selfhost = selfhosts; selfhost; selfhost=selfhost->next) { for (host = validhosts; host; host=host->next) { if (addrEqual (selfhost->family, selfhost->addr, selfhost->len, host)) return 0; } } } else return 0; } for (host = validhosts; host; host = host->next) { if ((host->family == FamilyServerInterpreted)) { if (siAddrMatch (family, addr, len, host, client)) { return (0); } } else { if (addr && addrEqual (family, addr, len, host)) return (0); } } return (1); } static int ConvertAddr ( register struct sockaddr *saddr, int *len, void **addr) { if (*len == 0) return (FamilyLocal); switch (saddr->sa_family) { case AF_UNSPEC: #if defined(UNIXCONN) || defined(LOCALCONN) case AF_UNIX: #endif return FamilyLocal; #if defined(TCPCONN) case AF_INET: *len = sizeof (struct in_addr); *addr = (void *) &(((struct sockaddr_in *) saddr)->sin_addr); return FamilyInternet; #if defined(IPv6) && defined(AF_INET6) case AF_INET6: { struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) saddr; if (IN6_IS_ADDR_V4MAPPED(&(saddr6->sin6_addr))) { *len = sizeof (struct in_addr); *addr = (void *) &(saddr6->sin6_addr.s6_addr[12]); return FamilyInternet; } else { *len = sizeof (struct in6_addr); *addr = (void *) &(saddr6->sin6_addr); return FamilyInternet6; } } #endif #endif #ifdef CHAOSCONN case AF_CHAOS: { not implemented } return FamilyChaos; #endif default: return -1; } } int ChangeAccessControl( ClientPtr client, int fEnabled) { if (!AuthorizedClient(client)) return BadAccess; AccessEnabled = fEnabled; return Success; } /* returns FALSE if xhost + in effect, else TRUE */ int GetAccessControl(void) { return AccessEnabled; } /***************************************************************************** * FamilyServerInterpreted host entry implementation * * Supports an extensible system of host types which the server can interpret * See the IPv6 extensions to the X11 protocol spec for the definition. * * Currently supported schemes: * * hostname - hostname as defined in IETF RFC 2396 * ipv6 - IPv6 literal address as defined in IETF RFC's 3513 and * * See xc/doc/specs/SIAddresses for formal definitions of each type. */ /* These definitions and the siTypeAdd function could be exported in the * future to enable loading additional host types, but that was not done for * the initial implementation. */ typedef Bool (*siAddrMatchFunc)(int family, void * addr, int len, const char *siAddr, int siAddrlen, ClientPtr client, void *siTypePriv); typedef int (*siCheckAddrFunc)(const char *addrString, int length, void *siTypePriv); struct siType { struct siType * next; const char * typeName; siAddrMatchFunc addrMatch; siCheckAddrFunc checkAddr; void * typePriv; /* Private data for type routines */ }; static struct siType *siTypeList; static int siTypeAdd(const char *typeName, siAddrMatchFunc addrMatch, siCheckAddrFunc checkAddr, void *typePriv) { struct siType *s, *p; if ((typeName == NULL) || (addrMatch == NULL) || (checkAddr == NULL)) return BadValue; for (s = siTypeList, p = NULL; s != NULL ; p = s, s = s->next) { if (strcmp(typeName, s->typeName) == 0) { s->addrMatch = addrMatch; s->checkAddr = checkAddr; s->typePriv = typePriv; return Success; } } s = (struct siType *) malloc(sizeof(struct siType)); if (s == NULL) return BadAlloc; if (p == NULL) siTypeList = s; else p->next = s; s->next = NULL; s->typeName = typeName; s->addrMatch = addrMatch; s->checkAddr = checkAddr; s->typePriv = typePriv; return Success; } /* Checks to see if a host matches a server-interpreted host entry */ static Bool siAddrMatch(int family, void * addr, int len, HOST *host, ClientPtr client) { Bool matches = FALSE; struct siType *s; const char *valueString; int addrlen; valueString = (const char *) memchr(host->addr, '\0', host->len); if (valueString != NULL) { for (s = siTypeList; s != NULL ; s = s->next) { if (strcmp((char *) host->addr, s->typeName) == 0) { addrlen = host->len - (strlen((char *)host->addr) + 1); matches = s->addrMatch(family, addr, len, valueString + 1, addrlen, client, s->typePriv); break; } } #ifdef FAMILY_SI_DEBUG ErrorF( "Xserver: siAddrMatch(): type = %s, value = %*.*s -- %s\n", host->addr, addrlen, addrlen, valueString + 1, (matches) ? "accepted" : "rejected"); #endif } return matches; } static int siCheckAddr(const char *addrString, int length) { const char *valueString; int addrlen, typelen; int len = -1; struct siType *s; /* Make sure there is a \0 byte inside the specified length to separate the address type from the address value. */ valueString = (const char *) memchr(addrString, '\0', length); if (valueString != NULL) { /* Make sure the first string is a recognized address type, * and the second string is a valid address of that type. */ typelen = strlen(addrString) + 1; addrlen = length - typelen; for (s = siTypeList; s != NULL ; s = s->next) { if (strcmp(addrString, s->typeName) == 0) { len = s->checkAddr(valueString + 1, addrlen, s->typePriv); if (len >= 0) { len += typelen; } break; } } #ifdef FAMILY_SI_DEBUG { const char *resultMsg; if (s == NULL) { resultMsg = "type not registered"; } else { if (len == -1) resultMsg = "rejected"; else resultMsg = "accepted"; } ErrorF("Xserver: siCheckAddr(): type = %s, value = %*.*s, len = %d -- %s\n", addrString, addrlen, addrlen, valueString + 1, len, resultMsg); } #endif } return len; } /*** * Hostname server-interpreted host type * * Stored as hostname string, explicitly defined to be resolved ONLY * at access check time, to allow for hosts with dynamic addresses * but static hostnames, such as found in some DHCP & mobile setups. * * Hostname must conform to IETF RFC 2396 sec. 3.2.2, which defines it as: * hostname = *( domainlabel "." ) toplabel [ "." ] * domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum * toplabel = alpha | alpha *( alphanum | "-" ) alphanum */ #ifdef NI_MAXHOST # define SI_HOSTNAME_MAXLEN NI_MAXHOST #else # ifdef MAXHOSTNAMELEN # define SI_HOSTNAME_MAXLEN MAXHOSTNAMELEN # else # define SI_HOSTNAME_MAXLEN 256 # endif #endif static Bool siHostnameAddrMatch(int family, void * addr, int len, const char *siAddr, int siAddrLen, ClientPtr client, void *typePriv) { Bool res = FALSE; /* Currently only supports checking against IPv4 & IPv6 connections, but * support for other address families, such as DECnet, could be added if * desired. */ #if defined(IPv6) && defined(AF_INET6) if ((family == FamilyInternet) || (family == FamilyInternet6)) { char hostname[SI_HOSTNAME_MAXLEN]; struct addrinfo *addresses; struct addrinfo *a; int f, hostaddrlen; void * hostaddr = NULL; if (siAddrLen >= sizeof(hostname)) return FALSE; strncpy(hostname, siAddr, siAddrLen); hostname[siAddrLen] = '\0'; if (getaddrinfo(hostname, NULL, NULL, &addresses) == 0) { for (a = addresses ; a != NULL ; a = a->ai_next) { hostaddrlen = a->ai_addrlen; f = ConvertAddr(a->ai_addr,&hostaddrlen,&hostaddr); if ((f == family) && (len == hostaddrlen) && hostaddr && (acmp (addr, hostaddr, len) == 0) ) { res = TRUE; break; } } freeaddrinfo(addresses); } } #else /* IPv6 not supported, use gethostbyname instead for IPv4 */ if (family == FamilyInternet) { register struct hostent *hp; #ifdef XTHREADS_NEEDS_BYNAMEPARAMS _Xgethostbynameparams hparams; #endif char hostname[SI_HOSTNAME_MAXLEN]; int f, hostaddrlen; void * hostaddr; const char **addrlist; if (siAddrLen >= sizeof(hostname)) return FALSE; strncpy(hostname, siAddr, siAddrLen); hostname[siAddrLen] = '\0'; if ((hp = _XGethostbyname(hostname, hparams)) != NULL) { #ifdef h_addr /* new 4.3bsd version of gethostent */ /* iterate over the addresses */ for (addrlist = hp->h_addr_list; *addrlist; addrlist++) #else addrlist = &hp->h_addr; #endif { struct sockaddr_in sin; sin.sin_family = hp->h_addrtype; acopy ( *addrlist, &(sin.sin_addr), hp->h_length); hostaddrlen = sizeof(sin); f = ConvertAddr ((struct sockaddr *)&sin, &hostaddrlen, &hostaddr); if ((f == family) && (len == hostaddrlen) && (acmp (addr, hostaddr, len) == 0) ) { res = TRUE; break; } } } } #endif return res; } static int siHostnameCheckAddr(const char *valueString, int length, void *typePriv) { /* Check conformance of hostname to RFC 2396 sec. 3.2.2 definition. * We do not use ctype functions here to avoid locale-specific * character sets. Hostnames must be pure ASCII. */ int len = length; int i; Bool dotAllowed = FALSE; Bool dashAllowed = FALSE; if ((length <= 0) || (length >= SI_HOSTNAME_MAXLEN)) { len = -1; } else { for (i = 0; i < length; i++) { char c = valueString[i]; if (c == 0x2E) { /* '.' */ if (dotAllowed == FALSE) { len = -1; break; } else { dotAllowed = FALSE; dashAllowed = FALSE; } } else if (c == 0x2D) { /* '-' */ if (dashAllowed == FALSE) { len = -1; break; } else { dotAllowed = FALSE; } } else if (((c >= 0x30) && (c <= 0x3A)) /* 0-9 */ || ((c >= 0x61) && (c <= 0x7A)) /* a-z */ || ((c >= 0x41) && (c <= 0x5A)) /* A-Z */) { dotAllowed = TRUE; dashAllowed = TRUE; } else { /* Invalid character */ len = -1; break; } } } return len; } #if defined(IPv6) && defined(AF_INET6) /*** * "ipv6" server interpreted type * * Currently supports only IPv6 literal address as specified in IETF RFC 3513 * * Once draft-ietf-ipv6-scoping-arch-00.txt becomes an RFC, support will be * added for the scoped address format it specifies. */ /* Maximum length of an IPv6 address string - increase when adding support * for scoped address qualifiers. Includes room for trailing NUL byte. */ #define SI_IPv6_MAXLEN INET6_ADDRSTRLEN static Bool siIPv6AddrMatch(int family, void * addr, int len, const char *siAddr, int siAddrlen, ClientPtr client, void *typePriv) { struct in6_addr addr6; char addrbuf[SI_IPv6_MAXLEN]; if ((family != FamilyInternet6) || (len != sizeof(addr6))) return FALSE; memcpy(addrbuf, siAddr, siAddrlen); addrbuf[siAddrlen] = '\0'; if (inet_pton(AF_INET6, addrbuf, &addr6) != 1) { perror("inet_pton"); return FALSE; } if (memcmp(addr, &addr6, len) == 0) { return TRUE; } else { return FALSE; } } static int siIPv6CheckAddr(const char *addrString, int length, void *typePriv) { int len; /* Minimum length is 3 (smallest legal address is "::1") */ if (length < 3) { /* Address is too short! */ len = -1; } else if (length >= SI_IPv6_MAXLEN) { /* Address is too long! */ len = -1; } else { /* Assume inet_pton is sufficient validation */ struct in6_addr addr6; char addrbuf[SI_IPv6_MAXLEN]; memcpy(addrbuf, addrString, length); addrbuf[length] = '\0'; if (inet_pton(AF_INET6, addrbuf, &addr6) != 1) { perror("inet_pton"); len = -1; } else { len = length; } } return len; } #endif /* IPv6 */ #if !defined(NO_LOCAL_CLIENT_CRED) /*** * "localuser" & "localgroup" server interpreted types * * Allows local connections from a given local user or group */ #include #include #define LOCAL_USER 1 #define LOCAL_GROUP 2 typedef struct { int credType; } siLocalCredPrivRec, *siLocalCredPrivPtr; static siLocalCredPrivRec siLocalUserPriv = { LOCAL_USER }; static siLocalCredPrivRec siLocalGroupPriv = { LOCAL_GROUP }; static Bool siLocalCredGetId(const char *addr, int len, siLocalCredPrivPtr lcPriv, int *id) { Bool parsedOK = FALSE; char *addrbuf = malloc(len + 1); if (addrbuf == NULL) { return FALSE; } memcpy(addrbuf, addr, len); addrbuf[len] = '\0'; if (addr[0] == '#') { /* numeric id */ char *cp; errno = 0; *id = strtol(addrbuf + 1, &cp, 0); if ((errno == 0) && (cp != (addrbuf+1))) { parsedOK = TRUE; } } else { /* non-numeric name */ if (lcPriv->credType == LOCAL_USER) { struct passwd *pw = getpwnam(addrbuf); if (pw != NULL) { *id = (int) pw->pw_uid; parsedOK = TRUE; } } else { /* group */ struct group *gr = getgrnam(addrbuf); if (gr != NULL) { *id = (int) gr->gr_gid; parsedOK = TRUE; } } } free(addrbuf); return parsedOK; } static Bool siLocalCredAddrMatch(int family, void * addr, int len, const char *siAddr, int siAddrlen, ClientPtr client, void *typePriv) { int siAddrId; LocalClientCredRec *lcc; siLocalCredPrivPtr lcPriv = (siLocalCredPrivPtr) typePriv; if (GetLocalClientCreds(client, &lcc) == -1) { return FALSE; } #ifdef HAVE_GETZONEID /* Ensure process is in the same zone */ if ((lcc->fieldsSet & LCC_ZID_SET) && (lcc->zoneid != getzoneid())) { FreeLocalClientCreds(lcc); return FALSE; } #endif if (siLocalCredGetId(siAddr, siAddrlen, lcPriv, &siAddrId) == FALSE) { FreeLocalClientCreds(lcc); return FALSE; } if (lcPriv->credType == LOCAL_USER) { if ((lcc->fieldsSet & LCC_UID_SET) && (lcc->euid == siAddrId)) { FreeLocalClientCreds(lcc); return TRUE; } } else { if ((lcc->fieldsSet & LCC_GID_SET) && (lcc->egid == siAddrId)) { FreeLocalClientCreds(lcc); return TRUE; } if (lcc->pSuppGids != NULL) { int i; for (i = 0 ; i < lcc->nSuppGids; i++) { if (lcc->pSuppGids[i] == siAddrId) { FreeLocalClientCreds(lcc); return TRUE; } } } } FreeLocalClientCreds(lcc); return FALSE; } static int siLocalCredCheckAddr(const char *addrString, int length, void *typePriv) { int len = length; int id; if (siLocalCredGetId(addrString, length, (siLocalCredPrivPtr)typePriv, &id) == FALSE) { len = -1; } return len; } #endif /* localuser */ static void siTypesInitialize(void) { siTypeAdd("hostname", siHostnameAddrMatch, siHostnameCheckAddr, NULL); #if defined(IPv6) && defined(AF_INET6) siTypeAdd("ipv6", siIPv6AddrMatch, siIPv6CheckAddr, NULL); #endif #if !defined(NO_LOCAL_CLIENT_CRED) siTypeAdd("localuser", siLocalCredAddrMatch, siLocalCredCheckAddr, &siLocalUserPriv); siTypeAdd("localgroup", siLocalCredAddrMatch, siLocalCredCheckAddr, &siLocalGroupPriv); #endif } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/auth.c0000644000000000000000000004265313614532331016333 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * authorization hooks for the server * Author: Keith Packard, MIT X Consortium */ #ifdef HAVE_DIX_CONFIG_H #include #endif # include # include # include "misc.h" # include "osdep.h" # include "dixstruct.h" # include # include #ifdef XCSECURITY #define _SECURITY_SERVER # include #endif struct protocol { unsigned short name_length; char *name; AuthAddCFunc Add; /* new authorization data */ AuthCheckFunc Check; /* verify client authorization data */ AuthRstCFunc Reset; /* delete all authorization data entries */ AuthToIDFunc ToID; /* convert cookie to ID */ AuthFromIDFunc FromID; /* convert ID to cookie */ AuthRemCFunc Remove; /* remove a specific cookie */ #ifdef XCSECURITY AuthGenCFunc Generate; #endif }; static struct protocol protocols[] = { { (unsigned short) 18, "MIT-MAGIC-COOKIE-1", MitAddCookie, MitCheckCookie, MitResetCookie, MitToID, MitFromID, MitRemoveCookie, #ifdef XCSECURITY MitGenerateCookie #endif }, #ifdef HASXDMAUTH { (unsigned short) 19, "XDM-AUTHORIZATION-1", XdmAddCookie, XdmCheckCookie, XdmResetCookie, XdmToID, XdmFromID, XdmRemoveCookie, #ifdef XCSECURITY NULL #endif }, #endif #ifdef SECURE_RPC { (unsigned short) 9, "SUN-DES-1", SecureRPCAdd, SecureRPCCheck, SecureRPCReset, SecureRPCToID, SecureRPCFromID,SecureRPCRemove, #ifdef XCSECURITY NULL #endif }, #endif #ifdef XCSECURITY { (unsigned short) XSecurityAuthorizationNameLen, XSecurityAuthorizationName, NULL, AuthSecurityCheck, NULL, NULL, NULL, NULL, NULL }, #endif }; # define NUM_AUTHORIZATION (sizeof (protocols) /\ sizeof (struct protocol)) /* * Initialize all classes of authorization by reading the * specified authorization file */ static char *authorization_file = (char *)NULL; static Bool ShouldLoadAuth = TRUE; void InitAuthorization (char *file_name) { #ifdef __sun char * envBuffer; #endif authorization_file = file_name; #ifdef NX_TRANS_AUTH #ifdef NX_TRANS_TEST fprintf(stderr, "InitAuthorization: Going to propagate auth file '%s' to the environment.\n", authorization_file); #endif #ifdef __sun envBuffer = malloc(15+strlen(authorization_file)); sprintf(envBuffer,"NX_XAUTHORITY=%s",authorization_file); putenv(envBuffer); #else setenv("NX_XAUTHORITY", authorization_file, 1); #endif #endif } static int LoadAuthorization (void) { FILE *f; Xauth *auth; int i; int count = 0; ShouldLoadAuth = FALSE; if (!authorization_file) return 0; #ifdef NX_TRANS_AUTH /* * We think that the way LoadAuthorization() is working is wrong. * It doesn't reset the list of stored authorizations before reading * the new cookies. Our take is that if a new auth file is to be * read, the only cookies that are to be accepted are those that are * in the new file, not those in the file -plus- those that have * been in the file in the past. Furthermore, if the list can't be * read or it is empty, it should assume that it ignores which co- * okies are valid and thus it should disable any access. Your mile- * age can vary. A less draconian approach could be to leave the old * cookies if the file can't be read and remove them only if the * file is empty. * * Adding the cookies without removing the old values for the same * protocol has an important implication. If an user shares the co- * okie with somebody and later wants to revoke the access to the * display, changing the cookie will not work. This is especially * important with NX. For security reasons, after reconnecting the * session to a different display, it is advisable to generate a * new set of cookies, but doing that it is useless with the current * code, as the old cookies are going to be still accepted. On the * same topic, consider that once an user has got access to the X * server, he/she can freely enable host authentication from any * host, so the safe behaviour should be to reset the host based * authenthication at least at reconnection, and keep as valid only * the cookies that are actually in the file. This behaviour would * surely break many applications, among them a SSH connection run * inside a NX session, as ssh -X reads the cookie for the display * only at session startup and does not read the cookies again * when the auth file is changed. * * Another bug (or feature, depending on how you want to consider * it) is that if the authority file contains entries for different * displays (as it is the norm when the authority file is the default * .Xauthority in the user's home), the server will match -any- of * the cookies, even cookies that are not for its own display. This * means that you have be careful when passing an authority file to * nxagent or Xnest and maybe keep separate files for letting nxagent * find the cookie to be used to connect to the remote display and * for letting it find what cookies to accept. If the file is the * same, clients will be able to connect to nxagent with both the * cookies. */ #ifdef NX_TRANS_AUTH_RESET #ifdef NX_TRANS_TEST fprintf(stderr, "LoadAuthorization: Resetting authorization info.\n"); #endif for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].Reset) { (*protocols[i].Reset) (); } } #endif #endif /* #ifdef NX_TRANS_AUTH */ f = Fopen (authorization_file, "r"); if (!f) return -1; while ((auth = XauReadAuth (f)) != 0) { for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == auth->name_length && memcmp (protocols[i].name, auth->name, (int) auth->name_length) == 0 && protocols[i].Add) { #ifdef NX_TRANS_AUTH #ifdef NX_TRANS_TEST fprintf(stderr, "LoadAuthorization: Adding new record from file [%s].\n", authorization_file); #endif #endif ++count; (*protocols[i].Add) (auth->data_length, auth->data, FakeClientID(0)); } } XauDisposeAuth (auth); } #ifdef NX_TRANS_AUTH if (count == 0) { fprintf(stderr, "Warning: No authorization record could be read from file '%s'.\n", authorization_file); fprintf(stderr, "Warning: Please, create a valid authorization cookie using the command\n" "Warning: 'xauth -f %s add MIT-MAGIC-COOKIE-1 '.\n", authorization_file); } #endif #ifdef NX_TRANS_AUTH if (Fclose (f) != 0) { /* * If the Fclose() fails, for example because of a signal, * it's advisable to return the number of protocols read, * if any, or otherwise the server would believe that no * cookie is valid and eventually fall back to host based * authentication. Note anyway that the new code in Check- * Authorization() doesn't care the return value and gives * a chance to the function to check the file at the next * connection. */ if (count > 0) { return count; } else { return -1; } } #else Fclose (f); #endif return count; } #ifdef XDMCP /* * XdmcpInit calls this function to discover all authorization * schemes supported by the display */ void RegisterAuthorizations (void) { int i; for (i = 0; i < NUM_AUTHORIZATION; i++) XdmcpRegisterAuthorization (protocols[i].name, (int)protocols[i].name_length); } #endif XID CheckAuthorization ( unsigned int name_length, char *name, unsigned int data_length, char *data, ClientPtr client, char **reason) /* failure message. NULL for default msg */ { int i; struct stat buf; static time_t lastmod = 0; #ifndef NX_TRANS_AUTH static Bool loaded = FALSE; #endif if (!authorization_file || stat(authorization_file, &buf)) { if (lastmod != 0) { lastmod = 0; ShouldLoadAuth = TRUE; /* stat lost, so force reload */ } } else if (buf.st_mtime > lastmod) { lastmod = buf.st_mtime; ShouldLoadAuth = TRUE; } if (ShouldLoadAuth) { int loadauth = LoadAuthorization(); /* * If the authorization file has at least one entry for this server, * disable local host access. (loadauth > 0) * * If there are zero entries (either initially or when the * authorization file is later reloaded), or if a valid * authorization file was never loaded, enable local host access. * (loadauth == 0 || !loaded) * * If the authorization file was loaded initially (with valid * entries for this server), and reloading it later fails, don't * change anything. (loadauth == -1 && loaded) */ #ifdef NX_TRANS_AUTH /* * The implementation of CheckAuthorization() was changed. The way * the auth file was handled previously was questionable and could * open the way to a vast array of security problems. There might be * ways for an attacker to prevent the server from reading the file * and it was enough for the server to fail reading the file once * (because of a not blocked signal, for example) to leave the dis- * play open to all the users running a session on the same terminal * server. * * In NX we want to have only two cases: either we have to check an * authorization file or we don't. In the first case we need to do our * best to read the file at any new client access and never fall back * to host based authentication. Falling back to local host access has * no way back, as it will always take precedence over the auth cookie * (unless the user explicitly disables, one by one, all the rules * allowing local access, if and only if he/she becomes aware of the * problem). In the second case we assume that user doesn't care secu- * rity and so allow unrestricted access from the local machine. */ #ifdef NX_TRANS_TEST fprintf(stderr, "CheckAuthorization: Going to set authorization with loadauth [%d].\n", loadauth); #endif if (authorization_file) { #ifdef NX_TRANS_TEST fprintf(stderr, "CheckAuthorization: Disabling local host access.\n"); #endif DisableLocalHost(); } else { /* * Enable host-based authentication only if * the authorization file was not specified * either on the command line or in the env- * ironment. */ #ifdef NX_TRANS_TEST fprintf(stderr, "CheckAuthorization: Enabling local host access.\n"); #endif EnableLocalHost(); } /* * Avoid the 'unused variable' warning. */ loadauth = loadauth; #else /* #ifdef NX_TRANS_AUTH */ if (loadauth > 0) { DisableLocalHost(); /* got at least one */ loaded = TRUE; } else if (loadauth == 0 || !loaded) EnableLocalHost (); #endif /* #ifdef NX_TRANS_AUTH */ } if (name_length) { for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == name_length && memcmp (protocols[i].name, name, (int) name_length) == 0) { return (*protocols[i].Check) (data_length, data, client, reason); } *reason = "Protocol not supported by server\n"; } } else *reason = "No protocol specified\n"; return (XID) ~0L; } void ResetAuthorization (void) { int i; for (i = 0; i < NUM_AUTHORIZATION; i++) if (protocols[i].Reset) (*protocols[i].Reset)(); ShouldLoadAuth = TRUE; } XID AuthorizationToID ( unsigned short name_length, char *name, unsigned short data_length, char *data) { int i; for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == name_length && memcmp (protocols[i].name, name, (int) name_length) == 0 && protocols[i].ToID) { return (*protocols[i].ToID) (data_length, data); } } return (XID) ~0L; } int AuthorizationFromID ( XID id, unsigned short *name_lenp, char **namep, unsigned short *data_lenp, char **datap) { int i; for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].FromID && (*protocols[i].FromID) (id, data_lenp, datap)) { *name_lenp = protocols[i].name_length; *namep = protocols[i].name; return 1; } } return 0; } int RemoveAuthorization ( unsigned short name_length, char *name, unsigned short data_length, char *data) { int i; for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == name_length && memcmp (protocols[i].name, name, (int) name_length) == 0 && protocols[i].Remove) { return (*protocols[i].Remove) (data_length, data); } } return 0; } int AddAuthorization (unsigned name_length, char *name, unsigned data_length, char *data) { int i; for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == name_length && memcmp (protocols[i].name, name, (int) name_length) == 0 && protocols[i].Add) { return (*protocols[i].Add) (data_length, data, FakeClientID(0)); } } return 0; } #ifdef XCSECURITY XID GenerateAuthorization( unsigned name_length, char *name, unsigned data_length, char *data, unsigned *data_length_return, char **data_return) { int i; for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == name_length && memcmp (protocols[i].name, name, (int) name_length) == 0 && protocols[i].Generate) { return (*protocols[i].Generate) (data_length, data, FakeClientID(0), data_length_return, data_return); } } return -1; } /* A random number generator that is more unpredictable than that shipped with some systems. This code is taken from the C standard. */ static unsigned long int next = 1; static int xdm_rand(void) { next = next * 1103515245 + 12345; return (unsigned int)(next/65536) % 32768; } static void xdm_srand(unsigned int seed) { next = seed; } void GenerateRandomData (int len, char *buf) { static int seed; int value; int i; seed += GetTimeInMillis(); xdm_srand (seed); for (i = 0; i < len; i++) { value = xdm_rand (); buf[i] ^= (value & 0xff00) >> 8; } /* XXX add getrusage, popen("ps -ale") */ } #endif /* XCSECURITY */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/client.c0000644000000000000000000002770513614532331016651 0ustar /* * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). All * rights reserved. * Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * @file * * This file contains functionality for identifying clients by various * means. The primary purpose of identification is to simply aid in * finding out which clients are using X server and how they are using * it. For example, it's often necessary to monitor what requests * clients are executing (to spot bad behaviour) and how they are * allocating resources in X server (to spot excessive resource * usage). * * This framework automatically allocates information, that can be * used for client identification, when a client connects to the * server. The information is freed when the client disconnects. The * allocated information is just a collection of various IDs, such as * PID and process name for local clients, that are likely to be * useful in analyzing X server usage. * * Users of the framework can query ID information about clients at * any time. To avoid repeated polling of IDs the users can also * subscribe for notifications about the availability of ID * information. IDs have been allocated before ClientStateCallback is * called with ClientStateInitial state. Similarly the IDs will be * released after ClientStateCallback is called with ClientStateGone * state. * * Author: Rami Ylimäki */ #include #include #include #include "client.h" #include "os.h" #include "dixstruct.h" #ifdef __sun #include #include #endif #ifdef __OpenBSD__ #include #include #include #include #include #endif /** * Try to determine a PID for a client from its connection * information. This should be called only once when new client has * connected, use GetClientPid to determine the PID at other times. * * @param[in] client Connection linked to some process. * * @return PID of the client. Error (-1) if PID can't be determined * for the client. * * @see GetClientPid */ pid_t DetermineClientPid(struct _Client * client) { LocalClientCredRec *lcc = NULL; pid_t pid = -1; if (client == NullClient) return pid; if (client == serverClient) return getpid(); if (GetLocalClientCreds(client, &lcc) != -1) { if (lcc->fieldsSet & LCC_PID_SET) pid = lcc->pid; FreeLocalClientCreds(lcc); } return pid; } /** * Try to determine a command line string for a client based on its * PID. Note that mapping PID to a command hasn't been implemented for * some operating systems. This should be called only once when a new * client has connected, use GetClientCmdName/Args to determine the * string at other times. * * @param[in] pid Process ID of a client. * @param[out] cmdname Client process name without arguments. You must * release this by calling free. On error NULL is * returned. Pass NULL if you aren't interested in * this value. * @param[out] cmdargs Arguments to client process. Useful for * identifying a client that is executed from a * launcher program. You must release this by * calling free. On error NULL is returned. Pass * NULL if you aren't interested in this value. * * @see GetClientCmdName/Args */ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs) { char path[PATH_MAX + 1]; int totsize = 0; int fd = 0; if (cmdname) *cmdname = NULL; if (cmdargs) *cmdargs = NULL; if (pid == -1) return; #ifdef __sun /* Solaris */ /* Solaris does not support /proc/pid/cmdline, but makes information * similar to what ps shows available in a binary structure in the * /proc/pid/psinfo file. */ if (snprintf(path, sizeof(path), "/proc/%d/psinfo", pid) < 0) return; fd = open(path, O_RDONLY); if (fd < 0) { ErrorF("Failed to open %s: %s\n", path, strerror(errno)); return; } else { psinfo_t psinfo = { 0 }; char *sp; totsize = read(fd, &psinfo, sizeof(psinfo_t)); close(fd); if (totsize <= 0) return; /* pr_psargs is the first PRARGSZ (80) characters of the command * line string - assume up to the first space is the command name, * since it's not delimited. While there is also pr_fname, that's * more limited, giving only the first 16 chars of the basename of * the file that was exec'ed, thus cutting off many long gnome * command names, or returning "isapython2.6" for all python scripts. */ psinfo.pr_psargs[PRARGSZ - 1] = '\0'; sp = strchr(psinfo.pr_psargs, ' '); if (sp) *sp++ = '\0'; if (cmdname) *cmdname = strdup(psinfo.pr_psargs); if (cmdargs && sp) *cmdargs = strdup(sp); } #elif defined(__OpenBSD__) /* on OpenBSD use kvm_getargv() */ { kvm_t *kd; char errbuf[_POSIX2_LINE_MAX]; char **argv; struct kinfo_proc *kp; size_t len = 0; int i, n; kd = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, errbuf); if (kd == NULL) return; kp = kvm_getprocs(kd, KERN_PROC_PID, pid, sizeof(struct kinfo_proc), &n); if (n != 1) return; argv = kvm_getargv(kd, kp, 0); *cmdname = strdup(argv[0]); i = 1; while (argv[i] != NULL) { len += strlen(argv[i]) + 1; i++; } *cmdargs = calloc(1, len); i = 1; while (argv[i] != NULL) { strlcat(*cmdargs, argv[i], len); strlcat(*cmdargs, " ", len); i++; } kvm_close(kd); } #else /* Linux using /proc/pid/cmdline */ /* Check if /proc/pid/cmdline exists. It's not supported on all * operating systems. */ if (snprintf(path, sizeof(path), "/proc/%d/cmdline", pid) < 0) return; fd = open(path, O_RDONLY); if (fd < 0) return; /* Read the contents of /proc/pid/cmdline. It should contain the * process name and arguments. */ totsize = read(fd, path, sizeof(path)); close(fd); if (totsize <= 0) return; path[totsize - 1] = '\0'; /* Contruct the process name without arguments. */ if (cmdname) { *cmdname = strdup(path); } /* Construct the arguments for client process. */ if (cmdargs) { int cmdsize = strlen(path) + 1; int argsize = totsize - cmdsize; char *args = NULL; if (argsize > 0) args = malloc(argsize); if (args) { int i = 0; for (i = 0; i < (argsize - 1); ++i) { const char c = path[cmdsize + i]; args[i] = (c == '\0') ? ' ' : c; } args[argsize - 1] = '\0'; *cmdargs = args; } } #endif } /** * Called when a new client connects. Allocates client ID information. * * @param[in] client Recently connected client. */ void ReserveClientIds(struct _Client *client) { #ifdef CLIENTIDS if (client == NullClient) return; assert(!client->clientIds); client->clientIds = calloc(1, sizeof(ClientIdRec)); if (!client->clientIds) return; client->clientIds->pid = DetermineClientPid(client); if (client->clientIds->pid != -1) DetermineClientCmd(client->clientIds->pid, &client->clientIds->cmdname, &client->clientIds->cmdargs); DebugF("client(%lx): Reserved pid(%d).\n", (unsigned long) client->clientAsMask, client->clientIds->pid); DebugF("client(%lx): Reserved cmdname(%s) and cmdargs(%s).\n", (unsigned long) client->clientAsMask, client->clientIds->cmdname ? client->clientIds->cmdname : "NULL", client->clientIds->cmdargs ? client->clientIds->cmdargs : "NULL"); #endif /* CLIENTIDS */ } /** * Called when an existing client disconnects. Frees client ID * information. * * @param[in] client Recently disconnected client. */ void ReleaseClientIds(struct _Client *client) { #ifdef CLIENTIDS if (client == NullClient) return; if (!client->clientIds) return; DebugF("client(%lx): Released pid(%d).\n", (unsigned long) client->clientAsMask, client->clientIds->pid); DebugF("client(%lx): Released cmdline(%s) and cmdargs(%s).\n", (unsigned long) client->clientAsMask, client->clientIds->cmdname ? client->clientIds->cmdname : "NULL", client->clientIds->cmdargs ? client->clientIds->cmdargs : "NULL"); free((void *) client->clientIds->cmdname); /* const char * */ free((void *) client->clientIds->cmdargs); /* const char * */ free(client->clientIds); client->clientIds = NULL; #endif /* CLIENTIDS */ } /** * Get cached PID of a client. * * param[in] client Client whose PID has been already cached. * * @return Cached client PID. Error (-1) if called: * - before ClientStateInitial client state notification * - after ClientStateGone client state notification * - for remote clients * * @see DetermineClientPid */ pid_t GetClientPid(struct _Client *client) { if (client == NullClient) return -1; if (!client->clientIds) return -1; return client->clientIds->pid; } /** * Get cached command name string of a client. * * param[in] client Client whose command line string has been already * cached. * * @return Cached client command name. Error (NULL) if called: * - before ClientStateInitial client state notification * - after ClientStateGone client state notification * - for remote clients * - on OS that doesn't support mapping of PID to command line * * @see DetermineClientCmd */ const char * GetClientCmdName(struct _Client *client) { if (client == NullClient) return NULL; if (!client->clientIds) return NULL; return client->clientIds->cmdname; } /** * Get cached command arguments string of a client. * * param[in] client Client whose command line string has been already * cached. * * @return Cached client command arguments. Error (NULL) if called: * - before ClientStateInitial client state notification * - after ClientStateGone client state notification * - for remote clients * - on OS that doesn't support mapping of PID to command line * * @see DetermineClientCmd */ const char * GetClientCmdArgs(struct _Client *client) { if (client == NullClient) return NULL; if (!client->clientIds) return NULL; return client->clientIds->cmdargs; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/connection.c0000644000000000000000000007704413614532331017533 0ustar /*********************************************************** Copyright 1987, 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /***************************************************************** * Stuff to create connections --- OS dependent * * EstablishNewConnections, CreateWellKnownSockets, ResetWellKnownSockets, * CloseDownConnection, CheckConnections, * OnlyListToOneClient, * ListenToAllClients, * * (WaitForSomething is in its own file) * * In this implementation, a client socket table is not kept. * Instead, what would be the index into the table is just the * file descriptor of the socket. This won't work for if the * socket ids aren't small nums (0 - 2^8) * *****************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #define XSERV_t #define TRANS_SERVER #define TRANS_REOPEN #include #include #include #include #include #include #include #include #if defined(TCPCONN) # include # include /* FIXME: correct indentation levels after ancient platform support clean-up */ # ifdef apollo # ifndef NO_TCP_H # include # endif # else # ifdef CSRG_BASED # include # endif # include # endif # include #endif #include #include "misc.h" #include "osdep.h" #include #include "opaque.h" #include "dixstruct.h" #include "list.h" #ifdef XCSECURITY #define _SECURITY_SERVER #include #endif #ifdef X_NOT_POSIX #define Pid_t int #else #define Pid_t pid_t #endif int lastfdesc; /* maximum file descriptor */ fd_set NotifyReadFds; /* mask for other file descriptors */ fd_set NotifyWriteFds; /* mask for other write file descriptors */ fd_set AllSockets; /* select on this */ fd_set AllClients; /* available clients */ fd_set LastSelectMask; /* mask returned from last select call */ fd_set LastSelectWriteMask; /* mask returned from last select call */ fd_set ClientsWithInput; /* clients with FULL requests in buffer */ fd_set ClientsWriteBlocked; /* clients who cannot receive output */ fd_set OutputPending; /* clients with reply/event data ready to go */ int MaxClients = 0; int NumNotifyWriteFd; /* Number of NotifyFd members with write set */ Bool NewOutputPending; /* not yet attempted to write some new output */ Bool AnyWritesPending; /* true if some client blocked on write or NotifyFd with write */ Bool NoListenAll; /* Don't establish any listening sockets */ Bool RunFromSmartParent; /* send SIGUSR1 to parent process */ static char dynamic_display[7]; /* display name */ Bool PartialNetwork; /* continue even if unable to bind all addrs */ static Pid_t ParentProcess; static Bool debug_conns = FALSE; fd_set IgnoredClientsWithInput; static fd_set GrabImperviousClients; static fd_set SavedAllClients; static fd_set SavedAllSockets; static fd_set SavedClientsWithInput; int GrabInProgress = 0; static void QueueNewConnections(int curconn, int ready, void *data); int *ConnectionTranslation = NULL; XtransConnInfo *ListenTransConns = NULL; int *ListenTransFds = NULL; int ListenTransCount; static void ErrorConnMax(XtransConnInfo /* trans_conn */); static void CloseDownFileDescriptor( OsCommPtr /*oc*/ ); static XtransConnInfo lookup_trans_conn (int fd) { if (ListenTransFds) { int i; for (i = 0; i < ListenTransCount; i++) if (ListenTransFds[i] == fd) return ListenTransConns[i]; } return (NULL); } /* Set MaxClients and lastfdesc, and allocate ConnectionTranslation */ void InitConnectionLimits(void) { lastfdesc = -1; #ifndef __CYGWIN__ #if !defined(XNO_SYSCONF) && defined(_SC_OPEN_MAX) lastfdesc = sysconf(_SC_OPEN_MAX) - 1; #endif #ifdef HAS_GETDTABLESIZE if (lastfdesc < 0) lastfdesc = getdtablesize() - 1; #endif #ifdef _NFILE if (lastfdesc < 0) lastfdesc = _NFILE - 1; #endif #endif /* __CYGWIN__ */ /* This is the fallback */ if (lastfdesc < 0) lastfdesc = MAXSOCKS; if (lastfdesc > MAXSELECT) lastfdesc = MAXSELECT; if (lastfdesc > MAXCLIENTS) { lastfdesc = MAXCLIENTS; if (debug_conns) ErrorF( "REACHED MAXIMUM CLIENTS LIMIT %d\n", MAXCLIENTS); } MaxClients = lastfdesc; #ifdef DEBUG ErrorF("InitConnectionLimits: MaxClients = %d\n", MaxClients); #endif ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1)); } /* * If SIGUSR1 was set to SIG_IGN when the server started, assume that either * * a- The parent process is ignoring SIGUSR1 * * or * * b- The parent process is expecting a SIGUSR1 * when the server is ready to accept connections * * In the first case, the signal will be harmless, in the second case, * the signal will be quite useful. */ static void InitParentProcess(void) { OsSigHandlerPtr handler; handler = OsSignal (SIGUSR1, SIG_IGN); if ( handler == SIG_IGN) RunFromSmartParent = TRUE; OsSignal(SIGUSR1, handler); ParentProcess = getppid (); #ifdef __UNIXOS2__ /* * fg030505: under OS/2, xinit is not the parent process but * the "grant parent" process of the server because execvpe() * presents us an additional process number; * GetPPID(pid) is part of libemxfix */ ParentProcess = GetPPID (ParentProcess); #endif /* __UNIXOS2__ */ } void NotifyParentProcess(void) { if (displayfd >= 0) { #ifdef NXAGENT_SERVER if (displayfd == STDERR_FILENO) { const char *msg = "Auto-detected display number is: DISPLAY=:"; if (write(displayfd, msg, strlen(msg)) != strlen(msg)) FatalError("Cannot write display number to fd %d\n", displayfd); } #endif if (write(displayfd, display, strlen(display)) != strlen(display)) FatalError("Cannot write display number to fd %d\n", displayfd); if (write(displayfd, "\n", 1) != 1) FatalError("Cannot write display number to fd %d\n", displayfd); close(displayfd); displayfd = -1; } if (RunFromSmartParent) { if (ParentProcess > 1) { kill (ParentProcess, SIGUSR1); } } } static Bool TryCreateSocket(int num, int *partial) { char port[20]; snprintf(port, sizeof(port), "%d", num); return (_XSERVTransMakeAllCOTSServerListeners(port, partial, &ListenTransCount, &ListenTransConns) >= 0); } /***************** * CreateWellKnownSockets * At initialization, create the sockets to listen on for new clients. *****************/ void CreateWellKnownSockets(void) { int i; int partial; FD_ZERO(&AllSockets); FD_ZERO(&AllClients); FD_ZERO(&LastSelectMask); FD_ZERO(&ClientsWithInput); for (i=0; i= 1) if (!PartialNetwork && partial) FatalError ("Failed to establish all listening sockets"); } else { /* -displayfd and no explicit display number */ Bool found = 0; int i_offset = 0; #ifdef NXAGENT_SERVER if (explicit_display) i_offset = atoi(display); #endif /* NXAGENT_SERVER */ for (i = i_offset; i < 65536 - X_TCP_PORT; i++) { if (TryCreateSocket(i, &partial) && !partial) { found = 1; break; } else CloseWellKnownConnections(); } if (!found) FatalError("Failed to find a socket to listen on"); snprintf(dynamic_display, sizeof(dynamic_display), "%d", i); display = dynamic_display; LogSetDisplay(); } ListenTransFds = malloc(ListenTransCount * sizeof (int)); for (i = 0; i < ListenTransCount; i++) { int fd = _XSERVTransGetConnectionNumber(ListenTransConns[i]); ListenTransFds[i] = fd; SetNotifyFd(fd, QueueNewConnections, X_NOTIFY_READ, NULL); if (!_XSERVTransIsLocal(ListenTransConns[i])) DefineSelf (fd); } if (ListenTransCount == 0 && !NoListenAll) FatalError ("Cannot establish any listening sockets - Make sure an X server isn't already running"); OsSignal (SIGPIPE, SIG_IGN); OsSignal (SIGHUP, AutoResetServer); OsSignal (SIGINT, GiveUp); OsSignal (SIGTERM, GiveUp); ResetHosts(display); InitParentProcess(); #ifdef XDMCP XdmcpInit (); #endif } #ifdef NX_TRANS_SOCKET /* * The following block is now defined also * under Cygwin to support this environment. */ #ifndef __DARWIN__ /* * This is defined in Xtranssock.c and must * be called explicitly as it doesn't share * a pointer in the transport function table. */ extern void _XSERVTransSocketRejectConnection(XtransConnInfo); void RejectWellKnownSockets () { int i; for (i = 0; i < ListenTransCount; i++) { _XSERVTransSocketRejectConnection(ListenTransConns[i]); } } #endif /* #ifndef __DARWIN__ */ #else /* #ifdef NX_TRANS_SOCKET */ void RejectWellKnownSockets () { } #endif /* #ifdef NX_TRANS_SOCKET */ void ResetWellKnownSockets (void) { int i; ResetOsBuffers(); for (i = 0; i < ListenTransCount; i++) { int status = _XSERVTransResetListener (ListenTransConns[i]); if (status != TRANS_RESET_NOOP) { if (status == TRANS_RESET_FAILURE) { /* * ListenTransConns[i] freed by xtrans. * Remove it from out list. */ RemoveNotifyFd(ListenTransFds[i]); ListenTransFds[i] = ListenTransFds[ListenTransCount - 1]; ListenTransConns[i] = ListenTransConns[ListenTransCount - 1]; ListenTransCount -= 1; i -= 1; } else if (status == TRANS_RESET_NEW_FD) { /* * A new file descriptor was allocated (the old one was closed) */ int newfd = _XSERVTransGetConnectionNumber (ListenTransConns[i]); ListenTransFds[i] = newfd; } } } for (i = 0; i < ListenTransCount; i++) SetNotifyFd(ListenTransFds[i], QueueNewConnections, X_NOTIFY_READ, NULL); ResetAuthorization (); ResetHosts(display); /* * restart XDMCP */ #ifdef XDMCP XdmcpReset (); #endif } void CloseWellKnownConnections(void) { int i; for (i = 0; i < ListenTransCount; i++) { if (ListenTransConns[i] != NULL) { _XSERVTransClose(ListenTransConns[i]); ListenTransConns[i] = NULL; if (ListenTransFds != NULL) RemoveNotifyFd(ListenTransFds[i]); } } ListenTransCount = 0; } static void AuthAudit (ClientPtr client, Bool letin, struct sockaddr *saddr, int len, unsigned int proto_n, char *auth_proto, int auth_id) { char addr[128]; char *out = addr; char client_uid_string[64]; LocalClientCredRec *lcc; if (!len) strcpy(out, "local host"); else switch (saddr->sa_family) { case AF_UNSPEC: #if defined(UNIXCONN) || defined(LOCALCONN) case AF_UNIX: #endif strcpy(out, "local host"); break; #if defined(TCPCONN) case AF_INET: sprintf(out, "IP %s", inet_ntoa(((struct sockaddr_in *) saddr)->sin_addr)); break; #if defined(IPv6) && defined(AF_INET6) case AF_INET6: { char ipaddr[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, &((struct sockaddr_in6 *) saddr)->sin6_addr, ipaddr, sizeof(ipaddr)); sprintf(out, "IP %s", ipaddr); } break; #endif #endif default: strcpy(out, "unknown address"); } if (GetLocalClientCreds(client, &lcc) != -1) { int slen; /* length written to client_uid_string */ strcpy(client_uid_string, " ( "); slen = 3; if (lcc->fieldsSet & LCC_UID_SET) { snprintf(client_uid_string + slen, sizeof(client_uid_string) - slen, "uid=%ld ", (long) lcc->euid); slen = strlen(client_uid_string); } if (lcc->fieldsSet & LCC_GID_SET) { snprintf(client_uid_string + slen, sizeof(client_uid_string) - slen, "gid=%ld ", (long) lcc->egid); slen = strlen(client_uid_string); } if (lcc->fieldsSet & LCC_PID_SET) { snprintf(client_uid_string + slen, sizeof(client_uid_string) - slen, "pid=%ld ", (long) lcc->pid); slen = strlen(client_uid_string); } if (lcc->fieldsSet & LCC_ZID_SET) { snprintf(client_uid_string + slen, sizeof(client_uid_string) - slen, "zoneid=%ld ", (long) lcc->zoneid); slen = strlen(client_uid_string); } snprintf(client_uid_string + slen, sizeof(client_uid_string) - slen, ")"); FreeLocalClientCreds(lcc); } else { client_uid_string[0] = '\0'; } if (proto_n) AuditF("client %d %s from %s%s\n Auth name: %.*s ID: %d\n", client->index, letin ? "connected" : "rejected", addr, client_uid_string, (int)proto_n, auth_proto, auth_id); else AuditF("client %d %s from %s%s\n", client->index, letin ? "connected" : "rejected", addr, client_uid_string); } XID AuthorizationIDOfClient(ClientPtr client) { if (client->osPrivate) return ((OsCommPtr)client->osPrivate)->auth_id; else return None; } /***************************************************************** * ClientAuthorized * * Sent by the client at connection setup: * typedef struct _xConnClientPrefix { * CARD8 byteOrder; * BYTE pad; * CARD16 majorVersion, minorVersion; * CARD16 nbytesAuthProto; * CARD16 nbytesAuthString; * } xConnClientPrefix; * * It is hoped that eventually one protocol will be agreed upon. In the * mean time, a server that implements a different protocol than the * client expects, or a server that only implements the host-based * mechanism, will simply ignore this information. * *****************************************************************/ char * ClientAuthorized(ClientPtr client, unsigned int proto_n, char *auth_proto, unsigned int string_n, char *auth_string) { OsCommPtr priv; Xtransaddr *from = NULL; int family; int fromlen; XID auth_id; char *reason = NULL; XtransConnInfo trans_conn; priv = (OsCommPtr)client->osPrivate; trans_conn = priv->trans_conn; auth_id = CheckAuthorization (proto_n, auth_proto, string_n, auth_string, client, &reason); if (auth_id == (XID) ~0L) { if ( #ifdef XCSECURITY (proto_n == 0 || strncmp (auth_proto, XSecurityAuthorizationName, proto_n) != 0) && #endif _XSERVTransGetPeerAddr (trans_conn, &family, &fromlen, &from) != -1) { if ( InvalidHost ((struct sockaddr *) from, fromlen, client)) AuthAudit(client, FALSE, (struct sockaddr *) from, fromlen, proto_n, auth_proto, auth_id); else { auth_id = (XID) 0; if (auditTrailLevel > 1) AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen, proto_n, auth_proto, auth_id); } free ((char *) from); } if (auth_id == (XID) ~0L) { if (reason) return reason; else return "Client is not authorized to connect to Server"; } } else if (auditTrailLevel > 1) { if (_XSERVTransGetPeerAddr (trans_conn, &family, &fromlen, &from) != -1) { AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen, proto_n, auth_proto, auth_id); free ((char *) from); } } priv->auth_id = auth_id; priv->conn_time = 0; #ifdef XDMCP /* indicate to Xdmcp protocol that we've opened new client */ XdmcpOpenDisplay(priv->fd); #endif /* XDMCP */ /* At this point, if the client is authorized to change the access control * list, we should getpeername() information, and add the client to * the selfhosts list. It's not really the host machine, but the * true purpose of the selfhosts list is to see who may change the * access control list. */ return((char *)NULL); } static ClientPtr AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time) { OsCommPtr oc; ClientPtr client; if ( fd >= lastfdesc ) return NullClient; oc = (OsCommPtr)malloc(sizeof(OsCommRec)); if (!oc) return NullClient; oc->trans_conn = trans_conn; oc->fd = fd; oc->input = (ConnectionInputPtr)NULL; oc->output = (ConnectionOutputPtr)NULL; oc->auth_id = None; oc->conn_time = conn_time; if (!(client = NextAvailableClient((void *)oc))) { free (oc); return NullClient; } client->local = ComputeLocalClient(client); { ConnectionTranslation[fd] = client->index; if (GrabInProgress) { FD_SET(fd, &SavedAllClients); FD_SET(fd, &SavedAllSockets); } else { FD_SET(fd, &AllClients); FD_SET(fd, &AllSockets); } } #ifdef DEBUG ErrorF("AllocNewConnection: client index = %d, socket fd = %d\n", client->index, fd); #endif return client; } /***************** * EstablishNewConnections * If anyone is waiting on listened sockets, accept them. * Returns a mask with indices of new clients. Updates AllClients * and AllSockets. *****************/ static Bool EstablishNewConnections(ClientPtr clientUnused, void * closure) { int curconn = (int) (intptr_t) closure; int newconn; /* fd of new client */ CARD32 connect_time; int i; ClientPtr client; OsCommPtr oc; XtransConnInfo trans_conn, new_trans_conn; int status; connect_time = GetTimeInMillis(); /* kill off stragglers */ for (i=1; iosPrivate); if ((oc && (oc->conn_time != 0) && (connect_time - oc->conn_time) >= TimeOutValue) || (client->noClientException != Success && !client->clientGone)) CloseDownClient(client); } } if ((trans_conn = lookup_trans_conn(curconn)) == NULL) return TRUE; if ((new_trans_conn = _XSERVTransAccept(trans_conn, &status)) == NULL) return TRUE; newconn = _XSERVTransGetConnectionNumber(new_trans_conn); if (newconn < lastfdesc) { int clientid; clientid = ConnectionTranslation[newconn]; if (clientid && (client = clients[clientid])) CloseDownClient(client); } _XSERVTransSetOption(new_trans_conn, TRANS_NONBLOCKING, 1); if (trans_conn->flags & TRANS_NOXAUTH) new_trans_conn->flags = new_trans_conn->flags | TRANS_NOXAUTH; if (!AllocNewConnection(new_trans_conn, newconn, connect_time)) { ErrorConnMax(new_trans_conn); } return TRUE; } static void QueueNewConnections(int fd, int ready, void *data) { QueueWorkProc(EstablishNewConnections, NULL, (void *) (intptr_t) fd); } #define NOROOM "Maximum number of clients reached" /************ * ErrorConnMax * Fail a connection due to lack of client or file descriptor space ************/ static void ConnMaxNotify(int fd, int events, void *data) { XtransConnInfo trans_conn = data; char order = 0; /* try to read the byte-order of the connection */ (void)_XSERVTransRead(trans_conn, &order, 1); if (order == 'l' || order == 'B' || order == 'r' || order == 'R') { xConnSetupPrefix csp; char pad[3] = { 0, 0, 0 }; int whichbyte = 1; struct iovec iov[3]; csp.success = xFalse; csp.lengthReason = sizeof(NOROOM) - 1; csp.length = (sizeof(NOROOM) + 2) >> 2; csp.majorVersion = X_PROTOCOL; csp.minorVersion = X_PROTOCOL_REVISION; if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) || (!(*(char *) &whichbyte) && (order == 'l' || order == 'r'))) { swaps(&csp.majorVersion); swaps(&csp.minorVersion); swaps(&csp.length); } iov[0].iov_len = sz_xConnSetupPrefix; iov[0].iov_base = (char *) &csp; iov[1].iov_len = csp.lengthReason; iov[1].iov_base = NOROOM; iov[2].iov_len = (4 - (csp.lengthReason & 3)) & 3; iov[2].iov_base = pad; (void)_XSERVTransWritev(trans_conn, iov, 3); } RemoveNotifyFd(trans_conn->fd); _XSERVTransClose(trans_conn); } static void ErrorConnMax(XtransConnInfo trans_conn) { if (!SetNotifyFd(trans_conn->fd, ConnMaxNotify, X_NOTIFY_READ, trans_conn)) _XSERVTransClose(trans_conn); } /************ * CloseDownFileDescriptor: * Remove this file descriptor and it's I/O buffers, etc. ************/ static void CloseDownFileDescriptor(OsCommPtr oc) { int connection = oc->fd; if (oc->trans_conn) { _XSERVTransDisconnect(oc->trans_conn); _XSERVTransClose(oc->trans_conn); } FreeOsBuffers(oc); free(oc); ConnectionTranslation[connection] = 0; FD_CLR(connection, &AllSockets); FD_CLR(connection, &AllClients); FD_CLR(connection, &ClientsWithInput); FD_CLR(connection, &GrabImperviousClients); if (GrabInProgress) { FD_CLR(connection, &SavedAllSockets); FD_CLR(connection, &SavedAllClients); FD_CLR(connection, &SavedClientsWithInput); } FD_CLR(connection, &ClientsWriteBlocked); if (!XFD_ANYSET(&ClientsWriteBlocked) && NumNotifyWriteFd == 0) AnyWritesPending = FALSE; FD_CLR(connection, &OutputPending); } /***************** * CheckConnections * Some connection has died, go find which one and shut it down * The file descriptor has been closed, but is still in AllClients. * If would truly be wonderful if select() would put the bogus * file descriptors in the exception mask, but nooooo. So we have * to check each and every socket individually. *****************/ void CheckConnections(void) { fd_mask mask; fd_set tmask; int curclient, curoff; int i; struct timeval notime; int r; notime.tv_sec = 0; notime.tv_usec = 0; for (i=0; iosPrivate; if (FlushCallback) CallCallbacks(&FlushCallback, client); if (oc->output && oc->output->count) FlushClient(client, oc, (char *)NULL, 0); #ifdef XDMCP XdmcpCloseDisplay(oc->fd); #endif CloseDownFileDescriptor(oc); client->osPrivate = (void *)NULL; if (auditTrailLevel > 1) AuditF("client %d disconnected\n", client->index); } struct notify_fd { struct xorg_list list; int fd; int mask; NotifyFdProcPtr notify; void *data; }; static struct xorg_list notify_fds; void InitNotifyFds(void) { struct notify_fd *s, *next; static int been_here; if (been_here) xorg_list_for_each_entry_safe(s, next, ¬ify_fds, list) RemoveNotifyFd(s->fd); xorg_list_init(¬ify_fds); NumNotifyWriteFd = 0; been_here = 1; } /***************** * SetNotifyFd * Registers a callback to be invoked when the specified * file descriptor becomes readable. *****************/ Bool SetNotifyFd(int fd, NotifyFdProcPtr notify, int mask, void *data) { struct notify_fd *n; int changes; xorg_list_for_each_entry(n, ¬ify_fds, list) if (n->fd == fd) break; if (&n->list == ¬ify_fds) { if (mask == 0) return TRUE; n = calloc(1, sizeof (struct notify_fd)); if (!n) return FALSE; n->fd = fd; xorg_list_add(&n->list, ¬ify_fds); } changes = n->mask ^ mask; if (changes & X_NOTIFY_READ) { if (mask & X_NOTIFY_READ) { FD_SET(fd, &NotifyReadFds); FD_SET(fd, &AllSockets); if (GrabInProgress) FD_SET(fd, &SavedAllSockets); } else { FD_CLR(fd, &AllSockets); if (GrabInProgress) FD_CLR(fd, &SavedAllSockets); FD_CLR(fd, &NotifyReadFds); } } if (changes & X_NOTIFY_WRITE) { if (mask & X_NOTIFY_WRITE) { FD_SET(fd, &NotifyWriteFds); if (!NumNotifyWriteFd++) AnyWritesPending = TRUE; } else { FD_CLR(fd, &NotifyWriteFds); if (!--NumNotifyWriteFd) if (!XFD_ANYSET(&ClientsWriteBlocked)) AnyWritesPending = FALSE; } } if (mask == 0) { xorg_list_del(&n->list); free(n); } else { n->mask = mask; n->data = data; n->notify = notify; } return TRUE; } /***************** * HandlNotifyFds * A WorkProc to be called when any of the registered * file descriptors are readable. *****************/ void HandleNotifyFds(void) { struct notify_fd *n, *next; xorg_list_for_each_entry_safe(n, next, ¬ify_fds, list) { int ready = 0; if ((n->mask & X_NOTIFY_READ) && FD_ISSET(n->fd, &LastSelectMask)) ready |= X_NOTIFY_READ; if ((n->mask & X_NOTIFY_WRITE) & FD_ISSET(n->fd, &LastSelectWriteMask)) ready |= X_NOTIFY_WRITE; if (ready != 0) n->notify(n->fd, ready, n->data); } } /***************** * OnlyListenToOneClient: * Only accept requests from one client. Continue to handle new * connections, but don't take any protocol requests from the new * ones. Note that if GrabInProgress is set, EstablishNewConnections * needs to put new clients into SavedAllSockets and SavedAllClients. * Note also that there is no timeout for this in the protocol. * This routine is "undone" by ListenToAllClients() *****************/ void OnlyListenToOneClient(ClientPtr client) { OsCommPtr oc = (OsCommPtr)client->osPrivate; int connection = oc->fd; if (! GrabInProgress) { XFD_COPYSET(&ClientsWithInput, &SavedClientsWithInput); XFD_ANDSET(&ClientsWithInput, &ClientsWithInput, &GrabImperviousClients); if (FD_ISSET(connection, &SavedClientsWithInput)) { FD_CLR(connection, &SavedClientsWithInput); FD_SET(connection, &ClientsWithInput); } XFD_UNSET(&SavedClientsWithInput, &GrabImperviousClients); XFD_COPYSET(&AllSockets, &SavedAllSockets); XFD_COPYSET(&AllClients, &SavedAllClients); XFD_UNSET(&AllSockets, &AllClients); XFD_ANDSET(&AllClients, &AllClients, &GrabImperviousClients); FD_SET(connection, &AllClients); XFD_ORSET(&AllSockets, &AllSockets, &AllClients); GrabInProgress = client->index; } } /**************** * ListenToAllClients: * Undoes OnlyListentToOneClient() ****************/ void ListenToAllClients(void) { if (GrabInProgress) { XFD_ORSET(&AllSockets, &AllSockets, &SavedAllSockets); XFD_ORSET(&AllClients, &AllClients, &SavedAllClients); XFD_ORSET(&ClientsWithInput, &ClientsWithInput, &SavedClientsWithInput); GrabInProgress = 0; } } /**************** * IgnoreClient * Removes one client from input masks. * Must have cooresponding call to AttendClient. ****************/ void IgnoreClient (ClientPtr client) { OsCommPtr oc = (OsCommPtr)client->osPrivate; int connection = oc->fd; isItTimeToYield = TRUE; if (!GrabInProgress || FD_ISSET(connection, &AllClients)) { if (FD_ISSET (connection, &ClientsWithInput)) FD_SET(connection, &IgnoredClientsWithInput); else FD_CLR(connection, &IgnoredClientsWithInput); FD_CLR(connection, &ClientsWithInput); FD_CLR(connection, &AllSockets); FD_CLR(connection, &AllClients); FD_CLR(connection, &LastSelectMask); } else { if (FD_ISSET (connection, &SavedClientsWithInput)) FD_SET(connection, &IgnoredClientsWithInput); else FD_CLR(connection, &IgnoredClientsWithInput); FD_CLR(connection, &SavedClientsWithInput); FD_CLR(connection, &SavedAllSockets); FD_CLR(connection, &SavedAllClients); } } /**************** * AttendClient * Adds one client back into the input masks. ****************/ void AttendClient (ClientPtr client) { OsCommPtr oc = (OsCommPtr)client->osPrivate; int connection = oc->fd; if (!GrabInProgress || GrabInProgress == client->index || FD_ISSET(connection, &GrabImperviousClients)) { FD_SET(connection, &AllClients); FD_SET(connection, &AllSockets); FD_SET(connection, &LastSelectMask); if (FD_ISSET (connection, &IgnoredClientsWithInput)) FD_SET(connection, &ClientsWithInput); } else { FD_SET(connection, &SavedAllClients); FD_SET(connection, &SavedAllSockets); if (FD_ISSET(connection, &IgnoredClientsWithInput)) FD_SET(connection, &SavedClientsWithInput); } } /* make client impervious to grabs; assume only executing client calls this */ void MakeClientGrabImpervious(ClientPtr client) { OsCommPtr oc = (OsCommPtr)client->osPrivate; int connection = oc->fd; FD_SET(connection, &GrabImperviousClients); if (ServerGrabCallback) { ServerGrabInfoRec grabinfo; grabinfo.client = client; grabinfo.grabstate = CLIENT_IMPERVIOUS; CallCallbacks(&ServerGrabCallback, &grabinfo); } } /* make client pervious to grabs; assume only executing client calls this */ void MakeClientGrabPervious(ClientPtr client) { OsCommPtr oc = (OsCommPtr)client->osPrivate; int connection = oc->fd; FD_CLR(connection, &GrabImperviousClients); if (GrabInProgress && (GrabInProgress != client->index)) { if (FD_ISSET(connection, &ClientsWithInput)) { FD_SET(connection, &SavedClientsWithInput); FD_CLR(connection, &ClientsWithInput); } FD_CLR(connection, &AllSockets); FD_CLR(connection, &AllClients); isItTimeToYield = TRUE; } if (ServerGrabCallback) { ServerGrabInfoRec grabinfo; grabinfo.client = client; grabinfo.grabstate = CLIENT_PERVIOUS; CallCallbacks(&ServerGrabCallback, &grabinfo); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/Imakefile0000644000000000000000000001755613614532331017043 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include NULL = /* * If you have any extra files to be put into the library, define them here. */ ZONEID_DEFINES = -UHAVE_GETZONEID #if NXLibraries NX_INCLUDES = -I../../../../nxcomp NX_DEFINES = -DNX_TRANS_SOCKET \ -DNX_TRANS_AUTH \ -DNX_TRANS_FOPEN \ -DNX_TRANS_SLEEP \ -DNX_TRANS_EXIT \ -DNX_TRANS_WAKEUP=1000 \ -DNXAGENT_SERVER \ $(NULL) # -DNX_TRANS_WARN \ # -DNX_TRANS_INFO \ # -DNX_TRANS_TEST \ # -DNX_TRANS_DEBUG \ #endif /* * do not modify the following two definitions */ #ifndef OtherSources #define OtherSources #endif #ifndef OtherObjects #define OtherObjects #endif #if HasXdmAuth XDMAUTHDEFS = -DHASXDMAUTH XDMAUTHOBJS = xdmauth.o XDMAUTHSRCS = xdmauth.c #else XDMAUTHDEFS = XDMAUTHOBJS = XDMAUTHSCRS = #endif TIRPC_INCLUDES = #if HasSecureRPC RPCDEFS = -DSECURE_RPC RPCOBJS = rpcauth.o RPCSRCS = rpcauth.c #if UseTIRPC TIRPC_INCLUDES = $$(pkg-config --cflags-only-I 'libtirpc') #endif #else RPCDEFS = RPCOBJS = RPCSRCS = #endif #if HasBSD44Sockets SOCK_DEFINES = -DBSD44SOCKETS #endif #if HasGetIfAddrs IFADDRS_DEFINES = -DHAS_GETIFADDRS #endif #if !defined(DDXOsColor) COLOR_SRCS=oscolor.c COLOR_OBJS=oscolor.o #endif #if !HasSnprintf SNPRINTF_SRCS = snprintf.c SNPRINTF_OBJS = snprintf.o #endif #if !HasStrlcat STRLCAT_SRCS = strlcat.c strlcpy.c STRLCAT_OBJS = strlcat.o strlcpy.o #endif #if !HasReallocarray REALLOCARRAY_SRCS = reallocarray.c REALLOCARRAY_OBJS = reallocarray.o #endif #if HasGetpeerucred GETPEER_DEFINES = -DHAS_GETPEERUCRED #else # if HasGetpeereid GETPEER_DEFINES = -DHAS_GETPEEREID # endif #endif #if !HasTimingsafeMemcmp TMEMCMP_SRCS = timingsafe_memcmp.c TMEMCMP_OBJS = timingsafe_memcmp.o #endif BOOTSTRAPCFLAGS = SRCS = WaitFor.c \ access.c \ client.c \ connection.c \ io.c \ $(COLOR_SRCS) \ osinit.c \ utils.c \ log.c \ auth.c \ mitauth.c \ secauth.c \ $(XDMAUTHSRCS) \ $(RPCSRCS) \ xdmcp.c \ OtherSources \ xstrans.c \ $(SNPRINTF_SRCS) \ $(STRLCAT_SRCS) \ $(REALLOCARRAY_SRCS) \ xprintf.c \ $(TMEMCMP_SRCS) \ $(NULL) OBJS = WaitFor.o \ access.o \ client.o \ connection.o \ io.o \ $(COLOR_OBJS) \ osinit.o \ utils.o \ log.o \ auth.o \ mitauth.o \ secauth.o \ $(XDMAUTHOBJS) \ $(RPCOBJS) \ xdmcp.o \ OtherObjects \ xstrans.o \ $(SNPRINTF_OBJS) \ $(STRLCAT_OBJS) \ $(REALLOCARRAY_OBJS) \ xprintf.o \ $(TMEMCMP_OBJS) \ $(NULL) #if UseMemLeak MEM_DEFINES = -DMEMBUG #endif ADM_DEFINES = -DADMPATH=\"$(ADMDIR)/X\%smsgs\" XDMCP_DEFINES = ServerXdmcpDefines ERROR_DEFINES = ServerErrorDefines #if HasPam && HasPamMisc PAM_DEFINES = -DUSE_PAM #endif XTRANS_DEFINES = -DXTRANS_SEND_FDS=0 DEFINES = $(CONNECTION_FLAGS) \ $(MEM_DEFINES) \ $(XDMAUTHDEFS) \ $(RPCDEFS) \ $(SIGNAL_DEFINES) \ $(OS_DEFINES) \ $(GETPEER_DEFINES) \ $(RANDOM_DEFINES) \ $(BUGMSG) \ $(XTRANS_FAILDEFINES) \ $(XTRANS_DEFINES) \ $(NX_DEFINES) \ $(NULL) INCLUDES = -I. \ -I../include \ -I$(XINCLUDESRC) \ -I$(EXTINCSRC) \ -I$(SERVERSRC)/Xext \ -I$(SERVERSRC)/render \ -I$(TOP)/lib/Xau \ $(NX_INCLUDES) \ `pkg-config --cflags-only-I pixman-1` \ $(TIRPC_INCLUDES) \ $(NULL) DEPEND_DEFINES = $(XDMCP_DEFINES) \ $(EXT_DEFINES) \ $(TRANS_INCLUDES) \ $(CONNECTION_FLAGS) \ $(GETPEER_DEFINES) \ DependDefines \ $(NULL) LINTLIBS = ../dix/llib-ldix.ln #ifdef NEED_ALLOCA_FROM_LIBPW PWLIB = /lib/libPW.a #endif /* NEED_ALLOCA_FROM_LIBPW */ NormalLibraryObjectRule() NormalLibraryTarget(os,$(OBJS)) LintLibraryTarget(os,$(SRCS)) NormalLintTarget($(SRCS)) #ifdef NEED_ALLOCA_FROM_LIBPW XCOMM XCOMM And this one is to get the version of alloca that lives in /lib/libPW.a XCOMM without getting all of the rest of the stuff in there. XCOMM alloca.o: $(PWLIB) rm -f alloca.o ar x $(PWLIB) alloca.o #endif /* NEED_ALLOCA_FROM_LIBPW */ SpecialCObjectRule(access,$(ICONFIGFILES),$(XDMCP_DEFINES) $(SOCK_DEFINES) $(IFADDRS_DEFINES) $(ZONEID_DEFINES)) SpecialCObjectRule(auth,$(ICONFIGFILES),$(XDMCP_DEFINES)) SpecialCObjectRule(xdmauth,$(ICONFIGFILES),$(XDMCP_DEFINES)) SpecialCObjectRule(xdmcp,$(ICONFIGFILES),$(SOCK_DEFINES) $(XDMCP_DEFINES)) SpecialCObjectRule(connection,$(ICONFIGFILES),$(SOCK_DEFINES) $(XDMCP_DEFINES)) SpecialCObjectRule(osinit,$(ICONFIGFILES),$(ADM_DEFINES)) SpecialCObjectRule(WaitFor,$(ICONFIGFILES),$(EXT_DEFINES)) SpecialCObjectRule(io,$(ICONFIGFILES),$(EXT_DEFINES)) SpecialCObjectRule(utils,$(ICONFIGFILES),$(XDMCP_DEFINES) $(EXT_DEFINES) $(ERROR_DEFINES) $(PAM_DEFINES)) #if defined(SparcArchitecture) && HasGcc && !HasGcc2 oscolor.o: oscolor.c $(ICONFIGFILES) $(RM) $@ cc -c $(CDEBUGFLAGS) $(ALLDEFINES) $*.c #endif #if !HasSnprintf LinkSourceFile(snprintf.c,$(LIBSRC)/misc) #endif DependTarget() nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/io.c0000644000000000000000000010100713614532331015766 0ustar /*********************************************************** Copyright 1987, 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /***************************************************************** * i/o functions * * WriteToClient, ReadRequestFromClient * InsertFakeRequest, ResetCurrentRequest * *****************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #if 0 #define DEBUG_COMMUNICATION #endif #include #define XSERV_t #define TRANS_SERVER #define TRANS_REOPEN #include #include #include #include #include #include #include "os.h" #include "osdep.h" #include #include "opaque.h" #include "dixstruct.h" #include "misc.h" CallbackListPtr ReplyCallback; CallbackListPtr FlushCallback; /* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX * systems are broken and return EWOULDBLOCK when they should return EAGAIN */ #if defined(EAGAIN) && defined(EWOULDBLOCK) #define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK) #else #ifdef EAGAIN #define ETEST(err) (err == EAGAIN) #else #define ETEST(err) (err == EWOULDBLOCK) #endif #endif Bool CriticalOutputPending; int timesThisConnection = 0; ConnectionInputPtr FreeInputs = (ConnectionInputPtr)NULL; ConnectionOutputPtr FreeOutputs = (ConnectionOutputPtr)NULL; OsCommPtr AvailableInput = (OsCommPtr)NULL; #define get_req_len(req,cli) ((cli)->swapped ? \ lswaps((req)->length) : (req)->length) #ifdef BIGREQS #include #define get_big_req_len(req,cli) ((cli)->swapped ? \ lswapl(((xBigReq *)(req))->length) : \ ((xBigReq *)(req))->length) #endif #define MAX_TIMES_PER 10 /* * A lot of the code in this file manipulates a ConnectionInputPtr: * * ----------------------------------------------- * |------- bufcnt ------->| | | * | |- gotnow ->| | | * | |-------- needed ------>| | * |-----------+--------- size --------+---------->| * ----------------------------------------------- * ^ ^ * | | * buffer bufptr * * buffer is a pointer to the start of the buffer. * bufptr points to the start of the current request. * bufcnt counts how many bytes are in the buffer. * size is the size of the buffer in bytes. * * In several of the functions, gotnow and needed are local variables * that do the following: * * gotnow is the number of bytes of the request that we're * trying to read that are currently in the buffer. * Typically, gotnow = (buffer + bufcnt) - bufptr * * needed = the length of the request that we're trying to * read. Watch out: needed sometimes counts bytes and sometimes * counts CARD32's. */ /***************************************************************** * ReadRequestFromClient * Returns one request in client->requestBuffer. The request * length will be in client->req_len. Return status is: * * > 0 if successful, specifies length in bytes of the request * = 0 if entire request is not yet available * < 0 if client should be terminated * * The request returned must be contiguous so that it can be * cast in the dispatcher to the correct request type. Because requests * are variable length, ReadRequestFromClient() must look at the first 4 * or 8 bytes of a request to determine the length (the request length is * in the 3rd and 4th bytes of the request unless it is a Big Request * (see the Big Request Extension), in which case the 3rd and 4th bytes * are zero and the following 4 bytes are the request length. * * Note: in order to make the server scheduler (WaitForSomething()) * "fair", the ClientsWithInput mask is used. This mask tells which * clients have FULL requests left in their buffers. Clients with * partial requests require a read. Basically, client buffers * are drained before select() is called again. But, we can't keep * reading from a client that is sending buckets of data (or has * a partial request) because others clients need to be scheduled. *****************************************************************/ #define YieldControl() \ { isItTimeToYield = TRUE; \ timesThisConnection = 0; } #define YieldControlNoInput() \ { YieldControl(); \ FD_CLR(fd, &ClientsWithInput); } #define YieldControlDeath() \ { timesThisConnection = 0; } int ReadRequestFromClient(ClientPtr client) { OsCommPtr oc = (OsCommPtr)client->osPrivate; ConnectionInputPtr oci = oc->input; int fd = oc->fd; unsigned int gotnow, needed; int result; register xReq *request; Bool need_header; #ifdef BIGREQS Bool move_header; #endif /* If an input buffer was empty, either free it if it is too big * or link it into our list of free input buffers. This means that * different clients can share the same input buffer (at different * times). This was done to save memory. */ if (AvailableInput) { if (AvailableInput != oc) { register ConnectionInputPtr aci = AvailableInput->input; if (aci->size > BUFWATERMARK) { free(aci->buffer); free(aci); } else { aci->next = FreeInputs; FreeInputs = aci; } AvailableInput->input = (ConnectionInputPtr)NULL; } AvailableInput = (OsCommPtr)NULL; } /* make sure we have an input buffer */ if (!oci) { if ((oci = FreeInputs)) { FreeInputs = oci->next; } else if (!(oci = AllocateInputBuffer())) { YieldControlDeath(); return -1; } oc->input = oci; } /* advance to start of next request */ oci->bufptr += oci->lenLastReq; need_header = FALSE; #ifdef BIGREQS move_header = FALSE; #endif gotnow = oci->bufcnt + oci->buffer - oci->bufptr; if (oci->ignoreBytes > 0) { if (oci->ignoreBytes > oci->size) needed = oci->size; else needed = oci->ignoreBytes; } else if (gotnow < sizeof(xReq)) { /* We don't have an entire xReq yet. Can't tell how big * the request will be until we get the whole xReq. */ needed = sizeof(xReq); need_header = TRUE; } else { /* We have a whole xReq. We can tell how big the whole * request will be unless it is a Big Request. */ request = (xReq *)oci->bufptr; needed = get_req_len(request, client); #ifdef BIGREQS if (!needed && client->big_requests) { /* It's a Big Request. */ move_header = TRUE; if (gotnow < sizeof(xBigReq)) { /* Still need more data to tell just how big. */ needed = sizeof(xBigReq) >> 2; /* needed is in CARD32s now */ need_header = TRUE; } else needed = get_big_req_len(request, client); } #endif client->req_len = needed; needed <<= 2; /* needed is in bytes now */ } if (gotnow < needed) { /* Need to read more data, either so that we can get a * complete xReq (if need_header is TRUE), a complete * xBigReq (if move_header is TRUE), or the rest of the * request (if need_header and move_header are both FALSE). */ oci->lenLastReq = 0; #ifdef BIGREQS if (needed > maxBigRequestSize << 2) { /* request is too big for us to handle */ /* * Mark the rest of it as needing to be ignored, and then return * the full size. Dispatch() will turn it into a BadLength error. */ oci->ignoreBytes = needed - gotnow; oci->lenLastReq = gotnow; return needed; } #endif if ((gotnow == 0) || ((oci->bufptr - oci->buffer + needed) > oci->size)) { /* no data, or the request is too big to fit in the buffer */ if ((gotnow > 0) && (oci->bufptr != oci->buffer)) /* save the data we've already read */ memmove(oci->buffer, oci->bufptr, gotnow); if (needed > oci->size) { /* make buffer bigger to accomodate request */ char *ibuf; ibuf = (char *)realloc(oci->buffer, needed); if (!ibuf) { YieldControlDeath(); return -1; } oci->size = needed; oci->buffer = ibuf; } oci->bufptr = oci->buffer; oci->bufcnt = gotnow; } /* XXX this is a workaround. This function is sometimes called * after the trans_conn has been freed. In this case trans_conn * will be null. Really ought to restructure things so that we * never get here in those circumstances. */ if (!oc->trans_conn) { /* treat as if an error occured on the read, which is what * used to happen */ YieldControlDeath(); return -1; } result = _XSERVTransRead(oc->trans_conn, oci->buffer + oci->bufcnt, oci->size - oci->bufcnt); if (result <= 0) { if ((result < 0) && ETEST(errno)) { #if defined(SVR4) && defined(__i386__) && !defined(sun) if (0) #endif { YieldControlNoInput(); return 0; } } YieldControlDeath(); return -1; } oci->bufcnt += result; gotnow += result; /* free up some space after huge requests */ if ((oci->size > BUFWATERMARK) && (oci->bufcnt < BUFSIZE) && (needed < BUFSIZE)) { char *ibuf; ibuf = (char *)realloc(oci->buffer, BUFSIZE); if (ibuf) { oci->size = BUFSIZE; oci->buffer = ibuf; oci->bufptr = ibuf + oci->bufcnt - gotnow; } } if (need_header && gotnow >= needed) { /* We wanted an xReq, now we've gotten it. */ request = (xReq *)oci->bufptr; needed = get_req_len(request, client); #ifdef BIGREQS if (!needed && client->big_requests) { move_header = TRUE; if (gotnow < sizeof(xBigReq)) needed = sizeof(xBigReq) >> 2; else needed = get_big_req_len(request, client); } #endif client->req_len = needed; needed <<= 2; } if (gotnow < needed) { /* Still don't have enough; punt. */ YieldControlNoInput(); return 0; } } if (needed == 0) { #ifdef BIGREQS if (client->big_requests) needed = sizeof(xBigReq); else #endif needed = sizeof(xReq); } /* If there are bytes to ignore, ignore them now. */ if (oci->ignoreBytes > 0) { assert(needed == oci->ignoreBytes || needed == oci->size); /* * The _XSERVTransRead call above may return more or fewer bytes than we * want to ignore. Ignore the smaller of the two sizes. */ if (gotnow < needed) { oci->ignoreBytes -= gotnow; oci->bufptr += gotnow; gotnow = 0; } else { oci->ignoreBytes -= needed; oci->bufptr += needed; gotnow -= needed; } needed = 0; } oci->lenLastReq = needed; /* * Check to see if client has at least one whole request in the * buffer beyond the request we're returning to the caller. * If there is only a partial request, treat like buffer * is empty so that select() will be called again and other clients * can get into the queue. */ gotnow -= needed; if (gotnow >= sizeof(xReq)) { request = (xReq *)(oci->bufptr + needed); if (gotnow >= (result = (get_req_len(request, client) << 2)) #ifdef BIGREQS && (result || (client->big_requests && (gotnow >= sizeof(xBigReq) && gotnow >= (get_big_req_len(request, client) << 2)))) #endif ) FD_SET(fd, &ClientsWithInput); else { FD_CLR(fd, &ClientsWithInput); } } else { if (!gotnow) AvailableInput = oc; FD_CLR(fd, &ClientsWithInput); } #ifdef BIGREQS if (move_header) { request = (xReq *)oci->bufptr; oci->bufptr += (sizeof(xBigReq) - sizeof(xReq)); *(xReq *)oci->bufptr = *request; oci->lenLastReq -= (sizeof(xBigReq) - sizeof(xReq)); client->req_len -= (sizeof(xBigReq) - sizeof(xReq)) >> 2; } #endif client->requestBuffer = (void *)oci->bufptr; #ifdef DEBUG_COMMUNICATION { xReq *req = client->requestBuffer; ErrorF("REQUEST: ClientIDX: %i, type: 0x%x data: 0x%x len: %i\n", client->index,req->reqType,req->data,req->length); } #endif return needed; } /***************************************************************** * InsertFakeRequest * Splice a consed up (possibly partial) request in as the next request. * **********************/ Bool InsertFakeRequest(ClientPtr client, char *data, int count) { OsCommPtr oc = (OsCommPtr)client->osPrivate; ConnectionInputPtr oci = oc->input; int fd = oc->fd; int gotnow, moveup; if (AvailableInput) { if (AvailableInput != oc) { ConnectionInputPtr aci = AvailableInput->input; if (aci->size > BUFWATERMARK) { free(aci->buffer); free(aci); } else { aci->next = FreeInputs; FreeInputs = aci; } AvailableInput->input = (ConnectionInputPtr)NULL; } AvailableInput = (OsCommPtr)NULL; } if (!oci) { if ((oci = FreeInputs)) FreeInputs = oci->next; else if (!(oci = AllocateInputBuffer())) return FALSE; oc->input = oci; } oci->bufptr += oci->lenLastReq; oci->lenLastReq = 0; gotnow = oci->bufcnt + oci->buffer - oci->bufptr; if ((gotnow + count) > oci->size) { char *ibuf; ibuf = (char *)realloc(oci->buffer, gotnow + count); if (!ibuf) return(FALSE); oci->size = gotnow + count; oci->buffer = ibuf; oci->bufptr = ibuf + oci->bufcnt - gotnow; } moveup = count - (oci->bufptr - oci->buffer); if (moveup > 0) { if (gotnow > 0) memmove(oci->bufptr + moveup, oci->bufptr, gotnow); oci->bufptr += moveup; oci->bufcnt += moveup; } memmove(oci->bufptr - count, data, count); oci->bufptr -= count; gotnow += count; if ((gotnow >= sizeof(xReq)) && (gotnow >= (int)(get_req_len((xReq *)oci->bufptr, client) << 2))) FD_SET(fd, &ClientsWithInput); else YieldControlNoInput(); return(TRUE); } /***************************************************************** * ResetRequestFromClient * Reset to reexecute the current request, and yield. * **********************/ void ResetCurrentRequest(ClientPtr client) { OsCommPtr oc = (OsCommPtr)client->osPrivate; register ConnectionInputPtr oci = oc->input; int fd = oc->fd; register xReq *request; int gotnow, needed; if (AvailableInput == oc) AvailableInput = (OsCommPtr)NULL; oci->lenLastReq = 0; gotnow = oci->bufcnt + oci->buffer - oci->bufptr; if (gotnow < sizeof(xReq)) { YieldControlNoInput(); } else { request = (xReq *)oci->bufptr; needed = get_req_len(request, client); #ifdef BIGREQS if (!needed && client->big_requests) { oci->bufptr -= sizeof(xBigReq) - sizeof(xReq); *(xReq *)oci->bufptr = *request; ((xBigReq *)oci->bufptr)->length = client->req_len; if (client->swapped) { swapl(&((xBigReq *)oci->bufptr)->length); } } #endif if (gotnow >= (needed << 2)) { if (FD_ISSET(fd, &AllClients)) { FD_SET(fd, &ClientsWithInput); } else { FD_SET(fd, &IgnoredClientsWithInput); } YieldControl(); } else YieldControlNoInput(); } } /***************************************************************** * PeekNextRequest and SkipRequests were implemented to support DBE * idioms, but can certainly be used outside of DBE. There are two * related macros in os.h, ReqLen and CastxReq. See the porting * layer document for more details. * **********************/ /***************************************************************** * PeekNextRequest * lets you look ahead at the unexecuted requests in a * client's request buffer. * * Note: this implementation of PeekNextRequest ignores the * readmore parameter. * **********************/ xReqPtr PeekNextRequest( xReqPtr req, /* request we're starting from */ ClientPtr client, /* client whose requests we're skipping */ Bool readmore) /* attempt to read more if next request isn't there? */ { register ConnectionInputPtr oci = ((OsCommPtr)client->osPrivate)->input; xReqPtr pnextreq; int needed, gotnow, reqlen; if (!oci) return NULL; if (!req) { /* caller wants the request after the one currently being executed */ pnextreq = (xReqPtr) (((CARD32 *)client->requestBuffer) + client->req_len); } else { /* caller wants the request after the one specified by req */ reqlen = get_req_len(req, client); #ifdef BIGREQS if (!reqlen) reqlen = get_big_req_len(req, client); #endif pnextreq = (xReqPtr)(((char *)req) + (reqlen << 2)); } /* see how much of the next request we have available */ gotnow = oci->bufcnt - (((char *)pnextreq) - oci->buffer); if (gotnow < sizeof(xReq)) return NULL; needed = get_req_len(pnextreq, client) << 2; #ifdef BIGREQS if (!needed) { /* it's a big request */ if (gotnow < sizeof(xBigReq)) return NULL; needed = get_big_req_len(pnextreq, client) << 2; } #endif /* if we have less than we need, return NULL */ return (gotnow < needed) ? NULL : pnextreq; } /***************************************************************** * SkipRequests * lets you skip over some of the requests in a client's * request buffer. Presumably the caller has used PeekNextRequest * to examine the requests being skipped and has performed whatever * actions they dictate. * **********************/ CallbackListPtr SkippedRequestsCallback = NULL; void SkipRequests( xReqPtr req, /* last request being skipped */ ClientPtr client, /* client whose requests we're skipping */ int numskipped) /* how many requests we're skipping */ { OsCommPtr oc = (OsCommPtr)client->osPrivate; register ConnectionInputPtr oci = oc->input; int reqlen; /* see if anyone wants to snoop the skipped requests */ if (SkippedRequestsCallback) { SkippedRequestInfoRec skipinfo; skipinfo.req = req; skipinfo.client = client; skipinfo.numskipped = numskipped; CallCallbacks(&SkippedRequestsCallback, &skipinfo); } /* adjust the sequence number */ client->sequence += numskipped; /* twiddle the oci to skip over the requests */ reqlen = get_req_len(req, client); #ifdef BIGREQS if (!reqlen) reqlen = get_big_req_len(req, client); #endif reqlen <<= 2; oci->bufptr = (char *)req; oci->lenLastReq = reqlen; /* see if any requests left in the buffer */ if ( ((char *)req + reqlen) == (oci->buffer + oci->bufcnt) ) { /* no requests; mark input buffer as available and client * as having no input */ int fd = oc->fd; AvailableInput = oc; YieldControlNoInput(); } } /* lookup table for adding padding bytes to data that is read from or written to the X socket. */ static int padlength[4] = {0, 3, 2, 1}; /******************** * FlushAllOutput() * Flush all clients with output. However, if some client still * has input in the queue (more requests), then don't flush. This * will prevent the output queue from being flushed every time around * the round robin queue. Now, some say that it SHOULD be flushed * every time around, but... * **********************/ void FlushAllOutput(void) { register int index, base; register fd_mask mask; /* raphael */ OsCommPtr oc; register ClientPtr client; Bool newoutput = NewOutputPending; if (!newoutput) return; /* * It may be that some client still has critical output pending, * but he is not yet ready to receive it anyway, so we will * simply wait for the select to tell us when he's ready to receive. */ CriticalOutputPending = FALSE; NewOutputPending = FALSE; for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++) { mask = OutputPending.fds_bits[ base ]; OutputPending.fds_bits[ base ] = 0; while (mask) { index = ffs(mask) - 1; mask &= ~lowbit(mask); if ((index = ConnectionTranslation[(base * (sizeof(fd_mask)*8)) + index]) == 0) continue; client = clients[index]; if (client->clientGone) continue; oc = (OsCommPtr)client->osPrivate; if ( FD_ISSET(oc->fd, &ClientsWithInput)) { FD_SET(oc->fd, &OutputPending); /* set the bit again */ NewOutputPending = TRUE; } else (void)FlushClient(client, oc, (char *)NULL, 0); } } } void FlushIfCriticalOutputPending(void) { if (CriticalOutputPending) FlushAllOutput(); } void SetCriticalOutputPending(void) { CriticalOutputPending = TRUE; } /***************** * WriteToClient * Copies buf into ClientPtr.buf if it fits (with padding), else * flushes ClientPtr.buf and buf to client. As of this writing, * every use of WriteToClient is cast to void, and the result * is ignored. Potentially, this could be used by requests * that are sending several chunks of data and want to break * out of a loop on error. Thus, we will leave the type of * this routine as int. *****************/ int WriteToClient (ClientPtr who, int count, const void *__buf) { OsCommPtr oc; ConnectionOutputPtr oco; int padBytes; const char *buf = __buf; #ifdef DEBUG_COMMUNICATION Bool multicount = FALSE; #endif if (!count || !who || who == serverClient || who->clientGone) return(0); oc = who->osPrivate; oco = oc->output; #ifdef DEBUG_COMMUNICATION { char info[128]; xError *err; xGenericReply *rep; xEvent *ev; if (!who->replyBytesRemaining) { switch(buf[0]) { case X_Reply: rep = (xGenericReply*)buf; if (rep->sequenceNumber == who->sequence) { snprintf(info,127,"Xreply: type: 0x%x data: 0x%x " "len: %i seq#: 0x%x", rep->type, rep->data1, rep->length, rep->sequenceNumber); multicount = TRUE; } break; case X_Error: err = (xError*)buf; snprintf(info,127,"Xerror: Code: 0x%x resID: 0x%x maj: 0x%x " "min: %x", err->errorCode,err->resourceID, err->minorCode,err->majorCode); break; default: if ((buf[0] & 0x7f) == KeymapNotify) snprintf(info,127,"KeymapNotifyEvent: %i",buf[0]); else { ev = (xEvent*)buf; snprintf(info,127,"XEvent: type: 0x%x detail: 0x%x " "seq#: 0x%x", ev->u.u.type, ev->u.u.detail, ev->u.u.sequenceNumber); } } ErrorF("REPLY: ClientIDX: %i %s\n",who->index, info); } else multicount = TRUE; } #endif if (!oco) { if ((oco = FreeOutputs)) { FreeOutputs = oco->next; } else if (!(oco = AllocateOutputBuffer())) { if (oc->trans_conn) { _XSERVTransDisconnect(oc->trans_conn); _XSERVTransClose(oc->trans_conn); oc->trans_conn = NULL; } MarkClientException(who); return -1; } oc->output = oco; } padBytes = padlength[count & 3]; if(ReplyCallback) { ReplyInfoRec replyinfo; replyinfo.client = who; replyinfo.replyData = buf; replyinfo.dataLenBytes = count + padBytes; if (who->replyBytesRemaining) { /* still sending data of an earlier reply */ who->replyBytesRemaining -= count + padBytes; replyinfo.startOfReply = FALSE; replyinfo.bytesRemaining = who->replyBytesRemaining; CallCallbacks((&ReplyCallback), (void *)&replyinfo); } else if (who->clientState == ClientStateRunning && buf[0] == X_Reply) { /* start of new reply */ CARD32 replylen; unsigned long bytesleft; replylen = ((xGenericReply *)buf)->length; if (who->swapped) swapl(&replylen); bytesleft = (replylen * 4) + SIZEOF(xReply) - count - padBytes; replyinfo.startOfReply = TRUE; replyinfo.bytesRemaining = who->replyBytesRemaining = bytesleft; CallCallbacks((&ReplyCallback), (void *)&replyinfo); } } #ifdef DEBUG_COMMUNICATION else if (multicount) { if (who->replyBytesRemaining) { who->replyBytesRemaining -= (count + padBytes); } else { CARD32 replylen; replylen = ((xGenericReply *)buf)->length; who->replyBytesRemaining = (replylen * 4) + SIZEOF(xReply) - count - padBytes; } } #endif if (oco->count == 0 || oco->count + count + padBytes > oco->size) { FD_CLR(oc->fd, &OutputPending); if(!XFD_ANYSET(&OutputPending)) { CriticalOutputPending = FALSE; NewOutputPending = FALSE; } return FlushClient(who, oc, buf, count); } NewOutputPending = TRUE; FD_SET(oc->fd, &OutputPending); memmove((char *)oco->buf + oco->count, buf, count); oco->count += count; if (padBytes) { memset(oco->buf + oco->count, '\0', padBytes); oco->count += padBytes; } return(count); } /******************** * FlushClient() * If the client isn't keeping up with us, then we try to continue * buffering the data and set the apropriate bit in ClientsWritable * (which is used by WaitFor in the select). If the connection yields * a permanent error, or we can't allocate any more space, we then * close the connection. * **********************/ int FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount) { ConnectionOutputPtr oco = oc->output; int connection = oc->fd; XtransConnInfo trans_conn = oc->trans_conn; struct iovec iov[3]; static char padBuffer[3]; const char *extraBuf = __extraBuf; long written; long padsize; long notWritten; long todo; if (!oco) return 0; written = 0; padsize = padlength[extraCount & 3]; notWritten = oco->count + extraCount + padsize; if (!notWritten) return 0; if (FlushCallback) CallCallbacks(&FlushCallback, who); todo = notWritten; while (notWritten) { long before = written; /* amount of whole thing written */ long remain = todo; /* amount to try this time, <= notWritten */ int i = 0; long len; /* You could be very general here and have "in" and "out" iovecs * and write a loop without using a macro, but what the heck. This * translates to: * * how much of this piece is new? * if more new then we are trying this time, clamp * if nothing new * then bump down amount already written, for next piece * else put new stuff in iovec, will need all of next piece * * Note that todo had better be at least 1 or else we'll end up * writing 0 iovecs. */ #define InsertIOV(pointer, length) \ len = (length) - before; \ if (len > remain) \ len = remain; \ if (len <= 0) { \ before = (-len); \ } else { \ iov[i].iov_len = len; \ iov[i].iov_base = (pointer) + before; \ i++; \ remain -= len; \ before = 0; \ } InsertIOV ((char *)oco->buf, oco->count) InsertIOV ((char *)extraBuf, extraCount) InsertIOV (padBuffer, padsize) errno = 0; if (trans_conn && (len = _XSERVTransWritev(trans_conn, iov, i)) >= 0) { written += len; notWritten -= len; todo = notWritten; } else if (ETEST(errno) #ifdef SUNSYSV /* check for another brain-damaged OS bug */ || (errno == 0) #endif #ifdef EMSGSIZE /* check for another brain-damaged OS bug */ || ((errno == EMSGSIZE) && (todo == 1)) #endif ) { /* If we've arrived here, then the client is stuffed to the gills and not ready to accept more. Make a note of it and buffer the rest. */ FD_SET(connection, &ClientsWriteBlocked); AnyWritesPending = TRUE; if (written < oco->count) { if (written > 0) { oco->count -= written; memmove((char *)oco->buf, (char *)oco->buf + written, oco->count); written = 0; } } else { written -= oco->count; oco->count = 0; } if (notWritten > oco->size) { unsigned char *obuf = NULL; if (notWritten + BUFSIZE <= INT_MAX) { obuf = calloc(1, notWritten + BUFSIZE); if (obuf) { memmove(obuf, oco->buf, oco->size); free(oco->buf); } } if (!obuf) { _XSERVTransDisconnect(oc->trans_conn); _XSERVTransClose(oc->trans_conn); oc->trans_conn = NULL; MarkClientException(who); oco->count = 0; return(-1); } oco->size = notWritten + BUFSIZE; oco->buf = obuf; } /* If the amount written extended into the padBuffer, then the difference "extraCount - written" may be less than 0 */ if ((len = extraCount - written) > 0) memmove ((char *)oco->buf + oco->count, extraBuf + written, len); oco->count = notWritten; /* this will include the pad */ /* return only the amount explicitly requested */ return extraCount; } #ifdef EMSGSIZE /* check for another brain-damaged OS bug */ else if (errno == EMSGSIZE) { todo >>= 1; } #endif else { if (oc->trans_conn) { _XSERVTransDisconnect(oc->trans_conn); _XSERVTransClose(oc->trans_conn); oc->trans_conn = NULL; } MarkClientException(who); oco->count = 0; return(-1); } } /* everything was flushed out */ oco->count = 0; /* check to see if this client was write blocked */ if (AnyWritesPending) { FD_CLR(oc->fd, &ClientsWriteBlocked); if (!XFD_ANYSET(&ClientsWriteBlocked) && NumNotifyWriteFd == 0) AnyWritesPending = FALSE; } if (oco->size > BUFWATERMARK) { free(oco->buf); free(oco); } else { oco->next = FreeOutputs; FreeOutputs = oco; } oc->output = (ConnectionOutputPtr)NULL; return extraCount; /* return only the amount explicitly requested */ } ConnectionInputPtr AllocateInputBuffer(void) { ConnectionInputPtr oci; oci = (ConnectionInputPtr)malloc(sizeof(ConnectionInput)); if (!oci) return (ConnectionInputPtr)NULL; oci->buffer = (char *)malloc(BUFSIZE); if (!oci->buffer) { free(oci); return (ConnectionInputPtr)NULL; } oci->size = BUFSIZE; oci->bufptr = oci->buffer; oci->bufcnt = 0; oci->lenLastReq = 0; oci->ignoreBytes = 0; return oci; } ConnectionOutputPtr AllocateOutputBuffer(void) { ConnectionOutputPtr oco; oco = (ConnectionOutputPtr)malloc(sizeof(ConnectionOutput)); if (!oco) return (ConnectionOutputPtr)NULL; oco->buf = (unsigned char *) malloc(BUFSIZE); if (!oco->buf) { free(oco); return (ConnectionOutputPtr)NULL; } oco->size = BUFSIZE; oco->count = 0; return oco; } void FreeOsBuffers(OsCommPtr oc) { ConnectionInputPtr oci; ConnectionOutputPtr oco; if (AvailableInput == oc) AvailableInput = (OsCommPtr)NULL; if ((oci = oc->input)) { if (FreeInputs) { free(oci->buffer); free(oci); } else { FreeInputs = oci; oci->next = (ConnectionInputPtr)NULL; oci->bufptr = oci->buffer; oci->bufcnt = 0; oci->lenLastReq = 0; oci->ignoreBytes = 0; } } if ((oco = oc->output)) { if (FreeOutputs) { free(oco->buf); free(oco); } else { FreeOutputs = oco; oco->next = (ConnectionOutputPtr)NULL; oco->count = 0; } } } void ResetOsBuffers(void) { ConnectionInputPtr oci; ConnectionOutputPtr oco; while ((oci = FreeInputs)) { FreeInputs = oci->next; free(oci->buffer); free(oci); } while ((oco = FreeOutputs)) { FreeOutputs = oco->next; free(oco->buf); free(oco); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/log.c0000644000000000000000000005014313614532331016144 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, Copyright 1994 Quarterdeck Office Systems. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital and Quarterdeck not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL AND QUARTERDECK DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the copyright holder(s) * and author(s) shall not be used in advertising or otherwise to promote * the sale, use or other dealings in this Software without prior written * authorization from the copyright holder(s) and author(s). */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include /* for malloc() */ #include #include "input.h" #include "site.h" #include "opaque.h" #ifdef NX_TRANS_SOCKET #include #endif #ifdef DDXOSVERRORF void (*OsVendorVErrorFProc)(const char *, va_list args) = NULL; #ifdef NX_TRANS_EXIT int OsVendorVErrorFFatal = 0; #endif #endif static FILE *logFile = NULL; static Bool logFlush = FALSE; static Bool logSync = FALSE; static int logVerbosity = DEFAULT_LOG_VERBOSITY; static int logFileVerbosity = DEFAULT_LOG_FILE_VERBOSITY; /* Buffer to information logged before the log file is opened. */ static char *saveBuffer = NULL; static int bufferSize = 0, bufferUnused = 0, bufferPos = 0; static Bool needBuffer = TRUE; /* Prefix strings for log messages. */ #ifndef X_UNKNOWN_STRING #define X_UNKNOWN_STRING "(\?\?)" #endif #ifndef X_PROBE_STRING #define X_PROBE_STRING "(--)" #endif #ifndef X_CONFIG_STRING #define X_CONFIG_STRING "(**)" #endif #ifndef X_DEFAULT_STRING #define X_DEFAULT_STRING "(==)" #endif #ifndef X_CMDLINE_STRING #define X_CMDLINE_STRING "(++)" #endif #ifndef X_NOTICE_STRING #define X_NOTICE_STRING "(!!)" #endif #ifndef X_ERROR_STRING #define X_ERROR_STRING "(EE)" #endif #ifndef X_WARNING_STRING #define X_WARNING_STRING "(WW)" #endif #ifndef X_INFO_STRING #define X_INFO_STRING "(II)" #endif #ifndef X_NOT_IMPLEMENTED_STRING #define X_NOT_IMPLEMENTED_STRING "(NI)" #endif /* * LogFilePrep is called to setup files for logging, including getting * an old file out of the way, but it doesn't actually open the file, * since it may be used for renaming a file we're already logging to. */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" static char * LogFilePrep(const char *fname, const char *backup, const char *idstring) { char *logFileName = NULL; if (asprintf(&logFileName, fname, idstring) == -1) FatalError("Cannot allocate space for the log file name\n"); if (backup && *backup) { struct stat buf; if (!stat(logFileName, &buf) && S_ISREG(buf.st_mode)) { char *suffix; char *oldLog; if ((asprintf(&suffix, backup, idstring) == -1) || (asprintf(&oldLog, "%s%s", logFileName, suffix) == -1)) { FatalError("Cannot allocate space for the log file name\n"); } free(suffix); if (rename(logFileName, oldLog) == -1) { FatalError("Cannot move old log file \"%s\" to \"%s\"\n", logFileName, oldLog); } free(oldLog); } } else { if (remove(logFileName) != 0) { FatalError("Cannot remove old log file \"%s\": %s\n", logFileName, strerror(errno)); } } return logFileName; } #pragma GCC diagnostic pop /* * LogInit is called to start logging to a file. It is also called (with * NULL arguments) when logging to a file is not wanted. It must always be * called, otherwise log messages will continue to accumulate in a buffer. * * %s, if present in the fname or backup strings, is expanded to the display * string (or to a string containing the pid if the display is not yet set). */ static char *saved_log_fname; static char *saved_log_backup; static char *saved_log_tempname; const char * LogInit(const char *fname, const char *backup) { char *logFileName = NULL; if (fname && *fname) { if (displayfd != -1) { /* Display isn't set yet, so we can't use it in filenames yet. */ char pidstring[32]; snprintf(pidstring, sizeof(pidstring), "pid-%ld", (unsigned long) getpid()); logFileName = LogFilePrep(fname, backup, pidstring); saved_log_tempname = logFileName; /* Save the patterns for use when the display is named. */ saved_log_fname = strdup(fname); if (backup == NULL) saved_log_backup = NULL; else saved_log_backup = strdup(backup); } else logFileName = LogFilePrep(fname, backup, display); if ((logFile = fopen(logFileName, "w")) == NULL) FatalError("Cannot open log file \"%s\"\n", logFileName); setvbuf(logFile, NULL, _IONBF, 0); /* Flush saved log information. */ if (saveBuffer && bufferSize > 0) { fwrite(saveBuffer, bufferPos, 1, logFile); fflush(logFile); fsync(fileno(logFile)); } } /* * Unconditionally free the buffer, and flag that the buffer is no longer * needed. */ if (saveBuffer && bufferSize > 0) { free(saveBuffer); /* Must be free(), not free() */ saveBuffer = NULL; bufferSize = 0; } needBuffer = FALSE; return logFileName; } void LogSetDisplay(void) { if (saved_log_fname) { char *logFileName; logFileName = LogFilePrep(saved_log_fname, saved_log_backup, display); if (rename(saved_log_tempname, logFileName) == 0) { LogMessageVerb(X_PROBED, 0, "Log file renamed from \"%s\" to \"%s\"\n", saved_log_tempname, logFileName); if (strlen(saved_log_tempname) >= strlen(logFileName)) strncpy(saved_log_tempname, logFileName, strlen(saved_log_tempname)); } else { ErrorF("Failed to rename log file \"%s\" to \"%s\": %s\n", saved_log_tempname, logFileName, strerror(errno)); } /* free newly allocated string - can't free old one since existing pointers to it may exist in DDX callers. */ free(logFileName); free(saved_log_fname); free(saved_log_backup); } } void LogClose() { if (logFile) { fclose(logFile); logFile = NULL; } } Bool LogSetParameter(LogParameter param, int value) { switch (param) { case XLOG_FLUSH: logFlush = value ? TRUE : FALSE; return TRUE; case XLOG_SYNC: logSync = value ? TRUE : FALSE; return TRUE; case XLOG_VERBOSITY: logVerbosity = value; return TRUE; case XLOG_FILE_VERBOSITY: logFileVerbosity = value; return TRUE; default: return FALSE; } } /* This function does the actual log message writes. */ void LogVWrite(int verb, const char *f, va_list args) { static char tmpBuffer[1024]; int len = 0; /* * Since a va_list can only be processed once, write the string to a * buffer, and then write the buffer out to the appropriate output * stream(s). */ if (verb < 0 || logFileVerbosity >= verb || logVerbosity >= verb) { vsnprintf(tmpBuffer, sizeof(tmpBuffer), f, args); #ifdef NX_TRANS_EXIT /* * Beautify the message. Make the * first letter uppercase. */ *tmpBuffer = toupper(*tmpBuffer); /* * Remove the trailing newline. */ if (strlen(tmpBuffer) > 0 && *(tmpBuffer + strlen(tmpBuffer) - 1) == '\n') { *(tmpBuffer + strlen(tmpBuffer) - 1) = '\0'; } /* * Remove the trailing full-stop. */ if (strlen(tmpBuffer) > 0 && *(tmpBuffer + strlen(tmpBuffer) - 1) == '.') { *(tmpBuffer + strlen(tmpBuffer) - 1) = '\0'; } #endif /* #ifdef NX_TRANS_EXIT */ len = strlen(tmpBuffer); } if ((verb < 0 || logVerbosity >= verb) && len > 0) fwrite(tmpBuffer, len, 1, stderr); if ((verb < 0 || logFileVerbosity >= verb) && len > 0) { if (logFile) { fwrite(tmpBuffer, len, 1, logFile); if (logFlush) { fflush(logFile); if (logSync) fsync(fileno(logFile)); } } else if (needBuffer) { /* * Note, this code is used before OsInit() has been called, so * malloc() and friends can't be used. */ if (len > bufferUnused) { bufferSize += 1024; bufferUnused += 1024; if (saveBuffer) saveBuffer = realloc(saveBuffer, bufferSize); else saveBuffer = malloc(bufferSize); if (!saveBuffer) FatalError("realloc() failed while saving log messages\n"); } bufferUnused -= len; memcpy(saveBuffer + bufferPos, tmpBuffer, len); bufferPos += len; } } } void LogWrite(int verb, const char *f, ...) { va_list args; va_start(args, f); LogVWrite(verb, f, args); va_end(args); } void LogVMessageVerb(MessageType type, int verb, const char *format, va_list args) { const char *s = X_UNKNOWN_STRING; char *tmpBuf = NULL; /* Ignore verbosity for X_ERROR */ if (logVerbosity >= verb || logFileVerbosity >= verb || type == X_ERROR) { switch (type) { case X_PROBED: s = X_PROBE_STRING; break; case X_CONFIG: s = X_CONFIG_STRING; break; case X_DEFAULT: s = X_DEFAULT_STRING; break; case X_CMDLINE: s = X_CMDLINE_STRING; break; case X_NOTICE: s = X_NOTICE_STRING; break; case X_ERROR: s = X_ERROR_STRING; if (verb > 0) verb = 0; break; case X_WARNING: s = X_WARNING_STRING; break; case X_INFO: s = X_INFO_STRING; break; case X_NOT_IMPLEMENTED: s = X_NOT_IMPLEMENTED_STRING; break; case X_UNKNOWN: s = X_UNKNOWN_STRING; break; case X_NONE: s = NULL; break; } /* * Prefix the format string with the message type. We do it this way * so that LogVWrite() is only called once per message. */ if (s) { tmpBuf = malloc(strlen(format) + strlen(s) + 1 + 1); /* Silently return if malloc fails here. */ if (!tmpBuf) return; sprintf(tmpBuf, "%s ", s); strcat(tmpBuf, format); LogVWrite(verb, tmpBuf, args); free(tmpBuf); } else LogVWrite(verb, format, args); } } /* Log message with verbosity level specified. */ void LogMessageVerb(MessageType type, int verb, const char *format, ...) { va_list ap; va_start(ap, format); LogVMessageVerb(type, verb, format, ap); va_end(ap); } /* Log a message with the standard verbosity level of 1. */ void LogMessage(MessageType type, const char *format, ...) { va_list ap; va_start(ap, format); LogVMessageVerb(type, 1, format, ap); va_end(ap); } #ifdef __GNUC__ void AbortServer(void) __attribute__((noreturn)); #endif void AbortServer(void) { #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "AbortServer: Going to abort the current server.\n"); #endif OsCleanup(TRUE); AbortDDX(); fflush(stderr); if (CoreDump) abort(); #ifdef NX_TRANS_EXIT #ifdef NX_TRANS_TEST fprintf(stderr, "AbortServer: Going to clean up NX resources and exit.\n"); #endif NXTransExit(1); #else /* #ifdef NX_TRANS_EXIT */ exit (1); #endif } #ifndef AUDIT_PREFIX #define AUDIT_PREFIX "AUDIT: %s: %ld %s: " #endif #ifndef AUDIT_TIMEOUT #define AUDIT_TIMEOUT ((CARD32)(120 * 1000)) /* 2 mn */ #endif static int nrepeat = 0; static int oldlen = -1; static OsTimerPtr auditTimer = NULL; void FreeAuditTimer(void) { if (auditTimer != NULL) { /* Force output of pending messages */ TimerForce(auditTimer); TimerFree(auditTimer); auditTimer = NULL; } } static char * AuditPrefix(void) { time_t tm; char *autime, *s; char *tmpBuf; int len; time(&tm); autime = ctime(&tm); if ((s = strchr(autime, '\n'))) *s = '\0'; if ((s = strrchr(argvGlobal[0], '/'))) s++; else s = argvGlobal[0]; len = strlen(AUDIT_PREFIX) + strlen(autime) + 10 + strlen(s) + 1; tmpBuf = malloc(len); if (!tmpBuf) return NULL; snprintf(tmpBuf, len, AUDIT_PREFIX, autime, (unsigned long)getpid(), s); return tmpBuf; } void AuditF(const char * f, ...) { va_list args; va_start(args, f); VAuditF(f, args); va_end(args); } static CARD32 AuditFlush(OsTimerPtr timer, CARD32 now, void * arg) { char *prefix; if (nrepeat > 0) { prefix = AuditPrefix(); ErrorF("%slast message repeated %d times\n", prefix != NULL ? prefix : "", nrepeat); nrepeat = 0; if (prefix != NULL) free(prefix); return AUDIT_TIMEOUT; } else { /* if the timer expires without anything to print, flush the message */ oldlen = -1; return 0; } } void VAuditF(const char *f, va_list args) { char *prefix; char buf[1024]; int len; static char oldbuf[1024]; prefix = AuditPrefix(); len = vsnprintf(buf, sizeof(buf), f, args); if (len == oldlen && strcmp(buf, oldbuf) == 0) { /* Message already seen */ nrepeat++; } else { /* new message */ if (auditTimer != NULL) TimerForce(auditTimer); ErrorF("%s%s", prefix != NULL ? prefix : "", buf); strlcpy(oldbuf, buf, sizeof(oldbuf)); oldlen = len; nrepeat = 0; auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL); } if (prefix != NULL) free(prefix); } void FatalError(const char *f, ...) { va_list args; static Bool beenhere = FALSE; #ifdef NX_TRANS_EXIT if (beenhere) { fprintf(stderr, "Error: Aborting session with fatal error function reentered.\n"); } else { /* * Tell to the log function that this * is a fatal error. */ OsVendorVErrorFFatal = 1; fprintf(stderr, "Error: Aborting session with '"); va_start(args, f); VErrorF(f, args); va_end(args); fprintf(stderr, "'.\n"); } #else /* #ifdef NX_TRANS_EXIT */ if (beenhere) ErrorF("\nFatalError re-entered, aborting\n"); else ErrorF("\nFatal server error:\n"); va_start(args, f); VErrorF(f, args); va_end(args); ErrorF("\n"); #endif /* #ifdef NX_TRANS_EXIT */ #ifdef DDXOSFATALERROR if (!beenhere) OsVendorFatalError(); #endif #ifdef ABORTONFATALERROR abort(); #endif if (!beenhere) { beenhere = TRUE; AbortServer(); } else abort(); /*NOTREACHED*/ } void VErrorF(const char *f, va_list args) { #ifdef DDXOSVERRORF if (OsVendorVErrorFProc) OsVendorVErrorFProc(f, args); else LogVWrite(-1, f, args); #else LogVWrite(-1, f, args); #endif } void ErrorF(const char * f, ...) { va_list args; va_start(args, f); VErrorF(f, args); va_end(args); } /* A perror() workalike. */ #ifndef NEED_STRERROR #ifdef SYSV #define NEED_STRERROR #endif #endif #if defined(NEED_STRERROR) && !defined(strerror) extern char *sys_errlist[]; extern int sys_nerr; #define strerror(n) \ ((n) >= 0 && (n) < sys_nerr) ? sys_errlist[(n)] : "unknown error" #endif void Error(char *str) { char *err = NULL; int saveErrno = errno; if (str) { err = malloc(strlen(strerror(saveErrno)) + strlen(str) + 2 + 1); if (!err) return; sprintf(err, "%s: ", str); strcat(err, strerror(saveErrno)); LogWrite(-1, "%s", err); } else LogWrite(-1, "%s", strerror(saveErrno)); } void LogPrintMarkers() { /* Show what the message marker symbols mean. */ ErrorF("Markers: "); LogMessageVerb(X_PROBED, -1, "probed, "); LogMessageVerb(X_CONFIG, -1, "from config file, "); LogMessageVerb(X_DEFAULT, -1, "default setting,\n\t"); LogMessageVerb(X_CMDLINE, -1, "from command line, "); LogMessageVerb(X_NOTICE, -1, "notice, "); LogMessageVerb(X_INFO, -1, "informational,\n\t"); LogMessageVerb(X_WARNING, -1, "warning, "); LogMessageVerb(X_ERROR, -1, "error, "); LogMessageVerb(X_NOT_IMPLEMENTED, -1, "not implemented, "); LogMessageVerb(X_UNKNOWN, -1, "unknown.\n"); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/mitauth.c0000644000000000000000000000777713614532331017055 0ustar /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * MIT-MAGIC-COOKIE-1 authorization scheme * Author: Keith Packard, MIT X Consortium */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "os.h" #include "osdep.h" #include "dixstruct.h" static struct auth { struct auth *next; unsigned short len; char *data; XID id; } *mit_auth; int MitAddCookie ( unsigned short data_length, char *data, XID id) { struct auth *new; new = (struct auth *) malloc (sizeof (struct auth)); if (!new) return 0; new->data = (char *) malloc ((unsigned) data_length); if (!new->data) { free(new); return 0; } new->next = mit_auth; mit_auth = new; memmove(new->data, data, (int) data_length); new->len = data_length; new->id = id; return 1; } XID MitCheckCookie ( unsigned short data_length, char *data, ClientPtr client, char **reason) { struct auth *auth; for (auth = mit_auth; auth; auth=auth->next) { if (data_length == auth->len && timingsafe_memcmp (data, auth->data, (int) data_length) == 0) return auth->id; } *reason = "Invalid MIT-MAGIC-COOKIE-1 key"; return (XID) -1; } int MitResetCookie (void) { struct auth *auth, *next; for (auth = mit_auth; auth; auth=next) { next = auth->next; free (auth->data); free (auth); } mit_auth = 0; return 0; } XID MitToID ( unsigned short data_length, char *data) { struct auth *auth; for (auth = mit_auth; auth; auth=auth->next) { if (data_length == auth->len && memcmp (data, auth->data, data_length) == 0) return auth->id; } return (XID) -1; } int MitFromID ( XID id, unsigned short *data_lenp, char **datap) { struct auth *auth; for (auth = mit_auth; auth; auth=auth->next) { if (id == auth->id) { *data_lenp = auth->len; *datap = auth->data; return 1; } } return 0; } int MitRemoveCookie ( unsigned short data_length, char *data) { struct auth *auth, *prev; prev = 0; for (auth = mit_auth; auth; prev = auth, auth=auth->next) { if (data_length == auth->len && memcmp (data, auth->data, data_length) == 0) { if (prev) prev->next = auth->next; else mit_auth = auth->next; free (auth->data); free (auth); return 1; } } return 0; } #ifdef XCSECURITY static char cookie[16]; /* 128 bits */ XID MitGenerateCookie ( unsigned data_length, char *data, XID id, unsigned *data_length_return, char **data_return) { int i = 0; int status; while (data_length--) { cookie[i++] += *data++; if (i >= sizeof (cookie)) i = 0; } GenerateRandomData(sizeof (cookie), cookie); status = MitAddCookie(sizeof (cookie), cookie, id); if (!status) { id = -1; } else { *data_return = cookie; *data_length_return = sizeof (cookie); } return id; } #endif /* XCSECURITY */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/oscolor.c0000644000000000000000000016066613614532331017057 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "os.h" typedef struct _builtinColor { unsigned char red; unsigned char green; unsigned char blue; unsigned short name; } BuiltinColor; static const char BuiltinColorNames[] = { "alice blue\0" "AliceBlue\0" "antique white\0" "AntiqueWhite\0" "AntiqueWhite1\0" "AntiqueWhite2\0" "AntiqueWhite3\0" "AntiqueWhite4\0" "aqua\0" "aquamarine\0" "aquamarine1\0" "aquamarine2\0" "aquamarine3\0" "aquamarine4\0" "azure\0" "azure1\0" "azure2\0" "azure3\0" "azure4\0" "beige\0" "bisque\0" "bisque1\0" "bisque2\0" "bisque3\0" "bisque4\0" "black\0" "blanched almond\0" "BlanchedAlmond\0" "blue\0" "blue violet\0" "blue1\0" "blue2\0" "blue3\0" "blue4\0" "BlueViolet\0" "brown\0" "brown1\0" "brown2\0" "brown3\0" "brown4\0" "burlywood\0" "burlywood1\0" "burlywood2\0" "burlywood3\0" "burlywood4\0" "cadet blue\0" "CadetBlue\0" "CadetBlue1\0" "CadetBlue2\0" "CadetBlue3\0" "CadetBlue4\0" "chartreuse\0" "chartreuse1\0" "chartreuse2\0" "chartreuse3\0" "chartreuse4\0" "chocolate\0" "chocolate1\0" "chocolate2\0" "chocolate3\0" "chocolate4\0" "coral\0" "coral1\0" "coral2\0" "coral3\0" "coral4\0" "cornflower blue\0" "CornflowerBlue\0" "cornsilk\0" "cornsilk1\0" "cornsilk2\0" "cornsilk3\0" "cornsilk4\0" "crimson\0" "cyan\0" "cyan1\0" "cyan2\0" "cyan3\0" "cyan4\0" "dark blue\0" "dark cyan\0" "dark goldenrod\0" "dark gray\0" "dark green\0" "dark grey\0" "dark khaki\0" "dark magenta\0" "dark olive green\0" "dark orange\0" "dark orchid\0" "dark red\0" "dark salmon\0" "dark sea green\0" "dark slate blue\0" "dark slate gray\0" "dark slate grey\0" "dark turquoise\0" "dark violet\0" "DarkBlue\0" "DarkCyan\0" "DarkGoldenrod\0" "DarkGoldenrod1\0" "DarkGoldenrod2\0" "DarkGoldenrod3\0" "DarkGoldenrod4\0" "DarkGray\0" "DarkGreen\0" "DarkGrey\0" "DarkKhaki\0" "DarkMagenta\0" "DarkOliveGreen\0" "DarkOliveGreen1\0" "DarkOliveGreen2\0" "DarkOliveGreen3\0" "DarkOliveGreen4\0" "DarkOrange\0" "DarkOrange1\0" "DarkOrange2\0" "DarkOrange3\0" "DarkOrange4\0" "DarkOrchid\0" "DarkOrchid1\0" "DarkOrchid2\0" "DarkOrchid3\0" "DarkOrchid4\0" "DarkRed\0" "DarkSalmon\0" "DarkSeaGreen\0" "DarkSeaGreen1\0" "DarkSeaGreen2\0" "DarkSeaGreen3\0" "DarkSeaGreen4\0" "DarkSlateBlue\0" "DarkSlateGray\0" "DarkSlateGray1\0" "DarkSlateGray2\0" "DarkSlateGray3\0" "DarkSlateGray4\0" "DarkSlateGrey\0" "DarkTurquoise\0" "DarkViolet\0" "deep pink\0" "deep sky blue\0" "DeepPink\0" "DeepPink1\0" "DeepPink2\0" "DeepPink3\0" "DeepPink4\0" "DeepSkyBlue\0" "DeepSkyBlue1\0" "DeepSkyBlue2\0" "DeepSkyBlue3\0" "DeepSkyBlue4\0" "dim gray\0" "dim grey\0" "DimGray\0" "DimGrey\0" "dodger blue\0" "DodgerBlue\0" "DodgerBlue1\0" "DodgerBlue2\0" "DodgerBlue3\0" "DodgerBlue4\0" "firebrick\0" "firebrick1\0" "firebrick2\0" "firebrick3\0" "firebrick4\0" "floral white\0" "FloralWhite\0" "forest green\0" "ForestGreen\0" "fuchsia\0" "gainsboro\0" "ghost white\0" "GhostWhite\0" "gold\0" "gold1\0" "gold2\0" "gold3\0" "gold4\0" "goldenrod\0" "goldenrod1\0" "goldenrod2\0" "goldenrod3\0" "goldenrod4\0" "gray\0" "gray0\0" "gray1\0" "gray10\0" "gray100\0" "gray11\0" "gray12\0" "gray13\0" "gray14\0" "gray15\0" "gray16\0" "gray17\0" "gray18\0" "gray19\0" "gray2\0" "gray20\0" "gray21\0" "gray22\0" "gray23\0" "gray24\0" "gray25\0" "gray26\0" "gray27\0" "gray28\0" "gray29\0" "gray3\0" "gray30\0" "gray31\0" "gray32\0" "gray33\0" "gray34\0" "gray35\0" "gray36\0" "gray37\0" "gray38\0" "gray39\0" "gray4\0" "gray40\0" "gray41\0" "gray42\0" "gray43\0" "gray44\0" "gray45\0" "gray46\0" "gray47\0" "gray48\0" "gray49\0" "gray5\0" "gray50\0" "gray51\0" "gray52\0" "gray53\0" "gray54\0" "gray55\0" "gray56\0" "gray57\0" "gray58\0" "gray59\0" "gray6\0" "gray60\0" "gray61\0" "gray62\0" "gray63\0" "gray64\0" "gray65\0" "gray66\0" "gray67\0" "gray68\0" "gray69\0" "gray7\0" "gray70\0" "gray71\0" "gray72\0" "gray73\0" "gray74\0" "gray75\0" "gray76\0" "gray77\0" "gray78\0" "gray79\0" "gray8\0" "gray80\0" "gray81\0" "gray82\0" "gray83\0" "gray84\0" "gray85\0" "gray86\0" "gray87\0" "gray88\0" "gray89\0" "gray9\0" "gray90\0" "gray91\0" "gray92\0" "gray93\0" "gray94\0" "gray95\0" "gray96\0" "gray97\0" "gray98\0" "gray99\0" "green\0" "green yellow\0" "green1\0" "green2\0" "green3\0" "green4\0" "GreenYellow\0" "grey\0" "grey0\0" "grey1\0" "grey10\0" "grey100\0" "grey11\0" "grey12\0" "grey13\0" "grey14\0" "grey15\0" "grey16\0" "grey17\0" "grey18\0" "grey19\0" "grey2\0" "grey20\0" "grey21\0" "grey22\0" "grey23\0" "grey24\0" "grey25\0" "grey26\0" "grey27\0" "grey28\0" "grey29\0" "grey3\0" "grey30\0" "grey31\0" "grey32\0" "grey33\0" "grey34\0" "grey35\0" "grey36\0" "grey37\0" "grey38\0" "grey39\0" "grey4\0" "grey40\0" "grey41\0" "grey42\0" "grey43\0" "grey44\0" "grey45\0" "grey46\0" "grey47\0" "grey48\0" "grey49\0" "grey5\0" "grey50\0" "grey51\0" "grey52\0" "grey53\0" "grey54\0" "grey55\0" "grey56\0" "grey57\0" "grey58\0" "grey59\0" "grey6\0" "grey60\0" "grey61\0" "grey62\0" "grey63\0" "grey64\0" "grey65\0" "grey66\0" "grey67\0" "grey68\0" "grey69\0" "grey7\0" "grey70\0" "grey71\0" "grey72\0" "grey73\0" "grey74\0" "grey75\0" "grey76\0" "grey77\0" "grey78\0" "grey79\0" "grey8\0" "grey80\0" "grey81\0" "grey82\0" "grey83\0" "grey84\0" "grey85\0" "grey86\0" "grey87\0" "grey88\0" "grey89\0" "grey9\0" "grey90\0" "grey91\0" "grey92\0" "grey93\0" "grey94\0" "grey95\0" "grey96\0" "grey97\0" "grey98\0" "grey99\0" "honeydew\0" "honeydew1\0" "honeydew2\0" "honeydew3\0" "honeydew4\0" "hot pink\0" "HotPink\0" "HotPink1\0" "HotPink2\0" "HotPink3\0" "HotPink4\0" "indian red\0" "IndianRed\0" "IndianRed1\0" "IndianRed2\0" "IndianRed3\0" "IndianRed4\0" "indigo\0" "ivory\0" "ivory1\0" "ivory2\0" "ivory3\0" "ivory4\0" "khaki\0" "khaki1\0" "khaki2\0" "khaki3\0" "khaki4\0" "lavender\0" "lavender blush\0" "LavenderBlush\0" "LavenderBlush1\0" "LavenderBlush2\0" "LavenderBlush3\0" "LavenderBlush4\0" "lawn green\0" "LawnGreen\0" "lemon chiffon\0" "LemonChiffon\0" "LemonChiffon1\0" "LemonChiffon2\0" "LemonChiffon3\0" "LemonChiffon4\0" "light blue\0" "light coral\0" "light cyan\0" "light goldenrod\0" "light goldenrod yellow\0" "light gray\0" "light green\0" "light grey\0" "light pink\0" "light salmon\0" "light sea green\0" "light sky blue\0" "light slate blue\0" "light slate gray\0" "light slate grey\0" "light steel blue\0" "light yellow\0" "LightBlue\0" "LightBlue1\0" "LightBlue2\0" "LightBlue3\0" "LightBlue4\0" "LightCoral\0" "LightCyan\0" "LightCyan1\0" "LightCyan2\0" "LightCyan3\0" "LightCyan4\0" "LightGoldenrod\0" "LightGoldenrod1\0" "LightGoldenrod2\0" "LightGoldenrod3\0" "LightGoldenrod4\0" "LightGoldenrodYellow\0" "LightGray\0" "LightGreen\0" "LightGrey\0" "LightPink\0" "LightPink1\0" "LightPink2\0" "LightPink3\0" "LightPink4\0" "LightSalmon\0" "LightSalmon1\0" "LightSalmon2\0" "LightSalmon3\0" "LightSalmon4\0" "LightSeaGreen\0" "LightSkyBlue\0" "LightSkyBlue1\0" "LightSkyBlue2\0" "LightSkyBlue3\0" "LightSkyBlue4\0" "LightSlateBlue\0" "LightSlateGray\0" "LightSlateGrey\0" "LightSteelBlue\0" "LightSteelBlue1\0" "LightSteelBlue2\0" "LightSteelBlue3\0" "LightSteelBlue4\0" "LightYellow\0" "LightYellow1\0" "LightYellow2\0" "LightYellow3\0" "LightYellow4\0" "lime\0" "lime green\0" "LimeGreen\0" "linen\0" "magenta\0" "magenta1\0" "magenta2\0" "magenta3\0" "magenta4\0" "maroon\0" "maroon1\0" "maroon2\0" "maroon3\0" "maroon4\0" "medium aquamarine\0" "medium blue\0" "medium orchid\0" "medium purple\0" "medium sea green\0" "medium slate blue\0" "medium spring green\0" "medium turquoise\0" "medium violet red\0" "MediumAquamarine\0" "MediumBlue\0" "MediumOrchid\0" "MediumOrchid1\0" "MediumOrchid2\0" "MediumOrchid3\0" "MediumOrchid4\0" "MediumPurple\0" "MediumPurple1\0" "MediumPurple2\0" "MediumPurple3\0" "MediumPurple4\0" "MediumSeaGreen\0" "MediumSlateBlue\0" "MediumSpringGreen\0" "MediumTurquoise\0" "MediumVioletRed\0" "midnight blue\0" "MidnightBlue\0" "mint cream\0" "MintCream\0" "misty rose\0" "MistyRose\0" "MistyRose1\0" "MistyRose2\0" "MistyRose3\0" "MistyRose4\0" "moccasin\0" "navajo white\0" "NavajoWhite\0" "NavajoWhite1\0" "NavajoWhite2\0" "NavajoWhite3\0" "NavajoWhite4\0" "navy\0" "navy blue\0" "NavyBlue\0" "old lace\0" "OldLace\0" "olive\0" "olive drab\0" "OliveDrab\0" "OliveDrab1\0" "OliveDrab2\0" "OliveDrab3\0" "OliveDrab4\0" "orange\0" "orange red\0" "orange1\0" "orange2\0" "orange3\0" "orange4\0" "OrangeRed\0" "OrangeRed1\0" "OrangeRed2\0" "OrangeRed3\0" "OrangeRed4\0" "orchid\0" "orchid1\0" "orchid2\0" "orchid3\0" "orchid4\0" "pale goldenrod\0" "pale green\0" "pale turquoise\0" "pale violet red\0" "PaleGoldenrod\0" "PaleGreen\0" "PaleGreen1\0" "PaleGreen2\0" "PaleGreen3\0" "PaleGreen4\0" "PaleTurquoise\0" "PaleTurquoise1\0" "PaleTurquoise2\0" "PaleTurquoise3\0" "PaleTurquoise4\0" "PaleVioletRed\0" "PaleVioletRed1\0" "PaleVioletRed2\0" "PaleVioletRed3\0" "PaleVioletRed4\0" "papaya whip\0" "PapayaWhip\0" "peach puff\0" "PeachPuff\0" "PeachPuff1\0" "PeachPuff2\0" "PeachPuff3\0" "PeachPuff4\0" "peru\0" "pink\0" "pink1\0" "pink2\0" "pink3\0" "pink4\0" "plum\0" "plum1\0" "plum2\0" "plum3\0" "plum4\0" "powder blue\0" "PowderBlue\0" "purple\0" "purple1\0" "purple2\0" "purple3\0" "purple4\0" "rebecca purple\0" "RebeccaPurple\0" "red\0" "red1\0" "red2\0" "red3\0" "red4\0" "rosy brown\0" "RosyBrown\0" "RosyBrown1\0" "RosyBrown2\0" "RosyBrown3\0" "RosyBrown4\0" "royal blue\0" "RoyalBlue\0" "RoyalBlue1\0" "RoyalBlue2\0" "RoyalBlue3\0" "RoyalBlue4\0" "saddle brown\0" "SaddleBrown\0" "salmon\0" "salmon1\0" "salmon2\0" "salmon3\0" "salmon4\0" "sandy brown\0" "SandyBrown\0" "sea green\0" "SeaGreen\0" "SeaGreen1\0" "SeaGreen2\0" "SeaGreen3\0" "SeaGreen4\0" "seashell\0" "seashell1\0" "seashell2\0" "seashell3\0" "seashell4\0" "sienna\0" "sienna1\0" "sienna2\0" "sienna3\0" "sienna4\0" "silver\0" "sky blue\0" "SkyBlue\0" "SkyBlue1\0" "SkyBlue2\0" "SkyBlue3\0" "SkyBlue4\0" "slate blue\0" "slate gray\0" "slate grey\0" "SlateBlue\0" "SlateBlue1\0" "SlateBlue2\0" "SlateBlue3\0" "SlateBlue4\0" "SlateGray\0" "SlateGray1\0" "SlateGray2\0" "SlateGray3\0" "SlateGray4\0" "SlateGrey\0" "snow\0" "snow1\0" "snow2\0" "snow3\0" "snow4\0" "spring green\0" "SpringGreen\0" "SpringGreen1\0" "SpringGreen2\0" "SpringGreen3\0" "SpringGreen4\0" "steel blue\0" "SteelBlue\0" "SteelBlue1\0" "SteelBlue2\0" "SteelBlue3\0" "SteelBlue4\0" "tan\0" "tan1\0" "tan2\0" "tan3\0" "tan4\0" "teal\0" "thistle\0" "thistle1\0" "thistle2\0" "thistle3\0" "thistle4\0" "tomato\0" "tomato1\0" "tomato2\0" "tomato3\0" "tomato4\0" "turquoise\0" "turquoise1\0" "turquoise2\0" "turquoise3\0" "turquoise4\0" "violet\0" "violet red\0" "VioletRed\0" "VioletRed1\0" "VioletRed2\0" "VioletRed3\0" "VioletRed4\0" "web gray\0" "web green\0" "web grey\0" "web maroon\0" "web purple\0" "WebGray\0" "WebGreen\0" "WebGrey\0" "WebMaroon\0" "WebPurple\0" "wheat\0" "wheat1\0" "wheat2\0" "wheat3\0" "wheat4\0" "white\0" "white smoke\0" "WhiteSmoke\0" "x11 gray\0" "x11 green\0" "x11 grey\0" "x11 maroon\0" "x11 purple\0" "X11Gray\0" "X11Green\0" "X11Grey\0" "X11Maroon\0" "X11Purple\0" "yellow\0" "yellow green\0" "yellow1\0" "yellow2\0" "yellow3\0" "yellow4\0" "YellowGreen\0" }; static const BuiltinColor BuiltinColors[] = { {240, 248, 255, 0}, /* alice blue */ {240, 248, 255, 11}, /* AliceBlue */ {250, 235, 215, 21}, /* antique white */ {250, 235, 215, 35}, /* AntiqueWhite */ {255, 239, 219, 48}, /* AntiqueWhite1 */ {238, 223, 204, 62}, /* AntiqueWhite2 */ {205, 192, 176, 76}, /* AntiqueWhite3 */ {139, 131, 120, 90}, /* AntiqueWhite4 */ {0, 255, 255, 104}, /* aqua */ {127, 255, 212, 109}, /* aquamarine */ {127, 255, 212, 120}, /* aquamarine1 */ {118, 238, 198, 132}, /* aquamarine2 */ {102, 205, 170, 144}, /* aquamarine3 */ {69, 139, 116, 156}, /* aquamarine4 */ {240, 255, 255, 168}, /* azure */ {240, 255, 255, 174}, /* azure1 */ {224, 238, 238, 181}, /* azure2 */ {193, 205, 205, 188}, /* azure3 */ {131, 139, 139, 195}, /* azure4 */ {245, 245, 220, 202}, /* beige */ {255, 228, 196, 208}, /* bisque */ {255, 228, 196, 215}, /* bisque1 */ {238, 213, 183, 223}, /* bisque2 */ {205, 183, 158, 231}, /* bisque3 */ {139, 125, 107, 239}, /* bisque4 */ {0, 0, 0, 247}, /* black */ {255, 235, 205, 253}, /* blanched almond */ {255, 235, 205, 269}, /* BlanchedAlmond */ {0, 0, 255, 284}, /* blue */ {138, 43, 226, 289}, /* blue violet */ {0, 0, 255, 301}, /* blue1 */ {0, 0, 238, 307}, /* blue2 */ {0, 0, 205, 313}, /* blue3 */ {0, 0, 139, 319}, /* blue4 */ {138, 43, 226, 325}, /* BlueViolet */ {165, 42, 42, 336}, /* brown */ {255, 64, 64, 342}, /* brown1 */ {238, 59, 59, 349}, /* brown2 */ {205, 51, 51, 356}, /* brown3 */ {139, 35, 35, 363}, /* brown4 */ {222, 184, 135, 370}, /* burlywood */ {255, 211, 155, 380}, /* burlywood1 */ {238, 197, 145, 391}, /* burlywood2 */ {205, 170, 125, 402}, /* burlywood3 */ {139, 115, 85, 413}, /* burlywood4 */ {95, 158, 160, 424}, /* cadet blue */ {95, 158, 160, 435}, /* CadetBlue */ {152, 245, 255, 445}, /* CadetBlue1 */ {142, 229, 238, 456}, /* CadetBlue2 */ {122, 197, 205, 467}, /* CadetBlue3 */ {83, 134, 139, 478}, /* CadetBlue4 */ {127, 255, 0, 489}, /* chartreuse */ {127, 255, 0, 500}, /* chartreuse1 */ {118, 238, 0, 512}, /* chartreuse2 */ {102, 205, 0, 524}, /* chartreuse3 */ {69, 139, 0, 536}, /* chartreuse4 */ {210, 105, 30, 548}, /* chocolate */ {255, 127, 36, 558}, /* chocolate1 */ {238, 118, 33, 569}, /* chocolate2 */ {205, 102, 29, 580}, /* chocolate3 */ {139, 69, 19, 591}, /* chocolate4 */ {255, 127, 80, 602}, /* coral */ {255, 114, 86, 608}, /* coral1 */ {238, 106, 80, 615}, /* coral2 */ {205, 91, 69, 622}, /* coral3 */ {139, 62, 47, 629}, /* coral4 */ {100, 149, 237, 636}, /* cornflower blue */ {100, 149, 237, 652}, /* CornflowerBlue */ {255, 248, 220, 667}, /* cornsilk */ {255, 248, 220, 676}, /* cornsilk1 */ {238, 232, 205, 686}, /* cornsilk2 */ {205, 200, 177, 696}, /* cornsilk3 */ {139, 136, 120, 706}, /* cornsilk4 */ {220, 20, 60, 716}, /* crimson */ {0, 255, 255, 724}, /* cyan */ {0, 255, 255, 729}, /* cyan1 */ {0, 238, 238, 735}, /* cyan2 */ {0, 205, 205, 741}, /* cyan3 */ {0, 139, 139, 747}, /* cyan4 */ {0, 0, 139, 753}, /* dark blue */ {0, 139, 139, 763}, /* dark cyan */ {184, 134, 11, 773}, /* dark goldenrod */ {169, 169, 169, 788}, /* dark gray */ {0, 100, 0, 798}, /* dark green */ {169, 169, 169, 809}, /* dark grey */ {189, 183, 107, 819}, /* dark khaki */ {139, 0, 139, 830}, /* dark magenta */ {85, 107, 47, 843}, /* dark olive green */ {255, 140, 0, 860}, /* dark orange */ {153, 50, 204, 872}, /* dark orchid */ {139, 0, 0, 884}, /* dark red */ {233, 150, 122, 893}, /* dark salmon */ {143, 188, 143, 905}, /* dark sea green */ {72, 61, 139, 920}, /* dark slate blue */ {47, 79, 79, 936}, /* dark slate gray */ {47, 79, 79, 952}, /* dark slate grey */ {0, 206, 209, 968}, /* dark turquoise */ {148, 0, 211, 983}, /* dark violet */ {0, 0, 139, 995}, /* DarkBlue */ {0, 139, 139, 1004}, /* DarkCyan */ {184, 134, 11, 1013}, /* DarkGoldenrod */ {255, 185, 15, 1027}, /* DarkGoldenrod1 */ {238, 173, 14, 1042}, /* DarkGoldenrod2 */ {205, 149, 12, 1057}, /* DarkGoldenrod3 */ {139, 101, 8, 1072}, /* DarkGoldenrod4 */ {169, 169, 169, 1087}, /* DarkGray */ {0, 100, 0, 1096}, /* DarkGreen */ {169, 169, 169, 1106}, /* DarkGrey */ {189, 183, 107, 1115}, /* DarkKhaki */ {139, 0, 139, 1125}, /* DarkMagenta */ {85, 107, 47, 1137}, /* DarkOliveGreen */ {202, 255, 112, 1152}, /* DarkOliveGreen1 */ {188, 238, 104, 1168}, /* DarkOliveGreen2 */ {162, 205, 90, 1184}, /* DarkOliveGreen3 */ {110, 139, 61, 1200}, /* DarkOliveGreen4 */ {255, 140, 0, 1216}, /* DarkOrange */ {255, 127, 0, 1227}, /* DarkOrange1 */ {238, 118, 0, 1239}, /* DarkOrange2 */ {205, 102, 0, 1251}, /* DarkOrange3 */ {139, 69, 0, 1263}, /* DarkOrange4 */ {153, 50, 204, 1275}, /* DarkOrchid */ {191, 62, 255, 1286}, /* DarkOrchid1 */ {178, 58, 238, 1298}, /* DarkOrchid2 */ {154, 50, 205, 1310}, /* DarkOrchid3 */ {104, 34, 139, 1322}, /* DarkOrchid4 */ {139, 0, 0, 1334}, /* DarkRed */ {233, 150, 122, 1342}, /* DarkSalmon */ {143, 188, 143, 1353}, /* DarkSeaGreen */ {193, 255, 193, 1366}, /* DarkSeaGreen1 */ {180, 238, 180, 1380}, /* DarkSeaGreen2 */ {155, 205, 155, 1394}, /* DarkSeaGreen3 */ {105, 139, 105, 1408}, /* DarkSeaGreen4 */ {72, 61, 139, 1422}, /* DarkSlateBlue */ {47, 79, 79, 1436}, /* DarkSlateGray */ {151, 255, 255, 1450}, /* DarkSlateGray1 */ {141, 238, 238, 1465}, /* DarkSlateGray2 */ {121, 205, 205, 1480}, /* DarkSlateGray3 */ {82, 139, 139, 1495}, /* DarkSlateGray4 */ {47, 79, 79, 1510}, /* DarkSlateGrey */ {0, 206, 209, 1524}, /* DarkTurquoise */ {148, 0, 211, 1538}, /* DarkViolet */ {255, 20, 147, 1549}, /* deep pink */ {0, 191, 255, 1559}, /* deep sky blue */ {255, 20, 147, 1573}, /* DeepPink */ {255, 20, 147, 1582}, /* DeepPink1 */ {238, 18, 137, 1592}, /* DeepPink2 */ {205, 16, 118, 1602}, /* DeepPink3 */ {139, 10, 80, 1612}, /* DeepPink4 */ {0, 191, 255, 1622}, /* DeepSkyBlue */ {0, 191, 255, 1634}, /* DeepSkyBlue1 */ {0, 178, 238, 1647}, /* DeepSkyBlue2 */ {0, 154, 205, 1660}, /* DeepSkyBlue3 */ {0, 104, 139, 1673}, /* DeepSkyBlue4 */ {105, 105, 105, 1686}, /* dim gray */ {105, 105, 105, 1695}, /* dim grey */ {105, 105, 105, 1704}, /* DimGray */ {105, 105, 105, 1712}, /* DimGrey */ {30, 144, 255, 1720}, /* dodger blue */ {30, 144, 255, 1732}, /* DodgerBlue */ {30, 144, 255, 1743}, /* DodgerBlue1 */ {28, 134, 238, 1755}, /* DodgerBlue2 */ {24, 116, 205, 1767}, /* DodgerBlue3 */ {16, 78, 139, 1779}, /* DodgerBlue4 */ {178, 34, 34, 1791}, /* firebrick */ {255, 48, 48, 1801}, /* firebrick1 */ {238, 44, 44, 1812}, /* firebrick2 */ {205, 38, 38, 1823}, /* firebrick3 */ {139, 26, 26, 1834}, /* firebrick4 */ {255, 250, 240, 1845}, /* floral white */ {255, 250, 240, 1858}, /* FloralWhite */ {34, 139, 34, 1870}, /* forest green */ {34, 139, 34, 1883}, /* ForestGreen */ {255, 0, 255, 1895}, /* fuchsia */ {220, 220, 220, 1903}, /* gainsboro */ {248, 248, 255, 1913}, /* ghost white */ {248, 248, 255, 1925}, /* GhostWhite */ {255, 215, 0, 1936}, /* gold */ {255, 215, 0, 1941}, /* gold1 */ {238, 201, 0, 1947}, /* gold2 */ {205, 173, 0, 1953}, /* gold3 */ {139, 117, 0, 1959}, /* gold4 */ {218, 165, 32, 1965}, /* goldenrod */ {255, 193, 37, 1975}, /* goldenrod1 */ {238, 180, 34, 1986}, /* goldenrod2 */ {205, 155, 29, 1997}, /* goldenrod3 */ {139, 105, 20, 2008}, /* goldenrod4 */ {190, 190, 190, 2019}, /* gray */ {0, 0, 0, 2024}, /* gray0 */ {3, 3, 3, 2030}, /* gray1 */ {26, 26, 26, 2036}, /* gray10 */ {255, 255, 255, 2043}, /* gray100 */ {28, 28, 28, 2051}, /* gray11 */ {31, 31, 31, 2058}, /* gray12 */ {33, 33, 33, 2065}, /* gray13 */ {36, 36, 36, 2072}, /* gray14 */ {38, 38, 38, 2079}, /* gray15 */ {41, 41, 41, 2086}, /* gray16 */ {43, 43, 43, 2093}, /* gray17 */ {46, 46, 46, 2100}, /* gray18 */ {48, 48, 48, 2107}, /* gray19 */ {5, 5, 5, 2114}, /* gray2 */ {51, 51, 51, 2120}, /* gray20 */ {54, 54, 54, 2127}, /* gray21 */ {56, 56, 56, 2134}, /* gray22 */ {59, 59, 59, 2141}, /* gray23 */ {61, 61, 61, 2148}, /* gray24 */ {64, 64, 64, 2155}, /* gray25 */ {66, 66, 66, 2162}, /* gray26 */ {69, 69, 69, 2169}, /* gray27 */ {71, 71, 71, 2176}, /* gray28 */ {74, 74, 74, 2183}, /* gray29 */ {8, 8, 8, 2190}, /* gray3 */ {77, 77, 77, 2196}, /* gray30 */ {79, 79, 79, 2203}, /* gray31 */ {82, 82, 82, 2210}, /* gray32 */ {84, 84, 84, 2217}, /* gray33 */ {87, 87, 87, 2224}, /* gray34 */ {89, 89, 89, 2231}, /* gray35 */ {92, 92, 92, 2238}, /* gray36 */ {94, 94, 94, 2245}, /* gray37 */ {97, 97, 97, 2252}, /* gray38 */ {99, 99, 99, 2259}, /* gray39 */ {10, 10, 10, 2266}, /* gray4 */ {102, 102, 102, 2272}, /* gray40 */ {105, 105, 105, 2279}, /* gray41 */ {107, 107, 107, 2286}, /* gray42 */ {110, 110, 110, 2293}, /* gray43 */ {112, 112, 112, 2300}, /* gray44 */ {115, 115, 115, 2307}, /* gray45 */ {117, 117, 117, 2314}, /* gray46 */ {120, 120, 120, 2321}, /* gray47 */ {122, 122, 122, 2328}, /* gray48 */ {125, 125, 125, 2335}, /* gray49 */ {13, 13, 13, 2342}, /* gray5 */ {127, 127, 127, 2348}, /* gray50 */ {130, 130, 130, 2355}, /* gray51 */ {133, 133, 133, 2362}, /* gray52 */ {135, 135, 135, 2369}, /* gray53 */ {138, 138, 138, 2376}, /* gray54 */ {140, 140, 140, 2383}, /* gray55 */ {143, 143, 143, 2390}, /* gray56 */ {145, 145, 145, 2397}, /* gray57 */ {148, 148, 148, 2404}, /* gray58 */ {150, 150, 150, 2411}, /* gray59 */ {15, 15, 15, 2418}, /* gray6 */ {153, 153, 153, 2424}, /* gray60 */ {156, 156, 156, 2431}, /* gray61 */ {158, 158, 158, 2438}, /* gray62 */ {161, 161, 161, 2445}, /* gray63 */ {163, 163, 163, 2452}, /* gray64 */ {166, 166, 166, 2459}, /* gray65 */ {168, 168, 168, 2466}, /* gray66 */ {171, 171, 171, 2473}, /* gray67 */ {173, 173, 173, 2480}, /* gray68 */ {176, 176, 176, 2487}, /* gray69 */ {18, 18, 18, 2494}, /* gray7 */ {179, 179, 179, 2500}, /* gray70 */ {181, 181, 181, 2507}, /* gray71 */ {184, 184, 184, 2514}, /* gray72 */ {186, 186, 186, 2521}, /* gray73 */ {189, 189, 189, 2528}, /* gray74 */ {191, 191, 191, 2535}, /* gray75 */ {194, 194, 194, 2542}, /* gray76 */ {196, 196, 196, 2549}, /* gray77 */ {199, 199, 199, 2556}, /* gray78 */ {201, 201, 201, 2563}, /* gray79 */ {20, 20, 20, 2570}, /* gray8 */ {204, 204, 204, 2576}, /* gray80 */ {207, 207, 207, 2583}, /* gray81 */ {209, 209, 209, 2590}, /* gray82 */ {212, 212, 212, 2597}, /* gray83 */ {214, 214, 214, 2604}, /* gray84 */ {217, 217, 217, 2611}, /* gray85 */ {219, 219, 219, 2618}, /* gray86 */ {222, 222, 222, 2625}, /* gray87 */ {224, 224, 224, 2632}, /* gray88 */ {227, 227, 227, 2639}, /* gray89 */ {23, 23, 23, 2646}, /* gray9 */ {229, 229, 229, 2652}, /* gray90 */ {232, 232, 232, 2659}, /* gray91 */ {235, 235, 235, 2666}, /* gray92 */ {237, 237, 237, 2673}, /* gray93 */ {240, 240, 240, 2680}, /* gray94 */ {242, 242, 242, 2687}, /* gray95 */ {245, 245, 245, 2694}, /* gray96 */ {247, 247, 247, 2701}, /* gray97 */ {250, 250, 250, 2708}, /* gray98 */ {252, 252, 252, 2715}, /* gray99 */ {0, 255, 0, 2722}, /* green */ {173, 255, 47, 2728}, /* green yellow */ {0, 255, 0, 2741}, /* green1 */ {0, 238, 0, 2748}, /* green2 */ {0, 205, 0, 2755}, /* green3 */ {0, 139, 0, 2762}, /* green4 */ {173, 255, 47, 2769}, /* GreenYellow */ {190, 190, 190, 2781}, /* grey */ {0, 0, 0, 2786}, /* grey0 */ {3, 3, 3, 2792}, /* grey1 */ {26, 26, 26, 2798}, /* grey10 */ {255, 255, 255, 2805}, /* grey100 */ {28, 28, 28, 2813}, /* grey11 */ {31, 31, 31, 2820}, /* grey12 */ {33, 33, 33, 2827}, /* grey13 */ {36, 36, 36, 2834}, /* grey14 */ {38, 38, 38, 2841}, /* grey15 */ {41, 41, 41, 2848}, /* grey16 */ {43, 43, 43, 2855}, /* grey17 */ {46, 46, 46, 2862}, /* grey18 */ {48, 48, 48, 2869}, /* grey19 */ {5, 5, 5, 2876}, /* grey2 */ {51, 51, 51, 2882}, /* grey20 */ {54, 54, 54, 2889}, /* grey21 */ {56, 56, 56, 2896}, /* grey22 */ {59, 59, 59, 2903}, /* grey23 */ {61, 61, 61, 2910}, /* grey24 */ {64, 64, 64, 2917}, /* grey25 */ {66, 66, 66, 2924}, /* grey26 */ {69, 69, 69, 2931}, /* grey27 */ {71, 71, 71, 2938}, /* grey28 */ {74, 74, 74, 2945}, /* grey29 */ {8, 8, 8, 2952}, /* grey3 */ {77, 77, 77, 2958}, /* grey30 */ {79, 79, 79, 2965}, /* grey31 */ {82, 82, 82, 2972}, /* grey32 */ {84, 84, 84, 2979}, /* grey33 */ {87, 87, 87, 2986}, /* grey34 */ {89, 89, 89, 2993}, /* grey35 */ {92, 92, 92, 3000}, /* grey36 */ {94, 94, 94, 3007}, /* grey37 */ {97, 97, 97, 3014}, /* grey38 */ {99, 99, 99, 3021}, /* grey39 */ {10, 10, 10, 3028}, /* grey4 */ {102, 102, 102, 3034}, /* grey40 */ {105, 105, 105, 3041}, /* grey41 */ {107, 107, 107, 3048}, /* grey42 */ {110, 110, 110, 3055}, /* grey43 */ {112, 112, 112, 3062}, /* grey44 */ {115, 115, 115, 3069}, /* grey45 */ {117, 117, 117, 3076}, /* grey46 */ {120, 120, 120, 3083}, /* grey47 */ {122, 122, 122, 3090}, /* grey48 */ {125, 125, 125, 3097}, /* grey49 */ {13, 13, 13, 3104}, /* grey5 */ {127, 127, 127, 3110}, /* grey50 */ {130, 130, 130, 3117}, /* grey51 */ {133, 133, 133, 3124}, /* grey52 */ {135, 135, 135, 3131}, /* grey53 */ {138, 138, 138, 3138}, /* grey54 */ {140, 140, 140, 3145}, /* grey55 */ {143, 143, 143, 3152}, /* grey56 */ {145, 145, 145, 3159}, /* grey57 */ {148, 148, 148, 3166}, /* grey58 */ {150, 150, 150, 3173}, /* grey59 */ {15, 15, 15, 3180}, /* grey6 */ {153, 153, 153, 3186}, /* grey60 */ {156, 156, 156, 3193}, /* grey61 */ {158, 158, 158, 3200}, /* grey62 */ {161, 161, 161, 3207}, /* grey63 */ {163, 163, 163, 3214}, /* grey64 */ {166, 166, 166, 3221}, /* grey65 */ {168, 168, 168, 3228}, /* grey66 */ {171, 171, 171, 3235}, /* grey67 */ {173, 173, 173, 3242}, /* grey68 */ {176, 176, 176, 3249}, /* grey69 */ {18, 18, 18, 3256}, /* grey7 */ {179, 179, 179, 3262}, /* grey70 */ {181, 181, 181, 3269}, /* grey71 */ {184, 184, 184, 3276}, /* grey72 */ {186, 186, 186, 3283}, /* grey73 */ {189, 189, 189, 3290}, /* grey74 */ {191, 191, 191, 3297}, /* grey75 */ {194, 194, 194, 3304}, /* grey76 */ {196, 196, 196, 3311}, /* grey77 */ {199, 199, 199, 3318}, /* grey78 */ {201, 201, 201, 3325}, /* grey79 */ {20, 20, 20, 3332}, /* grey8 */ {204, 204, 204, 3338}, /* grey80 */ {207, 207, 207, 3345}, /* grey81 */ {209, 209, 209, 3352}, /* grey82 */ {212, 212, 212, 3359}, /* grey83 */ {214, 214, 214, 3366}, /* grey84 */ {217, 217, 217, 3373}, /* grey85 */ {219, 219, 219, 3380}, /* grey86 */ {222, 222, 222, 3387}, /* grey87 */ {224, 224, 224, 3394}, /* grey88 */ {227, 227, 227, 3401}, /* grey89 */ {23, 23, 23, 3408}, /* grey9 */ {229, 229, 229, 3414}, /* grey90 */ {232, 232, 232, 3421}, /* grey91 */ {235, 235, 235, 3428}, /* grey92 */ {237, 237, 237, 3435}, /* grey93 */ {240, 240, 240, 3442}, /* grey94 */ {242, 242, 242, 3449}, /* grey95 */ {245, 245, 245, 3456}, /* grey96 */ {247, 247, 247, 3463}, /* grey97 */ {250, 250, 250, 3470}, /* grey98 */ {252, 252, 252, 3477}, /* grey99 */ {240, 255, 240, 3484}, /* honeydew */ {240, 255, 240, 3493}, /* honeydew1 */ {224, 238, 224, 3503}, /* honeydew2 */ {193, 205, 193, 3513}, /* honeydew3 */ {131, 139, 131, 3523}, /* honeydew4 */ {255, 105, 180, 3533}, /* hot pink */ {255, 105, 180, 3542}, /* HotPink */ {255, 110, 180, 3550}, /* HotPink1 */ {238, 106, 167, 3559}, /* HotPink2 */ {205, 96, 144, 3568}, /* HotPink3 */ {139, 58, 98, 3577}, /* HotPink4 */ {205, 92, 92, 3586}, /* indian red */ {205, 92, 92, 3597}, /* IndianRed */ {255, 106, 106, 3607}, /* IndianRed1 */ {238, 99, 99, 3618}, /* IndianRed2 */ {205, 85, 85, 3629}, /* IndianRed3 */ {139, 58, 58, 3640}, /* IndianRed4 */ {75, 0, 130, 3651}, /* indigo */ {255, 255, 240, 3658}, /* ivory */ {255, 255, 240, 3664}, /* ivory1 */ {238, 238, 224, 3671}, /* ivory2 */ {205, 205, 193, 3678}, /* ivory3 */ {139, 139, 131, 3685}, /* ivory4 */ {240, 230, 140, 3692}, /* khaki */ {255, 246, 143, 3698}, /* khaki1 */ {238, 230, 133, 3705}, /* khaki2 */ {205, 198, 115, 3712}, /* khaki3 */ {139, 134, 78, 3719}, /* khaki4 */ {230, 230, 250, 3726}, /* lavender */ {255, 240, 245, 3735}, /* lavender blush */ {255, 240, 245, 3750}, /* LavenderBlush */ {255, 240, 245, 3764}, /* LavenderBlush1 */ {238, 224, 229, 3779}, /* LavenderBlush2 */ {205, 193, 197, 3794}, /* LavenderBlush3 */ {139, 131, 134, 3809}, /* LavenderBlush4 */ {124, 252, 0, 3824}, /* lawn green */ {124, 252, 0, 3835}, /* LawnGreen */ {255, 250, 205, 3845}, /* lemon chiffon */ {255, 250, 205, 3859}, /* LemonChiffon */ {255, 250, 205, 3872}, /* LemonChiffon1 */ {238, 233, 191, 3886}, /* LemonChiffon2 */ {205, 201, 165, 3900}, /* LemonChiffon3 */ {139, 137, 112, 3914}, /* LemonChiffon4 */ {173, 216, 230, 3928}, /* light blue */ {240, 128, 128, 3939}, /* light coral */ {224, 255, 255, 3951}, /* light cyan */ {238, 221, 130, 3962}, /* light goldenrod */ {250, 250, 210, 3978}, /* light goldenrod yellow */ {211, 211, 211, 4001}, /* light gray */ {144, 238, 144, 4012}, /* light green */ {211, 211, 211, 4024}, /* light grey */ {255, 182, 193, 4035}, /* light pink */ {255, 160, 122, 4046}, /* light salmon */ {32, 178, 170, 4059}, /* light sea green */ {135, 206, 250, 4075}, /* light sky blue */ {132, 112, 255, 4090}, /* light slate blue */ {119, 136, 153, 4107}, /* light slate gray */ {119, 136, 153, 4124}, /* light slate grey */ {176, 196, 222, 4141}, /* light steel blue */ {255, 255, 224, 4158}, /* light yellow */ {173, 216, 230, 4171}, /* LightBlue */ {191, 239, 255, 4181}, /* LightBlue1 */ {178, 223, 238, 4192}, /* LightBlue2 */ {154, 192, 205, 4203}, /* LightBlue3 */ {104, 131, 139, 4214}, /* LightBlue4 */ {240, 128, 128, 4225}, /* LightCoral */ {224, 255, 255, 4236}, /* LightCyan */ {224, 255, 255, 4246}, /* LightCyan1 */ {209, 238, 238, 4257}, /* LightCyan2 */ {180, 205, 205, 4268}, /* LightCyan3 */ {122, 139, 139, 4279}, /* LightCyan4 */ {238, 221, 130, 4290}, /* LightGoldenrod */ {255, 236, 139, 4305}, /* LightGoldenrod1 */ {238, 220, 130, 4321}, /* LightGoldenrod2 */ {205, 190, 112, 4337}, /* LightGoldenrod3 */ {139, 129, 76, 4353}, /* LightGoldenrod4 */ {250, 250, 210, 4369}, /* LightGoldenrodYellow */ {211, 211, 211, 4390}, /* LightGray */ {144, 238, 144, 4400}, /* LightGreen */ {211, 211, 211, 4411}, /* LightGrey */ {255, 182, 193, 4421}, /* LightPink */ {255, 174, 185, 4431}, /* LightPink1 */ {238, 162, 173, 4442}, /* LightPink2 */ {205, 140, 149, 4453}, /* LightPink3 */ {139, 95, 101, 4464}, /* LightPink4 */ {255, 160, 122, 4475}, /* LightSalmon */ {255, 160, 122, 4487}, /* LightSalmon1 */ {238, 149, 114, 4500}, /* LightSalmon2 */ {205, 129, 98, 4513}, /* LightSalmon3 */ {139, 87, 66, 4526}, /* LightSalmon4 */ {32, 178, 170, 4539}, /* LightSeaGreen */ {135, 206, 250, 4553}, /* LightSkyBlue */ {176, 226, 255, 4566}, /* LightSkyBlue1 */ {164, 211, 238, 4580}, /* LightSkyBlue2 */ {141, 182, 205, 4594}, /* LightSkyBlue3 */ {96, 123, 139, 4608}, /* LightSkyBlue4 */ {132, 112, 255, 4622}, /* LightSlateBlue */ {119, 136, 153, 4637}, /* LightSlateGray */ {119, 136, 153, 4652}, /* LightSlateGrey */ {176, 196, 222, 4667}, /* LightSteelBlue */ {202, 225, 255, 4682}, /* LightSteelBlue1 */ {188, 210, 238, 4698}, /* LightSteelBlue2 */ {162, 181, 205, 4714}, /* LightSteelBlue3 */ {110, 123, 139, 4730}, /* LightSteelBlue4 */ {255, 255, 224, 4746}, /* LightYellow */ {255, 255, 224, 4758}, /* LightYellow1 */ {238, 238, 209, 4771}, /* LightYellow2 */ {205, 205, 180, 4784}, /* LightYellow3 */ {139, 139, 122, 4797}, /* LightYellow4 */ {0, 255, 0, 4810}, /* lime */ {50, 205, 50, 4815}, /* lime green */ {50, 205, 50, 4826}, /* LimeGreen */ {250, 240, 230, 4836}, /* linen */ {255, 0, 255, 4842}, /* magenta */ {255, 0, 255, 4850}, /* magenta1 */ {238, 0, 238, 4859}, /* magenta2 */ {205, 0, 205, 4868}, /* magenta3 */ {139, 0, 139, 4877}, /* magenta4 */ {176, 48, 96, 4886}, /* maroon */ {255, 52, 179, 4893}, /* maroon1 */ {238, 48, 167, 4901}, /* maroon2 */ {205, 41, 144, 4909}, /* maroon3 */ {139, 28, 98, 4917}, /* maroon4 */ {102, 205, 170, 4925}, /* medium aquamarine */ {0, 0, 205, 4943}, /* medium blue */ {186, 85, 211, 4955}, /* medium orchid */ {147, 112, 219, 4969}, /* medium purple */ {60, 179, 113, 4983}, /* medium sea green */ {123, 104, 238, 5000}, /* medium slate blue */ {0, 250, 154, 5018}, /* medium spring green */ {72, 209, 204, 5038}, /* medium turquoise */ {199, 21, 133, 5055}, /* medium violet red */ {102, 205, 170, 5073}, /* MediumAquamarine */ {0, 0, 205, 5090}, /* MediumBlue */ {186, 85, 211, 5101}, /* MediumOrchid */ {224, 102, 255, 5114}, /* MediumOrchid1 */ {209, 95, 238, 5128}, /* MediumOrchid2 */ {180, 82, 205, 5142}, /* MediumOrchid3 */ {122, 55, 139, 5156}, /* MediumOrchid4 */ {147, 112, 219, 5170}, /* MediumPurple */ {171, 130, 255, 5183}, /* MediumPurple1 */ {159, 121, 238, 5197}, /* MediumPurple2 */ {137, 104, 205, 5211}, /* MediumPurple3 */ {93, 71, 139, 5225}, /* MediumPurple4 */ {60, 179, 113, 5239}, /* MediumSeaGreen */ {123, 104, 238, 5254}, /* MediumSlateBlue */ {0, 250, 154, 5270}, /* MediumSpringGreen */ {72, 209, 204, 5288}, /* MediumTurquoise */ {199, 21, 133, 5304}, /* MediumVioletRed */ {25, 25, 112, 5320}, /* midnight blue */ {25, 25, 112, 5334}, /* MidnightBlue */ {245, 255, 250, 5347}, /* mint cream */ {245, 255, 250, 5358}, /* MintCream */ {255, 228, 225, 5368}, /* misty rose */ {255, 228, 225, 5379}, /* MistyRose */ {255, 228, 225, 5389}, /* MistyRose1 */ {238, 213, 210, 5400}, /* MistyRose2 */ {205, 183, 181, 5411}, /* MistyRose3 */ {139, 125, 123, 5422}, /* MistyRose4 */ {255, 228, 181, 5433}, /* moccasin */ {255, 222, 173, 5442}, /* navajo white */ {255, 222, 173, 5455}, /* NavajoWhite */ {255, 222, 173, 5467}, /* NavajoWhite1 */ {238, 207, 161, 5480}, /* NavajoWhite2 */ {205, 179, 139, 5493}, /* NavajoWhite3 */ {139, 121, 94, 5506}, /* NavajoWhite4 */ {0, 0, 128, 5519}, /* navy */ {0, 0, 128, 5524}, /* navy blue */ {0, 0, 128, 5534}, /* NavyBlue */ {253, 245, 230, 5543}, /* old lace */ {253, 245, 230, 5552}, /* OldLace */ {128, 128, 0, 5560}, /* olive */ {107, 142, 35, 5566}, /* olive drab */ {107, 142, 35, 5577}, /* OliveDrab */ {192, 255, 62, 5587}, /* OliveDrab1 */ {179, 238, 58, 5598}, /* OliveDrab2 */ {154, 205, 50, 5609}, /* OliveDrab3 */ {105, 139, 34, 5620}, /* OliveDrab4 */ {255, 165, 0, 5631}, /* orange */ {255, 69, 0, 5638}, /* orange red */ {255, 165, 0, 5649}, /* orange1 */ {238, 154, 0, 5657}, /* orange2 */ {205, 133, 0, 5665}, /* orange3 */ {139, 90, 0, 5673}, /* orange4 */ {255, 69, 0, 5681}, /* OrangeRed */ {255, 69, 0, 5691}, /* OrangeRed1 */ {238, 64, 0, 5702}, /* OrangeRed2 */ {205, 55, 0, 5713}, /* OrangeRed3 */ {139, 37, 0, 5724}, /* OrangeRed4 */ {218, 112, 214, 5735}, /* orchid */ {255, 131, 250, 5742}, /* orchid1 */ {238, 122, 233, 5750}, /* orchid2 */ {205, 105, 201, 5758}, /* orchid3 */ {139, 71, 137, 5766}, /* orchid4 */ {238, 232, 170, 5774}, /* pale goldenrod */ {152, 251, 152, 5789}, /* pale green */ {175, 238, 238, 5800}, /* pale turquoise */ {219, 112, 147, 5815}, /* pale violet red */ {238, 232, 170, 5831}, /* PaleGoldenrod */ {152, 251, 152, 5845}, /* PaleGreen */ {154, 255, 154, 5855}, /* PaleGreen1 */ {144, 238, 144, 5866}, /* PaleGreen2 */ {124, 205, 124, 5877}, /* PaleGreen3 */ {84, 139, 84, 5888}, /* PaleGreen4 */ {175, 238, 238, 5899}, /* PaleTurquoise */ {187, 255, 255, 5913}, /* PaleTurquoise1 */ {174, 238, 238, 5928}, /* PaleTurquoise2 */ {150, 205, 205, 5943}, /* PaleTurquoise3 */ {102, 139, 139, 5958}, /* PaleTurquoise4 */ {219, 112, 147, 5973}, /* PaleVioletRed */ {255, 130, 171, 5987}, /* PaleVioletRed1 */ {238, 121, 159, 6002}, /* PaleVioletRed2 */ {205, 104, 137, 6017}, /* PaleVioletRed3 */ {139, 71, 93, 6032}, /* PaleVioletRed4 */ {255, 239, 213, 6047}, /* papaya whip */ {255, 239, 213, 6059}, /* PapayaWhip */ {255, 218, 185, 6070}, /* peach puff */ {255, 218, 185, 6081}, /* PeachPuff */ {255, 218, 185, 6091}, /* PeachPuff1 */ {238, 203, 173, 6102}, /* PeachPuff2 */ {205, 175, 149, 6113}, /* PeachPuff3 */ {139, 119, 101, 6124}, /* PeachPuff4 */ {205, 133, 63, 6135}, /* peru */ {255, 192, 203, 6140}, /* pink */ {255, 181, 197, 6145}, /* pink1 */ {238, 169, 184, 6151}, /* pink2 */ {205, 145, 158, 6157}, /* pink3 */ {139, 99, 108, 6163}, /* pink4 */ {221, 160, 221, 6169}, /* plum */ {255, 187, 255, 6174}, /* plum1 */ {238, 174, 238, 6180}, /* plum2 */ {205, 150, 205, 6186}, /* plum3 */ {139, 102, 139, 6192}, /* plum4 */ {176, 224, 230, 6198}, /* powder blue */ {176, 224, 230, 6210}, /* PowderBlue */ {160, 32, 240, 6221}, /* purple */ {155, 48, 255, 6228}, /* purple1 */ {145, 44, 238, 6236}, /* purple2 */ {125, 38, 205, 6244}, /* purple3 */ {85, 26, 139, 6252}, /* purple4 */ {102, 51, 153, 6260}, /* rebecca purple */ {102, 51, 153, 6275}, /* RebeccaPurple */ {255, 0, 0, 6289}, /* red */ {255, 0, 0, 6293}, /* red1 */ {238, 0, 0, 6298}, /* red2 */ {205, 0, 0, 6303}, /* red3 */ {139, 0, 0, 6308}, /* red4 */ {188, 143, 143, 6313}, /* rosy brown */ {188, 143, 143, 6324}, /* RosyBrown */ {255, 193, 193, 6334}, /* RosyBrown1 */ {238, 180, 180, 6345}, /* RosyBrown2 */ {205, 155, 155, 6356}, /* RosyBrown3 */ {139, 105, 105, 6367}, /* RosyBrown4 */ {65, 105, 225, 6378}, /* royal blue */ {65, 105, 225, 6389}, /* RoyalBlue */ {72, 118, 255, 6399}, /* RoyalBlue1 */ {67, 110, 238, 6410}, /* RoyalBlue2 */ {58, 95, 205, 6421}, /* RoyalBlue3 */ {39, 64, 139, 6432}, /* RoyalBlue4 */ {139, 69, 19, 6443}, /* saddle brown */ {139, 69, 19, 6456}, /* SaddleBrown */ {250, 128, 114, 6468}, /* salmon */ {255, 140, 105, 6475}, /* salmon1 */ {238, 130, 98, 6483}, /* salmon2 */ {205, 112, 84, 6491}, /* salmon3 */ {139, 76, 57, 6499}, /* salmon4 */ {244, 164, 96, 6507}, /* sandy brown */ {244, 164, 96, 6519}, /* SandyBrown */ {46, 139, 87, 6530}, /* sea green */ {46, 139, 87, 6540}, /* SeaGreen */ {84, 255, 159, 6549}, /* SeaGreen1 */ {78, 238, 148, 6559}, /* SeaGreen2 */ {67, 205, 128, 6569}, /* SeaGreen3 */ {46, 139, 87, 6579}, /* SeaGreen4 */ {255, 245, 238, 6589}, /* seashell */ {255, 245, 238, 6598}, /* seashell1 */ {238, 229, 222, 6608}, /* seashell2 */ {205, 197, 191, 6618}, /* seashell3 */ {139, 134, 130, 6628}, /* seashell4 */ {160, 82, 45, 6638}, /* sienna */ {255, 130, 71, 6645}, /* sienna1 */ {238, 121, 66, 6653}, /* sienna2 */ {205, 104, 57, 6661}, /* sienna3 */ {139, 71, 38, 6669}, /* sienna4 */ {192, 192, 192, 6677}, /* silver */ {135, 206, 235, 6684}, /* sky blue */ {135, 206, 235, 6693}, /* SkyBlue */ {135, 206, 255, 6701}, /* SkyBlue1 */ {126, 192, 238, 6710}, /* SkyBlue2 */ {108, 166, 205, 6719}, /* SkyBlue3 */ {74, 112, 139, 6728}, /* SkyBlue4 */ {106, 90, 205, 6737}, /* slate blue */ {112, 128, 144, 6748}, /* slate gray */ {112, 128, 144, 6759}, /* slate grey */ {106, 90, 205, 6770}, /* SlateBlue */ {131, 111, 255, 6780}, /* SlateBlue1 */ {122, 103, 238, 6791}, /* SlateBlue2 */ {105, 89, 205, 6802}, /* SlateBlue3 */ {71, 60, 139, 6813}, /* SlateBlue4 */ {112, 128, 144, 6824}, /* SlateGray */ {198, 226, 255, 6834}, /* SlateGray1 */ {185, 211, 238, 6845}, /* SlateGray2 */ {159, 182, 205, 6856}, /* SlateGray3 */ {108, 123, 139, 6867}, /* SlateGray4 */ {112, 128, 144, 6878}, /* SlateGrey */ {255, 250, 250, 6888}, /* snow */ {255, 250, 250, 6893}, /* snow1 */ {238, 233, 233, 6899}, /* snow2 */ {205, 201, 201, 6905}, /* snow3 */ {139, 137, 137, 6911}, /* snow4 */ {0, 255, 127, 6917}, /* spring green */ {0, 255, 127, 6930}, /* SpringGreen */ {0, 255, 127, 6942}, /* SpringGreen1 */ {0, 238, 118, 6955}, /* SpringGreen2 */ {0, 205, 102, 6968}, /* SpringGreen3 */ {0, 139, 69, 6981}, /* SpringGreen4 */ {70, 130, 180, 6994}, /* steel blue */ {70, 130, 180, 7005}, /* SteelBlue */ {99, 184, 255, 7015}, /* SteelBlue1 */ {92, 172, 238, 7026}, /* SteelBlue2 */ {79, 148, 205, 7037}, /* SteelBlue3 */ {54, 100, 139, 7048}, /* SteelBlue4 */ {210, 180, 140, 7059}, /* tan */ {255, 165, 79, 7063}, /* tan1 */ {238, 154, 73, 7068}, /* tan2 */ {205, 133, 63, 7073}, /* tan3 */ {139, 90, 43, 7078}, /* tan4 */ {0, 128, 128, 7083}, /* teal */ {216, 191, 216, 7088}, /* thistle */ {255, 225, 255, 7096}, /* thistle1 */ {238, 210, 238, 7105}, /* thistle2 */ {205, 181, 205, 7114}, /* thistle3 */ {139, 123, 139, 7123}, /* thistle4 */ {255, 99, 71, 7132}, /* tomato */ {255, 99, 71, 7139}, /* tomato1 */ {238, 92, 66, 7147}, /* tomato2 */ {205, 79, 57, 7155}, /* tomato3 */ {139, 54, 38, 7163}, /* tomato4 */ {64, 224, 208, 7171}, /* turquoise */ {0, 245, 255, 7181}, /* turquoise1 */ {0, 229, 238, 7192}, /* turquoise2 */ {0, 197, 205, 7203}, /* turquoise3 */ {0, 134, 139, 7214}, /* turquoise4 */ {238, 130, 238, 7225}, /* violet */ {208, 32, 144, 7232}, /* violet red */ {208, 32, 144, 7243}, /* VioletRed */ {255, 62, 150, 7253}, /* VioletRed1 */ {238, 58, 140, 7264}, /* VioletRed2 */ {205, 50, 120, 7275}, /* VioletRed3 */ {139, 34, 82, 7286}, /* VioletRed4 */ {128, 128, 128, 7297}, /* web gray */ {0, 128, 0, 7306}, /* web green */ {128, 128, 128, 7316}, /* web grey */ {128, 0, 0, 7325}, /* web maroon */ {128, 0, 128, 7336}, /* web purple */ {128, 128, 128, 7347}, /* WebGray */ {0, 128, 0, 7355}, /* WebGreen */ {128, 128, 128, 7364}, /* WebGrey */ {128, 0, 0, 7372}, /* WebMaroon */ {128, 0, 128, 7382}, /* WebPurple */ {245, 222, 179, 7392}, /* wheat */ {255, 231, 186, 7398}, /* wheat1 */ {238, 216, 174, 7405}, /* wheat2 */ {205, 186, 150, 7412}, /* wheat3 */ {139, 126, 102, 7419}, /* wheat4 */ {255, 255, 255, 7426}, /* white */ {245, 245, 245, 7432}, /* white smoke */ {245, 245, 245, 7444}, /* WhiteSmoke */ {190, 190, 190, 7455}, /* x11 gray */ {0, 255, 0, 7464}, /* x11 green */ {190, 190, 190, 7474}, /* x11 grey */ {176, 48, 96, 7483}, /* x11 maroon */ {160, 32, 240, 7494}, /* x11 purple */ {190, 190, 190, 7505}, /* X11Gray */ {0, 255, 0, 7513}, /* X11Green */ {190, 190, 190, 7522}, /* X11Grey */ {176, 48, 96, 7530}, /* X11Maroon */ {160, 32, 240, 7540}, /* X11Purple */ {255, 255, 0, 7550}, /* yellow */ {154, 205, 50, 7557}, /* yellow green */ {255, 255, 0, 7570}, /* yellow1 */ {238, 238, 0, 7578}, /* yellow2 */ {205, 205, 0, 7586}, /* yellow3 */ {139, 139, 0, 7594}, /* yellow4 */ {154, 205, 50, 7602}, /* YellowGreen */ }; #define NUM_BUILTIN_COLORS (sizeof (BuiltinColors) / sizeof (BuiltinColors[0])) Bool OsLookupColor(int screen, char *name, unsigned int len, unsigned short *pred, unsigned short *pgreen, unsigned short *pblue) { const BuiltinColor *c; int low, mid, high; int r; low = 0; high = NUM_BUILTIN_COLORS - 1; while (high >= low) { mid = (low + high) / 2; c = &BuiltinColors[mid]; r = strncasecmp(&BuiltinColorNames[c->name], name, len); if (r == 0 && len == strlen(&BuiltinColorNames[c->name])) { *pred = c->red * 0x101; *pgreen = c->green * 0x101; *pblue = c->blue * 0x101; return TRUE; } if (r < 0) low = mid + 1; else high = mid - 1; } return FALSE; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/osdep.h0000644000000000000000000002167413614532331016511 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _OSDEP_H_ #define _OSDEP_H_ 1 #define BUFSIZE 4096 #define BUFWATERMARK 8192 #ifndef MAXBUFSIZE #define MAXBUFSIZE (1 << 22) #endif #include #ifndef X_NOT_POSIX #ifdef _POSIX_SOURCE #include #else #define _POSIX_SOURCE #include #undef _POSIX_SOURCE #endif #else /* X_NOT_POSIX */ #endif /* X_NOT_POSIX */ #ifndef OPEN_MAX #ifdef SVR4 #define OPEN_MAX 256 #else #include #ifndef OPEN_MAX #if defined(NOFILE) && !defined(NOFILES_MAX) #define OPEN_MAX NOFILE #else #define OPEN_MAX NOFILES_MAX #endif #endif #endif #endif #include /* * MAXSOCKS is used only for initialising MaxClients when no other method * like sysconf(_SC_OPEN_MAX) is not supported. */ #if OPEN_MAX <= 256 #define MAXSOCKS (OPEN_MAX - 1) #else #define MAXSOCKS 256 #endif /* MAXSELECT is the number of fds that select() can handle */ #define MAXSELECT (sizeof(fd_set) * NBBY) #ifndef HAS_GETDTABLESIZE #if !defined(SVR4) && !defined(SYSV) #define HAS_GETDTABLESIZE #endif #endif #include typedef Bool (*ValidatorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type); typedef Bool (*GeneratorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type); typedef Bool (*AddAuthorFunc)(unsigned name_length, char *name, unsigned data_length, char *data); typedef struct _connectionInput { struct _connectionInput *next; char *buffer; /* contains current client input */ char *bufptr; /* pointer to current start of data */ int bufcnt; /* count of bytes in buffer */ int lenLastReq; int size; unsigned int ignoreBytes; /* bytes to ignore before the next request */ } ConnectionInput, *ConnectionInputPtr; typedef struct _connectionOutput { struct _connectionOutput *next; int size; unsigned char *buf; int count; } ConnectionOutput, *ConnectionOutputPtr; struct _osComm; #define AuthInitArgs void typedef void (*AuthInitFunc) (AuthInitArgs); #define AuthAddCArgs unsigned short data_length, char *data, XID id typedef int (*AuthAddCFunc) (AuthAddCArgs); #define AuthCheckArgs unsigned short data_length, char *data, ClientPtr client, char **reason typedef XID (*AuthCheckFunc) (AuthCheckArgs); #define AuthFromIDArgs XID id, unsigned short *data_lenp, char **datap typedef int (*AuthFromIDFunc) (AuthFromIDArgs); #define AuthGenCArgs unsigned data_length, char *data, XID id, unsigned *data_length_return, char **data_return typedef XID (*AuthGenCFunc) (AuthGenCArgs); #define AuthRemCArgs unsigned short data_length, char *data typedef int (*AuthRemCFunc) (AuthRemCArgs); #define AuthRstCArgs void typedef int (*AuthRstCFunc) (AuthRstCArgs); #define AuthToIDArgs unsigned short data_length, char *data typedef XID (*AuthToIDFunc) (AuthToIDArgs); typedef void (*OsCloseFunc)(ClientPtr); typedef int (*OsFlushFunc)(ClientPtr who, struct _osComm * oc, char* extraBuf, int extraCount); typedef struct _osComm { int fd; ConnectionInputPtr input; ConnectionOutputPtr output; XID auth_id; /* authorization id */ CARD32 conn_time; /* timestamp if not established, else 0 */ struct _XtransConnInfo *trans_conn; /* transport connection object */ } OsCommRec, *OsCommPtr; extern int FlushClient( ClientPtr /*who*/, OsCommPtr /*oc*/, const void * /*__extraBuf*/, int /*extraCount*/ ); extern void FreeOsBuffers( OsCommPtr /*oc*/ ); extern void InitNotifyFds(void); extern void HandleNotifyFds(void); #include "dix.h" extern ConnectionInputPtr AllocateInputBuffer(void); extern ConnectionOutputPtr AllocateOutputBuffer(void); extern fd_set AllSockets; extern fd_set AllClients; extern fd_set LastSelectMask; extern fd_set LastSelectWriteMask; extern fd_set WellKnownConnections; extern fd_set EnabledDevices; extern fd_set NotifyReadFds; extern fd_set NotifyWriteFds; extern fd_set ClientsWithInput; extern fd_set ClientsWriteBlocked; extern fd_set OutputPending; extern fd_set IgnoredClientsWithInput; extern int *ConnectionTranslation; extern Bool NewOutputPending; extern Bool AnyWritesPending; extern Bool NumNotifyWriteFd; extern Bool CriticalOutputPending; extern int timesThisConnection; extern ConnectionInputPtr FreeInputs; extern ConnectionOutputPtr FreeOutputs; extern OsCommPtr AvailableInput; extern WorkQueuePtr workQueue; /* added by raphael */ #define ffs mffs extern int mffs(fd_mask); /* in access.c */ extern Bool ComputeLocalClient(ClientPtr client); /* in auth.c */ extern void GenerateRandomData (int len, char *buf); /* in mitauth.c */ extern XID MitCheckCookie (AuthCheckArgs); extern XID MitGenerateCookie (AuthGenCArgs); extern XID MitToID (AuthToIDArgs); extern int MitAddCookie (AuthAddCArgs); extern int MitFromID (AuthFromIDArgs); extern int MitRemoveCookie (AuthRemCArgs); extern int MitResetCookie (AuthRstCArgs); /* in xdmauth.c */ #ifdef HASXDMAUTH extern XID XdmCheckCookie (AuthCheckArgs); extern XID XdmToID (AuthToIDArgs); extern int XdmAddCookie (AuthAddCArgs); extern int XdmFromID (AuthFromIDArgs); extern int XdmRemoveCookie (AuthRemCArgs); extern int XdmResetCookie (AuthRstCArgs); #endif /* in rpcauth.c */ #ifdef SECURE_RPC extern void SecureRPCInit (AuthInitArgs); extern XID SecureRPCCheck (AuthCheckArgs); extern XID SecureRPCToID (AuthToIDArgs); extern int SecureRPCAdd (AuthAddCArgs); extern int SecureRPCFromID (AuthFromIDArgs); extern int SecureRPCRemove (AuthRemCArgs); extern int SecureRPCReset (AuthRstCArgs); #endif /* in secauth.c */ extern XID AuthSecurityCheck (AuthCheckArgs); /* in xdmcp.c */ extern void XdmcpUseMsg (void); extern int XdmcpOptions(int argc, char **argv, int i); extern void XdmcpSetAuthentication (ARRAY8Ptr name); extern void XdmcpRegisterConnection ( int type, char *address, int addrlen); extern void XdmcpRegisterAuthorizations (void); extern void XdmcpRegisterAuthorization (char *name, int namelen); extern void XdmcpRegisterDisplayClass (char *name, int length); extern void XdmcpInit (void); extern void XdmcpReset (void); extern void XdmcpOpenDisplay(int sock); extern void XdmcpCloseDisplay(int sock); extern void XdmcpRegisterAuthentication ( char *name, int namelen, char *data, int datalen, ValidatorFunc Validator, GeneratorFunc Generator, AddAuthorFunc AddAuth); extern int XdmcpCheckAuthentication (ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type); extern int XdmcpAddAuthorization (ARRAY8Ptr name, ARRAY8Ptr data); struct sockaddr_in; extern void XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr); #ifdef HASXDMAUTH extern void XdmAuthenticationInit (char *cookie, int cookie_length); #endif #endif /* _OSDEP_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/osinit.c0000644000000000000000000001314013614532331016664 0ustar /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "os.h" #include "osdep.h" #include #include "dixstruct.h" #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN #else #define PATH_MAX 1024 #endif #endif #if !defined(SYSV) #include #endif #ifndef ADMPATH #define ADMPATH "/usr/adm/X%smsgs" #endif extern char *display; #ifdef RLIMIT_DATA int limitDataSpace = -1; #endif #ifdef RLIMIT_STACK int limitStackSpace = -1; #endif #ifdef RLIMIT_NOFILE int limitNoFile = -1; #endif void OsInit(void) { static Bool been_here = FALSE; static char* admpath = ADMPATH; static char* devnull = "/dev/null"; char fname[PATH_MAX]; #ifdef macII set42sig(); #endif if (!been_here) { InitNotifyFds(); #if !defined(__CYGWIN__) fclose(stdin); fclose(stdout); #endif /* * If a write of zero bytes to stderr returns non-zero, i.e. -1, * then writing to stderr failed, and we'll write somewhere else * instead. (Apparently this never happens in the Real World.) */ if (write (2, fname, 0) == -1) { FILE *err; if (strlen (display) + strlen (admpath) + 1 < sizeof fname) sprintf (fname, admpath, display); else strcpy (fname, devnull); /* * uses stdio to avoid os dependencies here, * a real os would use * open (fname, O_WRONLY|O_APPEND|O_CREAT, 0666) */ if (!(err = fopen (fname, "a+"))) err = fopen (devnull, "w"); if (err && (fileno(err) != 2)) { dup2 (fileno (err), 2); fclose (err); } #if defined(SYSV) || defined(SVR4) || defined(__CYGWIN__) { static char buf[BUFSIZ]; setvbuf (stderr, buf, _IOLBF, BUFSIZ); } #else setlinebuf(stderr); #endif } #ifndef X_NOT_POSIX if (getpgrp () == 0) setpgid (0, 0); #else #if !defined(SYSV) if (getpgrp (0) == 0) setpgrp (0, getpid ()); #endif #endif #ifdef RLIMIT_DATA if (limitDataSpace >= 0) { struct rlimit rlim; if (!getrlimit(RLIMIT_DATA, &rlim)) { if ((limitDataSpace > 0) && (limitDataSpace < rlim.rlim_max)) rlim.rlim_cur = limitDataSpace; else rlim.rlim_cur = rlim.rlim_max; (void)setrlimit(RLIMIT_DATA, &rlim); } } #endif #ifdef RLIMIT_STACK if (limitStackSpace >= 0) { struct rlimit rlim; if (!getrlimit(RLIMIT_STACK, &rlim)) { if ((limitStackSpace > 0) && (limitStackSpace < rlim.rlim_max)) rlim.rlim_cur = limitStackSpace; else rlim.rlim_cur = rlim.rlim_max; (void)setrlimit(RLIMIT_STACK, &rlim); } } #endif #ifdef RLIMIT_NOFILE if (limitNoFile >= 0) { struct rlimit rlim; if (!getrlimit(RLIMIT_NOFILE, &rlim)) { if ((limitNoFile > 0) && (limitNoFile < rlim.rlim_max)) rlim.rlim_cur = limitNoFile; else rlim.rlim_cur = rlim.rlim_max; #if 0 if (rlim.rlim_cur > MAXSOCKS) rlim.rlim_cur = MAXSOCKS; #endif (void)setrlimit(RLIMIT_NOFILE, &rlim); } } #endif #ifdef SERVER_LOCK LockServer(); #endif been_here = TRUE; } TimerInit(); #ifdef DDXOSINIT OsVendorInit(); #endif /* * No log file by default. OsVendorInit() should call LogInit() with the * log file name if logging to a file is desired. */ LogInit(NULL, NULL); SmartScheduleInit(); OsInitAllocator(); } void OsCleanup(Bool terminating) { #ifdef SERVER_LOCK if (terminating) { UnlockServer(); } #endif } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/reallocarray.c0000644000000000000000000000263113614532331020042 0ustar /* $OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $ */ /* * Copyright (c) 2008 Otto Moerbeek * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include "os.h" /* * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW */ #define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4)) void * reallocarray(void *optr, size_t nmemb, size_t size) { if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && nmemb > 0 && SIZE_MAX / nmemb < size) { errno = ENOMEM; return NULL; } return realloc(optr, size * nmemb); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/rpcauth.c0000644000000000000000000001154613614532331017035 0ustar /* Copyright 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * SUN-DES-1 authentication mechanism * Author: Mayank Choudhary, Sun Microsystems */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifdef SECURE_RPC #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include #ifdef sun /* only includes this if _KERNEL is #defined... */ extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *); #endif #ifdef ultrix #include #include #endif static enum auth_stat why; static char * authdes_ezdecode(char *inmsg, int len) { struct rpc_msg msg; char cred_area[MAX_AUTH_BYTES]; char verf_area[MAX_AUTH_BYTES]; char *temp_inmsg; struct svc_req r; bool_t res0, res1; XDR xdr; SVCXPRT xprt; temp_inmsg = (char *) malloc(len); if (temp_inmsg == NULL) { why = AUTH_FAILED; /* generic error, since there is no AUTH_BADALLOC */ return NULL; } memmove(temp_inmsg, inmsg, len); memset((char *)&msg, 0, sizeof(msg)); memset((char *)&r, 0, sizeof(r)); memset(cred_area, 0, sizeof(cred_area)); memset(verf_area, 0, sizeof(verf_area)); msg.rm_call.cb_cred.oa_base = cred_area; msg.rm_call.cb_verf.oa_base = verf_area; why = AUTH_FAILED; xdrmem_create(&xdr, temp_inmsg, len, XDR_DECODE); if ((r.rq_clntcred = (caddr_t) malloc(MAX_AUTH_BYTES)) == NULL) goto bad1; r.rq_xprt = &xprt; /* decode into msg */ res0 = xdr_opaque_auth(&xdr, &(msg.rm_call.cb_cred)); res1 = xdr_opaque_auth(&xdr, &(msg.rm_call.cb_verf)); if ( ! (res0 && res1) ) goto bad2; /* do the authentication */ r.rq_cred = msg.rm_call.cb_cred; /* read by opaque stuff */ if (r.rq_cred.oa_flavor != AUTH_DES) { why = AUTH_TOOWEAK; goto bad2; } #ifdef SVR4 if ((why = __authenticate(&r, &msg)) != AUTH_OK) { #else if ((why = _authenticate(&r, &msg)) != AUTH_OK) { #endif goto bad2; } return (((struct authdes_cred *) r.rq_clntcred)->adc_fullname.name); bad2: free(r.rq_clntcred); bad1: return ((char *)0); /* ((struct authdes_cred *) NULL); */ } static XID rpc_id = (XID) ~0L; static Bool CheckNetName ( unsigned char *addr, short len, void * closure ) { return (len == strlen ((char *) closure) && strncmp ((char *) addr, (char *) closure, len) == 0); } static char rpc_error[MAXNETNAMELEN+50]; XID SecureRPCCheck (unsigned short data_length, char *data, ClientPtr client, char **reason) { char *fullname; if (rpc_id == (XID) ~0L) { *reason = "Secure RPC authorization not initialized"; } else { fullname = authdes_ezdecode(data, data_length); if (fullname == (char *)0) { sprintf(rpc_error, "Unable to authenticate secure RPC client (why=%d)", why); *reason = rpc_error; } else { if (ForEachHostInFamily (FamilyNetname, CheckNetName, fullname)) return rpc_id; sprintf(rpc_error, "Principal \"%s\" is not authorized to connect", fullname); *reason = rpc_error; } } return (XID) ~0L; } void SecureRPCInit (void) { if (rpc_id == ~0L) AddAuthorization (9, "SUN-DES-1", 0, (char *) 0); } int SecureRPCAdd (unsigned short data_length, char *data, XID id) { if (data_length) AddHost ((void *) 0, FamilyNetname, data_length, data); rpc_id = id; return 1; } int SecureRPCReset (void) { rpc_id = (XID) ~0L; return 1; } XID SecureRPCToID (unsigned short data_length, char *data) { return rpc_id; } int SecureRPCFromID (XID id, unsigned short *data_lenp, char **datap) { return 0; } int SecureRPCRemove (unsigned short data_length, char *data) { return 0; } #endif /* SECURE_RPC */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/secauth.c0000644000000000000000000001145013614532331017015 0ustar /* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "os.h" #include "osdep.h" #include "dixstruct.h" #include "swaprep.h" #ifdef XCSECURITY #define _SECURITY_SERVER #include #endif static char InvalidPolicyReason[] = "invalid policy specification"; static char PolicyViolationReason[] = "policy violation"; static Bool AuthCheckSitePolicy( unsigned short *data_lengthP, char **dataP, ClientPtr client, char **reason) { CARD8 *policy = *(CARD8 **)dataP; int length; Bool permit; int nPolicies; char **sitePolicies; int nSitePolicies; Bool found = FALSE; if ((length = *data_lengthP) < 2) { *reason = InvalidPolicyReason; return FALSE; } permit = (*policy++ == 0); nPolicies = (CARD8) *policy++; length -= 2; sitePolicies = SecurityGetSitePolicyStrings(&nSitePolicies); while (nPolicies) { int strLen, sitePolicy; if (length == 0) { *reason = InvalidPolicyReason; return FALSE; } strLen = (CARD8) *policy++; if (--length < strLen) { *reason = InvalidPolicyReason; return FALSE; } if (!found) { for (sitePolicy = 0; sitePolicy < nSitePolicies; sitePolicy++) { char *testPolicy = sitePolicies[sitePolicy]; if ((strLen == strlen(testPolicy)) && (strncmp((char *)policy, testPolicy, strLen) == 0)) { found = TRUE; /* need to continue parsing the policy... */ break; } } } policy += strLen; length -= strLen; nPolicies--; } if (found != permit) { *reason = PolicyViolationReason; return FALSE; } *data_lengthP = length; *dataP = (char *)policy; return TRUE; } XID AuthSecurityCheck ( unsigned short data_length, char *data, ClientPtr client, char **reason) { #ifdef XCSECURITY xConnSetupPrefix csp; xReq freq; if (client->clientState == ClientStateCheckedSecurity) { *reason = "repeated security check not permitted"; return (XID) -1; } else if (data_length > 0) { char policy_mask = *data++; if (--data_length == 1) { *reason = InvalidPolicyReason; return (XID) -1; } if (policy_mask & 0x01) /* Extensions policy */ { /* AuthCheckExtensionPolicy(&data_length, &data, client, reason) */ *reason = "security policy not implemented"; return (XID) -1; } if (policy_mask & 0x02) /* Site policy */ { if (!AuthCheckSitePolicy(&data_length, &data, client, reason)) return (XID) -1; } if (data_length > 0) { /* did we consume the whole policy? */ *reason = InvalidPolicyReason; return (XID) -1; } } else if (!GetAccessControl()) { /* * The client - possibly the X FireWall Proxy - gave * no auth data and host-based authorization is turned * off. In this case, the client should be denied * access to the X server. */ *reason = "server host access control is disabled"; return (XID) -1; } client->clientState = ClientStateCheckingSecurity; csp.success = 2 /* Authenticate */; csp.lengthReason = 0; csp.length = 0; csp.majorVersion = X_PROTOCOL; csp.minorVersion = X_PROTOCOL_REVISION; if (client->swapped) WriteSConnSetupPrefix(client, &csp); else WriteToClient(client, sz_xConnSetupPrefix, &csp); /* * Next time the client sends the real auth data, we want * ProcEstablishConnection to be called. */ freq.reqType = 1; freq.length = (sz_xReq + sz_xConnClientPrefix) >> 2; client->swapped = FALSE; if (!InsertFakeRequest(client, (char *)&freq, sz_xReq)) { *reason = "internal error"; return (XID) -1; } return (XID) 0; #else *reason = "method not supported"; return (XID) -1; #endif } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/strlcat.c0000644000000000000000000000325713614532331017043 0ustar /* * Copyright (c) 1998 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include /* * Appends src to string dst of size siz (unlike strncat, siz is the * full size of dst, not space left). At most siz-1 characters * will be copied. Always NUL terminates (unless siz <= strlen(dst)). * Returns strlen(src) + MIN(siz, strlen(initial dst)). * If retval >= siz, truncation occurred. */ size_t strlcat(char *dst, const char *src, size_t siz) { register char *d = dst; register const char *s = src; register size_t n = siz; size_t dlen; /* Find the end of dst and adjust bytes left but don't go past end */ while (n-- != 0 && *d != '\0') d++; dlen = d - dst; n = siz - dlen; if (n == 0) return(dlen + strlen(s)); while (*s != '\0') { if (n != 1) { *d++ = *s; n--; } s++; } *d = '\0'; return(dlen + (s - src)); /* count does not include NUL */ } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/strlcpy.c0000644000000000000000000000310013614532331017052 0ustar /* * Copyright (c) 1998 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_XORG_CONFIG_H #include #endif #include #include /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). * Returns strlen(src); if retval >= siz, truncation occurred. */ size_t strlcpy(char *dst, const char *src, size_t siz) { register char *d = dst; register const char *s = src; register size_t n = siz; /* Copy as many bytes as will fit */ if (n != 0 && --n != 0) { do { if ((*d++ = *s++) == 0) break; } while (--n != 0); } /* Not enough room in dst, add NUL and traverse rest of src */ if (n == 0) { if (siz != 0) *d = '\0'; /* NUL-terminate dst */ while (*s++) ; } return(s - src - 1); /* count does not include NUL */ } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/timingsafe_memcmp.c0000644000000000000000000000310013614532331021036 0ustar /* * Copyright (c) 2014 Google Inc. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #include #include #include "os.h" int timingsafe_memcmp(const void *b1, const void *b2, size_t len) { const unsigned char *p1 = b1, *p2 = b2; size_t i; int res = 0, done = 0; for (i = 0; i < len; i++) { /* lt is -1 if p1[i] < p2[i]; else 0. */ int lt = (p1[i] - p2[i]) >> CHAR_BIT; /* gt is -1 if p1[i] > p2[i]; else 0. */ int gt = (p2[i] - p1[i]) >> CHAR_BIT; /* cmp is 1 if p1[i] > p2[i]; -1 if p1[i] < p2[i]; else 0. */ int cmp = lt - gt; /* set res = cmp if !done. */ res |= cmp & ~done; /* set done if p1[i] != p2[i]. */ done |= lt | gt; } return (res); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/utils.c0000644000000000000000000014460313614532331016530 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, Copyright 1994 Quarterdeck Office Systems. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital and Quarterdeck not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL AND QUARTERDECK DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifdef __CYGWIN__ #include #include #endif #include #include #include "misc.h" #include #define XSERV_t #define TRANS_SERVER #define TRANS_REOPEN #include #include "input.h" #include "dixfont.h" #ifdef HAS_XFONT2 # include #else # include #endif /* HAS_XFONT2 */ #include "osdep.h" #ifdef X_POSIX_C_SOURCE #define _POSIX_C_SOURCE X_POSIX_C_SOURCE #include #undef _POSIX_C_SOURCE #else #if defined(X_NOT_POSIX) || defined(_POSIX_SOURCE) #include #else #define _POSIX_SOURCE #include #undef _POSIX_SOURCE #endif #endif #include #if !defined(SYSV) #include #endif #include #include #include /* for isspace */ #include #include #include #include #include /* for malloc() */ #if defined(TCPCONN) # include #endif #include "opaque.h" #include "dixstruct.h" #ifdef XKB #include "xkbsrv.h" #endif #ifdef XCSECURITY #define _SECURITY_SERVER #include #endif #ifdef RENDER #include "picture.h" #endif Bool noTestExtensions; #ifdef BIGREQS Bool noBigReqExtension = FALSE; #endif #ifdef COMPOSITE /* COMPOSITE is disabled by default for now until the * interface is stable */ Bool noCompositeExtension = TRUE; #endif #ifdef DAMAGE Bool noDamageExtension = FALSE; #endif #ifdef DBE Bool noDbeExtension = FALSE; #endif #ifdef DPMSExtension Bool noDPMSExtension = FALSE; #endif #ifdef GLXEXT Bool noGlxExtension = FALSE; #endif #ifdef SCREENSAVER Bool noScreenSaverExtension = FALSE; #endif #ifdef MITSHM Bool noMITShmExtension = FALSE; #endif #ifdef RANDR Bool noRRExtension = FALSE; Bool noRRXineramaExtension = FALSE; #endif #ifdef RENDER Bool noRenderExtension = FALSE; #endif #ifdef SHAPE Bool noShapeExtension = FALSE; #endif #ifdef XCSECURITY Bool noSecurityExtension = FALSE; #endif #ifdef XSYNC Bool noSyncExtension = FALSE; #endif #ifdef RES Bool noResExtension = FALSE; #endif #ifdef XCMISC Bool noXCMiscExtension = FALSE; #endif #ifdef XF86BIGFONT Bool noXFree86BigfontExtension = FALSE; #endif #ifdef XF86DRI Bool noXFree86DRIExtension = FALSE; #endif #ifdef XFIXES Bool noXFixesExtension = FALSE; #endif /* |noXkbExtension| is defined in xc/programs/Xserver/xkb/xkbInit.c */ #ifdef PANORAMIX /* Xinerama is disabled by default unless enabled via +xinerama */ Bool noPanoramiXExtension = TRUE; #endif #ifdef XINPUT Bool noXInputExtension = FALSE; #endif #ifdef XIDLE Bool noXIdleExtension = FALSE; #endif #ifdef XV Bool noXvExtension = FALSE; #endif #define X_INCLUDE_NETDB_H #include #include #ifdef NX_TRANS_SOCKET #include #include #endif #ifdef NX_TRANS_EXIT void (*OsVendorStartRedirectErrorFProc)() = NULL; void (*OsVendorEndRedirectErrorFProc)() = NULL; #endif Bool CoreDump; #ifdef PANORAMIX Bool PanoramiXVisibilityNotifySent = FALSE; Bool PanoramiXMapped = FALSE; Bool PanoramiXWindowExposureSent = FALSE; Bool PanoramiXOneExposeRequest = FALSE; Bool PanoramiXExtensionDisabledHack = FALSE; #endif int auditTrailLevel = 1; #if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED) #define HAS_SAVED_IDS_AND_SETEUID #endif #ifdef MEMBUG #define MEM_FAIL_SCALE 100000 long Memory_fail = 0; #include /* for random() */ #endif #ifndef NXAGENT_SERVER char *dev_tty_from_init = NULL; /* since we need to parse it anyway */ #endif #ifdef NXAGENT_SERVER extern const char *nxagentProgName; #endif #ifdef NX_TRANS_SOCKET extern char **environ; #endif extern char dispatchExceptionAtReset; /* Extension enable/disable in miinitext.c */ extern Bool EnableDisableExtension(char *name, Bool enable); extern void EnableDisableExtensionError(char *name, Bool enable); OsSigHandlerPtr OsSignal(sig, handler) int sig; OsSigHandlerPtr handler; { #ifdef X_NOT_POSIX return signal(sig, handler); #else struct sigaction act, oact; sigemptyset(&act.sa_mask); if (handler != SIG_IGN) sigaddset(&act.sa_mask, sig); act.sa_flags = 0; act.sa_handler = handler; if (sigaction(sig, &act, &oact)) perror("sigaction"); return oact.sa_handler; #endif } #ifdef SERVER_LOCK /* * Explicit support for a server lock file like the ones used for UUCP. * For architectures with virtual terminals that can run more than one * server at a time. This keeps the servers from stomping on each other * if the user forgets to give them different display numbers. */ #define LOCK_DIR "/tmp" #define LOCK_TMP_PREFIX "/.tX" #define LOCK_PREFIX "/.X" #define LOCK_SUFFIX "-lock" #ifndef PATH_MAX #include #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN #else #define PATH_MAX 1024 #endif #endif #endif static Bool StillLocking = FALSE; static char LockFile[PATH_MAX]; static Bool nolock = FALSE; /* * LockServer -- * Check if the server lock file exists. If so, check if the PID * contained inside is valid. If so, then die. Otherwise, create * the lock file containing the PID. */ void LockServer(void) { char tmp[PATH_MAX], pid_str[12]; int lfd, i, haslock, l_pid, t; char *tmppath = NULL; int len; char port[20]; if (nolock || NoListenAll) return; /* * Path names */ tmppath = LOCK_DIR; sprintf(port, "%d", atoi(display)); len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) : strlen(LOCK_TMP_PREFIX); len += strlen(tmppath) + strlen(port) + strlen(LOCK_SUFFIX) + 1; if (len > sizeof(LockFile)) FatalError("Display name `%s' is too long\n", port); (void)sprintf(tmp, "%s" LOCK_TMP_PREFIX "%s" LOCK_SUFFIX, tmppath, port); (void)sprintf(LockFile, "%s" LOCK_PREFIX "%s" LOCK_SUFFIX, tmppath, port); /* * Create a temporary file containing our PID. Attempt three times * to create the file. */ StillLocking = TRUE; i = 0; do { i++; lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644); if (lfd < 0) sleep(2); else break; } while (i < 3); if (lfd < 0) { unlink(tmp); i = 0; do { i++; lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644); if (lfd < 0) sleep(2); else break; } while (i < 3); } if (lfd < 0) FatalError("Could not create lock file in %s\n", tmp); (void) sprintf(pid_str, "%10ld\n", (long)getpid()); if (write(lfd, pid_str, 11) != 11) FatalError("Could not write pid to lock file in %s\n", tmp); #ifndef USE_CHMOD (void) fchmod(lfd, 0444); #else (void) chmod(tmp, 0444); #endif (void) close(lfd); /* * OK. Now the tmp file exists. Try three times to move it in place * for the lock. */ i = 0; haslock = 0; while ((!haslock) && (i++ < 3)) { haslock = (link(tmp,LockFile) == 0); if (haslock) { /* * We're done. */ break; } else { /* * Read the pid from the existing file */ lfd = open(LockFile, O_RDONLY|O_NOFOLLOW); if (lfd < 0) { unlink(tmp); FatalError("Can't read lock file %s\n", LockFile); } pid_str[0] = '\0'; if (read(lfd, pid_str, 11) != 11) { /* * Bogus lock file. */ unlink(LockFile); close(lfd); continue; } pid_str[11] = '\0'; sscanf(pid_str, "%d", &l_pid); close(lfd); /* * Now try to kill the PID to see if it exists. */ errno = 0; t = kill(l_pid, 0); if ((t< 0) && (errno == ESRCH)) { /* * Stale lock file. */ unlink(LockFile); continue; } else if (((t < 0) && (errno == EPERM)) || (t == 0)) { /* * Process is still active. */ unlink(tmp); FatalError("Server is already active for display %s\n%s %s\n%s\n", port, "\tIf this server is no longer running, remove", LockFile, "\tand start again."); } } } unlink(tmp); if (!haslock) FatalError("Could not create server lock file: %s\n", LockFile); StillLocking = FALSE; } /* * UnlockServer -- * Remove the server lock file. */ void UnlockServer(void) { if (nolock || NoListenAll) return; if (!StillLocking){ (void) unlink(LockFile); } } #endif /* SERVER_LOCK */ /* Force connections to close on SIGHUP from init */ /*ARGSUSED*/ SIGVAL AutoResetServer (int sig) { int olderrno = errno; dispatchException |= DE_RESET; isItTimeToYield = TRUE; #ifdef GPROF chdir ("/tmp"); exit (0); #endif #if defined(SYSV) && defined(X_NOT_POSIX) OsSignal (SIGHUP, AutoResetServer); #endif errno = olderrno; } /* Force connections to close and then exit on SIGTERM, SIGINT */ /*ARGSUSED*/ SIGVAL GiveUp(int sig) { int olderrno = errno; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) fprintf(stderr, "GiveUp: Called with signal [%d].\n", sig); #endif dispatchException |= DE_TERMINATE; isItTimeToYield = TRUE; #if defined(SYSV) && defined(X_NOT_POSIX) if (sig) OsSignal(sig, SIG_IGN); #endif errno = olderrno; } #ifndef DDXTIME CARD32 GetTimeInMillis(void) { struct timeval tp; X_GETTIMEOFDAY(&tp); return(tp.tv_sec * 1000) + (tp.tv_usec / 1000); } #endif void AdjustWaitForDelay (void * waitTime, unsigned long newdelay) { static struct timeval delay_val; struct timeval **wt = (struct timeval **) waitTime; unsigned long olddelay; if (*wt == NULL) { delay_val.tv_sec = newdelay / 1000; delay_val.tv_usec = 1000 * (newdelay % 1000); *wt = &delay_val; } else { olddelay = (*wt)->tv_sec * 1000 + (*wt)->tv_usec / 1000; if (newdelay < olddelay) { (*wt)->tv_sec = newdelay / 1000; (*wt)->tv_usec = 1000 * (newdelay % 1000); } } } void UseMsg(void) { #ifdef NXAGENT_SERVER ErrorF("Usage: %s [] [:]\n\n", nxagentProgName); #else ErrorF("use: X [:] [option]\n"); #endif ErrorF("-a # mouse acceleration (pixels)\n"); ErrorF("-ac disable access control restrictions\n"); #ifdef MEMBUG ErrorF("-alloc int chance alloc should fail\n"); #endif ErrorF("-audit int set audit trail level\n"); ErrorF("-auth file select authorization file\n"); ErrorF("bc enable bug compatibility\n"); ErrorF("-br create root window with black background\n"); ErrorF("+bs enable any backing store support\n"); ErrorF("-bs disable any backing store support\n"); ErrorF("-c turns off key-click\n"); ErrorF("c # key-click volume (0-100)\n"); ErrorF("-cc int default color visual class\n"); #ifdef NXAGENT_SERVER ErrorF("-co file deprecated, has no effect\n"); #endif #ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS ErrorF("-config file read options from file\n"); #endif ErrorF("-core generate core dump on fatal error\n"); ErrorF("-dpi int screen resolution in dots per inch\n"); #ifdef DPMSExtension ErrorF("dpms enables VESA DPMS monitor control\n"); ErrorF("-dpms disables VESA DPMS monitor control\n"); #endif ErrorF("-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs\n"); ErrorF("-f # bell base (0-100)\n"); ErrorF("-fc string cursor font\n"); ErrorF("-fn string default font name\n"); ErrorF("-fp string default font path\n"); ErrorF("-help prints message with these options\n"); ErrorF("-I ignore all remaining arguments\n"); #ifdef RLIMIT_DATA ErrorF("-ld int limit data space to N Kb\n"); #endif #ifdef RLIMIT_NOFILE ErrorF("-lf int limit number of open files to N\n"); #endif #ifdef RLIMIT_STACK ErrorF("-ls int limit stack space to N Kb\n"); #endif #ifdef SERVER_LOCK ErrorF("-nolock disable the locking mechanism\n"); #endif #ifndef NOLOGOHACK ErrorF("-logo enable logo in screen saver\n"); ErrorF("nologo disable logo in screen saver\n"); #endif ErrorF("-nolisten string don't listen on protocol\n"); ErrorF("-noreset don't reset after last client exists\n"); ErrorF("-reset reset after last client exists\n"); ErrorF("-p # screen-saver pattern duration (minutes)\n"); ErrorF("-pn accept failure to listen on all ports\n"); ErrorF("-nopn reject failure to listen on all ports\n"); ErrorF("-r turns off auto-repeat\n"); ErrorF("r turns on auto-repeat \n"); #ifdef RENDER ErrorF("-render [default|mono|gray|color] set render color alloc policy\n"); #endif ErrorF("-s # screen-saver timeout (minutes)\n"); #ifdef XCSECURITY ErrorF("-sp file security policy file\n"); #endif ErrorF("-su disable any save under support\n"); ErrorF("-t # mouse threshold (pixels)\n"); ErrorF("-terminate terminate at server reset\n"); ErrorF("-to # connection time out\n"); ErrorF("-tst disable testing extensions\n"); #ifndef NXAGENT_SERVER ErrorF("ttyxx server started from init on /dev/ttyxx\n"); #endif ErrorF("v video blanking for screen-saver\n"); ErrorF("-v screen-saver without video blanking\n"); ErrorF("-wm WhenMapped default backing-store\n"); ErrorF("-wr create root window with white background\n"); ErrorF("-maxbigreqsize set maximal bigrequest size \n"); #ifdef PANORAMIX ErrorF("+xinerama Enable XINERAMA (PanoramiX) extension\n"); ErrorF("-xinerama Disable XINERAMA (PanoramiX) extension (default)\n"); ErrorF("-disablexineramaextension Disable XINERAMA extension\n"); #endif #ifdef RANDR ErrorF("+rrxinerama Enable XINERAMA (via RandR) extension (default)\n"); ErrorF("-rrxinerama Disable XINERAMA (via RandR) extension\n"); #endif ErrorF("-dumbSched Disable smart scheduling, enable old behavior\n"); ErrorF("-schedInterval int Set scheduler interval in msec\n"); ErrorF("+extension name Enable extension\n"); ErrorF("-extension name Disable extension\n"); #ifdef XDMCP XdmcpUseMsg(); #endif #ifdef XKB XkbUseMsg(); #endif ddxUseMsg(); } /* This function performs a rudimentary sanity check * on the display name passed in on the command-line, * since this string is used to generate filenames. * It is especially important that the display name * not contain a "/" and not start with a "-". * --kvajk */ static int VerifyDisplayName(const char *d) { if ( d == (char *)0 ) return( 0 ); /* null */ if ( *d == '\0' ) return( 0 ); /* empty */ if ( *d == '-' ) return( 0 ); /* could be confused for an option */ if ( *d == '.' ) return( 0 ); /* must not equal "." or ".." */ if ( strchr(d, '/') != (char *)0 ) return( 0 ); /* very important!!! */ return( 1 ); } /* * This function is responsible for doing initalisation of any global * variables at an very early point of server startup (even before * |ProcessCommandLine()|. */ void InitGlobals(void) { ddxInitGlobals(); } /* * This function parses the command line. Handles device-independent fields * and allows ddx to handle additional fields. It is not allowed to modify * argc or any of the strings pointed to by argv. */ void ProcessCommandLine(int argc, char *argv[]) { int i, skip; defaultKeyboardControl.autoRepeat = TRUE; #ifdef NO_PART_NET PartialNetwork = FALSE; #else PartialNetwork = TRUE; #endif for ( i = 1; i < argc; i++ ) { /* call ddx first, so it can peek/override if it wants */ if((skip = ddxProcessArgument(argc, argv, i))) { i += (skip - 1); } else if(argv[i][0] == ':') { /* initialize display */ display = argv[i]; explicit_display = TRUE; display++; if( ! VerifyDisplayName( display ) ) { ErrorF("Bad display name: %s\n", display); UseMsg(); FatalError("Bad display name, exiting: %s\n", display); } } else if ( strcmp( argv[i], "-a") == 0) { if(++i < argc) defaultPointerControl.num = atoi(argv[i]); else UseMsg(); } else if ( strcmp( argv[i], "-ac") == 0) { defeatAccessControl = TRUE; } #ifdef MEMBUG else if ( strcmp( argv[i], "-alloc") == 0) { if(++i < argc) Memory_fail = atoi(argv[i]); else UseMsg(); } #endif else if ( strcmp( argv[i], "-audit") == 0) { if(++i < argc) auditTrailLevel = atoi(argv[i]); else UseMsg(); } else if ( strcmp( argv[i], "-auth") == 0) { if(++i < argc) InitAuthorization (argv[i]); else UseMsg(); } else if ( strcmp( argv[i], "-br") == 0) blackRoot = TRUE; else if ( strcmp( argv[i], "+bs") == 0) enableBackingStore = TRUE; else if ( strcmp( argv[i], "-bs") == 0) disableBackingStore = TRUE; else if ( strcmp( argv[i], "c") == 0) { if(++i < argc) defaultKeyboardControl.click = atoi(argv[i]); else UseMsg(); } else if ( strcmp( argv[i], "-c") == 0) { defaultKeyboardControl.click = 0; } else if ( strcmp( argv[i], "-cc") == 0) { if(++i < argc) defaultColorVisualClass = atoi(argv[i]); else UseMsg(); } #ifdef NXAGENT_SERVER else if ( strcmp( argv[i], "-co") == 0) { fprintf(stderr, "Warning: Ignoring deprecated command line option '%s'.\n", argv[i]); if(++i >= argc) UseMsg(); } #endif else if ( strcmp( argv[i], "-core") == 0) CoreDump = TRUE; else if ( strcmp( argv[i], "-dpi") == 0) { if(++i < argc) monitorResolution = atoi(argv[i]); else UseMsg(); } else if (strcmp(argv[i], "-displayfd") == 0) { if (++i < argc) { displayfd = atoi(argv[i]); nolock = TRUE; } else UseMsg(); } #ifdef DPMSExtension else if ( strcmp( argv[i], "dpms") == 0) DPMSEnabledSwitch = TRUE; else if ( strcmp( argv[i], "-dpms") == 0) DPMSDisabledSwitch = TRUE; #endif else if ( strcmp( argv[i], "-deferglyphs") == 0) { #ifdef HAS_XFONT2 if(++i >= argc || !!xfont2_parse_glyph_caching_mode(argv[i])) #else if(++i >= argc || !ParseGlyphCachingMode(argv[i])) #endif /* HAS_XFONT2 */ UseMsg(); } else if ( strcmp( argv[i], "-f") == 0) { if(++i < argc) defaultKeyboardControl.bell = atoi(argv[i]); else UseMsg(); } else if ( strcmp( argv[i], "-fc") == 0) { if(++i < argc) defaultCursorFont = argv[i]; else UseMsg(); } else if ( strcmp( argv[i], "-fn") == 0) { if(++i < argc) defaultTextFont = argv[i]; else UseMsg(); } else if ( strcmp( argv[i], "-fp") == 0) { if(++i < argc) { defaultFontPath = argv[i]; } else UseMsg(); } else if ( strcmp( argv[i], "-help") == 0) { UseMsg(); exit(0); } #ifdef XKB else if ( (skip=XkbProcessArguments(argc,argv,i))!=0 ) { if (skip>0) i+= skip-1; else UseMsg(); } #endif #ifdef RLIMIT_DATA else if ( strcmp( argv[i], "-ld") == 0) { if(++i < argc) { limitDataSpace = atoi(argv[i]); if (limitDataSpace > 0) limitDataSpace *= 1024; } else UseMsg(); } #endif #ifdef RLIMIT_NOFILE else if ( strcmp( argv[i], "-lf") == 0) { if(++i < argc) limitNoFile = atoi(argv[i]); else UseMsg(); } #endif #ifdef RLIMIT_STACK else if ( strcmp( argv[i], "-ls") == 0) { if(++i < argc) { limitStackSpace = atoi(argv[i]); if (limitStackSpace > 0) limitStackSpace *= 1024; } else UseMsg(); } #endif #ifdef SERVER_LOCK else if ( strcmp ( argv[i], "-nolock") == 0) { #if !defined(__CYGWIN__) if (getuid() != 0) ErrorF("Warning: the -nolock option can only be used by root\n"); else #endif nolock = TRUE; } #endif #ifndef NOLOGOHACK else if ( strcmp( argv[i], "-logo") == 0) { logoScreenSaver = 1; } else if ( strcmp( argv[i], "nologo") == 0) { logoScreenSaver = 0; } #endif else if ( strcmp( argv[i], "-nolisten") == 0) { if(++i < argc) { #ifdef NXAGENT_SERVER if (strcmp( argv[i], "ANY" ) == 0) NoListenAll = TRUE; else #endif /* NXAGENT_SERVER */ if (_XSERVTransNoListen(argv[i])) FatalError ("Failed to disable listen for %s transport", argv[i]); } else UseMsg(); } else if ( strcmp( argv[i], "-noreset") == 0) { dispatchExceptionAtReset = 0; } else if ( strcmp( argv[i], "-reset") == 0) { dispatchExceptionAtReset = DE_RESET; } else if ( strcmp( argv[i], "-p") == 0) { if(++i < argc) defaultScreenSaverInterval = ((CARD32)atoi(argv[i])) * MILLI_PER_MIN; else UseMsg(); } else if ( strcmp( argv[i], "-pn") == 0) PartialNetwork = TRUE; else if ( strcmp( argv[i], "-nopn") == 0) PartialNetwork = FALSE; else if ( strcmp( argv[i], "r") == 0) defaultKeyboardControl.autoRepeat = TRUE; else if ( strcmp( argv[i], "-r") == 0) defaultKeyboardControl.autoRepeat = FALSE; else if ( strcmp( argv[i], "-s") == 0) { if(++i < argc) defaultScreenSaverTime = ((CARD32)atoi(argv[i])) * MILLI_PER_MIN; else UseMsg(); } else if ( strcmp( argv[i], "-su") == 0) disableSaveUnders = TRUE; else if ( strcmp( argv[i], "-t") == 0) { if(++i < argc) defaultPointerControl.threshold = atoi(argv[i]); else UseMsg(); } else if ( strcmp( argv[i], "-terminate") == 0) { dispatchExceptionAtReset = DE_TERMINATE; } else if ( strcmp( argv[i], "-to") == 0) { if(++i < argc) TimeOutValue = ((CARD32)atoi(argv[i])) * MILLI_PER_SECOND; else UseMsg(); } else if ( strcmp( argv[i], "-tst") == 0) { noTestExtensions = TRUE; } else if ( strcmp( argv[i], "v") == 0) defaultScreenSaverBlanking = PreferBlanking; else if ( strcmp( argv[i], "-v") == 0) defaultScreenSaverBlanking = DontPreferBlanking; else if ( strcmp( argv[i], "-wm") == 0) defaultBackingStore = WhenMapped; else if ( strcmp( argv[i], "-wr") == 0) whiteRoot = TRUE; else if ( strcmp( argv[i], "-maxbigreqsize") == 0) { if(++i < argc) { long reqSizeArg = atol(argv[i]); /* Request size > 128MB does not make much sense... */ if( reqSizeArg > 0L && reqSizeArg < 128L ) { maxBigRequestSize = (reqSizeArg * 1048576L) - 1L; } else { UseMsg(); } } else { UseMsg(); } } #ifdef PANORAMIX else if ( strcmp( argv[i], "+xinerama") == 0){ noPanoramiXExtension = FALSE; } else if ( strcmp( argv[i], "-xinerama") == 0){ noPanoramiXExtension = TRUE; } else if ( strcmp( argv[i], "-disablexineramaextension") == 0){ PanoramiXExtensionDisabledHack = TRUE; } #endif #ifdef RANDR else if ( strcmp( argv[i], "+rrxinerama") == 0){ noRRXineramaExtension = FALSE; } else if ( strcmp( argv[i], "-rrxinerama") == 0){ noRRXineramaExtension = TRUE; } #endif else if ( strcmp( argv[i], "-I") == 0) { /* ignore all remaining arguments */ break; } #ifndef NXAGENT_SERVER else if (strncmp (argv[i], "tty", 3) == 0) { /* just in case any body is interested */ dev_tty_from_init = argv[i]; } #endif #ifdef XDMCP else if ((skip = XdmcpOptions(argc, argv, i)) != i) { i = skip - 1; } #endif #ifdef XCSECURITY else if ((skip = XSecurityOptions(argc, argv, i)) != i) { i = skip - 1; } #endif #if HAVE_SETITIMER else if ( strcmp( argv[i], "-dumbSched") == 0) { SmartScheduleSignalEnable = FALSE; } #endif else if ( strcmp( argv[i], "-schedInterval") == 0) { if (++i < argc) { SmartScheduleInterval = atoi(argv[i]); SmartScheduleSlice = SmartScheduleInterval; } else UseMsg(); } else if ( strcmp( argv[i], "-schedMax") == 0) { if (++i < argc) { SmartScheduleMaxSlice = atoi(argv[i]); } else UseMsg(); } #ifdef RENDER else if ( strcmp( argv[i], "-render" ) == 0) { if (++i < argc) { int policy = PictureParseCmapPolicy (argv[i]); if (policy != PictureCmapPolicyInvalid) PictureCmapPolicy = policy; else UseMsg (); } else UseMsg (); } #endif else if ( strcmp( argv[i], "+extension") == 0) { if (++i < argc) { if (!EnableDisableExtension(argv[i], TRUE)) EnableDisableExtensionError(argv[i], TRUE); } else UseMsg(); } else if ( strcmp( argv[i], "-extension") == 0) { if (++i < argc) { if (!EnableDisableExtension(argv[i], FALSE)) EnableDisableExtensionError(argv[i], FALSE); } else UseMsg(); } else { ErrorF("Unrecognized option: %s\n", argv[i]); UseMsg(); FatalError("Unrecognized option: %s\n", argv[i]); } } } #ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS static void InsertFileIntoCommandLine( int *resargc, char ***resargv, int prefix_argc, char **prefix_argv, char *filename, int suffix_argc, char **suffix_argv) { struct stat st; FILE *f; char *p; char *q; int insert_argc; char *buf; int len; int i; f = fopen(filename, "r"); if (!f) FatalError("Can't open option file %s\n", filename); fstat(fileno(f), &st); buf = (char *) malloc((unsigned) st.st_size + 1); if (!buf) FatalError("Out of Memory\n"); len = fread(buf, 1, (unsigned) st.st_size, f); fclose(f); if (len < 0) FatalError("Error reading option file %s\n", filename); buf[len] = '\0'; p = buf; q = buf; insert_argc = 0; while (*p) { while (isspace(*p)) p++; if (!*p) break; if (*p == '#') { while (*p && *p != '\n') p++; } else { while (*p && !isspace(*p)) *q++ = *p++; /* Since p and q might still be pointing at the same place, we */ /* need to step p over the whitespace now before we add the null. */ if (*p) p++; *q++ = '\0'; insert_argc++; } } buf = (char *) realloc(buf, q - buf); if (!buf) FatalError("Out of memory reallocing option buf\n"); *resargc = prefix_argc + insert_argc + suffix_argc; *resargv = (char **) malloc((*resargc + 1) * sizeof(char *)); if (!*resargv) FatalError("Out of Memory\n"); memcpy(*resargv, prefix_argv, prefix_argc * sizeof(char *)); p = buf; for (i = 0; i < insert_argc; i++) { (*resargv)[prefix_argc + i] = p; p += strlen(p) + 1; } memcpy(*resargv + prefix_argc + insert_argc, suffix_argv, suffix_argc * sizeof(char *)); (*resargv)[*resargc] = NULL; } /* end InsertFileIntoCommandLine */ void ExpandCommandLine(int *pargc, char ***pargv) { int i; #if !defined(__CYGWIN__) if (getuid() != geteuid()) return; #endif for (i = 1; i < *pargc; i++) { if ( (0 == strcmp((*pargv)[i], "-config")) && (i < (*pargc - 1)) ) { InsertFileIntoCommandLine(pargc, pargv, i, *pargv, (*pargv)[i+1], /* filename */ *pargc - i - 2, *pargv + i + 2); i--; } } } /* end ExpandCommandLine */ #endif /* Implement a simple-minded font authorization scheme. The authorization name is "hp-hostname-1", the contents are simply the host name. */ int set_font_authorizations(char **authorizations, int *authlen, void * client) { #define AUTHORIZATION_NAME "hp-hostname-1" #if defined(TCPCONN) static char *result = NULL; static char *p = NULL; if (p == NULL) { char hname[1024], *hnameptr; unsigned int len; #if defined(IPv6) && defined(AF_INET6) struct addrinfo hints, *ai = NULL; #else struct hostent *host; #ifdef XTHREADS_NEEDS_BYNAMEPARAMS _Xgethostbynameparams hparams; #endif #endif gethostname(hname, 1024); #if defined(IPv6) && defined(AF_INET6) bzero(&hints, sizeof(hints)); hints.ai_flags = AI_CANONNAME; if (getaddrinfo(hname, NULL, &hints, &ai) == 0) { hnameptr = ai->ai_canonname; } else { hnameptr = hname; } #else host = _XGethostbyname(hname, hparams); if (host == NULL) hnameptr = hname; else hnameptr = host->h_name; #endif len = strlen(hnameptr) + 1; result = malloc(len + sizeof(AUTHORIZATION_NAME) + 4); p = result; *p++ = sizeof(AUTHORIZATION_NAME) >> 8; *p++ = sizeof(AUTHORIZATION_NAME) & 0xff; *p++ = (len) >> 8; *p++ = (len & 0xff); memmove(p, AUTHORIZATION_NAME, sizeof(AUTHORIZATION_NAME)); p += sizeof(AUTHORIZATION_NAME); memmove(p, hnameptr, len); p += len; #if defined(IPv6) && defined(AF_INET6) if (ai) { freeaddrinfo(ai); } #endif } *authlen = p - result; *authorizations = result; return 1; #else /* TCPCONN */ return 0; #endif /* TCPCONN */ } /***************** * XNFalloc * "no failure" alloc *****************/ void * XNFalloc(unsigned long amount) { void *ptr = malloc(amount); if (!ptr) { FatalError("Out of memory"); } return ptr; } /***************** * XNFcalloc *****************/ void * XNFcalloc(unsigned long amount) { void *ret = calloc(1, amount); if (!ret) FatalError("XNFcalloc: Out of memory"); return ret; } /***************** * XNFrealloc * "no failure" realloc *****************/ void * XNFrealloc(void * ptr, unsigned long amount) { void *ret = realloc(ptr, amount); if (!ret) FatalError("XNFrealloc: Out of memory"); return ret; } void OsInitAllocator (void) { #ifdef MEMBUG static int been_here; /* Check the memory system after each generation */ if (been_here) CheckMemory (); else been_here = 1; #endif } char * Xstrdup(const char *s) { if (s == NULL) return NULL; return strdup(s); } char * XNFstrdup(const char *s) { char *ret; if (s == NULL) return NULL; ret = strdup(s); if (!ret) FatalError("XNFstrdup: Out of memory"); return ret; } void SmartScheduleStopTimer (void) { #if HAVE_SETITIMER struct itimerval timer; if (!SmartScheduleSignalEnable) return; #ifdef NX_TRANS_TEST fprintf(stderr, "SmartScheduleStopTimer: Stopping timer.\n"); #endif timer.it_interval.tv_sec = 0; timer.it_interval.tv_usec = 0; timer.it_value.tv_sec = 0; timer.it_value.tv_usec = 0; (void) setitimer (ITIMER_REAL, &timer, 0); #endif } void SmartScheduleStartTimer (void) { #if HAVE_SETITIMER struct itimerval timer; if (!SmartScheduleSignalEnable) return; #ifdef NX_TRANS_TEST fprintf(stderr, "SmartScheduleStartTimer: Starting timer with [%ld] ms.\n", SmartScheduleInterval); #endif timer.it_interval.tv_sec = 0; timer.it_interval.tv_usec = SmartScheduleInterval * 1000; timer.it_value.tv_sec = 0; timer.it_value.tv_usec = SmartScheduleInterval * 1000; setitimer (ITIMER_REAL, &timer, 0); #endif } #if HAVE_SETITIMER static void SmartScheduleTimer (int sig) { SmartScheduleTime += SmartScheduleInterval; #ifdef NX_TRANS_TEST fprintf(stderr, "SmartScheduleTimer: Got timer with time [%ld] ms.\n", SmartScheduleTime); #endif } int SmartScheduleEnable (void) { int ret = 0; struct sigaction act; if (!SmartScheduleSignalEnable) return 0; #ifdef NX_TRANS_TEST fprintf(stderr, "SmartScheduleEnable: Enabling the smart scheduler.\n"); #endif memset((char *) &act, 0, sizeof(struct sigaction)); /* Set up the timer signal function */ act.sa_flags = SA_RESTART; act.sa_handler = SmartScheduleTimer; sigemptyset (&act.sa_mask); sigaddset (&act.sa_mask, SIGALRM); ret = sigaction(SIGALRM, &act, 0); return ret; } static int SmartSchedulePause(void) { int ret = 0; struct sigaction act; if (!SmartScheduleSignalEnable) return 0; #ifdef NX_TRANS_TEST fprintf(stderr, "SmartSchedulePause: Pausing the smart scheduler.\n"); #endif memset((char *) &act, 0, sizeof(struct sigaction)); act.sa_handler = SIG_IGN; sigemptyset(&act.sa_mask); ret = sigaction(SIGALRM, &act, 0); return ret; } #endif void SmartScheduleInit(void) { #if HAVE_SETITIMER #ifdef NX_TRANS_TEST fprintf(stderr, "SmartScheduleInit: Initializing the smart scheduler.\n"); #endif if (SmartScheduleEnable() < 0) { perror("sigaction for smart scheduler"); SmartScheduleSignalEnable = FALSE; } #endif } #ifdef SIG_BLOCK static sigset_t PreviousSignalMask; static int BlockedSignalCount; #endif void OsBlockSignals (void) { #ifdef SIG_BLOCK if (BlockedSignalCount++ == 0) { sigset_t set; sigemptyset (&set); #ifdef SIGALRM sigaddset (&set, SIGALRM); #endif #ifdef SIGVTALRM sigaddset (&set, SIGVTALRM); #endif #ifdef SIGWINCH sigaddset (&set, SIGWINCH); #endif #ifdef SIGIO sigaddset (&set, SIGIO); #endif #ifdef SIGTSTP sigaddset (&set, SIGTSTP); #endif #ifdef SIGTTIN sigaddset (&set, SIGTTIN); #endif #ifdef SIGTTOU sigaddset (&set, SIGTTOU); #endif #ifdef SIGCHLD sigaddset (&set, SIGCHLD); #endif sigprocmask (SIG_BLOCK, &set, &PreviousSignalMask); } #endif } void OsReleaseSignals (void) { #ifdef SIG_BLOCK if (--BlockedSignalCount == 0) { sigprocmask (SIG_SETMASK, &PreviousSignalMask, 0); } #endif } /* * "safer" versions of system(3), popen(3) and pclose(3) which give up * all privs before running a command. * * This is based on the code in FreeBSD 2.2 libc. * * XXX It'd be good to redirect stderr so that it ends up in the log file * as well. As it is now, xkbcomp messages don't end up in the log file. */ int System(char *command) { int pid, p; #ifdef SIGCHLD void (*csig)(int); #endif int status; struct passwd *pwent; if (!command) return(1); #ifdef SIGCHLD csig = OsSignal(SIGCHLD, SIG_DFL); if (csig == SIG_ERR) { perror("signal"); return -1; } #endif #ifdef DEBUG ErrorF("System: `%s'\n", command); #endif #ifdef NX_TRANS_EXIT if (OsVendorStartRedirectErrorFProc != NULL) { OsVendorStartRedirectErrorFProc(); } #endif switch (pid = fork()) { case -1: /* error */ p = -1; case 0: /* child */ pwent = getpwuid(getuid()); if (initgroups(pwent->pw_name,getgid()) == -1) _exit(127); if (setgid(getgid()) == -1) _exit(127); if (setuid(getuid()) == -1) _exit(127); execl("/bin/sh", "sh", "-c", command, (char *)NULL); _exit(127); default: /* parent */ do { p = waitpid(pid, &status, 0); } while (p == -1 && errno == EINTR); } #ifdef NX_TRANS_EXIT if (OsVendorEndRedirectErrorFProc != NULL) { OsVendorEndRedirectErrorFProc(); } #endif #ifdef SIGCHLD if (OsSignal(SIGCHLD, csig) == SIG_ERR) { perror("signal"); return -1; } #endif return p == -1 ? -1 : status; } static struct pid { struct pid *next; FILE *fp; int pid; } *pidlist; void * Popen(char *command, char *type) { struct pid *cur; FILE *iop; int pdes[2], pid; if (command == NULL || type == NULL) return NULL; if ((*type != 'r' && *type != 'w') || type[1]) return NULL; if ((cur = (struct pid *)malloc(sizeof(struct pid))) == NULL) return NULL; if (pipe(pdes) < 0) { free(cur); return NULL; } /* Ignore the smart scheduler while this is going on */ #if HAVE_SETITIMER if (SmartSchedulePause() < 0) { close(pdes[0]); close(pdes[1]); free(cur); perror("signal"); return NULL; } #endif #ifdef NX_TRANS_EXIT if (OsVendorStartRedirectErrorFProc != NULL) { OsVendorStartRedirectErrorFProc(); } OsBlockSignals (); #endif switch (pid = fork()) { case -1: /* error */ close(pdes[0]); close(pdes[1]); free(cur); #if HAVE_SETITIMER if (SmartScheduleEnable() < 0) perror("signal"); #endif #ifdef NX_TRANS_EXIT if (OsVendorEndRedirectErrorFProc != NULL) { OsVendorEndRedirectErrorFProc(); } OsReleaseSignals (); #endif return NULL; case 0: /* child */ if (setgid(getgid()) == -1) _exit(127); if (setuid(getuid()) == -1) _exit(127); if (*type == 'r') { if (pdes[1] != 1) { /* stdout */ dup2(pdes[1], 1); close(pdes[1]); } close(pdes[0]); } else { if (pdes[0] != 0) { /* stdin */ dup2(pdes[0], 0); close(pdes[0]); } close(pdes[1]); } #ifdef NX_TRANS_SOCKET /* * Check if the child process should not * use the parent's libraries. */ if (_NXUnsetLibraryPath) { #ifndef __sun unsetenv ("LD_LIBRARY_PATH"); #else char **ep = environ; ep = environ; while (*ep) { if (!strncmp("LD_LIBRARY_PATH=", *ep, strlen("LD_LIBRARY_PATH="))) { break; } *ep++; } while (*ep) { *ep = *(ep + 1); ep++; } #endif } #endif #ifdef NX_TRANS_EXIT OsReleaseSignals (); #endif #if HAVE_SETITIMER if (SmartScheduleEnable() < 0) { perror("signal"); return NULL; } #endif execl("/bin/sh", "sh", "-c", command, (char *)NULL); _exit(127); } #ifndef NX_TRANS_EXIT /* Avoid EINTR during stdio calls */ OsBlockSignals (); #endif /* parent */ if (*type == 'r') { iop = fdopen(pdes[0], type); close(pdes[1]); } else { iop = fdopen(pdes[1], type); close(pdes[0]); } cur->fp = iop; cur->pid = pid; cur->next = pidlist; pidlist = cur; #ifdef DEBUG ErrorF("Popen: `%s', fp = %p\n", command, iop); #endif return iop; } /* fopen that drops privileges */ void * Fopen(char *file, char *type) { FILE *iop; #ifndef HAS_SAVED_IDS_AND_SETEUID struct pid *cur; int pdes[2], pid; if (file == NULL || type == NULL) return NULL; if ((*type != 'r' && *type != 'w') || type[1]) return NULL; if ((cur = (struct pid *)malloc(sizeof(struct pid))) == NULL) return NULL; if (pipe(pdes) < 0) { free(cur); return NULL; } switch (pid = fork()) { case -1: /* error */ close(pdes[0]); close(pdes[1]); free(cur); return NULL; case 0: /* child */ if (setgid(getgid()) == -1) _exit(127); if (setuid(getuid()) == -1) _exit(127); if (*type == 'r') { if (pdes[1] != 1) { /* stdout */ dup2(pdes[1], 1); close(pdes[1]); } close(pdes[0]); } else { if (pdes[0] != 0) { /* stdin */ dup2(pdes[0], 0); close(pdes[0]); } close(pdes[1]); } execl("/bin/cat", "cat", file, (char *)NULL); _exit(127); } /* Avoid EINTR during stdio calls */ OsBlockSignals (); /* parent */ if (*type == 'r') { iop = fdopen(pdes[0], type); close(pdes[1]); } else { iop = fdopen(pdes[1], type); close(pdes[0]); } cur->fp = iop; cur->pid = pid; cur->next = pidlist; pidlist = cur; #ifdef DEBUG ErrorF("Popen: `%s', fp = %p\n", command, iop); #endif return iop; #else int ruid, euid; ruid = getuid(); euid = geteuid(); if (seteuid(ruid) == -1) { return NULL; } iop = fopen(file, type); if (seteuid(euid) == -1) { fclose(iop); return NULL; } return iop; #endif /* HAS_SAVED_IDS_AND_SETEUID */ } int Pclose(void * iop) { struct pid *cur, *last; int pstat; int pid; #ifdef DEBUG ErrorF("Pclose: fp = %p\n", iop); #endif fclose(iop); for (last = NULL, cur = pidlist; cur; last = cur, cur = cur->next) if (cur->fp == iop) break; if (cur == NULL) return -1; do { pid = waitpid(cur->pid, &pstat, 0); } while (pid == -1 && errno == EINTR); if (last == NULL) pidlist = cur->next; else last->next = cur->next; free(cur); /* allow EINTR again */ OsReleaseSignals (); #ifdef NX_TRANS_EXIT if (OsVendorEndRedirectErrorFProc != NULL) { OsVendorEndRedirectErrorFProc(); } #endif return pid == -1 ? -1 : pstat; } int Fclose(void * iop) { #ifdef HAS_SAVED_IDS_AND_SETEUID return fclose(iop); #else return Pclose(iop); #endif } /* * CheckUserParameters: check for long command line arguments and long * environment variables. By default, these checks are only done when * the server's euid != ruid. In 3.3.x, these checks were done in an * external wrapper utility. */ /* Consider LD* variables insecure? */ #ifndef REMOVE_ENV_LD #define REMOVE_ENV_LD 1 #endif /* Remove long environment variables? */ #ifndef REMOVE_LONG_ENV #define REMOVE_LONG_ENV 1 #endif /* * Disallow stdout or stderr as pipes? It's possible to block the X server * when piping stdout+stderr to a pipe. * * Don't enable this because it looks like it's going to cause problems. */ #ifndef NO_OUTPUT_PIPES #define NO_OUTPUT_PIPES 0 #endif /* Check args and env only if running setuid (euid == 0 && euid != uid) ? */ #ifndef CHECK_EUID #define CHECK_EUID 1 #endif /* * Maybe the locale can be faked to make isprint(3) report that everything * is printable? Avoid it by default. */ #ifndef USE_ISPRINT #define USE_ISPRINT 0 #endif #define MAX_ARG_LENGTH 128 #define MAX_ENV_LENGTH 256 #define MAX_ENV_PATH_LENGTH 2048 /* Limit for *PATH and TERMCAP */ #if USE_ISPRINT #include #define checkPrintable(c) isprint(c) #else #define checkPrintable(c) (((c) & 0x7f) >= 0x20 && ((c) & 0x7f) != 0x7f) #endif enum BadCode { NotBad = 0, UnsafeArg, ArgTooLong, UnprintableArg, EnvTooLong, OutputIsPipe, InternalError }; #if defined(VENDORSUPPORT) #define BUGADDRESS VENDORSUPPORT #elif defined(BUILDERADDR) #define BUGADDRESS BUILDERADDR #else #define BUGADDRESS "xorg@freedesktop.org" #endif #define ARGMSG \ "\nIf the arguments used are valid, and have been rejected incorrectly\n" \ "please send details of the arguments and why they are valid to\n" \ "%s. In the meantime, you can start the Xserver as\n" \ "the \"super user\" (root).\n" #define ENVMSG \ "\nIf the environment is valid, and have been rejected incorrectly\n" \ "please send details of the environment and why it is valid to\n" \ "%s. In the meantime, you can start the Xserver as\n" \ "the \"super user\" (root).\n" void CheckUserParameters(int argc, char **argv, char **envp) { enum BadCode bad = NotBad; int i = 0, j; char *a, *e = NULL; #if CHECK_EUID if (geteuid() == 0 && getuid() != geteuid()) #endif { /* Check each argv[] */ for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-fp") == 0) { i++; /* continue with next argument. skip the length check */ if (i >= argc) break; } else { if (strlen(argv[i]) > MAX_ARG_LENGTH) { bad = ArgTooLong; break; } } a = argv[i]; while (*a) { if (checkPrintable(*a) == 0) { bad = UnprintableArg; break; } a++; } if (bad) break; } if (!bad) { /* Check each envp[] */ for (i = 0; envp[i]; i++) { /* Check for bad environment variables and values */ #if REMOVE_ENV_LD while (envp[i] && (strncmp(envp[i], "LD", 2) == 0)) { #ifdef ENVDEBUG ErrorF("CheckUserParameters: removing %s from the " "environment\n", strtok(envp[i], "=")); #endif for (j = i; envp[j]; j++) { envp[j] = envp[j+1]; } } #endif if (envp[i] && (strlen(envp[i]) > MAX_ENV_LENGTH)) { #if REMOVE_LONG_ENV #ifdef ENVDEBUG ErrorF("CheckUserParameters: removing %s from the " "environment\n", strtok(envp[i], "=")); #endif for (j = i; envp[j]; j++) { envp[j] = envp[j+1]; } i--; #else char *eq; int len; eq = strchr(envp[i], '='); if (!eq) continue; len = eq - envp[i]; e = malloc(len + 1); if (!e) { bad = InternalError; break; } strncpy(e, envp[i], len); e[len] = 0; if (len >= 4 && (strcmp(e + len - 4, "PATH") == 0 || strcmp(e, "TERMCAP") == 0)) { if (strlen(envp[i]) > MAX_ENV_PATH_LENGTH) { bad = EnvTooLong; break; } else { free(e); } } else { bad = EnvTooLong; break; } #endif } } } #if NO_OUTPUT_PIPES if (!bad) { struct stat buf; if (fstat(fileno(stdout), &buf) == 0 && S_ISFIFO(buf.st_mode)) bad = OutputIsPipe; if (fstat(fileno(stderr), &buf) == 0 && S_ISFIFO(buf.st_mode)) bad = OutputIsPipe; } #endif } switch (bad) { case NotBad: return; case UnsafeArg: ErrorF("Command line argument number %d is unsafe\n", i); ErrorF(ARGMSG, BUGADDRESS); break; case ArgTooLong: ErrorF("Command line argument number %d is too long\n", i); ErrorF(ARGMSG, BUGADDRESS); break; case UnprintableArg: ErrorF("Command line argument number %d contains unprintable" " characters\n", i); ErrorF(ARGMSG, BUGADDRESS); break; case EnvTooLong: ErrorF("Environment variable `%s' is too long\n", e); ErrorF(ENVMSG, BUGADDRESS); break; case OutputIsPipe: ErrorF("Stdout and/or stderr is a pipe\n"); break; case InternalError: ErrorF("Internal Error\n"); break; default: ErrorF("Unknown error\n"); ErrorF(ARGMSG, BUGADDRESS); ErrorF(ENVMSG, BUGADDRESS); break; } FatalError("X server aborted because of unsafe environment\n"); } /* * CheckUserAuthorization: check if the user is allowed to start the * X server. This usually means some sort of PAM checking, and it is * usually only done for setuid servers (uid != euid). */ #ifdef USE_PAM #include #include #include #endif /* USE_PAM */ void CheckUserAuthorization(void) { #ifdef USE_PAM static struct pam_conv conv = { misc_conv, NULL }; pam_handle_t *pamh = NULL; struct passwd *pw; int retval; if (getuid() != geteuid()) { pw = getpwuid(getuid()); if (pw == NULL) FatalError("getpwuid() failed for uid %d\n", getuid()); retval = pam_start("xserver", pw->pw_name, &conv, &pamh); if (retval != PAM_SUCCESS) FatalError("pam_start() failed.\n" "\tMissing or mangled PAM config file or module?\n"); retval = pam_authenticate(pamh, 0); if (retval != PAM_SUCCESS) { pam_end(pamh, retval); FatalError("PAM authentication failed, cannot start X server.\n" "\tPerhaps you do not have console ownership?\n"); } retval = pam_acct_mgmt(pamh, 0); if (retval != PAM_SUCCESS) { pam_end(pamh, retval); FatalError("PAM authentication failed, cannot start X server.\n" "\tPerhaps you do not have console ownership?\n"); } /* this is not a session, so do not do session management */ pam_end(pamh, PAM_SUCCESS); } #endif } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/WaitFor.c0000644000000000000000000005327013614532331016742 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /***************************************************************** * OS Dependent input routines: * * WaitForSomething * TimerForce, TimerSet, TimerCheck, TimerFree * *****************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for strings, fcntl, time */ #include #include #include #include "misc.h" #include "osdep.h" #include #include "dixstruct.h" #include "opaque.h" #ifdef DPMSExtension #include "dpmsproc.h" #endif #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) static unsigned long startTimeInMillis; #endif /* This is just a fallback to errno to hide the differences between unix and Windows in the code */ #define GetErrno() errno /* modifications by raphael */ int mffs(fd_mask mask) { int i; if (!mask) return 0; i = 1; while (!(mask & 1)) { i++; mask >>= 1; } return i; } #ifdef DPMSExtension #define DPMS_SERVER #include #endif struct _OsTimerRec { OsTimerPtr next; CARD32 expires; OsTimerCallback callback; void * arg; }; static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev); static OsTimerPtr timers = NULL; /***************** * WaitForSomething: * Make the server suspend until there is * 1. data from clients or * 2. input events available or * 3. ddx notices something of interest (graphics * queue ready, etc.) or * 4. clients that have buffered replies/events are ready * * If the time between INPUT events is * greater than ScreenSaverTime, the display is turned off (or * saved, depending on the hardware). So, WaitForSomething() * has to handle this also (that's why the select() has a timeout. * For more info on ClientsWithInput, see ReadRequestFromClient(). * pClientsReady is an array to store ready client->index values into. *****************/ int WaitForSomething(int *pClientsReady) { int i; struct timeval waittime, *wt; INT32 timeout = 0; fd_set clientsReadable; fd_set clientsWritable; int curclient; int selecterr; int nready; CARD32 now = 0; Bool someReady = FALSE; Bool someNotifyWriteReady = FALSE; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "WaitForSomething: Got called.\n"); #endif FD_ZERO(&clientsReadable); #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) startTimeInMillis = GetTimeInMillis(); #endif /* We need a while loop here to handle crashed connections and the screen saver timeout */ while (1) { /* deal with any blocked jobs */ if (workQueue) ProcessWorkQueue(); if (XFD_ANYSET (&ClientsWithInput)) { someReady = TRUE; waittime.tv_sec = 0; waittime.tv_usec = 0; wt = &waittime; } if (someReady) { XFD_COPYSET(&AllSockets, &LastSelectMask); XFD_UNSET(&LastSelectMask, &ClientsWithInput); } else { wt = NULL; if (timers) { now = GetTimeInMillis(); timeout = timers->expires - now; if (timeout < 0) timeout = 0; waittime.tv_sec = timeout / MILLI_PER_SECOND; waittime.tv_usec = (timeout % MILLI_PER_SECOND) * (1000000 / MILLI_PER_SECOND); wt = &waittime; } XFD_COPYSET(&AllSockets, &LastSelectMask); } SmartScheduleStopTimer (); BlockHandler((void *)&wt, (void *)&LastSelectMask); if (NewOutputPending) FlushAllOutput(); #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) /* * If caller has marked the first element of pClientsReady[], * bail out of select after a short timeout. We need this to * let the NX agent remove the splash screen when the timeout * is expired. A better option would be to use the existing * screen-saver timeout but it can be modified by clients, so * we would need a special handling. This hack is trivial and * keeps WaitForSomething() backward compatible with the exis- * ting servers. */ if (pClientsReady[0] == -1) { unsigned long timeoutInMillis; #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) fprintf(stderr, "WaitForSomething: pClientsReady[0] is [%d], pClientsReady[1] is [%d].\n", pClientsReady[0], pClientsReady[1]); #endif timeoutInMillis = GetTimeInMillis(); if (timeoutInMillis - startTimeInMillis >= NX_TRANS_WAKEUP) { #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) fprintf(stderr, "WaitForSomething: Returning 0 because of wakeup timeout.\n"); #endif return 0; } timeoutInMillis = NX_TRANS_WAKEUP - (timeoutInMillis - startTimeInMillis); #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) fprintf(stderr, "WaitForSomething: Milliseconds to next wakeup are %ld.\n", timeoutInMillis); #endif if (wt == NULL || (wt -> tv_sec * MILLI_PER_SECOND + wt -> tv_usec / MILLI_PER_SECOND) > timeoutInMillis) { if ((waittime.tv_sec * MILLI_PER_SECOND + waittime.tv_usec / MILLI_PER_SECOND) > timeoutInMillis) { waittime.tv_sec = timeoutInMillis / MILLI_PER_SECOND; waittime.tv_usec = (timeoutInMillis * MILLI_PER_SECOND) % (MILLI_PER_SECOND * 1000); wt = &waittime; } #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) fprintf(stderr, "WaitForSomething: Next wakeup timeout set to %ld milliseconds.\n", (waittime.tv_sec * MILLI_PER_SECOND) + (waittime.tv_usec / MILLI_PER_SECOND)); #endif } #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) && defined(NX_TRANS_DEBUG) else { fprintf(stderr, "WaitForSomething: Using existing timeout of %ld milliseconds.\n", (waittime.tv_sec * MILLI_PER_SECOND) + (waittime.tv_usec / MILLI_PER_SECOND)); } #endif } #endif /* keep this check close to select() call to minimize race */ #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) if (dispatchException) { i = -1; fprintf(stderr, "WaitForSomething: Value of dispatchException is true. Set i = -1.\n"); } #else if (dispatchException) i = -1; #endif else if (AnyWritesPending) { #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) if (wt == NULL) { fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask and " "clientsWritable and null timeout.\n"); } else { fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask, " "clientsWritable, %ld secs and %ld usecs.\n", wt -> tv_sec, wt -> tv_usec); } #endif XFD_COPYSET(&ClientsWriteBlocked, &LastSelectWriteMask); XFD_ORSET(&LastSelectWriteMask, &NotifyWriteFds, &LastSelectWriteMask); i = Select(MaxClients, &LastSelectMask, &LastSelectWriteMask, NULL, wt); } else { #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) if (wt == NULL) { fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask and null timeout.\n"); } else { fprintf(stderr, "WaitForSomething: Executing select with LastSelectMask, %ld secs and %ld usecs.\n", wt -> tv_sec, wt -> tv_usec); } #endif i = Select (MaxClients, &LastSelectMask, NULL, NULL, wt); } #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "WaitForSomething: Bailed out with i = [%d] and errno = [%d].\n", i, errno); if (i < 0) { fprintf(stderr, "WaitForSomething: Error is [%s].\n", strerror(errno)); } #endif selecterr = GetErrno(); WakeupHandler(i, (void *)&LastSelectMask); SmartScheduleStartTimer (); if (i <= 0) /* An error or timeout occurred */ { #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) if (dispatchException) { fprintf(stderr, "WaitForSomething: Returning 0 because of (dispatchException).\n"); return 0; } #else if (dispatchException) return 0; #endif if (i < 0) { if (selecterr == EBADF) /* Some client disconnected */ { CheckConnections (); #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) if (! XFD_ANYSET (&AllClients)) { fprintf(stderr, "WaitForSomething: Returning 0 because of (! XFD_ANYSET (&AllClients)).\n"); return 0; } #else if (! XFD_ANYSET (&AllClients)) return 0; #endif } else if (selecterr == EINVAL) { FatalError("WaitForSomething(): select: errno=%d\n", selecterr); } else if (selecterr != EINTR) { ErrorF("WaitForSomething(): select: errno=%d\n", selecterr); } } else if (someReady) { /* * If no-one else is home, bail quickly */ XFD_COPYSET(&ClientsWithInput, &LastSelectMask); XFD_COPYSET(&ClientsWithInput, &clientsReadable); break; } #if defined(NX_TRANS_SOCKET) if (*checkForInput[0] != *checkForInput[1]) { #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "WaitForSomething: Returning 0 because of (*checkForInput[0] != *checkForInput[1]).\n"); #endif return 0; } #else if (*checkForInput[0] != *checkForInput[1]) return 0; #endif if (timers) { int expired = 0; now = GetTimeInMillis(); if ((int) (timers->expires - now) <= 0) expired = 1; while (timers && (int) (timers->expires - now) <= 0) DoTimer(timers, now, &timers); if (expired) return 0; } } else { fd_set tmp_set; if (*checkForInput[0] == *checkForInput[1]) { if (timers) { int expired = 0; now = GetTimeInMillis(); if ((int) (timers->expires - now) <= 0) expired = 1; while (timers && (int) (timers->expires - now) <= 0) DoTimer(timers, now, &timers); if (expired) return 0; } } if (someReady) XFD_ORSET(&LastSelectMask, &ClientsWithInput, &LastSelectMask); if (AnyWritesPending) { XFD_ANDSET(&clientsWritable, &LastSelectWriteMask, &ClientsWriteBlocked); if (XFD_ANYSET(&clientsWritable)) { NewOutputPending = TRUE; XFD_ORSET(&OutputPending, &clientsWritable, &OutputPending); XFD_UNSET(&ClientsWriteBlocked, &clientsWritable); if (!XFD_ANYSET(&ClientsWriteBlocked) && NumNotifyWriteFd == 0) AnyWritesPending = FALSE; } if (NumNotifyWriteFd != 0) { XFD_ANDSET(&tmp_set, &LastSelectWriteMask, &NotifyWriteFds); if (XFD_ANYSET(&tmp_set)) someNotifyWriteReady = TRUE; } } XFD_ANDSET(&clientsReadable, &LastSelectMask, &AllClients); XFD_ANDSET(&tmp_set, &LastSelectMask, &NotifyReadFds); if (XFD_ANYSET(&tmp_set) || someNotifyWriteReady) HandleNotifyFds(); if (XFD_ANYSET (&clientsReadable)) break; } } nready = 0; if (XFD_ANYSET (&clientsReadable)) { for (i=0; inext; timer->next = NULL; newTime = (*timer->callback)(timer, now, timer->arg); if (newTime) TimerSet(timer, 0, newTime, timer->callback, timer->arg); } OsTimerPtr TimerSet(OsTimerPtr timer, int flags, CARD32 millis, OsTimerCallback func, void * arg) { register OsTimerPtr *prev; CARD32 now = GetTimeInMillis(); if (!timer) { timer = (OsTimerPtr)malloc(sizeof(struct _OsTimerRec)); if (!timer) return NULL; } else { for (prev = &timers; *prev; prev = &(*prev)->next) { if (*prev == timer) { *prev = timer->next; if (flags & TimerForceOld) (void)(*timer->callback)(timer, now, timer->arg); break; } } } if (!millis) return timer; if (!(flags & TimerAbsolute)) millis += now; timer->expires = millis; timer->callback = func; timer->arg = arg; if ((int) (millis - now) <= 0) { timer->next = NULL; millis = (*timer->callback)(timer, now, timer->arg); if (!millis) return timer; } for (prev = &timers; *prev && (int) ((*prev)->expires - millis) <= 0; prev = &(*prev)->next) ; timer->next = *prev; *prev = timer; return timer; } Bool TimerForce(OsTimerPtr timer) { OsTimerPtr *prev; for (prev = &timers; *prev; prev = &(*prev)->next) { if (*prev == timer) { DoTimer(timer, GetTimeInMillis(), prev); return TRUE; } } return FALSE; } void TimerCancel(OsTimerPtr timer) { OsTimerPtr *prev; if (!timer) return; for (prev = &timers; *prev; prev = &(*prev)->next) { if (*prev == timer) { *prev = timer->next; break; } } } void TimerFree(OsTimerPtr timer) { if (!timer) return; TimerCancel(timer); free(timer); } void TimerCheck(void) { CARD32 now = GetTimeInMillis(); while (timers && (int) (timers->expires - now) <= 0) DoTimer(timers, now, &timers); } void TimerInit(void) { OsTimerPtr timer; while ((timer = timers)) { timers = timer->next; free(timer); } } #ifdef DPMSExtension #define DPMS_CHECK_MODE(mode,time)\ if (time > 0 && DPMSPowerLevel < mode && timeout >= time)\ DPMSSet(mode); #define DPMS_CHECK_TIMEOUT(time)\ if (time > 0 && (time - timeout) > 0)\ return time - timeout; static CARD32 NextDPMSTimeout(INT32 timeout) { /* * Return the amount of time remaining until we should set * the next power level. Fallthroughs are intentional. */ switch (DPMSPowerLevel) { case DPMSModeOn: DPMS_CHECK_TIMEOUT(DPMSStandbyTime) case DPMSModeStandby: DPMS_CHECK_TIMEOUT(DPMSSuspendTime) case DPMSModeSuspend: DPMS_CHECK_TIMEOUT(DPMSOffTime) default: /* DPMSModeOff */ return 0; } } #endif /* DPMSExtension */ static CARD32 ScreenSaverTimeoutExpire(OsTimerPtr timer,CARD32 now,void * arg) { INT32 timeout = now - lastDeviceEventTime.milliseconds; CARD32 nextTimeout = 0; #ifdef DPMSExtension /* * Check each mode lowest to highest, since a lower mode can * have the same timeout as a higher one. */ if (DPMSEnabled) { DPMS_CHECK_MODE(DPMSModeOff, DPMSOffTime) DPMS_CHECK_MODE(DPMSModeSuspend, DPMSSuspendTime) DPMS_CHECK_MODE(DPMSModeStandby, DPMSStandbyTime) nextTimeout = NextDPMSTimeout(timeout); } /* * Only do the screensaver checks if we're not in a DPMS * power saving mode */ if (DPMSPowerLevel != DPMSModeOn) return nextTimeout; #endif /* DPMSExtension */ if (!ScreenSaverTime) return nextTimeout; if (timeout < ScreenSaverTime) { return nextTimeout > 0 ? min(ScreenSaverTime - timeout, nextTimeout) : ScreenSaverTime - timeout; } ResetOsBuffers(); /* not ideal, but better than nothing */ SaveScreens(SCREEN_SAVER_ON, ScreenSaverActive); if (ScreenSaverInterval > 0) { nextTimeout = nextTimeout > 0 ? min(ScreenSaverInterval, nextTimeout) : ScreenSaverInterval; } return nextTimeout; } static OsTimerPtr ScreenSaverTimer = NULL; void FreeScreenSaverTimer(void) { if (ScreenSaverTimer) { TimerFree(ScreenSaverTimer); ScreenSaverTimer = NULL; } } void SetScreenSaverTimer(void) { CARD32 timeout = 0; #ifdef DPMSExtension if (DPMSEnabled) { /* * A higher DPMS level has a timeout that's either less * than or equal to that of a lower DPMS level. */ if (DPMSStandbyTime > 0) timeout = DPMSStandbyTime; else if (DPMSSuspendTime > 0) timeout = DPMSSuspendTime; else if (DPMSOffTime > 0) timeout = DPMSOffTime; } #endif if (ScreenSaverTime > 0) { timeout = timeout > 0 ? min(ScreenSaverTime, timeout) : ScreenSaverTime; } #ifdef SCREENSAVER if (timeout && !screenSaverSuspended) { #else if (timeout) { #endif ScreenSaverTimer = TimerSet(ScreenSaverTimer, 0, timeout, ScreenSaverTimeoutExpire, NULL); } else if (ScreenSaverTimer) { FreeScreenSaverTimer(); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/xdmauth.c0000644000000000000000000002720013614532331017033 0ustar /* Copyright 1988, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* * XDM-AUTHENTICATION-1 (XDMCP authentication) and * XDM-AUTHORIZATION-1 (client authorization) protocols * * Author: Keith Packard, MIT X Consortium */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #define XSERV_t #define TRANS_SERVER #define TRANS_REOPEN #include #include "os.h" #include "osdep.h" #include "dixstruct.h" #ifdef HASXDMAUTH static Bool authFromXDMCP; #ifdef XDMCP #include #undef REQUEST #include /* XDM-AUTHENTICATION-1 */ static XdmAuthKeyRec privateKey; static char XdmAuthenticationName[] = "XDM-AUTHENTICATION-1"; #define XdmAuthenticationNameLen (sizeof XdmAuthenticationName - 1) static XdmAuthKeyRec global_rho; static Bool XdmAuthenticationValidator (ARRAY8Ptr privateData, ARRAY8Ptr incomingData, xdmOpCode packet_type) { XdmAuthKeyPtr incoming; XdmcpUnwrap (incomingData->data, (unsigned char *)&privateKey, incomingData->data,incomingData->length); if (packet_type == ACCEPT) { if (incomingData->length != 8) return FALSE; incoming = (XdmAuthKeyPtr) incomingData->data; XdmcpDecrementKey (incoming); return XdmcpCompareKeys (incoming, &global_rho); } return FALSE; } static Bool XdmAuthenticationGenerator (ARRAY8Ptr privateData, ARRAY8Ptr outgoingData, xdmOpCode packet_type) { outgoingData->length = 0; outgoingData->data = 0; if (packet_type == REQUEST) { if (XdmcpAllocARRAY8 (outgoingData, 8)) XdmcpWrap ((unsigned char *)&global_rho, (unsigned char *)&privateKey, outgoingData->data, 8); } return TRUE; } static Bool XdmAuthenticationAddAuth (int name_len, char *name, int data_len, char *data) { Bool ret; XdmcpUnwrap ((unsigned char *)data, (unsigned char *)&privateKey, (unsigned char *)data, data_len); authFromXDMCP = TRUE; ret = AddAuthorization (name_len, name, data_len, data); authFromXDMCP = FALSE; return ret; } #define atox(c) ('0' <= c && c <= '9' ? c - '0' : \ 'a' <= c && c <= 'f' ? c - 'a' + 10 : \ 'A' <= c && c <= 'F' ? c - 'A' + 10 : -1) static int HexToBinary (char *in, char *out, int len) { int top, bottom; while (len > 0) { top = atox(in[0]); if (top == -1) return 0; bottom = atox(in[1]); if (bottom == -1) return 0; *out++ = (top << 4) | bottom; in += 2; len -= 2; } if (len) return 0; *out++ = '\0'; return 1; } void XdmAuthenticationInit (char *cookie, int cookie_len) { bzero (privateKey.data, 8); if (!strncmp (cookie, "0x", 2) || !strncmp (cookie, "0X", 2)) { if (cookie_len > 2 + 2 * 8) cookie_len = 2 + 2 * 8; HexToBinary (cookie + 2, (char *)privateKey.data, cookie_len - 2); } else { if (cookie_len > 7) cookie_len = 7; memmove (privateKey.data + 1, cookie, cookie_len); } XdmcpGenerateKey (&global_rho); XdmcpRegisterAuthentication (XdmAuthenticationName, XdmAuthenticationNameLen, (char *)&global_rho, sizeof (global_rho), (ValidatorFunc)XdmAuthenticationValidator, (GeneratorFunc)XdmAuthenticationGenerator, (AddAuthorFunc)XdmAuthenticationAddAuth); } #endif /* XDMCP */ /* XDM-AUTHORIZATION-1 */ typedef struct _XdmAuthorization { struct _XdmAuthorization *next; XdmAuthKeyRec rho; XdmAuthKeyRec key; XID id; } XdmAuthorizationRec, *XdmAuthorizationPtr; static XdmAuthorizationPtr xdmAuth; typedef struct _XdmClientAuth { struct _XdmClientAuth *next; XdmAuthKeyRec rho; char client[6]; long time; } XdmClientAuthRec, *XdmClientAuthPtr; static XdmClientAuthPtr xdmClients; static long clockOffset; static Bool gotClock; #define TwentyMinutes (20 * 60) #define TwentyFiveMinutes (25 * 60) static Bool XdmClientAuthCompare (XdmClientAuthPtr a, XdmClientAuthPtr b) { int i; if (!XdmcpCompareKeys (&a->rho, &b->rho)) return FALSE; for (i = 0; i < 6; i++) if (a->client[i] != b->client[i]) return FALSE; return a->time == b->time; } static void XdmClientAuthDecode (unsigned char *plain, XdmClientAuthPtr auth) { int i, j; j = 0; for (i = 0; i < 8; i++) { auth->rho.data[i] = plain[j]; ++j; } for (i = 0; i < 6; i++) { auth->client[i] = plain[j]; ++j; } auth->time = 0; for (i = 0; i < 4; i++) { auth->time |= plain[j] << ((3 - i) << 3); j++; } } static void XdmClientAuthTimeout (long now) { XdmClientAuthPtr client, next, prev; prev = 0; for (client = xdmClients; client; client=next) { next = client->next; if (abs (now - client->time) > TwentyFiveMinutes) { if (prev) prev->next = next; else xdmClients = next; free (client); } else prev = client; } } static XdmClientAuthPtr XdmAuthorizationValidate (unsigned char *plain, int length, XdmAuthKeyPtr rho, ClientPtr xclient, char **reason) { XdmClientAuthPtr client, existing; long now; int i; if (length != (192 / 8)) { if (reason) *reason = "Bad XDM authorization key length"; return NULL; } client = (XdmClientAuthPtr) malloc (sizeof (XdmClientAuthRec)); if (!client) return NULL; XdmClientAuthDecode (plain, client); if (!XdmcpCompareKeys (&client->rho, rho)) { free (client); if (reason) *reason = "Invalid XDM-AUTHORIZATION-1 key (failed key comparison)"; return NULL; } for (i = 18; i < 24; i++) if (plain[i] != 0) { free (client); if (reason) *reason = "Invalid XDM-AUTHORIZATION-1 key (failed NULL check)"; return NULL; } if (xclient) { int family, addr_len; Xtransaddr *addr; if (_XSERVTransGetPeerAddr(((OsCommPtr)xclient->osPrivate)->trans_conn, &family, &addr_len, &addr) == 0 && _XSERVTransConvertAddress(&family, &addr_len, &addr) == 0) { #if defined(TCPCONN) if (family == FamilyInternet && memcmp((char *)addr, client->client, 4) != 0) { free (client); free (addr); if (reason) *reason = "Invalid XDM-AUTHORIZATION-1 key (failed address comparison)"; return NULL; } #endif free (addr); } } now = time(0); if (!gotClock) { clockOffset = client->time - now; gotClock = TRUE; } now += clockOffset; XdmClientAuthTimeout (now); if (abs (client->time - now) > TwentyMinutes) { free (client); if (reason) *reason = "Excessive XDM-AUTHORIZATION-1 time offset"; return NULL; } for (existing = xdmClients; existing; existing=existing->next) { if (XdmClientAuthCompare (existing, client)) { free (client); if (reason) *reason = "XDM authorization key matches an existing client!"; return NULL; } } return client; } int XdmAddCookie (unsigned short data_length, char *data, XID id) { XdmAuthorizationPtr new; unsigned char *rho_bits, *key_bits; switch (data_length) { case 16: /* auth from files is 16 bytes long */ #ifdef XDMCP if (authFromXDMCP) { /* R5 xdm sent bogus authorization data in the accept packet, * but we can recover */ rho_bits = global_rho.data; key_bits = (unsigned char *) data; key_bits[0] = '\0'; } else #endif { rho_bits = (unsigned char *) data; key_bits = (unsigned char *) (data + 8); } break; #ifdef XDMCP case 8: /* auth from XDMCP is 8 bytes long */ rho_bits = global_rho.data; key_bits = (unsigned char *) data; break; #endif default: return 0; } /* the first octet of the key must be zero */ if (key_bits[0] != '\0') return 0; new = (XdmAuthorizationPtr) malloc (sizeof (XdmAuthorizationRec)); if (!new) return 0; new->next = xdmAuth; xdmAuth = new; memmove (new->key.data, key_bits, (int) 8); memmove (new->rho.data, rho_bits, (int) 8); new->id = id; return 1; } XID XdmCheckCookie (unsigned short cookie_length, char *cookie, ClientPtr xclient, char **reason) { XdmAuthorizationPtr auth; XdmClientAuthPtr client; unsigned char *plain; /* Auth packets must be a multiple of 8 bytes long */ if (cookie_length & 7) return (XID) -1; plain = (unsigned char *) malloc (cookie_length); if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length); if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, xclient, reason)) != NULL) { client->next = xdmClients; xdmClients = client; free (plain); return auth->id; } } free (plain); return (XID) -1; } int XdmResetCookie (void) { XdmAuthorizationPtr auth, next_auth; XdmClientAuthPtr client, next_client; for (auth = xdmAuth; auth; auth=next_auth) { next_auth = auth->next; free (auth); } xdmAuth = 0; for (client = xdmClients; client; client=next_client) { next_client = client->next; free (client); } xdmClients = (XdmClientAuthPtr) 0; return 1; } XID XdmToID (unsigned short cookie_length, char *cookie) { XdmAuthorizationPtr auth; XdmClientAuthPtr client; unsigned char *plain; plain = (unsigned char *) malloc (cookie_length); if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length); if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, NULL, NULL)) != NULL) { free (client); free (cookie); free (plain); return auth->id; } } free (cookie); free (plain); return (XID) -1; } int XdmFromID (XID id, unsigned short *data_lenp, char **datap) { XdmAuthorizationPtr auth; for (auth = xdmAuth; auth; auth=auth->next) { if (id == auth->id) { *data_lenp = 16; *datap = (char *) &auth->rho; return 1; } } return 0; } int XdmRemoveCookie (unsigned short data_length, char *data) { XdmAuthorizationPtr auth; XdmAuthKeyPtr key_bits, rho_bits; switch (data_length) { case 16: rho_bits = (XdmAuthKeyPtr) data; key_bits = (XdmAuthKeyPtr) (data + 8); break; #ifdef XDMCP case 8: rho_bits = &global_rho; key_bits = (XdmAuthKeyPtr) data; break; #endif default: return 0; } for (auth = xdmAuth; auth; auth=auth->next) { if (XdmcpCompareKeys (rho_bits, &auth->rho) && XdmcpCompareKeys (key_bits, &auth->key)) { xdmAuth = auth->next; free (auth); return 1; } } return 0; } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/xdmcp.c0000644000000000000000000012110413614532331016472 0ustar /* * Copyright 1989 Network Computing Devices, Inc., Mountain View, California. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of N.C.D. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. N.C.D. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include #include "misc.h" #include #include "osdep.h" #include "input.h" #include "dixstruct.h" #include "opaque.h" #ifndef NX_TRANS_SOCKET #define NX_TRANS_SOCKET #define NX_TRANS_TEST #endif #define XSERV_t #define TRANS_SERVER #define TRANS_REOPEN #include #ifdef XDMCP #undef REQUEST #ifdef XDMCP_NO_IPV6 #undef IPv6 #endif #include #define X_INCLUDE_NETDB_H #include #ifdef NX_TRANS_SOCKET xdmcp_states XdmcpState; int XdmcpStartTime; int XdmcpTimeOutRtx; #endif extern char *defaultDisplayClass; static int xdmcpSocket, sessionSocket; static xdmcp_states state; #if defined(IPv6) && defined(AF_INET6) static int xdmcpSocket6; static struct sockaddr_storage req_sockaddr; #else static struct sockaddr_in req_sockaddr; #endif static int req_socklen; static CARD32 SessionID; static CARD32 timeOutTime; static int timeOutRtx; static CARD16 DisplayNumber; static xdmcp_states XDM_INIT_STATE = XDM_OFF; #ifdef HASXDMAUTH static char *xdmAuthCookie; #endif static XdmcpBuffer buffer; #if defined(IPv6) && defined(AF_INET6) static struct addrinfo *mgrAddr; static struct addrinfo *mgrAddrFirst; #define SOCKADDR_TYPE struct sockaddr_storage #define SOCKADDR_FAMILY(s) ((struct sockaddr *)&(s))->sa_family #ifdef BSD44SOCKETS #define SOCKLEN_FIELD(s) ((struct sockaddr *)&(s))->sa_len #define SOCKLEN_TYPE unsigned char #else #define SOCKLEN_TYPE unsigned int #endif #else #define SOCKADDR_TYPE struct sockaddr_in #define SOCKADDR_FAMILY(s) (s).sin_family #ifdef BSD44SOCKETS #define SOCKLEN_FIELD(s) (s).sin_len #define SOCKLEN_TYPE unsigned char #else #define SOCKLEN_TYPE size_t #endif #endif static SOCKADDR_TYPE ManagerAddress; static SOCKADDR_TYPE FromAddress; #ifdef SOCKLEN_FIELD #define ManagerAddressLen SOCKLEN_FIELD(ManagerAddress) #define FromAddressLen SOCKLEN_FIELD(FromAddress) #else static SOCKLEN_TYPE ManagerAddressLen, FromAddressLen; #endif #if defined(IPv6) && defined(AF_INET6) static struct multicastinfo { struct multicastinfo *next; struct addrinfo *ai; int hops; } *mcastlist; #endif static void XdmcpAddHost( struct sockaddr *from, int fromlen, ARRAY8Ptr AuthenticationName, ARRAY8Ptr hostname, ARRAY8Ptr status); static void XdmcpSelectHost( struct sockaddr *host_sockaddr, int host_len, ARRAY8Ptr AuthenticationName); static void get_xdmcp_sock(void); static void send_query_msg(void); static void recv_willing_msg( struct sockaddr * /*from*/, int /*fromlen*/, unsigned /*length*/); static void send_request_msg(void); static void recv_accept_msg(unsigned /*length*/); static void recv_decline_msg(unsigned /*length*/); static void send_manage_msg(void); static void recv_refuse_msg(unsigned /*length*/); static void recv_failed_msg(unsigned /*length*/); static void send_keepalive_msg(void); static void recv_alive_msg(unsigned /*length*/); static void XdmcpFatal( char * /*type*/, ARRAY8Ptr /*status*/); static void XdmcpWarning(char * /*str*/); static void get_manager_by_name( int /*argc*/, char ** /*argv*/, int /*i*/); static void get_fromaddr_by_name(int /*argc*/, char ** /*argv*/, int /*i*/); #if defined(IPv6) && defined(AF_INET6) static int get_mcast_options(int /*argc*/, char ** /*argv*/, int /*i*/); #endif static void receive_packet(int /*socketfd*/); static void send_packet(void); extern void XdmcpDeadSession(char * /*reason*/); static void timeout(void); static void XdmcpBlockHandler( void * /*data*/, struct timeval ** /*wt*/, void * /*LastSelectMask*/); static void XdmcpWakeupHandler( void * /*data*/, int /*i*/, void * /*LastSelectMask*/); void XdmcpRegisterManufacturerDisplayID( char * /*name*/, int /*length*/); static unsigned short xdm_udp_port = XDM_UDP_PORT; static Bool OneSession = FALSE; static const char *xdm_from = NULL; void XdmcpUseMsg (void) { ErrorF("-query host-name contact named host for XDMCP\n"); ErrorF("-broadcast broadcast for XDMCP\n"); #if defined(IPv6) && defined(AF_INET6) ErrorF("-multicast [addr [hops]] IPv6 multicast for XDMCP\n"); #endif ErrorF("-indirect host-name contact named host for indirect XDMCP\n"); ErrorF("-port port-num UDP port number to send messages to\n"); ErrorF("-from local-address specify the local address to connect from\n"); ErrorF("-once Terminate server after one session\n"); ErrorF("-class display-class specify display class to send in manage\n"); #ifdef HASXDMAUTH ErrorF("-cookie xdm-auth-bits specify the magic cookie for XDMCP\n"); #endif ErrorF("-displayID display-id manufacturer display ID for request\n"); } static void XdmcpDefaultListen(void) { /* Even when configured --disable-listen-tcp, we should listen on tcp in XDMCP modes */ _XSERVTransListen("tcp"); } int XdmcpOptions(int argc, char **argv, int i) { if (strcmp(argv[i], "-query") == 0) { get_manager_by_name(argc, argv, i++); XDM_INIT_STATE = XDM_QUERY; AccessUsingXdmcp (); XdmcpDefaultListen(); return (i + 1); } if (strcmp(argv[i], "-broadcast") == 0) { XDM_INIT_STATE = XDM_BROADCAST; AccessUsingXdmcp (); XdmcpDefaultListen(); return (i + 1); } #if defined(IPv6) && defined(AF_INET6) if (strcmp(argv[i], "-multicast") == 0) { i = get_mcast_options(argc, argv, ++i); XDM_INIT_STATE = XDM_MULTICAST; AccessUsingXdmcp (); XdmcpDefaultListen(); return (i + 1); } #endif if (strcmp(argv[i], "-indirect") == 0) { get_manager_by_name(argc, argv, i++); XDM_INIT_STATE = XDM_INDIRECT; AccessUsingXdmcp (); XdmcpDefaultListen(); return (i + 1); } if (strcmp(argv[i], "-port") == 0) { if (++i == argc) { FatalError("Xserver: missing port number in command line\n"); } xdm_udp_port = (unsigned short) atoi(argv[i]); return (i + 1); } if (strcmp(argv[i], "-from") == 0) { get_fromaddr_by_name(argc, argv, ++i); return (i + 1); } if (strcmp(argv[i], "-once") == 0) { OneSession = TRUE; return (i + 1); } if (strcmp(argv[i], "-class") == 0) { if (++i == argc) { FatalError("Xserver: missing class name in command line\n"); } defaultDisplayClass = argv[i]; return (i + 1); } #ifdef HASXDMAUTH if (strcmp(argv[i], "-cookie") == 0) { if (++i == argc) { FatalError("Xserver: missing cookie data in command line\n"); } xdmAuthCookie = argv[i]; return (i + 1); } #endif if (strcmp(argv[i], "-displayID") == 0) { if (++i == argc) { FatalError("Xserver: missing displayID in command line\n"); } XdmcpRegisterManufacturerDisplayID (argv[i], strlen (argv[i])); return (i + 1); } return (i); } /* * This section is a collection of routines for * registering server-specific data with the XDMCP * state machine. */ /* * Save all broadcast addresses away so BroadcastQuery * packets get sent everywhere */ #define MAX_BROADCAST 10 /* This stays sockaddr_in since IPv6 doesn't support broadcast */ static struct sockaddr_in BroadcastAddresses[MAX_BROADCAST]; static int NumBroadcastAddresses; void XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr) { struct sockaddr_in *bcast; if (NumBroadcastAddresses >= MAX_BROADCAST) return; bcast = &BroadcastAddresses[NumBroadcastAddresses++]; bzero (bcast, sizeof (struct sockaddr_in)); #ifdef BSD44SOCKETS bcast->sin_len = addr->sin_len; #endif bcast->sin_family = addr->sin_family; bcast->sin_port = htons (xdm_udp_port); bcast->sin_addr = addr->sin_addr; } /* * Each authentication type is registered here; Validator * will be called to check all access attempts using * the specified authentication type */ static ARRAYofARRAY8 AuthenticationNames, AuthenticationDatas; typedef struct _AuthenticationFuncs { ValidatorFunc Validator; GeneratorFunc Generator; AddAuthorFunc AddAuth; } AuthenticationFuncsRec, *AuthenticationFuncsPtr; static AuthenticationFuncsPtr AuthenticationFuncsList; void XdmcpRegisterAuthentication ( char *name, int namelen, char *data, int datalen, ValidatorFunc Validator, GeneratorFunc Generator, AddAuthorFunc AddAuth) { int i; ARRAY8 AuthenticationName, AuthenticationData; static AuthenticationFuncsPtr newFuncs; if (!XdmcpAllocARRAY8 (&AuthenticationName, namelen)) return; if (!XdmcpAllocARRAY8 (&AuthenticationData, datalen)) { XdmcpDisposeARRAY8 (&AuthenticationName); return; } for (i = 0; i < namelen; i++) AuthenticationName.data[i] = name[i]; for (i = 0; i < datalen; i++) AuthenticationData.data[i] = data[i]; if (!(XdmcpReallocARRAYofARRAY8 (&AuthenticationNames, AuthenticationNames.length + 1) && XdmcpReallocARRAYofARRAY8 (&AuthenticationDatas, AuthenticationDatas.length + 1) && (newFuncs = (AuthenticationFuncsPtr) malloc ( (AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec))))) { XdmcpDisposeARRAY8 (&AuthenticationName); XdmcpDisposeARRAY8 (&AuthenticationData); return; } for (i = 0; i < AuthenticationNames.length - 1; i++) newFuncs[i] = AuthenticationFuncsList[i]; newFuncs[AuthenticationNames.length-1].Validator = Validator; newFuncs[AuthenticationNames.length-1].Generator = Generator; newFuncs[AuthenticationNames.length-1].AddAuth = AddAuth; free (AuthenticationFuncsList); AuthenticationFuncsList = newFuncs; AuthenticationNames.data[AuthenticationNames.length-1] = AuthenticationName; AuthenticationDatas.data[AuthenticationDatas.length-1] = AuthenticationData; } /* * Select the authentication type to be used; this is * set by the manager of the host to be connected to. */ ARRAY8 noAuthenticationName = {(CARD16) 0, (CARD8Ptr) 0}; ARRAY8 noAuthenticationData = {(CARD16) 0, (CARD8Ptr) 0}; ARRAY8Ptr AuthenticationName = &noAuthenticationName; ARRAY8Ptr AuthenticationData = &noAuthenticationData; AuthenticationFuncsPtr AuthenticationFuncs; void XdmcpSetAuthentication (ARRAY8Ptr name) { int i; for (i = 0; i < AuthenticationNames.length; i++) if (XdmcpARRAY8Equal (&AuthenticationNames.data[i], name)) { AuthenticationName = &AuthenticationNames.data[i]; AuthenticationData = &AuthenticationDatas.data[i]; AuthenticationFuncs = &AuthenticationFuncsList[i]; break; } } /* * Register the host address for the display */ static ARRAY16 ConnectionTypes; static ARRAYofARRAY8 ConnectionAddresses; static long xdmcpGeneration; void XdmcpRegisterConnection ( int type, char *address, int addrlen) { int i; CARD8 *newAddress; if (xdmcpGeneration != serverGeneration) { XdmcpDisposeARRAY16 (&ConnectionTypes); XdmcpDisposeARRAYofARRAY8 (&ConnectionAddresses); xdmcpGeneration = serverGeneration; } if (xdm_from != NULL) { /* Only register the requested address */ const void *regAddr = address; const void *fromAddr = NULL; int regAddrlen = addrlen; if (addrlen == sizeof(struct in_addr)) { if (SOCKADDR_FAMILY(FromAddress) == AF_INET) { fromAddr = &((struct sockaddr_in *)&FromAddress)->sin_addr; } #if defined(IPv6) && defined(AF_INET6) else if ((SOCKADDR_FAMILY(FromAddress) == AF_INET6) && IN6_IS_ADDR_V4MAPPED( &((struct sockaddr_in6 *)&FromAddress)->sin6_addr)) { fromAddr = &((struct sockaddr_in6 *)&FromAddress)->sin6_addr.s6_addr[12]; } #endif } #if defined(IPv6) && defined(AF_INET6) else if (addrlen == sizeof(struct in6_addr)) { if (SOCKADDR_FAMILY(FromAddress) == AF_INET6) { fromAddr = &((struct sockaddr_in6 *)&FromAddress)->sin6_addr; } else if ((SOCKADDR_FAMILY(FromAddress) == AF_INET) && IN6_IS_ADDR_V4MAPPED((struct in6_addr *) address)) { fromAddr = &((struct sockaddr_in *)&FromAddress)->sin_addr; regAddr = &((struct sockaddr_in6 *)&address)->sin6_addr.s6_addr[12]; regAddrlen = sizeof(struct in_addr); } } #endif if (fromAddr && memcmp(regAddr, fromAddr, regAddrlen) != 0) { return; } } newAddress = (CARD8 *) malloc (addrlen * sizeof (CARD8)); if (!newAddress) return; if (!XdmcpReallocARRAY16 (&ConnectionTypes, ConnectionTypes.length + 1)) { free (newAddress); return; } if (!XdmcpReallocARRAYofARRAY8 (&ConnectionAddresses, ConnectionAddresses.length + 1)) { free (newAddress); return; } ConnectionTypes.data[ConnectionTypes.length - 1] = (CARD16) type; for (i = 0; i < addrlen; i++) newAddress[i] = address[i]; ConnectionAddresses.data[ConnectionAddresses.length-1].data = newAddress; ConnectionAddresses.data[ConnectionAddresses.length-1].length = addrlen; } /* * Register an Authorization Name. XDMCP advertises this list * to the manager. */ static ARRAYofARRAY8 AuthorizationNames; void XdmcpRegisterAuthorizations (void) { XdmcpDisposeARRAYofARRAY8 (&AuthorizationNames); RegisterAuthorizations (); } void XdmcpRegisterAuthorization (char *name, int namelen) { ARRAY8 authName; int i; authName.data = (CARD8 *) malloc (namelen * sizeof (CARD8)); if (!authName.data) return; if (!XdmcpReallocARRAYofARRAY8 (&AuthorizationNames, AuthorizationNames.length +1)) { free (authName.data); return; } for (i = 0; i < namelen; i++) authName.data[i] = (CARD8) name[i]; authName.length = namelen; AuthorizationNames.data[AuthorizationNames.length-1] = authName; } /* * Register the DisplayClass string */ ARRAY8 DisplayClass; void XdmcpRegisterDisplayClass (char *name, int length) { int i; XdmcpDisposeARRAY8 (&DisplayClass); if (!XdmcpAllocARRAY8 (&DisplayClass, length)) return; for (i = 0; i < length; i++) DisplayClass.data[i] = (CARD8) name[i]; } /* * Register the Manufacturer display ID */ ARRAY8 ManufacturerDisplayID; void XdmcpRegisterManufacturerDisplayID (char *name, int length) { int i; XdmcpDisposeARRAY8 (&ManufacturerDisplayID); if (!XdmcpAllocARRAY8 (&ManufacturerDisplayID, length)) return; for (i = 0; i < length; i++) ManufacturerDisplayID.data[i] = (CARD8) name[i]; } /* * initialize XDMCP; create the socket, compute the display * number, set up the state machine */ void XdmcpInit(void) { #ifdef NX_TRANS_SOCKET XdmcpStartTime = GetTimeInMillis(); #endif state = XDM_INIT_STATE; #ifdef HASXDMAUTH if (xdmAuthCookie) XdmAuthenticationInit (xdmAuthCookie, strlen (xdmAuthCookie)); #endif if (state != XDM_OFF) { XdmcpRegisterAuthorizations(); XdmcpRegisterDisplayClass (defaultDisplayClass, strlen (defaultDisplayClass)); AccessUsingXdmcp(); RegisterBlockAndWakeupHandlers (XdmcpBlockHandler, XdmcpWakeupHandler, (void *) 0); timeOutRtx = 0; DisplayNumber = (CARD16) atoi(display); get_xdmcp_sock(); send_packet(); } } void XdmcpReset (void) { state = XDM_INIT_STATE; if (state != XDM_OFF) { RegisterBlockAndWakeupHandlers (XdmcpBlockHandler, XdmcpWakeupHandler, (void *) 0); timeOutRtx = 0; send_packet(); } } /* * Called whenever a new connection is created; notices the * first connection and saves it to terminate the session * when it is closed */ void XdmcpOpenDisplay(int sock) { if (state != XDM_AWAIT_MANAGE_RESPONSE) return; state = XDM_RUN_SESSION; timeOutTime = GetTimeInMillis() + XDM_DEF_DORMANCY * 1000; sessionSocket = sock; } void XdmcpCloseDisplay(int sock) { if ((state != XDM_RUN_SESSION && state != XDM_AWAIT_ALIVE_RESPONSE) || sessionSocket != sock) return; state = XDM_INIT_STATE; if (OneSession) dispatchException |= DE_TERMINATE; else dispatchException |= DE_RESET; isItTimeToYield = TRUE; } /* * called before going to sleep, this routine * may modify the timeout value about to be sent * to select; in this way XDMCP can do appropriate things * dynamically while starting up */ /*ARGSUSED*/ static void XdmcpBlockHandler( void * data, /* unused */ struct timeval **wt, void * pReadmask) { fd_set *last_select_mask = (fd_set*)pReadmask; CARD32 millisToGo; if (state == XDM_OFF) return; FD_SET(xdmcpSocket, last_select_mask); #if defined(IPv6) && defined(AF_INET6) if (xdmcpSocket6 >= 0) FD_SET(xdmcpSocket6, last_select_mask); #endif if (timeOutTime == 0) return; millisToGo = timeOutTime - GetTimeInMillis(); if ((int) millisToGo < 0) millisToGo = 0; AdjustWaitForDelay (wt, millisToGo); } /* * called after select returns; this routine will * recognise when XDMCP packets await and * process them appropriately */ /*ARGSUSED*/ static void XdmcpWakeupHandler( void * data, /* unused */ int i, void * pReadmask) { fd_set* last_select_mask = (fd_set*)pReadmask; #ifdef NX_TRANS_SOCKET XdmcpState = state; XdmcpTimeOutRtx = timeOutRtx; #endif if (state == XDM_OFF) return; if (i > 0) { if (FD_ISSET(xdmcpSocket, last_select_mask)) { receive_packet(xdmcpSocket); FD_CLR(xdmcpSocket, last_select_mask); } #if defined(IPv6) && defined(AF_INET6) if (xdmcpSocket6 >= 0 && FD_ISSET(xdmcpSocket6, last_select_mask)) { receive_packet(xdmcpSocket6); FD_CLR(xdmcpSocket6, last_select_mask); } #endif } else if (timeOutTime && (int) (GetTimeInMillis() - timeOutTime) >= 0) { if (state == XDM_RUN_SESSION) { state = XDM_KEEPALIVE; send_packet(); } else timeout(); } } /* * This routine should be called from the routine that drives the * user's host menu when the user selects a host */ static void XdmcpSelectHost( struct sockaddr *host_sockaddr, int host_len, ARRAY8Ptr auth_name) { state = XDM_START_CONNECTION; memmove(&req_sockaddr, host_sockaddr, host_len); req_socklen = host_len; XdmcpSetAuthentication (auth_name); send_packet(); } /* * !!! this routine should be replaced by a routine that adds * the host to the user's host menu. the current version just * selects the first host to respond with willing message. */ /*ARGSUSED*/ static void XdmcpAddHost( struct sockaddr *from, int fromlen, ARRAY8Ptr auth_name, ARRAY8Ptr hostname, ARRAY8Ptr status) { XdmcpSelectHost(from, fromlen, auth_name); } /* * A message is queued on the socket; read it and * do the appropriate thing */ ARRAY8 UnwillingMessage = { (CARD8) 14, (CARD8 *) "Host unwilling" }; static void receive_packet(int socketfd) { #if defined(IPv6) && defined(AF_INET6) struct sockaddr_storage from; #else struct sockaddr_in from; #endif int fromlen = sizeof(from); XdmcpHeader header; /* read message off socket */ if (!XdmcpFill (socketfd, &buffer, (XdmcpNetaddr) &from, &fromlen)) return; /* reset retransmission backoff */ timeOutRtx = 0; if (!XdmcpReadHeader (&buffer, &header)) return; if (header.version != XDM_PROTOCOL_VERSION) return; switch (header.opcode) { case WILLING: recv_willing_msg((struct sockaddr *) &from, fromlen, header.length); break; case UNWILLING: XdmcpFatal("Manager unwilling", &UnwillingMessage); break; case ACCEPT: recv_accept_msg(header.length); break; case DECLINE: recv_decline_msg(header.length); break; case REFUSE: recv_refuse_msg(header.length); break; case FAILED: recv_failed_msg(header.length); break; case ALIVE: recv_alive_msg(header.length); break; } } /* * send the appropriate message given the current state */ static void send_packet(void) { int rtx; switch (state) { case XDM_QUERY: case XDM_BROADCAST: case XDM_INDIRECT: #if defined(IPv6) && defined(AF_INET6) case XDM_MULTICAST: #endif send_query_msg(); break; case XDM_START_CONNECTION: send_request_msg(); break; case XDM_MANAGE: send_manage_msg(); break; case XDM_KEEPALIVE: send_keepalive_msg(); break; default: break; } rtx = (XDM_MIN_RTX << timeOutRtx); if (rtx > XDM_MAX_RTX) rtx = XDM_MAX_RTX; timeOutTime = GetTimeInMillis() + rtx * 1000; } /* * The session is declared dead for some reason; too many * timeouts, or Keepalive failure. */ void XdmcpDeadSession (char *reason) { ErrorF ("XDM: %s, declaring session dead\n", reason); state = XDM_INIT_STATE; isItTimeToYield = TRUE; dispatchException |= DE_RESET; timeOutTime = 0; timeOutRtx = 0; send_packet(); } /* * Timeout waiting for an XDMCP response. */ static void timeout(void) { timeOutRtx++; if (state == XDM_AWAIT_ALIVE_RESPONSE && timeOutRtx >= XDM_KA_RTX_LIMIT ) { XdmcpDeadSession ("too many keepalive retransmissions"); return; } else if (timeOutRtx >= XDM_RTX_LIMIT) { /* Quit if "-once" specified, otherwise reset and try again. */ if (OneSession) { dispatchException |= DE_TERMINATE; ErrorF("XDM: too many retransmissions\n"); } else { XdmcpDeadSession("too many retransmissions"); } return; } #if defined(IPv6) && defined(AF_INET6) if (state == XDM_COLLECT_QUERY || state == XDM_COLLECT_INDIRECT_QUERY) { /* Try next address */ for (mgrAddr = mgrAddr->ai_next; ; mgrAddr = mgrAddr->ai_next) { if (mgrAddr == NULL) { mgrAddr = mgrAddrFirst; } if (mgrAddr->ai_family == AF_INET || mgrAddr->ai_family == AF_INET6) break; } #ifndef SIN6_LEN ManagerAddressLen = mgrAddr->ai_addrlen; #endif memcpy(&ManagerAddress, mgrAddr->ai_addr, mgrAddr->ai_addrlen); } #endif switch (state) { case XDM_COLLECT_QUERY: state = XDM_QUERY; break; case XDM_COLLECT_BROADCAST_QUERY: state = XDM_BROADCAST; break; #if defined(IPv6) && defined(AF_INET6) case XDM_COLLECT_MULTICAST_QUERY: state = XDM_MULTICAST; break; #endif case XDM_COLLECT_INDIRECT_QUERY: state = XDM_INDIRECT; break; case XDM_AWAIT_REQUEST_RESPONSE: state = XDM_START_CONNECTION; break; case XDM_AWAIT_MANAGE_RESPONSE: state = XDM_MANAGE; break; case XDM_AWAIT_ALIVE_RESPONSE: state = XDM_KEEPALIVE; break; default: break; } send_packet(); } int XdmcpCheckAuthentication ( ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type) { return (XdmcpARRAY8Equal (Name, AuthenticationName) && (AuthenticationName->length == 0 || (*AuthenticationFuncs->Validator) (AuthenticationData, Data, packet_type))); } int XdmcpAddAuthorization ( ARRAY8Ptr name, ARRAY8Ptr data) { AddAuthorFunc AddAuth; if (AuthenticationFuncs && AuthenticationFuncs->AddAuth) AddAuth = AuthenticationFuncs->AddAuth; else AddAuth = AddAuthorization; return (*AddAuth) ((unsigned short)name->length, (char *)name->data, (unsigned short)data->length, (char *)data->data); } /* * from here to the end of this file are routines private * to the state machine. */ static void get_xdmcp_sock(void) { int soopts = 1; #if defined(IPv6) && defined(AF_INET6) if ((xdmcpSocket6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) XdmcpWarning("INET6 UDP socket creation failed"); #endif if ((xdmcpSocket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) XdmcpWarning("UDP socket creation failed"); #ifdef SO_BROADCAST else if (setsockopt(xdmcpSocket, SOL_SOCKET, SO_BROADCAST, (char *)&soopts, sizeof(soopts)) < 0) XdmcpWarning("UDP set broadcast socket-option failed"); #endif /* SO_BROADCAST */ if (xdmcpSocket >= 0 && xdm_from != NULL) { if (bind(xdmcpSocket, (struct sockaddr *)&FromAddress, FromAddressLen) < 0) { FatalError("Xserver: failed to bind to -from address: %s\n", xdm_from); } } } static void send_query_msg(void) { XdmcpHeader header; Bool broadcast = FALSE; #if defined(IPv6) && defined(AF_INET6) Bool multicast = FALSE; #endif int i; int socketfd = xdmcpSocket; header.version = XDM_PROTOCOL_VERSION; switch(state){ case XDM_QUERY: header.opcode = (CARD16) QUERY; state = XDM_COLLECT_QUERY; break; case XDM_BROADCAST: header.opcode = (CARD16) BROADCAST_QUERY; state = XDM_COLLECT_BROADCAST_QUERY; broadcast = TRUE; break; #if defined(IPv6) && defined(AF_INET6) case XDM_MULTICAST: header.opcode = (CARD16) BROADCAST_QUERY; state = XDM_COLLECT_MULTICAST_QUERY; multicast = TRUE; break; #endif case XDM_INDIRECT: header.opcode = (CARD16) INDIRECT_QUERY; state = XDM_COLLECT_INDIRECT_QUERY; break; default: break; } header.length = 1; for (i = 0; i < AuthenticationNames.length; i++) header.length += 2 + AuthenticationNames.data[i].length; XdmcpWriteHeader (&buffer, &header); XdmcpWriteARRAYofARRAY8 (&buffer, &AuthenticationNames); if (broadcast) { for (i = 0; i < NumBroadcastAddresses; i++) XdmcpFlush (xdmcpSocket, &buffer, (XdmcpNetaddr) &BroadcastAddresses[i], sizeof (struct sockaddr_in)); } #if defined(IPv6) && defined(AF_INET6) else if (multicast) { struct multicastinfo *mcl; struct addrinfo *ai; for (mcl = mcastlist; mcl != NULL; mcl = mcl->next) { for (ai = mcl->ai ; ai != NULL; ai = ai->ai_next) { if (ai->ai_family == AF_INET) { unsigned char hopflag = (unsigned char) mcl->hops; socketfd = xdmcpSocket; setsockopt(socketfd, IPPROTO_IP, IP_MULTICAST_TTL, &hopflag, sizeof(hopflag)); } else if (ai->ai_family == AF_INET6) { int hopflag6 = mcl->hops; socketfd = xdmcpSocket6; setsockopt(socketfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &hopflag6, sizeof(hopflag6)); } else { continue; } XdmcpFlush (socketfd, &buffer, (XdmcpNetaddr) ai->ai_addr, ai->ai_addrlen); break; } } } #endif else { #if defined(IPv6) && defined(AF_INET6) if (SOCKADDR_FAMILY(ManagerAddress) == AF_INET6) socketfd = xdmcpSocket6; #endif XdmcpFlush (socketfd, &buffer, (XdmcpNetaddr) &ManagerAddress, ManagerAddressLen); } } static void recv_willing_msg( struct sockaddr *from, int fromlen, unsigned length) { ARRAY8 authenticationName; ARRAY8 hostname; ARRAY8 status; authenticationName.data = 0; hostname.data = 0; status.data = 0; if (XdmcpReadARRAY8 (&buffer, &authenticationName) && XdmcpReadARRAY8 (&buffer, &hostname) && XdmcpReadARRAY8 (&buffer, &status)) { if (length == 6 + authenticationName.length + hostname.length + status.length) { switch (state) { case XDM_COLLECT_QUERY: XdmcpSelectHost(from, fromlen, &authenticationName); break; case XDM_COLLECT_BROADCAST_QUERY: #if defined(IPv6) && defined(AF_INET6) case XDM_COLLECT_MULTICAST_QUERY: #endif case XDM_COLLECT_INDIRECT_QUERY: XdmcpAddHost(from, fromlen, &authenticationName, &hostname, &status); break; default: break; } } } XdmcpDisposeARRAY8 (&authenticationName); XdmcpDisposeARRAY8 (&hostname); XdmcpDisposeARRAY8 (&status); } static void send_request_msg(void) { XdmcpHeader header; int length; int i; CARD16 XdmcpConnectionType; ARRAY8 authenticationData; int socketfd = xdmcpSocket; switch (SOCKADDR_FAMILY(ManagerAddress)) { case AF_INET: XdmcpConnectionType=FamilyInternet; break; #if defined(IPv6) && defined(AF_INET6) case AF_INET6: XdmcpConnectionType=FamilyInternet6; break; #endif default: XdmcpConnectionType=0xffff; break; } header.version = XDM_PROTOCOL_VERSION; header.opcode = (CARD16) REQUEST; length = 2; /* display number */ length += 1 + 2 * ConnectionTypes.length; /* connection types */ length += 1; /* connection addresses */ for (i = 0; i < ConnectionAddresses.length; i++) length += 2 + ConnectionAddresses.data[i].length; authenticationData.length = 0; authenticationData.data = 0; if (AuthenticationFuncs) { (*AuthenticationFuncs->Generator) (AuthenticationData, &authenticationData, REQUEST); } length += 2 + AuthenticationName->length; /* authentication name */ length += 2 + authenticationData.length; /* authentication data */ length += 1; /* authorization names */ for (i = 0; i < AuthorizationNames.length; i++) length += 2 + AuthorizationNames.data[i].length; length += 2 + ManufacturerDisplayID.length; /* display ID */ header.length = length; if (!XdmcpWriteHeader (&buffer, &header)) { XdmcpDisposeARRAY8 (&authenticationData); return; } XdmcpWriteCARD16 (&buffer, DisplayNumber); XdmcpWriteCARD8 (&buffer, ConnectionTypes.length); /* The connection array is send reordered, so that connections of */ /* the same address type as the XDMCP manager connection are send */ /* first. This works around a bug in xdm. mario@klebsch.de */ for (i = 0; i < (int)ConnectionTypes.length; i++) if (ConnectionTypes.data[i]==XdmcpConnectionType) XdmcpWriteCARD16 (&buffer, ConnectionTypes.data[i]); for (i = 0; i < (int)ConnectionTypes.length; i++) if (ConnectionTypes.data[i]!=XdmcpConnectionType) XdmcpWriteCARD16 (&buffer, ConnectionTypes.data[i]); XdmcpWriteCARD8 (&buffer, ConnectionAddresses.length); for (i = 0; i < (int)ConnectionAddresses.length; i++) if ( (i=ConnectionTypes.length) || (ConnectionTypes.data[i]!=XdmcpConnectionType) ) XdmcpWriteARRAY8 (&buffer, &ConnectionAddresses.data[i]); XdmcpWriteARRAY8 (&buffer, AuthenticationName); XdmcpWriteARRAY8 (&buffer, &authenticationData); XdmcpDisposeARRAY8 (&authenticationData); XdmcpWriteARRAYofARRAY8 (&buffer, &AuthorizationNames); XdmcpWriteARRAY8 (&buffer, &ManufacturerDisplayID); #if defined(IPv6) && defined(AF_INET6) if (SOCKADDR_FAMILY(req_sockaddr) == AF_INET6) socketfd = xdmcpSocket6; #endif if (XdmcpFlush (socketfd, &buffer, (XdmcpNetaddr) &req_sockaddr, req_socklen)) state = XDM_AWAIT_REQUEST_RESPONSE; } static void recv_accept_msg(unsigned length) { CARD32 AcceptSessionID; ARRAY8 AcceptAuthenticationName, AcceptAuthenticationData; ARRAY8 AcceptAuthorizationName, AcceptAuthorizationData; if (state != XDM_AWAIT_REQUEST_RESPONSE) return; AcceptAuthenticationName.data = 0; AcceptAuthenticationData.data = 0; AcceptAuthorizationName.data = 0; AcceptAuthorizationData.data = 0; if (XdmcpReadCARD32 (&buffer, &AcceptSessionID) && XdmcpReadARRAY8 (&buffer, &AcceptAuthenticationName) && XdmcpReadARRAY8 (&buffer, &AcceptAuthenticationData) && XdmcpReadARRAY8 (&buffer, &AcceptAuthorizationName) && XdmcpReadARRAY8 (&buffer, &AcceptAuthorizationData)) { if (length == 12 + AcceptAuthenticationName.length + AcceptAuthenticationData.length + AcceptAuthorizationName.length + AcceptAuthorizationData.length) { if (!XdmcpCheckAuthentication (&AcceptAuthenticationName, &AcceptAuthenticationData, ACCEPT)) { XdmcpFatal ("Authentication Failure", &AcceptAuthenticationName); } /* permit access control manipulations from this host */ AugmentSelf (&req_sockaddr, req_socklen); /* if the authorization specified in the packet fails * to be acceptable, enable the local addresses */ if (!XdmcpAddAuthorization (&AcceptAuthorizationName, &AcceptAuthorizationData)) { AddLocalHosts (); } SessionID = AcceptSessionID; state = XDM_MANAGE; send_packet(); } } XdmcpDisposeARRAY8 (&AcceptAuthenticationName); XdmcpDisposeARRAY8 (&AcceptAuthenticationData); XdmcpDisposeARRAY8 (&AcceptAuthorizationName); XdmcpDisposeARRAY8 (&AcceptAuthorizationData); } static void recv_decline_msg(unsigned length) { ARRAY8 status, DeclineAuthenticationName, DeclineAuthenticationData; status.data = 0; DeclineAuthenticationName.data = 0; DeclineAuthenticationData.data = 0; if (XdmcpReadARRAY8 (&buffer, &status) && XdmcpReadARRAY8 (&buffer, &DeclineAuthenticationName) && XdmcpReadARRAY8 (&buffer, &DeclineAuthenticationData)) { if (length == 6 + status.length + DeclineAuthenticationName.length + DeclineAuthenticationData.length && XdmcpCheckAuthentication (&DeclineAuthenticationName, &DeclineAuthenticationData, DECLINE)) { XdmcpFatal ("Session declined", &status); } } XdmcpDisposeARRAY8 (&status); XdmcpDisposeARRAY8 (&DeclineAuthenticationName); XdmcpDisposeARRAY8 (&DeclineAuthenticationData); } static void send_manage_msg(void) { XdmcpHeader header; int socketfd = xdmcpSocket; header.version = XDM_PROTOCOL_VERSION; header.opcode = (CARD16) MANAGE; header.length = 8 + DisplayClass.length; if (!XdmcpWriteHeader (&buffer, &header)) return; XdmcpWriteCARD32 (&buffer, SessionID); XdmcpWriteCARD16 (&buffer, DisplayNumber); XdmcpWriteARRAY8 (&buffer, &DisplayClass); state = XDM_AWAIT_MANAGE_RESPONSE; #if defined(IPv6) && defined(AF_INET6) if (SOCKADDR_FAMILY(req_sockaddr) == AF_INET6) socketfd = xdmcpSocket6; #endif XdmcpFlush (socketfd, &buffer, (XdmcpNetaddr) &req_sockaddr, req_socklen); } static void recv_refuse_msg(unsigned length) { CARD32 RefusedSessionID; if (state != XDM_AWAIT_MANAGE_RESPONSE) return; if (length != 4) return; if (XdmcpReadCARD32 (&buffer, &RefusedSessionID)) { if (RefusedSessionID == SessionID) { state = XDM_START_CONNECTION; send_packet(); } } } static void recv_failed_msg(unsigned length) { CARD32 FailedSessionID; ARRAY8 status; if (state != XDM_AWAIT_MANAGE_RESPONSE) return; status.data = 0; if (XdmcpReadCARD32 (&buffer, &FailedSessionID) && XdmcpReadARRAY8 (&buffer, &status)) { if (length == 6 + status.length && SessionID == FailedSessionID) { XdmcpFatal ("Session failed", &status); } } XdmcpDisposeARRAY8 (&status); } static void send_keepalive_msg(void) { XdmcpHeader header; int socketfd = xdmcpSocket; header.version = XDM_PROTOCOL_VERSION; header.opcode = (CARD16) KEEPALIVE; header.length = 6; XdmcpWriteHeader (&buffer, &header); XdmcpWriteCARD16 (&buffer, DisplayNumber); XdmcpWriteCARD32 (&buffer, SessionID); state = XDM_AWAIT_ALIVE_RESPONSE; #if defined(IPv6) && defined(AF_INET6) if (SOCKADDR_FAMILY(req_sockaddr) == AF_INET6) socketfd = xdmcpSocket6; #endif XdmcpFlush (socketfd, &buffer, (XdmcpNetaddr) &req_sockaddr, req_socklen); } static void recv_alive_msg (unsigned length) { CARD8 SessionRunning; CARD32 AliveSessionID; if (state != XDM_AWAIT_ALIVE_RESPONSE) return; if (length != 5) return; if (XdmcpReadCARD8 (&buffer, &SessionRunning) && XdmcpReadCARD32 (&buffer, &AliveSessionID)) { if (SessionRunning && AliveSessionID == SessionID) { state = XDM_RUN_SESSION; timeOutTime = GetTimeInMillis() + XDM_DEF_DORMANCY * 1000; } else { XdmcpDeadSession ("Alive response indicates session dead"); } } } static void XdmcpFatal ( char *type, ARRAY8Ptr status) { FatalError ("XDMCP fatal error: %s %*.*s\n", type, status->length, status->length, status->data); } static void XdmcpWarning(char *str) { ErrorF("XDMCP warning: %s\n", str); } static void get_addr_by_name( char * argtype, char * namestr, int port, int socktype, SOCKADDR_TYPE *addr, SOCKLEN_TYPE *addrlen #if defined(IPv6) && defined(AF_INET6) , struct addrinfo **aip, struct addrinfo **aifirstp #endif ) { #if defined(IPv6) && defined(AF_INET6) struct addrinfo *ai; struct addrinfo hints; char portstr[6]; char *pport = portstr; int gaierr; bzero(&hints, sizeof(hints)); hints.ai_socktype = socktype; if (port == 0) { pport = NULL; } else if (port > 0 && port < 65535) { sprintf(portstr, "%d", port); } else { FatalError("Xserver: port out of range: %d\n", port); } if (*aifirstp != NULL) { freeaddrinfo(*aifirstp); *aifirstp = NULL; } if ((gaierr = getaddrinfo(namestr, pport, &hints, aifirstp)) == 0) { for (ai = *aifirstp; ai != NULL; ai = ai->ai_next) { if (ai->ai_family == AF_INET || ai->ai_family == AF_INET6) break; } if ((ai == NULL) || (ai->ai_addrlen > sizeof(SOCKADDR_TYPE))) { FatalError ("Xserver: %s host %s not on supported network type\n", argtype, namestr); } else { *aip = ai; *addrlen = ai->ai_addrlen; memcpy(addr, ai->ai_addr, ai->ai_addrlen); } } else { FatalError("Xserver: %s: %s %s\n", gai_strerror(gaierr), argtype, namestr); } #else struct hostent *hep; #ifdef XTHREADS_NEEDS_BYNAMEPARAMS _Xgethostbynameparams hparams; #endif if (!(hep = _XGethostbyname(namestr, hparams))) { FatalError("Xserver: %s unknown host: %s\n", argtype, namestr); } if (hep->h_length == sizeof (struct in_addr)) { memmove(&addr->sin_addr, hep->h_addr, hep->h_length); *addrlen = sizeof(struct sockaddr_in); addr->sin_family = AF_INET; addr->sin_port = htons (port); } else { FatalError("Xserver: %s host on strange network %s\n", argtype, namestr); } #endif } static void get_manager_by_name( int argc, char **argv, int i) { if ((i + 1) == argc) { FatalError("Xserver: missing %s host name in command line\n", argv[i]); } get_addr_by_name(argv[i], argv[i+1], xdm_udp_port, SOCK_DGRAM, &ManagerAddress, &ManagerAddressLen #if defined(IPv6) && defined(AF_INET6) , &mgrAddr, &mgrAddrFirst #endif ); } static void get_fromaddr_by_name( int argc, char **argv, int i) { #if defined(IPv6) && defined(AF_INET6) struct addrinfo *ai = NULL; struct addrinfo *aifirst = NULL; #endif if (i == argc) { FatalError("Xserver: missing -from host name in command line\n"); } get_addr_by_name("-from", argv[i], 0, 0, &FromAddress, &FromAddressLen #if defined(IPv6) && defined(AF_INET6) , &ai, &aifirst #endif ); xdm_from = argv[i]; } #if defined(IPv6) && defined(AF_INET6) static int get_mcast_options(argc, argv, i) int argc, i; char **argv; { char *address = XDM_DEFAULT_MCAST_ADDR6; int hopcount = 1; struct addrinfo hints; char portstr[6]; int gaierr; struct addrinfo *ai, *firstai; if ((i < argc) && (argv[i][0] != '-') && (argv[i][0] != '+')) { address = argv[i++]; if ((i < argc) && (argv[i][0] != '-') && (argv[i][0] != '+')) { hopcount = strtol(argv[i++], NULL, 10); if ((hopcount < 1) || (hopcount > 255)) { FatalError("Xserver: multicast hop count out of range: %d\n", hopcount); } } } if (xdm_udp_port > 0 && xdm_udp_port < 65535) { sprintf(portstr, "%d", xdm_udp_port); } else { FatalError("Xserver: port out of range: %d\n", xdm_udp_port); } bzero(&hints, sizeof(hints)); hints.ai_socktype = SOCK_DGRAM; if ((gaierr = getaddrinfo(address, portstr, &hints, &firstai)) == 0) { for (ai = firstai; ai != NULL; ai = ai->ai_next) { if (((ai->ai_family == AF_INET) && IN_MULTICAST(((struct sockaddr_in *) ai->ai_addr) ->sin_addr.s_addr)) || ((ai->ai_family == AF_INET6) && IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *) ai->ai_addr) ->sin6_addr))) break; } if (ai == NULL) { FatalError ("Xserver: address not supported multicast type %s\n", address); } else { struct multicastinfo *mcastinfo, *mcl; mcastinfo = malloc(sizeof(struct multicastinfo)); mcastinfo->next = NULL; mcastinfo->ai = firstai; mcastinfo->hops = hopcount; if (mcastlist == NULL) { mcastlist = mcastinfo; } else { for (mcl = mcastlist; mcl->next != NULL; mcl = mcl->next) { /* Do nothing - just find end of list */ } mcl->next = mcastinfo; } } } else { FatalError("Xserver: %s: %s\n", gai_strerror(gaierr), address); } return i; } #endif #else static int xdmcp_non_empty; /* avoid complaint by ranlib */ #endif /* XDMCP */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/xprintf.c0000644000000000000000000001774213614532331017065 0ustar /** * @file * * @section DESCRIPTION * * These functions provide a portable implementation of the common (but not * yet universal) asprintf & vasprintf routines to allocate a buffer big * enough to sprintf the arguments to. The XNF variants terminate the server * if the allocation fails. */ /* * Copyright (c) 2004 Alexander Gottwald * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name(s) of the above copyright * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "os.h" #include #include #include #include #ifdef asprintf #undef asprintf #endif #ifdef vasprintf #undef vasprintf #endif #ifndef va_copy #ifdef __va_copy #define va_copy __va_copy #else #error "no working va_copy was found" #endif #endif /** * Varargs sprintf that allocates a string buffer the right size for * the pattern & data provided and prints the requested data to it. * * @param ret Pointer to which the newly allocated buffer is written * (contents undefined on error) * @param format printf style format string * @param va variable argument list * @return size of allocated buffer, or -1 on error. */ int Xvasprintf(char **ret, const char *_X_RESTRICT_KYWD format, va_list va) { #ifdef HAVE_VASPRINTF return vasprintf(ret, format, va); #else int size; va_list va2; va_copy(va2, va); size = vsnprintf(NULL, 0, format, va2); va_end(va2); *ret = malloc(size + 1); if (*ret == NULL) return -1; vsnprintf(*ret, size + 1, format, va); (*ret)[size] = 0; return size; #endif } #ifndef HAVE_VASPRINTF #define vasprintf Xvasprintf #endif /** * sprintf that allocates a string buffer the right size for * the pattern & data provided and prints the requested data to it. * * @param ret Pointer to which the newly allocated buffer is written * (contents undefined on error) * @param format printf style format string * @param ... arguments for specified format * @return size of allocated buffer, or -1 on error. */ int Xasprintf(char **ret, const char *_X_RESTRICT_KYWD format, ...) { int size; va_list va; va_start(va, format); size = vasprintf(ret, format, va); va_end(va); return size; } /** * Varargs sprintf that allocates a string buffer the right size for * the pattern & data provided and prints the requested data to it. * On failure, issues a FatalError message and aborts the server. * * @param ret Pointer to which the newly allocated buffer is written * (contents undefined on error) * @param format printf style format string * @param va variable argument list * @return size of allocated buffer */ int XNFvasprintf(char **ret, const char *_X_RESTRICT_KYWD format, va_list va) { int size = vasprintf(ret, format, va); if ((size == -1) || (*ret == NULL)) { FatalError("XNFvasprintf failed: %s", strerror(errno)); } return size; } /** * sprintf that allocates a string buffer the right size for * the pattern & data provided and prints the requested data to it. * On failure, issues a FatalError message and aborts the server. * * @param ret Pointer to which the newly allocated buffer is written * (contents undefined on error) * @param format printf style format string * @param ... arguments for specified format * @return size of allocated buffer */ int XNFasprintf(char **ret, const char *_X_RESTRICT_KYWD format, ...) { int size; va_list va; va_start(va, format); size = XNFvasprintf(ret, format, va); va_end(va); return size; } /** * Varargs snprintf that returns the actual number of bytes (excluding final * '\0') that were copied into the buffer. * This is opposed to the normal sprintf() usually returns the number of bytes * that would have been written. * * @param s buffer to copy into * @param n size of buffer s * @param format printf style format string * @param va variable argument list * @return number of bytes actually copied, excluding final '\0' */ int Xvscnprintf(char *s, int n, const char *format, va_list args) { int x; if (n == 0) return 0; x = vsnprintf(s, n , format, args); return (x >= n) ? (n - 1) : x; } /** * snprintf that returns the actual number of bytes (excluding final '\0') that * were copied into the buffer. * This is opposed to the normal sprintf() usually returns the number of bytes * that would have been written. * * @param s buffer to copy into * @param n size of buffer s * @param format printf style format string * @param ... arguments for specified format * @return number of bytes actually copied, excluding final '\0' */ int Xscnprintf(char *s, int n, const char *format, ...) { int x; va_list ap; va_start(ap, format); x = Xvscnprintf(s, n, format, ap); va_end(ap); return x; } /* Old api, now deprecated, may be removed in the future */ char * Xvprintf(const char *format, va_list va) { char *ret; if (vasprintf(&ret, format, va) == -1) ret = NULL; return ret; } char * Xprintf(const char *format, ...) { char *ret; va_list va; va_start(va, format); if (vasprintf(&ret, format, va) == -1) ret = NULL; va_end(va); return ret; } char * XNFvprintf(const char *format, va_list va) { char *ret; XNFvasprintf(&ret, format, va); return ret; } char * XNFprintf(const char *format, ...) { char *ret; va_list va; va_start(va, format); XNFvasprintf(&ret, format, va); va_end(va); return ret; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/os/xstrans.c0000644000000000000000000000050513614532331017062 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* ErrorF is used by xtrans */ #ifndef HAVE_DIX_CONFIG_H extern _X_EXPORT void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1, 2); #endif #define TRANS_REOPEN #define TRANS_SERVER #define XSERV_t #include nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/Imakefile0000644000000000000000000000570113614532331017515 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include NULL = SRCS = randr.c \ rrcrtc.c \ rrdispatch.c \ rrinfo.c \ rrmode.c \ rrmonitor.c \ rroutput.c \ rrpointer.c \ rrproperty.c \ rrprovider.c \ rrproviderproperty.c \ rrscreen.c \ rrsdispatch.c \ rrtransform.c \ rrxinerama.c \ $(NULL) OBJS = randr.o \ rrcrtc.o \ rrdispatch.o \ rrinfo.o \ rrmode.o \ rrmonitor.o \ rroutput.o \ rrpointer.o \ rrproperty.o \ rrprovider.o \ rrproviderproperty.o \ rrscreen.o \ rrsdispatch.o \ rrtransform.o \ rrxinerama.o \ $(NULL) INCLUDES = -I../include -I../mi \ -I../fb -I$(EXTINCSRC) -I$(XINCLUDESRC) \ -I../render \ `pkg-config --cflags-only-I pixman-1` #if defined(BuildXinerama) PNRX_DEFINES = -DXINERAMA -DPANORAMIX #endif #if defined(NXAgentServer) && NXAgentServer NX_DEFINES = -DNXAGENT_SERVER #endif LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln DEFINES = \ $(PNRX_DEFINES) \ $(NX_DEFINES) \ $(NULL) NormalLibraryTarget(randr,$(OBJS)) NormalLibraryObjectRule() LintLibraryTarget(randr,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/panoramiXproto.h0000644000000000000000000001345213614532331021101 0ustar /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ #ifndef _PANORAMIXPROTO_H_ #define _PANORAMIXPROTO_H_ #define PANORAMIX_PROTOCOL_NAME "XINERAMA" #define X_PanoramiXQueryVersion 0 #define X_PanoramiXGetState 1 #define X_PanoramiXGetScreenCount 2 #define X_PanoramiXGetScreenSize 3 #define X_XineramaIsActive 4 #define X_XineramaQueryScreens 5 typedef struct _PanoramiXQueryVersion { CARD8 reqType; /* always PanoramiXReqCode */ CARD8 panoramiXReqType; /* always X_PanoramiXQueryVersion */ CARD16 length B16; CARD8 clientMajor; CARD8 clientMinor; CARD16 unused B16; } xPanoramiXQueryVersionReq; #define sz_xPanoramiXQueryVersionReq 8 typedef struct { CARD8 type; /* must be X_Reply */ CARD8 pad1; /* unused */ CARD16 sequenceNumber B16; /* last sequence number */ CARD32 length B32; /* 0 */ CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad2 B32; /* unused */ CARD32 pad3 B32; /* unused */ CARD32 pad4 B32; /* unused */ CARD32 pad5 B32; /* unused */ CARD32 pad6 B32; /* unused */ } xPanoramiXQueryVersionReply; #define sz_xPanoramiXQueryVersionReply 32 typedef struct _PanoramiXGetState { CARD8 reqType; /* always PanoramiXReqCode */ CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ CARD16 length B16; CARD32 window B32; } xPanoramiXGetStateReq; #define sz_xPanoramiXGetStateReq 8 typedef struct { BYTE type; BYTE state; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 window B32; CARD32 pad1 B32; /* unused */ CARD32 pad2 B32; /* unused */ CARD32 pad3 B32; /* unused */ CARD32 pad4 B32; /* unused */ CARD32 pad5 B32; /* unused */ } xPanoramiXGetStateReply; #define sz_panoramiXGetStateReply 32 typedef struct _PanoramiXGetScreenCount { CARD8 reqType; /* always PanoramiXReqCode */ CARD8 panoramiXReqType; /* always X_PanoramiXGetScreenCount */ CARD16 length B16; CARD32 window B32; } xPanoramiXGetScreenCountReq; #define sz_xPanoramiXGetScreenCountReq 8 typedef struct { BYTE type; BYTE ScreenCount; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 window B32; CARD32 pad1 B32; /* unused */ CARD32 pad2 B32; /* unused */ CARD32 pad3 B32; /* unused */ CARD32 pad4 B32; /* unused */ CARD32 pad5 B32; /* unused */ } xPanoramiXGetScreenCountReply; #define sz_panoramiXGetScreenCountReply 32 typedef struct _PanoramiXGetScreenSize { CARD8 reqType; /* always PanoramiXReqCode */ CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ CARD16 length B16; CARD32 window B32; CARD32 screen B32; } xPanoramiXGetScreenSizeReq; #define sz_xPanoramiXGetScreenSizeReq 12 typedef struct { BYTE type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 width B32; CARD32 height B32; CARD32 window B32; CARD32 screen B32; CARD32 pad2 B32; /* unused */ CARD32 pad3 B32; /* unused */ } xPanoramiXGetScreenSizeReply; #define sz_panoramiXGetScreenSizeReply 32 /************ Alternate protocol ******************/ typedef struct { CARD8 reqType; CARD8 panoramiXReqType; CARD16 length B16; } xXineramaIsActiveReq; #define sz_xXineramaIsActiveReq 4 typedef struct { BYTE type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 state B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXineramaIsActiveReply; #define sz_XineramaIsActiveReply 32 typedef struct { CARD8 reqType; CARD8 panoramiXReqType; CARD16 length B16; } xXineramaQueryScreensReq; #define sz_xXineramaQueryScreensReq 4 typedef struct { BYTE type; CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 number B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXineramaQueryScreensReply; #define sz_XineramaQueryScreensReply 32 typedef struct { INT16 x_org B16; INT16 y_org B16; CARD16 width B16; CARD16 height B16; } xXineramaScreenInfo; #define sz_XineramaScreenInfo 8 #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/randr.c0000644000000000000000000005777013614532331017173 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Copyright © 2000 Compaq Computer Corporation * Copyright © 2002 Hewlett-Packard Company * Copyright © 2006 Intel Corporation * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Jim Gettys, Hewlett-Packard Company, Inc. * Keith Packard, Intel Corporation */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "randrstr.h" #ifndef NXAGENT_SERVER #include "extinit.h" #endif /* From render.h */ #ifndef SubPixelUnknown #define SubPixelUnknown 0 #endif #define RR_VALIDATE static int RRNScreens; #define wrap(priv,real,mem,func) {\ ((ScreenPtr)priv)->mem = ((ScreenPtr)real)->mem; \ ((ScreenPtr)real)->mem = func; \ } #define unwrap(priv,real,mem) {\ ((ScreenPtr)real)->mem = ((ScreenPtr)priv)->mem; \ } static int ProcRRDispatch(ClientPtr pClient); static int SProcRRDispatch(ClientPtr pClient); int RREventBase; int RRErrorBase; RESTYPE RRClientType, RREventType; /* resource types for event masks */ #ifndef NXAGENT_SERVER DevPrivateKey RRClientPrivateKey = &RRClientPrivateKey; DevPrivateKey rrPrivKey = &rrPrivKey; #else int RRClientPrivateIndex; int rrPrivIndex = -1; #endif static void RRClientCallback(CallbackListPtr *list, void *closure, void *data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; rrClientPriv(pClient); RRTimesPtr pTimes = (RRTimesPtr) (pRRClient + 1); int i; pRRClient->major_version = 0; pRRClient->minor_version = 0; for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; rrScrPriv(pScreen); if (pScrPriv) { pTimes[i].setTime = pScrPriv->lastSetTime; pTimes[i].configTime = pScrPriv->lastConfigTime; } } } static Bool RRCloseScreen( ScreenPtr pScreen) { rrScrPriv(pScreen); int j; unwrap(pScrPriv, pScreen, CloseScreen); for (j = pScrPriv->numCrtcs - 1; j >= 0; j--) RRCrtcDestroy(pScrPriv->crtcs[j]); for (j = pScrPriv->numOutputs - 1; j >= 0; j--) RROutputDestroy(pScrPriv->outputs[j]); if (pScrPriv->provider) RRProviderDestroy(pScrPriv->provider); RRMonitorClose(pScreen); free(pScrPriv->crtcs); free(pScrPriv->outputs); free(pScrPriv); RRNScreens -= 1; /* ok, one fewer screen with RandR running */ return (*pScreen->CloseScreen) (pScreen); } static void SRRScreenChangeNotifyEvent(xRRScreenChangeNotifyEvent * from, xRRScreenChangeNotifyEvent * to) { to->type = from->type; to->rotation = from->rotation; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->timestamp, to->timestamp); cpswapl(from->configTimestamp, to->configTimestamp); cpswapl(from->root, to->root); cpswapl(from->window, to->window); cpswaps(from->sizeID, to->sizeID); cpswaps(from->subpixelOrder, to->subpixelOrder); cpswaps(from->widthInPixels, to->widthInPixels); cpswaps(from->heightInPixels, to->heightInPixels); cpswaps(from->widthInMillimeters, to->widthInMillimeters); cpswaps(from->heightInMillimeters, to->heightInMillimeters); } static void SRRCrtcChangeNotifyEvent(xRRCrtcChangeNotifyEvent * from, xRRCrtcChangeNotifyEvent * to) { to->type = from->type; to->subCode = from->subCode; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->timestamp, to->timestamp); cpswapl(from->window, to->window); cpswapl(from->crtc, to->crtc); cpswapl(from->mode, to->mode); cpswaps(from->rotation, to->rotation); /* pad1 */ cpswaps(from->x, to->x); cpswaps(from->y, to->y); cpswaps(from->width, to->width); cpswaps(from->height, to->height); } static void SRROutputChangeNotifyEvent(xRROutputChangeNotifyEvent * from, xRROutputChangeNotifyEvent * to) { to->type = from->type; to->subCode = from->subCode; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->timestamp, to->timestamp); cpswapl(from->configTimestamp, to->configTimestamp); cpswapl(from->window, to->window); cpswapl(from->output, to->output); cpswapl(from->crtc, to->crtc); cpswapl(from->mode, to->mode); cpswaps(from->rotation, to->rotation); to->connection = from->connection; to->subpixelOrder = from->subpixelOrder; } static void SRROutputPropertyNotifyEvent(xRROutputPropertyNotifyEvent * from, xRROutputPropertyNotifyEvent * to) { to->type = from->type; to->subCode = from->subCode; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->window, to->window); cpswapl(from->output, to->output); cpswapl(from->atom, to->atom); cpswapl(from->timestamp, to->timestamp); to->state = from->state; /* pad1 */ /* pad2 */ /* pad3 */ /* pad4 */ } static void SRRProviderChangeNotifyEvent(xRRProviderChangeNotifyEvent * from, xRRProviderChangeNotifyEvent * to) { to->type = from->type; to->subCode = from->subCode; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->timestamp, to->timestamp); cpswapl(from->window, to->window); cpswapl(from->provider, to->provider); } static void SRRProviderPropertyNotifyEvent(xRRProviderPropertyNotifyEvent * from, xRRProviderPropertyNotifyEvent * to) { to->type = from->type; to->subCode = from->subCode; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->window, to->window); cpswapl(from->provider, to->provider); cpswapl(from->atom, to->atom); cpswapl(from->timestamp, to->timestamp); to->state = from->state; /* pad1 */ /* pad2 */ /* pad3 */ /* pad4 */ } static void SRRResourceChangeNotifyEvent(xRRResourceChangeNotifyEvent * from, xRRResourceChangeNotifyEvent * to) { to->type = from->type; to->subCode = from->subCode; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->timestamp, to->timestamp); cpswapl(from->window, to->window); } static void SRRNotifyEvent(xEvent *from, xEvent *to) { switch (from->u.u.detail) { case RRNotify_CrtcChange: SRRCrtcChangeNotifyEvent((xRRCrtcChangeNotifyEvent *) from, (xRRCrtcChangeNotifyEvent *) to); break; case RRNotify_OutputChange: SRROutputChangeNotifyEvent((xRROutputChangeNotifyEvent *) from, (xRROutputChangeNotifyEvent *) to); break; case RRNotify_OutputProperty: SRROutputPropertyNotifyEvent((xRROutputPropertyNotifyEvent *) from, (xRROutputPropertyNotifyEvent *) to); break; case RRNotify_ProviderChange: SRRProviderChangeNotifyEvent((xRRProviderChangeNotifyEvent *) from, (xRRProviderChangeNotifyEvent *) to); break; case RRNotify_ProviderProperty: SRRProviderPropertyNotifyEvent((xRRProviderPropertyNotifyEvent *) from, (xRRProviderPropertyNotifyEvent *) to); break; case RRNotify_ResourceChange: SRRResourceChangeNotifyEvent((xRRResourceChangeNotifyEvent *) from, (xRRResourceChangeNotifyEvent *) to); default: break; } } static int RRGeneration; Bool RRInit(void) { if (RRGeneration != serverGeneration) { #ifdef NXAGENT_SERVER if ((rrPrivIndex = AllocateScreenPrivateIndex()) < 0) return FALSE; #endif if (!RRModeInit()) return FALSE; if (!RRCrtcInit()) return FALSE; if (!RROutputInit()) return FALSE; if (!RRProviderInit()) return FALSE; RRGeneration = serverGeneration; } #ifndef NXAGENT_SERVER if (!dixRegisterPrivateKey(&rrPrivKeyRec, PRIVATE_SCREEN, 0)) return FALSE; #endif /* !defined(NXAGENT_SERVER) */ return TRUE; } Bool RRScreenInit(ScreenPtr pScreen) { rrScrPrivPtr pScrPriv; if (!RRInit()) return FALSE; pScrPriv = (rrScrPrivPtr) calloc(1, sizeof(rrScrPrivRec)); if (!pScrPriv) return FALSE; SetRRScreen(pScreen, pScrPriv); /* * Calling function best set these function vectors */ pScrPriv->rrGetInfo = 0; pScrPriv->maxWidth = pScrPriv->minWidth = pScreen->width; pScrPriv->maxHeight = pScrPriv->minHeight = pScreen->height; pScrPriv->width = pScreen->width; pScrPriv->height = pScreen->height; pScrPriv->mmWidth = pScreen->mmWidth; pScrPriv->mmHeight = pScreen->mmHeight; #if RANDR_12_INTERFACE pScrPriv->rrScreenSetSize = NULL; pScrPriv->rrCrtcSet = NULL; pScrPriv->rrCrtcSetGamma = NULL; #endif #if RANDR_10_INTERFACE pScrPriv->rrSetConfig = 0; pScrPriv->rotations = RR_Rotate_0; pScrPriv->reqWidth = pScreen->width; pScrPriv->reqHeight = pScreen->height; pScrPriv->nSizes = 0; pScrPriv->pSizes = NULL; pScrPriv->rotation = RR_Rotate_0; pScrPriv->rate = 0; pScrPriv->size = 0; #endif /* * This value doesn't really matter -- any client must call * GetScreenInfo before reading it which will automatically update * the time */ pScrPriv->lastSetTime = currentTime; pScrPriv->lastConfigTime = currentTime; wrap(pScrPriv, pScreen, CloseScreen, RRCloseScreen); pScreen->ConstrainCursorHarder = RRConstrainCursorHarder; pScreen->ReplaceScanoutPixmap = RRReplaceScanoutPixmap; pScrPriv->numOutputs = 0; pScrPriv->outputs = NULL; pScrPriv->numCrtcs = 0; pScrPriv->crtcs = NULL; RRMonitorInit(pScreen); RRNScreens += 1; /* keep count of screens that implement randr */ return TRUE; } /*ARGSUSED*/ static int RRFreeClient(void *data, XID id) { RREventPtr pRREvent; WindowPtr pWin; RREventPtr *pHead, pCur, pPrev; pRREvent = (RREventPtr) data; pWin = pRREvent->window; #ifndef NXAGENT_SERVER dixLookupResourceByType((void **) &pHead, pWin->drawable.id, RREventType, serverClient, DixDestroyAccess); #else /* !defined(NXAGENT_SERVER) */ pHead = (RREventPtr *) LookupIDByType(pWin->drawable.id, RREventType); #endif /* !defined(NXAGENT_SERVER) */ if (pHead) { pPrev = 0; for (pCur = *pHead; pCur && pCur != pRREvent; pCur = pCur->next) pPrev = pCur; if (pCur) { if (pPrev) pPrev->next = pRREvent->next; else *pHead = pRREvent->next; } } free((void *) pRREvent); return 1; } /*ARGSUSED*/ static int RRFreeEvents(void *data, XID id) { RREventPtr *pHead, pCur, pNext; pHead = (RREventPtr *) data; for (pCur = *pHead; pCur; pCur = pNext) { pNext = pCur->next; FreeResource(pCur->clientResource, RRClientType); free((void *) pCur); } free((void *) pHead); return 1; } void RRExtensionInit(void) { ExtensionEntry *extEntry; if (RRNScreens == 0) return; #ifndef NXAGENT_SERVER if (!dixRegisterPrivateKey(&RRClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(RRClientRec) + screenInfo.numScreens * sizeof(RRTimesRec))) return; #else /* !defined(NXAGENT_SERVER) */ RRClientPrivateIndex = AllocateClientPrivateIndex(); if (!AllocateClientPrivate(RRClientPrivateIndex, sizeof(RRClientRec) + screenInfo.numScreens * sizeof(RRTimesRec))) return; #endif /* !defined(NXAGENT_SERVER) */ if (!AddCallback(&ClientStateCallback, RRClientCallback, 0)) return; RRClientType = CreateNewResourceType(RRFreeClient #ifndef NXAGENT_SERVER , "RandRClient" #endif ); if (!RRClientType) return; #ifdef NXAGENT_SERVER RegisterResourceName(RRClientType, "RandRClient"); #endif RREventType = CreateNewResourceType(RRFreeEvents #ifndef NXAGENT_SERVER , "RandREvent" #endif ); if (!RREventType) return; #ifdef NXAGENT_SERVER RegisterResourceName(RREventType, "RandREvent"); #endif extEntry = AddExtension(RANDR_NAME, RRNumberEvents, RRNumberErrors, ProcRRDispatch, SProcRRDispatch, NULL, StandardMinorOpcode); if (!extEntry) return; RRErrorBase = extEntry->errorBase; RREventBase = extEntry->eventBase; EventSwapVector[RREventBase + RRScreenChangeNotify] = (EventSwapPtr) SRRScreenChangeNotifyEvent; EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr) SRRNotifyEvent; RRModeInitErrorValue(); RRCrtcInitErrorValue(); RROutputInitErrorValue(); RRProviderInitErrorValue(); #ifdef PANORAMIX RRXineramaExtensionInit(); #endif } void RRResourcesChanged(ScreenPtr pScreen) { rrScrPriv(pScreen); pScrPriv->resourcesChanged = TRUE; RRSetChanged(pScreen); } static void RRDeliverResourceEvent(ClientPtr client, WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; rrScrPriv(pScreen); xRRResourceChangeNotifyEvent re = { .type = RRNotify + RREventBase, .subCode = RRNotify_ResourceChange, #ifdef NXAGENT_SERVER .sequenceNumber = client->sequence, #endif .timestamp = pScrPriv->lastSetTime.milliseconds, .window = pWin->drawable.id }; WriteEventsToClient(client, 1, (xEvent *) &re); } static int TellChanged(WindowPtr pWin, void *value) { RREventPtr *pHead, pRREvent; ClientPtr client; ScreenPtr pScreen = pWin->drawable.pScreen; #ifndef NXAGENT_SERVER ScreenPtr iter; rrScrPrivPtr pSlaveScrPriv; #endif rrScrPriv(pScreen); int i; #ifndef NXAGENT_SERVER dixLookupResourceByType((void **) &pHead, pWin->drawable.id, RREventType, serverClient, DixReadAccess); #else /* !defined(NXAGENT_SERVER) */ pHead = (RREventPtr *) LookupIDByType(pWin->drawable.id, RREventType); #endif /* !defined(NXAGENT_SERVER) */ if (!pHead) return WT_WALKCHILDREN; for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) { client = pRREvent->client; if (client == serverClient || client->clientGone) continue; if (pRREvent->mask & RRScreenChangeNotifyMask) RRDeliverScreenEvent(client, pWin, pScreen); if (pRREvent->mask & RRCrtcChangeNotifyMask) { for (i = 0; i < pScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pScrPriv->crtcs[i]; if (crtc->changed) RRDeliverCrtcEvent(client, pWin, crtc); } #ifndef NXAGENT_SERVER xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) { pSlaveScrPriv = rrGetScrPriv(iter); for (i = 0; i < pSlaveScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pSlaveScrPriv->crtcs[i]; if (crtc->changed) RRDeliverCrtcEvent(client, pWin, crtc); } } #endif } if (pRREvent->mask & RROutputChangeNotifyMask) { for (i = 0; i < pScrPriv->numOutputs; i++) { RROutputPtr output = pScrPriv->outputs[i]; if (output->changed) RRDeliverOutputEvent(client, pWin, output); } #ifndef NXAGENT_SERVER xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) { pSlaveScrPriv = rrGetScrPriv(iter); for (i = 0; i < pSlaveScrPriv->numOutputs; i++) { RROutputPtr output = pSlaveScrPriv->outputs[i]; if (output->changed) RRDeliverOutputEvent(client, pWin, output); } } #endif } #ifndef NXAGENT_SERVER if (pRREvent->mask & RRProviderChangeNotifyMask) { xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) { pSlaveScrPriv = rrGetScrPriv(iter); if (pSlaveScrPriv->provider->changed) RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider); } xorg_list_for_each_entry(iter, &pScreen->offload_slave_list, offload_head) { pSlaveScrPriv = rrGetScrPriv(iter); if (pSlaveScrPriv->provider->changed) RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider); } xorg_list_for_each_entry(iter, &pScreen->unattached_list, unattached_head) { pSlaveScrPriv = rrGetScrPriv(iter); if (pSlaveScrPriv->provider->changed) RRDeliverProviderEvent(client, pWin, pSlaveScrPriv->provider); } } #endif if (pRREvent->mask & RRResourceChangeNotifyMask) { if (pScrPriv->resourcesChanged) { RRDeliverResourceEvent(client, pWin); } } } return WT_WALKCHILDREN; } void RRSetChanged(ScreenPtr pScreen) { #ifndef NXAGENT_SERVER /* set changed bits on the master screen only */ ScreenPtr master; rrScrPriv(pScreen); rrScrPrivPtr mastersp; if (pScreen->isGPU) { master = pScreen->current_master; if (!master) return; mastersp = rrGetScrPriv(master); } else { master = pScreen; mastersp = pScrPriv; } mastersp->changed = TRUE; #else /* !defined(NXAGENT_SERVER) */ rrScrPriv(pScreen); pScrPriv->changed = TRUE; #endif } /* * Something changed; send events and adjust pointer position */ void RRTellChanged(ScreenPtr pScreen) { ScreenPtr master; rrScrPriv(pScreen); rrScrPrivPtr mastersp; int i; #ifndef NXAGENT_SERVER ScreenPtr iter; rrScrPrivPtr pSlaveScrPriv; #endif #ifndef NXAGENT_SERVER if (pScreen->isGPU) { master = pScreen->current_master; mastersp = rrGetScrPriv(master); } else #endif { master = pScreen; mastersp = pScrPriv; } if (mastersp->changed) { UpdateCurrentTimeIf(); if (mastersp->configChanged) { mastersp->lastConfigTime = currentTime; mastersp->configChanged = FALSE; } pScrPriv->changed = FALSE; mastersp->changed = FALSE; WalkTree(master, TellChanged, (void *) master); mastersp->resourcesChanged = FALSE; for (i = 0; i < pScrPriv->numOutputs; i++) pScrPriv->outputs[i]->changed = FALSE; for (i = 0; i < pScrPriv->numCrtcs; i++) pScrPriv->crtcs[i]->changed = FALSE; #ifndef NXAGENT_SERVER xorg_list_for_each_entry(iter, &master->output_slave_list, output_head) { pSlaveScrPriv = rrGetScrPriv(iter); pSlaveScrPriv->provider->changed = FALSE; for (i = 0; i < pSlaveScrPriv->numOutputs; i++) pSlaveScrPriv->outputs[i]->changed = FALSE; for (i = 0; i < pSlaveScrPriv->numCrtcs; i++) pSlaveScrPriv->crtcs[i]->changed = FALSE; } xorg_list_for_each_entry(iter, &master->offload_slave_list, offload_head) { pSlaveScrPriv = rrGetScrPriv(iter); pSlaveScrPriv->provider->changed = FALSE; } xorg_list_for_each_entry(iter, &master->unattached_list, unattached_head) { pSlaveScrPriv = rrGetScrPriv(iter); pSlaveScrPriv->provider->changed = FALSE; } #endif /* !defined(NXAGENT_SERVER) */ if (mastersp->layoutChanged) { pScrPriv->layoutChanged = FALSE; RRPointerScreenConfigured(master); RRSendConfigNotify(master); } } } /* * Return the first output which is connected to an active CRTC * Used in emulating 1.0 behaviour */ RROutputPtr RRFirstOutput(ScreenPtr pScreen) { rrScrPriv(pScreen); RROutputPtr output; int i, j; if (!pScrPriv) return NULL; if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) return pScrPriv->primaryOutput; for (i = 0; i < pScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pScrPriv->crtcs[i]; for (j = 0; j < pScrPriv->numOutputs; j++) { output = pScrPriv->outputs[j]; if (output->crtc == crtc) return output; } } return NULL; } CARD16 RRVerticalRefresh(xRRModeInfo * mode) { CARD32 refresh; CARD32 dots = mode->hTotal * mode->vTotal; if (!dots) return 0; refresh = (mode->dotClock + dots / 2) / dots; if (refresh > 0xffff) refresh = 0xffff; return (CARD16) refresh; } static int ProcRRDispatch(ClientPtr client) { REQUEST(xReq); if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data]) return BadRequest; UpdateCurrentTimeIf(); return (*ProcRandrVector[stuff->data]) (client); } static int SProcRRDispatch(ClientPtr client) { REQUEST(xReq); if (stuff->data >= RRNumberRequests || !SProcRandrVector[stuff->data]) return BadRequest; UpdateCurrentTimeIf(); return (*SProcRandrVector[stuff->data]) (client); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/randrstr.h0000644000000000000000000007622513614532331017725 0ustar /* * Copyright © 2000 Compaq Computer Corporation * Copyright © 2002 Hewlett-Packard Company * Copyright © 2006 Intel Corporation * Copyright © 2008 Red Hat, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Jim Gettys, Hewlett-Packard Company, Inc. * Keith Packard, Intel Corporation */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _RANDRSTR_H_ #define _RANDRSTR_H_ #ifndef NXAGENT_SERVER #include "list.h" #endif #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "resource.h" #include "scrnintstr.h" #include "windowstr.h" #include "pixmapstr.h" #include "extnsionst.h" #include "servermd.h" #include "rrtransform.h" #include #include #include /* we share subpixel order information */ #include "picturestr.h" #include /* required for ABI compatibility for now */ #define RANDR_10_INTERFACE 1 #define RANDR_12_INTERFACE 1 #define RANDR_13_INTERFACE 1 /* requires RANDR_12_INTERFACE */ #define RANDR_15_INTERFACE 1 #define RANDR_GET_CRTC_INTERFACE 1 #define RANDR_INTERFACE_VERSION 0x0104 typedef XID RRMode; typedef XID RROutput; typedef XID RRCrtc; typedef XID RRProvider; extern int RREventBase, RRErrorBase; extern int (*ProcRandrVector[RRNumberRequests]) (ClientPtr); extern int (*SProcRandrVector[RRNumberRequests]) (ClientPtr); /* * Modeline for a monitor. Name follows directly after this struct */ #define RRModeName(pMode) ((char *) (pMode + 1)) typedef struct _rrMode RRModeRec, *RRModePtr; typedef struct _rrPropertyValue RRPropertyValueRec, *RRPropertyValuePtr; typedef struct _rrProperty RRPropertyRec, *RRPropertyPtr; typedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr; typedef struct _rrOutput RROutputRec, *RROutputPtr; typedef struct _rrProvider RRProviderRec, *RRProviderPtr; typedef struct _rrMonitor RRMonitorRec, *RRMonitorPtr; struct _rrMode { int refcnt; xRRModeInfo mode; char *name; ScreenPtr userScreen; }; struct _rrPropertyValue { Atom type; /* ignored by server */ short format; /* format of data for swapping - 8,16,32 */ long size; /* size of data in (format/8) bytes */ void *data; /* private to client */ }; struct _rrProperty { RRPropertyPtr next; ATOM propertyName; Bool is_pending; Bool range; Bool immutable; int num_valid; INT32 *valid_values; RRPropertyValueRec current, pending; }; struct _rrCrtc { RRCrtc id; ScreenPtr pScreen; RRModePtr mode; int x, y; Rotation rotation; Rotation rotations; Bool changed; int numOutputs; RROutputPtr *outputs; int gammaSize; CARD16 *gammaRed; CARD16 *gammaBlue; CARD16 *gammaGreen; void *devPrivate; Bool transforms; RRTransformRec client_pending_transform; RRTransformRec client_current_transform; PictTransform transform; struct pict_f_transform f_transform; struct pict_f_transform f_inverse; PixmapPtr scanout_pixmap; }; struct _rrOutput { RROutput id; ScreenPtr pScreen; char *name; int nameLength; CARD8 connection; CARD8 subpixelOrder; int mmWidth; int mmHeight; RRCrtcPtr crtc; int numCrtcs; RRCrtcPtr *crtcs; int numClones; RROutputPtr *clones; int numModes; int numPreferred; RRModePtr *modes; int numUserModes; RRModePtr *userModes; Bool changed; RRPropertyPtr properties; Bool pendingProperties; void *devPrivate; }; struct _rrProvider { RRProvider id; ScreenPtr pScreen; uint32_t capabilities; char *name; int nameLength; RRPropertyPtr properties; Bool pendingProperties; Bool changed; struct _rrProvider *offload_sink; struct _rrProvider *output_source; }; typedef struct _rrMonitorGeometry { BoxRec box; CARD32 mmWidth; CARD32 mmHeight; } RRMonitorGeometryRec, *RRMonitorGeometryPtr; struct _rrMonitor { Atom name; ScreenPtr pScreen; int numOutputs; RROutput *outputs; Bool primary; Bool automatic; RRMonitorGeometryRec geometry; }; #if RANDR_12_INTERFACE typedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight); typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode, int x, int y, Rotation rotation, int numOutputs, RROutputPtr * outputs); typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc); typedef Bool (*RRCrtcGetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc); typedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen, RROutputPtr output, Atom property, RRPropertyValuePtr value); typedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr pScreen, RROutputPtr output, RRModePtr mode); typedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen, RRModePtr mode); #endif #if RANDR_13_INTERFACE typedef Bool (*RROutputGetPropertyProcPtr) (ScreenPtr pScreen, RROutputPtr output, Atom property); typedef Bool (*RRGetPanningProcPtr) (ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea, BoxPtr trackingArea, INT16 *border); typedef Bool (*RRSetPanningProcPtr) (ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea, BoxPtr trackingArea, INT16 *border); #endif /* RANDR_13_INTERFACE */ typedef Bool (*RRProviderGetPropertyProcPtr) (ScreenPtr pScreen, RRProviderPtr provider, Atom property); typedef Bool (*RRProviderSetPropertyProcPtr) (ScreenPtr pScreen, RRProviderPtr provider, Atom property, RRPropertyValuePtr value); typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation * rotations); typedef Bool (*RRCloseScreenProcPtr) (ScreenPtr pscreen); typedef Bool (*RRProviderSetOutputSourceProcPtr) (ScreenPtr pScreen, RRProviderPtr provider, RRProviderPtr output_source); typedef Bool (*RRProviderSetOffloadSinkProcPtr) (ScreenPtr pScreen, RRProviderPtr provider, RRProviderPtr offload_sink); typedef void (*RRProviderDestroyProcPtr) (ScreenPtr pScreen, RRProviderPtr provider); /* These are for 1.0 compatibility */ typedef struct _rrRefresh { CARD16 rate; RRModePtr mode; } RRScreenRate, *RRScreenRatePtr; typedef struct _rrScreenSize { int id; short width, height; short mmWidth, mmHeight; int nRates; RRScreenRatePtr pRates; } RRScreenSize, *RRScreenSizePtr; #ifdef RANDR_10_INTERFACE typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize); #endif typedef Bool (*RRCrtcSetScanoutPixmapProcPtr) (RRCrtcPtr crtc, PixmapPtr pixmap); typedef struct _rrScrPriv { /* * 'public' part of the structure; DDXen fill this in * as they initialize */ #if RANDR_10_INTERFACE RRSetConfigProcPtr rrSetConfig; #endif RRGetInfoProcPtr rrGetInfo; #if RANDR_12_INTERFACE RRScreenSetSizeProcPtr rrScreenSetSize; RRCrtcSetProcPtr rrCrtcSet; RRCrtcSetGammaProcPtr rrCrtcSetGamma; RRCrtcGetGammaProcPtr rrCrtcGetGamma; RROutputSetPropertyProcPtr rrOutputSetProperty; RROutputValidateModeProcPtr rrOutputValidateMode; RRModeDestroyProcPtr rrModeDestroy; #endif #if RANDR_13_INTERFACE RROutputGetPropertyProcPtr rrOutputGetProperty; RRGetPanningProcPtr rrGetPanning; RRSetPanningProcPtr rrSetPanning; #endif /* TODO #if RANDR_15_INTERFACE */ RRCrtcSetScanoutPixmapProcPtr rrCrtcSetScanoutPixmap; RRProviderSetOutputSourceProcPtr rrProviderSetOutputSource; RRProviderSetOffloadSinkProcPtr rrProviderSetOffloadSink; RRProviderGetPropertyProcPtr rrProviderGetProperty; RRProviderSetPropertyProcPtr rrProviderSetProperty; /* * Private part of the structure; not considered part of the ABI */ TimeStamp lastSetTime; /* last changed by client */ TimeStamp lastConfigTime; /* possible configs changed */ RRCloseScreenProcPtr CloseScreen; Bool changed; /* some config changed */ Bool configChanged; /* configuration changed */ Bool layoutChanged; /* screen layout changed */ Bool resourcesChanged; /* screen resources change */ CARD16 minWidth, minHeight; CARD16 maxWidth, maxHeight; CARD16 width, height; /* last known screen size */ CARD16 mmWidth, mmHeight; /* last known screen size */ int numOutputs; RROutputPtr *outputs; RROutputPtr primaryOutput; int numCrtcs; RRCrtcPtr *crtcs; /* Last known pointer position */ RRCrtcPtr pointerCrtc; #ifdef RANDR_10_INTERFACE /* * Configuration information */ Rotation rotations; CARD16 reqWidth, reqHeight; int nSizes; RRScreenSizePtr pSizes; Rotation rotation; int rate; int size; #endif Bool discontiguous; RRProviderPtr provider; RRProviderDestroyProcPtr rrProviderDestroy; int numMonitors; RRMonitorPtr *monitors; } rrScrPrivRec, *rrScrPrivPtr; #ifndef NXAGENT_SERVER extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec; #define rrPrivKey (&rrPrivKeyRec) extern DevPrivateKey rrPrivKey; #else extern int rrPrivIndex; #endif #ifndef NXAGENT_SERVER #define rrGetScrPriv(pScr) ((rrScrPrivPtr)dixLookupPrivate(&(pScr)->devPrivates, rrPrivKey)) #define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr) #define SetRRScreen(s,p) dixSetPrivate(&(s)->devPrivates, rrPrivKey, p) #else /* !defined(NXAGENT_SERVER) */ #define rrGetScrPriv(pScr) ((rrScrPrivPtr) (pScr)->devPrivates[rrPrivIndex].ptr) #define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr) #define SetRRScreen(s,p) ((s)->devPrivates[rrPrivIndex].ptr = (void *) (p)) #endif /* !defined(NXAGENT_SERVER) */ /* * each window has a list of clients requesting * RRNotify events. Each client has a resource * for each window it selects RRNotify input for, * this resource is used to delete the RRNotifyRec * entry from the per-window queue. */ typedef struct _RREvent *RREventPtr; typedef struct _RREvent { RREventPtr next; ClientPtr client; WindowPtr window; XID clientResource; int mask; } RREventRec; typedef struct _RRTimes { TimeStamp setTime; TimeStamp configTime; } RRTimesRec, *RRTimesPtr; typedef struct _RRClient { int major_version; int minor_version; /* RRTimesRec times[0]; */ } RRClientRec, *RRClientPtr; extern RESTYPE RRClientType, RREventType; /* resource types for event masks */ #ifndef NXAGENT_SERVER extern DevPrivateKey RRClientPrivateKey; #else extern int RRClientPrivateIndex; #endif extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType, RRProviderType; #ifdef NXAGENT_SERVER #define LookupOutput(client,id,a) ((RROutputPtr) \ (SecurityLookupIDByType (client, id, \ RROutputType, a))) #define LookupCrtc(client,id,a) ((RRCrtcPtr) \ (SecurityLookupIDByType (client, id, \ RRCrtcType, a))) #define LookupMode(client,id,a) ((RRModePtr) \ (SecurityLookupIDByType (client, id, \ RRModeType, a))) #define LookupProvider(client,id,a) ((RRProviderPtr) \ (SecurityLookupIDByType (client, id, \ RRProviderType, a))) #define DixSetAttrAccess DixWriteAccess #define DixUseAccess DixWriteAccess #endif #ifndef NXAGENT_SERVER #define RRClientPrivateKey (&RRClientPrivateKeyRec) #define GetRRClient(pClient) ((RRClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RRClientPrivateKey)) #else /* !defined/NXAGENT_SERVER) */ #define GetRRClient(pClient) ((RRClientPtr) (pClient)->devPrivates[RRClientPrivateIndex].ptr) #endif /* !defined(NXAGENT_SERVER) */ #define rrClientPriv(pClient) RRClientPtr pRRClient = GetRRClient(pClient) /* Initialize the extension */ void RRExtensionInit(void); #ifndef NXAGENT_SERVER #define VERIFY_RR_OUTPUT(id, ptr, a)\ {\ int rc = dixLookupResourceByType((void **)&(ptr), id,\ RROutputType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ return rc;\ }\ } #define VERIFY_RR_CRTC(id, ptr, a)\ {\ int rc = dixLookupResourceByType((void **)&(ptr), id,\ RRCrtcType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ return rc;\ }\ } #define VERIFY_RR_MODE(id, ptr, a)\ {\ int rc = dixLookupResourceByType((void **)&(ptr), id,\ RRModeType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ return rc;\ }\ } #define VERIFY_RR_PROVIDER(id, ptr, a)\ {\ int rc = dixLookupResourceByType((void **)&(ptr), id,\ RRProviderType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ return rc;\ }\ } #else /* !defined(NXAGENT_SERVER) */ #define VERIFY_RR_OUTPUT(id, ptr, a)\ {\ ptr = LookupOutput(client, id, a);\ if (!ptr) {\ client->errorValue = id;\ return RRErrorBase + BadRROutput;\ }\ } #define VERIFY_RR_CRTC(id, ptr, a)\ {\ ptr = LookupCrtc (client, id, a);\ if (!ptr) {\ client->errorValue = id;\ return RRErrorBase + BadRRCrtc;\ }\ } #define VERIFY_RR_MODE(id, ptr, a)\ {\ ptr = LookupMode (client, id, a);\ if (!ptr) {\ client->errorValue = id;\ return RRErrorBase + BadRRMode;\ }\ } #define VERIFY_RR_PROVIDER(id, ptr, a)\ {\ ptr = LookupProvider (client, id, a);\ if (!ptr) {\ client->errorValue = id;\ return RRErrorBase + BadRRProvider;\ }\ } #endif /* !defined(NXAGENT_SERVER) */ #ifdef RANDR_12_INTERFACE /* * Set the range of sizes for the screen */ extern _X_EXPORT void RRScreenSetSizeRange(ScreenPtr pScreen, CARD16 minWidth, CARD16 minHeight, CARD16 maxWidth, CARD16 maxHeight); #endif /* rrscreen.c */ /* * Notify the extension that the screen size has been changed. * The driver is responsible for calling this whenever it has changed * the size of the screen */ extern _X_EXPORT void RRScreenSizeNotify(ScreenPtr pScreen); /* * Request that the screen be resized */ extern _X_EXPORT Bool RRScreenSizeSet(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight); /* * Send ConfigureNotify event to root window when 'something' happens */ extern _X_EXPORT void RRSendConfigNotify(ScreenPtr pScreen); /* * screen dispatch */ extern _X_EXPORT int ProcRRGetScreenSizeRange(ClientPtr client); extern _X_EXPORT int ProcRRSetScreenSize(ClientPtr client); extern _X_EXPORT int ProcRRGetScreenResources(ClientPtr client); extern _X_EXPORT int ProcRRGetScreenResourcesCurrent(ClientPtr client); extern _X_EXPORT int ProcRRSetScreenConfig(ClientPtr client); extern _X_EXPORT int ProcRRGetScreenInfo(ClientPtr client); /* * Deliver a ScreenNotify event */ extern _X_EXPORT void RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen); extern _X_EXPORT void RRResourcesChanged(ScreenPtr pScreen); /* randr.c */ /* set a screen change on the primary screen */ extern _X_EXPORT void RRSetChanged(ScreenPtr pScreen); /* * Send all pending events */ extern _X_EXPORT void RRTellChanged(ScreenPtr pScreen); /* * Poll the driver for changed information */ extern _X_EXPORT Bool RRGetInfo(ScreenPtr pScreen, Bool force_query); extern _X_EXPORT Bool RRInit(void); extern _X_EXPORT Bool RRScreenInit(ScreenPtr pScreen); extern _X_EXPORT RROutputPtr RRFirstOutput(ScreenPtr pScreen); extern _X_EXPORT CARD16 RRVerticalRefresh(xRRModeInfo * mode); #ifdef RANDR_10_INTERFACE /* * This is the old interface, deprecated but left * around for compatibility */ /* * Then, register the specific size with the screen */ extern _X_EXPORT RRScreenSizePtr RRRegisterSize(ScreenPtr pScreen, short width, short height, short mmWidth, short mmHeight); extern _X_EXPORT Bool RRRegisterRate(ScreenPtr pScreen, RRScreenSizePtr pSize, int rate); /* * Finally, set the current configuration of the screen */ extern _X_EXPORT void RRSetCurrentConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize); extern _X_EXPORT Rotation RRGetRotation(ScreenPtr pScreen); #endif /* rrcrtc.c */ /* * Notify the CRTC of some change; layoutChanged indicates that * some position or size element changed */ extern _X_EXPORT void RRCrtcChanged(RRCrtcPtr crtc, Bool layoutChanged); /* * Create a CRTC */ extern _X_EXPORT RRCrtcPtr RRCrtcCreate(ScreenPtr pScreen, void *devPrivate); /* * Set the allowed rotations on a CRTC */ extern _X_EXPORT void RRCrtcSetRotations(RRCrtcPtr crtc, Rotation rotations); /* * Set whether transforms are allowed on a CRTC */ extern _X_EXPORT void RRCrtcSetTransformSupport(RRCrtcPtr crtc, Bool transforms); /* * Notify the extension that the Crtc has been reconfigured, * the driver calls this whenever it has updated the mode */ extern _X_EXPORT Bool RRCrtcNotify(RRCrtcPtr crtc, RRModePtr mode, int x, int y, Rotation rotation, RRTransformPtr transform, int numOutputs, RROutputPtr * outputs); extern _X_EXPORT void RRDeliverCrtcEvent(ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc); /* * Request that the Crtc be reconfigured */ extern _X_EXPORT Bool RRCrtcSet(RRCrtcPtr crtc, RRModePtr mode, int x, int y, Rotation rotation, int numOutput, RROutputPtr * outputs); /* * Request that the Crtc gamma be changed */ extern _X_EXPORT Bool RRCrtcGammaSet(RRCrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue); /* * Request current gamma back from the DDX (if possible). * This includes gamma size. */ extern _X_EXPORT Bool RRCrtcGammaGet(RRCrtcPtr crtc); /* * Notify the extension that the Crtc gamma has been changed * The driver calls this whenever it has changed the gamma values * in the RRCrtcRec */ extern _X_EXPORT Bool RRCrtcGammaNotify(RRCrtcPtr crtc); /* * Set the size of the gamma table at server startup time */ extern _X_EXPORT Bool RRCrtcGammaSetSize(RRCrtcPtr crtc, int size); /* * Return the area of the frame buffer scanned out by the crtc, * taking into account the current mode and rotation */ extern _X_EXPORT void RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height); /* * Return crtc transform */ extern _X_EXPORT RRTransformPtr RRCrtcGetTransform(RRCrtcPtr crtc); /* * Check whether the pending and current transforms are the same */ extern _X_EXPORT Bool RRCrtcPendingTransform(RRCrtcPtr crtc); /* * Destroy a Crtc at shutdown */ extern _X_EXPORT void RRCrtcDestroy(RRCrtcPtr crtc); /* * Set the pending CRTC transformation */ extern _X_EXPORT int RRCrtcTransformSet(RRCrtcPtr crtc, PictTransformPtr transform, struct pict_f_transform *f_transform, struct pict_f_transform *f_inverse, char *filter, int filter_len, xFixed * params, int nparams); /* * Initialize crtc type */ extern _X_EXPORT Bool RRCrtcInit(void); /* * Initialize crtc type error value */ extern _X_EXPORT void RRCrtcInitErrorValue(void); /* * Detach and free a scanout pixmap */ extern _X_EXPORT void RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc); extern _X_EXPORT Bool RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable); /* * Crtc dispatch */ extern _X_EXPORT int ProcRRGetCrtcInfo(ClientPtr client); extern _X_EXPORT int ProcRRSetCrtcConfig(ClientPtr client); extern _X_EXPORT int ProcRRGetCrtcGammaSize(ClientPtr client); extern _X_EXPORT int ProcRRGetCrtcGamma(ClientPtr client); extern _X_EXPORT int ProcRRSetCrtcGamma(ClientPtr client); extern _X_EXPORT int ProcRRSetCrtcTransform(ClientPtr client); extern _X_EXPORT int ProcRRGetCrtcTransform(ClientPtr client); int ProcRRGetPanning(ClientPtr client); int ProcRRSetPanning(ClientPtr client); void RRConstrainCursorHarder( #ifndef NXAGENT_SERVER DeviceIntPtr, #endif /* !defined(NXAGENT_SERVER) */ ScreenPtr, int, int *, int *); /* rrdispatch.c */ extern _X_EXPORT Bool RRClientKnowsRates(ClientPtr pClient); /* rrmode.c */ /* * Find, and if necessary, create a mode */ extern _X_EXPORT RRModePtr RRModeGet(xRRModeInfo * modeInfo, const char *name); /* * Destroy a mode. */ extern _X_EXPORT void RRModeDestroy(RRModePtr mode); /* * Return a list of modes that are valid for some output in pScreen */ extern _X_EXPORT RRModePtr *RRModesForScreen(ScreenPtr pScreen, int *num_ret); /* * Initialize mode type */ extern _X_EXPORT Bool RRModeInit(void); /* * Initialize mode type error value */ extern _X_EXPORT void RRModeInitErrorValue(void); extern _X_EXPORT int ProcRRCreateMode(ClientPtr client); extern _X_EXPORT int ProcRRDestroyMode(ClientPtr client); extern _X_EXPORT int ProcRRAddOutputMode(ClientPtr client); extern _X_EXPORT int ProcRRDeleteOutputMode(ClientPtr client); /* rroutput.c */ /* * Notify the output of some change. configChanged indicates whether * any external configuration (mode list, clones, connected status) * has changed, or whether the change was strictly internal * (which crtc is in use) */ extern _X_EXPORT void RROutputChanged(RROutputPtr output, Bool configChanged); /* * Create an output */ extern _X_EXPORT RROutputPtr RROutputCreate(ScreenPtr pScreen, const char *name, int nameLength, void *devPrivate); /* * Notify extension that output parameters have been changed */ extern _X_EXPORT Bool RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones); extern _X_EXPORT Bool RROutputSetModes(RROutputPtr output, RRModePtr * modes, int numModes, int numPreferred); extern _X_EXPORT int RROutputAddUserMode(RROutputPtr output, RRModePtr mode); extern _X_EXPORT int RROutputDeleteUserMode(RROutputPtr output, RRModePtr mode); extern _X_EXPORT Bool RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs); extern _X_EXPORT Bool RROutputSetConnection(RROutputPtr output, CARD8 connection); extern _X_EXPORT Bool RROutputSetSubpixelOrder(RROutputPtr output, int subpixelOrder); extern _X_EXPORT Bool RROutputSetPhysicalSize(RROutputPtr output, int mmWidth, int mmHeight); extern _X_EXPORT void RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output); extern _X_EXPORT void RROutputDestroy(RROutputPtr output); extern _X_EXPORT int ProcRRGetOutputInfo(ClientPtr client); extern _X_EXPORT int ProcRRSetOutputPrimary(ClientPtr client); extern _X_EXPORT int ProcRRGetOutputPrimary(ClientPtr client); /* * Initialize output type */ extern _X_EXPORT Bool RROutputInit(void); /* * Initialize output type error value */ extern _X_EXPORT void RROutputInitErrorValue(void); /* rrpointer.c */ extern _X_EXPORT void RRPointerMoved(ScreenPtr pScreen, int x, int y); extern _X_EXPORT void RRPointerScreenConfigured(ScreenPtr pScreen); /* rrproperty.c */ extern _X_EXPORT void RRDeleteAllOutputProperties(RROutputPtr output); extern _X_EXPORT RRPropertyValuePtr RRGetOutputProperty(RROutputPtr output, Atom property, Bool pending); extern _X_EXPORT RRPropertyPtr RRQueryOutputProperty(RROutputPtr output, Atom property); extern _X_EXPORT void RRDeleteOutputProperty(RROutputPtr output, Atom property); extern _X_EXPORT Bool RRPostPendingProperties(RROutputPtr output); extern _X_EXPORT int RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type, int format, int mode, unsigned long len, void *value, Bool sendevent, Bool pending); extern _X_EXPORT int RRConfigureOutputProperty(RROutputPtr output, Atom property, Bool pending, Bool range, Bool immutable, int num_values, INT32 *values); extern _X_EXPORT int ProcRRChangeOutputProperty(ClientPtr client); extern _X_EXPORT int ProcRRGetOutputProperty(ClientPtr client); extern _X_EXPORT int ProcRRListOutputProperties(ClientPtr client); extern _X_EXPORT int ProcRRQueryOutputProperty(ClientPtr client); extern _X_EXPORT int ProcRRConfigureOutputProperty(ClientPtr client); extern _X_EXPORT int ProcRRDeleteOutputProperty(ClientPtr client); /* rrprovider.c */ extern _X_EXPORT void RRProviderInitErrorValue(void); extern _X_EXPORT int ProcRRGetProviders(ClientPtr client); extern _X_EXPORT int ProcRRGetProviderInfo(ClientPtr client); extern _X_EXPORT int ProcRRSetProviderOutputSource(ClientPtr client); extern _X_EXPORT int ProcRRSetProviderOffloadSink(ClientPtr client); extern _X_EXPORT Bool RRProviderInit(void); extern _X_EXPORT RRProviderPtr RRProviderCreate(ScreenPtr pScreen, const char *name, int nameLength); extern _X_EXPORT void RRProviderDestroy(RRProviderPtr provider); extern _X_EXPORT void RRProviderSetCapabilities(RRProviderPtr provider, uint32_t capabilities); extern _X_EXPORT Bool RRProviderLookup(XID id, RRProviderPtr * provider_p); extern _X_EXPORT void RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider); /* rrproviderproperty.c */ extern _X_EXPORT void RRDeleteAllProviderProperties(RRProviderPtr provider); extern _X_EXPORT RRPropertyValuePtr RRGetProviderProperty(RRProviderPtr provider, Atom property, Bool pending); extern _X_EXPORT RRPropertyPtr RRQueryProviderProperty(RRProviderPtr provider, Atom property); extern _X_EXPORT void RRDeleteProviderProperty(RRProviderPtr provider, Atom property); extern _X_EXPORT int RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type, int format, int mode, unsigned long len, void *value, Bool sendevent, Bool pending); extern _X_EXPORT int RRConfigureProviderProperty(RRProviderPtr provider, Atom property, Bool pending, Bool range, Bool immutable, int num_values, INT32 *values); extern _X_EXPORT Bool RRPostProviderPendingProperties(RRProviderPtr provider); extern _X_EXPORT int ProcRRGetProviderProperty(ClientPtr client); extern _X_EXPORT int ProcRRListProviderProperties(ClientPtr client); extern _X_EXPORT int ProcRRQueryProviderProperty(ClientPtr client); extern _X_EXPORT int ProcRRConfigureProviderProperty(ClientPtr client); extern _X_EXPORT int ProcRRChangeProviderProperty(ClientPtr client); extern _X_EXPORT int ProcRRDeleteProviderProperty(ClientPtr client); /* rrxinerama.c */ #ifdef XINERAMA extern _X_EXPORT void RRXineramaExtensionInit(void); #endif void RRMonitorInit(ScreenPtr screen); Bool RRMonitorMakeList(ScreenPtr screen, Bool get_active, RRMonitorPtr * monitors_ret, int *nmon_ret); int RRMonitorCountList(ScreenPtr screen); void RRMonitorFreeList(RRMonitorPtr monitors, int nmon); void RRMonitorClose(ScreenPtr screen); RRMonitorPtr RRMonitorAlloc(int noutput); int RRMonitorAdd(ClientPtr client, ScreenPtr screen, RRMonitorPtr monitor); void RRMonitorFree(RRMonitorPtr monitor); int ProcRRGetMonitors(ClientPtr client); int ProcRRSetMonitor(ClientPtr client); int ProcRRDeleteMonitor(ClientPtr client); #endif /* _RANDRSTR_H_ */ /* randr extension implementation structure Query state: ProcRRGetScreenInfo/ProcRRGetScreenResources RRGetInfo • Request configuration from driver, either 1.0 or 1.2 style • These functions only record state changes, all other actions are pended until RRTellChanged is called ->rrGetInfo 1.0: RRRegisterSize RRRegisterRate RRSetCurrentConfig 1.2: RRScreenSetSizeRange RROutputSetCrtcs RRModeGet RROutputSetModes RROutputSetConnection RROutputSetSubpixelOrder RROutputSetClones RRCrtcNotify • Must delay scanning configuration until after ->rrGetInfo returns because some drivers will call SetCurrentConfig in the middle of the ->rrGetInfo operation. 1.0: • Scan old configuration, mirror to new structures RRScanOldConfig RRCrtcCreate RROutputCreate RROutputSetCrtcs RROutputSetConnection RROutputSetSubpixelOrder RROldModeAdd • This adds modes one-at-a-time RRModeGet RRCrtcNotify • send events, reset pointer if necessary RRTellChanged WalkTree (sending events) • when layout has changed: RRPointerScreenConfigured RRSendConfigNotify Asynchronous state setting (1.2 only) When setting state asynchronously, the driver invokes the ->rrGetInfo function and then calls RRTellChanged to flush the changes to the clients and reset pointer if necessary Set state ProcRRSetScreenConfig RRCrtcSet 1.2: ->rrCrtcSet RRCrtcNotify 1.0: ->rrSetConfig RRCrtcNotify RRTellChanged */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rrcrtc.c0000644000000000000000000015014713614532331017354 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Copyright © 2006 Keith Packard * Copyright 2010 Red Hat, Inc * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "randrstr.h" #include "swaprep.h" #include "mipointer.h" RESTYPE RRCrtcType; /* * Notify the CRTC of some change */ void RRCrtcChanged(RRCrtcPtr crtc, Bool layoutChanged) { ScreenPtr pScreen = crtc->pScreen; crtc->changed = TRUE; if (pScreen) { rrScrPriv(pScreen); RRSetChanged(pScreen); /* * Send ConfigureNotify on any layout change */ if (layoutChanged) pScrPriv->layoutChanged = TRUE; } } /* * Create a CRTC */ RRCrtcPtr RRCrtcCreate(ScreenPtr pScreen, void *devPrivate) { RRCrtcPtr crtc; RRCrtcPtr *crtcs; rrScrPrivPtr pScrPriv; if (!RRInit()) return NULL; pScrPriv = rrGetScrPriv(pScreen); /* make space for the crtc pointer */ crtcs = reallocarray(pScrPriv->crtcs, pScrPriv->numCrtcs + 1, sizeof(RRCrtcPtr)); if (!crtcs) return NULL; pScrPriv->crtcs = crtcs; crtc = calloc(1, sizeof(RRCrtcRec)); if (!crtc) return NULL; crtc->id = FakeClientID(0); crtc->pScreen = pScreen; crtc->mode = NULL; crtc->x = 0; crtc->y = 0; crtc->rotation = RR_Rotate_0; crtc->rotations = RR_Rotate_0; crtc->outputs = NULL; crtc->numOutputs = 0; crtc->gammaSize = 0; crtc->gammaRed = crtc->gammaBlue = crtc->gammaGreen = NULL; crtc->changed = FALSE; crtc->devPrivate = devPrivate; RRTransformInit(&crtc->client_pending_transform); RRTransformInit(&crtc->client_current_transform); pixman_transform_init_identity(&crtc->transform); pixman_f_transform_init_identity(&crtc->f_transform); pixman_f_transform_init_identity(&crtc->f_inverse); if (!AddResource(crtc->id, RRCrtcType, (void *) crtc)) return NULL; /* attach the screen and crtc together */ crtc->pScreen = pScreen; pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc; RRResourcesChanged(pScreen); return crtc; } /* * Set the allowed rotations on a CRTC */ void RRCrtcSetRotations(RRCrtcPtr crtc, Rotation rotations) { crtc->rotations = rotations; } /* * Set whether transforms are allowed on a CRTC */ void RRCrtcSetTransformSupport(RRCrtcPtr crtc, Bool transforms) { crtc->transforms = transforms; } /* * Notify the extension that the Crtc has been reconfigured, * the driver calls this whenever it has updated the mode */ Bool RRCrtcNotify(RRCrtcPtr crtc, RRModePtr mode, int x, int y, Rotation rotation, RRTransformPtr transform, int numOutputs, RROutputPtr * outputs) { int i, j; /* * Check to see if any of the new outputs were * not in the old list and mark them as changed */ for (i = 0; i < numOutputs; i++) { for (j = 0; j < crtc->numOutputs; j++) if (outputs[i] == crtc->outputs[j]) break; if (j == crtc->numOutputs) { outputs[i]->crtc = crtc; RROutputChanged(outputs[i], FALSE); RRCrtcChanged(crtc, FALSE); } } /* * Check to see if any of the old outputs are * not in the new list and mark them as changed */ for (j = 0; j < crtc->numOutputs; j++) { for (i = 0; i < numOutputs; i++) if (outputs[i] == crtc->outputs[j]) break; if (i == numOutputs) { if (crtc->outputs[j]->crtc == crtc) crtc->outputs[j]->crtc = NULL; RROutputChanged(crtc->outputs[j], FALSE); RRCrtcChanged(crtc, FALSE); } } /* * Reallocate the crtc output array if necessary */ if (numOutputs != crtc->numOutputs) { RROutputPtr *newoutputs; if (numOutputs) { if (crtc->numOutputs) newoutputs = reallocarray(crtc->outputs, numOutputs, sizeof(RROutputPtr)); else newoutputs = xallocarray(numOutputs, sizeof(RROutputPtr)); if (!newoutputs) return FALSE; } else { free(crtc->outputs); newoutputs = NULL; } crtc->outputs = newoutputs; crtc->numOutputs = numOutputs; } /* * Copy the new list of outputs into the crtc */ memcpy(crtc->outputs, outputs, numOutputs * sizeof(RROutputPtr)); /* * Update remaining crtc fields */ if (mode != crtc->mode) { if (crtc->mode) RRModeDestroy(crtc->mode); crtc->mode = mode; if (mode != NULL) mode->refcnt++; RRCrtcChanged(crtc, TRUE); } if (x != crtc->x) { crtc->x = x; RRCrtcChanged(crtc, TRUE); } if (y != crtc->y) { crtc->y = y; RRCrtcChanged(crtc, TRUE); } if (rotation != crtc->rotation) { crtc->rotation = rotation; RRCrtcChanged(crtc, TRUE); } if (!RRTransformEqual(transform, &crtc->client_current_transform)) { RRTransformCopy(&crtc->client_current_transform, transform); RRCrtcChanged(crtc, TRUE); } if (crtc->changed && mode) { RRTransformCompute(x, y, mode->mode.width, mode->mode.height, rotation, &crtc->client_current_transform, &crtc->transform, &crtc->f_transform, &crtc->f_inverse); } return TRUE; } void RRDeliverCrtcEvent(ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc) { ScreenPtr pScreen = pWin->drawable.pScreen; rrScrPriv(pScreen); RRModePtr mode = crtc->mode; xRRCrtcChangeNotifyEvent ce = { .type = RRNotify + RREventBase, .subCode = RRNotify_CrtcChange, .timestamp = pScrPriv->lastSetTime.milliseconds, .window = pWin->drawable.id, .crtc = crtc->id, .mode = mode ? mode->mode.id : None, .rotation = crtc->rotation, .x = mode ? crtc->x : 0, .y = mode ? crtc->y : 0, .width = mode ? mode->mode.width : 0, .height = mode ? mode->mode.height : 0 }; WriteEventsToClient(client, 1, (xEvent *) &ce); } static Bool RRCrtcPendingProperties(RRCrtcPtr crtc) { ScreenPtr pScreen = crtc->pScreen; rrScrPriv(pScreen); int o; for (o = 0; o < pScrPriv->numOutputs; o++) { RROutputPtr output = pScrPriv->outputs[o]; if (output->crtc == crtc && output->pendingProperties) return TRUE; } return FALSE; } static void crtc_bounds(RRCrtcPtr crtc, int *left, int *right, int *top, int *bottom) { *left = crtc->x; *top = crtc->y; switch (crtc->rotation) { case RR_Rotate_0: case RR_Rotate_180: default: *right = crtc->x + crtc->mode->mode.width; *bottom = crtc->y + crtc->mode->mode.height; return; case RR_Rotate_90: case RR_Rotate_270: *right = crtc->x + crtc->mode->mode.height; *bottom = crtc->y + crtc->mode->mode.width; return; } } /* overlapping counts as adjacent */ static Bool crtcs_adjacent(const RRCrtcPtr a, const RRCrtcPtr b) { /* left, right, top, bottom... */ int al, ar, at, ab; int bl, br, bt, bb; int cl, cr, ct, cb; /* the overlap, if any */ crtc_bounds(a, &al, &ar, &at, &ab); crtc_bounds(b, &bl, &br, &bt, &bb); cl = max(al, bl); cr = min(ar, br); ct = max(at, bt); cb = min(ab, bb); return (cl <= cr) && (ct <= cb); } /* Depth-first search and mark all CRTCs reachable from cur */ static void mark_crtcs(rrScrPrivPtr pScrPriv, int *reachable, int cur) { int i; reachable[cur] = TRUE; for (i = 0; i < pScrPriv->numCrtcs; ++i) { if (reachable[i] || !pScrPriv->crtcs[i]->mode) continue; if (crtcs_adjacent(pScrPriv->crtcs[cur], pScrPriv->crtcs[i])) mark_crtcs(pScrPriv, reachable, i); } } static void RRComputeContiguity(ScreenPtr pScreen) { rrScrPriv(pScreen); Bool discontiguous = TRUE; int i, n = pScrPriv->numCrtcs; int *reachable = calloc(n, sizeof(int)); if (!reachable) goto out; /* Find first enabled CRTC and start search for reachable CRTCs from it */ for (i = 0; i < n; ++i) { if (pScrPriv->crtcs[i]->mode) { mark_crtcs(pScrPriv, reachable, i); break; } } /* Check that all enabled CRTCs were marked as reachable */ for (i = 0; i < n; ++i) if (pScrPriv->crtcs[i]->mode && !reachable[i]) goto out; discontiguous = FALSE; out: free(reachable); pScrPriv->discontiguous = discontiguous; } static void rrDestroySharedPixmap(RRCrtcPtr crtc, PixmapPtr pPixmap) { #ifndef NXAGENT_SERVER ScreenPtr master = crtc->pScreen->current_master; if (master && pPixmap->master_pixmap) { PixmapPtr mscreenpix = master->GetScreenPixmap(master); master->StopPixmapTracking(mscreenpix, pPixmap); /* * Unref the pixmap twice: once for the original reference, and once * for the reference implicitly added by PixmapShareToSlave. */ master->DestroyPixmap(pPixmap->master_pixmap); master->DestroyPixmap(pPixmap->master_pixmap); } #endif crtc->pScreen->DestroyPixmap(pPixmap); } void RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc) { rrScrPriv(crtc->pScreen); pScrPriv->rrCrtcSetScanoutPixmap(crtc, NULL); if (crtc->scanout_pixmap) { rrDestroySharedPixmap(crtc, crtc->scanout_pixmap); } crtc->scanout_pixmap = NULL; RRCrtcChanged(crtc, TRUE); } #ifndef NXAGENT_SERVER static PixmapPtr rrCreateSharedPixmap(RRCrtcPtr crtc, ScreenPtr master, int width, int height, int depth, int x, int y, Rotation rotation) { Bool ret; PixmapPtr mpix, spix; rrScrPriv(crtc->pScreen); mpix = master->CreatePixmap(master, width, height, depth, CREATE_PIXMAP_USAGE_SHARED); if (!mpix) return NULL; spix = PixmapShareToSlave(mpix, crtc->pScreen); if (spix == NULL) { master->DestroyPixmap(mpix); return NULL; } ret = pScrPriv->rrCrtcSetScanoutPixmap(crtc, spix); if (ret == FALSE) { rrDestroySharedPixmap(crtc, spix); ErrorF("randr: failed to set shadow slave pixmap\n"); return NULL; } return spix; } static Bool rrSetupPixmapSharing(RRCrtcPtr crtc, int width, int height, int x, int y, Rotation rotation) { ScreenPtr master = crtc->pScreen->current_master; int depth; PixmapPtr mscreenpix; PixmapPtr spix; /* create a pixmap on the master screen, then get a shared handle for it create a shared pixmap on the slave screen using the handle set the master screen to do dirty updates to the shared pixmap from the screen pixmap. set slave screen to scanout shared linear pixmap */ mscreenpix = master->GetScreenPixmap(master); depth = mscreenpix->drawable.depth; if (crtc->scanout_pixmap) RRCrtcDetachScanoutPixmap(crtc); if (width == 0 && height == 0) { return TRUE; } spix = rrCreateSharedPixmap(crtc, master, width, height, depth, x, y, rotation); if (spix == NULL) { return FALSE; } crtc->scanout_pixmap = spix; master->StartPixmapTracking(mscreenpix, spix, x, y, 0, 0, rotation); return TRUE; } static void crtc_to_box(BoxPtr box, RRCrtcPtr crtc) { box->x1 = crtc->x; box->y1 = crtc->y; switch (crtc->rotation) { case RR_Rotate_0: case RR_Rotate_180: default: box->x2 = crtc->x + crtc->mode->mode.width; box->y2 = crtc->y + crtc->mode->mode.height; break; case RR_Rotate_90: case RR_Rotate_270: box->x2 = crtc->x + crtc->mode->mode.height; box->y2 = crtc->y + crtc->mode->mode.width; break; } } static Bool rrCheckPixmapBounding(ScreenPtr pScreen, RRCrtcPtr rr_crtc, Rotation rotation, int x, int y, int w, int h) { RegionRec root_pixmap_region, total_region, new_crtc_region; int c; BoxRec newbox; BoxPtr newsize; ScreenPtr slave; int new_width, new_height; PixmapPtr screen_pixmap = pScreen->GetScreenPixmap(pScreen); rrScrPriv(pScreen); PixmapRegionInit(&root_pixmap_region, screen_pixmap); RegionInit(&total_region, NULL, 0); /* have to iterate all the crtcs of the attached gpu masters and all their output slaves */ for (c = 0; c < pScrPriv->numCrtcs; c++) { RRCrtcPtr crtc = pScrPriv->crtcs[c]; if (crtc == rr_crtc) { newbox.x1 = x; newbox.y1 = y; if (rotation == RR_Rotate_90 || rotation == RR_Rotate_270) { newbox.x2 = x + h; newbox.y2 = y + w; } else { newbox.x2 = x + w; newbox.y2 = y + h; } } else { if (!crtc->mode) continue; crtc_to_box(&newbox, crtc); } RegionInit(&new_crtc_region, &newbox, 1); RegionUnion(&total_region, &total_region, &new_crtc_region); } xorg_list_for_each_entry(slave, &pScreen->output_slave_list, output_head) { rrScrPrivPtr slave_priv = rrGetScrPriv(slave); for (c = 0; c < slave_priv->numCrtcs; c++) { RRCrtcPtr slave_crtc = slave_priv->crtcs[c]; if (slave_crtc == rr_crtc) { newbox.x1 = x; newbox.y1 = y; if (rotation == RR_Rotate_90 || rotation == RR_Rotate_270) { newbox.x2 = x + h; newbox.y2 = y + w; } else { newbox.x2 = x + w; newbox.y2 = y + h; } } else { if (!slave_crtc->mode) continue; crtc_to_box(&newbox, slave_crtc); } RegionInit(&new_crtc_region, &newbox, 1); RegionUnion(&total_region, &total_region, &new_crtc_region); } } newsize = RegionExtents(&total_region); new_width = newsize->x2 - newsize->x1; new_height = newsize->y2 - newsize->y1; if (new_width == screen_pixmap->drawable.width && new_height == screen_pixmap->drawable.height) { } else { pScrPriv->rrScreenSetSize(pScreen, new_width, new_height, 0, 0); } /* set shatters TODO */ return TRUE; } #endif /* !defined(NXAGENT_SERVER) */ /* * Request that the Crtc be reconfigured */ Bool RRCrtcSet(RRCrtcPtr crtc, RRModePtr mode, int x, int y, Rotation rotation, int numOutputs, RROutputPtr * outputs) { ScreenPtr pScreen = crtc->pScreen; Bool ret = FALSE; Bool recompute = TRUE; Bool crtcChanged; int o; rrScrPriv(pScreen); crtcChanged = FALSE; for (o = 0; o < numOutputs; o++) { if (outputs[o] && outputs[o]->crtc != crtc) { crtcChanged = TRUE; break; } } /* See if nothing changed */ if (crtc->mode == mode && crtc->x == x && crtc->y == y && crtc->rotation == rotation && crtc->numOutputs == numOutputs && !memcmp(crtc->outputs, outputs, numOutputs * sizeof(RROutputPtr)) && !RRCrtcPendingProperties(crtc) && !RRCrtcPendingTransform(crtc) && !crtcChanged) { recompute = FALSE; ret = TRUE; } else { #ifndef NXAGENT_SERVER if (pScreen->isGPU) { ScreenPtr master = pScreen->current_master; int width = 0, height = 0; if (mode) { width = mode->mode.width; height = mode->mode.height; } ret = rrCheckPixmapBounding(master, crtc, rotation, x, y, width, height); if (!ret) return FALSE; if (pScreen->current_master) { ret = rrSetupPixmapSharing(crtc, width, height, x, y, rotation); } } #endif #if RANDR_12_INTERFACE if (pScrPriv->rrCrtcSet) { ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y, rotation, numOutputs, outputs); } else #endif { #if RANDR_10_INTERFACE if (pScrPriv->rrSetConfig) { RRScreenSize size; RRScreenRate rate; if (!mode) { RRCrtcNotify(crtc, NULL, x, y, rotation, NULL, 0, NULL); ret = TRUE; } else { size.width = mode->mode.width; size.height = mode->mode.height; if (outputs[0]->mmWidth && outputs[0]->mmHeight) { size.mmWidth = outputs[0]->mmWidth; size.mmHeight = outputs[0]->mmHeight; } else { size.mmWidth = pScreen->mmWidth; size.mmHeight = pScreen->mmHeight; } size.nRates = 1; rate.rate = RRVerticalRefresh(&mode->mode); size.pRates = &rate; ret = (*pScrPriv->rrSetConfig) (pScreen, rotation, rate.rate, &size); /* * Old 1.0 interface tied screen size to mode size */ if (ret) { RRCrtcNotify(crtc, mode, x, y, rotation, NULL, 1, outputs); RRScreenSizeNotify(pScreen); } } } #endif } if (ret) { RRTellChanged(pScreen); for (o = 0; o < numOutputs; o++) RRPostPendingProperties(outputs[o]); } } if (recompute) RRComputeContiguity(pScreen); return ret; } /* * Return crtc transform */ RRTransformPtr RRCrtcGetTransform(RRCrtcPtr crtc) { RRTransformPtr transform = &crtc->client_pending_transform; if (pixman_transform_is_identity(&transform->transform)) return NULL; return transform; } /* * Check whether the pending and current transforms are the same */ Bool RRCrtcPendingTransform(RRCrtcPtr crtc) { return memcmp(&crtc->client_current_transform.transform, &crtc->client_pending_transform.transform, sizeof(PictTransform)) != 0; } /* * Destroy a Crtc at shutdown */ void RRCrtcDestroy(RRCrtcPtr crtc) { FreeResource(crtc->id, 0); } static int RRCrtcDestroyResource(void *value, XID pid) { RRCrtcPtr crtc = (RRCrtcPtr) value; ScreenPtr pScreen = crtc->pScreen; if (pScreen) { rrScrPriv(pScreen); int i; for (i = 0; i < pScrPriv->numCrtcs; i++) { if (pScrPriv->crtcs[i] == crtc) { memmove(pScrPriv->crtcs + i, pScrPriv->crtcs + i + 1, (pScrPriv->numCrtcs - (i + 1)) * sizeof(RRCrtcPtr)); --pScrPriv->numCrtcs; break; } } RRResourcesChanged(pScreen); } if (crtc->scanout_pixmap) RRCrtcDetachScanoutPixmap(crtc); free(crtc->gammaRed); if (crtc->mode) RRModeDestroy(crtc->mode); free(crtc->outputs); free(crtc); return 1; } /* * Request that the Crtc gamma be changed */ Bool RRCrtcGammaSet(RRCrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue) { Bool ret = TRUE; #if RANDR_12_INTERFACE ScreenPtr pScreen = crtc->pScreen; #endif memcpy(crtc->gammaRed, red, crtc->gammaSize * sizeof(CARD16)); memcpy(crtc->gammaGreen, green, crtc->gammaSize * sizeof(CARD16)); memcpy(crtc->gammaBlue, blue, crtc->gammaSize * sizeof(CARD16)); #if RANDR_12_INTERFACE if (pScreen) { rrScrPriv(pScreen); if (pScrPriv->rrCrtcSetGamma) ret = (*pScrPriv->rrCrtcSetGamma) (pScreen, crtc); } #endif return ret; } /* * Request current gamma back from the DDX (if possible). * This includes gamma size. */ Bool RRCrtcGammaGet(RRCrtcPtr crtc) { Bool ret = TRUE; #if RANDR_12_INTERFACE ScreenPtr pScreen = crtc->pScreen; #endif #if RANDR_12_INTERFACE if (pScreen) { rrScrPriv(pScreen); if (pScrPriv->rrCrtcGetGamma) ret = (*pScrPriv->rrCrtcGetGamma) (pScreen, crtc); } #endif return ret; } /* * Notify the extension that the Crtc gamma has been changed * The driver calls this whenever it has changed the gamma values * in the RRCrtcRec */ Bool RRCrtcGammaNotify(RRCrtcPtr crtc) { return TRUE; /* not much going on here */ } static void RRModeGetScanoutSize(RRModePtr mode, PictTransformPtr transform, int *width, int *height) { BoxRec box; if (mode == NULL) { *width = 0; *height = 0; return; } box.x1 = 0; box.y1 = 0; box.x2 = mode->mode.width; box.y2 = mode->mode.height; pixman_transform_bounds(transform, &box); *width = box.x2 - box.x1; *height = box.y2 - box.y1; } /** * Returns the width/height that the crtc scans out from the framebuffer */ void RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height) { RRModeGetScanoutSize(crtc->mode, &crtc->transform, width, height); } /* * Set the size of the gamma table at server startup time */ Bool RRCrtcGammaSetSize(RRCrtcPtr crtc, int size) { CARD16 *gamma; if (size == crtc->gammaSize) return TRUE; if (size) { gamma = xallocarray(size, 3 * sizeof(CARD16)); if (!gamma) return FALSE; } else gamma = NULL; free(crtc->gammaRed); crtc->gammaRed = gamma; crtc->gammaGreen = gamma + size; crtc->gammaBlue = gamma + size * 2; crtc->gammaSize = size; return TRUE; } /* * Set the pending CRTC transformation */ int RRCrtcTransformSet(RRCrtcPtr crtc, PictTransformPtr transform, struct pixman_f_transform *f_transform, struct pixman_f_transform *f_inverse, char *filter_name, int filter_len, xFixed * params, int nparams) { PictFilterPtr filter = NULL; int width = 0, height = 0; if (!crtc->transforms) return BadValue; if (filter_len) { filter = PictureFindFilter(crtc->pScreen, filter_name, filter_len); if (!filter) return BadName; if (filter->ValidateParams) { if (!filter->ValidateParams(crtc->pScreen, filter->id, params, nparams, &width, &height)) return BadMatch; } else { width = filter->width; height = filter->height; } } else { if (nparams) return BadMatch; } if (!RRTransformSetFilter(&crtc->client_pending_transform, filter, params, nparams, width, height)) return BadAlloc; crtc->client_pending_transform.transform = *transform; crtc->client_pending_transform.f_transform = *f_transform; crtc->client_pending_transform.f_inverse = *f_inverse; return Success; } /* * Initialize crtc type */ Bool RRCrtcInit(void) { RRCrtcType = CreateNewResourceType(RRCrtcDestroyResource #ifndef NXAGENT_SERVER , "CRTC" #endif ); if (!RRCrtcType) return FALSE; #ifdef NXAGENT_SERVER RegisterResourceName(RRCrtcType, "CRTC"); #endif return TRUE; } /* * Initialize crtc type error value */ void RRCrtcInitErrorValue(void) { #ifndef NXAGENT_SERVER SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc); #endif } int ProcRRGetCrtcInfo(ClientPtr client) { REQUEST(xRRGetCrtcInfoReq); xRRGetCrtcInfoReply rep; RRCrtcPtr crtc; CARD8 *extra; unsigned long extraLen; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; RRModePtr mode; RROutput *outputs; RROutput *possible; int i, j, k; int width, height; BoxRec panned_area; REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); /* All crtcs must be associated with screens before client * requests are processed */ pScreen = crtc->pScreen; pScrPriv = rrGetScrPriv(pScreen); mode = crtc->mode; memset(&rep, 0, sizeof(xRRGetCrtcInfoReply)); rep = (xRRGetCrtcInfoReply) { .type = X_Reply, .status = RRSetConfigSuccess, .sequenceNumber = client->sequence, .length = 0, .timestamp = pScrPriv->lastSetTime.milliseconds }; if (pScrPriv->rrGetPanning && pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) && (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1)) { rep.x = panned_area.x1; rep.y = panned_area.y1; rep.width = panned_area.x2 - panned_area.x1; rep.height = panned_area.y2 - panned_area.y1; } else { RRCrtcGetScanoutSize(crtc, &width, &height); rep.x = crtc->x; rep.y = crtc->y; rep.width = width; rep.height = height; } rep.mode = mode ? mode->mode.id : 0; rep.rotation = crtc->rotation; rep.rotations = crtc->rotations; rep.nOutput = crtc->numOutputs; k = 0; for (i = 0; i < pScrPriv->numOutputs; i++) for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++) if (pScrPriv->outputs[i]->crtcs[j] == crtc) k++; rep.nPossibleOutput = k; rep.length = rep.nOutput + rep.nPossibleOutput; extraLen = rep.length << 2; if (extraLen) { extra = calloc(1, extraLen); if (!extra) return BadAlloc; } else extra = NULL; outputs = (RROutput *) extra; possible = (RROutput *) (outputs + rep.nOutput); for (i = 0; i < crtc->numOutputs; i++) { outputs[i] = crtc->outputs[i]->id; if (client->swapped) swapl(&outputs[i]); } k = 0; for (i = 0; i < pScrPriv->numOutputs; i++) for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++) if (pScrPriv->outputs[i]->crtcs[j] == crtc) { possible[k] = pScrPriv->outputs[i]->id; if (client->swapped) swapl(&possible[k]); k++; } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swaps(&rep.x); swaps(&rep.y); swaps(&rep.width); swaps(&rep.height); swapl(&rep.mode); swaps(&rep.rotation); swaps(&rep.rotations); swaps(&rep.nOutput); swaps(&rep.nPossibleOutput); } WriteToClient(client, sizeof(xRRGetCrtcInfoReply), &rep); if (extraLen) { WriteToClient(client, extraLen, extra); free(extra); } return Success; } int ProcRRSetCrtcConfig(ClientPtr client) { REQUEST(xRRSetCrtcConfigReq); xRRSetCrtcConfigReply rep; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; RRCrtcPtr crtc; RRModePtr mode; int numOutputs; RROutputPtr *outputs = NULL; RROutput *outputIds; TimeStamp time; Rotation rotation; int #ifndef NXAGENT_SERVER ret, #endif i, j; CARD8 status; REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq); numOutputs = (stuff->length - bytes_to_int32(SIZEOF(xRRSetCrtcConfigReq))); VERIFY_RR_CRTC(stuff->crtc, crtc, DixSetAttrAccess); if (stuff->mode == None) { mode = NULL; if (numOutputs > 0) return BadMatch; } else { VERIFY_RR_MODE(stuff->mode, mode, DixSetAttrAccess); if (numOutputs == 0) return BadMatch; } if (numOutputs) { outputs = xallocarray(numOutputs, sizeof(RROutputPtr)); if (!outputs) return BadAlloc; } else outputs = NULL; outputIds = (RROutput *) (stuff + 1); for (i = 0; i < numOutputs; i++) { #ifndef NXAGENT_SERVER ret = dixLookupResourceByType((void **) (outputs + i), outputIds[i], RROutputType, client, DixSetAttrAccess); if (ret != Success) { free(outputs); return ret; } #else /* !defined(NXAGENT_SERVER) */ outputs[i] = (RROutputPtr) LookupIDByType(outputIds[i], RROutputType); if (!outputs[i]) { client->errorValue = outputIds[i]; if (outputs) free(outputs); return RRErrorBase + BadRROutput; } #endif /* !defined(NXAGENT_SERVER) */ /* validate crtc for this output */ for (j = 0; j < outputs[i]->numCrtcs; j++) if (outputs[i]->crtcs[j] == crtc) break; if (j == outputs[i]->numCrtcs) { free(outputs); return BadMatch; } /* validate mode for this output */ for (j = 0; j < outputs[i]->numModes + outputs[i]->numUserModes; j++) { RRModePtr m = (j < outputs[i]->numModes ? outputs[i]->modes[j] : outputs[i]->userModes[j - outputs[i]->numModes]); if (m == mode) break; } if (j == outputs[i]->numModes + outputs[i]->numUserModes) { free(outputs); return BadMatch; } } /* validate clones */ for (i = 0; i < numOutputs; i++) { for (j = 0; j < numOutputs; j++) { int k; if (i == j) continue; for (k = 0; k < outputs[i]->numClones; k++) { if (outputs[i]->clones[k] == outputs[j]) break; } if (k == outputs[i]->numClones) { free(outputs); return BadMatch; } } } pScreen = crtc->pScreen; pScrPriv = rrGetScrPriv(pScreen); time = ClientTimeToServerTime(stuff->timestamp); if (!pScrPriv) { time = currentTime; status = RRSetConfigFailed; goto sendReply; } /* * Validate requested rotation */ rotation = (Rotation) stuff->rotation; /* test the rotation bits only! */ switch (rotation & 0xf) { case RR_Rotate_0: case RR_Rotate_90: case RR_Rotate_180: case RR_Rotate_270: break; default: /* * Invalid rotation */ client->errorValue = stuff->rotation; free(outputs); return BadValue; } if (mode) { if ((~crtc->rotations) & rotation) { /* * requested rotation or reflection not supported by screen */ client->errorValue = stuff->rotation; free(outputs); return BadMatch; } #ifdef RANDR_12_INTERFACE /* * Check screen size bounds if the DDX provides a 1.2 interface * for setting screen size. Else, assume the CrtcSet sets * the size along with the mode. If the driver supports transforms, * then it must allow crtcs to display a subset of the screen, so * only do this check for drivers without transform support. */ if (pScrPriv->rrScreenSetSize && !crtc->transforms) { int source_width; int source_height; PictTransform transform; struct pixman_f_transform f_transform, f_inverse; int width, height; #ifndef NXAGENT_SERVER if (pScreen->isGPU) { width = pScreen->current_master->width; height = pScreen->current_master->height; } else #else /* !defined(NXAGENT_SERVER) */ { width = pScreen->width; height = pScreen->height; } #endif /* !defined(NXAGENT_SERVER) */ RRTransformCompute(stuff->x, stuff->y, mode->mode.width, mode->mode.height, rotation, &crtc->client_pending_transform, &transform, &f_transform, &f_inverse); RRModeGetScanoutSize(mode, &transform, &source_width, &source_height); if (stuff->x + source_width > width) { client->errorValue = stuff->x; free(outputs); return BadValue; } if (stuff->y + source_height > height) { client->errorValue = stuff->y; free(outputs); return BadValue; } } #endif } if (!RRCrtcSet(crtc, mode, stuff->x, stuff->y, rotation, numOutputs, outputs)) { status = RRSetConfigFailed; goto sendReply; } status = RRSetConfigSuccess; pScrPriv->lastSetTime = time; sendReply: free(outputs); memset(&rep, 0, sizeof(xRRSetCrtcConfigReply)); rep = (xRRSetCrtcConfigReply) { .type = X_Reply, .status = status, .sequenceNumber = client->sequence, .length = 0, .newTimestamp = pScrPriv->lastSetTime.milliseconds }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.newTimestamp); } WriteToClient(client, sizeof(xRRSetCrtcConfigReply), &rep); return Success; } int ProcRRGetPanning(ClientPtr client) { REQUEST(xRRGetPanningReq); xRRGetPanningReply rep; RRCrtcPtr crtc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; BoxRec total; BoxRec tracking; INT16 border[4]; REQUEST_SIZE_MATCH(xRRGetPanningReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); /* All crtcs must be associated with screens before client * requests are processed */ pScreen = crtc->pScreen; pScrPriv = rrGetScrPriv(pScreen); if (!pScrPriv) return RRErrorBase + BadRRCrtc; memset(&rep, 0, sizeof(xRRGetPanningReply)); rep = (xRRGetPanningReply) { .type = X_Reply, .status = RRSetConfigSuccess, .sequenceNumber = client->sequence, .length = 1, .timestamp = pScrPriv->lastSetTime.milliseconds }; if (pScrPriv->rrGetPanning && pScrPriv->rrGetPanning(pScreen, crtc, &total, &tracking, border)) { rep.left = total.x1; rep.top = total.y1; rep.width = total.x2 - total.x1; rep.height = total.y2 - total.y1; rep.track_left = tracking.x1; rep.track_top = tracking.y1; rep.track_width = tracking.x2 - tracking.x1; rep.track_height = tracking.y2 - tracking.y1; rep.border_left = border[0]; rep.border_top = border[1]; rep.border_right = border[2]; rep.border_bottom = border[3]; } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swaps(&rep.left); swaps(&rep.top); swaps(&rep.width); swaps(&rep.height); swaps(&rep.track_left); swaps(&rep.track_top); swaps(&rep.track_width); swaps(&rep.track_height); swaps(&rep.border_left); swaps(&rep.border_top); swaps(&rep.border_right); swaps(&rep.border_bottom); } WriteToClient(client, sizeof(xRRGetPanningReply), &rep); return Success; } int ProcRRSetPanning(ClientPtr client) { REQUEST(xRRSetPanningReq); xRRSetPanningReply rep; RRCrtcPtr crtc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; TimeStamp time; BoxRec total; BoxRec tracking; INT16 border[4]; CARD8 status; REQUEST_SIZE_MATCH(xRRSetPanningReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); /* All crtcs must be associated with screens before client * requests are processed */ pScreen = crtc->pScreen; pScrPriv = rrGetScrPriv(pScreen); if (!pScrPriv) { time = currentTime; status = RRSetConfigFailed; goto sendReply; } time = ClientTimeToServerTime(stuff->timestamp); if (!pScrPriv->rrGetPanning) return RRErrorBase + BadRRCrtc; total.x1 = stuff->left; total.y1 = stuff->top; total.x2 = total.x1 + stuff->width; total.y2 = total.y1 + stuff->height; tracking.x1 = stuff->track_left; tracking.y1 = stuff->track_top; tracking.x2 = tracking.x1 + stuff->track_width; tracking.y2 = tracking.y1 + stuff->track_height; border[0] = stuff->border_left; border[1] = stuff->border_top; border[2] = stuff->border_right; border[3] = stuff->border_bottom; if (!pScrPriv->rrSetPanning(pScreen, crtc, &total, &tracking, border)) return BadMatch; pScrPriv->lastSetTime = time; status = RRSetConfigSuccess; sendReply: memset(&rep, 0, sizeof(xRRSetPanningReply)); rep = (xRRSetPanningReply) { .type = X_Reply, .status = status, .sequenceNumber = client->sequence, .length = 0, .newTimestamp = pScrPriv->lastSetTime.milliseconds }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.newTimestamp); } WriteToClient(client, sizeof(xRRSetPanningReply), &rep); return Success; } int ProcRRGetCrtcGammaSize(ClientPtr client) { REQUEST(xRRGetCrtcGammaSizeReq); xRRGetCrtcGammaSizeReply reply; RRCrtcPtr crtc; REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); /* Gamma retrieval failed, any better error? */ if (!RRCrtcGammaGet(crtc)) return RRErrorBase + BadRRCrtc; reply = (xRRGetCrtcGammaSizeReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .size = crtc->gammaSize }; if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swaps(&reply.size); } WriteToClient(client, sizeof(xRRGetCrtcGammaSizeReply), &reply); return Success; } int ProcRRGetCrtcGamma(ClientPtr client) { REQUEST(xRRGetCrtcGammaReq); xRRGetCrtcGammaReply reply; RRCrtcPtr crtc; unsigned long len; char *extra = NULL; REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); /* Gamma retrieval failed, any better error? */ if (!RRCrtcGammaGet(crtc)) return RRErrorBase + BadRRCrtc; len = crtc->gammaSize * 3 * 2; if (crtc->gammaSize) { extra = calloc(1, len); if (!extra) return BadAlloc; } reply = (xRRGetCrtcGammaReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(len), .size = crtc->gammaSize }; if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swaps(&reply.size); } WriteToClient(client, sizeof(xRRGetCrtcGammaReply), &reply); if (crtc->gammaSize) { memcpy(extra, crtc->gammaRed, len); client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write; WriteSwappedDataToClient(client, len, extra); free(extra); } return Success; } int ProcRRSetCrtcGamma(ClientPtr client) { REQUEST(xRRSetCrtcGammaReq); RRCrtcPtr crtc; unsigned long len; CARD16 *red, *green, *blue; REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); len = client->req_len - bytes_to_int32(sizeof(xRRSetCrtcGammaReq)); if (len < (stuff->size * 3 + 1) >> 1) return BadLength; if (stuff->size != crtc->gammaSize) return BadMatch; red = (CARD16 *) (stuff + 1); green = red + crtc->gammaSize; blue = green + crtc->gammaSize; RRCrtcGammaSet(crtc, red, green, blue); return Success; } /* Version 1.3 additions */ int ProcRRSetCrtcTransform(ClientPtr client) { REQUEST(xRRSetCrtcTransformReq); RRCrtcPtr crtc; PictTransform transform; struct pixman_f_transform f_transform, f_inverse; char *filter; int nbytes; xFixed *params; int nparams; REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); PictTransform_from_xRenderTransform(&transform, &stuff->transform); pixman_f_transform_from_pixman_transform(&f_transform, &transform); if (!pixman_f_transform_invert(&f_inverse, &f_transform)) return BadMatch; filter = (char *) (stuff + 1); nbytes = stuff->nbytesFilter; params = (xFixed *) (filter + pad_to_int32(nbytes)); nparams = ((xFixed *) stuff + client->req_len) - params; if (nparams < 0) return BadLength; return RRCrtcTransformSet(crtc, &transform, &f_transform, &f_inverse, filter, nbytes, params, nparams); } #define CrtcTransformExtra (SIZEOF(xRRGetCrtcTransformReply) - 32) static int transform_filter_length(RRTransformPtr transform) { int nbytes, nparams; if (transform->filter == NULL) return 0; nbytes = strlen(transform->filter->name); nparams = transform->nparams; return pad_to_int32(nbytes) + (nparams * sizeof(xFixed)); } static int transform_filter_encode(ClientPtr client, char *output, CARD16 *nbytesFilter, CARD16 *nparamsFilter, RRTransformPtr transform) { int nbytes, nparams; if (transform->filter == NULL) { *nbytesFilter = 0; *nparamsFilter = 0; return 0; } nbytes = strlen(transform->filter->name); nparams = transform->nparams; *nbytesFilter = nbytes; *nparamsFilter = nparams; memcpy(output, transform->filter->name, nbytes); while ((nbytes & 3) != 0) output[nbytes++] = 0; memcpy(output + nbytes, transform->params, nparams * sizeof(xFixed)); if (client->swapped) { swaps(nbytesFilter); swaps(nparamsFilter); SwapLongs((CARD32 *) (output + nbytes), nparams); } nbytes += nparams * sizeof(xFixed); return nbytes; } static void transform_encode(ClientPtr client, xRenderTransform * wire, PictTransform * pict) { xRenderTransform_from_PictTransform(wire, pict); if (client->swapped) SwapLongs((CARD32 *) wire, bytes_to_int32(sizeof(xRenderTransform))); } int ProcRRGetCrtcTransform(ClientPtr client) { REQUEST(xRRGetCrtcTransformReq); xRRGetCrtcTransformReply *reply; RRCrtcPtr crtc; int nextra; RRTransformPtr current, pending; char *extra; REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); pending = &crtc->client_pending_transform; current = &crtc->client_current_transform; nextra = (transform_filter_length(pending) + transform_filter_length(current)); reply = calloc(1, sizeof(xRRGetCrtcTransformReply) + nextra); if (!reply) return BadAlloc; extra = (char *) (reply + 1); reply->type = X_Reply; reply->sequenceNumber = client->sequence; reply->length = bytes_to_int32(CrtcTransformExtra + nextra); reply->hasTransforms = crtc->transforms; transform_encode(client, &reply->pendingTransform, &pending->transform); extra += transform_filter_encode(client, extra, &reply->pendingNbytesFilter, &reply->pendingNparamsFilter, pending); transform_encode(client, &reply->currentTransform, ¤t->transform); extra += transform_filter_encode(client, extra, &reply->currentNbytesFilter, &reply->currentNparamsFilter, current); if (client->swapped) { swaps(&reply->sequenceNumber); swapl(&reply->length); } WriteToClient(client, sizeof(xRRGetCrtcTransformReply) + nextra, reply); free(reply); return Success; } static Bool check_all_screen_crtcs(ScreenPtr pScreen, int *x, int *y) { rrScrPriv(pScreen); int i; for (i = 0; i < pScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pScrPriv->crtcs[i]; int left, right, top, bottom; if (!crtc->mode) continue; crtc_bounds(crtc, &left, &right, &top, &bottom); if ((*x >= left) && (*x < right) && (*y >= top) && (*y < bottom)) return TRUE; } return FALSE; } static Bool constrain_all_screen_crtcs( #ifndef NXAGENT_SERVER DeviceIntPtr pDev, #endif /* !defined(NXAGENT_SERVER) */ ScreenPtr pScreen, int *x, int *y) { rrScrPriv(pScreen); int i; /* if we're trying to escape, clamp to the CRTC we're coming from */ for (i = 0; i < pScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pScrPriv->crtcs[i]; int nx, ny; int left, right, top, bottom; if (!crtc->mode) continue; crtc_bounds(crtc, &left, &right, &top, &bottom); #ifndef NXAGENT_SERVER miPointerGetPosition(pDev, &nx, &ny); #else /* !defined(NXAGENT_SERVER) */ miPointerPosition(&nx, &ny); #endif /* !defined(NXAGENT_SERVER) */ if ((nx >= left) && (nx < right) && (ny >= top) && (ny < bottom)) { if (*x < left) *x = left; if (*x >= right) *x = right - 1; if (*y < top) *y = top; if (*y >= bottom) *y = bottom - 1; return TRUE; } } return FALSE; } void RRConstrainCursorHarder( #ifndef NXAGENT_SERVER DeviceIntPtr pDev, #endif /* !defined(NXAGENT_SERVER) */ ScreenPtr pScreen, int mode, int *x, int *y) { rrScrPriv(pScreen); Bool ret; #ifndef NXAGENT_SERVER ScreenPtr slave; #endif /* intentional dead space -> let it float */ if (pScrPriv->discontiguous) return; /* if we're moving inside a crtc, we're fine */ ret = check_all_screen_crtcs(pScreen, x, y); if (ret == TRUE) return; #ifndef NXAGENT_SERVER xorg_list_for_each_entry(slave, &pScreen->output_slave_list, output_head) { ret = check_all_screen_crtcs(slave, x, y); if (ret == TRUE) return; } #endif /* !defined(NXAGENT_SERVER) */ /* if we're trying to escape, clamp to the CRTC we're coming from */ ret = constrain_all_screen_crtcs( #ifndef NXAGENT_SERVER pDev, #endif /* !defined(NXAGENT_SERVER) */ pScreen, x, y); if (ret == TRUE) return; #ifndef NXAGENT_SERVER xorg_list_for_each_entry(slave, &pScreen->output_slave_list, output_head) { ret = constrain_all_screen_crtcs(pDev, slave, x, y); if (ret == TRUE) return; } #endif /* !defined(NXAGENT_SERVER) */ } Bool RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable) { rrScrPriv(pDrawable->pScreen); Bool ret = TRUE; PixmapPtr *saved_scanout_pixmap; int i; saved_scanout_pixmap = malloc(sizeof(PixmapPtr) * pScrPriv->numCrtcs); if (saved_scanout_pixmap == NULL) return FALSE; for (i = 0; i < pScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pScrPriv->crtcs[i]; Bool size_fits; saved_scanout_pixmap[i] = crtc->scanout_pixmap; if (!crtc->mode && enable) continue; if (!crtc->scanout_pixmap && !enable) continue; size_fits = (crtc->mode && crtc->x == pDrawable->x && crtc->y == pDrawable->y && crtc->mode->mode.width == pDrawable->width && crtc->mode->mode.height == pDrawable->height); /* is the pixmap already set? */ if (crtc->scanout_pixmap == pPixmap) { /* if its a disable then don't care about size */ if (enable == FALSE) { /* set scanout to NULL */ crtc->scanout_pixmap = NULL; } else if (!size_fits) { /* if the size no longer fits then drop off */ crtc->scanout_pixmap = NULL; pScrPriv->rrCrtcSetScanoutPixmap(crtc, crtc->scanout_pixmap); (*pScrPriv->rrCrtcSet) (pDrawable->pScreen, crtc, crtc->mode, crtc->x, crtc->y, crtc->rotation, crtc->numOutputs, crtc->outputs); saved_scanout_pixmap[i] = crtc->scanout_pixmap; ret = FALSE; } else { /* if the size fits then we are already setup */ } } else { if (!size_fits) ret = FALSE; else if (enable) crtc->scanout_pixmap = pPixmap; else /* reject an attempt to disable someone else's scanout_pixmap */ ret = FALSE; } } for (i = 0; i < pScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pScrPriv->crtcs[i]; if (crtc->scanout_pixmap == saved_scanout_pixmap[i]) continue; if (ret) { pScrPriv->rrCrtcSetScanoutPixmap(crtc, crtc->scanout_pixmap); (*pScrPriv->rrCrtcSet) (pDrawable->pScreen, crtc, crtc->mode, crtc->x, crtc->y, crtc->rotation, crtc->numOutputs, crtc->outputs); } else crtc->scanout_pixmap = saved_scanout_pixmap[i]; } free(saved_scanout_pixmap); return ret; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rrdispatch.c0000644000000000000000000002366013614532331020217 0ustar /* * Copyright © 2006 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "randrstr.h" #include "protocol-versions.h" Bool RRClientKnowsRates(ClientPtr pClient) { rrClientPriv(pClient); return version_compare(pRRClient->major_version, pRRClient->minor_version, 1, 1) >= 0; } static int ProcRRQueryVersion(ClientPtr client) { xRRQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; REQUEST(xRRQueryVersionReq); rrClientPriv(client); REQUEST_SIZE_MATCH(xRRQueryVersionReq); pRRClient->major_version = stuff->majorVersion; pRRClient->minor_version = stuff->minorVersion; if (version_compare(stuff->majorVersion, stuff->minorVersion, SERVER_RANDR_MAJOR_VERSION, SERVER_RANDR_MINOR_VERSION) < 0) { rep.majorVersion = stuff->majorVersion; rep.minorVersion = stuff->minorVersion; } else { rep.majorVersion = SERVER_RANDR_MAJOR_VERSION; rep.minorVersion = SERVER_RANDR_MINOR_VERSION; } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.majorVersion); swapl(&rep.minorVersion); } WriteToClient(client, sizeof(xRRQueryVersionReply), &rep); return Success; } static int ProcRRSelectInput(ClientPtr client) { REQUEST(xRRSelectInputReq); rrClientPriv(client); RRTimesPtr pTimes; WindowPtr pWin; RREventPtr pRREvent, *pHead; XID clientResource; int rc; REQUEST_SIZE_MATCH(xRRSelectInputReq); #ifndef NXAGENT_SERVER rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess); #else pWin = SecurityLookupWindow(stuff->window, client, DixWriteAccess); rc = pWin ? Success : BadWindow; #endif if (rc != Success) return rc; #ifndef NXAGENT_SERVER rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id, RREventType, client, DixWriteAccess); #else /* !defined(NXAGENT_SERVER) */ pHead = (RREventPtr *) LookupIDByType(pWin->drawable.id, RREventType); #endif /* !defined(NXAGENT_SERVER) */ if (rc != Success && rc != BadValue) return rc; if (stuff->enable & (RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask | RROutputChangeNotifyMask | RROutputPropertyNotifyMask | RRProviderChangeNotifyMask | RRProviderPropertyNotifyMask | RRResourceChangeNotifyMask)) { ScreenPtr pScreen = pWin->drawable.pScreen; rrScrPriv(pScreen); pRREvent = NULL; if (pHead) { /* check for existing entry. */ for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) if (pRREvent->client == client) break; } if (!pRREvent) { /* build the entry */ pRREvent = (RREventPtr) malloc(sizeof(RREventRec)); if (!pRREvent) return BadAlloc; pRREvent->next = 0; pRREvent->client = client; pRREvent->window = pWin; pRREvent->mask = stuff->enable; /* * add a resource that will be deleted when * the client goes away */ clientResource = FakeClientID(client->index); pRREvent->clientResource = clientResource; if (!AddResource(clientResource, RRClientType, (void *) pRREvent)) return BadAlloc; /* * create a resource to contain a pointer to the list * of clients selecting input. This must be indirect as * the list may be arbitrarily rearranged which cannot be * done through the resource database. */ if (!pHead) { pHead = (RREventPtr *) malloc(sizeof(RREventPtr)); if (!pHead || !AddResource(pWin->drawable.id, RREventType, (void *) pHead)) { FreeResource(clientResource, RT_NONE); return BadAlloc; } *pHead = 0; } pRREvent->next = *pHead; *pHead = pRREvent; } /* * Now see if the client needs an event */ if (pScrPriv) { pTimes = &((RRTimesPtr) (pRRClient + 1))[pScreen->myNum]; if (CompareTimeStamps(pTimes->setTime, pScrPriv->lastSetTime) != 0 || CompareTimeStamps(pTimes->configTime, pScrPriv->lastConfigTime) != 0) { if (pRREvent->mask & RRScreenChangeNotifyMask) { RRDeliverScreenEvent(client, pWin, pScreen); } if (pRREvent->mask & RRCrtcChangeNotifyMask) { int i; for (i = 0; i < pScrPriv->numCrtcs; i++) { RRDeliverCrtcEvent(client, pWin, pScrPriv->crtcs[i]); } } if (pRREvent->mask & RROutputChangeNotifyMask) { int i; for (i = 0; i < pScrPriv->numOutputs; i++) { RRDeliverOutputEvent(client, pWin, pScrPriv->outputs[i]); } } /* We don't check for RROutputPropertyNotifyMask, as randrproto.txt doesn't * say if there ought to be notifications of changes to output properties * if those changes occurred before the time RRSelectInput is called. */ } } } else if (stuff->enable == 0) { /* delete the interest */ if (pHead) { RREventPtr pNewRREvent = 0; for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) { if (pRREvent->client == client) break; pNewRREvent = pRREvent; } if (pRREvent) { FreeResource(pRREvent->clientResource, RRClientType); if (pNewRREvent) pNewRREvent->next = pRREvent->next; else *pHead = pRREvent->next; free(pRREvent); } } } else { client->errorValue = stuff->enable; return BadValue; } return Success; } int (*ProcRandrVector[RRNumberRequests]) (ClientPtr) = { ProcRRQueryVersion, /* 0 */ /* we skip 1 to make old clients fail pretty immediately */ NULL, /* 1 ProcRandrOldGetScreenInfo */ /* V1.0 apps share the same set screen config request id */ ProcRRSetScreenConfig, /* 2 */ NULL, /* 3 ProcRandrOldScreenChangeSelectInput */ /* 3 used to be ScreenChangeSelectInput; deprecated */ ProcRRSelectInput, /* 4 */ ProcRRGetScreenInfo, /* 5 */ /* V1.2 additions */ ProcRRGetScreenSizeRange, /* 6 */ ProcRRSetScreenSize, /* 7 */ ProcRRGetScreenResources, /* 8 */ ProcRRGetOutputInfo, /* 9 */ ProcRRListOutputProperties, /* 10 */ ProcRRQueryOutputProperty, /* 11 */ ProcRRConfigureOutputProperty, /* 12 */ ProcRRChangeOutputProperty, /* 13 */ ProcRRDeleteOutputProperty, /* 14 */ ProcRRGetOutputProperty, /* 15 */ ProcRRCreateMode, /* 16 */ ProcRRDestroyMode, /* 17 */ ProcRRAddOutputMode, /* 18 */ ProcRRDeleteOutputMode, /* 19 */ ProcRRGetCrtcInfo, /* 20 */ ProcRRSetCrtcConfig, /* 21 */ ProcRRGetCrtcGammaSize, /* 22 */ ProcRRGetCrtcGamma, /* 23 */ ProcRRSetCrtcGamma, /* 24 */ /* V1.3 additions */ ProcRRGetScreenResourcesCurrent, /* 25 */ ProcRRSetCrtcTransform, /* 26 */ ProcRRGetCrtcTransform, /* 27 */ ProcRRGetPanning, /* 28 */ ProcRRSetPanning, /* 29 */ ProcRRSetOutputPrimary, /* 30 */ ProcRRGetOutputPrimary, /* 31 */ /* V1.4 additions */ ProcRRGetProviders, /* 32 */ ProcRRGetProviderInfo, /* 33 */ ProcRRSetProviderOffloadSink, /* 34 */ ProcRRSetProviderOutputSource, /* 35 */ ProcRRListProviderProperties, /* 36 */ ProcRRQueryProviderProperty, /* 37 */ ProcRRConfigureProviderProperty, /* 38 */ ProcRRChangeProviderProperty, /* 39 */ ProcRRDeleteProviderProperty, /* 40 */ ProcRRGetProviderProperty, /* 41 */ ProcRRGetMonitors, /* 42 */ ProcRRSetMonitor, /* 43 */ ProcRRDeleteMonitor, /* 44 */ }; nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rrinfo.c0000644000000000000000000002145713614532331017355 0ustar /* * Copyright © 2006 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "randrstr.h" #ifdef RANDR_10_INTERFACE static RRModePtr RROldModeAdd(RROutputPtr output, RRScreenSizePtr size, int refresh) { ScreenPtr pScreen = output->pScreen; rrScrPriv(pScreen); xRRModeInfo modeInfo; char name[100]; RRModePtr mode; int i; RRModePtr *modes; memset(&modeInfo, '\0', sizeof(modeInfo)); snprintf(name, sizeof(name), "%dx%d", size->width, size->height); modeInfo.width = size->width; modeInfo.height = size->height; modeInfo.hTotal = size->width; modeInfo.vTotal = size->height; modeInfo.dotClock = ((CARD32) size->width * (CARD32) size->height * (CARD32) refresh); modeInfo.nameLength = strlen(name); mode = RRModeGet(&modeInfo, name); if (!mode) return NULL; for (i = 0; i < output->numModes; i++) if (output->modes[i] == mode) { RRModeDestroy(mode); return mode; } if (output->numModes) modes = reallocarray(output->modes, output->numModes + 1, sizeof(RRModePtr)); else modes = malloc(sizeof(RRModePtr)); if (!modes) { RRModeDestroy(mode); FreeResource(mode->mode.id, 0); return NULL; } modes[output->numModes++] = mode; output->modes = modes; output->changed = TRUE; pScrPriv->changed = TRUE; pScrPriv->configChanged = TRUE; return mode; } static void RRScanOldConfig(ScreenPtr pScreen, Rotation rotations) { rrScrPriv(pScreen); RROutputPtr output; RRCrtcPtr crtc; RRModePtr mode, newMode = NULL; int i; CARD16 minWidth = MAXSHORT, minHeight = MAXSHORT; CARD16 maxWidth = 0, maxHeight = 0; CARD16 width, height; /* * First time through, create a crtc and output and hook * them together */ if (pScrPriv->numOutputs == 0 && pScrPriv->numCrtcs == 0) { crtc = RRCrtcCreate(pScreen, NULL); if (!crtc) return; output = RROutputCreate(pScreen, "default", 7, NULL); if (!output) return; RROutputSetCrtcs(output, &crtc, 1); RROutputSetConnection(output, RR_Connected); RROutputSetSubpixelOrder(output, PictureGetSubpixelOrder(pScreen)); } output = pScrPriv->outputs[0]; if (!output) return; crtc = pScrPriv->crtcs[0]; if (!crtc) return; /* check rotations */ if (rotations != crtc->rotations) { crtc->rotations = rotations; crtc->changed = TRUE; pScrPriv->changed = TRUE; } /* regenerate mode list */ for (i = 0; i < pScrPriv->nSizes; i++) { RRScreenSizePtr size = &pScrPriv->pSizes[i]; int r; if (size->nRates) { for (r = 0; r < size->nRates; r++) { mode = RROldModeAdd(output, size, size->pRates[r].rate); if (i == pScrPriv->size && size->pRates[r].rate == pScrPriv->rate) { newMode = mode; } } free(size->pRates); } else { mode = RROldModeAdd(output, size, 0); if (i == pScrPriv->size) newMode = mode; } } if (pScrPriv->nSizes) free(pScrPriv->pSizes); pScrPriv->pSizes = NULL; pScrPriv->nSizes = 0; /* find size bounds */ for (i = 0; i < output->numModes + output->numUserModes; i++) { mode = (i < output->numModes ? output->modes[i] : output->userModes[i - output->numModes]); width = mode->mode.width; height = mode->mode.height; if (width < minWidth) minWidth = width; if (width > maxWidth) maxWidth = width; if (height < minHeight) minHeight = height; if (height > maxHeight) maxHeight = height; } RRScreenSetSizeRange(pScreen, minWidth, minHeight, maxWidth, maxHeight); /* notice current mode */ if (newMode) RRCrtcNotify(crtc, newMode, 0, 0, pScrPriv->rotation, NULL, 1, &output); } #endif /* * Poll the driver for changed information */ Bool RRGetInfo(ScreenPtr pScreen, Bool force_query) { rrScrPriv(pScreen); Rotation rotations; int i; /* Return immediately if we don't need to re-query and we already have the * information. */ if (!force_query) { if (pScrPriv->numCrtcs != 0 || pScrPriv->numOutputs != 0) return TRUE; } for (i = 0; i < pScrPriv->numOutputs; i++) pScrPriv->outputs[i]->changed = FALSE; for (i = 0; i < pScrPriv->numCrtcs; i++) pScrPriv->crtcs[i]->changed = FALSE; rotations = 0; pScrPriv->changed = FALSE; pScrPriv->configChanged = FALSE; if (!(*pScrPriv->rrGetInfo) (pScreen, &rotations)) return FALSE; #if RANDR_10_INTERFACE if (pScrPriv->nSizes) RRScanOldConfig(pScreen, rotations); #endif RRTellChanged(pScreen); return TRUE; } /* * Register the range of sizes for the screen */ void RRScreenSetSizeRange(ScreenPtr pScreen, CARD16 minWidth, CARD16 minHeight, CARD16 maxWidth, CARD16 maxHeight) { rrScrPriv(pScreen); if (!pScrPriv) return; if (pScrPriv->minWidth == minWidth && pScrPriv->minHeight == minHeight && pScrPriv->maxWidth == maxWidth && pScrPriv->maxHeight == maxHeight) { return; } pScrPriv->minWidth = minWidth; pScrPriv->minHeight = minHeight; pScrPriv->maxWidth = maxWidth; pScrPriv->maxHeight = maxHeight; RRSetChanged(pScreen); pScrPriv->configChanged = TRUE; } #ifdef RANDR_10_INTERFACE static Bool RRScreenSizeMatches(RRScreenSizePtr a, RRScreenSizePtr b) { if (a->width != b->width) return FALSE; if (a->height != b->height) return FALSE; if (a->mmWidth != b->mmWidth) return FALSE; if (a->mmHeight != b->mmHeight) return FALSE; return TRUE; } RRScreenSizePtr RRRegisterSize(ScreenPtr pScreen, short width, short height, short mmWidth, short mmHeight) { rrScrPriv(pScreen); int i; RRScreenSize tmp; RRScreenSizePtr pNew; if (!pScrPriv) return 0; tmp.id = 0; tmp.width = width; tmp.height = height; tmp.mmWidth = mmWidth; tmp.mmHeight = mmHeight; tmp.pRates = 0; tmp.nRates = 0; for (i = 0; i < pScrPriv->nSizes; i++) if (RRScreenSizeMatches(&tmp, &pScrPriv->pSizes[i])) return &pScrPriv->pSizes[i]; pNew = reallocarray(pScrPriv->pSizes, pScrPriv->nSizes + 1, sizeof(RRScreenSize)); if (!pNew) return 0; pNew[pScrPriv->nSizes++] = tmp; pScrPriv->pSizes = pNew; return &pNew[pScrPriv->nSizes - 1]; } Bool RRRegisterRate(ScreenPtr pScreen, RRScreenSizePtr pSize, int rate) { rrScrPriv(pScreen); int i; RRScreenRatePtr pNew, pRate; if (!pScrPriv) return FALSE; for (i = 0; i < pSize->nRates; i++) if (pSize->pRates[i].rate == rate) return TRUE; pNew = reallocarray(pSize->pRates, pSize->nRates + 1, sizeof(RRScreenRate)); if (!pNew) return FALSE; pRate = &pNew[pSize->nRates++]; pRate->rate = rate; pSize->pRates = pNew; return TRUE; } Rotation RRGetRotation(ScreenPtr pScreen) { RROutputPtr output = RRFirstOutput(pScreen); if (!output) return RR_Rotate_0; return output->crtc->rotation; } void RRSetCurrentConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { rrScrPriv(pScreen); if (!pScrPriv) return; pScrPriv->size = pSize - pScrPriv->pSizes; pScrPriv->rotation = rotation; pScrPriv->rate = rate; } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rrmode.c0000644000000000000000000003002313614532331017333 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Copyright © 2006 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "randrstr.h" RESTYPE RRModeType; static Bool RRModeEqual(xRRModeInfo * a, xRRModeInfo * b) { if (a->width != b->width) return FALSE; if (a->height != b->height) return FALSE; if (a->dotClock != b->dotClock) return FALSE; if (a->hSyncStart != b->hSyncStart) return FALSE; if (a->hSyncEnd != b->hSyncEnd) return FALSE; if (a->hTotal != b->hTotal) return FALSE; if (a->hSkew != b->hSkew) return FALSE; if (a->vSyncStart != b->vSyncStart) return FALSE; if (a->vSyncEnd != b->vSyncEnd) return FALSE; if (a->vTotal != b->vTotal) return FALSE; if (a->nameLength != b->nameLength) return FALSE; if (a->modeFlags != b->modeFlags) return FALSE; return TRUE; } /* * Keep a list so it's easy to find modes in the resource database. */ static int num_modes; static RRModePtr *modes; static RRModePtr RRModeCreate(xRRModeInfo * modeInfo, const char *name, ScreenPtr userScreen) { RRModePtr mode, *newModes; if (!RRInit()) return NULL; mode = malloc(sizeof(RRModeRec) + modeInfo->nameLength + 1); if (!mode) return NULL; mode->refcnt = 1; mode->mode = *modeInfo; mode->name = (char *) (mode + 1); memcpy(mode->name, name, modeInfo->nameLength); mode->name[modeInfo->nameLength] = '\0'; mode->userScreen = userScreen; if (num_modes) newModes = reallocarray(modes, num_modes + 1, sizeof(RRModePtr)); else newModes = malloc(sizeof(RRModePtr)); if (!newModes) { free(mode); return NULL; } mode->mode.id = FakeClientID(0); if (!AddResource(mode->mode.id, RRModeType, (void *) mode)) { free(newModes); return NULL; } modes = newModes; modes[num_modes++] = mode; /* * give the caller a reference to this mode */ ++mode->refcnt; #ifdef DEBUG fprintf(stderr, "RRModeCreate: num_modes [%d] new mode [%s] ([%p]) refcnt [%d]\n", num_modes, mode->name, mode, mode->refcnt); #endif return mode; } static RRModePtr RRModeFindByName(const char *name, CARD16 nameLength) { int i; RRModePtr mode; for (i = 0; i < num_modes; i++) { mode = modes[i]; if (mode->mode.nameLength == nameLength && !memcmp(name, mode->name, nameLength)) { return mode; } } return NULL; } RRModePtr RRModeGet(xRRModeInfo * modeInfo, const char *name) { int i; for (i = 0; i < num_modes; i++) { RRModePtr mode = modes[i]; if (RRModeEqual(&mode->mode, modeInfo) && !memcmp(name, mode->name, modeInfo->nameLength)) { ++mode->refcnt; #ifdef DEBUG fprintf(stderr, "RRModeGet: return existing mode [%s] ([%p]) refcnt [%d]\n", mode->name, mode, mode->refcnt); #endif return mode; } } #ifdef DEBUG { RRModePtr mode = RRModeCreate(modeInfo, name, NULL); fprintf(stderr, "RRModeGet: return new mode [%s] ([%p]) refcnt [%d]\n", mode->name, mode, mode->refcnt); return mode; } #else return RRModeCreate(modeInfo, name, NULL); #endif } static RRModePtr RRModeCreateUser(ScreenPtr pScreen, xRRModeInfo * modeInfo, const char *name, int *error) { RRModePtr mode; mode = RRModeFindByName(name, modeInfo->nameLength); if (mode) { *error = BadName; return NULL; } mode = RRModeCreate(modeInfo, name, pScreen); if (!mode) { *error = BadAlloc; return NULL; } *error = Success; return mode; } RRModePtr * RRModesForScreen(ScreenPtr pScreen, int *num_ret) { rrScrPriv(pScreen); int o, c, m; RRModePtr *screen_modes; int num_screen_modes = 0; screen_modes = xallocarray((num_modes ? num_modes : 1), sizeof(RRModePtr)); if (!screen_modes) return NULL; /* * Add modes from all outputs */ for (o = 0; o < pScrPriv->numOutputs; o++) { RROutputPtr output = pScrPriv->outputs[o]; int n; for (m = 0; m < output->numModes + output->numUserModes; m++) { RRModePtr mode = (m < output->numModes ? output->modes[m] : output->userModes[m - output->numModes]); for (n = 0; n < num_screen_modes; n++) if (screen_modes[n] == mode) break; if (n == num_screen_modes) screen_modes[num_screen_modes++] = mode; } } /* * Add modes from all crtcs. The goal is to * make sure all available and active modes * are visible to the client */ for (c = 0; c < pScrPriv->numCrtcs; c++) { RRCrtcPtr crtc = pScrPriv->crtcs[c]; RRModePtr mode = crtc->mode; int n; if (!mode) continue; for (n = 0; n < num_screen_modes; n++) if (screen_modes[n] == mode) break; if (n == num_screen_modes) screen_modes[num_screen_modes++] = mode; } /* * Add all user modes for this screen */ for (m = 0; m < num_modes; m++) { RRModePtr mode = modes[m]; int n; if (mode->userScreen != pScreen) continue; for (n = 0; n < num_screen_modes; n++) if (screen_modes[n] == mode) break; if (n == num_screen_modes) screen_modes[num_screen_modes++] = mode; } *num_ret = num_screen_modes; return screen_modes; } void RRModeDestroy(RRModePtr mode) { int m; if (--mode->refcnt > 0) return; for (m = 0; m < num_modes; m++) { if (modes[m] == mode) { memmove(modes + m, modes + m + 1, (num_modes - m - 1) * sizeof(RRModePtr)); num_modes--; if (!num_modes) { free(modes); modes = NULL; } break; } } free(mode); } static int RRModeDestroyResource(void *value, XID pid) { RRModeDestroy((RRModePtr) value); return 1; } /* * Initialize mode type */ Bool RRModeInit(void) { assert(num_modes == 0); assert(modes == NULL); RRModeType = CreateNewResourceType(RRModeDestroyResource #ifndef NXAGENT_SERVER , "MODE" #endif ); if (!RRModeType) return FALSE; #ifdef NXAGENT_SERVER RegisterResourceName(RRModeType, "MODE"); #endif return TRUE; } /* * Initialize mode type error value */ void RRModeInitErrorValue(void) { #ifndef NXAGENT_SERVER SetResourceTypeErrorValue(RRModeType, RRErrorBase + BadRRMode); #endif } int ProcRRCreateMode(ClientPtr client) { REQUEST(xRRCreateModeReq); xRRCreateModeReply rep; WindowPtr pWin; ScreenPtr pScreen; xRRModeInfo *modeInfo; long units_after; char *name; int error, rc; RRModePtr mode; REQUEST_AT_LEAST_SIZE(xRRCreateModeReq); #ifndef NXAGENT_SERVER rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); #else pWin = SecurityLookupWindow(stuff->window, client, DixReadAccess); rc = pWin ? Success : BadWindow; #endif if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; modeInfo = &stuff->modeInfo; name = (char *) (stuff + 1); units_after = (stuff->length - bytes_to_int32(sizeof(xRRCreateModeReq))); /* check to make sure requested name fits within the data provided */ if (bytes_to_int32(modeInfo->nameLength) > units_after) return BadLength; mode = RRModeCreateUser(pScreen, modeInfo, name, &error); if (!mode) return error; rep = (xRRCreateModeReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .mode = mode->mode.id }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.mode); } WriteToClient(client, sizeof(xRRCreateModeReply), &rep); /* Drop out reference to this mode */ RRModeDestroy(mode); return Success; } int ProcRRDestroyMode(ClientPtr client) { REQUEST(xRRDestroyModeReq); RRModePtr mode; REQUEST_SIZE_MATCH(xRRDestroyModeReq); VERIFY_RR_MODE(stuff->mode, mode, DixDestroyAccess); if (!mode->userScreen) return BadMatch; if (mode->refcnt > 1) return BadAccess; FreeResource(stuff->mode, 0); return Success; } int ProcRRAddOutputMode(ClientPtr client) { REQUEST(xRRAddOutputModeReq); RRModePtr mode; RROutputPtr output; REQUEST_SIZE_MATCH(xRRAddOutputModeReq); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); VERIFY_RR_MODE(stuff->mode, mode, DixUseAccess); return RROutputAddUserMode(output, mode); } int ProcRRDeleteOutputMode(ClientPtr client) { REQUEST(xRRDeleteOutputModeReq); RRModePtr mode; RROutputPtr output; REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); VERIFY_RR_MODE(stuff->mode, mode, DixUseAccess); return RROutputDeleteUserMode(output, mode); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rrmonitor.c0000644000000000000000000005556313614532331020116 0ustar /* * Copyright © 2014 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "randrstr.h" #include "swaprep.h" #ifndef NXAGENT_SERVER #include "list.h" #endif static Atom RRMonitorCrtcName(RRCrtcPtr crtc) { char name[20]; if (crtc->numOutputs) { RROutputPtr output = crtc->outputs[0]; return MakeAtom(output->name, output->nameLength, TRUE); } sprintf(name, "Monitor-%08lx", (unsigned long int) crtc->id); return MakeAtom(name, strlen(name), TRUE); } static Bool RRMonitorCrtcPrimary(RRCrtcPtr crtc) { ScreenPtr screen = crtc->pScreen; rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); int o; for (o = 0; o < crtc->numOutputs; o++) if (crtc->outputs[o] == pScrPriv->primaryOutput) return TRUE; return FALSE; } #define DEFAULT_PIXELS_PER_MM (96.0 / 25.4) static void RRMonitorGetCrtcGeometry(RRCrtcPtr crtc, RRMonitorGeometryPtr geometry) { ScreenPtr screen = crtc->pScreen; rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); BoxRec panned_area; /* Check to see if crtc is panned and return the full area when applicable. */ if (pScrPriv && pScrPriv->rrGetPanning && pScrPriv->rrGetPanning(screen, crtc, &panned_area, NULL, NULL) && (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1)) { geometry->box = panned_area; } else { int width, height; RRCrtcGetScanoutSize(crtc, &width, &height); geometry->box.x1 = crtc->x; geometry->box.y1 = crtc->y; geometry->box.x2 = geometry->box.x1 + width; geometry->box.y2 = geometry->box.y1 + height; } if (crtc->numOutputs && crtc->outputs[0]->mmWidth && crtc->outputs[0]->mmHeight) { RROutputPtr output = crtc->outputs[0]; geometry->mmWidth = output->mmWidth; geometry->mmHeight = output->mmHeight; } else { geometry->mmWidth = floor((geometry->box.x2 - geometry->box.x1) / DEFAULT_PIXELS_PER_MM + 0.5); geometry->mmHeight = floor((geometry->box.y2 - geometry->box.y1) / DEFAULT_PIXELS_PER_MM + 0.5); } } static Bool RRMonitorSetFromServer(RRCrtcPtr crtc, RRMonitorPtr monitor) { int o; monitor->name = RRMonitorCrtcName(crtc); monitor->pScreen = crtc->pScreen; monitor->numOutputs = crtc->numOutputs; monitor->outputs = calloc(crtc->numOutputs, sizeof(RRCrtc)); if (!monitor->outputs) return FALSE; for (o = 0; o < crtc->numOutputs; o++) monitor->outputs[o] = crtc->outputs[o]->id; monitor->primary = RRMonitorCrtcPrimary(crtc); monitor->automatic = TRUE; RRMonitorGetCrtcGeometry(crtc, &monitor->geometry); return TRUE; } static Bool RRMonitorAutomaticGeometry(RRMonitorPtr monitor) { return (monitor->geometry.box.x1 == 0 && monitor->geometry.box.y1 == 0 && monitor->geometry.box.x2 == 0 && monitor->geometry.box.y2 == 0); } static void RRMonitorGetGeometry(RRMonitorPtr monitor, RRMonitorGeometryPtr geometry) { if (RRMonitorAutomaticGeometry(monitor) && monitor->numOutputs > 0) { ScreenPtr screen = monitor->pScreen; rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); RRMonitorGeometryRec first = { .box = {0, 0, 0, 0}, .mmWidth = 0, .mmHeight = 0 }; RRMonitorGeometryRec this; int c, o, co; int active_crtcs = 0; *geometry = first; for (o = 0; o < monitor->numOutputs; o++) { RRCrtcPtr crtc = NULL; Bool in_use = FALSE; for (c = 0; !in_use && c < pScrPriv->numCrtcs; c++) { crtc = pScrPriv->crtcs[c]; if (!crtc->mode) continue; for (co = 0; !in_use && co < crtc->numOutputs; co++) if (monitor->outputs[o] == crtc->outputs[co]->id) in_use = TRUE; } if (!in_use) continue; RRMonitorGetCrtcGeometry(crtc, &this); if (active_crtcs == 0) { first = this; *geometry = this; } else { geometry->box.x1 = min(this.box.x1, geometry->box.x1); geometry->box.x2 = max(this.box.x2, geometry->box.x2); geometry->box.y1 = min(this.box.y1, geometry->box.y1); geometry->box.y2 = max(this.box.y2, geometry->box.y2); } active_crtcs++; } /* Adjust physical sizes to account for total area */ if (active_crtcs > 1 && first.box.x2 != first.box.x1 && first.box.y2 != first.box.y1) { geometry->mmWidth = (this.box.x2 - this.box.x1) / (first.box.x2 - first.box.x1) * first.mmWidth; geometry->mmHeight = (this.box.y2 - this.box.y1) / (first.box.y2 - first.box.y1) * first.mmHeight; } } else { *geometry = monitor->geometry; } } static Bool RRMonitorSetFromClient(RRMonitorPtr client_monitor, RRMonitorPtr monitor) { monitor->name = client_monitor->name; monitor->pScreen = client_monitor->pScreen; monitor->numOutputs = client_monitor->numOutputs; monitor->outputs = calloc(client_monitor->numOutputs, sizeof(RROutput)); if (!monitor->outputs && client_monitor->numOutputs) return FALSE; memcpy(monitor->outputs, client_monitor->outputs, client_monitor->numOutputs * sizeof(RROutput)); monitor->primary = client_monitor->primary; monitor->automatic = client_monitor->automatic; RRMonitorGetGeometry(client_monitor, &monitor->geometry); return TRUE; } typedef struct _rrMonitorList { int num_client; int num_server; RRCrtcPtr *server_crtc; int num_crtcs; int client_primary; int server_primary; } RRMonitorListRec, *RRMonitorListPtr; static Bool RRMonitorInitList(ScreenPtr screen, RRMonitorListPtr mon_list, Bool get_active) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); int m, o, c, sc; int numCrtcs; #ifndef NXAGENT_SERVER ScreenPtr slave; #endif if (!RRGetInfo(screen, FALSE)) return FALSE; /* Count the number of crtcs in this and any slave screens */ numCrtcs = pScrPriv->numCrtcs; #ifndef NXAGENT_SERVER xorg_list_for_each_entry(slave, &screen->output_slave_list, output_head) { rrScrPrivPtr pSlavePriv; pSlavePriv = rrGetScrPriv(slave); numCrtcs += pSlavePriv->numCrtcs; } #endif mon_list->num_crtcs = numCrtcs; mon_list->server_crtc = calloc(numCrtcs * 2, sizeof(RRCrtcPtr)); if (!mon_list->server_crtc) return FALSE; /* Collect pointers to all of the active crtcs */ c = 0; for (sc = 0; sc < pScrPriv->numCrtcs; sc++, c++) { if (pScrPriv->crtcs[sc]->mode != NULL) mon_list->server_crtc[c] = pScrPriv->crtcs[sc]; } #ifndef NXAGENT_SERVER xorg_list_for_each_entry(slave, &screen->output_slave_list, output_head) { rrScrPrivPtr pSlavePriv; pSlavePriv = rrGetScrPriv(slave); for (sc = 0; sc < pSlavePriv->numCrtcs; sc++, c++) { if (pSlavePriv->crtcs[sc]->mode != NULL) mon_list->server_crtc[c] = pSlavePriv->crtcs[sc]; } } #endif /* Walk the list of client-defined monitors, clearing the covered * CRTCs from the full list and finding whether one of the * monitors is primary */ mon_list->num_client = pScrPriv->numMonitors; mon_list->client_primary = -1; for (m = 0; m < pScrPriv->numMonitors; m++) { RRMonitorPtr monitor = pScrPriv->monitors[m]; if (get_active) { RRMonitorGeometryRec geom; RRMonitorGetGeometry(monitor, &geom); if (geom.box.x2 - geom.box.x1 == 0 || geom.box.y2 - geom.box.y1 == 0) { mon_list->num_client--; continue; } } if (monitor->primary && mon_list->client_primary == -1) mon_list->client_primary = m; for (o = 0; o < monitor->numOutputs; o++) { for (c = 0; c < numCrtcs; c++) { RRCrtcPtr crtc = mon_list->server_crtc[c]; if (crtc) { int co; for (co = 0; co < crtc->numOutputs; co++) if (crtc->outputs[co]->id == monitor->outputs[o]) { mon_list->server_crtc[c] = NULL; break; } } } } } /* Now look at the active CRTCs, and count * those not covered by a client monitor, as well * as finding whether one of them is marked primary */ mon_list->num_server = 0; mon_list->server_primary = -1; for (c = 0; c < mon_list->num_crtcs; c++) { RRCrtcPtr crtc = mon_list->server_crtc[c]; if (!crtc) continue; mon_list->num_server++; if (RRMonitorCrtcPrimary(crtc) && mon_list->server_primary == -1) mon_list->server_primary = c; } return TRUE; } static void RRMonitorFiniList(RRMonitorListPtr list) { free(list->server_crtc); } /* Construct a complete list of protocol-visible monitors, including * the manually generated ones as well as those generated * automatically from the remaining CRCTs */ Bool RRMonitorMakeList(ScreenPtr screen, Bool get_active, RRMonitorPtr * monitors_ret, int *nmon_ret) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); RRMonitorListRec list; int m, c; RRMonitorPtr mon, monitors; Bool has_primary = FALSE; if (!pScrPriv) return FALSE; if (!RRMonitorInitList(screen, &list, get_active)) return FALSE; monitors = calloc(list.num_client + list.num_server, sizeof(RRMonitorRec)); if (!monitors) { RRMonitorFiniList(&list); return FALSE; } mon = monitors; /* Fill in the primary monitor data first */ if (list.client_primary >= 0) { RRMonitorSetFromClient(pScrPriv->monitors[list.client_primary], mon); mon++; } else if (list.server_primary >= 0) { RRMonitorSetFromServer(list.server_crtc[list.server_primary], mon); mon++; } /* Fill in the client-defined monitors next */ for (m = 0; m < pScrPriv->numMonitors; m++) { if (m == list.client_primary) continue; if (get_active) { RRMonitorGeometryRec geom; RRMonitorGetGeometry(pScrPriv->monitors[m], &geom); if (geom.box.x2 - geom.box.x1 == 0 || geom.box.y2 - geom.box.y1 == 0) { continue; } } RRMonitorSetFromClient(pScrPriv->monitors[m], mon); if (has_primary) mon->primary = FALSE; else if (mon->primary) has_primary = TRUE; mon++; } /* And finish with the list of crtc-inspired monitors */ for (c = 0; c < list.num_crtcs; c++) { RRCrtcPtr crtc = list.server_crtc[c]; if (c == list.server_primary && list.client_primary < 0) continue; if (!list.server_crtc[c]) continue; RRMonitorSetFromServer(crtc, mon); if (has_primary) mon->primary = FALSE; else if (mon->primary) has_primary = TRUE; mon++; } RRMonitorFiniList(&list); *nmon_ret = list.num_client + list.num_server; *monitors_ret = monitors; return TRUE; } int RRMonitorCountList(ScreenPtr screen) { RRMonitorListRec list; int nmon; if (!RRMonitorInitList(screen, &list, FALSE)) return -1; nmon = list.num_client + list.num_server; RRMonitorFiniList(&list); return nmon; } void RRMonitorFree(RRMonitorPtr monitor) { free(monitor); } RRMonitorPtr RRMonitorAlloc(int noutput) { RRMonitorPtr monitor; monitor = calloc(1, sizeof(RRMonitorRec) + noutput * sizeof(RROutput)); if (!monitor) return NULL; monitor->numOutputs = noutput; monitor->outputs = (RROutput *) (monitor + 1); return monitor; } static int RRMonitorDelete(ClientPtr client, ScreenPtr screen, Atom name) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); int m; if (!pScrPriv) { client->errorValue = name; return BadAtom; } for (m = 0; m < pScrPriv->numMonitors; m++) { RRMonitorPtr monitor = pScrPriv->monitors[m]; if (monitor->name == name) { memmove(pScrPriv->monitors + m, pScrPriv->monitors + m + 1, (pScrPriv->numMonitors - (m + 1)) * sizeof(RRMonitorPtr)); --pScrPriv->numMonitors; RRMonitorFree(monitor); return Success; } } client->errorValue = name; return BadValue; } static Bool RRMonitorMatchesOutputName(ScreenPtr screen, Atom name) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); int o; const char *str = NameForAtom(name); int len = strlen(str); for (o = 0; o < pScrPriv->numOutputs; o++) { RROutputPtr output = pScrPriv->outputs[o]; if (output->nameLength == len && !memcmp(output->name, str, len)) return TRUE; } return FALSE; } int RRMonitorAdd(ClientPtr client, ScreenPtr screen, RRMonitorPtr monitor) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); int m; #ifndef NXAGENT_SERVER ScreenPtr slave; #endif RRMonitorPtr *monitors; if (!pScrPriv) return BadAlloc; /* 'name' must not match the name of any Output on the screen, or * a Value error results. */ if (RRMonitorMatchesOutputName(screen, monitor->name)) { client->errorValue = monitor->name; return BadValue; } #ifndef NXAGENT_SERVER xorg_list_for_each_entry(slave, &screen->output_slave_list, output_head) { if (RRMonitorMatchesOutputName(slave, monitor->name)) { client->errorValue = monitor->name; return BadValue; } } #endif /* 'name' must not match the name of any Monitor on the screen, or * a Value error results. */ for (m = 0; m < pScrPriv->numMonitors; m++) { if (pScrPriv->monitors[m]->name == monitor->name) { client->errorValue = monitor->name; return BadValue; } } /* Allocate space for the new pointer. This is done before * removing matching monitors as it may fail, and the request * needs to not have any side-effects on failure */ if (pScrPriv->numMonitors) monitors = reallocarray(pScrPriv->monitors, pScrPriv->numMonitors + 1, sizeof(RRMonitorPtr)); else monitors = malloc(sizeof(RRMonitorPtr)); if (!monitors) return BadAlloc; pScrPriv->monitors = monitors; for (m = 0; m < pScrPriv->numMonitors; m++) { RRMonitorPtr existing = pScrPriv->monitors[m]; int o, eo; /* If 'name' matches an existing Monitor on the screen, the * existing one will be deleted as if RRDeleteMonitor were called. */ if (existing->name == monitor->name) { (void) RRMonitorDelete(client, screen, existing->name); continue; } /* For each output in 'info.outputs', each one is removed from all * pre-existing Monitors. If removing the output causes the list * of outputs for that Monitor to become empty, then that * Monitor will be deleted as if RRDeleteMonitor were called. */ for (eo = 0; eo < existing->numOutputs; eo++) { for (o = 0; o < monitor->numOutputs; o++) { if (monitor->outputs[o] == existing->outputs[eo]) { memmove(existing->outputs + eo, existing->outputs + eo + 1, (existing->numOutputs - (eo + 1)) * sizeof(RROutput)); --existing->numOutputs; --eo; break; } } if (existing->numOutputs == 0) { (void) RRMonitorDelete(client, screen, existing->name); break; } } if (monitor->primary) existing->primary = FALSE; } /* Add the new one to the list */ pScrPriv->monitors[pScrPriv->numMonitors++] = monitor; return Success; } void RRMonitorFreeList(RRMonitorPtr monitors, int nmon) { int m; for (m = 0; m < nmon; m++) free(monitors[m].outputs); free(monitors); } void RRMonitorInit(ScreenPtr screen) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); if (!pScrPriv) return; pScrPriv->numMonitors = 0; pScrPriv->monitors = NULL; } void RRMonitorClose(ScreenPtr screen) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); int m; if (!pScrPriv) return; for (m = 0; m < pScrPriv->numMonitors; m++) RRMonitorFree(pScrPriv->monitors[m]); free(pScrPriv->monitors); pScrPriv->monitors = NULL; pScrPriv->numMonitors = 0; } static CARD32 RRMonitorTimestamp(ScreenPtr screen) { rrScrPrivPtr pScrPriv = rrGetScrPriv(screen); /* XXX should take client monitor changes into account */ return pScrPriv->lastConfigTime.milliseconds; } int ProcRRGetMonitors(ClientPtr client) { REQUEST(xRRGetMonitorsReq); xRRGetMonitorsReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, }; WindowPtr window; ScreenPtr screen; int r; RRMonitorPtr monitors; int nmonitors; int noutputs; int m; Bool get_active; REQUEST_SIZE_MATCH(xRRGetMonitorsReq); #ifndef NXAGENT_SERVER r = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess); #else window = SecurityLookupWindow(stuff->window, client, DixReadAccess); r = window ? Success : BadWindow; #endif if (r != Success) return r; screen = window->drawable.pScreen; get_active = stuff->get_active; if (!RRMonitorMakeList(screen, get_active, &monitors, &nmonitors)) return BadAlloc; rep.timestamp = RRMonitorTimestamp(screen); noutputs = 0; for (m = 0; m < nmonitors; m++) { rep.length += SIZEOF(xRRMonitorInfo) >> 2; rep.length += monitors[m].numOutputs; noutputs += monitors[m].numOutputs; } rep.nmonitors = nmonitors; rep.noutputs = noutputs; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swapl(&rep.nmonitors); swapl(&rep.noutputs); } WriteToClient(client, sizeof(xRRGetMonitorsReply), &rep); client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; for (m = 0; m < nmonitors; m++) { RRMonitorPtr monitor = &monitors[m]; xRRMonitorInfo info = { .name = monitor->name, .primary = monitor->primary, .automatic = monitor->automatic, .noutput = monitor->numOutputs, .x = monitor->geometry.box.x1, .y = monitor->geometry.box.y1, .width = monitor->geometry.box.x2 - monitor->geometry.box.x1, .height = monitor->geometry.box.y2 - monitor->geometry.box.y1, .widthInMillimeters = monitor->geometry.mmWidth, .heightInMillimeters = monitor->geometry.mmHeight, }; if (client->swapped) { swapl(&info.name); swaps(&info.noutput); swaps(&info.x); swaps(&info.y); swaps(&info.width); swaps(&info.height); swapl(&info.widthInMillimeters); swapl(&info.heightInMillimeters); } WriteToClient(client, sizeof(xRRMonitorInfo), &info); WriteSwappedDataToClient(client, monitor->numOutputs * sizeof(RROutput), monitor->outputs); } RRMonitorFreeList(monitors, nmonitors); return Success; } int ProcRRSetMonitor(ClientPtr client) { REQUEST(xRRSetMonitorReq); WindowPtr window; ScreenPtr screen; RRMonitorPtr monitor; int r; REQUEST_AT_LEAST_SIZE(xRRSetMonitorReq); if (stuff->monitor.noutput != stuff->length - (SIZEOF(xRRSetMonitorReq) >> 2)) return BadLength; #ifndef NXAGENT_SERVER r = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess); #else window = SecurityLookupWindow(stuff->window, client, DixReadAccess); r = window ? Success : BadWindow; #endif if (r != Success) return r; screen = window->drawable.pScreen; if (!ValidAtom(stuff->monitor.name)) return BadAtom; /* Allocate the new monitor */ monitor = RRMonitorAlloc(stuff->monitor.noutput); if (!monitor) return BadAlloc; /* Fill in the bits from the request */ monitor->pScreen = screen; monitor->name = stuff->monitor.name; monitor->primary = stuff->monitor.primary; monitor->automatic = FALSE; memcpy(monitor->outputs, stuff + 1, stuff->monitor.noutput * sizeof(RROutput)); monitor->geometry.box.x1 = stuff->monitor.x; monitor->geometry.box.y1 = stuff->monitor.y; monitor->geometry.box.x2 = stuff->monitor.x + stuff->monitor.width; monitor->geometry.box.y2 = stuff->monitor.y + stuff->monitor.height; monitor->geometry.mmWidth = stuff->monitor.widthInMillimeters; monitor->geometry.mmHeight = stuff->monitor.heightInMillimeters; r = RRMonitorAdd(client, screen, monitor); if (r == Success) RRSendConfigNotify(screen); else RRMonitorFree(monitor); return r; } int ProcRRDeleteMonitor(ClientPtr client) { REQUEST(xRRDeleteMonitorReq); WindowPtr window; ScreenPtr screen; int r; REQUEST_SIZE_MATCH(xRRDeleteMonitorReq); #ifndef NXAGENT_SERVER r = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess); #else window = SecurityLookupWindow(stuff->window, client, DixReadAccess); r = window ? Success : BadWindow; #endif if (r != Success) return r; screen = window->drawable.pScreen; if (!ValidAtom(stuff->name)) { client->errorValue = stuff->name; return BadAtom; } r = RRMonitorDelete(client, screen, stuff->name); if (r == Success) RRSendConfigNotify(screen); return r; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rroutput.c0000644000000000000000000004163613614532331017763 0ustar /* * Copyright © 2006 Keith Packard * Copyright © 2008 Red Hat, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "randrstr.h" RESTYPE RROutputType; /* * Notify the output of some change */ void RROutputChanged(RROutputPtr output, Bool configChanged) { /* set changed bits on the master screen only */ ScreenPtr pScreen = output->pScreen; rrScrPrivPtr mastersp; output->changed = TRUE; if (!pScreen) return; #ifndef NXAGENT_SERVER if (pScreen->isGPU) { ScreenPtr master = pScreen->current_master; if (!master) return; mastersp = rrGetScrPriv(master); } else #endif { mastersp = rrGetScrPriv(pScreen); } RRSetChanged(pScreen); if (configChanged) mastersp->configChanged = TRUE; } /* * Create an output */ RROutputPtr RROutputCreate(ScreenPtr pScreen, const char *name, int nameLength, void *devPrivate) { RROutputPtr output; RROutputPtr *outputs; rrScrPrivPtr pScrPriv; if (!RRInit()) return NULL; pScrPriv = rrGetScrPriv(pScreen); outputs = reallocarray(pScrPriv->outputs, pScrPriv->numOutputs + 1, sizeof(RROutputPtr)); if (!outputs) return NULL; pScrPriv->outputs = outputs; output = malloc(sizeof(RROutputRec) + nameLength + 1); if (!output) return NULL; output->id = FakeClientID(0); output->pScreen = pScreen; output->name = (char *) (output + 1); output->nameLength = nameLength; memcpy(output->name, name, nameLength); output->name[nameLength] = '\0'; output->connection = RR_UnknownConnection; output->subpixelOrder = SubPixelUnknown; output->mmWidth = 0; output->mmHeight = 0; output->crtc = NULL; output->numCrtcs = 0; output->crtcs = NULL; output->numClones = 0; output->clones = NULL; output->numModes = 0; output->numPreferred = 0; output->modes = NULL; output->numUserModes = 0; output->userModes = NULL; output->properties = NULL; output->pendingProperties = FALSE; output->changed = FALSE; output->devPrivate = devPrivate; if (!AddResource(output->id, RROutputType, (void *) output)) return NULL; pScrPriv->outputs[pScrPriv->numOutputs++] = output; RRResourcesChanged(pScreen); return output; } /* * Notify extension that output parameters have been changed */ Bool RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones) { RROutputPtr *newClones; int i; if (numClones == output->numClones) { for (i = 0; i < numClones; i++) if (output->clones[i] != clones[i]) break; if (i == numClones) return TRUE; } if (numClones) { newClones = xallocarray(numClones, sizeof(RROutputPtr)); if (!newClones) return FALSE; } else newClones = NULL; free(output->clones); memcpy(newClones, clones, numClones * sizeof(RROutputPtr)); output->clones = newClones; output->numClones = numClones; RROutputChanged(output, TRUE); return TRUE; } Bool RROutputSetModes(RROutputPtr output, RRModePtr * modes, int numModes, int numPreferred) { RRModePtr *newModes; int i; if (numModes == output->numModes && numPreferred == output->numPreferred) { for (i = 0; i < numModes; i++) if (output->modes[i] != modes[i]) break; if (i == numModes) { for (i = 0; i < numModes; i++) RRModeDestroy(modes[i]); return TRUE; } } if (numModes) { newModes = xallocarray(numModes, sizeof(RRModePtr)); if (!newModes) return FALSE; } else newModes = NULL; if (output->modes) { for (i = 0; i < output->numModes; i++) RRModeDestroy(output->modes[i]); free(output->modes); } memcpy(newModes, modes, numModes * sizeof(RRModePtr)); output->modes = newModes; output->numModes = numModes; output->numPreferred = numPreferred; RROutputChanged(output, TRUE); return TRUE; } int RROutputAddUserMode(RROutputPtr output, RRModePtr mode) { int m; ScreenPtr pScreen = output->pScreen; rrScrPriv(pScreen); RRModePtr *newModes; /* Check to see if this mode is already listed for this output */ for (m = 0; m < output->numModes + output->numUserModes; m++) { RRModePtr e = (m < output->numModes ? output->modes[m] : output->userModes[m - output->numModes]); if (mode == e) return Success; } /* Check with the DDX to see if this mode is OK */ if (pScrPriv->rrOutputValidateMode) if (!pScrPriv->rrOutputValidateMode(pScreen, output, mode)) return BadMatch; if (output->userModes) newModes = reallocarray(output->userModes, output->numUserModes + 1, sizeof(RRModePtr)); else newModes = malloc(sizeof(RRModePtr)); if (!newModes) return BadAlloc; output->userModes = newModes; output->userModes[output->numUserModes++] = mode; ++mode->refcnt; RROutputChanged(output, TRUE); RRTellChanged(pScreen); return Success; } int RROutputDeleteUserMode(RROutputPtr output, RRModePtr mode) { int m; /* Find this mode in the user mode list */ for (m = 0; m < output->numUserModes; m++) { RRModePtr e = output->userModes[m]; if (mode == e) break; } /* Not there, access error */ if (m == output->numUserModes) return BadAccess; /* make sure the mode isn't active for this output */ if (output->crtc && output->crtc->mode == mode) return BadMatch; memmove(output->userModes + m, output->userModes + m + 1, (output->numUserModes - m - 1) * sizeof(RRModePtr)); output->numUserModes--; RRModeDestroy(mode); return Success; } Bool RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs) { RRCrtcPtr *newCrtcs; int i; if (numCrtcs == output->numCrtcs) { for (i = 0; i < numCrtcs; i++) if (output->crtcs[i] != crtcs[i]) break; if (i == numCrtcs) return TRUE; } if (numCrtcs) { newCrtcs = xallocarray(numCrtcs, sizeof(RRCrtcPtr)); if (!newCrtcs) return FALSE; } else newCrtcs = NULL; free(output->crtcs); memcpy(newCrtcs, crtcs, numCrtcs * sizeof(RRCrtcPtr)); output->crtcs = newCrtcs; output->numCrtcs = numCrtcs; RROutputChanged(output, TRUE); return TRUE; } Bool RROutputSetConnection(RROutputPtr output, CARD8 connection) { if (output->connection == connection) return TRUE; output->connection = connection; RROutputChanged(output, TRUE); return TRUE; } Bool RROutputSetSubpixelOrder(RROutputPtr output, int subpixelOrder) { if (output->subpixelOrder == subpixelOrder) return TRUE; output->subpixelOrder = subpixelOrder; RROutputChanged(output, FALSE); return TRUE; } Bool RROutputSetPhysicalSize(RROutputPtr output, int mmWidth, int mmHeight) { if (output->mmWidth == mmWidth && output->mmHeight == mmHeight) return TRUE; output->mmWidth = mmWidth; output->mmHeight = mmHeight; RROutputChanged(output, FALSE); return TRUE; } void RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output) { ScreenPtr pScreen = pWin->drawable.pScreen; rrScrPriv(pScreen); RRCrtcPtr crtc = output->crtc; RRModePtr mode = crtc ? crtc->mode : NULL; xRROutputChangeNotifyEvent oe = { .type = RRNotify + RREventBase, .subCode = RRNotify_OutputChange, .timestamp = pScrPriv->lastSetTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds, .window = pWin->drawable.id, .output = output->id, .crtc = crtc ? crtc->id : None, .mode = mode ? mode->mode.id : None, .rotation = crtc ? crtc->rotation : RR_Rotate_0, .connection = output->connection, .subpixelOrder = output->subpixelOrder }; WriteEventsToClient(client, 1, (xEvent *) &oe); } /* * Destroy a Output at shutdown */ void RROutputDestroy(RROutputPtr output) { FreeResource(output->id, 0); } static int RROutputDestroyResource(void *value, XID pid) { RROutputPtr output = (RROutputPtr) value; ScreenPtr pScreen = output->pScreen; int m; if (pScreen) { rrScrPriv(pScreen); int i; if (pScrPriv->primaryOutput == output) pScrPriv->primaryOutput = NULL; for (i = 0; i < pScrPriv->numOutputs; i++) { if (pScrPriv->outputs[i] == output) { memmove(pScrPriv->outputs + i, pScrPriv->outputs + i + 1, (pScrPriv->numOutputs - (i + 1)) * sizeof(RROutputPtr)); --pScrPriv->numOutputs; break; } } RRResourcesChanged(pScreen); } if (output->modes) { for (m = 0; m < output->numModes; m++) RRModeDestroy(output->modes[m]); free(output->modes); } for (m = 0; m < output->numUserModes; m++) RRModeDestroy(output->userModes[m]); free(output->userModes); free(output->crtcs); free(output->clones); RRDeleteAllOutputProperties(output); free(output); return 1; } /* * Initialize output type */ Bool RROutputInit(void) { RROutputType = CreateNewResourceType(RROutputDestroyResource #ifndef NXAGENT_SERVER , "OUTPUT" #endif ); if (!RROutputType) return FALSE; #ifdef NXAGENT_SERVER RegisterResourceName(RROutputType, "OUTPUT"); #endif return TRUE; } /* * Initialize output type error value */ void RROutputInitErrorValue(void) { #ifndef NXAGENT_SERVER SetResourceTypeErrorValue(RROutputType, RRErrorBase + BadRROutput); #endif } #define OutputInfoExtra (SIZEOF(xRRGetOutputInfoReply) - 32) int ProcRRGetOutputInfo(ClientPtr client) { REQUEST(xRRGetOutputInfoReq); xRRGetOutputInfoReply rep; RROutputPtr output; CARD8 *extra; unsigned long extraLen; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; RRCrtc *crtcs; RRMode *modes; RROutput *clones; char *name; int i; REQUEST_SIZE_MATCH(xRRGetOutputInfoReq); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); pScreen = output->pScreen; pScrPriv = rrGetScrPriv(pScreen); rep = (xRRGetOutputInfoReply) { .type = X_Reply, .status = RRSetConfigSuccess, .sequenceNumber = client->sequence, .length = bytes_to_int32(OutputInfoExtra), .timestamp = pScrPriv->lastSetTime.milliseconds, .crtc = output->crtc ? output->crtc->id : None, .mmWidth = output->mmWidth, .mmHeight = output->mmHeight, .connection = output->connection, .subpixelOrder = output->subpixelOrder, .nCrtcs = output->numCrtcs, .nModes = output->numModes + output->numUserModes, .nPreferred = output->numPreferred, .nClones = output->numClones, .nameLength = output->nameLength }; extraLen = ((output->numCrtcs + output->numModes + output->numUserModes + output->numClones + bytes_to_int32(rep.nameLength)) << 2); if (extraLen) { rep.length += bytes_to_int32(extraLen); extra = calloc(1, extraLen); if (!extra) return BadAlloc; } else extra = NULL; crtcs = (RRCrtc *) extra; modes = (RRMode *) (crtcs + output->numCrtcs); clones = (RROutput *) (modes + output->numModes + output->numUserModes); name = (char *) (clones + output->numClones); for (i = 0; i < output->numCrtcs; i++) { crtcs[i] = output->crtcs[i]->id; if (client->swapped) swapl(&crtcs[i]); } for (i = 0; i < output->numModes + output->numUserModes; i++) { if (i < output->numModes) modes[i] = output->modes[i]->mode.id; else modes[i] = output->userModes[i - output->numModes]->mode.id; if (client->swapped) swapl(&modes[i]); } for (i = 0; i < output->numClones; i++) { clones[i] = output->clones[i]->id; if (client->swapped) swapl(&clones[i]); } memcpy(name, output->name, output->nameLength); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swapl(&rep.crtc); swapl(&rep.mmWidth); swapl(&rep.mmHeight); swaps(&rep.nCrtcs); swaps(&rep.nModes); swaps(&rep.nPreferred); swaps(&rep.nClones); swaps(&rep.nameLength); } WriteToClient(client, sizeof(xRRGetOutputInfoReply), &rep); if (extraLen) { WriteToClient(client, extraLen, extra); free(extra); } return Success; } static void RRSetPrimaryOutput(ScreenPtr pScreen, rrScrPrivPtr pScrPriv, RROutputPtr output) { if (pScrPriv->primaryOutput == output) return; /* clear the old primary */ if (pScrPriv->primaryOutput) { RROutputChanged(pScrPriv->primaryOutput, 0); pScrPriv->primaryOutput = NULL; } /* set the new primary */ if (output) { pScrPriv->primaryOutput = output; RROutputChanged(output, 0); } pScrPriv->layoutChanged = TRUE; RRTellChanged(pScreen); } int ProcRRSetOutputPrimary(ClientPtr client) { REQUEST(xRRSetOutputPrimaryReq); RROutputPtr output = NULL; WindowPtr pWin; rrScrPrivPtr pScrPriv; int ret; #ifndef NXAGENT_SERVER ScreenPtr slave; #endif REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq); #ifndef NXAGENT_SERVER ret = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); #else pWin = SecurityLookupWindow(stuff->window, client, DixReadAccess); ret = pWin ? Success : BadWindow; #endif if (ret != Success) return ret; if (stuff->output) { VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); #ifndef NXAGENT_SERVER if (!output->pScreen->isGPU && output->pScreen != pWin->drawable.pScreen) { client->errorValue = stuff->window; return BadMatch; } if (output->pScreen->isGPU && output->pScreen->current_master != pWin->drawable.pScreen) { client->errorValue = stuff->window; return BadMatch; } #endif } pScrPriv = rrGetScrPriv(pWin->drawable.pScreen); if (pScrPriv) { RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output); #ifndef NXAGENT_SERVER xorg_list_for_each_entry(slave, &pWin->drawable.pScreen->output_slave_list, output_head) { rrScrPrivPtr pSlavePriv; pSlavePriv = rrGetScrPriv(slave); RRSetPrimaryOutput(slave, pSlavePriv, output); } #endif } return Success; } int ProcRRGetOutputPrimary(ClientPtr client) { REQUEST(xRRGetOutputPrimaryReq); WindowPtr pWin; rrScrPrivPtr pScrPriv; xRRGetOutputPrimaryReply rep; RROutputPtr primary = NULL; int rc; REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq); #ifndef NXAGENT_SERVER rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); #else pWin = SecurityLookupWindow(stuff->window, client, DixReadAccess); rc = pWin ? Success : BadWindow; #endif if (rc != Success) return rc; pScrPriv = rrGetScrPriv(pWin->drawable.pScreen); if (pScrPriv) primary = pScrPriv->primaryOutput; rep = (xRRGetOutputPrimaryReply) { .type = X_Reply, .sequenceNumber = client->sequence, .output = primary ? primary->id : None }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.output); } WriteToClient(client, sizeof(xRRGetOutputPrimaryReply), &rep); return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rrpointer.c0000644000000000000000000001315213614532331020073 0ustar /* * Copyright © 2006 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "randrstr.h" #include "inputstr.h" /* * When the pointer moves, check to see if the specified position is outside * any of theavailable CRTCs and move it to a 'sensible' place if so, where * sensible is the closest monitor to the departing edge. * * Returns whether the position was adjusted */ static Bool RRCrtcContainsPosition(RRCrtcPtr crtc, int x, int y) { RRModePtr mode = crtc->mode; int scan_width, scan_height; if (!mode) return FALSE; RRCrtcGetScanoutSize(crtc, &scan_width, &scan_height); if (crtc->x <= x && x < crtc->x + scan_width && crtc->y <= y && y < crtc->y + scan_height) return TRUE; return FALSE; } /* * Find the CRTC nearest the specified position, ignoring 'skip' */ static void RRPointerToNearestCrtc( #ifndef NXAGENT_SERVER DeviceIntPtr pDev, #endif /* !defined(NXAGENT_SERVER) */ ScreenPtr pScreen, int x, int y, RRCrtcPtr skip) { rrScrPriv(pScreen); int c; RRCrtcPtr nearest = NULL; int best = 0; int best_dx = 0, best_dy = 0; for (c = 0; c < pScrPriv->numCrtcs; c++) { RRCrtcPtr crtc = pScrPriv->crtcs[c]; RRModePtr mode = crtc->mode; int dx, dy; int dist; int scan_width, scan_height; if (!mode) continue; if (crtc == skip) continue; RRCrtcGetScanoutSize(crtc, &scan_width, &scan_height); if (x < crtc->x) dx = crtc->x - x; else if (x > crtc->x + scan_width - 1) dx = crtc->x + (scan_width - 1) - x; else dx = 0; if (y < crtc->y) dy = crtc->y - y; else if (y > crtc->y + scan_height - 1) dy = crtc->y + (scan_height - 1) - y; else dy = 0; dist = dx * dx + dy * dy; if (!nearest || dist < best) { nearest = crtc; best_dx = dx; best_dy = dy; best = dist; } } if (best_dx || best_dy) (*pScreen->SetCursorPosition) ( #ifndef NXAGENT_SERVER pDev, #endif /* !defined(NXAGENT_SERVER) */ pScreen, x + best_dx, y + best_dy, TRUE); pScrPriv->pointerCrtc = nearest; } void RRPointerMoved(ScreenPtr pScreen, int x, int y) { rrScrPriv(pScreen); RRCrtcPtr pointerCrtc = pScrPriv->pointerCrtc; int c; /* Check last known CRTC */ if (pointerCrtc && RRCrtcContainsPosition(pointerCrtc, x, y)) return; /* Check all CRTCs */ for (c = 0; c < pScrPriv->numCrtcs; c++) { RRCrtcPtr crtc = pScrPriv->crtcs[c]; if (RRCrtcContainsPosition(crtc, x, y)) { /* Remember containing CRTC */ pScrPriv->pointerCrtc = crtc; return; } } /* None contain pointer, find nearest */ ErrorF("RRPointerMoved: Untested, may cause \"bogus pointer event\"\n"); RRPointerToNearestCrtc( #ifndef NXAGENT_SERVER inputInfo.pointer, #endif /* !defined(NXAGENT_SERVER) */ pScreen, x, y, pointerCrtc); } /* * When the screen is reconfigured, move all pointers to the nearest * CRTC */ void RRPointerScreenConfigured(ScreenPtr pScreen) { WindowPtr pRoot; ScreenPtr pCurrentScreen; int x, y; #ifndef NXAGENT_SERVER DeviceIntPtr pDev; for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (IsPointerDevice(pDev)) { #endif /* NXAGENT_SERVER */ pRoot = GetCurrentRootWindow( #ifndef NXAGENT_SERVER pDev #endif /* NXAGENT_SERVER */ ); pCurrentScreen = pRoot ? pRoot->drawable.pScreen : NULL; if (pScreen == pCurrentScreen) { GetSpritePosition( #ifndef NXAGENT_SERVER pDev, #endif /* NXAGENT_SERVER */ &x, &y); RRPointerToNearestCrtc( #ifndef NXAGENT_SERVER pDev, #endif /* NXAGENT_SERVER */ pScreen, x, y, NULL); #ifndef NXAGENT_SERVER } } #endif /* NXAGENT_SERVER */ } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rrproperty.c0000644000000000000000000005300113614532331020274 0ustar /* * Copyright © 2006 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "randrstr.h" #include "propertyst.h" #include "swaprep.h" static int DeliverPropertyEvent(WindowPtr pWin, void *value) { xRROutputPropertyNotifyEvent *event = value; RREventPtr *pHead, pRREvent; #ifndef NXAGENT_SERVER dixLookupResourceByType((void **) &pHead, pWin->drawable.id, RREventType, serverClient, DixReadAccess); #else /* !defined(NXAGENT_SERVER) */ pHead = (RREventPtr *) LookupIDByType(pWin->drawable.id, RREventType); #endif /* !defined(NXAGENT_SERVER) */ if (!pHead) return WT_WALKCHILDREN; for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) { if (!(pRREvent->mask & RROutputPropertyNotifyMask)) continue; event->window = pRREvent->window->drawable.id; WriteEventsToClient(pRREvent->client, 1, (xEvent *) event); } return WT_WALKCHILDREN; } static void RRDeliverPropertyEvent(ScreenPtr pScreen, xEvent *event) { if (!(dispatchException & (DE_RESET | DE_TERMINATE))) WalkTree(pScreen, DeliverPropertyEvent, event); } static void RRDestroyOutputProperty(RRPropertyPtr prop) { free(prop->valid_values); free(prop->current.data); free(prop->pending.data); free(prop); } static void RRDeleteProperty(RROutputRec * output, RRPropertyRec * prop) { xRROutputPropertyNotifyEvent event = { .type = RREventBase + RRNotify, .subCode = RRNotify_OutputProperty, .output = output->id, .state = PropertyDelete, .atom = prop->propertyName, .timestamp = currentTime.milliseconds }; RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event); RRDestroyOutputProperty(prop); } void RRDeleteAllOutputProperties(RROutputPtr output) { RRPropertyPtr prop, next; for (prop = output->properties; prop; prop = next) { next = prop->next; RRDeleteProperty(output, prop); } } static void RRInitOutputPropertyValue(RRPropertyValuePtr property_value) { property_value->type = None; property_value->format = 0; property_value->size = 0; property_value->data = NULL; } static RRPropertyPtr RRCreateOutputProperty(Atom property) { RRPropertyPtr prop; prop = (RRPropertyPtr) malloc(sizeof(RRPropertyRec)); if (!prop) return NULL; prop->next = NULL; prop->propertyName = property; prop->is_pending = FALSE; prop->range = FALSE; prop->immutable = FALSE; prop->num_valid = 0; prop->valid_values = NULL; RRInitOutputPropertyValue(&prop->current); RRInitOutputPropertyValue(&prop->pending); return prop; } void RRDeleteOutputProperty(RROutputPtr output, Atom property) { RRPropertyRec *prop, **prev; for (prev = &output->properties; (prop = *prev); prev = &(prop->next)) if (prop->propertyName == property) { *prev = prop->next; RRDeleteProperty(output, prop); return; } } int RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type, int format, int mode, unsigned long len, void *value, Bool sendevent, Bool pending) { RRPropertyPtr prop; rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen); int size_in_bytes; unsigned long total_len; RRPropertyValuePtr prop_value; RRPropertyValueRec new_value; Bool add = FALSE; size_in_bytes = format >> 3; /* first see if property already exists */ prop = RRQueryOutputProperty(output, property); if (!prop) { /* just add to list */ prop = RRCreateOutputProperty(property); if (!prop) return BadAlloc; add = TRUE; mode = PropModeReplace; } if (pending && prop->is_pending) prop_value = &prop->pending; else prop_value = &prop->current; /* To append or prepend to a property the request format and type must match those of the already defined property. The existing format and type are irrelevant when using the mode "PropModeReplace" since they will be written over. */ if ((format != prop_value->format) && (mode != PropModeReplace)) return BadMatch; if ((prop_value->type != type) && (mode != PropModeReplace)) return BadMatch; new_value = *prop_value; if (mode == PropModeReplace) total_len = len; else total_len = prop_value->size + len; if (mode == PropModeReplace || len > 0) { void *new_data = NULL, *old_data = NULL; new_value.data = xallocarray(total_len, size_in_bytes); if (!new_value.data && total_len && size_in_bytes) { if (add) RRDestroyOutputProperty(prop); return BadAlloc; } new_value.size = len; new_value.type = type; new_value.format = format; switch (mode) { case PropModeReplace: new_data = new_value.data; old_data = NULL; break; case PropModeAppend: new_data = (void *) (((char *) new_value.data) + (prop_value->size * size_in_bytes)); old_data = new_value.data; break; case PropModePrepend: new_data = new_value.data; old_data = (void *) (((char *) new_value.data) + (prop_value->size * size_in_bytes)); break; } if (new_data) memcpy((char *) new_data, (char *) value, len * size_in_bytes); if (old_data) memcpy((char *) old_data, (char *) prop_value->data, prop_value->size * size_in_bytes); if (pending && pScrPriv->rrOutputSetProperty && !pScrPriv->rrOutputSetProperty(output->pScreen, output, prop->propertyName, &new_value)) { free(new_value.data); if (add) RRDestroyOutputProperty(prop); return BadValue; } free(prop_value->data); *prop_value = new_value; } else if (len == 0) { /* do nothing */ } if (add) { prop->next = output->properties; output->properties = prop; } if (pending && prop->is_pending) output->pendingProperties = TRUE; if (sendevent) { xRROutputPropertyNotifyEvent event = { .type = RREventBase + RRNotify, .subCode = RRNotify_OutputProperty, .output = output->id, .state = PropertyNewValue, .atom = prop->propertyName, .timestamp = currentTime.milliseconds }; RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event); } return Success; } Bool RRPostPendingProperties(RROutputPtr output) { RRPropertyValuePtr pending_value; RRPropertyValuePtr current_value; RRPropertyPtr property; Bool ret = TRUE; if (!output->pendingProperties) return TRUE; output->pendingProperties = FALSE; for (property = output->properties; property; property = property->next) { /* Skip non-pending properties */ if (!property->is_pending) continue; pending_value = &property->pending; current_value = &property->current; /* * If the pending and current values are equal, don't mark it * as changed (which would deliver an event) */ if (pending_value->type == current_value->type && pending_value->format == current_value->format && pending_value->size == current_value->size && !memcmp(pending_value->data, current_value->data, pending_value->size * (pending_value->format / 8))) continue; if (RRChangeOutputProperty(output, property->propertyName, pending_value->type, pending_value->format, PropModeReplace, pending_value->size, pending_value->data, TRUE, FALSE) != Success) ret = FALSE; } return ret; } RRPropertyPtr RRQueryOutputProperty(RROutputPtr output, Atom property) { RRPropertyPtr prop; for (prop = output->properties; prop; prop = prop->next) if (prop->propertyName == property) return prop; return NULL; } RRPropertyValuePtr RRGetOutputProperty(RROutputPtr output, Atom property, Bool pending) { RRPropertyPtr prop = RRQueryOutputProperty(output, property); rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen); if (!prop) return NULL; if (pending && prop->is_pending) return &prop->pending; else { #if RANDR_13_INTERFACE /* If we can, try to update the property value first */ if (pScrPriv->rrOutputGetProperty) pScrPriv->rrOutputGetProperty(output->pScreen, output, prop->propertyName); #endif return &prop->current; } } int RRConfigureOutputProperty(RROutputPtr output, Atom property, Bool pending, Bool range, Bool immutable, int num_values, INT32 *values) { RRPropertyPtr prop = RRQueryOutputProperty(output, property); Bool add = FALSE; INT32 *new_values; if (!prop) { prop = RRCreateOutputProperty(property); if (!prop) return BadAlloc; add = TRUE; } else if (prop->immutable && !immutable) return BadAccess; /* * ranges must have even number of values */ if (range && (num_values & 1)) { if (add) RRDestroyOutputProperty(prop); return BadMatch; } new_values = xallocarray(num_values, sizeof(INT32)); if (!new_values && num_values) { if (add) RRDestroyOutputProperty(prop); return BadAlloc; } if (num_values) memcpy(new_values, values, num_values * sizeof(INT32)); /* * Property moving from pending to non-pending * loses any pending values */ if (prop->is_pending && !pending) { free(prop->pending.data); RRInitOutputPropertyValue(&prop->pending); } prop->is_pending = pending; prop->range = range; prop->immutable = immutable; prop->num_valid = num_values; free(prop->valid_values); prop->valid_values = new_values; if (add) { prop->next = output->properties; output->properties = prop; } return Success; } int ProcRRListOutputProperties(ClientPtr client) { REQUEST(xRRListOutputPropertiesReq); Atom *pAtoms = NULL; xRRListOutputPropertiesReply rep; int numProps = 0; RROutputPtr output; RRPropertyPtr prop; REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); for (prop = output->properties; prop; prop = prop->next) numProps++; if (numProps) if (!(pAtoms = xallocarray(numProps, sizeof(Atom)))) return BadAlloc; rep = (xRRListOutputPropertiesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(numProps * sizeof(Atom)), .nAtoms = numProps }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.nAtoms); } WriteToClient(client, sizeof(xRRListOutputPropertiesReply), &rep); if (numProps) { /* Copy property name atoms to reply buffer */ Atom *temppAtoms = pAtoms; for (prop = output->properties; prop; prop = prop->next) *temppAtoms++ = prop->propertyName; client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); free(pAtoms); } return Success; } int ProcRRQueryOutputProperty(ClientPtr client) { REQUEST(xRRQueryOutputPropertyReq); xRRQueryOutputPropertyReply rep; RROutputPtr output; RRPropertyPtr prop; char *extra = NULL; REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); prop = RRQueryOutputProperty(output, stuff->property); if (!prop) return BadName; if (prop->num_valid) { extra = xallocarray(prop->num_valid, sizeof(INT32)); if (!extra) return BadAlloc; } rep = (xRRQueryOutputPropertyReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = prop->num_valid, .pending = prop->is_pending, .range = prop->range, .immutable = prop->immutable }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); } WriteToClient(client, sizeof(xRRQueryOutputPropertyReply), &rep); if (prop->num_valid) { memcpy(extra, prop->valid_values, prop->num_valid * sizeof(INT32)); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32), extra); free(extra); } return Success; } int ProcRRConfigureOutputProperty(ClientPtr client) { REQUEST(xRRConfigureOutputPropertyReq); RROutputPtr output; int num_valid; REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); num_valid = stuff->length - bytes_to_int32(sizeof(xRRConfigureOutputPropertyReq)); return RRConfigureOutputProperty(output, stuff->property, stuff->pending, stuff->range, FALSE, num_valid, (INT32 *) (stuff + 1)); } int ProcRRChangeOutputProperty(ClientPtr client) { REQUEST(xRRChangeOutputPropertyReq); RROutputPtr output; char format, mode; unsigned long len; int sizeInBytes; int totalSize; int err; REQUEST_AT_LEAST_SIZE(xRRChangeOutputPropertyReq); UpdateCurrentTime(); format = stuff->format; mode = stuff->mode; if ((mode != PropModeReplace) && (mode != PropModeAppend) && (mode != PropModePrepend)) { client->errorValue = mode; return BadValue; } if ((format != 8) && (format != 16) && (format != 32)) { client->errorValue = format; return BadValue; } len = stuff->nUnits; if (len > bytes_to_int32((0xffffffff - sizeof(xChangePropertyReq)))) return BadLength; sizeInBytes = format >> 3; totalSize = len * sizeInBytes; REQUEST_FIXED_SIZE(xRRChangeOutputPropertyReq, totalSize); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return BadAtom; } if (!ValidAtom(stuff->type)) { client->errorValue = stuff->type; return BadAtom; } err = RRChangeOutputProperty(output, stuff->property, stuff->type, (int) format, (int) mode, len, (void *) &stuff[1], TRUE, TRUE); if (err != Success) return err; else return Success; } int ProcRRDeleteOutputProperty(ClientPtr client) { REQUEST(xRRDeleteOutputPropertyReq); RROutputPtr output; RRPropertyPtr prop; REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq); UpdateCurrentTime(); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return BadAtom; } prop = RRQueryOutputProperty(output, stuff->property); if (!prop) { client->errorValue = stuff->property; return BadName; } if (prop->immutable) { client->errorValue = stuff->property; return BadAccess; } RRDeleteOutputProperty(output, stuff->property); return Success; } int ProcRRGetOutputProperty(ClientPtr client) { REQUEST(xRRGetOutputPropertyReq); RRPropertyPtr prop, *prev; RRPropertyValuePtr prop_value; unsigned long n, len, ind; RROutputPtr output; xRRGetOutputPropertyReply reply; char *extra = NULL; REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq); if (stuff->delete) UpdateCurrentTime(); VERIFY_RR_OUTPUT(stuff->output, output, stuff->delete ? DixWriteAccess : DixReadAccess); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return BadAtom; } if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) { client->errorValue = stuff->delete; return BadValue; } if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type)) { client->errorValue = stuff->type; return BadAtom; } for (prev = &output->properties; (prop = *prev); prev = &prop->next) if (prop->propertyName == stuff->property) break; reply = (xRRGetOutputPropertyReply) { .type = X_Reply, .sequenceNumber = client->sequence }; if (!prop) { reply.nItems = 0; reply.length = 0; reply.bytesAfter = 0; reply.propertyType = None; reply.format = 0; if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swapl(&reply.propertyType); swapl(&reply.bytesAfter); swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply); return Success; } if (prop->immutable && stuff->delete) return BadAccess; prop_value = RRGetOutputProperty(output, stuff->property, stuff->pending); if (!prop_value) return BadAtom; /* If the request type and actual type don't match. Return the property information, but not the data. */ if (((stuff->type != prop_value->type) && (stuff->type != AnyPropertyType)) ) { reply.bytesAfter = prop_value->size; reply.format = prop_value->format; reply.length = 0; reply.nItems = 0; reply.propertyType = prop_value->type; if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swapl(&reply.propertyType); swapl(&reply.bytesAfter); swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply); return Success; } /* * Return type, format, value to client */ n = (prop_value->format / 8) * prop_value->size; /* size (bytes) of prop */ ind = stuff->longOffset << 2; /* If longOffset is invalid such that it causes "len" to be negative, it's a value error. */ if (n < ind) { client->errorValue = stuff->longOffset; return BadValue; } len = min(n - ind, 4 * stuff->longLength); if (len) { extra = malloc(len); if (!extra) return BadAlloc; } reply.bytesAfter = n - (ind + len); reply.format = prop_value->format; reply.length = bytes_to_int32(len); if (prop_value->format) reply.nItems = len / (prop_value->format / 8); else reply.nItems = 0; reply.propertyType = prop_value->type; if (stuff->delete && (reply.bytesAfter == 0)) { xRROutputPropertyNotifyEvent event = { .type = RREventBase + RRNotify, .subCode = RRNotify_OutputProperty, .output = output->id, .state = PropertyDelete, .atom = prop->propertyName, .timestamp = currentTime.milliseconds }; RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event); } if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swapl(&reply.propertyType); swapl(&reply.bytesAfter); swapl(&reply.nItems); } WriteToClient(client, sizeof(xGenericReply), &reply); if (len) { memcpy(extra, (char *) prop_value->data + ind, len); switch (reply.format) { case 32: client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; break; case 16: client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write; break; default: client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient; break; } WriteSwappedDataToClient(client, len, extra); free(extra); } if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */ *prev = prop->next; RRDestroyOutputProperty(prop); } return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rrprovider.c0000644000000000000000000003343013614532331020246 0ustar /* * Copyright © 2012 Red Hat Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Authors: Dave Airlie */ #include "randrstr.h" #include "swaprep.h" RESTYPE RRProviderType; /* * Initialize provider type error value */ void RRProviderInitErrorValue(void) { #ifndef NXAGENT_SERVER SetResourceTypeErrorValue(RRProviderType, RRErrorBase + BadRRProvider); #endif } #define ADD_PROVIDER(_pScreen) do { \ pScrPriv = rrGetScrPriv((_pScreen)); \ if (pScrPriv->provider) { \ providers[count_providers] = pScrPriv->provider->id; \ if (client->swapped) \ swapl(&providers[count_providers]); \ count_providers++; \ } \ } while(0) int ProcRRGetProviders(ClientPtr client) { REQUEST(xRRGetProvidersReq); xRRGetProvidersReply rep; WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; int rc; CARD8 *extra; unsigned int extraLen; RRProvider *providers; int total_providers = 0, count_providers = 0; #ifndef NXAGENT_SERVER ScreenPtr iter; #endif REQUEST_SIZE_MATCH(xRRGetProvidersReq); #ifndef NXAGENT_SERVER rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); #else pWin = SecurityLookupWindow(stuff->window, client, DixReadAccess); rc = pWin ? Success : BadWindow; #endif if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); if (pScrPriv->provider) total_providers++; #ifndef NXAGENT_SERVER xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) { pScrPriv = rrGetScrPriv(iter); total_providers += pScrPriv->provider ? 1 : 0; } xorg_list_for_each_entry(iter, &pScreen->offload_slave_list, offload_head) { pScrPriv = rrGetScrPriv(iter); total_providers += pScrPriv->provider ? 1 : 0; } xorg_list_for_each_entry(iter, &pScreen->unattached_list, unattached_head) { pScrPriv = rrGetScrPriv(iter); total_providers += pScrPriv->provider ? 1 : 0; } #endif pScrPriv = rrGetScrPriv(pScreen); if (!pScrPriv) { rep = (xRRGetProvidersReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .timestamp = currentTime.milliseconds, .nProviders = 0 }; extra = NULL; extraLen = 0; } else { rep = (xRRGetProvidersReply) { .type = X_Reply, .sequenceNumber = client->sequence, .timestamp = pScrPriv->lastSetTime.milliseconds, .nProviders = total_providers, .length = total_providers }; extraLen = rep.length << 2; if (extraLen) { extra = calloc(1, extraLen); if (!extra) return BadAlloc; } else extra = NULL; providers = (RRProvider *) extra; ADD_PROVIDER(pScreen); #ifndef NXAGENT_SERVER xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) { ADD_PROVIDER(iter); } xorg_list_for_each_entry(iter, &pScreen->offload_slave_list, offload_head) { ADD_PROVIDER(iter); } xorg_list_for_each_entry(iter, &pScreen->unattached_list, unattached_head) { ADD_PROVIDER(iter); } #endif } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swaps(&rep.nProviders); } WriteToClient(client, sizeof(xRRGetProvidersReply), &rep); if (extraLen) { WriteToClient(client, extraLen, extra); free(extra); } return Success; } int ProcRRGetProviderInfo(ClientPtr client) { REQUEST(xRRGetProviderInfoReq); xRRGetProviderInfoReply rep; rrScrPrivPtr pScrPriv; #ifndef NXAGENT_SERVER rrScrPrivPtr pScrProvPriv; #endif RRProviderPtr provider; ScreenPtr pScreen; CARD8 *extra; unsigned int extraLen = 0; RRCrtc *crtcs; RROutput *outputs; int i; char *name; #ifndef NXAGENT_SERVER ScreenPtr provscreen; #endif RRProvider *providers; uint32_t *prov_cap; REQUEST_SIZE_MATCH(xRRGetProviderInfoReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); pScreen = provider->pScreen; pScrPriv = rrGetScrPriv(pScreen); rep = (xRRGetProviderInfoReply) { .type = X_Reply, .status = RRSetConfigSuccess, .sequenceNumber = client->sequence, .length = 0, .capabilities = provider->capabilities, .nameLength = provider->nameLength, .timestamp = pScrPriv->lastSetTime.milliseconds, .nCrtcs = pScrPriv->numCrtcs, .nOutputs = pScrPriv->numOutputs, .nAssociatedProviders = 0 }; /* count associated providers */ if (provider->offload_sink) rep.nAssociatedProviders++; if (provider->output_source) rep.nAssociatedProviders++; #ifndef NXAGENT_SERVER xorg_list_for_each_entry(provscreen, &pScreen->output_slave_list, output_head) rep.nAssociatedProviders++; xorg_list_for_each_entry(provscreen, &pScreen->offload_slave_list, offload_head) rep.nAssociatedProviders++; #endif rep.length = (pScrPriv->numCrtcs + pScrPriv->numOutputs + (rep.nAssociatedProviders * 2) + bytes_to_int32(rep.nameLength)); extraLen = rep.length << 2; if (extraLen) { extra = calloc(1, extraLen); if (!extra) return BadAlloc; } else extra = NULL; crtcs = (RRCrtc *) extra; outputs = (RROutput *) (crtcs + rep.nCrtcs); providers = (RRProvider *) (outputs + rep.nOutputs); prov_cap = (unsigned int *) (providers + rep.nAssociatedProviders); name = (char *) (prov_cap + rep.nAssociatedProviders); for (i = 0; i < pScrPriv->numCrtcs; i++) { crtcs[i] = pScrPriv->crtcs[i]->id; if (client->swapped) swapl(&crtcs[i]); } for (i = 0; i < pScrPriv->numOutputs; i++) { outputs[i] = pScrPriv->outputs[i]->id; if (client->swapped) swapl(&outputs[i]); } i = 0; if (provider->offload_sink) { providers[i] = provider->offload_sink->id; if (client->swapped) swapl(&providers[i]); prov_cap[i] = RR_Capability_SinkOffload; if (client->swapped) swapl(&prov_cap[i]); i++; } if (provider->output_source) { providers[i] = provider->output_source->id; if (client->swapped) swapl(&providers[i]); prov_cap[i] = RR_Capability_SourceOutput; swapl(&prov_cap[i]); i++; } #ifndef NXAGENT_SERVER xorg_list_for_each_entry(provscreen, &pScreen->output_slave_list, output_head) { pScrProvPriv = rrGetScrPriv(provscreen); providers[i] = pScrProvPriv->provider->id; if (client->swapped) swapl(&providers[i]); prov_cap[i] = RR_Capability_SinkOutput; if (client->swapped) swapl(&prov_cap[i]); i++; } xorg_list_for_each_entry(provscreen, &pScreen->offload_slave_list, offload_head) { pScrProvPriv = rrGetScrPriv(provscreen); providers[i] = pScrProvPriv->provider->id; if (client->swapped) swapl(&providers[i]); prov_cap[i] = RR_Capability_SourceOffload; if (client->swapped) swapl(&prov_cap[i]); i++; } #endif memcpy(name, provider->name, rep.nameLength); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.capabilities); swaps(&rep.nCrtcs); swaps(&rep.nOutputs); swaps(&rep.nameLength); } WriteToClient(client, sizeof(xRRGetProviderInfoReply), &rep); if (extraLen) { WriteToClient(client, extraLen, extra); free(extra); } return Success; } int ProcRRSetProviderOutputSource(ClientPtr client) { REQUEST(xRRSetProviderOutputSourceReq); rrScrPrivPtr pScrPriv; RRProviderPtr provider, source_provider = NULL; ScreenPtr pScreen; REQUEST_SIZE_MATCH(xRRSetProviderOutputSourceReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); if (!(provider->capabilities & RR_Capability_SinkOutput)) return BadValue; if (stuff->source_provider) { VERIFY_RR_PROVIDER(stuff->source_provider, source_provider, DixReadAccess); if (!(source_provider->capabilities & RR_Capability_SourceOutput)) return BadValue; } pScreen = provider->pScreen; pScrPriv = rrGetScrPriv(pScreen); pScrPriv->rrProviderSetOutputSource(pScreen, provider, source_provider); provider->changed = TRUE; RRSetChanged(pScreen); RRTellChanged(pScreen); return Success; } int ProcRRSetProviderOffloadSink(ClientPtr client) { REQUEST(xRRSetProviderOffloadSinkReq); rrScrPrivPtr pScrPriv; RRProviderPtr provider, sink_provider = NULL; ScreenPtr pScreen; REQUEST_SIZE_MATCH(xRRSetProviderOffloadSinkReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); if (!(provider->capabilities & RR_Capability_SourceOffload)) return BadValue; #ifndef NXAGENT_SERVER if (!provider->pScreen->isGPU) return BadValue; #endif /* !defined(NXAGENT_SERVER) */ if (stuff->sink_provider) { VERIFY_RR_PROVIDER(stuff->sink_provider, sink_provider, DixReadAccess); if (!(sink_provider->capabilities & RR_Capability_SinkOffload)) return BadValue; } pScreen = provider->pScreen; pScrPriv = rrGetScrPriv(pScreen); pScrPriv->rrProviderSetOffloadSink(pScreen, provider, sink_provider); provider->changed = TRUE; RRSetChanged(pScreen); RRTellChanged(pScreen); return Success; } RRProviderPtr RRProviderCreate(ScreenPtr pScreen, const char *name, int nameLength) { RRProviderPtr provider; rrScrPrivPtr pScrPriv; pScrPriv = rrGetScrPriv(pScreen); provider = calloc(1, sizeof(RRProviderRec) + nameLength + 1); if (!provider) return NULL; provider->id = FakeClientID(0); provider->pScreen = pScreen; provider->name = (char *) (provider + 1); provider->nameLength = nameLength; memcpy(provider->name, name, nameLength); provider->name[nameLength] = '\0'; provider->changed = FALSE; if (!AddResource(provider->id, RRProviderType, (void *) provider)) return NULL; pScrPriv->provider = provider; return provider; } /* * Destroy a provider at shutdown */ void RRProviderDestroy(RRProviderPtr provider) { FreeResource(provider->id, 0); } void RRProviderSetCapabilities(RRProviderPtr provider, uint32_t capabilities) { provider->capabilities = capabilities; } static int RRProviderDestroyResource(void *value, XID pid) { RRProviderPtr provider = (RRProviderPtr) value; ScreenPtr pScreen = provider->pScreen; if (pScreen) { rrScrPriv(pScreen); if (pScrPriv->rrProviderDestroy) (*pScrPriv->rrProviderDestroy) (pScreen, provider); pScrPriv->provider = NULL; } free(provider); return 1; } Bool RRProviderInit(void) { RRProviderType = CreateNewResourceType(RRProviderDestroyResource #ifndef NXAGENT_SERVER , "Provider" #endif /* !defined(NXAGENT_SERVER) */ ); if (!RRProviderType) return FALSE; #ifdef NXAGENT_SERVER RegisterResourceName(RRProviderType, "Provider"); #endif return TRUE; } extern _X_EXPORT Bool RRProviderLookup(XID id, RRProviderPtr * provider_p) { #ifndef NXAGENT_SERVER int rc = dixLookupResourceByType((void **) provider_p, id, RRProviderType, NullClient, DixReadAccess); if (rc == Success) return TRUE; #else /* !defined(NXAGENT_SERVER) */ provider_p = (RRProviderPtr *) LookupIDByType(id, RREventType); if (provider_p) return TRUE; #endif /* !defined(NXAGENT_SERVER) */ return FALSE; } void RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider) { ScreenPtr pScreen = pWin->drawable.pScreen; rrScrPriv(pScreen); xRRProviderChangeNotifyEvent pe = { .type = RRNotify + RREventBase, .subCode = RRNotify_ProviderChange, #ifdef NXAGENT_SERVER .sequenceNumber = client->sequence, #endif .timestamp = pScrPriv->lastSetTime.milliseconds, .window = pWin->drawable.id, .provider = provider->id }; WriteEventsToClient(client, 1, (xEvent *) &pe); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rrproviderproperty.c0000644000000000000000000005347313614532331022064 0ustar /* * Copyright © 2006 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "randrstr.h" #include "propertyst.h" #include "swaprep.h" static int DeliverPropertyEvent(WindowPtr pWin, void *value) { xRRProviderPropertyNotifyEvent *event = value; RREventPtr *pHead, pRREvent; #ifndef NXAGENT_SERVER dixLookupResourceByType((void **) &pHead, pWin->drawable.id, RREventType, serverClient, DixReadAccess); #else /* !defined(NXAGENT_SERVER) */ pHead = (RREventPtr *) LookupIDByType(pWin->drawable.id, RREventType); #endif /* !defined(NXAGENT_SERVER) */ if (!pHead) return WT_WALKCHILDREN; for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) { if (!(pRREvent->mask & RRProviderPropertyNotifyMask)) continue; event->window = pRREvent->window->drawable.id; WriteEventsToClient(pRREvent->client, 1, (xEvent *) event); } return WT_WALKCHILDREN; } static void RRDeliverPropertyEvent(ScreenPtr pScreen, xEvent *event) { if (!(dispatchException & (DE_RESET | DE_TERMINATE))) WalkTree(pScreen, DeliverPropertyEvent, event); } static void RRDestroyProviderProperty(RRPropertyPtr prop) { free(prop->valid_values); free(prop->current.data); free(prop->pending.data); free(prop); } static void RRDeleteProperty(RRProviderRec * provider, RRPropertyRec * prop) { xRRProviderPropertyNotifyEvent event = { .type = RREventBase + RRNotify, .subCode = RRNotify_ProviderProperty, .provider = provider->id, .state = PropertyDelete, .atom = prop->propertyName, .timestamp = currentTime.milliseconds }; RRDeliverPropertyEvent(provider->pScreen, (xEvent *) &event); RRDestroyProviderProperty(prop); } void RRDeleteAllProviderProperties(RRProviderPtr provider) { RRPropertyPtr prop, next; for (prop = provider->properties; prop; prop = next) { next = prop->next; RRDeleteProperty(provider, prop); } } static void RRInitProviderPropertyValue(RRPropertyValuePtr property_value) { property_value->type = None; property_value->format = 0; property_value->size = 0; property_value->data = NULL; } static RRPropertyPtr RRCreateProviderProperty(Atom property) { RRPropertyPtr prop; prop = (RRPropertyPtr) malloc(sizeof(RRPropertyRec)); if (!prop) return NULL; prop->next = NULL; prop->propertyName = property; prop->is_pending = FALSE; prop->range = FALSE; prop->immutable = FALSE; prop->num_valid = 0; prop->valid_values = NULL; RRInitProviderPropertyValue(&prop->current); RRInitProviderPropertyValue(&prop->pending); return prop; } void RRDeleteProviderProperty(RRProviderPtr provider, Atom property) { RRPropertyRec *prop, **prev; for (prev = &provider->properties; (prop = *prev); prev = &(prop->next)) if (prop->propertyName == property) { *prev = prop->next; RRDeleteProperty(provider, prop); return; } } int RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type, int format, int mode, unsigned long len, void *value, Bool sendevent, Bool pending) { RRPropertyPtr prop; rrScrPrivPtr pScrPriv = rrGetScrPriv(provider->pScreen); int size_in_bytes; int total_size; unsigned long total_len; RRPropertyValuePtr prop_value; RRPropertyValueRec new_value; Bool add = FALSE; size_in_bytes = format >> 3; /* first see if property already exists */ prop = RRQueryProviderProperty(provider, property); if (!prop) { /* just add to list */ prop = RRCreateProviderProperty(property); if (!prop) return BadAlloc; add = TRUE; mode = PropModeReplace; } if (pending && prop->is_pending) prop_value = &prop->pending; else prop_value = &prop->current; /* To append or prepend to a property the request format and type must match those of the already defined property. The existing format and type are irrelevant when using the mode "PropModeReplace" since they will be written over. */ if ((format != prop_value->format) && (mode != PropModeReplace)) return BadMatch; if ((prop_value->type != type) && (mode != PropModeReplace)) return BadMatch; new_value = *prop_value; if (mode == PropModeReplace) total_len = len; else total_len = prop_value->size + len; if (mode == PropModeReplace || len > 0) { void *new_data = NULL, *old_data = NULL; total_size = total_len * size_in_bytes; new_value.data = (void *) malloc(total_size); if (!new_value.data && total_size) { if (add) RRDestroyProviderProperty(prop); return BadAlloc; } new_value.size = len; new_value.type = type; new_value.format = format; switch (mode) { case PropModeReplace: new_data = new_value.data; old_data = NULL; break; case PropModeAppend: new_data = (void *) (((char *) new_value.data) + (prop_value->size * size_in_bytes)); old_data = new_value.data; break; case PropModePrepend: new_data = new_value.data; old_data = (void *) (((char *) new_value.data) + (prop_value->size * size_in_bytes)); break; } if (new_data) memcpy((char *) new_data, (char *) value, len * size_in_bytes); if (old_data) memcpy((char *) old_data, (char *) prop_value->data, prop_value->size * size_in_bytes); if (pending && pScrPriv->rrProviderSetProperty && !pScrPriv->rrProviderSetProperty(provider->pScreen, provider, prop->propertyName, &new_value)) { if (add) RRDestroyProviderProperty(prop); free(new_value.data); return BadValue; } free(prop_value->data); *prop_value = new_value; } else if (len == 0) { /* do nothing */ } if (add) { prop->next = provider->properties; provider->properties = prop; } if (pending && prop->is_pending) provider->pendingProperties = TRUE; if (sendevent) { xRRProviderPropertyNotifyEvent event = { .type = RREventBase + RRNotify, .subCode = RRNotify_ProviderProperty, .provider = provider->id, .state = PropertyNewValue, .atom = prop->propertyName, .timestamp = currentTime.milliseconds }; RRDeliverPropertyEvent(provider->pScreen, (xEvent *) &event); } return Success; } Bool RRPostProviderPendingProperties(RRProviderPtr provider) { RRPropertyValuePtr pending_value; RRPropertyValuePtr current_value; RRPropertyPtr property; Bool ret = TRUE; if (!provider->pendingProperties) return TRUE; provider->pendingProperties = FALSE; for (property = provider->properties; property; property = property->next) { /* Skip non-pending properties */ if (!property->is_pending) continue; pending_value = &property->pending; current_value = &property->current; /* * If the pending and current values are equal, don't mark it * as changed (which would deliver an event) */ if (pending_value->type == current_value->type && pending_value->format == current_value->format && pending_value->size == current_value->size && !memcmp(pending_value->data, current_value->data, pending_value->size * (pending_value->format / 8))) continue; if (RRChangeProviderProperty(provider, property->propertyName, pending_value->type, pending_value->format, PropModeReplace, pending_value->size, pending_value->data, TRUE, FALSE) != Success) ret = FALSE; } return ret; } RRPropertyPtr RRQueryProviderProperty(RRProviderPtr provider, Atom property) { RRPropertyPtr prop; for (prop = provider->properties; prop; prop = prop->next) if (prop->propertyName == property) return prop; return NULL; } RRPropertyValuePtr RRGetProviderProperty(RRProviderPtr provider, Atom property, Bool pending) { RRPropertyPtr prop = RRQueryProviderProperty(provider, property); rrScrPrivPtr pScrPriv = rrGetScrPriv(provider->pScreen); if (!prop) return NULL; if (pending && prop->is_pending) return &prop->pending; else { #if RANDR_13_INTERFACE /* If we can, try to update the property value first */ if (pScrPriv->rrProviderGetProperty) pScrPriv->rrProviderGetProperty(provider->pScreen, provider, prop->propertyName); #endif return &prop->current; } } int RRConfigureProviderProperty(RRProviderPtr provider, Atom property, Bool pending, Bool range, Bool immutable, int num_values, INT32 *values) { RRPropertyPtr prop = RRQueryProviderProperty(provider, property); Bool add = FALSE; INT32 *new_values; if (!prop) { prop = RRCreateProviderProperty(property); if (!prop) return BadAlloc; add = TRUE; } else if (prop->immutable && !immutable) return BadAccess; /* * ranges must have even number of values */ if (range && (num_values & 1)) { if (add) RRDestroyProviderProperty(prop); return BadMatch; } new_values = xallocarray(num_values, sizeof(INT32)); if (!new_values && num_values) { if (add) RRDestroyProviderProperty(prop); return BadAlloc; } if (num_values) memcpy(new_values, values, num_values * sizeof(INT32)); /* * Property moving from pending to non-pending * loses any pending values */ if (prop->is_pending && !pending) { free(prop->pending.data); RRInitProviderPropertyValue(&prop->pending); } prop->is_pending = pending; prop->range = range; prop->immutable = immutable; prop->num_valid = num_values; free(prop->valid_values); prop->valid_values = new_values; if (add) { prop->next = provider->properties; provider->properties = prop; } return Success; } int ProcRRListProviderProperties(ClientPtr client) { REQUEST(xRRListProviderPropertiesReq); Atom *pAtoms = NULL, *temppAtoms; xRRListProviderPropertiesReply rep; int numProps = 0; RRProviderPtr provider; RRPropertyPtr prop; REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); for (prop = provider->properties; prop; prop = prop->next) numProps++; if (numProps) if (!(pAtoms = xallocarray(numProps, sizeof(Atom)))) return BadAlloc; rep = (xRRListProviderPropertiesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(numProps * sizeof(Atom)), .nAtoms = numProps }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.nAtoms); } temppAtoms = pAtoms; for (prop = provider->properties; prop; prop = prop->next) *temppAtoms++ = prop->propertyName; WriteToClient(client, sizeof(xRRListProviderPropertiesReply), &rep); if (numProps) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); free(pAtoms); } return Success; } int ProcRRQueryProviderProperty(ClientPtr client) { REQUEST(xRRQueryProviderPropertyReq); xRRQueryProviderPropertyReply rep; RRProviderPtr provider; RRPropertyPtr prop; char *extra = NULL; REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); prop = RRQueryProviderProperty(provider, stuff->property); if (!prop) return BadName; if (prop->num_valid) { extra = xallocarray(prop->num_valid, sizeof(INT32)); if (!extra) return BadAlloc; } rep = (xRRQueryProviderPropertyReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = prop->num_valid, .pending = prop->is_pending, .range = prop->range, .immutable = prop->immutable }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); } WriteToClient(client, sizeof(xRRQueryProviderPropertyReply), &rep); if (prop->num_valid) { memcpy(extra, prop->valid_values, prop->num_valid * sizeof(INT32)); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32), extra); free(extra); } return Success; } int ProcRRConfigureProviderProperty(ClientPtr client) { REQUEST(xRRConfigureProviderPropertyReq); RRProviderPtr provider; int num_valid; REQUEST_AT_LEAST_SIZE(xRRConfigureProviderPropertyReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); num_valid = stuff->length - bytes_to_int32(sizeof(xRRConfigureProviderPropertyReq)); return RRConfigureProviderProperty(provider, stuff->property, stuff->pending, stuff->range, FALSE, num_valid, (INT32 *) (stuff + 1)); } int ProcRRChangeProviderProperty(ClientPtr client) { REQUEST(xRRChangeProviderPropertyReq); RRProviderPtr provider; char format, mode; unsigned long len; int sizeInBytes; int totalSize; int err; REQUEST_AT_LEAST_SIZE(xRRChangeProviderPropertyReq); UpdateCurrentTime(); format = stuff->format; mode = stuff->mode; if ((mode != PropModeReplace) && (mode != PropModeAppend) && (mode != PropModePrepend)) { client->errorValue = mode; return BadValue; } if ((format != 8) && (format != 16) && (format != 32)) { client->errorValue = format; return BadValue; } len = stuff->nUnits; if (len > bytes_to_int32((0xffffffff - sizeof(xChangePropertyReq)))) return BadLength; sizeInBytes = format >> 3; totalSize = len * sizeInBytes; REQUEST_FIXED_SIZE(xRRChangeProviderPropertyReq, totalSize); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return BadAtom; } if (!ValidAtom(stuff->type)) { client->errorValue = stuff->type; return BadAtom; } err = RRChangeProviderProperty(provider, stuff->property, stuff->type, (int) format, (int) mode, len, (void *) &stuff[1], TRUE, TRUE); if (err != Success) return err; else return Success; } int ProcRRDeleteProviderProperty(ClientPtr client) { REQUEST(xRRDeleteProviderPropertyReq); RRProviderPtr provider; RRPropertyPtr prop; REQUEST_SIZE_MATCH(xRRDeleteProviderPropertyReq); UpdateCurrentTime(); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return BadAtom; } prop = RRQueryProviderProperty(provider, stuff->property); if (!prop) { client->errorValue = stuff->property; return BadName; } if (prop->immutable) { client->errorValue = stuff->property; return BadAccess; } RRDeleteProviderProperty(provider, stuff->property); return Success; } int ProcRRGetProviderProperty(ClientPtr client) { REQUEST(xRRGetProviderPropertyReq); RRPropertyPtr prop, *prev; RRPropertyValuePtr prop_value; unsigned long n, len, ind; RRProviderPtr provider; xRRGetProviderPropertyReply reply = { .type = X_Reply, .sequenceNumber = client->sequence }; char *extra = NULL; REQUEST_SIZE_MATCH(xRRGetProviderPropertyReq); if (stuff->delete) UpdateCurrentTime(); VERIFY_RR_PROVIDER(stuff->provider, provider, stuff->delete ? DixWriteAccess : DixReadAccess); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return BadAtom; } if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) { client->errorValue = stuff->delete; return BadValue; } if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type)) { client->errorValue = stuff->type; return BadAtom; } for (prev = &provider->properties; (prop = *prev); prev = &prop->next) if (prop->propertyName == stuff->property) break; if (!prop) { reply.nItems = 0; reply.length = 0; reply.bytesAfter = 0; reply.propertyType = None; reply.format = 0; if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swapl(&reply.propertyType); swapl(&reply.bytesAfter); swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetProviderPropertyReply), &reply); return Success; } if (prop->immutable && stuff->delete) return BadAccess; prop_value = RRGetProviderProperty(provider, stuff->property, stuff->pending); if (!prop_value) return BadAtom; /* If the request type and actual type don't match. Return the property information, but not the data. */ if (((stuff->type != prop_value->type) && (stuff->type != AnyPropertyType)) ) { reply.bytesAfter = prop_value->size; reply.format = prop_value->format; reply.length = 0; reply.nItems = 0; reply.propertyType = prop_value->type; if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swapl(&reply.propertyType); swapl(&reply.bytesAfter); swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetProviderPropertyReply), &reply); return Success; } /* * Return type, format, value to client */ n = (prop_value->format / 8) * prop_value->size; /* size (bytes) of prop */ ind = stuff->longOffset << 2; /* If longOffset is invalid such that it causes "len" to be negative, it's a value error. */ if (n < ind) { client->errorValue = stuff->longOffset; return BadValue; } len = min(n - ind, 4 * stuff->longLength); if (len) { extra = malloc(len); if (!extra) return BadAlloc; } reply.bytesAfter = n - (ind + len); reply.format = prop_value->format; reply.length = bytes_to_int32(len); if (prop_value->format) reply.nItems = len / (prop_value->format / 8); else reply.nItems = 0; reply.propertyType = prop_value->type; if (stuff->delete && (reply.bytesAfter == 0)) { xRRProviderPropertyNotifyEvent event = { .type = RREventBase + RRNotify, .subCode = RRNotify_ProviderProperty, .provider = provider->id, .state = PropertyDelete, .atom = prop->propertyName, .timestamp = currentTime.milliseconds }; RRDeliverPropertyEvent(provider->pScreen, (xEvent *) &event); } if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swapl(&reply.propertyType); swapl(&reply.bytesAfter); swapl(&reply.nItems); } WriteToClient(client, sizeof(xGenericReply), &reply); if (len) { memcpy(extra, (char *) prop_value->data + ind, len); switch (reply.format) { case 32: client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; break; case 16: client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write; break; default: client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient; break; } WriteSwappedDataToClient(client, len, extra); free(extra); } if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */ *prev = prop->next; RRDestroyProviderProperty(prop); } return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rrscreen.c0000644000000000000000000011065513614532331017700 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Copyright © 2006 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "randrstr.h" static CARD16 RR10CurrentSizeID(ScreenPtr pScreen); /* * Edit connection information block so that new clients * see the current screen size on connect */ static void RREditConnectionInfo(ScreenPtr pScreen) { xConnSetup *connSetup; char *vendor; xPixmapFormat *formats; xWindowRoot *root; xDepth *depth; xVisualType *visual; int screen = 0; int d; connSetup = (xConnSetup *) ConnectionInfo; vendor = (char *) connSetup + sizeof(xConnSetup); formats = (xPixmapFormat *) ((char *) vendor + pad_to_int32(connSetup->nbytesVendor)); root = (xWindowRoot *) ((char *) formats + sizeof(xPixmapFormat) * screenInfo.numPixmapFormats); while (screen != pScreen->myNum) { depth = (xDepth *) ((char *) root + sizeof(xWindowRoot)); for (d = 0; d < root->nDepths; d++) { visual = (xVisualType *) ((char *) depth + sizeof(xDepth)); depth = (xDepth *) ((char *) visual + depth->nVisuals * sizeof(xVisualType)); } root = (xWindowRoot *) ((char *) depth); screen++; } root->pixWidth = pScreen->width; root->pixHeight = pScreen->height; root->mmWidth = pScreen->mmWidth; root->mmHeight = pScreen->mmHeight; } void RRSendConfigNotify(ScreenPtr pScreen) { WindowPtr pWin = pScreen->root; xEvent event = { .u.configureNotify.window = pWin->drawable.id, .u.configureNotify.aboveSibling = None, .u.configureNotify.x = 0, .u.configureNotify.y = 0, /* XXX xinerama stuff ? */ .u.configureNotify.width = pWin->drawable.width, .u.configureNotify.height = pWin->drawable.height, .u.configureNotify.borderWidth = wBorderWidth(pWin), .u.configureNotify.override = pWin->overrideRedirect }; event.u.u.type = ConfigureNotify; DeliverEvents(pWin, &event, 1, NullWindow); } void RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen) { rrScrPriv(pScreen); RRCrtcPtr crtc = pScrPriv->numCrtcs ? pScrPriv->crtcs[0] : NULL; WindowPtr pRoot = pScreen->root; xRRScreenChangeNotifyEvent se = { .type = RRScreenChangeNotify + RREventBase, .rotation = (CARD8) (crtc ? crtc->rotation : RR_Rotate_0), .timestamp = pScrPriv->lastSetTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds, .root = pRoot->drawable.id, .window = pWin->drawable.id, .subpixelOrder = PictureGetSubpixelOrder(pScreen), .sizeID = RR10CurrentSizeID(pScreen) }; if (se.rotation & (RR_Rotate_90 | RR_Rotate_270)) { se.widthInPixels = pScreen->height; se.heightInPixels = pScreen->width; se.widthInMillimeters = pScreen->mmHeight; se.heightInMillimeters = pScreen->mmWidth; } else { se.widthInPixels = pScreen->width; se.heightInPixels = pScreen->height; se.widthInMillimeters = pScreen->mmWidth; se.heightInMillimeters = pScreen->mmHeight; } WriteEventsToClient(client, 1, (xEvent *) (char *) &se); } /* * Notify the extension that the screen size has been changed. * The driver is responsible for calling this whenever it has changed * the size of the screen */ void RRScreenSizeNotify(ScreenPtr pScreen) { rrScrPriv(pScreen); /* * Deliver ConfigureNotify events when root changes * pixel size */ if (pScrPriv->width == pScreen->width && pScrPriv->height == pScreen->height && pScrPriv->mmWidth == pScreen->mmWidth && pScrPriv->mmHeight == pScreen->mmHeight) return; pScrPriv->width = pScreen->width; pScrPriv->height = pScreen->height; pScrPriv->mmWidth = pScreen->mmWidth; pScrPriv->mmHeight = pScreen->mmHeight; RRSetChanged(pScreen); /* pScrPriv->sizeChanged = TRUE; */ RRTellChanged(pScreen); RRSendConfigNotify(pScreen); RREditConnectionInfo(pScreen); RRPointerScreenConfigured(pScreen); /* * Fix pointer bounds and location */ ScreenRestructured(pScreen); } /* * Request that the screen be resized */ Bool RRScreenSizeSet(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight) { rrScrPriv(pScreen); #if RANDR_12_INTERFACE if (pScrPriv->rrScreenSetSize) { return (*pScrPriv->rrScreenSetSize) (pScreen, width, height, mmWidth, mmHeight); } #endif #if RANDR_10_INTERFACE if (pScrPriv->rrSetConfig) { return TRUE; /* can't set size separately */ } #endif return FALSE; } /* * Retrieve valid screen size range */ int ProcRRGetScreenSizeRange(ClientPtr client) { REQUEST(xRRGetScreenSizeRangeReq); xRRGetScreenSizeRangeReply rep; WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; int rc; REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq); #ifndef NXAGENT_SERVER rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); #else pWin = SecurityLookupWindow(stuff->window, client, DixReadAccess); rc = pWin ? Success : BadWindow; #endif if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); rep = (xRRGetScreenSizeRangeReply) { .type = X_Reply, .pad = 0, .sequenceNumber = client->sequence, .length = 0 }; if (pScrPriv) { if (!RRGetInfo(pScreen, FALSE)) return BadAlloc; rep.minWidth = pScrPriv->minWidth; rep.minHeight = pScrPriv->minHeight; rep.maxWidth = pScrPriv->maxWidth; rep.maxHeight = pScrPriv->maxHeight; } else { rep.maxWidth = rep.minWidth = pScreen->width; rep.maxHeight = rep.minHeight = pScreen->height; } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.minWidth); swaps(&rep.minHeight); swaps(&rep.maxWidth); swaps(&rep.maxHeight); } WriteToClient(client, sizeof(xRRGetScreenSizeRangeReply), &rep); return Success; } int ProcRRSetScreenSize(ClientPtr client) { REQUEST(xRRSetScreenSizeReq); WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; int i, rc; REQUEST_SIZE_MATCH(xRRSetScreenSizeReq); #ifndef NXAGENT_SERVER rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); #else pWin = SecurityLookupWindow(stuff->window, client, DixReadAccess); rc = pWin ? Success : BadWindow; #endif if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); if (!pScrPriv) return BadMatch; if (stuff->width < pScrPriv->minWidth || pScrPriv->maxWidth < stuff->width) { client->errorValue = stuff->width; return BadValue; } if (stuff->height < pScrPriv->minHeight || pScrPriv->maxHeight < stuff->height) { client->errorValue = stuff->height; return BadValue; } for (i = 0; i < pScrPriv->numCrtcs; i++) { RRCrtcPtr crtc = pScrPriv->crtcs[i]; RRModePtr mode = crtc->mode; if (mode) { int source_width = mode->mode.width; int source_height = mode->mode.height; Rotation rotation = crtc->rotation; if (rotation == RR_Rotate_90 || rotation == RR_Rotate_270) { source_width = mode->mode.height; source_height = mode->mode.width; } if (crtc->x + source_width > stuff->width || crtc->y + source_height > stuff->height) return BadMatch; } } if (stuff->widthInMillimeters == 0 || stuff->heightInMillimeters == 0) { client->errorValue = 0; return BadValue; } if (!RRScreenSizeSet(pScreen, stuff->width, stuff->height, stuff->widthInMillimeters, stuff->heightInMillimeters)) { return BadMatch; } return Success; } #define update_totals(gpuscreen, pScrPriv) do { \ total_crtcs += pScrPriv->numCrtcs; \ total_outputs += pScrPriv->numOutputs; \ modes = RRModesForScreen(gpuscreen, &num_modes); \ if (!modes) \ return BadAlloc; \ for (j = 0; j < num_modes; j++) \ total_name_len += modes[j]->mode.nameLength; \ total_modes += num_modes; \ free(modes); \ } while(0) static inline void swap_modeinfos(xRRModeInfo * modeinfos, int i) { swapl(&modeinfos[i].id); swaps(&modeinfos[i].width); swaps(&modeinfos[i].height); swapl(&modeinfos[i].dotClock); swaps(&modeinfos[i].hSyncStart); swaps(&modeinfos[i].hSyncEnd); swaps(&modeinfos[i].hTotal); swaps(&modeinfos[i].hSkew); swaps(&modeinfos[i].vSyncStart); swaps(&modeinfos[i].vSyncEnd); swaps(&modeinfos[i].vTotal); swaps(&modeinfos[i].nameLength); swapl(&modeinfos[i].modeFlags); } #define update_arrays(gpuscreen, pScrPriv, primary_crtc, has_primary) do { \ for (j = 0; j < pScrPriv->numCrtcs; j++) { \ if (has_primary && \ primary_crtc == pScrPriv->crtcs[j]) { \ has_primary = 0; \ continue; \ }\ crtcs[crtc_count] = pScrPriv->crtcs[j]->id; \ if (client->swapped) \ swapl(&crtcs[crtc_count]); \ crtc_count++; \ } \ for (j = 0; j < pScrPriv->numOutputs; j++) { \ outputs[output_count] = pScrPriv->outputs[j]->id; \ if (client->swapped) \ swapl(&outputs[output_count]); \ output_count++; \ } \ { \ RRModePtr mode; \ modes = RRModesForScreen(gpuscreen, &num_modes); \ for (j = 0; j < num_modes; j++) { \ mode = modes[j]; \ modeinfos[mode_count] = mode->mode; \ if (client->swapped) { \ swap_modeinfos(modeinfos, mode_count); \ } \ memcpy(names, mode->name, mode->mode.nameLength); \ names += mode->mode.nameLength; \ mode_count++; \ } \ free(modes); \ } \ } while (0) #ifndef NXAGENT_SERVER static int rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) { int j; int total_crtcs, total_outputs, total_modes, total_name_len; int crtc_count, output_count, mode_count; ScreenPtr iter; rrScrPrivPtr pScrPriv; int num_modes; RRModePtr *modes; xRRGetScreenResourcesReply rep; unsigned long extraLen; CARD8 *extra; RRCrtc *crtcs; RRCrtcPtr primary_crtc = NULL; RROutput *outputs; xRRModeInfo *modeinfos; CARD8 *names; int has_primary = 0; /* we need to iterate all the GPU masters and all their output slaves */ total_crtcs = 0; total_outputs = 0; total_modes = 0; total_name_len = 0; pScrPriv = rrGetScrPriv(pScreen); if (query && pScrPriv) if (!RRGetInfo(pScreen, query)) return BadAlloc; update_totals(pScreen, pScrPriv); xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) { pScrPriv = rrGetScrPriv(iter); if (query) if (!RRGetInfo(iter, query)) return BadAlloc; update_totals(iter, pScrPriv); } pScrPriv = rrGetScrPriv(pScreen); rep = (xRRGetScreenResourcesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .timestamp = pScrPriv->lastSetTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds, .nCrtcs = total_crtcs, .nOutputs = total_outputs, .nModes = total_modes, .nbytesNames = total_name_len }; rep.length = (total_crtcs + total_outputs + total_modes * bytes_to_int32(SIZEOF(xRRModeInfo)) + bytes_to_int32(total_name_len)); extraLen = rep.length << 2; if (extraLen) { extra = calloc(1,extraLen); if (!extra) { return BadAlloc; } } else extra = NULL; crtcs = (RRCrtc *) extra; outputs = (RROutput *) (crtcs + total_crtcs); modeinfos = (xRRModeInfo *) (outputs + total_outputs); names = (CARD8 *) (modeinfos + total_modes); crtc_count = 0; output_count = 0; mode_count = 0; pScrPriv = rrGetScrPriv(pScreen); if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) { has_primary = 1; primary_crtc = pScrPriv->primaryOutput->crtc; crtcs[0] = pScrPriv->primaryOutput->crtc->id; if (client->swapped) swapl(&crtcs[0]); crtc_count = 1; } update_arrays(pScreen, pScrPriv, primary_crtc, has_primary); xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) { pScrPriv = rrGetScrPriv(iter); update_arrays(iter, pScrPriv, primary_crtc, has_primary); } assert(bytes_to_int32((char *) names - (char *) extra) == rep.length); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swapl(&rep.configTimestamp); swaps(&rep.nCrtcs); swaps(&rep.nOutputs); swaps(&rep.nModes); swaps(&rep.nbytesNames); } WriteToClient(client, sizeof(xRRGetScreenResourcesReply), &rep); if (extraLen) { WriteToClient(client, extraLen, extra); free(extra); } return Success; } #endif /* !defined(NXAGENT_SERVER) */ static int rrGetScreenResources(ClientPtr client, Bool query) { REQUEST(xRRGetScreenResourcesReq); xRRGetScreenResourcesReply rep; WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; CARD8 *extra; unsigned long extraLen; int i, rc, has_primary = 0; RRCrtc *crtcs; RROutput *outputs; xRRModeInfo *modeinfos; CARD8 *names; REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq); #ifndef NXAGENT_SERVER rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); #else pWin = SecurityLookupWindow(stuff->window, client, DixReadAccess); rc = pWin ? Success : BadWindow; #endif if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); if (query && pScrPriv) if (!RRGetInfo(pScreen, query)) return BadAlloc; #ifndef NXAGENT_SERVER if (!xorg_list_is_empty(&pScreen->output_slave_list)) return rrGetMultiScreenResources(client, query, pScreen); #endif if (!pScrPriv) { rep = (xRRGetScreenResourcesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .timestamp = currentTime.milliseconds, .configTimestamp = currentTime.milliseconds, .nCrtcs = 0, .nOutputs = 0, .nModes = 0, .nbytesNames = 0 }; extra = NULL; extraLen = 0; } else { RRModePtr *modes; int num_modes; modes = RRModesForScreen(pScreen, &num_modes); if (!modes) return BadAlloc; rep = (xRRGetScreenResourcesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .timestamp = pScrPriv->lastSetTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds, .nCrtcs = pScrPriv->numCrtcs, .nOutputs = pScrPriv->numOutputs, .nModes = num_modes, .nbytesNames = 0 }; for (i = 0; i < num_modes; i++) rep.nbytesNames += modes[i]->mode.nameLength; rep.length = (pScrPriv->numCrtcs + pScrPriv->numOutputs + num_modes * bytes_to_int32(SIZEOF(xRRModeInfo)) + bytes_to_int32(rep.nbytesNames)); extraLen = rep.length << 2; if (extraLen) { extra = calloc(1, extraLen); if (!extra) { free(modes); return BadAlloc; } } else extra = NULL; crtcs = (RRCrtc *) extra; outputs = (RROutput *) (crtcs + pScrPriv->numCrtcs); modeinfos = (xRRModeInfo *) (outputs + pScrPriv->numOutputs); names = (CARD8 *) (modeinfos + num_modes); if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) { has_primary = 1; crtcs[0] = pScrPriv->primaryOutput->crtc->id; if (client->swapped) swapl(&crtcs[0]); } for (i = 0; i < pScrPriv->numCrtcs; i++) { if (has_primary && pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i]) { has_primary = 0; continue; } crtcs[i + has_primary] = pScrPriv->crtcs[i]->id; if (client->swapped) swapl(&crtcs[i + has_primary]); } for (i = 0; i < pScrPriv->numOutputs; i++) { outputs[i] = pScrPriv->outputs[i]->id; if (client->swapped) swapl(&outputs[i]); } for (i = 0; i < num_modes; i++) { RRModePtr mode = modes[i]; modeinfos[i] = mode->mode; if (client->swapped) { swapl(&modeinfos[i].id); swaps(&modeinfos[i].width); swaps(&modeinfos[i].height); swapl(&modeinfos[i].dotClock); swaps(&modeinfos[i].hSyncStart); swaps(&modeinfos[i].hSyncEnd); swaps(&modeinfos[i].hTotal); swaps(&modeinfos[i].hSkew); swaps(&modeinfos[i].vSyncStart); swaps(&modeinfos[i].vSyncEnd); swaps(&modeinfos[i].vTotal); swaps(&modeinfos[i].nameLength); swapl(&modeinfos[i].modeFlags); } memcpy(names, mode->name, mode->mode.nameLength); names += mode->mode.nameLength; } free(modes); assert(bytes_to_int32((char *) names - (char *) extra) == rep.length); } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swapl(&rep.configTimestamp); swaps(&rep.nCrtcs); swaps(&rep.nOutputs); swaps(&rep.nModes); swaps(&rep.nbytesNames); } WriteToClient(client, sizeof(xRRGetScreenResourcesReply), (char *) &rep); if (extraLen) { WriteToClient(client, extraLen, extra); free(extra); } return Success; } int ProcRRGetScreenResources(ClientPtr client) { return rrGetScreenResources(client, TRUE); } int ProcRRGetScreenResourcesCurrent(ClientPtr client) { return rrGetScreenResources(client, FALSE); } typedef struct _RR10Data { RRScreenSizePtr sizes; int nsize; int nrefresh; int size; CARD16 refresh; } RR10DataRec, *RR10DataPtr; /* * Convert 1.2 monitor data into 1.0 screen data */ static RR10DataPtr RR10GetData(ScreenPtr pScreen, RROutputPtr output) { RR10DataPtr data; RRScreenSizePtr size; int nmode = output->numModes + output->numUserModes; int o, os, l, r; RRScreenRatePtr refresh; CARD16 vRefresh; RRModePtr mode; Bool *used; /* Make sure there is plenty of space for any combination */ data = malloc(sizeof(RR10DataRec) + sizeof(RRScreenSize) * nmode + sizeof(RRScreenRate) * nmode + sizeof(Bool) * nmode); if (!data) return NULL; size = (RRScreenSizePtr) (data + 1); refresh = (RRScreenRatePtr) (size + nmode); used = (Bool *) (refresh + nmode); memset(used, '\0', sizeof(Bool) * nmode); data->sizes = size; data->nsize = 0; data->nrefresh = 0; data->size = 0; data->refresh = 0; /* * find modes not yet listed */ for (o = 0; o < output->numModes + output->numUserModes; o++) { if (used[o]) continue; if (o < output->numModes) mode = output->modes[o]; else mode = output->userModes[o - output->numModes]; l = data->nsize; size[l].id = data->nsize; size[l].width = mode->mode.width; size[l].height = mode->mode.height; if (output->mmWidth && output->mmHeight) { size[l].mmWidth = output->mmWidth; size[l].mmHeight = output->mmHeight; } else { size[l].mmWidth = pScreen->mmWidth; size[l].mmHeight = pScreen->mmHeight; } size[l].nRates = 0; size[l].pRates = &refresh[data->nrefresh]; data->nsize++; /* * Find all modes with matching size */ for (os = o; os < output->numModes + output->numUserModes; os++) { if (os < output->numModes) mode = output->modes[os]; else mode = output->userModes[os - output->numModes]; if (mode->mode.width == size[l].width && mode->mode.height == size[l].height) { vRefresh = RRVerticalRefresh(&mode->mode); used[os] = TRUE; for (r = 0; r < size[l].nRates; r++) if (vRefresh == size[l].pRates[r].rate) break; if (r == size[l].nRates) { size[l].pRates[r].rate = vRefresh; size[l].pRates[r].mode = mode; size[l].nRates++; data->nrefresh++; } if (mode == output->crtc->mode) { data->size = l; data->refresh = vRefresh; } } } } return data; } int ProcRRGetScreenInfo(ClientPtr client) { REQUEST(xRRGetScreenInfoReq); xRRGetScreenInfoReply rep; WindowPtr pWin; int rc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; CARD8 *extra; unsigned long extraLen; RROutputPtr output; REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); #ifndef NXAGENT_SERVER rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); #else pWin = SecurityLookupWindow(stuff->window, client, DixReadAccess); rc = pWin ? Success : BadWindow; #endif if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); if (pScrPriv) if (!RRGetInfo(pScreen, TRUE)) return BadAlloc; output = RRFirstOutput(pScreen); if (!pScrPriv || !output) { rep = (xRRGetScreenInfoReply) { .type = X_Reply, .setOfRotations = RR_Rotate_0, .sequenceNumber = client->sequence, .length = 0, .root = pWin->drawable.pScreen->root->drawable.id, .timestamp = currentTime.milliseconds, .configTimestamp = currentTime.milliseconds, .nSizes = 0, .sizeID = 0, .rotation = RR_Rotate_0, .rate = 0, .nrateEnts = 0 }; extra = 0; extraLen = 0; } else { int i, j; xScreenSizes *size; CARD16 *rates; CARD8 *data8; Bool has_rate = RRClientKnowsRates(client); RR10DataPtr pData; RRScreenSizePtr pSize; pData = RR10GetData(pScreen, output); if (!pData) return BadAlloc; rep = (xRRGetScreenInfoReply) { .type = X_Reply, .setOfRotations = output->crtc->rotations, .sequenceNumber = client->sequence, .length = 0, .root = pWin->drawable.pScreen->root->drawable.id, .timestamp = pScrPriv->lastSetTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds, .rotation = output->crtc->rotation, .nSizes = pData->nsize, .nrateEnts = pData->nrefresh + pData->nsize, .sizeID = pData->size, .rate = pData->refresh }; extraLen = rep.nSizes * sizeof(xScreenSizes); if (has_rate) extraLen += rep.nrateEnts * sizeof(CARD16); if (extraLen) { extra = (CARD8 *) calloc(1, extraLen); if (!extra) { free(pData); return BadAlloc; } } else extra = NULL; /* * First comes the size information */ size = (xScreenSizes *) extra; rates = (CARD16 *) (size + rep.nSizes); for (i = 0; i < pData->nsize; i++) { pSize = &pData->sizes[i]; size->widthInPixels = pSize->width; size->heightInPixels = pSize->height; size->widthInMillimeters = pSize->mmWidth; size->heightInMillimeters = pSize->mmHeight; if (client->swapped) { swaps(&size->widthInPixels); swaps(&size->heightInPixels); swaps(&size->widthInMillimeters); swaps(&size->heightInMillimeters); } size++; if (has_rate) { *rates = pSize->nRates; if (client->swapped) { swaps(rates); } rates++; for (j = 0; j < pSize->nRates; j++) { *rates = pSize->pRates[j].rate; if (client->swapped) { swaps(rates); } rates++; } } } free(pData); data8 = (CARD8 *) rates; if (data8 - (CARD8 *) extra != extraLen) FatalError("RRGetScreenInfo bad extra len %ld != %ld\n", (unsigned long) (data8 - (CARD8 *) extra), extraLen); rep.length = bytes_to_int32(extraLen); } if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.timestamp); swapl(&rep.configTimestamp); swaps(&rep.rotation); swaps(&rep.nSizes); swaps(&rep.sizeID); swaps(&rep.rate); swaps(&rep.nrateEnts); } WriteToClient(client, sizeof(xRRGetScreenInfoReply), &rep); if (extraLen) { WriteToClient(client, extraLen, extra); free(extra); } return Success; } int ProcRRSetScreenConfig(ClientPtr client) { REQUEST(xRRSetScreenConfigReq); xRRSetScreenConfigReply rep; DrawablePtr pDraw; int rc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; TimeStamp time; int i; Rotation rotation; int rate; Bool has_rate; CARD8 status; RROutputPtr output; RRCrtcPtr crtc; RRModePtr mode; RR10DataPtr pData = NULL; RRScreenSizePtr pSize; int width, height; UpdateCurrentTime(); if (RRClientKnowsRates(client)) { REQUEST_SIZE_MATCH(xRRSetScreenConfigReq); has_rate = TRUE; } else { REQUEST_SIZE_MATCH(xRR1_0SetScreenConfigReq); has_rate = FALSE; } #ifndef NXAGENT_SERVER rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess); #else /* !defined(NXAGENT_SERVER) */ pDraw = SecurityLookupDrawable(stuff->drawable, client, DixWriteAccess); rc = pDraw ? Success : BadDrawable; #endif /* !defined(NXAGENT_SERVER) */ if (rc != Success) return rc; pScreen = pDraw->pScreen; pScrPriv = rrGetScrPriv(pScreen); time = ClientTimeToServerTime(stuff->timestamp); if (!pScrPriv) { time = currentTime; status = RRSetConfigFailed; goto sendReply; } if (!RRGetInfo(pScreen, FALSE)) return BadAlloc; output = RRFirstOutput(pScreen); if (!output) { time = currentTime; status = RRSetConfigFailed; goto sendReply; } crtc = output->crtc; /* * If the client's config timestamp is not the same as the last config * timestamp, then the config information isn't up-to-date and * can't even be validated. * * Note that the client only knows about the milliseconds part of the * timestamp, so using CompareTimeStamps here would cause randr to suddenly * stop working after several hours have passed (freedesktop bug #6502). */ if (stuff->configTimestamp != pScrPriv->lastConfigTime.milliseconds) { status = RRSetConfigInvalidConfigTime; goto sendReply; } pData = RR10GetData(pScreen, output); if (!pData) return BadAlloc; if (stuff->sizeID >= pData->nsize) { /* * Invalid size ID */ client->errorValue = stuff->sizeID; free(pData); return BadValue; } pSize = &pData->sizes[stuff->sizeID]; /* * Validate requested rotation */ rotation = (Rotation) stuff->rotation; /* test the rotation bits only! */ switch (rotation & 0xf) { case RR_Rotate_0: case RR_Rotate_90: case RR_Rotate_180: case RR_Rotate_270: break; default: /* * Invalid rotation */ client->errorValue = stuff->rotation; free(pData); return BadValue; } if ((~crtc->rotations) & rotation) { /* * requested rotation or reflection not supported by screen */ client->errorValue = stuff->rotation; free(pData); return BadMatch; } /* * Validate requested refresh */ if (has_rate) rate = (int) stuff->rate; else rate = 0; if (rate) { for (i = 0; i < pSize->nRates; i++) { if (pSize->pRates[i].rate == rate) break; } if (i == pSize->nRates) { /* * Invalid rate */ client->errorValue = rate; free(pData); return BadValue; } mode = pSize->pRates[i].mode; } else mode = pSize->pRates[0].mode; /* * Make sure the requested set-time is not older than * the last set-time */ if (CompareTimeStamps(time, pScrPriv->lastSetTime) < 0) { status = RRSetConfigInvalidTime; goto sendReply; } /* * If the screen size is changing, adjust all of the other outputs * to fit the new size, mirroring as much as possible */ width = mode->mode.width; height = mode->mode.height; if (width < pScrPriv->minWidth || pScrPriv->maxWidth < width) { client->errorValue = width; free(pData); return BadValue; } if (height < pScrPriv->minHeight || pScrPriv->maxHeight < height) { client->errorValue = height; free(pData); return BadValue; } if (rotation & (RR_Rotate_90 | RR_Rotate_270)) { width = mode->mode.height; height = mode->mode.width; } if (width != pScreen->width || height != pScreen->height) { int c; for (c = 0; c < pScrPriv->numCrtcs; c++) { if (!RRCrtcSet(pScrPriv->crtcs[c], NULL, 0, 0, RR_Rotate_0, 0, NULL)) { status = RRSetConfigFailed; /* XXX recover from failure */ goto sendReply; } } if (!RRScreenSizeSet(pScreen, width, height, pScreen->mmWidth, pScreen->mmHeight)) { status = RRSetConfigFailed; /* XXX recover from failure */ goto sendReply; } } if (!RRCrtcSet(crtc, mode, 0, 0, stuff->rotation, 1, &output)) status = RRSetConfigFailed; else { pScrPriv->lastSetTime = time; status = RRSetConfigSuccess; } /* * XXX Configure other crtcs to mirror as much as possible */ sendReply: free(pData); rep = (xRRSetScreenConfigReply) { .type = X_Reply, .status = status, .sequenceNumber = client->sequence, .length = 0, .newTimestamp = pScrPriv->lastSetTime.milliseconds, .newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds, .root = pDraw->pScreen->root->drawable.id, /* .subpixelOrder = ?? */ }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.newTimestamp); swapl(&rep.newConfigTimestamp); swapl(&rep.root); } WriteToClient(client, sizeof(xRRSetScreenConfigReply), &rep); return Success; } static CARD16 RR10CurrentSizeID(ScreenPtr pScreen) { CARD16 sizeID = 0xffff; RROutputPtr output = RRFirstOutput(pScreen); if (output) { RR10DataPtr data = RR10GetData(pScreen, output); if (data) { int i; for (i = 0; i < data->nsize; i++) if (data->sizes[i].width == pScreen->width && data->sizes[i].height == pScreen->height) { sizeID = (CARD16) i; break; } free(data); } } return sizeID; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rrsdispatch.c0000644000000000000000000004320413614532331020376 0ustar /* * Copyright © 2006 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "randrstr.h" static int SProcRRQueryVersion(ClientPtr client) { REQUEST(xRRQueryVersionReq); REQUEST_SIZE_MATCH(xRRQueryVersionReq); swaps(&stuff->length); swapl(&stuff->majorVersion); swapl(&stuff->minorVersion); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetScreenInfo(ClientPtr client) { REQUEST(xRRGetScreenInfoReq); REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); swaps(&stuff->length); swapl(&stuff->window); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSetScreenConfig(ClientPtr client) { REQUEST(xRRSetScreenConfigReq); if (RRClientKnowsRates(client)) { REQUEST_SIZE_MATCH(xRRSetScreenConfigReq); swaps(&stuff->rate); } else { REQUEST_SIZE_MATCH(xRR1_0SetScreenConfigReq); } swaps(&stuff->length); swapl(&stuff->drawable); swapl(&stuff->timestamp); swaps(&stuff->sizeID); swaps(&stuff->rotation); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSelectInput(ClientPtr client) { REQUEST(xRRSelectInputReq); REQUEST_SIZE_MATCH(xRRSelectInputReq); swaps(&stuff->length); swapl(&stuff->window); swaps(&stuff->enable); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetScreenSizeRange(ClientPtr client) { REQUEST(xRRGetScreenSizeRangeReq); REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq); swaps(&stuff->length); swapl(&stuff->window); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSetScreenSize(ClientPtr client) { REQUEST(xRRSetScreenSizeReq); REQUEST_SIZE_MATCH(xRRSetScreenSizeReq); swaps(&stuff->length); swapl(&stuff->window); swaps(&stuff->width); swaps(&stuff->height); swapl(&stuff->widthInMillimeters); swapl(&stuff->heightInMillimeters); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetScreenResources(ClientPtr client) { REQUEST(xRRGetScreenResourcesReq); REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq); swaps(&stuff->length); swapl(&stuff->window); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetOutputInfo(ClientPtr client) { REQUEST(xRRGetOutputInfoReq); REQUEST_SIZE_MATCH(xRRGetOutputInfoReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->configTimestamp); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRListOutputProperties(ClientPtr client) { REQUEST(xRRListOutputPropertiesReq); REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq); swaps(&stuff->length); swapl(&stuff->output); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRQueryOutputProperty(ClientPtr client) { REQUEST(xRRQueryOutputPropertyReq); REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->property); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRConfigureOutputProperty(ClientPtr client) { REQUEST(xRRConfigureOutputPropertyReq); REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->property); SwapRestL(stuff); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRChangeOutputProperty(ClientPtr client) { REQUEST(xRRChangeOutputPropertyReq); REQUEST_AT_LEAST_SIZE(xRRChangeOutputPropertyReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->property); swapl(&stuff->type); swapl(&stuff->nUnits); switch (stuff->format) { case 8: break; case 16: SwapRestS(stuff); break; case 32: SwapRestL(stuff); break; default: client->errorValue = stuff->format; return BadValue; } return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRDeleteOutputProperty(ClientPtr client) { REQUEST(xRRDeleteOutputPropertyReq); REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->property); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetOutputProperty(ClientPtr client) { REQUEST(xRRGetOutputPropertyReq); REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->property); swapl(&stuff->type); swapl(&stuff->longOffset); swapl(&stuff->longLength); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRCreateMode(ClientPtr client) { xRRModeInfo *modeinfo; REQUEST(xRRCreateModeReq); REQUEST_AT_LEAST_SIZE(xRRCreateModeReq); swaps(&stuff->length); swapl(&stuff->window); modeinfo = &stuff->modeInfo; swapl(&modeinfo->id); swaps(&modeinfo->width); swaps(&modeinfo->height); swapl(&modeinfo->dotClock); swaps(&modeinfo->hSyncStart); swaps(&modeinfo->hSyncEnd); swaps(&modeinfo->hTotal); swaps(&modeinfo->vSyncStart); swaps(&modeinfo->vSyncEnd); swaps(&modeinfo->vTotal); swaps(&modeinfo->nameLength); swapl(&modeinfo->modeFlags); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRDestroyMode(ClientPtr client) { REQUEST(xRRDestroyModeReq); REQUEST_SIZE_MATCH(xRRDestroyModeReq); swaps(&stuff->length); swapl(&stuff->mode); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRAddOutputMode(ClientPtr client) { REQUEST(xRRAddOutputModeReq); REQUEST_SIZE_MATCH(xRRAddOutputModeReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->mode); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRDeleteOutputMode(ClientPtr client) { REQUEST(xRRDeleteOutputModeReq); REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq); swaps(&stuff->length); swapl(&stuff->output); swapl(&stuff->mode); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetCrtcInfo(ClientPtr client) { REQUEST(xRRGetCrtcInfoReq); REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq); swaps(&stuff->length); swapl(&stuff->crtc); swapl(&stuff->configTimestamp); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSetCrtcConfig(ClientPtr client) { REQUEST(xRRSetCrtcConfigReq); REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq); swaps(&stuff->length); swapl(&stuff->crtc); swapl(&stuff->timestamp); swapl(&stuff->configTimestamp); swaps(&stuff->x); swaps(&stuff->y); swapl(&stuff->mode); swaps(&stuff->rotation); SwapRestL(stuff); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetCrtcGammaSize(ClientPtr client) { REQUEST(xRRGetCrtcGammaSizeReq); REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq); swaps(&stuff->length); swapl(&stuff->crtc); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetCrtcGamma(ClientPtr client) { REQUEST(xRRGetCrtcGammaReq); REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq); swaps(&stuff->length); swapl(&stuff->crtc); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSetCrtcGamma(ClientPtr client) { REQUEST(xRRSetCrtcGammaReq); REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq); swaps(&stuff->length); swapl(&stuff->crtc); swaps(&stuff->size); SwapRestS(stuff); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSetCrtcTransform(ClientPtr client) { int nparams; char *filter; CARD32 *params; REQUEST(xRRSetCrtcTransformReq); REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq); swaps(&stuff->length); swapl(&stuff->crtc); SwapLongs((CARD32 *) &stuff->transform, bytes_to_int32(sizeof(xRenderTransform))); swaps(&stuff->nbytesFilter); filter = (char *) (stuff + 1); params = (CARD32 *) (filter + pad_to_int32(stuff->nbytesFilter)); nparams = ((CARD32 *) stuff + client->req_len) - params; if (nparams < 0) return BadLength; SwapLongs(params, nparams); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetCrtcTransform(ClientPtr client) { REQUEST(xRRGetCrtcTransformReq); REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq); swaps(&stuff->length); swapl(&stuff->crtc); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetPanning(ClientPtr client) { REQUEST(xRRGetPanningReq); REQUEST_SIZE_MATCH(xRRGetPanningReq); swaps(&stuff->length); swapl(&stuff->crtc); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSetPanning(ClientPtr client) { REQUEST(xRRSetPanningReq); REQUEST_SIZE_MATCH(xRRSetPanningReq); swaps(&stuff->length); swapl(&stuff->crtc); swapl(&stuff->timestamp); swaps(&stuff->left); swaps(&stuff->top); swaps(&stuff->width); swaps(&stuff->height); swaps(&stuff->track_left); swaps(&stuff->track_top); swaps(&stuff->track_width); swaps(&stuff->track_height); swaps(&stuff->border_left); swaps(&stuff->border_top); swaps(&stuff->border_right); swaps(&stuff->border_bottom); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSetOutputPrimary(ClientPtr client) { REQUEST(xRRSetOutputPrimaryReq); REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq); swaps(&stuff->length); swapl(&stuff->window); swapl(&stuff->output); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRGetOutputPrimary(ClientPtr client) { REQUEST(xRRGetOutputPrimaryReq); REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq); swaps(&stuff->length); swapl(&stuff->window); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRGetProviders(ClientPtr client) { REQUEST(xRRGetProvidersReq); REQUEST_SIZE_MATCH(xRRGetProvidersReq); swaps(&stuff->length); swapl(&stuff->window); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRGetProviderInfo(ClientPtr client) { REQUEST(xRRGetProviderInfoReq); REQUEST_SIZE_MATCH(xRRGetProviderInfoReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->configTimestamp); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRSetProviderOffloadSink(ClientPtr client) { REQUEST(xRRSetProviderOffloadSinkReq); REQUEST_SIZE_MATCH(xRRSetProviderOffloadSinkReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->sink_provider); swapl(&stuff->configTimestamp); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRSetProviderOutputSource(ClientPtr client) { REQUEST(xRRSetProviderOutputSourceReq); REQUEST_SIZE_MATCH(xRRSetProviderOutputSourceReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->source_provider); swapl(&stuff->configTimestamp); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRListProviderProperties(ClientPtr client) { REQUEST(xRRListProviderPropertiesReq); REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq); swaps(&stuff->length); swapl(&stuff->provider); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRQueryProviderProperty(ClientPtr client) { REQUEST(xRRQueryProviderPropertyReq); REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->property); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRConfigureProviderProperty(ClientPtr client) { REQUEST(xRRConfigureProviderPropertyReq); REQUEST_AT_LEAST_SIZE(xRRConfigureProviderPropertyReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->property); /* TODO: no way to specify format? */ SwapRestL(stuff); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRChangeProviderProperty(ClientPtr client) { REQUEST(xRRChangeProviderPropertyReq); REQUEST_AT_LEAST_SIZE(xRRChangeProviderPropertyReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->property); swapl(&stuff->type); swapl(&stuff->nUnits); switch (stuff->format) { case 8: break; case 16: SwapRestS(stuff); break; case 32: SwapRestL(stuff); break; } return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRDeleteProviderProperty(ClientPtr client) { REQUEST(xRRDeleteProviderPropertyReq); REQUEST_SIZE_MATCH(xRRDeleteProviderPropertyReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->property); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRGetProviderProperty(ClientPtr client) { REQUEST(xRRGetProviderPropertyReq); REQUEST_SIZE_MATCH(xRRGetProviderPropertyReq); swaps(&stuff->length); swapl(&stuff->provider); swapl(&stuff->property); swapl(&stuff->type); swapl(&stuff->longOffset); swapl(&stuff->longLength); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRGetMonitors(ClientPtr client) { REQUEST(xRRGetMonitorsReq); REQUEST_SIZE_MATCH(xRRGetMonitorsReq); swaps(&stuff->length); swapl(&stuff->window); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRSetMonitor(ClientPtr client) { REQUEST(xRRSetMonitorReq); REQUEST_AT_LEAST_SIZE(xRRGetMonitorsReq); swaps(&stuff->length); swapl(&stuff->window); swapl(&stuff->monitor.name); swaps(&stuff->monitor.noutput); swaps(&stuff->monitor.x); swaps(&stuff->monitor.y); swaps(&stuff->monitor.width); swaps(&stuff->monitor.height); SwapRestL(stuff); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRDeleteMonitor(ClientPtr client) { REQUEST(xRRDeleteMonitorReq); REQUEST_SIZE_MATCH(xRRDeleteMonitorReq); swaps(&stuff->length); swapl(&stuff->window); swapl(&stuff->name); return ProcRandrVector[stuff->randrReqType] (client); } int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = { SProcRRQueryVersion, /* 0 */ /* we skip 1 to make old clients fail pretty immediately */ NULL, /* 1 SProcRandrOldGetScreenInfo */ /* V1.0 apps share the same set screen config request id */ SProcRRSetScreenConfig, /* 2 */ NULL, /* 3 SProcRandrOldScreenChangeSelectInput */ /* 3 used to be ScreenChangeSelectInput; deprecated */ SProcRRSelectInput, /* 4 */ SProcRRGetScreenInfo, /* 5 */ /* V1.2 additions */ SProcRRGetScreenSizeRange, /* 6 */ SProcRRSetScreenSize, /* 7 */ SProcRRGetScreenResources, /* 8 */ SProcRRGetOutputInfo, /* 9 */ SProcRRListOutputProperties, /* 10 */ SProcRRQueryOutputProperty, /* 11 */ SProcRRConfigureOutputProperty, /* 12 */ SProcRRChangeOutputProperty, /* 13 */ SProcRRDeleteOutputProperty, /* 14 */ SProcRRGetOutputProperty, /* 15 */ SProcRRCreateMode, /* 16 */ SProcRRDestroyMode, /* 17 */ SProcRRAddOutputMode, /* 18 */ SProcRRDeleteOutputMode, /* 19 */ SProcRRGetCrtcInfo, /* 20 */ SProcRRSetCrtcConfig, /* 21 */ SProcRRGetCrtcGammaSize, /* 22 */ SProcRRGetCrtcGamma, /* 23 */ SProcRRSetCrtcGamma, /* 24 */ /* V1.3 additions */ SProcRRGetScreenResources, /* 25 GetScreenResourcesCurrent */ SProcRRSetCrtcTransform, /* 26 */ SProcRRGetCrtcTransform, /* 27 */ SProcRRGetPanning, /* 28 */ SProcRRSetPanning, /* 29 */ SProcRRSetOutputPrimary, /* 30 */ SProcRRGetOutputPrimary, /* 31 */ /* V1.4 additions */ SProcRRGetProviders, /* 32 */ SProcRRGetProviderInfo, /* 33 */ SProcRRSetProviderOffloadSink, /* 34 */ SProcRRSetProviderOutputSource, /* 35 */ SProcRRListProviderProperties, /* 36 */ SProcRRQueryProviderProperty, /* 37 */ SProcRRConfigureProviderProperty, /* 38 */ SProcRRChangeProviderProperty, /* 39 */ SProcRRDeleteProviderProperty, /* 40 */ SProcRRGetProviderProperty, /* 41 */ SProcRRGetMonitors, /* 42 */ SProcRRSetMonitor, /* 43 */ SProcRRDeleteMonitor, /* 44 */ }; nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rrtransform.c0000644000000000000000000002243413614532331020431 0ustar /* * Copyright © 2007 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include "randrstr.h" #include "rrtransform.h" void RRTransformInit(RRTransformPtr transform) { pixman_transform_init_identity(&transform->transform); pixman_f_transform_init_identity(&transform->f_transform); pixman_f_transform_init_identity(&transform->f_inverse); transform->filter = NULL; transform->params = NULL; transform->nparams = 0; } void RRTransformFini(RRTransformPtr transform) { free(transform->params); } Bool RRTransformEqual(RRTransformPtr a, RRTransformPtr b) { if (a && pixman_transform_is_identity(&a->transform)) a = NULL; if (b && pixman_transform_is_identity(&b->transform)) b = NULL; if (a == NULL && b == NULL) return TRUE; if (a == NULL || b == NULL) return FALSE; if (memcmp(&a->transform, &b->transform, sizeof(a->transform)) != 0) return FALSE; if (a->filter != b->filter) return FALSE; if (a->nparams != b->nparams) return FALSE; if (memcmp(a->params, b->params, a->nparams * sizeof(xFixed)) != 0) return FALSE; return TRUE; } Bool RRTransformSetFilter(RRTransformPtr dst, PictFilterPtr filter, xFixed * params, int nparams, int width, int height) { xFixed *new_params; if (nparams) { new_params = xallocarray(nparams, sizeof(xFixed)); if (!new_params) return FALSE; memcpy(new_params, params, nparams * sizeof(xFixed)); } else new_params = NULL; free(dst->params); dst->filter = filter; dst->params = new_params; dst->nparams = nparams; dst->width = width; dst->height = height; return TRUE; } Bool RRTransformCopy(RRTransformPtr dst, RRTransformPtr src) { if (src && pixman_transform_is_identity(&src->transform)) src = NULL; if (src) { if (!RRTransformSetFilter(dst, src->filter, src->params, src->nparams, src->width, src->height)) return FALSE; dst->transform = src->transform; dst->f_transform = src->f_transform; dst->f_inverse = src->f_inverse; } else { if (!RRTransformSetFilter(dst, NULL, NULL, 0, 0, 0)) return FALSE; pixman_transform_init_identity(&dst->transform); pixman_f_transform_init_identity(&dst->f_transform); pixman_f_transform_init_identity(&dst->f_inverse); } return TRUE; } #define F(x) IntToxFixed(x) static void RRTransformRescale(struct pixman_f_transform *f_transform, double limit) { double max = 0, v, scale; int i, j; for (j = 0; j < 3; j++) for (i = 0; i < 3; i++) if ((v = fabs(f_transform->m[j][i])) > max) max = v; scale = limit / max; for (j = 0; j < 3; j++) for (i = 0; i < 3; i++) f_transform->m[j][i] *= scale; } /* * Compute the complete transformation matrix including * client-specified transform, rotation/reflection values and the crtc * offset. * * Return TRUE if the resulting transform is not a simple translation. */ Bool RRTransformCompute(int x, int y, int width, int height, Rotation rotation, RRTransformPtr rr_transform, PictTransformPtr transform, struct pixman_f_transform *f_transform, struct pixman_f_transform *f_inverse) { PictTransform t_transform, inverse; struct pixman_f_transform tf_transform, tf_inverse; Bool overflow = FALSE; if (!transform) transform = &t_transform; if (!f_transform) f_transform = &tf_transform; if (!f_inverse) f_inverse = &tf_inverse; pixman_transform_init_identity(transform); pixman_transform_init_identity(&inverse); pixman_f_transform_init_identity(f_transform); pixman_f_transform_init_identity(f_inverse); if (rotation != RR_Rotate_0) { double f_rot_cos, f_rot_sin, f_rot_dx, f_rot_dy; double f_scale_x, f_scale_y, f_scale_dx, f_scale_dy; xFixed rot_cos, rot_sin, rot_dx, rot_dy; xFixed scale_x, scale_y, scale_dx, scale_dy; /* rotation */ switch (rotation & 0xf) { default: case RR_Rotate_0: f_rot_cos = 1; f_rot_sin = 0; f_rot_dx = 0; f_rot_dy = 0; rot_cos = F(1); rot_sin = F(0); rot_dx = F(0); rot_dy = F(0); break; case RR_Rotate_90: f_rot_cos = 0; f_rot_sin = 1; f_rot_dx = height; f_rot_dy = 0; rot_cos = F(0); rot_sin = F(1); rot_dx = F(height); rot_dy = F(0); break; case RR_Rotate_180: f_rot_cos = -1; f_rot_sin = 0; f_rot_dx = width; f_rot_dy = height; rot_cos = F(~0u); rot_sin = F(0); rot_dx = F(width); rot_dy = F(height); break; case RR_Rotate_270: f_rot_cos = 0; f_rot_sin = -1; f_rot_dx = 0; f_rot_dy = width; rot_cos = F(0); rot_sin = F(~0u); rot_dx = F(0); rot_dy = F(width); break; } pixman_transform_rotate(transform, &inverse, rot_cos, rot_sin); pixman_transform_translate(transform, &inverse, rot_dx, rot_dy); pixman_f_transform_rotate(f_transform, f_inverse, f_rot_cos, f_rot_sin); pixman_f_transform_translate(f_transform, f_inverse, f_rot_dx, f_rot_dy); /* reflection */ f_scale_x = 1; f_scale_dx = 0; f_scale_y = 1; f_scale_dy = 0; scale_x = F(1); scale_dx = 0; scale_y = F(1); scale_dy = 0; if (rotation & RR_Reflect_X) { f_scale_x = -1; scale_x = F(~0u); if (rotation & (RR_Rotate_0 | RR_Rotate_180)) { f_scale_dx = width; scale_dx = F(width); } else { f_scale_dx = height; scale_dx = F(height); } } if (rotation & RR_Reflect_Y) { f_scale_y = -1; scale_y = F(~0u); if (rotation & (RR_Rotate_0 | RR_Rotate_180)) { f_scale_dy = height; scale_dy = F(height); } else { f_scale_dy = width; scale_dy = F(width); } } pixman_transform_scale(transform, &inverse, scale_x, scale_y); pixman_f_transform_scale(f_transform, f_inverse, f_scale_x, f_scale_y); pixman_transform_translate(transform, &inverse, scale_dx, scale_dy); pixman_f_transform_translate(f_transform, f_inverse, f_scale_dx, f_scale_dy); } #ifdef RANDR_12_INTERFACE if (rr_transform) { if (!pixman_transform_multiply (transform, &rr_transform->transform, transform)) overflow = TRUE; pixman_f_transform_multiply(f_transform, &rr_transform->f_transform, f_transform); pixman_f_transform_multiply(f_inverse, f_inverse, &rr_transform->f_inverse); } #endif /* * Compute the class of the resulting transform */ if (!overflow && pixman_transform_is_identity(transform)) { pixman_transform_init_translate(transform, F(x), F(y)); pixman_f_transform_init_translate(f_transform, x, y); pixman_f_transform_init_translate(f_inverse, -x, -y); return FALSE; } else { pixman_f_transform_translate(f_transform, f_inverse, x, y); if (!pixman_transform_translate(transform, &inverse, F(x), F(y))) overflow = TRUE; if (overflow) { struct pixman_f_transform f_scaled; f_scaled = *f_transform; RRTransformRescale(&f_scaled, 16384.0); pixman_transform_from_pixman_f_transform(transform, &f_scaled); } return TRUE; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rrtransform.h0000644000000000000000000000524513614532331020437 0ustar /* * Copyright © 2007 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _RRTRANSFORM_H_ #define _RRTRANSFORM_H_ #include #include "picturestr.h" typedef struct _rrTransform RRTransformRec, *RRTransformPtr; struct _rrTransform { PictTransform transform; struct pict_f_transform f_transform; struct pict_f_transform f_inverse; PictFilterPtr filter; xFixed *params; int nparams; int width; int height; }; extern _X_EXPORT void RRTransformInit(RRTransformPtr transform); extern _X_EXPORT void RRTransformFini(RRTransformPtr transform); extern _X_EXPORT Bool RRTransformEqual(RRTransformPtr a, RRTransformPtr b); extern _X_EXPORT Bool RRTransformSetFilter(RRTransformPtr dst, PictFilterPtr filter, xFixed * params, int nparams, int width, int height); extern _X_EXPORT Bool RRTransformCopy(RRTransformPtr dst, RRTransformPtr src); /* * Compute the complete transformation matrix including * client-specified transform, rotation/reflection values and the crtc * offset. * * Return TRUE if the resulting transform is not a simple translation. */ extern _X_EXPORT Bool RRTransformCompute(int x, int y, int width, int height, Rotation rotation, RRTransformPtr rr_transform, PictTransformPtr transform, struct pict_f_transform *f_transform, struct pict_f_transform *f_inverse); #endif /* _RRTRANSFORM_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/randr/rrxinerama.c0000644000000000000000000003637413614532331020232 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* * Copyright © 2006 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * This Xinerama implementation comes from the SiS driver which has * the following notice: */ /* * SiS driver main code * * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2) Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3) The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Author: Thomas Winischhofer * - driver entirely rewritten since 2001, only basic structure taken from * old code (except sis_dri.c, sis_shadow.c, sis_accel.c and parts of * sis_dga.c; these were mostly taken over; sis_dri.c was changed for * new versions of the DRI layer) * * This notice covers the entire driver code unless indicated otherwise. * * Formerly based on code which was * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England. * Written by: * Alan Hourihane , * Mike Chapman , * Juanjo Santamarta , * Mitani Hiroshi , * David Thomas . */ #include "randrstr.h" #include "swaprep.h" #include "panoramiXproto.h" #include "protocol-versions.h" /* Xinerama is not multi-screen capable; just report about screen 0 */ #define RR_XINERAMA_SCREEN 0 static int ProcRRXineramaQueryVersion(ClientPtr client); static int ProcRRXineramaGetState(ClientPtr client); static int ProcRRXineramaGetScreenCount(ClientPtr client); static int ProcRRXineramaGetScreenSize(ClientPtr client); static int ProcRRXineramaIsActive(ClientPtr client); static int ProcRRXineramaQueryScreens(ClientPtr client); static int SProcRRXineramaDispatch(ClientPtr client); extern Bool noRRXineramaExtension; /* Proc */ int ProcRRXineramaQueryVersion(ClientPtr client) { xPanoramiXQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION, .minorVersion = SERVER_RRXINERAMA_MINOR_VERSION }; REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.majorVersion); swaps(&rep.minorVersion); } WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), &rep); return Success; } int ProcRRXineramaGetState(ClientPtr client) { REQUEST(xPanoramiXGetStateReq); WindowPtr pWin; xPanoramiXGetStateReply rep; register int rc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; Bool active = FALSE; REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); #ifndef NXAGENT_SERVER rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); #else pWin = SecurityLookupWindow(stuff->window, client, DixReadAccess); rc = pWin ? Success : BadWindow; #endif if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); if (pScrPriv) { /* XXX do we need more than this? */ active = TRUE; } rep = (xPanoramiXGetStateReply) { .type = X_Reply, .state = active, .sequenceNumber = client->sequence, .length = 0, .window = stuff->window }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.window); } WriteToClient(client, sizeof(xPanoramiXGetStateReply), &rep); return Success; } static int RRXineramaScreenCount(ScreenPtr pScreen) { return RRMonitorCountList(pScreen); } static Bool RRXineramaScreenActive(ScreenPtr pScreen) { return RRXineramaScreenCount(pScreen) > 0; } int ProcRRXineramaGetScreenCount(ClientPtr client) { REQUEST(xPanoramiXGetScreenCountReq); WindowPtr pWin; xPanoramiXGetScreenCountReply rep; register int rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); #ifndef NXAGENT_SERVER rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); #else pWin = SecurityLookupWindow(stuff->window, client, DixReadAccess); rc = pWin ? Success : BadWindow; #endif if (rc != Success) return rc; rep = (xPanoramiXGetScreenCountReply) { .type = X_Reply, .ScreenCount = RRXineramaScreenCount(pWin->drawable.pScreen), .sequenceNumber = client->sequence, .length = 0, .window = stuff->window }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.window); } WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), &rep); return Success; } int ProcRRXineramaGetScreenSize(ClientPtr client) { REQUEST(xPanoramiXGetScreenSizeReq); WindowPtr pWin, pRoot; ScreenPtr pScreen; xPanoramiXGetScreenSizeReply rep; register int rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); #ifndef NXAGENT_SERVER rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); #else pWin = SecurityLookupWindow(stuff->window, client, DixReadAccess); rc = pWin ? Success : BadWindow; #endif if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pRoot = pScreen->root; rep = (xPanoramiXGetScreenSizeReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .width = pRoot->drawable.width, .height = pRoot->drawable.height, .window = stuff->window, .screen = stuff->screen }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.width); swapl(&rep.height); swapl(&rep.window); swapl(&rep.screen); } WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), &rep); return Success; } int ProcRRXineramaIsActive(ClientPtr client) { xXineramaIsActiveReply rep; REQUEST_SIZE_MATCH(xXineramaIsActiveReq); rep = (xXineramaIsActiveReply) { .type = X_Reply, .length = 0, .sequenceNumber = client->sequence, .state = RRXineramaScreenActive(screenInfo.screens[RR_XINERAMA_SCREEN]) }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.state); } WriteToClient(client, sizeof(xXineramaIsActiveReply), &rep); return Success; } static void RRXineramaWriteMonitor(ClientPtr client, RRMonitorPtr monitor) { xXineramaScreenInfo scratch; scratch.x_org = monitor->geometry.box.x1; scratch.y_org = monitor->geometry.box.y1; scratch.width = monitor->geometry.box.x2 - monitor->geometry.box.x1; scratch.height = monitor->geometry.box.y2 - monitor->geometry.box.y1; if (client->swapped) { swaps(&scratch.x_org); swaps(&scratch.y_org); swaps(&scratch.width); swaps(&scratch.height); } WriteToClient(client, sz_XineramaScreenInfo, &scratch); } int ProcRRXineramaQueryScreens(ClientPtr client) { xXineramaQueryScreensReply rep; ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN]; int m; RRMonitorPtr monitors = NULL; int nmonitors = 0; REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); if (RRXineramaScreenActive(pScreen)) { RRGetInfo(pScreen, FALSE); if (!RRMonitorMakeList(pScreen, TRUE, &monitors, &nmonitors)) return BadAlloc; } rep = (xXineramaQueryScreensReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(nmonitors * sz_XineramaScreenInfo), .number = nmonitors }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.number); } WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep); for (m = 0; m < nmonitors; m++) RRXineramaWriteMonitor(client, &monitors[m]); if (monitors) RRMonitorFreeList(monitors, nmonitors); return Success; } static int ProcRRXineramaDispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_PanoramiXQueryVersion: return ProcRRXineramaQueryVersion(client); case X_PanoramiXGetState: return ProcRRXineramaGetState(client); case X_PanoramiXGetScreenCount: return ProcRRXineramaGetScreenCount(client); case X_PanoramiXGetScreenSize: return ProcRRXineramaGetScreenSize(client); case X_XineramaIsActive: return ProcRRXineramaIsActive(client); case X_XineramaQueryScreens: return ProcRRXineramaQueryScreens(client); } return BadRequest; } /* SProc */ static int SProcRRXineramaQueryVersion(ClientPtr client) { REQUEST(xPanoramiXQueryVersionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); return ProcRRXineramaQueryVersion(client); } static int SProcRRXineramaGetState(ClientPtr client) { REQUEST(xPanoramiXGetStateReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); swapl(&stuff->window); return ProcRRXineramaGetState(client); } static int SProcRRXineramaGetScreenCount(ClientPtr client) { REQUEST(xPanoramiXGetScreenCountReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); swapl(&stuff->window); return ProcRRXineramaGetScreenCount(client); } static int SProcRRXineramaGetScreenSize(ClientPtr client) { REQUEST(xPanoramiXGetScreenSizeReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); swapl(&stuff->window); swapl(&stuff->screen); return ProcRRXineramaGetScreenSize(client); } static int SProcRRXineramaIsActive(ClientPtr client) { REQUEST(xXineramaIsActiveReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXineramaIsActiveReq); return ProcRRXineramaIsActive(client); } static int SProcRRXineramaQueryScreens(ClientPtr client) { REQUEST(xXineramaQueryScreensReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); return ProcRRXineramaQueryScreens(client); } int SProcRRXineramaDispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_PanoramiXQueryVersion: return SProcRRXineramaQueryVersion(client); case X_PanoramiXGetState: return SProcRRXineramaGetState(client); case X_PanoramiXGetScreenCount: return SProcRRXineramaGetScreenCount(client); case X_PanoramiXGetScreenSize: return SProcRRXineramaGetScreenSize(client); case X_XineramaIsActive: return SProcRRXineramaIsActive(client); case X_XineramaQueryScreens: return SProcRRXineramaQueryScreens(client); } return BadRequest; } void RRXineramaExtensionInit(void) { #ifdef PANORAMIX if (!noPanoramiXExtension) return; #endif if (noRRXineramaExtension) return; /* * Xinerama isn't capable enough to have multiple protocol screens each * with their own output geometry. So if there's more than one protocol * screen, just don't even try. */ if (screenInfo.numScreens > 1) return; (void) AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0, ProcRRXineramaDispatch, SProcRRXineramaDispatch, NULL, StandardMinorOpcode); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/record/Imakefile0000644000000000000000000000107113614532331017661 0ustar NULL = #include SRCS = record.c set.c OBJS = record.o set.o INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/Xext `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln #if defined(NXAgentServer) && NXAgentServer NX_DEFINES = -DNXAGENT_SERVER #endif DEFINES = \ -DNDEBUG \ $(NX_DEFINES) \ $(NULL) NormalLibraryObjectRule() NormalLibraryTarget(record,$(OBJS)) LintLibraryTarget(record,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() nx-libs-3.5.99.23/nx-X11/programs/Xserver/record/record.c0000644000000000000000000025364413614532331017511 0ustar /* Copyright 1995, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Author: David P. Wiggins, The Open Group This work benefited from earlier work done by Martha Zimet of NCD and Jim Haggerty of Metheus. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "dixstruct.h" #include "extnsionst.h" #define _XRECORD_SERVER_ #include #include "set.h" #include "swaprep.h" #include #include #ifdef PANORAMIX #include "globals.h" #include "panoramiX.h" #include "panoramiXsrv.h" #include "cursor.h" #endif #include "protocol-versions.h" static RESTYPE RTContext; /* internal resource type for Record contexts */ static int RecordErrorBase; /* first Record error number */ /* How many bytes of protocol data to buffer in a context. Don't set to less * than 32. */ #define REPLY_BUF_SIZE 1024 /* Record Context structure */ typedef struct { XID id; /* resource id of context */ ClientPtr pRecordingClient; /* client that has context enabled */ struct _RecordClientsAndProtocolRec *pListOfRCAP; /* all registered info */ ClientPtr pBufClient; /* client whose protocol is in replyBuffer*/ unsigned int continuedReply:1; /* recording a reply that is split up? */ char elemHeaders; /* element header flags (time/seq no.) */ char bufCategory; /* category of protocol in replyBuffer */ int numBufBytes; /* number of bytes in replyBuffer */ char replyBuffer[REPLY_BUF_SIZE]; /* buffered recorded protocol */ int inFlush; /* are we inside RecordFlushReplyBuffer */ } RecordContextRec, *RecordContextPtr; /* RecordMinorOpRec - to hold minor opcode selections for extension requests * and replies */ typedef union { int count; /* first element of array: how many "major" structs to follow */ struct { /* rest of array elements are this */ short first; /* first major opcode */ short last; /* last major opcode */ RecordSetPtr pMinOpSet; /* minor opcode set for above major range */ } major; } RecordMinorOpRec, *RecordMinorOpPtr; /* RecordClientsAndProtocolRec, nicknamed RCAP - holds all the client and * protocol selections passed in a single CreateContext or RegisterClients. * Generally, a context will have one of these from the create and an * additional one for each RegisterClients. RCAPs are freed when all their * clients are unregistered. */ typedef struct _RecordClientsAndProtocolRec { RecordContextPtr pContext; /* context that owns this RCAP */ struct _RecordClientsAndProtocolRec *pNextRCAP; /* next RCAP on context */ RecordSetPtr pRequestMajorOpSet; /* requests to record */ RecordMinorOpPtr pRequestMinOpInfo; /* extension requests to record */ RecordSetPtr pReplyMajorOpSet; /* replies to record */ RecordMinorOpPtr pReplyMinOpInfo; /* extension replies to record */ RecordSetPtr pDeviceEventSet; /* device events to record */ RecordSetPtr pDeliveredEventSet; /* delivered events to record */ RecordSetPtr pErrorSet; /* errors to record */ XID * pClientIDs; /* array of clients to record */ short numClients; /* number of clients in pClientIDs */ short sizeClients; /* size of pClientIDs array */ unsigned int clientStarted:1; /* record new client connections? */ unsigned int clientDied:1; /* record client disconnections? */ unsigned int clientIDsSeparatelyAllocated:1; /* pClientIDs malloced? */ } RecordClientsAndProtocolRec, *RecordClientsAndProtocolPtr; /* how much bigger to make pRCAP->pClientIDs when reallocing */ #define CLIENT_ARRAY_GROWTH_INCREMENT 4 /* counts the total number of RCAPs belonging to enabled contexts. */ static int numEnabledRCAPs; /* void VERIFY_CONTEXT(RecordContextPtr, XID, ClientPtr) * In the spirit of the VERIFY_* macros in dix.h, this macro fills in * the context pointer if the given ID is a valid Record Context, else it * returns an error. */ #define VERIFY_CONTEXT(_pContext, _contextid, _client) { \ (_pContext) = (RecordContextPtr)LookupIDByType((_contextid), RTContext); \ if (!(_pContext)) { \ (_client)->errorValue = (_contextid); \ return RecordErrorBase + XRecordBadContext; \ } \ } static int RecordDeleteContext( void * /*value*/, XID /*id*/ ); /***************************************************************************/ /* client private stuff */ /* To make declarations less obfuscated, have a typedef for a pointer to a * Proc function. */ typedef int (*ProcFunctionPtr)( ClientPtr /*pClient*/ ); /* Record client private. Generally a client only has one of these if * any of its requests are being recorded. */ typedef struct { /* ptr to client's proc vector before Record stuck its nose in */ ProcFunctionPtr *originalVector; /* proc vector with pointers for recorded requests redirected to the * function RecordARequest */ ProcFunctionPtr recordVector[256]; } RecordClientPrivateRec, *RecordClientPrivatePtr; static int RecordClientPrivateIndex; /* RecordClientPrivatePtr RecordClientPrivate(ClientPtr) * gets the client private of the given client. Syntactic sugar. */ #define RecordClientPrivate(_pClient) (RecordClientPrivatePtr) \ ((_pClient)->devPrivates[RecordClientPrivateIndex].ptr) /***************************************************************************/ /* global list of all contexts */ static RecordContextPtr *ppAllContexts; static int numContexts;/* number of contexts in ppAllContexts */ /* number of currently enabled contexts. All enabled contexts are bunched * up at the front of the ppAllContexts array, from ppAllContexts[0] to * ppAllContexts[numEnabledContexts-1], to eliminate time spent skipping * past disabled contexts. */ static int numEnabledContexts; /* RecordFindContextOnAllContexts * * Arguments: * pContext is the context to search for. * * Returns: * The index into the array ppAllContexts at which pContext is stored. * If pContext is not found in ppAllContexts, returns -1. * * Side Effects: none. */ static int RecordFindContextOnAllContexts(RecordContextPtr pContext) { int i; assert(numContexts >= numEnabledContexts); for (i = 0; i < numContexts; i++) { if (ppAllContexts[i] == pContext) return i; } return -1; } /* RecordFindContextOnAllContexts */ /***************************************************************************/ /* RecordFlushReplyBuffer * * Arguments: * pContext is the context to flush. * data1 is a pointer to additional data, and len1 is its length in bytes. * data2 is a pointer to additional data, and len2 is its length in bytes. * * Returns: nothing. * * Side Effects: * If the context is enabled, any buffered (recorded) protocol is written * to the recording client, and the number of buffered bytes is set to * zero. If len1 is not zero, data1/len1 are then written to the * recording client, and similarly for data2/len2 (written after * data1/len1). */ static void RecordFlushReplyBuffer( RecordContextPtr pContext, void * data1, int len1, void * data2, int len2 ) { if (!pContext->pRecordingClient || pContext->pRecordingClient->clientGone || pContext->inFlush) return; ++pContext->inFlush; if (pContext->numBufBytes) WriteToClient(pContext->pRecordingClient, pContext->numBufBytes, (char *)pContext->replyBuffer); pContext->numBufBytes = 0; if (len1) WriteToClient(pContext->pRecordingClient, len1, data1); if (len2) WriteToClient(pContext->pRecordingClient, len2, data2); --pContext->inFlush; } /* RecordFlushReplyBuffer */ /* RecordAProtocolElement * * Arguments: * pContext is the context that is recording a protocol element. * pClient is the client whose protocol is being recorded. For * device events and EndOfData, pClient is NULL. * category is the category of the protocol element, as defined * by the RECORD spec. * data is a pointer to the protocol data, and datalen is its length * in bytes. * futurelen is the number of bytes that will be sent in subsequent * calls to this function to complete this protocol element. * In those subsequent calls, futurelen will be -1 to indicate * that the current data is a continuation of the same protocol * element. * * Returns: nothing. * * Side Effects: * The context may be flushed. The new protocol element will be * added to the context's protocol buffer with appropriate element * headers prepended (sequence number and timestamp). If the data * is continuation data (futurelen == -1), element headers won't * be added. If the protocol element and headers won't fit in * the context's buffer, it is sent directly to the recording * client (after any buffered data). */ static void RecordAProtocolElement(RecordContextPtr pContext, ClientPtr pClient, int category, void * data, int datalen, int futurelen) { CARD32 elemHeaderData[2]; int numElemHeaders = 0; Bool recordingClientSwapped = pContext->pRecordingClient->swapped; CARD32 serverTime = 0; Bool gotServerTime = FALSE; int replylen; if (futurelen >= 0) { /* start of new protocol element */ xRecordEnableContextReply *pRep = (xRecordEnableContextReply *) pContext->replyBuffer; if (pContext->pBufClient != pClient || pContext->bufCategory != category) { RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0); pContext->pBufClient = pClient; pContext->bufCategory = category; } if (!pContext->numBufBytes) { serverTime = GetTimeInMillis(); gotServerTime = TRUE; pRep->type = X_Reply; pRep->category = category; pRep->sequenceNumber = pContext->pRecordingClient->sequence; pRep->length = 0; pRep->elementHeader = pContext->elemHeaders; pRep->serverTime = serverTime; if (pClient) { pRep->clientSwapped = (pClient->swapped != recordingClientSwapped); pRep->idBase = pClient->clientAsMask; pRep->recordedSequenceNumber = pClient->sequence; } else /* it's a device event, StartOfData, or EndOfData */ { pRep->clientSwapped = (category != XRecordFromServer) && recordingClientSwapped; pRep->idBase = 0; pRep->recordedSequenceNumber = 0; } if (recordingClientSwapped) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); swapl(&pRep->idBase); swapl(&pRep->serverTime); swapl(&pRep->recordedSequenceNumber); } pContext->numBufBytes = SIZEOF(xRecordEnableContextReply); } /* generate element headers if needed */ if ( ( (pContext->elemHeaders & XRecordFromClientTime) && category == XRecordFromClient) || ( (pContext->elemHeaders & XRecordFromServerTime) && category == XRecordFromServer)) { if (gotServerTime) elemHeaderData[numElemHeaders] = serverTime; else elemHeaderData[numElemHeaders] = GetTimeInMillis(); if (recordingClientSwapped) swapl(&elemHeaderData[numElemHeaders]); numElemHeaders++; } if ( (pContext->elemHeaders & XRecordFromClientSequence) && (category == XRecordFromClient || category == XRecordClientDied)) { elemHeaderData[numElemHeaders] = pClient->sequence; if (recordingClientSwapped) swapl(&elemHeaderData[numElemHeaders]); numElemHeaders++; } /* adjust reply length */ replylen = pRep->length; if (recordingClientSwapped) swapl(&replylen); replylen += numElemHeaders + (datalen >> 2) + (futurelen >> 2); if (recordingClientSwapped) swapl(&replylen); pRep->length = replylen; } /* end if not continued reply */ numElemHeaders *= 4; /* if space available >= space needed, buffer the data */ if (REPLY_BUF_SIZE - pContext->numBufBytes >= datalen + numElemHeaders) { if (numElemHeaders) { memcpy(pContext->replyBuffer + pContext->numBufBytes, elemHeaderData, numElemHeaders); pContext->numBufBytes += numElemHeaders; } if (datalen) { memcpy(pContext->replyBuffer + pContext->numBufBytes, data, datalen); pContext->numBufBytes += datalen; } } else RecordFlushReplyBuffer(pContext, (void *)elemHeaderData, numElemHeaders, (void *)data, datalen); } /* RecordAProtocolElement */ /* RecordFindClientOnContext * * Arguments: * pContext is the context to search. * clientspec is the resource ID mask identifying the client to search * for, or XRecordFutureClients. * pposition is a pointer to an int, or NULL. See Returns. * * Returns: * The RCAP on which clientspec was found, or NULL if not found on * any RCAP on the given context. * If pposition was not NULL and the returned RCAP is not NULL, * *pposition will be set to the index into the returned the RCAP's * pClientIDs array that holds clientspec. * * Side Effects: none. */ static RecordClientsAndProtocolPtr RecordFindClientOnContext( RecordContextPtr pContext, XID clientspec, int *pposition ) { RecordClientsAndProtocolPtr pRCAP; for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP) { int i; for (i = 0; i < pRCAP->numClients; i++) { if (pRCAP->pClientIDs[i] == clientspec) { if (pposition) *pposition = i; return pRCAP; } } } return NULL; } /* RecordFindClientOnContext */ /* RecordABigRequest * * Arguments: * pContext is the recording context. * client is the client being recorded. * stuff is a pointer to the big request of client (see the Big Requests * extension for details.) * * Returns: nothing. * * Side Effects: * The big request is recorded with the correct length field re-inserted. * * Note: this function exists mainly to make RecordARequest smaller. */ static void RecordABigRequest(RecordContextPtr pContext, ClientPtr client, xReq *stuff) { CARD32 bigLength; int bytesLeft; /* note: client->req_len has been frobbed by ReadRequestFromClient * (os/io.c) to discount the extra 4 bytes taken by the extended length * field in a big request. The actual request length to record is * client->req_len + 1 (measured in CARD32s). */ /* record the request header */ bytesLeft = client->req_len << 2; RecordAProtocolElement(pContext, client, XRecordFromClient, (void *)stuff, SIZEOF(xReq), bytesLeft); /* reinsert the extended length field that was squished out */ bigLength = client->req_len + (sizeof(bigLength) >> 2); if (client->swapped) swapl(&bigLength); RecordAProtocolElement(pContext, client, XRecordFromClient, (void *)&bigLength, sizeof(bigLength), /* continuation */ -1); bytesLeft -= sizeof(bigLength); /* record the rest of the request after the length */ RecordAProtocolElement(pContext, client, XRecordFromClient, (void *)(stuff + 1), bytesLeft, /* continuation */ -1); } /* RecordABigRequest */ /* RecordARequest * * Arguments: * client is a client that the server has dispatched a request to by * calling client->requestVector[request opcode] . * The request is in client->requestBuffer. * * Returns: * Whatever is returned by the "real" Proc function for this request. * The "real" Proc function is the function that was in * client->requestVector[request opcode] before it was replaced by * RecordARequest. (See the function RecordInstallHooks.) * * Side Effects: * The request is recorded by all contexts that have registered this * request for this client. The real Proc function is called. */ static int RecordARequest(ClientPtr client) { RecordContextPtr pContext; RecordClientsAndProtocolPtr pRCAP; int i; RecordClientPrivatePtr pClientPriv; REQUEST(xReq); int majorop; majorop = stuff->reqType; for (i = 0; i < numEnabledContexts; i++) { pContext = ppAllContexts[i]; pRCAP = RecordFindClientOnContext(pContext, client->clientAsMask, NULL); if (pRCAP && pRCAP->pRequestMajorOpSet && RecordIsMemberOfSet(pRCAP->pRequestMajorOpSet, majorop)) { if (majorop <= 127) { /* core request */ if (stuff->length == 0) RecordABigRequest(pContext, client, stuff); else RecordAProtocolElement(pContext, client, XRecordFromClient, (void *)stuff, client->req_len << 2, 0); } else /* extension, check minor opcode */ { int minorop = MinorOpcodeOfRequest(client); int numMinOpInfo; RecordMinorOpPtr pMinorOpInfo = pRCAP->pRequestMinOpInfo; assert (pMinorOpInfo); numMinOpInfo = pMinorOpInfo->count; pMinorOpInfo++; assert (numMinOpInfo); for ( ; numMinOpInfo; numMinOpInfo--, pMinorOpInfo++) { if (majorop >= pMinorOpInfo->major.first && majorop <= pMinorOpInfo->major.last && RecordIsMemberOfSet(pMinorOpInfo->major.pMinOpSet, minorop)) { if (stuff->length == 0) RecordABigRequest(pContext, client, stuff); else RecordAProtocolElement(pContext, client, XRecordFromClient, (void *)stuff, client->req_len << 2, 0); break; } } /* end for each minor op info */ } /* end extension request */ } /* end this RCAP wants this major opcode */ } /* end for each context */ pClientPriv = RecordClientPrivate(client); assert(pClientPriv); return (* pClientPriv->originalVector[majorop])(client); } /* RecordARequest */ /* RecordASkippedRequest * * Arguments: * pcbl is &SkippedRequestCallback. * nulldata is NULL. * calldata is a pointer to a SkippedRequestInfoRec (include/os.h) * which provides information about requests that the server is * skipping. The client's proc vector won't be called for skipped * requests, so that's why we have to catch them here. * * Returns: nothing. * * Side Effects: * The skipped requests are recorded by all contexts that have * registered those requests for this client. * * Note: most servers don't skip requests, so calls to this will probably * be rare. For more information on skipped requests, search for * the word skip in ddx.tbl.ms (the porting layer document). */ static void RecordASkippedRequest(CallbackListPtr *pcbl, void * nulldata, void * calldata) { SkippedRequestInfoRec *psi = (SkippedRequestInfoRec *)calldata; RecordContextPtr pContext; RecordClientsAndProtocolPtr pRCAP; xReqPtr stuff = psi->req; ClientPtr client = psi->client; int numSkippedRequests = psi->numskipped; int reqlen; int i; int majorop; while (numSkippedRequests--) { majorop = stuff->reqType; reqlen = ReqLen(stuff, client); /* handle big request */ if (stuff->length == 0) reqlen += 4; for (i = 0; i < numEnabledContexts; i++) { pContext = ppAllContexts[i]; pRCAP = RecordFindClientOnContext(pContext, client->clientAsMask, NULL); if (pRCAP && pRCAP->pRequestMajorOpSet && RecordIsMemberOfSet(pRCAP->pRequestMajorOpSet, majorop)) { if (majorop <= 127) { /* core request */ RecordAProtocolElement(pContext, client, XRecordFromClient, (void *)stuff, reqlen, 0); } else /* extension, check minor opcode */ { int minorop = MinorOpcodeOfRequest(client); int numMinOpInfo; RecordMinorOpPtr pMinorOpInfo = pRCAP->pRequestMinOpInfo; assert (pMinorOpInfo); numMinOpInfo = pMinorOpInfo->count; pMinorOpInfo++; assert (numMinOpInfo); for ( ; numMinOpInfo; numMinOpInfo--, pMinorOpInfo++) { if (majorop >= pMinorOpInfo->major.first && majorop <= pMinorOpInfo->major.last && RecordIsMemberOfSet(pMinorOpInfo->major.pMinOpSet, minorop)) { RecordAProtocolElement(pContext, client, XRecordFromClient, (void *)stuff, reqlen, 0); break; } } /* end for each minor op info */ } /* end extension request */ } /* end this RCAP wants this major opcode */ } /* end for each context */ /* go to next request */ stuff = (xReqPtr)( ((char *)stuff) + reqlen); } /* end for each skipped request */ } /* RecordASkippedRequest */ /* RecordAReply * * Arguments: * pcbl is &ReplyCallback. * nulldata is NULL. * calldata is a pointer to a ReplyInfoRec (include/os.h) * which provides information about replies that are being sent * to clients. * * Returns: nothing. * * Side Effects: * The reply is recorded by all contexts that have registered this * reply type for this client. If more data belonging to the same * reply is expected, and if the reply is being recorded by any * context, pContext->continuedReply is set to 1. * If pContext->continuedReply was already 1 and this is the last * chunk of data belonging to this reply, it is set to 0. */ static void RecordAReply(CallbackListPtr *pcbl, void * nulldata, void * calldata) { RecordContextPtr pContext; RecordClientsAndProtocolPtr pRCAP; int eci; int majorop; ReplyInfoRec *pri = (ReplyInfoRec *)calldata; ClientPtr client = pri->client; REQUEST(xReq); majorop = stuff->reqType; for (eci = 0; eci < numEnabledContexts; eci++) { pContext = ppAllContexts[eci]; pRCAP = RecordFindClientOnContext(pContext, client->clientAsMask, NULL); if (pRCAP) { if (pContext->continuedReply) { RecordAProtocolElement(pContext, client, XRecordFromServer, (void *)pri->replyData, pri->dataLenBytes, /* continuation */ -1); if (!pri->bytesRemaining) pContext->continuedReply = 0; } else if (pri->startOfReply && pRCAP->pReplyMajorOpSet && RecordIsMemberOfSet(pRCAP->pReplyMajorOpSet, majorop)) { if (majorop <= 127) { /* core reply */ RecordAProtocolElement(pContext, client, XRecordFromServer, (void *)pri->replyData, pri->dataLenBytes, pri->bytesRemaining); if (pri->bytesRemaining) pContext->continuedReply = 1; } else /* extension, check minor opcode */ { int minorop = MinorOpcodeOfRequest(client); int numMinOpInfo; RecordMinorOpPtr pMinorOpInfo = pRCAP->pReplyMinOpInfo; assert (pMinorOpInfo); numMinOpInfo = pMinorOpInfo->count; pMinorOpInfo++; assert (numMinOpInfo); for ( ; numMinOpInfo; numMinOpInfo--, pMinorOpInfo++) { if (majorop >= pMinorOpInfo->major.first && majorop <= pMinorOpInfo->major.last && RecordIsMemberOfSet(pMinorOpInfo->major.pMinOpSet, minorop)) { RecordAProtocolElement(pContext, client, XRecordFromServer, (void *)pri->replyData, pri->dataLenBytes, pri->bytesRemaining); if (pri->bytesRemaining) pContext->continuedReply = 1; break; } } /* end for each minor op info */ } /* end extension reply */ } /* end continued reply vs. start of reply */ } /* end client is registered on this context */ } /* end for each context */ } /* RecordAReply */ /* RecordADeliveredEventOrError * * Arguments: * pcbl is &EventCallback. * nulldata is NULL. * calldata is a pointer to a EventInfoRec (include/dix.h) * which provides information about events that are being sent * to clients. * * Returns: nothing. * * Side Effects: * The event or error is recorded by all contexts that have registered * it for this client. */ static void RecordADeliveredEventOrError(CallbackListPtr *pcbl, void * nulldata, void * calldata) { EventInfoRec *pei = (EventInfoRec *)calldata; RecordContextPtr pContext; RecordClientsAndProtocolPtr pRCAP; int eci; /* enabled context index */ ClientPtr pClient = pei->client; for (eci = 0; eci < numEnabledContexts; eci++) { pContext = ppAllContexts[eci]; pRCAP = RecordFindClientOnContext(pContext, pClient->clientAsMask, NULL); if (pRCAP && (pRCAP->pDeliveredEventSet || pRCAP->pErrorSet)) { int ev; /* event index */ xEvent *pev = pei->events; for (ev = 0; ev < pei->count; ev++, pev++) { int recordit = 0; if (pRCAP->pErrorSet) { recordit = RecordIsMemberOfSet(pRCAP->pErrorSet, ((xError *)(pev))->errorCode); } else if (pRCAP->pDeliveredEventSet) { recordit = RecordIsMemberOfSet(pRCAP->pDeliveredEventSet, pev->u.u.type & 0177); } if (recordit) { xEvent swappedEvent; xEvent *pEvToRecord = pev; if (pClient->swapped) { (*EventSwapVector[pev->u.u.type & 0177]) (pev, &swappedEvent); pEvToRecord = &swappedEvent; } RecordAProtocolElement(pContext, pClient, XRecordFromServer, pEvToRecord, SIZEOF(xEvent), 0); } } /* end for each event */ } /* end this client is on this context */ } /* end for each enabled context */ } /* RecordADeliveredEventOrError */ /* RecordADeviceEvent * * Arguments: * pcbl is &DeviceEventCallback. * nulldata is NULL. * calldata is a pointer to a DeviceEventInfoRec (include/dix.h) * which provides information about device events that occur. * * Returns: nothing. * * Side Effects: * The device event is recorded by all contexts that have registered * it for this client. */ static void RecordADeviceEvent(CallbackListPtr *pcbl, void * nulldata, void * calldata) { DeviceEventInfoRec *pei = (DeviceEventInfoRec *)calldata; RecordContextPtr pContext; RecordClientsAndProtocolPtr pRCAP; int eci; /* enabled context index */ for (eci = 0; eci < numEnabledContexts; eci++) { pContext = ppAllContexts[eci]; for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP) { if (pRCAP->pDeviceEventSet) { int ev; /* event index */ xEvent *pev = pei->events; for (ev = 0; ev < pei->count; ev++, pev++) { if (RecordIsMemberOfSet(pRCAP->pDeviceEventSet, pev->u.u.type & 0177)) { xEvent swappedEvent; xEvent *pEvToRecord = pev; #ifdef PANORAMIX xEvent shiftedEvent; if (!noPanoramiXExtension && (pev->u.u.type == MotionNotify || pev->u.u.type == ButtonPress || pev->u.u.type == ButtonRelease || pev->u.u.type == KeyPress || pev->u.u.type == KeyRelease)) { int scr = XineramaGetCursorScreen(); memcpy(&shiftedEvent, pev, sizeof(xEvent)); shiftedEvent.u.keyButtonPointer.rootX += panoramiXdataPtr[scr].x - panoramiXdataPtr[0].x; shiftedEvent.u.keyButtonPointer.rootY += panoramiXdataPtr[scr].y - panoramiXdataPtr[0].y; pEvToRecord = &shiftedEvent; } #endif /* PANORAMIX */ if (pContext->pRecordingClient->swapped) { (*EventSwapVector[pEvToRecord->u.u.type & 0177]) (pEvToRecord, &swappedEvent); pEvToRecord = &swappedEvent; } RecordAProtocolElement(pContext, NULL, XRecordFromServer, pEvToRecord, SIZEOF(xEvent), 0); /* make sure device events get flushed in the absence * of other client activity */ SetCriticalOutputPending(); } } /* end for each event */ } /* end this RCAP selects device events */ } /* end for each RCAP on this context */ } /* end for each enabled context */ } /* RecordADeviceEvent */ /* RecordFlushAllContexts * * Arguments: * pcbl is &FlushCallback. * nulldata and calldata are NULL. * * Returns: nothing. * * Side Effects: * All buffered reply data of all enabled contexts is written to * the recording clients. */ static void RecordFlushAllContexts( CallbackListPtr *pcbl, void * nulldata, void * calldata ) { int eci; /* enabled context index */ RecordContextPtr pContext; for (eci = 0; eci < numEnabledContexts; eci++) { pContext = ppAllContexts[eci]; /* In most cases we leave it to RecordFlushReplyBuffer to make * this check, but this function could be called very often, so we * check before calling hoping to save the function call cost * most of the time. */ if (pContext->numBufBytes) RecordFlushReplyBuffer(ppAllContexts[eci], NULL, 0, NULL, 0); } } /* RecordFlushAllContexts */ /* RecordInstallHooks * * Arguments: * pRCAP is an RCAP on an enabled or being-enabled context. * oneclient can be zero or the resource ID mask identifying a client. * * Returns: BadAlloc if a memory allocation error occurred, else Success. * * Side Effects: * Recording hooks needed by RCAP are installed. * If oneclient is zero, recording hooks needed for all clients and * protocol on the RCAP are installed. If oneclient is non-zero, * only those hooks needed for the specified client are installed. * * Client requestVectors may be altered. numEnabledRCAPs will be * incremented if oneclient == 0. Callbacks may be added to * various callback lists. */ static int RecordInstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient) { int i = 0; XID client; if (oneclient) client = oneclient; else client = pRCAP->numClients ? pRCAP->pClientIDs[i++] : 0; while (client) { if (client != XRecordFutureClients) { if (pRCAP->pRequestMajorOpSet) { RecordSetIteratePtr pIter = NULL; RecordSetInterval interval; ClientPtr pClient = clients[CLIENT_ID(client)]; if (pClient && !RecordClientPrivate(pClient)) { RecordClientPrivatePtr pClientPriv; /* no Record proc vector; allocate one */ pClientPriv = (RecordClientPrivatePtr) malloc(sizeof(RecordClientPrivateRec)); if (!pClientPriv) return BadAlloc; /* copy old proc vector to new */ memcpy(pClientPriv->recordVector, pClient->requestVector, sizeof (pClientPriv->recordVector)); pClientPriv->originalVector = pClient->requestVector; pClient->devPrivates[RecordClientPrivateIndex].ptr = (void *)pClientPriv; pClient->requestVector = pClientPriv->recordVector; } while ((pIter = RecordIterateSet(pRCAP->pRequestMajorOpSet, pIter, &interval))) { unsigned int j; for (j = interval.first; j <= interval.last; j++) pClient->requestVector[j] = RecordARequest; } } } if (oneclient) client = 0; else client = (i < pRCAP->numClients) ? pRCAP->pClientIDs[i++] : 0; } assert(numEnabledRCAPs >= 0); if (!oneclient && ++numEnabledRCAPs == 1) { /* we're enabling the first context */ if (!AddCallback(&EventCallback, RecordADeliveredEventOrError, NULL)) return BadAlloc; if (!AddCallback(&DeviceEventCallback, RecordADeviceEvent, NULL)) return BadAlloc; if (!AddCallback(&ReplyCallback, RecordAReply, NULL)) return BadAlloc; if (!AddCallback(&SkippedRequestsCallback, RecordASkippedRequest, NULL)) return BadAlloc; if (!AddCallback(&FlushCallback, RecordFlushAllContexts, NULL)) return BadAlloc; /* Alternate context flushing scheme: delete the line above * and call RegisterBlockAndWakeupHandlers here passing * RecordFlushAllContexts. Is this any better? */ } return Success; } /* RecordInstallHooks */ /* RecordUninstallHooks * * Arguments: * pRCAP is an RCAP on an enabled or being-disabled context. * oneclient can be zero or the resource ID mask identifying a client. * * Returns: nothing. * * Side Effects: * Recording hooks needed by RCAP may be uninstalled. * If oneclient is zero, recording hooks needed for all clients and * protocol on the RCAP may be uninstalled. If oneclient is non-zero, * only those hooks needed for the specified client may be uninstalled. * * Client requestVectors may be altered. numEnabledRCAPs will be * decremented if oneclient == 0. Callbacks may be deleted from * various callback lists. */ static void RecordUninstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient) { int i = 0; XID client; if (oneclient) client = oneclient; else client = pRCAP->numClients ? pRCAP->pClientIDs[i++] : 0; while (client) { if (client != XRecordFutureClients) { if (pRCAP->pRequestMajorOpSet) { ClientPtr pClient = clients[CLIENT_ID(client)]; int c; Bool otherRCAPwantsProcVector = FALSE; RecordClientPrivatePtr pClientPriv = RecordClientPrivate(pClient); assert (pClient && RecordClientPrivate(pClient)); memcpy(pClientPriv->recordVector, pClientPriv->originalVector, sizeof (pClientPriv->recordVector)); for (c = 0; c < numEnabledContexts; c++) { RecordClientsAndProtocolPtr pOtherRCAP; RecordContextPtr pContext = ppAllContexts[c]; if (pContext == pRCAP->pContext) continue; pOtherRCAP = RecordFindClientOnContext(pContext, client, NULL); if (pOtherRCAP && pOtherRCAP->pRequestMajorOpSet) { RecordSetIteratePtr pIter = NULL; RecordSetInterval interval; otherRCAPwantsProcVector = TRUE; while ((pIter = RecordIterateSet( pOtherRCAP->pRequestMajorOpSet, pIter, &interval))) { unsigned int j; for (j = interval.first; j <= interval.last; j++) pClient->requestVector[j] = RecordARequest; } } } if (!otherRCAPwantsProcVector) { /* nobody needs it, so free it */ pClient->requestVector = pClientPriv->originalVector; pClient->devPrivates[RecordClientPrivateIndex].ptr = NULL; free(pClientPriv); } } /* end if this RCAP specifies any requests */ } /* end if not future clients */ if (oneclient) client = 0; else client = (i < pRCAP->numClients) ? pRCAP->pClientIDs[i++] : 0; } assert(numEnabledRCAPs >= 1); if (!oneclient && --numEnabledRCAPs == 0) { /* we're disabling the last context */ DeleteCallback(&EventCallback, RecordADeliveredEventOrError, NULL); DeleteCallback(&DeviceEventCallback, RecordADeviceEvent, NULL); DeleteCallback(&ReplyCallback, RecordAReply, NULL); DeleteCallback(&SkippedRequestsCallback, RecordASkippedRequest, NULL); DeleteCallback(&FlushCallback, RecordFlushAllContexts, NULL); /* Alternate context flushing scheme: delete the line above * and call RemoveBlockAndWakeupHandlers here passing * RecordFlushAllContexts. Is this any better? */ /* Having deleted the callback, call it one last time. -gildea */ RecordFlushAllContexts(&FlushCallback, NULL, NULL); } } /* RecordUninstallHooks */ /* RecordDeleteClientFromRCAP * * Arguments: * pRCAP is an RCAP to delete the client from. * position is the index into the array pRCAP->pClientIDs of the * client to delete. * * Returns: nothing. * * Side Effects: * Recording hooks needed by client will be uninstalled if the context * is enabled. The designated client will be removed from the * pRCAP->pClientIDs array. If it was the only client on the RCAP, * the RCAP is removed from the context and freed. (Invariant: RCAPs * have at least one client.) */ static void RecordDeleteClientFromRCAP(RecordClientsAndProtocolPtr pRCAP, int position) { if (pRCAP->pContext->pRecordingClient) RecordUninstallHooks(pRCAP, pRCAP->pClientIDs[position]); if (position != pRCAP->numClients - 1) pRCAP->pClientIDs[position] = pRCAP->pClientIDs[pRCAP->numClients - 1]; if (--pRCAP->numClients == 0) { /* no more clients; remove RCAP from context's list */ RecordContextPtr pContext = pRCAP->pContext; if (pContext->pRecordingClient) RecordUninstallHooks(pRCAP, 0); if (pContext->pListOfRCAP == pRCAP) pContext->pListOfRCAP = pRCAP->pNextRCAP; else { RecordClientsAndProtocolPtr prevRCAP; for (prevRCAP = pContext->pListOfRCAP; prevRCAP->pNextRCAP != pRCAP; prevRCAP = prevRCAP->pNextRCAP) ; prevRCAP->pNextRCAP = pRCAP->pNextRCAP; } /* free the RCAP */ if (pRCAP->clientIDsSeparatelyAllocated) free(pRCAP->pClientIDs); free(pRCAP); } } /* RecordDeleteClientFromRCAP */ /* RecordAddClientToRCAP * * Arguments: * pRCAP is an RCAP to add the client to. * clientspec is the resource ID mask identifying a client, or * XRecordFutureClients. * * Returns: nothing. * * Side Effects: * Recording hooks needed by client will be installed if the context * is enabled. The designated client will be added to the * pRCAP->pClientIDs array, which may be realloced. * pRCAP->clientIDsSeparatelyAllocated may be set to 1 if there * is no more room to hold clients internal to the RCAP. */ static void RecordAddClientToRCAP(RecordClientsAndProtocolPtr pRCAP, XID clientspec) { if (pRCAP->numClients == pRCAP->sizeClients) { if (pRCAP->clientIDsSeparatelyAllocated) { XID *pNewIDs = (XID *)realloc(pRCAP->pClientIDs, (pRCAP->sizeClients + CLIENT_ARRAY_GROWTH_INCREMENT) * sizeof(XID)); if (!pNewIDs) return; pRCAP->pClientIDs = pNewIDs; pRCAP->sizeClients += CLIENT_ARRAY_GROWTH_INCREMENT; } else { XID *pNewIDs = (XID *)malloc((pRCAP->sizeClients + CLIENT_ARRAY_GROWTH_INCREMENT) * sizeof(XID)); if (!pNewIDs) return; memcpy(pNewIDs, pRCAP->pClientIDs, pRCAP->numClients *sizeof(XID)); pRCAP->pClientIDs = pNewIDs; pRCAP->sizeClients += CLIENT_ARRAY_GROWTH_INCREMENT; pRCAP->clientIDsSeparatelyAllocated = 1; } } pRCAP->pClientIDs[pRCAP->numClients++] = clientspec; if (pRCAP->pContext->pRecordingClient) RecordInstallHooks(pRCAP, clientspec); } /* RecordDeleteClientFromRCAP */ /* RecordDeleteClientFromContext * * Arguments: * pContext is the context to delete from. * clientspec is the resource ID mask identifying a client, or * XRecordFutureClients. * * Returns: nothing. * * Side Effects: * If clientspec is on any RCAP of the context, it is deleted from that * RCAP. (A given clientspec can only be on one RCAP of a context.) */ static void RecordDeleteClientFromContext(RecordContextPtr pContext, XID clientspec) { RecordClientsAndProtocolPtr pRCAP; int position; if ((pRCAP = RecordFindClientOnContext(pContext, clientspec, &position))) RecordDeleteClientFromRCAP(pRCAP, position); } /* RecordDeleteClientFromContext */ /* RecordSanityCheckClientSpecifiers * * Arguments: * clientspecs is an array of alleged CLIENTSPECs passed by the client. * nspecs is the number of elements in clientspecs. * errorspec, if non-zero, is the resource id base of a client that * must not appear in clienspecs. * * Returns: BadMatch if any of the clientspecs are invalid, else Success. * * Side Effects: none. */ static int RecordSanityCheckClientSpecifiers(XID *clientspecs, int nspecs, XID errorspec) { int i; int clientIndex; for (i = 0; i < nspecs; i++) { if (clientspecs[i] == XRecordCurrentClients || clientspecs[i] == XRecordFutureClients || clientspecs[i] == XRecordAllClients) continue; if (errorspec && (CLIENT_BITS(clientspecs[i]) == errorspec) ) return BadMatch; clientIndex = CLIENT_ID(clientspecs[i]); if (clientIndex && clients[clientIndex] && clients[clientIndex]->clientState == ClientStateRunning) { if (clientspecs[i] == clients[clientIndex]->clientAsMask) continue; if (!LookupIDByClass(clientspecs[i], RC_ANY)) return BadMatch; } else return BadMatch; } return Success; } /* RecordSanityCheckClientSpecifiers */ /* RecordCanonicalizeClientSpecifiers * * Arguments: * pClientspecs is an array of CLIENTSPECs that have been sanity * checked. * pNumClientspecs is a pointer to the number of elements in pClientspecs. * excludespec, if non-zero, is the resource id base of a client that * should not be included in the expansion of XRecordAllClients or * XRecordCurrentClients. * * Returns: * A pointer to an array of CLIENTSPECs that is the same as the * passed array with the following modifications: * - all but the client id bits of resource IDs are stripped off. * - duplicates removed. * - XRecordAllClients expanded to a list of all currently connected * clients + XRecordFutureClients - excludespec (if non-zero) * - XRecordCurrentClients expanded to a list of all currently * connected clients - excludespec (if non-zero) * The returned array may be the passed array modified in place, or * it may be an malloc'ed array. The caller should keep a pointer to the * original array and free the returned array if it is different. * * *pNumClientspecs is set to the number of elements in the returned * array. * * Side Effects: * pClientspecs may be modified in place. */ static XID * RecordCanonicalizeClientSpecifiers(XID *pClientspecs, int *pNumClientspecs, XID excludespec) { int i; int numClients = *pNumClientspecs; /* first pass strips off the resource index bits, leaving just the * client id bits. This makes searching for a particular client simpler * (and faster.) */ for (i = 0; i < numClients; i++) { XID cs = pClientspecs[i]; if (cs > XRecordAllClients) pClientspecs[i] = CLIENT_BITS(cs); } for (i = 0; i < numClients; i++) { if (pClientspecs[i] == XRecordAllClients || pClientspecs[i] == XRecordCurrentClients) { /* expand All/Current */ int j, nc; XID *pCanon = (XID *)malloc(sizeof(XID) * (currentMaxClients + 1)); if (!pCanon) return NULL; for (nc = 0, j = 1; j < currentMaxClients; j++) { ClientPtr client = clients[j]; if (client != NullClient && client->clientState == ClientStateRunning && client->clientAsMask != excludespec) { pCanon[nc++] = client->clientAsMask; } } if (pClientspecs[i] == XRecordAllClients) pCanon[nc++] = XRecordFutureClients; *pNumClientspecs = nc; return pCanon; } else /* not All or Current */ { int j; for (j = i + 1; j < numClients; ) { if (pClientspecs[i] == pClientspecs[j]) { pClientspecs[j] = pClientspecs[--numClients]; } else j++; } } } /* end for each clientspec */ *pNumClientspecs = numClients; return pClientspecs; } /* RecordCanonicalizeClientSpecifiers */ /****************************************************************************/ /* stuff for RegisterClients */ /* RecordPadAlign * * Arguments: * size is the number of bytes taken by an object. * align is a byte boundary (e.g. 4, 8) * * Returns: * the number of pad bytes to add at the end of an object of the * given size so that an object placed immediately behind it will * begin on an -byte boundary. * * Side Effects: none. */ static int RecordPadAlign(int size, int align) { return (align - (size & (align - 1))) & (align - 1); } /* RecordPadAlign */ /* RecordSanityCheckRegisterClients * * Arguments: * pContext is the context being registered on. * client is the client that issued a RecordCreateContext or * RecordRegisterClients request. * stuff is a pointer to the request. * * Returns: * Any one of several possible error values if any of the request * arguments are invalid. Success if everything is OK. * * Side Effects: none. */ static int RecordSanityCheckRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegisterClientsReq *stuff) { int err; xRecordRange *pRange; int i; XID recordingClient; if (((client->req_len << 2) - SIZEOF(xRecordRegisterClientsReq)) != 4 * stuff->nClients + SIZEOF(xRecordRange) * stuff->nRanges) return BadLength; if (stuff->elementHeader & ~(XRecordFromClientSequence|XRecordFromClientTime|XRecordFromServerTime)) { client->errorValue = stuff->elementHeader; return BadValue; } recordingClient = pContext->pRecordingClient ? pContext->pRecordingClient->clientAsMask : 0; err = RecordSanityCheckClientSpecifiers((XID *)&stuff[1], stuff->nClients, recordingClient); if (err != Success) return err; pRange = (xRecordRange *)(((XID *)&stuff[1]) + stuff->nClients); for (i = 0; i < stuff->nRanges; i++, pRange++) { if (pRange->coreRequestsFirst > pRange->coreRequestsLast) { client->errorValue = pRange->coreRequestsFirst; return BadValue; } if (pRange->coreRepliesFirst > pRange->coreRepliesLast) { client->errorValue = pRange->coreRepliesFirst; return BadValue; } if ((pRange->extRequestsMajorFirst || pRange->extRequestsMajorLast) && (pRange->extRequestsMajorFirst < 128 || pRange->extRequestsMajorLast < 128 || pRange->extRequestsMajorFirst > pRange->extRequestsMajorLast)) { client->errorValue = pRange->extRequestsMajorFirst; return BadValue; } if (pRange->extRequestsMinorFirst > pRange->extRequestsMinorLast) { client->errorValue = pRange->extRequestsMinorFirst; return BadValue; } if ((pRange->extRepliesMajorFirst || pRange->extRepliesMajorLast) && (pRange->extRepliesMajorFirst < 128 || pRange->extRepliesMajorLast < 128 || pRange->extRepliesMajorFirst > pRange->extRepliesMajorLast)) { client->errorValue = pRange->extRepliesMajorFirst; return BadValue; } if (pRange->extRepliesMinorFirst > pRange->extRepliesMinorLast) { client->errorValue = pRange->extRepliesMinorFirst; return BadValue; } if ((pRange->deliveredEventsFirst || pRange->deliveredEventsLast) && (pRange->deliveredEventsFirst < 2 || pRange->deliveredEventsLast < 2 || pRange->deliveredEventsFirst > pRange->deliveredEventsLast)) { client->errorValue = pRange->deliveredEventsFirst; return BadValue; } if ((pRange->deviceEventsFirst || pRange->deviceEventsLast) && (pRange->deviceEventsFirst < 2 || pRange->deviceEventsLast < 2 || pRange->deviceEventsFirst > pRange->deviceEventsLast)) { client->errorValue = pRange->deviceEventsFirst; return BadValue; } if (pRange->errorsFirst > pRange->errorsLast) { client->errorValue = pRange->errorsFirst; return BadValue; } if (pRange->clientStarted != xFalse && pRange->clientStarted != xTrue) { client->errorValue = pRange->clientStarted; return BadValue; } if (pRange->clientDied != xFalse && pRange->clientDied != xTrue) { client->errorValue = pRange->clientDied; return BadValue; } } /* end for each range */ return Success; } /* end RecordSanityCheckRegisterClients */ /* This is a tactical structure used to gather information about all the sets * (RecordSetPtr) that need to be created for an RCAP in the process of * digesting a list of RECORDRANGEs (converting it to the internal * representation). */ typedef struct { int nintervals; /* number of intervals in following array */ RecordSetInterval *intervals; /* array of intervals for this set */ int size; /* size of intevals array; >= nintervals */ int align; /* alignment restriction for set */ int offset; /* where to store set pointer rel. to start of RCAP */ short first, last; /* if for extension, major opcode interval */ } SetInfoRec, *SetInfoPtr; /* These constant are used to index into an array of SetInfoRec. */ enum {REQ, /* set info for requests */ REP, /* set info for replies */ ERR, /* set info for errors */ DEV, /* set info for device events */ DLEV, /* set info for delivered events */ PREDEFSETS}; /* number of predefined array entries */ /* RecordAllocIntervals * * Arguments: * psi is a pointer to a SetInfoRec whose intervals pointer is NULL. * nIntervals is the desired size of the intervals array. * * Returns: BadAlloc if a memory allocation error occurred, else Success. * * Side Effects: * If Success is returned, psi->intervals is a pointer to size * RecordSetIntervals, all zeroed, and psi->size is set to size. */ static int RecordAllocIntervals(SetInfoPtr psi, int nIntervals) { assert(!psi->intervals); psi->intervals = (RecordSetInterval *) malloc(nIntervals * sizeof(RecordSetInterval)); if (!psi->intervals) return BadAlloc; bzero(psi->intervals, nIntervals * sizeof(RecordSetInterval)); psi->size = nIntervals; return Success; } /* end RecordAllocIntervals */ /* RecordConvertRangesToIntervals * * Arguments: * psi is a pointer to the SetInfoRec we are building. * pRanges is an array of xRecordRanges. * nRanges is the number of elements in pRanges. * byteoffset is the offset from the start of an xRecordRange of the * two bytes (1 for first, 1 for last) we are interested in. * pExtSetInfo, if non-NULL, indicates that the two bytes mentioned * above are followed by four bytes (2 for first, 2 for last) * representing a minor opcode range, and this information should be * stored in one of the SetInfoRecs starting at pExtSetInfo. * pnExtSetInfo is the number of elements in the pExtSetInfo array. * * Returns: BadAlloc if a memory allocation error occurred, else Success. * * Side Effects: * The slice of pRanges indicated by byteoffset is stored in psi. * If pExtSetInfo is non-NULL, minor opcode intervals are stored * in an existing SetInfoRec if the major opcode interval matches, else * they are stored in a new SetInfoRec, and *pnExtSetInfo is * increased accordingly. */ static int RecordConvertRangesToIntervals( SetInfoPtr psi, xRecordRange *pRanges, int nRanges, int byteoffset, SetInfoPtr pExtSetInfo, int *pnExtSetInfo ) { int i; CARD8 *pCARD8; int first, last; int err; for (i = 0; i < nRanges; i++, pRanges++) { pCARD8 = ((CARD8 *)pRanges) + byteoffset; first = pCARD8[0]; last = pCARD8[1]; if (first || last) { if (!psi->intervals) { err = RecordAllocIntervals(psi, 2 * (nRanges - i)); if (err != Success) return err; } psi->intervals[psi->nintervals].first = first; psi->intervals[psi->nintervals].last = last; psi->nintervals++; assert(psi->nintervals <= psi->size); if (pExtSetInfo) { SetInfoPtr pesi = pExtSetInfo; CARD16 *pCARD16 = (CARD16 *)(pCARD8 + 2); int j; for (j = 0; j < *pnExtSetInfo; j++, pesi++) { if ( (first == pesi->first) && (last == pesi->last) ) break; } if (j == *pnExtSetInfo) { err = RecordAllocIntervals(pesi, 2 * (nRanges - i)); if (err != Success) return err; pesi->first = first; pesi->last = last; (*pnExtSetInfo)++; } pesi->intervals[pesi->nintervals].first = pCARD16[0]; pesi->intervals[pesi->nintervals].last = pCARD16[1]; pesi->nintervals++; assert(pesi->nintervals <= pesi->size); } } } return Success; } /* end RecordConvertRangesToIntervals */ #define offset_of(_structure, _field) \ ((char *)(& (_structure . _field)) - (char *)(&_structure)) /* RecordRegisterClients * * Arguments: * pContext is the context on which to register the clients. * client is the client that issued the RecordCreateContext or * RecordRegisterClients request. * stuff is a pointer to the request. * * Returns: * Any one of several possible error values defined by the protocol. * Success if everything is OK. * * Side Effects: * If different element headers are specified, the context is flushed. * If any of the specified clients are already registered on the * context, they are first unregistered. A new RCAP is created to * hold the specified protocol and clients, and it is linked onto the * context. If the context is enabled, appropriate hooks are installed * to record the new clients and protocol. */ static int RecordRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegisterClientsReq *stuff) { int err; int i; SetInfoPtr si; int maxSets; int nExtReqSets = 0; int nExtRepSets = 0; int extReqSetsOffset = 0; int extRepSetsOffset = 0; SetInfoPtr pExtReqSets, pExtRepSets; int clientListOffset; XID *pCanonClients; int clientStarted = 0, clientDied = 0; xRecordRange *pRanges, rr; int nClients; int sizeClients; int totRCAPsize; RecordClientsAndProtocolPtr pRCAP; int pad; XID recordingClient; /* do all sanity checking up front */ err = RecordSanityCheckRegisterClients(pContext, client, stuff); if (err != Success) return err; /* if element headers changed, flush buffer */ if (pContext->elemHeaders != stuff->elementHeader) { RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0); pContext->elemHeaders = stuff->elementHeader; } nClients = stuff->nClients; if (!nClients) /* if empty clients list, we're done. */ return Success; recordingClient = pContext->pRecordingClient ? pContext->pRecordingClient->clientAsMask : 0; pCanonClients = RecordCanonicalizeClientSpecifiers((XID *)&stuff[1], &nClients, recordingClient); if (!pCanonClients) return BadAlloc; /* We may have to create as many as one set for each "predefined" * protocol types, plus one per range for extension reuests, plus one per * range for extension replies. */ maxSets = PREDEFSETS + 2 * stuff->nRanges; si = (SetInfoPtr)malloc(sizeof(SetInfoRec) * maxSets); if (!si) { err = BadAlloc; goto bailout; } bzero(si, sizeof(SetInfoRec) * maxSets); /* theoretically you must do this because NULL may not be all-bits-zero */ for (i = 0; i < maxSets; i++) si[i].intervals = NULL; pExtReqSets = si + PREDEFSETS; pExtRepSets = pExtReqSets + stuff->nRanges; pRanges = (xRecordRange *)(((XID *)&stuff[1]) + stuff->nClients); err = RecordConvertRangesToIntervals(&si[REQ], pRanges, stuff->nRanges, offset_of(rr, coreRequestsFirst), NULL, NULL); if (err != Success) goto bailout; err = RecordConvertRangesToIntervals(&si[REQ], pRanges, stuff->nRanges, offset_of(rr, extRequestsMajorFirst), pExtReqSets, &nExtReqSets); if (err != Success) goto bailout; err = RecordConvertRangesToIntervals(&si[REP], pRanges, stuff->nRanges, offset_of(rr, coreRepliesFirst), NULL, NULL); if (err != Success) goto bailout; err = RecordConvertRangesToIntervals(&si[REP], pRanges, stuff->nRanges, offset_of(rr, extRepliesMajorFirst), pExtRepSets, &nExtRepSets); if (err != Success) goto bailout; err = RecordConvertRangesToIntervals(&si[ERR], pRanges, stuff->nRanges, offset_of(rr, errorsFirst), NULL, NULL); if (err != Success) goto bailout; err = RecordConvertRangesToIntervals(&si[DLEV], pRanges, stuff->nRanges, offset_of(rr, deliveredEventsFirst), NULL, NULL); if (err != Success) goto bailout; err = RecordConvertRangesToIntervals(&si[DEV], pRanges, stuff->nRanges, offset_of(rr, deviceEventsFirst), NULL, NULL); if (err != Success) goto bailout; /* collect client-started and client-died */ for (i = 0; i < stuff->nRanges; i++) { if (pRanges[i].clientStarted) clientStarted = TRUE; if (pRanges[i].clientDied) clientDied = TRUE; } /* We now have all the information collected to create all the sets, * and we can compute the total memory required for the RCAP. */ totRCAPsize = sizeof(RecordClientsAndProtocolRec); /* leave a little room to grow before forcing a separate allocation */ sizeClients = nClients + CLIENT_ARRAY_GROWTH_INCREMENT; pad = RecordPadAlign(totRCAPsize, sizeof(XID)); clientListOffset = totRCAPsize + pad; totRCAPsize += pad + sizeClients * sizeof(XID); if (nExtReqSets) { pad = RecordPadAlign(totRCAPsize, sizeof(RecordSetPtr)); extReqSetsOffset = totRCAPsize + pad; totRCAPsize += pad + (nExtReqSets + 1) * sizeof(RecordMinorOpRec); } if (nExtRepSets) { pad = RecordPadAlign(totRCAPsize, sizeof(RecordSetPtr)); extRepSetsOffset = totRCAPsize + pad; totRCAPsize += pad + (nExtRepSets + 1) * sizeof(RecordMinorOpRec); } for (i = 0; i < maxSets; i++) { if (si[i].nintervals) { si[i].size = RecordSetMemoryRequirements( si[i].intervals, si[i].nintervals, &si[i].align); pad = RecordPadAlign(totRCAPsize, si[i].align); si[i].offset = pad + totRCAPsize; totRCAPsize += pad + si[i].size; } } /* allocate memory for the whole RCAP */ pRCAP = (RecordClientsAndProtocolPtr)malloc(totRCAPsize); if (!pRCAP) { err = BadAlloc; goto bailout; } /* fill in the RCAP */ pRCAP->pContext = pContext; pRCAP->pClientIDs = (XID *)((char *)pRCAP + clientListOffset); pRCAP->numClients = nClients; pRCAP->sizeClients = sizeClients; pRCAP->clientIDsSeparatelyAllocated = 0; for (i = 0; i < nClients; i++) { RecordDeleteClientFromContext(pContext, pCanonClients[i]); pRCAP->pClientIDs[i] = pCanonClients[i]; } /* create all the sets */ if (si[REQ].intervals) { pRCAP->pRequestMajorOpSet = RecordCreateSet(si[REQ].intervals, si[REQ].nintervals, (RecordSetPtr)((char *)pRCAP + si[REQ].offset), si[REQ].size); } else pRCAP->pRequestMajorOpSet = NULL; if (si[REP].intervals) { pRCAP->pReplyMajorOpSet = RecordCreateSet(si[REP].intervals, si[REP].nintervals, (RecordSetPtr)((char *)pRCAP + si[REP].offset), si[REP].size); } else pRCAP->pReplyMajorOpSet = NULL; if (si[ERR].intervals) { pRCAP->pErrorSet = RecordCreateSet(si[ERR].intervals, si[ERR].nintervals, (RecordSetPtr)((char *)pRCAP + si[ERR].offset), si[ERR].size); } else pRCAP->pErrorSet = NULL; if (si[DEV].intervals) { pRCAP->pDeviceEventSet = RecordCreateSet(si[DEV].intervals, si[DEV].nintervals, (RecordSetPtr)((char *)pRCAP + si[DEV].offset), si[DEV].size); } else pRCAP->pDeviceEventSet = NULL; if (si[DLEV].intervals) { pRCAP->pDeliveredEventSet = RecordCreateSet(si[DLEV].intervals, si[DLEV].nintervals, (RecordSetPtr)((char *)pRCAP + si[DLEV].offset), si[DLEV].size); } else pRCAP->pDeliveredEventSet = NULL; if (nExtReqSets) { pRCAP->pRequestMinOpInfo = (RecordMinorOpPtr) ((char *)pRCAP + extReqSetsOffset); pRCAP->pRequestMinOpInfo[0].count = nExtReqSets; for (i = 0; i < nExtReqSets; i++, pExtReqSets++) { pRCAP->pRequestMinOpInfo[i+1].major.first = pExtReqSets->first; pRCAP->pRequestMinOpInfo[i+1].major.last = pExtReqSets->last; pRCAP->pRequestMinOpInfo[i+1].major.pMinOpSet = RecordCreateSet(pExtReqSets->intervals, pExtReqSets->nintervals, (RecordSetPtr)((char *)pRCAP + pExtReqSets->offset), pExtReqSets->size); } } else pRCAP->pRequestMinOpInfo = NULL; if (nExtRepSets) { pRCAP->pReplyMinOpInfo = (RecordMinorOpPtr) ((char *)pRCAP + extRepSetsOffset); pRCAP->pReplyMinOpInfo[0].count = nExtRepSets; for (i = 0; i < nExtRepSets; i++, pExtRepSets++) { pRCAP->pReplyMinOpInfo[i+1].major.first = pExtRepSets->first; pRCAP->pReplyMinOpInfo[i+1].major.last = pExtRepSets->last; pRCAP->pReplyMinOpInfo[i+1].major.pMinOpSet = RecordCreateSet(pExtRepSets->intervals, pExtRepSets->nintervals, (RecordSetPtr)((char *)pRCAP + pExtRepSets->offset), pExtRepSets->size); } } else pRCAP->pReplyMinOpInfo = NULL; pRCAP->clientStarted = clientStarted; pRCAP->clientDied = clientDied; /* link the RCAP onto the context */ pRCAP->pNextRCAP = pContext->pListOfRCAP; pContext->pListOfRCAP = pRCAP; if (pContext->pRecordingClient) /* context enabled */ RecordInstallHooks(pRCAP, 0); bailout: if (si) { for (i = 0; i < maxSets; i++) if (si[i].intervals) free(si[i].intervals); free(si); } if (pCanonClients && pCanonClients != (XID *)&stuff[1]) free(pCanonClients); return err; } /* RecordRegisterClients */ /* Proc functions all take a client argument, execute the request in * client->requestBuffer, and return a protocol error status. */ static int ProcRecordQueryVersion(ClientPtr client) { /* REQUEST(xRecordQueryVersionReq); */ xRecordQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .majorVersion = SERVER_RECORD_MAJOR_VERSION, .minorVersion = SERVER_RECORD_MINOR_VERSION }; REQUEST_SIZE_MATCH(xRecordQueryVersionReq); if(client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.majorVersion); swaps(&rep.minorVersion); } WriteToClient(client, sizeof(xRecordQueryVersionReply), &rep); return (client->noClientException); } /* ProcRecordQueryVersion */ static int ProcRecordCreateContext(ClientPtr client) { REQUEST(xRecordCreateContextReq); RecordContextPtr pContext; RecordContextPtr *ppNewAllContexts = NULL; int err = BadAlloc; REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq); LEGAL_NEW_RESOURCE(stuff->context, client); pContext = (RecordContextPtr)malloc(sizeof(RecordContextRec)); if (!pContext) goto bailout; /* make sure there is room in ppAllContexts to store the new context */ ppNewAllContexts = (RecordContextPtr *) realloc(ppAllContexts, sizeof(RecordContextPtr) * (numContexts + 1)); if (!ppNewAllContexts) goto bailout; ppAllContexts = ppNewAllContexts; pContext->id = stuff->context; pContext->pRecordingClient = NULL; pContext->pListOfRCAP = NULL; pContext->elemHeaders = 0; pContext->bufCategory = 0; pContext->numBufBytes = 0; pContext->pBufClient = NULL; pContext->continuedReply = 0; pContext->inFlush = 0; err = RecordRegisterClients(pContext, client, (xRecordRegisterClientsReq *)stuff); if (err != Success) goto bailout; if (AddResource(pContext->id, RTContext, pContext)) { ppAllContexts[numContexts++] = pContext; return Success; } else { RecordDeleteContext((void *)pContext, pContext->id); err = BadAlloc; } bailout: if (pContext) free(pContext); return err; } /* ProcRecordCreateContext */ static int ProcRecordRegisterClients(ClientPtr client) { RecordContextPtr pContext; REQUEST(xRecordRegisterClientsReq); REQUEST_AT_LEAST_SIZE(xRecordRegisterClientsReq); VERIFY_CONTEXT(pContext, stuff->context, client); return RecordRegisterClients(pContext, client, stuff); } /* ProcRecordRegisterClients */ static int ProcRecordUnregisterClients(ClientPtr client) { RecordContextPtr pContext; int err; REQUEST(xRecordUnregisterClientsReq); XID *pCanonClients; int nClients; int i; REQUEST_AT_LEAST_SIZE(xRecordUnregisterClientsReq); if ((client->req_len << 2) - SIZEOF(xRecordUnregisterClientsReq) != 4 * stuff->nClients) return BadLength; VERIFY_CONTEXT(pContext, stuff->context, client); err = RecordSanityCheckClientSpecifiers((XID *)&stuff[1], stuff->nClients, 0); if (err != Success) return err; nClients = stuff->nClients; pCanonClients = RecordCanonicalizeClientSpecifiers((XID *)&stuff[1], &nClients, 0); if (!pCanonClients) return BadAlloc; for (i = 0; i < nClients; i++) { RecordDeleteClientFromContext(pContext, pCanonClients[i]); } if (pCanonClients != (XID *)&stuff[1]) free(pCanonClients); return Success; } /* ProcRecordUnregisterClients */ /****************************************************************************/ /* stuff for GetContext */ /* This is a tactical structure used to hold the xRecordRanges as they are * being reconstituted from the sets in the RCAPs. */ typedef struct { xRecordRange *pRanges; /* array of xRecordRanges for one RCAP */ int size; /* number of elements in pRanges, >= nRanges */ int nRanges; /* number of occupied element of pRanges */ } GetContextRangeInfoRec, *GetContextRangeInfoPtr; /* RecordAllocRanges * * Arguments: * pri is a pointer to a GetContextRangeInfoRec to allocate for. * nRanges is the number of xRecordRanges desired for pri. * * Returns: BadAlloc if a memory allocation error occurred, else Success. * * Side Effects: * If Success is returned, pri->pRanges points to at least nRanges * ranges. pri->nRanges is set to nRanges. pri->size is the actual * number of ranges. Newly allocated ranges are zeroed. */ static int RecordAllocRanges(GetContextRangeInfoPtr pri, int nRanges) { int newsize; xRecordRange *pNewRange; #define SZINCR 8 newsize = max(pri->size + SZINCR, nRanges); pNewRange = (xRecordRange *)realloc(pri->pRanges, newsize * sizeof(xRecordRange)); if (!pNewRange) return BadAlloc; pri->pRanges = pNewRange; pri->size = newsize; bzero(&pri->pRanges[pri->size - SZINCR], SZINCR * sizeof(xRecordRange)); if (pri->nRanges < nRanges) pri->nRanges = nRanges; return Success; } /* RecordAllocRanges */ /* RecordConvertSetToRanges * * Arguments: * pSet is the set to be converted. * pri is where the result should be stored. * byteoffset is the offset from the start of an xRecordRange of the * two vales (first, last) we are interested in. * card8 is TRUE if the vales are one byte each and FALSE if two bytes * each. * imax is the largest set value to store in pri->pRanges. * pStartIndex, if non-NULL, is the index of the first range in * pri->pRanges that should be stored to. If NULL, * start at index 0. * * Returns: BadAlloc if a memory allocation error occurred, else Success. * * Side Effects: * If Success is returned, the slice of pri->pRanges indicated by * byteoffset and card8 is filled in with the intervals from pSet. * if pStartIndex was non-NULL, *pStartIndex is filled in with one * more than the index of the last xRecordRange that was touched. */ static int RecordConvertSetToRanges( RecordSetPtr pSet, GetContextRangeInfoPtr pri, int byteoffset, Bool card8, unsigned int imax, int *pStartIndex ) { int nRanges; RecordSetIteratePtr pIter = NULL; RecordSetInterval interval; CARD8 *pCARD8; CARD16 *pCARD16; int err; if (!pSet) return Success; nRanges = pStartIndex ? *pStartIndex : 0; while ((pIter = RecordIterateSet(pSet, pIter, &interval))) { if (interval.first > imax) break; if (interval.last > imax) interval.last = imax; nRanges++; if (nRanges > pri->size) { err = RecordAllocRanges(pri, nRanges); if (err != Success) return err; } else pri->nRanges = max(pri->nRanges, nRanges); if (card8) { pCARD8 = ((CARD8 *)&pri->pRanges[nRanges-1]) + byteoffset; *pCARD8++ = interval.first; *pCARD8 = interval.last; } else { pCARD16 = (CARD16 *) (((char *)&pri->pRanges[nRanges-1]) + byteoffset); *pCARD16++ = interval.first; *pCARD16 = interval.last; } } if (pStartIndex) *pStartIndex = nRanges; return Success; } /* RecordConvertSetToRanges */ /* RecordConvertMinorOpInfoToRanges * * Arguments: * pMinOpInfo is the minor opcode info to convert to xRecordRanges. * pri is where the result should be stored. * byteoffset is the offset from the start of an xRecordRange of the * four vales (CARD8 major_first, CARD8 major_last, * CARD16 minor_first, CARD16 minor_last) we are going to store. * * Returns: BadAlloc if a memory allocation error occurred, else Success. * * Side Effects: * If Success is returned, the slice of pri->pRanges indicated by * byteoffset is filled in with the information from pMinOpInfo. */ static int RecordConvertMinorOpInfoToRanges( RecordMinorOpPtr pMinOpInfo, GetContextRangeInfoPtr pri, int byteoffset ) { int nsets; int start; int i; int err; if (!pMinOpInfo) return Success; nsets = pMinOpInfo->count; pMinOpInfo++; start = 0; for (i = 0; i < nsets; i++) { int j, s; s = start; err = RecordConvertSetToRanges(pMinOpInfo[i].major.pMinOpSet, pri, byteoffset + 2, FALSE, 65535, &start); if (err != Success) return err; for (j = s; j < start; j++) { CARD8 *pCARD8 = ((CARD8 *)&pri->pRanges[j]) + byteoffset; *pCARD8++ = pMinOpInfo[i].major.first; *pCARD8 = pMinOpInfo[i].major.last; } } return Success; } /* RecordConvertMinorOpInfoToRanges */ /* RecordSwapRanges * * Arguments: * pRanges is an array of xRecordRanges. * nRanges is the number of elements in pRanges. * * Returns: nothing. * * Side Effects: * The 16 bit fields of each xRecordRange are byte swapped. */ static void RecordSwapRanges(xRecordRange *pRanges, int nRanges) { int i; for (i = 0; i < nRanges; i++, pRanges++) { swaps(&pRanges->extRequestsMinorFirst); swaps(&pRanges->extRequestsMinorLast); swaps(&pRanges->extRepliesMinorFirst); swaps(&pRanges->extRepliesMinorLast); } } /* RecordSwapRanges */ static int ProcRecordGetContext(ClientPtr client) { RecordContextPtr pContext; REQUEST(xRecordGetContextReq); xRecordGetContextReply rep; RecordClientsAndProtocolPtr pRCAP; int nRCAPs = 0; GetContextRangeInfoPtr pRangeInfo; GetContextRangeInfoPtr pri; int i; int err; CARD32 nClients, length; REQUEST_SIZE_MATCH(xRecordGetContextReq); VERIFY_CONTEXT(pContext, stuff->context, client); /* how many RCAPs are there on this context? */ for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP) nRCAPs++; /* allocate and initialize space for record range info */ pRangeInfo = (GetContextRangeInfoPtr)malloc( nRCAPs * sizeof(GetContextRangeInfoRec)); if (!pRangeInfo && nRCAPs > 0) return BadAlloc; for (i = 0; i < nRCAPs; i++) { pRangeInfo[i].pRanges = NULL; pRangeInfo[i].size = 0; pRangeInfo[i].nRanges = 0; } /* convert the RCAP (internal) representation of the recorded protocol * to the wire protocol (external) representation, storing the information * for the ith RCAP in pri[i] */ for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo; pRCAP; pRCAP = pRCAP->pNextRCAP, pri++) { xRecordRange rr; err = RecordConvertSetToRanges(pRCAP->pRequestMajorOpSet, pri, offset_of(rr, coreRequestsFirst), TRUE, 127, NULL); if (err != Success) goto bailout; err = RecordConvertSetToRanges(pRCAP->pReplyMajorOpSet, pri, offset_of(rr, coreRepliesFirst), TRUE, 127, NULL); if (err != Success) goto bailout; err = RecordConvertSetToRanges(pRCAP->pDeliveredEventSet, pri, offset_of(rr, deliveredEventsFirst), TRUE, 255, NULL); if (err != Success) goto bailout; err = RecordConvertSetToRanges(pRCAP->pDeviceEventSet, pri, offset_of(rr, deviceEventsFirst), TRUE, 255, NULL); if (err != Success) goto bailout; err = RecordConvertSetToRanges(pRCAP->pErrorSet, pri, offset_of(rr, errorsFirst), TRUE, 255, NULL); if (err != Success) goto bailout; err = RecordConvertMinorOpInfoToRanges(pRCAP->pRequestMinOpInfo, pri, offset_of(rr, extRequestsMajorFirst)); if (err != Success) goto bailout; err = RecordConvertMinorOpInfoToRanges(pRCAP->pReplyMinOpInfo, pri, offset_of(rr, extRepliesMajorFirst)); if (err != Success) goto bailout; if (pRCAP->clientStarted || pRCAP->clientDied) { if (pri->nRanges == 0) RecordAllocRanges(pri, 1); pri->pRanges[0].clientStarted = pRCAP->clientStarted; pri->pRanges[0].clientDied = pRCAP->clientDied; } } /* calculate number of clients and reply length */ nClients = 0; length = 0; for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo; pRCAP; pRCAP = pRCAP->pNextRCAP, pri++) { nClients += pRCAP->numClients; length += pRCAP->numClients * ( (sizeof(xRecordClientInfo) >> 2) + pri->nRanges * (sizeof(xRecordRange) >> 2)); } /* write the reply header */ rep = (xRecordGetContextReply) { .type = X_Reply, .enabled = pContext->pRecordingClient != NULL, .sequenceNumber = client->sequence, .length = length, .elementHeader = pContext->elemHeaders, .nClients = nClients }; if(client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.nClients); } WriteToClient(client, sizeof(xRecordGetContextReply), &rep); /* write all the CLIENT_INFOs */ for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo; pRCAP; pRCAP = pRCAP->pNextRCAP, pri++) { xRecordClientInfo rci; rci.nRanges = pri->nRanges; if (client->swapped) { swapl(&rci.nRanges); RecordSwapRanges(pri->pRanges, pri->nRanges); } for (i = 0; i < pRCAP->numClients; i++) { rci.clientResource = pRCAP->pClientIDs[i]; if (client->swapped) swapl(&rci.clientResource); WriteToClient(client, sizeof(xRecordClientInfo), &rci); WriteToClient(client, sizeof(xRecordRange) * pri->nRanges, (char *)pri->pRanges); } } err = client->noClientException; bailout: for (i = 0; i < nRCAPs; i++) { if (pRangeInfo[i].pRanges) free(pRangeInfo[i].pRanges); } free(pRangeInfo); return err; } /* ProcRecordGetContext */ static int ProcRecordEnableContext(ClientPtr client) { RecordContextPtr pContext; REQUEST(xRecordEnableContextReq); int i; RecordClientsAndProtocolPtr pRCAP; REQUEST_SIZE_MATCH(xRecordGetContextReq); VERIFY_CONTEXT(pContext, stuff->context, client); if (pContext->pRecordingClient) return BadMatch; /* already enabled */ /* install record hooks for each RCAP */ for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP) { int err = RecordInstallHooks(pRCAP, 0); if (err != Success) { /* undo the previous installs */ RecordClientsAndProtocolPtr pUninstallRCAP; for (pUninstallRCAP = pContext->pListOfRCAP; pUninstallRCAP != pRCAP; pUninstallRCAP = pUninstallRCAP->pNextRCAP) { RecordUninstallHooks(pUninstallRCAP, 0); } return err; } } /* Disallow further request processing on this connection until * the context is disabled. */ IgnoreClient(client); pContext->pRecordingClient = client; /* Don't allow the data connection to record itself; unregister it. */ RecordDeleteClientFromContext(pContext, pContext->pRecordingClient->clientAsMask); /* move the newly enabled context to the front part of ppAllContexts, * where all the enabled contexts are */ i = RecordFindContextOnAllContexts(pContext); assert(i >= numEnabledContexts); if (i != numEnabledContexts) { ppAllContexts[i] = ppAllContexts[numEnabledContexts]; ppAllContexts[numEnabledContexts] = pContext; } ++numEnabledContexts; assert(numEnabledContexts > 0); /* send StartOfData */ RecordAProtocolElement(pContext, NULL, XRecordStartOfData, NULL, 0, 0); RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0); return Success; } /* ProcRecordEnableContext */ /* RecordDisableContext * * Arguments: * pContext is the context to disable. * nRanges is the number of elements in pRanges. * * Returns: nothing. * * Side Effects: * If the context was enabled, it is disabled. An EndOfData * message is sent to the recording client. Recording hooks for * this context are uninstalled. The context is moved to the * rear part of the ppAllContexts array. numEnabledContexts is * decremented. Request processing for the formerly recording client * is resumed. */ static void RecordDisableContext(RecordContextPtr pContext) { RecordClientsAndProtocolPtr pRCAP; int i; if (!pContext->pRecordingClient) return; if (!pContext->pRecordingClient->clientGone) { RecordAProtocolElement(pContext, NULL, XRecordEndOfData, NULL, 0, 0); RecordFlushReplyBuffer(pContext, NULL, 0, NULL, 0); /* Re-enable request processing on this connection. */ AttendClient(pContext->pRecordingClient); } for (pRCAP = pContext->pListOfRCAP; pRCAP; pRCAP = pRCAP->pNextRCAP) { RecordUninstallHooks(pRCAP, 0); } pContext->pRecordingClient = NULL; /* move the newly disabled context to the rear part of ppAllContexts, * where all the disabled contexts are */ i = RecordFindContextOnAllContexts(pContext); assert( (i != -1) && (i < numEnabledContexts) ); if (i != (numEnabledContexts - 1) ) { ppAllContexts[i] = ppAllContexts[numEnabledContexts-1]; ppAllContexts[numEnabledContexts-1] = pContext; } --numEnabledContexts; assert(numEnabledContexts >= 0); } /* RecordDisableContext */ static int ProcRecordDisableContext(ClientPtr client) { RecordContextPtr pContext; REQUEST(xRecordDisableContextReq); REQUEST_SIZE_MATCH(xRecordDisableContextReq); VERIFY_CONTEXT(pContext, stuff->context, client); RecordDisableContext(pContext); return Success; } /* ProcRecordDisableContext */ /* RecordDeleteContext * * Arguments: * value is the context to delete. * id is its resource ID. * * Returns: Success. * * Side Effects: * Disables the context, frees all associated memory, and removes * it from the ppAllContexts array. */ static int RecordDeleteContext(void * value, XID id) { int i; RecordContextPtr pContext = (RecordContextPtr)value; RecordClientsAndProtocolPtr pRCAP; RecordDisableContext(pContext); /* Remove all the clients from all the RCAPs. * As a result, the RCAPs will be freed. */ while ((pRCAP = pContext->pListOfRCAP)) { int numClients = pRCAP->numClients; /* when the last client is deleted, the RCAP will go away. */ while(numClients--) { RecordDeleteClientFromRCAP(pRCAP, numClients); } } free(pContext); /* remove context from AllContexts list */ if (-1 != (i = RecordFindContextOnAllContexts(pContext))) { ppAllContexts[i] = ppAllContexts[numContexts - 1]; if (--numContexts == 0) { free(ppAllContexts); ppAllContexts = NULL; } } return Success; } /* RecordDeleteContext */ static int ProcRecordFreeContext(ClientPtr client) { RecordContextPtr pContext; REQUEST(xRecordFreeContextReq); REQUEST_SIZE_MATCH(xRecordFreeContextReq); VERIFY_CONTEXT(pContext, stuff->context, client); FreeResource(stuff->context, RT_NONE); return Success; } /* ProcRecordFreeContext */ static int ProcRecordDispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_RecordQueryVersion: return ProcRecordQueryVersion(client); case X_RecordCreateContext: return ProcRecordCreateContext(client); case X_RecordRegisterClients: return ProcRecordRegisterClients(client); case X_RecordUnregisterClients: return ProcRecordUnregisterClients(client); case X_RecordGetContext: return ProcRecordGetContext(client); case X_RecordEnableContext: return ProcRecordEnableContext(client); case X_RecordDisableContext: return ProcRecordDisableContext(client); case X_RecordFreeContext: return ProcRecordFreeContext(client); default: return BadRequest; } } /* ProcRecordDispatch */ static int SProcRecordQueryVersion(ClientPtr client) { REQUEST(xRecordQueryVersionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xRecordQueryVersionReq); swaps(&stuff->majorVersion); swaps(&stuff->minorVersion); return ProcRecordQueryVersion(client); } /* SProcRecordQueryVersion */ static int SwapCreateRegister(xRecordRegisterClientsReq *stuff) { int i; XID *pClientID; swapl(&stuff->context); swapl(&stuff->nClients); swapl(&stuff->nRanges); pClientID = (XID *)&stuff[1]; if (stuff->nClients > stuff->length - (sz_xRecordRegisterClientsReq >> 2)) return BadLength; for (i = 0; i < stuff->nClients; i++, pClientID++) { swapl(pClientID); } if (stuff->nRanges > stuff->length - (sz_xRecordRegisterClientsReq >> 2) - stuff->nClients) return BadLength; RecordSwapRanges((xRecordRange *)pClientID, stuff->nRanges); return Success; } /* SwapCreateRegister */ static int SProcRecordCreateContext(ClientPtr client) { REQUEST(xRecordCreateContextReq); int status; swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq); if ((status = SwapCreateRegister((void *)stuff)) != Success) return status; return ProcRecordCreateContext(client); } /* SProcRecordCreateContext */ static int SProcRecordRegisterClients(ClientPtr client) { REQUEST(xRecordRegisterClientsReq); int status; swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xRecordRegisterClientsReq); if ((status = SwapCreateRegister((void *)stuff)) != Success) return status; return ProcRecordRegisterClients(client); } /* SProcRecordRegisterClients */ static int SProcRecordUnregisterClients(ClientPtr client) { REQUEST(xRecordUnregisterClientsReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xRecordUnregisterClientsReq); swapl(&stuff->context); swapl(&stuff->nClients); SwapRestL(stuff); return ProcRecordUnregisterClients(client); } /* SProcRecordUnregisterClients */ static int SProcRecordGetContext(ClientPtr client) { REQUEST(xRecordGetContextReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xRecordGetContextReq); swapl(&stuff->context); return ProcRecordGetContext(client); } /* SProcRecordGetContext */ static int SProcRecordEnableContext(ClientPtr client) { REQUEST(xRecordEnableContextReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xRecordEnableContextReq); swapl(&stuff->context); return ProcRecordEnableContext(client); } /* SProcRecordEnableContext */ static int SProcRecordDisableContext(ClientPtr client) { REQUEST(xRecordDisableContextReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xRecordDisableContextReq); swapl(&stuff->context); return ProcRecordDisableContext(client); } /* SProcRecordDisableContext */ static int SProcRecordFreeContext(ClientPtr client) { REQUEST(xRecordFreeContextReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xRecordFreeContextReq); swapl(&stuff->context); return ProcRecordFreeContext(client); } /* SProcRecordFreeContext */ static int SProcRecordDispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_RecordQueryVersion: return SProcRecordQueryVersion(client); case X_RecordCreateContext: return SProcRecordCreateContext(client); case X_RecordRegisterClients: return SProcRecordRegisterClients(client); case X_RecordUnregisterClients: return SProcRecordUnregisterClients(client); case X_RecordGetContext: return SProcRecordGetContext(client); case X_RecordEnableContext: return SProcRecordEnableContext(client); case X_RecordDisableContext: return SProcRecordDisableContext(client); case X_RecordFreeContext: return SProcRecordFreeContext(client); default: return BadRequest; } } /* SProcRecordDispatch */ /* RecordConnectionSetupInfo * * Arguments: * pContext is an enabled context that specifies recording of * connection setup info. * pci holds the connection setup info. * * Returns: nothing. * * Side Effects: * The connection setup info is sent to the recording client. */ static void RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec *pci) { int prefixsize = SIZEOF(xConnSetupPrefix); int restsize = pci->prefix->length * 4; if (pci->client->swapped) { char *pConnSetup = (char *)malloc(prefixsize + restsize); if (!pConnSetup) return; SwapConnSetupPrefix(pci->prefix, (xConnSetupPrefix*)pConnSetup); SwapConnSetupInfo((char *)pci->setup, (char *)(pConnSetup + prefixsize)); RecordAProtocolElement(pContext, pci->client, XRecordClientStarted, (void *)pConnSetup, prefixsize + restsize, 0); free(pConnSetup); } else { /* don't alloc and copy as in the swapped case; just send the * data in two pieces */ RecordAProtocolElement(pContext, pci->client, XRecordClientStarted, (void *)pci->prefix, prefixsize, restsize); RecordAProtocolElement(pContext, pci->client, XRecordClientStarted, (void *)pci->setup, restsize, /* continuation */ -1); } } /* RecordConnectionSetupInfo */ /* RecordDeleteContext * * Arguments: * pcbl is &ClientStateCallback. * nullata is NULL. * calldata is a pointer to a NewClientInfoRec (include/dixstruct.h) * which contains information about client state changes. * * Returns: nothing. * * Side Effects: * If a new client has connected and any contexts have specified * XRecordFutureClients, the new client is registered on those contexts. * If any of those contexts specify recording of the connection setup * info, it is recorded. * * If an existing client has disconnected, it is deleted from any * contexts that it was registered on. If any of those contexts * specified XRecordClientDied, they record a ClientDied protocol element. * If the disconnectiong client happened to be the data connection of an * enabled context, the context is disabled. */ static void RecordAClientStateChange(CallbackListPtr *pcbl, void * nulldata, void * calldata) { NewClientInfoRec *pci = (NewClientInfoRec *)calldata; int i; ClientPtr pClient = pci->client; switch (pClient->clientState) { case ClientStateRunning: /* new client */ for (i = 0; i < numContexts; i++) { RecordClientsAndProtocolPtr pRCAP; RecordContextPtr pContext = ppAllContexts[i]; if ((pRCAP = RecordFindClientOnContext(pContext, XRecordFutureClients, NULL))) { RecordAddClientToRCAP(pRCAP, pClient->clientAsMask); if (pContext->pRecordingClient && pRCAP->clientStarted) RecordConnectionSetupInfo(pContext, pci); } } break; case ClientStateGone: case ClientStateRetained: /* client disconnected */ for (i = 0; i < numContexts; i++) { RecordClientsAndProtocolPtr pRCAP; RecordContextPtr pContext = ppAllContexts[i]; int pos; if (pContext->pRecordingClient == pClient) RecordDisableContext(pContext); if ((pRCAP = RecordFindClientOnContext(pContext, pClient->clientAsMask, &pos))) { if (pContext->pRecordingClient && pRCAP->clientDied) RecordAProtocolElement(pContext, pClient, XRecordClientDied, NULL, 0, 0); RecordDeleteClientFromRCAP(pRCAP, pos); } } break; default: break; } /* end switch on client state */ } /* RecordAClientStateChange */ /* RecordCloseDown * * Arguments: * extEntry is the extension information for RECORD. * * Returns: nothing. * * Side Effects: * Performs any cleanup needed by RECORD at server shutdown time. * */ static void RecordCloseDown(ExtensionEntry *extEntry) { DeleteCallback(&ClientStateCallback, RecordAClientStateChange, NULL); } /* RecordCloseDown */ /* RecordExtensionInit * * Arguments: none. * * Returns: nothing. * * Side Effects: * Enables the RECORD extension if possible. */ void RecordExtensionInit(void) { ExtensionEntry *extentry; RTContext = CreateNewResourceType(RecordDeleteContext); if (!RTContext) return; RecordClientPrivateIndex = AllocateClientPrivateIndex(); if (!AllocateClientPrivate(RecordClientPrivateIndex, 0)) return; ppAllContexts = NULL; numContexts = numEnabledContexts = numEnabledRCAPs = 0; if (!AddCallback(&ClientStateCallback, RecordAClientStateChange, NULL)) return; extentry = AddExtension(RECORD_NAME, RecordNumEvents, RecordNumErrors, ProcRecordDispatch, SProcRecordDispatch, RecordCloseDown, StandardMinorOpcode); if (!extentry) { DeleteCallback(&ClientStateCallback, RecordAClientStateChange, NULL); return; } RecordErrorBase = extentry->errorBase; } /* RecordExtensionInit */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/record/set.c0000644000000000000000000002674613614532331017027 0ustar /* Copyright 1995, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* See the header set.h for a description of the set ADT. Implementation Strategy A bit vector is an obvious choice to represent the set, but may take too much memory, depending on the numerically largest member in the set. One expected common case is for the client to ask for *all* protocol. This means it would ask for minor opcodes 0 through 65535. Representing this as a bit vector takes 8K -- and there may be multiple minor opcode intervals, as many as one per major (extension) opcode). In such cases, a list-of-intervals representation would be preferable to reduce memory consumption. Both representations will be implemented, and RecordCreateSet will decide heuristically which one to use based on the set members. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "misc.h" #include "set.h" static int maxMemberInInterval(RecordSetInterval *pIntervals, int nIntervals) { int i; int maxMember = -1; for (i = 0; i < nIntervals; i++) { if (maxMember < (int)pIntervals[i].last) maxMember = pIntervals[i].last; } return maxMember; } static void NoopDestroySet(RecordSetPtr pSet) { } /***************************************************************************/ /* set operations for bit vector representation */ typedef struct { RecordSetRec baseSet; int maxMember; /* followed by the bit vector itself */ } BitVectorSet, *BitVectorSetPtr; #define BITS_PER_LONG (sizeof(unsigned long) * 8) static void BitVectorDestroySet(RecordSetPtr pSet) { free(pSet); } static unsigned long BitVectorIsMemberOfSet(RecordSetPtr pSet, int pm) { BitVectorSetPtr pbvs = (BitVectorSetPtr)pSet; unsigned long *pbitvec; if ((int)pm > pbvs->maxMember) return FALSE; pbitvec = (unsigned long *)(&pbvs[1]); return (pbitvec[pm / BITS_PER_LONG] & ((unsigned long)1 << (pm % BITS_PER_LONG))); } static int BitVectorFindBit(RecordSetPtr pSet, int iterbit, Bool bitval) { BitVectorSetPtr pbvs = (BitVectorSetPtr)pSet; unsigned long *pbitvec = (unsigned long *)(&pbvs[1]); int startlong; int startbit; int walkbit; int maxMember; unsigned long skipval; unsigned long bits; unsigned long usefulbits; startlong = iterbit / BITS_PER_LONG; pbitvec += startlong; startbit = startlong * BITS_PER_LONG; skipval = bitval ? 0L : ~0L; maxMember = pbvs->maxMember; if (startbit > maxMember) return -1; bits = *pbitvec; usefulbits = ~(((unsigned long)1 << (iterbit - startbit)) - 1); if ( (bits & usefulbits) == (skipval & usefulbits) ) { pbitvec++; startbit += BITS_PER_LONG; while (startbit <= maxMember && *pbitvec == skipval) { pbitvec++; startbit += BITS_PER_LONG; } if (startbit > maxMember) return -1; } walkbit = (startbit < iterbit) ? iterbit - startbit : 0; bits = *pbitvec; while (walkbit < BITS_PER_LONG && ((!(bits & ((unsigned long)1 << walkbit))) == bitval)) walkbit++; return startbit + walkbit; } static RecordSetIteratePtr BitVectorIterateSet(RecordSetPtr pSet, RecordSetIteratePtr pIter, RecordSetInterval *pInterval) { int iterbit = (int)(long)pIter; int b; b = BitVectorFindBit(pSet, iterbit, TRUE); if (b == -1) return (RecordSetIteratePtr)0; pInterval->first = b; b = BitVectorFindBit(pSet, b, FALSE); pInterval->last = (b < 0) ? ((BitVectorSetPtr)pSet)->maxMember : b - 1; return (RecordSetIteratePtr)(long)(pInterval->last + 1); } static RecordSetOperations BitVectorSetOperations = { BitVectorDestroySet, BitVectorIsMemberOfSet, BitVectorIterateSet }; static RecordSetOperations BitVectorNoFreeOperations = { NoopDestroySet, BitVectorIsMemberOfSet, BitVectorIterateSet }; static int BitVectorSetMemoryRequirements(RecordSetInterval *pIntervals, int nIntervals, int maxMember, int *alignment) { int nlongs; *alignment = sizeof(unsigned long); nlongs = (maxMember + BITS_PER_LONG) / BITS_PER_LONG; return (sizeof(BitVectorSet) + nlongs * sizeof(unsigned long)); } static RecordSetPtr BitVectorCreateSet(RecordSetInterval *pIntervals, int nIntervals, void *pMem, int memsize) { BitVectorSetPtr pbvs; int i, j; unsigned long *pbitvec; /* allocate all storage needed by this set in one chunk */ if (pMem) { memset(pMem, 0, memsize); pbvs = (BitVectorSetPtr)pMem; pbvs->baseSet.ops = &BitVectorNoFreeOperations; } else { pbvs = (BitVectorSetPtr)calloc(1, memsize); if (!pbvs) return NULL; pbvs->baseSet.ops = &BitVectorSetOperations; } pbvs->maxMember = maxMemberInInterval(pIntervals, nIntervals); /* fill in the set */ pbitvec = (unsigned long *)(&pbvs[1]); for (i = 0; i < nIntervals; i++) { for (j = pIntervals[i].first; j <= (int)pIntervals[i].last; j++) { pbitvec[j/BITS_PER_LONG] |= ((unsigned long)1 << (j % BITS_PER_LONG)); } } return (RecordSetPtr)pbvs; } /***************************************************************************/ /* set operations for interval list representation */ typedef struct { RecordSetRec baseSet; int nIntervals; /* followed by the intervals (RecordSetInterval) */ } IntervalListSet, *IntervalListSetPtr; static void IntervalListDestroySet(RecordSetPtr pSet) { free(pSet); } static unsigned long IntervalListIsMemberOfSet(RecordSetPtr pSet, int pm) { IntervalListSetPtr prls = (IntervalListSetPtr)pSet; RecordSetInterval *pInterval = (RecordSetInterval *)(&prls[1]); int hi, lo, probe; /* binary search */ lo = 0; hi = prls->nIntervals - 1; while (lo <= hi) { probe = (hi + lo) / 2; if (pm >= pInterval[probe].first && pm <= pInterval[probe].last) return 1; else if (pm < pInterval[probe].first) hi = probe - 1; else lo = probe + 1; } return 0; } static RecordSetIteratePtr IntervalListIterateSet(RecordSetPtr pSet, RecordSetIteratePtr pIter, RecordSetInterval *pIntervalReturn) { RecordSetInterval *pInterval = (RecordSetInterval *)pIter; IntervalListSetPtr prls = (IntervalListSetPtr)pSet; if (pInterval == NULL) { pInterval = (RecordSetInterval *)(&prls[1]); } if ( (pInterval - (RecordSetInterval *)(&prls[1])) < prls->nIntervals ) { *pIntervalReturn = *pInterval; return (RecordSetIteratePtr)(++pInterval); } else return (RecordSetIteratePtr)NULL; } static RecordSetOperations IntervalListSetOperations = { IntervalListDestroySet, IntervalListIsMemberOfSet, IntervalListIterateSet }; static RecordSetOperations IntervalListNoFreeOperations = { NoopDestroySet, IntervalListIsMemberOfSet, IntervalListIterateSet }; static int IntervalListMemoryRequirements(RecordSetInterval *pIntervals, int nIntervals, int maxMember, int *alignment) { *alignment = sizeof(unsigned long); return sizeof(IntervalListSet) + nIntervals * sizeof(RecordSetInterval); } static RecordSetPtr IntervalListCreateSet(RecordSetInterval *pIntervals, int nIntervals, void *pMem, int memsize) { IntervalListSetPtr prls; int i, j, k; RecordSetInterval *stackIntervals = NULL; CARD16 first; if (nIntervals > 0) { stackIntervals = (RecordSetInterval *)malloc( sizeof(RecordSetInterval) * nIntervals); if (!stackIntervals) return NULL; /* sort intervals, store in stackIntervals (insertion sort) */ for (i = 0; i < nIntervals; i++) { first = pIntervals[i].first; for (j = 0; j < i; j++) { if (first < stackIntervals[j].first) break; } for (k = i; k > j; k--) { stackIntervals[k] = stackIntervals[k-1]; } stackIntervals[j] = pIntervals[i]; } /* merge abutting/overlapping intervals */ for (i = 0; i < nIntervals - 1; ) { if ( (stackIntervals[i].last + (unsigned int)1) < stackIntervals[i + 1].first) { i++; /* disjoint intervals */ } else { stackIntervals[i].last = max(stackIntervals[i].last, stackIntervals[i + 1].last); nIntervals--; for (j = i + 1; j < nIntervals; j++) stackIntervals[j] = stackIntervals[j + 1]; } } } /* allocate and fill in set structure */ if (pMem) { prls = (IntervalListSetPtr)pMem; prls->baseSet.ops = &IntervalListNoFreeOperations; } else { prls = (IntervalListSetPtr) malloc(sizeof(IntervalListSet) + nIntervals * sizeof(RecordSetInterval)); if (!prls) goto bailout; prls->baseSet.ops = &IntervalListSetOperations; } if (nIntervals > 0) memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval)); prls->nIntervals = nIntervals; bailout: if (stackIntervals) free(stackIntervals); return (RecordSetPtr)prls; } typedef RecordSetPtr (*RecordCreateSetProcPtr)( RecordSetInterval *pIntervals, int nIntervals, void *pMem, int memsize ); static int _RecordSetMemoryRequirements(RecordSetInterval *pIntervals, int nIntervals, int *alignment, RecordCreateSetProcPtr *ppCreateSet) { int bmsize, rlsize, bma, rla; int maxMember; /* find maximum member of set so we know how big to make the bit vector */ maxMember = maxMemberInInterval(pIntervals, nIntervals); bmsize = BitVectorSetMemoryRequirements(pIntervals, nIntervals, maxMember, &bma); rlsize = IntervalListMemoryRequirements(pIntervals, nIntervals, maxMember, &rla); if ( ( (nIntervals > 1) && (maxMember <= 255) ) || (bmsize < rlsize) ) { *alignment = bma; *ppCreateSet = BitVectorCreateSet; return bmsize; } else { *alignment = rla; *ppCreateSet = IntervalListCreateSet; return rlsize; } } /***************************************************************************/ /* user-visible functions */ int RecordSetMemoryRequirements(pIntervals, nIntervals, alignment) RecordSetInterval *pIntervals; int nIntervals; int *alignment; { RecordCreateSetProcPtr pCreateSet; return _RecordSetMemoryRequirements(pIntervals, nIntervals, alignment, &pCreateSet); } RecordSetPtr RecordCreateSet(pIntervals, nIntervals, pMem, memsize) RecordSetInterval *pIntervals; int nIntervals; void *pMem; int memsize; { RecordCreateSetProcPtr pCreateSet; int alignment; int size; size = _RecordSetMemoryRequirements(pIntervals, nIntervals, &alignment, &pCreateSet); if (pMem) { if ( ((long)pMem & (alignment-1) ) || memsize < size) return NULL; } return (*pCreateSet)(pIntervals, nIntervals, pMem, size); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/record/set.h0000644000000000000000000001252213614532331017017 0ustar /* Copyright 1995, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /* A Set Abstract Data Type (ADT) for the RECORD Extension David P. Wiggins 7/25/95 The RECORD extension server code needs to maintain sets of numbers that designate protocol message types. In most cases the interval of numbers starts at 0 and does not exceed 255, but in a few cases (minor opcodes of extension requests) the maximum is 65535. This disparity suggests that a single set representation may not be suitable for all sets, especially given that server memory is precious. We introduce a set ADT to hide implementation differences so that multiple simultaneous set representations can exist. A single interface is presented to the set user regardless of the implementation in use for a particular set. The existing RECORD SI appears to require only four set operations: create (given a list of members), destroy, see if a particular number is a member of the set, and iterate over the members of a set. Though many more set operations are imaginable, to keep the code space down, we won't provide any more operations than are needed. The following types and functions/macros define the ADT. */ /* an interval of set members */ typedef struct { CARD16 first; CARD16 last; } RecordSetInterval; typedef struct _RecordSetRec *RecordSetPtr; /* primary set type */ typedef void *RecordSetIteratePtr; /* table of function pointers for set operations. set users should never declare a variable of this type. */ typedef struct { void (*DestroySet)( RecordSetPtr pSet ); unsigned long (*IsMemberOfSet)( RecordSetPtr pSet, int possible_member ); RecordSetIteratePtr (*IterateSet)( RecordSetPtr pSet, RecordSetIteratePtr pIter, RecordSetInterval *interval ); } RecordSetOperations; /* "base class" for sets. set users should never declare a variable of this type. */ typedef struct _RecordSetRec { RecordSetOperations *ops; } RecordSetRec; RecordSetPtr RecordCreateSet( RecordSetInterval *intervals, int nintervals, void *pMem, int memsize ); /* RecordCreateSet creates and returns a new set having members specified by intervals and nintervals. nintervals is the number of RecordSetInterval structures pointed to by intervals. The elements belonging to the new set are determined as follows. For each RecordSetInterval structure, the elements between first and last inclusive are members of the new set. If a RecordSetInterval's first field is greater than its last field, the results are undefined. It is valid to create an empty set (nintervals == 0). If RecordCreateSet returns NULL, the set could not be created due to resource constraints. */ int RecordSetMemoryRequirements( RecordSetInterval * /*pIntervals*/, int /*nintervals*/, int * /*alignment*/ ); #define RecordDestroySet(_pSet) \ /* void */ (*_pSet->ops->DestroySet)(/* RecordSetPtr */ _pSet) /* RecordDestroySet frees all resources used by _pSet. _pSet should not be used after it is destroyed. */ #define RecordIsMemberOfSet(_pSet, _m) \ /* unsigned long */ (*_pSet->ops->IsMemberOfSet)(/* RecordSetPtr */ _pSet, \ /* int */ _m) /* RecordIsMemberOfSet returns a non-zero value if _m is a member of _pSet, else it returns zero. */ #define RecordIterateSet(_pSet, _pIter, _interval) \ /* RecordSetIteratePtr */ (*_pSet->ops->IterateSet)(/* RecordSetPtr */ _pSet,\ /* RecordSetIteratePtr */ _pIter, /* RecordSetInterval */ _interval) /* RecordIterateSet returns successive intervals of members of _pSet. If _pIter is NULL, the first interval of set members is copied into _interval. The return value should be passed as _pIter in the next call to RecordIterateSet to obtain the next interval. When the return value is NULL, there were no more intervals in the set, and nothing is copied into the _interval parameter. Intervals appear in increasing numerical order with no overlap between intervals. As such, the list of intervals produced by RecordIterateSet may not match the list of intervals that were passed in RecordCreateSet. Typical usage: pIter = NULL; while (pIter = RecordIterateSet(pSet, pIter, &interval)) { process interval; } */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/animcur.c0000644000000000000000000002615413614532331017664 0ustar /* * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* * Animated cursors for X. Not specific to Render in any way, but * stuck there because Render has the other cool cursor extension. * Besides, everyone has Render. * * Implemented as a simple layer over the core cursor code; it * creates composite cursors out of a set of static cursors and * delta times between each image. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "servermd.h" #include "scrnintstr.h" #include "dixstruct.h" #include "cursorstr.h" #include "dixfontstr.h" #include "opaque.h" #include "picturestr.h" typedef struct _AnimCurElt { CursorPtr pCursor; /* cursor to show */ CARD32 delay; /* in ms */ } AnimCurElt; typedef struct _AnimCur { int nelt; /* number of elements in the elts array */ AnimCurElt *elts; /* actually allocated right after the structure */ } AnimCurRec, *AnimCurPtr; typedef struct _AnimScrPriv { CursorPtr pCursor; int elt; CARD32 time; CloseScreenProcPtr CloseScreen; ScreenBlockHandlerProcPtr BlockHandler; CursorLimitsProcPtr CursorLimits; DisplayCursorProcPtr DisplayCursor; SetCursorPositionProcPtr SetCursorPosition; RealizeCursorProcPtr RealizeCursor; UnrealizeCursorProcPtr UnrealizeCursor; RecolorCursorProcPtr RecolorCursor; } AnimCurScreenRec, *AnimCurScreenPtr; typedef struct _AnimCurState { CursorPtr pCursor; ScreenPtr pScreen; int elt; CARD32 time; } AnimCurStateRec, *AnimCurStatePtr; static AnimCurStateRec animCurState; static unsigned char empty[4]; static CursorBits animCursorBits = { empty, empty, 2, 1, 1, 0, 0, 1 }; int AnimCurScreenPrivateIndex = -1; int AnimCurGeneration; #define IsAnimCur(c) ((c)->bits == &animCursorBits) #define GetAnimCur(c) ((AnimCurPtr) ((c) + 1)) #define GetAnimCurScreen(s) ((AnimCurScreenPtr) ((s)->devPrivates[AnimCurScreenPrivateIndex].ptr)) #define GetAnimCurScreenIfSet(s) ((AnimCurScreenPrivateIndex != -1) ? GetAnimCurScreen(s) : NULL) #define SetAnimCurScreen(s,p) ((s)->devPrivates[AnimCurScreenPrivateIndex].ptr = (void *) (p)) #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func) #define Unwrap(as,s,elt) ((s)->elt = (as)->elt) static Bool AnimCurDisplayCursor (ScreenPtr pScreen, CursorPtr pCursor); static Bool AnimCurSetCursorPosition (ScreenPtr pScreen, int x, int y, Bool generateEvent); static Bool AnimCurCloseScreen (ScreenPtr pScreen) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Bool ret; Unwrap(as, pScreen, CloseScreen); Unwrap(as, pScreen, BlockHandler); Unwrap(as, pScreen, CursorLimits); Unwrap(as, pScreen, DisplayCursor); Unwrap(as, pScreen, SetCursorPosition); Unwrap(as, pScreen, RealizeCursor); Unwrap(as, pScreen, UnrealizeCursor); Unwrap(as, pScreen, RecolorCursor); SetAnimCurScreen(pScreen,0); ret = (*pScreen->CloseScreen) (pScreen); free (as); if (screenInfo.numScreens <= 1) AnimCurScreenPrivateIndex = -1; return ret; } static void AnimCurCursorLimits (ScreenPtr pScreen, CursorPtr pCursor, BoxPtr pHotBox, BoxPtr pTopLeftBox) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Unwrap (as, pScreen, CursorLimits); if (IsAnimCur(pCursor)) { AnimCurPtr ac = GetAnimCur(pCursor); (*pScreen->CursorLimits) (pScreen, ac->elts[0].pCursor, pHotBox, pTopLeftBox); } else { (*pScreen->CursorLimits) (pScreen, pCursor, pHotBox, pTopLeftBox); } Wrap (as, pScreen, CursorLimits, AnimCurCursorLimits); } /* * This has to be a screen block handler instead of a generic * block handler so that it is well ordered with respect to the DRI * block handler responsible for releasing the hardware to DRI clients */ static void AnimCurScreenBlockHandler (int screenNum, void * blockData, void * pTimeout, void * pReadmask) { ScreenPtr pScreen = screenInfo.screens[screenNum]; AnimCurScreenPtr as = GetAnimCurScreen(pScreen); if (pScreen == animCurState.pScreen) { CARD32 now = GetTimeInMillis (); if ((INT32) (now - animCurState.time) >= 0) { AnimCurPtr ac = GetAnimCur(animCurState.pCursor); int elt = (animCurState.elt + 1) % ac->nelt; DisplayCursorProcPtr DisplayCursor; /* * Not a simple Unwrap/Wrap as this * isn't called along the DisplayCursor * wrapper chain. */ DisplayCursor = pScreen->DisplayCursor; pScreen->DisplayCursor = as->DisplayCursor; (void) (*pScreen->DisplayCursor) (pScreen, ac->elts[elt].pCursor); as->DisplayCursor = pScreen->DisplayCursor; pScreen->DisplayCursor = DisplayCursor; animCurState.elt = elt; animCurState.time = now + ac->elts[elt].delay; } AdjustWaitForDelay (pTimeout, animCurState.time - now); } Unwrap (as, pScreen, BlockHandler); (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask); Wrap (as, pScreen, BlockHandler, AnimCurScreenBlockHandler); } static Bool AnimCurDisplayCursor (ScreenPtr pScreen, CursorPtr pCursor) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Bool ret; Unwrap (as, pScreen, DisplayCursor); if (IsAnimCur(pCursor)) { if (pCursor != animCurState.pCursor) { AnimCurPtr ac = GetAnimCur(pCursor); ret = (*pScreen->DisplayCursor) (pScreen, ac->elts[0].pCursor); if (ret) { animCurState.elt = 0; animCurState.time = GetTimeInMillis () + ac->elts[0].delay; animCurState.pCursor = pCursor; animCurState.pScreen = pScreen; } } else ret = TRUE; } else { animCurState.pCursor = 0; animCurState.pScreen = 0; ret = (*pScreen->DisplayCursor) (pScreen, pCursor); } Wrap (as, pScreen, DisplayCursor, AnimCurDisplayCursor); return ret; } static Bool AnimCurSetCursorPosition (ScreenPtr pScreen, int x, int y, Bool generateEvent) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Bool ret; Unwrap (as, pScreen, SetCursorPosition); if (animCurState.pCursor) animCurState.pScreen = pScreen; ret = (*pScreen->SetCursorPosition) (pScreen, x, y, generateEvent); Wrap (as, pScreen, SetCursorPosition, AnimCurSetCursorPosition); return ret; } static Bool AnimCurRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Bool ret; Unwrap (as, pScreen, RealizeCursor); if (IsAnimCur(pCursor)) ret = TRUE; else ret = (*pScreen->RealizeCursor) (pScreen, pCursor); Wrap (as, pScreen, RealizeCursor, AnimCurRealizeCursor); return ret; } static Bool AnimCurUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Bool ret; Unwrap (as, pScreen, UnrealizeCursor); if (IsAnimCur(pCursor)) { AnimCurPtr ac = GetAnimCur(pCursor); int i; if (pScreen->myNum == 0) for (i = 0; i < ac->nelt; i++) FreeCursor (ac->elts[i].pCursor, 0); ret = TRUE; } else ret = (*pScreen->UnrealizeCursor) (pScreen, pCursor); Wrap (as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor); return ret; } static void AnimCurRecolorCursor (ScreenPtr pScreen, CursorPtr pCursor, Bool displayed) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Unwrap (as, pScreen, RecolorCursor); if (IsAnimCur(pCursor)) { AnimCurPtr ac = GetAnimCur(pCursor); int i; for (i = 0; i < ac->nelt; i++) (*pScreen->RecolorCursor) (pScreen, ac->elts[i].pCursor, displayed && animCurState.elt == i); } else (*pScreen->RecolorCursor) (pScreen, pCursor, displayed); Wrap (as, pScreen, RecolorCursor, AnimCurRecolorCursor); } Bool AnimCurInit (ScreenPtr pScreen) { AnimCurScreenPtr as; if (AnimCurGeneration != serverGeneration) { AnimCurScreenPrivateIndex = AllocateScreenPrivateIndex (); if (AnimCurScreenPrivateIndex < 0) return FALSE; AnimCurGeneration = serverGeneration; animCurState.pCursor = 0; animCurState.pScreen = 0; animCurState.elt = 0; animCurState.time = 0; } as = (AnimCurScreenPtr) malloc (sizeof (AnimCurScreenRec)); if (!as) return FALSE; Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen); Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler); Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits); Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor); Wrap(as, pScreen, SetCursorPosition, AnimCurSetCursorPosition); Wrap(as, pScreen, RealizeCursor, AnimCurRealizeCursor); Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor); Wrap(as, pScreen, RecolorCursor, AnimCurRecolorCursor); SetAnimCurScreen(pScreen,as); return TRUE; } int AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor) { CursorPtr pCursor; int i; AnimCurPtr ac; for (i = 0; i < screenInfo.numScreens; i++) if (!GetAnimCurScreenIfSet (screenInfo.screens[i])) return BadImplementation; for (i = 0; i < ncursor; i++) if (IsAnimCur (cursors[i])) return BadMatch; pCursor = (CursorPtr) malloc (sizeof (CursorRec) + sizeof (AnimCurRec) + ncursor * sizeof (AnimCurElt)); if (!pCursor) return BadAlloc; pCursor->bits = &animCursorBits; animCursorBits.refcnt++; pCursor->refcnt = 1; pCursor->foreRed = cursors[0]->foreRed; pCursor->foreGreen = cursors[0]->foreGreen; pCursor->foreBlue = cursors[0]->foreBlue; pCursor->backRed = cursors[0]->backRed; pCursor->backGreen = cursors[0]->backGreen; pCursor->backBlue = cursors[0]->backBlue; /* * Fill in the AnimCurRec */ ac = GetAnimCur (pCursor); ac->nelt = ncursor; ac->elts = (AnimCurElt *) (ac + 1); for (i = 0; i < ncursor; i++) { cursors[i]->refcnt++; ac->elts[i].pCursor = cursors[i]; ac->elts[i].delay = deltas[i]; } *ppCursor = pCursor; return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/filter.c0000644000000000000000000002262713614532331017514 0ustar /* * $Id: filter.c,v 1.10 2005/07/03 08:53:54 daniels Exp $ * * Copyright © 2002 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "misc.h" #include "scrnintstr.h" #include "os.h" #include "regionstr.h" #include "validate.h" #include "windowstr.h" #include "input.h" #include "resource.h" #include "colormapst.h" #include "cursorstr.h" #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" #include "picturestr.h" static char **filterNames; static int nfilterNames; /* * standard but not required filters don't have constant indices */ int PictureGetFilterId (char *filter, int len, Bool makeit) { int i; char *name; char **names; if (len < 0) len = strlen (filter); for (i = 0; i < nfilterNames; i++) if (!CompareISOLatin1Lowered ((unsigned char *) filterNames[i], -1, (unsigned char *) filter, len)) return i; if (!makeit) return -1; name = malloc (len + 1); if (!name) return -1; memcpy (name, filter, len); name[len] = '\0'; if (filterNames) names = realloc (filterNames, (nfilterNames + 1) * sizeof (char *)); else names = malloc (sizeof (char *)); if (!names) { free (name); return -1; } filterNames = names; i = nfilterNames++; filterNames[i] = name; return i; } static Bool PictureSetDefaultIds (void) { /* careful here -- this list must match the #define values */ if (PictureGetFilterId (FilterNearest, -1, TRUE) != PictFilterNearest) return FALSE; if (PictureGetFilterId (FilterBilinear, -1, TRUE) != PictFilterBilinear) return FALSE; if (PictureGetFilterId (FilterFast, -1, TRUE) != PictFilterFast) return FALSE; if (PictureGetFilterId (FilterGood, -1, TRUE) != PictFilterGood) return FALSE; if (PictureGetFilterId (FilterBest, -1, TRUE) != PictFilterBest) return FALSE; if (PictureGetFilterId (FilterConvolution, -1, TRUE) != PictFilterConvolution) return FALSE; return TRUE; } char * PictureGetFilterName (int id) { if (0 <= id && id < nfilterNames) return filterNames[id]; else return 0; } static void PictureFreeFilterIds (void) { int i; for (i = 0; i < nfilterNames; i++) free (filterNames[i]); free (filterNames); nfilterNames = 0; filterNames = 0; } int PictureAddFilter (ScreenPtr pScreen, char *filter, PictFilterValidateParamsProcPtr ValidateParams) { PictureScreenPtr ps = GetPictureScreen(pScreen); int id = PictureGetFilterId (filter, -1, TRUE); int i; PictFilterPtr filters; if (id < 0) return -1; /* * It's an error to attempt to reregister a filter */ for (i = 0; i < ps->nfilters; i++) if (ps->filters[i].id == id) return -1; if (ps->filters) filters = realloc (ps->filters, (ps->nfilters + 1) * sizeof (PictFilterRec)); else filters = malloc (sizeof (PictFilterRec)); if (!filters) return -1; ps->filters = filters; i = ps->nfilters++; ps->filters[i].name = PictureGetFilterName (id); ps->filters[i].id = id; ps->filters[i].ValidateParams = ValidateParams; return id; } Bool PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias) { PictureScreenPtr ps = GetPictureScreen(pScreen); int filter_id = PictureGetFilterId (filter, -1, FALSE); int alias_id = PictureGetFilterId (alias, -1, TRUE); int i; if (filter_id < 0 || alias_id < 0) return FALSE; for (i = 0; i < ps->nfilterAliases; i++) if (ps->filterAliases[i].alias_id == alias_id) break; if (i == ps->nfilterAliases) { PictFilterAliasPtr aliases; if (ps->filterAliases) aliases = realloc (ps->filterAliases, (ps->nfilterAliases + 1) * sizeof (PictFilterAliasRec)); else aliases = malloc (sizeof (PictFilterAliasRec)); if (!aliases) return FALSE; ps->filterAliases = aliases; ps->filterAliases[i].alias = PictureGetFilterName (alias_id); ps->filterAliases[i].alias_id = alias_id; ps->nfilterAliases++; } ps->filterAliases[i].filter_id = filter_id; return TRUE; } PictFilterPtr PictureFindFilter (ScreenPtr pScreen, char *name, int len) { PictureScreenPtr ps = GetPictureScreen(pScreen); int id = PictureGetFilterId (name, len, FALSE); int i; if (id < 0) return 0; /* Check for an alias, allow them to recurse */ for (i = 0; i < ps->nfilterAliases; i++) if (ps->filterAliases[i].alias_id == id) { id = ps->filterAliases[i].filter_id; i = 0; } /* find the filter */ for (i = 0; i < ps->nfilters; i++) if (ps->filters[i].id == id) return &ps->filters[i]; return 0; } static Bool convolutionFilterValidateParams (ScreenPtr pScreen, int filter, xFixed *params, int nparams, int* width, int* height) { int w, h; if (nparams < 3) return FALSE; if (xFixedFrac (params[0]) || xFixedFrac (params[1])) return FALSE; w = xFixedToInt (params[0]); h = xFixedToInt (params[1]); nparams -= 2; if (w * h > nparams) return FALSE; *width = w; *height = h; return TRUE; } Bool PictureSetDefaultFilters (ScreenPtr pScreen) { if (!filterNames) if (!PictureSetDefaultIds ()) return FALSE; if (PictureAddFilter (pScreen, FilterNearest, 0) < 0) return FALSE; if (PictureAddFilter (pScreen, FilterBilinear, 0) < 0) return FALSE; if (!PictureSetFilterAlias (pScreen, FilterNearest, FilterFast)) return FALSE; if (!PictureSetFilterAlias (pScreen, FilterBilinear, FilterGood)) return FALSE; if (!PictureSetFilterAlias (pScreen, FilterBilinear, FilterBest)) return FALSE; if (PictureAddFilter (pScreen, FilterConvolution, convolutionFilterValidateParams) < 0) return FALSE; return TRUE; } void PictureResetFilters (ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreen(pScreen); free (ps->filters); free (ps->filterAliases); PictureFreeFilterIds (); } int SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams) { PictFilterPtr pFilter; ScreenPtr pScreen; if (pPicture->pDrawable) { pScreen = pPicture->pDrawable->pScreen; } else { pScreen = screenInfo.screens[0]; } pFilter = PictureFindFilter (pScreen, name, len); if (!pFilter) return BadName; if (pPicture->pDrawable == NULL) { int s; /* For source pictures, the picture isn't tied to a screen. So, ensure * that all screens can handle a filter we set for the picture. */ for (s = 1; s < screenInfo.numScreens; s++) { PictFilterPtr pScreenFilter; pScreenFilter = PictureFindFilter(screenInfo.screens[s], name, len); if (!pScreenFilter || pScreenFilter->id != pFilter->id) return BadMatch; } } return SetPicturePictFilter (pPicture, pFilter, params, nparams); } int SetPicturePictFilter (PicturePtr pPicture, PictFilterPtr pFilter, xFixed *params, int nparams) { ScreenPtr pScreen; int i; if (pPicture->pDrawable) pScreen = pPicture->pDrawable->pScreen; else pScreen = screenInfo.screens[0]; if (pFilter->ValidateParams) { int width, height; if (!(*pFilter->ValidateParams) (pScreen, pFilter->id, params, nparams, &width, &height)) return BadMatch; } else if (nparams) { return BadMatch; } if (nparams != pPicture->filter_nparams) { xFixed *new_params = malloc (nparams * sizeof (xFixed)); if (!new_params && nparams) return BadAlloc; free (pPicture->filter_params); pPicture->filter_params = new_params; pPicture->filter_nparams = nparams; } for (i = 0; i < nparams; i++) pPicture->filter_params[i] = params[i]; pPicture->filter = pFilter->id; if (pPicture->pDrawable) { PictureScreenPtr ps = GetPictureScreen(pScreen); int result; result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter, params, nparams); return result; } pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/glyph.c0000644000000000000000000004443113614532331017347 0ustar /* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "misc.h" #include "scrnintstr.h" #include "os.h" #include "regionstr.h" #include "validate.h" #include "windowstr.h" #include "input.h" #include "resource.h" #include "colormapst.h" #include "cursorstr.h" #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" #include "picturestr.h" #include "glyphstr.h" #include "mipict.h" #include /* * From Knuth -- a good choice for hash/rehash values is p, p-2 where * p and p-2 are both prime. These tables are sized to have an extra 10% * free to avoid exponential performance degradation as the hash table fills */ static GlyphHashSetRec glyphHashSets[] = { { 32, 43, 41 }, { 64, 73, 71 }, { 128, 151, 149 }, { 256, 283, 281 }, { 512, 571, 569 }, { 1024, 1153, 1151 }, { 2048, 2269, 2267 }, { 4096, 4519, 4517 }, { 8192, 9013, 9011 }, { 16384, 18043, 18041 }, { 32768, 36109, 36107 }, { 65536, 72091, 72089 }, { 131072, 144409, 144407 }, { 262144, 288361, 288359 }, { 524288, 576883, 576881 }, { 1048576, 1153459, 1153457 }, { 2097152, 2307163, 2307161 }, { 4194304, 4613893, 4613891 }, { 8388608, 9227641, 9227639 }, { 16777216, 18455029, 18455027 }, { 33554432, 36911011, 36911009 }, { 67108864, 73819861, 73819859 }, { 134217728, 147639589, 147639587 }, { 268435456, 295279081, 295279079 }, { 536870912, 590559793, 590559791 } }; #define NGLYPHHASHSETS (sizeof(glyphHashSets)/sizeof(glyphHashSets[0])) const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 }; GlyphHashRec globalGlyphs[GlyphFormatNum]; GlyphHashSetPtr FindGlyphHashSet (CARD32 filled) { int i; for (i = 0; i < NGLYPHHASHSETS; i++) if (glyphHashSets[i].entries >= filled) return &glyphHashSets[i]; return 0; } static int _GlyphSetPrivateAllocateIndex = 0; int AllocateGlyphSetPrivateIndex (void) { return _GlyphSetPrivateAllocateIndex++; } void ResetGlyphSetPrivateIndex (void) { _GlyphSetPrivateAllocateIndex = 0; } Bool _GlyphSetSetNewPrivate (GlyphSetPtr glyphSet, int n, void * ptr) { void **new; if (n > glyphSet->maxPrivate) { if (glyphSet->devPrivates && glyphSet->devPrivates != (void *)(&glyphSet[1])) { new = (void **) realloc (glyphSet->devPrivates, (n + 1) * sizeof (void *)); if (!new) return FALSE; } else { new = (void **) malloc ((n + 1) * sizeof (void *)); if (!new) return FALSE; if (glyphSet->devPrivates) memcpy (new, glyphSet->devPrivates, (glyphSet->maxPrivate + 1) * sizeof (void *)); } glyphSet->devPrivates = new; /* Zero out new, uninitialize privates */ while (++glyphSet->maxPrivate < n) glyphSet->devPrivates[glyphSet->maxPrivate] = (void *)0; } glyphSet->devPrivates[n] = ptr; return TRUE; } Bool GlyphInit (ScreenPtr pScreen) { return TRUE; } #ifndef NXAGENT_SERVER GlyphRefPtr FindGlyphRef (GlyphHashPtr hash, CARD32 signature, Bool match, GlyphPtr compare) { CARD32 elt, step, s; GlyphPtr glyph; GlyphRefPtr table, gr, del; CARD32 tableSize = hash->hashSet->size; table = hash->table; elt = signature % tableSize; step = 0; del = 0; for (;;) { gr = &table[elt]; s = gr->signature; glyph = gr->glyph; if (!glyph) { if (del) gr = del; break; } if (glyph == DeletedGlyph) { if (!del) del = gr; else if (gr == del) break; } else if (s == signature && (!match || memcmp (&compare->info, &glyph->info, compare->size) == 0)) { break; } if (!step) { step = signature % hash->hashSet->rehash; if (!step) step = 1; } elt += step; if (elt >= tableSize) elt -= tableSize; } return gr; } #endif CARD32 HashGlyph (GlyphPtr glyph) { CARD32 *bits = (CARD32 *) &(glyph->info); CARD32 hash; int n = glyph->size / sizeof (CARD32); hash = 0; while (n--) hash ^= *bits++; return hash; } #ifdef CHECK_DUPLICATES void DuplicateRef (GlyphPtr glyph, char *where) { ErrorF ("Duplicate Glyph 0x%x from %s\n", glyph, where); } void CheckDuplicates (GlyphHashPtr hash, char *where) { GlyphPtr g; int i, j; for (i = 0; i < hash->hashSet->size; i++) { g = hash->table[i].glyph; if (!g || g == DeletedGlyph) continue; for (j = i + 1; j < hash->hashSet->size; j++) if (hash->table[j].glyph == g) DuplicateRef (g, where); } } #else #define CheckDuplicates(a,b) #define DuplicateRef(a,b) #endif void FreeGlyph (GlyphPtr glyph, int format) { CheckDuplicates (&globalGlyphs[format], "FreeGlyph"); if (--glyph->refcnt == 0) { GlyphRefPtr gr; int i; int first; first = -1; for (i = 0; i < globalGlyphs[format].hashSet->size; i++) if (globalGlyphs[format].table[i].glyph == glyph) { if (first != -1) DuplicateRef (glyph, "FreeGlyph check"); first = i; } gr = FindGlyphRef (&globalGlyphs[format], HashGlyph (glyph), TRUE, glyph); if (gr - globalGlyphs[format].table != first) DuplicateRef (glyph, "Found wrong one"); if (gr->glyph && gr->glyph != DeletedGlyph) { gr->glyph = DeletedGlyph; gr->signature = 0; globalGlyphs[format].tableEntries--; } free (glyph); } } #ifndef NXAGENT_SERVER void AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id) { GlyphRefPtr gr; CARD32 hash; CheckDuplicates (&globalGlyphs[glyphSet->fdepth], "AddGlyph top global"); /* Locate existing matching glyph */ hash = HashGlyph (glyph); gr = FindGlyphRef (&globalGlyphs[glyphSet->fdepth], hash, TRUE, glyph); if (gr->glyph && gr->glyph != DeletedGlyph) { free (glyph); glyph = gr->glyph; } else { gr->glyph = glyph; gr->signature = hash; globalGlyphs[glyphSet->fdepth].tableEntries++; } /* Insert/replace glyphset value */ gr = FindGlyphRef (&glyphSet->hash, id, FALSE, 0); ++glyph->refcnt; if (gr->glyph && gr->glyph != DeletedGlyph) FreeGlyph (gr->glyph, glyphSet->fdepth); else glyphSet->hash.tableEntries++; gr->glyph = glyph; gr->signature = id; CheckDuplicates (&globalGlyphs[glyphSet->fdepth], "AddGlyph bottom"); } #endif /* NXAGENT_SERVER */ Bool DeleteGlyph (GlyphSetPtr glyphSet, Glyph id) { GlyphRefPtr gr; GlyphPtr glyph; gr = FindGlyphRef (&glyphSet->hash, id, FALSE, 0); glyph = gr->glyph; if (glyph && glyph != DeletedGlyph) { gr->glyph = DeletedGlyph; glyphSet->hash.tableEntries--; FreeGlyph (glyph, glyphSet->fdepth); return TRUE; } return FALSE; } #ifndef NXAGENT_SERVER GlyphPtr FindGlyph (GlyphSetPtr glyphSet, Glyph id) { GlyphPtr glyph; glyph = FindGlyphRef (&glyphSet->hash, id, FALSE, 0)->glyph; if (glyph == DeletedGlyph) glyph = 0; return glyph; } #endif /* NXAGENT_SERVER */ GlyphPtr AllocateGlyph (xGlyphInfo *gi, int fdepth) { int size; GlyphPtr glyph; size_t padded_width; padded_width = PixmapBytePad (gi->width, glyphDepths[fdepth]); if (gi->height && padded_width > (UINT32_MAX - sizeof(GlyphRec))/gi->height) return 0; size = gi->height * padded_width; glyph = (GlyphPtr) malloc (size + sizeof (GlyphRec)); if (!glyph) return 0; glyph->refcnt = 0; glyph->size = size + sizeof (xGlyphInfo); glyph->info = *gi; return glyph; } Bool AllocateGlyphHash (GlyphHashPtr hash, GlyphHashSetPtr hashSet) { hash->table = (GlyphRefPtr) malloc (hashSet->size * sizeof (GlyphRefRec)); if (!hash->table) return FALSE; memset (hash->table, 0, hashSet->size * sizeof (GlyphRefRec)); hash->hashSet = hashSet; hash->tableEntries = 0; return TRUE; } #ifndef NXAGENT_SERVER Bool ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global) { CARD32 tableEntries; GlyphHashSetPtr hashSet; GlyphHashRec newHash; GlyphRefPtr gr; GlyphPtr glyph; int i; int oldSize; CARD32 s; tableEntries = hash->tableEntries + change; hashSet = FindGlyphHashSet (tableEntries); if (hashSet == hash->hashSet) return TRUE; if (global) CheckDuplicates (hash, "ResizeGlyphHash top"); if (!AllocateGlyphHash (&newHash, hashSet)) return FALSE; if (hash->table) { oldSize = hash->hashSet->size; for (i = 0; i < oldSize; i++) { glyph = hash->table[i].glyph; if (glyph && glyph != DeletedGlyph) { s = hash->table[i].signature; gr = FindGlyphRef (&newHash, s, global, glyph); gr->signature = s; gr->glyph = glyph; ++newHash.tableEntries; } } free (hash->table); } *hash = newHash; if (global) CheckDuplicates (hash, "ResizeGlyphHash bottom"); return TRUE; } #endif /* NXAGENT_SERVER */ Bool ResizeGlyphSet (GlyphSetPtr glyphSet, CARD32 change) { return (ResizeGlyphHash (&glyphSet->hash, change, FALSE) && ResizeGlyphHash (&globalGlyphs[glyphSet->fdepth], change, TRUE)); } GlyphSetPtr AllocateGlyphSet (int fdepth, PictFormatPtr format) { GlyphSetPtr glyphSet; int size; if (!globalGlyphs[fdepth].hashSet) { if (!AllocateGlyphHash (&globalGlyphs[fdepth], &glyphHashSets[0])) return FALSE; } size = (sizeof (GlyphSetRec) + (sizeof (void *) * _GlyphSetPrivateAllocateIndex)); glyphSet = malloc (size); if (!glyphSet) return FALSE; bzero((char *)glyphSet, size); glyphSet->maxPrivate = _GlyphSetPrivateAllocateIndex - 1; if (_GlyphSetPrivateAllocateIndex) glyphSet->devPrivates = (void *)(&glyphSet[1]); if (!AllocateGlyphHash (&glyphSet->hash, &glyphHashSets[0])) { free (glyphSet); return FALSE; } glyphSet->refcnt = 1; glyphSet->fdepth = fdepth; glyphSet->format = format; return glyphSet; } int FreeGlyphSet (void *value, XID gid) { GlyphSetPtr glyphSet = (GlyphSetPtr) value; if (--glyphSet->refcnt == 0) { CARD32 i, tableSize = glyphSet->hash.hashSet->size; GlyphRefPtr table = glyphSet->hash.table; GlyphPtr glyph; for (i = 0; i < tableSize; i++) { glyph = table[i].glyph; if (glyph && glyph != DeletedGlyph) FreeGlyph (glyph, glyphSet->fdepth); } if (!globalGlyphs[glyphSet->fdepth].tableEntries) { free (globalGlyphs[glyphSet->fdepth].table); globalGlyphs[glyphSet->fdepth].table = 0; globalGlyphs[glyphSet->fdepth].hashSet = 0; } else ResizeGlyphHash (&globalGlyphs[glyphSet->fdepth], 0, TRUE); free (table); if (glyphSet->devPrivates && glyphSet->devPrivates != (void *)(&glyphSet[1])) free(glyphSet->devPrivates); free (glyphSet); } return Success; } void GlyphExtents(int nlist, GlyphListPtr list, GlyphPtr * glyphs, BoxPtr extents) { int x1, x2, y1, y2; int n; GlyphPtr glyph; int x, y; x = 0; y = 0; extents->x1 = MAXSHORT; extents->x2 = MINSHORT; extents->y1 = MAXSHORT; extents->y2 = MINSHORT; while (nlist--) { x += list->xOff; y += list->yOff; n = list->len; list++; while (n--) { glyph = *glyphs++; x1 = x - glyph->info.x; if (x1 < MINSHORT) x1 = MINSHORT; y1 = y - glyph->info.y; if (y1 < MINSHORT) y1 = MINSHORT; x2 = x1 + glyph->info.width; if (x2 > MAXSHORT) x2 = MAXSHORT; y2 = y1 + glyph->info.height; if (y2 > MAXSHORT) y2 = MAXSHORT; if (x1 < extents->x1) extents->x1 = x1; if (x2 > extents->x2) extents->x2 = x2; if (y1 < extents->y1) extents->y1 = y1; if (y2 > extents->y2) extents->y2 = y2; x += glyph->info.xOff; y += glyph->info.yOff; } } } #define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0) void CompositeGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr lists, GlyphPtr * glyphs) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); ValidatePicture(pSrc); ValidatePicture(pDst); (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, lists, glyphs); } #ifndef NXAGENT_SERVER void miGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs) { PixmapPtr pPixmap = 0; PicturePtr pPicture; PixmapPtr pMaskPixmap = 0; PicturePtr pMask; ScreenPtr pScreen = pDst->pDrawable->pScreen; int width = 0, height = 0; int x, y; int xDst = list->xOff, yDst = list->yOff; int n; GlyphPtr glyph; int error; BoxRec extents; CARD32 component_alpha; if (maskFormat) { GCPtr pGC; xRectangle rect; GlyphExtents(nlist, list, glyphs, &extents); if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1) return; width = extents.x2 - extents.x1; height = extents.y2 - extents.y1; pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, maskFormat->depth, CREATE_PIXMAP_USAGE_SCRATCH); if (!pMaskPixmap) return; component_alpha = NeedsComponent(maskFormat->format); pMask = CreatePicture(0, &pMaskPixmap->drawable, maskFormat, CPComponentAlpha, &component_alpha, serverClient, &error); if (!pMask) { (*pScreen->DestroyPixmap) (pMaskPixmap); return; } pGC = GetScratchGC(pMaskPixmap->drawable.depth, pScreen); ValidateGC(&pMaskPixmap->drawable, pGC); rect.x = 0; rect.y = 0; rect.width = width; rect.height = height; (*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect); FreeScratchGC(pGC); x = -extents.x1; y = -extents.y1; } else { pMask = pDst; x = 0; y = 0; } pPicture = 0; while (nlist--) { x += list->xOff; y += list->yOff; n = list->len; while (n--) { glyph = *glyphs++; if (!pPicture) { pPixmap = GetScratchPixmapHeader(pScreen, glyph->info.width, glyph->info.height, list->format->depth, list->format->depth, 0, (void *) (glyph + 1)); if (!pPixmap) return; component_alpha = NeedsComponent(list->format->format); pPicture = CreatePicture(0, &pPixmap->drawable, list->format, CPComponentAlpha, &component_alpha, serverClient, &error); if (!pPicture) { FreeScratchPixmapHeader(pPixmap); return; } } (*pScreen->ModifyPixmapHeader) (pPixmap, glyph->info.width, glyph->info.height, 0, 0, -1, (void *) (glyph + 1)); pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (maskFormat) { CompositePicture(PictOpAdd, pPicture, None, pMask, 0, 0, 0, 0, x - glyph->info.x, y - glyph->info.y, glyph->info.width, glyph->info.height); } else { CompositePicture(op, pSrc, pPicture, pDst, xSrc + (x - glyph->info.x) - xDst, ySrc + (y - glyph->info.y) - yDst, 0, 0, x - glyph->info.x, y - glyph->info.y, glyph->info.width, glyph->info.height); } x += glyph->info.xOff; y += glyph->info.yOff; } list++; if (pPicture) { FreeScratchPixmapHeader(pPixmap); FreePicture((void *) pPicture, 0); pPicture = 0; pPixmap = 0; } } if (maskFormat) { x = extents.x1; y = extents.y1; CompositePicture(op, pSrc, pMask, pDst, xSrc + x - xDst, ySrc + y - yDst, 0, 0, x, y, width, height); FreePicture((void *) pMask, (XID) 0); (*pScreen->DestroyPixmap) (pMaskPixmap); } } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/glyphstr.h0000644000000000000000000000755613614532331020114 0ustar /* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifndef _GLYPHSTR_H_ #define _GLYPHSTR_H_ #include #include "picture.h" #include "screenint.h" #define GlyphFormat1 0 #define GlyphFormat4 1 #define GlyphFormat8 2 #define GlyphFormat16 3 #define GlyphFormat32 4 #define GlyphFormatNum 5 typedef struct _Glyph { CARD32 refcnt; CARD32 size; /* info + bitmap */ xGlyphInfo info; /* bits follow */ } GlyphRec, *GlyphPtr; #ifdef NXAGENT_SERVER #include "../hw/nxagent/NXglyphstr_GlyphRef.h" #else typedef struct _GlyphRef { CARD32 signature; GlyphPtr glyph; } GlyphRefRec, *GlyphRefPtr; #endif /* NXAGENT_SERVER */ #define DeletedGlyph ((GlyphPtr) 1) typedef struct _GlyphHashSet { CARD32 entries; CARD32 size; CARD32 rehash; } GlyphHashSetRec, *GlyphHashSetPtr; typedef struct _GlyphHash { GlyphRefPtr table; GlyphHashSetPtr hashSet; CARD32 tableEntries; } GlyphHashRec, *GlyphHashPtr; #ifdef NXAGENT_SERVER #include "../hw/nxagent/NXglyphstr_GlyphSet.h" #else typedef struct _GlyphSet { CARD32 refcnt; PictFormatPtr format; int fdepth; GlyphHashRec hash; int maxPrivate; void **devPrivates; } GlyphSetRec, *GlyphSetPtr; #endif /* NXAGENT_SERVER */ #define GlyphSetGetPrivate(pGlyphSet,n) \ ((n) > (pGlyphSet)->maxPrivate ? \ (void *) 0 : \ (pGlyphSet)->devPrivates[n]) #define GlyphSetSetPrivate(pGlyphSet,n,ptr) \ ((n) > (pGlyphSet)->maxPrivate ? \ _GlyphSetSetNewPrivate(pGlyphSet, n, ptr) : \ ((((pGlyphSet)->devPrivates[n] = (ptr)) != 0) || TRUE)) typedef struct _GlyphList { INT16 xOff; INT16 yOff; CARD8 len; PictFormatPtr format; } GlyphListRec, *GlyphListPtr; extern GlyphHashRec globalGlyphs[GlyphFormatNum]; GlyphHashSetPtr FindGlyphHashSet (CARD32 filled); int AllocateGlyphSetPrivateIndex (void); void ResetGlyphSetPrivateIndex (void); Bool _GlyphSetSetNewPrivate (GlyphSetPtr glyphSet, int n, void * ptr); Bool GlyphInit (ScreenPtr pScreen); GlyphRefPtr FindGlyphRef (GlyphHashPtr hash, CARD32 signature, Bool match, GlyphPtr compare); CARD32 HashGlyph (GlyphPtr glyph); void FreeGlyph (GlyphPtr glyph, int format); void AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id); Bool DeleteGlyph (GlyphSetPtr glyphSet, Glyph id); GlyphPtr FindGlyph (GlyphSetPtr glyphSet, Glyph id); GlyphPtr AllocateGlyph (xGlyphInfo *gi, int format); Bool AllocateGlyphHash (GlyphHashPtr hash, GlyphHashSetPtr hashSet); Bool ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global); Bool ResizeGlyphSet (GlyphSetPtr glyphSet, CARD32 change); GlyphSetPtr AllocateGlyphSet (int fdepth, PictFormatPtr format); int FreeGlyphSet (void *value, XID gid); #endif /* _GLYPHSTR_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/Imakefile0000644000000000000000000000350313614532331017664 0ustar NULL = #include #if (!(defined(NXAgentServer) && NXAgentServer)) NXAGENT_SKIP_SRCS = \ glyph.c \ mitrap.c \ picture.c \ render.c \ $(NULL) NXAGENT_SKIP_OBJS = \ glyph.o \ mitrap.o \ picture.o \ render.o \ $(NULL) #else NX_DEFINES = -DNXAGENT_SERVER #endif SRCS = animcur.c \ filter.c \ glyph.c \ matrix.c \ miindex.c \ mipict.c \ mirect.c \ mitri.c \ renderedge.c \ $(NXAGENT_SKIP_SRCS) \ $(NULL) OBJS = animcur.o \ filter.o \ glyph.o \ matrix.o \ miindex.o \ mipict.o \ mirect.o \ mitri.o \ renderedge.o \ $(NXAGENT_SKIP_OBJS) \ $(NULL) INCLUDES = -I. -I../include -I../mi \ -I../fb -I$(EXTINCSRC) -I$(XINCLUDESRC) \ -I../Xext \ `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln DEFINES = \ $(NX_DEFINES) \ $(NULL) NormalLibraryTarget(render,$(OBJS)) NormalLibraryObjectRule() LintLibraryTarget(render,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() InstallDriverSDKNonExecFile(glyphstr.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(mipict.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(picture.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(picturestr.h,$(DRIVERSDKINCLUDEDIR)) nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/matrix.c0000644000000000000000000000547013614532331017530 0ustar /* * Copyright © 2007 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting documentation, and * that the name of the copyright holders not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. The copyright holders make no representations * about the suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "misc.h" #include "scrnintstr.h" #include "os.h" #include "regionstr.h" #include "validate.h" #include "windowstr.h" #include "input.h" #include "resource.h" #include "colormapst.h" #include "cursorstr.h" #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" #include "picturestr.h" void PictTransform_from_xRenderTransform(PictTransformPtr pict, xRenderTransform * render) { pict->matrix[0][0] = render->matrix11; pict->matrix[0][1] = render->matrix12; pict->matrix[0][2] = render->matrix13; pict->matrix[1][0] = render->matrix21; pict->matrix[1][1] = render->matrix22; pict->matrix[1][2] = render->matrix23; pict->matrix[2][0] = render->matrix31; pict->matrix[2][1] = render->matrix32; pict->matrix[2][2] = render->matrix33; } void xRenderTransform_from_PictTransform(xRenderTransform * render, PictTransformPtr pict) { render->matrix11 = pict->matrix[0][0]; render->matrix12 = pict->matrix[0][1]; render->matrix13 = pict->matrix[0][2]; render->matrix21 = pict->matrix[1][0]; render->matrix22 = pict->matrix[1][1]; render->matrix23 = pict->matrix[1][2]; render->matrix31 = pict->matrix[2][0]; render->matrix32 = pict->matrix[2][1]; render->matrix33 = pict->matrix[2][2]; } Bool PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector) { return pixman_transform_point(transform, vector); } Bool PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector) { return pixman_transform_point_3d(transform, vector); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/miindex.c0000644000000000000000000002032213614532331017652 0ustar /* * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _MIINDEX_H_ #define _MIINDEX_H_ #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "mi.h" #include "picturestr.h" #include "mipict.h" #include "colormapst.h" #define NUM_CUBE_LEVELS 4 #define NUM_GRAY_LEVELS 13 static Bool miBuildRenderColormap (ColormapPtr pColormap, Pixel *pixels, int *nump) { int r, g, b; unsigned short red, green, blue; Pixel pixel; Bool used[MI_MAX_INDEXED]; int needed; int policy; int cube, gray; int i, n; if (pColormap->mid != pColormap->pScreen->defColormap) { policy = PictureCmapPolicyAll; } else { int avail = pColormap->pVisual->ColormapEntries; policy = PictureCmapPolicy; if (policy == PictureCmapPolicyDefault) { if (avail >= 256 && (pColormap->pVisual->class|DynamicClass) == PseudoColor) policy = PictureCmapPolicyColor; else if (avail >= 64) policy = PictureCmapPolicyGray; else policy = PictureCmapPolicyMono; } } /* * Make sure enough cells are free for the chosen policy */ for (;;) { switch (policy) { case PictureCmapPolicyAll: needed = 0; break; case PictureCmapPolicyColor: needed = 71; break; case PictureCmapPolicyGray: needed = 11; break; case PictureCmapPolicyMono: default: needed = 0; break; } if (needed <= pColormap->freeRed) break; policy--; } /* * Compute size of cube and gray ramps */ cube = gray = 0; switch (policy) { case PictureCmapPolicyAll: /* * Allocate as big a cube as possible */ if ((pColormap->pVisual->class|DynamicClass) == PseudoColor) { for (cube = 1; cube * cube * cube < pColormap->pVisual->ColormapEntries; cube++) ; cube--; if (cube == 1) cube = 0; } else cube = 0; /* * Figure out how many gray levels to use so that they * line up neatly with the cube */ if (cube) { needed = pColormap->pVisual->ColormapEntries - (cube*cube*cube); /* levels to fill in with */ gray = needed / (cube - 1); /* total levels */ gray = (gray + 1) * (cube - 1) + 1; } else gray = pColormap->pVisual->ColormapEntries; break; case PictureCmapPolicyColor: cube = NUM_CUBE_LEVELS; /* fall through ... */ case PictureCmapPolicyGray: gray = NUM_GRAY_LEVELS; break; case PictureCmapPolicyMono: default: gray = 2; break; } memset (used, '\0', pColormap->pVisual->ColormapEntries * sizeof (Bool)); for (r = 0; r < cube; r++) for (g = 0; g < cube; g++) for (b = 0; b < cube; b++) { red = (r * 65535 + (cube-1)/2) / (cube - 1); green = (g * 65535 + (cube-1)/2) / (cube - 1); blue = (b * 65535 + (cube-1)/2) / (cube - 1); if (AllocColor (pColormap, &red, &green, &blue, &pixel, 0) != Success) return FALSE; used[pixel] = TRUE; } for (g = 0; g < gray; g++) { red = green = blue = (g * 65535 + (gray-1)/2) / (gray - 1); if (AllocColor (pColormap, &red, &green, &blue, &pixel, 0) != Success) return FALSE; used[pixel] = TRUE; } n = 0; for (i = 0; i < pColormap->pVisual->ColormapEntries; i++) if (used[i]) pixels[n++] = i; *nump = n; return TRUE; } /* 0 <= red, green, blue < 32 */ static Pixel FindBestColor (miIndexedPtr pIndexed, Pixel *pixels, int num, int red, int green, int blue) { Pixel best = pixels[0]; int bestDist = 1 << 30; int dist; int dr, dg, db; while (num--) { Pixel pixel = *pixels++; CARD32 v = pIndexed->rgba[pixel]; dr = ((v >> 19) & 0x1f); dg = ((v >> 11) & 0x1f); db = ((v >> 3) & 0x1f); dr = dr - red; dg = dg - green; db = db - blue; dist = dr * dr + dg * dg + db * db; if (dist < bestDist) { bestDist = dist; best = pixel; } } return best; } /* 0 <= gray < 32768 */ static Pixel FindBestGray (miIndexedPtr pIndexed, Pixel *pixels, int num, int gray) { Pixel best = pixels[0]; int bestDist = 1 << 30; int dist; int dr; int r; while (num--) { Pixel pixel = *pixels++; CARD32 v = pIndexed->rgba[pixel]; r = v & 0xff; r = r | (r << 8); dr = gray - (r >> 1); dist = dr * dr; if (dist < bestDist) { bestDist = dist; best = pixel; } } return best; } Bool miInitIndexed (ScreenPtr pScreen, PictFormatPtr pFormat) { ColormapPtr pColormap = pFormat->index.pColormap; VisualPtr pVisual = pColormap->pVisual; miIndexedPtr pIndexed; Pixel pixels[MI_MAX_INDEXED]; xrgb rgb[MI_MAX_INDEXED]; int num; int i; Pixel p, r, g, b; if (pVisual->ColormapEntries > MI_MAX_INDEXED) return FALSE; if (pVisual->class & DynamicClass) { if (!miBuildRenderColormap (pColormap, pixels, &num)) return FALSE; } else { num = pVisual->ColormapEntries; for (p = 0; p < num; p++) pixels[p] = p; } pIndexed = malloc (sizeof (miIndexedRec)); if (!pIndexed) return FALSE; pFormat->index.nvalues = num; pFormat->index.pValues = malloc (num * sizeof (xIndexValue)); if (!pFormat->index.pValues) { free (pIndexed); return FALSE; } /* * Build mapping from pixel value to ARGB */ QueryColors (pColormap, num, pixels, rgb); for (i = 0; i < num; i++) { p = pixels[i]; pFormat->index.pValues[i].pixel = p; pFormat->index.pValues[i].red = rgb[i].red; pFormat->index.pValues[i].green = rgb[i].green; pFormat->index.pValues[i].blue = rgb[i].blue; pFormat->index.pValues[i].alpha = 0xffff; pIndexed->rgba[p] = (0xff000000 | ((rgb[i].red & 0xff00) << 8) | ((rgb[i].green & 0xff00) ) | ((rgb[i].blue & 0xff00) >> 8)); } /* * Build mapping from RGB to pixel value. This could probably be * done a bit quicker... */ switch (pVisual->class | DynamicClass) { case GrayScale: pIndexed->color = FALSE; for (r = 0; r < 32768; r++) pIndexed->ent[r] = FindBestGray (pIndexed, pixels, num, r); break; case PseudoColor: pIndexed->color = TRUE; p = 0; for (r = 0; r < 32; r++) for (g = 0; g < 32; g++) for (b = 0; b < 32; b++) { pIndexed->ent[p] = FindBestColor (pIndexed, pixels, num, r, g, b); p++; } break; } pFormat->index.devPrivate = pIndexed; return TRUE; } void miCloseIndexed (ScreenPtr pScreen, PictFormatPtr pFormat) { if (pFormat->index.devPrivate) { free (pFormat->index.devPrivate); pFormat->index.devPrivate = 0; } if (pFormat->index.pValues) { free (pFormat->index.pValues); pFormat->index.pValues = 0; } } void miUpdateIndexed (ScreenPtr pScreen, PictFormatPtr pFormat, int ndef, xColorItem *pdef) { miIndexedPtr pIndexed = pFormat->index.devPrivate; if (pIndexed) { while (ndef--) { pIndexed->rgba[pdef->pixel] = (0xff000000 | ((pdef->red & 0xff00) << 8) | ((pdef->green & 0xff00) ) | ((pdef->blue & 0xff00) >> 8)); pdef++; } } } #endif /* _MIINDEX_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/mipict.c0000644000000000000000000004114313614532331017506 0ustar /* * Copyright © 1999 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "mi.h" #include "picturestr.h" #include "mipict.h" #ifndef __GNUC__ #define __inline #endif int miCreatePicture (PicturePtr pPicture) { return Success; } void miDestroyPicture (PicturePtr pPicture) { if (pPicture->freeCompClip) RegionDestroy(pPicture->pCompositeClip); } void miDestroyPictureClip (PicturePtr pPicture) { switch (pPicture->clientClipType) { case CT_NONE: return; case CT_PIXMAP: (*pPicture->pDrawable->pScreen->DestroyPixmap) ((PixmapPtr) (pPicture->clientClip)); break; default: /* * we know we'll never have a list of rectangles, since ChangeClip * immediately turns them into a region */ RegionDestroy(pPicture->clientClip); break; } pPicture->clientClip = NULL; pPicture->clientClipType = CT_NONE; } int miChangePictureClip (PicturePtr pPicture, int type, void * value, int n) { ScreenPtr pScreen = pPicture->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); void * clientClip; int clientClipType; switch (type) { case CT_PIXMAP: /* convert the pixmap to a region */ clientClip = (void *) BitmapToRegion(pScreen, (PixmapPtr) value); if (!clientClip) return BadAlloc; clientClipType = CT_REGION; (*pScreen->DestroyPixmap) ((PixmapPtr) value); break; case CT_REGION: clientClip = value; clientClipType = CT_REGION; break; case CT_NONE: clientClip = 0; clientClipType = CT_NONE; break; default: clientClip = (void *) RegionFromRects(n, (xRectangle *) value, type); if (!clientClip) return BadAlloc; clientClipType = CT_REGION; free(value); break; } (*ps->DestroyPictureClip) (pPicture); pPicture->clientClip = clientClip; pPicture->clientClipType = clientClipType; pPicture->stateChanges |= CPClipMask; return Success; } void miChangePicture (PicturePtr pPicture, Mask mask) { return; } void miValidatePicture (PicturePtr pPicture, Mask mask) { DrawablePtr pDrawable = pPicture->pDrawable; if ((mask & (CPClipXOrigin|CPClipYOrigin|CPClipMask|CPSubwindowMode)) || (pDrawable->serialNumber != (pPicture->serialNumber & DRAWABLE_SERIAL_BITS))) { if (pDrawable->type == DRAWABLE_WINDOW) { WindowPtr pWin = (WindowPtr) pDrawable; RegionPtr pregWin; Bool freeTmpClip, freeCompClip; if (pPicture->subWindowMode == IncludeInferiors) { pregWin = NotClippedByChildren(pWin); freeTmpClip = TRUE; } else { pregWin = &pWin->clipList; freeTmpClip = FALSE; } freeCompClip = pPicture->freeCompClip; /* * if there is no client clip, we can get by with just keeping the * pointer we got, and remembering whether or not should destroy * (or maybe re-use) it later. this way, we avoid unnecessary * copying of regions. (this wins especially if many clients clip * by children and have no client clip.) */ if (pPicture->clientClipType == CT_NONE) { if (freeCompClip) RegionDestroy(pPicture->pCompositeClip); pPicture->pCompositeClip = pregWin; pPicture->freeCompClip = freeTmpClip; } else { /* * we need one 'real' region to put into the composite clip. if * pregWin the current composite clip are real, we can get rid of * one. if pregWin is real and the current composite clip isn't, * use pregWin for the composite clip. if the current composite * clip is real and pregWin isn't, use the current composite * clip. if neither is real, create a new region. */ RegionTranslate(pPicture->clientClip, pDrawable->x + pPicture->clipOrigin.x, pDrawable->y + pPicture->clipOrigin.y); if (freeCompClip) { RegionIntersect(pPicture->pCompositeClip, pregWin, pPicture->clientClip); if (freeTmpClip) RegionDestroy(pregWin); } else if (freeTmpClip) { RegionIntersect(pregWin, pregWin, pPicture->clientClip); pPicture->pCompositeClip = pregWin; } else { pPicture->pCompositeClip = RegionCreate(NullBox, 0); RegionIntersect(pPicture->pCompositeClip, pregWin, pPicture->clientClip); } pPicture->freeCompClip = TRUE; RegionTranslate(pPicture->clientClip, -(pDrawable->x + pPicture->clipOrigin.x), -(pDrawable->y + pPicture->clipOrigin.y)); } } /* end of composite clip for a window */ else { BoxRec pixbounds; /* XXX should we translate by drawable.x/y here ? */ /* If you want pixmaps in offscreen memory, yes */ pixbounds.x1 = pDrawable->x; pixbounds.y1 = pDrawable->y; pixbounds.x2 = pDrawable->x + pDrawable->width; pixbounds.y2 = pDrawable->y + pDrawable->height; if (pPicture->freeCompClip) { RegionReset(pPicture->pCompositeClip, &pixbounds); } else { pPicture->freeCompClip = TRUE; pPicture->pCompositeClip = RegionCreate(&pixbounds, 1); } if (pPicture->clientClipType == CT_REGION) { if(pDrawable->x || pDrawable->y) { RegionTranslate(pPicture->clientClip, pDrawable->x + pPicture->clipOrigin.x, pDrawable->y + pPicture->clipOrigin.y); RegionIntersect(pPicture->pCompositeClip, pPicture->pCompositeClip, pPicture->clientClip); RegionTranslate(pPicture->clientClip, -(pDrawable->x + pPicture->clipOrigin.x), -(pDrawable->y + pPicture->clipOrigin.y)); } else { RegionTranslate(pPicture->pCompositeClip, -pPicture->clipOrigin.x, -pPicture->clipOrigin.y); RegionIntersect(pPicture->pCompositeClip, pPicture->pCompositeClip, pPicture->clientClip); RegionTranslate(pPicture->pCompositeClip, pPicture->clipOrigin.x, pPicture->clipOrigin.y); } } } /* end of composite clip for pixmap */ } } int miChangePictureTransform (PicturePtr pPicture, PictTransform *transform) { return Success; } int miChangePictureFilter (PicturePtr pPicture, int filter, xFixed *params, int nparams) { return Success; } #define BOUND(v) (INT16) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v)) static __inline Bool miClipPictureReg (RegionPtr pRegion, RegionPtr pClip, int dx, int dy) { if (RegionNumRects(pRegion) == 1 && RegionNumRects(pClip) == 1) { BoxPtr pRbox = RegionRects(pRegion); BoxPtr pCbox = RegionRects(pClip); int v; if (pRbox->x1 < (v = pCbox->x1 + dx)) pRbox->x1 = BOUND(v); if (pRbox->x2 > (v = pCbox->x2 + dx)) pRbox->x2 = BOUND(v); if (pRbox->y1 < (v = pCbox->y1 + dy)) pRbox->y1 = BOUND(v); if (pRbox->y2 > (v = pCbox->y2 + dy)) pRbox->y2 = BOUND(v); if (pRbox->x1 >= pRbox->x2 || pRbox->y1 >= pRbox->y2) { RegionEmpty(pRegion); } } else if (!RegionNotEmpty(pClip)) return FALSE; else { if (dx || dy) RegionTranslate(pRegion, -dx, -dy); if (!RegionIntersect(pRegion, pRegion, pClip)) return FALSE; if (dx || dy) RegionTranslate(pRegion, dx, dy); } return RegionNotEmpty(pRegion); } static __inline Bool miClipPictureSrc (RegionPtr pRegion, PicturePtr pPicture, int dx, int dy) { /* XXX what to do with clipping from transformed pictures? */ if (pPicture->transform || !pPicture->pDrawable) return TRUE; if (pPicture->repeat) { if (pPicture->clientClipType != CT_NONE) { RegionTranslate(pRegion, dx - pPicture->clipOrigin.x, dy - pPicture->clipOrigin.y); if (!RegionIntersect(pRegion, pRegion, (RegionPtr) pPicture->clientClip)) return FALSE; RegionTranslate(pRegion, - (dx - pPicture->clipOrigin.x), - (dy - pPicture->clipOrigin.y)); } return TRUE; } else { return miClipPictureReg (pRegion, pPicture->pCompositeClip, dx, dy); } } static void miCompositeSourceValidate (PicturePtr pPicture, INT16 x, INT16 y, CARD16 width, CARD16 height) { DrawablePtr pDrawable = pPicture->pDrawable; ScreenPtr pScreen; if (!pDrawable) return; pScreen = pDrawable->pScreen; if (pScreen->SourceValidate) { x -= pPicture->pDrawable->x; y -= pPicture->pDrawable->y; if (pPicture->transform) { xPoint points[4]; int i; int xmin, ymin, xmax, ymax; #define VectorSet(i,_x,_y) { points[i].x = _x; points[i].y = _y; } VectorSet (0, x, y); VectorSet (1, x + width, y); VectorSet (2, x, y + height); VectorSet (3, x + width, y + height); xmin = ymin = 32767; xmax = ymax = -32737; for (i = 0; i < 4; i++) { PictVector t; t.vector[0] = IntToxFixed (points[i].x); t.vector[1] = IntToxFixed (points[i].y); t.vector[2] = xFixed1; if (PictureTransformPoint (pPicture->transform, &t)) { int tx = xFixedToInt (t.vector[0]); int ty = xFixedToInt (t.vector[1]); if (tx < xmin) xmin = tx; if (tx > xmax) xmax = tx; if (ty < ymin) ymin = ty; if (ty > ymax) ymax = ty; } } x = xmin; y = ymin; width = xmax - xmin; height = ymax - ymin; } (*pScreen->SourceValidate) (pDrawable, x, y, width, height); } } /* * returns FALSE if the final region is empty. Indistinguishable from * an allocation failure, but rendering ignores those anyways. */ Bool miComputeCompositeRegion (RegionPtr pRegion, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { int v; pRegion->extents.x1 = xDst; v = xDst + width; pRegion->extents.x2 = BOUND(v); pRegion->extents.y1 = yDst; v = yDst + height; pRegion->extents.y2 = BOUND(v); pRegion->data = 0; /* Check for empty operation */ if (pRegion->extents.x1 >= pRegion->extents.x2 || pRegion->extents.y1 >= pRegion->extents.y2) { RegionEmpty(pRegion); return FALSE; } /* clip against dst */ if (!miClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0)) { RegionUninit(pRegion); return FALSE; } if (pDst->alphaMap) { if (!miClipPictureReg (pRegion, pDst->alphaMap->pCompositeClip, -pDst->alphaOrigin.x, -pDst->alphaOrigin.y)) { RegionUninit(pRegion); return FALSE; } } /* clip against src */ if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc)) { RegionUninit(pRegion); return FALSE; } if (pSrc->alphaMap) { if (!miClipPictureSrc (pRegion, pSrc->alphaMap, xDst - (xSrc + pSrc->alphaOrigin.x), yDst - (ySrc + pSrc->alphaOrigin.y))) { RegionUninit(pRegion); return FALSE; } } /* clip against mask */ if (pMask) { if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask)) { RegionUninit(pRegion); return FALSE; } if (pMask->alphaMap) { if (!miClipPictureSrc (pRegion, pMask->alphaMap, xDst - (xMask + pMask->alphaOrigin.x), yDst - (yMask + pMask->alphaOrigin.y))) { RegionUninit(pRegion); return FALSE; } } } miCompositeSourceValidate (pSrc, xSrc, ySrc, width, height); if (pMask) miCompositeSourceValidate (pMask, xMask, yMask, width, height); return TRUE; } void miRenderColorToPixel (PictFormatPtr format, xRenderColor *color, CARD32 *pixel) { CARD32 r, g, b, a; miIndexedPtr pIndexed; switch (format->type) { case PictTypeDirect: r = color->red >> (16 - Ones (format->direct.redMask)); g = color->green >> (16 - Ones (format->direct.greenMask)); b = color->blue >> (16 - Ones (format->direct.blueMask)); a = color->alpha >> (16 - Ones (format->direct.alphaMask)); r = r << format->direct.red; g = g << format->direct.green; b = b << format->direct.blue; a = a << format->direct.alpha; *pixel = r|g|b|a; break; case PictTypeIndexed: pIndexed = (miIndexedPtr) (format->index.devPrivate); if (pIndexed->color) { r = color->red >> 11; g = color->green >> 11; b = color->blue >> 11; *pixel = miIndexToEnt15 (pIndexed, (r << 10) | (g << 5) | b); } else { r = color->red >> 8; g = color->green >> 8; b = color->blue >> 8; *pixel = miIndexToEntY24 (pIndexed, (r << 16) | (g << 8) | b); } break; } } static CARD16 miFillColor (CARD32 pixel, int bits) { while (bits < 16) { pixel |= pixel << bits; bits <<= 1; } return (CARD16) pixel; } Bool miIsSolidAlpha (PicturePtr pSrc) { ScreenPtr pScreen; char line[1]; if (!pSrc->pDrawable) return FALSE; pScreen = pSrc->pDrawable->pScreen; /* Alpha-only */ if (PICT_FORMAT_TYPE (pSrc->format) != PICT_TYPE_A) return FALSE; /* repeat */ if (!pSrc->repeat) return FALSE; /* 1x1 */ if (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1) return FALSE; line[0] = 1; (*pScreen->GetImage) (pSrc->pDrawable, 0, 0, 1, 1, ZPixmap, ~0L, line); switch (pSrc->pDrawable->bitsPerPixel) { case 1: return (CARD8) line[0] == 1 || (CARD8) line[0] == 0x80; case 4: return (CARD8) line[0] == 0xf || (CARD8) line[0] == 0xf0; case 8: return (CARD8) line[0] == 0xff; default: return FALSE; } } void miRenderPixelToColor (PictFormatPtr format, CARD32 pixel, xRenderColor *color) { CARD32 r, g, b, a; miIndexedPtr pIndexed; switch (format->type) { case PictTypeDirect: r = (pixel >> format->direct.red) & format->direct.redMask; g = (pixel >> format->direct.green) & format->direct.greenMask; b = (pixel >> format->direct.blue) & format->direct.blueMask; a = (pixel >> format->direct.alpha) & format->direct.alphaMask; color->red = miFillColor (r, Ones (format->direct.redMask)); color->green = miFillColor (g, Ones (format->direct.greenMask)); color->blue = miFillColor (b, Ones (format->direct.blueMask)); color->alpha = miFillColor (a, Ones (format->direct.alphaMask)); break; case PictTypeIndexed: pIndexed = (miIndexedPtr) (format->index.devPrivate); pixel = pIndexed->rgba[pixel & (MI_MAX_INDEXED-1)]; r = (pixel >> 16) & 0xff; g = (pixel >> 8) & 0xff; b = (pixel ) & 0xff; color->red = miFillColor (r, 8); color->green = miFillColor (g, 8); color->blue = miFillColor (b, 8); color->alpha = 0xffff; break; } } Bool miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) { PictureScreenPtr ps; if (!PictureInit (pScreen, formats, nformats)) return FALSE; ps = GetPictureScreen(pScreen); ps->CreatePicture = miCreatePicture; ps->DestroyPicture = miDestroyPicture; ps->ChangePictureClip = miChangePictureClip; ps->DestroyPictureClip = miDestroyPictureClip; ps->ChangePicture = miChangePicture; ps->ValidatePicture = miValidatePicture; ps->InitIndexed = miInitIndexed; ps->CloseIndexed = miCloseIndexed; ps->UpdateIndexed = miUpdateIndexed; ps->ChangePictureTransform = miChangePictureTransform; ps->ChangePictureFilter = miChangePictureFilter; /* MI rendering routines */ ps->Composite = 0; /* requires DDX support */ ps->Glyphs = miGlyphs; ps->CompositeRects = miCompositeRects; ps->Trapezoids = miTrapezoids; ps->Triangles = miTriangles; ps->TriStrip = miTriStrip; ps->TriFan = miTriFan; ps->RasterizeTrapezoid = 0; /* requires DDX support */ ps->AddTraps = 0; /* requires DDX support */ ps->AddTriangles = 0; /* requires DDX support */ return TRUE; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/mipict.h0000644000000000000000000001170013614532331017507 0ustar /* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifndef _MIPICT_H_ #define _MIPICT_H_ #include "picturestr.h" #define MI_MAX_INDEXED 256 /* XXX depth must be <= 8 */ #if MI_MAX_INDEXED <= 256 typedef CARD8 miIndexType; #endif typedef struct _miIndexed { Bool color; CARD32 rgba[MI_MAX_INDEXED]; miIndexType ent[32768]; } miIndexedRec, *miIndexedPtr; #define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \ (((s) >> 6) & 0x03e0) | \ (((s) >> 9) & 0x7c00)) #define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15]) #define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24)) #define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)]) int miCreatePicture (PicturePtr pPicture); void miDestroyPicture (PicturePtr pPicture); void miDestroyPictureClip (PicturePtr pPicture); int miChangePictureClip (PicturePtr pPicture, int type, void * value, int n); void miChangePicture (PicturePtr pPicture, Mask mask); void miValidatePicture (PicturePtr pPicture, Mask mask); int miChangePictureTransform (PicturePtr pPicture, PictTransform *transform); int miChangePictureFilter (PicturePtr pPicture, int filter, xFixed *params, int nparams); Bool miClipPicture (RegionPtr pRegion, PicturePtr pPicture, INT16 xReg, INT16 yReg, INT16 xPict, INT16 yPict); Bool miComputeCompositeRegion (RegionPtr pRegion, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); Bool miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); void miGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr *glyphs); void miRenderColorToPixel (PictFormatPtr pPict, xRenderColor *color, CARD32 *pixel); void miRenderPixelToColor (PictFormatPtr pPict, CARD32 pixel, xRenderColor *color); Bool miIsSolidAlpha (PicturePtr pSrc); void miCompositeRects (CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects); void miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box); void miTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps); void miPointFixedBounds (int npoint, xPointFixed *points, BoxPtr bounds); void miTriangleBounds (int ntri, xTriangle *tris, BoxPtr bounds); void miRasterizeTriangle (PicturePtr pMask, xTriangle *tri, int x_off, int y_off); void miTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntri, xTriangle *tris); void miTriStrip (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points); void miTriFan (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points); PicturePtr miCreateAlphaPicture (ScreenPtr pScreen, PicturePtr pDst, PictFormatPtr pPictFormat, CARD16 width, CARD16 height); Bool miInitIndexed (ScreenPtr pScreen, PictFormatPtr pFormat); void miCloseIndexed (ScreenPtr pScreen, PictFormatPtr pFormat); void miUpdateIndexed (ScreenPtr pScreen, PictFormatPtr pFormat, int ndef, xColorItem *pdef); #endif /* _MIPICT_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/mirect.c0000644000000000000000000001110713614532331017501 0ustar /* * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "mi.h" #include "picturestr.h" #include "mipict.h" static void miColorRects (PicturePtr pDst, PicturePtr pClipPict, xRenderColor *color, int nRect, xRectangle *rects, int xoff, int yoff) { ScreenPtr pScreen = pDst->pDrawable->pScreen; CARD32 pixel; GCPtr pGC; CARD32 tmpval[5]; RegionPtr pClip; unsigned long mask; miRenderColorToPixel (pDst->pFormat, color, &pixel); pGC = GetScratchGC (pDst->pDrawable->depth, pScreen); if (!pGC) return; tmpval[0] = GXcopy; tmpval[1] = pixel; tmpval[2] = pDst->subWindowMode; mask = GCFunction | GCForeground | GCSubwindowMode; if (pClipPict->clientClipType == CT_REGION) { tmpval[3] = pDst->clipOrigin.x - xoff; tmpval[4] = pDst->clipOrigin.y - yoff; mask |= GCClipXOrigin|GCClipYOrigin; pClip = RegionCreate(NULL, 1); RegionCopy(pClip, (RegionPtr) pClipPict->clientClip); (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0); } ChangeGC (pGC, mask, tmpval); ValidateGC (pDst->pDrawable, pGC); if (xoff || yoff) { int i; for (i = 0; i < nRect; i++) { rects[i].x -= xoff; rects[i].y -= yoff; } } (*pGC->ops->PolyFillRect) (pDst->pDrawable, pGC, nRect, rects); if (xoff || yoff) { int i; for (i = 0; i < nRect; i++) { rects[i].x += xoff; rects[i].y += yoff; } } FreeScratchGC (pGC); } void miCompositeRects (CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects) { ScreenPtr pScreen = pDst->pDrawable->pScreen; if (color->alpha == 0xffff) { if (op == PictOpOver) op = PictOpSrc; } if (op == PictOpClear) color->red = color->green = color->blue = color->alpha = 0; if (op == PictOpSrc || op == PictOpClear) { miColorRects (pDst, pDst, color, nRect, rects, 0, 0); if (pDst->alphaMap) miColorRects (pDst->alphaMap, pDst, color, nRect, rects, pDst->alphaOrigin.x, pDst->alphaOrigin.y); } else { PictFormatPtr rgbaFormat; PixmapPtr pPixmap; PicturePtr pSrc; xRectangle one; int error; Pixel pixel; GCPtr pGC; CARD32 tmpval[2]; rgbaFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8); if (!rgbaFormat) goto bail1; pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1, rgbaFormat->depth, CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) goto bail2; miRenderColorToPixel (rgbaFormat, color, &pixel); pGC = GetScratchGC (rgbaFormat->depth, pScreen); if (!pGC) goto bail3; tmpval[0] = GXcopy; tmpval[1] = pixel; ChangeGC (pGC, GCFunction | GCForeground, tmpval); ValidateGC (&pPixmap->drawable, pGC); one.x = 0; one.y = 0; one.width = 1; one.height = 1; (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one); tmpval[0] = xTrue; pSrc = CreatePicture (0, &pPixmap->drawable, rgbaFormat, CPRepeat, tmpval, 0, &error); if (!pSrc) goto bail4; while (nRect--) { CompositePicture (op, pSrc, 0, pDst, 0, 0, 0, 0, rects->x, rects->y, rects->width, rects->height); rects++; } FreePicture ((void *) pSrc, 0); bail4: FreeScratchGC (pGC); bail3: (*pScreen->DestroyPixmap) (pPixmap); bail2: bail1: ; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/mitrap.c0000644000000000000000000001241413614532331017514 0ustar /* * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "servermd.h" #include "mi.h" #include "picturestr.h" #include "mipict.h" PicturePtr miCreateAlphaPicture (ScreenPtr pScreen, PicturePtr pDst, PictFormatPtr pPictFormat, CARD16 width, CARD16 height) { PixmapPtr pPixmap; PicturePtr pPicture; GCPtr pGC; int error; xRectangle rect; if (width > 32767 || height > 32767) return 0; if (!pPictFormat) { if (pDst->polyEdge == PolyEdgeSharp) pPictFormat = PictureMatchFormat (pScreen, 1, PICT_a1); else pPictFormat = PictureMatchFormat (pScreen, 8, PICT_a8); if (!pPictFormat) return 0; } pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, pPictFormat->depth, 0); if (!pPixmap) return 0; pGC = GetScratchGC (pPixmap->drawable.depth, pScreen); if (!pGC) { (*pScreen->DestroyPixmap) (pPixmap); return 0; } ValidateGC (&pPixmap->drawable, pGC); rect.x = 0; rect.y = 0; rect.width = width; rect.height = height; (*pGC->ops->PolyFillRect)(&pPixmap->drawable, pGC, 1, &rect); FreeScratchGC (pGC); pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat, 0, 0, serverClient, &error); (*pScreen->DestroyPixmap) (pPixmap); return pPicture; } static xFixed miLineFixedX (xLineFixed *l, xFixed y, Bool ceil) { xFixed dx = l->p2.x - l->p1.x; xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx; xFixed dy = l->p2.y - l->p1.y; if (ceil) ex += (dy - 1); return l->p1.x + (xFixed) (ex / dy); } void miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box) { box->y1 = MAXSHORT; box->y2 = MINSHORT; box->x1 = MAXSHORT; box->x2 = MINSHORT; for (; ntrap; ntrap--, traps++) { INT16 x1, y1, x2, y2; if (!xTrapezoidValid(traps)) continue; y1 = xFixedToInt (traps->top); if (y1 < box->y1) box->y1 = y1; y2 = xFixedToInt (xFixedCeil (traps->bottom)); if (y2 > box->y2) box->y2 = y2; x1 = xFixedToInt (min (miLineFixedX (&traps->left, traps->top, FALSE), miLineFixedX (&traps->left, traps->bottom, FALSE))); if (x1 < box->x1) box->x1 = x1; x2 = xFixedToInt (xFixedCeil (max (miLineFixedX (&traps->right, traps->top, TRUE), miLineFixedX (&traps->right, traps->bottom, TRUE)))); if (x2 > box->x2) box->x2 = x2; } } #ifndef NXAGENT_SERVER void miTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps) { ScreenPtr pScreen = pDst->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); /* * Check for solid alpha add */ if (op == PictOpAdd && miIsSolidAlpha (pSrc)) { for (; ntrap; ntrap--, traps++) (*ps->RasterizeTrapezoid) (pDst, traps, 0, 0); } else if (maskFormat) { PicturePtr pPicture; BoxRec bounds; INT16 xDst, yDst; INT16 xRel, yRel; xDst = traps[0].left.p1.x >> 16; yDst = traps[0].left.p1.y >> 16; miTrapezoidBounds (ntrap, traps, &bounds); if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2) return; pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); if (!pPicture) return; for (; ntrap; ntrap--, traps++) (*ps->RasterizeTrapezoid) (pPicture, traps, -bounds.x1, -bounds.y1); xRel = bounds.x1 + xSrc - xDst; yRel = bounds.y1 + ySrc - yDst; CompositePicture (op, pSrc, pPicture, pDst, xRel, yRel, 0, 0, bounds.x1, bounds.y1, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); FreePicture (pPicture, 0); } else { if (pDst->polyEdge == PolyEdgeSharp) maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1); else maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8); for (; ntrap; ntrap--, traps++) miTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps); } } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/mitri.c0000644000000000000000000001213313614532331017342 0ustar /* * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "mi.h" #include "picturestr.h" #include "mipict.h" void miPointFixedBounds (int npoint, xPointFixed *points, BoxPtr bounds) { bounds->x1 = xFixedToInt (points->x); bounds->x2 = xFixedToInt (xFixedCeil (points->x)); bounds->y1 = xFixedToInt (points->y); bounds->y2 = xFixedToInt (xFixedCeil (points->y)); points++; npoint--; while (npoint-- > 0) { INT16 x1 = xFixedToInt (points->x); INT16 x2 = xFixedToInt (xFixedCeil (points->x)); INT16 y1 = xFixedToInt (points->y); INT16 y2 = xFixedToInt (xFixedCeil (points->y)); if (x1 < bounds->x1) bounds->x1 = x1; else if (x2 > bounds->x2) bounds->x2 = x2; if (y1 < bounds->y1) bounds->y1 = y1; else if (y2 > bounds->y2) bounds->y2 = y2; points++; } } void miTriangleBounds (int ntri, xTriangle *tris, BoxPtr bounds) { miPointFixedBounds (ntri * 3, (xPointFixed *) tris, bounds); } void miTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntri, xTriangle *tris) { ScreenPtr pScreen = pDst->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); /* * Check for solid alpha add */ if (op == PictOpAdd && miIsSolidAlpha (pSrc)) { (*ps->AddTriangles) (pDst, 0, 0, ntri, tris); } else if (maskFormat) { BoxRec bounds; PicturePtr pPicture; INT16 xDst, yDst; INT16 xRel, yRel; xDst = tris[0].p1.x >> 16; yDst = tris[0].p1.y >> 16; miTriangleBounds (ntri, tris, &bounds); if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) return; pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); if (!pPicture) return; (*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris); xRel = bounds.x1 + xSrc - xDst; yRel = bounds.y1 + ySrc - yDst; CompositePicture (op, pSrc, pPicture, pDst, xRel, yRel, 0, 0, bounds.x1, bounds.y1, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); FreePicture (pPicture, 0); } else { if (pDst->polyEdge == PolyEdgeSharp) maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1); else maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8); for (; ntri; ntri--, tris++) miTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, tris); } } void miTriStrip (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points) { ScreenPtr pScreen = pDst->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); xTriangle *tris, *tri; int ntri; if (npoint < 3) return; ntri = npoint - 2; tris = malloc (ntri * sizeof (xTriangle)); if (!tris) return; for (tri = tris; npoint >= 3; npoint--, points++, tri++) { tri->p1 = points[0]; tri->p2 = points[1]; tri->p3 = points[2]; } (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris); free (tris); } void miTriFan (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points) { ScreenPtr pScreen = pDst->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); xTriangle *tris, *tri; xPointFixed *first; int ntri; if (npoint < 3) return; ntri = npoint - 2; tris = malloc (ntri * sizeof (xTriangle)); if (!tris) return; first = points++; for (tri = tris; npoint >= 3; npoint--, points++, tri++) { tri->p1 = *first; tri->p2 = points[0]; tri->p3 = points[1]; } (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris); free (tris); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/picture.c0000644000000000000000000013316713614532331017704 0ustar /* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "misc.h" #include "scrnintstr.h" #include "os.h" #include "regionstr.h" #include "validate.h" #include "windowstr.h" #include "input.h" #include "resource.h" #include "colormapst.h" #include "cursorstr.h" #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" #ifndef NXAGENT_SERVER #include "picturestr.h" #endif int PictureScreenPrivateIndex = -1; int PictureWindowPrivateIndex; int PictureGeneration; RESTYPE PictureType; RESTYPE PictFormatType; RESTYPE GlyphSetType; int PictureCmapPolicy = PictureCmapPolicyDefault; /* Picture Private machinery */ static int picturePrivateCount; void ResetPicturePrivateIndex (void) { picturePrivateCount = 0; } int AllocatePicturePrivateIndex (void) { return picturePrivateCount++; } Bool AllocatePicturePrivate (ScreenPtr pScreen, int index2, unsigned int amount) { PictureScreenPtr ps = GetPictureScreen(pScreen); unsigned int oldamount; /* Round up sizes for proper alignment */ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); if (index2 >= ps->PicturePrivateLen) { unsigned int *nsizes; nsizes = (unsigned int *)realloc(ps->PicturePrivateSizes, (index2 + 1) * sizeof(unsigned int)); if (!nsizes) return FALSE; while (ps->PicturePrivateLen <= index2) { nsizes[ps->PicturePrivateLen++] = 0; ps->totalPictureSize += sizeof(DevUnion); } ps->PicturePrivateSizes = nsizes; } oldamount = ps->PicturePrivateSizes[index2]; if (amount > oldamount) { ps->PicturePrivateSizes[index2] = amount; ps->totalPictureSize += (amount - oldamount); } return TRUE; } Bool PictureDestroyWindow (WindowPtr pWindow) { ScreenPtr pScreen = pWindow->drawable.pScreen; PicturePtr pPicture; PictureScreenPtr ps = GetPictureScreen(pScreen); Bool ret; while ((pPicture = GetPictureWindow(pWindow))) { SetPictureWindow(pWindow, pPicture->pNext); if (pPicture->id) FreeResource (pPicture->id, PictureType); FreePicture ((void *) pPicture, pPicture->id); } pScreen->DestroyWindow = ps->DestroyWindow; ret = (*pScreen->DestroyWindow) (pWindow); ps->DestroyWindow = pScreen->DestroyWindow; pScreen->DestroyWindow = PictureDestroyWindow; return ret; } Bool PictureCloseScreen (ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreen(pScreen); Bool ret; int n; pScreen->CloseScreen = ps->CloseScreen; ret = (*pScreen->CloseScreen) (pScreen); PictureResetFilters (pScreen); for (n = 0; n < ps->nformats; n++) if (ps->formats[n].type == PictTypeIndexed) (*ps->CloseIndexed) (pScreen, &ps->formats[n]); SetPictureScreen(pScreen, 0); if (ps->PicturePrivateSizes) free (ps->PicturePrivateSizes); free (ps->formats); free (ps); return ret; } void PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef) { ScreenPtr pScreen = pColormap->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); pScreen->StoreColors = ps->StoreColors; (*pScreen->StoreColors) (pColormap, ndef, pdef); ps->StoreColors = pScreen->StoreColors; pScreen->StoreColors = PictureStoreColors; if (pColormap->class == PseudoColor || pColormap->class == GrayScale) { PictFormatPtr format = ps->formats; int nformats = ps->nformats; while (nformats--) { if (format->type == PictTypeIndexed && format->index.pColormap == pColormap) { (*ps->UpdateIndexed) (pScreen, format, ndef, pdef); break; } format++; } } } static int visualDepth (ScreenPtr pScreen, VisualPtr pVisual) { int d, v; DepthPtr pDepth; for (d = 0; d < pScreen->numDepths; d++) { pDepth = &pScreen->allowedDepths[d]; for (v = 0; v < pDepth->numVids; v++) if (pDepth->vids[v] == pVisual->vid) return pDepth->depth; } return 0; } typedef struct _formatInit { CARD32 format; CARD8 depth; } FormatInitRec, *FormatInitPtr; static int addFormat (FormatInitRec formats[256], int nformat, CARD32 format, CARD8 depth) { int n; for (n = 0; n < nformat; n++) if (formats[n].format == format && formats[n].depth == depth) return nformat; formats[nformat].format = format; formats[nformat].depth = depth; return ++nformat; } #define Mask(n) ((n) == 32 ? 0xffffffff : ((1 << (n))-1)) #ifndef NXAGENT_SERVER PictFormatPtr PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp) { int nformats, f; PictFormatPtr pFormats; FormatInitRec formats[1024]; CARD32 format; CARD8 depth; VisualPtr pVisual; int v; int bpp; int type; int r, g, b; int d; DepthPtr pDepth; nformats = 0; /* formats required by protocol */ formats[nformats].format = PICT_a1; formats[nformats].depth = 1; nformats++; formats[nformats].format = PICT_a8; formats[nformats].depth = 8; nformats++; formats[nformats].format = PICT_a4; formats[nformats].depth = 4; nformats++; formats[nformats].format = PICT_a8r8g8b8; formats[nformats].depth = 32; nformats++; formats[nformats].format = PICT_x8r8g8b8; formats[nformats].depth = 32; nformats++; /* now look through the depths and visuals adding other formats */ for (v = 0; v < pScreen->numVisuals; v++) { pVisual = &pScreen->visuals[v]; depth = visualDepth (pScreen, pVisual); if (!depth) continue; bpp = BitsPerPixel (depth); switch (pVisual->class) { case DirectColor: case TrueColor: r = Ones (pVisual->redMask); g = Ones (pVisual->greenMask); b = Ones (pVisual->blueMask); type = PICT_TYPE_OTHER; /* * Current rendering code supports only two direct formats, * fields must be packed together at the bottom of the pixel * and must be either RGB or BGR */ if (pVisual->offsetBlue == 0 && pVisual->offsetGreen == b && pVisual->offsetRed == b + g) { type = PICT_TYPE_ARGB; } else if (pVisual->offsetRed == 0 && pVisual->offsetGreen == r && pVisual->offsetBlue == r + g) { type = PICT_TYPE_ABGR; } if (type != PICT_TYPE_OTHER) { format = PICT_FORMAT(bpp, type, 0, r, g, b); nformats = addFormat (formats, nformats, format, depth); } break; case StaticColor: case PseudoColor: format = PICT_VISFORMAT (bpp, PICT_TYPE_COLOR, v); nformats = addFormat (formats, nformats, format, depth); break; case StaticGray: case GrayScale: format = PICT_VISFORMAT (bpp, PICT_TYPE_GRAY, v); nformats = addFormat (formats, nformats, format, depth); break; } } /* * Walk supported depths and add useful Direct formats */ for (d = 0; d < pScreen->numDepths; d++) { pDepth = &pScreen->allowedDepths[d]; bpp = BitsPerPixel (pDepth->depth); format = 0; switch (bpp) { case 16: /* depth 12 formats */ if (pDepth->depth >= 12) { nformats = addFormat (formats, nformats, PICT_x4r4g4b4, pDepth->depth); nformats = addFormat (formats, nformats, PICT_x4b4g4r4, pDepth->depth); } /* depth 15 formats */ if (pDepth->depth >= 15) { nformats = addFormat (formats, nformats, PICT_x1r5g5b5, pDepth->depth); nformats = addFormat (formats, nformats, PICT_x1b5g5r5, pDepth->depth); } /* depth 16 formats */ if (pDepth->depth >= 16) { nformats = addFormat (formats, nformats, PICT_a1r5g5b5, pDepth->depth); nformats = addFormat (formats, nformats, PICT_a1b5g5r5, pDepth->depth); nformats = addFormat (formats, nformats, PICT_r5g6b5, pDepth->depth); nformats = addFormat (formats, nformats, PICT_b5g6r5, pDepth->depth); nformats = addFormat (formats, nformats, PICT_a4r4g4b4, pDepth->depth); nformats = addFormat (formats, nformats, PICT_a4b4g4r4, pDepth->depth); } break; case 24: if (pDepth->depth >= 24) { nformats = addFormat (formats, nformats, PICT_r8g8b8, pDepth->depth); nformats = addFormat (formats, nformats, PICT_b8g8r8, pDepth->depth); } break; case 32: if (pDepth->depth >= 24) { nformats = addFormat (formats, nformats, PICT_x8r8g8b8, pDepth->depth); nformats = addFormat (formats, nformats, PICT_x8b8g8r8, pDepth->depth); } break; } } pFormats = (PictFormatPtr) malloc (nformats * sizeof (PictFormatRec)); if (!pFormats) return 0; memset (pFormats, '\0', nformats * sizeof (PictFormatRec)); for (f = 0; f < nformats; f++) { pFormats[f].id = FakeClientID (0); pFormats[f].depth = formats[f].depth; format = formats[f].format; pFormats[f].format = format; switch (PICT_FORMAT_TYPE(format)) { case PICT_TYPE_ARGB: pFormats[f].type = PictTypeDirect; pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format)); if (pFormats[f].direct.alphaMask) pFormats[f].direct.alpha = (PICT_FORMAT_R(format) + PICT_FORMAT_G(format) + PICT_FORMAT_B(format)); pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format)); pFormats[f].direct.red = (PICT_FORMAT_G(format) + PICT_FORMAT_B(format)); pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format)); pFormats[f].direct.green = PICT_FORMAT_B(format); pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format)); pFormats[f].direct.blue = 0; break; case PICT_TYPE_ABGR: pFormats[f].type = PictTypeDirect; pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format)); if (pFormats[f].direct.alphaMask) pFormats[f].direct.alpha = (PICT_FORMAT_B(format) + PICT_FORMAT_G(format) + PICT_FORMAT_R(format)); pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format)); pFormats[f].direct.blue = (PICT_FORMAT_G(format) + PICT_FORMAT_R(format)); pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format)); pFormats[f].direct.green = PICT_FORMAT_R(format); pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format)); pFormats[f].direct.red = 0; break; case PICT_TYPE_A: pFormats[f].type = PictTypeDirect; pFormats[f].direct.alpha = 0; pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format)); /* remaining fields already set to zero */ break; case PICT_TYPE_COLOR: case PICT_TYPE_GRAY: pFormats[f].type = PictTypeIndexed; pFormats[f].index.vid = pScreen->visuals[PICT_FORMAT_VIS(format)].vid; break; } } *nformatp = nformats; return pFormats; } #endif static VisualPtr PictureFindVisual (ScreenPtr pScreen, VisualID visual) { int i; VisualPtr pVisual; for (i = 0, pVisual = pScreen->visuals; i < pScreen->numVisuals; i++, pVisual++) { if (pVisual->vid == visual) return pVisual; } return 0; } Bool PictureInitIndexedFormats (ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); PictFormatPtr format; int nformat; if (!ps) return FALSE; format = ps->formats; nformat = ps->nformats; while (nformat--) { if (format->type == PictTypeIndexed && !format->index.pColormap) { if (format->index.vid == pScreen->rootVisual) format->index.pColormap = (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP); else { VisualPtr pVisual; pVisual = PictureFindVisual (pScreen, format->index.vid); if (CreateColormap (FakeClientID (0), pScreen, pVisual, &format->index.pColormap, AllocNone, 0) != Success) { return FALSE; } } if (!(*ps->InitIndexed) (pScreen, format)) return FALSE; } format++; } return TRUE; } Bool PictureFinishInit (void) { int s; for (s = 0; s < screenInfo.numScreens; s++) { if (!PictureInitIndexedFormats (screenInfo.screens[s])) return FALSE; (void) AnimCurInit (screenInfo.screens[s]); } return TRUE; } Bool PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); if (!ps) return FALSE; ps->subpixel = subpixel; return TRUE; } int PictureGetSubpixelOrder (ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); if (!ps) return SubPixelUnknown; return ps->subpixel; } PictFormatPtr PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); PictFormatPtr format; int nformat; int type; if (!ps) return 0; format = ps->formats; nformat = ps->nformats; switch (pVisual->class) { case StaticGray: case GrayScale: case StaticColor: case PseudoColor: type = PictTypeIndexed; break; case TrueColor: case DirectColor: type = PictTypeDirect; break; default: return 0; } while (nformat--) { if (format->depth == depth && format->type == type) { if (type == PictTypeIndexed) { if (format->index.vid == pVisual->vid) return format; } else { if (format->direct.redMask << format->direct.red == pVisual->redMask && format->direct.greenMask << format->direct.green == pVisual->greenMask && format->direct.blueMask << format->direct.blue == pVisual->blueMask) { return format; } } } format++; } return 0; } PictFormatPtr PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 f) { PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); PictFormatPtr format; int nformat; if (!ps) return 0; format = ps->formats; nformat = ps->nformats; while (nformat--) { if (format->depth == depth && format->format == (f & 0xffffff)) return format; format++; } return 0; } int PictureParseCmapPolicy (const char *name) { if ( strcmp (name, "default" ) == 0) return PictureCmapPolicyDefault; else if ( strcmp (name, "mono" ) == 0) return PictureCmapPolicyMono; else if ( strcmp (name, "gray" ) == 0) return PictureCmapPolicyGray; else if ( strcmp (name, "color" ) == 0) return PictureCmapPolicyColor; else if ( strcmp (name, "all" ) == 0) return PictureCmapPolicyAll; else return PictureCmapPolicyInvalid; } Bool PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) { PictureScreenPtr ps; int n; CARD32 type, a, r, g, b; if (PictureGeneration != serverGeneration) { PictureType = CreateNewResourceType (FreePicture); if (!PictureType) return FALSE; PictFormatType = CreateNewResourceType (FreePictFormat); if (!PictFormatType) return FALSE; GlyphSetType = CreateNewResourceType (FreeGlyphSet); if (!GlyphSetType) return FALSE; PictureScreenPrivateIndex = AllocateScreenPrivateIndex(); if (PictureScreenPrivateIndex < 0) return FALSE; PictureWindowPrivateIndex = AllocateWindowPrivateIndex(); PictureGeneration = serverGeneration; #ifdef XResExtension RegisterResourceName (PictureType, "PICTURE"); RegisterResourceName (PictFormatType, "PICTFORMAT"); RegisterResourceName (GlyphSetType, "GLYPHSET"); #endif } if (!AllocateWindowPrivate (pScreen, PictureWindowPrivateIndex, 0)) return FALSE; if (!formats) { formats = PictureCreateDefaultFormats (pScreen, &nformats); if (!formats) return FALSE; } for (n = 0; n < nformats; n++) { if (!AddResource (formats[n].id, PictFormatType, (void *) (formats+n))) { free (formats); return FALSE; } if (formats[n].type == PictTypeIndexed) { VisualPtr pVisual = PictureFindVisual (pScreen, formats[n].index.vid); if ((pVisual->class | DynamicClass) == PseudoColor) type = PICT_TYPE_COLOR; else type = PICT_TYPE_GRAY; a = r = g = b = 0; } else { if ((formats[n].direct.redMask| formats[n].direct.blueMask| formats[n].direct.greenMask) == 0) type = PICT_TYPE_A; else if (formats[n].direct.red > formats[n].direct.blue) type = PICT_TYPE_ARGB; else type = PICT_TYPE_ABGR; a = Ones (formats[n].direct.alphaMask); r = Ones (formats[n].direct.redMask); g = Ones (formats[n].direct.greenMask); b = Ones (formats[n].direct.blueMask); } formats[n].format = PICT_FORMAT(0,type,a,r,g,b); } ps = (PictureScreenPtr) malloc (sizeof (PictureScreenRec)); if (!ps) { free (formats); return FALSE; } SetPictureScreen(pScreen, ps); if (!GlyphInit (pScreen)) { SetPictureScreen(pScreen, 0); free (formats); free (ps); return FALSE; } ps->totalPictureSize = sizeof (PictureRec); ps->PicturePrivateSizes = 0; ps->PicturePrivateLen = 0; ps->formats = formats; ps->fallback = formats; ps->nformats = nformats; ps->filters = 0; ps->nfilters = 0; ps->filterAliases = 0; ps->nfilterAliases = 0; ps->subpixel = SubPixelUnknown; ps->CloseScreen = pScreen->CloseScreen; ps->DestroyWindow = pScreen->DestroyWindow; ps->StoreColors = pScreen->StoreColors; pScreen->DestroyWindow = PictureDestroyWindow; pScreen->CloseScreen = PictureCloseScreen; pScreen->StoreColors = PictureStoreColors; if (!PictureSetDefaultFilters (pScreen)) { PictureResetFilters (pScreen); SetPictureScreen(pScreen, 0); free (formats); free (ps); return FALSE; } return TRUE; } void SetPictureToDefaults (PicturePtr pPicture) { pPicture->refcnt = 1; pPicture->repeat = 0; pPicture->graphicsExposures = FALSE; pPicture->subWindowMode = ClipByChildren; pPicture->polyEdge = PolyEdgeSharp; pPicture->polyMode = PolyModePrecise; pPicture->freeCompClip = FALSE; pPicture->clientClipType = CT_NONE; pPicture->componentAlpha = FALSE; pPicture->repeatType = RepeatNone; pPicture->alphaMap = 0; pPicture->alphaOrigin.x = 0; pPicture->alphaOrigin.y = 0; pPicture->clipOrigin.x = 0; pPicture->clipOrigin.y = 0; pPicture->clientClip = 0; pPicture->transform = 0; pPicture->dither = None; pPicture->filter = PictureGetFilterId (FilterNearest, -1, TRUE); pPicture->filter_params = 0; pPicture->filter_nparams = 0; pPicture->serialNumber = GC_CHANGE_SERIAL_BIT; pPicture->stateChanges = (1 << (CPLastBit+1)) - 1; pPicture->pSourcePict = 0; } #ifndef NXAGENT_SERVER PicturePtr AllocatePicture (ScreenPtr pScreen) { PictureScreenPtr ps = GetPictureScreen(pScreen); PicturePtr pPicture; char *ptr; DevUnion *ppriv; unsigned int *sizes; unsigned int size; int i; pPicture = (PicturePtr) malloc (ps->totalPictureSize); if (!pPicture) return 0; ppriv = (DevUnion *)(pPicture + 1); pPicture->devPrivates = ppriv; sizes = ps->PicturePrivateSizes; ptr = (char *)(ppriv + ps->PicturePrivateLen); for (i = ps->PicturePrivateLen; --i >= 0; ppriv++, sizes++) { if ( (size = *sizes) ) { ppriv->ptr = (void *)ptr; ptr += size; } else ppriv->ptr = (void *)NULL; } return pPicture; } PicturePtr CreatePicture (Picture pid, DrawablePtr pDrawable, PictFormatPtr pFormat, Mask vmask, XID *vlist, ClientPtr client, int *error) { PicturePtr pPicture; PictureScreenPtr ps = GetPictureScreen(pDrawable->pScreen); pPicture = AllocatePicture (pDrawable->pScreen); if (!pPicture) { *error = BadAlloc; return 0; } pPicture->id = pid; pPicture->pDrawable = pDrawable; pPicture->pFormat = pFormat; pPicture->format = pFormat->format | (pDrawable->bitsPerPixel << 24); if (pDrawable->type == DRAWABLE_PIXMAP) { ++((PixmapPtr)pDrawable)->refcnt; pPicture->pNext = 0; } else { pPicture->pNext = GetPictureWindow(((WindowPtr) pDrawable)); SetPictureWindow(((WindowPtr) pDrawable), pPicture); } SetPictureToDefaults (pPicture); if (vmask) *error = ChangePicture (pPicture, vmask, vlist, 0, client); else *error = Success; if (*error == Success) *error = (*ps->CreatePicture) (pPicture); if (*error != Success) { FreePicture (pPicture, (XID) 0); pPicture = 0; } return pPicture; } #endif static CARD32 xRenderColorToCard32(xRenderColor c) { return (c.alpha >> 8 << 24) | (c.red >> 8 << 16) | (c.green & 0xff00) | (c.blue >> 8); } static unsigned int premultiply(unsigned int x) { unsigned int a = x >> 24; unsigned int t = (x & 0xff00ff) * a; t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8; t &= 0xff00ff; x = ((x >> 8) & 0xff) * a; x = (x + ((x >> 8) & 0xff) + 0x80); x &= 0xff00; x |= t | (a << 24); return x; } static unsigned int INTERPOLATE_PIXEL_256(unsigned int x, unsigned int a, unsigned int y, unsigned int b) { CARD32 t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; t >>= 8; t &= 0xff00ff; x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; x &= 0xff00ff00; x |= t; return x; } static void initGradientColorTable(SourcePictPtr pGradient, int *error) { int begin_pos, end_pos; xFixed incr, dpos; int pos, current_stop; PictGradientStopPtr stops = pGradient->linear.stops; int nstops = pGradient->linear.nstops; /* The position where the gradient begins and ends */ begin_pos = (stops[0].x * PICT_GRADIENT_STOPTABLE_SIZE) >> 16; end_pos = (stops[nstops - 1].x * PICT_GRADIENT_STOPTABLE_SIZE) >> 16; pos = 0; /* The position in the color table. */ /* Up to first point */ while (pos <= begin_pos) { pGradient->linear.colorTable[pos] = xRenderColorToCard32(stops[0].color); ++pos; } incr = (1<<16)/ PICT_GRADIENT_STOPTABLE_SIZE; /* the double increment. */ dpos = incr * pos; /* The position in terms of 0-1. */ current_stop = 0; /* We always interpolate between current and current + 1. */ /* Gradient area */ while (pos < end_pos) { unsigned int current_color = xRenderColorToCard32(stops[current_stop].color); unsigned int next_color = xRenderColorToCard32(stops[current_stop + 1].color); int dist = (int)(256*(dpos - stops[current_stop].x) / (stops[current_stop+1].x - stops[current_stop].x)); int idist = 256 - dist; pGradient->linear.colorTable[pos] = premultiply(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist)); ++pos; dpos += incr; if (dpos > stops[current_stop + 1].x) ++current_stop; } /* After last point */ while (pos < PICT_GRADIENT_STOPTABLE_SIZE) { pGradient->linear.colorTable[pos] = xRenderColorToCard32(stops[nstops - 1].color); ++pos; } } static void initGradient(SourcePictPtr pGradient, int stopCount, xFixed *stopPoints, xRenderColor *stopColors, int *error) { int i; xFixed dpos; if (stopCount <= 0) { *error = BadValue; return; } dpos = -1; for (i = 0; i < stopCount; ++i) { if (stopPoints[i] <= dpos || stopPoints[i] > (1<<16)) { *error = BadValue; return; } dpos = stopPoints[i]; } pGradient->linear.stops = malloc(stopCount*sizeof(PictGradientStop)); if (!pGradient->linear.stops) { *error = BadAlloc; return; } pGradient->linear.nstops = stopCount; for (i = 0; i < stopCount; ++i) { pGradient->linear.stops[i].x = stopPoints[i]; pGradient->linear.stops[i].color = stopColors[i]; } initGradientColorTable(pGradient, error); } #ifndef NXAGENT_SERVER static PicturePtr createSourcePicture(void) { PicturePtr pPicture; pPicture = (PicturePtr) malloc(sizeof(PictureRec)); if (!pPicture) return 0; pPicture->pDrawable = 0; pPicture->pFormat = 0; pPicture->pNext = 0; pPicture->devPrivates = 0; SetPictureToDefaults(pPicture); return pPicture; } PicturePtr CreateSolidPicture (Picture pid, xRenderColor *color, int *error) { PicturePtr pPicture; pPicture = createSourcePicture(); if (!pPicture) { *error = BadAlloc; return 0; } pPicture->id = pid; pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictSolidFill)); if (!pPicture->pSourcePict) { *error = BadAlloc; free(pPicture); return 0; } pPicture->pSourcePict->type = SourcePictTypeSolidFill; pPicture->pSourcePict->solidFill.color = xRenderColorToCard32(*color); return pPicture; } #endif PicturePtr CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2, int nStops, xFixed *stops, xRenderColor *colors, int *error) { PicturePtr pPicture; if (nStops < 2) { *error = BadValue; return 0; } pPicture = createSourcePicture(); if (!pPicture) { *error = BadAlloc; return 0; } if (p1->x == p2->x && p1->y == p2->y) { *error = BadValue; return 0; } pPicture->id = pid; pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictLinearGradient)); if (!pPicture->pSourcePict) { *error = BadAlloc; free(pPicture); return 0; } pPicture->pSourcePict->linear.type = SourcePictTypeLinear; pPicture->pSourcePict->linear.p1 = *p1; pPicture->pSourcePict->linear.p2 = *p2; initGradient(pPicture->pSourcePict, nStops, stops, colors, error); if (*error) { free(pPicture); return 0; } return pPicture; } #define FixedToDouble(x) ((x)/65536.) PicturePtr CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer, xFixed innerRadius, xFixed outerRadius, int nStops, xFixed *stops, xRenderColor *colors, int *error) { PicturePtr pPicture; PictRadialGradient *radial; if (nStops < 2) { *error = BadValue; return 0; } pPicture = createSourcePicture(); if (!pPicture) { *error = BadAlloc; return 0; } { double dx = (double)(inner->x - outer->x); double dy = (double)(inner->y - outer->y); if (sqrt(dx*dx + dy*dy) + (double)(innerRadius) > (double)(outerRadius)) { *error = BadValue; return 0; } } pPicture->id = pid; pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictRadialGradient)); if (!pPicture->pSourcePict) { *error = BadAlloc; free(pPicture); return 0; } radial = &pPicture->pSourcePict->radial; radial->type = SourcePictTypeRadial; { double x = (double)innerRadius / (double)outerRadius; radial->dx = (outer->x - inner->x); radial->dy = (outer->y - inner->y); radial->fx = (inner->x) - x*radial->dx; radial->fy = (inner->y) - x*radial->dy; radial->m = 1./(1+x); radial->b = -x*radial->m; radial->dx /= 65536.; radial->dy /= 65536.; radial->fx /= 65536.; radial->fy /= 65536.; x = outerRadius/65536.; radial->a = x*x - radial->dx*radial->dx - radial->dy*radial->dy; } initGradient(pPicture->pSourcePict, nStops, stops, colors, error); if (*error) { free(pPicture); return 0; } return pPicture; } PicturePtr CreateConicalGradientPicture (Picture pid, xPointFixed *center, xFixed angle, int nStops, xFixed *stops, xRenderColor *colors, int *error) { PicturePtr pPicture; if (nStops < 2) { *error = BadValue; return 0; } pPicture = createSourcePicture(); if (!pPicture) { *error = BadAlloc; return 0; } pPicture->id = pid; pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictConicalGradient)); if (!pPicture->pSourcePict) { *error = BadAlloc; free(pPicture); return 0; } pPicture->pSourcePict->conical.type = SourcePictTypeConical; pPicture->pSourcePict->conical.center = *center; pPicture->pSourcePict->conical.angle = angle; initGradient(pPicture->pSourcePict, nStops, stops, colors, error); if (*error) { free(pPicture); return 0; } return pPicture; } #define NEXT_VAL(_type) (vlist ? (_type) *vlist++ : (_type) ulist++->val) #define NEXT_PTR(_type) ((_type) ulist++->ptr) int ChangePicture (PicturePtr pPicture, Mask vmask, XID *vlist, DevUnion *ulist, ClientPtr client) { ScreenPtr pScreen = pPicture->pDrawable ? pPicture->pDrawable->pScreen : 0; PictureScreenPtr ps = pScreen ? GetPictureScreen(pScreen) : 0; BITS32 index2; int error = 0; BITS32 maskQ; pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; maskQ = vmask; while (vmask && !error) { index2 = (BITS32) lowbit (vmask); vmask &= ~index2; pPicture->stateChanges |= index2; switch (index2) { case CPRepeat: { unsigned int newr; newr = NEXT_VAL(unsigned int); if (newr <= RepeatReflect) { pPicture->repeat = (newr != RepeatNone); pPicture->repeatType = newr; } else { client->errorValue = newr; error = BadValue; } } break; case CPAlphaMap: { PicturePtr pAlpha; if (vlist) { Picture pid = NEXT_VAL(Picture); if (pid == None) pAlpha = 0; else { pAlpha = (PicturePtr) SecurityLookupIDByType(client, pid, PictureType, DixWriteAccess|DixReadAccess); if (!pAlpha) { client->errorValue = pid; error = BadPixmap; break; } if (pAlpha->pDrawable->type != DRAWABLE_PIXMAP) { client->errorValue = pid; error = BadMatch; break; } } } else pAlpha = NEXT_PTR(PicturePtr); if (!error) { if (pAlpha && pAlpha->pDrawable->type == DRAWABLE_PIXMAP) pAlpha->refcnt++; if (pPicture->alphaMap) FreePicture ((void *) pPicture->alphaMap, (XID) 0); pPicture->alphaMap = pAlpha; } } break; case CPAlphaXOrigin: pPicture->alphaOrigin.x = NEXT_VAL(INT16); break; case CPAlphaYOrigin: pPicture->alphaOrigin.y = NEXT_VAL(INT16); break; case CPClipXOrigin: pPicture->clipOrigin.x = NEXT_VAL(INT16); break; case CPClipYOrigin: pPicture->clipOrigin.y = NEXT_VAL(INT16); break; case CPClipMask: { Pixmap pid; PixmapPtr pPixmap; int clipType; if (!pScreen) return BadDrawable; if (vlist) { pid = NEXT_VAL(Pixmap); if (pid == None) { clipType = CT_NONE; pPixmap = NullPixmap; } else { clipType = CT_PIXMAP; pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pid, RT_PIXMAP, DixReadAccess); if (!pPixmap) { client->errorValue = pid; error = BadPixmap; break; } } } else { pPixmap = NEXT_PTR(PixmapPtr); if (pPixmap) clipType = CT_PIXMAP; else clipType = CT_NONE; } if (pPixmap) { if ((pPixmap->drawable.depth != 1) || (pPixmap->drawable.pScreen != pScreen)) { error = BadMatch; break; } else { clipType = CT_PIXMAP; pPixmap->refcnt++; } } error = (*ps->ChangePictureClip)(pPicture, clipType, (void *)pPixmap, 0); break; } case CPGraphicsExposure: { unsigned int newe; newe = NEXT_VAL(unsigned int); if (newe <= xTrue) pPicture->graphicsExposures = newe; else { client->errorValue = newe; error = BadValue; } } break; case CPSubwindowMode: { unsigned int news; news = NEXT_VAL(unsigned int); if (news == ClipByChildren || news == IncludeInferiors) pPicture->subWindowMode = news; else { client->errorValue = news; error = BadValue; } } break; case CPPolyEdge: { unsigned int newe; newe = NEXT_VAL(unsigned int); if (newe == PolyEdgeSharp || newe == PolyEdgeSmooth) pPicture->polyEdge = newe; else { client->errorValue = newe; error = BadValue; } } break; case CPPolyMode: { unsigned int newm; newm = NEXT_VAL(unsigned int); if (newm == PolyModePrecise || newm == PolyModeImprecise) pPicture->polyMode = newm; else { client->errorValue = newm; error = BadValue; } } break; case CPDither: pPicture->dither = NEXT_VAL(Atom); break; case CPComponentAlpha: { unsigned int newca; newca = NEXT_VAL (unsigned int); if (newca <= xTrue) pPicture->componentAlpha = newca; else { client->errorValue = newca; error = BadValue; } } break; default: client->errorValue = maskQ; error = BadValue; break; } } if (ps) (*ps->ChangePicture) (pPicture, maskQ); return error; } int SetPictureClipRects (PicturePtr pPicture, int xOrigin, int yOrigin, int nRect, xRectangle *rects) { ScreenPtr pScreen = pPicture->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); RegionPtr clientClip; int result; clientClip = RegionFromRects( nRect, rects, CT_UNSORTED); if (!clientClip) return BadAlloc; result =(*ps->ChangePictureClip) (pPicture, CT_REGION, (void *) clientClip, 0); if (result == Success) { pPicture->clipOrigin.x = xOrigin; pPicture->clipOrigin.y = yOrigin; pPicture->stateChanges |= CPClipXOrigin|CPClipYOrigin|CPClipMask; pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; } return result; } int SetPictureClipRegion (PicturePtr pPicture, int xOrigin, int yOrigin, RegionPtr pRegion) { ScreenPtr pScreen = pPicture->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); RegionPtr clientClip; int result; int type; if (pRegion) { type = CT_REGION; clientClip = RegionCreate( RegionExtents(pRegion), RegionNumRects(pRegion)); if (!clientClip) return BadAlloc; if (!RegionCopy(clientClip, pRegion)) { RegionDestroy(clientClip); return BadAlloc; } } else { type = CT_NONE; clientClip = 0; } result =(*ps->ChangePictureClip) (pPicture, type, (void *) clientClip, 0); if (result == Success) { pPicture->clipOrigin.x = xOrigin; pPicture->clipOrigin.y = yOrigin; pPicture->stateChanges |= CPClipXOrigin|CPClipYOrigin|CPClipMask; pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; } return result; } int SetPictureTransform (PicturePtr pPicture, PictTransform *transform) { static const PictTransform identity = { { { xFixed1, 0x00000, 0x00000 }, { 0x00000, xFixed1, 0x00000 }, { 0x00000, 0x00000, xFixed1 }, } }; if (transform && memcmp (transform, &identity, sizeof (PictTransform)) == 0) transform = 0; if (transform) { if (!pPicture->transform) { pPicture->transform = (PictTransform *) malloc (sizeof (PictTransform)); if (!pPicture->transform) return BadAlloc; } *pPicture->transform = *transform; } else { if (pPicture->transform) { free (pPicture->transform); pPicture->transform = 0; } } pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; return Success; } void CopyPicture (PicturePtr pSrc, Mask mask, PicturePtr pDst) { PictureScreenPtr ps = GetPictureScreen(pSrc->pDrawable->pScreen); Mask origMask = mask; pDst->serialNumber |= GC_CHANGE_SERIAL_BIT; pDst->stateChanges |= mask; while (mask) { Mask bit = lowbit(mask); switch (bit) { case CPRepeat: pDst->repeat = pSrc->repeat; pDst->repeatType = pSrc->repeatType; break; case CPAlphaMap: if (pSrc->alphaMap && pSrc->alphaMap->pDrawable->type == DRAWABLE_PIXMAP) pSrc->alphaMap->refcnt++; if (pDst->alphaMap) FreePicture ((void *) pDst->alphaMap, (XID) 0); pDst->alphaMap = pSrc->alphaMap; break; case CPAlphaXOrigin: pDst->alphaOrigin.x = pSrc->alphaOrigin.x; break; case CPAlphaYOrigin: pDst->alphaOrigin.y = pSrc->alphaOrigin.y; break; case CPClipXOrigin: pDst->clipOrigin.x = pSrc->clipOrigin.x; break; case CPClipYOrigin: pDst->clipOrigin.y = pSrc->clipOrigin.y; break; case CPClipMask: switch (pSrc->clientClipType) { case CT_NONE: (*ps->ChangePictureClip)(pDst, CT_NONE, NULL, 0); break; case CT_REGION: if (!pSrc->clientClip) { (*ps->ChangePictureClip)(pDst, CT_NONE, NULL, 0); } else { RegionPtr clientClip; RegionPtr srcClientClip = (RegionPtr)pSrc->clientClip; clientClip = RegionCreate( RegionExtents(srcClientClip), RegionNumRects(srcClientClip)); (*ps->ChangePictureClip)(pDst, CT_REGION, clientClip, 0); } break; default: /* XXX: CT_PIXMAP unimplemented */ break; } break; case CPGraphicsExposure: pDst->graphicsExposures = pSrc->graphicsExposures; break; case CPPolyEdge: pDst->polyEdge = pSrc->polyEdge; break; case CPPolyMode: pDst->polyMode = pSrc->polyMode; break; case CPDither: pDst->dither = pSrc->dither; break; case CPComponentAlpha: pDst->componentAlpha = pSrc->componentAlpha; break; } mask &= ~bit; } (*ps->ChangePicture)(pDst, origMask); } static void ValidateOnePicture (PicturePtr pPicture) { if (pPicture->pDrawable && pPicture->serialNumber != pPicture->pDrawable->serialNumber) { PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen); (*ps->ValidatePicture) (pPicture, pPicture->stateChanges); pPicture->stateChanges = 0; pPicture->serialNumber = pPicture->pDrawable->serialNumber; } } void ValidatePicture(PicturePtr pPicture) { ValidateOnePicture (pPicture); if (pPicture->alphaMap) ValidateOnePicture (pPicture->alphaMap); } #ifndef NXAGENT_SERVER int FreePicture (void * value, XID pid) { PicturePtr pPicture = (PicturePtr) value; if (--pPicture->refcnt == 0) { if (pPicture->transform) free (pPicture->transform); if (!pPicture->pDrawable) { if (pPicture->pSourcePict) { if (pPicture->pSourcePict->type != SourcePictTypeSolidFill) free(pPicture->pSourcePict->linear.stops); free(pPicture->pSourcePict); } } else { ScreenPtr pScreen = pPicture->pDrawable->pScreen; PictureScreenPtr ps = GetPictureScreen(pScreen); if (pPicture->alphaMap) FreePicture ((void *) pPicture->alphaMap, (XID) 0); (*ps->DestroyPicture) (pPicture); (*ps->DestroyPictureClip) (pPicture); if (pPicture->pDrawable->type == DRAWABLE_WINDOW) { WindowPtr pWindow = (WindowPtr) pPicture->pDrawable; PicturePtr *pPrev; for (pPrev = (PicturePtr *) &((pWindow)->devPrivates[PictureWindowPrivateIndex].ptr); *pPrev; pPrev = &(*pPrev)->pNext) { if (*pPrev == pPicture) { *pPrev = pPicture->pNext; break; } } } else if (pPicture->pDrawable->type == DRAWABLE_PIXMAP) { (*pScreen->DestroyPixmap) ((PixmapPtr)pPicture->pDrawable); } } free (pPicture); } return Success; } #endif int FreePictFormat (void * pPictFormat, XID pid) { return Success; } /** * ReduceCompositeOp is used to choose simpler ops for cases where alpha * channels are always one and so math on the alpha channel per pixel becomes * unnecessary. It may also avoid destination reads sometimes if apps aren't * being careful to avoid these cases. */ static CARD8 ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst) { Bool no_src_alpha, no_dst_alpha; no_src_alpha = PICT_FORMAT_COLOR(pSrc->format) && PICT_FORMAT_A(pSrc->format) == 0 && pSrc->alphaMap == NULL && pMask == NULL; no_dst_alpha = PICT_FORMAT_COLOR(pDst->format) && PICT_FORMAT_A(pDst->format) == 0 && pDst->alphaMap == NULL; /* TODO, maybe: Conjoint and Disjoint op reductions? */ /* Deal with simplifications where the source alpha is always 1. */ if (no_src_alpha) { switch (op) { case PictOpOver: op = PictOpSrc; break; case PictOpInReverse: op = PictOpDst; break; case PictOpOutReverse: op = PictOpClear; break; case PictOpAtop: op = PictOpIn; break; case PictOpAtopReverse: op = PictOpOverReverse; break; case PictOpXor: op = PictOpOut; break; default: break; } } /* Deal with simplifications when the destination alpha is always 1 */ if (no_dst_alpha) { switch (op) { case PictOpOverReverse: op = PictOpDst; break; case PictOpIn: op = PictOpSrc; break; case PictOpOut: op = PictOpClear; break; case PictOpAtop: op = PictOpOver; break; case PictOpXor: op = PictOpOutReverse; break; default: break; } } /* Reduce some con/disjoint ops to the basic names. */ switch (op) { case PictOpDisjointClear: case PictOpConjointClear: op = PictOpClear; break; case PictOpDisjointSrc: case PictOpConjointSrc: op = PictOpSrc; break; case PictOpDisjointDst: case PictOpConjointDst: op = PictOpDst; break; default: break; } return op; } void CompositePicture (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); ValidatePicture (pSrc); if (pMask) ValidatePicture (pMask); ValidatePicture (pDst); op = ReduceCompositeOp (op, pSrc, pMask, pDst); if (op == PictOpDst) return; (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); } void CompositeRects(CARD8 op, PicturePtr pDst, xRenderColor * color, int nRect, xRectangle *rects) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); ValidatePicture (pDst); (*ps->CompositeRects) (op, pDst, color, nRect, rects); } void CompositeTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); ValidatePicture (pSrc); ValidatePicture (pDst); (*ps->Trapezoids) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, traps); } void CompositeTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntriangles, xTriangle *triangles) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); ValidatePicture (pSrc); ValidatePicture (pDst); (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntriangles, triangles); } void CompositeTriStrip (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoints, xPointFixed *points) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); ValidatePicture (pSrc); ValidatePicture (pDst); (*ps->TriStrip) (op, pSrc, pDst, maskFormat, xSrc, ySrc, npoints, points); } void CompositeTriFan (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoints, xPointFixed *points) { PictureScreenPtr ps = GetPictureScreen(pDst->pDrawable->pScreen); ValidatePicture (pSrc); ValidatePicture (pDst); (*ps->TriFan) (op, pSrc, pDst, maskFormat, xSrc, ySrc, npoints, points); } void AddTraps (PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntrap, xTrap *traps) { PictureScreenPtr ps = GetPictureScreen(pPicture->pDrawable->pScreen); ValidatePicture (pPicture); (*ps->AddTraps) (pPicture, xOff, yOff, ntrap, traps); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/picture.h0000644000000000000000000002104113614532331017674 0ustar /* * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifndef _PICTURE_H_ #define _PICTURE_H_ typedef struct _DirectFormat *DirectFormatPtr; typedef struct _PictFormat *PictFormatPtr; typedef struct _Picture *PicturePtr; /* * While the protocol is generous in format support, the * sample implementation allows only packed RGB and GBR * representations for data to simplify software rendering, */ #define PICT_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) | \ ((type) << 16) | \ ((a) << 12) | \ ((r) << 8) | \ ((g) << 4) | \ ((b))) /* * gray/color formats use a visual index instead of argb */ #define PICT_VISFORMAT(bpp,type,vi) (((bpp) << 24) | \ ((type) << 16) | \ ((vi))) #define PICT_FORMAT_BPP(f) (((f) >> 24) ) #define PICT_FORMAT_TYPE(f) (((f) >> 16) & 0xff) #define PICT_FORMAT_A(f) (((f) >> 12) & 0x0f) #define PICT_FORMAT_R(f) (((f) >> 8) & 0x0f) #define PICT_FORMAT_G(f) (((f) >> 4) & 0x0f) #define PICT_FORMAT_B(f) (((f) ) & 0x0f) #define PICT_FORMAT_RGB(f) (((f) ) & 0xfff) #define PICT_FORMAT_VIS(f) (((f) ) & 0xffff) #define PICT_TYPE_OTHER 0 #define PICT_TYPE_A 1 #define PICT_TYPE_ARGB 2 #define PICT_TYPE_ABGR 3 #define PICT_TYPE_COLOR 4 #define PICT_TYPE_GRAY 5 #define PICT_FORMAT_COLOR(f) (PICT_FORMAT_TYPE(f) & 2) /* 32bpp formats */ #define PICT_a8r8g8b8 PICT_FORMAT(32,PICT_TYPE_ARGB,8,8,8,8) #define PICT_x8r8g8b8 PICT_FORMAT(32,PICT_TYPE_ARGB,0,8,8,8) #define PICT_a8b8g8r8 PICT_FORMAT(32,PICT_TYPE_ABGR,8,8,8,8) #define PICT_x8b8g8r8 PICT_FORMAT(32,PICT_TYPE_ABGR,0,8,8,8) /* 24bpp formats */ #define PICT_r8g8b8 PICT_FORMAT(24,PICT_TYPE_ARGB,0,8,8,8) #define PICT_b8g8r8 PICT_FORMAT(24,PICT_TYPE_ABGR,0,8,8,8) /* 16bpp formats */ #define PICT_r5g6b5 PICT_FORMAT(16,PICT_TYPE_ARGB,0,5,6,5) #define PICT_b5g6r5 PICT_FORMAT(16,PICT_TYPE_ABGR,0,5,6,5) #define PICT_a1r5g5b5 PICT_FORMAT(16,PICT_TYPE_ARGB,1,5,5,5) #define PICT_x1r5g5b5 PICT_FORMAT(16,PICT_TYPE_ARGB,0,5,5,5) #define PICT_a1b5g5r5 PICT_FORMAT(16,PICT_TYPE_ABGR,1,5,5,5) #define PICT_x1b5g5r5 PICT_FORMAT(16,PICT_TYPE_ABGR,0,5,5,5) #define PICT_a4r4g4b4 PICT_FORMAT(16,PICT_TYPE_ARGB,4,4,4,4) #define PICT_x4r4g4b4 PICT_FORMAT(16,PICT_TYPE_ARGB,0,4,4,4) #define PICT_a4b4g4r4 PICT_FORMAT(16,PICT_TYPE_ABGR,4,4,4,4) #define PICT_x4b4g4r4 PICT_FORMAT(16,PICT_TYPE_ABGR,0,4,4,4) /* 8bpp formats */ #define PICT_a8 PICT_FORMAT(8,PICT_TYPE_A,8,0,0,0) #define PICT_r3g3b2 PICT_FORMAT(8,PICT_TYPE_ARGB,0,3,3,2) #define PICT_b2g3r3 PICT_FORMAT(8,PICT_TYPE_ABGR,0,3,3,2) #define PICT_a2r2g2b2 PICT_FORMAT(8,PICT_TYPE_ARGB,2,2,2,2) #define PICT_a2b2g2r2 PICT_FORMAT(8,PICT_TYPE_ABGR,2,2,2,2) #define PICT_c8 PICT_FORMAT(8,PICT_TYPE_COLOR,0,0,0,0) #define PICT_g8 PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0) #define PICT_x4a4 PICT_FORMAT(8,PICT_TYPE_A,4,0,0,0) #define PICT_x4r1g2b1 PICT_FORMAT(8,PICT_TYPE_ARGB,0,1,2,1) #define PICT_x4b1g2r1 PICT_FORMAT(8,PICT_TYPE_ABGR,0,1,2,1) #define PICT_x4a1r1g1b1 PICT_FORMAT(8,PICT_TYPE_ARGB,1,1,1,1) #define PICT_x4a1b1g1r1 PICT_FORMAT(8,PICT_TYPE_ABGR,1,1,1,1) #define PICT_x4c4 PICT_FORMAT(8,PICT_TYPE_COLOR,0,0,0,0) #define PICT_x4g4 PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0) /* 4bpp formats */ #define PICT_a4 PICT_FORMAT(4,PICT_TYPE_A,4,0,0,0) #define PICT_r1g2b1 PICT_FORMAT(4,PICT_TYPE_ARGB,0,1,2,1) #define PICT_b1g2r1 PICT_FORMAT(4,PICT_TYPE_ABGR,0,1,2,1) #define PICT_a1r1g1b1 PICT_FORMAT(4,PICT_TYPE_ARGB,1,1,1,1) #define PICT_a1b1g1r1 PICT_FORMAT(4,PICT_TYPE_ABGR,1,1,1,1) #define PICT_c4 PICT_FORMAT(4,PICT_TYPE_COLOR,0,0,0,0) #define PICT_g4 PICT_FORMAT(4,PICT_TYPE_GRAY,0,0,0,0) /* 1bpp formats */ #define PICT_a1 PICT_FORMAT(1,PICT_TYPE_A,1,0,0,0) #define PICT_g1 PICT_FORMAT(1,PICT_TYPE_GRAY,0,0,0,0) /* * For dynamic indexed visuals (GrayScale and PseudoColor), these control the * selection of colors allocated for drawing to Pictures. The default * policy depends on the size of the colormap: * * Size Default Policy * ---------------------------- * < 64 PolicyMono * < 256 PolicyGray * 256 PolicyColor (only on PseudoColor) * * The actual allocation code lives in miindex.c, and so is * austensibly server dependent, but that code does: * * PolicyMono Allocate no additional colors, use black and white * PolicyGray Allocate 13 gray levels (11 cells used) * PolicyColor Allocate a 4x4x4 cube and 13 gray levels (71 cells used) * PolicyAll Allocate as big a cube as possible, fill with gray (all) * * Here's a picture to help understand how many colors are * actually allocated (this is just the gray ramp): * * gray level * all 0000 1555 2aaa 4000 5555 6aaa 8000 9555 aaaa bfff d555 eaaa ffff * b/w 0000 ffff * 4x4x4 5555 aaaa * extra 1555 2aaa 4000 6aaa 8000 9555 bfff d555 eaaa * * The default colormap supplies two gray levels (black/white), the * 4x4x4 cube allocates another two and nine more are allocated to fill * in the 13 levels. When the 4x4x4 cube is not allocated, a total of * 11 cells are allocated. */ #define PictureCmapPolicyInvalid -1 #define PictureCmapPolicyDefault 0 #define PictureCmapPolicyMono 1 #define PictureCmapPolicyGray 2 #define PictureCmapPolicyColor 3 #define PictureCmapPolicyAll 4 extern int PictureCmapPolicy; int PictureParseCmapPolicy (const char *name); extern int RenderErrBase; extern int RenderClientPrivateIndex; /* Fixed point updates from Carl Worth, USC, Information Sciences Institute */ #if defined(WIN32) && !defined(__GNUC__) typedef __int64 xFixed_32_32; #else # if defined (_LP64) || \ defined(__alpha__) || defined(__alpha) || \ defined(ia64) || defined(__ia64__) || \ defined(__sparc64__) || \ defined(__s390x__) || \ defined(amd64) || defined (__amd64__) typedef long xFixed_32_32; # else # if defined(__GNUC__) && \ ((__GNUC__ > 2) || \ ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ > 7))) __extension__ # endif typedef long long int xFixed_32_32; # endif #endif typedef xFixed_32_32 xFixed_48_16; #define MAX_FIXED_48_16 ((xFixed_48_16) 0x7fffffff) #define MIN_FIXED_48_16 (-((xFixed_48_16) 1 << 31)) typedef CARD32 xFixed_1_31; typedef CARD32 xFixed_1_16; typedef INT32 xFixed_16_16; /* * An unadorned "xFixed" is the same as xFixed_16_16, * (since it's quite common in the code) */ typedef xFixed_16_16 xFixed; #define XFIXED_BITS 16 #define xFixedToInt(f) (int) ((f) >> XFIXED_BITS) #define IntToxFixed(i) ((xFixed) (i) << XFIXED_BITS) #define xFixedE ((xFixed) 1) #define xFixed1 (IntToxFixed(1)) #define xFixed1MinusE (xFixed1 - xFixedE) #define xFixedFrac(f) ((f) & xFixed1MinusE) #define xFixedFloor(f) ((f) & ~xFixed1MinusE) #define xFixedCeil(f) xFixedFloor((f) + xFixed1MinusE) #define xFixedFraction(f) ((f) & xFixed1MinusE) #define xFixedMod2(f) ((f) & (xFixed1 | xFixed1MinusE)) /* whether 't' is a well defined not obviously empty trapezoid */ #define xTrapezoidValid(t) ((t)->left.p1.y != (t)->left.p2.y && \ (t)->right.p1.y != (t)->right.p2.y && \ (int) ((t)->bottom - (t)->top) > 0) /* * Standard NTSC luminance conversions: * * y = r * 0.299 + g * 0.587 + b * 0.114 * * Approximate this for a bit more speed: * * y = (r * 153 + g * 301 + b * 58) / 512 * * This gives 17 bits of luminance; to get 15 bits, lop the low two */ #define CvtR8G8B8toY15(s) (((((s) >> 16) & 0xff) * 153 + \ (((s) >> 8) & 0xff) * 301 + \ (((s) ) & 0xff) * 58) >> 2) #endif /* _PICTURE_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/picturestr.h0000644000000000000000000004305413614532331020435 0ustar /* * $Id: picturestr.h,v 1.15 2005/12/09 18:35:21 ajax Exp $ * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifndef _PICTURESTR_H_ #define _PICTURESTR_H_ #include "glyphstr.h" #include "scrnintstr.h" #include "resource.h" typedef struct _DirectFormat { CARD16 red, redMask; CARD16 green, greenMask; CARD16 blue, blueMask; CARD16 alpha, alphaMask; } DirectFormatRec; typedef struct _IndexFormat { VisualID vid; ColormapPtr pColormap; int nvalues; xIndexValue *pValues; void *devPrivate; } IndexFormatRec; typedef struct _PictFormat { CARD32 id; CARD32 format; /* except bpp */ unsigned char type; unsigned char depth; DirectFormatRec direct; IndexFormatRec index; } PictFormatRec; typedef struct pixman_vector PictVector, *PictVectorPtr; typedef struct pixman_transform PictTransform, *PictTransformPtr; #define pict_f_transform pixman_f_transform #define PICT_GRADIENT_STOPTABLE_SIZE 1024 #define SourcePictTypeSolidFill 0 #define SourcePictTypeLinear 1 #define SourcePictTypeRadial 2 #define SourcePictTypeConical 3 #ifdef NXAGENT_SERVER #include "../hw/nxagent/NXpicturestr_PictSolidFill.h" #else typedef struct _PictSolidFill { unsigned int type; CARD32 color; } PictSolidFill, *PictSolidFillPtr; #endif /* NXAGENT_SERVER */ typedef struct _PictGradientStop { xFixed x; xRenderColor color; } PictGradientStop, *PictGradientStopPtr; typedef struct _PictGradient { unsigned int type; int nstops; PictGradientStopPtr stops; CARD32 colorTable[PICT_GRADIENT_STOPTABLE_SIZE]; } PictGradient, *PictGradientPtr; typedef struct _PictLinearGradient { unsigned int type; int nstops; PictGradientStopPtr stops; CARD32 colorTable[PICT_GRADIENT_STOPTABLE_SIZE]; xPointFixed p1; xPointFixed p2; } PictLinearGradient, *PictLinearGradientPtr; typedef struct _PictRadialGradient { unsigned int type; int nstops; PictGradientStopPtr stops; CARD32 colorTable[PICT_GRADIENT_STOPTABLE_SIZE]; double fx; double fy; double dx; double dy; double a; double m; double b; } PictRadialGradient, *PictRadialGradientPtr; typedef struct _PictConicalGradient { unsigned int type; int nstops; PictGradientStopPtr stops; CARD32 colorTable[PICT_GRADIENT_STOPTABLE_SIZE]; xPointFixed center; xFixed angle; } PictConicalGradient, *PictConicalGradientPtr; typedef union _SourcePict { unsigned int type; PictSolidFill solidFill; PictGradient gradient; PictLinearGradient linear; PictRadialGradient radial; PictConicalGradient conical; } SourcePict, *SourcePictPtr; typedef struct _Picture { DrawablePtr pDrawable; PictFormatPtr pFormat; CARD32 format; /* PICT_FORMAT */ int refcnt; CARD32 id; PicturePtr pNext; /* chain on same drawable */ unsigned int repeat : 1; unsigned int graphicsExposures : 1; unsigned int subWindowMode : 1; unsigned int polyEdge : 1; unsigned int polyMode : 1; unsigned int freeCompClip : 1; unsigned int clientClipType : 2; unsigned int componentAlpha : 1; unsigned int repeatType : 2; unsigned int unused : 21; PicturePtr alphaMap; DDXPointRec alphaOrigin; DDXPointRec clipOrigin; void *clientClip; Atom dither; unsigned long stateChanges; unsigned long serialNumber; RegionPtr pCompositeClip; DevUnion *devPrivates; PictTransform *transform; int filter; xFixed *filter_params; int filter_nparams; SourcePictPtr pSourcePict; } PictureRec; typedef Bool (*PictFilterValidateParamsProcPtr) (ScreenPtr pScreen, int id, xFixed *params, int nparams, int *width, int *height); typedef struct { char *name; int id; PictFilterValidateParamsProcPtr ValidateParams; int width, height; } PictFilterRec, *PictFilterPtr; #define PictFilterNearest 0 #define PictFilterBilinear 1 #define PictFilterFast 2 #define PictFilterGood 3 #define PictFilterBest 4 #define PictFilterConvolution 5 typedef struct { char *alias; int alias_id; int filter_id; } PictFilterAliasRec, *PictFilterAliasPtr; typedef int (*CreatePictureProcPtr) (PicturePtr pPicture); typedef void (*DestroyPictureProcPtr) (PicturePtr pPicture); typedef int (*ChangePictureClipProcPtr) (PicturePtr pPicture, int clipType, void *value, int n); typedef void (*DestroyPictureClipProcPtr)(PicturePtr pPicture); typedef int (*ChangePictureTransformProcPtr) (PicturePtr pPicture, PictTransform *transform); typedef int (*ChangePictureFilterProcPtr) (PicturePtr pPicture, int filter, xFixed *params, int nparams); typedef void (*DestroyPictureFilterProcPtr) (PicturePtr pPicture); typedef void (*ChangePictureProcPtr) (PicturePtr pPicture, Mask mask); typedef void (*ValidatePictureProcPtr) (PicturePtr pPicture, Mask mask); typedef void (*CompositeProcPtr) (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); typedef void (*GlyphsProcPtr) (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists, GlyphPtr *glyphs); typedef void (*CompositeRectsProcPtr) (CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects); typedef void (*RasterizeTrapezoidProcPtr)(PicturePtr pMask, xTrapezoid *trap, int x_off, int y_off); typedef void (*TrapezoidsProcPtr) (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps); typedef void (*TrianglesProcPtr) (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntri, xTriangle *tris); typedef void (*TriStripProcPtr) (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points); typedef void (*TriFanProcPtr) (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points); typedef Bool (*InitIndexedProcPtr) (ScreenPtr pScreen, PictFormatPtr pFormat); typedef void (*CloseIndexedProcPtr) (ScreenPtr pScreen, PictFormatPtr pFormat); typedef void (*UpdateIndexedProcPtr) (ScreenPtr pScreen, PictFormatPtr pFormat, int ndef, xColorItem *pdef); typedef void (*AddTrapsProcPtr) (PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntrap, xTrap *traps); typedef void (*AddTrianglesProcPtr) (PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntri, xTriangle *tris); typedef struct _PictureScreen { int totalPictureSize; unsigned int *PicturePrivateSizes; int PicturePrivateLen; PictFormatPtr formats; PictFormatPtr fallback; int nformats; CreatePictureProcPtr CreatePicture; DestroyPictureProcPtr DestroyPicture; ChangePictureClipProcPtr ChangePictureClip; DestroyPictureClipProcPtr DestroyPictureClip; ChangePictureProcPtr ChangePicture; ValidatePictureProcPtr ValidatePicture; CompositeProcPtr Composite; GlyphsProcPtr Glyphs; CompositeRectsProcPtr CompositeRects; DestroyWindowProcPtr DestroyWindow; CloseScreenProcPtr CloseScreen; StoreColorsProcPtr StoreColors; InitIndexedProcPtr InitIndexed; CloseIndexedProcPtr CloseIndexed; UpdateIndexedProcPtr UpdateIndexed; int subpixel; PictFilterPtr filters; int nfilters; PictFilterAliasPtr filterAliases; int nfilterAliases; ChangePictureTransformProcPtr ChangePictureTransform; /** * Called immediately after a picture's transform is changed through the * SetPictureFilter request. Not called for source-only pictures. */ ChangePictureFilterProcPtr ChangePictureFilter; DestroyPictureFilterProcPtr DestroyPictureFilter; TrapezoidsProcPtr Trapezoids; TrianglesProcPtr Triangles; TriStripProcPtr TriStrip; TriFanProcPtr TriFan; RasterizeTrapezoidProcPtr RasterizeTrapezoid; AddTrianglesProcPtr AddTriangles; AddTrapsProcPtr AddTraps; } PictureScreenRec, *PictureScreenPtr; extern int PictureScreenPrivateIndex; extern int PictureWindowPrivateIndex; extern RESTYPE PictureType; extern RESTYPE PictFormatType; extern RESTYPE GlyphSetType; #define GetPictureScreen(s) ((PictureScreenPtr) ((s)->devPrivates[PictureScreenPrivateIndex].ptr)) #define GetPictureScreenIfSet(s) ((PictureScreenPrivateIndex != -1) ? GetPictureScreen(s) : NULL) #define SetPictureScreen(s,p) ((s)->devPrivates[PictureScreenPrivateIndex].ptr = (void *) (p)) #define GetPictureWindow(w) ((PicturePtr) ((w)->devPrivates[PictureWindowPrivateIndex].ptr)) #define SetPictureWindow(w,p) ((w)->devPrivates[PictureWindowPrivateIndex].ptr = (void *) (p)) #define VERIFY_PICTURE(pPicture, pid, client, mode, err) {\ pPicture = SecurityLookupIDByType(client, pid, PictureType, mode);\ if (!pPicture) { \ client->errorValue = pid; \ return err; \ } \ } #define VERIFY_ALPHA(pPicture, pid, client, mode, err) {\ if (pid == None) \ pPicture = 0; \ else { \ VERIFY_PICTURE(pPicture, pid, client, mode, err); \ } \ } \ void ResetPicturePrivateIndex (void); int AllocatePicturePrivateIndex (void); Bool AllocatePicturePrivate (ScreenPtr pScreen, int index2, unsigned int amount); Bool PictureDestroyWindow (WindowPtr pWindow); Bool PictureCloseScreen (ScreenPtr pScreen); void PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef); Bool PictureInitIndexedFormats (ScreenPtr pScreen); Bool PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel); int PictureGetSubpixelOrder (ScreenPtr pScreen); PictFormatPtr PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp); PictFormatPtr PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual); PictFormatPtr PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 format); Bool PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); int PictureGetFilterId (char *filter, int len, Bool makeit); char * PictureGetFilterName (int id); int PictureAddFilter (ScreenPtr pScreen, char *filter, PictFilterValidateParamsProcPtr ValidateParams); Bool PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias); Bool PictureSetDefaultFilters (ScreenPtr pScreen); void PictureResetFilters (ScreenPtr pScreen); PictFilterPtr PictureFindFilter (ScreenPtr pScreen, char *name, int len); int SetPicturePictFilter (PicturePtr pPicture, PictFilterPtr pFilter, xFixed *params, int nparams); int SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams); Bool PictureFinishInit (void); void SetPictureToDefaults (PicturePtr pPicture); PicturePtr AllocatePicture (ScreenPtr pScreen); #if 0 Bool miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); #endif PicturePtr CreatePicture (Picture pid, DrawablePtr pDrawable, PictFormatPtr pFormat, Mask mask, XID *list, ClientPtr client, int *error); int ChangePicture (PicturePtr pPicture, Mask vmask, XID *vlist, DevUnion *ulist, ClientPtr client); int SetPictureClipRects (PicturePtr pPicture, int xOrigin, int yOrigin, int nRect, xRectangle *rects); int SetPictureClipRegion (PicturePtr pPicture, int xOrigin, int yOrigin, RegionPtr pRegion); int SetPictureTransform (PicturePtr pPicture, PictTransform *transform); void CopyPicture (PicturePtr pSrc, Mask mask, PicturePtr pDst); void ValidatePicture(PicturePtr pPicture); int FreePicture (void *pPicture, XID pid); int FreePictFormat (void *pPictFormat, XID pid); void CompositePicture (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); void CompositeGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr lists, GlyphPtr *glyphs); void CompositeRects (CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects); void CompositeTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps); void CompositeTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntriangles, xTriangle *triangles); void CompositeTriStrip (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoints, xPointFixed *points); void CompositeTriFan (CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoints, xPointFixed *points); Bool PictureTransformPoint (PictTransformPtr transform, PictVectorPtr vector); Bool PictureTransformPoint3d (PictTransformPtr transform, PictVectorPtr vector); void RenderExtensionInit (void); Bool AnimCurInit (ScreenPtr pScreen); int AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor); void AddTraps (PicturePtr pPicture, INT16 xOff, INT16 yOff, int ntraps, xTrap *traps); PicturePtr CreateSolidPicture (Picture pid, xRenderColor *color, int *error); PicturePtr CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2, int nStops, xFixed *stops, xRenderColor *colors, int *error); PicturePtr CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer, xFixed innerRadius, xFixed outerRadius, int nStops, xFixed *stops, xRenderColor *colors, int *error); PicturePtr CreateConicalGradientPicture (Picture pid, xPointFixed *center, xFixed angle, int nStops, xFixed *stops, xRenderColor *colors, int *error); #ifdef PANORAMIX void PanoramiXRenderInit (void); void PanoramiXRenderReset (void); #endif /* * matrix.c */ extern _X_EXPORT void PictTransform_from_xRenderTransform(PictTransformPtr pict, xRenderTransform * render); extern _X_EXPORT void xRenderTransform_from_PictTransform(xRenderTransform * render, PictTransformPtr pict); extern _X_EXPORT Bool PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector); extern _X_EXPORT Bool PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector); #endif /* _PICTURESTR_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/render.c0000644000000000000000000025272513614532331017512 0ustar /* * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of SuSE not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. SuSE makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "resource.h" #include "scrnintstr.h" #include "windowstr.h" #include "pixmapstr.h" #include "colormapst.h" #include "extnsionst.h" #include "servermd.h" #include #include #include "picturestr.h" #include "glyphstr.h" #include #include "cursorstr.h" #include "protocol-versions.h" #if !defined(UINT32_MAX) #define UINT32_MAX 0xffffffffU #endif static int ProcRenderQueryVersion (ClientPtr pClient); static int ProcRenderQueryPictFormats (ClientPtr pClient); static int ProcRenderQueryPictIndexValues (ClientPtr pClient); static int ProcRenderQueryDithers (ClientPtr pClient); static int ProcRenderCreatePicture (ClientPtr pClient); static int ProcRenderChangePicture (ClientPtr pClient); static int ProcRenderSetPictureClipRectangles (ClientPtr pClient); static int ProcRenderFreePicture (ClientPtr pClient); static int ProcRenderComposite (ClientPtr pClient); static int ProcRenderScale (ClientPtr pClient); static int ProcRenderTrapezoids (ClientPtr pClient); static int ProcRenderTriangles (ClientPtr pClient); static int ProcRenderTriStrip (ClientPtr pClient); static int ProcRenderTriFan (ClientPtr pClient); static int ProcRenderColorTrapezoids (ClientPtr pClient); static int ProcRenderColorTriangles (ClientPtr pClient); static int ProcRenderTransform (ClientPtr pClient); static int ProcRenderCreateGlyphSet (ClientPtr pClient); static int ProcRenderReferenceGlyphSet (ClientPtr pClient); static int ProcRenderFreeGlyphSet (ClientPtr pClient); static int ProcRenderAddGlyphs (ClientPtr pClient); static int ProcRenderAddGlyphsFromPicture (ClientPtr pClient); static int ProcRenderFreeGlyphs (ClientPtr pClient); static int ProcRenderCompositeGlyphs (ClientPtr pClient); static int ProcRenderFillRectangles (ClientPtr pClient); static int ProcRenderCreateCursor (ClientPtr pClient); static int ProcRenderSetPictureTransform (ClientPtr pClient); static int ProcRenderQueryFilters (ClientPtr pClient); static int ProcRenderSetPictureFilter (ClientPtr pClient); static int ProcRenderCreateAnimCursor (ClientPtr pClient); static int ProcRenderAddTraps (ClientPtr pClient); static int ProcRenderCreateSolidFill (ClientPtr pClient); static int ProcRenderCreateLinearGradient (ClientPtr pClient); static int ProcRenderCreateRadialGradient (ClientPtr pClient); static int ProcRenderCreateConicalGradient (ClientPtr pClient); static int ProcRenderDispatch (ClientPtr pClient); static int SProcRenderQueryVersion (ClientPtr pClient); static int SProcRenderQueryPictFormats (ClientPtr pClient); static int SProcRenderQueryPictIndexValues (ClientPtr pClient); static int SProcRenderQueryDithers (ClientPtr pClient); static int SProcRenderCreatePicture (ClientPtr pClient); static int SProcRenderChangePicture (ClientPtr pClient); static int SProcRenderSetPictureClipRectangles (ClientPtr pClient); static int SProcRenderFreePicture (ClientPtr pClient); static int SProcRenderComposite (ClientPtr pClient); static int SProcRenderScale (ClientPtr pClient); static int SProcRenderTrapezoids (ClientPtr pClient); static int SProcRenderTriangles (ClientPtr pClient); static int SProcRenderTriStrip (ClientPtr pClient); static int SProcRenderTriFan (ClientPtr pClient); static int SProcRenderColorTrapezoids (ClientPtr pClient); static int SProcRenderColorTriangles (ClientPtr pClient); static int SProcRenderTransform (ClientPtr pClient); static int SProcRenderCreateGlyphSet (ClientPtr pClient); static int SProcRenderReferenceGlyphSet (ClientPtr pClient); static int SProcRenderFreeGlyphSet (ClientPtr pClient); static int SProcRenderAddGlyphs (ClientPtr pClient); static int SProcRenderAddGlyphsFromPicture (ClientPtr pClient); static int SProcRenderFreeGlyphs (ClientPtr pClient); static int SProcRenderCompositeGlyphs (ClientPtr pClient); static int SProcRenderFillRectangles (ClientPtr pClient); static int SProcRenderCreateCursor (ClientPtr pClient); static int SProcRenderSetPictureTransform (ClientPtr pClient); static int SProcRenderQueryFilters (ClientPtr pClient); static int SProcRenderSetPictureFilter (ClientPtr pClient); static int SProcRenderCreateAnimCursor (ClientPtr pClient); static int SProcRenderAddTraps (ClientPtr pClient); static int SProcRenderCreateSolidFill (ClientPtr pClient); static int SProcRenderCreateLinearGradient (ClientPtr pClient); static int SProcRenderCreateRadialGradient (ClientPtr pClient); static int SProcRenderCreateConicalGradient (ClientPtr pClient); static int SProcRenderDispatch (ClientPtr pClient); #ifdef NXAGENT_SERVER static int xorg_ProcRenderDispatch (ClientPtr pClient); static int xorg_SProcRenderDispatch (ClientPtr pClient); #endif int (*ProcRenderVector[RenderNumberRequests])(ClientPtr) = { ProcRenderQueryVersion, ProcRenderQueryPictFormats, ProcRenderQueryPictIndexValues, ProcRenderQueryDithers, ProcRenderCreatePicture, ProcRenderChangePicture, ProcRenderSetPictureClipRectangles, ProcRenderFreePicture, ProcRenderComposite, ProcRenderScale, ProcRenderTrapezoids, ProcRenderTriangles, ProcRenderTriStrip, ProcRenderTriFan, ProcRenderColorTrapezoids, ProcRenderColorTriangles, ProcRenderTransform, ProcRenderCreateGlyphSet, ProcRenderReferenceGlyphSet, ProcRenderFreeGlyphSet, ProcRenderAddGlyphs, ProcRenderAddGlyphsFromPicture, ProcRenderFreeGlyphs, ProcRenderCompositeGlyphs, ProcRenderCompositeGlyphs, ProcRenderCompositeGlyphs, ProcRenderFillRectangles, ProcRenderCreateCursor, ProcRenderSetPictureTransform, ProcRenderQueryFilters, ProcRenderSetPictureFilter, ProcRenderCreateAnimCursor, ProcRenderAddTraps, ProcRenderCreateSolidFill, ProcRenderCreateLinearGradient, ProcRenderCreateRadialGradient, ProcRenderCreateConicalGradient }; int (*SProcRenderVector[RenderNumberRequests])(ClientPtr) = { SProcRenderQueryVersion, SProcRenderQueryPictFormats, SProcRenderQueryPictIndexValues, SProcRenderQueryDithers, SProcRenderCreatePicture, SProcRenderChangePicture, SProcRenderSetPictureClipRectangles, SProcRenderFreePicture, SProcRenderComposite, SProcRenderScale, SProcRenderTrapezoids, SProcRenderTriangles, SProcRenderTriStrip, SProcRenderTriFan, SProcRenderColorTrapezoids, SProcRenderColorTriangles, SProcRenderTransform, SProcRenderCreateGlyphSet, SProcRenderReferenceGlyphSet, SProcRenderFreeGlyphSet, SProcRenderAddGlyphs, SProcRenderAddGlyphsFromPicture, SProcRenderFreeGlyphs, SProcRenderCompositeGlyphs, SProcRenderCompositeGlyphs, SProcRenderCompositeGlyphs, SProcRenderFillRectangles, SProcRenderCreateCursor, SProcRenderSetPictureTransform, SProcRenderQueryFilters, SProcRenderSetPictureFilter, SProcRenderCreateAnimCursor, SProcRenderAddTraps, SProcRenderCreateSolidFill, SProcRenderCreateLinearGradient, SProcRenderCreateRadialGradient, SProcRenderCreateConicalGradient }; static void RenderResetProc (ExtensionEntry *extEntry); #if 0 static CARD8 RenderReqCode; #endif int RenderErrBase; int RenderClientPrivateIndex; typedef struct _RenderClient { int major_version; int minor_version; } RenderClientRec, *RenderClientPtr; #define GetRenderClient(pClient) ((RenderClientPtr) (pClient)->devPrivates[RenderClientPrivateIndex].ptr) static void RenderClientCallback (CallbackListPtr *list, void * closure, void * data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; RenderClientPtr pRenderClient = GetRenderClient (pClient); pRenderClient->major_version = 0; pRenderClient->minor_version = 0; } void RenderExtensionInit (void) { ExtensionEntry *extEntry; if (!PictureType) return; if (!PictureFinishInit ()) return; RenderClientPrivateIndex = AllocateClientPrivateIndex (); if (!AllocateClientPrivate (RenderClientPrivateIndex, sizeof (RenderClientRec))) return; if (!AddCallback (&ClientStateCallback, RenderClientCallback, 0)) return; extEntry = AddExtension (RENDER_NAME, 0, RenderNumberErrors, ProcRenderDispatch, SProcRenderDispatch, RenderResetProc, StandardMinorOpcode); if (!extEntry) return; #if 0 RenderReqCode = (CARD8) extEntry->base; #endif RenderErrBase = extEntry->errorBase; } static void RenderResetProc (ExtensionEntry *extEntry) { ResetPicturePrivateIndex(); ResetGlyphSetPrivateIndex(); } #ifndef NXAGENT_SERVER static int ProcRenderQueryVersion (ClientPtr client) { RenderClientPtr pRenderClient = GetRenderClient (client); xRenderQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, .majorVersion = SERVER_RENDER_MAJOR_VERSION, .minorVersion = SERVER_RENDER_MINOR_VERSION }; REQUEST(xRenderQueryVersionReq); REQUEST_SIZE_MATCH(xRenderQueryVersionReq); pRenderClient->major_version = stuff->majorVersion; pRenderClient->minor_version = stuff->minorVersion; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.majorVersion); swapl(&rep.minorVersion); } WriteToClient(client, sizeof(xRenderQueryVersionReply), &rep); return (client->noClientException); } #endif /* NXAGENT_SERVER */ #if 0 static int VisualDepth (ScreenPtr pScreen, VisualPtr pVisual) { DepthPtr pDepth; int d, v; for (d = 0; d < pScreen->numDepths; d++) { pDepth = pScreen->allowedDepths + d; for (v = 0; v < pDepth->numVids; v++) { if (pDepth->vids[v] == pVisual->vid) return pDepth->depth; } } return 0; } #endif static VisualPtr findVisual (ScreenPtr pScreen, VisualID vid) { VisualPtr pVisual; int v; for (v = 0; v < pScreen->numVisuals; v++) { pVisual = pScreen->visuals + v; if (pVisual->vid == vid) return pVisual; } return 0; } extern char *ConnectionInfo; #ifndef NXAGENT_SERVER static int ProcRenderQueryPictFormats (ClientPtr client) { RenderClientPtr pRenderClient = GetRenderClient (client); xRenderQueryPictFormatsReply *reply; xPictScreen *pictScreen; xPictDepth *pictDepth; xPictVisual *pictVisual; xPictFormInfo *pictForm; CARD32 *pictSubpixel; ScreenPtr pScreen; VisualPtr pVisual; DepthPtr pDepth; int v, d; PictureScreenPtr ps; PictFormatPtr pFormat; int nformat; int ndepth; int nvisual; int rlength; int s; int n; int numScreens; int numSubpixel; /* REQUEST(xRenderQueryPictFormatsReq); */ REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq); #ifdef PANORAMIX if (noPanoramiXExtension) numScreens = screenInfo.numScreens; else numScreens = ((xConnSetup *)ConnectionInfo)->numRoots; #else numScreens = screenInfo.numScreens; #endif ndepth = nformat = nvisual = 0; for (s = 0; s < numScreens; s++) { pScreen = screenInfo.screens[s]; for (d = 0; d < pScreen->numDepths; d++) { pDepth = pScreen->allowedDepths + d; ++ndepth; for (v = 0; v < pDepth->numVids; v++) { pVisual = findVisual (pScreen, pDepth->vids[v]); if (pVisual && PictureMatchVisual (pScreen, pDepth->depth, pVisual)) ++nvisual; } } ps = GetPictureScreenIfSet(pScreen); if (ps) nformat += ps->nformats; } if (pRenderClient->major_version == 0 && pRenderClient->minor_version < 6) numSubpixel = 0; else numSubpixel = numScreens; rlength = (sizeof (xRenderQueryPictFormatsReply) + nformat * sizeof (xPictFormInfo) + numScreens * sizeof (xPictScreen) + ndepth * sizeof (xPictDepth) + nvisual * sizeof (xPictVisual) + numSubpixel * sizeof (CARD32)); reply = (xRenderQueryPictFormatsReply *) malloc (rlength); if (!reply) return BadAlloc; memset(reply, 0, rlength); reply->type = X_Reply; reply->sequenceNumber = client->sequence; reply->length = (rlength - sizeof(xGenericReply)) >> 2; reply->numFormats = nformat; reply->numScreens = numScreens; reply->numDepths = ndepth; reply->numVisuals = nvisual; reply->numSubpixel = numSubpixel; pictForm = (xPictFormInfo *) (reply + 1); for (s = 0; s < numScreens; s++) { pScreen = screenInfo.screens[s]; ps = GetPictureScreenIfSet(pScreen); if (ps) { for (nformat = 0, pFormat = ps->formats; nformat < ps->nformats; nformat++, pFormat++) { pictForm->id = pFormat->id; pictForm->type = pFormat->type; pictForm->depth = pFormat->depth; pictForm->direct.red = pFormat->direct.red; pictForm->direct.redMask = pFormat->direct.redMask; pictForm->direct.green = pFormat->direct.green; pictForm->direct.greenMask = pFormat->direct.greenMask; pictForm->direct.blue = pFormat->direct.blue; pictForm->direct.blueMask = pFormat->direct.blueMask; pictForm->direct.alpha = pFormat->direct.alpha; pictForm->direct.alphaMask = pFormat->direct.alphaMask; if (pFormat->type == PictTypeIndexed && pFormat->index.pColormap) pictForm->colormap = pFormat->index.pColormap->mid; else pictForm->colormap = None; if (client->swapped) { swapl (&pictForm->id); swaps (&pictForm->direct.red); swaps (&pictForm->direct.redMask); swaps (&pictForm->direct.green); swaps (&pictForm->direct.greenMask); swaps (&pictForm->direct.blue); swaps (&pictForm->direct.blueMask); swaps (&pictForm->direct.alpha); swaps (&pictForm->direct.alphaMask); swapl (&pictForm->colormap); } pictForm++; } } } pictScreen = (xPictScreen *) pictForm; for (s = 0; s < numScreens; s++) { pScreen = screenInfo.screens[s]; pictDepth = (xPictDepth *) (pictScreen + 1); ndepth = 0; for (d = 0; d < pScreen->numDepths; d++) { pictVisual = (xPictVisual *) (pictDepth + 1); pDepth = pScreen->allowedDepths + d; nvisual = 0; for (v = 0; v < pDepth->numVids; v++) { pVisual = findVisual (pScreen, pDepth->vids[v]); if (pVisual && (pFormat = PictureMatchVisual (pScreen, pDepth->depth, pVisual))) { pictVisual->visual = pVisual->vid; pictVisual->format = pFormat->id; if (client->swapped) { swapl (&pictVisual->visual); swapl (&pictVisual->format); } pictVisual++; nvisual++; } } pictDepth->depth = pDepth->depth; pictDepth->nPictVisuals = nvisual; if (client->swapped) { swaps (&pictDepth->nPictVisuals); } ndepth++; pictDepth = (xPictDepth *) pictVisual; } pictScreen->nDepth = ndepth; ps = GetPictureScreenIfSet(pScreen); if (ps) pictScreen->fallback = ps->fallback->id; else pictScreen->fallback = 0; if (client->swapped) { swapl (&pictScreen->nDepth); swapl (&pictScreen->fallback); } pictScreen = (xPictScreen *) pictDepth; } pictSubpixel = (CARD32 *) pictScreen; for (s = 0; s < numSubpixel; s++) { pScreen = screenInfo.screens[s]; ps = GetPictureScreenIfSet(pScreen); if (ps) *pictSubpixel = ps->subpixel; else *pictSubpixel = SubPixelUnknown; if (client->swapped) { swapl (pictSubpixel); } ++pictSubpixel; } if (client->swapped) { swaps (&reply->sequenceNumber); swapl (&reply->length); swapl (&reply->numFormats); swapl (&reply->numScreens); swapl (&reply->numDepths); swapl (&reply->numVisuals); swapl (&reply->numSubpixel); } WriteToClient(client, rlength, reply); free (reply); return client->noClientException; } #endif /* NXAGENT_SERVER */ static int ProcRenderQueryPictIndexValues (ClientPtr client) { PictFormatPtr pFormat; int num; int rlength; int i; REQUEST(xRenderQueryPictIndexValuesReq); xRenderQueryPictIndexValuesReply *reply; xIndexValue *values; REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq); pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, DixReadAccess); if (!pFormat) { client->errorValue = stuff->format; return RenderErrBase + BadPictFormat; } if (pFormat->type != PictTypeIndexed) { client->errorValue = stuff->format; return BadMatch; } num = pFormat->index.nvalues; rlength = (sizeof (xRenderQueryPictIndexValuesReply) + num * sizeof(xIndexValue)); reply = (xRenderQueryPictIndexValuesReply *) calloc (1, rlength); if (!reply) return BadAlloc; reply->type = X_Reply; reply->sequenceNumber = client->sequence; reply->length = (rlength - sizeof(xGenericReply)) >> 2; reply->numIndexValues = num; values = (xIndexValue *) (reply + 1); memcpy (reply + 1, pFormat->index.pValues, num * sizeof (xIndexValue)); if (client->swapped) { for (i = 0; i < num; i++) { swapl (&values[i].pixel); swaps (&values[i].red); swaps (&values[i].green); swaps (&values[i].blue); swaps (&values[i].alpha); } swaps (&reply->sequenceNumber); swapl (&reply->length); swapl (&reply->numIndexValues); } WriteToClient(client, rlength, reply); free(reply); return (client->noClientException); } static int ProcRenderQueryDithers (ClientPtr client) { return BadImplementation; } #ifndef NXAGENT_SERVER static int ProcRenderCreatePicture (ClientPtr client) { PicturePtr pPicture; DrawablePtr pDrawable; PictFormatPtr pFormat; int len; int error; REQUEST(xRenderCreatePictureReq); REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); LEGAL_NEW_RESOURCE(stuff->pid, client); SECURITY_VERIFY_DRAWABLE(pDrawable, stuff->drawable, client, DixWriteAccess); pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, DixReadAccess); if (!pFormat) { client->errorValue = stuff->format; return RenderErrBase + BadPictFormat; } if (pFormat->depth != pDrawable->depth) return BadMatch; len = client->req_len - (sizeof(xRenderCreatePictureReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; pPicture = CreatePicture (stuff->pid, pDrawable, pFormat, stuff->mask, (XID *) (stuff + 1), client, &error); if (!pPicture) return error; if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } static int ProcRenderChangePicture (ClientPtr client) { PicturePtr pPicture; REQUEST(xRenderChangePictureReq); int len; REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); len = client->req_len - (sizeof(xRenderChangePictureReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; return ChangePicture (pPicture, stuff->mask, (XID *) (stuff + 1), (DevUnion *) 0, client); } static int ProcRenderSetPictureClipRectangles (ClientPtr client) { REQUEST(xRenderSetPictureClipRectanglesReq); PicturePtr pPicture; int nr; int result; REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pPicture->pDrawable) return BadDrawable; nr = (client->req_len << 2) - sizeof(xRenderChangePictureReq); if (nr & 4) return BadLength; nr >>= 3; result = SetPictureClipRects (pPicture, stuff->xOrigin, stuff->yOrigin, nr, (xRectangle *) &stuff[1]); if (client->noClientException != Success) return(client->noClientException); else return(result); } #endif /* NXAGENT_SERVER */ static int ProcRenderFreePicture (ClientPtr client) { PicturePtr pPicture; REQUEST(xRenderFreePictureReq); REQUEST_SIZE_MATCH(xRenderFreePictureReq); VERIFY_PICTURE (pPicture, stuff->picture, client, DixDestroyAccess, RenderErrBase + BadPicture); FreeResource (stuff->picture, RT_NONE); return(client->noClientException); } static Bool PictOpValid (CARD8 op) { if (/*PictOpMinimum <= op && */ op <= PictOpMaximum) return TRUE; if (PictOpDisjointMinimum <= op && op <= PictOpDisjointMaximum) return TRUE; if (PictOpConjointMinimum <= op && op <= PictOpConjointMaximum) return TRUE; return FALSE; } #ifndef NXAGENT_SERVER static int ProcRenderComposite (ClientPtr client) { PicturePtr pSrc, pMask, pDst; REQUEST(xRenderCompositeReq); REQUEST_SIZE_MATCH(xRenderCompositeReq); if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_ALPHA (pMask, stuff->mask, client, DixReadAccess, RenderErrBase + BadPicture); if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) || (pMask && pMask->pDrawable && pSrc->pDrawable->pScreen != pMask->pDrawable->pScreen)) return BadMatch; CompositePicture (stuff->op, pSrc, pMask, pDst, stuff->xSrc, stuff->ySrc, stuff->xMask, stuff->yMask, stuff->xDst, stuff->yDst, stuff->width, stuff->height); return Success; } #endif /* NXAGENT_SERVER */ static int ProcRenderScale (ClientPtr client) { return BadImplementation; } #ifndef NXAGENT_SERVER static int ProcRenderTrapezoids (ClientPtr client) { int ntraps; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrapezoidsReq); REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq); if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; return RenderErrBase + BadPictFormat; } } else pFormat = 0; ntraps = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq); if (ntraps % sizeof (xTrapezoid)) return BadLength; ntraps /= sizeof (xTrapezoid); if (ntraps) CompositeTrapezoids (stuff->op, pSrc, pDst, pFormat, stuff->xSrc, stuff->ySrc, ntraps, (xTrapezoid *) &stuff[1]); return client->noClientException; } #endif /* NXAGENT_SERVER */ static int ProcRenderTriangles (ClientPtr client) { int ntris; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrianglesReq); REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; return RenderErrBase + BadPictFormat; } } else pFormat = 0; ntris = (client->req_len << 2) - sizeof (xRenderTrianglesReq); if (ntris % sizeof (xTriangle)) return BadLength; ntris /= sizeof (xTriangle); if (ntris) CompositeTriangles (stuff->op, pSrc, pDst, pFormat, stuff->xSrc, stuff->ySrc, ntris, (xTriangle *) &stuff[1]); return client->noClientException; } static int ProcRenderTriStrip (ClientPtr client) { int npoints; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrianglesReq); REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; return RenderErrBase + BadPictFormat; } } else pFormat = 0; npoints = ((client->req_len << 2) - sizeof (xRenderTriStripReq)); if (npoints & 4) return(BadLength); npoints >>= 3; if (npoints >= 3) CompositeTriStrip (stuff->op, pSrc, pDst, pFormat, stuff->xSrc, stuff->ySrc, npoints, (xPointFixed *) &stuff[1]); return client->noClientException; } static int ProcRenderTriFan (ClientPtr client) { int npoints; PicturePtr pSrc, pDst; PictFormatPtr pFormat; REQUEST(xRenderTrianglesReq); REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; return RenderErrBase + BadPictFormat; } } else pFormat = 0; npoints = ((client->req_len << 2) - sizeof (xRenderTriStripReq)); if (npoints & 4) return(BadLength); npoints >>= 3; if (npoints >= 3) CompositeTriFan (stuff->op, pSrc, pDst, pFormat, stuff->xSrc, stuff->ySrc, npoints, (xPointFixed *) &stuff[1]); return client->noClientException; } static int ProcRenderColorTrapezoids (ClientPtr client) { return BadImplementation; } static int ProcRenderColorTriangles (ClientPtr client) { return BadImplementation; } static int ProcRenderTransform (ClientPtr client) { return BadImplementation; } #ifndef NXAGENT_SERVER static int ProcRenderCreateGlyphSet (ClientPtr client) { GlyphSetPtr glyphSet; PictFormatPtr format; int f; REQUEST(xRenderCreateGlyphSetReq); REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq); LEGAL_NEW_RESOURCE(stuff->gsid, client); format = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, DixReadAccess); if (!format) { client->errorValue = stuff->format; return RenderErrBase + BadPictFormat; } switch (format->depth) { case 1: f = GlyphFormat1; break; case 4: f = GlyphFormat4; break; case 8: f = GlyphFormat8; break; case 16: f = GlyphFormat16; break; case 32: f = GlyphFormat32; break; default: return BadMatch; } if (format->type != PictTypeDirect) return BadMatch; glyphSet = AllocateGlyphSet (f, format); if (!glyphSet) return BadAlloc; if (!AddResource (stuff->gsid, GlyphSetType, (void *)glyphSet)) return BadAlloc; return Success; } static int ProcRenderReferenceGlyphSet (ClientPtr client) { GlyphSetPtr glyphSet; REQUEST(xRenderReferenceGlyphSetReq); REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq); LEGAL_NEW_RESOURCE(stuff->gsid, client); glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->existing, GlyphSetType, DixWriteAccess); if (!glyphSet) { client->errorValue = stuff->existing; return RenderErrBase + BadGlyphSet; } glyphSet->refcnt++; if (!AddResource (stuff->gsid, GlyphSetType, (void *)glyphSet)) return BadAlloc; return client->noClientException; } #endif /* NXAGENT_SERVER */ #define NLOCALDELTA 64 #define NLOCALGLYPH 256 #ifndef NXAGENT_SERVER static int ProcRenderFreeGlyphSet (ClientPtr client) { GlyphSetPtr glyphSet; REQUEST(xRenderFreeGlyphSetReq); REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, DixDestroyAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; return RenderErrBase + BadGlyphSet; } FreeResource (stuff->glyphset, RT_NONE); return client->noClientException; } #endif /* NXAGENT_SERVER */ typedef struct _GlyphNew { Glyph id; GlyphPtr glyph; } GlyphNewRec, *GlyphNewPtr; static int ProcRenderAddGlyphs (ClientPtr client) { GlyphSetPtr glyphSet; REQUEST(xRenderAddGlyphsReq); GlyphNewRec glyphsLocal[NLOCALGLYPH]; GlyphNewPtr glyphsBase, glyphs; GlyphPtr glyph = NULL; int remain, nglyphs; CARD32 *gids; xGlyphInfo *gi; CARD8 *bits; int size; int err = BadAlloc; REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq); glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, DixWriteAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; return RenderErrBase + BadGlyphSet; } nglyphs = stuff->nglyphs; if (nglyphs > UINT32_MAX / sizeof(GlyphNewRec)) return BadAlloc; if (nglyphs <= NLOCALGLYPH) glyphsBase = glyphsLocal; else { glyphsBase = (GlyphNewPtr) malloc (nglyphs * sizeof (GlyphNewRec)); if (!glyphsBase) return BadAlloc; } remain = (client->req_len << 2) - sizeof (xRenderAddGlyphsReq); glyphs = glyphsBase; gids = (CARD32 *) (stuff + 1); gi = (xGlyphInfo *) (gids + nglyphs); bits = (CARD8 *) (gi + nglyphs); remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs; while (remain >= 0 && nglyphs) { glyph = AllocateGlyph (gi, glyphSet->fdepth); if (!glyph) { err = BadAlloc; goto bail; } glyphs->glyph = glyph; glyphs->id = *gids; size = glyph->size - sizeof (xGlyphInfo); if (remain < size) break; memcpy ((CARD8 *) (glyph + 1), bits, size); if (size & 3) size += 4 - (size & 3); bits += size; remain -= size; gi++; gids++; glyphs++; nglyphs--; } if (nglyphs || remain) { err = BadLength; goto bail; } nglyphs = stuff->nglyphs; if (!ResizeGlyphSet (glyphSet, nglyphs)) { err = BadAlloc; goto bail; } glyphs = glyphsBase; while (nglyphs--) { AddGlyph (glyphSet, glyphs->glyph, glyphs->id); glyphs++; } if (glyphsBase != glyphsLocal) free (glyphsBase); return client->noClientException; bail: while (glyphs != glyphsBase) { --glyphs; free (glyphs->glyph); } if (glyphsBase != glyphsLocal) free (glyphsBase); return err; } static int ProcRenderAddGlyphsFromPicture (ClientPtr client) { return BadImplementation; } #ifndef NXAGENT_SERVER static int ProcRenderFreeGlyphs (ClientPtr client) { REQUEST(xRenderFreeGlyphsReq); GlyphSetPtr glyphSet; int nglyph; CARD32 *gids; CARD32 glyph; REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, DixWriteAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; return RenderErrBase + BadGlyphSet; } nglyph = ((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)) >> 2; gids = (CARD32 *) (stuff + 1); while (nglyph-- > 0) { glyph = *gids++; if (!DeleteGlyph (glyphSet, glyph)) { client->errorValue = glyph; return RenderErrBase + BadGlyph; } } return client->noClientException; } static int ProcRenderCompositeGlyphs (ClientPtr client) { GlyphSetPtr glyphSet; GlyphSet gs; PicturePtr pSrc, pDst; PictFormatPtr pFormat; GlyphListRec listsLocal[NLOCALDELTA]; GlyphListPtr lists, listsBase; GlyphPtr glyphsLocal[NLOCALGLYPH]; Glyph glyph; GlyphPtr *glyphs, *glyphsBase; xGlyphElt *elt; CARD8 *buffer, *end; int nglyph; int nlist; int space; int size; int n; REQUEST(xRenderCompositeGlyphsReq); REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq); switch (stuff->renderReqType) { default: size = 1; break; case X_RenderCompositeGlyphs16: size = 2; break; case X_RenderCompositeGlyphs32: size = 4; break; } if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; if (stuff->maskFormat) { pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; return RenderErrBase + BadPictFormat; } } else pFormat = 0; glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, DixReadAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; return RenderErrBase + BadGlyphSet; } buffer = (CARD8 *) (stuff + 1); end = (CARD8 *) stuff + (client->req_len << 2); nglyph = 0; nlist = 0; while (buffer + sizeof (xGlyphElt) < end) { elt = (xGlyphElt *) buffer; buffer += sizeof (xGlyphElt); if (elt->len == 0xff) { buffer += 4; } else { nlist++; nglyph += elt->len; space = size * elt->len; if (space & 3) space += 4 - (space & 3); buffer += space; } } if (nglyph <= NLOCALGLYPH) glyphsBase = glyphsLocal; else { glyphsBase = (GlyphPtr *) malloc (nglyph * sizeof (GlyphPtr)); if (!glyphsBase) return BadAlloc; } if (nlist <= NLOCALDELTA) listsBase = listsLocal; else { listsBase = (GlyphListPtr) malloc (nlist * sizeof (GlyphListRec)); if (!listsBase) { if (glyphsBase != glyphsLocal) free(glyphsBase); return BadAlloc; } } buffer = (CARD8 *) (stuff + 1); glyphs = glyphsBase; lists = listsBase; while (buffer + sizeof (xGlyphElt) < end) { elt = (xGlyphElt *) buffer; buffer += sizeof (xGlyphElt); if (elt->len == 0xff) { if (buffer + sizeof (GlyphSet) < end) { memcpy(&gs, buffer, sizeof(GlyphSet)); glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, gs, GlyphSetType, DixReadAccess); if (!glyphSet) { client->errorValue = gs; if (glyphsBase != glyphsLocal) free (glyphsBase); if (listsBase != listsLocal) free (listsBase); return RenderErrBase + BadGlyphSet; } } buffer += 4; } else { lists->xOff = elt->deltax; lists->yOff = elt->deltay; lists->format = glyphSet->format; lists->len = 0; n = elt->len; while (n--) { if (buffer + size <= end) { switch (size) { case 1: glyph = *((CARD8 *)buffer); break; case 2: glyph = *((CARD16 *)buffer); break; case 4: default: glyph = *((CARD32 *)buffer); break; } if ((*glyphs = FindGlyph (glyphSet, glyph))) { lists->len++; glyphs++; } } buffer += size; } space = size * elt->len; if (space & 3) buffer += 4 - (space & 3); lists++; } } if (buffer > end) { if (glyphsBase != glyphsLocal) free(glyphsBase); if (listsBase != listsLocal) free(listsBase); return BadLength; } CompositeGlyphs (stuff->op, pSrc, pDst, pFormat, stuff->xSrc, stuff->ySrc, nlist, listsBase, glyphsBase); if (glyphsBase != glyphsLocal) free (glyphsBase); if (listsBase != listsLocal) free (listsBase); return client->noClientException; } static int ProcRenderFillRectangles (ClientPtr client) { PicturePtr pDst; int things; REQUEST(xRenderFillRectanglesReq); REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq); if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; things = (client->req_len << 2) - sizeof(xRenderFillRectanglesReq); if (things & 4) return(BadLength); things >>= 3; CompositeRects (stuff->op, pDst, &stuff->color, things, (xRectangle *) &stuff[1]); return client->noClientException; } #endif /* NXAGENT_SERVER */ static void SetBit (unsigned char *line, int x, int bit) { unsigned char mask; if (screenInfo.bitmapBitOrder == LSBFirst) mask = (1 << (x & 7)); else mask = (0x80 >> (x & 7)); /* XXX assumes byte order is host byte order */ line += (x >> 3); if (bit) *line |= mask; else *line &= ~mask; } #define DITHER_DIM 2 static CARD32 orderedDither[DITHER_DIM][DITHER_DIM] = { { 1, 3, }, { 4, 2, }, }; #define DITHER_SIZE ((sizeof orderedDither / sizeof orderedDither[0][0]) + 1) #ifndef NXAGENT_SERVER static int ProcRenderCreateCursor (ClientPtr client) { REQUEST(xRenderCreateCursorReq); PicturePtr pSrc; ScreenPtr pScreen; unsigned short width, height; CARD32 *argbbits, *argb; unsigned char *srcbits, *srcline; unsigned char *mskbits, *mskline; int stride; int x, y; int nbytes_mono; CursorMetricRec cm; CursorPtr pCursor; CARD32 twocolor[3]; int ncolor; REQUEST_SIZE_MATCH (xRenderCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); if (!pSrc->pDrawable) return BadDrawable; pScreen = pSrc->pDrawable->pScreen; width = pSrc->pDrawable->width; height = pSrc->pDrawable->height; if (height && width > UINT32_MAX/(height*sizeof(CARD32))) return BadAlloc; if ( stuff->x > width || stuff->y > height ) return (BadMatch); argbbits = malloc (width * height * sizeof (CARD32)); if (!argbbits) return (BadAlloc); stride = BitmapBytePad(width); nbytes_mono = stride*height; srcbits = (unsigned char *)malloc(nbytes_mono); if (!srcbits) { free (argbbits); return (BadAlloc); } mskbits = (unsigned char *)malloc(nbytes_mono); if (!mskbits) { free(argbbits); free(srcbits); return (BadAlloc); } bzero ((char *) mskbits, nbytes_mono); bzero ((char *) srcbits, nbytes_mono); if (pSrc->format == PICT_a8r8g8b8) { (*pScreen->GetImage) (pSrc->pDrawable, 0, 0, width, height, ZPixmap, 0xffffffff, (void *) argbbits); } else { PixmapPtr pPixmap; PicturePtr pPicture; PictFormatPtr pFormat; int error; pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8); if (!pFormat) { free (argbbits); free (srcbits); free (mskbits); return (BadImplementation); } pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32, CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) { free (argbbits); free (srcbits); free (mskbits); return (BadAlloc); } pPicture = CreatePicture (0, &pPixmap->drawable, pFormat, 0, 0, client, &error); if (!pPicture) { free (argbbits); free (srcbits); free (mskbits); return error; } (*pScreen->DestroyPixmap) (pPixmap); CompositePicture (PictOpSrc, pSrc, 0, pPicture, 0, 0, 0, 0, 0, 0, width, height); (*pScreen->GetImage) (pPicture->pDrawable, 0, 0, width, height, ZPixmap, 0xffffffff, (void *) argbbits); FreePicture (pPicture, 0); } /* * Check whether the cursor can be directly supported by * the core cursor code */ ncolor = 0; argb = argbbits; for (y = 0; ncolor <= 2 && y < height; y++) { for (x = 0; ncolor <= 2 && x < width; x++) { CARD32 p = *argb++; CARD32 a = (p >> 24); if (a == 0) /* transparent */ continue; if (a == 0xff) /* opaque */ { int n; for (n = 0; n < ncolor; n++) if (p == twocolor[n]) break; if (n == ncolor) twocolor[ncolor++] = p; } else ncolor = 3; } } /* * Convert argb image to two plane cursor */ srcline = srcbits; mskline = mskbits; argb = argbbits; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { CARD32 p = *argb++; if (ncolor <= 2) { CARD32 a = ((p >> 24)); SetBit (mskline, x, a != 0); SetBit (srcline, x, a != 0 && p == twocolor[0]); } else { CARD32 a = ((p >> 24) * DITHER_SIZE + 127) / 255; CARD32 i = ((CvtR8G8B8toY15(p) >> 7) * DITHER_SIZE + 127) / 255; CARD32 d = orderedDither[y&(DITHER_DIM-1)][x&(DITHER_DIM-1)]; /* Set mask from dithered alpha value */ SetBit(mskline, x, a > d); /* Set src from dithered intensity value */ SetBit(srcline, x, a > d && i <= d); } } srcline += stride; mskline += stride; } /* * Dither to white and black if the cursor has more than two colors */ if (ncolor > 2) { twocolor[0] = 0xff000000; twocolor[1] = 0xffffffff; } else { free (argbbits); argbbits = 0; } #define GetByte(p,s) (((p) >> (s)) & 0xff) #define GetColor(p,s) (GetByte(p,s) | (GetByte(p,s) << 8)) cm.width = width; cm.height = height; cm.xhot = stuff->x; cm.yhot = stuff->y; pCursor = AllocCursorARGB (srcbits, mskbits, argbbits, &cm, GetColor(twocolor[0], 16), GetColor(twocolor[0], 8), GetColor(twocolor[0], 0), GetColor(twocolor[1], 16), GetColor(twocolor[1], 8), GetColor(twocolor[1], 0)); if (pCursor && AddResource(stuff->cid, RT_CURSOR, (void *)pCursor)) return (client->noClientException); return BadAlloc; } static int ProcRenderSetPictureTransform (ClientPtr client) { REQUEST(xRenderSetPictureTransformReq); PicturePtr pPicture; int result; REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); result = SetPictureTransform (pPicture, (PictTransform *) &stuff->transform); if (client->noClientException != Success) return(client->noClientException); else return(result); } #endif /* NXAGENT_SERVER */ static int ProcRenderQueryFilters (ClientPtr client) { REQUEST (xRenderQueryFiltersReq); DrawablePtr pDrawable; xRenderQueryFiltersReply *reply; int nbytesName; int nnames; ScreenPtr pScreen; PictureScreenPtr ps; int i, j; int len; int total_bytes; INT16 *aliases; char *names; REQUEST_SIZE_MATCH(xRenderQueryFiltersReq); SECURITY_VERIFY_DRAWABLE(pDrawable, stuff->drawable, client, DixReadAccess); pScreen = pDrawable->pScreen; nbytesName = 0; nnames = 0; ps = GetPictureScreenIfSet(pScreen); if (ps) { for (i = 0; i < ps->nfilters; i++) nbytesName += 1 + strlen (ps->filters[i].name); for (i = 0; i < ps->nfilterAliases; i++) nbytesName += 1 + strlen (ps->filterAliases[i].alias); nnames = ps->nfilters + ps->nfilterAliases; } len = ((nnames + 1) >> 1) + ((nbytesName + 3) >> 2); total_bytes = sizeof (xRenderQueryFiltersReply) + (len << 2); reply = (xRenderQueryFiltersReply *) calloc (1, total_bytes); if (!reply) return BadAlloc; aliases = (INT16 *) (reply + 1); names = (char *) (aliases + ((nnames + 1) & ~1)); reply->type = X_Reply; reply->sequenceNumber = client->sequence; reply->length = len; reply->numAliases = nnames; reply->numFilters = nnames; if (ps) { /* fill in alias values */ for (i = 0; i < ps->nfilters; i++) aliases[i] = FilterAliasNone; for (i = 0; i < ps->nfilterAliases; i++) { for (j = 0; j < ps->nfilters; j++) if (ps->filterAliases[i].filter_id == ps->filters[j].id) break; if (j == ps->nfilters) { for (j = 0; j < ps->nfilterAliases; j++) if (ps->filterAliases[i].filter_id == ps->filterAliases[j].alias_id) { break; } if (j == ps->nfilterAliases) j = FilterAliasNone; else j = j + ps->nfilters; } aliases[i + ps->nfilters] = j; } /* fill in filter names */ for (i = 0; i < ps->nfilters; i++) { j = strlen (ps->filters[i].name); *names++ = j; strncpy (names, ps->filters[i].name, j); names += j; } /* fill in filter alias names */ for (i = 0; i < ps->nfilterAliases; i++) { j = strlen (ps->filterAliases[i].alias); *names++ = j; strncpy (names, ps->filterAliases[i].alias, j); names += j; } } if (client->swapped) { for (i = 0; i < reply->numAliases; i++) { swaps (&aliases[i]); } swaps(&reply->sequenceNumber); swapl(&reply->length); swapl(&reply->numAliases); swapl(&reply->numFilters); } WriteToClient(client, total_bytes, reply); free (reply); return(client->noClientException); } #ifndef NXAGENT_SERVER static int ProcRenderSetPictureFilter (ClientPtr client) { REQUEST (xRenderSetPictureFilterReq); PicturePtr pPicture; int result; xFixed *params; int nparams; char *name; REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq); VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); name = (char *) (stuff + 1); params = (xFixed *) (name + ((stuff->nbytes + 3) & ~3)); nparams = ((xFixed *) stuff + client->req_len) - params; result = SetPictureFilter (pPicture, name, stuff->nbytes, params, nparams); return result; } static int ProcRenderCreateAnimCursor (ClientPtr client) { REQUEST(xRenderCreateAnimCursorReq); CursorPtr *cursors; CARD32 *deltas; CursorPtr pCursor; int ncursor; xAnimCursorElt *elt; int i; int ret; REQUEST_AT_LEAST_SIZE(xRenderCreateAnimCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); if (client->req_len & 1) return BadLength; ncursor = (client->req_len - (SIZEOF(xRenderCreateAnimCursorReq) >> 2)) >> 1; cursors = malloc (ncursor * (sizeof (CursorPtr) + sizeof (CARD32))); if (!cursors) return BadAlloc; deltas = (CARD32 *) (cursors + ncursor); elt = (xAnimCursorElt *) (stuff + 1); for (i = 0; i < ncursor; i++) { cursors[i] = (CursorPtr)SecurityLookupIDByType(client, elt->cursor, RT_CURSOR, DixReadAccess); if (!cursors[i]) { free (cursors); client->errorValue = elt->cursor; return BadCursor; } deltas[i] = elt->delay; elt++; } ret = AnimCursorCreate (cursors, deltas, ncursor, &pCursor); free (cursors); if (ret != Success) return ret; if (AddResource (stuff->cid, RT_CURSOR, (void *)pCursor)) return client->noClientException; return BadAlloc; } #endif /* NXAGENT_SERVER */ static int ProcRenderAddTraps (ClientPtr client) { int ntraps; PicturePtr pPicture; REQUEST(xRenderAddTrapsReq); REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq); VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pPicture->pDrawable) return BadDrawable; ntraps = (client->req_len << 2) - sizeof (xRenderAddTrapsReq); if (ntraps % sizeof (xTrap)) return BadLength; ntraps /= sizeof (xTrap); if (ntraps) AddTraps (pPicture, stuff->xOff, stuff->yOff, ntraps, (xTrap *) &stuff[1]); return client->noClientException; } #ifndef NXAGENT_SERVER static int ProcRenderCreateSolidFill(ClientPtr client) { PicturePtr pPicture; int error = 0; REQUEST(xRenderCreateSolidFillReq); REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq); LEGAL_NEW_RESOURCE(stuff->pid, client); pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error); if (!pPicture) return error; if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } static int ProcRenderCreateLinearGradient (ClientPtr client) { PicturePtr pPicture; int len; int error = 0; xFixed *stops; xRenderColor *colors; REQUEST(xRenderCreateLinearGradientReq); REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq); LEGAL_NEW_RESOURCE(stuff->pid, client); len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq); if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; stops = (xFixed *)(stuff + 1); colors = (xRenderColor *)(stops + stuff->nStops); pPicture = CreateLinearGradientPicture (stuff->pid, &stuff->p1, &stuff->p2, stuff->nStops, stops, colors, &error); if (!pPicture) return error; if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } static int ProcRenderCreateRadialGradient (ClientPtr client) { PicturePtr pPicture; int len; int error = 0; xFixed *stops; xRenderColor *colors; REQUEST(xRenderCreateRadialGradientReq); REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq); LEGAL_NEW_RESOURCE(stuff->pid, client); len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq); if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; stops = (xFixed *)(stuff + 1); colors = (xRenderColor *)(stops + stuff->nStops); pPicture = CreateRadialGradientPicture (stuff->pid, &stuff->inner, &stuff->outer, stuff->inner_radius, stuff->outer_radius, stuff->nStops, stops, colors, &error); if (!pPicture) return error; if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } static int ProcRenderCreateConicalGradient (ClientPtr client) { PicturePtr pPicture; int len; int error = 0; xFixed *stops; xRenderColor *colors; REQUEST(xRenderCreateConicalGradientReq); REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq); LEGAL_NEW_RESOURCE(stuff->pid, client); len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq); if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; stops = (xFixed *)(stuff + 1); colors = (xRenderColor *)(stops + stuff->nStops); pPicture = CreateConicalGradientPicture (stuff->pid, &stuff->center, stuff->angle, stuff->nStops, stops, colors, &error); if (!pPicture) return error; if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; } #endif /* NXAGENT_SERVER */ static int #ifdef NXAGENT_SERVER xorg_ProcRenderDispatch (ClientPtr client) #else ProcRenderDispatch (ClientPtr client) #endif { REQUEST(xReq); if (stuff->data < RenderNumberRequests) return (*ProcRenderVector[stuff->data]) (client); else return BadRequest; } static int SProcRenderQueryVersion (ClientPtr client) { REQUEST(xRenderQueryVersionReq); REQUEST_SIZE_MATCH(xRenderQueryVersionReq); swaps(&stuff->length); swapl(&stuff->majorVersion); swapl(&stuff->minorVersion); return (*ProcRenderVector[stuff->renderReqType])(client); } static int SProcRenderQueryPictFormats (ClientPtr client) { REQUEST(xRenderQueryPictFormatsReq); REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq); swaps(&stuff->length); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderQueryPictIndexValues (ClientPtr client) { REQUEST(xRenderQueryPictIndexValuesReq); REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq); swaps(&stuff->length); swapl(&stuff->format); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderQueryDithers (ClientPtr client) { return BadImplementation; } static int SProcRenderCreatePicture (ClientPtr client) { REQUEST(xRenderCreatePictureReq); REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); swaps(&stuff->length); swapl(&stuff->pid); swapl(&stuff->drawable); swapl(&stuff->format); swapl(&stuff->mask); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderChangePicture (ClientPtr client) { REQUEST(xRenderChangePictureReq); REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); swaps(&stuff->length); swapl(&stuff->picture); swapl(&stuff->mask); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderSetPictureClipRectangles (ClientPtr client) { REQUEST(xRenderSetPictureClipRectanglesReq); REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); swaps(&stuff->length); swapl(&stuff->picture); SwapRestS(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderFreePicture (ClientPtr client) { REQUEST(xRenderFreePictureReq); REQUEST_SIZE_MATCH(xRenderFreePictureReq); swaps(&stuff->length); swapl(&stuff->picture); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderComposite (ClientPtr client) { REQUEST(xRenderCompositeReq); REQUEST_SIZE_MATCH(xRenderCompositeReq); swaps(&stuff->length); swapl(&stuff->src); swapl(&stuff->mask); swapl(&stuff->dst); swaps(&stuff->xSrc); swaps(&stuff->ySrc); swaps(&stuff->xMask); swaps(&stuff->yMask); swaps(&stuff->xDst); swaps(&stuff->yDst); swaps(&stuff->width); swaps(&stuff->height); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderScale (ClientPtr client) { REQUEST(xRenderScaleReq); REQUEST_SIZE_MATCH(xRenderScaleReq); swaps(&stuff->length); swapl(&stuff->src); swapl(&stuff->dst); swapl(&stuff->colorScale); swapl(&stuff->alphaScale); swaps(&stuff->xSrc); swaps(&stuff->ySrc); swaps(&stuff->xDst); swaps(&stuff->yDst); swaps(&stuff->width); swaps(&stuff->height); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderTrapezoids (ClientPtr client) { REQUEST(xRenderTrapezoidsReq); REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq); swaps (&stuff->length); swapl (&stuff->src); swapl (&stuff->dst); swapl (&stuff->maskFormat); swaps (&stuff->xSrc); swaps (&stuff->ySrc); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderTriangles (ClientPtr client) { REQUEST(xRenderTrianglesReq); REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); swaps (&stuff->length); swapl (&stuff->src); swapl (&stuff->dst); swapl (&stuff->maskFormat); swaps (&stuff->xSrc); swaps (&stuff->ySrc); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderTriStrip (ClientPtr client) { REQUEST(xRenderTriStripReq); REQUEST_AT_LEAST_SIZE(xRenderTriStripReq); swaps (&stuff->length); swapl (&stuff->src); swapl (&stuff->dst); swapl (&stuff->maskFormat); swaps (&stuff->xSrc); swaps (&stuff->ySrc); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderTriFan (ClientPtr client) { REQUEST(xRenderTriFanReq); REQUEST_AT_LEAST_SIZE(xRenderTriFanReq); swaps (&stuff->length); swapl (&stuff->src); swapl (&stuff->dst); swapl (&stuff->maskFormat); swaps (&stuff->xSrc); swaps (&stuff->ySrc); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderColorTrapezoids (ClientPtr client) { return BadImplementation; } static int SProcRenderColorTriangles (ClientPtr client) { return BadImplementation; } static int SProcRenderTransform (ClientPtr client) { return BadImplementation; } static int SProcRenderCreateGlyphSet (ClientPtr client) { REQUEST(xRenderCreateGlyphSetReq); REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq); swaps(&stuff->length); swapl(&stuff->gsid); swapl(&stuff->format); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderReferenceGlyphSet (ClientPtr client) { REQUEST(xRenderReferenceGlyphSetReq); REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq); swaps(&stuff->length); swapl(&stuff->gsid); swapl(&stuff->existing); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderFreeGlyphSet (ClientPtr client) { REQUEST(xRenderFreeGlyphSetReq); REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); swaps(&stuff->length); swapl(&stuff->glyphset); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderAddGlyphs (ClientPtr client) { register int i; CARD32 *gids; void *end; xGlyphInfo *gi; REQUEST(xRenderAddGlyphsReq); REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq); swaps(&stuff->length); swapl(&stuff->glyphset); swapl(&stuff->nglyphs); if (stuff->nglyphs & 0xe0000000) return BadLength; end = (CARD8 *) stuff + (client->req_len << 2); gids = (CARD32 *) (stuff + 1); gi = (xGlyphInfo *) (gids + stuff->nglyphs); if ((char *) end - (char *) (gids + stuff->nglyphs) < 0) return BadLength; if ((char *) end - (char *) (gi + stuff->nglyphs) < 0) return BadLength; for (i = 0; i < stuff->nglyphs; i++) { swapl (&gids[i]); swaps (&gi[i].width); swaps (&gi[i].height); swaps (&gi[i].x); swaps (&gi[i].y); swaps (&gi[i].xOff); swaps (&gi[i].yOff); } return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderAddGlyphsFromPicture (ClientPtr client) { return BadImplementation; } static int SProcRenderFreeGlyphs (ClientPtr client) { REQUEST(xRenderFreeGlyphsReq); REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); swaps(&stuff->length); swapl(&stuff->glyphset); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderCompositeGlyphs (ClientPtr client) { xGlyphElt *elt; CARD8 *buffer; CARD8 *end; int space; int i; int size; REQUEST(xRenderCompositeGlyphsReq); REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq); switch (stuff->renderReqType) { default: size = 1; break; case X_RenderCompositeGlyphs16: size = 2; break; case X_RenderCompositeGlyphs32: size = 4; break; } swaps(&stuff->length); swapl(&stuff->src); swapl(&stuff->dst); swapl(&stuff->maskFormat); swapl(&stuff->glyphset); swaps(&stuff->xSrc); swaps(&stuff->ySrc); buffer = (CARD8 *) (stuff + 1); end = (CARD8 *) stuff + (client->req_len << 2); while (buffer + sizeof (xGlyphElt) < end) { elt = (xGlyphElt *) buffer; buffer += sizeof (xGlyphElt); swaps (&elt->deltax); swaps (&elt->deltay); i = elt->len; if (i == 0xff) { swapl ((int *) buffer); buffer += 4; } else { space = size * i; switch (size) { case 1: buffer += i; break; case 2: while (i--) { swaps ((short *) buffer); buffer += 2; } break; case 4: while (i--) { swapl ((int *) buffer); buffer += 4; } break; } if (space & 3) buffer += 4 - (space & 3); } } return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderFillRectangles (ClientPtr client) { REQUEST(xRenderFillRectanglesReq); REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq); swaps(&stuff->length); swapl(&stuff->dst); swaps(&stuff->color.red); swaps(&stuff->color.green); swaps(&stuff->color.blue); swaps(&stuff->color.alpha); SwapRestS(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderCreateCursor (ClientPtr client) { REQUEST(xRenderCreateCursorReq); REQUEST_SIZE_MATCH (xRenderCreateCursorReq); swaps(&stuff->length); swapl(&stuff->cid); swapl(&stuff->src); swaps(&stuff->x); swaps(&stuff->y); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderSetPictureTransform (ClientPtr client) { REQUEST(xRenderSetPictureTransformReq); REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); swaps(&stuff->length); swapl(&stuff->picture); swapl(&stuff->transform.matrix11); swapl(&stuff->transform.matrix12); swapl(&stuff->transform.matrix13); swapl(&stuff->transform.matrix21); swapl(&stuff->transform.matrix22); swapl(&stuff->transform.matrix23); swapl(&stuff->transform.matrix31); swapl(&stuff->transform.matrix32); swapl(&stuff->transform.matrix33); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderQueryFilters (ClientPtr client) { REQUEST (xRenderQueryFiltersReq); REQUEST_SIZE_MATCH (xRenderQueryFiltersReq); swaps(&stuff->length); swapl(&stuff->drawable); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderSetPictureFilter (ClientPtr client) { REQUEST (xRenderSetPictureFilterReq); REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq); swaps(&stuff->length); swapl(&stuff->picture); swaps(&stuff->nbytes); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderCreateAnimCursor (ClientPtr client) { REQUEST (xRenderCreateAnimCursorReq); REQUEST_AT_LEAST_SIZE (xRenderCreateAnimCursorReq); swaps(&stuff->length); swapl(&stuff->cid); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderAddTraps (ClientPtr client) { REQUEST (xRenderAddTrapsReq); REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq); swaps(&stuff->length); swapl(&stuff->picture); swaps(&stuff->xOff); swaps(&stuff->yOff); SwapRestL(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderCreateSolidFill(ClientPtr client) { REQUEST (xRenderCreateSolidFillReq); REQUEST_AT_LEAST_SIZE (xRenderCreateSolidFillReq); swaps(&stuff->length); swapl(&stuff->pid); swaps(&stuff->color.alpha); swaps(&stuff->color.red); swaps(&stuff->color.green); swaps(&stuff->color.blue); return (*ProcRenderVector[stuff->renderReqType]) (client); } static void swapStops(void *stuff, int num) { int i; CARD32 *stops; CARD16 *colors; stops = (CARD32 *)(stuff); for (i = 0; i < num; ++i) { swapl(stops); ++stops; } colors = (CARD16 *) (stops); for (i = 0; i < 4*num; ++i) { swaps(colors); ++colors; } } static int SProcRenderCreateLinearGradient (ClientPtr client) { int len; REQUEST (xRenderCreateLinearGradientReq); REQUEST_AT_LEAST_SIZE (xRenderCreateLinearGradientReq); swaps(&stuff->length); swapl(&stuff->pid); swapl(&stuff->p1.x); swapl(&stuff->p1.y); swapl(&stuff->p2.x); swapl(&stuff->p2.y); swapl(&stuff->nStops); len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq); if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; swapStops(stuff+1, stuff->nStops); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderCreateRadialGradient (ClientPtr client) { int len; REQUEST (xRenderCreateRadialGradientReq); REQUEST_AT_LEAST_SIZE (xRenderCreateRadialGradientReq); swaps(&stuff->length); swapl(&stuff->pid); swapl(&stuff->inner.x); swapl(&stuff->inner.y); swapl(&stuff->outer.x); swapl(&stuff->outer.y); swapl(&stuff->inner_radius); swapl(&stuff->outer_radius); swapl(&stuff->nStops); len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq); if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; swapStops(stuff+1, stuff->nStops); return (*ProcRenderVector[stuff->renderReqType]) (client); } static int SProcRenderCreateConicalGradient (ClientPtr client) { int len; REQUEST (xRenderCreateConicalGradientReq); REQUEST_AT_LEAST_SIZE (xRenderCreateConicalGradientReq); swaps(&stuff->length); swapl(&stuff->pid); swapl(&stuff->center.x); swapl(&stuff->center.y); swapl(&stuff->angle); swapl(&stuff->nStops); len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq); if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor))) return BadLength; swapStops(stuff+1, stuff->nStops); return (*ProcRenderVector[stuff->renderReqType]) (client); } #ifdef NXAGENT_SERVER static int xorg_SProcRenderDispatch (ClientPtr client) #else SProcRenderDispatch (ClientPtr client) #endif { REQUEST(xReq); if (stuff->data < RenderNumberRequests) return (*SProcRenderVector[stuff->data]) (client); else return BadRequest; } #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #define VERIFY_XIN_PICTURE(pPicture, pid, client, mode, err) {\ pPicture = SecurityLookupIDByType(client, pid, XRT_PICTURE, mode);\ if (!pPicture) { \ client->errorValue = pid; \ return err; \ } \ } #define VERIFY_XIN_ALPHA(pPicture, pid, client, mode, err) {\ if (pid == None) \ pPicture = 0; \ else { \ VERIFY_XIN_PICTURE(pPicture, pid, client, mode, err); \ } \ } \ int (*PanoramiXSaveRenderVector[RenderNumberRequests])(ClientPtr); unsigned long XRT_PICTURE; static int PanoramiXRenderCreatePicture (ClientPtr client) { REQUEST(xRenderCreatePictureReq); PanoramiXRes *refDraw, *newPict; int result = Success, j; REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)))) return BadAlloc; newPict->type = XRT_PICTURE; newPict->info[0].id = stuff->pid; if (refDraw->type == XRT_WINDOW && stuff->drawable == screenInfo.screens[0]->root->drawable.id) { newPict->u.pict.root = TRUE; } else newPict->u.pict.root = FALSE; for(j = 1; j < PanoramiXNumScreens; j++) newPict->info[j].id = FakeClientID(client->index); FOR_NSCREENS_BACKWARD(j) { stuff->pid = newPict->info[j].id; stuff->drawable = refDraw->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderCreatePicture]) (client); if(result != Success) break; } if (result == Success) AddResource(newPict->info[0].id, XRT_PICTURE, newPict); else free(newPict); return (result); } static int PanoramiXRenderChangePicture (ClientPtr client) { PanoramiXRes *pict; int result = Success, j; REQUEST(xRenderChangePictureReq); REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { stuff->picture = pict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderChangePicture]) (client); if(result != Success) break; } return (result); } static int PanoramiXRenderSetPictureClipRectangles (ClientPtr client) { REQUEST(xRenderSetPictureClipRectanglesReq); int result = Success, j; PanoramiXRes *pict; REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { stuff->picture = pict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderSetPictureClipRectangles]) (client); if(result != Success) break; } return (result); } static int PanoramiXRenderSetPictureTransform (ClientPtr client) { REQUEST(xRenderSetPictureTransformReq); int result = Success, j; PanoramiXRes *pict; REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq); VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { stuff->picture = pict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderSetPictureTransform]) (client); if(result != Success) break; } return (result); } static int PanoramiXRenderSetPictureFilter (ClientPtr client) { REQUEST(xRenderSetPictureFilterReq); int result = Success, j; PanoramiXRes *pict; REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq); VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { stuff->picture = pict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderSetPictureFilter]) (client); if(result != Success) break; } return (result); } static int PanoramiXRenderFreePicture (ClientPtr client) { PanoramiXRes *pict; int result = Success, j; REQUEST(xRenderFreePictureReq); REQUEST_SIZE_MATCH(xRenderFreePictureReq); client->errorValue = stuff->picture; VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixDestroyAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { stuff->picture = pict->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderFreePicture]) (client); if(result != Success) break; } /* Since ProcRenderFreePicture is using FreeResource, it will free our resource for us on the last pass through the loop above */ return (result); } static int PanoramiXRenderComposite (ClientPtr client) { PanoramiXRes *src, *msk, *dst; int result = Success, j; xRenderCompositeReq orig; REQUEST(xRenderCompositeReq); REQUEST_SIZE_MATCH(xRenderCompositeReq); VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_XIN_ALPHA (msk, stuff->mask, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); orig = *stuff; FOR_NSCREENS_FORWARD(j) { stuff->src = src->info[j].id; if (src->u.pict.root) { stuff->xSrc = orig.xSrc - panoramiXdataPtr[j].x; stuff->ySrc = orig.ySrc - panoramiXdataPtr[j].y; } stuff->dst = dst->info[j].id; if (dst->u.pict.root) { stuff->xDst = orig.xDst - panoramiXdataPtr[j].x; stuff->yDst = orig.yDst - panoramiXdataPtr[j].y; } if (msk) { stuff->mask = msk->info[j].id; if (msk->u.pict.root) { stuff->xMask = orig.xMask - panoramiXdataPtr[j].x; stuff->yMask = orig.yMask - panoramiXdataPtr[j].y; } } result = (*PanoramiXSaveRenderVector[X_RenderComposite]) (client); if(result != Success) break; } return result; } static int PanoramiXRenderCompositeGlyphs (ClientPtr client) { PanoramiXRes *src, *dst; int result = Success, j; REQUEST(xRenderCompositeGlyphsReq); xGlyphElt origElt, *elt; INT16 xSrc, ySrc; REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq); VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (client->req_len << 2 >= (sizeof (xRenderCompositeGlyphsReq) + sizeof (xGlyphElt))) { elt = (xGlyphElt *) (stuff + 1); origElt = *elt; xSrc = stuff->xSrc; ySrc = stuff->ySrc; FOR_NSCREENS_FORWARD(j) { stuff->src = src->info[j].id; if (src->u.pict.root) { stuff->xSrc = xSrc - panoramiXdataPtr[j].x; stuff->ySrc = ySrc - panoramiXdataPtr[j].y; } stuff->dst = dst->info[j].id; if (dst->u.pict.root) { elt->deltax = origElt.deltax - panoramiXdataPtr[j].x; elt->deltay = origElt.deltay - panoramiXdataPtr[j].y; } result = (*PanoramiXSaveRenderVector[stuff->renderReqType]) (client); if(result != Success) break; } } return result; } static int PanoramiXRenderFillRectangles (ClientPtr client) { PanoramiXRes *dst; int result = Success, j; REQUEST(xRenderFillRectanglesReq); char *extra; int extra_len; REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq); VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq); if (extra_len && (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { if (j) memcpy (stuff + 1, extra, extra_len); if (dst->u.pict.root) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { xRectangle *rects = (xRectangle *) (stuff + 1); int i = extra_len / sizeof (xRectangle); while (i--) { rects->x -= x_off; rects->y -= y_off; rects++; } } } stuff->dst = dst->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client); if(result != Success) break; } free(extra); } return result; } static int PanoramiXRenderTrapezoids(ClientPtr client) { PanoramiXRes *src, *dst; int result = Success, j; REQUEST(xRenderTrapezoidsReq); char *extra; int extra_len; REQUEST_AT_LEAST_SIZE (xRenderTrapezoidsReq); VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq); if (extra_len && (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { if (j) memcpy (stuff + 1, extra, extra_len); if (dst->u.pict.root) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { xTrapezoid *trap = (xTrapezoid *) (stuff + 1); int i = extra_len / sizeof (xTrapezoid); while (i--) { trap->top -= y_off; trap->bottom -= y_off; trap->left.p1.x -= x_off; trap->left.p1.y -= y_off; trap->left.p2.x -= x_off; trap->left.p2.y -= y_off; trap->right.p1.x -= x_off; trap->right.p1.y -= y_off; trap->right.p2.x -= x_off; trap->right.p2.y -= y_off; trap++; } } } stuff->src = src->info[j].id; stuff->dst = dst->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderTrapezoids]) (client); if(result != Success) break; } free(extra); } return result; } static int PanoramiXRenderTriangles(ClientPtr client) { PanoramiXRes *src, *dst; int result = Success, j; REQUEST(xRenderTrianglesReq); char *extra; int extra_len; REQUEST_AT_LEAST_SIZE (xRenderTrianglesReq); VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq); if (extra_len && (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { if (j) memcpy (stuff + 1, extra, extra_len); if (dst->u.pict.root) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { xTriangle *tri = (xTriangle *) (stuff + 1); int i = extra_len / sizeof (xTriangle); while (i--) { tri->p1.x -= x_off; tri->p1.y -= y_off; tri->p2.x -= x_off; tri->p2.y -= y_off; tri->p3.x -= x_off; tri->p3.y -= y_off; tri++; } } } stuff->src = src->info[j].id; stuff->dst = dst->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderTriangles]) (client); if(result != Success) break; } free(extra); } return result; } static int PanoramiXRenderTriStrip(ClientPtr client) { PanoramiXRes *src, *dst; int result = Success, j; REQUEST(xRenderTriStripReq); char *extra; int extra_len; REQUEST_AT_LEAST_SIZE (xRenderTriStripReq); VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq); if (extra_len && (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { if (j) memcpy (stuff + 1, extra, extra_len); if (dst->u.pict.root) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { xPointFixed *fixed = (xPointFixed *) (stuff + 1); int i = extra_len / sizeof (xPointFixed); while (i--) { fixed->x -= x_off; fixed->y -= y_off; fixed++; } } } stuff->src = src->info[j].id; stuff->dst = dst->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderTriStrip]) (client); if(result != Success) break; } free(extra); } return result; } static int PanoramiXRenderTriFan(ClientPtr client) { PanoramiXRes *src, *dst; int result = Success, j; REQUEST(xRenderTriFanReq); char *extra; int extra_len; REQUEST_AT_LEAST_SIZE (xRenderTriFanReq); VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq); if (extra_len && (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { if (j) memcpy (stuff + 1, extra, extra_len); if (dst->u.pict.root) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { xPointFixed *fixed = (xPointFixed *) (stuff + 1); int i = extra_len / sizeof (xPointFixed); while (i--) { fixed->x -= x_off; fixed->y -= y_off; fixed++; } } } stuff->src = src->info[j].id; stuff->dst = dst->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderTriFan]) (client); if(result != Success) break; } free(extra); } return result; } #if 0 /* Not implemented yet */ static int PanoramiXRenderColorTrapezoids(ClientPtr client) { PanoramiXRes *src, *dst; int result = Success, j; REQUEST(xRenderColorTrapezoidsReq); char *extra; int extra_len; REQUEST_AT_LEAST_SIZE (xRenderColorTrapezoidsReq); VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderColorTrapezoidsReq); if (extra_len && (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { if (j) memcpy (stuff + 1, extra, extra_len); if (dst->u.pict.root) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { ....; } } stuff->dst = dst->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderColorTrapezoids]) (client); if(result != Success) break; } free(extra); } return result; } static int PanoramiXRenderColorTriangles(ClientPtr client) { PanoramiXRes *src, *dst; int result = Success, j; REQUEST(xRenderColorTrianglesReq); char *extra; int extra_len; REQUEST_AT_LEAST_SIZE (xRenderColorTrianglesReq); VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderColorTrianglesReq); if (extra_len && (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); FOR_NSCREENS_FORWARD(j) { if (j) memcpy (stuff + 1, extra, extra_len); if (dst->u.pict.root) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { ....; } } stuff->dst = dst->info[j].id; result = (*PanoramiXSaveRenderVector[X_RenderColorTriangles]) (client); if(result != Success) break; } free(extra); } return result; } #endif static int PanoramiXRenderAddTraps (ClientPtr client) { PanoramiXRes *picture; int result = Success, j; REQUEST(xRenderAddTrapsReq); char *extra; int extra_len; INT16 x_off, y_off; REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq); VERIFY_XIN_PICTURE (picture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq); if (extra_len && (extra = (char *) malloc (extra_len))) { memcpy (extra, stuff + 1, extra_len); x_off = stuff->xOff; y_off = stuff->yOff; FOR_NSCREENS_FORWARD(j) { if (j) memcpy (stuff + 1, extra, extra_len); stuff->picture = picture->info[j].id; if (picture->u.pict.root) { stuff->xOff = x_off + panoramiXdataPtr[j].x; stuff->yOff = y_off + panoramiXdataPtr[j].y; } result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client); if(result != Success) break; } free(extra); } return result; } void PanoramiXRenderInit (void) { int i; XRT_PICTURE = CreateNewResourceType (XineramaDeleteResource); for (i = 0; i < RenderNumberRequests; i++) PanoramiXSaveRenderVector[i] = ProcRenderVector[i]; /* * Stuff in Xinerama aware request processing hooks */ ProcRenderVector[X_RenderCreatePicture] = PanoramiXRenderCreatePicture; ProcRenderVector[X_RenderChangePicture] = PanoramiXRenderChangePicture; ProcRenderVector[X_RenderSetPictureTransform] = PanoramiXRenderSetPictureTransform; ProcRenderVector[X_RenderSetPictureFilter] = PanoramiXRenderSetPictureFilter; ProcRenderVector[X_RenderSetPictureClipRectangles] = PanoramiXRenderSetPictureClipRectangles; ProcRenderVector[X_RenderFreePicture] = PanoramiXRenderFreePicture; ProcRenderVector[X_RenderComposite] = PanoramiXRenderComposite; ProcRenderVector[X_RenderCompositeGlyphs8] = PanoramiXRenderCompositeGlyphs; ProcRenderVector[X_RenderCompositeGlyphs16] = PanoramiXRenderCompositeGlyphs; ProcRenderVector[X_RenderCompositeGlyphs32] = PanoramiXRenderCompositeGlyphs; ProcRenderVector[X_RenderFillRectangles] = PanoramiXRenderFillRectangles; ProcRenderVector[X_RenderTrapezoids] = PanoramiXRenderTrapezoids; ProcRenderVector[X_RenderTriangles] = PanoramiXRenderTriangles; ProcRenderVector[X_RenderTriStrip] = PanoramiXRenderTriStrip; ProcRenderVector[X_RenderTriFan] = PanoramiXRenderTriFan; ProcRenderVector[X_RenderAddTraps] = PanoramiXRenderAddTraps; } void PanoramiXRenderReset (void) { int i; for (i = 0; i < RenderNumberRequests; i++) ProcRenderVector[i] = PanoramiXSaveRenderVector[i]; } #endif /* PANORAMIX */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/renderedge.c0000644000000000000000000001064213614532331020325 0ustar /* * $Id: renderedge.c,v 1.4 2005/07/03 07:02:08 daniels Exp $ * * Copyright © 2004 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "renderedge.h" /* * Compute the smallest value no less than y which is on a * grid row */ xFixed RenderSampleCeilY (xFixed y, int n) { xFixed f = xFixedFrac(y); xFixed i = xFixedFloor(y); f = ((f + Y_FRAC_FIRST(n)) / STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n); if (f > Y_FRAC_LAST(n)) { f = Y_FRAC_FIRST(n); i += xFixed1; } return (i | f); } #define _div(a,b) ((a) >= 0 ? (a) / (b) : -((-(a) + (b) - 1) / (b))) /* * Compute the largest value no greater than y which is on a * grid row */ xFixed RenderSampleFloorY (xFixed y, int n) { xFixed f = xFixedFrac(y); xFixed i = xFixedFloor (y); f = _div(f - Y_FRAC_FIRST(n), STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n); if (f < Y_FRAC_FIRST(n)) { f = Y_FRAC_LAST(n); i -= xFixed1; } return (i | f); } /* * Step an edge by any amount (including negative values) */ void RenderEdgeStep (RenderEdge *e, int n) { xFixed_48_16 ne; e->x += n * e->stepx; ne = e->e + n * (xFixed_48_16) e->dx; if (n >= 0) { if (ne > 0) { int nx = (ne + e->dy - 1) / e->dy; e->e = ne - nx * (xFixed_48_16) e->dy; e->x += nx * e->signdx; } } else { if (ne <= -e->dy) { int nx = (-ne) / e->dy; e->e = ne + nx * (xFixed_48_16) e->dy; e->x -= nx * e->signdx; } } } /* * A private routine to initialize the multi-step * elements of an edge structure */ static void _RenderEdgeMultiInit (RenderEdge *e, int n, xFixed *stepx_p, xFixed *dx_p) { xFixed stepx; xFixed_48_16 ne; ne = n * (xFixed_48_16) e->dx; stepx = n * e->stepx; if (ne > 0) { int nx = ne / e->dy; ne -= nx * e->dy; stepx += nx * e->signdx; } *dx_p = ne; *stepx_p = stepx; } /* * Initialize one edge structure given the line endpoints and a * starting y value */ void RenderEdgeInit (RenderEdge *e, int n, xFixed y_start, xFixed x_top, xFixed y_top, xFixed x_bot, xFixed y_bot) { xFixed dx, dy; e->x = x_top; e->e = 0; dx = x_bot - x_top; dy = y_bot - y_top; e->dy = dy; e->dx = 0; if (dy) { if (dx >= 0) { e->signdx = 1; e->stepx = dx / dy; e->dx = dx % dy; e->e = -dy; } else { e->signdx = -1; e->stepx = -(-dx / dy); e->dx = -dx % dy; e->e = 0; } _RenderEdgeMultiInit (e, STEP_Y_SMALL(n), &e->stepx_small, &e->dx_small); _RenderEdgeMultiInit (e, STEP_Y_BIG(n), &e->stepx_big, &e->dx_big); } RenderEdgeStep (e, y_start - y_top); } /* * Initialize one edge structure given a line, starting y value * and a pixel offset for the line */ void RenderLineFixedEdgeInit (RenderEdge *e, int n, xFixed y, xLineFixed *line, int x_off, int y_off) { xFixed x_off_fixed = IntToxFixed(x_off); xFixed y_off_fixed = IntToxFixed(y_off); xPointFixed *top, *bot; if (line->p1.y <= line->p2.y) { top = &line->p1; bot = &line->p2; } else { top = &line->p2; bot = &line->p1; } RenderEdgeInit (e, n, y, top->x + x_off_fixed, top->y + y_off_fixed, bot->x + x_off_fixed, bot->y + y_off_fixed); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/render/renderedge.h0000644000000000000000000000651713614532331020340 0ustar /* * $Id: renderedge.h,v 1.4 2005/08/24 11:18:33 daniels Exp $ * * Copyright © 2004 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _RENDEREDGE_H_ #define _RENDEREDGE_H_ #include "picturestr.h" #define MAX_ALPHA(n) ((1 << (n)) - 1) #define N_Y_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) - 1) #define N_X_FRAC(n) ((1 << ((n)/2)) + 1) #define STEP_Y_SMALL(n) (xFixed1 / N_Y_FRAC(n)) #define STEP_Y_BIG(n) (xFixed1 - (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n)) #define Y_FRAC_FIRST(n) (STEP_Y_SMALL(n) / 2) #define Y_FRAC_LAST(n) (Y_FRAC_FIRST(n) + (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n)) #define STEP_X_SMALL(n) (xFixed1 / N_X_FRAC(n)) #define STEP_X_BIG(n) (xFixed1 - (N_X_FRAC(n) - 1) * STEP_X_SMALL(n)) #define X_FRAC_FIRST(n) (STEP_X_SMALL(n) / 2) #define X_FRAC_LAST(n) (X_FRAC_FIRST(n) + (N_X_FRAC(n) - 1) * STEP_X_SMALL(n)) #define RenderSamplesX(x,n) ((n) == 1 ? 0 : (xFixedFrac (x) + X_FRAC_FIRST(n)) / STEP_X_SMALL(n)) /* * An edge structure. This represents a single polygon edge * and can be quickly stepped across small or large gaps in the * sample grid */ typedef struct { xFixed x; xFixed e; xFixed stepx; xFixed signdx; xFixed dy; xFixed dx; xFixed stepx_small; xFixed stepx_big; xFixed dx_small; xFixed dx_big; } RenderEdge; /* * Step across a small sample grid gap */ #define RenderEdgeStepSmall(edge) { \ edge->x += edge->stepx_small; \ edge->e += edge->dx_small; \ if (edge->e > 0) \ { \ edge->e -= edge->dy; \ edge->x += edge->signdx; \ } \ } /* * Step across a large sample grid gap */ #define RenderEdgeStepBig(edge) { \ edge->x += edge->stepx_big; \ edge->e += edge->dx_big; \ if (edge->e > 0) \ { \ edge->e -= edge->dy; \ edge->x += edge->signdx; \ } \ } xFixed RenderSampleCeilY (xFixed y, int bpp); xFixed RenderSampleFloorY (xFixed y, int bpp); void RenderEdgeStep (RenderEdge *e, int n); void RenderEdgeInit (RenderEdge *e, int bpp, xFixed y_start, xFixed x_top, xFixed y_top, xFixed x_bot, xFixed y_bot); void RenderLineFixedEdgeInit (RenderEdge *e, int bpp, xFixed y, xLineFixed *line, int x_off, int y_off); #endif /* _RENDEREDGE_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/bigreq.c0000644000000000000000000000541513614532331017145 0ustar /* Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include #include "opaque.h" #if 0 static unsigned char XBigReqCode; #endif static void BigReqResetProc( ExtensionEntry * /* extEntry */ ); static DISPATCH_PROC(ProcBigReqDispatch); void BigReqExtensionInit(void) { #if 0 ExtensionEntry *extEntry; if ((extEntry = AddExtension(XBigReqExtensionName, 0, 0, ProcBigReqDispatch, ProcBigReqDispatch, BigReqResetProc, StandardMinorOpcode)) != 0) XBigReqCode = (unsigned char)extEntry->base; #else (void) AddExtension(XBigReqExtensionName, 0, 0, ProcBigReqDispatch, ProcBigReqDispatch, BigReqResetProc, StandardMinorOpcode); #endif DeclareExtensionSecurity(XBigReqExtensionName, TRUE); } /*ARGSUSED*/ static void BigReqResetProc (extEntry) ExtensionEntry *extEntry; { } static int ProcBigReqDispatch (client) register ClientPtr client; { REQUEST(xBigReqEnableReq); xBigReqEnableReply rep; if (client->swapped) { swaps(&stuff->length); } if (stuff->brReqType != X_BigReqEnable) return BadRequest; REQUEST_SIZE_MATCH(xBigReqEnableReq); client->big_requests = TRUE; memset(&rep, 0, sizeof(xBigReqEnableReply)); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.max_request_size = maxBigRequestSize; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.max_request_size); } WriteToClient(client, sizeof(xBigReqEnableReply), &rep); return(client->noClientException); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/dpms.c0000644000000000000000000002374713614532331016647 0ustar /***************************************************************** Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* * HISTORY * * @(#)RCSfile: dpms.c,v Revision: 1.1.4.5 (DEC) Date: 1996/03/04 15:27:00 */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include "opaque.h" #define DPMS_SERVER #include #include #include "dpmsproc.h" #if 0 static unsigned char DPMSCode; #endif static DISPATCH_PROC(ProcDPMSDispatch); static DISPATCH_PROC(SProcDPMSDispatch); static DISPATCH_PROC(ProcDPMSGetVersion); static DISPATCH_PROC(SProcDPMSGetVersion); static DISPATCH_PROC(ProcDPMSGetTimeouts); static DISPATCH_PROC(SProcDPMSGetTimeouts); static DISPATCH_PROC(ProcDPMSSetTimeouts); static DISPATCH_PROC(SProcDPMSSetTimeouts); static DISPATCH_PROC(ProcDPMSEnable); static DISPATCH_PROC(SProcDPMSEnable); static DISPATCH_PROC(ProcDPMSDisable); static DISPATCH_PROC(SProcDPMSDisable); static DISPATCH_PROC(ProcDPMSForceLevel); static DISPATCH_PROC(SProcDPMSForceLevel); static DISPATCH_PROC(ProcDPMSInfo); static DISPATCH_PROC(SProcDPMSInfo); static DISPATCH_PROC(ProcDPMSCapable); static DISPATCH_PROC(SProcDPMSCapable); static void DPMSResetProc(ExtensionEntry* extEntry); void DPMSExtensionInit(void) { #if 0 ExtensionEntry *extEntry; if ((extEntry = AddExtension(DPMSExtensionName, 0, 0, ProcDPMSDispatch, SProcDPMSDispatch, DPMSResetProc, StandardMinorOpcode))) DPMSCode = (unsigned char)extEntry->base; #else (void) AddExtension(DPMSExtensionName, 0, 0, ProcDPMSDispatch, SProcDPMSDispatch, DPMSResetProc, StandardMinorOpcode); #endif } /*ARGSUSED*/ static void DPMSResetProc (extEntry) ExtensionEntry *extEntry; { } static int ProcDPMSGetVersion(client) register ClientPtr client; { /* REQUEST(xDPMSGetVersionReq); */ xDPMSGetVersionReply rep = {0}; REQUEST_SIZE_MATCH(xDPMSGetVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = DPMSMajorVersion; rep.minorVersion = DPMSMinorVersion; if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.majorVersion); swaps(&rep.minorVersion); } WriteToClient(client, sizeof(xDPMSGetVersionReply), &rep); return(client->noClientException); } static int ProcDPMSCapable(register ClientPtr client) { /* REQUEST(xDPMSCapableReq); */ xDPMSCapableReply rep = {0}; REQUEST_SIZE_MATCH(xDPMSCapableReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.capable = DPMSCapableFlag; if (client->swapped) { swaps(&rep.sequenceNumber); } WriteToClient(client, sizeof(xDPMSCapableReply), &rep); return(client->noClientException); } static int ProcDPMSGetTimeouts(client) register ClientPtr client; { /* REQUEST(xDPMSGetTimeoutsReq); */ xDPMSGetTimeoutsReply rep = {0}; REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.standby = DPMSStandbyTime / MILLI_PER_SECOND; rep.suspend = DPMSSuspendTime / MILLI_PER_SECOND; rep.off = DPMSOffTime / MILLI_PER_SECOND; if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.standby); swaps(&rep.suspend); swaps(&rep.off); } WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), &rep); return(client->noClientException); } static int ProcDPMSSetTimeouts(client) register ClientPtr client; { REQUEST(xDPMSSetTimeoutsReq); REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq); if ((stuff->off != 0)&&(stuff->off < stuff->suspend)) { client->errorValue = stuff->off; return BadValue; } if ((stuff->suspend != 0)&&(stuff->suspend < stuff->standby)) { client->errorValue = stuff->suspend; return BadValue; } DPMSStandbyTime = stuff->standby * MILLI_PER_SECOND; DPMSSuspendTime = stuff->suspend * MILLI_PER_SECOND; DPMSOffTime = stuff->off * MILLI_PER_SECOND; SetScreenSaverTimer(); return(client->noClientException); } static int ProcDPMSEnable(client) register ClientPtr client; { Bool was_enabled = DPMSEnabled; REQUEST_SIZE_MATCH(xDPMSEnableReq); if (DPMSCapableFlag) { DPMSEnabled = TRUE; if (!was_enabled) SetScreenSaverTimer(); } return(client->noClientException); } static int ProcDPMSDisable(client) register ClientPtr client; { /* REQUEST(xDPMSDisableReq); */ REQUEST_SIZE_MATCH(xDPMSDisableReq); DPMSSet(DPMSModeOn); DPMSEnabled = FALSE; return(client->noClientException); } static int ProcDPMSForceLevel(client) register ClientPtr client; { REQUEST(xDPMSForceLevelReq); REQUEST_SIZE_MATCH(xDPMSForceLevelReq); if (!DPMSEnabled) return BadMatch; if (stuff->level != DPMSModeOn && stuff->level != DPMSModeStandby && stuff->level != DPMSModeSuspend && stuff->level != DPMSModeOff) { client->errorValue = stuff->level; return BadValue; } DPMSSet(stuff->level); return(client->noClientException); } static int ProcDPMSInfo(register ClientPtr client) { /* REQUEST(xDPMSInfoReq); */ xDPMSInfoReply rep = {0}; REQUEST_SIZE_MATCH(xDPMSInfoReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.power_level = DPMSPowerLevel; rep.state = DPMSEnabled; if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.power_level); } WriteToClient(client, sizeof(xDPMSInfoReply), &rep); return(client->noClientException); } static int ProcDPMSDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_DPMSGetVersion: return ProcDPMSGetVersion(client); case X_DPMSCapable: return ProcDPMSCapable(client); case X_DPMSGetTimeouts: return ProcDPMSGetTimeouts(client); case X_DPMSSetTimeouts: return ProcDPMSSetTimeouts(client); case X_DPMSEnable: return ProcDPMSEnable(client); case X_DPMSDisable: return ProcDPMSDisable(client); case X_DPMSForceLevel: return ProcDPMSForceLevel(client); case X_DPMSInfo: return ProcDPMSInfo(client); default: return BadRequest; } } static int SProcDPMSGetVersion(client) register ClientPtr client; { REQUEST(xDPMSGetVersionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDPMSGetVersionReq); swaps(&stuff->majorVersion); swaps(&stuff->minorVersion); return ProcDPMSGetVersion(client); } static int SProcDPMSCapable(register ClientPtr client) { REQUEST(xDPMSCapableReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDPMSCapableReq); return ProcDPMSCapable(client); } static int SProcDPMSGetTimeouts(client) register ClientPtr client; { REQUEST(xDPMSGetTimeoutsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq); return ProcDPMSGetTimeouts(client); } static int SProcDPMSSetTimeouts(client) register ClientPtr client; { REQUEST(xDPMSSetTimeoutsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq); swaps(&stuff->standby); swaps(&stuff->suspend); swaps(&stuff->off); return ProcDPMSSetTimeouts(client); } static int SProcDPMSEnable(client) register ClientPtr client; { REQUEST(xDPMSEnableReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDPMSEnableReq); return ProcDPMSEnable(client); } static int SProcDPMSDisable(client) register ClientPtr client; { REQUEST(xDPMSDisableReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDPMSDisableReq); return ProcDPMSDisable(client); } static int SProcDPMSForceLevel(client) register ClientPtr client; { REQUEST(xDPMSForceLevelReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDPMSForceLevelReq); swaps(&stuff->level); return ProcDPMSForceLevel(client); } static int SProcDPMSInfo(client) register ClientPtr client; { REQUEST(xDPMSInfoReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDPMSInfoReq); return ProcDPMSInfo(client); } static int SProcDPMSDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_DPMSGetVersion: return SProcDPMSGetVersion(client); case X_DPMSCapable: return SProcDPMSCapable(client); case X_DPMSGetTimeouts: return SProcDPMSGetTimeouts(client); case X_DPMSSetTimeouts: return SProcDPMSSetTimeouts(client); case X_DPMSEnable: return SProcDPMSEnable(client); case X_DPMSDisable: return SProcDPMSDisable(client); case X_DPMSForceLevel: return SProcDPMSForceLevel(client); case X_DPMSInfo: return SProcDPMSInfo(client); default: return BadRequest; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/dpmsproc.h0000644000000000000000000000036513614532331017527 0ustar /* Prototypes for functions that the DDX must provide */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _DPMSPROC_H_ #define _DPMSPROC_H_ void DPMSSet(int level); int DPMSGet(int *plevel); Bool DPMSSupported(void); #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/dpmsstubs.c0000644000000000000000000000324313614532331017715 0ustar /***************************************************************** Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ typedef int Bool; #ifdef HAVE_DIX_CONFIG_H #include #endif #include "dpmsproc.h" #define FALSE 0 Bool DPMSSupported(void) { return FALSE; } int DPMSGet(int *plevel) { return -1; } void DPMSSet(int level) { } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/Imakefile0000644000000000000000000001074013614532331017336 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ #include #if HasShm && (!(defined(NXAgentServer) && NXAgentServer)) SHMSRCS = shm.c SHMOBJS = shm.o #endif #if BuildScreenSaverExt SCRNSAVSRC = saver.c SCRNSAVOBJ = saver.o #endif #if BuildXF86BigfontExt XF86BIGFSRCS = xf86bigfont.c XF86BIGFOBJS = xf86bigfont.o #if HasShm SHM_DEFINES = -DHAS_SHM #endif #endif #if BuildXvExt XVSRCS = xvmain.c xvdisp.c xvmc.c XVOBJS = xvmain.o xvdisp.o xvmc.o #endif #if BuildXResExt XRESSRCS = xres.c XRESOBJS = xres.o #endif #if BuildXCSecurity SECURITYSRCS = security.c SECURITYOBJS = security.o SERVERCONFIGDIR = ServerConfigDir POLICYFILEDEF = -DDEFAULTPOLICYFILE=\"$(SERVERCONFIGDIR)/SecurityPolicy\" #endif #if BuildXinerama PNRXSRCS = panoramiX.c panoramiXSwap.c panoramiXprocs.c PNRXOBJS = panoramiX.o panoramiXSwap.o panoramiXprocs.o PNRXINCLUDES = -I../mi -I../render #endif #if BuildDPMS DPMSSRCS = dpms.c DPMSOBJS = dpms.o #endif SRCS = shape.c $(SHMSRCS) xcmisc.c\ xtest.c sleepuntil.c \ bigreq.c sync.c $(SCRNSAVSRC) \ $(XF86BIGFSRCS) $(SECURITYSRCS) \ $(PNRXSRCS) $(DPMSSRCS) \ $(XVSRCS) $(XRESSRCS) $(DMXSRCS) OBJS = shape.o $(SHMOBJS) xcmisc.o \ xtest.o sleepuntil.o \ bigreq.o sync.o $(SCRNSAVOBJ) \ $(XF86BIGFOBJS) $(SECURITYOBJS) \ $(PNRXOBJS) $(DPMSOBJS) \ $(XVOBJS) $(XRESOBJS) $(DMXOBJS) SOBJS = $(SHMOBJS) $(SECURITYOBJS) \ shape.o xtest.o sleepuntil.o $(PNRXOBJS) \ $(XF86BIGFOBJS) #if defined(NXAgentServer) && NXAgentServer NX_DEFINES = -DNXAGENT_SERVER #endif #if defined(XorgVersion) /* XXX Check if this can be eliminated */ XF86INCLUDES = -I$(XF86COMSRC) #endif INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \ $(PNRXINCLUDES) \ $(XF86INCLUDES) \ $(DMXINCLUDES) \ `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln #if defined(NXAgentServer) && NXAgentServer DEFINES = $(EXT_DEFINES) $(XVMCSHM_DEFINES) $(NX_DEFINES) #else DEFINES = $(EXT_DEFINES) $(XVMCSHM_DEFINES) #endif NormalLibraryObjectRule() NormalLibraryTarget(ext,$(OBJS)) LintLibraryTarget(ext,$(SRCS)) NormalLintTarget($(SRCS)) #if BuildXF86BigfontExt SpecialCObjectRule(xf86bigfont,$(ICONFIGFILES),$(SHM_DEFINES)) #endif #if BuildXCSecurity SpecialCObjectRule(security,$(ICONFIGFILES),$(POLICYFILEDEF)) #endif LinkConfDirectory(xserver,.,xserver,.) #if BuildXCSecurity && InstallSecurityConfig InstallNonExecFile(SecurityPolicy,$(SERVERCONFIGDIR)) #endif DependTarget() InstallDriverSDKNonExecFile(xvdix.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(xvmcext.h,$(DRIVERSDKINCLUDEDIR)) nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/panoramiX.c0000644000000000000000000010531413614532331017631 0ustar /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifdef HAVE_DMX_CONFIG_H #include #endif #include #include #include #include #include "misc.h" #include "cursor.h" #include "cursorstr.h" #include "extnsionst.h" #include "dixstruct.h" #include "gc.h" #include "gcstruct.h" #include "scrnintstr.h" #include "window.h" #include "windowstr.h" #include "pixmapstr.h" #include "panoramiX.h" #include #include "panoramiXsrv.h" #include "globals.h" #include "servermd.h" #include "resource.h" #ifdef RENDER #include "picturestr.h" #endif #include "protocol-versions.h" #ifdef GLXPROXY extern VisualPtr glxMatchVisual(ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatchScreen); #endif #if 0 static unsigned char PanoramiXReqCode = 0; #endif /* * PanoramiX data declarations */ int PanoramiXPixWidth = 0; int PanoramiXPixHeight = 0; _X_EXPORT int PanoramiXNumScreens = 0; _X_EXPORT PanoramiXData *panoramiXdataPtr = NULL; RegionRec PanoramiXScreenRegion = {{0, 0, 0, 0}, NULL}; static int PanoramiXNumDepths; static DepthPtr PanoramiXDepths; static int PanoramiXNumVisuals; static VisualPtr PanoramiXVisuals; /* We support at most 256 visuals */ _X_EXPORT XID *PanoramiXVisualTable = NULL; _X_EXPORT unsigned long XRC_DRAWABLE; _X_EXPORT unsigned long XRT_WINDOW; _X_EXPORT unsigned long XRT_PIXMAP; _X_EXPORT unsigned long XRT_GC; _X_EXPORT unsigned long XRT_COLORMAP; /* * Function prototypes */ static int panoramiXGeneration; static int ProcPanoramiXDispatch(ClientPtr client); static void PanoramiXResetProc(ExtensionEntry*); /* * External references for functions and data variables */ #include "panoramiXh.h" int (* SavedProcVector[256]) (ClientPtr client) = { NULL, }; static int PanoramiXGCIndex = -1; static int PanoramiXScreenIndex = -1; typedef struct { DDXPointRec clipOrg; DDXPointRec patOrg; GCFuncs *wrapFuncs; } PanoramiXGCRec, *PanoramiXGCPtr; typedef struct { CreateGCProcPtr CreateGC; CloseScreenProcPtr CloseScreen; } PanoramiXScreenRec, *PanoramiXScreenPtr; RegionRec XineramaScreenRegions[MAXSCREENS]; static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr); static void XineramaChangeGC(GCPtr, unsigned long); static void XineramaCopyGC(GCPtr, unsigned long, GCPtr); static void XineramaDestroyGC(GCPtr); static void XineramaChangeClip(GCPtr, int, void *, int); static void XineramaDestroyClip(GCPtr); static void XineramaCopyClip(GCPtr, GCPtr); static GCFuncs XineramaGCFuncs = { XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC, XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip }; #define Xinerama_GC_FUNC_PROLOGUE(pGC)\ PanoramiXGCPtr pGCPriv = \ (PanoramiXGCPtr) (pGC)->devPrivates[PanoramiXGCIndex].ptr;\ (pGC)->funcs = pGCPriv->wrapFuncs; #define Xinerama_GC_FUNC_EPILOGUE(pGC)\ pGCPriv->wrapFuncs = (pGC)->funcs;\ (pGC)->funcs = &XineramaGCFuncs; static Bool XineramaCloseScreen (ScreenPtr pScreen) { PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr; pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->CreateGC = pScreenPriv->CreateGC; RegionUninit(&XineramaScreenRegions[pScreen->myNum]); if (pScreen->myNum == 0) RegionUninit(&PanoramiXScreenRegion); free ((void *) pScreenPriv); return (*pScreen->CloseScreen) (pScreen); } static Bool XineramaCreateGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr; Bool ret; pScreen->CreateGC = pScreenPriv->CreateGC; if((ret = (*pScreen->CreateGC)(pGC))) { PanoramiXGCPtr pGCPriv = (PanoramiXGCPtr) pGC->devPrivates[PanoramiXGCIndex].ptr; pGCPriv->wrapFuncs = pGC->funcs; pGC->funcs = &XineramaGCFuncs; pGCPriv->clipOrg.x = pGC->clipOrg.x; pGCPriv->clipOrg.y = pGC->clipOrg.y; pGCPriv->patOrg.x = pGC->patOrg.x; pGCPriv->patOrg.y = pGC->patOrg.y; } pScreen->CreateGC = XineramaCreateGC; return ret; } static void XineramaValidateGC( GCPtr pGC, unsigned long changes, DrawablePtr pDraw ){ Xinerama_GC_FUNC_PROLOGUE (pGC); if((pDraw->type == DRAWABLE_WINDOW) && !(((WindowPtr)pDraw)->parent)) { /* the root window */ int x_off = panoramiXdataPtr[pGC->pScreen->myNum].x; int y_off = panoramiXdataPtr[pGC->pScreen->myNum].y; int new_val; new_val = pGCPriv->clipOrg.x - x_off; if(pGC->clipOrg.x != new_val) { pGC->clipOrg.x = new_val; changes |= GCClipXOrigin; } new_val = pGCPriv->clipOrg.y - y_off; if(pGC->clipOrg.y != new_val) { pGC->clipOrg.y = new_val; changes |= GCClipYOrigin; } new_val = pGCPriv->patOrg.x - x_off; if(pGC->patOrg.x != new_val) { pGC->patOrg.x = new_val; changes |= GCTileStipXOrigin; } new_val = pGCPriv->patOrg.y - y_off; if(pGC->patOrg.y != new_val) { pGC->patOrg.y = new_val; changes |= GCTileStipYOrigin; } } else { if(pGC->clipOrg.x != pGCPriv->clipOrg.x) { pGC->clipOrg.x = pGCPriv->clipOrg.x; changes |= GCClipXOrigin; } if(pGC->clipOrg.y != pGCPriv->clipOrg.y) { pGC->clipOrg.y = pGCPriv->clipOrg.y; changes |= GCClipYOrigin; } if(pGC->patOrg.x != pGCPriv->patOrg.x) { pGC->patOrg.x = pGCPriv->patOrg.x; changes |= GCTileStipXOrigin; } if(pGC->patOrg.y != pGCPriv->patOrg.y) { pGC->patOrg.y = pGCPriv->patOrg.y; changes |= GCTileStipYOrigin; } } (*pGC->funcs->ValidateGC)(pGC, changes, pDraw); Xinerama_GC_FUNC_EPILOGUE (pGC); } static void XineramaDestroyGC(GCPtr pGC) { Xinerama_GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->DestroyGC)(pGC); Xinerama_GC_FUNC_EPILOGUE (pGC); } static void XineramaChangeGC ( GCPtr pGC, unsigned long mask ){ Xinerama_GC_FUNC_PROLOGUE (pGC); if(mask & GCTileStipXOrigin) pGCPriv->patOrg.x = pGC->patOrg.x; if(mask & GCTileStipYOrigin) pGCPriv->patOrg.y = pGC->patOrg.y; if(mask & GCClipXOrigin) pGCPriv->clipOrg.x = pGC->clipOrg.x; if(mask & GCClipYOrigin) pGCPriv->clipOrg.y = pGC->clipOrg.y; (*pGC->funcs->ChangeGC) (pGC, mask); Xinerama_GC_FUNC_EPILOGUE (pGC); } static void XineramaCopyGC ( GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst ){ PanoramiXGCPtr pSrcPriv = (PanoramiXGCPtr) pGCSrc->devPrivates[PanoramiXGCIndex].ptr; Xinerama_GC_FUNC_PROLOGUE (pGCDst); if(mask & GCTileStipXOrigin) pGCPriv->patOrg.x = pSrcPriv->patOrg.x; if(mask & GCTileStipYOrigin) pGCPriv->patOrg.y = pSrcPriv->patOrg.y; if(mask & GCClipXOrigin) pGCPriv->clipOrg.x = pSrcPriv->clipOrg.x; if(mask & GCClipYOrigin) pGCPriv->clipOrg.y = pSrcPriv->clipOrg.y; (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); Xinerama_GC_FUNC_EPILOGUE (pGCDst); } static void XineramaChangeClip ( GCPtr pGC, int type, void *pvalue, int nrects ){ Xinerama_GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); Xinerama_GC_FUNC_EPILOGUE (pGC); } static void XineramaCopyClip(GCPtr pgcDst, GCPtr pgcSrc) { Xinerama_GC_FUNC_PROLOGUE (pgcDst); (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); Xinerama_GC_FUNC_EPILOGUE (pgcDst); } static void XineramaDestroyClip(GCPtr pGC) { Xinerama_GC_FUNC_PROLOGUE (pGC); (* pGC->funcs->DestroyClip)(pGC); Xinerama_GC_FUNC_EPILOGUE (pGC); } _X_EXPORT int XineramaDeleteResource(void * data, XID id) { free(data); return 1; } typedef struct { int screen; int id; } PanoramiXSearchData; static Bool XineramaFindIDByScrnum(void * resource, XID id, void * privdata) { PanoramiXRes *res = (PanoramiXRes*)resource; PanoramiXSearchData *data = (PanoramiXSearchData*)privdata; return (res->info[data->screen].id == data->id); } PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen) { PanoramiXSearchData data; if(!screen) return LookupIDByType(id, type); data.screen = screen; data.id = id; return LookupClientResourceComplex(clients[CLIENT_ID(id)], type, XineramaFindIDByScrnum, &data); } typedef struct _connect_callback_list { void (*func)(void); struct _connect_callback_list *next; } XineramaConnectionCallbackList; static XineramaConnectionCallbackList *ConnectionCallbackList = NULL; _X_EXPORT Bool XineramaRegisterConnectionBlockCallback(void (*func)(void)) { XineramaConnectionCallbackList *newlist; if(!(newlist = malloc(sizeof(XineramaConnectionCallbackList)))) return FALSE; newlist->next = ConnectionCallbackList; newlist->func = func; ConnectionCallbackList = newlist; return TRUE; } static void XineramaInitData(ScreenPtr pScreen) { int i, w, h; RegionNull(&PanoramiXScreenRegion); for (i = 0; i < PanoramiXNumScreens; i++) { BoxRec TheBox; pScreen = screenInfo.screens[i]; panoramiXdataPtr[i].x = dixScreenOrigins[i].x; panoramiXdataPtr[i].y = dixScreenOrigins[i].y; panoramiXdataPtr[i].width = pScreen->width; panoramiXdataPtr[i].height = pScreen->height; TheBox.x1 = panoramiXdataPtr[i].x; TheBox.x2 = TheBox.x1 + panoramiXdataPtr[i].width; TheBox.y1 = panoramiXdataPtr[i].y; TheBox.y2 = TheBox.y1 + panoramiXdataPtr[i].height; RegionInit(&XineramaScreenRegions[i], &TheBox, 1); RegionUnion(&PanoramiXScreenRegion, &PanoramiXScreenRegion, &XineramaScreenRegions[i]); } PanoramiXPixWidth = panoramiXdataPtr[0].x + panoramiXdataPtr[0].width; PanoramiXPixHeight = panoramiXdataPtr[0].y + panoramiXdataPtr[0].height; for (i = 1; i < PanoramiXNumScreens; i++) { w = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width; h = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height; if (PanoramiXPixWidth < w) PanoramiXPixWidth = w; if (PanoramiXPixHeight < h) PanoramiXPixHeight = h; } } void XineramaReinitData(ScreenPtr pScreen) { int i; RegionUninit(&PanoramiXScreenRegion); for (i = 0; i < PanoramiXNumScreens; i++) RegionUninit(&XineramaScreenRegions[i]); XineramaInitData(pScreen); } /* * PanoramiXExtensionInit(): * Called from InitExtensions in main(). * Register PanoramiXeen Extension * Initialize global variables. */ void PanoramiXExtensionInit(int argc, char *argv[]) { int i; Bool success = FALSE; ExtensionEntry *extEntry; ScreenPtr pScreen = screenInfo.screens[0]; PanoramiXScreenPtr pScreenPriv; if (noPanoramiXExtension) return; PanoramiXNumScreens = screenInfo.numScreens; if (PanoramiXNumScreens == 1) { /* Only 1 screen */ noPanoramiXExtension = TRUE; return; } while (panoramiXGeneration != serverGeneration) { extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0,0, ProcPanoramiXDispatch, SProcPanoramiXDispatch, PanoramiXResetProc, StandardMinorOpcode); if (!extEntry) { ErrorF("PanoramiXExtensionInit(): failed to AddExtension\n"); break; } #if 0 PanoramiXReqCode = (unsigned char)extEntry->base; #endif /* * First make sure all the basic allocations succeed. If not, * run in non-PanoramiXeen mode. */ panoramiXdataPtr = (PanoramiXData *) calloc(PanoramiXNumScreens, sizeof(PanoramiXData)); BREAK_IF(!panoramiXdataPtr); BREAK_IF((PanoramiXGCIndex = AllocateGCPrivateIndex()) < 0); BREAK_IF((PanoramiXScreenIndex = AllocateScreenPrivateIndex()) < 0); for (i = 0; i < PanoramiXNumScreens; i++) { pScreen = screenInfo.screens[i]; if(!AllocateGCPrivate(pScreen, PanoramiXGCIndex, sizeof(PanoramiXGCRec))) { noPanoramiXExtension = TRUE; return; } pScreenPriv = malloc(sizeof(PanoramiXScreenRec)); pScreen->devPrivates[PanoramiXScreenIndex].ptr = (void *)pScreenPriv; if(!pScreenPriv) { noPanoramiXExtension = TRUE; return; } pScreenPriv->CreateGC = pScreen->CreateGC; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CreateGC = XineramaCreateGC; pScreen->CloseScreen = XineramaCloseScreen; } XRC_DRAWABLE = CreateNewResourceClass(); XRT_WINDOW = CreateNewResourceType(XineramaDeleteResource) | XRC_DRAWABLE; XRT_PIXMAP = CreateNewResourceType(XineramaDeleteResource) | XRC_DRAWABLE; XRT_GC = CreateNewResourceType(XineramaDeleteResource); XRT_COLORMAP = CreateNewResourceType(XineramaDeleteResource); panoramiXGeneration = serverGeneration; success = TRUE; } if (!success) { noPanoramiXExtension = TRUE; ErrorF("%s Extension failed to initialize\n", PANORAMIX_PROTOCOL_NAME); return; } XineramaInitData(pScreen); /* * Put our processes into the ProcVector */ for (i = 256; i--; ) SavedProcVector[i] = ProcVector[i]; ProcVector[X_CreateWindow] = PanoramiXCreateWindow; ProcVector[X_ChangeWindowAttributes] = PanoramiXChangeWindowAttributes; ProcVector[X_DestroyWindow] = PanoramiXDestroyWindow; ProcVector[X_DestroySubwindows] = PanoramiXDestroySubwindows; ProcVector[X_ChangeSaveSet] = PanoramiXChangeSaveSet; ProcVector[X_ReparentWindow] = PanoramiXReparentWindow; ProcVector[X_MapWindow] = PanoramiXMapWindow; ProcVector[X_MapSubwindows] = PanoramiXMapSubwindows; ProcVector[X_UnmapWindow] = PanoramiXUnmapWindow; ProcVector[X_UnmapSubwindows] = PanoramiXUnmapSubwindows; ProcVector[X_ConfigureWindow] = PanoramiXConfigureWindow; ProcVector[X_CirculateWindow] = PanoramiXCirculateWindow; ProcVector[X_GetGeometry] = PanoramiXGetGeometry; ProcVector[X_TranslateCoords] = PanoramiXTranslateCoords; ProcVector[X_CreatePixmap] = PanoramiXCreatePixmap; ProcVector[X_FreePixmap] = PanoramiXFreePixmap; ProcVector[X_CreateGC] = PanoramiXCreateGC; ProcVector[X_ChangeGC] = PanoramiXChangeGC; ProcVector[X_CopyGC] = PanoramiXCopyGC; ProcVector[X_SetDashes] = PanoramiXSetDashes; ProcVector[X_SetClipRectangles] = PanoramiXSetClipRectangles; ProcVector[X_FreeGC] = PanoramiXFreeGC; ProcVector[X_ClearArea] = PanoramiXClearToBackground; ProcVector[X_CopyArea] = PanoramiXCopyArea;; ProcVector[X_CopyPlane] = PanoramiXCopyPlane;; ProcVector[X_PolyPoint] = PanoramiXPolyPoint; ProcVector[X_PolyLine] = PanoramiXPolyLine; ProcVector[X_PolySegment] = PanoramiXPolySegment; ProcVector[X_PolyRectangle] = PanoramiXPolyRectangle; ProcVector[X_PolyArc] = PanoramiXPolyArc; ProcVector[X_FillPoly] = PanoramiXFillPoly; ProcVector[X_PolyFillRectangle] = PanoramiXPolyFillRectangle; ProcVector[X_PolyFillArc] = PanoramiXPolyFillArc; ProcVector[X_PutImage] = PanoramiXPutImage; ProcVector[X_GetImage] = PanoramiXGetImage; ProcVector[X_PolyText8] = PanoramiXPolyText8; ProcVector[X_PolyText16] = PanoramiXPolyText16; ProcVector[X_ImageText8] = PanoramiXImageText8; ProcVector[X_ImageText16] = PanoramiXImageText16; ProcVector[X_CreateColormap] = PanoramiXCreateColormap; ProcVector[X_FreeColormap] = PanoramiXFreeColormap; ProcVector[X_CopyColormapAndFree] = PanoramiXCopyColormapAndFree; ProcVector[X_InstallColormap] = PanoramiXInstallColormap; ProcVector[X_UninstallColormap] = PanoramiXUninstallColormap; ProcVector[X_AllocColor] = PanoramiXAllocColor; ProcVector[X_AllocNamedColor] = PanoramiXAllocNamedColor; ProcVector[X_AllocColorCells] = PanoramiXAllocColorCells; ProcVector[X_AllocColorPlanes] = PanoramiXAllocColorPlanes; ProcVector[X_FreeColors] = PanoramiXFreeColors; ProcVector[X_StoreColors] = PanoramiXStoreColors; ProcVector[X_StoreNamedColor] = PanoramiXStoreNamedColor; #ifdef RENDER PanoramiXRenderInit (); #endif } extern Bool CreateConnectionBlock(void); Bool PanoramiXCreateConnectionBlock(void) { int i, j, length; Bool disableBackingStore = FALSE; Bool disableSaveUnders = FALSE; int old_width, old_height; float width_mult, height_mult; xWindowRoot *root; xVisualType *visual; xDepth *depth; VisualPtr pVisual; ScreenPtr pScreen; /* * Do normal CreateConnectionBlock but faking it for only one screen */ if(!PanoramiXNumDepths) { ErrorF("PanoramiX error: Incompatible screens. No common visuals\n"); return FALSE; } for(i = 1; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; if(pScreen->rootDepth != screenInfo.screens[0]->rootDepth) { ErrorF("PanoramiX error: Incompatible screens. Root window depths differ\n"); return FALSE; } if(pScreen->backingStoreSupport != screenInfo.screens[0]->backingStoreSupport) disableBackingStore = TRUE; if(pScreen->saveUnderSupport != screenInfo.screens[0]->saveUnderSupport) disableSaveUnders = TRUE; } if(disableBackingStore || disableSaveUnders) { for(i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; if(disableBackingStore) pScreen->backingStoreSupport = NotUseful; if(disableSaveUnders) pScreen->saveUnderSupport = NotUseful; } } i = screenInfo.numScreens; screenInfo.numScreens = 1; if (!CreateConnectionBlock()) { screenInfo.numScreens = i; return FALSE; } screenInfo.numScreens = i; root = (xWindowRoot *) (ConnectionInfo + connBlockScreenStart); length = connBlockScreenStart + sizeof(xWindowRoot); /* overwrite the connection block */ root->nDepths = PanoramiXNumDepths; for (i = 0; i < PanoramiXNumDepths; i++) { depth = (xDepth *) (ConnectionInfo + length); depth->depth = PanoramiXDepths[i].depth; depth->nVisuals = PanoramiXDepths[i].numVids; length += sizeof(xDepth); visual = (xVisualType *)(ConnectionInfo + length); for (j = 0; j < depth->nVisuals; j++, visual++) { visual->visualID = PanoramiXDepths[i].vids[j]; for (pVisual = PanoramiXVisuals; pVisual->vid != visual->visualID; pVisual++) ; visual->class = pVisual->class; visual->bitsPerRGB = pVisual->bitsPerRGBValue; visual->colormapEntries = pVisual->ColormapEntries; visual->redMask = pVisual->redMask; visual->greenMask = pVisual->greenMask; visual->blueMask = pVisual->blueMask; } length += (depth->nVisuals * sizeof(xVisualType)); } connSetupPrefix.length = length >> 2; free(PanoramiXVisuals); for (i = 0; i < PanoramiXNumDepths; i++) free(PanoramiXDepths[i].vids); free(PanoramiXDepths); /* * OK, change some dimensions so it looks as if it were one big screen */ old_width = root->pixWidth; old_height = root->pixHeight; root->pixWidth = PanoramiXPixWidth; root->pixHeight = PanoramiXPixHeight; width_mult = (1.0 * root->pixWidth) / old_width; height_mult = (1.0 * root->pixHeight) / old_height; root->mmWidth *= width_mult; root->mmHeight *= height_mult; while(ConnectionCallbackList) { void *tmp; tmp = (void *)ConnectionCallbackList; (*ConnectionCallbackList->func)(); ConnectionCallbackList = ConnectionCallbackList->next; free(tmp); } return TRUE; } extern void PanoramiXConsolidate(void) { int i, j, k; VisualPtr pVisual, pVisual2; ScreenPtr pScreen, pScreen2; DepthPtr pDepth, pDepth2; PanoramiXRes *root, *defmap, *saver; Bool foundDepth, missingDepth; if(!PanoramiXVisualTable) PanoramiXVisualTable = calloc(256 * MAXSCREENS, sizeof(XID)); pScreen = screenInfo.screens[0]; pVisual = pScreen->visuals; pDepth = pScreen->allowedDepths; PanoramiXNumDepths = 0; PanoramiXDepths = calloc(pScreen->numDepths,sizeof(DepthRec)); PanoramiXNumVisuals = 0; PanoramiXVisuals = calloc(pScreen->numVisuals,sizeof(VisualRec)); for (i = 0; i < pScreen->numDepths; i++, pDepth++) { missingDepth = FALSE; for (j = 1; j < PanoramiXNumScreens; j++) { pScreen2 = screenInfo.screens[j]; pDepth2 = pScreen2->allowedDepths; foundDepth = FALSE; for (k = 0; k < pScreen2->numDepths; k++, pDepth2++) { if(pDepth2->depth == pDepth->depth) { foundDepth = TRUE; break; } } if(!foundDepth) { missingDepth = TRUE; break; } } if(!missingDepth) { PanoramiXDepths[PanoramiXNumDepths].depth = pDepth->depth; PanoramiXDepths[PanoramiXNumDepths].numVids = 0; if(pDepth->numVids) PanoramiXDepths[PanoramiXNumDepths].vids = malloc(sizeof(VisualID) * pDepth->numVids); else PanoramiXDepths[PanoramiXNumDepths].vids = NULL; PanoramiXNumDepths++; } } for (i = 0; i < pScreen->numVisuals; i++, pVisual++) { PanoramiXVisualTable[pVisual->vid * MAXSCREENS] = pVisual->vid; /* check if the visual exists on all screens */ for (j = 1; j < PanoramiXNumScreens; j++) { pScreen2 = screenInfo.screens[j]; #ifdef GLXPROXY pVisual2 = glxMatchVisual(pScreen, pVisual, pScreen2); if (pVisual2) { PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j] = pVisual2->vid; continue; } else if (glxMatchVisual(pScreen, pVisual, pScreen)) { PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j] = 0; break; } #endif pVisual2 = pScreen2->visuals; for (k = 0; k < pScreen2->numVisuals; k++, pVisual2++) { if ((pVisual->class == pVisual2->class) && (pVisual->ColormapEntries == pVisual2->ColormapEntries) && (pVisual->nplanes == pVisual2->nplanes) && (pVisual->redMask == pVisual2->redMask) && (pVisual->greenMask == pVisual2->greenMask) && (pVisual->blueMask == pVisual2->blueMask) && (pVisual->offsetRed == pVisual2->offsetRed) && (pVisual->offsetGreen == pVisual2->offsetGreen) && (pVisual->offsetBlue == pVisual2->offsetBlue)) { /* We merely assign the first visual that matches. OpenGL will need to get involved at some point if you want match GLX visuals */ PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j] = pVisual2->vid; break; } } } /* if it doesn't exist on all screens we can't use it */ for (j = 0; j < PanoramiXNumScreens; j++) { if (!PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j]) { PanoramiXVisualTable[pVisual->vid * MAXSCREENS] = 0; break; } } /* if it does, make sure it's in the list of supported depths and visuals */ if(PanoramiXVisualTable[pVisual->vid * MAXSCREENS]) { PanoramiXVisuals[PanoramiXNumVisuals].vid = pVisual->vid; PanoramiXVisuals[PanoramiXNumVisuals].class = pVisual->class; PanoramiXVisuals[PanoramiXNumVisuals].bitsPerRGBValue = pVisual->bitsPerRGBValue; PanoramiXVisuals[PanoramiXNumVisuals].ColormapEntries = pVisual->ColormapEntries; PanoramiXVisuals[PanoramiXNumVisuals].nplanes = pVisual->nplanes; PanoramiXVisuals[PanoramiXNumVisuals].redMask = pVisual->redMask; PanoramiXVisuals[PanoramiXNumVisuals].greenMask = pVisual->greenMask; PanoramiXVisuals[PanoramiXNumVisuals].blueMask = pVisual->blueMask; PanoramiXVisuals[PanoramiXNumVisuals].offsetRed = pVisual->offsetRed; PanoramiXVisuals[PanoramiXNumVisuals].offsetGreen = pVisual->offsetGreen; PanoramiXVisuals[PanoramiXNumVisuals].offsetBlue = pVisual->offsetBlue; PanoramiXNumVisuals++; for (j = 0; j < PanoramiXNumDepths; j++) { if (PanoramiXDepths[j].depth == pVisual->nplanes) { PanoramiXDepths[j].vids[PanoramiXDepths[j].numVids] = pVisual->vid; PanoramiXDepths[j].numVids++; break; } } } } root = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)); root->type = XRT_WINDOW; defmap = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)); defmap->type = XRT_COLORMAP; saver = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)); saver->type = XRT_WINDOW; for (i = 0; i < PanoramiXNumScreens; i++) { root->info[i].id = screenInfo.screens[i]->root->drawable.id; root->u.win.class = InputOutput; root->u.win.root = TRUE; saver->info[i].id = savedScreenInfo[i].wid; saver->u.win.class = InputOutput; saver->u.win.root = TRUE; defmap->info[i].id = (screenInfo.screens[i])->defColormap; } AddResource(root->info[0].id, XRT_WINDOW, root); AddResource(saver->info[0].id, XRT_WINDOW, saver); AddResource(defmap->info[0].id, XRT_COLORMAP, defmap); } /* * PanoramiXResetProc() * Exit, deallocating as needed. */ static void PanoramiXResetProc(ExtensionEntry* extEntry) { int i; #ifdef RENDER PanoramiXRenderReset (); #endif screenInfo.numScreens = PanoramiXNumScreens; for (i = 256; i--; ) ProcVector[i] = SavedProcVector[i]; free(panoramiXdataPtr); } int ProcPanoramiXQueryVersion (ClientPtr client) { /* REQUEST(xPanoramiXQueryVersionReq); */ xPanoramiXQueryVersionReply rep; REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION; rep.minorVersion = SERVER_PANORAMIX_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.majorVersion); swaps(&rep.minorVersion); } WriteToClient(client, sizeof (xPanoramiXQueryVersionReply), &rep); return (client->noClientException); } int ProcPanoramiXGetState(ClientPtr client) { REQUEST(xPanoramiXGetStateReq); WindowPtr pWin; xPanoramiXGetStateReply rep; REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); pWin = LookupWindow (stuff->window, client); if (!pWin) return BadWindow; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.state = !noPanoramiXExtension; if (client->swapped) { swaps (&rep.sequenceNumber); swapl (&rep.length); swapl ((int* )&rep.state); } WriteToClient (client, sizeof (xPanoramiXGetStateReply), &rep); return client->noClientException; } int ProcPanoramiXGetScreenCount(ClientPtr client) { REQUEST(xPanoramiXGetScreenCountReq); WindowPtr pWin; xPanoramiXGetScreenCountReply rep; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); pWin = LookupWindow (stuff->window, client); if (!pWin) return BadWindow; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.ScreenCount = PanoramiXNumScreens; if (client->swapped) { swaps (&rep.sequenceNumber); swapl (&rep.length); swapl ((int* )&rep.ScreenCount); } WriteToClient (client, sizeof (xPanoramiXGetScreenCountReply), &rep); return client->noClientException; } int ProcPanoramiXGetScreenSize(ClientPtr client) { REQUEST(xPanoramiXGetScreenSizeReq); WindowPtr pWin; xPanoramiXGetScreenSizeReply rep; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); pWin = LookupWindow (stuff->window, client); if (!pWin) return BadWindow; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; /* screen dimensions */ rep.width = panoramiXdataPtr[stuff->screen].width; rep.height = panoramiXdataPtr[stuff->screen].height; if (client->swapped) { swaps (&rep.sequenceNumber); swapl (&rep.length); swapl (&rep.width); swapl (&rep.height); } WriteToClient (client, sizeof (xPanoramiXGetScreenSizeReply), &rep); return client->noClientException; } int ProcXineramaIsActive(ClientPtr client) { /* REQUEST(xXineramaIsActiveReq); */ xXineramaIsActiveReply rep; REQUEST_SIZE_MATCH(xXineramaIsActiveReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; #if 1 { /* The following hack fools clients into thinking that Xinerama * is disabled even though it is not. */ extern Bool PanoramiXExtensionDisabledHack; rep.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack; } #else rep.state = !noPanoramiXExtension; #endif if (client->swapped) { swaps (&rep.sequenceNumber); swapl (&rep.length); swapl (&rep.state); } WriteToClient (client, sizeof (xXineramaIsActiveReply), &rep); return client->noClientException; } int ProcXineramaQueryScreens(ClientPtr client) { /* REQUEST(xXineramaQueryScreensReq); */ xXineramaQueryScreensReply rep; REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens; rep.length = rep.number * sz_XineramaScreenInfo >> 2; if (client->swapped) { swaps (&rep.sequenceNumber); swapl (&rep.length); swapl (&rep.number); } WriteToClient (client, sizeof (xXineramaQueryScreensReply), &rep); if(!noPanoramiXExtension) { xXineramaScreenInfo scratch; int i; for(i = 0; i < PanoramiXNumScreens; i++) { scratch.x_org = panoramiXdataPtr[i].x; scratch.y_org = panoramiXdataPtr[i].y; scratch.width = panoramiXdataPtr[i].width; scratch.height = panoramiXdataPtr[i].height; if(client->swapped) { swaps (&scratch.x_org); swaps (&scratch.y_org); swaps (&scratch.width); swaps (&scratch.height); } WriteToClient (client, sz_XineramaScreenInfo, &scratch); } } return client->noClientException; } static int ProcPanoramiXDispatch (ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_PanoramiXQueryVersion: return ProcPanoramiXQueryVersion(client); case X_PanoramiXGetState: return ProcPanoramiXGetState(client); case X_PanoramiXGetScreenCount: return ProcPanoramiXGetScreenCount(client); case X_PanoramiXGetScreenSize: return ProcPanoramiXGetScreenSize(client); case X_XineramaIsActive: return ProcXineramaIsActive(client); case X_XineramaQueryScreens: return ProcXineramaQueryScreens(client); } return BadRequest; } #if X_BYTE_ORDER == X_LITTLE_ENDIAN #define SHIFT_L(v,s) (v) << (s) #define SHIFT_R(v,s) (v) >> (s) #else #define SHIFT_L(v,s) (v) >> (s) #define SHIFT_R(v,s) (v) << (s) #endif static void CopyBits(char *dst, int shiftL, char *src, int bytes) { /* Just get it to work. Worry about speed later */ int shiftR = 8 - shiftL; while(bytes--) { *dst |= SHIFT_L(*src, shiftL); *(dst + 1) |= SHIFT_R(*src, shiftR); dst++; src++; } } /* Caution. This doesn't support 2 and 4 bpp formats. We expect 1 bpp and planar data to be already cleared when presented to this function */ void XineramaGetImageData( DrawablePtr *pDrawables, int left, int top, int width, int height, unsigned int format, unsigned long planemask, char *data, int pitch, Bool isRoot ){ RegionRec SrcRegion, GrabRegion; BoxRec SrcBox, *pbox; int x, y, w, h, i, j, nbox, size, sizeNeeded, ScratchPitch, inOut, depth; DrawablePtr pDraw = pDrawables[0]; char *ScratchMem = NULL; size = 0; /* find box in logical screen space */ SrcBox.x1 = left; SrcBox.y1 = top; if(!isRoot) { SrcBox.x1 += pDraw->x + panoramiXdataPtr[0].x; SrcBox.y1 += pDraw->y + panoramiXdataPtr[0].y; } SrcBox.x2 = SrcBox.x1 + width; SrcBox.y2 = SrcBox.y1 + height; RegionInit(&SrcRegion, &SrcBox, 1); RegionNull(&GrabRegion); depth = (format == XYPixmap) ? 1 : pDraw->depth; for(i = 0; i < PanoramiXNumScreens; i++) { pDraw = pDrawables[i]; inOut = RegionContainsRect(&XineramaScreenRegions[i],&SrcBox); if(inOut == rgnIN) { (*pDraw->pScreen->GetImage)(pDraw, SrcBox.x1 - pDraw->x - panoramiXdataPtr[i].x, SrcBox.y1 - pDraw->y - panoramiXdataPtr[i].y, width, height, format, planemask, data); break; } else if (inOut == rgnOUT) continue; RegionIntersect(&GrabRegion, &SrcRegion, &XineramaScreenRegions[i]); nbox = RegionNumRects(&GrabRegion); if(nbox) { pbox = RegionRects(&GrabRegion); while(nbox--) { w = pbox->x2 - pbox->x1; h = pbox->y2 - pbox->y1; ScratchPitch = PixmapBytePad(w, depth); sizeNeeded = ScratchPitch * h; if(sizeNeeded > size) { char *tmpdata = ScratchMem; ScratchMem = realloc(ScratchMem, sizeNeeded); if(ScratchMem) size = sizeNeeded; else { ScratchMem = tmpdata; break; } } x = pbox->x1 - pDraw->x - panoramiXdataPtr[i].x; y = pbox->y1 - pDraw->y - panoramiXdataPtr[i].y; (*pDraw->pScreen->GetImage)(pDraw, x, y, w, h, format, planemask, ScratchMem); /* copy the memory over */ if(depth == 1) { int k, shift, leftover, index, index2; x = pbox->x1 - SrcBox.x1; y = pbox->y1 - SrcBox.y1; shift = x & 7; x >>= 3; leftover = w & 7; w >>= 3; /* clean up the edge */ if(leftover) { int mask = (1 << leftover) - 1; for(j = h, k = w; j--; k += ScratchPitch) ScratchMem[k] &= mask; } for(j = 0, index = (pitch * y) + x, index2 = 0; j < h; j++, index += pitch, index2 += ScratchPitch) { if(w) { if(!shift) memcpy(data + index, ScratchMem + index2, w); else CopyBits(data + index, shift, ScratchMem + index2, w); } if(leftover) { data[index + w] |= SHIFT_L(ScratchMem[index2 + w], shift); if((shift + leftover) > 8) data[index + w + 1] |= SHIFT_R(ScratchMem[index2 + w],(8 - shift)); } } } else { j = BitsPerPixel(depth) >> 3; x = (pbox->x1 - SrcBox.x1) * j; y = pbox->y1 - SrcBox.y1; w *= j; for(j = 0; j < h; j++) { memcpy(data + (pitch * (y + j)) + x, ScratchMem + (ScratchPitch * j), w); } } pbox++; } RegionSubtract(&SrcRegion, &SrcRegion, &GrabRegion); if(!RegionNotEmpty(&SrcRegion)) break; } } if(ScratchMem) free(ScratchMem); RegionUninit(&SrcRegion); RegionUninit(&GrabRegion); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/panoramiX.h0000644000000000000000000000575413614532331017645 0ustar /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ /* * PanoramiX definitions */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _PANORAMIX_H_ #define _PANORAMIX_H_ #include /*#include "gcstruct.h"*/ typedef struct _PanoramiXData { int x; int y; int width; int height; } PanoramiXData; typedef struct _PanoramiXInfo { XID id ; } PanoramiXInfo; typedef struct { PanoramiXInfo info[MAXSCREENS]; RESTYPE type; union { struct { char visibility; char class; char root; } win; struct { Bool shared; } pix; #ifdef RENDER struct { Bool root; } pict; #endif char raw_data[4]; } u; } PanoramiXRes; #define FOR_NSCREENS_FORWARD(j) for(j = 0; j < PanoramiXNumScreens; j++) #define FOR_NSCREENS_BACKWARD(j) for(j = PanoramiXNumScreens - 1; j >= 0; j--) #define FOR_NSCREENS(j) FOR_NSCREENS_FORWARD(j) #define BREAK_IF(a) if ((a)) break #define IF_RETURN(a,b) if ((a)) return (b) #define FORCE_ROOT(a) { \ int _j; \ for (_j = PanoramiXNumScreens - 1; _j; _j--) \ if ((a).root == screenInfo.screens[_j]->root->drawable.id) \ break; \ (a).rootX += panoramiXdataPtr[_j].x; \ (a).rootY += panoramiXdataPtr[_j].y; \ (a).root = screenInfo.screens[0]->root->drawable.id; \ } #define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared) #define SKIP_FAKE_WINDOW(a) if(!LookupIDByType(a, XRT_WINDOW)) return #endif /* _PANORAMIX_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/panoramiXh.h0000644000000000000000000000623013614532331020003 0ustar /* * Server dispatcher function replacements */ extern int PanoramiXCreateWindow(ClientPtr client); extern int PanoramiXChangeWindowAttributes(ClientPtr client); extern int PanoramiXDestroyWindow(ClientPtr client); extern int PanoramiXDestroySubwindows(ClientPtr client); extern int PanoramiXChangeSaveSet(ClientPtr client); extern int PanoramiXReparentWindow(ClientPtr client); extern int PanoramiXMapWindow(ClientPtr client); extern int PanoramiXMapSubwindows(ClientPtr client); extern int PanoramiXUnmapWindow(ClientPtr client); extern int PanoramiXUnmapSubwindows(ClientPtr client); extern int PanoramiXConfigureWindow(ClientPtr client); extern int PanoramiXCirculateWindow(ClientPtr client); extern int PanoramiXGetGeometry(ClientPtr client); extern int PanoramiXTranslateCoords(ClientPtr client); extern int PanoramiXCreatePixmap(ClientPtr client); extern int PanoramiXFreePixmap(ClientPtr client); extern int PanoramiXChangeGC(ClientPtr client); extern int PanoramiXCopyGC(ClientPtr client); extern int PanoramiXCopyColormapAndFree(ClientPtr client); extern int PanoramiXCreateGC(ClientPtr client); extern int PanoramiXSetDashes(ClientPtr client); extern int PanoramiXSetClipRectangles(ClientPtr client); extern int PanoramiXFreeGC(ClientPtr client); extern int PanoramiXClearToBackground(ClientPtr client); extern int PanoramiXCopyArea(ClientPtr client); extern int PanoramiXCopyPlane(ClientPtr client); extern int PanoramiXPolyPoint(ClientPtr client); extern int PanoramiXPolyLine(ClientPtr client); extern int PanoramiXPolySegment(ClientPtr client); extern int PanoramiXPolyRectangle(ClientPtr client); extern int PanoramiXPolyArc(ClientPtr client); extern int PanoramiXFillPoly(ClientPtr client); extern int PanoramiXPolyFillArc(ClientPtr client); extern int PanoramiXPolyFillRectangle(ClientPtr client); extern int PanoramiXPutImage(ClientPtr client); extern int PanoramiXGetImage(ClientPtr client); extern int PanoramiXPolyText8(ClientPtr client); extern int PanoramiXPolyText16(ClientPtr client); extern int PanoramiXImageText8(ClientPtr client); extern int PanoramiXImageText16(ClientPtr client); extern int PanoramiXCreateColormap(ClientPtr client); extern int PanoramiXFreeColormap(ClientPtr client); extern int PanoramiXInstallColormap(ClientPtr client); extern int PanoramiXUninstallColormap(ClientPtr client); extern int PanoramiXAllocColor(ClientPtr client); extern int PanoramiXAllocNamedColor(ClientPtr client); extern int PanoramiXAllocColorCells(ClientPtr client); extern int PanoramiXStoreNamedColor(ClientPtr client); extern int PanoramiXFreeColors(ClientPtr client); extern int PanoramiXStoreColors(ClientPtr client); extern int PanoramiXAllocColorPlanes(ClientPtr client); #define PROC_EXTERN(pfunc) extern int pfunc(ClientPtr) PROC_EXTERN(ProcPanoramiXQueryVersion); PROC_EXTERN(ProcPanoramiXGetState); PROC_EXTERN(ProcPanoramiXGetScreenCount); PROC_EXTERN(ProcPanoramiXGetScreenSize); PROC_EXTERN(ProcXineramaQueryScreens); PROC_EXTERN(ProcXineramaIsActive); extern int SProcPanoramiXDispatch(ClientPtr client); extern char *ConnectionInfo; extern int connBlockScreenStart; extern xConnSetupPrefix connSetupPrefix; extern int (* SavedProcVector[256]) (ClientPtr client); nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/panoramiXprocs.c0000644000000000000000000017453313614532331020711 0ustar /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* Massively rewritten by Mark Vojkovich */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "windowstr.h" #include "dixfontstr.h" #include "gcstruct.h" #include "colormapst.h" #include "scrnintstr.h" #include "opaque.h" #include "inputstr.h" #include "migc.h" #include "misc.h" #include "dixstruct.h" #include "panoramiX.h" #include "panoramiXsrv.h" #include "resource.h" #include "panoramiXh.h" #define XINERAMA_IMAGE_BUFSIZE (256*1024) #define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \ CWDontPropagate | CWOverrideRedirect | CWCursor ) #if 0 extern void (* EventSwapVector[128]) (fsError *, fsError *); extern void Swap32Write(); extern void SLHostsExtend(); extern void SQColorsExtend(); WriteSConnectionInfo(); extern void WriteSConnSetupPrefix(); #endif /* Various of the DIX function interfaces were not designed to allow * the client->errorValue to be set on BadValue and other errors. * Rather than changing interfaces and breaking untold code we introduce * a new global that dispatch can use. */ extern XID clientErrorValue; /* XXX this is a kludge */ int PanoramiXCreateWindow(ClientPtr client) { PanoramiXRes *parent, *newWin; PanoramiXRes *backPix = NULL; PanoramiXRes *bordPix = NULL; PanoramiXRes *cmap = NULL; REQUEST(xCreateWindowReq); int pback_offset = 0, pbord_offset = 0, cmap_offset = 0; int result = 0, len, j; int orig_x, orig_y; XID orig_visual, tmp; Bool parentIsRoot; REQUEST_AT_LEAST_SIZE(xCreateWindowReq); len = client->req_len - (sizeof(xCreateWindowReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; if (!(parent = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->parent, XRT_WINDOW, DixWriteAccess))) return BadWindow; if(stuff->class == CopyFromParent) stuff->class = parent->u.win.class; if((stuff->class == InputOnly) && (stuff->mask & (~INPUTONLY_LEGAL_MASK))) return BadMatch; if ((Mask)stuff->mask & CWBackPixmap) { pback_offset = Ones((Mask)stuff->mask & (CWBackPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pback_offset); if ((tmp != None) && (tmp != ParentRelative)) { if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } if ((Mask)stuff->mask & CWBorderPixmap) { pbord_offset = Ones((Mask)stuff->mask & (CWBorderPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pbord_offset); if (tmp != CopyFromParent) { if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } if ((Mask)stuff->mask & CWColormap) { cmap_offset = Ones((Mask)stuff->mask & (CWColormap - 1)); tmp = *((CARD32 *) &stuff[1] + cmap_offset); if ((tmp != CopyFromParent) && (tmp != None)) { if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_COLORMAP, DixReadAccess))) return BadColor; } } if(!(newWin = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)))) return BadAlloc; newWin->type = XRT_WINDOW; newWin->u.win.visibility = VisibilityNotViewable; newWin->u.win.class = stuff->class; newWin->u.win.root = FALSE; newWin->info[0].id = stuff->wid; for(j = 1; j < PanoramiXNumScreens; j++) newWin->info[j].id = FakeClientID(client->index); if (stuff->class == InputOnly) stuff->visual = CopyFromParent; orig_visual = stuff->visual; orig_x = stuff->x; orig_y = stuff->y; parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) || (stuff->parent == savedScreenInfo[0].wid); FOR_NSCREENS_BACKWARD(j) { stuff->wid = newWin->info[j].id; stuff->parent = parent->info[j].id; if (parentIsRoot) { stuff->x = orig_x - panoramiXdataPtr[j].x; stuff->y = orig_y - panoramiXdataPtr[j].y; } if (backPix) *((CARD32 *) &stuff[1] + pback_offset) = backPix->info[j].id; if (bordPix) *((CARD32 *) &stuff[1] + pbord_offset) = bordPix->info[j].id; if (cmap) *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[j].id; if ( orig_visual != CopyFromParent ) stuff->visual = PanoramiXVisualTable[(orig_visual*MAXSCREENS) + j]; result = (*SavedProcVector[X_CreateWindow])(client); if(result != Success) break; } if (result == Success) AddResource(newWin->info[0].id, XRT_WINDOW, newWin); else free(newWin); return (result); } int PanoramiXChangeWindowAttributes(ClientPtr client) { PanoramiXRes *win; PanoramiXRes *backPix = NULL; PanoramiXRes *bordPix = NULL; PanoramiXRes *cmap = NULL; REQUEST(xChangeWindowAttributesReq); int pback_offset = 0, pbord_offset = 0, cmap_offset = 0; int result = 0, len, j; XID tmp; REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2); if (Ones(stuff->valueMask) != len) return BadLength; if (!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->window, XRT_WINDOW, DixWriteAccess))) return BadWindow; if((win->u.win.class == InputOnly) && (stuff->valueMask & (~INPUTONLY_LEGAL_MASK))) return BadMatch; if ((Mask)stuff->valueMask & CWBackPixmap) { pback_offset = Ones((Mask)stuff->valueMask & (CWBackPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pback_offset); if ((tmp != None) && (tmp != ParentRelative)) { if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } if ((Mask)stuff->valueMask & CWBorderPixmap) { pbord_offset = Ones((Mask)stuff->valueMask & (CWBorderPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pbord_offset); if (tmp != CopyFromParent) { if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } if ((Mask)stuff->valueMask & CWColormap) { cmap_offset = Ones((Mask)stuff->valueMask & (CWColormap - 1)); tmp = *((CARD32 *) &stuff[1] + cmap_offset); if ((tmp != CopyFromParent) && (tmp != None)) { if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_COLORMAP, DixReadAccess))) return BadColor; } } FOR_NSCREENS_BACKWARD(j) { stuff->window = win->info[j].id; if (backPix) *((CARD32 *) &stuff[1] + pback_offset) = backPix->info[j].id; if (bordPix) *((CARD32 *) &stuff[1] + pbord_offset) = bordPix->info[j].id; if (cmap) *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[j].id; result = (*SavedProcVector[X_ChangeWindowAttributes])(client); } return (result); } int PanoramiXDestroyWindow(ClientPtr client) { PanoramiXRes *win; int result = 0, j; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->id, XRT_WINDOW, DixDestroyAccess))) return BadWindow; FOR_NSCREENS_BACKWARD(j) { stuff->id = win->info[j].id; result = (*SavedProcVector[X_DestroyWindow])(client); if(result != Success) break; } /* Since ProcDestroyWindow is using FreeResource, it will free our resource for us on the last pass through the loop above */ return (result); } int PanoramiXDestroySubwindows(ClientPtr client) { PanoramiXRes *win; int result = 0, j; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->id, XRT_WINDOW, DixDestroyAccess))) return BadWindow; FOR_NSCREENS_BACKWARD(j) { stuff->id = win->info[j].id; result = (*SavedProcVector[X_DestroySubwindows])(client); if(result != Success) break; } /* DestroySubwindows is using FreeResource which will free our resources for us on the last pass through the loop above */ return (result); } int PanoramiXChangeSaveSet(ClientPtr client) { PanoramiXRes *win; int result = 0, j; REQUEST(xChangeSaveSetReq); REQUEST_SIZE_MATCH(xChangeSaveSetReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->window, XRT_WINDOW, DixReadAccess))) return BadWindow; FOR_NSCREENS_BACKWARD(j) { stuff->window = win->info[j].id; result = (*SavedProcVector[X_ChangeSaveSet])(client); if(result != Success) break; } return (result); } int PanoramiXReparentWindow(ClientPtr client) { PanoramiXRes *win, *parent; int result = 0, j; int x, y; Bool parentIsRoot; REQUEST(xReparentWindowReq); REQUEST_SIZE_MATCH(xReparentWindowReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->window, XRT_WINDOW, DixWriteAccess))) return BadWindow; if(!(parent = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->parent, XRT_WINDOW, DixWriteAccess))) return BadWindow; x = stuff->x; y = stuff->y; parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) || (stuff->parent == savedScreenInfo[0].wid); FOR_NSCREENS_BACKWARD(j) { stuff->window = win->info[j].id; stuff->parent = parent->info[j].id; if(parentIsRoot) { stuff->x = x - panoramiXdataPtr[j].x; stuff->y = y - panoramiXdataPtr[j].y; } result = (*SavedProcVector[X_ReparentWindow])(client); if(result != Success) break; } return (result); } int PanoramiXMapWindow(ClientPtr client) { PanoramiXRes *win; int result = 0, j; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->id, XRT_WINDOW, DixReadAccess))) return BadWindow; FOR_NSCREENS_FORWARD(j) { stuff->id = win->info[j].id; result = (*SavedProcVector[X_MapWindow])(client); if(result != Success) break; } return (result); } int PanoramiXMapSubwindows(ClientPtr client) { PanoramiXRes *win; int result = 0, j; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->id, XRT_WINDOW, DixReadAccess))) return BadWindow; FOR_NSCREENS_FORWARD(j) { stuff->id = win->info[j].id; result = (*SavedProcVector[X_MapSubwindows])(client); if(result != Success) break; } return (result); } int PanoramiXUnmapWindow(ClientPtr client) { PanoramiXRes *win; int result = 0, j; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->id, XRT_WINDOW, DixReadAccess))) return BadWindow; FOR_NSCREENS_FORWARD(j) { stuff->id = win->info[j].id; result = (*SavedProcVector[X_UnmapWindow])(client); if(result != Success) break; } return (result); } int PanoramiXUnmapSubwindows(ClientPtr client) { PanoramiXRes *win; int result = 0, j; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->id, XRT_WINDOW, DixReadAccess))) return BadWindow; FOR_NSCREENS_FORWARD(j) { stuff->id = win->info[j].id; result = (*SavedProcVector[X_UnmapSubwindows])(client); if(result != Success) break; } return (result); } int PanoramiXConfigureWindow(ClientPtr client) { PanoramiXRes *win; PanoramiXRes *sib = NULL; WindowPtr pWin; int result = 0, j, len, sib_offset = 0, x = 0, y = 0; int x_offset = -1; int y_offset = -1; REQUEST(xConfigureWindowReq); REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); len = client->req_len - (sizeof(xConfigureWindowReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; /* because we need the parent */ if (!(pWin = (WindowPtr)SecurityLookupIDByType( client, stuff->window, RT_WINDOW, DixWriteAccess))) return BadWindow; if (!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->window, XRT_WINDOW, DixWriteAccess))) return BadWindow; if ((Mask)stuff->mask & CWSibling) { XID tmp; sib_offset = Ones((Mask)stuff->mask & (CWSibling - 1)); if ((tmp = *((CARD32 *) &stuff[1] + sib_offset))) { if(!(sib = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_WINDOW, DixReadAccess))) return BadWindow; } } if(pWin->parent && ((pWin->parent == screenInfo.screens[0]->root) || (pWin->parent->drawable.id == savedScreenInfo[0].wid))) { if ((Mask)stuff->mask & CWX) { x_offset = 0; x = *((CARD32 *)&stuff[1]); } if ((Mask)stuff->mask & CWY) { y_offset = (x_offset == -1) ? 0 : 1; y = *((CARD32 *) &stuff[1] + y_offset); } } /* have to go forward or you get expose events before ConfigureNotify events */ FOR_NSCREENS_FORWARD(j) { stuff->window = win->info[j].id; if(sib) *((CARD32 *) &stuff[1] + sib_offset) = sib->info[j].id; if(x_offset >= 0) *((CARD32 *) &stuff[1] + x_offset) = x - panoramiXdataPtr[j].x; if(y_offset >= 0) *((CARD32 *) &stuff[1] + y_offset) = y - panoramiXdataPtr[j].y; result = (*SavedProcVector[X_ConfigureWindow])(client); if(result != Success) break; } return (result); } int PanoramiXCirculateWindow(ClientPtr client) { PanoramiXRes *win; int result = 0, j; REQUEST(xCirculateWindowReq); REQUEST_SIZE_MATCH(xCirculateWindowReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->window, XRT_WINDOW, DixWriteAccess))) return BadWindow; FOR_NSCREENS_FORWARD(j) { stuff->window = win->info[j].id; result = (*SavedProcVector[X_CirculateWindow])(client); if(result != Success) break; } return (result); } int PanoramiXGetGeometry(ClientPtr client) { xGetGeometryReply rep; DrawablePtr pDraw; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); VERIFY_GEOMETRABLE (pDraw, stuff->id, client); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.root = screenInfo.screens[0]->root->drawable.id; rep.depth = pDraw->depth; rep.width = pDraw->width; rep.height = pDraw->height; rep.x = rep.y = rep.borderWidth = 0; if (stuff->id == rep.root) { xWindowRoot *root = (xWindowRoot *) (ConnectionInfo + connBlockScreenStart); rep.width = root->pixWidth; rep.height = root->pixHeight; } else if ((pDraw->type == UNDRAWABLE_WINDOW) || (pDraw->type == DRAWABLE_WINDOW)) { WindowPtr pWin = (WindowPtr)pDraw; rep.x = pWin->origin.x - wBorderWidth (pWin); rep.y = pWin->origin.y - wBorderWidth (pWin); if((pWin->parent == screenInfo.screens[0]->root) || (pWin->parent->drawable.id == savedScreenInfo[0].wid)) { rep.x += panoramiXdataPtr[0].x; rep.y += panoramiXdataPtr[0].y; } rep.borderWidth = pWin->borderWidth; } WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep); return (client->noClientException); } int PanoramiXTranslateCoords(ClientPtr client) { INT16 x, y; REQUEST(xTranslateCoordsReq); WindowPtr pWin, pDst; xTranslateCoordsReply rep; REQUEST_SIZE_MATCH(xTranslateCoordsReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, DixReadAccess); if (!pWin) return(BadWindow); pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, DixReadAccess); if (!pDst) return(BadWindow); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.sameScreen = xTrue; rep.child = None; if((pWin == screenInfo.screens[0]->root) || (pWin->drawable.id == savedScreenInfo[0].wid)) { x = stuff->srcX - panoramiXdataPtr[0].x; y = stuff->srcY - panoramiXdataPtr[0].y; } else { x = pWin->drawable.x + stuff->srcX; y = pWin->drawable.y + stuff->srcY; } pWin = pDst->firstChild; while (pWin) { #ifdef SHAPE BoxRec box; #endif if ((pWin->mapped) && (x >= pWin->drawable.x - wBorderWidth (pWin)) && (x < pWin->drawable.x + (int)pWin->drawable.width + wBorderWidth (pWin)) && (y >= pWin->drawable.y - wBorderWidth (pWin)) && (y < pWin->drawable.y + (int)pWin->drawable.height + wBorderWidth (pWin)) #ifdef SHAPE /* When a window is shaped, a further check * is made to see if the point is inside * borderSize */ && (!wBoundingShape(pWin) || RegionContainsPoint( wBoundingShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box)) #endif ) { rep.child = pWin->drawable.id; pWin = (WindowPtr) NULL; } else pWin = pWin->nextSib; } rep.dstX = x - pDst->drawable.x; rep.dstY = y - pDst->drawable.y; if((pDst == screenInfo.screens[0]->root) || (pDst->drawable.id == savedScreenInfo[0].wid)) { rep.dstX += panoramiXdataPtr[0].x; rep.dstY += panoramiXdataPtr[0].y; } WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep); return(client->noClientException); } int PanoramiXCreatePixmap(ClientPtr client) { PanoramiXRes *refDraw, *newPix; int result = 0, j; REQUEST(xCreatePixmapReq); REQUEST_SIZE_MATCH(xCreatePixmapReq); client->errorValue = stuff->pid; if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixReadAccess))) return BadDrawable; if(!(newPix = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)))) return BadAlloc; newPix->type = XRT_PIXMAP; newPix->u.pix.shared = FALSE; newPix->info[0].id = stuff->pid; for(j = 1; j < PanoramiXNumScreens; j++) newPix->info[j].id = FakeClientID(client->index); FOR_NSCREENS_BACKWARD(j) { stuff->pid = newPix->info[j].id; stuff->drawable = refDraw->info[j].id; result = (*SavedProcVector[X_CreatePixmap])(client); if(result != Success) break; } if (result == Success) AddResource(newPix->info[0].id, XRT_PIXMAP, newPix); else free(newPix); return (result); } int PanoramiXFreePixmap(ClientPtr client) { PanoramiXRes *pix; int result = 0, j; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); client->errorValue = stuff->id; if(!(pix = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->id, XRT_PIXMAP, DixDestroyAccess))) return BadPixmap; FOR_NSCREENS_BACKWARD(j) { stuff->id = pix->info[j].id; result = (*SavedProcVector[X_FreePixmap])(client); if(result != Success) break; } /* Since ProcFreePixmap is using FreeResource, it will free our resource for us on the last pass through the loop above */ return (result); } int PanoramiXCreateGC(ClientPtr client) { PanoramiXRes *refDraw; PanoramiXRes *newGC; PanoramiXRes *stip = NULL; PanoramiXRes *tile = NULL; PanoramiXRes *clip = NULL; REQUEST(xCreateGCReq); int tile_offset = 0, stip_offset = 0, clip_offset = 0; int result = 0, len, j; XID tmp; REQUEST_AT_LEAST_SIZE(xCreateGCReq); client->errorValue = stuff->gc; len = client->req_len - (sizeof(xCreateGCReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; if (!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixReadAccess))) return BadDrawable; if ((Mask)stuff->mask & GCTile) { tile_offset = Ones((Mask)stuff->mask & (GCTile - 1)); if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) { if(!(tile = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } if ((Mask)stuff->mask & GCStipple) { stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1)); if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) { if(!(stip = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } if ((Mask)stuff->mask & GCClipMask) { clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1)); if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) { if(!(clip = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } if(!(newGC = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)))) return BadAlloc; newGC->type = XRT_GC; newGC->info[0].id = stuff->gc; for(j = 1; j < PanoramiXNumScreens; j++) newGC->info[j].id = FakeClientID(client->index); FOR_NSCREENS_BACKWARD(j) { stuff->gc = newGC->info[j].id; stuff->drawable = refDraw->info[j].id; if (tile) *((CARD32 *) &stuff[1] + tile_offset) = tile->info[j].id; if (stip) *((CARD32 *) &stuff[1] + stip_offset) = stip->info[j].id; if (clip) *((CARD32 *) &stuff[1] + clip_offset) = clip->info[j].id; result = (*SavedProcVector[X_CreateGC])(client); if(result != Success) break; } if (result == Success) AddResource(newGC->info[0].id, XRT_GC, newGC); else free(newGC); return (result); } int PanoramiXChangeGC(ClientPtr client) { PanoramiXRes *gc; PanoramiXRes *stip = NULL; PanoramiXRes *tile = NULL; PanoramiXRes *clip = NULL; REQUEST(xChangeGCReq); int tile_offset = 0, stip_offset = 0, clip_offset = 0; int result = 0, len, j; XID tmp; REQUEST_AT_LEAST_SIZE(xChangeGCReq); len = client->req_len - (sizeof(xChangeGCReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; if (!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; if ((Mask)stuff->mask & GCTile) { tile_offset = Ones((Mask)stuff->mask & (GCTile - 1)); if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) { if(!(tile = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } if ((Mask)stuff->mask & GCStipple) { stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1)); if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) { if(!(stip = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } if ((Mask)stuff->mask & GCClipMask) { clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1)); if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) { if(!(clip = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } FOR_NSCREENS_BACKWARD(j) { stuff->gc = gc->info[j].id; if (tile) *((CARD32 *) &stuff[1] + tile_offset) = tile->info[j].id; if (stip) *((CARD32 *) &stuff[1] + stip_offset) = stip->info[j].id; if (clip) *((CARD32 *) &stuff[1] + clip_offset) = clip->info[j].id; result = (*SavedProcVector[X_ChangeGC])(client); if(result != Success) break; } return (result); } int PanoramiXCopyGC(ClientPtr client) { PanoramiXRes *srcGC, *dstGC; int result = 0, j; REQUEST(xCopyGCReq); REQUEST_SIZE_MATCH(xCopyGCReq); if(!(srcGC = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->srcGC, XRT_GC, DixReadAccess))) return BadGC; if(!(dstGC = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->dstGC, XRT_GC, DixWriteAccess))) return BadGC; FOR_NSCREENS(j) { stuff->srcGC = srcGC->info[j].id; stuff->dstGC = dstGC->info[j].id; result = (*SavedProcVector[X_CopyGC])(client); if(result != Success) break; } return (result); } int PanoramiXSetDashes(ClientPtr client) { PanoramiXRes *gc; int result = 0, j; REQUEST(xSetDashesReq); REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixWriteAccess))) return BadGC; FOR_NSCREENS_BACKWARD(j) { stuff->gc = gc->info[j].id; result = (*SavedProcVector[X_SetDashes])(client); if(result != Success) break; } return (result); } int PanoramiXSetClipRectangles(ClientPtr client) { PanoramiXRes *gc; int result = 0, j; REQUEST(xSetClipRectanglesReq); REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixWriteAccess))) return BadGC; FOR_NSCREENS_BACKWARD(j) { stuff->gc = gc->info[j].id; result = (*SavedProcVector[X_SetClipRectangles])(client); if(result != Success) break; } return (result); } int PanoramiXFreeGC(ClientPtr client) { PanoramiXRes *gc; int result = 0, j; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->id, XRT_GC, DixDestroyAccess))) return BadGC; FOR_NSCREENS_BACKWARD(j) { stuff->id = gc->info[j].id; result = (*SavedProcVector[X_FreeGC])(client); if(result != Success) break; } /* Since ProcFreeGC is using FreeResource, it will free our resource for us on the last pass through the loop above */ return (result); } int PanoramiXClearToBackground(ClientPtr client) { PanoramiXRes *win; int result = 0, j, x, y; Bool isRoot; REQUEST(xClearAreaReq); REQUEST_SIZE_MATCH(xClearAreaReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->window, XRT_WINDOW, DixWriteAccess))) return BadWindow; x = stuff->x; y = stuff->y; isRoot = win->u.win.root; FOR_NSCREENS_BACKWARD(j) { stuff->window = win->info[j].id; if(isRoot) { stuff->x = x - panoramiXdataPtr[j].x; stuff->y = y - panoramiXdataPtr[j].y; } result = (*SavedProcVector[X_ClearArea])(client); if(result != Success) break; } return (result); } /* For Window to Pixmap copies you're screwed since each screen's pixmap will look like what it sees on its screen. Unless the screens overlap and the window lies on each, the two copies will be out of sync. To remedy this we do a GetImage and PutImage in place of the copy. Doing this as a single Image isn't quite correct since it will include the obscured areas but we will have to fix this later. (MArk). */ int PanoramiXCopyArea(ClientPtr client) { int j, result = 0, srcx, srcy, dstx, dsty; PanoramiXRes *gc, *src, *dst; Bool srcIsRoot = FALSE; Bool dstIsRoot = FALSE; Bool srcShared, dstShared; REQUEST(xCopyAreaReq); REQUEST_SIZE_MATCH(xCopyAreaReq); if(!(src = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->srcDrawable, XRC_DRAWABLE, DixReadAccess))) return BadDrawable; srcShared = IS_SHARED_PIXMAP(src); if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->dstDrawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; dstShared = IS_SHARED_PIXMAP(dst); if(dstShared && srcShared) return (* SavedProcVector[X_CopyArea])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; if((dst->type == XRT_WINDOW) && dst->u.win.root) dstIsRoot = TRUE; if((src->type == XRT_WINDOW) && src->u.win.root) srcIsRoot = TRUE; srcx = stuff->srcX; srcy = stuff->srcY; dstx = stuff->dstX; dsty = stuff->dstY; if((dst->type == XRT_PIXMAP) && (src->type == XRT_WINDOW)) { DrawablePtr drawables[MAXSCREENS]; DrawablePtr pDst; GCPtr pGC; char *data; int pitch; FOR_NSCREENS(j) VERIFY_DRAWABLE(drawables[j], src->info[j].id, client); pitch = PixmapBytePad(stuff->width, drawables[0]->depth); if(!(data = calloc(1, stuff->height * pitch))) return BadAlloc; XineramaGetImageData(drawables, srcx, srcy, stuff->width, stuff->height, ZPixmap, ~0, data, pitch, srcIsRoot); FOR_NSCREENS_BACKWARD(j) { stuff->gc = gc->info[j].id; VALIDATE_DRAWABLE_AND_GC(dst->info[j].id, pDst, pGC, client); if(drawables[0]->depth != pDst->depth) { client->errorValue = stuff->dstDrawable; free(data); return (BadMatch); } (*pGC->ops->PutImage) (pDst, pGC, pDst->depth, dstx, dsty, stuff->width, stuff->height, 0, ZPixmap, data); if(dstShared) break; } free(data); result = Success; } else { DrawablePtr pDst = NULL, pSrc = NULL; GCPtr pGC = NULL; RegionPtr pRgn[MAXSCREENS]; FOR_NSCREENS_BACKWARD(j) { stuff->dstDrawable = dst->info[j].id; stuff->srcDrawable = src->info[j].id; stuff->gc = gc->info[j].id; if (srcIsRoot) { stuff->srcX = srcx - panoramiXdataPtr[j].x; stuff->srcY = srcy - panoramiXdataPtr[j].y; } if (dstIsRoot) { stuff->dstX = dstx - panoramiXdataPtr[j].x; stuff->dstY = dsty - panoramiXdataPtr[j].y; } VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client); if (stuff->dstDrawable != stuff->srcDrawable) { SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client, DixReadAccess); if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) { client->errorValue = stuff->dstDrawable; return (BadMatch); } } else pSrc = pDst; pRgn[j] = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, stuff->srcX, stuff->srcY, stuff->width, stuff->height, stuff->dstX, stuff->dstY); if(dstShared) { while(j--) pRgn[j] = NULL; break; } } if(pGC->graphicsExposures) { ScreenPtr pScreen = pDst->pScreen; RegionRec totalReg; Bool overlap; RegionNull(&totalReg); FOR_NSCREENS_BACKWARD(j) { if(pRgn[j]) { if(srcIsRoot) { RegionTranslate(pRgn[j], panoramiXdataPtr[j].x, panoramiXdataPtr[j].y); } RegionAppend(&totalReg, pRgn[j]); RegionDestroy(pRgn[j]); } } RegionValidate(&totalReg, &overlap); (*pScreen->SendGraphicsExpose)( client, &totalReg, stuff->dstDrawable, X_CopyArea, 0); RegionUninit(&totalReg); } result = client->noClientException; } return (result); } int PanoramiXCopyPlane(ClientPtr client) { int j, srcx, srcy, dstx, dsty; PanoramiXRes *gc, *src, *dst; Bool srcIsRoot = FALSE; Bool dstIsRoot = FALSE; Bool srcShared, dstShared; DrawablePtr psrcDraw, pdstDraw = NULL; GCPtr pGC = NULL; RegionPtr pRgn[MAXSCREENS]; REQUEST(xCopyPlaneReq); REQUEST_SIZE_MATCH(xCopyPlaneReq); if(!(src = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->srcDrawable, XRC_DRAWABLE, DixReadAccess))) return BadDrawable; srcShared = IS_SHARED_PIXMAP(src); if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->dstDrawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; dstShared = IS_SHARED_PIXMAP(dst); if(dstShared && srcShared) return (* SavedProcVector[X_CopyPlane])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; if((dst->type == XRT_WINDOW) && dst->u.win.root) dstIsRoot = TRUE; if((src->type == XRT_WINDOW) && src->u.win.root) srcIsRoot = TRUE; srcx = stuff->srcX; srcy = stuff->srcY; dstx = stuff->dstX; dsty = stuff->dstY; FOR_NSCREENS_BACKWARD(j) { stuff->dstDrawable = dst->info[j].id; stuff->srcDrawable = src->info[j].id; stuff->gc = gc->info[j].id; if (srcIsRoot) { stuff->srcX = srcx - panoramiXdataPtr[j].x; stuff->srcY = srcy - panoramiXdataPtr[j].y; } if (dstIsRoot) { stuff->dstX = dstx - panoramiXdataPtr[j].x; stuff->dstY = dsty - panoramiXdataPtr[j].y; } VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client); if (stuff->dstDrawable != stuff->srcDrawable) { SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client, DixReadAccess); if (pdstDraw->pScreen != psrcDraw->pScreen) { client->errorValue = stuff->dstDrawable; return (BadMatch); } } else psrcDraw = pdstDraw; if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) || (stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) { client->errorValue = stuff->bitPlane; return(BadValue); } pRgn[j] = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC, stuff->srcX, stuff->srcY, stuff->width, stuff->height, stuff->dstX, stuff->dstY, stuff->bitPlane); if(dstShared) { while(j--) pRgn[j] = NULL; break; } } if(pGC->graphicsExposures) { ScreenPtr pScreen = pdstDraw->pScreen; RegionRec totalReg; Bool overlap; RegionNull(&totalReg); FOR_NSCREENS_BACKWARD(j) { if(pRgn[j]) { RegionAppend(&totalReg, pRgn[j]); RegionDestroy(pRgn[j]); } } RegionValidate(&totalReg, &overlap); (*pScreen->SendGraphicsExpose)( client, &totalReg, stuff->dstDrawable, X_CopyPlane, 0); RegionUninit(&totalReg); } return (client->noClientException); } int PanoramiXPolyPoint(ClientPtr client) { PanoramiXRes *gc, *draw; int result = 0, npoint, j; xPoint *origPts; Bool isRoot; REQUEST(xPolyPointReq); REQUEST_AT_LEAST_SIZE(xPolyPointReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyPoint])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2; if (npoint > 0) { origPts = (xPoint *) malloc(npoint * sizeof(xPoint)); memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint)); FOR_NSCREENS_FORWARD(j){ if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint)); if (isRoot) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { xPoint *pnts = (xPoint*)&stuff[1]; int i = (stuff->coordMode==CoordModePrevious) ? 1 : npoint; while(i--) { pnts->x -= x_off; pnts->y -= y_off; pnts++; } } } stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; result = (* SavedProcVector[X_PolyPoint])(client); if(result != Success) break; } free(origPts); return (result); } else return (client->noClientException); } int PanoramiXPolyLine(ClientPtr client) { PanoramiXRes *gc, *draw; int result = 0, npoint, j; xPoint *origPts; Bool isRoot; REQUEST(xPolyLineReq); REQUEST_AT_LEAST_SIZE(xPolyLineReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyLine])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2; if (npoint > 0){ origPts = (xPoint *) malloc(npoint * sizeof(xPoint)); memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint)); FOR_NSCREENS_FORWARD(j){ if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint)); if (isRoot) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { xPoint *pnts = (xPoint*)&stuff[1]; int i = (stuff->coordMode==CoordModePrevious) ? 1 : npoint; while(i--) { pnts->x -= x_off; pnts->y -= y_off; pnts++; } } } stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; result = (* SavedProcVector[X_PolyLine])(client); if(result != Success) break; } free(origPts); return (result); } else return (client->noClientException); } int PanoramiXPolySegment(ClientPtr client) { int result = 0, nsegs, i, j; PanoramiXRes *gc, *draw; xSegment *origSegs; Bool isRoot; REQUEST(xPolySegmentReq); REQUEST_AT_LEAST_SIZE(xPolySegmentReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolySegment])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq); if(nsegs & 4) return BadLength; nsegs >>= 3; if (nsegs > 0) { origSegs = (xSegment *) malloc(nsegs * sizeof(xSegment)); memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment)); FOR_NSCREENS_FORWARD(j){ if(j) memcpy(&stuff[1], origSegs, nsegs * sizeof(xSegment)); if (isRoot) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { xSegment *segs = (xSegment*)&stuff[1]; for (i = nsegs; i--; segs++) { segs->x1 -= x_off; segs->x2 -= x_off; segs->y1 -= y_off; segs->y2 -= y_off; } } } stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; result = (* SavedProcVector[X_PolySegment])(client); if(result != Success) break; } free(origSegs); return (result); } else return (client->noClientException); } int PanoramiXPolyRectangle(ClientPtr client) { int result = 0, nrects, i, j; PanoramiXRes *gc, *draw; Bool isRoot; xRectangle *origRecs; REQUEST(xPolyRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyRectangleReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyRectangle])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq); if(nrects & 4) return BadLength; nrects >>= 3; if (nrects > 0){ origRecs = (xRectangle *) malloc(nrects * sizeof(xRectangle)); memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle)); FOR_NSCREENS_FORWARD(j){ if(j) memcpy(&stuff[1], origRecs, nrects * sizeof(xRectangle)); if (isRoot) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { xRectangle *rects = (xRectangle *) &stuff[1]; for (i = nrects; i--; rects++) { rects->x -= x_off; rects->y -= y_off; } } } stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; result = (* SavedProcVector[X_PolyRectangle])(client); if(result != Success) break; } free(origRecs); return (result); } else return (client->noClientException); } int PanoramiXPolyArc(ClientPtr client) { int result = 0, narcs, i, j; PanoramiXRes *gc, *draw; Bool isRoot; xArc *origArcs; REQUEST(xPolyArcReq); REQUEST_AT_LEAST_SIZE(xPolyArcReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyArc])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; narcs = (client->req_len << 2) - sizeof(xPolyArcReq); if(narcs % sizeof(xArc)) return BadLength; narcs /= sizeof(xArc); if (narcs > 0){ origArcs = (xArc *) malloc(narcs * sizeof(xArc)); memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc)); FOR_NSCREENS_FORWARD(j){ if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc)); if (isRoot) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { xArc *arcs = (xArc *) &stuff[1]; for (i = narcs; i--; arcs++) { arcs->x -= x_off; arcs->y -= y_off; } } } stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; result = (* SavedProcVector[X_PolyArc])(client); if(result != Success) break; } free(origArcs); return (result); } else return (client->noClientException); } int PanoramiXFillPoly(ClientPtr client) { int result = 0, count, j; PanoramiXRes *gc, *draw; Bool isRoot; DDXPointPtr locPts; REQUEST(xFillPolyReq); REQUEST_AT_LEAST_SIZE(xFillPolyReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_FillPoly])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; count = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2; if (count > 0){ locPts = (DDXPointPtr) malloc(count * sizeof(DDXPointRec)); memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec)); FOR_NSCREENS_FORWARD(j){ if(j) memcpy(&stuff[1], locPts, count * sizeof(DDXPointRec)); if (isRoot) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { DDXPointPtr pnts = (DDXPointPtr)&stuff[1]; int i = (stuff->coordMode==CoordModePrevious) ? 1 : count; while(i--) { pnts->x -= x_off; pnts->y -= y_off; pnts++; } } } stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; result = (* SavedProcVector[X_FillPoly])(client); if(result != Success) break; } free(locPts); return (result); } else return (client->noClientException); } int PanoramiXPolyFillRectangle(ClientPtr client) { int result = 0, things, i, j; PanoramiXRes *gc, *draw; Bool isRoot; xRectangle *origRects; REQUEST(xPolyFillRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyFillRectangle])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq); if(things & 4) return BadLength; things >>= 3; if (things > 0){ origRects = (xRectangle *) malloc(things * sizeof(xRectangle)); memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle)); FOR_NSCREENS_FORWARD(j){ if(j) memcpy(&stuff[1], origRects, things * sizeof(xRectangle)); if (isRoot) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { xRectangle *rects = (xRectangle *) &stuff[1]; for (i = things; i--; rects++) { rects->x -= x_off; rects->y -= y_off; } } } stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; result = (* SavedProcVector[X_PolyFillRectangle])(client); if(result != Success) break; } free(origRects); return (result); } else return (client->noClientException); } int PanoramiXPolyFillArc(ClientPtr client) { PanoramiXRes *gc, *draw; Bool isRoot; int result = 0, narcs, i, j; xArc *origArcs; REQUEST(xPolyFillArcReq); REQUEST_AT_LEAST_SIZE(xPolyFillArcReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyFillArc])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq); IF_RETURN((narcs % sizeof(xArc)), BadLength); narcs /= sizeof(xArc); if (narcs > 0) { origArcs = (xArc *) malloc(narcs * sizeof(xArc)); memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc)); FOR_NSCREENS_FORWARD(j){ if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc)); if (isRoot) { int x_off = panoramiXdataPtr[j].x; int y_off = panoramiXdataPtr[j].y; if(x_off || y_off) { xArc *arcs = (xArc *) &stuff[1]; for (i = narcs; i--; arcs++) { arcs->x -= x_off; arcs->y -= y_off; } } } stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; result = (* SavedProcVector[X_PolyFillArc])(client); if(result != Success) break; } free(origArcs); return (result); } else return (client->noClientException); } int PanoramiXPutImage(ClientPtr client) { PanoramiXRes *gc, *draw; Bool isRoot; int j, result = 0, orig_x, orig_y; REQUEST(xPutImageReq); REQUEST_AT_LEAST_SIZE(xPutImageReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PutImage])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; orig_x = stuff->dstX; orig_y = stuff->dstY; FOR_NSCREENS_BACKWARD(j){ if (isRoot) { stuff->dstX = orig_x - panoramiXdataPtr[j].x; stuff->dstY = orig_y - panoramiXdataPtr[j].y; } stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; result = (* SavedProcVector[X_PutImage])(client); if(result != Success) break; } return (result); } int PanoramiXGetImage(ClientPtr client) { DrawablePtr drawables[MAXSCREENS]; DrawablePtr pDraw; PanoramiXRes *draw; xGetImageReply xgi; Bool isRoot; char *pBuf; int i, x, y, w, h, format; Mask plane = 0, planemask; int linesDone, nlines, linesPerBuf; long widthBytesLine, length; REQUEST(xGetImageReq); REQUEST_SIZE_MATCH(xGetImageReq); if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) { client->errorValue = stuff->format; return(BadValue); } if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(draw->type == XRT_PIXMAP) return (*SavedProcVector[X_GetImage])(client); VERIFY_DRAWABLE(pDraw, stuff->drawable, client); if(!((WindowPtr)pDraw)->realized) return(BadMatch); x = stuff->x; y = stuff->y; w = stuff->width; h = stuff->height; format = stuff->format; planemask = stuff->planeMask; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; if(isRoot) { if( /* check for being onscreen */ x < 0 || x + w > PanoramiXPixWidth || y < 0 || y + h > PanoramiXPixHeight ) return(BadMatch); } else { if( /* check for being onscreen */ panoramiXdataPtr[0].x + pDraw->x + x < 0 || panoramiXdataPtr[0].x + pDraw->x + x + w > PanoramiXPixWidth || panoramiXdataPtr[0].y + pDraw->y + y < 0 || panoramiXdataPtr[0].y + pDraw->y + y + h > PanoramiXPixHeight || /* check for being inside of border */ x < - wBorderWidth((WindowPtr)pDraw) || x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width || y < -wBorderWidth((WindowPtr)pDraw) || y + h > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height) return(BadMatch); } drawables[0] = pDraw; for(i = 1; i < PanoramiXNumScreens; i++) VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client); xgi.visual = wVisual (((WindowPtr) pDraw)); xgi.type = X_Reply; xgi.sequenceNumber = client->sequence; xgi.depth = pDraw->depth; if(format == ZPixmap) { widthBytesLine = PixmapBytePad(w, pDraw->depth); length = widthBytesLine * h; } else { widthBytesLine = BitmapBytePad(w); plane = ((Mask)1) << (pDraw->depth - 1); /* only planes asked for */ length = widthBytesLine * h * Ones(planemask & (plane | (plane - 1))); } xgi.length = (length + 3) >> 2; if (widthBytesLine == 0 || h == 0) linesPerBuf = 0; else if (widthBytesLine >= XINERAMA_IMAGE_BUFSIZE) linesPerBuf = 1; else { linesPerBuf = XINERAMA_IMAGE_BUFSIZE / widthBytesLine; if (linesPerBuf > h) linesPerBuf = h; } length = linesPerBuf * widthBytesLine; if(!(pBuf = malloc(length))) return (BadAlloc); WriteReplyToClient(client, sizeof (xGetImageReply), &xgi); if (linesPerBuf == 0) { /* nothing to do */ } else if (format == ZPixmap) { linesDone = 0; while (h - linesDone > 0) { nlines = min(linesPerBuf, h - linesDone); if(pDraw->depth == 1) bzero(pBuf, nlines * widthBytesLine); XineramaGetImageData(drawables, x, y + linesDone, w, nlines, format, planemask, pBuf, widthBytesLine, isRoot); WriteToClient(client, (int)(nlines * widthBytesLine), pBuf); linesDone += nlines; } } else { /* XYPixmap */ for (; plane; plane >>= 1) { if (planemask & plane) { linesDone = 0; while (h - linesDone > 0) { nlines = min(linesPerBuf, h - linesDone); bzero(pBuf, nlines * widthBytesLine); XineramaGetImageData(drawables, x, y + linesDone, w, nlines, format, plane, pBuf, widthBytesLine, isRoot); WriteToClient(client, (int)(nlines * widthBytesLine), pBuf); linesDone += nlines; } } } } free(pBuf); return (client->noClientException); } /* The text stuff should be rewritten so that duplication happens at the GlyphBlt level. That is, loading the font and getting the glyphs should only happen once */ int PanoramiXPolyText8(ClientPtr client) { PanoramiXRes *gc, *draw; Bool isRoot; int result = 0, j; int orig_x, orig_y; REQUEST(xPolyTextReq); REQUEST_AT_LEAST_SIZE(xPolyTextReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyText8])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; orig_x = stuff->x; orig_y = stuff->y; FOR_NSCREENS_BACKWARD(j){ stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; if (isRoot) { stuff->x = orig_x - panoramiXdataPtr[j].x; stuff->y = orig_y - panoramiXdataPtr[j].y; } result = (*SavedProcVector[X_PolyText8])(client); if(result != Success) break; } return (result); } int PanoramiXPolyText16(ClientPtr client) { PanoramiXRes *gc, *draw; Bool isRoot; int result = 0, j; int orig_x, orig_y; REQUEST(xPolyTextReq); REQUEST_AT_LEAST_SIZE(xPolyTextReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyText16])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; orig_x = stuff->x; orig_y = stuff->y; FOR_NSCREENS_BACKWARD(j){ stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; if (isRoot) { stuff->x = orig_x - panoramiXdataPtr[j].x; stuff->y = orig_y - panoramiXdataPtr[j].y; } result = (*SavedProcVector[X_PolyText16])(client); if(result != Success) break; } return (result); } int PanoramiXImageText8(ClientPtr client) { int result = 0, j; PanoramiXRes *gc, *draw; Bool isRoot; int orig_x, orig_y; REQUEST(xImageTextReq); REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_ImageText8])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; orig_x = stuff->x; orig_y = stuff->y; FOR_NSCREENS_BACKWARD(j){ stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; if (isRoot) { stuff->x = orig_x - panoramiXdataPtr[j].x; stuff->y = orig_y - panoramiXdataPtr[j].y; } result = (*SavedProcVector[X_ImageText8])(client); if(result != Success) break; } return (result); } int PanoramiXImageText16(ClientPtr client) { int result = 0, j; PanoramiXRes *gc, *draw; Bool isRoot; int orig_x, orig_y; REQUEST(xImageTextReq); REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_ImageText16])(client); if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; orig_x = stuff->x; orig_y = stuff->y; FOR_NSCREENS_BACKWARD(j){ stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; if (isRoot) { stuff->x = orig_x - panoramiXdataPtr[j].x; stuff->y = orig_y - panoramiXdataPtr[j].y; } result = (*SavedProcVector[X_ImageText16])(client); if(result != Success) break; } return (result); } int PanoramiXCreateColormap(ClientPtr client) { PanoramiXRes *win, *newCmap; int result = 0, j, orig_visual; REQUEST(xCreateColormapReq); REQUEST_SIZE_MATCH(xCreateColormapReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->window, XRT_WINDOW, DixReadAccess))) return BadWindow; if(!stuff->visual || (stuff->visual > 255)) return BadValue; if(!(newCmap = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)))) return BadAlloc; newCmap->type = XRT_COLORMAP; newCmap->info[0].id = stuff->mid; for(j = 1; j < PanoramiXNumScreens; j++) newCmap->info[j].id = FakeClientID(client->index); orig_visual = stuff->visual; FOR_NSCREENS_BACKWARD(j){ stuff->mid = newCmap->info[j].id; stuff->window = win->info[j].id; stuff->visual = PanoramiXVisualTable[(orig_visual * MAXSCREENS) + j]; result = (* SavedProcVector[X_CreateColormap])(client); if(result != Success) break; } if (result == Success) AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap); else free(newCmap); return (result); } int PanoramiXFreeColormap(ClientPtr client) { PanoramiXRes *cmap; int result = 0, j; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); client->errorValue = stuff->id; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->id, XRT_COLORMAP, DixDestroyAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j) { stuff->id = cmap->info[j].id; result = (* SavedProcVector[X_FreeColormap])(client); if(result != Success) break; } /* Since ProcFreeColormap is using FreeResource, it will free our resource for us on the last pass through the loop above */ return (result); } int PanoramiXCopyColormapAndFree(ClientPtr client) { PanoramiXRes *cmap, *newCmap; int result = 0, j; REQUEST(xCopyColormapAndFreeReq); REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq); client->errorValue = stuff->srcCmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->srcCmap, XRT_COLORMAP, DixReadAccess | DixWriteAccess))) return BadColor; if(!(newCmap = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)))) return BadAlloc; newCmap->type = XRT_COLORMAP; newCmap->info[0].id = stuff->mid; for(j = 1; j < PanoramiXNumScreens; j++) newCmap->info[j].id = FakeClientID(client->index); FOR_NSCREENS_BACKWARD(j){ stuff->srcCmap = cmap->info[j].id; stuff->mid = newCmap->info[j].id; result = (* SavedProcVector[X_CopyColormapAndFree])(client); if(result != Success) break; } if (result == Success) AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap); else free(newCmap); return (result); } int PanoramiXInstallColormap(ClientPtr client) { REQUEST(xResourceReq); int result = 0, j; PanoramiXRes *cmap; REQUEST_SIZE_MATCH(xResourceReq); client->errorValue = stuff->id; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->id, XRT_COLORMAP, DixReadAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j){ stuff->id = cmap->info[j].id; result = (* SavedProcVector[X_InstallColormap])(client); if(result != Success) break; } return (result); } int PanoramiXUninstallColormap(ClientPtr client) { REQUEST(xResourceReq); int result = 0, j; PanoramiXRes *cmap; REQUEST_SIZE_MATCH(xResourceReq); client->errorValue = stuff->id; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->id, XRT_COLORMAP, DixReadAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j) { stuff->id = cmap->info[j].id; result = (* SavedProcVector[X_UninstallColormap])(client); if(result != Success) break; } return (result); } int PanoramiXAllocColor(ClientPtr client) { int result = 0, j; PanoramiXRes *cmap; REQUEST(xAllocColorReq); REQUEST_SIZE_MATCH(xAllocColorReq); client->errorValue = stuff->cmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; result = (* SavedProcVector[X_AllocColor])(client); if(result != Success) break; } return (result); } int PanoramiXAllocNamedColor(ClientPtr client) { int result = 0, j; PanoramiXRes *cmap; REQUEST(xAllocNamedColorReq); REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes); client->errorValue = stuff->cmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; result = (* SavedProcVector[X_AllocNamedColor])(client); if(result != Success) break; } return (result); } int PanoramiXAllocColorCells(ClientPtr client) { int result = 0, j; PanoramiXRes *cmap; REQUEST(xAllocColorCellsReq); REQUEST_SIZE_MATCH(xAllocColorCellsReq); client->errorValue = stuff->cmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; result = (* SavedProcVector[X_AllocColorCells])(client); if(result != Success) break; } return (result); } int PanoramiXAllocColorPlanes(ClientPtr client) { int result = 0, j; PanoramiXRes *cmap; REQUEST(xAllocColorPlanesReq); REQUEST_SIZE_MATCH(xAllocColorPlanesReq); client->errorValue = stuff->cmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; result = (* SavedProcVector[X_AllocColorPlanes])(client); if(result != Success) break; } return (result); } int PanoramiXFreeColors(ClientPtr client) { int result = 0, j; PanoramiXRes *cmap; REQUEST(xFreeColorsReq); REQUEST_AT_LEAST_SIZE(xFreeColorsReq); client->errorValue = stuff->cmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j) { stuff->cmap = cmap->info[j].id; result = (* SavedProcVector[X_FreeColors])(client); } return (result); } int PanoramiXStoreColors(ClientPtr client) { int result = 0, j; PanoramiXRes *cmap; REQUEST(xStoreColorsReq); REQUEST_AT_LEAST_SIZE(xStoreColorsReq); client->errorValue = stuff->cmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; result = (* SavedProcVector[X_StoreColors])(client); if(result != Success) break; } return (result); } int PanoramiXStoreNamedColor(ClientPtr client) { int result = 0, j; PanoramiXRes *cmap; REQUEST(xStoreNamedColorReq); REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes); client->errorValue = stuff->cmap; if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) return BadColor; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; result = (* SavedProcVector[X_StoreNamedColor])(client); if(result != Success) break; } return (result); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/panoramiXsrv.h0000644000000000000000000000235313614532331020370 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _PANORAMIXSRV_H_ #define _PANORAMIXSRV_H_ #include "panoramiX.h" extern int PanoramiXNumScreens; extern PanoramiXData *panoramiXdataPtr; extern int PanoramiXPixWidth; extern int PanoramiXPixHeight; extern RegionRec PanoramiXScreenRegion; extern XID *PanoramiXVisualTable; extern void PanoramiXConsolidate(void); extern Bool PanoramiXCreateConnectionBlock(void); extern PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int); extern PanoramiXRes * PanoramiXFindIDOnAnyScreen(RESTYPE, XID); extern WindowPtr PanoramiXChangeWindow(int, WindowPtr); extern Bool XineramaRegisterConnectionBlockCallback(void (*func)(void)); extern int XineramaDeleteResource(void *, XID); extern void XineramaReinitData(ScreenPtr); extern RegionRec XineramaScreenRegions[MAXSCREENS]; extern unsigned long XRC_DRAWABLE; extern unsigned long XRT_WINDOW; extern unsigned long XRT_PIXMAP; extern unsigned long XRT_GC; extern unsigned long XRT_COLORMAP; extern void XineramaGetImageData( DrawablePtr *pDrawables, int left, int top, int width, int height, unsigned int format, unsigned long planemask, char *data, int pitch, Bool isRoot ); #endif /* _PANORAMIXSRV_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/panoramiXSwap.c0000644000000000000000000000763613614532331020474 0ustar /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "cursor.h" #include "cursorstr.h" #include "extnsionst.h" #include "dixstruct.h" #include "gc.h" #include "gcstruct.h" #include "scrnintstr.h" #include "window.h" #include "windowstr.h" #include "pixmapstr.h" #if 0 #include #include #endif #include "panoramiX.h" #include #include "panoramiXsrv.h" #include "globals.h" #include "panoramiXh.h" static int SProcPanoramiXQueryVersion (ClientPtr client) { REQUEST(xPanoramiXQueryVersionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq); return ProcPanoramiXQueryVersion(client); } static int SProcPanoramiXGetState(ClientPtr client) { REQUEST(xPanoramiXGetStateReq); swaps (&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); swapl (&stuff->window); return ProcPanoramiXGetState(client); } static int SProcPanoramiXGetScreenCount(ClientPtr client) { REQUEST(xPanoramiXGetScreenCountReq); swaps (&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); swapl (&stuff->window); return ProcPanoramiXGetScreenCount(client); } static int SProcPanoramiXGetScreenSize(ClientPtr client) { REQUEST(xPanoramiXGetScreenSizeReq); swaps (&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); swapl (&stuff->window); swapl (&stuff->screen); return ProcPanoramiXGetScreenSize(client); } static int SProcXineramaIsActive(ClientPtr client) { REQUEST(xXineramaIsActiveReq); swaps (&stuff->length); REQUEST_SIZE_MATCH(xXineramaIsActiveReq); return ProcXineramaIsActive(client); } static int SProcXineramaQueryScreens(ClientPtr client) { REQUEST(xXineramaQueryScreensReq); swaps (&stuff->length); REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); return ProcXineramaQueryScreens(client); } int SProcPanoramiXDispatch (ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_PanoramiXQueryVersion: return SProcPanoramiXQueryVersion(client); case X_PanoramiXGetState: return SProcPanoramiXGetState(client); case X_PanoramiXGetScreenCount: return SProcPanoramiXGetScreenCount(client); case X_PanoramiXGetScreenSize: return SProcPanoramiXGetScreenSize(client); case X_XineramaIsActive: return SProcXineramaIsActive(client); case X_XineramaQueryScreens: return SProcXineramaQueryScreens(client); } return BadRequest; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/saver.c0000644000000000000000000011303513614532331017012 0ustar /* * Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "os.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "extnsionst.h" #include "dixstruct.h" #include "resource.h" #include "opaque.h" #include #include "gcstruct.h" #include "cursorstr.h" #include "colormapst.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #endif #ifdef DPMSExtension #define DPMS_SERVER #include #endif #include #include "protocol-versions.h" #if 0 static unsigned char ScreenSaverReqCode = 0; #endif static int ScreenSaverEventBase = 0; static DISPATCH_PROC(ProcScreenSaverQueryInfo); static DISPATCH_PROC(ProcScreenSaverDispatch); static DISPATCH_PROC(ProcScreenSaverQueryVersion); static DISPATCH_PROC(ProcScreenSaverSelectInput); static DISPATCH_PROC(ProcScreenSaverSetAttributes); static DISPATCH_PROC(ProcScreenSaverUnsetAttributes); static DISPATCH_PROC(ProcScreenSaverSuspend); static DISPATCH_PROC(SProcScreenSaverDispatch); static DISPATCH_PROC(SProcScreenSaverQueryInfo); static DISPATCH_PROC(SProcScreenSaverQueryVersion); static DISPATCH_PROC(SProcScreenSaverSelectInput); static DISPATCH_PROC(SProcScreenSaverSetAttributes); static DISPATCH_PROC(SProcScreenSaverUnsetAttributes); static DISPATCH_PROC(SProcScreenSaverSuspend); static Bool ScreenSaverHandle ( ScreenPtr /* pScreen */, int /* xstate */, Bool /* force */ ); static Bool CreateSaverWindow ( ScreenPtr /* pScreen */ ); static Bool DestroySaverWindow ( ScreenPtr /* pScreen */ ); static void UninstallSaverColormap ( ScreenPtr /* pScreen */ ); static void CheckScreenPrivate ( ScreenPtr /* pScreen */ ); static void SScreenSaverNotifyEvent ( xScreenSaverNotifyEvent * /* from */, xScreenSaverNotifyEvent * /* to */ ); static void ScreenSaverResetProc ( ExtensionEntry * /* extEntry */ ); static RESTYPE SuspendType; /* resource type for suspension records */ typedef struct _ScreenSaverSuspension *ScreenSaverSuspensionPtr; /* List of clients that are suspending the screensaver. */ static ScreenSaverSuspensionPtr suspendingClients = NULL; /* * clientResource is a resource ID that's added when the record is * allocated, so the record is freed and the screensaver resumed when * the client disconnects. count is the number of times the client has * requested the screensaver be suspended. */ typedef struct _ScreenSaverSuspension { ScreenSaverSuspensionPtr next; ClientPtr pClient; XID clientResource; int count; } ScreenSaverSuspensionRec; static int ScreenSaverFreeSuspend( void * /*value */, XID /* id */ ); /* * each screen has a list of clients requesting * ScreenSaverNotify events. Each client has a resource * for each screen it selects ScreenSaverNotify input for, * this resource is used to delete the ScreenSaverNotifyRec * entry from the per-screen queue. */ static RESTYPE EventType; /* resource type for event masks */ typedef struct _ScreenSaverEvent *ScreenSaverEventPtr; typedef struct _ScreenSaverEvent { ScreenSaverEventPtr next; ClientPtr client; ScreenPtr screen; XID resource; CARD32 mask; } ScreenSaverEventRec; static int ScreenSaverFreeEvents( void * /* value */, XID /* id */ ); static Bool setEventMask ( ScreenPtr /* pScreen */, ClientPtr /* client */, unsigned long /* mask */ ); static unsigned long getEventMask ( ScreenPtr /* pScreen */, ClientPtr /* client */ ); /* * when a client sets the screen saver attributes, a resource is * kept to be freed when the client exits */ static RESTYPE AttrType; /* resource type for attributes */ typedef struct _ScreenSaverAttr { ScreenPtr screen; ClientPtr client; XID resource; short x, y; unsigned short width, height, borderWidth; unsigned char class; unsigned char depth; VisualID visual; CursorPtr pCursor; PixmapPtr pBackgroundPixmap; PixmapPtr pBorderPixmap; Colormap colormap; unsigned long mask; /* no pixmaps or cursors */ unsigned long *values; } ScreenSaverAttrRec, *ScreenSaverAttrPtr; static int ScreenSaverFreeAttr ( void * /* value */, XID /* id */ ); static void FreeAttrs ( ScreenSaverAttrPtr /* pAttr */ ); static void FreeScreenAttr ( ScreenSaverAttrPtr /* pAttr */ ); static void SendScreenSaverNotify ( ScreenPtr /* pScreen */, int /* state */, Bool /* forced */ ); typedef struct _ScreenSaverScreenPrivate { ScreenSaverEventPtr events; ScreenSaverAttrPtr attr; Bool hasWindow; Colormap installedMap; } ScreenSaverScreenPrivateRec, *ScreenSaverScreenPrivatePtr; static ScreenSaverScreenPrivatePtr MakeScreenPrivate ( ScreenPtr /* pScreen */ ); static int ScreenPrivateIndex; #define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr) #define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (void *) v); #define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL) #define New(t) ((t *) malloc (sizeof (t))) /**************** * ScreenSaverExtensionInit * * Called from InitExtensions in main() or from QueryExtension() if the * extension is dynamically loaded. * ****************/ void ScreenSaverExtensionInit(void) { ExtensionEntry *extEntry; int i; ScreenPtr pScreen; AttrType = CreateNewResourceType(ScreenSaverFreeAttr); EventType = CreateNewResourceType(ScreenSaverFreeEvents); SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend); ScreenPrivateIndex = AllocateScreenPrivateIndex (); for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; SetScreenPrivate (pScreen, NULL); } if (AttrType && EventType && SuspendType && ScreenPrivateIndex != -1 && (extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0, ProcScreenSaverDispatch, SProcScreenSaverDispatch, ScreenSaverResetProc, StandardMinorOpcode))) { #if 0 ScreenSaverReqCode = (unsigned char)extEntry->base; #endif ScreenSaverEventBase = extEntry->eventBase; EventSwapVector[ScreenSaverEventBase] = (EventSwapPtr) SScreenSaverNotifyEvent; } } /*ARGSUSED*/ static void ScreenSaverResetProc (extEntry) ExtensionEntry *extEntry; { } static void CheckScreenPrivate (pScreen) ScreenPtr pScreen; { SetupScreen (pScreen); if (!pPriv) return; if (!pPriv->attr && !pPriv->events && !pPriv->hasWindow && pPriv->installedMap == None) { free (pPriv); SetScreenPrivate (pScreen, NULL); savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL; } } static ScreenSaverScreenPrivatePtr MakeScreenPrivate (pScreen) ScreenPtr pScreen; { SetupScreen (pScreen); if (pPriv) return pPriv; pPriv = New (ScreenSaverScreenPrivateRec); if (!pPriv) return 0; pPriv->events = 0; pPriv->attr = 0; pPriv->hasWindow = FALSE; pPriv->installedMap = None; SetScreenPrivate (pScreen, pPriv); savedScreenInfo[pScreen->myNum].ExternalScreenSaver = ScreenSaverHandle; return pPriv; } static unsigned long getEventMask (pScreen, client) ScreenPtr pScreen; ClientPtr client; { SetupScreen(pScreen); ScreenSaverEventPtr pEv; if (!pPriv) return 0; for (pEv = pPriv->events; pEv; pEv = pEv->next) if (pEv->client == client) return pEv->mask; return 0; } static Bool setEventMask (pScreen, client, mask) ScreenPtr pScreen; ClientPtr client; unsigned long mask; { SetupScreen(pScreen); ScreenSaverEventPtr pEv, *pPrev; if (getEventMask (pScreen, client) == mask) return TRUE; if (!pPriv) { pPriv = MakeScreenPrivate (pScreen); if (!pPriv) return FALSE; } for (pPrev = &pPriv->events; (pEv = *pPrev) != 0; pPrev = &pEv->next) if (pEv->client == client) break; if (mask == 0) { FreeResource (pEv->resource, EventType); *pPrev = pEv->next; free (pEv); CheckScreenPrivate (pScreen); } else { if (!pEv) { pEv = New (ScreenSaverEventRec); if (!pEv) { CheckScreenPrivate (pScreen); return FALSE; } *pPrev = pEv; pEv->next = NULL; pEv->client = client; pEv->screen = pScreen; pEv->resource = FakeClientID (client->index); if (!AddResource (pEv->resource, EventType, (void *) pEv)) return FALSE; } pEv->mask = mask; } return TRUE; } static void FreeAttrs (pAttr) ScreenSaverAttrPtr pAttr; { PixmapPtr pPixmap; CursorPtr pCursor; if ((pPixmap = pAttr->pBackgroundPixmap) != 0) (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap); if ((pPixmap = pAttr->pBorderPixmap) != 0) (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap); if ((pCursor = pAttr->pCursor) != 0) FreeCursor (pCursor, (Cursor) 0); } static void FreeScreenAttr (pAttr) ScreenSaverAttrPtr pAttr; { FreeAttrs (pAttr); free (pAttr->values); free (pAttr); } static int ScreenSaverFreeEvents (value, id) void * value; XID id; { ScreenSaverEventPtr pOld = (ScreenSaverEventPtr)value; ScreenPtr pScreen = pOld->screen; SetupScreen (pScreen); ScreenSaverEventPtr pEv, *pPrev; if (!pPriv) return TRUE; for (pPrev = &pPriv->events; (pEv = *pPrev) != 0; pPrev = &pEv->next) if (pEv == pOld) break; if (!pEv) return TRUE; *pPrev = pEv->next; free (pEv); CheckScreenPrivate (pScreen); return TRUE; } static int ScreenSaverFreeAttr (value, id) void * value; XID id; { ScreenSaverAttrPtr pOldAttr = (ScreenSaverAttrPtr)value; ScreenPtr pScreen = pOldAttr->screen; SetupScreen (pScreen); if (!pPriv) return TRUE; if (pPriv->attr != pOldAttr) return TRUE; FreeScreenAttr (pOldAttr); pPriv->attr = NULL; if (pPriv->hasWindow) { SaveScreens (SCREEN_SAVER_FORCER, ScreenSaverReset); SaveScreens (SCREEN_SAVER_FORCER, ScreenSaverActive); } CheckScreenPrivate (pScreen); return TRUE; } static int ScreenSaverFreeSuspend (void * value, XID id) { ScreenSaverSuspensionPtr data = (ScreenSaverSuspensionPtr) value; ScreenSaverSuspensionPtr *prev, this; /* Unlink and free the suspension record for the client */ for (prev = &suspendingClients; (this = *prev); prev = &this->next) { if (this == data) { *prev = this->next; free (this); break; } } /* Reenable the screensaver if this was the last client suspending it. */ if (screenSaverSuspended && suspendingClients == NULL) { screenSaverSuspended = FALSE; /* The screensaver could be active, since suspending it (by design) doesn't prevent it from being forceably activated */ #ifdef DPMSExtension if (screenIsSaved != SCREEN_SAVER_ON && DPMSPowerLevel == DPMSModeOn) #else if (screenIsSaved != SCREEN_SAVER_ON) #endif { UpdateCurrentTimeIf(); lastDeviceEventTime = currentTime; SetScreenSaverTimer(); } } return Success; } static void SendScreenSaverNotify (pScreen, state, forced) ScreenPtr pScreen; int state; Bool forced; { ScreenSaverScreenPrivatePtr pPriv; ScreenSaverEventPtr pEv; unsigned long mask; xScreenSaverNotifyEvent ev; int kind; UpdateCurrentTimeIf (); mask = ScreenSaverNotifyMask; if (state == ScreenSaverCycle) mask = ScreenSaverCycleMask; pScreen = screenInfo.screens[pScreen->myNum]; pPriv = GetScreenPrivate(pScreen); if (!pPriv) return; if (pPriv->attr) kind = ScreenSaverExternal; else if (ScreenSaverBlanking != DontPreferBlanking) kind = ScreenSaverBlanked; else kind = ScreenSaverInternal; for (pEv = pPriv->events; pEv; pEv = pEv->next) { if (!(pEv->mask & mask)) continue; ev.type = ScreenSaverNotify + ScreenSaverEventBase; ev.state = state; ev.timestamp = currentTime.milliseconds; ev.root = pScreen->root->drawable.id; ev.window = savedScreenInfo[pScreen->myNum].wid; ev.kind = kind; ev.forced = forced; WriteEventsToClient (pEv->client, 1, (xEvent *) &ev); } } static void SScreenSaverNotifyEvent (from, to) xScreenSaverNotifyEvent *from, *to; { to->type = from->type; to->state = from->state; cpswaps (from->sequenceNumber, to->sequenceNumber); cpswapl (from->timestamp, to->timestamp); cpswapl (from->root, to->root); cpswapl (from->window, to->window); to->kind = from->kind; to->forced = from->forced; } static void UninstallSaverColormap (pScreen) ScreenPtr pScreen; { SetupScreen(pScreen); ColormapPtr pCmap; if (pPriv && pPriv->installedMap != None) { pCmap = (ColormapPtr) LookupIDByType (pPriv->installedMap, RT_COLORMAP); if (pCmap) (*pCmap->pScreen->UninstallColormap) (pCmap); pPriv->installedMap = None; CheckScreenPrivate (pScreen); } } static Bool CreateSaverWindow (pScreen) ScreenPtr pScreen; { SetupScreen (pScreen); ScreenSaverStuffPtr pSaver; ScreenSaverAttrPtr pAttr; WindowPtr pWin; int result; unsigned long mask; Colormap *installedMaps; int numInstalled; int i; Colormap wantMap; ColormapPtr pCmap; pSaver = &savedScreenInfo[pScreen->myNum]; if (pSaver->pWindow) { pSaver->pWindow = NullWindow; FreeResource (pSaver->wid, RT_NONE); if (pPriv) { UninstallSaverColormap (pScreen); pPriv->hasWindow = FALSE; CheckScreenPrivate (pScreen); } } if (!pPriv || !(pAttr = pPriv->attr)) return FALSE; pPriv->installedMap = None; if (GrabInProgress && GrabInProgress != pAttr->client->index) return FALSE; pWin = CreateWindow (pSaver->wid, pScreen->root, pAttr->x, pAttr->y, pAttr->width, pAttr->height, pAttr->borderWidth, pAttr->class, pAttr->mask, (XID *)pAttr->values, pAttr->depth, serverClient, pAttr->visual, &result); if (!pWin) return FALSE; if (!AddResource(pWin->drawable.id, RT_WINDOW, pWin)) return FALSE; mask = 0; if (pAttr->pBackgroundPixmap) { pWin->backgroundState = BackgroundPixmap; pWin->background.pixmap = pAttr->pBackgroundPixmap; pAttr->pBackgroundPixmap->refcnt++; mask |= CWBackPixmap; } if (pAttr->pBorderPixmap) { pWin->borderIsPixel = FALSE; pWin->border.pixmap = pAttr->pBorderPixmap; pAttr->pBorderPixmap->refcnt++; mask |= CWBorderPixmap; } if (pAttr->pCursor) { if (!pWin->optional) if (!MakeWindowOptional (pWin)) { FreeResource (pWin->drawable.id, RT_NONE); return FALSE; } if (pWin->optional->cursor) FreeCursor (pWin->optional->cursor, (Cursor)0); pWin->optional->cursor = pAttr->pCursor; pAttr->pCursor->refcnt++; pWin->cursorIsNone = FALSE; CheckWindowOptionalNeed (pWin); mask |= CWCursor; } if (mask) (*pScreen->ChangeWindowAttributes) (pWin, mask); if (pAttr->colormap != None) (void) ChangeWindowAttributes (pWin, CWColormap, &pAttr->colormap, serverClient); MapWindow (pWin, serverClient); pPriv->hasWindow = TRUE; pSaver->pWindow = pWin; /* check and install our own colormap if it isn't installed now */ wantMap = wColormap (pWin); if (wantMap == None) return TRUE; installedMaps = (Colormap *) malloc (pScreen->maxInstalledCmaps * sizeof (Colormap)); numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps) (pScreen, installedMaps); for (i = 0; i < numInstalled; i++) if (installedMaps[i] == wantMap) break; free ((char *) installedMaps); if (i < numInstalled) return TRUE; pCmap = (ColormapPtr) LookupIDByType (wantMap, RT_COLORMAP); if (!pCmap) return TRUE; pPriv->installedMap = wantMap; (*pCmap->pScreen->InstallColormap) (pCmap); return TRUE; } static Bool DestroySaverWindow (pScreen) ScreenPtr pScreen; { SetupScreen(pScreen); ScreenSaverStuffPtr pSaver; if (!pPriv || !pPriv->hasWindow) return FALSE; pSaver = &savedScreenInfo[pScreen->myNum]; if (pSaver->pWindow) { pSaver->pWindow = NullWindow; FreeResource (pSaver->wid, RT_NONE); } pPriv->hasWindow = FALSE; CheckScreenPrivate (pScreen); UninstallSaverColormap (pScreen); return TRUE; } static Bool ScreenSaverHandle (pScreen, xstate, force) ScreenPtr pScreen; int xstate; Bool force; { int state = 0; Bool ret = FALSE; ScreenSaverScreenPrivatePtr pPriv; switch (xstate) { case SCREEN_SAVER_ON: state = ScreenSaverOn; ret = CreateSaverWindow (pScreen); break; case SCREEN_SAVER_OFF: state = ScreenSaverOff; ret = DestroySaverWindow (pScreen); break; case SCREEN_SAVER_CYCLE: state = ScreenSaverCycle; pPriv = GetScreenPrivate (pScreen); if (pPriv && pPriv->hasWindow) ret = TRUE; } #ifdef PANORAMIX if(noPanoramiXExtension || !pScreen->myNum) #endif SendScreenSaverNotify (pScreen, state, force); return ret; } static int ProcScreenSaverQueryVersion (client) register ClientPtr client; { xScreenSaverQueryVersionReply rep; REQUEST_SIZE_MATCH (xScreenSaverQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = SERVER_SAVER_MAJOR_VERSION; rep.minorVersion = SERVER_SAVER_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); } WriteToClient(client, sizeof (xScreenSaverQueryVersionReply), &rep); return (client->noClientException); } static int ProcScreenSaverQueryInfo (client) register ClientPtr client; { REQUEST(xScreenSaverQueryInfoReq); xScreenSaverQueryInfoReply rep; ScreenSaverStuffPtr pSaver; DrawablePtr pDraw; CARD32 lastInput; ScreenSaverScreenPrivatePtr pPriv; REQUEST_SIZE_MATCH (xScreenSaverQueryInfoReq); pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); if (!pDraw) return BadDrawable; pSaver = &savedScreenInfo[pDraw->pScreen->myNum]; pPriv = GetScreenPrivate (pDraw->pScreen); UpdateCurrentTime (); lastInput = GetTimeInMillis() - lastDeviceEventTime.milliseconds; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.window = pSaver->wid; if (screenIsSaved != SCREEN_SAVER_OFF) { rep.state = ScreenSaverOn; if (ScreenSaverTime) rep.tilOrSince = lastInput - ScreenSaverTime; else rep.tilOrSince = 0; } else { if (ScreenSaverTime) { rep.state = ScreenSaverOff; if (ScreenSaverTime < lastInput) rep.tilOrSince = 0; else rep.tilOrSince = ScreenSaverTime - lastInput; } else { rep.state = ScreenSaverDisabled; rep.tilOrSince = 0; } } rep.idle = lastInput; rep.eventMask = getEventMask (pDraw->pScreen, client); if (pPriv && pPriv->attr) rep.kind = ScreenSaverExternal; else if (ScreenSaverBlanking != DontPreferBlanking) rep.kind = ScreenSaverBlanked; else rep.kind = ScreenSaverInternal; if (client->swapped) { swaps (&rep.sequenceNumber); swapl (&rep.length); swapl (&rep.window); swapl (&rep.tilOrSince); swapl (&rep.idle); swapl (&rep.eventMask); } WriteToClient(client, sizeof (xScreenSaverQueryInfoReply), &rep); return (client->noClientException); } static int ProcScreenSaverSelectInput (client) register ClientPtr client; { REQUEST(xScreenSaverSelectInputReq); DrawablePtr pDraw; REQUEST_SIZE_MATCH (xScreenSaverSelectInputReq); pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); if (!pDraw) return BadDrawable; if (!setEventMask (pDraw->pScreen, client, stuff->eventMask)) return BadAlloc; return Success; } static int ScreenSaverSetAttributes (ClientPtr client) { REQUEST(xScreenSaverSetAttributesReq); DrawablePtr pDraw; WindowPtr pParent; ScreenPtr pScreen; ScreenSaverScreenPrivatePtr pPriv = 0; ScreenSaverAttrPtr pAttr = 0; int ret, len, class, bw, depth; unsigned long visual; int idepth, ivisual; Bool fOK; DepthPtr pDepth; WindowOptPtr ancwopt; unsigned int *pVlist; unsigned long *values = 0; unsigned long tmask, imask; unsigned long val; Pixmap pixID; PixmapPtr pPixmap; Cursor cursorID; CursorPtr pCursor; Colormap cmap; ColormapPtr pCmap; REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq); pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); if (!pDraw) return BadDrawable; pScreen = pDraw->pScreen; pParent = pScreen->root; len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; if (!stuff->width || !stuff->height) { client->errorValue = 0; return BadValue; } switch (class = stuff->c_class) { case CopyFromParent: case InputOnly: case InputOutput: break; default: client->errorValue = class; return BadValue; } bw = stuff->borderWidth; depth = stuff->depth; visual = stuff->visualID; /* copied directly from CreateWindow */ if (class == CopyFromParent) class = pParent->drawable.class; if ((class != InputOutput) && (class != InputOnly)) { client->errorValue = class; return BadValue; } if ((class != InputOnly) && (pParent->drawable.class == InputOnly)) return BadMatch; if ((class == InputOnly) && ((bw != 0) || (depth != 0))) return BadMatch; if ((class == InputOutput) && (depth == 0)) depth = pParent->drawable.depth; ancwopt = pParent->optional; if (!ancwopt) ancwopt = FindWindowWithOptional(pParent)->optional; if (visual == CopyFromParent) visual = ancwopt->visual; /* Find out if the depth and visual are acceptable for this Screen */ if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth)) { fOK = FALSE; for(idepth = 0; idepth < pScreen->numDepths; idepth++) { pDepth = (DepthPtr) &pScreen->allowedDepths[idepth]; if ((depth == pDepth->depth) || (depth == 0)) { for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) { if (visual == pDepth->vids[ivisual]) { fOK = TRUE; break; } } } } if (fOK == FALSE) return BadMatch; } if (((stuff->mask & (CWBorderPixmap | CWBorderPixel)) == 0) && (class != InputOnly) && (depth != pParent->drawable.depth)) { return BadMatch; } if (((stuff->mask & CWColormap) == 0) && (class != InputOnly) && ((visual != ancwopt->visual) || (ancwopt->colormap == None))) { return BadMatch; } /* end of errors from CreateWindow */ pPriv = GetScreenPrivate (pScreen); if (pPriv && pPriv->attr) { if (pPriv->attr->client != client) return BadAccess; } if (!pPriv) { pPriv = MakeScreenPrivate (pScreen); if (!pPriv) return FALSE; } pAttr = New (ScreenSaverAttrRec); if (!pAttr) { ret = BadAlloc; goto bail; } /* over allocate for override redirect */ values = (unsigned long *) malloc ((len + 1) * sizeof (unsigned long)); if (!values) { ret = BadAlloc; goto bail; } pAttr->screen = pScreen; pAttr->client = client; pAttr->x = stuff->x; pAttr->y = stuff->y; pAttr->width = stuff->width; pAttr->height = stuff->height; pAttr->borderWidth = stuff->borderWidth; pAttr->class = stuff->c_class; pAttr->depth = depth; pAttr->visual = visual; pAttr->colormap = None; pAttr->pCursor = NullCursor; pAttr->pBackgroundPixmap = NullPixmap; pAttr->pBorderPixmap = NullPixmap; pAttr->values = values; /* * go through the mask, checking the values, * looking up pixmaps and cursors and hold a reference * to them. */ pAttr->mask = tmask = stuff->mask | CWOverrideRedirect; pVlist = (unsigned int *) (stuff + 1); while (tmask) { imask = lowbit (tmask); tmask &= ~imask; switch (imask) { case CWBackPixmap: pixID = (Pixmap )*pVlist; if (pixID == None) { *values++ = None; } else if (pixID == ParentRelative) { if (depth != pParent->drawable.depth) { ret = BadMatch; goto PatchUp; } *values++ = ParentRelative; } else { pPixmap = (PixmapPtr)LookupIDByType(pixID, RT_PIXMAP); if (pPixmap != (PixmapPtr) NULL) { if ((pPixmap->drawable.depth != depth) || (pPixmap->drawable.pScreen != pScreen)) { ret = BadMatch; goto PatchUp; } pAttr->pBackgroundPixmap = pPixmap; pPixmap->refcnt++; pAttr->mask &= ~CWBackPixmap; } else { ret = BadPixmap; client->errorValue = pixID; goto PatchUp; } } break; case CWBackPixel: *values++ = (CARD32) *pVlist; break; case CWBorderPixmap: pixID = (Pixmap ) *pVlist; if (pixID == CopyFromParent) { if (depth != pParent->drawable.depth) { ret = BadMatch; goto PatchUp; } *values++ = CopyFromParent; } else { pPixmap = (PixmapPtr)LookupIDByType(pixID, RT_PIXMAP); if (pPixmap) { if ((pPixmap->drawable.depth != depth) || (pPixmap->drawable.pScreen != pScreen)) { ret = BadMatch; goto PatchUp; } pAttr->pBorderPixmap = pPixmap; pPixmap->refcnt++; pAttr->mask &= ~CWBorderPixmap; } else { ret = BadPixmap; client->errorValue = pixID; goto PatchUp; } } break; case CWBorderPixel: *values++ = (CARD32) *pVlist; break; case CWBitGravity: val = (CARD8 )*pVlist; if (val > StaticGravity) { ret = BadValue; client->errorValue = val; goto PatchUp; } *values++ = val; break; case CWWinGravity: val = (CARD8 )*pVlist; if (val > StaticGravity) { ret = BadValue; client->errorValue = val; goto PatchUp; } *values++ = val; break; case CWBackingStore: val = (CARD8 )*pVlist; if ((val != NotUseful) && (val != WhenMapped) && (val != Always)) { ret = BadValue; client->errorValue = val; goto PatchUp; } *values++ = val; break; case CWBackingPlanes: *values++ = (CARD32) *pVlist; break; case CWBackingPixel: *values++ = (CARD32) *pVlist; break; case CWSaveUnder: val = (BOOL) *pVlist; if ((val != xTrue) && (val != xFalse)) { ret = BadValue; client->errorValue = val; goto PatchUp; } *values++ = val; break; case CWEventMask: *values++ = (CARD32) *pVlist; break; case CWDontPropagate: *values++ = (CARD32) *pVlist; break; case CWOverrideRedirect: if (!(stuff->mask & CWOverrideRedirect)) pVlist--; else { val = (BOOL ) *pVlist; if ((val != xTrue) && (val != xFalse)) { ret = BadValue; client->errorValue = val; goto PatchUp; } } *values++ = xTrue; break; case CWColormap: cmap = (Colormap) *pVlist; pCmap = (ColormapPtr)LookupIDByType(cmap, RT_COLORMAP); if (!pCmap) { ret = BadColor; client->errorValue = cmap; goto PatchUp; } if (pCmap->pVisual->vid != visual || pCmap->pScreen != pScreen) { ret = BadMatch; goto PatchUp; } pAttr->colormap = cmap; pAttr->mask &= ~CWColormap; break; case CWCursor: cursorID = (Cursor ) *pVlist; if ( cursorID == None) { *values++ = None; } else { pCursor = (CursorPtr)LookupIDByType(cursorID, RT_CURSOR); if (!pCursor) { ret = BadCursor; client->errorValue = cursorID; goto PatchUp; } pCursor->refcnt++; pAttr->pCursor = pCursor; pAttr->mask &= ~CWCursor; } break; default: ret = BadValue; client->errorValue = stuff->mask; goto PatchUp; } pVlist++; } if (pPriv->attr) FreeScreenAttr (pPriv->attr); pPriv->attr = pAttr; pAttr->resource = FakeClientID (client->index); if (!AddResource (pAttr->resource, AttrType, (void *) pAttr)) return BadAlloc; return Success; PatchUp: FreeAttrs (pAttr); bail: CheckScreenPrivate (pScreen); if (pAttr) free (pAttr->values); free (pAttr); return ret; } static int ScreenSaverUnsetAttributes (ClientPtr client) { REQUEST(xScreenSaverSetAttributesReq); DrawablePtr pDraw; ScreenSaverScreenPrivatePtr pPriv; REQUEST_SIZE_MATCH (xScreenSaverUnsetAttributesReq); pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); if (!pDraw) return BadDrawable; pPriv = GetScreenPrivate (pDraw->pScreen); if (pPriv && pPriv->attr && pPriv->attr->client == client) { FreeResource (pPriv->attr->resource, AttrType); FreeScreenAttr (pPriv->attr); pPriv->attr = NULL; CheckScreenPrivate (pDraw->pScreen); } return Success; } static int ProcScreenSaverSetAttributes (ClientPtr client) { #ifdef PANORAMIX if(!noPanoramiXExtension) { REQUEST(xScreenSaverSetAttributesReq); PanoramiXRes *draw; PanoramiXRes *backPix = NULL; PanoramiXRes *bordPix = NULL; PanoramiXRes *cmap = NULL; int i, status = 0, len; int pback_offset = 0, pbord_offset = 0, cmap_offset = 0; XID orig_visual, tmp; REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; if((Mask)stuff->mask & CWBackPixmap) { pback_offset = Ones((Mask)stuff->mask & (CWBackPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pback_offset); if ((tmp != None) && (tmp != ParentRelative)) { if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } if ((Mask)stuff->mask & CWBorderPixmap) { pbord_offset = Ones((Mask)stuff->mask & (CWBorderPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pbord_offset); if (tmp != CopyFromParent) { if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } } if ((Mask)stuff->mask & CWColormap) { cmap_offset = Ones((Mask)stuff->mask & (CWColormap - 1)); tmp = *((CARD32 *) &stuff[1] + cmap_offset); if ((tmp != CopyFromParent) && (tmp != None)) { if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType( client, tmp, XRT_COLORMAP, DixReadAccess))) return BadColor; } } orig_visual = stuff->visualID; FOR_NSCREENS_BACKWARD(i) { stuff->drawable = draw->info[i].id; if (backPix) *((CARD32 *) &stuff[1] + pback_offset) = backPix->info[i].id; if (bordPix) *((CARD32 *) &stuff[1] + pbord_offset) = bordPix->info[i].id; if (cmap) *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[i].id; if (orig_visual != CopyFromParent) stuff->visualID = PanoramiXVisualTable[(orig_visual*MAXSCREENS) + i]; status = ScreenSaverSetAttributes(client); } return status; } #endif return ScreenSaverSetAttributes(client); } static int ProcScreenSaverUnsetAttributes (ClientPtr client) { #ifdef PANORAMIX if(!noPanoramiXExtension) { REQUEST(xScreenSaverUnsetAttributesReq); PanoramiXRes *draw; int i; REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; for(i = PanoramiXNumScreens - 1; i > 0; i--) { stuff->drawable = draw->info[i].id; ScreenSaverUnsetAttributes(client); } stuff->drawable = draw->info[0].id; } #endif return ScreenSaverUnsetAttributes(client); } static int ProcScreenSaverSuspend (ClientPtr client) { ScreenSaverSuspensionPtr *prev, this; REQUEST(xScreenSaverSuspendReq); REQUEST_SIZE_MATCH(xScreenSaverSuspendReq); /* Check if this client is suspending the screensaver */ for (prev = &suspendingClients; (this = *prev); prev = &this->next) if (this->pClient == client) break; if (this) { if (stuff->suspend == TRUE) this->count++; else if (--this->count == 0) FreeResource (this->clientResource, RT_NONE); return Success; } /* If we get to this point, this client isn't suspending the screensaver */ if (stuff->suspend == FALSE) return Success; /* * Allocate a suspension record for the client, and stop the screensaver * if it isn't already suspended by another client. We attach a resource ID * to the record, so the screensaver will be reenabled and the record freed * if the client disconnects without reenabling it first. */ this = (ScreenSaverSuspensionPtr) malloc (sizeof (ScreenSaverSuspensionRec)); if (!this) return BadAlloc; memset(this, 0, sizeof (ScreenSaverSuspensionRec)); this->next = NULL; this->pClient = client; this->count = 1; this->clientResource = FakeClientID (client->index); if (!AddResource (this->clientResource, SuspendType, (void *) this)) { free (this); return BadAlloc; } *prev = this; if (!screenSaverSuspended) { screenSaverSuspended = TRUE; FreeScreenSaverTimer(); } return (client->noClientException); } static DISPATCH_PROC((*NormalVector[])) = { ProcScreenSaverQueryVersion, ProcScreenSaverQueryInfo, ProcScreenSaverSelectInput, ProcScreenSaverSetAttributes, ProcScreenSaverUnsetAttributes, ProcScreenSaverSuspend, }; #define NUM_REQUESTS ((sizeof NormalVector) / (sizeof NormalVector[0])) static int ProcScreenSaverDispatch (client) ClientPtr client; { REQUEST(xReq); if (stuff->data < NUM_REQUESTS) return (*NormalVector[stuff->data])(client); return BadRequest; } static int SProcScreenSaverQueryVersion (client) ClientPtr client; { REQUEST(xScreenSaverQueryVersionReq); swaps (&stuff->length); REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq); return ProcScreenSaverQueryVersion (client); } static int SProcScreenSaverQueryInfo (client) ClientPtr client; { REQUEST(xScreenSaverQueryInfoReq); swaps (&stuff->length); REQUEST_SIZE_MATCH(xScreenSaverQueryInfoReq); swapl (&stuff->drawable); return ProcScreenSaverQueryInfo (client); } static int SProcScreenSaverSelectInput (client) ClientPtr client; { REQUEST(xScreenSaverSelectInputReq); swaps (&stuff->length); REQUEST_SIZE_MATCH(xScreenSaverSelectInputReq); swapl (&stuff->drawable); swapl (&stuff->eventMask); return ProcScreenSaverSelectInput (client); } static int SProcScreenSaverSetAttributes (client) ClientPtr client; { REQUEST(xScreenSaverSetAttributesReq); swaps (&stuff->length); REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq); swapl (&stuff->drawable); swaps (&stuff->x); swaps (&stuff->y); swaps (&stuff->width); swaps (&stuff->height); swaps (&stuff->borderWidth); swapl (&stuff->visualID); swapl (&stuff->mask); SwapRestL(stuff); return ProcScreenSaverSetAttributes (client); } static int SProcScreenSaverUnsetAttributes (client) ClientPtr client; { REQUEST(xScreenSaverUnsetAttributesReq); swaps (&stuff->length); REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq); swapl (&stuff->drawable); return ProcScreenSaverUnsetAttributes (client); } static int SProcScreenSaverSuspend (ClientPtr client) { REQUEST(xScreenSaverSuspendReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xScreenSaverSuspendReq); swapl(&stuff->suspend); return ProcScreenSaverSuspend (client); } static DISPATCH_PROC((*SwappedVector[])) = { SProcScreenSaverQueryVersion, SProcScreenSaverQueryInfo, SProcScreenSaverSelectInput, SProcScreenSaverSetAttributes, SProcScreenSaverUnsetAttributes, SProcScreenSaverSuspend, }; static int SProcScreenSaverDispatch (client) ClientPtr client; { REQUEST(xReq); if (stuff->data < NUM_REQUESTS) return (*SwappedVector[stuff->data])(client); return BadRequest; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/security.c0000644000000000000000000015473013614532331017550 0ustar /**************************************************************************/ /* */ /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ /* Copyright (c) 2008-2014 Oleksandr Shneyder */ /* Copyright (c) 2011-2016 Mike Gabriel */ /* Copyright (c) 2014-2016 Mihai Moldovan */ /* Copyright (c) 2014-2016 Ulrich Sibiller */ /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ /* */ /* nx-X11, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /* NOTE: This software has received contributions from various other */ /* contributors, only the core maintainers and supporters are listed as */ /* copyright holders. Please contact us, if you feel you should be listed */ /* as copyright holder, as well. */ /* */ /**************************************************************************/ /* Copyright 1996, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "dixstruct.h" #include "extnsionst.h" #include "windowstr.h" #include "inputstr.h" #include "scrnintstr.h" #include "gcstruct.h" #include "colormapst.h" #include "propertyst.h" #include "protocol-versions.h" #define _SECURITY_SERVER #include #include #include #include /* for file reading operations */ #include /* for XA_STRING */ #ifdef NXAGENT_SERVER #include #include #include #include #endif #ifndef DEFAULTPOLICYFILE # define DEFAULTPOLICYFILE NULL #endif #ifdef NXAGENT_SERVER #define NX_ALTERNATIVEPOLICYFILE "/usr/local/share/nx/SecurityPolicy" #endif #if defined(WIN32) || defined(__CYGWIN__) #include #undef index #endif /* * Set here the required NX log level. */ #ifdef NXAGENT_SERVER #define PANIC #define WARNING #undef TEST #undef DEBUG #endif #ifdef NXAGENT_SERVER static char _NXPolicyFilePath[1024]; #endif static int SecurityErrorBase; /* first Security error number */ static int SecurityEventBase; /* first Security event number */ CallbackListPtr SecurityValidateGroupCallback = NULL; /* see security.h */ RESTYPE SecurityAuthorizationResType; /* resource type for authorizations */ static RESTYPE RTEventClient; /* Proc vectors for untrusted clients, swapped and unswapped versions. * These are the same as the normal proc vectors except that extensions * that haven't declared themselves secure will have ProcBadRequest plugged * in for their major opcode dispatcher. This prevents untrusted clients * from guessing extension major opcodes and using the extension even though * the extension can't be listed or queried. */ int (*UntrustedProcVector[256])( ClientPtr /*client*/ ); int (*SwappedUntrustedProcVector[256])( ClientPtr /*client*/ ); #ifdef NXAGENT_SERVER /* * This function returns the SecurityPolicy * file full path. This path is referred by * SecurityPolicyFile variable (generally it * contains the hardcoded path at compile time). * If the path does not exist, the function will * try a set of well known paths. */ char *_NXGetPolicyFilePath(const char *path) { struct stat SecurityPolicyStat; /* * Check the policy file path only once. */ if (*_NXPolicyFilePath != '\0') { return _NXPolicyFilePath; } if (stat(path, &SecurityPolicyStat) == 0) { if (strlen(path) + 1 > 1024) { #ifdef WARNING fprintf(stderr, "_NXGetPolicyFilePath: WARNING! Maximum length of SecurityPolicy file path exceeded.\n"); #endif goto _NXGetPolicyFilePathError; } strcpy(_NXPolicyFilePath, path); #ifdef TEST fprintf(stderr, "_NXGetPolicyFilePath: Using SecurityPolicy file path [%s].\n", _NXPolicyFilePath); #endif return _NXPolicyFilePath; } if (stat(DEFAULTPOLICYFILE, &SecurityPolicyStat) == 0) { if (strlen(DEFAULTPOLICYFILE) + 1 > 1024) { #ifdef WARNING fprintf(stderr, "_NXGetPolicyFilePath: WARNING! Maximum length of SecurityPolicy file path exceeded.\n"); #endif goto _NXGetPolicyFilePathError; } strcpy(_NXPolicyFilePath, DEFAULTPOLICYFILE); #ifdef TEST fprintf(stderr, "_NXGetPolicyFilePath: Using SecurityPolicy file path [%s].\n", _NXPolicyFilePath); #endif return _NXPolicyFilePath; } if (stat(NX_ALTERNATIVEPOLICYFILE, &SecurityPolicyStat) == 0) { if (strlen(NX_ALTERNATIVEPOLICYFILE) + 1 > 1024) { #ifdef WARNING fprintf(stderr, "_NXGetPolicyFilePath: WARNING! Maximum length of SecurityPolicy file path exceeded.\n"); #endif goto _NXGetPolicyFilePathError; } strcpy(_NXPolicyFilePath, NX_ALTERNATIVEPOLICYFILE); #ifdef TEST fprintf(stderr, "_NXGetPolicyFilePath: Using SecurityPolicy file path [%s].\n", _NXPolicyFilePath); #endif return _NXPolicyFilePath; } _NXGetPolicyFilePathError: if (strlen(path) + 1 > 1024) { #ifdef WARNING fprintf(stderr, "_NXGetPolicyFilePath: WARNING! Maximum length of SecurityPolicy file exceeded.\n"); #endif } strcpy(_NXPolicyFilePath, path); #ifdef TEST fprintf(stderr, "_NXGetPolicyFilePath: Using default SecurityPolicy file path [%s].\n", _NXPolicyFilePath); #endif return _NXPolicyFilePath; } #endif /* SecurityAudit * * Arguments: * format is the formatting string to be used to interpret the * remaining arguments. * * Returns: nothing. * * Side Effects: * Writes the message to the log file if security logging is on. */ void SecurityAudit(char *format, ...) { va_list args; if (auditTrailLevel < SECURITY_AUDIT_LEVEL) return; va_start(args, format); VAuditF(format, args); va_end(args); } /* SecurityAudit */ #define rClient(obj) (clients[CLIENT_ID((obj)->resource)]) /* SecurityDeleteAuthorization * * Arguments: * value is the authorization to delete. * id is its resource ID. * * Returns: Success. * * Side Effects: * Frees everything associated with the authorization. */ static int SecurityDeleteAuthorization( void * value, XID id) { SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value; unsigned short name_len, data_len; char *name, *data; int status; int i; OtherClientsPtr pEventClient; /* Remove the auth using the os layer auth manager */ status = AuthorizationFromID(pAuth->id, &name_len, &name, &data_len, &data); assert(status); status = RemoveAuthorization(name_len, name, data_len, data); assert(status); (void)status; /* free the auth timer if there is one */ if (pAuth->timer) TimerFree(pAuth->timer); /* send revoke events */ while ((pEventClient = pAuth->eventClients)) { /* send revocation event event */ xSecurityAuthorizationRevokedEvent are; are.type = SecurityEventBase + XSecurityAuthorizationRevoked; are.authId = pAuth->id; WriteEventsToClient(rClient(pEventClient), 1, (xEvent *)&are); FreeResource(pEventClient->resource, RT_NONE); } /* kill all clients using this auth */ for (i = 1; iauthId == pAuth->id)) CloseDownClient(clients[i]); } SecurityAudit("revoked authorization ID %d\n", pAuth->id); free(pAuth); return Success; } /* SecurityDeleteAuthorization */ /* resource delete function for RTEventClient */ static int SecurityDeleteAuthorizationEventClient( void * value, XID id) { OtherClientsPtr pEventClient, prev = NULL; SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value; for (pEventClient = pAuth->eventClients; pEventClient; pEventClient = pEventClient->next) { if (pEventClient->resource == id) { if (prev) prev->next = pEventClient->next; else pAuth->eventClients = pEventClient->next; free(pEventClient); return(Success); } prev = pEventClient; } /*NOTREACHED*/ return -1; /* make compiler happy */ } /* SecurityDeleteAuthorizationEventClient */ /* SecurityComputeAuthorizationTimeout * * Arguments: * pAuth is the authorization for which we are computing the timeout * seconds is the number of seconds we want to wait * * Returns: * the number of milliseconds that the auth timer should be set to * * Side Effects: * Sets pAuth->secondsRemaining to any "overflow" amount of time * that didn't fit in 32 bits worth of milliseconds */ static CARD32 SecurityComputeAuthorizationTimeout( SecurityAuthorizationPtr pAuth, unsigned int seconds) { /* maxSecs is the number of full seconds that can be expressed in * 32 bits worth of milliseconds */ CARD32 maxSecs = (CARD32)(~0) / (CARD32)MILLI_PER_SECOND; if (seconds > maxSecs) { /* only come here if we want to wait more than 49 days */ pAuth->secondsRemaining = seconds - maxSecs; return maxSecs * MILLI_PER_SECOND; } else { /* by far the common case */ pAuth->secondsRemaining = 0; return seconds * MILLI_PER_SECOND; } } /* SecurityStartAuthorizationTimer */ /* SecurityAuthorizationExpired * * This function is passed as an argument to TimerSet and gets called from * the timer manager in the os layer when its time is up. * * Arguments: * timer is the timer for this authorization. * time is the current time. * pval is the authorization whose time is up. * * Returns: * A new time delay in milliseconds if the timer should wait some * more, else zero. * * Side Effects: * Frees the authorization resource if the timeout period is really * over, otherwise recomputes pAuth->secondsRemaining. */ static CARD32 SecurityAuthorizationExpired( OsTimerPtr timer, CARD32 time, void * pval) { SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)pval; assert(pAuth->timer == timer); if (pAuth->secondsRemaining) { return SecurityComputeAuthorizationTimeout(pAuth, pAuth->secondsRemaining); } else { FreeResource(pAuth->id, RT_NONE); return 0; } } /* SecurityAuthorizationExpired */ /* SecurityStartAuthorizationTimer * * Arguments: * pAuth is the authorization whose timer should be started. * * Returns: nothing. * * Side Effects: * A timer is started, set to expire after the timeout period for * this authorization. When it expires, the function * SecurityAuthorizationExpired will be called. */ static void SecurityStartAuthorizationTimer( SecurityAuthorizationPtr pAuth) { pAuth->timer = TimerSet(pAuth->timer, 0, SecurityComputeAuthorizationTimeout(pAuth, pAuth->timeout), SecurityAuthorizationExpired, pAuth); } /* SecurityStartAuthorizationTimer */ /* Proc functions all take a client argument, execute the request in * client->requestBuffer, and return a protocol error status. */ static int ProcSecurityQueryVersion( ClientPtr client) { /* REQUEST(xSecurityQueryVersionReq); */ xSecurityQueryVersionReply rep; /* paranoia: this "can't happen" because this extension is hidden * from untrusted clients, but just in case... */ if (client->trustLevel != XSecurityClientTrusted) return BadRequest; REQUEST_SIZE_MATCH(xSecurityQueryVersionReq); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.majorVersion = SERVER_SECURITY_MAJOR_VERSION; rep.minorVersion = SERVER_SECURITY_MINOR_VERSION; if(client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.majorVersion); swaps(&rep.minorVersion); } WriteToClient(client, SIZEOF(xSecurityQueryVersionReply), &rep); return (client->noClientException); } /* ProcSecurityQueryVersion */ static int SecurityEventSelectForAuthorization( SecurityAuthorizationPtr pAuth, ClientPtr client, Mask mask) { OtherClients *pEventClient; for (pEventClient = pAuth->eventClients; pEventClient; pEventClient = pEventClient->next) { if (SameClient(pEventClient, client)) { if (mask == 0) FreeResource(pEventClient->resource, RT_NONE); else pEventClient->mask = mask; return Success; } } pEventClient = (OtherClients *) malloc(sizeof(OtherClients)); if (!pEventClient) return BadAlloc; pEventClient->mask = mask; pEventClient->resource = FakeClientID(client->index); pEventClient->next = pAuth->eventClients; if (!AddResource(pEventClient->resource, RTEventClient, (void *)pAuth)) { free(pEventClient); return BadAlloc; } pAuth->eventClients = pEventClient; return Success; } /* SecurityEventSelectForAuthorization */ static int ProcSecurityGenerateAuthorization( ClientPtr client) { REQUEST(xSecurityGenerateAuthorizationReq); int len; /* request length in CARD32s*/ Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */ SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */ int err; /* error to return from this function */ XID authId; /* authorization ID assigned by os layer */ xSecurityGenerateAuthorizationReply rep; /* reply struct */ unsigned int trustLevel; /* trust level of new auth */ XID group; /* group of new auth */ CARD32 timeout; /* timeout of new auth */ CARD32 *values; /* list of supplied attributes */ char *protoname; /* auth proto name sent in request */ char *protodata; /* auth proto data sent in request */ unsigned int authdata_len; /* # bytes of generated auth data */ char *pAuthdata; /* generated auth data */ Mask eventMask; /* what events on this auth does client want */ /* paranoia: this "can't happen" because this extension is hidden * from untrusted clients, but just in case... */ if (client->trustLevel != XSecurityClientTrusted) return BadRequest; /* check request length */ REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq); len = SIZEOF(xSecurityGenerateAuthorizationReq) >> 2; len += (stuff->nbytesAuthProto + (unsigned)3) >> 2; len += (stuff->nbytesAuthData + (unsigned)3) >> 2; values = ((CARD32 *)stuff) + len; len += Ones(stuff->valueMask); if (client->req_len != len) return BadLength; /* check valuemask */ if (stuff->valueMask & ~XSecurityAllAuthorizationAttributes) { client->errorValue = stuff->valueMask; return BadValue; } /* check timeout */ timeout = 60; if (stuff->valueMask & XSecurityTimeout) { timeout = *values++; } /* check trustLevel */ trustLevel = XSecurityClientUntrusted; if (stuff->valueMask & XSecurityTrustLevel) { trustLevel = *values++; if (trustLevel != XSecurityClientTrusted && trustLevel != XSecurityClientUntrusted) { client->errorValue = trustLevel; return BadValue; } } /* check group */ group = None; if (stuff->valueMask & XSecurityGroup) { group = *values++; if (SecurityValidateGroupCallback) { SecurityValidateGroupInfoRec vgi; vgi.group = group; vgi.valid = FALSE; CallCallbacks(&SecurityValidateGroupCallback, (void *)&vgi); /* if nobody said they recognized it, it's an error */ if (!vgi.valid) { client->errorValue = group; return BadValue; } } } /* check event mask */ eventMask = 0; if (stuff->valueMask & XSecurityEventMask) { eventMask = *values++; if (eventMask & ~XSecurityAllEventMasks) { client->errorValue = eventMask; return BadValue; } } protoname = (char *)&stuff[1]; protodata = protoname + ((stuff->nbytesAuthProto + (unsigned)3) >> 2); /* call os layer to generate the authorization */ authId = GenerateAuthorization(stuff->nbytesAuthProto, protoname, stuff->nbytesAuthData, protodata, &authdata_len, &pAuthdata); if ((XID) ~0L == authId) { err = SecurityErrorBase + XSecurityBadAuthorizationProtocol; goto bailout; } /* now that we've added the auth, remember to remove it if we have to * abort the request for some reason (like allocation failure) */ removeAuth = TRUE; /* associate additional information with this auth ID */ pAuth = (SecurityAuthorizationPtr)malloc(sizeof(SecurityAuthorizationRec)); if (!pAuth) { err = BadAlloc; goto bailout; } /* fill in the auth fields */ pAuth->id = authId; pAuth->timeout = timeout; pAuth->group = group; pAuth->trustLevel = trustLevel; pAuth->refcnt = 0; /* the auth was just created; nobody's using it yet */ pAuth->secondsRemaining = 0; pAuth->timer = NULL; pAuth->eventClients = NULL; /* handle event selection */ if (eventMask) { err = SecurityEventSelectForAuthorization(pAuth, client, eventMask); if (err != Success) goto bailout; } if (!AddResource(authId, SecurityAuthorizationResType, pAuth)) { err = BadAlloc; goto bailout; } /* start the timer ticking */ if (pAuth->timeout != 0) SecurityStartAuthorizationTimer(pAuth); /* tell client the auth id and data */ rep.type = X_Reply; rep.length = (authdata_len + 3) >> 2; rep.sequenceNumber = client->sequence; rep.authId = authId; rep.dataLength = authdata_len; if (client->swapped) { swapl(&rep.length); swaps(&rep.sequenceNumber); swapl(&rep.authId); swaps(&rep.dataLength); } WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply), &rep); WriteToClient(client, authdata_len, pAuthdata); SecurityAudit("client %d generated authorization %d trust %d timeout %d group %d events %d\n", client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout, pAuth->group, eventMask); /* the request succeeded; don't call RemoveAuthorization or free pAuth */ removeAuth = FALSE; pAuth = NULL; err = client->noClientException; bailout: if (removeAuth) RemoveAuthorization(stuff->nbytesAuthProto, protoname, authdata_len, pAuthdata); if (pAuth) free(pAuth); return err; } /* ProcSecurityGenerateAuthorization */ static int ProcSecurityRevokeAuthorization( ClientPtr client) { REQUEST(xSecurityRevokeAuthorizationReq); SecurityAuthorizationPtr pAuth; /* paranoia: this "can't happen" because this extension is hidden * from untrusted clients, but just in case... */ if (client->trustLevel != XSecurityClientTrusted) return BadRequest; REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq); pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(client, stuff->authId, SecurityAuthorizationResType, DixDestroyAccess); if (!pAuth) return SecurityErrorBase + XSecurityBadAuthorization; FreeResource(stuff->authId, RT_NONE); return Success; } /* ProcSecurityRevokeAuthorization */ static int ProcSecurityDispatch( ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_SecurityQueryVersion: return ProcSecurityQueryVersion(client); case X_SecurityGenerateAuthorization: return ProcSecurityGenerateAuthorization(client); case X_SecurityRevokeAuthorization: return ProcSecurityRevokeAuthorization(client); default: return BadRequest; } } /* ProcSecurityDispatch */ static int SProcSecurityQueryVersion( ClientPtr client) { REQUEST(xSecurityQueryVersionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xSecurityQueryVersionReq); swaps(&stuff->majorVersion); swaps(&stuff->minorVersion); return ProcSecurityQueryVersion(client); } /* SProcSecurityQueryVersion */ static int SProcSecurityGenerateAuthorization( ClientPtr client) { REQUEST(xSecurityGenerateAuthorizationReq); CARD32 *values; unsigned long nvalues; int values_offset; swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq); swaps(&stuff->nbytesAuthProto); swaps(&stuff->nbytesAuthData); swapl(&stuff->valueMask); values_offset = ((stuff->nbytesAuthProto + (unsigned)3) >> 2) + ((stuff->nbytesAuthData + (unsigned)3) >> 2); if (values_offset > stuff->length - (sz_xSecurityGenerateAuthorizationReq >> 2)) return BadLength; values = (CARD32 *)(&stuff[1]) + values_offset; nvalues = (((CARD32 *)stuff) + stuff->length) - values; SwapLongs(values, nvalues); return ProcSecurityGenerateAuthorization(client); } /* SProcSecurityGenerateAuthorization */ static int SProcSecurityRevokeAuthorization( ClientPtr client) { REQUEST(xSecurityRevokeAuthorizationReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq); swapl(&stuff->authId); return ProcSecurityRevokeAuthorization(client); } /* SProcSecurityRevokeAuthorization */ static int SProcSecurityDispatch( ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_SecurityQueryVersion: return SProcSecurityQueryVersion(client); case X_SecurityGenerateAuthorization: return SProcSecurityGenerateAuthorization(client); case X_SecurityRevokeAuthorization: return SProcSecurityRevokeAuthorization(client); default: return BadRequest; } } /* SProcSecurityDispatch */ static void SwapSecurityAuthorizationRevokedEvent( xSecurityAuthorizationRevokedEvent *from, xSecurityAuthorizationRevokedEvent *to) { to->type = from->type; to->detail = from->detail; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->authId, to->authId); } /* SecurityDetermineEventPropogationLimits * * This is a helper function for SecurityCheckDeviceAccess. * * Arguments: * dev is the device for which the starting and stopping windows for * event propogation should be determined. * The values pointed to by ppWin and ppStopWin are not used. * * Returns: * ppWin is filled in with a pointer to the window at which event * propogation for the given device should start given the current * state of the server (pointer position, window layout, etc.) * ppStopWin is filled in with the window at which event propogation * should stop; events should not go to ppStopWin. * * Side Effects: none. */ static void SecurityDetermineEventPropogationLimits( DeviceIntPtr dev, WindowPtr *ppWin, WindowPtr *ppStopWin) { WindowPtr pFocusWin = dev->focus ? dev->focus->win : NoneWin; if (pFocusWin == NoneWin) { /* no focus -- events don't go anywhere */ *ppWin = *ppStopWin = NULL; return; } if (pFocusWin == PointerRootWin) { /* focus follows the pointer */ *ppWin = GetSpriteWindow(); *ppStopWin = NULL; /* propogate all the way to the root */ } else { /* a real window is set for the focus */ WindowPtr pSpriteWin = GetSpriteWindow(); *ppStopWin = pFocusWin->parent; /* don't go past the focus window */ /* if the pointer is in a subwindow of the focus window, start * at that subwindow, else start at the focus window itself */ if (IsParent(pFocusWin, pSpriteWin)) *ppWin = pSpriteWin; else *ppWin = pFocusWin; } } /* SecurityDetermineEventPropogationLimits */ /* SecurityCheckDeviceAccess * * Arguments: * client is the client attempting to access a device. * dev is the device being accessed. * fromRequest is TRUE if the device access is a direct result of * the client executing some request and FALSE if it is a * result of the server trying to send an event (e.g. KeymapNotify) * to the client. * Returns: * TRUE if the device access should be allowed, else FALSE. * * Side Effects: * An audit message is generated if access is denied. */ Bool SecurityCheckDeviceAccess(client, dev, fromRequest) ClientPtr client; DeviceIntPtr dev; Bool fromRequest; { WindowPtr pWin, pStopWin; Bool untrusted_got_event; Bool found_event_window; Mask eventmask; int reqtype = 0; /* trusted clients always allowed to do anything */ if (client->trustLevel == XSecurityClientTrusted) return TRUE; /* device security other than keyboard is not implemented yet */ if (dev != inputInfo.keyboard) return TRUE; /* some untrusted client wants access */ if (fromRequest) { reqtype = ((xReq *)client->requestBuffer)->reqType; switch (reqtype) { /* never allow these */ case X_ChangeKeyboardMapping: case X_ChangeKeyboardControl: case X_SetModifierMapping: SecurityAudit("client %d attempted request %d\n", client->index, reqtype); return FALSE; default: break; } } untrusted_got_event = FALSE; found_event_window = FALSE; if (dev->grab) { untrusted_got_event = ((rClient(dev->grab))->trustLevel != XSecurityClientTrusted); } else { SecurityDetermineEventPropogationLimits(dev, &pWin, &pStopWin); eventmask = KeyPressMask | KeyReleaseMask; while ( (pWin != pStopWin) && !found_event_window) { OtherClients *other; if (pWin->eventMask & eventmask) { found_event_window = TRUE; client = wClient(pWin); if (client->trustLevel != XSecurityClientTrusted) { untrusted_got_event = TRUE; } } if (wOtherEventMasks(pWin) & eventmask) { found_event_window = TRUE; for (other = wOtherClients(pWin); other; other = other->next) { if (other->mask & eventmask) { client = rClient(other); if (client->trustLevel != XSecurityClientTrusted) { untrusted_got_event = TRUE; break; } } } } if (wDontPropagateMask(pWin) & eventmask) break; pWin = pWin->parent; } /* while propogating the event */ } /* allow access by untrusted clients only if an event would have gone * to an untrusted client */ if (!untrusted_got_event) { char *devname = dev->name; if (!devname) devname = "unnamed"; if (fromRequest) SecurityAudit("client %d attempted request %d device %d (%s)\n", client->index, reqtype, dev->id, devname); else SecurityAudit("client %d attempted to access device %d (%s)\n", client->index, dev->id, devname); } return untrusted_got_event; } /* SecurityCheckDeviceAccess */ /* SecurityAuditResourceIDAccess * * Arguments: * client is the client doing the resource access. * id is the resource id. * * Returns: NULL * * Side Effects: * An audit message is generated with details of the denied * resource access. */ static void * SecurityAuditResourceIDAccess( ClientPtr client, XID id) { int cid = CLIENT_ID(id); int reqtype = ((xReq *)client->requestBuffer)->reqType; switch (reqtype) { case X_ChangeProperty: case X_DeleteProperty: case X_GetProperty: { xChangePropertyReq *req = (xChangePropertyReq *)client->requestBuffer; int propertyatom = req->property; const char *propertyname = NameForAtom(propertyatom); SecurityAudit("client %d attempted request %d with window 0x%x property %s of client %d\n", client->index, reqtype, id, propertyname, cid); break; } default: { SecurityAudit("client %d attempted request %d with resource 0x%x of client %d\n", client->index, reqtype, id, cid); break; } } return NULL; } /* SecurityAuditResourceIDAccess */ /* SecurityCheckResourceIDAccess * * This function gets plugged into client->CheckAccess and is called from * SecurityLookupIDByType/Class to determine if the client can access the * resource. * * Arguments: * client is the client doing the resource access. * id is the resource id. * rtype is its type or class. * access_mode represents the intended use of the resource; see * resource.h. * rval is a pointer to the resource structure for this resource. * * Returns: * If access is granted, the value of rval that was passed in, else NULL. * * Side Effects: * Disallowed resource accesses are audited. */ static void * SecurityCheckResourceIDAccess( ClientPtr client, XID id, RESTYPE rtype, Mask access_mode, void * rval) { int cid = CLIENT_ID(id); int reqtype = ((xReq *)client->requestBuffer)->reqType; if (DixUnknownAccess == access_mode) return rval; /* for compatibility, we have to allow access */ switch (reqtype) { /* these are always allowed */ case X_QueryTree: case X_TranslateCoords: case X_GetGeometry: /* property access is controlled in SecurityCheckPropertyAccess */ case X_GetProperty: case X_ChangeProperty: case X_DeleteProperty: case X_RotateProperties: case X_ListProperties: return rval; default: break; } if (cid != 0) { /* not a server-owned resource */ /* * The following 'if' restricts clients to only access resources at * the same trustLevel. Since there are currently only two trust levels, * and trusted clients never call this function, this degenerates into * saying that untrusted clients can only access resources of other * untrusted clients. One way to add the notion of groups would be to * allow values other than Trusted (0) and Untrusted (1) for this field. * Clients at the same trust level would be able to use each other's * resources, but not those of clients at other trust levels. I haven't * tried it, but this probably mostly works already. The obvious * competing alternative for grouping clients for security purposes is to * use app groups. dpw */ if (client->trustLevel == clients[cid]->trustLevel ) return rval; else return SecurityAuditResourceIDAccess(client, id); } else /* server-owned resource - probably a default colormap or root window */ { if (RT_WINDOW == rtype || RC_DRAWABLE == rtype) { switch (reqtype) { /* the following operations are allowed on root windows */ case X_CreatePixmap: case X_CreateGC: case X_CreateWindow: case X_CreateColormap: case X_ListProperties: case X_GrabPointer: case X_UngrabButton: case X_QueryBestSize: case X_GetWindowAttributes: break; case X_SendEvent: { /* see if it is an event specified by the ICCCM */ xSendEventReq *req = (xSendEventReq *) (client->requestBuffer); if (req->propagate == xTrue || (req->eventMask != ColormapChangeMask && req->eventMask != StructureNotifyMask && req->eventMask != (SubstructureRedirectMask|SubstructureNotifyMask) ) || (req->event.u.u.type != UnmapNotify && req->event.u.u.type != ConfigureRequest && req->event.u.u.type != ClientMessage ) ) { /* not an ICCCM event */ return SecurityAuditResourceIDAccess(client, id); } break; } /* case X_SendEvent on root */ case X_ChangeWindowAttributes: { /* Allow selection of PropertyNotify and StructureNotify * events on the root. */ xChangeWindowAttributesReq *req = (xChangeWindowAttributesReq *)(client->requestBuffer); if (req->valueMask == CWEventMask) { CARD32 value = *((CARD32 *)(req + 1)); if ( (value & ~(PropertyChangeMask|StructureNotifyMask)) == 0) break; } return SecurityAuditResourceIDAccess(client, id); } /* case X_ChangeWindowAttributes on root */ default: { /* others not allowed */ return SecurityAuditResourceIDAccess(client, id); } } } /* end server-owned window or drawable */ else if (SecurityAuthorizationResType == rtype) { SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)rval; if (pAuth->trustLevel != client->trustLevel) return SecurityAuditResourceIDAccess(client, id); } else if (RT_COLORMAP != rtype) { /* don't allow anything else besides colormaps */ return SecurityAuditResourceIDAccess(client, id); } } return rval; } /* SecurityCheckResourceIDAccess */ /* SecurityClientStateCallback * * Arguments: * pcbl is &ClientStateCallback. * nullata is NULL. * calldata is a pointer to a NewClientInfoRec (include/dixstruct.h) * which contains information about client state changes. * * Returns: nothing. * * Side Effects: * * If a new client is connecting, its authorization ID is copied to * client->authID. If this is a generated authorization, its reference * count is bumped, its timer is cancelled if it was running, and its * trustlevel is copied to client->trustLevel. * * If a client is disconnecting and the client was using a generated * authorization, the authorization's reference count is decremented, and * if it is now zero, the timer for this authorization is started. */ static void SecurityClientStateCallback( CallbackListPtr *pcbl, void * nulldata, void * calldata) { NewClientInfoRec *pci = (NewClientInfoRec *)calldata; ClientPtr client = pci->client; switch (client->clientState) { case ClientStateRunning: { XID authId = AuthorizationIDOfClient(client); SecurityAuthorizationPtr pAuth; client->authId = authId; pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId, SecurityAuthorizationResType); if (pAuth) { /* it is a generated authorization */ pAuth->refcnt++; if (pAuth->refcnt == 1) { if (pAuth->timer) TimerCancel(pAuth->timer); } client->trustLevel = pAuth->trustLevel; if (client->trustLevel != XSecurityClientTrusted) { client->CheckAccess = SecurityCheckResourceIDAccess; client->requestVector = client->swapped ? SwappedUntrustedProcVector : UntrustedProcVector; } } break; } case ClientStateGone: case ClientStateRetained: /* client disconnected */ { XID authId = client->authId; SecurityAuthorizationPtr pAuth; pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId, SecurityAuthorizationResType); if (pAuth) { /* it is a generated authorization */ pAuth->refcnt--; if (pAuth->refcnt == 0) { SecurityStartAuthorizationTimer(pAuth); } } break; } default: break; } } /* SecurityClientStateCallback */ /* SecurityCensorImage * * Called after pScreen->GetImage to prevent pieces or trusted windows from * being returned in image data from an untrusted window. * * Arguments: * client is the client doing the GetImage. * pVisibleRegion is the visible region of the window. * widthBytesLine is the width in bytes of one horizontal line in pBuf. * pDraw is the source window. * x, y, w, h is the rectangle of image data from pDraw in pBuf. * format is the format of the image data in pBuf: ZPixmap or XYPixmap. * pBuf is the image data. * * Returns: nothing. * * Side Effects: * Any part of the rectangle (x, y, w, h) that is outside the visible * region of the window will be destroyed (overwritten) in pBuf. */ void SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h, format, pBuf) ClientPtr client; RegionPtr pVisibleRegion; long widthBytesLine; DrawablePtr pDraw; int x, y, w, h; unsigned int format; char * pBuf; { RegionRec imageRegion; /* region representing x,y,w,h */ RegionRec censorRegion; /* region to obliterate */ BoxRec imageBox; int nRects; imageBox.x1 = x; imageBox.y1 = y; imageBox.x2 = x + w; imageBox.y2 = y + h; RegionInit(&imageRegion, &imageBox, 1); RegionNull(&censorRegion); /* censorRegion = imageRegion - visibleRegion */ RegionSubtract(&censorRegion, &imageRegion, pVisibleRegion); nRects = RegionNumRects(&censorRegion); if (nRects > 0) { /* we have something to censor */ GCPtr pScratchGC = NULL; PixmapPtr pPix = NULL; xRectangle *pRects = NULL; Bool failed = FALSE; int depth = 1; int bitsPerPixel = 1; int i; BoxPtr pBox; /* convert region to list-of-rectangles for PolyFillRect */ pRects = (xRectangle *)malloc(nRects * sizeof(xRectangle *)); if (!pRects) { failed = TRUE; goto failSafe; } for (pBox = RegionRects(&censorRegion), i = 0; i < nRects; i++, pBox++) { pRects[i].x = pBox->x1; pRects[i].y = pBox->y1 - imageBox.y1; pRects[i].width = pBox->x2 - pBox->x1; pRects[i].height = pBox->y2 - pBox->y1; } /* use pBuf as a fake pixmap */ if (format == ZPixmap) { depth = pDraw->depth; bitsPerPixel = pDraw->bitsPerPixel; } pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h, depth, bitsPerPixel, widthBytesLine, (void *)pBuf); if (!pPix) { failed = TRUE; goto failSafe; } pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen); if (!pScratchGC) { failed = TRUE; goto failSafe; } ValidateGC(&pPix->drawable, pScratchGC); (* pScratchGC->ops->PolyFillRect)(&pPix->drawable, pScratchGC, nRects, pRects); failSafe: if (failed) { /* Censoring was not completed above. To be safe, wipe out * all the image data so that nothing trusted gets out. */ bzero(pBuf, (int)(widthBytesLine * h)); } if (pRects) free(pRects); if (pScratchGC) FreeScratchGC(pScratchGC); if (pPix) FreeScratchPixmapHeader(pPix); } RegionUninit(&imageRegion); RegionUninit(&censorRegion); } /* SecurityCensorImage */ /**********************************************************************/ typedef struct _PropertyAccessRec { ATOM name; ATOM mustHaveProperty; char *mustHaveValue; char windowRestriction; #define SecurityAnyWindow 0 #define SecurityRootWindow 1 #define SecurityWindowWithProperty 2 char readAction; char writeAction; char destroyAction; struct _PropertyAccessRec *next; } PropertyAccessRec, *PropertyAccessPtr; static PropertyAccessPtr PropertyAccessList = NULL; static char SecurityDefaultAction = SecurityErrorOperation; static char *SecurityPolicyFile = DEFAULTPOLICYFILE; static ATOM SecurityMaxPropertyName = 0; static char *SecurityKeywords[] = { #define SecurityKeywordComment 0 "#", #define SecurityKeywordProperty 1 "property", #define SecurityKeywordSitePolicy 2 "sitepolicy", #define SecurityKeywordRoot 3 "root", #define SecurityKeywordAny 4 "any" }; #define NUMKEYWORDS (sizeof(SecurityKeywords) / sizeof(char *)) #undef PROPDEBUG /*#define PROPDEBUG 1*/ static void SecurityFreePropertyAccessList(void) { while (PropertyAccessList) { PropertyAccessPtr freeit = PropertyAccessList; PropertyAccessList = PropertyAccessList->next; free(freeit); } } /* SecurityFreePropertyAccessList */ #define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') ) static char * SecuritySkipWhitespace( char *p) { while (SecurityIsWhitespace(*p)) p++; return p; } /* SecuritySkipWhitespace */ static char * SecurityParseString( char **rest) { char *startOfString; char *s = *rest; char endChar = 0; s = SecuritySkipWhitespace(s); if (*s == '"' || *s == '\'') { endChar = *s++; startOfString = s; while (*s && (*s != endChar)) s++; } else { startOfString = s; while (*s && !SecurityIsWhitespace(*s)) s++; } if (*s) { *s = '\0'; *rest = s + 1; return startOfString; } else { *rest = s; return (endChar) ? NULL : startOfString; } } /* SecurityParseString */ static int SecurityParseKeyword( char **p) { int i; char *s = *p; s = SecuritySkipWhitespace(s); for (i = 0; i < NUMKEYWORDS; i++) { int len = strlen(SecurityKeywords[i]); if (strncmp(s, SecurityKeywords[i], len) == 0) { *p = s + len; return (i); } } *p = s; return -1; } /* SecurityParseKeyword */ static Bool SecurityParsePropertyAccessRule( char *p) { char *propname; char c; char action = SecurityDefaultAction; char readAction, writeAction, destroyAction; PropertyAccessPtr pacl, prev, cur; char *mustHaveProperty = NULL; char *mustHaveValue = NULL; Bool invalid; char windowRestriction; int size; int keyword; /* get property name */ propname = SecurityParseString(&p); if (!propname || (strlen(propname) == 0)) return FALSE; /* get window on which property must reside for rule to apply */ keyword = SecurityParseKeyword(&p); if (keyword == SecurityKeywordRoot) windowRestriction = SecurityRootWindow; else if (keyword == SecurityKeywordAny) windowRestriction = SecurityAnyWindow; else /* not root or any, must be a property name */ { mustHaveProperty = SecurityParseString(&p); if (!mustHaveProperty || (strlen(mustHaveProperty) == 0)) return FALSE; windowRestriction = SecurityWindowWithProperty; p = SecuritySkipWhitespace(p); if (*p == '=') { /* property value is specified too */ p++; /* skip over '=' */ mustHaveValue = SecurityParseString(&p); if (!mustHaveValue) return FALSE; } } /* get operations and actions */ invalid = FALSE; readAction = writeAction = destroyAction = SecurityDefaultAction; while ( (c = *p++) && !invalid) { switch (c) { case 'i': action = SecurityIgnoreOperation; break; case 'a': action = SecurityAllowOperation; break; case 'e': action = SecurityErrorOperation; break; case 'r': readAction = action; break; case 'w': writeAction = action; break; case 'd': destroyAction = action; break; default : if (!SecurityIsWhitespace(c)) invalid = TRUE; break; } } if (invalid) return FALSE; /* We've successfully collected all the information needed for this * property access rule. Now record it in a PropertyAccessRec. */ size = sizeof(PropertyAccessRec); /* If there is a property value string, allocate space for it * right after the PropertyAccessRec. */ if (mustHaveValue) size += strlen(mustHaveValue) + 1; pacl = (PropertyAccessPtr)malloc(size); if (!pacl) return FALSE; pacl->name = MakeAtom(propname, strlen(propname), TRUE); if (pacl->name == BAD_RESOURCE) { free(pacl); return FALSE; } if (mustHaveProperty) { pacl->mustHaveProperty = MakeAtom(mustHaveProperty, strlen(mustHaveProperty), TRUE); if (pacl->mustHaveProperty == BAD_RESOURCE) { free(pacl); return FALSE; } } else pacl->mustHaveProperty = 0; if (mustHaveValue) { pacl->mustHaveValue = (char *)(pacl + 1); strcpy(pacl->mustHaveValue, mustHaveValue); } else pacl->mustHaveValue = NULL; SecurityMaxPropertyName = max(SecurityMaxPropertyName, pacl->name); pacl->windowRestriction = windowRestriction; pacl->readAction = readAction; pacl->writeAction = writeAction; pacl->destroyAction = destroyAction; /* link the new rule into the list of rules in order of increasing * property name (atom) value to make searching easier */ for (prev = NULL, cur = PropertyAccessList; cur && cur->name <= pacl->name; prev = cur, cur = cur->next) ; if (!prev) { pacl->next = cur; PropertyAccessList = pacl; } else { prev->next = pacl; pacl->next = cur; } return TRUE; } /* SecurityParsePropertyAccessRule */ static char **SecurityPolicyStrings = NULL; static int nSecurityPolicyStrings = 0; static Bool SecurityParseSitePolicy( char *p) { char *policyStr = SecurityParseString(&p); char *copyPolicyStr; char **newStrings; if (!policyStr) return FALSE; copyPolicyStr = (char *)malloc(strlen(policyStr) + 1); if (!copyPolicyStr) return TRUE; strcpy(copyPolicyStr, policyStr); newStrings = (char **)realloc(SecurityPolicyStrings, sizeof (char *) * (nSecurityPolicyStrings + 1)); if (!newStrings) { free(copyPolicyStr); return TRUE; } SecurityPolicyStrings = newStrings; SecurityPolicyStrings[nSecurityPolicyStrings++] = copyPolicyStr; return TRUE; } /* SecurityParseSitePolicy */ char ** SecurityGetSitePolicyStrings(n) int *n; { *n = nSecurityPolicyStrings; return SecurityPolicyStrings; } /* SecurityGetSitePolicyStrings */ static void SecurityFreeSitePolicyStrings(void) { if (SecurityPolicyStrings) { assert(nSecurityPolicyStrings); while (nSecurityPolicyStrings--) { free(SecurityPolicyStrings[nSecurityPolicyStrings]); } free(SecurityPolicyStrings); SecurityPolicyStrings = NULL; nSecurityPolicyStrings = 0; } } /* SecurityFreeSitePolicyStrings */ static void SecurityLoadPropertyAccessList(void) { FILE *f; int lineNumber = 0; SecurityMaxPropertyName = 0; #ifdef NXAGENT_SERVER if (!_NXGetPolicyFilePath(SecurityPolicyFile)) { return; } #else if (!SecurityPolicyFile) return; #endif #ifdef NXAGENT_SERVER f = Fopen(_NXGetPolicyFilePath(SecurityPolicyFile), "r"); #else f = Fopen(SecurityPolicyFile, "r"); #endif if (!f) { #ifdef NXAGENT_SERVER ErrorF("error opening security policy file %s\n", _NXGetPolicyFilePath(SecurityPolicyFile)); #else ErrorF("error opening security policy file %s\n", SecurityPolicyFile); #endif return; } while (!feof(f)) { char buf[200]; Bool validLine; char *p; if (!(p = fgets(buf, sizeof(buf), f))) break; lineNumber++; /* if first line, check version number */ if (lineNumber == 1) { char *v = SecurityParseString(&p); if (strcmp(v, SECURITY_POLICY_FILE_VERSION) != 0) { #ifdef NXAGENT_SERVER ErrorF("%s: invalid security policy file version, ignoring file\n", _NXGetPolicyFilePath(SecurityPolicyFile)); #else ErrorF("%s: invalid security policy file version, ignoring file\n", SecurityPolicyFile); #endif break; } validLine = TRUE; } else { switch (SecurityParseKeyword(&p)) { case SecurityKeywordComment: validLine = TRUE; break; case SecurityKeywordProperty: validLine = SecurityParsePropertyAccessRule(p); break; case SecurityKeywordSitePolicy: validLine = SecurityParseSitePolicy(p); break; default: validLine = (*p == '\0'); /* blank lines OK, others not */ break; } } #ifdef NXAGENT_SERVER if (!validLine) { ErrorF("Line %d of %s invalid, ignoring\n", lineNumber, _NXGetPolicyFilePath(SecurityPolicyFile)); } #else if (!validLine) ErrorF("Line %d of %s invalid, ignoring\n", lineNumber, SecurityPolicyFile); #endif } /* end while more input */ #ifdef PROPDEBUG { PropertyAccessPtr pacl; char *op = "aie"; for (pacl = PropertyAccessList; pacl; pacl = pacl->next) { ErrorF("property %s ", NameForAtom(pacl->name)); switch (pacl->windowRestriction) { case SecurityAnyWindow: ErrorF("any "); break; case SecurityRootWindow: ErrorF("root "); break; case SecurityWindowWithProperty: { ErrorF("%s ", NameForAtom(pacl->mustHaveProperty)); if (pacl->mustHaveValue) ErrorF(" = \"%s\" ", pacl->mustHaveValue); } break; } ErrorF("%cr %cw %cd\n", op[pacl->readAction], op[pacl->writeAction], op[pacl->destroyAction]); } } #endif /* PROPDEBUG */ Fclose(f); } /* SecurityLoadPropertyAccessList */ static Bool SecurityMatchString( char *ws, char *cs) { while (*ws && *cs) { if (*ws == '*') { Bool match = FALSE; ws++; while (!(match = SecurityMatchString(ws, cs)) && *cs) { cs++; } return match; } else if (*ws == *cs) { ws++; cs++; } else break; } return ( ( (*ws == '\0') || ((*ws == '*') && *(ws+1) == '\0') ) && (*cs == '\0') ); } /* SecurityMatchString */ #ifdef PROPDEBUG #include #include #endif char SecurityCheckPropertyAccess(client, pWin, propertyName, access_mode) ClientPtr client; WindowPtr pWin; ATOM propertyName; Mask access_mode; { PropertyAccessPtr pacl; char action = SecurityDefaultAction; /* if client trusted or window untrusted, allow operation */ if ( (client->trustLevel == XSecurityClientTrusted) || (wClient(pWin)->trustLevel != XSecurityClientTrusted) ) return SecurityAllowOperation; #ifdef PROPDEBUG /* For testing, it's more convenient if the property rules file gets * reloaded whenever it changes, so we can rapidly try things without * having to reset the server. */ { struct stat buf; static time_t lastmod = 0; #ifdef NXAGENT_SERVER int ret = stat(_NXGetPolicyFilePath(SecurityPolicyFile), &buf); #else int ret = stat(SecurityPolicyFile , &buf); #endif if ( (ret == 0) && (buf.st_mtime > lastmod) ) { ErrorF("reloading property rules\n"); SecurityFreePropertyAccessList(); SecurityLoadPropertyAccessList(); lastmod = buf.st_mtime; } } #endif /* If the property atom is bigger than any atoms on the list, * we know we won't find it, so don't even bother looking. */ if (propertyName <= SecurityMaxPropertyName) { /* untrusted client operating on trusted window; see if it's allowed */ for (pacl = PropertyAccessList; pacl; pacl = pacl->next) { if (pacl->name < propertyName) continue; if (pacl->name > propertyName) break; /* pacl->name == propertyName, so see if it applies to this window */ switch (pacl->windowRestriction) { case SecurityAnyWindow: /* always applies */ break; case SecurityRootWindow: { /* if not a root window, this rule doesn't apply */ if (pWin->parent) continue; } break; case SecurityWindowWithProperty: { PropertyPtr pProp = wUserProps (pWin); Bool match = FALSE; char *p; char *pEndData; while (pProp) { if (pProp->propertyName == pacl->mustHaveProperty) break; pProp = pProp->next; } if (!pProp) continue; if (!pacl->mustHaveValue) break; if (pProp->type != XA_STRING || pProp->format != 8) continue; p = pProp->data; pEndData = ((char *)pProp->data) + pProp->size; while (!match && p < pEndData) { if (SecurityMatchString(pacl->mustHaveValue, p)) match = TRUE; else { /* skip to the next string */ while (*p++ && p < pEndData) ; } } if (!match) continue; } break; /* end case SecurityWindowWithProperty */ } /* end switch on windowRestriction */ /* If we get here, the property access rule pacl applies. * If pacl doesn't apply, something above should have * executed a continue, which will skip the follwing code. */ action = SecurityAllowOperation; if (access_mode & DixReadAccess) action = max(action, pacl->readAction); if (access_mode & DixWriteAccess) action = max(action, pacl->writeAction); if (access_mode & DixDestroyAccess) action = max(action, pacl->destroyAction); break; } /* end for each pacl */ } /* end if propertyName <= SecurityMaxPropertyName */ if (SecurityAllowOperation != action) { /* audit the access violation */ int cid = CLIENT_ID(pWin->drawable.id); int reqtype = ((xReq *)client->requestBuffer)->reqType; char *actionstr = (SecurityIgnoreOperation == action) ? "ignored" : "error"; SecurityAudit("client %d attempted request %d with window 0x%x property %s (atom 0x%x) of client %d, %s\n", client->index, reqtype, pWin->drawable.id, NameForAtom(propertyName), propertyName, cid, actionstr); } return action; } /* SecurityCheckPropertyAccess */ /* SecurityResetProc * * Arguments: * extEntry is the extension information for the security extension. * * Returns: nothing. * * Side Effects: * Performs any cleanup needed by Security at server shutdown time. */ static void SecurityResetProc( ExtensionEntry *extEntry) { SecurityFreePropertyAccessList(); SecurityFreeSitePolicyStrings(); } /* SecurityResetProc */ int XSecurityOptions(argc, argv, i) int argc; char **argv; int i; { if (strcmp(argv[i], "-sp") == 0) { if (i < argc) SecurityPolicyFile = argv[++i]; return (i + 1); } return (i); } /* XSecurityOptions */ /* SecurityExtensionInit * * Arguments: none. * * Returns: nothing. * * Side Effects: * Enables the Security extension if possible. */ void SecurityExtensionInit(void) { ExtensionEntry *extEntry; int i; SecurityAuthorizationResType = CreateNewResourceType(SecurityDeleteAuthorization); RTEventClient = CreateNewResourceType( SecurityDeleteAuthorizationEventClient); if (!SecurityAuthorizationResType || !RTEventClient) return; RTEventClient |= RC_NEVERRETAIN; if (!AddCallback(&ClientStateCallback, SecurityClientStateCallback, NULL)) return; extEntry = AddExtension(SECURITY_EXTENSION_NAME, XSecurityNumberEvents, XSecurityNumberErrors, ProcSecurityDispatch, SProcSecurityDispatch, SecurityResetProc, StandardMinorOpcode); SecurityErrorBase = extEntry->errorBase; SecurityEventBase = extEntry->eventBase; EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] = (EventSwapPtr)SwapSecurityAuthorizationRevokedEvent; /* initialize untrusted proc vectors */ for (i = 0; i < 128; i++) { UntrustedProcVector[i] = ProcVector[i]; SwappedUntrustedProcVector[i] = SwappedProcVector[i]; } /* make sure insecure extensions are not allowed */ for (i = 128; i < 256; i++) { if (!UntrustedProcVector[i]) { UntrustedProcVector[i] = ProcBadRequest; SwappedUntrustedProcVector[i] = ProcBadRequest; } } SecurityLoadPropertyAccessList(); } /* SecurityExtensionInit */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/SecurityPolicy0000644000000000000000000000555513614532331020447 0ustar version-1 # $Xorg: SecurityPolicy,v 1.3 2000/08/17 19:47:56 cpqbld Exp $ # The site policy fields are interpreted by the XC-QUERY-SECURITY-1 # authorization protocol. The values are arbitrary and site-specific. # Refer to the Security Extension Specification for the usage of the policies. #sitepolicy A #sitepolicy B #sitepolicy C # Property access rules: # property # ::= any | root | # ::= | = # :== [ | | ]* # :== r | w | d # r read # w write # d delete # :== a | i | e # a allow # i ignore # e error # Allow reading of application resources, but not writing. property RESOURCE_MANAGER root ar iw property SCREEN_RESOURCES root ar iw # Ignore attempts to use cut buffers. Giving errors causes apps to crash, # and allowing access may give away too much information. property CUT_BUFFER0 root irw property CUT_BUFFER1 root irw property CUT_BUFFER2 root irw property CUT_BUFFER3 root irw property CUT_BUFFER4 root irw property CUT_BUFFER5 root irw property CUT_BUFFER6 root irw property CUT_BUFFER7 root irw # If you are using Motif, you probably want these. property _MOTIF_DEFAULT_BINDINGS root ar iw property _MOTIF_DRAG_WINDOW root ar iw property _MOTIF_DRAG_TARGETS any ar iw property _MOTIF_DRAG_ATOMS any ar iw property _MOTIF_DRAG_ATOM_PAIRS any ar iw # If you are running CDE you also need these property _MOTIF_WM_INFO root arw property TT_SESSION root irw property WM_ICON_SIZE root irw property "SDT Pixel Set" any irw # The next two rules let xwininfo -tree work when untrusted. property WM_NAME any ar # Allow read of WM_CLASS, but only for windows with WM_NAME. # This might be more restrictive than necessary, but demonstrates # the facility, and is also an attempt to # say "top level windows only." property WM_CLASS WM_NAME ar # These next three let xlsclients work untrusted. Think carefully # before including these; giving away the client machine name and command # may be exposing too much. property WM_STATE WM_NAME ar property WM_CLIENT_MACHINE WM_NAME ar property WM_COMMAND WM_NAME ar # To let untrusted clients use the standard colormaps created by # xstdcmap, include these lines. property RGB_DEFAULT_MAP root ar property RGB_BEST_MAP root ar property RGB_RED_MAP root ar property RGB_GREEN_MAP root ar property RGB_BLUE_MAP root ar property RGB_GRAY_MAP root ar # To let untrusted clients use the color management database created # by xcmsdb, include these lines. property XDCCC_LINEAR_RGB_CORRECTION root ar property XDCCC_LINEAR_RGB_MATRICES root ar property XDCCC_GRAY_SCREENWHITEPOINT root ar property XDCCC_GRAY_CORRECTION root ar # To let untrusted clients use the overlay visuals that many vendors # support, include this line. property SERVER_OVERLAY_VISUALS root ar nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/shape.c0000644000000000000000000010042213614532331016766 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "os.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "extnsionst.h" #include "dixstruct.h" #include "resource.h" #include "opaque.h" #ifdef LEGACY_XEXT_PROTO /* * The legacy shape proto implementation used to distinguish between * the server and client side via the _SHAPE_SERVER_ macro. * If not set, shape.h pulls in Xlib, which will lead to compile * errors in a server environment. */ #define _SHAPE_SERVER_ #include #else #include #endif #include "protocol-versions.h" #include "regionstr.h" #include "gcstruct.h" typedef RegionPtr (*CreateDftPtr)( WindowPtr /* pWin */ ); static int ShapeFreeClient( void * /* data */, XID /* id */ ); static int ShapeFreeEvents( void * /* data */, XID /* id */ ); static void ShapeResetProc( ExtensionEntry * /* extEntry */ ); static void SShapeNotifyEvent( xShapeNotifyEvent * /* from */, xShapeNotifyEvent * /* to */ ); static int RegionOperate ( ClientPtr /* client */, WindowPtr /* pWin */, int /* kind */, RegionPtr * /* destRgnp */, RegionPtr /* srcRgn */, int /* op */, int /* xoff */, int /* yoff */, CreateDftPtr /* create */ ); /* SendShapeNotify, CreateBoundingShape and CreateClipShape are used * externally by the Xfixes extension and are now defined in window.h */ static DISPATCH_PROC(ProcShapeCombine); static DISPATCH_PROC(ProcShapeDispatch); static DISPATCH_PROC(ProcShapeGetRectangles); static DISPATCH_PROC(ProcShapeInputSelected); static DISPATCH_PROC(ProcShapeMask); static DISPATCH_PROC(ProcShapeOffset); static DISPATCH_PROC(ProcShapeQueryExtents); static DISPATCH_PROC(ProcShapeQueryVersion); static DISPATCH_PROC(ProcShapeRectangles); static DISPATCH_PROC(ProcShapeSelectInput); static DISPATCH_PROC(SProcShapeCombine); static DISPATCH_PROC(SProcShapeDispatch); static DISPATCH_PROC(SProcShapeGetRectangles); static DISPATCH_PROC(SProcShapeInputSelected); static DISPATCH_PROC(SProcShapeMask); static DISPATCH_PROC(SProcShapeOffset); static DISPATCH_PROC(SProcShapeQueryExtents); static DISPATCH_PROC(SProcShapeQueryVersion); static DISPATCH_PROC(SProcShapeRectangles); static DISPATCH_PROC(SProcShapeSelectInput); #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #endif #if 0 static unsigned char ShapeReqCode = 0; #endif static int ShapeEventBase = 0; static RESTYPE ClientType, EventType; /* resource types for event masks */ /* * each window has a list of clients requesting * ShapeNotify events. Each client has a resource * for each window it selects ShapeNotify input for, * this resource is used to delete the ShapeNotifyRec * entry from the per-window queue. */ typedef struct _ShapeEvent *ShapeEventPtr; typedef struct _ShapeEvent { ShapeEventPtr next; ClientPtr client; WindowPtr window; XID clientResource; } ShapeEventRec; /**************** * ShapeExtensionInit * * Called from InitExtensions in main() or from QueryExtension() if the * extension is dynamically loaded. * ****************/ void ShapeExtensionInit(void) { ExtensionEntry *extEntry; ClientType = CreateNewResourceType(ShapeFreeClient); EventType = CreateNewResourceType(ShapeFreeEvents); if (ClientType && EventType && (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0, ProcShapeDispatch, SProcShapeDispatch, ShapeResetProc, StandardMinorOpcode))) { #if 0 ShapeReqCode = (unsigned char)extEntry->base; #endif ShapeEventBase = extEntry->eventBase; EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent; } } /*ARGSUSED*/ static void ShapeResetProc (extEntry) ExtensionEntry *extEntry; { } static int RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create) ClientPtr client; WindowPtr pWin; int kind; RegionPtr *destRgnp, srcRgn; int op; int xoff, yoff; CreateDftPtr create; /* creates a reasonable *destRgnp */ { ScreenPtr pScreen = pWin->drawable.pScreen; if (srcRgn && (xoff || yoff)) RegionTranslate(srcRgn, xoff, yoff); if (!pWin->parent) { if (srcRgn) RegionDestroy(srcRgn); return Success; } /* May/30/2001: * The shape.PS specs say if src is None, existing shape is to be * removed (and so the op-code has no meaning in such removal); * see shape.PS, page 3, ShapeMask. */ if (srcRgn == NULL) { if (*destRgnp != NULL) { RegionDestroy(*destRgnp); *destRgnp = 0; /* go on to remove shape and generate ShapeNotify */ } else { /* May/30/2001: * The target currently has no shape in effect, so nothing to * do here. The specs say that ShapeNotify is generated whenever * the client region is "modified"; since no modification is done * here, we do not generate that event. The specs does not say * "it is an error to request removal when there is no shape in * effect", so we return good status. */ return Success; } } else switch (op) { case ShapeSet: if (*destRgnp) RegionDestroy(*destRgnp); *destRgnp = srcRgn; srcRgn = 0; break; case ShapeUnion: if (*destRgnp) RegionUnion(*destRgnp, *destRgnp, srcRgn); break; case ShapeIntersect: if (*destRgnp) RegionIntersect(*destRgnp, *destRgnp, srcRgn); else { *destRgnp = srcRgn; srcRgn = 0; } break; case ShapeSubtract: if (!*destRgnp) *destRgnp = (*create)(pWin); RegionSubtract(*destRgnp, *destRgnp, srcRgn); break; case ShapeInvert: if (!*destRgnp) *destRgnp = RegionCreate((BoxPtr) 0, 0); else RegionSubtract(*destRgnp, srcRgn, *destRgnp); break; default: client->errorValue = op; return BadValue; } if (srcRgn) RegionDestroy(srcRgn); (*pScreen->SetShape) (pWin); SendShapeNotify (pWin, kind); return Success; } RegionPtr CreateBoundingShape (pWin) WindowPtr pWin; { BoxRec extents = {0}; extents.x1 = -wBorderWidth (pWin); extents.y1 = -wBorderWidth (pWin); extents.x2 = pWin->drawable.width + wBorderWidth (pWin); extents.y2 = pWin->drawable.height + wBorderWidth (pWin); return RegionCreate(&extents, 1); } RegionPtr CreateClipShape (pWin) WindowPtr pWin; { BoxRec extents = {0}; extents.x1 = 0; extents.y1 = 0; extents.x2 = pWin->drawable.width; extents.y2 = pWin->drawable.height; return RegionCreate(&extents, 1); } static int ProcShapeQueryVersion (client) register ClientPtr client; { xShapeQueryVersionReply rep = {0}; REQUEST_SIZE_MATCH (xShapeQueryVersionReq); memset(&rep, 0, sizeof(xShapeQueryVersionReply)); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION; rep.minorVersion = SERVER_SHAPE_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.majorVersion); swaps(&rep.minorVersion); } WriteToClient(client, sizeof (xShapeQueryVersionReply), &rep); return (client->noClientException); } /***************** * ProcShapeRectangles * *****************/ static int ProcShapeRectangles (client) register ClientPtr client; { WindowPtr pWin; REQUEST(xShapeRectanglesReq); xRectangle *prects; int nrects, ctype; RegionPtr srcRgn; RegionPtr *destRgn; CreateDftPtr createDefault; REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq); UpdateCurrentTime(); pWin = LookupWindow (stuff->dest, client); if (!pWin) return BadWindow; switch (stuff->destKind) { case ShapeBounding: createDefault = CreateBoundingShape; break; case ShapeClip: createDefault = CreateClipShape; break; case ShapeInput: createDefault = CreateBoundingShape; break; default: client->errorValue = stuff->destKind; return BadValue; } if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) && (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded)) { client->errorValue = stuff->ordering; return BadValue; } nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq)); if (nrects & 4) return BadLength; nrects >>= 3; prects = (xRectangle *) &stuff[1]; ctype = VerifyRectOrder(nrects, prects, (int)stuff->ordering); if (ctype < 0) return BadMatch; srcRgn = RegionFromRects(nrects, prects, ctype); if (!pWin->optional) MakeWindowOptional (pWin); switch (stuff->destKind) { case ShapeBounding: destRgn = &pWin->optional->boundingShape; break; case ShapeClip: destRgn = &pWin->optional->clipShape; break; case ShapeInput: destRgn = &pWin->optional->inputShape; break; default: return BadValue; } return RegionOperate (client, pWin, (int)stuff->destKind, destRgn, srcRgn, (int)stuff->op, stuff->xOff, stuff->yOff, createDefault); } #ifdef PANORAMIX static int ProcPanoramiXShapeRectangles( register ClientPtr client) { REQUEST(xShapeRectanglesReq); PanoramiXRes *win; int j, result = 0; REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->dest, XRT_WINDOW, DixWriteAccess))) return BadWindow; FOR_NSCREENS(j) { stuff->dest = win->info[j].id; result = ProcShapeRectangles (client); BREAK_IF(result != Success); } return (result); } #endif /************** * ProcShapeMask **************/ static int ProcShapeMask (client) register ClientPtr client; { WindowPtr pWin; ScreenPtr pScreen; REQUEST(xShapeMaskReq); RegionPtr srcRgn; RegionPtr *destRgn; PixmapPtr pPixmap; CreateDftPtr createDefault; REQUEST_SIZE_MATCH (xShapeMaskReq); UpdateCurrentTime(); pWin = SecurityLookupWindow (stuff->dest, client, DixWriteAccess); if (!pWin) return BadWindow; switch (stuff->destKind) { case ShapeBounding: createDefault = CreateBoundingShape; break; case ShapeClip: createDefault = CreateClipShape; break; case ShapeInput: createDefault = CreateBoundingShape; break; default: client->errorValue = stuff->destKind; return BadValue; } pScreen = pWin->drawable.pScreen; if (stuff->src == None) srcRgn = 0; else { pPixmap = (PixmapPtr) SecurityLookupIDByType(client, stuff->src, RT_PIXMAP, DixReadAccess); if (!pPixmap) return BadPixmap; if (pPixmap->drawable.pScreen != pScreen || pPixmap->drawable.depth != 1) return BadMatch; srcRgn = BitmapToRegion(pScreen, pPixmap); if (!srcRgn) return BadAlloc; } if (!pWin->optional) MakeWindowOptional (pWin); switch (stuff->destKind) { case ShapeBounding: destRgn = &pWin->optional->boundingShape; break; case ShapeClip: destRgn = &pWin->optional->clipShape; break; case ShapeInput: destRgn = &pWin->optional->inputShape; break; default: return BadValue; } return RegionOperate (client, pWin, (int)stuff->destKind, destRgn, srcRgn, (int)stuff->op, stuff->xOff, stuff->yOff, createDefault); } #ifdef PANORAMIX static int ProcPanoramiXShapeMask( register ClientPtr client) { REQUEST(xShapeMaskReq); PanoramiXRes *win, *pmap; int j, result = 0; REQUEST_SIZE_MATCH (xShapeMaskReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->dest, XRT_WINDOW, DixWriteAccess))) return BadWindow; if(stuff->src != None) { if(!(pmap = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->src, XRT_PIXMAP, DixReadAccess))) return BadPixmap; } else pmap = NULL; FOR_NSCREENS(j) { stuff->dest = win->info[j].id; if(pmap) stuff->src = pmap->info[j].id; result = ProcShapeMask (client); BREAK_IF(result != Success); } return (result); } #endif /************ * ProcShapeCombine ************/ static int ProcShapeCombine (client) register ClientPtr client; { WindowPtr pSrcWin, pDestWin; ScreenPtr pScreen; REQUEST(xShapeCombineReq); RegionPtr srcRgn; RegionPtr *destRgn; CreateDftPtr createDefault; CreateDftPtr createSrc; RegionPtr tmp; REQUEST_SIZE_MATCH (xShapeCombineReq); UpdateCurrentTime(); pDestWin = LookupWindow (stuff->dest, client); if (!pDestWin) return BadWindow; if (!pDestWin->optional) MakeWindowOptional (pDestWin); switch (stuff->destKind) { case ShapeBounding: createDefault = CreateBoundingShape; break; case ShapeClip: createDefault = CreateClipShape; break; case ShapeInput: createDefault = CreateBoundingShape; break; default: client->errorValue = stuff->destKind; return BadValue; } pScreen = pDestWin->drawable.pScreen; pSrcWin = LookupWindow (stuff->src, client); if (!pSrcWin) return BadWindow; switch (stuff->srcKind) { case ShapeBounding: srcRgn = wBoundingShape (pSrcWin); createSrc = CreateBoundingShape; break; case ShapeClip: srcRgn = wClipShape (pSrcWin); createSrc = CreateClipShape; break; case ShapeInput: srcRgn = wInputShape (pSrcWin); createSrc = CreateBoundingShape; break; default: client->errorValue = stuff->srcKind; return BadValue; } if (pSrcWin->drawable.pScreen != pScreen) { return BadMatch; } if (srcRgn) { tmp = RegionCreate((BoxPtr) 0, 0); RegionCopy(tmp, srcRgn); srcRgn = tmp; } else srcRgn = (*createSrc) (pSrcWin); if (!pDestWin->optional) MakeWindowOptional (pDestWin); switch (stuff->destKind) { case ShapeBounding: destRgn = &pDestWin->optional->boundingShape; break; case ShapeClip: destRgn = &pDestWin->optional->clipShape; break; case ShapeInput: destRgn = &pDestWin->optional->inputShape; break; default: return BadValue; } return RegionOperate (client, pDestWin, (int)stuff->destKind, destRgn, srcRgn, (int)stuff->op, stuff->xOff, stuff->yOff, createDefault); } #ifdef PANORAMIX static int ProcPanoramiXShapeCombine( register ClientPtr client) { REQUEST(xShapeCombineReq); PanoramiXRes *win, *win2; int j, result = 0; REQUEST_AT_LEAST_SIZE (xShapeCombineReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->dest, XRT_WINDOW, DixWriteAccess))) return BadWindow; if(!(win2 = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->src, XRT_WINDOW, DixReadAccess))) return BadWindow; FOR_NSCREENS(j) { stuff->dest = win->info[j].id; stuff->src = win2->info[j].id; result = ProcShapeCombine (client); BREAK_IF(result != Success); } return (result); } #endif /************* * ProcShapeOffset *************/ static int ProcShapeOffset (client) register ClientPtr client; { WindowPtr pWin; ScreenPtr pScreen; REQUEST(xShapeOffsetReq); RegionPtr srcRgn; REQUEST_SIZE_MATCH (xShapeOffsetReq); UpdateCurrentTime(); pWin = LookupWindow (stuff->dest, client); if (!pWin) return BadWindow; switch (stuff->destKind) { case ShapeBounding: srcRgn = wBoundingShape (pWin); break; case ShapeClip: srcRgn = wClipShape(pWin); break; case ShapeInput: srcRgn = wInputShape (pWin); break; default: client->errorValue = stuff->destKind; return BadValue; } pScreen = pWin->drawable.pScreen; if (srcRgn) { RegionTranslate(srcRgn, stuff->xOff, stuff->yOff); (*pScreen->SetShape) (pWin); } SendShapeNotify (pWin, (int)stuff->destKind); return Success; } #ifdef PANORAMIX static int ProcPanoramiXShapeOffset( register ClientPtr client) { REQUEST(xShapeOffsetReq); PanoramiXRes *win; int j, result = 0; REQUEST_AT_LEAST_SIZE (xShapeOffsetReq); if(!(win = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->dest, XRT_WINDOW, DixWriteAccess))) return BadWindow; FOR_NSCREENS(j) { stuff->dest = win->info[j].id; result = ProcShapeOffset (client); if(result != Success) break; } return (result); } #endif static int ProcShapeQueryExtents (client) register ClientPtr client; { REQUEST(xShapeQueryExtentsReq); WindowPtr pWin; xShapeQueryExtentsReply rep = {0}; BoxRec extents = {0}, *pExtents; RegionPtr region; REQUEST_SIZE_MATCH (xShapeQueryExtentsReq); memset(&rep, 0, sizeof(xShapeQueryExtentsReply)); pWin = LookupWindow (stuff->window, client); if (!pWin) return BadWindow; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.boundingShaped = (wBoundingShape(pWin) != 0); rep.clipShaped = (wClipShape(pWin) != 0); if ((region = wBoundingShape(pWin))) { /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */ pExtents = RegionExtents(region); extents = *pExtents; } else { extents.x1 = -wBorderWidth (pWin); extents.y1 = -wBorderWidth (pWin); extents.x2 = pWin->drawable.width + wBorderWidth (pWin); extents.y2 = pWin->drawable.height + wBorderWidth (pWin); } rep.xBoundingShape = extents.x1; rep.yBoundingShape = extents.y1; rep.widthBoundingShape = extents.x2 - extents.x1; rep.heightBoundingShape = extents.y2 - extents.y1; if ((region = wClipShape(pWin))) { /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */ pExtents = RegionExtents(region); extents = *pExtents; } else { extents.x1 = 0; extents.y1 = 0; extents.x2 = pWin->drawable.width; extents.y2 = pWin->drawable.height; } rep.xClipShape = extents.x1; rep.yClipShape = extents.y1; rep.widthClipShape = extents.x2 - extents.x1; rep.heightClipShape = extents.y2 - extents.y1; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.xBoundingShape); swaps(&rep.yBoundingShape); swaps(&rep.widthBoundingShape); swaps(&rep.heightBoundingShape); swaps(&rep.xClipShape); swaps(&rep.yClipShape); swaps(&rep.widthClipShape); swaps(&rep.heightClipShape); } WriteToClient(client, sizeof (xShapeQueryExtentsReply), &rep); return (client->noClientException); } /*ARGSUSED*/ static int ShapeFreeClient (data, id) void *data; XID id; { ShapeEventPtr pShapeEvent; WindowPtr pWin; ShapeEventPtr *pHead, pCur, pPrev; pShapeEvent = (ShapeEventPtr) data; pWin = pShapeEvent->window; pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, EventType); if (pHead) { pPrev = 0; for (pCur = *pHead; pCur && pCur != pShapeEvent; pCur=pCur->next) pPrev = pCur; if (pCur) { if (pPrev) pPrev->next = pShapeEvent->next; else *pHead = pShapeEvent->next; } } free ((void *) pShapeEvent); return 1; } /*ARGSUSED*/ static int ShapeFreeEvents (data, id) void *data; XID id; { ShapeEventPtr *pHead, pCur, pNext; pHead = (ShapeEventPtr *) data; for (pCur = *pHead; pCur; pCur = pNext) { pNext = pCur->next; FreeResource (pCur->clientResource, ClientType); free ((void *) pCur); } free ((void *) pHead); return 1; } static int ProcShapeSelectInput (client) register ClientPtr client; { REQUEST(xShapeSelectInputReq); WindowPtr pWin; ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead; XID clientResource; REQUEST_SIZE_MATCH (xShapeSelectInputReq); pWin = SecurityLookupWindow (stuff->window, client, DixWriteAccess); if (!pWin) return BadWindow; pHead = (ShapeEventPtr *)SecurityLookupIDByType(client, pWin->drawable.id, EventType, DixWriteAccess); switch (stuff->enable) { case xTrue: if (pHead) { /* check for existing entry. */ for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) { if (pShapeEvent->client == client) return Success; } } /* build the entry */ pNewShapeEvent = (ShapeEventPtr) malloc (sizeof (ShapeEventRec)); if (!pNewShapeEvent) return BadAlloc; pNewShapeEvent->next = 0; pNewShapeEvent->client = client; pNewShapeEvent->window = pWin; /* * add a resource that will be deleted when * the client goes away */ clientResource = FakeClientID (client->index); pNewShapeEvent->clientResource = clientResource; if (!AddResource (clientResource, ClientType, (void *)pNewShapeEvent)) return BadAlloc; /* * create a resource to contain a pointer to the list * of clients selecting input. This must be indirect as * the list may be arbitrarily rearranged which cannot be * done through the resource database. */ if (!pHead) { pHead = (ShapeEventPtr *) malloc (sizeof (ShapeEventPtr)); if (!pHead || !AddResource (pWin->drawable.id, EventType, (void *)pHead)) { FreeResource (clientResource, RT_NONE); return BadAlloc; } *pHead = 0; } pNewShapeEvent->next = *pHead; *pHead = pNewShapeEvent; break; case xFalse: /* delete the interest */ if (pHead) { pNewShapeEvent = 0; for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) { if (pShapeEvent->client == client) break; pNewShapeEvent = pShapeEvent; } if (pShapeEvent) { FreeResource (pShapeEvent->clientResource, ClientType); if (pNewShapeEvent) pNewShapeEvent->next = pShapeEvent->next; else *pHead = pShapeEvent->next; free (pShapeEvent); } } break; default: client->errorValue = stuff->enable; return BadValue; } return Success; } /* * deliver the event */ void SendShapeNotify (pWin, which) WindowPtr pWin; int which; { ShapeEventPtr *pHead, pShapeEvent; xShapeNotifyEvent se = {0}; BoxRec extents = {0}; RegionPtr region; BYTE shaped; pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, EventType); if (!pHead) return; switch (which) { case ShapeBounding: region = wBoundingShape(pWin); if (region) { extents = *RegionExtents(region); shaped = xTrue; } else { extents.x1 = -wBorderWidth (pWin); extents.y1 = -wBorderWidth (pWin); extents.x2 = pWin->drawable.width + wBorderWidth (pWin); extents.y2 = pWin->drawable.height + wBorderWidth (pWin); shaped = xFalse; } break; case ShapeClip: region = wClipShape(pWin); if (region) { extents = *RegionExtents(region); shaped = xTrue; } else { extents.x1 = 0; extents.y1 = 0; extents.x2 = pWin->drawable.width; extents.y2 = pWin->drawable.height; shaped = xFalse; } break; case ShapeInput: region = wInputShape(pWin); if (region) { extents = *RegionExtents(region); shaped = xTrue; } else { extents.x1 = -wBorderWidth (pWin); extents.y1 = -wBorderWidth (pWin); extents.x2 = pWin->drawable.width + wBorderWidth (pWin); extents.y2 = pWin->drawable.height + wBorderWidth (pWin); shaped = xFalse; } break; default: return; } for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) { se.type = ShapeNotify + ShapeEventBase; se.kind = which; se.window = pWin->drawable.id; se.x = extents.x1; se.y = extents.y1; se.width = extents.x2 - extents.x1; se.height = extents.y2 - extents.y1; se.time = currentTime.milliseconds; se.shaped = shaped; WriteEventsToClient (pShapeEvent->client, 1, (xEvent *) &se); } } static int ProcShapeInputSelected (client) register ClientPtr client; { REQUEST(xShapeInputSelectedReq); WindowPtr pWin; ShapeEventPtr pShapeEvent, *pHead; int enabled; xShapeInputSelectedReply rep = {0}; REQUEST_SIZE_MATCH (xShapeInputSelectedReq); pWin = LookupWindow (stuff->window, client); if (!pWin) return BadWindow; pHead = (ShapeEventPtr *) SecurityLookupIDByType(client, pWin->drawable.id, EventType, DixReadAccess); enabled = xFalse; if (pHead) { for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) { if (pShapeEvent->client == client) { enabled = xTrue; break; } } } rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.enabled = enabled; if (client->swapped) { swaps (&rep.sequenceNumber); swapl (&rep.length); } WriteToClient (client, sizeof (xShapeInputSelectedReply), &rep); return (client->noClientException); } static int ProcShapeGetRectangles (client) register ClientPtr client; { REQUEST(xShapeGetRectanglesReq); WindowPtr pWin; xShapeGetRectanglesReply rep = {0}; xRectangle *rects; int nrects, i; RegionPtr region; REQUEST_SIZE_MATCH(xShapeGetRectanglesReq); pWin = LookupWindow (stuff->window, client); if (!pWin) return BadWindow; switch (stuff->kind) { case ShapeBounding: region = wBoundingShape(pWin); break; case ShapeClip: region = wClipShape(pWin); break; case ShapeInput: region = wInputShape (pWin); break; default: client->errorValue = stuff->kind; return BadValue; } if (!region) { nrects = 1; rects = (xRectangle *) malloc (sizeof (xRectangle)); if (!rects) return BadAlloc; switch (stuff->kind) { case ShapeBounding: rects->x = - (int) wBorderWidth (pWin); rects->y = - (int) wBorderWidth (pWin); rects->width = pWin->drawable.width + wBorderWidth (pWin); rects->height = pWin->drawable.height + wBorderWidth (pWin); break; case ShapeClip: rects->x = 0; rects->y = 0; rects->width = pWin->drawable.width; rects->height = pWin->drawable.height; break; case ShapeInput: rects->x = - (int) wBorderWidth (pWin); rects->y = - (int) wBorderWidth (pWin); rects->width = pWin->drawable.width + wBorderWidth (pWin); rects->height = pWin->drawable.height + wBorderWidth (pWin); break; } } else { BoxPtr box; nrects = RegionNumRects(region); box = RegionRects(region); rects = (xRectangle *) malloc (nrects * sizeof (xRectangle)); if (!rects && nrects) return BadAlloc; for (i = 0; i < nrects; i++, box++) { rects[i].x = box->x1; rects[i].y = box->y1; rects[i].width = box->x2 - box->x1; rects[i].height = box->y2 - box->y1; } } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = (nrects * sizeof (xRectangle)) >> 2; rep.ordering = YXBanded; rep.nrects = nrects; if (client->swapped) { swaps (&rep.sequenceNumber); swapl (&rep.length); swapl (&rep.nrects); SwapShorts ((short *)rects, (unsigned long)nrects * 4); } WriteToClient (client, sizeof (rep), &rep); WriteToClient (client, nrects * sizeof (xRectangle), rects); free (rects); return client->noClientException; } static int ProcShapeDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_ShapeQueryVersion: return ProcShapeQueryVersion (client); case X_ShapeRectangles: #ifdef PANORAMIX if ( !noPanoramiXExtension ) return ProcPanoramiXShapeRectangles (client); else #endif return ProcShapeRectangles (client); case X_ShapeMask: #ifdef PANORAMIX if ( !noPanoramiXExtension ) return ProcPanoramiXShapeMask (client); else #endif return ProcShapeMask (client); case X_ShapeCombine: #ifdef PANORAMIX if ( !noPanoramiXExtension ) return ProcPanoramiXShapeCombine (client); else #endif return ProcShapeCombine (client); case X_ShapeOffset: #ifdef PANORAMIX if ( !noPanoramiXExtension ) return ProcPanoramiXShapeOffset (client); else #endif return ProcShapeOffset (client); case X_ShapeQueryExtents: return ProcShapeQueryExtents (client); case X_ShapeSelectInput: return ProcShapeSelectInput (client); case X_ShapeInputSelected: return ProcShapeInputSelected (client); case X_ShapeGetRectangles: return ProcShapeGetRectangles (client); default: return BadRequest; } } static void SShapeNotifyEvent(from, to) xShapeNotifyEvent *from, *to; { to->type = from->type; to->kind = from->kind; cpswapl (from->window, to->window); cpswaps (from->sequenceNumber, to->sequenceNumber); cpswaps (from->x, to->x); cpswaps (from->y, to->y); cpswaps (from->width, to->width); cpswaps (from->height, to->height); cpswapl (from->time, to->time); to->shaped = from->shaped; } static int SProcShapeQueryVersion (client) register ClientPtr client; { REQUEST (xShapeQueryVersionReq); swaps (&stuff->length); return ProcShapeQueryVersion (client); } static int SProcShapeRectangles (client) register ClientPtr client; { REQUEST (xShapeRectanglesReq); swaps (&stuff->length); REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq); swapl (&stuff->dest); swaps (&stuff->xOff); swaps (&stuff->yOff); SwapRestS(stuff); return ProcShapeRectangles (client); } static int SProcShapeMask (client) register ClientPtr client; { REQUEST (xShapeMaskReq); swaps (&stuff->length); REQUEST_SIZE_MATCH (xShapeMaskReq); swapl (&stuff->dest); swaps (&stuff->xOff); swaps (&stuff->yOff); swapl (&stuff->src); return ProcShapeMask (client); } static int SProcShapeCombine (client) register ClientPtr client; { REQUEST (xShapeCombineReq); swaps (&stuff->length); REQUEST_SIZE_MATCH (xShapeCombineReq); swapl (&stuff->dest); swaps (&stuff->xOff); swaps (&stuff->yOff); swapl (&stuff->src); return ProcShapeCombine (client); } static int SProcShapeOffset (client) register ClientPtr client; { REQUEST (xShapeOffsetReq); swaps (&stuff->length); REQUEST_SIZE_MATCH (xShapeOffsetReq); swapl (&stuff->dest); swaps (&stuff->xOff); swaps (&stuff->yOff); return ProcShapeOffset (client); } static int SProcShapeQueryExtents (client) register ClientPtr client; { REQUEST (xShapeQueryExtentsReq); swaps (&stuff->length); REQUEST_SIZE_MATCH (xShapeQueryExtentsReq); swapl (&stuff->window); return ProcShapeQueryExtents (client); } static int SProcShapeSelectInput (client) register ClientPtr client; { REQUEST (xShapeSelectInputReq); swaps (&stuff->length); REQUEST_SIZE_MATCH (xShapeSelectInputReq); swapl (&stuff->window); return ProcShapeSelectInput (client); } static int SProcShapeInputSelected (client) register ClientPtr client; { REQUEST (xShapeInputSelectedReq); swaps (&stuff->length); REQUEST_SIZE_MATCH (xShapeInputSelectedReq); swapl (&stuff->window); return ProcShapeInputSelected (client); } static int SProcShapeGetRectangles (client) register ClientPtr client; { REQUEST(xShapeGetRectanglesReq); swaps (&stuff->length); REQUEST_SIZE_MATCH(xShapeGetRectanglesReq); swapl (&stuff->window); return ProcShapeGetRectangles (client); } static int SProcShapeDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_ShapeQueryVersion: return SProcShapeQueryVersion (client); case X_ShapeRectangles: return SProcShapeRectangles (client); case X_ShapeMask: return SProcShapeMask (client); case X_ShapeCombine: return SProcShapeCombine (client); case X_ShapeOffset: return SProcShapeOffset (client); case X_ShapeQueryExtents: return SProcShapeQueryExtents (client); case X_ShapeSelectInput: return SProcShapeSelectInput (client); case X_ShapeInputSelected: return SProcShapeInputSelected (client); case X_ShapeGetRectangles: return SProcShapeGetRectangles (client); default: return BadRequest; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/shm.c0000644000000000000000000010160413614532331016460 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ********************************************************/ /* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */ #define SHM #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "resource.h" #include "scrnintstr.h" #include "windowstr.h" #include "pixmapstr.h" #include "gcstruct.h" #include "extnsionst.h" #include "servermd.h" #define _XSHM_SERVER_ #include #include #include "protocol-versions.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #endif typedef struct _ShmDesc { struct _ShmDesc *next; int shmid; int refcnt; char *addr; Bool writable; unsigned long size; } ShmDescRec, *ShmDescPtr; static void miShmPutImage(XSHM_PUT_IMAGE_ARGS); static void fbShmPutImage(XSHM_PUT_IMAGE_ARGS); static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS); static int ShmDetachSegment( void * /* value */, XID /* shmseg */ ); static void ShmResetProc( ExtensionEntry * /* extEntry */ ); static void SShmCompletionEvent( xShmCompletionEvent * /* from */, xShmCompletionEvent * /* to */ ); static Bool ShmDestroyPixmap (PixmapPtr pPixmap); static DISPATCH_PROC(ProcShmAttach); static DISPATCH_PROC(ProcShmCreatePixmap); static DISPATCH_PROC(ProcShmDetach); static DISPATCH_PROC(ProcShmDispatch); static DISPATCH_PROC(ProcShmGetImage); static DISPATCH_PROC(ProcShmPutImage); static DISPATCH_PROC(ProcShmQueryVersion); static DISPATCH_PROC(SProcShmAttach); static DISPATCH_PROC(SProcShmCreatePixmap); static DISPATCH_PROC(SProcShmDetach); static DISPATCH_PROC(SProcShmDispatch); static DISPATCH_PROC(SProcShmGetImage); static DISPATCH_PROC(SProcShmPutImage); static DISPATCH_PROC(SProcShmQueryVersion); static unsigned char ShmReqCode; int ShmCompletionCode; int BadShmSegCode; RESTYPE ShmSegType; static ShmDescPtr Shmsegs; static Bool sharedPixmaps; static int pixmapFormat; static int shmPixFormat[MAXSCREENS]; static ShmFuncsPtr shmFuncs[MAXSCREENS]; static DestroyPixmapProcPtr destroyPixmap[MAXSCREENS]; #ifdef PIXPRIV static int shmPixmapPrivate; #endif static ShmFuncs miFuncs = {NULL, miShmPutImage}; static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage}; #define VERIFY_SHMSEG(shmseg,shmdesc,client) \ { \ shmdesc = (ShmDescPtr)LookupIDByType(shmseg, ShmSegType); \ if (!shmdesc) \ { \ client->errorValue = shmseg; \ return BadShmSegCode; \ } \ } #define VERIFY_SHMPTR(shmseg,offset,needwrite,shmdesc,client) \ { \ VERIFY_SHMSEG(shmseg, shmdesc, client); \ if ((offset & 3) || (offset > shmdesc->size)) \ { \ client->errorValue = offset; \ return BadValue; \ } \ if (needwrite && !shmdesc->writable) \ return BadAccess; \ } #define VERIFY_SHMSIZE(shmdesc,offset,len,client) \ { \ if ((offset + len) > shmdesc->size) \ { \ return BadAccess; \ } \ } #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) static Bool badSysCall = FALSE; static void SigSysHandler(signo) int signo; { badSysCall = TRUE; } static Bool CheckForShmSyscall() { void (*oldHandler)(); int shmid = -1; /* If no SHM support in the kernel, the bad syscall will generate SIGSYS */ oldHandler = OsSignal(SIGSYS, SigSysHandler); badSysCall = FALSE; shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT); if (shmid != -1) { /* Successful allocation - clean up */ shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL); } else { /* Allocation failed */ badSysCall = TRUE; } OsSignal(SIGSYS, oldHandler); return(!badSysCall); } #define MUST_CHECK_FOR_SHM_SYSCALL #endif #ifndef NXAGENT_SERVER void ShmExtensionInit(void) { ExtensionEntry *extEntry; int i; #ifdef MUST_CHECK_FOR_SHM_SYSCALL if (!CheckForShmSyscall()) { ErrorF("MIT-SHM extension disabled due to lack of kernel support\n"); return; } #endif sharedPixmaps = xFalse; pixmapFormat = 0; { sharedPixmaps = xTrue; pixmapFormat = shmPixFormat[0]; for (i = 0; i < screenInfo.numScreens; i++) { if (!shmFuncs[i]) shmFuncs[i] = &miFuncs; if (!shmFuncs[i]->CreatePixmap) sharedPixmaps = xFalse; if (shmPixFormat[i] && (shmPixFormat[i] != pixmapFormat)) { sharedPixmaps = xFalse; pixmapFormat = 0; } } if (!pixmapFormat) pixmapFormat = ZPixmap; if (sharedPixmaps) { for (i = 0; i < screenInfo.numScreens; i++) { destroyPixmap[i] = screenInfo.screens[i]->DestroyPixmap; screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap; } #ifdef PIXPRIV shmPixmapPrivate = AllocatePixmapPrivateIndex(); for (i = 0; i < screenInfo.numScreens; i++) { if (!AllocatePixmapPrivate(screenInfo.screens[i], shmPixmapPrivate, 0)) return; } #endif } } ShmSegType = CreateNewResourceType(ShmDetachSegment); if (ShmSegType && (extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors, ProcShmDispatch, SProcShmDispatch, ShmResetProc, StandardMinorOpcode))) { ShmReqCode = (unsigned char)extEntry->base; ShmCompletionCode = extEntry->eventBase; BadShmSegCode = extEntry->errorBase; EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent; } } #endif /* NXAGENT_SERVER */ /*ARGSUSED*/ static void ShmResetProc (extEntry) ExtensionEntry *extEntry; { int i; for (i = 0; i < MAXSCREENS; i++) { shmFuncs[i] = (ShmFuncsPtr)NULL; shmPixFormat[i] = 0; } } void ShmRegisterFuncs( ScreenPtr pScreen, ShmFuncsPtr funcs) { shmFuncs[pScreen->myNum] = funcs; } void ShmSetPixmapFormat( ScreenPtr pScreen, int format) { shmPixFormat[pScreen->myNum] = format; } static Bool ShmDestroyPixmap (PixmapPtr pPixmap) { ScreenPtr pScreen = pPixmap->drawable.pScreen; Bool ret; if (pPixmap->refcnt == 1) { ShmDescPtr shmdesc; #ifdef PIXPRIV shmdesc = (ShmDescPtr) pPixmap->devPrivates[shmPixmapPrivate].ptr; #else char *base = (char *) pPixmap->devPrivate.ptr; if (base != (void *) (pPixmap + 1)) { for (shmdesc = Shmsegs; shmdesc; shmdesc = shmdesc->next) { if (shmdesc->addr <= base && base <= shmdesc->addr + shmdesc->size) break; } } else shmdesc = 0; #endif if (shmdesc) ShmDetachSegment ((void *) shmdesc, pPixmap->drawable.id); } pScreen->DestroyPixmap = destroyPixmap[pScreen->myNum]; ret = (*pScreen->DestroyPixmap) (pPixmap); destroyPixmap[pScreen->myNum] = pScreen->DestroyPixmap; pScreen->DestroyPixmap = ShmDestroyPixmap; return ret; } void ShmRegisterFbFuncs(pScreen) ScreenPtr pScreen; { shmFuncs[pScreen->myNum] = &fbFuncs; } static int ProcShmQueryVersion(client) register ClientPtr client; { xShmQueryVersionReply rep; REQUEST_SIZE_MATCH(xShmQueryVersionReq); memset(&rep, 0, sizeof(xShmQueryVersionReply)); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.sharedPixmaps = sharedPixmaps; rep.pixmapFormat = pixmapFormat; rep.majorVersion = SERVER_SHM_MAJOR_VERSION; rep.minorVersion = SERVER_SHM_MINOR_VERSION; rep.uid = geteuid(); rep.gid = getegid(); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.majorVersion); swaps(&rep.minorVersion); swaps(&rep.uid); swaps(&rep.gid); } WriteToClient(client, sizeof(xShmQueryVersionReply), &rep); return (client->noClientException); } /* * Simulate the access() system call for a shared memory segement, * using the credentials from the client if available */ static int shm_access(ClientPtr client, struct ipc_perm *perm, int readonly) { int uid, gid; mode_t mask; if (LocalClientCred(client, &uid, &gid) != -1) { /* User id 0 always gets access */ if (uid == 0) { return 0; } /* Check the owner */ if (perm->uid == uid || perm->cuid == uid) { mask = S_IRUSR; if (!readonly) { mask |= S_IWUSR; } return (perm->mode & mask) == mask ? 0 : -1; } /* Check the group */ if (perm->gid == gid || perm->cgid == gid) { mask = S_IRGRP; if (!readonly) { mask |= S_IWGRP; } return (perm->mode & mask) == mask ? 0 : -1; } } /* Otherwise, check everyone else */ mask = S_IROTH; if (!readonly) { mask |= S_IWOTH; } return (perm->mode & mask) == mask ? 0 : -1; } static int ProcShmAttach(client) register ClientPtr client; { struct shmid_ds buf; ShmDescPtr shmdesc; REQUEST(xShmAttachReq); REQUEST_SIZE_MATCH(xShmAttachReq); LEGAL_NEW_RESOURCE(stuff->shmseg, client); if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) { client->errorValue = stuff->readOnly; return(BadValue); } for (shmdesc = Shmsegs; shmdesc && (shmdesc->shmid != stuff->shmid); shmdesc = shmdesc->next) ; if (shmdesc) { if (!stuff->readOnly && !shmdesc->writable) return BadAccess; shmdesc->refcnt++; } else { shmdesc = (ShmDescPtr) malloc(sizeof(ShmDescRec)); if (!shmdesc) return BadAlloc; shmdesc->addr = shmat(stuff->shmid, 0, stuff->readOnly ? SHM_RDONLY : 0); if ((shmdesc->addr == ((char *)-1)) || shmctl(stuff->shmid, IPC_STAT, &buf)) { free(shmdesc); return BadAccess; } /* The attach was performed with root privs. We must * do manual checking of access rights for the credentials * of the client */ if (shm_access(client, &(buf.shm_perm), stuff->readOnly) == -1) { shmdt(shmdesc->addr); free(shmdesc); return BadAccess; } shmdesc->shmid = stuff->shmid; shmdesc->refcnt = 1; shmdesc->writable = !stuff->readOnly; shmdesc->size = buf.shm_segsz; shmdesc->next = Shmsegs; Shmsegs = shmdesc; } if (!AddResource(stuff->shmseg, ShmSegType, (void *)shmdesc)) return BadAlloc; return(client->noClientException); } /*ARGSUSED*/ static int ShmDetachSegment(value, shmseg) void * value; /* must conform to DeleteType */ XID shmseg; { ShmDescPtr shmdesc = (ShmDescPtr)value; ShmDescPtr *prev; if (--shmdesc->refcnt) return TRUE; shmdt(shmdesc->addr); for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next) ; *prev = shmdesc->next; free(shmdesc); return Success; } static int ProcShmDetach(client) register ClientPtr client; { ShmDescPtr shmdesc; REQUEST(xShmDetachReq); REQUEST_SIZE_MATCH(xShmDetachReq); VERIFY_SHMSEG(stuff->shmseg, shmdesc, client); FreeResource(stuff->shmseg, RT_NONE); return(client->noClientException); } static void #ifdef NXAGENT_SERVER xorg_miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) #else miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) #endif DrawablePtr dst; GCPtr pGC; int depth, w, h, sx, sy, sw, sh, dx, dy; unsigned int format; char *data; { PixmapPtr pmap; GCPtr putGC; putGC = GetScratchGC(depth, dst->pScreen); if (!putGC) return; pmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth, CREATE_PIXMAP_USAGE_SCRATCH); if (!pmap) { FreeScratchGC(putGC); return; } ValidateGC((DrawablePtr)pmap, putGC); (*putGC->ops->PutImage)((DrawablePtr)pmap, putGC, depth, -sx, -sy, w, h, 0, (format == XYPixmap) ? XYPixmap : ZPixmap, data); FreeScratchGC(putGC); if (format == XYBitmap) (void)(*pGC->ops->CopyPlane)((DrawablePtr)pmap, dst, pGC, 0, 0, sw, sh, dx, dy, 1L); else (void)(*pGC->ops->CopyArea)((DrawablePtr)pmap, dst, pGC, 0, 0, sw, sh, dx, dy); (*pmap->drawable.pScreen->DestroyPixmap)(pmap); } #ifndef NXAGENT_SERVER static void fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) DrawablePtr dst; GCPtr pGC; int depth, w, h, sx, sy, sw, sh, dx, dy; unsigned int format; char *data; { if ((format == ZPixmap) || (depth == 1)) { PixmapPtr pPixmap; pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth, BitsPerPixel(depth), PixmapBytePad(w, depth), (void *)data); if (!pPixmap) return; if (format == XYBitmap) (void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy, 1L); else (void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy); FreeScratchPixmapHeader(pPixmap); } else miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data); } #endif /* NXAGENT_SERVER */ #ifdef PANORAMIX static int ProcPanoramiXShmPutImage(register ClientPtr client) { int j, result = 0, orig_x, orig_y; PanoramiXRes *draw, *gc; Bool sendEvent, isRoot; REQUEST(xShmPutImageReq); REQUEST_SIZE_MATCH(xShmPutImageReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; orig_x = stuff->dstX; orig_y = stuff->dstY; sendEvent = stuff->sendEvent; stuff->sendEvent = 0; FOR_NSCREENS(j) { if(!j) stuff->sendEvent = sendEvent; stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; if (isRoot) { stuff->dstX = orig_x - panoramiXdataPtr[j].x; stuff->dstY = orig_y - panoramiXdataPtr[j].y; } result = ProcShmPutImage(client); if(result != client->noClientException) break; } return(result); } static int ProcPanoramiXShmGetImage(ClientPtr client) { PanoramiXRes *draw; DrawablePtr drawables[MAXSCREENS]; DrawablePtr pDraw; xShmGetImageReply xgi; ShmDescPtr shmdesc; int i, x, y, w, h, format; Mask plane = 0, planemask; long lenPer = 0, length, widthBytesLine; Bool isRoot; REQUEST(xShmGetImageReq); REQUEST_SIZE_MATCH(xShmGetImageReq); if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) { client->errorValue = stuff->format; return(BadValue); } if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if (draw->type == XRT_PIXMAP) return ProcShmGetImage(client); VERIFY_DRAWABLE(pDraw, stuff->drawable, client); VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); x = stuff->x; y = stuff->y; w = stuff->width; h = stuff->height; format = stuff->format; planemask = stuff->planeMask; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; if(isRoot) { if( /* check for being onscreen */ x < 0 || x + w > PanoramiXPixWidth || y < 0 || y + h > PanoramiXPixHeight ) return(BadMatch); } else { if( /* check for being onscreen */ panoramiXdataPtr[0].x + pDraw->x + x < 0 || panoramiXdataPtr[0].x + pDraw->x + x + w > PanoramiXPixWidth || panoramiXdataPtr[0].y + pDraw->y + y < 0 || panoramiXdataPtr[0].y + pDraw->y + y + h > PanoramiXPixHeight || /* check for being inside of border */ x < - wBorderWidth((WindowPtr)pDraw) || x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width || y < -wBorderWidth((WindowPtr)pDraw) || y + h > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height) return(BadMatch); } drawables[0] = pDraw; for(i = 1; i < PanoramiXNumScreens; i++) VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client); memset(&xgi, 0, sizeof(xShmGetImageReply)); xgi.visual = wVisual(((WindowPtr)pDraw)); xgi.type = X_Reply; xgi.length = 0; xgi.sequenceNumber = client->sequence; xgi.depth = pDraw->depth; if(format == ZPixmap) { widthBytesLine = PixmapBytePad(w, pDraw->depth); length = widthBytesLine * h; } else { widthBytesLine = PixmapBytePad(w, 1); lenPer = widthBytesLine * h; plane = ((Mask)1) << (pDraw->depth - 1); length = lenPer * Ones(planemask & (plane | (plane - 1))); } VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client); xgi.size = length; if (length == 0) {/* nothing to do */ } else if (format == ZPixmap) { XineramaGetImageData(drawables, x, y, w, h, format, planemask, shmdesc->addr + stuff->offset, widthBytesLine, isRoot); } else { length = stuff->offset; for (; plane; plane >>= 1) { if (planemask & plane) { XineramaGetImageData(drawables, x, y, w, h, format, plane, shmdesc->addr + length, widthBytesLine, isRoot); length += lenPer; } } } if (client->swapped) { swaps(&xgi.sequenceNumber); swapl(&xgi.length); swapl(&xgi.visual); swapl(&xgi.size); } WriteToClient(client, sizeof(xShmGetImageReply), &xgi); return(client->noClientException); } static int ProcPanoramiXShmCreatePixmap( register ClientPtr client) { ScreenPtr pScreen = NULL; PixmapPtr pMap = NULL; DrawablePtr pDraw; DepthPtr pDepth; int i, j, result; ShmDescPtr shmdesc; REQUEST(xShmCreatePixmapReq); unsigned int width, height, depth; unsigned long size; PanoramiXRes *newPix; REQUEST_SIZE_MATCH(xShmCreatePixmapReq); client->errorValue = stuff->pid; if (!sharedPixmaps) return BadImplementation; LEGAL_NEW_RESOURCE(stuff->pid, client); VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client); VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); width = stuff->width; height = stuff->height; depth = stuff->depth; if (!width || !height || !depth) { client->errorValue = 0; return BadValue; } if (width > 32767 || height > 32767) return BadAlloc; if (stuff->depth != 1) { pDepth = pDraw->pScreen->allowedDepths; for (i=0; ipScreen->numDepths; i++, pDepth++) if (pDepth->depth == stuff->depth) goto CreatePmap; client->errorValue = stuff->depth; return BadValue; } CreatePmap: size = PixmapBytePad(width, depth) * height; if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) { if (size < width * height) return BadAlloc; } /* thankfully, offset is unsigned */ if (stuff->offset + size < size) return BadAlloc; VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client); if(!(newPix = (PanoramiXRes *) malloc(sizeof(PanoramiXRes)))) return BadAlloc; newPix->type = XRT_PIXMAP; newPix->u.pix.shared = TRUE; newPix->info[0].id = stuff->pid; for(j = 1; j < PanoramiXNumScreens; j++) newPix->info[j].id = FakeClientID(client->index); result = (client->noClientException); FOR_NSCREENS(j) { pScreen = screenInfo.screens[j]; pMap = (*shmFuncs[j]->CreatePixmap)(pScreen, stuff->width, stuff->height, stuff->depth, shmdesc->addr + stuff->offset); if (pMap) { #ifdef PIXPRIV pMap->devPrivates[shmPixmapPrivate].ptr = (void *) shmdesc; #endif shmdesc->refcnt++; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = newPix->info[j].id; if (!AddResource(newPix->info[j].id, RT_PIXMAP, (void *)pMap)) { (*pScreen->DestroyPixmap)(pMap); result = BadAlloc; break; } } else { result = BadAlloc; break; } } if(result == BadAlloc) { while(j--) { (*pScreen->DestroyPixmap)(pMap); FreeResource(newPix->info[j].id, RT_NONE); } free(newPix); } else AddResource(stuff->pid, XRT_PIXMAP, newPix); return result; } #endif #ifndef NXAGENT_SERVER static int ProcShmPutImage(client) register ClientPtr client; { GCPtr pGC; DrawablePtr pDraw; long length; ShmDescPtr shmdesc; REQUEST(xShmPutImageReq); REQUEST_SIZE_MATCH(xShmPutImageReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client); if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse)) return BadValue; if (stuff->format == XYBitmap) { if (stuff->depth != 1) return BadMatch; length = PixmapBytePad(stuff->totalWidth, 1); } else if (stuff->format == XYPixmap) { if (pDraw->depth != stuff->depth) return BadMatch; length = PixmapBytePad(stuff->totalWidth, 1); length *= stuff->depth; } else if (stuff->format == ZPixmap) { if (pDraw->depth != stuff->depth) return BadMatch; length = PixmapBytePad(stuff->totalWidth, stuff->depth); } else { client->errorValue = stuff->format; return BadValue; } /* * There's a potential integer overflow in this check: * VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight, * client); * the version below ought to avoid it */ if (stuff->totalHeight != 0 && length > (shmdesc->size - stuff->offset)/stuff->totalHeight) { client->errorValue = stuff->totalWidth; return BadValue; } if (stuff->srcX > stuff->totalWidth) { client->errorValue = stuff->srcX; return BadValue; } if (stuff->srcY > stuff->totalHeight) { client->errorValue = stuff->srcY; return BadValue; } if ((stuff->srcX + stuff->srcWidth) > stuff->totalWidth) { client->errorValue = stuff->srcWidth; return BadValue; } if ((stuff->srcY + stuff->srcHeight) > stuff->totalHeight) { client->errorValue = stuff->srcHeight; return BadValue; } if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) || ((stuff->format != ZPixmap) && (stuff->srcX < screenInfo.bitmapScanlinePad) && ((stuff->format == XYBitmap) || ((stuff->srcY == 0) && (stuff->srcHeight == stuff->totalHeight))))) && ((stuff->srcX + stuff->srcWidth) == stuff->totalWidth)) (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY, stuff->totalWidth, stuff->srcHeight, stuff->srcX, stuff->format, shmdesc->addr + stuff->offset + (stuff->srcY * length)); else (*shmFuncs[pDraw->pScreen->myNum]->PutImage)( pDraw, pGC, stuff->depth, stuff->format, stuff->totalWidth, stuff->totalHeight, stuff->srcX, stuff->srcY, stuff->srcWidth, stuff->srcHeight, stuff->dstX, stuff->dstY, shmdesc->addr + stuff->offset); if (stuff->sendEvent) { xShmCompletionEvent ev; memset(&ev, 0, sizeof(xShmCompletionEvent)); ev.type = ShmCompletionCode; ev.drawable = stuff->drawable; ev.minorEvent = X_ShmPutImage; ev.majorEvent = ShmReqCode; ev.shmseg = stuff->shmseg; ev.offset = stuff->offset; WriteEventsToClient(client, 1, (xEvent *) &ev); } return (client->noClientException); } #endif /* NXAGENT_SERVER */ static int ProcShmGetImage(client) register ClientPtr client; { DrawablePtr pDraw; long lenPer = 0, length; Mask plane = 0; xShmGetImageReply xgi; ShmDescPtr shmdesc; REQUEST(xShmGetImageReq); REQUEST_SIZE_MATCH(xShmGetImageReq); if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) { client->errorValue = stuff->format; return(BadValue); } VERIFY_DRAWABLE(pDraw, stuff->drawable, client); VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); memset(&xgi, 0, sizeof(xShmGetImageReply)); if (pDraw->type == DRAWABLE_WINDOW) { if( /* check for being viewable */ !((WindowPtr) pDraw)->realized || /* check for being on screen */ pDraw->x + stuff->x < 0 || pDraw->x + stuff->x + (int)stuff->width > pDraw->pScreen->width || pDraw->y + stuff->y < 0 || pDraw->y + stuff->y + (int)stuff->height > pDraw->pScreen->height || /* check for being inside of border */ stuff->x < - wBorderWidth((WindowPtr)pDraw) || stuff->x + (int)stuff->width > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width || stuff->y < -wBorderWidth((WindowPtr)pDraw) || stuff->y + (int)stuff->height > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->height ) return(BadMatch); xgi.visual = wVisual(((WindowPtr)pDraw)); } else { if (stuff->x < 0 || stuff->x+(int)stuff->width > pDraw->width || stuff->y < 0 || stuff->y+(int)stuff->height > pDraw->height ) return(BadMatch); xgi.visual = None; } xgi.type = X_Reply; xgi.length = 0; xgi.sequenceNumber = client->sequence; xgi.depth = pDraw->depth; if(stuff->format == ZPixmap) { length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height; } else { lenPer = PixmapBytePad(stuff->width, 1) * stuff->height; plane = ((Mask)1) << (pDraw->depth - 1); /* only planes asked for */ length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1))); } VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client); xgi.size = length; if (length == 0) { /* nothing to do */ } else if (stuff->format == ZPixmap) { (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, stuff->width, stuff->height, stuff->format, stuff->planeMask, shmdesc->addr + stuff->offset); } else { length = stuff->offset; for (; plane; plane >>= 1) { if (stuff->planeMask & plane) { (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, stuff->width, stuff->height, stuff->format, plane, shmdesc->addr + length); length += lenPer; } } } if (client->swapped) { swaps(&xgi.sequenceNumber); swapl(&xgi.length); swapl(&xgi.visual); swapl(&xgi.size); } WriteToClient(client, sizeof(xShmGetImageReply), &xgi); return(client->noClientException); } #ifndef NXAGENT_SERVER static PixmapPtr fbShmCreatePixmap (pScreen, width, height, depth, addr) ScreenPtr pScreen; int width; int height; int depth; char *addr; { register PixmapPtr pPixmap; pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0); if (!pPixmap) return NullPixmap; if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth, BitsPerPixel(depth), PixmapBytePad(width, depth), (void *)addr)) { (*pScreen->DestroyPixmap)(pPixmap); return NullPixmap; } return pPixmap; } #endif /* NXAGENT_SERVER */ static int ProcShmCreatePixmap(client) register ClientPtr client; { PixmapPtr pMap; DrawablePtr pDraw; DepthPtr pDepth; register int i; ShmDescPtr shmdesc; REQUEST(xShmCreatePixmapReq); unsigned int width, height, depth; unsigned long size; REQUEST_SIZE_MATCH(xShmCreatePixmapReq); client->errorValue = stuff->pid; if (!sharedPixmaps) return BadImplementation; LEGAL_NEW_RESOURCE(stuff->pid, client); VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client); VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); width = stuff->width; height = stuff->height; depth = stuff->depth; if (!width || !height || !depth) { client->errorValue = 0; return BadValue; } if (width > 32767 || height > 32767) return BadAlloc; if (stuff->depth != 1) { pDepth = pDraw->pScreen->allowedDepths; for (i=0; ipScreen->numDepths; i++, pDepth++) if (pDepth->depth == stuff->depth) goto CreatePmap; client->errorValue = stuff->depth; return BadValue; } CreatePmap: size = PixmapBytePad(width, depth) * height; if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) { if (size < width * height) return BadAlloc; /* thankfully, offset is unsigned */ if (stuff->offset + size < size) return BadAlloc; } VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client); pMap = (*shmFuncs[pDraw->pScreen->myNum]->CreatePixmap)( pDraw->pScreen, stuff->width, stuff->height, stuff->depth, shmdesc->addr + stuff->offset); if (pMap) { #ifdef PIXPRIV pMap->devPrivates[shmPixmapPrivate].ptr = (void *) shmdesc; #endif shmdesc->refcnt++; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = stuff->pid; if (AddResource(stuff->pid, RT_PIXMAP, (void *)pMap)) { return(client->noClientException); } } return (BadAlloc); } static int #ifdef NXAGENT_SERVER xorg_ProcShmDispatch (client) #else ProcShmDispatch (client) #endif register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_ShmQueryVersion: return ProcShmQueryVersion(client); case X_ShmAttach: return ProcShmAttach(client); case X_ShmDetach: return ProcShmDetach(client); case X_ShmPutImage: #ifdef PANORAMIX if ( !noPanoramiXExtension ) return ProcPanoramiXShmPutImage(client); #endif return ProcShmPutImage(client); case X_ShmGetImage: #ifdef PANORAMIX if ( !noPanoramiXExtension ) return ProcPanoramiXShmGetImage(client); #endif return ProcShmGetImage(client); case X_ShmCreatePixmap: #ifdef PANORAMIX if ( !noPanoramiXExtension ) return ProcPanoramiXShmCreatePixmap(client); #endif return ProcShmCreatePixmap(client); default: return BadRequest; } } static void SShmCompletionEvent(from, to) xShmCompletionEvent *from, *to; { to->type = from->type; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->drawable, to->drawable); cpswaps(from->minorEvent, to->minorEvent); to->majorEvent = from->majorEvent; cpswapl(from->shmseg, to->shmseg); cpswapl(from->offset, to->offset); } static int SProcShmQueryVersion(client) register ClientPtr client; { REQUEST(xShmQueryVersionReq); swaps(&stuff->length); return ProcShmQueryVersion(client); } static int SProcShmAttach(client) ClientPtr client; { REQUEST(xShmAttachReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xShmAttachReq); swapl(&stuff->shmseg); swapl(&stuff->shmid); return ProcShmAttach(client); } static int SProcShmDetach(client) ClientPtr client; { REQUEST(xShmDetachReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xShmDetachReq); swapl(&stuff->shmseg); return ProcShmDetach(client); } static int SProcShmPutImage(client) ClientPtr client; { REQUEST(xShmPutImageReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xShmPutImageReq); swapl(&stuff->drawable); swapl(&stuff->gc); swaps(&stuff->totalWidth); swaps(&stuff->totalHeight); swaps(&stuff->srcX); swaps(&stuff->srcY); swaps(&stuff->srcWidth); swaps(&stuff->srcHeight); swaps(&stuff->dstX); swaps(&stuff->dstY); swapl(&stuff->shmseg); swapl(&stuff->offset); return ProcShmPutImage(client); } static int SProcShmGetImage(client) ClientPtr client; { REQUEST(xShmGetImageReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xShmGetImageReq); swapl(&stuff->drawable); swaps(&stuff->x); swaps(&stuff->y); swaps(&stuff->width); swaps(&stuff->height); swapl(&stuff->planeMask); swapl(&stuff->shmseg); swapl(&stuff->offset); return ProcShmGetImage(client); } static int SProcShmCreatePixmap(client) ClientPtr client; { REQUEST(xShmCreatePixmapReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xShmCreatePixmapReq); swapl(&stuff->pid); swapl(&stuff->drawable); swaps(&stuff->width); swaps(&stuff->height); swapl(&stuff->shmseg); swapl(&stuff->offset); return ProcShmCreatePixmap(client); } static int #ifdef NXAGENT_SERVER xorg_SProcShmDispatch (client) #else SProcShmDispatch (client) #endif register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_ShmQueryVersion: return SProcShmQueryVersion(client); case X_ShmAttach: return SProcShmAttach(client); case X_ShmDetach: return SProcShmDetach(client); case X_ShmPutImage: return SProcShmPutImage(client); case X_ShmGetImage: return SProcShmGetImage(client); case X_ShmCreatePixmap: return SProcShmCreatePixmap(client); default: return BadRequest; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/shmint.h0000644000000000000000000000274213614532331017203 0ustar /* * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef _SHMINT_H_ #define _SHMINT_H_ #define _XSHM_SERVER_ #include #include "screenint.h" #include "pixmap.h" #include "gc.h" void ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs); void ShmSetPixmapFormat(ScreenPtr pScreen, int format); void ShmRegisterFbFuncs(ScreenPtr pScreen); #endif /* _SHMINT_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/sleepuntil.c0000644000000000000000000001407413614532331020061 0ustar /* * Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * * Author: Keith Packard, MIT X Consortium */ /* dixsleep.c - implement millisecond timeouts for X clients */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "sleepuntil.h" #include #include #include "misc.h" #include "windowstr.h" #include "dixstruct.h" #include "pixmapstr.h" #include "scrnintstr.h" typedef struct _Sertafied { struct _Sertafied *next; TimeStamp revive; ClientPtr pClient; XID id; void (*notifyFunc)( ClientPtr /* client */, void * /* closure */ ); void *closure; } SertafiedRec, *SertafiedPtr; static SertafiedPtr pPending; static RESTYPE SertafiedResType; static Bool BlockHandlerRegistered; static int SertafiedGeneration; static void ClientAwaken( ClientPtr /* client */, void * /* closure */ ); static int SertafiedDelete( void * /* value */, XID /* id */ ); static void SertafiedBlockHandler( void * /* data */, OSTimePtr /* wt */, void * /* LastSelectMask */ ); static void SertafiedWakeupHandler( void * /* data */, int /* i */, void * /* LastSelectMask */ ); _X_EXPORT int ClientSleepUntil (client, revive, notifyFunc, closure) ClientPtr client; TimeStamp *revive; void (*notifyFunc)( ClientPtr /* client */, void * /* closure */); void *closure; { SertafiedPtr pRequest, pReq, pPrev; if (SertafiedGeneration != serverGeneration) { SertafiedResType = CreateNewResourceType (SertafiedDelete); if (!SertafiedResType) return FALSE; SertafiedGeneration = serverGeneration; BlockHandlerRegistered = FALSE; } pRequest = (SertafiedPtr) malloc (sizeof (SertafiedRec)); if (!pRequest) return FALSE; pRequest->pClient = client; pRequest->revive = *revive; pRequest->id = FakeClientID (client->index); pRequest->closure = closure; if (!BlockHandlerRegistered) { if (!RegisterBlockAndWakeupHandlers (SertafiedBlockHandler, SertafiedWakeupHandler, (void *) 0)) { free (pRequest); return FALSE; } BlockHandlerRegistered = TRUE; } pRequest->notifyFunc = 0; if (!AddResource (pRequest->id, SertafiedResType, (void *) pRequest)) return FALSE; if (!notifyFunc) notifyFunc = ClientAwaken; pRequest->notifyFunc = notifyFunc; /* Insert into time-ordered queue, with earliest activation time coming first. */ pPrev = 0; for (pReq = pPending; pReq; pReq = pReq->next) { if (CompareTimeStamps (pReq->revive, *revive) == LATER) break; pPrev = pReq; } if (pPrev) pPrev->next = pRequest; else pPending = pRequest; pRequest->next = pReq; IgnoreClient (client); return TRUE; } static void ClientAwaken (client, closure) ClientPtr client; void *closure; { if (!client->clientGone) AttendClient (client); } static int SertafiedDelete (value, id) void * value; XID id; { SertafiedPtr pRequest = (SertafiedPtr)value; SertafiedPtr pReq, pPrev; pPrev = 0; for (pReq = pPending; pReq; pPrev = pReq, pReq = pReq->next) if (pReq == pRequest) { if (pPrev) pPrev->next = pReq->next; else pPending = pReq->next; break; } if (pRequest->notifyFunc) (*pRequest->notifyFunc) (pRequest->pClient, pRequest->closure); free (pRequest); return TRUE; } static void SertafiedBlockHandler (data, wt, LastSelectMask) void *data; /* unused */ OSTimePtr wt; /* wait time */ void *LastSelectMask; { SertafiedPtr pReq, pNext; unsigned long delay; TimeStamp now; if (!pPending) return; now.milliseconds = GetTimeInMillis (); now.months = currentTime.months; if ((int) (now.milliseconds - currentTime.milliseconds) < 0) now.months++; for (pReq = pPending; pReq; pReq = pNext) { pNext = pReq->next; if (CompareTimeStamps (pReq->revive, now) == LATER) break; FreeResource (pReq->id, RT_NONE); /* AttendClient() may have been called via the resource delete * function so a client may have input to be processed and so * set delay to 0 to prevent blocking in WaitForSomething(). */ AdjustWaitForDelay (wt, 0); } pReq = pPending; if (!pReq) return; delay = pReq->revive.milliseconds - now.milliseconds; AdjustWaitForDelay (wt, delay); } static void SertafiedWakeupHandler (data, i, LastSelectMask) void * data; int i; void * LastSelectMask; { SertafiedPtr pReq, pNext; TimeStamp now; now.milliseconds = GetTimeInMillis (); now.months = currentTime.months; if ((int) (now.milliseconds - currentTime.milliseconds) < 0) now.months++; for (pReq = pPending; pReq; pReq = pNext) { pNext = pReq->next; if (CompareTimeStamps (pReq->revive, now) == LATER) break; FreeResource (pReq->id, RT_NONE); } if (!pPending) { RemoveBlockAndWakeupHandlers (SertafiedBlockHandler, SertafiedWakeupHandler, (void *) 0); BlockHandlerRegistered = FALSE; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/sleepuntil.h0000644000000000000000000000323613614532331020064 0ustar /* * Copyright (C) 2001 The XFree86 Project, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project shall * not be used in advertising or otherwise to promote the sale, use or other * dealings in this Software without prior written authorization from the * XFree86 Project. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _SLEEPUNTIL_H_ #define _SLEEPUNTIL_H_ 1 #include "dix.h" extern int ClientSleepUntil( ClientPtr client, TimeStamp *revive, void (*notifyFunc)( ClientPtr /* client */, void * /* closure */ ), void * Closure ); #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/sync.c0000644000000000000000000020324013614532331016644 0ustar /* Copyright 1991, 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1991, 1993 by Digital Equipment Corporation, Maynard, Massachusetts, and Olivetti Research Limited, Cambridge, England. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Olivetti not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Digital and Olivetti make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include "misc.h" #include "os.h" #include "extnsionst.h" #include "dixstruct.h" #include "resource.h" #include "opaque.h" #define _SYNC_SERVER #include #include #include "protocol-versions.h" #include #include /* * Local Global Variables */ static int SyncEventBase; static int SyncErrorBase; static RESTYPE RTCounter = 0; static RESTYPE RTAwait; static RESTYPE RTAlarm; static RESTYPE RTAlarmClient; static int SyncNumSystemCounters = 0; static SyncCounter **SysCounterList = NULL; #define IsSystemCounter(pCounter) \ (pCounter && (pCounter->client == NULL)) /* these are all the alarm attributes that pertain to the alarm's trigger */ #define XSyncCAAllTrigger \ (XSyncCACounter | XSyncCAValueType | XSyncCAValue | XSyncCATestType) static int FreeAlarm( void * /* addr */, XID /* id */ ); static int FreeAlarmClient( void * /* value */, XID /* id */ ); static int FreeAwait( void * /* addr */, XID /* id */ ); static void ServertimeBracketValues( void * /* pCounter */, CARD64 * /* pbracket_less */, CARD64 * /* pbracket_greater */ ); static void ServertimeQueryValue( void * /* pCounter */, CARD64 * /* pValue_return */ ); static void ServertimeWakeupHandler( void * /* env */, int /* rc */, void * /* LastSelectMask */ ); static int SyncInitTrigger( ClientPtr /* client */, SyncTrigger * /* pTrigger */, XSyncCounter /* counter */, Mask /* changes */ ); static void SAlarmNotifyEvent( xSyncAlarmNotifyEvent * /* from */, xSyncAlarmNotifyEvent * /* to */ ); static void SCounterNotifyEvent( xSyncCounterNotifyEvent * /* from */, xSyncCounterNotifyEvent * /* to */ ); static void ServertimeBlockHandler( void * /* env */, struct timeval ** /* wt */, void * /* LastSelectMask */ ); static int SyncAddTriggerToCounter( SyncTrigger * /* pTrigger */ ); extern void SyncAlarmCounterDestroyed( SyncTrigger * /* pTrigger */ ); static void SyncAlarmTriggerFired( SyncTrigger * /* pTrigger */ ); static void SyncAwaitTriggerFired( SyncTrigger * /* pTrigger */ ); static int SyncChangeAlarmAttributes( ClientPtr /* client */, SyncAlarm * /* pAlarm */, Mask /* mask */, CARD32 * /* values */ ); static Bool SyncCheckTriggerNegativeComparison( SyncTrigger * /* pTrigger */, CARD64 /* oldval */ ); static Bool SyncCheckTriggerNegativeTransition( SyncTrigger * /* pTrigger */, CARD64 /* oldval */ ); static Bool SyncCheckTriggerPositiveComparison( SyncTrigger * /* pTrigger */, CARD64 /* oldval */ ); static Bool SyncCheckTriggerPositiveTransition( SyncTrigger * /* pTrigger */, CARD64 /* oldval */ ); static SyncCounter * SyncCreateCounter( ClientPtr /* client */, XSyncCounter /* id */, CARD64 /* initialvalue */ ); static void SyncComputeBracketValues( SyncCounter * /* pCounter */, Bool /* startOver */ ); static void SyncDeleteTriggerFromCounter( SyncTrigger * /* pTrigger */ ); static Bool SyncEventSelectForAlarm( SyncAlarm * /* pAlarm */, ClientPtr /* client */, Bool /* wantevents */ ); static void SyncInitServerTime( void ); static void SyncInitIdleTime( void ); static void SyncResetProc( ExtensionEntry * /* extEntry */ ); static void SyncSendAlarmNotifyEvents( SyncAlarm * /* pAlarm */ ); static void SyncSendCounterNotifyEvents( ClientPtr /* client */, SyncAwait ** /* ppAwait */, int /* num_events */ ); static DISPATCH_PROC(ProcSyncAwait); static DISPATCH_PROC(ProcSyncChangeAlarm); static DISPATCH_PROC(ProcSyncChangeCounter); static DISPATCH_PROC(ProcSyncCreateAlarm); static DISPATCH_PROC(ProcSyncCreateCounter); static DISPATCH_PROC(ProcSyncDestroyAlarm); static DISPATCH_PROC(ProcSyncDestroyCounter); static DISPATCH_PROC(ProcSyncDispatch); static DISPATCH_PROC(ProcSyncGetPriority); static DISPATCH_PROC(ProcSyncInitialize); static DISPATCH_PROC(ProcSyncListSystemCounters); static DISPATCH_PROC(ProcSyncQueryAlarm); static DISPATCH_PROC(ProcSyncQueryCounter); static DISPATCH_PROC(ProcSyncSetCounter); static DISPATCH_PROC(ProcSyncSetPriority); static DISPATCH_PROC(SProcSyncAwait); static DISPATCH_PROC(SProcSyncChangeAlarm); static DISPATCH_PROC(SProcSyncChangeCounter); static DISPATCH_PROC(SProcSyncCreateAlarm); static DISPATCH_PROC(SProcSyncCreateCounter); static DISPATCH_PROC(SProcSyncDestroyAlarm); static DISPATCH_PROC(SProcSyncDestroyCounter); static DISPATCH_PROC(SProcSyncDispatch); static DISPATCH_PROC(SProcSyncGetPriority); static DISPATCH_PROC(SProcSyncInitialize); static DISPATCH_PROC(SProcSyncListSystemCounters); static DISPATCH_PROC(SProcSyncQueryAlarm); static DISPATCH_PROC(SProcSyncQueryCounter); static DISPATCH_PROC(SProcSyncSetCounter); static DISPATCH_PROC(SProcSyncSetPriority); /* Each counter maintains a simple linked list of triggers that are * interested in the counter. The two functions below are used to * delete and add triggers on this list. */ static void SyncDeleteTriggerFromCounter(pTrigger) SyncTrigger *pTrigger; { SyncTriggerList *pCur; SyncTriggerList *pPrev; /* pCounter needs to be stored in pTrigger before calling here. */ if (!pTrigger->pCounter) return; pPrev = NULL; pCur = pTrigger->pCounter->pTriglist; while (pCur) { if (pCur->pTrigger == pTrigger) { if (pPrev) pPrev->next = pCur->next; else pTrigger->pCounter->pTriglist = pCur->next; free(pCur); break; } pPrev = pCur; pCur = pCur->next; } if (IsSystemCounter(pTrigger->pCounter)) SyncComputeBracketValues(pTrigger->pCounter, /*startOver*/ TRUE); } static int SyncAddTriggerToCounter(pTrigger) SyncTrigger *pTrigger; { SyncTriggerList *pCur; if (!pTrigger->pCounter) return Success; /* don't do anything if it's already there */ for (pCur = pTrigger->pCounter->pTriglist; pCur; pCur = pCur->next) { if (pCur->pTrigger == pTrigger) return Success; } if (!(pCur = (SyncTriggerList *)malloc(sizeof(SyncTriggerList)))) return BadAlloc; pCur->pTrigger = pTrigger; pCur->next = pTrigger->pCounter->pTriglist; pTrigger->pCounter->pTriglist = pCur; if (IsSystemCounter(pTrigger->pCounter)) SyncComputeBracketValues(pTrigger->pCounter, /*startOver*/ TRUE); return Success; } /* Below are four possible functions that can be plugged into * pTrigger->CheckTrigger, corresponding to the four possible * test-types. These functions are called after the counter's * value changes but are also passed the old counter value * so they can inspect both the old and new values. * (PositiveTransition and NegativeTransition need to see both * pieces of information.) These functions return the truth value * of the trigger. * * All of them include the condition pTrigger->pCounter == NULL. * This is because the spec says that a trigger with a counter value * of None is always TRUE. */ static Bool SyncCheckTriggerPositiveComparison(pTrigger, oldval) SyncTrigger *pTrigger; CARD64 oldval; { return (pTrigger->pCounter == NULL || XSyncValueGreaterOrEqual(pTrigger->pCounter->value, pTrigger->test_value)); } static Bool SyncCheckTriggerNegativeComparison(pTrigger, oldval) SyncTrigger *pTrigger; CARD64 oldval; { return (pTrigger->pCounter == NULL || XSyncValueLessOrEqual(pTrigger->pCounter->value, pTrigger->test_value)); } static Bool SyncCheckTriggerPositiveTransition(pTrigger, oldval) SyncTrigger *pTrigger; CARD64 oldval; { return (pTrigger->pCounter == NULL || (XSyncValueLessThan(oldval, pTrigger->test_value) && XSyncValueGreaterOrEqual(pTrigger->pCounter->value, pTrigger->test_value))); } static Bool SyncCheckTriggerNegativeTransition(pTrigger, oldval) SyncTrigger *pTrigger; CARD64 oldval; { return (pTrigger->pCounter == NULL || (XSyncValueGreaterThan(oldval, pTrigger->test_value) && XSyncValueLessOrEqual(pTrigger->pCounter->value, pTrigger->test_value))); } static int SyncInitTrigger(client, pTrigger, counter, changes) ClientPtr client; /* so we can set errorValue */ SyncTrigger *pTrigger; XSyncCounter counter; Mask changes; { SyncCounter *pCounter = pTrigger->pCounter; int status; Bool newcounter = FALSE; if (changes & XSyncCACounter) { if (counter == None) pCounter = NULL; else if (!(pCounter = (SyncCounter *)SecurityLookupIDByType( client, counter, RTCounter, DixReadAccess))) { client->errorValue = counter; return SyncErrorBase + XSyncBadCounter; } if (pCounter != pTrigger->pCounter) { /* new counter for trigger */ SyncDeleteTriggerFromCounter(pTrigger); pTrigger->pCounter = pCounter; newcounter = TRUE; } } /* if system counter, ask it what the current value is */ if (IsSystemCounter(pCounter)) { (*pCounter->pSysCounterInfo->QueryValue) ((void *) pCounter, &pCounter->value); } if (changes & XSyncCAValueType) { if (pTrigger->value_type != XSyncRelative && pTrigger->value_type != XSyncAbsolute) { client->errorValue = pTrigger->value_type; return BadValue; } } if (changes & XSyncCATestType) { if (pTrigger->test_type != XSyncPositiveTransition && pTrigger->test_type != XSyncNegativeTransition && pTrigger->test_type != XSyncPositiveComparison && pTrigger->test_type != XSyncNegativeComparison) { client->errorValue = pTrigger->test_type; return BadValue; } /* select appropriate CheckTrigger function */ switch (pTrigger->test_type) { case XSyncPositiveTransition: pTrigger->CheckTrigger = SyncCheckTriggerPositiveTransition; break; case XSyncNegativeTransition: pTrigger->CheckTrigger = SyncCheckTriggerNegativeTransition; break; case XSyncPositiveComparison: pTrigger->CheckTrigger = SyncCheckTriggerPositiveComparison; break; case XSyncNegativeComparison: pTrigger->CheckTrigger = SyncCheckTriggerNegativeComparison; break; } } if (changes & (XSyncCAValueType | XSyncCAValue)) { if (pTrigger->value_type == XSyncAbsolute) pTrigger->test_value = pTrigger->wait_value; else /* relative */ { Bool overflow; if (pCounter == NULL) return BadMatch; XSyncValueAdd(&pTrigger->test_value, pCounter->value, pTrigger->wait_value, &overflow); if (overflow) { client->errorValue = XSyncValueHigh32(pTrigger->wait_value); return BadValue; } } } /* we wait until we're sure there are no errors before registering * a new counter on a trigger */ if (newcounter) { if ((status = SyncAddTriggerToCounter(pTrigger)) != Success) return status; } else if (IsSystemCounter(pCounter)) { SyncComputeBracketValues(pCounter, /*startOver*/ TRUE); } return Success; } /* AlarmNotify events happen in response to actions taken on an Alarm or * the counter used by the alarm. AlarmNotify may be sent to multiple * clients. The alarm maintains a list of clients interested in events. */ static void SyncSendAlarmNotifyEvents(pAlarm) SyncAlarm *pAlarm; { SyncAlarmClientList *pcl; xSyncAlarmNotifyEvent ane; SyncTrigger *pTrigger = &pAlarm->trigger; UpdateCurrentTime(); ane.type = SyncEventBase + XSyncAlarmNotify; ane.kind = XSyncAlarmNotify; ane.alarm = pAlarm->alarm_id; if (pTrigger->pCounter) { ane.counter_value_hi = XSyncValueHigh32(pTrigger->pCounter->value); ane.counter_value_lo = XSyncValueLow32(pTrigger->pCounter->value); } else { /* XXX what else can we do if there's no counter? */ ane.counter_value_hi = ane.counter_value_lo = 0; } ane.alarm_value_hi = XSyncValueHigh32(pTrigger->test_value); ane.alarm_value_lo = XSyncValueLow32(pTrigger->test_value); ane.time = currentTime.milliseconds; ane.state = pAlarm->state; /* send to owner */ if (pAlarm->events) WriteEventsToClient(pAlarm->client, 1, (xEvent *) &ane); /* send to other interested clients */ for (pcl = pAlarm->pEventClients; pcl; pcl = pcl->next) WriteEventsToClient(pcl->client, 1, (xEvent *) &ane); } /* CounterNotify events only occur in response to an Await. The events * go only to the Awaiting client. */ static void SyncSendCounterNotifyEvents(client, ppAwait, num_events) ClientPtr client; SyncAwait **ppAwait; int num_events; { xSyncCounterNotifyEvent *pEvents, *pev; int i; if (client->clientGone) return; pev = pEvents = (xSyncCounterNotifyEvent *) calloc(num_events, sizeof(xSyncCounterNotifyEvent)); if (!pEvents) return; UpdateCurrentTime(); for (i = 0; i < num_events; i++, ppAwait++, pev++) { SyncTrigger *pTrigger = &(*ppAwait)->trigger; pev->type = SyncEventBase + XSyncCounterNotify; pev->kind = XSyncCounterNotify; pev->counter = pTrigger->pCounter->id; pev->wait_value_lo = XSyncValueLow32(pTrigger->test_value); pev->wait_value_hi = XSyncValueHigh32(pTrigger->test_value); pev->counter_value_lo = XSyncValueLow32(pTrigger->pCounter->value); pev->counter_value_hi = XSyncValueHigh32(pTrigger->pCounter->value); pev->time = currentTime.milliseconds; pev->count = num_events - i - 1; /* events remaining */ pev->destroyed = pTrigger->pCounter->beingDestroyed; } /* swapping will be taken care of by this */ WriteEventsToClient(client, num_events, (xEvent *)pEvents); free(pEvents); } /* This function is called when an alarm's counter is destroyed. * It is plugged into pTrigger->CounterDestroyed (for alarm triggers). */ void SyncAlarmCounterDestroyed(pTrigger) SyncTrigger *pTrigger; { SyncAlarm *pAlarm = (SyncAlarm *)pTrigger; pAlarm->state = XSyncAlarmInactive; SyncSendAlarmNotifyEvents(pAlarm); pTrigger->pCounter = NULL; } /* This function is called when an alarm "goes off." * It is plugged into pTrigger->TriggerFired (for alarm triggers). */ static void SyncAlarmTriggerFired(pTrigger) SyncTrigger *pTrigger; { SyncAlarm *pAlarm = (SyncAlarm *)pTrigger; CARD64 new_test_value; /* no need to check alarm unless it's active */ if (pAlarm->state != XSyncAlarmActive) return; /* " if the counter value is None, or if the delta is 0 and * the test-type is PositiveComparison or NegativeComparison, * no change is made to value (test-value) and the alarm * state is changed to Inactive before the event is generated." */ if (pAlarm->trigger.pCounter == NULL || (XSyncValueIsZero(pAlarm->delta) && (pAlarm->trigger.test_type == XSyncPositiveComparison || pAlarm->trigger.test_type == XSyncNegativeComparison))) pAlarm->state = XSyncAlarmInactive; new_test_value = pAlarm->trigger.test_value; if (pAlarm->state == XSyncAlarmActive) { Bool overflow; CARD64 oldvalue; SyncTrigger *paTrigger = &pAlarm->trigger; /* "The alarm is updated by repeatedly adding delta to the * value of the trigger and re-initializing it until it * becomes FALSE." */ oldvalue = paTrigger->test_value; /* XXX really should do something smarter here */ do { XSyncValueAdd(&paTrigger->test_value, paTrigger->test_value, pAlarm->delta, &overflow); } while (!overflow && (*paTrigger->CheckTrigger)(paTrigger, paTrigger->pCounter->value)); new_test_value = paTrigger->test_value; paTrigger->test_value = oldvalue; /* "If this update would cause value to fall outside the range * for an INT64...no change is made to value (test-value) and * the alarm state is changed to Inactive before the event is * generated." */ if (overflow) { new_test_value = oldvalue; pAlarm->state = XSyncAlarmInactive; } } /* The AlarmNotify event has to have the "new state of the alarm" * which we can't be sure of until this point. However, it has * to have the "old" trigger test value. That's the reason for * all the newvalue/oldvalue shuffling above. After we send the * events, give the trigger its new test value. */ SyncSendAlarmNotifyEvents(pAlarm); pTrigger->test_value = new_test_value; } /* This function is called when an Await unblocks, either as a result * of the trigger firing OR the counter being destroyed. * It goes into pTrigger->TriggerFired AND pTrigger->CounterDestroyed * (for Await triggers). */ static void SyncAwaitTriggerFired(pTrigger) SyncTrigger *pTrigger; { SyncAwait *pAwait = (SyncAwait *)pTrigger; int numwaits; SyncAwaitUnion *pAwaitUnion; SyncAwait **ppAwait; int num_events = 0; pAwaitUnion = (SyncAwaitUnion *)pAwait->pHeader; numwaits = pAwaitUnion->header.num_waitconditions; ppAwait = (SyncAwait **)malloc(numwaits * sizeof(SyncAwait *)); if (!ppAwait) goto bail; pAwait = &(pAwaitUnion+1)->await; /* "When a client is unblocked, all the CounterNotify events for * the Await request are generated contiguously. If count is 0 * there are no more events to follow for this request. If * count is n, there are at least n more events to follow." * * Thus, it is best to find all the counters for which events * need to be sent first, so that an accurate count field can * be stored in the events. */ for ( ; numwaits; numwaits--, pAwait++) { CARD64 diff; Bool overflow, diffgreater, diffequal; /* "A CounterNotify event with the destroyed flag set to TRUE is * always generated if the counter for one of the triggers is * destroyed." */ if (pAwait->trigger.pCounter->beingDestroyed) { ppAwait[num_events++] = pAwait; continue; } /* "The difference between the counter and the test value is * calculated by subtracting the test value from the value of * the counter." */ XSyncValueSubtract(&diff, pAwait->trigger.pCounter->value, pAwait->trigger.test_value, &overflow); /* "If the difference lies outside the range for an INT64, an * event is not generated." */ if (overflow) continue; diffgreater = XSyncValueGreaterThan(diff, pAwait->event_threshold); diffequal = XSyncValueEqual(diff, pAwait->event_threshold); /* "If the test-type is PositiveTransition or * PositiveComparison, a CounterNotify event is generated if * the difference is at least event-threshold. If the test-type * is NegativeTransition or NegativeComparison, a CounterNotify * event is generated if the difference is at most * event-threshold." */ if ( ((pAwait->trigger.test_type == XSyncPositiveComparison || pAwait->trigger.test_type == XSyncPositiveTransition) && (diffgreater || diffequal)) || ((pAwait->trigger.test_type == XSyncNegativeComparison || pAwait->trigger.test_type == XSyncNegativeTransition) && (!diffgreater) /* less or equal */ ) ) { ppAwait[num_events++] = pAwait; } } if (num_events) SyncSendCounterNotifyEvents(pAwaitUnion->header.client, ppAwait, num_events); free(ppAwait); bail: /* unblock the client */ AttendClient(pAwaitUnion->header.client); /* delete the await */ FreeResource(pAwaitUnion->header.delete_id, RT_NONE); } /* This function should always be used to change a counter's value so that * any triggers depending on the counter will be checked. */ void SyncChangeCounter(pCounter, newval) SyncCounter *pCounter; CARD64 newval; { SyncTriggerList *ptl, *pnext; CARD64 oldval; oldval = pCounter->value; pCounter->value = newval; /* run through triggers to see if any become true */ for (ptl = pCounter->pTriglist; ptl; ptl = pnext) { pnext = ptl->next; if ((*ptl->pTrigger->CheckTrigger)(ptl->pTrigger, oldval)) (*ptl->pTrigger->TriggerFired)(ptl->pTrigger); } if (IsSystemCounter(pCounter)) { SyncComputeBracketValues(pCounter, /* startOver */ FALSE); } } /* loosely based on dix/events.c/EventSelectForWindow */ static Bool SyncEventSelectForAlarm(pAlarm, client, wantevents) SyncAlarm *pAlarm; ClientPtr client; Bool wantevents; { SyncAlarmClientList *pClients; if (client == pAlarm->client) /* alarm owner */ { pAlarm->events = wantevents; return Success; } /* see if the client is already on the list (has events selected) */ for (pClients = pAlarm->pEventClients; pClients; pClients = pClients->next) { if (pClients->client == client) { /* client's presence on the list indicates desire for * events. If the client doesn't want events, remove it * from the list. If the client does want events, do * nothing, since it's already got them. */ if (!wantevents) { FreeResource(pClients->delete_id, RT_NONE); } return Success; } } /* if we get here, this client does not currently have * events selected on the alarm */ if (!wantevents) /* client doesn't want events, and we just discovered that it * doesn't have them, so there's nothing to do. */ return Success; /* add new client to pAlarm->pEventClients */ pClients = (SyncAlarmClientList *) malloc(sizeof(SyncAlarmClientList)); if (!pClients) return BadAlloc; /* register it as a resource so it will be cleaned up * if the client dies */ pClients->delete_id = FakeClientID(client->index); if (!AddResource(pClients->delete_id, RTAlarmClient, pAlarm)) { free(pClients); return BadAlloc; } /* link it into list after we know all the allocations succeed */ pClients->next = pAlarm->pEventClients; pAlarm->pEventClients = pClients; pClients->client = client; return Success; } /* * ** SyncChangeAlarmAttributes ** This is used by CreateAlarm and ChangeAlarm */ static int SyncChangeAlarmAttributes(client, pAlarm, mask, values) ClientPtr client; SyncAlarm *pAlarm; Mask mask; CARD32 *values; { int status; XSyncCounter counter; Mask origmask = mask; counter = pAlarm->trigger.pCounter ? pAlarm->trigger.pCounter->id : None; while (mask) { int index2 = lowbit(mask); mask &= ~index2; switch (index2) { case XSyncCACounter: mask &= ~XSyncCACounter; /* sanity check in SyncInitTrigger */ counter = *values++; break; case XSyncCAValueType: mask &= ~XSyncCAValueType; /* sanity check in SyncInitTrigger */ pAlarm->trigger.value_type = *values++; break; case XSyncCAValue: mask &= ~XSyncCAValue; XSyncIntsToValue(&pAlarm->trigger.wait_value, values[1], values[0]); values += 2; break; case XSyncCATestType: mask &= ~XSyncCATestType; /* sanity check in SyncInitTrigger */ pAlarm->trigger.test_type = *values++; break; case XSyncCADelta: mask &= ~XSyncCADelta; XSyncIntsToValue(&pAlarm->delta, values[1], values[0]); values += 2; break; case XSyncCAEvents: mask &= ~XSyncCAEvents; if ((*values != xTrue) && (*values != xFalse)) { client->errorValue = *values; return BadValue; } status = SyncEventSelectForAlarm(pAlarm, client, (Bool)(*values++)); if (status != Success) return status; break; default: client->errorValue = mask; return BadValue; } } /* "If the test-type is PositiveComparison or PositiveTransition * and delta is less than zero, or if the test-type is * NegativeComparison or NegativeTransition and delta is * greater than zero, a Match error is generated." */ if (origmask & (XSyncCADelta|XSyncCATestType)) { CARD64 zero; XSyncIntToValue(&zero, 0); if ((((pAlarm->trigger.test_type == XSyncPositiveComparison) || (pAlarm->trigger.test_type == XSyncPositiveTransition)) && XSyncValueLessThan(pAlarm->delta, zero)) || (((pAlarm->trigger.test_type == XSyncNegativeComparison) || (pAlarm->trigger.test_type == XSyncNegativeTransition)) && XSyncValueGreaterThan(pAlarm->delta, zero)) ) { return BadMatch; } } /* postpone this until now, when we're sure nothing else can go wrong */ if ((status = SyncInitTrigger(client, &pAlarm->trigger, counter, origmask & XSyncCAAllTrigger)) != Success) return status; /* XXX spec does not really say to do this - needs clarification */ pAlarm->state = XSyncAlarmActive; return Success; } static SyncCounter * SyncCreateCounter(client, id, initialvalue) ClientPtr client; XSyncCounter id; CARD64 initialvalue; { SyncCounter *pCounter; if (!(pCounter = (SyncCounter *) malloc(sizeof(SyncCounter)))) return (SyncCounter *)NULL; if (!AddResource(id, RTCounter, (void *) pCounter)) { free((void *) pCounter); return (SyncCounter *)NULL; } pCounter->client = client; pCounter->id = id; pCounter->value = initialvalue; pCounter->pTriglist = NULL; pCounter->beingDestroyed = FALSE; pCounter->pSysCounterInfo = NULL; return pCounter; } static int FreeCounter( void * /*env*/, XID /*id*/ ); /* * ***** System Counter utilities */ void * SyncCreateSystemCounter(name, initial, resolution, counterType, QueryValue, BracketValues) char *name; CARD64 initial; CARD64 resolution; SyncCounterType counterType; void (*QueryValue) ( void * /* pCounter */, CARD64 * /* pValue_return */); void (*BracketValues) ( void * /* pCounter */, CARD64 * /* pbracket_less */, CARD64 * /* pbracket_greater */); { SyncCounter *pCounter; SysCounterList = (SyncCounter **)realloc(SysCounterList, (SyncNumSystemCounters+1)*sizeof(SyncCounter *)); if (!SysCounterList) return (void *)NULL; /* this function may be called before SYNC has been initialized, so we * have to make sure RTCounter is created. */ if (RTCounter == 0) { RTCounter = CreateNewResourceType(FreeCounter); if (RTCounter == 0) { return (void *)NULL; } } pCounter = SyncCreateCounter((ClientPtr)NULL, FakeClientID(0), initial); if (pCounter) { SysCounterInfo *psci; psci = (SysCounterInfo *)malloc(sizeof(SysCounterInfo)); if (!psci) { FreeResource(pCounter->id, RT_NONE); return (void *) pCounter; } pCounter->pSysCounterInfo = psci; psci->name = name; psci->resolution = resolution; psci->counterType = counterType; psci->QueryValue = QueryValue; psci->BracketValues = BracketValues; XSyncMaxValue(&psci->bracket_greater); XSyncMinValue(&psci->bracket_less); SysCounterList[SyncNumSystemCounters++] = pCounter; } return (void *) pCounter; } void SyncDestroySystemCounter(pSysCounter) void * pSysCounter; { SyncCounter *pCounter = (SyncCounter *)pSysCounter; FreeResource(pCounter->id, RT_NONE); } static void SyncComputeBracketValues(pCounter, startOver) SyncCounter *pCounter; Bool startOver; { SyncTriggerList *pCur; SyncTrigger *pTrigger; SysCounterInfo *psci; CARD64 *pnewgtval = NULL; CARD64 *pnewltval = NULL; SyncCounterType ct; if (!pCounter) return; psci = pCounter->pSysCounterInfo; ct = pCounter->pSysCounterInfo->counterType; if (ct == XSyncCounterNeverChanges) return; if (startOver) { XSyncMaxValue(&psci->bracket_greater); XSyncMinValue(&psci->bracket_less); } for (pCur = pCounter->pTriglist; pCur; pCur = pCur->next) { pTrigger = pCur->pTrigger; if (pTrigger->test_type == XSyncPositiveComparison && ct != XSyncCounterNeverIncreases) { if (XSyncValueLessThan(pCounter->value, pTrigger->test_value) && XSyncValueLessThan(pTrigger->test_value, psci->bracket_greater)) { psci->bracket_greater = pTrigger->test_value; pnewgtval = &psci->bracket_greater; } } else if (pTrigger->test_type == XSyncNegativeComparison && ct != XSyncCounterNeverDecreases) { if (XSyncValueGreaterThan(pCounter->value, pTrigger->test_value) && XSyncValueGreaterThan(pTrigger->test_value, psci->bracket_less)) { psci->bracket_less = pTrigger->test_value; pnewltval = &psci->bracket_less; } } else if ( (pTrigger->test_type == XSyncPositiveTransition && ct != XSyncCounterNeverIncreases) || (pTrigger->test_type == XSyncNegativeTransition && ct != XSyncCounterNeverDecreases) ) { if (XSyncValueLessThan(pCounter->value, pTrigger->test_value)) { if (XSyncValueLessThan(pTrigger->test_value, psci->bracket_greater)) { psci->bracket_greater = pTrigger->test_value; pnewgtval = &psci->bracket_greater; } else if (XSyncValueGreaterThan(pTrigger->test_value, psci->bracket_less)) { psci->bracket_less = pTrigger->test_value; pnewltval = &psci->bracket_less; } } } } /* end for each trigger */ if (pnewgtval || pnewltval) { (*psci->BracketValues)((void *)pCounter, pnewltval, pnewgtval); } } /* * ***** Resource delete functions */ /* ARGSUSED */ static int FreeAlarm(addr, id) void *addr; XID id; { SyncAlarm *pAlarm = (SyncAlarm *) addr; pAlarm->state = XSyncAlarmDestroyed; SyncSendAlarmNotifyEvents(pAlarm); /* delete event selections */ while (pAlarm->pEventClients) FreeResource(pAlarm->pEventClients->delete_id, RT_NONE); SyncDeleteTriggerFromCounter(&pAlarm->trigger); free(pAlarm); return Success; } /* * ** Cleanup after the destruction of a Counter */ /* ARGSUSED */ static int FreeCounter(env, id) void *env; XID id; { SyncCounter *pCounter = (SyncCounter *) env; SyncTriggerList *ptl, *pnext; pCounter->beingDestroyed = TRUE; /* tell all the counter's triggers that the counter has been destroyed */ for (ptl = pCounter->pTriglist; ptl; ptl = pnext) { (*ptl->pTrigger->CounterDestroyed)(ptl->pTrigger); pnext = ptl->next; free(ptl); /* destroy the trigger list as we go */ } if (IsSystemCounter(pCounter)) { int i, found = 0; free(pCounter->pSysCounterInfo); /* find the counter in the list of system counters and remove it */ if (SysCounterList) { for (i = 0; i < SyncNumSystemCounters; i++) { if (SysCounterList[i] == pCounter) { found = i; break; } } if (found < (SyncNumSystemCounters-1)) { for (i = found; i < SyncNumSystemCounters-1; i++) { SysCounterList[i] = SysCounterList[i+1]; } } } SyncNumSystemCounters--; } free(pCounter); return Success; } /* * ** Cleanup after Await */ /* ARGSUSED */ static int FreeAwait(addr, id) void *addr; XID id; { SyncAwaitUnion *pAwaitUnion = (SyncAwaitUnion *) addr; SyncAwait *pAwait; int numwaits; pAwait = &(pAwaitUnion+1)->await; /* first await on list */ /* remove triggers from counters */ for (numwaits = pAwaitUnion->header.num_waitconditions; numwaits; numwaits--, pAwait++) { /* If the counter is being destroyed, FreeCounter will delete * the trigger list itself, so don't do it here. */ SyncCounter *pCounter = pAwait->trigger.pCounter; if (pCounter && !pCounter->beingDestroyed) SyncDeleteTriggerFromCounter(&pAwait->trigger); } free(pAwaitUnion); return Success; } /* loosely based on dix/events.c/OtherClientGone */ static int FreeAlarmClient(value, id) void * value; /* must conform to DeleteType */ XID id; { SyncAlarm *pAlarm = (SyncAlarm *)value; SyncAlarmClientList *pCur, *pPrev; for (pPrev = NULL, pCur = pAlarm->pEventClients; pCur; pPrev = pCur, pCur = pCur->next) { if (pCur->delete_id == id) { if (pPrev) pPrev->next = pCur->next; else pAlarm->pEventClients = pCur->next; free(pCur); return(Success); } } FatalError("alarm client not on event list"); /*NOTREACHED*/ } /* * ***** Proc functions */ /* * ** Initialize the extension */ static int ProcSyncInitialize(client) ClientPtr client; { xSyncInitializeReply rep; REQUEST_SIZE_MATCH(xSyncInitializeReq); memset(&rep, 0, sizeof(xSyncInitializeReply)); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.majorVersion = SERVER_SYNC_MAJOR_VERSION; rep.minorVersion = SERVER_SYNC_MINOR_VERSION; rep.length = 0; if (client->swapped) { swaps(&rep.sequenceNumber); } WriteToClient(client, sizeof(rep), &rep); return (client->noClientException); } /* * ** Get list of system counters available through the extension */ static int ProcSyncListSystemCounters(client) ClientPtr client; { xSyncListSystemCountersReply rep; int i, len; xSyncSystemCounter *list = NULL, *walklist = NULL; REQUEST_SIZE_MATCH(xSyncListSystemCountersReq); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.nCounters = SyncNumSystemCounters; for (i = len = 0; i < SyncNumSystemCounters; i++) { char *name = SysCounterList[i]->pSysCounterInfo->name; /* pad to 4 byte boundary */ len += (sz_xSyncSystemCounter + strlen(name) + 3) & ~3; } if (len) { walklist = list = (xSyncSystemCounter *) malloc(len); if (!list) return BadAlloc; } rep.length = len >> 2; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.nCounters); } for (i = 0; i < SyncNumSystemCounters; i++) { int namelen; char *pname_in_reply; SysCounterInfo *psci = SysCounterList[i]->pSysCounterInfo; walklist->counter = SysCounterList[i]->id; walklist->resolution_hi = XSyncValueHigh32(psci->resolution); walklist->resolution_lo = XSyncValueLow32(psci->resolution); namelen = strlen(psci->name); walklist->name_length = namelen; if (client->swapped) { swapl(&walklist->counter); swapl(&walklist->resolution_hi); swapl(&walklist->resolution_lo); swaps(&walklist->name_length); } pname_in_reply = ((char *)walklist) + sz_xSyncSystemCounter; strncpy(pname_in_reply, psci->name, namelen); walklist = (xSyncSystemCounter *) (((char *)walklist) + ((sz_xSyncSystemCounter + namelen + 3) & ~3)); } WriteToClient(client, sizeof(rep), &rep); if (len) { WriteToClient(client, len, list); free(list); } return (client->noClientException); } /* * ** Set client Priority */ static int ProcSyncSetPriority(client) ClientPtr client; { REQUEST(xSyncSetPriorityReq); ClientPtr priorityclient; REQUEST_SIZE_MATCH(xSyncSetPriorityReq); if (stuff->id == None) priorityclient = client; else if (!(priorityclient = LookupClient(stuff->id, client))) { client->errorValue = stuff->id; return BadMatch; } if (priorityclient->priority != stuff->priority) { priorityclient->priority = stuff->priority; /* The following will force the server back into WaitForSomething * so that the change in this client's priority is immediately * reflected. */ isItTimeToYield = TRUE; dispatchException |= DE_PRIORITYCHANGE; } return Success; } /* * ** Get client Priority */ static int ProcSyncGetPriority(client) ClientPtr client; { REQUEST(xSyncGetPriorityReq); xSyncGetPriorityReply rep; ClientPtr priorityclient; REQUEST_SIZE_MATCH(xSyncGetPriorityReq); if (stuff->id == None) priorityclient = client; else if (!(priorityclient = LookupClient(stuff->id, client))) { client->errorValue = stuff->id; return BadMatch; } rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.priority = priorityclient->priority; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.priority); } WriteToClient(client, sizeof(xSyncGetPriorityReply), &rep); return (client->noClientException); } /* * ** Create a new counter */ static int ProcSyncCreateCounter(client) ClientPtr client; { REQUEST(xSyncCreateCounterReq); CARD64 initial; REQUEST_SIZE_MATCH(xSyncCreateCounterReq); LEGAL_NEW_RESOURCE(stuff->cid, client); XSyncIntsToValue(&initial, stuff->initial_value_lo, stuff->initial_value_hi); if (!SyncCreateCounter(client, stuff->cid, initial)) return BadAlloc; return (client->noClientException); } /* * ** Set Counter value */ static int ProcSyncSetCounter(client) ClientPtr client; { REQUEST(xSyncSetCounterReq); SyncCounter *pCounter; CARD64 newvalue; REQUEST_SIZE_MATCH(xSyncSetCounterReq); pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->cid, RTCounter, DixWriteAccess); if (pCounter == NULL) { client->errorValue = stuff->cid; return SyncErrorBase + XSyncBadCounter; } if (IsSystemCounter(pCounter)) { client->errorValue = stuff->cid; return BadAccess; } XSyncIntsToValue(&newvalue, stuff->value_lo, stuff->value_hi); SyncChangeCounter(pCounter, newvalue); return Success; } /* * ** Change Counter value */ static int ProcSyncChangeCounter(client) ClientPtr client; { REQUEST(xSyncChangeCounterReq); SyncCounter *pCounter; CARD64 newvalue; Bool overflow; REQUEST_SIZE_MATCH(xSyncChangeCounterReq); pCounter = (SyncCounter *) SecurityLookupIDByType(client, stuff->cid, RTCounter, DixWriteAccess); if (pCounter == NULL) { client->errorValue = stuff->cid; return SyncErrorBase + XSyncBadCounter; } if (IsSystemCounter(pCounter)) { client->errorValue = stuff->cid; return BadAccess; } XSyncIntsToValue(&newvalue, stuff->value_lo, stuff->value_hi); XSyncValueAdd(&newvalue, pCounter->value, newvalue, &overflow); if (overflow) { /* XXX 64 bit value can't fit in 32 bits; do the best we can */ client->errorValue = stuff->value_hi; return BadValue; } SyncChangeCounter(pCounter, newvalue); return Success; } /* * ** Destroy a counter */ static int ProcSyncDestroyCounter(client) ClientPtr client; { REQUEST(xSyncDestroyCounterReq); SyncCounter *pCounter; REQUEST_SIZE_MATCH(xSyncDestroyCounterReq); pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->counter, RTCounter, DixDestroyAccess); if (pCounter == NULL) { client->errorValue = stuff->counter; return SyncErrorBase + XSyncBadCounter; } if (IsSystemCounter(pCounter)) { client->errorValue = stuff->counter; return BadAccess; } FreeResource(pCounter->id, RT_NONE); return Success; } /* * ** Await */ static int ProcSyncAwait(client) ClientPtr client; { REQUEST(xSyncAwaitReq); int len, items; int i; xSyncWaitCondition *pProtocolWaitConds; SyncAwaitUnion *pAwaitUnion; SyncAwait *pAwait; int status; REQUEST_AT_LEAST_SIZE(xSyncAwaitReq); len = client->req_len << 2; len -= sz_xSyncAwaitReq; items = len / sz_xSyncWaitCondition; if (items * sz_xSyncWaitCondition != len) { return BadLength; } if (items == 0) { client->errorValue = items; /* XXX protocol change */ return BadValue; } pProtocolWaitConds = (xSyncWaitCondition *) & stuff[1]; /* all the memory for the entire await list is allocated * here in one chunk */ pAwaitUnion = (SyncAwaitUnion *)malloc((items+1) * sizeof(SyncAwaitUnion)); if (!pAwaitUnion) return BadAlloc; /* first item is the header, remainder are real wait conditions */ pAwaitUnion->header.delete_id = FakeClientID(client->index); if (!AddResource(pAwaitUnion->header.delete_id, RTAwait, pAwaitUnion)) { free(pAwaitUnion); return BadAlloc; } /* don't need to do any more memory allocation for this request! */ pAwaitUnion->header.client = client; pAwaitUnion->header.num_waitconditions = 0; pAwait = &(pAwaitUnion+1)->await; /* skip over header */ for (i = 0; i < items; i++, pProtocolWaitConds++, pAwait++) { if (pProtocolWaitConds->counter == None) /* XXX protocol change */ { /* this should take care of removing any triggers created by * this request that have already been registered on counters */ FreeResource(pAwaitUnion->header.delete_id, RT_NONE); client->errorValue = pProtocolWaitConds->counter; return SyncErrorBase + XSyncBadCounter; } /* sanity checks are in SyncInitTrigger */ pAwait->trigger.pCounter = NULL; pAwait->trigger.value_type = pProtocolWaitConds->value_type; XSyncIntsToValue(&pAwait->trigger.wait_value, pProtocolWaitConds->wait_value_lo, pProtocolWaitConds->wait_value_hi); pAwait->trigger.test_type = pProtocolWaitConds->test_type; status = SyncInitTrigger(client, &pAwait->trigger, pProtocolWaitConds->counter, XSyncCAAllTrigger); if (status != Success) { /* this should take care of removing any triggers created by * this request that have already been registered on counters */ FreeResource(pAwaitUnion->header.delete_id, RT_NONE); return status; } /* this is not a mistake -- same function works for both cases */ pAwait->trigger.TriggerFired = SyncAwaitTriggerFired; pAwait->trigger.CounterDestroyed = SyncAwaitTriggerFired; XSyncIntsToValue(&pAwait->event_threshold, pProtocolWaitConds->event_threshold_lo, pProtocolWaitConds->event_threshold_hi); pAwait->pHeader = &pAwaitUnion->header; pAwaitUnion->header.num_waitconditions++; } IgnoreClient(client); /* see if any of the triggers are already true */ pAwait = &(pAwaitUnion+1)->await; /* skip over header */ for (i = 0; i < items; i++, pAwait++) { /* don't have to worry about NULL counters because the request * errors before we get here out if they occur */ if ((*pAwait->trigger.CheckTrigger)(&pAwait->trigger, pAwait->trigger.pCounter->value)) { (*pAwait->trigger.TriggerFired)(&pAwait->trigger); break; /* once is enough */ } } return Success; } /* * ** Query a counter */ static int ProcSyncQueryCounter(client) ClientPtr client; { REQUEST(xSyncQueryCounterReq); xSyncQueryCounterReply rep; SyncCounter *pCounter; REQUEST_SIZE_MATCH(xSyncQueryCounterReq); pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->counter, RTCounter, DixReadAccess); if (pCounter == NULL) { client->errorValue = stuff->counter; return SyncErrorBase + XSyncBadCounter; } rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; /* if system counter, ask it what the current value is */ if (IsSystemCounter(pCounter)) { (*pCounter->pSysCounterInfo->QueryValue) ((void *) pCounter, &pCounter->value); } rep.value_hi = XSyncValueHigh32(pCounter->value); rep.value_lo = XSyncValueLow32(pCounter->value); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.value_hi); swapl(&rep.value_lo); } WriteToClient(client, sizeof(xSyncQueryCounterReply), &rep); return (client->noClientException); } /* * ** Create Alarm */ static int ProcSyncCreateAlarm(client) ClientPtr client; { REQUEST(xSyncCreateAlarmReq); SyncAlarm *pAlarm; int status; unsigned long len, vmask; SyncTrigger *pTrigger; REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq); LEGAL_NEW_RESOURCE(stuff->id, client); vmask = stuff->valueMask; len = client->req_len - (sizeof(xSyncCreateAlarmReq) >> 2); /* the "extra" call to Ones accounts for the presence of 64 bit values */ if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta)))) return BadLength; if (!(pAlarm = (SyncAlarm *) malloc(sizeof(SyncAlarm)))) { return BadAlloc; } /* set up defaults */ pTrigger = &pAlarm->trigger; pTrigger->pCounter = NULL; pTrigger->value_type = XSyncAbsolute; XSyncIntToValue(&pTrigger->wait_value, 0L); pTrigger->test_type = XSyncPositiveComparison; pTrigger->TriggerFired = SyncAlarmTriggerFired; pTrigger->CounterDestroyed = SyncAlarmCounterDestroyed; status = SyncInitTrigger(client, pTrigger, None, XSyncCAAllTrigger); if (status != Success) { free(pAlarm); return status; } pAlarm->client = client; pAlarm->alarm_id = stuff->id; XSyncIntToValue(&pAlarm->delta, 1L); pAlarm->events = TRUE; pAlarm->state = XSyncAlarmInactive; pAlarm->pEventClients = NULL; status = SyncChangeAlarmAttributes(client, pAlarm, vmask, (CARD32 *)&stuff[1]); if (status != Success) { free(pAlarm); return status; } if (!AddResource(stuff->id, RTAlarm, pAlarm)) { free(pAlarm); return BadAlloc; } /* see if alarm already triggered. NULL counter will not trigger * in CreateAlarm and sets alarm state to Inactive. */ if (!pTrigger->pCounter) { pAlarm->state = XSyncAlarmInactive; /* XXX protocol change */ } else if ((*pTrigger->CheckTrigger)(pTrigger, pTrigger->pCounter->value)) { (*pTrigger->TriggerFired)(pTrigger); } return Success; } /* * ** Change Alarm */ static int ProcSyncChangeAlarm(client) ClientPtr client; { REQUEST(xSyncChangeAlarmReq); SyncAlarm *pAlarm; long vmask; int len, status; REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq); if (!(pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm, RTAlarm, DixWriteAccess))) { client->errorValue = stuff->alarm; return SyncErrorBase + XSyncBadAlarm; } vmask = stuff->valueMask; len = client->req_len - (sizeof(xSyncChangeAlarmReq) >> 2); /* the "extra" call to Ones accounts for the presence of 64 bit values */ if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta)))) return BadLength; if ((status = SyncChangeAlarmAttributes(client, pAlarm, vmask, (CARD32 *)&stuff[1])) != Success) return status; /* see if alarm already triggered. NULL counter WILL trigger * in ChangeAlarm. */ if (!pAlarm->trigger.pCounter || (*pAlarm->trigger.CheckTrigger)(&pAlarm->trigger, pAlarm->trigger.pCounter->value)) { (*pAlarm->trigger.TriggerFired)(&pAlarm->trigger); } return Success; } static int ProcSyncQueryAlarm(client) ClientPtr client; { REQUEST(xSyncQueryAlarmReq); SyncAlarm *pAlarm; xSyncQueryAlarmReply rep; SyncTrigger *pTrigger; REQUEST_SIZE_MATCH(xSyncQueryAlarmReq); pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm, RTAlarm, DixReadAccess); if (!pAlarm) { client->errorValue = stuff->alarm; return (SyncErrorBase + XSyncBadAlarm); } rep.type = X_Reply; rep.length = (sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)) >> 2; rep.sequenceNumber = client->sequence; pTrigger = &pAlarm->trigger; rep.counter = (pTrigger->pCounter) ? pTrigger->pCounter->id : None; #if 0 /* XXX unclear what to do, depends on whether relative value-types * are "consumed" immediately and are considered absolute from then * on. */ rep.value_type = pTrigger->value_type; rep.wait_value_hi = XSyncValueHigh32(pTrigger->wait_value); rep.wait_value_lo = XSyncValueLow32(pTrigger->wait_value); #else rep.value_type = XSyncAbsolute; rep.wait_value_hi = XSyncValueHigh32(pTrigger->test_value); rep.wait_value_lo = XSyncValueLow32(pTrigger->test_value); #endif rep.test_type = pTrigger->test_type; rep.delta_hi = XSyncValueHigh32(pAlarm->delta); rep.delta_lo = XSyncValueLow32(pAlarm->delta); rep.events = pAlarm->events; rep.state = pAlarm->state; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.counter); swapl(&rep.wait_value_hi); swapl(&rep.wait_value_lo); swapl(&rep.test_type); swapl(&rep.delta_hi); swapl(&rep.delta_lo); } WriteToClient(client, sizeof(xSyncQueryAlarmReply), &rep); return (client->noClientException); } static int ProcSyncDestroyAlarm(client) ClientPtr client; { REQUEST(xSyncDestroyAlarmReq); REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq); if (!((SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm, RTAlarm, DixDestroyAccess))) { client->errorValue = stuff->alarm; return SyncErrorBase + XSyncBadAlarm; } FreeResource(stuff->alarm, RT_NONE); return (client->noClientException); } /* * ** Given an extension request, call the appropriate request procedure */ static int ProcSyncDispatch(client) ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_SyncInitialize: return ProcSyncInitialize(client); case X_SyncListSystemCounters: return ProcSyncListSystemCounters(client); case X_SyncCreateCounter: return ProcSyncCreateCounter(client); case X_SyncSetCounter: return ProcSyncSetCounter(client); case X_SyncChangeCounter: return ProcSyncChangeCounter(client); case X_SyncQueryCounter: return ProcSyncQueryCounter(client); case X_SyncDestroyCounter: return ProcSyncDestroyCounter(client); case X_SyncAwait: return ProcSyncAwait(client); case X_SyncCreateAlarm: return ProcSyncCreateAlarm(client); case X_SyncChangeAlarm: return ProcSyncChangeAlarm(client); case X_SyncQueryAlarm: return ProcSyncQueryAlarm(client); case X_SyncDestroyAlarm: return ProcSyncDestroyAlarm(client); case X_SyncSetPriority: return ProcSyncSetPriority(client); case X_SyncGetPriority: return ProcSyncGetPriority(client); default: return BadRequest; } } /* * Boring Swapping stuff ... */ static int SProcSyncInitialize(client) ClientPtr client; { REQUEST(xSyncInitializeReq); swaps(&stuff->length); REQUEST_SIZE_MATCH (xSyncInitializeReq); return ProcSyncInitialize(client); } static int SProcSyncListSystemCounters(client) ClientPtr client; { REQUEST(xSyncListSystemCountersReq); swaps(&stuff->length); REQUEST_SIZE_MATCH (xSyncListSystemCountersReq); return ProcSyncListSystemCounters(client); } static int SProcSyncCreateCounter(client) ClientPtr client; { REQUEST(xSyncCreateCounterReq); swaps(&stuff->length); REQUEST_SIZE_MATCH (xSyncCreateCounterReq); swapl(&stuff->cid); swapl(&stuff->initial_value_lo); swapl(&stuff->initial_value_hi); return ProcSyncCreateCounter(client); } static int SProcSyncSetCounter(client) ClientPtr client; { REQUEST(xSyncSetCounterReq); swaps(&stuff->length); REQUEST_SIZE_MATCH (xSyncSetCounterReq); swapl(&stuff->cid); swapl(&stuff->value_lo); swapl(&stuff->value_hi); return ProcSyncSetCounter(client); } static int SProcSyncChangeCounter(client) ClientPtr client; { REQUEST(xSyncChangeCounterReq); swaps(&stuff->length); REQUEST_SIZE_MATCH (xSyncChangeCounterReq); swapl(&stuff->cid); swapl(&stuff->value_lo); swapl(&stuff->value_hi); return ProcSyncChangeCounter(client); } static int SProcSyncQueryCounter(client) ClientPtr client; { REQUEST(xSyncQueryCounterReq); swaps(&stuff->length); REQUEST_SIZE_MATCH (xSyncQueryCounterReq); swapl(&stuff->counter); return ProcSyncQueryCounter(client); } static int SProcSyncDestroyCounter(client) ClientPtr client; { REQUEST(xSyncDestroyCounterReq); swaps(&stuff->length); REQUEST_SIZE_MATCH (xSyncDestroyCounterReq); swapl(&stuff->counter); return ProcSyncDestroyCounter(client); } static int SProcSyncAwait(client) ClientPtr client; { REQUEST(xSyncAwaitReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xSyncAwaitReq); SwapRestL(stuff); return ProcSyncAwait(client); } static int SProcSyncCreateAlarm(client) ClientPtr client; { REQUEST(xSyncCreateAlarmReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq); swapl(&stuff->id); swapl(&stuff->valueMask); SwapRestL(stuff); return ProcSyncCreateAlarm(client); } static int SProcSyncChangeAlarm(client) ClientPtr client; { REQUEST(xSyncChangeAlarmReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq); swapl(&stuff->alarm); swapl(&stuff->valueMask); SwapRestL(stuff); return ProcSyncChangeAlarm(client); } static int SProcSyncQueryAlarm(client) ClientPtr client; { REQUEST(xSyncQueryAlarmReq); swaps(&stuff->length); REQUEST_SIZE_MATCH (xSyncQueryAlarmReq); swapl(&stuff->alarm); return ProcSyncQueryAlarm(client); } static int SProcSyncDestroyAlarm(client) ClientPtr client; { REQUEST(xSyncDestroyAlarmReq); swaps(&stuff->length); REQUEST_SIZE_MATCH (xSyncDestroyAlarmReq); swapl(&stuff->alarm); return ProcSyncDestroyAlarm(client); } static int SProcSyncSetPriority(client) ClientPtr client; { REQUEST(xSyncSetPriorityReq); swaps(&stuff->length); REQUEST_SIZE_MATCH (xSyncSetPriorityReq); swapl(&stuff->id); swapl(&stuff->priority); return ProcSyncSetPriority(client); } static int SProcSyncGetPriority(client) ClientPtr client; { REQUEST(xSyncGetPriorityReq); swaps(&stuff->length); REQUEST_SIZE_MATCH (xSyncGetPriorityReq); swapl(&stuff->id); return ProcSyncGetPriority(client); } static int SProcSyncDispatch(client) ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_SyncInitialize: return SProcSyncInitialize(client); case X_SyncListSystemCounters: return SProcSyncListSystemCounters(client); case X_SyncCreateCounter: return SProcSyncCreateCounter(client); case X_SyncSetCounter: return SProcSyncSetCounter(client); case X_SyncChangeCounter: return SProcSyncChangeCounter(client); case X_SyncQueryCounter: return SProcSyncQueryCounter(client); case X_SyncDestroyCounter: return SProcSyncDestroyCounter(client); case X_SyncAwait: return SProcSyncAwait(client); case X_SyncCreateAlarm: return SProcSyncCreateAlarm(client); case X_SyncChangeAlarm: return SProcSyncChangeAlarm(client); case X_SyncQueryAlarm: return SProcSyncQueryAlarm(client); case X_SyncDestroyAlarm: return SProcSyncDestroyAlarm(client); case X_SyncSetPriority: return SProcSyncSetPriority(client); case X_SyncGetPriority: return SProcSyncGetPriority(client); default: return BadRequest; } } /* * Event Swapping */ static void SCounterNotifyEvent(from, to) xSyncCounterNotifyEvent *from, *to; { to->type = from->type; to->kind = from->kind; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->counter, to->counter); cpswapl(from->wait_value_lo, to->wait_value_lo); cpswapl(from->wait_value_hi, to->wait_value_hi); cpswapl(from->counter_value_lo, to->counter_value_lo); cpswapl(from->counter_value_hi, to->counter_value_hi); cpswapl(from->time, to->time); cpswaps(from->count, to->count); to->destroyed = from->destroyed; } static void SAlarmNotifyEvent(from, to) xSyncAlarmNotifyEvent *from, *to; { to->type = from->type; to->kind = from->kind; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->alarm, to->alarm); cpswapl(from->counter_value_lo, to->counter_value_lo); cpswapl(from->counter_value_hi, to->counter_value_hi); cpswapl(from->alarm_value_lo, to->alarm_value_lo); cpswapl(from->alarm_value_hi, to->alarm_value_hi); cpswapl(from->time, to->time); to->state = from->state; } /* * ** Close everything down. ** This is fairly simple for now. */ /* ARGSUSED */ static void SyncResetProc(extEntry) ExtensionEntry *extEntry; { free(SysCounterList); SysCounterList = NULL; RTCounter = 0; } /* * ** Initialise the extension. */ void SyncExtensionInit(void) { ExtensionEntry *extEntry; if (RTCounter == 0) { RTCounter = CreateNewResourceType(FreeCounter); } RTAlarm = CreateNewResourceType(FreeAlarm); RTAwait = CreateNewResourceType(FreeAwait)|RC_NEVERRETAIN; RTAlarmClient = CreateNewResourceType(FreeAlarmClient)|RC_NEVERRETAIN; if (RTCounter == 0 || RTAwait == 0 || RTAlarm == 0 || RTAlarmClient == 0 || (extEntry = AddExtension(SYNC_NAME, XSyncNumberEvents, XSyncNumberErrors, ProcSyncDispatch, SProcSyncDispatch, SyncResetProc, StandardMinorOpcode)) == NULL) { ErrorF("Sync Extension %d.%d failed to Initialise\n", SYNC_MAJOR_VERSION, SYNC_MINOR_VERSION); return; } SyncEventBase = extEntry->eventBase; SyncErrorBase = extEntry->errorBase; EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent; EventSwapVector[SyncEventBase + XSyncAlarmNotify] = (EventSwapPtr) SAlarmNotifyEvent; /* * Although SERVERTIME is implemented by the OS layer, we initialise it * here because doing it in OsInit() is too early. The resource database * is not initialised when OsInit() is called. This is just about OK * because there is always a servertime counter. */ SyncInitServerTime(); SyncInitIdleTime(); #ifdef DEBUG fprintf(stderr, "Sync Extension %d.%d\n", SYNC_MAJOR_VERSION, SYNC_MINOR_VERSION); #endif } /* * ***** SERVERTIME implementation - should go in its own file in OS directory? */ static void * ServertimeCounter; static XSyncValue Now; static XSyncValue *pnext_time; #define GetTime()\ {\ unsigned long millis = GetTimeInMillis();\ unsigned long maxis = XSyncValueHigh32(Now);\ if (millis < XSyncValueLow32(Now)) maxis++;\ XSyncIntsToValue(&Now, millis, maxis);\ } /* *** Server Block Handler *** code inspired by multibuffer extension */ /*ARGSUSED*/ static void ServertimeBlockHandler(env, wt, LastSelectMask) void * env; struct timeval **wt; void * LastSelectMask; { XSyncValue delay; unsigned long timeout; if (pnext_time) { GetTime(); if (XSyncValueGreaterOrEqual(Now, *pnext_time)) { timeout = 0; } else { Bool overflow; XSyncValueSubtract(&delay, *pnext_time, Now, &overflow); (void)overflow; timeout = XSyncValueLow32(delay); } AdjustWaitForDelay(wt, timeout); /* os/utils.c */ } } /* *** Wakeup Handler */ /*ARGSUSED*/ static void ServertimeWakeupHandler(env, rc, LastSelectMask) void * env; int rc; void * LastSelectMask; { if (pnext_time) { GetTime(); if (XSyncValueGreaterOrEqual(Now, *pnext_time)) { SyncChangeCounter(ServertimeCounter, Now); } } } static void ServertimeQueryValue(pCounter, pValue_return) void * pCounter; CARD64 *pValue_return; { GetTime(); *pValue_return = Now; } static void ServertimeBracketValues(pCounter, pbracket_less, pbracket_greater) void *pCounter; CARD64 *pbracket_less; CARD64 *pbracket_greater; { if (!pnext_time && pbracket_greater) { RegisterBlockAndWakeupHandlers(ServertimeBlockHandler, ServertimeWakeupHandler, NULL); } else if (pnext_time && !pbracket_greater) { RemoveBlockAndWakeupHandlers(ServertimeBlockHandler, ServertimeWakeupHandler, NULL); } pnext_time = pbracket_greater; } static void SyncInitServerTime(void) { CARD64 resolution; XSyncIntsToValue(&Now, GetTimeInMillis(), 0); XSyncIntToValue(&resolution, 4); ServertimeCounter = SyncCreateSystemCounter("SERVERTIME", Now, resolution, XSyncCounterNeverDecreases, ServertimeQueryValue, ServertimeBracketValues); pnext_time = NULL; } /* * IDLETIME implementation */ static SyncCounter *IdleTimeCounter; static XSyncValue *pIdleTimeValueLess; static XSyncValue *pIdleTimeValueGreater; static void IdleTimeQueryValue (void *pCounter, CARD64 *pValue_return) { CARD32 idle = GetTimeInMillis() - lastDeviceEventTime.milliseconds; XSyncIntsToValue (pValue_return, idle, 0); } static void IdleTimeBlockHandler (void *env, struct timeval **wt, void *LastSelectMask) { XSyncValue idle, old_idle; SyncTriggerList *list = IdleTimeCounter->pTriglist; SyncTrigger *trig; if (!pIdleTimeValueLess && !pIdleTimeValueGreater) return; old_idle = IdleTimeCounter->value; IdleTimeQueryValue (NULL, &idle); IdleTimeCounter->value = idle; /* push, so CheckTrigger works */ if (pIdleTimeValueLess && XSyncValueLessOrEqual (idle, *pIdleTimeValueLess)) { /* * We've been idle for less than the threshold value, and someone * wants to know about that, but now we need to know whether they * want level or edge trigger. Check the trigger list against the * current idle time, and if any succeed, bomb out of select() * immediately so we can reschedule. */ for (list = IdleTimeCounter->pTriglist; list; list = list->next) { trig = list->pTrigger; if (trig->CheckTrigger(trig, old_idle)) { AdjustWaitForDelay(wt, 0); break; } } /* * We've been called exactly on the idle time, but we have a * NegativeTransition trigger which requires a transition from an * idle time greater than this. Schedule a wakeup for the next * millisecond so we won't miss a transition. */ if (XSyncValueEqual (idle, *pIdleTimeValueLess)) AdjustWaitForDelay(wt, 1); } else if (pIdleTimeValueGreater) { /* * There's a threshold in the positive direction. If we've been * idle less than it, schedule a wakeup for sometime in the future. * If we've been idle more than it, and someone wants to know about * that level-triggered, schedule an immediate wakeup. */ unsigned long timeout = -1; if (XSyncValueLessThan (idle, *pIdleTimeValueGreater)) { XSyncValue value; Bool overflow; XSyncValueSubtract (&value, *pIdleTimeValueGreater, idle, &overflow); timeout = min(timeout, XSyncValueLow32 (value)); } else { for (list = IdleTimeCounter->pTriglist; list; list = list->next) { trig = list->pTrigger; if (trig->CheckTrigger(trig, old_idle)) { timeout = min(timeout, 0); break; } } } AdjustWaitForDelay (wt, timeout); } IdleTimeCounter->value = old_idle; /* pop */ } static void IdleTimeWakeupHandler (void * env, int rc, void * LastSelectMask) { XSyncValue idle; if (!pIdleTimeValueLess && !pIdleTimeValueGreater) return; IdleTimeQueryValue (NULL, &idle); if ((pIdleTimeValueGreater && XSyncValueGreaterOrEqual (idle, *pIdleTimeValueGreater)) || (pIdleTimeValueLess && XSyncValueLessOrEqual (idle, *pIdleTimeValueLess))) { SyncChangeCounter (IdleTimeCounter, idle); } } static void IdleTimeBracketValues (void *pCounter, CARD64 *pbracket_less, CARD64 *pbracket_greater) { Bool registered = (pIdleTimeValueLess || pIdleTimeValueGreater); if (registered && !pbracket_less && !pbracket_greater) { RemoveBlockAndWakeupHandlers(IdleTimeBlockHandler, IdleTimeWakeupHandler, NULL); } else if (!registered && (pbracket_less || pbracket_greater)) { RegisterBlockAndWakeupHandlers(IdleTimeBlockHandler, IdleTimeWakeupHandler, NULL); } pIdleTimeValueGreater = pbracket_greater; pIdleTimeValueLess = pbracket_less; } static void SyncInitIdleTime (void) { CARD64 resolution; XSyncValue idle; IdleTimeQueryValue (NULL, &idle); XSyncIntToValue (&resolution, 4); IdleTimeCounter = SyncCreateSystemCounter ("IDLETIME", idle, resolution, XSyncCounterUnrestricted, IdleTimeQueryValue, IdleTimeBracketValues); pIdleTimeValueLess = pIdleTimeValueGreater = NULL; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/xcmisc.c0000644000000000000000000001354413614532331017164 0ustar /* Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include "swaprep.h" #include #include #if 0 static unsigned char XCMiscCode; #endif static void XCMiscResetProc( ExtensionEntry * /* extEntry */ ); static DISPATCH_PROC(ProcXCMiscDispatch); static DISPATCH_PROC(ProcXCMiscGetVersion); static DISPATCH_PROC(ProcXCMiscGetXIDList); static DISPATCH_PROC(ProcXCMiscGetXIDRange); static DISPATCH_PROC(SProcXCMiscDispatch); static DISPATCH_PROC(SProcXCMiscGetVersion); static DISPATCH_PROC(SProcXCMiscGetXIDList); static DISPATCH_PROC(SProcXCMiscGetXIDRange); void XCMiscExtensionInit(void) { #if 0 ExtensionEntry *extEntry; if ((extEntry = AddExtension(XCMiscExtensionName, 0, 0, ProcXCMiscDispatch, SProcXCMiscDispatch, XCMiscResetProc, StandardMinorOpcode)) != 0) XCMiscCode = (unsigned char)extEntry->base; #else (void) AddExtension(XCMiscExtensionName, 0, 0, ProcXCMiscDispatch, SProcXCMiscDispatch, XCMiscResetProc, StandardMinorOpcode); #endif DeclareExtensionSecurity(XCMiscExtensionName, TRUE); } /*ARGSUSED*/ static void XCMiscResetProc (extEntry) ExtensionEntry *extEntry; { } static int ProcXCMiscGetVersion(client) register ClientPtr client; { xXCMiscGetVersionReply rep; REQUEST_SIZE_MATCH(xXCMiscGetVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = XCMiscMajorVersion; rep.minorVersion = XCMiscMinorVersion; if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.majorVersion); swaps(&rep.minorVersion); } WriteToClient(client, sizeof(xXCMiscGetVersionReply), &rep); return(client->noClientException); } static int ProcXCMiscGetXIDRange(client) register ClientPtr client; { xXCMiscGetXIDRangeReply rep; XID min_id, max_id; REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq); GetXIDRange(client->index, FALSE, &min_id, &max_id); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.start_id = min_id; rep.count = max_id - min_id + 1; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.start_id); swapl(&rep.count); } WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), &rep); return(client->noClientException); } static int ProcXCMiscGetXIDList(client) register ClientPtr client; { REQUEST(xXCMiscGetXIDListReq); xXCMiscGetXIDListReply rep; XID *pids; unsigned int count; REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq); if (stuff->count > UINT32_MAX / sizeof(XID)) return BadAlloc; pids = (XID *)malloc(stuff->count * sizeof(XID)); if (!pids) { return BadAlloc; } count = GetXIDList(client, stuff->count, pids); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = count; rep.count = count; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.count); } WriteToClient(client, sizeof(xXCMiscGetXIDListReply), &rep); if (count) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, count * sizeof(XID), pids); } free(pids); return(client->noClientException); } static int ProcXCMiscDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_XCMiscGetVersion: return ProcXCMiscGetVersion(client); case X_XCMiscGetXIDRange: return ProcXCMiscGetXIDRange(client); case X_XCMiscGetXIDList: return ProcXCMiscGetXIDList(client); default: return BadRequest; } } static int SProcXCMiscGetVersion(client) register ClientPtr client; { REQUEST(xXCMiscGetVersionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXCMiscGetVersionReq); swaps(&stuff->majorVersion); swaps(&stuff->minorVersion); return ProcXCMiscGetVersion(client); } static int SProcXCMiscGetXIDRange(client) register ClientPtr client; { REQUEST(xReq); swaps(&stuff->length); return ProcXCMiscGetXIDRange(client); } static int SProcXCMiscGetXIDList(client) register ClientPtr client; { REQUEST(xXCMiscGetXIDListReq); REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq); swaps(&stuff->length); swapl(&stuff->count); return ProcXCMiscGetXIDList(client); } static int SProcXCMiscDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_XCMiscGetVersion: return SProcXCMiscGetVersion(client); case X_XCMiscGetXIDRange: return SProcXCMiscGetXIDRange(client); case X_XCMiscGetXIDList: return SProcXCMiscGetXIDList(client); default: return BadRequest; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/xf86bigfont.c0000644000000000000000000005252313614532331020042 0ustar /* * BIGFONT extension for sharing font metrics between clients (if possible) * and for transmitting font metrics to clients in a compressed form. * * Copyright (c) 1999-2000 Bruno Haible * Copyright (c) 1999-2000 The XFree86 Project, Inc. */ /* THIS IS NOT AN X CONSORTIUM STANDARD */ /* * Big fonts suffer from the following: All clients that have opened a * font can access the complete glyph metrics array (the XFontStruct member * `per_char') directly, without going through a macro. Moreover these * glyph metrics are ink metrics, i.e. are not redundant even for a * fixed-width font. For a Unicode font, the size of this array is 768 KB. * * Problems: 1. It eats a lot of memory in each client. 2. All this glyph * metrics data is piped through the socket when the font is opened. * * This extension addresses these two problems for local clients, by using * shared memory. It also addresses the second problem for non-local clients, * by compressing the data before transmit by a factor of nearly 6. * * If you use this extension, your OS ought to nicely support shared memory. * This means: Shared memory should be swappable to the swap, and the limits * should be high enough (SHMMNI at least 64, SHMMAX at least 768 KB, * SHMALL at least 48 MB). It is a plus if your OS allows shmat() calls * on segments that have already been marked "removed", because it permits * these segments to be cleaned up by the OS if the X server is killed with * signal SIGKILL. * * This extension is transparently exploited by Xlib (functions XQueryFont, * XLoadQueryFont). */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #ifdef HAS_SHM #if defined(linux) && (!defined(__GNU_LIBRARY__) || __GNU_LIBRARY__ < 2) /* libc4 does not define __GNU_LIBRARY__, libc5 defines __GNU_LIBRARY__ as 1 */ /* Linux libc4 and libc5 only (because glibc doesn't include kernel headers): Linux 2.0.x and 2.2.x define SHMLBA as PAGE_SIZE, but forget to define PAGE_SIZE. It is defined in . */ #include #endif #ifdef SVR4 #include #endif #if defined(__CYGWIN__) || defined(__SCO__) #include #include #endif #include #include #include #include #include #include #include #endif #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "gcstruct.h" #include "dixfontstr.h" #include "extnsionst.h" #include "protocol-versions.h" #define _XF86BIGFONT_SERVER_ #include #ifdef HAS_XFONT2 # include #endif /* HAS_XFONT2 */ static void XF86BigfontResetProc( ExtensionEntry * /* extEntry */ ); static DISPATCH_PROC(ProcXF86BigfontDispatch); static DISPATCH_PROC(ProcXF86BigfontQueryVersion); static DISPATCH_PROC(ProcXF86BigfontQueryFont); static DISPATCH_PROC(SProcXF86BigfontDispatch); static DISPATCH_PROC(SProcXF86BigfontQueryVersion); static DISPATCH_PROC(SProcXF86BigfontQueryFont); #if 0 static unsigned char XF86BigfontReqCode; #endif #ifdef HAS_SHM /* A random signature, transmitted to the clients so they can verify that the shared memory segment they are attaching to was really established by the X server they are talking to. */ static CARD32 signature; /* Index for additional information stored in a FontRec's devPrivates array. */ static int FontShmdescIndex; static unsigned int pagesize; static Bool badSysCall = FALSE; #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) static void SigSysHandler( int signo) { badSysCall = TRUE; } static Bool CheckForShmSyscall(void) { void (*oldHandler)(int); int shmid = -1; /* If no SHM support in the kernel, the bad syscall will generate SIGSYS */ oldHandler = OsSignal(SIGSYS, SigSysHandler); badSysCall = FALSE; shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT); if (shmid != -1) { /* Successful allocation - clean up */ shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL); } else { /* Allocation failed */ badSysCall = TRUE; } OsSignal(SIGSYS, oldHandler); return (!badSysCall); } #define MUST_CHECK_FOR_SHM_SYSCALL #endif #endif void XFree86BigfontExtensionInit() { #if 0 ExtensionEntry* extEntry; if ((extEntry = AddExtension(XF86BIGFONTNAME, XF86BigfontNumberEvents, XF86BigfontNumberErrors, ProcXF86BigfontDispatch, SProcXF86BigfontDispatch, XF86BigfontResetProc, StandardMinorOpcode))) { XF86BigfontReqCode = (unsigned char) extEntry->base; #else if (AddExtension(XF86BIGFONTNAME, XF86BigfontNumberEvents, XF86BigfontNumberErrors, ProcXF86BigfontDispatch, SProcXF86BigfontDispatch, XF86BigfontResetProc, StandardMinorOpcode)) { #endif #ifdef HAS_SHM #ifdef MUST_CHECK_FOR_SHM_SYSCALL /* * Note: Local-clients will not be optimized without shared memory * support. Remote-client optimization does not depend on shared * memory support. Thus, the extension is still registered even * when shared memory support is not functional. */ if (!CheckForShmSyscall()) { ErrorF(XF86BIGFONTNAME " extension local-client optimization disabled due to lack of shared memory support in the kernel\n"); return; } #endif srand((unsigned int) time(NULL)); signature = ((unsigned int) (65536.0/(RAND_MAX+1.0) * rand()) << 16) + (unsigned int) (65536.0/(RAND_MAX+1.0) * rand()); /* fprintf(stderr, "signature = 0x%08X\n", signature); */ #ifdef HAS_XFONT2 FontShmdescIndex = xfont2_allocate_font_private_index(); #else FontShmdescIndex = AllocateFontPrivateIndex(); #endif /* HAS_XFONT2 */ #if !defined(CSRG_BASED) && !defined(__CYGWIN__) pagesize = SHMLBA; #else # ifdef _SC_PAGESIZE pagesize = sysconf(_SC_PAGESIZE); # else pagesize = getpagesize(); # endif #endif #endif } } /* ========== Management of shared memory segments ========== */ #ifdef HAS_SHM #ifdef __linux__ /* On Linux, shared memory marked as "removed" can still be attached. Nice feature, because the kernel will automatically free the associated storage when the server and all clients are gone. */ #define EARLY_REMOVE #endif typedef struct _ShmDesc { struct _ShmDesc *next; struct _ShmDesc **prev; int shmid; char *attach_addr; } ShmDescRec, *ShmDescPtr; static ShmDescPtr ShmList = (ShmDescPtr) NULL; static ShmDescPtr shmalloc( unsigned int size) { ShmDescPtr pDesc; int shmid; char *addr; #ifdef MUST_CHECK_FOR_SHM_SYSCALL if (pagesize == 0) return (ShmDescPtr) NULL; #endif /* On some older Linux systems, the number of shared memory segments system-wide is 127. In Linux 2.4, it is 4095. Therefore there is a tradeoff to be made between allocating a shared memory segment on one hand, and allocating memory and piping the glyph metrics on the other hand. If the glyph metrics size is small, we prefer the traditional way. */ if (size < 3500) return (ShmDescPtr) NULL; pDesc = (ShmDescRec *) malloc(sizeof(ShmDescRec)); if (!pDesc) return (ShmDescPtr) NULL; size = (size + pagesize-1) & -pagesize; shmid = shmget(IPC_PRIVATE, size, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH); if (shmid == -1) { ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, errno = %d\n", size, errno); free(pDesc); return (ShmDescPtr) NULL; } if ((addr = shmat(shmid, 0, 0)) == (char *)-1) { ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, errno = %d\n", size, errno); shmctl(shmid, IPC_RMID, (void *) 0); free(pDesc); return (ShmDescPtr) NULL; } #ifdef EARLY_REMOVE shmctl(shmid, IPC_RMID, (void *) 0); #endif pDesc->shmid = shmid; pDesc->attach_addr = addr; if (ShmList) ShmList->prev = &pDesc->next; pDesc->next = ShmList; pDesc->prev = &ShmList; ShmList = pDesc; return pDesc; } static void shmdealloc( ShmDescPtr pDesc) { #ifndef EARLY_REMOVE shmctl(pDesc->shmid, IPC_RMID, (void *) 0); #endif shmdt(pDesc->attach_addr); if (pDesc->next) pDesc->next->prev = pDesc->prev; *pDesc->prev = pDesc->next; free(pDesc); } #endif /* Called when a font is closed. */ void XF86BigfontFreeFontShm( FontPtr pFont) { #ifdef HAS_SHM ShmDescPtr pDesc; /* If during shutdown of the server, XF86BigfontCleanup() has already * called shmdealloc() for all segments, we don't need to do it here. */ if (!ShmList) return; pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex); if (pDesc) shmdealloc(pDesc); #endif } /* Called upon fatal signal. */ void XF86BigfontCleanup() { #ifdef HAS_SHM while (ShmList) shmdealloc(ShmList); #endif } /* Called when a server generation dies. */ static void XF86BigfontResetProc( ExtensionEntry* extEntry) { /* This function is normally called from CloseDownExtensions(), called * from main(). It will be followed by a call to FreeAllResources(), * which will call XF86BigfontFreeFontShm() for each font. Thus it * appears that we do not need to do anything in this function. -- * But I prefer to write robust code, and not keep shared memory lying * around when it's not needed any more. (Someone might close down the * extension without calling FreeAllResources()...) */ XF86BigfontCleanup(); } /* ========== Handling of extension specific requests ========== */ static int ProcXF86BigfontQueryVersion( ClientPtr client) { xXF86BigfontQueryVersionReply reply; REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq); memset(&reply, 0, sizeof(xXF86BigfontQueryVersionReply)); reply.type = X_Reply; reply.length = 0; reply.sequenceNumber = client->sequence; reply.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION; reply.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION; reply.uid = geteuid(); reply.gid = getegid(); #ifdef HAS_SHM reply.signature = signature; #else reply.signature = 0; /* This is redundant. Avoids uninitialized memory. */ #endif reply.capabilities = #ifdef HAS_SHM (client->local && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0) #else 0 #endif ; /* may add more bits here in future versions */ if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swaps(&reply.majorVersion); swaps(&reply.minorVersion); swapl(&reply.uid); swapl(&reply.gid); swapl(&reply.signature); } WriteToClient(client, sizeof(xXF86BigfontQueryVersionReply), &reply); return client->noClientException; } static void swapCharInfo( xCharInfo *pCI) { swaps(&pCI->leftSideBearing); swaps(&pCI->rightSideBearing); swaps(&pCI->characterWidth); swaps(&pCI->ascent); swaps(&pCI->descent); swaps(&pCI->attributes); } /* static CARD32 hashCI (xCharInfo *p); */ #define hashCI(p) \ (CARD32)(((p->leftSideBearing << 27) + (p->leftSideBearing >> 5) + \ (p->rightSideBearing << 23) + (p->rightSideBearing >> 9) + \ (p->characterWidth << 16) + \ (p->ascent << 11) + (p->descent << 6)) ^ p->attributes) static int ProcXF86BigfontQueryFont( ClientPtr client) { FontPtr pFont; REQUEST(xXF86BigfontQueryFontReq); CARD32 stuff_flags; xCharInfo* pmax; xCharInfo* pmin; int nCharInfos; int shmid; #ifdef HAS_SHM ShmDescPtr pDesc = NULL; #else #define pDesc 0 #endif xCharInfo* pCI; CARD16* pIndex2UniqIndex; CARD16* pUniqIndex2Index; CARD32 nUniqCharInfos; #if 0 REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq); #else switch (client->req_len) { case 2: /* client with version 1.0 libX11 */ stuff_flags = (client->local && !client->swapped ? XF86Bigfont_FLAGS_Shm : 0); break; case 3: /* client with version 1.1 libX11 */ stuff_flags = stuff->flags; break; default: return BadLength; } #endif client->errorValue = stuff->id; /* EITHER font or gc */ pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, DixReadAccess); if (!pFont) { /* can't use VERIFY_GC because it might return BadGC */ GC *pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC, DixReadAccess); if (!pGC) { client->errorValue = stuff->id; return BadFont; /* procotol spec says only error is BadFont */ } pFont = pGC->font; } pmax = FONTINKMAX(pFont); pmin = FONTINKMIN(pFont); nCharInfos = (pmax->rightSideBearing == pmin->rightSideBearing && pmax->leftSideBearing == pmin->leftSideBearing && pmax->descent == pmin->descent && pmax->ascent == pmin->ascent && pmax->characterWidth == pmin->characterWidth) ? 0 : N2dChars(pFont); shmid = -1; pCI = NULL; pIndex2UniqIndex = NULL; pUniqIndex2Index = NULL; nUniqCharInfos = 0; if (nCharInfos > 0) { #ifdef HAS_SHM if (!badSysCall) pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex); else pDesc = NULL; if (pDesc) { pCI = (xCharInfo *) pDesc->attach_addr; if (stuff_flags & XF86Bigfont_FLAGS_Shm) shmid = pDesc->shmid; } else { if (stuff_flags & XF86Bigfont_FLAGS_Shm && !badSysCall) pDesc = shmalloc(nCharInfos * sizeof(xCharInfo) + sizeof(CARD32)); if (pDesc) { pCI = (xCharInfo *) pDesc->attach_addr; shmid = pDesc->shmid; } else { #endif pCI = (xCharInfo *) malloc(nCharInfos * sizeof(xCharInfo)); if (!pCI) return BadAlloc; #ifdef HAS_SHM } #endif /* Fill nCharInfos starting at pCI. */ { xCharInfo* prCI = pCI; int ninfos = 0; int ncols = pFont->info.lastCol - pFont->info.firstCol + 1; int row; for (row = pFont->info.firstRow; row <= pFont->info.lastRow && ninfos < nCharInfos; row++) { unsigned char chars[512]; xCharInfo* tmpCharInfos[256]; unsigned long count; int col; unsigned long i; i = 0; for (col = pFont->info.firstCol; col <= pFont->info.lastCol; col++) { chars[i++] = row; chars[i++] = col; } (*pFont->get_metrics) (pFont, ncols, chars, TwoD16Bit, &count, tmpCharInfos); for (i = 0; i < count && ninfos < nCharInfos; i++) { *prCI++ = *tmpCharInfos[i]; ninfos++; } } } #ifdef HAS_SHM if (pDesc && !badSysCall) { *(CARD32 *)(pCI + nCharInfos) = signature; #ifdef HAS_XFONT2 if (!xfont2_font_set_private(pFont, FontShmdescIndex, pDesc)) { #else if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) { #endif /* HAS_XFONT2 */ shmdealloc(pDesc); return BadAlloc; } } } #endif if (shmid == -1) { /* Cannot use shared memory, so remove-duplicates the xCharInfos using a temporary hash table. */ /* Note that CARD16 is suitable as index type, because nCharInfos <= 0x10000. */ CARD32 hashModulus; CARD16* pHash2UniqIndex; CARD16* pUniqIndex2NextUniqIndex; CARD32 NextIndex; CARD32 NextUniqIndex; CARD16* tmp; CARD32 i, j; hashModulus = 67; if (hashModulus > nCharInfos+1) hashModulus = nCharInfos+1; tmp = (CARD16*) malloc((4*nCharInfos+1) * sizeof(CARD16)); if (!tmp) { if (!pDesc) free(pCI); return BadAlloc; } pIndex2UniqIndex = tmp; /* nCharInfos elements */ pUniqIndex2Index = tmp + nCharInfos; /* max. nCharInfos elements */ pUniqIndex2NextUniqIndex = tmp + 2*nCharInfos; /* max. nCharInfos elements */ pHash2UniqIndex = tmp + 3*nCharInfos; /* hashModulus (<= nCharInfos+1) elements */ /* Note that we can use 0xffff as end-of-list indicator, because even if nCharInfos = 0x10000, 0xffff can not occur as valid entry before the last element has been inserted. And once the last element has been inserted, we don't need the hash table any more. */ for (j = 0; j < hashModulus; j++) pHash2UniqIndex[j] = (CARD16)(-1); NextUniqIndex = 0; for (NextIndex = 0; NextIndex < nCharInfos; NextIndex++) { xCharInfo* p = &pCI[NextIndex]; CARD32 hashCode = hashCI(p) % hashModulus; for (i = pHash2UniqIndex[hashCode]; i != (CARD16)(-1); i = pUniqIndex2NextUniqIndex[i]) { j = pUniqIndex2Index[i]; if (pCI[j].leftSideBearing == p->leftSideBearing && pCI[j].rightSideBearing == p->rightSideBearing && pCI[j].characterWidth == p->characterWidth && pCI[j].ascent == p->ascent && pCI[j].descent == p->descent && pCI[j].attributes == p->attributes) break; } if (i != (CARD16)(-1)) { /* Found *p at Index j, UniqIndex i */ pIndex2UniqIndex[NextIndex] = i; } else { /* Allocate a new entry in the Uniq table */ if (hashModulus <= 2*NextUniqIndex && hashModulus < nCharInfos+1) { /* Time to increate hash table size */ hashModulus = 2*hashModulus+1; if (hashModulus > nCharInfos+1) hashModulus = nCharInfos+1; for (j = 0; j < hashModulus; j++) pHash2UniqIndex[j] = (CARD16)(-1); for (i = 0; i < NextUniqIndex; i++) pUniqIndex2NextUniqIndex[i] = (CARD16)(-1); for (i = 0; i < NextUniqIndex; i++) { j = pUniqIndex2Index[i]; p = &pCI[j]; hashCode = hashCI(p) % hashModulus; pUniqIndex2NextUniqIndex[i] = pHash2UniqIndex[hashCode]; pHash2UniqIndex[hashCode] = i; } p = &pCI[NextIndex]; hashCode = hashCI(p) % hashModulus; } i = NextUniqIndex++; pUniqIndex2NextUniqIndex[i] = pHash2UniqIndex[hashCode]; pHash2UniqIndex[hashCode] = i; pUniqIndex2Index[i] = NextIndex; pIndex2UniqIndex[NextIndex] = i; } } nUniqCharInfos = NextUniqIndex; /* fprintf(stderr, "font metrics: nCharInfos = %d, nUniqCharInfos = %d, hashModulus = %d\n", nCharInfos, nUniqCharInfos, hashModulus); */ } } { int nfontprops = pFont->info.nprops; int rlength = sizeof(xXF86BigfontQueryFontReply) + nfontprops * sizeof(xFontProp) + (nCharInfos > 0 && shmid == -1 ? nUniqCharInfos * sizeof(xCharInfo) + (nCharInfos+1)/2 * 2 * sizeof(CARD16) : 0); xXF86BigfontQueryFontReply* reply = (xXF86BigfontQueryFontReply *) calloc(1, rlength); char* p; if (!reply) { if (nCharInfos > 0) { if (shmid == -1) free(pIndex2UniqIndex); if (!pDesc) free(pCI); } return BadAlloc; } reply->type = X_Reply; reply->length = (rlength - sizeof(xGenericReply)) >> 2; reply->sequenceNumber = client->sequence; reply->minBounds = pFont->info.ink_minbounds; reply->maxBounds = pFont->info.ink_maxbounds; reply->minCharOrByte2 = pFont->info.firstCol; reply->maxCharOrByte2 = pFont->info.lastCol; reply->defaultChar = pFont->info.defaultCh; reply->nFontProps = pFont->info.nprops; reply->drawDirection = pFont->info.drawDirection; reply->minByte1 = pFont->info.firstRow; reply->maxByte1 = pFont->info.lastRow; reply->allCharsExist = pFont->info.allExist; reply->fontAscent = pFont->info.fontAscent; reply->fontDescent = pFont->info.fontDescent; reply->nCharInfos = nCharInfos; reply->nUniqCharInfos = nUniqCharInfos; reply->shmid = shmid; reply->shmsegoffset = 0; if (client->swapped) { swaps(&reply->sequenceNumber); swapl(&reply->length); swapCharInfo(&reply->minBounds); swapCharInfo(&reply->maxBounds); swaps(&reply->minCharOrByte2); swaps(&reply->maxCharOrByte2); swaps(&reply->defaultChar); swaps(&reply->nFontProps); swaps(&reply->fontAscent); swaps(&reply->fontDescent); swapl(&reply->nCharInfos); swapl(&reply->nUniqCharInfos); swapl(&reply->shmid); swapl(&reply->shmsegoffset); } p = (char*) &reply[1]; { FontPropPtr pFP; xFontProp* prFP; int i; for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) p; i < nfontprops; i++, pFP++, prFP++) { prFP->name = pFP->name; prFP->value = pFP->value; if (client->swapped) { swapl(&prFP->name); swapl(&prFP->value); } } p = (char*) prFP; } if (nCharInfos > 0 && shmid == -1) { xCharInfo* pci; CARD16* ps; int i, j; pci = (xCharInfo*) p; for (i = 0; i < nUniqCharInfos; i++, pci++) { *pci = pCI[pUniqIndex2Index[i]]; if (client->swapped) swapCharInfo(pci); } ps = (CARD16*) pci; for (j = 0; j < nCharInfos; j++, ps++) { *ps = pIndex2UniqIndex[j]; if (client->swapped) { swaps(ps); } } } WriteToClient(client, rlength, reply); free(reply); if (nCharInfos > 0) { if (shmid == -1) free(pIndex2UniqIndex); if (!pDesc) free(pCI); } return (client->noClientException); } } static int ProcXF86BigfontDispatch( ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_XF86BigfontQueryVersion: return ProcXF86BigfontQueryVersion(client); case X_XF86BigfontQueryFont: return ProcXF86BigfontQueryFont(client); default: return BadRequest; } } static int SProcXF86BigfontQueryVersion( ClientPtr client) { REQUEST(xXF86BigfontQueryVersionReq); swaps(&stuff->length); return ProcXF86BigfontQueryVersion(client); } static int SProcXF86BigfontQueryFont( ClientPtr client) { REQUEST(xXF86BigfontQueryFontReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq); swapl(&stuff->id); return ProcXF86BigfontQueryFont(client); } static int SProcXF86BigfontDispatch( ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_XF86BigfontQueryVersion: return SProcXF86BigfontQueryVersion(client); case X_XF86BigfontQueryFont: return SProcXF86BigfontQueryFont(client); default: return BadRequest; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/xres.c0000644000000000000000000002326213614532331016655 0ustar /* Copyright (c) 2002 XFree86 Inc */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include "swaprep.h" #include #include "pixmapstr.h" #include "windowstr.h" #include "gcstruct.h" #include "protocol-versions.h" static int ProcXResQueryVersion (ClientPtr client) { xXResQueryVersionReply rep; REQUEST_SIZE_MATCH (xXResQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.server_major = SERVER_XRES_MAJOR_VERSION; rep.server_minor = SERVER_XRES_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.server_major); swaps(&rep.server_minor); } WriteToClient(client, sizeof (xXResQueryVersionReply), &rep); return (client->noClientException); } static int ProcXResQueryClients (ClientPtr client) { /* REQUEST(xXResQueryClientsReq); */ xXResQueryClientsReply rep; int *current_clients; int i, num_clients; REQUEST_SIZE_MATCH(xXResQueryClientsReq); current_clients = malloc((currentMaxClients - 1) * sizeof(int)); num_clients = 0; for(i = 1; i < currentMaxClients; i++) { if(clients[i]) { current_clients[num_clients] = i; num_clients++; } } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.num_clients = num_clients; rep.length = rep.num_clients * sz_xXResClient >> 2; if (client->swapped) { swaps (&rep.sequenceNumber); swapl (&rep.length); swapl (&rep.num_clients); } WriteToClient (client, sizeof (xXResQueryClientsReply), &rep); if(num_clients) { xXResClient scratch; for(i = 0; i < num_clients; i++) { scratch.resource_base = clients[current_clients[i]]->clientAsMask; scratch.resource_mask = RESOURCE_ID_MASK; if(client->swapped) { swapl (&scratch.resource_base); swapl (&scratch.resource_mask); } WriteToClient (client, sz_xXResClient, &scratch); } } free(current_clients); return (client->noClientException); } static void ResFindAllRes (void * value, XID id, RESTYPE type, void * cdata) { int *counts = (int *)cdata; counts[(type & TypeMask) - 1]++; } static int ProcXResQueryClientResources (ClientPtr client) { REQUEST(xXResQueryClientResourcesReq); xXResQueryClientResourcesReply rep; int i, clientID, num_types; int *counts; REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq); clientID = CLIENT_ID(stuff->xid); /* we could remove the (clientID == 0) check if we wanted to allow probing the X-server's resource usage */ if(!clientID || (clientID >= currentMaxClients) || !clients[clientID]) { client->errorValue = stuff->xid; return BadValue; } counts = malloc((lastResourceType + 1) * sizeof(int)); memset(counts, 0, (lastResourceType + 1) * sizeof(int)); FindAllClientResources(clients[clientID], ResFindAllRes, counts); num_types = 0; for(i = 0; i <= lastResourceType; i++) { if(counts[i]) num_types++; } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.num_types = num_types; rep.length = rep.num_types * sz_xXResType >> 2; if (client->swapped) { swaps (&rep.sequenceNumber); swapl (&rep.length); swapl (&rep.num_types); } WriteToClient (client,sizeof(xXResQueryClientResourcesReply),&rep); if(num_types) { xXResType scratch; for(i = 0; i < lastResourceType; i++) { if(!counts[i]) continue; if(!ResourceNames[i + 1]) { char buf[40]; snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1); RegisterResourceName(i + 1, buf); } scratch.resource_type = ResourceNames[i + 1]; scratch.count = counts[i]; if(client->swapped) { swapl (&scratch.resource_type); swapl (&scratch.count); } WriteToClient (client, sz_xXResType, &scratch); } } free(counts); return (client->noClientException); } static unsigned long ResGetApproxPixmapBytes (PixmapPtr pix) { unsigned long nPixels; int bytesPerPixel; bytesPerPixel = pix->drawable.bitsPerPixel>>3; nPixels = pix->drawable.width * pix->drawable.height; /* Divide by refcnt as pixmap could be shared between clients, * so total pixmap mem is shared between these. */ return ( nPixels * bytesPerPixel ) / pix->refcnt; } static void ResFindPixmaps (void * value, XID id, void * cdata) { unsigned long *bytes = (unsigned long *)cdata; PixmapPtr pix = (PixmapPtr)value; *bytes += ResGetApproxPixmapBytes(pix); } static void ResFindWindowPixmaps (void * value, XID id, void * cdata) { unsigned long *bytes = (unsigned long *)cdata; WindowPtr pWin = (WindowPtr)value; if (pWin->backgroundState == BackgroundPixmap) *bytes += ResGetApproxPixmapBytes(pWin->background.pixmap); if (pWin->border.pixmap != NULL && !pWin->borderIsPixel) *bytes += ResGetApproxPixmapBytes(pWin->border.pixmap); } static void ResFindGCPixmaps (void * value, XID id, void * cdata) { unsigned long *bytes = (unsigned long *)cdata; GCPtr pGC = (GCPtr)value; if (pGC->stipple != NULL) *bytes += ResGetApproxPixmapBytes(pGC->stipple); if (pGC->tile.pixmap != NULL && !pGC->tileIsPixel) *bytes += ResGetApproxPixmapBytes(pGC->tile.pixmap); } static int ProcXResQueryClientPixmapBytes (ClientPtr client) { REQUEST(xXResQueryClientPixmapBytesReq); xXResQueryClientPixmapBytesReply rep; int clientID; unsigned long bytes; REQUEST_SIZE_MATCH(xXResQueryClientPixmapBytesReq); clientID = CLIENT_ID(stuff->xid); /* we could remove the (clientID == 0) check if we wanted to allow probing the X-server's resource usage */ if(!clientID || (clientID >= currentMaxClients) || !clients[clientID]) { client->errorValue = stuff->xid; return BadValue; } bytes = 0; FindClientResourcesByType(clients[clientID], RT_PIXMAP, ResFindPixmaps, (void *)(&bytes)); /* * Make sure win background pixmaps also held to account. */ FindClientResourcesByType(clients[clientID], RT_WINDOW, ResFindWindowPixmaps, (void *)(&bytes)); /* * GC Tile & Stipple pixmaps too. */ FindClientResourcesByType(clients[clientID], RT_GC, ResFindGCPixmaps, (void *)(&bytes)); #ifdef COMPOSITE /* FIXME: include composite pixmaps too */ #endif rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.bytes = bytes; #ifdef _XSERVER64 rep.bytes_overflow = bytes >> 32; #else rep.bytes_overflow = 0; #endif if (client->swapped) { swaps (&rep.sequenceNumber); swapl (&rep.length); swapl (&rep.bytes); swapl (&rep.bytes_overflow); } WriteToClient (client,sizeof(xXResQueryClientPixmapBytesReply),&rep); return (client->noClientException); } static void ResResetProc (ExtensionEntry *extEntry) { } static int ProcResDispatch (ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_XResQueryVersion: return ProcXResQueryVersion(client); case X_XResQueryClients: return ProcXResQueryClients(client); case X_XResQueryClientResources: return ProcXResQueryClientResources(client); case X_XResQueryClientPixmapBytes: return ProcXResQueryClientPixmapBytes(client); default: break; } return BadRequest; } static int SProcXResQueryVersion (ClientPtr client) { REQUEST_SIZE_MATCH (xXResQueryVersionReq); return ProcXResQueryVersion(client); } static int SProcXResQueryClientResources (ClientPtr client) { REQUEST(xXResQueryClientResourcesReq); REQUEST_SIZE_MATCH (xXResQueryClientResourcesReq); swapl(&stuff->xid); return ProcXResQueryClientResources(client); } static int SProcXResQueryClientPixmapBytes (ClientPtr client) { REQUEST(xXResQueryClientPixmapBytesReq); REQUEST_SIZE_MATCH (xXResQueryClientPixmapBytesReq); swapl(&stuff->xid); return ProcXResQueryClientPixmapBytes(client); } static int SProcResDispatch (ClientPtr client) { REQUEST(xReq); swaps(&stuff->length); switch (stuff->data) { case X_XResQueryVersion: return SProcXResQueryVersion(client); case X_XResQueryClients: /* nothing to swap */ return ProcXResQueryClients(client); case X_XResQueryClientResources: return SProcXResQueryClientResources(client); case X_XResQueryClientPixmapBytes: return SProcXResQueryClientPixmapBytes(client); default: break; } return BadRequest; } void ResExtensionInit(void) { (void) AddExtension(XRES_NAME, 0, 0, ProcResDispatch, SProcResDispatch, ResResetProc, StandardMinorOpcode); RegisterResourceName(RT_NONE, "NONE"); RegisterResourceName(RT_WINDOW, "WINDOW"); RegisterResourceName(RT_PIXMAP, "PIXMAP"); RegisterResourceName(RT_GC, "GC"); RegisterResourceName(RT_FONT, "FONT"); RegisterResourceName(RT_CURSOR, "CURSOR"); RegisterResourceName(RT_COLORMAP, "COLORMAP"); RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY"); RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT"); RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB"); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/xtest.c0000644000000000000000000003454513614532331017051 0ustar /* Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include "windowstr.h" #include "inputstr.h" #include "scrnintstr.h" #include "dixevents.h" #include "sleepuntil.h" #define _XTEST_SERVER_ #include #include #ifdef XINPUT #include #include #define EXTENSION_EVENT_BASE 64 #include "extinit.h" /* LookupDeviceIntRec */ #endif /* XINPUT */ #if 0 static unsigned char XTestReqCode; #endif #ifdef XINPUT extern int DeviceValuator; #endif /* XINPUT */ #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #endif static void XTestResetProc( ExtensionEntry * /* extEntry */ ); static int XTestSwapFakeInput( ClientPtr /* client */, xReq * /* req */ ); static DISPATCH_PROC(ProcXTestCompareCursor); static DISPATCH_PROC(ProcXTestDispatch); static DISPATCH_PROC(ProcXTestFakeInput); static DISPATCH_PROC(ProcXTestGetVersion); static DISPATCH_PROC(ProcXTestGrabControl); static DISPATCH_PROC(SProcXTestCompareCursor); static DISPATCH_PROC(SProcXTestDispatch); static DISPATCH_PROC(SProcXTestFakeInput); static DISPATCH_PROC(SProcXTestGetVersion); static DISPATCH_PROC(SProcXTestGrabControl); void XTestExtensionInit(void) { #if 0 ExtensionEntry *extEntry; if ((extEntry = AddExtension(XTestExtensionName, 0, 0, ProcXTestDispatch, SProcXTestDispatch, XTestResetProc, StandardMinorOpcode)) != 0) XTestReqCode = (unsigned char)extEntry->base; #else (void) AddExtension(XTestExtensionName, 0, 0, ProcXTestDispatch, SProcXTestDispatch, XTestResetProc, StandardMinorOpcode); #endif } /*ARGSUSED*/ static void XTestResetProc (extEntry) ExtensionEntry *extEntry; { } static int ProcXTestGetVersion(client) register ClientPtr client; { xXTestGetVersionReply rep = {0}; REQUEST_SIZE_MATCH(xXTestGetVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = XTestMajorVersion; rep.minorVersion = XTestMinorVersion; if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.minorVersion); } WriteToClient(client, sizeof(xXTestGetVersionReply), &rep); return(client->noClientException); } static int ProcXTestCompareCursor(client) register ClientPtr client; { REQUEST(xXTestCompareCursorReq); xXTestCompareCursorReply rep = {0}; WindowPtr pWin; CursorPtr pCursor; REQUEST_SIZE_MATCH(xXTestCompareCursorReq); pWin = (WindowPtr)LookupWindow(stuff->window, client); if (!pWin) return(BadWindow); if (stuff->cursor == None) pCursor = NullCursor; else if (stuff->cursor == XTestCurrentCursor) pCursor = GetSpriteCursor(); else { pCursor = (CursorPtr)LookupIDByType(stuff->cursor, RT_CURSOR); if (!pCursor) { client->errorValue = stuff->cursor; return (BadCursor); } } rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.same = (wCursor(pWin) == pCursor); if (client->swapped) { swaps(&rep.sequenceNumber); } WriteToClient(client, sizeof(xXTestCompareCursorReply), &rep); return(client->noClientException); } static int ProcXTestFakeInput(client) register ClientPtr client; { REQUEST(xXTestFakeInputReq); int nev, n, type; xEvent *ev; DeviceIntPtr dev = NULL; WindowPtr root; #ifdef XINPUT Bool extension = FALSE; deviceValuator *dv = NULL; int base; int *values; #endif /* XINPUT */ nev = (stuff->length << 2) - sizeof(xReq); if ((nev % sizeof(xEvent)) || !nev) return BadLength; nev /= sizeof(xEvent); UpdateCurrentTime(); ev = (xEvent *)&((xReq *)stuff)[1]; type = ev->u.u.type & 0177; #ifdef XINPUT if (type >= EXTENSION_EVENT_BASE) { type -= DeviceValuator; switch (type) { case XI_DeviceKeyPress: case XI_DeviceKeyRelease: case XI_DeviceButtonPress: case XI_DeviceButtonRelease: case XI_DeviceMotionNotify: case XI_ProximityIn: case XI_ProximityOut: break; default: client->errorValue = ev->u.u.type; return BadValue; } if (nev == 1 && type == XI_DeviceMotionNotify) return BadLength; if (type == XI_DeviceMotionNotify) base = ((deviceValuator *)(ev+1))->first_valuator; else base = 0; for (n = 1; n < nev; n++) { dv = (deviceValuator *)(ev + n); if (dv->type != DeviceValuator) { client->errorValue = dv->type; return BadValue; } if (dv->first_valuator != base) { client->errorValue = dv->first_valuator; return BadValue; } if (!dv->num_valuators || dv->num_valuators > 6) { client->errorValue = dv->num_valuators; return BadValue; } base += dv->num_valuators; } type = type - XI_DeviceKeyPress + KeyPress; extension = TRUE; } else #endif /* XINPUT */ { if (nev != 1) return BadLength; switch (type) { case KeyPress: case KeyRelease: case MotionNotify: case ButtonPress: case ButtonRelease: break; default: client->errorValue = ev->u.u.type; return BadValue; } } if (ev->u.keyButtonPointer.time) { TimeStamp activateTime; CARD32 ms; activateTime = currentTime; ms = activateTime.milliseconds + ev->u.keyButtonPointer.time; if (ms < activateTime.milliseconds) activateTime.months++; activateTime.milliseconds = ms; ev->u.keyButtonPointer.time = 0; /* see mbuf.c:QueueDisplayRequest for code similar to this */ if (!ClientSleepUntil(client, &activateTime, NULL, NULL)) { return BadAlloc; } /* swap the request back so we can simply re-execute it */ if (client->swapped) { (void) XTestSwapFakeInput(client, (xReq *)stuff); swaps(&stuff->length); } ResetCurrentRequest (client); client->sequence--; return Success; } #ifdef XINPUT if (extension) { dev = LookupDeviceIntRec(stuff->deviceid & 0177); if (!dev) { client->errorValue = stuff->deviceid & 0177; return BadValue; } if (nev > 1) { dv = (deviceValuator *)(ev + 1); if (!dev->valuator || dv->first_valuator >= dev->valuator->numAxes) { client->errorValue = dv->first_valuator; return BadValue; } if (dv->first_valuator + dv->num_valuators > dev->valuator->numAxes) { client->errorValue = dv->num_valuators; return BadValue; } } } #endif /* XINPUT */ switch (type) { case KeyPress: case KeyRelease: #ifdef XINPUT if (!extension) #endif /* XINPUT */ dev = (DeviceIntPtr)LookupKeyboardDevice(); if (ev->u.u.detail < dev->key->curKeySyms.minKeyCode || ev->u.u.detail > dev->key->curKeySyms.maxKeyCode) { client->errorValue = ev->u.u.detail; return BadValue; } break; case MotionNotify: #ifdef XINPUT if (extension) { if (ev->u.u.detail != xFalse && ev->u.u.detail != xTrue) { client->errorValue = ev->u.u.detail; return BadValue; } if (ev->u.u.detail == xTrue && dev->valuator->mode == Absolute) { values = dev->valuator->axisVal + dv->first_valuator; for (n = 1; n < nev; n++) { dv = (deviceValuator *)(ev + n); switch (dv->num_valuators) { case 6: dv->valuator5 += values[5]; case 5: dv->valuator4 += values[4]; case 4: dv->valuator3 += values[3]; case 3: dv->valuator2 += values[2]; case 2: dv->valuator1 += values[1]; case 1: dv->valuator0 += values[0]; } values += 6; } } break; } #endif /* XINPUT */ dev = (DeviceIntPtr)LookupPointerDevice(); if (ev->u.keyButtonPointer.root == None) root = GetCurrentRootWindow(); else { root = LookupWindow(ev->u.keyButtonPointer.root, client); if (!root) return BadWindow; if (root->parent) { client->errorValue = ev->u.keyButtonPointer.root; return BadValue; } } if (ev->u.u.detail == xTrue) { int x, y; GetSpritePosition(&x, &y); ev->u.keyButtonPointer.rootX += x; ev->u.keyButtonPointer.rootY += y; } else if (ev->u.u.detail != xFalse) { client->errorValue = ev->u.u.detail; return BadValue; } #ifdef PANORAMIX if (!noPanoramiXExtension) { ScreenPtr pScreen = root->drawable.pScreen; BoxRec box; int i; int x = ev->u.keyButtonPointer.rootX + panoramiXdataPtr[0].x; int y = ev->u.keyButtonPointer.rootY + panoramiXdataPtr[0].y; if (!RegionContainsPoint(&XineramaScreenRegions[pScreen->myNum], x, y, &box)) { FOR_NSCREENS(i) { if (i == pScreen->myNum) continue; if (RegionContainsPoint( &XineramaScreenRegions[i], x, y, &box)) { root = screenInfo.screens[i]->root; x -= panoramiXdataPtr[i].x; y -= panoramiXdataPtr[i].y; ev->u.keyButtonPointer.rootX = x; ev->u.keyButtonPointer.rootY = y; break; } } } } #endif if (ev->u.keyButtonPointer.rootX < 0) ev->u.keyButtonPointer.rootX = 0; else if (ev->u.keyButtonPointer.rootX >= root->drawable.width) ev->u.keyButtonPointer.rootX = root->drawable.width - 1; if (ev->u.keyButtonPointer.rootY < 0) ev->u.keyButtonPointer.rootY = 0; else if (ev->u.keyButtonPointer.rootY >= root->drawable.height) ev->u.keyButtonPointer.rootY = root->drawable.height - 1; #ifdef PANORAMIX if ((!noPanoramiXExtension && root->drawable.pScreen->myNum != XineramaGetCursorScreen()) || (noPanoramiXExtension && root != GetCurrentRootWindow())) #else if (root != GetCurrentRootWindow()) #endif { NewCurrentScreen(root->drawable.pScreen, ev->u.keyButtonPointer.rootX, ev->u.keyButtonPointer.rootY); return client->noClientException; } (*root->drawable.pScreen->SetCursorPosition) (root->drawable.pScreen, ev->u.keyButtonPointer.rootX, ev->u.keyButtonPointer.rootY, FALSE); dev->valuator->lastx = ev->u.keyButtonPointer.rootX; dev->valuator->lasty = ev->u.keyButtonPointer.rootY; break; case ButtonPress: case ButtonRelease: #ifdef XINPUT if (!extension) #endif /* XINPUT */ dev = (DeviceIntPtr)LookupPointerDevice(); if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons) { client->errorValue = ev->u.u.detail; return BadValue; } break; } if (screenIsSaved == SCREEN_SAVER_ON) SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset); ev->u.keyButtonPointer.time = currentTime.milliseconds; (*dev->public.processInputProc)(ev, dev, nev); return client->noClientException; } static int ProcXTestGrabControl(client) register ClientPtr client; { REQUEST(xXTestGrabControlReq); REQUEST_SIZE_MATCH(xXTestGrabControlReq); if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse)) { client->errorValue = stuff->impervious; return(BadValue); } if (stuff->impervious) MakeClientGrabImpervious(client); else MakeClientGrabPervious(client); return(client->noClientException); } static int ProcXTestDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_XTestGetVersion: return ProcXTestGetVersion(client); case X_XTestCompareCursor: return ProcXTestCompareCursor(client); case X_XTestFakeInput: return ProcXTestFakeInput(client); case X_XTestGrabControl: return ProcXTestGrabControl(client); default: return BadRequest; } } static int SProcXTestGetVersion(client) register ClientPtr client; { REQUEST(xXTestGetVersionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXTestGetVersionReq); swaps(&stuff->minorVersion); return ProcXTestGetVersion(client); } static int SProcXTestCompareCursor(client) register ClientPtr client; { REQUEST(xXTestCompareCursorReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXTestCompareCursorReq); swapl(&stuff->window); swapl(&stuff->cursor); return ProcXTestCompareCursor(client); } static int XTestSwapFakeInput(client, req) register ClientPtr client; xReq *req; { register int nev; register xEvent *ev; xEvent sev; EventSwapPtr proc; nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent); for (ev = (xEvent *)&req[1]; --nev >= 0; ev++) { /* Swap event */ proc = EventSwapVector[ev->u.u.type & 0177]; /* no swapping proc; invalid event type? */ if (!proc || proc == NotImplemented) { client->errorValue = ev->u.u.type; return BadValue; } (*proc)(ev, &sev); *ev = sev; } return Success; } static int SProcXTestFakeInput(client) register ClientPtr client; { register int n; REQUEST(xReq); swaps(&stuff->length); n = XTestSwapFakeInput(client, stuff); if (n != Success) return n; return ProcXTestFakeInput(client); } static int SProcXTestGrabControl(client) register ClientPtr client; { REQUEST(xXTestGrabControlReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXTestGrabControlReq); return ProcXTestGrabControl(client); } static int SProcXTestDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_XTestGetVersion: return SProcXTestGetVersion(client); case X_XTestCompareCursor: return SProcXTestCompareCursor(client); case X_XTestFakeInput: return SProcXTestFakeInput(client); case X_XTestGrabControl: return SProcXTestGrabControl(client); default: return BadRequest; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/xvdisp.c0000644000000000000000000015062213614532331017212 0ustar /*********************************************************** Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* ** File: ** ** xvdisp.c --- Xv server extension dispatch module. ** ** Author: ** ** David Carver (Digital Workstation Engineering/Project Athena) ** ** Revisions: ** ** 11.06.91 Carver ** - changed SetPortControl to SetPortAttribute ** - changed GetPortControl to GetPortAttribute ** - changed QueryBestSize ** ** 15.05.91 Carver ** - version 2.0 upgrade ** ** 24.01.91 Carver ** - version 1.4 upgrade ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "scrnintstr.h" #include "windowstr.h" #include "pixmapstr.h" #include "gcstruct.h" #include "dixstruct.h" #include "resource.h" #include "opaque.h" #include #include #include "xvdix.h" #ifdef MITSHM #define _XSHM_SERVER_ #ifdef LEGACY_XEXT_PROTO #include #else #include #endif #endif #include "xvdisp.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" unsigned long XvXRTPort; #ifdef MITSHM static int XineramaXvShmPutImage(ClientPtr); #endif static int XineramaXvPutImage(ClientPtr); static int XineramaXvPutVideo(ClientPtr); static int XineramaXvPutStill(ClientPtr); static int XineramaXvSetPortAttribute(ClientPtr); static int XineramaXvStopVideo(ClientPtr); #endif /* INTERNAL */ static int ProcXvQueryExtension(ClientPtr); static int ProcXvQueryAdaptors(ClientPtr); static int ProcXvQueryEncodings(ClientPtr); static int ProcXvPutVideo(ClientPtr); static int ProcXvPutStill(ClientPtr); static int ProcXvGetVideo(ClientPtr); static int ProcXvGetStill(ClientPtr); static int ProcXvGrabPort(ClientPtr); static int ProcXvUngrabPort(ClientPtr); static int ProcXvSelectVideoNotify(ClientPtr); static int ProcXvSelectPortNotify(ClientPtr); static int ProcXvStopVideo(ClientPtr); static int ProcXvSetPortAttribute(ClientPtr); static int ProcXvGetPortAttribute(ClientPtr); static int ProcXvQueryBestSize(ClientPtr); static int ProcXvQueryPortAttributes(ClientPtr); static int ProcXvPutImage(ClientPtr); #ifdef MITSHM static int ProcXvShmPutImage(ClientPtr); #endif static int ProcXvQueryImageAttributes(ClientPtr); static int ProcXvListImageFormats(ClientPtr); static int SProcXvQueryExtension(ClientPtr); static int SProcXvQueryAdaptors(ClientPtr); static int SProcXvQueryEncodings(ClientPtr); static int SProcXvPutVideo(ClientPtr); static int SProcXvPutStill(ClientPtr); static int SProcXvGetVideo(ClientPtr); static int SProcXvGetStill(ClientPtr); static int SProcXvGrabPort(ClientPtr); static int SProcXvUngrabPort(ClientPtr); static int SProcXvSelectVideoNotify(ClientPtr); static int SProcXvSelectPortNotify(ClientPtr); static int SProcXvStopVideo(ClientPtr); static int SProcXvSetPortAttribute(ClientPtr); static int SProcXvGetPortAttribute(ClientPtr); static int SProcXvQueryBestSize(ClientPtr); static int SProcXvQueryPortAttributes(ClientPtr); static int SProcXvPutImage(ClientPtr); #ifdef MITSHM static int SProcXvShmPutImage(ClientPtr); #endif static int SProcXvQueryImageAttributes(ClientPtr); static int SProcXvListImageFormats(ClientPtr); static int SWriteQueryAdaptorsReply(ClientPtr, xvQueryAdaptorsReply *); static int SWriteQueryExtensionReply(ClientPtr, xvQueryExtensionReply *); static int SWriteQueryEncodingsReply(ClientPtr, xvQueryEncodingsReply *); static int SWriteAdaptorInfo(ClientPtr, xvAdaptorInfo *); static int SWriteEncodingInfo(ClientPtr, xvEncodingInfo *); static int SWriteFormat(ClientPtr, xvFormat *); static int SWriteAttributeInfo(ClientPtr, xvAttributeInfo *); static int SWriteGrabPortReply(ClientPtr, xvGrabPortReply *); static int SWriteGetPortAttributeReply(ClientPtr, xvGetPortAttributeReply *); static int SWriteQueryBestSizeReply(ClientPtr, xvQueryBestSizeReply *); static int SWriteQueryPortAttributesReply( ClientPtr, xvQueryPortAttributesReply *); static int SWriteQueryImageAttributesReply( ClientPtr, xvQueryImageAttributesReply*); static int SWriteListImageFormatsReply(ClientPtr, xvListImageFormatsReply*); static int SWriteImageFormatInfo(ClientPtr, xvImageFormatInfo*); #define _WriteQueryAdaptorsReply(_c,_d) \ if ((_c)->swapped) SWriteQueryAdaptorsReply(_c, _d); \ else WriteToClient(_c, sz_xvQueryAdaptorsReply, _d) #define _WriteQueryExtensionReply(_c,_d) \ if ((_c)->swapped) SWriteQueryExtensionReply(_c, _d); \ else WriteToClient(_c, sz_xvQueryExtensionReply, _d) #define _WriteQueryEncodingsReply(_c,_d) \ if ((_c)->swapped) SWriteQueryEncodingsReply(_c, _d); \ else WriteToClient(_c, sz_xvQueryEncodingsReply, _d) #define _WriteAdaptorInfo(_c,_d) \ if ((_c)->swapped) SWriteAdaptorInfo(_c, _d); \ else WriteToClient(_c, sz_xvAdaptorInfo, _d) #define _WriteAttributeInfo(_c,_d) \ if ((_c)->swapped) SWriteAttributeInfo(_c, _d); \ else WriteToClient(_c, sz_xvAttributeInfo, _d) #define _WriteEncodingInfo(_c,_d) \ if ((_c)->swapped) SWriteEncodingInfo(_c, _d); \ else WriteToClient(_c, sz_xvEncodingInfo, _d) #define _WriteFormat(_c,_d) \ if ((_c)->swapped) SWriteFormat(_c, _d); \ else WriteToClient(_c, sz_xvFormat, _d) #define _WriteGrabPortReply(_c,_d) \ if ((_c)->swapped) SWriteGrabPortReply(_c, _d); \ else WriteToClient(_c, sz_xvGrabPortReply, _d) #define _WriteGetPortAttributeReply(_c,_d) \ if ((_c)->swapped) SWriteGetPortAttributeReply(_c, _d); \ else WriteToClient(_c, sz_xvGetPortAttributeReply, _d) #define _WriteQueryBestSizeReply(_c,_d) \ if ((_c)->swapped) SWriteQueryBestSizeReply(_c, _d); \ else WriteToClient(_c, sz_xvQueryBestSizeReply, _d) #define _WriteQueryPortAttributesReply(_c,_d) \ if ((_c)->swapped) SWriteQueryPortAttributesReply(_c, _d); \ else WriteToClient(_c, sz_xvQueryPortAttributesReply, _d) #define _WriteQueryImageAttributesReply(_c,_d) \ if ((_c)->swapped) SWriteQueryImageAttributesReply(_c, _d); \ else WriteToClient(_c, sz_xvQueryImageAttributesReply, _d) #define _WriteListImageFormatsReply(_c,_d) \ if ((_c)->swapped) SWriteListImageFormatsReply(_c, _d); \ else WriteToClient(_c, sz_xvListImageFormatsReply, _d) #define _WriteImageFormatInfo(_c,_d) \ if ((_c)->swapped) SWriteImageFormatInfo(_c, _d); \ else WriteToClient(_c, sz_xvImageFormatInfo, _d) #define _AllocatePort(_i,_p) \ ((_p)->id != _i) ? (* (_p)->pAdaptor->ddAllocatePort)(_i,_p,&_p) : Success /* ** ProcXvDispatch ** ** ** */ int #ifdef NXAGENT_SERVER xorg_ProcXvDispatch(ClientPtr client) #else ProcXvDispatch(ClientPtr client) #endif { REQUEST(xReq); UpdateCurrentTime(); switch (stuff->data) { case xv_QueryExtension: return(ProcXvQueryExtension(client)); case xv_QueryAdaptors: return(ProcXvQueryAdaptors(client)); case xv_QueryEncodings: return(ProcXvQueryEncodings(client)); case xv_PutVideo: #ifdef PANORAMIX if(!noPanoramiXExtension) return(XineramaXvPutVideo(client)); else #endif return(ProcXvPutVideo(client)); case xv_PutStill: #ifdef PANORAMIX if(!noPanoramiXExtension) return(XineramaXvPutStill(client)); else #endif return(ProcXvPutStill(client)); case xv_GetVideo: return(ProcXvGetVideo(client)); case xv_GetStill: return(ProcXvGetStill(client)); case xv_GrabPort: return(ProcXvGrabPort(client)); case xv_UngrabPort: return(ProcXvUngrabPort(client)); case xv_SelectVideoNotify: return(ProcXvSelectVideoNotify(client)); case xv_SelectPortNotify: return(ProcXvSelectPortNotify(client)); case xv_StopVideo: #ifdef PANORAMIX if(!noPanoramiXExtension) return(XineramaXvStopVideo(client)); else #endif return(ProcXvStopVideo(client)); case xv_SetPortAttribute: #ifdef PANORAMIX if(!noPanoramiXExtension) return(XineramaXvSetPortAttribute(client)); else #endif return(ProcXvSetPortAttribute(client)); case xv_GetPortAttribute: return(ProcXvGetPortAttribute(client)); case xv_QueryBestSize: return(ProcXvQueryBestSize(client)); case xv_QueryPortAttributes: return(ProcXvQueryPortAttributes(client)); case xv_PutImage: #ifdef PANORAMIX if(!noPanoramiXExtension) return(XineramaXvPutImage(client)); else #endif return(ProcXvPutImage(client)); #ifdef MITSHM case xv_ShmPutImage: #ifdef PANORAMIX if(!noPanoramiXExtension) return(XineramaXvShmPutImage(client)); else #endif return(ProcXvShmPutImage(client)); #endif case xv_QueryImageAttributes: return(ProcXvQueryImageAttributes(client)); case xv_ListImageFormats: return(ProcXvListImageFormats(client)); default: if (stuff->data < xvNumRequests) { SendErrorToClient(client, XvReqCode, stuff->data, 0, BadImplementation); return(BadImplementation); } else { SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest); return(BadRequest); } } } int #ifdef NXAGENT_SERVER xorg_SProcXvDispatch(ClientPtr client) #else SProcXvDispatch(ClientPtr client) #endif { REQUEST(xReq); UpdateCurrentTime(); switch (stuff->data) { case xv_QueryExtension: return(SProcXvQueryExtension(client)); case xv_QueryAdaptors: return(SProcXvQueryAdaptors(client)); case xv_QueryEncodings: return(SProcXvQueryEncodings(client)); case xv_PutVideo: return(SProcXvPutVideo(client)); case xv_PutStill: return(SProcXvPutStill(client)); case xv_GetVideo: return(SProcXvGetVideo(client)); case xv_GetStill: return(SProcXvGetStill(client)); case xv_GrabPort: return(SProcXvGrabPort(client)); case xv_UngrabPort: return(SProcXvUngrabPort(client)); case xv_SelectVideoNotify: return(SProcXvSelectVideoNotify(client)); case xv_SelectPortNotify: return(SProcXvSelectPortNotify(client)); case xv_StopVideo: return(SProcXvStopVideo(client)); case xv_SetPortAttribute: return(SProcXvSetPortAttribute(client)); case xv_GetPortAttribute: return(SProcXvGetPortAttribute(client)); case xv_QueryBestSize: return(SProcXvQueryBestSize(client)); case xv_QueryPortAttributes: return(SProcXvQueryPortAttributes(client)); case xv_PutImage: return(SProcXvPutImage(client)); #ifdef MITSHM case xv_ShmPutImage: return(SProcXvShmPutImage(client)); #endif case xv_QueryImageAttributes: return(SProcXvQueryImageAttributes(client)); case xv_ListImageFormats: return(SProcXvListImageFormats(client)); default: if (stuff->data < xvNumRequests) { SendErrorToClient(client, XvReqCode, stuff->data, 0, BadImplementation); return(BadImplementation); } else { SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest); return(BadRequest); } } } static int ProcXvQueryExtension(ClientPtr client) { xvQueryExtensionReply rep; /* REQUEST(xvQueryExtensionReq); */ REQUEST_SIZE_MATCH(xvQueryExtensionReq); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.version = XvVersion; rep.revision = XvRevision; _WriteQueryExtensionReply(client, &rep); return Success; } static int ProcXvQueryAdaptors(ClientPtr client) { xvFormat format; xvAdaptorInfo ainfo; xvQueryAdaptorsReply rep; int totalSize, na, nf; int nameSize; XvAdaptorPtr pa; XvFormatPtr pf; WindowPtr pWin; ScreenPtr pScreen; XvScreenPtr pxvs; REQUEST(xvQueryAdaptorsReq); REQUEST_SIZE_MATCH(xvQueryAdaptorsReq); if(!(pWin = (WindowPtr)LookupWindow(stuff->window, client) )) { client->errorValue = stuff->window; return (BadWindow); } pScreen = pWin->drawable.pScreen; pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr; if (!pxvs) { rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.num_adaptors = 0; rep.length = 0; _WriteQueryAdaptorsReply(client, &rep); return Success; } (* pxvs->ddQueryAdaptors)(pScreen, &pxvs->pAdaptors, &pxvs->nAdaptors); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.num_adaptors = pxvs->nAdaptors; /* CALCULATE THE TOTAL SIZE OF THE REPLY IN BYTES */ totalSize = pxvs->nAdaptors * sz_xvAdaptorInfo; /* FOR EACH ADPATOR ADD UP THE BYTES FOR ENCODINGS AND FORMATS */ na = pxvs->nAdaptors; pa = pxvs->pAdaptors; while (na--) { totalSize += (strlen(pa->name) + 3) & ~3; totalSize += pa->nFormats * sz_xvFormat; pa++; } rep.length = totalSize >> 2; _WriteQueryAdaptorsReply(client, &rep); na = pxvs->nAdaptors; pa = pxvs->pAdaptors; while (na--) { ainfo.base_id = pa->base_id; ainfo.num_ports = pa->nPorts; ainfo.type = pa->type; ainfo.name_size = nameSize = strlen(pa->name); ainfo.num_formats = pa->nFormats; _WriteAdaptorInfo(client, &ainfo); WriteToClient(client, nameSize, pa->name); nf = pa->nFormats; pf = pa->pFormats; while (nf--) { format.depth = pf->depth; format.visual = pf->visual; _WriteFormat(client, &format); pf++; } pa++; } return (client->noClientException); } static int ProcXvQueryEncodings(ClientPtr client) { xvEncodingInfo einfo; xvQueryEncodingsReply rep; int totalSize; int nameSize; XvPortPtr pPort; int ne; XvEncodingPtr pe; int status; REQUEST(xvQueryEncodingsReq); REQUEST_SIZE_MATCH(xvQueryEncodingsReq); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.num_encodings = pPort->pAdaptor->nEncodings; /* FOR EACH ENCODING ADD UP THE BYTES FOR ENCODING NAMES */ ne = pPort->pAdaptor->nEncodings; pe = pPort->pAdaptor->pEncodings; totalSize = ne * sz_xvEncodingInfo; while (ne--) { totalSize += (strlen(pe->name) + 3) & ~3; pe++; } rep.length = totalSize >> 2; _WriteQueryEncodingsReply(client, &rep); ne = pPort->pAdaptor->nEncodings; pe = pPort->pAdaptor->pEncodings; while (ne--) { einfo.encoding = pe->id; einfo.name_size = nameSize = strlen(pe->name); einfo.width = pe->width; einfo.height = pe->height; einfo.rate.numerator = pe->rate.numerator; einfo.rate.denominator = pe->rate.denominator; _WriteEncodingInfo(client, &einfo); WriteToClient(client, nameSize, pe->name); pe++; } return (client->noClientException); } static int ProcXvPutVideo(ClientPtr client) { DrawablePtr pDraw; XvPortPtr pPort; GCPtr pGC; int status; REQUEST(xvPutVideoReq); REQUEST_SIZE_MATCH(xvPutVideoReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } if (!(pPort->pAdaptor->type & XvInputMask) || !(pPort->pAdaptor->type & XvVideoMask)) { client->errorValue = stuff->port; return (BadMatch); } status = XVCALL(diMatchPort)(pPort, pDraw); if (status != Success) { return status; } return XVCALL(diPutVideo)(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y, stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y, stuff->drw_w, stuff->drw_h); } static int ProcXvPutStill(ClientPtr client) { DrawablePtr pDraw; XvPortPtr pPort; GCPtr pGC; int status; REQUEST(xvPutStillReq); REQUEST_SIZE_MATCH(xvPutStillReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } if (!(pPort->pAdaptor->type & XvInputMask) || !(pPort->pAdaptor->type & XvStillMask)) { client->errorValue = stuff->port; return (BadMatch); } status = XVCALL(diMatchPort)(pPort, pDraw); if (status != Success) { return status; } return XVCALL(diPutStill)(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y, stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y, stuff->drw_w, stuff->drw_h); } static int ProcXvGetVideo(ClientPtr client) { DrawablePtr pDraw; XvPortPtr pPort; GCPtr pGC; int status; REQUEST(xvGetVideoReq); REQUEST_SIZE_MATCH(xvGetVideoReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } if (!(pPort->pAdaptor->type & XvOutputMask) || !(pPort->pAdaptor->type & XvVideoMask)) { client->errorValue = stuff->port; return (BadMatch); } status = XVCALL(diMatchPort)(pPort, pDraw); if (status != Success) { return status; } return XVCALL(diGetVideo)(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y, stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y, stuff->drw_w, stuff->drw_h); } static int ProcXvGetStill(ClientPtr client) { DrawablePtr pDraw; XvPortPtr pPort; GCPtr pGC; int status; REQUEST(xvGetStillReq); REQUEST_SIZE_MATCH(xvGetStillReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } if (!(pPort->pAdaptor->type & XvOutputMask) || !(pPort->pAdaptor->type & XvStillMask)) { client->errorValue = stuff->port; return (BadMatch); } status = XVCALL(diMatchPort)(pPort, pDraw); if (status != Success) { return status; } return XVCALL(diGetStill)(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y, stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y, stuff->drw_w, stuff->drw_h); } static int ProcXvSelectVideoNotify(ClientPtr client) { DrawablePtr pDraw; REQUEST(xvSelectVideoNotifyReq); REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq); if(!(pDraw = (DrawablePtr)LOOKUP_DRAWABLE(stuff->drawable, client) )) { client->errorValue = stuff->drawable; return (BadWindow); } return XVCALL(diSelectVideoNotify)(client, pDraw, stuff->onoff); } static int ProcXvSelectPortNotify(ClientPtr client) { int status; XvPortPtr pPort; REQUEST(xvSelectPortNotifyReq); REQUEST_SIZE_MATCH(xvSelectPortNotifyReq); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } return XVCALL(diSelectPortNotify)(client, pPort, stuff->onoff); } static int ProcXvGrabPort(ClientPtr client) { int result, status; XvPortPtr pPort; xvGrabPortReply rep; REQUEST(xvGrabPortReq); REQUEST_SIZE_MATCH(xvGrabPortReq); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } status = XVCALL(diGrabPort)(client, pPort, stuff->time, &result); if (status != Success) { return status; } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.result = result; _WriteGrabPortReply(client, &rep); return Success; } static int ProcXvUngrabPort(ClientPtr client) { int status; XvPortPtr pPort; REQUEST(xvGrabPortReq); REQUEST_SIZE_MATCH(xvGrabPortReq); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } return XVCALL(diUngrabPort)(client, pPort, stuff->time); } static int ProcXvStopVideo(ClientPtr client) { int status; DrawablePtr pDraw; XvPortPtr pPort; REQUEST(xvStopVideoReq); REQUEST_SIZE_MATCH(xvStopVideoReq); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } if(!(pDraw = LOOKUP_DRAWABLE(stuff->drawable, client) )) { client->errorValue = stuff->drawable; return (BadDrawable); } return XVCALL(diStopVideo)(client, pPort, pDraw); } static int ProcXvSetPortAttribute(ClientPtr client) { int status; XvPortPtr pPort; REQUEST(xvSetPortAttributeReq); REQUEST_SIZE_MATCH(xvSetPortAttributeReq); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } if (!ValidAtom(stuff->attribute)) { client->errorValue = stuff->attribute; return(BadAtom); } status = XVCALL(diSetPortAttribute)(client, pPort, stuff->attribute, stuff->value); if (status == BadMatch) client->errorValue = stuff->attribute; else client->errorValue = stuff->value; return status; } static int ProcXvGetPortAttribute(ClientPtr client) { INT32 value; int status; XvPortPtr pPort; xvGetPortAttributeReply rep; REQUEST(xvGetPortAttributeReq); REQUEST_SIZE_MATCH(xvGetPortAttributeReq); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } if (!ValidAtom(stuff->attribute)) { client->errorValue = stuff->attribute; return(BadAtom); } status = XVCALL(diGetPortAttribute)(client, pPort, stuff->attribute, &value); if (status != Success) { client->errorValue = stuff->attribute; return status; } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.value = value; _WriteGetPortAttributeReply(client, &rep); return Success; } static int ProcXvQueryBestSize(ClientPtr client) { int status; unsigned int actual_width, actual_height; XvPortPtr pPort; xvQueryBestSizeReply rep; REQUEST(xvQueryBestSizeReq); REQUEST_SIZE_MATCH(xvQueryBestSizeReq); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; (* pPort->pAdaptor->ddQueryBestSize)(client, pPort, stuff->motion, stuff->vid_w, stuff->vid_h, stuff->drw_w, stuff->drw_h, &actual_width, &actual_height); rep.actual_width = actual_width; rep.actual_height = actual_height; _WriteQueryBestSizeReply(client, &rep); return Success; } static int ProcXvQueryPortAttributes(ClientPtr client) { int status, size, i; XvPortPtr pPort; XvAttributePtr pAtt; xvQueryPortAttributesReply rep; xvAttributeInfo Info; REQUEST(xvQueryPortAttributesReq); REQUEST_SIZE_MATCH(xvQueryPortAttributesReq); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.num_attributes = pPort->pAdaptor->nAttributes; rep.text_size = 0; for(i = 0, pAtt = pPort->pAdaptor->pAttributes; i < pPort->pAdaptor->nAttributes; i++, pAtt++) { rep.text_size += (strlen(pAtt->name) + 1 + 3) & ~3L; } rep.length = (pPort->pAdaptor->nAttributes * sz_xvAttributeInfo) + rep.text_size; rep.length >>= 2; _WriteQueryPortAttributesReply(client, &rep); for(i = 0, pAtt = pPort->pAdaptor->pAttributes; i < pPort->pAdaptor->nAttributes; i++, pAtt++) { size = strlen(pAtt->name) + 1; /* pass the NULL */ Info.flags = pAtt->flags; Info.min = pAtt->min_value; Info.max = pAtt->max_value; Info.size = (size + 3) & ~3L; _WriteAttributeInfo(client, &Info); WriteToClient(client, size, pAtt->name); } return Success; } static int ProcXvPutImage(ClientPtr client) { DrawablePtr pDraw; XvPortPtr pPort; XvImagePtr pImage = NULL; GCPtr pGC; int status, i, size; CARD16 width, height; REQUEST(xvPutImageReq); REQUEST_AT_LEAST_SIZE(xvPutImageReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } if (!(pPort->pAdaptor->type & XvImageMask) || !(pPort->pAdaptor->type & XvInputMask)) { client->errorValue = stuff->port; return (BadMatch); } status = XVCALL(diMatchPort)(pPort, pDraw); if (status != Success) { return status; } for(i = 0; i < pPort->pAdaptor->nImages; i++) { if(pPort->pAdaptor->pImages[i].id == stuff->id) { pImage = &(pPort->pAdaptor->pImages[i]); break; } } if(!pImage) return BadMatch; width = stuff->width; height = stuff->height; size = (*pPort->pAdaptor->ddQueryImageAttributes)(client, pPort, pImage, &width, &height, NULL, NULL); size += sizeof(xvPutImageReq); size = (size + 3) >> 2; if((width < stuff->width) || (height < stuff->height)) return BadValue; if(client->req_len < size) return BadLength; return XVCALL(diPutImage)(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y, stuff->src_w, stuff->src_h, stuff->drw_x, stuff->drw_y, stuff->drw_w, stuff->drw_h, pImage, (unsigned char*)(&stuff[1]), FALSE, stuff->width, stuff->height); } #ifdef MITSHM /* redefined here since it's not in any header file */ typedef struct _ShmDesc { struct _ShmDesc *next; int shmid; int refcnt; char *addr; Bool writable; unsigned long size; } ShmDescRec, *ShmDescPtr; extern RESTYPE ShmSegType; extern int BadShmSegCode; extern int ShmCompletionCode; static int ProcXvShmPutImage(ClientPtr client) { ShmDescPtr shmdesc; DrawablePtr pDraw; XvPortPtr pPort; XvImagePtr pImage = NULL; GCPtr pGC; int status, size_needed, i; CARD16 width, height; REQUEST(xvShmPutImageReq); REQUEST_SIZE_MATCH(xvShmPutImageReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } if ((status = _AllocatePort(stuff->port, pPort)) != Success) { client->errorValue = stuff->port; return (status); } if (!(pPort->pAdaptor->type & XvImageMask) || !(pPort->pAdaptor->type & XvInputMask)) { client->errorValue = stuff->port; return (BadMatch); } status = XVCALL(diMatchPort)(pPort, pDraw); if (status != Success) { return status; } for(i = 0; i < pPort->pAdaptor->nImages; i++) { if(pPort->pAdaptor->pImages[i].id == stuff->id) { pImage = &(pPort->pAdaptor->pImages[i]); break; } } if(!pImage) return BadMatch; if(!(shmdesc = (ShmDescPtr)LookupIDByType(stuff->shmseg, ShmSegType))) { client->errorValue = stuff->shmseg; return BadShmSegCode; } width = stuff->width; height = stuff->height; size_needed = (*pPort->pAdaptor->ddQueryImageAttributes)(client, pPort, pImage, &width, &height, NULL, NULL); if((size_needed + stuff->offset) > shmdesc->size) return BadAccess; if((width < stuff->width) || (height < stuff->height)) return BadValue; status = XVCALL(diPutImage)(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y, stuff->src_w, stuff->src_h, stuff->drw_x, stuff->drw_y, stuff->drw_w, stuff->drw_h, pImage, (unsigned char *)shmdesc->addr + stuff->offset, stuff->send_event, stuff->width, stuff->height); if((status == Success) && stuff->send_event) { xShmCompletionEvent ev; ev.type = ShmCompletionCode; ev.drawable = stuff->drawable; ev.minorEvent = xv_ShmPutImage; ev.majorEvent = XvReqCode; ev.shmseg = stuff->shmseg; ev.offset = stuff->offset; WriteEventsToClient(client, 1, (xEvent *) &ev); } return status; } #endif #ifdef XvMCExtension #include "xvmcext.h" #endif static int ProcXvQueryImageAttributes(ClientPtr client) { xvQueryImageAttributesReply rep; int size, num_planes, i; CARD16 width, height; XvImagePtr pImage = NULL; XvPortPtr pPort; int *offsets; int *pitches; int planeLength; REQUEST(xvQueryImageAttributesReq); REQUEST_SIZE_MATCH(xvQueryImageAttributesReq); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } for(i = 0; i < pPort->pAdaptor->nImages; i++) { if(pPort->pAdaptor->pImages[i].id == stuff->id) { pImage = &(pPort->pAdaptor->pImages[i]); break; } } #ifdef XvMCExtension if(!pImage) pImage = XvMCFindXvImage(pPort, stuff->id); #endif if(!pImage) return BadMatch; num_planes = pImage->num_planes; if(!(offsets = malloc(num_planes << 3))) return BadAlloc; pitches = offsets + num_planes; width = stuff->width; height = stuff->height; size = (*pPort->pAdaptor->ddQueryImageAttributes)(client, pPort, pImage, &width, &height, offsets, pitches); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = planeLength = num_planes << 1; rep.num_planes = num_planes; rep.width = width; rep.height = height; rep.data_size = size; _WriteQueryImageAttributesReply(client, &rep); if(client->swapped) SwapLongs((CARD32*)offsets, planeLength); WriteToClient(client, planeLength << 2, offsets); free(offsets); return Success; } static int ProcXvListImageFormats(ClientPtr client) { XvPortPtr pPort; XvImagePtr pImage; int i; xvListImageFormatsReply rep; xvImageFormatInfo info; REQUEST(xvListImageFormatsReq); REQUEST_SIZE_MATCH(xvListImageFormatsReq); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { client->errorValue = stuff->port; return (_XvBadPort); } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.num_formats = pPort->pAdaptor->nImages; rep.length = pPort->pAdaptor->nImages * sz_xvImageFormatInfo >> 2; _WriteListImageFormatsReply(client, &rep); pImage = pPort->pAdaptor->pImages; for(i = 0; i < pPort->pAdaptor->nImages; i++, pImage++) { info.id = pImage->id; info.type = pImage->type; info.byte_order = pImage->byte_order; memcpy(&info.guid, pImage->guid, 16); info.bpp = pImage->bits_per_pixel; info.num_planes = pImage->num_planes; info.depth = pImage->depth; info.red_mask = pImage->red_mask; info.green_mask = pImage->green_mask; info.blue_mask = pImage->blue_mask; info.format = pImage->format; info.y_sample_bits = pImage->y_sample_bits; info.u_sample_bits = pImage->u_sample_bits; info.v_sample_bits = pImage->v_sample_bits; info.horz_y_period = pImage->horz_y_period; info.horz_u_period = pImage->horz_u_period; info.horz_v_period = pImage->horz_v_period; info.vert_y_period = pImage->vert_y_period; info.vert_u_period = pImage->vert_u_period; info.vert_v_period = pImage->vert_v_period; memcpy(&info.comp_order, pImage->component_order, 32); info.scanline_order = pImage->scanline_order; _WriteImageFormatInfo(client, &info); } return Success; } /* Swapped Procs */ static int SProcXvQueryExtension(ClientPtr client) { REQUEST(xvQueryExtensionReq); REQUEST_SIZE_MATCH(xvQueryExtensionReq); swaps(&stuff->length); return ProcXvQueryExtension(client); } static int SProcXvQueryAdaptors(ClientPtr client) { REQUEST(xvQueryAdaptorsReq); REQUEST_SIZE_MATCH(xvQueryAdaptorsReq); swaps(&stuff->length); swapl(&stuff->window); return ProcXvQueryAdaptors(client); } static int SProcXvQueryEncodings(ClientPtr client) { REQUEST(xvQueryEncodingsReq); REQUEST_SIZE_MATCH(xvQueryEncodingsReq); swaps(&stuff->length); swapl(&stuff->port); return ProcXvQueryEncodings(client); } static int SProcXvGrabPort(ClientPtr client) { REQUEST(xvGrabPortReq); REQUEST_SIZE_MATCH(xvGrabPortReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->time); return ProcXvGrabPort(client); } static int SProcXvUngrabPort(ClientPtr client) { REQUEST(xvUngrabPortReq); REQUEST_SIZE_MATCH(xvUngrabPortReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->time); return ProcXvUngrabPort(client); } static int SProcXvPutVideo(ClientPtr client) { REQUEST(xvPutVideoReq); REQUEST_SIZE_MATCH(xvPutVideoReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->drawable); swapl(&stuff->gc); swaps(&stuff->vid_x); swaps(&stuff->vid_y); swaps(&stuff->vid_w); swaps(&stuff->vid_h); swaps(&stuff->drw_x); swaps(&stuff->drw_y); swaps(&stuff->drw_w); swaps(&stuff->drw_h); return ProcXvPutVideo(client); } static int SProcXvPutStill(ClientPtr client) { REQUEST(xvPutStillReq); REQUEST_SIZE_MATCH(xvPutStillReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->drawable); swapl(&stuff->gc); swaps(&stuff->vid_x); swaps(&stuff->vid_y); swaps(&stuff->vid_w); swaps(&stuff->vid_h); swaps(&stuff->drw_x); swaps(&stuff->drw_y); swaps(&stuff->drw_w); swaps(&stuff->drw_h); return ProcXvPutStill(client); } static int SProcXvGetVideo(ClientPtr client) { REQUEST(xvGetVideoReq); REQUEST_SIZE_MATCH(xvGetVideoReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->drawable); swapl(&stuff->gc); swaps(&stuff->vid_x); swaps(&stuff->vid_y); swaps(&stuff->vid_w); swaps(&stuff->vid_h); swaps(&stuff->drw_x); swaps(&stuff->drw_y); swaps(&stuff->drw_w); swaps(&stuff->drw_h); return ProcXvGetVideo(client); } static int SProcXvGetStill(ClientPtr client) { REQUEST(xvGetStillReq); REQUEST_SIZE_MATCH(xvGetStillReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->drawable); swapl(&stuff->gc); swaps(&stuff->vid_x); swaps(&stuff->vid_y); swaps(&stuff->vid_w); swaps(&stuff->vid_h); swaps(&stuff->drw_x); swaps(&stuff->drw_y); swaps(&stuff->drw_w); swaps(&stuff->drw_h); return ProcXvGetStill(client); } static int SProcXvPutImage(ClientPtr client) { REQUEST(xvPutImageReq); REQUEST_AT_LEAST_SIZE(xvPutImageReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->drawable); swapl(&stuff->gc); swapl(&stuff->id); swaps(&stuff->src_x); swaps(&stuff->src_y); swaps(&stuff->src_w); swaps(&stuff->src_h); swaps(&stuff->drw_x); swaps(&stuff->drw_y); swaps(&stuff->drw_w); swaps(&stuff->drw_h); swaps(&stuff->width); swaps(&stuff->height); return ProcXvPutImage(client); } #ifdef MITSHM static int SProcXvShmPutImage(ClientPtr client) { REQUEST(xvShmPutImageReq); REQUEST_SIZE_MATCH(xvShmPutImageReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->drawable); swapl(&stuff->gc); swapl(&stuff->shmseg); swapl(&stuff->id); swapl(&stuff->offset); swaps(&stuff->src_x); swaps(&stuff->src_y); swaps(&stuff->src_w); swaps(&stuff->src_h); swaps(&stuff->drw_x); swaps(&stuff->drw_y); swaps(&stuff->drw_w); swaps(&stuff->drw_h); swaps(&stuff->width); swaps(&stuff->height); return ProcXvShmPutImage(client); } #endif static int SProcXvSelectVideoNotify(ClientPtr client) { REQUEST(xvSelectVideoNotifyReq); REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq); swaps(&stuff->length); swapl(&stuff->drawable); return ProcXvSelectVideoNotify(client); } static int SProcXvSelectPortNotify(ClientPtr client) { REQUEST(xvSelectPortNotifyReq); REQUEST_SIZE_MATCH(xvSelectPortNotifyReq); swaps(&stuff->length); swapl(&stuff->port); return ProcXvSelectPortNotify(client); } static int SProcXvStopVideo(ClientPtr client) { REQUEST(xvStopVideoReq); REQUEST_SIZE_MATCH(xvStopVideoReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->drawable); return ProcXvStopVideo(client); } static int SProcXvSetPortAttribute(ClientPtr client) { REQUEST(xvSetPortAttributeReq); REQUEST_SIZE_MATCH(xvSetPortAttributeReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->attribute); swapl(&stuff->value); return ProcXvSetPortAttribute(client); } static int SProcXvGetPortAttribute(ClientPtr client) { REQUEST(xvGetPortAttributeReq); REQUEST_SIZE_MATCH(xvGetPortAttributeReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->attribute); return ProcXvGetPortAttribute(client); } static int SProcXvQueryBestSize(ClientPtr client) { REQUEST(xvQueryBestSizeReq); REQUEST_SIZE_MATCH(xvQueryBestSizeReq); swaps(&stuff->length); swapl(&stuff->port); swaps(&stuff->vid_w); swaps(&stuff->vid_h); swaps(&stuff->drw_w); swaps(&stuff->drw_h); return ProcXvQueryBestSize(client); } static int SProcXvQueryPortAttributes(ClientPtr client) { REQUEST(xvQueryPortAttributesReq); REQUEST_SIZE_MATCH(xvQueryPortAttributesReq); swaps(&stuff->length); swapl(&stuff->port); return ProcXvQueryPortAttributes(client); } static int SProcXvQueryImageAttributes(ClientPtr client) { REQUEST(xvQueryImageAttributesReq); REQUEST_SIZE_MATCH(xvQueryImageAttributesReq); swaps(&stuff->length); swapl(&stuff->port); swapl(&stuff->id); swaps(&stuff->width); swaps(&stuff->height); return ProcXvQueryImageAttributes(client); } static int SProcXvListImageFormats(ClientPtr client) { REQUEST(xvListImageFormatsReq); REQUEST_SIZE_MATCH(xvListImageFormatsReq); swaps(&stuff->length); swapl(&stuff->port); return ProcXvListImageFormats(client); } static int SWriteQueryExtensionReply( ClientPtr client, xvQueryExtensionReply *rep ){ swaps(&rep->sequenceNumber); swapl(&rep->length); swaps(&rep->version); swaps(&rep->revision); WriteToClient(client, sz_xvQueryExtensionReply, rep); return Success; } static int SWriteQueryAdaptorsReply( ClientPtr client, xvQueryAdaptorsReply *rep ){ swaps(&rep->sequenceNumber); swapl(&rep->length); swaps(&rep->num_adaptors); WriteToClient(client, sz_xvQueryAdaptorsReply, rep); return Success; } static int SWriteQueryEncodingsReply( ClientPtr client, xvQueryEncodingsReply *rep ){ swaps(&rep->sequenceNumber); swapl(&rep->length); swaps(&rep->num_encodings); WriteToClient(client, sz_xvQueryEncodingsReply, rep); return Success; } static int SWriteAdaptorInfo( ClientPtr client, xvAdaptorInfo *pAdaptor ){ swapl(&pAdaptor->base_id); swaps(&pAdaptor->name_size); swaps(&pAdaptor->num_ports); swaps(&pAdaptor->num_formats); WriteToClient(client, sz_xvAdaptorInfo, pAdaptor); return Success; } static int SWriteEncodingInfo( ClientPtr client, xvEncodingInfo *pEncoding ){ swapl(&pEncoding->encoding); swaps(&pEncoding->name_size); swaps(&pEncoding->width); swaps(&pEncoding->height); swapl(&pEncoding->rate.numerator); swapl(&pEncoding->rate.denominator); WriteToClient(client, sz_xvEncodingInfo, pEncoding); return Success; } static int SWriteFormat( ClientPtr client, xvFormat *pFormat ){ swapl(&pFormat->visual); WriteToClient(client, sz_xvFormat, pFormat); return Success; } static int SWriteAttributeInfo( ClientPtr client, xvAttributeInfo *pAtt ){ swapl(&pAtt->flags); swapl(&pAtt->size); swapl(&pAtt->min); swapl(&pAtt->max); WriteToClient(client, sz_xvAttributeInfo, pAtt); return Success; } static int SWriteImageFormatInfo( ClientPtr client, xvImageFormatInfo *pImage ){ swapl(&pImage->id); swapl(&pImage->red_mask); swapl(&pImage->green_mask); swapl(&pImage->blue_mask); swapl(&pImage->y_sample_bits); swapl(&pImage->u_sample_bits); swapl(&pImage->v_sample_bits); swapl(&pImage->horz_y_period); swapl(&pImage->horz_u_period); swapl(&pImage->horz_v_period); swapl(&pImage->vert_y_period); swapl(&pImage->vert_u_period); swapl(&pImage->vert_v_period); WriteToClient(client, sz_xvImageFormatInfo, pImage); return Success; } static int SWriteGrabPortReply( ClientPtr client, xvGrabPortReply *rep ){ swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, sz_xvGrabPortReply, rep); return Success; } static int SWriteGetPortAttributeReply( ClientPtr client, xvGetPortAttributeReply *rep ){ swaps(&rep->sequenceNumber); swapl(&rep->length); swapl(&rep->value); WriteToClient(client, sz_xvGetPortAttributeReply, rep); return Success; } static int SWriteQueryBestSizeReply( ClientPtr client, xvQueryBestSizeReply *rep ){ swaps(&rep->sequenceNumber); swapl(&rep->length); swaps(&rep->actual_width); swaps(&rep->actual_height); WriteToClient(client, sz_xvQueryBestSizeReply, rep); return Success; } static int SWriteQueryPortAttributesReply( ClientPtr client, xvQueryPortAttributesReply *rep ){ swaps(&rep->sequenceNumber); swapl(&rep->length); swapl(&rep->num_attributes); swapl(&rep->text_size); WriteToClient(client, sz_xvQueryPortAttributesReply, rep); return Success; } static int SWriteQueryImageAttributesReply( ClientPtr client, xvQueryImageAttributesReply *rep ){ swaps(&rep->sequenceNumber); swapl(&rep->length); swapl(&rep->num_planes); swapl(&rep->data_size); swaps(&rep->width); swaps(&rep->height); WriteToClient(client, sz_xvQueryImageAttributesReply, rep); return Success; } static int SWriteListImageFormatsReply( ClientPtr client, xvListImageFormatsReply *rep ){ swaps(&rep->sequenceNumber); swapl(&rep->length); swapl(&rep->num_formats); WriteToClient(client, sz_xvListImageFormatsReply, rep); return Success; } #ifdef PANORAMIX static int XineramaXvStopVideo(ClientPtr client) { int result = Success, i; PanoramiXRes *draw, *port; REQUEST(xvStopVideoReq); REQUEST_SIZE_MATCH(xvStopVideoReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(port = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->port, XvXRTPort, DixReadAccess))) return _XvBadPort; FOR_NSCREENS_BACKWARD(i) { if(port->info[i].id) { stuff->drawable = draw->info[i].id; stuff->port = port->info[i].id; result = ProcXvStopVideo(client); } } return result; } static int XineramaXvSetPortAttribute(ClientPtr client) { REQUEST(xvSetPortAttributeReq); PanoramiXRes *port; int result = Success, i; REQUEST_SIZE_MATCH(xvSetPortAttributeReq); if(!(port = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->port, XvXRTPort, DixReadAccess))) return _XvBadPort; FOR_NSCREENS_BACKWARD(i) { if(port->info[i].id) { stuff->port = port->info[i].id; result = ProcXvSetPortAttribute(client); } } return result; } #ifdef MITSHM static int XineramaXvShmPutImage(ClientPtr client) { REQUEST(xvShmPutImageReq); PanoramiXRes *draw, *gc, *port; Bool send_event = stuff->send_event; Bool isRoot; int result = Success, i, x, y; REQUEST_SIZE_MATCH(xvShmPutImageReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; if(!(port = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->port, XvXRTPort, DixReadAccess))) return _XvBadPort; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; x = stuff->drw_x; y = stuff->drw_y; FOR_NSCREENS_BACKWARD(i) { if(port->info[i].id) { stuff->drawable = draw->info[i].id; stuff->port = port->info[i].id; stuff->gc = gc->info[i].id; stuff->drw_x = x; stuff->drw_y = y; if(isRoot) { stuff->drw_x -= panoramiXdataPtr[i].x; stuff->drw_y -= panoramiXdataPtr[i].y; } stuff->send_event = (send_event && !i) ? 1 : 0; result = ProcXvShmPutImage(client); } } return result; } #endif static int XineramaXvPutImage(ClientPtr client) { REQUEST(xvPutImageReq); PanoramiXRes *draw, *gc, *port; Bool isRoot; int result = Success, i, x, y; REQUEST_AT_LEAST_SIZE(xvPutImageReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; if(!(port = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->port, XvXRTPort, DixReadAccess))) return _XvBadPort; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; x = stuff->drw_x; y = stuff->drw_y; FOR_NSCREENS_BACKWARD(i) { if(port->info[i].id) { stuff->drawable = draw->info[i].id; stuff->port = port->info[i].id; stuff->gc = gc->info[i].id; stuff->drw_x = x; stuff->drw_y = y; if(isRoot) { stuff->drw_x -= panoramiXdataPtr[i].x; stuff->drw_y -= panoramiXdataPtr[i].y; } result = ProcXvPutImage(client); } } return result; } static int XineramaXvPutVideo(ClientPtr client) { REQUEST(xvPutImageReq); PanoramiXRes *draw, *gc, *port; Bool isRoot; int result = Success, i, x, y; REQUEST_AT_LEAST_SIZE(xvPutVideoReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; if(!(port = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->port, XvXRTPort, DixReadAccess))) return _XvBadPort; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; x = stuff->drw_x; y = stuff->drw_y; FOR_NSCREENS_BACKWARD(i) { if(port->info[i].id) { stuff->drawable = draw->info[i].id; stuff->port = port->info[i].id; stuff->gc = gc->info[i].id; stuff->drw_x = x; stuff->drw_y = y; if(isRoot) { stuff->drw_x -= panoramiXdataPtr[i].x; stuff->drw_y -= panoramiXdataPtr[i].y; } result = ProcXvPutVideo(client); } } return result; } static int XineramaXvPutStill(ClientPtr client) { REQUEST(xvPutImageReq); PanoramiXRes *draw, *gc, *port; Bool isRoot; int result = Success, i, x, y; REQUEST_AT_LEAST_SIZE(xvPutImageReq); if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->gc, XRT_GC, DixReadAccess))) return BadGC; if(!(port = (PanoramiXRes *)SecurityLookupIDByType( client, stuff->port, XvXRTPort, DixReadAccess))) return _XvBadPort; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; x = stuff->drw_x; y = stuff->drw_y; FOR_NSCREENS_BACKWARD(i) { if(port->info[i].id) { stuff->drawable = draw->info[i].id; stuff->port = port->info[i].id; stuff->gc = gc->info[i].id; stuff->drw_x = x; stuff->drw_y = y; if(isRoot) { stuff->drw_x -= panoramiXdataPtr[i].x; stuff->drw_y -= panoramiXdataPtr[i].y; } result = ProcXvPutStill(client); } } return result; } void XineramifyXv(void) { ScreenPtr pScreen, screen0 = screenInfo.screens[0]; XvScreenPtr xvsp0 = (XvScreenPtr)screen0->devPrivates[XvScreenIndex].ptr; XvAdaptorPtr refAdapt, pAdapt; XvAttributePtr pAttr; XvScreenPtr xvsp; Bool isOverlay, hasOverlay; PanoramiXRes *port; XvAdaptorPtr MatchingAdaptors[MAXSCREENS]; int i, j, k, l; XvXRTPort = CreateNewResourceType(XineramaDeleteResource); if(!xvsp0) return; for(i = 0; i < xvsp0->nAdaptors; i++) { refAdapt = xvsp0->pAdaptors + i; bzero(MatchingAdaptors, sizeof(XvAdaptorPtr) * MAXSCREENS); MatchingAdaptors[0] = refAdapt; if(!(refAdapt->type & XvInputMask)) continue; isOverlay = FALSE; for(j = 0; j < refAdapt->nAttributes; j++) { pAttr = refAdapt->pAttributes + j; if(!strcmp(pAttr->name, "XV_COLORKEY")) { isOverlay = TRUE; break; } } for(j = 1; j < PanoramiXNumScreens; j++) { pScreen = screenInfo.screens[j]; xvsp = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr; /* Do not try to go on if xv is not supported on this screen */ if (xvsp==NULL) continue ; /* if the adaptor has the same name it's a perfect match */ for(k = 0; k < xvsp->nAdaptors; k++) { pAdapt = xvsp->pAdaptors + k; if(!strcmp(refAdapt->name, pAdapt->name)) { MatchingAdaptors[j] = pAdapt; break; } } if(MatchingAdaptors[j]) continue; /* found it */ /* otherwise we only look for XvImage adaptors */ if(!(refAdapt->type & XvImageMask)) continue; if(refAdapt->nImages <= 0) continue; /* prefer overlay/overlay non-overlay/non-overlay pairing */ for(k = 0; k < xvsp->nAdaptors; k++) { pAdapt = xvsp->pAdaptors + k; if((pAdapt->type & XvImageMask) && (pAdapt->nImages > 0)) { hasOverlay = FALSE; for(l = 0; l < pAdapt->nAttributes; l++) { if(!strcmp(pAdapt->name, "XV_COLORKEY")) { hasOverlay = TRUE; break; } } if(isOverlay && hasOverlay) { MatchingAdaptors[j] = pAdapt; break; } else if(!isOverlay && !hasOverlay) { MatchingAdaptors[j] = pAdapt; break; } } } if(MatchingAdaptors[j]) continue; /* found it */ /* but we'll take any XvImage pairing if we can get it */ for(k = 0; k < xvsp->nAdaptors; k++) { pAdapt = xvsp->pAdaptors + k; if((pAdapt->type & XvImageMask) && (pAdapt->nImages > 0)) { MatchingAdaptors[j] = pAdapt; break; } } } /* now create a resource for each port */ for(j = 0; j < refAdapt->nPorts; j++) { if(!(port = malloc(sizeof(PanoramiXRes)))) break; port->info[0].id = MatchingAdaptors[0]->base_id + j; AddResource(port->info[0].id, XvXRTPort, port); for(k = 1; k < PanoramiXNumScreens; k++) { if(MatchingAdaptors[k] && (MatchingAdaptors[k]->nPorts > j)) port->info[k].id = MatchingAdaptors[k]->base_id + j; else port->info[k].id = 0; } } } } #endif nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/xvdisp.h0000644000000000000000000000004013614532331017203 0ustar extern void XineramifyXv(void); nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/xvdix.h0000644000000000000000000002065513614532331017046 0ustar /*********************************************************** Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef XVDIX_H #define XVDIX_H /* ** File: ** ** xvdix.h --- Xv device independent header file ** ** Author: ** ** David Carver (Digital Workstation Engineering/Project Athena) ** ** Revisions: ** ** 29.08.91 Carver ** - removed UnrealizeWindow wrapper unrealizing windows no longer ** preempts video ** ** 11.06.91 Carver ** - changed SetPortControl to SetPortAttribute ** - changed GetPortControl to GetPortAttribute ** - changed QueryBestSize ** ** 15.05.91 Carver ** - version 2.0 upgrade ** ** 24.01.91 Carver ** - version 1.4 upgrade ** */ #include "scrnintstr.h" #include extern int XvScreenIndex; extern unsigned long XvExtensionGeneration; extern unsigned long XvScreenGeneration; extern unsigned long XvResourceGeneration; extern int XvReqCode; extern int XvEventBase; extern int XvErrorBase; extern unsigned long XvRTPort; extern unsigned long XvRTEncoding; extern unsigned long XvRTGrab; extern unsigned long XvRTVideoNotify; extern unsigned long XvRTVideoNotifyList; extern unsigned long XvRTPortNotify; typedef struct { int numerator; int denominator; } XvRationalRec, *XvRationalPtr; typedef struct { char depth; unsigned long visual; } XvFormatRec, *XvFormatPtr; typedef struct { unsigned long id; ClientPtr client; } XvGrabRec, *XvGrabPtr; typedef struct _XvVideoNotifyRec { struct _XvVideoNotifyRec *next; ClientPtr client; unsigned long id; unsigned long mask; } XvVideoNotifyRec, *XvVideoNotifyPtr; typedef struct _XvPortNotifyRec { struct _XvPortNotifyRec *next; ClientPtr client; unsigned long id; } XvPortNotifyRec, *XvPortNotifyPtr; typedef struct { int id; ScreenPtr pScreen; char *name; unsigned short width, height; XvRationalRec rate; } XvEncodingRec, *XvEncodingPtr; typedef struct _XvAttributeRec { int flags; int min_value; int max_value; char *name; } XvAttributeRec, *XvAttributePtr; typedef struct { int id; int type; int byte_order; char guid[16]; int bits_per_pixel; int format; int num_planes; /* for RGB formats only */ int depth; unsigned int red_mask; unsigned int green_mask; unsigned int blue_mask; /* for YUV formats only */ unsigned int y_sample_bits; unsigned int u_sample_bits; unsigned int v_sample_bits; unsigned int horz_y_period; unsigned int horz_u_period; unsigned int horz_v_period; unsigned int vert_y_period; unsigned int vert_u_period; unsigned int vert_v_period; char component_order[32]; int scanline_order; } XvImageRec, *XvImagePtr; typedef struct { unsigned long base_id; unsigned char type; char *name; int nEncodings; XvEncodingPtr pEncodings; int nFormats; XvFormatPtr pFormats; int nAttributes; XvAttributePtr pAttributes; int nImages; XvImagePtr pImages; int nPorts; struct _XvPortRec *pPorts; ScreenPtr pScreen; int (* ddAllocatePort)(unsigned long, struct _XvPortRec*, struct _XvPortRec**); int (* ddFreePort)(struct _XvPortRec*); int (* ddPutVideo)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); int (* ddPutStill)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); int (* ddGetVideo)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); int (* ddGetStill)(ClientPtr, DrawablePtr,struct _XvPortRec*, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); int (* ddStopVideo)(ClientPtr, struct _XvPortRec*, DrawablePtr); int (* ddSetPortAttribute)(ClientPtr, struct _XvPortRec*, Atom, INT32); int (* ddGetPortAttribute)(ClientPtr, struct _XvPortRec*, Atom, INT32*); int (* ddQueryBestSize)(ClientPtr, struct _XvPortRec*, CARD8, CARD16, CARD16,CARD16, CARD16, unsigned int*, unsigned int*); int (* ddPutImage)(ClientPtr, DrawablePtr, struct _XvPortRec*, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16, XvImagePtr, unsigned char*, Bool, CARD16, CARD16); int (* ddQueryImageAttributes)(ClientPtr, struct _XvPortRec*, XvImagePtr, CARD16*, CARD16*, int*, int*); DevUnion devPriv; } XvAdaptorRec, *XvAdaptorPtr; typedef struct _XvPortRec { unsigned long id; XvAdaptorPtr pAdaptor; XvPortNotifyPtr pNotify; DrawablePtr pDraw; ClientPtr client; XvGrabRec grab; TimeStamp time; DevUnion devPriv; } XvPortRec, *XvPortPtr; #define LOOKUP_PORT(_id, client)\ ((XvPortPtr)LookupIDByType(_id, XvRTPort)) #define LOOKUP_ENCODING(_id, client)\ ((XvEncodingPtr)LookupIDByType(_id, XvRTEncoding)) #define LOOKUP_VIDEONOTIFY_LIST(_id, client)\ ((XvVideoNotifyPtr)LookupIDByType(_id, XvRTVideoNotifyList)) #define LOOKUP_PORTNOTIFY_LIST(_id, client)\ ((XvPortNotifyPtr)LookupIDByType(_id, XvRTPortNotifyList)) typedef struct { int version, revision; int nAdaptors; XvAdaptorPtr pAdaptors; DestroyWindowProcPtr DestroyWindow; DestroyPixmapProcPtr DestroyPixmap; CloseScreenProcPtr CloseScreen; Bool (* ddCloseScreen)(ScreenPtr); int (* ddQueryAdaptors)(ScreenPtr, XvAdaptorPtr*, int*); DevUnion devPriv; } XvScreenRec, *XvScreenPtr; #define SCREEN_PROLOGUE(pScreen, field)\ ((pScreen)->field = \ ((XvScreenPtr) \ (pScreen)->devPrivates[XvScreenIndex].ptr)->field) #define SCREEN_EPILOGUE(pScreen, field, wrapper)\ ((pScreen)->field = wrapper) /* Errors */ #define _XvBadPort (XvBadPort+XvErrorBase) #define _XvBadEncoding (XvBadEncoding+XvErrorBase) extern int ProcXvDispatch(ClientPtr); extern int SProcXvDispatch(ClientPtr); extern void XvExtensionInit(void); extern int XvScreenInit(ScreenPtr); extern int XvGetScreenIndex(void); extern unsigned long XvGetRTPort(void); extern int XvdiSendPortNotify(XvPortPtr, Atom, INT32); extern int XvdiVideoStopped(XvPortPtr, int); extern int XvdiPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); extern int XvdiPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); extern int XvdiGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); extern int XvdiGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); extern int XvdiPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16, XvImagePtr, unsigned char*, Bool, CARD16, CARD16); extern int XvdiSelectVideoNotify(ClientPtr, DrawablePtr, BOOL); extern int XvdiSelectPortNotify(ClientPtr, XvPortPtr, BOOL); extern int XvdiSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32); extern int XvdiGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32*); extern int XvdiStopVideo(ClientPtr, XvPortPtr, DrawablePtr); extern int XvdiPreemptVideo(ClientPtr, XvPortPtr, DrawablePtr); extern int XvdiMatchPort(XvPortPtr, DrawablePtr); extern int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *); extern int XvdiUngrabPort( ClientPtr, XvPortPtr, Time); #if !defined(UNIXCPP) #define XVCALL(name) Xv##name #else #define XVCALL(name) Xv/**/name #endif #endif /* XVDIX_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/xvmain.c0000644000000000000000000006343513614532331017204 0ustar /*********************************************************** Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts, and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* ** File: ** ** xvmain.c --- Xv server extension main device independent module. ** ** Author: ** ** David Carver (Digital Workstation Engineering/Project Athena) ** ** Revisions: ** ** 04.09.91 Carver ** - change: stop video always generates an event even when video ** wasn't active ** ** 29.08.91 Carver ** - change: unrealizing windows no longer preempts video ** ** 11.06.91 Carver ** - changed SetPortControl to SetPortAttribute ** - changed GetPortControl to GetPortAttribute ** - changed QueryBestSize ** ** 28.05.91 Carver ** - fixed Put and Get requests to not preempt operations to same drawable ** ** 15.05.91 Carver ** - version 2.0 upgrade ** ** 19.03.91 Carver ** - fixed Put and Get requests to honor grabbed ports. ** - fixed Video requests to update di structure with new drawable, and ** client after calling ddx. ** ** 24.01.91 Carver ** - version 1.4 upgrade ** ** Notes: ** ** Port structures reference client structures in a two different ** ways: when grabs, or video is active. Each reference is encoded ** as fake client resources and thus when the client is goes away so ** does the reference (it is zeroed). No other action is taken, so ** video doesn't necessarily stop. It probably will as a result of ** other resources going away, but if a client starts video using ** none of its own resources, then the video will continue to play ** after the client disappears. ** ** */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "os.h" #include "scrnintstr.h" #include "windowstr.h" #include "pixmapstr.h" #include "gc.h" #include "extnsionst.h" #include "dixstruct.h" #include "resource.h" #include "opaque.h" #include "input.h" #define GLOBAL #include #include #include "xvdix.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #include "xvdisp.h" #endif int XvScreenIndex = -1; unsigned long XvExtensionGeneration = 0; unsigned long XvScreenGeneration = 0; unsigned long XvResourceGeneration = 0; int XvReqCode; int XvEventBase; int XvErrorBase; unsigned long XvRTPort; unsigned long XvRTEncoding; unsigned long XvRTGrab; unsigned long XvRTVideoNotify; unsigned long XvRTVideoNotifyList; unsigned long XvRTPortNotify; /* EXTERNAL */ extern XID clientErrorValue; static void WriteSwappedVideoNotifyEvent(xvEvent *, xvEvent *); static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *); static Bool CreateResourceTypes(void); static Bool XvCloseScreen(ScreenPtr); static Bool XvDestroyPixmap(PixmapPtr); static Bool XvDestroyWindow(WindowPtr); static void XvResetProc(ExtensionEntry*); static int XvdiDestroyGrab(void *, XID); static int XvdiDestroyEncoding(void *, XID); static int XvdiDestroyVideoNotify(void *, XID); static int XvdiDestroyPortNotify(void *, XID); static int XvdiDestroyVideoNotifyList(void *, XID); static int XvdiDestroyPort(void *, XID); static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int); /* ** XvExtensionInit ** ** */ void XvExtensionInit(void) { ExtensionEntry *extEntry; /* LOOK TO SEE IF ANY SCREENS WERE INITIALIZED; IF NOT THEN INIT GLOBAL VARIABLES SO THE EXTENSION CAN FUNCTION */ if (XvScreenGeneration != serverGeneration) { if (!CreateResourceTypes()) { ErrorF("XvExtensionInit: Unable to allocate resource types\n"); return; } XvScreenIndex = AllocateScreenPrivateIndex (); if (XvScreenIndex < 0) { ErrorF("XvExtensionInit: Unable to allocate screen private index\n"); return; } #ifdef PANORAMIX XineramaRegisterConnectionBlockCallback(XineramifyXv); #endif XvScreenGeneration = serverGeneration; } if (XvExtensionGeneration != serverGeneration) { XvExtensionGeneration = serverGeneration; extEntry = AddExtension(XvName, XvNumEvents, XvNumErrors, ProcXvDispatch, SProcXvDispatch, XvResetProc, StandardMinorOpcode); if (!extEntry) { FatalError("XvExtensionInit: AddExtensions failed\n"); } XvReqCode = extEntry->base; XvEventBase = extEntry->eventBase; XvErrorBase = extEntry->errorBase; EventSwapVector[XvEventBase+XvVideoNotify] = (EventSwapPtr)WriteSwappedVideoNotifyEvent; EventSwapVector[XvEventBase+XvPortNotify] = (EventSwapPtr)WriteSwappedPortNotifyEvent; (void)MakeAtom(XvName, strlen(XvName), xTrue); } } static Bool CreateResourceTypes(void) { if (XvResourceGeneration == serverGeneration) return TRUE; XvResourceGeneration = serverGeneration; if (!(XvRTPort = CreateNewResourceType(XvdiDestroyPort))) { ErrorF("CreateResourceTypes: failed to allocate port resource.\n"); return FALSE; } if (!(XvRTGrab = CreateNewResourceType(XvdiDestroyGrab))) { ErrorF("CreateResourceTypes: failed to allocate grab resource.\n"); return FALSE; } if (!(XvRTEncoding = CreateNewResourceType(XvdiDestroyEncoding))) { ErrorF("CreateResourceTypes: failed to allocate encoding resource.\n"); return FALSE; } if (!(XvRTVideoNotify = CreateNewResourceType(XvdiDestroyVideoNotify))) { ErrorF("CreateResourceTypes: failed to allocate video notify resource.\n"); return FALSE; } if (!(XvRTVideoNotifyList = CreateNewResourceType(XvdiDestroyVideoNotifyList))) { ErrorF("CreateResourceTypes: failed to allocate video notify list resource.\n"); return FALSE; } if (!(XvRTPortNotify = CreateNewResourceType(XvdiDestroyPortNotify))) { ErrorF("CreateResourceTypes: failed to allocate port notify resource.\n"); return FALSE; } return TRUE; } _X_EXPORT int XvScreenInit(ScreenPtr pScreen) { XvScreenPtr pxvs; if (XvScreenGeneration != serverGeneration) { if (!CreateResourceTypes()) { ErrorF("XvScreenInit: Unable to allocate resource types\n"); return BadAlloc; } XvScreenIndex = AllocateScreenPrivateIndex (); if (XvScreenIndex < 0) { ErrorF("XvScreenInit: Unable to allocate screen private index\n"); return BadAlloc; } #ifdef PANORAMIX XineramaRegisterConnectionBlockCallback(XineramifyXv); #endif XvScreenGeneration = serverGeneration; } if (pScreen->devPrivates[XvScreenIndex].ptr) { ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n"); } /* ALLOCATE SCREEN PRIVATE RECORD */ pxvs = (XvScreenPtr) malloc (sizeof (XvScreenRec)); if (!pxvs) { ErrorF("XvScreenInit: Unable to allocate screen private structure\n"); return BadAlloc; } pScreen->devPrivates[XvScreenIndex].ptr = (void *)pxvs; pxvs->DestroyPixmap = pScreen->DestroyPixmap; pxvs->DestroyWindow = pScreen->DestroyWindow; pxvs->CloseScreen = pScreen->CloseScreen; pScreen->DestroyPixmap = XvDestroyPixmap; pScreen->DestroyWindow = XvDestroyWindow; pScreen->CloseScreen = XvCloseScreen; return Success; } static Bool XvCloseScreen( ScreenPtr pScreen ){ XvScreenPtr pxvs; pxvs = (XvScreenPtr) pScreen->devPrivates[XvScreenIndex].ptr; pScreen->DestroyPixmap = pxvs->DestroyPixmap; pScreen->DestroyWindow = pxvs->DestroyWindow; pScreen->CloseScreen = pxvs->CloseScreen; (* pxvs->ddCloseScreen)(pScreen); free(pxvs); pScreen->devPrivates[XvScreenIndex].ptr = (void *)NULL; return (*pScreen->CloseScreen)(pScreen); } static void XvResetProc(ExtensionEntry* extEntry) { } _X_EXPORT int XvGetScreenIndex() { return XvScreenIndex; } _X_EXPORT unsigned long XvGetRTPort() { return XvRTPort; } static Bool XvDestroyPixmap(PixmapPtr pPix) { Bool status; ScreenPtr pScreen; XvScreenPtr pxvs; XvAdaptorPtr pa; int na; XvPortPtr pp; int np; pScreen = pPix->drawable.pScreen; SCREEN_PROLOGUE(pScreen, DestroyPixmap); pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr; /* CHECK TO SEE IF THIS PORT IS IN USE */ pa = pxvs->pAdaptors; na = pxvs->nAdaptors; while (na--) { np = pa->nPorts; pp = pa->pPorts; while (np--) { if (pp->pDraw == (DrawablePtr)pPix) { XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted); (void)(* pp->pAdaptor->ddStopVideo)((ClientPtr)NULL, pp, pp->pDraw); pp->pDraw = (DrawablePtr)NULL; pp->client = (ClientPtr)NULL; pp->time = currentTime; } pp++; } pa++; } status = (* pScreen->DestroyPixmap)(pPix); SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap); return status; } static Bool XvDestroyWindow(WindowPtr pWin) { Bool status; ScreenPtr pScreen; XvScreenPtr pxvs; XvAdaptorPtr pa; int na; XvPortPtr pp; int np; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE(pScreen, DestroyWindow); pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr; /* CHECK TO SEE IF THIS PORT IS IN USE */ pa = pxvs->pAdaptors; na = pxvs->nAdaptors; while (na--) { np = pa->nPorts; pp = pa->pPorts; while (np--) { if (pp->pDraw == (DrawablePtr)pWin) { XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted); (void)(* pp->pAdaptor->ddStopVideo)((ClientPtr)NULL, pp, pp->pDraw); pp->pDraw = (DrawablePtr)NULL; pp->client = (ClientPtr)NULL; pp->time = currentTime; } pp++; } pa++; } status = (* pScreen->DestroyWindow)(pWin); SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow); return status; } /* The XvdiVideoStopped procedure is a hook for the device dependent layer. It provides a way for the dd layer to inform the di layer that video has stopped in a port for reasons that the di layer had no control over; note that it doesn't call back into the dd layer */ int XvdiVideoStopped(XvPortPtr pPort, int reason) { /* IF PORT ISN'T ACTIVE THEN WE'RE DONE */ if (!pPort->pDraw) return Success; XvdiSendVideoNotify(pPort, pPort->pDraw, reason); pPort->pDraw = (DrawablePtr)NULL; pPort->client = (ClientPtr)NULL; pPort->time = currentTime; return Success; } static int XvdiDestroyPort(void * pPort, XID id) { return (* ((XvPortPtr)pPort)->pAdaptor->ddFreePort)(pPort); } static int XvdiDestroyGrab(void * pGrab, XID id) { ((XvGrabPtr)pGrab)->client = (ClientPtr)NULL; return Success; } static int XvdiDestroyVideoNotify(void * pn, XID id) { /* JUST CLEAR OUT THE client POINTER FIELD */ ((XvVideoNotifyPtr)pn)->client = (ClientPtr)NULL; return Success; } static int XvdiDestroyPortNotify(void * pn, XID id) { /* JUST CLEAR OUT THE client POINTER FIELD */ ((XvPortNotifyPtr)pn)->client = (ClientPtr)NULL; return Success; } static int XvdiDestroyVideoNotifyList(void * pn, XID id) { XvVideoNotifyPtr npn,cpn; /* ACTUALLY DESTROY THE NOTITY LIST */ cpn = (XvVideoNotifyPtr)pn; while (cpn) { npn = cpn->next; if (cpn->client) FreeResource(cpn->id, XvRTVideoNotify); free(cpn); cpn = npn; } return Success; } static int XvdiDestroyEncoding(void * value, XID id) { return Success; } static int XvdiSendVideoNotify(pPort, pDraw, reason) XvPortPtr pPort; DrawablePtr pDraw; int reason; { xvEvent event; XvVideoNotifyPtr pn; pn = (XvVideoNotifyPtr)LookupIDByType(pDraw->id, XvRTVideoNotifyList); while (pn) { if (pn->client) { event.u.u.type = XvEventBase + XvVideoNotify; event.u.u.sequenceNumber = pn->client->sequence; event.u.videoNotify.time = currentTime.milliseconds; event.u.videoNotify.drawable = pDraw->id; event.u.videoNotify.port = pPort->id; event.u.videoNotify.reason = reason; (void) TryClientEvents(pn->client, (xEventPtr)&event, 1, NoEventMask, NoEventMask, NullGrab); } pn = pn->next; } return Success; } int XvdiSendPortNotify( XvPortPtr pPort, Atom attribute, INT32 value ){ xvEvent event; XvPortNotifyPtr pn; pn = pPort->pNotify; while (pn) { if (pn->client) { event.u.u.type = XvEventBase + XvPortNotify; event.u.u.sequenceNumber = pn->client->sequence; event.u.portNotify.time = currentTime.milliseconds; event.u.portNotify.port = pPort->id; event.u.portNotify.attribute = attribute; event.u.portNotify.value = value; (void) TryClientEvents(pn->client, (xEventPtr)&event, 1, NoEventMask, NoEventMask, NullGrab); } pn = pn->next; } return Success; } #define CHECK_SIZE(dw, dh, sw, sh) { \ if(!dw || !dh || !sw || !sh) return Success; \ /* The region code will break these if they are too large */ \ if((dw > 32767) || (dh > 32767) || (sw > 32767) || (sh > 32767)) \ return BadValue; \ } int XvdiPutVideo( ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ DrawablePtr pOldDraw; CHECK_SIZE(drw_w, drw_h, vid_w, vid_h); /* UPDATE TIME VARIABLES FOR USE IN EVENTS */ UpdateCurrentTime(); /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN INFORM CLIENT OF ITS FAILURE */ if (pPort->grab.client && (pPort->grab.client != client)) { XvdiSendVideoNotify(pPort, pDraw, XvBusy); return Success; } /* CHECK TO SEE IF PORT IS IN USE; IF SO THEN WE MUST DELIVER INTERRUPTED EVENTS TO ANY CLIENTS WHO WANT THEM */ pOldDraw = pPort->pDraw; if ((pOldDraw) && (pOldDraw != pDraw)) { XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted); } (void) (* pPort->pAdaptor->ddPutVideo)(client, pDraw, pPort, pGC, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h); if ((pPort->pDraw) && (pOldDraw != pDraw)) { pPort->client = client; XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted); } pPort->time = currentTime; return (Success); } int XvdiPutStill( ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ int status; CHECK_SIZE(drw_w, drw_h, vid_w, vid_h); /* UPDATE TIME VARIABLES FOR USE IN EVENTS */ UpdateCurrentTime(); /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN INFORM CLIENT OF ITS FAILURE */ if (pPort->grab.client && (pPort->grab.client != client)) { XvdiSendVideoNotify(pPort, pDraw, XvBusy); return Success; } pPort->time = currentTime; status = (* pPort->pAdaptor->ddPutStill)(client, pDraw, pPort, pGC, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h); return status; } int XvdiPutImage( ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, INT16 src_x, INT16 src_y, CARD16 src_w, CARD16 src_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h, XvImagePtr image, unsigned char* data, Bool sync, CARD16 width, CARD16 height ){ CHECK_SIZE(drw_w, drw_h, src_w, src_h); /* UPDATE TIME VARIABLES FOR USE IN EVENTS */ UpdateCurrentTime(); /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN INFORM CLIENT OF ITS FAILURE */ if (pPort->grab.client && (pPort->grab.client != client)) { XvdiSendVideoNotify(pPort, pDraw, XvBusy); return Success; } pPort->time = currentTime; return (* pPort->pAdaptor->ddPutImage)(client, pDraw, pPort, pGC, src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, image, data, sync, width, height); } int XvdiGetVideo( ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ DrawablePtr pOldDraw; CHECK_SIZE(drw_w, drw_h, vid_w, vid_h); /* UPDATE TIME VARIABLES FOR USE IN EVENTS */ UpdateCurrentTime(); /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN INFORM CLIENT OF ITS FAILURE */ if (pPort->grab.client && (pPort->grab.client != client)) { XvdiSendVideoNotify(pPort, pDraw, XvBusy); return Success; } /* CHECK TO SEE IF PORT IS IN USE; IF SO THEN WE MUST DELIVER INTERRUPTED EVENTS TO ANY CLIENTS WHO WANT THEM */ pOldDraw = pPort->pDraw; if ((pOldDraw) && (pOldDraw != pDraw)) { XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted); } (void) (* pPort->pAdaptor->ddGetVideo)(client, pDraw, pPort, pGC, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h); if ((pPort->pDraw) && (pOldDraw != pDraw)) { pPort->client = client; XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted); } pPort->time = currentTime; return (Success); } int XvdiGetStill( ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ int status; CHECK_SIZE(drw_w, drw_h, vid_w, vid_h); /* UPDATE TIME VARIABLES FOR USE IN EVENTS */ UpdateCurrentTime(); /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN INFORM CLIENT OF ITS FAILURE */ if (pPort->grab.client && (pPort->grab.client != client)) { XvdiSendVideoNotify(pPort, pDraw, XvBusy); return Success; } status = (* pPort->pAdaptor->ddGetStill)(client, pDraw, pPort, pGC, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h); pPort->time = currentTime; return status; } int XvdiGrabPort( ClientPtr client, XvPortPtr pPort, Time ctime, int *p_result ){ unsigned long id; TimeStamp time; UpdateCurrentTime(); time = ClientTimeToServerTime(ctime); if (pPort->grab.client && (client != pPort->grab.client)) { *p_result = XvAlreadyGrabbed; return Success; } if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, pPort->time) == EARLIER)) { *p_result = XvInvalidTime; return Success; } if (client == pPort->grab.client) { *p_result = Success; return Success; } id = FakeClientID(client->index); if (!AddResource(id, XvRTGrab, &pPort->grab)) { return BadAlloc; } /* IF THERE IS ACTIVE VIDEO THEN STOP IT */ if ((pPort->pDraw) && (client != pPort->client)) { XVCALL(diStopVideo)((ClientPtr)NULL, pPort, pPort->pDraw); } pPort->grab.client = client; pPort->grab.id = id; pPort->time = currentTime; *p_result = Success; return Success; } int XvdiUngrabPort( ClientPtr client, XvPortPtr pPort, Time ctime ){ TimeStamp time; UpdateCurrentTime(); time = ClientTimeToServerTime(ctime); if ((!pPort->grab.client) || (client != pPort->grab.client)) { return Success; } if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, pPort->time) == EARLIER)) { return Success; } /* FREE THE GRAB RESOURCE; AND SET THE GRAB CLIENT TO NULL */ FreeResource(pPort->grab.id, XvRTGrab); pPort->grab.client = (ClientPtr)NULL; pPort->time = currentTime; return Success; } int XvdiSelectVideoNotify( ClientPtr client, DrawablePtr pDraw, BOOL onoff ){ XvVideoNotifyPtr pn,tpn,fpn; /* FIND VideoNotify LIST */ pn = (XvVideoNotifyPtr)LookupIDByType(pDraw->id, XvRTVideoNotifyList); /* IF ONE DONES'T EXIST AND NO MASK, THEN JUST RETURN */ if (!onoff && !pn) return Success; /* IF ONE DOESN'T EXIST CREATE IT AND ADD A RESOURCE SO THAT THE LIST WILL BE DELETED WHEN THE DRAWABLE IS DESTROYED */ if (!pn) { if (!(tpn = (XvVideoNotifyPtr)malloc(sizeof(XvVideoNotifyRec)))) return BadAlloc; tpn->next = (XvVideoNotifyPtr)NULL; if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn)) { free(tpn); return BadAlloc; } } else { /* LOOK TO SEE IF ENTRY ALREADY EXISTS */ fpn = (XvVideoNotifyPtr)NULL; tpn = pn; while (tpn) { if (tpn->client == client) { if (!onoff) tpn->client = (ClientPtr)NULL; return Success; } if (!tpn->client) fpn = tpn; /* TAKE NOTE OF FREE ENTRY */ tpn = tpn->next; } /* IF TUNNING OFF, THEN JUST RETURN */ if (!onoff) return Success; /* IF ONE ISN'T FOUND THEN ALLOCATE ONE AND LINK IT INTO THE LIST */ if (fpn) { tpn = fpn; } else { if (!(tpn = (XvVideoNotifyPtr)malloc(sizeof(XvVideoNotifyRec)))) return BadAlloc; tpn->next = pn->next; pn->next = tpn; } } /* INIT CLIENT PTR IN CASE WE CAN'T ADD RESOURCE */ /* ADD RESOURCE SO THAT IF CLIENT EXITS THE CLIENT PTR WILL BE CLEARED */ tpn->client = (ClientPtr)NULL; tpn->id = FakeClientID(client->index); AddResource(tpn->id, XvRTVideoNotify, tpn); tpn->client = client; return Success; } int XvdiSelectPortNotify( ClientPtr client, XvPortPtr pPort, BOOL onoff ){ XvPortNotifyPtr pn,tpn; /* SEE IF CLIENT IS ALREADY IN LIST */ tpn = (XvPortNotifyPtr)NULL; pn = pPort->pNotify; while (pn) { if (!pn->client) tpn = pn; /* TAKE NOTE OF FREE ENTRY */ if (pn->client == client) break; pn = pn->next; } /* IS THE CLIENT ALREADY ON THE LIST? */ if (pn) { /* REMOVE IT? */ if (!onoff) { pn->client = (ClientPtr)NULL; FreeResource(pn->id, XvRTPortNotify); } return Success; } /* DIDN'T FIND IT; SO REUSE LIST ELEMENT IF ONE IS FREE OTHERWISE CREATE A NEW ONE AND ADD IT TO THE BEGINNING OF THE LIST */ if (!tpn) { if (!(tpn = (XvPortNotifyPtr)malloc(sizeof(XvPortNotifyRec)))) return BadAlloc; tpn->next = pPort->pNotify; pPort->pNotify = tpn; } tpn->client = client; tpn->id = FakeClientID(client->index); AddResource(tpn->id, XvRTPortNotify, tpn); return Success; } int XvdiStopVideo( ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw ){ int status; /* IF PORT ISN'T ACTIVE THEN WE'RE DONE */ if (!pPort->pDraw || (pPort->pDraw != pDraw)) { XvdiSendVideoNotify(pPort, pDraw, XvStopped); return Success; } /* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN INFORM CLIENT OF ITS FAILURE */ if ((client) && (pPort->grab.client) && (pPort->grab.client != client)) { XvdiSendVideoNotify(pPort, pDraw, XvBusy); return Success; } XvdiSendVideoNotify(pPort, pDraw, XvStopped); status = (* pPort->pAdaptor->ddStopVideo)(client, pPort, pDraw); pPort->pDraw = (DrawablePtr)NULL; pPort->client = (ClientPtr)client; pPort->time = currentTime; return status; } int XvdiPreemptVideo( ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw ){ int status; /* IF PORT ISN'T ACTIVE THEN WE'RE DONE */ if (!pPort->pDraw || (pPort->pDraw != pDraw)) return Success; XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted); status = (* pPort->pAdaptor->ddStopVideo)(client, pPort, pPort->pDraw); pPort->pDraw = (DrawablePtr)NULL; pPort->client = (ClientPtr)client; pPort->time = currentTime; return status; } int XvdiMatchPort( XvPortPtr pPort, DrawablePtr pDraw ){ XvAdaptorPtr pa; XvFormatPtr pf; int nf; pa = pPort->pAdaptor; if (pa->pScreen != pDraw->pScreen) return BadMatch; nf = pa->nFormats; pf = pa->pFormats; while (nf--) { if ((pf->depth == pDraw->depth) #if 0 && ((pDraw->type == DRAWABLE_PIXMAP) || (wVisual(((WindowPtr)pDraw)) == pf->visual)) #endif ) return Success; pf++; } return BadMatch; } int XvdiSetPortAttribute( ClientPtr client, XvPortPtr pPort, Atom attribute, INT32 value ){ XvdiSendPortNotify(pPort, attribute, value); return (* pPort->pAdaptor->ddSetPortAttribute)(client, pPort, attribute, value); } int XvdiGetPortAttribute( ClientPtr client, XvPortPtr pPort, Atom attribute, INT32 *p_value ){ return (* pPort->pAdaptor->ddGetPortAttribute)(client, pPort, attribute, p_value); } static void WriteSwappedVideoNotifyEvent(xvEvent *from, xvEvent *to) { to->u.u.type = from->u.u.type; to->u.u.detail = from->u.u.detail; cpswaps(from->u.videoNotify.sequenceNumber, to->u.videoNotify.sequenceNumber); cpswapl(from->u.videoNotify.time, to->u.videoNotify.time); cpswapl(from->u.videoNotify.drawable, to->u.videoNotify.drawable); cpswapl(from->u.videoNotify.port, to->u.videoNotify.port); } static void WriteSwappedPortNotifyEvent(xvEvent *from, xvEvent *to) { to->u.u.type = from->u.u.type; to->u.u.detail = from->u.u.detail; cpswaps(from->u.portNotify.sequenceNumber, to->u.portNotify.sequenceNumber); cpswapl(from->u.portNotify.time, to->u.portNotify.time); cpswapl(from->u.portNotify.port, to->u.portNotify.port); cpswapl(from->u.portNotify.value, to->u.portNotify.value); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/xvmc.c0000644000000000000000000005070413614532331016652 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "resource.h" #include "scrnintstr.h" #include "extnsionst.h" #include "servermd.h" #include #include "xvdix.h" #include #include #include #include "xvmcext.h" #ifdef HAS_XVMCSHM #include #include #include #endif /* HAS_XVMCSHM */ #define DR_CLIENT_DRIVER_NAME_SIZE 48 #define DR_BUSID_SIZE 48 int XvMCScreenIndex = -1; unsigned long XvMCGeneration = 0; int XvMCReqCode; int XvMCEventBase; int XvMCErrorBase; unsigned long XvMCRTContext; unsigned long XvMCRTSurface; unsigned long XvMCRTSubpicture; typedef struct { int num_adaptors; XvMCAdaptorPtr adaptors; CloseScreenProcPtr CloseScreen; char clientDriverName[DR_CLIENT_DRIVER_NAME_SIZE]; char busID[DR_BUSID_SIZE]; int major; int minor; int patchLevel; } XvMCScreenRec, *XvMCScreenPtr; #define XVMC_GET_PRIVATE(pScreen) \ (XvMCScreenPtr)((pScreen)->devPrivates[XvMCScreenIndex].ptr) static int XvMCDestroyContextRes(void * data, XID id) { XvMCContextPtr pContext = (XvMCContextPtr)data; pContext->refcnt--; if(!pContext->refcnt) { XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); (*pScreenPriv->adaptors[pContext->adapt_num].DestroyContext)(pContext); free(pContext); } return Success; } static int XvMCDestroySurfaceRes(void * data, XID id) { XvMCSurfacePtr pSurface = (XvMCSurfacePtr)data; XvMCContextPtr pContext = pSurface->context; XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); (*pScreenPriv->adaptors[pContext->adapt_num].DestroySurface)(pSurface); free(pSurface); XvMCDestroyContextRes((void *)pContext, pContext->context_id); return Success; } static int XvMCDestroySubpictureRes(void * data, XID id) { XvMCSubpicturePtr pSubpict = (XvMCSubpicturePtr)data; XvMCContextPtr pContext = pSubpict->context; XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); (*pScreenPriv->adaptors[pContext->adapt_num].DestroySubpicture)(pSubpict); free(pSubpict); XvMCDestroyContextRes((void *)pContext, pContext->context_id); return Success; } static void XvMCResetProc (ExtensionEntry *extEntry) { } static int ProcXvMCQueryVersion(ClientPtr client) { xvmcQueryVersionReply rep; /* REQUEST(xvmcQueryVersionReq); */ REQUEST_SIZE_MATCH(xvmcQueryVersionReq); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.major = XvMCVersion; rep.minor = XvMCRevision; WriteToClient(client, sizeof(xvmcQueryVersionReply), &rep); return Success; } static int ProcXvMCListSurfaceTypes(ClientPtr client) { XvPortPtr pPort; int i; XvMCScreenPtr pScreenPriv; xvmcListSurfaceTypesReply rep; xvmcSurfaceInfo info; XvMCAdaptorPtr adaptor = NULL; XvMCSurfaceInfoPtr surface; REQUEST(xvmcListSurfaceTypesReq); REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq); if(!(pPort = LOOKUP_PORT(stuff->port, client))) { client->errorValue = stuff->port; return _XvBadPort; } if(XvMCScreenIndex >= 0) { /* any adaptors at all */ ScreenPtr pScreen = pPort->pAdaptor->pScreen; if((pScreenPriv = XVMC_GET_PRIVATE(pScreen))) { /* any this screen */ for(i = 0; i < pScreenPriv->num_adaptors; i++) { if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) { adaptor = &(pScreenPriv->adaptors[i]); break; } } } } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.num = (adaptor) ? adaptor->num_surfaces : 0; rep.length = rep.num * sizeof(xvmcSurfaceInfo) >> 2; WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep); for(i = 0; i < rep.num; i++) { surface = adaptor->surfaces[i]; info.surface_type_id = surface->surface_type_id; info.chroma_format = surface->chroma_format; info.max_width = surface->max_width; info.max_height = surface->max_height; info.subpicture_max_width = surface->subpicture_max_width; info.subpicture_max_height = surface->subpicture_max_height; info.mc_type = surface->mc_type; info.flags = surface->flags; WriteToClient(client, sizeof(xvmcSurfaceInfo), &info); } return Success; } static int ProcXvMCCreateContext(ClientPtr client) { XvPortPtr pPort; CARD32 *data = NULL; int dwords = 0; int i, result, adapt_num = -1; ScreenPtr pScreen; XvMCContextPtr pContext; XvMCScreenPtr pScreenPriv; XvMCAdaptorPtr adaptor = NULL; XvMCSurfaceInfoPtr surface = NULL; xvmcCreateContextReply rep; REQUEST(xvmcCreateContextReq); REQUEST_SIZE_MATCH(xvmcCreateContextReq); if(!(pPort = LOOKUP_PORT(stuff->port, client))) { client->errorValue = stuff->port; return _XvBadPort; } pScreen = pPort->pAdaptor->pScreen; if(XvMCScreenIndex < 0) /* no XvMC adaptors */ return BadMatch; if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) /* none this screen */ return BadMatch; for(i = 0; i < pScreenPriv->num_adaptors; i++) { if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) { adaptor = &(pScreenPriv->adaptors[i]); adapt_num = i; break; } } if(adapt_num < 0) /* none this port */ return BadMatch; for(i = 0; i < adaptor->num_surfaces; i++) { if(adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) { surface = adaptor->surfaces[i]; break; } } /* adaptor doesn't support this suface_type_id */ if(!surface) return BadMatch; if((stuff->width > surface->max_width) || (stuff->height > surface->max_height)) return BadValue; if(!(pContext = malloc(sizeof(XvMCContextRec)))) { return BadAlloc; } pContext->pScreen = pScreen; pContext->adapt_num = adapt_num; pContext->context_id = stuff->context_id; pContext->surface_type_id = stuff->surface_type_id; pContext->width = stuff->width; pContext->height = stuff->height; pContext->flags = stuff->flags; pContext->refcnt = 1; result = (*adaptor->CreateContext)(pPort, pContext, &dwords, &data); if(result != Success) { free(pContext); return result; } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.width_actual = pContext->width; rep.height_actual = pContext->height; rep.flags_return = pContext->flags; rep.length = dwords; WriteToClient(client, sizeof(xvmcCreateContextReply), &rep); if(dwords) WriteToClient(client, dwords << 2, data); AddResource(pContext->context_id, XvMCRTContext, pContext); if(data) free(data); return Success; } static int ProcXvMCDestroyContext(ClientPtr client) { REQUEST(xvmcDestroyContextReq); REQUEST_SIZE_MATCH(xvmcDestroyContextReq); if(!LookupIDByType(stuff->context_id, XvMCRTContext)) return (XvMCBadContext + XvMCErrorBase); FreeResource(stuff->context_id, RT_NONE); return Success; } static int ProcXvMCCreateSurface(ClientPtr client) { CARD32 *data = NULL; int dwords = 0; int result; XvMCContextPtr pContext; XvMCSurfacePtr pSurface; XvMCScreenPtr pScreenPriv; xvmcCreateSurfaceReply rep; REQUEST(xvmcCreateSurfaceReq); REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq); if(!(pContext = LookupIDByType(stuff->context_id, XvMCRTContext))) return (XvMCBadContext + XvMCErrorBase); pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); if(!(pSurface = malloc(sizeof(XvMCSurfaceRec)))) return BadAlloc; pSurface->surface_id = stuff->surface_id; pSurface->surface_type_id = pContext->surface_type_id; pSurface->context = pContext; result = (*pScreenPriv->adaptors[pContext->adapt_num].CreateSurface)( pSurface, &dwords, &data); if(result != Success) { free(pSurface); return result; } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = dwords; WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep); if(dwords) WriteToClient(client, dwords << 2, data); AddResource(pSurface->surface_id, XvMCRTSurface, pSurface); if(data) free(data); pContext->refcnt++; return Success; } static int ProcXvMCDestroySurface(ClientPtr client) { REQUEST(xvmcDestroySurfaceReq); REQUEST_SIZE_MATCH(xvmcDestroySurfaceReq); if(!LookupIDByType(stuff->surface_id, XvMCRTSurface)) return (XvMCBadSurface + XvMCErrorBase); FreeResource(stuff->surface_id, RT_NONE); return Success; } static int ProcXvMCCreateSubpicture(ClientPtr client) { Bool image_supported = FALSE; CARD32 *data = NULL; int i, result, dwords = 0; XvMCContextPtr pContext; XvMCSubpicturePtr pSubpicture; XvMCScreenPtr pScreenPriv; xvmcCreateSubpictureReply rep; XvMCAdaptorPtr adaptor; XvMCSurfaceInfoPtr surface = NULL; REQUEST(xvmcCreateSubpictureReq); REQUEST_SIZE_MATCH(xvmcCreateSubpictureReq); if(!(pContext = LookupIDByType(stuff->context_id, XvMCRTContext))) return (XvMCBadContext + XvMCErrorBase); pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); adaptor = &(pScreenPriv->adaptors[pContext->adapt_num]); /* find which surface this context supports */ for(i = 0; i < adaptor->num_surfaces; i++) { if(adaptor->surfaces[i]->surface_type_id == pContext->surface_type_id){ surface = adaptor->surfaces[i]; break; } } if(!surface) return BadMatch; /* make sure this surface supports that xvimage format */ if(!surface->compatible_subpictures) return BadMatch; for(i = 0; i < surface->compatible_subpictures->num_xvimages; i++) { if(surface->compatible_subpictures->xvimage_ids[i] == stuff->xvimage_id) { image_supported = TRUE; break; } } if(!image_supported) return BadMatch; /* make sure the size is OK */ if((stuff->width > surface->subpicture_max_width) || (stuff->height > surface->subpicture_max_height)) return BadValue; if(!(pSubpicture = malloc(sizeof(XvMCSubpictureRec)))) return BadAlloc; pSubpicture->subpicture_id = stuff->subpicture_id; pSubpicture->xvimage_id = stuff->xvimage_id; pSubpicture->width = stuff->width; pSubpicture->height = stuff->height; pSubpicture->num_palette_entries = 0; /* overwritten by DDX */ pSubpicture->entry_bytes = 0; /* overwritten by DDX */ pSubpicture->component_order[0] = 0; /* overwritten by DDX */ pSubpicture->component_order[1] = 0; pSubpicture->component_order[2] = 0; pSubpicture->component_order[3] = 0; pSubpicture->context = pContext; result = (*pScreenPriv->adaptors[pContext->adapt_num].CreateSubpicture)( pSubpicture, &dwords, &data); if(result != Success) { free(pSubpicture); return result; } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.width_actual = pSubpicture->width; rep.height_actual = pSubpicture->height; rep.num_palette_entries = pSubpicture->num_palette_entries; rep.entry_bytes = pSubpicture->entry_bytes; rep.component_order[0] = pSubpicture->component_order[0]; rep.component_order[1] = pSubpicture->component_order[1]; rep.component_order[2] = pSubpicture->component_order[2]; rep.component_order[3] = pSubpicture->component_order[3]; rep.length = dwords; WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep); if(dwords) WriteToClient(client, dwords << 2, data); AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture); if(data) free(data); pContext->refcnt++; return Success; } static int ProcXvMCDestroySubpicture(ClientPtr client) { REQUEST(xvmcDestroySubpictureReq); REQUEST_SIZE_MATCH(xvmcDestroySubpictureReq); if(!LookupIDByType(stuff->subpicture_id, XvMCRTSubpicture)) return (XvMCBadSubpicture + XvMCErrorBase); FreeResource(stuff->subpicture_id, RT_NONE); return Success; } static int ProcXvMCListSubpictureTypes(ClientPtr client) { XvPortPtr pPort; xvmcListSubpictureTypesReply rep; XvMCScreenPtr pScreenPriv; ScreenPtr pScreen; XvMCAdaptorPtr adaptor = NULL; XvMCSurfaceInfoPtr surface = NULL; xvImageFormatInfo info; XvImagePtr pImage; int i, j; REQUEST(xvmcListSubpictureTypesReq); REQUEST_SIZE_MATCH(xvmcListSubpictureTypesReq); if(!(pPort = LOOKUP_PORT(stuff->port, client))) { client->errorValue = stuff->port; return _XvBadPort; } pScreen = pPort->pAdaptor->pScreen; if(XvMCScreenIndex < 0) /* No XvMC adaptors */ return BadMatch; if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) return BadMatch; /* None this screen */ for(i = 0; i < pScreenPriv->num_adaptors; i++) { if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) { adaptor = &(pScreenPriv->adaptors[i]); break; } } if(!adaptor) return BadMatch; for(i = 0; i < adaptor->num_surfaces; i++) { if(adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) { surface = adaptor->surfaces[i]; break; } } if(!surface) return BadMatch; rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.num = 0; if(surface->compatible_subpictures) rep.num = surface->compatible_subpictures->num_xvimages; rep.length = rep.num * sizeof(xvImageFormatInfo) >> 2; WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), &rep); for(i = 0; i < rep.num; i++) { pImage = NULL; for(j = 0; j < adaptor->num_subpictures; j++) { if(surface->compatible_subpictures->xvimage_ids[i] == adaptor->subpictures[j]->id) { pImage = adaptor->subpictures[j]; break; } } if(!pImage) return BadImplementation; info.id = pImage->id; info.type = pImage->type; info.byte_order = pImage->byte_order; memcpy(&info.guid, pImage->guid, 16); info.bpp = pImage->bits_per_pixel; info.num_planes = pImage->num_planes; info.depth = pImage->depth; info.red_mask = pImage->red_mask; info.green_mask = pImage->green_mask; info.blue_mask = pImage->blue_mask; info.format = pImage->format; info.y_sample_bits = pImage->y_sample_bits; info.u_sample_bits = pImage->u_sample_bits; info.v_sample_bits = pImage->v_sample_bits; info.horz_y_period = pImage->horz_y_period; info.horz_u_period = pImage->horz_u_period; info.horz_v_period = pImage->horz_v_period; info.vert_y_period = pImage->vert_y_period; info.vert_u_period = pImage->vert_u_period; info.vert_v_period = pImage->vert_v_period; memcpy(&info.comp_order, pImage->component_order, 32); info.scanline_order = pImage->scanline_order; WriteToClient(client, sizeof(xvImageFormatInfo), &info); } return Success; } static int ProcXvMCGetDRInfo(ClientPtr client) { xvmcGetDRInfoReply rep; XvPortPtr pPort; ScreenPtr pScreen; XvMCScreenPtr pScreenPriv; #ifdef HAS_XVMCSHM volatile CARD32 *patternP; #endif REQUEST(xvmcGetDRInfoReq); REQUEST_SIZE_MATCH(xvmcGetDRInfoReq); if(!(pPort = LOOKUP_PORT(stuff->port, client))) { client->errorValue = stuff->port; return _XvBadPort; } pScreen = pPort->pAdaptor->pScreen; pScreenPriv = XVMC_GET_PRIVATE(pScreen); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.major = pScreenPriv->major; rep.minor = pScreenPriv->minor; rep.patchLevel = pScreenPriv->patchLevel; rep.nameLen = (strlen(pScreenPriv->clientDriverName) + 4) >> 2; rep.busIDLen = (strlen(pScreenPriv->busID) + 4) >> 2; rep.length = rep.nameLen + rep.busIDLen; rep.nameLen <<=2; rep.busIDLen <<=2; /* * Read back to the client what she has put in the shared memory * segment she prepared for us. */ rep.isLocal = 1; #ifdef HAS_XVMCSHM patternP = (CARD32 *)shmat( stuff->shmKey, NULL, SHM_RDONLY ); if ( -1 != (long) patternP) { register volatile CARD32 *patternC = patternP; register int i; CARD32 magic = stuff->magic; rep.isLocal = 1; i = 1024 / sizeof(CARD32); while ( i-- ) { if (*patternC++ != magic) { rep.isLocal = 0; break; } magic = ~magic; } shmdt( (char *)patternP ); } #endif /* HAS_XVMCSHM */ WriteToClient(client, sizeof(xvmcGetDRInfoReply), &rep); if (rep.length) { WriteToClient(client, rep.nameLen, pScreenPriv->clientDriverName); WriteToClient(client, rep.busIDLen, pScreenPriv->busID); } return Success; } int (*ProcXvMCVector[xvmcNumRequest])(ClientPtr) = { ProcXvMCQueryVersion, ProcXvMCListSurfaceTypes, ProcXvMCCreateContext, ProcXvMCDestroyContext, ProcXvMCCreateSurface, ProcXvMCDestroySurface, ProcXvMCCreateSubpicture, ProcXvMCDestroySubpicture, ProcXvMCListSubpictureTypes, ProcXvMCGetDRInfo }; static int ProcXvMCDispatch (ClientPtr client) { REQUEST(xReq); if(stuff->data < xvmcNumRequest) return (*ProcXvMCVector[stuff->data])(client); else return BadRequest; } static int SProcXvMCDispatch (ClientPtr client) { /* We only support local */ return BadImplementation; } void XvMCExtensionInit(void) { ExtensionEntry *extEntry; if(XvMCScreenIndex < 0) /* nobody supports it */ return; if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes))) return; if(!(XvMCRTSurface = CreateNewResourceType(XvMCDestroySurfaceRes))) return; if(!(XvMCRTSubpicture = CreateNewResourceType(XvMCDestroySubpictureRes))) return; extEntry = AddExtension(XvMCName, XvMCNumEvents, XvMCNumErrors, ProcXvMCDispatch, SProcXvMCDispatch, XvMCResetProc, StandardMinorOpcode); if(!extEntry) return; XvMCReqCode = extEntry->base; XvMCEventBase = extEntry->eventBase; XvMCErrorBase = extEntry->errorBase; } static Bool XvMCCloseScreen (ScreenPtr pScreen) { XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; free(pScreenPriv); return (*pScreen->CloseScreen)(pScreen); } int XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt) { XvMCScreenPtr pScreenPriv; if(XvMCGeneration != serverGeneration) { if((XvMCScreenIndex = AllocateScreenPrivateIndex()) < 0) return BadAlloc; XvMCGeneration = serverGeneration; } if(!(pScreenPriv = (XvMCScreenPtr)malloc(sizeof(XvMCScreenRec)))) return BadAlloc; pScreen->devPrivates[XvMCScreenIndex].ptr = (void *)pScreenPriv; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = XvMCCloseScreen; pScreenPriv->num_adaptors = num; pScreenPriv->adaptors = pAdapt; pScreenPriv->clientDriverName[0] = 0; pScreenPriv->busID[0] = 0; pScreenPriv->major = 0; pScreenPriv->minor = 0; pScreenPriv->patchLevel = 0; return Success; } XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id) { XvImagePtr pImage = NULL; ScreenPtr pScreen = pPort->pAdaptor->pScreen; XvMCScreenPtr pScreenPriv; XvMCAdaptorPtr adaptor = NULL; int i; if(XvMCScreenIndex < 0) return NULL; if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) return NULL; for(i = 0; i < pScreenPriv->num_adaptors; i++) { if(pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) { adaptor = &(pScreenPriv->adaptors[i]); break; } } if(!adaptor) return NULL; for(i = 0; i < adaptor->num_subpictures; i++) { if(adaptor->subpictures[i]->id == id) { pImage = adaptor->subpictures[i]; break; } } return pImage; } int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name, char *busID, int major, int minor, int patchLevel) { XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen); strncpy(pScreenPriv->clientDriverName, name, DR_CLIENT_DRIVER_NAME_SIZE); strncpy(pScreenPriv->busID, busID, DR_BUSID_SIZE); pScreenPriv->major = major; pScreenPriv->minor = minor; pScreenPriv->patchLevel = patchLevel; pScreenPriv->clientDriverName[DR_CLIENT_DRIVER_NAME_SIZE-1] = 0; pScreenPriv->busID[DR_BUSID_SIZE-1] = 0; return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xext/xvmcext.h0000644000000000000000000000502013614532331017367 0ustar #ifndef _XVMC_H #define _XVMC_H #include #include "xvdix.h" typedef struct { int num_xvimages; int *xvimage_ids; } XvMCImageIDList; typedef struct { int surface_type_id; int chroma_format; int color_description; unsigned short max_width; unsigned short max_height; unsigned short subpicture_max_width; unsigned short subpicture_max_height; int mc_type; int flags; XvMCImageIDList *compatible_subpictures; } XvMCSurfaceInfoRec, *XvMCSurfaceInfoPtr; typedef struct { XID context_id; ScreenPtr pScreen; int adapt_num; int surface_type_id; unsigned short width; unsigned short height; CARD32 flags; int refcnt; void * port_priv; void * driver_priv; } XvMCContextRec, *XvMCContextPtr; typedef struct { XID surface_id; int surface_type_id; XvMCContextPtr context; void * driver_priv; } XvMCSurfaceRec, *XvMCSurfacePtr; typedef struct { XID subpicture_id; int xvimage_id; unsigned short width; unsigned short height; int num_palette_entries; int entry_bytes; char component_order[4]; XvMCContextPtr context; void * driver_priv; } XvMCSubpictureRec, *XvMCSubpicturePtr; typedef int (*XvMCCreateContextProcPtr) ( XvPortPtr port, XvMCContextPtr context, int *num_priv, CARD32 **priv ); typedef void (*XvMCDestroyContextProcPtr) ( XvMCContextPtr context ); typedef int (*XvMCCreateSurfaceProcPtr) ( XvMCSurfacePtr surface, int *num_priv, CARD32 **priv ); typedef void (*XvMCDestroySurfaceProcPtr) ( XvMCSurfacePtr surface ); typedef int (*XvMCCreateSubpictureProcPtr) ( XvMCSubpicturePtr subpicture, int *num_priv, CARD32 **priv ); typedef void (*XvMCDestroySubpictureProcPtr) ( XvMCSubpicturePtr subpicture ); typedef struct { XvAdaptorPtr xv_adaptor; int num_surfaces; XvMCSurfaceInfoPtr *surfaces; int num_subpictures; XvImagePtr *subpictures; XvMCCreateContextProcPtr CreateContext; XvMCDestroyContextProcPtr DestroyContext; XvMCCreateSurfaceProcPtr CreateSurface; XvMCDestroySurfaceProcPtr DestroySurface; XvMCCreateSubpictureProcPtr CreateSubpicture; XvMCDestroySubpictureProcPtr DestroySubpicture; } XvMCAdaptorRec, *XvMCAdaptorPtr; void XvMCExtensionInit(void); int XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr adapt); XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id); int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name, char *busID, int major, int minor, int patchLevel); #endif /* _XVMC_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/xfixes/cursor.c0000644000000000000000000006343513614532331017575 0ustar /* * Copyright © 2006 Sun Microsystems * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Sun Microsystems not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Sun Microsystems makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * Copyright © 2002 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "xfixesint.h" #include "scrnintstr.h" #include "cursorstr.h" #include "dixevents.h" #include "servermd.h" #include "inputstr.h" #include "windowstr.h" static RESTYPE CursorClientType; static RESTYPE CursorHideCountType; static RESTYPE CursorWindowType; static int CursorScreenPrivateIndex = -1; static int CursorGeneration; static CursorPtr CursorCurrent; static CursorPtr pInvisibleCursor = NULL; static void deleteCursorHideCountsForScreen (ScreenPtr pScreen); #define VERIFY_CURSOR(pCursor, cursor, client, access) { \ pCursor = (CursorPtr)SecurityLookupIDByType((client), (cursor), \ RT_CURSOR, (access)); \ if (!pCursor) { \ (client)->errorValue = (cursor); \ return BadCursor; \ } \ } /* * There is a global list of windows selecting for cursor events */ typedef struct _CursorEvent *CursorEventPtr; typedef struct _CursorEvent { CursorEventPtr next; CARD32 eventMask; ClientPtr pClient; WindowPtr pWindow; XID clientResource; } CursorEventRec; static CursorEventPtr cursorEvents; /* * Each screen has a list of clients which have requested * that the cursor be hid, and the number of times each * client has requested. */ typedef struct _CursorHideCountRec *CursorHideCountPtr; typedef struct _CursorHideCountRec { CursorHideCountPtr pNext; ClientPtr pClient; ScreenPtr pScreen; int hideCount; XID resource; } CursorHideCountRec; /* * Wrap DisplayCursor to catch cursor change events */ typedef struct _CursorScreen { DisplayCursorProcPtr DisplayCursor; CloseScreenProcPtr CloseScreen; CursorHideCountPtr pCursorHideCounts; } CursorScreenRec, *CursorScreenPtr; #define GetCursorScreen(s) ((CursorScreenPtr) ((s)->devPrivates[CursorScreenPrivateIndex].ptr)) #define GetCursorScreenIfSet(s) ((CursorScreenPrivateIndex != -1) ? GetCursorScreen(s) : NULL) #define SetCursorScreen(s,p) ((s)->devPrivates[CursorScreenPrivateIndex].ptr = (void *) (p)) #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func) #define Unwrap(as,s,elt) ((s)->elt = (as)->elt) static Bool CursorDisplayCursor (ScreenPtr pScreen, CursorPtr pCursor) { CursorScreenPtr cs = GetCursorScreen(pScreen); Bool ret; Unwrap (cs, pScreen, DisplayCursor); if (cs->pCursorHideCounts != NULL) { ret = (*pScreen->DisplayCursor) (pScreen, pInvisibleCursor); } else { ret = (*pScreen->DisplayCursor) (pScreen, pCursor); } if (pCursor != CursorCurrent) { CursorEventPtr e; CursorCurrent = pCursor; for (e = cursorEvents; e; e = e->next) { if (e->eventMask & XFixesDisplayCursorNotifyMask) { xXFixesCursorNotifyEvent ev; ev.type = XFixesEventBase + XFixesCursorNotify; ev.subtype = XFixesDisplayCursorNotify; ev.window = e->pWindow->drawable.id; ev.cursorSerial = pCursor->serialNumber; ev.timestamp = currentTime.milliseconds; ev.name = pCursor->name; WriteEventsToClient (e->pClient, 1, (xEvent *) &ev); } } } Wrap (cs, pScreen, DisplayCursor, CursorDisplayCursor); return ret; } static Bool CursorCloseScreen (ScreenPtr pScreen) { CursorScreenPtr cs = GetCursorScreen (pScreen); Bool ret; Unwrap (cs, pScreen, CloseScreen); Unwrap (cs, pScreen, DisplayCursor); deleteCursorHideCountsForScreen(pScreen); ret = (*pScreen->CloseScreen) (pScreen); free (cs); if (screenInfo.numScreens <= 1) CursorScreenPrivateIndex = -1; return ret; } #define CursorAllEvents (XFixesDisplayCursorNotifyMask) static int XFixesSelectCursorInput (ClientPtr pClient, WindowPtr pWindow, CARD32 eventMask) { CursorEventPtr *prev, e; for (prev = &cursorEvents; (e = *prev); prev = &e->next) { if (e->pClient == pClient && e->pWindow == pWindow) { break; } } if (!eventMask) { if (e) { FreeResource (e->clientResource, 0); } return Success; } if (!e) { e = (CursorEventPtr) calloc (1, sizeof (CursorEventRec)); if (!e) return BadAlloc; e->next = 0; e->pClient = pClient; e->pWindow = pWindow; e->clientResource = FakeClientID(pClient->index); /* * Add a resource hanging from the window to * catch window destroy */ if (!LookupIDByType(pWindow->drawable.id, CursorWindowType)) if (!AddResource (pWindow->drawable.id, CursorWindowType, (void *) pWindow)) { free (e); return BadAlloc; } if (!AddResource (e->clientResource, CursorClientType, (void *) e)) return BadAlloc; *prev = e; } e->eventMask = eventMask; return Success; } int ProcXFixesSelectCursorInput (ClientPtr client) { REQUEST (xXFixesSelectCursorInputReq); WindowPtr pWin; #ifndef NXAGENT_SERVER int rc; #endif REQUEST_SIZE_MATCH (xXFixesSelectCursorInputReq); #ifndef NXAGENT_SERVER rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); if (rc != Success) return rc; #else pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixReadAccess); if (!pWin) return(BadWindow); #endif if (stuff->eventMask & ~CursorAllEvents) { client->errorValue = stuff->eventMask; return( BadValue ); } return XFixesSelectCursorInput (client, pWin, stuff->eventMask); } static int GetBit (unsigned char *line, int x) { unsigned char mask; if (screenInfo.bitmapBitOrder == LSBFirst) mask = (1 << (x & 7)); else mask = (0x80 >> (x & 7)); /* XXX assumes byte order is host byte order */ line += (x >> 3); if (*line & mask) return 1; return 0; } int SProcXFixesSelectCursorInput (ClientPtr client) { REQUEST(xXFixesSelectCursorInputReq); swaps(&stuff->length); swapl(&stuff->window); swapl(&stuff->eventMask); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } void SXFixesCursorNotifyEvent (xXFixesCursorNotifyEvent *from, xXFixesCursorNotifyEvent *to) { to->type = from->type; cpswaps (from->sequenceNumber, to->sequenceNumber); cpswapl (from->window, to->window); cpswapl (from->cursorSerial, to->cursorSerial); cpswapl (from->timestamp, to->timestamp); cpswapl (from->name, to->name); } static void CopyCursorToImage (CursorPtr pCursor, CARD32 *image) { int width = pCursor->bits->width; int height = pCursor->bits->height; int npixels = width * height; #ifdef ARGB_CURSOR if (pCursor->bits->argb) memcpy (image, pCursor->bits->argb, npixels * sizeof (CARD32)); else #endif { unsigned char *srcLine = pCursor->bits->source; unsigned char *mskLine = pCursor->bits->mask; int stride = BitmapBytePad (width); int x, y; CARD32 fg, bg; fg = (0xff000000 | ((pCursor->foreRed & 0xff00) << 8) | (pCursor->foreGreen & 0xff00) | (pCursor->foreBlue >> 8)); bg = (0xff000000 | ((pCursor->backRed & 0xff00) << 8) | (pCursor->backGreen & 0xff00) | (pCursor->backBlue >> 8)); for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { if (GetBit (mskLine, x)) { if (GetBit (srcLine, x)) *image++ = fg; else *image++ = bg; } else *image++ = 0; } srcLine += stride; mskLine += stride; } } } int ProcXFixesGetCursorImage (ClientPtr client) { /* REQUEST(xXFixesGetCursorImageReq); */ xXFixesGetCursorImageReply *rep; CursorPtr pCursor; CARD32 *image; int npixels; int width, height; int x, y; REQUEST_SIZE_MATCH(xXFixesGetCursorImageReq); pCursor = CursorCurrent; if (!pCursor) return BadCursor; GetSpritePosition (&x, &y); width = pCursor->bits->width; height = pCursor->bits->height; npixels = width * height; rep = calloc (sizeof (xXFixesGetCursorImageReply) + npixels * sizeof (CARD32), 1); if (!rep) return BadAlloc; rep->type = X_Reply; rep->sequenceNumber = client->sequence; rep->length = npixels; rep->width = width; rep->height = height; rep->x = x; rep->y = y; rep->xhot = pCursor->bits->xhot; rep->yhot = pCursor->bits->yhot; rep->cursorSerial = pCursor->serialNumber; image = (CARD32 *) (rep + 1); CopyCursorToImage(pCursor, image); if (client->swapped) { swaps(&rep->sequenceNumber); swapl(&rep->length); swaps(&rep->x); swaps(&rep->y); swaps(&rep->width); swaps(&rep->height); swaps(&rep->xhot); swaps(&rep->yhot); swapl(&rep->cursorSerial); SwapLongs(image, npixels); } WriteToClient(client, sizeof (xXFixesGetCursorImageReply) + (npixels << 2), (char *) rep); free (rep); return client->noClientException; } int SProcXFixesGetCursorImage (ClientPtr client) { REQUEST(xXFixesGetCursorImageReq); swaps(&stuff->length); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesSetCursorName (ClientPtr client) { CursorPtr pCursor; char *tchar; REQUEST(xXFixesSetCursorNameReq); Atom atom; REQUEST_AT_LEAST_SIZE(xXFixesSetCursorNameReq); VERIFY_CURSOR(pCursor, stuff->cursor, client, DixWriteAccess); tchar = (char *) &stuff[1]; atom = MakeAtom (tchar, stuff->nbytes, TRUE); if (atom == BAD_RESOURCE) return BadAlloc; pCursor->name = atom; return(client->noClientException); } int SProcXFixesSetCursorName (ClientPtr client) { REQUEST(xXFixesSetCursorNameReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xXFixesSetCursorNameReq); swapl(&stuff->cursor); swaps(&stuff->nbytes); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesGetCursorName (ClientPtr client) { CursorPtr pCursor; xXFixesGetCursorNameReply reply; REQUEST(xXFixesGetCursorNameReq); const char *str; int len; REQUEST_SIZE_MATCH(xXFixesGetCursorNameReq); VERIFY_CURSOR(pCursor, stuff->cursor, client, DixReadAccess); if (pCursor->name) str = NameForAtom (pCursor->name); else str = ""; len = strlen (str); reply = (xXFixesGetCursorNameReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = (len + 3) >> 2, .atom = pCursor->name, .nbytes = len }; if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); swapl(&reply.atom); swaps(&reply.nbytes); } WriteReplyToClient(client, sizeof(xXFixesGetCursorNameReply), &reply); WriteToClient(client, len, str); return(client->noClientException); } int SProcXFixesGetCursorName (ClientPtr client) { REQUEST(xXFixesSetCursorNameReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesGetCursorNameReq); swapl(&stuff->cursor); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesGetCursorImageAndName (ClientPtr client) { /* REQUEST(xXFixesGetCursorImageAndNameReq); */ xXFixesGetCursorImageAndNameReply *rep; CursorPtr pCursor; CARD32 *image; int npixels; const char *name; int nbytes, nbytesRound; int width, height; int x, y; REQUEST_SIZE_MATCH(xXFixesGetCursorImageAndNameReq); pCursor = CursorCurrent; if (!pCursor) return BadCursor; GetSpritePosition (&x, &y); width = pCursor->bits->width; height = pCursor->bits->height; npixels = width * height; name = pCursor->name ? NameForAtom (pCursor->name) : ""; nbytes = strlen (name); nbytesRound = (nbytes + 3) & ~3; rep = calloc (sizeof (xXFixesGetCursorImageAndNameReply) + npixels * sizeof (CARD32) + nbytesRound, 1); if (!rep) return BadAlloc; rep->type = X_Reply; rep->sequenceNumber = client->sequence; rep->length = npixels + (nbytesRound >> 2); rep->width = width; rep->height = height; rep->x = x; rep->y = y; rep->xhot = pCursor->bits->xhot; rep->yhot = pCursor->bits->yhot; rep->cursorSerial = pCursor->serialNumber; rep->cursorName = pCursor->name; rep->nbytes = nbytes; image = (CARD32 *) (rep + 1); CopyCursorToImage(pCursor, image); memcpy((image + npixels), name, nbytes); if (client->swapped) { swaps(&rep->sequenceNumber); swapl(&rep->length); swaps(&rep->x); swaps(&rep->y); swaps(&rep->width); swaps(&rep->height); swaps(&rep->xhot); swaps(&rep->yhot); swapl(&rep->cursorSerial); swapl(&rep->cursorName); swaps(&rep->nbytes); SwapLongs(image, npixels); } WriteToClient(client, sizeof (xXFixesGetCursorImageAndNameReply) + (npixels << 2) + nbytesRound, (char *) rep); free (rep); return client->noClientException; } int SProcXFixesGetCursorImageAndName (ClientPtr client) { REQUEST(xXFixesGetCursorImageAndNameReq); swaps(&stuff->length); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } /* * Find every cursor reference in the system, ask testCursor * whether it should be replaced with a reference to pCursor. */ typedef Bool (*TestCursorFunc) (CursorPtr pOld, void * closure); typedef struct { RESTYPE type; TestCursorFunc testCursor; CursorPtr pNew; void * closure; } ReplaceCursorLookupRec, *ReplaceCursorLookupPtr; static const RESTYPE CursorRestypes[] = { RT_WINDOW, RT_PASSIVEGRAB, RT_CURSOR }; #define NUM_CURSOR_RESTYPES (sizeof (CursorRestypes) / sizeof (CursorRestypes[0])) static Bool ReplaceCursorLookup (void * value, XID id, void * closure) { ReplaceCursorLookupPtr rcl = (ReplaceCursorLookupPtr) closure; WindowPtr pWin; GrabPtr pGrab; CursorPtr pCursor = 0, *pCursorRef = 0; XID cursor = 0; switch (rcl->type) { case RT_WINDOW: pWin = (WindowPtr) value; if (pWin->optional) { pCursorRef = &pWin->optional->cursor; pCursor = *pCursorRef; } break; case RT_PASSIVEGRAB: pGrab = (GrabPtr) value; pCursorRef = &pGrab->cursor; pCursor = *pCursorRef; break; case RT_CURSOR: pCursorRef = 0; pCursor = (CursorPtr) value; cursor = id; break; } if (pCursor && pCursor != rcl->pNew) { if ((*rcl->testCursor) (pCursor, rcl->closure)) { rcl->pNew->refcnt++; /* either redirect reference or update resource database */ if (pCursorRef) *pCursorRef = rcl->pNew; else ChangeResourceValue (id, RT_CURSOR, rcl->pNew); FreeCursor (pCursor, cursor); } } return FALSE; /* keep walking */ } static void ReplaceCursor (CursorPtr pCursor, TestCursorFunc testCursor, void * closure) { int clientIndex; int resIndex; ReplaceCursorLookupRec rcl; /* * Cursors exist only in the resource database, windows and grabs. * All of these are always pointed at by the resource database. Walk * the whole thing looking for cursors */ rcl.testCursor = testCursor; rcl.pNew = pCursor; rcl.closure = closure; /* for each client */ for (clientIndex = 0; clientIndex < currentMaxClients; clientIndex++) { if (!clients[clientIndex]) continue; for (resIndex = 0; resIndex < NUM_CURSOR_RESTYPES; resIndex++) { rcl.type = CursorRestypes[resIndex]; /* * This function walks the entire client resource database */ LookupClientResourceComplex (clients[clientIndex], rcl.type, ReplaceCursorLookup, (void *) &rcl); } } /* this "knows" that WindowHasNewCursor doesn't depend on it's argument */ WindowHasNewCursor (screenInfo.screens[0]->root); } static Bool TestForCursor (CursorPtr pCursor, void * closure) { return (pCursor == (CursorPtr) closure); } int ProcXFixesChangeCursor (ClientPtr client) { CursorPtr pSource, pDestination; REQUEST(xXFixesChangeCursorReq); REQUEST_SIZE_MATCH(xXFixesChangeCursorReq); VERIFY_CURSOR (pSource, stuff->source, client, DixReadAccess); VERIFY_CURSOR (pDestination, stuff->destination, client, DixWriteAccess); ReplaceCursor (pSource, TestForCursor, (void *) pDestination); return (client->noClientException); } int SProcXFixesChangeCursor (ClientPtr client) { REQUEST(xXFixesChangeCursorReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesChangeCursorReq); swapl(&stuff->source); swapl(&stuff->destination); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } static Bool TestForCursorName (CursorPtr pCursor, void * closure) { Atom *pName = closure; return (pCursor->name == *pName); } int ProcXFixesChangeCursorByName (ClientPtr client) { CursorPtr pSource; Atom name; char *tchar; REQUEST(xXFixesChangeCursorByNameReq); REQUEST_FIXED_SIZE(xXFixesChangeCursorByNameReq, stuff->nbytes); VERIFY_CURSOR(pSource, stuff->source, client, DixReadAccess); tchar = (char *) &stuff[1]; name = MakeAtom (tchar, stuff->nbytes, FALSE); if (name) ReplaceCursor (pSource, TestForCursorName, &name); return (client->noClientException); } int SProcXFixesChangeCursorByName (ClientPtr client) { REQUEST(xXFixesChangeCursorByNameReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xXFixesChangeCursorByNameReq); swapl(&stuff->source); swaps(&stuff->nbytes); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } /* * Routines for manipulating the per-screen hide counts list. * This list indicates which clients have requested cursor hiding * for that screen. */ /* Return the screen's hide-counts list element for the given client */ static CursorHideCountPtr findCursorHideCount (ClientPtr pClient, ScreenPtr pScreen) { CursorScreenPtr cs = GetCursorScreen(pScreen); CursorHideCountPtr pChc; for (pChc = cs->pCursorHideCounts; pChc != NULL; pChc = pChc->pNext) { if (pChc->pClient == pClient) { return pChc; } } return NULL; } static int createCursorHideCount (ClientPtr pClient, ScreenPtr pScreen) { CursorScreenPtr cs = GetCursorScreen(pScreen); CursorHideCountPtr pChc; pChc = (CursorHideCountPtr) calloc(1, sizeof(CursorHideCountRec)); if (pChc == NULL) { return BadAlloc; } pChc->pClient = pClient; pChc->pScreen = pScreen; pChc->hideCount = 1; pChc->resource = FakeClientID(pClient->index); pChc->pNext = cs->pCursorHideCounts; cs->pCursorHideCounts = pChc; /* * Create a resource for this element so it can be deleted * when the client goes away. */ if (!AddResource (pChc->resource, CursorHideCountType, (void *) pChc)) { free(pChc); return BadAlloc; } return Success; } /* * Delete the given hide-counts list element from its screen list. */ static void deleteCursorHideCount (CursorHideCountPtr pChcToDel, ScreenPtr pScreen) { CursorScreenPtr cs = GetCursorScreen(pScreen); CursorHideCountPtr pChc, pNext; CursorHideCountPtr pChcLast = NULL; pChc = cs->pCursorHideCounts; while (pChc != NULL) { pNext = pChc->pNext; if (pChc == pChcToDel) { free(pChc); if (pChcLast == NULL) { cs->pCursorHideCounts = pNext; } else { pChcLast->pNext = pNext; } return; } pChcLast = pChc; pChc = pNext; } } /* * Delete all the hide-counts list elements for this screen. */ static void deleteCursorHideCountsForScreen (ScreenPtr pScreen) { CursorScreenPtr cs = GetCursorScreen(pScreen); CursorHideCountPtr pChc, pTmp; pChc = cs->pCursorHideCounts; while (pChc != NULL) { pTmp = pChc->pNext; FreeResource(pChc->resource, 0); pChc = pTmp; } cs->pCursorHideCounts = NULL; } int ProcXFixesHideCursor (ClientPtr client) { WindowPtr pWin; CursorHideCountPtr pChc; REQUEST(xXFixesHideCursorReq); int ret; REQUEST_SIZE_MATCH (xXFixesHideCursorReq); pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); if (!pWin) { client->errorValue = stuff->window; return BadWindow; } /* * Has client hidden the cursor before on this screen? * If so, just increment the count. */ pChc = findCursorHideCount(client, pWin->drawable.pScreen); if (pChc != NULL) { pChc->hideCount++; return client->noClientException; } /* * This is the first time this client has hid the cursor * for this screen. */ ret = createCursorHideCount(client, pWin->drawable.pScreen); if (ret == Success) { (void) CursorDisplayCursor(pWin->drawable.pScreen, CursorCurrent); } return ret; } int SProcXFixesHideCursor (ClientPtr client) { REQUEST(xXFixesHideCursorReq); swaps (&stuff->length); REQUEST_SIZE_MATCH (xXFixesHideCursorReq); swapl (&stuff->window); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesShowCursor (ClientPtr client) { WindowPtr pWin; CursorHideCountPtr pChc; REQUEST(xXFixesShowCursorReq); REQUEST_SIZE_MATCH (xXFixesShowCursorReq); pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); if (!pWin) { client->errorValue = stuff->window; return BadWindow; } /* * Has client hidden the cursor on this screen? * If not, generate an error. */ pChc = findCursorHideCount(client, pWin->drawable.pScreen); if (pChc == NULL) { return BadMatch; } pChc->hideCount--; if (pChc->hideCount <= 0) { FreeResource(pChc->resource, 0); } return (client->noClientException); } int SProcXFixesShowCursor (ClientPtr client) { REQUEST(xXFixesShowCursorReq); swaps (&stuff->length); REQUEST_SIZE_MATCH (xXFixesShowCursorReq); swapl (&stuff->window); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } static int CursorFreeClient (void * data, XID id) { CursorEventPtr old = (CursorEventPtr) data; CursorEventPtr *prev, e; for (prev = &cursorEvents; (e = *prev); prev = &e->next) { if (e == old) { *prev = e->next; free (e); break; } } return 1; } static int CursorFreeHideCount (void * data, XID id) { CursorHideCountPtr pChc = (CursorHideCountPtr) data; ScreenPtr pScreen = pChc->pScreen; deleteCursorHideCount(pChc, pChc->pScreen); (void) CursorDisplayCursor(pScreen, CursorCurrent); return 1; } static int CursorFreeWindow (void * data, XID id) { WindowPtr pWindow = (WindowPtr) data; CursorEventPtr e, next; for (e = cursorEvents; e; e = next) { next = e->next; if (e->pWindow == pWindow) { FreeResource (e->clientResource, 0); } } return 1; } static CursorPtr createInvisibleCursor (void) { CursorPtr pCursor; static unsigned int *psrcbits, *pmaskbits; CursorMetricRec cm; psrcbits = (unsigned int *) malloc(4); pmaskbits = (unsigned int *) malloc(4); if (psrcbits == NULL || pmaskbits == NULL) { return NULL; } *psrcbits = 0; *pmaskbits = 0; cm.width = 1; cm.height = 1; cm.xhot = 0; cm.yhot = 0; pCursor = AllocCursor( (unsigned char *)psrcbits, (unsigned char *)pmaskbits, &cm, 0, 0, 0, 0, 0, 0); return pCursor; } Bool XFixesCursorInit (void) { int i; if (CursorGeneration != serverGeneration) { CursorScreenPrivateIndex = AllocateScreenPrivateIndex (); if (CursorScreenPrivateIndex < 0) return FALSE; CursorGeneration = serverGeneration; } for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; CursorScreenPtr cs; cs = (CursorScreenPtr) malloc (sizeof (CursorScreenRec)); if (!cs) return FALSE; Wrap (cs, pScreen, CloseScreen, CursorCloseScreen); Wrap (cs, pScreen, DisplayCursor, CursorDisplayCursor); cs->pCursorHideCounts = NULL; SetCursorScreen (pScreen, cs); } CursorClientType = CreateNewResourceType(CursorFreeClient); CursorHideCountType = CreateNewResourceType(CursorFreeHideCount); CursorWindowType = CreateNewResourceType(CursorFreeWindow); if (pInvisibleCursor == NULL) { pInvisibleCursor = createInvisibleCursor(); if (pInvisibleCursor == NULL) { return BadAlloc; } } return CursorClientType && CursorWindowType; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xfixes/Imakefile0000644000000000000000000000121513614532331017711 0ustar #include NULL = SRCS = cursor.c region.c saveset.c select.c xfixes.c OBJS = cursor.o region.o saveset.o select.o xfixes.o INCLUDES = -I. -I../include -I../Xext -I../fixes -I../render \ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln #if defined(NXAgentServer) && NXAgentServer NX_DEFINES = -DNXAGENT_SERVER #endif DEFINES = \ $(NX_DEFINES) \ $(NULL) NormalLibraryTarget(xfixes,$(OBJS)) NormalLibraryObjectRule() LintLibraryTarget(xfixes,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() nx-libs-3.5.99.23/nx-X11/programs/Xserver/xfixes/region.c0000644000000000000000000005173613614532331017544 0ustar /* * Copyright © 2003 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "xfixesint.h" #include "scrnintstr.h" #ifdef RENDER #include extern int RenderErrBase; #endif #include #include #include RESTYPE RegionResType; static int RegionResFree (void * data, XID id) { RegionPtr pRegion = (RegionPtr) data; RegionDestroy(pRegion); return Success; } RegionPtr XFixesRegionCopy (RegionPtr pRegion) { RegionPtr pNew = RegionCreate(RegionExtents(pRegion), RegionNumRects(pRegion)); if (!pNew) return 0; if (!RegionCopy(pNew, pRegion)) { RegionDestroy(pNew); return 0; } return pNew; } Bool XFixesRegionInit (void) { RegionResType = CreateNewResourceType(RegionResFree); return TRUE; } int ProcXFixesCreateRegion (ClientPtr client) { int things; RegionPtr pRegion; REQUEST (xXFixesCreateRegionReq); REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq); LEGAL_NEW_RESOURCE (stuff->region, client); things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq); if (things & 4) return BadLength; things >>= 3; pRegion = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED); if (!pRegion) return BadAlloc; if (!AddResource (stuff->region, RegionResType, (void *) pRegion)) return BadAlloc; return(client->noClientException); } int SProcXFixesCreateRegion (ClientPtr client) { REQUEST(xXFixesCreateRegionReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq); swapl(&stuff->region); SwapRestS(stuff); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesCreateRegionFromBitmap (ClientPtr client) { RegionPtr pRegion; PixmapPtr pPixmap; REQUEST (xXFixesCreateRegionFromBitmapReq); REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq); LEGAL_NEW_RESOURCE (stuff->region, client); pPixmap = (PixmapPtr) SecurityLookupIDByType (client, stuff->bitmap, RT_PIXMAP, DixReadAccess); if (!pPixmap) { client->errorValue = stuff->bitmap; return BadPixmap; } if (pPixmap->drawable.depth != 1) return BadMatch; pRegion = BitmapToRegion(pPixmap->drawable.pScreen, pPixmap); if (!pRegion) return BadAlloc; if (!AddResource (stuff->region, RegionResType, (void *) pRegion)) return BadAlloc; return(client->noClientException); } int SProcXFixesCreateRegionFromBitmap (ClientPtr client) { REQUEST(xXFixesCreateRegionFromBitmapReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq); swapl(&stuff->region); swapl(&stuff->bitmap); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesCreateRegionFromWindow (ClientPtr client) { RegionPtr pRegion; Bool copy = TRUE; WindowPtr pWin; REQUEST (xXFixesCreateRegionFromWindowReq); REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq); LEGAL_NEW_RESOURCE (stuff->region, client); pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); if (!pWin) { client->errorValue = stuff->window; return BadWindow; } switch (stuff->kind) { case WindowRegionBounding: #ifdef SHAPE pRegion = wBoundingShape(pWin); if (!pRegion) #endif { pRegion = CreateBoundingShape (pWin); copy = FALSE; } break; case WindowRegionClip: #ifdef SHAPE pRegion = wClipShape(pWin); if (!pRegion) #endif { pRegion = CreateClipShape (pWin); copy = FALSE; } break; default: client->errorValue = stuff->kind; return BadValue; } if (copy && pRegion) pRegion = XFixesRegionCopy (pRegion); if (!pRegion) return BadAlloc; if (!AddResource (stuff->region, RegionResType, (void *) pRegion)) return BadAlloc; return(client->noClientException); } int SProcXFixesCreateRegionFromWindow (ClientPtr client) { REQUEST(xXFixesCreateRegionFromWindowReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq); swapl(&stuff->region); swapl(&stuff->window); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesCreateRegionFromGC (ClientPtr client) { RegionPtr pRegion, pClip; GCPtr pGC; #ifndef NXAGENT_SERVER int rc; #endif REQUEST (xXFixesCreateRegionFromGCReq); REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq); LEGAL_NEW_RESOURCE (stuff->region, client); #ifndef NXAGENT_SERVER rc = dixLookupGC(&pGC, stuff->gc, client, DixReadAccess); if (rc != Success) return rc; #else SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixReadAccess); #endif switch (pGC->clientClipType) { case CT_PIXMAP: pRegion = BitmapToRegion(pGC->pScreen, (PixmapPtr) pGC->clientClip); if (!pRegion) return BadAlloc; break; case CT_REGION: pClip = (RegionPtr) pGC->clientClip; pRegion = XFixesRegionCopy (pClip); if (!pRegion) return BadAlloc; break; default: return BadImplementation; /* assume sane server bits */ } if (!AddResource (stuff->region, RegionResType, (void *) pRegion)) return BadAlloc; return(client->noClientException); } int SProcXFixesCreateRegionFromGC (ClientPtr client) { REQUEST(xXFixesCreateRegionFromGCReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesCreateRegionFromGCReq); swapl(&stuff->region); swapl(&stuff->gc); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesCreateRegionFromPicture (ClientPtr client) { #ifdef RENDER RegionPtr pRegion; PicturePtr pPicture; REQUEST (xXFixesCreateRegionFromPictureReq); REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq); LEGAL_NEW_RESOURCE (stuff->region, client); VERIFY_PICTURE(pPicture, stuff->picture, client, DixReadAccess, RenderErrBase + BadPicture); switch (pPicture->clientClipType) { case CT_PIXMAP: pRegion = BitmapToRegion(pPicture->pDrawable->pScreen, (PixmapPtr) pPicture->clientClip); if (!pRegion) return BadAlloc; break; case CT_REGION: pRegion = XFixesRegionCopy ((RegionPtr) pPicture->clientClip); if (!pRegion) return BadAlloc; break; default: return BadImplementation; /* assume sane server bits */ } if (!AddResource (stuff->region, RegionResType, (void *) pRegion)) return BadAlloc; return(client->noClientException); #else return BadRequest; #endif } int SProcXFixesCreateRegionFromPicture (ClientPtr client) { REQUEST(xXFixesCreateRegionFromPictureReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesCreateRegionFromPictureReq); swapl(&stuff->region); swapl(&stuff->picture); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesDestroyRegion (ClientPtr client) { REQUEST (xXFixesDestroyRegionReq); RegionPtr pRegion; REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq); VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); FreeResource (stuff->region, RT_NONE); return(client->noClientException); } int SProcXFixesDestroyRegion (ClientPtr client) { REQUEST(xXFixesDestroyRegionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq); swapl(&stuff->region); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesSetRegion (ClientPtr client) { int things; RegionPtr pRegion, pNew; REQUEST (xXFixesSetRegionReq); REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq); VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq); if (things & 4) return BadLength; things >>= 3; pNew = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED); if (!pNew) return BadAlloc; if (!RegionCopy(pRegion, pNew)) { RegionDestroy(pNew); return BadAlloc; } RegionDestroy(pNew); return(client->noClientException); } int SProcXFixesSetRegion (ClientPtr client) { REQUEST(xXFixesSetRegionReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq); swapl(&stuff->region); SwapRestS(stuff); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesCopyRegion (ClientPtr client) { RegionPtr pSource, pDestination; REQUEST (xXFixesCopyRegionReq); VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); if (!RegionCopy(pDestination, pSource)) return BadAlloc; return(client->noClientException); } int SProcXFixesCopyRegion (ClientPtr client) { REQUEST(xXFixesCopyRegionReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xXFixesCopyRegionReq); swapl(&stuff->source); swapl(&stuff->destination); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesCombineRegion (ClientPtr client) { RegionPtr pSource1, pSource2, pDestination; int ret = Success; REQUEST (xXFixesCombineRegionReq); REQUEST_SIZE_MATCH (xXFixesCombineRegionReq); VERIFY_REGION(pSource1, stuff->source1, client, DixReadAccess); VERIFY_REGION(pSource2, stuff->source2, client, DixReadAccess); VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); switch (stuff->xfixesReqType) { case X_XFixesUnionRegion: if (!RegionUnion(pDestination, pSource1, pSource2)) ret = BadAlloc; break; case X_XFixesIntersectRegion: if (!RegionIntersect(pDestination, pSource1, pSource2)) ret = BadAlloc; break; case X_XFixesSubtractRegion: if (!RegionSubtract(pDestination, pSource1, pSource2)) ret = BadAlloc; break; } if (ret == Success) ret = client->noClientException; return ret; } int SProcXFixesCombineRegion (ClientPtr client) { REQUEST(xXFixesCombineRegionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesCombineRegionReq); swapl(&stuff->source1); swapl(&stuff->source2); swapl(&stuff->destination); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesInvertRegion (ClientPtr client) { RegionPtr pSource, pDestination; BoxRec bounds; int ret = Success; REQUEST(xXFixesInvertRegionReq); REQUEST_SIZE_MATCH(xXFixesInvertRegionReq); VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); /* Compute bounds, limit to 16 bits */ bounds.x1 = stuff->x; bounds.y1 = stuff->y; if ((int) stuff->x + (int) stuff->width > MAXSHORT) bounds.x2 = MAXSHORT; else bounds.x2 = stuff->x + stuff->width; if ((int) stuff->y + (int) stuff->height > MAXSHORT) bounds.y2 = MAXSHORT; else bounds.y2 = stuff->y + stuff->height; if (!RegionInverse(pDestination, pSource, &bounds)) ret = BadAlloc; if (ret == Success) ret = client->noClientException; return ret; } int SProcXFixesInvertRegion (ClientPtr client) { REQUEST(xXFixesInvertRegionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesInvertRegionReq); swapl(&stuff->source); swaps(&stuff->x); swaps(&stuff->y); swaps(&stuff->width); swaps(&stuff->height); swapl(&stuff->destination); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesTranslateRegion (ClientPtr client) { RegionPtr pRegion; REQUEST(xXFixesTranslateRegionReq); REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq); VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); RegionTranslate(pRegion, stuff->dx, stuff->dy); return (client->noClientException); } int SProcXFixesTranslateRegion (ClientPtr client) { REQUEST(xXFixesTranslateRegionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq); swapl(&stuff->region); swaps(&stuff->dx); swaps(&stuff->dy); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesRegionExtents (ClientPtr client) { RegionPtr pSource, pDestination; REQUEST(xXFixesRegionExtentsReq); REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq); VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); RegionReset(pDestination, RegionExtents(pSource)); return (client->noClientException); } int SProcXFixesRegionExtents (ClientPtr client) { REQUEST(xXFixesRegionExtentsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq); swapl(&stuff->source); swapl(&stuff->destination); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesFetchRegion (ClientPtr client) { RegionPtr pRegion; xXFixesFetchRegionReply *reply; xRectangle *pRect; BoxPtr pExtent; BoxPtr pBox; int i, nBox; REQUEST(xXFixesFetchRegionReq); REQUEST_SIZE_MATCH(xXFixesFetchRegionReq); VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess); pExtent = RegionExtents(pRegion); pBox = RegionRects (pRegion); nBox = RegionNumRects (pRegion); reply = calloc (sizeof (xXFixesFetchRegionReply) + nBox * sizeof (xRectangle), 1); if (!reply) return BadAlloc; reply->type = X_Reply; reply->sequenceNumber = client->sequence; reply->length = nBox << 1; reply->x = pExtent->x1; reply->y = pExtent->y1; reply->width = pExtent->x2 - pExtent->x1; reply->height = pExtent->y2 - pExtent->y1; pRect = (xRectangle *) (reply + 1); for (i = 0; i < nBox; i++) { pRect[i].x = pBox[i].x1; pRect[i].y = pBox[i].y1; pRect[i].width = pBox[i].x2 - pBox[i].x1; pRect[i].height = pBox[i].y2 - pBox[i].y1; } if (client->swapped) { swaps(&reply->sequenceNumber); swapl(&reply->length); swaps(&reply->x); swaps(&reply->y); swaps(&reply->width); swaps(&reply->height); SwapShorts((INT16 *) pRect, nBox * 4); } WriteToClient(client, sizeof (xXFixesFetchRegionReply) + nBox * sizeof (xRectangle), reply); free (reply); return (client->noClientException); } int SProcXFixesFetchRegion (ClientPtr client) { REQUEST(xXFixesFetchRegionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesFetchRegionReq); swapl(&stuff->region); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesSetGCClipRegion (ClientPtr client) { GCPtr pGC; RegionPtr pRegion; XID vals[2]; #ifndef NXAGENT_SERVER int rc; #endif REQUEST(xXFixesSetGCClipRegionReq); REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq); #ifndef NXAGENT_SERVER rc = dixLookupGC(&pGC, stuff->gc, client, DixWriteAccess); if (rc != Success) return rc; #else SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixWriteAccess); #endif VERIFY_REGION_OR_NONE (pRegion, stuff->region, client, DixReadAccess); if (pRegion) { pRegion = XFixesRegionCopy (pRegion); if (!pRegion) return BadAlloc; } vals[0] = stuff->xOrigin; vals[1] = stuff->yOrigin; DoChangeGC (pGC, GCClipXOrigin|GCClipYOrigin, vals, 0); (*pGC->funcs->ChangeClip)(pGC, pRegion ? CT_REGION : CT_NONE, (void *)pRegion, 0); return (client->noClientException); } int SProcXFixesSetGCClipRegion (ClientPtr client) { REQUEST(xXFixesSetGCClipRegionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq); swapl(&stuff->gc); swapl(&stuff->region); swaps(&stuff->xOrigin); swaps(&stuff->yOrigin); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } typedef RegionPtr (*CreateDftPtr)(WindowPtr pWin); int ProcXFixesSetWindowShapeRegion (ClientPtr client) { #ifdef SHAPE WindowPtr pWin; ScreenPtr pScreen; RegionPtr pRegion; RegionPtr *pDestRegion; REQUEST(xXFixesSetWindowShapeRegionReq); REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq); pWin = (WindowPtr) LookupIDByType (stuff->dest, RT_WINDOW); if (!pWin) { client->errorValue = stuff->dest; return BadWindow; } VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixWriteAccess); pScreen = pWin->drawable.pScreen; switch (stuff->destKind) { case ShapeBounding: case ShapeClip: case ShapeInput: break; default: client->errorValue = stuff->destKind; return BadValue; } if (pRegion) { pRegion = XFixesRegionCopy (pRegion); if (!pRegion) return BadAlloc; if (!pWin->optional) MakeWindowOptional (pWin); switch (stuff->destKind) { default: case ShapeBounding: pDestRegion = &pWin->optional->boundingShape; break; case ShapeClip: pDestRegion = &pWin->optional->clipShape; break; case ShapeInput: pDestRegion = &pWin->optional->inputShape; break; } if (stuff->xOff || stuff->yOff) RegionTranslate(pRegion, stuff->xOff, stuff->yOff); } else { if (pWin->optional) { switch (stuff->destKind) { default: case ShapeBounding: pDestRegion = &pWin->optional->boundingShape; break; case ShapeClip: pDestRegion = &pWin->optional->clipShape; break; case ShapeInput: pDestRegion = &pWin->optional->inputShape; break; } } else pDestRegion = &pRegion; /* a NULL region pointer */ } if (*pDestRegion) RegionDestroy(*pDestRegion); *pDestRegion = pRegion; (*pScreen->SetShape) (pWin); SendShapeNotify (pWin, stuff->destKind); return (client->noClientException); #else return BadRequest; #endif } int SProcXFixesSetWindowShapeRegion (ClientPtr client) { REQUEST(xXFixesSetWindowShapeRegionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq); swapl(&stuff->dest); swaps(&stuff->xOff); swaps(&stuff->yOff); swapl(&stuff->region); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesSetPictureClipRegion (ClientPtr client) { #ifdef RENDER PicturePtr pPicture; RegionPtr pRegion; REQUEST(xXFixesSetPictureClipRegionReq); REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq); VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess); return SetPictureClipRegion (pPicture, stuff->xOrigin, stuff->yOrigin, pRegion); #else return BadRequest; #endif } int SProcXFixesSetPictureClipRegion (ClientPtr client) { REQUEST(xXFixesSetPictureClipRegionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq); swapl(&stuff->picture); swapl(&stuff->region); swaps(&stuff->xOrigin); swaps(&stuff->yOrigin); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } int ProcXFixesExpandRegion (ClientPtr client) { RegionPtr pSource, pDestination; int ret = Success; REQUEST (xXFixesExpandRegionReq); BoxPtr pTmp; BoxPtr pSrc; int nBoxes; int i; REQUEST_SIZE_MATCH (xXFixesExpandRegionReq); VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); nBoxes = RegionNumRects(pSource); pSrc = RegionRects(pSource); if (nBoxes) { pTmp = malloc (nBoxes * sizeof (BoxRec)); if (!pTmp) return BadAlloc; for (i = 0; i < nBoxes; i++) { pTmp[i].x1 = pSrc[i].x1 - stuff->left; pTmp[i].x2 = pSrc[i].x2 + stuff->right; pTmp[i].y1 = pSrc[i].y1 - stuff->top; pTmp[i].y2 = pSrc[i].y2 + stuff->bottom; } RegionEmpty(pDestination); for (i = 0; i < nBoxes; i++) { RegionRec r; RegionInit(&r, &pTmp[i], 0); RegionUnion(pDestination, pDestination, &r); } free(pTmp); } if (ret == Success) ret = client->noClientException; return ret; } int SProcXFixesExpandRegion (ClientPtr client) { REQUEST(xXFixesExpandRegionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesExpandRegionReq); swapl(&stuff->source); swapl(&stuff->destination); swaps(&stuff->left); swaps(&stuff->right); swaps(&stuff->top); swaps(&stuff->bottom); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xfixes/saveset.c0000644000000000000000000000523113614532331017720 0ustar /* * Copyright © 2002 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "xfixesint.h" int ProcXFixesChangeSaveSet(ClientPtr client) { Bool toRoot, remap; int result; WindowPtr pWin; REQUEST(xXFixesChangeSaveSetReq); REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq); #ifndef NXAGENT_SERVER result = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); if (result != Success) return result; #else pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixReadAccess); if (!pWin) return(BadWindow); #endif if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) return BadMatch; if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete)) { client->errorValue = stuff->mode; return( BadValue ); } if ((stuff->target != SaveSetNearest) && (stuff->target != SaveSetRoot)) { client->errorValue = stuff->target; return( BadValue ); } if ((stuff->map != SaveSetMap) && (stuff->map != SaveSetUnmap)) { client->errorValue = stuff->map; return( BadValue ); } toRoot = (stuff->target == SaveSetRoot); remap = (stuff->map == SaveSetMap); result = AlterSaveSetForClient(client, pWin, stuff->mode, toRoot, remap); if (client->noClientException != Success) return(client->noClientException); else return(result); } int SProcXFixesChangeSaveSet(ClientPtr client) { REQUEST(xXFixesChangeSaveSetReq); swaps(&stuff->length); swapl(&stuff->window); return ProcXFixesChangeSaveSet(client); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xfixes/select.c0000644000000000000000000001666013614532331017535 0ustar /* * Copyright © 2002 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "xfixesint.h" static RESTYPE SelectionClientType, SelectionWindowType; static Bool SelectionCallbackRegistered = FALSE; /* * There is a global list of windows selecting for selection events * on every selection. This should be plenty efficient for the * expected usage, if it does become a problem, it should be easily * replaced with a hash table of some kind keyed off the selection atom */ typedef struct _SelectionEvent *SelectionEventPtr; typedef struct _SelectionEvent { SelectionEventPtr next; Atom selection; CARD32 eventMask; ClientPtr pClient; WindowPtr pWindow; XID clientResource; } SelectionEventRec; static SelectionEventPtr selectionEvents; static void XFixesSelectionCallback (CallbackListPtr *callbacks, void * data, void * args) { SelectionEventPtr e; SelectionInfoRec *info = (SelectionInfoRec *) args; Selection *selection = info->selection; int subtype; CARD32 eventMask; switch (info->kind) { case SelectionSetOwner: subtype = XFixesSetSelectionOwnerNotify; eventMask = XFixesSetSelectionOwnerNotifyMask; break; case SelectionWindowDestroy: subtype = XFixesSelectionWindowDestroyNotify; eventMask = XFixesSelectionWindowDestroyNotifyMask; break; case SelectionClientClose: subtype = XFixesSelectionClientCloseNotify; eventMask = XFixesSelectionClientCloseNotifyMask; break; default: return; } for (e = selectionEvents; e; e = e->next) { if (e->selection == selection->selection && (e->eventMask & eventMask)) { xXFixesSelectionNotifyEvent ev; memset(&ev, 0, sizeof(xXFixesSelectionNotifyEvent)); ev.type = XFixesEventBase + XFixesSelectionNotify; ev.subtype = subtype; ev.window = e->pWindow->drawable.id; if (subtype == XFixesSetSelectionOwnerNotify) ev.owner = selection->window; else ev.owner = 0; ev.selection = e->selection; ev.timestamp = currentTime.milliseconds; ev.selectionTimestamp = selection->lastTimeChanged.milliseconds; WriteEventsToClient (e->pClient, 1, (xEvent *) &ev); } } } static Bool CheckSelectionCallback (void) { if (selectionEvents) { if (!SelectionCallbackRegistered) { if (!AddCallback (&SelectionCallback, XFixesSelectionCallback, NULL)) return FALSE; SelectionCallbackRegistered = TRUE; } } else { if (SelectionCallbackRegistered) { DeleteCallback (&SelectionCallback, XFixesSelectionCallback, NULL); SelectionCallbackRegistered = FALSE; } } return TRUE; } #define SelectionAllEvents (XFixesSetSelectionOwnerNotifyMask |\ XFixesSelectionWindowDestroyNotifyMask |\ XFixesSelectionClientCloseNotifyMask) static int XFixesSelectSelectionInput (ClientPtr pClient, Atom selection, WindowPtr pWindow, CARD32 eventMask) { SelectionEventPtr *prev, e; for (prev = &selectionEvents; (e = *prev); prev = &e->next) { if (e->selection == selection && e->pClient == pClient && e->pWindow == pWindow) { break; } } if (!eventMask) { if (e) { FreeResource (e->clientResource, 0); } return Success; } if (!e) { e = (SelectionEventPtr) malloc (sizeof (SelectionEventRec)); if (!e) return BadAlloc; e->next = 0; e->selection = selection; e->pClient = pClient; e->pWindow = pWindow; e->clientResource = FakeClientID(pClient->index); /* * Add a resource hanging from the window to * catch window destroy */ if (!LookupIDByType(pWindow->drawable.id, SelectionWindowType)) if (!AddResource (pWindow->drawable.id, SelectionWindowType, (void *) pWindow)) { free (e); return BadAlloc; } if (!AddResource (e->clientResource, SelectionClientType, (void *) e)) return BadAlloc; *prev = e; if (!CheckSelectionCallback ()) { FreeResource (e->clientResource, 0); return BadAlloc; } } e->eventMask = eventMask; return Success; } int ProcXFixesSelectSelectionInput (ClientPtr client) { REQUEST (xXFixesSelectSelectionInputReq); WindowPtr pWin; #ifndef NXAGENT_SERVER int rc; #endif REQUEST_SIZE_MATCH (xXFixesSelectSelectionInputReq); #ifndef NXAGENT_SERVER rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); if (rc != Success) return rc; #else pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, DixReadAccess); if (!pWin) return(BadWindow); #endif if (stuff->eventMask & ~SelectionAllEvents) { client->errorValue = stuff->eventMask; return( BadValue ); } return XFixesSelectSelectionInput (client, stuff->selection, pWin, stuff->eventMask); } int SProcXFixesSelectSelectionInput (ClientPtr client) { REQUEST(xXFixesSelectSelectionInputReq); REQUEST_SIZE_MATCH(xXFixesSelectSelectionInputReq); swaps(&stuff->length); swapl(&stuff->window); swapl(&stuff->selection); swapl(&stuff->eventMask); return ProcXFixesSelectSelectionInput(client); } void SXFixesSelectionNotifyEvent (xXFixesSelectionNotifyEvent *from, xXFixesSelectionNotifyEvent *to) { to->type = from->type; cpswaps (from->sequenceNumber, to->sequenceNumber); cpswapl (from->window, to->window); cpswapl (from->owner, to->owner); cpswapl (from->selection, to->selection); cpswapl (from->timestamp, to->timestamp); cpswapl (from->selectionTimestamp, to->selectionTimestamp); } static int SelectionFreeClient (void * data, XID id) { SelectionEventPtr old = (SelectionEventPtr) data; SelectionEventPtr *prev, e; for (prev = &selectionEvents; (e = *prev); prev = &e->next) { if (e == old) { *prev = e->next; free (e); CheckSelectionCallback (); break; } } return 1; } static int SelectionFreeWindow (void * data, XID id) { WindowPtr pWindow = (WindowPtr) data; SelectionEventPtr e, next; for (e = selectionEvents; e; e = next) { next = e->next; if (e->pWindow == pWindow) { FreeResource (e->clientResource, 0); } } return 1; } Bool XFixesSelectionInit (void) { SelectionClientType = CreateNewResourceType(SelectionFreeClient); SelectionWindowType = CreateNewResourceType(SelectionFreeWindow); return SelectionClientType && SelectionWindowType; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xfixes/xfixes.c0000644000000000000000000002127113614532331017556 0ustar /* * Copyright © 2006 Sun Microsystems * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Sun Microsystems not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Sun Microsystems makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * Copyright © 2002 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "xfixesint.h" #include "protocol-versions.h" static unsigned char XFixesReqCode; int XFixesEventBase; int XFixesErrorBase; static int XFixesClientPrivateIndex; static int ProcXFixesQueryVersion(ClientPtr client) { XFixesClientPtr pXFixesClient = GetXFixesClient (client); xXFixesQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; REQUEST(xXFixesQueryVersionReq); REQUEST_SIZE_MATCH(xXFixesQueryVersionReq); if (stuff->majorVersion < SERVER_XFIXES_MAJOR_VERSION) { rep.majorVersion = stuff->majorVersion; rep.minorVersion = stuff->minorVersion; } else { rep.majorVersion = SERVER_XFIXES_MAJOR_VERSION; if (stuff->majorVersion == SERVER_XFIXES_MAJOR_VERSION && stuff->minorVersion < SERVER_XFIXES_MINOR_VERSION) rep.minorVersion = stuff->minorVersion; else rep.minorVersion = SERVER_XFIXES_MINOR_VERSION; } pXFixesClient->major_version = rep.majorVersion; pXFixesClient->minor_version = rep.minorVersion; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.majorVersion); swapl(&rep.minorVersion); } WriteToClient(client, sizeof(xXFixesQueryVersionReply), &rep); return(client->noClientException); } /* Major version controls available requests */ static const int version_requests[] = { X_XFixesQueryVersion, /* before client sends QueryVersion */ X_XFixesGetCursorImage, /* Version 1 */ X_XFixesChangeCursorByName, /* Version 2 */ X_XFixesExpandRegion, /* Version 3 */ X_XFixesShowCursor, /* Version 4 */ }; #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr) = { /*************** Version 1 ******************/ ProcXFixesQueryVersion, ProcXFixesChangeSaveSet, ProcXFixesSelectSelectionInput, ProcXFixesSelectCursorInput, ProcXFixesGetCursorImage, /*************** Version 2 ******************/ ProcXFixesCreateRegion, ProcXFixesCreateRegionFromBitmap, ProcXFixesCreateRegionFromWindow, ProcXFixesCreateRegionFromGC, ProcXFixesCreateRegionFromPicture, ProcXFixesDestroyRegion, ProcXFixesSetRegion, ProcXFixesCopyRegion, ProcXFixesCombineRegion, ProcXFixesCombineRegion, ProcXFixesCombineRegion, ProcXFixesInvertRegion, ProcXFixesTranslateRegion, ProcXFixesRegionExtents, ProcXFixesFetchRegion, ProcXFixesSetGCClipRegion, ProcXFixesSetWindowShapeRegion, ProcXFixesSetPictureClipRegion, ProcXFixesSetCursorName, ProcXFixesGetCursorName, ProcXFixesGetCursorImageAndName, ProcXFixesChangeCursor, ProcXFixesChangeCursorByName, /*************** Version 3 ******************/ ProcXFixesExpandRegion, /*************** Version 4 ****************/ ProcXFixesHideCursor, ProcXFixesShowCursor, }; static int ProcXFixesDispatch (ClientPtr client) { REQUEST(xXFixesReq); XFixesClientPtr pXFixesClient = GetXFixesClient (client); if (pXFixesClient->major_version >= NUM_VERSION_REQUESTS) return BadRequest; if (stuff->xfixesReqType > version_requests[pXFixesClient->major_version]) return BadRequest; return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } static int SProcXFixesQueryVersion(ClientPtr client) { REQUEST(xXFixesQueryVersionReq); swaps(&stuff->length); swapl(&stuff->majorVersion); swapl(&stuff->minorVersion); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } static int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = { /*************** Version 1 ******************/ SProcXFixesQueryVersion, SProcXFixesChangeSaveSet, SProcXFixesSelectSelectionInput, SProcXFixesSelectCursorInput, SProcXFixesGetCursorImage, /*************** Version 2 ******************/ SProcXFixesCreateRegion, SProcXFixesCreateRegionFromBitmap, SProcXFixesCreateRegionFromWindow, SProcXFixesCreateRegionFromGC, SProcXFixesCreateRegionFromPicture, SProcXFixesDestroyRegion, SProcXFixesSetRegion, SProcXFixesCopyRegion, SProcXFixesCombineRegion, SProcXFixesCombineRegion, SProcXFixesCombineRegion, SProcXFixesInvertRegion, SProcXFixesTranslateRegion, SProcXFixesRegionExtents, SProcXFixesFetchRegion, SProcXFixesSetGCClipRegion, SProcXFixesSetWindowShapeRegion, SProcXFixesSetPictureClipRegion, SProcXFixesSetCursorName, SProcXFixesGetCursorName, SProcXFixesGetCursorImageAndName, SProcXFixesChangeCursor, SProcXFixesChangeCursorByName, /*************** Version 3 ******************/ SProcXFixesExpandRegion, /*************** Version 4 ****************/ SProcXFixesHideCursor, SProcXFixesShowCursor, }; static int SProcXFixesDispatch (ClientPtr client) { REQUEST(xXFixesReq); if (stuff->xfixesReqType >= XFixesNumberRequests) return BadRequest; return (*SProcXFixesVector[stuff->xfixesReqType]) (client); } static void XFixesClientCallback (CallbackListPtr *list, void *closure, void *data) { NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; ClientPtr pClient = clientinfo->client; XFixesClientPtr pXFixesClient = GetXFixesClient (pClient); pXFixesClient->major_version = 0; pXFixesClient->minor_version = 0; } /*ARGSUSED*/ static void XFixesResetProc (ExtensionEntry *extEntry) { DeleteCallback (&ClientStateCallback, XFixesClientCallback, 0); } void XFixesExtensionInit(void) { ExtensionEntry *extEntry; XFixesClientPrivateIndex = AllocateClientPrivateIndex (); if (!AllocateClientPrivate (XFixesClientPrivateIndex, sizeof (XFixesClientRec))) return; if (!AddCallback (&ClientStateCallback, XFixesClientCallback, 0)) return; if (XFixesSelectionInit() && XFixesCursorInit () && XFixesRegionInit () && (extEntry = AddExtension(XFIXES_NAME, XFixesNumberEvents, XFixesNumberErrors, ProcXFixesDispatch, SProcXFixesDispatch, XFixesResetProc, StandardMinorOpcode)) != 0) { XFixesReqCode = (unsigned char)extEntry->base; XFixesEventBase = extEntry->eventBase; XFixesErrorBase = extEntry->errorBase; EventSwapVector[XFixesEventBase + XFixesSelectionNotify] = (EventSwapPtr) SXFixesSelectionNotifyEvent; EventSwapVector[XFixesEventBase + XFixesCursorNotify] = (EventSwapPtr) SXFixesCursorNotifyEvent; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xfixes/xfixes.h0000644000000000000000000000337113614532331017564 0ustar /* * Copyright © 2002 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _XFIXES_H_ #define _XFIXES_H_ #include "resource.h" extern RESTYPE RegionResType; extern int XFixesErrorBase; #define VERIFY_REGION(pRegion, rid, client, mode) { \ pRegion = SecurityLookupIDByType (client, rid, RegionResType, mode); \ if (!pRegion) { \ client->errorValue = rid; \ return XFixesErrorBase + BadRegion; \ } \ } #define VERIFY_REGION_OR_NONE(pRegion, rid, client, mode) { \ pRegion = 0; \ if (rid) VERIFY_REGION(pRegion, rid, client, mode); \ } RegionPtr XFixesRegionCopy (RegionPtr pRegion); #endif /* _XFIXES_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/xfixes/xfixesint.h0000644000000000000000000001455313614532331020303 0ustar /* * Copyright © 2006 Sun Microsystems * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Sun Microsystems not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Sun Microsystems makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * Copyright © 2002 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Keith Packard makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef _XFIXESINT_H_ #define _XFIXESINT_H_ #include #include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include #include "windowstr.h" #include "selection.h" #include "xfixes.h" extern int XFixesEventBase; typedef struct _XFixesClient { CARD32 major_version; CARD32 minor_version; } XFixesClientRec, *XFixesClientPtr; #define GetXFixesClient(pClient) ((XFixesClientPtr) (pClient)->devPrivates[XFixesClientPrivateIndex].ptr) extern int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr); /* Initialize extension at server startup time */ void XFixesExtensionInit(void); /* Save set */ int ProcXFixesChangeSaveSet(ClientPtr client); int SProcXFixesChangeSaveSet(ClientPtr client); /* Selection events */ int ProcXFixesSelectSelectionInput (ClientPtr client); int SProcXFixesSelectSelectionInput (ClientPtr client); void SXFixesSelectionNotifyEvent (xXFixesSelectionNotifyEvent *from, xXFixesSelectionNotifyEvent *to); Bool XFixesSelectionInit (void); /* Cursor notification */ Bool XFixesCursorInit (void); int ProcXFixesSelectCursorInput (ClientPtr client); int SProcXFixesSelectCursorInput (ClientPtr client); void SXFixesCursorNotifyEvent (xXFixesCursorNotifyEvent *from, xXFixesCursorNotifyEvent *to); int ProcXFixesGetCursorImage (ClientPtr client); int SProcXFixesGetCursorImage (ClientPtr client); /* Cursor names (Version 2) */ int ProcXFixesSetCursorName (ClientPtr client); int SProcXFixesSetCursorName (ClientPtr client); int ProcXFixesGetCursorName (ClientPtr client); int SProcXFixesGetCursorName (ClientPtr client); int ProcXFixesGetCursorImageAndName (ClientPtr client); int SProcXFixesGetCursorImageAndName (ClientPtr client); /* Cursor replacement (Version 2) */ int ProcXFixesChangeCursor (ClientPtr client); int SProcXFixesChangeCursor (ClientPtr client); int ProcXFixesChangeCursorByName (ClientPtr client); int SProcXFixesChangeCursorByName (ClientPtr client); /* Region objects (Version 2* */ Bool XFixesRegionInit (void); int ProcXFixesCreateRegion (ClientPtr client); int SProcXFixesCreateRegion (ClientPtr client); int ProcXFixesCreateRegionFromBitmap (ClientPtr client); int SProcXFixesCreateRegionFromBitmap (ClientPtr client); int ProcXFixesCreateRegionFromWindow (ClientPtr client); int SProcXFixesCreateRegionFromWindow (ClientPtr client); int ProcXFixesCreateRegionFromGC (ClientPtr client); int SProcXFixesCreateRegionFromGC (ClientPtr client); int ProcXFixesCreateRegionFromPicture (ClientPtr client); int SProcXFixesCreateRegionFromPicture (ClientPtr client); int ProcXFixesDestroyRegion (ClientPtr client); int SProcXFixesDestroyRegion (ClientPtr client); int ProcXFixesSetRegion (ClientPtr client); int SProcXFixesSetRegion (ClientPtr client); int ProcXFixesCopyRegion (ClientPtr client); int SProcXFixesCopyRegion (ClientPtr client); int ProcXFixesCombineRegion (ClientPtr client); int SProcXFixesCombineRegion (ClientPtr client); int ProcXFixesInvertRegion (ClientPtr client); int SProcXFixesInvertRegion (ClientPtr client); int ProcXFixesTranslateRegion (ClientPtr client); int SProcXFixesTranslateRegion (ClientPtr client); int ProcXFixesRegionExtents (ClientPtr client); int SProcXFixesRegionExtents (ClientPtr client); int ProcXFixesFetchRegion (ClientPtr client); int SProcXFixesFetchRegion (ClientPtr client); int ProcXFixesSetGCClipRegion (ClientPtr client); int SProcXFixesSetGCClipRegion (ClientPtr client); int ProcXFixesSetWindowShapeRegion (ClientPtr client); int SProcXFixesSetWindowShapeRegion (ClientPtr client); int ProcXFixesSetPictureClipRegion (ClientPtr client); int SProcXFixesSetPictureClipRegion (ClientPtr client); int ProcXFixesExpandRegion (ClientPtr client); int SProcXFixesExpandRegion (ClientPtr client); /* Cursor Visibility (Version 4) */ int ProcXFixesHideCursor (ClientPtr client); int SProcXFixesHideCursor (ClientPtr client); int ProcXFixesShowCursor (ClientPtr client); int SProcXFixesShowCursor (ClientPtr client); #endif /* _XFIXESINT_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/allowev.c0000644000000000000000000001053513614532331016774 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Function to allow frozen events to be routed from extension input devices. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "allowev.h" #include "dixevents.h" /*********************************************************************** * * This procedure allows frozen events to be routed. * */ int SProcXAllowDeviceEvents(register ClientPtr client) { REQUEST(xAllowDeviceEventsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xAllowDeviceEventsReq); swapl(&stuff->time); return (ProcXAllowDeviceEvents(client)); } /*********************************************************************** * * This procedure allows frozen events to be routed. * */ int ProcXAllowDeviceEvents(register ClientPtr client) { TimeStamp time; DeviceIntPtr thisdev; REQUEST(xAllowDeviceEventsReq); REQUEST_SIZE_MATCH(xAllowDeviceEventsReq); thisdev = LookupDeviceIntRec(stuff->deviceid); if (thisdev == NULL) { SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadDevice); return Success; } time = ClientTimeToServerTime(stuff->time); switch (stuff->mode) { case ReplayThisDevice: AllowSome(client, time, thisdev, NOT_GRABBED); break; case SyncThisDevice: AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT); break; case AsyncThisDevice: AllowSome(client, time, thisdev, THAWED); break; case AsyncOtherDevices: AllowSome(client, time, thisdev, THAW_OTHERS); break; case SyncAll: AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT); break; case AsyncAll: AllowSome(client, time, thisdev, THAWED_BOTH); break; default: SendErrorToClient(client, IReqCode, X_AllowDeviceEvents, 0, BadValue); client->errorValue = stuff->mode; return Success; } return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/allowev.h0000644000000000000000000000263113614532331016777 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef ALLOWEV_H #define ALLOWEV_H 1 int SProcXAllowDeviceEvents(ClientPtr /* client */ ); int ProcXAllowDeviceEvents(ClientPtr /* client */ ); #endif /* ALLOWEV_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/chgdctl.c0000644000000000000000000001445113614532331016734 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /******************************************************************** * * Change Device control attributes for an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include /* control constants */ #include "XIstubs.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "chgdctl.h" /*********************************************************************** * * This procedure changes the control attributes for an extension device, * for clients on machines with a different byte ordering than the server. * */ int SProcXChangeDeviceControl(register ClientPtr client) { REQUEST(xChangeDeviceControlReq); swaps(&stuff->length); REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl)); swaps(&stuff->control); return (ProcXChangeDeviceControl(client)); } /*********************************************************************** * * Change the control attributes. * */ int ProcXChangeDeviceControl(ClientPtr client) { unsigned len; int i, status; DeviceIntPtr dev; xDeviceResolutionCtl *r; xChangeDeviceControlReply rep; AxisInfoPtr a; CARD32 *resolution; REQUEST(xChangeDeviceControlReq); REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl)); len = stuff->length - (sizeof(xChangeDeviceControlReq) >> 2); dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadDevice); return Success; } rep.repType = X_Reply; rep.RepType = X_ChangeDeviceControl; rep.length = 0; rep.sequenceNumber = client->sequence; switch (stuff->control) { case DEVICE_RESOLUTION: r = (xDeviceResolutionCtl *) & stuff[1]; if ((len < (sizeof(xDeviceResolutionCtl) >> 2)) || (len != (sizeof(xDeviceResolutionCtl) >> 2) + r->num_valuators)) { SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadLength); return Success; } if (!dev->valuator) { SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadMatch); return Success; } if ((dev->grab) && !SameClient(dev->grab, client)) { rep.status = AlreadyGrabbed; WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep); return Success; } resolution = (CARD32 *) (r + 1); if (r->first_valuator + r->num_valuators > dev->valuator->numAxes) { SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue); return Success; } status = ChangeDeviceControl(client, dev, (xDeviceCtl *) r); if (status == Success) { a = &dev->valuator->axes[r->first_valuator]; for (i = 0; i < r->num_valuators; i++) if (*(resolution + i) < (a + i)->min_resolution || *(resolution + i) > (a + i)->max_resolution) { SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue); return Success; } for (i = 0; i < r->num_valuators; i++) (a++)->resolution = *resolution++; } else if (status == DeviceBusy) { rep.status = DeviceBusy; WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep); return Success; } else { SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadMatch); return Success; } break; default: SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue); return Success; } WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep); return Success; } /*********************************************************************** * * This procedure writes the reply for the xChangeDeviceControl function, * if the client and server have a different byte ordering. * */ void SRepXChangeDeviceControl(ClientPtr client, int size, xChangeDeviceControlReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/chgdctl.h0000644000000000000000000000304513614532331016736 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef CHGDCTL_H #define CHGDCTL_H 1 int SProcXChangeDeviceControl(ClientPtr /* client */ ); int ProcXChangeDeviceControl(ClientPtr /* client */ ); void SRepXChangeDeviceControl(ClientPtr /* client */ , int /* size */ , xChangeDeviceControlReply * /* rep */ ); #endif /* CHGDCTL_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/chgfctl.c0000644000000000000000000003634313614532331016742 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /******************************************************************** * * Change feedback control attributes for an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include /* control constants */ #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "chgfctl.h" #define DO_ALL (-1) /*********************************************************************** * * This procedure changes the control attributes for an extension device, * for clients on machines with a different byte ordering than the server. * */ int SProcXChangeFeedbackControl(register ClientPtr client) { REQUEST(xChangeFeedbackControlReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq); swapl(&stuff->mask); return (ProcXChangeFeedbackControl(client)); } /*********************************************************************** * * Change the control attributes. * */ int ProcXChangeFeedbackControl(ClientPtr client) { unsigned len; DeviceIntPtr dev; KbdFeedbackPtr k; PtrFeedbackPtr p; IntegerFeedbackPtr i; StringFeedbackPtr s; BellFeedbackPtr b; LedFeedbackPtr l; REQUEST(xChangeFeedbackControlReq); REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq); len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2); dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadDevice); return Success; } switch (stuff->feedbackid) { case KbdFeedbackClass: if (len != (sizeof(xKbdFeedbackCtl) >> 2)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadLength); return Success; } for (k = dev->kbdfeed; k; k = k->next) if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id) { ChangeKbdFeedback(client, dev, stuff->mask, k, (xKbdFeedbackCtl *) & stuff[1]); return Success; } break; case PtrFeedbackClass: if (len != (sizeof(xPtrFeedbackCtl) >> 2)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadLength); return Success; } for (p = dev->ptrfeed; p; p = p->next) if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id) { ChangePtrFeedback(client, dev, stuff->mask, p, (xPtrFeedbackCtl *) & stuff[1]); return Success; } break; case StringFeedbackClass: { xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]); if (client->swapped) { if (len < (sizeof(xStringFeedbackCtl) + 3) >> 2) return BadLength; swaps(&f->num_keysyms); } if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadLength); return Success; } for (s = dev->stringfeed; s; s = s->next) if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id) { ChangeStringFeedback(client, dev, stuff->mask, s, (xStringFeedbackCtl *) & stuff[1]); return Success; } break; } case IntegerFeedbackClass: if (len != (sizeof(xIntegerFeedbackCtl) >> 2)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadLength); return Success; } for (i = dev->intfeed; i; i = i->next) if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id) { ChangeIntegerFeedback(client, dev, stuff->mask, i, (xIntegerFeedbackCtl *) & stuff[1]); return Success; } break; case LedFeedbackClass: if (len != (sizeof(xLedFeedbackCtl) >> 2)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadLength); return Success; } for (l = dev->leds; l; l = l->next) if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id) { ChangeLedFeedback(client, dev, stuff->mask, l, (xLedFeedbackCtl *) & stuff[1]); return Success; } break; case BellFeedbackClass: if (len != (sizeof(xBellFeedbackCtl) >> 2)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadLength); return Success; } for (b = dev->bell; b; b = b->next) if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id) { ChangeBellFeedback(client, dev, stuff->mask, b, (xBellFeedbackCtl *) & stuff[1]); return Success; } break; default: break; } SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch); return Success; } /****************************************************************************** * * This procedure changes KbdFeedbackClass data. * */ int ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, KbdFeedbackPtr k, xKbdFeedbackCtl * f) { KeybdCtrl kctrl; int t; int key = DO_ALL; if (client->swapped) { swaps(&f->length); swaps(&f->pitch); swaps(&f->duration); swapl(&f->led_mask); swapl(&f->led_values); } kctrl = k->ctrl; if (mask & DvKeyClickPercent) { t = f->click; if (t == -1) t = defaultKeyboardControl.click; else if (t < 0 || t > 100) { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } kctrl.click = t; } if (mask & DvPercent) { t = f->percent; if (t == -1) t = defaultKeyboardControl.bell; else if (t < 0 || t > 100) { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } kctrl.bell = t; } if (mask & DvPitch) { t = f->pitch; if (t == -1) t = defaultKeyboardControl.bell_pitch; else if (t < 0) { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } kctrl.bell_pitch = t; } if (mask & DvDuration) { t = f->duration; if (t == -1) t = defaultKeyboardControl.bell_duration; else if (t < 0) { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } kctrl.bell_duration = t; } if (mask & DvLed) { kctrl.leds &= ~(f->led_mask); kctrl.leds |= (f->led_mask & f->led_values); } if (mask & DvKey) { key = (KeyCode) f->key; if (key < 8 || key > 255) { client->errorValue = key; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } if (!(mask & DvAutoRepeatMode)) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch); return Success; } } if (mask & DvAutoRepeatMode) { int inx = (key >> 3); int kmask = (1 << (key & 7)); t = (CARD8) f->auto_repeat_mode; if (t == AutoRepeatModeOff) { if (key == DO_ALL) kctrl.autoRepeat = FALSE; else kctrl.autoRepeats[inx] &= ~kmask; } else if (t == AutoRepeatModeOn) { if (key == DO_ALL) kctrl.autoRepeat = TRUE; else kctrl.autoRepeats[inx] |= kmask; } else if (t == AutoRepeatModeDefault) { if (key == DO_ALL) kctrl.autoRepeat = defaultKeyboardControl.autoRepeat; else kctrl.autoRepeats[inx] &= ~kmask; kctrl.autoRepeats[inx] = (kctrl.autoRepeats[inx] & ~kmask) | (defaultKeyboardControl.autoRepeats[inx] & kmask); } else { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } } k->ctrl = kctrl; (*k->CtrlProc) (dev, &k->ctrl); return Success; } /****************************************************************************** * * This procedure changes PtrFeedbackClass data. * */ int ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, PtrFeedbackPtr p, xPtrFeedbackCtl * f) { PtrCtrl pctrl; /* might get BadValue part way through */ if (client->swapped) { swaps(&f->length); swaps(&f->num); swaps(&f->denom); swaps(&f->thresh); } pctrl = p->ctrl; if (mask & DvAccelNum) { int accelNum; accelNum = f->num; if (accelNum == -1) pctrl.num = defaultPointerControl.num; else if (accelNum < 0) { client->errorValue = accelNum; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } else pctrl.num = accelNum; } if (mask & DvAccelDenom) { int accelDenom; accelDenom = f->denom; if (accelDenom == -1) pctrl.den = defaultPointerControl.den; else if (accelDenom <= 0) { client->errorValue = accelDenom; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } else pctrl.den = accelDenom; } if (mask & DvThreshold) { int threshold; threshold = f->thresh; if (threshold == -1) pctrl.threshold = defaultPointerControl.threshold; else if (threshold < 0) { client->errorValue = threshold; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } else pctrl.threshold = threshold; } p->ctrl = pctrl; (*p->CtrlProc) (dev, &p->ctrl); return Success; } /****************************************************************************** * * This procedure changes IntegerFeedbackClass data. * */ int ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, IntegerFeedbackPtr i, xIntegerFeedbackCtl * f) { if (client->swapped) { swaps(&f->length); swapl(&f->int_to_display); } i->ctrl.integer_displayed = f->int_to_display; (*i->CtrlProc) (dev, &i->ctrl); return Success; } /****************************************************************************** * * This procedure changes StringFeedbackClass data. * */ int ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, StringFeedbackPtr s, xStringFeedbackCtl * f) { int i, j; KeySym *syms, *sup_syms; syms = (KeySym *) (f + 1); if (client->swapped) { swaps(&f->length); /* swapped num_keysyms in calling proc */ SwapLongs((CARD32 *) syms, f->num_keysyms); } if (f->num_keysyms > s->ctrl.max_symbols) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } sup_syms = s->ctrl.symbols_supported; for (i = 0; i < f->num_keysyms; i++) { for (j = 0; j < s->ctrl.num_symbols_supported; j++) if (*(syms + i) == *(sup_syms + j)) break; if (j == s->ctrl.num_symbols_supported) { SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch); return Success; } } s->ctrl.num_symbols_displayed = f->num_keysyms; for (i = 0; i < f->num_keysyms; i++) *(s->ctrl.symbols_displayed + i) = *(syms + i); (*s->CtrlProc) (dev, &s->ctrl); return Success; } /****************************************************************************** * * This procedure changes BellFeedbackClass data. * */ int ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, BellFeedbackPtr b, xBellFeedbackCtl * f) { int t; BellCtrl bctrl; /* might get BadValue part way through */ if (client->swapped) { swaps(&f->length); swaps(&f->pitch); swaps(&f->duration); } bctrl = b->ctrl; if (mask & DvPercent) { t = f->percent; if (t == -1) t = defaultKeyboardControl.bell; else if (t < 0 || t > 100) { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } bctrl.percent = t; } if (mask & DvPitch) { t = f->pitch; if (t == -1) t = defaultKeyboardControl.bell_pitch; else if (t < 0) { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } bctrl.pitch = t; } if (mask & DvDuration) { t = f->duration; if (t == -1) t = defaultKeyboardControl.bell_duration; else if (t < 0) { client->errorValue = t; SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadValue); return Success; } bctrl.duration = t; } b->ctrl = bctrl; (*b->CtrlProc) (dev, &b->ctrl); return Success; } /****************************************************************************** * * This procedure changes LedFeedbackClass data. * */ int ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, LedFeedbackPtr l, xLedFeedbackCtl * f) { LedCtrl lctrl; /* might get BadValue part way through */ if (client->swapped) { swaps(&f->length); swapl(&f->led_values); swapl(&f->led_mask); } f->led_mask &= l->ctrl.led_mask; /* set only supported leds */ f->led_values &= l->ctrl.led_mask; /* set only supported leds */ if (mask & DvLed) { lctrl.led_mask = f->led_mask; lctrl.led_values = f->led_values; (*l->CtrlProc) (dev, &lctrl); l->ctrl.led_values &= ~(f->led_mask); /* zero changed leds */ l->ctrl.led_values |= (f->led_mask & f->led_values); /* OR in set leds */ } return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/chgfctl.h0000644000000000000000000000502513614532331016740 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef CHGFCTL_H #define CHGFCTL_H 1 int SProcXChangeFeedbackControl(ClientPtr /* client */ ); int ProcXChangeFeedbackControl(ClientPtr /* client */ ); int ChangeKbdFeedback(ClientPtr /* client */ , DeviceIntPtr /* dev */ , unsigned long /* mask */ , KbdFeedbackPtr /* k */ , xKbdFeedbackCtl * /* f */ ); int ChangePtrFeedback(ClientPtr /* client */ , DeviceIntPtr /* dev */ , unsigned long /* mask */ , PtrFeedbackPtr /* p */ , xPtrFeedbackCtl * /* f */ ); int ChangeIntegerFeedback(ClientPtr /* client */ , DeviceIntPtr /* dev */ , unsigned long /* mask */ , IntegerFeedbackPtr /* i */ , xIntegerFeedbackCtl * /* f */ ); int ChangeStringFeedback(ClientPtr /* client */ , DeviceIntPtr /* dev */ , unsigned long /* mask */ , StringFeedbackPtr /* s */ , xStringFeedbackCtl * /* f */ ); int ChangeBellFeedback(ClientPtr /* client */ , DeviceIntPtr /* dev */ , unsigned long /* mask */ , BellFeedbackPtr /* b */ , xBellFeedbackCtl * /* f */ ); int ChangeLedFeedback(ClientPtr /* client */ , DeviceIntPtr /* dev */ , unsigned long /* mask */ , LedFeedbackPtr /* l */ , xLedFeedbackCtl * /* f */ ); #endif /* CHGFCTL_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/chgkbd.c0000644000000000000000000001424513614532331016547 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Extension function to change the keyboard device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "XIstubs.h" #include "globals.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" #include "chgkbd.h" #include "chgptr.h" /*********************************************************************** * * This procedure changes the keyboard device. * */ int SProcXChangeKeyboardDevice(register ClientPtr client) { REQUEST(xChangeKeyboardDeviceReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq); return (ProcXChangeKeyboardDevice(client)); } /*********************************************************************** * * This procedure is invoked to swap the request bytes if the server and * client have a different byte order. * */ int ProcXChangeKeyboardDevice(register ClientPtr client) { int i; DeviceIntPtr xkbd = inputInfo.keyboard; DeviceIntPtr dev; FocusClassPtr xf = xkbd->focus; FocusClassPtr df; KeyClassPtr k; xChangeKeyboardDeviceReply rep; changeDeviceNotify ev; REQUEST(xChangeKeyboardDeviceReq); REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq); rep.repType = X_Reply; rep.RepType = X_ChangeKeyboardDevice; rep.length = 0; rep.sequenceNumber = client->sequence; dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { rep.status = -1; SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0, BadDevice); return Success; } k = dev->key; if (k == NULL) { rep.status = -1; SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0, BadMatch); return Success; } if (((dev->grab) && !SameClient(dev->grab, client)) || ((xkbd->grab) && !SameClient(xkbd->grab, client))) rep.status = AlreadyGrabbed; else if ((dev->sync.frozen && dev->sync.other && !SameClient(dev->sync.other, client)) || (xkbd->sync.frozen && xkbd->sync.other && !SameClient(xkbd->sync.other, client))) rep.status = GrabFrozen; else { if (ChangeKeyboardDevice(xkbd, dev) != Success) { SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0, BadDevice); return Success; } if (!dev->focus) InitFocusClassDeviceStruct(dev); if (!dev->kbdfeed) InitKbdFeedbackClassDeviceStruct(dev, (BellProcPtr) NoopDDA, (KbdCtrlProcPtr) NoopDDA); df = dev->focus; df->win = xf->win; df->revert = xf->revert; df->time = xf->time; df->traceGood = xf->traceGood; if (df->traceSize != xf->traceSize) { df->trace = (WindowPtr *) realloc(df->trace, xf->traceSize * sizeof(WindowPtr)); } df->traceSize = xf->traceSize; for (i = 0; i < df->traceSize; i++) df->trace[i] = xf->trace[i]; RegisterOtherDevice(xkbd); RegisterKeyboardDevice(dev); ev.type = ChangeDeviceNotify; ev.deviceid = stuff->deviceid; ev.time = currentTime.milliseconds; ev.request = NewKeyboard; SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1); SendMappingNotify(MappingKeyboard, k->curKeySyms.minKeyCode, k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1, client); rep.status = 0; } WriteReplyToClient(client, sizeof(xChangeKeyboardDeviceReply), &rep); return Success; } /*********************************************************************** * * This procedure writes the reply for the XChangeKeyboardDevice * function, if the client and server have a different byte ordering. * */ void SRepXChangeKeyboardDevice(ClientPtr client, int size, xChangeKeyboardDeviceReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/chgkbd.h0000644000000000000000000000305013614532331016544 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef CHGKBD_H #define CHGKBD_H 1 int SProcXChangeKeyboardDevice(ClientPtr /* client */ ); int ProcXChangeKeyboardDevice(ClientPtr /* client */ ); void SRepXChangeKeyboardDevice(ClientPtr /* client */ , int /* size */ , xChangeKeyboardDeviceReply * /* rep */ ); #endif /* CHGKBD_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/chgkmap.c0000644000000000000000000001053313614532331016733 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /******************************************************************** * * Change key mapping for an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" #include "chgkmap.h" /*********************************************************************** * * This procedure swaps the request when the client and * server have different byte orderings. * */ int SProcXChangeDeviceKeyMapping(register ClientPtr client) { unsigned int count; REQUEST(xChangeDeviceKeyMappingReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq); count = stuff->keyCodes * stuff->keySymsPerKeyCode; REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32)); SwapLongs((CARD32 *) (&stuff[1]), count); return (ProcXChangeDeviceKeyMapping(client)); } /*********************************************************************** * * Change the device key mapping. * */ int ProcXChangeDeviceKeyMapping(register ClientPtr client) { int ret; unsigned len; DeviceIntPtr dev; unsigned int count; REQUEST(xChangeDeviceKeyMappingReq); REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq); count = stuff->keyCodes * stuff->keySymsPerKeyCode; REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32)); dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_ChangeDeviceKeyMapping, 0, BadDevice); return Success; } len = stuff->length - (sizeof(xChangeDeviceKeyMappingReq) >> 2); ret = ChangeKeyMapping(client, dev, len, DeviceMappingNotify, stuff->firstKeyCode, stuff->keyCodes, stuff->keySymsPerKeyCode, (KeySym *) & stuff[1]); if (ret != Success) SendErrorToClient(client, IReqCode, X_ChangeDeviceKeyMapping, 0, ret); return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/chgkmap.h0000644000000000000000000000264313614532331016743 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef CHGKMAP_H #define CHGKMAP_H 1 int SProcXChangeDeviceKeyMapping(ClientPtr /* client */ ); int ProcXChangeDeviceKeyMapping(ClientPtr /* client */ ); #endif /* CHGKMAP_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/chgprop.c0000644000000000000000000001232313614532331016762 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Function to modify the dont-propagate-list for an extension input device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" #include "chgprop.h" #include "grabdev.h" /*********************************************************************** * * This procedure returns the extension version. * */ int SProcXChangeDeviceDontPropagateList(register ClientPtr client) { REQUEST(xChangeDeviceDontPropagateListReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq); swapl(&stuff->window); swaps(&stuff->count); REQUEST_FIXED_SIZE(xChangeDeviceDontPropagateListReq, stuff->count * sizeof(CARD32)); SwapLongs((CARD32 *) (&stuff[1]), stuff->count); return (ProcXChangeDeviceDontPropagateList(client)); } /*********************************************************************** * * This procedure changes the dont-propagate list for the specified window. * */ int ProcXChangeDeviceDontPropagateList(register ClientPtr client) { int i; WindowPtr pWin; struct tmask tmp[EMASKSIZE]; OtherInputMasks *others; REQUEST(xChangeDeviceDontPropagateListReq); REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq); if (stuff->length != (sizeof(xChangeDeviceDontPropagateListReq) >> 2) + stuff->count) { SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0, BadLength); return Success; } pWin = (WindowPtr) LookupWindow(stuff->window, client); if (!pWin) { client->errorValue = stuff->window; SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0, BadWindow); return Success; } if (stuff->mode != AddToList && stuff->mode != DeleteFromList) { client->errorValue = stuff->window; SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0, BadMode); return Success; } if (CreateMaskFromList(client, (XEventClass *) & stuff[1], stuff->count, tmp, NULL, X_ChangeDeviceDontPropagateList) != Success) return Success; others = wOtherInputMasks(pWin); if (!others && stuff->mode == DeleteFromList) return Success; for (i = 0; i < EMASKSIZE; i++) { if (tmp[i].mask == 0) continue; if (stuff->mode == DeleteFromList) tmp[i].mask = (others->dontPropagateMask[i] & ~tmp[i].mask); else if (others) tmp[i].mask |= others->dontPropagateMask[i]; if (DeviceEventSuppressForWindow(pWin, client, tmp[i].mask, i) != Success) { SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0, BadClass); return Success; } } return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/chgprop.h0000644000000000000000000000266113614532331016773 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef CHGPROP_H #define CHGPROP_H 1 int SProcXChangeDeviceDontPropagateList(ClientPtr /* client */ ); int ProcXChangeDeviceDontPropagateList(ClientPtr /* client */ ); #endif /* CHGPROP_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/chgptr.c0000644000000000000000000001576113614532331016620 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Extension function to change the pointer device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "XIstubs.h" #include "windowstr.h" /* window structure */ #include "scrnintstr.h" /* screen structure */ #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "dixevents.h" #include "exevents.h" #include "exglobals.h" #include "chgptr.h" /*********************************************************************** * * This procedure is invoked to swap the request bytes if the server and * client have a different byte order. * */ int SProcXChangePointerDevice(register ClientPtr client) { REQUEST(xChangePointerDeviceReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xChangePointerDeviceReq); return (ProcXChangePointerDevice(client)); } /*********************************************************************** * * This procedure changes the device used as the X pointer. * */ int ProcXChangePointerDevice(register ClientPtr client) { DeviceIntPtr xptr = inputInfo.pointer; DeviceIntPtr dev; ValuatorClassPtr v; xChangePointerDeviceReply rep; changeDeviceNotify ev; REQUEST(xChangePointerDeviceReq); REQUEST_SIZE_MATCH(xChangePointerDeviceReq); rep.repType = X_Reply; rep.RepType = X_ChangePointerDevice; rep.length = 0; rep.sequenceNumber = client->sequence; dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { rep.status = -1; SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadDevice); return Success; } v = dev->valuator; if (v == NULL || v->numAxes < 2 || stuff->xaxis >= v->numAxes || stuff->yaxis >= v->numAxes) { rep.status = -1; SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadMatch); return Success; } if (((dev->grab) && !SameClient(dev->grab, client)) || ((xptr->grab) && !SameClient(xptr->grab, client))) rep.status = AlreadyGrabbed; else if ((dev->sync.frozen && dev->sync.other && !SameClient(dev->sync.other, client)) || (xptr->sync.frozen && xptr->sync.other && !SameClient(xptr->sync.other, client))) rep.status = GrabFrozen; else { if (ChangePointerDevice(xptr, dev, stuff->xaxis, stuff->yaxis) != Success) { SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadDevice); return Success; } if (dev->focus) DeleteFocusClassDeviceStruct(dev); if (!dev->button) InitButtonClassDeviceStruct(dev, 0, NULL); if (!dev->ptrfeed) InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr) NoopDDA); RegisterOtherDevice(xptr); RegisterPointerDevice(dev); ev.type = ChangeDeviceNotify; ev.deviceid = stuff->deviceid; ev.time = currentTime.milliseconds; ev.request = NewPointer; SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1); SendMappingNotify(MappingPointer, 0, 0, client); rep.status = 0; } WriteReplyToClient(client, sizeof(xChangePointerDeviceReply), &rep); return Success; } void DeleteFocusClassDeviceStruct(DeviceIntPtr dev) { free(dev->focus->trace); free(dev->focus); dev->focus = NULL; } /*********************************************************************** * * Send an event to interested clients in all windows on all screens. * */ void SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count) { int i; WindowPtr pWin, p1; for (i = 0; i < screenInfo.numScreens; i++) { pWin = screenInfo.screens[i]->root; (void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id); p1 = pWin->firstChild; FindInterestedChildren(dev, p1, mask, ev, count); } } /*********************************************************************** * * Walk through the window tree, finding all clients that want to know * about the ChangeDeviceNotify Event. * */ void FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask, xEvent * ev, int count) { WindowPtr p2; while (p1) { p2 = p1->firstChild; (void)DeliverEventsToWindow(p1, ev, count, mask, NullGrab, dev->id); FindInterestedChildren(dev, p2, mask, ev, count); p1 = p1->nextSib; } } /*********************************************************************** * * This procedure writes the reply for the XChangePointerDevice * function, if the client and server have a different byte ordering. * */ void SRepXChangePointerDevice(ClientPtr client, int size, xChangePointerDeviceReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/chgptr.h0000644000000000000000000000370013614532331016613 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef CHGPTR_H #define CHGPTR_H 1 int SProcXChangePointerDevice(ClientPtr /* client */ ); int ProcXChangePointerDevice(ClientPtr /* client */ ); void DeleteFocusClassDeviceStruct(DeviceIntPtr /* dev */ ); void SendEventToAllWindows(DeviceIntPtr /* dev */ , Mask /* mask */ , xEvent * /* ev */ , int /* count */ ); void FindInterestedChildren( /* FIXME: could be static? */ DeviceIntPtr /* dev */ , WindowPtr /* p1 */ , Mask /* mask */ , xEvent * /* ev */ , int /* count */ ); void SRepXChangePointerDevice(ClientPtr /* client */ , int /* size */ , xChangePointerDeviceReply * /* rep */ ); #endif /* CHGPTR_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/closedev.c0000644000000000000000000001246413614532331017132 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Extension function to close an extension input device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ #include "scrnintstr.h" /* screen structure */ #include #include #include "XIstubs.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "closedev.h" /*********************************************************************** * * This procedure closes an input device. * */ int SProcXCloseDevice(register ClientPtr client) { REQUEST(xCloseDeviceReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xCloseDeviceReq); return (ProcXCloseDevice(client)); } /*********************************************************************** * * This procedure closes an input device. * */ int ProcXCloseDevice(register ClientPtr client) { int i; WindowPtr pWin, p1; DeviceIntPtr d; REQUEST(xCloseDeviceReq); REQUEST_SIZE_MATCH(xCloseDeviceReq); d = LookupDeviceIntRec(stuff->deviceid); if (d == NULL) { SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice); return Success; } if (d->grab && SameClient(d->grab, client)) (*d->DeactivateGrab) (d); /* release active grab */ /* Remove event selections from all windows for events from this device * and selected by this client. * Delete passive grabs from all windows for this device. */ for (i = 0; i < screenInfo.numScreens; i++) { pWin = screenInfo.screens[i]->root; DeleteDeviceEvents(d, pWin, client); p1 = pWin->firstChild; DeleteEventsFromChildren(d, p1, client); } CloseInputDevice(d, client); return Success; } /*********************************************************************** * * Walk througth the window tree, deleting event selections for this client * from this device from all windows. * */ void DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client) { WindowPtr p2; while (p1) { p2 = p1->firstChild; DeleteDeviceEvents(dev, p1, client); DeleteEventsFromChildren(dev, p2, client); p1 = p1->nextSib; } } /*********************************************************************** * * Clear out event selections and passive grabs from a window for the * specified device. * */ void DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) { InputClientsPtr others; OtherInputMasks *pOthers; GrabPtr grab, next; if ((pOthers = wOtherInputMasks(pWin)) != 0) for (others = pOthers->inputClients; others; others = others->next) if (SameClient(others, client)) others->mask[dev->id] = NoEventMask; for (grab = wPassiveGrabs(pWin); grab; grab = next) { next = grab->next; if ((grab->device == dev) && (client->clientAsMask == CLIENT_BITS(grab->resource))) FreeResource(grab->resource, RT_NONE); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/closedev.h0000644000000000000000000000317213614532331017133 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef CLOSEDEV_H #define CLOSEDEV_H 1 int SProcXCloseDevice(ClientPtr /* client */ ); int ProcXCloseDevice(ClientPtr /* client */ ); void DeleteEventsFromChildren(DeviceIntPtr /* dev */ , WindowPtr /* p1 */ , ClientPtr /* client */ ); void DeleteDeviceEvents(DeviceIntPtr /* dev */ , WindowPtr /* pWin */ , ClientPtr /* client */ ); #endif /* CLOSEDEV_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/devbell.c0000644000000000000000000001175513614532331016745 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Extension function to change the keyboard device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "devbell.h" /*********************************************************************** * * This procedure is invoked to swap the request bytes if the server and * client have a different byte order. * */ int SProcXDeviceBell(register ClientPtr client) { REQUEST(xDeviceBellReq); swaps(&stuff->length); return (ProcXDeviceBell(client)); } /*********************************************************************** * * This procedure rings a bell on an extension device. * */ int ProcXDeviceBell(register ClientPtr client) { DeviceIntPtr dev; KbdFeedbackPtr k; BellFeedbackPtr b; int base; int newpercent; CARD8 class; void * ctrl; BellProcPtr proc; REQUEST(xDeviceBellReq); REQUEST_SIZE_MATCH(xDeviceBellReq); dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { client->errorValue = stuff->deviceid; SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadDevice); return Success; } if (stuff->percent < -100 || stuff->percent > 100) { client->errorValue = stuff->percent; SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue); return Success; } if (stuff->feedbackclass == KbdFeedbackClass) { for (k = dev->kbdfeed; k; k = k->next) if (k->ctrl.id == stuff->feedbackid) break; if (!k) { client->errorValue = stuff->feedbackid; SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue); return Success; } base = k->ctrl.bell; proc = k->BellProc; ctrl = (void *) &(k->ctrl); class = KbdFeedbackClass; } else if (stuff->feedbackclass == BellFeedbackClass) { for (b = dev->bell; b; b = b->next) if (b->ctrl.id == stuff->feedbackid) break; if (!b) { client->errorValue = stuff->feedbackid; SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue); return Success; } base = b->ctrl.percent; proc = b->BellProc; ctrl = (void *) &(b->ctrl); class = BellFeedbackClass; } else { client->errorValue = stuff->feedbackclass; SendErrorToClient(client, IReqCode, X_DeviceBell, 0, BadValue); return Success; } newpercent = (base * stuff->percent) / 100; if (stuff->percent < 0) newpercent = base + newpercent; else newpercent = base - newpercent + stuff->percent; (*proc) (newpercent, dev, ctrl, class); return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/devbell.h0000644000000000000000000000261313614532331016743 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef DEVBELL_H #define DEVBELL_H 1 int SProcXDeviceBell(ClientPtr /* client */ ); int ProcXDeviceBell(ClientPtr /* client */ ); #endif /* DEVBELL_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/exevents.c0000644000000000000000000010215113614532331017160 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /******************************************************************** * * Routines to register and initialize extension input devices. * This also contains ProcessOtherEvent, the routine called from DDX * to route extension events. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include "inputstr.h" #include "windowstr.h" #include "miscstruct.h" #include "region.h" #include "exevents.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "dixevents.h" /* DeliverFocusedEvent */ #include "dixgrabs.h" /* CreateGrab() */ #include "chgptr.h" #define WID(w) ((w) ? ((w)->drawable.id) : 0) #define AllModifiersMask ( \ ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \ Mod3Mask | Mod4Mask | Mod5Mask ) #define AllButtonsMask ( \ Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) #define Motion_Filter(class) (DevicePointerMotionMask | \ (class)->state | (class)->motionMask) static Bool ShouldFreeInputMasks(WindowPtr /* pWin */ , Bool /* ignoreSelectedEvents */ ); static Bool MakeInputMasks(WindowPtr /* pWin */ ); /************************************************************************** * * Procedures for extension device event routing. * */ void RegisterOtherDevice(DeviceIntPtr device) { device->public.processInputProc = ProcessOtherEvent; device->public.realInputProc = ProcessOtherEvent; (device)->ActivateGrab = ActivateKeyboardGrab; (device)->DeactivateGrab = DeactivateKeyboardGrab; } /*ARGSUSED*/ void ProcessOtherEvent(xEventPtr xE, register DeviceIntPtr other, int count) { register BYTE *kptr; register int i; register CARD16 modifiers; register CARD16 mask; GrabPtr grab = other->grab; Bool deactivateDeviceGrab = FALSE; int key = 0, bit = 0, rootX, rootY; ButtonClassPtr b = other->button; KeyClassPtr k = other->key; ValuatorClassPtr v = other->valuator; deviceValuator *xV = (deviceValuator *) xE; if (xE->u.u.type != DeviceValuator) { GetSpritePosition(&rootX, &rootY); xE->u.keyButtonPointer.rootX = rootX; xE->u.keyButtonPointer.rootY = rootY; key = xE->u.u.detail; NoticeEventTime(xE); xE->u.keyButtonPointer.state = inputInfo.keyboard->key->state | inputInfo.pointer->button->state; bit = 1 << (key & 7); } if (DeviceEventCallback) { DeviceEventInfoRec eventinfo; eventinfo.events = (xEventPtr) xE; eventinfo.count = count; CallCallbacks(&DeviceEventCallback, (void *) & eventinfo); } for (i = 1; i < count; i++) if ((++xV)->type == DeviceValuator) { int first = xV->first_valuator; int *axisvals; if (xV->num_valuators && (!v || (xV->num_valuators && (first + xV->num_valuators > v->numAxes)))) FatalError("Bad valuators reported for device %s\n", other->name); xV->device_state = 0; if (k) xV->device_state |= k->state; if (b) xV->device_state |= b->state; if (v && v->axisVal) { axisvals = v->axisVal; switch (xV->num_valuators) { case 6: *(axisvals + first + 5) = xV->valuator5; case 5: *(axisvals + first + 4) = xV->valuator4; case 4: *(axisvals + first + 3) = xV->valuator3; case 3: *(axisvals + first + 2) = xV->valuator2; case 2: *(axisvals + first + 1) = xV->valuator1; case 1: *(axisvals + first) = xV->valuator0; case 0: default: break; } } } if (xE->u.u.type == DeviceKeyPress) { if (!k) return; modifiers = k->modifierMap[key]; kptr = &k->down[key >> 3]; if (*kptr & bit) { /* allow ddx to generate multiple downs */ if (!modifiers) { xE->u.u.type = DeviceKeyRelease; ProcessOtherEvent(xE, other, count); xE->u.u.type = DeviceKeyPress; /* release can have side effects, don't fall through */ ProcessOtherEvent(xE, other, count); } return; } if (other->valuator) other->valuator->motionHintWindow = NullWindow; *kptr |= bit; k->prev_state = k->state; for (i = 0, mask = 1; modifiers; i++, mask <<= 1) { if (mask & modifiers) { /* This key affects modifier "i" */ k->modifierKeyCount[i]++; k->state |= mask; modifiers &= ~mask; } } if (!grab && CheckDeviceGrabs(other, xE, 0, count)) { other->activatingKey = key; return; } } else if (xE->u.u.type == DeviceKeyRelease) { if (!k) return; kptr = &k->down[key >> 3]; if (!(*kptr & bit)) /* guard against duplicates */ return; modifiers = k->modifierMap[key]; if (other->valuator) other->valuator->motionHintWindow = NullWindow; *kptr &= ~bit; k->prev_state = k->state; for (i = 0, mask = 1; modifiers; i++, mask <<= 1) { if (mask & modifiers) { /* This key affects modifier "i" */ if (--k->modifierKeyCount[i] <= 0) { k->modifierKeyCount[i] = 0; k->state &= ~mask; } modifiers &= ~mask; } } if (other->fromPassiveGrab && (key == other->activatingKey)) deactivateDeviceGrab = TRUE; } else if (xE->u.u.type == DeviceButtonPress) { if (!b) return; kptr = &b->down[key >> 3]; *kptr |= bit; if (other->valuator) other->valuator->motionHintWindow = NullWindow; b->buttonsDown++; b->motionMask = DeviceButtonMotionMask; xE->u.u.detail = b->map[key]; if (xE->u.u.detail == 0) return; if (xE->u.u.detail <= 5) b->state |= (Button1Mask >> 1) << xE->u.u.detail; SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify); if (!grab) if (CheckDeviceGrabs(other, xE, 0, count)) return; } else if (xE->u.u.type == DeviceButtonRelease) { if (!b) return; kptr = &b->down[key >> 3]; *kptr &= ~bit; if (other->valuator) other->valuator->motionHintWindow = NullWindow; if (!--b->buttonsDown) b->motionMask = 0; xE->u.u.detail = b->map[key]; if (xE->u.u.detail == 0) return; if (xE->u.u.detail <= 5) b->state &= ~((Button1Mask >> 1) << xE->u.u.detail); SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify); if (!b->state && other->fromPassiveGrab) deactivateDeviceGrab = TRUE; } else if (xE->u.u.type == ProximityIn) other->valuator->mode &= ~OutOfProximity; else if (xE->u.u.type == ProximityOut) other->valuator->mode |= OutOfProximity; if (grab) DeliverGrabbedEvent(xE, other, deactivateDeviceGrab, count); else if (other->focus) DeliverFocusedEvent(other, xE, GetSpriteWindow(), count); else DeliverDeviceEvents(GetSpriteWindow(), xE, NullGrab, NullWindow, other, count); if (deactivateDeviceGrab == TRUE) (*other->DeactivateGrab) (other); } int InitProximityClassDeviceStruct(DeviceIntPtr dev) { register ProximityClassPtr proxc; proxc = (ProximityClassPtr) malloc(sizeof(ProximityClassRec)); if (!proxc) return FALSE; dev->proximity = proxc; return TRUE; } void InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval, int resolution, int min_res, int max_res) { register AxisInfoPtr ax = dev->valuator->axes + axnum; ax->min_value = minval; ax->max_value = maxval; ax->resolution = resolution; ax->min_resolution = min_res; ax->max_resolution = max_res; } static void FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k, ButtonClassPtr b, ValuatorClassPtr v, int first) { ev->type = DeviceStateNotify; ev->deviceid = dev->id; ev->time = currentTime.milliseconds; ev->classes_reported = 0; ev->num_keys = 0; ev->num_buttons = 0; ev->num_valuators = 0; if (b) { ev->classes_reported |= (1 << ButtonClass); ev->num_buttons = b->numButtons; memmove((char *)&ev->buttons[0], (char *)b->down, 4); } else if (k) { ev->classes_reported |= (1 << KeyClass); ev->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode; memmove((char *)&ev->keys[0], (char *)k->down, 4); } if (v) { int nval = v->numAxes - first; ev->classes_reported |= (1 << ValuatorClass); ev->classes_reported |= (dev->valuator->mode << ModeBitsShift); ev->num_valuators = nval < 3 ? nval : 3; switch (ev->num_valuators) { case 3: ev->valuator2 = v->axisVal[first + 2]; case 2: ev->valuator1 = v->axisVal[first + 1]; case 1: ev->valuator0 = v->axisVal[first]; break; } } } static void FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v, int first) { int nval = v->numAxes - first; ev->type = DeviceValuator; ev->deviceid = dev->id; ev->num_valuators = nval < 3 ? nval : 3; ev->first_valuator = first; switch (ev->num_valuators) { case 3: ev->valuator2 = v->axisVal[first + 2]; case 2: ev->valuator1 = v->axisVal[first + 1]; case 1: ev->valuator0 = v->axisVal[first]; break; } first += ev->num_valuators; } void DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register WindowPtr pWin) { deviceFocus event; if (type == FocusIn) type = DeviceFocusIn; else type = DeviceFocusOut; event.deviceid = dev->id; event.mode = mode; event.type = type; event.detail = detail; event.window = pWin->drawable.id; event.time = currentTime.milliseconds; (void)DeliverEventsToWindow(pWin, (xEvent *) & event, 1, DeviceFocusChangeMask, NullGrab, dev->id); if ((type == DeviceFocusIn) && (wOtherInputMasks(pWin)) && (wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask)) { int evcount = 1; deviceStateNotify *ev, *sev; deviceKeyStateNotify *kev; deviceButtonStateNotify *bev; KeyClassPtr k; ButtonClassPtr b; ValuatorClassPtr v; int nval = 0, nkeys = 0, nbuttons = 0, first = 0; if ((b = dev->button) != NULL) { nbuttons = b->numButtons; if (nbuttons > 32) evcount++; } if ((k = dev->key) != NULL) { nkeys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode; if (nkeys > 32) evcount++; if (nbuttons > 0) { evcount++; } } if ((v = dev->valuator) != NULL) { nval = v->numAxes; if (nval > 3) evcount++; if (nval > 6) { if (!(k && b)) evcount++; if (nval > 9) evcount += ((nval - 7) / 3); } } sev = ev = (deviceStateNotify *) malloc(evcount * sizeof(xEvent)); FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first); if (b != NULL) { FixDeviceStateNotify(dev, ev++, NULL, b, v, first); first += 3; nval -= 3; if (nbuttons > 32) { (ev - 1)->deviceid |= MORE_EVENTS; bev = (deviceButtonStateNotify *) ev++; bev->type = DeviceButtonStateNotify; bev->deviceid = dev->id; memmove((char *)&bev->buttons[0], (char *)&b->down[4], 28); } if (nval > 0) { (ev - 1)->deviceid |= MORE_EVENTS; FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); first += 3; nval -= 3; } } if (k != NULL) { FixDeviceStateNotify(dev, ev++, k, NULL, v, first); first += 3; nval -= 3; if (nkeys > 32) { (ev - 1)->deviceid |= MORE_EVENTS; kev = (deviceKeyStateNotify *) ev++; kev->type = DeviceKeyStateNotify; kev->deviceid = dev->id; memmove((char *)&kev->keys[0], (char *)&k->down[4], 28); } if (nval > 0) { (ev - 1)->deviceid |= MORE_EVENTS; FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); first += 3; nval -= 3; } } while (nval > 0) { FixDeviceStateNotify(dev, ev++, NULL, NULL, v, first); first += 3; nval -= 3; if (nval > 0) { (ev - 1)->deviceid |= MORE_EVENTS; FixDeviceValuator(dev, (deviceValuator *) ev++, v, first); first += 3; nval -= 3; } } (void)DeliverEventsToWindow(pWin, (xEvent *) sev, evcount, DeviceStateNotifyMask, NullGrab, dev->id); free(sev); } } int GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, BYTE other_devices_mode, CARD16 modifiers, DeviceIntPtr modifier_device, CARD8 button, Window grabWindow, BOOL ownerEvents, Cursor rcursor, Window rconfineTo, Mask eventMask) { WindowPtr pWin, confineTo; CursorPtr cursor; GrabPtr grab; if ((this_device_mode != GrabModeSync) && (this_device_mode != GrabModeAsync)) { client->errorValue = this_device_mode; return BadValue; } if ((other_devices_mode != GrabModeSync) && (other_devices_mode != GrabModeAsync)) { client->errorValue = other_devices_mode; return BadValue; } if ((modifiers != AnyModifier) && (modifiers & ~AllModifiersMask)) { client->errorValue = modifiers; return BadValue; } if ((ownerEvents != xFalse) && (ownerEvents != xTrue)) { client->errorValue = ownerEvents; return BadValue; } pWin = LookupWindow(grabWindow, client); if (!pWin) return BadWindow; if (rconfineTo == None) confineTo = NullWindow; else { confineTo = LookupWindow(rconfineTo, client); if (!confineTo) return BadWindow; } if (rcursor == None) cursor = NullCursor; else { cursor = (CursorPtr) LookupIDByType(rcursor, RT_CURSOR); if (!cursor) { client->errorValue = rcursor; return BadCursor; } } grab = CreateGrab(client->index, dev, pWin, eventMask, (Bool) ownerEvents, (Bool) this_device_mode, (Bool) other_devices_mode, modifier_device, modifiers, DeviceButtonPress, button, confineTo, cursor); if (!grab) return BadAlloc; return AddPassiveGrabToList(grab); } int GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, BYTE other_devices_mode, CARD16 modifiers, DeviceIntPtr modifier_device, CARD8 key, Window grabWindow, BOOL ownerEvents, Mask mask) { WindowPtr pWin; GrabPtr grab; KeyClassPtr k = dev->key; if (k == NULL) return BadMatch; if ((other_devices_mode != GrabModeSync) && (other_devices_mode != GrabModeAsync)) { client->errorValue = other_devices_mode; return BadValue; } if ((this_device_mode != GrabModeSync) && (this_device_mode != GrabModeAsync)) { client->errorValue = this_device_mode; return BadValue; } if (((key > k->curKeySyms.maxKeyCode) || (key < k->curKeySyms.minKeyCode)) && (key != AnyKey)) { client->errorValue = key; return BadValue; } if ((modifiers != AnyModifier) && (modifiers & ~AllModifiersMask)) { client->errorValue = modifiers; return BadValue; } if ((ownerEvents != xTrue) && (ownerEvents != xFalse)) { client->errorValue = ownerEvents; return BadValue; } pWin = LookupWindow(grabWindow, client); if (!pWin) return BadWindow; grab = CreateGrab(client->index, dev, pWin, mask, ownerEvents, this_device_mode, other_devices_mode, modifier_device, modifiers, DeviceKeyPress, key, NullWindow, NullCursor); if (!grab) return BadAlloc; return AddPassiveGrabToList(grab); } int SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client, Mask mask, Mask exclusivemasks, Mask validmasks) { int mskidx = dev->id; int i, ret; Mask check; InputClientsPtr others; if (mask & ~validmasks) { client->errorValue = mask; return BadValue; } check = (mask & exclusivemasks); if (wOtherInputMasks(pWin)) { if (check & wOtherInputMasks(pWin)->inputEvents[mskidx]) { /* It is illegal for two different * clients to select on any of the * events for maskcheck. However, * it is OK, for some client to * continue selecting on one of those * events. */ for (others = wOtherInputMasks(pWin)->inputClients; others; others = others->next) { if (!SameClient(others, client) && (check & others->mask[mskidx])) return BadAccess; } } for (others = wOtherInputMasks(pWin)->inputClients; others; others = others->next) { if (SameClient(others, client)) { check = others->mask[mskidx]; others->mask[mskidx] = mask; if (mask == 0) { for (i = 0; i < EMASKSIZE; i++) if (i != mskidx && others->mask[i] != 0) break; if (i == EMASKSIZE) { RecalculateDeviceDeliverableEvents(pWin); if (ShouldFreeInputMasks(pWin, FALSE)) FreeResource(others->resource, RT_NONE); return Success; } } goto maskSet; } } } check = 0; if ((ret = AddExtensionClient(pWin, client, mask, mskidx)) != Success) return ret; maskSet: if (dev->valuator) if ((dev->valuator->motionHintWindow == pWin) && (mask & DevicePointerMotionHintMask) && !(check & DevicePointerMotionHintMask) && !dev->grab) dev->valuator->motionHintWindow = NullWindow; RecalculateDeviceDeliverableEvents(pWin); return Success; } int AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx) { InputClientsPtr others; if (!pWin->optional && !MakeWindowOptional(pWin)) return BadAlloc; others = (InputClients *) malloc(sizeof(InputClients)); if (!others) return BadAlloc; if (!pWin->optional->inputMasks && !MakeInputMasks(pWin)) { free(others); return BadAlloc; } bzero((char *)&others->mask[0], sizeof(Mask) * EMASKSIZE); others->mask[mskidx] = mask; others->resource = FakeClientID(client->index); others->next = pWin->optional->inputMasks->inputClients; pWin->optional->inputMasks->inputClients = others; if (!AddResource(others->resource, RT_INPUTCLIENT, (void *) pWin)) return BadAlloc; return Success; } static Bool MakeInputMasks(WindowPtr pWin) { struct _OtherInputMasks *imasks; imasks = (struct _OtherInputMasks *) malloc(sizeof(struct _OtherInputMasks)); if (!imasks) return FALSE; bzero((char *)imasks, sizeof(struct _OtherInputMasks)); pWin->optional->inputMasks = imasks; return TRUE; } void RecalculateDeviceDeliverableEvents(WindowPtr pWin) { register InputClientsPtr others; struct _OtherInputMasks *inputMasks; /* default: NULL */ register WindowPtr pChild, tmp; int i; pChild = pWin; while (1) { if ((inputMasks = wOtherInputMasks(pChild)) != 0) { for (others = inputMasks->inputClients; others; others = others->next) { for (i = 0; i < EMASKSIZE; i++) inputMasks->inputEvents[i] |= others->mask[i]; } for (i = 0; i < EMASKSIZE; i++) inputMasks->deliverableEvents[i] = inputMasks->inputEvents[i]; for (tmp = pChild->parent; tmp; tmp = tmp->parent) if (wOtherInputMasks(tmp)) for (i = 0; i < EMASKSIZE; i++) inputMasks->deliverableEvents[i] |= (wOtherInputMasks(tmp)->deliverableEvents[i] & ~inputMasks-> dontPropagateMask[i] & PropagateMask[i]); } if (pChild->firstChild) { pChild = pChild->firstChild; continue; } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } } int InputClientGone(register WindowPtr pWin, XID id) { register InputClientsPtr other, prev; if (!wOtherInputMasks(pWin)) return (Success); prev = 0; for (other = wOtherInputMasks(pWin)->inputClients; other; other = other->next) { if (other->resource == id) { if (prev) { prev->next = other->next; free(other); } else if (!(other->next)) { if (ShouldFreeInputMasks(pWin, TRUE)) { wOtherInputMasks(pWin)->inputClients = other->next; free(wOtherInputMasks(pWin)); pWin->optional->inputMasks = (OtherInputMasks *) NULL; CheckWindowOptionalNeed(pWin); free(other); } else { other->resource = FakeClientID(0); if (!AddResource(other->resource, RT_INPUTCLIENT, (void *) pWin)) return BadAlloc; } } else { wOtherInputMasks(pWin)->inputClients = other->next; free(other); } RecalculateDeviceDeliverableEvents(pWin); return (Success); } prev = other; } FatalError("client not on device event list"); /*NOTREACHED*/ } int SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, xEvent * ev, Mask mask, int count) { WindowPtr pWin; WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */ WindowPtr spriteWin = GetSpriteWindow(); if (dest == PointerWindow) pWin = spriteWin; else if (dest == InputFocus) { WindowPtr inputFocus; if (!d->focus) inputFocus = spriteWin; else inputFocus = d->focus->win; if (inputFocus == FollowKeyboardWin) inputFocus = inputInfo.keyboard->focus->win; if (inputFocus == NoneWin) return Success; /* If the input focus is PointerRootWin, send the event to where * the pointer is if possible, then perhaps propogate up to root. */ if (inputFocus == PointerRootWin) inputFocus = GetCurrentRootWindow(); if (IsParent(inputFocus, spriteWin)) { effectiveFocus = inputFocus; pWin = spriteWin; } else effectiveFocus = pWin = inputFocus; } else pWin = LookupWindow(dest, client); if (!pWin) return BadWindow; if ((propagate != xFalse) && (propagate != xTrue)) { client->errorValue = propagate; return BadValue; } ev->u.u.type |= 0x80; if (propagate) { for (; pWin; pWin = pWin->parent) { if (DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, d->id)) return Success; if (pWin == effectiveFocus) return Success; if (wOtherInputMasks(pWin)) mask &= ~wOtherInputMasks(pWin)->dontPropagateMask[d->id]; if (!mask) break; } } else (void)(DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, d->id)); return Success; } int SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map) { register int i; ButtonClassPtr b = dev->button; if (b == NULL) return BadMatch; if (nElts != b->numButtons) { client->errorValue = nElts; return BadValue; } if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue)) return BadValue; for (i = 0; i < nElts; i++) if ((b->map[i + 1] != map[i]) && BitIsOn(b->down, i + 1)) return MappingBusy; for (i = 0; i < nElts; i++) b->map[i + 1] = map[i]; return Success; } int SetModifierMapping(ClientPtr client, DeviceIntPtr dev, int len, int rlen, int numKeyPerModifier, KeyCode * inputMap, KeyClassPtr * k) { KeyCode *map = NULL; int inputMapLen; register int i; *k = dev->key; if (*k == NULL) return BadMatch; if (len != ((numKeyPerModifier << 1) + rlen)) return BadLength; inputMapLen = 8 * numKeyPerModifier; /* * Now enforce the restriction that "all of the non-zero keycodes must be * in the range specified by min-keycode and max-keycode in the * connection setup (else a Value error)" */ i = inputMapLen; while (i--) { if (inputMap[i] && (inputMap[i] < (*k)->curKeySyms.minKeyCode || inputMap[i] > (*k)->curKeySyms.maxKeyCode)) { client->errorValue = inputMap[i]; return -1; /* BadValue collides with MappingFailed */ } } /* * Now enforce the restriction that none of the old or new * modifier keys may be down while we change the mapping, and * that the DDX layer likes the choice. */ if (!AllModifierKeysAreUp(dev, (*k)->modifierKeyMap, (int)(*k)->maxKeysPerModifier, inputMap, (int)numKeyPerModifier) || !AllModifierKeysAreUp(dev, inputMap, (int)numKeyPerModifier, (*k)->modifierKeyMap, (int)(*k)->maxKeysPerModifier)) { return MappingBusy; } else { for (i = 0; i < inputMapLen; i++) { if (inputMap[i] && !LegalModifier(inputMap[i], (DevicePtr) dev)) { return MappingFailed; } } } /* * Now build the keyboard's modifier bitmap from the * list of keycodes. */ if (inputMapLen) { map = (KeyCode *) malloc(inputMapLen); if (!map) return BadAlloc; } if ((*k)->modifierKeyMap) free((*k)->modifierKeyMap); if (inputMapLen) { (*k)->modifierKeyMap = map; memmove((char *)(*k)->modifierKeyMap, (char *)inputMap, inputMapLen); } else (*k)->modifierKeyMap = NULL; (*k)->maxKeysPerModifier = numKeyPerModifier; for (i = 0; i < MAP_LENGTH; i++) (*k)->modifierMap[i] = 0; for (i = 0; i < inputMapLen; i++) if (inputMap[i]) { (*k)->modifierMap[inputMap[i]] |= (1 << (i / (*k)->maxKeysPerModifier)); } return (MappingSuccess); } void SendDeviceMappingNotify(CARD8 request, KeyCode firstKeyCode, CARD8 count, DeviceIntPtr dev) { xEvent event; deviceMappingNotify *ev = (deviceMappingNotify *) & event; ev->type = DeviceMappingNotify; ev->request = request; ev->deviceid = dev->id; ev->time = currentTime.milliseconds; if (request == MappingKeyboard) { ev->firstKeyCode = firstKeyCode; ev->count = count; } SendEventToAllWindows(dev, DeviceMappingNotifyMask, (xEvent *) ev, 1); } int ChangeKeyMapping(ClientPtr client, DeviceIntPtr dev, unsigned len, int type, KeyCode firstKeyCode, CARD8 keyCodes, CARD8 keySymsPerKeyCode, KeySym * map) { KeySymsRec keysyms; KeyClassPtr k = dev->key; if (k == NULL) return (BadMatch); if (len != (keyCodes * keySymsPerKeyCode)) return BadLength; if ((firstKeyCode < k->curKeySyms.minKeyCode) || (firstKeyCode + keyCodes - 1 > k->curKeySyms.maxKeyCode)) { client->errorValue = firstKeyCode; return BadValue; } if (keySymsPerKeyCode == 0) { client->errorValue = 0; return BadValue; } keysyms.minKeyCode = firstKeyCode; keysyms.maxKeyCode = firstKeyCode + keyCodes - 1; keysyms.mapWidth = keySymsPerKeyCode; keysyms.map = map; if (!SetKeySymsMap(&k->curKeySyms, &keysyms)) return BadAlloc; SendDeviceMappingNotify(MappingKeyboard, firstKeyCode, keyCodes, dev); return client->noClientException; } void DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources) { int i; DeviceIntPtr dev; InputClientsPtr ic; struct _OtherInputMasks *inputMasks; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev == inputInfo.pointer || dev == inputInfo.keyboard) continue; DeleteDeviceFromAnyExtEvents(pWin, dev); } for (dev = inputInfo.off_devices; dev; dev = dev->next) DeleteDeviceFromAnyExtEvents(pWin, dev); if (freeResources) while ((inputMasks = wOtherInputMasks(pWin)) != 0) { ic = inputMasks->inputClients; for (i = 0; i < EMASKSIZE; i++) inputMasks->dontPropagateMask[i] = 0; FreeResource(ic->resource, RT_NONE); } } void DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev) { WindowPtr parent; /* Deactivate any grabs performed on this window, before making * any input focus changes. * Deactivating a device grab should cause focus events. */ if (dev->grab && (dev->grab->window == pWin)) (*dev->DeactivateGrab) (dev); /* If the focus window is a root window (ie. has no parent) * then don't delete the focus from it. */ if (dev->focus && (pWin == dev->focus->win) && (pWin->parent != NullWindow)) { int focusEventMode = NotifyNormal; /* If a grab is in progress, then alter the mode of focus events. */ if (dev->grab) focusEventMode = NotifyWhileGrabbed; switch (dev->focus->revert) { case RevertToNone: DoFocusEvents(dev, pWin, NoneWin, focusEventMode); dev->focus->win = NoneWin; dev->focus->traceGood = 0; break; case RevertToParent: parent = pWin; do { parent = parent->parent; dev->focus->traceGood--; } while (!parent->realized); DoFocusEvents(dev, pWin, parent, focusEventMode); dev->focus->win = parent; dev->focus->revert = RevertToNone; break; case RevertToPointerRoot: DoFocusEvents(dev, pWin, PointerRootWin, focusEventMode); dev->focus->win = PointerRootWin; dev->focus->traceGood = 0; break; case RevertToFollowKeyboard: if (inputInfo.keyboard->focus->win) { DoFocusEvents(dev, pWin, inputInfo.keyboard->focus->win, focusEventMode); dev->focus->win = FollowKeyboardWin; dev->focus->traceGood = 0; } else { DoFocusEvents(dev, pWin, NoneWin, focusEventMode); dev->focus->win = NoneWin; dev->focus->traceGood = 0; } break; } } if (dev->valuator) if (dev->valuator->motionHintWindow == pWin) dev->valuator->motionHintWindow = NullWindow; } int MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * pEvents, Mask mask) { DeviceIntPtr dev; dev = LookupDeviceIntRec(pEvents->deviceid & DEVICE_BITS); if (!dev) return 0; if (pEvents->type == DeviceMotionNotify) { if (mask & DevicePointerMotionHintMask) { if (WID(dev->valuator->motionHintWindow) == pEvents->event) { return 1; /* don't send, but pretend we did */ } pEvents->detail = NotifyHint; } else { pEvents->detail = NotifyNormal; } } return (0); } void CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type, deviceKeyButtonPointer * xE, GrabPtr grab, ClientPtr client, Mask deliveryMask) { DeviceIntPtr dev; dev = LookupDeviceIntRec(xE->deviceid & DEVICE_BITS); if (!dev) return; if (type == DeviceMotionNotify) dev->valuator->motionHintWindow = pWin; else if ((type == DeviceButtonPress) && (!grab) && (deliveryMask & DeviceButtonGrabMask)) { GrabRec tempGrab; tempGrab.device = dev; tempGrab.resource = client->clientAsMask; tempGrab.window = pWin; tempGrab.ownerEvents = (deliveryMask & DeviceOwnerGrabButtonMask) ? TRUE : FALSE; tempGrab.eventMask = deliveryMask; tempGrab.keyboardMode = GrabModeAsync; tempGrab.pointerMode = GrabModeAsync; tempGrab.confineTo = NullWindow; tempGrab.cursor = NullCursor; (*dev->ActivateGrab) (dev, &tempGrab, currentTime, TRUE); } } Mask DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) { register InputClientsPtr other; if (!wOtherInputMasks(pWin)) return 0; for (other = wOtherInputMasks(pWin)->inputClients; other; other = other->next) { if (SameClient(other, client)) return other->mask[dev->id]; } return 0; } void MaybeStopDeviceHint(register DeviceIntPtr dev, ClientPtr client) { WindowPtr pWin; GrabPtr grab = dev->grab; pWin = dev->valuator->motionHintWindow; if ((grab && SameClient(grab, client) && ((grab->eventMask & DevicePointerMotionHintMask) || (grab->ownerEvents && (DeviceEventMaskForClient(dev, pWin, client) & DevicePointerMotionHintMask)))) || (!grab && (DeviceEventMaskForClient(dev, pWin, client) & DevicePointerMotionHintMask))) dev->valuator->motionHintWindow = NullWindow; } int DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask, int maskndx) { struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin); if (mask & ~PropagateMask[maskndx]) { client->errorValue = mask; return BadValue; } if (mask == 0) { if (inputMasks) inputMasks->dontPropagateMask[maskndx] = mask; } else { if (!inputMasks) AddExtensionClient(pWin, client, 0, 0); inputMasks = wOtherInputMasks(pWin); inputMasks->dontPropagateMask[maskndx] = mask; } RecalculateDeviceDeliverableEvents(pWin); if (ShouldFreeInputMasks(pWin, FALSE)) FreeResource(inputMasks->inputClients->resource, RT_NONE); return Success; } static Bool ShouldFreeInputMasks(WindowPtr pWin, Bool ignoreSelectedEvents) { int i; Mask allInputEventMasks = 0; struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin); for (i = 0; i < EMASKSIZE; i++) allInputEventMasks |= inputMasks->dontPropagateMask[i]; if (!ignoreSelectedEvents) for (i = 0; i < EMASKSIZE; i++) allInputEventMasks |= inputMasks->inputEvents[i]; if (allInputEventMasks == 0) return TRUE; else return FALSE; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/exglobals.h0000644000000000000000000000464213614532331017312 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /***************************************************************** * * Globals referenced elsewhere in the server. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef EXGLOBALS_H #define EXGLOBALS_H 1 extern int IReqCode; extern int BadDevice; extern int BadEvent; extern int BadMode; extern int DeviceBusy; extern int BadClass; extern Mask DevicePointerMotionMask; extern Mask DevicePointerMotionHintMask; extern Mask DeviceFocusChangeMask; extern Mask DeviceStateNotifyMask; extern Mask ChangeDeviceNotifyMask; extern Mask DeviceMappingNotifyMask; extern Mask DeviceOwnerGrabButtonMask; extern Mask DeviceButtonGrabMask; extern Mask DeviceButtonMotionMask; extern Mask PropagateMask[]; extern int DeviceValuator; extern int DeviceKeyPress; extern int DeviceKeyRelease; extern int DeviceButtonPress; extern int DeviceButtonRelease; extern int DeviceMotionNotify; extern int DeviceFocusIn; extern int DeviceFocusOut; extern int ProximityIn; extern int ProximityOut; extern int DeviceStateNotify; extern int DeviceKeyStateNotify; extern int DeviceButtonStateNotify; extern int DeviceMappingNotify; extern int ChangeDeviceNotify; extern int RT_INPUTCLIENT; #if 0 /* FIXME: in dix */ extern InputInfo inputInfo; #endif #endif /* EXGLOBALS_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/extinit.c0000644000000000000000000007367013614532331017020 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /******************************************************************** * * Dispatch routines and initialization routines for the X input extension. * */ #define NUMTYPES 15 #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "inputstr.h" #include "gcstruct.h" /* pointer for extnsionst.h */ #include "extnsionst.h" /* extension entry */ #include #include #include "dixevents.h" #include "exevents.h" #include "extinit.h" #include "exglobals.h" #include "swaprep.h" #include "protocol-versions.h" /* modules local to Xi */ #include "allowev.h" #include "chgdctl.h" #include "chgfctl.h" #include "chgkbd.h" #include "chgprop.h" #include "chgptr.h" #include "closedev.h" #include "devbell.h" #include "getbmap.h" #include "getbmap.h" #include "getdctl.h" #include "getfctl.h" #include "getfocus.h" #include "getkmap.h" #include "getmmap.h" #include "getprop.h" #include "getselev.h" #include "getvers.h" #include "getvers.h" #include "grabdev.h" #include "grabdevb.h" #include "grabdevk.h" #include "gtmotion.h" #include "listdev.h" #include "opendev.h" #include "queryst.h" #include "selectev.h" #include "sendexev.h" #include "chgkmap.h" #include "setbmap.h" #include "setdval.h" #include "setfocus.h" #include "setmmap.h" #include "setmode.h" #include "ungrdev.h" #include "ungrdevb.h" #include "ungrdevk.h" static Mask lastExtEventMask = 1; int ExtEventIndex; Mask ExtValidMasks[EMASKSIZE]; Mask ExtExclusiveMasks[EMASKSIZE]; struct dev_type { Atom type; char *name; } dev_type[] = { { 0, XI_KEYBOARD}, { 0, XI_MOUSE}, { 0, XI_TABLET}, { 0, XI_TOUCHSCREEN}, { 0, XI_TOUCHPAD}, { 0, XI_BARCODE}, { 0, XI_BUTTONBOX}, { 0, XI_KNOB_BOX}, { 0, XI_ONE_KNOB}, { 0, XI_NINE_KNOB}, { 0, XI_TRACKBALL}, { 0, XI_QUADRATURE}, { 0, XI_ID_MODULE}, { 0, XI_SPACEBALL}, { 0, XI_DATAGLOVE}, { 0, XI_EYETRACKER}, { 0, XI_CURSORKEYS}, { 0, XI_FOOTMOUSE}}; CARD8 event_base[numInputClasses]; XExtEventInfo EventInfo[32]; /***************************************************************** * * Globals referenced elsewhere in the server. * */ int IReqCode = 0; int BadDevice = 0; int BadEvent = 1; int BadMode = 2; int DeviceBusy = 3; int BadClass = 4; Mask DevicePointerMotionMask; Mask DevicePointerMotionHintMask; Mask DeviceFocusChangeMask; Mask DeviceStateNotifyMask; Mask ChangeDeviceNotifyMask; Mask DeviceMappingNotifyMask; Mask DeviceOwnerGrabButtonMask; Mask DeviceButtonGrabMask; Mask DeviceButtonMotionMask; int DeviceValuator; int DeviceKeyPress; int DeviceKeyRelease; int DeviceButtonPress; int DeviceButtonRelease; int DeviceMotionNotify; int DeviceFocusIn; int DeviceFocusOut; int ProximityIn; int ProximityOut; int DeviceStateNotify; int DeviceKeyStateNotify; int DeviceButtonStateNotify; int DeviceMappingNotify; int ChangeDeviceNotify; int RT_INPUTCLIENT; /***************************************************************** * * Externs defined elsewhere in the X server. * */ extern XExtensionVersion AllExtensionVersions[]; Mask PropagateMask[MAX_DEVICES]; /***************************************************************** * * Declarations of local routines. * */ static XExtensionVersion thisversion = {XI_Present, SERVER_XI_MAJOR_VERSION, SERVER_XI_MINOR_VERSION, }; /********************************************************************** * * IExtensionInit - initialize the input extension. * * Called from InitExtensions in main() or from QueryExtension() if the * extension is dynamically loaded. * * This extension has several events and errors. * */ void XInputExtensionInit(void) { ExtensionEntry *extEntry; extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch, SProcIDispatch, IResetProc, StandardMinorOpcode); if (extEntry) { IReqCode = extEntry->base; AllExtensionVersions[IReqCode - 128] = thisversion; MakeDeviceTypeAtoms(); RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone); FixExtensionEvents(extEntry); ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch; EventSwapVector[DeviceValuator] = SEventIDispatch; EventSwapVector[DeviceKeyPress] = SEventIDispatch; EventSwapVector[DeviceKeyRelease] = SEventIDispatch; EventSwapVector[DeviceButtonPress] = SEventIDispatch; EventSwapVector[DeviceButtonRelease] = SEventIDispatch; EventSwapVector[DeviceMotionNotify] = SEventIDispatch; EventSwapVector[DeviceFocusIn] = SEventIDispatch; EventSwapVector[DeviceFocusOut] = SEventIDispatch; EventSwapVector[ProximityIn] = SEventIDispatch; EventSwapVector[ProximityOut] = SEventIDispatch; EventSwapVector[DeviceStateNotify] = SEventIDispatch; EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch; EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch; EventSwapVector[DeviceMappingNotify] = SEventIDispatch; EventSwapVector[ChangeDeviceNotify] = SEventIDispatch; } else { FatalError("IExtensionInit: AddExtensions failed\n"); } } /************************************************************************* * * ProcIDispatch - main dispatch routine for requests to this extension. * This routine is used if server and client have the same byte ordering. * */ int ProcIDispatch(register ClientPtr client) { REQUEST(xReq); if (stuff->data == X_GetExtensionVersion) return (ProcXGetExtensionVersion(client)); if (stuff->data == X_ListInputDevices) return (ProcXListInputDevices(client)); else if (stuff->data == X_OpenDevice) return (ProcXOpenDevice(client)); else if (stuff->data == X_CloseDevice) return (ProcXCloseDevice(client)); else if (stuff->data == X_SetDeviceMode) return (ProcXSetDeviceMode(client)); else if (stuff->data == X_SelectExtensionEvent) return (ProcXSelectExtensionEvent(client)); else if (stuff->data == X_GetSelectedExtensionEvents) return (ProcXGetSelectedExtensionEvents(client)); else if (stuff->data == X_ChangeDeviceDontPropagateList) return (ProcXChangeDeviceDontPropagateList(client)); else if (stuff->data == X_GetDeviceDontPropagateList) return (ProcXGetDeviceDontPropagateList(client)); else if (stuff->data == X_GetDeviceMotionEvents) return (ProcXGetDeviceMotionEvents(client)); else if (stuff->data == X_ChangeKeyboardDevice) return (ProcXChangeKeyboardDevice(client)); else if (stuff->data == X_ChangePointerDevice) return (ProcXChangePointerDevice(client)); else if (stuff->data == X_GrabDevice) return (ProcXGrabDevice(client)); else if (stuff->data == X_UngrabDevice) return (ProcXUngrabDevice(client)); else if (stuff->data == X_GrabDeviceKey) return (ProcXGrabDeviceKey(client)); else if (stuff->data == X_UngrabDeviceKey) return (ProcXUngrabDeviceKey(client)); else if (stuff->data == X_GrabDeviceButton) return (ProcXGrabDeviceButton(client)); else if (stuff->data == X_UngrabDeviceButton) return (ProcXUngrabDeviceButton(client)); else if (stuff->data == X_AllowDeviceEvents) return (ProcXAllowDeviceEvents(client)); else if (stuff->data == X_GetDeviceFocus) return (ProcXGetDeviceFocus(client)); else if (stuff->data == X_SetDeviceFocus) return (ProcXSetDeviceFocus(client)); else if (stuff->data == X_GetFeedbackControl) return (ProcXGetFeedbackControl(client)); else if (stuff->data == X_ChangeFeedbackControl) return (ProcXChangeFeedbackControl(client)); else if (stuff->data == X_GetDeviceKeyMapping) return (ProcXGetDeviceKeyMapping(client)); else if (stuff->data == X_ChangeDeviceKeyMapping) return (ProcXChangeDeviceKeyMapping(client)); else if (stuff->data == X_GetDeviceModifierMapping) return (ProcXGetDeviceModifierMapping(client)); else if (stuff->data == X_SetDeviceModifierMapping) return (ProcXSetDeviceModifierMapping(client)); else if (stuff->data == X_GetDeviceButtonMapping) return (ProcXGetDeviceButtonMapping(client)); else if (stuff->data == X_SetDeviceButtonMapping) return (ProcXSetDeviceButtonMapping(client)); else if (stuff->data == X_QueryDeviceState) return (ProcXQueryDeviceState(client)); else if (stuff->data == X_SendExtensionEvent) return (ProcXSendExtensionEvent(client)); else if (stuff->data == X_DeviceBell) return (ProcXDeviceBell(client)); else if (stuff->data == X_SetDeviceValuators) return (ProcXSetDeviceValuators(client)); else if (stuff->data == X_GetDeviceControl) return (ProcXGetDeviceControl(client)); else if (stuff->data == X_ChangeDeviceControl) return (ProcXChangeDeviceControl(client)); else { SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest); } return (BadRequest); } /******************************************************************************* * * SProcXDispatch * * Main swapped dispatch routine for requests to this extension. * This routine is used if server and client do not have the same byte ordering. * */ int SProcIDispatch(register ClientPtr client) { REQUEST(xReq); if (stuff->data == X_GetExtensionVersion) return (SProcXGetExtensionVersion(client)); if (stuff->data == X_ListInputDevices) return (SProcXListInputDevices(client)); else if (stuff->data == X_OpenDevice) return (SProcXOpenDevice(client)); else if (stuff->data == X_CloseDevice) return (SProcXCloseDevice(client)); else if (stuff->data == X_SetDeviceMode) return (SProcXSetDeviceMode(client)); else if (stuff->data == X_SelectExtensionEvent) return (SProcXSelectExtensionEvent(client)); else if (stuff->data == X_GetSelectedExtensionEvents) return (SProcXGetSelectedExtensionEvents(client)); else if (stuff->data == X_ChangeDeviceDontPropagateList) return (SProcXChangeDeviceDontPropagateList(client)); else if (stuff->data == X_GetDeviceDontPropagateList) return (SProcXGetDeviceDontPropagateList(client)); else if (stuff->data == X_GetDeviceMotionEvents) return (SProcXGetDeviceMotionEvents(client)); else if (stuff->data == X_ChangeKeyboardDevice) return (SProcXChangeKeyboardDevice(client)); else if (stuff->data == X_ChangePointerDevice) return (SProcXChangePointerDevice(client)); else if (stuff->data == X_GrabDevice) return (SProcXGrabDevice(client)); else if (stuff->data == X_UngrabDevice) return (SProcXUngrabDevice(client)); else if (stuff->data == X_GrabDeviceKey) return (SProcXGrabDeviceKey(client)); else if (stuff->data == X_UngrabDeviceKey) return (SProcXUngrabDeviceKey(client)); else if (stuff->data == X_GrabDeviceButton) return (SProcXGrabDeviceButton(client)); else if (stuff->data == X_UngrabDeviceButton) return (SProcXUngrabDeviceButton(client)); else if (stuff->data == X_AllowDeviceEvents) return (SProcXAllowDeviceEvents(client)); else if (stuff->data == X_GetDeviceFocus) return (SProcXGetDeviceFocus(client)); else if (stuff->data == X_SetDeviceFocus) return (SProcXSetDeviceFocus(client)); else if (stuff->data == X_GetFeedbackControl) return (SProcXGetFeedbackControl(client)); else if (stuff->data == X_ChangeFeedbackControl) return (SProcXChangeFeedbackControl(client)); else if (stuff->data == X_GetDeviceKeyMapping) return (SProcXGetDeviceKeyMapping(client)); else if (stuff->data == X_ChangeDeviceKeyMapping) return (SProcXChangeDeviceKeyMapping(client)); else if (stuff->data == X_GetDeviceModifierMapping) return (SProcXGetDeviceModifierMapping(client)); else if (stuff->data == X_SetDeviceModifierMapping) return (SProcXSetDeviceModifierMapping(client)); else if (stuff->data == X_GetDeviceButtonMapping) return (SProcXGetDeviceButtonMapping(client)); else if (stuff->data == X_SetDeviceButtonMapping) return (SProcXSetDeviceButtonMapping(client)); else if (stuff->data == X_QueryDeviceState) return (SProcXQueryDeviceState(client)); else if (stuff->data == X_SendExtensionEvent) return (SProcXSendExtensionEvent(client)); else if (stuff->data == X_DeviceBell) return (SProcXDeviceBell(client)); else if (stuff->data == X_SetDeviceValuators) return (SProcXSetDeviceValuators(client)); else if (stuff->data == X_GetDeviceControl) return (SProcXGetDeviceControl(client)); else if (stuff->data == X_ChangeDeviceControl) return (SProcXChangeDeviceControl(client)); else { SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest); } return (BadRequest); } /********************************************************************** * * SReplyIDispatch * Swap any replies defined in this extension. * */ /* FIXME: this would be more concise and readable in ANSI C */ #define DISPATCH(code) \ if (rep->RepType == X_##code) \ SRepX##code (client, len, (x##code##Reply *) rep) void SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) /* All we look at is the type field */ { /* This is common to all replies */ if (rep->RepType == X_GetExtensionVersion) SRepXGetExtensionVersion(client, len, (xGetExtensionVersionReply *) rep); else if (rep->RepType == X_ListInputDevices) SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep); else if (rep->RepType == X_OpenDevice) SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep); else if (rep->RepType == X_SetDeviceMode) SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep); else if (rep->RepType == X_GetSelectedExtensionEvents) SRepXGetSelectedExtensionEvents(client, len, (xGetSelectedExtensionEventsReply *) rep); else if (rep->RepType == X_GetDeviceDontPropagateList) SRepXGetDeviceDontPropagateList(client, len, (xGetDeviceDontPropagateListReply *) rep); else if (rep->RepType == X_GetDeviceMotionEvents) SRepXGetDeviceMotionEvents(client, len, (xGetDeviceMotionEventsReply *) rep); else if (rep->RepType == X_ChangeKeyboardDevice) SRepXChangeKeyboardDevice(client, len, (xChangeKeyboardDeviceReply *) rep); else if (rep->RepType == X_ChangePointerDevice) SRepXChangePointerDevice(client, len, (xChangePointerDeviceReply *) rep); else if (rep->RepType == X_GrabDevice) SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep); else if (rep->RepType == X_GetDeviceFocus) SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep); else if (rep->RepType == X_GetFeedbackControl) SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep); else if (rep->RepType == X_GetDeviceKeyMapping) SRepXGetDeviceKeyMapping(client, len, (xGetDeviceKeyMappingReply *) rep); else if (rep->RepType == X_GetDeviceModifierMapping) SRepXGetDeviceModifierMapping(client, len, (xGetDeviceModifierMappingReply *) rep); else if (rep->RepType == X_SetDeviceModifierMapping) SRepXSetDeviceModifierMapping(client, len, (xSetDeviceModifierMappingReply *) rep); else if (rep->RepType == X_GetDeviceButtonMapping) SRepXGetDeviceButtonMapping(client, len, (xGetDeviceButtonMappingReply *) rep); else if (rep->RepType == X_SetDeviceButtonMapping) SRepXSetDeviceButtonMapping(client, len, (xSetDeviceButtonMappingReply *) rep); else if (rep->RepType == X_QueryDeviceState) SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep); else if (rep->RepType == X_SetDeviceValuators) SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep); else if (rep->RepType == X_GetDeviceControl) SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep); else if (rep->RepType == X_ChangeDeviceControl) SRepXChangeDeviceControl(client, len, (xChangeDeviceControlReply *) rep); else { FatalError("XINPUT confused sending swapped reply"); } } /***************************************************************************** * * SEventIDispatch * * Swap any events defined in this extension. */ #define DO_SWAP(func,type) func ((type *)from, (type *)to) void SEventIDispatch(xEvent * from, xEvent * to) { int type = from->u.u.type & 0177; if (type == DeviceValuator) DO_SWAP(SEventDeviceValuator, deviceValuator); else if (type == DeviceKeyPress) { SKeyButtonPtrEvent(from, to); to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; } else if (type == DeviceKeyRelease) { SKeyButtonPtrEvent(from, to); to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; } else if (type == DeviceButtonPress) { SKeyButtonPtrEvent(from, to); to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; } else if (type == DeviceButtonRelease) { SKeyButtonPtrEvent(from, to); to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; } else if (type == DeviceMotionNotify) { SKeyButtonPtrEvent(from, to); to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; } else if (type == DeviceFocusIn) DO_SWAP(SEventFocus, deviceFocus); else if (type == DeviceFocusOut) DO_SWAP(SEventFocus, deviceFocus); else if (type == ProximityIn) { SKeyButtonPtrEvent(from, to); to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; } else if (type == ProximityOut) { SKeyButtonPtrEvent(from, to); to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; } else if (type == DeviceStateNotify) DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify); else if (type == DeviceKeyStateNotify) DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify); else if (type == DeviceButtonStateNotify) DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify); else if (type == DeviceMappingNotify) DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify); else if (type == ChangeDeviceNotify) DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify); else { FatalError("XInputExtension: Impossible event!\n"); } } /************************************************************************ * * This function swaps the DeviceValuator event. * */ void SEventDeviceValuator(deviceValuator * from, deviceValuator * to) { register int i; INT32 *ip B32; *to = *from; swaps(&to->sequenceNumber); swaps(&to->device_state); ip = &to->valuator0; for (i = 0; i < 6; i++) { swapl((ip + i)); /* macro - braces are required */ } } void SEventFocus(deviceFocus * from, deviceFocus * to) { *to = *from; swaps(&to->sequenceNumber); swapl(&to->time); swapl(&to->window); } void SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to) { register int i; INT32 *ip B32; *to = *from; swaps(&to->sequenceNumber); swapl(&to->time); ip = &to->valuator0; for (i = 0; i < 3; i++) { swapl((ip + i)); /* macro - braces are required */ } } void SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from, deviceKeyStateNotify * to) { *to = *from; swaps(&to->sequenceNumber); } void SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from, deviceButtonStateNotify * to) { *to = *from; swaps(&to->sequenceNumber); } void SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to) { *to = *from; swaps(&to->sequenceNumber); swapl(&to->time); } void SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to) { *to = *from; swaps(&to->sequenceNumber); swapl(&to->time); } /************************************************************************ * * This function sets up extension event types and masks. * */ void FixExtensionEvents(ExtensionEntry * extEntry) { Mask mask; DeviceValuator = extEntry->eventBase; DeviceKeyPress = DeviceValuator + 1; DeviceKeyRelease = DeviceKeyPress + 1; DeviceButtonPress = DeviceKeyRelease + 1; DeviceButtonRelease = DeviceButtonPress + 1; DeviceMotionNotify = DeviceButtonRelease + 1; DeviceFocusIn = DeviceMotionNotify + 1; DeviceFocusOut = DeviceFocusIn + 1; ProximityIn = DeviceFocusOut + 1; ProximityOut = ProximityIn + 1; DeviceStateNotify = ProximityOut + 1; DeviceMappingNotify = DeviceStateNotify + 1; ChangeDeviceNotify = DeviceMappingNotify + 1; DeviceKeyStateNotify = ChangeDeviceNotify + 1; DeviceButtonStateNotify = DeviceKeyStateNotify + 1; event_base[KeyClass] = DeviceKeyPress; event_base[ButtonClass] = DeviceButtonPress; event_base[ValuatorClass] = DeviceMotionNotify; event_base[ProximityClass] = ProximityIn; event_base[FocusClass] = DeviceFocusIn; event_base[OtherClass] = DeviceStateNotify; BadDevice += extEntry->errorBase; BadEvent += extEntry->errorBase; BadMode += extEntry->errorBase; DeviceBusy += extEntry->errorBase; BadClass += extEntry->errorBase; mask = GetNextExtEventMask(); SetMaskForExtEvent(mask, DeviceKeyPress); AllowPropagateSuppress(mask); mask = GetNextExtEventMask(); SetMaskForExtEvent(mask, DeviceKeyRelease); AllowPropagateSuppress(mask); mask = GetNextExtEventMask(); SetMaskForExtEvent(mask, DeviceButtonPress); AllowPropagateSuppress(mask); mask = GetNextExtEventMask(); SetMaskForExtEvent(mask, DeviceButtonRelease); AllowPropagateSuppress(mask); mask = GetNextExtEventMask(); SetMaskForExtEvent(mask, ProximityIn); SetMaskForExtEvent(mask, ProximityOut); AllowPropagateSuppress(mask); mask = GetNextExtEventMask(); DeviceStateNotifyMask = mask; SetMaskForExtEvent(mask, DeviceStateNotify); mask = GetNextExtEventMask(); DevicePointerMotionMask = mask; SetMaskForExtEvent(mask, DeviceMotionNotify); AllowPropagateSuppress(mask); DevicePointerMotionHintMask = GetNextExtEventMask(); SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint); SetEventInfo(GetNextExtEventMask(), _deviceButton1Motion); SetEventInfo(GetNextExtEventMask(), _deviceButton2Motion); SetEventInfo(GetNextExtEventMask(), _deviceButton3Motion); SetEventInfo(GetNextExtEventMask(), _deviceButton4Motion); SetEventInfo(GetNextExtEventMask(), _deviceButton5Motion); DeviceButtonMotionMask = GetNextExtEventMask(); SetEventInfo(DeviceButtonMotionMask, _deviceButtonMotion); DeviceFocusChangeMask = GetNextExtEventMask(); SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusIn); SetMaskForExtEvent(DeviceFocusChangeMask, DeviceFocusOut); mask = GetNextExtEventMask(); SetMaskForExtEvent(mask, DeviceMappingNotify); DeviceMappingNotifyMask = mask; mask = GetNextExtEventMask(); SetMaskForExtEvent(mask, ChangeDeviceNotify); ChangeDeviceNotifyMask = mask; DeviceButtonGrabMask = GetNextExtEventMask(); SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab); SetExclusiveAccess(DeviceButtonGrabMask); DeviceOwnerGrabButtonMask = GetNextExtEventMask(); SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton); SetEventInfo(0, _noExtensionEvent); } /************************************************************************ * * This function restores extension event types and masks to their * initial state. * */ void RestoreExtensionEvents(void) { int i; IReqCode = 0; for (i = 0; i < ExtEventIndex - 1; i++) { if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128)) SetMaskForEvent(0, EventInfo[i].type); EventInfo[i].mask = 0; EventInfo[i].type = 0; } ExtEventIndex = 0; lastExtEventMask = 1; DeviceValuator = 0; DeviceKeyPress = 1; DeviceKeyRelease = 2; DeviceButtonPress = 3; DeviceButtonRelease = 4; DeviceMotionNotify = 5; DeviceFocusIn = 6; DeviceFocusOut = 7; ProximityIn = 8; ProximityOut = 9; DeviceStateNotify = 10; DeviceMappingNotify = 11; ChangeDeviceNotify = 12; DeviceKeyStateNotify = 13; DeviceButtonStateNotify = 13; BadDevice = 0; BadEvent = 1; BadMode = 2; DeviceBusy = 3; BadClass = 4; } /*********************************************************************** * * IResetProc. * Remove reply-swapping routine. * Remove event-swapping routine. * */ void IResetProc(ExtensionEntry * unused) { ReplySwapVector[IReqCode] = ReplyNotSwappd; EventSwapVector[DeviceValuator] = NotImplemented; EventSwapVector[DeviceKeyPress] = NotImplemented; EventSwapVector[DeviceKeyRelease] = NotImplemented; EventSwapVector[DeviceButtonPress] = NotImplemented; EventSwapVector[DeviceButtonRelease] = NotImplemented; EventSwapVector[DeviceMotionNotify] = NotImplemented; EventSwapVector[DeviceFocusIn] = NotImplemented; EventSwapVector[DeviceFocusOut] = NotImplemented; EventSwapVector[ProximityIn] = NotImplemented; EventSwapVector[ProximityOut] = NotImplemented; EventSwapVector[DeviceStateNotify] = NotImplemented; EventSwapVector[DeviceKeyStateNotify] = NotImplemented; EventSwapVector[DeviceButtonStateNotify] = NotImplemented; EventSwapVector[DeviceMappingNotify] = NotImplemented; EventSwapVector[ChangeDeviceNotify] = NotImplemented; RestoreExtensionEvents(); } /*********************************************************************** * * Assign an id and type to an input device. * */ void AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name) { dev->type = type; dev->name = (char *)malloc(strlen(name) + 1); strcpy(dev->name, name); } /*********************************************************************** * * Make device type atoms. * */ void MakeDeviceTypeAtoms(void) { int i; for (i = 0; i < NUMTYPES; i++) dev_type[i].type = MakeAtom(dev_type[i].name, strlen(dev_type[i].name), 1); } /************************************************************************** * * Return a DeviceIntPtr corresponding to a specified device id. * This will not return the pointer or keyboard, or devices that are not on. * */ DeviceIntPtr LookupDeviceIntRec(CARD8 id) { DeviceIntPtr dev; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->id == id) { if (id == inputInfo.pointer->id || id == inputInfo.keyboard->id) return (NULL); return (dev); } } return (NULL); } /************************************************************************** * * Allow the specified event to be restricted to being selected by one * client at a time. * The default is to allow more than one client to select the event. * */ void SetExclusiveAccess(Mask mask) { int i; for (i = 0; i < MAX_DEVICES; i++) ExtExclusiveMasks[i] |= mask; } /************************************************************************** * * Allow the specified event to have its propagation suppressed. * The default is to not allow suppression of propagation. * */ void AllowPropagateSuppress(Mask mask) { int i; for (i = 0; i < MAX_DEVICES; i++) PropagateMask[i] |= mask; } /************************************************************************** * * Return the next available extension event mask. * */ Mask GetNextExtEventMask(void) { int i; Mask mask = lastExtEventMask; if (lastExtEventMask == 0) { FatalError("GetNextExtEventMask: no more events are available."); } lastExtEventMask <<= 1; for (i = 0; i < MAX_DEVICES; i++) ExtValidMasks[i] |= mask; return mask; } /************************************************************************** * * Assign the specified mask to the specified event. * */ void SetMaskForExtEvent(Mask mask, int event) { EventInfo[ExtEventIndex].mask = mask; EventInfo[ExtEventIndex++].type = event; if ((event < LASTEvent) || (event >= 128)) FatalError("MaskForExtensionEvent: bogus event number"); SetMaskForEvent(mask, event); } /************************************************************************** * * Record an event mask where there is no unique corresponding event type. * We can't call SetMaskForEvent, since that would clobber the existing * mask for that event. MotionHint and ButtonMotion are examples. * * Since extension event types will never be less than 64, we can use * 0-63 in the EventInfo array as the "type" to be used to look up this * mask. This means that the corresponding macros such as * DevicePointerMotionHint must have access to the same constants. * */ void SetEventInfo(Mask mask, int constant) { EventInfo[ExtEventIndex].mask = mask; EventInfo[ExtEventIndex++].type = constant; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getbmap.c0000644000000000000000000001105213614532331016735 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Extension function to return the version of the extension. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getbmap.h" /*********************************************************************** * * This procedure gets the button mapping for the specified device. * */ int SProcXGetDeviceButtonMapping(register ClientPtr client) { REQUEST(xGetDeviceButtonMappingReq); swaps(&stuff->length); return (ProcXGetDeviceButtonMapping(client)); } /*********************************************************************** * * This procedure gets the button mapping for the specified device. * */ int ProcXGetDeviceButtonMapping(register ClientPtr client) { DeviceIntPtr dev; xGetDeviceButtonMappingReply rep; ButtonClassPtr b; REQUEST(xGetDeviceButtonMappingReq); REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq); rep.repType = X_Reply; rep.RepType = X_GetDeviceButtonMapping; rep.nElts = 0; rep.length = 0; rep.sequenceNumber = client->sequence; dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0, BadDevice); return Success; } b = dev->button; if (b == NULL) { SendErrorToClient(client, IReqCode, X_GetDeviceButtonMapping, 0, BadMatch); return Success; } rep.nElts = b->numButtons; rep.length = (rep.nElts + (4 - 1)) / 4; WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep); WriteToClient(client, rep.nElts, &b->map[1]); return Success; } /*********************************************************************** * * This procedure writes the reply for the XGetDeviceButtonMapping function, * if the client and server have a different byte ordering. * */ void SRepXGetDeviceButtonMapping(ClientPtr client, int size, xGetDeviceButtonMappingReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getbmap.h0000644000000000000000000000305113614532331016742 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef GETBMAP_H #define GETBMAP_H 1 int SProcXGetDeviceButtonMapping(ClientPtr /* client */ ); int ProcXGetDeviceButtonMapping(ClientPtr /* client */ ); void SRepXGetDeviceButtonMapping(ClientPtr /* client */ , int /* size */ , xGetDeviceButtonMappingReply * /* rep */ ); #endif /* GETBMAP_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getdctl.c0000644000000000000000000001413513614532331016751 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /******************************************************************** * * Get Device control attributes for an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getdctl.h" /*********************************************************************** * * This procedure gets the control attributes for an extension device, * for clients on machines with a different byte ordering than the server. * */ int SProcXGetDeviceControl(register ClientPtr client) { REQUEST(xGetDeviceControlReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xGetDeviceControlReq); swaps(&stuff->control); return (ProcXGetDeviceControl(client)); } /*********************************************************************** * * Get the state of the specified device control. * */ int ProcXGetDeviceControl(ClientPtr client) { int total_length = 0; char *buf, *savbuf; register DeviceIntPtr dev; xGetDeviceControlReply rep; REQUEST(xGetDeviceControlReq); REQUEST_SIZE_MATCH(xGetDeviceControlReq); dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadDevice); return Success; } rep.repType = X_Reply; rep.RepType = X_GetDeviceControl; rep.length = 0; rep.sequenceNumber = client->sequence; switch (stuff->control) { case DEVICE_RESOLUTION: if (!dev->valuator) { SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadMatch); return Success; } total_length = sizeof(xDeviceResolutionState) + (3 * sizeof(int) * dev->valuator->numAxes); break; default: SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue); return Success; } buf = (char *)malloc(total_length); if (!buf) { SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadAlloc); return Success; } savbuf = buf; switch (stuff->control) { case DEVICE_RESOLUTION: CopySwapDeviceResolution(client, dev->valuator, buf, total_length); break; default: break; } rep.length = (total_length + 3) >> 2; WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep); WriteToClient(client, total_length, savbuf); free(savbuf); return Success; } /*********************************************************************** * * This procedure copies DeviceResolution data, swapping if necessary. * */ void CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf, int length) { AxisInfoPtr a; xDeviceResolutionState *r; int i, *iptr; r = (xDeviceResolutionState *) buf; r->control = DEVICE_RESOLUTION; r->length = length; r->num_valuators = v->numAxes; buf += sizeof(xDeviceResolutionState); iptr = (int *)buf; for (i = 0, a = v->axes; i < v->numAxes; i++, a++) *iptr++ = a->resolution; for (i = 0, a = v->axes; i < v->numAxes; i++, a++) *iptr++ = a->min_resolution; for (i = 0, a = v->axes; i < v->numAxes; i++, a++) *iptr++ = a->max_resolution; if (client->swapped) { swaps(&r->control); swaps(&r->length); swapl(&r->num_valuators); iptr = (int *)buf; for (i = 0; i < (3 * v->numAxes); i++, iptr++) { swapl(iptr); } } } /*********************************************************************** * * This procedure writes the reply for the xGetDeviceControl function, * if the client and server have a different byte ordering. * */ void SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getdctl.h0000644000000000000000000000325413614532331016756 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef GETDCTL_H #define GETDCTL_H 1 int SProcXGetDeviceControl(ClientPtr /* client */ ); int ProcXGetDeviceControl(ClientPtr /* client */ ); void CopySwapDeviceResolution(ClientPtr /* client */ , ValuatorClassPtr /* v */ , char * /* buf */ , int /* length */ ); void SRepXGetDeviceControl(ClientPtr /* client */ , int /* size */ , xGetDeviceControlReply * /* rep */ ); #endif /* GETDCTL_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getfctl.c0000644000000000000000000002514713614532331016760 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /******************************************************************** * * Get feedback control attributes for an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getfctl.h" /*********************************************************************** * * This procedure gets the control attributes for an extension device, * for clients on machines with a different byte ordering than the server. * */ int SProcXGetFeedbackControl(register ClientPtr client) { REQUEST(xGetFeedbackControlReq); swaps(&stuff->length); return (ProcXGetFeedbackControl(client)); } /*********************************************************************** * * Get the feedback control state. * */ int ProcXGetFeedbackControl(ClientPtr client) { int total_length = 0; char *buf, *savbuf; register DeviceIntPtr dev; KbdFeedbackPtr k; PtrFeedbackPtr p; IntegerFeedbackPtr i; StringFeedbackPtr s; BellFeedbackPtr b; LedFeedbackPtr l; xGetFeedbackControlReply rep; REQUEST(xGetFeedbackControlReq); REQUEST_SIZE_MATCH(xGetFeedbackControlReq); dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadDevice); return Success; } rep.repType = X_Reply; rep.RepType = X_GetFeedbackControl; rep.length = 0; rep.sequenceNumber = client->sequence; rep.num_feedbacks = 0; for (k = dev->kbdfeed; k; k = k->next) { rep.num_feedbacks++; total_length += sizeof(xKbdFeedbackState); } for (p = dev->ptrfeed; p; p = p->next) { rep.num_feedbacks++; total_length += sizeof(xPtrFeedbackState); } for (s = dev->stringfeed; s; s = s->next) { rep.num_feedbacks++; total_length += sizeof(xStringFeedbackState) + (s->ctrl.num_symbols_supported * sizeof(KeySym)); } for (i = dev->intfeed; i; i = i->next) { rep.num_feedbacks++; total_length += sizeof(xIntegerFeedbackState); } for (l = dev->leds; l; l = l->next) { rep.num_feedbacks++; total_length += sizeof(xLedFeedbackState); } for (b = dev->bell; b; b = b->next) { rep.num_feedbacks++; total_length += sizeof(xBellFeedbackState); } if (total_length == 0) { SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadMatch); return Success; } buf = (char *)malloc(total_length); if (!buf) { SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadAlloc); return Success; } savbuf = buf; for (k = dev->kbdfeed; k; k = k->next) CopySwapKbdFeedback(client, k, &buf); for (p = dev->ptrfeed; p; p = p->next) CopySwapPtrFeedback(client, p, &buf); for (s = dev->stringfeed; s; s = s->next) CopySwapStringFeedback(client, s, &buf); for (i = dev->intfeed; i; i = i->next) CopySwapIntegerFeedback(client, i, &buf); for (l = dev->leds; l; l = l->next) CopySwapLedFeedback(client, l, &buf); for (b = dev->bell; b; b = b->next) CopySwapBellFeedback(client, b, &buf); rep.length = (total_length + 3) >> 2; WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep); WriteToClient(client, total_length, savbuf); free(savbuf); return Success; } /*********************************************************************** * * This procedure copies KbdFeedbackClass data, swapping if necessary. * */ void CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf) { int i; xKbdFeedbackState *k2; k2 = (xKbdFeedbackState *) * buf; k2->class = KbdFeedbackClass; k2->length = sizeof(xKbdFeedbackState); k2->id = k->ctrl.id; k2->click = k->ctrl.click; k2->percent = k->ctrl.bell; k2->pitch = k->ctrl.bell_pitch; k2->duration = k->ctrl.bell_duration; k2->led_mask = k->ctrl.leds; k2->global_auto_repeat = k->ctrl.autoRepeat; for (i = 0; i < 32; i++) k2->auto_repeats[i] = k->ctrl.autoRepeats[i]; if (client->swapped) { swaps(&k2->length); swaps(&k2->pitch); swaps(&k2->duration); swapl(&k2->led_mask); swapl(&k2->led_values); } *buf += sizeof(xKbdFeedbackState); } /*********************************************************************** * * This procedure copies PtrFeedbackClass data, swapping if necessary. * */ void CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf) { xPtrFeedbackState *p2; p2 = (xPtrFeedbackState *) * buf; p2->class = PtrFeedbackClass; p2->length = sizeof(xPtrFeedbackState); p2->id = p->ctrl.id; p2->accelNum = p->ctrl.num; p2->accelDenom = p->ctrl.den; p2->threshold = p->ctrl.threshold; if (client->swapped) { swaps(&p2->length); swaps(&p2->accelNum); swaps(&p2->accelDenom); swaps(&p2->threshold); } *buf += sizeof(xPtrFeedbackState); } /*********************************************************************** * * This procedure copies IntegerFeedbackClass data, swapping if necessary. * */ void CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf) { xIntegerFeedbackState *i2; i2 = (xIntegerFeedbackState *) * buf; i2->class = IntegerFeedbackClass; i2->length = sizeof(xIntegerFeedbackState); i2->id = i->ctrl.id; i2->resolution = i->ctrl.resolution; i2->min_value = i->ctrl.min_value; i2->max_value = i->ctrl.max_value; if (client->swapped) { swaps(&i2->length); swapl(&i2->resolution); swapl(&i2->min_value); swapl(&i2->max_value); } *buf += sizeof(xIntegerFeedbackState); } /*********************************************************************** * * This procedure copies StringFeedbackClass data, swapping if necessary. * */ void CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf) { int i; xStringFeedbackState *s2; KeySym *kptr; s2 = (xStringFeedbackState *) * buf; s2->class = StringFeedbackClass; s2->length = sizeof(xStringFeedbackState) + s->ctrl.num_symbols_supported * sizeof(KeySym); s2->id = s->ctrl.id; s2->max_symbols = s->ctrl.max_symbols; s2->num_syms_supported = s->ctrl.num_symbols_supported; *buf += sizeof(xStringFeedbackState); kptr = (KeySym *) (*buf); for (i = 0; i < s->ctrl.num_symbols_supported; i++) *kptr++ = *(s->ctrl.symbols_supported + i); if (client->swapped) { swaps(&s2->length); swaps(&s2->max_symbols); swaps(&s2->num_syms_supported); kptr = (KeySym *) (*buf); for (i = 0; i < s->ctrl.num_symbols_supported; i++, kptr++) { swapl(kptr); } } *buf += (s->ctrl.num_symbols_supported * sizeof(KeySym)); } /*********************************************************************** * * This procedure copies LedFeedbackClass data, swapping if necessary. * */ void CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf) { xLedFeedbackState *l2; l2 = (xLedFeedbackState *) * buf; l2->class = LedFeedbackClass; l2->length = sizeof(xLedFeedbackState); l2->id = l->ctrl.id; l2->led_values = l->ctrl.led_values; l2->led_mask = l->ctrl.led_mask; if (client->swapped) { swaps(&l2->length); swapl(&l2->led_values); swapl(&l2->led_mask); } *buf += sizeof(xLedFeedbackState); } /*********************************************************************** * * This procedure copies BellFeedbackClass data, swapping if necessary. * */ void CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf) { xBellFeedbackState *b2; b2 = (xBellFeedbackState *) * buf; b2->class = BellFeedbackClass; b2->length = sizeof(xBellFeedbackState); b2->id = b->ctrl.id; b2->percent = b->ctrl.percent; b2->pitch = b->ctrl.pitch; b2->duration = b->ctrl.duration; if (client->swapped) { swaps(&b2->length); swaps(&b2->pitch); swaps(&b2->duration); } *buf += sizeof(xBellFeedbackState); } /*********************************************************************** * * This procedure writes the reply for the xGetFeedbackControl function, * if the client and server have a different byte ordering. * */ void SRepXGetFeedbackControl(ClientPtr client, int size, xGetFeedbackControlReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); swaps(&rep->num_feedbacks); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getfctl.h0000644000000000000000000000431513614532331016757 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef GETFCTL_H #define GETFCTL_H 1 int SProcXGetFeedbackControl(ClientPtr /* client */ ); int ProcXGetFeedbackControl(ClientPtr /* client */ ); void CopySwapKbdFeedback(ClientPtr /* client */ , KbdFeedbackPtr /* k */ , char ** /* buf */ ); void CopySwapPtrFeedback(ClientPtr /* client */ , PtrFeedbackPtr /* p */ , char ** /* buf */ ); void CopySwapIntegerFeedback(ClientPtr /* client */ , IntegerFeedbackPtr /* i */ , char ** /* buf */ ); void CopySwapStringFeedback(ClientPtr /* client */ , StringFeedbackPtr /* s */ , char ** /* buf */ ); void CopySwapLedFeedback(ClientPtr /* client */ , LedFeedbackPtr /* l */ , char ** /* buf */ ); void CopySwapBellFeedback(ClientPtr /* client */ , BellFeedbackPtr /* b */ , char ** /* buf */ ); void SRepXGetFeedbackControl(ClientPtr /* client */ , int /* size */ , xGetFeedbackControlReply * /* rep */ ); #endif /* GETFCTL_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getfocus.c0000644000000000000000000001105013614532331017133 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Extension function to get the focus for an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "windowstr.h" /* focus struct */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getfocus.h" /*********************************************************************** * * This procedure gets the focus for a device. * */ int SProcXGetDeviceFocus(register ClientPtr client) { REQUEST(xGetDeviceFocusReq); swaps(&stuff->length); return (ProcXGetDeviceFocus(client)); } /*********************************************************************** * * This procedure gets the focus for a device. * */ int ProcXGetDeviceFocus(ClientPtr client) { DeviceIntPtr dev; FocusClassPtr focus; xGetDeviceFocusReply rep; REQUEST(xGetDeviceFocusReq); REQUEST_SIZE_MATCH(xGetDeviceFocusReq); dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL || !dev->focus) { SendErrorToClient(client, IReqCode, X_GetDeviceFocus, 0, BadDevice); return Success; } rep.repType = X_Reply; rep.RepType = X_GetDeviceFocus; rep.length = 0; rep.sequenceNumber = client->sequence; focus = dev->focus; if (focus->win == NoneWin) rep.focus = None; else if (focus->win == PointerRootWin) rep.focus = PointerRoot; else if (focus->win == FollowKeyboardWin) rep.focus = FollowKeyboard; else rep.focus = focus->win->drawable.id; rep.time = focus->time.milliseconds; rep.revertTo = focus->revert; WriteReplyToClient(client, sizeof(xGetDeviceFocusReply), &rep); return Success; } /*********************************************************************** * * This procedure writes the reply for the GetDeviceFocus function, * if the client and server have a different byte ordering. * */ void SRepXGetDeviceFocus(ClientPtr client, int size, xGetDeviceFocusReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); swapl(&rep->focus); swapl(&rep->time); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getfocus.h0000644000000000000000000000301213614532331017137 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef GETFOCUS_H #define GETFOCUS_H 1 int SProcXGetDeviceFocus(ClientPtr /* client */ ); int ProcXGetDeviceFocus(ClientPtr /* client */ ); void SRepXGetDeviceFocus(ClientPtr /* client */ , int /* size */ , xGetDeviceFocusReply * /* rep */ ); #endif /* GETFOCUS_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getkmap.c0000644000000000000000000001222313614532331016747 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /******************************************************************** * * Get the key mapping for an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "swaprep.h" #include "getkmap.h" /*********************************************************************** * * This procedure gets the key mapping for an extension device, * for clients on machines with a different byte ordering than the server. * */ int SProcXGetDeviceKeyMapping(register ClientPtr client) { REQUEST(xGetDeviceKeyMappingReq); swaps(&stuff->length); return (ProcXGetDeviceKeyMapping(client)); } /*********************************************************************** * * Get the device key mapping. * */ int ProcXGetDeviceKeyMapping(register ClientPtr client) { xGetDeviceKeyMappingReply rep; DeviceIntPtr dev; KeySymsPtr k; REQUEST(xGetDeviceKeyMappingReq); REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq); dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadDevice); return Success; } if (dev->key == NULL) { SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadMatch); return Success; } k = &dev->key->curKeySyms; if ((stuff->firstKeyCode < k->minKeyCode) || (stuff->firstKeyCode > k->maxKeyCode)) { client->errorValue = stuff->firstKeyCode; SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue); return Success; } if (stuff->firstKeyCode + stuff->count > k->maxKeyCode + 1) { client->errorValue = stuff->count; SendErrorToClient(client, IReqCode, X_GetDeviceKeyMapping, 0, BadValue); return Success; } rep.repType = X_Reply; rep.RepType = X_GetDeviceKeyMapping; rep.sequenceNumber = client->sequence; rep.keySymsPerKeyCode = k->mapWidth; rep.length = (k->mapWidth * stuff->count); /* KeySyms are 4 bytes */ WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep); client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; WriteSwappedDataToClient(client, k->mapWidth * stuff->count * sizeof(KeySym), &k->map[(stuff->firstKeyCode - k->minKeyCode) * k->mapWidth]); return Success; } /*********************************************************************** * * This procedure writes the reply for the XGetDeviceKeyMapping function, * if the client and server have a different byte ordering. * */ void SRepXGetDeviceKeyMapping(ClientPtr client, int size, xGetDeviceKeyMappingReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getkmap.h0000644000000000000000000000304513614532331016756 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef GETKMAP_H #define GETKMAP_H 1 int SProcXGetDeviceKeyMapping(ClientPtr /* client */ ); int ProcXGetDeviceKeyMapping(ClientPtr /* client */ ); void SRepXGetDeviceKeyMapping(ClientPtr /* client */ , int /* size */ , xGetDeviceKeyMappingReply * /* rep */ ); #endif /* GETKMAP_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getmmap.c0000644000000000000000000001145113614532331016753 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /******************************************************************** * * Get the modifier mapping for an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include /* Request macro */ #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getmmap.h" /*********************************************************************** * * This procedure gets the modifier mapping for an extension device, * for clients on machines with a different byte ordering than the server. * */ int SProcXGetDeviceModifierMapping(register ClientPtr client) { REQUEST(xGetDeviceModifierMappingReq); swaps(&stuff->length); return (ProcXGetDeviceModifierMapping(client)); } /*********************************************************************** * * Get the device Modifier mapping. * */ int ProcXGetDeviceModifierMapping(ClientPtr client) { CARD8 maxkeys; DeviceIntPtr dev; xGetDeviceModifierMappingReply rep; KeyClassPtr kp; REQUEST(xGetDeviceModifierMappingReq); REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq); dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_GetDeviceModifierMapping, 0, BadDevice); return Success; } kp = dev->key; if (kp == NULL) { SendErrorToClient(client, IReqCode, X_GetDeviceModifierMapping, 0, BadMatch); return Success; } maxkeys = kp->maxKeysPerModifier; rep.repType = X_Reply; rep.RepType = X_GetDeviceModifierMapping; rep.numKeyPerModifier = maxkeys; rep.sequenceNumber = client->sequence; /* length counts 4 byte quantities - there are 8 modifiers 1 byte big */ rep.length = 2 * maxkeys; WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep); /* Reply with the (modified by DDX) map that SetModifierMapping passed in */ WriteToClient(client, 8 * maxkeys, kp->modifierKeyMap); return Success; } /*********************************************************************** * * This procedure writes the reply for the XGetDeviceModifierMapping function, * if the client and server have a different byte ordering. * */ void SRepXGetDeviceModifierMapping(ClientPtr client, int size, xGetDeviceModifierMappingReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getmmap.h0000644000000000000000000000306513614532331016762 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef GETMMAP_H #define GETMMAP_H 1 int SProcXGetDeviceModifierMapping(ClientPtr /* client */ ); int ProcXGetDeviceModifierMapping(ClientPtr /* client */ ); void SRepXGetDeviceModifierMapping(ClientPtr /* client */ , int /* size */ , xGetDeviceModifierMappingReply * /* rep */ ); #endif /* GETMMAP_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getprop.c0000644000000000000000000001367613614532331017014 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Function to return the dont-propagate-list for an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structs */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "swaprep.h" #include "getprop.h" extern XExtEventInfo EventInfo[]; extern int ExtEventIndex; /*********************************************************************** * * Handle a request from a client with a different byte order. * */ int SProcXGetDeviceDontPropagateList(register ClientPtr client) { REQUEST(xGetDeviceDontPropagateListReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq); swapl(&stuff->window); return (ProcXGetDeviceDontPropagateList(client)); } /*********************************************************************** * * This procedure lists the input devices available to the server. * */ int ProcXGetDeviceDontPropagateList(register ClientPtr client) { CARD16 count = 0; int i; XEventClass *buf = NULL, *tbuf; WindowPtr pWin; xGetDeviceDontPropagateListReply rep; OtherInputMasks *others; REQUEST(xGetDeviceDontPropagateListReq); REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq); rep.repType = X_Reply; rep.RepType = X_GetDeviceDontPropagateList; rep.sequenceNumber = client->sequence; rep.length = 0; rep.count = 0; pWin = (WindowPtr) LookupWindow(stuff->window, client); if (!pWin) { client->errorValue = stuff->window; SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0, BadWindow); return Success; } if ((others = wOtherInputMasks(pWin)) != 0) { for (i = 0; i < EMASKSIZE; i++) tbuf = ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT); if (count) { rep.count = count; buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass)); rep.length = (rep.count * sizeof(XEventClass) + 3) >> 2; tbuf = buf; for (i = 0; i < EMASKSIZE; i++) tbuf = ClassFromMask(tbuf, others->dontPropagateMask[i], i, NULL, CREATE); } } WriteReplyToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep); if (count) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf); free(buf); } return Success; } /*********************************************************************** * * This procedure gets a list of event classes from a mask word. * A single mask may translate to more than one event class. * */ XEventClass * ClassFromMask(XEventClass * buf, Mask mask, int maskndx, CARD16 * count, int mode) { int i, j; int id = maskndx; Mask tmask = 0x80000000; for (i = 0; i < 32; i++, tmask >>= 1) if (tmask & mask) { for (j = 0; j < ExtEventIndex; j++) if (EventInfo[j].mask == tmask) { if (mode == COUNT) (*count)++; else *buf++ = (id << 8) | EventInfo[j].type; } } return (buf); } /*********************************************************************** * * This procedure writes the reply for the XGetDeviceDontPropagateList function, * if the client and server have a different byte ordering. * */ void SRepXGetDeviceDontPropagateList(ClientPtr client, int size, xGetDeviceDontPropagateListReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); swaps(&rep->count); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getprop.h0000644000000000000000000000334213614532331017006 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef GETPROP_H #define GETPROP_H 1 int SProcXGetDeviceDontPropagateList(ClientPtr /* client */ ); int ProcXGetDeviceDontPropagateList(ClientPtr /* client */ ); XEventClass *ClassFromMask(XEventClass * /* buf */ , Mask /* mask */ , int /* maskndx */ , CARD16 * /* count */ , int /* mode */ ); void SRepXGetDeviceDontPropagateList(ClientPtr /* client */ , int /* size */ , xGetDeviceDontPropagateListReply * /* rep */ ); #endif /* GETPROP_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getselev.c0000644000000000000000000001374113614532331017143 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Extension function to get the current selected events for a given window. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include #include #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window struct */ #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "swaprep.h" #include "getprop.h" #include "getselev.h" /*********************************************************************** * * This procedure gets the current selected extension events. * */ int SProcXGetSelectedExtensionEvents(register ClientPtr client) { REQUEST(xGetSelectedExtensionEventsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq); swapl(&stuff->window); return (ProcXGetSelectedExtensionEvents(client)); } /*********************************************************************** * * This procedure gets the current device select mask, * if the client and server have a different byte ordering. * */ int ProcXGetSelectedExtensionEvents(register ClientPtr client) { int i; int total_length = 0; xGetSelectedExtensionEventsReply rep; WindowPtr pWin; XEventClass *buf = NULL; XEventClass *tclient; XEventClass *aclient; OtherInputMasks *pOthers; InputClientsPtr others; REQUEST(xGetSelectedExtensionEventsReq); REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq); rep.repType = X_Reply; rep.RepType = X_GetSelectedExtensionEvents; rep.length = 0; rep.sequenceNumber = client->sequence; rep.this_client_count = 0; rep.all_clients_count = 0; if (!(pWin = LookupWindow(stuff->window, client))) { SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0, BadWindow); return Success; } if ((pOthers = wOtherInputMasks(pWin)) != 0) { for (others = pOthers->inputClients; others; others = others->next) for (i = 0; i < EMASKSIZE; i++) tclient = ClassFromMask(NULL, others->mask[i], i, &rep.all_clients_count, COUNT); for (others = pOthers->inputClients; others; others = others->next) if (SameClient(others, client)) { for (i = 0; i < EMASKSIZE; i++) tclient = ClassFromMask(NULL, others->mask[i], i, &rep.this_client_count, COUNT); break; } total_length = (rep.all_clients_count + rep.this_client_count) * sizeof(XEventClass); rep.length = (total_length + 3) >> 2; buf = (XEventClass *) malloc(total_length); tclient = buf; aclient = buf + rep.this_client_count; if (others) for (i = 0; i < EMASKSIZE; i++) tclient = ClassFromMask(tclient, others->mask[i], i, NULL, CREATE); for (others = pOthers->inputClients; others; others = others->next) for (i = 0; i < EMASKSIZE; i++) aclient = ClassFromMask(aclient, others->mask[i], i, NULL, CREATE); } WriteReplyToClient(client, sizeof(xGetSelectedExtensionEventsReply), &rep); if (total_length) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, total_length, buf); free(buf); } return Success; } /*********************************************************************** * * This procedure writes the reply for the XGetSelectedExtensionEvents function, * if the client and server have a different byte ordering. * */ void SRepXGetSelectedExtensionEvents(ClientPtr client, int size, xGetSelectedExtensionEventsReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); swaps(&rep->this_client_count); swaps(&rep->all_clients_count); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getselev.h0000644000000000000000000000310413614532331017140 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef GETSELEV_H #define GETSELEV_H 1 int SProcXGetSelectedExtensionEvents(ClientPtr /* client */ ); int ProcXGetSelectedExtensionEvents(ClientPtr /* client */ ); void SRepXGetSelectedExtensionEvents(ClientPtr /* client */ , int /* size */ , xGetSelectedExtensionEventsReply * /* rep */ ); #endif /* GETSELEV_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getvers.c0000644000000000000000000001127713614532331017006 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Extension function to return the version of the extension. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getvers.h" XExtensionVersion AllExtensionVersions[128]; /*********************************************************************** * * Handle a request from a client with a different byte order than us. * */ int SProcXGetExtensionVersion(register ClientPtr client) { REQUEST(xGetExtensionVersionReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq); swaps(&stuff->nbytes); return (ProcXGetExtensionVersion(client)); } /*********************************************************************** * * This procedure lists the input devices available to the server. * */ int ProcXGetExtensionVersion(register ClientPtr client) { xGetExtensionVersionReply rep; REQUEST(xGetExtensionVersionReq); REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq); if (stuff->length != (sizeof(xGetExtensionVersionReq) + stuff->nbytes + 3) >> 2) { SendErrorToClient(client, IReqCode, X_GetExtensionVersion, 0, BadLength); return Success; } memset(&rep, 0, sizeof(xGetExtensionVersionReply)); rep.repType = X_Reply; rep.RepType = X_GetExtensionVersion; rep.length = 0; rep.sequenceNumber = client->sequence; rep.major_version = 0; rep.minor_version = 0; rep.present = TRUE; if (rep.present) { rep.major_version = AllExtensionVersions[IReqCode - 128].major_version; rep.minor_version = AllExtensionVersions[IReqCode - 128].minor_version; } WriteReplyToClient(client, sizeof(xGetExtensionVersionReply), &rep); return Success; } /*********************************************************************** * * This procedure writes the reply for the XGetExtensionVersion function, * if the client and server have a different byte ordering. * */ void SRepXGetExtensionVersion(ClientPtr client, int size, xGetExtensionVersionReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); swaps(&rep->major_version); swaps(&rep->minor_version); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/getvers.h0000644000000000000000000000304513614532331017005 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef GETVERS_H #define GETVERS_H 1 int SProcXGetExtensionVersion(ClientPtr /* client */ ); int ProcXGetExtensionVersion(ClientPtr /* client */ ); void SRepXGetExtensionVersion(ClientPtr /* client */ , int /* size */ , xGetExtensionVersionReply * /* rep */ ); #endif /* GETVERS_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/grabdevb.c0000644000000000000000000001215113614532331017073 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Extension function to grab a button on an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ #include #include #include "exevents.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "grabdev.h" #include "grabdevb.h" /*********************************************************************** * * Handle requests from clients with a different byte order. * */ int SProcXGrabDeviceButton(register ClientPtr client) { REQUEST(xGrabDeviceButtonReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq); swapl(&stuff->grabWindow); swaps(&stuff->modifiers); swaps(&stuff->event_count); REQUEST_FIXED_SIZE(xGrabDeviceButtonReq, stuff->event_count * sizeof(CARD32)); SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count); return (ProcXGrabDeviceButton(client)); } /*********************************************************************** * * Grab a button on an extension device. * */ int ProcXGrabDeviceButton(ClientPtr client) { int ret; DeviceIntPtr dev; DeviceIntPtr mdev; XEventClass *class; struct tmask tmp[EMASKSIZE]; REQUEST(xGrabDeviceButtonReq); REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq); if (stuff->length != (sizeof(xGrabDeviceButtonReq) >> 2) + stuff->event_count) { SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadLength); return Success; } dev = LookupDeviceIntRec(stuff->grabbed_device); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadDevice); return Success; } if (stuff->modifier_device != UseXKeyboard) { mdev = LookupDeviceIntRec(stuff->modifier_device); if (mdev == NULL) { SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadDevice); return Success; } if (mdev->key == NULL) { SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, BadMatch); return Success; } } else mdev = (DeviceIntPtr) LookupKeyboardDevice(); class = (XEventClass *) (&stuff[1]); /* first word of values */ if ((ret = CreateMaskFromList(client, class, stuff->event_count, tmp, dev, X_GrabDeviceButton)) != Success) return Success; ret = GrabButton(client, dev, stuff->this_device_mode, stuff->other_devices_mode, stuff->modifiers, mdev, stuff->button, stuff->grabWindow, stuff->ownerEvents, (Cursor) 0, (Window) 0, tmp[stuff->grabbed_device].mask); if (ret != Success) SendErrorToClient(client, IReqCode, X_GrabDeviceButton, 0, ret); return (Success); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/grabdevb.h0000644000000000000000000000263213614532331017103 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef GRABDEVB_H #define GRABDEVB_H 1 int SProcXGrabDeviceButton(ClientPtr /* client */ ); int ProcXGrabDeviceButton(ClientPtr /* client */ ); #endif /* GRABDEVB_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/grabdev.c0000644000000000000000000001412213614532331016731 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Extension function to grab an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "dixevents.h" /* GrabDevice */ #include "grabdev.h" extern XExtEventInfo EventInfo[]; extern int ExtEventIndex; /*********************************************************************** * * Swap the request if the requestor has a different byte order than us. * */ int SProcXGrabDevice(register ClientPtr client) { REQUEST(xGrabDeviceReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xGrabDeviceReq); swapl(&stuff->grabWindow); swapl(&stuff->time); swaps(&stuff->event_count); if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count) return BadLength; SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count); return (ProcXGrabDevice(client)); } /*********************************************************************** * * Grab an extension device. * */ int ProcXGrabDevice(ClientPtr client) { int error; xGrabDeviceReply rep; DeviceIntPtr dev; struct tmask tmp[EMASKSIZE]; REQUEST(xGrabDeviceReq); REQUEST_AT_LEAST_SIZE(xGrabDeviceReq); if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count) { SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadLength); return Success; } rep.repType = X_Reply; rep.RepType = X_GrabDevice; rep.sequenceNumber = client->sequence; rep.length = 0; dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_GrabDevice, 0, BadDevice); return Success; } if (CreateMaskFromList(client, (XEventClass *) & stuff[1], stuff->event_count, tmp, dev, X_GrabDevice) != Success) return Success; error = GrabDevice(client, dev, stuff->this_device_mode, stuff->other_devices_mode, stuff->grabWindow, stuff->ownerEvents, stuff->time, tmp[stuff->deviceid].mask, &rep.status); if (error != Success) { SendErrorToClient(client, IReqCode, X_GrabDevice, 0, error); return Success; } WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep); return Success; } /*********************************************************************** * * This procedure creates an event mask from a list of XEventClasses. * */ int CreateMaskFromList(ClientPtr client, XEventClass * list, int count, struct tmask *mask, DeviceIntPtr dev, int req) { int i, j; int device; DeviceIntPtr tdev; for (i = 0; i < EMASKSIZE; i++) { mask[i].mask = 0; mask[i].dev = NULL; } for (i = 0; i < count; i++, list++) { device = *list >> 8; if (device > 255) { SendErrorToClient(client, IReqCode, req, 0, BadClass); return BadClass; } tdev = LookupDeviceIntRec(device); if (tdev == NULL || (dev != NULL && tdev != dev)) { SendErrorToClient(client, IReqCode, req, 0, BadClass); return BadClass; } for (j = 0; j < ExtEventIndex; j++) if (EventInfo[j].type == (*list & 0xff)) { mask[device].mask |= EventInfo[j].mask; mask[device].dev = (Pointer) tdev; break; } } return Success; } /*********************************************************************** * * This procedure writes the reply for the XGrabDevice function, * if the client and server have a different byte ordering. * */ void SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/grabdev.h0000644000000000000000000000332213614532331016736 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef GRABDEV_H #define GRABDEV_H 1 int SProcXGrabDevice(ClientPtr /* client */ ); int ProcXGrabDevice(ClientPtr /* client */ ); int CreateMaskFromList(ClientPtr /* client */ , XEventClass * /* list */ , int /* count */ , struct tmask /* mask */ [], DeviceIntPtr /* dev */ , int /* req */ ); void SRepXGrabDevice(ClientPtr /* client */ , int /* size */ , xGrabDeviceReply * /* rep */ ); #endif /* GRABDEV_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/grabdevk.c0000644000000000000000000001177713614532331017121 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Extension function to grab a key on an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ #include #include #include "exevents.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "grabdev.h" #include "grabdevk.h" /*********************************************************************** * * Handle requests from clients with a different byte order. * */ int SProcXGrabDeviceKey(register ClientPtr client) { REQUEST(xGrabDeviceKeyReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq); swapl(&stuff->grabWindow); swaps(&stuff->modifiers); swaps(&stuff->event_count); REQUEST_FIXED_SIZE(xGrabDeviceKeyReq, stuff->event_count * sizeof(CARD32)); SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count); return (ProcXGrabDeviceKey(client)); } /*********************************************************************** * * Grab a key on an extension device. * */ int ProcXGrabDeviceKey(ClientPtr client) { int ret; DeviceIntPtr dev; DeviceIntPtr mdev; XEventClass *class; struct tmask tmp[EMASKSIZE]; REQUEST(xGrabDeviceKeyReq); REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq); if (stuff->length != (sizeof(xGrabDeviceKeyReq) >> 2) + stuff->event_count) { SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadLength); return Success; } dev = LookupDeviceIntRec(stuff->grabbed_device); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadDevice); return Success; } if (stuff->modifier_device != UseXKeyboard) { mdev = LookupDeviceIntRec(stuff->modifier_device); if (mdev == NULL) { SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadDevice); return Success; } if (mdev->key == NULL) { SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, BadMatch); return Success; } } else mdev = (DeviceIntPtr) LookupKeyboardDevice(); class = (XEventClass *) (&stuff[1]); /* first word of values */ if ((ret = CreateMaskFromList(client, class, stuff->event_count, tmp, dev, X_GrabDeviceKey)) != Success) return Success; ret = GrabKey(client, dev, stuff->this_device_mode, stuff->other_devices_mode, stuff->modifiers, mdev, stuff->key, stuff->grabWindow, stuff->ownerEvents, tmp[stuff->grabbed_device].mask); if (ret != Success) { SendErrorToClient(client, IReqCode, X_GrabDeviceKey, 0, ret); return Success; } return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/grabdevk.h0000644000000000000000000000262413614532331017115 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef GRABDEVK_H #define GRABDEVK_H 1 int SProcXGrabDeviceKey(ClientPtr /* client */ ); int ProcXGrabDeviceKey(ClientPtr /* client */ ); #endif /* GRABDEVK_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/gtmotion.c0000644000000000000000000001405013614532331017157 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Request to get the motion history from an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" #include "gtmotion.h" /*********************************************************************** * * Swap the request if server and client have different byte ordering. * */ int SProcXGetDeviceMotionEvents(register ClientPtr client) { REQUEST(xGetDeviceMotionEventsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq); swapl(&stuff->start); swapl(&stuff->stop); return (ProcXGetDeviceMotionEvents(client)); } /**************************************************************************** * * Get the motion history for an extension pointer devices. * */ int ProcXGetDeviceMotionEvents(ClientPtr client) { INT32 *coords = NULL, *bufptr; xGetDeviceMotionEventsReply rep; unsigned long i; int num_events, axes, size = 0, tsize; unsigned long nEvents; DeviceIntPtr dev; TimeStamp start, stop; int length = 0; ValuatorClassPtr v; REQUEST(xGetDeviceMotionEventsReq); REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq); dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, BadDevice); return Success; } v = dev->valuator; if (v == NULL || v->numAxes == 0) { SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, BadMatch); return Success; } if (dev->valuator->motionHintWindow) MaybeStopDeviceHint(dev, client); axes = v->numAxes; rep.repType = X_Reply; rep.RepType = X_GetDeviceMotionEvents; rep.sequenceNumber = client->sequence; rep.nEvents = 0; rep.axes = axes; rep.mode = v->mode & DeviceMode; rep.length = 0; start = ClientTimeToServerTime(stuff->start); stop = ClientTimeToServerTime(stuff->stop); if (CompareTimeStamps(start, stop) == LATER || CompareTimeStamps(start, currentTime) == LATER) { WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); return Success; } if (CompareTimeStamps(stop, currentTime) == LATER) stop = currentTime; num_events = v->numMotionEvents; if (num_events) { size = sizeof(Time) + (axes * sizeof(INT32)); tsize = num_events * size; coords = (INT32 *) malloc(tsize); if (!coords) { SendErrorToClient(client, IReqCode, X_GetDeviceMotionEvents, 0, BadAlloc); return Success; } rep.nEvents = (v->GetMotionProc) (dev, (xTimecoord *) coords, /* XXX */ start.milliseconds, stop.milliseconds, (ScreenPtr) NULL); } if (rep.nEvents > 0) { length = (rep.nEvents * size + 3) >> 2; rep.length = length; } nEvents = rep.nEvents; WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); if (nEvents) { if (client->swapped) { bufptr = coords; for (i = 0; i < nEvents * (axes + 1); i++) { swapl(bufptr); bufptr++; } } WriteToClient(client, length * 4, coords); } if (coords) free(coords); return Success; } /*********************************************************************** * * This procedure writes the reply for the XGetDeviceMotionEvents function, * if the client and server have a different byte ordering. * */ void SRepXGetDeviceMotionEvents(ClientPtr client, int size, xGetDeviceMotionEventsReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); swapl(&rep->nEvents); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/gtmotion.h0000644000000000000000000000304613614532331017167 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef GTMOTION_H #define GTMOTION_H 1 int SProcXGetDeviceMotionEvents(ClientPtr /* client */ ); int ProcXGetDeviceMotionEvents(ClientPtr /* client */ ); void SRepXGetDeviceMotionEvents(ClientPtr /* client */ , int /* size */ , xGetDeviceMotionEventsReply * /* rep */ ); #endif /* GTMOTION_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/Imakefile0000644000000000000000000000275613614532331016776 0ustar #include SRCS = allowev.c \ chgkbd.c \ chgdctl.c \ chgfctl.c \ chgkmap.c \ chgprop.c \ chgptr.c \ closedev.c \ devbell.c \ exevents.c \ extinit.c \ getdctl.c \ getfctl.c \ getfocus.c \ getbmap.c \ getkmap.c \ getmmap.c \ getprop.c \ getselev.c \ getvers.c \ gtmotion.c \ grabdev.c \ grabdevb.c \ grabdevk.c \ listdev.c \ opendev.c \ queryst.c \ selectev.c \ sendexev.c \ setdval.c \ setfocus.c \ setmode.c \ setbmap.c \ setmmap.c \ stubs.c \ ungrdev.c \ ungrdevb.c \ ungrdevk.c OBJS = allowev.o \ chgkbd.o \ chgdctl.o \ chgfctl.o \ chgkmap.o \ chgprop.o \ chgptr.o \ closedev.o \ devbell.o \ exevents.o \ extinit.o \ getdctl.o \ getfctl.o \ getfocus.o \ getbmap.o \ getkmap.o \ getmmap.o \ getprop.o \ getselev.o \ getvers.o \ gtmotion.o \ grabdev.o \ grabdevb.o \ grabdevk.o \ listdev.o \ opendev.o \ queryst.o \ selectev.o \ sendexev.o \ setdval.o \ setfocus.o \ setmode.o \ setbmap.o \ setmmap.o \ ungrdev.o \ ungrdevb.o \ ungrdevk.o INCLUDES = -I../include -I$(EXTINCSRC) -I$(XINCLUDESRC) `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln #if defined(NXAgentServer) && NXAgentServer NX_DEFINES = -DNXAGENT_SERVER #endif DEFINES = $(NX_DEFINES) NormalLibraryTarget(xinput,$(OBJS)) NormalLibraryObjectRule() LintLibraryTarget(xinput,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/listdev.c0000644000000000000000000002450213614532331016774 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Extension function to list the available input devices. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "XIstubs.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" /* FIXME */ #include "listdev.h" #define VPC 20 /* Max # valuators per chunk */ /*********************************************************************** * * This procedure lists the input devices available to the server. * */ int SProcXListInputDevices(register ClientPtr client) { REQUEST(xListInputDevicesReq); swaps(&stuff->length); return (ProcXListInputDevices(client)); } /*********************************************************************** * * This procedure lists the input devices available to the server. * */ int ProcXListInputDevices(register ClientPtr client) { xListInputDevicesReply rep; int numdevs; int namesize = 1; /* need 1 extra byte for strcpy */ int size = 0; int total_length; char *devbuf; char *classbuf; char *namebuf; char *savbuf; xDeviceInfo *dev; DeviceIntPtr d; REQUEST_SIZE_MATCH(xListInputDevicesReq); memset(&rep, 0, sizeof(xListInputDevicesReply)); rep.repType = X_Reply; rep.RepType = X_ListInputDevices; rep.length = 0; rep.sequenceNumber = client->sequence; AddOtherInputDevices(); numdevs = inputInfo.numDevices; for (d = inputInfo.devices; d; d = d->next) SizeDeviceInfo(d, &namesize, &size); for (d = inputInfo.off_devices; d; d = d->next) SizeDeviceInfo(d, &namesize, &size); total_length = numdevs * sizeof(xDeviceInfo) + size + namesize; devbuf = (char *) calloc (1, total_length); classbuf = devbuf + (numdevs * sizeof(xDeviceInfo)); namebuf = classbuf + size; savbuf = devbuf; dev = (xDeviceInfoPtr) devbuf; for (d = inputInfo.devices; d; d = d->next, dev++) ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf); for (d = inputInfo.off_devices; d; d = d->next, dev++) ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf); rep.ndevices = numdevs; rep.length = (total_length + 3) >> 2; WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep); WriteToClient(client, total_length, savbuf); free(savbuf); return Success; } /*********************************************************************** * * This procedure calculates the size of the information to be returned * for an input device. * */ void SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size) { int chunks; *namesize += 1; if (d->name) *namesize += strlen(d->name); if (d->key != NULL) *size += sizeof(xKeyInfo); if (d->button != NULL) *size += sizeof(xButtonInfo); if (d->valuator != NULL) { chunks = ((int)d->valuator->numAxes + 19) / VPC; *size += (chunks * sizeof(xValuatorInfo) + d->valuator->numAxes * sizeof(xAxisInfo)); } } /*********************************************************************** * * This procedure lists information to be returned for an input device. * */ void ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev, char **devbuf, char **classbuf, char **namebuf) { CopyDeviceName(namebuf, d->name); CopySwapDevice(client, d, 0, devbuf); if (d->key != NULL) { CopySwapKeyClass(client, d->key, classbuf); dev->num_classes++; } if (d->button != NULL) { CopySwapButtonClass(client, d->button, classbuf); dev->num_classes++; } if (d->valuator != NULL) { dev->num_classes += CopySwapValuatorClass(client, d->valuator, classbuf); } } /*********************************************************************** * * This procedure copies data to the DeviceInfo struct, swapping if necessary. * * We need the extra byte in the allocated buffer, because the trailing null * hammers one extra byte, which is overwritten by the next name except for * the last name copied. * */ void CopyDeviceName(char **namebuf, char *name) { char *nameptr = (char *)*namebuf; if (name) { *nameptr++ = strlen(name); strcpy(nameptr, name); *namebuf += (strlen(name) + 1); } else { *nameptr++ = 0; *namebuf += 1; } } /*********************************************************************** * * This procedure copies data to the DeviceInfo struct, swapping if necessary. * */ void CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes, char **buf) { xDeviceInfoPtr dev; dev = (xDeviceInfoPtr) * buf; dev->id = d->id; dev->type = d->type; dev->num_classes = num_classes; if (d == inputInfo.keyboard) dev->use = IsXKeyboard; else if (d == inputInfo.pointer) dev->use = IsXPointer; else dev->use = IsXExtensionDevice; if (client->swapped) { swapl(&dev->type); /* macro - braces are required */ } *buf += sizeof(xDeviceInfo); } /*********************************************************************** * * This procedure copies KeyClass information, swapping if necessary. * */ void CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf) { xKeyInfoPtr k2; k2 = (xKeyInfoPtr) * buf; k2->class = KeyClass; k2->length = sizeof(xKeyInfo); k2->min_keycode = k->curKeySyms.minKeyCode; k2->max_keycode = k->curKeySyms.maxKeyCode; k2->num_keys = k2->max_keycode - k2->min_keycode + 1; if (client->swapped) { swaps(&k2->num_keys); } *buf += sizeof(xKeyInfo); } /*********************************************************************** * * This procedure copies ButtonClass information, swapping if necessary. * */ void CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf) { xButtonInfoPtr b2; b2 = (xButtonInfoPtr) * buf; b2->class = ButtonClass; b2->length = sizeof(xButtonInfo); b2->num_buttons = b->numButtons; if (client->swapped) { swaps(&b2->num_buttons); /* macro - braces are required */ } *buf += sizeof(xButtonInfo); } /*********************************************************************** * * This procedure copies ValuatorClass information, swapping if necessary. * * Devices may have up to 255 valuators. The length of a ValuatorClass is * defined to be sizeof(ValuatorClassInfo) + num_axes * sizeof (xAxisInfo). * The maximum length is therefore (8 + 255 * 12) = 3068. However, the * length field is one byte. If a device has more than 20 valuators, we * must therefore return multiple valuator classes to the client. * */ int CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf) { int i, j, axes, t_axes; xValuatorInfoPtr v2; AxisInfo *a; xAxisInfoPtr a2; for (i = 0, axes = v->numAxes; i < ((v->numAxes + 19) / VPC); i++, axes -= VPC) { t_axes = axes < VPC ? axes : VPC; if (t_axes < 0) t_axes = v->numAxes % VPC; v2 = (xValuatorInfoPtr) * buf; v2->class = ValuatorClass; v2->length = sizeof(xValuatorInfo) + t_axes * sizeof(xAxisInfo); v2->num_axes = t_axes; v2->mode = v->mode & DeviceMode; v2->motion_buffer_size = v->numMotionEvents; if (client->swapped) { swapl(&v2->motion_buffer_size); } *buf += sizeof(xValuatorInfo); a = v->axes + (VPC * i); a2 = (xAxisInfoPtr) * buf; for (j = 0; j < t_axes; j++) { a2->min_value = a->min_value; a2->max_value = a->max_value; a2->resolution = a->resolution; if (client->swapped) { swapl(&a2->min_value); swapl(&a2->max_value); swapl(&a2->resolution); } a2++; a++; *buf += sizeof(xAxisInfo); } } return (i); } /*********************************************************************** * * This procedure writes the reply for the XListInputDevices function, * if the client and server have a different byte ordering. * */ void SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/listdev.h0000644000000000000000000000454713614532331017010 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef LISTDEV_H #define LISTDEV_H 1 int SProcXListInputDevices(ClientPtr /* client */ ); int ProcXListInputDevices(ClientPtr /* client */ ); void SizeDeviceInfo(DeviceIntPtr /* d */ , int * /* namesize */ , int * /* size */ ); void ListDeviceInfo(ClientPtr /* client */ , DeviceIntPtr /* d */ , xDeviceInfoPtr /* dev */ , char ** /* devbuf */ , char ** /* classbuf */ , char ** /* namebuf */ ); void CopyDeviceName(char ** /* namebuf */ , char * /* name */ ); void CopySwapDevice(ClientPtr /* client */ , DeviceIntPtr /* d */ , int /* num_classes */ , char ** /* buf */ ); void CopySwapKeyClass(ClientPtr /* client */ , KeyClassPtr /* k */ , char ** /* buf */ ); void CopySwapButtonClass(ClientPtr /* client */ , ButtonClassPtr /* b */ , char ** /* buf */ ); int CopySwapValuatorClass(ClientPtr /* client */ , ValuatorClassPtr /* v */ , char ** /* buf */ ); void SRepXListInputDevices(ClientPtr /* client */ , int /* size */ , xListInputDevicesReply * /* rep */ ); #endif /* LISTDEV_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/opendev.c0000644000000000000000000001373213614532331016765 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Request to open an extension input device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "XIstubs.h" #include "windowstr.h" /* window structure */ #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "opendev.h" extern CARD8 event_base[]; /*********************************************************************** * * This procedure swaps the request if the server and client have different * byte orderings. * */ int SProcXOpenDevice(register ClientPtr client) { REQUEST(xOpenDeviceReq); swaps(&stuff->length); return (ProcXOpenDevice(client)); } /*********************************************************************** * * This procedure causes the server to open an input device. * */ int ProcXOpenDevice(register ClientPtr client) { xInputClassInfo evbase[numInputClasses]; Bool enableit = FALSE; int j = 0; int status = Success; xOpenDeviceReply rep; DeviceIntPtr dev; REQUEST(xOpenDeviceReq); REQUEST_SIZE_MATCH(xOpenDeviceReq); if (stuff->deviceid == inputInfo.pointer->id || stuff->deviceid == inputInfo.keyboard->id) { SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice); return Success; } if ((dev = LookupDeviceIntRec(stuff->deviceid)) == NULL) { /* not open */ for (dev = inputInfo.off_devices; dev; dev = dev->next) if (dev->id == stuff->deviceid) break; if (dev == NULL) { SendErrorToClient(client, IReqCode, X_OpenDevice, 0, BadDevice); return Success; } enableit = TRUE; } OpenInputDevice(dev, client, &status); if (status != Success) { SendErrorToClient(client, IReqCode, X_OpenDevice, 0, status); return Success; } if (enableit && dev->inited && dev->startup) (void)EnableDevice(dev); memset(&rep, 0, sizeof(xOpenDeviceReply)); rep.repType = X_Reply; rep.RepType = X_OpenDevice; rep.sequenceNumber = client->sequence; if (dev->key != NULL) { evbase[j].class = KeyClass; evbase[j++].event_type_base = event_base[KeyClass]; } if (dev->button != NULL) { evbase[j].class = ButtonClass; evbase[j++].event_type_base = event_base[ButtonClass]; } if (dev->valuator != NULL) { evbase[j].class = ValuatorClass; evbase[j++].event_type_base = event_base[ValuatorClass]; } if (dev->kbdfeed != NULL || dev->ptrfeed != NULL || dev->leds != NULL || dev->intfeed != NULL || dev->bell != NULL || dev->stringfeed != NULL) { evbase[j].class = FeedbackClass; evbase[j++].event_type_base = event_base[FeedbackClass]; } if (dev->focus != NULL) { evbase[j].class = FocusClass; evbase[j++].event_type_base = event_base[FocusClass]; } if (dev->proximity != NULL) { evbase[j].class = ProximityClass; evbase[j++].event_type_base = event_base[ProximityClass]; } evbase[j].class = OtherClass; evbase[j++].event_type_base = event_base[OtherClass]; rep.length = (j * sizeof(xInputClassInfo) + 3) >> 2; rep.num_classes = j; WriteReplyToClient(client, sizeof(xOpenDeviceReply), &rep); WriteToClient(client, j * sizeof(xInputClassInfo), evbase); return (Success); } /*********************************************************************** * * This procedure writes the reply for the XOpenDevice function, * if the client and server have a different byte ordering. * */ void SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/opendev.h0000644000000000000000000000277513614532331016777 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef OPENDEV_H #define OPENDEV_H 1 int SProcXOpenDevice(ClientPtr /* client */ ); int ProcXOpenDevice(ClientPtr /* client */ ); void SRepXOpenDevice(ClientPtr /* client */ , int /* size */ , xOpenDeviceReply * /* rep */ ); #endif /* OPENDEV_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/queryst.c0000644000000000000000000001174413614532331017042 0ustar /* Copyright 1998, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ /*********************************************************************** * * Request to query the state of an extension input device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" #include "queryst.h" /*********************************************************************** * * This procedure allows a client to query the state of a device. * */ int SProcXQueryDeviceState(register ClientPtr client) { REQUEST(xQueryDeviceStateReq); swaps(&stuff->length); return (ProcXQueryDeviceState(client)); } /*********************************************************************** * * This procedure allows frozen events to be routed. * */ int ProcXQueryDeviceState(register ClientPtr client) { int i; int num_classes = 0; int total_length = 0; char *buf, *savbuf; KeyClassPtr k; xKeyState *tk; ButtonClassPtr b; xButtonState *tb; ValuatorClassPtr v; xValuatorState *tv; xQueryDeviceStateReply rep; DeviceIntPtr dev; int *values; REQUEST(xQueryDeviceStateReq); REQUEST_SIZE_MATCH(xQueryDeviceStateReq); rep.repType = X_Reply; rep.RepType = X_QueryDeviceState; rep.length = 0; rep.sequenceNumber = client->sequence; dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, BadDevice); return Success; } v = dev->valuator; if (v != NULL && v->motionHintWindow != NULL) MaybeStopDeviceHint(dev, client); k = dev->key; if (k != NULL) { total_length += sizeof(xKeyState); num_classes++; } b = dev->button; if (b != NULL) { total_length += sizeof(xButtonState); num_classes++; } if (v != NULL) { total_length += (sizeof(xValuatorState) + (v->numAxes * sizeof(int))); num_classes++; } buf = (char *)malloc(total_length); if (!buf) { SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0, BadAlloc); return Success; } savbuf = buf; if (k != NULL) { tk = (xKeyState *) buf; tk->class = KeyClass; tk->length = sizeof(xKeyState); tk->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1; for (i = 0; i < 32; i++) tk->keys[i] = k->down[i]; buf += sizeof(xKeyState); } if (b != NULL) { tb = (xButtonState *) buf; tb->class = ButtonClass; tb->length = sizeof(xButtonState); tb->num_buttons = b->numButtons; for (i = 0; i < 32; i++) tb->buttons[i] = b->down[i]; buf += sizeof(xButtonState); } if (v != NULL) { tv = (xValuatorState *) buf; tv->class = ValuatorClass; tv->length = sizeof(xValuatorState); tv->num_valuators = v->numAxes; tv->mode = v->mode; buf += sizeof(xValuatorState); for (i = 0, values = v->axisVal; i < v->numAxes; i++) { *((int *)buf) = *values++; if (client->swapped) { swapl((int *)buf); /* macro - braces needed */ } buf += sizeof(int); } } rep.num_classes = num_classes; rep.length = (total_length + 3) >> 2; WriteReplyToClient(client, sizeof(xQueryDeviceStateReply), &rep); if (total_length > 0) WriteToClient(client, total_length, savbuf); free(savbuf); return Success; } /*********************************************************************** * * This procedure writes the reply for the XQueryDeviceState function, * if the client and server have a different byte ordering. * */ void SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/queryst.h0000644000000000000000000000302313614532331017036 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef QUERYST_H #define QUERYST_H 1 int SProcXQueryDeviceState(ClientPtr /* client */ ); int ProcXQueryDeviceState(ClientPtr /* client */ ); void SRepXQueryDeviceState(ClientPtr /* client */ , int /* size */ , xQueryDeviceStateReply * /* rep */ ); #endif /* QUERYST_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/selectev.c0000644000000000000000000001131713614532331017134 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Request to select input from an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" #include "grabdev.h" #include "selectev.h" extern Mask ExtExclusiveMasks[]; extern Mask ExtValidMasks[]; /*********************************************************************** * * Handle requests from clients with a different byte order. * */ int SProcXSelectExtensionEvent(register ClientPtr client) { REQUEST(xSelectExtensionEventReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq); swapl(&stuff->window); swaps(&stuff->count); REQUEST_FIXED_SIZE(xSelectExtensionEventReq, stuff->count * sizeof(CARD32)); SwapLongs((CARD32 *) (&stuff[1]), stuff->count); return (ProcXSelectExtensionEvent(client)); } /*********************************************************************** * * This procedure selects input from an extension device. * */ int ProcXSelectExtensionEvent(register ClientPtr client) { int ret; int i; WindowPtr pWin; struct tmask tmp[EMASKSIZE]; REQUEST(xSelectExtensionEventReq); REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq); if (stuff->length != (sizeof(xSelectExtensionEventReq) >> 2) + stuff->count) { SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, BadLength); return Success; } pWin = (WindowPtr) LookupWindow(stuff->window, client); if (!pWin) { client->errorValue = stuff->window; SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, BadWindow); return Success; } if ((ret = CreateMaskFromList(client, (XEventClass *) & stuff[1], stuff->count, tmp, NULL, X_SelectExtensionEvent)) != Success) return Success; for (i = 0; i < EMASKSIZE; i++) if (tmp[i].dev != NULL) { if ((ret = SelectForWindow((DeviceIntPtr) tmp[i].dev, pWin, client, tmp[i].mask, ExtExclusiveMasks[i], ExtValidMasks[i])) != Success) { SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, ret); return Success; } } return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/selectev.h0000644000000000000000000000264213614532331017142 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef SELECTEV_H #define SELECTEV_H 1 int SProcXSelectExtensionEvent(ClientPtr /* client */ ); int ProcXSelectExtensionEvent(ClientPtr /* client */ ); #endif /* SELECTEV_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/sendexev.c0000644000000000000000000001346613614532331017152 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Request to send an extension event. * */ #define EXTENSION_EVENT_BASE 64 #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* Window */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" #include "grabdev.h" #include "sendexev.h" extern int lastEvent; /* Defined in extension.c */ /*********************************************************************** * * Handle requests from clients with a different byte order than us. * */ int SProcXSendExtensionEvent(register ClientPtr client) { CARD32 *p; register int i; xEvent eventT; xEvent *eventP; EventSwapPtr proc; REQUEST(xSendExtensionEventReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq); swapl(&stuff->destination); swaps(&stuff->count); if (stuff->length != (sizeof(xSendExtensionEventReq) >> 2) + stuff->count + (stuff->num_events * (sizeof(xEvent) >> 2))) return BadLength; eventP = (xEvent *) & stuff[1]; for (i = 0; i < stuff->num_events; i++, eventP++) { proc = EventSwapVector[eventP->u.u.type & 0177]; if (proc == NotImplemented) /* no swapping proc; invalid event type? */ return (BadValue); (*proc) (eventP, &eventT); *eventP = eventT; } p = (CARD32 *)(((xEvent *) & stuff[1]) + stuff->num_events); SwapLongs(p, stuff->count); return (ProcXSendExtensionEvent(client)); } /*********************************************************************** * * Send an event to some client, as if it had come from an extension input * device. * */ int ProcXSendExtensionEvent(register ClientPtr client) { int ret; DeviceIntPtr dev; xEvent *first; XEventClass *list; struct tmask tmp[EMASKSIZE]; REQUEST(xSendExtensionEventReq); REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq); if (stuff->length != (sizeof(xSendExtensionEventReq) >> 2) + stuff->count + (stuff->num_events * (sizeof(xEvent) >> 2))) { SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadLength); return Success; } dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadDevice); return Success; } /* the previous code here returned the unitialized variable ret, so using Success we have defined returncode at least. FIXME: Upstream works different here, we must check this! */ if (stuff->num_events == 0) /* return ret; */ return Success; /* The client's event type must be one defined by an extension. */ first = ((xEvent *) & stuff[1]); if (!((EXTENSION_EVENT_BASE <= first->u.u.type) && (first->u.u.type < lastEvent))) { client->errorValue = first->u.u.type; SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, BadValue); return Success; } list = (XEventClass *) (first + stuff->num_events); if ((ret = CreateMaskFromList(client, list, stuff->count, tmp, dev, X_SendExtensionEvent)) != Success) return Success; ret = (SendEvent(client, dev, stuff->destination, stuff->propagate, (xEvent *) & stuff[1], tmp[stuff->deviceid].mask, stuff->num_events)); if (ret != Success) SendErrorToClient(client, IReqCode, X_SendExtensionEvent, 0, ret); return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/sendexev.h0000644000000000000000000000263613614532331017154 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef SENDEXEV_H #define SENDEXEV_H 1 int SProcXSendExtensionEvent(ClientPtr /* client */ ); int ProcXSendExtensionEvent(ClientPtr /* client */ ); #endif /* SENDEXEV_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/setbmap.c0000644000000000000000000001161413614532331016755 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Request to change the button mapping of an extension device. * */ #define IsOn(ptr, bit) \ (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))) #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "exevents.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setbmap.h" /*********************************************************************** * * This procedure changes the button mapping. * */ int SProcXSetDeviceButtonMapping(register ClientPtr client) { REQUEST(xSetDeviceButtonMappingReq); swaps(&stuff->length); return (ProcXSetDeviceButtonMapping(client)); } /*********************************************************************** * * This procedure lists the input devices available to the server. * */ int ProcXSetDeviceButtonMapping(register ClientPtr client) { int ret; xSetDeviceButtonMappingReply rep; DeviceIntPtr dev; REQUEST(xSetDeviceButtonMappingReq); REQUEST_AT_LEAST_SIZE(xSetDeviceButtonMappingReq); if (stuff->length != (sizeof(xSetDeviceButtonMappingReq) + stuff->map_length + 3) >> 2) { SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0, BadLength); return Success; } rep.repType = X_Reply; rep.RepType = X_SetDeviceButtonMapping; rep.length = 0; rep.sequenceNumber = client->sequence; rep.status = MappingSuccess; dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0, BadDevice); return Success; } ret = SetButtonMapping(client, dev, stuff->map_length, (BYTE *) & stuff[1]); if (ret == BadValue || ret == BadMatch) { SendErrorToClient(client, IReqCode, X_SetDeviceButtonMapping, 0, ret); return Success; } else { rep.status = ret; WriteReplyToClient(client, sizeof(xSetDeviceButtonMappingReply), &rep); } if (ret != MappingBusy) SendDeviceMappingNotify(MappingPointer, 0, 0, dev); return Success; } /*********************************************************************** * * This procedure writes the reply for the XSetDeviceButtonMapping function, * if the client and server have a different byte ordering. * */ void SRepXSetDeviceButtonMapping(ClientPtr client, int size, xSetDeviceButtonMappingReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/setbmap.h0000644000000000000000000000305113614532331016756 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef SETBMAP_H #define SETBMAP_H 1 int SProcXSetDeviceButtonMapping(ClientPtr /* client */ ); int ProcXSetDeviceButtonMapping(ClientPtr /* client */ ); void SRepXSetDeviceButtonMapping(ClientPtr /* client */ , int /* size */ , xSetDeviceButtonMappingReply * /* rep */ ); #endif /* SETBMAP_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/setdval.c0000644000000000000000000001210213614532331016755 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Request to change the mode of an extension input device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "XIstubs.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setdval.h" /*********************************************************************** * * Handle a request from a client with a different byte order. * */ int SProcXSetDeviceValuators(register ClientPtr client) { REQUEST(xSetDeviceValuatorsReq); swaps(&stuff->length); return (ProcXSetDeviceValuators(client)); } /*********************************************************************** * * This procedure sets the value of valuators on an extension input device. * */ int ProcXSetDeviceValuators(register ClientPtr client) { DeviceIntPtr dev; xSetDeviceValuatorsReply rep; REQUEST(xSetDeviceValuatorsReq); REQUEST_AT_LEAST_SIZE(xSetDeviceValuatorsReq); rep.repType = X_Reply; rep.RepType = X_SetDeviceValuators; rep.length = 0; rep.status = Success; rep.sequenceNumber = client->sequence; if (stuff->length != (sizeof(xSetDeviceValuatorsReq) >> 2) + stuff->num_valuators) { SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadLength); return Success; } dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadDevice); return Success; } if (dev->valuator == NULL) { SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadMatch); return Success; } if (stuff->first_valuator + stuff->num_valuators > dev->valuator->numAxes) { SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, BadValue); return Success; } if ((dev->grab) && !SameClient(dev->grab, client)) rep.status = AlreadyGrabbed; else rep.status = SetDeviceValuators(client, dev, (int *)&stuff[1], stuff->first_valuator, stuff->num_valuators); if (rep.status != Success && rep.status != AlreadyGrabbed) SendErrorToClient(client, IReqCode, X_SetDeviceValuators, 0, rep.status); else WriteReplyToClient(client, sizeof(xSetDeviceValuatorsReply), &rep); return Success; } /*********************************************************************** * * This procedure writes the reply for the XSetDeviceValuators function, * if the client and server have a different byte ordering. * */ void SRepXSetDeviceValuators(ClientPtr client, int size, xSetDeviceValuatorsReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/setdval.h0000644000000000000000000000303713614532331016771 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef SETDVAL_H #define SETDVAL_H 1 int SProcXSetDeviceValuators(ClientPtr /* client */ ); int ProcXSetDeviceValuators(ClientPtr /* client */ ); void SRepXSetDeviceValuators(ClientPtr /* client */ , int /* size */ , xSetDeviceValuatorsReply * /* rep */ ); #endif /* SETDVAL_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/setfocus.c0000644000000000000000000000753513614532331017164 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Request to set the focus for an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "windowstr.h" /* focus struct */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "dixevents.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setfocus.h" /*********************************************************************** * * This procedure sets the focus for a device. * */ int SProcXSetDeviceFocus(register ClientPtr client) { REQUEST(xSetDeviceFocusReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xSetDeviceFocusReq); swapl(&stuff->focus); swapl(&stuff->time); return (ProcXSetDeviceFocus(client)); } /*********************************************************************** * * This procedure sets the focus for a device. * */ int ProcXSetDeviceFocus(register ClientPtr client) { int ret; register DeviceIntPtr dev; REQUEST(xSetDeviceFocusReq); REQUEST_SIZE_MATCH(xSetDeviceFocusReq); dev = LookupDeviceIntRec(stuff->device); if (dev == NULL || !dev->focus) { SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, BadDevice); return Success; } ret = SetInputFocus(client, dev, stuff->focus, stuff->revertTo, stuff->time, TRUE); if (ret != Success) SendErrorToClient(client, IReqCode, X_SetDeviceFocus, 0, ret); return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/setfocus.h0000644000000000000000000000262613614532331017165 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef SETFOCUS_H #define SETFOCUS_H 1 int SProcXSetDeviceFocus(ClientPtr /* client */ ); int ProcXSetDeviceFocus(ClientPtr /* client */ ); #endif /* SETFOCUS_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/setmmap.c0000644000000000000000000001151613614532331016771 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /******************************************************************** * * Set modifier mapping for an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "exevents.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setmmap.h" /*********************************************************************** * * This procedure sets the modifier mapping for an extension device, * for clients on machines with a different byte ordering than the server. * */ int SProcXSetDeviceModifierMapping(register ClientPtr client) { REQUEST(xSetDeviceModifierMappingReq); swaps(&stuff->length); return (ProcXSetDeviceModifierMapping(client)); } /*********************************************************************** * * Set the device Modifier mapping. * */ int ProcXSetDeviceModifierMapping(ClientPtr client) { int ret; xSetDeviceModifierMappingReply rep; DeviceIntPtr dev; KeyClassPtr kp; REQUEST(xSetDeviceModifierMappingReq); REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq); dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0, BadDevice); return Success; } rep.repType = X_Reply; rep.RepType = X_SetDeviceModifierMapping; rep.length = 0; rep.sequenceNumber = client->sequence; ret = SetModifierMapping(client, dev, stuff->length, (sizeof(xSetDeviceModifierMappingReq) >> 2), stuff->numKeyPerModifier, (BYTE *) & stuff[1], &kp); if (ret == MappingSuccess || ret == MappingBusy || ret == MappingFailed) { rep.success = ret; if (ret == MappingSuccess) SendDeviceMappingNotify(MappingModifier, 0, 0, dev); WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply), &rep); } else { if (ret == -1) ret = BadValue; SendErrorToClient(client, IReqCode, X_SetDeviceModifierMapping, 0, ret); } return Success; } /*********************************************************************** * * This procedure writes the reply for the XSetDeviceModifierMapping function, * if the client and server have a different byte ordering. * */ void SRepXSetDeviceModifierMapping(ClientPtr client, int size, xSetDeviceModifierMappingReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/setmmap.h0000644000000000000000000000306513614532331016776 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef SETMMAP_H #define SETMMAP_H 1 int SProcXSetDeviceModifierMapping(ClientPtr /* client */ ); int ProcXSetDeviceModifierMapping(ClientPtr /* client */ ); void SRepXSetDeviceModifierMapping(ClientPtr /* client */ , int /* size */ , xSetDeviceModifierMappingReply * /* rep */ ); #endif /* SETMMAP_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/setmode.c0000644000000000000000000001110613614532331016756 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Request to change the mode of an extension input device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include #include #include "XIstubs.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setmode.h" /*********************************************************************** * * Handle a request from a client with a different byte order. * */ int SProcXSetDeviceMode(register ClientPtr client) { REQUEST(xSetDeviceModeReq); swaps(&stuff->length); return (ProcXSetDeviceMode(client)); } /*********************************************************************** * * This procedure sets the mode of a device. * */ int ProcXSetDeviceMode(register ClientPtr client) { DeviceIntPtr dev; xSetDeviceModeReply rep; REQUEST(xSetDeviceModeReq); REQUEST_SIZE_MATCH(xSetDeviceModeReq); rep.repType = X_Reply; rep.RepType = X_SetDeviceMode; rep.length = 0; rep.sequenceNumber = client->sequence; dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadDevice); return Success; } if (dev->valuator == NULL) { SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, BadMatch); return Success; } if ((dev->grab) && !SameClient(dev->grab, client)) rep.status = AlreadyGrabbed; else rep.status = SetDeviceMode(client, dev, stuff->mode); if (rep.status == Success) dev->valuator->mode = stuff->mode; else if (rep.status != AlreadyGrabbed) { SendErrorToClient(client, IReqCode, X_SetDeviceMode, 0, rep.status); return Success; } WriteReplyToClient(client, sizeof(xSetDeviceModeReply), &rep); return Success; } /*********************************************************************** * * This procedure writes the reply for the XSetDeviceMode function, * if the client and server have a different byte ordering. * */ void SRepXSetDeviceMode(ClientPtr client, int size, xSetDeviceModeReply * rep) { swaps(&rep->sequenceNumber); swapl(&rep->length); WriteToClient(client, size, rep); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/setmode.h0000644000000000000000000000300113614532331016756 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef SETMODE_H #define SETMODE_H 1 int SProcXSetDeviceMode(ClientPtr /* client */ ); int ProcXSetDeviceMode(ClientPtr /* client */ ); void SRepXSetDeviceMode(ClientPtr /* client */ , int /* size */ , xSetDeviceModeReply * /* rep */ ); #endif /* SETMODE_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/stubs.c0000644000000000000000000002501713614532331016464 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* * stubs.c -- stub routines for the X server side of the XINPUT * extension. This file is mainly to be used only as documentation. * There is not much code here, and you can't get a working XINPUT * server just using this. * The Xvfb server uses this file so it will compile with the same * object files as the real X server for a platform that has XINPUT. * Xnest could do the same thing. */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include "inputstr.h" #include #include #include "XIstubs.h" /*********************************************************************** * * Caller: ProcXChangeKeyboardDevice * * This procedure does the implementation-dependent portion of the work * needed to change the keyboard device. * * The X keyboard device has a FocusRec. If the device that has been * made into the new X keyboard did not have a FocusRec, * ProcXChangeKeyboardDevice will allocate one for it. * * If you do not want clients to be able to focus the old X keyboard * device, call DeleteFocusClassDeviceStruct to free the FocusRec. * * If you support input devices with keys that you do not want to be * used as the X keyboard, you need to check for them here and return * a BadDevice error. * * The default implementation is to do nothing (assume you do want * clients to be able to focus the old X keyboard). The commented-out * sample code shows what you might do if you don't want the default. * */ int ChangeKeyboardDevice(DeviceIntPtr old_dev, DeviceIntPtr new_dev) { /*********************************************************************** DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c * **********************************************************************/ return BadMatch; } /*********************************************************************** * * Caller: ProcXChangePointerDevice * * This procedure does the implementation-dependent portion of the work * needed to change the pointer device. * * The X pointer device does not have a FocusRec. If the device that * has been made into the new X pointer had a FocusRec, * ProcXChangePointerDevice will free it. * * If you want clients to be able to focus the old pointer device that * has now become accessible through the input extension, you need to * add a FocusRec to it here. * * The XChangePointerDevice protocol request also allows the client * to choose which axes of the new pointer device are used to move * the X cursor in the X- and Y- directions. If the axes are different * than the default ones, you need to keep track of that here. * * If you support input devices with valuators that you do not want to be * used as the X pointer, you need to check for them here and return a * BadDevice error. * * The default implementation is to do nothing (assume you don't want * clients to be able to focus the old X pointer). The commented-out * sample code shows what you might do if you don't want the default. * */ int ChangePointerDevice(DeviceIntPtr old_dev, DeviceIntPtr new_dev, unsigned char x, unsigned char y) { /*********************************************************************** InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr* x_axis = x; * keep track of new x-axis* y_axis = y; * keep track of new y-axis* if (x_axis != 0 || y_axis != 1) axes_changed = TRUE; * remember axes have changed* else axes_changed = FALSE; *************************************************************************/ return BadMatch; } /*********************************************************************** * * Caller: ProcXCloseDevice * * Take care of implementation-dependent details of closing a device. * Some implementations may actually close the device, others may just * remove this clients interest in that device. * * The default implementation is to do nothing (assume all input devices * are initialized during X server initialization and kept open). * */ void CloseInputDevice(DeviceIntPtr d, ClientPtr client) { } /*********************************************************************** * * Caller: ProcXListInputDevices * * This is the implementation-dependent routine to initialize an input * device to the point that information about it can be listed. * Some implementations open all input devices when the server is first * initialized, and never close them. Other implementations open only * the X pointer and keyboard devices during server initialization, * and only open other input devices when some client makes an * XOpenDevice request. If some other process has the device open, the * server may not be able to get information about the device to list it. * * This procedure should be used by implementations that do not initialize * all input devices at server startup. It should do device-dependent * initialization for any devices not previously initialized, and call * AddInputDevice for each of those devices so that a DeviceIntRec will be * created for them. * * The default implementation is to do nothing (assume all input devices * are initialized during X server initialization and kept open). * The commented-out sample code shows what you might do if you don't want * the default. * */ void AddOtherInputDevices(void) { /********************************************************************** for each uninitialized device, do something like: DeviceIntPtr dev; DeviceProc deviceProc; void * private; dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE); dev->public.devicePrivate = private; RegisterOtherDevice(dev); dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success); ************************************************************************/ } /*********************************************************************** * * Caller: ProcXOpenDevice * * This is the implementation-dependent routine to open an input device. * Some implementations open all input devices when the server is first * initialized, and never close them. Other implementations open only * the X pointer and keyboard devices during server initialization, * and only open other input devices when some client makes an * XOpenDevice request. This entry point is for the latter type of * implementation. * * If the physical device is not already open, do it here. In this case, * you need to keep track of the fact that one or more clients has the * device open, and physically close it when the last client that has * it open does an XCloseDevice. * * The default implementation is to do nothing (assume all input devices * are opened during X server initialization and kept open). * */ void OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status) { } /**************************************************************************** * * Caller: ProcXSetDeviceMode * * Change the mode of an extension device. * This function is used to change the mode of a device from reporting * relative motion to reporting absolute positional information, and * vice versa. * The default implementation below is that no such devices are supported. * */ int SetDeviceMode(register ClientPtr client, DeviceIntPtr dev, int mode) { return BadMatch; } /**************************************************************************** * * Caller: ProcXSetDeviceValuators * * Set the value of valuators on an extension input device. * This function is used to set the initial value of valuators on * those input devices that are capable of reporting either relative * motion or an absolute position, and allow an initial position to be set. * The default implementation below is that no such devices are supported. * */ int SetDeviceValuators(register ClientPtr client, DeviceIntPtr dev, int *valuators, int first_valuator, int num_valuators) { return BadMatch; } /**************************************************************************** * * Caller: ProcXChangeDeviceControl * * Change the specified device controls on an extension input device. * */ int ChangeDeviceControl(register ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control) { switch (control->control) { case DEVICE_RESOLUTION: return (BadMatch); default: return (BadMatch); } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/ungrdevb.c0000644000000000000000000001233013614532331017132 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Request to release a grab of a button on an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "dixgrabs.h" #include "ungrdevb.h" #define AllModifiersMask ( \ ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \ Mod3Mask | Mod4Mask | Mod5Mask ) /*********************************************************************** * * Handle requests from a client with a different byte order. * */ int SProcXUngrabDeviceButton(register ClientPtr client) { REQUEST(xUngrabDeviceButtonReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq); swapl(&stuff->grabWindow); swaps(&stuff->modifiers); return (ProcXUngrabDeviceButton(client)); } /*********************************************************************** * * Release a grab of a button on an extension device. * */ int ProcXUngrabDeviceButton(ClientPtr client) { DeviceIntPtr dev; DeviceIntPtr mdev; WindowPtr pWin; GrabRec temporaryGrab; REQUEST(xUngrabDeviceButtonReq); REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq); dev = LookupDeviceIntRec(stuff->grabbed_device); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadDevice); return Success; } if (dev->button == NULL) { SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadMatch); return Success; } if (stuff->modifier_device != UseXKeyboard) { mdev = LookupDeviceIntRec(stuff->modifier_device); if (mdev == NULL) { SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadDevice); return Success; } if (mdev->key == NULL) { SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadMatch); return Success; } } else mdev = (DeviceIntPtr) LookupKeyboardDevice(); pWin = LookupWindow(stuff->grabWindow, client); if (!pWin) { SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadWindow); return Success; } if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadValue); return Success; } temporaryGrab.resource = client->clientAsMask; temporaryGrab.device = dev; temporaryGrab.window = pWin; temporaryGrab.type = DeviceButtonPress; temporaryGrab.modifierDevice = mdev; temporaryGrab.modifiersDetail.exact = stuff->modifiers; temporaryGrab.modifiersDetail.pMask = NULL; temporaryGrab.detail.exact = stuff->button; temporaryGrab.detail.pMask = NULL; DeletePassiveGrabFromList(&temporaryGrab); return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/ungrdevb.h0000644000000000000000000000263613614532331017147 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef UNGRDEVB_H #define UNGRDEVB_H 1 int SProcXUngrabDeviceButton(ClientPtr /* client */ ); int ProcXUngrabDeviceButton(ClientPtr /* client */ ); #endif /* UNGRDEVB_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/ungrdev.c0000644000000000000000000000751513614532331017001 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Request to release a grab of an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "ungrdev.h" /*********************************************************************** * * Handle requests from a client with a different byte order. * */ int SProcXUngrabDevice(register ClientPtr client) { REQUEST(xUngrabDeviceReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xUngrabDeviceReq); swapl(&stuff->time); return (ProcXUngrabDevice(client)); } /*********************************************************************** * * Release a grab of an extension device. * */ int ProcXUngrabDevice(register ClientPtr client) { DeviceIntPtr dev; GrabPtr grab; TimeStamp time; REQUEST(xUngrabDeviceReq); REQUEST_SIZE_MATCH(xUngrabDeviceReq); dev = LookupDeviceIntRec(stuff->deviceid); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_UngrabDevice, 0, BadDevice); return Success; } grab = dev->grab; time = ClientTimeToServerTime(stuff->time); if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, dev->grabTime) != EARLIER) && (grab) && SameClient(grab, client)) (*dev->DeactivateGrab) (dev); return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/ungrdev.h0000644000000000000000000000261713614532331017004 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef UNGRDEV_H #define UNGRDEV_H 1 int SProcXUngrabDevice(ClientPtr /* client */ ); int ProcXUngrabDevice(ClientPtr /* client */ ); #endif /* UNGRDEV_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/ungrdevk.c0000644000000000000000000001260013614532331017143 0ustar /************************************************************ Copyright 1989, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************************** * * Request to release a grab of a key on an extension device. * */ #ifdef HAVE_DIX_CONFIG_H #include #endif #include /* for inputstr.h */ #include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ #include #include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "dixgrabs.h" #include "ungrdevk.h" #define AllModifiersMask ( \ ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \ Mod3Mask | Mod4Mask | Mod5Mask ) /*********************************************************************** * * Handle requests from a client with a different byte order. * */ int SProcXUngrabDeviceKey(register ClientPtr client) { REQUEST(xUngrabDeviceKeyReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq); swapl(&stuff->grabWindow); swaps(&stuff->modifiers); return (ProcXUngrabDeviceKey(client)); } /*********************************************************************** * * Release a grab of a key on an extension device. * */ int ProcXUngrabDeviceKey(ClientPtr client) { DeviceIntPtr dev; DeviceIntPtr mdev; WindowPtr pWin; GrabRec temporaryGrab; REQUEST(xUngrabDeviceKeyReq); REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq); dev = LookupDeviceIntRec(stuff->grabbed_device); if (dev == NULL) { SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadDevice); return Success; } if (dev->key == NULL) { SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch); return Success; } if (stuff->modifier_device != UseXKeyboard) { mdev = LookupDeviceIntRec(stuff->modifier_device); if (mdev == NULL) { SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadDevice); return Success; } if (mdev->key == NULL) { SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadMatch); return Success; } } else mdev = (DeviceIntPtr) LookupKeyboardDevice(); pWin = LookupWindow(stuff->grabWindow, client); if (!pWin) { SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadWindow); return Success; } if (((stuff->key > dev->key->curKeySyms.maxKeyCode) || (stuff->key < dev->key->curKeySyms.minKeyCode)) && (stuff->key != AnyKey)) { SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadValue); return Success; } if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadValue); return Success; } temporaryGrab.resource = client->clientAsMask; temporaryGrab.device = dev; temporaryGrab.window = pWin; temporaryGrab.type = DeviceKeyPress; temporaryGrab.modifierDevice = mdev; temporaryGrab.modifiersDetail.exact = stuff->modifiers; temporaryGrab.modifiersDetail.pMask = NULL; temporaryGrab.detail.exact = stuff->key; temporaryGrab.detail.pMask = NULL; DeletePassiveGrabFromList(&temporaryGrab); return Success; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/Xi/ungrdevk.h0000644000000000000000000000263013614532331017152 0ustar /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef UNGRDEVK_H #define UNGRDEVK_H 1 int SProcXUngrabDeviceKey(ClientPtr /* client */ ); int ProcXUngrabDeviceKey(ClientPtr /* client */ ); #endif /* UNGRDEVK_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/ddxBeep.c0000644000000000000000000002232013614532331017075 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #include #include /*#define FALLING_TONE 1*/ /*#define RISING_TONE 1*/ #define FALLING_TONE 10 #define RISING_TONE 10 #define SHORT_TONE 50 #define SHORT_DELAY 60 #define LONG_TONE 75 #define VERY_LONG_TONE 100 #define LONG_DELAY 85 #define CLICK_DURATION 1 #define DEEP_PITCH 250 #define LOW_PITCH 500 #define MID_PITCH 1000 #define HIGH_PITCH 2000 #define CLICK_PITCH 1500 static unsigned long atomGeneration= 0; static Atom featureOn; static Atom featureOff; static Atom featureChange; static Atom ledOn; static Atom ledOff; static Atom ledChange; static Atom slowWarn; static Atom slowPress; static Atom slowReject; static Atom slowAccept; static Atom slowRelease; static Atom stickyLatch; static Atom stickyLock; static Atom stickyUnlock; static Atom bounceReject; static char doesPitch = 1; #define FEATURE_ON "AX_FeatureOn" #define FEATURE_OFF "AX_FeatureOff" #define FEATURE_CHANGE "AX_FeatureChange" #define LED_ON "AX_IndicatorOn" #define LED_OFF "AX_IndicatorOff" #define LED_CHANGE "AX_IndicatorChange" #define SLOW_WARN "AX_SlowKeysWarning" #define SLOW_PRESS "AX_SlowKeyPress" #define SLOW_REJECT "AX_SlowKeyReject" #define SLOW_ACCEPT "AX_SlowKeyAccept" #define SLOW_RELEASE "AX_SlowKeyRelease" #define STICKY_LATCH "AX_StickyLatch" #define STICKY_LOCK "AX_StickyLock" #define STICKY_UNLOCK "AX_StickyUnlock" #define BOUNCE_REJECT "AX_BounceKeyReject" #define MAKE_ATOM(a) MakeAtom(a,sizeof(a)-1,True) static void _XkbDDXBeepInitAtoms(void) { featureOn= MAKE_ATOM(FEATURE_ON); featureOff= MAKE_ATOM(FEATURE_OFF); featureChange= MAKE_ATOM(FEATURE_CHANGE); ledOn= MAKE_ATOM(LED_ON); ledOff= MAKE_ATOM(LED_OFF); ledChange= MAKE_ATOM(LED_CHANGE); slowWarn= MAKE_ATOM(SLOW_WARN); slowPress= MAKE_ATOM(SLOW_PRESS); slowReject= MAKE_ATOM(SLOW_REJECT); slowAccept= MAKE_ATOM(SLOW_ACCEPT); slowRelease= MAKE_ATOM(SLOW_RELEASE); stickyLatch= MAKE_ATOM(STICKY_LATCH); stickyLock= MAKE_ATOM(STICKY_LOCK); stickyUnlock= MAKE_ATOM(STICKY_UNLOCK); bounceReject= MAKE_ATOM(BOUNCE_REJECT); #if defined(sun) doesPitch = 0; #endif return; } static CARD32 _XkbDDXBeepExpire(OsTimerPtr timer,CARD32 now,void * arg) { DeviceIntPtr dev= (DeviceIntPtr)arg; KbdFeedbackPtr feed; KeybdCtrl * ctrl; XkbSrvInfoPtr xkbInfo; CARD32 next; int pitch,duration; int oldPitch,oldDuration; Atom name; if ((dev==NULL)||(dev->key==NULL)||(dev->key->xkbInfo==NULL)|| (dev->kbdfeed==NULL)) return 0; if (atomGeneration!=serverGeneration) { _XkbDDXBeepInitAtoms(); atomGeneration= serverGeneration; } feed= dev->kbdfeed; ctrl= &feed->ctrl; xkbInfo= dev->key->xkbInfo; next= 0; pitch= oldPitch= ctrl->bell_pitch; duration= oldDuration= ctrl->bell_duration; name= None; switch (xkbInfo->beepType) { default: ErrorF("Unknown beep type %d\n",xkbInfo->beepType); case _BEEP_NONE: duration= 0; break; /* When an LED is turned on, we want a high-pitched beep. * When the LED it turned off, we want a low-pitched beep. * If we cannot do pitch, we want a single beep for on and two * beeps for off. */ case _BEEP_LED_ON: if (name==None) name= ledOn; duration= SHORT_TONE; pitch= HIGH_PITCH; break; case _BEEP_LED_OFF: if (name==None) name= ledOff; duration= SHORT_TONE; pitch= LOW_PITCH; if (!doesPitch && xkbInfo->beepCount<1) next = SHORT_DELAY; break; /* When a Feature is turned on, we want an up-siren. * When a Feature is turned off, we want a down-siren. * If we cannot do pitch, we want a single beep for on and two * beeps for off. */ case _BEEP_FEATURE_ON: if (name==None) name= featureOn; if (xkbInfo->beepCount<1) { pitch= LOW_PITCH; duration= VERY_LONG_TONE; if (doesPitch) next= SHORT_DELAY; } else { pitch= MID_PITCH; duration= SHORT_TONE; } break; case _BEEP_FEATURE_OFF: if (name==None) name= featureOff; if (xkbInfo->beepCount<1) { pitch= MID_PITCH; if (doesPitch) duration= VERY_LONG_TONE; else duration= SHORT_TONE; next= SHORT_DELAY; } else { pitch= LOW_PITCH; duration= SHORT_TONE; } break; /* Two high beeps indicate an LED or Feature changed * state, but that another LED or Feature is also on. * [[[WDW - This is not in AccessDOS ]]] */ case _BEEP_LED_CHANGE: if (name==None) name= ledChange; case _BEEP_FEATURE_CHANGE: if (name==None) name= featureChange; duration= SHORT_TONE; pitch= HIGH_PITCH; if (xkbInfo->beepCount<1) { next= SHORT_DELAY; } break; /* Three high-pitched beeps are the warning that SlowKeys * is going to be turned on or off. */ case _BEEP_SLOW_WARN: if (name==None) name= slowWarn; duration= SHORT_TONE; pitch= HIGH_PITCH; if (xkbInfo->beepCount<2) next= SHORT_DELAY; break; /* Click on SlowKeys press and accept. * Deep pitch when a SlowKey or BounceKey is rejected. * [[[WDW - Rejects are not in AccessDOS ]]] * If we cannot do pitch, we want single beeps. */ case _BEEP_SLOW_PRESS: if (name==None) name= slowPress; case _BEEP_SLOW_ACCEPT: if (name==None) name= slowAccept; case _BEEP_SLOW_RELEASE: if (name==None) name= slowRelease; duration= CLICK_DURATION; pitch= CLICK_PITCH; break; case _BEEP_BOUNCE_REJECT: if (name==None) name= bounceReject; case _BEEP_SLOW_REJECT: if (name==None) name= slowReject; duration= SHORT_TONE; pitch= DEEP_PITCH; break; /* Low followed by high pitch when a StickyKey is latched. * High pitch when a StickyKey is locked. * Low pitch when unlocked. * If we cannot do pitch, two beeps for latch, nothing for * lock, and two for unlock. */ case _BEEP_STICKY_LATCH: if (name==None) name= stickyLatch; duration= SHORT_TONE; if (xkbInfo->beepCount<1) { next= SHORT_DELAY; pitch= LOW_PITCH; } else pitch= HIGH_PITCH; break; case _BEEP_STICKY_LOCK: if (name==None) name= stickyLock; if (doesPitch) { duration= SHORT_TONE; pitch= HIGH_PITCH; } break; case _BEEP_STICKY_UNLOCK: if (name==None) name= stickyUnlock; duration= SHORT_TONE; pitch= LOW_PITCH; if (!doesPitch && xkbInfo->beepCount<1) next = SHORT_DELAY; break; } if (timer == NULL && duration>0) { CARD32 starttime = GetTimeInMillis(); CARD32 elapsedtime; ctrl->bell_duration= duration; ctrl->bell_pitch= pitch; if (xkbInfo->beepCount==0) { XkbHandleBell(0,0,dev,ctrl->bell,(void *)ctrl,KbdFeedbackClass,name,None, NULL); } else if (xkbInfo->desc->ctrls->enabled_ctrls&XkbAudibleBellMask) { (*dev->kbdfeed->BellProc)(ctrl->bell,dev,(void *)ctrl,KbdFeedbackClass); } ctrl->bell_duration= oldDuration; ctrl->bell_pitch= oldPitch; xkbInfo->beepCount++; /* Some DDX schedule the beep and return immediately, others don't return until the beep is completed. We measure the time and if it's less than the beep duration, make sure not to schedule the next beep until after the current one finishes. */ elapsedtime = GetTimeInMillis(); if (elapsedtime > starttime) { /* watch out for millisecond counter overflow! */ elapsedtime -= starttime; } else { elapsedtime = 0; } if (elapsedtime < duration) { next += duration - elapsedtime; } } return next; } int XkbDDXAccessXBeep(DeviceIntPtr dev,unsigned what,unsigned which) { XkbSrvInfoRec *xkbInfo= dev->key->xkbInfo; CARD32 next; xkbInfo->beepType= what; xkbInfo->beepCount= 0; next= _XkbDDXBeepExpire(NULL,0,(void *)dev); if (next>0) { xkbInfo->beepTimer= TimerSet(xkbInfo->beepTimer, 0, next, _XkbDDXBeepExpire, (void *)dev); } return 1; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/ddxCtrls.c0000644000000000000000000000614313614532331017316 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #include #include void XkbDDXKeybdCtrlProc(DeviceIntPtr dev,KeybdCtrl *ctrl) { int realRepeat; realRepeat= ctrl->autoRepeat; if ((dev->kbdfeed)&&(XkbDDXUsesSoftRepeat(dev))) ctrl->autoRepeat= 0; if (dev->key && dev->key->xkbInfo && dev->key->xkbInfo->kbdProc) (*dev->key->xkbInfo->kbdProc)(dev,ctrl); ctrl->autoRepeat= realRepeat; return; } int XkbDDXUsesSoftRepeat(DeviceIntPtr pXDev) { #ifndef XKB_ALWAYS_USES_SOFT_REPEAT if (pXDev && pXDev->kbdfeed ) { if (pXDev->kbdfeed->ctrl.autoRepeat) { if (pXDev->key && pXDev->key->xkbInfo) { XkbDescPtr xkb; xkb= pXDev->key->xkbInfo->desc; if ((xkb->ctrls->repeat_delay == 660) && (xkb->ctrls->repeat_interval == 40) && ((xkb->ctrls->enabled_ctrls&(XkbSlowKeysMask| XkbBounceKeysMask| XkbMouseKeysMask))==0)) { return 0; } return ((xkb->ctrls->enabled_ctrls&XkbRepeatKeysMask)!=0); } } } return 0; #else return 1; #endif } void XkbDDXChangeControls(DeviceIntPtr dev,XkbControlsPtr old,XkbControlsPtr new) { unsigned changed, i; unsigned char *rep_old, *rep_new, *rep_fb; changed= new->enabled_ctrls^old->enabled_ctrls; for (rep_old = old->per_key_repeat, rep_new = new->per_key_repeat, rep_fb = dev->kbdfeed->ctrl.autoRepeats, i = 0; i < XkbPerKeyBitArraySize; i++) { if (rep_old[i] != rep_new[i]) { rep_fb[i] = rep_new[i]; changed &= XkbPerKeyRepeatMask; } } if (changed&XkbPerKeyRepeatMask) { if (dev->kbdfeed->CtrlProc) (*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl); } return; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/ddxDevBtn.c0000644000000000000000000000560213614532331017410 0ustar /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #include #include #include extern int DeviceValuator; void XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button) { int * devVal; INT32 * evVal; xEvent events[2]; deviceKeyButtonPointer *btn; deviceValuator * val; int x,y; int nAxes, i, count; if ((dev==(DeviceIntPtr)LookupPointerDevice())||(!dev->public.on)) return; nAxes = (dev->valuator?dev->valuator->numAxes:0); if (nAxes > 6) nAxes = 6; GetSpritePosition(&x,&y); btn= (deviceKeyButtonPointer *) &events[0]; val= (deviceValuator *) &events[1]; if (press) btn->type= DeviceButtonPress; else btn->type= DeviceButtonRelease; btn->detail= button; btn->time= GetTimeInMillis(); btn->root_x= x; btn->root_y= y; btn->deviceid= dev->id; count= 1; if (nAxes>0) { btn->deviceid|= 0x80; val->type = DeviceValuator; val->deviceid = dev->id; val->first_valuator = 0; evVal= &val->valuator0; devVal= dev->valuator->axisVal; for (i=nAxes;i>0;i--) { *evVal++ = *devVal++; if (evVal > &val->valuator5) { int tmp = val->first_valuator+6; val->num_valuators = 6; val++; evVal= &val->valuator0; val->first_valuator= tmp; } } if ((nAxes % 6) != 0) { val->num_valuators = (nAxes % 6); } count= 1+((nAxes+5)/6); } (*dev->public.processInputProc)((xEventPtr)btn, dev, count); return; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/ddxFakeBtn.c0000644000000000000000000000371313614532331017541 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #include #include void XkbDDXFakePointerButton(int event,int button) { xEvent ev; int x,y; DevicePtr ptr; if ((ptr = LookupPointerDevice())==NULL) return; GetSpritePosition(&x,&y); ev.u.u.type = event; ev.u.u.detail = button; ev.u.keyButtonPointer.time = GetTimeInMillis(); ev.u.keyButtonPointer.rootX = x; ev.u.keyButtonPointer.rootY = y; (*ptr->processInputProc)( &ev, (DeviceIntPtr)ptr, 1 ); return; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/ddxFakeMtn.c0000644000000000000000000000643713614532331017562 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #include #include #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #endif #include "mipointer.h" #include "mipointrst.h" void XkbDDXFakePointerMotion(unsigned flags,int x,int y) { int oldX,oldY; ScreenPtr pScreen, oldScreen; GetSpritePosition(&oldX, &oldY); pScreen = oldScreen = GetSpriteWindow()->drawable.pScreen; #ifdef PANORAMIX if (!noPanoramiXExtension) { BoxRec box; int i; if(!RegionContainsPoint(&XineramaScreenRegions[pScreen->myNum], oldX, oldY, &box)) { FOR_NSCREENS(i) { if(i == pScreen->myNum) continue; if(RegionContainsPoint(&XineramaScreenRegions[i], oldX, oldY, &box)) { pScreen = screenInfo.screens[i]; break; } } } oldScreen = pScreen; if (flags&XkbSA_MoveAbsoluteX) oldX= x; else oldX+= x; if (flags&XkbSA_MoveAbsoluteY) oldY= y; else oldY+= y; if(!RegionContainsPoint(&XineramaScreenRegions[pScreen->myNum], oldX, oldY, &box)) { FOR_NSCREENS(i) { if(i == pScreen->myNum) continue; if(RegionContainsPoint(&XineramaScreenRegions[i], oldX, oldY, &box)) { pScreen = screenInfo.screens[i]; break; } } } oldX -= panoramiXdataPtr[pScreen->myNum].x; oldY -= panoramiXdataPtr[pScreen->myNum].y; } else #endif { if (flags&XkbSA_MoveAbsoluteX) oldX= x; else oldX+= x; if (flags&XkbSA_MoveAbsoluteY) oldY= y; else oldY+= y; #define GetScreenPrivate(s) ((miPointerScreenPtr) ((s)->devPrivates[miPointerScreenIndex].ptr)) (*(GetScreenPrivate(oldScreen))->screenFuncs->CursorOffScreen) (&pScreen, &oldX, &oldY); } if (pScreen != oldScreen) NewCurrentScreen(pScreen, oldX, oldY); if (pScreen->SetCursorPosition) (*pScreen->SetCursorPosition)(pScreen, oldX, oldY, TRUE); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/ddxKillSrv.c0000644000000000000000000000323313614532331017612 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #include int XkbDDXTerminateServer(DeviceIntPtr dev,KeyCode key,XkbAction *act) { #ifndef NXAGENT_SERVER GiveUp(1); #endif /* NXAGENT_SERVER */ return 0; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/ddxLEDs.c0000644000000000000000000000427313614532331017020 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #include #include static void XkbDDXUpdateIndicators(DeviceIntPtr dev,CARD32 new) { dev->kbdfeed->ctrl.leds= new; (*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl); return; } void XkbDDXUpdateDeviceIndicators( DeviceIntPtr dev, XkbSrvLedInfoPtr sli, CARD32 new) { if (sli->fb.kf==dev->kbdfeed) XkbDDXUpdateIndicators(dev,new); else if (sli->class==KbdFeedbackClass) { KbdFeedbackPtr kf; kf= sli->fb.kf; if (kf && kf->CtrlProc) { (*kf->CtrlProc)(dev,&kf->ctrl); } } else if (sli->class==LedFeedbackClass) { LedFeedbackPtr lf; lf= sli->fb.lf; if (lf && lf->CtrlProc) { (*lf->CtrlProc)(dev,&lf->ctrl); } } return; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/ddxList.c0000644000000000000000000001760213614532331017144 0ustar /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include #include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #include #include #ifdef WIN32 /* from ddxLoad.c */ extern const char* Win32TempDir(); extern int Win32System(const char *cmdline); #undef System #define System Win32System #define W32_tmparg " '%s'" #define W32_tmpfile ,tmpname #define W32_tmplen strlen(tmpname)+3 #else #define W32_tmparg #define W32_tmpfile #define W32_tmplen 0 #endif /***====================================================================***/ static char *componentDirs[_XkbListNumComponents] = { "keymap", "keycodes", "types", "compat", "symbols", "geometry" }; /***====================================================================***/ static Status _AddListComponent( XkbSrvListInfoPtr list, int what, unsigned flags, char * str, ClientPtr client) { int slen,wlen; unsigned char * wire8; unsigned short *wire16; char * tmp; if (list->nTotal>=list->maxRtrn) { list->nTotal++; return Success; } tmp= strchr(str,')'); if ((tmp==NULL)&&((tmp=strchr(str,'('))==NULL)) { slen= strlen(str); while ((slen>0) && isspace(str[slen-1])) { slen--; } } else { slen= (tmp-str+1); } wlen= (((slen+1)/2)*2)+4; /* four bytes for flags and length, pad to */ /* 2-byte boundary */ if ((list->szPool-list->nPool)1024) list->szPool+= XkbPaddedSize(wlen*2); else list->szPool+= 1024; list->pool= _XkbTypedRealloc(list->pool,list->szPool,char); if (!list->pool) return BadAlloc; } wire16= (unsigned short *)&list->pool[list->nPool]; wire8= (unsigned char *)&wire16[2]; wire16[0]= flags; wire16[1]= slen; memcpy(wire8,str,slen); if (client->swapped) { swaps(&wire16[0]); swaps(&wire16[1]); } list->nPool+= wlen; list->nFound[what]++; list->nTotal++; return Success; } /***====================================================================***/ static Status XkbDDXListComponent( DeviceIntPtr dev, int what, XkbSrvListInfoPtr list, ClientPtr client) { char *file,*map,*tmp,*buf=NULL; FILE *in; Status status; int rval; Bool haveDir; #ifdef WIN32 char tmpname[PATH_MAX]; #endif if ((list->pattern[what]==NULL)||(list->pattern[what][0]=='\0')) return Success; file= list->pattern[what]; map= strrchr(file,'('); if (map!=NULL) { map++; tmp= strrchr(map,')'); if ((tmp==NULL)||(tmp[1]!='\0')) { /* illegal pattern. No error, but no match */ return Success; } } in= NULL; haveDir= True; #ifdef WIN32 strcpy(tmpname, Win32TempDir()); strcat(tmpname, "\\xkb_XXXXXX"); (void) mktemp(tmpname); #endif if (XkbBaseDirectory!=NULL) { if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) { if (asprintf(&buf, "%s/%s.dir", XkbBaseDirectory, componentDirs[what]) == -1) buf = NULL; else in = fopen(buf,"r"); } if (!in) { haveDir= False; free(buf); if (asprintf (&buf, "'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg, XkbBinDirectory, XkbBaseDirectory, componentDirs[what], (long) ((xkbDebugFlags < 2) ? 1 : ((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)), file W32_tmpfile ) == -1) buf = NULL; } } else { if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) { if (asprintf(&buf, "%s.dir", componentDirs[what]) == -1) buf = NULL; else in = fopen(buf,"r"); buf = NULL; } if (!in) { haveDir= False; free(buf); if (asprintf (&buf, "xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg, componentDirs[what], (long) ((xkbDebugFlags < 2) ? 1 : ((xkbDebugFlags > 10) ? 10 : xkbDebugFlags)), file W32_tmpfile ) == -1) buf = NULL; } } status= Success; if (!haveDir) { #ifndef WIN32 in= Popen(buf,"r"); #else if (xkbDebugFlags) DebugF("xkb executes: %s\n",buf); if (System(buf) < 0) ErrorF("Could not invoke keymap compiler\n"); else in= fopen(tmpname, "r"); #endif } if (!in) { free (buf); #ifdef WIN32 unlink(tmpname); #endif return BadImplementation; } list->nFound[what]= 0; if (buf) { free(buf); buf = NULL; } buf = malloc(PATH_MAX * sizeof(char)); if (!buf) return BadAlloc; while ((status==Success)&&((tmp=fgets(buf,PATH_MAX,in))!=NULL)) { unsigned flags; register unsigned int i; if (*tmp=='#') /* comment, skip it */ continue; if (!strncmp(tmp, "Warning:", 8) || !strncmp(tmp, " ", 8)) /* skip warnings too */ continue; flags= 0; /* each line in the listing is supposed to start with two */ /* groups of eight characters, which specify the general */ /* flags and the flags that are specific to the component */ /* if they're missing, fail with BadImplementation */ for (i=0;(i<8)&&(status==Success);i++) { /* read the general flags */ if (isalpha(*tmp)) flags|= (1L< #endif #ifdef HAVE_XKB_CONFIG_H #include #endif #include #include #include /* stat() */ #include #include #include #include #include #include #include #include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #include #include #include "xkb.h" #if defined(CSRG_BASED) || defined(linux) || defined(__GNU__) #include #endif /* * If XKM_OUTPUT_DIR specifies a path without a leading slash, it is * relative to the top-level XKB configuration directory. * Making the server write to a subdirectory of that directory * requires some work in the general case (install procedure * has to create links to /var or somesuch on many machines), * so we just compile into /usr/tmp for now. */ #ifndef XKM_OUTPUT_DIR #define XKM_OUTPUT_DIR "compiled/" #endif #define PRE_ERROR_MSG "\"The XKEYBOARD keymap compiler (xkbcomp) reports:\"" #define ERROR_PREFIX "\"> \"" #define POST_ERROR_MSG1 "\"Errors from xkbcomp are not fatal to the X server\"" #define POST_ERROR_MSG2 "\"End of messages from xkbcomp\"" #if defined(WIN32) #define PATHSEPARATOR "\\" #else #define PATHSEPARATOR "/" #endif #ifdef WIN32 #include const char* Win32TempDir() { static char buffer[PATH_MAX]; if (GetTempPath(sizeof(buffer), buffer)) { int len; buffer[sizeof(buffer)-1] = 0; len = strlen(buffer); if (len > 0) if (buffer[len-1] == '\\') buffer[len-1] = 0; return buffer; } if (getenv("TEMP") != NULL) return getenv("TEMP"); else if (getenv("TMP") != NULL) return getenv("TEMP"); else return "/tmp"; } int Win32System(const char *cmdline) { STARTUPINFO si; PROCESS_INFORMATION pi; DWORD dwExitCode; char *cmd = xstrdup(cmdline); ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { LPVOID buffer; if (!FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &buffer, 0, NULL )) { ErrorF("Starting '%s' failed!\n", cmdline); } else { ErrorF("Starting '%s' failed: %s", cmdline, (char *)buffer); LocalFree(buffer); } free(cmd); return -1; } /* Wait until child process exits. */ WaitForSingleObject( pi.hProcess, INFINITE ); GetExitCodeProcess( pi.hProcess, &dwExitCode); /* Close process and thread handles. */ CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); free(cmd); return dwExitCode; } #undef System #define System(x) Win32System(x) #endif static void OutputDirectory( char* outdir, size_t size) { #ifndef WIN32 if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size)) { /* if server running as root it *may* be able to write */ /* FIXME: check whether directory is writable at all */ (void) strcpy (outdir, XKM_OUTPUT_DIR); } else #else if (strlen(Win32TempDir()) + 1 < size) { (void) strcpy(outdir, Win32TempDir()); (void) strcat(outdir, "\\"); } else #endif if (strlen("/tmp/") < size) { (void) strcpy (outdir, "/tmp/"); } } static Bool XkbDDXCompileNamedKeymap( XkbDescPtr xkb, XkbComponentNamesPtr names, char * nameRtrn, int nameRtrnLen) { char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile; if (names->keymap==NULL) return False; strncpy(file,names->keymap,PATH_MAX); file[PATH_MAX-1]= '\0'; if ((map= strrchr(file,'('))!=NULL) { char *tmp; if ((tmp= strrchr(map,')'))!=NULL) { *map++= '\0'; *tmp= '\0'; } else { map= NULL; } } if ((outFile= strrchr(file,'/'))!=NULL) outFile= Xstrdup(&outFile[1]); else outFile= Xstrdup(file); XkbEnsureSafeMapName(outFile); OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir)); if (XkbBaseDirectory!=NULL) { char *xkbbasedir = XkbBaseDirectory; char *xkbbindir = XkbBinDirectory; if (asprintf(&cmd,"\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s \"%s%s.xkm\"", xkbbindir, ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), xkbbasedir,(map?"-m ":""),(map?map:""), PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file, xkm_output_dir,outFile) == -1) cmd = NULL; } else { if (asprintf(&cmd, "xkbcomp -w %d -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s \"%s%s.xkm\"", ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), (map?"-m ":""),(map?map:""), PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file, xkm_output_dir,outFile) == -1) cmd = NULL; } if (xkbDebugFlags) { DebugF("XkbDDXCompileNamedKeymap compiling keymap using:\n"); DebugF(" \"cmd\"\n"); } if (System(cmd)==0) { if (nameRtrn) { strncpy(nameRtrn,outFile,nameRtrnLen); nameRtrn[nameRtrnLen-1]= '\0'; } if (outFile!=NULL) _XkbFree(outFile); if (cmd!=NULL) free(cmd); return True; } DebugF("Error compiling keymap (%s)\n",names->keymap); if (outFile!=NULL) _XkbFree(outFile); if (cmd!=NULL) free(cmd); return False; } static Bool XkbDDXCompileKeymapByNames( XkbDescPtr xkb, XkbComponentNamesPtr names, unsigned want, unsigned need, char * nameRtrn, int nameRtrnLen) { FILE * out; char *buf = NULL, keymap[PATH_MAX],xkm_output_dir[PATH_MAX]; #ifdef WIN32 char tmpname[PATH_MAX]; #endif if ((names->keymap==NULL)||(names->keymap[0]=='\0')) { sprintf(keymap,"server-%s",display); } else { if (strlen(names->keymap) > PATH_MAX - 1) { ErrorF("name of keymap (%s) exceeds max length\n", names->keymap); return False; } strcpy(keymap,names->keymap); } XkbEnsureSafeMapName(keymap); OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir)); #ifdef WIN32 strcpy(tmpname, Win32TempDir()); strcat(tmpname, "\\xkb_XXXXXX"); (void) mktemp(tmpname); #endif if (XkbBaseDirectory!=NULL) { #ifndef WIN32 char *xkmfile = "-"; #else /* WIN32 has no popen. The input must be stored in a file which is used as input for xkbcomp. xkbcomp does not read from stdin. */ char *xkmfile = tmpname; #endif char *xkbbasedir = XkbBaseDirectory; char *xkbbindir = XkbBinDirectory; if (asprintf(&buf, "\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"", xkbbindir, ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), xkbbasedir, xkmfile, PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1, xkm_output_dir,keymap) == -1) buf = NULL; } else { #ifndef WIN32 char *xkmfile = "-"; #else char *xkmfile = tmpname; #endif if (asprintf(&buf, "xkbcomp -w %d -xkm \"%s\" -em1 %s -emp %s -eml %s \"%s%s.xkm\"", ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), xkmfile, PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1, xkm_output_dir,keymap) == -1) buf = NULL; } #ifdef TEST if (buf != NULL) fprintf(stderr, "XkbDDXCompileKeymapByNames: " "Executing command [%s].\n", buf); else fprintf(stderr, "XkbDDXCompileKeymapByNames: " "Callin Popen() with null command.\n"); #endif #ifndef WIN32 out= Popen(buf,"w"); #else out= fopen(tmpname, "w"); #endif if (out!=NULL) { #ifdef DEBUG if (xkbDebugFlags) { ErrorF("XkbDDXCompileKeymapByNames compiling keymap:\n"); XkbWriteXKBKeymapForNames(stderr,names,NULL,xkb,want,need); } #endif XkbWriteXKBKeymapForNames(out,names,NULL,xkb,want,need); #ifndef WIN32 #ifdef __sun if (Pclose(out) != 0) { ErrorF("Warning: Spurious failure reported in Pclose() running 'xkbcomp'.\n"); } if (1) #else if (Pclose(out)==0) #endif #else if (fclose(out)==0 && System(buf) >= 0) #endif { if (xkbDebugFlags) DebugF("xkb executes: %s\n",buf); if (nameRtrn) { strncpy(nameRtrn,keymap,nameRtrnLen); nameRtrn[nameRtrnLen-1]= '\0'; } if (buf != NULL) free (buf); return True; } else DebugF("Error compiling keymap (%s)\n",keymap); #ifdef WIN32 /* remove the temporary file */ unlink(tmpname); #endif } else { #ifndef WIN32 DebugF("Could not invoke keymap compiler\n"); #else DebugF("Could not open file %s\n", tmpname); #endif } if (nameRtrn) nameRtrn[0]= '\0'; if (buf != NULL) free (buf); return False; } static FILE * XkbDDXOpenConfigFile(char *mapName,char *fileNameRtrn,int fileNameRtrnLen) { char buf[PATH_MAX],xkm_output_dir[PATH_MAX]; FILE * file; buf[0]= '\0'; if (mapName!=NULL) { OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir)); if ((XkbBaseDirectory!=NULL)&&(xkm_output_dir[0]!='/') #ifdef WIN32 &&(!isalpha(xkm_output_dir[0]) || xkm_output_dir[1]!=':') #endif ) { if (snprintf(buf, PATH_MAX, "%s/%s%s.xkm", XkbBaseDirectory, xkm_output_dir, mapName) >= PATH_MAX) buf[0] = '\0'; } else { if (snprintf(buf, PATH_MAX, "%s%s.xkm", xkm_output_dir, mapName) >= PATH_MAX) buf[0] = '\0'; } if (buf[0] != '\0') file= fopen(buf,"rb"); else file= NULL; } else file= NULL; if ((fileNameRtrn!=NULL)&&(fileNameRtrnLen>0)) { strncpy(fileNameRtrn,buf,fileNameRtrnLen); buf[fileNameRtrnLen-1]= '\0'; } return file; } unsigned XkbDDXLoadKeymapByNames( DeviceIntPtr keybd, XkbComponentNamesPtr names, unsigned want, unsigned need, XkbFileInfo * finfoRtrn, char * nameRtrn, int nameRtrnLen) { XkbDescPtr xkb; FILE * file; char fileName[PATH_MAX]; unsigned missing; bzero(finfoRtrn,sizeof(XkbFileInfo)); if ((keybd==NULL)||(keybd->key==NULL)||(keybd->key->xkbInfo==NULL)) xkb= NULL; else xkb= keybd->key->xkbInfo->desc; if ((names->keycodes==NULL)&&(names->types==NULL)&& (names->compat==NULL)&&(names->symbols==NULL)&& (names->geometry==NULL)) { if (names->keymap==NULL) { bzero(finfoRtrn,sizeof(XkbFileInfo)); if (xkb && XkbDetermineFileType(finfoRtrn,XkbXKMFile,NULL) && ((finfoRtrn->defined&need)==need) ) { finfoRtrn->xkb= xkb; nameRtrn[0]= '\0'; return finfoRtrn->defined; } return 0; } else if (!XkbDDXCompileNamedKeymap(xkb,names,nameRtrn,nameRtrnLen)) { DebugF("Couldn't compile keymap file\n"); return 0; } } else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need, nameRtrn,nameRtrnLen)){ DebugF("Couldn't compile keymap file\n"); return 0; } file= XkbDDXOpenConfigFile(nameRtrn,fileName,PATH_MAX); if (file==NULL) { LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",fileName); return 0; } missing= XkmReadFile(file,need,want,finfoRtrn); if (finfoRtrn->xkb==NULL) { LogMessage(X_ERROR, "Error loading keymap %s\n",fileName); fclose(file); (void) unlink (fileName); return 0; } else if (xkbDebugFlags) { DebugF("Loaded %s, defined=0x%x\n",fileName,finfoRtrn->defined); } fclose(file); (void) unlink (fileName); return (need|want)&(~missing); } Bool XkbDDXNamesFromRules( DeviceIntPtr keybd, char * rules_name, XkbRF_VarDefsPtr defs, XkbComponentNamesPtr names) { char buf[PATH_MAX]; FILE * file; Bool complete; XkbRF_RulesPtr rules; if (!rules_name) return False; if (XkbBaseDirectory==NULL) { if (strlen(rules_name)+7 > PATH_MAX) return False; sprintf(buf,"rules/%s",rules_name); } else { if (snprintf(buf, PATH_MAX, "%s/rules/%s", XkbBaseDirectory, rules_name) >= PATH_MAX) return False; } if ((file= fopen(buf,"r"))==NULL) return False; if ((rules= XkbRF_Create(0,0))==NULL) { fclose(file); return False; } if (!XkbRF_LoadRules(file,rules)) { fclose(file); XkbRF_Free(rules,True); return False; } bzero((char *)names,sizeof(XkbComponentNamesRec)); complete= XkbRF_GetComponents(rules,defs,names); fclose(file); XkbRF_Free(rules,True); return complete; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/ddxPrivate.c0000644000000000000000000000031513614532331017634 0ustar #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include "windowstr.h" #include int XkbDDXPrivate(DeviceIntPtr dev,KeyCode key,XkbAction *act) { return 0; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/ddxVT.c0000644000000000000000000000312613614532331016556 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #include int XkbDDXSwitchScreen(DeviceIntPtr dev,KeyCode key,XkbAction *act) { return 1; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/Imakefile0000644000000000000000000000420613614532331017172 0ustar #define SGIHyperOpt #include #if BuildXInputExt XKBXI_SRCS = xkbPrOtherEv.c XKBXI_OBJS = xkbPrOtherEv.o #endif #ifdef DfltDisableXKB XKB_DISABLE = -DXKB_DFLT_DISABLED=1 #else XKB_DISABLE = -DXKB_DFLT_DISABLED=0 #endif XKB_DDXDEFS = XkbServerDefines #if defined(NXAgentServer) && NXAgentServer NX_DEFINES = -DNXAGENT_SERVER #endif DDX_SRCS = ddxBeep.c ddxCtrls.c ddxFakeBtn.c ddxFakeMtn.c \ ddxKillSrv.c ddxLEDs.c ddxVT.c ddxLoad.c \ ddxList.c ddxDevBtn.c ddxPrivate.c DDX_OBJS = ddxBeep.o ddxCtrls.o ddxFakeBtn.o ddxFakeMtn.o \ ddxKillSrv.o ddxLEDs.o ddxVT.o ddxLoad.o \ ddxList.o ddxDevBtn.o ddxPrivate.o SRCS = xkb.c xkbUtils.c xkbEvents.c xkbAccessX.c xkbSwap.c \ xkbLEDs.c xkbInit.c xkbActions.c xkbPrKeyEv.c \ xkmread.c xkbtext.c xkbfmisc.c xkberrs.c maprules.c \ XKBMisc.c XKBMAlloc.c XKBAlloc.c XKBGAlloc.c xkbout.c \ $(XKBXI_SRCS) $(DDX_SRCS) OBJS = xkb.o xkbUtils.o xkbEvents.o xkbAccessX.o xkbSwap.o \ xkbLEDs.o xkbInit.o xkbActions.o xkbPrKeyEv.o \ xkmread.o xkbtext.o xkbfmisc.o xkberrs.o maprules.o \ XKBMisc.o XKBMAlloc.o XKBAlloc.o XKBGAlloc.o xkbout.o \ $(XKBXI_OBJS) $(DDX_OBJS) INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/Xext \ -I$(SERVERSRC)/mi $(XF86INCLUDES) \ `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln DEFINES = $(XKB_DDXDEFS) $(NX_DEFINES) XKB_DEFINES = -DXKB_BASE_DIRECTORY=\"$(SYSTEMXKBCONFDIR)\" -DXKB_BIN_DIRECTORY=\"$(SYSTEMXKBBINDIR)\" -DXKB_DFLT_RULES_FILE=\"base\" -DXKB_DFLT_KB_LAYOUT=\"us\" -DXKB_DFLT_KB_MODEL=\"pc102\" $(XKB_DISABLE) NormalLibraryObjectRule() NormalLibraryTarget(xkb,$(OBJS)) LintLibraryTarget(xkb,$(SRCS)) NormalLintTarget($(SRCS)) SpecialCObjectRule(xkbInit,$(ICONFIGFILES),$(XKB_DEFINES)) #if BuildLibraries #if UseConfDirForXkb LinkConfDirectory(xkb,.,xkb,.) ODIR = $(CONFDIR) #else ODIR = $(LIBDIR) #endif #ifdef VarDbDirectory NDIR = $(VARDBDIR) #else NDIR = $(CONFDIR) #endif #if !UseConfDirForXkb || defined(VarDbDirectory) LinkConfDirectoryLong(xkb,xkb,compiled,compiled,$(ODIR),$(NDIR)) #endif #endif DependTarget() nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/maprules.c0000644000000000000000000007751413614532331017371 0ustar /************************************************************ Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #define X_INCLUDE_STRING_H #define XOS_USE_NO_LOCKING #include #include #include #include #include #include #include #include "misc.h" #include "inputstr.h" #include "dix.h" #include "xkbstr.h" #include /***====================================================================***/ #define DFLT_LINE_SIZE 128 typedef struct { int line_num; int sz_line; int num_line; char buf[DFLT_LINE_SIZE]; char * line; } InputLine; static void InitInputLine(InputLine *line) { line->line_num= 1; line->num_line= 0; line->sz_line= DFLT_LINE_SIZE; line->line= line->buf; return; } static void FreeInputLine(InputLine *line) { if (line->line!=line->buf) _XkbFree(line->line); line->line_num= 1; line->num_line= 0; line->sz_line= DFLT_LINE_SIZE; line->line= line->buf; return; } static int InputLineAddChar(InputLine *line,int ch) { if (line->num_line>=line->sz_line) { if (line->line==line->buf) { line->line= (char *)_XkbAlloc(line->sz_line*2); memcpy(line->line,line->buf,line->sz_line); } else { line->line=(char *)_XkbRealloc((char *)line->line,line->sz_line*2); } line->sz_line*= 2; } line->line[line->num_line++]= ch; return ch; } #define ADD_CHAR(l,c) ((l)->num_line<(l)->sz_line?\ (int)((l)->line[(l)->num_line++]= (c)):\ InputLineAddChar(l,c)) static Bool GetInputLine(FILE *file,InputLine *line,Bool checkbang) { int ch; Bool endOfFile,spacePending,slashPending,inComment; endOfFile= False; while ((!endOfFile)&&(line->num_line==0)) { spacePending= slashPending= inComment= False; while (((ch=getc(file))!='\n')&&(ch!=EOF)) { if (ch=='\\') { if ((ch=getc(file))==EOF) break; if (ch=='\n') { inComment= False; ch= ' '; line->line_num++; } } if (inComment) continue; if (ch=='/') { if (slashPending) { inComment= True; slashPending= False; } else { slashPending= True; } continue; } else if (slashPending) { if (spacePending) { ADD_CHAR(line,' '); spacePending= False; } ADD_CHAR(line,'/'); slashPending= False; } if (isspace(ch)) { while (isspace(ch)&&(ch!='\n')&&(ch!=EOF)) { ch= getc(file); } if (ch==EOF) break; if ((ch!='\n')&&(line->num_line>0)) spacePending= True; ungetc(ch,file); } else { if (spacePending) { ADD_CHAR(line,' '); spacePending= False; } if (checkbang && ch=='!') { if (line->num_line!=0) { DebugF("The '!' legal only at start of line\n"); DebugF("Line containing '!' ignored\n"); line->num_line= 0; inComment= 0; break; } } ADD_CHAR(line,ch); } } if (ch==EOF) endOfFile= True; /* else line->num_line++;*/ } if ((line->num_line==0)&&(endOfFile)) return False; ADD_CHAR(line,'\0'); return True; } /***====================================================================***/ #define MODEL 0 #define LAYOUT 1 #define VARIANT 2 #define OPTION 3 #define KEYCODES 4 #define SYMBOLS 5 #define TYPES 6 #define COMPAT 7 #define GEOMETRY 8 #define KEYMAP 9 #define MAX_WORDS 10 #define PART_MASK 0x000F #define COMPONENT_MASK 0x03F0 static char * cname[MAX_WORDS] = { "model", "layout", "variant", "option", "keycodes", "symbols", "types", "compat", "geometry", "keymap" }; typedef struct _RemapSpec { int number; int num_remap; struct { int word; int index; } remap[MAX_WORDS]; } RemapSpec; typedef struct _FileSpec { char * name[MAX_WORDS]; struct _FileSpec * pending; } FileSpec; typedef struct { char * model; char * layout[XkbNumKbdGroups+1]; char * variant[XkbNumKbdGroups+1]; char * options; } XkbRF_MultiDefsRec, *XkbRF_MultiDefsPtr; #define NDX_BUFF_SIZE 4 /***====================================================================***/ static char* get_index(char *str, int *ndx) { char ndx_buf[NDX_BUFF_SIZE]; char *end; if (*str != '[') { *ndx = 0; return str; } str++; end = strchr(str, ']'); if (end == NULL) { *ndx = -1; return str - 1; } if ( (end - str) >= NDX_BUFF_SIZE) { *ndx = -1; return end + 1; } strncpy(ndx_buf, str, end - str); ndx_buf[end - str] = '\0'; *ndx = atoi(ndx_buf); return end + 1; } static void SetUpRemap(InputLine *line,RemapSpec *remap) { char * tok,*str; unsigned present, l_ndx_present, v_ndx_present; register int i; int len, ndx; _Xstrtokparams strtok_buf; Bool found; l_ndx_present = v_ndx_present = present= 0; str= &line->line[1]; len = remap->number; bzero((char *)remap,sizeof(RemapSpec)); remap->number = len; while ((tok=_XStrtok(str," ",strtok_buf))!=NULL) { found= False; str= NULL; if (strcmp(tok,"=")==0) continue; for (i=0;i len) { char *end = get_index(tok+len, &ndx); if ((i != LAYOUT && i != VARIANT) || *end != '\0' || ndx == -1) break; if (ndx < 1 || ndx > XkbNumKbdGroups) { DebugF("Illegal %s index: %d\n", cname[i], ndx); DebugF("Index must be in range 1..%d\n", XkbNumKbdGroups); break; } } else { ndx = 0; } found= True; if (present&(1<remap[remap->num_remap].word= i; remap->remap[remap->num_remap++].index= ndx; break; } } if (!found) { fprintf(stderr,"Unknown component \"%s\" ignored\n",tok); } } if ((present&PART_MASK)==0) { unsigned mask= PART_MASK; ErrorF("Mapping needs at least one of "); for (i=0; (inum_remap= 0; return; } if ((present&COMPONENT_MASK)==0) { DebugF("Mapping needs at least one component\n"); DebugF("Illegal mapping ignored\n"); remap->num_remap= 0; return; } if (((present&COMPONENT_MASK)&(1<num_remap= 0; return; } remap->number++; return; } static Bool MatchOneOf(char *wanted,char *vals_defined) { char *str,*next; int want_len= strlen(wanted); for (str=vals_defined,next=NULL;str!=NULL;str=next) { int len; next= strchr(str,','); if (next) { len= next-str; next++; } else { len= strlen(str); } if ((len==want_len)&&(strncmp(wanted,str,len)==0)) return True; } return False; } /***====================================================================***/ static Bool CheckLine( InputLine * line, RemapSpec * remap, XkbRF_RulePtr rule, XkbRF_GroupPtr group) { char * str,*tok; register int nread, i; FileSpec tmp; _Xstrtokparams strtok_buf; Bool append = False; if (line->line[0]=='!') { if (line->line[1] == '$' || (line->line[1] == ' ' && line->line[2] == '$')) { char *gname = strchr(line->line, '$'); char *words = strchr(gname, ' '); if(!words) return False; *words++ = '\0'; for (; *words; words++) { if (*words != '=' && *words != ' ') break; } if (*words == '\0') return False; group->name = Xstrdup(gname); group->words = Xstrdup(words); for (i = 1, words = group->words; *words; words++) { if ( *words == ' ') { *words++ = '\0'; i++; } } group->number = i; return True; } else { SetUpRemap(line,remap); return False; } } if (remap->num_remap==0) { DebugF("Must have a mapping before first line of data\n"); DebugF("Illegal line of data ignored\n"); return False; } bzero((char *)&tmp,sizeof(FileSpec)); str= line->line; for (nread= 0;(tok=_XStrtok(str," ",strtok_buf))!=NULL;nread++) { str= NULL; if (strcmp(tok,"=")==0) { nread--; continue; } if (nread>remap->num_remap) { DebugF("Too many words on a line\n"); DebugF("Extra word \"%s\" ignored\n",tok); continue; } tmp.name[remap->remap[nread].word]= tok; if (*tok == '+' || *tok == '|') append = True; } if (nreadnum_remap) { DebugF("Too few words on a line: %s\n", line->line); DebugF("line ignored\n"); return False; } rule->flags= 0; rule->number = remap->number; if (tmp.name[OPTION]) rule->flags|= XkbRF_Option; else if (append) rule->flags|= XkbRF_Append; else rule->flags|= XkbRF_Normal; rule->model= Xstrdup(tmp.name[MODEL]); rule->layout= Xstrdup(tmp.name[LAYOUT]); rule->variant= Xstrdup(tmp.name[VARIANT]); rule->option= Xstrdup(tmp.name[OPTION]); rule->keycodes= Xstrdup(tmp.name[KEYCODES]); rule->symbols= Xstrdup(tmp.name[SYMBOLS]); rule->types= Xstrdup(tmp.name[TYPES]); rule->compat= Xstrdup(tmp.name[COMPAT]); rule->geometry= Xstrdup(tmp.name[GEOMETRY]); rule->keymap= Xstrdup(tmp.name[KEYMAP]); rule->layout_num = rule->variant_num = 0; for (i = 0; i < nread; i++) { if (remap->remap[i].index) { if (remap->remap[i].word == LAYOUT) rule->layout_num = remap->remap[i].index; if (remap->remap[i].word == VARIANT) rule->variant_num = remap->remap[i].index; } } return True; } static char * _Concat(char *str1,char *str2) { int len; if ((!str1)||(!str2)) return str1; len= strlen(str1)+strlen(str2)+1; str1= _XkbTypedRealloc(str1,len,char); if (str1) strcat(str1,str2); return str1; } static void squeeze_spaces(char *p1) { char *p2; for (p2 = p1; *p2; p2++) { *p1 = *p2; if (*p1 != ' ') p1++; } *p1 = '\0'; } static Bool MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs) { bzero((char *)mdefs,sizeof(XkbRF_MultiDefsRec)); mdefs->model = defs->model; mdefs->options = Xstrdup(defs->options); if (mdefs->options) squeeze_spaces(mdefs->options); if (defs->layout) { if (!strchr(defs->layout, ',')) { mdefs->layout[0] = defs->layout; } else { char *p; int i; mdefs->layout[1] = Xstrdup(defs->layout); if (mdefs->layout[1] == NULL) return False; squeeze_spaces(mdefs->layout[1]); p = mdefs->layout[1]; for (i = 2; i <= XkbNumKbdGroups; i++) { if ((p = strchr(p, ','))) { *p++ = '\0'; mdefs->layout[i] = p; } else { break; } } if (p && (p = strchr(p, ','))) *p = '\0'; } } if (defs->variant) { if (!strchr(defs->variant, ',')) { mdefs->variant[0] = defs->variant; } else { char *p; int i; mdefs->variant[1] = Xstrdup(defs->variant); if (mdefs->variant[1] == NULL) return False; squeeze_spaces(mdefs->variant[1]); p = mdefs->variant[1]; for (i = 2; i <= XkbNumKbdGroups; i++) { if ((p = strchr(p, ','))) { *p++ = '\0'; mdefs->variant[i] = p; } else { break; } } if (p && (p = strchr(p, ','))) *p = '\0'; } } return True; } static void FreeMultiDefs(XkbRF_MultiDefsPtr defs) { if (defs->options) _XkbFree(defs->options); if (defs->layout[1]) _XkbFree(defs->layout[1]); if (defs->variant[1]) _XkbFree(defs->variant[1]); } static void Apply(char *src, char **dst) { if (src) { if (*src == '+' || *src == '!') { *dst= _Concat(*dst, src); } else { if (*dst == NULL) *dst= Xstrdup(src); } } } static void XkbRF_ApplyRule( XkbRF_RulePtr rule, XkbComponentNamesPtr names) { rule->flags&= ~XkbRF_PendingMatch; /* clear the flag because it's applied */ Apply(rule->keycodes, &names->keycodes); Apply(rule->symbols, &names->symbols); Apply(rule->types, &names->types); Apply(rule->compat, &names->compat); Apply(rule->geometry, &names->geometry); Apply(rule->keymap, &names->keymap); } static Bool CheckGroup( XkbRF_RulesPtr rules, char * group_name, char * name) { int i; char *p; XkbRF_GroupPtr group; for (i = 0, group = rules->groups; i < rules->num_groups; i++, group++) { if (! strcmp(group->name, group_name)) { break; } } if (i == rules->num_groups) return False; for (i = 0, p = group->words; i < group->number; i++, p += strlen(p)+1) { if (! strcmp(p, name)) { return True; } } return False; } static int XkbRF_CheckApplyRule( XkbRF_RulePtr rule, XkbRF_MultiDefsPtr mdefs, XkbComponentNamesPtr names, XkbRF_RulesPtr rules) { Bool pending = False; if (rule->model != NULL) { if(mdefs->model == NULL) return 0; if (strcmp(rule->model, "*") == 0) { pending = True; } else { if (rule->model[0] == '$') { if (!CheckGroup(rules, rule->model, mdefs->model)) return 0; } else { if (strcmp(rule->model, mdefs->model) != 0) return 0; } } } if (rule->option != NULL) { if (mdefs->options == NULL) return 0; if ((!MatchOneOf(rule->option,mdefs->options))) return 0; } if (rule->layout != NULL) { if(mdefs->layout[rule->layout_num] == NULL || *mdefs->layout[rule->layout_num] == '\0') return 0; if (strcmp(rule->layout, "*") == 0) { pending = True; } else { if (rule->layout[0] == '$') { if (!CheckGroup(rules, rule->layout, mdefs->layout[rule->layout_num])) return 0; } else { if (strcmp(rule->layout, mdefs->layout[rule->layout_num]) != 0) return 0; } } } if (rule->variant != NULL) { if (mdefs->variant[rule->variant_num] == NULL || *mdefs->variant[rule->variant_num] == '\0') return 0; if (strcmp(rule->variant, "*") == 0) { pending = True; } else { if (rule->variant[0] == '$') { if (!CheckGroup(rules, rule->variant, mdefs->variant[rule->variant_num])) return 0; } else { if (strcmp(rule->variant, mdefs->variant[rule->variant_num]) != 0) return 0; } } } if (pending) { rule->flags|= XkbRF_PendingMatch; return rule->number; } /* exact match, apply it now */ XkbRF_ApplyRule(rule,names); return rule->number; } static void XkbRF_ClearPartialMatches(XkbRF_RulesPtr rules) { register int i; XkbRF_RulePtr rule; for (i=0,rule=rules->rules;inum_rules;i++,rule++) { rule->flags&= ~XkbRF_PendingMatch; } } static void XkbRF_ApplyPartialMatches(XkbRF_RulesPtr rules,XkbComponentNamesPtr names) { int i; XkbRF_RulePtr rule; for (rule = rules->rules, i = 0; i < rules->num_rules; i++, rule++) { if ((rule->flags&XkbRF_PendingMatch)==0) continue; XkbRF_ApplyRule(rule,names); } } static void XkbRF_CheckApplyRules( XkbRF_RulesPtr rules, XkbRF_MultiDefsPtr mdefs, XkbComponentNamesPtr names, int flags) { int i; XkbRF_RulePtr rule; int skip; for (rule = rules->rules, i=0; i < rules->num_rules; rule++, i++) { if ((rule->flags & flags) != flags) continue; skip = XkbRF_CheckApplyRule(rule, mdefs, names, rules); if (skip && !(flags & XkbRF_Option)) { for ( ;(i < rules->num_rules) && (rule->number == skip); rule++, i++); rule--; i--; } } } /***====================================================================***/ static char * XkbRF_SubstituteVars(char *name, XkbRF_MultiDefsPtr mdefs) { char *str, *outstr, *orig, *var; int len, ndx; orig= name; str= index(name,'%'); if (str==NULL) return name; len= strlen(name); while (str!=NULL) { char pfx= str[1]; int extra_len= 0; if ((pfx=='+')||(pfx=='|')||(pfx=='_')||(pfx=='-')) { extra_len= 1; str++; } else if (pfx=='(') { extra_len= 2; str++; } var = str + 1; str = get_index(var + 1, &ndx); if (ndx == -1) { str = index(str,'%'); continue; } if ((*var=='l') && mdefs->layout[ndx] && *mdefs->layout[ndx]) len+= strlen(mdefs->layout[ndx])+extra_len; else if ((*var=='m')&&mdefs->model) len+= strlen(mdefs->model)+extra_len; else if ((*var=='v') && mdefs->variant[ndx] && *mdefs->variant[ndx]) len+= strlen(mdefs->variant[ndx])+extra_len; if ((pfx=='(')&&(*str==')')) { str++; } str= index(&str[0],'%'); } name= (char *)_XkbAlloc(len+1); str= orig; outstr= name; while (*str!='\0') { if (str[0]=='%') { char pfx,sfx; str++; pfx= str[0]; sfx= '\0'; if ((pfx=='+')||(pfx=='|')||(pfx=='_')||(pfx=='-')) { str++; } else if (pfx=='(') { sfx= ')'; str++; } else pfx= '\0'; var = str; str = get_index(var + 1, &ndx); if (ndx == -1) { continue; } if ((*var=='l') && mdefs->layout[ndx] && *mdefs->layout[ndx]) { if (pfx) *outstr++= pfx; strcpy(outstr,mdefs->layout[ndx]); outstr+= strlen(mdefs->layout[ndx]); if (sfx) *outstr++= sfx; } else if ((*var=='m')&&(mdefs->model)) { if (pfx) *outstr++= pfx; strcpy(outstr,mdefs->model); outstr+= strlen(mdefs->model); if (sfx) *outstr++= sfx; } else if ((*var=='v') && mdefs->variant[ndx] && *mdefs->variant[ndx]) { if (pfx) *outstr++= pfx; strcpy(outstr,mdefs->variant[ndx]); outstr+= strlen(mdefs->variant[ndx]); if (sfx) *outstr++= sfx; } if ((pfx=='(')&&(*str==')')) str++; } else { *outstr++= *str++; } } *outstr++= '\0'; if (orig!=name) _XkbFree(orig); return name; } /***====================================================================***/ Bool XkbRF_GetComponents( XkbRF_RulesPtr rules, XkbRF_VarDefsPtr defs, XkbComponentNamesPtr names) { XkbRF_MultiDefsRec mdefs; MakeMultiDefs(&mdefs, defs); bzero((char *)names,sizeof(XkbComponentNamesRec)); XkbRF_ClearPartialMatches(rules); XkbRF_CheckApplyRules(rules, &mdefs, names, XkbRF_Normal); XkbRF_ApplyPartialMatches(rules, names); XkbRF_CheckApplyRules(rules, &mdefs, names, XkbRF_Append); XkbRF_ApplyPartialMatches(rules, names); XkbRF_CheckApplyRules(rules, &mdefs, names, XkbRF_Option); if (names->keycodes) names->keycodes= XkbRF_SubstituteVars(names->keycodes, &mdefs); if (names->symbols) names->symbols= XkbRF_SubstituteVars(names->symbols, &mdefs); if (names->types) names->types= XkbRF_SubstituteVars(names->types, &mdefs); if (names->compat) names->compat= XkbRF_SubstituteVars(names->compat, &mdefs); if (names->geometry) names->geometry= XkbRF_SubstituteVars(names->geometry, &mdefs); if (names->keymap) names->keymap= XkbRF_SubstituteVars(names->keymap, &mdefs); FreeMultiDefs(&mdefs); return (names->keycodes && names->symbols && names->types && names->compat && names->geometry ) || names->keymap; } XkbRF_RulePtr XkbRF_AddRule(XkbRF_RulesPtr rules) { if (rules->sz_rules<1) { rules->sz_rules= 16; rules->num_rules= 0; rules->rules= _XkbTypedCalloc(rules->sz_rules,XkbRF_RuleRec); } else if (rules->num_rules>=rules->sz_rules) { rules->sz_rules*= 2; rules->rules= _XkbTypedRealloc(rules->rules,rules->sz_rules, XkbRF_RuleRec); } if (!rules->rules) { rules->sz_rules= rules->num_rules= 0; DebugF("Allocation failure in XkbRF_AddRule\n"); return NULL; } bzero((char *)&rules->rules[rules->num_rules],sizeof(XkbRF_RuleRec)); return &rules->rules[rules->num_rules++]; } XkbRF_GroupPtr XkbRF_AddGroup(XkbRF_RulesPtr rules) { if (rules->sz_groups<1) { rules->sz_groups= 16; rules->num_groups= 0; rules->groups= _XkbTypedCalloc(rules->sz_groups,XkbRF_GroupRec); } else if (rules->num_groups >= rules->sz_groups) { rules->sz_groups *= 2; rules->groups= _XkbTypedRealloc(rules->groups,rules->sz_groups, XkbRF_GroupRec); } if (!rules->groups) { rules->sz_groups= rules->num_groups= 0; return NULL; } bzero((char *)&rules->groups[rules->num_groups],sizeof(XkbRF_GroupRec)); return &rules->groups[rules->num_groups++]; } Bool XkbRF_LoadRules(FILE *file, XkbRF_RulesPtr rules) { InputLine line; RemapSpec remap; XkbRF_RuleRec trule,*rule; XkbRF_GroupRec tgroup,*group; if (!(rules && file)) return False; bzero((char *)&remap,sizeof(RemapSpec)); bzero((char *)&tgroup,sizeof(XkbRF_GroupRec)); InitInputLine(&line); while (GetInputLine(file,&line,True)) { if (CheckLine(&line,&remap,&trule,&tgroup)) { if (tgroup.number) { if ((group= XkbRF_AddGroup(rules))!=NULL) { *group= tgroup; bzero((char *)&tgroup,sizeof(XkbRF_GroupRec)); } } else { if ((rule= XkbRF_AddRule(rules))!=NULL) { *rule= trule; bzero((char *)&trule,sizeof(XkbRF_RuleRec)); } } } line.num_line= 0; } FreeInputLine(&line); return True; } Bool XkbRF_LoadRulesByName(char *base,char *locale,XkbRF_RulesPtr rules) { FILE * file; char buf[PATH_MAX]; Bool ok; if ((!base)||(!rules)) return False; if (locale) { if (snprintf(buf, PATH_MAX, "%s-%s", base, locale) >= PATH_MAX) return False; } else { if (strlen(base)+1 > PATH_MAX) return False; strcpy(buf,base); } file= fopen(buf, "r"); if ((!file)&&(locale)) { /* fallback if locale was specified */ strcpy(buf,base); file= fopen(buf, "r"); } if (!file) return False; ok= XkbRF_LoadRules(file,rules); fclose(file); return ok; } /***====================================================================***/ #define HEAD_NONE 0 #define HEAD_MODEL 1 #define HEAD_LAYOUT 2 #define HEAD_VARIANT 3 #define HEAD_OPTION 4 #define HEAD_EXTRA 5 XkbRF_VarDescPtr XkbRF_AddVarDesc(XkbRF_DescribeVarsPtr vars) { if (vars->sz_desc<1) { vars->sz_desc= 16; vars->num_desc= 0; vars->desc= _XkbTypedCalloc(vars->sz_desc,XkbRF_VarDescRec); } else if (vars->num_desc>=vars->sz_desc) { vars->sz_desc*= 2; vars->desc= _XkbTypedRealloc(vars->desc,vars->sz_desc,XkbRF_VarDescRec); } if (!vars->desc) { vars->sz_desc= vars->num_desc= 0; DebugF("Allocation failure in XkbRF_AddVarDesc\n"); return NULL; } vars->desc[vars->num_desc].name= NULL; vars->desc[vars->num_desc].desc= NULL; return &vars->desc[vars->num_desc++]; } XkbRF_VarDescPtr XkbRF_AddVarDescCopy(XkbRF_DescribeVarsPtr vars,XkbRF_VarDescPtr from) { XkbRF_VarDescPtr nd; if ((nd=XkbRF_AddVarDesc(vars))!=NULL) { nd->name= Xstrdup(from->name); nd->desc= Xstrdup(from->desc); } return nd; } XkbRF_DescribeVarsPtr XkbRF_AddVarToDescribe(XkbRF_RulesPtr rules,char *name) { if (rules->sz_extra<1) { rules->num_extra= 0; rules->sz_extra= 1; rules->extra_names= _XkbTypedCalloc(rules->sz_extra,char *); rules->extra= _XkbTypedCalloc(rules->sz_extra, XkbRF_DescribeVarsRec); } else if (rules->num_extra>=rules->sz_extra) { rules->sz_extra*= 2; rules->extra_names= _XkbTypedRealloc(rules->extra_names,rules->sz_extra, char *); rules->extra=_XkbTypedRealloc(rules->extra, rules->sz_extra, XkbRF_DescribeVarsRec); } if ((!rules->extra_names)||(!rules->extra)) { DebugF("allocation error in extra parts\n"); rules->sz_extra= rules->num_extra= 0; rules->extra_names= NULL; rules->extra= NULL; return NULL; } rules->extra_names[rules->num_extra]= Xstrdup(name); bzero(&rules->extra[rules->num_extra],sizeof(XkbRF_DescribeVarsRec)); return &rules->extra[rules->num_extra++]; } Bool XkbRF_LoadDescriptions(FILE *file,XkbRF_RulesPtr rules) { InputLine line; XkbRF_VarDescRec tmp; char *tok; int len,headingtype,extra_ndx = 0; bzero((char *)&tmp, sizeof(XkbRF_VarDescRec)); headingtype = HEAD_NONE; InitInputLine(&line); for ( ; GetInputLine(file,&line,False); line.num_line= 0) { if (line.line[0]=='!') { tok = strtok(&(line.line[1]), " \t"); if (strcasecmp(tok,"model") == 0) headingtype = HEAD_MODEL; else if (strcasecmp(tok,"layout") == 0) headingtype = HEAD_LAYOUT; else if (strcasecmp(tok,"variant") == 0) headingtype = HEAD_VARIANT; else if (strcasecmp(tok,"option") == 0) headingtype = HEAD_OPTION; else { int i; headingtype = HEAD_EXTRA; extra_ndx= -1; for (i=0;(inum_extra)&&(extra_ndx<0);i++) { if (!strcasecmp(tok,rules->extra_names[i])) extra_ndx= i; } if (extra_ndx<0) { XkbRF_DescribeVarsPtr var; DebugF("Extra heading \"%s\" encountered\n",tok); var= XkbRF_AddVarToDescribe(rules,tok); if (var) extra_ndx= var-rules->extra; else headingtype= HEAD_NONE; } } continue; } if (headingtype == HEAD_NONE) { DebugF("Must have a heading before first line of data\n"); DebugF("Illegal line of data ignored\n"); continue; } len = strlen(line.line); if ((tmp.name= strtok(line.line, " \t")) == NULL) { DebugF("Huh? No token on line\n"); DebugF("Illegal line of data ignored\n"); continue; } if (strlen(tmp.name) == len) { DebugF("No description found\n"); DebugF("Illegal line of data ignored\n"); continue; } tok = line.line + strlen(tmp.name) + 1; while ((*tok!='\n')&&isspace(*tok)) tok++; if (*tok == '\0') { DebugF("No description found\n"); DebugF("Illegal line of data ignored\n"); continue; } tmp.desc= tok; switch (headingtype) { case HEAD_MODEL: XkbRF_AddVarDescCopy(&rules->models,&tmp); break; case HEAD_LAYOUT: XkbRF_AddVarDescCopy(&rules->layouts,&tmp); break; case HEAD_VARIANT: XkbRF_AddVarDescCopy(&rules->variants,&tmp); break; case HEAD_OPTION: XkbRF_AddVarDescCopy(&rules->options,&tmp); break; case HEAD_EXTRA: XkbRF_AddVarDescCopy(&rules->extra[extra_ndx],&tmp); break; } } FreeInputLine(&line); if ((rules->models.num_desc==0) && (rules->layouts.num_desc==0) && (rules->variants.num_desc==0) && (rules->options.num_desc==0) && (rules->num_extra==0)) { return False; } return True; } Bool XkbRF_LoadDescriptionsByName(char *base,char *locale,XkbRF_RulesPtr rules) { FILE * file; char buf[PATH_MAX]; Bool ok; if ((!base)||(!rules)) return False; if (locale) { if (strlen(base)+strlen(locale)+6 > PATH_MAX) return False; sprintf(buf,"%s-%s.lst", base, locale); } else { if (strlen(base)+5 > PATH_MAX) return False; sprintf(buf,"%s.lst", base); } file= fopen(buf, "r"); if ((!file)&&(locale)) { /* fallback if locale was specified */ sprintf(buf,"%s.lst", base); file= fopen(buf, "r"); } if (!file) return False; ok= XkbRF_LoadDescriptions(file,rules); fclose(file); return ok; } /***====================================================================***/ XkbRF_RulesPtr XkbRF_Load(char *base,char *locale,Bool wantDesc,Bool wantRules) { XkbRF_RulesPtr rules; if ((!base)||((!wantDesc)&&(!wantRules))) return NULL; if ((rules=_XkbTypedCalloc(1,XkbRF_RulesRec))==NULL) return NULL; if (wantDesc&&(!XkbRF_LoadDescriptionsByName(base,locale,rules))) { XkbRF_Free(rules,True); return NULL; } if (wantRules&&(!XkbRF_LoadRulesByName(base,locale,rules))) { XkbRF_Free(rules,True); return NULL; } return rules; } XkbRF_RulesPtr XkbRF_Create(int szRules,int szExtra) { XkbRF_RulesPtr rules; if ((rules=_XkbTypedCalloc(1,XkbRF_RulesRec))==NULL) return NULL; if (szRules>0) { rules->sz_rules= szRules; rules->rules= _XkbTypedCalloc(rules->sz_rules,XkbRF_RuleRec); if (!rules->rules) { _XkbFree(rules); return NULL; } } if (szExtra>0) { rules->sz_extra= szExtra; rules->extra= _XkbTypedCalloc(rules->sz_extra,XkbRF_DescribeVarsRec); if (!rules->extra) { if (rules->rules) _XkbFree(rules->rules); _XkbFree(rules); return NULL; } } return rules; } /***====================================================================***/ static void XkbRF_ClearVarDescriptions(XkbRF_DescribeVarsPtr var) { register int i; for (i=0;inum_desc;i++) { if (var->desc[i].name) _XkbFree(var->desc[i].name); if (var->desc[i].desc) _XkbFree(var->desc[i].desc); var->desc[i].name= var->desc[i].desc= NULL; } if (var->desc) _XkbFree(var->desc); var->desc= NULL; return; } void XkbRF_Free(XkbRF_RulesPtr rules,Bool freeRules) { int i; XkbRF_RulePtr rule; XkbRF_GroupPtr group; if (!rules) return; XkbRF_ClearVarDescriptions(&rules->models); XkbRF_ClearVarDescriptions(&rules->layouts); XkbRF_ClearVarDescriptions(&rules->variants); XkbRF_ClearVarDescriptions(&rules->options); if (rules->extra) { for (i = 0; i < rules->num_extra; i++) { XkbRF_ClearVarDescriptions(&rules->extra[i]); } _XkbFree(rules->extra); rules->num_extra= rules->sz_extra= 0; rules->extra= NULL; } if (rules->rules) { for (i=0,rule=rules->rules;inum_rules;i++,rule++) { if (rule->model) _XkbFree(rule->model); if (rule->layout) _XkbFree(rule->layout); if (rule->variant) _XkbFree(rule->variant); if (rule->option) _XkbFree(rule->option); if (rule->keycodes) _XkbFree(rule->keycodes); if (rule->symbols) _XkbFree(rule->symbols); if (rule->types) _XkbFree(rule->types); if (rule->compat) _XkbFree(rule->compat); if (rule->geometry) _XkbFree(rule->geometry); if (rule->keymap) _XkbFree(rule->keymap); bzero((char *)rule,sizeof(XkbRF_RuleRec)); } _XkbFree(rules->rules); rules->num_rules= rules->sz_rules= 0; rules->rules= NULL; } if (rules->groups) { for (i=0, group=rules->groups;inum_groups;i++,group++) { if (group->name) _XkbFree(group->name); if (group->words) _XkbFree(group->words); } _XkbFree(rules->groups); rules->num_groups= 0; rules->groups= NULL; } if (freeRules) _XkbFree(rules); return; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkbAccessX.c0000644000000000000000000005654313614532331017576 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include "inputstr.h" #include #if !defined(WIN32) #include #endif int XkbDfltRepeatDelay= 660; int XkbDfltRepeatInterval= 40; void * XkbLastRepeatEvent= NULL; #define DFLT_TIMEOUT_CTRLS (XkbAX_KRGMask|XkbStickyKeysMask|XkbMouseKeysMask) #define DFLT_TIMEOUT_OPTS (XkbAX_IndicatorFBMask) unsigned short XkbDfltAccessXTimeout= 120; unsigned int XkbDfltAccessXTimeoutMask= DFLT_TIMEOUT_CTRLS; static unsigned int XkbDfltAccessXTimeoutValues= 0; static unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS; static unsigned int XkbDfltAccessXTimeoutOptionsValues= 0; unsigned int XkbDfltAccessXFeedback= XkbAccessXFeedbackMask; unsigned short XkbDfltAccessXOptions= XkbAX_AllOptionsMask & ~(XkbAX_IndicatorFBMask|XkbAX_SKReleaseFBMask|XkbAX_SKRejectFBMask); void AccessXComputeCurveFactor(XkbSrvInfoPtr xkbi,XkbControlsPtr ctrls) { xkbi->mouseKeysCurve= 1.0+(((double)ctrls->mk_curve)*0.001); xkbi->mouseKeysCurveFactor= ( ((double)ctrls->mk_max_speed)/ pow((double)ctrls->mk_time_to_max,xkbi->mouseKeysCurve)); return; } void AccessXInit(DeviceIntPtr keybd) { XkbSrvInfoPtr xkbi = keybd->key->xkbInfo; XkbControlsPtr ctrls = xkbi->desc->ctrls; xkbi->shiftKeyCount= 0; xkbi->mouseKeysCounter= 0; xkbi->inactiveKey= 0; xkbi->slowKey= 0; xkbi->repeatKey= 0; xkbi->krgTimerActive= _OFF_TIMER; xkbi->beepType= _BEEP_NONE; xkbi->beepCount= 0; xkbi->mouseKeyTimer= NULL; xkbi->slowKeysTimer= NULL; xkbi->bounceKeysTimer= NULL; xkbi->repeatKeyTimer= NULL; xkbi->krgTimer= NULL; xkbi->beepTimer= NULL; ctrls->repeat_delay = XkbDfltRepeatDelay; ctrls->repeat_interval = XkbDfltRepeatInterval; ctrls->debounce_delay = 300; ctrls->slow_keys_delay = 300; ctrls->mk_delay = 160; ctrls->mk_interval = 40; ctrls->mk_time_to_max = 30; ctrls->mk_max_speed = 30; ctrls->mk_curve = 500; ctrls->mk_dflt_btn = 1; ctrls->ax_timeout = XkbDfltAccessXTimeout; ctrls->axt_ctrls_mask = XkbDfltAccessXTimeoutMask; ctrls->axt_ctrls_values = XkbDfltAccessXTimeoutValues; ctrls->axt_opts_mask = XkbDfltAccessXTimeoutOptionsMask; ctrls->axt_opts_values = XkbDfltAccessXTimeoutOptionsValues; if (XkbDfltAccessXTimeout) ctrls->enabled_ctrls |= XkbAccessXTimeoutMask; else ctrls->enabled_ctrls &= ~XkbAccessXTimeoutMask; ctrls->enabled_ctrls |= XkbDfltAccessXFeedback; ctrls->ax_options = XkbDfltAccessXOptions; AccessXComputeCurveFactor(xkbi,ctrls); return; } /************************************************************************/ /* */ /* AccessXKeyboardEvent */ /* */ /* Generate a synthetic keyboard event. */ /* */ /************************************************************************/ static void AccessXKeyboardEvent(DeviceIntPtr keybd, BYTE type, BYTE keyCode, Bool isRepeat) { xEvent xE; xE.u.u.type = type; xE.u.u.detail = keyCode; xE.u.keyButtonPointer.time = GetTimeInMillis(); if (xkbDebugFlags&0x8) { DebugF("AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up")); } if (!_XkbIsPressEvent(type) && isRepeat) XkbLastRepeatEvent= (void *)&xE; XkbProcessKeyboardEvent(&xE,keybd,1L); XkbLastRepeatEvent= NULL; return; } /* AccessXKeyboardEvent */ /************************************************************************/ /* */ /* AccessXKRGTurnOn */ /* */ /* Turn the keyboard response group on. */ /* */ /************************************************************************/ static void AccessXKRGTurnOn(DeviceIntPtr dev,CARD16 KRGControl,xkbControlsNotify *pCN) { XkbSrvInfoPtr xkbi = dev->key->xkbInfo; XkbControlsPtr ctrls = xkbi->desc->ctrls; XkbControlsRec old; XkbEventCauseRec cause; XkbSrvLedInfoPtr sli; old= *ctrls; ctrls->enabled_ctrls |= (KRGControl&XkbAX_KRGMask); if (XkbComputeControlsNotify(dev,&old,ctrls,pCN,False)) XkbSendControlsNotify(dev,pCN); cause.kc= pCN->keycode; cause.event= pCN->eventType; cause.mjr= pCN->requestMajor; cause.mnr= pCN->requestMinor; sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0); XkbUpdateIndicators(dev,sli->usesControls,True,NULL,&cause); if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask)) XkbDDXAccessXBeep(dev,_BEEP_FEATURE_ON,KRGControl); return; } /* AccessXKRGTurnOn */ /************************************************************************/ /* */ /* AccessXKRGTurnOff */ /* */ /* Turn the keyboard response group off. */ /* */ /************************************************************************/ static void AccessXKRGTurnOff(DeviceIntPtr dev,xkbControlsNotify *pCN) { XkbSrvInfoPtr xkbi = dev->key->xkbInfo; XkbControlsPtr ctrls = xkbi->desc->ctrls; XkbControlsRec old; XkbEventCauseRec cause; XkbSrvLedInfoPtr sli; old = *ctrls; ctrls->enabled_ctrls &= ~XkbAX_KRGMask; if (XkbComputeControlsNotify(dev,&old,ctrls,pCN,False)) XkbSendControlsNotify(dev,pCN); cause.kc= pCN->keycode; cause.event= pCN->eventType; cause.mjr= pCN->requestMajor; cause.mnr= pCN->requestMinor; sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0); XkbUpdateIndicators(dev,sli->usesControls,True,NULL,&cause); if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask)) { unsigned changes= old.enabled_ctrls^ctrls->enabled_ctrls; XkbDDXAccessXBeep(dev,_BEEP_FEATURE_OFF,changes); } return; } /* AccessXKRGTurnOff */ /************************************************************************/ /* */ /* AccessXStickyKeysTurnOn */ /* */ /* Turn StickyKeys on. */ /* */ /************************************************************************/ static void AccessXStickyKeysTurnOn(DeviceIntPtr dev,xkbControlsNotify *pCN) { XkbSrvInfoPtr xkbi = dev->key->xkbInfo; XkbControlsPtr ctrls = xkbi->desc->ctrls; XkbControlsRec old; XkbEventCauseRec cause; XkbSrvLedInfoPtr sli; old = *ctrls; ctrls->enabled_ctrls |= XkbStickyKeysMask; xkbi->shiftKeyCount = 0; if (XkbComputeControlsNotify(dev,&old,ctrls,pCN,False)) XkbSendControlsNotify(dev,pCN); cause.kc= pCN->keycode; cause.event= pCN->eventType; cause.mjr= pCN->requestMajor; cause.mnr= pCN->requestMinor; sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0); XkbUpdateIndicators(dev,sli->usesControls,True,NULL,&cause); if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask)) { XkbDDXAccessXBeep(dev,_BEEP_FEATURE_ON,XkbStickyKeysMask); } return; } /* AccessXStickyKeysTurnOn */ /************************************************************************/ /* */ /* AccessXStickyKeysTurnOff */ /* */ /* Turn StickyKeys off. */ /* */ /************************************************************************/ static void AccessXStickyKeysTurnOff(DeviceIntPtr dev,xkbControlsNotify *pCN) { XkbSrvInfoPtr xkbi = dev->key->xkbInfo; XkbControlsPtr ctrls = xkbi->desc->ctrls; XkbControlsRec old; XkbEventCauseRec cause; XkbSrvLedInfoPtr sli; old = *ctrls; ctrls->enabled_ctrls &= ~XkbStickyKeysMask; xkbi->shiftKeyCount = 0; if (XkbComputeControlsNotify(dev,&old,ctrls,pCN,False)) XkbSendControlsNotify(dev,pCN); cause.kc= pCN->keycode; cause.event= pCN->eventType; cause.mjr= pCN->requestMajor; cause.mnr= pCN->requestMinor; sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0); XkbUpdateIndicators(dev,sli->usesControls,True,NULL,&cause); if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask)) { XkbDDXAccessXBeep(dev,_BEEP_FEATURE_OFF,XkbStickyKeysMask); } #ifndef NO_CLEAR_LATCHES_FOR_STICKY_KEYS_OFF XkbClearAllLatchesAndLocks(dev,xkbi,False,&cause); #endif return; } /* AccessXStickyKeysTurnOff */ static CARD32 AccessXKRGExpire(OsTimerPtr timer,CARD32 now,void * arg) { XkbSrvInfoPtr xkbi= ((DeviceIntPtr)arg)->key->xkbInfo; xkbControlsNotify cn; if (xkbi->krgTimerActive==_KRG_WARN_TIMER) { XkbDDXAccessXBeep((DeviceIntPtr)arg,_BEEP_SLOW_WARN,XkbStickyKeysMask); xkbi->krgTimerActive= _KRG_TIMER; return 4000; } xkbi->krgTimerActive= _OFF_TIMER; cn.keycode = 0; cn.eventType = 0; cn.requestMajor = 0; cn.requestMinor = 0; if (xkbi->desc->ctrls->enabled_ctrls&XkbSlowKeysMask) AccessXKRGTurnOff((DeviceIntPtr)arg,&cn); else AccessXKRGTurnOn((DeviceIntPtr)arg,XkbSlowKeysMask,&cn); return 0; } static CARD32 AccessXRepeatKeyExpire(OsTimerPtr timer,CARD32 now,void * arg) { XkbSrvInfoPtr xkbi= ((DeviceIntPtr)arg)->key->xkbInfo; KeyCode key; if (xkbi->repeatKey==0) return 0; key= xkbi->repeatKey; AccessXKeyboardEvent((DeviceIntPtr)arg,KeyRelease,key,True); AccessXKeyboardEvent((DeviceIntPtr)arg,KeyPress,key,True); return xkbi->desc->ctrls->repeat_interval; } void AccessXCancelRepeatKey(XkbSrvInfoPtr xkbi,KeyCode key) { if (xkbi->repeatKey==key) xkbi->repeatKey= 0; return; } static CARD32 AccessXSlowKeyExpire(OsTimerPtr timer,CARD32 now,void * arg) { DeviceIntPtr keybd; XkbSrvInfoPtr xkbi; XkbDescPtr xkb; XkbControlsPtr ctrls; keybd= (DeviceIntPtr)arg; xkbi= keybd->key->xkbInfo; xkb= xkbi->desc; ctrls= xkb->ctrls; if (xkbi->slowKey!=0) { xkbAccessXNotify ev; KeySym *sym= XkbKeySymsPtr(xkb,xkbi->slowKey); ev.detail= XkbAXN_SKAccept; ev.keycode= xkbi->slowKey; ev.slowKeysDelay= ctrls->slow_keys_delay; ev.debounceDelay= ctrls->debounce_delay; XkbSendAccessXNotify(keybd,&ev); if (XkbAX_NeedFeedback(ctrls,XkbAX_SKAcceptFBMask)) XkbDDXAccessXBeep(keybd,_BEEP_SLOW_ACCEPT,XkbSlowKeysMask); AccessXKeyboardEvent(keybd,KeyPress,xkbi->slowKey,False); /* check for magic sequences */ if ((ctrls->enabled_ctrls&XkbAccessXKeysMask) && ((sym[0]==XK_Shift_R)||(sym[0]==XK_Shift_L))) xkbi->shiftKeyCount++; /* Start repeating if necessary. Stop autorepeating if the user * presses a non-modifier key that doesn't autorepeat. */ if (keybd->kbdfeed->ctrl.autoRepeat && ((xkbi->slowKey != xkbi->mouseKey) || (!xkbi->mouseKeysAccel)) && (ctrls->enabled_ctrls&XkbRepeatKeysMask)) { if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,xkbi->slowKey)) { xkbi->repeatKey = xkbi->slowKey; xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer, 0, ctrls->repeat_delay, AccessXRepeatKeyExpire, (void *)keybd); } } } return 0; } static CARD32 AccessXBounceKeyExpire(OsTimerPtr timer,CARD32 now,void * arg) { XkbSrvInfoPtr xkbi= ((DeviceIntPtr)arg)->key->xkbInfo; xkbi->inactiveKey= 0; return 0; } static CARD32 AccessXTimeoutExpire(OsTimerPtr timer,CARD32 now,void * arg) { DeviceIntPtr dev = (DeviceIntPtr)arg; XkbSrvInfoPtr xkbi= dev->key->xkbInfo; XkbControlsPtr ctrls= xkbi->desc->ctrls; XkbControlsRec old; xkbControlsNotify cn; XkbEventCauseRec cause; XkbSrvLedInfoPtr sli; if (xkbi->lastPtrEventTime) { unsigned timeToWait = (ctrls->ax_timeout*1000); unsigned timeElapsed = (now-xkbi->lastPtrEventTime); if (timeToWait > timeElapsed) return (timeToWait - timeElapsed); } old= *ctrls; xkbi->shiftKeyCount= 0; ctrls->enabled_ctrls&= ~ctrls->axt_ctrls_mask; ctrls->enabled_ctrls|= (ctrls->axt_ctrls_values&ctrls->axt_ctrls_mask); if (ctrls->axt_opts_mask) { ctrls->ax_options&= ~ctrls->axt_opts_mask; ctrls->ax_options|= (ctrls->axt_opts_values&ctrls->axt_opts_mask); } if (XkbComputeControlsNotify(dev,&old,ctrls,&cn,False)) { cn.keycode = 0; cn.eventType = 0; cn.requestMajor = 0; cn.requestMinor = 0; XkbSendControlsNotify(dev,&cn); } XkbSetCauseUnknown(&cause); sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0); XkbUpdateIndicators(dev,sli->usesControls,True,NULL,&cause); if (ctrls->ax_options!=old.ax_options) { unsigned set,cleared,bell; set= ctrls->ax_options&(~old.ax_options); cleared= (~ctrls->ax_options)&old.ax_options; if (set && cleared) bell= _BEEP_FEATURE_CHANGE; else if (set) bell= _BEEP_FEATURE_ON; else bell= _BEEP_FEATURE_OFF; XkbDDXAccessXBeep(dev,bell,XkbAccessXTimeoutMask); } xkbi->krgTimerActive= _OFF_TIMER; return 0; } /************************************************************************/ /* */ /* AccessXFilterPressEvent */ /* */ /* Filter events before they get any further if SlowKeys is turned on. */ /* In addition, this routine handles the ever so popular magic key */ /* acts for turning various accessibility features on/off. */ /* */ /* Returns TRUE if this routine has discarded the event. */ /* Returns FALSE if the event needs further processing. */ /* */ /************************************************************************/ Bool AccessXFilterPressEvent( register xEvent * xE, register DeviceIntPtr keybd, int count) { XkbSrvInfoPtr xkbi = keybd->key->xkbInfo; XkbControlsPtr ctrls = xkbi->desc->ctrls; Bool ignoreKeyEvent = FALSE; KeyCode key = xE->u.u.detail; KeySym * sym = XkbKeySymsPtr(xkbi->desc,key); if (ctrls->enabled_ctrls&XkbAccessXKeysMask) { /* check for magic sequences */ if ((sym[0]==XK_Shift_R)||(sym[0]==XK_Shift_L)) { if (XkbAX_NeedFeedback(ctrls,XkbAX_SlowWarnFBMask)) { xkbi->krgTimerActive = _KRG_WARN_TIMER; xkbi->krgTimer= TimerSet(xkbi->krgTimer, 0, 4000, AccessXKRGExpire, (void *)keybd); } else { xkbi->krgTimerActive = _KRG_TIMER; xkbi->krgTimer= TimerSet(xkbi->krgTimer, 0, 8000, AccessXKRGExpire, (void *)keybd); } if (!(ctrls->enabled_ctrls & XkbSlowKeysMask)) { CARD32 now= GetTimeInMillis(); if ((now-xkbi->lastShiftEventTime)>15000) xkbi->shiftKeyCount= 1; else xkbi->shiftKeyCount++; xkbi->lastShiftEventTime= now; } } else { if (xkbi->krgTimerActive) { xkbi->krgTimer= TimerSet(xkbi->krgTimer,0, 0, NULL, NULL); xkbi->krgTimerActive= _OFF_TIMER; } } } /* Don't transmit the KeyPress if SlowKeys is turned on; * The wakeup handler will synthesize one for us if the user * has held the key long enough. */ if (ctrls->enabled_ctrls & XkbSlowKeysMask) { xkbAccessXNotify ev; /* If key was already pressed, ignore subsequent press events * from the server's autorepeat */ if(xkbi->slowKey == key) return TRUE; ev.detail= XkbAXN_SKPress; ev.keycode= key; ev.slowKeysDelay= ctrls->slow_keys_delay; ev.debounceDelay= ctrls->debounce_delay; XkbSendAccessXNotify(keybd,&ev); if (XkbAX_NeedFeedback(ctrls,XkbAX_SKPressFBMask)) XkbDDXAccessXBeep(keybd,_BEEP_SLOW_PRESS,XkbSlowKeysMask); xkbi->slowKey= key; xkbi->slowKeysTimer = TimerSet(xkbi->slowKeysTimer, 0, ctrls->slow_keys_delay, AccessXSlowKeyExpire, (void *)keybd); ignoreKeyEvent = TRUE; } /* Don't transmit the KeyPress if BounceKeys is turned on * and the user pressed the same key within a given time period * from the last release. */ else if ((ctrls->enabled_ctrls & XkbBounceKeysMask) && (key == xkbi->inactiveKey)) { if (XkbAX_NeedFeedback(ctrls,XkbAX_BKRejectFBMask)) XkbDDXAccessXBeep(keybd,_BEEP_BOUNCE_REJECT,XkbBounceKeysMask); ignoreKeyEvent = TRUE; } /* Start repeating if necessary. Stop autorepeating if the user * presses a non-modifier key that doesn't autorepeat. */ if (XkbDDXUsesSoftRepeat(keybd)) { if ((keybd->kbdfeed->ctrl.autoRepeat) && ((ctrls->enabled_ctrls&(XkbSlowKeysMask|XkbRepeatKeysMask))== XkbRepeatKeysMask)) { if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key)) { if (xkbDebugFlags&0x10) DebugF("Starting software autorepeat...\n"); xkbi->repeatKey = key; xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer, 0, ctrls->repeat_delay, AccessXRepeatKeyExpire, (void *)keybd); } } } /* Check for two keys being pressed at the same time. This section * essentially says the following: * * If StickyKeys is on, and a modifier is currently being held down, * and one of the following is true: the current key is not a modifier * or the currentKey is a modifier, but not the only modifier being * held down, turn StickyKeys off if the TwoKeys off ctrl is set. */ if ((ctrls->enabled_ctrls & XkbStickyKeysMask) && (xkbi->state.base_mods!=0) && (XkbAX_NeedOption(ctrls,XkbAX_TwoKeysMask))) { xkbControlsNotify cn; cn.keycode = key; cn.eventType = KeyPress; cn.requestMajor = 0; cn.requestMinor = 0; AccessXStickyKeysTurnOff(keybd,&cn); } if (!ignoreKeyEvent) XkbProcessKeyboardEvent(xE,keybd,count); return ignoreKeyEvent; } /* AccessXFilterPressEvent */ /************************************************************************/ /* */ /* AccessXFilterReleaseEvent */ /* */ /* Filter events before they get any further if SlowKeys is turned on. */ /* In addition, this routine handles the ever so popular magic key */ /* acts for turning various accessibility features on/off. */ /* */ /* Returns TRUE if this routine has discarded the event. */ /* Returns FALSE if the event needs further processing. */ /* */ /************************************************************************/ Bool AccessXFilterReleaseEvent( register xEvent * xE, register DeviceIntPtr keybd, int count) { XkbSrvInfoPtr xkbi = keybd->key->xkbInfo; XkbControlsPtr ctrls = xkbi->desc->ctrls; KeyCode key = xE->u.u.detail; Bool ignoreKeyEvent = FALSE; /* Don't transmit the KeyRelease if BounceKeys is on and * this is the release of a key that was ignored due to * BounceKeys. */ if (ctrls->enabled_ctrls & XkbBounceKeysMask) { if ((key!=xkbi->mouseKey)&&(!BitIsOn(keybd->key->down,key))) ignoreKeyEvent = TRUE; xkbi->inactiveKey= key; xkbi->bounceKeysTimer= TimerSet(xkbi->bounceKeysTimer, 0, ctrls->debounce_delay, AccessXBounceKeyExpire, (void *)keybd); } /* Don't transmit the KeyRelease if SlowKeys is turned on and * the user didn't hold the key long enough. We know we passed * the key if the down bit was set by CoreProcessKeyboadEvent. */ if (ctrls->enabled_ctrls & XkbSlowKeysMask) { xkbAccessXNotify ev; unsigned beep_type; ev.keycode= key; ev.slowKeysDelay= ctrls->slow_keys_delay; ev.debounceDelay= ctrls->debounce_delay; if (BitIsOn(keybd->key->down,key) || (xkbi->mouseKey == key)) { ev.detail= XkbAXN_SKRelease; beep_type= _BEEP_SLOW_RELEASE; } else { ev.detail= XkbAXN_SKReject; beep_type= _BEEP_SLOW_REJECT; ignoreKeyEvent = TRUE; } XkbSendAccessXNotify(keybd,&ev); if (XkbAX_NeedFeedback(ctrls,XkbAX_SKRejectFBMask)) { XkbDDXAccessXBeep(keybd,beep_type,XkbSlowKeysMask); } if (xkbi->slowKey==key) xkbi->slowKey= 0; } /* Stop Repeating if the user releases the key that is currently * repeating. */ if (xkbi->repeatKey==key) { xkbi->repeatKey= 0; } if ((ctrls->enabled_ctrls&XkbAccessXTimeoutMask)&&(ctrls->ax_timeout>0)) { xkbi->lastPtrEventTime= 0; xkbi->krgTimer= TimerSet(xkbi->krgTimer, 0, ctrls->ax_timeout*1000, AccessXTimeoutExpire, (void *)keybd); xkbi->krgTimerActive= _ALL_TIMEOUT_TIMER; } else if (xkbi->krgTimerActive!=_OFF_TIMER) { xkbi->krgTimer= TimerSet(xkbi->krgTimer, 0, 0, NULL, NULL); xkbi->krgTimerActive= _OFF_TIMER; } /* Keep track of how many times the Shift key has been pressed. * If it has been pressed and released 5 times in a row, toggle * the state of StickyKeys. */ if ((!ignoreKeyEvent)&&(xkbi->shiftKeyCount)) { KeySym *pSym= XkbKeySymsPtr(xkbi->desc,key); if ((pSym[0]!=XK_Shift_L)&&(pSym[0]!=XK_Shift_R)) { xkbi->shiftKeyCount= 0; } else if (xkbi->shiftKeyCount>=5) { xkbControlsNotify cn; cn.keycode = key; cn.eventType = KeyPress; cn.requestMajor = 0; cn.requestMinor = 0; if (ctrls->enabled_ctrls & XkbStickyKeysMask) AccessXStickyKeysTurnOff(keybd,&cn); else AccessXStickyKeysTurnOn(keybd,&cn); xkbi->shiftKeyCount= 0; } } if (!ignoreKeyEvent) XkbProcessKeyboardEvent(xE,keybd,count); return ignoreKeyEvent; } /* AccessXFilterReleaseEvent */ /************************************************************************/ /* */ /* ProcessPointerEvent */ /* */ /* This routine merely sets the shiftKeyCount and clears the keyboard */ /* response group timer (if necessary) on a mouse event. This is so */ /* multiple shifts with just the mouse and shift-drags with the mouse */ /* don't accidentally turn on StickyKeys or the Keyboard Response Group.*/ /* */ /************************************************************************/ void ProcessPointerEvent( register xEvent * xE, register DeviceIntPtr mouse, int count) { DeviceIntPtr dev = (DeviceIntPtr)LookupKeyboardDevice(); XkbSrvInfoPtr xkbi = dev->key->xkbInfo; unsigned changed = 0; xkbi->shiftKeyCount = 0; xkbi->lastPtrEventTime= xE->u.keyButtonPointer.time; if (xE->u.u.type==ButtonPress) { changed |= XkbPointerButtonMask; } else if (xE->u.u.type==ButtonRelease) { xkbi->lockedPtrButtons&= ~(1<<(xE->u.u.detail&0x7)); changed |= XkbPointerButtonMask; } CoreProcessPointerEvent(xE,mouse,count); xkbi->state.ptr_buttons = mouse->button->state; /* clear any latched modifiers */ if ( xkbi->state.latched_mods && (xE->u.u.type==ButtonRelease) ) { unsigned changed_leds; XkbStateRec oldState; XkbSrvLedInfoPtr sli; sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0); oldState= xkbi->state; XkbLatchModifiers(dev,0xFF,0x00); XkbComputeDerivedState(xkbi); changed |= XkbStateChangedFlags(&oldState,&xkbi->state); if (changed&sli->usedComponents) { changed_leds= XkbIndicatorsToUpdate(dev,changed,False); if (changed_leds) { XkbEventCauseRec cause; XkbSetCauseKey(&cause,(xE->u.u.detail&0x7),xE->u.u.type); XkbUpdateIndicators(dev,changed_leds,True,NULL,&cause); } } dev->key->state= XkbStateFieldFromRec(&xkbi->state); } if (((xkbi->flags&_XkbStateNotifyInProgress)==0)&&(changed!=0)) { xkbStateNotify sn; sn.keycode= xE->u.u.detail; sn.eventType= xE->u.u.type; sn.requestMajor = sn.requestMinor = 0; sn.changed= changed; XkbSendStateNotify(dev,&sn); } } /* ProcessPointerEvent */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkbActions.c0000644000000000000000000011640413614532331017636 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include "misc.h" #include "inputstr.h" #include #include "xkb.h" #include static unsigned int _xkbServerGeneration; static int xkbDevicePrivateIndex = -1; static void xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, void * data) { xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(device); ProcessInputProc tmp = device->public.processInputProc; if(xkbPrivPtr->unwrapProc) xkbPrivPtr->unwrapProc = NULL; UNWRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr); proc(device,data); WRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, tmp,xkbUnwrapProc); } void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc) { xkbDeviceInfoPtr xkbPrivPtr; if (serverGeneration != _xkbServerGeneration) { if ((xkbDevicePrivateIndex = AllocateDevicePrivateIndex()) == -1) return; _xkbServerGeneration = serverGeneration; } if (!AllocateDevicePrivate(device, xkbDevicePrivateIndex)) return; xkbPrivPtr = (xkbDeviceInfoPtr) malloc(sizeof(xkbDeviceInfoRec)); if (!xkbPrivPtr) return; xkbPrivPtr->unwrapProc = NULL; device->devPrivates[xkbDevicePrivateIndex].ptr = xkbPrivPtr; WRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, proc,xkbUnwrapProc); } void XkbFreePrivates(DeviceIntPtr device) { if (device && device->devPrivates && device->nPrivates > 0 && xkbDevicePrivateIndex != -1 && xkbDevicePrivateIndex < device->nPrivates) { free(device->devPrivates[xkbDevicePrivateIndex].ptr); device->devPrivates[xkbDevicePrivateIndex].ptr = NULL; } } #ifdef XINPUT extern void ProcessOtherEvent( xEvent * /* xE */, DeviceIntPtr /* dev */, int /* count */ ); #endif /***====================================================================***/ static XkbAction _FixUpAction(XkbDescPtr xkb,XkbAction *act) { static XkbAction fake; if (XkbIsPtrAction(act)&&(!(xkb->ctrls->enabled_ctrls&XkbMouseKeysMask))) { fake.type = XkbSA_NoAction; return fake; } if (XkbDisableLockActions) { switch (act->type) { case XkbSA_LockMods: fake.mods.type = XkbSA_SetMods; fake.mods.flags = 0; fake.mods.mask = act->mods.mask; return fake; case XkbSA_LatchMods: fake.mods.type = XkbSA_SetMods; fake.mods.flags = 0; fake.mods.mask = act->mods.mask; return fake; case XkbSA_ISOLock: if (act->iso.flags&XkbSA_ISODfltIsGroup) { fake.group.type = XkbSA_SetGroup; fake.group.flags = act->iso.flags&XkbSA_GroupAbsolute; XkbSASetGroup(&fake.group,XkbSAGroup(&act->iso)); } else { fake.mods.type = XkbSA_SetMods; fake.mods.flags = 0; fake.mods.mask = act->iso.mask; } return fake; case XkbSA_LockGroup: case XkbSA_LatchGroup: /* We want everything from the latch/lock action except the * type should be changed to set. */ fake = *act; fake.group.type = XkbSA_SetGroup; return fake; } } else if (xkb->ctrls->enabled_ctrls&XkbStickyKeysMask) { if (act->any.type==XkbSA_SetMods) { fake.mods.type = XkbSA_LatchMods; fake.mods.mask = act->mods.mask; if (XkbAX_NeedOption(xkb->ctrls,XkbAX_LatchToLockMask)) fake.mods.flags= XkbSA_ClearLocks|XkbSA_LatchToLock; else fake.mods.flags= XkbSA_ClearLocks; return fake; } if (act->any.type==XkbSA_SetGroup) { fake.group.type = XkbSA_LatchGroup; if (XkbAX_NeedOption(xkb->ctrls,XkbAX_LatchToLockMask)) fake.group.flags= XkbSA_ClearLocks|XkbSA_LatchToLock; else fake.group.flags= XkbSA_ClearLocks; XkbSASetGroup(&fake.group,XkbSAGroup(&act->group)); return fake; } } return *act; } static XkbAction XkbGetKeyAction(XkbSrvInfoPtr xkbi,XkbStatePtr xkbState,CARD8 key) { int effectiveGroup; int col; XkbDescPtr xkb; XkbKeyTypePtr type; XkbAction * pActs; static XkbAction fake; xkb= xkbi->desc; if (!XkbKeyHasActions(xkb,key) || !XkbKeycodeInRange(xkb,key)) { fake.type = XkbSA_NoAction; return fake; } pActs= XkbKeyActionsPtr(xkb,key); col= 0; effectiveGroup= xkbState->group; if (effectiveGroup!=XkbGroup1Index) { if (XkbKeyNumGroups(xkb,key)>(unsigned)1) { if (effectiveGroup>=XkbKeyNumGroups(xkb,key)) { unsigned gi= XkbKeyGroupInfo(xkb,key); switch (XkbOutOfRangeGroupAction(gi)) { default: case XkbWrapIntoRange: effectiveGroup %= XkbKeyNumGroups(xkb,key); break; case XkbClampIntoRange: effectiveGroup = XkbKeyNumGroups(xkb,key)-1; break; case XkbRedirectIntoRange: effectiveGroup= XkbOutOfRangeGroupInfo(gi); if (effectiveGroup>=XkbKeyNumGroups(xkb,key)) effectiveGroup= 0; break; } } } else effectiveGroup= XkbGroup1Index; col+= (effectiveGroup*XkbKeyGroupsWidth(xkb,key)); } type= XkbKeyKeyType(xkb,key,effectiveGroup); if (type->map!=NULL) { register unsigned i,mods; register XkbKTMapEntryPtr entry; mods= xkbState->mods&type->mods.mask; for (entry= type->map,i=0;imap_count;i++,entry++) { if ((entry->active)&&(entry->mods.mask==mods)) { col+= entry->level; break; } } } if (pActs[col].any.type==XkbSA_NoAction) return pActs[col]; fake= _FixUpAction(xkb,&pActs[col]); return fake; } static XkbAction XkbGetButtonAction(DeviceIntPtr kbd,DeviceIntPtr dev,int button) { XkbAction fake; if ((dev->button)&&(dev->button->xkb_acts)) { if (dev->button->xkb_acts[button-1].any.type!=XkbSA_NoAction) { fake= _FixUpAction(kbd->key->xkbInfo->desc, &dev->button->xkb_acts[button-1]); return fake; } } fake.any.type= XkbSA_NoAction; return fake; } /***====================================================================***/ #define SYNTHETIC_KEYCODE 1 #define BTN_ACT_FLAG 0x100 typedef struct _XkbFilter { CARD16 keycode; CARD8 what; CARD8 active; CARD8 filterOthers; CARD32 priv; XkbAction upAction; int (*filter)( XkbSrvInfoPtr /* xkbi */, struct _XkbFilter * /* filter */, unsigned /* keycode */, XkbAction * /* action */ ); struct _XkbFilter *next; } XkbFilterRec,*XkbFilterPtr; static int _XkbFilterSetState( XkbSrvInfoPtr xkbi, XkbFilterPtr filter, unsigned keycode, XkbAction *pAction) { if (filter->keycode==0) { /* initial press */ filter->keycode = keycode; filter->active = 1; filter->filterOthers = ((pAction->mods.mask&XkbSA_ClearLocks)!=0); filter->priv = 0; filter->filter = _XkbFilterSetState; if (pAction->type==XkbSA_SetMods) { filter->upAction = *pAction; xkbi->setMods= pAction->mods.mask; } else { xkbi->groupChange = XkbSAGroup(&pAction->group); if (pAction->group.flags&XkbSA_GroupAbsolute) xkbi->groupChange-= xkbi->state.base_group; filter->upAction= *pAction; XkbSASetGroup(&filter->upAction.group,xkbi->groupChange); } } else if (filter->keycode==keycode) { if (filter->upAction.type==XkbSA_SetMods) { xkbi->clearMods = filter->upAction.mods.mask; if (filter->upAction.mods.flags&XkbSA_ClearLocks) { xkbi->state.locked_mods&= ~filter->upAction.mods.mask; } } else { if (filter->upAction.group.flags&XkbSA_ClearLocks) { xkbi->state.locked_group = 0; } xkbi->groupChange = -XkbSAGroup(&filter->upAction.group); } filter->active = 0; } else { filter->upAction.mods.flags&= ~XkbSA_ClearLocks; filter->filterOthers = 0; } return 1; } #define LATCH_KEY_DOWN 1 #define LATCH_PENDING 2 #define NO_LATCH 3 static int _XkbFilterLatchState( XkbSrvInfoPtr xkbi, XkbFilterPtr filter, unsigned keycode, XkbAction * pAction) { if (filter->keycode==0) { /* initial press */ filter->keycode = keycode; filter->active = 1; filter->filterOthers = 1; filter->priv = LATCH_KEY_DOWN; filter->filter = _XkbFilterLatchState; if (pAction->type==XkbSA_LatchMods) { filter->upAction = *pAction; xkbi->setMods = pAction->mods.mask; } else { xkbi->groupChange = XkbSAGroup(&pAction->group); if (pAction->group.flags&XkbSA_GroupAbsolute) xkbi->groupChange-= xkbi->state.base_group; filter->upAction= *pAction; XkbSASetGroup(&filter->upAction.group,xkbi->groupChange); } } else if ( pAction && (filter->priv==LATCH_PENDING) ) { if (((1<type)&XkbSA_BreakLatch)!=0) { filter->active = 0; if (filter->upAction.type==XkbSA_LatchMods) xkbi->state.latched_mods&= ~filter->upAction.mods.mask; else xkbi->state.latched_group-=XkbSAGroup(&filter->upAction.group); } else if ((pAction->type==filter->upAction.type)&& (pAction->mods.flags==filter->upAction.mods.flags)&& (pAction->mods.mask==filter->upAction.mods.mask)) { if (filter->upAction.mods.flags&XkbSA_LatchToLock) { XkbControlsPtr ctrls= xkbi->desc->ctrls; if (filter->upAction.type==XkbSA_LatchMods) pAction->mods.type= XkbSA_LockMods; else pAction->group.type= XkbSA_LockGroup; if (XkbAX_NeedFeedback(ctrls,XkbAX_StickyKeysFBMask)&& (ctrls->enabled_ctrls&XkbStickyKeysMask)) { XkbDDXAccessXBeep(xkbi->device,_BEEP_STICKY_LOCK, XkbStickyKeysMask); } } else { if (filter->upAction.type==XkbSA_LatchMods) pAction->mods.type= XkbSA_SetMods; else pAction->group.type= XkbSA_SetGroup; } if (filter->upAction.type==XkbSA_LatchMods) xkbi->state.latched_mods&= ~filter->upAction.mods.mask; else xkbi->state.latched_group-=XkbSAGroup(&filter->upAction.group); filter->active = 0; } } else if (filter->keycode==keycode) { /* release */ XkbControlsPtr ctrls= xkbi->desc->ctrls; int needBeep; int beepType= _BEEP_NONE; needBeep= ((ctrls->enabled_ctrls&XkbStickyKeysMask)&& XkbAX_NeedFeedback(ctrls,XkbAX_StickyKeysFBMask)); if (filter->upAction.type==XkbSA_LatchMods) { xkbi->clearMods = filter->upAction.mods.mask; if ((filter->upAction.mods.flags&XkbSA_ClearLocks)&& (xkbi->clearMods&xkbi->state.locked_mods)==xkbi->clearMods) { xkbi->state.locked_mods&= ~xkbi->clearMods; filter->priv= NO_LATCH; beepType= _BEEP_STICKY_UNLOCK; } } else { xkbi->groupChange = -XkbSAGroup(&filter->upAction.group); if ((filter->upAction.group.flags&XkbSA_ClearLocks)&& (xkbi->state.locked_group)) { xkbi->state.locked_group = 0; filter->priv = NO_LATCH; beepType= _BEEP_STICKY_UNLOCK; } } if (filter->priv==NO_LATCH) { filter->active= 0; } else { filter->priv= LATCH_PENDING; if (filter->upAction.type==XkbSA_LatchMods) { xkbi->state.latched_mods |= filter->upAction.mods.mask; needBeep = xkbi->state.latched_mods ? needBeep : 0; xkbi->state.latched_mods |= filter->upAction.mods.mask; } else { xkbi->state.latched_group+= XkbSAGroup(&filter->upAction.group); } if (needBeep && (beepType==_BEEP_NONE)) beepType= _BEEP_STICKY_LATCH; } if (needBeep && (beepType!=_BEEP_NONE)) XkbDDXAccessXBeep(xkbi->device,beepType,XkbStickyKeysMask); } else if (filter->priv==LATCH_KEY_DOWN) { filter->priv= NO_LATCH; filter->filterOthers = 0; } return 1; } static int _XkbFilterLockState( XkbSrvInfoPtr xkbi, XkbFilterPtr filter, unsigned keycode, XkbAction * pAction) { if (pAction&&(pAction->type==XkbSA_LockGroup)) { if (pAction->group.flags&XkbSA_GroupAbsolute) xkbi->state.locked_group= XkbSAGroup(&pAction->group); else xkbi->state.locked_group+= XkbSAGroup(&pAction->group); return 1; } if (filter->keycode==0) { /* initial press */ filter->keycode = keycode; filter->active = 1; filter->filterOthers = 0; filter->priv = 0; filter->filter = _XkbFilterLockState; filter->upAction = *pAction; xkbi->state.locked_mods^= pAction->mods.mask; xkbi->setMods = pAction->mods.mask; } else if (filter->keycode==keycode) { filter->active = 0; xkbi->clearMods = filter->upAction.mods.mask; } return 1; } #define ISO_KEY_DOWN 0 #define NO_ISO_LOCK 1 static int _XkbFilterISOLock( XkbSrvInfoPtr xkbi, XkbFilterPtr filter, unsigned keycode, XkbAction * pAction) { if (filter->keycode==0) { /* initial press */ CARD8 flags= pAction->iso.flags; filter->keycode = keycode; filter->active = 1; filter->filterOthers = 1; filter->priv = ISO_KEY_DOWN; filter->upAction = *pAction; filter->filter = _XkbFilterISOLock; if (flags&XkbSA_ISODfltIsGroup) { xkbi->groupChange = XkbSAGroup(&pAction->iso); xkbi->setMods = 0; } else { xkbi->setMods = pAction->iso.mask; xkbi->groupChange = 0; } if ((!(flags&XkbSA_ISONoAffectMods))&&(xkbi->state.base_mods)) { filter->priv= NO_ISO_LOCK; xkbi->state.locked_mods^= xkbi->state.base_mods; } if ((!(flags&XkbSA_ISONoAffectGroup))&&(xkbi->state.base_group)) { /* 6/22/93 (ef) -- lock groups if group key is down first */ } if (!(flags&XkbSA_ISONoAffectPtr)) { /* 6/22/93 (ef) -- lock mouse buttons if they're down */ } } else if (filter->keycode==keycode) { CARD8 flags= filter->upAction.iso.flags; if (flags&XkbSA_ISODfltIsGroup) { xkbi->groupChange = -XkbSAGroup(&filter->upAction.iso); xkbi->clearMods = 0; if (filter->priv==ISO_KEY_DOWN) xkbi->state.locked_group+= XkbSAGroup(&filter->upAction.iso); } else { xkbi->clearMods= filter->upAction.iso.mask; xkbi->groupChange= 0; if (filter->priv==ISO_KEY_DOWN) xkbi->state.locked_mods^= filter->upAction.iso.mask; } filter->active = 0; } else if (pAction) { CARD8 flags= filter->upAction.iso.flags; switch (pAction->type) { case XkbSA_SetMods: case XkbSA_LatchMods: if (!(flags&XkbSA_ISONoAffectMods)) { pAction->type= XkbSA_LockMods; filter->priv= NO_ISO_LOCK; } break; case XkbSA_SetGroup: case XkbSA_LatchGroup: if (!(flags&XkbSA_ISONoAffectGroup)) { pAction->type= XkbSA_LockGroup; filter->priv= NO_ISO_LOCK; } break; case XkbSA_PtrBtn: if (!(flags&XkbSA_ISONoAffectPtr)) { pAction->type= XkbSA_LockPtrBtn; filter->priv= NO_ISO_LOCK; } break; case XkbSA_SetControls: if (!(flags&XkbSA_ISONoAffectCtrls)) { pAction->type= XkbSA_LockControls; filter->priv= NO_ISO_LOCK; } break; } } return 1; } static CARD32 _XkbPtrAccelExpire(OsTimerPtr timer,CARD32 now,void * arg) { XkbSrvInfoPtr xkbi= (XkbSrvInfoPtr)arg; XkbControlsPtr ctrls= xkbi->desc->ctrls; int dx,dy; if (xkbi->mouseKey==0) return 0; if (xkbi->mouseKeysAccel) { if ((xkbi->mouseKeysCounter)mk_time_to_max) { double step; xkbi->mouseKeysCounter++; step= xkbi->mouseKeysCurveFactor* pow((double)xkbi->mouseKeysCounter,xkbi->mouseKeysCurve); if (xkbi->mouseKeysDX<0) dx= floor( ((double)xkbi->mouseKeysDX)*step ); else dx= ceil( ((double)xkbi->mouseKeysDX)*step ); if (xkbi->mouseKeysDY<0) dy= floor( ((double)xkbi->mouseKeysDY)*step ); else dy= ceil( ((double)xkbi->mouseKeysDY)*step ); } else { dx= xkbi->mouseKeysDX*ctrls->mk_max_speed; dy= xkbi->mouseKeysDY*ctrls->mk_max_speed; } if (xkbi->mouseKeysFlags&XkbSA_MoveAbsoluteX) dx= xkbi->mouseKeysDX; if (xkbi->mouseKeysFlags&XkbSA_MoveAbsoluteY) dy= xkbi->mouseKeysDY; } else { dx= xkbi->mouseKeysDX; dy= xkbi->mouseKeysDY; } XkbDDXFakePointerMotion(xkbi->mouseKeysFlags,dx,dy); return xkbi->desc->ctrls->mk_interval; } static int _XkbFilterPointerMove( XkbSrvInfoPtr xkbi, XkbFilterPtr filter, unsigned keycode, XkbAction * pAction) { int x,y; Bool accel; if (filter->keycode==0) { /* initial press */ filter->keycode = keycode; filter->active = 1; filter->filterOthers = 0; filter->priv=0; filter->filter = _XkbFilterPointerMove; filter->upAction= *pAction; xkbi->mouseKeysCounter= 0; xkbi->mouseKey= keycode; accel= ((pAction->ptr.flags&XkbSA_NoAcceleration)==0); x= XkbPtrActionX(&pAction->ptr); y= XkbPtrActionY(&pAction->ptr); XkbDDXFakePointerMotion(pAction->ptr.flags,x,y); AccessXCancelRepeatKey(xkbi,keycode); xkbi->mouseKeysAccel= accel&& (xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask); xkbi->mouseKeysFlags= pAction->ptr.flags; xkbi->mouseKeysDX= XkbPtrActionX(&pAction->ptr); xkbi->mouseKeysDY= XkbPtrActionY(&pAction->ptr); xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0, xkbi->desc->ctrls->mk_delay, _XkbPtrAccelExpire,(void *)xkbi); } else if (filter->keycode==keycode) { filter->active = 0; if (xkbi->mouseKey==keycode) { xkbi->mouseKey= 0; xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0, 0, NULL, NULL); } } return 0; } static int _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi, XkbFilterPtr filter, unsigned keycode, XkbAction * pAction) { if (filter->keycode==0) { /* initial press */ int button= pAction->btn.button; if (button==XkbSA_UseDfltButton) button = xkbi->desc->ctrls->mk_dflt_btn; filter->keycode = keycode; filter->active = 1; filter->filterOthers = 0; filter->priv=0; filter->filter = _XkbFilterPointerBtn; filter->upAction= *pAction; filter->upAction.btn.button= button; switch (pAction->type) { case XkbSA_LockPtrBtn: if (((xkbi->lockedPtrButtons&(1<btn.flags&XkbSA_LockNoLock)==0)) { xkbi->lockedPtrButtons|= (1<upAction.type= XkbSA_NoAction; } break; case XkbSA_PtrBtn: { register int i,nClicks; AccessXCancelRepeatKey(xkbi,keycode); if (pAction->btn.count>0) { nClicks= pAction->btn.count; for (i=0;iupAction.type= XkbSA_NoAction; } else XkbDDXFakePointerButton(ButtonPress,button); } break; case XkbSA_SetPtrDflt: { XkbControlsPtr ctrls= xkbi->desc->ctrls; XkbControlsRec old; xkbControlsNotify cn; old= *ctrls; AccessXCancelRepeatKey(xkbi,keycode); switch (pAction->dflt.affect) { case XkbSA_AffectDfltBtn: if (pAction->dflt.flags&XkbSA_DfltBtnAbsolute) ctrls->mk_dflt_btn= XkbSAPtrDfltValue(&pAction->dflt); else { ctrls->mk_dflt_btn+= XkbSAPtrDfltValue(&pAction->dflt); if (ctrls->mk_dflt_btn>5) ctrls->mk_dflt_btn= 5; else if (ctrls->mk_dflt_btn<1) ctrls->mk_dflt_btn= 1; } break; default: ErrorF( "Attempt to change unknown pointer default (%d) ignored\n", pAction->dflt.affect); break; } if (XkbComputeControlsNotify(xkbi->device, &old,xkbi->desc->ctrls, &cn,False)) { cn.keycode = keycode; cn.eventType = KeyPress; cn.requestMajor = 0; cn.requestMinor = 0; XkbSendControlsNotify(xkbi->device,&cn); } } break; } } else if (filter->keycode==keycode) { int button= filter->upAction.btn.button; switch (filter->upAction.type) { case XkbSA_LockPtrBtn: if (((filter->upAction.btn.flags&XkbSA_LockNoUnlock)!=0)|| ((xkbi->lockedPtrButtons&(1<lockedPtrButtons&= ~(1<active = 0; } return 0; } static int _XkbFilterControls( XkbSrvInfoPtr xkbi, XkbFilterPtr filter, unsigned keycode, XkbAction * pAction) { XkbControlsRec old; XkbControlsPtr ctrls; DeviceIntPtr kbd; unsigned int change; XkbEventCauseRec cause; kbd= xkbi->device; ctrls= xkbi->desc->ctrls; old= *ctrls; if (filter->keycode==0) { /* initial press */ filter->keycode = keycode; filter->active = 1; filter->filterOthers = 0; change= XkbActionCtrls(&pAction->ctrls); filter->priv = change; filter->filter = _XkbFilterControls; filter->upAction = *pAction; if (pAction->type==XkbSA_LockControls) { filter->priv= (ctrls->enabled_ctrls&change); change&= ~ctrls->enabled_ctrls; } if (change) { xkbControlsNotify cn; XkbSrvLedInfoPtr sli; ctrls->enabled_ctrls|= change; if (XkbComputeControlsNotify(kbd,&old,ctrls,&cn,False)) { cn.keycode = keycode; cn.eventType = KeyPress; cn.requestMajor = 0; cn.requestMinor = 0; XkbSendControlsNotify(kbd,&cn); } XkbSetCauseKey(&cause,keycode,KeyPress); /* If sticky keys were disabled, clear all locks and latches */ if ((old.enabled_ctrls&XkbStickyKeysMask)&& (!(ctrls->enabled_ctrls&XkbStickyKeysMask))) { XkbClearAllLatchesAndLocks(kbd,xkbi,False,&cause); } sli= XkbFindSrvLedInfo(kbd,XkbDfltXIClass,XkbDfltXIId,0); XkbUpdateIndicators(kbd,sli->usesControls,True,NULL,&cause); if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask)) XkbDDXAccessXBeep(kbd,_BEEP_FEATURE_ON,change); } } else if (filter->keycode==keycode) { change= filter->priv; if (change) { xkbControlsNotify cn; XkbSrvLedInfoPtr sli; ctrls->enabled_ctrls&= ~change; if (XkbComputeControlsNotify(kbd,&old,ctrls,&cn,False)) { cn.keycode = keycode; cn.eventType = KeyRelease; cn.requestMajor = 0; cn.requestMinor = 0; XkbSendControlsNotify(kbd,&cn); } XkbSetCauseKey(&cause,keycode,KeyRelease); /* If sticky keys were disabled, clear all locks and latches */ if ((old.enabled_ctrls&XkbStickyKeysMask)&& (!(ctrls->enabled_ctrls&XkbStickyKeysMask))) { XkbClearAllLatchesAndLocks(kbd,xkbi,False,&cause); } sli= XkbFindSrvLedInfo(kbd,XkbDfltXIClass,XkbDfltXIId,0); XkbUpdateIndicators(kbd,sli->usesControls,True,NULL,&cause); if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask)) XkbDDXAccessXBeep(kbd,_BEEP_FEATURE_OFF,change); } filter->keycode= 0; filter->active= 0; } return 1; } static int _XkbFilterActionMessage(XkbSrvInfoPtr xkbi, XkbFilterPtr filter, unsigned keycode, XkbAction * pAction) { XkbMessageAction * pMsg; DeviceIntPtr kbd; kbd= xkbi->device; if (filter->keycode==0) { /* initial press */ pMsg= &pAction->msg; if ((pMsg->flags&XkbSA_MessageOnRelease)|| ((pMsg->flags&XkbSA_MessageGenKeyEvent)==0)) { filter->keycode = keycode; filter->active = 1; filter->filterOthers = 0; filter->priv = 0; filter->filter = _XkbFilterActionMessage; filter->upAction = *pAction; } if (pMsg->flags&XkbSA_MessageOnPress) { xkbActionMessage msg; msg.keycode= keycode; msg.press= 1; msg.keyEventFollows=((pMsg->flags&XkbSA_MessageGenKeyEvent)!=0); memcpy((char *)msg.message, (char *)pMsg->message,XkbActionMessageLength); XkbSendActionMessage(kbd,&msg); } return ((pAction->msg.flags&XkbSA_MessageGenKeyEvent)!=0); } else if (filter->keycode==keycode) { pMsg= &filter->upAction.msg; if (pMsg->flags&XkbSA_MessageOnRelease) { xkbActionMessage msg; msg.keycode= keycode; msg.press= 0; msg.keyEventFollows=((pMsg->flags&XkbSA_MessageGenKeyEvent)!=0); memcpy((char *)msg.message,(char *)pMsg->message, XkbActionMessageLength); XkbSendActionMessage(kbd,&msg); } filter->keycode= 0; filter->active= 0; return ((pMsg->flags&XkbSA_MessageGenKeyEvent)!=0); } return 0; } static int _XkbFilterRedirectKey( XkbSrvInfoPtr xkbi, XkbFilterPtr filter, unsigned keycode, XkbAction * pAction) { unsigned realMods; xEvent ev; int x,y; XkbStateRec old; unsigned mods,mask,oldCoreState = 0,oldCorePrevState = 0; xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(xkbi->device); if ((filter->keycode!=0)&&(filter->keycode!=keycode)) return 1; GetSpritePosition(&x,&y); ev.u.keyButtonPointer.time = GetTimeInMillis(); ev.u.keyButtonPointer.rootX = x; ev.u.keyButtonPointer.rootY = y; if (filter->keycode==0) { /* initial press */ if ((pAction->redirect.new_keydesc->min_key_code)|| (pAction->redirect.new_key>xkbi->desc->max_key_code)) { return 1; } filter->keycode = keycode; filter->active = 1; filter->filterOthers = 0; filter->priv = 0; filter->filter = _XkbFilterRedirectKey; filter->upAction = *pAction; ev.u.u.type = KeyPress; ev.u.u.detail = pAction->redirect.new_key; mask= XkbSARedirectVModsMask(&pAction->redirect); mods= XkbSARedirectVMods(&pAction->redirect); if (mask) XkbVirtualModsToReal(xkbi->desc,mask,&mask); if (mods) XkbVirtualModsToReal(xkbi->desc,mods,&mods); mask|= pAction->redirect.mods_mask; mods|= pAction->redirect.mods; if ( mask || mods ) { old= xkbi->state; oldCoreState= xkbi->device->key->state; oldCorePrevState= xkbi->device->key->prev_state; xkbi->state.base_mods&= ~mask; xkbi->state.base_mods|= (mods&mask); xkbi->state.latched_mods&= ~mask; xkbi->state.latched_mods|= (mods&mask); xkbi->state.locked_mods&= ~mask; xkbi->state.locked_mods|= (mods&mask); XkbComputeDerivedState(xkbi); xkbi->device->key->state= xkbi->device->key->prev_state= xkbi->state.mods; } realMods = xkbi->device->key->modifierMap[ev.u.u.detail]; xkbi->device->key->modifierMap[ev.u.u.detail] = 0; UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr); xkbi->device->public.processInputProc(&ev,xkbi->device,1); COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, ProcessKeyboardEvent,xkbUnwrapProc); xkbi->device->key->modifierMap[ev.u.u.detail] = realMods; if ( mask || mods ) { xkbi->device->key->state= oldCoreState; xkbi->device->key->prev_state= oldCorePrevState; xkbi->state= old; } } else if (filter->keycode==keycode) { ev.u.u.type = KeyRelease; ev.u.u.detail = filter->upAction.redirect.new_key; mask= XkbSARedirectVModsMask(&filter->upAction.redirect); mods= XkbSARedirectVMods(&filter->upAction.redirect); if (mask) XkbVirtualModsToReal(xkbi->desc,mask,&mask); if (mods) XkbVirtualModsToReal(xkbi->desc,mods,&mods); mask|= filter->upAction.redirect.mods_mask; mods|= filter->upAction.redirect.mods; if ( mask || mods ) { old= xkbi->state; oldCoreState= xkbi->device->key->state; oldCorePrevState= xkbi->device->key->prev_state; xkbi->state.base_mods&= ~mask; xkbi->state.base_mods|= (mods&mask); xkbi->state.latched_mods&= ~mask; xkbi->state.latched_mods|= (mods&mask); xkbi->state.locked_mods&= ~mask; xkbi->state.locked_mods|= (mods&mask); XkbComputeDerivedState(xkbi); xkbi->device->key->state= xkbi->device->key->prev_state= xkbi->state.mods; } realMods = xkbi->device->key->modifierMap[ev.u.u.detail]; xkbi->device->key->modifierMap[ev.u.u.detail] = 0; UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr); xkbi->device->public.processInputProc(&ev,xkbi->device,1); COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr, ProcessKeyboardEvent,xkbUnwrapProc); xkbi->device->key->modifierMap[ev.u.u.detail] = realMods; if ( mask || mods ) { xkbi->device->key->state= oldCoreState; xkbi->device->key->prev_state= oldCorePrevState; xkbi->state= old; } filter->keycode= 0; filter->active= 0; } return 0; } static int _XkbFilterSwitchScreen( XkbSrvInfoPtr xkbi, XkbFilterPtr filter, unsigned keycode, XkbAction * pAction) { if (filter->keycode==0) { /* initial press */ DeviceIntPtr dev = xkbi->device; filter->keycode = keycode; filter->active = 1; filter->filterOthers = 0; filter->filter = _XkbFilterSwitchScreen; AccessXCancelRepeatKey(xkbi, keycode); XkbDDXSwitchScreen(dev,keycode,pAction); return 0; } else if (filter->keycode==keycode) { filter->active= 0; return 0; } return 1; } static int _XkbFilterXF86Private( XkbSrvInfoPtr xkbi, XkbFilterPtr filter, unsigned keycode, XkbAction * pAction) { if (filter->keycode==0) { /* initial press */ DeviceIntPtr dev = xkbi->device; filter->keycode = keycode; filter->active = 1; filter->filterOthers = 0; filter->filter = _XkbFilterXF86Private; XkbDDXPrivate(dev,keycode,pAction); return 0; } else if (filter->keycode==keycode) { filter->active= 0; return 0; } return 1; } #ifdef XINPUT static int _XkbFilterDeviceBtn( XkbSrvInfoPtr xkbi, XkbFilterPtr filter, unsigned keycode, XkbAction * pAction) { if (filter->keycode==0) { /* initial press */ DeviceIntPtr dev; int button; dev= _XkbLookupButtonDevice(pAction->devbtn.device,NULL); if ((!dev)||(!dev->public.on)||(&dev->public==LookupPointerDevice())) return 1; button= pAction->devbtn.button; if ((button<1)||(button>dev->button->numButtons)) return 1; filter->keycode = keycode; filter->active = 1; filter->filterOthers = 0; filter->priv=0; filter->filter = _XkbFilterDeviceBtn; filter->upAction= *pAction; switch (pAction->type) { case XkbSA_LockDeviceBtn: if ((pAction->devbtn.flags&XkbSA_LockNoLock)|| (dev->button->down[button/8]&(1L<<(button%8)))) return 0; XkbDDXFakeDeviceButton(dev,True,button); filter->upAction.type= XkbSA_NoAction; break; case XkbSA_DeviceBtn: if (pAction->devbtn.count>0) { int nClicks,i; nClicks= pAction->btn.count; for (i=0;iupAction.type= XkbSA_NoAction; } else XkbDDXFakeDeviceButton(dev,True,button); break; } } else if (filter->keycode==keycode) { DeviceIntPtr dev; int button; filter->active= 0; dev= _XkbLookupButtonDevice(filter->upAction.devbtn.device,NULL); if ((!dev)||(!dev->public.on)||(&dev->public==LookupPointerDevice())) return 1; button= filter->upAction.btn.button; switch (filter->upAction.type) { case XkbSA_LockDeviceBtn: if ((filter->upAction.devbtn.flags&XkbSA_LockNoUnlock)|| ((dev->button->down[button/8]&(1L<<(button%8)))==0)) return 0; XkbDDXFakeDeviceButton(dev,False,button); break; case XkbSA_DeviceBtn: XkbDDXFakeDeviceButton(dev,False,button); break; } filter->active = 0; } return 0; } #endif static int szFilters = 0; static XkbFilterPtr filters = NULL; static XkbFilterPtr _XkbNextFreeFilter( void ) { register int i; if (szFilters==0) { szFilters = 4; filters = _XkbTypedCalloc(szFilters,XkbFilterRec); /* 6/21/93 (ef) -- XXX! deal with allocation failure */ } for (i=0;ikey; xkbi= keyc->xkbInfo; key= xE->u.u.detail; if ((xkbi->flags&_XkbStateNotifyInProgress)==0) { xkbi->prev_state = xkbi->state; xkbi->flags|= _XkbStateNotifyInProgress; genStateNotify= True; } else genStateNotify= False; xkbi->clearMods = xkbi->setMods = 0; xkbi->groupChange = 0; sendEvent = 1; #ifdef XINPUT keyEvent= ((xE->u.u.type==KeyPress)||(xE->u.u.type==DeviceKeyPress)|| (xE->u.u.type==KeyRelease)||(xE->u.u.type==DeviceKeyRelease)); pressEvent= (xE->u.u.type==KeyPress)||(xE->u.u.type==DeviceKeyPress)|| (xE->u.u.type==ButtonPress)||(xE->u.u.type==DeviceButtonPress); xiEvent= (xE->u.u.type==DeviceKeyPress)||(xE->u.u.type==DeviceKeyRelease)|| (xE->u.u.type==DeviceButtonPress)|| (xE->u.u.type==DeviceButtonRelease); #else keyEvent= (xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease); pressEvent= (xE->u.u.type==KeyPress)||(xE->u.u.type==ButtonPress); #endif if (pressEvent) { if (keyEvent) act = XkbGetKeyAction(xkbi,&xkbi->state,key); else { act = XkbGetButtonAction(kbd,dev,key); key|= BTN_ACT_FLAG; } sendEvent = _XkbApplyFilters(xkbi,key,&act); if (sendEvent) { switch (act.type) { case XkbSA_SetMods: case XkbSA_SetGroup: filter = _XkbNextFreeFilter(); sendEvent = _XkbFilterSetState(xkbi,filter,key,&act); break; case XkbSA_LatchMods: case XkbSA_LatchGroup: filter = _XkbNextFreeFilter(); sendEvent=_XkbFilterLatchState(xkbi,filter,key,&act); break; case XkbSA_LockMods: case XkbSA_LockGroup: filter = _XkbNextFreeFilter(); sendEvent=_XkbFilterLockState(xkbi,filter,key,&act); break; case XkbSA_ISOLock: filter = _XkbNextFreeFilter(); sendEvent=_XkbFilterISOLock(xkbi,filter,key,&act); break; case XkbSA_MovePtr: filter = _XkbNextFreeFilter(); sendEvent= _XkbFilterPointerMove(xkbi,filter,key,&act); break; case XkbSA_PtrBtn: case XkbSA_LockPtrBtn: case XkbSA_SetPtrDflt: filter = _XkbNextFreeFilter(); sendEvent= _XkbFilterPointerBtn(xkbi,filter,key,&act); break; case XkbSA_Terminate: sendEvent= XkbDDXTerminateServer(dev,key,&act); break; case XkbSA_SwitchScreen: filter = _XkbNextFreeFilter(); sendEvent=_XkbFilterSwitchScreen(xkbi,filter,key,&act); break; case XkbSA_SetControls: case XkbSA_LockControls: filter = _XkbNextFreeFilter(); sendEvent=_XkbFilterControls(xkbi,filter,key,&act); break; case XkbSA_ActionMessage: filter = _XkbNextFreeFilter(); sendEvent=_XkbFilterActionMessage(xkbi,filter,key,&act); break; case XkbSA_RedirectKey: filter = _XkbNextFreeFilter(); sendEvent= _XkbFilterRedirectKey(xkbi,filter,key,&act); break; #ifdef XINPUT case XkbSA_DeviceBtn: case XkbSA_LockDeviceBtn: filter = _XkbNextFreeFilter(); sendEvent= _XkbFilterDeviceBtn(xkbi,filter,key,&act); break; #endif case XkbSA_XFree86Private: filter = _XkbNextFreeFilter(); sendEvent= _XkbFilterXF86Private(xkbi,filter,key,&act); break; } } } else { if (!keyEvent) key|= BTN_ACT_FLAG; sendEvent = _XkbApplyFilters(xkbi,key,NULL); } if (xkbi->groupChange!=0) xkbi->state.base_group+= xkbi->groupChange; if (xkbi->setMods) { for (i=0,bit=1; xkbi->setMods; i++,bit<<=1 ) { if (xkbi->setMods&bit) { keyc->modifierKeyCount[i]++; xkbi->state.base_mods|= bit; xkbi->setMods&= ~bit; } } } if (xkbi->clearMods) { for (i=0,bit=1; xkbi->clearMods; i++,bit<<=1 ) { if (xkbi->clearMods&bit) { keyc->modifierKeyCount[i]--; if (keyc->modifierKeyCount[i]<=0) { xkbi->state.base_mods&= ~bit; keyc->modifierKeyCount[i] = 0; } xkbi->clearMods&= ~bit; } } } if (sendEvent) { #ifdef XINPUT if (xiEvent) ProcessOtherEvent(xE,dev,count); else #endif if (keyEvent) { realMods = keyc->modifierMap[key]; keyc->modifierMap[key] = 0; UNWRAP_PROCESS_INPUT_PROC(dev,xkbPrivPtr); dev->public.processInputProc(xE,dev,count); COND_WRAP_PROCESS_INPUT_PROC(dev, xkbPrivPtr, ProcessKeyboardEvent,xkbUnwrapProc); keyc->modifierMap[key] = realMods; } else CoreProcessPointerEvent(xE,dev,count); } else if (keyEvent) FixKeyState(xE,dev); XkbComputeDerivedState(xkbi); keyc->prev_state= keyc->state; keyc->state= XkbStateFieldFromRec(&xkbi->state); changed = XkbStateChangedFlags(&xkbi->prev_state,&xkbi->state); if (genStateNotify) { if (changed) { xkbStateNotify sn; sn.keycode= key; sn.eventType= xE->u.u.type; sn.requestMajor = sn.requestMinor = 0; sn.changed= changed; XkbSendStateNotify(dev,&sn); } xkbi->flags&= ~_XkbStateNotifyInProgress; } changed= XkbIndicatorsToUpdate(dev,changed,False); if (changed) { XkbEventCauseRec cause; XkbSetCauseKey(&cause,key,xE->u.u.type); XkbUpdateIndicators(dev,changed,True,NULL,&cause); } return; } int XkbLatchModifiers(DeviceIntPtr pXDev,CARD8 mask,CARD8 latches) { XkbSrvInfoPtr xkbi; XkbFilterPtr filter; XkbAction act; unsigned clear; if ( pXDev && pXDev->key && pXDev->key->xkbInfo ) { xkbi = pXDev->key->xkbInfo; clear= (mask&(~latches)); xkbi->state.latched_mods&= ~clear; /* Clear any pending latch to locks. */ act.type = XkbSA_NoAction; _XkbApplyFilters(xkbi,SYNTHETIC_KEYCODE,&act); act.type = XkbSA_LatchMods; act.mods.flags = 0; act.mods.mask = mask&latches; filter = _XkbNextFreeFilter(); _XkbFilterLatchState(xkbi,filter,SYNTHETIC_KEYCODE,&act); _XkbFilterLatchState(xkbi,filter,SYNTHETIC_KEYCODE,(XkbAction *)NULL); return Success; } return BadValue; } int XkbLatchGroup(DeviceIntPtr pXDev,int group) { XkbSrvInfoPtr xkbi; XkbFilterPtr filter; XkbAction act; if ( pXDev && pXDev->key && pXDev->key->xkbInfo ) { xkbi = pXDev->key->xkbInfo; act.type = XkbSA_LatchGroup; act.group.flags = 0; XkbSASetGroup(&act.group,group); filter = _XkbNextFreeFilter(); _XkbFilterLatchState(xkbi,filter,SYNTHETIC_KEYCODE,&act); _XkbFilterLatchState(xkbi,filter,SYNTHETIC_KEYCODE,(XkbAction *)NULL); return Success; } return BadValue; } /***====================================================================***/ void XkbClearAllLatchesAndLocks( DeviceIntPtr dev, XkbSrvInfoPtr xkbi, Bool genEv, XkbEventCausePtr cause) { XkbStateRec os; xkbStateNotify sn; sn.changed= 0; os= xkbi->state; if (os.latched_mods) { /* clear all latches */ XkbLatchModifiers(dev,~0,0); sn.changed|= XkbModifierLatchMask; } if (os.latched_group) { XkbLatchGroup(dev,0); sn.changed|= XkbGroupLatchMask; } if (os.locked_mods) { xkbi->state.locked_mods= 0; sn.changed|= XkbModifierLockMask; } if (os.locked_group) { xkbi->state.locked_group= 0; sn.changed|= XkbGroupLockMask; } if ( genEv && sn.changed) { CARD32 changed; XkbComputeDerivedState(xkbi); sn.keycode= cause->kc; sn.eventType= cause->event; sn.requestMajor= cause->mjr; sn.requestMinor= cause->mnr; sn.changed= XkbStateChangedFlags(&os,&xkbi->state); XkbSendStateNotify(dev,&sn); changed= XkbIndicatorsToUpdate(dev,sn.changed,False); if (changed) { XkbUpdateIndicators(dev,changed,True,NULL,cause); } } return; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/XKBAlloc.c0000644000000000000000000002115013614532331017121 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "inputstr.h" #include #include "xkbgeom.h" /***===================================================================***/ /*ARGSUSED*/ Status XkbAllocCompatMap(XkbDescPtr xkb,unsigned which,unsigned nSI) { XkbCompatMapPtr compat; XkbSymInterpretRec *prev_interpret; if (!xkb) return BadMatch; if (xkb->compat) { if (xkb->compat->size_si>=nSI) return Success; compat= xkb->compat; compat->size_si= nSI; if (compat->sym_interpret==NULL) compat->num_si= 0; prev_interpret = compat->sym_interpret; compat->sym_interpret= _XkbTypedRealloc(compat->sym_interpret, nSI,XkbSymInterpretRec); if (compat->sym_interpret==NULL) { _XkbFree(prev_interpret); compat->size_si= compat->num_si= 0; return BadAlloc; } if (compat->num_si!=0) { _XkbClearElems(compat->sym_interpret,compat->num_si, compat->size_si-1,XkbSymInterpretRec); } return Success; } compat= _XkbTypedCalloc(1,XkbCompatMapRec); if (compat==NULL) return BadAlloc; if (nSI>0) { compat->sym_interpret= _XkbTypedCalloc(nSI,XkbSymInterpretRec); if (!compat->sym_interpret) { _XkbFree(compat); return BadAlloc; } } compat->size_si= nSI; compat->num_si= 0; bzero((char *)&compat->groups[0],XkbNumKbdGroups*sizeof(XkbModsRec)); xkb->compat= compat; return Success; } void XkbFreeCompatMap(XkbDescPtr xkb,unsigned which,Bool freeMap) { register XkbCompatMapPtr compat; if ((xkb==NULL)||(xkb->compat==NULL)) return; compat= xkb->compat; if (freeMap) which= XkbAllCompatMask; if (which&XkbGroupCompatMask) bzero((char *)&compat->groups[0],XkbNumKbdGroups*sizeof(XkbModsRec)); if (which&XkbSymInterpMask) { if ((compat->sym_interpret)&&(compat->size_si>0)) _XkbFree(compat->sym_interpret); compat->size_si= compat->num_si= 0; compat->sym_interpret= NULL; } if (freeMap) { _XkbFree(compat); xkb->compat= NULL; } return; } /***===================================================================***/ Status XkbAllocNames(XkbDescPtr xkb,unsigned which,int nTotalRG,int nTotalAliases) { XkbNamesPtr names; if (xkb==NULL) return BadMatch; if (xkb->names==NULL) { xkb->names = _XkbTypedCalloc(1,XkbNamesRec); if (xkb->names==NULL) return BadAlloc; } names= xkb->names; if ((which&XkbKTLevelNamesMask)&&(xkb->map!=NULL)&&(xkb->map->types!=NULL)){ register int i; XkbKeyTypePtr type; type= xkb->map->types; for (i=0;imap->num_types;i++,type++) { if (type->level_names==NULL) { type->level_names= _XkbTypedCalloc(type->num_levels,Atom); if (type->level_names==NULL) return BadAlloc; } } } if ((which&XkbKeyNamesMask)&&(names->keys==NULL)) { if ((!XkbIsLegalKeycode(xkb->min_key_code))|| (!XkbIsLegalKeycode(xkb->max_key_code))|| (xkb->max_key_codemin_key_code)) return BadValue; names->keys= _XkbTypedCalloc((xkb->max_key_code+1),XkbKeyNameRec); if (names->keys==NULL) return BadAlloc; } if ((which&XkbKeyAliasesMask)&&(nTotalAliases>0)) { if (names->key_aliases==NULL) { names->key_aliases= _XkbTypedCalloc(nTotalAliases,XkbKeyAliasRec); } else if (nTotalAliases>names->num_key_aliases) { XkbKeyAliasRec *prev_aliases = names->key_aliases; names->key_aliases= _XkbTypedRealloc(names->key_aliases, nTotalAliases,XkbKeyAliasRec); if (names->key_aliases!=NULL) { _XkbClearElems(names->key_aliases,names->num_key_aliases, nTotalAliases-1,XkbKeyAliasRec); } else { _XkbFree(prev_aliases); } } if (names->key_aliases==NULL) { names->num_key_aliases= 0; return BadAlloc; } names->num_key_aliases= nTotalAliases; } if ((which&XkbRGNamesMask)&&(nTotalRG>0)) { if (names->radio_groups==NULL) { names->radio_groups= _XkbTypedCalloc(nTotalRG,Atom); } else if (nTotalRG>names->num_rg) { Atom *prev_radio_groups = names->radio_groups; names->radio_groups= _XkbTypedRealloc(names->radio_groups,nTotalRG, Atom); if (names->radio_groups!=NULL) { _XkbClearElems(names->radio_groups,names->num_rg,nTotalRG-1, Atom); } else { _XkbFree(prev_radio_groups); } } if (names->radio_groups==NULL) return BadAlloc; names->num_rg= nTotalRG; } return Success; } void XkbFreeNames(XkbDescPtr xkb,unsigned which,Bool freeMap) { XkbNamesPtr names; if ((xkb==NULL)||(xkb->names==NULL)) return; names= xkb->names; if (freeMap) which= XkbAllNamesMask; if (which&XkbKTLevelNamesMask) { XkbClientMapPtr map= xkb->map; if ((map!=NULL)&&(map->types!=NULL)) { register int i; register XkbKeyTypePtr type; type= map->types; for (i=0;inum_types;i++,type++) { if (type->level_names!=NULL) { _XkbFree(type->level_names); type->level_names= NULL; } } } } if ((which&XkbKeyNamesMask)&&(names->keys!=NULL)) { _XkbFree(names->keys); names->keys= NULL; names->num_keys= 0; } if ((which&XkbKeyAliasesMask)&&(names->key_aliases)){ _XkbFree(names->key_aliases); names->key_aliases=NULL; names->num_key_aliases=0; } if ((which&XkbRGNamesMask)&&(names->radio_groups)) { _XkbFree(names->radio_groups); names->radio_groups= NULL; names->num_rg= 0; } if (freeMap) { _XkbFree(names); xkb->names= NULL; } return; } /***===================================================================***/ /*ARGSUSED*/ Status XkbAllocControls(XkbDescPtr xkb,unsigned which) { if (xkb==NULL) return BadMatch; if (xkb->ctrls==NULL) { xkb->ctrls= _XkbTypedCalloc(1,XkbControlsRec); if (!xkb->ctrls) return BadAlloc; } return Success; } /*ARGSUSED*/ static void XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap) { if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) { _XkbFree(xkb->ctrls); xkb->ctrls= NULL; } return; } /***===================================================================***/ Status XkbAllocIndicatorMaps(XkbDescPtr xkb) { if (xkb==NULL) return BadMatch; if (xkb->indicators==NULL) { xkb->indicators= _XkbTypedCalloc(1,XkbIndicatorRec); if (!xkb->indicators) return BadAlloc; } return Success; } static void XkbFreeIndicatorMaps(XkbDescPtr xkb) { if ((xkb!=NULL)&&(xkb->indicators!=NULL)) { _XkbFree(xkb->indicators); xkb->indicators= NULL; } return; } /***====================================================================***/ XkbDescRec * XkbAllocKeyboard(void) { XkbDescRec *xkb; xkb = _XkbTypedCalloc(1,XkbDescRec); if (xkb) xkb->device_spec= XkbUseCoreKbd; return xkb; } void XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll) { if (xkb==NULL) return; if (freeAll) which= XkbAllComponentsMask; if (which&XkbClientMapMask) XkbFreeClientMap(xkb,XkbAllClientInfoMask,True); if (which&XkbServerMapMask) XkbFreeServerMap(xkb,XkbAllServerInfoMask,True); if (which&XkbCompatMapMask) XkbFreeCompatMap(xkb,XkbAllCompatMask,True); if (which&XkbIndicatorMapMask) XkbFreeIndicatorMaps(xkb); if (which&XkbNamesMask) XkbFreeNames(xkb,XkbAllNamesMask,True); if ((which&XkbGeometryMask) && (xkb->geom!=NULL)) XkbFreeGeometry(xkb->geom,XkbGeomAllMask,True); if (which&XkbControlsMask) XkbFreeControls(xkb,XkbAllControlsMask,True); if (freeAll) _XkbFree(xkb); return; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkb.c0000644000000000000000000051761013614532331016321 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "inputstr.h" #include #include "extnsionst.h" #include "xkb.h" #include "protocol-versions.h" #include int XkbEventBase; static int XkbErrorBase; int XkbReqCode; static int XkbKeyboardErrorCode; CARD32 xkbDebugFlags = 0; static CARD32 xkbDebugCtrls = 0; static RESTYPE RT_XKBCLIENT; /***====================================================================***/ #define CHK_DEVICE(d,sp,lf) {\ int why;\ d = (DeviceIntPtr)lf((sp),&why);\ if (!dev) {\ client->errorValue = _XkbErrCode2(why,(sp));\ return XkbKeyboardErrorCode;\ }\ } #define CHK_KBD_DEVICE(d,sp) CHK_DEVICE(d,sp,_XkbLookupKeyboard) #define CHK_LED_DEVICE(d,sp) CHK_DEVICE(d,sp,_XkbLookupLedDevice) #define CHK_BELL_DEVICE(d,sp) CHK_DEVICE(d,sp,_XkbLookupBellDevice) #define CHK_ANY_DEVICE(d,sp) CHK_DEVICE(d,sp,_XkbLookupAnyDevice) #define CHK_ATOM_ONLY2(a,ev,er) {\ if (((a)==None)||(!ValidAtom((a)))) {\ (ev)= (XID)(a);\ return er;\ }\ } #define CHK_ATOM_ONLY(a) \ CHK_ATOM_ONLY2(a,client->errorValue,BadAtom) #define CHK_ATOM_OR_NONE3(a,ev,er,ret) {\ if (((a)!=None)&&(!ValidAtom((a)))) {\ (ev)= (XID)(a);\ (er)= BadAtom;\ return ret;\ }\ } #define CHK_ATOM_OR_NONE2(a,ev,er) {\ if (((a)!=None)&&(!ValidAtom((a)))) {\ (ev)= (XID)(a);\ return er;\ }\ } #define CHK_ATOM_OR_NONE(a) \ CHK_ATOM_OR_NONE2(a,client->errorValue,BadAtom) #define CHK_MASK_LEGAL3(err,mask,legal,ev,er,ret) {\ if ((mask)&(~(legal))) { \ (ev)= _XkbErrCode2((err),((mask)&(~(legal))));\ (er)= BadValue;\ return ret;\ }\ } #define CHK_MASK_LEGAL2(err,mask,legal,ev,er) {\ if ((mask)&(~(legal))) { \ (ev)= _XkbErrCode2((err),((mask)&(~(legal))));\ return er;\ }\ } #define CHK_MASK_LEGAL(err,mask,legal) \ CHK_MASK_LEGAL2(err,mask,legal,client->errorValue,BadValue) #define CHK_MASK_MATCH(err,affect,value) {\ if ((value)&(~(affect))) { \ client->errorValue= _XkbErrCode2((err),((value)&(~(affect))));\ return BadMatch;\ }\ } #define CHK_MASK_OVERLAP(err,m1,m2) {\ if ((m1)&(m2)) { \ client->errorValue= _XkbErrCode2((err),((m1)&(m2)));\ return BadMatch;\ }\ } #define CHK_KEY_RANGE2(err,first,num,x,ev,er) {\ if (((unsigned)(first)+(num)-1)>(x)->max_key_code) {\ (ev)=_XkbErrCode4(err,(first),(num),(x)->max_key_code);\ return er;\ }\ else if ( (first)<(x)->min_key_code ) {\ (ev)=_XkbErrCode3(err+1,(first),xkb->min_key_code);\ return er;\ }\ } #define CHK_KEY_RANGE(err,first,num,x) \ CHK_KEY_RANGE2(err,first,num,x,client->errorValue,BadValue) #define CHK_REQ_KEY_RANGE2(err,first,num,r,ev,er) {\ if (((unsigned)(first)+(num)-1)>(r)->maxKeyCode) {\ (ev)=_XkbErrCode4(err,(first),(num),(r)->maxKeyCode);\ return er;\ }\ else if ( (first)<(r)->minKeyCode ) {\ (ev)=_XkbErrCode3(err+1,(first),(r)->minKeyCode);\ return er;\ }\ } #define CHK_REQ_KEY_RANGE(err,first,num,r) \ CHK_REQ_KEY_RANGE2(err,first,num,r,client->errorValue,BadValue) /***====================================================================***/ int ProcXkbUseExtension(ClientPtr client) { REQUEST(xkbUseExtensionReq); xkbUseExtensionReply rep = {0}; int supported; REQUEST_SIZE_MATCH(xkbUseExtensionReq); if (stuff->wantedMajor != SERVER_XKB_MAJOR_VERSION) { /* pre-release version 0.65 is compatible with 1.00 */ supported= ((SERVER_XKB_MAJOR_VERSION==1)&& (stuff->wantedMajor==0)&&(stuff->wantedMinor==65)); } else supported = 1; if ((supported) && (!(client->xkbClientFlags&_XkbClientInitialized))) { client->xkbClientFlags= _XkbClientInitialized; client->vMajor= stuff->wantedMajor; client->vMinor= stuff->wantedMinor; } else if (xkbDebugFlags&0x1) { ErrorF("Rejecting client %d (0x%lx) (wants %d.%02d, have %d.%02d)\n", client->index, (long)client->clientAsMask, stuff->wantedMajor,stuff->wantedMinor, SERVER_XKB_MAJOR_VERSION,SERVER_XKB_MINOR_VERSION); } rep.type = X_Reply; rep.supported = supported; rep.length = 0; rep.sequenceNumber = client->sequence; rep.serverMajor = SERVER_XKB_MAJOR_VERSION; rep.serverMinor = SERVER_XKB_MINOR_VERSION; if ( client->swapped ) { swaps(&rep.sequenceNumber); swaps(&rep.serverMajor); swaps(&rep.serverMinor); } WriteToClient(client,SIZEOF(xkbUseExtensionReply), &rep); return client->noClientException; } /***====================================================================***/ int ProcXkbSelectEvents(ClientPtr client) { unsigned legal; DeviceIntPtr dev; XkbInterestPtr masks; REQUEST(xkbSelectEventsReq); REQUEST_AT_LEAST_SIZE(xkbSelectEventsReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_ANY_DEVICE(dev,stuff->deviceSpec); if (((stuff->affectWhich&XkbMapNotifyMask)!=0)&&(stuff->affectMap)) { client->mapNotifyMask&= ~stuff->affectMap; client->mapNotifyMask|= (stuff->affectMap&stuff->map); } if ((stuff->affectWhich&(~XkbMapNotifyMask))==0) return client->noClientException; masks = XkbFindClientResource((DevicePtr)dev,client); if (!masks){ XID id = FakeClientID(client->index); AddResource(id,RT_XKBCLIENT,dev); masks= XkbAddClientResource((DevicePtr)dev,client,id); } if (masks) { union { CARD8 *c8; CARD16 *c16; CARD32 *c32; } from,to; register unsigned bit,ndx,maskLeft,dataLeft,size; from.c8= (CARD8 *)&stuff[1]; dataLeft= (stuff->length*4)-SIZEOF(xkbSelectEventsReq); maskLeft= (stuff->affectWhich&(~XkbMapNotifyMask)); for (ndx=0,bit=1; (maskLeft!=0); ndx++, bit<<=1) { if ((bit&maskLeft)==0) continue; maskLeft&= ~bit; switch (ndx) { case XkbNewKeyboardNotify: to.c16= &client->newKeyboardNotifyMask; legal= XkbAllNewKeyboardEventsMask; size= 2; break; case XkbStateNotify: to.c16= &masks->stateNotifyMask; legal= XkbAllStateEventsMask; size= 2; break; case XkbControlsNotify: to.c32= &masks->ctrlsNotifyMask; legal= XkbAllControlEventsMask; size= 4; break; case XkbIndicatorStateNotify: to.c32= &masks->iStateNotifyMask; legal= XkbAllIndicatorEventsMask; size= 4; break; case XkbIndicatorMapNotify: to.c32= &masks->iMapNotifyMask; legal= XkbAllIndicatorEventsMask; size= 4; break; case XkbNamesNotify: to.c16= &masks->namesNotifyMask; legal= XkbAllNameEventsMask; size= 2; break; case XkbCompatMapNotify: to.c8= &masks->compatNotifyMask; legal= XkbAllCompatMapEventsMask; size= 1; break; case XkbBellNotify: to.c8= &masks->bellNotifyMask; legal= XkbAllBellEventsMask; size= 1; break; case XkbActionMessage: to.c8= &masks->actionMessageMask; legal= XkbAllActionMessagesMask; size= 1; break; case XkbAccessXNotify: to.c16= &masks->accessXNotifyMask; legal= XkbAllAccessXEventsMask; size= 2; break; case XkbExtensionDeviceNotify: to.c16= &masks->extDevNotifyMask; legal= XkbAllExtensionDeviceEventsMask; size= 2; break; default: client->errorValue = _XkbErrCode2(33,bit); return BadValue; } if (stuff->clear&bit) { if (size==2) to.c16[0]= 0; else if (size==4) to.c32[0]= 0; else to.c8[0]= 0; } else if (stuff->selectAll&bit) { if (size==2) to.c16[0]= ~0; else if (size==4) to.c32[0]= ~0; else to.c8[0]= ~0; } else { if (dataLeft<(size*2)) return BadLength; if (size==2) { CHK_MASK_MATCH(ndx,from.c16[0],from.c16[1]); CHK_MASK_LEGAL(ndx,from.c16[0],legal); to.c16[0]&= ~from.c16[0]; to.c16[0]|= (from.c16[0]&from.c16[1]); } else if (size==4) { CHK_MASK_MATCH(ndx,from.c32[0],from.c32[1]); CHK_MASK_LEGAL(ndx,from.c32[0],legal); to.c32[0]&= ~from.c32[0]; to.c32[0]|= (from.c32[0]&from.c32[1]); } else { CHK_MASK_MATCH(ndx,from.c8[0],from.c8[1]); CHK_MASK_LEGAL(ndx,from.c8[0],legal); to.c8[0]&= ~from.c8[0]; to.c8[0]|= (from.c8[0]&from.c8[1]); size= 2; } from.c8+= (size*2); dataLeft-= (size*2); } } if (dataLeft>2) { ErrorF("Extra data (%d bytes) after SelectEvents\n",dataLeft); return BadLength; } return client->noClientException; } return BadAlloc; } /***====================================================================***/ int ProcXkbBell(ClientPtr client) { REQUEST(xkbBellReq); DeviceIntPtr dev; WindowPtr pWin; int base; int newPercent,oldPitch,oldDuration; void * ctrl; REQUEST_SIZE_MATCH(xkbBellReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_BELL_DEVICE(dev,stuff->deviceSpec); CHK_ATOM_OR_NONE(stuff->name); if ((stuff->forceSound)&&(stuff->eventOnly)) { client->errorValue=_XkbErrCode3(0x1,stuff->forceSound,stuff->eventOnly); return BadMatch; } if (stuff->percent < -100 || stuff->percent > 100) { client->errorValue = _XkbErrCode2(0x2,stuff->percent); return BadValue; } if (stuff->duration<-1) { client->errorValue = _XkbErrCode2(0x3,stuff->duration); return BadValue; } if (stuff->pitch<-1) { client->errorValue = _XkbErrCode2(0x4,stuff->pitch); return BadValue; } if (stuff->bellClass == XkbDfltXIClass) { if (dev->kbdfeed!=NULL) stuff->bellClass= KbdFeedbackClass; else stuff->bellClass= BellFeedbackClass; } if (stuff->bellClass == KbdFeedbackClass) { KbdFeedbackPtr k; if (stuff->bellID==XkbDfltXIId) k= dev->kbdfeed; else { for (k=dev->kbdfeed; k; k=k->next) { if (k->ctrl.id == stuff->bellID) break; } } if (!k) { client->errorValue= _XkbErrCode2(0x5,stuff->bellID); return BadValue; } base = k->ctrl.bell; ctrl = (void *) &(k->ctrl); oldPitch= k->ctrl.bell_pitch; oldDuration= k->ctrl.bell_duration; if (stuff->pitch!=0) { if (stuff->pitch==-1) k->ctrl.bell_pitch= defaultKeyboardControl.bell_pitch; else k->ctrl.bell_pitch= stuff->pitch; } if (stuff->duration!=0) { if (stuff->duration==-1) k->ctrl.bell_duration= defaultKeyboardControl.bell_duration; else k->ctrl.bell_duration= stuff->duration; } } else if (stuff->bellClass == BellFeedbackClass) { BellFeedbackPtr b; if (stuff->bellID==XkbDfltXIId) b= dev->bell; else { for (b=dev->bell; b; b=b->next) { if (b->ctrl.id == stuff->bellID) break; } } if (!b) { client->errorValue = _XkbErrCode2(0x6,stuff->bellID); return BadValue; } base = b->ctrl.percent; ctrl = (void *) &(b->ctrl); oldPitch= b->ctrl.pitch; oldDuration= b->ctrl.duration; if (stuff->pitch!=0) { if (stuff->pitch==-1) b->ctrl.pitch= defaultKeyboardControl.bell_pitch; else b->ctrl.pitch= stuff->pitch; } if (stuff->duration!=0) { if (stuff->duration==-1) b->ctrl.duration= defaultKeyboardControl.bell_duration; else b->ctrl.duration= stuff->duration; } } else { client->errorValue = _XkbErrCode2(0x7,stuff->bellClass);; return BadValue; } if (stuff->window!=None) { pWin= (WindowPtr)LookupIDByType(stuff->window,RT_WINDOW); if (pWin==NULL) { client->errorValue= stuff->window; return BadValue; } } else pWin= NULL; newPercent= (base*stuff->percent)/100; if (stuff->percent < 0) newPercent= base+newPercent; else newPercent= base-newPercent+stuff->percent; XkbHandleBell(stuff->forceSound, stuff->eventOnly, dev, newPercent, ctrl, stuff->bellClass, stuff->name, pWin, client); if ((stuff->pitch!=0)||(stuff->duration!=0)) { if (stuff->bellClass == KbdFeedbackClass) { KbdFeedbackPtr k; k= (KbdFeedbackPtr)ctrl; if (stuff->pitch!=0) k->ctrl.bell_pitch= oldPitch; if (stuff->duration!=0) k->ctrl.bell_duration= oldDuration; } else { BellFeedbackPtr b; b= (BellFeedbackPtr)ctrl; if (stuff->pitch!=0) b->ctrl.pitch= oldPitch; if (stuff->duration!=0) b->ctrl.duration= oldDuration; } } return Success; } /***====================================================================***/ int ProcXkbGetState(ClientPtr client) { REQUEST(xkbGetStateReq); DeviceIntPtr dev; xkbGetStateReply rep = {0}; XkbStateRec *xkb; REQUEST_SIZE_MATCH(xkbGetStateReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); xkb= &dev->key->xkbInfo->state; rep.type= X_Reply; rep.sequenceNumber= client->sequence; rep.length = 0; rep.deviceID = dev->id; rep.mods = dev->key->state&0xff; rep.baseMods = xkb->base_mods; rep.lockedMods = xkb->locked_mods; rep.latchedMods = xkb->latched_mods; rep.group = xkb->group; rep.baseGroup = xkb->base_group; rep.latchedGroup = xkb->latched_group; rep.lockedGroup = xkb->locked_group; rep.compatState = xkb->compat_state; rep.ptrBtnState = xkb->ptr_buttons; if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.ptrBtnState); } WriteToClient(client, SIZEOF(xkbGetStateReply), &rep); return client->noClientException; } /***====================================================================***/ int ProcXkbLatchLockState(ClientPtr client) { int status; DeviceIntPtr dev; XkbStateRec oldState,*newState; CARD16 changed; REQUEST(xkbLatchLockStateReq); REQUEST_SIZE_MATCH(xkbLatchLockStateReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); CHK_MASK_MATCH(0x01,stuff->affectModLocks,stuff->modLocks); CHK_MASK_MATCH(0x01,stuff->affectModLatches,stuff->modLatches); status = Success; oldState= dev->key->xkbInfo->state; newState= &dev->key->xkbInfo->state; if ( stuff->affectModLocks ) { newState->locked_mods&= ~stuff->affectModLocks; newState->locked_mods|= (stuff->affectModLocks&stuff->modLocks); } if (( status == Success ) && stuff->lockGroup ) newState->locked_group = stuff->groupLock; if (( status == Success ) && stuff->affectModLatches ) status=XkbLatchModifiers(dev,stuff->affectModLatches,stuff->modLatches); if (( status == Success ) && stuff->latchGroup ) status=XkbLatchGroup(dev,stuff->groupLatch); if ( status != Success ) return status; XkbComputeDerivedState(dev->key->xkbInfo); dev->key->state= XkbStateFieldFromRec(newState); changed = XkbStateChangedFlags(&oldState,newState); if (changed) { xkbStateNotify sn; sn.keycode= 0; sn.eventType= 0; sn.requestMajor = XkbReqCode; sn.requestMinor = X_kbLatchLockState; sn.changed= changed; XkbSendStateNotify(dev,&sn); changed= XkbIndicatorsToUpdate(dev,changed,False); if (changed) { XkbEventCauseRec cause; XkbSetCauseXkbReq(&cause,X_kbLatchLockState,client); XkbUpdateIndicators(dev,changed,True,NULL,&cause); } } return client->noClientException; } /***====================================================================***/ int ProcXkbGetControls(ClientPtr client) { xkbGetControlsReply rep = {0}; XkbControlsPtr xkb; DeviceIntPtr dev; REQUEST(xkbGetControlsReq); REQUEST_SIZE_MATCH(xkbGetControlsReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); xkb = dev->key->xkbInfo->desc->ctrls; rep.type = X_Reply; rep.length = (SIZEOF(xkbGetControlsReply)- SIZEOF(xGenericReply)) >> 2; rep.sequenceNumber = client->sequence; rep.deviceID = ((DeviceIntPtr)dev)->id; rep.numGroups = xkb->num_groups; rep.groupsWrap = xkb->groups_wrap; rep.internalMods = xkb->internal.mask; rep.ignoreLockMods = xkb->ignore_lock.mask; rep.internalRealMods = xkb->internal.real_mods; rep.ignoreLockRealMods = xkb->ignore_lock.real_mods; rep.internalVMods = xkb->internal.vmods; rep.ignoreLockVMods = xkb->ignore_lock.vmods; rep.enabledCtrls = xkb->enabled_ctrls; rep.repeatDelay = xkb->repeat_delay; rep.repeatInterval = xkb->repeat_interval; rep.slowKeysDelay = xkb->slow_keys_delay; rep.debounceDelay = xkb->debounce_delay; rep.mkDelay = xkb->mk_delay; rep.mkInterval = xkb->mk_interval; rep.mkTimeToMax = xkb->mk_time_to_max; rep.mkMaxSpeed = xkb->mk_max_speed; rep.mkCurve = xkb->mk_curve; rep.mkDfltBtn = xkb->mk_dflt_btn; rep.axTimeout = xkb->ax_timeout; rep.axtCtrlsMask = xkb->axt_ctrls_mask; rep.axtCtrlsValues = xkb->axt_ctrls_values; rep.axtOptsMask = xkb->axt_opts_mask; rep.axtOptsValues = xkb->axt_opts_values; rep.axOptions = xkb->ax_options; memcpy(rep.perKeyRepeat,xkb->per_key_repeat,XkbPerKeyBitArraySize); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.internalVMods); swaps(&rep.ignoreLockVMods); swapl(&rep.enabledCtrls); swaps(&rep.repeatDelay); swaps(&rep.repeatInterval); swaps(&rep.slowKeysDelay); swaps(&rep.debounceDelay); swaps(&rep.mkDelay); swaps(&rep.mkInterval); swaps(&rep.mkTimeToMax); swaps(&rep.mkMaxSpeed); swaps(&rep.mkCurve); swaps(&rep.axTimeout); swapl(&rep.axtCtrlsMask); swapl(&rep.axtCtrlsValues); swaps(&rep.axtOptsMask); swaps(&rep.axtOptsValues); swaps(&rep.axOptions); } WriteToClient(client, SIZEOF(xkbGetControlsReply), &rep); return(client->noClientException); } int ProcXkbSetControls(ClientPtr client) { DeviceIntPtr dev; XkbSrvInfoPtr xkbi; XkbControlsPtr ctrl; XkbControlsRec new,old; xkbControlsNotify cn; XkbEventCauseRec cause; XkbSrvLedInfoPtr sli; REQUEST(xkbSetControlsReq); REQUEST_SIZE_MATCH(xkbSetControlsReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); CHK_MASK_LEGAL(0x01,stuff->changeCtrls,XkbAllControlsMask); xkbi = dev->key->xkbInfo; ctrl = xkbi->desc->ctrls; new = *ctrl; XkbSetCauseXkbReq(&cause,X_kbSetControls,client); if (stuff->changeCtrls&XkbInternalModsMask) { CHK_MASK_MATCH(0x02,stuff->affectInternalMods,stuff->internalMods); CHK_MASK_MATCH(0x03,stuff->affectInternalVMods,stuff->internalVMods); new.internal.real_mods&=~stuff->affectInternalMods; new.internal.real_mods|=(stuff->affectInternalMods&stuff->internalMods); new.internal.vmods&=~stuff->affectInternalVMods; new.internal.vmods|= (stuff->affectInternalVMods&stuff->internalVMods); new.internal.mask= new.internal.real_mods| XkbMaskForVMask(xkbi->desc,new.internal.vmods); } if (stuff->changeCtrls&XkbIgnoreLockModsMask) { CHK_MASK_MATCH(0x4,stuff->affectIgnoreLockMods,stuff->ignoreLockMods); CHK_MASK_MATCH(0x5,stuff->affectIgnoreLockVMods,stuff->ignoreLockVMods); new.ignore_lock.real_mods&=~stuff->affectIgnoreLockMods; new.ignore_lock.real_mods|= (stuff->affectIgnoreLockMods&stuff->ignoreLockMods); new.ignore_lock.vmods&= ~stuff->affectIgnoreLockVMods; new.ignore_lock.vmods|= (stuff->affectIgnoreLockVMods&stuff->ignoreLockVMods); new.ignore_lock.mask= new.ignore_lock.real_mods| XkbMaskForVMask(xkbi->desc,new.ignore_lock.vmods); } CHK_MASK_MATCH(0x06,stuff->affectEnabledCtrls,stuff->enabledCtrls); if (stuff->affectEnabledCtrls) { CHK_MASK_LEGAL(0x07,stuff->affectEnabledCtrls,XkbAllBooleanCtrlsMask); new.enabled_ctrls&= ~stuff->affectEnabledCtrls; new.enabled_ctrls|= (stuff->affectEnabledCtrls&stuff->enabledCtrls); } if (stuff->changeCtrls&XkbRepeatKeysMask) { if ((stuff->repeatDelay<1)||(stuff->repeatInterval<1)) { client->errorValue = _XkbErrCode3(0x08,stuff->repeatDelay, stuff->repeatInterval); return BadValue; } new.repeat_delay = stuff->repeatDelay; new.repeat_interval = stuff->repeatInterval; } if (stuff->changeCtrls&XkbSlowKeysMask) { if (stuff->slowKeysDelay<1) { client->errorValue = _XkbErrCode2(0x09,stuff->slowKeysDelay); return BadValue; } new.slow_keys_delay = stuff->slowKeysDelay; } if (stuff->changeCtrls&XkbBounceKeysMask) { if (stuff->debounceDelay<1) { client->errorValue = _XkbErrCode2(0x0A,stuff->debounceDelay); return BadValue; } new.debounce_delay = stuff->debounceDelay; } if (stuff->changeCtrls&XkbMouseKeysMask) { if (stuff->mkDfltBtn>XkbMaxMouseKeysBtn) { client->errorValue = _XkbErrCode2(0x0B,stuff->mkDfltBtn); return BadValue; } new.mk_dflt_btn = stuff->mkDfltBtn; } if (stuff->changeCtrls&XkbMouseKeysAccelMask) { if ((stuff->mkDelay<1) || (stuff->mkInterval<1) || (stuff->mkTimeToMax<1) || (stuff->mkMaxSpeed<1)|| (stuff->mkCurve<-1000)) { client->errorValue = _XkbErrCode2(0x0C,0); return BadValue; } new.mk_delay = stuff->mkDelay; new.mk_interval = stuff->mkInterval; new.mk_time_to_max = stuff->mkTimeToMax; new.mk_max_speed = stuff->mkMaxSpeed; new.mk_curve = stuff->mkCurve; AccessXComputeCurveFactor(xkbi,&new); } if (stuff->changeCtrls&XkbGroupsWrapMask) { unsigned act,num; act= XkbOutOfRangeGroupAction(stuff->groupsWrap); switch (act) { case XkbRedirectIntoRange: num= XkbOutOfRangeGroupNumber(stuff->groupsWrap); if (num>=new.num_groups) { client->errorValue= _XkbErrCode3(0x0D,new.num_groups,num); return BadValue; } case XkbWrapIntoRange: case XkbClampIntoRange: break; default: client->errorValue= _XkbErrCode2(0x0E,act); return BadValue; } new.groups_wrap= stuff->groupsWrap; } CHK_MASK_LEGAL(0x0F,stuff->axOptions,XkbAX_AllOptionsMask); if (stuff->changeCtrls&XkbAccessXKeysMask) new.ax_options = stuff->axOptions&XkbAX_AllOptionsMask; else { if (stuff->changeCtrls&XkbStickyKeysMask) { new.ax_options&= ~XkbAX_SKOptionsMask; new.ax_options|= stuff->axOptions&XkbAX_SKOptionsMask; } if (stuff->changeCtrls&XkbAccessXFeedbackMask) { new.ax_options&= ~XkbAX_FBOptionsMask; new.ax_options|= stuff->axOptions&XkbAX_FBOptionsMask; } } if (stuff->changeCtrls&XkbAccessXTimeoutMask) { if (stuff->axTimeout<1) { client->errorValue = _XkbErrCode2(0x10,stuff->axTimeout); return BadValue; } CHK_MASK_MATCH(0x11,stuff->axtCtrlsMask,stuff->axtCtrlsValues); CHK_MASK_LEGAL(0x12,stuff->axtCtrlsMask,XkbAllBooleanCtrlsMask); CHK_MASK_MATCH(0x13,stuff->axtOptsMask,stuff->axtOptsValues); CHK_MASK_LEGAL(0x14,stuff->axtOptsMask,XkbAX_AllOptionsMask); new.ax_timeout = stuff->axTimeout; new.axt_ctrls_mask = stuff->axtCtrlsMask; new.axt_ctrls_values = (stuff->axtCtrlsValues&stuff->axtCtrlsMask); new.axt_opts_mask = stuff->axtOptsMask; new.axt_opts_values= (stuff->axtOptsValues&stuff->axtOptsMask); } if (stuff->changeCtrls&XkbPerKeyRepeatMask) { memcpy(new.per_key_repeat,stuff->perKeyRepeat,XkbPerKeyBitArraySize); } old= *ctrl; *ctrl= new; XkbDDXChangeControls(dev,&old,ctrl); if (XkbComputeControlsNotify(dev,&old,ctrl,&cn,False)) { cn.keycode= 0; cn.eventType = 0; cn.requestMajor = XkbReqCode; cn.requestMinor = X_kbSetControls; XkbSendControlsNotify(dev,&cn); } if ((sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0))!=NULL) XkbUpdateIndicators(dev,sli->usesControls,True,NULL,&cause); #ifndef NO_CLEAR_LATCHES_FOR_STICKY_KEYS_OFF /* If sticky keys were disabled, clear all locks and latches */ if ((old.enabled_ctrls&XkbStickyKeysMask)&& (!(ctrl->enabled_ctrls&XkbStickyKeysMask))) { XkbClearAllLatchesAndLocks(dev,xkbi,True,&cause); } #endif return client->noClientException; } /***====================================================================***/ static int XkbSizeKeyTypes(XkbDescPtr xkb,xkbGetMapReply *rep) { XkbKeyTypeRec *type; unsigned i,len; len= 0; if (((rep->present&XkbKeyTypesMask)==0)||(rep->nTypes<1)|| (!xkb)||(!xkb->map)||(!xkb->map->types)) { rep->present&= ~XkbKeyTypesMask; rep->firstType= rep->nTypes= 0; return 0; } type= &xkb->map->types[rep->firstType]; for (i=0;inTypes;i++,type++){ len+= SIZEOF(xkbKeyTypeWireDesc); if (type->map_count>0) { len+= (type->map_count*SIZEOF(xkbKTMapEntryWireDesc)); if (type->preserve) len+= (type->map_count*SIZEOF(xkbModsWireDesc)); } } return len; } static char * XkbWriteKeyTypes( XkbDescPtr xkb, xkbGetMapReply * rep, char * buf, ClientPtr client) { XkbKeyTypePtr type; unsigned i; xkbKeyTypeWireDesc *wire; type= &xkb->map->types[rep->firstType]; for (i=0;inTypes;i++,type++) { register unsigned n; wire= (xkbKeyTypeWireDesc *)buf; wire->mask = type->mods.mask; wire->realMods = type->mods.real_mods; wire->virtualMods = type->mods.vmods; wire->numLevels = type->num_levels; wire->nMapEntries = type->map_count; wire->preserve = (type->preserve!=NULL); if (client->swapped) { swaps(&wire->virtualMods); } buf= (char *)&wire[1]; if (wire->nMapEntries>0) { xkbKTMapEntryWireDesc * ewire; XkbKTMapEntryPtr entry; ewire= (xkbKTMapEntryWireDesc *)buf; entry= type->map; for (n=0;nmap_count;n++,ewire++,entry++) { ewire->active= entry->active; ewire->mask= entry->mods.mask; ewire->level= entry->level; ewire->realMods= entry->mods.real_mods; ewire->virtualMods= entry->mods.vmods; if (client->swapped) { swaps(&ewire->virtualMods); } } buf= (char *)ewire; if (type->preserve!=NULL) { xkbModsWireDesc * pwire; XkbModsPtr preserve; pwire= (xkbModsWireDesc *)buf; preserve= type->preserve; for (n=0;nmap_count;n++,pwire++,preserve++) { pwire->mask= preserve->mask; pwire->realMods= preserve->real_mods; pwire->virtualMods= preserve->vmods; if (client->swapped) { swaps(&pwire->virtualMods); } } buf= (char *)pwire; } } } return buf; } static int XkbSizeKeySyms(XkbDescPtr xkb,xkbGetMapReply *rep) { XkbSymMapPtr symMap; unsigned i,len; unsigned nSyms,nSymsThisKey; if (((rep->present&XkbKeySymsMask)==0)||(rep->nKeySyms<1)|| (!xkb)||(!xkb->map)||(!xkb->map->key_sym_map)) { rep->present&= ~XkbKeySymsMask; rep->firstKeySym= rep->nKeySyms= 0; rep->totalSyms= 0; return 0; } len= rep->nKeySyms*SIZEOF(xkbSymMapWireDesc); symMap = &xkb->map->key_sym_map[rep->firstKeySym]; for (i=nSyms=0;inKeySyms;i++,symMap++) { if (symMap->offset!=0) { nSymsThisKey= XkbNumGroups(symMap->group_info)*symMap->width; nSyms+= nSymsThisKey; } } len+= nSyms*4; rep->totalSyms= nSyms; return len; } static int XkbSizeVirtualMods(XkbDescPtr xkb,xkbGetMapReply *rep) { register unsigned i,nMods,bit; if (((rep->present&XkbVirtualModsMask)==0)||(rep->virtualMods==0)|| (!xkb)||(!xkb->server)) { rep->present&= ~XkbVirtualModsMask; rep->virtualMods= 0; return 0; } for (i=nMods=0,bit=1;ivirtualMods&bit) nMods++; } return XkbPaddedSize(nMods); } static char * XkbWriteKeySyms(XkbDescPtr xkb,xkbGetMapReply *rep,char *buf,ClientPtr client) { register KeySym * pSym; XkbSymMapPtr symMap; xkbSymMapWireDesc * outMap; register unsigned i; symMap = &xkb->map->key_sym_map[rep->firstKeySym]; for (i=0;inKeySyms;i++,symMap++) { outMap = (xkbSymMapWireDesc *)buf; outMap->ktIndex[0] = symMap->kt_index[0]; outMap->ktIndex[1] = symMap->kt_index[1]; outMap->ktIndex[2] = symMap->kt_index[2]; outMap->ktIndex[3] = symMap->kt_index[3]; outMap->groupInfo = symMap->group_info; outMap->width= symMap->width; outMap->nSyms = symMap->width*XkbNumGroups(symMap->group_info); buf= (char *)&outMap[1]; if (outMap->nSyms==0) continue; pSym = &xkb->map->syms[symMap->offset]; memcpy((char *)buf,(char *)pSym,outMap->nSyms*4); if (client->swapped) { register int nSyms= outMap->nSyms; swaps(&outMap->nSyms); while (nSyms-->0) { swapl((int *)buf); buf+= 4; } } else buf+= outMap->nSyms*4; } return buf; } static int XkbSizeKeyActions(XkbDescPtr xkb,xkbGetMapReply *rep) { unsigned i,len,nActs; register KeyCode firstKey; if (((rep->present&XkbKeyActionsMask)==0)||(rep->nKeyActs<1)|| (!xkb)||(!xkb->server)||(!xkb->server->key_acts)) { rep->present&= ~XkbKeyActionsMask; rep->firstKeyAct= rep->nKeyActs= 0; rep->totalActs= 0; return 0; } firstKey= rep->firstKeyAct; for (nActs=i=0;inKeyActs;i++) { if (xkb->server->key_acts[i+firstKey]!=0) nActs+= XkbKeyNumActions(xkb,i+firstKey); } len= XkbPaddedSize(rep->nKeyActs)+(nActs*SIZEOF(xkbActionWireDesc)); rep->totalActs= nActs; return len; } static char * XkbWriteKeyActions(XkbDescPtr xkb,xkbGetMapReply *rep,char *buf, ClientPtr client) { unsigned i; CARD8 * numDesc; XkbAnyAction * actDesc; numDesc = (CARD8 *)buf; for (i=0;inKeyActs;i++) { if (xkb->server->key_acts[i+rep->firstKeyAct]==0) numDesc[i] = 0; else numDesc[i] = XkbKeyNumActions(xkb,(i+rep->firstKeyAct)); } buf+= XkbPaddedSize(rep->nKeyActs); actDesc = (XkbAnyAction *)buf; for (i=0;inKeyActs;i++) { if (xkb->server->key_acts[i+rep->firstKeyAct]!=0) { unsigned int num; num = XkbKeyNumActions(xkb,(i+rep->firstKeyAct)); memcpy((char *)actDesc, (char*)XkbKeyActionsPtr(xkb,(i+rep->firstKeyAct)), num*SIZEOF(xkbActionWireDesc)); actDesc+= num; } } buf = (char *)actDesc; return buf; } static int XkbSizeKeyBehaviors(XkbDescPtr xkb,xkbGetMapReply *rep) { unsigned i,len,nBhvr; XkbBehavior * bhv; if (((rep->present&XkbKeyBehaviorsMask)==0)||(rep->nKeyBehaviors<1)|| (!xkb)||(!xkb->server)||(!xkb->server->behaviors)) { rep->present&= ~XkbKeyBehaviorsMask; rep->firstKeyBehavior= rep->nKeyBehaviors= 0; rep->totalKeyBehaviors= 0; return 0; } bhv= &xkb->server->behaviors[rep->firstKeyBehavior]; for (nBhvr=i=0;inKeyBehaviors;i++,bhv++) { if (bhv->type!=XkbKB_Default) nBhvr++; } len= nBhvr*SIZEOF(xkbBehaviorWireDesc); rep->totalKeyBehaviors= nBhvr; return len; } static char * XkbWriteKeyBehaviors(XkbDescPtr xkb,xkbGetMapReply *rep,char *buf, ClientPtr client) { unsigned i; xkbBehaviorWireDesc *wire; XkbBehavior *pBhvr; wire = (xkbBehaviorWireDesc *)buf; pBhvr= &xkb->server->behaviors[rep->firstKeyBehavior]; for (i=0;inKeyBehaviors;i++,pBhvr++) { if (pBhvr->type!=XkbKB_Default) { wire->key= i+rep->firstKeyBehavior; wire->type= pBhvr->type; wire->data= pBhvr->data; wire++; } } buf = (char *)wire; return buf; } static int XkbSizeExplicit(XkbDescPtr xkb,xkbGetMapReply *rep) { unsigned i,len,nRtrn; if (((rep->present&XkbExplicitComponentsMask)==0)||(rep->nKeyExplicit<1)|| (!xkb)||(!xkb->server)||(!xkb->server->explicit)) { rep->present&= ~XkbExplicitComponentsMask; rep->firstKeyExplicit= rep->nKeyExplicit= 0; rep->totalKeyExplicit= 0; return 0; } for (nRtrn=i=0;inKeyExplicit;i++) { if (xkb->server->explicit[i+rep->firstKeyExplicit]!=0) nRtrn++; } rep->totalKeyExplicit= nRtrn; len= XkbPaddedSize(nRtrn*2); /* two bytes per non-zero explicit component */ return len; } static char * XkbWriteExplicit(XkbDescPtr xkb,xkbGetMapReply *rep,char *buf,ClientPtr client) { unsigned i; char * start; unsigned char * pExp; start= buf; pExp= &xkb->server->explicit[rep->firstKeyExplicit]; for (i=0;inKeyExplicit;i++,pExp++) { if (*pExp!=0) { *buf++= i+rep->firstKeyExplicit; *buf++= *pExp; } } i= XkbPaddedSize(buf-start)-(buf-start); /* pad to word boundary */ return buf+i; } static int XkbSizeModifierMap(XkbDescPtr xkb,xkbGetMapReply *rep) { unsigned i,len,nRtrn; if (((rep->present&XkbModifierMapMask)==0)||(rep->nModMapKeys<1)|| (!xkb)||(!xkb->map)||(!xkb->map->modmap)) { rep->present&= ~XkbModifierMapMask; rep->firstModMapKey= rep->nModMapKeys= 0; rep->totalModMapKeys= 0; return 0; } for (nRtrn=i=0;inModMapKeys;i++) { if (xkb->map->modmap[i+rep->firstModMapKey]!=0) nRtrn++; } rep->totalModMapKeys= nRtrn; len= XkbPaddedSize(nRtrn*2); /* two bytes per non-zero modmap component */ return len; } static char * XkbWriteModifierMap(XkbDescPtr xkb,xkbGetMapReply *rep,char *buf, ClientPtr client) { unsigned i; char * start; unsigned char * pMap; start= buf; pMap= &xkb->map->modmap[rep->firstModMapKey]; for (i=0;inModMapKeys;i++,pMap++) { if (*pMap!=0) { *buf++= i+rep->firstModMapKey; *buf++= *pMap; } } i= XkbPaddedSize(buf-start)-(buf-start); /* pad to word boundary */ return buf+i; } static int XkbSizeVirtualModMap(XkbDescPtr xkb,xkbGetMapReply *rep) { unsigned i,len,nRtrn; if (((rep->present&XkbVirtualModMapMask)==0)||(rep->nVModMapKeys<1)|| (!xkb)||(!xkb->server)||(!xkb->server->vmodmap)) { rep->present&= ~XkbVirtualModMapMask; rep->firstVModMapKey= rep->nVModMapKeys= 0; rep->totalVModMapKeys= 0; return 0; } for (nRtrn=i=0;inVModMapKeys;i++) { if (xkb->server->vmodmap[i+rep->firstVModMapKey]!=0) nRtrn++; } rep->totalVModMapKeys= nRtrn; len= nRtrn*SIZEOF(xkbVModMapWireDesc); return len; } static char * XkbWriteVirtualModMap(XkbDescPtr xkb,xkbGetMapReply *rep,char *buf, ClientPtr client) { unsigned i; xkbVModMapWireDesc * wire; unsigned short * pMap; wire= (xkbVModMapWireDesc *)buf; pMap= &xkb->server->vmodmap[rep->firstVModMapKey]; for (i=0;inVModMapKeys;i++,pMap++) { if (*pMap!=0) { wire->key= i+rep->firstVModMapKey; wire->vmods= *pMap; wire++; } } return (char *)wire; } static Status XkbComputeGetMapReplySize(XkbDescPtr xkb,xkbGetMapReply *rep) { int len; rep->minKeyCode= xkb->min_key_code; rep->maxKeyCode= xkb->max_key_code; len= XkbSizeKeyTypes(xkb,rep); len+= XkbSizeKeySyms(xkb,rep); len+= XkbSizeKeyActions(xkb,rep); len+= XkbSizeKeyBehaviors(xkb,rep); len+= XkbSizeVirtualMods(xkb,rep); len+= XkbSizeExplicit(xkb,rep); len+= XkbSizeModifierMap(xkb,rep); len+= XkbSizeVirtualModMap(xkb,rep); rep->length+= (len/4); return Success; } static int XkbSendMap(ClientPtr client,XkbDescPtr xkb,xkbGetMapReply *rep) { unsigned i,len; char *desc,*start; len= (rep->length*4)-(SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply)); start= desc= (char *)malloc(len); if (!start) return BadAlloc; memset(start, 0, len); if ( rep->nTypes>0 ) desc = XkbWriteKeyTypes(xkb,rep,desc,client); if ( rep->nKeySyms>0 ) desc = XkbWriteKeySyms(xkb,rep,desc,client); if ( rep->nKeyActs>0 ) desc = XkbWriteKeyActions(xkb,rep,desc,client); if ( rep->totalKeyBehaviors>0 ) desc = XkbWriteKeyBehaviors(xkb,rep,desc,client); if ( rep->virtualMods ) { register int sz,bit; for (i=sz=0,bit=1;ivirtualMods&bit) { desc[sz++]= xkb->server->vmods[i]; } } desc+= XkbPaddedSize(sz); } if ( rep->totalKeyExplicit>0 ) desc= XkbWriteExplicit(xkb,rep,desc,client); if ( rep->totalModMapKeys>0 ) desc= XkbWriteModifierMap(xkb,rep,desc,client); if ( rep->totalVModMapKeys>0 ) desc= XkbWriteVirtualModMap(xkb,rep,desc,client); if ((desc-start)!=(len)) { ErrorF("BOGUS LENGTH in write keyboard desc, expected %d, got %ld\n", len, (unsigned long)(desc-start)); } if (client->swapped) { swaps(&rep->sequenceNumber); swapl(&rep->length); swaps(&rep->present); swaps(&rep->totalSyms); swaps(&rep->totalActs); } WriteToClient(client, (i=SIZEOF(xkbGetMapReply)), rep); WriteToClient(client, len, start); free((char *)start); return client->noClientException; } int ProcXkbGetMap(ClientPtr client) { DeviceIntPtr dev; xkbGetMapReply rep = {0}; XkbDescRec *xkb; int n,status; REQUEST(xkbGetMapReq); REQUEST_SIZE_MATCH(xkbGetMapReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); CHK_MASK_OVERLAP(0x01,stuff->full,stuff->partial); CHK_MASK_LEGAL(0x02,stuff->full,XkbAllMapComponentsMask); CHK_MASK_LEGAL(0x03,stuff->partial,XkbAllMapComponentsMask); xkb= dev->key->xkbInfo->desc; rep.type= X_Reply; rep.sequenceNumber= client->sequence; rep.length = (SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply))>>2; rep.deviceID = dev->id; rep.present = stuff->partial|stuff->full; rep.minKeyCode = xkb->min_key_code; rep.maxKeyCode = xkb->max_key_code; if ( stuff->full&XkbKeyTypesMask ) { rep.firstType = 0; rep.nTypes = xkb->map->num_types; } else if (stuff->partial&XkbKeyTypesMask) { if (((unsigned)stuff->firstType+stuff->nTypes)>xkb->map->num_types) { client->errorValue = _XkbErrCode4(0x04,xkb->map->num_types, stuff->firstType,stuff->nTypes); return BadValue; } rep.firstType = stuff->firstType; rep.nTypes = stuff->nTypes; } else rep.nTypes = 0; rep.totalTypes = xkb->map->num_types; n= XkbNumKeys(xkb); if ( stuff->full&XkbKeySymsMask ) { rep.firstKeySym = xkb->min_key_code; rep.nKeySyms = n; } else if (stuff->partial&XkbKeySymsMask) { CHK_KEY_RANGE(0x05,stuff->firstKeySym,stuff->nKeySyms,xkb); rep.firstKeySym = stuff->firstKeySym; rep.nKeySyms = stuff->nKeySyms; } else rep.nKeySyms = 0; rep.totalSyms= 0; if ( stuff->full&XkbKeyActionsMask ) { rep.firstKeyAct= xkb->min_key_code; rep.nKeyActs= n; } else if (stuff->partial&XkbKeyActionsMask) { CHK_KEY_RANGE(0x07,stuff->firstKeyAct,stuff->nKeyActs,xkb); rep.firstKeyAct= stuff->firstKeyAct; rep.nKeyActs= stuff->nKeyActs; } else rep.nKeyActs= 0; rep.totalActs= 0; if ( stuff->full&XkbKeyBehaviorsMask ) { rep.firstKeyBehavior = xkb->min_key_code; rep.nKeyBehaviors = n; } else if (stuff->partial&XkbKeyBehaviorsMask) { CHK_KEY_RANGE(0x09,stuff->firstKeyBehavior,stuff->nKeyBehaviors,xkb); rep.firstKeyBehavior= stuff->firstKeyBehavior; rep.nKeyBehaviors= stuff->nKeyBehaviors; } else rep.nKeyBehaviors = 0; rep.totalKeyBehaviors= 0; if (stuff->full&XkbVirtualModsMask) rep.virtualMods= ~0; else if (stuff->partial&XkbVirtualModsMask) rep.virtualMods= stuff->virtualMods; if (stuff->full&XkbExplicitComponentsMask) { rep.firstKeyExplicit= xkb->min_key_code; rep.nKeyExplicit= n; } else if (stuff->partial&XkbExplicitComponentsMask) { CHK_KEY_RANGE(0x0B,stuff->firstKeyExplicit,stuff->nKeyExplicit,xkb); rep.firstKeyExplicit= stuff->firstKeyExplicit; rep.nKeyExplicit= stuff->nKeyExplicit; } else rep.nKeyExplicit = 0; rep.totalKeyExplicit= 0; if (stuff->full&XkbModifierMapMask) { rep.firstModMapKey= xkb->min_key_code; rep.nModMapKeys= n; } else if (stuff->partial&XkbModifierMapMask) { CHK_KEY_RANGE(0x0D,stuff->firstModMapKey,stuff->nModMapKeys,xkb); rep.firstModMapKey= stuff->firstModMapKey; rep.nModMapKeys= stuff->nModMapKeys; } else rep.nModMapKeys = 0; rep.totalModMapKeys= 0; if (stuff->full&XkbVirtualModMapMask) { rep.firstVModMapKey= xkb->min_key_code; rep.nVModMapKeys= n; } else if (stuff->partial&XkbVirtualModMapMask) { CHK_KEY_RANGE(0x0F,stuff->firstVModMapKey,stuff->nVModMapKeys,xkb); rep.firstVModMapKey= stuff->firstVModMapKey; rep.nVModMapKeys= stuff->nVModMapKeys; } else rep.nVModMapKeys = 0; rep.totalVModMapKeys= 0; if ((status=XkbComputeGetMapReplySize(xkb,&rep))!=Success) return status; return XkbSendMap(client,xkb,&rep); } /***====================================================================***/ static int CheckKeyTypes( ClientPtr client, XkbDescPtr xkb, xkbSetMapReq * req, xkbKeyTypeWireDesc **wireRtrn, int * nMapsRtrn, CARD8 * mapWidthRtrn) { unsigned nMaps; register unsigned i,n; register CARD8 * map; register xkbKeyTypeWireDesc *wire = *wireRtrn; if (req->firstType>((unsigned)xkb->map->num_types)) { *nMapsRtrn = _XkbErrCode3(0x01,req->firstType,xkb->map->num_types); return 0; } if (req->flags&XkbSetMapResizeTypes) { nMaps = req->firstType+req->nTypes; if (nMapsfirstType,req->nTypes,4); return 0; } } else if (req->present&XkbKeyTypesMask) { nMaps = xkb->map->num_types; if ((req->firstType+req->nTypes)>nMaps) { *nMapsRtrn = req->firstType+req->nTypes; return 0; } } else { *nMapsRtrn = xkb->map->num_types; for (i=0;imap->num_types;i++) { mapWidthRtrn[i] = xkb->map->types[i].num_levels; } return 1; } for (i=0;ifirstType;i++) { mapWidthRtrn[i] = xkb->map->types[i].num_levels; } for (i=0;inTypes;i++) { unsigned width; if (client->swapped) { swaps(&wire->virtualMods); } n= i+req->firstType; width= wire->numLevels; if (width<1) { *nMapsRtrn= _XkbErrCode3(0x04,n,width); return 0; } else if ((n==XkbOneLevelIndex)&&(width!=1)) { /* must be width 1 */ *nMapsRtrn= _XkbErrCode3(0x05,n,width); return 0; } else if ((width!=2)&& ((n==XkbTwoLevelIndex)||(n==XkbKeypadIndex)|| (n==XkbAlphabeticIndex))) { /* TWO_LEVEL, ALPHABETIC and KEYPAD must be width 2 */ *nMapsRtrn= _XkbErrCode3(0x05,n,width); return 0; } if (wire->nMapEntries>0) { xkbKTSetMapEntryWireDesc * mapWire; xkbModsWireDesc * preWire; mapWire= (xkbKTSetMapEntryWireDesc *)&wire[1]; preWire= (xkbModsWireDesc *)&mapWire[wire->nMapEntries]; for (n=0;nnMapEntries;n++) { if (client->swapped) { swaps(&mapWire[n].virtualMods); } if (mapWire[n].realMods&(~wire->realMods)) { *nMapsRtrn= _XkbErrCode4(0x06,n,mapWire[n].realMods, wire->realMods); return 0; } if (mapWire[n].virtualMods&(~wire->virtualMods)) { *nMapsRtrn= _XkbErrCode3(0x07,n,mapWire[n].virtualMods); return 0; } if (mapWire[n].level>=wire->numLevels) { *nMapsRtrn= _XkbErrCode4(0x08,n,wire->numLevels, mapWire[n].level); return 0; } if (wire->preserve) { if (client->swapped) { swaps(&preWire[n].virtualMods); } if (preWire[n].realMods&(~mapWire[n].realMods)) { *nMapsRtrn= _XkbErrCode4(0x09,n,preWire[n].realMods, mapWire[n].realMods); return 0; } if (preWire[n].virtualMods&(~mapWire[n].virtualMods)) { *nMapsRtrn=_XkbErrCode3(0x0a,n,preWire[n].virtualMods); return 0; } } } if (wire->preserve) map= (CARD8 *)&preWire[wire->nMapEntries]; else map= (CARD8 *)&mapWire[wire->nMapEntries]; } else map= (CARD8 *)&wire[1]; mapWidthRtrn[i+req->firstType] = wire->numLevels; wire= (xkbKeyTypeWireDesc *)map; } for (i=req->firstType+req->nTypes;imap->types[i].num_levels; } *nMapsRtrn = nMaps; *wireRtrn = wire; return 1; } static int CheckKeySyms( ClientPtr client, XkbDescPtr xkb, xkbSetMapReq * req, int nTypes, CARD8 * mapWidths, CARD16 * symsPerKey, xkbSymMapWireDesc ** wireRtrn, int * errorRtrn) { register unsigned i; XkbSymMapPtr map; xkbSymMapWireDesc* wire = *wireRtrn; if (!(XkbKeySymsMask&req->present)) return 1; CHK_REQ_KEY_RANGE2(0x11,req->firstKeySym,req->nKeySyms,req,(*errorRtrn),0); map = &xkb->map->key_sym_map[xkb->min_key_code]; for (i=xkb->min_key_code;i<(unsigned)req->firstKeySym;i++,map++) { register int g,ng,w; ng= XkbNumGroups(map->group_info); for (w=g=0;gkt_index[g]>=(unsigned)nTypes) { *errorRtrn = _XkbErrCode4(0x13,i,g,map->kt_index[g]); return 0; } if (mapWidths[map->kt_index[g]]>w) w= mapWidths[map->kt_index[g]]; } symsPerKey[i] = w*ng; } for (i=0;inKeySyms;i++) { KeySym *pSyms; register unsigned nG; if (client->swapped) { swaps(&wire->nSyms); } nG = XkbNumGroups(wire->groupInfo); if (nG>XkbNumKbdGroups) { *errorRtrn = _XkbErrCode3(0x14,i+req->firstKeySym,nG); return 0; } if (nG>0) { register int g,w; for (g=w=0;gktIndex[g]>=(unsigned)nTypes) { *errorRtrn= _XkbErrCode4(0x15,i+req->firstKeySym,g, wire->ktIndex[g]); return 0; } if (mapWidths[wire->ktIndex[g]]>w) w= mapWidths[wire->ktIndex[g]]; } if (wire->width!=w) { *errorRtrn= _XkbErrCode3(0x16,i+req->firstKeySym,wire->width); return 0; } w*= nG; symsPerKey[i+req->firstKeySym] = w; if (w!=wire->nSyms) { *errorRtrn=_XkbErrCode4(0x16,i+req->firstKeySym,wire->nSyms,w); return 0; } } else if (wire->nSyms!=0) { *errorRtrn = _XkbErrCode3(0x17,i+req->firstKeySym,wire->nSyms); return 0; } pSyms = (KeySym *)&wire[1]; wire = (xkbSymMapWireDesc *)&pSyms[wire->nSyms]; } map = &xkb->map->key_sym_map[i]; for (;i<=(unsigned)xkb->max_key_code;i++,map++) { register int g,nG,w; nG= XkbKeyNumGroups(xkb,i); for (w=g=0;gkt_index[g]>=(unsigned)nTypes) { *errorRtrn = _XkbErrCode4(0x18,i,g,map->kt_index[g]); return 0; } if (mapWidths[map->kt_index[g]]>w) w= mapWidths[map->kt_index[g]]; } symsPerKey[i] = w*nG; } *wireRtrn = wire; return 1; } static int CheckKeyActions( XkbDescPtr xkb, xkbSetMapReq * req, int nTypes, CARD8 * mapWidths, CARD16 * symsPerKey, CARD8 ** wireRtrn, int * nActsRtrn) { int nActs; CARD8 * wire = *wireRtrn; register unsigned i; if (!(XkbKeyActionsMask&req->present)) return 1; CHK_REQ_KEY_RANGE2(0x21,req->firstKeyAct,req->nKeyActs,req,(*nActsRtrn),0); for (nActs=i=0;inKeyActs;i++) { if (wire[0]!=0) { if (wire[0]==symsPerKey[i+req->firstKeyAct]) nActs+= wire[0]; else { *nActsRtrn= _XkbErrCode3(0x23,i+req->firstKeyAct,wire[0]); return 0; } } wire++; } if (req->nKeyActs%4) wire+= 4-(req->nKeyActs%4); *wireRtrn = (CARD8 *)(((XkbAnyAction *)wire)+nActs); *nActsRtrn = nActs; return 1; } static int CheckKeyBehaviors( XkbDescPtr xkb, xkbSetMapReq * req, xkbBehaviorWireDesc ** wireRtrn, int * errorRtrn) { register xkbBehaviorWireDesc * wire = *wireRtrn; register XkbServerMapPtr server = xkb->server; register unsigned i; unsigned first,last; if (((req->present&XkbKeyBehaviorsMask)==0)||(req->nKeyBehaviors<1)) { req->present&= ~XkbKeyBehaviorsMask; req->nKeyBehaviors= 0; return 1; } first= req->firstKeyBehavior; last= req->firstKeyBehavior+req->nKeyBehaviors-1; if (firstminKeyCode) { *errorRtrn = _XkbErrCode3(0x31,first,req->minKeyCode); return 0; } if (last>req->maxKeyCode) { *errorRtrn = _XkbErrCode3(0x32,last,req->maxKeyCode); return 0; } for (i=0;itotalKeyBehaviors;i++,wire++) { if ((wire->keykey>last)) { *errorRtrn = _XkbErrCode4(0x33,first,last,wire->key); return 0; } if ((wire->type&XkbKB_Permanent)&& ((server->behaviors[wire->key].type!=wire->type)|| (server->behaviors[wire->key].data!=wire->data))) { *errorRtrn = _XkbErrCode3(0x33,wire->key,wire->type); return 0; } if ((wire->type==XkbKB_RadioGroup)&& ((wire->data&(~XkbKB_RGAllowNone))>XkbMaxRadioGroups)) { *errorRtrn= _XkbErrCode4(0x34,wire->key,wire->data, XkbMaxRadioGroups); return 0; } if ((wire->type==XkbKB_Overlay1)||(wire->type==XkbKB_Overlay2)) { CHK_KEY_RANGE2(0x35,wire->key,1,xkb,*errorRtrn,0); } } *wireRtrn = wire; return 1; } static int CheckVirtualMods( XkbDescRec * xkb, xkbSetMapReq * req, CARD8 ** wireRtrn, int * errorRtrn) { register CARD8 *wire = *wireRtrn; register unsigned i,nMods,bit; if (((req->present&XkbVirtualModsMask)==0)||(req->virtualMods==0)) return 1; for (i=nMods=0,bit=1;ivirtualMods&bit) nMods++; } *wireRtrn= (wire+XkbPaddedSize(nMods)); return 1; } static int CheckKeyExplicit( XkbDescPtr xkb, xkbSetMapReq * req, CARD8 ** wireRtrn, int * errorRtrn) { register CARD8 * wire = *wireRtrn; CARD8 * start; register unsigned i; int first,last; if (((req->present&XkbExplicitComponentsMask)==0)||(req->nKeyExplicit<1)) { req->present&= ~XkbExplicitComponentsMask; req->nKeyExplicit= 0; return 1; } first= req->firstKeyExplicit; last= first+req->nKeyExplicit-1; if (firstminKeyCode) { *errorRtrn = _XkbErrCode3(0x51,first,req->minKeyCode); return 0; } if (last>req->maxKeyCode) { *errorRtrn = _XkbErrCode3(0x52,last,req->maxKeyCode); return 0; } start= wire; for (i=0;itotalKeyExplicit;i++,wire+=2) { if ((wire[0]last)) { *errorRtrn = _XkbErrCode4(0x53,first,last,wire[0]); return 0; } if (wire[1]&(~XkbAllExplicitMask)) { *errorRtrn= _XkbErrCode3(0x52,~XkbAllExplicitMask,wire[1]); return 0; } } wire+= XkbPaddedSize(wire-start)-(wire-start); *wireRtrn= wire; return 1; } static int CheckModifierMap(XkbDescPtr xkb,xkbSetMapReq *req,CARD8 **wireRtrn,int *errRtrn) { register CARD8 * wire = *wireRtrn; CARD8 * start; register unsigned i; int first,last; if (((req->present&XkbModifierMapMask)==0)||(req->nModMapKeys<1)) { req->present&= ~XkbModifierMapMask; req->nModMapKeys= 0; return 1; } first= req->firstModMapKey; last= first+req->nModMapKeys-1; if (firstminKeyCode) { *errRtrn = _XkbErrCode3(0x61,first,req->minKeyCode); return 0; } if (last>req->maxKeyCode) { *errRtrn = _XkbErrCode3(0x62,last,req->maxKeyCode); return 0; } start= wire; for (i=0;itotalModMapKeys;i++,wire+=2) { if ((wire[0]last)) { *errRtrn = _XkbErrCode4(0x63,first,last,wire[0]); return 0; } } wire+= XkbPaddedSize(wire-start)-(wire-start); *wireRtrn= wire; return 1; } static int CheckVirtualModMap( XkbDescPtr xkb, xkbSetMapReq *req, xkbVModMapWireDesc **wireRtrn, int *errRtrn) { register xkbVModMapWireDesc * wire = *wireRtrn; register unsigned i; int first,last; if (((req->present&XkbVirtualModMapMask)==0)||(req->nVModMapKeys<1)) { req->present&= ~XkbVirtualModMapMask; req->nVModMapKeys= 0; return 1; } first= req->firstVModMapKey; last= first+req->nVModMapKeys-1; if (firstminKeyCode) { *errRtrn = _XkbErrCode3(0x71,first,req->minKeyCode); return 0; } if (last>req->maxKeyCode) { *errRtrn = _XkbErrCode3(0x72,last,req->maxKeyCode); return 0; } for (i=0;itotalVModMapKeys;i++,wire++) { if ((wire->keykey>last)) { *errRtrn = _XkbErrCode4(0x73,first,last,wire->key); return 0; } } *wireRtrn= wire; return 1; } static char * SetKeyTypes( XkbDescPtr xkb, xkbSetMapReq * req, xkbKeyTypeWireDesc * wire, XkbChangesPtr changes) { register unsigned i; unsigned first,last; CARD8 *map; if ((unsigned)(req->firstType+req->nTypes)>xkb->map->size_types) { i= req->firstType+req->nTypes; if (XkbAllocClientMap(xkb,XkbKeyTypesMask,i)!=Success) { return NULL; } } if ((unsigned)(req->firstType+req->nTypes)>xkb->map->num_types) xkb->map->num_types= req->firstType+req->nTypes; for (i=0;inTypes;i++) { XkbKeyTypePtr pOld; register unsigned n; if (XkbResizeKeyType(xkb,i+req->firstType,wire->nMapEntries, wire->preserve,wire->numLevels)!=Success) { return NULL; } pOld = &xkb->map->types[i+req->firstType]; map = (CARD8 *)&wire[1]; pOld->mods.real_mods = wire->realMods; pOld->mods.vmods= wire->virtualMods; pOld->num_levels = wire->numLevels; pOld->map_count= wire->nMapEntries; pOld->mods.mask= pOld->mods.real_mods| XkbMaskForVMask(xkb,pOld->mods.vmods); if (wire->nMapEntries) { xkbKTSetMapEntryWireDesc *mapWire; xkbModsWireDesc *preWire; unsigned tmp; mapWire= (xkbKTSetMapEntryWireDesc *)map; preWire= (xkbModsWireDesc *)&mapWire[wire->nMapEntries]; for (n=0;nnMapEntries;n++) { pOld->map[n].active= 1; pOld->map[n].mods.mask= mapWire[n].realMods; pOld->map[n].mods.real_mods= mapWire[n].realMods; pOld->map[n].mods.vmods= mapWire[n].virtualMods; pOld->map[n].level= mapWire[n].level; if (mapWire[n].virtualMods!=0) { tmp= XkbMaskForVMask(xkb,mapWire[n].virtualMods); pOld->map[n].active= (tmp!=0); pOld->map[n].mods.mask|= tmp; } if (wire->preserve) { pOld->preserve[n].real_mods= preWire[n].realMods; pOld->preserve[n].vmods= preWire[n].virtualMods; tmp= XkbMaskForVMask(xkb,preWire[n].virtualMods); pOld->preserve[n].mask= preWire[n].realMods|tmp; } } if (wire->preserve) map= (CARD8 *)&preWire[wire->nMapEntries]; else map= (CARD8 *)&mapWire[wire->nMapEntries]; } else map= (CARD8 *)&wire[1]; wire = (xkbKeyTypeWireDesc *)map; } first= req->firstType; last= first+req->nTypes-1; /* last changed type */ if (changes->map.changed&XkbKeyTypesMask) { int oldLast; oldLast= changes->map.first_type+changes->map.num_types-1; if (changes->map.first_typemap.first_type; if (oldLast>last) last= oldLast; } changes->map.changed|= XkbKeyTypesMask; changes->map.first_type = first; changes->map.num_types = (last-first)+1; return (char *)wire; } static char * SetKeySyms( ClientPtr client, XkbDescPtr xkb, xkbSetMapReq * req, xkbSymMapWireDesc * wire, XkbChangesPtr changes, DeviceIntPtr dev) { register unsigned i,s; XkbSymMapPtr oldMap; KeySym * newSyms; KeySym * pSyms; unsigned first,last; oldMap = &xkb->map->key_sym_map[req->firstKeySym]; for (i=0;inKeySyms;i++,oldMap++) { pSyms = (KeySym *)&wire[1]; if (wire->nSyms>0) { newSyms = XkbResizeKeySyms(xkb,i+req->firstKeySym,wire->nSyms); for (s=0;snSyms;s++) { newSyms[s]= pSyms[s]; } if (client->swapped) { for (s=0;snSyms;s++) { swapl(&newSyms[s]); } } } oldMap->kt_index[0] = wire->ktIndex[0]; oldMap->kt_index[1] = wire->ktIndex[1]; oldMap->kt_index[2] = wire->ktIndex[2]; oldMap->kt_index[3] = wire->ktIndex[3]; oldMap->group_info = wire->groupInfo; oldMap->width = wire->width; wire= (xkbSymMapWireDesc *)&pSyms[wire->nSyms]; } first= req->firstKeySym; last= first+req->nKeySyms-1; if (changes->map.changed&XkbKeySymsMask) { int oldLast= (changes->map.first_key_sym+changes->map.num_key_syms-1); if (changes->map.first_key_symmap.first_key_sym; if (oldLast>last) last= oldLast; } changes->map.changed|= XkbKeySymsMask; changes->map.first_key_sym = first; changes->map.num_key_syms = (last-first+1); s= 0; for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) { if (XkbKeyNumGroups(xkb,i)>s) s= XkbKeyNumGroups(xkb,i); } if (s!=xkb->ctrls->num_groups) { xkbControlsNotify cn; XkbControlsRec old; cn.keycode= 0; cn.eventType= 0; cn.requestMajor= XkbReqCode; cn.requestMinor= X_kbSetMap; old= *xkb->ctrls; xkb->ctrls->num_groups= s; if (XkbComputeControlsNotify(dev,&old,xkb->ctrls,&cn,False)) XkbSendControlsNotify(dev,&cn); } return (char *)wire; } static char * SetKeyActions( XkbDescPtr xkb, xkbSetMapReq * req, CARD8 * wire, XkbChangesPtr changes) { register unsigned i,first,last; CARD8 * nActs = wire; XkbAction * newActs; wire+= XkbPaddedSize(req->nKeyActs); for (i=0;inKeyActs;i++) { if (nActs[i]==0) xkb->server->key_acts[i+req->firstKeyAct]= 0; else { newActs= XkbResizeKeyActions(xkb,i+req->firstKeyAct,nActs[i]); memcpy((char *)newActs,(char *)wire, nActs[i]*SIZEOF(xkbActionWireDesc)); wire+= nActs[i]*SIZEOF(xkbActionWireDesc); } } first= req->firstKeyAct; last= (first+req->nKeyActs-1); if (changes->map.changed&XkbKeyActionsMask) { int oldLast; oldLast= changes->map.first_key_act+changes->map.num_key_acts-1; if (changes->map.first_key_actmap.first_key_act; if (oldLast>last) last= oldLast; } changes->map.changed|= XkbKeyActionsMask; changes->map.first_key_act= first; changes->map.num_key_acts= (last-first+1); return (char *)wire; } static char * SetKeyBehaviors( XkbSrvInfoPtr xkbi, xkbSetMapReq *req, xkbBehaviorWireDesc *wire, XkbChangesPtr changes) { register unsigned i; int maxRG = -1; XkbDescPtr xkb = xkbi->desc; XkbServerMapPtr server = xkb->server; unsigned first,last; first= req->firstKeyBehavior; last= req->firstKeyBehavior+req->nKeyBehaviors-1; bzero(&server->behaviors[first],req->nKeyBehaviors*sizeof(XkbBehavior)); for (i=0;itotalKeyBehaviors;i++) { if ((server->behaviors[wire->key].type&XkbKB_Permanent)==0) { server->behaviors[wire->key].type= wire->type; server->behaviors[wire->key].data= wire->data; if ((wire->type==XkbKB_RadioGroup)&&(((int)wire->data)>maxRG)) maxRG= wire->data + 1; } wire++; } if (maxRG>(int)xkbi->nRadioGroups) { int sz = maxRG*sizeof(XkbRadioGroupRec); if (xkbi->radioGroups) xkbi->radioGroups=(XkbRadioGroupPtr)_XkbRealloc(xkbi->radioGroups,sz); else xkbi->radioGroups= (XkbRadioGroupPtr)_XkbCalloc(1, sz); if (xkbi->radioGroups) { if (xkbi->nRadioGroups) bzero(&xkbi->radioGroups[xkbi->nRadioGroups], (maxRG-xkbi->nRadioGroups)*sizeof(XkbRadioGroupRec)); xkbi->nRadioGroups= maxRG; } else xkbi->nRadioGroups= 0; /* should compute members here */ } if (changes->map.changed&XkbKeyBehaviorsMask) { unsigned oldLast; oldLast= changes->map.first_key_behavior+ changes->map.num_key_behaviors-1; if (changes->map.first_key_behaviorfirstKeyBehavior) first= changes->map.first_key_behavior; if (oldLast>last) last= oldLast; } changes->map.changed|= XkbKeyBehaviorsMask; changes->map.first_key_behavior = first; changes->map.num_key_behaviors = (last-first+1); return (char *)wire; } static char * SetVirtualMods(XkbSrvInfoPtr xkbi,xkbSetMapReq *req,CARD8 *wire, XkbChangesPtr changes) { register int i,bit,nMods; XkbServerMapPtr srv = xkbi->desc->server; if (((req->present&XkbVirtualModsMask)==0)||(req->virtualMods==0)) return (char *)wire; for (i=nMods=0,bit=1;ivirtualMods&bit) { if (srv->vmods[i]!=wire[nMods]) { changes->map.changed|= XkbVirtualModsMask; changes->map.vmods|= bit; srv->vmods[i]= wire[nMods]; } nMods++; } } return (char *)(wire+XkbPaddedSize(nMods)); } static char * SetKeyExplicit(XkbSrvInfoPtr xkbi,xkbSetMapReq *req,CARD8 *wire, XkbChangesPtr changes) { register unsigned i,first,last; XkbServerMapPtr xkb = xkbi->desc->server; CARD8 * start; start= wire; first= req->firstKeyExplicit; last= req->firstKeyExplicit+req->nKeyExplicit-1; bzero(&xkb->explicit[first],req->nKeyExplicit); for (i=0;itotalKeyExplicit;i++,wire+= 2) { xkb->explicit[wire[0]]= wire[1]; } if (first>0) { if (changes->map.changed&XkbExplicitComponentsMask) { int oldLast; oldLast= changes->map.first_key_explicit+ changes->map.num_key_explicit-1; if (changes->map.first_key_explicitmap.first_key_explicit; if (oldLast>last) last= oldLast; } changes->map.first_key_explicit= first; changes->map.num_key_explicit= (last-first)+1; } wire+= XkbPaddedSize(wire-start)-(wire-start); return (char *)wire; } static char * SetModifierMap( XkbSrvInfoPtr xkbi, xkbSetMapReq * req, CARD8 * wire, XkbChangesPtr changes) { register unsigned i,first,last; XkbClientMapPtr xkb = xkbi->desc->map; CARD8 * start; start= wire; first= req->firstModMapKey; last= req->firstModMapKey+req->nModMapKeys-1; bzero(&xkb->modmap[first],req->nModMapKeys); for (i=0;itotalModMapKeys;i++,wire+= 2) { xkb->modmap[wire[0]]= wire[1]; } if (first>0) { if (changes->map.changed&XkbModifierMapMask) { int oldLast; oldLast= changes->map.first_modmap_key+ changes->map.num_modmap_keys-1; if (changes->map.first_modmap_keymap.first_modmap_key; if (oldLast>last) last= oldLast; } changes->map.first_modmap_key= first; changes->map.num_modmap_keys= (last-first)+1; } wire+= XkbPaddedSize(wire-start)-(wire-start); return (char *)wire; } static char * SetVirtualModMap( XkbSrvInfoPtr xkbi, xkbSetMapReq * req, xkbVModMapWireDesc * wire, XkbChangesPtr changes) { register unsigned i,first,last; XkbServerMapPtr srv = xkbi->desc->server; first= req->firstVModMapKey; last= req->firstVModMapKey+req->nVModMapKeys-1; bzero(&srv->vmodmap[first],req->nVModMapKeys*sizeof(unsigned short)); for (i=0;itotalVModMapKeys;i++,wire++) { srv->vmodmap[wire->key]= wire->vmods; } if (first>0) { if (changes->map.changed&XkbVirtualModMapMask) { int oldLast; oldLast= changes->map.first_vmodmap_key+ changes->map.num_vmodmap_keys-1; if (changes->map.first_vmodmap_keymap.first_vmodmap_key; if (oldLast>last) last= oldLast; } changes->map.first_vmodmap_key= first; changes->map.num_vmodmap_keys= (last-first)+1; } return (char *)wire; } int ProcXkbSetMap(ClientPtr client) { DeviceIntPtr dev; XkbSrvInfoPtr xkbi; XkbDescPtr xkb; XkbChangesRec change; XkbEventCauseRec cause; int nTypes = 0,nActions,error; char * tmp; CARD8 mapWidths[XkbMaxLegalKeyCode+1]; CARD16 symsPerKey[XkbMaxLegalKeyCode+1]; Bool sentNKN; REQUEST(xkbSetMapReq); REQUEST_AT_LEAST_SIZE(xkbSetMapReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); CHK_MASK_LEGAL(0x01,stuff->present,XkbAllMapComponentsMask); XkbSetCauseXkbReq(&cause,X_kbSetMap,client); xkbi= dev->key->xkbInfo; xkb = xkbi->desc; if ((xkb->min_key_code!=stuff->minKeyCode)|| (xkb->max_key_code!=stuff->maxKeyCode)) { if (client->vMajor!=1) { /* pre 1.0 versions of Xlib have a bug */ stuff->minKeyCode= xkb->min_key_code; stuff->maxKeyCode= xkb->max_key_code; } else { if (!XkbIsLegalKeycode(stuff->minKeyCode)) { client->errorValue= _XkbErrCode3(2,stuff->minKeyCode, stuff->maxKeyCode); return BadValue; } if (stuff->minKeyCode>stuff->maxKeyCode) { client->errorValue= _XkbErrCode3(3,stuff->minKeyCode, stuff->maxKeyCode); return BadMatch; } } } tmp = (char *)&stuff[1]; if ((stuff->present&XkbKeyTypesMask)&& (!CheckKeyTypes(client,xkb,stuff,(xkbKeyTypeWireDesc **)&tmp, &nTypes,mapWidths))) { client->errorValue = nTypes; return BadValue; } if ((stuff->present&XkbKeySymsMask)&& (!CheckKeySyms(client,xkb,stuff,nTypes,mapWidths,symsPerKey, (xkbSymMapWireDesc **)&tmp,&error))) { client->errorValue = error; return BadValue; } if ((stuff->present&XkbKeyActionsMask)&& (!CheckKeyActions(xkb,stuff,nTypes,mapWidths,symsPerKey, (CARD8 **)&tmp,&nActions))) { client->errorValue = nActions; return BadValue; } if ((stuff->present&XkbKeyBehaviorsMask)&& (!CheckKeyBehaviors(xkb,stuff,(xkbBehaviorWireDesc**)&tmp,&error))) { client->errorValue = error; return BadValue; } if ((stuff->present&XkbVirtualModsMask)&& (!CheckVirtualMods(xkb,stuff,(CARD8 **)&tmp,&error))) { client->errorValue= error; return BadValue; } if ((stuff->present&XkbExplicitComponentsMask)&& (!CheckKeyExplicit(xkb,stuff,(CARD8 **)&tmp,&error))) { client->errorValue= error; return BadValue; } if ((stuff->present&XkbModifierMapMask)&& (!CheckModifierMap(xkb,stuff,(CARD8 **)&tmp,&error))) { client->errorValue= error; return BadValue; } if ((stuff->present&XkbVirtualModMapMask)&& (!CheckVirtualModMap(xkb,stuff,(xkbVModMapWireDesc **)&tmp,&error))) { client->errorValue= error; return BadValue; } if (((tmp-((char *)stuff))/4)!=stuff->length) { ErrorF("Internal error! Bad length in XkbSetMap (after check)\n"); client->errorValue = tmp-((char *)&stuff[1]); return BadLength; } bzero(&change,sizeof(change)); sentNKN= False; if ((xkb->min_key_code!=stuff->minKeyCode)|| (xkb->max_key_code!=stuff->maxKeyCode)) { Status status; xkbNewKeyboardNotify nkn; memset(&nkn, 0, sizeof(xkbNewKeyboardNotify)); nkn.deviceID= nkn.oldDeviceID= dev->id; nkn.oldMinKeyCode= xkb->min_key_code; nkn.oldMaxKeyCode= xkb->max_key_code; status= XkbChangeKeycodeRange(xkb,stuff->minKeyCode,stuff->maxKeyCode, &change); if (status!=Success) return status; nkn.minKeyCode= xkb->min_key_code; nkn.maxKeyCode= xkb->max_key_code; nkn.requestMajor= XkbReqCode; nkn.requestMinor= X_kbSetMap; nkn.changed= XkbNKN_KeycodesMask; XkbSendNewKeyboardNotify(dev,&nkn); sentNKN= True; } tmp = (char *)&stuff[1]; if (stuff->present&XkbKeyTypesMask) { tmp = SetKeyTypes(xkb,stuff,(xkbKeyTypeWireDesc *)tmp,&change); if (!tmp) goto allocFailure; } if (stuff->present&XkbKeySymsMask) { tmp = SetKeySyms(client,xkb,stuff,(xkbSymMapWireDesc *)tmp,&change,dev); if (!tmp) goto allocFailure; } if (stuff->present&XkbKeyActionsMask) { tmp = SetKeyActions(xkb,stuff,(CARD8 *)tmp,&change); if (!tmp) goto allocFailure; } if (stuff->present&XkbKeyBehaviorsMask) { tmp= SetKeyBehaviors(xkbi,stuff,(xkbBehaviorWireDesc *)tmp,&change); if (!tmp) goto allocFailure; } if (stuff->present&XkbVirtualModsMask) tmp= SetVirtualMods(xkbi,stuff,(CARD8 *)tmp,&change); if (stuff->present&XkbExplicitComponentsMask) tmp= SetKeyExplicit(xkbi,stuff,(CARD8 *)tmp,&change); if (stuff->present&XkbModifierMapMask) tmp= SetModifierMap(xkbi,stuff,(CARD8 *)tmp,&change); if (stuff->present&XkbVirtualModMapMask) tmp= SetVirtualModMap(xkbi,stuff,(xkbVModMapWireDesc *)tmp,&change); if (((tmp-((char *)stuff))/4)!=stuff->length) { ErrorF("Internal error! Bad length in XkbSetMap (after set)\n"); client->errorValue = tmp-((char *)&stuff[1]); return BadLength; } if (stuff->flags&XkbSetMapRecomputeActions) { KeyCode first,last,firstMM,lastMM; if (change.map.num_key_syms>0) { first= change.map.first_key_sym; last= first+change.map.num_key_syms-1; } else first= last= 0; if (change.map.num_modmap_keys>0) { firstMM= change.map.first_modmap_key; lastMM= firstMM + change.map.num_modmap_keys - 1; } else firstMM= lastMM= 0; if ((last>0) && (lastMM>0)) { if (firstMMlast) last= lastMM; } else if (lastMM>0) { first= firstMM; last= lastMM; } if (last>0) { unsigned check= 0; XkbUpdateActions(dev,first,(last-first+1),&change,&check,&cause); if (check) XkbCheckSecondaryEffects(xkbi,check,&change,&cause); } } if (!sentNKN) XkbSendNotification(dev,&change,&cause); XkbUpdateCoreDescription(dev,False); return client->noClientException; allocFailure: return BadAlloc; } /***====================================================================***/ static Status XkbComputeGetCompatMapReplySize( XkbCompatMapPtr compat, xkbGetCompatMapReply * rep) { unsigned size,nGroups; nGroups= 0; if (rep->groups!=0) { register int i,bit; for (i=0,bit=1;igroups&bit) nGroups++; } } size= nGroups*SIZEOF(xkbModsWireDesc); size+= (rep->nSI*SIZEOF(xkbSymInterpretWireDesc)); rep->length= size/4; return Success; } static int XkbSendCompatMap( ClientPtr client, XkbCompatMapPtr compat, xkbGetCompatMapReply * rep) { char * data; int size; size= rep->length*4; if (size>0) { data = (char *)malloc(size); if (data) { register unsigned i,bit; xkbModsWireDesc * grp; XkbSymInterpretPtr sym= &compat->sym_interpret[rep->firstSI]; xkbSymInterpretWireDesc *wire = (xkbSymInterpretWireDesc *)data; for (i=0;inSI;i++,sym++,wire++) { wire->sym= sym->sym; wire->mods= sym->mods; wire->match= sym->match; wire->virtualMod= sym->virtual_mod; wire->flags= sym->flags; memcpy((char*)&wire->act,(char*)&sym->act,sz_xkbActionWireDesc); if (client->swapped) { swapl(&wire->sym); } } if (rep->groups) { grp = (xkbModsWireDesc *)wire; for (i=0,bit=1;igroups&bit) { grp->mask= compat->groups[i].mask; grp->realMods= compat->groups[i].real_mods; grp->virtualMods= compat->groups[i].vmods; if (client->swapped) { swaps(&grp->virtualMods); } grp++; } } wire= (xkbSymInterpretWireDesc*)grp; } } else return BadAlloc; } else data= NULL; if (client->swapped) { swaps(&rep->sequenceNumber); swapl(&rep->length); swaps(&rep->firstSI); swaps(&rep->nSI); swaps(&rep->nTotalSI); } WriteToClient(client, SIZEOF(xkbGetCompatMapReply), rep); if (data) { WriteToClient(client, size, data); free((char *)data); } return client->noClientException; } int ProcXkbGetCompatMap(ClientPtr client) { xkbGetCompatMapReply rep = {0}; DeviceIntPtr dev; XkbDescPtr xkb; XkbCompatMapPtr compat; REQUEST(xkbGetCompatMapReq); REQUEST_SIZE_MATCH(xkbGetCompatMapReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); xkb = dev->key->xkbInfo->desc; compat= xkb->compat; rep.type = X_Reply; rep.deviceID = dev->id; rep.sequenceNumber = client->sequence; rep.length = 0; rep.firstSI = stuff->firstSI; rep.nSI = stuff->nSI; if (stuff->getAllSI) { rep.firstSI = 0; rep.nSI = compat->num_si; } else if ((((unsigned)stuff->nSI)>0)&& ((unsigned)(stuff->firstSI+stuff->nSI-1)>=compat->num_si)) { client->errorValue = _XkbErrCode2(0x05,compat->num_si); return BadValue; } rep.nTotalSI = compat->num_si; rep.groups= stuff->groups; XkbComputeGetCompatMapReplySize(compat,&rep); return XkbSendCompatMap(client,compat,&rep); } int ProcXkbSetCompatMap(ClientPtr client) { DeviceIntPtr dev; XkbSrvInfoPtr xkbi; XkbDescPtr xkb; XkbCompatMapPtr compat; char * data; int nGroups; register unsigned i,bit; REQUEST(xkbSetCompatMapReq); REQUEST_AT_LEAST_SIZE(xkbSetCompatMapReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); data = (char *)&stuff[1]; xkbi = dev->key->xkbInfo; xkb= xkbi->desc; compat= xkb->compat; if ((stuff->nSI>0)||(stuff->truncateSI)) { xkbSymInterpretWireDesc *wire; if (stuff->firstSI>compat->num_si) { client->errorValue = _XkbErrCode2(0x02,compat->num_si); return BadValue; } wire= (xkbSymInterpretWireDesc *)data; wire+= stuff->nSI; data = (char *)wire; } nGroups= 0; if (stuff->groups!=0) { for (i=0,bit=1;igroups&bit ) nGroups++; } } data+= nGroups*SIZEOF(xkbModsWireDesc); if (((data-((char *)stuff))/4)!=stuff->length) { return BadLength; } data = (char *)&stuff[1]; if (stuff->nSI>0) { xkbSymInterpretWireDesc *wire = (xkbSymInterpretWireDesc *)data; XkbSymInterpretPtr sym; if ((unsigned)(stuff->firstSI+stuff->nSI)>compat->num_si) { compat->num_si= stuff->firstSI+stuff->nSI; compat->sym_interpret= _XkbTypedRealloc(compat->sym_interpret, compat->num_si, XkbSymInterpretRec); if (!compat->sym_interpret) { compat->num_si= 0; return BadAlloc; } } else if (stuff->truncateSI) { compat->num_si = stuff->firstSI+stuff->nSI; } sym = &compat->sym_interpret[stuff->firstSI]; for (i=0;inSI;i++,wire++,sym++) { if (client->swapped) { swapl(&wire->sym); } sym->sym= wire->sym; sym->mods= wire->mods; sym->match= wire->match; sym->flags= wire->flags; sym->virtual_mod= wire->virtualMod; memcpy((char *)&sym->act,(char *)&wire->act, SIZEOF(xkbActionWireDesc)); } data = (char *)wire; } else if (stuff->truncateSI) { compat->num_si = stuff->firstSI; } if (stuff->groups!=0) { xkbModsWireDesc *wire = (xkbModsWireDesc *)data; for (i=0,bit=1;igroups&bit) { if (client->swapped) { swaps(&wire->virtualMods); } compat->groups[i].mask= wire->realMods; compat->groups[i].real_mods= wire->realMods; compat->groups[i].vmods= wire->virtualMods; if (wire->virtualMods!=0) { unsigned tmp; tmp= XkbMaskForVMask(xkb,wire->virtualMods); compat->groups[i].mask|= tmp; } data+= SIZEOF(xkbModsWireDesc); wire= (xkbModsWireDesc *)data; } } } i= XkbPaddedSize((data-((char *)stuff))); if ((i/4)!=stuff->length) { ErrorF("Internal length error on read in ProcXkbSetCompatMap\n"); return BadLength; } if (dev->xkb_interest) { xkbCompatMapNotify ev; ev.deviceID = dev->id; ev.changedGroups = stuff->groups; ev.firstSI = stuff->firstSI; ev.nSI = stuff->nSI; ev.nTotalSI = compat->num_si; XkbSendCompatMapNotify(dev,&ev); } if (stuff->recomputeActions) { XkbChangesRec change; unsigned check; XkbEventCauseRec cause; XkbSetCauseXkbReq(&cause,X_kbSetCompatMap,client); bzero(&change,sizeof(XkbChangesRec)); XkbUpdateActions(dev,xkb->min_key_code,XkbNumKeys(xkb),&change,&check, &cause); if (check) XkbCheckSecondaryEffects(xkbi,check,&change,&cause); XkbUpdateCoreDescription(dev,False); XkbSendNotification(dev,&change,&cause); } return client->noClientException; } /***====================================================================***/ int ProcXkbGetIndicatorState(ClientPtr client) { xkbGetIndicatorStateReply rep = {0};; XkbSrvLedInfoPtr sli; DeviceIntPtr dev; REQUEST(xkbGetIndicatorStateReq); REQUEST_SIZE_MATCH(xkbGetIndicatorStateReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId, XkbXI_IndicatorStateMask); if (!sli) return BadAlloc; rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.deviceID = dev->id; rep.state = sli->effectiveState; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.state); } WriteToClient(client, SIZEOF(xkbGetIndicatorStateReply), &rep); return client->noClientException; } /***====================================================================***/ static Status XkbComputeGetIndicatorMapReplySize( XkbIndicatorPtr indicators, xkbGetIndicatorMapReply *rep) { register int i,bit; int nIndicators; rep->realIndicators = indicators->phys_indicators; for (i=nIndicators=0,bit=1;iwhich&bit) nIndicators++; } rep->length = (nIndicators*SIZEOF(xkbIndicatorMapWireDesc))/4; return Success; } static int XkbSendIndicatorMap( ClientPtr client, XkbIndicatorPtr indicators, xkbGetIndicatorMapReply * rep) { int length; CARD8 * map; register int i; register unsigned bit; length = rep->length*4; if (length>0) { CARD8 *to; to= map= (CARD8 *)malloc(length); if (map) { xkbIndicatorMapWireDesc *wire = (xkbIndicatorMapWireDesc *)to; for (i=0,bit=1;iwhich&bit) { wire->flags= indicators->maps[i].flags; wire->whichGroups= indicators->maps[i].which_groups; wire->groups= indicators->maps[i].groups; wire->whichMods= indicators->maps[i].which_mods; wire->mods= indicators->maps[i].mods.mask; wire->realMods= indicators->maps[i].mods.real_mods; wire->virtualMods= indicators->maps[i].mods.vmods; wire->ctrls= indicators->maps[i].ctrls; if (client->swapped) { swaps(&wire->virtualMods); swapl(&wire->ctrls); } wire++; } } to = (CARD8 *)wire; if ((to-map)!=length) { client->errorValue = _XkbErrCode2(0xff,length); return BadLength; } } else return BadAlloc; } else map = NULL; if (client->swapped) { swaps(&rep->sequenceNumber); swapl(&rep->length); swapl(&rep->which); swapl(&rep->realIndicators); } WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), rep); if (map) { WriteToClient(client, length, map); free((char *)map); } return client->noClientException; } int ProcXkbGetIndicatorMap(ClientPtr client) { xkbGetIndicatorMapReply rep = {0}; DeviceIntPtr dev; XkbDescPtr xkb; XkbIndicatorPtr leds; REQUEST(xkbGetIndicatorMapReq); REQUEST_SIZE_MATCH(xkbGetIndicatorMapReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); xkb= dev->key->xkbInfo->desc; leds= xkb->indicators; rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.deviceID = dev->id; rep.which = stuff->which; XkbComputeGetIndicatorMapReplySize(leds,&rep); return XkbSendIndicatorMap(client,leds,&rep); } int ProcXkbSetIndicatorMap(ClientPtr client) { register int i,bit; int nIndicators,why; DeviceIntPtr dev; XkbSrvInfoPtr xkbi; xkbIndicatorMapWireDesc *from; XkbSrvLedInfoPtr sli; XkbEventCauseRec cause; REQUEST(xkbSetIndicatorMapReq); REQUEST_AT_LEAST_SIZE(xkbSetIndicatorMapReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; dev = _XkbLookupKeyboard(stuff->deviceSpec,&why); if (!dev) { client->errorValue = _XkbErrCode2(why,stuff->deviceSpec); return XkbKeyboardErrorCode; } xkbi= dev->key->xkbInfo; if (stuff->which==0) return client->noClientException; for (nIndicators=i=0,bit=1;iwhich&bit) nIndicators++; } if (stuff->length!=((SIZEOF(xkbSetIndicatorMapReq)+ (nIndicators*SIZEOF(xkbIndicatorMapWireDesc)))/4)) { return BadLength; } sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId, XkbXI_IndicatorMapsMask); if (!sli) return BadAlloc; from = (xkbIndicatorMapWireDesc *)&stuff[1]; for (i=0,bit=1;iwhich&bit) { if (client->swapped) { swaps(&from->virtualMods); swapl(&from->ctrls); } CHK_MASK_LEGAL(i,from->whichGroups,XkbIM_UseAnyGroup); CHK_MASK_LEGAL(i,from->whichMods,XkbIM_UseAnyMods); from++; } } from = (xkbIndicatorMapWireDesc *)&stuff[1]; for (i=0,bit=1;iwhich&bit) { sli->maps[i].flags = from->flags; sli->maps[i].which_groups = from->whichGroups; sli->maps[i].groups = from->groups; sli->maps[i].which_mods = from->whichMods; sli->maps[i].mods.mask = from->mods; sli->maps[i].mods.real_mods = from->mods; sli->maps[i].mods.vmods= from->virtualMods; sli->maps[i].ctrls = from->ctrls; if (from->virtualMods!=0) { unsigned tmp; tmp= XkbMaskForVMask(xkbi->desc,from->virtualMods); sli->maps[i].mods.mask= from->mods|tmp; } from++; } } XkbSetCauseXkbReq(&cause,X_kbSetIndicatorMap,client); XkbApplyLedMapChanges(dev,sli,stuff->which,NULL,NULL,&cause); return client->noClientException; } /***====================================================================***/ int ProcXkbGetNamedIndicator(ClientPtr client) { DeviceIntPtr dev; xkbGetNamedIndicatorReply rep = {0}; register int i = 0; XkbSrvLedInfoPtr sli; XkbIndicatorMapPtr map = NULL; REQUEST(xkbGetNamedIndicatorReq); REQUEST_SIZE_MATCH(xkbGetNamedIndicatorReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_LED_DEVICE(dev,stuff->deviceSpec); CHK_ATOM_ONLY(stuff->indicator); sli= XkbFindSrvLedInfo(dev,stuff->ledClass,stuff->ledID,0); if (!sli) return BadAlloc; i= 0; map= NULL; if ((sli->names)&&(sli->maps)) { for (i=0;iindicator==sli->names[i]) { map= &sli->maps[i]; break; } } } rep.type= X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.deviceID = dev->id; rep.indicator= stuff->indicator; if (map!=NULL) { rep.found= True; rep.on= ((sli->effectiveState&(1<physIndicators&(1<flags; rep.whichGroups= map->which_groups; rep.groups= map->groups; rep.whichMods= map->which_mods; rep.mods= map->mods.mask; rep.realMods= map->mods.real_mods; rep.virtualMods= map->mods.vmods; rep.ctrls= map->ctrls; rep.supported= True; } else { rep.found= False; rep.on= False; rep.realIndicator= False; rep.ndx= XkbNoIndicator; rep.flags= 0; rep.whichGroups= 0; rep.groups= 0; rep.whichMods= 0; rep.mods= 0; rep.realMods= 0; rep.virtualMods= 0; rep.ctrls= 0; rep.supported= True; } if ( client->swapped ) { swapl(&rep.length); swaps(&rep.sequenceNumber); swapl(&rep.indicator); swaps(&rep.virtualMods); swapl(&rep.ctrls); } WriteToClient(client,SIZEOF(xkbGetNamedIndicatorReply), &rep); return client->noClientException; } int ProcXkbSetNamedIndicator(ClientPtr client) { DeviceIntPtr dev,kbd; XkbIndicatorMapPtr map; XkbSrvLedInfoPtr sli; register int led = 0; unsigned extDevReason; unsigned statec,namec,mapc; XkbEventCauseRec cause; xkbExtensionDeviceNotify ed; XkbChangesRec changes; REQUEST(xkbSetNamedIndicatorReq); REQUEST_SIZE_MATCH(xkbSetNamedIndicatorReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_LED_DEVICE(dev,stuff->deviceSpec); CHK_ATOM_ONLY(stuff->indicator); CHK_MASK_LEGAL(0x10,stuff->whichGroups,XkbIM_UseAnyGroup); CHK_MASK_LEGAL(0x11,stuff->whichMods,XkbIM_UseAnyMods); extDevReason= 0; sli= XkbFindSrvLedInfo(dev,stuff->ledClass,stuff->ledID, XkbXI_IndicatorsMask); if (!sli) return BadAlloc; statec= mapc= namec= 0; map= NULL; if (sli->names && sli->maps) { for (led=0;(lednames[led]==stuff->indicator) { map= &sli->maps[led]; break; } } } if (map==NULL) { if (!stuff->createMap) return client->noClientException; for (led=0,map=NULL;(lednames)&&(sli->maps)&&(sli->names[led]==None)&& (!XkbIM_InUse(&sli->maps[led]))) { map= &sli->maps[led]; sli->names[led]= stuff->indicator; break; } } if (map==NULL) return client->noClientException; namec|= (1<namesPresent|= ((stuff->indicator!=None)?(1<setMap) { map->flags = stuff->flags; map->which_groups = stuff->whichGroups; map->groups = stuff->groups; map->which_mods = stuff->whichMods; map->mods.mask = stuff->realMods; map->mods.real_mods = stuff->realMods; map->mods.vmods= stuff->virtualMods; map->ctrls = stuff->ctrls; mapc|= (1<setState)&&((map->flags&XkbIM_NoExplicit)==0)) { if (stuff->on) sli->explicitState|= (1<explicitState&= ~(1<effectiveState^sli->explicitState)&(1<flags&XkbSLI_HasOwnState)==0) kbd= (DeviceIntPtr)LookupKeyboardDevice(); XkbFlushLedEvents(dev,kbd,sli,&ed,&changes,&cause); return client->noClientException; } /***====================================================================***/ static CARD32 _XkbCountAtoms(Atom *atoms,int maxAtoms,int *count) { register unsigned int i,bit,nAtoms; register CARD32 atomsPresent; for (i=nAtoms=atomsPresent=0,bit=1;iminKeyCode= xkb->min_key_code; rep->maxKeyCode= xkb->max_key_code; which= rep->which; length= 0; if (xkb->names!=NULL) { if (which&XkbKeycodesNameMask) length++; if (which&XkbGeometryNameMask) length++; if (which&XkbSymbolsNameMask) length++; if (which&XkbPhysSymbolsNameMask) length++; if (which&XkbTypesNameMask) length++; if (which&XkbCompatNameMask) length++; } else which&= ~XkbComponentNamesMask; if (xkb->map!=NULL) { if (which&XkbKeyTypeNamesMask) length+= xkb->map->num_types; rep->nTypes= xkb->map->num_types; if (which&XkbKTLevelNamesMask) { XkbKeyTypePtr pType = xkb->map->types; int nKTLevels = 0; length+= XkbPaddedSize(xkb->map->num_types)/4; for (i=0;imap->num_types;i++,pType++) { if (pType->level_names!=NULL) nKTLevels+= pType->num_levels; } rep->nKTLevels= nKTLevels; length+= nKTLevels; } } else { rep->nTypes= 0; rep->nKTLevels= 0; which&= ~(XkbKeyTypeNamesMask|XkbKTLevelNamesMask); } rep->minKeyCode= xkb->min_key_code; rep->maxKeyCode= xkb->max_key_code; rep->indicators= 0; rep->virtualMods= 0; rep->groupNames= 0; if (xkb->names!=NULL) { if (which&XkbIndicatorNamesMask) { int nLeds; rep->indicators= _XkbCountAtoms(xkb->names->indicators,XkbNumIndicators,&nLeds); length+= nLeds; if (nLeds==0) which&= ~XkbIndicatorNamesMask; } if (which&XkbVirtualModNamesMask) { int nVMods; rep->virtualMods= _XkbCountAtoms(xkb->names->vmods,XkbNumVirtualMods,&nVMods); length+= nVMods; if (nVMods==0) which&= ~XkbVirtualModNamesMask; } if (which&XkbGroupNamesMask) { int nGroups; rep->groupNames= _XkbCountAtoms(xkb->names->groups,XkbNumKbdGroups,&nGroups); length+= nGroups; if (nGroups==0) which&= ~XkbGroupNamesMask; } if ((which&XkbKeyNamesMask)&&(xkb->names->keys)) length+= rep->nKeys; else which&= ~XkbKeyNamesMask; if ((which&XkbKeyAliasesMask)&& (xkb->names->key_aliases)&&(xkb->names->num_key_aliases>0)) { rep->nKeyAliases= xkb->names->num_key_aliases; length+= rep->nKeyAliases*2; } else { which&= ~XkbKeyAliasesMask; rep->nKeyAliases= 0; } if ((which&XkbRGNamesMask)&&(xkb->names->num_rg>0)) length+= xkb->names->num_rg; else which&= ~XkbRGNamesMask; } else { which&= ~(XkbIndicatorNamesMask|XkbVirtualModNamesMask); which&= ~(XkbGroupNamesMask|XkbKeyNamesMask|XkbKeyAliasesMask); which&= ~XkbRGNamesMask; } rep->length= length; rep->which= which; return Success; } static int XkbSendNames(ClientPtr client,XkbDescPtr xkb,xkbGetNamesReply *rep) { register unsigned i,length,which; char * start; char * desc; length= rep->length*4; which= rep->which; if (client->swapped) { swaps(&rep->sequenceNumber); swapl(&rep->length); swapl(&rep->which); swaps(&rep->virtualMods); swapl(&rep->indicators); } start = desc = (char *)calloc(1, length); if ( !start ) return BadAlloc; if (xkb->names) { if (which&XkbKeycodesNameMask) { *((CARD32 *)desc)= xkb->names->keycodes; if (client->swapped) { swapl((int *)desc); } desc+= 4; } if (which&XkbGeometryNameMask) { *((CARD32 *)desc)= xkb->names->geometry; if (client->swapped) { swapl((int *)desc); } desc+= 4; } if (which&XkbSymbolsNameMask) { *((CARD32 *)desc)= xkb->names->symbols; if (client->swapped) { swapl((int *)desc); } desc+= 4; } if (which&XkbPhysSymbolsNameMask) { register CARD32 *atm= (CARD32 *)desc; atm[0]= (CARD32)xkb->names->phys_symbols; if (client->swapped) { swapl(&atm[0]); } desc+= 4; } if (which&XkbTypesNameMask) { *((CARD32 *)desc)= (CARD32)xkb->names->types; if (client->swapped) { swapl((int *)desc); } desc+= 4; } if (which&XkbCompatNameMask) { *((CARD32 *)desc)= (CARD32)xkb->names->compat; if (client->swapped) { swapl((int *)desc); } desc+= 4; } if (which&XkbKeyTypeNamesMask) { register CARD32 *atm= (CARD32 *)desc; register XkbKeyTypePtr type= xkb->map->types; for (i=0;imap->num_types;i++,atm++,type++) { *atm= (CARD32)type->name; if (client->swapped) { swapl(atm); } } desc= (char *)atm; } if (which&XkbKTLevelNamesMask && xkb->map) { XkbKeyTypePtr type = xkb->map->types; register CARD32 *atm; for (i=0;inTypes;i++,type++) { *desc++ = type->num_levels; } desc+= XkbPaddedSize(rep->nTypes)-rep->nTypes; atm= (CARD32 *)desc; type = xkb->map->types; for (i=0;imap->num_types;i++,type++) { register unsigned l; if (type->level_names) { for (l=0;lnum_levels;l++,atm++) { *atm= type->level_names[l]; if (client->swapped) { swapl(atm); } } desc+= type->num_levels*4; } } } if (which&XkbIndicatorNamesMask) { desc= _XkbWriteAtoms(desc,xkb->names->indicators,XkbNumIndicators, client->swapped); } if (which&XkbVirtualModNamesMask) { desc= _XkbWriteAtoms(desc,xkb->names->vmods,XkbNumVirtualMods, client->swapped); } if (which&XkbGroupNamesMask) { desc= _XkbWriteAtoms(desc,xkb->names->groups,XkbNumKbdGroups, client->swapped); } if (which&XkbKeyNamesMask) { for (i=0;inKeys;i++,desc+= sizeof(XkbKeyNameRec)) { *((XkbKeyNamePtr)desc)= xkb->names->keys[i+rep->firstKey]; } } if (which&XkbKeyAliasesMask) { XkbKeyAliasPtr pAl; pAl= xkb->names->key_aliases; for (i=0;inKeyAliases;i++,pAl++,desc+=2*XkbKeyNameLength) { *((XkbKeyAliasPtr)desc)= *pAl; } } if ((which&XkbRGNamesMask)&&(rep->nRadioGroups>0)) { register CARD32 *atm= (CARD32 *)desc; for (i=0;inRadioGroups;i++,atm++) { *atm= (CARD32)xkb->names->radio_groups[i]; if (client->swapped) { swapl(atm); } } desc+= rep->nRadioGroups*4; } } if ((desc-start)!=(length)) { ErrorF("BOGUS LENGTH in write names, expected %d, got %ld\n", length, (unsigned long)(desc-start)); } WriteToClient(client, SIZEOF(xkbGetNamesReply), rep); WriteToClient(client, length, start); free((char *)start); return client->noClientException; } int ProcXkbGetNames(ClientPtr client) { DeviceIntPtr dev; XkbDescPtr xkb; xkbGetNamesReply rep = {0}; REQUEST(xkbGetNamesReq); REQUEST_SIZE_MATCH(xkbGetNamesReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); CHK_MASK_LEGAL(0x01,stuff->which,XkbAllNamesMask); xkb = dev->key->xkbInfo->desc; rep.type= X_Reply; rep.sequenceNumber= client->sequence; rep.length = 0; rep.deviceID = dev->id; rep.which = stuff->which; rep.nTypes = xkb->map->num_types; rep.firstKey = xkb->min_key_code; rep.nKeys = XkbNumKeys(xkb); if (xkb->names!=NULL) { rep.nKeyAliases= xkb->names->num_key_aliases; rep.nRadioGroups = xkb->names->num_rg; } else { rep.nKeyAliases= rep.nRadioGroups= 0; } XkbComputeGetNamesReplySize(xkb,&rep); return XkbSendNames(client,xkb,&rep); } /***====================================================================***/ static CARD32 * _XkbCheckAtoms(CARD32 *wire,int nAtoms,int swapped,Atom *pError) { register int i; for (i=0;ixkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); CHK_MASK_LEGAL(0x01,stuff->which,XkbAllNamesMask); xkb = dev->key->xkbInfo->desc; names = xkb->names; tmp = (CARD32 *)&stuff[1]; if (stuff->which&XkbKeycodesNameMask) { tmp= _XkbCheckAtoms(tmp,1,client->swapped,&bad); if (!tmp) { client->errorValue = bad; return BadAtom; } } if (stuff->which&XkbGeometryNameMask) { tmp= _XkbCheckAtoms(tmp,1,client->swapped,&bad); if (!tmp) { client->errorValue = bad; return BadAtom; } } if (stuff->which&XkbSymbolsNameMask) { tmp= _XkbCheckAtoms(tmp,1,client->swapped,&bad); if (!tmp) { client->errorValue = bad; return BadAtom; } } if (stuff->which&XkbPhysSymbolsNameMask) { tmp= _XkbCheckAtoms(tmp,1,client->swapped,&bad); if (!tmp) { client->errorValue= bad; return BadAtom; } } if (stuff->which&XkbTypesNameMask) { tmp= _XkbCheckAtoms(tmp,1,client->swapped,&bad); if (!tmp) { client->errorValue = bad; return BadAtom; } } if (stuff->which&XkbCompatNameMask) { tmp= _XkbCheckAtoms(tmp,1,client->swapped,&bad); if (!tmp) { client->errorValue = bad; return BadAtom; } } if (stuff->which&XkbKeyTypeNamesMask) { register int i; CARD32 *old; if ( stuff->nTypes<1 ) { client->errorValue = _XkbErrCode2(0x02,stuff->nTypes); return BadValue; } if ((unsigned)(stuff->firstType+stuff->nTypes-1)>=xkb->map->num_types) { client->errorValue = _XkbErrCode4(0x03,stuff->firstType, stuff->nTypes, xkb->map->num_types); return BadValue; } if (((unsigned)stuff->firstType)<=XkbLastRequiredType) { client->errorValue = _XkbErrCode2(0x04,stuff->firstType); return BadAccess; } old= tmp; tmp= _XkbCheckAtoms(tmp,stuff->nTypes,client->swapped,&bad); if (!tmp) { client->errorValue= bad; return BadAtom; } for (i=0;inTypes;i++,old++) { if (!_XkbCheckTypeName((Atom)*old,stuff->firstType+i)) client->errorValue= _XkbErrCode2(0x05,i); } } if (stuff->which&XkbKTLevelNamesMask) { register unsigned i; XkbKeyTypePtr type; CARD8 * width; if ( stuff->nKTLevels<1 ) { client->errorValue = _XkbErrCode2(0x05,stuff->nKTLevels); return BadValue; } if ((unsigned)(stuff->firstKTLevel+stuff->nKTLevels-1)>= xkb->map->num_types) { client->errorValue = _XkbErrCode4(0x06,stuff->firstKTLevel, stuff->nKTLevels,xkb->map->num_types); return BadValue; } width = (CARD8 *)tmp; tmp= (CARD32 *)(((char *)tmp)+XkbPaddedSize(stuff->nKTLevels)); type = &xkb->map->types[stuff->firstKTLevel]; for (i=0;inKTLevels;i++,type++) { if (width[i]==0) continue; else if (width[i]!=type->num_levels) { client->errorValue= _XkbErrCode4(0x07,i+stuff->firstKTLevel, type->num_levels,width[i]); return BadMatch; } tmp= _XkbCheckAtoms(tmp,width[i],client->swapped,&bad); if (!tmp) { client->errorValue= bad; return BadAtom; } } } if (stuff->which&XkbIndicatorNamesMask) { if (stuff->indicators==0) { client->errorValue= 0x08; return BadMatch; } tmp= _XkbCheckMaskedAtoms(tmp,XkbNumIndicators,stuff->indicators, client->swapped,&bad); if (!tmp) { client->errorValue= bad; return BadAtom; } } if (stuff->which&XkbVirtualModNamesMask) { if (stuff->virtualMods==0) { client->errorValue= 0x09; return BadMatch; } tmp= _XkbCheckMaskedAtoms(tmp,XkbNumVirtualMods, (CARD32)stuff->virtualMods, client->swapped,&bad); if (!tmp) { client->errorValue = bad; return BadAtom; } } if (stuff->which&XkbGroupNamesMask) { if (stuff->groupNames==0) { client->errorValue= 0x0a; return BadMatch; } tmp= _XkbCheckMaskedAtoms(tmp,XkbNumKbdGroups, (CARD32)stuff->groupNames, client->swapped,&bad); if (!tmp) { client->errorValue = bad; return BadAtom; } } if (stuff->which&XkbKeyNamesMask) { if (stuff->firstKey<(unsigned)xkb->min_key_code) { client->errorValue= _XkbErrCode3(0x0b,xkb->min_key_code, stuff->firstKey); return BadValue; } if (((unsigned)(stuff->firstKey+stuff->nKeys-1)>xkb->max_key_code)|| (stuff->nKeys<1)) { client->errorValue= _XkbErrCode4(0x0c,xkb->max_key_code, stuff->firstKey,stuff->nKeys); return BadValue; } tmp+= stuff->nKeys; } if ((stuff->which&XkbKeyAliasesMask)&&(stuff->nKeyAliases>0)) { tmp+= stuff->nKeyAliases*2; } if (stuff->which&XkbRGNamesMask) { if ( stuff->nRadioGroups<1 ) { client->errorValue= _XkbErrCode2(0x0d,stuff->nRadioGroups); return BadValue; } tmp= _XkbCheckAtoms(tmp,stuff->nRadioGroups,client->swapped,&bad); if (!tmp) { client->errorValue= bad; return BadAtom; } } if ((tmp-((CARD32 *)stuff))!=stuff->length) { client->errorValue = stuff->length; return BadLength; } if (XkbAllocNames(xkb,stuff->which,stuff->nRadioGroups, stuff->nKeyAliases)!=Success) { return BadAlloc; } /* everything is okay -- update names */ bzero(&nn,sizeof(xkbNamesNotify)); nn.changed= stuff->which; tmp = (CARD32 *)&stuff[1]; if (stuff->which&XkbKeycodesNameMask) names->keycodes= *tmp++; if (stuff->which&XkbGeometryNameMask) names->geometry= *tmp++; if (stuff->which&XkbSymbolsNameMask) names->symbols= *tmp++; if (stuff->which&XkbPhysSymbolsNameMask) names->phys_symbols= *tmp++; if (stuff->which&XkbTypesNameMask) names->types= *tmp++; if (stuff->which&XkbCompatNameMask) names->compat= *tmp++; if ((stuff->which&XkbKeyTypeNamesMask)&&(stuff->nTypes>0)) { register unsigned i; register XkbKeyTypePtr type; type= &xkb->map->types[stuff->firstType]; for (i=0;inTypes;i++,type++) { type->name= *tmp++; } nn.firstType= stuff->firstType; nn.nTypes= stuff->nTypes; } if (stuff->which&XkbKTLevelNamesMask) { register XkbKeyTypePtr type; register unsigned i; CARD8 *width; width = (CARD8 *)tmp; tmp= (CARD32 *)(((char *)tmp)+XkbPaddedSize(stuff->nKTLevels)); type= &xkb->map->types[stuff->firstKTLevel]; for (i=0;inKTLevels;i++,type++) { if (width[i]>0) { if (type->level_names) { register unsigned n; for (n=0;nlevel_names[n]= tmp[n]; } } tmp+= width[i]; } } nn.firstLevelName= 0; nn.nLevelNames= stuff->nTypes; } if (stuff->which&XkbIndicatorNamesMask) { tmp= _XkbCopyMaskedAtoms(tmp,names->indicators,XkbNumIndicators, stuff->indicators); nn.changedIndicators= stuff->indicators; } if (stuff->which&XkbVirtualModNamesMask) { tmp= _XkbCopyMaskedAtoms(tmp,names->vmods,XkbNumVirtualMods, stuff->virtualMods); nn.changedVirtualMods= stuff->virtualMods; } if (stuff->which&XkbGroupNamesMask) { tmp= _XkbCopyMaskedAtoms(tmp,names->groups,XkbNumKbdGroups, stuff->groupNames); nn.changedVirtualMods= stuff->groupNames; } if (stuff->which&XkbKeyNamesMask) { memcpy((char*)&names->keys[stuff->firstKey],(char *)tmp, stuff->nKeys*XkbKeyNameLength); tmp+= stuff->nKeys; nn.firstKey= stuff->firstKey; nn.nKeys= stuff->nKeys; } if (stuff->which&XkbKeyAliasesMask) { if (stuff->nKeyAliases>0) { register int na= stuff->nKeyAliases; if (XkbAllocNames(xkb,XkbKeyAliasesMask,0,na)!=Success) return BadAlloc; memcpy((char *)names->key_aliases,(char *)tmp, stuff->nKeyAliases*sizeof(XkbKeyAliasRec)); tmp+= stuff->nKeyAliases*2; } else if (names->key_aliases!=NULL) { _XkbFree(names->key_aliases); names->key_aliases= NULL; names->num_key_aliases= 0; } nn.nAliases= names->num_key_aliases; } if (stuff->which&XkbRGNamesMask) { if (stuff->nRadioGroups>0) { register unsigned i,nrg; nrg= stuff->nRadioGroups; if (XkbAllocNames(xkb,XkbRGNamesMask,nrg,0)!=Success) return BadAlloc; for (i=0;inRadioGroups;i++) { names->radio_groups[i]= tmp[i]; } tmp+= stuff->nRadioGroups; } else if (names->radio_groups) { _XkbFree(names->radio_groups); names->radio_groups= NULL; names->num_rg= 0; } nn.nRadioGroups= names->num_rg; } if (nn.changed) { Bool needExtEvent; needExtEvent= (nn.changed&XkbIndicatorNamesMask)!=0; XkbSendNamesNotify(dev,&nn); if (needExtEvent) { XkbSrvLedInfoPtr sli; xkbExtensionDeviceNotify edev; register int i; register unsigned bit; sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId, XkbXI_IndicatorsMask); sli->namesPresent= 0; for (i=0,bit=1;iindicators[i]!=None) sli->namesPresent|= bit; } bzero(&edev,sizeof(xkbExtensionDeviceNotify)); edev.reason= XkbXI_IndicatorNamesMask; edev.ledClass= KbdFeedbackClass; edev.ledID= dev->kbdfeed->ctrl.id; edev.ledsDefined= sli->namesPresent|sli->mapsPresent; edev.ledState= sli->effectiveState; edev.firstBtn= 0; edev.nBtns= 0; edev.supported= XkbXI_AllFeaturesMask; edev.unsupported= 0; XkbSendExtensionDeviceNotify(dev,client,&edev); } } return client->noClientException; } /***====================================================================***/ #include "xkbgeom.h" #define XkbSizeCountedString(s) ((s)?((((2+strlen(s))+3)/4)*4):4) static char * XkbWriteCountedString(char *wire,char *str,Bool swap) { CARD16 len,*pLen, paddedLen; len= (str?strlen(str):0); pLen= (CARD16 *)wire; *pLen= len; if (swap) { swaps(pLen); } paddedLen= pad_to_int32(sizeof(len)+len)-sizeof(len); strncpy(&wire[sizeof(len)],str,paddedLen); wire+= sizeof(len)+paddedLen; return wire; } static int XkbSizeGeomProperties(XkbGeometryPtr geom) { register int i,size; XkbPropertyPtr prop; for (size=i=0,prop=geom->properties;inum_properties;i++,prop++) { size+= XkbSizeCountedString(prop->name); size+= XkbSizeCountedString(prop->value); } return size; } static char * XkbWriteGeomProperties(char *wire,XkbGeometryPtr geom,Bool swap) { register int i; register XkbPropertyPtr prop; for (i=0,prop=geom->properties;inum_properties;i++,prop++) { wire= XkbWriteCountedString(wire,prop->name,swap); wire= XkbWriteCountedString(wire,prop->value,swap); } return wire; } static int XkbSizeGeomKeyAliases(XkbGeometryPtr geom) { return geom->num_key_aliases*(2*XkbKeyNameLength); } static char * XkbWriteGeomKeyAliases(char *wire,XkbGeometryPtr geom,Bool swap) { register int sz; sz= geom->num_key_aliases*(XkbKeyNameLength*2); if (sz>0) { memcpy(wire,(char *)geom->key_aliases,sz); wire+= sz; } return wire; } static int XkbSizeGeomColors(XkbGeometryPtr geom) { register int i,size; register XkbColorPtr color; for (i=size=0,color=geom->colors;inum_colors;i++,color++) { size+= XkbSizeCountedString(color->spec); } return size; } static char * XkbWriteGeomColors(char *wire,XkbGeometryPtr geom,Bool swap) { register int i; register XkbColorPtr color; for (i=0,color=geom->colors;inum_colors;i++,color++) { wire= XkbWriteCountedString(wire,color->spec,swap); } return wire; } static int XkbSizeGeomShapes(XkbGeometryPtr geom) { register int i,size; register XkbShapePtr shape; for (i=size=0,shape=geom->shapes;inum_shapes;i++,shape++) { register int n; register XkbOutlinePtr ol; size+= SIZEOF(xkbShapeWireDesc); for (n=0,ol=shape->outlines;nnum_outlines;n++,ol++) { size+= SIZEOF(xkbOutlineWireDesc); size+= ol->num_points*SIZEOF(xkbPointWireDesc); } } return size; } static char * XkbWriteGeomShapes(char *wire,XkbGeometryPtr geom,Bool swap) { int i; XkbShapePtr shape; xkbShapeWireDesc * shapeWire; for (i=0,shape=geom->shapes;inum_shapes;i++,shape++) { register int o; XkbOutlinePtr ol; xkbOutlineWireDesc * olWire; shapeWire= (xkbShapeWireDesc *)wire; shapeWire->name= shape->name; shapeWire->nOutlines= shape->num_outlines; if (shape->primary!=NULL) shapeWire->primaryNdx= XkbOutlineIndex(shape,shape->primary); else shapeWire->primaryNdx= XkbNoShape; if (shape->approx!=NULL) shapeWire->approxNdx= XkbOutlineIndex(shape,shape->approx); else shapeWire->approxNdx= XkbNoShape; shapeWire->pad= 0; if (swap) { swapl(&shapeWire->name); } wire= (char *)&shapeWire[1]; for (o=0,ol=shape->outlines;onum_outlines;o++,ol++) { register int p; XkbPointPtr pt; xkbPointWireDesc * ptWire; olWire= (xkbOutlineWireDesc *)wire; olWire->nPoints= ol->num_points; olWire->cornerRadius= ol->corner_radius; olWire->pad= 0; wire= (char *)&olWire[1]; ptWire= (xkbPointWireDesc *)wire; for (p=0,pt=ol->points;pnum_points;p++,pt++) { ptWire[p].x= pt->x; ptWire[p].y= pt->y; if (swap) { swaps(&ptWire[p].x); swaps(&ptWire[p].y); } } wire= (char *)&ptWire[ol->num_points]; } } return wire; } static int XkbSizeGeomDoodads(int num_doodads,XkbDoodadPtr doodad) { register int i,size; for (i=size=0;iany.type==XkbTextDoodad) { size+= XkbSizeCountedString(doodad->text.text); size+= XkbSizeCountedString(doodad->text.font); } else if (doodad->any.type==XkbLogoDoodad) { size+= XkbSizeCountedString(doodad->logo.logo_name); } } return size; } static char * XkbWriteGeomDoodads(char *wire,int num_doodads,XkbDoodadPtr doodad,Bool swap) { register int i; xkbDoodadWireDesc * doodadWire; for (i=0;iany.name= doodad->any.name; doodadWire->any.type= doodad->any.type; doodadWire->any.priority= doodad->any.priority; doodadWire->any.top= doodad->any.top; doodadWire->any.left= doodad->any.left; if (swap) { swapl(&doodadWire->any.name); swaps(&doodadWire->any.top); swaps(&doodadWire->any.left); } switch (doodad->any.type) { case XkbOutlineDoodad: case XkbSolidDoodad: doodadWire->shape.angle= doodad->shape.angle; doodadWire->shape.colorNdx= doodad->shape.color_ndx; doodadWire->shape.shapeNdx= doodad->shape.shape_ndx; if (swap) { swaps(&doodadWire->shape.angle); } break; case XkbTextDoodad: doodadWire->text.angle= doodad->text.angle; doodadWire->text.width= doodad->text.width; doodadWire->text.height= doodad->text.height; doodadWire->text.colorNdx= doodad->text.color_ndx; if (swap) { swaps(&doodadWire->text.angle); swaps(&doodadWire->text.width); swaps(&doodadWire->text.height); } wire= XkbWriteCountedString(wire,doodad->text.text,swap); wire= XkbWriteCountedString(wire,doodad->text.font,swap); break; case XkbIndicatorDoodad: doodadWire->indicator.shapeNdx= doodad->indicator.shape_ndx; doodadWire->indicator.onColorNdx=doodad->indicator.on_color_ndx; doodadWire->indicator.offColorNdx= doodad->indicator.off_color_ndx; break; case XkbLogoDoodad: doodadWire->logo.angle= doodad->logo.angle; doodadWire->logo.colorNdx= doodad->logo.color_ndx; doodadWire->logo.shapeNdx= doodad->logo.shape_ndx; wire= XkbWriteCountedString(wire,doodad->logo.logo_name,swap); break; default: ErrorF("Unknown doodad type %d in XkbWriteGeomDoodads\n", doodad->any.type); ErrorF("Ignored\n"); break; } } return wire; } static char * XkbWriteGeomOverlay(char *wire,XkbOverlayPtr ol,Bool swap) { register int r; XkbOverlayRowPtr row; xkbOverlayWireDesc * olWire; olWire= (xkbOverlayWireDesc *)wire; olWire->name= ol->name; olWire->nRows= ol->num_rows; olWire->pad1= 0; olWire->pad2= 0; if (swap) { swapl(&olWire->name); } wire= (char *)&olWire[1]; for (r=0,row=ol->rows;rnum_rows;r++,row++) { unsigned int k; XkbOverlayKeyPtr key; xkbOverlayRowWireDesc * rowWire; rowWire= (xkbOverlayRowWireDesc *)wire; rowWire->rowUnder= row->row_under; rowWire->nKeys= row->num_keys; rowWire->pad1= 0; wire= (char *)&rowWire[1]; for (k=0,key=row->keys;knum_keys;k++,key++) { xkbOverlayKeyWireDesc * keyWire; keyWire= (xkbOverlayKeyWireDesc *)wire; memcpy(keyWire->over,key->over.name,XkbKeyNameLength); memcpy(keyWire->under,key->under.name,XkbKeyNameLength); wire= (char *)&keyWire[1]; } } return wire; } static int XkbSizeGeomSections(XkbGeometryPtr geom) { register int i,size; XkbSectionPtr section; for (i=size=0,section=geom->sections;inum_sections;i++,section++) { size+= SIZEOF(xkbSectionWireDesc); if (section->rows) { int r; XkbRowPtr row; for (r=0,row=section->rows;rnum_rows;row++,r++) { size+= SIZEOF(xkbRowWireDesc); size+= row->num_keys*SIZEOF(xkbKeyWireDesc); } } if (section->doodads) size+= XkbSizeGeomDoodads(section->num_doodads,section->doodads); if (section->overlays) { int o; XkbOverlayPtr ol; for (o=0,ol=section->overlays;onum_overlays;o++,ol++) { int r; XkbOverlayRowPtr row; size+= SIZEOF(xkbOverlayWireDesc); for (r=0,row=ol->rows;rnum_rows;r++,row++) { size+= SIZEOF(xkbOverlayRowWireDesc); size+= row->num_keys*SIZEOF(xkbOverlayKeyWireDesc); } } } } return size; } static char * XkbWriteGeomSections(char *wire,XkbGeometryPtr geom,Bool swap) { register int i; XkbSectionPtr section; xkbSectionWireDesc * sectionWire; for (i=0,section=geom->sections;inum_sections;i++,section++) { sectionWire= (xkbSectionWireDesc *)wire; sectionWire->name= section->name; sectionWire->top= section->top; sectionWire->left= section->left; sectionWire->width= section->width; sectionWire->height= section->height; sectionWire->angle= section->angle; sectionWire->priority= section->priority; sectionWire->nRows= section->num_rows; sectionWire->nDoodads= section->num_doodads; sectionWire->nOverlays= section->num_overlays; sectionWire->pad= 0; if (swap) { swapl(§ionWire->name); swaps(§ionWire->top); swaps(§ionWire->left); swaps(§ionWire->width); swaps(§ionWire->height); swaps(§ionWire->angle); } wire= (char *)§ionWire[1]; if (section->rows) { int r; XkbRowPtr row; xkbRowWireDesc * rowWire; for (r=0,row=section->rows;rnum_rows;r++,row++) { rowWire= (xkbRowWireDesc *)wire; rowWire->top= row->top; rowWire->left= row->left; rowWire->nKeys= row->num_keys; rowWire->vertical= row->vertical; rowWire->pad= 0; if (swap) { swaps(&rowWire->top); swaps(&rowWire->left); } wire= (char *)&rowWire[1]; if (row->keys) { int k; XkbKeyPtr key; xkbKeyWireDesc * keyWire; keyWire= (xkbKeyWireDesc *)wire; for (k=0,key=row->keys;knum_keys;k++,key++) { memcpy(keyWire[k].name,key->name.name,XkbKeyNameLength); keyWire[k].gap= key->gap; keyWire[k].shapeNdx= key->shape_ndx; keyWire[k].colorNdx= key->color_ndx; if (swap) { swaps(&keyWire[k].gap); } } wire= (char *)&keyWire[row->num_keys]; } } } if (section->doodads) { wire= XkbWriteGeomDoodads(wire, section->num_doodads,section->doodads, swap); } if (section->overlays) { register int o; for (o=0;onum_overlays;o++) { wire= XkbWriteGeomOverlay(wire,§ion->overlays[o],swap); } } } return wire; } static Status XkbComputeGetGeometryReplySize( XkbGeometryPtr geom, xkbGetGeometryReply * rep, Atom name) { int len; if (geom!=NULL) { len= XkbSizeCountedString(geom->label_font); len+= XkbSizeGeomProperties(geom); len+= XkbSizeGeomColors(geom); len+= XkbSizeGeomShapes(geom); len+= XkbSizeGeomSections(geom); len+= XkbSizeGeomDoodads(geom->num_doodads,geom->doodads); len+= XkbSizeGeomKeyAliases(geom); rep->length= len/4; rep->found= True; rep->name= geom->name; rep->widthMM= geom->width_mm; rep->heightMM= geom->height_mm; rep->nProperties= geom->num_properties; rep->nColors= geom->num_colors; rep->nShapes= geom->num_shapes; rep->nSections= geom->num_sections; rep->nDoodads= geom->num_doodads; rep->nKeyAliases= geom->num_key_aliases; rep->baseColorNdx= XkbGeomColorIndex(geom,geom->base_color); rep->labelColorNdx= XkbGeomColorIndex(geom,geom->label_color); } else { rep->length= 0; rep->found= False; rep->name= name; rep->widthMM= rep->heightMM= 0; rep->nProperties= rep->nColors= rep->nShapes= 0; rep->nSections= rep->nDoodads= 0; rep->nKeyAliases= 0; rep->labelColorNdx= rep->baseColorNdx= 0; } return Success; } static int XkbSendGeometry( ClientPtr client, XkbGeometryPtr geom, xkbGetGeometryReply * rep, Bool freeGeom) { char *desc,*start; int len; if (geom!=NULL) { len= rep->length*4; start= desc= (char *)malloc(len); if (!start) return BadAlloc; desc= XkbWriteCountedString(desc,geom->label_font,client->swapped); if ( rep->nProperties>0 ) desc = XkbWriteGeomProperties(desc,geom,client->swapped); if ( rep->nColors>0 ) desc = XkbWriteGeomColors(desc,geom,client->swapped); if ( rep->nShapes>0 ) desc = XkbWriteGeomShapes(desc,geom,client->swapped); if ( rep->nSections>0 ) desc = XkbWriteGeomSections(desc,geom,client->swapped); if ( rep->nDoodads>0 ) desc = XkbWriteGeomDoodads(desc,geom->num_doodads,geom->doodads, client->swapped); if ( rep->nKeyAliases>0 ) desc = XkbWriteGeomKeyAliases(desc,geom,client->swapped); if ((desc-start)!=(len)) { ErrorF("BOGUS LENGTH in XkbSendGeometry, expected %d, got %ld\n", len, (unsigned long)(desc-start)); } } else { len= 0; start= NULL; } if (client->swapped) { swaps(&rep->sequenceNumber); swapl(&rep->length); swapl(&rep->name); swaps(&rep->widthMM); swaps(&rep->heightMM); swaps(&rep->nProperties); swaps(&rep->nColors); swaps(&rep->nShapes); swaps(&rep->nSections); swaps(&rep->nDoodads); swaps(&rep->nKeyAliases); } WriteToClient(client, SIZEOF(xkbGetGeometryReply), rep); if (len>0) WriteToClient(client, len, start); if (start!=NULL) free((char *)start); if (freeGeom) XkbFreeGeometry(geom,XkbGeomAllMask,True); return client->noClientException; } int ProcXkbGetGeometry(ClientPtr client) { DeviceIntPtr dev; xkbGetGeometryReply rep = {0}; XkbGeometryPtr geom; Bool shouldFree; Status status; REQUEST(xkbGetGeometryReq); REQUEST_SIZE_MATCH(xkbGetGeometryReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); CHK_ATOM_OR_NONE(stuff->name); geom= XkbLookupNamedGeometry(dev,stuff->name,&shouldFree); rep.type= X_Reply; rep.deviceID= dev->id; rep.sequenceNumber= client->sequence; rep.length= 0; status= XkbComputeGetGeometryReplySize(geom,&rep,stuff->name); if (status!=Success) return status; else return XkbSendGeometry(client,geom,&rep,shouldFree); } /***====================================================================***/ static Status _GetCountedString(char **wire_inout, ClientPtr client, char **str) { char * wire, *next; CARD16 len; wire= *wire_inout; len = *(CARD16 *) wire; if (client->swapped) { swaps(&len); } next = wire + XkbPaddedSize(len + 2); /* Check we're still within the size of the request */ if (client->req_len < bytes_to_int32(next - (char *) client->requestBuffer)) return BadValue; *str = malloc(len + 1); if (!*str) return BadAlloc; memcpy(*str, &wire[2], len); *(*str + len) = '\0'; *wire_inout = next; return Success; } static Status _CheckSetDoodad( char ** wire_inout, XkbGeometryPtr geom, XkbSectionPtr section, ClientPtr client) { char * wire; xkbDoodadWireDesc * dWire; xkbAnyDoodadWireDesc any; xkbTextDoodadWireDesc text; XkbDoodadPtr doodad; Status status; dWire= (xkbDoodadWireDesc *)(*wire_inout); any = dWire->any; wire= (char *)&dWire[1]; if (client->swapped) { swapl(&any.name); swaps(&any.top); swaps(&any.left); swaps(&any.angle); } CHK_ATOM_ONLY(dWire->any.name); doodad = XkbAddGeomDoodad(geom, section, any.name); if (!doodad) return BadAlloc; doodad->any.type= dWire->any.type; doodad->any.priority= dWire->any.priority; doodad->any.top = any.top; doodad->any.left = any.left; doodad->any.angle = any.angle; switch (doodad->any.type) { case XkbOutlineDoodad: case XkbSolidDoodad: if (dWire->shape.colorNdx>=geom->num_colors) { client->errorValue= _XkbErrCode3(0x40,geom->num_colors, dWire->shape.colorNdx); return BadMatch; } if (dWire->shape.shapeNdx>=geom->num_shapes) { client->errorValue= _XkbErrCode3(0x41,geom->num_shapes, dWire->shape.shapeNdx); return BadMatch; } doodad->shape.color_ndx= dWire->shape.colorNdx; doodad->shape.shape_ndx= dWire->shape.shapeNdx; break; case XkbTextDoodad: if (dWire->text.colorNdx>=geom->num_colors) { client->errorValue= _XkbErrCode3(0x42,geom->num_colors, dWire->text.colorNdx); return BadMatch; } text = dWire->text; if (client->swapped) { swaps(&text.width); swaps(&text.height); } doodad->text.width= text.width; doodad->text.height= text.height; doodad->text.color_ndx= dWire->text.colorNdx; status = _GetCountedString(&wire, client, &doodad->text.text); if (status != Success) return status; status = _GetCountedString(&wire, client, &doodad->text.font); if (status != Success) { free (doodad->text.text); return status; } break; case XkbIndicatorDoodad: if (dWire->indicator.onColorNdx>=geom->num_colors) { client->errorValue= _XkbErrCode3(0x43,geom->num_colors, dWire->indicator.onColorNdx); return BadMatch; } if (dWire->indicator.offColorNdx>=geom->num_colors) { client->errorValue= _XkbErrCode3(0x44,geom->num_colors, dWire->indicator.offColorNdx); return BadMatch; } if (dWire->indicator.shapeNdx>=geom->num_shapes) { client->errorValue= _XkbErrCode3(0x45,geom->num_shapes, dWire->indicator.shapeNdx); return BadMatch; } doodad->indicator.shape_ndx= dWire->indicator.shapeNdx; doodad->indicator.on_color_ndx= dWire->indicator.onColorNdx; doodad->indicator.off_color_ndx= dWire->indicator.offColorNdx; break; case XkbLogoDoodad: if (dWire->logo.colorNdx>=geom->num_colors) { client->errorValue= _XkbErrCode3(0x46,geom->num_colors, dWire->logo.colorNdx); return BadMatch; } if (dWire->logo.shapeNdx>=geom->num_shapes) { client->errorValue= _XkbErrCode3(0x47,geom->num_shapes, dWire->logo.shapeNdx); return BadMatch; } doodad->logo.color_ndx= dWire->logo.colorNdx; doodad->logo.shape_ndx= dWire->logo.shapeNdx; status = _GetCountedString(&wire, client, &doodad->logo.logo_name); if (status != Success) return status; break; default: client->errorValue= _XkbErrCode2(0x4F,dWire->any.type); return BadValue; } *wire_inout= wire; return Success; } static Status _CheckSetOverlay( char ** wire_inout, XkbGeometryPtr geom, XkbSectionPtr section, ClientPtr client) { register int r; char * wire; XkbOverlayPtr ol; xkbOverlayWireDesc * olWire; xkbOverlayRowWireDesc * rWire; wire= *wire_inout; olWire= (xkbOverlayWireDesc *)wire; if (client->swapped) { swapl(&olWire->name); } CHK_ATOM_ONLY(olWire->name); ol= XkbAddGeomOverlay(section,olWire->name,olWire->nRows); rWire= (xkbOverlayRowWireDesc *)&olWire[1]; for (r=0;rnRows;r++) { register int k; xkbOverlayKeyWireDesc * kWire; XkbOverlayRowPtr row; if (rWire->rowUnder>section->num_rows) { client->errorValue= _XkbErrCode4(0x20,r,section->num_rows, rWire->rowUnder); return BadMatch; } row= XkbAddGeomOverlayRow(ol,rWire->rowUnder,rWire->nKeys); kWire= (xkbOverlayKeyWireDesc *)&rWire[1]; for (k=0;knKeys;k++,kWire++) { if (XkbAddGeomOverlayKey(ol,row, (char *)kWire->over,(char *)kWire->under)==NULL) { client->errorValue= _XkbErrCode3(0x21,r,k); return BadMatch; } } rWire= (xkbOverlayRowWireDesc *)kWire; } olWire= (xkbOverlayWireDesc *)rWire; wire= (char *)olWire; *wire_inout= wire; return Success; } static Status _CheckSetSections( XkbGeometryPtr geom, xkbSetGeometryReq * req, char ** wire_inout, ClientPtr client) { Status status; register int s; char * wire; xkbSectionWireDesc * sWire; XkbSectionPtr section; wire= *wire_inout; if (req->nSections<1) return Success; sWire= (xkbSectionWireDesc *)wire; for (s=0;snSections;s++) { register int r; xkbRowWireDesc * rWire; if (client->swapped) { swapl(&sWire->name); swaps(&sWire->top); swaps(&sWire->left); swaps(&sWire->width); swaps(&sWire->height); swaps(&sWire->angle); } CHK_ATOM_ONLY(sWire->name); section= XkbAddGeomSection(geom,sWire->name,sWire->nRows, sWire->nDoodads,sWire->nOverlays); if (!section) return BadAlloc; section->priority= sWire->priority; section->top= sWire->top; section->left= sWire->left; section->width= sWire->width; section->height= sWire->height; section->angle= sWire->angle; rWire= (xkbRowWireDesc *)&sWire[1]; for (r=0;rnRows;r++) { register int k; XkbRowPtr row; xkbKeyWireDesc * kWire; if (client->swapped) { swaps(&rWire->top); swaps(&rWire->left); } row= XkbAddGeomRow(section,rWire->nKeys); if (!row) return BadAlloc; row->top= rWire->top; row->left= rWire->left; row->vertical= rWire->vertical; kWire= (xkbKeyWireDesc *)&rWire[1]; for (k=0;knKeys;k++) { XkbKeyPtr key; key= XkbAddGeomKey(row); if (!key) return BadAlloc; memcpy(key->name.name,kWire[k].name,XkbKeyNameLength); key->gap= kWire[k].gap; key->shape_ndx= kWire[k].shapeNdx; key->color_ndx= kWire[k].colorNdx; if (key->shape_ndx>=geom->num_shapes) { client->errorValue= _XkbErrCode3(0x10,key->shape_ndx, geom->num_shapes); return BadMatch; } if (key->color_ndx>=geom->num_colors) { client->errorValue= _XkbErrCode3(0x11,key->color_ndx, geom->num_colors); return BadMatch; } } rWire= (xkbRowWireDesc *)&kWire[rWire->nKeys]; } wire= (char *)rWire; if (sWire->nDoodads>0) { register int d; for (d=0;dnDoodads;d++) { status=_CheckSetDoodad(&wire,geom,section,client); if (status!=Success) return status; } } if (sWire->nOverlays>0) { register int o; for (o=0;onOverlays;o++) { status= _CheckSetOverlay(&wire,geom,section,client); if (status!=Success) return status; } } sWire= (xkbSectionWireDesc *)wire; } wire= (char *)sWire; *wire_inout= wire; return Success; } static Status _CheckSetShapes( XkbGeometryPtr geom, xkbSetGeometryReq * req, char ** wire_inout, ClientPtr client) { register int i; char * wire; wire= *wire_inout; if (req->nShapes<1) { client->errorValue= _XkbErrCode2(0x06,req->nShapes); return BadValue; } else { xkbShapeWireDesc * shapeWire; XkbShapePtr shape; register int o; shapeWire= (xkbShapeWireDesc *)wire; for (i=0;inShapes;i++) { xkbOutlineWireDesc * olWire; XkbOutlinePtr ol; shape= XkbAddGeomShape(geom,shapeWire->name,shapeWire->nOutlines); if (!shape) return BadAlloc; olWire= (xkbOutlineWireDesc *)(&shapeWire[1]); for (o=0;onOutlines;o++) { register int p; XkbPointPtr pt; xkbPointWireDesc * ptWire; ol= XkbAddGeomOutline(shape,olWire->nPoints); if (!ol) return BadAlloc; ol->corner_radius= olWire->cornerRadius; ptWire= (xkbPointWireDesc *)&olWire[1]; for (p=0,pt=ol->points;pnPoints;p++,pt++) { pt->x= ptWire[p].x; pt->y= ptWire[p].y; if (client->swapped) { swaps(&pt->x); swaps(&pt->y); } } ol->num_points= olWire->nPoints; olWire= (xkbOutlineWireDesc *)(&ptWire[olWire->nPoints]); } if (shapeWire->primaryNdx!=XkbNoShape) shape->primary= &shape->outlines[shapeWire->primaryNdx]; if (shapeWire->approxNdx!=XkbNoShape) shape->approx= &shape->outlines[shapeWire->approxNdx]; shapeWire= (xkbShapeWireDesc *)olWire; } wire= (char *)shapeWire; } if (geom->num_shapes!=req->nShapes) { client->errorValue= _XkbErrCode3(0x07,geom->num_shapes,req->nShapes); return BadMatch; } *wire_inout= wire; return Success; } static Status _CheckSetGeom( XkbGeometryPtr geom, xkbSetGeometryReq * req, ClientPtr client) { register int i; Status status; char * wire; wire= (char *)&req[1]; status = _GetCountedString(&wire, client, &geom->label_font); if (status != Success) return status; for (i=0;inProperties;i++) { char *name,*val; status = _GetCountedString(&wire, client, &name); if (status != Success) return status; status = _GetCountedString(&wire, client, &val); if (status != Success) { free(name); return status; } if (XkbAddGeomProperty(geom,name,val)==NULL) { free(name); free(val); return BadAlloc; } free(name); free(val); } if (req->nColors<2) { client->errorValue= _XkbErrCode3(0x01,2,req->nColors); return BadValue; } if (req->baseColorNdx>req->nColors) { client->errorValue=_XkbErrCode3(0x03,req->nColors,req->baseColorNdx); return BadMatch; } if (req->labelColorNdx>req->nColors) { client->errorValue= _XkbErrCode3(0x03,req->nColors,req->labelColorNdx); return BadMatch; } if (req->labelColorNdx==req->baseColorNdx) { client->errorValue= _XkbErrCode3(0x04,req->baseColorNdx, req->labelColorNdx); return BadMatch; } for (i=0;inColors;i++) { char *name; status = _GetCountedString(&wire, client, &name); if (status != Success) return status; if (!XkbAddGeomColor(geom,name,geom->num_colors)) { free(name); return BadAlloc; } free(name); } if (req->nColors!=geom->num_colors) { client->errorValue= _XkbErrCode3(0x05,req->nColors,geom->num_colors); return BadMatch; } geom->label_color= &geom->colors[req->labelColorNdx]; geom->base_color= &geom->colors[req->baseColorNdx]; if ((status=_CheckSetShapes(geom,req,&wire,client))!=Success) return status; if ((status=_CheckSetSections(geom,req,&wire,client))!=Success) return status; for (i=0;inDoodads;i++) { status=_CheckSetDoodad(&wire,geom,NULL,client); if (status!=Success) return status; } for (i=0;inKeyAliases;i++) { if (XkbAddGeomKeyAlias(geom,&wire[XkbKeyNameLength],wire)==NULL) return BadAlloc; wire+= 2*XkbKeyNameLength; } return Success; } int ProcXkbSetGeometry(ClientPtr client) { DeviceIntPtr dev; XkbGeometryPtr geom,old; XkbGeometrySizesRec sizes; Status status; XkbDescPtr xkb; Bool new_name; xkbNewKeyboardNotify nkn; REQUEST(xkbSetGeometryReq); REQUEST_AT_LEAST_SIZE(xkbSetGeometryReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); CHK_ATOM_OR_NONE(stuff->name); xkb= dev->key->xkbInfo->desc; old= xkb->geom; xkb->geom= NULL; sizes.which= XkbGeomAllMask; sizes.num_properties= stuff->nProperties; sizes.num_colors= stuff->nColors; sizes.num_shapes= stuff->nShapes; sizes.num_sections= stuff->nSections; sizes.num_doodads= stuff->nDoodads; sizes.num_key_aliases= stuff->nKeyAliases; if ((status= XkbAllocGeometry(xkb,&sizes))!=Success) { xkb->geom= old; return status; } geom= xkb->geom; geom->name= stuff->name; geom->width_mm= stuff->widthMM; geom->height_mm= stuff->heightMM; if ((status= _CheckSetGeom(geom,stuff,client))!=Success) { XkbFreeGeometry(geom,XkbGeomAllMask,True); xkb->geom= old; return status; } new_name= (xkb->names->geometry!=geom->name); xkb->names->geometry= geom->name; if (old) XkbFreeGeometry(old,XkbGeomAllMask,True); if (new_name) { xkbNamesNotify nn; bzero(&nn,sizeof(xkbNamesNotify)); nn.changed= XkbGeometryNameMask; XkbSendNamesNotify(dev,&nn); } memset(&nkn, 0, sizeof(xkbNewKeyboardNotify)); nkn.deviceID= nkn.oldDeviceID= dev->id; nkn.minKeyCode= nkn.oldMinKeyCode= xkb->min_key_code; nkn.maxKeyCode= nkn.oldMaxKeyCode= xkb->max_key_code; nkn.requestMajor= XkbReqCode; nkn.requestMinor= X_kbSetGeometry; nkn.changed= XkbNKN_GeometryMask; XkbSendNewKeyboardNotify(dev,&nkn); return Success; } /***====================================================================***/ int ProcXkbPerClientFlags(ClientPtr client) { DeviceIntPtr dev; xkbPerClientFlagsReply rep = {0}; XkbInterestPtr interest; REQUEST(xkbPerClientFlagsReq); REQUEST_SIZE_MATCH(xkbPerClientFlagsReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); CHK_MASK_LEGAL(0x01,stuff->change,XkbPCF_AllFlagsMask); CHK_MASK_MATCH(0x02,stuff->change,stuff->value); interest = XkbFindClientResource((DevicePtr)dev,client); rep.type= X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; if (stuff->change) { client->xkbClientFlags&= ~stuff->change; client->xkbClientFlags|= stuff->value; } if (stuff->change&XkbPCF_AutoResetControlsMask) { Bool want; want= stuff->value&XkbPCF_AutoResetControlsMask; if (interest && !want) { interest->autoCtrls= interest->autoCtrlValues= 0; } else if (want && (!interest)) { XID id = FakeClientID(client->index); AddResource(id,RT_XKBCLIENT,dev); interest= XkbAddClientResource((DevicePtr)dev,client,id); if (!interest) return BadAlloc; } if (interest && want ) { register unsigned affect; affect= stuff->ctrlsToChange; CHK_MASK_LEGAL(0x03,affect,XkbAllBooleanCtrlsMask); CHK_MASK_MATCH(0x04,affect,stuff->autoCtrls); CHK_MASK_MATCH(0x05,stuff->autoCtrls,stuff->autoCtrlValues); interest->autoCtrls&= ~affect; interest->autoCtrlValues&= ~affect; interest->autoCtrls|= stuff->autoCtrls&affect; interest->autoCtrlValues|= stuff->autoCtrlValues&affect; } } rep.supported = XkbPCF_AllFlagsMask; rep.value= client->xkbClientFlags&XkbPCF_AllFlagsMask; if (interest) { rep.autoCtrls= interest->autoCtrls; rep.autoCtrlValues= interest->autoCtrlValues; } else { rep.autoCtrls= rep.autoCtrlValues= 0; } if ( client->swapped ) { swaps(&rep.sequenceNumber); swapl(&rep.supported); swapl(&rep.value); swapl(&rep.autoCtrls); swapl(&rep.autoCtrlValues); } WriteToClient(client,SIZEOF(xkbPerClientFlagsReply), &rep); return client->noClientException; } /***====================================================================***/ /* all latin-1 alphanumerics, plus parens, minus, underscore, slash */ /* and wildcards */ static unsigned char componentSpecLegal[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff }; /* same as above but accepts percent, plus and bar too */ static unsigned char componentExprLegal[] = { 0x00, 0x00, 0x00, 0x00, 0x20, 0xaf, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff }; static char * GetComponentSpec(unsigned char **pWire,Bool allowExpr,int *errRtrn) { int len; register int i; unsigned char *wire,*str,*tmp,*legal; if (allowExpr) legal= &componentExprLegal[0]; else legal= &componentSpecLegal[0]; wire= *pWire; len= (*(unsigned char *)wire++); if (len>0) { str= (unsigned char *)_XkbCalloc(1, len+1); if (str) { tmp= str; for (i=0;ixkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); status= Success; str= (unsigned char *)&stuff[1]; bzero(&list,sizeof(XkbSrvListInfoRec)); list.maxRtrn= stuff->maxNames; list.pattern[_XkbListKeymaps]= GetComponentSpec(&str,False,&status); list.pattern[_XkbListKeycodes]= GetComponentSpec(&str,False,&status); list.pattern[_XkbListTypes]= GetComponentSpec(&str,False,&status); list.pattern[_XkbListCompat]= GetComponentSpec(&str,False,&status); list.pattern[_XkbListSymbols]= GetComponentSpec(&str,False,&status); list.pattern[_XkbListGeometry]= GetComponentSpec(&str,False,&status); if (status!=Success) return status; len= str-((unsigned char *)stuff); if ((XkbPaddedSize(len)/4)!=stuff->length) return BadLength; if ((status=XkbDDXList(dev,&list,client))!=Success) { if (list.pool) { _XkbFree(list.pool); list.pool= NULL; } return status; } rep.type= X_Reply; rep.deviceID = dev->id; rep.sequenceNumber = client->sequence; rep.length = XkbPaddedSize(list.nPool)/4; rep.nKeymaps = list.nFound[_XkbListKeymaps]; rep.nKeycodes = list.nFound[_XkbListKeycodes]; rep.nTypes = list.nFound[_XkbListTypes]; rep.nCompatMaps = list.nFound[_XkbListCompat]; rep.nSymbols = list.nFound[_XkbListSymbols]; rep.nGeometries = list.nFound[_XkbListGeometry]; rep.extra= 0; if (list.nTotal>list.maxRtrn) rep.extra = (list.nTotal-list.maxRtrn); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.nKeymaps); swaps(&rep.nKeycodes); swaps(&rep.nTypes); swaps(&rep.nCompatMaps); swaps(&rep.nSymbols); swaps(&rep.nGeometries); swaps(&rep.extra); } WriteToClient(client,SIZEOF(xkbListComponentsReply),&rep); if (list.nPool && list.pool) { WriteToClient(client,XkbPaddedSize(list.nPool), list.pool); _XkbFree(list.pool); list.pool= NULL; } return client->noClientException; } /***====================================================================***/ int ProcXkbGetKbdByName(ClientPtr client) { DeviceIntPtr dev; XkbFileInfo finfo; xkbGetKbdByNameReply rep = {0}; xkbGetMapReply mrep = {0}; xkbGetCompatMapReply crep = {0}; xkbGetIndicatorMapReply irep = {0}; xkbGetNamesReply nrep = {0}; xkbGetGeometryReply grep = {0}; XkbComponentNamesRec names = {0}; XkbDescPtr xkb; unsigned char * str; char mapFile[PATH_MAX]; unsigned len; unsigned fwant,fneed,reported; int status; Bool geom_changed; REQUEST(xkbGetKbdByNameReq); REQUEST_AT_LEAST_SIZE(xkbGetKbdByNameReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev,stuff->deviceSpec); xkb = dev->key->xkbInfo->desc; status= Success; str= (unsigned char *)&stuff[1]; names.keymap= GetComponentSpec(&str,True,&status); names.keycodes= GetComponentSpec(&str,True,&status); names.types= GetComponentSpec(&str,True,&status); names.compat= GetComponentSpec(&str,True,&status); names.symbols= GetComponentSpec(&str,True,&status); names.geometry= GetComponentSpec(&str,True,&status); if (status!=Success) return status; len= str-((unsigned char *)stuff); if ((XkbPaddedSize(len)/4)!=stuff->length) return BadLength; CHK_MASK_LEGAL(0x01,stuff->want,XkbGBN_AllComponentsMask); CHK_MASK_LEGAL(0x02,stuff->need,XkbGBN_AllComponentsMask); if (stuff->load) fwant= XkbGBN_AllComponentsMask; else fwant= stuff->want|stuff->need; if (!names.keymap) { if ((!names.compat)&& (fwant&(XkbGBN_CompatMapMask|XkbGBN_IndicatorMapMask))) { names.compat= Xstrdup("%"); } if ((!names.types)&&(fwant&(XkbGBN_TypesMask))) { names.types= Xstrdup("%"); } if ((!names.symbols)&&(fwant&XkbGBN_SymbolsMask)) { names.symbols= Xstrdup("%"); } geom_changed= ((names.geometry!=NULL)&&(strcmp(names.geometry,"%")!=0)); if ((!names.geometry)&&(fwant&XkbGBN_GeometryMask)) { names.geometry= Xstrdup("%"); geom_changed= False; } } else { geom_changed= True; } bzero(mapFile,PATH_MAX); rep.type= X_Reply; rep.deviceID = dev->id; rep.sequenceNumber = client->sequence; rep.length = 0; rep.minKeyCode = xkb->min_key_code; rep.maxKeyCode = xkb->max_key_code; rep.loaded= False; fwant= XkbConvertGetByNameComponents(True,stuff->want)|XkmVirtualModsMask; fneed= XkbConvertGetByNameComponents(True,stuff->need); rep.reported= XkbConvertGetByNameComponents(False,fwant|fneed); if (stuff->load) { fneed|= XkmKeymapRequired; fwant|= XkmKeymapLegal; } if ((fwant|fneed)&XkmSymbolsMask) { fneed|= XkmKeyNamesIndex|XkmTypesIndex; fwant|= XkmIndicatorsIndex; } rep.found = XkbDDXLoadKeymapByNames(dev,&names,fwant,fneed,&finfo, mapFile,PATH_MAX); rep.newKeyboard= False; rep.pad1= rep.pad2= rep.pad3= rep.pad4= 0; stuff->want|= stuff->need; if (finfo.xkb==NULL) rep.reported= 0; else { if (stuff->load) rep.loaded= True; if (stuff->load || ((rep.reported&XkbGBN_SymbolsMask) && (finfo.xkb->compat))) { XkbChangesRec changes; bzero(&changes,sizeof(changes)); XkbUpdateDescActions(finfo.xkb, finfo.xkb->min_key_code,XkbNumKeys(finfo.xkb), &changes); } if (finfo.xkb->map==NULL) rep.reported&= ~(XkbGBN_SymbolsMask|XkbGBN_TypesMask); else if (rep.reported&(XkbGBN_SymbolsMask|XkbGBN_TypesMask)) { mrep.type= X_Reply; mrep.deviceID = dev->id; mrep.sequenceNumber= client->sequence; mrep.length = ((SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply))>>2); mrep.minKeyCode = finfo.xkb->min_key_code; mrep.maxKeyCode = finfo.xkb->max_key_code; mrep.present = 0; mrep.totalSyms = mrep.totalActs = mrep.totalKeyBehaviors= mrep.totalKeyExplicit= mrep.totalModMapKeys= mrep.totalVModMapKeys= 0; if (rep.reported&(XkbGBN_TypesMask|XkbGBN_ClientSymbolsMask)) { mrep.present|= XkbKeyTypesMask; mrep.firstType = 0; mrep.nTypes = mrep.totalTypes= finfo.xkb->map->num_types; } else { mrep.firstType = mrep.nTypes= 0; mrep.totalTypes= 0; } if (rep.reported&XkbGBN_ClientSymbolsMask) { mrep.present|= (XkbKeySymsMask|XkbModifierMapMask); mrep.firstKeySym = mrep.firstModMapKey= finfo.xkb->min_key_code; mrep.nKeySyms = mrep.nModMapKeys= XkbNumKeys(finfo.xkb); } else { mrep.firstKeySym= mrep.firstModMapKey= 0; mrep.nKeySyms= mrep.nModMapKeys= 0; } if (rep.reported&XkbGBN_ServerSymbolsMask) { mrep.present|= XkbAllServerInfoMask; mrep.virtualMods= ~0; mrep.firstKeyAct = mrep.firstKeyBehavior = mrep.firstKeyExplicit = finfo.xkb->min_key_code; mrep.nKeyActs = mrep.nKeyBehaviors = mrep.nKeyExplicit = XkbNumKeys(finfo.xkb); mrep.firstVModMapKey= finfo.xkb->min_key_code; mrep.nVModMapKeys= XkbNumKeys(finfo.xkb); } else { mrep.virtualMods= 0; mrep.firstKeyAct= mrep.firstKeyBehavior= mrep.firstKeyExplicit = 0; mrep.nKeyActs= mrep.nKeyBehaviors= mrep.nKeyExplicit= 0; } XkbComputeGetMapReplySize(finfo.xkb,&mrep); rep.length+= SIZEOF(xGenericReply)/4+mrep.length; } if (finfo.xkb->compat==NULL) rep.reported&= ~XkbGBN_CompatMapMask; else if (rep.reported&XkbGBN_CompatMapMask) { crep.type= X_Reply; crep.deviceID= dev->id; crep.sequenceNumber= client->sequence; crep.length= 0; crep.groups= XkbAllGroupsMask; crep.firstSI= 0; crep.nSI= crep.nTotalSI= finfo.xkb->compat->num_si; XkbComputeGetCompatMapReplySize(finfo.xkb->compat,&crep); rep.length+= SIZEOF(xGenericReply)/4+crep.length; } if (finfo.xkb->indicators==NULL) rep.reported&= ~XkbGBN_IndicatorMapMask; else if (rep.reported&XkbGBN_IndicatorMapMask) { irep.type= X_Reply; irep.deviceID= dev->id; irep.sequenceNumber= client->sequence; irep.length= 0; irep.which= XkbAllIndicatorsMask; XkbComputeGetIndicatorMapReplySize(finfo.xkb->indicators,&irep); rep.length+= SIZEOF(xGenericReply)/4+irep.length; } if (finfo.xkb->names==NULL) rep.reported&= ~(XkbGBN_OtherNamesMask|XkbGBN_KeyNamesMask); else if (rep.reported&(XkbGBN_OtherNamesMask|XkbGBN_KeyNamesMask)) { nrep.type= X_Reply; nrep.deviceID= dev->id; nrep.sequenceNumber= client->sequence; nrep.length= 0; nrep.minKeyCode= finfo.xkb->min_key_code; nrep.maxKeyCode= finfo.xkb->max_key_code; if (rep.reported&XkbGBN_OtherNamesMask) { nrep.which= XkbAllNamesMask; if (finfo.xkb->map!=NULL) nrep.nTypes= finfo.xkb->map->num_types; else nrep.nTypes= 0; nrep.nKTLevels= 0; nrep.groupNames= XkbAllGroupsMask; nrep.virtualMods= XkbAllVirtualModsMask; nrep.indicators= XkbAllIndicatorsMask; nrep.nRadioGroups= finfo.xkb->names->num_rg; } else { nrep.which= 0; nrep.nTypes= 0; nrep.nKTLevels= 0; nrep.groupNames= 0; nrep.virtualMods= 0; nrep.indicators= 0; nrep.nRadioGroups= 0; } if (rep.reported&XkbGBN_KeyNamesMask) { nrep.which|= XkbKeyNamesMask; nrep.firstKey= finfo.xkb->min_key_code; nrep.nKeys= XkbNumKeys(finfo.xkb); nrep.nKeyAliases= finfo.xkb->names->num_key_aliases; if (nrep.nKeyAliases) nrep.which|= XkbKeyAliasesMask; } else { nrep.which&= ~(XkbKeyNamesMask|XkbKeyAliasesMask); nrep.firstKey= nrep.nKeys= 0; nrep.nKeyAliases= 0; } XkbComputeGetNamesReplySize(finfo.xkb,&nrep); rep.length+= SIZEOF(xGenericReply)/4+nrep.length; } if (finfo.xkb->geom==NULL) rep.reported&= ~XkbGBN_GeometryMask; else if (rep.reported&XkbGBN_GeometryMask) { grep.type= X_Reply; grep.deviceID= dev->id; grep.sequenceNumber= client->sequence; grep.length= 0; grep.found= True; grep.pad= 0; grep.widthMM= grep.heightMM= 0; grep.nProperties= grep.nColors= grep.nShapes= 0; grep.nSections= grep.nDoodads= 0; grep.baseColorNdx= grep.labelColorNdx= 0; XkbComputeGetGeometryReplySize(finfo.xkb->geom,&grep,None); rep.length+= SIZEOF(xGenericReply)/4+grep.length; } } reported= rep.reported; if ( client->swapped ) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.found); swaps(&rep.reported); } WriteToClient(client,SIZEOF(xkbGetKbdByNameReply), &rep); if (reported&(XkbGBN_SymbolsMask|XkbGBN_TypesMask)) XkbSendMap(client,finfo.xkb,&mrep); if (reported&XkbGBN_CompatMapMask) XkbSendCompatMap(client,finfo.xkb->compat,&crep); if (reported&XkbGBN_IndicatorMapMask) XkbSendIndicatorMap(client,finfo.xkb->indicators,&irep); if (reported&(XkbGBN_KeyNamesMask|XkbGBN_OtherNamesMask)) XkbSendNames(client,finfo.xkb,&nrep); if (reported&XkbGBN_GeometryMask) XkbSendGeometry(client,finfo.xkb->geom,&grep,False); if (rep.loaded) { XkbDescPtr old_xkb; xkbNewKeyboardNotify nkn; int i,nG,nTG; old_xkb= xkb; xkb= finfo.xkb; dev->key->xkbInfo->desc= xkb; finfo.xkb= old_xkb; /* so it'll get freed automatically */ *xkb->ctrls= *old_xkb->ctrls; for (nG=nTG=0,i=xkb->min_key_code;i<=xkb->max_key_code;i++) { nG= XkbKeyNumGroups(xkb,i); if (nG>=XkbNumKbdGroups) { nTG= XkbNumKbdGroups; break; } if (nG>nTG) { nTG= nG; } } xkb->ctrls->num_groups= nTG; memcpy(dev->key->modifierMap,xkb->map->modmap,xkb->max_key_code+1); XkbUpdateCoreDescription(dev,True); if (dev->kbdfeed && dev->kbdfeed->xkb_sli) { XkbSrvLedInfoPtr old_sli; XkbSrvLedInfoPtr sli; old_sli = dev->kbdfeed->xkb_sli; dev->kbdfeed->xkb_sli = NULL; sli = XkbAllocSrvLedInfo(dev,dev->kbdfeed,NULL,0); if (sli) { sli->explicitState = old_sli->explicitState; sli->effectiveState = old_sli->effectiveState; } dev->kbdfeed->xkb_sli = sli; XkbFreeSrvLedInfo(old_sli); } memset(&nkn, 0, sizeof(xkbNewKeyboardNotify)); nkn.deviceID= nkn.oldDeviceID= dev->id; nkn.minKeyCode= finfo.xkb->min_key_code; nkn.maxKeyCode= finfo.xkb->max_key_code; nkn.oldMinKeyCode= xkb->min_key_code; nkn.oldMaxKeyCode= xkb->max_key_code; nkn.requestMajor= XkbReqCode; nkn.requestMinor= X_kbGetKbdByName; nkn.changed= XkbNKN_KeycodesMask; if (geom_changed) nkn.changed|= XkbNKN_GeometryMask; XkbSendNewKeyboardNotify(dev,&nkn); } if ((finfo.xkb!=NULL)&&(finfo.xkb!=xkb)) { XkbFreeKeyboard(finfo.xkb,XkbAllComponentsMask,True); finfo.xkb= NULL; } if (names.keymap) { _XkbFree(names.keymap); names.keymap= NULL; } if (names.keycodes) { _XkbFree(names.keycodes); names.keycodes= NULL; } if (names.types) { _XkbFree(names.types); names.types= NULL; } if (names.compat) { _XkbFree(names.compat); names.compat= NULL; } if (names.symbols) { _XkbFree(names.symbols); names.symbols= NULL; } if (names.geometry) { _XkbFree(names.geometry); names.geometry= NULL; } return client->noClientException; } /***====================================================================***/ static int ComputeDeviceLedInfoSize( DeviceIntPtr dev, unsigned int what, XkbSrvLedInfoPtr sli) { int nNames,nMaps; register unsigned n,bit; if (sli==NULL) return 0; nNames= nMaps= 0; if ((what&XkbXI_IndicatorNamesMask)==0) sli->namesPresent= 0; if ((what&XkbXI_IndicatorMapsMask)==0) sli->mapsPresent= 0; for (n=0,bit=1;nnames && sli->names[n]!=None) { sli->namesPresent|= bit; nNames++; } if (sli->maps && XkbIM_InUse(&sli->maps[n])) { sli->mapsPresent|= bit; nMaps++; } } return (nNames*4)+(nMaps*SIZEOF(xkbIndicatorMapWireDesc)); } static int CheckDeviceLedFBs( DeviceIntPtr dev, int class, int id, xkbGetDeviceInfoReply * rep, ClientPtr client) { int nFBs= 0; int length= 0; Bool classOk; if (class==XkbDfltXIClass) { if (dev->kbdfeed) class= KbdFeedbackClass; else if (dev->leds) class= LedFeedbackClass; else { client->errorValue= _XkbErrCode2(XkbErr_BadClass,class); return XkbKeyboardErrorCode; } } classOk= False; if ((dev->kbdfeed)&&((class==KbdFeedbackClass)||(class==XkbAllXIClasses))) { KbdFeedbackPtr kf; classOk= True; for (kf= dev->kbdfeed;(kf);kf=kf->next) { if ((id!=XkbAllXIIds)&&(id!=XkbDfltXIId)&&(id!=kf->ctrl.id)) continue; nFBs++; length+= SIZEOF(xkbDeviceLedsWireDesc); if (!kf->xkb_sli) kf->xkb_sli= XkbAllocSrvLedInfo(dev,kf,NULL,0); length+= ComputeDeviceLedInfoSize(dev,rep->present,kf->xkb_sli); if (id!=XkbAllXIIds) break; } } if ((dev->leds)&&((class==LedFeedbackClass)||(class==XkbAllXIClasses))) { LedFeedbackPtr lf; classOk= True; for (lf= dev->leds;(lf);lf=lf->next) { if ((id!=XkbAllXIIds)&&(id!=XkbDfltXIId)&&(id!=lf->ctrl.id)) continue; nFBs++; length+= SIZEOF(xkbDeviceLedsWireDesc); if (!lf->xkb_sli) lf->xkb_sli= XkbAllocSrvLedInfo(dev,NULL,lf,0); length+= ComputeDeviceLedInfoSize(dev,rep->present,lf->xkb_sli); if (id!=XkbAllXIIds) break; } } if (nFBs>0) { if (rep->supported&XkbXI_IndicatorsMask) { rep->nDeviceLedFBs= nFBs; rep->length+= (length/4); } return Success; } if (classOk) client->errorValue= _XkbErrCode2(XkbErr_BadId,id); else client->errorValue= _XkbErrCode2(XkbErr_BadClass,class); return XkbKeyboardErrorCode; } static int SendDeviceLedInfo( XkbSrvLedInfoPtr sli, ClientPtr client) { xkbDeviceLedsWireDesc wire; int length; length= 0; wire.ledClass= sli->class; wire.ledID= sli->id; wire.namesPresent= sli->namesPresent; wire.mapsPresent= sli->mapsPresent; wire.physIndicators= sli->physIndicators; wire.state= sli->effectiveState; if (client->swapped) { swaps(&wire.ledClass); swaps(&wire.ledID); swapl(&wire.namesPresent); swapl(&wire.mapsPresent); swapl(&wire.physIndicators); swapl(&wire.state); } WriteToClient(client,SIZEOF(xkbDeviceLedsWireDesc), &wire); length+= SIZEOF(xkbDeviceLedsWireDesc); if (sli->namesPresent|sli->mapsPresent) { register unsigned i,bit; if (sli->namesPresent) { CARD32 awire; for (i=0,bit=1;inamesPresent&bit) { awire= (CARD32)sli->names[i]; if (client->swapped) { swapl(&awire); } WriteToClient(client,4, &awire); length+= 4; } } } if (sli->mapsPresent) { for (i=0,bit=1;imapsPresent&bit) { iwire.flags= sli->maps[i].flags; iwire.whichGroups= sli->maps[i].which_groups; iwire.groups= sli->maps[i].groups; iwire.whichMods= sli->maps[i].which_mods; iwire.mods= sli->maps[i].mods.mask; iwire.realMods= sli->maps[i].mods.real_mods; iwire.virtualMods= sli->maps[i].mods.vmods; iwire.ctrls= sli->maps[i].ctrls; if (client->swapped) { swaps(&iwire.virtualMods); swapl(&iwire.ctrls); } WriteToClient(client,SIZEOF(xkbIndicatorMapWireDesc), (char *)&iwire); length+= SIZEOF(xkbIndicatorMapWireDesc); } } } } return length; } static int SendDeviceLedFBs( DeviceIntPtr dev, int class, int id, unsigned wantLength, ClientPtr client) { int length= 0; if (class==XkbDfltXIClass) { if (dev->kbdfeed) class= KbdFeedbackClass; else if (dev->leds) class= LedFeedbackClass; } if ((dev->kbdfeed)&& ((class==KbdFeedbackClass)||(class==XkbAllXIClasses))) { KbdFeedbackPtr kf; for (kf= dev->kbdfeed;(kf);kf=kf->next) { if ((id==XkbAllXIIds)||(id==XkbDfltXIId)||(id==kf->ctrl.id)) { length+= SendDeviceLedInfo(kf->xkb_sli,client); if (id!=XkbAllXIIds) break; } } } if ((dev->leds)&& ((class==LedFeedbackClass)||(class==XkbAllXIClasses))) { LedFeedbackPtr lf; for (lf= dev->leds;(lf);lf=lf->next) { if ((id==XkbAllXIIds)||(id==XkbDfltXIId)||(id==lf->ctrl.id)) { length+= SendDeviceLedInfo(lf->xkb_sli,client); if (id!=XkbAllXIIds) break; } } } if (length==wantLength) return Success; else return BadLength; } int ProcXkbGetDeviceInfo(ClientPtr client) { DeviceIntPtr dev; xkbGetDeviceInfoReply rep = {0}; int status,nDeviceLedFBs; unsigned length,nameLen; CARD16 ledClass,ledID; unsigned wanted,supported; char * str; REQUEST(xkbGetDeviceInfoReq); REQUEST_SIZE_MATCH(xkbGetDeviceInfoReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; wanted= stuff->wanted; CHK_ANY_DEVICE(dev,stuff->deviceSpec); CHK_MASK_LEGAL(0x01,wanted,XkbXI_AllDeviceFeaturesMask); if ((!dev->button)||((stuff->nBtns<1)&&(!stuff->allBtns))) wanted&= ~XkbXI_ButtonActionsMask; if ((!dev->kbdfeed)&&(!dev->leds)) wanted&= ~XkbXI_IndicatorsMask; wanted&= ~XkbXI_KeyboardsMask; nameLen= XkbSizeCountedString(dev->name); rep.type = X_Reply; rep.deviceID= dev->id; rep.sequenceNumber = client->sequence; rep.length = nameLen/4; rep.present = wanted; rep.supported = XkbXI_AllDeviceFeaturesMask&(~XkbXI_KeyboardsMask); rep.unsupported = XkbXI_KeyboardsMask; rep.firstBtnWanted = rep.nBtnsWanted = 0; rep.firstBtnRtrn = rep.nBtnsRtrn = 0; if (dev->button) rep.totalBtns= dev->button->numButtons; else rep.totalBtns= 0; rep.devType= dev->type; rep.hasOwnState= (dev->key && dev->key->xkbInfo); rep.nDeviceLedFBs = 0; if (dev->kbdfeed) rep.dfltKbdFB= dev->kbdfeed->ctrl.id; else rep.dfltKbdFB= XkbXINone; if (dev->leds) rep.dfltLedFB= dev->leds->ctrl.id; else rep.dfltLedFB= XkbXINone; ledClass= stuff->ledClass; ledID= stuff->ledID; rep.firstBtnWanted= rep.nBtnsWanted= 0; rep.firstBtnRtrn= rep.nBtnsRtrn= 0; if (wanted&XkbXI_ButtonActionsMask) { if (stuff->allBtns) { stuff->firstBtn= 0; stuff->nBtns= dev->button->numButtons; } if ((stuff->firstBtn+stuff->nBtns)>dev->button->numButtons) { client->errorValue = _XkbErrCode4(0x02,dev->button->numButtons, stuff->firstBtn, stuff->nBtns); return BadValue; } else { rep.firstBtnWanted= stuff->firstBtn; rep.nBtnsWanted= stuff->nBtns; if (dev->button->xkb_acts!=NULL) { XkbAction *act; register int i; rep.firstBtnRtrn= stuff->firstBtn; rep.nBtnsRtrn= stuff->nBtns; act= &dev->button->xkb_acts[rep.firstBtnWanted]; for (i=0;itype!=XkbSA_NoAction) break; } rep.firstBtnRtrn+= i; rep.nBtnsRtrn-= i; act= &dev->button->xkb_acts[rep.firstBtnRtrn+rep.nBtnsRtrn-1]; for (i=0;itype!=XkbSA_NoAction) break; } rep.nBtnsRtrn-= i; } rep.length+= (rep.nBtnsRtrn*SIZEOF(xkbActionWireDesc))/4; } } if (wanted&XkbXI_IndicatorsMask) { status= CheckDeviceLedFBs(dev,ledClass,ledID,&rep,client); if (status!=Success) return status; } length= rep.length*4; supported= rep.supported; nDeviceLedFBs = rep.nDeviceLedFBs; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.present); swaps(&rep.supported); swaps(&rep.unsupported); swaps(&rep.nDeviceLedFBs); // FIXME: rep.type here is an Atom... this might go terribly wrong... swapl((int *)&rep.type); } WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), &rep); str= (char*) malloc(nameLen); if (!str) return BadAlloc; XkbWriteCountedString(str,dev->name,client->swapped); WriteToClient(client,nameLen,str); free(str); length-= nameLen; if (rep.nBtnsRtrn>0) { int sz; xkbActionWireDesc * awire; sz= rep.nBtnsRtrn*SIZEOF(xkbActionWireDesc); awire= (xkbActionWireDesc *)&dev->button->xkb_acts[rep.firstBtnRtrn]; WriteToClient(client,sz, awire); length-= sz; } if (nDeviceLedFBs>0) { status= SendDeviceLedFBs(dev,ledClass,ledID,length,client); if (status!=Success) return status; } else if (length!=0) { ErrorF("Internal Error! BadLength in ProcXkbGetDeviceInfo\n"); ErrorF(" Wrote %d fewer bytes than expected\n",length); return BadLength; } if (stuff->wanted&(~supported)) { xkbExtensionDeviceNotify ed; bzero((char *)&ed,SIZEOF(xkbExtensionDeviceNotify)); ed.ledClass= ledClass; ed.ledID= ledID; ed.ledsDefined= 0; ed.ledState= 0; ed.firstBtn= ed.nBtns= 0; ed.reason= XkbXI_UnsupportedFeatureMask; ed.supported= supported; ed.unsupported= stuff->wanted&(~supported); XkbSendExtensionDeviceNotify(dev,client,&ed); } return client->noClientException; } static char * CheckSetDeviceIndicators( char * wire, DeviceIntPtr dev, int num, int * status_rtrn, ClientPtr client) { xkbDeviceLedsWireDesc * ledWire; int i; XkbSrvLedInfoPtr sli; ledWire= (xkbDeviceLedsWireDesc *)wire; for (i=0;iswapped) { swaps(&ledWire->ledClass); swaps(&ledWire->ledID); swapl(&ledWire->namesPresent); swapl(&ledWire->mapsPresent); swapl(&ledWire->physIndicators); } sli= XkbFindSrvLedInfo(dev,ledWire->ledClass,ledWire->ledID, XkbXI_IndicatorsMask); if (sli!=NULL) { register int n; register unsigned bit; int nMaps,nNames; CARD32 *atomWire; xkbIndicatorMapWireDesc *mapWire; nMaps= nNames= 0; for (n=0,bit=1;nnamesPresent&bit) nNames++; if (ledWire->mapsPresent&bit) nMaps++; } atomWire= (CARD32 *)&ledWire[1]; if (nNames>0) { for (n=0;nswapped) { swapl(atomWire); } CHK_ATOM_OR_NONE3(((Atom)(*atomWire)),client->errorValue, *status_rtrn,NULL); atomWire++; } } mapWire= (xkbIndicatorMapWireDesc *)atomWire; if (nMaps>0) { for (n=0;nswapped) { swaps(&mapWire->virtualMods); swapl(&mapWire->ctrls); } CHK_MASK_LEGAL3(0x21,mapWire->whichGroups, XkbIM_UseAnyGroup, client->errorValue, *status_rtrn,NULL); CHK_MASK_LEGAL3(0x22,mapWire->whichMods,XkbIM_UseAnyMods, client->errorValue, *status_rtrn,NULL); mapWire++; } } ledWire= (xkbDeviceLedsWireDesc *)mapWire; } else { /* SHOULD NEVER HAPPEN */ return (char *)ledWire; } } return (char *)ledWire; } static char * SetDeviceIndicators( char * wire, DeviceIntPtr dev, unsigned changed, int num, int * status_rtrn, ClientPtr client, xkbExtensionDeviceNotify *ev) { xkbDeviceLedsWireDesc * ledWire; int i; XkbEventCauseRec cause; unsigned namec,mapc,statec; xkbExtensionDeviceNotify ed; XkbChangesRec changes; DeviceIntPtr kbd; bzero((char *)&ed,sizeof(xkbExtensionDeviceNotify)); bzero((char *)&changes,sizeof(XkbChangesRec)); XkbSetCauseXkbReq(&cause,X_kbSetDeviceInfo,client); ledWire= (xkbDeviceLedsWireDesc *)wire; for (i=0;iledClass,ledWire->ledID, XkbXI_IndicatorMapsMask); if (!sli) { /* SHOULD NEVER HAPPEN!! */ return (char *)ledWire; } atomWire= (CARD32 *)&ledWire[1]; if (changed&XkbXI_IndicatorNamesMask) { namec= sli->namesPresent|ledWire->namesPresent; bzero((char *)sli->names,XkbNumIndicators*sizeof(Atom)); } if (ledWire->namesPresent) { sli->namesPresent= ledWire->namesPresent; bzero((char *)sli->names,XkbNumIndicators*sizeof(Atom)); for (n=0,bit=1;nnamesPresent&bit) { sli->names[n]= (Atom)*atomWire; if (sli->names[n]==None) ledWire->namesPresent&= ~bit; atomWire++; } } } mapWire= (xkbIndicatorMapWireDesc *)atomWire; if (changed&XkbXI_IndicatorMapsMask) { mapc= sli->mapsPresent|ledWire->mapsPresent; sli->mapsPresent= ledWire->mapsPresent; bzero((char*)sli->maps,XkbNumIndicators*sizeof(XkbIndicatorMapRec)); } if (ledWire->mapsPresent) { for (n=0,bit=1;nmapsPresent&bit) { sli->maps[n].flags= mapWire->flags; sli->maps[n].which_groups= mapWire->whichGroups; sli->maps[n].groups= mapWire->groups; sli->maps[n].which_mods= mapWire->whichMods; sli->maps[n].mods.mask= mapWire->mods; sli->maps[n].mods.real_mods=mapWire->realMods; sli->maps[n].mods.vmods= mapWire->virtualMods; sli->maps[n].ctrls= mapWire->ctrls; mapWire++; } } } if (changed&XkbXI_IndicatorStateMask) { statec= sli->effectiveState^ledWire->state; sli->explicitState&= ~statec; sli->explicitState|= (ledWire->state&statec); } if (namec) XkbApplyLedNameChanges(dev,sli,namec,&ed,&changes,&cause); if (mapc) XkbApplyLedMapChanges(dev,sli,mapc,&ed,&changes,&cause); if (statec) XkbApplyLedStateChanges(dev,sli,statec,&ed,&changes,&cause); kbd= dev; if ((sli->flags&XkbSLI_HasOwnState)==0) kbd= (DeviceIntPtr)LookupKeyboardDevice(); XkbFlushLedEvents(dev,kbd,sli,&ed,&changes,&cause); ledWire= (xkbDeviceLedsWireDesc *)mapWire; } return (char *)ledWire; } int ProcXkbSetDeviceInfo(ClientPtr client) { DeviceIntPtr dev; unsigned change; char * wire; xkbExtensionDeviceNotify ed; REQUEST(xkbSetDeviceInfoReq); REQUEST_AT_LEAST_SIZE(xkbSetDeviceInfoReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; change= stuff->change; CHK_ANY_DEVICE(dev,stuff->deviceSpec); CHK_MASK_LEGAL(0x01,change,(XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask))); wire= (char *)&stuff[1]; if (change&XkbXI_ButtonActionsMask) { if (!dev->button) { client->errorValue = _XkbErrCode2(XkbErr_BadClass,ButtonClass); return XkbKeyboardErrorCode; } if ((stuff->firstBtn+stuff->nBtns)>dev->button->numButtons) { client->errorValue= _XkbErrCode4(0x02,stuff->firstBtn,stuff->nBtns, dev->button->numButtons); return BadMatch; } wire+= (stuff->nBtns*SIZEOF(xkbActionWireDesc)); } if (stuff->change&XkbXI_IndicatorsMask) { int status= Success; wire= CheckSetDeviceIndicators(wire,dev,stuff->nDeviceLedFBs, &status,client); if (status!=Success) return status; } if (((wire-((char *)stuff))/4)!=stuff->length) return BadLength; bzero((char *)&ed,SIZEOF(xkbExtensionDeviceNotify)); ed.deviceID= dev->id; wire= (char *)&stuff[1]; if (change&XkbXI_ButtonActionsMask) { int nBtns,sz,i; XkbAction * acts; DeviceIntPtr kbd; nBtns= dev->button->numButtons; acts= dev->button->xkb_acts; if (acts==NULL) { acts= _XkbTypedCalloc(nBtns,XkbAction); if (!acts) return BadAlloc; dev->button->xkb_acts= acts; } sz= stuff->nBtns*SIZEOF(xkbActionWireDesc); memcpy((char *)&acts[stuff->firstBtn],(char *)wire,sz); wire+= sz; ed.reason|= XkbXI_ButtonActionsMask; ed.firstBtn= stuff->firstBtn; ed.nBtns= stuff->nBtns; if (dev->key) kbd= dev; else kbd= (DeviceIntPtr)LookupKeyboardDevice(); acts= &dev->button->xkb_acts[stuff->firstBtn]; for (i=0;inBtns;i++,acts++) { if (acts->type!=XkbSA_NoAction) XkbSetActionKeyMods(kbd->key->xkbInfo->desc,acts,0); } } if (stuff->change&XkbXI_IndicatorsMask) { int status= Success; wire= SetDeviceIndicators(wire,dev,change,stuff->nDeviceLedFBs, &status,client,&ed); if (status!=Success) return status; } if ((stuff->change)&&(ed.reason)) XkbSendExtensionDeviceNotify(dev,client,&ed); return client->noClientException; } /***====================================================================***/ int ProcXkbSetDebuggingFlags(ClientPtr client) { CARD32 newFlags,newCtrls,extraLength; xkbSetDebuggingFlagsReply rep = {0}; REQUEST(xkbSetDebuggingFlagsReq); REQUEST_AT_LEAST_SIZE(xkbSetDebuggingFlagsReq); newFlags= xkbDebugFlags&(~stuff->affectFlags); newFlags|= (stuff->flags&stuff->affectFlags); newCtrls= xkbDebugCtrls&(~stuff->affectCtrls); newCtrls|= (stuff->ctrls&stuff->affectCtrls); if (xkbDebugFlags || newFlags || stuff->msgLength) { ErrorF("XkbDebug: Setting debug flags to 0x%lx\n",(long)newFlags); if (newCtrls!=xkbDebugCtrls) ErrorF("XkbDebug: Setting debug controls to 0x%lx\n",(long)newCtrls); } extraLength= (stuff->length<<2)-sz_xkbSetDebuggingFlagsReq; if (stuff->msgLength>0) { char *msg; if (extraLengthmsgLength)) { ErrorF("XkbDebug: msgLength= %d, length= %ld (should be %d)\n", stuff->msgLength,(long)extraLength, XkbPaddedSize(stuff->msgLength)); return BadLength; } msg= (char *)&stuff[1]; if (msg[stuff->msgLength-1]!='\0') { ErrorF("XkbDebug: message not null-terminated\n"); return BadValue; } ErrorF("XkbDebug: %s\n",msg); } xkbDebugFlags = newFlags; xkbDebugCtrls = newCtrls; XkbDisableLockActions= (xkbDebugCtrls&XkbDF_DisableLocks); rep.type= X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.currentFlags = newFlags; rep.currentCtrls = newCtrls; rep.supportedFlags = ~0; rep.supportedCtrls = ~0; if ( client->swapped ) { swaps(&rep.sequenceNumber); swapl(&rep.currentFlags); swapl(&rep.currentCtrls); swapl(&rep.supportedFlags); swapl(&rep.supportedCtrls); } WriteToClient(client,SIZEOF(xkbSetDebuggingFlagsReply), &rep); return client->noClientException; } /***====================================================================***/ static int ProcXkbDispatch (ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_kbUseExtension: return ProcXkbUseExtension(client); case X_kbSelectEvents: return ProcXkbSelectEvents(client); case X_kbBell: return ProcXkbBell(client); case X_kbGetState: return ProcXkbGetState(client); case X_kbLatchLockState: return ProcXkbLatchLockState(client); case X_kbGetControls: return ProcXkbGetControls(client); case X_kbSetControls: return ProcXkbSetControls(client); case X_kbGetMap: return ProcXkbGetMap(client); case X_kbSetMap: return ProcXkbSetMap(client); case X_kbGetCompatMap: return ProcXkbGetCompatMap(client); case X_kbSetCompatMap: return ProcXkbSetCompatMap(client); case X_kbGetIndicatorState: return ProcXkbGetIndicatorState(client); case X_kbGetIndicatorMap: return ProcXkbGetIndicatorMap(client); case X_kbSetIndicatorMap: return ProcXkbSetIndicatorMap(client); case X_kbGetNamedIndicator: return ProcXkbGetNamedIndicator(client); case X_kbSetNamedIndicator: return ProcXkbSetNamedIndicator(client); case X_kbGetNames: return ProcXkbGetNames(client); case X_kbSetNames: return ProcXkbSetNames(client); case X_kbGetGeometry: return ProcXkbGetGeometry(client); case X_kbSetGeometry: return ProcXkbSetGeometry(client); case X_kbPerClientFlags: return ProcXkbPerClientFlags(client); case X_kbListComponents: return ProcXkbListComponents(client); case X_kbGetKbdByName: return ProcXkbGetKbdByName(client); case X_kbGetDeviceInfo: return ProcXkbGetDeviceInfo(client); case X_kbSetDeviceInfo: return ProcXkbSetDeviceInfo(client); case X_kbSetDebuggingFlags: return ProcXkbSetDebuggingFlags(client); default: return BadRequest; } } static int XkbClientGone(void * data,XID id) { DevicePtr pXDev = (DevicePtr)data; if (!XkbRemoveResourceClient(pXDev,id)) { ErrorF("Internal Error! bad RemoveResourceClient in XkbClientGone\n"); } return 1; } /*ARGSUSED*/ static void XkbResetProc(ExtensionEntry *extEntry) { } void XkbExtensionInit(void) { ExtensionEntry *extEntry; if ((extEntry = AddExtension(XkbName, XkbNumberEvents, XkbNumberErrors, ProcXkbDispatch, SProcXkbDispatch, XkbResetProc, StandardMinorOpcode))) { XkbReqCode = (unsigned char)extEntry->base; XkbEventBase = (unsigned char)extEntry->eventBase; XkbErrorBase = (unsigned char)extEntry->errorBase; XkbKeyboardErrorCode = XkbErrorBase+XkbKeyboard; RT_XKBCLIENT = CreateNewResourceType(XkbClientGone); } return; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkbDflts.h0000644000000000000000000004136013614532331017315 0ustar /* This file generated automatically by xkbcomp */ /* DO NOT EDIT */ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifndef DEFAULT_H #define DEFAULT_H 1 #define GET_ATOM(d,s) MakeAtom(s,strlen(s),1) #define DPYTYPE char * #define NUM_KEYS 1 #define vmod_NumLock 0 #define vmod_Alt 1 #define vmod_LevelThree 2 #define vmod_AltGr 3 #define vmod_ScrollLock 4 #define vmod_NumLockMask (1<<0) #define vmod_AltMask (1<<1) #define vmod_LevelThreeMask (1<<2) #define vmod_AltGrMask (1<<3) #define vmod_ScrollLockMask (1<<4) /* types name is "default" */ static Atom lnames_ONE_LEVEL[1]; static XkbKTMapEntryRec map_TWO_LEVEL[1]= { { 1, 1, { ShiftMask, ShiftMask, 0 } } }; static Atom lnames_TWO_LEVEL[2]; static XkbKTMapEntryRec map_ALPHABETIC[2]= { { 1, 1, { ShiftMask, ShiftMask, 0 } }, { 1, 0, { LockMask, LockMask, 0 } } }; static XkbModsRec preserve_ALPHABETIC[2]= { { 0, 0, 0 }, { LockMask, LockMask, 0 } }; static Atom lnames_ALPHABETIC[2]; static XkbKTMapEntryRec map_KEYPAD[2]= { { 1, 1, { ShiftMask, ShiftMask, 0 } }, { 0, 1, { 0, 0, vmod_NumLockMask } } }; static Atom lnames_KEYPAD[2]; static XkbKTMapEntryRec map_PC_BREAK[1]= { { 1, 1, { ControlMask, ControlMask, 0 } } }; static Atom lnames_PC_BREAK[2]; static XkbKTMapEntryRec map_PC_SYSRQ[1]= { { 0, 1, { 0, 0, vmod_AltMask } } }; static Atom lnames_PC_SYSRQ[2]; static XkbKTMapEntryRec map_CTRL_ALT[1]= { { 0, 1, { ControlMask, ControlMask, vmod_AltMask } } }; static Atom lnames_CTRL_ALT[2]; static XkbKTMapEntryRec map_THREE_LEVEL[3]= { { 1, 1, { ShiftMask, ShiftMask, 0 } }, { 0, 2, { 0, 0, vmod_LevelThreeMask } }, { 0, 2, { ShiftMask, ShiftMask, vmod_LevelThreeMask } } }; static Atom lnames_THREE_LEVEL[3]; static XkbKTMapEntryRec map_SHIFT_ALT[1]= { { 0, 1, { ShiftMask, ShiftMask, vmod_AltMask } } }; static Atom lnames_SHIFT_ALT[2]; static XkbKeyTypeRec dflt_types[]= { { { 0, 0, 0 }, 1, 0, NULL, NULL, None, lnames_ONE_LEVEL }, { { ShiftMask, ShiftMask, 0 }, 2, 1, map_TWO_LEVEL, NULL, None, lnames_TWO_LEVEL }, { { ShiftMask|LockMask, ShiftMask|LockMask, 0 }, 2, 2, map_ALPHABETIC, preserve_ALPHABETIC, None, lnames_ALPHABETIC }, { { ShiftMask, ShiftMask, vmod_NumLockMask }, 2, 2, map_KEYPAD, NULL, None, lnames_KEYPAD }, { { ControlMask, ControlMask, 0 }, 2, 1, map_PC_BREAK, NULL, None, lnames_PC_BREAK }, { { 0, 0, vmod_AltMask }, 2, 1, map_PC_SYSRQ, NULL, None, lnames_PC_SYSRQ }, { { ControlMask, ControlMask, vmod_AltMask }, 2, 1, map_CTRL_ALT, NULL, None, lnames_CTRL_ALT }, { { ShiftMask, ShiftMask, vmod_LevelThreeMask }, 3, 3, map_THREE_LEVEL, NULL, None, lnames_THREE_LEVEL }, { { ShiftMask, ShiftMask, vmod_AltMask }, 2, 1, map_SHIFT_ALT, NULL, None, lnames_SHIFT_ALT } }; #define num_dflt_types (sizeof(dflt_types)/sizeof(XkbKeyTypeRec)) static void initTypeNames(DPYTYPE dpy) { dflt_types[0].name= GET_ATOM(dpy,"ONE_LEVEL"); lnames_ONE_LEVEL[0]= GET_ATOM(dpy,"Any"); dflt_types[1].name= GET_ATOM(dpy,"TWO_LEVEL"); lnames_TWO_LEVEL[0]= GET_ATOM(dpy,"Base"); lnames_TWO_LEVEL[1]= GET_ATOM(dpy,"Shift"); dflt_types[2].name= GET_ATOM(dpy,"ALPHABETIC"); lnames_ALPHABETIC[0]= GET_ATOM(dpy,"Base"); lnames_ALPHABETIC[1]= GET_ATOM(dpy,"Caps"); dflt_types[3].name= GET_ATOM(dpy,"KEYPAD"); lnames_KEYPAD[0]= GET_ATOM(dpy,"Base"); lnames_KEYPAD[1]= GET_ATOM(dpy,"Number"); dflt_types[4].name= GET_ATOM(dpy,"PC_BREAK"); lnames_PC_BREAK[0]= GET_ATOM(dpy,"Base"); lnames_PC_BREAK[1]= GET_ATOM(dpy,"Control"); dflt_types[5].name= GET_ATOM(dpy,"PC_SYSRQ"); lnames_PC_SYSRQ[0]= GET_ATOM(dpy,"Base"); lnames_PC_SYSRQ[1]= GET_ATOM(dpy,"Alt"); dflt_types[6].name= GET_ATOM(dpy,"CTRL+ALT"); lnames_CTRL_ALT[0]= GET_ATOM(dpy,"Base"); lnames_CTRL_ALT[1]= GET_ATOM(dpy,"Ctrl+Alt"); dflt_types[7].name= GET_ATOM(dpy,"THREE_LEVEL"); lnames_THREE_LEVEL[0]= GET_ATOM(dpy,"Base"); lnames_THREE_LEVEL[1]= GET_ATOM(dpy,"Shift"); lnames_THREE_LEVEL[2]= GET_ATOM(dpy,"Level3"); dflt_types[8].name= GET_ATOM(dpy,"SHIFT+ALT"); lnames_SHIFT_ALT[0]= GET_ATOM(dpy,"Base"); lnames_SHIFT_ALT[1]= GET_ATOM(dpy,"Shift+Alt"); } /* compat name is "default" */ static XkbSymInterpretRec dfltSI[69]= { { XK_ISO_Level2_Latch, 0x0000, XkbSI_LevelOneOnly|XkbSI_Exactly, ShiftMask, 255, { XkbSA_LatchMods, { 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Eisu_Shift, 0x0000, XkbSI_Exactly, LockMask, 255, { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Eisu_toggle, 0x0000, XkbSI_Exactly, LockMask, 255, { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Kana_Shift, 0x0000, XkbSI_Exactly, LockMask, 255, { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Kana_Lock, 0x0000, XkbSI_Exactly, LockMask, 255, { XkbSA_NoAction, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Shift_Lock, 0x0000, XkbSI_AnyOf, ShiftMask|LockMask, 255, { XkbSA_LockMods, { 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Num_Lock, 0x0000, XkbSI_AnyOf, 0xff, 0, { XkbSA_LockMods, { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } } }, { XK_Alt_L, 0x0000, XkbSI_AnyOf, 0xff, 1, { XkbSA_SetMods, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Alt_R, 0x0000, XkbSI_AnyOf, 0xff, 1, { XkbSA_SetMods, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Scroll_Lock, 0x0000, XkbSI_AnyOf, 0xff, 4, { XkbSA_LockMods, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_ISO_Lock, 0x0000, XkbSI_AnyOf, 0xff, 255, { XkbSA_ISOLock, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_ISO_Level3_Shift, 0x0000, XkbSI_LevelOneOnly|XkbSI_AnyOf, 0xff, 2, { XkbSA_SetMods, { 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 } } }, { XK_ISO_Level3_Latch, 0x0000, XkbSI_LevelOneOnly|XkbSI_AnyOf, 0xff, 2, { XkbSA_LatchMods, { 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 } } }, { XK_Mode_switch, 0x0000, XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff, 3, { XkbSA_SetGroup, { 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_1, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00 } } }, { XK_KP_End, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00 } } }, { XK_KP_2, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } } }, { XK_KP_Down, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } } }, { XK_KP_3, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00 } } }, { XK_KP_Next, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00 } } }, { XK_KP_4, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Left, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_6, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Right, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_7, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } } }, { XK_KP_Home, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } } }, { XK_KP_8, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } } }, { XK_KP_Up, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } } }, { XK_KP_9, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } } }, { XK_KP_Prior, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_MovePtr, { 0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00 } } }, { XK_KP_5, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_PtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Begin, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_PtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_F1, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Divide, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_F2, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Multiply, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_F3, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Subtract, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_SetPtrDflt, { 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Separator, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_PtrBtn, { 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Add, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_PtrBtn, { 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_0, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_LockPtrBtn, { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Insert, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_LockPtrBtn, { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Decimal, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_LockPtrBtn, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_KP_Delete, 0x0001, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_LockPtrBtn, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Button_Dflt, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_PtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Button1, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_PtrBtn, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Button2, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_PtrBtn, { 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Button3, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_PtrBtn, { 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_DblClick_Dflt, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_PtrBtn, { 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_DblClick1, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_PtrBtn, { 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_DblClick2, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_PtrBtn, { 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_DblClick3, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_PtrBtn, { 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Drag_Dflt, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Drag1, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Drag2, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_Drag3, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_LockPtrBtn, { 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_EnableKeys, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00 } } }, { XK_Pointer_Accelerate, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00 } } }, { XK_Pointer_DfltBtnNext, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_SetPtrDflt, { 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } } }, { XK_Pointer_DfltBtnPrev, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_SetPtrDflt, { 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00 } } }, { XK_AccessX_Enable, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00 } } }, #ifndef NXAGENT_SERVER /* * Make sure that the server can't be killed * by pressing this key-sequence. */ { XK_Terminate_Server, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_Terminate, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, #endif { XK_ISO_Group_Latch, 0x0000, XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff, 3, { XkbSA_LatchGroup, { 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_ISO_Next_Group, 0x0000, XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff, 3, { XkbSA_LockGroup, { 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_ISO_Prev_Group, 0x0000, XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff, 3, { XkbSA_LockGroup, { 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_ISO_First_Group, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_LockGroup, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { XK_ISO_Last_Group, 0x0000, XkbSI_AnyOfOrNone, 0xff, 255, { XkbSA_LockGroup, { 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } } }, { NoSymbol, 0x0000, XkbSI_Exactly, LockMask, 255, { XkbSA_LockMods, { 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } } }, { NoSymbol, 0x0000, XkbSI_AnyOf, 0xff, 255, { XkbSA_SetMods, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } } }; #define num_dfltSI (sizeof(dfltSI)/sizeof(XkbSymInterpretRec)) static XkbCompatMapRec compatMap= { dfltSI, { /* group compatibility */ { 0, 0, 0 }, { 0, 0, vmod_AltGrMask }, { 0, 0, vmod_AltGrMask }, { 0, 0, vmod_AltGrMask } }, num_dfltSI, num_dfltSI }; static void initIndicatorNames(DPYTYPE dpy,XkbDescPtr xkb) { xkb->names->indicators[ 0]= GET_ATOM(dpy,"Caps Lock"); xkb->names->indicators[ 1]= GET_ATOM(dpy,"Num Lock"); xkb->names->indicators[ 2]= GET_ATOM(dpy,"Shift Lock"); xkb->names->indicators[ 3]= GET_ATOM(dpy,"Mouse Keys"); xkb->names->indicators[ 4]= GET_ATOM(dpy,"Scroll Lock"); xkb->names->indicators[ 5]= GET_ATOM(dpy,"Group 2"); } #endif /* DEFAULT_H */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkberrs.c0000644000000000000000000000273213614532331017207 0ustar /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include unsigned _XkbErrCode; char * _XkbErrLocation= NULL; unsigned _XkbErrData; nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkbEvents.c0000644000000000000000000007177413614532331017514 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include "inputstr.h" #include "windowstr.h" #include #include "xkb.h" /***====================================================================***/ void XkbSendNewKeyboardNotify(DeviceIntPtr kbd,xkbNewKeyboardNotify *pNKN) { register int i; Time time; CARD16 changed; pNKN->type = XkbEventCode + XkbEventBase; pNKN->xkbType = XkbNewKeyboardNotify; pNKN->time = time = GetTimeInMillis(); changed = pNKN->changed; for (i=1; iclientGone || (clients[i]->requestVector==InitialVector)) { continue; } if (clients[i]->xkbClientFlags&_XkbClientInitialized) { if (clients[i]->newKeyboardNotifyMask&changed) { pNKN->sequenceNumber = clients[i]->sequence; pNKN->time = time; pNKN->changed = changed; if ( clients[i]->swapped ) { swaps(&pNKN->sequenceNumber); swapl(&pNKN->time); swaps(&pNKN->changed); } WriteToClient(clients[i],sizeof(xEvent), pNKN); if (changed&XkbNKN_KeycodesMask) { clients[i]->minKC= pNKN->minKeyCode; clients[i]->maxKC= pNKN->maxKeyCode; } } } else if (changed&XkbNKN_KeycodesMask) { xEvent event; event.u.u.type= MappingNotify; event.u.mappingNotify.request= MappingKeyboard; event.u.mappingNotify.firstKeyCode= clients[i]->minKC; event.u.mappingNotify.count= clients[i]->maxKC-clients[i]->minKC+1; event.u.u.sequenceNumber= clients[i]->sequence; if (clients[i]->swapped) { swaps(&event.u.u.sequenceNumber); } WriteToClient(clients[i],SIZEOF(xEvent), &event); event.u.mappingNotify.request= MappingModifier; WriteToClient(clients[i],SIZEOF(xEvent), &event); } } return; } /***====================================================================***/ void XkbSendStateNotify(DeviceIntPtr kbd,xkbStateNotify *pSN) { XkbSrvInfoPtr xkbi; XkbStatePtr state; XkbInterestPtr interest; Time time; register CARD16 changed,bState; interest = kbd->xkb_interest; if (!interest) return; xkbi = kbd->key->xkbInfo; state= &xkbi->state; pSN->type = XkbEventCode + XkbEventBase; pSN->xkbType = XkbStateNotify; pSN->deviceID = kbd->id; pSN->time = time = GetTimeInMillis(); pSN->mods = state->mods; pSN->baseMods = state->base_mods; pSN->latchedMods = state->latched_mods; pSN->lockedMods = state->locked_mods; pSN->group = state->group; pSN->baseGroup = state->base_group; pSN->latchedGroup = state->latched_group; pSN->lockedGroup = state->locked_group; pSN->compatState = state->compat_state; pSN->grabMods = state->grab_mods; pSN->compatGrabMods = state->compat_grab_mods; pSN->lookupMods = state->lookup_mods; pSN->compatLookupMods = state->compat_lookup_mods; pSN->ptrBtnState = state->ptr_buttons; changed = pSN->changed; bState= pSN->ptrBtnState; while (interest) { if ((!interest->client->clientGone) && (interest->client->requestVector != InitialVector) && (interest->client->xkbClientFlags&_XkbClientInitialized) && (interest->stateNotifyMask&changed)) { pSN->sequenceNumber = interest->client->sequence; pSN->time = time; pSN->changed = changed; pSN->ptrBtnState = bState; if ( interest->client->swapped ) { swaps(&pSN->sequenceNumber); swapl(&pSN->time); swaps(&pSN->changed); swaps(&pSN->ptrBtnState); } WriteToClient(interest->client, sizeof(xEvent), pSN); } interest= interest->next; } return; } /***====================================================================***/ void XkbSendMapNotify(DeviceIntPtr kbd,xkbMapNotify *pMN) { int i; XkbSrvInfoPtr xkbi; unsigned time = 0,initialized; CARD16 changed; xkbi = kbd->key->xkbInfo; initialized= 0; changed = pMN->changed; pMN->minKeyCode= xkbi->desc->min_key_code; pMN->maxKeyCode= xkbi->desc->max_key_code; for (i=1; iclientGone && (clients[i]->requestVector != InitialVector) && (clients[i]->xkbClientFlags&_XkbClientInitialized) && (clients[i]->mapNotifyMask&changed)) { if (!initialized) { pMN->type = XkbEventCode + XkbEventBase; pMN->xkbType = XkbMapNotify; pMN->deviceID = kbd->id; time = GetTimeInMillis(); initialized= 1; } pMN->time= time; pMN->sequenceNumber = clients[i]->sequence; pMN->changed = changed; if ( clients[i]->swapped ) { swaps(&pMN->sequenceNumber); swapl(&pMN->time); swaps(&pMN->changed); } WriteToClient(clients[i],sizeof(xEvent), pMN); } } return; } int XkbComputeControlsNotify( DeviceIntPtr kbd, XkbControlsPtr old, XkbControlsPtr new, xkbControlsNotify * pCN, Bool forceCtrlProc) { int i; CARD32 changedControls; changedControls= 0; if (!kbd || !kbd->kbdfeed) return 0; if (old->enabled_ctrls!=new->enabled_ctrls) changedControls|= XkbControlsEnabledMask; if ((old->repeat_delay!=new->repeat_delay)|| (old->repeat_interval!=new->repeat_interval)) changedControls|= XkbRepeatKeysMask; for (i = 0; i < XkbPerKeyBitArraySize; i++) if (old->per_key_repeat[i] != new->per_key_repeat[i]) changedControls|= XkbPerKeyRepeatMask; if (old->slow_keys_delay!=new->slow_keys_delay) changedControls|= XkbSlowKeysMask; if (old->debounce_delay!=new->debounce_delay) changedControls|= XkbBounceKeysMask; if ((old->mk_delay!=new->mk_delay)|| (old->mk_interval!=new->mk_interval)|| (old->mk_dflt_btn!=new->mk_dflt_btn)) changedControls|= XkbMouseKeysMask; if ((old->mk_time_to_max!=new->mk_time_to_max)|| (old->mk_curve!=new->mk_curve)|| (old->mk_max_speed!=new->mk_max_speed)) changedControls|= XkbMouseKeysAccelMask; if (old->ax_options!=new->ax_options) changedControls|= XkbAccessXKeysMask; if ((old->ax_options^new->ax_options) & XkbAX_SKOptionsMask) changedControls|= XkbStickyKeysMask; if ((old->ax_options^new->ax_options) & XkbAX_FBOptionsMask) changedControls|= XkbAccessXFeedbackMask; if ((old->ax_timeout!=new->ax_timeout)|| (old->axt_ctrls_mask!=new->axt_ctrls_mask)|| (old->axt_ctrls_values!=new->axt_ctrls_values)|| (old->axt_opts_mask!=new->axt_opts_mask)|| (old->axt_opts_values!= new->axt_opts_values)) { changedControls|= XkbAccessXTimeoutMask; } if ((old->internal.mask!=new->internal.mask)|| (old->internal.real_mods!=new->internal.real_mods)|| (old->internal.vmods!=new->internal.vmods)) changedControls|= XkbInternalModsMask; if ((old->ignore_lock.mask!=new->ignore_lock.mask)|| (old->ignore_lock.real_mods!=new->ignore_lock.real_mods)|| (old->ignore_lock.vmods!=new->ignore_lock.vmods)) changedControls|= XkbIgnoreLockModsMask; if (new->enabled_ctrls&XkbRepeatKeysMask) kbd->kbdfeed->ctrl.autoRepeat=TRUE; else kbd->kbdfeed->ctrl.autoRepeat=FALSE; if (kbd->kbdfeed && kbd->kbdfeed->CtrlProc && (changedControls || forceCtrlProc)) (*kbd->kbdfeed->CtrlProc)(kbd, &kbd->kbdfeed->ctrl); if ((!changedControls)&&(old->num_groups==new->num_groups)) return 0; if (!kbd->xkb_interest) return 0; pCN->changedControls = changedControls; pCN->enabledControls = new->enabled_ctrls; pCN->enabledControlChanges = (new->enabled_ctrls^old->enabled_ctrls); pCN->numGroups = new->num_groups; return 1; } void XkbSendControlsNotify(DeviceIntPtr kbd,xkbControlsNotify *pCN) { int initialized; CARD32 changedControls, enabledControls, enabledChanges = 0; XkbSrvInfoPtr xkbi; XkbInterestPtr interest; Time time = 0; interest = kbd->xkb_interest; if (!interest) return; xkbi = kbd->key->xkbInfo; initialized = 0; enabledControls = xkbi->desc->ctrls->enabled_ctrls; changedControls = pCN->changedControls; pCN->numGroups= xkbi->desc->ctrls->num_groups; while (interest) { if ((!interest->client->clientGone) && (interest->client->requestVector != InitialVector) && (interest->client->xkbClientFlags&_XkbClientInitialized) && (interest->ctrlsNotifyMask&changedControls)) { if (!initialized) { pCN->type = XkbEventCode + XkbEventBase; pCN->xkbType = XkbControlsNotify; pCN->deviceID = kbd->id; pCN->time = time = GetTimeInMillis(); enabledChanges = pCN->enabledControlChanges; initialized= 1; } pCN->changedControls = changedControls; pCN->enabledControls = enabledControls; pCN->enabledControlChanges = enabledChanges; pCN->sequenceNumber = interest->client->sequence; pCN->time = time; if ( interest->client->swapped ) { swaps(&pCN->sequenceNumber); swapl(&pCN->changedControls); swapl(&pCN->enabledControls); swapl(&pCN->enabledControlChanges); swapl(&pCN->time); } WriteToClient(interest->client, sizeof(xEvent), pCN); } interest= interest->next; } return; } static void XkbSendIndicatorNotify(DeviceIntPtr kbd,int xkbType,xkbIndicatorNotify *pEv) { int initialized; XkbInterestPtr interest; Time time = 0; CARD32 state,changed; interest = kbd->xkb_interest; if (!interest) return; initialized = 0; state = pEv->state; changed = pEv->changed; while (interest) { if ((!interest->client->clientGone) && (interest->client->requestVector != InitialVector) && (interest->client->xkbClientFlags&_XkbClientInitialized) && (((xkbType==XkbIndicatorStateNotify)&& (interest->iStateNotifyMask&changed))|| ((xkbType==XkbIndicatorMapNotify)&& (interest->iMapNotifyMask&changed)))) { if (!initialized) { pEv->type = XkbEventCode + XkbEventBase; pEv->xkbType = xkbType; pEv->deviceID = kbd->id; pEv->time = time = GetTimeInMillis(); initialized= 1; } pEv->sequenceNumber = interest->client->sequence; pEv->time = time; pEv->changed = changed; pEv->state = state; if ( interest->client->swapped ) { swaps(&pEv->sequenceNumber); swapl(&pEv->time); swapl(&pEv->changed); swapl(&pEv->state); } WriteToClient(interest->client, sizeof(xEvent), pEv); } interest= interest->next; } return; } void XkbHandleBell( BOOL force, BOOL eventOnly, DeviceIntPtr kbd, CARD8 percent, void * pCtrl, CARD8 class, Atom name, WindowPtr pWin, ClientPtr pClient) { xkbBellNotify bn; int initialized; XkbSrvInfoPtr xkbi; XkbInterestPtr interest; CARD8 id; CARD16 pitch,duration; Time time = 0; XID winID = 0; xkbi = kbd->key->xkbInfo; if ((force||(xkbi->desc->ctrls->enabled_ctrls&XkbAudibleBellMask))&& (!eventOnly)) { (*kbd->kbdfeed->BellProc)(percent,kbd,(void *)pCtrl,class); } interest = kbd->xkb_interest; if ((!interest)||(force)) return; if ((class==0)||(class==KbdFeedbackClass)) { KeybdCtrl *pKeyCtrl= (KeybdCtrl *)pCtrl; id= pKeyCtrl->id; pitch= pKeyCtrl->bell_pitch; duration= pKeyCtrl->bell_duration; } else if (class==BellFeedbackClass) { BellCtrl *pBellCtrl= (BellCtrl *)pCtrl; id= pBellCtrl->id; pitch= pBellCtrl->pitch; duration= pBellCtrl->duration; } else return; initialized = 0; while (interest) { if ((!interest->client->clientGone) && (interest->client->requestVector != InitialVector) && (interest->client->xkbClientFlags&_XkbClientInitialized) && (interest->bellNotifyMask)) { if (!initialized) { time = GetTimeInMillis(); bn.type = XkbEventCode + XkbEventBase; bn.xkbType = XkbBellNotify; bn.deviceID = kbd->id; bn.bellClass = class; bn.bellID = id; bn.percent= percent; bn.eventOnly = (eventOnly!=0); winID= (pWin?pWin->drawable.id:None); initialized= 1; } bn.sequenceNumber = interest->client->sequence; bn.time = time; bn.pitch = pitch; bn.duration = duration; bn.name = name; bn.window= winID; if ( interest->client->swapped ) { swaps(&bn.sequenceNumber); swapl(&bn.time); swaps(&bn.pitch); swaps(&bn.duration); swapl(&bn.name); swapl(&bn.window); } WriteToClient(interest->client, sizeof(xEvent), &bn); } interest= interest->next; } return; } void XkbSendAccessXNotify(DeviceIntPtr kbd,xkbAccessXNotify *pEv) { int initialized; XkbInterestPtr interest; Time time = 0; CARD16 sk_delay,db_delay; interest = kbd->xkb_interest; if (!interest) return; initialized = 0; sk_delay= pEv->slowKeysDelay; db_delay= pEv->debounceDelay; while (interest) { if ((!interest->client->clientGone) && (interest->client->requestVector != InitialVector) && (interest->client->xkbClientFlags&_XkbClientInitialized) && (interest->accessXNotifyMask&(1<detail))) { if (!initialized) { pEv->type = XkbEventCode + XkbEventBase; pEv->xkbType = XkbAccessXNotify; pEv->deviceID = kbd->id; pEv->time = time = GetTimeInMillis(); initialized= 1; } pEv->sequenceNumber = interest->client->sequence; pEv->time = time; pEv->slowKeysDelay = sk_delay; pEv->debounceDelay = db_delay; if ( interest->client->swapped ) { swaps(&pEv->sequenceNumber); swapl(&pEv->time); swaps(&pEv->slowKeysDelay); swaps(&pEv->debounceDelay); } WriteToClient(interest->client, sizeof(xEvent), pEv); } interest= interest->next; } return; } void XkbSendNamesNotify(DeviceIntPtr kbd,xkbNamesNotify *pEv) { int initialized; XkbInterestPtr interest; Time time = 0; CARD16 changed,changedVirtualMods; CARD32 changedIndicators; interest = kbd->xkb_interest; if (!interest) return; initialized = 0; changed= pEv->changed; changedIndicators= pEv->changedIndicators; changedVirtualMods= pEv->changedVirtualMods; while (interest) { if ((!interest->client->clientGone) && (interest->client->requestVector != InitialVector) && (interest->client->xkbClientFlags&_XkbClientInitialized) && (interest->namesNotifyMask&pEv->changed)) { if (!initialized) { pEv->type = XkbEventCode + XkbEventBase; pEv->xkbType = XkbNamesNotify; pEv->deviceID = kbd->id; pEv->time = time = GetTimeInMillis(); initialized= 1; } pEv->sequenceNumber = interest->client->sequence; pEv->time = time; pEv->changed = changed; pEv->changedIndicators = changedIndicators; pEv->changedVirtualMods= changedVirtualMods; if ( interest->client->swapped ) { swaps(&pEv->sequenceNumber); swapl(&pEv->time); swaps(&pEv->changed); swapl(&pEv->changedIndicators); swaps(&pEv->changedVirtualMods); } WriteToClient(interest->client, sizeof(xEvent), pEv); } interest= interest->next; } return; } void XkbSendCompatMapNotify(DeviceIntPtr kbd,xkbCompatMapNotify *pEv) { int initialized; XkbInterestPtr interest; Time time = 0; CARD16 firstSI = 0, nSI = 0, nTotalSI = 0; interest = kbd->xkb_interest; if (!interest) return; initialized = 0; while (interest) { if ((!interest->client->clientGone) && (interest->client->requestVector != InitialVector) && (interest->client->xkbClientFlags&_XkbClientInitialized) && (interest->compatNotifyMask)) { if (!initialized) { pEv->type = XkbEventCode + XkbEventBase; pEv->xkbType = XkbCompatMapNotify; pEv->deviceID = kbd->id; pEv->time = time = GetTimeInMillis(); firstSI= pEv->firstSI; nSI= pEv->nSI; nTotalSI= pEv->nTotalSI; initialized= 1; } pEv->sequenceNumber = interest->client->sequence; pEv->time = time; pEv->firstSI = firstSI; pEv->nSI = nSI; pEv->nTotalSI = nTotalSI; if ( interest->client->swapped ) { swaps(&pEv->sequenceNumber); swapl(&pEv->time); swaps(&pEv->firstSI); swaps(&pEv->nSI); swaps(&pEv->nTotalSI); } WriteToClient(interest->client, sizeof(xEvent), pEv); } interest= interest->next; } return; } void XkbSendActionMessage(DeviceIntPtr kbd,xkbActionMessage *pEv) { int initialized; XkbSrvInfoPtr xkbi; XkbInterestPtr interest; Time time = 0; xkbi = kbd->key->xkbInfo; interest = kbd->xkb_interest; if (!interest) return; initialized = 0; pEv->mods= xkbi->state.mods; pEv->group= xkbi->state.group; while (interest) { if ((!interest->client->clientGone) && (interest->client->requestVector != InitialVector) && (interest->client->xkbClientFlags&_XkbClientInitialized) && (interest->actionMessageMask)) { if (!initialized) { pEv->type = XkbEventCode + XkbEventBase; pEv->xkbType = XkbActionMessage; pEv->deviceID = kbd->id; pEv->sequenceNumber = interest->client->sequence; pEv->time = time = GetTimeInMillis(); initialized= 1; } pEv->sequenceNumber = interest->client->sequence; pEv->time = time; if ( interest->client->swapped ) { swaps(&pEv->sequenceNumber); swapl(&pEv->time); } WriteToClient(interest->client, sizeof(xEvent), pEv); } interest= interest->next; } return; } void XkbSendExtensionDeviceNotify( DeviceIntPtr dev, ClientPtr client, xkbExtensionDeviceNotify * pEv) { int initialized; XkbInterestPtr interest; Time time = 0; CARD32 defined, state; CARD16 reason, supported = 0; interest = dev->xkb_interest; if (!interest) return; initialized = 0; reason= pEv->reason; defined= pEv->ledsDefined; state= pEv->ledState; while (interest) { if ((!interest->client->clientGone) && (interest->client->requestVector != InitialVector) && (interest->client->xkbClientFlags&_XkbClientInitialized) && (interest->extDevNotifyMask&reason)) { if (!initialized) { pEv->type = XkbEventCode + XkbEventBase; pEv->xkbType = XkbExtensionDeviceNotify; pEv->deviceID = dev->id; pEv->sequenceNumber = interest->client->sequence; pEv->time = time = GetTimeInMillis(); supported= pEv->supported; initialized= 1; } else { pEv->sequenceNumber = interest->client->sequence; pEv->time = time; pEv->ledsDefined= defined; pEv->ledState= state; pEv->reason= reason; pEv->supported= supported; } if (client!=interest->client) { /* only report UnsupportedFeature to the client that */ /* issued the failing request */ pEv->reason&= ~XkbXI_UnsupportedFeatureMask; if ((interest->extDevNotifyMask&reason)==0) continue; } if ( interest->client->swapped ) { swaps(&pEv->sequenceNumber); swapl(&pEv->time); swapl(&pEv->ledsDefined); swapl(&pEv->ledState); swaps(&pEv->reason); swaps(&pEv->supported); } WriteToClient(interest->client, sizeof(xEvent), pEv); } interest= interest->next; } return; } void XkbSendNotification( DeviceIntPtr kbd, XkbChangesPtr pChanges, XkbEventCausePtr cause) { XkbSrvLedInfoPtr sli; sli= NULL; if (pChanges->state_changes) { xkbStateNotify sn; sn.changed= pChanges->state_changes; sn.keycode= cause->kc; sn.eventType= cause->event; sn.requestMajor= cause->mjr; sn.requestMinor= cause->mnr; XkbSendStateNotify(kbd,&sn); } if (pChanges->map.changed) { xkbMapNotify mn; memset(&mn, 0, sizeof(xkbMapNotify)); mn.changed= pChanges->map.changed; mn.firstType= pChanges->map.first_type; mn.nTypes= pChanges->map.num_types; mn.firstKeySym= pChanges->map.first_key_sym; mn.nKeySyms= pChanges->map.num_key_syms; mn.firstKeyAct= pChanges->map.first_key_act; mn.nKeyActs= pChanges->map.num_key_acts; mn.firstKeyBehavior= pChanges->map.first_key_behavior; mn.nKeyBehaviors= pChanges->map.num_key_behaviors; mn.virtualMods= pChanges->map.vmods; mn.firstKeyExplicit= pChanges->map.first_key_explicit; mn.nKeyExplicit= pChanges->map.num_key_explicit; mn.firstModMapKey= pChanges->map.first_modmap_key; mn.nModMapKeys= pChanges->map.num_modmap_keys; mn.firstVModMapKey= pChanges->map.first_vmodmap_key; mn.nVModMapKeys= pChanges->map.num_vmodmap_keys; XkbSendMapNotify(kbd,&mn); } if ((pChanges->ctrls.changed_ctrls)|| (pChanges->ctrls.enabled_ctrls_changes)) { xkbControlsNotify cn; memset(&cn, 0, sizeof(xkbControlsNotify)); cn.changedControls= pChanges->ctrls.changed_ctrls; cn.enabledControlChanges= pChanges->ctrls.enabled_ctrls_changes; cn.keycode= cause->kc; cn.eventType= cause->event; cn.requestMajor= cause->mjr; cn.requestMinor= cause->mnr; XkbSendControlsNotify(kbd,&cn); } if (pChanges->indicators.map_changes) { xkbIndicatorNotify in; if (sli==NULL) sli= XkbFindSrvLedInfo(kbd,XkbDfltXIClass,XkbDfltXIId,0); memset(&in, 0, sizeof(xkbIndicatorNotify)); in.state= sli->effectiveState; in.changed= pChanges->indicators.map_changes; XkbSendIndicatorNotify(kbd,XkbIndicatorMapNotify,&in); } if (pChanges->indicators.state_changes) { xkbIndicatorNotify in; if (sli==NULL) sli= XkbFindSrvLedInfo(kbd,XkbDfltXIClass,XkbDfltXIId,0); memset(&in, 0, sizeof(xkbIndicatorNotify)); in.state= sli->effectiveState; in.changed= pChanges->indicators.state_changes; XkbSendIndicatorNotify(kbd,XkbIndicatorStateNotify,&in); } if (pChanges->names.changed) { xkbNamesNotify nn; memset(&nn, 0, sizeof(xkbNamesNotify)); nn.changed= pChanges->names.changed; nn.firstType= pChanges->names.first_type; nn.nTypes= pChanges->names.num_types; nn.firstLevelName= pChanges->names.first_lvl; nn.nLevelNames= pChanges->names.num_lvls; nn.nRadioGroups= pChanges->names.num_rg; nn.changedVirtualMods= pChanges->names.changed_vmods; nn.changedIndicators= pChanges->names.changed_indicators; XkbSendNamesNotify(kbd,&nn); } if ((pChanges->compat.changed_groups)||(pChanges->compat.num_si>0)) { xkbCompatMapNotify cmn; memset(&cmn, 0, sizeof(xkbCompatMapNotify)); cmn.changedGroups= pChanges->compat.changed_groups; cmn.firstSI= pChanges->compat.first_si; cmn.nSI= pChanges->compat.num_si; cmn.nTotalSI= kbd->key->xkbInfo->desc->compat->num_si; XkbSendCompatMapNotify(kbd,&cmn); } return; } /***====================================================================***/ Bool XkbFilterEvents(ClientPtr pClient,int nEvents,xEvent *xE) { int i, button_mask; DeviceIntPtr pXDev = (DeviceIntPtr)LookupKeyboardDevice(); XkbSrvInfoPtr xkbi; xkbi= pXDev->key->xkbInfo; if ( pClient->xkbClientFlags & _XkbClientInitialized ) { if ((xkbDebugFlags&0x10)&& ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) { DebugF("XKbFilterWriteEvents:\n"); DebugF(" Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state); DebugF(" XkbLastRepeatEvent!=xE (0x%x!=0x%x) %s\n", XkbLastRepeatEvent,xE, ((XkbLastRepeatEvent!=(void *)xE)?"True":"False")); DebugF(" (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n", pClient->xkbClientFlags, (_XkbWantsDetectableAutoRepeat(pClient)?"True":"False")); DebugF(" !IsRelease(%d) %s\n",xE[0].u.u.type, (!_XkbIsReleaseEvent(xE[0].u.u.type))?"True":"False"); } if ( (XkbLastRepeatEvent==(void *)xE) && (_XkbWantsDetectableAutoRepeat(pClient)) && (_XkbIsReleaseEvent(xE[0].u.u.type)) ) { return False; } if ((pXDev->grab != NullGrab) && pXDev->fromPassiveGrab && ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) { register unsigned state,flags; flags= pClient->xkbClientFlags; state= xkbi->state.compat_grab_mods; if (flags & XkbPCF_GrabsUseXKBStateMask) { int group; if (flags&XkbPCF_LookupStateWhenGrabbed) { group= xkbi->state.group; state= xkbi->state.lookup_mods; } else { state= xkbi->state.grab_mods; group= xkbi->state.base_group+xkbi->state.latched_group; if ((group<0)||(group>=xkbi->desc->ctrls->num_groups)) { group= XkbAdjustGroup(group,xkbi->desc->ctrls); } } state = XkbBuildCoreState(state, group); } else if (flags&XkbPCF_LookupStateWhenGrabbed) state= xkbi->state.compat_lookup_mods; xE[0].u.keyButtonPointer.state= state; } button_mask = 1 << xE[0].u.u.detail; if (xE[0].u.u.type == ButtonPress && ((xE[0].u.keyButtonPointer.state >> 7) & button_mask) == button_mask && (xkbi->lockedPtrButtons & button_mask) == button_mask) { /* If the MouseKeys is pressed, and the "real" mouse is also pressed * when the mouse is released, the server does not behave properly. * Faking a release of the button here solves the problem. */ DebugF("Faking release of button %d\n", xE[0].u.u.detail); XkbDDXFakePointerButton(ButtonRelease, xE[0].u.u.detail); } } else { register CARD8 type; for (i=0;istate.lookup_mods, xkbi->state.grab_mods); DebugF("compat lookup= 0x%02x, grab= 0x%02x\n", xkbi->state.compat_lookup_mods, xkbi->state.compat_grab_mods); } if ( (type>=KeyPress)&&(type<=MotionNotify) ) { CARD16 old,new; old= xE[i].u.keyButtonPointer.state&(~0x1f00); new= xE[i].u.keyButtonPointer.state&0x1F00; if (old==XkbStateFieldFromRec(&xkbi->state)) new|= xkbi->state.compat_lookup_mods; else new|= xkbi->state.compat_grab_mods; xE[i].u.keyButtonPointer.state= new; } else if ((type==EnterNotify)||(type==LeaveNotify)) { xE->u.enterLeave.state&= 0x1F00; xE->u.enterLeave.state|= xkbi->state.compat_grab_mods; } button_mask = 1 << xE[i].u.u.detail; if (type == ButtonPress && ((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask && (xkbi->lockedPtrButtons & button_mask) == button_mask) { DebugF("Faking release of button %d\n", xE[i].u.u.detail); XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail); } } } return True; } /***====================================================================***/ XkbInterestPtr XkbFindClientResource(DevicePtr inDev,ClientPtr client) { DeviceIntPtr dev = (DeviceIntPtr)inDev; XkbInterestPtr interest; if ( dev->xkb_interest ) { interest = dev->xkb_interest; while (interest){ if (interest->client==client) { return interest; } interest = interest->next; } } return NULL; } XkbInterestPtr XkbAddClientResource(DevicePtr inDev,ClientPtr client,XID id) { DeviceIntPtr dev = (DeviceIntPtr)inDev; XkbInterestPtr interest; interest = dev->xkb_interest; while (interest) { if (interest->client==client) return ((interest->resource==id)?interest:NULL); interest = interest->next; } interest = _XkbTypedAlloc(XkbInterestRec); bzero(interest,sizeof(XkbInterestRec)); if (interest) { interest->dev = dev; interest->client = client; interest->resource = id; interest->stateNotifyMask= 0; interest->ctrlsNotifyMask= 0; interest->namesNotifyMask= 0; interest->compatNotifyMask= 0; interest->bellNotifyMask= FALSE; interest->accessXNotifyMask= 0; interest->iStateNotifyMask= 0; interest->iMapNotifyMask= 0; interest->altSymsNotifyMask= 0; interest->next = dev->xkb_interest; dev->xkb_interest= interest; return interest; } return NULL; } int XkbRemoveResourceClient(DevicePtr inDev,XID id) { XkbSrvInfoPtr xkbi; DeviceIntPtr dev = (DeviceIntPtr)inDev; XkbInterestPtr interest; Bool found; unsigned long autoCtrls,autoValues; ClientPtr client = NULL; found= False; autoCtrls= autoValues= 0; if ( dev->xkb_interest ) { interest = dev->xkb_interest; if (interest && (interest->resource==id)){ dev->xkb_interest = interest->next; autoCtrls= interest->autoCtrls; autoValues= interest->autoCtrlValues; client= interest->client; _XkbFree(interest); found= True; } while ((!found)&&(interest->next)) { if (interest->next->resource==id) { XkbInterestPtr victim = interest->next; interest->next = victim->next; autoCtrls= victim->autoCtrls; autoValues= victim->autoCtrlValues; client= victim->client; _XkbFree(victim); found= True; } interest = interest->next; } } if (found && autoCtrls && dev->key && dev->key->xkbInfo ) { XkbEventCauseRec cause; xkbi= dev->key->xkbInfo; XkbSetCauseXkbReq(&cause,X_kbPerClientFlags,client); XkbEnableDisableControls(xkbi,autoCtrls,autoValues,NULL,&cause); } return found; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkbfmisc.c0000644000000000000000000004231513614532331017336 0ustar /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include "misc.h" #include "inputstr.h" #include "dix.h" #include "xkbstr.h" #include #include "xkbgeom.h" #include "xkb.h" unsigned _XkbKSCheckCase(KeySym ks) { unsigned set,rtrn; set= (ks & (~0xff)) >> 8; rtrn= 0; switch (set) { case 0: /* latin 1 */ if (((ks>=XK_A)&&(ks<=XK_Z))|| ((ks>=XK_Agrave)&&(ks<=XK_THORN)&&(ks!=XK_multiply))) { rtrn|= _XkbKSUpper; } if (((ks>=XK_a)&&(ks<=XK_z))|| ((ks>=XK_agrave)&&(ks<=XK_ydiaeresis))) { rtrn|= _XkbKSLower; } break; case 1: /* latin 2 */ if (((ks>=XK_Aogonek)&&(ks<=XK_Zabovedot)&&(ks!=XK_breve))|| ((ks>=XK_Racute)&&(ks<=XK_Tcedilla))) { rtrn|= _XkbKSUpper; } if (((ks>=XK_aogonek)&&(ks<=XK_zabovedot)&&(ks!=XK_caron))|| ((ks>=XK_racute)&&(ks<=XK_tcedilla))) { rtrn|= _XkbKSLower; } break; case 2: /* latin 3 */ if (((ks>=XK_Hstroke)&&(ks<=XK_Jcircumflex))|| ((ks>=XK_Cabovedot)&&(ks<=XK_Scircumflex))) { rtrn|= _XkbKSUpper; } if (((ks>=XK_hstroke)&&(ks<=XK_jcircumflex))|| ((ks>=XK_cabovedot)&&(ks<=XK_scircumflex))) { rtrn|= _XkbKSLower; } break; case 3: /* latin 4 */ if (((ks>=XK_Rcedilla)&&(ks<=XK_Tslash))|| (ks==XK_ENG)|| ((ks>=XK_Amacron)&&(ks<=XK_Umacron))) { rtrn|= _XkbKSUpper; } if (((ks>=XK_rcedilla)&&(ks<=XK_tslash))|| (ks==XK_eng)|| ((ks>=XK_amacron)&&(ks<=XK_umacron))) { rtrn|= _XkbKSLower; } break; case 18: /* latin 8 */ if ((ks==XK_Babovedot)|| ((ks>=XK_Dabovedot)&&(ks<=XK_Wacute))|| ((ks>=XK_Ygrave)&&(ks<=XK_Fabovedot))|| (ks==XK_Mabovedot)|| (ks==XK_Pabovedot)|| (ks==XK_Sabovedot)|| (ks==XK_Wdiaeresis)|| ((ks>=XK_Wcircumflex)&&(ks<=XK_Ycircumflex))) { rtrn|= _XkbKSUpper; } if ((ks==XK_babovedot)|| (ks==XK_dabovedot)|| (ks==XK_fabovedot)|| (ks==XK_mabovedot)|| ((ks>=XK_wgrave)&&(ks<=XK_wacute))|| (ks==XK_ygrave)|| ((ks>=XK_wdiaeresis)&&(ks<=XK_ycircumflex))) { rtrn|= _XkbKSLower; } break; case 19: /* latin 9 */ if ((ks==XK_OE)||(ks==XK_Ydiaeresis)) { rtrn|= _XkbKSUpper; } if (ks==XK_oe) { rtrn|= _XkbKSLower; } break; } return rtrn; } /***===================================================================***/ Bool XkbLookupGroupAndLevel( XkbDescPtr xkb, int key, int * mods_inout, int * grp_inout, int * lvl_rtrn) { int nG,eG; if ((!xkb)||(!XkbKeycodeInRange(xkb,key))||(!grp_inout)) return False; nG= XkbKeyNumGroups(xkb,key); eG= *grp_inout; if ( nG==0 ) { *grp_inout= 0; if (lvl_rtrn!=NULL) *lvl_rtrn= 0; return False; } else if ( nG==1 ) { eG= 0; } else if ( eG>=nG ) { unsigned gI= XkbKeyGroupInfo(xkb,key); switch (XkbOutOfRangeGroupAction(gI)) { default: eG %= nG; break; case XkbClampIntoRange: eG = nG-1; break; case XkbRedirectIntoRange: eG = XkbOutOfRangeGroupNumber(gI); if (eG>=nG) eG= 0; break; } } *grp_inout= eG; if (mods_inout!=NULL) { XkbKeyTypePtr type; int preserve; type = XkbKeyKeyType(xkb,key,eG); if (lvl_rtrn!=NULL) *lvl_rtrn= 0; preserve= 0; if (type->map) { /* find the shift level */ register int i; register XkbKTMapEntryPtr entry; for (i=0,entry=type->map;imap_count;i++,entry++) { if ((entry->active)&& (((*mods_inout)&type->mods.mask)==entry->mods.mask)){ if (lvl_rtrn!=NULL) *lvl_rtrn= entry->level; if (type->preserve) preserve= type->preserve[i].mask; break; } } } (*mods_inout)&= ~(type->mods.mask&(~preserve)); } return True; } /***===================================================================***/ static Bool XkbWriteSectionFromName(FILE *file,char *sectionName,char *name) { fprintf(file," xkb_%-20s { include \"%s\" };\n",sectionName,name); return True; } #define NEED_DESC(n) ((!n)||((n)[0]=='+')||((n)[0]=='|')||(strchr((n),'%'))) #define COMPLETE(n) ((n)&&(!NEED_DESC(n))) /* ARGSUSED */ static void _AddIncl( FILE * file, XkbFileInfo * result, Bool topLevel, Bool showImplicit, int index, void * priv) { if ((priv)&&(strcmp((char *)priv,"%")!=0)) fprintf(file," include \"%s\"\n",(char *)priv); return; } Bool XkbWriteXKBKeymapForNames( FILE * file, XkbComponentNamesPtr names, Display * dpy, XkbDescPtr xkb, unsigned want, unsigned need) { char * name; const char * tmp; unsigned complete; XkbNamesPtr old_names; int multi_section; unsigned wantNames,wantConfig,wantDflts; XkbFileInfo finfo; bzero(&finfo,sizeof(XkbFileInfo)); complete= 0; if ((name=names->keymap)==NULL) name= "default"; if (COMPLETE(names->keycodes)) complete|= XkmKeyNamesMask; if (COMPLETE(names->types)) complete|= XkmTypesMask; if (COMPLETE(names->compat)) complete|= XkmCompatMapMask; if (COMPLETE(names->symbols)) complete|= XkmSymbolsMask; if (COMPLETE(names->geometry)) complete|= XkmGeometryMask; want|= (complete|need); if (want&XkmSymbolsMask) want|= XkmKeyNamesMask|XkmTypesMask; if (want==0) return False; if (xkb!=NULL) { old_names= xkb->names; finfo.type= 0; finfo.defined= 0; finfo.xkb= xkb; if (!XkbDetermineFileType(&finfo,XkbXKBFile,NULL)) return False; } else old_names= NULL; wantConfig= want&(~complete); if (xkb!=NULL) { if (wantConfig&XkmTypesMask) { if ((!xkb->map) || (xkb->map->num_typescompat) || (xkb->compat->num_si<1)) wantConfig&= ~XkmCompatMapMask; } if (wantConfig&XkmSymbolsMask) { if ((!xkb->map) || (!xkb->map->key_sym_map)) wantConfig&= ~XkmSymbolsMask; } if (wantConfig&XkmIndicatorsMask) { if (!xkb->indicators) wantConfig&= ~XkmIndicatorsMask; } if (wantConfig&XkmKeyNamesMask) { if ((!xkb->names)||(!xkb->names->keys)) wantConfig&= ~XkmKeyNamesMask; } if ((wantConfig&XkmGeometryMask)&&(!xkb->geom)) wantConfig&= ~XkmGeometryMask; } else { wantConfig= 0; } complete|= wantConfig; wantDflts= 0; wantNames= want&(~complete); if ((xkb!=NULL) && (old_names!=NULL)) { if (wantNames&XkmTypesMask) { if (old_names->types!=None) { tmp= NameForAtom(old_names->types); names->types= Xstrdup(tmp); } else { wantDflts|= XkmTypesMask; } complete|= XkmTypesMask; } if (wantNames&XkmCompatMapMask) { if (old_names->compat!=None) { tmp= NameForAtom(old_names->compat); names->compat= Xstrdup(tmp); } else wantDflts|= XkmCompatMapMask; complete|= XkmCompatMapMask; } if (wantNames&XkmSymbolsMask) { if (old_names->symbols==None) return False; tmp= NameForAtom(old_names->symbols); names->symbols= Xstrdup(tmp); complete|= XkmSymbolsMask; } if (wantNames&XkmKeyNamesMask) { if (old_names->keycodes!=None) { tmp= NameForAtom(old_names->keycodes); names->keycodes= Xstrdup(tmp); } else wantDflts|= XkmKeyNamesMask; complete|= XkmKeyNamesMask; } if (wantNames&XkmGeometryMask) { if (old_names->geometry==None) return False; tmp= NameForAtom(old_names->geometry); names->geometry= Xstrdup(tmp); complete|= XkmGeometryMask; wantNames&= ~XkmGeometryMask; } } if (complete&XkmCompatMapMask) complete|= XkmIndicatorsMask|XkmVirtualModsMask; else if (complete&(XkmSymbolsMask|XkmTypesMask)) complete|= XkmVirtualModsMask; if (need & (~complete)) return False; if ((complete&XkmSymbolsMask)&&((XkmKeyNamesMask|XkmTypesMask)&(~complete))) return False; multi_section= 1; if (((complete&XkmKeymapRequired)==XkmKeymapRequired)&& ((complete&(~XkmKeymapLegal))==0)) { fprintf(file,"xkb_keymap \"%s\" {\n",name); } else if (((complete&XkmSemanticsRequired)==XkmSemanticsRequired)&& ((complete&(~XkmSemanticsLegal))==0)) { fprintf(file,"xkb_semantics \"%s\" {\n",name); } else if (((complete&XkmLayoutRequired)==XkmLayoutRequired)&& ((complete&(~XkmLayoutLegal))==0)) { fprintf(file,"xkb_layout \"%s\" {\n",name); } else if (XkmSingleSection(complete&(~XkmVirtualModsMask))) { multi_section= 0; } else { return False; } wantNames= complete&(~(wantConfig|wantDflts)); name= names->keycodes; if (wantConfig&XkmKeyNamesMask) XkbWriteXKBKeycodes(file,&finfo,False,False,_AddIncl,name); else if (wantDflts&XkmKeyNamesMask) fprintf(stderr,"Default symbols not implemented yet!\n"); else if (wantNames&XkmKeyNamesMask) XkbWriteSectionFromName(file,"keycodes",name); name= names->types; if (wantConfig&XkmTypesMask) XkbWriteXKBKeyTypes(file,&finfo,False,False,_AddIncl,name); else if (wantDflts&XkmTypesMask) fprintf(stderr,"Default types not implemented yet!\n"); else if (wantNames&XkmTypesMask) XkbWriteSectionFromName(file,"types",name); name= names->compat; if (wantConfig&XkmCompatMapMask) XkbWriteXKBCompatMap(file,&finfo,False,False,_AddIncl,name); else if (wantDflts&XkmCompatMapMask) fprintf(stderr,"Default interps not implemented yet!\n"); else if (wantNames&XkmCompatMapMask) XkbWriteSectionFromName(file,"compatibility",name); name= names->symbols; if (wantConfig&XkmSymbolsMask) XkbWriteXKBSymbols(file,&finfo,False,False,_AddIncl,name); else if (wantNames&XkmSymbolsMask) XkbWriteSectionFromName(file,"symbols",name); name= names->geometry; if (wantConfig&XkmGeometryMask) XkbWriteXKBGeometry(file,&finfo,False,False,_AddIncl,name); else if (wantNames&XkmGeometryMask) XkbWriteSectionFromName(file,"geometry",name); if (multi_section) fprintf(file,"};\n"); return True; } /***====================================================================***/ /*ARGSUSED*/ Status XkbMergeFile(XkbDescPtr xkb,XkbFileInfo finfo) { return BadImplementation; } /***====================================================================***/ int XkbFindKeycodeByName(XkbDescPtr xkb,char *name,Bool use_aliases) { register int i; if ((!xkb)||(!xkb->names)||(!xkb->names->keys)) return 0; for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) { if (strncmp(xkb->names->keys[i].name,name,XkbKeyNameLength)==0) return i; } if (!use_aliases) return 0; if (xkb->geom && xkb->geom->key_aliases) { XkbKeyAliasPtr a; a= xkb->geom->key_aliases; for (i=0;igeom->num_key_aliases;i++,a++) { if (strncmp(name,a->alias,XkbKeyNameLength)==0) return XkbFindKeycodeByName(xkb,a->real,False); } } if (xkb->names && xkb->names->key_aliases) { XkbKeyAliasPtr a; a= xkb->names->key_aliases; for (i=0;inames->num_key_aliases;i++,a++) { if (strncmp(name,a->alias,XkbKeyNameLength)==0) return XkbFindKeycodeByName(xkb,a->real,False); } } return 0; } unsigned XkbConvertGetByNameComponents(Bool toXkm,unsigned orig) { unsigned rtrn; rtrn= 0; if (toXkm) { if (orig&XkbGBN_TypesMask) rtrn|= XkmTypesMask; if (orig&XkbGBN_CompatMapMask) rtrn|= XkmCompatMapMask; if (orig&XkbGBN_SymbolsMask) rtrn|= XkmSymbolsMask; if (orig&XkbGBN_IndicatorMapMask) rtrn|= XkmIndicatorsMask; if (orig&XkbGBN_KeyNamesMask) rtrn|= XkmKeyNamesMask; if (orig&XkbGBN_GeometryMask) rtrn|= XkmGeometryMask; } else { if (orig&XkmTypesMask) rtrn|= XkbGBN_TypesMask; if (orig&XkmCompatMapMask) rtrn|= XkbGBN_CompatMapMask; if (orig&XkmSymbolsMask) rtrn|= XkbGBN_SymbolsMask; if (orig&XkmIndicatorsMask) rtrn|= XkbGBN_IndicatorMapMask; if (orig&XkmKeyNamesMask) rtrn|= XkbGBN_KeyNamesMask; if (orig&XkmGeometryMask) rtrn|= XkbGBN_GeometryMask; if (orig!=0) rtrn|= XkbGBN_OtherNamesMask; } return rtrn; } unsigned XkbConvertXkbComponents(Bool toXkm,unsigned orig) { unsigned rtrn; rtrn= 0; if (toXkm) { if (orig&XkbClientMapMask) rtrn|= XkmTypesMask|XkmSymbolsMask; if (orig&XkbServerMapMask) rtrn|= XkmTypesMask|XkmSymbolsMask; if (orig&XkbCompatMapMask) rtrn|= XkmCompatMapMask; if (orig&XkbIndicatorMapMask) rtrn|= XkmIndicatorsMask; if (orig&XkbNamesMask) rtrn|= XkmKeyNamesMask; if (orig&XkbGeometryMask) rtrn|= XkmGeometryMask; } else { if (orig!=0) rtrn|= XkbNamesMask; if (orig&XkmTypesMask) rtrn|= XkbClientMapMask; if (orig&XkmCompatMapMask) rtrn|= XkbCompatMapMask|XkbIndicatorMapMask; if (orig&XkmSymbolsMask) rtrn|=XkbClientMapMask|XkbServerMapMask; if (orig&XkmIndicatorsMask) rtrn|= XkbIndicatorMapMask; if (orig&XkmKeyNamesMask) rtrn|= XkbNamesMask|XkbIndicatorMapMask; if (orig&XkmGeometryMask) rtrn|= XkbGeometryMask; } return rtrn; } Bool XkbDetermineFileType(XkbFileInfoPtr finfo,int format,int *opts_missing) { unsigned present; XkbDescPtr xkb; if ((!finfo)||(!finfo->xkb)) return False; if (opts_missing) *opts_missing= 0; xkb= finfo->xkb; present= 0; if ((xkb->names)&&(xkb->names->keys)) present|= XkmKeyNamesMask; if ((xkb->map)&&(xkb->map->types)) present|= XkmTypesMask; if (xkb->compat) present|= XkmCompatMapMask; if ((xkb->map)&&(xkb->map->num_syms>1)) present|= XkmSymbolsMask; if (xkb->indicators) present|= XkmIndicatorsMask; if (xkb->geom) present|= XkmGeometryMask; if (!present) return False; else switch (present) { case XkmKeyNamesMask: finfo->type= XkmKeyNamesIndex; finfo->defined= present; return True; case XkmTypesMask: finfo->type= XkmTypesIndex; finfo->defined= present; return True; case XkmCompatMapMask: finfo->type= XkmCompatMapIndex; finfo->defined= present; return True; case XkmSymbolsMask: if (format!=XkbXKMFile) { finfo->type= XkmSymbolsIndex; finfo->defined= present; return True; } break; case XkmGeometryMask: finfo->type= XkmGeometryIndex; finfo->defined= present; return True; } if ((present&(~XkmSemanticsLegal))==0) { if ((XkmSemanticsRequired&present)==XkmSemanticsRequired) { if (opts_missing) *opts_missing= XkmSemanticsOptional&(~present); finfo->type= XkmSemanticsFile; finfo->defined= present; return True; } } else if ((present&(~XkmLayoutLegal))==0) { if ((XkmLayoutRequired&present)==XkmLayoutRequired) { if (opts_missing) *opts_missing= XkmLayoutOptional&(~present); finfo->type= XkmLayoutFile; finfo->defined= present; return True; } } else if ((present&(~XkmKeymapLegal))==0) { if ((XkmKeymapRequired&present)==XkmKeymapRequired) { if (opts_missing) *opts_missing= XkmKeymapOptional&(~present); finfo->type= XkmKeymapFile; finfo->defined= present; return True; } } return False; } /* all latin-1 alphanumerics, plus parens, slash, minus, underscore and */ /* wildcards */ static unsigned char componentSpecLegal[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, 0xff, 0x83, 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff }; void XkbEnsureSafeMapName(char *name) { if (name==NULL) return; while (*name!='\0') { if ((componentSpecLegal[(*name)/8]&(1<<((*name)%8)))==0) *name= '_'; name++; } return; } /***====================================================================***/ #define UNMATCHABLE(c) (((c)=='(')||((c)==')')||((c)=='/')) Bool XkbNameMatchesPattern(char *name,char *ptrn) { while (ptrn[0]!='\0') { if (name[0]=='\0') { if (ptrn[0]=='*') { ptrn++; continue; } return False; } if (ptrn[0]=='?') { if (UNMATCHABLE(name[0])) return False; } else if (ptrn[0]=='*') { if ((!UNMATCHABLE(name[0]))&&XkbNameMatchesPattern(name+1,ptrn)) return True; return XkbNameMatchesPattern(name,ptrn+1); } else if (ptrn[0]!=name[0]) return False; name++; ptrn++; } /* if we get here, the pattern is exhausted (-:just like me:-) */ return (name[0]=='\0'); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/XKBGAlloc.c0000644000000000000000000006144113614532331017237 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include "misc.h" #include "inputstr.h" #include #include "xkbgeom.h" /***====================================================================***/ static void _XkbFreeGeomLeafElems( Bool freeAll, int first, int count, unsigned short * num_inout, unsigned short * sz_inout, char ** elems, unsigned int elem_sz) { if ((freeAll)||(*elems==NULL)) { *num_inout= *sz_inout= 0; if (*elems!=NULL) { _XkbFree(*elems); *elems= NULL; } return; } if ((first>=(*num_inout))||(first<0)||(count<1)) return; if (first+count>=(*num_inout)) { /* truncating the array is easy */ (*num_inout)= first; } else { char * ptr; int extra; ptr= *elems; extra= ((*num_inout)-(first+count))*elem_sz; if (extra>0) memmove(&ptr[first*elem_sz],&ptr[(first+count)*elem_sz],extra); (*num_inout)-= count; } return; } typedef void (*ContentsClearFunc)( char * /* priv */ ); static void _XkbFreeGeomNonLeafElems( Bool freeAll, int first, int count, unsigned short * num_inout, unsigned short * sz_inout, char ** elems, unsigned int elem_sz, ContentsClearFunc freeFunc) { register int i; register char *ptr; if (freeAll) { first= 0; count= (*num_inout); } else if ((first>=(*num_inout))||(first<0)||(count<1)) return; else if (first+count>(*num_inout)) count= (*num_inout)-first; if (*elems==NULL) return; if (freeFunc) { ptr= *elems; ptr+= first*elem_sz; for (i=0;i=(*num_inout)) *num_inout= first; else { i= ((*num_inout)-(first+count))*elem_sz; ptr= *elems; memmove(&ptr[first*elem_sz],&ptr[(first+count)*elem_sz],i); (*num_inout)-= count; } return; } /***====================================================================***/ static void _XkbClearProperty(char *prop_in) { XkbPropertyPtr prop= (XkbPropertyPtr)prop_in; if (prop->name) { _XkbFree(prop->name); prop->name= NULL; } if (prop->value) { _XkbFree(prop->value); prop->value= NULL; } return; } void XkbFreeGeomProperties( XkbGeometryPtr geom, int first, int count, Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll,first,count, &geom->num_properties,&geom->sz_properties, (char **)&geom->properties, sizeof(XkbPropertyRec),_XkbClearProperty); return; } /***====================================================================***/ void XkbFreeGeomKeyAliases( XkbGeometryPtr geom, int first, int count, Bool freeAll) { _XkbFreeGeomLeafElems(freeAll,first,count, &geom->num_key_aliases,&geom->sz_key_aliases, (char **)&geom->key_aliases, sizeof(XkbKeyAliasRec)); return; } /***====================================================================***/ static void _XkbClearColor(char *color_in) { XkbColorPtr color= (XkbColorPtr)color_in; if (color->spec) _XkbFree(color->spec); return; } void XkbFreeGeomColors(XkbGeometryPtr geom,int first,int count,Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll,first,count, &geom->num_colors,&geom->sz_colors, (char **)&geom->colors, sizeof(XkbColorRec),_XkbClearColor); return; } /***====================================================================***/ void XkbFreeGeomPoints(XkbOutlinePtr outline,int first,int count,Bool freeAll) { _XkbFreeGeomLeafElems(freeAll,first,count, &outline->num_points,&outline->sz_points, (char **)&outline->points, sizeof(XkbPointRec)); return; } /***====================================================================***/ static void _XkbClearOutline(char *outline_in) { XkbOutlinePtr outline= (XkbOutlinePtr)outline_in; if (outline->points!=NULL) XkbFreeGeomPoints(outline,0,outline->num_points,True); return; } void XkbFreeGeomOutlines(XkbShapePtr shape,int first,int count,Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll,first,count, &shape->num_outlines,&shape->sz_outlines, (char **)&shape->outlines, sizeof(XkbOutlineRec),_XkbClearOutline); return; } /***====================================================================***/ static void _XkbClearShape(char *shape_in) { XkbShapePtr shape= (XkbShapePtr)shape_in; if (shape->outlines) XkbFreeGeomOutlines(shape,0,shape->num_outlines,True); return; } void XkbFreeGeomShapes(XkbGeometryPtr geom,int first,int count,Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll,first,count, &geom->num_shapes,&geom->sz_shapes, (char **)&geom->shapes, sizeof(XkbShapeRec),_XkbClearShape); return; } /***====================================================================***/ void XkbFreeGeomOverlayKeys(XkbOverlayRowPtr row,int first,int count,Bool freeAll) { _XkbFreeGeomLeafElems(freeAll,first,count, &row->num_keys,&row->sz_keys, (char **)&row->keys, sizeof(XkbOverlayKeyRec)); return; } /***====================================================================***/ static void _XkbClearOverlayRow(char *row_in) { XkbOverlayRowPtr row= (XkbOverlayRowPtr)row_in; if (row->keys!=NULL) XkbFreeGeomOverlayKeys(row,0,row->num_keys,True); return; } void XkbFreeGeomOverlayRows(XkbOverlayPtr overlay,int first,int count,Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll,first,count, &overlay->num_rows,&overlay->sz_rows, (char **)&overlay->rows, sizeof(XkbOverlayRowRec),_XkbClearOverlayRow); return; } /***====================================================================***/ static void _XkbClearOverlay(char *overlay_in) { XkbOverlayPtr overlay= (XkbOverlayPtr)overlay_in; if (overlay->rows!=NULL) XkbFreeGeomOverlayRows(overlay,0,overlay->num_rows,True); return; } void XkbFreeGeomOverlays(XkbSectionPtr section,int first,int count,Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll,first,count, §ion->num_overlays,§ion->sz_overlays, (char **)§ion->overlays, sizeof(XkbOverlayRec),_XkbClearOverlay); return; } /***====================================================================***/ void XkbFreeGeomKeys(XkbRowPtr row,int first,int count,Bool freeAll) { _XkbFreeGeomLeafElems(freeAll,first,count, &row->num_keys,&row->sz_keys, (char **)&row->keys, sizeof(XkbKeyRec)); return; } /***====================================================================***/ static void _XkbClearRow(char *row_in) { XkbRowPtr row= (XkbRowPtr)row_in; if (row->keys!=NULL) XkbFreeGeomKeys(row,0,row->num_keys,True); return; } void XkbFreeGeomRows(XkbSectionPtr section,int first,int count,Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll,first,count, §ion->num_rows,§ion->sz_rows, (char **)§ion->rows, sizeof(XkbRowRec),_XkbClearRow); } /***====================================================================***/ static void _XkbClearSection(char *section_in) { XkbSectionPtr section= (XkbSectionPtr)section_in; if (section->rows!=NULL) XkbFreeGeomRows(section,0,section->num_rows,True); if (section->doodads!=NULL) { XkbFreeGeomDoodads(section->doodads,section->num_doodads,True); section->doodads= NULL; } return; } void XkbFreeGeomSections(XkbGeometryPtr geom,int first,int count,Bool freeAll) { _XkbFreeGeomNonLeafElems(freeAll,first,count, &geom->num_sections,&geom->sz_sections, (char **)&geom->sections, sizeof(XkbSectionRec),_XkbClearSection); return; } /***====================================================================***/ static void _XkbClearDoodad(char *doodad_in) { XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in; switch (doodad->any.type) { case XkbTextDoodad: { if (doodad->text.text!=NULL) { _XkbFree(doodad->text.text); doodad->text.text= NULL; } if (doodad->text.font!=NULL) { _XkbFree(doodad->text.font); doodad->text.font= NULL; } } break; case XkbLogoDoodad: { if (doodad->logo.logo_name!=NULL) { _XkbFree(doodad->logo.logo_name); doodad->logo.logo_name= NULL; } } break; } return; } void XkbFreeGeomDoodads(XkbDoodadPtr doodads,int nDoodads,Bool freeAll) { register int i; register XkbDoodadPtr doodad; if (doodads) { for (i=0,doodad= doodads;iproperties!=NULL)) XkbFreeGeomProperties(geom,0,geom->num_properties,True); if ((which&XkbGeomColorsMask)&&(geom->colors!=NULL)) XkbFreeGeomColors(geom,0,geom->num_colors,True); if ((which&XkbGeomShapesMask)&&(geom->shapes!=NULL)) XkbFreeGeomShapes(geom,0,geom->num_shapes,True); if ((which&XkbGeomSectionsMask)&&(geom->sections!=NULL)) XkbFreeGeomSections(geom,0,geom->num_sections,True); if ((which&XkbGeomDoodadsMask)&&(geom->doodads!= NULL)) { XkbFreeGeomDoodads(geom->doodads,geom->num_doodads,True); geom->doodads= NULL; geom->num_doodads= geom->sz_doodads= 0; } if ((which&XkbGeomKeyAliasesMask)&&(geom->key_aliases!=NULL)) XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,True); if (freeMap) { if (geom->label_font!=NULL) { _XkbFree(geom->label_font); geom->label_font= NULL; } _XkbFree(geom); } return; } /***====================================================================***/ static Status _XkbGeomAlloc( XPointer * old, unsigned short * num, unsigned short * total, int num_new, size_t sz_elem) { if (num_new<1) return Success; if ((*old)==NULL) *num= *total= 0; if ((*num)+num_new<=(*total)) return Success; *total= (*num)+num_new; if ((*old)!=NULL) (*old)= (XPointer)_XkbRealloc((*old),(*total)*sz_elem); else (*old)= (XPointer)_XkbCalloc((*total),sz_elem); if ((*old)==NULL) { *total= *num= 0; return BadAlloc; } if (*num>0) { char *tmp= (char *)(*old); bzero(&tmp[sz_elem*(*num)],(num_new*sz_elem)); } return Success; } #define _XkbAllocProps(g,n) _XkbGeomAlloc((XPointer *)&(g)->properties,\ &(g)->num_properties,&(g)->sz_properties,\ (n),sizeof(XkbPropertyRec)) #define _XkbAllocColors(g,n) _XkbGeomAlloc((XPointer *)&(g)->colors,\ &(g)->num_colors,&(g)->sz_colors,\ (n),sizeof(XkbColorRec)) #define _XkbAllocShapes(g,n) _XkbGeomAlloc((XPointer *)&(g)->shapes,\ &(g)->num_shapes,&(g)->sz_shapes,\ (n),sizeof(XkbShapeRec)) #define _XkbAllocSections(g,n) _XkbGeomAlloc((XPointer *)&(g)->sections,\ &(g)->num_sections,&(g)->sz_sections,\ (n),sizeof(XkbSectionRec)) #define _XkbAllocDoodads(g,n) _XkbGeomAlloc((XPointer *)&(g)->doodads,\ &(g)->num_doodads,&(g)->sz_doodads,\ (n),sizeof(XkbDoodadRec)) #define _XkbAllocKeyAliases(g,n) _XkbGeomAlloc((XPointer *)&(g)->key_aliases,\ &(g)->num_key_aliases,&(g)->sz_key_aliases,\ (n),sizeof(XkbKeyAliasRec)) #define _XkbAllocOutlines(s,n) _XkbGeomAlloc((XPointer *)&(s)->outlines,\ &(s)->num_outlines,&(s)->sz_outlines,\ (n),sizeof(XkbOutlineRec)) #define _XkbAllocRows(s,n) _XkbGeomAlloc((XPointer *)&(s)->rows,\ &(s)->num_rows,&(s)->sz_rows,\ (n),sizeof(XkbRowRec)) #define _XkbAllocPoints(o,n) _XkbGeomAlloc((XPointer *)&(o)->points,\ &(o)->num_points,&(o)->sz_points,\ (n),sizeof(XkbPointRec)) #define _XkbAllocKeys(r,n) _XkbGeomAlloc((XPointer *)&(r)->keys,\ &(r)->num_keys,&(r)->sz_keys,\ (n),sizeof(XkbKeyRec)) #define _XkbAllocOverlays(s,n) _XkbGeomAlloc((XPointer *)&(s)->overlays,\ &(s)->num_overlays,&(s)->sz_overlays,\ (n),sizeof(XkbOverlayRec)) #define _XkbAllocOverlayRows(o,n) _XkbGeomAlloc((XPointer *)&(o)->rows,\ &(o)->num_rows,&(o)->sz_rows,\ (n),sizeof(XkbOverlayRowRec)) #define _XkbAllocOverlayKeys(r,n) _XkbGeomAlloc((XPointer *)&(r)->keys,\ &(r)->num_keys,&(r)->sz_keys,\ (n),sizeof(XkbOverlayKeyRec)) Status XkbAllocGeomProps(XkbGeometryPtr geom,int nProps) { return _XkbAllocProps(geom,nProps); } Status XkbAllocGeomColors(XkbGeometryPtr geom,int nColors) { return _XkbAllocColors(geom,nColors); } Status XkbAllocGeomKeyAliases(XkbGeometryPtr geom,int nKeyAliases) { return _XkbAllocKeyAliases(geom,nKeyAliases); } Status XkbAllocGeomShapes(XkbGeometryPtr geom,int nShapes) { return _XkbAllocShapes(geom,nShapes); } Status XkbAllocGeomSections(XkbGeometryPtr geom,int nSections) { return _XkbAllocSections(geom,nSections); } Status XkbAllocGeomOverlays(XkbSectionPtr section,int nOverlays) { return _XkbAllocOverlays(section,nOverlays); } Status XkbAllocGeomOverlayRows(XkbOverlayPtr overlay,int nRows) { return _XkbAllocOverlayRows(overlay,nRows); } Status XkbAllocGeomOverlayKeys(XkbOverlayRowPtr row,int nKeys) { return _XkbAllocOverlayKeys(row,nKeys); } Status XkbAllocGeomDoodads(XkbGeometryPtr geom,int nDoodads) { return _XkbAllocDoodads(geom,nDoodads); } Status XkbAllocGeomSectionDoodads(XkbSectionPtr section,int nDoodads) { return _XkbAllocDoodads(section,nDoodads); } Status XkbAllocGeomOutlines(XkbShapePtr shape,int nOL) { return _XkbAllocOutlines(shape,nOL); } Status XkbAllocGeomRows(XkbSectionPtr section,int nRows) { return _XkbAllocRows(section,nRows); } Status XkbAllocGeomPoints(XkbOutlinePtr ol,int nPts) { return _XkbAllocPoints(ol,nPts); } Status XkbAllocGeomKeys(XkbRowPtr row,int nKeys) { return _XkbAllocKeys(row,nKeys); } Status XkbAllocGeometry(XkbDescPtr xkb,XkbGeometrySizesPtr sizes) { XkbGeometryPtr geom; Status rtrn; if (xkb->geom==NULL) { xkb->geom= _XkbTypedCalloc(1,XkbGeometryRec); if (!xkb->geom) return BadAlloc; } geom= xkb->geom; if ((sizes->which&XkbGeomPropertiesMask)&& ((rtrn=_XkbAllocProps(geom,sizes->num_properties))!=Success)) { goto BAIL; } if ((sizes->which&XkbGeomColorsMask)&& ((rtrn=_XkbAllocColors(geom,sizes->num_colors))!=Success)) { goto BAIL; } if ((sizes->which&XkbGeomShapesMask)&& ((rtrn=_XkbAllocShapes(geom,sizes->num_shapes))!=Success)) { goto BAIL; } if ((sizes->which&XkbGeomSectionsMask)&& ((rtrn=_XkbAllocSections(geom,sizes->num_sections))!=Success)) { goto BAIL; } if ((sizes->which&XkbGeomDoodadsMask)&& ((rtrn=_XkbAllocDoodads(geom,sizes->num_doodads))!=Success)) { goto BAIL; } if ((sizes->which&XkbGeomKeyAliasesMask)&& ((rtrn=_XkbAllocKeyAliases(geom,sizes->num_key_aliases))!=Success)) { goto BAIL; } return Success; BAIL: XkbFreeGeometry(geom,XkbGeomAllMask,True); xkb->geom= NULL; return rtrn; } /***====================================================================***/ XkbPropertyPtr XkbAddGeomProperty(XkbGeometryPtr geom,char *name,char *value) { register int i; register XkbPropertyPtr prop; if ((!geom)||(!name)||(!value)) return NULL; for (i=0,prop=geom->properties;inum_properties;i++,prop++) { if ((prop->name)&&(strcmp(name,prop->name)==0)) { if (prop->value) _XkbFree(prop->value); prop->value= (char *)_XkbAlloc(strlen(value)+1); if (prop->value) strcpy(prop->value,value); return prop; } } if ((geom->num_properties>=geom->sz_properties)&& (_XkbAllocProps(geom,1)!=Success)) { return NULL; } prop= &geom->properties[geom->num_properties]; prop->name= (char *)_XkbAlloc(strlen(name)+1); if (!name) return NULL; strcpy(prop->name,name); prop->value= (char *)_XkbAlloc(strlen(value)+1); if (!value) { _XkbFree(prop->name); prop->name= NULL; return NULL; } strcpy(prop->value,value); geom->num_properties++; return prop; } XkbKeyAliasPtr XkbAddGeomKeyAlias(XkbGeometryPtr geom,char *aliasStr,char *realStr) { register int i; register XkbKeyAliasPtr alias; if ((!geom)||(!aliasStr)||(!realStr)||(!aliasStr[0])||(!realStr[0])) return NULL; for (i=0,alias=geom->key_aliases;inum_key_aliases;i++,alias++) { if (strncmp(alias->alias,aliasStr,XkbKeyNameLength)==0) { bzero(alias->real,XkbKeyNameLength); memcpy(alias->real, realStr, min(XkbKeyNameLength, strlen(realStr))); return alias; } } if ((geom->num_key_aliases>=geom->sz_key_aliases)&& (_XkbAllocKeyAliases(geom,1)!=Success)) { return NULL; } alias= &geom->key_aliases[geom->num_key_aliases]; bzero(alias,sizeof(XkbKeyAliasRec)); memcpy(alias->alias, aliasStr, min(XkbKeyNameLength, strlen(aliasStr))); memcpy(alias->real, realStr, min(XkbKeyNameLength, strlen(realStr))); geom->num_key_aliases++; return alias; } XkbColorPtr XkbAddGeomColor(XkbGeometryPtr geom,char *spec,unsigned int pixel) { register int i; register XkbColorPtr color; if ((!geom)||(!spec)) return NULL; for (i=0,color=geom->colors;inum_colors;i++,color++) { if ((color->spec)&&(strcmp(color->spec,spec)==0)) { color->pixel= pixel; return color; } } if ((geom->num_colors>=geom->sz_colors)&& (_XkbAllocColors(geom,1)!=Success)) { return NULL; } color= &geom->colors[geom->num_colors]; color->pixel= pixel; color->spec= (char *)_XkbAlloc(strlen(spec)+1); if (!color->spec) return NULL; strcpy(color->spec,spec); geom->num_colors++; return color; } XkbOutlinePtr XkbAddGeomOutline(XkbShapePtr shape,int sz_points) { XkbOutlinePtr outline; if ((!shape)||(sz_points<0)) return NULL; if ((shape->num_outlines>=shape->sz_outlines)&& (_XkbAllocOutlines(shape,1)!=Success)) { return NULL; } outline= &shape->outlines[shape->num_outlines]; bzero(outline,sizeof(XkbOutlineRec)); if ((sz_points>0)&&(_XkbAllocPoints(outline,sz_points)!=Success)) return NULL; shape->num_outlines++; return outline; } XkbShapePtr XkbAddGeomShape(XkbGeometryPtr geom,Atom name,int sz_outlines) { XkbShapePtr shape; register int i; if ((!geom)||(!name)||(sz_outlines<0)) return NULL; if (geom->num_shapes>0) { for (shape=geom->shapes,i=0;inum_shapes;i++,shape++) { if (name==shape->name) return shape; } } if ((geom->num_shapes>=geom->sz_shapes)&& (_XkbAllocShapes(geom,1)!=Success)) return NULL; shape= &geom->shapes[geom->num_shapes]; bzero(shape,sizeof(XkbShapeRec)); if ((sz_outlines>0)&&(_XkbAllocOutlines(shape,sz_outlines)!=Success)) return NULL; shape->name= name; shape->primary= shape->approx= NULL; geom->num_shapes++; return shape; } XkbKeyPtr XkbAddGeomKey(XkbRowPtr row) { XkbKeyPtr key; if (!row) return NULL; if ((row->num_keys>=row->sz_keys)&&(_XkbAllocKeys(row,1)!=Success)) return NULL; key= &row->keys[row->num_keys++]; bzero(key,sizeof(XkbKeyRec)); return key; } XkbRowPtr XkbAddGeomRow(XkbSectionPtr section,int sz_keys) { XkbRowPtr row; if ((!section)||(sz_keys<0)) return NULL; if ((section->num_rows>=section->sz_rows)&& (_XkbAllocRows(section,1)!=Success)) return NULL; row= §ion->rows[section->num_rows]; bzero(row,sizeof(XkbRowRec)); if ((sz_keys>0)&&(_XkbAllocKeys(row,sz_keys)!=Success)) return NULL; section->num_rows++; return row; } XkbSectionPtr XkbAddGeomSection( XkbGeometryPtr geom, Atom name, int sz_rows, int sz_doodads, int sz_over) { register int i; XkbSectionPtr section; if ((!geom)||(name==None)||(sz_rows<0)) return NULL; for (i=0,section=geom->sections;inum_sections;i++,section++) { if (section->name!=name) continue; if (((sz_rows>0)&&(_XkbAllocRows(section,sz_rows)!=Success))|| ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success))|| ((sz_over>0)&&(_XkbAllocOverlays(section,sz_over)!=Success))) return NULL; return section; } if ((geom->num_sections>=geom->sz_sections)&& (_XkbAllocSections(geom,1)!=Success)) return NULL; section= &geom->sections[geom->num_sections]; if ((sz_rows>0)&&(_XkbAllocRows(section,sz_rows)!=Success)) return NULL; if ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success)) { if (section->rows) { _XkbFree(section->rows); section->rows= NULL; section->sz_rows= section->num_rows= 0; } return NULL; } section->name= name; geom->num_sections++; return section; } XkbDoodadPtr XkbAddGeomDoodad(XkbGeometryPtr geom,XkbSectionPtr section,Atom name) { XkbDoodadPtr old,doodad; register int i,nDoodads; if ((!geom)||(name==None)) return NULL; if ((section!=NULL)&&(section->num_doodads>0)) { old= section->doodads; nDoodads= section->num_doodads; } else { old= geom->doodads; nDoodads= geom->num_doodads; } for (i=0,doodad=old;iany.name==name) return doodad; } if (section) { if ((section->num_doodads>=geom->sz_doodads)&& (_XkbAllocDoodads(section,1)!=Success)) { return NULL; } doodad= §ion->doodads[section->num_doodads++]; } else { if ((geom->num_doodads>=geom->sz_doodads)&& (_XkbAllocDoodads(geom,1)!=Success)) return NULL; doodad= &geom->doodads[geom->num_doodads++]; } bzero(doodad,sizeof(XkbDoodadRec)); doodad->any.name= name; return doodad; } XkbOverlayKeyPtr XkbAddGeomOverlayKey( XkbOverlayPtr overlay, XkbOverlayRowPtr row, char * over, char * under) { register int i; XkbOverlayKeyPtr key; XkbSectionPtr section; XkbRowPtr row_under; Bool found; if ((!overlay)||(!row)||(!over)||(!under)) return NULL; section= overlay->section_under; if (row->row_under>=section->num_rows) return NULL; row_under= §ion->rows[row->row_under]; for (i=0,found=False;inum_keys;i++) { if (strncmp(under,row_under->keys[i].name.name,XkbKeyNameLength)==0) { found= True; break; } } if (!found) return NULL; if ((row->num_keys>=row->sz_keys)&&(_XkbAllocOverlayKeys(row,1)!=Success)) return NULL; key= &row->keys[row->num_keys]; memcpy(key->under.name, under, min(XkbKeyNameLength, strlen(under))); memcpy(key->over.name, over, min(XkbKeyNameLength, strlen(over))); row->num_keys++; return key; } XkbOverlayRowPtr XkbAddGeomOverlayRow(XkbOverlayPtr overlay,int row_under,int sz_keys) { register int i; XkbOverlayRowPtr row; if ((!overlay)||(sz_keys<0)) return NULL; if (row_under>=overlay->section_under->num_rows) return NULL; for (i=0;inum_rows;i++) { if (overlay->rows[i].row_under==row_under) { row= &overlay->rows[i]; if ((row->sz_keysrows[i]; } } if ((overlay->num_rows>=overlay->sz_rows)&& (_XkbAllocOverlayRows(overlay,1)!=Success)) return NULL; row= &overlay->rows[overlay->num_rows]; bzero(row,sizeof(XkbOverlayRowRec)); if ((sz_keys>0)&&(_XkbAllocOverlayKeys(row,sz_keys)!=Success)) return NULL; row->row_under= row_under; overlay->num_rows++; return row; } XkbOverlayPtr XkbAddGeomOverlay(XkbSectionPtr section,Atom name,int sz_rows) { register int i; XkbOverlayPtr overlay; if ((!section)||(name==None)||(sz_rows==0)) return NULL; for (i=0,overlay=section->overlays;inum_overlays;i++,overlay++) { if (overlay->name==name) { if ((sz_rows>0)&&(_XkbAllocOverlayRows(overlay,sz_rows)!=Success)) return NULL; return overlay; } } if ((section->num_overlays>=section->sz_overlays)&& (_XkbAllocOverlays(section,1)!=Success)) return NULL; overlay= §ion->overlays[section->num_overlays]; if ((sz_rows>0)&&(_XkbAllocOverlayRows(overlay,sz_rows)!=Success)) return NULL; overlay->name= name; overlay->section_under= section; section->num_overlays++; return overlay; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkbgeom.h0000644000000000000000000003637013614532331017175 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBGEOM_H_ #define _XKBGEOM_H_ #include "xkbstr.h" #define XkbAddGeomKeyAlias SrvXkbAddGeomKeyAlias #define XkbAddGeomColor SrvXkbAddGeomColor #define XkbAddGeomDoodad SrvXkbAddGeomDoodad #define XkbAddGeomKey SrvXkbAddGeomKey #define XkbAddGeomOutline SrvXkbAddGeomOutline #define XkbAddGeomOverlay SrvXkbAddGeomOverlay #define XkbAddGeomOverlayRow SrvXkbAddGeomOverlayRow #define XkbAddGeomOverlayKey SrvXkbAddGeomOverlayKey #define XkbAddGeomProperty SrvXkbAddGeomProperty #define XkbAddGeomRow SrvXkbAddGeomRow #define XkbAddGeomSection SrvXkbAddGeomSection #define XkbAddGeomShape SrvXkbAddGeomShape #define XkbAllocGeomKeyAliases SrvXkbAllocGeomKeyAliases #define XkbAllocGeomColors SrvXkbAllocGeomColors #define XkbAllocGeomDoodads SrvXkbAllocGeomDoodads #define XkbAllocGeomKeys SrvXkbAllocGeomKeys #define XkbAllocGeomOutlines SrvXkbAllocGeomOutlines #define XkbAllocGeomPoints SrvXkbAllocGeomPoints #define XkbAllocGeomProps SrvXkbAllocGeomProps #define XkbAllocGeomRows SrvXkbAllocGeomRows #define XkbAllocGeomSectionDoodads SrvXkbAllocGeomSectionDoodads #define XkbAllocGeomSections SrvXkbAllocGeomSections #define XkbAllocGeomOverlays SrvXkbAllocGeomOverlays #define XkbAllocGeomOverlayRows SrvXkbAllocGeomOverlayRows #define XkbAllocGeomOverlayKeys SrvXkbAllocGeomOverlayKeys #define XkbAllocGeomShapes SrvXkbAllocGeomShapes #define XkbAllocGeometry SrvXkbAllocGeometry #define XkbFreeGeomKeyAliases SrvXkbFreeGeomKeyAliases #define XkbFreeGeomColors SrvXkbFreeGeomColors #define XkbFreeGeomDoodads SrvXkbFreeGeomDoodads #define XkbFreeGeomProperties SrvXkbFreeGeomProperties #define XkbFreeGeomOverlayKeys SrvXkbFreeGeomOverlayKeys #define XkbFreeGeomOverlayRows SrvXkbFreeGeomOverlayRows #define XkbFreeGeomOverlays SrvXkbFreeGeomOverlays #define XkbFreeGeomKeys SrvXkbFreeGeomKeys #define XkbFreeGeomRows SrvXkbFreeGeomRows #define XkbFreeGeomSections SrvXkbFreeGeomSections #define XkbFreeGeomPoints SrvXkbFreeGeomPoints #define XkbFreeGeomOutlines SrvXkbFreeGeomOutlines #define XkbFreeGeomShapes SrvXkbFreeGeomShapes #define XkbFreeGeometry SrvXkbFreeGeometry typedef struct _XkbProperty { char *name; char *value; } XkbPropertyRec,*XkbPropertyPtr; typedef struct _XkbColor { unsigned int pixel; char * spec; } XkbColorRec,*XkbColorPtr; typedef struct _XkbPoint { short x; short y; } XkbPointRec, *XkbPointPtr; typedef struct _XkbBounds { short x1,y1; short x2,y2; } XkbBoundsRec, *XkbBoundsPtr; #define XkbBoundsWidth(b) (((b)->x2)-((b)->x1)) #define XkbBoundsHeight(b) (((b)->y2)-((b)->y1)) typedef struct _XkbOutline { unsigned short num_points; unsigned short sz_points; unsigned short corner_radius; XkbPointPtr points; } XkbOutlineRec, *XkbOutlinePtr; typedef struct _XkbShape { Atom name; unsigned short num_outlines; unsigned short sz_outlines; XkbOutlinePtr outlines; XkbOutlinePtr approx; XkbOutlinePtr primary; XkbBoundsRec bounds; } XkbShapeRec, *XkbShapePtr; #define XkbOutlineIndex(s,o) ((int)((o)-&(s)->outlines[0])) typedef struct _XkbShapeDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; unsigned short color_ndx; unsigned short shape_ndx; } XkbShapeDoodadRec, *XkbShapeDoodadPtr; #define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) #define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) #define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) #define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) typedef struct _XkbTextDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; short width; short height; unsigned short color_ndx; char * text; char * font; } XkbTextDoodadRec, *XkbTextDoodadPtr; #define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) #define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) typedef struct _XkbIndicatorDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; unsigned short shape_ndx; unsigned short on_color_ndx; unsigned short off_color_ndx; } XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr; #define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) #define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx]) #define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx]) #define XkbSetIndicatorDoodadOnColor(g,d,c) \ ((d)->on_color_ndx= (c)-&(g)->colors[0]) #define XkbSetIndicatorDoodadOffColor(g,d,c) \ ((d)->off_color_ndx= (c)-&(g)->colors[0]) #define XkbSetIndicatorDoodadShape(g,d,s) \ ((d)->shape_ndx= (s)-&(g)->shapes[0]) typedef struct _XkbLogoDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; unsigned short color_ndx; unsigned short shape_ndx; char * logo_name; } XkbLogoDoodadRec, *XkbLogoDoodadPtr; #define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) #define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) #define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) #define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) typedef struct _XkbAnyDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; } XkbAnyDoodadRec, *XkbAnyDoodadPtr; typedef union _XkbDoodad { XkbAnyDoodadRec any; XkbShapeDoodadRec shape; XkbTextDoodadRec text; XkbIndicatorDoodadRec indicator; XkbLogoDoodadRec logo; } XkbDoodadRec, *XkbDoodadPtr; #define XkbUnknownDoodad 0 #define XkbOutlineDoodad 1 #define XkbSolidDoodad 2 #define XkbTextDoodad 3 #define XkbIndicatorDoodad 4 #define XkbLogoDoodad 5 typedef struct _XkbKey { XkbKeyNameRec name; short gap; unsigned char shape_ndx; unsigned char color_ndx; } XkbKeyRec, *XkbKeyPtr; #define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx]) #define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx]) #define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0]) #define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0]) typedef struct _XkbRow { short top; short left; unsigned short num_keys; unsigned short sz_keys; int vertical; XkbKeyPtr keys; XkbBoundsRec bounds; } XkbRowRec, *XkbRowPtr; typedef struct _XkbSection { Atom name; unsigned char priority; short top; short left; unsigned short width; unsigned short height; short angle; unsigned short num_rows; unsigned short num_doodads; unsigned short num_overlays; unsigned short sz_rows; unsigned short sz_doodads; unsigned short sz_overlays; XkbRowPtr rows; XkbDoodadPtr doodads; XkbBoundsRec bounds; struct _XkbOverlay *overlays; } XkbSectionRec, *XkbSectionPtr; typedef struct _XkbOverlayKey { XkbKeyNameRec over; XkbKeyNameRec under; } XkbOverlayKeyRec,*XkbOverlayKeyPtr; typedef struct _XkbOverlayRow { unsigned short row_under; unsigned short num_keys; unsigned short sz_keys; XkbOverlayKeyPtr keys; } XkbOverlayRowRec,*XkbOverlayRowPtr; typedef struct _XkbOverlay { Atom name; XkbSectionPtr section_under; unsigned short num_rows; unsigned short sz_rows; XkbOverlayRowPtr rows; XkbBoundsPtr bounds; } XkbOverlayRec,*XkbOverlayPtr; typedef struct _XkbGeometry { Atom name; unsigned short width_mm; unsigned short height_mm; char * label_font; XkbColorPtr label_color; XkbColorPtr base_color; unsigned short sz_properties; unsigned short sz_colors; unsigned short sz_shapes; unsigned short sz_sections; unsigned short sz_doodads; unsigned short sz_key_aliases; unsigned short num_properties; unsigned short num_colors; unsigned short num_shapes; unsigned short num_sections; unsigned short num_doodads; unsigned short num_key_aliases; XkbPropertyPtr properties; XkbColorPtr colors; XkbShapePtr shapes; XkbSectionPtr sections; XkbDoodadPtr doodads; XkbKeyAliasPtr key_aliases; } XkbGeometryRec; #define XkbGeomColorIndex(g,c) ((int)((c)-&(g)->colors[0])) #define XkbGeomPropertiesMask (1<<0) #define XkbGeomColorsMask (1<<1) #define XkbGeomShapesMask (1<<2) #define XkbGeomSectionsMask (1<<3) #define XkbGeomDoodadsMask (1<<4) #define XkbGeomKeyAliasesMask (1<<5) #define XkbGeomAllMask (0x3f) typedef struct _XkbGeometrySizes { unsigned int which; unsigned short num_properties; unsigned short num_colors; unsigned short num_shapes; unsigned short num_sections; unsigned short num_doodads; unsigned short num_key_aliases; } XkbGeometrySizesRec,*XkbGeometrySizesPtr; _XFUNCPROTOBEGIN extern XkbPropertyPtr XkbAddGeomProperty( XkbGeometryPtr /* geom */, char * /* name */, char * /* value */ ); extern XkbKeyAliasPtr XkbAddGeomKeyAlias( XkbGeometryPtr /* geom */, char * /* alias */, char * /* real */ ); extern XkbColorPtr XkbAddGeomColor( XkbGeometryPtr /* geom */, char * /* spec */, unsigned int /* pixel */ ); extern XkbOutlinePtr XkbAddGeomOutline( XkbShapePtr /* shape */, int /* sz_points */ ); extern XkbShapePtr XkbAddGeomShape( XkbGeometryPtr /* geom */, Atom /* name */, int /* sz_outlines */ ); extern XkbKeyPtr XkbAddGeomKey( XkbRowPtr /* row */ ); extern XkbRowPtr XkbAddGeomRow( XkbSectionPtr /* section */, int /* sz_keys */ ); extern XkbSectionPtr XkbAddGeomSection( XkbGeometryPtr /* geom */, Atom /* name */, int /* sz_rows */, int /* sz_doodads */, int /* sz_overlays */ ); extern XkbOverlayPtr XkbAddGeomOverlay( XkbSectionPtr /* section */, Atom /* name */, int /* sz_rows */ ); extern XkbOverlayRowPtr XkbAddGeomOverlayRow( XkbOverlayPtr /* overlay */, int /* row_under */, int /* sz_keys */ ); extern XkbOverlayKeyPtr XkbAddGeomOverlayKey( XkbOverlayPtr /* overlay */, XkbOverlayRowPtr /* row */, char * /* over */, char * /* under */ ); extern XkbDoodadPtr XkbAddGeomDoodad( XkbGeometryPtr /* geom */, XkbSectionPtr /* section */, Atom /* name */ ); extern void XkbFreeGeomKeyAliases( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomColors( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomDoodads( XkbDoodadPtr /* doodads */, int /* nDoodads */, Bool /* freeAll */ ); extern void XkbFreeGeomProperties( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomOverlayKeys( XkbOverlayRowPtr /* row */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomOverlayRows( XkbOverlayPtr /* overlay */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomOverlays( XkbSectionPtr /* section */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomKeys( XkbRowPtr /* row */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomRows( XkbSectionPtr /* section */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomSections( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomPoints( XkbOutlinePtr /* outline */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomOutlines( XkbShapePtr /* shape */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeomShapes( XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ ); extern void XkbFreeGeometry( XkbGeometryPtr /* geom */, unsigned int /* which */, Bool /* freeMap */ ); extern Status XkbAllocGeomProps( XkbGeometryPtr /* geom */, int /* nProps */ ); extern Status XkbAllocGeomKeyAliases( XkbGeometryPtr /* geom */, int /* nAliases */ ); extern Status XkbAllocGeomColors( XkbGeometryPtr /* geom */, int /* nColors */ ); extern Status XkbAllocGeomShapes( XkbGeometryPtr /* geom */, int /* nShapes */ ); extern Status XkbAllocGeomSections( XkbGeometryPtr /* geom */, int /* nSections */ ); extern Status XkbAllocGeomOverlays( XkbSectionPtr /* section */, int /* num_needed */ ); extern Status XkbAllocGeomOverlayRows( XkbOverlayPtr /* overlay */, int /* num_needed */ ); extern Status XkbAllocGeomOverlayKeys( XkbOverlayRowPtr /* row */, int /* num_needed */ ); extern Status XkbAllocGeomDoodads( XkbGeometryPtr /* geom */, int /* nDoodads */ ); extern Status XkbAllocGeomSectionDoodads( XkbSectionPtr /* section */, int /* nDoodads */ ); extern Status XkbAllocGeomOutlines( XkbShapePtr /* shape */, int /* nOL */ ); extern Status XkbAllocGeomRows( XkbSectionPtr /* section */, int /* nRows */ ); extern Status XkbAllocGeomPoints( XkbOutlinePtr /* ol */, int /* nPts */ ); extern Status XkbAllocGeomKeys( XkbRowPtr /* row */, int /* nKeys */ ); extern Status XkbAllocGeometry( XkbDescPtr /* xkb */, XkbGeometrySizesPtr /* sizes */ ); extern Status XkbSetGeometry( Display * /* dpy */, unsigned /* deviceSpec */, XkbGeometryPtr /* geom */ ); extern Bool XkbComputeShapeTop( XkbShapePtr /* shape */, XkbBoundsPtr /* bounds */ ); extern Bool XkbComputeShapeBounds( XkbShapePtr /* shape */ ); extern Bool XkbComputeRowBounds( XkbGeometryPtr /* geom */, XkbSectionPtr /* section */, XkbRowPtr /* row */ ); extern Bool XkbComputeSectionBounds( XkbGeometryPtr /* geom */, XkbSectionPtr /* section */ ); extern char * XkbFindOverlayForKey( XkbGeometryPtr /* geom */, XkbSectionPtr /* wanted */, char * /* under */ ); extern Status XkbGetGeometry( Display * /* dpy */, XkbDescPtr /* xkb */ ); extern Status XkbGetNamedGeometry( Display * /* dpy */, XkbDescPtr /* xkb */, Atom /* name */ ); _XFUNCPROTOEND #endif /* _XKBSTR_H_ */ nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkb.h0000644000000000000000000000260213614532331016314 0ustar extern int ProcXkbUseExtension(ClientPtr client); extern int ProcXkbSelectEvents(ClientPtr client); extern int ProcXkbBell(ClientPtr client); extern int ProcXkbGetState(ClientPtr client); extern int ProcXkbLatchLockState(ClientPtr client); extern int ProcXkbGetControls(ClientPtr client); extern int ProcXkbSetControls(ClientPtr client); extern int ProcXkbGetMap(ClientPtr client); extern int ProcXkbSetMap(ClientPtr client); extern int ProcXkbGetCompatMap(ClientPtr client); extern int ProcXkbSetCompatMap(ClientPtr client); extern int ProcXkbGetIndicatorState(ClientPtr client); extern int ProcXkbGetIndicatorMap(ClientPtr client); extern int ProcXkbSetIndicatorMap(ClientPtr client); extern int ProcXkbGetNamedIndicator(ClientPtr client); extern int ProcXkbSetNamedIndicator(ClientPtr client); extern int ProcXkbGetNames(ClientPtr client); extern int ProcXkbSetNames(ClientPtr client); extern int ProcXkbGetGeometry(ClientPtr client); extern int ProcXkbSetGeometry(ClientPtr client); extern int ProcXkbPerClientFlags(ClientPtr client); extern int ProcXkbListComponents(ClientPtr client); extern int ProcXkbGetKbdByName(ClientPtr client); extern int ProcXkbGetDeviceInfo(ClientPtr client); extern int ProcXkbSetDeviceInfo(ClientPtr client); extern int ProcXkbSetDebuggingFlags(ClientPtr client); extern void XkbExtensionInit(void); extern Bool XkbFilterEvents(ClientPtr pClient, int nEvents, xEvent *xE); nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkbInit.c0000644000000000000000000006470313614532331017145 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #ifdef HAVE_XKB_CONFIG_H #include #endif #include #include #include #include #include #include #include #include #include #include "misc.h" #include "inputstr.h" #include "opaque.h" #include "property.h" #include "scrnintstr.h" #include #include "xkbgeom.h" #include #include "xkbfile.h" #include "xkb.h" #define CREATE_ATOM(s) MakeAtom(s,sizeof(s)-1,1) #ifdef sun #define LED_NUM 1 #define LED_SCROLL 2 #define LED_COMPOSE 3 #define LED_CAPS 4 #define PHYS_LEDS 0x0f #else #define LED_CAPS 1 #define LED_NUM 2 #define LED_SCROLL 3 #define PHYS_LEDS 0x07 #endif #define MAX_TOC 16 typedef struct _SrvXkmInfo { DeviceIntPtr dev; FILE * file; XkbFileInfo xkbinfo; } SrvXkmInfo; /***====================================================================***/ #ifndef XKB_BASE_DIRECTORY #define XKB_BASE_DIRECTORY "/usr/lib/X11/xkb" #endif #ifndef XKB_BIN_DIRECTORY #define XKB_BIN_DIRECTORY XKB_BASE_DIRECTORY #endif #ifndef XKB_DFLT_RULES_FILE #define XKB_DFLT_RULES_FILE "base" #endif #ifndef XKB_DFLT_KB_LAYOUT #define XKB_DFLT_KB_LAYOUT "us" #endif #ifndef XKB_DFLT_KB_MODEL #define XKB_DFLT_KB_MODEL "dflt" #endif #ifndef XKB_DFLT_KB_VARIANT #define XKB_DFLT_KB_VARIANT NULL #endif #ifndef XKB_DFLT_KB_OPTIONS #define XKB_DFLT_KB_OPTIONS NULL #endif #ifndef XKB_DFLT_DISABLED #define XKB_DFLT_DISABLED True #endif #ifndef XKB_DFLT_RULES_PROP #define XKB_DFLT_RULES_PROP True #endif char * XkbBaseDirectory= XKB_BASE_DIRECTORY; char * XkbBinDirectory= XKB_BIN_DIRECTORY; static int XkbWantAccessX= 0; static XkbFileInfo * _XkbInitFileInfo= NULL; static Bool rulesDefined= False; static char * XkbRulesFile= NULL; static char * XkbModelDflt= NULL; static char * XkbLayoutDflt= NULL; static char * XkbVariantDflt= NULL; static char * XkbOptionsDflt= NULL; static char * XkbModelUsed= NULL; static char * XkbLayoutUsed= NULL; static char * XkbVariantUsed= NULL; static char * XkbOptionsUsed= NULL; Bool noXkbExtension= XKB_DFLT_DISABLED; static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP; /***====================================================================***/ static char * XkbGetRulesDflts(XkbRF_VarDefsPtr defs) { if (XkbModelDflt) defs->model= XkbModelDflt; else defs->model= XKB_DFLT_KB_MODEL; if (XkbLayoutDflt) defs->layout= XkbLayoutDflt; else defs->layout= XKB_DFLT_KB_LAYOUT; if (XkbVariantDflt) defs->variant= XkbVariantDflt; else defs->variant= XKB_DFLT_KB_VARIANT; if (XkbOptionsDflt) defs->options= XkbOptionsDflt; else defs->options= XKB_DFLT_KB_OPTIONS; return (rulesDefined?XkbRulesFile:XKB_DFLT_RULES_FILE); } static Bool XkbWriteRulesProp(ClientPtr client, void * closure) { int len,out; Atom name; char * pval; if (rulesDefined && (!XkbRulesFile)) return False; len= (XkbRulesFile?strlen(XkbRulesFile):strlen(XKB_DFLT_RULES_FILE)); len+= (XkbModelUsed?strlen(XkbModelUsed):0); len+= (XkbLayoutUsed?strlen(XkbLayoutUsed):0); len+= (XkbVariantUsed?strlen(XkbVariantUsed):0); len+= (XkbOptionsUsed?strlen(XkbOptionsUsed):0); if (len<1) return True; len+= 5; /* trailing NULs */ name= MakeAtom(_XKB_RF_NAMES_PROP_ATOM,strlen(_XKB_RF_NAMES_PROP_ATOM),1); if (name==None) { ErrorF("Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM); return True; } pval= (char*) malloc(len); if (!pval) { ErrorF("Allocation error: %s proprerty not created\n", _XKB_RF_NAMES_PROP_ATOM); return True; } out= 0; if (XkbRulesFile) { strcpy(&pval[out],XkbRulesFile); out+= strlen(XkbRulesFile); } else { strcpy(&pval[out],XKB_DFLT_RULES_FILE); out+= strlen(XKB_DFLT_RULES_FILE); } pval[out++]= '\0'; if (XkbModelUsed) { strcpy(&pval[out],XkbModelUsed); out+= strlen(XkbModelUsed); } pval[out++]= '\0'; if (XkbLayoutUsed) { strcpy(&pval[out],XkbLayoutUsed); out+= strlen(XkbLayoutUsed); } pval[out++]= '\0'; if (XkbVariantUsed) { strcpy(&pval[out],XkbVariantUsed); out+= strlen(XkbVariantUsed); } pval[out++]= '\0'; if (XkbOptionsUsed) { strcpy(&pval[out],XkbOptionsUsed); out+= strlen(XkbOptionsUsed); } pval[out++]= '\0'; if (out!=len) { ErrorF("Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n", out,len); } ChangeWindowProperty(screenInfo.screens[0]->root,name,XA_STRING,8,PropModeReplace, len,pval,True); free(pval); return True; } static void XkbSetRulesUsed(XkbRF_VarDefsPtr defs) { if (XkbModelUsed) _XkbFree(XkbModelUsed); XkbModelUsed= (defs->model?Xstrdup(defs->model):NULL); if (XkbLayoutUsed) _XkbFree(XkbLayoutUsed); XkbLayoutUsed= (defs->layout?Xstrdup(defs->layout):NULL); if (XkbVariantUsed) _XkbFree(XkbVariantUsed); XkbVariantUsed= (defs->variant?Xstrdup(defs->variant):NULL); if (XkbOptionsUsed) _XkbFree(XkbOptionsUsed); XkbOptionsUsed= (defs->options?Xstrdup(defs->options):NULL); if (XkbWantRulesProp) QueueWorkProc(XkbWriteRulesProp,NULL,NULL); return; } /** * Set the default RMLVO for the next device to be initialised. * If a parameter is NULL, the previous setting will be used. Use empty * strings if you want to delete a previous setting. * * If @rulesFile is NULL and no previous @rulesFile has been set, the * built-in default is chosen as default. */ void XkbSetRulesDflts(char *rulesFile,char *model,char *layout, char *variant,char *options) { if (!rulesFile && !XkbRulesFile) { LogMessage(X_WARNING, "[xkb] No rule given, and no previous rule " "defined. Defaulting to '%s'.\n", XKB_DFLT_RULES_FILE); rulesFile = XKB_DFLT_RULES_FILE; } if (rulesFile) { if (XkbRulesFile) _XkbFree(XkbRulesFile); XkbRulesFile= Xstrdup(rulesFile); rulesDefined= True; } if (model) { if (XkbModelDflt) _XkbFree(XkbModelDflt); XkbModelDflt= Xstrdup(model); } if (layout) { if (XkbLayoutDflt) _XkbFree(XkbLayoutDflt); XkbLayoutDflt= Xstrdup(layout); } if (variant) { if (XkbVariantDflt) _XkbFree(XkbVariantDflt); XkbVariantDflt= Xstrdup(variant); } if (options) { if (XkbOptionsDflt) _XkbFree(XkbOptionsDflt); XkbOptionsDflt= Xstrdup(options); } return; } /***====================================================================***/ #include "xkbDflts.h" static Bool XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file) { if (file->xkbinfo.defined&XkmTypesMask) return True; initTypeNames(NULL); if (XkbAllocClientMap(xkb,XkbKeyTypesMask,num_dflt_types)!=Success) return False; if (XkbCopyKeyTypes(dflt_types,xkb->map->types,num_dflt_types)!= Success) { return False; } xkb->map->size_types= xkb->map->num_types= num_dflt_types; return True; } static void XkbInitRadioGroups(XkbSrvInfoPtr xkbi,SrvXkmInfo *file) { xkbi->nRadioGroups = 0; xkbi->radioGroups = NULL; return; } static Status XkbInitCompatStructs(XkbDescPtr xkb,SrvXkmInfo *file) { register int i; XkbCompatMapPtr compat; if (file->xkbinfo.defined&XkmCompatMapMask) return Success; if (XkbAllocCompatMap(xkb,XkbAllCompatMask,num_dfltSI)!=Success) return BadAlloc; compat = xkb->compat; if (compat->sym_interpret) { compat->num_si = num_dfltSI; memcpy((char *)compat->sym_interpret,(char *)dfltSI,sizeof(dfltSI)); } for (i=0;igroups[i]= compatMap.groups[i]; if (compat->groups[i].vmods!=0) { unsigned mask; mask= XkbMaskForVMask(xkb,compat->groups[i].vmods); compat->groups[i].mask= compat->groups[i].real_mods|mask; } else compat->groups[i].mask= compat->groups[i].real_mods; } return Success; } static void XkbInitSemantics(XkbDescPtr xkb,SrvXkmInfo *file) { XkbInitKeyTypes(xkb,file); XkbInitCompatStructs(xkb,file); return; } /***====================================================================***/ static Status XkbInitNames(XkbSrvInfoPtr xkbi,SrvXkmInfo *file) { XkbDescPtr xkb; XkbNamesPtr names; Status rtrn; Atom unknown; xkb= xkbi->desc; if ((rtrn=XkbAllocNames(xkb,XkbAllNamesMask,0,0))!=Success) return rtrn; unknown= CREATE_ATOM("unknown"); names = xkb->names; if (names->keycodes==None) names->keycodes= unknown; if (names->geometry==None) names->geometry= unknown; if (names->phys_symbols==None) names->phys_symbols= unknown; if (names->symbols==None) names->symbols= unknown; if (names->types==None) names->types= unknown; if (names->compat==None) names->compat= unknown; if ((file->xkbinfo.defined&XkmVirtualModsMask)==0) { if (names->vmods[vmod_NumLock]==None) names->vmods[vmod_NumLock]= CREATE_ATOM("NumLock"); if (names->vmods[vmod_Alt]==None) names->vmods[vmod_Alt]= CREATE_ATOM("Alt"); if (names->vmods[vmod_AltGr]==None) names->vmods[vmod_AltGr]= CREATE_ATOM("ModeSwitch"); } if (((file->xkbinfo.defined&XkmIndicatorsMask)==0)|| ((file->xkbinfo.defined&XkmGeometryMask)==0)) { initIndicatorNames(NULL,xkb); if (names->indicators[LED_CAPS-1]==None) names->indicators[LED_CAPS-1] = CREATE_ATOM("Caps Lock"); if (names->indicators[LED_NUM-1]==None) names->indicators[LED_NUM-1] = CREATE_ATOM("Num Lock"); if (names->indicators[LED_SCROLL-1]==None) names->indicators[LED_SCROLL-1] = CREATE_ATOM("Scroll Lock"); #ifdef LED_COMPOSE if (names->indicators[LED_COMPOSE-1]==None) names->indicators[LED_COMPOSE-1] = CREATE_ATOM("Compose"); #endif } if (xkb->geom!=NULL) names->geometry= xkb->geom->name; else names->geometry= unknown; return Success; } static Status XkbInitIndicatorMap(XkbSrvInfoPtr xkbi,SrvXkmInfo *file) { XkbDescPtr xkb; XkbIndicatorPtr map; XkbSrvLedInfoPtr sli; xkb= xkbi->desc; if (XkbAllocIndicatorMaps(xkb)!=Success) return BadAlloc; if ((file->xkbinfo.defined&XkmIndicatorsMask)==0) { map= xkb->indicators; map->phys_indicators = PHYS_LEDS; map->maps[LED_CAPS-1].flags= XkbIM_NoExplicit; map->maps[LED_CAPS-1].which_mods= XkbIM_UseLocked; map->maps[LED_CAPS-1].mods.mask= LockMask; map->maps[LED_CAPS-1].mods.real_mods= LockMask; map->maps[LED_NUM-1].flags= XkbIM_NoExplicit; map->maps[LED_NUM-1].which_mods= XkbIM_UseLocked; map->maps[LED_NUM-1].mods.mask= 0; map->maps[LED_NUM-1].mods.real_mods= 0; map->maps[LED_NUM-1].mods.vmods= vmod_NumLockMask; /* Metro Link */ map->maps[LED_SCROLL-1].flags= XkbIM_NoExplicit; map->maps[LED_SCROLL-1].which_mods= XkbIM_UseLocked; map->maps[LED_SCROLL-1].mods.mask= Mod3Mask; map->maps[LED_SCROLL-1].mods.real_mods= Mod3Mask; /* Metro Link */ } sli= XkbFindSrvLedInfo(xkbi->device,XkbDfltXIClass,XkbDfltXIId,0); if (sli) XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask); return Success; } static Status XkbInitControls(DeviceIntPtr pXDev,XkbSrvInfoPtr xkbi,SrvXkmInfo *file) { XkbDescPtr xkb; XkbControlsPtr ctrls; xkb= xkbi->desc; /* 12/31/94 (ef) -- XXX! Should check if controls loaded from file */ if (XkbAllocControls(xkb,XkbAllControlsMask)!=Success) FatalError("Couldn't allocate keyboard controls\n"); ctrls= xkb->ctrls; if ((file->xkbinfo.defined&XkmSymbolsMask)==0) ctrls->num_groups = 1; ctrls->groups_wrap = XkbSetGroupInfo(1,XkbWrapIntoRange,0); ctrls->internal.mask = 0; ctrls->internal.real_mods = 0; ctrls->internal.vmods = 0; ctrls->ignore_lock.mask = 0; ctrls->ignore_lock.real_mods = 0; ctrls->ignore_lock.vmods = 0; ctrls->enabled_ctrls = XkbAccessXTimeoutMask|XkbRepeatKeysMask| XkbMouseKeysAccelMask|XkbAudibleBellMask| XkbIgnoreGroupLockMask; if (XkbWantAccessX) ctrls->enabled_ctrls|= XkbAccessXKeysMask; AccessXInit(pXDev); return Success; } void XkbInitDevice(DeviceIntPtr pXDev) { int i; XkbSrvInfoPtr xkbi; XkbChangesRec changes; SrvXkmInfo file; unsigned check; XkbEventCauseRec cause; file.dev= pXDev; file.file=NULL; bzero(&file.xkbinfo,sizeof(XkbFileInfo)); bzero(&changes,sizeof(XkbChangesRec)); pXDev->key->xkbInfo= xkbi= _XkbTypedCalloc(1,XkbSrvInfoRec); if ( xkbi ) { XkbDescPtr xkb; if ((_XkbInitFileInfo!=NULL)&&(_XkbInitFileInfo->xkb!=NULL)) { file.xkbinfo= *_XkbInitFileInfo; xkbi->desc= _XkbInitFileInfo->xkb; _XkbInitFileInfo= NULL; } else { xkbi->desc= XkbAllocKeyboard(); if (!xkbi->desc) FatalError("Couldn't allocate keyboard description\n"); xkbi->desc->min_key_code = pXDev->key->curKeySyms.minKeyCode; xkbi->desc->max_key_code = pXDev->key->curKeySyms.maxKeyCode; } xkb= xkbi->desc; if (xkb->min_key_code == 0) xkb->min_key_code = pXDev->key->curKeySyms.minKeyCode; if (xkb->max_key_code == 0) xkb->max_key_code = pXDev->key->curKeySyms.maxKeyCode; if ((pXDev->key->curKeySyms.minKeyCode!=xkbi->desc->min_key_code)|| (pXDev->key->curKeySyms.maxKeyCode!=xkbi->desc->max_key_code)) { /* 12/9/95 (ef) -- XXX! Maybe we should try to fix up one or */ /* the other here, but for now just complain */ /* can't just update the core range without */ /* reallocating the KeySymsRec (pain) */ ErrorF("Internal Error!! XKB and core keymap have different range\n"); } if (XkbAllocClientMap(xkb,XkbAllClientInfoMask,0)!=Success) FatalError("Couldn't allocate client map in XkbInitDevice\n"); i= XkbNumKeys(xkb)/3+1; if (XkbAllocServerMap(xkb,XkbAllServerInfoMask,i)!=Success) FatalError("Couldn't allocate server map in XkbInitDevice\n"); xkbi->dfltPtrDelta=1; xkbi->device = pXDev; file.xkbinfo.xkb= xkb; XkbInitSemantics(xkb,&file); XkbInitNames(xkbi,&file); XkbInitRadioGroups(xkbi,&file); /* 12/31/94 (ef) -- XXX! Should check if state loaded from file */ bzero(&xkbi->state,sizeof(XkbStateRec)); XkbInitControls(pXDev,xkbi,&file); if (file.xkbinfo.defined&XkmSymbolsMask) memcpy(pXDev->key->modifierMap,xkb->map->modmap,xkb->max_key_code+1); else memcpy(xkb->map->modmap,pXDev->key->modifierMap,xkb->max_key_code+1); XkbInitIndicatorMap(xkbi,&file); if (!(file.xkbinfo.defined&XkmSymbolsMask)) { XkbUpdateKeyTypesFromCore(pXDev,xkb->min_key_code,XkbNumKeys(xkb), &changes); } else { XkbUpdateCoreDescription(pXDev,True); } XkbSetCauseUnknown(&cause); XkbUpdateActions(pXDev,xkb->min_key_code, XkbNumKeys(xkb),&changes, &check,&cause); /* For sanity. The first time the connection * is opened, the client side min and max are set * using QueryMinMaxKeyCodes() which grabs them * from pXDev. */ pXDev->key->curKeySyms.minKeyCode = xkb->min_key_code; pXDev->key->curKeySyms.maxKeyCode = xkb->max_key_code; } if (file.file!=NULL) fclose(file.file); return; } #if MAP_LENGTH > XkbMaxKeyCount #undef XkbMaxKeyCount #define XkbMaxKeyCount MAP_LENGTH #endif Bool XkbInitKeyboardDeviceStruct( DeviceIntPtr dev, XkbComponentNamesPtr names, KeySymsPtr pSymsIn, CARD8 pModsIn[], void (*bellProc)( int /*percent*/, DeviceIntPtr /*device*/, void * /*ctrl*/, int), void (*ctrlProc)( DeviceIntPtr /*device*/, KeybdCtrl * /*ctrl*/)) { XkbFileInfo finfo; KeySymsRec tmpSyms,*pSyms; CARD8 tmpMods[XkbMaxLegalKeyCode+1],*pMods; char name[PATH_MAX],*rules; Bool ok=False; XkbRF_VarDefsRec defs; if ((dev->key!=NULL)||(dev->kbdfeed!=NULL)) return False; pSyms= pSymsIn; pMods= pModsIn; bzero(&defs,sizeof(XkbRF_VarDefsRec)); rules= XkbGetRulesDflts(&defs); /* * The strings are duplicated because it is not guaranteed that * they are allocated, or that they are allocated for every server * generation. Eventually they will be freed at the end of this * function. */ if (names->keymap) names->keymap = Xstrdup(names->keymap); if (names->keycodes) names->keycodes = Xstrdup(names->keycodes); if (names->types) names->types = Xstrdup(names->types); if (names->compat) names->compat = Xstrdup(names->compat); if (names->geometry) names->geometry = Xstrdup(names->geometry); if (names->symbols) names->symbols = Xstrdup(names->symbols); if (defs.model && defs.layout && rules) { XkbComponentNamesRec rNames; bzero(&rNames,sizeof(XkbComponentNamesRec)); if (XkbDDXNamesFromRules(dev,rules,&defs,&rNames)) { if (rNames.keymap) { if (!names->keymap) names->keymap = rNames.keymap; else _XkbFree(rNames.keymap); } if (rNames.keycodes) { if (!names->keycodes) names->keycodes = rNames.keycodes; else _XkbFree(rNames.keycodes); } if (rNames.types) { if (!names->types) names->types = rNames.types; else _XkbFree(rNames.types); } if (rNames.compat) { if (!names->compat) names->compat = rNames.compat; else _XkbFree(rNames.compat); } if (rNames.symbols) { if (!names->symbols) names->symbols = rNames.symbols; else _XkbFree(rNames.symbols); } if (rNames.geometry) { if (!names->geometry) names->geometry = rNames.geometry; else _XkbFree(rNames.geometry); } XkbSetRulesUsed(&defs); } } if (names->keymap) { XkbComponentNamesRec tmpNames; bzero(&tmpNames,sizeof(XkbComponentNamesRec)); tmpNames.keymap = names->keymap; ok = (Bool) XkbDDXLoadKeymapByNames(dev,&tmpNames,XkmAllIndicesMask,0, &finfo,name,PATH_MAX); } if (!(ok && (finfo.xkb!=NULL))) ok = (Bool) XkbDDXLoadKeymapByNames(dev,names,XkmAllIndicesMask,0, &finfo,name,PATH_MAX); if (ok && (finfo.xkb!=NULL)) { XkbDescPtr xkb; KeyCode minKC,maxKC; xkb= finfo.xkb; minKC= xkb->min_key_code; maxKC= xkb->max_key_code; if (XkbIsLegalKeycode(minKC)&&XkbIsLegalKeycode(maxKC)&&(minKC<=maxKC)&& ((minKC!=pSyms->minKeyCode)||(maxKC!=pSyms->maxKeyCode))) { if (xkb->map!=NULL) { KeySym *inSym,*outSym; int width= pSymsIn->mapWidth; tmpSyms.minKeyCode= minKC; tmpSyms.maxKeyCode= maxKC; if (minKCminKeyCode) minKC= pSymsIn->minKeyCode; if (maxKC>pSymsIn->maxKeyCode) maxKC= pSymsIn->maxKeyCode; tmpSyms.mapWidth= width; tmpSyms.map= _XkbTypedCalloc(width*XkbNumKeys(xkb),KeySym); inSym= &pSymsIn->map[(minKC-pSymsIn->minKeyCode)*width]; outSym= &tmpSyms.map[(minKC-tmpSyms.minKeyCode)*width]; memcpy(outSym,inSym,((maxKC-minKC+1)*width)*sizeof(KeySym)); pSyms= &tmpSyms; } if ((xkb->map!=NULL)&&(xkb->map->modmap!=NULL)) { bzero(tmpMods,XkbMaxKeyCount); memcpy(tmpMods,xkb->map->modmap,maxKC+1); pMods= tmpMods; } } _XkbInitFileInfo= &finfo; } else { LogMessage(X_WARNING, "Couldn't load XKB keymap, falling back to pre-XKB keymap\n"); } ok= InitKeyboardDeviceStruct((DevicePtr)dev,pSyms,pMods,bellProc,ctrlProc); _XkbInitFileInfo= NULL; if ((pSyms==&tmpSyms)&&(pSyms->map!=NULL)) { _XkbFree(pSyms->map); pSyms->map= NULL; } if (names->keymap) _XkbFree(names->keymap); names->keymap = NULL; if (names->keycodes) _XkbFree(names->keycodes); names->keycodes = NULL; if (names->types) _XkbFree(names->types); names->types = NULL; if (names->compat) _XkbFree(names->compat); names->compat = NULL; if (names->geometry) _XkbFree(names->geometry); names->geometry = NULL; if (names->symbols) _XkbFree(names->symbols); names->symbols = NULL; return ok; } /***====================================================================***/ /* * InitKeyClassDeviceStruct initializes the key class before it * initializes the keyboard feedback class for a device. * UpdateActions can't set up the correct autorepeat for keyboard * initialization because the keyboard feedback isn't created yet. * Instead, UpdateActions notes the "correct" autorepeat in the * SrvInfo structure and InitKbdFeedbackClass calls UpdateAutoRepeat * to apply the computed autorepeat once the feedback class exists. * * DIX will apply the changed autorepeat, so there's no need to * do so here. This function returns True if both RepeatKeys and * the core protocol autorepeat ctrls are set (i.e. should use * software autorepeat), false otherwise. * * This function also computes the autorepeat accelerators for the * default indicator feedback. */ int XkbFinishDeviceInit(DeviceIntPtr pXDev) { XkbSrvInfoPtr xkbi; XkbDescPtr xkb; int softRepeat; XkbSrvLedInfoPtr sli; xkbi = NULL; if (pXDev && pXDev->key && pXDev->key->xkbInfo && pXDev->kbdfeed) { xkbi= pXDev->key->xkbInfo; xkb= xkbi->desc; if (pXDev->kbdfeed) { xkbi->kbdProc= pXDev->kbdfeed->CtrlProc; pXDev->kbdfeed->CtrlProc= XkbDDXKeybdCtrlProc; } if (pXDev->kbdfeed->ctrl.autoRepeat) xkb->ctrls->enabled_ctrls|= XkbRepeatKeysMask; softRepeat= (xkb->ctrls->enabled_ctrls&XkbRepeatKeysMask)!=0; if (pXDev->kbdfeed) { memcpy(pXDev->kbdfeed->ctrl.autoRepeats, xkb->ctrls->per_key_repeat,XkbPerKeyBitArraySize); softRepeat= softRepeat&&pXDev->kbdfeed->ctrl.autoRepeat; } } else softRepeat= 0; sli= XkbFindSrvLedInfo(pXDev,XkbDfltXIClass,XkbDfltXIId,0); if (sli && xkbi) XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask); else DebugF("No indicator feedback in XkbFinishInit (shouldn't happen)!\n"); return softRepeat; } /* * Be very careful about what does and doesn't get freed by this * function. To reduce fragmentation, XkbInitDevice allocates a * single huge block per device and divides it up into most of the * fixed-size structures for the device. Don't free anything that * is part of this larger block. */ void XkbFreeInfo(XkbSrvInfoPtr xkbi) { if (xkbi->radioGroups) { _XkbFree(xkbi->radioGroups); xkbi->radioGroups= NULL; } if (xkbi->mouseKeyTimer) { TimerFree(xkbi->mouseKeyTimer); xkbi->mouseKeyTimer= NULL; } if (xkbi->slowKeysTimer) { TimerFree(xkbi->slowKeysTimer); xkbi->slowKeysTimer= NULL; } if (xkbi->bounceKeysTimer) { TimerFree(xkbi->bounceKeysTimer); xkbi->bounceKeysTimer= NULL; } if (xkbi->repeatKeyTimer) { TimerFree(xkbi->repeatKeyTimer); xkbi->repeatKeyTimer= NULL; } if (xkbi->krgTimer) { TimerFree(xkbi->krgTimer); xkbi->krgTimer= NULL; } xkbi->beepType= _BEEP_NONE; if (xkbi->beepTimer) { TimerFree(xkbi->beepTimer); xkbi->beepTimer= NULL; } if (xkbi->desc) { XkbFreeKeyboard(xkbi->desc,XkbAllComponentsMask,True); xkbi->desc= NULL; } _XkbFree(xkbi); return; } /***====================================================================***/ extern int XkbDfltRepeatDelay; extern int XkbDfltRepeatInterval; extern unsigned short XkbDfltAccessXTimeout; extern unsigned int XkbDfltAccessXTimeoutMask; extern unsigned int XkbDfltAccessXFeedback; extern unsigned char XkbDfltAccessXOptions; int XkbProcessArguments(int argc,char *argv[],int i) { if (strcmp(argv[i],"-kb")==0) { noXkbExtension= True; return 1; } else if (strcmp(argv[i],"+kb")==0) { noXkbExtension= False; return 1; } else if (strncmp(argv[i], "-xkbdir", 7) == 0) { if(++i < argc) { #if !defined(WIN32) && !defined(__CYGWIN__) if (getuid() != geteuid()) { LogMessage(X_WARNING, "-xkbdir is not available for setuid X servers\n"); return -1; } else #endif { if (strlen(argv[i]) < PATH_MAX) { XkbBaseDirectory= argv[i]; return 2; } else { LogMessage(X_ERROR, "-xkbdir pathname too long\n"); return -1; } } } else { return -1; } } else if ((strncmp(argv[i],"-accessx",8)==0)|| (strncmp(argv[i],"+accessx",8)==0)) { int j=1; if (argv[i][0]=='-') XkbWantAccessX= 0; else { XkbWantAccessX= 1; if ( ((i+1)= argc) UseMsg (); XkbDfltRepeatDelay = (long)atoi(argv[i]); return 2; } if ((strcmp(argv[i], "-arinterval") == 0) || (strcmp (argv[i], "-ar2") == 0)) { /* -arinterval int */ if (++i >= argc) UseMsg (); XkbDfltRepeatInterval = (long)atoi(argv[i]); return 2; } return 0; } void XkbUseMsg(void) { ErrorF("-kb disable the X Keyboard Extension\n"); ErrorF("+kb enable the X Keyboard Extension\n"); ErrorF("[+-]accessx [ timeout [ timeout_mask [ feedback [ options_mask] ] ] ]\n"); ErrorF(" enable/disable accessx key sequences\n"); ErrorF("-ardelay set XKB autorepeat delay\n"); ErrorF("-arinterval set XKB autorepeat interval\n"); } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkbLEDs.c0000644000000000000000000006703513614532331017032 0ustar /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include "misc.h" #include "inputstr.h" #include #include #include "xkb.h" /***====================================================================***/ /* * unsigned * XkbIndicatorsToUpdate(dev,changed,check_devs_rtrn) * * Given a keyboard and a set of state components that have changed, * this function returns the indicators on the default keyboard * feedback that might be affected. It also reports whether or not * any extension devices might be affected in check_devs_rtrn. */ unsigned XkbIndicatorsToUpdate( DeviceIntPtr dev, unsigned long state_changes, Bool enable_changes) { register unsigned update= 0; XkbSrvLedInfoPtr sli; sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0); if (state_changes&(XkbModifierStateMask|XkbGroupStateMask)) update|= sli->usesEffective; if (state_changes&(XkbModifierBaseMask|XkbGroupBaseMask)) update|= sli->usesBase; if (state_changes&(XkbModifierLatchMask|XkbGroupLatchMask)) update|= sli->usesLatched; if (state_changes&(XkbModifierLockMask|XkbGroupLockMask)) update|= sli->usesLocked; if (state_changes&XkbCompatStateMask) update|= sli->usesCompat; if (enable_changes) update|= sli->usesControls; return update; } /***====================================================================***/ /* * Bool * XkbApplyLEDChangeToKeyboard(xkbi,map,on,change) * * Some indicators "drive" the keyboard when their state is explicitly * changed, as described in section 9.2.1 of the XKB protocol spec. * This function updates the state and controls for the keyboard * specified by 'xkbi' to reflect any changes that are required * when the indicator described by 'map' is turned on or off. The * extent of the changes is reported in change, which must be defined. */ static Bool XkbApplyLEDChangeToKeyboard( XkbSrvInfoPtr xkbi, XkbIndicatorMapPtr map, Bool on, XkbChangesPtr change) { Bool ctrlChange,stateChange; XkbStatePtr state; if ((map->flags&XkbIM_NoExplicit)||((map->flags&XkbIM_LEDDrivesKB)==0)) return False; ctrlChange= stateChange= False; if (map->ctrls) { XkbControlsPtr ctrls= xkbi->desc->ctrls; unsigned old; old= ctrls->enabled_ctrls; if (on) ctrls->enabled_ctrls|= map->ctrls; else ctrls->enabled_ctrls&= ~map->ctrls; if (old!=ctrls->enabled_ctrls) { change->ctrls.changed_ctrls= XkbControlsEnabledMask; change->ctrls.enabled_ctrls_changes= old^ctrls->enabled_ctrls; ctrlChange= True; } } state= &xkbi->state; if ((map->groups)&&((map->which_groups&(~XkbIM_UseBase))!=0)) { register int i; register unsigned bit,match; if (on) match= (map->groups)&XkbAllGroupsMask; else match= (~map->groups)&XkbAllGroupsMask; if (map->which_groups&(XkbIM_UseLocked|XkbIM_UseEffective)) { for (i=0,bit=1;iwhich_groups&XkbIM_UseLatched) XkbLatchGroup(xkbi->device,0); /* unlatch group */ state->locked_group= i; stateChange= True; } else if (map->which_groups&(XkbIM_UseLatched|XkbIM_UseEffective)) { for (i=0,bit=1;ilocked_group= 0; XkbLatchGroup(xkbi->device,i); stateChange= True; } } if ((map->mods.mask)&&((map->which_mods&(~XkbIM_UseBase))!=0)) { if (map->which_mods&(XkbIM_UseLocked|XkbIM_UseEffective)) { register unsigned long old; old= state->locked_mods; if (on) state->locked_mods|= map->mods.mask; else state->locked_mods&= ~map->mods.mask; if (state->locked_mods!=old) stateChange= True; } if (map->which_mods&(XkbIM_UseLatched|XkbIM_UseEffective)) { register unsigned long newmods; newmods= state->latched_mods; if (on) newmods|= map->mods.mask; else newmods&= ~map->mods.mask; if (newmods!=state->locked_mods) { newmods&= map->mods.mask; XkbLatchModifiers(xkbi->device,map->mods.mask,newmods); stateChange= True; } } } return (stateChange || ctrlChange); } /* * Bool * ComputeAutoState(map,state,ctrls) * * This function reports the effect of applying the specified * indicator map given the specified state and controls, as * described in section 9.2 of the XKB protocol specification. */ static Bool ComputeAutoState( XkbIndicatorMapPtr map, XkbStatePtr state, XkbControlsPtr ctrls) { Bool on; CARD8 mods,group; on= False; mods= group= 0; if (map->which_mods&XkbIM_UseAnyMods) { if (map->which_mods&XkbIM_UseBase) mods|= state->base_mods; if (map->which_mods&XkbIM_UseLatched) mods|= state->latched_mods; if (map->which_mods&XkbIM_UseLocked) mods|= state->locked_mods; if (map->which_mods&XkbIM_UseEffective) mods|= state->mods; if (map->which_mods&XkbIM_UseCompat) mods|= state->compat_state; on = ((map->mods.mask&mods)!=0); on = on||((mods==0)&&(map->mods.mask==0)&&(map->mods.vmods==0)); } if (map->which_groups&XkbIM_UseAnyGroup) { if (map->which_groups&XkbIM_UseBase) group|= (1L << state->base_group); if (map->which_groups&XkbIM_UseLatched) group|= (1L << state->latched_group); if (map->which_groups&XkbIM_UseLocked) group|= (1L << state->locked_group); if (map->which_groups&XkbIM_UseEffective) group|= (1L << state->group); on = on||(((map->groups&group)!=0)||(map->groups==0)); } if (map->ctrls) on = on||(ctrls->enabled_ctrls&map->ctrls); return on; } static void XkbUpdateLedAutoState( DeviceIntPtr dev, XkbSrvLedInfoPtr sli, unsigned maps_to_check, xkbExtensionDeviceNotify * ed, XkbChangesPtr changes, XkbEventCausePtr cause) { DeviceIntPtr kbd; XkbStatePtr state; XkbControlsPtr ctrls; XkbChangesRec my_changes; xkbExtensionDeviceNotify my_ed; register unsigned i,bit,affected; register XkbIndicatorMapPtr map; unsigned oldState; if ((maps_to_check==0)||(sli->maps==NULL)||(sli->mapsPresent==0)) return; if (dev->key && dev->key->xkbInfo) kbd= dev; else kbd= (DeviceIntPtr)LookupKeyboardDevice(); state= &kbd->key->xkbInfo->state; ctrls= kbd->key->xkbInfo->desc->ctrls; affected= maps_to_check; oldState= sli->effectiveState; sli->autoState&= ~affected; for (i=0,bit=1;(imaps[i]; if((!(map->flags&XkbIM_NoAutomatic))&&ComputeAutoState(map,state,ctrls)) sli->autoState|= bit; } sli->effectiveState= (sli->autoState|sli->explicitState); affected= sli->effectiveState^oldState; if (affected==0) return; if (ed==NULL) { ed= &my_ed; bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); } else if ((ed->reason&XkbXI_IndicatorsMask)&& ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); } if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) { if (changes==NULL) { changes= &my_changes; bzero((char *)changes,sizeof(XkbChangesRec)); } changes->indicators.state_changes|= affected; } ed->reason|= (XkbXI_IndicatorStateMask&(~XkbXI_KeyboardsMask)); ed->ledClass= sli->class; ed->ledID= sli->id; ed->ledsDefined= sli->namesPresent|sli->mapsPresent; ed->ledState= sli->effectiveState; ed->unsupported|= XkbXI_KeyboardsMask&XkbXI_IndicatorStateMask; ed->supported= XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask); if (changes!=&my_changes) changes= NULL; if (ed!=&my_ed) ed= NULL; if (changes || ed) XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); return; } static void XkbUpdateAllDeviceIndicators(XkbChangesPtr changes,XkbEventCausePtr cause) { DeviceIntPtr edev; XkbSrvLedInfoPtr sli; for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) { if (edev->kbdfeed) { KbdFeedbackPtr kf; for (kf=edev->kbdfeed;kf!=NULL;kf=kf->next) { if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL)) continue; sli= kf->xkb_sli; XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, changes,cause); } } if (edev->leds) { LedFeedbackPtr lf; for (lf=edev->leds;lf!=NULL;lf=lf->next) { if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL)) continue; sli= lf->xkb_sli; XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, changes,cause); } } } return; } /***====================================================================***/ /* * void * XkbSetIndicators(dev,affect,values,cause) * * Attempts to change the indicators specified in 'affect' to the * states specified in 'values' for the default keyboard feedback * on the keyboard specified by 'dev.' Attempts to change indicator * state might be ignored or have no affect, depending on the XKB * indicator map for any affected indicators, as described in section * 9.2 of the XKB protocol specification. * * If 'changes' is non-NULL, this function notes any changes to the * keyboard state, controls, or indicator state that result from this * attempted change. If 'changes' is NULL, this function generates * XKB events to report any such changes to interested clients. * * If 'cause' is non-NULL, it specifies the reason for the change, * as reported in some XKB events. If it is NULL, this function * assumes that the change is the result of a core protocol * ChangeKeyboardMapping request. */ void XkbSetIndicators( DeviceIntPtr dev, CARD32 affect, CARD32 values, XkbEventCausePtr cause) { XkbSrvLedInfoPtr sli; XkbChangesRec changes; xkbExtensionDeviceNotify ed; unsigned side_affected; bzero((char *)&changes,sizeof(XkbChangesRec)); bzero((char *)&ed,sizeof(xkbExtensionDeviceNotify)); sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0); sli->explicitState&= ~affect; sli->explicitState|= (affect&values); XkbApplyLedStateChanges(dev,sli,affect,&ed,&changes,cause); side_affected= 0; if (changes.state_changes!=0) side_affected|= XkbIndicatorsToUpdate(dev,changes.state_changes,False); if (changes.ctrls.enabled_ctrls_changes) side_affected|= sli->usesControls; if (side_affected) { XkbUpdateLedAutoState(dev,sli,side_affected,&ed,&changes,cause); affect|= side_affected; } if (changes.state_changes || changes.ctrls.enabled_ctrls_changes) XkbUpdateAllDeviceIndicators(NULL,cause); XkbFlushLedEvents(dev,dev,sli,&ed,&changes,cause); return; } /***====================================================================***/ /* * void * XkbUpdateIndicators(dev,update,check_edevs,changes,cause) * * Applies the indicator maps for any indicators specified in * 'update' from the default keyboard feedback on the device * specified by 'dev.' * * If 'changes' is NULL, this function generates and XKB events * required to report the necessary changes, otherwise it simply * notes the indicators with changed state. * * If 'check_edevs' is True, this function also checks the indicator * maps for any open extension devices that have them, and updates * the state of any extension device indicators as necessary. */ void XkbUpdateIndicators( DeviceIntPtr dev, register CARD32 update, Bool check_edevs, XkbChangesPtr changes, XkbEventCausePtr cause) { XkbSrvLedInfoPtr sli; sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0); XkbUpdateLedAutoState(dev,sli,update,NULL,changes,cause); if (check_edevs) XkbUpdateAllDeviceIndicators(changes,cause); return; } /***====================================================================***/ /***====================================================================***/ /* * void * XkbCheckIndicatorMaps(dev,sli,which) * * Updates the 'indicator accelerators' for the indicators specified * by 'which' in the feedback specified by 'sli.' The indicator * accelerators are internal to the server and are used to simplify * and speed up the process of figuring out which indicators might * be affected by a particular change in keyboard state or controls. */ void XkbCheckIndicatorMaps(DeviceIntPtr dev,XkbSrvLedInfoPtr sli,unsigned which) { register unsigned i,bit; XkbIndicatorMapPtr map; XkbDescPtr xkb; if ((sli->flags&XkbSLI_HasOwnState)==0) dev= (DeviceIntPtr)LookupKeyboardDevice(); sli->usesBase&= ~which; sli->usesLatched&= ~which; sli->usesLocked&= ~which; sli->usesEffective&= ~which; sli->usesCompat&= ~which; sli->usesControls&= ~which; sli->mapsPresent&= ~which; xkb= dev->key->xkbInfo->desc; for (i=0,bit=1,map=sli->maps;imapsPresent|= bit; what= (map->which_mods|map->which_groups); if (what&XkbIM_UseBase) sli->usesBase|= bit; if (what&XkbIM_UseLatched) sli->usesLatched|= bit; if (what&XkbIM_UseLocked) sli->usesLocked|= bit; if (what&XkbIM_UseEffective) sli->usesEffective|= bit; if (what&XkbIM_UseCompat) sli->usesCompat|= bit; if (map->ctrls) sli->usesControls|= bit; map->mods.mask= map->mods.real_mods; if (map->mods.vmods!=0) { map->mods.mask|= XkbMaskForVMask(xkb,map->mods.vmods); } } } sli->usedComponents= 0; if (sli->usesBase) sli->usedComponents|= XkbModifierBaseMask|XkbGroupBaseMask; if (sli->usesLatched) sli->usedComponents|= XkbModifierLatchMask|XkbGroupLatchMask; if (sli->usesLocked) sli->usedComponents|= XkbModifierLockMask|XkbGroupLockMask; if (sli->usesEffective) sli->usedComponents|= XkbModifierStateMask|XkbGroupStateMask; if (sli->usesCompat) sli->usedComponents|= XkbCompatStateMask; return; } /***====================================================================***/ /* * XkbSrvLedInfoPtr * XkbAllocSrvLedInfo(dev,kf,lf,needed_parts) * * Allocates an XkbSrvLedInfoPtr for the feedback specified by either * 'kf' or 'lf' on the keyboard specified by 'dev.' * * If 'needed_parts' is non-zero, this function makes sure that any * of the parts speicified therein are allocated. */ XkbSrvLedInfoPtr XkbAllocSrvLedInfo( DeviceIntPtr dev, KbdFeedbackPtr kf, LedFeedbackPtr lf, unsigned needed_parts) { XkbSrvLedInfoPtr sli; Bool checkAccel; Bool checkNames; sli= NULL; checkAccel= checkNames= False; if ((kf!=NULL)&&(kf->xkb_sli==NULL)) { kf->xkb_sli= sli= _XkbTypedCalloc(1,XkbSrvLedInfoRec); if (sli==NULL) return NULL; /* ALLOCATION ERROR */ if (dev->key && dev->key->xkbInfo) sli->flags= XkbSLI_HasOwnState; else sli->flags= 0; sli->class= KbdFeedbackClass; sli->id= kf->ctrl.id; sli->fb.kf= kf; sli->autoState= 0; sli->explicitState= kf->ctrl.leds; sli->effectiveState= kf->ctrl.leds; if ((kf==dev->kbdfeed) && (dev->key) && (dev->key->xkbInfo)) { XkbDescPtr xkb; xkb= dev->key->xkbInfo->desc; sli->flags|= XkbSLI_IsDefault; sli->physIndicators= xkb->indicators->phys_indicators; sli->names= xkb->names->indicators; sli->maps= xkb->indicators->maps; checkNames= checkAccel= True; } else { sli->physIndicators= XkbAllIndicatorsMask; sli->names= NULL; sli->maps= NULL; } } else if ((kf!=NULL)&&((kf->xkb_sli->flags&XkbSLI_IsDefault)!=0)) { XkbDescPtr xkb; xkb= dev->key->xkbInfo->desc; sli->physIndicators= xkb->indicators->phys_indicators; if (xkb->names->indicators!=sli->names) { checkNames= True; sli->names= xkb->names->indicators; } if (xkb->indicators->maps!=sli->maps) { checkAccel= True; sli->maps= xkb->indicators->maps; } } else if ((lf!=NULL)&&(lf->xkb_sli==NULL)) { lf->xkb_sli= sli= _XkbTypedCalloc(1,XkbSrvLedInfoRec); if (sli==NULL) return NULL; /* ALLOCATION ERROR */ if (dev->key && dev->key->xkbInfo) sli->flags= XkbSLI_HasOwnState; else sli->flags= 0; sli->class= LedFeedbackClass; sli->id= lf->ctrl.id; sli->fb.lf= lf; sli->physIndicators= lf->ctrl.led_mask; sli->autoState= 0; sli->explicitState= lf->ctrl.led_values; sli->effectiveState= lf->ctrl.led_values; sli->maps= NULL; sli->names= NULL; } if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask)) sli->names= _XkbTypedCalloc(XkbNumIndicators,Atom); if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask)) sli->maps= _XkbTypedCalloc(XkbNumIndicators,XkbIndicatorMapRec); if (checkNames) { register unsigned i,bit; sli->namesPresent= 0; for (i=0,bit=1;inames[i]!=None) sli->namesPresent|= bit; } } if (checkAccel) XkbCheckIndicatorMaps(dev,sli,XkbAllIndicatorsMask); return sli; } void XkbFreeSrvLedInfo(XkbSrvLedInfoPtr sli) { if ((sli->flags&XkbSLI_IsDefault)==0) { if (sli->maps) _XkbFree(sli->maps); if (sli->names) _XkbFree(sli->names); } sli->maps= NULL; sli->names= NULL; _XkbFree(sli); return; } /***====================================================================***/ /* * XkbSrvLedInfoPtr * XkbFindSrvLedInfo(dev,class,id,needed_parts) * * Finds the XkbSrvLedInfoPtr for the specified 'class' and 'id' * on the device specified by 'dev.' If the class and id specify * a valid device feedback, this function returns the existing * feedback or allocates a new one. * */ XkbSrvLedInfoPtr XkbFindSrvLedInfo( DeviceIntPtr dev, unsigned class, unsigned id, unsigned needed_parts) { XkbSrvLedInfoPtr sli; /* optimization to check for most common case */ if (((class==XkbDfltXIClass)&&(id==XkbDfltXIId))&&(dev->kbdfeed)) { if (dev->kbdfeed->xkb_sli==NULL) { dev->kbdfeed->xkb_sli= XkbAllocSrvLedInfo(dev,dev->kbdfeed,NULL,needed_parts); } return dev->kbdfeed->xkb_sli; } sli= NULL; if (class==XkbDfltXIClass) { if (dev->kbdfeed) class= KbdFeedbackClass; else if (dev->leds) class= LedFeedbackClass; else return NULL; } if (class==KbdFeedbackClass) { KbdFeedbackPtr kf; for (kf=dev->kbdfeed;kf!=NULL;kf=kf->next) { if ((id==XkbDfltXIId)||(id==kf->ctrl.id)) { if (kf->xkb_sli==NULL) kf->xkb_sli= XkbAllocSrvLedInfo(dev,kf,NULL,needed_parts); sli= kf->xkb_sli; break; } } } else if (class==LedFeedbackClass) { LedFeedbackPtr lf; for (lf=dev->leds;lf!=NULL;lf=lf->next) { if ((id==XkbDfltXIId)||(id==lf->ctrl.id)) { if (lf->xkb_sli==NULL) lf->xkb_sli= XkbAllocSrvLedInfo(dev,NULL,lf,needed_parts); sli= lf->xkb_sli; break; } } } if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask)) sli->names= _XkbTypedCalloc(XkbNumIndicators,Atom); if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask)) sli->maps= _XkbTypedCalloc(XkbNumIndicators,XkbIndicatorMapRec); return sli; } /***====================================================================***/ void XkbFlushLedEvents( DeviceIntPtr dev, DeviceIntPtr kbd, XkbSrvLedInfoPtr sli, xkbExtensionDeviceNotify * ed, XkbChangesPtr changes, XkbEventCausePtr cause) { if (changes) { if (changes->indicators.state_changes) XkbDDXUpdateDeviceIndicators(dev,sli,sli->effectiveState); XkbSendNotification(kbd,changes,cause); bzero((char *)changes,sizeof(XkbChangesRec)); if (XkbAX_NeedFeedback(kbd->key->xkbInfo->desc->ctrls, XkbAX_IndicatorFBMask)) { if (sli->effectiveState) /* it appears that the which parameter is not used */ XkbDDXAccessXBeep(dev, _BEEP_LED_ON, XkbAccessXFeedbackMask); else XkbDDXAccessXBeep(dev, _BEEP_LED_OFF, XkbAccessXFeedbackMask); } } if (ed && (ed->reason)) { if ((dev!=kbd)&&(ed->reason&XkbXI_IndicatorStateMask)) XkbDDXUpdateDeviceIndicators(dev,sli,sli->effectiveState); XkbSendExtensionDeviceNotify(dev,cause->client,ed); } bzero((char *)ed,sizeof(XkbExtensionDeviceNotify)); return; } /***====================================================================***/ void XkbApplyLedNameChanges( DeviceIntPtr dev, XkbSrvLedInfoPtr sli, unsigned changed_names, xkbExtensionDeviceNotify * ed, XkbChangesPtr changes, XkbEventCausePtr cause) { DeviceIntPtr kbd; XkbChangesRec my_changes; xkbExtensionDeviceNotify my_ed; if (changed_names==0) return; if (dev->key && dev->key->xkbInfo) kbd= dev; else kbd= (DeviceIntPtr)LookupKeyboardDevice(); if (ed==NULL) { ed= &my_ed; bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); } else if ((ed->reason&XkbXI_IndicatorsMask)&& ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); } if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) { if (changes==NULL) { changes= &my_changes; bzero((char *)changes,sizeof(XkbChangesRec)); } changes->names.changed|= XkbIndicatorNamesMask; changes->names.changed_indicators|= changed_names; } ed->reason|= (XkbXI_IndicatorNamesMask&(~XkbXI_KeyboardsMask)); ed->ledClass= sli->class; ed->ledID= sli->id; ed->ledsDefined= sli->namesPresent|sli->mapsPresent; ed->ledState= sli->effectiveState; ed->unsupported= XkbXI_KeyboardsMask; ed->supported= XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask); if (changes!=&my_changes) changes= NULL; if (ed!=&my_ed) ed= NULL; if (changes || ed) XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); return; } /***====================================================================***/ /* * void * XkbApplyLedMapChanges(dev,sli,changed_maps,changes,cause) * * Handles all of the secondary effects of the changes to the * feedback specified by 'sli' on the device specified by 'dev.' * * If 'changed_maps' specifies any indicators, this function generates * XkbExtensionDeviceNotify events and possibly IndicatorMapNotify * events to report the changes, and recalculates the effective * state of each indicator with a changed map. If any indicators * change state, the server generates XkbExtensionDeviceNotify and * XkbIndicatorStateNotify events as appropriate. * * If 'changes' is non-NULL, this function updates it to reflect * any changes to the keyboard state or controls or to the 'core' * indicator names, maps, or state. If 'changes' is NULL, this * function generates XKB events as needed to report the changes. * If 'dev' is not a keyboard device, any changes are reported * for the core keyboard. * * The 'cause' specifies the reason for the event (key event or * request) for the change, as reported in some XKB events. */ void XkbApplyLedMapChanges( DeviceIntPtr dev, XkbSrvLedInfoPtr sli, unsigned changed_maps, xkbExtensionDeviceNotify * ed, XkbChangesPtr changes, XkbEventCausePtr cause) { DeviceIntPtr kbd; XkbChangesRec my_changes; xkbExtensionDeviceNotify my_ed; if (changed_maps==0) return; if (dev->key && dev->key->xkbInfo) kbd= dev; else kbd= (DeviceIntPtr)LookupKeyboardDevice(); if (ed==NULL) { ed= &my_ed; bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); } else if ((ed->reason&XkbXI_IndicatorsMask)&& ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); } if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) { if (changes==NULL) { changes= &my_changes; bzero((char *)changes,sizeof(XkbChangesRec)); } changes->indicators.map_changes|= changed_maps; } XkbCheckIndicatorMaps(dev,sli,changed_maps); ed->reason|= (XkbXI_IndicatorMapsMask&(~XkbXI_KeyboardsMask)); ed->ledClass= sli->class; ed->ledID= sli->id; ed->ledsDefined= sli->namesPresent|sli->mapsPresent; ed->ledState= sli->effectiveState; ed->unsupported|= XkbXI_KeyboardsMask&XkbXI_IndicatorMapsMask; ed->supported= XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask); XkbUpdateLedAutoState(dev,sli,changed_maps,ed,changes,cause); if (changes!=&my_changes) changes= NULL; if (ed!=&my_ed) ed= NULL; if (changes || ed) XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); return; } /***====================================================================***/ void XkbApplyLedStateChanges(DeviceIntPtr dev, XkbSrvLedInfoPtr sli, unsigned changed_leds, xkbExtensionDeviceNotify * ed, XkbChangesPtr changes, XkbEventCausePtr cause) { XkbSrvInfoPtr xkbi; DeviceIntPtr kbd; XkbChangesRec my_changes; xkbExtensionDeviceNotify my_ed; register unsigned i,bit,affected; XkbIndicatorMapPtr map; unsigned oldState; Bool kb_changed; if (changed_leds==0) return; if (dev->key && dev->key->xkbInfo) kbd= dev; else kbd= (DeviceIntPtr)LookupKeyboardDevice(); xkbi= kbd->key->xkbInfo; if (changes==NULL) { changes= &my_changes; bzero((char *)changes,sizeof(XkbChangesRec)); } kb_changed= False; affected= changed_leds; oldState= sli->effectiveState; for (i=0,bit=1;(imaps[i]; if (map->flags&XkbIM_NoExplicit) { sli->explicitState&= ~bit; continue; } if (map->flags&XkbIM_LEDDrivesKB) { Bool on= ((sli->explicitState&bit)!=0); if (XkbApplyLEDChangeToKeyboard(xkbi,map,on,changes)) kb_changed= True; } } sli->effectiveState= (sli->autoState|sli->explicitState); affected= sli->effectiveState^oldState; if (ed==NULL) { ed= &my_ed; bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); } else if (affected&&(ed->reason&XkbXI_IndicatorsMask)&& ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); } if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) changes->indicators.state_changes|= affected; if (affected) { ed->reason|= (XkbXI_IndicatorStateMask&(~XkbXI_KeyboardsMask)); ed->ledClass= sli->class; ed->ledID= sli->id; ed->ledsDefined= sli->namesPresent|sli->mapsPresent; ed->ledState= sli->effectiveState; ed->unsupported|= XkbXI_KeyboardsMask&XkbXI_IndicatorStateMask; ed->supported= XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask); } if (kb_changed) { XkbComputeDerivedState(kbd->key->xkbInfo); XkbUpdateLedAutoState(dev,sli,sli->mapsPresent,ed,changes,cause); } if (changes!=&my_changes) changes= NULL; if (ed!=&my_ed) ed= NULL; if (changes || ed) XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); if (kb_changed) XkbUpdateAllDeviceIndicators(NULL,cause); return; } /***====================================================================***/ nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/XKBMAlloc.c0000644000000000000000000006310113614532331017240 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #elif defined(HAVE_CONFIG_H) #include #endif #include #include #include #include "misc.h" #include "inputstr.h" #include #include /***====================================================================***/ Status XkbAllocClientMap(XkbDescPtr xkb,unsigned which,unsigned nTotalTypes) { register int i; XkbClientMapPtr map; if ((xkb==NULL)||((nTotalTypes>0)&&(nTotalTypesmin_key_code))|| (!XkbIsLegalKeycode(xkb->max_key_code))|| (xkb->max_key_codemin_key_code))) { DebugF("bad keycode (%d,%d) in XkbAllocClientMap\n", xkb->min_key_code,xkb->max_key_code); return BadValue; } if (xkb->map==NULL) { map= _XkbTypedCalloc(1,XkbClientMapRec); if (map==NULL) return BadAlloc; xkb->map= map; } else map= xkb->map; if ((which&XkbKeyTypesMask)&&(nTotalTypes>0)) { if (map->types==NULL) { map->types= _XkbTypedCalloc(nTotalTypes,XkbKeyTypeRec); if (map->types==NULL) return BadAlloc; map->num_types= 0; map->size_types= nTotalTypes; } else if (map->size_typestypes; map->types= _XkbTypedRealloc(map->types,nTotalTypes,XkbKeyTypeRec); if (map->types==NULL) { _XkbFree(prev_types); map->num_types= map->size_types= 0; return BadAlloc; } map->size_types= nTotalTypes; bzero(&map->types[map->num_types], ((map->size_types-map->num_types)*sizeof(XkbKeyTypeRec))); } } if (which&XkbKeySymsMask) { int nKeys= XkbNumKeys(xkb); if (map->syms==NULL) { map->size_syms= (nKeys*15)/10; map->syms= _XkbTypedCalloc(map->size_syms,KeySym); if (!map->syms) { map->size_syms= 0; return BadAlloc; } map->num_syms= 1; map->syms[0]= NoSymbol; } if (map->key_sym_map==NULL) { i= xkb->max_key_code+1; map->key_sym_map= _XkbTypedCalloc(i,XkbSymMapRec); if (map->key_sym_map==NULL) return BadAlloc; } } if (which&XkbModifierMapMask) { if ((!XkbIsLegalKeycode(xkb->min_key_code))|| (!XkbIsLegalKeycode(xkb->max_key_code))|| (xkb->max_key_codemin_key_code)) return BadMatch; if (map->modmap==NULL) { i= xkb->max_key_code+1; map->modmap= _XkbTypedCalloc(i,unsigned char); if (map->modmap==NULL) return BadAlloc; } } return Success; } Status XkbAllocServerMap(XkbDescPtr xkb,unsigned which,unsigned nNewActions) { register int i; XkbServerMapPtr map; if (xkb==NULL) return BadMatch; if (xkb->server==NULL) { map= _XkbTypedCalloc(1,XkbServerMapRec); if (map==NULL) return BadAlloc; for (i=0;ivmods[i]= XkbNoModifierMask; } xkb->server= map; } else map= xkb->server; if (which&XkbExplicitComponentsMask) { if ((!XkbIsLegalKeycode(xkb->min_key_code))|| (!XkbIsLegalKeycode(xkb->max_key_code))|| (xkb->max_key_codemin_key_code)) return BadMatch; if (map->explicit==NULL) { i= xkb->max_key_code+1; map->explicit= _XkbTypedCalloc(i,unsigned char); if (map->explicit==NULL) return BadAlloc; } } if (which&XkbKeyActionsMask) { if ((!XkbIsLegalKeycode(xkb->min_key_code))|| (!XkbIsLegalKeycode(xkb->max_key_code))|| (xkb->max_key_codemin_key_code)) return BadMatch; if (nNewActions<1) nNewActions= 1; if (map->acts==NULL) { map->acts= _XkbTypedCalloc((nNewActions+1),XkbAction); if (map->acts==NULL) return BadAlloc; map->num_acts= 1; map->size_acts= nNewActions+1; } else if ((map->size_acts-map->num_acts)acts; need= map->num_acts+nNewActions; map->acts= _XkbTypedRealloc(map->acts,need,XkbAction); if (map->acts==NULL) { _XkbFree(prev_acts); map->num_acts= map->size_acts= 0; return BadAlloc; } map->size_acts= need; bzero(&map->acts[map->num_acts], ((map->size_acts-map->num_acts)*sizeof(XkbAction))); } if (map->key_acts==NULL) { i= xkb->max_key_code+1; map->key_acts= _XkbTypedCalloc(i,unsigned short); if (map->key_acts==NULL) return BadAlloc; } } if (which&XkbKeyBehaviorsMask) { if ((!XkbIsLegalKeycode(xkb->min_key_code))|| (!XkbIsLegalKeycode(xkb->max_key_code))|| (xkb->max_key_codemin_key_code)) return BadMatch; if (map->behaviors==NULL) { i= xkb->max_key_code+1; map->behaviors= _XkbTypedCalloc(i,XkbBehavior); if (map->behaviors==NULL) return BadAlloc; } } if (which&XkbVirtualModMapMask) { if ((!XkbIsLegalKeycode(xkb->min_key_code))|| (!XkbIsLegalKeycode(xkb->max_key_code))|| (xkb->max_key_codemin_key_code)) return BadMatch; if (map->vmodmap==NULL) { i= xkb->max_key_code+1; map->vmodmap= _XkbTypedCalloc(i,unsigned short); if (map->vmodmap==NULL) return BadAlloc; } } return Success; } /***====================================================================***/ static Status XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into) { if ((!from)||(!into)) return BadMatch; if (into->map) { _XkbFree(into->map); into->map= NULL; } if (into->preserve) { _XkbFree(into->preserve); into->preserve= NULL; } if (into->level_names) { _XkbFree(into->level_names); into->level_names= NULL; } *into= *from; if ((from->map)&&(into->map_count>0)) { into->map= _XkbTypedCalloc(into->map_count,XkbKTMapEntryRec); if (!into->map) return BadAlloc; memcpy(into->map,from->map,into->map_count*sizeof(XkbKTMapEntryRec)); } if ((from->preserve)&&(into->map_count>0)) { into->preserve= _XkbTypedCalloc(into->map_count,XkbModsRec); if (!into->preserve) return BadAlloc; memcpy(into->preserve,from->preserve, into->map_count*sizeof(XkbModsRec)); } if ((from->level_names)&&(into->num_levels>0)) { into->level_names= _XkbTypedCalloc(into->num_levels,Atom); if (!into->level_names) return BadAlloc; memcpy(into->level_names,from->level_names, into->num_levels*sizeof(Atom)); } return Success; } Status XkbCopyKeyTypes(XkbKeyTypePtr from,XkbKeyTypePtr into,int num_types) { register int i,rtrn; if ((!from)||(!into)||(num_types<0)) return BadMatch; for (i=0;i=xkb->map->num_types)||(map_count<0)|| (new_num_lvls<1)) return BadValue; switch (type_ndx) { case XkbOneLevelIndex: if (new_num_lvls!=1) return BadMatch; break; case XkbTwoLevelIndex: case XkbAlphabeticIndex: case XkbKeypadIndex: if (new_num_lvls!=2) return BadMatch; break; } type= &xkb->map->types[type_ndx]; if (map_count==0) { if (type->map!=NULL) _XkbFree(type->map); type->map= NULL; if (type->preserve!=NULL) _XkbFree(type->preserve); type->preserve= NULL; type->map_count= 0; } else { XkbKTMapEntryRec *prev_map = type->map; if ((map_count>type->map_count)||(type->map==NULL)) type->map=_XkbTypedRealloc(type->map,map_count,XkbKTMapEntryRec); if (!type->map) { if (prev_map) _XkbFree(prev_map); return BadAlloc; } if (want_preserve) { XkbModsRec *prev_preserve = type->preserve; if ((map_count>type->map_count)||(type->preserve==NULL)) { type->preserve= _XkbTypedRealloc(type->preserve,map_count, XkbModsRec); } if (!type->preserve) { if (prev_preserve) _XkbFree(prev_preserve); return BadAlloc; } } else if (type->preserve!=NULL) { _XkbFree(type->preserve); type->preserve= NULL; } type->map_count= map_count; } if ((new_num_lvls>type->num_levels)||(type->level_names==NULL)) { Atom * prev_level_names = type->level_names; type->level_names=_XkbTypedRealloc(type->level_names,new_num_lvls,Atom); if (!type->level_names) { if (prev_level_names) _XkbFree(prev_level_names); return BadAlloc; } } /* * Here's the theory: * If the width of the type changed, we might have to resize the symbol * maps for any keys that use the type for one or more groups. This is * expensive, so we'll try to cull out any keys that are obviously okay: * In any case: * - keys that have a group width <= the old width are okay (because * they could not possibly have been associated with the old type) * If the key type increased in size: * - keys that already have a group width >= to the new width are okay * + keys that have a group width >= the old width but < the new width * might have to be enlarged. * If the key type decreased in size: * - keys that have a group width > the old width don't have to be * resized (because they must have some other wider type associated * with some group). * + keys that have a group width == the old width might have to be * shrunk. * The possibilities marked with '+' require us to examine the key types * associated with each group for the key. */ bzero(matchingKeys,XkbMaxKeyCount*sizeof(KeyCode)); nMatchingKeys= 0; if (new_num_lvls>type->num_levels) { int nTotal; KeySym * newSyms; int width,match,nResize; register int i,g,nSyms; nResize= 0; for (nTotal=1,i=xkb->min_key_code;i<=xkb->max_key_code;i++) { width= XkbKeyGroupsWidth(xkb,i); if (widthnum_levels) continue; for (match=0,g=XkbKeyNumGroups(xkb,i)-1;(g>=0)&&(!match);g--) { if (XkbKeyKeyTypeIndex(xkb,i,g)==type_ndx) { matchingKeys[nMatchingKeys++]= i; match= 1; } } if ((!match)||(width>=new_num_lvls)) nTotal+= XkbKeyNumSyms(xkb,i); else { nTotal+= XkbKeyNumGroups(xkb,i)*new_num_lvls; nResize++; } } if (nResize>0) { int nextMatch; xkb->map->size_syms= (nTotal*15)/10; newSyms = _XkbTypedCalloc(xkb->map->size_syms,KeySym); if (newSyms==NULL) return BadAlloc; nextMatch= 0; nSyms= 1; for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) { if (matchingKeys[nextMatch]==i) { KeySym *pOld; nextMatch++; width= XkbKeyGroupsWidth(xkb,i); pOld= XkbKeySymsPtr(xkb,i); for (g=XkbKeyNumGroups(xkb,i)-1;g>=0;g--) { memcpy(&newSyms[nSyms+(new_num_lvls*g)],&pOld[width*g], width*sizeof(KeySym)); } xkb->map->key_sym_map[i].offset= nSyms; nSyms+= XkbKeyNumGroups(xkb,i)*new_num_lvls; } else { memcpy(&newSyms[nSyms],XkbKeySymsPtr(xkb,i), XkbKeyNumSyms(xkb,i)*sizeof(KeySym)); xkb->map->key_sym_map[i].offset= nSyms; nSyms+= XkbKeyNumSyms(xkb,i); } } type->num_levels= new_num_lvls; _XkbFree(xkb->map->syms); xkb->map->syms= newSyms; xkb->map->num_syms= nSyms; return Success; } } else if (new_num_lvlsnum_levels) { int width,match; register int g,i; for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) { width= XkbKeyGroupsWidth(xkb,i); if (widthnum_levels) continue; for (match=0,g=XkbKeyNumGroups(xkb,i)-1;(g>=0)&&(!match);g--) { if (XkbKeyKeyTypeIndex(xkb,i,g)==type_ndx) { matchingKeys[nMatchingKeys++]= i; match= 1; } } } } if (nMatchingKeys>0) { int key,firstClear; register int i,g; if (new_num_lvls>type->num_levels) firstClear= type->num_levels; else firstClear= new_num_lvls; for (i=0;i=0;g--) { if (XkbKeyKeyTypeIndex(xkb,key,g)==type_ndx) { if (nClear>0) bzero(&pSyms[g*width+firstClear],nClear*sizeof(KeySym)); } } } } type->num_levels= new_num_lvls; return Success; } KeySym * XkbResizeKeySyms(XkbDescPtr xkb,int key,int needed) { register int i,nSyms,nKeySyms; unsigned nOldSyms; KeySym *newSyms; if (needed==0) { xkb->map->key_sym_map[key].offset= 0; return xkb->map->syms; } nOldSyms= XkbKeyNumSyms(xkb,key); if (nOldSyms>=(unsigned)needed) { return XkbKeySymsPtr(xkb,key); } if (xkb->map->size_syms-xkb->map->num_syms>=(unsigned)needed) { if (nOldSyms>0) { memcpy(&xkb->map->syms[xkb->map->num_syms],XkbKeySymsPtr(xkb,key), nOldSyms*sizeof(KeySym)); } if ((needed-nOldSyms)>0) { bzero(&xkb->map->syms[xkb->map->num_syms+XkbKeyNumSyms(xkb,key)], (needed-nOldSyms)*sizeof(KeySym)); } xkb->map->key_sym_map[key].offset = xkb->map->num_syms; xkb->map->num_syms+= needed; return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; } xkb->map->size_syms+= (needed>32?needed:32); newSyms = _XkbTypedCalloc(xkb->map->size_syms,KeySym); if (newSyms==NULL) return NULL; newSyms[0]= NoSymbol; nSyms = 1; for (i=xkb->min_key_code;i<=(int)xkb->max_key_code;i++) { int nCopy; nCopy= nKeySyms= XkbKeyNumSyms(xkb,i); if ((nKeySyms==0)&&(i!=key)) continue; if (i==key) nKeySyms= needed; if (nCopy!=0) memcpy(&newSyms[nSyms],XkbKeySymsPtr(xkb,i),nCopy*sizeof(KeySym)); if (nKeySyms>nCopy) bzero(&newSyms[nSyms+nCopy],(nKeySyms-nCopy)*sizeof(KeySym)); xkb->map->key_sym_map[i].offset = nSyms; nSyms+= nKeySyms; } _XkbFree(xkb->map->syms); xkb->map->syms = newSyms; xkb->map->num_syms = nSyms; return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; } static unsigned _ExtendRange( unsigned int old_flags, unsigned int flag, KeyCode newKC, KeyCode * old_min, unsigned char * old_num) { if ((old_flags&flag)==0) { old_flags|= flag; *old_min= newKC; *old_num= 1; } else { int last= (*old_min)+(*old_num)-1; if (newKC<*old_min) { *old_min= newKC; *old_num= (last-newKC)+1; } else if (newKC>last) { *old_num= (newKC-(*old_min))+1; } } return old_flags; } Status XkbChangeKeycodeRange( XkbDescPtr xkb, int minKC, int maxKC, XkbChangesPtr changes) { int tmp; if ((!xkb)||(minKCXkbMaxLegalKeyCode)) return BadValue; if (minKC>maxKC) return BadMatch; if (minKCmin_key_code) { if (changes) changes->map.min_key_code= minKC; tmp= xkb->min_key_code-minKC; if (xkb->map) { if (xkb->map->key_sym_map) { bzero((char *)&xkb->map->key_sym_map[minKC], tmp*sizeof(XkbSymMapRec)); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, XkbKeySymsMask,minKC, &changes->map.first_key_sym, &changes->map.num_key_syms); } } if (xkb->map->modmap) { bzero((char *)&xkb->map->modmap[minKC],tmp); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, XkbModifierMapMask,minKC, &changes->map.first_modmap_key, &changes->map.num_modmap_keys); } } } if (xkb->server) { if (xkb->server->behaviors) { bzero((char *)&xkb->server->behaviors[minKC], tmp*sizeof(XkbBehavior)); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, XkbKeyBehaviorsMask,minKC, &changes->map.first_key_behavior, &changes->map.num_key_behaviors); } } if (xkb->server->key_acts) { bzero((char *)&xkb->server->key_acts[minKC], tmp*sizeof(unsigned short)); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, XkbKeyActionsMask,minKC, &changes->map.first_key_act, &changes->map.num_key_acts); } } if (xkb->server->vmodmap) { bzero((char *)&xkb->server->vmodmap[minKC], tmp*sizeof(unsigned short)); if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, XkbVirtualModMapMask,minKC, &changes->map.first_modmap_key, &changes->map.num_vmodmap_keys); } } } if ((xkb->names)&&(xkb->names->keys)) { bzero((char *)&xkb->names->keys[minKC],tmp*sizeof(XkbKeyNameRec)); if (changes) { changes->names.changed= _ExtendRange(changes->names.changed, XkbKeyNamesMask,minKC, &changes->names.first_key, &changes->names.num_keys); } } xkb->min_key_code= minKC; } if (maxKC>xkb->max_key_code) { if (changes) changes->map.max_key_code= maxKC; tmp= maxKC-xkb->max_key_code; if (xkb->map) { if (xkb->map->key_sym_map) { XkbSymMapRec *prev_key_sym_map = xkb->map->key_sym_map; xkb->map->key_sym_map= _XkbTypedRealloc(xkb->map->key_sym_map, (maxKC+1),XkbSymMapRec); if (!xkb->map->key_sym_map) { _XkbFree(prev_key_sym_map); return BadAlloc; } #ifdef NXAGENT_SERVER bzero((char *)&xkb->map->key_sym_map[xkb->max_key_code+1], tmp*sizeof(XkbSymMapRec)); #else bzero((char *)&xkb->map->key_sym_map[xkb->max_key_code], tmp*sizeof(XkbSymMapRec)); #endif if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, XkbKeySymsMask,maxKC, &changes->map.first_key_sym, &changes->map.num_key_syms); } } if (xkb->map->modmap) { unsigned char *prev_modmap = xkb->map->modmap; xkb->map->modmap= _XkbTypedRealloc(xkb->map->modmap, (maxKC+1),unsigned char); if (!xkb->map->modmap) { _XkbFree(prev_modmap); return BadAlloc; } #ifdef NXAGENT_SERVER bzero((char *)&xkb->map->modmap[xkb->max_key_code+1],tmp); #else bzero((char *)&xkb->map->modmap[xkb->max_key_code],tmp); #endif if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, XkbModifierMapMask,maxKC, &changes->map.first_modmap_key, &changes->map.num_modmap_keys); } } } if (xkb->server) { if (xkb->server->behaviors) { XkbBehavior *prev_behaviors = xkb->server->behaviors; xkb->server->behaviors=_XkbTypedRealloc(xkb->server->behaviors, (maxKC+1),XkbBehavior); if (!xkb->server->behaviors) { _XkbFree(prev_behaviors); return BadAlloc; } #ifdef NXAGENT_SERVER bzero((char *)&xkb->server->behaviors[xkb->max_key_code+1], tmp*sizeof(XkbBehavior)); #else bzero((char *)&xkb->server->behaviors[xkb->max_key_code], tmp*sizeof(XkbBehavior)); #endif if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, XkbKeyBehaviorsMask,maxKC, &changes->map.first_key_behavior, &changes->map.num_key_behaviors); } } if (xkb->server->key_acts) { unsigned short *prev_key_acts = xkb->server->key_acts; xkb->server->key_acts= _XkbTypedRealloc(xkb->server->key_acts, (maxKC+1),unsigned short); if (!xkb->server->key_acts) { _XkbFree(prev_key_acts); return BadAlloc; } #ifdef NXAGENT_SERVER bzero((char *)&xkb->server->key_acts[xkb->max_key_code+1], tmp*sizeof(unsigned short)); #else bzero((char *)&xkb->server->key_acts[xkb->max_key_code], tmp*sizeof(unsigned short)); #endif if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, XkbKeyActionsMask,maxKC, &changes->map.first_key_act, &changes->map.num_key_acts); } } if (xkb->server->vmodmap) { unsigned short *prev_vmodmap = xkb->server->vmodmap; xkb->server->vmodmap= _XkbTypedRealloc(xkb->server->vmodmap, (maxKC+1),unsigned short); if (!xkb->server->vmodmap) { _XkbFree(prev_vmodmap); return BadAlloc; } #ifdef NXAGENT_SERVER bzero((char *)&xkb->server->vmodmap[xkb->max_key_code+1], tmp*sizeof(unsigned short)); #else bzero((char *)&xkb->server->vmodmap[xkb->max_key_code], tmp*sizeof(unsigned short)); #endif if (changes) { changes->map.changed= _ExtendRange(changes->map.changed, XkbVirtualModMapMask,maxKC, &changes->map.first_modmap_key, &changes->map.num_vmodmap_keys); } } } if ((xkb->names)&&(xkb->names->keys)) { XkbKeyNameRec *prev_keys = xkb->names->keys; xkb->names->keys= _XkbTypedRealloc(xkb->names->keys, (maxKC+1),XkbKeyNameRec); if (!xkb->names->keys) { _XkbFree(prev_keys); return BadAlloc; } #ifdef NXAGENT_SERVER bzero((char *)&xkb->names->keys[xkb->max_key_code+1], tmp*sizeof(XkbKeyNameRec)); #else bzero((char *)&xkb->names->keys[xkb->max_key_code], tmp*sizeof(XkbKeyNameRec)); #endif if (changes) { changes->names.changed= _ExtendRange(changes->names.changed, XkbKeyNamesMask,maxKC, &changes->names.first_key, &changes->names.num_keys); } } xkb->max_key_code= maxKC; } return Success; } XkbAction * XkbResizeKeyActions(XkbDescPtr xkb,int key,int needed) { register int i,nActs; XkbAction *newActs; if (needed==0) { xkb->server->key_acts[key]= 0; return NULL; } if (XkbKeyHasActions(xkb,key)&&(XkbKeyNumSyms(xkb,key)>=(unsigned)needed)) return XkbKeyActionsPtr(xkb,key); if (xkb->server->size_acts-xkb->server->num_acts>=(unsigned)needed) { xkb->server->key_acts[key]= xkb->server->num_acts; xkb->server->num_acts+= needed; return &xkb->server->acts[xkb->server->key_acts[key]]; } xkb->server->size_acts= xkb->server->num_acts+needed+8; newActs = _XkbTypedCalloc(xkb->server->size_acts,XkbAction); if (newActs==NULL) return NULL; newActs[0].type = XkbSA_NoAction; nActs = 1; for (i=xkb->min_key_code;i<=(int)xkb->max_key_code;i++) { int nKeyActs,nCopy; if ((xkb->server->key_acts[i]==0)&&(i!=key)) continue; nCopy= nKeyActs= XkbKeyNumActions(xkb,i); if (i==key) { nKeyActs= needed; if (needed0) memcpy(&newActs[nActs],XkbKeyActionsPtr(xkb,i), nCopy*sizeof(XkbAction)); if (nCopyserver->key_acts[i]= nActs; nActs+= nKeyActs; } _XkbFree(xkb->server->acts); xkb->server->acts = newActs; xkb->server->num_acts= nActs; return &xkb->server->acts[xkb->server->key_acts[key]]; } void XkbFreeClientMap(XkbDescPtr xkb,unsigned what,Bool freeMap) { XkbClientMapPtr map; if ((xkb==NULL)||(xkb->map==NULL)) return; if (freeMap) what= XkbAllClientInfoMask; map= xkb->map; if (what&XkbKeyTypesMask) { if (map->types!=NULL) { if (map->num_types>0) { register int i; XkbKeyTypePtr type; for (i=0,type=map->types;inum_types;i++,type++) { if (type->map!=NULL) { _XkbFree(type->map); type->map= NULL; } if (type->preserve!=NULL) { _XkbFree(type->preserve); type->preserve= NULL; } type->map_count= 0; if (type->level_names!=NULL) { _XkbFree(type->level_names); type->level_names= NULL; } } } _XkbFree(map->types); map->num_types= map->size_types= 0; map->types= NULL; } } if (what&XkbKeySymsMask) { if (map->key_sym_map!=NULL) { _XkbFree(map->key_sym_map); map->key_sym_map= NULL; } if (map->syms!=NULL) { _XkbFree(map->syms); map->size_syms= map->num_syms= 0; map->syms= NULL; } } if ((what&XkbModifierMapMask)&&(map->modmap!=NULL)) { _XkbFree(map->modmap); map->modmap= NULL; } if (freeMap) { _XkbFree(xkb->map); xkb->map= NULL; } return; } void XkbFreeServerMap(XkbDescPtr xkb,unsigned what,Bool freeMap) { XkbServerMapPtr map; if ((xkb==NULL)||(xkb->server==NULL)) return; if (freeMap) what= XkbAllServerInfoMask; map= xkb->server; if ((what&XkbExplicitComponentsMask)&&(map->explicit!=NULL)) { _XkbFree(map->explicit); map->explicit= NULL; } if (what&XkbKeyActionsMask) { if (map->key_acts!=NULL) { _XkbFree(map->key_acts); map->key_acts= NULL; } if (map->acts!=NULL) { _XkbFree(map->acts); map->num_acts= map->size_acts= 0; map->acts= NULL; } } if ((what&XkbKeyBehaviorsMask)&&(map->behaviors!=NULL)) { _XkbFree(map->behaviors); map->behaviors= NULL; } if ((what&XkbVirtualModMapMask)&&(map->vmodmap!=NULL)) { _XkbFree(map->vmodmap); map->vmodmap= NULL; } if (freeMap) { _XkbFree(xkb->server); xkb->server= NULL; } return; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/XKBMisc.c0000644000000000000000000005466513614532331017003 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #elif defined(HAVE_CONFIG_H) #include #endif #include #include #include #include "misc.h" #include "inputstr.h" #include #include /***====================================================================***/ #define CORE_SYM(i) (imap->num_types)) { nSyms[i]= xkb->map->types[types_inout[i]].num_levels; if (nSyms[i]>groupsWidth) groupsWidth= nSyms[i]; } else { types_inout[i]= XkbTwoLevelIndex; /* don't really know, yet */ nSyms[i]= 2; } } if (nSyms[XkbGroup1Index]<2) nSyms[XkbGroup1Index]= 2; if (nSyms[XkbGroup2Index]<2) nSyms[XkbGroup2Index]= 2; /* Step 2: Copy the symbols from the core ordering to XKB ordering */ /* symbols in the core are in the order: */ /* G1L1 G1L2 G2L1 G2L2 [G1L[3-n]] [G2L[3-n]] [G3L*] [G3L*] */ xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index,0)]= CORE_SYM(0); xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index,1)]= CORE_SYM(1); for (i=2;i=map_width)&& ((protected&(XkbExplicitKeyType3Mask|XkbExplicitKeyType4Mask))==0)) { nSyms[XkbGroup3Index]= 0; nSyms[XkbGroup4Index]= 0; nGroups= 2; } else { nGroups= 3; for (i=0;i1)&&(syms[1]==NoSymbol)&&(syms[0]!=NoSymbol)) { KeySym upper,lower; XConvertCase(syms[0],&lower,&upper); if (upper!=lower) { xkb_syms_rtrn[XKB_OFFSET(i,0)]= lower; xkb_syms_rtrn[XKB_OFFSET(i,1)]= upper; if ((protected&(1<=0;i--) { if (((empty&(1<1)&&((empty&(XkbGroup1Mask|XkbGroup2Mask))==XkbGroup2Mask)) { if ((protected&(XkbExplicitKeyType1Mask|XkbExplicitKeyType2Mask))==0) { nSyms[XkbGroup2Index]= nSyms[XkbGroup1Index]; types_inout[XkbGroup2Index]= types_inout[XkbGroup1Index]; memcpy((char *)&xkb_syms_rtrn[2],(char *)xkb_syms_rtrn, 2*sizeof(KeySym)); } else if (types_inout[XkbGroup1Index]==types_inout[XkbGroup2Index]) { memcpy((char *)&xkb_syms_rtrn[nSyms[XkbGroup1Index]], (char *)xkb_syms_rtrn, nSyms[XkbGroup1Index]*sizeof(KeySym)); } } /* step 7: check for all groups identical or all width 1 */ if (nGroups>1) { Bool sameType,allOneLevel; allOneLevel= (xkb->map->types[types_inout[0]].num_levels==1); for (i=1,sameType=True;(allOneLevel||sameType)&&(imap->types[types_inout[i]].num_levels==1); } if ((sameType)&& (!(protected&(XkbExplicitKeyTypesMask&~XkbExplicitKeyType1Mask)))){ register int s; Bool identical; for (i=1,identical=True;identical&&(i1)) { KeySym *syms; syms= &xkb_syms_rtrn[nSyms[XkbGroup1Index]]; nSyms[XkbGroup1Index]= 1; for (i=1;icompat->sym_interpret; for (i=0;icompat->num_si;i++,interp++) { if ((interp->sym==NoSymbol)||(sym==interp->sym)) { int match; if ((level==0)||((interp->match&XkbSI_LevelOneOnly)==0)) mods= real_mods; else mods= 0; switch (interp->match&XkbSI_OpMask) { case XkbSI_NoneOf: match= ((interp->mods&mods)==0); break; case XkbSI_AnyOfOrNone: match= ((mods==0)||((interp->mods&mods)!=0)); break; case XkbSI_AnyOf: match= ((interp->mods&mods)!=0); break; case XkbSI_AllOf: match= ((interp->mods&mods)==interp->mods); break; case XkbSI_Exactly: match= (interp->mods==mods); break; default: match= 0; break; } if (match) { if (interp->sym!=NoSymbol) { return interp; } else if (rtrn==NULL) { rtrn= interp; } } } } return rtrn; } static void _XkbAddKeyChange(KeyCode *pFirst,unsigned char *pNum,KeyCode newKey) { KeyCode last; last= (*pFirst)+(*pNum); if (newKey<*pFirst) { *pFirst= newKey; *pNum= (last-newKey)+1; } else if (newKey>last) { *pNum= (last-*pFirst)+1; } return; } static void _XkbSetActionKeyMods(XkbDescPtr xkb,XkbAction *act,unsigned mods) { unsigned tmp; switch (act->type) { case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods: if (act->mods.flags&XkbSA_UseModMapMods) act->mods.real_mods= act->mods.mask= mods; if ((tmp= XkbModActionVMods(&act->mods))!=0) { XkbVirtualModsToReal(xkb,tmp,&tmp); act->mods.mask|= tmp; } break; case XkbSA_ISOLock: if (act->iso.flags&XkbSA_UseModMapMods) act->iso.real_mods= act->iso.mask= mods; if ((tmp= XkbModActionVMods(&act->iso))!=0) { XkbVirtualModsToReal(xkb,tmp,&tmp); act->iso.mask|= tmp; } break; } return; } #define IBUF_SIZE 8 Bool XkbApplyCompatMapToKey(XkbDescPtr xkb,KeyCode key,XkbChangesPtr changes) { KeySym * syms; unsigned char explicit,mods; XkbSymInterpretPtr *interps,ibuf[IBUF_SIZE]; int n,nSyms,found; unsigned changed,tmp; if ((!xkb)||(!xkb->map)||(!xkb->map->key_sym_map)|| (!xkb->compat)||(!xkb->compat->sym_interpret)|| (keymin_key_code)||(key>xkb->max_key_code)) { return False; } if (((!xkb->server)||(!xkb->server->key_acts))&& (XkbAllocServerMap(xkb,XkbAllServerInfoMask,0)!=Success)) { return False; } changed= 0; /* keeps track of what has changed in _this_ call */ explicit= xkb->server->explicit[key]; if (explicit&XkbExplicitInterpretMask) /* nothing to do */ return True; mods= (xkb->map->modmap?xkb->map->modmap[key]:0); nSyms= XkbKeyNumSyms(xkb,key); syms= XkbKeySymsPtr(xkb,key); if (nSyms>IBUF_SIZE) { interps= _XkbTypedCalloc(nSyms,XkbSymInterpretPtr); if (interps==NULL) { interps= ibuf; nSyms= IBUF_SIZE; } } else { interps= ibuf; } found= 0; for (n=0;nact.type!=XkbSA_NoAction) found++; else interps[n]= NULL; } } /* 1/28/96 (ef) -- XXX! WORKING HERE */ if (!found) { if (xkb->server->key_acts[key]!=0) { xkb->server->key_acts[key]= 0; changed|= XkbKeyActionsMask; } } else { XkbAction *pActs; unsigned int new_vmodmask; changed|= XkbKeyActionsMask; pActs= XkbResizeKeyActions(xkb,key,nSyms); if (!pActs) { if (nSyms > IBUF_SIZE) free(interps); return False; } new_vmodmask= 0; for (n=0;nact); if ((n==0)||((interps[n]->match&XkbSI_LevelOneOnly)==0)) { effMods= mods; if (interps[n]->virtual_mod!=XkbNoModifier) new_vmodmask|= (1<virtual_mod); } else effMods= 0; _XkbSetActionKeyMods(xkb,&pActs[n],effMods); } else pActs[n].type= XkbSA_NoAction; } if (((explicit&XkbExplicitVModMapMask)==0)&& (xkb->server->vmodmap[key]!=new_vmodmask)) { changed|= XkbVirtualModMapMask; xkb->server->vmodmap[key]= new_vmodmask; } if (interps[0]) { if ((interps[0]->flags&XkbSI_LockingKey)&& ((explicit&XkbExplicitBehaviorMask)==0)) { xkb->server->behaviors[key].type= XkbKB_Lock; changed|= XkbKeyBehaviorsMask; } if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) { CARD8 old; old= xkb->ctrls->per_key_repeat[key/8]; if (interps[0]->flags&XkbSI_AutoRepeat) xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8)); else xkb->ctrls->per_key_repeat[key/8]&= ~(1<<(key%8)); if (changes && (old!=xkb->ctrls->per_key_repeat[key/8])) changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask; } } } if ((!found)||(interps[0]==NULL)) { if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) { CARD8 old; old= xkb->ctrls->per_key_repeat[key/8]; xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8)); if (changes && (old!=xkb->ctrls->per_key_repeat[key/8])) changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask; } if (((explicit&XkbExplicitBehaviorMask)==0)&& (xkb->server->behaviors[key].type==XkbKB_Lock)) { xkb->server->behaviors[key].type= XkbKB_Default; changed|= XkbKeyBehaviorsMask; } } if (changes) { XkbMapChangesPtr mc; mc= &changes->map; tmp= (changed&mc->changed); if (tmp&XkbKeyActionsMask) _XkbAddKeyChange(&mc->first_key_act,&mc->num_key_acts,key); else if (changed&XkbKeyActionsMask) { mc->changed|= XkbKeyActionsMask; mc->first_key_act= key; mc->num_key_acts= 1; } if (tmp&XkbKeyBehaviorsMask) { _XkbAddKeyChange(&mc->first_key_behavior,&mc->num_key_behaviors, key); } else if (changed&XkbKeyBehaviorsMask) { mc->changed|= XkbKeyBehaviorsMask; mc->first_key_behavior= key; mc->num_key_behaviors= 1; } if (tmp&XkbVirtualModMapMask) _XkbAddKeyChange(&mc->first_vmodmap_key,&mc->num_vmodmap_keys,key); else if (changed&XkbVirtualModMapMask) { mc->changed|= XkbVirtualModMapMask; mc->first_vmodmap_key= key; mc->num_vmodmap_keys= 1; } mc->changed|= changed; } if (interps!=ibuf) _XkbFree(interps); return True; } Status XkbChangeTypesOfKey( XkbDescPtr xkb, int key, int nGroups, unsigned groups, int * newTypesIn, XkbMapChangesPtr changes) { XkbKeyTypePtr pOldType,pNewType; register int i; int width,nOldGroups,oldWidth,newTypes[XkbNumKbdGroups]; if ((!xkb) || (!XkbKeycodeInRange(xkb,key)) || (!xkb->map) || (!xkb->map->types)||(!newTypesIn)||((groups&XkbAllGroupsMask)==0)|| (nGroups>XkbNumKbdGroups)) { return BadMatch; } if (nGroups==0) { for (i=0;imap->key_sym_map[key].kt_index[i]= XkbOneLevelIndex; } i= xkb->map->key_sym_map[key].group_info; i= XkbSetNumGroups(i,0); xkb->map->key_sym_map[key].group_info= i; XkbResizeKeySyms(xkb,key,0); return Success; } nOldGroups= XkbKeyNumGroups(xkb,key); oldWidth= XkbKeyGroupsWidth(xkb,key); for (width=i=0;i0) newTypes[i]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index); else newTypes[i]= XkbTwoLevelIndex; if (newTypes[i]>xkb->map->num_types) return BadMatch; pNewType= &xkb->map->types[newTypes[i]]; if (pNewType->num_levels>width) width= pNewType->num_levels; } if ((xkb->ctrls)&&(nGroups>xkb->ctrls->num_groups)) xkb->ctrls->num_groups= nGroups; if ((width!=oldWidth)||(nGroups!=nOldGroups)) { KeySym oldSyms[XkbMaxSymsPerKey],*pSyms; int nCopy; if (nOldGroups==0) { pSyms= XkbResizeKeySyms(xkb,key,width*nGroups); if (pSyms!=NULL) { i= xkb->map->key_sym_map[key].group_info; i= XkbSetNumGroups(i,nGroups); xkb->map->key_sym_map[key].group_info= i; xkb->map->key_sym_map[key].width= width; for (i=0;imap->key_sym_map[key].kt_index[i]= newTypes[i]; } return Success; } return BadAlloc; } pSyms= XkbKeySymsPtr(xkb,key); memcpy(oldSyms,pSyms,XkbKeyNumSyms(xkb,key)*sizeof(KeySym)); pSyms= XkbResizeKeySyms(xkb,key,width*nGroups); if (pSyms==NULL) return BadAlloc; bzero(pSyms,width*nGroups*sizeof(KeySym)); for (i=0;(imap->types[newTypes[i]]; if (pNewType->num_levels>pOldType->num_levels) nCopy= pOldType->num_levels; else nCopy= pNewType->num_levels; memcpy(&pSyms[i*width],&oldSyms[i*oldWidth],nCopy*sizeof(KeySym)); } if (XkbKeyHasActions(xkb,key)) { XkbAction oldActs[XkbMaxSymsPerKey],*pActs; pActs= XkbKeyActionsPtr(xkb,key); memcpy(oldActs,pActs,XkbKeyNumSyms(xkb,key)*sizeof(XkbAction)); pActs= XkbResizeKeyActions(xkb,key,width*nGroups); if (pActs==NULL) return BadAlloc; bzero(pActs,width*nGroups*sizeof(XkbAction)); for (i=0;(imap->types[newTypes[i]]; if (pNewType->num_levels>pOldType->num_levels) nCopy= pOldType->num_levels; else nCopy= pNewType->num_levels; memcpy(&pActs[i*width],&oldActs[i*oldWidth], nCopy*sizeof(XkbAction)); } } i= xkb->map->key_sym_map[key].group_info; i= XkbSetNumGroups(i,nGroups); xkb->map->key_sym_map[key].group_info= i; xkb->map->key_sym_map[key].width= width; } width= 0; for (i=0;imap->key_sym_map[key].kt_index[i]= newTypes[i]; if (xkb->map->types[newTypes[i]].num_levels>width) width= xkb->map->types[newTypes[i]].num_levels; } xkb->map->key_sym_map[key].width= width; if (changes!=NULL) { if (changes->changed&XkbKeySymsMask) { _XkbAddKeyChange(&changes->first_key_sym,&changes->num_key_syms, key); } else { changes->changed|= XkbKeySymsMask; changes->first_key_sym= key; changes->num_key_syms= 1; } } return Success; } /***====================================================================***/ Bool XkbVirtualModsToReal(XkbDescPtr xkb,unsigned virtual_mask,unsigned *mask_rtrn) { register int i,bit; register unsigned mask; if (xkb==NULL) return False; if (virtual_mask==0) { *mask_rtrn= 0; return True; } if (xkb->server==NULL) return False; for (i=mask=0,bit=1;iserver->vmods[i]; } *mask_rtrn= mask; return True; } /***====================================================================***/ static Bool XkbUpdateActionVirtualMods(XkbDescPtr xkb,XkbAction *act,unsigned changed) { unsigned int tmp; switch (act->type) { case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods: if (((tmp= XkbModActionVMods(&act->mods))&changed)!=0) { XkbVirtualModsToReal(xkb,tmp,&tmp); act->mods.mask= act->mods.real_mods; act->mods.mask|= tmp; return True; } break; case XkbSA_ISOLock: if ((((tmp= XkbModActionVMods(&act->iso))!=0)&changed)!=0) { XkbVirtualModsToReal(xkb,tmp,&tmp); act->iso.mask= act->iso.real_mods; act->iso.mask|= tmp; return True; } break; } return False; } static void XkbUpdateKeyTypeVirtualMods( XkbDescPtr xkb, XkbKeyTypePtr type, unsigned int changed, XkbChangesPtr changes) { register unsigned int i; unsigned int mask = 0; XkbVirtualModsToReal(xkb,type->mods.vmods,&mask); type->mods.mask= type->mods.real_mods|mask; if ((type->map_count>0)&&(type->mods.vmods!=0)) { XkbKTMapEntryPtr entry; for (i=0,entry=type->map;imap_count;i++,entry++) { if (entry->mods.vmods!=0) { XkbVirtualModsToReal(xkb,entry->mods.vmods,&mask); entry->mods.mask=entry->mods.real_mods|mask; /* entry is active if vmods are bound*/ entry->active= (mask!=0); } else entry->active= 1; } } if (changes) { int type_ndx; type_ndx= type-xkb->map->types; if ((type_ndx<0)||(type_ndx>xkb->map->num_types)) return; if (changes->map.changed&XkbKeyTypesMask) { int last; last= changes->map.first_type+changes->map.num_types-1; if (type_ndxmap.first_type) { changes->map.first_type= type_ndx; changes->map.num_types= (last-type_ndx)+1; } else if (type_ndx>last) { changes->map.num_types= (type_ndx-changes->map.first_type)+1; } } else { changes->map.changed|= XkbKeyTypesMask; changes->map.first_type= type_ndx; changes->map.num_types= 1; } } return; } Bool XkbApplyVirtualModChanges(XkbDescPtr xkb,unsigned changed,XkbChangesPtr changes) { register int i; unsigned int checkState = 0; if ((!xkb) || (!xkb->map) || (changed==0)) return False; for (i=0;imap->num_types;i++) { if (xkb->map->types[i].mods.vmods & changed) XkbUpdateKeyTypeVirtualMods(xkb,&xkb->map->types[i],changed,changes); } if (changed&xkb->ctrls->internal.vmods) { unsigned int newMask = 0; XkbVirtualModsToReal(xkb,xkb->ctrls->internal.vmods,&newMask); newMask|= xkb->ctrls->internal.real_mods; if (xkb->ctrls->internal.mask!=newMask) { xkb->ctrls->internal.mask= newMask; if (changes) { changes->ctrls.changed_ctrls|= XkbInternalModsMask; checkState= True; } } } if (changed&xkb->ctrls->ignore_lock.vmods) { unsigned int newMask = 0; XkbVirtualModsToReal(xkb,xkb->ctrls->ignore_lock.vmods,&newMask); newMask|= xkb->ctrls->ignore_lock.real_mods; if (xkb->ctrls->ignore_lock.mask!=newMask) { xkb->ctrls->ignore_lock.mask= newMask; if (changes) { changes->ctrls.changed_ctrls|= XkbIgnoreLockModsMask; checkState= True; } } } if (xkb->indicators!=NULL) { XkbIndicatorMapPtr map; map= &xkb->indicators->maps[0]; for (i=0;imods.vmods&changed) { unsigned int newMask = 0; XkbVirtualModsToReal(xkb,map->mods.vmods,&newMask); newMask|= map->mods.real_mods; if (newMask!=map->mods.mask) { map->mods.mask= newMask; if (changes) { changes->indicators.map_changes|= (1<compat!=NULL) { XkbCompatMapPtr compat; compat= xkb->compat; for (i=0;igroups[i].vmods,&newMask); newMask|= compat->groups[i].real_mods; if (compat->groups[i].mask!=newMask) { compat->groups[i].mask= newMask; if (changes) { changes->compat.changed_groups|= (1<map && xkb->server) { int highChange = 0, lowChange = -1; for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) { if (XkbKeyHasActions(xkb,i)) { register XkbAction *pAct; register int n; pAct= XkbKeyActionsPtr(xkb,i); for (n=XkbKeyNumActions(xkb,i);n>0;n--,pAct++) { if ((pAct->type!=XkbSA_NoAction)&& XkbUpdateActionVirtualMods(xkb,pAct,changed)) { if (lowChange<0) lowChange= i; highChange= i; } } } } if (changes && (lowChange>0)) { /* something changed */ if (changes->map.changed&XkbKeyActionsMask) { int last; if (changes->map.first_key_actmap.first_key_act; last= changes->map.first_key_act+changes->map.num_key_acts-1; if (last>highChange) highChange= last; } changes->map.changed|= XkbKeyActionsMask; changes->map.first_key_act= lowChange; changes->map.num_key_acts= (highChange-lowChange)+1; } } return checkState; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkbout.c0000644000000000000000000007327113614532331017051 0ustar /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include #include #include "misc.h" #include "inputstr.h" #include "dix.h" #include "xkbstr.h" #include #include "xkbgeom.h" #include #define VMOD_HIDE_VALUE 0 #define VMOD_SHOW_VALUE 1 #define VMOD_COMMENT_VALUE 2 static Bool WriteXKBVModDecl(FILE *file,Display *dpy,XkbDescPtr xkb,int showValue) { register int i,nMods; Atom * vmodNames; if (xkb==NULL) return False; if (xkb->names!=NULL) vmodNames= xkb->names->vmods; else vmodNames= NULL; for (i=nMods=0;iserver)&&(xkb->server->vmods[i]!=XkbNoModifierMask)) { if (showValue==VMOD_COMMENT_VALUE) { fprintf(file,"/* = %s */", XkbModMaskText(xkb->server->vmods[i],XkbXKBFile)); } else { fprintf(file,"= %s", XkbModMaskText(xkb->server->vmods[i],XkbXKBFile)); } } nMods++; } } if (nMods>0) fprintf(file,";\n\n"); return True; } /***====================================================================***/ static Bool WriteXKBAction(FILE *file,XkbFileInfo *result,XkbAnyAction *action) { XkbDescPtr xkb; Display * dpy; xkb= result->xkb; dpy= xkb->dpy; fprintf(file,"%s",XkbActionText(dpy,xkb,(XkbAction *)action,XkbXKBFile)); return True; } /***====================================================================***/ Bool XkbWriteXKBKeycodes( FILE * file, XkbFileInfo * result, Bool topLevel, Bool showImplicit, XkbFileAddOnFunc addOn, void * priv) { Atom kcName; register unsigned i; XkbDescPtr xkb; Display * dpy; char * alternate; xkb= result->xkb; dpy= xkb->dpy; if ((!xkb)||(!xkb->names)||(!xkb->names->keys)) { _XkbLibError(_XkbErrMissingNames,"XkbWriteXKBKeycodes",0); return False; } kcName= xkb->names->keycodes; if (kcName!=None) fprintf(file,"xkb_keycodes \"%s\" {\n", XkbAtomText(dpy,kcName,XkbXKBFile)); else fprintf(file,"xkb_keycodes {\n"); fprintf(file," minimum = %d;\n",xkb->min_key_code); fprintf(file," maximum = %d;\n",xkb->max_key_code); for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) { if (xkb->names->keys[i].name[0]!='\0') { if (XkbFindKeycodeByName(xkb,xkb->names->keys[i].name,True)!=i) alternate= "alternate "; else alternate= ""; fprintf(file," %s%6s = %d;\n",alternate, XkbKeyNameText(xkb->names->keys[i].name,XkbXKBFile), i); } } if (xkb->indicators!=NULL) { for (i=0;iindicators->phys_indicators&(1<names->indicators[i]!=None) { fprintf(file,"%sindicator %d = \"%s\";\n",type,i+1, XkbAtomText(dpy,xkb->names->indicators[i],XkbXKBFile)); } } } if (xkb->names->key_aliases!=NULL) { XkbKeyAliasPtr pAl; pAl= xkb->names->key_aliases; for (i=0;inames->num_key_aliases;i++,pAl++) { fprintf(file," alias %6s = %6s;\n", XkbKeyNameText(pAl->alias,XkbXKBFile), XkbKeyNameText(pAl->real,XkbXKBFile)); } } if (addOn) (*addOn)(file,result,topLevel,showImplicit,XkmKeyNamesIndex,priv); fprintf(file,"};\n\n"); return True; } Bool XkbWriteXKBKeyTypes( FILE * file, XkbFileInfo * result, Bool topLevel, Bool showImplicit, XkbFileAddOnFunc addOn, void * priv) { Display * dpy; register unsigned i,n; XkbKeyTypePtr type; XkbKTMapEntryPtr entry; XkbDescPtr xkb; xkb= result->xkb; dpy= xkb->dpy; if ((!xkb)||(!xkb->map)||(!xkb->map->types)) { _XkbLibError(_XkbErrMissingTypes,"XkbWriteXKBKeyTypes",0); return False; } if (xkb->map->num_typesnames==NULL)||(xkb->names->types==None)) fprintf(file,"xkb_types {\n\n"); else fprintf(file,"xkb_types \"%s\" {\n\n", XkbAtomText(dpy,xkb->names->types,XkbXKBFile)); WriteXKBVModDecl(file,dpy,xkb, (showImplicit?VMOD_COMMENT_VALUE:VMOD_HIDE_VALUE)); type= xkb->map->types; for (i=0;imap->num_types;i++,type++) { fprintf(file," type \"%s\" {\n", XkbAtomText(dpy,type->name,XkbXKBFile)); fprintf(file," modifiers= %s;\n", XkbVModMaskText(dpy,xkb,type->mods.real_mods,type->mods.vmods, XkbXKBFile)); entry= type->map; for (n=0;nmap_count;n++,entry++) { char *str; str=XkbVModMaskText(dpy,xkb,entry->mods.real_mods,entry->mods.vmods, XkbXKBFile); fprintf(file," map[%s]= Level%d;\n",str,entry->level+1); if ((type->preserve)&&((type->preserve[n].real_mods)|| (type->preserve[n].vmods))) { fprintf(file," preserve[%s]= ",str); fprintf(file,"%s;\n",XkbVModMaskText(dpy,xkb, type->preserve[n].real_mods, type->preserve[n].vmods, XkbXKBFile)); } } if (type->level_names!=NULL) { Atom *name= type->level_names; for (n=0;nnum_levels;n++,name++) { if ((*name)==None) continue; fprintf(file," level_name[Level%d]= \"%s\";\n",n+1, XkbAtomText(dpy,*name,XkbXKBFile)); } } fprintf(file," };\n"); } if (addOn) (*addOn)(file,result,topLevel,showImplicit,XkmTypesIndex,priv); fprintf(file,"};\n\n"); return True; } static Bool WriteXKBIndicatorMap( FILE * file, XkbFileInfo * result, Atom name, XkbIndicatorMapPtr led, XkbFileAddOnFunc addOn, void * priv) { XkbDescPtr xkb; xkb= result->xkb; fprintf(file," indicator \"%s\" {\n",NameForAtom(name)); if (led->flags&XkbIM_NoExplicit) fprintf(file," !allowExplicit;\n"); if (led->flags&XkbIM_LEDDrivesKB) fprintf(file," indicatorDrivesKeyboard;\n"); if (led->which_groups!=0) { if (led->which_groups!=XkbIM_UseEffective) { fprintf(file," whichGroupState= %s;\n", XkbIMWhichStateMaskText(led->which_groups,XkbXKBFile)); } fprintf(file," groups= 0x%02x;\n",led->groups); } if (led->which_mods!=0) { if (led->which_mods!=XkbIM_UseEffective) { fprintf(file," whichModState= %s;\n", XkbIMWhichStateMaskText(led->which_mods,XkbXKBFile)); } fprintf(file," modifiers= %s;\n", XkbVModMaskText(xkb->dpy,xkb, led->mods.real_mods,led->mods.vmods, XkbXKBFile)); } if (led->ctrls!=0) { fprintf(file," controls= %s;\n", XkbControlsMaskText(led->ctrls,XkbXKBFile)); } if (addOn) (*addOn)(file,result,False,True,XkmIndicatorsIndex,priv); fprintf(file," };\n"); return True; } Bool XkbWriteXKBCompatMap( FILE * file, XkbFileInfo * result, Bool topLevel, Bool showImplicit, XkbFileAddOnFunc addOn, void * priv) { Display * dpy; register unsigned i; XkbSymInterpretPtr interp; XkbDescPtr xkb; xkb= result->xkb; dpy= xkb->dpy; if ((!xkb)||(!xkb->compat)||(!xkb->compat->sym_interpret)) { _XkbLibError(_XkbErrMissingCompatMap,"XkbWriteXKBCompatMap",0); return False; } if ((xkb->names==NULL)||(xkb->names->compat==None)) fprintf(file,"xkb_compatibility {\n\n"); else fprintf(file,"xkb_compatibility \"%s\" {\n\n", XkbAtomText(dpy,xkb->names->compat,XkbXKBFile)); WriteXKBVModDecl(file,dpy,xkb, (showImplicit?VMOD_COMMENT_VALUE:VMOD_HIDE_VALUE)); fprintf(file," interpret.useModMapMods= AnyLevel;\n"); fprintf(file," interpret.repeat= False;\n"); fprintf(file," interpret.locking= False;\n"); interp= xkb->compat->sym_interpret; for (i=0;icompat->num_si;i++,interp++) { fprintf(file," interpret %s+%s(%s) {\n", ((interp->sym==NoSymbol)?"Any": XkbKeysymText(interp->sym,XkbXKBFile)), XkbSIMatchText(interp->match,XkbXKBFile), XkbModMaskText(interp->mods,XkbXKBFile)); if (interp->virtual_mod!=XkbNoModifier) { fprintf(file," virtualModifier= %s;\n", XkbVModIndexText(dpy,xkb,interp->virtual_mod,XkbXKBFile)); } if (interp->match&XkbSI_LevelOneOnly) fprintf(file," useModMapMods=level1;\n"); if (interp->flags&XkbSI_LockingKey) fprintf(file," locking= True;\n"); if (interp->flags&XkbSI_AutoRepeat) fprintf(file," repeat= True;\n"); fprintf(file," action= "); WriteXKBAction(file,result,&interp->act); fprintf(file,";\n"); fprintf(file," };\n"); } for (i=0;icompat->groups[i]; if ((gc->real_mods==0)&&(gc->vmods==0)) continue; fprintf(file," group %d = %s;\n",i+1,XkbVModMaskText(xkb->dpy,xkb, gc->real_mods,gc->vmods, XkbXKBFile)); } if (xkb->indicators) { for (i=0;iindicators->maps[i]; if ((map->flags!=0)||(map->which_groups!=0)||(map->groups!=0)|| (map->which_mods!=0)|| (map->mods.real_mods!=0)||(map->mods.vmods!=0)|| (map->ctrls!=0)) { WriteXKBIndicatorMap(file,result,xkb->names->indicators[i],map, addOn,priv); } } } if (addOn) (*addOn)(file,result,topLevel,showImplicit,XkmCompatMapIndex,priv); fprintf(file,"};\n\n"); return True; } Bool XkbWriteXKBSymbols( FILE * file, XkbFileInfo * result, Bool topLevel, Bool showImplicit, XkbFileAddOnFunc addOn, void * priv) { Display * dpy; register unsigned i,tmp; XkbDescPtr xkb; XkbClientMapPtr map; XkbServerMapPtr srv; Bool showActions; xkb= result->xkb; map= xkb->map; srv= xkb->server; dpy= xkb->dpy; if ((!xkb)||(!map)||(!map->syms)||(!map->key_sym_map)) { _XkbLibError(_XkbErrMissingSymbols,"XkbWriteXKBSymbols",0); return False; } if ((!xkb->names)||(!xkb->names->keys)) { _XkbLibError(_XkbErrMissingNames,"XkbWriteXKBSymbols",0); return False; } if ((xkb->names==NULL)||(xkb->names->symbols==None)) fprintf(file,"xkb_symbols {\n\n"); else fprintf(file,"xkb_symbols \"%s\" {\n\n", XkbAtomText(dpy,xkb->names->symbols,XkbXKBFile)); for (tmp=i=0;inames->groups[i]!=None) { fprintf(file," name[group%d]=\"%s\";\n",i+1, XkbAtomText(dpy,xkb->names->groups[i],XkbXKBFile)); tmp++; } } if (tmp>0) fprintf(file,"\n"); for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) { Bool simple; if ((int)XkbKeyNumSyms(xkb,i)<1) continue; if (XkbFindKeycodeByName(xkb,xkb->names->keys[i].name,True)!=i) continue; simple= True; fprintf(file," key %6s {", XkbKeyNameText(xkb->names->keys[i].name,XkbXKBFile)); if (srv->explicit) { if (((srv->explicit[i]&XkbExplicitKeyTypesMask)!=0)|| (showImplicit)) { int typeNdx,g; Bool multi; char * comment=" "; if ((srv->explicit[i]&XkbExplicitKeyTypesMask)==0) comment= "//"; multi= False; typeNdx= XkbKeyKeyTypeIndex(xkb,i,0); for (g=1;(gexplicit[i]&(1<types[typeNdx].name, XkbXKBFile)); } else if (showImplicit) { fprintf(file,"\n// type[group%d]= \"%s\",",g+1, XkbAtomText(dpy,map->types[typeNdx].name, XkbXKBFile)); } } } else { fprintf(file,"\n%s type= \"%s\",",comment, XkbAtomText(dpy,map->types[typeNdx].name, XkbXKBFile)); } simple= False; } if (((srv->explicit[i]&XkbExplicitAutoRepeatMask)!=0)&& (xkb->ctrls!=NULL)) { if (xkb->ctrls->per_key_repeat[i/8]&(1<<(i%8))) fprintf(file,"\n repeat= Yes,"); else fprintf(file,"\n repeat= No,"); simple= False; } if ((xkb->server!=NULL)&&(xkb->server->vmodmap!=NULL)&& (xkb->server->vmodmap[i]!=0)) { if ((srv->explicit[i]&XkbExplicitVModMapMask)!=0) { fprintf(file,"\n virtualMods= %s,", XkbVModMaskText(dpy,xkb,0, xkb->server->vmodmap[i], XkbXKBFile)); } else if (showImplicit) { fprintf(file,"\n// virtualMods= %s,", XkbVModMaskText(dpy,xkb,0, xkb->server->vmodmap[i], XkbXKBFile)); } } } switch (XkbOutOfRangeGroupAction(XkbKeyGroupInfo(xkb,i))) { case XkbClampIntoRange: fprintf(file,"\n groupsClamp,"); break; case XkbRedirectIntoRange: fprintf(file,"\n groupsRedirect= Group%d,", XkbOutOfRangeGroupNumber(XkbKeyGroupInfo(xkb,i))+1); break; } if (srv->behaviors!=NULL) { unsigned type; type= srv->behaviors[i].type&XkbKB_OpMask; if (type!=XkbKB_Default) { simple= False; fprintf(file,"\n %s,", XkbBehaviorText(xkb,&srv->behaviors[i],XkbXKBFile)); } } if ((srv->explicit==NULL) || showImplicit || ((srv->explicit[i]&XkbExplicitInterpretMask)!=0)) showActions= XkbKeyHasActions(xkb,i); else showActions= False; if (((unsigned)XkbKeyNumGroups(xkb,i)>1)||showActions) simple= False; if (simple) { KeySym *syms; unsigned s; syms= XkbKeySymsPtr(xkb,i); fprintf(file," [ "); for (s=0;smodmap) { for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) { if (map->modmap[i]!=0) { register int n,bit; for (bit=1,n=0;nmodmap[i]&bit) { char buf[5]; memcpy(buf,xkb->names->keys[i].name,4); buf[4]= '\0'; fprintf(file," modifier_map %s { <%s> };\n", XkbModIndexText(n,XkbXKBFile),buf); } } } } } if (addOn) (*addOn)(file,result,topLevel,showImplicit,XkmSymbolsIndex,priv); fprintf(file,"};\n\n"); return True; } static Bool WriteXKBOutline( FILE * file, XkbShapePtr shape, XkbOutlinePtr outline, int lastRadius, int first, int indent) { register int i; XkbPointPtr pt; char * iStr; fprintf(file,"%s",iStr= XkbIndentText(first)); if (first!=indent) iStr= XkbIndentText(indent); if (outline->corner_radius!=lastRadius) { fprintf(file,"corner= %s,", XkbGeomFPText(outline->corner_radius,XkbMessage)); if (shape!=NULL) { fprintf(file,"\n%s",iStr); } } if (shape) { if (outline==shape->approx) fprintf(file,"approx= "); else if (outline==shape->primary) fprintf(file,"primary= "); } fprintf(file,"{"); for (pt=outline->points,i=0;inum_points;i++,pt++) { if (i==0) fprintf(file," "); else if ((i%4)==0) fprintf(file,",\n%s ",iStr); else fprintf(file,", "); fprintf(file,"[ %3s, %3s ]",XkbGeomFPText(pt->x,XkbXKBFile), XkbGeomFPText(pt->y,XkbXKBFile)); } fprintf(file," }"); return True; } static Bool WriteXKBDoodad( FILE * file, Display * dpy, unsigned indent, XkbGeometryPtr geom, XkbDoodadPtr doodad) { register char * i_str; XkbShapePtr shape; XkbColorPtr color; i_str= XkbIndentText(indent); fprintf(file,"%s%s \"%s\" {\n",i_str, XkbDoodadTypeText(doodad->any.type,XkbMessage), XkbAtomText(dpy,doodad->any.name,XkbMessage)); fprintf(file,"%s top= %s;\n",i_str, XkbGeomFPText(doodad->any.top,XkbXKBFile)); fprintf(file,"%s left= %s;\n",i_str, XkbGeomFPText(doodad->any.left,XkbXKBFile)); fprintf(file,"%s priority= %d;\n",i_str,doodad->any.priority); switch (doodad->any.type) { case XkbOutlineDoodad: case XkbSolidDoodad: if (doodad->shape.angle!=0) { fprintf(file,"%s angle= %s;\n",i_str, XkbGeomFPText(doodad->shape.angle,XkbXKBFile)); } if (doodad->shape.color_ndx!=0) { fprintf(file,"%s color= \"%s\";\n",i_str, XkbShapeDoodadColor(geom,&doodad->shape)->spec); } shape= XkbShapeDoodadShape(geom,&doodad->shape); fprintf(file,"%s shape= \"%s\";\n",i_str, XkbAtomText(dpy,shape->name,XkbXKBFile)); break; case XkbTextDoodad: if (doodad->text.angle!=0) { fprintf(file,"%s angle= %s;\n",i_str, XkbGeomFPText(doodad->text.angle,XkbXKBFile)); } if (doodad->text.width!=0) { fprintf(file,"%s width= %s;\n",i_str, XkbGeomFPText(doodad->text.width,XkbXKBFile)); } if (doodad->text.height!=0) { fprintf(file,"%s height= %s;\n",i_str, XkbGeomFPText(doodad->text.height,XkbXKBFile)); } if (doodad->text.color_ndx!=0) { color= XkbTextDoodadColor(geom,&doodad->text); fprintf(file,"%s color= \"%s\";\n",i_str, XkbStringText(color->spec,XkbXKBFile)); } fprintf(file,"%s XFont= \"%s\";\n",i_str, XkbStringText(doodad->text.font,XkbXKBFile)); fprintf(file,"%s text= \"%s\";\n",i_str, XkbStringText(doodad->text.text,XkbXKBFile)); break; case XkbIndicatorDoodad: shape= XkbIndicatorDoodadShape(geom,&doodad->indicator); color= XkbIndicatorDoodadOnColor(geom,&doodad->indicator); fprintf(file,"%s onColor= \"%s\";\n",i_str, XkbStringText(color->spec,XkbXKBFile)); color= XkbIndicatorDoodadOffColor(geom,&doodad->indicator); fprintf(file,"%s offColor= \"%s\";\n",i_str, XkbStringText(color->spec,XkbXKBFile)); fprintf(file,"%s shape= \"%s\";\n",i_str, XkbAtomText(dpy,shape->name,XkbXKBFile)); break; case XkbLogoDoodad: fprintf(file,"%s logoName= \"%s\";\n",i_str, XkbStringText(doodad->logo.logo_name,XkbXKBFile)); if (doodad->shape.angle!=0) { fprintf(file,"%s angle= %s;\n",i_str, XkbGeomFPText(doodad->logo.angle,XkbXKBFile)); } if (doodad->shape.color_ndx!=0) { fprintf(file,"%s color= \"%s\";\n",i_str, XkbLogoDoodadColor(geom,&doodad->logo)->spec); } shape= XkbLogoDoodadShape(geom,&doodad->logo); fprintf(file,"%s shape= \"%s\";\n",i_str, XkbAtomText(dpy,shape->name,XkbXKBFile)); break; } fprintf(file,"%s};\n",i_str); return True; } /*ARGSUSED*/ static Bool WriteXKBOverlay( FILE * file, Display * dpy, unsigned indent, XkbGeometryPtr geom, XkbOverlayPtr ol) { register char * i_str; int r,k,nOut; XkbOverlayRowPtr row; XkbOverlayKeyPtr key; i_str= XkbIndentText(indent); if (ol->name!=None) { fprintf(file,"%soverlay \"%s\" {\n",i_str, XkbAtomText(dpy,ol->name,XkbMessage)); } else fprintf(file,"%soverlay {\n",i_str); for (nOut=r=0,row=ol->rows;rnum_rows;r++,row++) { for (k=0,key=row->keys;knum_keys;k++,key++) { char *over,*under; over= XkbKeyNameText(key->over.name,XkbXKBFile); under= XkbKeyNameText(key->under.name,XkbXKBFile); if (nOut==0) fprintf(file,"%s %6s=%6s",i_str,under,over); else if ((nOut%4)==0) fprintf(file,",\n%s %6s=%6s",i_str,under,over); else fprintf(file,", %6s=%6s",under,over); nOut++; } } fprintf(file,"\n%s};\n",i_str); return True; } static Bool WriteXKBSection( FILE * file, Display * dpy, XkbSectionPtr s, XkbGeometryPtr geom) { register int i; XkbRowPtr row; int dfltKeyColor = 0; fprintf(file," section \"%s\" {\n", XkbAtomText(dpy,s->name,XkbXKBFile)); if (s->rows&&(s->rows->num_keys>0)) { dfltKeyColor= s->rows->keys[0].color_ndx; fprintf(file," key.color= \"%s\";\n", XkbStringText(geom->colors[dfltKeyColor].spec,XkbXKBFile)); } fprintf(file," priority= %d;\n",s->priority); fprintf(file," top= %s;\n",XkbGeomFPText(s->top,XkbXKBFile)); fprintf(file," left= %s;\n",XkbGeomFPText(s->left,XkbXKBFile)); fprintf(file," width= %s;\n",XkbGeomFPText(s->width,XkbXKBFile)); fprintf(file," height= %s;\n", XkbGeomFPText(s->height,XkbXKBFile)); if (s->angle!=0) { fprintf(file," angle= %s;\n", XkbGeomFPText(s->angle,XkbXKBFile)); } for (i=0,row=s->rows;inum_rows;i++,row++) { fprintf(file," row {\n"); fprintf(file," top= %s;\n", XkbGeomFPText(row->top,XkbXKBFile)); fprintf(file," left= %s;\n", XkbGeomFPText(row->left,XkbXKBFile)); if (row->vertical) fprintf(file," vertical;\n"); if (row->num_keys>0) { register int k; register XkbKeyPtr key; int forceNL=0; int nThisLine= 0; fprintf(file," keys {\n"); for (k=0,key=row->keys;knum_keys;k++,key++) { XkbShapePtr shape; if (key->color_ndx!=dfltKeyColor) forceNL= 1; if (k==0) { fprintf(file," "); nThisLine= 0; } else if (((nThisLine%2)==1)||(forceNL)) { fprintf(file,",\n "); forceNL= nThisLine= 0; } else { fprintf(file,", "); nThisLine++; } shape= XkbKeyShape(geom,key); fprintf(file,"{ %6s, \"%s\", %3s", XkbKeyNameText(key->name.name,XkbXKBFile), XkbAtomText(dpy,shape->name,XkbXKBFile), XkbGeomFPText(key->gap,XkbXKBFile)); if (key->color_ndx!=dfltKeyColor) { fprintf(file,", color=\"%s\"",XkbKeyColor(geom,key)->spec); forceNL= 1; } fprintf(file," }"); } fprintf(file,"\n };\n"); } fprintf(file," };\n"); } if (s->doodads!=NULL) { XkbDoodadPtr doodad; for (i=0,doodad=s->doodads;inum_doodads;i++,doodad++) { WriteXKBDoodad(file,dpy,8,geom,doodad); } } if (s->overlays!=NULL) { XkbOverlayPtr ol; for (i=0,ol=s->overlays;inum_overlays;i++,ol++) { WriteXKBOverlay(file,dpy,8,geom,ol); } } fprintf(file," }; // End of \"%s\" section\n\n", XkbAtomText(dpy,s->name,XkbXKBFile)); return True; } Bool XkbWriteXKBGeometry( FILE * file, XkbFileInfo * result, Bool topLevel, Bool showImplicit, XkbFileAddOnFunc addOn, void * priv) { Display * dpy; register unsigned i,n; XkbDescPtr xkb; XkbGeometryPtr geom; xkb= result->xkb; if ((!xkb)||(!xkb->geom)) { _XkbLibError(_XkbErrMissingGeometry,"XkbWriteXKBGeometry",0); return False; } dpy= xkb->dpy; geom= xkb->geom; if (geom->name==None) fprintf(file,"xkb_geometry {\n\n"); else fprintf(file,"xkb_geometry \"%s\" {\n\n", XkbAtomText(dpy,geom->name,XkbXKBFile)); fprintf(file," width= %s;\n", XkbGeomFPText(geom->width_mm,XkbXKBFile)); fprintf(file," height= %s;\n\n", XkbGeomFPText(geom->height_mm,XkbXKBFile)); if (geom->key_aliases!=NULL) { XkbKeyAliasPtr pAl; pAl= geom->key_aliases; for (i=0;inum_key_aliases;i++,pAl++) { fprintf(file," alias %6s = %6s;\n", XkbKeyNameText(pAl->alias,XkbXKBFile), XkbKeyNameText(pAl->real,XkbXKBFile)); } fprintf(file,"\n"); } if (geom->base_color!=NULL) fprintf(file," baseColor= \"%s\";\n", XkbStringText(geom->base_color->spec,XkbXKBFile)); if (geom->label_color!=NULL) fprintf(file," labelColor= \"%s\";\n", XkbStringText(geom->label_color->spec,XkbXKBFile)); if (geom->label_font!=NULL) fprintf(file," xfont= \"%s\";\n", XkbStringText(geom->label_font,XkbXKBFile)); if ((geom->num_colors>0)&&(showImplicit)) { XkbColorPtr color; for (color=geom->colors,i=0;inum_colors;i++,color++) { fprintf(file,"// color[%d]= \"%s\"\n",i, XkbStringText(color->spec,XkbXKBFile)); } fprintf(file,"\n"); } if (geom->num_properties>0) { XkbPropertyPtr prop; for (prop=geom->properties,i=0;inum_properties;i++,prop++) { fprintf(file," %s= \"%s\";\n",prop->name, XkbStringText(prop->value,XkbXKBFile)); } fprintf(file,"\n"); } if (geom->num_shapes>0) { XkbShapePtr shape; XkbOutlinePtr outline; int lastR; for (shape=geom->shapes,i=0;inum_shapes;i++,shape++) { lastR=0; fprintf(file," shape \"%s\" {", XkbAtomText(dpy,shape->name,XkbXKBFile)); outline= shape->outlines; if (shape->num_outlines>1) { for (n=0;nnum_outlines;n++,outline++) { if (n==0) fprintf(file,"\n"); else fprintf(file,",\n"); WriteXKBOutline(file,shape,outline,lastR,8,8); lastR= outline->corner_radius; } fprintf(file,"\n };\n"); } else { WriteXKBOutline(file,NULL,outline,lastR,1,8); fprintf(file," };\n"); } } } if (geom->num_sections>0) { XkbSectionPtr section; for (section=geom->sections,i=0;inum_sections;i++,section++){ WriteXKBSection(file,dpy,section,geom); } } if (geom->num_doodads>0) { XkbDoodadPtr doodad; for (i=0,doodad=geom->doodads;inum_doodads;i++,doodad++) { WriteXKBDoodad(file,dpy,4,geom,doodad); } } if (addOn) (*addOn)(file,result,topLevel,showImplicit,XkmGeometryIndex,priv); fprintf(file,"};\n\n"); return True; } /*ARGSUSED*/ Bool XkbWriteXKBSemantics( FILE * file, XkbFileInfo * result, Bool topLevel, Bool showImplicit, XkbFileAddOnFunc addOn, void * priv) { Bool ok; fprintf(file,"xkb_semantics {\n"); ok= XkbWriteXKBKeyTypes(file,result,False,False,addOn,priv); ok= ok&&XkbWriteXKBCompatMap(file,result,False,False,addOn,priv); fprintf(file,"};\n"); return ok; } /*ARGSUSED*/ Bool XkbWriteXKBLayout( FILE * file, XkbFileInfo * result, Bool topLevel, Bool showImplicit, XkbFileAddOnFunc addOn, void * priv) { Bool ok; XkbDescPtr xkb; xkb= result->xkb; fprintf(file,"xkb_layout {\n"); ok= XkbWriteXKBKeycodes(file,result,False,showImplicit,addOn,priv); ok= ok&&XkbWriteXKBKeyTypes(file,result,False,showImplicit,addOn,priv); ok= ok&&XkbWriteXKBSymbols(file,result,False,showImplicit,addOn,priv); if (xkb->geom) ok= ok&&XkbWriteXKBGeometry(file,result,False,showImplicit,addOn,priv); fprintf(file,"};\n"); return ok; } /*ARGSUSED*/ Bool XkbWriteXKBKeymap( FILE * file, XkbFileInfo * result, Bool topLevel, Bool showImplicit, XkbFileAddOnFunc addOn, void * priv) { Bool ok; XkbDescPtr xkb; xkb= result->xkb; fprintf(file,"xkb_keymap {\n"); ok= XkbWriteXKBKeycodes(file,result,False,showImplicit,addOn,priv); ok= ok&&XkbWriteXKBKeyTypes(file,result,False,showImplicit,addOn,priv); ok= ok&&XkbWriteXKBCompatMap(file,result,False,showImplicit,addOn,priv); ok= ok&&XkbWriteXKBSymbols(file,result,False,showImplicit,addOn,priv); if (xkb->geom) ok= ok&&XkbWriteXKBGeometry(file,result,False,showImplicit,addOn,priv); fprintf(file,"};\n"); return ok; } Bool XkbWriteXKBFile( FILE * out, XkbFileInfo * result, Bool showImplicit, XkbFileAddOnFunc addOn, void * priv) { Bool ok = False; Bool (*func)( FILE * /* file */, XkbFileInfo * /* result */, Bool /* topLevel */, Bool /* showImplicit */, XkbFileAddOnFunc /* addOn */, void * /* priv */ ) = NULL; switch (result->type) { case XkmSemanticsFile: func= XkbWriteXKBSemantics; break; case XkmLayoutFile: func= XkbWriteXKBLayout; break; case XkmKeymapFile: func= XkbWriteXKBKeymap; break; case XkmTypesIndex: func= XkbWriteXKBKeyTypes; break; case XkmCompatMapIndex: func= XkbWriteXKBCompatMap; break; case XkmSymbolsIndex: func= XkbWriteXKBSymbols; break; case XkmKeyNamesIndex: func= XkbWriteXKBKeycodes; break; case XkmGeometryFile: case XkmGeometryIndex: func= XkbWriteXKBGeometry; break; case XkmVirtualModsIndex: case XkmIndicatorsIndex: _XkbLibError(_XkbErrBadImplementation, XkbConfigText(result->type,XkbMessage),0); return False; } if (out==NULL) { _XkbLibError(_XkbErrFileCannotOpen,"XkbWriteXkbFile",0); ok= False; } else if (func) { ok= (*func)(out,result,True,showImplicit,addOn,priv); } return ok; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkbPrKeyEv.c0000644000000000000000000001272313614532331017562 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include "misc.h" #include "inputstr.h" #include #include /***====================================================================***/ void XkbProcessKeyboardEvent(xEvent *xE,DeviceIntPtr keybd,int count) { KeyClassPtr keyc = keybd->key; XkbSrvInfoPtr xkbi; int key; XkbBehavior behavior; unsigned ndx; xkbi= keyc->xkbInfo; key= xE->u.u.detail; if (xkbDebugFlags&0x8) { DebugF("XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up")); } if ( (xkbi->repeatKey==key) && (xE->u.u.type==KeyRelease) && ((xkbi->desc->ctrls->enabled_ctrls&XkbRepeatKeysMask)==0) ) { AccessXCancelRepeatKey(xkbi,key); } behavior= xkbi->desc->server->behaviors[key]; /* The "permanent" flag indicates a hard-wired behavior that occurs */ /* below XKB, such as a key that physically locks. XKB does not */ /* do anything to implement the behavior, but it *does* report that */ /* key is hardwired */ if ((behavior.type&XkbKB_Permanent)==0) { switch (behavior.type) { case XkbKB_Default: if (( xE->u.u.type == KeyPress ) && (keyc->down[key>>3] & (1<<(key&7)))) { XkbLastRepeatEvent= (void *)xE; xE->u.u.type = KeyRelease; XkbHandleActions(keybd,keybd,xE,count); xE->u.u.type = KeyPress; XkbHandleActions(keybd,keybd,xE,count); XkbLastRepeatEvent= NULL; return; } else if ((xE->u.u.type==KeyRelease) && (!(keyc->down[key>>3]&(1<<(key&7))))) { XkbLastRepeatEvent= (void *)&xE; xE->u.u.type = KeyPress; XkbHandleActions(keybd,keybd,xE,count); xE->u.u.type = KeyRelease; XkbHandleActions(keybd,keybd,xE,count); XkbLastRepeatEvent= NULL; return; } break; case XkbKB_Lock: if ( xE->u.u.type == KeyRelease ) return; else { int bit= 1<<(key&7); if ( keyc->down[key>>3]&bit ) xE->u.u.type= KeyRelease; } break; case XkbKB_RadioGroup: ndx= (behavior.data&(~XkbKB_RGAllowNone)); if ( ndxnRadioGroups ) { XkbRadioGroupPtr rg; if ( xE->u.u.type == KeyRelease ) return; rg = &xkbi->radioGroups[ndx]; if ( rg->currentDown == xE->u.u.detail ) { if (behavior.data&XkbKB_RGAllowNone) { xE->u.u.type = KeyRelease; XkbHandleActions(keybd,keybd,xE,count); rg->currentDown= 0; } return; } if ( rg->currentDown!=0 ) { int tmpkey = xE->u.u.detail; xE->u.u.type= KeyRelease; xE->u.u.detail= rg->currentDown; XkbHandleActions(keybd,keybd,xE,count); xE->u.u.type= KeyPress; xE->u.u.detail= tmpkey; } rg->currentDown= key; } else ErrorF("InternalError! Illegal radio group %d\n",ndx); break; case XkbKB_Overlay1: case XkbKB_Overlay2: { unsigned which; if (behavior.type==XkbKB_Overlay1) which= XkbOverlay1Mask; else which= XkbOverlay2Mask; if ( (xkbi->desc->ctrls->enabled_ctrls&which)==0 ) break; if ((behavior.data>=xkbi->desc->min_key_code)&& (behavior.data<=xkbi->desc->max_key_code)) { xE->u.u.detail= behavior.data; /* 9/11/94 (ef) -- XXX! need to match release with */ /* press even if the state of the */ /* corresponding overlay control */ /* changes while the key is down */ } } break; default: ErrorF("unknown key behavior 0x%04x\n",behavior.type); break; } } XkbHandleActions(keybd,keybd,xE,count); return; } void ProcessKeyboardEvent(xEvent *xE,DeviceIntPtr keybd,int count) { KeyClassPtr keyc = keybd->key; XkbSrvInfoPtr xkbi; xkbi= keyc->xkbInfo; #ifdef DEBUG if (xkbDebugFlags&0x8) { int key= xE->u.u.detail; ErrorF("PKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up")); } #endif if ((xkbi->desc->ctrls->enabled_ctrls&XkbAllFilteredEventsMask)==0) XkbProcessKeyboardEvent(xE,keybd,count); else if (xE->u.u.type==KeyPress) AccessXFilterPressEvent(xE,keybd,count); else if (xE->u.u.type==KeyRelease) AccessXFilterReleaseEvent(xE,keybd,count); return; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkbPrOtherEv.c0000644000000000000000000000503413614532331020110 0ustar /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include "misc.h" #include "inputstr.h" #include #include #include extern void ProcessOtherEvent( xEvent * /* xE */, DeviceIntPtr /* dev */, int /* count */ ); /***====================================================================***/ void XkbProcessOtherEvent(xEvent *xE,DeviceIntPtr dev,int count) { Bool xkbCares,isBtn; xkbCares= True; isBtn= False; switch ( xE->u.u.type ) { case KeyPress: xE->u.u.type= DeviceKeyPress; break; case KeyRelease: xE->u.u.type= DeviceKeyRelease; break; case ButtonPress: xE->u.u.type= DeviceButtonPress; isBtn= True; break; case ButtonRelease: xE->u.u.type= DeviceButtonRelease; isBtn= True; break; default: xkbCares= False; break; } if (xkbCares) { if ((!isBtn)||((dev->button)&&(dev->button->xkb_acts))) { DeviceIntPtr kbd; if (dev->key) kbd= dev; else kbd= (DeviceIntPtr)LookupKeyboardDevice(); XkbHandleActions(dev,kbd,xE,count); return; } } ProcessOtherEvent(xE,dev,count); return; } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkbSwap.c0000644000000000000000000003217613614532331017153 0ustar /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include "stdio.h" #include #include #include "misc.h" #include "inputstr.h" #include #include "xkbstr.h" #include "extnsionst.h" #include "xkb.h" /* * REQUEST SWAPPING */ static int SProcXkbUseExtension(ClientPtr client) { REQUEST(xkbUseExtensionReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbUseExtensionReq); swaps(&stuff->wantedMajor); swaps(&stuff->wantedMinor); return ProcXkbUseExtension(client); } static int SProcXkbSelectEvents(ClientPtr client) { REQUEST(xkbSelectEventsReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xkbSelectEventsReq); swaps(&stuff->deviceSpec); swaps(&stuff->affectWhich); swaps(&stuff->clear); swaps(&stuff->selectAll); swaps(&stuff->affectMap); swaps(&stuff->map); if ((stuff->affectWhich&(~XkbMapNotifyMask))!=0) { union { BOOL *b; CARD8 *c8; CARD16 *c16; CARD32 *c32; } from; register unsigned bit,ndx,maskLeft,dataLeft,size; from.c8= (CARD8 *)&stuff[1]; dataLeft= (stuff->length*4)-SIZEOF(xkbSelectEventsReq); maskLeft= (stuff->affectWhich&(~XkbMapNotifyMask)); for (ndx=0,bit=1; (maskLeft!=0); ndx++, bit<<=1) { if (((bit&maskLeft)==0)||(ndx==XkbMapNotify)) continue; maskLeft&= ~bit; if ((stuff->selectAll&bit)||(stuff->clear&bit)) continue; switch (ndx) { case XkbNewKeyboardNotify: case XkbStateNotify: case XkbNamesNotify: case XkbAccessXNotify: case XkbExtensionDeviceNotify: size= 2; break; case XkbControlsNotify: case XkbIndicatorStateNotify: case XkbIndicatorMapNotify: size= 4; break; case XkbBellNotify: case XkbActionMessage: case XkbCompatMapNotify: size= 1; break; default: client->errorValue = _XkbErrCode2(0x1,bit); return BadValue; } if (dataLeft<(size*2)) return BadLength; if (size==2) { swaps(&from.c16[0]); swaps(&from.c16[1]); } else if (size==4) { swapl(&from.c32[0]); swapl(&from.c32[1]); } else { size= 2; } from.c8+= (size*2); dataLeft-= (size*2); } if (dataLeft>2) { ErrorF("Extra data (%d bytes) after SelectEvents\n",dataLeft); return BadLength; } } return ProcXkbSelectEvents(client); } static int SProcXkbBell(ClientPtr client) { REQUEST(xkbBellReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbBellReq); swaps(&stuff->deviceSpec); swaps(&stuff->bellClass); swaps(&stuff->bellID); swapl(&stuff->name); swapl(&stuff->window); swaps(&stuff->pitch); swaps(&stuff->duration); return ProcXkbBell(client); } static int SProcXkbGetState(ClientPtr client) { REQUEST(xkbGetStateReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbGetStateReq); swaps(&stuff->deviceSpec); return ProcXkbGetState(client); } static int SProcXkbLatchLockState(ClientPtr client) { REQUEST(xkbLatchLockStateReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbLatchLockStateReq); swaps(&stuff->deviceSpec); swaps(&stuff->groupLatch); return ProcXkbLatchLockState(client); } static int SProcXkbGetControls(ClientPtr client) { REQUEST(xkbGetControlsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbGetControlsReq); swaps(&stuff->deviceSpec); return ProcXkbGetControls(client); } static int SProcXkbSetControls(ClientPtr client) { REQUEST(xkbSetControlsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbSetControlsReq); swaps(&stuff->deviceSpec); swaps(&stuff->affectInternalVMods); swaps(&stuff->internalVMods); swaps(&stuff->affectIgnoreLockVMods); swaps(&stuff->ignoreLockVMods); swaps(&stuff->axOptions); swapl(&stuff->affectEnabledCtrls); swapl(&stuff->enabledCtrls); swapl(&stuff->changeCtrls); swaps(&stuff->repeatDelay); swaps(&stuff->repeatInterval); swaps(&stuff->slowKeysDelay); swaps(&stuff->debounceDelay); swaps(&stuff->mkDelay); swaps(&stuff->mkInterval); swaps(&stuff->mkTimeToMax); swaps(&stuff->mkMaxSpeed); swaps(&stuff->mkCurve); swaps(&stuff->axTimeout); swapl(&stuff->axtCtrlsMask); swapl(&stuff->axtCtrlsValues); swaps(&stuff->axtOptsMask); swaps(&stuff->axtOptsValues); return ProcXkbSetControls(client); } static int SProcXkbGetMap(ClientPtr client) { REQUEST(xkbGetMapReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbGetMapReq); swaps(&stuff->deviceSpec); swaps(&stuff->full); swaps(&stuff->partial); swaps(&stuff->virtualMods); return ProcXkbGetMap(client); } static int SProcXkbSetMap(ClientPtr client) { REQUEST(xkbSetMapReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xkbSetMapReq); swaps(&stuff->deviceSpec); swaps(&stuff->present); swaps(&stuff->flags); swaps(&stuff->totalSyms); swaps(&stuff->totalActs); swaps(&stuff->virtualMods); return ProcXkbSetMap(client); } static int SProcXkbGetCompatMap(ClientPtr client) { REQUEST(xkbGetCompatMapReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbGetCompatMapReq); swaps(&stuff->deviceSpec); swaps(&stuff->firstSI); swaps(&stuff->nSI); return ProcXkbGetCompatMap(client); } static int SProcXkbSetCompatMap(ClientPtr client) { REQUEST(xkbSetCompatMapReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xkbSetCompatMapReq); swaps(&stuff->deviceSpec); swaps(&stuff->firstSI); swaps(&stuff->nSI); return ProcXkbSetCompatMap(client); } static int SProcXkbGetIndicatorState(ClientPtr client) { REQUEST(xkbGetIndicatorStateReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbGetIndicatorStateReq); swaps(&stuff->deviceSpec); return ProcXkbGetIndicatorState(client); } static int SProcXkbGetIndicatorMap(ClientPtr client) { REQUEST(xkbGetIndicatorMapReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbGetIndicatorMapReq); swaps(&stuff->deviceSpec); swapl(&stuff->which); return ProcXkbGetIndicatorMap(client); } static int SProcXkbSetIndicatorMap(ClientPtr client) { REQUEST(xkbSetIndicatorMapReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xkbSetIndicatorMapReq); swaps(&stuff->deviceSpec); swapl(&stuff->which); return ProcXkbSetIndicatorMap(client); } static int SProcXkbGetNamedIndicator(ClientPtr client) { REQUEST(xkbGetNamedIndicatorReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbGetNamedIndicatorReq); swaps(&stuff->deviceSpec); swaps(&stuff->ledClass); swaps(&stuff->ledID); swapl(&stuff->indicator); return ProcXkbGetNamedIndicator(client); } static int SProcXkbSetNamedIndicator(ClientPtr client) { REQUEST(xkbSetNamedIndicatorReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbSetNamedIndicatorReq); swaps(&stuff->deviceSpec); swaps(&stuff->ledClass); swaps(&stuff->ledID); swapl(&stuff->indicator); swaps(&stuff->virtualMods); swapl(&stuff->ctrls); return ProcXkbSetNamedIndicator(client); } static int SProcXkbGetNames(ClientPtr client) { REQUEST(xkbGetNamesReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbGetNamesReq); swaps(&stuff->deviceSpec); swapl(&stuff->which); return ProcXkbGetNames(client); } static int SProcXkbSetNames(ClientPtr client) { REQUEST(xkbSetNamesReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xkbSetNamesReq); swaps(&stuff->deviceSpec); swaps(&stuff->virtualMods); swapl(&stuff->which); swapl(&stuff->indicators); swaps(&stuff->totalKTLevelNames); return ProcXkbSetNames(client); } static int SProcXkbGetGeometry(ClientPtr client) { REQUEST(xkbGetGeometryReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbGetGeometryReq); swaps(&stuff->deviceSpec); swapl(&stuff->name); return ProcXkbGetGeometry(client); } static int SProcXkbSetGeometry(ClientPtr client) { REQUEST(xkbSetGeometryReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xkbSetGeometryReq); swaps(&stuff->deviceSpec); swapl(&stuff->name); swaps(&stuff->widthMM); swaps(&stuff->heightMM); swaps(&stuff->nProperties); swaps(&stuff->nColors); swaps(&stuff->nDoodads); swaps(&stuff->nKeyAliases); return ProcXkbSetGeometry(client); } static int SProcXkbPerClientFlags(ClientPtr client) { REQUEST(xkbPerClientFlagsReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbPerClientFlagsReq); swaps(&stuff->deviceSpec); swapl(&stuff->change); swapl(&stuff->value); swapl(&stuff->ctrlsToChange); swapl(&stuff->autoCtrls); swapl(&stuff->autoCtrlValues); return ProcXkbPerClientFlags(client); } static int SProcXkbListComponents(ClientPtr client) { REQUEST(xkbListComponentsReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xkbListComponentsReq); swaps(&stuff->deviceSpec); swaps(&stuff->maxNames); return ProcXkbListComponents(client); } static int SProcXkbGetKbdByName(ClientPtr client) { REQUEST(xkbGetKbdByNameReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xkbGetKbdByNameReq); swaps(&stuff->deviceSpec); swaps(&stuff->want); swaps(&stuff->need); return ProcXkbGetKbdByName(client); } static int SProcXkbGetDeviceInfo(ClientPtr client) { REQUEST(xkbGetDeviceInfoReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbGetDeviceInfoReq); swaps(&stuff->deviceSpec); swaps(&stuff->wanted); swaps(&stuff->ledClass); swaps(&stuff->ledID); return ProcXkbGetDeviceInfo(client); } static int SProcXkbSetDeviceInfo(ClientPtr client) { REQUEST(xkbSetDeviceInfoReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xkbSetDeviceInfoReq); swaps(&stuff->deviceSpec); swaps(&stuff->change); swaps(&stuff->nDeviceLedFBs); return ProcXkbSetDeviceInfo(client); } static int SProcXkbSetDebuggingFlags(ClientPtr client) { REQUEST(xkbSetDebuggingFlagsReq); swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xkbSetDebuggingFlagsReq); swapl(&stuff->affectFlags); swapl(&stuff->flags); swapl(&stuff->affectCtrls); swapl(&stuff->ctrls); swaps(&stuff->msgLength); return ProcXkbSetDebuggingFlags(client); } int SProcXkbDispatch (ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_kbUseExtension: return SProcXkbUseExtension(client); case X_kbSelectEvents: return SProcXkbSelectEvents(client); case X_kbBell: return SProcXkbBell(client); case X_kbGetState: return SProcXkbGetState(client); case X_kbLatchLockState: return SProcXkbLatchLockState(client); case X_kbGetControls: return SProcXkbGetControls(client); case X_kbSetControls: return SProcXkbSetControls(client); case X_kbGetMap: return SProcXkbGetMap(client); case X_kbSetMap: return SProcXkbSetMap(client); case X_kbGetCompatMap: return SProcXkbGetCompatMap(client); case X_kbSetCompatMap: return SProcXkbSetCompatMap(client); case X_kbGetIndicatorState: return SProcXkbGetIndicatorState(client); case X_kbGetIndicatorMap: return SProcXkbGetIndicatorMap(client); case X_kbSetIndicatorMap: return SProcXkbSetIndicatorMap(client); case X_kbGetNamedIndicator: return SProcXkbGetNamedIndicator(client); case X_kbSetNamedIndicator: return SProcXkbSetNamedIndicator(client); case X_kbGetNames: return SProcXkbGetNames(client); case X_kbSetNames: return SProcXkbSetNames(client); case X_kbGetGeometry: return SProcXkbGetGeometry(client); case X_kbSetGeometry: return SProcXkbSetGeometry(client); case X_kbPerClientFlags: return SProcXkbPerClientFlags(client); case X_kbListComponents: return SProcXkbListComponents(client); case X_kbGetKbdByName: return SProcXkbGetKbdByName(client); case X_kbGetDeviceInfo: return SProcXkbGetDeviceInfo(client); case X_kbSetDeviceInfo: return SProcXkbSetDeviceInfo(client); case X_kbSetDebuggingFlags: return SProcXkbSetDebuggingFlags(client); default: return BadRequest; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkbtext.c0000644000000000000000000007636513614532331017235 0ustar /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include #include "misc.h" #include "inputstr.h" #include "dix.h" #include "xkbstr.h" #include #include "xkbgeom.h" /***====================================================================***/ #define BUFFER_SIZE 512 static char textBuffer[BUFFER_SIZE]; static int tbNext= 0; static char * tbGetBuffer(unsigned size) { char *rtrn; if (size>=BUFFER_SIZE) return NULL; if ((BUFFER_SIZE-tbNext)<=size) tbNext= 0; rtrn= &textBuffer[tbNext]; tbNext+= size; return rtrn; } /***====================================================================***/ char * XkbAtomText(Display *dpy,Atom atm,unsigned format) { const char *atmstr; char *rtrn,*tmp; atmstr= NameForAtom(atm); if (atmstr!=NULL) { int len; len= strlen(atmstr)+1; if (len>BUFFER_SIZE) len= BUFFER_SIZE-2; rtrn= tbGetBuffer(len); strncpy(rtrn,atmstr,len); rtrn[len]= '\0'; } else { rtrn= tbGetBuffer(1); rtrn[0]= '\0'; } if (format==XkbCFile) { for (tmp=rtrn;*tmp!='\0';tmp++) { if ((tmp==rtrn)&&(!isalpha(*tmp))) *tmp= '_'; else if (!isalnum(*tmp)) *tmp= '_'; } } return XkbStringText(rtrn,format); } /***====================================================================***/ char * XkbVModIndexText(Display *dpy,XkbDescPtr xkb,unsigned ndx,unsigned format) { register int len; register Atom *vmodNames; char *rtrn; const char *tmp; char numBuf[20]; if (xkb && xkb->names) vmodNames= xkb->names->vmods; else vmodNames= NULL; tmp= NULL; if (ndx>=XkbNumVirtualMods) tmp= "illegal"; else if (vmodNames&&(vmodNames[ndx]!=None)) tmp= NameForAtom(vmodNames[ndx]); if (tmp==NULL) { sprintf(numBuf,"%d",ndx); tmp = numBuf; } len= strlen(tmp)+1; if (format==XkbCFile) len+= 4; if (len>=BUFFER_SIZE) len= BUFFER_SIZE-1; rtrn= tbGetBuffer(len); if (format==XkbCFile) { strcpy(rtrn,"vmod_"); strncpy(&rtrn[5],tmp,len-4); } else strncpy(rtrn,tmp,len); return rtrn; } char * XkbVModMaskText( Display * dpy, XkbDescPtr xkb, unsigned modMask, unsigned mask, unsigned format) { register int i,bit; int len; char *mm,*rtrn; char *str,buf[BUFFER_SIZE]; if ((modMask==0)&&(mask==0)) { rtrn= tbGetBuffer(5); if (format==XkbCFile) sprintf(rtrn,"0"); else sprintf(rtrn,"none"); return rtrn; } if (modMask!=0) mm= XkbModMaskText(modMask,format); else mm= NULL; str= buf; buf[0]= '\0'; if (mask) { char *tmp; for (i=0,bit=1;i=BUFFER_SIZE) len= BUFFER_SIZE-1; rtrn= tbGetBuffer(len+1); rtrn[0]= '\0'; if (mm!=NULL) { i= strlen(mm); if (i>len) i= len; strcpy(rtrn,mm); } else { i=0; } if (str!=NULL) { if (mm!=NULL) { if (format==XkbCFile) strcat(rtrn,"|"); else strcat(rtrn,"+"); } strncat(rtrn,str,len-i); } rtrn[len]= '\0'; return rtrn; } static char *modNames[XkbNumModifiers] = { "Shift", "Lock", "Control", "Mod1", "Mod2", "Mod3", "Mod4", "Mod5" }; char * XkbModIndexText(unsigned ndx,unsigned format) { char * rtrn; char buf[100]; if (format==XkbCFile) { if (ndx0) { len= strlen(from); if (len<((*pLeft)-3)) { strcat(to,from); *pLeft-= len; return True; } } *pLeft= -1; return False; } /*ARGSUSED*/ static Bool CopyNoActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int*sz) { return True; } static Bool CopyModActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, int* sz) { XkbModAction * act; unsigned tmp; act= &action->mods; tmp= XkbModActionVMods(act); TryCopyStr(buf,"modifiers=",sz); if (act->flags&XkbSA_UseModMapMods) TryCopyStr(buf,"modMapMods",sz); else if (act->real_mods || tmp) { TryCopyStr(buf, XkbVModMaskText(dpy,xkb,act->real_mods,tmp,XkbXKBFile), sz); } else TryCopyStr(buf,"none",sz); if (act->type==XkbSA_LockMods) return True; if (act->flags&XkbSA_ClearLocks) TryCopyStr(buf,",clearLocks",sz); if (act->flags&XkbSA_LatchToLock) TryCopyStr(buf,",latchToLock",sz); return True; } /*ARGSUSED*/ static Bool CopyGroupActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbGroupAction * act; char tbuf[32]; act= &action->group; TryCopyStr(buf,"group=",sz); if (act->flags&XkbSA_GroupAbsolute) sprintf(tbuf,"%d",XkbSAGroup(act)+1); else if (XkbSAGroup(act)<0) sprintf(tbuf,"%d",XkbSAGroup(act)); else sprintf(tbuf,"+%d",XkbSAGroup(act)); TryCopyStr(buf,tbuf,sz); if (act->type==XkbSA_LockGroup) return True; if (act->flags&XkbSA_ClearLocks) TryCopyStr(buf,",clearLocks",sz); if (act->flags&XkbSA_LatchToLock) TryCopyStr(buf,",latchToLock",sz); return True; } /*ARGSUSED*/ static Bool CopyMovePtrArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) { XkbPtrAction * act; int x,y; char tbuf[32]; act= &action->ptr; x= XkbPtrActionX(act); y= XkbPtrActionY(act); if ((act->flags&XkbSA_MoveAbsoluteX)||(x<0)) sprintf(tbuf,"x=%d",x); else sprintf(tbuf,"x=+%d",x); TryCopyStr(buf,tbuf,sz); if ((act->flags&XkbSA_MoveAbsoluteY)||(y<0)) sprintf(tbuf,",y=%d",y); else sprintf(tbuf,",y=+%d",y); TryCopyStr(buf,tbuf,sz); if (act->flags&XkbSA_NoAcceleration) TryCopyStr(buf,",!accel",sz); return True; } /*ARGSUSED*/ static Bool CopyPtrBtnArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) { XkbPtrBtnAction * act; char tbuf[32]; act= &action->btn; TryCopyStr(buf,"button=",sz); if ((act->button>0)&&(act->button<6)) { sprintf(tbuf,"%d",act->button); TryCopyStr(buf,tbuf,sz); } else TryCopyStr(buf,"default",sz); if (act->count>0) { sprintf(tbuf,",count=%d",act->count); TryCopyStr(buf,tbuf,sz); } if (action->type==XkbSA_LockPtrBtn) { switch (act->flags&(XkbSA_LockNoUnlock|XkbSA_LockNoLock)) { case XkbSA_LockNoLock: sprintf(tbuf,",affect=unlock"); break; case XkbSA_LockNoUnlock: sprintf(tbuf,",affect=lock"); break; case XkbSA_LockNoUnlock|XkbSA_LockNoLock: sprintf(tbuf,",affect=neither"); break; default: sprintf(tbuf,",affect=both"); break; } TryCopyStr(buf,tbuf,sz); } return True; } /*ARGSUSED*/ static Bool CopySetPtrDfltArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbPtrDfltAction * act; char tbuf[32]; act= &action->dflt; if (act->affect==XkbSA_AffectDfltBtn) { TryCopyStr(buf,"affect=button,button=",sz); if ((act->flags&XkbSA_DfltBtnAbsolute)||(XkbSAPtrDfltValue(act)<0)) sprintf(tbuf,"%d",XkbSAPtrDfltValue(act)); else sprintf(tbuf,"+%d",XkbSAPtrDfltValue(act)); TryCopyStr(buf,tbuf,sz); } return True; } static Bool CopyISOLockArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) { XkbISOAction * act; char tbuf[64]; act= &action->iso; if (act->flags&XkbSA_ISODfltIsGroup) { TryCopyStr(tbuf,"group=",sz); if (act->flags&XkbSA_GroupAbsolute) sprintf(tbuf,"%d",XkbSAGroup(act)+1); else if (XkbSAGroup(act)<0) sprintf(tbuf,"%d",XkbSAGroup(act)); else sprintf(tbuf,"+%d",XkbSAGroup(act)); TryCopyStr(buf,tbuf,sz); } else { unsigned tmp; tmp= XkbModActionVMods(act); TryCopyStr(buf,"modifiers=",sz); if (act->flags&XkbSA_UseModMapMods) TryCopyStr(buf,"modMapMods",sz); else if (act->real_mods || tmp) { if (act->real_mods) { TryCopyStr(buf,XkbModMaskText(act->real_mods,XkbXKBFile),sz); if (tmp) TryCopyStr(buf,"+",sz); } if (tmp) TryCopyStr(buf,XkbVModMaskText(dpy,xkb,0,tmp,XkbXKBFile),sz); } else TryCopyStr(buf,"none",sz); } TryCopyStr(buf,",affect=",sz); if ((act->affect&XkbSA_ISOAffectMask)==0) TryCopyStr(buf,"all",sz); else { int nOut= 0; if ((act->affect&XkbSA_ISONoAffectMods)==0) { TryCopyStr(buf,"mods",sz); nOut++; } if ((act->affect&XkbSA_ISONoAffectGroup)==0) { sprintf(tbuf,"%sgroups",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } if ((act->affect&XkbSA_ISONoAffectPtr)==0) { sprintf(tbuf,"%spointer",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } if ((act->affect&XkbSA_ISONoAffectCtrls)==0) { sprintf(tbuf,"%scontrols",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } } return True; } /*ARGSUSED*/ static Bool CopySwitchScreenArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbSwitchScreenAction * act; char tbuf[32]; act= &action->screen; if ((act->flags&XkbSA_SwitchAbsolute)||(XkbSAScreen(act)<0)) sprintf(tbuf,"screen=%d",XkbSAScreen(act)); else sprintf(tbuf,"screen=+%d",XkbSAScreen(act)); TryCopyStr(buf,tbuf,sz); if (act->flags&XkbSA_SwitchApplication) TryCopyStr(buf,",!same",sz); else TryCopyStr(buf,",same",sz); return True; } /*ARGSUSED*/ static Bool CopySetLockControlsArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action, char *buf,int *sz) { XkbCtrlsAction * act; unsigned tmp; char tbuf[32]; act= &action->ctrls; tmp= XkbActionCtrls(act); TryCopyStr(buf,"controls=",sz); if (tmp==0) TryCopyStr(buf,"none",sz); else if ((tmp&XkbAllBooleanCtrlsMask)==XkbAllBooleanCtrlsMask) TryCopyStr(buf,"all",sz); else { int nOut= 0; if (tmp&XkbRepeatKeysMask) { sprintf(tbuf,"%sRepeatKeys",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } if (tmp&XkbSlowKeysMask) { sprintf(tbuf,"%sSlowKeys",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } if (tmp&XkbBounceKeysMask) { sprintf(tbuf,"%sBounceKeys",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } if (tmp&XkbStickyKeysMask) { sprintf(tbuf,"%sStickyKeys",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } if (tmp&XkbMouseKeysMask) { sprintf(tbuf,"%sMouseKeys",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } if (tmp&XkbMouseKeysAccelMask) { sprintf(tbuf,"%sMouseKeysAccel",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } if (tmp&XkbAccessXKeysMask) { sprintf(tbuf,"%sAccessXKeys",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } if (tmp&XkbAccessXTimeoutMask) { sprintf(tbuf,"%sAccessXTimeout",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } if (tmp&XkbAccessXFeedbackMask) { sprintf(tbuf,"%sAccessXFeedback",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } if (tmp&XkbAudibleBellMask) { sprintf(tbuf,"%sAudibleBell",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } if (tmp&XkbOverlay1Mask) { sprintf(tbuf,"%sOverlay1",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } if (tmp&XkbOverlay2Mask) { sprintf(tbuf,"%sOverlay2",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } if (tmp&XkbIgnoreGroupLockMask) { sprintf(tbuf,"%sIgnoreGroupLock",(nOut>0?"+":"")); TryCopyStr(buf,tbuf,sz); nOut++; } } return True; } /*ARGSUSED*/ static Bool CopyActionMessageArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbMessageAction * act; unsigned all; char tbuf[32]; act= &action->msg; all= XkbSA_MessageOnPress|XkbSA_MessageOnRelease; TryCopyStr(buf,"report=",sz); if ((act->flags&all)==0) TryCopyStr(buf,"none",sz); else if ((act->flags&all)==all) TryCopyStr(buf,"all",sz); else if (act->flags&XkbSA_MessageOnPress) TryCopyStr(buf,"KeyPress",sz); else TryCopyStr(buf,"KeyRelease",sz); sprintf(tbuf,",data[0]=0x%02x",act->message[0]); TryCopyStr(buf,tbuf,sz); sprintf(tbuf,",data[1]=0x%02x",act->message[1]); TryCopyStr(buf,tbuf,sz); sprintf(tbuf,",data[2]=0x%02x",act->message[2]); TryCopyStr(buf,tbuf,sz); sprintf(tbuf,",data[3]=0x%02x",act->message[3]); TryCopyStr(buf,tbuf,sz); sprintf(tbuf,",data[4]=0x%02x",act->message[4]); TryCopyStr(buf,tbuf,sz); sprintf(tbuf,",data[5]=0x%02x",act->message[5]); TryCopyStr(buf,tbuf,sz); return True; } static Bool CopyRedirectKeyArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbRedirectKeyAction * act; char tbuf[32],*tmp; unsigned kc; unsigned vmods,vmods_mask; act= &action->redirect; kc= act->new_key; vmods= XkbSARedirectVMods(act); vmods_mask= XkbSARedirectVModsMask(act); if (xkb && xkb->names && xkb->names->keys && (kc<=xkb->max_key_code) && (xkb->names->keys[kc].name[0]!='\0')) { char *kn; kn= XkbKeyNameText(xkb->names->keys[kc].name,XkbXKBFile); sprintf(tbuf,"key=%s",kn); } else sprintf(tbuf,"key=%d",kc); TryCopyStr(buf,tbuf,sz); if ((act->mods_mask==0)&&(vmods_mask==0)) return True; if ((act->mods_mask==XkbAllModifiersMask)&& (vmods_mask==XkbAllVirtualModsMask)) { tmp= XkbVModMaskText(dpy,xkb,act->mods,vmods,XkbXKBFile); TryCopyStr(buf,",mods=",sz); TryCopyStr(buf,tmp,sz); } else { if ((act->mods_mask&act->mods)||(vmods_mask&vmods)) { tmp= XkbVModMaskText(dpy,xkb,act->mods_mask&act->mods, vmods_mask&vmods,XkbXKBFile); TryCopyStr(buf,",mods= ",sz); TryCopyStr(buf,tmp,sz); } if ((act->mods_mask&(~act->mods))||(vmods_mask&(~vmods))) { tmp= XkbVModMaskText(dpy,xkb,act->mods_mask&(~act->mods), vmods_mask&(~vmods),XkbXKBFile); TryCopyStr(buf,",clearMods= ",sz); TryCopyStr(buf,tmp,sz); } } return True; } /*ARGSUSED*/ static Bool CopyDeviceBtnArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbDeviceBtnAction * act; char tbuf[32]; act= &action->devbtn; sprintf(tbuf,"device= %d",act->device); TryCopyStr(buf,tbuf,sz); TryCopyStr(buf,",button=",sz); sprintf(tbuf,"%d",act->button); TryCopyStr(buf,tbuf,sz); if (act->count>0) { sprintf(tbuf,",count=%d",act->count); TryCopyStr(buf,tbuf,sz); } if (action->type==XkbSA_LockDeviceBtn) { switch (act->flags&(XkbSA_LockNoUnlock|XkbSA_LockNoLock)) { case XkbSA_LockNoLock: sprintf(tbuf,",affect=unlock"); break; case XkbSA_LockNoUnlock: sprintf(tbuf,",affect=lock"); break; case XkbSA_LockNoUnlock|XkbSA_LockNoLock: sprintf(tbuf,",affect=neither"); break; default: sprintf(tbuf,",affect=both"); break; } TryCopyStr(buf,tbuf,sz); } return True; } /*ARGSUSED*/ static Bool CopyOtherArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) { XkbAnyAction * act; char tbuf[32]; act= &action->any; sprintf(tbuf,"type=0x%02x",act->type); TryCopyStr(buf,tbuf,sz); sprintf(tbuf,",data[0]=0x%02x",act->data[0]); TryCopyStr(buf,tbuf,sz); sprintf(tbuf,",data[1]=0x%02x",act->data[1]); TryCopyStr(buf,tbuf,sz); sprintf(tbuf,",data[2]=0x%02x",act->data[2]); TryCopyStr(buf,tbuf,sz); sprintf(tbuf,",data[3]=0x%02x",act->data[3]); TryCopyStr(buf,tbuf,sz); sprintf(tbuf,",data[4]=0x%02x",act->data[4]); TryCopyStr(buf,tbuf,sz); sprintf(tbuf,",data[5]=0x%02x",act->data[5]); TryCopyStr(buf,tbuf,sz); sprintf(tbuf,",data[6]=0x%02x",act->data[6]); TryCopyStr(buf,tbuf,sz); return True; } typedef Bool (*actionCopy)( Display * /* dpy */, XkbDescPtr /* xkb */, XkbAction * /* action */, char * /* buf */, int* /* sz */ ); static actionCopy copyActionArgs[XkbSA_NumActions] = { CopyNoActionArgs /* NoAction */, CopyModActionArgs /* SetMods */, CopyModActionArgs /* LatchMods */, CopyModActionArgs /* LockMods */, CopyGroupActionArgs /* SetGroup */, CopyGroupActionArgs /* LatchGroup */, CopyGroupActionArgs /* LockGroup */, CopyMovePtrArgs /* MovePtr */, CopyPtrBtnArgs /* PtrBtn */, CopyPtrBtnArgs /* LockPtrBtn */, CopySetPtrDfltArgs /* SetPtrDflt */, CopyISOLockArgs /* ISOLock */, CopyNoActionArgs /* Terminate */, CopySwitchScreenArgs /* SwitchScreen */, CopySetLockControlsArgs /* SetControls */, CopySetLockControlsArgs /* LockControls */, CopyActionMessageArgs /* ActionMessage*/, CopyRedirectKeyArgs /* RedirectKey */, CopyDeviceBtnArgs /* DeviceBtn */, CopyDeviceBtnArgs /* LockDeviceBtn*/ }; #define ACTION_SZ 256 char * XkbActionText(Display *dpy,XkbDescPtr xkb,XkbAction *action,unsigned format) { char buf[ACTION_SZ],*tmp; int sz; if (format==XkbCFile) { sprintf(buf, "{ %20s, { 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x } }", XkbActionTypeText(action->type,XkbCFile), action->any.data[0],action->any.data[1],action->any.data[2], action->any.data[3],action->any.data[4],action->any.data[5], action->any.data[6]); } else { sprintf(buf,"%s(",XkbActionTypeText(action->type,XkbXKBFile)); sz= ACTION_SZ-strlen(buf)+2; /* room for close paren and NULL */ if (action->type<(unsigned)XkbSA_NumActions) (*copyActionArgs[action->type])(dpy,xkb,action,buf,&sz); else CopyOtherArgs(dpy,xkb,action,buf,&sz); TryCopyStr(buf,")",&sz); } tmp= tbGetBuffer(strlen(buf)+1); if (tmp!=NULL) strcpy(tmp,buf); return tmp; } char * XkbBehaviorText(XkbDescPtr xkb,XkbBehavior *behavior,unsigned format) { char buf[256],*tmp; if (format==XkbCFile) { if (behavior->type==XkbKB_Default) sprintf(buf,"{ 0, 0 }"); else sprintf(buf,"{ %3d, 0x%02x }",behavior->type,behavior->data); } else { unsigned type,permanent; type= behavior->type&XkbKB_OpMask; permanent=((behavior->type&XkbKB_Permanent)!=0); if (type==XkbKB_Lock) { sprintf(buf,"lock= %s",(permanent?"Permanent":"True")); } else if (type==XkbKB_RadioGroup) { int g; g= ((behavior->data)&(~XkbKB_RGAllowNone))+1; if (XkbKB_RGAllowNone&behavior->data) { sprintf(buf,"allowNone,"); tmp= &buf[strlen(buf)]; } else tmp= buf; if (permanent) sprintf(tmp,"permanentRadioGroup= %d",g); else sprintf(tmp,"radioGroup= %d",g); } else if ((type==XkbKB_Overlay1)||(type==XkbKB_Overlay2)) { int ndx,kc; char *kn; ndx= ((type==XkbKB_Overlay1)?1:2); kc= behavior->data; if ((xkb)&&(xkb->names)&&(xkb->names->keys)) kn= XkbKeyNameText(xkb->names->keys[kc].name,XkbXKBFile); else { static char tbuf[8]; sprintf(tbuf,"%d",kc); kn= tbuf; } if (permanent) sprintf(buf,"permanentOverlay%d= %s",ndx,kn); else sprintf(buf,"overlay%d= %s",ndx,kn); } } tmp= tbGetBuffer(strlen(buf)+1); if (tmp!=NULL) strcpy(tmp,buf); return tmp; } /***====================================================================***/ char * XkbIndentText(unsigned size) { static char buf[32]; register int i; if (size>31) size= 31; for (i=0;i #endif #include #include #include #include #include #define XK_CYRILLIC #include #include "misc.h" #include "inputstr.h" #include #include "xkbgeom.h" #include "xkb.h" #ifdef MODE_SWITCH extern Bool noKME; /* defined in os/utils.c */ #endif int XkbDisableLockActions = 0; /***====================================================================***/ #ifndef RETURN_SHOULD_REPEAT #define RETURN_SHOULD_REPEAT 0 #endif /***====================================================================***/ DeviceIntPtr _XkbLookupAnyDevice(int id,int *why_rtrn) { DeviceIntPtr dev = NULL; dev= (DeviceIntPtr)LookupKeyboardDevice(); if ((id==XkbUseCoreKbd)||(dev->id==id)) return dev; dev= (DeviceIntPtr)LookupPointerDevice(); if ((id==XkbUseCorePtr)||(dev->id==id)) return dev; if (id&(~0xff)) dev = NULL; dev= (DeviceIntPtr)LookupDevice(id); if (dev!=NULL) return dev; if ((!dev)&&(why_rtrn)) *why_rtrn= XkbErr_BadDevice; return dev; } DeviceIntPtr _XkbLookupKeyboard(int id,int *why_rtrn) { DeviceIntPtr dev = NULL; if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL) return NULL; else if ((!dev->key)||(!dev->key->xkbInfo)) { if (why_rtrn) *why_rtrn= XkbErr_BadClass; return NULL; } return dev; } DeviceIntPtr _XkbLookupBellDevice(int id,int *why_rtrn) { DeviceIntPtr dev = NULL; if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL) return NULL; else if ((!dev->kbdfeed)&&(!dev->bell)) { if (why_rtrn) *why_rtrn= XkbErr_BadClass; return NULL; } return dev; } DeviceIntPtr _XkbLookupLedDevice(int id,int *why_rtrn) { DeviceIntPtr dev = NULL; if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL) return NULL; else if ((!dev->kbdfeed)&&(!dev->leds)) { if (why_rtrn) *why_rtrn= XkbErr_BadClass; return NULL; } return dev; } DeviceIntPtr _XkbLookupButtonDevice(int id,int *why_rtrn) { DeviceIntPtr dev = NULL; if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL) return NULL; else if (!dev->button) { if (why_rtrn) *why_rtrn= XkbErr_BadClass; return NULL; } return dev; } void XkbSetActionKeyMods(XkbDescPtr xkb,XkbAction *act,unsigned mods) { register unsigned tmp; switch (act->type) { case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods: if (act->mods.flags&XkbSA_UseModMapMods) act->mods.real_mods= act->mods.mask= mods; if ((tmp= XkbModActionVMods(&act->mods))!=0) act->mods.mask|= XkbMaskForVMask(xkb,tmp); break; case XkbSA_ISOLock: if (act->iso.flags&XkbSA_UseModMapMods) act->iso.real_mods= act->iso.mask= mods; if ((tmp= XkbModActionVMods(&act->iso))!=0) act->iso.mask|= XkbMaskForVMask(xkb,tmp); break; } return; } unsigned XkbMaskForVMask(XkbDescPtr xkb,unsigned vmask) { register int i,bit; register unsigned mask; for (mask=i=0,bit=1;iserver->vmods[i]; } return mask; } /***====================================================================***/ void XkbUpdateKeyTypesFromCore( DeviceIntPtr pXDev, KeyCode first, CARD8 num, XkbChangesPtr changes) { XkbDescPtr xkb; unsigned key,nG,explicit; KeySymsPtr pCore; int types[XkbNumKbdGroups]; KeySym tsyms[XkbMaxSymsPerKey] = {NoSymbol},*syms; XkbMapChangesPtr mc; xkb= pXDev->key->xkbInfo->desc; if (first+num-1>xkb->max_key_code) { /* 1/12/95 (ef) -- XXX! should allow XKB structures to grow */ num= xkb->max_key_code-first+1; } mc= (changes?(&changes->map):NULL); pCore= &pXDev->key->curKeySyms; syms= &pCore->map[(first-xkb->min_key_code)*pCore->mapWidth]; for (key=first; key<(first+num); key++,syms+= pCore->mapWidth) { explicit= xkb->server->explicit[key]&XkbExplicitKeyTypesMask; types[XkbGroup1Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index); types[XkbGroup2Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup2Index); types[XkbGroup3Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup3Index); types[XkbGroup4Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup4Index); nG= XkbKeyTypesForCoreSymbols(xkb,pCore->mapWidth,syms,explicit,types, tsyms); XkbChangeTypesOfKey(xkb,key,nG,XkbAllGroupsMask,types,mc); memcpy((char *)XkbKeySymsPtr(xkb,key),(char *)tsyms, XkbKeyNumSyms(xkb,key)*sizeof(KeySym)); } if (changes->map.changed&XkbKeySymsMask) { CARD8 oldLast,newLast; oldLast = changes->map.first_key_sym+changes->map.num_key_syms-1; newLast = first+num-1; if (firstmap.first_key_sym) changes->map.first_key_sym = first; if (oldLast>newLast) newLast= oldLast; changes->map.num_key_syms = newLast-changes->map.first_key_sym+1; } else { changes->map.changed|= XkbKeySymsMask; changes->map.first_key_sym = first; changes->map.num_key_syms = num; } return; } void XkbUpdateDescActions( XkbDescPtr xkb, KeyCode first, CARD8 num, XkbChangesPtr changes) { register unsigned key; for (key=first;key<(first+num);key++) { XkbApplyCompatMapToKey(xkb,key,changes); } if (changes->map.changed&(XkbVirtualModMapMask|XkbModifierMapMask)) { unsigned char newVMods[XkbNumVirtualMods]; register unsigned bit,i; unsigned present; bzero(newVMods,XkbNumVirtualMods); present= 0; for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) { if (xkb->server->vmodmap[key]==0) continue; for (i=0,bit=1;iserver->vmodmap[key]) { present|= bit; newVMods[i]|= xkb->map->modmap[key]; } } } for (i=0,bit=1;iserver->vmods[i])) { changes->map.changed|= XkbVirtualModsMask; changes->map.vmods|= bit; xkb->server->vmods[i]= newVMods[i]; } } } if (changes->map.changed&XkbVirtualModsMask) XkbApplyVirtualModChanges(xkb,changes->map.vmods,changes); if (changes->map.changed&XkbKeyActionsMask) { CARD8 oldLast,newLast; oldLast= changes->map.first_key_act+changes->map.num_key_acts-1; newLast = first+num-1; if (firstmap.first_key_act) changes->map.first_key_act = first; if (newLast>oldLast) newLast= oldLast; changes->map.num_key_acts= newLast-changes->map.first_key_act+1; } else { changes->map.changed|= XkbKeyActionsMask; changes->map.first_key_act = first; changes->map.num_key_acts = num; } return; } void XkbUpdateActions( DeviceIntPtr pXDev, KeyCode first, CARD8 num, XkbChangesPtr changes, unsigned * needChecksRtrn, XkbEventCausePtr cause) { XkbSrvInfoPtr xkbi; XkbDescPtr xkb; CARD8 * repeat; if (needChecksRtrn) *needChecksRtrn= 0; xkbi= pXDev->key->xkbInfo; xkb= xkbi->desc; repeat= xkb->ctrls->per_key_repeat; if (pXDev->kbdfeed) memcpy(repeat,pXDev->kbdfeed->ctrl.autoRepeats,32); XkbUpdateDescActions(xkb,first,num,changes); if ((pXDev->kbdfeed)&& (changes->ctrls.enabled_ctrls_changes&XkbPerKeyRepeatMask)) { memcpy(pXDev->kbdfeed->ctrl.autoRepeats,repeat, 32); (*pXDev->kbdfeed->CtrlProc)(pXDev, &pXDev->kbdfeed->ctrl); } return; } void XkbUpdateCoreDescription(DeviceIntPtr keybd,Bool resize) { register int key,tmp; int maxSymsPerKey,maxKeysPerMod; int first,last,firstCommon,lastCommon; XkbDescPtr xkb; KeyClassPtr keyc; CARD8 keysPerMod[XkbNumModifiers]; if (!keybd || !keybd->key || !keybd->key->xkbInfo) return; xkb= keybd->key->xkbInfo->desc; keyc= keybd->key; maxSymsPerKey= maxKeysPerMod= 0; bzero(keysPerMod,sizeof(keysPerMod)); memcpy(keyc->modifierMap,xkb->map->modmap,xkb->max_key_code+1); if ((xkb->min_key_code==keyc->curKeySyms.minKeyCode)&& (xkb->max_key_code==keyc->curKeySyms.maxKeyCode)) { first= firstCommon= xkb->min_key_code; last= lastCommon= xkb->max_key_code; } else if (resize) { keyc->curKeySyms.minKeyCode= xkb->min_key_code; keyc->curKeySyms.maxKeyCode= xkb->max_key_code; tmp= keyc->curKeySyms.mapWidth*_XkbCoreNumKeys(keyc); keyc->curKeySyms.map= _XkbTypedRealloc(keyc->curKeySyms.map,tmp,KeySym); if (!keyc->curKeySyms.map) FatalError("Couldn't allocate keysyms\n"); first= firstCommon= xkb->min_key_code; last= lastCommon= xkb->max_key_code; } else { if (xkb->min_key_codecurKeySyms.minKeyCode) { first= xkb->min_key_code; firstCommon= keyc->curKeySyms.minKeyCode; } else { firstCommon= xkb->min_key_code; first= keyc->curKeySyms.minKeyCode; } if (xkb->max_key_code>keyc->curKeySyms.maxKeyCode) { lastCommon= keyc->curKeySyms.maxKeyCode; last= xkb->max_key_code; } else { lastCommon= xkb->max_key_code; last= keyc->curKeySyms.maxKeyCode; } } /* determine sizes */ for (key=first;key<=last;key++) { if (XkbKeycodeInRange(xkb,key)) { int nGroups; int w; nGroups= XkbKeyNumGroups(xkb,key); tmp= 0; if (nGroups>0) { if ((w=XkbKeyGroupWidth(xkb,key,XkbGroup1Index))<=2) tmp+= 2; else tmp+= w + 2; } if (nGroups>1) { if (tmp <= 2) { if ((w=XkbKeyGroupWidth(xkb,key,XkbGroup2Index))<2) tmp+= 2; else tmp+= w; } else { if ((w=XkbKeyGroupWidth(xkb,key,XkbGroup2Index))>2) tmp+= w - 2; } } if (nGroups>2) tmp+= XkbKeyGroupWidth(xkb,key,XkbGroup3Index); if (nGroups>3) tmp+= XkbKeyGroupWidth(xkb,key,XkbGroup4Index); if (tmp>maxSymsPerKey) maxSymsPerKey= tmp; } if (_XkbCoreKeycodeInRange(keyc,key)) { if (keyc->modifierMap[key]!=0) { register unsigned bit,i,mask; mask= keyc->modifierMap[key]; for (i=0,bit=1;imaxKeysPerMod) maxKeysPerMod= keysPerMod[i]; } } } } } if (maxKeysPerMod>0) { tmp= maxKeysPerMod*XkbNumModifiers; if (keyc->modifierKeyMap==NULL) keyc->modifierKeyMap= (KeyCode *)_XkbCalloc(1, tmp); else if (keyc->maxKeysPerModifiermodifierKeyMap= (KeyCode *)_XkbRealloc(keyc->modifierKeyMap,tmp); if (keyc->modifierKeyMap==NULL) FatalError("Couldn't allocate modifierKeyMap in UpdateCore\n"); bzero(keyc->modifierKeyMap,tmp); } else if ((keyc->maxKeysPerModifier>0)&&(keyc->modifierKeyMap!=NULL)) { _XkbFree(keyc->modifierKeyMap); keyc->modifierKeyMap= NULL; } keyc->maxKeysPerModifier= maxKeysPerMod; if (maxSymsPerKey>0) { tmp= maxSymsPerKey*_XkbCoreNumKeys(keyc); keyc->curKeySyms.map= _XkbTypedRealloc(keyc->curKeySyms.map,tmp,KeySym); if (keyc->curKeySyms.map==NULL) FatalError("Couldn't allocate symbols map in UpdateCore\n"); } else if ((keyc->curKeySyms.mapWidth>0)&&(keyc->curKeySyms.map!=NULL)) { _XkbFree(keyc->curKeySyms.map); keyc->curKeySyms.map= NULL; } keyc->curKeySyms.mapWidth= maxSymsPerKey; bzero(keysPerMod,sizeof(keysPerMod)); for (key=firstCommon;key<=lastCommon;key++) { if (keyc->curKeySyms.map!=NULL) { KeySym *pCore,*pXKB; unsigned nGroups,groupWidth,n,nOut; nGroups= XkbKeyNumGroups(xkb,key); n= (key-keyc->curKeySyms.minKeyCode)*maxSymsPerKey; pCore= &keyc->curKeySyms.map[n]; bzero(pCore,maxSymsPerKey*sizeof(KeySym)); pXKB= XkbKeySymsPtr(xkb,key); nOut= 2; if (nGroups>0) { groupWidth= XkbKeyGroupWidth(xkb,key,XkbGroup1Index); if (groupWidth>0) pCore[0]= pXKB[0]; if (groupWidth>1) pCore[1]= pXKB[1]; for (n=2;n2) nOut= groupWidth; } pXKB+= XkbKeyGroupsWidth(xkb,key); nOut+= 2; if (nGroups>1) { groupWidth= XkbKeyGroupWidth(xkb,key,XkbGroup2Index); if (groupWidth>0) pCore[2]= pXKB[0]; if (groupWidth>1) pCore[3]= pXKB[1]; for (n=2;n2) nOut+= (groupWidth-2); } pXKB+= XkbKeyGroupsWidth(xkb,key); for (n=XkbGroup3Index;n= 6 && (pCore[4] || pCore[5])) { pCore[2] = pCore[4]; pCore[3] = pCore[5]; } } if (keyc->modifierMap[key]!=0) { register unsigned bit,i,mask; mask= keyc->modifierMap[key]; for (i=0,bit=1;imodifierKeyMap[tmp]= key; keysPerMod[i]++; } } } } #ifdef MODE_SWITCH /* Fix up any of the KME stuff if we changed the core description. */ if (!noKME) HandleKeyBinding(keyc, &keyc->curKeySyms); #endif return; } void XkbSetRepeatKeys(DeviceIntPtr pXDev,int key,int onoff) { if (pXDev && pXDev->key && pXDev->key->xkbInfo) { xkbControlsNotify cn; XkbControlsPtr ctrls = pXDev->key->xkbInfo->desc->ctrls; XkbControlsRec old; old = *ctrls; if (key== -1) { /* global autorepeat setting changed */ if (onoff) ctrls->enabled_ctrls |= XkbRepeatKeysMask; else ctrls->enabled_ctrls &= ~XkbRepeatKeysMask; } else if (pXDev->kbdfeed) { ctrls->per_key_repeat[key/8] = pXDev->kbdfeed->ctrl.autoRepeats[key/8]; } if (XkbComputeControlsNotify(pXDev,&old,ctrls,&cn,True)) XkbSendControlsNotify(pXDev,&cn); } return; } void XkbApplyMappingChange( DeviceIntPtr kbd, CARD8 request, KeyCode firstKey, CARD8 num, ClientPtr client) { XkbEventCauseRec cause; XkbChangesRec changes; unsigned check; if (kbd->key->xkbInfo==NULL) XkbInitDevice(kbd); bzero(&changes,sizeof(XkbChangesRec)); check= 0; if (request==MappingKeyboard) { XkbSetCauseCoreReq(&cause,X_ChangeKeyboardMapping,client); XkbUpdateKeyTypesFromCore(kbd,firstKey,num,&changes); XkbUpdateActions(kbd,firstKey,num,&changes,&check,&cause); if (check) XkbCheckSecondaryEffects(kbd->key->xkbInfo,check,&changes,&cause); } else if (request==MappingModifier) { XkbDescPtr xkb= kbd->key->xkbInfo->desc; XkbSetCauseCoreReq(&cause,X_SetModifierMapping,client); num = xkb->max_key_code-xkb->min_key_code+1; memcpy(xkb->map->modmap,kbd->key->modifierMap,xkb->max_key_code+1); changes.map.changed|= XkbModifierMapMask; changes.map.first_modmap_key= xkb->min_key_code; changes.map.num_modmap_keys= num; XkbUpdateActions(kbd,xkb->min_key_code,num,&changes,&check,&cause); if (check) XkbCheckSecondaryEffects(kbd->key->xkbInfo,check,&changes,&cause); } /* 3/26/94 (ef) -- XXX! Doesn't deal with input extension requests */ XkbSendNotification(kbd,&changes,&cause); return; } void XkbDisableComputedAutoRepeats(DeviceIntPtr dev,unsigned key) { XkbSrvInfoPtr xkbi = dev->key->xkbInfo; xkbMapNotify mn; xkbi->desc->server->explicit[key]|= XkbExplicitAutoRepeatMask; bzero(&mn,sizeof(mn)); mn.changed= XkbExplicitComponentsMask; mn.firstKeyExplicit= key; mn.nKeyExplicit= 1; XkbSendMapNotify(dev,&mn); return; } unsigned XkbStateChangedFlags(XkbStatePtr old,XkbStatePtr new) { int changed; changed=(old->group!=new->group?XkbGroupStateMask:0); changed|=(old->base_group!=new->base_group?XkbGroupBaseMask:0); changed|=(old->latched_group!=new->latched_group?XkbGroupLatchMask:0); changed|=(old->locked_group!=new->locked_group?XkbGroupLockMask:0); changed|=(old->mods!=new->mods?XkbModifierStateMask:0); changed|=(old->base_mods!=new->base_mods?XkbModifierBaseMask:0); changed|=(old->latched_mods!=new->latched_mods?XkbModifierLatchMask:0); changed|=(old->locked_mods!=new->locked_mods?XkbModifierLockMask:0); changed|=(old->compat_state!=new->compat_state?XkbCompatStateMask:0); changed|=(old->grab_mods!=new->grab_mods?XkbGrabModsMask:0); if (old->compat_grab_mods!=new->compat_grab_mods) changed|= XkbCompatGrabModsMask; changed|=(old->lookup_mods!=new->lookup_mods?XkbLookupModsMask:0); if (old->compat_lookup_mods!=new->compat_lookup_mods) changed|= XkbCompatLookupModsMask; changed|=(old->ptr_buttons!=new->ptr_buttons?XkbPointerButtonMask:0); return changed; } void XkbComputeCompatState(XkbSrvInfoPtr xkbi) { CARD16 grp_mask; XkbStatePtr state= &xkbi->state; XkbCompatMapPtr map; if (!state || !xkbi->desc || !xkbi->desc->ctrls || !xkbi->desc->compat) return; map= xkbi->desc->compat; grp_mask= map->groups[state->group].mask; state->compat_state = state->mods|grp_mask; state->compat_lookup_mods= state->lookup_mods|grp_mask; if (xkbi->desc->ctrls->enabled_ctrls&XkbIgnoreGroupLockMask) grp_mask= map->groups[state->base_group].mask; state->compat_grab_mods= state->grab_mods|grp_mask; return; } unsigned XkbAdjustGroup(int group,XkbControlsPtr ctrls) { unsigned act; act= XkbOutOfRangeGroupAction(ctrls->groups_wrap); if (group<0) { while ( group < 0 ) { if (act==XkbClampIntoRange) { group= XkbGroup1Index; } else if (act==XkbRedirectIntoRange) { int newGroup; newGroup= XkbOutOfRangeGroupNumber(ctrls->groups_wrap); if (newGroup>=ctrls->num_groups) group= XkbGroup1Index; else group= newGroup; } else { group+= ctrls->num_groups; } } } else if (group>=ctrls->num_groups) { if (act==XkbClampIntoRange) { group= ctrls->num_groups-1; } else if (act==XkbRedirectIntoRange) { int newGroup; newGroup= XkbOutOfRangeGroupNumber(ctrls->groups_wrap); if (newGroup>=ctrls->num_groups) group= XkbGroup1Index; else group= newGroup; } else { #ifdef NXAGENT_SERVER /* we have seen division by zero here */ if (ctrls->num_groups != 0) #endif group%= ctrls->num_groups; } } return group; } void XkbComputeDerivedState(XkbSrvInfoPtr xkbi) { XkbStatePtr state= &xkbi->state; XkbControlsPtr ctrls= xkbi->desc->ctrls; unsigned char grp; if (!state || !ctrls) return; state->mods= (state->base_mods|state->latched_mods); state->mods|= state->locked_mods; state->lookup_mods= state->mods&(~ctrls->internal.mask); state->grab_mods= state->lookup_mods&(~ctrls->ignore_lock.mask); state->grab_mods|= ((state->base_mods|state->latched_mods)&ctrls->ignore_lock.mask); grp= state->locked_group; if (grp>=ctrls->num_groups) state->locked_group= XkbAdjustGroup(XkbCharToInt(grp),ctrls); grp= state->locked_group+state->base_group+state->latched_group; if (grp>=ctrls->num_groups) state->group= XkbAdjustGroup(XkbCharToInt(grp),ctrls); else state->group= grp; XkbComputeCompatState(xkbi); return; } /***====================================================================***/ void XkbCheckSecondaryEffects( XkbSrvInfoPtr xkbi, unsigned which, XkbChangesPtr changes, XkbEventCausePtr cause) { if (which&XkbStateNotifyMask) { XkbStateRec old; old= xkbi->state; changes->state_changes|= XkbStateChangedFlags(&old,&xkbi->state); XkbComputeDerivedState(xkbi); } if (which&XkbIndicatorStateNotifyMask) XkbUpdateIndicators(xkbi->device,XkbAllIndicatorsMask,True,changes, cause); return; } /***====================================================================***/ Bool XkbEnableDisableControls( XkbSrvInfoPtr xkbi, unsigned long change, unsigned long newValues, XkbChangesPtr changes, XkbEventCausePtr cause) { XkbControlsPtr ctrls; unsigned old; XkbSrvLedInfoPtr sli; ctrls= xkbi->desc->ctrls; old= ctrls->enabled_ctrls; ctrls->enabled_ctrls&= ~change; ctrls->enabled_ctrls|= (change&newValues); if (old==ctrls->enabled_ctrls) return False; if (cause!=NULL) { xkbControlsNotify cn; cn.numGroups= ctrls->num_groups; cn.changedControls= XkbControlsEnabledMask; cn.enabledControls= ctrls->enabled_ctrls; cn.enabledControlChanges= (ctrls->enabled_ctrls^old); cn.keycode= cause->kc; cn.eventType= cause->event; cn.requestMajor= cause->mjr; cn.requestMinor= cause->mnr; XkbSendControlsNotify(xkbi->device,&cn); } else { /* Yes, this really should be an XOR. If ctrls->enabled_ctrls_changes*/ /* is non-zero, the controls in question changed already in "this" */ /* request and this change merely undoes the previous one. By the */ /* same token, we have to figure out whether or not ControlsEnabled */ /* should be set or not in the changes structure */ changes->ctrls.enabled_ctrls_changes^= (ctrls->enabled_ctrls^old); if (changes->ctrls.enabled_ctrls_changes) changes->ctrls.changed_ctrls|= XkbControlsEnabledMask; else changes->ctrls.changed_ctrls&= ~XkbControlsEnabledMask; } sli= XkbFindSrvLedInfo(xkbi->device,XkbDfltXIClass,XkbDfltXIId,0); XkbUpdateIndicators(xkbi->device,sli->usesControls,True,changes,cause); return True; } /***====================================================================***/ #define MAX_TOC 16 XkbGeometryPtr XkbLookupNamedGeometry(DeviceIntPtr dev,Atom name,Bool *shouldFree) { XkbSrvInfoPtr xkbi= dev->key->xkbInfo; XkbDescPtr xkb= xkbi->desc; *shouldFree= 0; if (name==None) { if (xkb->geom!=NULL) return xkb->geom; name= xkb->names->geometry; } if ((xkb->geom!=NULL)&&(xkb->geom->name==name)) return xkb->geom; *shouldFree= 1; return NULL; } void XkbConvertCase(register KeySym sym, KeySym *lower, KeySym *upper) { *lower = sym; *upper = sym; switch(sym >> 8) { case 0: /* Latin 1 */ if ((sym >= XK_A) && (sym <= XK_Z)) *lower += (XK_a - XK_A); else if ((sym >= XK_a) && (sym <= XK_z)) *upper -= (XK_a - XK_A); else if ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis)) *lower += (XK_agrave - XK_Agrave); else if ((sym >= XK_agrave) && (sym <= XK_odiaeresis)) *upper -= (XK_agrave - XK_Agrave); else if ((sym >= XK_Ooblique) && (sym <= XK_Thorn)) *lower += (XK_oslash - XK_Ooblique); else if ((sym >= XK_oslash) && (sym <= XK_thorn)) *upper -= (XK_oslash - XK_Ooblique); break; case 1: /* Latin 2 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym == XK_Aogonek) *lower = XK_aogonek; else if (sym >= XK_Lstroke && sym <= XK_Sacute) *lower += (XK_lstroke - XK_Lstroke); else if (sym >= XK_Scaron && sym <= XK_Zacute) *lower += (XK_scaron - XK_Scaron); else if (sym >= XK_Zcaron && sym <= XK_Zabovedot) *lower += (XK_zcaron - XK_Zcaron); else if (sym == XK_aogonek) *upper = XK_Aogonek; else if (sym >= XK_lstroke && sym <= XK_sacute) *upper -= (XK_lstroke - XK_Lstroke); else if (sym >= XK_scaron && sym <= XK_zacute) *upper -= (XK_scaron - XK_Scaron); else if (sym >= XK_zcaron && sym <= XK_zabovedot) *upper -= (XK_zcaron - XK_Zcaron); else if (sym >= XK_Racute && sym <= XK_Tcedilla) *lower += (XK_racute - XK_Racute); else if (sym >= XK_racute && sym <= XK_tcedilla) *upper -= (XK_racute - XK_Racute); break; case 2: /* Latin 3 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= XK_Hstroke && sym <= XK_Hcircumflex) *lower += (XK_hstroke - XK_Hstroke); else if (sym >= XK_Gbreve && sym <= XK_Jcircumflex) *lower += (XK_gbreve - XK_Gbreve); else if (sym >= XK_hstroke && sym <= XK_hcircumflex) *upper -= (XK_hstroke - XK_Hstroke); else if (sym >= XK_gbreve && sym <= XK_jcircumflex) *upper -= (XK_gbreve - XK_Gbreve); else if (sym >= XK_Cabovedot && sym <= XK_Scircumflex) *lower += (XK_cabovedot - XK_Cabovedot); else if (sym >= XK_cabovedot && sym <= XK_scircumflex) *upper -= (XK_cabovedot - XK_Cabovedot); break; case 3: /* Latin 4 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= XK_Rcedilla && sym <= XK_Tslash) *lower += (XK_rcedilla - XK_Rcedilla); else if (sym >= XK_rcedilla && sym <= XK_tslash) *upper -= (XK_rcedilla - XK_Rcedilla); else if (sym == XK_ENG) *lower = XK_eng; else if (sym == XK_eng) *upper = XK_ENG; else if (sym >= XK_Amacron && sym <= XK_Umacron) *lower += (XK_amacron - XK_Amacron); else if (sym >= XK_amacron && sym <= XK_umacron) *upper -= (XK_amacron - XK_Amacron); break; case 6: /* Cyrillic */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= XK_Serbian_DJE && sym <= XK_Serbian_DZE) *lower -= (XK_Serbian_DJE - XK_Serbian_dje); else if (sym >= XK_Serbian_dje && sym <= XK_Serbian_dze) *upper += (XK_Serbian_DJE - XK_Serbian_dje); else if (sym >= XK_Cyrillic_YU && sym <= XK_Cyrillic_HARDSIGN) *lower -= (XK_Cyrillic_YU - XK_Cyrillic_yu); else if (sym >= XK_Cyrillic_yu && sym <= XK_Cyrillic_hardsign) *upper += (XK_Cyrillic_YU - XK_Cyrillic_yu); break; case 7: /* Greek */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= XK_Greek_ALPHAaccent && sym <= XK_Greek_OMEGAaccent) *lower += (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent); else if (sym >= XK_Greek_alphaaccent && sym <= XK_Greek_omegaaccent && sym != XK_Greek_iotaaccentdieresis && sym != XK_Greek_upsilonaccentdieresis) *upper -= (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent); else if (sym >= XK_Greek_ALPHA && sym <= XK_Greek_OMEGA) *lower += (XK_Greek_alpha - XK_Greek_ALPHA); else if (sym >= XK_Greek_alpha && sym <= XK_Greek_omega && sym != XK_Greek_finalsmallsigma) *upper -= (XK_Greek_alpha - XK_Greek_ALPHA); break; } } nx-libs-3.5.99.23/nx-X11/programs/Xserver/xkb/xkmread.c0000644000000000000000000010660313614532331017164 0ustar /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifdef HAVE_DIX_CONFIG_H #include #endif #include #include #include #include #include #include #include "misc.h" #include "inputstr.h" #include "xkbstr.h" #include "xkbsrv.h" #include "xkbgeom.h" Atom XkbInternAtom(Display *dpy,char *str,Bool only_if_exists) { if (str==NULL) return None; return MakeAtom(str,strlen(str),!only_if_exists); } /***====================================================================***/ static XPointer XkmInsureSize(XPointer oldPtr,int oldCount,int *newCountRtrn,int elemSize) { int newCount= *newCountRtrn; if (oldPtr==NULL) { if (newCount==0) return NULL; oldPtr= (XPointer)_XkbCalloc(newCount,elemSize); } else if (oldCount0) { int tmp; if (count>max_len) { tmp= fread(str,1,max_len,file); while (tmp=max_len) str[max_len-1]= '\0'; else str[count]= '\0'; count= XkbPaddedSize(nRead)-nRead; if (count>0) nRead+= XkmSkipPadding(file,count); return nRead; } /***====================================================================***/ static int ReadXkmVirtualMods(FILE *file,XkbFileInfo *result,XkbChangesPtr changes) { register unsigned int i,bit; unsigned int bound,named,tmp; int nRead=0; XkbDescPtr xkb; xkb= result->xkb; if (XkbAllocServerMap(xkb,XkbVirtualModsMask,0)!=Success) { _XkbLibError(_XkbErrBadAlloc,"ReadXkmVirtualMods",0); return -1; } bound= XkmGetCARD16(file,&nRead); named= XkmGetCARD16(file,&nRead); for (i=tmp=0,bit=1;iserver->vmods[i]= XkmGetCARD8(file,&nRead); if (changes) changes->map.vmods|= bit; tmp++; } } if ((i= XkbPaddedSize(tmp)-tmp)>0) nRead+= XkmSkipPadding(file,i); if (XkbAllocNames(xkb,XkbVirtualModNamesMask,0,0)!=Success) { _XkbLibError(_XkbErrBadAlloc,"ReadXkmVirtualMods",0); return -1; } for (i=0,bit=1;inames->vmods[i]= XkbInternAtom(xkb->dpy,name,False); if (changes) changes->names.changed_vmods|= bit; } } } return nRead; } /***====================================================================***/ static int ReadXkmKeycodes(FILE *file,XkbFileInfo *result,XkbChangesPtr changes) { register int i; unsigned minKC,maxKC,nAl; int nRead=0; char name[100]; XkbKeyNamePtr pN; XkbDescPtr xkb; xkb= result->xkb; name[0]= '\0'; nRead+= XkmGetCountedString(file,name,100); minKC= XkmGetCARD8(file,&nRead); maxKC= XkmGetCARD8(file,&nRead); if (xkb->min_key_code==0) { xkb->min_key_code= minKC; xkb->max_key_code= maxKC; } else { if (minKCmin_key_code) xkb->min_key_code= minKC; if (maxKC>xkb->max_key_code) { _XkbLibError(_XkbErrBadValue,"ReadXkmKeycodes",maxKC); return -1; } } nAl= XkmGetCARD8(file,&nRead); nRead+= XkmSkipPadding(file,1); #define WANTED (XkbKeycodesNameMask|XkbKeyNamesMask|XkbKeyAliasesMask) if (XkbAllocNames(xkb,WANTED,0,nAl)!=Success) { _XkbLibError(_XkbErrBadAlloc,"ReadXkmKeycodes",0); return -1; } if (name[0]!='\0') { xkb->names->keycodes= XkbInternAtom(xkb->dpy,name,False); } for (pN=&xkb->names->keys[minKC],i=minKC;i<=(int)maxKC;i++,pN++) { if (fread(pN,1,XkbKeyNameLength,file)!=XkbKeyNameLength) { _XkbLibError(_XkbErrBadLength,"ReadXkmKeycodes",0); return -1; } nRead+= XkbKeyNameLength; } if (nAl>0) { XkbKeyAliasPtr pAl; for (pAl= xkb->names->key_aliases,i=0;inames.changed|= XkbKeyAliasesMask; } if (changes) changes->names.changed|= XkbKeyNamesMask; return nRead; } /***====================================================================***/ static int ReadXkmKeyTypes(FILE *file,XkbFileInfo *result,XkbChangesPtr changes) { register unsigned i,n; unsigned num_types; int nRead=0; int tmp; XkbKeyTypePtr type; xkmKeyTypeDesc wire; XkbKTMapEntryPtr entry; xkmKTMapEntryDesc wire_entry; char buf[100]; XkbDescPtr xkb; xkb= result->xkb; if ((tmp= XkmGetCountedString(file,buf,100))<1) { _XkbLibError(_XkbErrBadLength,"ReadXkmKeyTypes",0); return -1; } nRead+= tmp; if (buf[0]!='\0') { if (XkbAllocNames(xkb,XkbTypesNameMask,0,0)!=Success) { _XkbLibError(_XkbErrBadAlloc,"ReadXkmKeyTypes",0); return -1; } xkb->names->types= XkbInternAtom(xkb->dpy,buf,False); } num_types= XkmGetCARD16(file,&nRead); nRead+= XkmSkipPadding(file,2); if (num_types<1) return nRead; if (XkbAllocClientMap(xkb,XkbKeyTypesMask,num_types)!=Success) { _XkbLibError(_XkbErrBadAlloc,"ReadXkmKeyTypes",0); return nRead; } xkb->map->num_types= num_types; if (num_typesmap->types; for (i=0;imap,type->map_count,&tmp,XkbKTMapEntryRec); if ((wire.nMapEntries>0)&&(type->map==NULL)) { _XkbLibError(_XkbErrBadValue,"ReadXkmKeyTypes",wire.nMapEntries); return -1; } for (n=0,entry= type->map;nactive= (wire_entry.virtualMods==0); entry->level= wire_entry.level; entry->mods.mask= wire_entry.realMods; entry->mods.real_mods= wire_entry.realMods; entry->mods.vmods= wire_entry.virtualMods; } nRead+= XkmGetCountedString(file,buf,100); if (((i==XkbOneLevelIndex)&&(strcmp(buf,"ONE_LEVEL")!=0))|| ((i==XkbTwoLevelIndex)&&(strcmp(buf,"TWO_LEVEL")!=0))|| ((i==XkbAlphabeticIndex)&&(strcmp(buf,"ALPHABETIC")!=0))|| ((i==XkbKeypadIndex)&&(strcmp(buf,"KEYPAD")!=0))) { _XkbLibError(_XkbErrBadTypeName,"ReadXkmKeyTypes",0); return -1; } if (buf[0]!='\0') { type->name= XkbInternAtom(xkb->dpy,buf,False); } else type->name= None; if (wire.preserve) { xkmModsDesc p_entry; XkbModsPtr pre; XkmInsureTypedSize(type->preserve,type->map_count,&tmp, XkbModsRec); if (type->preserve==NULL) { _XkbLibError(_XkbErrBadMatch,"ReadXkmKeycodes",0); return -1; } for (n=0,pre=type->preserve;nmask= p_entry.realMods; pre->real_mods= p_entry.realMods; pre->vmods= p_entry.virtualMods; } } if (wire.nLevelNames>0) { int width= wire.numLevels; if (wire.nLevelNames>(unsigned)width) { _XkbLibError(_XkbErrBadMatch,"ReadXkmKeycodes",0); return -1; } XkmInsureTypedSize(type->level_names,type->num_levels,&width,Atom); if (type->level_names!=NULL) { for (n=0;nlevel_names[n]= None; else type->level_names[n]= XkbInternAtom(xkb->dpy,buf,0); } } } type->mods.mask= wire.realMods; type->mods.real_mods= wire.realMods; type->mods.vmods= wire.virtualMods; type->num_levels= wire.numLevels; type->map_count= wire.nMapEntries; } if (changes) { changes->map.changed|= XkbKeyTypesMask; changes->map.first_type= 0; changes->map.num_types= xkb->map->num_types; } return nRead; } /***====================================================================***/ static int ReadXkmCompatMap(FILE *file,XkbFileInfo *result,XkbChangesPtr changes) { register int i; unsigned num_si,groups; char name[100]; XkbSymInterpretPtr interp; xkmSymInterpretDesc wire; unsigned tmp; int nRead=0; XkbDescPtr xkb; XkbCompatMapPtr compat; xkb= result->xkb; if ((tmp= XkmGetCountedString(file,name,100))<1) { _XkbLibError(_XkbErrBadLength,"ReadXkmCompatMap",0); return -1; } nRead+= tmp; if (name[0]!='\0') { if (XkbAllocNames(xkb,XkbCompatNameMask,0,0)!=Success) { _XkbLibError(_XkbErrBadAlloc,"ReadXkmCompatMap",0); return -1; } xkb->names->compat= XkbInternAtom(xkb->dpy,name,False); } num_si= XkmGetCARD16(file,&nRead); groups= XkmGetCARD8(file,&nRead); nRead+= XkmSkipPadding(file,1); if (XkbAllocCompatMap(xkb,XkbAllCompatMask,num_si)!=Success) return -1; compat= xkb->compat; compat->num_si= num_si; interp= compat->sym_interpret; for (i=0;isym= wire.sym; interp->mods= wire.mods; interp->match= wire.match; interp->virtual_mod= wire.virtualMod; interp->flags= wire.flags; interp->act.type= wire.actionType; interp->act.data[0]= wire.actionData[0]; interp->act.data[1]= wire.actionData[1]; interp->act.data[2]= wire.actionData[2]; interp->act.data[3]= wire.actionData[3]; interp->act.data[4]= wire.actionData[4]; interp->act.data[5]= wire.actionData[5]; interp->act.data[6]= wire.actionData[6]; } if ((num_si>0)&&(changes)) { changes->compat.first_si= 0; changes->compat.num_si= num_si; } if (groups) { register unsigned bit; for (i=0,bit=1;icompat->groups[i].real_mods= md.realMods; xkb->compat->groups[i].vmods= md.virtualMods; if (md.virtualMods != 0) { unsigned mask; if (XkbVirtualModsToReal(xkb,md.virtualMods,&mask)) xkb->compat->groups[i].mask= md.realMods|mask; } else xkb->compat->groups[i].mask= md.realMods; } } if (changes) changes->compat.changed_groups|= groups; } return nRead; } static int ReadXkmIndicators(FILE *file,XkbFileInfo *result,XkbChangesPtr changes) { register unsigned nLEDs; xkmIndicatorMapDesc wire; char buf[100]; unsigned tmp; int nRead=0; XkbDescPtr xkb; xkb= result->xkb; if ((xkb->indicators==NULL)&&(XkbAllocIndicatorMaps(xkb)!=Success)) { _XkbLibError(_XkbErrBadAlloc,"indicator rec",0); return -1; } if (XkbAllocNames(xkb,XkbIndicatorNamesMask,0,0)!=Success) { _XkbLibError(_XkbErrBadAlloc,"indicator names",0); return -1; } nLEDs= XkmGetCARD8(file,&nRead); nRead+= XkmSkipPadding(file,3); xkb->indicators->phys_indicators= XkmGetCARD32(file,&nRead); while (nLEDs-->0) { Atom name; XkbIndicatorMapPtr map; if ((tmp=XkmGetCountedString(file,buf,100))<1) { _XkbLibError(_XkbErrBadLength,"ReadXkmIndicators",0); return -1; } nRead+= tmp; if (buf[0]!='\0') name= XkbInternAtom(xkb->dpy,buf,False); else name= None; if ((tmp=fread(&wire,SIZEOF(xkmIndicatorMapDesc),1,file))<1) { _XkbLibError(_XkbErrBadLength,"ReadXkmIndicators",0); return -1; } nRead+= tmp*SIZEOF(xkmIndicatorMapDesc); if (xkb->names) { xkb->names->indicators[wire.indicator-1]= name; if (changes) changes->names.changed_indicators|= (1<<(wire.indicator-1)); } map= &xkb->indicators->maps[wire.indicator-1]; map->flags= wire.flags; map->which_groups= wire.which_groups; map->groups= wire.groups; map->which_mods= wire.which_mods; map->mods.mask= wire.real_mods; map->mods.real_mods= wire.real_mods; map->mods.vmods= wire.vmods; map->ctrls= wire.ctrls; } return nRead; } static XkbKeyTypePtr FindTypeForKey(XkbDescPtr xkb,Atom name,unsigned width,KeySym *syms) { if ((!xkb)||(!xkb->map)) return NULL; if (name!=None) { register unsigned i; for (i=0;imap->num_types;i++) { if (xkb->map->types[i].name==name) { if (xkb->map->types[i].num_levels!=width) DebugF("Group width mismatch between key and type\n"); return &xkb->map->types[i]; } } } if ((width<2)||((syms!=NULL)&&(syms[1]==NoSymbol))) return &xkb->map->types[XkbOneLevelIndex]; if (syms!=NULL) { if (XkbKSIsLower(syms[0])&&XkbKSIsUpper(syms[1])) return &xkb->map->types[XkbAlphabeticIndex]; else if (XkbKSIsKeypad(syms[0])||XkbKSIsKeypad(syms[1])) return &xkb->map->types[XkbKeypadIndex]; } return &xkb->map->types[XkbTwoLevelIndex]; } static int ReadXkmSymbols(FILE *file,XkbFileInfo *result) { register int i,g,s,totalVModMaps; xkmKeySymMapDesc wireMap; char buf[100]; unsigned minKC,maxKC,groupNames,tmp; int nRead=0; XkbDescPtr xkb; xkb= result->xkb; if ((tmp=XkmGetCountedString(file,buf,100))<1) return -1; nRead+= tmp; minKC= XkmGetCARD8(file,&nRead); maxKC= XkmGetCARD8(file,&nRead); groupNames= XkmGetCARD8(file,&nRead); totalVModMaps= XkmGetCARD8(file,&nRead); if (XkbAllocNames(xkb, XkbSymbolsNameMask|XkbPhysSymbolsNameMask|XkbGroupNamesMask, 0,0)!=Success) { _XkbLibError(_XkbErrBadAlloc,"physical names",0); return -1; } if ((buf[0]!='\0')&&(xkb->names)) { Atom name; name= XkbInternAtom(xkb->dpy,buf,0); xkb->names->symbols= name; xkb->names->phys_symbols= name; } for (i=0,g=1;inames)) { Atom name; name= XkbInternAtom(xkb->dpy,buf,0); xkb->names->groups[i]= name; } else xkb->names->groups[i]= None; } } if (XkbAllocServerMap(xkb,XkbAllServerInfoMask,0)!=Success) { _XkbLibError(_XkbErrBadAlloc,"server map",0); return -1; } if (XkbAllocClientMap(xkb,XkbAllClientInfoMask,0)!=Success) { _XkbLibError(_XkbErrBadAlloc,"client map",0); return -1; } if (XkbAllocControls(xkb,XkbAllControlsMask)!=Success) { _XkbLibError(_XkbErrBadAlloc,"controls",0); return -1; } if ((xkb->map==NULL)||(xkb->server==NULL)) return -1; if (xkb->min_key_code<8) xkb->min_key_code= minKC; if (xkb->max_key_code<8) xkb->max_key_code= maxKC; if ((minKC>=8)&&(minKCmin_key_code)) xkb->min_key_code= minKC; if ((maxKC>=8)&&(maxKC>xkb->max_key_code)) { _XkbLibError(_XkbErrBadValue,"keys in symbol map",maxKC); return -1; } for (i=minKC;i<=(int)maxKC;i++) { Atom typeName[XkbNumKbdGroups]; XkbKeyTypePtr type[XkbNumKbdGroups]; if ((tmp=fread(&wireMap,SIZEOF(xkmKeySymMapDesc),1,file))<1) { _XkbLibError(_XkbErrBadLength,"ReadXkmSymbols",0); return -1; } nRead+= tmp*SIZEOF(xkmKeySymMapDesc); bzero((char *)typeName,XkbNumKbdGroups*sizeof(Atom)); bzero((char *)type,XkbNumKbdGroups*sizeof(XkbKeyTypePtr)); if (wireMap.flags&XkmKeyHasTypes) { for (g=0;g0)) { typeName[g]= XkbInternAtom(xkb->dpy,buf,1); nRead+= tmp; } type[g]=FindTypeForKey(xkb,typeName[g],wireMap.width,NULL); if (type[g]==NULL) { _XkbLibError(_XkbErrMissingTypes,"ReadXkmSymbols",0); return -1; } if (typeName[g]==type[g]->name) xkb->server->explicit[i]|= (1<ctrls->per_key_repeat[i/8]|= (1<<(i%8)); xkb->server->explicit[i]|= XkbExplicitAutoRepeatMask; } else if (wireMap.flags&XkmNonRepeatingKey) { xkb->ctrls->per_key_repeat[i/8]&= ~(1<<(i%8)); xkb->server->explicit[i]|= XkbExplicitAutoRepeatMask; } xkb->map->modmap[i]= wireMap.modifier_map; if (XkbNumGroups(wireMap.num_groups)>0) { KeySym *sym; int nSyms; if (XkbNumGroups(wireMap.num_groups)>xkb->ctrls->num_groups) xkb->ctrls->num_groups= wireMap.num_groups; nSyms= XkbNumGroups(wireMap.num_groups)*wireMap.width; sym= XkbResizeKeySyms(xkb,i,nSyms); if (!sym) return -1; for (s=0;sserver->explicit[i]|= XkbExplicitInterpretMask; } } for (g=0;gserver->explicit[i]&(1<map->key_sym_map[i].kt_index[g]= type[g]-(&xkb->map->types[0]); } xkb->map->key_sym_map[i].group_info= wireMap.num_groups; xkb->map->key_sym_map[i].width= wireMap.width; if (wireMap.flags&XkmKeyHasBehavior) { xkmBehaviorDesc b; tmp= fread(&b,SIZEOF(xkmBehaviorDesc),1,file); nRead+= tmp*SIZEOF(xkmBehaviorDesc); xkb->server->behaviors[i].type= b.type; xkb->server->behaviors[i].data= b.data; xkb->server->explicit[i]|= XkbExplicitBehaviorMask; } } if (totalVModMaps>0) { xkmVModMapDesc v; for (i=0;i0) xkb->server->vmodmap[v.key]= v.vmods; } } return nRead; } static int ReadXkmGeomDoodad( FILE * file, Display * dpy, XkbGeometryPtr geom, XkbSectionPtr section) { XkbDoodadPtr doodad; xkmDoodadDesc doodadWire; char buf[100]; unsigned tmp; int nRead=0; nRead+= XkmGetCountedString(file,buf,100); tmp= fread(&doodadWire,SIZEOF(xkmDoodadDesc),1,file); nRead+= SIZEOF(xkmDoodadDesc)*tmp; doodad= XkbAddGeomDoodad(geom,section,XkbInternAtom(dpy,buf,False)); if (!doodad) return nRead; doodad->any.type= doodadWire.any.type; doodad->any.priority= doodadWire.any.priority; doodad->any.top= doodadWire.any.top; doodad->any.left= doodadWire.any.left; switch (doodadWire.any.type) { case XkbOutlineDoodad: case XkbSolidDoodad: doodad->shape.angle= doodadWire.shape.angle; doodad->shape.color_ndx= doodadWire.shape.color_ndx; doodad->shape.shape_ndx= doodadWire.shape.shape_ndx; break; case XkbTextDoodad: doodad->text.angle= doodadWire.text.angle; doodad->text.width= doodadWire.text.width; doodad->text.height= doodadWire.text.height; doodad->text.color_ndx= doodadWire.text.color_ndx; nRead+= XkmGetCountedString(file,buf,100); doodad->text.text= Xstrdup(buf); nRead+= XkmGetCountedString(file,buf,100); doodad->text.font= Xstrdup(buf); break; case XkbIndicatorDoodad: doodad->indicator.shape_ndx= doodadWire.indicator.shape_ndx; doodad->indicator.on_color_ndx= doodadWire.indicator.on_color_ndx; doodad->indicator.off_color_ndx= doodadWire.indicator.off_color_ndx; break; case XkbLogoDoodad: doodad->logo.angle= doodadWire.logo.angle; doodad->logo.color_ndx= doodadWire.logo.color_ndx; doodad->logo.shape_ndx= doodadWire.logo.shape_ndx; nRead+= XkmGetCountedString(file,buf,100); doodad->logo.logo_name= Xstrdup(buf); break; default: /* report error? */ return nRead; } return nRead; } static int ReadXkmGeomOverlay( FILE * file, Display * dpy, XkbGeometryPtr geom, XkbSectionPtr section) { char buf[100]; unsigned tmp; int nRead=0; XkbOverlayPtr ol; XkbOverlayRowPtr row; xkmOverlayDesc olWire; xkmOverlayRowDesc rowWire; register int r; nRead+= XkmGetCountedString(file,buf,100); tmp= fread(&olWire,SIZEOF(xkmOverlayDesc),1,file); nRead+= tmp*SIZEOF(xkmOverlayDesc); ol= XkbAddGeomOverlay(section,XkbInternAtom(dpy,buf,False), olWire.num_rows); if (!ol) return nRead; for (r=0;rkeys[k].over.name,keyWire.over,XkbKeyNameLength); memcpy(row->keys[k].under.name,keyWire.under,XkbKeyNameLength); } row->num_keys= rowWire.num_keys; } return nRead; } static int ReadXkmGeomSection( FILE * file, Display * dpy, XkbGeometryPtr geom) { register int i; XkbSectionPtr section; xkmSectionDesc sectionWire; unsigned tmp; int nRead= 0; char buf[100]; Atom nameAtom; nRead+= XkmGetCountedString(file,buf,100); nameAtom= XkbInternAtom(dpy,buf,False); tmp= fread(§ionWire,SIZEOF(xkmSectionDesc),1,file); nRead+= SIZEOF(xkmSectionDesc)*tmp; section= XkbAddGeomSection(geom,nameAtom,sectionWire.num_rows, sectionWire.num_doodads, sectionWire.num_overlays); if (!section) { _XkbLibError(_XkbErrBadAlloc,"ReadXkmGeomSection",0); return nRead; } section->top= sectionWire.top; section->left= sectionWire.left; section->width= sectionWire.width; section->height= sectionWire.height; section->angle= sectionWire.angle; section->priority= sectionWire.priority; if (sectionWire.num_rows>0) { register int k; XkbRowPtr row; xkmRowDesc rowWire; XkbKeyPtr key; xkmKeyDesc keyWire; for (i=0;itop= rowWire.top; row->left= rowWire.left; row->vertical= rowWire.vertical; for (k=0;kname.name,keyWire.name,XkbKeyNameLength); key->gap= keyWire.gap; key->shape_ndx= keyWire.shape_ndx; key->color_ndx= keyWire.color_ndx; } } } if (sectionWire.num_doodads>0) { for (i=0;i0) { for (i=0;ixkb,&sizes)!=Success) { _XkbLibError(_XkbErrBadAlloc,"ReadXkmGeometry",0); return nRead; } geom= result->xkb->geom; geom->name= XkbInternAtom(result->xkb->dpy,buf,False); geom->width_mm= wireGeom.width_mm; geom->height_mm= wireGeom.height_mm; nRead+= XkmGetCountedString(file,buf,100); geom->label_font= Xstrdup(buf); if (wireGeom.num_properties>0) { char val[1024]; for (i=0;i0) { for (i=0;ibase_color= &geom->colors[wireGeom.base_color_ndx]; geom->label_color= &geom->colors[wireGeom.label_color_ndx]; if (wireGeom.num_shapes>0) { XkbShapePtr shape; xkmShapeDesc shapeWire; Atom nameAtom; for (i=0;ixkb->dpy,buf,False); tmp= fread(&shapeWire,SIZEOF(xkmShapeDesc),1,file); nRead+= tmp*SIZEOF(xkmShapeDesc); shape= XkbAddGeomShape(geom,nameAtom,shapeWire.num_outlines); if (!shape) { _XkbLibError(_XkbErrBadAlloc,"ReadXkmGeometry",0); return nRead; } for (n=0;nnum_points= olWire.num_points; ol->corner_radius= olWire.corner_radius; for (p=0;ppoints[p].x= ptWire.x; ol->points[p].y= ptWire.y; if (ptWire.xbounds.x1) shape->bounds.x1= ptWire.x; if (ptWire.x>shape->bounds.x2) shape->bounds.x2= ptWire.x; if (ptWire.ybounds.y1) shape->bounds.y1= ptWire.y; if (ptWire.y>shape->bounds.y2) shape->bounds.y2= ptWire.y; } } if (shapeWire.primary_ndx!=XkbNoShape) shape->primary= &shape->outlines[shapeWire.primary_ndx]; if (shapeWire.approx_ndx!=XkbNoShape) shape->approx= &shape->outlines[shapeWire.approx_ndx]; } } if (wireGeom.num_sections>0) { for (i=0;ixkb->dpy,geom); nRead+= tmp; if (tmp==0) return nRead; } } if (wireGeom.num_doodads>0) { for (i=0;ixkb->dpy,geom,NULL); nRead+= tmp; if (tmp==0) return nRead; } } if ((wireGeom.num_key_aliases>0)&&(geom->key_aliases)) { int sz= XkbKeyNameLength*2; int num= wireGeom.num_key_aliases; if (fread(geom->key_aliases,sz,num,file)!=num) { _XkbLibError(_XkbErrBadLength,"ReadXkmGeometry",0); return -1; } nRead+= (num*sz); geom->num_key_aliases= num; } return nRead; } Bool XkmProbe(FILE *file) { unsigned hdr,tmp; int nRead=0; hdr= (('x'<<24)|('k'<<16)|('m'<<8)|XkmFileVersion); tmp= XkmGetCARD32(file,&nRead); if (tmp!=hdr) { if ((tmp&(~0xff))==(hdr&(~0xff))) { _XkbLibError(_XkbErrBadFileVersion,"XkmProbe",tmp&0xff); } return 0; } return 1; } Bool XkmReadTOC(FILE *file,xkmFileInfo* file_info,int max_toc,xkmSectionInfo *toc) { unsigned hdr,tmp; int nRead=0; unsigned i,size_toc; hdr= (('x'<<24)|('k'<<16)|('m'<<8)|XkmFileVersion); tmp= XkmGetCARD32(file,&nRead); if (tmp!=hdr) { if ((tmp&(~0xff))==(hdr&(~0xff))) { _XkbLibError(_XkbErrBadFileVersion,"XkmReadTOC",tmp&0xff); } else { _XkbLibError(_XkbErrBadFileType,"XkmReadTOC",tmp); } return 0; } _X_UNUSED int ignored_result; ignored_result = fread(file_info,SIZEOF(xkmFileInfo),1,file); size_toc= file_info->num_toc; if (size_toc>max_toc) { DebugF("Warning! Too many TOC entries; last %d ignored\n", size_toc-max_toc); size_toc= max_toc; } for (i=0;ixkb)) { _XkbLibError(_XkbErrBadMatch,"XkmReadFileSection",0); return 0; } fseek(file,toc->offset,SEEK_SET); _X_UNUSED int ignored_result; ignored_result = fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file); nRead= SIZEOF(xkmSectionInfo); if ((tmpTOC.type!=toc->type)||(tmpTOC.format!=toc->format)|| (tmpTOC.size!=toc->size)||(tmpTOC.offset!=toc->offset)) { _XkbLibError(_XkbErrIllegalContents,"XkmReadFileSection",0); return 0; } switch (tmpTOC.type) { case XkmVirtualModsIndex: nRead+= ReadXkmVirtualMods(file,result,NULL); if ((loaded_rtrn)&&(nRead>=0)) *loaded_rtrn|= XkmVirtualModsMask; break; case XkmTypesIndex: nRead+= ReadXkmKeyTypes(file,result,NULL); if ((loaded_rtrn)&&(nRead>=0)) *loaded_rtrn|= XkmTypesMask; break; case XkmCompatMapIndex: nRead+= ReadXkmCompatMap(file,result,NULL); if ((loaded_rtrn)&&(nRead>=0)) *loaded_rtrn|= XkmCompatMapMask; break; case XkmKeyNamesIndex: nRead+= ReadXkmKeycodes(file,result,NULL); if ((loaded_rtrn)&&(nRead>=0)) *loaded_rtrn|= XkmKeyNamesMask; break; case XkmSymbolsIndex: nRead+= ReadXkmSymbols(file,result); if ((loaded_rtrn)&&(nRead>=0)) *loaded_rtrn|= XkmSymbolsMask; break; case XkmIndicatorsIndex: nRead+= ReadXkmIndicators(file,result,NULL); if ((loaded_rtrn)&&(nRead>=0)) *loaded_rtrn|= XkmIndicatorsMask; break; case XkmGeometryIndex: nRead+= ReadXkmGeometry(file,result); if ((loaded_rtrn)&&(nRead>=0)) *loaded_rtrn|= XkmGeometryMask; break; default: _XkbLibError(_XkbErrBadImplementation, XkbConfigText(tmpTOC.type,XkbMessage),0); nRead= 0; break; } if (nRead!=tmpTOC.size) { _XkbLibError(_XkbErrBadLength,XkbConfigText(tmpTOC.type,XkbMessage), nRead-tmpTOC.size); return 0; } return (nRead>=0); } char * XkmReadFileSectionName(FILE *file,xkmSectionInfo *toc) { xkmSectionInfo tmpTOC; char name[100]; if ((!file)||(!toc)) return 0; switch (toc->type) { case XkmVirtualModsIndex: case XkmIndicatorsIndex: break; case XkmTypesIndex: case XkmCompatMapIndex: case XkmKeyNamesIndex: case XkmSymbolsIndex: case XkmGeometryIndex: fseek(file,toc->offset,SEEK_SET); _X_UNUSED int ignored_result; ignored_result = fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file); if ((tmpTOC.type!=toc->type)||(tmpTOC.format!=toc->format)|| (tmpTOC.size!=toc->size)||(tmpTOC.offset!=toc->offset)) { _XkbLibError(_XkbErrIllegalContents,"XkmReadFileSectionName",0); return 0; } if (XkmGetCountedString(file,name,100)>0) return Xstrdup(name); break; default: /* tmpTOC is unitilaoized here, so we use the one from toc for now. _XkbLibError(_XkbErrBadImplementation, XkbConfigText(tmpTOC.type,XkbMessage),0); */ _XkbLibError(_XkbErrBadImplementation, XkbConfigText(toc->type,XkbMessage),0); break; } return NULL; } /***====================================================================***/ #define MAX_TOC 16 unsigned XkmReadFile(FILE *file,unsigned need,unsigned want,XkbFileInfo *result) { register unsigned i; xkmSectionInfo toc[MAX_TOC],tmpTOC; xkmFileInfo fileInfo; unsigned tmp,nRead=0; unsigned which= need|want; if (!XkmReadTOC(file,&fileInfo,MAX_TOC,toc)) return which; if ((fileInfo.present&need)!=need) { _XkbLibError(_XkbErrIllegalContents,"XkmReadFile", need&(~fileInfo.present)); return which; } result->type= fileInfo.type; if (result->xkb==NULL) result->xkb= XkbAllocKeyboard(); for (i=0;i0) { nRead+= tmp; which&= ~(1<defined|= (1<&2 exit 1 fi $INDENT -linux -bad -bap -blf -bli0 -cbi0 -cdw -nce -cs -i4 -lc80 -psl -nbbo \ -nbc -psl -nbfda -nut -nss -T pointer -T ScreenPtr -T ScrnInfoPtr -T pointer \ -T DeviceIntPtr -T DevicePtr -T ClientPtr -T CallbackListPtr \ -T CallbackProcPtr -T OsTimerPtr -T CARD32 -T CARD16 -T CARD8 \ -T INT32 -T INT16 -T INT8 -T Atom -T Time -T WindowPtr -T DrawablePtr \ -T PixmapPtr -T ColormapPtr -T CursorPtr -T Font -T XID -T Mask \ -T BlockHandlerProcPtr -T WakeupHandlerProcPtr -T RegionPtr \ -T InternalEvent -T GrabPtr -T Timestamp -T Bool -T TimeStamp \ -T xEvent -T DeviceEvent -T RawDeviceEvent -T GrabMask -T Window \ -T Drawable -T FontPtr -T CallbackPtr -T XIPropertyValuePtr \ -T GrabParameters -T deviceKeyButtonPointer -T TouchOwnershipEvent \ -T xGenericEvent -T DeviceChangedEvent -T GCPtr -T BITS32 \ -T xRectangle -T BoxPtr -T RegionRec -T ValuatorMask -T KeyCode \ -T KeySymsPtr -T XkbDescPtr -T InputOption -T XI2Mask -T DevUnion \ -T DevPrivateKey -T DevScreenPrivateKey -T PropertyPtr -T RESTYPE \ -T XkbAction -T XkbChangesPtr -T XkbControlsPtr -T PrivatePtr -T pmWait \ -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT "$@" nx-libs-3.5.99.23/regenerate-symbol-docs.sh0000755000000000000000000000542613614532331015227 0ustar #!/bin/bash # Copyright (C) 2016 Mike Gabriel # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # libNX_X11 SYMBOLS_FILE="doc/libNX_X11/symbols/libNX_X11::symbols.txt" DOC_FILE="doc/libNX_X11/symbols/libNX_X11::symbol-usage_internally.txt" echo "Scanning for libNX_X11 symbols: in libNX_X11 internally: $DOC_FILE" cd nx-X11/lib/X11/ cat "../../../$SYMBOLS_FILE" | grep -v -E "^#" | while read symbol; do echo echo "#### $symbol ####" grep -n $symbol *.{c,h} 2>/dev/null done > "../../../$DOC_FILE" cd - 1>/dev/null DOC_FILE="doc/libNX_X11/symbols/libNX_X11::symbol-usage_nxagent.txt" echo "Scanning for libNX_X11 symbols: in hw/nxagent: $DOC_FILE" cd nx-X11/programs/Xserver/hw/nxagent/ cat "../../../../../$SYMBOLS_FILE" | grep -v -E "^#" | while read symbol; do echo echo "#### $symbol ####" grep -n $symbol *.{c,h} 2>/dev/null done > "../../../../../$DOC_FILE" cd - 1>/dev/null DOC_FILE="doc/libNX_X11/symbols/libNX_X11::symbol-usage_nxcompext.txt" echo "Scanning for libNX_X11 symbols: in hw/nxagent/compext: $DOC_FILE" cd nx-X11/programs/Xserver/hw/nxagent/compext/ cat "../../../../../../$SYMBOLS_FILE" | grep -v -E "^#" | while read symbol; do echo echo "#### $symbol ####" grep -n $symbol *.{c,h} 2>/dev/null done > "../../../../../../$DOC_FILE" cd - 1>/dev/null # nxcompext SYMBOLS_FILE="doc/nxcompext/symbols/nxcompext::symbols.txt" DOC_FILE="doc/nxcompext/symbols/nxcompext::symbol-usage_internally.txt" echo "Scanning for nxcompext symbols: in hw/nxagent/compext internally: $DOC_FILE" cd nx-X11/programs/Xserver/hw/nxagent/compext/ cat "../../../../../../$SYMBOLS_FILE" | grep -v -E "^#" | while read symbol; do echo echo "#### $symbol ####" grep -n $symbol *.{c,h} 2>/dev/null done > "../../../../../../$DOC_FILE" cd - 1>/dev/null DOC_FILE="doc/nxcompext/symbols/nxcompext::symbol-usage_nxagent.txt" echo "Scanning for nxcompext symbols: in hw/nxagent: $DOC_FILE" cd nx-X11/programs/Xserver/hw/nxagent/ cat ../../../../../$SYMBOLS_FILE | grep -v -E "^#" | while read symbol; do echo echo "#### $symbol ####" grep -n $symbol *.{c,h} 2>/dev/null done > "../../../../../$DOC_FILE" cd - 1>/dev/null nx-libs-3.5.99.23/replace.sh0000644000000000000000000000402013614532331012252 0ustar # Copyright (C) 2013 Jan Engelhardt # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # from http://mywiki.wooledge.org/BashFAQ/021 # The ${a/b/c} substitution is not POSIX compatible. Additionally, in # bash 3.x, quotes do not escape slashes. This causes screwed up # installation paths. # # SLES 11, bash-3.2-147.9.13 # $ dirname="foo/bar" # $ echo ${dirname//"foo/bar"/"omg/nei"} # bar/omg/nei/bar # # openSUSE 12.2, bash-4.2-51.6.1 # $ dirname="foo/bar" # $ echo ${dirname//"foo/bar"/"omg/nei"} # omg/nei # # openSUSE 12.2, dash-0.5.7-5.1.2.x86_64 # $ dirname="foo/bar" # $ echo ${dirname//"foo/bar"/"omg/nei"} # dash: 2: Bad substitution # # Source this file into your bash scripts to make available # a replacement (the string_rep function) for this substitution # mess. # string_rep() { # initialize vars in=$1 unset out # SEARCH must not be empty test -n "$2" || return while true; do # break loop if SEARCH is no longer in "$in" case "$in" in *"$2"*) : ;; *) break;; esac # append everything in "$in", up to the first instance of SEARCH, and REP, to "$out" out=$out${in%%"$2"*}$3 # remove everything up to and including the first instance of SEARCH from "$in" in=${in#*"$2"} done # append whatever is left in "$in" after the last instance of SEARCH to out, and print printf '%s%s\n' "$out" "$in" } nx-libs-3.5.99.23/roll-tarballs.sh0000755000000000000000000002401113614532331013416 0ustar #!/bin/bash # Copyright (C) 2011-2016 by Mike Gabriel # Copyright (C) 2012 by Reinhard Tartler # # This is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # Thanks to Jonas Smedegaard for inspiration... # Formatting/cleanups by siretart in December 2012 set -e usage() { echo "To be called at the project root of an nx-libs checkout" echo "usage: $(basename "$0") {,HEAD} {server|client}" exit 1 } PROJECT="nx-libs" NULL="" test -d ".git" || usage RELEASE="$1" test -n "${RELEASE}" || usage MODE="$2" test -n "$MODE" || usage if [ "x$MODE" = "xserver" ] || [ "x${MODE}" = "xfull" ]; then MODE="full" RELEASE_SUFFIX='-full' elif [ "x$MODE" = "xclient" ] || [ "x${MODE}" = "xlite" ]; then MODE="lite" RELEASE_SUFFIX='-lite' else usage fi CHECKOUT="${RELEASE}" if [ x"$RELEASE" == "xHEAD" ]; then CHECKOUT="refs/heads/$(git rev-parse --abbrev-ref HEAD)" fi if ! git rev-parse --verify -q "$CHECKOUT" >/dev/null; then echo " '${RELEASE}' is not a valid release number because there is no git tag named ${CHECKOUT}." echo " Please specify one of the following releases:" echo "HEAD (on branch `git rev-parse --abbrev-ref HEAD`)" git tag -l | grep "^redist" | cut -f2 -d"/" | sort -u exit 1 fi TARGETDIR="../.." MANIFEST="$(mktemp)" TEMP_DIR="$(mktemp -d)" trap "rm -f \"${MANIFEST}\"; rm -rf \"${TEMP_DIR}\"" 0 # create local copy of Git project at temp location git archive --format=tar "${CHECKOUT}" --prefix="${PROJECT}-${RELEASE}/" | ( cd "$TEMP_DIR"; tar xf - ) git --no-pager log --after "1972-01-01" --format="%ai %aN (%h) %n%n%x09*%w(68,0,10) %s%d%n" "${CHECKOUT}" > "${TEMP_DIR}/${PROJECT}-${RELEASE}/ChangeLog" echo "Created tarball for $CHECKOUT" cd "${TEMP_DIR}/${PROJECT}-${RELEASE}/" # Replace symlinks by copies of the linked target files # Note: We don't have symlinked directories!!! find . -type "l" | while read link; do TARGET="$(readlink "${link}")" pushd "$(dirname "${link}")" >/dev/null if [ -f "${TARGET}" ]; then rm -f "$(basename "${link}")" cp "${TARGET}" "$(basename "${link}")" fi popd >/dev/null done mkdir -p "doc/applied-patches" # prepare patches for lite and full tarball if [ "x$MODE" = "xfull" ]; then rm -f "README.md" rm -Rf "doc/_attic_/" rm -f ".gitignore" rm -f "nxcomp/.gitignore" rm -f "nxcompext/.gitignore" rm -f "nxcompshad/.gitignore" rm -f "nxproxy/.gitignore" rm -f "nx-X11/lib/X11/.gitignore" rm -f "nx-X11/.gitignore" rm -f "nx-X11/lib/include/X11/.gitignore" rm -f "nx-X11/lib/src/.gitignore" rm -f "nx-X11/programs/Xserver/composite/.gitignore" rm -f "nx-X11/programs/Xserver/hw/nxagent/.gitignore" rm -f "nx-X11/programs/Xserver/.gitignore" rm -f "nx-X11/programs/Xserver/include/.gitignore" rm -f "nx-X11/programs/Xserver/GL/.gitignore" rm -f "nx-X11/include/.gitignore" # bring Mesa in shape, drop symlinks and move versioned Mesa-bundle to # nx-X11/extras/Mesa. Deal with the Mesa.patches symlink/folder accordingly cp -Lr "nx-X11/extras/Mesa" "nx-X11/extras/tmpMesa" cp -Lr "nx-X11/extras/Mesa.patches" "nx-X11/extras/tmpMesa.patches" ls -d nx-X11/extras/* | grep -v "nx-X11/extras/tmpMesa*" | xargs rm -r mv "nx-X11/extras/tmpMesa" "nx-X11/extras/Mesa" mv "nx-X11/extras/tmpMesa.patches" "nx-X11/extras/Mesa.patches" # shrink Mesa to what we really need (and nothing else) rm -Rf "nx-X11/extras/Mesa/"{bin/,configs/,docs/,doxygen/,progs/,vms/,windows/,Makefile,Makefile.*,descrip.mms,mms-config.} rm -Rf "nx-X11/extras/Mesa/include/"{GLES,GLView.h} rm -f "nx-X11/extras/Mesa/include/GL/"{amesa.h,directfbgl.h,dmesa.h,foomesa.h,fxmesa.h,ggimesa.h,glfbdev.h,gl_mangle.h,glu.h,glu_mangle.h,glutf90.h,glut.h,glut_h.dja,glx.h,glx_mangle.h,Makefile.am,mesa_wgl.h,mglmesa.h,miniglx.h,svgamesa.h,uglglutshapes.h,uglmesa.h,vms_x_fix.h,wmesa.h,xmesa_x.h} rm -f "nx-X11/extras/Mesa/include/GL/internal/"{dri_interface.h,sarea.h} rm -Rf "nx-X11/extras/Mesa/src/"{egl/,glu/,glut/,glw/,glx/mini/,Makefile,glx/Makefile,descrip.mms} rm -f "nx-X11/extras/Mesa/src/glx/x11/"{clientattrib.c,dri_glx.c,dri_glx.h,eval.c,glxclient.h,glxcmds.c,glxext.c,glxextensions.c,glxextensions.h,glx_pbuffer.c,glx_query.c,glx_texture_compression.c,indirect.c,indirect.h,indirect_init.c,indirect_init.h,indirect_transpose_matrix.c,indirect_va_private.h,indirect_vertex_array.c,indirect_vertex_array.h,indirect_vertex_program.c,indirect_window_pos.c,packrender.h,packsingle.h,pixel.c,pixelstore.c,render2.c,renderpix.c,single2.c,singlepix.c,vertarr.c,XF86dri.c,xf86dri.h,xf86dristr.h,xfont.c} rm -Rf "nx-X11/extras/Mesa/src/mesa/"{ppc,sparc,tnl_dd,x86,x86-64,sources} rm -Rf "nx-X11/extras/Mesa/src/mesa/drivers/"{allegro,beos,d3d,directfb,dos,fbdev,ggi,glide,osmesa,svga,windows} rm -f "nx-X11/extras/Mesa/src/mesa/drivers/x11/"{fakeglx.c,glxapi.c,glxapi.h,realglx.*,xfonts.*} rm -Rf "nx-X11/extras/Mesa/src/mesa/drivers/dri/"{ffb,i810,i915,mga,r200,radeon,savage,tdfx,unichrome,fb,gamma,i830,mach64,r128,r300,s3v,sis,trident} rm -Rf "nx-X11/extras/Mesa/src/mesa/drivers/dri/x11/"x11_dri.{c,h} rm -Rf "nx-X11/extras/Mesa/src/mesa/drivers/dri/common/"{depthtmp.h,drirenderbuffer.h,dri_util.h,memops.h,mmx.h,spantmp_common.h,stenciltmp.h,texmem.h,utils.h,vblank.h,xmlconfig.h,xmlpool.h,drirenderbuffer.c,dri_util.c,extension_helper.h,mmio.h,spantmp2.h,spantmp.h,texmem.c,utils.c,vblank.c,xmlconfig.c,xmlpool/} rm -Rf "nx-X11/extras/Mesa/src/mesa/glapi/"{*.dtd,*.py,*.sh,*.xml,.cvsignore} rm -f "nx-X11/extras/Mesa/src/mesa/shader/"*.syn rm -f "nx-X11/extras/Mesa/src/mesa/shader/asmopcodes.reg" rm -f "nx-X11/extras/Mesa/src/mesa/shader/grammar/grammar_crt."{c,h} rm -f "nx-X11/extras/Mesa/src/mesa/shader/grammar/"*.syn rm -Rf "nx-X11/extras/Mesa/src/mesa/shader/slang/MachineIndependent/" rm -Rf "nx-X11/extras/Mesa/src/mesa/shader/slang/OGLCompilersDLL/" rm -Rf "nx-X11/extras/Mesa/src/mesa/shader/slang/OSDependent/" rm -Rf "nx-X11/extras/Mesa/src/mesa/shader/slang/slang_mesa."{cpp,h} rm -Rf "nx-X11/extras/Mesa/src/mesa/shader/slang/library/"*.*c rm -Rf "nx-X11/extras/Mesa/src/mesa/shader/slang/library/"*.py rm -Rf "nx-X11/extras/Mesa/src/mesa/shader/slang/library/"*.syn rm -Rf "nx-X11/extras/Mesa/src/mesa/shader/slang/Include/" rm -Rf "nx-X11/extras/Mesa/src/mesa/shader/slang/Public/" rm -f "nx-X11/extras/Mesa/src/mesa/swrast/s_fragprog_to_c.c" rm -f "nx-X11/extras/Mesa/src/mesa/swrast/s_tcc.c" rm -f "nx-X11/extras/Mesa/src/mesa/swrast_setup/ss_vb.h" rm -Rf "nx-X11/extras/Mesa/src/mesa/"*/NOTES rm -f "nx-X11/extras/Mesa/src/mesa/main/"*.py rm -f "nx-X11/extras/Mesa/src/mesa/main/"{mesa.def,Imakefile,vsnprintf.c} find nx-X11/extras/Mesa/ -name Makefile | while read file; do rm "$file"; done find nx-X11/extras/Mesa/ -name Makefile.* | while read file; do rm "$file"; done find nx-X11/extras/Mesa/ -name descrip.mms | while read file; do rm "$file"; done # this is for 3.5.0.x only... cat "debian/patches/series" | sort | grep -v '^#' | egrep "([0-9]+(_|-).*\.(full|full\+lite)\.patch)" | while read file do cp -v "debian/patches/$file" "doc/applied-patches/" echo "${file##*/}" >> "doc/applied-patches/series" done else rm -f "README.md" rm -f "bin/nxagent"* rm -Rf "nxcompshad"* rm -Rf "nx-X11"* rm -Rf "nxdialog"* rm -Rf "etc"* rm -f "mesa-quilt" rm -f "regenerate-symbol-docs.sh" rm -f "run-static-analysis.sh" rm -Rf "testscripts/"*nxagent* rm -Rf "testscripts/"slave* rm -Rf "doc/libNX_X11/" rm -Rf "doc/nxagent/" rm -Rf "doc/nxcompext/" rm -Rf "doc/nxcompshad/" rm -Rf "doc/_attic_/" rm -f ".gitignore" rm -f "m4/nx-xtrans.m4" rm -f "nxcomp/.gitignore" rm -f "nxproxy/.gitignore" # for old nx-libs releases, re-arranged since 3.5.99.3 rm -Rf "doc/nx-X11_vs_XOrg69_patches"* rm -Rf "doc/X11-symbols"* rm -f "README.keystrokes" rm -Rf "nxcompext"* mv LICENSE.nxcomp LICENSE # this is for 3.5.0.x only... cat "debian/patches/series" | sort | grep -v '^#' | egrep "([0-9]+(_|-).*\.full\+lite\.patch)" | while read file do cp -v "debian/patches/$file" "doc/applied-patches/" echo "${file##*/}" >> "doc/applied-patches/series" done fi # apply all patches shipped in debian/patches and create a copy of them that we ship with the tarball if [ -s "doc/applied-patches/series" ]; then QUILT_PATCHES="doc/applied-patches" quilt --quiltrc /dev/null push -a -q fi # remove folders that we do not want to roll into the tarball rm -Rf ".pc/" rm -Rf "debian/" rm -Rf "nx-libs.spec" # very old release did not add any README for f in $(ls README* 2>/dev/null); do mv -v "$f" "doc/"; done # remove files, that we do not want in the tarballs (build cruft) rm -Rf nx*/configure nx*/autom4te.cache* cd "$OLDPWD" # create target location for tarball mkdir -p "${TARGETDIR}/_releases_/source/${PROJECT}/" # roll the ball... cd "$TEMP_DIR" find "${PROJECT}-${RELEASE}" -type f | sort > "$MANIFEST" cd "$OLDPWD" tar c -C "$TEMP_DIR" \ --owner 0 \ --group 0 \ --numeric-owner \ --no-recursion \ --files-from "$MANIFEST" \ --gzip \ > "$TARGETDIR/_releases_/source/${PROJECT}/${PROJECT}-${RELEASE}${RELEASE_SUFFIX}.tar.gz" echo "$TARGETDIR/_releases_/source/${PROJECT}/${PROJECT}-${RELEASE}${RELEASE_SUFFIX}.tar.gz is ready" nx-libs-3.5.99.23/run-static-analysis.sh0000755000000000000000000000107613614532331014564 0ustar #!/bin/bash if [[ "${STATIC_ANALYSIS}" == "yes" ]]; then # cppcheck if ! [ -x "$(command -v cppcheck)" ]; then echo 'Error: cppcheck is not installed.' >&2 exit 1 fi CPPCHECK_OPTS='--error-exitcode=0 --force --quiet --suppressions-list=./static-analysis-suppressions' # we exclude some external projects CPPCHECK_EXCLUDES='-i ./nx-X11/extras/ -i nx-X11/programs/Xserver/GL/mesa* -i ./.pc -i ./nx-X11/.build-exports -i ./nx-X11/exports -i ./doc' echo "$(cppcheck --version):"; cppcheck $CPPCHECK_OPTS $CPPCHECK_EXCLUDES .; fi nx-libs-3.5.99.23/static-analysis-suppressions0000644000000000000000000000255113614532331016120 0ustar memleak:nx-X11/programs/Xserver/dix/gc.c memleak:nx-X11/lib/include/xtrans/Xtrans.c:982 memleak:nx-X11/lib/include/xtrans/Xtrans.c:987 memleak:nx-X11/lib/include/xtrans/Xtrans.c:1004 memleak:nx-X11/lib/include/xtrans/Xtrans.c:1009 uninitvar:nx-X11/lib/include/xtrans/Xtranssock.c:1107 uninitvar:nx-X11/lib/include/xtrans/Xtranssock.c:1109 uninitvar:nx-X11/lib/include/xtrans/Xtranssock.c:1146 uninitvar:nx-X11/lib/include/xtrans/Xtranssock.c:1148 memleak:nx-X11/lib/include/xtrans/Xtranssock.c:2446 memleak:nx-X11/lib/include/xtrans/Xtranssock.c:2458 nullPointer:nx-X11/programs/Xserver/Xext/security.c nullPointerArithmetic:nx-X11/programs/Xserver/randr/rrcrtc.c nullPointerArithmetic:nx-X11/programs/Xserver/randr/rroutput.c nullPointerArithmetic:nx-X11/programs/Xserver/randr/rrprovider.c nullPointerArithmetic:nx-X11/programs/Xserver/randr/rrscreen.c memleak:nx-X11/programs/Xserver/render/render.c:2929 memleak:nx-X11/programs/Xserver/render/render.c:2991 memleak:nx-X11/programs/Xserver/render/render.c:3049 memleak:nx-X11/programs/Xserver/render/render.c:3103 memleak:nx-X11/programs/Xserver/render/render.c:3157 memleak:nx-X11/programs/Xserver/render/render.c:3288 doubleFree:nx-X11/programs/Xserver/hw/nxagent/Keyboard.c:1699 uninitStructMember:nx-X11/programs/Xserver/mi/miwideline.c:190 invalidFree:nxcomp/src/EncodeBuffer.cpp:84 invalidFree:nxcomp/src/EncodeBuffer.cpp:106 nx-libs-3.5.99.23/testscripts/run-nxproxy2nxagent-on-localhost0000755000000000000000000001146713614532331021235 0ustar #!/bin/bash #/**************************************************************************/ #/* */ #/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ #/* Copyright (c) 2015-2016 Mike Gabriel */ #/* */ #/* NXSCRIPTS, NX protocol compression and NX extensions to this software */ #/* are copyright of the aforementioned persons and companies. */ #/* */ #/* Redistribution and use of the present software is allowed according */ #/* to terms specified in the file LICENSE.nxcomp which comes in the */ #/* source distribution. */ #/* */ #/* All rights reserved. */ #/* */ #/* NOTE: This software has received contributions from various other */ #/* contributors, only the core maintainers and supporters are listed as */ #/* copyright holders. Please contact us, if you feel you should be listed */ #/* as copyright holder, as well. */ #/* */ #/**************************************************************************/ # # Uncomment this to enable echo. # #set -x # ulimit -c "unlimited" NXPROXYBIN="nxproxy" NXAGENTBIN="nxagent" NX_PORT="9" NX_SYSTEM="${HOME}/.nx" NX_ROOT="${HOME}/.nx" # # This should be randomly generated. # #NX_COOKIE="$(xauth list |grep "${HOSTNAME}/unix:\<${NX_PORT}\>" | grep 'MIT' | cut -f '5' -d ' ')" NX_COOKIE="123efa980d2cba234ef6f73deac810ff" # # Create the directories for the NX session. # rm -rf "${NX_ROOT}/C-${NX_PORT}" || exit mkdir -p "${NX_ROOT}/C-${NX_PORT}" || exit rm -rf "${NX_ROOT}/S-${NX_PORT}" || exit mkdir -p "${NX_ROOT}/S-${NX_PORT}" || exit # # Set the path to libraries and NX executables. # LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${HOME}/NX/nxcomp:${HOME}/NX/nxcompext:${HOME}/NX/nx-X11/exports/lib" export LD_LIBRARY_PATH PATH="${PATH}:${HOME}/NX/nxclient/nxclient:${HOME}/NX/nx-X11/programs/Xserver/" export PATH # # Create the fake cookie for this display. # echo "Creating the X authorization cookie." xauth add "${HOSTNAME}/unix:${NX_PORT}" "MIT-MAGIC-COOKIE-1" "${NX_COOKIE}" xauth add "${HOSTNAME}:${NX_PORT}" "MIT-MAGIC-COOKIE-1" "${NX_COOKIE}" # # Options are written in a file 'options' in the session # directory. The agent will use the DISPLAY settings, so # we pass in the DISPLAY the name of the options file. # # cache=8M,images=32M,link=modem,type=unix-kde,cleanup=0, # accept=62.98.198.1,cookie=$NX_COOKIE, # id=giulietta.nomachine.com-1098-6A4649FD0FCA57FAC275AF3F1C45B10F, # media=1:1098 # NX_HOST="nx/nx,cache=8192k,link=modem,menu=1,keybd=1,samba=0,cups=0,limit=0,\ accept=127.0.0.1,cookie=$NX_COOKIE,errors=${NX_ROOT}/C-${NX_PORT}/session" echo "${NX_HOST}:${NX_PORT}" >"${NX_ROOT}/C-${NX_PORT}/options" # # Run the agent. if you don't have a font server running, # remove the argument "-fp unix/:7100" # NX_AGENT=":${NX_PORT}" echo "Running the X client side NX agent." SAVED_DISPLAY="${DISPLAY}" DISPLAY="nx/nx,options=${NX_ROOT}/C-${NX_PORT}/options:${NX_PORT}" export DISPLAY #valgrind -v --num-callers=8 --error-limit=no --trace-children=no \ #valgrind --num-callers=8 --tool=memcheck --leak-check=yes --show-reachable=yes --track-fds=yes \ #ldd "${NXAGENTBIN}" "${NXAGENTBIN}" -name 'NX' -geometry "800x600+100+100" "${@}" \ "${NX_AGENT}" 2>>"${NX_ROOT}/C-${NX_PORT}/session" & # # The X server side proxy will forward the connection # to the original DISPLAY. # DISPLAY="${SAVED_DISPLAY}" export DISPLAY # # These are the nxproxy options used to run a typical session. # # cookie=$NX_COOKIE,root=/home/pinzari/.nx,media=32824, # session=kde_on_giulietta,id=giulietta.nomachine.com-1098-6A4649FD0FCA57FAC275AF3F1C45B10F, # connect=giulietta.nomachine.com:1098 # #NX_HOST="nx/nx,keybd=1,samba=1,cups=1,connect=localhost,cookie=${NX_COOKIE},errors=${NX_ROOT}/S-${NX_PORT}/session" NX_HOST="nx/nx,keybd=1,samba=0,cups=0,connect=localhost,cookie=${NX_COOKIE},errors=${NX_ROOT}/S-${NX_PORT}/session" echo "${NX_HOST}:${NX_PORT}" >"${NX_ROOT}/S-${NX_PORT}/options" echo "Running the X server side NX proxy." #valgrind -v --num-callers=8 --error-limit=no --trace-children=no \ #valgrind --num-callers=8 --tool=memcheck --leak-check=yes --show-reachable=yes --track-fds=yes \ #ldd "${NXPROXYBIN}" "${NXPROXYBIN}" -S "nx/nx,options=${NX_ROOT}/S-${NX_PORT}/options:${NX_PORT}" \ 2>>"${NX_ROOT}/S-${NX_PORT}/session" & echo "Session running on display :$NX_PORT." nx-libs-3.5.99.23/testscripts/run-nxproxy2nxagent-over-network0000755000000000000000000001246113614532331021270 0ustar #!/bin/bash #/**************************************************************************/ #/* */ #/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ #/* Copyright (c) 2015-2016 Mike Gabriel */ #/* */ #/* NXSCRIPTS, NX protocol compression and NX extensions to this software */ #/* are copyright of the aforementioned persons and companies. */ #/* */ #/* Redistribution and use of the present software is allowed according */ #/* to terms specified in the file LICENSE.nxcomp which comes in the */ #/* source distribution. */ #/* */ #/* All rights reserved. */ #/* */ #/* NOTE: This software has received contributions from various other */ #/* contributors, only the core maintainers and supporters are listed as */ #/* copyright holders. Please contact us, if you feel you should be listed */ #/* as copyright holder, as well. */ #/* */ #/**************************************************************************/ # # Uncomment this to enable echo. # #set -x # ulimit -c "unlimited" NXPROXYBIN="nxproxy" NXAGENTBIN="nxagent" ### ### Adapt to your needs: NXAGENT_HOST, NXPROXY_HOST ### ### This script launches nxagent and has to be executed on the NXAGENT_HOST. ### On the NXPROXY_HOST you will have to execute nxproxy by copy+pasting ### some command lines... ### ### (Instructions for copy+pasting are given when this script has been launched). ### NXAGENT_HOST="127.0.0.1" # (e.g., 192.168.1.1, this scripts is launched on the NXAGENT_HOST machine) NXPROXY_HOST="127.0.0.1" # (e.g., 192.168.1.2, you want to connect nxproxy -> nxagent from the NXPROXY_HOST machine) NX_PORT="9" NX_SYSTEM="${HOME}/.nx" NX_ROOT="${HOME}/.nx" # # This should be randomly generated. # #NX_COOKIE="$(xauth list |grep "${HOSTNAME}/unix:\<${NX_PORT}\>" | grep 'MIT' | cut -f '5' -d ' ')" NX_COOKIE="123efa980d2cba234ef6f73deac810ff" # # Create the directories for the NX session. # rm -rf "${NX_ROOT}/C-${NX_PORT}" || exit mkdir -p "${NX_ROOT}/C-${NX_PORT}" || exit rm -rf "${NX_ROOT}/S-${NX_PORT}" || exit mkdir -p "${NX_ROOT}/S-${NX_PORT}" || exit # # Set the path to libraries and NX executables. # LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${HOME}/NX/nxcomp:${HOME}/NX/nxcompext:${HOME}/NX/nx-X11/exports/lib" export LD_LIBRARY_PATH PATH="${PATH}:${HOME}/NX/nxclient/nxclient:${HOME}/NX/nx-X11/programs/Xserver/" export PATH # # Create the fake cookie for this display. # echo "Creating the X authorization cookie." xauth add "${NXPROXY_HOST}/unix:${NX_PORT}" "MIT-MAGIC-COOKIE-1" "${NX_COOKIE}" xauth add "${NXPROXY_HOST}:${NX_PORT}" "MIT-MAGIC-COOKIE-1" "${NX_COOKIE}" # # Options are written in a file 'options' in the session # directory. The agent will use the DISPLAY settings, so # we pass in the DISPLAY the name of the options file. # # cache=8M,images=32M,link=modem,type=unix-kde,cleanup=0, # accept=62.98.198.1,cookie=${NX_COOKIE}, # id=giulietta.nomachine.com-1098-6A4649FD0FCA57FAC275AF3F1C45B10F, # media=1:1098 # NX_HOST="nx/nx,cache=8192k,link=modem,menu=1,keybd=1,samba=0,cups=0,limit=0,\ accept=${NXPROXY_HOST},cookie=${NX_COOKIE},errors=${NX_ROOT}/C-${NX_PORT}/session" echo "${NX_HOST}:${NX_PORT}" >"${NX_ROOT}/C-${NX_PORT}/options" # # Run the agent. if you don't have a font server running, # remove the argument "-fp unix/:7100" # NX_AGENT=":${NX_PORT}" echo "Running the X client side NX agent." SAVED_DISPLAY="${DISPLAY}" DISPLAY="nx/nx,options=${NX_ROOT}/C-${NX_PORT}/options:${NX_PORT}" export DISPLAY #valgrind -v --num-callers=8 --error-limit=no --trace-children=no \ #valgrind --num-callers=8 --tool=memcheck --leak-check=yes --show-reachable=yes --track-fds=yes \ #ldd "${NXAGENTBIN}" "${NXAGENTBIN}" -name 'NX' -geometry "800x600+100+100" "${@}" \ "${NX_AGENT}" 2>>"${NX_ROOT}/C-${NX_PORT}/session" & # # The X server side proxy will forward the connection # to the original DISPLAY. # DISPLAY="${SAVED_DISPLAY}" export DISPLAY # # These are the nxproxy options used to run a typical session. # # cookie=${NX_COOKIE},root=/home/pinzari/.nx,media=32824, # session=kde_on_giulietta,id=giulietta.nomachine.com-1098-6A4649FD0FCA57FAC275AF3F1C45B10F, # connect=giulietta.nomachine.com:1098 # printf '\n%s\n\n' 'Now... COPY+PASTE the below lines to your local system' echo '--------------8<---------' #NX_HOST="nx/nx,keybd=1,samba=1,cups=1,connect=${NXAGENT_HOST},cookie=${NX_COOKIE},errors=${NX_ROOT}/S-${NX_PORT}/session" NX_HOST="nx/nx,keybd=1,samba=0,cups=0,connect=tcp:${NXAGENT_HOST}:4009,cookie=${NX_COOKIE},errors=${NX_ROOT}/S-${NX_PORT}/session" echo "NX_HOST=${NX_HOST}" echo "echo \"${NX_HOST}:${NX_PORT}\" >\"${NX_ROOT}/S-${NX_PORT}/options\"" echo "\"${NXPROXYBIN}\" -S \"nx/nx,options=${NX_ROOT}/S-${NX_PORT}/options:${NX_PORT}\" 2>>\"${NX_ROOT}/S-${NX_PORT}/session\"" printf '%s\n\n' '-------------->8---------' nx-libs-3.5.99.23/testscripts/run-nxproxy2nxagent-over-sockets0000755000000000000000000001177713614532331021263 0ustar #!/bin/bash #/**************************************************************************/ #/* */ #/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ #/* Copyright (c) 2015-2016 Mike Gabriel */ #/* */ #/* NXSCRIPTS, NX protocol compression and NX extensions to this software */ #/* are copyright of the aforementioned persons and companies. */ #/* */ #/* Redistribution and use of the present software is allowed according */ #/* to terms specified in the file LICENSE.nxcomp which comes in the */ #/* source distribution. */ #/* */ #/* All rights reserved. */ #/* */ #/* NOTE: This software has received contributions from various other */ #/* contributors, only the core maintainers and supporters are listed as */ #/* copyright holders. Please contact us, if you feel you should be listed */ #/* as copyright holder, as well. */ #/* */ #/**************************************************************************/ # # Uncomment this to enable echo. # #set -x # ulimit -c "unlimited" NXPROXYBIN="nxproxy" NXAGENTBIN="nxagent" NX_PORT="7" NX_SYSTEM="${HOME}/.nx" NX_ROOT="${HOME}/.nx" # # This should be randomly generated. # #NX_COOKIE="$(xauth list |grep "${HOSTNAME}/unix:\<${NX_PORT}\>" | grep 'MIT' | cut -f '5' -d ' ')" NX_COOKIE="123efa980d2cba234ef6f73deac810ff" # # Create the directories for the NX session. # rm -rf "${NX_ROOT}/C-${NX_PORT}" || exit mkdir -p "${NX_ROOT}/C-${NX_PORT}" || exit rm -rf "${NX_ROOT}/S-${NX_PORT}" || exit mkdir -p "${NX_ROOT}/S-${NX_PORT}" || exit # # Set the path to libraries and NX executables. # LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${HOME}/NX/nxcomp:${HOME}/NX/nxcompext:${HOME}/NX/nx-X11/exports/lib" export LD_LIBRARY_PATH PATH="${PATH}:${HOME}/NX/nxclient/nxclient:${HOME}/NX/nx-X11/programs/Xserver/" export PATH # # Create the fake cookie for this display. # echo "Creating the X authorization cookie." xauth add "${HOSTNAME}/unix:${NX_PORT}" "MIT-MAGIC-COOKIE-1" "${NX_COOKIE}" xauth add "${HOSTNAME}:${NX_PORT}" "MIT-MAGIC-COOKIE-1" "${NX_COOKIE}" function urlencode() { echo "$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$1")" } # # Options are written in a file 'options' in the session # directory. The agent will use the DISPLAY settings, so # we pass in the DISPLAY the name of the options file. # # cache=8M,images=32M,link=modem,type=unix-kde,cleanup=0, # accept=62.98.198.1,cookie=${NX_COOKIE}, # id=giulietta.nomachine.com-1098-6A4649FD0FCA57FAC275AF3F1C45B10F, # media=1:1098 # NX_HOST="nx/nx,cache=8192k,link=modem,menu=1,keybd=1,samba=0,cups=0,limit=0,\ listen=$(urlencode "unix:${NX_SYSTEM}/C-${NX_PORT}/proxy.socket"),cookie=${NX_COOKIE},errors=${NX_ROOT}/C-${NX_PORT}/session" echo "${NX_HOST}:${NX_PORT}" >"${NX_ROOT}/C-${NX_PORT}/options" # # Run the agent. if you don't have a font server running, # remove the argument "-fp unix/:7100" # NX_AGENT=":${NX_PORT}" echo "Running the X client side NX agent." SAVED_DISPLAY="${DISPLAY}" DISPLAY="nx/nx,options=${NX_ROOT}/C-${NX_PORT}/options:${NX_PORT}" export DISPLAY #valgrind -v --num-callers=8 --error-limit=no --trace-children=no \ #valgrind --num-callers=8 --tool=memcheck --leak-check=yes --show-reachable=yes --track-fds=yes \ #ldd "${NXAGENTBIN}" "${NXAGENTBIN}" -name 'NX' -geometry '800x600+100+100' "${@}" \ "${NX_AGENT}" 2>>"${NX_ROOT}/C-${NX_PORT}/session" & # # The X server side proxy will forward the connection # to the original DISPLAY. # DISPLAY="${SAVED_DISPLAY}" export DISPLAY # # These are the nxproxy options used to run a typical session. # # cookie=${NX_COOKIE},root=/home/pinzari/.nx,media=32824, # session=kde_on_giulietta,id=giulietta.nomachine.com-1098-6A4649FD0FCA57FAC275AF3F1C45B10F, # connect=giulietta.nomachine.com:1098 # #NX_HOST="nx/nx,keybd=1,samba=1,cups=1,connect=localhost,cookie=${NX_COOKIE},errors=${NX_ROOT}/S-${NX_PORT}/session" NX_HOST="nx/nx,keybd=1,samba=0,cups=0,connect=$(urlencode "unix:${NX_SYSTEM}/C-${NX_PORT}/proxy.socket"),cookie=${NX_COOKIE},errors=${NX_ROOT}/S-${NX_PORT}/session" echo "${NX_HOST}:${NX_PORT}" >"${NX_ROOT}/S-${NX_PORT}/options" echo "Running the X server side NX proxy." #valgrind -v --num-callers=8 --error-limit=no --trace-children=no \ #valgrind --num-callers=8 --tool=memcheck --leak-check=yes --show-reachable=yes --track-fds=yes \ #ldd "${NXPROXYBIN}" "${NXPROXYBIN}" -S "nx/nx,options=${NX_ROOT}/S-${NX_PORT}/options:${NX_PORT}" \ 2>>"${NX_ROOT}/S-${NX_PORT}/session" & echo "Session running on display :${NX_PORT}." nx-libs-3.5.99.23/testscripts/run-nxproxy2nxproxy0000755000000000000000000001164713614532331016720 0ustar #!/bin/bash set -e #/**************************************************************************/ #/* */ #/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ #/* Copyright (c) 2015-2016 Mike Gabriel */ #/* */ #/* NXSCRIPTS, NX protocol compression and NX extensions to this software */ #/* are copyright of the aforementioned persons and companies. */ #/* */ #/* Redistribution and use of the present software is allowed according */ #/* to terms specified in the file LICENSE.nxcomp which comes in the */ #/* source distribution. */ #/* */ #/* All rights reserved. */ #/* */ #/* NOTE: This software has received contributions from various other */ #/* contributors, only the core maintainers and supporters are listed as */ #/* copyright holders. Please contact us, if you feel you should be listed */ #/* as copyright holder, as well. */ #/* */ #/**************************************************************************/ # # Uncomment this to enable echo. # # set -x # ulimit -c "unlimited" NX_PORT="8" NX_SYSTEM="${HOME}/.nx" NX_ROOT="${HOME}/.nx" mkdir -p "${NX_ROOT}" # # This should be randomly generated. # NX_COOKIE="$(xauth -n list |grep "${HOSTNAME}/unix:${NX_PORT}" | grep 'MIT' | cut -f '5' -d ' ' | head -n1)" [[ -z "$NX_COOKIE" ]] && NX_COOKIE="$(mcookie)" # # Create the directories for the NX session. # rm -rf "${NX_ROOT}/C-${NX_PORT}" || exit mkdir -p "${NX_ROOT}/C-${NX_PORT}" || exit rm -rf "${NX_ROOT}/S-${NX_PORT}" || exit mkdir -p "${NX_ROOT}/S-${NX_PORT}" || exit # # Set the path to libraries and NX executables. # LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${HOME}/NX/nxcomp:${HOME}/NX/nxcompext:${HOME}/NX/nx-X11/exports/lib" export LD_LIBRARY_PATH PATH="${PATH}:${HOME}/NX/nxclient/nxclient:${HOME}/NX/nx-X11/programs/Xserver/" export PATH # # Create the fake cookie for this display. # echo "Creating the X authorization cookie." xauth add "${HOSTNAME}/unix:${NX_PORT}" "MIT-MAGIC-COOKIE-1" "${NX_COOKIE}" xauth add "${HOSTNAME}:${NX_PORT}" "MIT-MAGIC-COOKIE-1" "${NX_COOKIE}" # # Options are written in a file 'options' in the session # directory. The agent will use the DISPLAY settings, so # we pass in the DISPLAY the name of the options file. # # cache=8M,images=32M,link=modem,type=unix-kde,cleanup=0, # accept=62.98.198.1,cookie=${NX_COOKIE}, # id=giulietta.nomachine.com-1098-6A4649FD0FCA57FAC275AF3F1C45B10F, # media=1:1098 # #NX_HOST="nx/nx,link=lan,pack=no-pack,keybd=1,samba=1,cups=1,limit=0,\ #accept=127.0.0.1,cookie=${NX_COOKIE},errors=${NX_ROOT}/C-${NX_PORT}/session" #NX_HOST="nx/nx,link=lan,pack=16m-jpeg-9,keybd=1,samba=1,cups=1,limit=0,\ #accept=127.0.0.1,cookie=${NX_COOKIE},errors=${NX_ROOT}/C-${NX_PORT}/session" #NX_HOST="nx/nx,cache=8192k,link=modem,keybd=1,samba=1,cups=1,limit=0,\ #connect=127.0.0.1,cookie=${NX_COOKIE},errors=${NX_ROOT}/C-${NX_PORT}/session" NX_HOST="nx/nx,link=lan,pack=16m-jpeg-9,keybd=1,samba=1,cups=1,limit=0,\ accept=127.0.0.1,cookie=${NX_COOKIE},errors=${NX_ROOT}/C-${NX_PORT}/session" echo "${NX_HOST}:${NX_PORT}" >"${NX_ROOT}/C-${NX_PORT}/options" # # Run the local proxy impersonating the X display. # echo "Running the X client side NX proxy." #valgrind -v --num-callers=8 --error-limit=no --trace-children=no \ #valgrind --tool=memcheck --track-fds=yes \ nxproxy -C "nx/nx,options=${NX_ROOT}/C-${NX_PORT}/options:${NX_PORT}" \ 2>>"${NX_ROOT}/C-${NX_PORT}/session" & # # The X server side proxy will forward the connection # to the original DISPLAY. # # # These are the nxproxy options used to run a typical session. # # cookie=${NX_COOKIE},root=/home/pinzari/.nx,media=32824, # session=kde_on_giulietta,id=giulietta.nomachine.com-1098-6A4649FD0FCA57FAC275AF3F1C45B10F, # connect=giulietta.nomachine.com:1098 # NX_HOST="nx/nx,keybd=1,samba=1,cups=1,connect=localhost,cookie=${NX_COOKIE},errors=${NX_ROOT}/S-${NX_PORT}/session" echo "${NX_HOST}:${NX_PORT}" >"${NX_ROOT}/S-${NX_PORT}/options" echo "Running the X server side NX proxy." #cachegrind -v --dumps=100000000 \ #cachegrind -v \ #valgrind -v --leak-check=yes --leak-resolution=high --show-reachable=yes \ # --show-reachable=yes --suppressions=nxproxy/nxproxy.supp \ # --weird-hacks=lax-ioctls --num-callers=8 --logfile-fd=2 \ nxproxy -S "nx/nx,options=${NX_ROOT}/S-${NX_PORT}/options:${NX_PORT}" \ 2>>"${NX_ROOT}/S-${NX_PORT}/session" & echo "Session running on display :${NX_PORT}." nx-libs-3.5.99.23/testscripts/run-nxproxy2nxproxy-over-sockets0000755000000000000000000001237713614532331021343 0ustar #!/bin/bash set -e #/**************************************************************************/ #/* */ #/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ #/* Copyright (c) 2015-2016 Mike Gabriel */ #/* */ #/* NXSCRIPTS, NX protocol compression and NX extensions to this software */ #/* are copyright of the aforementioned persons and companies. */ #/* */ #/* Redistribution and use of the present software is allowed according */ #/* to terms specified in the file LICENSE.nxcomp which comes in the */ #/* source distribution. */ #/* */ #/* All rights reserved. */ #/* */ #/* NOTE: This software has received contributions from various other */ #/* contributors, only the core maintainers and supporters are listed as */ #/* copyright holders. Please contact us, if you feel you should be listed */ #/* as copyright holder, as well. */ #/* */ #/**************************************************************************/ # # Uncomment this to enable echo. # set -x # ulimit -c "unlimited" NX_PORT="6" NX_SYSTEM="${HOME}/.nx" NX_ROOT="${HOME}/.nx" mkdir -p "${NX_ROOT}" # # This should be randomly generated. # NX_COOKIE="$(xauth -n list |grep "${HOSTNAME}/unix:${NX_PORT}" | grep 'MIT' | cut -f '5' -d ' ' | head -n1)" [[ -z "$NX_COOKIE" ]] && NX_COOKIE="$(mcookie)" # # Create the directories for the NX session. # rm -rf "${NX_ROOT}/C-${NX_PORT}" || exit mkdir -p "${NX_ROOT}/C-${NX_PORT}" || exit rm -rf "${NX_ROOT}/S-${NX_PORT}" || exit mkdir -p "${NX_ROOT}/S-${NX_PORT}" || exit # # Set the path to libraries and NX executables. # LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${HOME}/NX/nxcomp:${HOME}/NX/nxcompext:${HOME}/NX/nx-X11/exports/lib" export LD_LIBRARY_PATH PATH="${PATH}:${HOME}/NX/nxclient/nxclient:${HOME}/NX/nx-X11/programs/Xserver/" export PATH # # Create the fake cookie for this display. # echo "Creating the X authorization cookie." xauth add "${HOSTNAME}/unix:${NX_PORT}" "MIT-MAGIC-COOKIE-1" "${NX_COOKIE}" xauth add "${HOSTNAME}:${NX_PORT}" "MIT-MAGIC-COOKIE-1" "${NX_COOKIE}" function urlencode() { echo "$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$1")" } # # Options are written in a file 'options' in the session # directory. The agent will use the DISPLAY settings, so # we pass in the DISPLAY the name of the options file. # # cache=8M,images=32M,link=modem,type=unix-kde,cleanup=0, # accept=62.98.198.1,cookie=${NX_COOKIE}, # id=giulietta.nomachine.com-1098-6A4649FD0FCA57FAC275AF3F1C45B10F, # media=1:1098 # #NX_HOST="nx/nx,link=lan,pack=no-pack,keybd=1,samba=1,cups=1,limit=0,\ #accept=127.0.0.1,cookie=${NX_COOKIE},errors=${NX_ROOT}/C-${NX_PORT}/session" #NX_HOST="nx/nx,link=lan,pack=16m-jpeg-9,keybd=1,samba=1,cups=1,limit=0,\ #accept=127.0.0.1,cookie=${NX_COOKIE},errors=${NX_ROOT}/C-${NX_PORT}/session" #NX_HOST="nx/nx,cache=8192k,link=modem,keybd=1,samba=1,cups=1,limit=0,\ #connect=127.0.0.1,cookie=${NX_COOKIE},errors=${NX_ROOT}/C-${NX_PORT}/session" #NX_HOST="nx/nx,link=lan,pack=16m-jpeg-9,keybd=1,samba=1,cups=1,limit=0,\ #accept=127.0.0.1,cookie=${NX_COOKIE},errors=${NX_ROOT}/C-${NX_PORT}/session" NX_HOST="nx/nx,link=lan,pack=16m-jpeg-9,keybd=1,samba=1,cups=1,limit=0,\ listen=$(urlencode "unix:${NX_SYSTEM}/C-${NX_PORT}/proxy.socket"),cookie=${NX_COOKIE},errors=${NX_ROOT}/C-${NX_PORT}/session" echo "${NX_HOST}:${NX_PORT}" >"${NX_ROOT}/C-${NX_PORT}/options" # # Run the local proxy impersonating the X display. # echo "Running the X client side NX proxy." #valgrind -v --num-callers=8 --error-limit=no --trace-children=no \ #valgrind --tool=memcheck --track-fds=yes \ nxproxy -C "nx/nx,options=${NX_ROOT}/C-${NX_PORT}/options:${NX_PORT}" \ 2>>"${NX_ROOT}/C-${NX_PORT}/session" & # # The X server side proxy will forward the connection # to the original DISPLAY. # # # These are the nxproxy options used to run a typical session. # # cookie=${NX_COOKIE},root=/home/pinzari/.nx,media=32824, # session=kde_on_giulietta,id=giulietta.nomachine.com-1098-6A4649FD0FCA57FAC275AF3F1C45B10F, # connect=giulietta.nomachine.com:1098 # NX_HOST="nx/nx,keybd=1,samba=1,cups=1,connect=$(urlencode "unix:${NX_SYSTEM}/C-${NX_PORT}/proxy.socket"),cookie=${NX_COOKIE},errors=${NX_ROOT}/S-${NX_PORT}/session" echo "${NX_HOST}:${NX_PORT}" >"${NX_ROOT}/S-${NX_PORT}/options" echo "Running the X server side NX proxy." #cachegrind -v --dumps=100000000 \ #cachegrind -v \ #valgrind -v --leak-check=yes --leak-resolution=high --show-reachable=yes \ # --show-reachable=yes --suppressions=nxproxy/nxproxy.supp \ # --weird-hacks=lax-ioctls --num-callers=8 --logfile-fd=2 \ nxproxy -S "nx/nx,options=${NX_ROOT}/S-${NX_PORT}/options:${NX_PORT}" \ 2>>"${NX_ROOT}/S-${NX_PORT}/session" & echo "Session running on display :${NX_PORT}." nx-libs-3.5.99.23/testscripts/slave-agent0000755000000000000000000001673413614532331015045 0ustar #!/usr/bin/perl -w #/**************************************************************************/ #/* */ #/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ #/* */ #/* NXSCRIPTS, NX protocol compression and NX extensions to this software */ #/* are copyright of the aforementioned persons and companies. */ #/* */ #/* Redistribution and use of the present software is allowed according */ #/* to terms specified in the file LICENSE.nxcomp which comes in the */ #/* source distribution. */ #/* */ #/* All rights reserved. */ #/* */ #/* NOTE: This software has received contributions from various other */ #/* contributors, only the core maintainers and supporters are listed as */ #/* copyright holders. Please contact us, if you feel you should be listed */ #/* as copyright holder, as well. */ #/* */ #/**************************************************************************/ # This is a test script for the slave channel feature. While there are no # particular requirements for the slave channel command, what makes the most # sense is to use the feature to run some sort of multiplexer. # # This script contains functionality intended to test the channel's bandwidth, # latency and integrity. # # Usage: # Set NX_SLAVE_CMD to this script and enable the slave channel # # Run: # nxproxy [...] slave=12000 # nxagent -display nx/nx,options=nxagent.conf # slave=22000 in nxagent.conf # # Where 12000 and 22000 are example TCP ports the program will listen on. # # For ease of debugging and running both sides on a single machine, the script # reacts to its own name and changes the prompt to "Proxy" if $0 contains # "proxy", or "Agent" if it contains "agent". This has no other effect. # # use strict; use POSIX ":sys_wait_h"; my $me = "?"; my $EXIT; $| = 1; if ( $0 =~ /proxy/i ) { $me = "Proxy"; } elsif ( $0 =~ /agent/i ) { $me = "Agent"; } else { $me = $0; } print "$me slave. "; if ( scalar @ARGV ) { print "Called with arguments: " . join(' ', @ARGV) . "\n\n"; } else { print "Called without arguments.\n\n"; } my %commands; register('quit' , \&cmd_quit , "Exit."); register('fork' , \&cmd_fork , "Test forking a child process."); register('exec' , \&cmd_exec , "Test calling another process via exec."); register('system' , \&cmd_system , "Test calling another process via system."); register('echo' , \&cmd_echo , "Echo text after the command. Tests channel latency."); register('blkecho' , \&cmd_blkecho, "Echo data by 1k blocks. Tests channel integrity."); register('reexec' , \&cmd_reexec , "Reexecute slave handler."); register('chargen' , \&cmd_chargen, "Output characters forever. Tests channel throughput."); register('randgen' , \&cmd_randgen, "Output random characters forever. Tests channel throughput."); register('discard' , \&cmd_discard, "Accept characters forever. Tests channel throughput."); register('fastgen' , \&cmd_fastgen, "Output a single character forever. Tests channel throughput."); register('env' , \&cmd_env , "Dump the environment."); register('help' , \&cmd_help , "Shows this help."); register('pwd' , \&cmd_pwd , "Print working directory."); cmd_help(); #print "$me> "; my $line; while(!$EXIT) { print "$me> "; # Buffered IO screws things up my $c=""; $line = ""; while($c ne "\n") { my $ret = sysread(STDIN, $c, 1); if (!defined $ret) { die "Read failed: $!"; } if (!$ret) { last; } $line .= $c; } chomp $line; $line =~ s/\r+$//; $line =~ s/\n+$//; next unless ( $line ); my ($cmd, @args) = split(/\s+/, $line); if ( exists $commands{$cmd} ) { $commands{$cmd}->{handler}->( @args ); } else { print "Unknown command: '$cmd'\n"; } } print "$me slave terminated.\n"; sub register { my ($name, $handler, $desc) = @_; $commands{$name} = { handler => $handler, desc => $desc }; } sub cmd_quit { $EXIT = 1; } sub cmd_echo { my (@args) = @_; print "You said: '" . join(' ', @args) . "'\n\n"; } sub cmd_blkecho { my $size = shift // 1024; unless ($size =~ /^\d+/ ) { print "The argument must be a number\n\n"; return; } my $buf; while(1) { my ($tmp, $ret); $buf = ""; while(length($buf) < $size) { $ret = sysread(STDIN, $tmp, $size - length($buf)); if ( !defined $ret ) { die "Error reading from socket: $!"; } last if ( $ret == 0 ); $buf .= $tmp; } my $written =0; while($written < $size) { my $ret = syswrite(STDOUT, $buf, $size, $written); if (!defined $ret) { die "Error writing to socket: $!"; } last if ( $ret == 0); $written += $ret; } } } sub cmd_reexec { print "Will now re-execute: $0 " . join(' ', @ARGV) . "\n"; exec($0, @ARGV); } sub cmd_exec { print "Will now exec: uname -a\n"; exec("uname", "-a"); } sub cmd_system { print "Will now call: uptime\n"; system("uptime"); print "\n"; } # Forks off a short lived process sub cmd_fork { my $pid = fork(); if ( $pid == 0 ) { print "I am the child, with pid $$. Waiting 10 seconds.\n"; sleep(10); print "Child exiting with code 123\n"; exit(123); } else { print "I am the parent, my child is $pid\n"; my $dead = waitpid($pid, 0); print "Reaped child $pid, return $dead\n"; } print "\n"; } sub cmd_help { print "Commands:\n"; for my $cmd ( sort keys %commands ) { print "\t$cmd" . ( " " x (10 - length($cmd))) . ": " . $commands{$cmd}->{desc} . "\n"; } print "\n"; } # Output a single character really fast. # Used to test bandwidth and integrity sub cmd_fastgen { my $char = chr(shift // ord("x")); my $buf = ($char x 72) . "\n"; while( syswrite(STDOUT, $buf) ) { 1; } } # Output RFC 864 chargen. # Used to test bandwidth sub cmd_chargen { my $text = ""; for(my $i=33;$i<33+95;$i++) { $text .= chr($i); } my $pos = 0; my $strlen = 72; while( 1 ) { my $out = substr($text, $pos, $strlen); if ( $pos + $strlen > length($text) ) { $out .= substr($text, 0, $pos + $strlen - length($text) + 1); } $out .= "\n"; syswrite(STDOUT, $out) or return; if ( ++$pos >= length($text) ) { $pos=0; } } } # Output random data # Used to test channel integrity and bandwidth with incompressible content. # Typically slower than chargen/fastgen. sub cmd_randgen { if ( open(my $fh, '<', '/dev/urandom') ) { my $buf; while(1) { sysread($fh, $buf, 1024); syswrite(STDOUT, $buf) or return; } } else { print "Failed to open /dev/urandom: $!. May not be available on this architecture.\n\n"; } } # Accept arbitrary data # Used to test bandwidth sub cmd_discard { my $buf = ""; while( sysread(STDIN, $buf, 1024) ) { 1; } } # Dump the environment sub cmd_env { my $longest = 0; foreach my $var (keys %ENV) { if ( $longest < length($var) ) { $longest = length($var); } } foreach my $var (sort keys %ENV) { print "$var" . (" " x ($longest - length($var))) . ": $ENV{$var}\n"; } print "\n"; } # Show the current directory sub cmd_pwd { require Cwd; import Cwd; print "Current directory: " . getcwd() . "\n\n"; } nx-libs-3.5.99.23/testscripts/slave-client0000755000000000000000000002423613614532331015221 0ustar #!/usr/bin/perl -w #/**************************************************************************/ #/* */ #/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ #/* */ #/* NXSCRIPTS, NX protocol compression and NX extensions to this software */ #/* are copyright of the aforementioned persons and companies. */ #/* */ #/* Redistribution and use of the present software is allowed according */ #/* to terms specified in the file LICENSE.nxcomp which comes in the */ #/* source distribution. */ #/* */ #/* All rights reserved. */ #/* */ #/* NOTE: This software has received contributions from various other */ #/* contributors, only the core maintainers and supporters are listed as */ #/* copyright holders. Please contact us, if you feel you should be listed */ #/* as copyright holder, as well. */ #/* */ #/**************************************************************************/ use strict; use Getopt::Long; use IO::Socket; use Time::HiRes qw(gettimeofday tv_interval sleep ); use IO::Socket::INET; my ($opt_batch, $opt_count, $opt_host, $opt_port, $opt_debug, $opt_blocksize, $opt_dump, $opt_delay); my ($cmd_echo, $cmd_pingbench, $cmd_rand_read_bench, $cmd_fast_read_bench, $cmd_fast_write_bench); my ($cmd_rand_write_bench, $cmd_fast_echo_bench, $cmd_rand_echo_bench, $cmd_all_bench); my ($cmd_char_write_bench, $cmd_char_read_bench); my ($cmd_help); $opt_host = "127.0.0.1"; $opt_count = 10000; $opt_blocksize = 1024; $opt_delay = 0; Getopt::Long::Configure ("bundling"); GetOptions( "d|dump" => \$opt_dump, "c|count=i" => \$opt_count, "H|host=s" => \$opt_host, "P|port=i" => \$opt_port, "D|debug" => \$opt_debug, "e|delay=f" => \$opt_delay, "b|blocksize=i" => \$opt_blocksize, "E|echo=s" => \$cmd_echo, "pingbench" => \$cmd_pingbench, "randreadbench" => \$cmd_rand_read_bench, "fastreadbench" => \$cmd_fast_read_bench, "fastwritebench" => \$cmd_fast_write_bench, "randwritebench" => \$cmd_rand_write_bench, "fastechobench" => \$cmd_fast_echo_bench, "randechobench" => \$cmd_rand_echo_bench, "charwritebench" => \$cmd_char_write_bench, "charreadbench" => \$cmd_char_read_bench, "a|allbench" => \$cmd_all_bench, "h|help" => \$cmd_help, ) or die "Getopt failed"; if ($cmd_help) { print < [options] NX Slave Channel demo, benchmark and tester. Options: -b, --blocksize=INT Block size for testing. 1024 bytes by default. -c, --count=NUM Number of blocks or pings to issue. -D, --debug Output protocol data for debugging -d, --dump Dump benchmark data in tab separated format, for graphing. -e, --delay=FLOAT Delay between blocks or pings. None by default. -H, --host=HOST Host to connect to. 'localhost' by default. -P, --port=PORT Port to connect to. Mandatory. Benchmarks: -a, --allbench Run all the benchmarks --fastechobench Benchmark sending a single repeated character, and receiving it back. --fastreadbench Benchmark reading a single repeated character. --fastwritebench Benchmark writing a single repeated character. --pingbench Benchmark ping time. --randechobench Benchmark sending random data, and receiving it back --randreadbench Benchmark reading random, incompressible data. --randwritebench Benchmark writing random, incompressible data. Other commands: -E, --echo=STR Send STR to the slave channel handler, and print the response. -h, --help Show this text Example: Test basic connectivity: $0 --port 42000 --echo "hi" Connect to port 42000 and run all the benchmarks: $0 --port 42000 -a HELP exit(0); } if (!$opt_port) { print STDERR "Syntax: $0 --port [arguments]\nUse $0 --help for more information.\n\n"; exit(1); } my $socket = IO::Socket::INET->new(PeerAddr => $opt_host, PeerPort => $opt_port, Proto => 'tcp'); if (!$socket) { die "Can't connect to $opt_host:$opt_port: $!"; } my @greeting = read_until_prompt(); my $sl = StatusLine->new(); my $random_fh; if ( $cmd_all_bench ) { $cmd_pingbench = 1; $cmd_rand_read_bench = 1; $cmd_fast_read_bench = 1; $cmd_fast_write_bench = 1; $cmd_rand_write_bench = 1; $cmd_fast_echo_bench = 1; $cmd_rand_echo_bench = 1; $cmd_all_bench = 1; } if ( $cmd_echo ) { send_cmd("echo $cmd_echo"); print read_until_prompt() . "\n"; } if ( $cmd_pingbench ) { my $t0 = [gettimeofday()]; for(my $i=0;$i<$opt_count;$i++) { send_cmd("echo $i"); read_until_prompt(); my $elapsed = tv_interval($t0, [gettimeofday()]); if ( $opt_dump ) { print "$elapsed\t$i\n"; } else { $sl->set("Pinged " . ($i+1) . " times, ${elapsed}s elapsed, " . $opt_count / $elapsed . "/s"); } sleep($opt_delay) if ($opt_delay>0); } $sl->show_last(); print STDERR "\n\n"; } if ( $cmd_rand_read_bench ) { read_bench("Random read", "randgen"); } if ( $cmd_fast_read_bench ) { read_bench("Fast read", "fastgen"); } if ( $cmd_fast_write_bench ) { write_bench("Fast write", "discard", sub { "x" x $opt_blocksize }, 0); } if ( $cmd_rand_write_bench ) { write_bench("Random write", "discard", \&get_random_bytes, 0); } if ( $cmd_fast_echo_bench ) { write_bench("Fast echo", "blkecho $opt_blocksize", sub { "x" x $opt_blocksize }, 1); } if ( $cmd_rand_echo_bench ) { write_bench("Random echo", "blkecho $opt_blocksize", \&get_random_bytes, 1); } if ( $cmd_char_write_bench ) { for(my $i=0;$i<=255;$i++) { write_bench("Fast write $i", "discard", sub { chr($i) x $opt_blocksize }, 0); } } if ( $cmd_char_read_bench ) { for(my $i=0;$i<=255;$i++) { read_bench("Fast read $i", "fastgen $i"); } } sub get_random_bytes { if (!$random_fh) { open($random_fh, '<', "/dev/urandom") or die "Can't open /dev/urandom: $!"; } my $buf=""; while(length($buf) < $opt_blocksize) { my $tmp; sysread($random_fh, $tmp, $opt_blocksize - length($buf)); $buf .= $tmp; } return $buf; } sub read_bench { my ($desc, $command) = @_; init(); send_cmd($command); my $t0 = [gettimeofday()]; my $bytes = 0; while($bytes < $opt_count * $opt_blocksize) { my $junk = ""; while(length($junk) < $opt_blocksize) { $junk .= read_sock($opt_blocksize - length($junk)); } $bytes += length($junk); my $elapsed = tv_interval($t0, [gettimeofday()]); if ( $opt_dump ) { print "$elapsed\t$bytes\n"; } else { $sl->set("$desc $bytes bytes, ${elapsed}s elapsed, " . sprintf("%0.3f", ($bytes / $elapsed) / (1024*1024)) . " MB/s"); } sleep($opt_delay) if ($opt_delay>0); } $sl->show_last(); print STDERR "\n\n"; } sub write_bench { my ($desc, $command, $generator, $do_read) = @_; init(); send_cmd($command); my $t0 = [gettimeofday()]; my $bytes = 0; while($bytes < $opt_count * $opt_blocksize) { my $junk = $generator->(); $bytes += length($junk); write_sock($junk); if ( $do_read ) { my $readbuf = ""; while(length($readbuf) < $opt_blocksize) { $readbuf .= read_sock($opt_blocksize-length($readbuf)); } if ( $junk ne $readbuf ) { die "Agent returned different data! Sent:\n$junk\nReceived:\n$readbuf\n"; } } my $elapsed = tv_interval($t0, [gettimeofday()]); if ( $opt_dump ) { print "$elapsed\t$bytes\n"; } else { $sl->set("$desc $bytes bytes, ${elapsed}s elapsed, " . sprintf("%0.3f", ($bytes / $elapsed) / (1024*1024)) . " MB/s"); } sleep($opt_delay) if ($opt_delay>0); } $sl->show_last(); print STDERR "\n\n"; } sub read_until_prompt { my $buf; my $tmp; my @lines; my $ret = ""; while(1) { $buf .= read_sock(1024); while ( $buf =~ /^(.*?)\n/m ) { dbg("LINE: '$1'\n"); push @lines, $1; $ret .= "$1\n"; $buf =~ s/^(.*?)\n//m; } dbg("BUF: '$buf'\n"); if ( $buf =~ /^(Agent|Proxy|\?)> / ) { dbg("PROMPT: '$buf'\n"); return wantarray ? @lines : $ret; } } } sub init { if ( $socket ) { close $socket; } $socket = IO::Socket::INET->new(PeerAddr => $opt_host, PeerPort => $opt_port, Proto => 'tcp'); if (!$socket) { die "Can't connect to $opt_host:$opt_port: $!"; } my @greeting = read_until_prompt(); } sub read_sock { my ($len) = @_; my $buf; my $ret = sysread($socket, $buf, $len); if (!defined $ret) { die "Error reading $len bytes from socket: $!"; } if ( $ret == 0 ) { die "Socket unexpectedly closed when trying to read $len bytes"; } dbg("READ: '$buf', length $ret\n"); return $buf; } sub write_sock { my ($data) = @_; dbg("SEND: '$data'\n"); my $written = 0; my $total = length($data); while($written < $total) { my $ret = syswrite($socket, $data, $total, $written); if (!$ret) { die "Error writing '$data' to socket: $!"; } if ( $ret == 0 ) { die "Socket closed when writing '$data' to socket"; } $written += $ret; } } sub send_cmd { my ($cmd) = @_; write_sock("$cmd\n"); } sub dbg { my ($str) = @_; if ( $opt_debug ) { $str =~ s/[^[:print:]\r\n\t]/./g; print STDERR $str; } } package StatusLine; use Time::HiRes qw(gettimeofday tv_interval ); sub new { my $class = shift; my $self = { prev_len => 0 }; bless $self, $class; return $self; } sub set { my ($self, $str) = @_; my $now = [gettimeofday()]; $self->{last_str} = $str; if ( !defined $self->{prev_time} || tv_interval($self->{prev_time}, $now) >= 0.1 ) { print STDERR "\r" . (" " x $self->{prev_len}) . "\r$str"; $self->{prev_len} = length($str); $self->{prev_time} = $now; } } sub clear { my ($self) = @_; undef $self->{prev_time}; $self->set(""); } sub show_last { my ($self) = @_; undef $self->{prev_time}; $self->set( $self->{last_str} ) if ( $self->{last_str} ); } nx-libs-3.5.99.23/.travis.yml0000644000000000000000000000561113614532331012423 0ustar # Use new xenial images, should yield newer compilers and packages sudo: true dist: xenial language: cpp matrix: include: - os: linux addons: apt: sources: - sourceline: 'deb http://archive.ubuntu.com/ubuntu main restricted universe multiverse' - ubuntu-toolchain-r-test packages: - cppcheck # imake - xutils-dev # X11 libaries - libxcomposite-dev - libxdamage-dev - libxfont-dev - libxinerama-dev - libxpm-dev - libxrandr-dev - libxtst-dev - x11proto-fonts-dev # soft requirements - quilt - x11-xkb-utils env: - MATRIX_EVAL="CC=gcc && CXX=g++" - STATIC_ANALYSIS="yes" fail_fast: true - os: linux addons: apt: sources: - ubuntu-toolchain-r-test packages: - g++-9 # imake - xutils-dev # X11 libaries - libxcomposite-dev - libxdamage-dev - libxfont-dev - libxinerama-dev - libxpm-dev - libxrandr-dev - libxtst-dev - x11proto-fonts-dev # soft requirements - quilt - x11-xkb-utils env: - MATRIX_EVAL="CC=gcc-9 && CXX=g++-9" - STATIC_ANALYSIS="no" - os: linux addons: apt: sources: - llvm-toolchain-xenial-3.9 packages: - clang-3.9 # imake - xutils-dev # X11 libaries - libxcomposite-dev - libxdamage-dev - libxfont-dev - libxinerama-dev - libxpm-dev - libxrandr-dev - libxtst-dev - x11proto-fonts-dev # soft requirements - quilt - x11-xkb-utils env: - MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9" - STATIC_ANALYSIS="no" - os: linux addons: apt: sources: - llvm-toolchain-xenial-8 - ubuntu-toolchain-r-test packages: - clang-8 # imake - xutils-dev # X11 libaries - libxcomposite-dev - libxdamage-dev - libxfont-dev - libxinerama-dev - libxpm-dev - libxrandr-dev - libxtst-dev - x11proto-fonts-dev # soft requirements - quilt - x11-xkb-utils env: - MATRIX_EVAL="CC=clang-8 && CXX=clang++-8" - STATIC_ANALYSIS="no" before_install: - eval "${MATRIX_EVAL}" script: # run static analysis tools - ./run-static-analysis.sh # print compiler version - ${CC} --version # build all packages - make nx-libs-3.5.99.23/VERSION0000644000000000000000000000001213614532331011350 0ustar 3.5.99.23 nx-libs-3.5.99.23/version.sh0000755000000000000000000000220713614532331012334 0ustar #!/bin/sh # Copyright (C) 2015 Mihai Moldovan # Copyright (C) 2015 Mike Gabriel # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. COMPONENT="$1" VERSION_FILE="VERSION" case "${COMPONENT}" in (1|2|3|4) :;; (*) echo "usage: $(basename ${0}) " >&2; exit 1;; esac # More than one line is not supported. VER="$(head -n "1" "${VERSION_FILE}" | cut -d"." -f"${COMPONENT}")" [ "x${VER}" = "x" ] && VER="0" printf "${VER}"